From b68622bf8e6f4b2b3015bcb9c44646b8ece19491 Mon Sep 17 00:00:00 2001 From: mvertens Date: Sun, 26 Feb 2017 14:39:35 -0700 Subject: [PATCH 0001/1973] first pass at CLM sphinx documentation --- doc/Makefile | 20 + doc/source/conf.py | 164 +++++ doc/source/index.rst | 26 + ...w-Files-to-the-build-namelist-Database.rst | 24 + .../CLM-3.1-Managing-Your-Own-Data-files.rst | 73 ++ .../CLM-3.2-Adding-Resolution-Names.rst | 45 ++ ...3-Adding-or-Changing-Default-Filenames.rst | 40 + .../adding-new-resolutions/index.rst | 18 + doc/source/users_guide/index.rst | 23 + .../users_guide/overview/getting-help.rst | 117 +++ doc/source/users_guide/overview/index.rst | 18 + .../users_guide/overview/introduction.rst | 199 +++++ .../users_guide/overview/quickstart.rst | 114 +++ .../overview/scientific_validation.rst | 78 ++ .../running-PTCLM/adding-ptclm-site-data.rst | 109 +++ .../users_guide/running-PTCLM/index.rst | 18 + .../running-PTCLM/introduction-to-ptclm.rst | 139 ++++ .../running-PTCLM/ptclm-examples.rst | 70 ++ .../users_guide/running-PTCLM/using-ptclm.rst | 222 ++++++ .../running-single-points/index.rst | 18 + .../running-pts_mode-configurations.rst | 40 + .../running-single-point-configurations.rst | 218 ++++++ ...point-and-regional-grid-configurations.rst | 51 ++ ...tellite-Phenology-Model-(CLMSP-spinup).rst | 10 + ...CLM4.5-biogeochemistry-(CLMBGC-spinup).rst | 75 ++ ...tmospheric-forcing-to-spinup-the-model.rst | 31 + ...tmospheric-forcing-to-spinup-the-model.rst | 75 ++ ...transient-historical-CO2-concentration.rst | 138 ++++ .../running-special-cases/index.rst | 22 + .../running-the-prognostic-crop-model.rst | 31 + .../running-with-irrigation.rst | 33 + .../what-is-a-special-case.rst | 12 + .../choosing-a-compset.rst | 321 ++++++++ .../customizing-the-clm-configuration.rst | 688 ++++++++++++++++++ .../customizing-the-clm-namelist.rst | 251 +++++++ .../customizing-the-datm-namelist.rst | 109 +++ .../setting-up-and-running-a-case/index.rst | 19 + doc/source/users_guide/testing/index.rst | 18 + doc/source/users_guide/testing/testing.rst | 62 ++ .../users_guide/trouble-shooting/index.rst | 15 + .../trouble-shooting/trouble-shooting.rst | 395 ++++++++++ .../building-the-clm-tools.rst | 162 +++++ .../users_guide/using-clm-tools/cprnc.rst | 29 + .../using-clm-tools/creating-domain-files.rst | 27 + ...g-input-for-surface-dataset-generation.rst | 116 +++ .../creating-surface-datasets.rst | 376 ++++++++++ .../datasts-for-observational-sites.rst | 17 + .../users_guide/using-clm-tools/index.rst | 21 + .../observational-sites-datasets.rst | 18 + .../what-are-the-clm-tools.rst | 89 +++ 50 files changed, 5004 insertions(+) create mode 100644 doc/Makefile create mode 100644 doc/source/conf.py create mode 100644 doc/source/index.rst create mode 100644 doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst create mode 100644 doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst create mode 100644 doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst create mode 100644 doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst create mode 100644 doc/source/users_guide/adding-new-resolutions/index.rst create mode 100644 doc/source/users_guide/index.rst create mode 100644 doc/source/users_guide/overview/getting-help.rst create mode 100644 doc/source/users_guide/overview/index.rst create mode 100644 doc/source/users_guide/overview/introduction.rst create mode 100644 doc/source/users_guide/overview/quickstart.rst create mode 100644 doc/source/users_guide/overview/scientific_validation.rst create mode 100644 doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst create mode 100644 doc/source/users_guide/running-PTCLM/index.rst create mode 100644 doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst create mode 100644 doc/source/users_guide/running-PTCLM/ptclm-examples.rst create mode 100644 doc/source/users_guide/running-PTCLM/using-ptclm.rst create mode 100644 doc/source/users_guide/running-single-points/index.rst create mode 100644 doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst create mode 100644 doc/source/users_guide/running-single-points/running-single-point-configurations.rst create mode 100644 doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst create mode 100644 doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst create mode 100644 doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst create mode 100644 doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst create mode 100644 doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst create mode 100644 doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst create mode 100644 doc/source/users_guide/running-special-cases/index.rst create mode 100644 doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst create mode 100644 doc/source/users_guide/running-special-cases/running-with-irrigation.rst create mode 100644 doc/source/users_guide/running-special-cases/what-is-a-special-case.rst create mode 100644 doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst create mode 100644 doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst create mode 100644 doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst create mode 100644 doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst create mode 100644 doc/source/users_guide/setting-up-and-running-a-case/index.rst create mode 100644 doc/source/users_guide/testing/index.rst create mode 100644 doc/source/users_guide/testing/testing.rst create mode 100644 doc/source/users_guide/trouble-shooting/index.rst create mode 100644 doc/source/users_guide/trouble-shooting/trouble-shooting.rst create mode 100644 doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst create mode 100644 doc/source/users_guide/using-clm-tools/cprnc.rst create mode 100644 doc/source/users_guide/using-clm-tools/creating-domain-files.rst create mode 100644 doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst create mode 100644 doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst create mode 100644 doc/source/users_guide/using-clm-tools/datasts-for-observational-sites.rst create mode 100644 doc/source/users_guide/using-clm-tools/index.rst create mode 100644 doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst create mode 100644 doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000000..6d3ce5f50d --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = clmdoc +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 0000000000..bdf2be569c --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,164 @@ +# -*- coding: utf-8 -*- +# +# clmdoc documentation build configuration file, created by +# sphinx-quickstart on Thu Feb 23 17:14:30 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.intersphinx', + 'sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.mathjax', + 'sphinx.ext.githubpages'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'clmdoc' +copyright = u'2017, Erik Kluzek, Bill Sacks, Ben Andre' +author = u'Erik Kluzek, Bill Sacks, Ben Andre' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'' +# The full version, including alpha/beta/rc tags. +release = u'' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'bizstyle' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'clmdocdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'clmdoc.tex', u'clmdoc Documentation', + u'Erik Kluzek, Bill Sacks, Ben Andre', 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'clmdoc', u'clmdoc Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'clmdoc', u'clmdoc Documentation', + author, 'clmdoc', 'One line description of project.', + 'Miscellaneous'), +] + + + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None} diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000000..a5ec1eb158 --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,26 @@ +.. clmdoc documentation master file, created by + sphinx-quickstart on Tue Feb 21 13:37:07 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to the CLM documentation +================================== + +This document has one major sections. + +The :ref:`CLM user's guide ` is a basic guide in utilizing CLM. + +Table of contents +----------------- + +.. toctree:: + :maxdepth: 1 + + users_guide/index.rst + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst new file mode 100644 index 0000000000..de13570b3d --- /dev/null +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst @@ -0,0 +1,24 @@ +.. _adding-resolutions: + +======================== + Adding New Resolutions +======================== + +In the last chapter we gave the details on how to create new files for input into CLM. +These files could be either global resolutions, regional-grids or even a single grid point. +If you want to easily have these files available for continued use in your development you will then want to include them in the build-namelist database so that build-namelist can easily find them for you. +You can deal with them, just by putting the settings in the ``user_nl_clm namelist`` file, or by using ``CLM_USRDAT_NAME``. +Another way to deal with them is to enter them into the database for build-namelist, so that build-namelist can find them for you. +This keeps one central database for all your files, rather than having multiple locations to keep track of files. +If you have a LOT of files to keep track of it also might be easier than keeping track by hand, especially if you have to periodically update your files. +If you just have a few quick experiments to try, for a short time period you might be best off using the other methods mentioned above. + +There are two parts to adding files to the build-namelist database. +The first part is adding new resolution names which is done in the ``models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml`` file (and in the ``models/lnd/clm/bld/config_files/config_definition.xml`` file when adding supported single-point datasets). +You can then use the new resolution by using ``CLM_USRDAT_NAME``. +If you also want to be able to give the resolution into **create_newcase** -- you'll need to add the grid to the ``scripts/ccsm_utils/Case.template/config_grid.xml`` file. + +The second part is actually adding the new filenames which is done in the ``models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml`` file (``models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml`` file for CLM tools). +If you aren't adding any new resolutions, and you are just changing the files for existing resolutions, you don't need to edit the namelist_definition file. + + diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst new file mode 100644 index 0000000000..a8ebc81ac8 --- /dev/null +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst @@ -0,0 +1,73 @@ +.. _managing-your-data-files: + +============================== + Managing Your Data Own Files +============================== + +If you are running on a supported machine (such as yellowstone or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `CESM1.2.0 Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. + +Using **link_dirtree** is quite simple, you give the directory where data exists and then the directory that you want to create where datasets will point to the original source files. In the example below we use "$HOME/inputdata", but MYCSMDATA could be any directory you have access to where you want to put your data. + +``` +> cd scripts +# First make sure you have a inputdata location that you can write to +# You only need to do this step once, so you won't need to do this in the future +# (except to bring in any updated files in the original $CSMDATA location). +> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data +> ./link_dirtree $CSMDATA $MYCSMDATA +``` + +Then when you create a case you will change ``DIN_LOC_ROOT_CSMDATA`` to point to the location you linked to rather than the default location. + +``> ./xmlchange DIN_LOC_ROOT_CSMDATA=$MYCSMDATA`` + +In order to list the files that you have created you merely need to use the UNIX command find to find the files that are NOT softlinks. So for example executing the following command: + +``> find $MYCSMDATA -type f -print`` + +for me gives the following truncated list of CLM_USRDAT_NAME files that I have created. + +``` +/glade/p/work/erik/inputdata/lnd/clm2/pftdata/pft-physiology.c130503.nc +/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-01.nc +/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-02.nc +/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-03.nc +/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-04.nc +``` + +You can also use **find** to list files that have a particular pattern in the name as well (using the -name option with wildcards). Also you can always rerun the **link_dirtree** command if any new files are added that you need to be linked into your directory tree. Since, the files are soft-links -- it doesn't take up much space other than the files that you add there. This way all of the files are kept in one place, they are organized by usage according to CESM standards, and you can easily find your own files, and CLM can find them as well. + + + +If you are running on a supported machine (such as yellowstone or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `CESM1.2.0 Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. + +Using **link_dirtree** is quite simple, you give the directory where data exists and then the directory that you want to create where datasets will point to the original source files. In the example below we use "$HOME/inputdata", but MYCSMDATA could be any directory you have access to where you want to put your data. + +``` +> cd scripts +# First make sure you have a inputdata location that you can write to +# You only need to do this step once, so you won't need to do this in the future +# (except to bring in any updated files in the original $CSMDATA location). +> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data +> ./link_dirtree $CSMDATA $MYCSMDATA +``` + +Then when you create a case you will change ``DIN_LOC_ROOT_CSMDATA`` to point to the location you linked to rather than the default location. + +``> ./xmlchange DIN_LOC_ROOT_CSMDATA=$MYCSMDATA`` + +In order to list the files that you have created you merely need to use the UNIX command find to find the files that are NOT softlinks. So for example executing the following command: + +``> find $MYCSMDATA -type f -print`` + +for me gives the following truncated list of CLM_USRDAT_NAME files that I have created. + +``` +/glade/p/work/erik/inputdata/lnd/clm2/pftdata/pft-physiology.c130503.nc +/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-01.nc +/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-02.nc +/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-03.nc +/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-04.nc +``` + +You can also use **find** to list files that have a particular pattern in the name as well (using the -name option with wildcards). Also you can always rerun the **link_dirtree** command if any new files are added that you need to be linked into your directory tree. Since, the files are soft-links -- it doesn't take up much space other than the files that you add there. This way all of the files are kept in one place, they are organized by usage according to CESM standards, and you can easily find your own files, and CLM can find them as well. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst new file mode 100644 index 0000000000..6d44f73b5b --- /dev/null +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst @@ -0,0 +1,45 @@ +.. _adding-resolution-names: + +========================= + Adding Resolution Names +========================= + +If you are adding files for new resolutions which aren't covered in the namelist_definition file -- you'll need to add them in. +The list of valid resolutions is in the id="res" entry in the ``models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml`` file. +You need to choose a name for your new resolution and simply add it to the comma delimited list of valid_values for the id="res" entry. +The convention for global Gaussian grids is number_of_latitudes x number_of_longitudes. +The convention for global finite volume grids is latitude_grid_size x longitude_grid_size where latitude and longitude is measured in degrees. +The convention for unstructured HOMME grids is nenp4, where corresponds to the resolution. +The higher is the higher the resolution. +So for example, ne60np4 is roughly half-degree while ne240np4 is roughly a eighth degree. +For regional or single-point datasets the names have a grid size number_of_latitudes x number_of_longitudes followed by an underscore and then a descriptive name such as a City name followed by an abbreviation for the Country in caps. +The only hard requirement is that names be unique for different grid files. Here's what the entry for resolutions looks like in the file: +:: + + + Horizontal resolutions + Note: 0.1x0.1, 0.5x0.5, 5x5min, 10x10min, 3x3min, 1km-merge-10min, and 0.33x0.33 are only used for CLM tools + + +As you can see you just add your new resolution names to the end of the valid_values list. + +When using PTCLM and adding supported single-point resolutions, you'll also want to add these resolutions to the ``models/lnd/clm/bld/config_files/config_definition.xml`` under the ``sitespf_pt`` name. +The entry in that file looks like: +:: + + + Flag to turn on site specific special configuration flags for supported single + point resolutions. See the specific config_defaults_*.xml file for the special + settings that are set for a particular site. + + +PTCLM assumes that any supported single-point resolutions are valid settings for ``sitespf_pt``. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst new file mode 100644 index 0000000000..c539d0fd8c --- /dev/null +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst @@ -0,0 +1,40 @@ +.. _changing-default-filenames: + +============================ + Changing Default Filenames +============================ + +To add or change the default filenames you edit the ``models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml`` and either change an existing filename or add a new one. +Most entries in the default namelist files, include different attributes that describe the different properties that describe the differences in the datasets. +Attributes include the: resolution, year to simulation, range of years to simulate for transient datafiles, the land-mask, the representative concentration pathway (rcp) for future scenarios, and the type of biogeochemistry (bgc) model used. +For example the fatmgrid for the 1.9x2.5 resolution is as follows: + +``` + +lnd/clm2/surfdata_map/surfdata_0.9x1.25_simyr1850_c130415.nc + +``` + +Other ``fsurdat`` files are distinguished from this one by their resolution (hgrid), simulation year (sim_year) and prognostic crop (crop) attributes. + + +To add or change the default filenames for CLM tools edit the ``models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml`` and either change an existing filename or add a new one. +Editing this file is similar to the ``namelist_defaults_clm4_5.xml`` talked about above. + + +---------------------------- +What are the required files? +---------------------------- + +Different types of simulations and different types of configurations for CLM require different lists of files. +The CLM4.5-BGC or Carbon Nitrogen (cn) Biogeochemistry model for example requires ``stream_fldfilename_ndep`` files, which are NOT required by CLMSP. +Transient simulations also require transient datasets, and the names of these datasets are sometimes different from the static versions (sometimes both are required as in the dynamic PFT cases). + + +In the following table we list the different files used by CLM, they are listed in order of importance, dependencies, and customizing. +So the required files are all near the top, and the files used only under different conditions are listed later, and files with the fewest dependencies are near the top, as are the files that are least likely to be customized. + + +Table 3-1. Required Files for Different Configurations and Simulation Types +--------------------------------------------------------------------------- +Insert table 3-1 diff --git a/doc/source/users_guide/adding-new-resolutions/index.rst b/doc/source/users_guide/adding-new-resolutions/index.rst new file mode 100644 index 0000000000..c01aa36ca0 --- /dev/null +++ b/doc/source/users_guide/adding-new-resolutions/index.rst @@ -0,0 +1,18 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _adding-new-resolutions-section: + +##################################### +Adding New Resolutions +##################################### + +.. toctree:: + :maxdepth: 2 + + CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst + CLM-3.1-Managing-Your-Own-Data-files.rst + CLM-3.2-Adding-Resolution-Names.rst + CLM-3.3-Adding-or-Changing-Default-Filenames.rst diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst new file mode 100644 index 0000000000..510d4b22a2 --- /dev/null +++ b/doc/source/users_guide/index.rst @@ -0,0 +1,23 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _users-guide: + +##################################### +CLM User's Guide +##################################### + +.. toctree:: + :maxdepth: 2 + :numbered: + + overview/index.rst + setting-up-and-running-a-case/index.rst + using-clm-tools/index.rst + adding-new-resolutions/index.rst + running-special-cases/index.rst + running-single-points/index.rst + running-PTCLM/index.rst + trouble-shooting/index.rst diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst new file mode 100644 index 0000000000..fb5069226b --- /dev/null +++ b/doc/source/users_guide/overview/getting-help.rst @@ -0,0 +1,117 @@ +.. _getting-help: + +============== + Getting Help +============== +In addition to this users-guide there are several other resources that are available to help you use CLM4.5. The first one is the CESM1.2.0 User's-Guide, which documents the entire process of creating cases with CESM1.2.0. The next is the CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in CESM1.2.0. + +--------------------------- +The CESM User's-Guide +--------------------------- + +CLM4.5 in CESM1.2.0 is always run from within the standard CESM1.2.0 build and run scripts. Therefore, the user of CLM4.5 should familiarize themselves with the CESM1.2.0 scripts and understand how to work with them. User's-Guide documentation on the CESM1.2.0 scripts are available from the following web-page. The purpose of this CLM4.5 in CESM1.2.0 User's Guide is to give the CLM4.5 user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the CESM1.2.0 Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. + +`cesmrel; Scripts User's-Guide (http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/book1.html) `_ + +----------------------- +The CESM Bulletin Board +----------------------- + +There is a rich and diverse set of people that use the CESM, and often it is useful to be in contact with others to get help in solving problems or trying something new. To facilitate this we have an online Bulletin Board for questions on the CESM. There are also different sections in the Bulletin Board for the different component models or for different topics. + +`CESM Online Bulletin Board `_ + +----------------- +The CLM web pages +----------------- + +The main CLM web page contains information on the CLM, it's history, developers, as well as downloads for previous model versions. There are also documentation text files in the models/lnd/clm/doc directory that give some quick information on using CLM. + +`CLM web page `_ +`CLM Documentation Text Files `_ + +Also note that several of the XML database files can be viewed in a web browser to get a nice table of namelist options, namelist defaults, or compsets. Simply view them as a local file and bring up one of the following files: + +- `models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml `_ -- definition of CLM4.0 namelist items. +- `models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml `_ -- definition of CLM4.0 namelist items. +- `models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml `_ -- default values for CLM4.0 namelist items. +- `models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml `_ -- default values for CLM4.5 namelist items. +- `scripts/ccsm_utils/Case.template/config_definition.xml `_ -- definition of all env_*.xml items. +- `scripts/ccsm_utils/Case.template/config_compsets.xml `_ -- definition of all the compsets. +- `models/lnd/clm/bld/namelist_files/history_fields_clm4_0.xml `_ -- definition of CLM4.0 history fields. +- `models/lnd/clm/bld/namelist_files/history_fields_clm4_5.xml `_ -- definition of CLM4.5 history fields. + +------------------------ +Reporting bugs in CLM4.5 +------------------------ + +If you have any problems, additional questions, bug reports, or any other feedback, please send an email to <`cesmhelp@cgd.ucar.edu `_>. If you find bad, wrong, or misleading information in this users guide send an email to <`erik@ucar.edu `_>. The current list of known issues for CLM4.5 in CESM1.2.0 is in the models/lnd/clm/doc/KnownBugs file, and the list of issues for CESM1.2.0 is at... +`http://www.cesm.ucar.edu/models/cesm1.2//tags/cesm1_2_0/#PROBLEMS `_. + +--------------------------------------- +Some Acronym's and Terms We'll be Using +--------------------------------------- + +CAM + Community Atmosphere Model (CAM). The prognostically active atmosphere model component of CESM. + +CESM + Community Earth System Model (CESM). The coupled earth system model that CLM is a component of. + +CLM + Community Land Model (CLM). The prognostically active land model component of CESM. + +CLMBGC + Community Land Model (CLM4.5) with BGC Biogeochemistry. Uses CN Biogeochemistry with vertically resolved soil Carbon, CENTURY model like pools, and Nitrification/De-Nitrification. The CLM_CONFIG_OPTS option for this is + + ``./xmlchange CLM_CONFIG_OPTS="phys clm4_5 -bgc cn -vsoilc_centbgc on -clm4me on"`` + +CLMCN + Community Land Model (CLM) with Carbon Nitrogen (CN) Biogeochemistry (either CLM4.0 or CLM4.5) The CLM_CONFIG_OPTS option for this is + + ``./xmlchange CLM_CONFIG_OPTS="-bgc cn" -append`` + +CLMSP + Community Land Model (CLM) with Satellite Phenology (SP) (either CLM4.0 or CLM4.5) The CLM_CONFIG_OPTS option for this is + + ``./xmlchange CLM_CONFIG_OPTS="-bgc none" -append`` + +CLMU + Community Land Model (CLM) Urban Model (either CLM4.0 or CLM4.5). The urban model component of CLM is ALWAYS active (unless you create special surface datasets that have zero urban percent, or for regional/single-point simulations for a non-urban area). + +CRUNCEP + The Climate Research Unit (CRU) analysis of the NCEP atmosphere reanalysis atmosphere forcing data. This can be used to drive CLM with atmosphere forcing from 1901 to 2010. We also DO expect to be able to update this dataset beyond 2010 as newer data becomes available. + +DATM + Data Atmosphere Model (DATM) the prescribed data atmosphere component for CESM. Forcing data that we provide are either the Qian or CRUNCEP forcing datasets (see below). + +DV + Dynamic global vegetation, where fractional PFT (see PFT below) changes in time prognostically. Can NOT be used with prescribed transient PFT (requires either CLM4.5-BGC or CLMCN for either CLM4.0 or CLM4.5). The CLM_CONFIG_OPTS option for this is + + ``./xmlchange CLM_CONFIG_OPTS="-bgc cndv" -append`` + +ESMF + Earth System Modeling Framework (ESMF). They are a software project that provides a software library to support Earth System modeling. We provide interfaces for ESMF as well as use their regridding capabilities for offline CLM tools. + +NCAR + National Center for Atmospheric Research (NCAR). This is the research facility that maintains CLM with contributions from other national labs and Universities. + +NCEP + The National Center for Environmental Prediction (NCEP). In this document this normally refers to the reanalysis atmosphere data produced by NCEP. + +PFT + Plant Function Type (PFT). A type of vegetation that CLM parameterizes. + +PTCLM + PoinT CLM (PTCLM) a python script that operates on top of CLM for CLM4.5 to run single point simulations for CLM. + +Qian + The Qian et. al. analysis of the NCEP forcing data. This can be used to drive CLM with atmosphere forcing from 1948 to 2004. We do NOT expect to be able to update this dataset beyond 2004. + +SCRIP + Spherical Coordinate Remapping and Interpolation Package (SCRIP). We use it's file format for specifying both grid coordinates as well as mapping between different grids. + +VIC + Variable Infiltration Capacity (VIC) model for hydrology. This is an option to CLM4.5 in place of the standard CLM4.5 hydrology. The CLM_CONFIG_OPTS option for this is + + ``./xmlchange CLM_CONFIG_OPTS="-vichydro on" -append`` diff --git a/doc/source/users_guide/overview/index.rst b/doc/source/users_guide/overview/index.rst new file mode 100644 index 0000000000..1f31037460 --- /dev/null +++ b/doc/source/users_guide/overview/index.rst @@ -0,0 +1,18 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _overview_section: + +##################################### +Overview +##################################### + +.. toctree:: + :maxdepth: 2 + + introduction.rst + quickstart.rst + scientific_validation.rst + getting-help.rst diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst new file mode 100644 index 0000000000..37eb0cb82d --- /dev/null +++ b/doc/source/users_guide/overview/introduction.rst @@ -0,0 +1,199 @@ +.. _introduction: + +============== +Introduction +============== + +The Community Land Model (CLM4.5 in CESM1.2.0) is the latest in a +series of global land models developed by t he CESM Land Model Working +Group (LMWG) and maintained at the National Center for Atmospheric +Research (NCAR). This guide is intended to instruct both the novice +and experienced user on running CLM. This guide pertains to the latest +version CLM4.5 in CESM1.2.0 available for download from the public +release subversion repository as a part of CESM1.2.0. Documentation +may be different if you are using an older version, you should either +use the documentation for that release version, update to the latest +version, or use the documentation inside your own source tree. There +is information in the ChangeLog file and in the `What is new with +CLM4.5 in CESM1.2.0 since previous public releases? `_ +regarding the changes from previous versions of CESM. + +.. note:: This release of CLM4.5 in CESM1.2.0 includes BOTH CLM4.0 + physics used in previous releases as well as the updated CLM4.5 + physics. Both CLM as well as CLM support tools allow you to trigger + between the two physics modes. Most often when we refer to CLM4.0 we + are referring to the CLM4.0 physics in CLM4.5 in CESM1.2.0 rather + than to a specific version of CLM4.0 (where we would give the exact + version). Likewise, when referring to CLM4.5 we are referring to the + CLM4.5 physics in CLM4.5 in CESM1.2.0. + +The novice user should read `Chapter 1 `_ in detail before +beginning work, while the expert user should read `What is new with +CLM4.5 in CESM1.2.0 since previous public releases? `_ and +`Quickstart to using CLM4.5 `_ chapters, and then use the +more detailed chapters as reference. Before novice users go onto more +technical problems covered in `Chapter 2 `_, `Chapter 3 +`_, `Chapter 4 `_, or `Chapter 5 `_ they +should know the material covered in `Chapter 1 `_ and be able +to replicate some of the examples given there. + +All users should read the `How to Use This Document `_ and +`Other resources to get help from `_ sections to understand +the document conventions and the various ways of getting help on using +CLM4.5. Users should also read the `What is scientifically validated +and functional in CLM4.5 in CESM1.2.0? `_ section to see if +their planned use of the model is something that has been +scientifically validated and well tested. Users that are NOT using +NCAR machines or our list of well tested machines should also read the +What are the UNIX utilities required to use CLM4.5? section to make +sure they have all the required UNIX utilities on the system they want +to do their work. + +Developers that are making changes to CLM either for their own +development or for development that they hope will eventually become a +part of the main CLM should read the `Chapter 8 `_ +chapter. We have a suite of test scripts that automatically test many +different model configurations and namelist options, as well as +ensuring things like restarts are bit-for-bit and the like. It's +helpful to use these scripts to ensure your changes are working +correctly. As well as being a required part of the process to bring in +new code developments. And it's far easier to use the automated +scripts rather than having to figure out, what to test, how to do it, +and then finally do it by hand. If you are using non supported +machines you may also want to use the test scripts to make sure your +machine is working correctly. + +.. _what-is-new-with-clm4.5: + +========================= + What is New with CLM4.5 +========================= + +The CESM1.2.0 `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. +More details are given in the `CLM ChangeLog file `_. + +Previous release pages give similar list of changes for previous versions of the model. +The `CLM4 in CESM1.0.5 User's Guide `_ gives information on the updates for versions up to CLM4 in CESM1.0.5. + +.. _users-guide-overview: + +========================== + Overview of User's Guide +========================== + +In this introduction we first give a simple guide to understand the document conventions in `How to Use This Document `_. +The next section `What is new with CLM4.5 in CESM1.2.0 since previous public releases? `_ gives references to describe the differences between CLM4.5 in CESM1.2.0 and previous CESM releases both from a scientific as well as a software engineering point of view. +For information on previous releases of CLM4.5 before CLM4.5 in CESM1.2.0 see the CESM1.1.1 documentation. +The next section `Quickstart to using CLM4.5 `_ is for users that are already experts in using CLM and gives a quickstart guide to the bare details on how to use CLM4.5. +The next `What is scientifically validated and functional in CLM4.5 in CESM1.2.0? `_ tells you about what has been extensively tested and scientifically validated (and maybe more importantly) what has NOT. +`What are the UNIX utilities required to use CLM4.5? `_ lists the UNIX utilities required to use CLM4.5 and is important if you are running on non-NCAR machines, generic local machines, or machines NOT as well tested by us at NCAR. +Next we have `Important Notes and Best Practices for Usage of CLM4.5 `_ to detail some of the best practices for using CLM4.5 for science. +The last introductory section is `Other resources `_ to get help from which lists different resources for getting help with CESM1.0 and CLM4.5. + +`Chapter 1 `_ goes into detail on how to setup and run simulations with CLM4.5 and especially how to customize cases. +Details of cesm_setup modes and build-namelist options as well as namelist options are given in this chapter. + +`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.0 or CLM4.5 physics for creating input datasets for use by CLM, for the expert user. +There's an overview of what each tool does, and some general notes on how to build the FORTRAN tools. +Then each tool is described in detail along with different ways in which the tool might be used. +A final section on how to customize datasets for observational sites for very savvy expert users is given as the last section of this chapter. + +As a followup to the tools chapter, `Chapter 3 `_ tells how to add files to the XML database for build-namelist to use. +This is important if you want to use the XML database to automatically select user-created input files that you have created when you setup new cases with CLM (both CLM4.0 and CLM4.5 physics). + +In `Chapter 4 `_, again for the expert user, we give details on how to do some particularly difficult special cases. +For example, we give the protocol for spinning up the CLM4.5-BGC and CLMCN models as well as CLM with dynamic vegetation active (CNDV). +We give instructions to do a spinup case from a previous case with Coupler history output for atmospheric forcing. +We also give instructions on running both the prognostic crop and irrigation models. +Lastly we tell the user how to use the DATM model to send historical CO2 data to CLM. + +`Chapter 5 `_ outlines how to do single-point or regional simulations using CLM4.5. +This is useful to either compare CLM4.5 simulations with point observational stations, such as tower sites (which might include your own atmospheric forcing), or to do quick simulations with CLM for example to test a new parameterization. +There are several different ways given on how to perform single-point simulations which range from simple PTS_MODE to more complex where you create all your own datasets, tying into `Chapter 2 `_ and also `Chapter 3 `_ to add the files into the build-namelist XML database. +The PTCLM python script to run single-point simulations was added back in for this release (but it has bugs that don't allow it to work out of the box). +CLM4 in CESM1.0.5 has a fully working versions of PTCLM. + +Need `Chapter 6 `_ blurb... + +`Chapter 7 `_ gives some guidance on trouble-shooting problems when using CLM4.5. +It doesn't cover all possible problems with CLM, but gives you some guidelines for things that can be done for some common problems. + +`Chapter 8 `_ goes over the automated testing scripts for validating that the CLM is working correctly. +The test scripts run many different configurations and options with CLM4.0 physics as well and CLM4.5 physics making sure that they work, as well as doing automated testing to verify restarts are working correctly, and testing at many different resolutions. +In general this is an activity important only for a developer of CLM4.5, but could also be used by users who are doing extensive code modifications and want to ensure that the model continues to work correctly. + +In the appendices we talk about some issues that are useful for advanced users and developers of CLM4.5. + +Finally in `Appendix A `_ we give instructions on how to build the documentation associated with CLM4.5 (i.e. how to build this document). +This document is included in every CLM distribution and can be built so that you can view a local copy rather than having to go to the CESM website. +This also could be useful for developers who need to update the documentation due to changes they have made. + +.. _best-practices-for-usage: + +================ + Best Practices +================ + +- CLM4.5 includes BOTH the old CLM4.0 physics AND the new CLM4.5 physics and you can toggle between two. + The "standard" practice for CLM4.0 is to run with CN on, and with Qian atmospheric forcing. + While the "standard" practice for CLM4.5 is to run with BGC on, and CRUNCEP atmospheric forcing. + "BGC" is the new CLM4.5 biogeochemistry and include CENTURY-like pools, vertical resolved carbon, as well as Nitrification and de-Nitrification (see `the Section called Some Acronym's and Terms We'll be Using in Other resources to get help from `_ ). + +- When running with CLMCN (either CLM4.0 or CLM4.5 physics) or CLM4.5-BGC, it is critical to begin with initial conditions that are provided with the release or to spin the model up following the CN spinup procedure before conducting scientific runs (see `the Section called Spinning up the CLM4.5 biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for CLM4.5 or `the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4 `_ for CLM4.0). + Simulations without a proper spinup will effectively be starting from an unvegetated world. + See `the Section called Setting Your Initial Conditions File in Chapter 1 `_ for information on how to provide initial conditions for your simulation. + +- Initial condition files are provided for CLM4.0-CN as before, for fully coupled BCN and offline ICN cases for 1850 and 2000 at finite volume grids: 1deg (0.9x1.25), 2deg (1.9x2.5), and T31 resolutions. + We also have interpolated initial conditions for BCN for 1850 and 2000 for two finite volume grids: 10x15, 4x5 and two HOMME grids (ne30np4 and ne120np4). + There's also an initial condition file for ICN with the prognostic crop model for 2000 at 2deg resolution, and one with CLMSP for 2000 at 2deg resolution. + We also have initial conditions for offline CNDV for 1850. + The 1850 initial condition files are in 'reasonable' equilibrium. + The 2000 initial condition files represent the model state for the year 2000, and have been taken from transient simulations. + Therefore, by design the year 2000 initial condition files do not represent an equilibrium state. + Note also that spinning the 2000 initial conditions out to equilibrium will not reflect the best estimate of the real carbon/nitrogen state for the year 2000. + +- Initial condition files are also provided for CLM4.5 for several configurations and resolutions. + For CLM4.5-SP and CLM4.5-BGC with CRUNCEP forcing we have initial conditions at 1deg resolution for both 1850 and 2000. + The CLM4.5-BGC initial conditions for 1850 (again with CRUNCEP forcing) were also interpolated to 2deg, CRUNCEP half degree (360x720cru), and ne30np4 resolutions. + Also the CLM4.5-BGC initial conditions for 1850 (with CRUNCEP forcing) were interpolated to 1deg CLM4.5-BGC-DV and 2deg CLM4.5-BGC-Crop. + +- Users can generate initial condition files at different resolutions by using the CLM tool interpinic to interpolate from one of the provided resolutions to the resolution of interest. + Interpolated initial condition files may no longer be in 'reasonable' equilibrium. + +- In CLM4.5 for both CLM4.5-CN and CLM4.5-BGC the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). + By default we have provided a climatology dataset for lightning frequency and a dataset with coverage from 1850 to 2010 for population density. + Both of these datasets are interpolated from the native resolution of the datasets to the resolution you are running the model on. + If you are running with an atmosphere model or forcing that is significantly different than present day -- the lightning frequency may NOT appropriately correspond to your atmosphere forcing and fire initiation would be inappropriate. + +- Aerosol deposition is a required field to both CLM4.0 and CLM4.5 physics, sent from the atmosphere model. + Simulations without aerosol deposition will exhibit unreasonably high snow albedos. + The model sends aerosol deposition from the atmospheric model (either CAM or DATM). + When running with prescribed aerosol the atmosphere model will interpolate the aerosols from 2-degree resolution to the resolution the atmosphere model is running at. + +.. _how-to-use-this-document: + +======================================================== +How To Use This Document +======================================================== + +Links to descriptions and definitions have been provided in the code below. We use the same conventions used in the CESM documentation as outlined below. + +:: + + Throughout the document this style is used to indicate shell + commands and options, fragments of code, namelist variables, etc. + Where examples from an interactive shell session are presented, lines + starting with > indicate the shell prompt. A backslash "\" at the end + of a line means the line continues onto the next one (as it does in + standard UNIX shell). Note that $EDITOR" is used to refer to the + text editor of your choice. $EDITOR is a standard UNIX environment + variable and should be set on most UNIX systems. Comment lines are + signaled with a "#" sign, which is the standard UNIX comment sign as well. + $CSMDATA is used to denote the path to the inputdata directory for + your CESM data. + + > This is a shell prompt with commands \ + that continues to the following line. + > $EDITOR filename # means you are using a text editor to edit "filename" + # This is a comment line + diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst new file mode 100644 index 0000000000..f6784da2ef --- /dev/null +++ b/doc/source/users_guide/overview/quickstart.rst @@ -0,0 +1,114 @@ +.. _quickstart: + +============ + Quickstart +============ + +Running the CLM requires a suite of UNIX utilities and programs and you should make sure you have all of these available before trying to go forward with using it. +If you are missing one of these you should contact the systems administrator for the machine you wish to run on and make sure they are installed. + +List of utilities required for CESM in the "CESM1.2.0 Software/Operating System Prerequisites" section in `http://www.cesm.ucar.edu/models/cesm1.2//cesm/doc/usersguide/book1.html `_ +- UNIX bash shell (for some of the CLM tools scripts) +- NCL (for some of the offline tools for creating/modifying CLM input datasets see `Chapter 2 `_ for more information on NCL) +- Python (optional, needed for PTCLM) +- xsltproc, docbook and docbook utilities (optional, needed to build the Users-Guide) + +Before working with CLM4.5 read the QuickStart Guide in the `CESM1.2.0 Scripts User's Guide `_. Once you are familiar with how to setup cases for any type of simulation with CESM you will want to direct your attention to the specifics of using CLM. + +For some of the details of setting up cases for CLM4.5 read the README and text files available from the "models/lnd/clm/doc" directory (see the "CLM Web pages" section for a link to the list of these files). Here are the important ones that you should be familiar with. + +1. `README file `_ describing the directory structure. + +2. `Quickstart.userdatasets `_ file describing how to use your own datasets in the model (also see `the Section called Creating your own single-point/regional surface datasets in Chapter 5 `_). + +3. `models/lnd/clm/doc/KnownBugs `_ file describing known problems in CLM4.5 (that we expect to eventually fix). + +4. `models/lnd/clm/doc/KnownLimitationss `_ file describing known limitations in CLM4.5 and workarounds that we do NOT expect to fix. + +The IMPORTANT_NOTES file talks about important things for users to know about using the model scientifically. It content is given in the next chapter on `"What is scientifically validated and functional in CLM4.5 in CESM1.2.0?" `_. + +The ChangeLog/ChangeSum talk about advances in different versions of CLM. The content of these files is largely explained in the previous chapter on `"What is new with CLM4.5 in CESM1.2.0 since previous public releases?" `_. + +Note other directories have README files that explain different components and tools used when running CLM and are useful in understanding how those parts of the model work and should be consulted when using tools in those directories. For more details on configuring and customizing a case with CLM see `Chapter 1 `_. + +The Quickstart.GUIDE (which can be found in ``models/lnd/clm/doc``) is repeated here. +:: + + Quick-Start to Using cpl7 Scripts for clm4_5 + + Assumptions: You want to use yellowstone with clm4_5 BGC + to do a clm simulation with data atmosphere and the + latest CRUNCEP atm forcing files and settings. You also want to cycle + the CRUNCEP atm data between 1901 to 1920 and you want to run at + 0.9x1.25 degree resolution. + + Process: + + # Create the case + + cd scripts + + ./create_newcase -case -mach yellowstone_intel -res f09_g16 -compset I1850CRUCLM45BGC + (./create_newcase -help -- to get help on the script) + + # Setup the case + + cd + ./xmlchange id1=val1,id2=val2 # to make changes to any settings in the env_*.xml files + ./cesm_setup + (./cesm_setup -help -- to get help on the script, this creates the ./.run \ + script) + + # Add any namelist changes to the user_nl_* files + + $EDITOR user_nl_* + + # Compile the code + + ./.build + + # Submit the run + + ./.submit + +Information on Compsets: + + "I" compsets are the ones with clm and datm7 without ice and ocean. They + specify either CLM4.0 physics or CLM4.5 physics. + Most of the "I" compsets for CLM4.0 use the CLM_QIAN data with solar following + the cosine of solar zenith angle, precipitation constant, and other + variables linear interpolated in time (and with appropriate time-stamps on + the date). Useful "I" compsets for CLM4.5 use the CRUNCEP data in place + of the CLM_QIAN data. + + To list all the compsets use: + ./create_newcase -list compsets + + Some of the CLM4.5 I compsets are: + + Alias Description + 1850CRUCLM45 CLM4.5 to simulate year=1850 with CLMN45SP (Satellite Phenology) + I1850CRUCLM45BGC CLM4.5 to simulate year=1850 with CLM45BGC biogeophysics model (BGC) + I20TRCRUCLM45BGC CLM4.5 with BGC on with transient PFT over 1850-2000 + + While some of the CLM4 I compsets are: + + Alias Description + ICN CLM4.0 to simulate year=2000 with Carbon-Nitrogen BGC model (CN) + I1850CN CLM4.0 to simulate year=1850 with Carbon-Nitrogen BGC model (CN) + I20TRCN CLM4.0 with CN on with transient PFT over 1850-2000 + IRCP26CN CLM4.0 with CN on with transient PFT over 1850-2100 for RCP=2.6 scenario + IRCP45CN CLM4.0 with CN on with transient PFT over 1850-2100 for RCP=4.5 scenario + IRCP60CN CLM4.0 with CN on with transient PFT over 1850-2100 for RCP=6.0 scenario + IRCP85CN CLM4.0 with CN on with transient PFT over 1850-2100 for RCP=8.5 scenario + +Automatically resubmitting jobs: + + After doing a short simulation that you believe is correct + + ./xmlchange CONTINUE_RUN=TRUE + + # Change RESUBMIT to number greater than 0, and CONTINUE_RUN to TRUE... + + ./.submit + diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst new file mode 100644 index 0000000000..6ad113adc5 --- /dev/null +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -0,0 +1,78 @@ +.. _scientific-validiation: + +======================== + Scientific Validiation +======================== + +In this section we go over what has been extensively tested and scientifically validated with CLM4.5, and maybe more importantly what has NOT been tested and may NOT be scientifically validated. You can use all features of CLM, but need to realize that some things haven't been tested extensively or validated scientifically. When you use these features you may run into trouble doing so, and will need to do your own work to make sure the science is reasonable. + +-------------------------------------------------------------- +Standard Configuration and Namelist Options that are Validated +-------------------------------------------------------------- + +See +`http://www.cesm.ucar.edu/models/cesm1.2/clm/CLM_configurations_CESM1.2.pdf `_ for an explanation of what configurations are scientifically validated for CLM4.5. For CLM4.0 changes to the science of the model are minimal since CESM1.1.1 so we expect answers to be very similar to using it. + +In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case you will need to go through more extensive work to validate these options from a scientific standpoint. Some of these options are only for CLM4.5 while others are for both CLM4.0 AND CLM4.5 we explicitly say which they apply to. + +--------------------------------------------------------------------------------------------------------------- +Configure Modes NOT scientifically validated, documented, supported or, in some cases, even advised to be used: +--------------------------------------------------------------------------------------------------------------- + +These are options that you would add to ``CLM_CONFIG_OPTS``. + +1. exlaklayers on[CLM4.5 only] This mode is NOT tested and may NOT be even functional. + +2. snicar_frc on[CLM4.0 AND CLM4.5] This mode is tested and functional, but is NOT constantly scientifically validated, and should be considered experimental. + +3. vichydro on[CLM4.5 only] This mode is tested and functional, but does NOT have long scientific validation simulations run with it so, should be considered experimental. + +4. vsoilc_centbgc[CLM4.5 only] This option is extensively tested for both "on" and "off". The "no-vert" option has limited testing performed on it, but isn't scientifically validated (and it currently has a bug -- see 1746 and 1672 in `models/lnd/clm/doc/KnownBugs `_). The "no-cent" and "no-nitrif" options are NOT tested and as such may NOT ben even functional. + +---------------------------------------------- +Namelist options that should NOT be exercised: +---------------------------------------------- + +---------------------------------------------------- +Build-Namelist options that should NOT be exercised: +---------------------------------------------------- +1. -irrig with -bgc cn and -phys clm4_0 We have only run the irrigation model with CLMSP (i.e. without the CN model). We recommend that if you want to run the irrigation model with CN, that you do a spinup. But, more than that you may need to make adjustments to irrig_factor in models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90. See the notes on this in the description of the irrigation model in the +`Technical Descriptions of the Interactive Crop Management and Interactive Irrigation Models `_. + +2. -irrig with -crop on and -phys clm4_0 Irrigation doesn't work with the prognostic crop model. Irrigation is only applied to generic crop currently, which negates it's practical usage. We also have a known problem when both are on (see bug 1326 in the `models/lnd/clm/doc/KnownBugs `_ file). If you try to run in this mode, the CLM build-namelist will return with an error. + +-------------------------------------------- +Namelist items that should NOT be exercised: +-------------------------------------------- + +suplnitro='ALL' The suplnitro namelist option to the CN Biogeochemistry model supplies unlimited nitrogen and therefore vegetation is over-productive in this mode. + +urban_traffic:Not currently functional + +allowlakeprod:Considered experimental. + +anoxia_wtsat:Considered experimental (deprecated will be removed). + +atm_c14_filename:Considered experimental (dataset not provided). + +exponential_rooting_profile:Considered experimental. + +fin_use_fsat:Considered experimental. + +glc_dyntopo:Not currently functional. + +lake_decomp_fact:Considered experimental. + +more_vertlayers:Considered experimental. + +no_frozen_nitrif_denitrif:Considered experimental. + +perchroot:Considered experimental. + +perchroot_alt:Considered experimental. + +replenishlakec:Considered experimental. + +use_c14_bombspike:Considered experimental (dataset not provided). + +usefrootc:Considered experimental. diff --git a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst new file mode 100644 index 0000000000..81f45a038f --- /dev/null +++ b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst @@ -0,0 +1,109 @@ +.. _adding-ptclm-site-data: + +====================== +Adding PTCLM Site Data +====================== + +The "sitegroupname" option to PTCLM1.110726 looks for groups of sites in the files in the ``PTCLM_sitedata`` directory under the PTCLM directory. +You can add new names available for this option including your own lists of sites, by adding more files in this directory. +There are three files for each "sitegroupname": ``$SITEGROUP_sitedata.txt``, ``$SITEGROUP_soildata.txt`` and ``$SITEGROUP_pftdata.txt`` (where ``$SITEGROUP`` is the name that would be entered as "sitegroupname" to PTCLM). +Each file needs to have the same list of sites, but gives different information: site data, PFT data, and soil data respectively. +Although the site codes need to be the same between the three files, the files do NOT have to be in the same order. +Each file has a one-line header that lists the contents of each column which are separated by commas. +The first column for each of the files is the "site_code" which must be consistent between the three files. +The site code can be any unique character string, but in general we use the AmeriFlux site code. + +Site data file:`` $SITEGROUP_sitedata.txt``): The header for this file is: +:: + + site_code,name,state,lon,lat,elev,startyear,endyear,alignyear + +The columns: name, state, and elevation are informational only. Name is a longer descriptive name of the site, and state is the state for U.S. sites or country for non U.S. sites. The columns: lon and lat are the longitude and latitude of the location in decimal degrees. The last three columns are the start and ending year for the data and the align year for an 1850 case for the data. The align year is currently unused. + +Soil data file: ``$SITEGROUP_soildata.txt``): The header for this file is: +:: + + site_code,soil_depth,n_layers,layer_depth,layer_sand%,layer_clay% + +The first three fields after "site_code" are currently unused. The only two that are used are the percent sand and clay columns to set the soil texture. + +PFT data file: ``$SITEGROUP_pftdata.txt```): The header for this file is: +:: + + site_code,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5 + +This file gives the vegetation coverage for the different vegetation types for the site. The file only supports up to five PFT's at the same time. The columns with "pft_f" are the fractions for each PFT, and the columns with "pft_c" is the integer index of the given PFT. Look at the pft-physiology file to see what the PFT index for each PFT type is. + +---------------------------------------------- +Dynamic Land-Use Change Files for use by PTCLM +---------------------------------------------- + +There is a mechanism for giving site-specific land-use change in PTCLM. Adding site specific files to the ``PTCLM_sitedata`` directory under PTCLM allows you to specify the change in vegetation and change in harvesting (for the CN model) for that site. Files are named: ``$SITE_dynpftdata.txt``. There is a sample file for the US-Ha1 site called: ``US-Ha1_dynpftdata.txt``. The file has a one-line header with the information that the file has, and then one-line for each year with a transition. The header line is as follows: +:: + + trans_year,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5,har_vh1,har_vh2,har_sh1,har_sh2,har_sh3,graze,hold_harv,hold_graze + +This file only requires a line for each year where a transition or harvest happens. As in the "pftdata" file above "pft_f" refers to the fraction and "pft_c" refers to the PFT index, and only up to five vegetation types are allowed to co-exist. The last eight columns have to do with harvesting and grazing. The last two columns are whether to hold harvesting and/or grazing constant until the next transition year and will just be either 1 or 0. This file will be converted by the **PTCLM_sitedata/cnvrt_trnsyrs2_pftdyntxtfile.pl** script in the PTCLM directory to a format that **mksurfdata_map** can read that has an entry for each year for the range of years valid for the compset in question. + +------------------------------------------ +Converting AmeriFlux Data for use by PTCLM +------------------------------------------ + +AmeriFlux data comes in comma separated format and is available from: +`http://public.ornl.gov/ameriflux/dataproducts.shtml `_. Before you download the data you need to agree to the usage terms. + +Here is a copy of the usage terms from the web-site on June/13/2011. + +"The AmeriFlux data provided on this site are freely available and were furnished by individual AmeriFlux scientists who encourage their use. +Please kindly inform the appropriate AmeriFlux scientist(s) of how you are using the data and of any publication plans. +Please acknowledge the data source as a citation or in the acknowledgments if the data are not yet published. +If the AmeriFlux Principal Investigators (PIs) feel that they should be acknowledged or offered participation as authors, they will let you know and we assume that an agreement on such matters will be reached before publishing and/or use of the data for publication. +If your work directly competes with the PI's analysis they may ask that they have the opportunity to submit a manuscript before you submit one that uses unpublished data. +In addition, when publishing, please acknowledge the agency that supported the research. +Lastly, we kindly request that those publishing papers using AmeriFlux data provide preprints to the PIs providing the data and to the data archive at the Carbon Dioxide Information Analysis Center (CDIAC)." + +The above agreement applies to the "US-UMB" dataset imported into our repository as well, and Gil Bohrer is the PI on record for that dataset. + + +The CESM can NOT handle missing data, so we recommend using the "Level 4" Gap filled datasets. +The fields will also need to be renamed. +The "WS" column becomes "WIND", "PREC" becomes "PRECmms", "RH" stays as "RH", "TA" becomes "TBOT", "Rg" becomes "FSDS", "Rgl" becomes "FLDS", "PRESS" becomes "PSRF". +"ZBOT" can just be set to the constant of "30" (m). +The units of Temperature need to be converted from "Celsius" to "Kelvin" (use the value in ``SHR_CONST_TKFRZ`` in the file ``models/csm_share/shr/shr_const.F90`` of ``273.15``. +The units of Pressure also need to be converted from "kPa" to "Pa". LATIXY, and LONGXY should also be set to the latitude and longitude of the site. + + +----------------------------------------------------------- +Example: PTCLM transient example over a shorter time period +----------------------------------------------------------- + +This is an example of using PTCLM for Harvard Forest (AmeriFlux site code US-Ha1) for transient land use 1991-2006. +In order to do this we would've needed to have converted the AmeriFlux data into NetCDF format as show in the `the Section called Converting AmeriFlux Data for use by PTCLM `_ section above. +Also note that this site has a site-specific dynamic land-use change file for it ``PTCLM_sitedata/US-Ha1_dynpftdata.txt`` in the PTCLM directory and this file will be used for land-use change and harvesting rather than the global dataset. + +:: + + > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM + # We are going to use forcing data over 1991 to 2006, but we need to start with + # a transient compset to do so, so we use the 20th Century transient: 1850-2000 + # Note: When creating the fpftdyn dataset for this site it will use the + # PTCLM_sitedata/US-Ha1_dynpftdata.txt + # file for land-use change and harvesting + > ./PTCLM.py -m yellowstone_intel -s US-Ha1 -d $MYCSMDATA --sitegroupname AmeriFlux -c I20TRCRUCLM45BGC + > mkdir $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 + > cd $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 + # Copy data in NetCDF format to this directory, filenames should be YYYY-MM.nc + # The fieldnames on the file should be: + # FLDS,FSDS,LATIXY, LONGXY, PRECTmms,PSRF,RH,TBOT,WIND,ZBOT + # With units + # W/m2,W/m2,degrees_N,degrees_E,mm/s, Pa, %, K, m/s, m + # The time coordinate units should be: days since YYYY-MM-DD 00:00:00 + > cd ../../../../../US-Ha1_I20TRCRUCLM45BGC + # Now we need to set the start date to 1991, and make sure the align year is for 1991 + > ./xmlchange RUN_STARTDATE=1991-01-01,DATM_CLMNCEP_YR_ALIGN=1991 + # Similarly for Nitrogen deposition data we cycle over: 1991 to 2006 + > cat << EOF >> user_nl_clm + model_year_align_ndep=1991,stream_year_first_ndep=1991,stream_year_last_ndep=2006 + EOF + # Now setup the case, and we'll edit the datm namelist for prescribed aerosols + > ./cesm_setup diff --git a/doc/source/users_guide/running-PTCLM/index.rst b/doc/source/users_guide/running-PTCLM/index.rst new file mode 100644 index 0000000000..d82b7f9624 --- /dev/null +++ b/doc/source/users_guide/running-PTCLM/index.rst @@ -0,0 +1,18 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _running-PTCLM: + +##################################### +Running PTCLM +##################################### + +.. toctree:: + :maxdepth: 2 + + introduction-to-ptclm.rst + using-ptclm.rst + ptclm-examples.rst + adding-ptclm-site-data.rst diff --git a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst new file mode 100644 index 0000000000..f710ed0bb4 --- /dev/null +++ b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst @@ -0,0 +1,139 @@ +.. _introduction-to-ptclm.rst: + +.. _what-is-ptclm: + +=============== + What is PTCLM +=============== + +PTCLM (pronounced either as point clime or Pee-Tee clime) is a Python script to help you set up PoinT CLM simulations. + +It runs the CLM tools for you to get datasets set up, and copies them to a location you can use them according to the ``CLM_USRDAT_NAME`` naming convention. + +Then it runs **create_newcase** for you and modifies the env settings and namelist appropriately. + +PTCLM has a simple ASCII text file for storing basic information for your sites. + +We also have complete lists for AmeriFlux and Fluxnet-Canada sites, although we only have the meteorology data for one site. + +For other sites you will need to obtain the meteorology data and translate it to a format that the CESM datm model can use. + +But, even without meteorology data PTCLM is useful to setup datasets to run with standard ``CLM_QIAN`` data. + +The original authors of PTCLM are: Daniel M. Ricciuto, Dali Wang, Peter E. Thornton, Wilfred M. Post all at Environmental Sciences Division, Oak Ridge National Laboratory (ORNL) and R. Quinn Thomas at Cornell University. It was then modified fairly extensively by Erik Kluzek at NCAR. We want to thank all of these individuals for this contribution to the CESM effort. We also want to thank the folks at University of Michigan Biological Stations (US-UMB) who allowed us to use their Fluxnet station data and import it into our inputdata repository, especially Gil Bohrer the PI on record for this site. + + +.. _details-of-ptclm: + +================== + Details of PTCLM +================== + +To get help on PTCLM1.110726 use the "--help" option as follows. +:: + + > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM + > ./PTCLM.py --help + +The output to the above command is as follows: +:: + + Usage: PTCLM.py [options] -d inputdatadir -m machine -s sitename + + Python script to create cases to run single point simulations with tower site data. + + Options: + --version show program's version number and exit + -h, --help show this help message and exit + + Required Options: + -d CCSM_INPUT, --csmdata=CCSM_INPUT + Location of CCSM input data + -m MYMACHINE, --machine=MYMACHINE + Machine, valid CESM script machine (-m list to list valid + machines) + -s MYSITE, --site=MYSITE + Site-code to run, FLUXNET code or CLM1PT name (-s list to list + valid names) + + Configure and Run Options: + -c MYCOMPSET, --compset=MYCOMPSET + Compset for CCSM simulation (Must be a valid 'I' compset [other + than IG compsets], use -c list to list valid compsets) + --coldstart Do a coldstart with arbitrary initial conditions + --caseidprefix=MYCASEID + Unique identifier to include as a prefix to the case name + --cesm_root=BASE_CESM + Root CESM directory (top level directory with models and scripts + subdirs) + --debug Flag to turn on debug mode so won't run, but display what would + happen + --finidat=FINIDAT Name of finidat initial conditions file to start CLM from + --list List all valid: sites, compsets, and machines + --namelist=NAMELIST + List of namelist items to add to CLM namelist (example: + --namelist="hist_fincl1='TG',hist_nhtfrq=-1" + --QIAN_tower_yrs Use the QIAN forcing data year that correspond to the tower + years + --rmold Remove the old case directory before starting + --run_n=MYRUN_N Number of time units to run simulation + --run_units=MYRUN_UNITS + Time units to run simulation (steps,days,years, etc.) + --quiet Print minimul information on what the script is doing + --sitegroupname=SITEGROUP + Name of the group of sites to search for you selected site in + (look for prefix group names in the PTCLM_sitedata directory) + --stdurbpt If you want to setup for standard urban namelist settings + --useQIAN use QIAN input forcing data instead of tower site meterology data + --verbose Print out extra information on what the script is doing + + Input data generation options: + These are options having to do with generation of input datasets. Note: When + running for supported CLM1PT single-point datasets you can NOT generate new + datasets. For supported CLM1PT single-point datasets, you MUST run with the + following settings: --nopointdata And you must NOT set any of these: --soilgrid + --pftgrid --owritesrf + + --nopointdata Do NOT make point data (use data already created) + --owritesrf Overwrite the existing surface datasets if they exist (normally + do NOT recreate them) + --pftgrid Use pft information from global gridded file (rather than site + data) + --soilgrid Use soil information from global gridded file (rather than site + data) + + Main Script Version Id: $Id: PTCLM.py 47576 2013-05-29 19:11:16Z erik $ Scripts URL: $HeadURL: https://svn-ccsm-models.cgd.ucar.edu/PTCLM/trunk_tags/PTCLM1_130529/PTCLM.py $: + +Here we give a simple example of using PTCLM1 for a straightforward case of running at the US-UMB Fluxnet site on yellowstone where we already have the meteorology data on the machine. +Note, see `the Section called Converting AmeriFlux Data for use by PTCLM `_ for permission information to use this data. + +Example 6-1. Example of running PTCLM1 for US-UMB on yellowstone +---------------------------------------------------------------- + +:: + + > setenv CSMDATA $CESMDATAROOT/inputdata + > setenv MYCSMDATA $HOME/inputdata + > setenv SITE US-UMB + > setenv MYMACH yellowstone_intel + > setenv MYCASE testPTCLM + # First link the standard input files to a location you have write access + > cd scripts + > ./link_dirtree $CSMDATA $MYCSMDATA + + # Next build all of the clm tools you will need + > cd ../models/lnd/clm/tools/clm4_5/mksurfdata_map + > gmake + > gmake clean + > cd ../../../../../../tools/mapping/gen_domain_files/src + > ../../../../scripts/ccsm_utils/Machines/configure -mach yellowstone -compiler intel + > gmake + > gmake clean + # next run PTCLM (NOTE -- MAKE SURE python IS IN YOUR PATH) + > cd ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM + > ./PTCLM.py -m $MYMACH --case=$MYCASE --site=$SITE --csmdata=$MYCSMDATA --aerdepgrid --ndepgrid + # NOTE: we use --aerdepgrid --ndepgrid so that you use the global + # aerosol and Nitrogen deposition files rather than site-specific ones. + > cd ../../../../../$MYCASE + # Finally setup, build, and run the case as normal + diff --git a/doc/source/users_guide/running-PTCLM/ptclm-examples.rst b/doc/source/users_guide/running-PTCLM/ptclm-examples.rst new file mode 100644 index 0000000000..e9a887e89c --- /dev/null +++ b/doc/source/users_guide/running-PTCLM/ptclm-examples.rst @@ -0,0 +1,70 @@ +.. _ptclm-examples: + +========================= + Examples of using PTCLM +========================= + +Now let's give a few more complex examples using some of the options we have discussed above. + +In this first example, we'll demonstrate using a supported single point dataset, which then requires using the "nopointdata". We'll also demonstrate the compset option, "stdurbpt" and "caseidprefix" options. + +Example: Running PTCLM for the Mexicocity supported single point dataset +------------------------------------------------------------------------ +:: + + > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM + > ./PTCLM.py -m yellowstone_intel -s 1x1_mexicocityMEX -d $CSMDATA --nopointdata \ + --stdurbpt -c ICRUCLM45 --caseidprefix `pwd`/myPTCLMcases/site + > cd myPTCLMcases/site_1x1_mexicocityMEX_I + > ./cesm_setup + # Now build and run normally + > ./site_1x1_mexicocityMEX_I.build + # Here we show running interactively + > ./site_1x1_mexicocityMEX_I.run + +Now, let's demonstrate using a different group list, doing a spinup, running with Qian global forcing data, but using tower years to set the years to run over. This uses the options: sitegroupname, useQIAN, and QIANtower_years. + +Example: Running PTCLM for a spinup simulation with Qian data for tower years. +------------------------------------------------------------------------------ +:: + + > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM + > ./PTCLM.py -m yellowstone_intel -s US-Ha1 -d $CSMDATA --sitegroupname AmeriFlux --useQIAN --QIAN_tower_yrs + > cd ../../../../../US-Ha1_ICRUCLM45BGC_QIAN + > ./cesm_setup + # Now build and run normally + > ./US-Ha1_ICRUCLM45BGC_QIAN.build + # Here we show running interactively + > ./US-Ha1_ICRUCLM45BGC_QIAN.run + ``` + +Finally, let's demonstrate using a generic machine (which then requires the scratchroot option), using the global grid for PFT and soil types, and setting the run length to two months. + +Example: Running PTCLM on a user-defined machine with global PFT and soil types dataset +--------------------------------------------------------------------------------------- +:: + + > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM + # Note, see the the Section called Converting AmeriFlux Data for use by PTCLM with permission information + # to use the US-UMB data. + > ./PTCLM.py -m userdefined_intel -s US-UMB -d $CSMDATA --pftgrid --soilgrid \ + --scratchroot $HOME --run_n 2 --run_units nmonths + > cd ../../../../../US-UMB_ICRUCLM45BGC + # If userdefined is NOT set up for you Uncomment the following and set OS, NTASKS_PER_NODE, TMPDIR + # > ./xmlchange OS=$OS,MAX_TASKS_PER_NODE=$NTASKS_PER_NODE,MPILIB=mpi-serial + # > ./xmlchange RUNDIR=$TMPDIR/$USER/\$CASE/run,DIN_LOC_ROOT=$CSMDATA,COMPILER=intel + # > ./xmlchange EXEROOT=$TMPDIR/$USER/\$CASE + > ./cesm_setup + # Now build + > ./US-UMB_ICRUCLM45BGC.userdefined_intel.build + # To get the files from the svn server... + # First list the files from the streams text file + > ../ccsm_utils/Tools/listfilesin_streams \ + -t $HOME/US-UMB_ICRUCLM45BGC/run/clm1PT.1x1pt_US-UMB.stream.txt -l \ + > Buildconf/datm.input_data_list + # And now run the script to export data to your machine + > ../ccsm_utils/Tools/check_input_data -export + # Here we show running interactively + > ./US-UMB_ICRUCLM45BGC.userdefined_intel.run + +.. warning: Because of Bug 1364, when running this case as above we get a floating point error after reaching time-step 124 for the example exactly as above. Other machines or compilers probably won't have this problem. See the `models/lnd/clm/doc/KnownBugs `_ file for more information on this problem. diff --git a/doc/source/users_guide/running-PTCLM/using-ptclm.rst b/doc/source/users_guide/running-PTCLM/using-ptclm.rst new file mode 100644 index 0000000000..b644337239 --- /dev/null +++ b/doc/source/users_guide/running-PTCLM/using-ptclm.rst @@ -0,0 +1,222 @@ +.. _using-ptclm.rst: + +************************** +Using PTCLM +************************** + +There are three types of options to PTCLM1: required, setup/run-time, and dataset generation options. +The three required options are the three settings that MUST be specified for PTCLM to work at all. The other settings have default values that will default to something useful. The setup/run-time options control how the simulation will be setup and run. The dataset generation options control the generation of datasets needed when PTCLM is run. Most options use a double dash "--" "longname" such as "--list", but the most common options also have a short-name with a single dash (such as -m instead of --machine). + +The required options to PTCLM are: inputdata directory (-d), machine (-m) and site-name (-s). +Inputdata directory is the directory where you have the CESM inputdata files, you need to have write access to this directory, so if you are running on a machine that you do NOT have write access to the standard inputdata location (such as NCAR yellowstone or LBNL hopper) you need to link the standard files to a location you do have control over. We recommend using the ``scripts/link_dirtree`` tool to do that. "machine" is the scripts name for the machine/compiler you will be using for your case. And finally site-name is the name of the site that you want to run for. Site-name can either be a valid supported dataset name or a Fluxnet site name from the list of sites you are running on (see the --sitegroupname for more information about the site lists). + +After PTCLM is run a case directory where you can then setup, build and run your CESM case as normal. +It also creates a ``README.PTCLM`` in that directory that documents the commandline options to PTCLM that were used to create it. + +After "help" the "list" option is one of the most useful options for getting help on using PTCLM. +This option gives you information about some of the other options to PTCLM. To get a list of the machine, sites, and compsets that can be used for PTCLM use the "--list" option as follows. +:: + + > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM + > ./PTCLM.py --list + +The output to the above command is as follows: +:: + + /bin/sh: line 1: PTCLM.py: command not found + +Steps in running PTCLM +========================= + +1. Setup Inputdata directory with write access (use link_dirtree script) + + You need to setup an inputdata directory where you have write access to it. + Normally, for NCAR machines the data is on an inputdata where the user does NOT have write access to it. + A way that you can get around this is to use the **link_dirtree** script to create softlinks from the normal location to a location you have write access to. + So for example on yellowstone: + :: + + > setenv CSMDATA $CESMDATAROOT/inputdata + > setenv MYCSMDATA $HOME/inputdata + > mkdir $MYCSMDATA + > cd scripts + > ./link_dirtree $CSMDATA $MYCSMDATA + + See `the Section called Managing Your Own Data-files in Chapter 3 `_ for more information on this. + +2. Build the CLM tools + Next you need to make sure all the CLM FORTRAN tools are built. + :: + + > cd models/lnd/clm/tools/clm4_5/mksurfdata_map + > gmake + > gmake clean + > cd ../../../../../../tools/mapping/gen_domain_files/src + > ../../../../scripts/ccsm_utils/Machines/configure -mach yellowstone -compiler intel + > gmake + > gmake clean + +3. Run PTCLM + Next you actually run PTCLM1 which does the different things listed below: + + a. PTCLM names your case based on your input + :: + + [Prefix_]SiteCode_Compset[_QIAN] + + Where: + ``Prefix`` is from the caseidprefix option (or blank if not used). + + ``SiteCode`` is the site name you entered with the -s option. + + ``Compset`` is the compset name you entered with the -c option. + + ``_QIAN`` is part of the name only if the useQIAN is used. + + For example, the casename for the following will be: + :: + + > cd scripts + > ./PTCLM.py -m yellowstone_intel -s US-UMB -d $MYCSMDATA -c ICRUCLM45BGC --use QIAN "US-UMB_I_2000_CN_QIAN" + + b. PTCLM creates datasets for you + It will populate $MYCSMDATA with new datasets it creates using the CLM tools. + + c. If a transient compset and PTCLM1 finds a _dynpftdata.txt file + If you are running a transient compset (such as the "I_1850-2000_CN" compset) AND you there is a file in the PTCLM_sitedata directory under the PTCLM directory called $SITE_dynpftdata.txt it will use this file for the land-use changes. + Otherwise it will leave land-use constant, unless you use the pftgrid option so it uses the global dataset for landuse changes. + See the Section called Dynamic Land-Use Change Files for use by PTCLM for more information on this. + There is a sample transient dataset called US-Ha1_dynpftdata.txt. + Transient compsets, are compsets that create transient land-use change and forcing conditions such as: 'I_1850-2000', 'I_1850-2000_CN', 'I_RCP8.5_CN', 'I_RCP6.0_CN', 'I_RCP4.5_CN', or 'I_RCP2.6_CN'. + + d. PTCLM creates a pft-physiology for you + PTCLM1 will create a local copy of the pft-physiology specific for your site that you could then customize with changes specific for that site. + + e. PTCLM creates a README.PTCLM for you + PTCLM1 will create a simple text file with the command line for it in a file called README.PTCLM in the case directory it creates for you. + +4. Customize, setup, build and run case as normal + You then customize your case as you would normally. See the Chapter 1 chapter for more information on doing this. + +PTCLM options +========================= + +Next we discuss the setup and run-time options, dividing them up into setup, initial condition (IC), and run-time options. + +Configure options include: + +- --compset=MYCOMPSET +- --caseidprefix=MYCASEID +- --cesm_root=BASE_CESM +- --namelist=NAMELIST +- --rmold +- --scratchroot=SCRATCHROOT +- --sitegroupname=SITEGROUP +- --QIAN_tower_yrs +- --useQIAN + +``--compset`` + The "-c" option is the most commonly used option after the required options, as it specifies the CESM scripts component set to use with PTCLM1. + The default compset is the "ICN" compset with CN on for present day conditions. + +``--caseidprefix`` + This option gives a prefix to include in the casename when the case is created, in case you want to customize your casenames a bit. + By default, casenames are figured out based on the other options. The argument to this option can either be a name to prefix casenames with and/or a pathname to include. + Hence, if you want cases to appear in a specific directory you can give the pathname to that directory with this option. + +``--cesm_root`` + This option is for running PTCLM1 with a different root directory to CESM than the version PTCLM exists in. Normally you do NOT need to use this option. + +``--namelist`` + This option adds any items given into the CLM user_nl_clm namelist. This allows you to add customizations to the namelist before the clm.buildnml.csh file is created for the case. + +``--rmold`` + This option will remove an old case directory of the same name if one exists. Otherwise, if an old case directory already exists and you try to run PTCLM it will return with an error. + +``--scratchroot`` + This option is ONLY valid when using one of the generic machines (the -m option). This passed onto **create_newcase** and gives the location where cases will be built and run. + +``--sitegroupname`` + In the PTCLM directory there is a subdirectory "PTCLM_sitedata" that contains files with the site, PFT and soil data information for groups of sites. + These site groups are all separate ASCII files with the same prefix followed by a "_*data.txt" name. See `the Section called PTCLM Group Site Lists `_ for more information on these files. By default we have provided three different valid group names: + +EXAMPLE +------- +AmeriFlux + +Fluxnet-Canada + +The EXAMPLE is the group used by default and ONLY includes the US-UMB site as that is the only site we have data provided for. +The other two site groups include the site information for all of both the AmeriFlux and Fluxnet-Canada sites. +You can use the "sitegroupname" option to use one of the other lists, or you can create your own lists using the EXAMPLE file as an example. +Your list of sites could be real world locations or could be theoretical "virtual" sites given to exercise CLM on differing biomes for example. +Note, see `the Section called Converting AmeriFlux Data for use by PTCLM `_ with permission information to use the US-UMB data. + +``--useQIAN`` + This option says to use the standard CLM global Qian T62 atmospheric forcing rather than any tower site forcing data available. Otherwise, PTCLM will try to find tower forcing data for the specific site entered. + +``--QIAN_tower_yrs`` + This option is used with the "useQIAN" option to set the years to cycle over for the Qian data. In this case Qian atmospheric forcing will be used, but the simulation will run over the same years that tower site is available for this site. + +**IC options include:** + +- --coldstart +- --finidat=FINIDAT + +The coldstart option says to startup with OUT an initial condition file, while the finidat option explicitly gives the initial condition file to use. Obviously, the coldstart and finidat options can NOT be used together. + +``--coldstart`` + This option ensures that a cold-start will be done with arbitrary initial conditions. + +``--finidat`` + This option sets the initial condition file to startup the simulation from. + +**Run-time options include:** + +- --debug +- --run_n=MYRUN_N +- --run_units=MYRUN_UNITS +- --stdurbpt +- --debug + +This option tells PTCLM to echo what it would do if it were run, but NOT actually run anything. So it will show you the dataset creation commands it would use. It does however, run **create_newcase**, but then it only displays the **xmlchange** commands and changes that it would do. Also note that if you give the "--rmold" option it won't delete the case directory beforehand. Primarily this is intended for debugging the operation of PTCLM. + +``--run_n`` + This option along with run_units is used to set the length for the simulation. "run_n" is the number of units to use. The default run length depends on the site, compset, and configuration. + +``--run_units`` + This option is the units of time to use for the length of the simulation. It is used along with "run_n" to set the length of the simulation. The default run length depends on the site, compset, and configuration. + +``--stdurbpt`` + This option turns on the "stdurbpt_pd" use-case for CLM_NML_USE_CASE. This option can NOT be used for compsets that set the use-case to something besides present-day. + +**The dataset generation options are:** + +- --pftgrid +- --soilgrid +- --nopointdata +- --owritesrfaer + +The options that with a "grid" suffix all mean to create datasets using the global gridded information rather than using the site specific point data. By default the site specific point data is used. The "nopointdata" and "owritesrfaer" options have to do with file creation. + +Because supported single-point datasets already have the data created for them, you MUST use the "nopointdata" and "ndepgrid" options when you are using a supported single-point site. You must use "ndepgrid" even for a compset without CN. You also can NOT use the options: "soilgrid", "pftgrid", "aerdepgrid", or "owritesrfaer". + +``--pftgrid`` + This option says to use the PFT values provided on the global dataset rather than using the specific site based values from the PTCLM_sitedata/\*_pftdata.txt file when creating the surface dataset. + This option must NOT be used when you you are using a site that is a supported single point dataset. + +``--soilgrid`` + This option says to use the soil values provided on the global dataset rather than using the specific site based values from the PTCLM_sitedata/\*_soildata.txt file when creating the surface dataset. + This option must NOT be used when you you are using a site that is a supported single point dataset. + +``--nopointdata`` + This option says to NOT create any input datasets -- assume this step has already been done. + If datasets weren't already created, your case will fail when you try to run it. + In general the first time you run PTCLM for a new site you want it to generate new datasets, but the next time and future times you want to use this option so that it doesn't waste a lot of time rebuilding datasets over again. + + .. note:: This option is required when you you are using a site that is a supported single point dataset. + +``--owritesrfaer`` + This option says to overwrite any surface and/or aerosol deposition datasets that were already created. + Otherwise, the creation of these files will be skipped if a file is already found (but it WILL create files if they don't exist). + This option must NOT be used when you you are using a site that is a supported single point dataset. diff --git a/doc/source/users_guide/running-single-points/index.rst b/doc/source/users_guide/running-single-points/index.rst new file mode 100644 index 0000000000..2c4ea71bdb --- /dev/null +++ b/doc/source/users_guide/running-single-points/index.rst @@ -0,0 +1,18 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _running-single-points: + +##################################### +Running Single Point Regional Cases +##################################### + +.. toctree:: + :maxdepth: 2 + + single-point-and-regional-grid-configurations.rst + running-pts_mode-configurations.rst + running-single-point-configurations.rst + diff --git a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst new file mode 100644 index 0000000000..56d70b1d7d --- /dev/null +++ b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst @@ -0,0 +1,40 @@ +.. _pts_mode: + +**************************************************** +Running a single point using global data - PTS_MODE +**************************************************** + +``PTS_MODE`` enables you to run the model using global datasets, but just picking a single point from those datasets and operating on it. +It can be a very quick way to do fast simulations and get a quick turnaround. + +To setup a ``PTS_MODE`` simulation you use the "-pts_lat" and "-pts_lon" arguments to **create_newcase** to give the latitude and longitude of the point you want to simulate for (the code will pick the point on the global grid nearest to the point you give. Here's an example to setup a simulation for the nearest point at 2-degree resolution to Boulder Colorado. +:: + + > cd scripts + > ./create_newcase -case testPTS_MODE -res f19_g16 -compset I1850CRUCLM45BGC -pts_lat 40.0 -pts_lon -105 + > cd testPTS_MODE + + # We make sure the model will start up cold rather than using initial conditions + > ./xmlchange CLM_FORCE_COLDSTART=on,RUN_TYPE=startup + +Then setup, build and run as normal. We make sure initial conditions are NOT used since ``PTS_MODE`` currently CAN NOT run with initial conditions. + +.. note:: By default it sets up to run with MPILIB=mpi-serial (in the env_build.xml file) turned on, which allows you to run the model interactively. On some machines this mode is NOT supported and you may need to change it to FALSE before you are able to build. + +.. warning:: ``PTS_MODE`` currently does NOT restart nor is it able to startup from global initial condition files. See bugs "1017 and 1025" in the `models/lnd/clm/doc/KnownLimitationss `_ file. + +.. note:: You can change the point you are simulating for at run-time by changing the values of ``PTS_LAT`` and ``PTS_LON`` in the ``env_run.xml`` file. + +================================== + Running on in a single processor +================================== + +Note, that when running with ``PTS_MODE`` the number of processors is automatically set to one. +When running a single grid point you can only use a single processor. +You might also want to set the ``env_build.xml`` variable: ``MPILIB=mpi-serial`` to ``TRUE`` so that you can also run interactively without having to use MPI to start up your job. + +On many machines, batch queues have a minimum number of nodes or processors that can be used. +On these machines you may have to change the queue and possibly the time-limits of the job, to get it to run in the batch queue. +On the NCAR machine, yellowstone, this is done for you automatically, and the "caldera" queue is used for such single-processor simulations. +Another way to get around this problem is to run the job interactively using ``MPILIB=mpi-serial`` so that you don't submit the job to the batch queue. +For single point mode you also may want to consider using a smaller workstation or cluster, rather than a super-computer, because you can't take advantage of the multi-processing power of the super-computer anyway. diff --git a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst new file mode 100644 index 0000000000..3445b0cab7 --- /dev/null +++ b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst @@ -0,0 +1,218 @@ +.. _running-single-point-datasets: + +****************************************** + Running Single Point Configurations +****************************************** + +In addition to ``PTS_MODE``, CLM supports running using single-point or regional datasets that are customized to a particular region. +CLM supports a a small number of out-of-the-box single-point and regional datasets. +However, users can create their own dataset. + +To get the list of supported dataset resolutions do this: +:: + + > cd models/lnd/clm/doc + > ../bld/build-namelist -res list + + +Which results in the following: +:: + + CLM build-namelist - valid values for res (Horizontal resolutions + Note: 0.1x0.1, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools): + Values: default 512x1024 360x720cru 128x256 64x128 48x96 32x64 8x16 94x192 \ + 0.23x0.31 0.47x0.63 0.9x1.25 1.9x2.5 2.5x3.33 4x5 10x15 5x5_amazon 1x1_tropicAtl 1x1_camdenNJ \ + 1x1_vancouverCAN 1x1_mexicocityMEX 1x1_asphaltjungleNJ 1x1_brazil 1x1_urbanc_alpha 1x1_numaIA \ + 1x1_smallvilleIA 0.1x0.1 0.5x0.5 3x3min 5x5min 10x10min 0.33x0.33 ne4np4 ne16np4 ne30np4 ne60np4 \ + ne120np4 ne240np4 wus12 us20 + Default = 1.9x2.5 + (NOTE: resolution and mask and other settings may influence what the default is) + +The resolution names that have an underscore in them ("_") are all single-point or regional resolutions. + +To run for the Brazil test site do the following: + +Example: Running CLM over a single-point test site in Brazil with the default Qian atmosphere data forcing. +-------------------------------------------------------------------------------------------------------------------------- +:: + + > cd scripts + > set SITE=1x1_brazil + > ./create_newcase -case testSPDATASET -res $SITE -compset I + > cd testSPDATASET + +Then setup, build and run normally. + +Then to run for the urban Mexico City Mexico test site that also has atmosphere forcing data, but to run it with the Qian forcing data, but over the period for which it's own forcing data is provided do the following: + +Example: Running CLM over the single-point of Mexicocity Mexico with the default Qian atmosphere data forcing. +------------------------------------------------------------------------------------------------------------------------- +:: + + > cd scripts + # Set a variable to the site you want to use (as it's used several times below) + > set SITE=1x1_mexicocityMEX + > ./create_newcase -case testSPDATASET -res $SITE -compset I + > cd testSPDATASET + # Set DATM prescribed aerosols to single-point dataset + # Will then use the dataset with just the point for this $SITE + > ./xmlchange DATM_PRESAERO=pt1_pt1 + +Then setup, build and run normally. + +**Important:** Just like PTS_MODE above, By default it sets up to run with ``MPILIB=mpi-serial`` (in the ``env_build.xml`` file) turned on, which allows you to run the model interactively. On some machines this mode is NOT supported and you may need to change it to FALSE before you are able to build. + +.. warning:: See `the Section called Warning about Running with a Single-Processor on a Batch Machine `_ for a warning about running single-point jobs on batch machines. + +.. note:: When running a ``pt1_pt1`` resolution the number of processors is automatically set to one. When running a single grid point you can only use a single processor. You might also want to set the ``env_build.xml`` variable: ``MPILIB=mpi-serial`` to TRUE so that you can also run interactively without having to use mpi to start up your job. + +Using Supported Single-point Datasets that have their own Atmospheric Forcing +================================================================================ + +Of the supported single-point datasets we have three that also have atmospheric forcing data that go with them: Mexico City (Mexico), Vancouver, (Canada, British Columbia), and ``urbanc_alpha`` (test data for an Urban inter-comparison project). +Mexico city and Vancouver also have "#ifdef" in the source code for them to work with modified urban data parameters that are particular to these locations. +They can be turned on by using the ``CLM_CONFIG_OPTS env_build.xml`` variable to set the "-sitespf_pt" option in the CLM **configure**. +To turn on the atmospheric forcing for these datasets, you set the ``env_run.xml DATM_MODE`` variable to ``CLM1PT``, and then the atmospheric forcing datasets will be used for the point picked. + +When running with datasets that have their own atmospheric forcing you need to be careful to run over the period that data is available. +If you have at least one year of forcing it will cycle over the available data over and over again no matter how long of a simulation you run. +However, if you have less than a years worth of data (or if the start date doesn't start at the beginning of the year, or the end date doesn't end at the end of the year) then you won't be able to run over anything but the data extent. +In this case you will need to carefully set the ``RUN_STARTDATE``, ``START_TOD`` and ``STOP_N/STOP_OPTION`` variables for your case to run over the entire time extent of your data. +For the supported data points, these values are in the XML database and you can use the **queryDefaultNamelist.pl** script to query the values and set them for your case (they are set for the three urban test cases: Mexicocity, Vancouver, and urbanc_alpha). + +In the example below we will show how to do this for the Vancouver, Canada point. + +Example: Running CLM over the single-point of Vancouver Canada with supplied atmospheric forcing data for Vancouver. +------------------------------------------------------------------------------------------------------------------------- +:: + + > cd scripts + + # Set a variable to the site you want to use (as it's used several times below) + > set SITE=1x1_vancouverCAN + + # Create a case at the single-point resolutions with their forcing + > ./create_newcase -case testSPDATASETnAtmForcing -res $SITE -compset I1PTCLM45 + > cd testSPDATASETnAtmForcing + + # Set namelist options for urban test site + > ./xmlchange CLM_NML_USE_CASE=stdurbpt_pd + + # Figure out the start and end date for this dataset + # You can do this by examining the datafile. + > set STOP_N=330 + > set START_YEAR=1992 + > set STARTDATE=${START_YEAR}-08-12 + > @ NDAYS = $STOP_N / 24 + > ./xmlchange RUN_STARTDATE=$STARTDATE,STOP_N=$STOP_N,STOP_OPTION=nsteps + + # Set the User namelist to set the output frequencies of the history files + # Setting the stdurbpt use-case option create three history file streams + # The frequencies and number of time-samples needs to be set + > cat << EOF > user_nl_clm + hist_mfilt = $NDAYS,$STOP_N,$STOP_N + hist_nhtfrq = -1,1,1 + EOF + + # Set DATM prescribed aerosols to single-point dataset + # Will then use the dataset with just the point for this site + > ./xmlchange DATM_PRESAERO=pt1_pt1 + > ./case.setup + + +.. warning:: If you don't set the start-year and run-length carefully as shown above the model will abort with a "dtlimit error" in the atmosphere model (see bug 1110 in the `models/lnd/clm/doc/KnownLimitationss `_ file for documentation on this). Since, the forcing data for this site (and the MexicoCity site) is less than a year, the model won't be able to run for a full year. The ``1x1_urbanc_alpha`` site has data for more than a full year, but neither year is complete hence, it has the same problem (see the problem for this site above). + +.. note:: Just like ``PTS_MODE`` above, By default it sets up to run with ``MPILIB=mpi-serial`` (in the env_build.xml file) turned on, which allows you to run the model interactively. + +.. note:: When running a ``pt1_pt1`` resolution the number of processors is automatically set to one. When running a single grid point you can only use a single processor. You might also want to set the ``env_build.xml`` variable: ``MPILIB=mpi-serial`` to ``TRUE`` so that you can also run interactively without having to use mpi to start up your job. + + +Creating your own single-point dataset +=================================================== + +The following provides an example of setting up a case using ``CLM_USRDAT_NAME`` where you rename the files according to the ``CLM_USRDAT_NAME`` convention. +We have an example of such datafiles in the repository for a specific region over Alaska (actually just a sub-set of the global f19 grid). + +Example: Using CLM_USRDAT_NAME to run a simulation using user datasets for a specific region over Alaska +----------------------------------------------------------------------------------------------------------------------- +:: + + > cd scripts + > ./create_newcase -case my_userdataset_test -res CLM_USRDAT -compset ICRUCLM45 + > cd my_userdataset_test/ + > set GRIDNAME=13x12pt_f19_alaskaUSA + > set LMASK=gx1v6 + > ./xmlchange CLM_USRDAT_NAME=$GRIDNAME,CLM_BLDNML_OPTS="-mask $LMASK" + > ./xmlchange ATM_DOMAIN_FILE=domain.lnd.${GRIDNAME}_$LMASK.nc + > ./xmlchange LND_DOMAIN_FILE=domain.lnd.${GRIDNAME}_$LMASK.nc + + # Make sure the file exists in your $CSMDATA or else use svn to download it there + > ls $CSMDATA/lnd/clm2/surfdata_map/surfdata_${GRIDNAME}_simyr2000.nc + + # If it doesn't exist, comment out the following... + #> setenv SVN_INP_URL https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata/ + #> svn export $SVN_INP_URL/lnd/clm2/surfdata_map/surfdata_${GRIDNAME}_simyr2000.nc $CSMDATA/lnd/clm2/surfdata_map/surfdata_${GRIDNAME}_simyr2000.nc + > ./case.setup + +The first step is to create the domain and surface datasets using the process outlined in `the Section called The File Creation Process in Chapter 2 `_. Below we show an example of the process. + +Example: Creating a surface dataset for a single point +--------------------------------------------------------------------- +:: + + # set the GRIDNAME and creation date that will be used later + > setenv GRIDNAME 1x1_boulderCO + > setenv CDATE `date +%y%m%d` + # Create the SCRIP grid file for the location and create a unity mapping file for it. + > cd models/lnd/clm/tools/shared/mkmapdata + > ./mknoocnmap.pl -p 40,255 -n $GRIDNAME + # Set pointer to MAPFILE just created that will be used later + > setenv MAPFILE `pwd`/map_${GRIDNAME}_noocean_to_${GRIDNAME}_nomask_aave_da_${CDATE}.nc + # create the mapping files needed by mksurfdata_map. + > cd ../../shared/mkmapdata + > setenv GRIDFILE ../mkmapgrids/SCRIPgrid_${GRIDNAME}_nomask_${CDATE}.nc + > ./mkmapdata.sh -r $GRIDNAME -f $GRIDFILE -t regional + # create the domain file + > cd ../../../../tools/mapping/gen_domain_files/src + > ../../../scripts/ccsm_utils/Machines/configure -mach yellowstone -compiler intel + > gmake + > cd .. + > setenv OCNDOM domain.ocn_noocean.nc + > setenv ATMDOM domain.lnd.{$GRIDNAME}_noocean.nc + > ./gen_domain -m $MAPFILE -o $OCNDOM -l $ATMDOM + # Save the location where the domain file was created + > setenv GENDOM_PATH `pwd` + # Finally create the surface dataset + > cd ../../../../lnd/clm/tools/clm4_5/mksurfdata_map/src + > gmake + > cd .. + > ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE + +The next step is to create a case that points to the files you created above. We will still use the ``CLM_USRDAT_NAME`` option as a way to get a case setup without having to add the grid to scripts. + +Example: Setting up a case from the single-point surface dataset just created +-------------------------------------------------------------------------------------------- +:: + + # First setup an environment variable that points to the top of the CESM directory. + > setenv CESMROOT + # Next make sure you have a inputdata location that you can write to + # You only need to do this step once, so you won't need to do this in the future + > setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data + > ./link_dirtree $CSMDATA $MYCSMDATA + # Copy the file you created above to your new $MYCSMDATA location following the CLMUSRDAT + # naming convention (leave off the creation date) + > cp $CESMROOT/models/lnd/clm/tools/clm4_5/mksurfdata_map/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ + $MYCSMDATA/lnd/clm2/surfdata_map/surfdata_${GRIDNAME}_simyr1850.nc + > cd $CESMROOT/scripts + > ./create_newcase -case my_usernldatasets_test -res CLM_USRDAT -compset I1850CRUCLM45BGC \ + -mach yellowstone_intel + > cd my_usernldatasets_test + > ./xmlchange DIN_LOC_ROOT=$MYCSMDATA + # Set the path to the location of gen_domain set in the creation step above + > ./xmlchange ATM_DOMAIN_PATH=$GENDOM_PATH,LND_DOMAIN_PATH=$GENDOM_PATH + > ./xmlchange ATM_DOMAIN_FILE=$ATMDOM,LND_DOMAIN_FILE=$ATMDOM + > ./xmlchange CLM_USRDAT_NAME=$GRIDNAME + > ./case.setup + +.. note:: With this and previous versions of the model we recommended using ``CLM_USRDAT_NAME`` as a way to identify your own datasets without having to enter them into the XML database. This has two down-sides. First you can't include creation dates in your filenames, which means you can't keep track of different versions by date. It also means you HAVE to rename the files after you created them with **mksurfdata.pl**. And secondly, you have to use **linkdirtree** in order to place the files in a location outside of the usual ``DIN_LOC_ROOT`` (assuming you don't have write access to adding new files to the standard location on the machine you are using). Now, since ``user_nl`` files are supported for ALL model components, and the same domain files are read by both CLM and DATM and set using the envxml variables: ``ATM_DOMAIN_PATH``, ``ATM_DOMAIN_FILE``, ``LND_DOMAIN_PATH``, and ``LND_DOMAIN_FILE`` -- you can use this mechanism (``user_nl_clm`` and ``user_nl_datm`` and those envxml variables) to point to your datasets in any location. In the future we will deprecate ``CLM_USRDAT_NAME`` and recommend ``user_nl_clm`` and ``user_nl_datm`` and the ``DOMAIN`` envxml variables. diff --git a/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst b/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst new file mode 100644 index 0000000000..a1514768ee --- /dev/null +++ b/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst @@ -0,0 +1,51 @@ +.. _single-point-configurations: + +***************************************** +Single and Regional Grid Configurations +***************************************** + +CLM allows you to set up and run cases with a single-point or a local region as well as global resolutions. +This is often useful for running quick cases for testing, evaluating specific vegetation types, or land-units, or running with observed data for a specific site. + +There are three different ways to do this for normal-supported site + +``PTS_MODE`` + runs for a single point using global datasets. + +``CLM_USRDAT_NAME`` + runs using your own datasets (single-point or regional). + +``PTCLM`` + easily setup simulations to run for tower sites.. + +.. note:: ``PTS_MODE`` and ``PTCLM`` only works for a single point, while the other two options can also work for regional datasets as well. + +.. _options-for-single-points: + +========================================= + Choosing the right single point options +========================================= + +Running for a *normal supported site* is a great solution, if one of the supported single-point/regional datasets, is your region of interest (see `the Section called Running Supported Single-point/Regional Datasets `_). +All the datasets are created for you, and you can easily select one and run, out of the box with it using a supported resolution from the top level of the CESM scripts. +The problem is that there is a very limited set of supported datasets. +You can also use this method for your own datasets, but you have to create the datasets, and add them to the XML database in scripts, CLM and to the DATM. This is worthwhile if you want to repeat many multiple cases for a given point or region. + +In general `the Section called Running PTS_MODE configurations `_ is the quick and dirty method that gets you started without having to create datasets -- but has limitations. +It's good for an initial attempt at seeing results for a point of interest, but since you can NOT restart with it, it's usage is limited. +It is the quickest method as you can create a case for it directly from **create_newcase**. Although you can't restart, running a single point is very fast, and you can run for long simulation times even without restarts. + +Next, ``CLM_USRDAT_NAME`` is the best way to setup cases quickly where you have to create your own datasets (see `the Section called Creating your own single-point/regional surface datasets `_). +With this method you don't have to change DATM or add files to the XML database -- but you have to follow a strict naming convention for files. +However, once the files are named and in the proper location, you can easily setup new cases that use these datasets. +This is good for treating all the required datasets as a "group" and for a particular model version. For advanced CLM developers who need to track dataset changes with different model versions you would be best off adding these datasets as supported datasets with the "normal supported datasets" method. + +Lastly *PTCLM* is a great way to easily create datasets, setup simulations and run simulations for tower sites. +It takes advantage of both normal supported site functionality and CLM_USRDAT_NAME internally. +A big advantage to it, is that it's one-stop shopping, it runs tools to create datasets, and runs **create_newcase** and sets the appropriate env variables for you. So you only have to learn how to run one tool, rather than work with many different ones. PTCLM is described in the next chapter `Chapter 6 `_. + +Finally, if you also have meteorology data that you want to force your CLM simulations with you'll need to setup cases as described in `the Section called Running with your own atmosphere forcing `_. +You'll need to create CLM datasets either according to ``CLM_USRDAT_NAME``. +You may also need to modify DATM to use your forcing data. +And you'll need to change your forcing data to be in a format that DATM can use. In the PTCLM chapter `the Section called Converting AmeriFlux Data for use by PTCLM in Chapter 6 `_ section tells you how to use AmeriFlux data for atmospheric forcing. + diff --git a/doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst new file mode 100644 index 0000000000..7c8bd313c5 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst @@ -0,0 +1,10 @@ +.. _spinning-up-sp: + +=========================================== + Spinning up the Satellite Phenology Model +=========================================== + +To spin-up the CLMSP model you merely need to run CLMSP for 50 simulation years starting from arbitrary initial conditions. +You then use the final restart file for initial conditions in other simulations. +Because, this is a straight forward operation we will NOT give the details on how to do that here, but leave it as an exercise for the reader. +See the `Example 4-7 `_ as an example of doing this as the last step for CLMCN. diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst new file mode 100644 index 0000000000..efb2f6b4aa --- /dev/null +++ b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst @@ -0,0 +1,75 @@ +.. _spinning-up-clm45-bgc: + +====================== + Spinup of CLM4.5-BGC +====================== + +To get the CLM4.5-BGC model to a steady state, you first run it from arbitrary initial conditions using the "accelerated decomposition spinup" (-bgc_spinup on in CLM **configure**) mode for 1000 simulation years. +After this you branch from this mode in the "final spinup" (-bgc_spinup off in CLM **configure**), and run for (at least 200+ simulation years). + +**1. 45_AD_SPINUP** + For the first step of running 1000+ years in "-bgc_spinup on" mode, you will setup a case, and then edit the values in env_build.xml and env_run.xml so that the right configuration is turned on and the simulation is setup to run for the required length of simulation time. So do the following: + +Example:: AD_SPINUP Simulation for CLM4.5-BGC +-------------------------------------------------------- +:: + + > cd scripts + > ./create_newcase -case BGC_spinup -res f19_g16 -compset I1850CRUCLM45BGC -mach yellowstone_intel + > cd BGC_spinup + # Append "-spinup on" to CLM_BLDNML_OPTS + > ./xmlchange CLM_BLDNML_OPTS="-bgc_spinup on" -append + # The following sets CLM_FORCE_COLDSTART to "on", and run-type to startup (you could also use an editor) + > ./xmlchange CLM_FORCE_COLDSTART=on,RUN_TYPE=startup + # Make the output history files only annual, by adding the following to the user_nl_clm namelist + > echo 'hist_nhtfrq = -8760' >> user_nl_clm + # Now setup + > ./cesm_setup -case + # Now build + > ./BGC_spinup.build + # The following sets RESUBMIT to 30 times in env_run.xml (you could also use an editor) + # The following sets STOP_DATE,STOP_N and STOP_OPTION to Jan/1/1001, 20, "nyears" in env_run.xml (you could also use an editor) + > ./xmlchange RESUBMIT=20,STOP_N=50,STOP_OPTION=nyears,STOP_DATE=10010101 + # Now run normally + > ./BGC_spinup.submit + +.. note:: This same procedure works for CLM4.5-CN as well, you can typically shorten the spinup time from 1000 years to 600 though. + +Afterwards save the last restart file from this simulation to use in the next step. + +**2. Final spinup for CLM4.5-BGC** + Next save the last restart file from this step and use it as the "finidat" file to use for one more spinup for at least 200+ years in normal mode. So do the following: + +Example: Final CLMBGC Spinup Simulation for CLM4.5-BGC +------------------------------------------------------------------ +:: + + > cd scripts + > ./create_newcase -case BGC_finalspinup -res f19_g16 -compset I1850CRUCLM45BGC -mach yellowstone_intel + > cd BGC_finalspinup + # Now, Copy the last CLM restart file from the earlier case into your run directory + > cp /ptmp/$LOGIN/archive/BGC_spinup/rest/BGC_spinup.clm*.r*.1002-01-01-00000.nc \ + /glade/scratch/$LOGIN/CN_finalspinup + # Set the runtype to startup + > ./xmlchange RUN_TYPE=startup + # And copy the rpointer files for datm and drv from the earlier case + > cp /glade/scratch/$LOGIN/archive/BGC_spinup/rest/rpointer.atm /ptmp/$LOGIN/CN_finalspinup + > cp /glade/scratch/$LOGIN/archive/BGC_spinup/rest/rpointer.drv /ptmp/$LOGIN/CN_finalspinup + # Set the finidat file to the last restart file saved in previous step + > echo ' finidat = "BGC_spinup.clm2.r.1002-01-01-00000.nc"' > user_nl_clm + # Now setup + > ./cesm_setup + > Now build + > ./BGC_finalspinup.build + # The following sets RESUBMIT to 4 times in env_run.xml (you could also use an editor) + # The following sets STOP_N and STOP_OPTION to 50 and "nyears" in env_run.xml (you could also use an editor) + > ./xmlchange RESUBMIT=4,STOP_OPTION=nyears,STOP_N=50 + > Now run as normal + > ./BGC_finalspinup.submit + +To assess if the model is spunup plot trends of CLMBGC variables of interest. If you see a trend, you may need to run the simulation longer. Finally save the restart file from the end of this simulation to use as an "finidat" file for future simulations. + +.. note:: This same final spinup procedure works for CLM4.5-CN as well, you can typically shorten the spinup time from 200 years to 50 though. + + + diff --git a/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst new file mode 100644 index 0000000000..709a1b26a6 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst @@ -0,0 +1,31 @@ +.. _running-with-moar-data: + +======================== + Running with MOAR data +======================== + +Because it takes so long to spinup the CN model (as we just saw previously), if you are doing fully coupled simulations with active atmosphere and ocean, you will want to do the spinup portion of this "offline". +So instead of doing expensive fully coupled simulations for the spinup duration, you run CLM in a very cheap "I" compset using atmospheric forcing from a shorter fully coupled simulation (or a simulation run previously by someone else). + +In this example we will use the ``I1850SPINUPCN compset`` to setup CLM to run with atmospheric forcing from a previous fully coupled simulation with data that is already stored on disk on yellowstone. +There are several simulations that have high frequency data for which we can do this. You can also do this on a machine other than yellowstone, but would need to download the data from the Earth System Grid and change the datapath similar to `Example 4-11 `_. + +Example: Simulation with MOAR Data on yellowstone +------------------------------------------------------------- +:: + + > cd scripts + > ./create_newcase -case MOARforce1850 -res f19_g16 -compset I1850SPINUPCN -mach yellowstone_intel + > cd MOARforce1850 + # The following sets the casename to point to for atm forcing (you could also use an editor) + > ./xmlchange DATM_CPL_CASE=b40.1850.track1.1deg.006a + # The following sets the align year and years to run over for atm forcing + # (you could also use an editor) + > ./xmlchange DATM_CPL_YR_ALIGN=1,DATM_CPL_YR_START=960,DATM_CPL_YR_END=1030 + > ./cesm_setup + # Now build and run as normal + > ./MOARforce1850.build + > ./MOARforce1850.submit + + +.. warning: Because of bug 1339 (see the `models/lnd/clm/doc/KnownBugs `_ file on this) you can't run with 83 or more years of forcing. If you do need to run with more years of forcing, you'll need to address the issue as outlined in the `models/lnd/clm/doc/KnownBugs `_ file. diff --git a/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst new file mode 100644 index 0000000000..7d523f7324 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst @@ -0,0 +1,75 @@ +.. _running-with-previous-simulation-forcing: + +============================================================= + Running with atmospheric forcing from a previous simulation +============================================================= + +Another way that you might want to spinup the model is to run your own simulation for a relatively short period (either a B, E, or F compset) and then use it as forcing for your "I" case later. +By only running 20 to 50 years for the fully coupled case, you'll save a substantial amount of computer time rather than running the entire spinup period with a fully coupled model. + +The first thing we need to do is to run a fully coupled case and save the atmospheric coupling fields on a three hourly basis. In this example, we will run on yellowstone and archive the data to a local disk that we can then use in the next simulation. + +Example: Fully Coupled Simulation to Create Data to Force Next Example Simulation +---------------------------------------------------------------------------------------------- +:: + + > cd scripts + > ./create_newcase -case myBCN1850 -res f09_g16 -compset B1850CN -mach yellowstone_intel + > cd myBCN1850 + > ./cesm_setup + # Set histaux_a2x3hr to .true. in your user_nl_cpl output from the atmosphere model + # will be saved 3 hourly + echo "histaux_a2x3hr=.true." >> user_nl_cpl + # edit the driver code in order to save the correct list of fields (see note below) + > cp ../../models/drv/driver/ccsm_comp_mod.F90 SourceMods/src.cpl + > $EDITOR SourceMods/src.cpl + # Now build + > ./myBCN1850.build + # The following sets the archival disk space (you could also use an editor) + > ./xmlchange DOUT_S_ROOT='/glade/home/$USER/$CASE' + # Make sure files are archived to disk, but NOT to long term storage + # (you could also use an editor) + > ./xmlchange DOUT_S=TRUE,DOUT_L_MS=FALSE + # Set the run length to run a total of 20 years (you could also use an editor) + > ./xmlchange RESUBMIT=9,STOP_OPTION=nyears,STOP_N=2 + # Now run as normal + > ./myBCN1850.submit + +.. warning:: Because of bug 1733 (see the `models/lnd/clm/doc/KnownBugs `_ file on this) you'll need to edit the driver code in order for it to produce the correct list of fields needed to run the model later. + +Now we run an I compset forced with the data from the previous simulation using the ``CPLHIST3HrWx`` option to DATM_MODE. See `the Section called CPLHIST3HrWx mode and it's DATM settings in Chapter 1 `_ for more information on the DATM settings for ``CPLHIST3HrWx`` mode. + +Example: Simulation Forced with Data from the Previous Simulation +------------------------------------------------------------------------------ +:: + + > cd scripts + > ./create_newcase -case frcwmyBCN1850 -res f09_g16 -compset I1850SPINUPCN -mach yellowstone_intel + > cd frcWmyBCN1850 + # The following sets the casename to point to for atm forcing (you could also use an editor) + > ./xmlchange DATM_CPLHIST_CASE="myBCN1850" + # The following sets the align year and years to run over for atm forcing + # (you could also use an editor) + > ./xmlchange DATM_CPLHIST_YR_ALIGN="1",DATM_CPLHIST_YR_START=1,DATM_CPLHIST_YR_END=20 + # Set the strm_datdir in the namelist_defaults_datm.xml + # file to the archival path of the case above in the form of: /glade/home/achive/$USER/$DATM_CPLHIST_CASE/cpl/hist + # NOTE: THIS WILL CHANGE THE PATH FOR ALL I1850SPINUPCN COMPSET CASES MADE AFTER THIS! + > $EDITOR ../../models/atm/datm/bld/namelist_files/namelist_defaults_datm.xml + > ./cesm_setup + # Now build and run as normal + > ./frcwmyBCN1850.build + > ./frcwmyBCN1850.submit + + +.. note:: We did this by editing the "namelist_defaults_datm.xml" which will change the settings for ALL future ``I1850SPINUPCN`` cases you run. You could also do this by editing the path in the resulting streams text files in the CaseDocs directory, and then create a "user\_" streams file with the correct path. This would change the streams file JUST for this case. The steps do it this way are: + +:: + + > ./preview_namelists + > cp CaseDocs/datm.streams.txt.CPLHIST3HrWx.Precip user_datm.streams.txt.CPLHIST3HrWx.Precip + > cp CaseDocs/datm.streams.txt.CPLHIST3HrWx.Solar user_datm.streams.txt.CPLHIST3HrWx.Solar + > cp CaseDocs/datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip user_datm.streams.txt.CPLHIST3HrWx.nonSolarNonPrecip + # Change the field to point to the correct directory i.e.: /glade/home/achive/$USER/$DATM_CPLHIST_CASE/cpl/hist + > $EDITOR user_datm.streams.txt.CPLHIST3HrWx.* + > ./preview_namelists + # Then make sure the CaseDocs/datm.streams.txt.CPLHIST3HrWx.* files have the correct path diff --git a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst new file mode 100644 index 0000000000..854450ff12 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst @@ -0,0 +1,138 @@ +.. _running-with-historical-co2-forcing: + +===================================== + Running with historical CO2 forcing +===================================== + +In this case you want to run a simulation with stand-alone CLM responding to changes in CO2 for a historical period. +For this example, we will start with the "I_1850-2000_CN" compset that has transient: land-use, Nitrogen and Aerosol deposition already. +You could also use another compset if you didn't want these other features to be transient. +In order to get CO2 to be transient we need to add a new streams file and add it to the list of streams in the user_nl_datm file. +You also need a NetCDF datafile that datm can read that gives the variation. You could supply your own file, but we have a standard file that is used by CAM for this and our example will make use of this file. + +.. note:: Most everything here has to do with changing datm rather than CLM to allow this to happen. As such the user that wishes to do this should first become more familiar with datm and read the `CESM Data Model User's Guide `_ especially as it pertains to the datm. + +.. warning:: This section documents the process for doing something that is non-standard. There may be errors with the documentation and process, and you may have to do some work before all of this works for you. If that is the case, we recommend that you do further research into understanding the process and the files, as well as understanding the datm and how it works. You may have to read documentation found in the code for datm as well as "csm_share". + +The datm has "streams" files that have rough XML-like syntax and specify the location and file to get data from, as well as information on the variable names and the data locations of the grid points. +The datm expects specific variable names and the datm "maps" the expected variable names from the file to the names expected by datm. +The file we are working with here is a file with a single-point, that covers the entire globe (so the vertices go from -90 to 90 degrees in latitude and 0 to 360 degrees in longitude). +Since it's a single point it's a little easier to work with than datasets that may be at a given horizontal resolution. +The datm also expects that variables will be in certain units, and only expects a limited number of variables so arbitrary fields can NOT be exchanged this way. +However, the process would be similar for datasets that do contain more than one point. + +The three things that are needed: a domain file, a data file, and a streams text file. +The domain file is a CF-compliant NetCDF file that has information on the grid points (latitudes and longitudes for cell-centers and vertices, mask , fraction, and areas). +The datafile is a CF-compliant NetCDF file with the data that will be mapped. +The streams text file is the XML-like file that tells datm how to find the files and how to map the variables datm knows about to the variable names on the NetCDF files. Note, that in our case the domain file and the data file are the same file. In other cases, the domain file may be separate from the data file. + +First we are going to create a case, and we will edit the ``user_nl_datm`` so that we add a CO2 data stream in. +There is a streams text file available in ``models/lnd/clm/doc/UsersGuide/co2_streams.txt``, that includes file with a CO2 time-series from 1765 to 2007. + + +Example: Transient Simulation with Historical CO2 +-------------------------------------------------------------- +:: + + > cd scripts + > ./create_newcase -case DATM_CO2_TSERIES -res f19_g16 -compset I20TRCRUCLM45BGC + > cd DATM_CO2_TSERIES + + # Set CCSM_BGC to CO2A so that CO2 will be passed from atmosphere to land + # Set CLM_CO2_TYPE to diagnostic so that the land will use the value sent from the atmosphere + > ./xmlchange CCSM_BGC=CO2A,CLM_CO2_TYPE=diagnostic + > ./case.setup + + # Create the streams file for CO2 + > cat << EOF >> datm.streams.txt.co2tseries + + + + This is a streams file to pass historical CO2 from datm8 to the other + surface models. It reads in a historical dataset derived from data used + by CAM. The getco2_historical.ncl script in models/lnd/clm2/tools/ncl_scripts + was used to convert the CAM file to a streams compatible format (adding domain + information and making CO2 have latitude/longitude even if only for a single + point. + + + + Input stream description file for historical CO2 reconstruction data + + 04 March 2010: Converted to form that can be used by datm8 by Erik Kluzek + 18 December 2009: Prepared by B. Eaton using data provided by + Jean-Francois Lamarque. All variables except f11 are directly from + PRE2005_MIDYR_CONC.DAT. Data from 1765 to 2007 with 2006/2007 just + a repeat of 2005. + + + CLMNCEP + + + + time time + lonc lon + latc lat + area area + mask mask + + + $CSMDATA/atm/datm7/CO2 + + + fco2_datm_1765-2007_c100614.nc + + + + + CO2 co2diag + + + $CSMDATA/atm/datm7/CO2 + + + fco2_datm_1765-2007_c100614.nc + + + + + + EOF + + # And copy it to the run directory + > cp datm.streams.txt.co2tseries $RUNDIR + + # Run preview namelist so we have the namelist in CaseDocs + > ./preview_namelists + +The first thing we will do is to edit the ``user_nl_datm`` file to add a CO2 file stream in. +To do this we will copy a ``user_nl_datm`` in with the changes needed. The file ``addco2_user_nl_datm.user_nl`` is in ``models/lnd/clm/doc/UsersGuide`` and looks like this... +:: + + dtlimit = 1.5,1.5,1.5,1.5,1.5 + fillalgo = 'nn','nn','nn','nn','nn' + fillmask = 'nomask','nomask','nomask','nomask','nomask' + mapalgo = 'bilinear','bilinear','bilinear','bilinear','nn' + mapmask = 'nomask','nomask','nomask','nomask',nomask' + 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.presaero.trans_1850-2000 1849 1849 2006", + "datm.streams.txt.co2tseries 1766 1766 2005 " + taxmode = 'cycle','cycle','cycle','cycle','extend' + tintalgo = 'coszen','nearest','linear','linear','linear' + +You just copy this into your case directory. But, also compare it to the version in ``CaseDocs`` to make sure the changes are just to add in the new CO2 stream. Check to see that filenames, and start, end and align years are correct. +:: + + > cp ../../models/lnd/clm/doc/UsersGuide/addco2_user_nl_datm.user_nl user_nl_datm + > diff user_nl_datm CaseDocs/datm_atm_in + +Once, you've done that you can build and run your case normally. + +.. warning:: This procedure assumes you are using a ``I20TRCRUCLM45BGC`` compset out of the box, with ``DATM_PRESAERO`` equal to trans_1850-2000. So it assumes standard CLM4.5 CRUNCEP atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes anything here your ``user_nl_datm`` file will need to be adjusted to work with it. + +.. note:: The intent of the ``user_nl_datm`` is to add an extra streams file for CO2 to the end of the streams variable, and other arrays associated with streams (adding mapalgo as a new array with bilinear for everything, but the CO2 file which should be "nn" for nearest neighbor). Other variables should be the same as the other stream values. + +.. warning:: The streams file above is hard-coded for the path of the file on NCAR computers. To use it on an outside machine you'll need to edit the filepath in the streams file to point to the location where you have the file. + +After going through these steps, you will have a case where you have datm reading in an extra streams text file that points to a data file with CO2 data on it that will send that data to the CLM. + diff --git a/doc/source/users_guide/running-special-cases/index.rst b/doc/source/users_guide/running-special-cases/index.rst new file mode 100644 index 0000000000..af69b010da --- /dev/null +++ b/doc/source/users_guide/running-special-cases/index.rst @@ -0,0 +1,22 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _running-special-cases-section: + +##################################### +Running Special Cases +##################################### + +.. toctree:: + :maxdepth: 2 + + what-is-a-special-case.rst + running-the-prognostic-crop-model.rst + running-with-irrigation.rst + CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst + CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst + CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst + CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst + CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst diff --git a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst new file mode 100644 index 0000000000..31691e721d --- /dev/null +++ b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst @@ -0,0 +1,31 @@ +.. running-prognostic-crop-model: + +=================================== + Running the prognostic crop model +=================================== + +The prognostic crop model is setup to work with CLM4.5-BGC or CLM4.0-CN (with or without DV) for present day conditions and we have surface and initial condition datasets at f19 resolution. +In order to use the initial condition file, we need to set the ``RUN_TYPE`` to startup rather than ``hybrid`` since the compset for f19 sets up to use an initial condition file without crop active. +To activate the crop model you can choose a compset that has "CROP" in the name such as "ICRUCLM45BGCCROP" or simply add "-crop on" to ``CLM_CONFIG_OPTS``. + +Example: Crop Simulation +------------------------------------ +:: + + > cd scripts + > ./create_newcase -case CROP -res f19_g16 -compset I1850CRUCLM45BGC + > cd CROP + + # Append "-crop on" to CLM_CONFIG_OPTS in env_build.xml (you could also use an editor) + > ./xmlchange CLM_CONFIG_OPTS="-crop on" -append + + # Change to startup type so uses spunup initial conditions file for crop if it exists + # By default the model will do a hybrid startup with an initial condition file + # incompatible with the crop surface dataset. + + > ./xmlchange RUN_TYPE=startup + > ./case.setup + + # Now build and run normally + > ./case.build + > ./case.submit diff --git a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst new file mode 100644 index 0000000000..4a39f6ec5f --- /dev/null +++ b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst @@ -0,0 +1,33 @@ +.. running-with-irrigation: + +=================================== + Running with irrigation +=================================== + +In CLM4.5 irrigation can ONLY be used WITH crop. +To turn on irrigation in CLM4.5 we simply add "-irrig on" to ``CLM_BLDNML_OPTS``. +Just as in the crop example we also change ``RUN_TYPE`` to ``startup`` so that we don't use an initial condition file that is incompatible with irrigation. + +Example: Irrigation Simulation +------------------------------------------ +:: + + # Note here we do a CLMSP simulation as that is what has been validated + > cd scripts + > ./create_newcase -case IRRIG -res f19_g16 -compset I + > cd IRRIG + + # Append "-irrig" to CLM_BLDNML_OPTS in env_run.xml (you could also use an editor) + > ./xmlchange CLM_BLDNML_OPTS="-irrig" -append + + # Change to startup type so uses spunup initial conditions file for irrigation if it exists + # By default the model will do a hybrid startup with an initial condition file + # incompatible with the irrigation surface dataset. + > ./xmlchange RUN_TYPE=startup + > ./case.setup + + # Now build and run normally + > ./case.build + > ./case.submit + + diff --git a/doc/source/users_guide/running-special-cases/what-is-a-special-case.rst b/doc/source/users_guide/running-special-cases/what-is-a-special-case.rst new file mode 100644 index 0000000000..32daabafc6 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/what-is-a-special-case.rst @@ -0,0 +1,12 @@ +.. _what is a special case: + +========================= + What is a special case? +========================= + +All of the following special cases cases that take more than one step to do. +The straightforward cases have compsets and/or build-namelist use-cases setup for them or require simple editing of a single-case. +All of the cases here require you to do at least two simulations with different configurations, or require more complex editing of the case (changing the streams files). + +.. note:: The cases in this chapter are more sophisticated and require more technical knowledge and skill than cases in previous chapters. The user should be very familiar with doing simple cases before moving onto the cases described here. + diff --git a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst new file mode 100644 index 0000000000..806d76d966 --- /dev/null +++ b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst @@ -0,0 +1,321 @@ +.. _choosing-a-compset: + +==================== + Choosing a compset +==================== + +When setting up a new case one of the first choices to make is which "component set" (or compset) to use. +The compset refers to which component models are used as well as specific settings for them. +We label the different types of compsets with a different letter of the alphabet from "A" (for all data model) to "X" (for all dead model). +The compsets of interest when working with CLM are the "I" compsets (which contain CLM with a data atmosphere model and a stub ocean, and stub sea-ice models), "E" and "F" compsets (which contain CLM with the active atmosphere model (CAM), prescribed sea-ice model, and a data ocean model), and "B" compsets which have all active components. +Below we go into details on the "I" compsets which emphasize CLM as the only active model, and just mention the two other categories. + +When working with CLM you usually want to start with a relevant "I" compset before moving to the more complex cases that involve other active model components. +The "I" compsets can exercise CLM in a way that is similar to the coupled modes, but with much lower computational cost and faster turnaround times. + +Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) +------------------------------------------------------------------------- + +`Supported CLM Configurations `_ are listed in `Table 1-1 `_ for the Scientifically Supported compsets (have been scientifically validated with long simulations) and in `Table 1-2 `_ for the Functionally Supported compsets (we've only checked that they function). + + +**Scientifically Supported I Compsets:** + ++------------+--------------+-----------+-----------------+----------------+ +| Short Name | Description | Atm. | Compset Alias | Period | +| | | Forcing | Name | | ++============+==============+===========+=================+================+ +| CLM4.5SP | Satellite | CRUNCEP | 1850CRUCLM45 | 1850 | +| | phenology | | | | +| | with new | | | | +| | biogeophys | | | | ++------------+--------------+-----------+-----------------+----------------+ +| CLM4.5SP | New | CRUNCEP | I1850CRUCLM45BGC| 1850 | +| | biogeophys | +-----------------+----------------+ +| | + CENTURY- | | I20TRCRUCLM45BGC| 20th Century | +| | like | | | | +| | vertically | | | | +| | resolved | | | | +| | soil | | | | +| | BGC + CH4 | | | | +| | emissions, | | | | +| | nitrogen | | | | +| | updates | | | | ++------------+--------------+-----------+-----------------+----------------+ +| CLM4.5CN | New | CRUNCEP | I1850CRUCLM45CN | 1850 | +| | biogeophys | | | | +| | + CN soil | | | | +| | BGC, updates | | | | ++------------+--------------+-----------+-----------------+----------------+ +| CLM4SP | As in | Qian | I1850 | 1850 | +| | CCSM4/CESM1 | +-----------------+----------------+ +| | release | | I | 2000 | +| | | +-----------------+----------------+ +| | | | I20TR | 20th Century | ++------------+--------------+-----------+-----------------+----------------+ +| CLM4CN | As in | Qian | I1850CN | 1850 | +| | CCSM4/CESM1 | +-----------------+----------------+ +| | release | | ICN | 2000 | +| | | +-----------------+----------------+ +| | | | I20TRCN | 20th Century | +| | | +-----------------+----------------+ +| | | | IRCP26CN | RCP 2.6 to 2100| +| | | +-----------------+----------------+ +| | | | IRCP45CN | RCP 4.5 to 2100| +| | | +-----------------+----------------+ +| | | | IRCP60CN | RCP 6.0 to 2100| +| | | +-----------------+----------------+ +| | | | IRCP85CN | RCP 8.5 to 2100| ++------------+--------------+-----------+-----------------+----------------+ + +**Functionally Supported I Compsets:** + ++------------+-------------------+-------------------+-----------------+--------+ +| Short Name | Description | Atm. | Compset Alias | Period | +| | | Forcing | Name | | ++============+===================+===================+=================+========+ +| CLM4.5BGC- | ICRUCLM45BGCCROP | New biogeophys + | CRUNCEP | 2000 | +| CROP | | CENTURY-like | | | +| | | vertically | | | +| | | resolved soil | | | +| | | BGC + CH4 | | | +| | | emissions, | | | +| | | nitrogen updates | | | +| | | with prognostic | | | +| | | CROP | | | +| | | | | | ++------------+-------------------+-------------------+-----------------+--------+ +| CLM4.5BGC- | I1850CRUCLM45BGCDV| New biogeophys | CRUNCEP | 1850 | +| DV | | + CENTURY-like | | | +| | | vertically | | | +| | | resolved soil | | | +| | | BGC + CH4 | | | +| | | emissions, | | | +| | | nitrogen updates | | | +| | | with DV | | | +| | | | | | +| | | | | | +| | | | | | ++------------+-------------------+-------------------+-----------------+--------+ +| CLM4.5SP- | ICLM45VIC | Satellite | Qian | 2000 | +| VIC | | phenology with new| | | +| | | biogeophys with | | | +| | | VIC hydrology | | | ++------------+-------------------+-------------------+-----------------+--------+ +|CLM4CN-CROP | ICNCROP | As in CCSM4/CESM1 | Qian | 2000 | +| | | release | | | ++------------+-------------------+-------------------+-----------------+--------+ +|CLM4CN-DV | ICNDV | As in CCSM4/CESM1 | Qian | 1850 | +| | | release | | | ++------------+-------------------+-------------------+-----------------+--------+ + +Here is the entire list of compsets available. +Note that using the "-user_compset" option even more combinations are possible. +In the list below we give the alias name and then the long name which describes each component in parenthesis. +Alias (Long-name with time-period and each component) + +1. ``I`` (2000_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850`` (1850_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CLM45`` (1850_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CLM45BGC`` (1850_DATM%QIA_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CLM45CN`` (1850_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CLM45CNF`` (1850_DATM%QIA_CLM45%CN_SICE_SOCN_RTM%FLOOD_SGLC_SWAV) + +#. ``I1850CN`` (1850_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CRU`` (1850_DATM%CRU_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CRUCLM45`` (1850_DATM%CRU_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CRUCLM45BGC`` (1850_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CRUCLM45BGCDV`` (1850_DATM%CRU_CLM45%BGCDV_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CRUCLM45CN`` (1850_DATM%CRU_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850CRUCN`` (1850_DATM%CRU_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850SPINUPCLM45BGC`` (1850_DATM%S1850_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1850SPINUPCN`` (1850_DATM%S1850_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1PT`` (2000_DATM%1PT_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I1PTCLM45`` (2000_DATM%1PT_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TR`` (20TR_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TRCLM45`` (20TR_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TRCLM45CN`` (20TR_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TRCN`` (20TR_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TRCRU`` (20TR_DATM%CRU_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TRCRUCLM45`` (20TR_DATM%CRU_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TRCRUCLM45BGC`` (20TR_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TRCRUCLM45CN`` (20TR_DATM%CRU_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I20TRCRUCN`` (20TR_DATM%CRU_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I4804`` (4804_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I4804CLM45`` (4804_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I4804CLM45CN`` (4804_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``I4804CN`` (4804_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45`` (2000_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45BGC`` (2000_DATM%QIA_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45BGCCROP`` (2000_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45BGCDV`` (2000_DATM%QIA_CLM45%BGCDV_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45BGCDVCROP`` (2000_DATM%QIA_CLM45%BGCDV-CROP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45BGCNoVS`` (2000_DATM%QIA_CLM45%NoVS_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45CN`` (2000_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45CNCROP`` (2000_DATM%QIA_CLM45%CN-CROP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45CNDV`` (2000_DATM%QIA_CLM45%CNDV_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45CNTEST`` (2003_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV_TEST) + +#. ``ICLM45CRUBGC`` (2000_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45GLCMEC`` (2000_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV_TEST) + +#. ``ICLM45SNCRFRC`` (2000_DATM%QIA_CLM45%SP-SNCR_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45USUMB`` (2000_DATM%1PT_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV_CLMUSRDAT%1x1_US-UMB) + +#. ``ICLM45VIC`` (2000_DATM%QIA_CLM45%SP-VIC_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICLM45alaskaCN`` (2000_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV_CLMUSRDAT%13x12pt_f19_alaskaUSA) + +#. ``ICN`` (2000_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICNCROP`` (2000_DATM%QIA_CLM40%CN-CROP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICNDV`` (2000_DATM%QIA_CLM40%CNDV_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICNDVCROP`` (2000_DATM%QIA_CLM40%CNDV-CROP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICNTEST`` (2003_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV_TEST) + +#. ``ICRU`` (2000_DATM%CRU_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICRUCLM45`` (2000_DATM%CRU_CLM45_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICRUCLM45BGC`` (2000_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICRUCLM45BGCCROP`` (2000_DATM%CRU_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICRUCLM45BGCTEST`` (2003_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV_TEST) + +#. ``ICRUCLM45CN`` (2000_DATM%CRU_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ICRUCN`` (2000_DATM%CRU_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``IG`` (2000_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG1850`` (1850_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG1850CLM45`` (1850_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG1850CLM45CN`` (1850_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG1850CN`` (1850_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG20TR`` (20TR_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG20TRCLM45`` (20TR_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG20TRCLM45CN`` (20TR_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG20TRCN`` (20TR_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG4804`` (4804_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG4804CLM45`` (4804_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG4804CLM45CN`` (4804_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IG4804CN`` (4804_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGCLM45`` (2000_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGCLM45CN`` (2000_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGCN`` (2000_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGLCMEC`` (2000_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV_TEST) + +#. ``IGRCP26CLM45CN`` (RCP2_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGRCP26CN`` (RCP2_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGRCP45CLM45CN`` (RCP4_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGRCP45CN`` (RCP4_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGRCP60CLM45CN`` (RCP6_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGRCP60CN`` (RCP6_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGRCP85CLM45CN`` (RCP8_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IGRCP85CN`` (RCP8_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) + +#. ``IRCP26CLM45CN`` (RCP2_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``IRCP26CN`` (RCP2_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``IRCP45CLM45CN`` (RCP4_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``IRCP45CN`` (RCP4_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``IRCP60CLM45CN`` (RCP6_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``IRCP60CN`` (RCP6_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``IRCP85CLM45CN`` (RCP8_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``IRCP85CN`` (RCP8_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ISNCRFRC`` (2000_DATM%QIA_CLM40%SP-SNCR_SICE_SOCN_RTM_SGLC_SWAV) + +#. ``ITEST`` (2003_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV_TEST) + +#. ``ITESTCLM45`` (2003_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV_TEST) + +#. ``IUSUMB`` (2000_DATM%1PT_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV_CLMUSRDAT%1x1_US-UMB) + +#. ``IalaskaCN`` (2000_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV_CLMUSRDAT%13x12pt_f19_alaskaUSA) + +Compsets coupled to active atmosphere with data ocean +----------------------------------------------------- +CAM compsets are compsets that start with "E" or "F" in the name. They are described more fully in the scripts documentation or the CAM documentation. "E" compsets have a slab ocean model while "F" compsets have a data ocean model. + +Fully coupled compsets with fully active ocean, sea-ice, and atmosphere +----------------------------------------------------------------------- +Fully coupled compsets are compsets that start with "B" in the name. They are described more fully in the scripts documentation. + +Conclusion to choosing a compset +-------------------------------- +We've introduced the basic type of compsets that use CLM and given some further details for the "standalone CLM" (or "I" compsets). +The `config_compsets.xml `_ lists all of the compsets and gives a full description of each of them. +In the next section we look into customizing the setup time options for compsets using CLM. diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst new file mode 100644 index 0000000000..ed00d99483 --- /dev/null +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst @@ -0,0 +1,688 @@ +.. _configuring-clm: + +******************************* +Customizing CLM's Configuration +******************************* + +The "Creating a Case" section of the `CESM1.2.0 Scripts User's-Guide `_ gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. + +For CLM when **preview_namelist**, **$CASE.build**, or **$CASE.run** are called there are two steps that take place: + +1. The CLM "**configure**" script is called to setup the build-time configuration for CLM (more information on **configure** is given in `the Section called More information on the CLM configure script `_). The env variables for **configure** are locked after the **$CASE.build** step. So the results of the CLM **configure** are locked after the build has taken place. + +2. The CLM "**build-namelist**" script is called to generate the run-time namelist for CLM (more information on **build-namelist** is given below in `the Section called Definition of Namelist items and their default values `_. + +When customizing your case at the *8cesm_setup** step you are able to modify the process by effecting either one or both of these steps. The CLM "**configure**" and "**build-namelist**" scripts are both available in the "models/lnd/clm/bld" directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what types of options you can give either of them. + +There are five different types of customization for the configuration that we will discuss: CLM4.5 in CESM1.2.0 build-time options, CLM4.5 in CESM1.2.0 run-time options, User Namelist, other noteworthy CESM1.2.0 configuration items, the CLM **configure** script options, and the CLM **build-namelist** script options. + +Information on all of the script, configuration, build and run items is found under ``scripts/ccsm_utils/Case.template`` in the `config_definition.xml `_ file. + +================================ + CLM Script configuration items +================================ + +Below we list each of the CESM configuration items that are specific to CLM. All of these are available in your: ``env_build.xml`` and ``env_run.xml`` files. +:: + + CLM_CONFIG_OPTS + CLM_BLDNML_OPTS + CLM_NAMELIST_OPTS + CLM_FORCE_COLDSTART + CLM_NML_USE_CASE + CLM_USRDAT_NAME + CLM_CO2_TYPE + +For the precedence of the different options to **build-namelist** see the section on precedence below. + +The first item ``CLM_CONFIG_OPTS`` has to do with customizing the CLM build-time options for your case, the rest all have to do with generating the namelist. + +CLM_CONFIG_OPTS + The option ``CLM_CONFIG_OPTS`` is all about passing command line arguments to the CLM **configure** script. + It is important to note that some compsets, may already put a value into the ``CLM_CONFIG_OPTS`` variable. + You can still add more options to your ``CLM_CONFIG_OPTS`` but make sure you add to what is already there rather than replacing it. + Hence, we recommend using the "-append" option to the xmlchange script. + In `the Section called More information on the CLM configure script `_ below we will go into more details on options that can be customized in the CLM "**configure**" script. + It's also important to note that the **clm.buildnml.csh** script may already invoke certain CLM **configure** options and as such those command line options are NOT going to be available to change at this step (nor would you want to change them). + The options to CLM **configure** are given with the "-help" option which is given in `the Section called More information on the CLM configure script `_. + .. note:: ``CLM_CONFIG_OPTS`` is locked after the **$CASE.build** script is run. If you want to change something in ``CLM_CONFIG_OPTS`` you'll need to clean the build and rerun **$CASE.build**. The other env variables can be changed at run-time so are never locked. + +CLM_NML_USE_CASE + ``CLM_NML_USE_CASE`` is used to set a particular set of conditions that set multiple namelist items, all centering around a particular usage of the model. To list the valid options do the following: + :: + + > cd models/lnd/clm/doc + > ../bld/build-namelist -use_case list + + The output of the above command is: + :: + + CLM build-namelist - use cases: 1850-2100_rcp2.6_glacierMEC_transient 1850-2100_rcp2.6_transient \ + 1850-2100_rcp4.5_glacierMEC_transient 1850-2100_rcp4.5_transient \ + 1850-2100_rcp6_glacierMEC_transient 1850-2100_rcp6_transient \ + 1850-2100_rcp8.5_glacierMEC_transient 1850-2100_rcp8.5_transient 1850_control \ + 1850_glacierMEC_control 2000-2100_rcp8.5_transient 2000_control 2000_glacierMEC_control \ + 20thC_glacierMEC_transient 20thC_transient glacierMEC_pd stdurbpt_pd + Use cases are:... + + 1850-2100_rcp2.6_glacierMEC_transient = Simulate transient land-use, and aerosol deposition changes \ + with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE + + 1850-2100_rcp2.6_transient = Simulate transient land-use, and aerosol deposition changes with \ + historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE + + 1850-2100_rcp4.5_glacierMEC_transient = Simulate transient land-use, and aerosol deposition changes \ + with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM + + 1850-2100_rcp4.5_transient = Simulate transient land-use, and aerosol deposition changes with \ + historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM + + 1850-2100_rcp6_glacierMEC_transient = Simulate transient land-use, and aerosol deposition changes \ + with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM + + 1850-2100_rcp6_transient = Simulate transient land-use, and aerosol deposition changes with \ + historical data from 1850 to 2005 and then with the RCP6 scenario from AIM + + 1850-2100_rcp8.5_glacierMEC_transient = Simulate transient land-use, and aerosol deposition changes \ + with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE + + 1850-2100_rcp8.5_transient = Simulate transient land-use, and aerosol deposition changes with \ + historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE + + 1850_control = Conditions to simulate 1850 land-use + 1850_glacierMEC_control = Running an IG case for 1850 conditions with the ice sheet model glimmer + 2000-2100_rcp8.5_transient = Simulate transient land-use, and aerosol deposition changes with \ + historical data from 2000 to 2005 and then with the RCP8.5 scenario from MESSAGE + + 2000_control = Conditions to simulate 2000 land-use + 2000_glacierMEC_control = Running an IG case for 2000 conditions with the ice sheet model glimmer + 20thC_glacierMEC_transient = Simulate transient land-use, and aerosol deposition changes from 1850 \ + to 2005 + 20thC_transient = Simulate transient land-use, and aerosol deposition changes from 1850 to 2005 + glacierMEC_pd = Running an IG case with the ice sheet model glimmer + stdurbpt_pd = Standard Urban Point Namelist Settings + + .. note::See the `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. + +CLM_BLDNML_OPTS + The option CLM_BLDNML_OPTS is for passing options to the CLM "build-namelist" script. + As with the CLM "configure" script the CLM clm.buildnml.csh may already invoke certain options and as such those options will NOT be available to be set here. The best way to see what options can be sent to the "build-namelist" script is to do + :: + + > cd models/lnd/clm/bld + > ./build-namelist -help + + Here is the output from the above. + :: + + ./SYNOPSIS + build-namelist [options] + + Create the namelist for CLM + OPTIONS + -[no-]chk_res Also check [do NOT check] to make sure the resolution and + land-mask is valid. + -clm_demand "list" List of variables to require on clm namelist besides the usuals. + "-clm_demand list" to list valid options. + (can include a list member "null" which does nothing) + -clm_startfile "file" CLM restart file to start from. + -clm_start_type "type" Start type of simulation + (default, cold, arb_ic, startup, continue, or branch) + (default=do the default type for this configuration) + (cold=always start with arbitrary initial conditions) + (arb_ic=start with arbitrary initial conditions if + initial conditions don't exist) + (startup=ensure that initial conditions are being used) + -clm_usr_name "name" Dataset resolution/descriptor for personal datasets. + Default: not used + Example: 1x1pt_boulderCO_c090722 to describe location, + number of pts, and date files created + -co2_type "value" Set CO2 the type of CO2 variation to use. + -co2_ppmv "value" Set CO2 concentration to use when co2_type is constant (ppmv). + -config "filepath" Read the given CLM configuration cache file. + Default: "config_cache.xml". + -csmdata "dir" Root directory of CESM input data. + Can also be set by using the CSMDATA environment variable. + -d "directory" Directory where output namelist file will be written + Default: current working directory. + -drydep Produce a drydep_inparm namelist that will go into the + "drv_flds_in" file for the driver to pass dry-deposition to the atm. + Default: -no-drydep + (Note: buildnml.csh copies the file for use by the driver) + -glc_grid "grid" Glacier model grid and resolution when glacier model, + Only used if glc_nec > 0 for determining fglcmask + Default: gland5UM + (i.e. gland20, gland10 etcetera) + -glc_nec Glacier number of elevation classes [0 | 3 | 5 | 10 | 36] + (default is 0) (standard option with land-ice model is 10) + -glc_smb Only used if glc_nec > 0 + If .true., pass surface mass balance info to GLC + If .false., pass positive-degree-day info to GLC + Default: true + -help [or -h] Print usage to STDOUT. + -ignore_ic_date Ignore the date on the initial condition files + when determining what input initial condition file to use. + -ignore_ic_year Ignore just the year part of the date on the initial condition files + when determining what input initial condition file to use. + -infile "filepath" Specify a file (or list of files) containing namelists to + read values from. + + If used with a CLM build with multiple ensembles (ninst_lnd>1) + and the filename entered is a directory to files of the + form filepath/filepath and filepath/filepath_$n where $n + is the ensemble member number. the "filepath/filepath" + input namelist file is the master input namelist file + that is applied to ALL ensemble members. + + (by default for CESM this is setup for files of the + form $CASEDIR/user_nl_clm/user_nl_clm_????) + -inputdata "filepath" Writes out a list containing pathnames for required input datasets in + + file specified. + -irrig "value" If .true. turn irrigation on with namelist logical irrigate (for CLM4.5 physics) + (requires crop to be on in the clm configuration) + Seek surface datasets with irrigation turned on. (for CLM4.0 physics) + Default: .false. + -l_ncpl "LND_NCPL" Number of CLM coupling time-steps in a day. + -lnd_frac "domainfile" Land fraction file (the input domain file) + -mask "landmask" Type of land-mask (default, navy, gx3v5, gx1v5 etc.) + "-mask list" to list valid land masks. + -namelist "namelist" Specify namelist settings directly on the commandline by supplying + a string containing FORTRAN namelist syntax, e.g., + -namelist "&clm_inparm dt=1800 /" + -no-megan DO NOT PRODUCE a megan_emis_nl namelist that will go into the + "drv_flds_in" file for the driver to pass VOCs to the atm. + MEGAN (Model of Emissions of Gases and Aerosols from Nature) + (Note: buildnml.csh copies the file for use by the driver) + -[no-]note Add note to output namelist [do NOT add note] about the + arguments to build-namelist. + -rcp "value" Representative concentration pathway (rcp) to use for + future scenarios. + "-rcp list" to list valid rcp settings. + -res "resolution" Specify horizontal grid. Use nlatxnlon for spectral grids; + dlatxdlon for fv grids (dlat and dlon are the grid cell size + in degrees for latitude and longitude respectively) + "-res list" to list valid resolutions. + -s Turns on silent mode - only fatal messages issued. + -sim_year "year" Year to simulate for input datasets + (i.e. 1850, 2000, 1850-2000, 1850-2100) + "-sim_year list" to list valid simulation years + -bgc_spinup "on|off" CLM 4.5 Only. For CLM 4.0, spinup is controlled from configure. + Turn on given spinup mode for BGC setting of CN + on : Turn on Accelerated Decomposition (spinup_state = 1) + off : run in normal mode (spinup_state = 0) + + Default is off. + + Spinup is now a two step procedure. First, run the model + with spinup = "on". Then run the model for a while with + spinup = "off". The exit spinup step happens automatically + on the first timestep when using a restart file from spinup + mode. + + The spinup state is saved to the restart file. + If the values match between the model and the restart + file it proceeds as directed. + + If the restart file is in spinup mode and the model is in + normal mode, then it performs the exit spinup step + and proceeds in normal mode after that. + + If the restart file has normal mode and the model is in + spinup, then it enters spinup. This is useful if you change + a parameter and want to rapidly re-equilibrate without doing + a cold start. + + -test Enable checking that input datasets exist on local filesystem. + -verbose [or -v] Turn on verbose echoing of informational messages. + -use_case "case" Specify a use case which will provide default values. + "-use_case list" to list valid use-cases. + -version Echo the SVN tag name used to check out this CLM distribution. + + + + Note: The precedence for setting the values of namelist variables is (highest to lowest): + 0. namelist values set by specific command-line options, like, -d, -sim_year + (i.e. CLM_BLDNML_OPTS env_run variable) + 1. values set on the command-line using the -namelist option, + (i.e. CLM_NAMELIST_OPTS env_run variable) + 2. values read from the file(s) specified by -infile, + (i.e. user_nl_clm files) + 3. datasets from the -clm_usr_name option, + (i.e. CLM_USRDAT_NAME env_run variable) + 4. values set from a use-case scenario, e.g., -use_case + (i.e. CLM_NML_USE_CASE env_run variable) + 5. values from the namelist defaults file. + + +The **clm.buildnml.csh** script already sets the resolution and mask as well as the CLM **configure** file, and defines an input namelist and namelist input file, and the output namelist directory, and sets the start-type (from ``RUN_TYPE``), namelist options (from ``CLM_NAMELIST_OPTS``), co2_ppmv (from ``CCSM_CO2_PPMV``, co2_type (from ``CLM_CO2_TYPE``), lnd_frac (from ``LND_DOMAIN_PATH`` and ``LND_DOMAIN_FILE``), l_ncpl (from ``LND_NCPL``, glc_grid, glc_smb, glc_nec (from ``GLC_GRID``, ``GLC_SMB``, and ``GLC_NEC``), and "clm_usr_name" is set (to ``CLM_USRDAT_NAME >``when the grid is set to ``CLM_USRDAT_NAME``. +Hence only the following different options can be set: + +1. +-bgc_spinup + +#. -chk_res + +#. -clm_demand + +#. -drydep + +#. -ignore_ic_date + +#. -ignore_ic_year + +#. -irrig + +#. -no-megan + +#. -note + +#. -rcp + +#. -sim_year + +#. -verbose + + +"-bgc_spinup" is an option only available for CLM4.5 for any configuration when CN is turned on (so either CLMCN or CLMBGC). It can be set to "on" or "off". If "on" the model will go into Accelerated Decomposition mode, while for "off" (the default) it will have standard decomposition rates. If you are starting up from initial condition files the model will check what mode the initial condition file is in and do the appropriate action on the first time-step to change the Carbon pools to the appropriate spinup setting. See `the Section called Spinning up the CLM4.5 biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for an example using this option. + +"-chk_res" ensures that the resolution chosen is supported by CLM. If the resolution is NOT supported it will cause the CLM **build-namelist** to abort when run. So when either **preview_namelist**, **$CASE.build** or **$CASE.run** is executed it will abort early. Since, the CESM scripts only support certain resolutions anyway, in general this option is NOT needed in the context of running CESM cases. + +"-clm_demand" asks the **build-namelist** step to require that the list of variables entered be set. Typically, this is used to require that optional filenames be used and ensure they are set before continuing. For example, you may want to require that fpftdyn be set to get dynamically changing vegetation types. To do this you would do the following. +:: + + > ./xmlchange CLM_BLDNML_OPTS="-clm_demand fpftdyn"`` + +To see a list of valid variables that you could set do this: +:: + + > cd models/lnd/clm/doc + > ../bld/build-namelist -clm_demand list + + +.. note:: Using a 20th-Century transient compset or the ``20thC_transient`` use-case using ``CLM_NML_USE_CASE`` would set this as well, but would also use dynamic nitrogen and aerosol deposition files, so using ``-clm_demand`` would be a way to get *just* dynamic vegetation types and NOT the other files as well. + +"-drydep" adds the dry-deposition namelist to the driver. This is a driver namelist, but adding the option here has CLM **build-namelist** create the ``drv_flds_in`` file that the driver will copy over and use. Invoking this option does have an impact on performance even for I compsets and will slow the model down. It's also only useful when running with an active atmosphere model that makes use of this information. + +"-ignore_ic_date" ignores the Initial Conditions (IC) date completely for finding initial condition files to startup from. Without this option or the "-ignore_ic_year" option below, the date of the file comes into play. + +"-ignore_ic_year" ignores the Initial Conditions (IC) year for finding initial condition files to startup from. The date is used, but the year is ignored. Without this option or the "-ignore_ic_date" option below, the date and year of the file comes into play. + +When "-irrig" is used **build-namelist** will try to find surface datasets that have the irrigation model enabled. + +"no-megan" means do NOT add the MEGAN model Biogenic Volatile Organic Compounds (BVOC) namelist to the driver. This namelist is created by default, so normally this WILL be done. This is a driver namelist, so unless "no-megan" is specified the CLM **build-namelist** will create the ``drv_flds_in`` file that the driver will copy over and use (if you are running with CAM and CAM produces this file as well, it's file will have precedence). + +"-note" adds a note to the bottom of the namelist file, that gives the details of how **build-namelist** was called, giving the specific command-line options given to it. + +"-rcp" is used to set the representative concentration pathway for the future scenarios you want the data-sets to simulate conditions for, in the input datasets. To list the valid options do the following: +:: + + > cd models/lnd/clm/doc + > ../bld/build-namelist -rcp list + +"-sim_year" is used to set the simulation year you want the data-sets to simulate conditions for in the input datasets. The simulation "year" can also be a range of years in order to do simulations with changes in the dataset values as the simulation progresses. To list the valid options do the following: +:: + + > cd models/lnd/clm/doc + > ../bld/build-namelist -sim_year list + +``CLM_NAMELIST_OPTS`` + passes namelist items into one of the CLM namelists. + + .. note:: For character namelist items you need to use "'" as quotes for strings so that the scripts don't get confused with other quotes they use. + + Example, you want to set ``hist_dov2xy`` to ``.false.`` so that you get vector output to your history files. To do so edit ``env_run.xml`` and add a setting for ``hist_dov2xy``. So do the following: + :: + + > ./xmlchange CLM_NAMELIST_OPTS="hist_dov2xy=.false." + + Example, you want to set ``hist_fincl1`` to add the variable 'HK' to your history files. To do so edit ``env_run.xml`` and add a setting for ``hist_fincl1``. So do the following: + :: + + > ./xmlchange CLM_NAMELIST_OPTS="hist_fincl1='HK'" + + For a list of the history fields available see `CLM History Fields `_. + + .. note: See the `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. + +``CLM_FORCE_COLDSTART`` + when set to on, *requires* that your simulation do a cold start from arbitrary initial conditions. If this is NOT set, it will use an initial condition file if it can find an appropriate one, and otherwise do a cold start. ``CLM_FORCE_COLDSTART`` is a good way to ensure that you are doing a cold start if that is what you want to do. + +``CLM_USRDAT_NAME`` + Provides a way to enter your own datasets into the namelist. + The files you create must be named with specific naming conventions outlined in: `the Section called Creating your own single-point/regional surface datasets in Chapter 5 `_. + To see what the expected names of the files are, use the **queryDefaultNamelist.pl** to see what the names will need to be. + For example if your ``CLM_USRDAT_NAME`` will be "1x1_boulderCO", with a "navy" land-mask, constant simulation year range, for 1850, the following will list what your filenames should be: + :: + + > cd models/lnd/clm/bld + > queryDefaultNamelist.pl -usrname "1x1_boulderCO" -options mask=navy,sim_year=1850,sim_year_range="constant" -csmdata $CSMDATA + + An example of using ``CLM_USRDAT_NAME`` for a simulation is given in `Example 5-4 `_. + + .. note:: See `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. + +``CLM_CO2_TYPE`` + sets the type of input CO2 for either "constant", "diagnostic" or prognostic". + If "constant" the value from ``CCSM_CO2_PPMV`` will be used. + If "diagnostic" or "prognostic" the values MUST be sent from the atmosphere model. + For more information on how to send CO2 from the data atmosphere model see `the Section called Running stand-alone CLM with transient historical CO2 concentration in Chapter 4 `_. + +=============== + User Namelist +=============== + +``CLM_NAMELIST_OPTS`` as described above allows you to set any extra namelist items you would like to appear in your namelist. However, it only allows you a single line to enter namelist items, and strings must be quoted with ' which is a bit awkward. If you have a long list of namelist items you want to set (such as a long list of history fields) a convenient way to do it is to add to the ``user_nl_clm`` that is created after the **cesm_setup** command runs. The file needs to be in valid FORTRAN namelist format (with the exception that the namelist name &namelist and the end of namelist marker "/" are excluded". The **preview_namelist** or **$CASE.run** step will abort if there are syntax errors. All the variable names must be valid and the values must be valid for the datatype and any restrictions for valid values for that variable. Here's an example ``user_nl_clm`` namelist that sets a bunch of history file related items, to create output history files monthly, daily, every six and 1 hours. + +---------------------------------- +Example: user_nl_clm namelist file +---------------------------------- + +:: + + !---------------------------------------------------------------------------------- + ! Users should add all user specific namelist changes below in the form of + ! namelist_var = new_namelist_value + ! + ! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options + ! are set in the CLM_NAMELIST_OPTS env variable. + ! + ! EXCEPTIONS: + ! Set co2_ppmv with CCSM_CO2_PPMV option + ! Set dtime with L_NCPL option + ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options + ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases + ! (includes $inst_string for multi-ensemble cases) + ! Set glc_grid with GLC_GRID option + ! Set glc_smb with GLC_SMB option + ! Set maxpatch_glcmec with GLC_NEC option + !---------------------------------------------------------------------------------- + hist_fincl2 = 'TG','TBOT','FIRE','FIRA','FLDS','FSDS', + 'FSR','FSA','FGEV','FSH','FGR','TSOI', + 'ERRSOI','BUILDHEAT','SABV','SABG', + 'FSDSVD','FSDSND','FSDSVI','FSDSNI', + 'FSRVD','FSRND','FSRVI','FSRNI', + 'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI', + 'H2OSNO','SOILLIQ','SOILICE', + 'TSA_U', 'TSA_R', + 'TREFMNAV_U', 'TREFMNAV_R', + 'TREFMXAV_U', 'TREFMXAV_R', + 'TG_U', 'TG_R', + 'RH2M_U', 'RH2M_R', + 'QRUNOFF_U', 'QRUNOFF_R', + 'SoilAlpha_U', + 'Qanth', 'SWup', 'LWup', 'URBAN_AC', 'URBAN_HEAT' + hist_fincl3 = 'TG:I', 'FSA:I', 'SWup:I', 'URBAN_AC:I', 'URBAN_HEAT:I', + 'TG_U:I', 'TG_R:I', + hist_fincl4 = 'TG', 'FSA', 'SWup', 'URBAN_AC', 'URBAN_HEAT' + hist_mfilt = 1, 30, 28, 24 + hist_nhtfrq = 0, -24, -6, -1 + + +**Note:** The comments at the top are some guidance given in the default user_nl_clm and just give some guidance on how to set variables and use the file. + +**Note:** See the `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. + +**Note:** You do NOT need to specify the namelist group that the variables are in because the CLM **build-namelist** knows the namelist that specific variable names belong to, and it puts them there. + +Obviously, all of this would be difficult to put in the CLM_NAMELIST_OPTS variable, especially having to put ' around all the character strings. For more information on the namelist variables being set here and what they mean, see the section on CLM namelists below, as well as the namelist definition that gives details on each variable. + +--------------------- +Precedence of Options +--------------------- + +Note: The precedence for setting the values of namelist variables with the different env_build.xml, env_run.xml options is (highest to lowest): + +1. Namelist values set by specific command-line options, like, -d, -sim_year (i.e. CLM_BLDNML_OPTS env_build.xml variable) + +#. Values set on the command-line using the -namelist option, (i.e. CLM_NAMELIST_OPTS env_run.xml variable) + +#. Values read from the file specified by -infile, (i.e. user_nl_clm file) + +#. Datasets from the -clm_usr_name option, (i.e. CLM_USRDAT_NAME env_run.xml variable) + +#. Values set from a use-case scenario, e.g., -use_case (i.e. CLM_NML_USE_CASE env_run.xml variable) + +#. Values from the namelist defaults file. + +Thus a setting in ``CLM_BLDNML_OPTS`` will override a setting for the same thing given in a use case with ``CLM_NML_USE_CASE``. Likewise, a setting in ``CLM_NAMELIST_OPTS`` will override a setting in ``user_nl_clm``. + +------------------------------------ +Setting Your Initial Conditions File +------------------------------------ + +Especially with CLMBGC and CLMCN starting from initial conditions is very important. Even with CLMSP it takes many simulation years to get the model fully spunup. There are a couple different ways to provide an initial condition file. + +- `the Section called Doing a hybrid simulation to provide initial conditions `_ +- `the Section called Doing a branch simulation to provide initial conditions `_ +- `the Section called Providing a finidat file in your user_nl_clm file `_ +- `the Section called Adding a finidat file to the XML database `_ + + **Note:** Your initial condition file MUST agree with the surface dataset you are using to run the simulation. If the two files do NOT agree you will get a run-time about a mis-match in PFT weights, or in the number of PFT's or columns. To get around this you'll need to use the `Section called Using interpinic to interpolate initial conditions to different resolutions in Chapter 2 `_ to interpolate your initial condition dataset. + +------------------------------------------------------- +Doing a hybrid simulation to provide initial conditions +------------------------------------------------------- + +The first option is to setup a hybrid simulation and give a ``RUN_REFCASE`` and ``RUN_REFDATE`` to specify the reference case simulation name to use. When you setup most cases, at the standard resolutions of "f09" or "f19" it will already do this for you. For example, if you run an "I2000CN" compset at "f09_g16" resolution the following settings will already be done for you. + +``./xmlchange RUN_TYPE=hybrid,RUN_REFCASE=I2000CN_f09_g16_c100503,RUN_REFDATE=0001-01-01,GET_REFCASE=TRUE`` + +Setting the ``GET_REFCASE`` option to ``TRUE means`` it will copy the files from the: ``$DIN_LOC_ROOT/ccsm4_init/I2000CN_f09_g16_c100503/0001-01-01`` directory. Note, that the ``RUN_REFCASE`` and ``RUN_REFDATE`` variables are expanded to get the directory name above. If you do NOT set ``GET_REFCASE`` to ``TRUE`` then you will need to have placed the file in your run directory yourself. In either case, the file is expected to be named: ``$RUN_REFCASE.clm2.r.$RUN_REFDATE-00000.nc`` with the variables expanded of course. + +------------------------------------------------------- +Doing a branch simulation to provide initial conditions +------------------------------------------------------- + +The setup for running a branch simulation is essentially the same as for a hybrid. With the exception of setting ``RUN_TYPE`` to branch rather than hybrid. A branch simulation runs the case essentially as restarting from it's place before to exactly reproduce it (but possibly output more or different fields on the history files). While a hybrid simulation allows you to change the configuration or run-time options, as well as use a different code base than the original case that may have fewer fields on it than a full restart file. The ``GET_REFCASE`` option works similarly for a branch case as for a hybrid. + +------------------------------------------------- +Providing a finidat file in your user_nl_clm file +------------------------------------------------- + +Setting up a branch or hybrid simulation requires the initial condition file to follow a standard naming convention, and a standard input directory if you use the ``GET_REFCASE`` option. If you want to name your file willy nilly and place it anywhere, you can set it in your ``user_nl_clm`` file as in this example. +:: + + finidat = '/glade/home/$USER/myinitdata/clmi_I1850CN_f09_g16_0182-01-01.c120329.nc' + +Note, if you provide an initial condition file -- you can NOT set ``CLM_FORCE_COLDSTART`` to ``TRUE``. + +------------------------------------------- + Adding a finidat file to the XML database +------------------------------------------- + +Like other datasets, if you want to use a given initial condition file to be used for all (or most of) your cases you'll want to put it in the XML database so it will be used by default. The initial condition files, are resolution dependent, and dependent on the number of PFT's and other variables such as GLC_NEC or if irrigation is on or off. See Chapter 3 for more information on this. + +------------------------------------ +Other noteworthy configuration items +------------------------------------ + +For running "I" cases there are several other noteworthy configuration items that you may want to work with. +Most of these involve settings for the DATM, but one ``CCSM_CO2_PPMV`` applies to all models. +If you are running an B, E, or F case that doesn't use the DATM obviously the DATM_* settings will not be used. All of the settings below are in your ``env_build.xml`` and ``env_run.xml`` files +:: + + CCSM_CO2_PPMV + CCSM_VOC + DATM_MODE + DATM_PRESAERO + DATM_CLMNCEP_YR_ALIGN + DATM_CLMNCEP_YR_START + DATM_CLMNCEP_YR_END + DATM_CPL_CASE + DATM_CPL_YR_ALIGN + DATM_CPL_YR_START + DATM_CPL_YR_END + +``CCSM_CO2_PPMV`` + Sets the mixing ratio of CO2 in parts per million by volume for ALL CESM components to use. Note that most compsets already set this value to something reasonable. Also note that some compsets may tell the atmosphere model to override this value with either historic or ramped values. If the CCSM_BGC variable is set to something other than "none" the atmosphere model will determine CO2, and CLM will listen and use what the atmosphere sends it. On the CLM side the namelist item co2_type tells CLM to use the value sent from the atmosphere rather than a value set on it's own namelist. + +``CCSM_VOC`` + Enables passing of the Volatile Organic Compounds (VOC) from CLM to the atmospheric model. This of course is only important if the atmosphere model is a fully active model that can use these fields in it's chemistry calculations. + +``DATM_MODE`` + Sets the mode that the DATM model should run in this determines how data is handled as well as what the source of the data will be. Many of the modes are setup specifically to be used for ocean and/or sea-ice modeling. The modes that are designed for use by CLM are: + :: + + CLMCRUNCEP + CLM_QIAN + CLM1PT> + CPLHIST3HrWx + +``CLMCRUNCEP`` + The standard mode for CLM4.5 of using global atmospheric data that was developed by CRU using NCEP data from 1901 to 2010. + See `the Section called CLMCRUNCEP mode and it's DATM settings `_ for more information on the DATM settings for ``CLMCRUNCEP`` mode. + +``CLM_QIAN`` + The standard mode for CLM4.0 of using global atmospheric data that was developed by Qian et. al. for CLM using NCEP data from 1948 to 2004. See the `Section called CLM_QIAN mode and it's DATM settings `_ for more information on the DATM settings for ``CLM_QIAN`` mode. ``CLM1PT`` is for the special cases where we have single-point tower data for particular sites. Right now we only have data for three urban locations: MexicoCity Mexico, Vancouver Canada, and the urban-c alpha site. And we have data for the US-UMB AmeriFlux tower site for University of Michigan Biological Station. See `the Section called CLM1PT mode and it's DATM settings `_ for more information on the DATM settings for ``CLM1PT`` mode. ``CPLHIST3HrWx`` is for running with atmospheric forcing from a previous CESM simulation. See `the Section called CPLHIST3HrWx mode and it's DATM settings `_ for more information on the DATM settings for ``CPLHIST3HrWx`` mode. + +``DATM_PRESAERO`` + sets the prescribed aerosol mode for the data atmosphere model. The list of valid options include: + + ``clim_1850`` = constant year 1850 conditions + + ``clim_2000`` = constant year 2000 conditions + + ``trans_1850-2000`` = transient 1850 to year 2000 conditions + + ``rcp2.6`` = transient conditions for the rcp=2.6 W/m2 future scenario + + ``rcp4.5`` = transient conditions for the rcp=4.5 W/m2 future scenario + + ``rcp6.0`` = transient conditions for the rcp=6.0 W/m2 future scenario + + ``rcp8.5`` = transient conditions for the rcp=8.5 W/m2 future scenario + + ``pt1_pt1`` = read in single-point or regional datasets + +DATM_CLMNCEP_YR_START + ``DATM_CLMNCEP_YR_START`` sets the beginning year to cycle the atmospheric data over for ``CLM_QIAN`` or ``CLMCRUNCEP`` modes. + +DATM_CLMNCEP_YR_END + ``DATM_CLMNCEP_YR_END`` sets the ending year to cycle the atmospheric data over for ``CLM_QIAN`` or ``CLMCRUNCEP`` modes. + +DATM_CLMNCEP_YR_ALIGN + ``DATM_CLMNCEP_YR_START`` and ``DATM_CLMNCEP_YR_END`` determine the range of years to cycle the atmospheric data over, and ``DATM_CLMNCEP_YR_ALIGN`` determines which year in that range of years the simulation will start with. + +DATM_CPL_CASE + ``DATM_CPL_CASE`` sets the casename to use for the ``CPLHIST3HrWx`` mode. + +DATM_CPL_YR_START + ``DATM_CPL_YR_START`` sets the beginning year to cycle the atmospheric data over for the ``CPLHIST3HrWx`` mode. + +DATM_CPL_YR_END + ``DATM_CPL_YR_END`` sets the ending year to cycle the atmospheric data over for the ``CPLHIST3HrWx`` mode. + +DATM_CPL_YR_ALIGN + ``DATM_CPL_YR_START`` and ``DATM_CPL_YR_END`` determine the range of years to cycle the atmospheric data over, and ``DATM_CPL_YR_ALIGN`` determines which year in that range of years the simulation will start with. + +----------------------------- +Downloading DATM Forcing Data +----------------------------- + +In Chapter One of the `CESM User's Guide `_ there is a section on "Downloading input data". The normal process of setting up cases will use the "scripts/ccsm_utils/Tools/check_input_data" script to retrieve data from the CESM subversion inputdata repository. This is true for the standard `CLM_QIAN` forcing as well. + +The `CLMCRUNCEP` data is uploaded into the subversion inputdata repository as well -- but as it is 1.1 Terabytes of data downloading it is problematic (*IT WILL TAKE SEVERAL DAYS TO DOWNLOAD THE ENTIRE DATASET USING SUBVERSION*). Because of it's size you may also need to download it onto a separate disk space. We have done that on yellowstone for example where it resides in ``$ENV{CESMROOT}/lmwg`` while the rest of the input data resides in ``$ENV{CESMDATAROOT}/inputdata``. The data is also already available on: janus, franklin, and hopper. If you download the data, we recommend that you break your download into several chunks, by setting up a case and setting the year range for ``DATM_CPL_YR_START`` and ``DATM_CPL_YR_END`` in say 20 year sections over 1901 to 2010, and then use **check_input_data** to export the data. + +The ``CPLHIST3HrWx`` DATM forcing data is unique -- because it is large compared to the rest of the input data, and we only have a disk copy on yellowstone. The DATM assumes the path for the previous NCAR machine yellowstone of ``/glade/p/cesm/shared_outputdata/cases/ccsm4/$DATM_CPLHIST_CASE`` for the data. So you will need to change this path in order to run on any other machine. You can download the data itself from NCAR HPSS from ``/CCSM/csm/$DATM_CPLHIST_CASE``. + +-------------------------------------- +Customizing via the build script files +-------------------------------------- + +The final thing that the user may wish to do before **cesm_setup** is run is to edit the build script files which determine the configuration and namelist. The variables in ``env_build.xml`` or ``env_run.xml`` typically mean you will NOT have to edit build script files. But, there are rare instances where it is useful to do so. The build script files are copied to your case directory and are available under Buildconf. The list of build script files you might wish to edit are: + +**clm.buildexe.csh** +**clm.buildnml.csh** +**datm.buildexe.csh** +**datm.buildnml.csh** + +-------------------------------------------- +More information on the CLM configure script +-------------------------------------------- + +The CLM **configure** script defines the details of a clm configuration and summarizes it into a ``config_cache.xml`` file. The ``config_cache.xml`` will be placed in your case directory under ``Buildconf/clmconf``. The `config_definition.xml `_ in ``models/lnd/clm/bld/config_files`` gives a definition of each CLM configuration item, it is viewable in a web-browser. Many of these items are things that you would NOT change, but looking through the list gives you the valid options, and a good description of each. Below we repeat the ``config_definition.xml`` files contents: + +Help on CLM configure +--------------------- + +Coupling this with looking at the options to CLM **configure** with "-help" as below will enable you to understand how to set the different options. +:: + + > cd models/lnd/clm/bld + > configure -help + +The output to the above command is as follows: +:: + + SYNOPSIS + configure [options] + + Configure CLM in preparation to be built. + OPTIONS + User supplied values are denoted in angle brackets (<>). Any value that contains + white-space must be quoted. Long option names may be supplied with either single + or double leading dashes. A consequence of this is that single letter options may + NOT be bundled. + + -bgc Build CLM with BGC package [ none | cn | cndv ] + (default is none). + -cache Name of output cache file (default: config_cache.xml). + -cachedir Name of directory where output cache file is written + (default: CLM build directory). + -clm4me Turn Methane model: [on | off] + Requires bgc=cn/cndv (Carbon Nitrogen model) + (ONLY valid for CLM4.5!) + -clm_root Root directory of clm source code + (default: directory above location of this script) + -cppdefs A string of user specified CPP defines. Appended to + Makefile defaults. e.g. -cppdefs '-DVAR1 -DVAR2' + -vichydro Turn VIC hydrologic parameterizations : [on | off] (default is off) + -crop Toggle for prognostic crop model. [on | off] (default is off) + (can ONLY be turned on when BGC type is CN or CNDV) + -comp_intf Component interface to use (ESMF or MCT) (default MCT) + -defaults Specify full path to a configuration file which will be used + to supply defaults instead of the defaults in bld/config_files. + This file is used to specify model configuration parameters only. + Parameters relating to the build which are system dependent will + be ignored. + -exlaklayers Turn on extra lake layers (25 layers instead of 10) [on | off] + (ONLY valid for CLM4.5!) + -help [or -h] Print usage to STDOUT. + -nofire Turn off wildfires for BGC setting of CN + (default includes fire for CN) + -noio Turn history output completely off (typically for testing). + -phys Value of clm4_0 or clm4_5 (default is clm4_0) + -silent [or -s] Turns on silent mode - only fatal messages issued. + -sitespf_pt Setup for the given site specific single-point resolution. + -snicar_frc Turn on SNICAR radiative forcing calculation. [on | off] + (default is off) + -spinup CLM 4.0 Only. For CLM 4.5, spinup is controlled from build-namelist. + Turn on given spinup mode for BGC setting of CN (level) + AD Turn on Accelerated Decomposition from (2) + bare-soil + exit Jump directly from AD spinup to normal mode (1) + normal Normal decomposition ("final spinup mode") (0) + (default) + The recommended sequence is 2-1-0 + -usr_src [,[,[...]]] + Directories containing user source code. + -verbose [or -v] Turn on verbose echoing of settings made by configure. + -version Echo the SVN tag name used to check out this CLM distribution. + -vsoilc_centbgc Turn on vertical soil Carbon profile, CENTURY model decomposition, \ + + split Nitrification/de-Nitrification into two mineral + pools for NO3 and NH4 (requires clm4me Methane model), and + eliminate inconsistent duplicate soil hydraulic + parameters used in soil biogeochem. + (requires either CN or CNDV) + (ONLY valid for CLM4.5!) + [on,off or colon delimited list of no options] (default off) + no-vert Turn vertical soil Carbon profile off + no-cent Turn CENTURY off + no-nitrif Turn the Nitrification/denitrification off + [no-vert,no-cent,no-nitrif,no-vert:no-cent] + + +We've given details on how to use the options in env_build.xml and env_run.xml to interact with the CLM "configure" and "build-namelist" scripts, as well as giving a good understanding of how these scripts work and the options to them. +In the next section we give further details on the CLM namelist. You could customize the namelist for these options after "cesm_setup" is run. diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst new file mode 100644 index 0000000000..131078c648 --- /dev/null +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst @@ -0,0 +1,251 @@ +.. _customizing-a-case: + +============================ + Customizing CLM's namelist +============================ + +Once a case is **cesm_setup**, we can then customize the case further, by editing the run-time namelist for CLM. First let's list the definition of each namelist item and their valid values, and then we'll list the default values for them. Next for some of the most used or tricky namelist items we'll give examples of their use, and give you example namelists that highlight these features. + +In the following, various examples of namelists are provided that feature the use of different namelist options to customize a case for particular uses. +Most the examples revolve around how to customize the output history fields. +This should give you a good basis for setting up your own CLM namelist. + +----------------------------------------------------- +Definition of Namelist items and their default values +----------------------------------------------------- + +Here we point to you where you can find the definition of each namelist item and separately the default values for them. The default values may change depending on the resolution, land-mask, simulation-year and other attributes. Both of these files are viewable in your web browser, and then expand each in turn. + +1. `Definition of Namelists Relevant for CLM4.5 `_ + +2. `Default values of each CLM4.0 Namelist Item `_ + +3. `Default values of each CLM4.5 Namelist Item `_ + +List of fields that can be added to your output history files by namelist +------------------------------------------------------------------------- + +One set of the namelist items allows you to add fields to the output history files: ``hist_fincl1``, ``hist_fincl2``, ``hist_fincl3``, ``hist_fincl4``, ``hist_fincl5``, and ``hist_fincl6``. The following links for `CLM4.0 History Fields `_ and `CLM4.5 History Fields `_ documents all of the history fields available and gives the long-name and units for each. The table below lists all the CLM4.5 history fields. + +Definition of CLM history variables +----------------------------------- + +Included in the table are the following pieces of information: + +- Variable name. + +- Long name description. + +- units + + +Table 1-3. CLM History Fields +----------------------------- +Table goes here. + + +--------------------------------------------- +Examples of using different namelist features +--------------------------------------------- + +Below we will give examples of user namelists that activate different commonly used namelist features. We will discuss the namelist features in different examples and then show a user namelist that includes an example of the use of these features. First we will show the default namelist that doesn't activate any user options. + +The default namelist +-------------------- + +Here we give the default namelist as it would be created for an "I1850CRUCLM45BGC" compset at 0.9x1.25 resolution with a gx1v6 land-mask on yellowstone. To edit the namelist you would edit the ``user_nl_clm`` user namelist with just the items you want to change. For simplicity we will just show the CLM namelist and NOT the entire file. In the sections below, for simplicity we will just show the user namelist (``user_nl_clm``) that will add (or modify existing) namelist items to the namelist. + +Example 1-2. Default CLM Namelist +--------------------------------- +:: + + &clm_inparm + albice = 0.60,0.40 + co2_ppmv = 284.7 + co2_type = 'constant' + create_crop_landunit = .false. + dtime = 1800 + fatmlndfrc = '/glade/p/cesm/cseg/inputdata/share/domains/domain.lnd.fv0.9x1.25_gx1v6.090309.nc' + finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I1850CRUCLM45BGC.0241-01-01.0.9x1.25_g1v6_simyr1850_c130531.nc' + fpftcon = '/glade/p/cesm/cseg/inputdata/lnd/clm2/pftdata/pft-physiology.c130503.nc' + fsnowaging = '/glade/p/cesm/cseg/inputdata/lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc' + fsnowoptics = '/glade/p/cesm/cseg/inputdata/lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc' + fsurdat = '/glade/p/cesm/cseg/inputdata/lnd/clm2/surfdata_map/surfdata_0.9x1.25_simyr1850_c130415.nc' + maxpatch_glcmec = 0 + more_vertlayers = .false. + nsegspc = 20 + spinup_state = 0 + urban_hac = 'ON' + urban_traffic = .false. + / + &ndepdyn_nml + ndepmapalgo = 'bilinear' + stream_fldfilename_ndep = '/glade/p/cesm/cseg/inputdata/lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc' + stream_year_first_ndep = 1850 + stream_year_last_ndep = 1850 + / + &popd_streams + popdensmapalgo = 'bilinear' + stream_fldfilename_popdens = '$DIN_LOC_ROOT/lnd/clm2/firedata/clmforc.Li_2012_hdm_0.5x0.5_AVHRR_simyr1850-2010_c130401.nc' + stream_year_first_popdens = 1850 + stream_year_last_popdens = 1850 + / + &light_streams + lightngmapalgo = 'bilinear' + stream_fldfilename_lightng = '/glade/p/cesm/cseg/inputdata/atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_c130327.nc' + stream_year_first_lightng = 0001 + stream_year_last_lightng = 0001 + / + &clm_hydrology1_inparm + / + &clm_soilhydrology_inparm + / + &ch4par_in + fin_use_fsat = .true. + / + +Adding/removing fields on your primary history file +--------------------------------------------------- + +The primary history files are output monthly, and contain an extensive list of fieldnames, but the list of fieldnames can be added to using ``hist_fincl1`` or removed from by adding fieldnames to ``hist_fexcl1``. +A sample user namelist ``user_nl_clm`` adding few new fields (cosine of solar zenith angle, and solar declination) and excluding a few standard fields is (ground temperature, vegetation temperature, soil temperature and soil water).: + +Example 1-3. Example user_nl_clm namelist adding and removing fields on primary history file +-------------------------------------------------------------------------------------------- +:: + + hist_fincl1 = 'COSZEN', 'DECL' + hist_fexcl1 = 'TG', 'TV', 'TSOI', 'H2OSOI' + + +Adding auxiliary history files and changing output frequency +------------------------------------------------------------ + +The ``hist_fincl2`` through ``hist_fincl6`` set of namelist variables add given history fieldnames to auxiliary history file "streams", and ``hist_fexcl2`` through ``hist_fexcl6`` set of namelist variables remove given history fieldnames from history file auxiliary "streams". +A history "stream" is a set of history files that are produced at a given frequency. +By default there is only one stream of monthly data files. +To add more streams you add history fieldnames to ``hist_fincl2`` through ``hist_fincl6``. +The output frequency and the way averaging is done can be different for each history file stream. +By default the primary history files are monthly and any others are daily. You can have up to six active history streams, but you need to activate them in order. So if you activate stream "6" by setting ``hist_fincl6``, but if any of ``hist_fincl2`` through ``hist_fincl5`` are unset, only the history streams up to the first blank one will be activated. + +The frequency of the history file streams is given by the namelist variable ``hist_nhtfrq`` which is an array of rank six for each history stream. The values of the array ``hist_nhtfrq`` must be integers, where the following values have the given meaning: + +*Positive value* means the output frequency is the number of model steps between output. +*Negative value* means the output frequency is the absolute value in hours given (i.e -1 would mean an hour and -24 would mean a full day). Daily (-24) is the default value for all auxiliary files. +*Zero* means the output frequency is monthly. This is the default for the primary history files. + +The number of samples on each history file stream is given by the namelist variable ``hist_mfilt`` which is an array of rank six for each history stream. The values of the array ``hist_mfilt`` must be positive integers. By default the primary history file stream has one time sample on it (i.e. output is to separate monthly files), and all other streams have thirty time samples on them. + +A sample user namelist ``user_nl_clm`` turning on four extra file streams for output: daily, six-hourly, hourly, and every time-step, leaving the primary history files as monthly, and changing the number of samples on the streams to: yearly (12), thirty, weekly (28), daily (24), and daily (48) is: + +Example: user_nl_clm namelist adding auxiliary history files and changing output frequency +------------------------------------------------------------------------------------------------------ +:: + + hist_fincl2 = 'TG', 'TV' + hist_fincl3 = 'TG', 'TV' + hist_fincl4 = 'TG', 'TV' + hist_fincl5 = 'TG', 'TV' + hist_nhtfrq = 0, -24, -6, -1, 1 + hist_mfilt = 12, 30, 28, 24, 48 + +Removing all history fields +--------------------------- + +Sometimes for various reasons you want to remove all the history fields either because you want to do testing without any output, or you only want a very small custom list of output fields rather than the default extensive list of fields. +By default only the primary history files are active, so technically using ``hist_fexcl1`` explained in the first example, you could list ALL of the history fields that are output in ``hist_fexcl1`` and then you wouldn't get any output. +However, as the list is very extensive this would be a cumbersome thing to do. +So to facilitate this ``hist_empty_htapes`` allows you to turn off all default output. +You can still use ``hist_fincl1`` to turn your own list of fields on, but you then start from a clean slate. +A sample user namelist ``user_nl_clm`` turning off all history fields and then activating just a few selected fields (ground and vegetation temperatures and absorbed solar radiation) is: + +Example 1-5. Example user_nl_clm namelist removing all history fields +--------------------------------------------------------------------- +:: + + hist_empty_htapes = .true. + hist_fincl1 = 'TG', 'TV', 'FSA' + + +Various ways to change history output averaging flags +----------------------------------------------------- + +There are two ways to change the averaging of output history fields. +The first is using ``hist_avgflag_pertape`` which gives a default value for each history stream, the second is when you add fields using ``hist_fincl*``, you add an averaging flag to the end of the field name after a colon (for example 'TSOI:X', would output the maximum of TSOI). +The types of averaging that can be done are: + +- *A* Average, over the output interval. +- *I* Instantaneous, output the value at the output interval. +- *X* Maximum, over the output interval. +- *M* Minimum, over the output interval. + +The default averaging depends on the specific fields, but for most fields is an average. +A sample user namelist ``user_nl_clm`` making the monthly output fields all averages (except TSOI for the first two streams and FIRE for the 5th stream), and adding auxiliary file streams for instantaneous (6-hourly), maximum (daily), minimum (daily), and average (daily). +For some of the fields we diverge from the per-tape value given and customize to some different type of optimization. + +Example: user_nl_clm namelist with various ways to average history fields +------------------------------------------------------------------------------------- +:: + + hist_empty_htapes = .true. + hist_fincl1 = 'TSOI:X', 'TG', 'TV', 'FIRE', 'FSR', 'FSH', + 'EFLX_LH_TOT', 'WT' + hist_fincl2 = 'TSOI:X', 'TG', 'TV', 'FIRE', 'FSR', 'FSH', + 'EFLX_LH_TOT', 'WT' + hist_fincl3 = 'TSOI', 'TG:I', 'TV', 'FIRE', 'FSR', 'FSH', + 'EFLX_LH_TOT', 'WT' + hist_fincl4 = 'TSOI', 'TG', 'TV:I', 'FIRE', 'FSR', 'FSH', + 'EFLX_LH_TOT', 'WT' + hist_fincl5 = 'TSOI', 'TG', 'TV', 'FIRE:I', 'FSR', 'FSH', + 'EFLX_LH_TOT', 'WT' + hist_avgflag_pertape = 'A', 'I', 'X', 'M', 'A' + hist_nhtfrq = 0, -6, -24, -24, -24 + +In the example we put the same list of fields on each of the tapes: soil-temperature, ground temperature, vegetation temperature, emitted longwave radiation, reflected solar radiation, sensible heat, total latent-heat, and total water storage. +We also modify the soil-temperature for the primary and secondary auxiliary tapes by outputting them for a maximum instead of the prescribed per-tape of average and instantaneous respectively. +For the tertiary auxiliary tape we output ground temperature instantaneous instead of as a maximum, and for the fourth auxiliary tape we output vegetation temperature instantaneous instead of as a minimum. +Finally, for the fifth auxiliary tapes we output ``FIRE`` instantaneously instead of as an average. + +.. note:: We also use ``hist_empty_htapes`` as in the previous example, so we can list ONLY the fields that we want on the primary history tapes. + +Outputting history files as a vector in order to analyze the plant function types within gridcells +-------------------------------------------------------------------------------------------------- + +By default the output to history files are the grid-cell average of all land-units, and vegetation types within that grid-cell, and output is on the full 2D latitude/longitude grid with ocean masked out. +Sometimes it's important to understand how different land-units or vegetation types are acting within a grid-cell. +The way to do this is to output history files as a 1D-vector of all land-units and vegetation types. +In order to display this, you'll need to do extensive post-processing to make sense of the output. +Often you may only be interested in a few points, so once you figure out the 1D indices for the grid-cells of interest, you can easily view that data. +1D vector output can also be useful for single point datasets, since it's then obvious that all data is for the same grid cell. + +To do this you use ``hist_dov2xy`` which is an array of rank six for each history stream. +Set it to ``.false.`` if you want one of the history streams to be a 1D vector. +You can also use ``hist_type1d_pertape`` if you want to average over all the: Plant-Function-Types, columns, land-units, or grid-cells. +A sample user namelist ``user_nl_clm`` leaving the primary monthly files as 2D, and then doing grid-cell (GRID), column (COLS), and no averaging over auxiliary tapes output daily for a single field (ground temperature) is: + +Example: user_nl_clm namelist outputting some files in 1D Vector format +----------------------------------------------------------------------- +:: + + hist_fincl2 = 'TG' + hist_fincl3 = 'TG' + hist_fincl4 = 'TG' + hist_fincl5 = 'TG' + hist_fincl6 = 'TG' + hist_dov2xy = .true., .false., .false., .false. + hist_type2d_pertape = ' ', 'GRID', 'COLS', ' ' + hist_nhtfrq = 0, -24, -24, -24 + +.. warning:: LAND and COLS are also options to the pertape averaging, but currently there is a bug with them and they fail to work. + +.. note:: Technically the default for hist_nhtfrq is for primary files output monthly and the other auxiliary tapes for daily, so we don't actually have to include hist_nhtfrq, we could use the default for it. Here we specify it for clarity. + +.. caution:: LAND and COLS are also options to the pertape averaging, but currently there is a bug with them and they fail to work. + +Visualizing global 1D vector files will take effort. +You'll probably want to do some post-processing and possibly just extract out single points of interest to see what is going on. +Since, the output is a 1D vector, of only land-points traditional plots won't be helpful. +The number of points per grid-cell will also vary for anything, but grid-cell averaging. +You'll need to use the output fields pfts1d_ixy, and pfts1d_jxy, to get the mapping of the fields to the global 2D array. +pfts1d_itype_veg gives you the PFT number for each PFT. +Most likely you'll want to do this analysis in a data processing tool (such as NCL, Matlab, Mathmatica, IDL, etcetera that is able to read and process NetCDF data files). diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst new file mode 100644 index 0000000000..8cf0916717 --- /dev/null +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst @@ -0,0 +1,109 @@ +.. customizing-the-datm-namelist: + +=============================== + Customizing the DATM namelist +=============================== + +When running "I" compsets with CLM you use the DATM model to give atmospheric forcing data to CLM. There are two ways to customize DATM: + +1. **DATM Main Namelist and Stream Namlist gorup** (``datm_in``) +2. **DATM stream files** + +The `Data Model Documentation `_ gives the details of all the options for the data models and for DATM specifically. +It goes into detail on all namelist items both for DATM and for DATM streams. +So here we won't list ALL of the DATM namelist options, nor go into great details about stream files. +But, we will talk about a few of the different options that are relevant for running with CLM. +All of the options for changing the namelists or stream files is done by editing the ``user_nl_datm`` file. + +Because, they aren't useful for work with CLM we will NOT discuss any of the options for the main DATM namelist. Use the DATM Users Guide at the link above to find details of that. For the streams namelist we will discuss three items: + +1. ``mapalgo`` +#. ``taxmode`` +#. ``tintalgo`` + +And for the streams file itself we will discuss: + +offset + Again everything else (and including the above items) are discussed in the Data Model User's Guide. Of the above the last three: offset, taxmode and tintalgo are all closely related and have to do with the time interpolation of the DATM data. + +mapalgo + ``mapalgo`` sets the spatial interpolation method to go from the DATM input data to the output DATM model grid. The default is ``bilinear``. For ``CLM1PT`` we set it to ``nn`` to just select the nearest neighbor. This saves time and we also had problems running the interpolation for single-point mode. + +taxmode + ``taxmode`` is the time axis mode. + For CLM we usually have it set to ``cycle`` which means that once the end of the data is reached it will start over at the beginning. + The extend modes is used have it use the last time-step of the forcing data once it reaches the end of forcing data (or use the first time-step before it reaches where the forcing data starts). See the warning below about the extend mode. + +.. warning:: *THE extend OPTION NEEDS TO BE USED WITH CAUTION!* It is only invoked by default for the CLM1PT mode and is only intended for the supported urban datasets to extend the data for a single time-step. If you have the model *run extensively through periods in this mode you will effectively be repeating that last time-step over that entire period*. This means the output of your simulation will be worthless. + +offset (in the stream file) + ``offset`` is the time offset in seconds to give to each stream of data. Normally it is NOT used because the time-stamps for data is set correctly for each stream of data. Note, the ``offset`` may NEED to be adjusted depending on the ``taxmode`` described above, or it may need to be adjusted to account for data that is time-stamped at the END of an interval rather than the middle or beginning of interval. The ``offset`` can is set in the stream file rather than on the stream namelist. For data with a ``taxmode`` method of ``coszen`` the time-stamp needs to be for the beginning of the interval, while for other data it should be the midpoint. The ``offset`` can be used to adjust the time-stamps to get the data to line up correctly. + +tintalgo + ``tintalgo`` is the time interpolation algorithm. For CLM we usually use one of three modes: ``coszen``, ``nearest``, or ``linear``. We use ``coszen`` for solar data, nearest for precipitation data, and linear for everything else. If your data is half-hourly or hourly, nearest will work fine for everything. The ``coszen`` scaling is useful for longer periods (three hours or more) to try to get the solar to match the cosine of the solar zenith angle over that longer period of time. If you use linear for longer intervals, the solar will cut out at night-time anyway, and the straight line will be a poor approximation of the cosine of the solar zenith angle of actual solar data. nearest likewise would be bad for longer periods where it would be much higher than the actual values. + +.. note:: For ``coszen`` the time-stamps of the data should correspond to the beginning of the interval the data is measured for. Either make sure the time-stamps on the datafiles is set this way, or use the ``offset`` described above to set it. + +.. note:: For nearest and linear the time-stamps of the data should correspond to the middle of the interval the data is measured for. Either make sure the time-stamps on the datafiles is set this way, or use the ``offset`` described above to set it. + +In the sections below we go over each of the relevant ``DATM_MODE`` options and what the above DATM settings are for each. This gives you examples of actual usage for the settings. We also describe in what ways you might want to customize them for your own case. + +-------------------------------------- +CLMCRUNCEP mode and it's DATM settings +-------------------------------------- + +In ``CLMCRUNCEP`` mode the CRUNCEP dataset is used and all of it's data is on a 6-hourly interval. +Like ``CLM_QIAN`` the dataset is divided into those three data streams: solar, precipitation, and everything else (temperature, pressure, humidity and wind). +The time-stamps of the data were also adjusted so that they are the beginning of the interval for solar, and the middle for the other two. +Because, of this the ``offset`` is set to zero, and the ``tintalgo`` is: ``coszen``, ``nearest``, and ``linear`` for the solar, precipitation and other data respectively. +``taxmode`` is set to ``cycle`` and ``mapalgo`` is set to ``bilinear`` so that the data is spatially interpolated from the input exact half degree grid to the grid the atmosphere model is being run at (to run at this same model resolution use the 360x720cru_360x720cru resolution). + +.. note:: The "everything else" data stream (of temperature, pressure, humidity and wind) also includes the data for longwave downward forcing as well. Our simulations showed sensitivity to this field, so we backed off in using it, and let DATM calculate longwave down from the other fields. + +For more information on CRUNCEP forcing see `http://dods.extra.cea.fr/data/p529viov/cruncep/ `_. + +------------------------------------ +CLM_QIAN mode and it's DATM settings +------------------------------------ + +In ``CLM_QIAN`` mode the Qian dataset is used which has 6-hourly solar and precipitation data, and 3-hourly for everything else. +The dataset is divided into those three data streams: solar, precipitation, and everything else (temperature, pressure, humidity and wind). +The time-stamps of the data were also adjusted so that they are the beginning of the interval for solar, and the middle for the other two. +Because, of this the ``offset`` is set to zero, and the ``tintalgo`` is: ``coszen``, ``nearest``, and ``linear`` for the solar, precipitation and other data respectively. +``taxmode`` is set to ``cycle`` and ``mapalgo`` is set to ``bilinear`` so that the data is spatially interpolated from the input T62 grid to the grid the atmosphere model is being run at. + +Normally you wouldn't customize the ``CLM_QIAN`` settings, but you might replicate it's use for your own global data that had similar temporal characteristics. + +---------------------------------- +CLM1PT mode and it's DATM settings +---------------------------------- + +In ``CLM1PT`` mode the model is assumed to have half-hourly or hourly data for a single-point. +For the supported datasets that is exactly what it has. +But, if you add your own data you may need to make adjustments accordingly. +Using the ``CLM_USRDAT_NAME`` resolution you can easily extend this mode for your own datasets that may be regional or even global and could be at different temporal frequencies. +If you do so you'll need to make adjustments to your DATM settings. +The dataset has all data in a single stream file. +The time-stamps of the data were also adjusted so that they are at the middle of the interval. +Because, of this the ``offset`` is set to zero, and the ``tintalgo`` is set to ``nearest``. +``taxmode`` is set to ``extend`` and ``mapalgo`` is set to ``nn`` so that simply the nearest point is used. + +If you are using your own data for this mode and it's not at least hourly you'll want to adjust the DATM settings for it. If the data is three or six hourly, you'll need to divide it up into separate streams like in ``CLM_QIAN`` mode which will require fairly extensive changes to the DATM namelist and streams files. For an example of doing this see `Example 5-8 `_. + +---------------------------------------- +CPLHIST3HrWx mode and it's DATM settings +---------------------------------------- + +In ``CPLHIST3HrWx`` mode the model is assumed to have 3-hourly for a global grid from a previous CESM simulation. +Like ``CLM_QIAN`` mode the data is divided into three streams: one for precipitation, one for solar, and one for everything else. +The time-stamps for Coupler history files for CESM is at the end of the interval, so the ``offset`` needs to be set in order to adjust the time-stamps to what it needs to be for the ``tintalgo`` settings. +For precipitation ``taxmode`` is set to ``nearest`` so the ``offset`` is set to ``-5400`` seconds so that the ending time-step is adjusted by an hour and half to the middle of the interval. +For solar ``taxmode`` is set to ``coszen`` so the offset is set to ``-10800`` seconds so that the ending time-step is adjust by three hours to the beginning of the interval. +For everything else ``taxmode`` is set to ``linear`` so the offset is set to ``-5400`` seconds so that the ending time-step is adjusted by an hour and half to the middle of the interval. +For an example of such a case see `the Section called Running with MOAR data as atmospheric forcing to spinup the model in Chapter 4 `_. + + +Normally you wouldn't modify the DATM settings for this mode. +However, if you had data at a different frequency than 3-hours you would need to modify the ``offset`` and possibly the ``taxmode``. +The other two things that you might modify would be the path to the data or the domain file for the resolution (which is currently hardwired to f09). +For data at a different input resolution you would need to change the domain file in the streams file to use a domain file to the resolution that the data comes in on. diff --git a/doc/source/users_guide/setting-up-and-running-a-case/index.rst b/doc/source/users_guide/setting-up-and-running-a-case/index.rst new file mode 100644 index 0000000000..a9c1cb7d13 --- /dev/null +++ b/doc/source/users_guide/setting-up-and-running-a-case/index.rst @@ -0,0 +1,19 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _customizing_section: + +##################################### +Setting Up and Running a Case +##################################### + +.. toctree:: + :maxdepth: 2 + + choosing-a-compset.rst + customizing-the-clm-configuration.rst + customizing-the-clm-namelist.rst + customizing-the-datm-namelist.rst + diff --git a/doc/source/users_guide/testing/index.rst b/doc/source/users_guide/testing/index.rst new file mode 100644 index 0000000000..18c418fca4 --- /dev/null +++ b/doc/source/users_guide/testing/index.rst @@ -0,0 +1,18 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _testing: + +##################################### +Testing +##################################### + +.. toctree:: + :maxdepth: 2 + :numbered: + + testing.rst + + diff --git a/doc/source/users_guide/testing/testing.rst b/doc/source/users_guide/testing/testing.rst new file mode 100644 index 0000000000..91db57fc70 --- /dev/null +++ b/doc/source/users_guide/testing/testing.rst @@ -0,0 +1,62 @@ +.. _testing: + +******* +Testing +******* + +Technically, you could use the customization we gave in `Chapter 1 `_ to test various configuration and namelist options for CLM. +Sometimes, it's also useful to have automated tests though to test that restarts give exactly the same results as without a restart. +It's also useful to have automated tests to run over a wide variety of configurations, resolutions, and namelist options. +To do that we have several different types of scripts set up to make running comprehensive testing of CLM easy. +There are two types of testing scripts for CLM. +The first are the CESM test scripts, which utilize the **create_newcase** scripts that we shown how to use in this User's Guide. +The second are a set of stand-alone scripts that use the CLM **configure** and **build-namelist** scripts to build and test the model as well as testing the CLM tools as well. +Below we will go into further details of how to use both methods. + + +CIME Testing scripts +==================== + +We first introduce the test scripts that work for all CESM components. +The CIME script **create_test** runs a specific type of test, at a given resolution, for a given compset using a given machine. +There is a list of different tests, but the "ERI" tests do several things at once, running from startup, as well as doing exact branch and restart tests. +So to run "ERI" testing at 2-degree with the I1850CRUCLM45 compset on yellowstone_intel you do the following. +:: + + > cd scripts + > ./create_test -testname ERI.f19_g16.I1850CRUCLM45.yellowstone_intel + > cd ERI.f19_g16.I1850CRUCLM45.yellowstone_intel.$id + > ./ERI.f19_g16.I1850CRUCLM45.yellowstone_intel.$id.build + > ERI.f19_g16.I1850CRUCLM45.yellowstone_intel.$id.submit + +When the test is done it will update the file TestStatus with either a PASS or FAIL message. + +We already have a standard list of tests for clm (the "aux_clm" list of tests). To run the CLM yellowstone intel compiler test list, for the same machine and compiler you would do the following: +:: + + > cd scripts + > ./create_test -xml_mach yellowstone -xml_compiler intel -xml_category aux_clm -mach yellowstone -compiler intel + # Normally it will submit the jobs as they are ready, but if it's interrupted you + # may need to submit by hand as follows... + # Submit the suite of tests (note $id refers to the integer job number for this job) + > ./cs.submit.$id.yellowstone + # Later check the tests with... + > ./cs.status.$id + # The above will give a PASS or FAIL message for each test. + +For more information on doing testing with the CESM scripts see the `CESM1.2.0 User's Guide `_ on testing. + +Testing PTCLM +============= + +There is a simple test script for PTCLM called ``testcases.csh`` in the PTCLM directory (``scripts/ccsm_utils/Tools/lnd/clm/PTCLM``). +The test script is setup to run on the machines: yellowstone, frankfurt, yong, and titan. +You simply run the script interactively. +The script will write out the status of tests to a file called: ``tc.job#.status``. + +There are a few environment variables that can be used with ``testcases.csh`` to change it's operation. + +``CESM_ROOT``: To test with a separate root to CESM code set this env variable to the root directory to use. +``CLM_SOFF``: If set to ``TRUE`` - stop on first failed test rather than continuing to run. +``CLM_RETAIN_FILES``: If set to ``FALSE`` - cleanup tools build first. +``DEBUG``: If set to ``TRUE`` - setup cases, but do not build or run. diff --git a/doc/source/users_guide/trouble-shooting/index.rst b/doc/source/users_guide/trouble-shooting/index.rst new file mode 100644 index 0000000000..f4c6d813fc --- /dev/null +++ b/doc/source/users_guide/trouble-shooting/index.rst @@ -0,0 +1,15 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _troubleshooting: + +##################################### +Troubleshooting +##################################### + +.. toctree:: + :maxdepth: 2 + + trouble-shooting.rst diff --git a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst new file mode 100644 index 0000000000..5a2fb07192 --- /dev/null +++ b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst @@ -0,0 +1,395 @@ +.. _trouble-shooting: + +********************* +Trouble Shooting +********************* + +In this chapter we give some guidance on what to do when you encounter some of the most common problems. We can't cover all the problems that a user could potentially have, but we will try to help you recognize some of the most common situations. And we'll give you some suggestions on how to approach the problem to come up with a solution. + +In general you will run into one of three type of problems: + +1. *setup-time* +#. *build-time* +#. *run-time* + + +Setup Problems +============== + +The first type of problem happens when you invoke the **case.setup** command. +This indicates there is something wrong with your input datasets, or the details of what you are trying to setup the model to do. +There's also a trouble-shooting chapter in the `CESM1.2.0 Scripts User's Guide `_. +Many of the problems with configuration can be resolved with the guidelines given there. +Here we will restrict ourselves to problems from the input files. + +Example: Missing datasets +---------------------------------------------------------------- +:: + + > ./create_newcase -case ne60rcp6 -res ne60_g16 -compset IRCP60CN \ + -mach yellowstone_intel + > ./case.setup + +The following is what is displayed to the screen. +:: + + . + . + . + Running preview_namelist script + CLM configure done. + CLM adding use_case 1850-2100_rcp6_transient defaults for var clm_demand with val fpftdyn + CLM adding use_case 1850-2100_rcp6_transient defaults for var clm_start_type with val startup + CLM adding use_case 1850-2100_rcp6_transient defaults for var model_year_align_ndep with val 1850 + CLM adding use_case 1850-2100_rcp6_transient defaults for var rcp with val 6 + CLM adding use_case 1850-2100_rcp6_transient defaults for var sim_year with val 1850 + CLM adding use_case 1850-2100_rcp6_transient defaults for var sim_year_range with val 1850-2100 + CLM adding use_case 1850-2100_rcp6_transient defaults for var stream_year_first_ndep with val 1850 + CLM adding use_case 1850-2100_rcp6_transient defaults for var stream_year_last_ndep with val 2100 + CLM adding use_case 1850-2100_rcp6_transient defaults for var use_case_desc with val Simulate transient land-use, aerosol and Nitrogen deposition changes + with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM + + build-namelist - No default value found for fpftdyn. + Are defaults provided for this resolution and land mask? + ERROR: clm.buildnml.csh failed + ERROR: /Users/erik/clm_cesm1_1_1_rel/scripts/ne60rcp6/preview_namelists failed: 25344 + +The important thing to note here is the line: +:: + + ERROR: clm.buildnml.csh failed + +which tells us that the problem is in the land **clm.buildnml.csh**. It may also indicate problems in one of the other buildnml.csh files (atm, cesm, cpl, glc, ice, or ocn), in which case you should consult the appropriate model user's guide. + +In the example, the error is that the CLM XML database does NOT have a ``finidat`` for the given resolution, rcp scenario and ocean mask. That means you will need to create the file and then supply the file into your case. See `Chapter 2 `_ for more information on creating files, and see `Chapter 3 `_ for more information on adding files to the XML database. Alternatively, you can provide the file to your case by creating a user namelist as shown in `the Section called User Namelist in Chapter 1 `_. + +.. note:: The two most common problems from your **clm.buildnml.csh** will be errors from the CLM **configure** or **build-namelist**. For more information on these scripts see: `the Section called More information on the CLM configure script in Chapter 1 `_ and `the section on CLM_BLDNML_OPTS `_. + + +Build problems +================ + +The following is an example of running the build for a case and having it fail in the land model build. +As you can see it lists which model component is being built and the build log for that component. +:: + + CCSM BUILDEXE SCRIPT STARTING + - Build Libraries: mct pio csm_share + Sat Jun 19 21:21:19 MDT 2010 /ptmp/erik/test_build/mct/mct.bldlog.100619-212107 + Sat Jun 19 21:22:18 MDT 2010 /ptmp/erik/test_build/pio/pio.bldlog.100619-212107 + Sat Jun 19 21:23:18 MDT 2010 + /ptmp/erik/test_build/csm_share/csm_share.bldlog.100619-212107 + Sat Jun 19 21:24:00 MDT 2010 /ptmp/erik/test_build/run/cpl.bldlog.100619-212107 + Sat Jun 19 21:24:00 MDT 2010 /ptmp/erik/test_build/run/atm.bldlog.100619-212107 + Sat Jun 19 21:24:06 MDT 2010 /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 + ERROR: clm.buildexe.csh failed, see /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 + ERROR: cat /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 + +You can then examine the build log that failed and see what went wrong. Most compilers will give the full filepath and line number for the file that filed to compile. + +Run Time Problems +================= + +Tracking down problems while the model is running is much more difficult to do than setup or build problems. +In this section we will give some suggestions on how to find run time problems. +Below we show the log file results of a job that aborted while running. +:: + + CCSM PRESTAGE SCRIPT HAS FINISHED SUCCESSFULLY + Sun Jun 20 18:24:06 MDT 2010 -- CSM EXECUTION BEGINS HERE + Sun Jun 20 18:24:35 MDT 2010 -- CSM EXECUTION HAS FINISHED + Model did not complete - see /ptmp/erik/test_run/run/cpl.log.100620-182358 + +In the next section we will talk about using the different log files to track down problems, and find out where the problem is coming from. In the section after that we give some general advice on debugging problems and some suggestions on ideas that may be helpful to track the problem down. Some of the examples below are from the `models/lnd/clm/doc/KnownBugs `_ file. + +Tracking Problems by Querying Log Files +--------------------------------------- + +The first thing to do when tracking down problems is to query the different log files to see if you can discover where the problem occurs, and any error messages about it. +It's important to figure out if the problem comes in at initialization or in the run phase of the model, and in which model component the problem happens. +There are different log files for the different major components, and they all end with the date and time in YYMMDD-HHMMSS format (2-digit: year, month, day, hour minute and second). +When the model runs to completion the log files will be copied to the logs directory in the script directory, but when the model fails they will remain in the run directory. +Here's an example list of log files from an "I" case where the model dies in the land model initialization. +For "I" cases the sea-ice and ocean components are just stubs and don't create log files (and unless running with the active land-ice model "glc" log files won't be created either). +:: + + atm.log.100620-182358 + cesm.log.100620-182358 + cpl.log.100620-182358 + lnd.log.100620-182358 + +The coupler log file +-------------------- + +The first log file to check is the coupler log file so that you can see where the model dies and which model component it fails in. When the model dies at initialization the last model component listed is the component that failed. + +Example of a case that fails in the CLM land model initialization. +:: + + (seq_timemgr_clockPrint) Prev Time = 00001201 00000 + (seq_timemgr_clockPrint) Next Time = 99991201 00000 + (seq_timemgr_clockPrint) Intervl yms = 9999 0 0 + + (seq_mct_drv) : Initialize each component: atm, lnd, ocn, and ice + (seq_mct_drv) : Initialize atm component + (seq_mct_drv) : Initialize lnd component + +The cesm log file +----------------- + +The cesm log files are to some extent the "garbage collection" of log output. +The CLM sends it's output from it's master processor, but sends other output and possibly errors to the cesm log file. +Because, of this, often error messages are somewhere in the cesm log file. +However, since there is so much other output it may be difficult to find. +For example, here is some output from an older version of CESM (CESM1.0.2) where the RTM river routing file (before it was converted to NetCDF) was not provided and the error on the open statement for the file was embedded near the end of the cesm log file. +:: + + NODE# NAME + ( 0) be1105en.ucar.edu + "/gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/lnd/clm/src/riverroute/RtmMod.F90", line + 239: 1525-155 The file name provided in the OPEN statement for unit 1 has zero length or + contains all blanks. The program will recover by ignoring the OPEN statement. + "/gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/lnd/clm/src/riverroute/RtmMod.F90", line + 241: 1525-001 The READ statement on the file fort.1 cannot be completed because the end + of the file was reached. The program will stop. + + Running: ./cesm.exe + Please wait... + + Memory usage for ./cesm.exe (task # 0) is: 51696 KB. Exit status: 1. Signal: 0 + +Although the example is from an earlier version of the model it still serves to illustrate finding problems from the cesm log file. + +When working with the cesm log file, for a run-time problem, you will need to be able to separate it's output into three categories: pre-crash, crash, and post-crash. +The pre-crash section is everything that is normal output for good operation of the model. +The crash section is the section where the model dies and reports on the actual problem. +the post-crash section is the cleanup and finalization after the model dies. +The most important part of this of course is the crash section. +The tricky part is distinguishing it from the other sections. +Also because the cesm log file most likely has duplicated output from multiple processors it is even more difficult to distinguish the different sections and to some extent the sections may be intertwined, as different processors reach the different sections at different times. +Because, of this reducing the number of processors for your simulation may help you sort out the output in the file (see `the Section called Run with a smaller set of processors `_). +Also much of the output from the cesm log file are system level information having to do with MPI multiprocessing. +Usually you can ignore this information, but it makes it more difficult to trudge through. + + +Sometimes the cesm log file is the ONLY file available, because the model terminates early in initialization. +In this case understanding the output in the cesm log file becomes even more important. +This also indicates the model did NOT advance far enough to reach the initialization of the individual model components. +This may mean that the initialization of the multiprocessing for MPI and/or OpenMP failed, or that the reading of the driver namelist file "drv_in" failed. + + +Here we show those three sections for a cesm log file where a two task job failed on reading the namelist file. +For a typical job with many tasks similar sections of this will be repeated not just twice but for each task and hence make it harder to read. + + +*Pre-crash section of the cesm log file* +:: + + ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. + + ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. + ATTENTION: 0031-378 MP_EUIDEVICE setting ignored when LoadLeveler is not being used. + ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. + 0:INFO: 0031-724 Executing program: + 1:INFO: 0031-724 Executing program: + 0:/contrib/bin/cesm_launch: process 401894 bound to logical CPU 0 on host be0310en.ucar.edu ... + 1:/contrib/bin/cesm_launch: process 439264 bound to logical CPU 1 on host be0310en.ucar.edu ... + 0:INFO: 0031-619 64bit(us, Packet striping on) ppe_rmas MPCI_MSG: MPI/MPCI library was compiled on Wed Aug 5 13:36:06 2009 + 0: + 1:LAPI version #14.26 2008/11/23 11:02:30 1.296 src/rsct/lapi/lapi.c, lapi, rsct_rpt53, rpt53s004a 09/04/29 64bit(us) library compiled on Wed Apr 29 15:30:42 2009 + 1:. + 1:LAPI is using lightweight lock. + 0:LAPI version #14.26 2008/11/23 11:02:30 1.296 src/rsct/lapi/lapi.c, lapi, rsct_rpt53, rpt53s004a 09/04/29 64bit(us) library compiled on Wed Apr 29 15:30:42 2009 + 0:. + 0:LAPI is using lightweight lock. + 0:Use health ping for failover/recovery + 1:Use health ping for failover/recovery + 0:Initial communication over instance 2. + 1:Initial communication over instance 0. + 1:IB RDMA initialization completed successfully + 1:The MPI shared memory protocol is used for the job + 0:IB RDMA initialization completed successfully + 0:LAPI job ID for this job is: 1684890719 + 0:The MPI shared memory protocol is used for the job + 0:(seq_comm_setcomm) initialize ID ( 7 GLOBAL ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_setcomm) initialize ID ( 2 ATM ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_setcomm) initialize ID ( 1 LND ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_setcomm) initialize ID ( 4 ICE ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_setcomm) initialize ID ( 5 GLC ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_setcomm) initialize ID ( 3 OCN ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_setcomm) initialize ID ( 6 CPL ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_joincomm) initialize ID ( 8 CPLATM ) join IDs = 6 2 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_joincomm) initialize ID ( 9 CPLLND ) join IDs = 6 1 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_joincomm) initialize ID ( 10 CPLICE ) join IDs = 6 4 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_joincomm) initialize ID ( 11 CPLOCN ) join IDs = 6 3 ( npes = 2) ( nthreads = 1) + 0:(seq_comm_joincomm) initialize ID ( 12 CPLGLC ) join IDs = 6 5 ( npes = 2) ( nthreads = 1) + 0: + 0: (seq_comm_printcomms) ID layout : global pes vs local pe for each ID + 0: gpe LND ATM OCN ICE GLC CPL GLOBAL CPLATM CPLLND CPLICE CPLOCN CPLGLC nthrds + 0: --- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ + 0: 0 : 0 0 0 0 0 0 0 0 0 0 0 0 1 + 1: 1 : 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1: + 0: (t_initf) Read in prof_inparm namelist from: drv_in + 1: (seq_io_init) cpl_io_stride, iotasks or root out of bounds - resetting to defaults 4 0 1 + 0: piolib_mod.f90 1353 1 2 1 2 + 1: piolib_mod.f90 1353 1 2 1 2 + 0: pio_support::pio_die:: myrank= 0 : ERROR: piolib_mod.f90: 1354 : not enough procs for the stride + 1: pio_support::pio_die:: myrank= 1 : ERROR: piolib_mod.f90: 1354 : not enough procs for the stride + +*Crash section of the cesm log file* +:: + + 0: + 0: Traceback: + 1: + 1: Traceback: + 0: Offset 0x00000c4c in procedure __pio_support_NMOD_piodie, near line 88 in file pio_support.F90.in + 1: Offset 0x00000c4c in procedure __pio_support_NMOD_piodie, near line 88 in file pio_support.F90.in + 0: Offset 0x00000fd0 in procedure __piolib_mod_NMOD_init, near line 1354 in file piolib_mod.F90 + 1: Offset 0x00000fd0 in procedure __piolib_mod_NMOD_init, near line 1354 in file piolib_mod.F90 + 1: Offset 0x00000398 in procedure __seq_io_mod_NMOD_seq_io_init, near line 247 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/shr/seq_io_mod.F90 + 0: Offset 0x00000398 in procedure __seq_io_mod_NMOD_seq_io_init, near line 247 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/shr/seq_io_mod.F90 + 0: Offset 0x0001aa88 in procedure ccsm_driver, near line 465 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/driver/ccsm_driver.F90 + 0: --- End of call chain --- + 1: Offset 0x0001aa88 in procedure ccsm_driver, near line 465 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/driver/ccsm_driver.F90 + 1: --- End of call chain --- + +*Post-crash section of the cesm log file* +:: + + 1:Communication statistics of task 1 is associated with task key: 1684890719_1 + 0:Communication statistics of task 0 is associated with task key: 1684890719_0 + 0: + 0:Running: ./cesm.exe + 0:Please wait... + 0: + 0:Memory usage for ./cesm.exe (task # 0) is: 198892 KB. Exit status: 134. Signal: 0 + 1: + 1:Running: ./cesm.exe + 1:Please wait... + 1: + 1:Memory usage for ./cesm.exe (task # 0) is: 198572 KB. Exit status: 134. Signal: 0 + INFO: 0031-656 I/O file STDOUT closed by task 0 + INFO: 0031-656 I/O file STDERR closed by task 0 + ERROR: 0031-250 task 0: IOT/Abort trap + INFO: 0031-656 I/O file STDOUT closed by task 1 + INFO: 0031-656 I/O file STDERR closed by task 1 + ERROR: 0031-250 task 1: IOT/Abort trap + INFO: 0031-639 Exit status from pm_respond = 0 + ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. + Job /usr/local/lsf/7.0/aix5-64/bin/poejob /contrib/bin/ccsm_launch /contrib/bin/job_memusage.exe ./cesm.exe + + TID HOST_NAME COMMAND_LINE STATUS TERMINATION_TIME + ===== ========== ================ ======================= =================== + 00000 be0310en /contrib/bin/ccs Exit (134) 08/31/2010 12:32:57 + 00001 be0310en /contrib/bin/ccs Exit (134) 08/31/2010 12:32:57 + +The CLM log file +---------------- + +Of course when you are working with and making changes to CLM, most of your focus will be on the CLM log file and the errors it shows. +As already pointed out if you don't see errors in the ``lnd.log.*`` file you should look in the ``cesm.log.*`` to see if any errors showed up there. + +Here's an example of the ``lnd.log.*`` file when running ``PTS_MODE`` with initial conditions (this is bug 1025 in the `models/lnd/clm/doc/KnownLimitationss `_ file). +:: + + Successfully initialized variables for accumulation + + reading restart file I2000CN_f09_g16_c100503.clm2.r.0001-01-01-00000.nc + Reading restart dataset + ERROR - setlatlon.F:Cant get variable dim for lat or lsmlat + ENDRUN: called without a message string + +The DATM log file +----------------- + +When working with "I cases" the second most common problems after CLM problems are problems with the data atmosphere model. So examining the ``atm.log.*`` is important. + +Here's an example of a problem that occurs when the wrong prescribed aerosol file is given to a ``pt1_pt1`` simulation. +:: + + (datm_comp_init) atm mode = CLMNCEP + (shr_strdata_init) calling shr_dmodel_mapSet for fill + (shr_strdata_init) calling shr_dmodel_mapSet for remap + ('shr_map_getWts') ERROR: yd outside bounds 19.5000000000000000 + (shr_sys_abort) ERROR: ('shr_map_getWts') ERROR yd outside 90 degree bounds + (shr_sys_abort) WARNING: calling shr_mpi_abort() and stopping + +The batch log files +------------------- + +The names of the batch log files will depend on the batch system of the machine that is being used. They will normally be in the script directory. Usually, they don't contain important information, but they are a last resort place to look for error messages. On the NCAR system "yellowstone" the batch files are called with names that start with the batch submission script and then either "stderr.o" or "stdout.o", with the job number at the end. + +General Advice on Debugging Run time Problems +============================================= + +Here are some suggestions on how to track down a problem while running. In general if the problem still occurs for a simpler case, it will be easier to track down. + +1. *Run in DEBUG mode* +#. *Run with a smaller set of processors* +#. *Run in serial mode with a single processor* +#. *Run at a lower resolution* +#. *Run a simpler case* +#. *Run with a debugger* + +Run in DEBUG mode +----------------- + +The first thing to try is to run in DEBUG mode so that float point trapping will be triggered as well as array bounds checking and other things the compiler can turn on to help you find problems. +To do this edit the ``env_build.xml`` file and set DEBUG to TRUE as follows: +:: + + > ./xmlchange DEBUG=TRUE + + +Run with a smaller set of processors +------------------------------------ + +Another way to simplify the system is to run with a smaller set of processors. You will need to clean the setup and edit the --env_mach_pes.xml--. For example, to run with four processors: +:: + + > ./case.setup -clean + > ./xmlchange NTASKS_ATM=4,NTASKS_LND=4,NTASKS_ICE=4,NTASKS_OCN=4,NTASKS_CPL=4,NTASKS_GLC=4 + > ./case.setup + +Another recommended simplification is to run without threading, so set the NTHRDS for each component to "1" if it isn't already. Sometimes, multiprocessing problems require a certain number of processors before they occur so you may not be able to debug the problem without enough processors. But, it's always good to reduce it to as low a number as possible to make it simpler. For threading problems you may have to have threading enabled to find the problem, but you can run with 1, 2, or 3 threads to see what happens. + +Run in serial mode with a single processor +------------------------------------------ + +Simplifying to one processor removes all multi-processing problems and makes the case as simple as possible. If you can enable ``MPILIB=mpi-serial`` you will also be able to run interactively rather than having to submit to a job queue, which sometimes makes it easier to run and debug. If you can use ``MPILIB=mpi-serial`` you can also use threading, but still run interactively in order to use more processors to make it faster if needed. +:: + + > ./case.setup -clean + # Set tasks and threads for each component to 1 + # You could also set threads to something > 1 for speed, but still + # run interactively if threading isn't an issue. + + > ./xmlchange NTASKS_ATM=1,NTHRDS_ATM=1,NTASKS_LND=1,NTHRDS_LND=1,NTASKS_ICE=1,NTHRDS_ICE=1 + > ./xmlchange NTASKS_OCN=1,NTHRDS_OCN=1,NTASKS_CPL=1,NTHRDS_CPL=1,NTASKS_GLC=1,NTHRDS_GLC=1 + # set MPILIB to mpi-serial so that you can run interactively + > ./xmlchange MPILIB=mpi-serial + > ./case.setup + # Then build your case + # And finally run, by running the *.run script interactively + +Run at a lower resolution +------------------------- + +If you can create a new case running at a lower resolution and replicate the problem it may be easier to solve. This of course requires creating a whole new case, and trying out different lower resolutions. + +Run a simpler case +------------------ + +Along the same lines, you might try running a simpler case, trying another compset with a simpler setup and see if you can replicate the problem and then debug from that simpler case. Again, of course you will need to create new cases to do this. + +Run with a debugger +------------------- + +Another suggestion is to run the model with a debugger such as: **dbx**, **gdb**, or **totalview**. +Often to run with a debugger you will need to reduce the number of processors as outlined above. +Some debuggers such as **dbx** will only work with one processor, while more advanced debuggers such as **totalview** can work with both MPI tasks and OMP threads. +Even simple debuggers though can be used to query core files, to see where the code was at when it died (for example using the **where** in **dbx** for a core file can be very helpful. +For help in running with a debugger you will need to contact your system administrators for the machine you are running on. + diff --git a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst new file mode 100644 index 0000000000..c2633e6522 --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst @@ -0,0 +1,162 @@ +======================== + Building the CLM tools +======================== + +The FORTRAN tools all have similar makefiles, and similar options for building. +All of the Makefiles use GNU Make extensions and thus require that you use GNU make to use them. +They also auto detect the type of platform you are on, using "uname -s" and set the compiler, compiler flags and such accordingly. +There are also environment variables that can be set to set things that must be customized. +All the tools use NetCDF and hence require the path to the NetCDF libraries and include files. +On some platforms (such as Linux) multiple compilers can be used, and hence there are env variables that can be set to change the FORTRAN and/or "C" compilers used. +The tools other than cprnc also allow finer control, by also allowing the user to add compiler flags they choose, for both FORTRAN and "C", as well as picking the compiler, linker and and add linker options. +Finally the tools other than **cprnc** allow you to turn optimization on (which is off by default but on for the **mksurfdata_map** and **interpinic** programs) with the OPT flag so that the tool will run faster. +To get even faster performance, the **interpinic**, program allows you to also use the SMP to turn on multiple shared memory processors. +When ``SMP=TRUE`` you set the number of threads used by the program with the ``OMP_NUM_THREADS`` environment variable. + +Options used by all: **cprnc**, **interpinic**, and **mksurfdata_map** + +- ``LIB_NETCDF`` -- sets the location of the NetCDF library. +- ``INC_NETCDF`` -- sets the location of the NetCDF include files. +- ``USER_FC`` -- sets the name of the FORTRAN compiler. + +Options used by: **interpinic**, **mkprocdata_map**, **mkmapgrids**, and **mksurfdata_map** + +- ``MOD_NETCDF`` -- sets the location of the NetCDF FORTRAN module. +- ``USER_LINKER`` -- sets the name of the linker to use. +- ``USER_CPPDEFS`` -- adds any CPP defines to use. +- ``USER_CFLAGS`` -- add any "C" compiler flags to use. +- ``USER_FFLAGS`` -- add any FORTRAN compiler flags to use. +- ``USER_LDFLAGS`` -- add any linker flags to use. +- ``USER_CC`` -- sets the name of the "C" compiler to use. +- ``OPT`` -- set to TRUE to compile the code optimized (TRUE or FALSE) +- ``SMP`` -- set to TRUE to turn on shared memory parallelism (i.e. OpenMP) (TRUE or FALSE) +- ``Filepath`` -- list of directories to build source code from. +- ``Srcfiles`` -- list of source code filenames to build executable from. +- ``Makefile`` -- customized makefile options for this particular tool. +- ``mkDepends`` -- figure out dependencies between source files, so make can compile in order.. +- ``Makefile.common`` -- General tool Makefile that should be the same between all tools. + +Options used only by **cprnc**: + +- ``EXEDIR`` -- sets the location where the executable will be built. +- ``VPATH`` -- colon delimited path list to find the source files. + +More details on each environment variable. + +``LIB_NETCDF`` + This variable sets the path to the NetCDF library file (``libnetcdf.a``). If not set it defaults to ``/usr/local/lib``. In order to use the tools you need to build the NetCDF library and be able to link to it. In order to build the model with a particular compiler you may have to compile the NetCDF library with the same compiler (or at least a compatible one). + +``INC_NETCDF`` + This variable sets the path to the NetCDF include directory (in order to find the include file ``netcdf.inc``). if not set it defaults to ``/usr/local/include``. + +``MOD_NETCDF`` + This variable sets the path to the NetCDF module directory (in order to find the NetCDF FORTRAN-90 module file when NetCDF is used with a FORTRAN-90 **use statement**. When not set it defaults to the ``LIB_NETCDF`` value. + +``USER_FC`` + This variable sets the command name to the FORTRAN-90 compiler to use when compiling the tool. The default compiler to use depends on the platform. And for example, on the AIX platform this variable is NOT used + +``USER_LINKER`` + This variable sets the command name to the linker to use when linking the object files from the compiler together to build the executable. By default this is set to the value of the FORTRAN-90 compiler used to compile the source code. + +``USER_CPPDEFS`` + This variable adds additional optional values to define for the C preprocessor. Normally, there is no reason to do this as there are very few CPP tokens in the CLM tools. However, if you modify the tools there may be a reason to define new CPP tokens. + +``USER_CC`` + This variable sets the command name to the "C" compiler to use when compiling the tool. The default compiler to use depends on the platform. And for example, on the AIX platform this variable is NOT used + +``USER_CFLAGS`` + This variable adds additional compiler options for the "C" compiler to use when compiling the tool. By default the compiler options are picked according to the platform and compiler that will be used. + +``USER_FFLAGS`` + This variable adds additional compiler options for the FORTRAN-90 compiler to use when compiling the tool. By default the compiler options are picked according to the platform and compiler that will be used. + +``USER_LDFLAGS`` + This variable adds additional options to the linker that will be used when linking the object files into the executable. By default the linker options are picked according to the platform and compiler that is used. + +``SMP`` + This variable flags if shared memory parallelism (using OpenMP) should be used when compiling the tool. It can be set to either TRUE or FALSE, by default it is set to FALSE, so shared memory parallelism is NOT used. When set to TRUE you can set the number of threads by using the OMP_NUM_THREADS environment variable. Normally, the most you would set this to would be to the number of on-node CPU processors. Turning this on should make the tool run much faster. + +.. warning:: Note, that depending on the compiler answers may be different when SMP is activated. + +``OPT`` + This variable flags if compiler optimization should be used when compiling the tool. It can be set to either ``TRUE`` or ``FALSE``, by default it is set to ``FALSE`` for **mkmapgrids** and ``TRUE`` for **mksurfdata_map**, **mkprocdata_map** and **interpinic**. Turning this on should make the tool run much faster. + +.. warning:: Note, you should expect that answers will be different when ``OPT`` is activated. + +``Filepath`` + All of the tools are stand-alone and don't need any outside code to operate. The Filepath is the list of directories needed to compile and hence is always simply "." the current directory. Several tools use copies of code outside their directory that is in the CESM distribution (either ``csm_share`` code or CLM source code). + +``Srcfiles`` + The ``Srcfiles`` lists the filenames of the source code to use when building the tool. + +``Makefile`` + The ``Makefile`` is the custom GNU Makefile for this particular tool. It will customize the ``EXENAME`` and the optimization settings for this particular tool. + +``Makefile.common`` + The ``Makefile.common`` is the copy of the general GNU Makefile for all the CLM tools. This file should be identical between the different tools. This file has different sections of compiler options for different Operating Systems and compilers. + +``mkDepends`` + The ``mkDepends`` is the copy of the perl script used by the ``Makefile.common`` to figure out the dependencies between the source files so that it can compile in the necessary order. This file should be identical between the different tools. + +``EXEDIR`` + The cprnc tool uses this variable to set the location of where the executable will be built. The default is the current directory. + +``VPATH`` + The **cprnc** tool uses this variable to set the colon delimited pathnames of where the source code exists. The default is the current directory. + +.. note:: There are several files that are copies of the original files from either models``/lnd/clm/src/util_share``, ``models/csm_share/shr``, or copies from other tool directories. By having copies the tools can all be made stand-alone, but any changes to the originals will have to be put into the tool directories as well. + +The *README.filecopies* (which can be found in ``models/lnd/clm/tools``) is repeated here. +:: + + models/lnd/clm/tools/README.filecopies Jun/04/2013 + + There are several files that are copies of the original files from + either models/lnd/clm/src/main, models/csm_share/shr, + models/csm_share/unit_testers, or copies from other tool + directories. By having copies the tools can all be made stand-alone, + but any changes to the originals will have to be put into the tool + directories as well. + + I. Files that are IDENTICAL: + + 1. csm_share files copied that should be identical to models/csm_share/shr: + + shr_const_mod.F90 + shr_log_mod.F90 + shr_timer_mod.F90 + + 2. csm_share files copied that should be identical to models/csm_share/unit_testers: + + test_mod.F90 + + 3. clm/src files copied that should be identical to models/lnd/clm/src/util_share: + + nanMod.F90 + + II. Files with differences + + 1. csm_share files copied with differences: + + shr_kind_mod.F90 --- SHR_KIND_CXX is new + shr_sys_mod.F90 ---- Remove mpi abort and reference to shr_mpi_mod.F90. + shr_infnan_mod.F90 - Earlier version + shr_string_mod.F90 - Earlier version + shr_file_mod.F90 --- mkprocdata_map version is stripped down + clm_varctl.F90 ----- Earlier version + + 2. clm/src files with differences: + + fileutils.F90 --- Remove use of masterproc and spmdMod and endrun in abortutils. + + 4. Files in mkmapgrids + + domainMod.F90 ---- Highly customized based off an earlier version of clm code. + Remove use of abortutils, spmdMod. clm version uses latlon + this version uses domain in names. Distributed memory + parallelism is removed. + + 5. Files in mksurfdata_map + + mkvarpar.F90 --- clm4_0 and clm4_5 versions are different and different from main clm versions. + diff --git a/doc/source/users_guide/using-clm-tools/cprnc.rst b/doc/source/users_guide/using-clm-tools/cprnc.rst new file mode 100644 index 0000000000..e921858b4c --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/cprnc.rst @@ -0,0 +1,29 @@ +.. comparing-history-files: + +========================= + Comparing History Files +========================= + +**cprnc** is a tool shared by both CAM and CLM to compare two NetCDF history files. +It differences every field that has a time-axis that is also shared on both files, and reports a summary of the difference. +The summary includes the three largest differences, as well as the root mean square (RMS) difference. +It also gives some summary information on the field as well. +You have to enter at least one file, and up to two files. +With one file it gives you summary information on the file, and with two it gives you information on the differences between the two. +At the end it will give you a summary of the fields compared and how many fields were different and how many were identical. + +Options: + +-m = do NOT align time-stamps before comparing + +-v = verbose output + +-ipr + +-jpr + +-kpr + +See the **cprnc** `README `_ file for more details. + +.. note:: To compare files with OUT a time axis you can use the **cprnc.ncl** NCL script in ``models/lnd/clm/tools/shared/ncl_scripts``. It won't give you the details on the differences but will report if the files are identical or different. diff --git a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst new file mode 100644 index 0000000000..6d4ec7bc12 --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst @@ -0,0 +1,27 @@ +.. _creating-domain-files: + +***************************** + Creating CLM domain files +***************************** + +*gen_domain* to create a domain file for datm from a mapping file. The domain file is then used by BOTH DATM AND CLM to define the grid and land-mask. The general data flow is shown in two figures. `Figure 2-4 `_ shows the general flow for a general global case (or for a regional grid that DOES include ocean). `Figure 2-5 `_ shows the use of **mknoocnmap.pl** (see `the Section called Using mknocnmap.pl to create grid and maps for single-point regional grids `_) to create a regional or single-point map file that is then run through **gen_domain** to create the domain file for it. As stated before `Figure 2-2 `_ is the legend for both of these figures. See `the +tools/mapping/gen_domain_files/README `_ file for more help on **gen_domain**. + +Here we create domain files for a regular global domain. + +Figure 2-4. Global Domain file creation +======================================= + +Insert figure 2-4 + +Starting from SCRIP grid files for both your atmosphere and ocean, you use **tools/mapping/gen_mapping_files/gen_cesm_maps.sh** to create a mapping file between the atmosphere and ocean. That mapping file is then used as input to **gen_domain** to create output domain files for both atmosphere and ocean. The atmosphere domain file is then used by both CLM and DATM for I compsets, while the ocean domain file is ignored. For this process you have to define your SCRIP grid files on your own. For a regional or single-point case that doesn't include ocean see `Figure 2-5 `_. (See `Figure 2-2 `_ for the legend for this figure.) + +Note, that the SCRIP grid file used to start this process, is also used in **mkmapdata.sh** (see `the Section called Creating mapping files that mksurfdata_map will use `_). Next we create domain files for a single-point or regional domain. + +Figure 2-5. Domain file creation using mknoocnmap.pl +==================================================== +Insert figure 2-5 + +For a regular latitude/longitude grid that can be used for regional or single point simulations -- you can use **mknoocnmap.pl**. It creates a SCRIP grid file that can then be used as input to **mkmapdata.sh** as well as a SCRIP mapping file that is then input to **gen_domain**. The output of **gen_domain** is a atmosphere domain file used by both CLM and DATM and a ocean domain file that is ignored. (See `Figure 2-2 `_ for the legend for this figure.) + +In this case the process creates both SCRIP grid files to be used by **mkmapdata.sh** as well as the domain files that will be used by both CLM and DATM. diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst new file mode 100644 index 0000000000..332aa5bd65 --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -0,0 +1,116 @@ +.. _creating-maps-for-mksurfdata: + +********************************************* +Creating input for surface dataset generation +********************************************* + +1. Generating SCRIP grid files +================================== + +The utility ``mkmapdata.sh`` requires SCRIP format input files to describe the input and output grids that maps are generated for. CLM provides a utility, ``mkmapgrids`` that generates those files. +The program converts old formats of CAM or CLM grid files to SCRIP grid format. There is also a NCL script (``mkscripgrid.ncl``) to create regular latitude longitude regional or single-point grids at the resolution the user desires. + +SCRIP grid files for all the standard model resolutions and the raw surface datasets have already been done and the files are in the XML database. Hence, this step doesn't need to be done -- EXCEPT WHEN YOU ARE CREATING YOUR OWN GRIDS. If you have a CLM grid or CAM file from previous versions and you want to convert it you can use **mkmapgrids**. + +Using mknocnmap.pl to create grid and maps for single-point regional grids +-------------------------------------------------------------------------- + +If you want to create a regular latitude/longitude single-point or regional grid, we suggest you use **mknoocnmap.pl** in ``models/lnd/clm/tools/shared/mkmapdata`` which will create both the SCRIP grid file you need (using ``models/lnd/clm/tools/shared/mkmapgrids/mkscripgrid.ncl`` AND an identity mapping file assuming there is NO ocean in your grid domain. If you HAVE ocean in your domain you could modify the mask in the SCRIP grid file for ocean, and then use **ESMF_RegridWeightGen** to create the mapping file, and **gen_domain** to create the domain file. Like other tools, ``shared/mkmapdata/mknoocnmap.pl`` has a help option with the following: +:: + + SYNOPSIS + mknoocnmap.pl [options] Gets map and grid files for a single land-only point. + REQUIRED OPTIONS + -centerpoint [or -p] Center latitude,longitude of the grid to create. + -name [-or -n] Name to use to describe point + + OPTIONS + -dx Size of total grid in degrees in longitude direction + (default is 0.1) + -dy Size of total grid in degrees in latitude direction + (default is 0.1) + -silent [or -s] Make output silent + -help [or -h] Print usage to STDOUT. + -verbose [or -v] Make output more verbose. + -nx Number of longitudes (default is 1) + -ny Number of latitudes (default is 1) + +See `Figure 2-5 `_ for a visual representation of this process. + + +2. Creating mapping files for mksurfdata_map +============================================== + +``mkmapdata.sh`` uses the above SCRIP grid input files to create SCRIP mapping data files (uses ESMF). + +The bash shell script ``models/lnd/clm/tools/shared/mkmapgrids/mkmapdata.sh`` uses **ESMF_RegridWeightGen** to create a list of maps from the raw datasets that are input to **mksurfdata_map**. +Each dataset that has a different grid, or land-mask needs a different mapping file for it, but many different raw datasets share the same grid/land-mask as other files. +Hence, there doesn't need to be a different mapping file for EACH raw dataset -- just for each DIFFERENT raw dataset. +See `Figure 2-3 `_ for a visual representation of how this works. +The bash script figures out which mapping files it needs to create and then runs **ESMF_RegridWeightGen** for each one. +You can then either enter the datasets into the XML database (see `Chapter 3 `_ or leave the files in place, and use the "-res usrspec -usr_gname -usr_gdate" options to **mksurfdata_map** (see `the Section called Running mksurfdata.pl `_ below). +Use the "-phys" option to specify if you are creating mapping files for clm4_0 or clm4_5 (the list of raw datafiles is somewhat different between the two). +mkmapdata.sh has a help option with the following +:: + + ../../tools/shared/mkmapdata/mkmapdata.sh + + ********************** + usage on yellowstone: + ./mkmapdata.sh + + valid arguments: + [-f|--gridfile ] + Full pathname of model SCRIP grid file to use + This variable should be set if this is not a supported grid + This variable will override the automatic generation of the + filename generated from the -res argument + the filename is generated ASSUMING that this is a supported + grid that has entries in the file namelist_defaults_clm.xml + the -r|--res argument MUST be specied if this argument is specified + [-r|--res ] + Model output resolution (default is 10x15) + [-t|--gridtype ] + Model output grid type + supported values are [regional,global], (default is global) + [-p|--phys ] + Whether to generate mapping files for clm4_0 or clm4_5 + supported values are [clm4_0,clm4_5], (default is clm4_5) + [-b|--batch] + Toggles batch mode usage. + If you want to run in batch mode + you need to have a separate batch script for a supported machine + that calls this script interactively - you cannot submit this + script directory to the batch system + [-l|--list] + List mapping files required (use check_input_data to get them) + also writes data to clm.input_data_list + [-d|--debug] + Toggles debug-only (don't actually run mkmapdata just echo what would happen) + [-h|--help] + Displays this help message + [-v|--verbose] + Toggle verbose usage -- log more information on what is happening + + You can also set the following env variables: + ESMFBIN_PATH - Path to ESMF binaries + (default is /contrib/esmf-5.3.0-64-O/bin) + CSMDATA ------ Path to CESM input data + (default is /glade/p/cesm/cseg/inputdata) + MPIEXEC ------ Name of mpirun executable + (default is mpirun.lsf) + REGRID_PROC -- Number of MPI processors to use + (default is 8) + + **pass environment variables by preceding above commands + with 'env var1=setting var2=setting ' + ********************** + + +.. warning:: Make sure you specify with the "-phys" option if you are creating files for CLM4.0! The default is CLM4.5. + +Figure 2-3. Details of running mkmapdata.sh +------------------------------------------- +Insert figure 2-3 + +Each of the raw datasets for **mksurfdata_map** needs a mapping file to map from the output grid you are running on to the grid and land-mask for that dataset. This is what **mkmapdata.sh** does. To create the mapping files you need a SCRIP grid file to correspond with each resolution and land mask that you have a raw data file in **mksurfdata_map**. Some raw datasets share the same grid and land mask -- hence they can share the same SCRIP grid file. The output maps created here go into **mksurfdata_map** see `Figure 2-6 `_. diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst new file mode 100644 index 0000000000..e42a46f81f --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -0,0 +1,376 @@ +.. _creating-surface-datasets: + +=========================== + Creating Surface Datasets +=========================== + +When just creating a replacement file for an existing one, the relevant tool should be used directly to create the file. When you are creating a set of files for a new resolution there are some dependencies between the tools that you need to keep in mind when creating them. The main dependency is that you MUST create a SCRIP grid file first as the SCRIP grid dataset is then input into the other tools. Also look at `Table 3-1 `_ which gives information on the files required and when. `Figure 2-1 `_ shows an overview of the general data-flow for creation of the fsurdat datasets. + +Figure 2-1. Data Flow for Creation of Surface Datasets from Raw SCRIP Grid Files +-------------------------------------------------------------------------------- +Insert figure 2-1 + +Starting from a SCRIP grid file that describes the grid you will run the model on, you first run **mkmapdata.sh** to create a list of mapping files. See `Figure 2-3 `_ for a more detailed view of how **mkmapdata.sh** works. The mapping files tell **mksurfdata_map** how to map between the output grid and the raw datasets that it uses as input. The output of **mksurfdata_map** is a surface dataset that you then use for running the model. See `Figure 2-6 `_ for a more detailed view of how **mksurfdata_map** works. + +`Figure 2-2 `_ is the legend for this figure (`Figure 2-1 `_) and other figures in this chapter (`Figure 2-4 `_, `Figure 2-5 `_, and `Figure 2-6 `_). +Figure 2-2. Legend for Data Flow Figures +Insert figure 2-2 + +Green arrows define the input to a program, while red arrows define the output. Cylinders define files that are either created by a program or used as input for a program. Boxes are programs. + +You start with a description of a SCRIP grid file for your output grid file and then create mapping files from the raw datasets to it. Once, the mapping files are created **mksurfdata_map** is run to create the surface dataset to run the model. + +Creating a Complete Set of Files for Input to CLM +------------------------------------------------- + +1. Create SCRIP grid datasets (if NOT already done) + + First you need to create a descriptor file for your grid, that includes the locations of cell centers and cell corners. There is also a "mask" field, but in this case the mask is set to one everywhere (i.e. all of the masks for the output model grid are "nomask"). An example SCRIP grid file is: $CSMDATA/lnd/clm2/mappingdata/grids/SCRIPgrid_10x15_nomask_c110308.nc. The mkmapgrids and mkscripgrid.ncl NCL script in the models/lnd/clm/tools/shared/mkmapgrids directory can help you with this. SCRIP grid files for all the standard CLM grids are already created for you. See the Section called Creating an output SCRIP grid file at a resolution to run the model on for more information on this. + +2. Create domain dataset (if NOT already done) + + Next use gen_domain to create a domain file for use by DATM and CLM. This is required, unless a domain file was already created. See the Section called Creating a domain file for CLM and DATM for more information on this. + +3. Create mapping files for mksurfdata_map (if NOT already done) + + Create mapping files for mksurfdata_map with mkmapdata.sh in models/lnd/clm/tools/shared/mkmapdata. See the Section called Creating mapping files that mksurfdata_map will use for more information on this. + +4. Create surface datasets + + Next use mksurfdata_map to create a surface dataset, using the mapping datasets created on the previous step as input. There is a version for either clm4_0 or clm4_5 for this program. See the Section called Using mksurfdata_map to create surface datasets from grid datasets for more information on this. + +5. Create some sort of initial condition dataset + + You then need to do one of the following three options to have an initial dataset to start from. + + a. Use spinup-procedures to create initial condition datasets + + The first option is to do the spinup procedures from arbitrary initial conditions to get good initial datasets. This is the most robust method to use. See the Section called Spinning up the Satellite Phenology Model (CLMSP spinup) in Chapter 4, the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4, or the Section called Spinning up the CLM4.0 Carbon-Nitrogen Dynamic Global Vegetation Model (CNDV spinup) in Chapter 4 for more information on this. + + b. Use interpinic to interpolate existing initial condition datasets + + The next option is to interpolate from spunup datasets at a different resolution, using interpinic. There is a version for either clm4_0 or clm4_5 for this program. See the Section called Using interpinic to interpolate initial conditions to different resolutions for more information on this. + + c. Start up from arbitrary initial conditions + + The last alternative is to run from arbitrary initial conditions without using any spun-up datasets. This is inappropriate when using CLM4.5-BGC or CLMCN (bgc=cn or cndv) as it takes a long time to spinup Carbon pools. + +.. warning:: This is NOT recommended as many fields in CLM take a long time to equilibrate. + +6. Enter the new datasets into the build-namelist XML database + The last optional thing to do is to enter the new datasets into the build-namelist XML database. See Chapter 3 for more information on doing this. This is optional because the user may enter these files into their namelists manually. The advantage of entering them into the database is so that they automatically come up when you create new cases. + +The ``models/lnd/clm/tools/README`` goes through the complete process for creating input files needed to run CLM. We repeat that file here: +:: + + models/lnd/clm/tools/README Jun/04/2013 + + CLM tools for analysis of CLM history files -- or for creation or + modification of CLM input files. + + I. General directory structure: + + clm4_0 + mksurfdata_map --- Create surface datasets. + interpinic ------- Interpolate initial datasets to a different resolution. + (has optimized and OMP options) + clm4_5 + mksurfdata_map --- Create surface datasets. + interpinic ------- Interpolate initial datasets to a different resolution. + (has optimized and OMP options) + + shared + mkmapgrids ------- Create SCRIP grid files needed by mkmapdata + [input is CLM grid files] + (deprecated) + mkmapdata -------- Create SCRIP mapping data from SCRIP grid files (uses ESMF) + gen_domain ------- Create data model domain datasets from SCRIP mapping datasets. + (also in the top level mapping directory [../../../../tools/mapping]) + mkprocdata_map --- Convert output unstructured grids into a 2D format that + can be plotted easily + ncl_scripts ------ NCL post or pre processing scripts. + + + Note that there are different versions of mksurfdata_map and interpinic for + CLM4.0 vs. CLM4.5. Other tools are shared between the two model + versions. + + However, note that mkmapdata makes mapping files for CLM4.5 by default; to + make mapping files for CLM4.0, run the tool with the option: + -p clm4_0 + + II. Notes on building/running for each of the above tools: + + Each tool that has FORTRAN source code has the following files: + + README -------------- Specific help for using the specific tool and help on specific + files in that directory. + src/Filepath -------- List of directories needed to build the tool + (some files in ../src directories are required). + src/Makefile -------- Customization of the make for the particular tool in question + src/Makefile.common - General GNU Makefile for creating FORTRAN tools + (these are identical between tools). + src/Srcfiles -------- List of source files that are needed. + src/Mkdepends ------- Dependency generator program + + mkmapdata and ncl_scripts only contain scripts so don't have the above build files. + + Most tools have copies of files from other directories -- see the README.filecopies + file for more information on this. + + Tools may also have files with the directory name followed by: namelist, or runoptions. + + .namelist ------ Namelist to create a global file. + .runoptions ---- Command line options to use the given tool. + + These files are also used by the test scripts to test the tools (see the + README.testing) file. + + NOTE: Be sure to change the path of the datasets references by these namelists to + point to where you have exported your CESM inputdata datasets. + + To build: + + cd + setenv INC_NETCDF + setenv LIB_NETCDF + gmake + + The process will create a file called "Depends" which has the dependencies + for the build of each file on other files. + + By default some codes may be compiled non-optimized + so that you can use the debugger, and with bounds-checking, and float trapping on. + To speed up do the following... + + gmake OPT=TRUE (by default already on for interpinic and mksurfdata_map) + + Also some of the tools allow for OpenMP shared memory parallelism + (such as interpinic) with + + gmake SMP=TRUE + + To run a program with a namelist: + + ./program < namelist + + To get help on running a program with command line options (e.g., interpinic): + + ./program + + To run a program built with SMP=TRUE: + + setenv OMP_NUM_THREADS= + + run normally as above + + III. Process sequence to create input datasets needed to run CLM + + NOTE: The following assumes you want to create files for CLM4.5. If you want to + use CLM4.0, you will need to do the following: + - In the following commands, change references to the clm4_5 directory to clm4_0 + - Add the option '-p clm4_0' to the mkmapdata.sh command. + + 1.) Create SCRIP grid files (if needed) + + a.) For standard resolutions these files will already be created. (done) + + b.) To create regular lat-lon regional/single-point grids run mknoocnmap.pl + + This will create both SCRIP grid files and a mapping file that will + be valid if the region includes NO ocean whatsoever (so you can skip step 2). + You can also use this script to create SCRIP grid files for a region + (or even a global grid) that DOES include ocean if you use step 2 to + create mapping files for it (simply discard the non-ocean map created by + this script). + + Example, for single-point over Boulder Colorado. + + cd shared/mkmapdata + ./mknoocnmap.pl -p 40,255 -n 1x1_boulderCO + + c.) General case + + You'll need to convert or create SCRIP grid files on your own (using scripts + or other tools) for the general case where you have an unstructured grid, or + a grid that is not regular in latitude and longitude. + + example format + ================== + netcdf fv1.9x2.5_090205 { + dimensions: + grid_size = 13824 ; + grid_corners = 4 ; + grid_rank = 2 ; + variables: + double grid_center_lat(grid_size) ; + grid_center_lat:units = "degrees" ; + double grid_center_lon(grid_size) ; + grid_center_lon:units = "degrees" ; + double grid_corner_lat(grid_size, grid_corners) ; + grid_corner_lat:units = "degrees" ; + double grid_corner_lon(grid_size, grid_corners) ; + grid_corner_lon:units = "degrees" ; + int grid_dims(grid_rank) ; + int grid_imask(grid_size) ; + grid_imask:units = "unitless" ; + + 2.) Create ocean to atmosphere mapping file (if needed) + + a.) Standard resolutions (done) + + If this is a standard resolution with a standard ocean resolution -- this + step is already done, the files already exist. + + b.) Region without Ocean (done in step 1.b) + + IF YOU RAN mknoocnmap.pl FOR A REGION WITHOUT OCEAN THIS STEP IS ALREADY DONE. + + c.) New atmosphere or ocean resolution + + If the region DOES include ocean, use gen_domain to create a + mapping file for it. + + Example: + + cd ../../../../tools/mapping/gen_domain_files/src + ./gen_domain -m $MAPFILE -o $OCNGRIDNAME -l $ATMGRIDNAME + + + 3.) Add SCRIP grid file(s) created in (1) into XML database in CLM (optional) + + See the "Adding New Resolutions or New Files to the build-namelist Database" + Chapter in the CLM User's Guide + + http://www.cesm.ucar.edu/models/cesm1.0/clm/models/lnd/clm/doc/UsersGuide/book1.html + + If you don't do this step, you'll need to specify the file to mkmapdata + in step (3) using the "-f" option. + + 4.) Create mapping files for use by mksurfdata_map with mkmapdata + (See mkmapdata/README for more help on doing this) + + - this step uses the results of (1) that were entered into the XML database + by step (3). If you don't enter datasets in, you need to specify the + SCRIP grid file using the "-f" option to mkmapdata.sh. + + - note that mkmapdata generates maps for CLM4.5 by default; to generate + mapping files for CLM4.0, add the option '-p clm4_0' + + Example: to generate all necessary mapping files for the ne30np4 grid + + cd shared/mkmapdata + ./mkmapdata.sh -r ne30np4 + + 5.) Add mapping file(s) created in step (4) into XML database in CLM (optional) + + See notes on doing this in step (3) above. + Edit ../bld/namelist_files/namelist_defaults_clm.xml to incorporate new + mapping files. + + If you don't do this step, you'll need to specify the grid resolution name + and file creation dates to mksurfdata_map in step (5) below. + + 6.) Convert map of ocean to atm for use by DATM and CLM with gen_domain + (See tools/mapping/README for more help on doing this) + + - gen_domain uses the map from step (2) (or previously created CESM maps) + + Example: + + cd ../../../../tools/mapping/gen_domain_files/src + gmake + cd .. + setenv CDATE 090206 + setenv OCNGRIDNAME gx1v6 + setenv ATMGRIDNAME fv1.9x2.5 + setenv MAPFILE $CSMDATA/cpl/cpl6/map_${OCNGRIDNAME}_to_${ATMGRIDNAME}_aave_da_${CDATE}.nc + ./gen_domain -m $MAPFILE -o $OCNGRIDNAME -l $ATMGRIDNAME + + Normally for I compsets running CLM only you will discard the ocean domain + file, and only use the atmosphere domain file for datm and as the fatmlndfrc + file for CLM. Output domain files will be named according to the input OCN/LND + gridnames. + + 7.) Create surface datasets with mksurfdata_map + (See mksurfdata_map/README for more help on doing this) + + - Run clm4_5/mksurfdata_map/mksurfdata.pl + - This step uses the results of step (4) entered into the XML database + in step (5). + - If datasets were NOT entered into the XML database, set the resolution + to "usrspec" and use the "-usr_gname", and "-usr_gdate" options. + + Example: for 0.9x1.25 resolution + + cd clm4_5/mksurfdata_map/src + gmake + cd .. + ./mksurfdata.pl -r 0.9x1.25 + + NOTE that surface dataset will be used by default for fatmgrid - and it will + contain the lat,lon,edges and area values for the atm grid - ASSUMING that + the atm and land grid are the same + + 8.) Interpolate initial conditions using interpinic (optional) + (See interpinic/README for more help on doing this) + IMPORTANT NOTE on interpinic!!!:: BE SURE TO USE NetCDF4.3 WHEN BUILDING! + If your template file was written using pnetcdf -- interpinic will corrupt + the resulting file and make it unusable! + + 9.) Add new files to XML data or using user_nl_clm (optional) + + See notes on doing this in step (3) above. + + IV. Example of creating single-point datasets without entering into XML database. + + Here we apply the process described in III. for a single-point dataset + where we don't enter the datasets into the XML database (thus skipping + steps 3, 5 and 9), but use the needed command line options to specify where the + files are. This also skips step (2) since step 1 creates the needed mapping file. + We also skip step (8) and do NOT create a finidat file. + + 0.) Set name of grid to use and the creation date to be used later... + setenv GRIDNAME 1x1_boulderCO + setenv CDATE `date +%y%m%d` + 1.) SCRIP grid and atm to ocn mapping file + cd shared/mkmapdata + ./mknoocnmap.pl -p 40,255 -n $GRIDNAME + # Set pointer to MAPFILE that will be used in step (6) + setenv MAPFILE `pwd`/map_${GRIDNAME}_noocean_to_${GRIDNAME}_nomask_aave_da_${CDATE}.nc + cd ../.. + 2.) skip + 3.) skip + 4.) Mapping files needed for mksurfdata_map + cd shared/mkmapdata + setenv GRIDFILE ../mkmapgrids/SCRIPgrid_${GRIDNAME}_nomask_${CDATE}.nc + ./mkmapdata.sh -r $GRIDNAME -f $GRIDFILE -t regional + cd .. + 5.) skip + 6.) Generate domain file for datm and CLM + cd ../../../../tools/mapping/gen_domain_files/src + gmake + cd .. + setenv OCNDOM domain.ocn_noocean.nc + setenv ATMDOM domain.lnd.{$GRIDNAME}_noocean.nc + ./gen_domain -m $MAPFILE -o $OCNDOM -l $ATMDOM + cd ../../../../lnd/clm/tools + 7.) Create surface dataset for CLM + cd clm4_5/mksurfdata_map/src + gmake + cd .. + ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE + 8.) skip + 9.) skip + + V. Notes on which input datasets are needed for CLM + + global or regional/single-point grids + - need fsurdata and fatmlndfrc + + fsurdata ---- from mksurfdata_map in step (III.7) + fatmlndfrc -- use the domain.lnd file from gen_domain in step (III.6) + (NOTE: THIS FILE IS POINTED TO USING ATM_DOMAIN_PATH/ATM_DOMAIN_FILE/LND_DOMAIN_PATH/ \ + LND_DOMAIN_FILE + env_run.xml variables -- do NOT simply add this to your user_nl_clm as it will fail) + diff --git a/doc/source/users_guide/using-clm-tools/datasts-for-observational-sites.rst b/doc/source/users_guide/using-clm-tools/datasts-for-observational-sites.rst new file mode 100644 index 0000000000..d1824d432e --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/datasts-for-observational-sites.rst @@ -0,0 +1,17 @@ +================================== + Datasets for Observational Sites +================================== + +There are two ways to customize datasets for a particular observational site. +The first is to customize the input to the tools that create the dataset, and the second is to over-write the default data after you've created a given dataset. +Depending on the tool it might be easier to do it one way or the other. +In `Table 3-1 `_ we list the files that are most likely to be customized and the way they might be customized. +Of those files, the ones you are most likely to customize are: fatmlndfrc, fsurdat, faerdep (for DATM), and stream_fldfilename_ndep. +Note **mksurfdata_map** as documented previously has options to overwrite the vegetation and soil types. +For more information on this also see `the Section called Creating your own single-point/regional surface datasets in Chapter 5 `_. +And PTCLM uses these methods to customize datasets see `Chapter 6 `_. + + +Another aspect of customizing your input datasets is customizing the input atmospheric forcing datasets. +See `the Section called Running with your own atmosphere forcing in Chapter 5 `_ for more information on this. +Also the chapter on PTCLM in `the Section called Converting AmeriFlux Data for use by PTCLM in Chapter 6 `_ has information on using the AmeriFlux tower site data as atmospheric forcing. diff --git a/doc/source/users_guide/using-clm-tools/index.rst b/doc/source/users_guide/using-clm-tools/index.rst new file mode 100644 index 0000000000..583122cdcd --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/index.rst @@ -0,0 +1,21 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. _using-clm-tools-section: + +##################################### +Using CLM tools +##################################### + +.. toctree:: + :maxdepth: 2 + + what-are-the-clm-tools.rst + building-the-clm-tools.rst + creating-input-for-surface-dataset-generation.rst + creating-surface-datasets.rst + datasts-for-observational-sites.rst + creating-domain-files.rst + cprnc.rst diff --git a/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst b/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst new file mode 100644 index 0000000000..b5e47e861f --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst @@ -0,0 +1,18 @@ +.. _observational-sites-datasets: + +******************************* +Observational Sites Datasets +******************************* + +There are two ways to customize datasets for a particular observational site. +The first is to customize the input to the tools that create the dataset, and the second is to over-write the default data after you've created a given dataset. +Depending on the tool it might be easier to do it one way or the other. +In `Table 3-1 `_ we list the files that are most likely to be customized and the way they might be customized. +Of those files, the ones you are most likely to customize are: fatmlndfrc, fsurdat, faerdep (for DATM), and stream_fldfilename_ndep. +Note **mksurfdata_map** as documented previously has options to overwrite the vegetation and soil types. +For more information on this also see `the Section called Creating your own single-point/regional surface datasets in Chapter 5 `_. +And PTCLM uses these methods to customize datasets see `Chapter 6 `_. + +Another aspect of customizing your input datasets is customizing the input atmospheric forcing datasets. +See `the Section called Running with your own atmosphere forcing in Chapter 5 `_ for more information on this. +Also the chapter on PTCLM in `the Section called Converting AmeriFlux Data for use by PTCLM in Chapter 6 `_ has information on using the AmeriFlux tower site data as atmospheric forcing. diff --git a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst new file mode 100644 index 0000000000..e71c97cf3d --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst @@ -0,0 +1,89 @@ +.. _what-are-the-clm-tools: + +======================== + What are the CLM tools +======================== + +There are several tools provided with CLM that allow you to create your own input datasets at resolutions you choose, or to interpolate initial conditions to a different resolution, or used to compare CLM history files between different cases. +The tools are all available in the ``models/lnd/clm/tools`` directory. +Most of the tools are FORTRAN stand-alone programs in their own directory, but there is also a suite of NCL scripts in the ``shared/ncl_scripts`` directory, and some of the tools are scripts that may also call the ESMF regridding program. +Some of the NCL scripts are very specialized and not meant for general use, and we won't document them here. +They still contain documentation in the script itself and the README file in the tools directory. + +The tools are divided into three directories for three categories: clm4_0, clm4_5, and shared. +The first two are of course for tools that are designed to work with either the CLM4.0 or CLM4.5 versions of the model. +The last one are shared utilities that can be used by either, or have a "-phys" option so you can specify which version you want to use. + +The list of generally important scripts and programs are as follows. + +1. *tools/cprnc* (relative to top level directory) to compare NetCDF files with a time axis. + +#. *shared/mkmapgrids* to create SCRIP grid data files from old CLM format grid files that can then be used to create new CLM datasets (deprecated). There is also a NCL script (``shared/mkmapgrids/mkscripgrid.ncl`` to create SCRIP grid files for regular latitude/longitude grids. + +#. *shared/mkmapdata* to create SCRIP mapping data file from SCRIP grid files (uses ESMF). + +#. *shared/gen_domain* to create a domain file for datm from a mapping file. The domain file is then used by BOTH datm AND CLM to define the grid and land-mask. + +#. *mksurfdata_map* to create surface datasets from grid datasets (clm4_0 and clm4_5 versions). + +#. *shared/mkprocdata_map* to interpolate output unstructured grids (such as the CAM HOMME dy-core "ne" grids like ne30np4) into a 2D regular lat/long grid format that can be plotted easily. Can be used by either clm4_0 or clm4_5. + +In the sections to come we will go into detailed description of how to use each of these tools in turn. +First, however we will discuss the common environment variables and options that are used by all of the FORTRAN tools. +Second, we go over the outline of the entire file creation process for all input files needed by CLM for a new resolution, then we turn to each tool. +In the last section we will discuss how to customize files for particular observational sites. + +The tools run either one of two ways, with a namelist to provide options, or with command line arguments (and NOT both). +**gen_domain** and **cprnc** run with command line arguments, and the other tools run with namelists. + +In the following sections, we will outline how to make these files available for build-namelist so that you can easily create simulations that include them. +In the chapter on single-point and regional datasets we also give an alternative way to enter new datasets without having to edit files. + +------------------------------------ +Running FORTRAN tools with namelists +------------------------------------ + +**mksurfdata_map** and **mkmapgrids** run with namelists that are read from standard input. +Hence, you create a namelist and then run them by redirecting the namelist file into standard input as follows: +:: + + ./program < namelist + +For programs with namelists there is at least one sample namelist with the name "program".namelist (i.e. +``mksurfdata_map.namelist`` for the **mksurfdata_map** program). +There may also be other sample namelists that end in a different name besides "namelist". +Namelists that you create should be similar to the example namelist. +The namelist values are also documented along with the other namelists in the: +:: + + models/lnd/clm/bld/namelist_files/namelist_definition.xml`` file + and default values in the: + models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml`` file. + +----------------------------------------------- +Running FORTRAN tools with command line options +----------------------------------------------- + +**gen_domain**, and **cprnc** run with command line arguments. +The detailed sections below will give you more information on the command line arguments specific to each tool. +Also running the tool without any arguments will give you a general synopsis on how to run the tool. + +----------------------------------------- +Running FORTRAN tools built with SMP=TRUE +----------------------------------------- + +When you enable ``SMP=TRUE`` on your build of one of the tools that make use of it, you are using OpenMP for shared memory parallelism (SMP). +In SMP loops are run in parallel with different threads run on different processors all of which access the same memory (called on-node). +Thus you can only usefully run up to the number of processors that are available on a single-node of the machine you are running on. +For example, on the NCAR machine yellowstone there are 16 processors per node, but the SMT hardware on the machine allows you to submit twice as many threads or 32 threads. + + +--------- +Using NCL +--------- + +In the tools directory ``models/lnd/clm/tools/shared/ncl_scripts`` and in a few other locations there are scripts that use NCAR Command Language (NCL). +Unlike the FORTRAN tools, you will need to get a copy of NCL in order to use them. +You also won't have to build an executable in order to use them, hence no Makefile is provided. +NCL is provided for free download as either binaries or source code from: `http://www.ncl.ucar.edu/ `_. +The NCL web-site also contains documentation on NCL and it's use. These scripts are stand-alone and at most use environment variables to control how to use them. In some cases there are perl scripts with command line arguments that call the NCL scripts to control what they do. From 945619d5c5c94ab85dc18f17ea08d20f52e4a4d4 Mon Sep 17 00:00:00 2001 From: mvertens Date: Sun, 26 Mar 2017 11:23:47 -0600 Subject: [PATCH 0002/1973] first pass at some rst additions --- .../CLM45_Tech_Note_Chpt_1_Introduction.rst | 832 +++++++ .../CLM45_Tech_Note_Chpt_10_Glacier.rst | 169 ++ .../CLM45_Tech_Note_Chpt_11_RTM.rst | 139 ++ .../CLM45_Tech_Note_Chpt_12_Urban.rst | 130 + ...Note_Chpt_13_CN_Allocation_Respiration.rst | 599 +++++ ...Tech_Note_Chpt_14_Vegetation_Phenology.rst | 887 +++++++ .../CLM45_Tech_Note_Chpt_15_Decomposition.rst | 797 ++++++ ...h_Note_Chpt_16_External_Nitrogen_Cycle.rst | 397 +++ ...LM45_Tech_Note_Chpt_17_Plant_Mortality.rst | 505 ++++ .../CLM45_Tech_Note_Chpt_18_Fire.rst | 659 +++++ .../CLM45_Tech_Note_Chpt_19_Methane.rst | 619 +++++ .../CLM45_Tech_Note_Chpt_2_Ecosystem.rst | 782 ++++++ ...LM45_Tech_Note_Chpt_20_Crop_Irrigation.rst | 722 ++++++ ..._Tech_Note_Chpt_21_Transient_Landcover.rst | 359 +++ .../CLM45_Tech_Note_Chpt_22_DGVM.rst | 155 ++ .../CLM45_Tech_Note_Chpt_23_BVOCs.rst | 66 + .../CLM45_Tech_Note_Chpt_24_Dust.rst | 212 ++ .../CLM45_Tech_Note_Chpt_25_Isotopes.rst | 256 ++ .../CLM45_Tech_Note_Chpt_26_Offline.rst | 210 ++ .../CLM45_Tech_Note_Chpt_27_References.rst | 1377 +++++++++++ ...CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst | 1137 +++++++++ ...LM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst | 289 +++ .../CLM45_Tech_Note_Chpt_5_Fluxes.rst | 1773 ++++++++++++++ ...ech_Note_Chpt_6_Soil_Snow_Temperatures.rst | 928 +++++++ .../CLM45_Tech_Note_Chpt_7_Hydrology.rst | 2167 +++++++++++++++++ .../CLM45_Tech_Note_Chpt_8_Photosynthesis.rst | 718 ++++++ .../CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst | 1189 +++++++++ 27 files changed, 18073 insertions(+) create mode 100644 doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst create mode 100644 doc/source/tech_note/CHAPTER_10/CLM45_Tech_Note_Chpt_10_Glacier.rst create mode 100644 doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst create mode 100644 doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst create mode 100644 doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst create mode 100644 doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst create mode 100644 doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst create mode 100644 doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst create mode 100644 doc/source/tech_note/CHAPTER_17/CLM45_Tech_Note_Chpt_17_Plant_Mortality.rst create mode 100644 doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst create mode 100644 doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst create mode 100644 doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst create mode 100644 doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst create mode 100644 doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst create mode 100644 doc/source/tech_note/CHAPTER_22/CLM45_Tech_Note_Chpt_22_DGVM.rst create mode 100644 doc/source/tech_note/CHAPTER_23/CLM45_Tech_Note_Chpt_23_BVOCs.rst create mode 100644 doc/source/tech_note/CHAPTER_24/CLM45_Tech_Note_Chpt_24_Dust.rst create mode 100644 doc/source/tech_note/CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst create mode 100644 doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst create mode 100644 doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst create mode 100644 doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst create mode 100644 doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst create mode 100644 doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst create mode 100644 doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst create mode 100644 doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst create mode 100644 doc/source/tech_note/CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst create mode 100644 doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst diff --git a/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst b/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst new file mode 100644 index 0000000000..1bcd54fca7 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst @@ -0,0 +1,832 @@ +.. math:: 188 + +**NCAR/TN-503+STR** + +**NCAR Technical Note** + +**\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_** + +**** + +**July 2013** + +**** + +**Technical Description of version 4.5 of the Community Land Model +(CLM)** + +***Coordinating Lead Authors*** + +**Keith W. Oleson, David M. Lawrence** + +**** + +***Lead Authors*** + +**Gordon B. Bonan, Beth Drewniak, Maoyi Huang, Charles D. Koven, Samuel +Levis, Fang Li, William J. Riley, Zachary M. Subin, Sean C. Swenson, +Peter E. Thornton** + +**** + +***Contributing Authors*** + +**Anil Bozbiyik, Rosie Fisher, Colette L. Heald, Erik Kluzek, +Jean-Francois Lamarque, Peter J. Lawrence, L. Ruby Leung, William +Lipscomb, Stefan Muszala, Daniel M. Ricciuto, William Sacks, Ying Sun, +Jinyun Tang, Zong-Liang Yang** + +**** + +**** + +**** + +**NCAR Earth System Laboratory** + +**Climate and Global Dynamics +Division\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_** + +**NATIONAL CENTER FOR ATMOSPHERIC RESEARCH** + +**P. O. Box 3000** + +**BOULDER, COLORADO 80307-3000** + +**ISSN Print Edition 2153-2397** + +**ISSN Electronic Edition 2153-2400** + +**** + +**NCAR TECHNICAL NOTES** + +http://library.ucar.edu/research/publish-technote\ **** + +**** + +The Technical Notes series provides an outlet for a variety of NCAR +Manuscripts that contribute in specialized ways to the body of +scientific knowledge but that are not yet at a point of a formal +journal, monograph or book publication. Reports in this series are +issued by the NCAR scientific divisions, serviced by OpenSky and +operated through the NCAR Library. Designation symbols for the series +include: + +**EDD – Engineering, Design, or Development Reports** + +Equipment descriptions, test results, instrumentation, + +and operating and maintenance manuals. + +**IA – Instructional Aids** + +** Instruction manuals, bibliographies, film supplements, + +and other research or instructional aids. + +**PPR – Program Progress Reports** + +** Field program reports, interim and working reports, + +survey reports, and plans for experiments. + +**PROC – Proceedings** + +** Documentation or symposia, colloquia, conferences, + +workshops, and lectures. (Distribution maybe limited to + +attendees). + +**STR – Scientific and Technical Reports** + +Data compilations, theoretical and numerical + +investigations, and experimental results. + +The National Center for Atmospheric Research (NCAR) is operated by the +nonprofit University Corporation for Atmospheric Research (UCAR) under +the sponsorship of the National Science Foundation. Any opinions, +findings, conclusions, or recommendations expressed in this publication +are those of the author(s) and do not necessarily reflect the views of +the National Science Foundation. + +National Center for Atmospheric Research + +P. O. Box 3000 + +Boulder, Colorado 80307-300 + +**** + +ii + +**NCAR/TN-503+STR** + +**NCAR Technical Note** + +**\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_** + +**** + +**July 2013** + +**** + +**Technical Description of version 4.5 of the Community Land Model +(CLM)** + +***Coordinating Lead Authors*** + +**Keith W. Oleson, David M. Lawrence** + +**** + +***Lead Authors*** + +**Gordon B. Bonan, Beth Drewniak, Maoyi Huang, Charles D. Koven, Samuel +Levis, Fang Li, William J. Riley, Zachary M. Subin, Sean C. Swenson, +Peter E. Thornton** + +**** + +***Contributing Authors*** + +**Anil Bozbiyik, Rosie Fisher, Colette L. Heald, Erik Kluzek, +Jean-Francois Lamarque, Peter J. Lawrence, L. Ruby Leung, William +Lipscomb, Stefan Muszala, Daniel M. Ricciuto, William Sacks, Ying Sun, +Jinyun Tang, Zong-Liang Yang** + +**** + +**** + +**** + +**NCAR Earth System Laboratory** + +**Climate and Global Dynamics +Division\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_** + +**NATIONAL CENTER FOR ATMOSPHERIC RESEARCH** + +**P. O. Box 3000** + +**BOULDER, COLORADO 80307-3000** + +**ISSN Print Edition 2153-2397** + +**ISSN Electronic Edition 2153-2400** + +xi + +**TABLE OF CONTENTS** + +**** + +**1. Introduction 11.1 Model History 11.1.1 Inception of CLM 11.1.2 CLM2 +31.1.3 CLM3 51.1.4 CLM3.5 61.1.5 CLM4 71.1.6 CLM4.5 81.2 Biogeophysical +and Biogeochemical Processes 112. Surface Characterization and Model +Input Requirements 142.1 Surface Characterization 142.1.1 Surface +Heterogeneity and Data Structure 142.1.2 Vegetation Composition 172.1.3 +Vegetation Structure 192.1.4 Phenology and vegetation burial by snow +212.2 Model Input Requirements 212.2.1 Atmospheric Coupling 212.2.2 +Initialization 272.2.3 Surface Data 282.2.4 Adjustable Parameters and +Physical Constants 353. Surface Albedos 373.1 Canopy Radiative Transfer +373.2 Ground Albedos 463.2.1 Snow Albedo 483.2.2 Snowpack Optical +Properties 523.2.3 Snow Aging 563.3 Solar Zenith Angle 594. Radiative +Fluxes 634.1 Solar Fluxes 634.2 Longwave Fluxes 675. Momentum, Sensible +Heat, and Latent Heat Fluxes 715.1 Monin-Obukhov Similarity Theory 735.2 +Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces 825.3 +Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces +885.3.1 Theory 885.3.2 Numerical Implementation 1025.4 Update of Ground +Sensible and Latent Heat Fluxes 1075.5 Saturation Vapor Pressure 1106. +Soil and Snow Temperatures 1136.1 Numerical Solution 1146.2 Phase Change +1256.2.1 Soil and Snow Layers 1256.2.2 Surface Water 1296.3 Soil and +Snow Thermal Properties 1307. Hydrology 1347.1 Canopy Water 1357.2 Snow +1377.2.1 Snow Covered Area Fraction 1397.2.2 Ice Content 1407.2.3 Water +Content 1427.2.4 Black and organic carbon and mineral dust within snow +1437.2.5 Initialization of snow layer 1467.2.6 Snow Compaction 1467.2.7 +Snow Layer Combination and Subdivision 1497.2.7.1 Combination 1497.2.7.2 +Subdivision 1527.3 Surface Runoff, Surface Water Storage, and +Infiltration 1537.3.1 Surface Runoff 1537.3.2 Surface Water Storage +1557.3.3 Infiltration 1567.4 Soil Water 1587.4.1 Hydraulic Properties +1607.4.2 Numerical Solution 1637.4.2.1 Equilibrium soil matric potential +and volumetric moisture 1697.4.2.2 Equation set for layer i=1 1717.4.2.3 +Equation set for layers i=2,…,N\ :sub:`levsoi` -1 1717.4.2.4 Equation +set for layers i=N\ :sub:`levsoi` ,…N\ :sub:`levsoi` +1 1727.5 Frozen +Soils and Perched Water Table 1747.6 Groundwater-Soil Water Interactions +1757.7 Runoff from glaciers and snow-capped surfaces 1787.8 The Variable +Infiltration Capacity parameterizations as a hydrologic option 1798. +Stomatal Resistance and Photosynthesis 1838.1 Stomatal resistance 1838.2 +Photosynthesis 1868.3 Vcmax25 and canopy scaling 1918.4 Soil water +stress 1938.5 Numerical implementation 1979. Lake Model 2009.1 +Discretization 2019.2 External Data 2029.3 Surface Albedo 2029.4 Surface +Fluxes and Surface Temperature 2039.4.1 Overview of Changes from CLM4 +2039.4.2 Surface Properties 2039.4.3 Surface Flux Solution 2059.5 Lake +Temperature 2119.5.1 Introduction 2119.5.2 Overview of Changes from CLM4 +2129.5.3 Boundary Conditions 2139.5.4 Eddy Diffusivity and Thermal +Conductivities 2139.5.5 Radiation Penetration 2169.5.6 Heat Capacities +2179.5.7 Crank-Nicholson Solution 2179.5.8 Phase Change 2199.5.9 +Convection 2209.5.10 Energy Conservation 2239.6 Lake Hydrology 2239.6.1 +Overview 2239.6.2 Water Balance 2249.6.3 Precipitation, Evaporation, and +Runoff 2259.6.4 Soil Hydrology 2269.6.5 Modifications to Snow Layer +Logic 22710. Glaciers 22910.1 Overview 22910.2 Multiple elevation class +scheme 23110.3 Computation of the surface mass balance 23211. River +Transport Model (RTM) 23512. Urban Model (CLMU) 23913. Carbon and +Nitrogen Pools, Allocation, and Respiration 24413.1 Introduction 24413.2 +Carbon Allocation for Maintenance Respiration Costs 24613.3 Carbon and +Nitrogen Stoichiometry of New Growth 24813.4 Deployment of +retranslocated nitrogen 25213.5 Plant nitrogen uptake from soil mineral +nitrogen pool 25313.6 Final carbon and nitrogen allocation 25313.7 +Autotrophic Respiration 25613.7.1 Maintenance Respiration 25613.7.2 +Growth Respiration 25714. Vegetation Phenology 25914.1 General Phenology +Flux Parameterization 25914.1.1 Onset Periods 26014.1.2 Offset Periods +26214.1.3 Background Onset Growth 26414.1.4 Background Litterfall +26514.1.5 Livewood Turnover 26614.2 Evergreen Phenology 26714.3 +Seasonal-Deciduous Phenology 26814.3.1 Seasonal-Deciduous Onset Trigger +26814.3.2 Seasonal-Deciduous Offset Trigger 27114.4 Stress-Deciduous +Phenology 27114.4.1 Stress-Deciduous Onset Triggers 27114.4.2 +Stress-Deciduous Offset Triggers 27314.4.3 Stress-Deciduous: Long +Growing Season 27414.5 Litterfall Fluxes Merged to the Column Level +27615. Decomposition 27815.1 CLM-CN Pool Structure, Rate Constants and +Parameters 28115.2 Century-based Pool Structure, Rate Constants and +Parameters 28515.3 Environmental modifiers on decomposition rate 28615.4 +N-limitation of Decomposition Fluxes 28915.5 N Competition between plant +uptake and soil immobilization fluxes 29215.6 Final Decomposition Fluxes +29315.7 Vertical Distribution and Transport of Decomposing C and N pools +29515.8 Model Equilibration 29616. External Nitrogen Cycle 29816.1 +Atmospheric Nitrogen Deposition 29816.2 Biological Nitrogen Fixation +29916.3 Nitrification and Denitrification Losses of Nitrogen 30116.3.1 +CLM-CN formulation 30116.3.2 Century-based formulation 30416.4 Leaching +Losses of Nitrogen 30516.5 Losses of Nitrogen Due to Fire 30717. Plant +Mortality 30817.1 Mortality Fluxes Leaving Vegetation Pools 30817.2 +Mortality Fluxes Merged to the Column Level 31118. Fire 31618.1 Non-peat +fires outside cropland and tropical closed forest 31618.1.1 Fire counts +31618.1.2 Average spread area of a fire 32018.1.3 Fire impact 32318.2 +Agricultural fires 32518.3 Deforestation fires 32618.4 Peat fires 32919. +Methane Model 33219.1 Methane Model Structure and Flow 33219.2 Governing +Mass-Balance Relationship 33319.3 CH4 Production 33419.4 Ebullition +33819.5 Aerenchyma Transport 33819.6 CH4 Oxidation 34019.7 Reactive +Transport Solution 34019.7.1 Competition for CH4 and O2 34119.7.2 CH4 +and O2 Source Terms 34119.7.3 Aqueous and Gaseous Diffusion 34219.7.4 +Boundary Conditions 34319.7.5 Crank-Nicholson Solution 34419.7.6 +Interface between water table and unsaturated zone 34519.8 Inundated +Fraction Prediction 34619.9 Seasonal Inundation 34720. Crops and +Irrigation 34820.1 Summary of CLM4.5 updates relative to the CLM4.0 +34820.2 The crop model 34820.2.1 Introduction 34820.2.2 Crop plant +functional types 34920.2.3 Phenology 35020.2.3.1 Planting 35120.2.3.2 +Leaf emergence 35220.2.3.3 Grain fill 35320.2.3.4 Harvest 35320.2.4 +Allocation 35320.2.4.1 Leaf emergence to grain fill 35420.2.4.2 Grain +fill to harvest 35420.2.5 General comments 35520.3 The irrigation model +36020.4 The details about what is new in CLM4.5 36120.4.1 Interactive +irrigation for corn, temperate cereals, and soybean 36120.4.2 +Interactive fertilization 36320.4.3 Biological nitrogen fixation for +soybeans 36420.4.4 Modified C:N ratios for crops 36520.4.5 Nitrogen +retranslocation for crops 36520.4.6 Separate reproductive pool 36721. +Transient Landcover Change 36921.1 Annual Transient Land Cover Data and +Time Interpolation 36921.2 Mass and Energy Conservation 37121.3 Annual +Transient Land Cover Dataset Development 37221.3.1 UNH Transient Land +Use and Land Cover Change Dataset 37221.3.2 Representing Land Use and +Land Cover Change in CLM 37421.3.3 Present Day PFT Dataset 37521.3.4 +Potential PFT Distribution 37621.3.5 Transient Land Cover Change Dataset +37721.3.6 Forest Harvest Dataset Changes 37822. Dynamic Global +Vegetation Model 38122.1 Establishment and survival 38222.2 Light +competition 38322.3 CN processes modified for the CNDV coupling 38323. +Biogenic Volatile Organic Compounds (BVOCs) 38624. Dust Model 38825. +Carbon Isotopes 39325.1 General Form for Calculating 13C and 14C Flux +39325.2 Isotope Symbols, Units, and Reference Standards 39425.3 Carbon +Isotope Discrimination During Photosynthesis 39625.4 14C radioactive +decay and historical atmospheric 14C concentrations 39826. Offline Mode +40027. References 405** + +**LIST OF FIGURES** + +Figure 1.1. Land biogeophysical, biogeochemical, and landscape processes +simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). +13Figure 2.1. Configuration of the CLM subgrid hierarchy. 15Figure 4.1. +Schematic diagram of (a) direct beam radiation, (b) diffuse solar +radiation, and (c) longwave radiation absorbed, transmitted, and +reflected by vegetation and ground. 64Figure 5.1. Schematic diagram of +sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated +surfaces. 91Figure 5.2. Schematic diagram of water vapor fluxes for (a) +non-vegetated surfaces and (b) vegetated surfaces. 92Figure 6.1. +Schematic diagram of numerical scheme used to solve for soil +temperature. 119Figure 7.1. Hydrologic processes represented in CLM. +135Figure 7.2. Example of three layer snow pack (snl=-3). 137Figure 7.3. +Schematic diagram of numerical scheme used to solve for soil water +fluxes. 165Figure 12.1. Schematic representation of the urban land unit. +242Figure 12.2. Schematic of urban and atmospheric model coupling. +243Figure 13.1. Vegetation fluxes and pools. 245Figure 13.2: Carbon and +nitrogen pools. 246Figure 14.1. Example of annual phenology cycle for +seasonal deciduous. 260Figure 14.2. Example fluxes and pools sizes for +an onset growth period of 15 days, with initial transfer pool size of +100 gC m-2 and a timestep of one hour. a) Flux leaving transfer pool +(e.g. CFleaf\_xfer,leaf). b) Carbon content of transfer pool and its +associated display pool (e.g. CSleaf\_xfer and CSleaf, respectively). +262Figure 14.3. Example fluxes and pool sizes for an offset (litterfall) +period of 15 days, with initial display pool size of 100 gC m-2 and a +timestep of one hour. a) Litterfall flux (e.g CFleaf,litter). b) Carbon +content of display pool and litter pool through the litterfall period, +ignoring the losses from litter pool due to decomposition during this +period. 264Figure 15.1. Schematic of decomposition model in CLM. +279Figure 15.2. Pool structure, transitions, respired fractions (numbers +at end of arrows), and turnover times (numbers in boxes) for the 2 +alternate soil decomposition models included in CLM. 281Figure 16.1. +Biological nitrogen fixation as a function of annual net primary +production. 300Figure 19.1. Schematic representation of biological and +physical processes integrated in CLM that affect the net CH4 surface +flux. (left) Fully inundated portion of a CLM gridcell and (right) +variably saturated portion of a gridcell. 334Figure 21.1. Schematic of +land cover change impacts on CLM carbon pools and fluxes. 379Figure +21.2. Schematic of translation of annual UNH land units to CLM4 plant +functional types. 380Figure 25.1. Atmospheric +:math:`\mathrm{\Delta}`\ 14C used to drive 14C model over the historical +period. 399\ **** + +**LIST OF TABLES** + +Table 2.1. Plant functional types 18Table 2.2. Prescribed plant +functional type heights 20Table 2.3. Atmospheric input to land model +23Table 2.4. Land model output to atmospheric model 26Table 2.5. Surface +data required for CLM4.5 and their base spatial resolution 29Table 2.6. +Physical constants 36Table 3.1. Plant functional type optical properties +44Table 3.2. Intercepted snow optical properties 46Table 3.3. Dry and +saturated soil albedos 48Table 3.4. Spectral bands and weights used for +snow radiative transfer 51Table 3.5. Single-scatter albedo values used +for snowpack impurities and ice 54Table 3.6. Mass extinction values (m2 +kg-1) used for snowpack impurities and ice. 55Table 3.7. Asymmetry +scattering parameters used for snowpack impurities and ice. 56Table 3.8. +Orbital parameters 62Table 5.1. Plant functional type aerodynamic +parameters 101Table 5.2. Coefficients for e\ :sub:`sat`\ :sup:`T` +111Table 5.3. Coefficients for 112Table 6.1. Soil layer structure. +115Table 7.1. Meltwater scavenging efficiency for particles within snow +146Table 7.2. Minimum and maximum thickness of snow layers (m) 152Table +8.1. Plant functional type (PFT) photosynthetic parameters. 185Table +8.2. Temperature dependence parameters for C3 photosynthesis. 190Table +8.3. Plant functional type root distribution parameters. 196Table 13.1. +Allocation and carbon:nitrogen ratio parameters 250Table 15.1. +Decomposition rate constants for litter and SOM pools, C:N ratios, and +acceleration parameters (see section 15.8 for explanation) for the +CLM-CN decomposition pool structure. 283Table 15.2. Respiration +fractions for litter and SOM pools 284Table 15.3. Respiration fractions +for litter and SOM pools for Century-based structure 285Table 15.4. +Turnover times, C:N ratios, and acceleration parameters (see section +15.8 for explanation) for the Century-based decomposition cascade. +286Table 18.1. PFT-specific combustion completeness and fire mortality +factors. 331Table 19.1. Parameter descriptions and sensitivity analysis +ranges applied in the methane model. 337Table 19.2. Temperature +dependence of aqueous and gaseous diffusion coefficients for CH4 and O2. +342Table 20.1. Crop plant functional types (pfts) in CLM4.5CNcrop and +their parameters relating to phenology and morphology. Numbers in the +first column correspond to the list of pfts in Table 2.1. 357Table 20.2. +Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. +Numbers in the first column correspond to the list of pfts in Table 2.1. +359Table 20.3. Pre- and post-grain fill C:N ratios for crop leaf, stem, +fine root, and reproductive pools. 367Table 22.1. Plant functional type +(PFT) biogeography rules with respect to climate. 385Table 24.1. Mass +fraction m\ :sub:`i` , mass median diameter :sub:`v, i` , and geometric +standard deviation :sub:`g, i` , per dust source mode i 392Table 24.2. +Minimum and maximum particle diameters in each dust transport bin j +392\ **** + +ACKNOWLEDGEMENTS + +The authors would like to acknowledge the substantial contributions of +the following members of the Land Model and Biogeochemistry Working +Groups to the development of the Community Land Model since its +inception in 1996: Benjamin Andre, Ian Baker, Michael Barlage, Mike +Bosilovich, Marcia Branstetter, Tony Craig, Aiguo Dai, Yongjiu Dai, Mark +Decker, Scott Denning, Robert Dickinson, Paul Dirmeyer, Jared Entin, Jay +Famiglietti, Johannes Feddema, Mark Flanner, Jon Foley, Andrew Fox, Inez +Fung, David Gochis, Alex Guenther, Tim Hoar, Forrest Hoffman, Paul +Houser, Trish Jackson, Brian Kauffman, Silvia Kloster, Natalie Mahowald, +Jiafu Mao, Lei Meng, Sheri Michelson, Guo-Yue Niu, Adam Phillips, Taotao +Qian, Jon Radakovich, James Randerson, Nan Rosenbloom, Steve Running, +Koichi Sakaguchi, Adam Schlosser, Andrew Slater, Reto Stöckli, Quinn +Thomas, Mariana Vertenstein, Nicholas Viovy, Aihui Wang, Guiling Wang, +Charlie Zender, Xiaodong Zeng, and Xubin Zeng. + +The authors also thank the following people for their review of this +document: Jonathan Buzan, Kyla Dahlin, Sanjiv Kumar, Hanna Lee, Danica +Lombardozzi, Quinn Thomas, and Will Wieder. + +Current affiliations for the authors are as follows: + +K.W. Oleson, D.M. Lawrence, G.B. Bonan, S. Levis, S.C. Swenson, R. +Fisher, E. Kluzek, J.-F. Lamarque, P.J. Lawrence, S. Muszala, and W. +Sacks (National Center for Atmospheric Research); B. Drewniak (Argonne +National Laboratory); M. Huang, L.R. Leung (Pacific Northwest National +Laboratory); C.D. Koven, W.J. Riley, and J. Tang (Lawrence Berkeley +National Laboratory); F. Li (Chinese Academy of Sciences); Z.M. Subin +(Princeton University); P.E. Thornton and D.M. Ricciuto (Oak Ridge +National Laboratory); A. Bozbiyik (Bern University); C. Heald +(Massachusetts Institute of Technology), W. Lipscomb (Los Alamos +National Laboratory); Ying Sun and Z.-L. Yang (University of Texas at +Austin) + +.. math:: 188 + +.. math:: 7 + +Introduction +=============== + +The purpose of this technical note is to describe the biogeophysical and +biogeochemical parameterizations and numerical implementation of version +4.5 of the Community Land Model (CLM4.5). Scientific justification and +evaluation of these parameterizations can be found in the referenced +scientific papers (Chapter 27). This technical note and the CLM4.5 +User’s Guide together provide the user with the scientific description +and operating instructions for CLM. + +Model History +--------------- + +Inception of CLM +^^^^^^^^^^^^^^^^^^^^^^ + +The early development of the Community Land Model can be described as +the merging of a community-developed land model focusing on +biogeophysics and a concurrent effort at NCAR to expand the NCAR Land +Surface Model (NCAR LSM, Bonan 1996) to include the carbon cycle, +vegetation dynamics, and river routing. The concept of a +community-developed land component of the Community Climate System Model +(CCSM) was initially proposed at the CCSM Land Model Working Group +(LMWG) meeting in February 1996. Initial software specifications and +development focused on evaluating the best features of three existing +land models: the NCAR LSM (Bonan 1996, 1998) used in the Community +Climate Model (CCM3) and the initial version of CCSM; the Institute of +Atmospheric Physics, Chinese Academy of Sciences land model (IAP94) (Dai +and Zeng 1997); and the Biosphere-Atmosphere Transfer Scheme (BATS) +(Dickinson et al. 1993) used with CCM2. A scientific steering committee +was formed to review the initial specifications of the design provided +by Robert Dickinson, Gordon Bonan, Xubin Zeng, and Yongjiu Dai and to +facilitate further development. Steering committee members were selected +so as to provide guidance and expertise in disciplines not generally +well-represented in land surface models (e.g., carbon cycling, +ecological modeling, hydrology, and river routing) and included +scientists from NCAR, the university community, and government +laboratories (R. Dickinson, G. Bonan, X. Zeng, Paul Dirmeyer, Jay +Famiglietti, Jon Foley, and Paul Houser). + +The specifications for the new model, designated the Common Land Model, +were discussed and agreed upon at the June 1998 CCSM Workshop LMWG +meeting. An initial code was developed by Y. Dai and was examined in +March 1999 by Mike Bosilovich, P. Dirmeyer, and P. Houser. At this point +an extensive period of code testing was initiated. Keith Oleson, Y. Dai, +Adam Schlosser, and P. Houser presented preliminary results of offline +1-dimensional testing at the June 1999 CCSM Workshop LMWG meeting. +Results from more extensive offline testing at plot, catchment, and +large scale (up to global) were presented by Y. Dai, A. Schlosser, K. +Oleson, M. Bosilovich, Zong-Liang Yang, Ian Baker, P. Houser, and P. +Dirmeyer at the LMWG meeting hosted by COLA (Center for +Ocean-Land-Atmosphere Studies) in November 1999. Field data used for +validation included sites adopted by the Project for Intercomparison of +Land-surface Parameterization Schemes (Henderson-Sellers et al. 1993) +(Cabauw, Valdai, Red-Arkansas river basin) and others [FIFE (Sellers et +al. 1988), BOREAS (Sellers et al. 1995), HAPEX-MOBILHY (André et al. +1986), ABRACOS (Gash et al. 1996), Sonoran Desert (Unland et al. 1996), +GSWP (Dirmeyer et al. 1999)]. Y. Dai also presented results from a +preliminary coupling of the Common Land Model to CCM3, indicating that +the land model could be successfully coupled to a climate model. + +Results of coupled simulations using CCM3 and the Common Land Model were +presented by X. Zeng at the June 2000 CCSM Workshop LMWG meeting. +Comparisons with the NCAR LSM and observations indicated major +improvements to the seasonality of runoff, substantial reduction of a +summer cold bias, and snow depth. Some deficiencies related to runoff +and albedo were noted, however, that were subsequently addressed. Z.-L. +Yang and I. Baker demonstrated improvements in the simulation of snow +and soil temperatures. Sam Levis reported on efforts to incorporate a +river routing model to deliver runoff to the ocean model in CCSM. Soon +after the workshop, the code was delivered to NCAR for implementation +into the CCSM framework. Documentation for the Common Land Model is +provided by Dai et al. (2001) while the coupling with CCM3 is described +in Zeng et al. (2002). The model was introduced to the modeling +community in Dai et al. (2003). + +CLM2 +^^^^^^^^^^ + +Concurrent with the development of the Common Land Model, the NCAR LSM +was undergoing further development at NCAR in the areas of carbon +cycling, vegetation dynamics, and river routing. The preservation of +these advancements necessitated several modifications to the Common Land +Model. The biome-type land cover classification scheme was replaced with +a plant functional type (PFT) representation with the specification of +PFTs and leaf area index from satellite data (Oleson and Bonan 2000; +Bonan et al. 2002a, b). This also required modifications to +parameterizations for vegetation albedo and vertical burying of +vegetation by snow. Changes were made to canopy scaling, leaf +physiology, and soil water limitations on photosynthesis to resolve +deficiencies indicated by the coupling to a dynamic vegetation model. +Vertical heterogeneity in soil texture was implemented to improve +coupling with a dust emission model. A river routing model was +incorporated to improve the fresh water balance over oceans. Numerous +modest changes were made to the parameterizations to conform to the +strict energy and water balance requirements of CCSM. Further +substantial software development was also required to meet coding +standards. The resulting model was adopted in May 2002 as the Community +Land Model (CLM2) for use with the Community Atmosphere Model (CAM2, the +successor to CCM3) and version 2 of the Community Climate System Model +(CCSM2). + +K. Oleson reported on initial results from a coupling of CCM3 with CLM2 +at the June 2001 CCSM Workshop LMWG meeting. Generally, the CLM2 +preserved most of the improvements seen in the Common Land Model, +particularly with respect to surface air temperature, runoff, and snow. +These simulations are documented in Bonan et al. (2002a). Further small +improvements to the biogeophysical parameterizations, ongoing software +development, and extensive analysis and validation within CAM2 and CCSM2 +culminated in the release of CLM2 to the community in May 2002. + +Following this release, Peter Thornton implemented changes to the model +structure required to represent carbon and nitrogen cycling in the +model. This involved changing data structures from a single vector of +spatially independent sub-grid patches to one that recognizes three +hierarchical scales within a model grid cell: land unit, snow/soil +column, and PFT. Furthermore, as an option, the model can be configured +so that PFTs can share a single soil column and thus “compete” for +water. This version of the model (CLM2.1) was released to the community +in February 2003. CLM2.1, without the compete option turned on, produced +only round off level changes when compared to CLM2. + +CLM3 +^^^^^^^^^^ + +CLM3 implemented further software improvements related to performance +and model output, a re-writing of the code to support vector-based +computational platforms, and improvements in biogeophysical +parameterizations to correct deficiencies in the coupled model climate. +Of these parameterization improvements, two were shown to have a +noticeable impact on simulated climate. A variable aerodynamic +resistance for heat/moisture transfer from ground to canopy air that +depends on canopy density was implemented. This reduced unrealistically +high surface temperatures in semi-arid regions. The second improvement +added stability corrections to the diagnostic 2-m air temperature +calculation which reduced biases in this temperature. Competition +between PFTs for water, in which PFTs share a single soil column, is the +default mode of operation in this model version. CLM3 was released to +the community in June 2004. Dickinson et al. (2006) describe the climate +statistics of CLM3 when coupled to CCSM3.0. Hack et al. (2006) provide +an analysis of selected features of the land hydrological cycle. +Lawrence et al. (2007) examine the impact of changes in CLM3 +hydrological parameterizations on partitioning of evapotranspiration +(ET) and its effect on the timescales of ET response to precipitation +events, interseasonal soil moisture storage, soil moisture memory, and +land-atmosphere coupling. Qian et al. (2006) evaluate CLM3’s performance +in simulating soil moisture content, runoff, and river discharge when +forced by observed precipitation, temperature and other atmospheric +data. + +CLM3.5 +^^^^^^^^^^^^ + +Although the simulation of land surface climate by CLM3 was in many ways +adequate, most of the unsatisfactory aspects of the simulated climate +noted by the above studies could be traced directly to deficiencies in +simulation of the hydrological cycle. In 2004, a project was initiated +to improve the hydrology in CLM3 as part of the development of CLM +version 3.5. A selected set of promising approaches to alleviating the +hydrologic biases in CLM3 were tested and implemented. These included +new surface datasets based on Moderate Resolution Imaging +Spectroradiometer (MODIS) products, new parameterizations for canopy +integration, canopy interception, frozen soil, soil water availability, +and soil evaporation, a TOPMODEL-based model for surface and subsurface +runoff, a groundwater model for determining water table depth, and the +introduction of a factor to simulate nitrogen limitation on plant +productivity. Oleson et al. (2008a) show that CLM3.5 exhibits +significant improvements over CLM3 in its partitioning of global ET +which result in wetter soils, less plant water stress, increased +transpiration and photosynthesis, and an improved annual cycle of total +water storage. Phase and amplitude of the runoff annual cycle is +generally improved. Dramatic improvements in vegetation biogeography +result when CLM3.5 is coupled to a dynamic global vegetation model. +Stöckli et al. (2008) examine the performance of CLM3.5 at local scales +by making use of a network of long-term ground-based ecosystem +observations [FLUXNET (Baldocchi et al. 2001)]. Data from 15 FLUXNET +sites were used to demonstrate significantly improved soil hydrology and +energy partitioning in CLM3.5. CLM3.5 was released to the community in +May, 2007. + +CLM4 +^^^^^^^^^^ + +The motivation for the next version of the model, CLM4, was to +incorporate several recent scientific advances in the understanding and +representation of land surface processes, expand model capabilities, and +improve surface and atmospheric forcing datasets (Lawrence et al. 2011). +Included in the first category are more sophisticated representations of +soil hydrology and snow processes. In particular, new treatments of soil +column-groundwater interactions, soil evaporation, aerodynamic +parameters for sparse/dense canopies, vertical burial of vegetation by +snow, snow cover fraction and aging, black carbon and dust deposition, +and vertical distribution of solar energy for snow were implemented. +Major new capabilities in the model include a representation of the +carbon-nitrogen cycle (CLM4CN, see next paragraph for additional +information), the ability to model land cover change in a transient +mode, inclusion of organic soil and deep soil into the existing mineral +soil treatment to enable more realistic modeling of permafrost, an urban +canyon model to contrast rural and urban energy balance and climate +(CLMU), and an updated biogenic volatile organic compounds (BVOC) model. +Other modifications of note include refinement of the global PFT, +wetland, and lake distributions, more realistic optical properties for +grasslands and croplands, and an improved diurnal cycle and spectral +distribution of incoming solar radiation to force the model in offline +mode. + +Many of the ideas incorporated into the carbon and nitrogen cycle +component of CLM4 derive from the earlier development of the offline +ecosystem process model Biome-BGC (Biome BioGeochemical Cycles), +originating at the Numerical Terradynamic Simulation Group (NTSG) at the +University of Montana, under the guidance of Prof. Steven Running. +Biome-BGC itself is an extension of an earlier model, Forest-BGC +**(Running and Coughlan, 1988; Running and Gower, 1991)**, which +simulates water, carbon, and, to a limited extent, nitrogen fluxes for +forest ecosystems. Forest-BGC was designed to be driven by remote +sensing inputs of vegetation structure, and so used a diagnostic +(prescribed) leaf area index, or, in the case of the dynamic allocation +version of the model **(Running and Gower, 1991)**, prescribed maximum +leaf area index. + +Biome-BGC expanded on the Forest-BGC logic by introducing a more +mechanistic calculation of leaf and canopy scale photosynthesis **(Hunt +and Running, 1992)**, and extending the physiological parameterizations +to include multiple woody and non-woody vegetation types **(Hunt et al. +1996; Running and Hunt, 1993)**. Later versions of Biome-BGC introduced +more mechanistic descriptions of belowground carbon and nitrogen cycles, +nitrogen controls on photosynthesis and decomposition, sunlit and shaded +canopies, vertical gradient in leaf morphology, and explicit treatment +of fire and harvest disturbance and regrowth dynamics **(Kimball et al. +1997; Thornton, 1998; Thornton et al. 2002; White et al. 2000)**. +Biome-BGC version 4.1.2 **(Thornton et al. 2002)** provided a point of +departure for integrating new biogeochemistry components into CLM4. + +CLM4 was released to the community in June, 2010 along with the +Community Climate System Model version 4 (CCSM4). CLM4 is used in CCSM4, +CESM1, CESM1.1, and remains available as the default land component +model option for coupled simulations in CESM1.2. + +CLM4.5 +^^^^^^^^^^^^ + +The motivations for the development of CLM4.5 (the model version +described in this Technical Description) were similar to those for CLM4: +incorporate several recent scientific advances in the understanding and +representation of land surface processes, expand model capabilities, and +improve surface and atmospheric forcing datasets. + +Specifically, several parameterizations were revised to reflect new +scientific understanding and in an attempt to reduce biases identified +in CLM4 simulations including low soil carbon stocks especially in the +Arctic, excessive tropical GPP and unrealistically low Arctic GPP, a dry +soil bias in Arctic soils, unrealistically high LAI in the tropics, a +transient 20\ :math:`{}^{th}` century carbon response that was +inconsistent with observational estimates, and several other more minor +problems or biases. + +The main modifications include updates to canopy processes including a +revised canopy radiation scheme and canopy scaling of leaf processes, +co-limitations on photosynthesis, revisions to photosynthetic parameters +(Bonan et al. 2011), **** temperature acclimation of photosynthesis, and +improved stability of the iterative solution in the photosynthesis and +stomatal conductance model (Sun et al. 2012). Hydrology updates include +modifications such that hydraulic properties of frozen soils are +determined by liquid water content only rather than total water content +and the introduction of an ice impedance function, and other corrections +that increase the consistency between soil water state and water table +position and allow for a perched water table above icy permafrost ground +(Swenson et al. 2012). A new snow cover fraction parameterization is +incorporated that reflects the hysteresis in fractional snow cover for a +given snow depth between accumulation and melt phases (Swenson and +Lawrence, 2012). The lake model in CLM4 is replaced with a completely +revised and more realistic lake model (Subin et al. 2012a). A surface +water store is introduced, replacing the wetland land unit and +permitting prognostic wetland distribution modeling, and the surface +energy fluxes are calculated separately (Swenson and Lawrence, 2012) for +snow-covered, water-covered, and snow/water-free portions of vegetated +and crop land units, and snow-covered and snow-free portions of glacier +land units. Globally constant river flow velocity is replaced with +variable flow velocity based on mean grid cell slope. A vertically +resolved soil biogeochemistry scheme is introduced with base +decomposition rates modified by soil temperature, water, and oxygen +limitations and also including vertical mixing of soil carbon and +nitrogen due to bioturbation, cryoturbation, and diffusion (Koven et al. +2013). The litter and soil carbon and nitrogen pool structure as well as +nitrification and denitrification are modified based on the Century +model and biological fixation is revised to distribute fixation more +realistically over the year (Koven et al. 2013). The fire model is +replaced with a model that includes representations of natural and +anthropogenic triggers and suppression as well as agricultural, +deforestation, and peat fires (Li et al. 2012a,b; Li et al. 2013a). The +biogenic volatile organic compounds model is updated to MEGAN2.1 +(Guenther et al. 2012). + +Additions to the model include a methane production, oxidation, and +emissions model (Riley et al. 2011a) and an extension of the crop model +to include interactive fertilization, organ pools (Drewniak et al. +2013), and irrigation (Sacks et al. 2009). Elements of the Variable +Infiltration Capacity (VIC) model are included as an alternative +optional runoff generation scheme (Li et al. 2011). There is also an +option to run with a multilayer canopy (Bonan et al. 2012). Multiple +urban density classes, rather than the single dominant urban density +class used in CLM4, are modeled in the urban land unit. Carbon +(:math:`{}^{13}`\ C and :math:`{}^{14}`\ C) isotopes are enabled (Koven +et al. 2013). Minor changes include a switch of the C3 Arctic grass and +shrub phenology from stress deciduous to seasonal deciduous and a change +in the glacier bare ice albedo to better reflect recent estimates. +Finally, the carbon and nitrogen cycle spinup is accelerated and +streamlined with a revised spinup method, though the spinup timescale +remains long. + +Finally, the predominantly low resolution input data for provided with +CLM4 to create CLM4 surface datasets is replaced with newer and higher +resolution input datasets where possible (see section 2.2.3 for +details). The default meteorological forcing dataset provided with CLM4 +(Qian et al. 2006) is replaced with the 1901-2010 CRUNCEP forcing +dataset (see Chapter 26) for CLM4.5, though users can also still use the +Qian et al. (2006) dataset or other alternative forcing datasets. + +CLM4.5 was released to the community in June 2013 along with the +Community Earth System Model version 1.2 (CESM1.2). + +Biogeophysical and Biogeochemical Processes +----------------------------------------------- + +Biogeophysical and biogeochemical processes are simulated for each +subgrid land unit, column, and plant functional type (PFT) independently +and each subgrid unit maintains its own prognostic variables (see +section 2.1.1 for definitions of subgrid units). The same atmospheric +forcing is used to force all subgrid units within a grid cell. The +surface variables and fluxes required by the atmosphere are obtained by +averaging the subgrid quantities weighted by their fractional areas. The +processes simulated include (Figure 1.1): + +#. Surface characterization including land type heterogeneity and + ecosystem structure (Chapter 2) + +#. Absorption, reflection, and transmittance of solar radiation (Chapter + 3, 4) + +#. Absorption and emission of longwave radiation (Chapter 4) + +#. Momentum, sensible heat (ground and canopy), and latent heat (ground + evaporation, canopy evaporation, transpiration) fluxes (Chapter 5) + +#. Heat transfer in soil and snow including phase change (Chapter 6) + +#. Canopy hydrology (interception, throughfall, and drip) (Chapter 7) + +#. Snow hydrology (snow accumulation and melt, compaction, water + transfer between snow layers) (Chapter 7) + +#. Soil hydrology (surface runoff, infiltration, redistribution of water + within the column, sub-surface drainage, groundwater) (Chapter 7) + +#. Stomatal physiology and photosynthesis (Chapter 8) + +#. place Lake temperatures and fluxes (Chapter 9) + +#. Glacier processes (Chapter 10) + +#. Routing of runoff from rivers to ocean (Chapter 11) + +#. Urban energy balance and climate (Chapter 12) + +#. Vegetation carbon and nitrogen allocation and respiration (Chapter + 13) + +#. Vegetation phenology (Chapter 14) + +#. Soil and litter carbon decomposition (Chapter 15) + +#. Nitrogen cycling including deposition, biological fixation, + denitrification, leaching, and losses due to fire (Chapter 16) + +#. Plant mortality (Chapter 17) + +#. Fire ignition and suppression, including natural, deforestation, and + agricultural fire (Chapter 18) + +#. Methane production, oxidation, and emissions (Chapter 19) + +#. Crop dynamics and irrigation (Chapter 20) + +#. Land cover and land use change including wood harvest (Chapter 21) + +#. Dynamic global vegetation distribution (Chapter 22) + +#. Biogenic volatile organic compound emissions (Chapter 23) + +#. Dust mobilization and deposition (Chapter 24) + +#. Carbon isotope fractionation (Chapter 25) + +Figure 1.1. Land biogeophysical, biogeochemical, and landscape processes +simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). + +**|image|** + +.. |image| image:: image1 diff --git a/doc/source/tech_note/CHAPTER_10/CLM45_Tech_Note_Chpt_10_Glacier.rst b/doc/source/tech_note/CHAPTER_10/CLM45_Tech_Note_Chpt_10_Glacier.rst new file mode 100644 index 0000000000..9bd3e1e11d --- /dev/null +++ b/doc/source/tech_note/CHAPTER_10/CLM45_Tech_Note_Chpt_10_Glacier.rst @@ -0,0 +1,169 @@ +Glaciers +============ + +This chapter describes features of CLM that are specific to coupling to +an ice sheet model (in the CESM context, this is the Glimmer-CISM model; +Lipscomb and Sacks (2012) provide documentation and user’s guide for +Glimmer-CISM). General information about glacier land units can be found +elsewhere in this document (see Chapter 2 for an overview). + +Overview +------------- + +CLM is responsible for computing three quantities that are passed to the +ice sheet model: + +#. Surface mass balance (SMB) – the net annual accumulation/ablation of + mass at the upper surface (section 10.3) + +#. Ground surface temperature, which serves as an upper boundary + condition for Glimmer-CISM’s temperature calculation + +#. Surface topography, which currently is fixed in time, and is provided + on CLM’s surface dataset + +The ice sheet model is typically run at much higher resolution than CLM +(e.g., :math:`\sim`\ 5 km rather than :math:`\sim`\ 100 km). To improve +the downscaling from CLM’s grid to the ice sheet grid, the glaciated +portion of each grid cell is divided into multiple elevation classes +(section 10.2). The above quantities are computed separately in each +elevation class. Glimmer-CISM then computes high-resolution quantities +via horizontal and vertical interpolation. + +There are several reasons for computing the SMB in CLM rather than in +Glimmer-CISM: + +#. It is much cheaper to compute the SMB in CLM for :math:`\sim`\ 10 + elevation classes than in Glimmer-CISM. For example, suppose we are + running CLM at a resolution of :math:`\sim`\ 50 km and Glimmer at + :math:`\sim`\ 5 km. Greenland has dimensions of about 1000 x 2000 km. + For CLM we would have 20 x 40 x 10 = 8,000 columns, whereas for + Glimmer we would have 200 x 400 = 80,000 columns. + +#. We can use the sophisticated snow physics parameterization already in + CLM instead of implementing a separate scheme for Glimmer-CISM. Any + improvements to the CLM are applied to ice sheets automatically. + +#. The atmosphere model can respond during runtime to ice-sheet surface + changes. As shown by Pritchard et al. (2008), runtime albedo feedback + from the ice sheet is critical for simulating ice-sheet retreat on + paleoclimate time scales. Without this feedback the atmosphere warms + much less, and the retreat is delayed. + +#. Mass is more nearly conserved, given that the rate of surface ice + growth or melting computed in CLM is equal to the rate seen by the + dynamic ice sheet model. (Mass conservation is not exact, however, + because of approximations made in interpolating from the CLM grid to + the ice-sheet grid.) + +#. The improved SMB is available in CLM for all glaciated grid cells + (e.g., in the Alps, Rockies, Andes, and Himalayas), not just those + which are part of ice sheets. + +The current coupling between CLM and Glimmer-CISM is one-way only. That +is, CLM sends the SMB and surface temperature to Glimmer-CISM but does +not do anything with the fields that are returned. The CLM glacier +fraction and surface topography are therefore fixed in time. One-way +coupling is reasonable for runs of :math:`\sim`\ 100 years or less, in +which ice-sheet elevation changes are modest. For longer runs with +larger elevation changes, two-way coupling is highly desirable. A +two-way coupling scheme is under development. + +Multiple elevation class scheme +------------------------------------ + +In the typical operation of CLM, the glacier land unit contains a single +column (section 2.1.1). However, when running CESM with an active ice +sheet model, the glacier land unit is replaced by a glacier\_mec land +unit, where “mec” denotes “multiple elevation classes”. In most ways, +glacier\_mec land units behave the same as standard glacier land units. +However, each glacier\_mec land unit is divided into a user-defined set +of columns based on surface elevation. The default is 10 elevation +classes whose lower limits are 0, 200, 400, 700, 1000, 1300, 1600, 2000, +2500, and 3000 m. Each column is characterized by a fractional area and +surface elevation that are read in during model initialization. Each +glacier\_mec column within a grid cell has distinct ice and snow +temperatures, snow water content, surface fluxes, and SMB. + +Glacier\_mec columns, like glacier columns, are initialized with a +temperature of 250 K. While glacier columns are initialized with a snow +liquid water equivalent (LWE) equal to the maximum allowed value of 1 m, +glacier\_mec columns begin with a snow LWE of 0.5 m so that they will +reach their equilibrium mean snow depth sooner. Glacier\_mec columns +typically require several decades of spin-up to equilibrate with a given +climate. + +The atmospheric surface temperature, potential temperature, specific +humidity, density, and pressure are downscaled from the mean grid cell +elevation to the glacier\_mec column elevation using a specified lapse +rate (typically 6.0 deg/km) and an assumption of uniform relative +humidity. At a given time, lower-elevation columns can undergo surface +melting while columns at higher elevations remain frozen. This gives a +more accurate simulation of summer melting, which is a highly nonlinear +function of air temperature. The precipitation rate and radiative fluxes +are not currently downscaled, but could be in the future if care were +taken to preserve the cell-integrated values. + +In contrast to most CLM subgrid units, glacier\_mec columns can be +active (i.e., have model calculations run there) even if their area is +zero. This is done because the ice sheet model may require a SMB even +for some grid cells where CLM does not have glacier land units. To allow +for this, grid overlap files have been pre-computed. For given +resolutions of CLM and Glimmer-CISM, these files identify all +land-covered grid cells that overlap any part of the ice sheet grid. In +these overlapping cells, glacier\_mec columns are defined in all +elevation classes. Some columns may have zero area and are called +“virtual” columns. These columns do not affect energy exchange between +the land and the atmosphere, but are included for potential forcing of +Glimmer-CISM. + +Computation of the surface mass balance +-------------------------------------------- + +The SMB of a glacier or ice sheet is the net annual +accumulation/ablation of mass at the upper surface. Ablation is defined +as the mass of water that runs off to the ocean. Not all the surface +meltwater runs off; some of the melt percolates into the snow and +refreezes. Accumulation is primarily by snowfall and deposition, and +ablation is primarily by melting and evaporation/sublimation. CLM uses a +surface-energy-balance (SEB) scheme to compute the SMB. In this scheme, +the melting depends on the sum of the radiative, turbulent, and +conductive fluxes reaching the surface, as described elsewhere in this +document. + +CLM has a somewhat unrealistic treatment of accumulation and melting for +standard glacier land units. The snow depth is limited to a prescribed +depth of 1 m liquid water equivalent, with any additional snow assumed +to run off to the ocean. (This amounts to a crude parameterization of +iceberg calving.) Snow melting is treated in a realistic fashion, with +meltwater percolating downward through snow layers as long as the snow +is unsaturated. Once the underlying snow is saturated, any additional +meltwater runs off. When glacier ice melts, however, the meltwater is +assumed to remain in place until it refreezes. In warm parts of the ice +sheet, the meltwater does not refreeze, but stays in place indefinitely. + +In the modified glacier\_mec columns, the treatment of melting and +freezing depends on the logical variable *glc\_dyntopo*. This variable +controls whether CLM surface topography changes dynamically as the ice +sheet evolves (i.e., whether the coupling is one-way or two-way). If +*glc\_dyntopo* is true, then CLM receives updated topographic +information from the ice sheet model. In this case, snow in excess of +the prescribed maximum depth is assumed to turn into ice, contributing a +positive SMB to the ice sheet model. Melting ice is assumed to run off +to the ocean, giving a negative SMB. The net SMB associated with ice +formation (by conversion from snow) and melting/runoff is computed for +each column, averaged over the coupling interval, and sent to the +coupler (*qice, mm/s*). If *glc\_dyntopo* is false, then surface runoff +for glacier\_mec land units is computed as for glacier land units: Any +snow in excess of 1 m LWE runs off to the ocean, and Melted ice remains +in place until it refreezes. Excess snow and melted ice still contribute +to positive and negative values, respectively, of *qice*, but only for +the purpose of forcing Glimmer-CISM. Currently, *glc\_dyntopo* = false +is the default, and the only supported option. + +Note that the SMB typically is defined as the total accumulation of ice +and snow, minus the total ablation. The *qice* flux passed to +Glimmer-CISM is the mass balance for ice alone, not snow. We can think +of CLM as owning the snow, whereas Glimmer-CISM owns the underlying ice. +Fluctuations in snow depth between 0 and 1 m LWE are not reflected in +the SMB passed to Glimmer-CISM. diff --git a/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst b/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst new file mode 100644 index 0000000000..2f1fd04e7b --- /dev/null +++ b/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst @@ -0,0 +1,139 @@ +River Transport Model (RTM) +=============================== + +The RTM was developed to route total runoff from the land surface model +to either the active ocean or marginal seas which enables the hydrologic +cycle to be closed (Branstetter 2001, Branstetter and Famiglietti 1999). +This is needed to model ocean convection and circulation, which is +affected by freshwater input. It also provides another method of +diagnosing the performance of the land model because the river flow can +be directly compared to gauging station data (e.g., Dai and Trenberth +2002). + +To improve global energy conservation when CLM is being run as part of +the Community Climate System Model, runoff is split into two streams, a +liquid water stream and an ice water stream (derived from excess +snowfall in snow-capped grid cells, section 7.7). The liquid and ice +streams are routed through the RTM, passed to, and dealt with by the +ocean separately. + +The RTM uses a linear transport scheme to route water from each grid +cell to its downstream neighboring grid cell. The change in storage +:math:`S` of river water, whether it be liquid or ice, within a RTM grid +cell (m\ :math:`{}^{3}` s\ :math:`{}^{-1}`) is + +.. math:: + :label: ZEqnNum723341 + + \frac{dS}{dt} =\sum F_{in} -F_{out} +R + +where :math:`\sum F_{in}` is the sum of inflows of water from +neighboring upstream grid cells (m\ :math:`{}^{3}` s\ :math:`{}^{-1}`), +:math:`F_{out}` is the flux of water leaving the grid cell in the +downstream direction (m :math:`{}^{3}` s\ :math:`{}^{-1}`), and :math:`R` +is the total runoff generated by the land model grid cell +(m\ :math:`{}^{3}` s\ :math:`{}^{-1}`). Downstream water flow direction in +each grid cell is determined as one of eight compass points (north, +northeast, east, southeast, south, southwest, west, and northwest) based +on the steepest downhill slope as determined from a digital elevation +model (Graham et al. 1999). The flux of water leaving the grid cell +:math:`F_{out}` is + +.. math:: + :label: 11.2) + + F_{out} =\frac{v}{d} S + +where :math:`v` is the effective water flow velocity (m +s\ :math:`{}^{-1}`), :math:`d` is the distance between centers of +neighboring grid cells (m), and :math:`S` is the volume of river water +stored within the grid cell (m\ :math:`{}^{3}`). The effective water flow +velocity can be estimated from Manning’s equation, which is a function +of surface water slope, the hydraulic radius of the river channel, and a +channel roughness coefficient (Dingman, 2002). However, hydraulic radius +and channel roughness data are not available globally, so a simplified +effective flow velocity expression is used in RTM + +.. math:: + :label: 11.2) + + v=\max \left(0.05,k\beta ^{1/2} \right) + +where :math:`\beta` is the grid cell mean topographic slope, and +:math:`k=1`. + +The distance :math:`d` between two grid cell centers depends on river +direction, latitude, and longitude as + +.. math:: + :label: 11.3) + + d=\sqrt{\Delta x^{2} +\Delta y^{2} } . + +The distance in the zonal direction :math:`\Delta x` (m) is + +.. math:: + :label: 11.4) + + \Delta x=\left(1\times 10^{3} \left|\theta _{i,\, j} -\theta _{i*,\, j*} \right|R_{e} \right)\left[0.5\left(\cos \phi _{i,\, j} +\cos \phi _{i*,\, j*} \right)\right] + +where :math:`\theta _{i,\, j}` and :math:`\theta _{i*,\, j*}` are the +latitudes (radians) of the upstream and downstream grid cells, +:math:`\phi _{i,\, j}` and :math:`\phi _{i*,\, j*}` are the longitudes +(radians) of the upstream and downstream grid cells, :math:`R_{e}` is +the radius of the earth (km) (Table 2.6), and :math:`i` and :math:`j` +are grid cell indices. The distance in the meridional direction +:math:`\Delta y` (m) is + +.. math:: + :label: 11.5) + + \Delta y=\left(1\times 10^{3} \left|\theta _{i,\, j} -\theta _{i*,\, j*} \right|R_{e} \right). + +The RTM is generally run at a time step greater than that of the CLM +because of computational constraints. The total runoff from the land +model at each time step is accumulated until the RTM is invoked. The +total liquid water runoff at the land model resolution (kg +m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is + +.. math:: + :label: 11.6) + + R_{liq} =q_{over} +q_{drai} +q_{rgwl} + +where :math:`q_{over}` is surface runoff (section 7.3), +:math:`q_{drai}` is sub-surface drainage (section 7.6), and +:math:`q_{rgwl}` is liquid runoff from glaciers, wetlands, and lakes +(all in kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) (sections 7.7 and +9.6.3). The total ice water runoff, also at the land model resolution is + +.. math:: + :label: 11.7) + + R_{ice} =q_{snwcp,ice} + +where :math:`q_{snwcp,ice}` is the ice runoff from snow-capped +surfaces (section 7.7). The runoff at the land model resolution is +interpolated to the resolution of RTM and converted to units of +m\ :math:`{}^{3}` s\ :math:`{}^{-1}` for use in equation by multiplying +by :math:`1\times 10^{-3} A` where :math:`A` is the area +(m\ :math:`{}^{2}`) of the RTM grid cell. + +The RTM grid cells that are at river mouths, hence providing freshwater +flux to the ocean, are identified by examining each RTM ocean grid cell +and determining if a RTM land grid cell flows to that ocean grid cell. +River mouth grid cells are also assigned if any overlapping grid cells +at the land model resolution contain land. When used as part of the +Community Climate System Model, the ocean freshwater liquid and ice +fluxes at the RTM resolution are passed to the flux coupler which +distributes the fluxes to the appropriate ocean grid cells. When used +with the Community Atmosphere Model or when run offline, RTM serves only +as a diagnostic tool. The river-routing scheme conserves water globally +as + +.. math:: + :label: 11.8) + + \sum _{i,\, j}\left(\frac{dS}{dt} \right) _{i,\, j} =\sum _{i,\, j}R_{i,\, j} . + + diff --git a/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst b/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst new file mode 100644 index 0000000000..f4e74d3731 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst @@ -0,0 +1,130 @@ +Urban Model (CLMU) +====================== + +At the global scale, and at the coarse spatial resolution of current +climate models, urbanization has negligible impact on climate. However, +the urban parameterization (CLMU; Oleson et al. 2008b,c) allows +simulation of the urban environment within a climate model, and +particularly the temperature where people live. As such, the urban model +allows scientific study of how climate change affects the urban heat +island and possible urban planning and design strategies to mitigate +warming (e.g., white roofs). + +The urban model that was released as a component of CLM4.0 is separately +described in the urban technical note (Oleson et al. 2010b). Here, we +provide a brief overview of the urban model released as a component of +CLM4.5. The main changes in the urban model from CLM4.0 to CLM4.5 are 1) +an expansion of the single urban landunit to up to three landunits per +grid cell stratified by urban density types, 2) the number of urban +layers for roofs and walls is no longer constrained to be equal to the +number of ground layers, 3) space heating and air conditioning wasteheat +factors are now set to zero by default so that the user can customize +these factors for their own application, 4) the elevation threshold used +to eliminate urban areas in the surface dataset creation routines has +been changed from 2200 meters to 2600 meters, 5) hydrologic and thermal +calculations for the pervious road now follows CLM4.5 parameterizations. + +Urban areas in CLM are represented by up to three urban landunits per +gridcell according to density class. The urban landunit is based on the +“urban canyon” concept of Oke (1987) in which the canyon geometry is +described by building height (:math:`H`) and street width (:math:`W`) +(Figure 12.1). The canyon system consists of roofs, walls, and canyon +floor. Walls are further divided into shaded and sunlit components. The +canyon floor is divided into pervious (e.g., to represent residential +lawns, parks) and impervious (e.g., to represent roads, parking lots, +sidewalks) fractions. Vegetation is not explicitly modeled for the +pervious fraction; instead evaporation is parameterized by a simplified +bulk scheme. + +Each of the five urban surfaces is treated as a column within the +landunit (Figure 12.1). Radiation parameterizations account for trapping +of solar and longwave radiation inside the canyon. Momentum fluxes are +determined for the urban landunit using a roughness length and +displacement height appropriate for the urban canyon and stability +formulations from CLM. A one-dimensional heat conduction equation is +solved numerically for a multiple-layer (:math:`N_{levurb} =5`) column +to determine conduction fluxes into and out of canyon surfaces. The +interior boundary conditions for roofs and walls are determined by an +interior building temperature (:math:`T_{iB}` ) held between prescribed +maximum and minimum temperatures +(:math:`T_{iB,\, \max } ,\, T_{iB,\, \min }` ), thus explicitly +resolving space heating and air conditioning fluxes. Anthropogenic +sources of waste heat (:math:`Q_{H,\, waste}` ) from air conditioning +and space heating can be optionally incorporated as modifications to the +canyon energy budget. Turbulent [sensible heat (:math:`Q_{H,\, u}` ) and +latent heat (:math:`Q_{E,\, u}` )] and storage (:math:`Q_{S,\, u}` ) +heat fluxes and surface (:math:`T_{u,\, s}` ) and internal +(:math:`T_{u,\, i=1,\, N_{levgrnd} }` ) temperatures are determined for +each urban surface :math:`u`. Hydrology on the roof and canyon floor is +simulated and walls are hydrologically inactive. A snowpack can form on +the active surfaces. A certain amount of liquid water is allowed to pond +on these surfaces which supports evaporation. Water in excess of the +maximum ponding depth runs off +(:math:`R_{roof} ,\, R_{imprvrd} ,\, R_{prvrd}` ). + +The heat and moisture fluxes from each surface interact with each other +through a bulk air mass that represents air in the urban canopy layer +for which specific humidity (:math:`q_{ac}` ) and temperature +(:math:`T_{ac}` ) are prognosed (Figure 12.2). The air temperature can +be compared with that from surrounding vegetated/soil (rural) surfaces +in the model to ascertain heat island characteristics. As with other +landunits, the CLMU is forced either with output from a host atmospheric +model (e.g., the Community Atmosphere Model (stocktickerCAM)) or +observed forcing (e.g., reanalysis or field observations). The urban +model produces sensible, latent heat, and momentum fluxes, emitted +longwave, and reflected solar radiation, which are area-averaged with +fluxes from non-urban “landunits” (e.g., vegetation, lakes) to supply +grid cell averaged fluxes to the atmospheric model. + +Present day global urban extent and urban properties were developed by +Jackson et al. (2010). Urban extent, defined for four classes [tall +building district (TBD), and high, medium, and low density (HD, MD, +LD)], was derived from LandScan 2004, a population density dataset +derived from census data, nighttime lights satellite observations, road +proximity, and slope (Dobson et al. 2000). The urban extent data for +TBD, HD, and MD classes are aggregated from the original 1 km resolution +to both a 0.05\ :math:`{}^\circ` by 0.05\ :math:`{}^\circ` global grid +for high-resolution studies or a 0.5\ :math:`{}^\circ` by +0.5\ :math:`{}^\circ` grid. For the current implementation, the LD class +is not used because it is highly rural and better modeled as a +vegetated/soil surface. Although the TBD, HD, and MD classes are +represented as individual urban landunits, urban model history output is +currently a weighted average of the output for individual classes. + +For each of 33 distinct regions across the globe, thermal (e.g., heat +capacity and thermal conductivity), radiative (e.g., albedo and +emissivity) and morphological (e.g., height to width ratio, roof +fraction, average building height, and pervious fraction of the canyon +floor) properties are provided for each of the density classes. Building +interior minimum and maximum temperatures are prescribed based on +climate and socioeconomic considerations. The surface dataset creation +routines (see CLM4.5 User’s Guide) aggregate the data to the desired +resolution. + +Figure 12.1. Schematic representation of the urban land unit. + +See the text for description of notation. Incident, reflected, and net +solar and longwave radiation are calculated for each individual surface +but are not shown for clarity. + +.. image:: image1.png + +Figure 12.2. Schematic of urban and atmospheric model coupling. + +The urban model is forced by the atmospheric model wind +(:math:`u_{atm}` ), temperature (**:math:`T_{atm}` **), specific +humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar +(:math:`S_{atm} \, \downarrow` ) and longwave +(:math:`L_{atm} \, \downarrow` ) radiation at reference height +:math:`z'_{atm}` (section 2.2.1). Fluxes from the urban landunit to the +atmosphere are turbulent sensible (:math:`H`) and latent heat +(:math:`\lambda E`), momentum (:math:`\tau` ), albedo + +(:math:`I\uparrow` ), emitted longwave (:math:`L\uparrow` ), and +absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature + +(:math:`T_{ac}` ), specific humidity (:math:`q_{ac}` ), and wind speed +(:math:`u_{c}` ) within the urban canopy layer are diagnosed by the +urban model. :math:`H` is the average building height. + +.. image:: image2.png diff --git a/doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst b/doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst new file mode 100644 index 0000000000..c4a4ab2345 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst @@ -0,0 +1,599 @@ +Carbon and Nitrogen Pools, Allocation, and Respiration +========================================================== + +Introduction +----------------- + +CLM includes a fully-prognostic treatment of the terrestrial carbon and +nitrogen cycles including interactions between these cycles as mediated +by biological mechanisms of plants and soil heterotrophs. The model is +fully prognostic with respect to all carbon and nitrogen state variables +in the vegetation, litter, and soil organic matter. The seasonal timing +of new vegetation growth and litterfall is also prognostic, responding +to soil and air temperature, soil water availability, and daylength, in +varying degrees depending on a specified phenology type for each PFT +(see Chapter 14). The prognostic LAI, SAI, and vegetation heights are +utilized by the biophysical model. + +Separate state variables for C and N are tracked for leaf, live stem, +dead stem, live coarse root, dead coarse root, and fine root pools +(Figure 13.1 and 13.2). Each of these pools has two corresponding +storage pools representing, respectively, short-term and long-term +storage of non-structural carbohydrates and labile nitrogen. There are +two additional carbon pools, one for the storage of growth respiration +reserves, and another used to meet excess demand for maintenance +respiration during periods with low photosynthesis. One additional +nitrogen pool tracks retranslocated nitrogen, mobilized from leaf tissue +prior to abscission and litterfall. Altogether there are 20 state +variables for vegetation carbon, and 19 for vegetation nitrogen. + +Figure 13.1. Vegetation fluxes and pools. + +.. image:: image1.png + :width: 800px + :height: 800px + +Figure 13.2: Carbon and nitrogen pools. + +.. image:: image2.png + :width: 400px + :height: 400px + +Carbon Allocation for Maintenance Respiration Costs +-------------------------------------------------------- + +The carbon and nitrogen allocation routines in CLM determine the fate of +newly assimilated carbon, coming from the calculation of photosynthesis, +and available mineral nitrogen, coming from plant uptake of mineral +nitrogen in the soil or being drawn out of plant reserves. Allocation +fluxes are determined in three steps: first :math:`CF_{GPPpot}` is +used to evaluate the potential allocation of carbon and nitrogen +assuming an unlimited nitrogen supply, then the actual nitrogen supply +is compared against the demand, and finally allocation of carbon and +nitrogen are reduced, if necessary, to match nitrogen supply and demand. + +Allocation of available carbon on each time step is prioritized, with +first priority given to the demand for carbon to support maintenance +respiration of live tissues (section 13.7). Second priority is to +replenish the internal plant carbon pool that supports maintenance +respiration during times when maintenance respiration exceeds +photosynthesis (e.g. at night, during winter for perennial vegetation, +or during periods of drought stress) (Sprugel et al., 1995). Third +priority is to support growth of new tissues, including allocation to +storage pools from which new growth will be displayed in subsequent time +steps. + +The total maintenance respiration demand (:math:`CF_{mr}`, gC +m\ :sup:`-2` s\ :math:`{}^{-1}`) is calculated as a function of +tissue mass and nitrogen concentration, and temperature (section 13.7). +The carbon supply to support this demand is composed of fluxes allocated +from carbon assimilated in the current timestep +(:math:`CF_{GPP,mr}`, gC m\ :sup:`-2` s\ :math:`{}^{-1}`) +and from a storage pool that is drawn down when total demand exceeds +photosynthesis ( :math:`CF_{xs,mr}`, gC m\ :sup:`-2` +s\ :math:`{}^{-1}`): + +.. math:: + :label: 13.1) + + CF_{mr} =CF_{GPP,mr} +CF_{xs,mr} + +.. math:: + :label: 13.2) + + CF_{GPP,mr} =\_ \left\{\begin{array}{l} {CF_{mr} \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. + +.. math:: + :label: 13.3) + + CF_{xs,mr} =\_ \left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{mr} -CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. + +The storage pool that supplies carbon for maintenance respiration in +excess of current :math:`CF_{GPPpot}` ( :math:`CS_{xs}`, gC +m\ :sup:`-2`) is permitted to run a deficit (negative state), and +the magnitude of this deficit determines an allocation demand which +gradually replenishes :math:`CS_{xs}`. The logic for allowing a +negative state for this pool is to eliminate the need to know in advance +what the total maintenance respiration demand will be for a particular +combination of climate and plant type. Using the deficit approach, the +allocation to alleviate the deficit increases as the deficit increases, +until the supply of carbon into the pool balances the demand for carbon +leaving the pool in a quasi-steady state, with variability driven by the +seasonal cycle, climate variation, disturbance, and internal dynamics of +the plant-litter-soil system. In cases where the combination of climate +and plant type are not suitable to sustained growth, the deficit in this +pool increases until the available carbon is being allocated mostly to +alleviate the deficit, and new growth approaches zero. The allocation +flux to :math:`CS_{xs}` (:math:`CF_{GPP,xs}`, gC +m\ :sup:`-2` s\ :math:`{}^{-1}`) is given as + +.. math:: + :label: 13.4) + + CF_{GPP,xs,pot} =\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CS_{xs} \ge 0} \\ {-CS_{xs} /(86400\tau _{xs} )\qquad {\rm for\; }CS_{xs} <0} \end{array}\right. + +.. math:: + :label: 13.5) + + CF_{GPP,xs} =\left\{\begin{array}{l} {CF_{GPP,xs,pot} \qquad \qquad \qquad {\rm for\; }CF_{GPP,xs,pot} \le CF_{GPPpot} -CF_{GPP,mr} } \\ {\max (CF_{GPPpot} -CF_{GPP,mr} ,0)\qquad {\rm for\; }CF_{GPP,xs,pot} >CF_{GPPpot} -CF_{GPP,mr} } \end{array}\right. + +where :math:`\tau_{xs}` is the time constant (currently +set to 30 days) controlling the rate of replenishment of :math:`CS_{xs}`. + +Note that these two top-priority carbon allocation fluxes +(:math:`CF_{GPP,mr}` and :math:`CF_{GPP,xs}`) are not +stoichiometrically associated with any nitrogen fluxes, and so this +initial allocation step can proceed without reference to (or limitation +from) the available mineral nitrogen supply. + +Carbon and Nitrogen Stoichiometry of New Growth +---------------------------------------------------- + +After accounting for the carbon cost of maintenance respiration, the +remaining carbon flux from photosynthesis which can be allocated to new +growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :math:`{}^{-1}`) is + +.. math:: + :label: 13.6) + + CF_{avail\_ alloc} =CF_{GPPpot} -CF_{GPP,mr} -CF_{GPP,xs} . + +Potential allocation to new growth is calculated for all of the plant +carbon and nitrogen state variables based on specified C:N ratios for +each tissue type and allometric parameters that relate allocation +between various tissue types. The allometric parameters are defined as +follows: + +.. math:: + :label: ZEqnNum650137 + + \begin{array}{l} {a_{1} ={\rm \; ratio\; of\; new\; fine\; root\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{2} ={\rm \; ratio\; of\; new\; coarse\; root\; :\; new\; stem\; carbon\; allocation}} \\ {a_{3} ={\rm \; ratio\; of\; new\; stem\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{4} ={\rm \; ratio\; new\; live\; wood\; :\; new\; total\; wood\; allocation}} \\ {g_{1} ={\rm ratio\; of\; growth\; respiration\; carbon\; :\; new\; growth\; carbon.\; }} \end{array} + +Parameters :math:`a_{1}`, :math:`a_{2}`, and :math:`a_{4}` are defined as constants for a given PFT (Table +13.1), while :math:`g_{l }` = 0.3 (unitless) is prescribed as a +constant for all PFTs, based on construction costs for a range of woody +and non-woody tissues (Larcher, 1995). + +The model includes a dynamic allocation scheme for woody vegetation +(parameter :math:`a_{3}` = -1, Table 13.1), in which case the +ratio for carbon allocation between new stem and new leaf increases with +increasing net primary production (NPP), as + +.. math:: + :label: 13.8) + + a_{3} =\frac{2.7}{1+e^{-0.004NPP_{ann} -300} } -0.4 + +where :math:`NPP_{ann}` is the annual sum of NPP from the previous +year. This mechanism has the effect of increasing woody allocation in +favorable growth environments (Allen et al., 2005; Vanninen and Makela, +2005) and during the phase of stand growth prior to canopy closure +(Axelsson and Axelsson, 1986). + +Table 13.1. Allocation and carbon:nitrogen ratio parameters + ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`CN_{leaf}` | :math:`CN_{fr}` | :math:`CN_{lw}` | :math:`CN_{dw}` | ++==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ +| NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| NET Boreal | 1 | 0.3 | -1 | 0.1 | 40 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| NDT Boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BET Tropical | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BET temperate | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDT tropical | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDT temperate | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDT boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BES temperate | 1 | 0.3 | 0.2 | 0.5 | 30 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDS temperate | 1 | 0.3 | 0.2 | 0.5 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDS boreal | 1 | 0.3 | 0.2 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| C\ :math:`{}_{3}` arctic grass | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| C\ :math:`{}_{3}` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| C\ :math:`{}_{4}` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Crop R | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Crop I | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Corn R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Corn I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Temp Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Temp Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Winter Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Winter Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Soybean R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Soybean I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + +Carbon to nitrogen ratios are defined for different tissue types as +follows: + +.. math:: + :label: ZEqnNum413927 + + \begin{array}{l} {CN_{leaf} =\_ {\rm \; C:N\; for\; leaf}} \\ {CN_{fr} =\_ {\rm \; C:N\; for\; fine\; root}} \\ {CN_{lw} =\_ {\rm \; C:N\; for\; live\; wood\; (in\; stem\; and\; coarse\; root)}} \\ {CN_{dw} =\_ {\rm \; C:N\; for\; dead\; wood\; (in\; stem\; and\; coarse\; root)}} \end{array} + +where all C:N parameters are defined as constants for a given PFT (Table +13.1). + +Given values for the parameters in and , total carbon and nitrogen +allocation to new growth ( :math:`CF_{alloc}`, gC +m\ :sup:`-2` s\ :math:`{}^{-1}`, and :math:`NF_{alloc}`, gN +m\ :sup:`-2` s\ :math:`{}^{-1}`, respectively) can be expressed as +functions of new leaf carbon allocation (:math:`CF_{GPP,leaf}`, gC +m\ :sup:`-2` s\ :math:`{}^{-1}`): + +.. math:: + :label: ZEqnNum555154 + + \begin{array}{l} {CF_{alloc} =CF_{GPP,leaf} {\kern 1pt} C_{allom} } \\ {NF_{alloc} =CF_{GPP,leaf} {\kern 1pt} N_{allom} } \end{array} + +where + +.. math:: + :label: 13.11) + + \begin{array}{l} {C_{allom} =\left\{\begin{array}{l} {\left(1+g_{1} \right)\left(1+a_{1} +a_{3} \left(1+a_{2} \right)\right)\qquad {\rm for\; woody\; PFT}} \\ {1+g_{1} +a_{1} \left(1+g_{1} \right)\qquad \qquad {\rm for\; non-woody\; PFT}} \end{array}\right. } \\ {} \end{array} + +.. math:: + :label: 13.12) + + N_{allom} =\left\{\begin{array}{l} {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } +\frac{a_{3} a_{4} \left(1+a_{2} \right)}{CN_{lw} } +} \\ {\qquad \frac{a_{3} \left(1-a_{4} \right)\left(1+a_{2} \right)}{CN_{dw} } \qquad {\rm for\; woody\; PFT}} \\ {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } \qquad \qquad \qquad {\rm for\; non-woody\; PFT.}} \end{array}\right. + +Since the C:N stoichiometry for new growth allocation is defined, from +Eq. , as :math:`C_{allom}`/ :math:`N_{allom}`, the total carbon available for new growth allocation +(:math:`CF_{avail\_alloc}`) can be used to calculate the total +plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, +gN m\ :sup:`-2` s\ :math:`{}^{-1}`) as: + +.. math:: + :label: 13.13) + + NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . + +Deployment of retranslocated nitrogen +------------------------------------------ + +In many plants, some portion of the nitrogen used to construct new +tissues is mobilized from senescing tissues, especially leaves, and +retained within the plant when the tissues are lost as litter. This +store of retranslocated nitrogen is used to supply part of the nitrogen +demand for subsequent growth (Magill et al., 1997; Oikawa et al., 2005; +Son and Gower, 1991). CLM includes one pool of retranslocated nitrogen +(:math:`NS_{retrans}`, gN m\ :sup:`-2`), and the +availability of nitrogen from this pool to support new growth +(:math:`NF_{avail\_retrans}`, gN m\ :sup:`-2` +s\ :math:`{}^{-1}`) is proportional to the plant nitrogen demand, as: + +.. math:: + :label: 13.14) + + NF_{avail\_ retrans} =\min \left(\frac{NF_{retrans\_ ann} \frac{NF_{plant\_ demand} }{NF_{plant\_ demand\_ ann} } }{\Delta t} ,\; \frac{NS_{retrans} }{\Delta t} \right) + +where :math:`NF_{retrans\_ann}` (gN m\ :sup:`-2` y\ :math:`{}^{-1}`) is the previous year’s annual sum of retranslocated +nitrogen extracted from senescing tissues, +:math:`NF_{plant\_demand\_ann}` (gN m\ :sup:`-2` y\ :math:`{}^{-1}`) is the previous year’s annual sum of +:math:`NF_{plant\_demand}`, and :math:`\Delta`\ *t* (s) is the +model’s biogeochemistry time step. This formulation produces an annual +cycle in the extraction of nitrogen from :math:`NS_{retrans}` +which corresponds to the annual cycle of plant nitrogen demand, and +which is scaled to give :math:`NS_{retrans}` approximately a +one-year turnover time. The minimum function prevents extraction of more +than the remaining pool of retranslocated nitrogen, which can be an +important constraint under conditions where high rates of mortality are +modifying the size of the pool. During the first year of an initial +simulation, before :math:`NF_{plant\_demand\_ann}` and +:math:`NF_{retrans\_ann}` have valid values, +:math:`NF_{avail\_retrans}` is set to 0.0. + +The actual flux of nitrogen from the retranslocated N pool into +allocation of new growth (:math:`NF_{retrans,alloc}`, gN +m\ :sup:`-2` s\ :math:`{}^{-1}`) is never greater than the plant +demand for new nitrogen: + +.. math:: + :label: 13.15) + + NF_{retrans,alloc} =\min \left(NF_{plant\_ demand} ,NF_{avail\_ retrans} \right) + +Plant nitrogen uptake from soil mineral nitrogen pool +---------------------------------------------------------- + +The total plant nitrogen demand is reduced by the nitrogen flux from +:math:`NS_{retrans}` to give the plant demand for mineral nitrogen +from the soil (:math:`NF_{plant\_demand\_soil}`, gN +m\ :sup:`-2` s\ :math:`{}^{-1}`): + +.. math:: + :label: ZEqnNum491412 + + NF_{plant\_ demand\_ soil} =NF_{plant\_ demand} -NF_{retrans,alloc} . + +The combined demand from all PFTs sharing space on a soil column and the +demand from the heterotrophic community in the soil (nitrogen +immobilization demand) compete for the available soil mineral nitrogen +pool. The result of this competition is passed back to the allocation +algorithm as :math:`f_{plant\_demand}`, the fraction (from 0 to 1) +of the plant nitrogen demand which can be met given the current soil +mineral nitrogen supply and competition with heterotrophs. Plant uptake +from the soil mineral nitrogen pool is then given as: + +.. math:: + :label: 13.17) + + NF_{sminn,alloc} =NF_{plant\_ demand\_ soil} f_{plant\_ demand} + +Final carbon and nitrogen allocation +----------------------------------------- + +The total flux of allocated nitrogen is given as: + +.. math:: + :label: 13.18) + + NF_{alloc} =NF_{retrans,alloc} +NF_{sminn,alloc} + +From the stoichiometric relationship in Eq. , the associated carbon +allocation flux is: + +.. math:: + :label: 13.19) + + CF_{alloc} =NF_{alloc} \frac{C_{allom} }{N_{allom} } . + +The downregulation of photosynthesis can then be calculated as: + +.. math:: + :label: 13.20) + + f_{dreg} =\frac{CF_{alloc} -CF_{avail\_ alloc} }{CF_{GPPpot} } . + +Total allocation to new leaf carbon +(:math:`CF_{alloc,leaf\_tot}`, gC m\ :sup:`-2` s\ :math:`{}^{-1}`) is calculated as: + +.. math:: + :label: 13.21) + + CF_{alloc,leaf\_ tot} =\frac{CF_{alloc} }{C_{allom} } . + +There are two carbon pools associated with each plant tissue – one which +represents the currently displayed tissue, and another which represents +carbon stored for display in a subsequent growth period. The nitrogen +pools follow this same organization. The model keeps track of stored +carbon according to which tissue type it will eventually be displayed +as, and the separation between display in the current timestep and +storage for later display depends on the parameter :math:`f_{cur}` +(values 0 to 1). Given :math:`CF_{alloc,leaf}` and :math:`f_{cur}`, the allocation fluxes of carbon to display and +storage pools (where storage is indicated with *\_stor*) for the various +tissue types are given as: + +.. math:: + :label: 13.22) + + CF_{alloc,leaf} \_ =CF_{alloc,leaf\_ tot} f_{cur} + +.. math:: + :label: 13.23) + + CF_{alloc,leaf\_ stor} \_ =CF_{alloc,leaf\_ tot} \left(1-f_{cur} \right) + +.. math:: + :label: 13.24) + + CF_{alloc,froot} \_ =CF_{alloc,leaf\_ tot} a_{1} f_{cur} + +.. math:: + :label: 13.25) + + CF_{alloc,froot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{1} \left(1-f_{cur} \right) + +.. math:: + :label: 13.26) + + CF_{alloc,livestem} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} f_{cur} + +.. math:: + :label: 13.27) + + CF_{alloc,livestem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} \left(1-f_{cur} \right) + +.. math:: + :label: 13.28) + + CF_{alloc,deadstem} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)f_{cur} + +.. math:: + :label: 13.29) + + CF_{alloc,deadstem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right) + +.. math:: + :label: 13.30) + + CF_{alloc,livecroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} f_{cur} + +.. math:: + :label: 13.31) + + CF_{alloc,livecroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} \left(1-f_{cur} \right) + +.. math:: + :label: 13.32) + + CF_{alloc,deadcroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)f_{cur} + +.. math:: + :label: 13.33) + + CF_{alloc,deadcroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). + +The corresponding nitrogen allocation fluxes are given as: + +.. math:: + :label: 13.34) + + NF_{alloc,leaf} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } f_{cur} + +.. math:: + :label: 13.35) + + NF_{alloc,leaf\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } \left(1-f_{cur} \right) + +.. math:: + :label: 13.36) + + NF_{alloc,froot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } f_{cur} + +.. math:: + :label: 13.37) + + NF_{alloc,froot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } \left(1-f_{cur} \right) + +.. math:: + :label: 13.38) + + NF_{alloc,livestem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } f_{cur} + +.. math:: + :label: 13.39) + + NF_{alloc,livestem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) + +.. math:: + :label: 13.40) + + NF_{alloc,deadstem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} + +.. math:: + :label: 13.41) + + NF_{alloc,deadstem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right) + +.. math:: + :label: 13.42) + + NF_{alloc,livecroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } f_{cur} + +.. math:: + :label: 13.43) + + NF_{alloc,livecroot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) + +.. math:: + :label: 13.44) + + NF_{alloc,deadcroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} + +.. math:: + :label: 13.45) + + NF_{alloc,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). + +Autotrophic Respiration +---------------------------- + +The model treats maintenance and growth respiration fluxes separately, +even though it is difficult to measure them as separate fluxes (Lavigne +and Ryan, 1997; Sprugel et al., 1995). Maintenance respiration is +defined as the carbon cost to support the metabolic activity of existing +live tissue, while growth respiration is defined as the additional +carbon cost for the synthesis of new growth. + +13.7.1 Maintenance Respiration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Under the assumption that tissue nitrogen content is a suitable index of +cellular metabolic rate, maintenance respiration costs for live tissues +(leaf, live stem, live coarse root, and fine root) are calculated as +functions tissue nitrogen content and the relevant temperature, +following the empirical relationship reported by Ryan (1991): + +.. math:: + :label: 13.46) + + CF_{mr\_ leaf} \_ =NS_{leaf} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} + +.. math:: + :label: 13.47) + + CF_{mr\_ livestem} \_ =NS_{livestem} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} + +.. math:: + :label: 13.48) + + CF_{mr\_ livecroot} \_ =NS_{livecroot} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} + +.. math:: + :label: 13.49) + + CF_{mr\_ froot} \_ =\sum _{j=1}^{nlevsoi}NS_{froot} rootfr_{j} MR_{base} MR_{Q10} ^{(Ts_{j} -20)/10} + +where :math:`MR_{base}` (= 2.525e\ :sup:`-6` gC gN\ :sup:`-1` s\ :sup:`-1`) is the base rate of maintenance +respiration per unit nitrogen content, :math:`MR_{q10}` (= 2.0) is +the temperature sensitivity for maintenance respiration, +:math:`T_{2m}` (:math:`{}^\circ`\ C) is the air temperature at 2m +height, :math:`Ts_{j}`* (:math:`{}^\circ`\ C) is the soil +temperature at level *j*, and :math:`rootfr_{j}` is the fraction +of fine roots distributed in soil level *j*. + +Note that, for woody vegetation, maintenance respiration costs are not +calculated for the dead stem and dead coarse root components. These +components are assumed to consist of dead xylem cells, with no metabolic +function. By separating the small live component of the woody tissue +(ray parenchyma, phloem, and sheathing lateral meristem cells) from the +larger fraction of dead woody tissue, it is reasonable to assume a +common base maintenance respiration rate for all live tissue types. + +The total maintenance respiration cost is then given as: + +.. math:: + :label: 13.50) + + CF_{mr} =CF_{mr\_ leaf} +CF_{mr\_ froot} +CF_{mr\_ livestem} +CF_{mr\_ livecroot} . + +13.7.2 Growth Respiration +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Growth respiration is calculated as a factor of 0.3 times the total +carbon in new growth on a given timestep, based on construction costs +for a range of woody and non-woody tissues (Larcher, 1995). For new +carbon and nitrogen allocation that enters storage pools for subsequent +display, it is not clear what fraction of the associated growth +respiration should occur at the time of initial allocation, and what +fraction should occur later, at the time of display of new growth from +storage. Eddy covariance estimates of carbon fluxes in forest ecosystems +suggest that the growth respiration associated with transfer of +allocated carbon and nitrogen from storage into displayed tissue is not +significant (Churkina et al., 2003), and so it is assumed in CLM that +all of the growth respiration cost is incurred at the time of initial +allocation, regardless of the fraction of allocation that is displayed +immediately (i.e. regardless of the value of :math:`f_{cur}`, +section 13.5). This behavior is parameterized in such a way that if +future research suggests that some fraction of the growth respiration +cost should be incurred at the time of display from storage, a simple +parameter modification will effect the change. [1]_ + +.. [1] + Parameter :math:`\text{grpnow}` in routines CNGResp and CNAllocation, currently set to 1.0, could be changed to a smaller + value to transfer some portion (1 - :math:`\text{grpnow}` ) of the growth respiration forward in time to occur at the time of growth + display from storage. + diff --git a/doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst b/doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst new file mode 100644 index 0000000000..65a0cf17a7 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst @@ -0,0 +1,887 @@ +.. math:: 10 + +Vegetation Phenology +======================== + +The CLM phenology model consists of several algorithms controlling the +transfer of stored carbon and nitrogen out of storage pools for the +display of new growth and into litter pools for losses of displayed +growth. PFTs are classified into three distinct phenological types that +are represented by separate algorithms: an evergreen type, for which +some fraction of annual leaf growth persists in the displayed pool for +longer than one year; a seasonal-deciduous type with a single growing +season per year, controlled mainly by temperature and daylength; and a +stress-deciduous type with the potential for multiple growing seasons +per year, controlled by temperature and soil moisture conditions. + +The three phenology types share a common set of control variables. The +calculation of the phenology fluxes is generalized, operating +identically for all three phenology types, given a specification of the +common control variables. The following sections describe first the +general flux parameterization, followed by the algorithms for setting +the control parameters for the three phenology types. + +General Phenology Flux Parameterization +-------------------------------------------- + +Fluxes of carbon and nitrogen from storage pools and into displayed +tissue pools pass through a special transfer pool (denoted *\_xfer*), +maintained as a separate state variable for each tissue type. Storage +(*\_stor*) and transfer (*\_xfer*) pools are maintained separately to +reduce the complexity of accounting for transfers into and out of +storage over the course of a single growing season. + +Figure 14.1. Example of annual phenology cycle for seasonal deciduous. + +|image| + +14.1.1 Onset Periods +^^^^^^^^^^^^^^^^^^^^ + +The deciduous phenology algorithms specify the occurrence of onset +growth periods (Figure 14.1). Carbon fluxes from the transfer pools into +displayed growth are calculated during these periods as: + +.. math:: + + \label{14.1)} + CF_{leaf\_ xfer,leaf} =r_{xfer\_ on} CS_{leaf\_ xfer} + +.. math:: + + \label{14.2)} + CF_{froot\_ xfer,froot} =r_{xfer\_ on} CS_{froot\_ xfer} + +.. math:: + + \label{14.3)} + CF_{livestem\_ xfer,livestem} =r_{xfer\_ on} CS_{livestem\_ xfer} + +.. math:: + + \label{14.4)} + CF_{deadstem\_ xfer,deadstem} =r_{xfer\_ on} CS_{deadstem\_ xfer} + +.. math:: + + \label{14.5)} + CF_{livecroot\_ xfer,livecroot} =r_{xfer\_ on} CS_{livecroot\_ xfer} + +.. math:: + + \label{14.6)} + CF_{deadcroot\_ xfer,deadcroot} =r_{xfer\_ on} CS_{deadcroot\_ xfer} , + +with corresponding nitrogen fluxes: + +.. math:: + + \label{14.7)} + NF_{leaf\_ xfer,leaf} =r_{xfer\_ on} NS_{leaf\_ xfer} + +.. math:: + + \label{14.8)} + NF_{froot\_ xfer,froot} =r_{xfer\_ on} NS_{froot\_ xfer} + +.. math:: + + \label{14.9)} + NF_{livestem\_ xfer,livestem} =r_{xfer\_ on} NS_{livestem\_ xfer} + +.. math:: + + \label{14.10)} + NF_{deadstem\_ xfer,deadstem} =r_{xfer\_ on} NS_{deadstem\_ xfer} + +.. math:: + + \label{14.11)} + NF_{livecroot\_ xfer,livecroot} =r_{xfer\_ on} NS_{livecroot\_ xfer} + +.. math:: + + \label{14.12)} + NF_{deadcroot\_ xfer,deadcroot} =r_{xfer\_ on} NS_{deadcroot\_ xfer} , + +where CF is the carbon flux, CS is stored carbon, NF is the nitrogen +flux, NS is stored nitrogen, *r\ :math:`{}_{xfer\_on}`* +(s:math:`{}^{-1}`) is a time-varying rate coefficient controlling flux +out of the transfer pool: + +.. math:: + + \label{ZEqnNum852972} + r_{xfer\_ on} =\left\{\begin{array}{l} {{2\mathord{\left/ {\vphantom {2 t_{onset} }} \right. \kern-\nulldelimiterspace} t_{onset} } \qquad {\rm for\; }t_{onset} \ne \Delta t} \\ {{1\mathord{\left/ {\vphantom {1 \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \qquad {\rm for\; }t_{onset} =\Delta t} \end{array}\right. + +and *t\ :math:`{}_{onset}`* (s) is the number of seconds remaining in +the current phenology onset growth period (Figure 14.1). The form of Eq. +produces a flux from the transfer pool which declines linearly over the +onset growth period, approaching zero flux in the final timestep. + +14.1.2 Offset Periods +^^^^^^^^^^^^^^^^^^^^^ + +The deciduous phenology algorithms also specify the occurrence of +litterfall during offset periods. In contrast to the onset periods, only +leaf and fine root state variables are subject to litterfall fluxes. +Carbon fluxes from display pools into litter are calculated during these +periods as: + +.. math:: + + \label{14.14)} + CF_{leaf,litter}^{n} =\left\{\begin{array}{l} {CF_{leaf,litter}^{n-1} +r_{xfer\_ off} \left(CS_{leaf} -CF_{leaf,litter}^{n-1} {\kern 1pt} t_{offset} \right)\qquad {\rm for\; }t_{offset} \ne \Delta t} \\ {\left({CS_{leaf} \mathord{\left/ {\vphantom {CS_{leaf} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right)+CF_{alloc,leaf} \qquad \qquad \qquad \qquad {\rm for\; }t_{offset} =\Delta t} \end{array}\right. + +.. math:: + + \label{14.15)} + CF_{froot,litter}^{n} =\left\{\begin{array}{l} {CF_{froot,litter}^{n-1} +r_{xfer\_ off} \left(CS_{froot} -CF_{froot,litter}^{n-1} {\kern 1pt} t_{offset} \right)\qquad {\rm for\; }t_{offset} \ne \Delta t} \\ {\left({CS_{froot} \mathord{\left/ {\vphantom {CS_{froot} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right)+CF_{alloc,\, froot} \qquad \qquad \qquad {\rm for\; }t_{offset} =\Delta t} \end{array}\right. + +.. math:: + + \label{14.16)} + r_{xfer\_ off} =\frac{2\Delta t}{t_{offset} ^{2} } + +where superscripts *n* and *n-1* refer to fluxes on the current and +previous timesteps, respectively. The rate coefficient +*r\ :math:`{}_{xfer\_off}`* varies with time to produce a linearly +increasing litterfall rate throughout the offset period, and the special +case for fluxes in the final litterfall timestep +(*t\ :math:`{}_{offset}`* = *:math:`\Delta`\ t*) ensures that all of the +displayed growth is sent to the litter pools for deciduous plant types. + +Corresponding nitrogen fluxes during litterfall take into account +retranslocation of nitrogen out of the displayed leaf pool prior to +litterfall (*NF\ :math:`{}_{leaf,retrans}`*, gN m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`). Retranslocation of nitrogen out of fine roots is +assumed to be negligible. The fluxes are: + +.. math:: + + \label{14.17)} + NF_{leaf,litter} ={CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{leaf\_ litter} }} \right. \kern-\nulldelimiterspace} CN_{leaf\_ litter} } + +.. math:: + + \label{14.18)} + NF_{froot,litter} ={CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{froot} }} \right. \kern-\nulldelimiterspace} CN_{froot} } + +.. math:: + + \label{14.19)} + NF_{leaf,retrans} =\left({CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{leaf} }} \right. \kern-\nulldelimiterspace} CN_{leaf} } \right)-NF_{leaf,litter} . + +where CN is C:N. + +14.1.3 Background Onset Growth +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The stress-deciduous phenology algorithm includes a provision for the +case when stress signals are absent, and the vegetation shifts from a +deciduous habit to an evergreen habit, until the next occurrence of an +offset stress trigger . In that case, the regular onset flux mechanism +is switched off and a background onset growth algorithm is invoked +(*r\ :math:`{}_{bgtr}`* :math:`>` 0). During this period, small fluxes +of carbon and nitrogen from the storage pools into the associated +transfer pools are calculated on each time step, and the entire contents +of the transfer pool are added to the associated displayed growth pool +on each time step. The carbon fluxes from transfer to display pools +under these conditions are: + +.. math:: + + \label{14.20)} + CF_{leaf\_ xfer,leaf} ={CS_{leaf\_ xfer} \mathord{\left/ {\vphantom {CS_{leaf\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.21)} + CF_{froot\_ xfer,froot} ={CS_{froot\_ xfer} \mathord{\left/ {\vphantom {CS_{froot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.22)} + CF_{livestem\_ xfer,livestem} ={CS_{livestem\_ xfer} \mathord{\left/ {\vphantom {CS_{livestem\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.23)} + CF_{deadstem\_ xfer,deadstem} ={CS_{deadstem\_ xfer} \mathord{\left/ {\vphantom {CS_{deadstem\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.24)} + CF_{livecroot\_ xfer,livecroot} ={CS_{livecroot\_ xfer} \mathord{\left/ {\vphantom {CS_{livecroot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.25)} + CF_{deadcroot\_ xfer,deadcroot} ={CS_{deadcroot\_ xfer} \mathord{\left/ {\vphantom {CS_{deadcroot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} , + +and the corresponding nitrogen fluxes are: + +.. math:: + + \label{14.26)} + NF_{leaf\_ xfer,leaf} ={NS_{leaf\_ xfer} \mathord{\left/ {\vphantom {NS_{leaf\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.27)} + NF_{froot\_ xfer,froot} ={NS_{froot\_ xfer} \mathord{\left/ {\vphantom {NS_{froot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.28)} + NF_{livestem\_ xfer,livestem} ={NS_{livestem\_ xfer} \mathord{\left/ {\vphantom {NS_{livestem\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.29)} + NF_{deadstem\_ xfer,deadstem} ={NS_{deadstem\_ xfer} \mathord{\left/ {\vphantom {NS_{deadstem\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.30)} + NF_{livecroot\_ xfer,livecroot} ={NS_{livecroot\_ xfer} \mathord{\left/ {\vphantom {NS_{livecroot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.31)} + NF_{deadcroot\_ xfer,deadcroot} ={NS_{deadcroot\_ xfer} \mathord{\left/ {\vphantom {NS_{deadcroot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} . + +14.1.4 Background Litterfall +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Both evergreen and stress-deciduous phenology algorithms can specify a +litterfall flux that is not associated with a specific offset period, +but which occurs instead at a slow rate over an extended period of time, +referred to as background litterfall. For evergreen types the background +litterfall is the only litterfall flux. For stress-deciduous types +either the offset period litterfall or the background litterfall +mechanism may be active, but not both at once. Given a specification of +the background litterfall rate (*r\ :math:`{}_{bglf}`*, +s\ :math:`{}^{-1}`), litterfall carbon fluxes are calculated as + +.. math:: + + \label{14.32)} + CF_{leaf,litter} =r_{bglf} CS_{leaf} + +.. math:: + + \label{14.33)} + CS_{froot,litter} =r_{bglf} CS_{froot} , + +with corresponding nitrogen litterfall and retranslocation fluxes: + +.. math:: + + \label{14.34)} + NF_{leaf,litter} ={CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{leaf\_ litter} }} \right. \kern-\nulldelimiterspace} CN_{leaf\_ litter} } + +.. math:: + + \label{14.35)} + NF_{froot,litter} ={CF_{froot,litter} \mathord{\left/ {\vphantom {CF_{froot,litter} CN_{froot} }} \right. \kern-\nulldelimiterspace} CN_{froot} } + +.. math:: + + \label{14.36)} + NF_{leaf,retrans} =\left({CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{leaf} }} \right. \kern-\nulldelimiterspace} CN_{leaf} } \right)-NF_{leaf,litter} . + +14.1.5 Livewood Turnover +^^^^^^^^^^^^^^^^^^^^^^^^ + +The conceptualization of live wood vs. dead wood fractions for stem and +coarse root pools is intended to capture the difference in maintenance +respiration rates between these two physiologically distinct tissue +types. Unlike displayed pools for leaf and fine root, which are lost to +litterfall, live wood cells reaching the end of their lifespan are +retained as a part of the dead woody structure of stems and coarse +roots. A mechanism is therefore included in the phenology routine to +effect the transfer of live wood to dead wood pools, which also takes +into account the different nitrogen concentrations typical of these +tissue types. + +A live wood turnover rate (*r\ :math:`{}_{lwt}`*, s\ :math:`{}^{-1}`) is +defined as + +.. math:: + + \label{14.37)} + r_{lwt} ={p_{lwt} \mathord{\left/ {\vphantom {p_{lwt} \left(365\cdot 86400\right)}} \right. \kern-\nulldelimiterspace} \left(365\cdot 86400\right)} + +where *p\ :math:`{}_{lwt}`* = 0.7 is the assumed annual live wood +turnover fraction. Carbon fluxes from live to dead wood pools are: + +.. math:: + + \label{14.38)} + CF_{livestem,deadstem} =CS_{livestem} r_{lwt} + +.. math:: + + \label{14.39)} + CF_{livecroot,deadcroot} =CS_{livecroot} r_{lwt} , + +and the associated nitrogen fluxes, including retranslocation of +nitrogen out of live wood during turnover, are: + +.. math:: + + \label{14.40)} + NF_{livestem,deadstem} ={CF_{livestem,deadstem} \mathord{\left/ {\vphantom {CF_{livestem,deadstem} CN_{dw} }} \right. \kern-\nulldelimiterspace} CN_{dw} } + +.. math:: + + \label{14.41)} + NF_{livestem,retrans} =\left({CF_{livestem,deadstem} \mathord{\left/ {\vphantom {CF_{livestem,deadstem} CN_{lw} }} \right. \kern-\nulldelimiterspace} CN_{lw} } \right)-NF_{livestem,deadstem} + +.. math:: + + \label{14.42)} + NF_{livecroot,deadcroot} ={CF_{livecroot,deadcroot} \mathord{\left/ {\vphantom {CF_{livecroot,deadcroot} CN_{dw} }} \right. \kern-\nulldelimiterspace} CN_{dw} } + +.. math:: + + \label{14.43)} + NF_{livecroot,retrans} =\left({CF_{livecroot,deadcroot} \mathord{\left/ {\vphantom {CF_{livecroot,deadcroot} CN_{lw} }} \right. \kern-\nulldelimiterspace} CN_{lw} } \right)-NF_{livecroot,deadcroot} . + +Evergreen Phenology +------------------------ + +The evergreen phenology algorithm is by far the simplest of the three +possible types. It is assumed for all evergreen types that all carbon +and nitrogen allocated for new growth in the current timestep goes +immediately to the displayed growth pools (i.e. *f\ :math:`{}_{cur}`* = +(Chapter 13)). As such, there is never an accumulation of carbon or +nitrogen in the storage or transfer pools, and so the onset growth and +background onset growth mechanisms are never invoked for this type. +Litterfall is specified to occur only through the background litterfall +mechanism – there are no distinct periods of litterfall for evergreen +types, but rather a continuous (slow) shedding of foliage and fine +roots. This is an obvious area for potential improvements in the model, +since it is known, at least for evergreen needleleaf trees in the +temperate and boreal zones, that there are distinct periods of higher +and lower leaf litterfall (Ferrari, 1999; Gholz et al., 1985). The rate +of background litterfall (*r\ :math:`{}_{bglf}`*, section 14.1.4) +depends on the specified leaf longevity +(*:math:`\tau`\ :math:`{}_{leaf}`*, y), as + +.. math:: + + \label{14.44)} + r_{bglf} =\frac{1}{\tau _{leaf} \cdot 365\cdot 86400} . + +Seasonal-Deciduous Phenology +--------------------------------- + +The seasonal-deciduous phenology algorithm derives directly from the +treatment used in the offline model Biome-BGC v. 4.1.2, (Thornton et +al., 2002), which in turn is based on the parameterizations for leaf +onset and offset for temperate deciduous broadleaf forest from White et +al. (1997). Initiation of leaf onset is triggered when a common +degree-day summation exceeds a critical value, and leaf litterfall is +initiated when daylength is shorter than a critical value. Because of +the dependence on daylength, the seasonal deciduous phenology algorithm +is only valid for latitudes outside of the tropical zone, defined here +as :math:`\left|{\rm latitude}\right|>19.5{\rm {}^\circ }`. Neither the +background onset nor background litterfall mechanism is invoked for the +seasonal-deciduous phenology algorithm. The algorithm allows a maximum +of one onset period and one offset period each year. + +The algorithms for initiation of onset and offset periods use the winter +and summer solstices as coordination signals. The period between winter +and summer solstice is identified as *dayl\ :math:`{}_{n}`* :math:`>` +*dayl\ :math:`{}_{n-1}`*, and the period between summer and winter +solstice is identified as *dayl\ :math:`{}_{n}`* :math:`<` +*dayl\ :math:`{}_{n-1}`*, where *dayl\ :math:`{}_{n}`* and +*dayl\ :math:`{}_{n-1}`* are the daylength (s) calculated for the +current and previous timesteps, respectively, using + +.. math:: + + \label{14.45)} + dayl=2\cdot 13750.9871\cdot acos\left(\frac{-\sin (lat)\sin (decl)}{\cos (lat)\cos (decl)} \right), + +where *lat* and *decl* are the latitude and solar declination (radians), +respectively, and the factor 13750.9871 is the number of seconds per +radian of hour-angle. + +14.3.1 Seasonal-Deciduous Onset Trigger +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The onset trigger for the seasonal-deciduous phenology algorithm is +based on an accumulated growing-degree-day approach (White et al., +1997). The growing-degree-day summation (*GDD\ :math:`{}_{sum}`*) is +initiated (*GDD\ :math:`{}_{sum}`* = 0) when the phenological state is +dormant and the model timestep crosses the winter solstice. Once these +conditions are met, *GDD\ :math:`{}_{sum}`* is updated on each timestep +as + +.. math:: + + \label{ZEqnNum510730} + GDD_{sum}^{n} =\left\{\begin{array}{l} {GDD_{sum}^{n-1} +\left(T_{s,3} -TKFRZ\right)f_{day} \qquad {\rm for\; }T_{s,3} >TKFRZ} \\ {GDD_{sum}^{n-1} \qquad \qquad \qquad {\rm for\; }T_{s,3} \le TKFRZ} \end{array}\right. + +where *T\ :math:`{}_{s,3}`* (K) is the temperature of the third soil +layer, and +:math:`f_{day} ={\Delta t\mathord{\left/ {\vphantom {\Delta t 86400}} \right. \kern-\nulldelimiterspace} 86400}` . +The onset period is initiated if :math:`GDD_{sum} >GDD_{sum\_ crit}` , +where + +.. math:: + + \label{ZEqnNum598907} + GDD_{sum\_ crit} =\exp \left(4.8+0.13{\kern 1pt} \left(T_{2m,ann\_ avg} -TKFRZ\right)\right) + +and where *T\ :math:`{}_{2m,ann\_avg}`* (K) is the annual average of +the 2m air temperature, and TKFRZ is the freezing point of water (273.15 +K). The following control variables are set when a new onset growth +period is initiated: + +.. math:: + + \label{14.48)} + GDD_{sum} =0 + +.. math:: + + \label{14.49)} + t_{onset} =86400\cdot n_{days\_ on} , + +where *n\ :math:`{}_{days\_on}`* is set to a constant value of 30 days. +Fluxes from storage into transfer pools occur in the timestep when a new +onset growth period is initiated. Carbon fluxes are: + +.. math:: + + \label{ZEqnNum904388} + CF_{leaf\_ stor,leaf\_ xfer} ={f_{stor,xfer} CS_{leaf\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{leaf\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.51)} + CF_{froot\_ stor,froot\_ xfer} ={f_{stor,xfer} CS_{froot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{froot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.52)} + CF_{livestem\_ stor,livestem\_ xfer} ={f_{stor,xfer} CS_{livestem\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{livestem\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.53)} + CF_{deadstem\_ stor,deadstem\_ xfer} ={f_{stor,xfer} CS_{deadstem\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{deadstem\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.54)} + CF_{livecroot\_ stor,livecroot\_ xfer} ={f_{stor,xfer} CS_{livecroot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{livecroot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.55)} + CF_{deadcroot\_ stor,deadcroot\_ xfer} ={f_{stor,xfer} CS_{deadcroot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{deadcroot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{ZEqnNum195642} + CF_{gresp\_ stor,gresp\_ xfer} ={f_{stor,xfer} CS_{gresp\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{gresp\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +and the associated nitrogen fluxes are: + +.. math:: + + \label{ZEqnNum812152} + NF_{leaf\_ stor,leaf\_ xfer} ={f_{stor,xfer} NS_{leaf\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{leaf\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.58)} + NF_{froot\_ stor,froot\_ xfer} ={f_{stor,xfer} NS_{froot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{froot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.59)} + NF_{livestem\_ stor,livestem\_ xfer} ={f_{stor,xfer} NS_{livestem\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{livestem\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.60)} + NF_{deadstem\_ stor,deadstem\_ xfer} ={f_{stor,xfer} NS_{deadstem\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{deadstem\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{14.61)} + NF_{livecroot\_ stor,livecroot\_ xfer} ={f_{stor,xfer} NS_{livecroot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{livecroot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{ZEqnNum605338} + NF_{deadcroot\_ stor,deadcroot\_ xfer} ={f_{stor,xfer} NS_{deadcroot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{deadcroot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +where *f\ :math:`{}_{stor,xfer}`* is the fraction of current storage +pool moved into the transfer pool for display over the incipient onset +period. This fraction is set to 0.5, based on the observation that +seasonal deciduous trees are capable of replacing their canopies from +storage reserves in the event of a severe early-season disturbance such +as frost damage or defoliation due to insect herbivory. + +If the onset criterion (*GDD\ :math:`{}_{sum}`* :math:`>` +*GDD\ :math:`{}_{sum\_crit}`*) is not met before the summer solstice, +then *GDD\ :math:`{}_{sum}`* is set to 0.0 and the growing-degree-day +accumulation will not start again until the following winter solstice. +This mechanism prevents the initiation of very short growing seasons +late in the summer in cold climates. The onset counter is decremented on +each time step after initiation of the onset period, until it reaches +zero, signaling the end of the onset period: + +.. math:: + + \label{14.63)} + t_{onfset}^{n} =t_{onfset}^{n-1} -\Delta t + +14.3.2 Seasonal-Deciduous Offset Trigger +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +After the completion of an onset period, and once past the summer +solstice, the offset (litterfall) period is triggered when daylength is +shorter than 39300 s. The offset counter is set at the initiation of the +offset period: :math:`t_{offset} =86400\cdot n_{days\_ off}` , where +*n\ :math:`{}_{days\_off}`* is set to a constant value of 15 days. The +offset counter is decremented on each time step after initiation of the +offset period, until it reaches zero, signaling the end of the offset +period: + +.. math:: + + \label{14.64)} + t_{offset}^{n} =t_{offset}^{n-1} -\Delta t + +Stress-Deciduous Phenology +------------------------------- + +The stress-deciduous phenology algorithm was developed specifically for +the CLM based in part on the grass phenology model proposed by White et +al. (1997). The algorithm handles phenology for vegetation types such as +grasses and tropical drought-deciduous trees that respond to both cold +and drought-stress signals, and that can have multiple growing seasons +per year. The algorithm also allows for the possibility that leaves +might persist year-round in the absence of a suitable stress trigger. In +that case the phenology switches to an evergreen habit, maintaining a +marginally-deciduous leaf longevity (one year) until the occurrence of +the next stress trigger. + +14.4.1 Stress-Deciduous Onset Triggers +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In climates that are warm year-round, onset triggering depends on soil +water availability. At the beginning of a dormant period (end of +previous offset period), an accumulated soil water index +(*SWI\ :math:`{}_{sum}`*, d) is initialized (*SWI\ :math:`{}_{sum}`* = +0), with subsequent accumulation calculated as: + +.. math:: + + \label{ZEqnNum503826} + SWI_{sum}^{n} =\left\{\begin{array}{l} {SWI_{sum}^{n-1} +f_{day} \qquad {\rm for\; }\Psi _{s,3} \ge \Psi _{onset} } \\ {SWI_{sum}^{n-1} \qquad \qquad {\rm for\; }\Psi _{s,3} <\Psi _{onset} } \end{array}\right. + +where :math:`\Psi`\ *:math:`{}_{s,3}`* is the soil water potential (MPa) +in the third soil layer and :math:`\Psi`\ *:math:`{}_{onset}`* = -2 MPa +is the onset soil water potential threshold. Onset triggering is +possible once *SWI\ :math:`{}_{sum}`* :math:`>` 15. If the cold climate +growing degree-day accumulator is not active at the time when this +threshold is reached (see below), and if the daylength is greater than 6 +hours, then onset is triggered. Except as noted below, +*SWI\ :math:`{}_{sum}`* continues to accumulate according to Eq. during +the dormant period if the daylength criterion prevents onset triggering, +and onset is then triggered at the timestep when daylength exceeds 6 +hours. + +In climates with a cold season, onset triggering depends on both +accumulated soil temperature summation and adequate soil moisture. At +the beginning of a dormant period a freezing day accumulator +(*FD\ :math:`{}_{sum}`*, d) is initialized (*FD\ :math:`{}_{sum}`* = 0), +with subsequent accumulation calculated as: + +.. math:: + + \label{14.66)} + FD_{sum}^{n} =\left\{\begin{array}{l} {FD_{sum}^{n-1} +f_{day} \qquad {\rm for\; }T_{s,3} >TKFRZ} \\ {FD_{sum}^{n-1} \qquad \qquad {\rm for\; }T_{s,3} \le TKFRZ} \end{array}\right. . + +If *FD\ :math:`{}_{sum}`* :math:`>` 15 during the dormant period, then a +cold-climate onset triggering criterion is introduced, following exactly +the growing degree-day summation (*GDD\ :math:`{}_{sum}`*) logic of Eqs. +and . At that time *SWI\ :math:`{}_{sum}`* is reset +(*SWI\ :math:`{}_{sum}`* = 0). Onset triggering under these conditions +depends on meeting all three of the following criteria: +*SWI\ :math:`{}_{sum}`* :math:`>` 15, *GDD\ :math:`{}_{sum}`* :math:`>` +*GDD\ :math:`{}_{sum\_crit}`*, and daylength greater than 6 hrs. + +The following control variables are set when a new onset growth period +is initiated: *SWI\ :math:`{}_{sum}`* = 0, *FD\ :math:`{}_{sum}`* = 0, +*GDD\ :math:`{}_{sum}`* = 0, *n\ :math:`{}_{days\_active}`* = 0, and +:math:`t_{onset} =86400\cdot n_{days\_ on}` , where +*n\ :math:`{}_{days\_on}`* is set to a constant value of 30 days. Fluxes +from storage into transfer pools occur in the timestep when a new onset +growth period is initiated, and are handled identically to Eqs. - for +carbon fluxes, and to Eqs. - for nitrogen fluxes. The onset counter is +decremented on each time step after initiation of the onset period, +until it reaches zero, signaling the end of the onset period: + +.. math:: + + \label{14.67)} + t_{onfset}^{n} =t_{onfset}^{n-1} -\Delta t + +14.4.2 Stress-Deciduous Offset Triggers +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Any one of the following three conditions is sufficient to initiate an +offset period for the stress-deciduous phenology algorithm: sustained +period of dry soil, sustained period of cold temperature, or daylength +shorter than 6 hours. Offset triggering due to dry soil or cold +temperature conditions is only allowed once the most recent onset period +is complete. Dry soil condition is evaluated with an offset soil water +index accumulator (*OSWI\ :math:`{}_{sum}`*, d). To test for a sustained +period of dry soils, this control variable can increase or decrease, as +follows: + +.. math:: + + \label{14.68)} + OSWI_{sum}^{n} =\left\{\begin{array}{l} {OSWI_{sum}^{n-1} +f_{day} \qquad \qquad \qquad {\rm for\; }\Psi _{s,3} \le \Psi _{offset} } \\ {{\rm max}\left(OSWI_{sum}^{n-1} -f_{day} ,0\right)\qquad {\rm for\; }\Psi _{s,3} >\Psi _{onset} } \end{array}\right. + +where :math:`\Psi`\ *:math:`{}_{offset}`* = -2 MPa is the offset soil +water potential threshold. An offset period is triggered if the previous +onset period is complete and *OSWI\ :math:`{}_{sum}`* +:math:`\mathrm{\ge}` *OSWI\ :math:`{}_{sum\_crit}`*, where +*OSWI\ :math:`{}_{sum\_crit}`* = 15. + +The cold temperature trigger is calculated with an offset freezing day +accumulator (*OFD\ :math:`{}_{sum}`*, d). To test for a sustained period +of cold temperature, this variable can increase or decrease, as follows: + +.. math:: + + \label{14.69)} + OFD_{sum}^{n} =\left\{\begin{array}{l} {OFD_{sum}^{n-1} +f_{day} \qquad \qquad \qquad {\rm for\; }T_{s,3} \le TKFRZ} \\ {{\rm max}\left(OFD_{sum}^{n-1} -f_{day} ,0\right)\qquad \qquad {\rm for\; }T_{s,3} >TKFRZ} \end{array}\right. + +An offset period is triggered if the previous onset period is complete +and *OFD\ :math:`{}_{sum}`* :math:`>` *OFD\ :math:`{}_{sum\_crit}`*, +where *OFD\ :math:`{}_{sum\_crit}`* = 15. + +The offset counter is set at the initiation of the offset period: +:math:`t_{offset} =86400\cdot n_{days\_ off}` , where +*n\ :math:`{}_{days\_off}`* is set to a constant value of 15 days. The +offset counter is decremented on each time step after initiation of the +offset period, until it reaches zero, signaling the end of the offset +period: + +.. math:: + + \label{14.70)} + t_{offset}^{n} =t_{offset}^{n-1} -\Delta t + +14.4.3 Stress-Deciduous: Long Growing Season +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Under conditions when the stress-deciduous conditions triggering offset +are not met for one year or longer, the stress-deciduous algorithm +shifts toward the evergreen behavior. This can happen in cases where a +stress-deciduous vegetation type is assigned in a climate where suitably +strong stresses occur less frequently than once per year. This condition +is evaluated by tracking the number of days since the beginning of the +most recent onset period (*n\ :math:`{}_{days\_active}`*, d). At the end +of an offset period *n\ :math:`{}_{days\_active}`* is reset to 0. A long +growing season control variable (*LGS*, range 0 to 1) is calculated as: + +.. math:: + + \label{14.71)} + LGS=\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }n_{days\_ active} <365} \\ {\left({n_{days\_ active} \mathord{\left/ {\vphantom {n_{days\_ active} 365}} \right. \kern-\nulldelimiterspace} 365} \right)-1\qquad {\rm for\; }365\le n_{days\_ active} <730} \\ {1\qquad \qquad \qquad {\rm for\; }n_{days\_ active} \ge 730} \end{array}\right. . + +The rate coefficient for background litterfall (*r\ :math:`{}_{bglf}`*, +s\ :math:`{}^{-1}`) is calculated as a function of *LGS*: + +.. math:: + + \label{14.72)} + r_{bglf} =\frac{LGS}{\tau _{leaf} \cdot 365\cdot 86400} + +where *:math:`\tau`\ :math:`{}_{leaf}`* is the leaf longevity. The +result is a shift to continuous litterfall as +*n\ :math:`{}_{days\_active}`* increases from 365 to 730. When a new +offset period is triggered *r\ :math:`{}_{bglf}`* is set to 0. + +The rate coefficient for background onset growth from the transfer pools +(*r\ :math:`{}_{bgtr}`*, s\ :math:`{}^{-1}`) also depends on *LGS*, as: + +.. math:: + + \label{14.73)} + r_{bgtr} =\frac{LGS}{365\cdot 86400} . + +On each timestep with *r\ :math:`{}_{bgtr}`* :math:`\neq` 0, carbon +fluxes from storage to transfer pools are calculated as: + +.. math:: + + \label{14.74)} + CF_{leaf\_ stor,leaf\_ xfer} =CS_{leaf\_ stor} r_{bgtr} + +.. math:: + + \label{14.75)} + CF_{froot\_ stor,froot\_ xfer} =CS_{froot\_ stor} r_{bgtr} + +.. math:: + + \label{14.76)} + CF_{livestem\_ stor,livestem\_ xfer} =CS_{livestem\_ stor} r_{bgtr} + +.. math:: + + \label{14.77)} + CF_{deadstem\_ stor,deadstem\_ xfer} =CS_{deadstem\_ stor} r_{bgtr} + +.. math:: + + \label{14.78)} + CF_{livecroot\_ stor,livecroot\_ xfer} =CS_{livecroot\_ stor} r_{bgtr} + +.. math:: + + \label{14.79)} + CF_{deadcroot\_ stor,deadcroot\_ xfer} =CS_{deadcroot\_ stor} r_{bgtr} , + +with corresponding nitrogen fluxes: + +.. math:: + + \label{14.80)} + NF_{leaf\_ stor,leaf\_ xfer} =NS_{leaf\_ stor} r_{bgtr} + +.. math:: + + \label{14.81)} + NF_{froot\_ stor,froot\_ xfer} =NS_{froot\_ stor} r_{bgtr} + +.. math:: + + \label{14.82)} + NF_{livestem\_ stor,livestem\_ xfer} =NS_{livestem\_ stor} r_{bgtr} + +.. math:: + + \label{14.83)} + NF_{deadstem\_ stor,deadstem\_ xfer} =NS_{deadstem\_ stor} r_{bgtr} + +.. math:: + + \label{14.84)} + NF_{livecroot\_ stor,livecroot\_ xfer} =NS_{livecroot\_ stor} r_{bgtr} + +.. math:: + + \label{14.85)} + NF_{deadcroot\_ stor,deadcroot\_ xfer} =NS_{deadcroot\_ stor} r_{bgtr} . + +The result, in conjunction with the treatment of background onset +growth, is a shift to continuous transfer from storage to display pools +at a rate that would result in complete turnover of the storage pools in +one year at steady state, once *LGS* reaches 1 (i.e. after two years +without stress-deciduous offset conditions). If and when conditions +cause stress-deciduous triggering again, *r\ :math:`{}_{bgtr}`* is rest +to 0. + +Litterfall Fluxes Merged to the Column Level +------------------------------------------------- + +CLM uses three litter pools, defined on the basis of commonly measured +chemical fractionation of fresh litter into labile (LIT1 = hot water and +alcohol soluble fraction), cellulose/hemicellulose (LIT2 = acid soluble +fraction) and remaining material, referred to here for convenience as +lignin (LIT3 = acid insoluble fraction) (Aber et al., 1990; Taylor et +al., 1989). While multiple plant functional types can coexist on a +single CLM soil column, each soil column includes a single instance of +the litter pools. Fluxes entering the litter pools due to litterfall are +calculated using a weighted average of the fluxes originating at the PFT +level. Carbon fluxes are calculated as: + +.. math:: + + \label{14.86)} + CF_{leaf,lit1} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{lab\_ leaf,p} wcol_{p} + +.. math:: + + \label{14.87)} + CF_{leaf,lit2} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{cel\_ leaf,p} wcol_{p} + +.. math:: + + \label{14.88)} + CF_{leaf,lit3} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{lig\_ leaf,p} wcol_{p} + +.. math:: + + \label{14.89)} + CF_{froot,lit1} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{lab\_ froot,p} wcol_{p} + +.. math:: + + \label{14.90)} + CF_{froot,lit2} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{cel\_ froot,p} wcol_{p} + +.. math:: + + \label{14.91)} + CF_{froot,lit3} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{lig\_ froot,p} wcol_{p} , + +where *f\ :math:`{}_{lab\_leaf,p}`*, *f\ :math:`{}_{cel\_leaf,p}`*, and +*f\ :math:`{}_{lig\_leaf,p}`* are the labile, cellulose/hemicellulose, +and lignin fractions of leaf litter for PFT *p*, +*f\ :math:`{}_{lab\_froot,p}`*, *f\ :math:`{}_{cel\_froot,p}`*, and +*f\ :math:`{}_{lig\_froot,p}`* are the labile, cellulose/hemicellulose, +and lignin fractions of fine root litter for PFT *p*, +*wtcol\ :math:`{}_{p}`* is the weight relative to the column for PFT +*p*, and *p* is an index through the plant functional types occurring on +a column. Nitrogen fluxes to the litter pools are assumed to follow the +C:N of the senescent tissue, and so are distributed using the same +fractions used for carbon fluxes: + +.. math:: + + \label{14.92)} + NF_{leaf,lit1} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{lab\_ leaf,p} wcol_{p} + +.. math:: + + \label{14.93)} + NF_{leaf,lit2} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{cel\_ leaf,p} wcol_{p} + +.. math:: + + \label{14.94)} + NF_{leaf,lit3} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{lig\_ leaf,p} wcol_{p} + +.. math:: + + \label{14.95)} + NF_{froot,lit1} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{lab\_ froot,p} wcol_{p} + +.. math:: + + \label{14.96)} + NF_{froot,lit2} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{cel\_ froot,p} wcol_{p} + +.. math:: + + \label{14.97)} + NF_{froot,lit3} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{lig\_ froot,p} wcol_{p} . + +.. |image| image:: image1 diff --git a/doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst b/doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst new file mode 100644 index 0000000000..eefab609fb --- /dev/null +++ b/doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst @@ -0,0 +1,797 @@ +Decomposition +================= + +Decomposition of fresh litter material into progressively more +recalcitrant forms of soil organic matter is represented in CLM is +defined as a cascade of *k\ :math:`{}_{tras}`* transformations between +*m\ :math:`{}_{pool}`* decomposing coarse woody debris (CWD), litter, +and soil organic matter (SOM) pools, each defined at +*n\ :math:`{}_{lev}`* vertical levels. CLM allows the user to define, at +compile time, between 2 contrasting hypotheses of decomposition as +embodied by two separate decomposition submodels: the CLM-CN pool +structure used in CLM4.0, or a second pool structure, characterized by +slower decomposition rates, based on the Century model (Parton et al. +1988). In addition, the user can choose, at compile time, whether to +allow *n\ :math:`{}_{lev}`* to equal 1, as in CLM4.0, or to equal the +number of soil levels used for the soil hydrology (default 10). + +Figure 15.1. Schematic of decomposition model in CLM. + +Model is structured to allow different representations of the soil C and +N decomposition cascade, as well as a vertically-explicit treatment of +soil biogeochemistry. + +|image| + +For the single-level model structure, the fundamental equation for +carbon balance of the decomposing pools is: + +.. math:: + + \label{15.1)} + \frac{\partial C_{i} }{\partial t} =R_{i} +\sum _{j\ne i}\left(i-r_{j} \right)T_{ji} k_{j} C_{j} -k_{i} C_{i} + +where *C\ :math:`{}_{i}`* is the carbon content of pool *i*, +*R\ :math:`{}_{i}`* are the carbon inputs from plant tissues directly to +pool *i* (only non-zero for CWD and litter pools), *k\ :math:`{}_{i}`* +is the decay constant of pool *i*; *T\ :math:`{}_{ji}`* is the fraction +of carbon directed from pool *j* to pool *i* with fraction +*r\ :math:`{}_{j}`* lost as a respiration flux along the way. + +Adding the vertical dimension to the decomposing pools changes the +balance equation to the following: + +.. math:: + + \label{15.2)} + \begin{array}{l} {\frac{\partial C_{i} (z)}{\partial t} =R_{i} (z)+\sum _{i\ne j}\left(1-r_{j} \right)T_{ji} k_{j} (z)C_{j} (z) -k_{i} (z)C_{i} (z)} \\ {+\frac{\partial }{\partial z} \left(D(z)\frac{\partial C_{i} }{\partial z} \right)+\frac{\partial }{\partial z} \left(A(z)C_{i} \right)} \end{array} + +where *C\ :math:`{}_{i}`\ (z)* is now defined at each model level, and +in volumetric (gC m\ :math:`{}^{-3}`) rather than areal (gC +m\ :math:`{}^{-2}`) units, along with *R\ :math:`{}_{i}`\ (z)* and +*k\ :math:`{}_{j}`\ (z)*. In addition, vertical transport is handled by +the last two terms, for diffusive and advective transport. In the base +model, advective transport is set to zero, leaving only a diffusive flux +with diffusivity *D(z)* defined for all decomposing carbon and nitrogen +pools. Further discussion of the vertical distribution of carbon inputs +*R\ :math:`{}_{i}`\ (z)*, vertical turnover times +*k\ :math:`{}_{j}`\ (z)*, and vertical transport *D(z)* is below. +Discussion of the vertical model and analysis of both decomposition +structures is in Koven et al (2013). + +Figure 15.2. Pool structure, transitions, respired fractions (numbers at +end of arrows), and turnover times (numbers in boxes) for the 2 +alternate soil decomposition models included in CLM. + +|image| + +CLM-CN Pool Structure, Rate Constants and Parameters +--------------------------------------------------------- + +The CLM-CN structure in CLM45 uses three state variables for fresh +litter and four state variables for soil organic matter (SOM). The +masses of carbon and nitrogen in the live microbial community are not +modeled explicitly, but the activity of these organisms is represented +by decomposition fluxes transferring mass between the litter and SOM +pools, and heterotrophic respiration losses associated with these +transformations. The litter and SOM pools in CLM-CN are arranged as a +converging cascade (Figure 15.2), derived directly from the +implementation in Biome-BGC v4.1.2 (Thornton et al. 2002; Thornton and +Rosenbloom, 2005). + +Model parameters are estimated based on a synthesis of microcosm +decomposition studies using radio-labeled substrates (Degens and +Sparling, 1996; Ladd et al. 1992; Martin et al. 1980; Mary et al. 1993; +Saggar et al. 1994; Sørensen, 1981; van Veen et al. 1984). Multiple +exponential models are fitted to data from the microcosm studies to +estimate exponential decay rates and respiration fractions (Thornton, +1998). The microcosm experiments used for parameterization were all +conducted at constant temperature and under moist conditions with +relatively high mineral nitrogen concentrations, and so the resulting +rate constants are assumed not limited by the availability of water or +mineral nitrogen. Table 15.1 lists the base decomposition rates for each +litter and SOM pool, as well as a base rate for physical fragmentation +for the coarse woody debris pool (CWD). + +Table 15.1. Decomposition rate constants for litter and SOM pools, C:N +ratios, and acceleration parameters (see section 15.8 for explanation) +for the CLM-CN decomposition pool structure. + ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| | Biome-BGC | CLM-CN | | | ++==========================+================================================+===============================================+===============+=========================================+ +| | *k\ :math:`{}_{disc1 }`*\ (d:math:`{}^{-1}`) | *k\ :math:`{}_{disc2}`* (hr:math:`{}^{-1}`) | *C:N ratio* | *Acceleration term (a:math:`{}_{i}`)* | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| *k\ :math:`{}_{Lit1}`* | 0.7 | 0.04892 | - | 1 | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| *k\ :math:`{}_{Lit2}`* | 0.07 | 0.00302 | - | 1 | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| *k\ :math:`{}_{Lit3}`* | 0.014 | 0.00059 | - | 1 | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| *k\ :math:`{}_{SOM1}`* | 0.07 | 0.00302 | 12 | 1 | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| *k\ :math:`{}_{SOM2}`* | 0.014 | 0.00059 | 12 | 1 | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| *k\ :math:`{}_{SOM3}`* | 0.0014 | 0.00006 | 10 | 5 | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| *k\ :math:`{}_{SOM4}`* | 0.0001 | 0.000004 | 10 | 70 | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ +| *k\ :math:`{}_{CWD}`* | 0.001 | 0.00004 | - | 1 | ++--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + +The first column of Table 15.1 gives the rates as used for the Biome-BGC +model, which uses a discrete-time model with a daily timestep. The +second column of Table 15.1 shows the rates transformed for a one-hour +discrete timestep typical of CLM-CN. The transformation is based on the +conversion of the initial discrete-time value (*k\ :math:`{}_{disc1}`*) +first to a continuous time value (*k\ :math:`{}_{cont}`*), then to the +new discrete-time value with a different timestep +(*k\ :math:`{}_{disc2}`*) , following Olson (1963): + +.. math:: + + \label{ZEqnNum608251} + k_{cont} =-\log \left(1-k_{disc1} \right) + +.. math:: + + \label{ZEqnNum772630} + k_{disc2} =1-\exp \left(-k_{cont} \frac{\Delta t_{2} }{\Delta t_{1} } \right) + +where :math:`\Delta`\ *t\ :math:`{}_{1}`* (s) and +:math:`\Delta`\ *t\ :math:`{}_{2}`* (s) are the time steps of the +initial and new discrete-time models, respectively. + +Respiration fractions are parameterized for decomposition fluxes out of +each litter and SOM pool. The respiration fraction (*rf*, unitless) is +the fraction of the decomposition carbon flux leaving one of the litter +or SOM pools that is released as CO\ :math:`{}_{2}` due to heterotrophic +respiration. Respiration fractions and exponential decay rates are +estimated simultaneously from the results of microcosm decomposition +experiments (Thornton, 1998). The same values are used in CLM-CN and +Biome-BGC (Table 15.2). + +Table 15.2. Respiration fractions for litter and SOM pools + ++---------------------------+-----------------------+ +| Pool | *rf* | ++===========================+=======================+ +| *rf\ :math:`{}_{Lit1}`* | 0.39 | ++---------------------------+-----------------------+ +| *rf\ :math:`{}_{Lit2}`* | 0.55 | ++---------------------------+-----------------------+ +| *rf\ :math:`{}_{Lit3}`* | 0.29 | ++---------------------------+-----------------------+ +| *rf\ :math:`{}_{SOM1}`* | 0.28 | ++---------------------------+-----------------------+ +| *rf\ :math:`{}_{SOM2}`* | 0.46 | ++---------------------------+-----------------------+ +| *rf\ :math:`{}_{SOM3}`* | 0.55 | ++---------------------------+-----------------------+ +| *rf\ :math:`{}_{SOM4}`* | 1.0\ :math:`{}^{a}` | ++---------------------------+-----------------------+ + +:math:`{}^{a}` The respiration fraction for pool SOM4 is 1.0 by +definition: since there is no pool downstream of SOM4, the entire carbon +flux leaving this pool is assumed to be respired as CO\ :math:`{}_{2}`. + +Century-based Pool Structure, Rate Constants and Parameters +---------------------------------------------------------------- + +The Century-based decomposition cascade is, like CLM-CN, a first-order +decay model; the two structures differ in the number of pools, the +connections between those pools, the turnover times of the pools, and +the respired fraction during each transition (Figure 15.2). The turnover +times are different for the Century-based pool structure, following +those described in Parton et al. (1988) (Table 15.3). + +Table 15.3. Turnover times, C:N ratios, and acceleration parameters (see +section 15.8 for explanation) for the Century-based decomposition +cascade. + ++------------+------------------------+-------------+-------------------------------------------+ +| | Turnover time (year) | C:N ratio | Acceleration term (*a\ :math:`{}_{i}`*) | ++============+========================+=============+===========================================+ +| CWD | 4.1 | - | 1 | ++------------+------------------------+-------------+-------------------------------------------+ +| Litter 1 | 0.066 | - | 1 | ++------------+------------------------+-------------+-------------------------------------------+ +| Litter 2 | 0.25 | - | 1 | ++------------+------------------------+-------------+-------------------------------------------+ +| Litter 3 | 0.25 | - | 1 | ++------------+------------------------+-------------+-------------------------------------------+ +| SOM 1 | 0.17 | 8 | 1 | ++------------+------------------------+-------------+-------------------------------------------+ +| SOM 2 | 6.1 | 11 | 15 | ++------------+------------------------+-------------+-------------------------------------------+ +| SOM 3 | 270 | 11 | 675 | ++------------+------------------------+-------------+-------------------------------------------+ + +Likewise, values for the respiration fraction of Century-based structure +are in Table 15.4. + +Table 15.4. Respiration fractions for litter and SOM pools for +Century-based structure + ++---------------------------+----------+ +| Pool | *rf* | ++===========================+==========+ +| *rf\ :math:`{}_{Lit1}`* | 0.55 | ++---------------------------+----------+ +| *rf\ :math:`{}_{Lit2}`* | 0.5 | ++---------------------------+----------+ +| *rf\ :math:`{}_{Lit3}`* | 0.5 | ++---------------------------+----------+ +| *rf\ :math:`{}_{SOM1}`* | f(txt) | ++---------------------------+----------+ +| *rf\ :math:`{}_{SOM2}`* | 0.55 | ++---------------------------+----------+ +| *rf\ :math:`{}_{SOM3}`* | 0.55 | ++---------------------------+----------+ + +Environmental modifiers on decomposition rate +-------------------------------------------------- + +These base rates are modified on each timestep by functions of the +current soil environment. For the single-level model, there are two rate +modifiers, temperature (*r\ :math:`{}_{tsoil}`*, unitless) and moisture +(*r\ :math:`{}_{water}`*, unitless), both of which are calculated using +the average environmental conditions of the top five model levels (top +29 cm of soil column). For the vertically-resolved model, two additional +environmental modifiers are calculated beyond the temperature and +moisture limitations: an oxygen scalar (*r\ :math:`{}_{oxygen}`*, +unitless), and a depth scalar (*r\ :math:`{}_{depth}`*, unitless). + +The Temperature scalar *r\ :math:`{}_{tsoil}`* is calculated in CLM +using a *Q\ :math:`{}_{10}`* approach, with *Q\ :math:`{}_{10}`\ =1.5:* + +.. math:: + + \label{15.5)} + r_{tsoil} =Q_{10} ^{\left(\frac{T_{soil,\, j} -T_{ref} }{10} \right)} + +where *j* is the soil layer index, *T\ :math:`{}_{soil,j}`* (K) is the +temperature of soil level *j*. The reference temperature +*T\ :math:`{}_{ref}`* = 25C. + +The rate scalar for soil water potential (*r\ :math:`{}_{water}`*, +unitless) is calculated using a relationship from Andrén and Paustian +(1987) and supported by additional data in Orchard and Cook (1983): + +.. math:: + + \label{15.6)} + r_{water} =\sum _{j=1}^{5}\left\{\begin{array}{l} {0\qquad {\rm for\; }\Psi _{j} <\Psi _{\min } } \\ {\frac{\log \left({\Psi _{\min } \mathord{\left/ {\vphantom {\Psi _{\min } \Psi _{j} }} \right. \kern-\nulldelimiterspace} \Psi _{j} } \right)}{\log \left({\Psi _{\min } \mathord{\left/ {\vphantom {\Psi _{\min } \Psi _{\max } }} \right. \kern-\nulldelimiterspace} \Psi _{\max } } \right)} w_{soil,\, j} \qquad {\rm for\; }\Psi _{\min } \le \Psi _{j} \le \Psi _{\max } } \\ {1\qquad {\rm for\; }\Psi _{j} >\Psi _{\max } \qquad \qquad } \end{array}\right\} + +where :math:`\Psi`\ *:math:`{}_{j}`* is the soil water potential in +layer *j*, :math:`\Psi`\ *:math:`{}_{min}`* is a lower limit for soil +water potential control on decomposition rate (set to -10 MPa). +:math:`\Psi`\ *:math:`{}_{sat,j}`* (MPa) is the saturated soil water +potential, calculated using the multivariate regression model from Cosby +et al. (1984): + +.. math:: + + \label{15.7)} + \Psi _{sat,\, j} =-\left(9.8e-5\right)\exp \left(\left(1.54-0.0095P_{sand,\, j} +0.0063\left(100-P_{sand,\, j} -P_{clay,\, j} \right)\right)\log \left(10\right)\right) + +where *P\ :math:`{}_{sand,j}`* and *P\ :math:`{}_{clay,j}`* are the +volume percentages of sand and clay in soil layer *j*. + +For frozen soils, the bulk of the rapid dropoff in decomposition with +decreasing temperature is due to the moisture limitation, since matric +potential is limited by temperature in the supercooled water formulation +of Niu and Yang (2006), + +.. math:: + + \label{15.8)} + \psi \left(T\right)=-\frac{L_{f} \left(T-T_{f} \right)}{10^{3} T} + +An additional frozen decomposition limitation can be specified using a +‘frozen Q\ :math:`{}_{10}`’ following Koven et al. (2011), however the +default value of this is the same as the unfrozen Q\ :math:`{}_{10}` +value, and therefore the basic hypothesis is that frozen respiration is +limited by liquid water availability, and can be modeled following the +same approach as thawed but dry soils. + +An additional rate scalar, *r\ :math:`{}_{oxygen}`* is enabled when the +CH\ :math:`{}_{4}` submodel is used (set equal to 1 for the single layer +model or when the CH\ :math:`{}_{4}` submodel is disabled). This limits +decomposition when there is insufficient molecular oxygen to satisfy +stoichiometric demand (1 mol O\ :math:`{}_{2}` consumed per mol +CO\ :math:`{}_{2}` produced) from heterotrophic decomposers, and supply +from diffusion through soil layers (unsaturated and saturated) or +aerenchyma (Chapter 19). A minimum value of *r\ :math:`{}_{oxygen}`* is +set at 0.2, with the assumption that oxygen within organic tissues can +supply the necessary stoichiometric demand at this rate. This value lies +between estimates of 0.025–0.1 (Frolking et al. 2001), and 0.35 (Wania +et al. 2009); the large range of these estimates poses a large +unresolved uncertainty. + +Lastly, a possible explicit depth dependence, *r\ :math:`{}_{depth}`*, +(set equal to 1 for the single layer model) can be applied to soil C +decomposition rates to account for processes other than temperature, +moisture, and anoxia that can limit decomposition. This depth dependence +of decomposition was shown by Jenkinson and Coleman (2008) to be an +important term in fitting total C and 14C profiles, and implies that +unresolved processes, such as priming effects, microscale anoxia, soil +mineral surface and/or aggregate stabilization may be important in +controlling the fate of carbon at depth (Koven et al. 2013). CLM +includes these unresolved depth controls via an exponential decrease in +the soil turnover time with depth: + +.. math:: + + \label{15.9)} + r_{depth} =\exp \left(-\frac{z}{z_{\tau } } \right) + +where *z\ :math:`{}_{\tau}`* is the e-folding depth for decomposition, +set by default to 0.5m. + +The combined decomposition rate scalar (*r\ :math:`{}_{total}`*, +unitless) is: + +.. math:: + + \label{15.10)} + r_{total} =r_{tsoil} r_{water} r_{oxygen} r_{depth} . + +N-limitation of Decomposition Fluxes +----------------------------------------- + +Decomposition rates can also be limited by the availability of mineral +nitrogen, but calculation of this limitation depends on first estimating +the potential rates of decomposition, assuming an unlimited mineral +nitrogen supply. The general case is described here first, referring to +a generic decomposition flux from an “upstream” pool (*u*) to a +“downstream” pool (*d*), with an intervening loss due to respiration. +The potential carbon flux out of the upstream pool +(*CF\ :math:`{}_{pot,u}`*, gC m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is: + +.. math:: + + \label{15.11)} + CF_{pot,\, u} =CS_{u} k_{u} + +where *CS\ :math:`{}_{u}`* (gC m\ :math:`{}^{-2}`) is the initial mass +in the upstream pool and *k\ :math:`{}_{u}`* is the decay rate constant +(s:math:`{}^{-1}`) for the upstream pool, adjusted for temperature and +moisture conditions. Depending on the C:N ratios of the upstream and +downstream pools and the amount of carbon lost in the transformation due +to respiration (the respiration fraction), the execution of this +potential carbon flux can generate either a source or a sink of new +mineral nitrogen +(*NF\ :math:`{}_{pot\_min,u}`\ :math:`{}_{\rightarrow}`\ :math:`{}_{d}`*, +gN m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`). The governing equation +(Thornton and Rosenbloom, 2005) is: + +.. math:: + + \label{15.12)} + NF_{pot\_ min,\, u\to d} =\frac{CF_{pot,\, u} \left(1-rf_{u} -\frac{CN_{d} }{CN_{u} } \right)}{CN_{d} } + +where *rf\ :math:`{}_{u}`* is the respiration fraction for fluxes +leaving the upstream pool, *CN\ :math:`{}_{u}`* and *CN\ :math:`{}_{d}`* +are the C:N ratios for upstream and downstream pools, respectively. +Negative values of +*NF\ :math:`{}_{pot\_min,u}`\ :math:`{}_{\rightarrow}`\ :math:`{}_{d}`* +indicate that the decomposition flux results in a source of new mineral +nitrogen, while positive values indicate that the potential +decomposition flux results in a sink (demand) for mineral nitrogen. + +Following from the general case, potential carbon fluxes leaving +individual pools in the decomposition cascade, for the example of the +CLM-CN pool structure, are given as: + +.. math:: + + \label{15.13)} + CF_{pot,\, Lit1} ={CS_{Lit1} k_{Lit1} r_{total} \mathord{\left/ {\vphantom {CS_{Lit1} k_{Lit1} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{15.14)} + CF_{pot,\, Lit2} ={CS_{Lit2} k_{Lit2} r_{total} \mathord{\left/ {\vphantom {CS_{Lit2} k_{Lit2} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{15.15)} + CF_{pot,\, Lit3} ={CS_{Lit3} k_{Lit3} r_{total} \mathord{\left/ {\vphantom {CS_{Lit3} k_{Lit3} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{15.16)} + CF_{pot,\, SOM1} ={CS_{SOM1} k_{SOM1} r_{total} \mathord{\left/ {\vphantom {CS_{SOM1} k_{SOM1} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{15.17)} + CF_{pot,\, SOM2} ={CS_{SOM2} k_{SOM2} r_{total} \mathord{\left/ {\vphantom {CS_{SOM2} k_{SOM2} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{15.18)} + CF_{pot,\, SOM3} ={CS_{SOM3} k_{SOM3} r_{total} \mathord{\left/ {\vphantom {CS_{SOM3} k_{SOM3} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +.. math:: + + \label{15.19)} + CF_{pot,\, SOM4} ={CS_{SOM4} k_{SOM4} r_{total} \mathord{\left/ {\vphantom {CS_{SOM4} k_{SOM4} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + +where the factor (1/:math:`\Delta`\ *t*) is included because the rate +constant is calculated for the entire timestep (Eqs. and ), but the +convention is to express all fluxes on a per-second basis. Potential +mineral nitrogen fluxes associated with these decomposition steps are, +again for the example of the CLM-CN pool structure (the CENTURY +structure will be similar but without the different terminal step): + +.. math:: + + \label{ZEqnNum934998} + NF_{pot\_ min,\, Lit1\to SOM1} ={CF_{pot,\, Lit1} \left(1-rf_{Lit1} -\frac{CN_{SOM1} }{CN_{Lit1} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit1} \left(1-rf_{Lit1} -\frac{CN_{SOM1} }{CN_{Lit1} } \right) CN_{SOM1} }} \right. \kern-\nulldelimiterspace} CN_{SOM1} } + +.. math:: + + \label{15.21)} + NF_{pot\_ min,\, Lit2\to SOM2} ={CF_{pot,\, Lit2} \left(1-rf_{Lit2} -\frac{CN_{SOM2} }{CN_{Lit2} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit2} \left(1-rf_{Lit2} -\frac{CN_{SOM2} }{CN_{Lit2} } \right) CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } + +.. math:: + + \label{15.22)} + NF_{pot\_ min,\, Lit3\to SOM3} ={CF_{pot,\, Lit3} \left(1-rf_{Lit3} -\frac{CN_{SOM3} }{CN_{Lit3} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit3} \left(1-rf_{Lit3} -\frac{CN_{SOM3} }{CN_{Lit3} } \right) CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } + +.. math:: + + \label{15.23)} + NF_{pot\_ min,\, SOM1\to SOM2} ={CF_{pot,\, SOM1} \left(1-rf_{SOM1} -\frac{CN_{SOM2} }{CN_{SOM1} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM1} \left(1-rf_{SOM1} -\frac{CN_{SOM2} }{CN_{SOM1} } \right) CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } + +.. math:: + + \label{15.24)} + NF_{pot\_ min,\, SOM2\to SOM3} ={CF_{pot,\, SOM2} \left(1-rf_{SOM2} -\frac{CN_{SOM3} }{CN_{SOM2} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM2} \left(1-rf_{SOM2} -\frac{CN_{SOM3} }{CN_{SOM2} } \right) CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } + +.. math:: + + \label{15.25)} + NF_{pot\_ min,\, SOM3\to SOM4} ={CF_{pot,\, SOM3} \left(1-rf_{SOM3} -\frac{CN_{SOM4} }{CN_{SOM3} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM3} \left(1-rf_{SOM3} -\frac{CN_{SOM4} }{CN_{SOM3} } \right) CN_{SOM4} }} \right. \kern-\nulldelimiterspace} CN_{SOM4} } + +.. math:: + + \label{ZEqnNum473594} + NF_{pot\_ min,\, SOM4} =-{CF_{pot,\, SOM4} \mathord{\left/ {\vphantom {CF_{pot,\, SOM4} CN_{SOM4} }} \right. \kern-\nulldelimiterspace} CN_{SOM4} } + +where the special form of Eq. arises because there is no SOM pool +downstream of SOM4 in the converging cascade: all carbon fluxes leaving +that pool are assumed to be in the form of respired CO\ :math:`{}_{2}`, +and all nitrogen fluxes leaving that pool are assumed to be sources of +new mineral nitrogen. + +Steps in the decomposition cascade that result in release of new mineral +nitrogen (mineralization fluxes) are allowed to proceed at their +potential rates, without modification for nitrogen availability. Steps +that result in an uptake of mineral nitrogen (immobilization fluxes) are +subject to rate limitation, depending on the availability of mineral +nitrogen, the total immobilization demand, and the total demand for soil +mineral nitrogen to support new plant growth. The potential mineral +nitrogen fluxes from Eqs. - are evaluated, summing all the positive +fluxes to generate the total potential nitrogen immobilization flux +(*NF\ :math:`{}_{immob\_demand}`*, gN m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`), and summing absolute values of all the negative +fluxes to generate the total nitrogen mineralization flux +(*NF\ :math:`{}_{gross\_nmin}`*, gN m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`). Since *NF\ :math:`{}_{griss\_nmin}`* is a source of +new mineral nitrogen to the soil mineral nitrogen pool it is not limited +by the availability of soil mineral nitrogen, and is therefore an actual +as opposed to a potential flux. + +N Competition between plant uptake and soil immobilization fluxes +---------------------------------------------------------------------- + +Once *NF\ :math:`{}_{immob\_demand }`* is known, the competition between +plant and microbial nitrogen demand can be resolved. Mineral nitrogen in +the soil pool (*NS\ :math:`{}_{sminn}`*, gN m\ :math:`{}^{-2}`) at the +beginning of the timestep is considered the available supply. Total +demand for mineral nitrogen from this pool +(*NF\ :math:`{}_{total\_demand}`*, gN m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`) is: + +.. math:: + + \label{15.27)} + NF_{total\_ demand} =NF_{immob\_ demand} +NF_{plant\_ demand\_ soil} + +If *NF\ :math:`{}_{total\_demand}`*\ :math:`\Delta`\ *t* :math:`<` +*NS\ :math:`{}_{sminn}`*, then the available pool is large enough to +meet both plant and microbial demand, and neither plant growth nor +immobilization steps in the decomposition cascade are limited by +nitrogen availability in the timestep. In that case, the signaling +variables *f\ :math:`{}_{plant\_demand}`* and +*f\ :math:`{}_{immob\_demand}`* are both set to 1.0, where +*f\ :math:`{}_{plant\_demand}`* is defined and used in section 15.4, and +*f\ :math:`{}_{immob\_demand}`* is the fraction of potential +immobilization demand that can be met given current supply of mineral +nitrogen. + +If *NF\ :math:`{}_{total\_demand}`*\ :math:`\Delta`\ *t* +:math:`\mathrm{\ge}` *NS\ :math:`{}_{sminn}`*, then there is not enough +mineral nitrogen to meet the combined demands for plant growth and +heterotrophic immobilization, and both of these processes proceed at +lower-than-potential rates, defined by the fractions +*f\ :math:`{}_{plant\_demand}`* and *f\ :math:`{}_{immob\_demand}`*, +where: + +.. math:: + + \label{15.28)} + f_{plant\_ demand} =f_{immob\_ demand} =\frac{NS_{sminn} }{\Delta t\, NF_{total\_ demand} } + +This treatment of competition for nitrogen as a limiting resource is +referred to a demand-based competition, where the fraction of the +available resource that eventually flows to a particular process depends +on the demand from that process in comparison to the total demand from +all processes. Processes expressing a greater demand acquire a larger +fraction of the available resource. + +Final Decomposition Fluxes +------------------------------- + +With *f\ :math:`{}_{immob\_demand}`* known, final decomposition fluxes +can be calculated. Actual carbon fluxes leaving the individual litter +and SOM pools, again for the example of the CLM-CN pool structure (the +CENTURY structure will be similar but, again without the different +terminal step), are calculated as: + +.. math:: + + \label{15.29)} + CF_{Lit1} =\left\{\begin{array}{l} {CF_{pot,\, Lit1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} >0} \\ {CF_{pot,\, Lit1} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} \le 0} \end{array}\right\} + +.. math:: + + \label{15.30)} + CF_{Lit2} =\left\{\begin{array}{l} {CF_{pot,\, Lit2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} >0} \\ {CF_{pot,\, Lit2} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} \le 0} \end{array}\right\} + +.. math:: + + \label{15.31)} + CF_{Lit3} =\left\{\begin{array}{l} {CF_{pot,\, Lit3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} >0} \\ {CF_{pot,\, Lit3} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} \le 0} \end{array}\right\} + +.. math:: + + \label{15.32)} + CF_{SOM1} =\left\{\begin{array}{l} {CF_{pot,\, SOM1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} >0} \\ {CF_{pot,\, SOM1} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} \le 0} \end{array}\right\} + +.. math:: + + \label{15.33)} + CF_{SOM2} =\left\{\begin{array}{l} {CF_{pot,\, SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} >0} \\ {CF_{pot,\, SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} \le 0} \end{array}\right\} + +.. math:: + + \label{15.34)} + CF_{SOM3} =\left\{\begin{array}{l} {CF_{pot,\, SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} >0} \\ {CF_{pot,\, SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} \le 0} \end{array}\right\} + +.. math:: + + \label{15.35)} + CF_{SOM4} =CF_{pot,\, SOM4} + +Heterotrophic respiration fluxes (losses of carbon as +CO\ :math:`{}_{2}` to the atmosphere) are: + +.. math:: + + \label{15.36)} + CF_{Lit1,\, HR} =CF_{Lit1} rf_{Lit1} + +.. math:: + + \label{15.37)} + CF_{Lit2,\, HR} =CF_{Lit2} rf_{Lit2} + +.. math:: + + \label{15.38)} + CF_{Lit3,\, HR} =CF_{Lit3} rf_{Lit3} + +.. math:: + + \label{15.39)} + CF_{SOM1,\, HR} =CF_{SOM1} rf_{SOM1} + +.. math:: + + \label{15.40)} + CF_{SOM2,\, HR} =CF_{SOM2} rf_{SOM2} + +.. math:: + + \label{15.41)} + CF_{SOM3,\, HR} =CF_{SOM3} rf_{SOM3} + +.. math:: + + \label{15.42)} + CF_{SOM4,\, HR} =CF_{SOM4} rf_{SOM4} + +Transfers of carbon from upstream to downstream pools in the +decomposition cascade are given as: + +.. math:: + + \label{15.43)} + CF_{Lit1,\, SOM1} =CF_{Lit1} \left(1-rf_{Lit1} \right) + +.. math:: + + \label{15.44)} + CF_{Lit2,\, SOM2} =CF_{Lit2} \left(1-rf_{Lit2} \right) + +.. math:: + + \label{15.45)} + CF_{Lit3,\, SOM3} =CF_{Lit3} \left(1-rf_{Lit3} \right) + +.. math:: + + \label{15.46)} + CF_{SOM1,\, SOM2} =CF_{SOM1} \left(1-rf_{SOM1} \right) + +.. math:: + + \label{15.47)} + CF_{SOM2,\, SOM3} =CF_{SOM2} \left(1-rf_{SOM2} \right) + +.. math:: + + \label{15.48)} + CF_{SOM3,\, SOM4} =CF_{SOM3} \left(1-rf_{SOM3} \right) + +In accounting for the fluxes of nitrogen between pools in the +decomposition cascade and associated fluxes to or from the soil mineral +nitrogen pool, the model first calculates a flux of nitrogen from an +upstream pool to a downstream pool, then calculates a flux either from +the soil mineral nitrogen pool to the downstream pool (immobilization) +or from the downstream pool to the soil mineral nitrogen pool +(mineralization). Transfers of nitrogen from upstream to downstream +pools in the decomposition cascade are given as: + +.. math:: + + \label{15.49)} + NF_{Lit1,\, SOM1} ={CF_{Lit1} \mathord{\left/ {\vphantom {CF_{Lit1} CN_{Lit1} }} \right. \kern-\nulldelimiterspace} CN_{Lit1} } + +.. math:: + + \label{15.50)} + NF_{Lit2,\, SOM2} ={CF_{Lit2} \mathord{\left/ {\vphantom {CF_{Lit2} CN_{Lit2} }} \right. \kern-\nulldelimiterspace} CN_{Lit2} } + +.. math:: + + \label{15.51)} + NF_{Lit3,\, SOM3} ={CF_{Lit3} \mathord{\left/ {\vphantom {CF_{Lit3} CN_{Lit3} }} \right. \kern-\nulldelimiterspace} CN_{Lit3} } + +.. math:: + + \label{15.52)} + NF_{SOM1,\, SOM2} ={CF_{SOM1} \mathord{\left/ {\vphantom {CF_{SOM1} CN_{SOM1} }} \right. \kern-\nulldelimiterspace} CN_{SOM1} } + +.. math:: + + \label{15.53)} + NF_{SOM2,\, SOM3} ={CF_{SOM2} \mathord{\left/ {\vphantom {CF_{SOM2} CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } + +.. math:: + + \label{15.54)} + NF_{SOM3,\, SOM4} ={CF_{SOM3} \mathord{\left/ {\vphantom {CF_{SOM3} CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } + +Corresponding fluxes to or from the soil mineral nitrogen pool depend on +whether the decomposition step is an immobilization flux or a +mineralization flux: + +.. math:: + + \label{15.55)} + NF_{sminn,\, Lit1\to SOM1} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit1\to SOM1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} >0} \\ {NF_{pot\_ min,\, Lit1\to SOM1} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} \le 0} \end{array}\right\} + +.. math:: + + \label{15.56)} + NF_{sminn,\, Lit2\to SOM2} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit2\to SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} >0} \\ {NF_{pot\_ min,\, Lit2\to SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} \le 0} \end{array}\right\} + +.. math:: + + \label{15.57)} + NF_{sminn,\, Lit3\to SOM3} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit3\to SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} >0} \\ {NF_{pot\_ min,\, Lit3\to SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} \le 0} \end{array}\right\} + +.. math:: + + \label{15.58)} + NF_{sminn,SOM1\to SOM2} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM1\to SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} >0} \\ {NF_{pot\_ min,\, SOM1\to SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} \le 0} \end{array}\right\} + +.. math:: + + \label{15.59)} + NF_{sminn,SOM2\to SOM3} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM2\to SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} >0} \\ {NF_{pot\_ min,\, SOM2\to SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} \le 0} \end{array}\right\} + +.. math:: + + \label{15.60)} + NF_{sminn,SOM3\to SOM4} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM3\to SOM4} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} >0} \\ {NF_{pot\_ min,\, SOM3\to SOM4} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} \le 0} \end{array}\right\} + +.. math:: + + \label{15.61)} + NF_{sminn,\, SOM4} =NF_{pot\_ min,\, SOM4} + +Vertical Distribution and Transport of Decomposing C and N pools +--------------------------------------------------------------------- + +Additional terms are needed to calculate the vertically-resolved soil C +and N budget: the initial vertical distribution of C and N from PFTs +delivered to the litter and CWD pools, and the vertical transport of C +and N pools. + +For initial vertical inputs, CLM uses separate profiles for aboveground +(leaf, stem) and belowground (root) inputs. Aboveground inputs are given +a single exponential with default e-folding depth = 0.1m. Belowground +inputs are distributed according to rooting profiles with default values +based on the Jackson et al. (1996) exponential parameterization. + +Vertical mixing is accomplished by an advection-diffusion equation. The +goal of this is to consider slow, soild- and adsorbed-phase transport +due to bioturbation, cryoturbation, and erosion. Faster aqueous-phase +transport is not included in CLM, but has been developed as part of the +CLM-BeTR suite of parameterizations (Tang and Riley 2013). The default +value of the advection term is 0 cm/yr, such that transport is purely +diffusive. Diffusive transport differs in rate between permafrost soils +(where cryoturbation is the dominant transport term) and non-permafrost +soils (where bioturbation dominates). For permafrost soils, a +parameterization based on that of Koven et al. (2009) is used: the +diffusivity parameter is constant through the active layer, and +decreases linearly from the base of the active layer to zero at a set +depth (default 3m); the default permafrost diffusivity is 5 +cm\ :math:`{}^{2}`/yr. For non-permafrost soils, the default diffusivity +is 1 cm\ :math:`{}^{2}`/yr. + +Model Equilibration +------------------------ + +Because of the coupling between the slowest SOM pools and productivity +through N downregulation of photosynthesis, equilibration of the model +for initialization purposes will take an extremely long time in the +standard mode. This is particularly true for the CENTURY-based +decomposition cascade, which includes a passive pool. In order to +rapidly equilibrate the model, a modified version of the “accelerated +decomposition” (Thornton and Rosenbloom, 2005) is used. The fundamental +idea of this approach is to allow fluxes between the various pools (both +turnover-defined and vertically-defined fluxes) adjust rapidly, while +keeping the pool sizes themselves small so that they can fill quickly. +To do this, the base decomposition rate *k\ :math:`{}_{i}`* for each +pool *i* is accelerated by a term *a\ :math:`{}_{i}`* such that the slow +pools are collapsed onto an approximately annual timescale (Koven et al. +2013). Accelerating the pools beyond this timescale distorts the +seasonal and/or diurnal cycles of decomposition and N mineralization, +thus leading to a substantially different ecosystem productivity than +the full model. For the vertical model, the vertical transport terms are +also accelerated by the same term *a\ :math:`{}_{i}`*, as is the +radioactive decay when :math:`{}^{14}`\ C is enabled, following the same +principle of keeping fluxes between pools (or fluxes lost to decay) +close to the full model while keeping the pools sizes small. When +leaving the accelerated decomposition mode, the concentration of C and N +in pools that had been accelerated are multiplied by the same term +*a\ :math:`{}_{i}`*, to bring the model into approximate equilibrium. +Note that in CLM, the model can also transition into accelerated +decomposition mode from the standard mode (by dividing the pools by +*a\ :math:`{}_{i}`*), and that the transitions into and out of +accelerated decomposition mode are handled automatically by CLM upon +loading from restart files (which preserve information about the mode of +the model when restart files were written). + +The acceleration terms for the two decomposition cascades are shown in +Tables 15.1 and 15.3. + +.. |image| image:: image1 +.. |image| image:: image2 diff --git a/doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst b/doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst new file mode 100644 index 0000000000..b6dd7a2b1a --- /dev/null +++ b/doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst @@ -0,0 +1,397 @@ +.. math:: 1 + +.. math:: 1 + +External Nitrogen Cycle +=========================== + +In addition to the relatively rapid cycling of nitrogen within the plant +– litter – soil organic matter system, CLM also represents several slow +processes which couple the internal nitrogen cycle to external sources +and sinks. Inputs of new mineral nitrogen are from atmospheric +deposition and biological nitrogen fixation. Losses of mineral nitrogen +are due to nitrification, denitrification, leaching, and losses in fire. +While the short-term dynamics of nitrogen limitation depend on the +behavior of the internal nitrogen cycle, establishment of total +ecosystem nitrogen stocks depends on the balance between sources and +sinks in the external nitrogen cycle. + +CLM includes two separate treatments of the slow nitrogen cycle. The +first is the original CLM-CN formulations, which includes a single soil +mineral nitrogen pool to represent both +NO\ :math:`{}_{3}`\ :math:`{}^{-}` and +NH\ :math:`{}_{4}`\ :math:`{}^{+}`, and with nitrogen losses via +denitrification calculated as a constant fraction of mineralization plus +a fixed first-order loss of unutilized mineral nitrogen at the end of +every timestep. The second is based on the Century N-gas model; this +includes separate NH\ :math:`{}_{4}`\ :math:`{}^{+}` and +NO\ :math:`{}_{3}`\ :math:`{}^{-}`\ :math:`{}^{ }`\ pools, as well as +environmentally controlled nitrification and denitrification rates. Both +are described below. + +Atmospheric Nitrogen Deposition +------------------------------------ + +CLM uses a single variable to represent the total deposition of mineral +nitrogen onto the land surface, combining wet and dry deposition of +NO\ :math:`{}_{y}` and NH\ :math:`{}_{x}` as a single flux +(*NF\ :math:`{}_{ndep\_sminn}`*, gN m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`). This flux is intended to represent total reactive +nitrogen deposited to the land surface which originates from the +following natural and anthropogenic sources (Galloway et al. 2004): +formation of NO\ :math:`{}_{x}` during lightning, +NO\ :math:`{}_{x }`\ and NH\ :math:`{}_{3}` emission from wildfire, +NO\ :math:`{}_{x}` emission from natural soils, NH\ :math:`{}_{3}` +emission from natural soils, vegetation, and wild animals, +NO\ :math:`{}_{x}` and NH\ :math:`{}_{3}` emission during fossil fuel +combustion (both thermal and fuel NO\ :math:`{}_{x}` production), +NO\ :math:`{}_{x}` and NH\ :math:`{}_{3}` emission from other industrial +processes, NO\ :math:`{}_{x}` and NH\ :math:`{}_{3}` emission from fire +associated with deforestation, NO\ :math:`{}_{x}` and NH\ :math:`{}_{3}` +emission from agricultural burning, NO\ :math:`{}_{x}` emission from +agricultural soils, NH\ :math:`{}_{3}` emission from agricultural crops, +NH\ :math:`{}_{3}` emission from agricultural animal waste, and +NH\ :math:`{}_{3}` emission from human waste and waste water. The +deposition flux is provided as a spatially and (potentially) temporally +varying dataset (see section 2.2.3 for a description of the default +input dataset). + +In the CLM-CN mineral N pool model, the nitrogen deposition flux is +assumed to enter the soil mineral nitrogen pool +(*NS\ :math:`{}_{sminn}`*) directly; while in the Century-based model, +all of the nitrogen is assumed to enter the +NH\ :math:`{}_{4}`\ :math:`{}^{+}` pool. Real pathways for wet and dry +nitrogen deposition can be more complex than currently represented in +the CLM-CN, including release from melting snowpack and direct foliar +uptake of deposited NO\ :math:`{}_{y}` (e.g. Tye et al. 2005; Vallano +and Sparks, 2007). + +Biological Nitrogen Fixation +--------------------------------- + +The fixation of new reactive nitrogen from atmospheric N\ :math:`{}_{2}` +by soil microorganisms is an important component of both preindustrial +and modern-day nitrogen budgets, but a mechanistic understanding of +global-scale controls on biological nitrogen fixation (BNF) is still +only poorly developed (Cleveland et al. 1999; Galloway et al. 2004). +Cleveland et al. (1999) suggested empirical relationships that predict +BNF as a function of either evapotranspiration rate or net primary +productivity for natural vegetation. CLM assumes that BNF is a function +of net primary production (*CF\ :math:`{}_{ann\_NPP}`*, gC +m\ :math:`{}^{-2}` y\ :math:`{}^{-1}`). The rationale for choosing net +primary production over evapotranspiration as the predictor is that the +two are well-correlated (Parton et al. 1993; Running et al. 1989), and +the use of primary production also introduces a known dependence of BNF +on the carbon supply to nitrogen fixing microorganisms (Cleveland et al. +1999). The expression used is: + +.. math:: + + \label{ZEqnNum802819} + NF_{nfix,sminn} ={1.8\left(1-\exp \left(-0.003{\kern 1pt} CF_{ann\_ NPP} \right)\right)\mathord{\left/ {\vphantom {1.8\left(1-\exp \left(-0.003{\kern 1pt} CF_{ann\_ NPP} \right)\right) \left(86400\cdot 365\right)}} \right. \kern-\nulldelimiterspace} \left(86400\cdot 365\right)} + +where *NF\ :math:`{}_{nfix,sminn}`* (gN m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`) is the rate of BNF. Eq. is plotted over a range of +annual NPP in Figure 16.1. + +Figure 16.1. Biological nitrogen fixation as a function of annual net +primary production. + +|image| + +Because of the empirical nature of this NPP-BNF relationship, the +timescale for calculating NPP and thus BNF is unconstrained. Using +annual NPP, as in CLM4.0, introduces an error at high latitudes because +the aseasonal BNF inputs mean that much of the nitrogen is added when +the vegetation is dormant and may be lost before it is ever taken up by +vegetation. Thus an option was added to CLM to allow for an exponential +relaxation (with default e-folding time of 10 days) calculation of NPP, +and BNF calculated from that using equation 16.1. + +As with Atmospheric N deposition, BNF N inputs are added directly to the +mineral N pools. In the CLM-CN N model, this is the single mineral N +pool; in the Century-based model, this is the +NH\ :math:`{}_{4}`\ :math:`{}^{+}` pool. + +Nitrification and Denitrification Losses of Nitrogen +--------------------------------------------------------- + +In order to better understand the structural uncertainty in +biogeochemical responses to climate change, CLM includes two alternate +representations of the mineral N transformations and losses that define +the slow N cycle. Each of these is described below. + +16.3.1 CLM-CN formulation +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Under aerobic conditions in the soil oxygen is the preferred electron +acceptor supporting the metabolism of heterotrophs, but anaerobic +conditions favor the activity of soil heterotrophs which use nitrate as +an electron acceptor (e.g. *Pseudomonas* and *Clostridium*) supporting +respiration. This process, known as denitrification, results in the +transformation of nitrate to gaseous N\ :math:`{}_{2}`, with smaller +associated production of NO\ :math:`{}_{x}` and N\ :math:`{}_{2}`\ O. It +is typically assumed that nitrogen fixation and denitrification were +approximately balanced in the preindustrial biosphere (Galloway et al. +2004). It is likely that denitrification can occur within anaerobic +microsites within an otherwise aerobic soil environment, leading to +large global denitrification fluxes even when fluxes per unit area are +rather low (Galloway et al. 2004). + +Because the vertical distribution of soil organic matter is not resolved +explicitly in CLM-CN, a simple denitrification parameterization is used +that treats denitrification as a constant fraction of gross nitrogen +mineralization. At each step in the decomposition cascade, if the +transformation from an upstream to a downstream pool is predicted to +mineralize (as opposed to immobilize) nitrogen, then a constant fraction +of the nitrogen mineralization flux is assumed to be lost via +denitrification. Due to large uncertainties in the mechanistic +understanding of the environmental controls on denitrification, no +modifications to the denitrification fraction are made for different +soil moisture conditions. This is identified as a high-priority area for +future model development. + +Denitrification fluxes associated with gross mineralization in the +decomposition cascade are calculated as follows: + +.. math:: + + \label{16.2)} + NF_{denit,Lit1\to SOM1} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit1\to SOM1} >0} \\ {-NF_{pot\_ min,Lit1\to SOM1} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit1\to SOM1} \le 0} \end{array}\right. + +.. math:: + + \label{16.3)} + NF_{denit,Lit2\to SOM2} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit2\to SOM2} >0} \\ {-NF_{pot\_ min,Lit2\to SOM2} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit2\to SOM2} \le 0} \end{array}\right. + +.. math:: + + \label{16.4)} + NF_{denit,Lit3\to SOM3} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit3\to SOM3} >0} \\ {-NF_{pot\_ min,Lit3\to SOM3} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit3\to SOM3} \le 0} \end{array}\right. + +.. math:: + + \label{16.5)} + NF_{denit,SOM1\to SOM2} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM1\to SOM2} >0} \\ {-NF_{pot\_ min,SOM1\to SOM2} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM1\to SOM2} \le 0} \end{array}\right. + +.. math:: + + \label{16.6)} + NF_{denit,SOM2\to SOM3} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM2\to SOM3} >0} \\ {-NF_{pot\_ min,SOM2\to SOM3} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM2\to SOM3} \le 0} \end{array}\right. + +.. math:: + + \label{16.7)} + NF_{denit,SOM3\to SOM4} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM3\to SOM4} >0} \\ {-NF_{pot\_ min,SOM3\to SOM4} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM3\to SOM4} \le 0} \end{array}\right. + +.. math:: + + \label{16.8)} + NF_{denit,SOM4} =-NF_{pot\_ min,SOM4} + +where *f\ :math:`{}_{denit}`* = 0.01 is the constant denitrification +fraction of gross mineralization, and the denitrification fluxes are +assumed to be leaving the soil mineral nitrogen pool +(*NS\ :math:`{}_{sminn}`*) and entering the atmosphere. The speciation +of gaseous nitrogen fluxes entering the atmosphere (e.g. +N\ :math:`{}_{2}` vs. NO\ :math:`{}_{x}` or N\ :math:`{}_{2}`\ O) is not +specified. Providing an explicit speciation of these nitrogen losses is +another high-priority area for future model development. + +The model includes one other denitrification pathway, intended to +represent the observed losses of mineral nitrogen in systems +experiencing nitrogen saturation. One reason this mechanism has been +included is in anticipation of an agricultural fertilization flux, +provided either through a prescribed dataset or through a prognostic +agricultural management routine. The model does not currently include an +explicit representation of the fertilization flux, but when it is +introduced, it will be necessary to account for the substantial +denitrification losses associated with high nitrate concentrations in +some heavily fertilized agricultural soils. Nitrogen saturation can also +occur in natural vegetation systems, especially under conditions of high +atmospheric nitrogen deposition, and so this mechanism plays a useful +role even prior to the introduction within the model of agricultural +fertilization. + +For the purpose of this calculation, nitrogen saturation is evaluated on +each timestep, by comparing the total demand for new mineral nitrogen +from plants and immobilization with the available soil mineral nitrogen +pool. The denitrification of excess soil mineral nitrogen is non-zero +whenever the supply of mineral nitrogen exceeds the demand: + +.. math:: + + \label{16.9)} + NF_{sminn,denit} =\left\{\begin{array}{l} {\left(\frac{NS_{sminn} }{\Delta t} \right)-NF_{total\_ demand} f_{dnx} \qquad {\rm for\; }NF_{total\_ demand} \Delta tB_{up} } \end{array} + +where :math:`B_{ag}` (g C m\ :math:`{}^{--2}`) is the aboveground +biomass of combined leaf, stem and aboveground litter (leaf litter and +woody debris) pools; :math:`B_{low}` \ =155 g C m\ :math:`{}^{--2 }`\ is +the lower fuel threshold below which fire does not occur; +:math:`B_{up}` \ = 1050 g C m\ :math:`{}^{--2}` is the upper fuel +threshold above which fire occurrence is not limited by fuel +availability. **** + +Fuel combustibility :math:`f_{m}` is estimated by + +.. math:: + + \label{18.7)} + f_{m} =f_{RH} f_{\theta } f_{T} + +where\ :math:`f_{RH}` , **:math:`f_{\theta }` **, :math:`f_{T}` +represent the dependence of fuel combustibility on relative humidity +*RH* (%), surface soil wetness :math:`\theta` , and surface air +temperature *T* (ºC), respectively.\ :math:`f_{RH}` is calculated by + +.. math:: + + \label{18.8)} + f_{RH} =\left\{\begin{array}{cccc} {1} & {} & {} & {RH\le RH_{low} } \\ {\frac{RH_{up} -RH}{RH_{up} -RH_{low} } ,} & {} & {} & {RH_{low} 0.1` person km\ :math:`{}^{-2}`, we parameterize the +fraction of anthropogenic and natural fires unsuppressed by human +activities as + +.. math:: + + \label{18.10)} + f_{se,o} =f_{d} f_{e} + +where *f\ :math:`{}_{d}`* and *:math:`{}_{ }`\ f\ :math:`{}_{e}`* are +the effects of the demographic and economic conditions on fire +occurrence. The demographic influence on fire occurrence is + +.. math:: + + \label{18.11)} + f_{d} =0.01+0.98\exp (-0.025D_{P} ). + +For shrub and grass PFTs, the economic influence on fire occurrence is +parameterized as a function of Gross Domestic Product GDP (k 1995US$ +capita\ :math:`{}^{-1}`): + +.. math:: + + \label{18.12)} + f_{e} =0.1+0.9\times \exp [-\pi (\frac{GDP}{8} )^{0.5} ] + +which captures 73% of the observed MODIS fire counts with variable GDP +in regions where shrub and grass PFTs are dominant (fractional coverage +of shrub and grass PFTs :math:`>` 50%). In regions outside tropical +closed forests and dominated by trees (fractional coverage of tree PFTs +:math:`>` 50%), we divide the MODIS fire counts into only two bins +(:math:`GDP\ge 20` k 1995US$ capita\ :math:`{}^{-1}`, and :math:`GDP<20` +k 1995US$ capita\ :math:`{}^{-1}`) and parameterize the economic +influence on fire occurrence for tree PFTs as + +.. math:: + + \label{18.13)} + f_{e} =\left\{\begin{array}{cc} {0.39,} & {GDP\ge 20} \\ {1} & {GDP<20} \end{array}\right. + +to reproduce that the MODIS fire counts in tree-dominated regions of +GDP\ :math:`\ge 20` k 1995US$ capita\ :math:`{}^{-1}` is 39% of that in +other **** tree-dominated regions. + +18.1.2 Average spread area of a fire +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Fire fighting capacity depends on socioeconomic conditions and affects +fire spread area. Due to a lack of observations, we consider the +socioeconomic impact on the average burned area rather than separately +on fire spread rate and fire duration: + +.. math:: + + \label{18.14)} + a=a^{*} F_{se} + +where :math:`a^{*}` is the average burned area of a fire without +anthropogenic suppression and :math:`F_{se}` is the socioeconomic +effect on fire spread area. + +Average burned area of a fire without anthropogenic suppression is +assumed elliptical in shape with the wind direction along the major axis +and the point of ignition at one of the foci. According to the area +formula for an ellipse, average burned area of a fire can be represented +as: + +.. math:: + + \label{18.15)} + a^{*} =\pi \frac{l}{2} \frac{w}{2} \times 10^{-6} =\frac{\pi u_{p}^{2} \tau ^{2} }{4L_{B} } (1+\frac{1}{H_{B} } )^{2} \times 10^{-6} + +where :math:`u_{p}` \ (m s\ :math:`{}^{--1}`) is the fire spread rate in +the downwind direction; :math:`\tau` \ (s) is average fire +duration;\ :math:`L_{B}` and :math:`H_{B}` are length-to-breadth ratio +and head-to-back ratio of the ellipse; 10\ :math:`{}^{-6 }`\ converts +m\ :math:`{}^{2}` to km\ :math:`{}^{2}`. + +According to Arora and Boer (2005), + +.. math:: + + \label{ZEqnNum696342} + L_{B} =1.0+10.0[1-\exp (-0.06W)] + +where :math:`W`\ (m s\ :math:`{}^{--1}`) is the wind speed. According to +the mathematical properties of the ellipse, the head-to-back ratio +:math:`H_{B}` is + +.. math:: + + \label{ZEqnNum179757} + H_{B} =\frac{u_{p} }{u_{b} } =\frac{L_{B} +(L_{B} ^{2} -1)^{0.5} }{L_{B} -(L_{B} ^{2} -1)^{0.5} } . + +The fire spread rate in the downwind direction is represented as + +.. math:: + + \label{18.18)} + u_{p} =u_{\max } C_{m} g(W) + + (Arora and Boer, 2005), where :math:`u_{\max }` (m +s\ :math:`{}^{--1}`) is the PFT-dependent average maximum fire spread +rate in natural vegetation regions; :math:`C_{m}` and :math:`g(W)` +represent the dependence of :math:`u_{p}` on fuel wetness and wind +speed :math:`W`, respectively. :math:`u_{\max }` is set to 0.55 m +s\ :math:`{}^{--1 }`\ for grass PFTs, 0.46 m s\ :math:`{}^{--1}` for +shrub PFTs, 0.43 m s\ :math:`{}^{--1}` for\ :math:`{}^{ }`\ needleleaf +tree PFTs, and 0.40 m s\ :math:`{}^{--1}` for other tree PFTs. +:math:`C_{m} =C_{\beta } C_{RH}` is estimated by the dependence of +:math:`u_{p}` \ on root zone soil wetness (:math:`C_{\beta }` ) and +relative humidity (:math:`C_{RH}` ). Here,\ :math:`\beta` is a root +zone soil moisture limitation function. Due to a lack of observations to +calibrate :math:`C_{\beta }` , we adopt a simple linear function, where +:math:`\beta _{low}` \ =0.3 and :math:`\beta _{up}` \ =0.7 are the lower +and upper thresholds of root zone soil wetness, respectively. +**:math:`C_{RH}` ** is set equal to :math:`f_{RH}` . :math:`g(W)` is +derived from the mathematical properties of the ellipse and Eqs and + +.. math:: + + \label{18.19)} + g(W)=\frac{2L_{B} }{1+\frac{1}{H_{B} } } g(0). + +Since g(\ *W*)=1.0, and\ :math:`L_{B}` and :math:`H_{B}` are at their +maxima\ :math:`L_{B} ^{\max } =11.0`\ and :math:`H_{B} ^{\max } =482.0` +when :math:`W\to \infty` , g(0) can be derived as + +.. math:: + + \label{18.20)} + g(0)=\frac{1+\frac{1}{H_{B} ^{\max } } }{2L_{B} ^{\max } } =0.05. + +In the absence of globally gridded data on barriers to fire (e.g. +rivers, lakes, roads, firebreaks) and human fire-fighting efforts, +average fire duration is simply assumed equal to 1 which is the observed +2001–2004 mean persistence of most fires in the world (Giglio et al. +2006). + +As with the socioeconomic influence on fire occurrence, we assume that +the socioeconomic influence on fire spreading is negligible in regions +of\ :math:`D_{p} \le 0.1` person km\ :math:`{}^{-2}`, i.e., +:math:`F_{se} =1.0`. In regions of :math:`D_{p} >0.1` person +km\ :math:`{}^{-2}`, we parameterize such socioeconomic influence as: + +.. math:: + + \label{18.21)} + F_{se} =F_{d} F_{e} + +where *F\ :math:`{}_{d}`* and\ *:math:`{}_{ }`\ F\ :math:`{}_{e}`* are +effects of the demographic and economic conditions on the average spread +area of a fire, and are identified by maximizing the explained +variability of the GFED3 burned area fraction with both socioeconomic +indices in grid cells with various dominant vegetation types. For shrub +and grass PFTs, the demographic impact factor is + +.. math:: + + \label{ZEqnNum900584} + F_{d} =0.2+0.8\times \exp [-\pi (\frac{D_{p} }{450} )^{0.5} ] + +and the economic impact factor is + +.. math:: + + \label{ZEqnNum213480} + F_{e} =0.2+0.8\times \exp (-\pi \frac{GDP}{7} ). + +For tree PFTs outside tropical closed forests, the demographic and +economic impact factors are given as + +.. math:: + + \label{18.24)} + F_{d} =0.4+0.6\times \exp (-\pi \frac{D_{p} }{125} ) + +and + +.. math:: + + \label{ZEqnNum543524} + F_{e} =\left\{\begin{array}{cc} {0.62,} & {GDP>20} \\ {0.83,} & {8`\ *T\ :math:`{}_{f}`* if no agricultural fires occurred +earlier in the year; *f\ :math:`{}_{t}`* is set to 0 otherwise. Peak +month in this dataset correlates with the month after harvesting or the +month before planting. In CLM we use this dataset the same way whether +the CROP option is active or not, without regard to the CROP option’s +simulated planting and harvesting dates. + +In the post-fire region, fire impact is parameterized similar to section +18.1.3 but with combustion completeness factors and tissue mortality +factors for crop PFTs (Table 18.1). + +Deforestation fires +------------------------ + +CLM focuses on deforestation fires in tropical closed forests. Tropical +closed forests are defined as grid cells with tropical tree coverage +:math:`>`\ 60% according to the FAO classification. Deforestation fires +are defined as fires caused by deforestation, including escaped +deforestation fires, termed degradation fires. Deforestation and +degradation fires are assumed to occur outside of cropland areas in +these grid cells. Burned area is controlled by the deforestation rate +and climate: + +.. math:: + + \label{18.34)} + A_{b} =bf_{lu} f_{cli,d} A_{g} + +where *b* (time step)\ :math:`{}^{-1 }`\ is a global constant; +:math:`f_{lu}` (fraction) represents the effect of decreasing +fractional coverage of tree PFTs derived from land use data; and +:math:`f_{cli,d}` (fraction) represents the effect of climate +conditions on the burned area. + +Constants *b* and\ :math:`{}^{ }`\ :math:`{}^{f_{lu} }` are calibrated +based on observations and reanalysis datasets in the Amazon rainforest +(tropical closed forests within 15.5ºS\ :math:`\mathrm{-}`\ 10.5ºN, +30.5ºW\ :math:`\mathrm{-}`\ 91ºW). *b=*\ 0.035 d\ :math:`{}^{-1}` and +:math:`f_{lu}` is defined as + +.. math:: + + \label{18.35)} + f_{lu} =\max (0.0005,0.19D-0.0011) + +where :math:`D`\ (yr:math:`{}^{-1}`) is the annual loss of tree cover +based on CLM4’s land use and land cover change data. + +The effect of climate on deforestation fires is parameterized as: + +.. math:: + + \label{ZEqnNum336915} + \begin{array}{l} {f_{cli,d} =\max [0,\min (1,\frac{b_{2} -P_{60d} }{b_{2} } )]^{0.5} \max [0,\min (1,\frac{b_{3} -P_{10d} }{b_{3} } )]^{0.5} } \\ {\qquad \max [0,\min (1,\frac{0.25-P}{0.25} )]} \end{array} + +where\ :math:`P`\ (mm d\ :math:`{}^{-1}`) is instantaneous +precipitation, while :math:`P_{60d}` (mm d\ :math:`{}^{-1}`) and +:math:`P_{10d}` (mm d\ :math:`{}^{-1}`) are 60-day and 10-day running +means of precipitation, respectively; :math:`b_{2}` (mm +d\ :math:`{}^{-1}`) and :math:`b_{3}` (mm d\ :math:`{}^{-1}`) are the +grid-cell dependent thresholds of :math:`P_{60d}` and :math:`P_{10d}` ; +0.25 mm d\ :math:`{}^{-1}` is the maximum precipitation rate for +drizzle. Le Page et al. (2010) analyzed the relationship between +large-scale deforestation fire counts and precipitation during +2003\ :math:`\mathrm{-}`\ 2006 in southern Amazonia where tropical +evergreen trees (BET Tropical) are dominant. Figure 2 in Le Page et al. +(2010) showed that fires generally occurred if both :math:`P_{60d}` and +:math:`P_{10d}` were less than about 4.0 mm d\ :math:`{}^{-1}`, and +fires occurred more frequently in a drier environment. Based on the +30-yr (1985:math:`\mathrm{-}`\ 2004) precipitation data in Qian et al. +(2006), the climatological precipitation of dry months (P:math:`<`\ 4.0 +mm d\ :math:`{}^{-1}`) in a year over tropical deciduous tree (BDT +Tropical) dominated regions is 46% of that over BET Tropical dominated +regions, so we set the PFT-dependent thresholds of :math:`P_{60d}` and +:math:`P_{10d}` as 4.0 mm d\ :math:`{}^{-1}` for BET Tropical and 1.8 +mm d\ :math:`{}^{-1}` (= 4.0 mm d\ :math:`{}^{-1}` :math:`\times` 46%) +for BDT Tropical, and *b\ :math:`{}_{2}`* and *b\ :math:`{}_{3}`* are +the average of thresholds of BET Tropical and BDT Tropical weighted by +their coverage. + +The post-fire area due to deforestation is not limited to land-type +conversion regions. In the tree-reduced region, the maximum fire carbon +emissions are assumed to be 80% of the total conversion flux. According +to the fraction of conversion flux for tropical trees in the +tree-reduced region (60%) assigned by CLM, to reach the maximum fire +carbon emissions in a conversion region requires burning this region +about twice when we set PFT-dependent combustion completeness factors to +about 0.3 for stem [the mean of 0.2\ :math:`\mathrm{-}`\ 0.4 used in van +der Werf (2010)]. Therefore, when the burned area calculated from Eq. is +no more than twice the tree-reduced area, we assume no escaped fires +outside the land-type conversion region, and the fire-related fraction +of the total conversion flux is estimated as +:math:`\frac{A_{b} /A_{g} }{2D}` . Otherwise, 80% of the total +conversion flux is assumed to be fire carbon emissions, and the biomass +combustion and vegetation mortality outside the tree-reduced regions +with an area fraction of :math:`\frac{A_{b} }{A_{g} } -2D` are set as in +section 18.1.3. + +Peat fires +--------------- + +The burned area due to peat fires is given as *A\ :math:`{}_{b}`*: + +.. math:: + + \label{18.37)} + A_{b} =cf_{cli,p} f_{peat} (1-f_{sat} )A_{g} + +where *c* (time step)\ :math:`{}^{-1}` is a constant; :math:`f_{cli,p}` +represents the effect of climate on the burned area;\ :math:`f_{peat}` +is the fractional coverage of peatland in the grid cell; and +:math:`f_{sat}` is the fraction of the grid cell with a water table at +the surface or higher. *c*\ =1.0\ :math:`\times`\ 10\ :math:`{}^{-3}` +hr\ :math:`{}^{-1 }`\ for tropical peat fires and +*c*\ =4.2\ :math:`\times`\ 10\ :math:`{}^{-5}`\ :math:`{}^{ }`\ hr\ :math:`{}^{-1 }`\ for +boreal peat fires are derived using an inverse +method,\ :math:`{}^{ }`\ by matching simulations from an unreleased +CLM4.5 version driven by Qian et al. (2006) atmospheric forcing and +climatological lightning data to earlier studies: about 2.4 Mha peatland +was burned over Indonesia in 1997 (Page et al. 2002) and the average +burned area of peat fires in Western Canada was 0.2 Mha +yr\ :math:`{}^{-1}` for 1980\ :math:`\mathrm{-}`\ 1999 (Turestky et al. +2004). + +For tropical peat fires, :math:`f_{cli,p}` is set as a function of +long-term precipitation :math:`P_{60d}` : + +.. math:: + + \label{18.38)} + f_{cli,p} =\max [0,\min (1,\frac{4-P_{60d} }{4} )]^{2} . + +For boreal peat fires, :math:`f_{cli,p}` is set to + +.. math:: + + \label{18.39)} + f_{cli,p} =\exp (-\pi \frac{\theta _{17cm} }{0.3} )\cdot \max [0,\min (1,\frac{T_{17cm} -T_{f} }{10} )] + +where :math:`\theta _{17cm}` and :math:`T_{17cm}` are the wetness and +temperature of the top 17 cm of soil; :math:`T_{f}` \ =273.15 K is the +freezing temperature. + +Peat fires lead to peat combustion and the combustion and mortality of +vegetation in peatlands. For tropical peat fires, based on Page et al. +(2002), about 6% of the peat carbon loss from stored carbon is caused by +33.9% of the peatland burned. Carbon emissions due to peat combustion (g +C m\ :math:`{}^{-2}` (time step)\ :math:`{}^{-1}`) are therefore set as +the product of 6%/33.9%, by burned area fraction of peat fire ((time +step)\ :math:`{}^{-1}`), by soil organic carbon (g C +m\ :math:`{}^{-2}`). For boreal peat fires, the carbon emissions due to +peat combustion are set as 2.2 kg C +m\ :math:`{}^{-}`\ :math:`{}^{2 }`\ peat fire area (Turetsky et al. +2002). Biomass combustion and vegetation mortality in post-fire +peatlands are set the same as section 18.1.3 for non-crop PFTs and as +section 18.2 for crops PFTs. + +Table 18.1. PFT-specific combustion completeness and fire mortality +factors. + ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| PFT | *CC*\ :math:`{}_{leaf}` | *CC*\ :math:`{}_{stem}` | *CC*\ :math:`{}_{root}` | *CC*\ :math:`{}_{ts}` | *M*\ :math:`{}_{leaf}` | *M*\ :math:`{}_{livestem}` | *M*\ :math:`{}_{deadstem}` | *M*\ :math:`{}_{root}` | *M*\ :math:`{}_{ts}` | *M*\ :math:`{}_{livestem}` | *:math:`\xi`*\ :math:`{}_{j}` | ++==================================+===========================+===========================+===========================+=========================+==========================+==============================+==============================+==========================+========================+==============================+=================================+ +| NET Temperate | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| NET Boreal | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| NDT Boreal | - | - | - | - | - | - | - | - | - | - | - | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| BET Tropical | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| BET Temperate | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| BDT Tropical | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| BDT Temperate | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| BDT Boreal | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| BES Temperate | - | - | - | - | - | - | - | - | - | - | - | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| BDS Temperate | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| BDS Boreal | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| C\ :math:`{}_{3}` Grass Arctic | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| C\ :math:`{}_{3}` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| C\ :math:`{}_{4}` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| Crop 1 | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +| Crop 2 | - | - | - | - | - | - | - | - | - | - | - | ++----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + +Leaves (:math:`CC_{{\rm leaf}}` ), stems (:math:`CC_{{\rm stem}}` ), +roots (:math:`CC_{{\rm root}}` ) , and transfer and storage carbon +(:math:`CC_{{\rm ts}}` ); mortality factors for leaves +(:math:`M_{{\rm leaf}}` ), live stems (:math:`M_{{\rm livestem,1}}` ), +dead stems (:math:`M_{{\rm deadstem}}` ), roots +(:math:`M_{{\rm root}}` ), and transfer and storage carbon +(:math:`M_{{\rm ts}}` ) related to the carbon transfers from these pools +to litter pool; mortality factors for live stems +(:math:`M_{{\rm livestem,2}}` ) related to the carbon transfer from live +stems to dead stems; whole-plant mortality factor (:math:`\xi _{j}` ). +Parameters are calibrated in an unreleased CLM4.5 version driven by Qian +et al. (2006) atmospheric forcing and climatological lightning data. diff --git a/doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst b/doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst new file mode 100644 index 0000000000..980ed65268 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst @@ -0,0 +1,619 @@ +Methane Model +================= + +The representation of processes in the methane biogeochemical model +integrated in CLM [CLM4Me; (Riley et al. 2011a)] is based on several +previously published models (Cao et al. 1996; Petrescu et al. 2010; Tian +et al. 2010; Walter et al. 2001; Wania et al. 2010; Zhang et al. 2002; +Zhuang et al. 2004). Although the model has similarities with these +precursor models, a number of new process representations and +parameterization have been integrated into CLM. + +Mechanistically modeling net surface CH\ :math:`{}_{4}` emissions +requires representing a complex and interacting series of processes. We +first (section 19.1) describe the overall model structure and flow of +information in the CH\ :math:`{}_{4}` model, then describe the methods +used to represent: CH\ :math:`{}_{4}` mass balance; CH\ :math:`{}_{4}` +production; ebullition; aerenchyma transport; CH\ :math:`{}_{4}` +oxidation; reactive transport solution, including boundary conditions, +numerical solution, water table interface, etc.; seasonal inundation +effects; and impact of seasonal inundation on CH\ :math:`{}_{4}` +production. + +Methane Model Structure and Flow +------------------------------------- + +The driver routine for the methane biogeochemistry calculations (ch4, in +ch4Mod.F) controls the initialization of boundary conditions, +inundation, and impact of redox conditions; calls to routines to +calculate CH\ :math:`{}_{4}` production, oxidation, transport through +aerenchyma, ebullition, and the overall mass balance (for unsaturated +and saturated soils and, if desired, lakes); resolves changes to +CH\ :math:`{}_{4}` calculations associated with a changing inundated +fraction; performs a mass balance check; and calculates the average +gridcell CH\ :math:`{}_{4}` production, oxidation, and exchanges with +the atmosphere. + +Governing Mass-Balance Relationship +---------------------------------------- + +The model (Figure 19.1) accounts for CH\ :math:`{}_{4}` production in +the anaerobic fraction of soil (*P*, mol m\ :math:`{}^{-3}` +s\ :math:`{}^{-1}`), ebullition (*E*, mol m\ :math:`{}^{-3}` +s\ :math:`{}^{-1}`), aerenchyma transport (*A*, mol m\ :math:`{}^{-3}` +s\ :math:`{}^{-1}`), aqueous and gaseous diffusion (*F\ :math:`{}_{D}`*, +mol m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), and oxidation (*O*, mol +m\ :math:`{}^{-3}` s\ :math:`{}^{-1}`) via a transient reaction +diffusion equation: + +.. math:: + + \label{ZEqnNum628535} + \frac{\partial \left(RC\right)}{\partial t} =\frac{\partial F_{D} }{\partial z} +P\left(z,t\right)-E\left(z,t\right)-A\left(z,t\right)-O\left(z,t\right) + +Here *z* (m) represents the vertical dimension, *t* (s) is time, and *R* +accounts for gas in both the aqueous and gaseous +phases:\ :math:`R=\varepsilon _{a} +K_{H}^{} \varepsilon _{w}` , with +*:math:`\epsilon`\ :math:`{}_{a}`*, *:math:`\epsilon`\ :math:`{}_{w}`,* +and :math:`K_{H}^{}` (-) the air-filled porosity, water-filled +porosity, and partitioning coefficient for the species of interest, +respectively, and :math:`C` represents CH\ :math:`{}_{4}` or +O\ :math:`{}_{2}` concentration with respect to water volume (mol +m\ :math:`{}^{-3}`). + +An analogous version of equation is concurrently solved for +O\ :math:`{}_{2}`, but with the following differences relative to +CH\ :math:`{}_{4}`: *P* = *E* = 0 (i.e., no production or ebullition), +and the oxidation sink includes the O\ :math:`{}_{2}` demanded by +methanotrophs, heterotroph decomposers, nitrifiers, and autotrophic root +respiration. + +As currently implemented, each gridcell contains an inundated and a +non-inundated fraction. Therefore, equation is solved four times for +each gridcell and time step: in the inundated and non-inundated +fractions, and for CH\ :math:`{}_{4}` and O\ :math:`{}_{2}`. If desired, +the CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` mass balance equation is +solved again for lakes (Chapter 9). For non-inundated areas, the water +table interface is defined at the deepest transition from greater than +95% saturated to less than 95% saturated that occurs above frozen soil +layers. The inundated fraction is allowed to change at each time step, +and the total soil CH\ :math:`{}_{4}` quantity is conserved by evolving +CH\ :math:`{}_{4}` to the atmosphere when the inundated fraction +decreases, and averaging a portion of the non-inundated concentration +into the inundated concentration when the inundated fraction increases. + +Figure 19.1. Schematic representation of biological and physical +processes integrated in CLM that affect the net CH\ :math:`{}_{4}` +surface flux (Riley et al. 2011a). (left) Fully inundated portion of a +CLM gridcell and (right) variably saturated portion of a gridcell. + +|image| + +19.3 CH\ :math:`{}_{4}` Production +---------------------------------- + +Because CLM does not currently specifically represent wetland plant +functional types or soil biogeochemical processes, we used +gridcell-averaged decomposition rates as proxies. Thus, the upland +(default) heterotrophic respiration is used to estimate the wetland +decomposition rate after first dividing off the O\ :math:`{}_{2}` +limitation. The O\ :math:`{}_{2}` consumption associated with anaerobic +decomposition is then set to the unlimited version so that it will be +reduced appropriately during O\ :math:`{}_{2}` competition. +CH\ :math:`{}_{4}` production at each soil level in the anaerobic +portion (i.e., below the water table) of the column is related to the +gridcell estimate of heterotrophic respiration from soil and litter +(*R\ :math:`{}_{H}`*; mol C m\ :math:`{}^{-2}` +s\ :math:`{}^{-}`\ :math:`{}^{1}`) corrected for its soil temperature +(*T\ :math:`{}_{s}`*) dependence, soil temperature through a +*Q*\ :math:`{}_{10}` factor (:math:`f_{T}` ), pH (:math:`f_{pH}` ), +redox potential (:math:`f_{pE}` ), and a factor accounting for the +seasonal inundation fraction (*S*, described below): + +.. math:: + + \label{ZEqnNum109798} + P=R_{H} f_{CH_{4} } f_{T} f_{pH} f_{pE} S. + +Here, :math:`f_{CH_{4} }` is the baseline ratio between +CO\ :math:`{}_{2}` and CH\ :math:`{}_{4}` production (all parameters +values are given in Table 19.1). Currently, :math:`f_{CH_{4} }` is +modified to account for our assumptions that methanogens may have a +higher Q\ :math:`{}_{10}` than aerobic decomposers; are not N limited; +and do not have a low-moisture limitation. + +When the single BGC soil level is used in CLM (Chapter 15), the +temperature factor, :math:`f_{T}` , is set to 0 for temperatures equal +to or below freezing, even though CLM allows heterotrophic respiration +below freezing. However, if the vertically resolved BGC soil column is +used, CH\ :math:`{}_{4}` production continues below freezing because +liquid water stress limits decomposition. The base temperature for the +*Q*\ :math:`{}_{10}` factor, *T\ :math:`{}_{B}`*, is 22 +:math:`{}^\circ`\ C and effectively modified the base +:math:`f_{CH_{4} }` value. + +For the single-layer BGC version, *R\ :math:`{}_{H}`* is distributed ** +among soil levels by assuming that 50% is associated with the roots +(using the CLM PFT-specific rooting distribution) and the rest is evenly +divided among the top 0.28 m of soil (to be consistent with CLM’s soil +decomposition algorithm). For the vertically resolved BGC version, the +prognosed distribution of *R\ :math:`{}_{H}`* is used to estimate +CH\ :math:`{}_{4}` production. + +The factor :math:`f_{pH}` is nominally set to 1, although a static +spatial map of *pH* can be used to determine this factor (Dunfield et +al. 1993) by applying: + +.. math:: + + \label{19.3)} + f_{pH} =10^{-0.2235pH^{2} +2.7727pH-8.6} . + +The :math:`f_{pE}` factor assumes that alternative electron acceptors +are reduced with an e-folding time of 30 days after inundation. The +default version of the model applies this factor to horizontal changes +in inundated area but not to vertical changes in the water table depth +in the upland fraction of the gridcell. We consider both :math:`f_{pH}` +and :math:`f_{pE}` to be poorly constrained in the model and identify +these controllers as important areas for model improvement. + +As a non-default option to account for CH\ :math:`{}_{4}` production in +anoxic microsites above the water table, we apply the Arah and Stephen +(1998) estimate of anaerobic fraction: + +.. math:: + + \label{19.4)} + \varphi =\frac{1}{1+\eta C_{O_{2} } } . + +Here, *:math:`\varphi`* is the factor by which production is inhibited +above the water table (compared to production as calculated in equation +, :math:`C_{O_{2} }` (mol m\ :math:`{}^{-3}`) is the bulk soil oxygen +concentration, and *:math:`\eta`* = 400 mol m\ :math:`{}^{-3}`. + +The O\ :math:`{}_{2}` required to facilitate the vertically resolved +heterotrophic decomposition and root respiration is estimated assuming 1 +mol O\ :math:`{}_{2}` is required per mol CO\ :math:`{}_{2}` produced. +The model also calculates the O\ :math:`{}_{2}` required during +nitrification, and the total O\ :math:`{}_{2}` demand is used in the +O\ :math:`{}_{2}` mass balance solution. + +Table 19.1. Parameter descriptions and sensitivity analysis ranges +applied in the methane model. + ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| Mechanism | Parameter | Baseline Value | Range for Sensitivity Analysis | Units | Description | ++==============+============================+==============================================+==================================================================================================+=============================================+============================================================================================+ +| Production | *Q\ :math:`{}_{10}`* | 2 | 1.5 – 4 | - | CH\ :math:`{}_{4}` production Q\ :math:`{}_{10}` | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| | :math:`f_{pH}` | 1 | On, off | - | Impact of pH on CH\ :math:`{}_{4}` production | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| | :math:`f_{pE}` | 1 | On, off | - | Impact of redox potential on CH\ :math:`{}_{4}` production | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| ** | *S* | Varies | NA | - | Seasonal inundation factor | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| | *:math:`\beta`* | 0.2 | NA | - | Effect of anoxia on decomposition rate (used to calculate *S* only) | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| | :math:`f_{CH_{4} }` | 0.2 | NA | - | Ratio between CH\ :math:`{}_{4}` and CO\ :math:`{}_{2}` production below the water table | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| Ebullition | *C\ :math:`{}_{e,max}`* | 0.15 | NA | mol m\ :math:`{}^{-3}` | CH\ :math:`{}_{4}` concentration to start ebullition | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| ** | *C\ :math:`{}_{e,min}`* | 0.15 | NA | - | CH\ :math:`{}_{4}` concentration to end ebullition | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| Diffusion | :math:`f_{D_{0} }` \ ** | 1 | 1, 10 | m\ :math:`{}^{2}` s\ :math:`{}^{-1}` | Diffusion coefficient multiplier (Table 19.2) | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| Aerenchyma | *p* | 0.3 | NA | - | Grass aerenchyma porosity | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| ** | *R* | 2.9\ :math:`\times`\ 10\ :math:`{}^{-3}` m | NA | m | Aerenchyma radius | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| ** | *r\ :math:`{}_{L}`* | 3 | NA | - | Root length to depth ratio | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| | *F\ :math:`{}_{a}`* | 1 | 0.5 – 1.5 | - | Aerenchyma conductance multiplier | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| Oxidation | :math:`K_{CH_{4} }` | 5 x 10\ :math:`{}^{-3}` | 5\ :math:`\times`\ 10\ :math:`{}^{-4}`\ :math:`{}_{ }`- 5\ :math:`\times`\ 10\ :math:`{}^{-2}` | mol m\ :math:`{}^{-3}` | CH\ :math:`{}_{4}` half-saturation oxidation coefficient (wetlands) | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| ** | :math:`K_{O_{2} }` \ ** | 2 x 10\ :math:`{}^{-2}` | 2\ :math:`\times`\ 10\ :math:`{}^{-3}` - 2\ :math:`\times`\ 10\ :math:`{}^{-1}` | mol m\ :math:`{}^{-3}` | O\ :math:`{}_{2}` half-saturation oxidation coefficient | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +| | :math:`R_{o,\max }` \ ** | 1.25 x 10\ :math:`{}^{-5}` | 1.25\ :math:`\times`\ 10\ :math:`{}^{-6}` - 1.25\ :math:`\times`\ 10\ :math:`{}^{-4}` | mol m\ :math:`{}^{-3}` s\ :math:`{}^{-1}` | Maximum oxidation rate (wetlands) | ++--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + +.. math:: 8 + +.. math:: 17 + +Ebullition +--------------- + +Briefly, the simulated aqueous CH\ :math:`{}_{4}` concentration in each +soil level is used to estimate the expected equilibrium gaseous partial +pressure (:math:`C_{e}` ), as a function of temperature and depth below +the water table, by first estimating the Henry’s law partitioning +coefficient (:math:`k_{h}^{C}` ) by the method described in Wania et al. +(2010): + +.. math:: + + \label{19.5)} + \log \left(\frac{1}{k_{H} } \right)=\log k_{H}^{s} -\frac{1}{C_{H} } \left(\frac{1}{T} -\frac{1}{T^{s} } \right) + +.. math:: + + \label{ZEqnNum493232} + k_{h}^{C} =Tk_{H} R_{g} + +.. math:: + + \label{19.7)} + C_{e} =\frac{C_{w} R_{g} T}{\theta _{s} k_{H}^{C} p} + +where :math:`C_{H}` \ is a constant, :math:`R_{g}` is the universal +gas constant, :math:`k_{H}^{s}` is Henry’s law partitioning coefficient +at standard temperature (:math:`T^{s}` ),\ :math:`C_{w}` \ is local +aqueous CH\ :math:`{}_{4}` concentration, and *p* is pressure. + +The local pressure is calculated as the sum of the ambient pressure, +water pressure down to the local depth, and pressure from surface +ponding (if applicable). When the CH\ :math:`{}_{4}` partial pressure +exceeds 15% of the local pressure (Baird et al. 2004; Strack et al. +2006; Wania et al. 2010), bubbling occurs to remove CH\ :math:`{}_{4}` +to below this value, modified by the fraction of CH\ :math:`{}_{4}` in +the bubbles [taken as 57%; (Kellner et al. 2006; Wania et al. 2010)]. +Bubbles are immediately added to the surface flux for saturated columns +and are placed immediately above the water table interface in +unsaturated columns. + +Aerenchyma Transport +------------------------- + +Aerenchyma transport is modeled in CLM as gaseous diffusion driven by a +concentration gradient between the specific soil layer and the +atmosphere and, if specified, by vertical advection with the +transpiration stream. There is evidence that pressure driven flow can +also occur, but we did not include that mechanism in the current model. + +The diffusive transport through aerenchyma (*A*, mol m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`) from each soil layer is represented in the model as: + +.. math:: + + \label{ZEqnNum158128} + A=\frac{C\left(z\right)-C_{a} }{{\raise0.7ex\hbox{$ r_{L} z $}\!\mathord{\left/ {\vphantom {r_{L} z D}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ D $}} +r_{a} } pT\rho _{r} , + +where *D* is the free-air gas diffusion coefficient (m:math:`{}^{2}` +s\ :math:`{}^{-1}`); *C(z)* (mol m\ :math:`{}^{-3}`) is the gaseous +concentration at depth *z* (m); :math:`r_{L}` is the ratio of root +length to depth; *p* is the porosity (-); *T* is specific aerenchyma +area (m:math:`{}^{2}` m\ :math:`{}^{-2}`); *r\ :math:`{}_{a}`* is the +aerodynamic resistance between the surface and the atmospheric reference +height (s m:math:`{}^{-1}`); and :math:`\rho _{r}` is the rooting +density as a function of depth (-). The gaseous concentration is +calculated with Henry’s law as described in equation . + +Based on the ranges reported in Colmer (2003), we have chosen baseline +aerenchyma porosity values of 0.3 for grass and crop PFTs and 0.1 for +tree and shrub PFTs. The aerenchyma area varies over the course of the +growing season; we parameterize this dependency using the simulated leaf +area index *L* (m:math:`{}^{2}` m\ :math:`{}^{-2}`), as in Wania et al. +(2010): + +.. math:: + + \label{19.9)} + T=\frac{f_{N} N_{a} L}{0.22} \pi R^{2} . + +Here :math:`N_{a}` is annual net primary production (NPP, mol +m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`); *R* is the aerenchyma radius +(2.9:math:`\times`\ 10\ :math:`{}^{-3}` m); *f\ :math:`{}_{N}`* is the +belowground fraction of annual NPP; and the 0.22 factor represents the +amount of C per tiller. O\ :math:`{}_{2}` can also diffuse in from the +atmosphere to the soil layer via the reverse of the same pathway, with +the same representation as Equation but with the gas diffusivity of +oxygen. + +CLM also simulates the direct emission of CH\ :math:`{}_{4}` from leaves +to the atmosphere via transpiration of dissolved methane. We calculate +this flux (:math:`F_{CH_{4} -T}` ; mol m\ :math:`{}^{-}`\ :math:`{}^{2}` +s\ :math:`{}^{-1}`) using the simulated soil water methane concentration +(:math:`C_{CH_{4} ,j}` (mol m\ :math:`{}^{-3}`)) in each soil layer *j* +and the CLM predicted transpiration (:math:`F_{T}` ) for each PFT, +assuming that no methane was oxidized inside the plant tissue: + +.. math:: + + \label{19.10)} + F_{CH_{4} -T} =\sum _{j}\rho _{r,j} F_{T} C_{CH_{4} ,j} . + +CH\ :math:`{}_{4}` Oxidation +--------------------------------- + +CLM represents CH\ :math:`{}_{4}` oxidation with double Michaelis-Menten +kinetics (Arah and Stephen 1998; Segers 1998), dependent on both the +gaseous CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` concentrations: + +.. math:: + + \label{19.11)} + R_{oxic} =R_{o,\max } \left[\frac{C_{CH_{4} } }{K_{CH_{4} } +C_{CH_{4} } } \right]\left[\frac{C_{O_{2} } }{K_{O_{2} } +C_{O_{2} } } \right]Q_{10} F_{\vartheta } + +where :math:`K_{CH_{4} }` and :math:`K_{O_{2} }` \ are the half +saturation coefficients (mol m\ :math:`{}^{-3}`) with respect to +CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` concentrations, respectively; +:math:`R_{o,\max }` is the maximum oxidation rate (mol +m\ :math:`{}^{-3}` s\ :math:`{}^{-1}`); and *Q\ :math:`{}_{10}`* +specifies the temperature dependence of the reaction with a base +temperature set to 12 :math:`{}^\circ`\ C. The soil moisture limitation +factor :math:`F_{\vartheta }` is applied above the water table to +represent water stress for methanotrophs. Based on the data in Schnell +and King (1996), we take :math:`F_{\vartheta } =e^{{\raise0.7ex\hbox{` +-P +:math:`}\!\mathord{\left/ {\vphantom {-P P_{c} }} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{` +P\ :sub:`c` :math:`}} }` , where *P* is the soil moisture potential and +*P\ :math:`{}_{c}`* = -2.4:math:`\times`\ 10\ :math:`{}^{5}` mm. + +Reactive Transport Solution +-------------------------------- + +The solution to equation is solved in several sequential steps: resolve +competition for CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` (section +19.7.1); add the ebullition flux into the layer directly above the water +table or into the atmosphere; calculate the overall CH\ :math:`{}_{4}` +or O\ :math:`{}_{2}` source term based on production, aerenchyma +transport, ebullition, and oxidation; establish boundary conditions, +including surface conductance to account for snow, ponding, and +turbulent conductances and bottom flux condition (section 19.7.2); +calculate diffusivity (section 19.7.3); and solve the resulting mass +balance using a tridiagonal solver (section 19.7.5). + +19.7.1 Competition for CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For each time step, the unlimited CH\ :math:`{}_{4}` and +O\ :math:`{}_{2}` demands in each model depth interval are computed. If +the total demand over a time step for one of the species exceeds the +amount available in a particular control volume, the demand from each +process associated with the sink is scaled by the fraction required to +ensure non-negative concentrations. Since the methanotrophs are limited +by both CH\ :math:`{}_{4}` and O\ :math:`{}_{2}`, the stricter +limitation is applied to methanotroph oxidation, and then the +limitations are scaled back for the other processes. The competition is +designed so that the sinks must not exceed the available concentration +over the time step, and if any limitation exists, the sinks must sum to +this value. Because the sinks are calculated explicitly while the +transport is semi-implicit, negative concentrations can occur after the +tridiagonal solution. When this condition occurs for O\ :math:`{}_{2}`, +the concentrations are reset to zero; if it occurs for +CH\ :math:`{}_{4}`, the surface flux is adjusted and the concentration +is set to zero if the adjustment is not too large. + +19.7.2 CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` Source Terms +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The overall CH\ :math:`{}_{4}` net source term consists of production, +oxidation at the base of aerenchyma, transport through aerenchyma, +methanotrophic oxidation, and ebullition (either to the control volume +above the water table if unsaturated or directly to the atmosphere if +saturated). For O\ :math:`{}_{2}` below the top control volume, the net +source term consists of O\ :math:`{}_{2}` losses from methanotrophy, SOM +decomposition, and autotrophic respiration, and an O\ :math:`{}_{2}` +source through aerenchyma. + +19.7.3 Aqueous and Gaseous Diffusion +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For gaseous diffusion, we adopted the temperature dependence of +molecular free-air diffusion coefficients (*D\ :math:`{}_{0}`* +(m:math:`{}^{2}` s\ :math:`{}^{-1}`)) as described by Lerman et al. +(1979) and applied by Wania et al. (2010) (Table 19.2). + +Table 19.2. Temperature dependence of aqueous and gaseous diffusion +coefficients for CH\ :math:`{}_{4}` and O\ :math:`{}_{2}`. + ++----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ +| D\ :math:`{}_{0}` (m:math:`{}^{2}` s\ :math:`{}^{-1}`) | CH\ :math:`{}_{4}` | O\ :math:`{}_{2}` | ++==========================================================+==========================================================+========================================================+ +| Aqueous | 0.9798 + 0.02986\ *T* + 0.0004381\ *T*\ :math:`{}^{2}` | 1.172+ 0.03443\ *T* + 0.0005048\ *T*\ :math:`{}^{2}` | ++----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ +| Gaseous | 0.1875 + 0.0013\ *T* | 0.1759 + 0.0011\ *T* | ++----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ + +Gaseous diffusivity in soils also depends on the molecular diffusivity, +soil structure, porosity, and organic matter content. Moldrup et al. +(2003), using observations across a range of unsaturated mineral soils, +showed that the relationship between effective diffusivity +(:math:`D_{e}` (m:math:`{}^{2}` s\ :math:`{}^{-1}`)) and soil +properties can be represented as: + +.. math:: + + \label{ZEqnNum730978} + D_{e} =D_{0} \theta _{a}^{2} \left(\frac{\theta _{a} }{\theta _{s} } \right)^{{\raise0.7ex\hbox{$ 3 $}\!\mathord{\left/ {\vphantom {3 b}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ b $}} } , + +where :math:`\theta _{a}` and :math:`\theta _{s}` are the air-filled +and total (saturated water-filled) porosities (-), respectively, and *b* +is the slope of the water retention curve (-). However, Iiyama and +Hasegawa (2005) have shown that the original Millington-Quirk +(Millington and Quirk 1961) relationship matched measurements more +closely in unsaturated peat soils: + +.. math:: + + \label{ZEqnNum437147} + D_{e} =D_{0} \frac{\theta _{a} ^{{\raise0.7ex\hbox{$ 10 $}\!\mathord{\left/ {\vphantom {10 3}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ 3 $}} } }{\theta _{s} ^{2} } + +In CLM, we applied equation for soils with zero organic matter content +and equation for soils with more than 130 kg m\ :math:`{}^{-3}` organic +matter content. A linear interpolation between these two limits is +applied for soils with SOM content below 130 kg m\ :math:`{}^{-3}`. For +aqueous diffusion in the saturated part of the soil column, we applied +(Moldrup et al. 2003): + +.. math:: + + \label{19.14)} + D_{e} =D_{0} \theta _{s} ^{2} . + +To simplify the solution, we assumed that gaseous diffusion dominates +above the water table interface and aqueous diffusion below the water +table interface. Descriptions, baseline values, and dimensions for +parameters specific to the CH\ :math:`{}_{4}` model are given in Table +19.1. For freezing or frozen soils below the water table, diffusion is +limited to the remaining liquid (CLM allows for some freezing point +depression), and the diffusion coefficients are scaled by the +volume-fraction of liquid. For unsaturated soils, Henry’s law +equilibrium is assumed at the interface with the water table. + +19.7.4 Boundary Conditions +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +We assume the CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` surface fluxes +can be calculated from an effective conductance and a gaseous +concentration gradient between the atmospheric concentration and either +the gaseous concentration in the first soil layer (unsaturated soils) or +in equilibrium with the water (saturated +soil\ :math:`w\left(C_{1}^{n} -C_{a} \right)` and +:math:`w\left(C_{1}^{n+1} -C_{a} \right)` for the fully explicit and +fully implicit cases, respectively (however, see Tang and Riley (2013) +for a more complete representation of this process). Here, *w* is the +surface boundary layer conductance as calculated in the existing CLM +surface latent heat calculations. If the top layer is not fully +saturated, the :math:`\frac{D_{m1} }{\Delta x_{m1} }` term is replaced +with a series combination: +:math:`\left[\frac{1}{w} +\frac{\Delta x_{1} }{D_{1} } \right]^{-1}` , +and if the top layer is saturated, this term is replaced with +:math:`\left[\frac{K_{H} }{w} +\frac{\frac{1}{2} \Delta x_{1} }{D_{1} } \right]^{-1}` , +where *K\ :math:`{}_{H}`* is the Henry’s law equilibrium constant. + +When snow is present, a resistance is added to account for diffusion +through the snow based on the Millington-Quirk expression (equation ) +and CLM’s prediction of the liquid water, ice, and air fractions of each +snow layer. When the soil is ponded, the diffusivity is assumed to be +that of methane in pure water, and the resistance as the ratio of the +ponding depth to diffusivity. The overall conductance is taken as the +series combination of surface, snow, and ponding resistances. We assume +a zero flux gradient at the bottom of the soil column. + +19.7.5 Crank-Nicholson Solution +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Equation is solved using a Crank-Nicholson solution (Press et al. 1992), +which combines fully explicit and implicit representations of the mass +balance. The fully explicit decomposition of equation can be written as + +.. math:: + + \label{ZEqnNum395184} + \frac{R_{j}^{n+1} C_{j}^{n+1} -R_{j}^{n} C_{j}^{n} }{\Delta t} =\frac{1}{\Delta x_{j} } \left[\frac{D_{p1}^{n} }{\Delta x_{p1}^{} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{n} }{\Delta x_{m1}^{} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+S_{j}^{n} , + +where *j* refers to the cell in the vertically discretized soil column +(increasing downward), *n* refers to the current time step, +*:math:`\Delta`\ t* is the time step (s), *p1* is *j+½*, *m1* is *j-½*, +and :math:`S_{j}^{n}` is the net source at time step *n* and position +*j*, i.e., +:math:`S_{j}^{n} =P\left(j,n\right)-E\left(j,n\right)-A\left(j,n\right)-O\left(j,n\right)`. +The diffusivity coefficients are calculated as harmonic means of values +from the adjacent cells. Equation is solved for gaseous and aqueous +concentrations above and below the water table, respectively. The *R* +term ensure the total mass balance in both phases is properly accounted +for. An analogous relationship can be generated for the fully implicit +case by replacing *n* by *n+1* on the *C* and *S* terms of equation . +Using an average of the fully implicit and fully explicit relationships +gives: + +.. math:: + + \label{ZEqnNum463314} + \begin{array}{l} {-\frac{1}{2\Delta x_{j} } \frac{D_{m1}^{} }{\Delta x_{m1}^{} } C_{j-1}^{n+1} +\left[\frac{R_{j}^{n+1} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left(\frac{D_{p1}^{} }{\Delta x_{p1}^{} } +\frac{D_{m1}^{} }{\Delta x_{m1}^{} } \right)\right]C_{j}^{n+1} -\frac{1}{2\Delta x_{j} } \frac{D_{p1}^{} }{\Delta x_{p1}^{} } C_{j+1}^{n+1} =} \\ {\frac{R_{j}^{n} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1}^{} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1}^{} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right]} \end{array}, + +Equation is solved with a standard tridiagonal solver, i.e.: + +.. math:: + + \label{19.17)} + aC_{j-1}^{n+1} +bC_{j}^{n+1} +cC_{j+1}^{n+1} =r, + +with coefficients specified in equation . + +Two methane balance checks are performed at each timestep to insure that +the diffusion solution and the time-varying aggregation over inundated +and non-inundated areas strictly conserves methane molecules (except for +production minus consumption) and carbon atoms. + +19.7.6 Interface between water table and unsaturated zone +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +We assume Henry’s Law equilibrium at the interface between the saturated +and unsaturated zone and constant flux from the soil element below the +interface to the center of the soil element above the interface. In this +case, the coefficients are the same as described above, except for the +soil element above the interface: + +.. math:: \frac{D_{p1} }{\Delta x_{p1} } =\left[K_{H} \frac{\Delta x_{j} }{2D_{j} } +\frac{\Delta x_{j+1} }{2D_{j+1} } \right]^{-1} + +.. math:: b=\left[\frac{R_{j}^{n+1} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left(K_{H} \frac{D_{p1}^{} }{\Delta x_{p1} } +\frac{D_{m1}^{} }{\Delta x_{m1} } \right)\right] + +.. math:: + + \label{19.18)} + r=\frac{R_{j}^{n} }{\Delta t} C_{j}^{n} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1} } \left(C_{j+1}^{n} -K_{H} C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right] + +and the soil element below the interface: + +.. math:: \frac{D_{m1} }{\Delta x_{m1} } =\left[K_{H} \frac{\Delta x_{j-1} }{2D_{j-1} } +\frac{\Delta x_{j} }{2D_{j} } \right]^{-1} + +.. math:: a=-K_{H} \frac{1}{2\Delta x_{j} } \frac{D_{m1}^{} }{\Delta x_{m1} } + +.. math:: + + \label{19.19)} + r=\frac{R_{j}^{n} }{\Delta t} +C_{j}^{n} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1} } \left(C_{j}^{n} -K_{H} C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right] + +Inundated Fraction Prediction +---------------------------------- + +We developed a simplified dynamic representation of spatial inundation +based on recent work by Prigent et al. (2007), who described a +multi-satellite approach to estimate the global monthly inundated +fraction (*F\ :math:`{}_{i}`*) over an equal area grid +(0.25:math:`\circ`\ :math:`\times`\ 0.25\ :math:`\circ` at the equator) +from 1993 - 2000. They suggested that the IGBP estimate for inundation +could be used as a measure of sensitivity of their detection approach at +low inundation. We therefore used the sum of their satellite-derived +*F\ :math:`{}_{i}`* and the constant IGBP estimate when it was less than +10% to perform a simple inversion for the inundated fraction for methane +production (*f\ :math:`{}_{s}`*). The method optimized three parameters +(*p\ :math:`{}_{1}`*, *p\ :math:`{}_{2}`*, *p\ :math:`{}_{3}`*) for each +grid cell in a simple model based on simulated water table depth +(*z\ :math:`{}_{w}`*) and surface runoff (*Q\ :math:`{}_{r}`* (mm +s\ :math:`{}^{-1}`)): + +.. math:: + + \label{19.20)} + f_{s} =P_{1} e^{{\raise0.7ex\hbox{$ -z_{w} $}\!\mathord{\left/ {\vphantom {-z_{w} p_{2} }} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ p_{2} $}} } +p_{3} Q_{r} . + +These parameters were evaluated at the +0.5\ **:math:`\boldsymbol{{}^\circ}`** resolution, and aggregated for +coarser simulations. We expect that ongoing work in the hydrology +submodel of CLM will alleviate the need for this crude simplification of +inundated fraction in future model versions. + +Seasonal Inundation +------------------------ + +We have developed a simplified scaling factor to mimic the impact of +seasonal inundation on CH\ :math:`{}_{4}` production (see appendix B in +Riley et al. (2011a) for a discussion of this simplified expression): + +.. math:: + + \label{19.21)} + S=\frac{\beta \left(f-\bar{f}\right)+\bar{f}}{f} ,S\le 1. + +Here, *f* is the instantaneous inundated fraction, :math:`\bar{f}` is +the annual average inundated fraction (evaluated for the previous +calendar year) weighted by heterotrophic respiration, and +*:math:`\beta`* is the anoxia factor that relates the fully anoxic +decomposition rate to the fully oxygen-unlimited decomposition rate, all +other conditions being equal. + +.. |image| image:: image1 diff --git a/doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst b/doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst new file mode 100644 index 0000000000..0e29f00078 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst @@ -0,0 +1,782 @@ + +Surface Characterization and Model Input Requirements +======================================================== + +Surface Characterization +----------------------------- + +Surface Heterogeneity and Data Structure +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Spatial land surface heterogeneity in CLM is represented as a nested +subgrid hierarchy in which grid cells are composed of multiple land +units, snow/soil columns, and PFTs (Figure 2.1). Each grid cell can have +a different number of land units, each land unit can have a different +number of columns, and each column can have multiple PFTs. The first +subgrid level, the land unit, is intended to capture the broadest +spatial patterns of subgrid heterogeneity. The current land units are +glacier, lake, urban, vegetated, and crop (when the crop model option is +turned on). The land unit level can be used to further delineate these +patterns. For example, the urban land unit is divided into density +classes representing the tall building district, high density, and +medium density urban areas. + +The second subgrid level, the column, is intended to capture potential +variability in the soil and snow state variables within a single land +unit. For example, the vegetated land unit could contain several columns +with independently evolving vertical profiles of soil water and +temperature. Similarly, the managed vegetation land unit could be +divided into two columns, irrigated and non-irrigated. The snow/soil +column is represented by fifteen layers for soil and up to five layers +for snow, depending on snow depth. The central characteristic of the +column subgrid level is that this is where the state variables for water +and energy in the soil and snow are defined, as well as the fluxes of +these components within the soil and snow. Regardless of the number and +type of PFTs occupying space on the column, the column physics operates +with a single set of upper boundary fluxes, as well as a single set of +transpiration fluxes from multiple soil levels. These boundary fluxes +are weighted averages over all PFTs. Currently, for glacier, lake, and +vegetated land units, a single column is assigned to each land unit. The +crop land unit is split into irrigated and unirrigated columns with a +single crop occupying each column. The urban land units have five +columns (roof, sunlit walls and shaded walls, and pervious and +impervious canyon floor) (Oleson et al. 2010b). + +Figure 2.1. Configuration of the CLM subgrid hierarchy. + +Note that the Crop land unit is only used when the model is run with the +crop model active. Abbreviations: TBD – Tall Building District; HD – +High Density; MD – Medium Density, G – Glacier, L – Lake, U – Urban, C – +Crop, V – Vegetated, PFT – Plant Functional Type, I – Irrigated, U – +Unirrigated . + +.. image:: image1.png + +The third subgrid level is referred to as the PFT level, but it also +includes the treatment for bare ground. It is intended to capture the +biogeophysical and biogeochemical differences between broad categories +of plants in terms of their functional characteristics. On the vegetated +land unit, up to 16 possible PFTs that differ in physiology and +structure may coexist on a single column. All fluxes to and from the +surface are defined at the PFT level, as are the vegetation state +variables (e.g. vegetation temperature and canopy water storage). On the +crop land unit, several different crop types can be represented on each +crop land unit column (see Chapter 20 for details). + +In addition to state and flux variable data structures for conserved +components at each subgrid level (e.g., energy, water, carbon), each +subgrid level also has a physical state data structure for handling +quantities that are not involved in conservation checks (diagnostic +variables). For example, the urban canopy air temperature and humidity +are defined through physical state variables at the land unit level, the +number of snow layers and the soil roughness lengths are defined as +physical state variables at the column level, and the leaf area index +and the fraction of canopy that is wet are defined as physical state +variables at the PFT level. + +The standard configuration of the model subgrid hierarchy is illustrated +in Figure 2.1. Here, only four PFTs are shown associated with the single +column beneath the vegetated land unit but up to sixteen are possible. +The crop land unit is present only when the crop model is active. + +Note that the biogeophysical processes related to soil and snow require +PFT level properties to be aggregated to the column level. For example, +the net heat flux into the ground is required as a boundary condition +for the solution of snow/soil temperatures (Chapter 6). This column +level property must be determined by aggregating the net heat flux from +all PFTs sharing the column. This is generally accomplished in the model +by computing a weighted sum of the desired quantity over all PFTs whose +weighting depends on the PFT area relative to all PFTs, unless otherwise +noted in the text. + +Vegetation Composition +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Vegetated surfaces are comprised of up to 15 possible plant functional +types (PFTs) plus bare ground (Table 2.1). An additional PFT is +added if the irrigation model is active and six additional PFTs are +added if the crop model is active (Chapter 20). These plant types differ +in leaf and stem optical properties that determine reflection, +transmittance, and absorption of solar radiation (Table 3.1), root +distribution parameters that control the uptake of water from the soil +(Table 8.3), aerodynamic parameters that determine resistance to heat, +moisture, and momentum transfer (Table 5.1), and photosynthetic +parameters that determine stomatal resistance, photosynthesis, and +transpiration (Tables 8.1, 8.2). The composition and abundance of PFTs +within a grid cell can either be prescribed as time-invariant fields +(e.g., using the present day dataset described in section 21.3.3) or can +evolve with time if the model is run in transient landcover mode +(Chapter 21). + +Table 2.1. Plant functional types + ++--------------------------------------------------------------+-------------------+ +| Plant functional type | Acronym | ++==============================================================+===================+ +| Needleleaf evergreen tree – temperate | NET Temperate | ++--------------------------------------------------------------+-------------------+ +| Needleleaf evergreen tree - boreal | NET Boreal | ++--------------------------------------------------------------+-------------------+ +| Needleleaf deciduous tree – boreal | NDT Boreal | ++--------------------------------------------------------------+-------------------+ +| Broadleaf evergreen tree – tropical | BET Tropical | ++--------------------------------------------------------------+-------------------+ +| Broadleaf evergreen tree – temperate | BET Temperate | ++--------------------------------------------------------------+-------------------+ +| Broadleaf deciduous tree – tropical | BDT Tropical | ++--------------------------------------------------------------+-------------------+ +| Broadleaf deciduous tree – temperate | BDT Temperate | ++--------------------------------------------------------------+-------------------+ +| Broadleaf deciduous tree – boreal | BDT Boreal | ++--------------------------------------------------------------+-------------------+ +| Broadleaf evergreen shrub - temperate | BES Temperate | ++--------------------------------------------------------------+-------------------+ +| Broadleaf deciduous shrub – temperate | BDS Temperate | ++--------------------------------------------------------------+-------------------+ +| Broadleaf deciduous shrub – boreal | BDS Boreal | ++--------------------------------------------------------------+-------------------+ +| C\ :math:`{}_{3}` arctic grass | - | ++--------------------------------------------------------------+-------------------+ +| C\ :math:`{}_{3}` grass | - | ++--------------------------------------------------------------+-------------------+ +| C\ :math:`{}_{4}` grass | - | ++--------------------------------------------------------------+-------------------+ +| C\ :math:`{}_{3}` Unmanaged Rainfed Crop | Crop R | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{1}`\ C\ :math:`{}_{3}` Unmanaged Irrigated Crop | Crop I | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{2}`\ Rainfed Corn | Corn R | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{2}`\ Irrigated Corn | Corn I | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{2}`\ Rainfed Temperate Cereals | Temp Cereal R | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{2}`\ Irrigated Temperate Cereals | Temp Cereal I | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{3}`\ Rainfed Winter Cereals | Winter Cereal R | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{3}`\ Irrigated Winter Cereals | Winter Cereal I | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{2}`\ Rainfed Soybean | Soybean R | ++--------------------------------------------------------------+-------------------+ +| :math:`{}^{2}`\ Irrigated Soybean | Soybean I | ++--------------------------------------------------------------+-------------------+ + +:math:`{}^{1}`\ Only used if irrigation is active (Chapter 20). +:math:`{}^{2}`\ Only used if crop model is active (Chapter 20). +:math:`{}^{3}`\ Reserved for future implementations of crop model +(Chapter 20). + +Vegetation Structure +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Vegetation structure is defined by leaf and stem area indices +(:math:`L,\, S`) and canopy top and bottom heights +(:math:`z_{top}` ,\ :math:`z_{bot}` ) (Table 2.2). Separate leaf and +stem area indices and canopy heights are prescribed or calculated for +each PFT. Daily leaf and stem area indices are obtained from gridded +datasets of monthly values (section 2.2.3). Canopy top and bottom +heights are also obtained from gridded datasets. However, these are +currently invariant in space and time and were obtained from +PFT-specific values (Bonan et al. 2002a). When the biogeochemistry model +is active, vegetation state (LAI, SAI, canopy top and bottom heights) +are calculated prognostically (see Chapter 14). + +Table 2.2. Prescribed plant functional type heights + ++-----------------------------------+------------------------+------------------------+ +| Plant functional type | :math:`z_{top}` (m) | :math:`z_{bot}` (m) | ++===================================+========================+========================+ +| NET Temperate | 17 | 8.5 | ++-----------------------------------+------------------------+------------------------+ +| NET Boreal | 17 | 8.5 | ++-----------------------------------+------------------------+------------------------+ +| NDT Boreal | 14 | 7 | ++-----------------------------------+------------------------+------------------------+ +| BET Tropical | 35 | 1 | ++-----------------------------------+------------------------+------------------------+ +| BET temperate | 35 | 1 | ++-----------------------------------+------------------------+------------------------+ +| BDT tropical | 18 | 10 | ++-----------------------------------+------------------------+------------------------+ +| BDT temperate | 20 | 11.5 | ++-----------------------------------+------------------------+------------------------+ +| BDT boreal | 20 | 11.5 | ++-----------------------------------+------------------------+------------------------+ +| BES temperate | 0.5 | 0.1 | ++-----------------------------------+------------------------+------------------------+ +| BDS temperate | 0.5 | 0.1 | ++-----------------------------------+------------------------+------------------------+ +| BDS boreal | 0.5 | 0.1 | ++-----------------------------------+------------------------+------------------------+ +| C\ :math:`{}_{3}` arctic grass | 0.5 | 0.01 | ++-----------------------------------+------------------------+------------------------+ +| C\ :math:`{}_{3}` grass | 0.5 | 0.01 | ++-----------------------------------+------------------------+------------------------+ +| C\ :math:`{}_{4}` grass | 0.5 | 0.01 | ++-----------------------------------+------------------------+------------------------+ +| Crop R | 0.5 | 0.01 | ++-----------------------------------+------------------------+------------------------+ +| Crop I | 0.5 | 0.01 | ++-----------------------------------+------------------------+------------------------+ +| :math:`{}^{1}`\ Corn R | - | - | ++-----------------------------------+------------------------+------------------------+ +| :math:`{}^{1}`\ Corn I | - | - | ++-----------------------------------+------------------------+------------------------+ +| :math:`{}^{1}`\ Temp Cereal R | - | - | ++-----------------------------------+------------------------+------------------------+ +| :math:`{}^{1}`\ Temp Cereal I | - | - | ++-----------------------------------+------------------------+------------------------+ +| :math:`{}^{1}`\ Winter Cereal R | - | - | ++-----------------------------------+------------------------+------------------------+ +| :math:`{}^{1}`\ Winter Cereal I | - | - | ++-----------------------------------+------------------------+------------------------+ +| :math:`{}^{1}`\ Soybean R | - | - | ++-----------------------------------+------------------------+------------------------+ +| :math:`{}^{1}`\ Soybean I | - | - | ++-----------------------------------+------------------------+------------------------+ + +:math:`{}^{1}`\ Determined by the crop model (Chapter 20) + +Phenology and vegetation burial by snow +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When the biogeochemistry model is inactive, leaf and stem area indices +(m:math:`{}^{2}` leaf area m\ :math:`{}^{-2}` ground area) are updated +daily by linearly interpolating between monthly values. Monthly PFT leaf +area index values are developed from the 1-km MODIS-derived monthly grid +cell average leaf area index of Myneni et al. (2002), as described in +Lawrence and Chase (2007). Stem area index is calculated from the +monthly PFT leaf area index using the methods of Zeng et al. (2002). The +leaf and stem area indices are adjusted for vertical burying by snow +(Wang and Zeng 2009) as + +.. math:: + :label: 2.1 + + A=A^{*} ( 1-f_{veg}^{sno} ) + +where :math:`A^{\*}` is the leaf or stem area before adjustment for +snow, :math:`A` is the remaining exposed leaf or stem area, +:math:`f_{veg}^{sno}` is the vertical fraction of vegetation covered by snow + +.. math:: + :label: 2.2 + + {f_{veg}^{sno} = \frac{z_{sno} -z_{bot} }{z_{top} -z_{bot} } \qquad {\rm for\; tree\; and\; shrub}} \\ + {f_{veg}^{sno} = \frac{\min \left(z_{sno} ,\, z_{c} \right)}{z_{c} } \qquad {\rm for\; grass\; and\; crop}} + +where :math:`z_{sno} -z_{bot} \ge 0,{\rm \; }0\le f_{veg}^{sno} \le 1`, +:math:`z_{sno}` is the depth of snow (m) (section 7.2), and +:math:`z_{c} =0.2` is the snow depth when short vegetation is assumed to +be completely buried by snow (m). For numerical reasons, exposed leaf +and stem area are set to zero if less than 0.05. If the sum of exposed +leaf and stem area is zero, then the surface is treated as snow-covered +ground. + +Model Input Requirements +---------------------------- + +Atmospheric Coupling +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The current state of the atmosphere (Table 2.3) at a given time step is +used to force the land model. This atmospheric state is provided by an +atmospheric model in coupled mode or from an observed dataset in offline +mode (Chapter 26). The land model then initiates a full set of +calculations for surface energy, constituent, momentum, and radiative +fluxes. The land model calculations are implemented in two steps. The +land model proceeds with the calculation of surface energy, constituent, +momentum, and radiative fluxes using the snow and soil hydrologic states +from the previous time step. The land model then updates the soil and +snow hydrology calculations based on these fluxes. These fields are +passed to the atmosphere (Table 2.4). The albedos sent to the atmosphere +are for the solar zenith angle at the next time step but with surface +conditions from the current time step. + +Table 2.3. Atmospheric input to land model + ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Field | variable name | units | ++======================================================+================================================+=================================================+ +| :math:`{}^{1}`\ Reference height | :math:`z'_{atm}` | m | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Zonal wind at :math:`z_{atm}` | :math:`u_{atm}` | m s\ :math:`{}^{-1}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Meridional wind at :math:`z_{atm}` | :math:`v_{atm}` | m s\ :math:`{}^{-1}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Potential temperature | :math:`\overline{\theta _{atm} }` | K | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Specific humidity at :math:`z_{atm}` | :math:`q_{atm}` | kg kg\ :math:`{}^{-1}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Pressure at :math:`z_{atm}` | :math:`P_{atm}` | Pa | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Temperature at :math:`z_{atm}` | :math:`T_{atm}` | K | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Incident longwave radiation | :math:`L_{atm} \, \downarrow` | W m\ :math:`{}^{-2}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| :math:`{}^{2}`\ Liquid precipitation | :math:`q_{rain}` | mm s\ :math:`{}^{-1}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| :math:`{}^{2}`\ Solid precipitation | :math:`q_{sno}` | mm s\ :math:`{}^{-1}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Incident direct beam visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}^{\mu }` | W m\ :math:`{}^{-2}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Incident direct beam near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}^{\mu }` | W m\ :math:`{}^{-2}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Incident diffuse visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}` | W m\ :math:`{}^{-2}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Incident diffuse near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}` | W m\ :math:`{}^{-2}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| Carbon dioxide (CO:math:`{}_{2}`) concentration | :math:`c_{a}` | ppmv | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| :math:`{}^{3}`\ Aerosol deposition rate | :math:`D_{sp}` | kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| :math:`{}^{4}`\ Nitrogen deposition rate | :math:`NF_{ndep\_ s{\it min}n}` | g (N) m\ :math:`{}^{-2}` yr\ :math:`{}^{-1}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +| :math:`{}^{5}`\ Lightning frequency | :math:`I_{l}` | flash km\ :math:`{}^{-2}` hr\ :math:`{}^{-1}` | ++------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + +:math:`{}^{1}`\ The atmospheric reference height received from the +atmospheric model :math:`z'_{atm}` is assumed to be the height above +the surface as defined by the roughness length :math:`z_{0}` plus +displacement height :math:`d`. Thus, the reference height used for flux +computations (Chapter 5) is :math:`z_{atm} =z'_{atm} +z_{0} +d`. The +reference heights for temperature, wind, and specific humidity +(:math:`z_{atm,\, h}` , :math:`z_{atm,\, {\it m}}` , +:math:`z_{atm,\, w}` ) are required. These are set equal +to\ :math:`z_{atm}` . + +:math:`{}^{2}`\ The placeCAM provides convective and large-scale liquid +and solid precipitation, which are added to yield total liquid +precipitation :math:`q_{rain}` and solid precipitation +:math:`q_{sno}` . + +:math:`{}^{3}`\ There are 14 aerosol deposition rates required depending +on species and affinity for bonding with water; 8 of these are dust +deposition rates (dry and wet rates for 4 dust size bins, +:math:`D_{dst,\, dry1} ,\, D_{dst,\, dry2} ,\, D_{dst,\, dry3} ,\, D_{dst,\, dry4}` , +:math:`D_{dst,\, \, wet1} ,D_{dst,\, wet2} ,\, D_{dst,wet3} ,\, D_{dst,\, wet4}` ), +3 are black carbon deposition rates (dry and wet hydrophilic and dry +hydrophobic rates, +:math:`D_{bc,\, dryhphil} ,\, D_{bc,\, wethphil} ,\, D_{bc,\, dryhphob}` ), +and 3 are organic carbon deposition rates (dry and wet hydrophilic and +dry hydrophobic rates, +:math:`D_{oc,\, dryhphil} ,\, D_{oc,\, wethphil} ,\, D_{oc,\, dryhphob}` ). +These fluxes are computed interactively by the atmospheric model (when +prognostic aerosol representation is active) or are prescribed from a +time-varying (annual cycle or transient), globally-gridded deposition +file defined in the namelist (see the CLM4.5 User’s Guide). Aerosol +deposition rates were calculated in a transient 1850-2009 CAM simulation +(at a resolution of 1.9x2.5x26L) with interactive chemistry (troposphere +and stratosphere) driven by CCSM3 20\ :math:`{}^{th}` century +sea-surface temperatures and emissions (Lamarque et al. 2010) for +short-lived gases and aerosols; observed concentrations were specified +for methane, N\ :math:`{}_{2}`\ O, the ozone-depleting substances (CFCs) +,and CO\ :math:`{}_{2}`. The fluxes are used by the snow-related +parameterizations (Chapters 3 and 7). + +:math:`{}^{4}`\ The nitrogen deposition rate is required by the +biogeochemistry model when active and represents the total deposition of +mineral nitrogen onto the land surface, combining deposition of +NO\ :math:`{}_{y}` and NH\ :math:`{}_{x}`. The rate is supplied either +as a time-invariant spatially-varying annual mean rate or time-varying +for a transient simulation. Nitrogen deposition rates were calculated +from the same CAM chemistry simulation that generated the aerosol +deposition rates. + +:math:`{}^{5}`\ Climatological 3-hourly lightning frequency at +:math:`\sim`\ 1.8\ :math:`{}^{o}` resolution is provided, which was +calculated via bilinear interpolation from 1995-2011 NASA LIS/OTD grid +product v2.2 (http://ghrc.msfc.nasa.gov) 2-hourly, 2.5\ :math:`{}^{o}` +lightning frequency data. In future versions of the model, lightning +data may be obtained directly from the atmosphere model. + +Density of air (:math:`\rho _{atm}` ) (kg m\ :math:`{}^{-3}`) is also +required but is calculated directly from +:math:`\rho _{atm} =\frac{P_{atm} -0.378e_{atm} }{R_{da} T_{atm} }` +where :math:`P_{atm}` is atmospheric pressure (Pa), :math:`e_{atm}` is +atmospheric vapor pressure (Pa), :math:`R_{da}` is the gas constant for +dry air (J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), and +:math:`T_{atm}` is the atmospheric temperature (K). The atmospheric +vapor pressure :math:`e_{atm}` is derived from atmospheric specific +humidity :math:`q_{atm}` (kg kg\ :math:`{}^{-1}`) as +:math:`e_{atm} =\frac{q_{atm} P_{atm} }{0.622+0.378q_{atm} }` . + +The O\ :math:`{}_{2}` partial pressure (Pa) is required but is +calculated from molar ratio and the atmospheric pressure +:math:`P_{atm}` as :math:`o_{i} =0.209P_{atm}` . + +Table 2.4. Land model output to atmospheric model + ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Field | Variable name | units | ++=======================================+================================================+==============================================================+ +| :math:`{}^{1}`\ Latent heat flux | :math:`\lambda _{vap} E_{v} +\lambda E_{g}` | W m\ :math:`{}^{-2}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Sensible heat flux | :math:`H_{v} +H_{g}` | W m\ :math:`{}^{-2}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Water vapor flux | :math:`E_{v} +E_{g}` | mm s\ :math:`{}^{-1}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Zonal momentum flux | :math:`\tau _{x}` | kg m\ :math:`{}^{-1}` s\ :math:`{}^{-2}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Meridional momentum flux | :math:`\tau _{y}` | kg m\ :math:`{}^{-1}` s\ :math:`{}^{-2}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Emitted longwave radiation | :math:`L\, \uparrow` | W m\ :math:`{}^{-2}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Direct beam visible albedo | :math:`I\, \uparrow _{vis}^{\mu }` | - | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Direct beam near-infrared albedo | :math:`I\, \uparrow _{nir}^{\mu }` | - | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Diffuse visible albedo | :math:`I\, \uparrow _{vis}` | - | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Diffuse near-infrared albedo | :math:`I\, \uparrow _{nir}` | - | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Absorbed solar radiation | :math:`\vec{S}` | W m\ :math:`{}^{-2}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Radiative temperature | :math:`T_{rad}` | K | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Temperature at 2 meter height | :math:`T_{2m}` | K | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Specific humidity at 2 meter height | :math:`q_{2m}` | kg kg\ :math:`{}^{-1}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Snow water equivalent | :math:`W_{sno}` | m | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Aerodynamic resistance | :math:`r_{am}` | s m\ :math:`{}^{-1}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Friction velocity | :math:`u_{*}` | m s\ :math:`{}^{-1}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| :math:`{}^{2}`\ Dust flux | :math:`F_{j}` | kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +| Net ecosystem exchange | NEE | kgCO\ :math:`{}_{2}` m\ :math:`{}^{-2}` s\ :math:`{}^{-1}` | ++---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + +:math:`{}^{1}`\ :math:`\lambda _{vap}` is the latent heat of +vaporization (J kg\ :math:`{}^{-1}`) (Table 2.6) and :math:`\lambda` is +either the latent heat of vaporization :math:`\lambda _{vap}` or latent +heat of sublimation :math:`\lambda _{sub}` (J kg\ :math:`{}^{-1}`) +(Table 2.6) depending on the liquid water and ice content of the top +snow/soil layer (section 5.4). + +:math:`{}^{2}`\ There are :math:`j=1,\ldots ,4` dust transport bins. + +Initialization +^^^^^^^^^^^^^^^^^^^^ + +Initialization of the land model (i.e., providing the model with initial +temperature and moisture states) depends on the type of run (startup or +restart) (see the CLM4.5 User’s Guide). A startup run starts the model +from either initial conditions that are set internally in the Fortran +code (referred to as arbitrary initial conditions) or from an initial +conditions dataset that enables the model to start from a spun up state +(i.e., where the land is in equilibrium with the simulated climate). In +restart runs, the model is continued from a previous simulation and +initialized from a restart file that ensures that the output is +bit-for-bit the same as if the previous simulation had not stopped. The +fields that are required from the restart or initial conditions files +can be obtained by examining the code. Arbitrary initial conditions are +specified as follows. + +Vegetated and glacier land units have fifteen vertical layers, while +lakes have ten. For soil points, temperature calculations are done over +all layers, :math:`N_{levgrnd} =15`, while hydrology calculations are +done over the top ten layers, :math:`N_{levsoi} =10`, the bottom five +layers being specified as bedrock. Soil points are initialized with +surface ground temperature :math:`T_{g}` and soil layer temperature +:math:`T_{i}` , for :math:`i=1,\ldots ,N_{levgrnd}` , of 274 K, +vegetation temperature :math:`T_{v}` of 283 K, no snow or canopy water +(:math:`W_{sno} =0`, :math:`W_{can} =0`), and volumetric soil water +content :math:`\theta _{i} =0.15` mm\ :math:`{}^{3}` mm\ :math:`{}^{-3}` +for layers :math:`i=1,\ldots ,N_{levsoi}` and :math:`\theta _{i} =0.0` +mm\ :math:`{}^{3}` mm\ :math:`{}^{-3}` for layers +:math:`i=N_{levsoi} +1,\ldots ,N_{levgrnd}` . placeLake temperatures +(:math:`T_{g}` and :math:`T_{i}` ) are initialized at 277 K and +:math:`W_{sno} =0`. + +Glacier temperatures (:math:`T_{g} =T_{snl+1}` and :math:`T_{i}` for +:math:`i=snl+1,\ldots ,N_{levgrnd}` where :math:`snl` is the negative +of the number of snow layers, i.e., :math:`snl` ranges from –5 to 0) are +initialized to 250 K with a snow water equivalent :math:`W_{sno} =1000` +mm, snow depth :math:`z_{sno} =\frac{W_{sno} }{\rho _{sno} }` (m) where +:math:`\rho _{sno} =250` kg m\ :math:`{}^{-3}` is an initial estimate +for the bulk density of snow, and :math:`\theta _{i}` \ =1.0 for +:math:`i=1,\ldots ,N_{levgrnd}` . The snow layer structure (e.g., number +of snow layers :math:`snl` and layer thickness) is initialized based on +the snow depth (section 6.1). The snow liquid water and ice contents (kg +m\ :math:`{}^{-2}`) are initialized as :math:`w_{liq,\, i} =0` and +:math:`w_{ice,\, i} =\Delta z_{i} \rho _{sno}` , respectively, where +:math:`i=snl+1,\ldots ,0` are the snow layers, and :math:`\Delta z_{i}` +is the thickness of snow layer :math:`i` (m). The soil liquid water and +ice contents are initialized as :math:`w_{liq,\, i} =0` and +:math:`w_{ice,\, i} =\Delta z_{i} \rho _{ice} \theta _{i}` for +:math:`T_{i} \le T_{f}` , and +:math:`w_{liq,\, i} =\Delta z_{i} \rho _{liq} \theta _{i}` and +:math:`w_{ice,\, i} =0` for :math:`T_{i} >T_{f}` , where +:math:`\rho _{ice}` and :math:`\rho _{liq}` are the densities of ice +and liquid water (kg m\ :math:`{}^{-3}`) (Table 2.6), and :math:`T_{f}` +is the freezing temperature of water (K) (Table 2.6). All vegetated and +glacier land units are initialized with water stored in the unconfined +aquifer and unsaturated soil :math:`W_{a} =4000` mm and water table +depth :math:`z_{\nabla }` at five meters below the soil column. + +Surface Data +^^^^^^^^^^^^^^^^^^ + +Required surface data for each land grid cell are listed in Table 2.5 +and include the glacier, lake, and urban fractions of the grid cell +(vegetated and crop occupy the remainder), the fractional cover of each +plant functional type (PFT), monthly leaf and stem area index and canopy +top and bottom heights for each PFT, soil color, soil texture, soil +organic matter density, maximum fractional saturated area, slope, +elevation, biogenic volatile organic compounds (BVOCs) emissions +factors, population density, gross domestic production, peat area +fraction, and peak month of agricultural burning. Optional surface data +include crop irrigation and managed crops. All fields are aggregated to +the model’s grid from high-resolution input datasets (Table 2.5) that +are obtained from a variety of sources described below. + +Table 2.5. Surface data required for CLM and their base spatial +resolution + ++--------------------------------------------+---------------------------+ +| Surface Field | Resolution | ++============================================+===========================+ +| Percent glacier | 0.05\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Percent lake and lake depth | 0.05\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Percent urban | 0.05\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Percent plant functional types (PFTs) | 0.05\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Monthly leaf and stem area index | 0.5\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Canopy height (top, bottom) | 0.5\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Soil color | 0.5\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Percent sand, percent clay | 0.083\ :math:`{}^\circ` | ++--------------------------------------------+---------------------------+ +| Soil organic matter density | 0.083\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Maximum fractional saturated area | 0.125\ :math:`\circ` | ++--------------------------------------------+---------------------------+ +| Elevation | 1km | ++--------------------------------------------+---------------------------+ +| Slope | 1km | ++--------------------------------------------+---------------------------+ +| Biogenic Volatile Organic Compounds | 0.5\ :math:`{}^\circ` | ++--------------------------------------------+---------------------------+ +| Crop Irrigation | 0.083\ :math:`{}^\circ` | ++--------------------------------------------+---------------------------+ +| Managed crops | 0.5\ :math:`{}^\circ` | ++--------------------------------------------+---------------------------+ +| Population density | 0.5\ :math:`{}^\circ` | ++--------------------------------------------+---------------------------+ +| Gross domestic production | 0.5\ :math:`{}^\circ` | ++--------------------------------------------+---------------------------+ +| Peat area fraction | 0.5\ :math:`{}^\circ` | ++--------------------------------------------+---------------------------+ +| Peak month of agricultural waste burning | 0.5\ :math:`{}^\circ` | ++--------------------------------------------+---------------------------+ + +At the base spatial resolution of 0.05\ :math:`\circ`, the percentage of +each PFT is defined with respect to the vegetated portion of the grid +cell and the sum of the PFTs is 100%. The percent lake, wetland, +glacier, and urban at their base resolution are specified with respect +to the entire grid cell. The surface dataset creation routines re-adjust +the PFT percentages to ensure that the sum of all land cover types in +the grid cell sum to 100%. A minimum threshold of 0.1% of the grid cell +by area is required for urban areas. + +The percentage glacier mask was derived from vector data of global +glacier and ice sheet spatial coverage. Vector data for glaciers (ice +caps, icefields and mountain glaciers) were taken from the first +globally complete glacier inventory, the Randolph Glacier Inventory +version 1.0 (RGIv1.0: Arendt et al. 2012). Vector data for the Greenland +Ice Sheet were provided by Frank Paul and Tobias Bolch (University of +Zurich: Rastner et al. 2012). Antarctic Ice Sheet data were provided by +Andrew Bliss (University of Alaska) and were extracted from the +Scientific Committee on Antarctic Research (SCAR) Antarctic Digital +Database version 5.0. Floating ice is only provided for the Antarctic +and does not include the small area of Arctic ice shelves. High spatial +resolution vector data were then processed to determine the area of +glacier, ice sheet and floating ice within 30-second grid cells +globally. The 30-second glacier, ice sheet and Antarctic ice shelf masks +were subsequently draped over equivalent-resolution GLOBE topography +(Global Land One-km Base Elevation Project, Hastings et al. 1999) to +extract approximate ice-covered elevations of ice-covered regions. Grid +cells flagged as land-ice in the mask but ocean in GLOBE (typically, +around ice sheets at high latitudes) were designated land-ice with an +elevation of 0 meters. Finally, the high-resolution mask/topography +datasets were aggregated and processed into three 3-minute datasets: +3-minute fractional areal land ice coverage (including both glaciers and +ice sheets); 3-minute distributions of areal glacier fractional coverage +by elevation and areal ice sheet fractional coverage by elevation. Ice +fractions were binned at 100 meter intervals, with bin edges defined +from 0 to 6000 meters (plus one top bin encompassing all remaining +high-elevation ice, primarily in the Himalaya). These distributions by +elevation are needed when running CLM4 with multiple glacier elevation +classes. + +Percent lake and lake depth are area-averaged from the 90-second +resolution data of Kourzeneva (2009, 2010) to the 0.05\ :math:`{}^\circ` +resolution using the MODIS land-mask. Percent urban is derived from +LandScan 2004, a population density dataset derived from census data, +nighttime lights satellite observations, road proximity and slope +(Dobson et al. 2000) as described by Jackson et al. (2010) at 1km +resolution and aggregated to 0.05\ :math:`{}^\circ`. A number of urban +radiative, thermal, and morphological fields are also required and are +obtained from Jackson et al. (2010). Their description can be found in +Table 3 of the Community Land Model Urban (CLMU) technical note (Oleson +et al. 2010b). + +Percent PFTs are derived from MODIS satellite data as described in +Lawrence and Chase (2007) (section 21.3.3). Prescribed PFT leaf area +index is derived from the MODIS satellite data of Myneni et al. (2002) +using the de-aggregation methods described in Lawrence and Chase (2007) +(section 2.2.3). Prescribed PFT stem area index is derived from PFT leaf +area index phenology combined with the methods of Zeng et al. (2002). +Prescribed canopy top and bottom heights are from Bonan (1996) as +described in Bonan et al. (2002b). If the biogeochemistry model is +active, it supplies the leaf and stem area index and canopy top and +bottom heights dynamically, and the prescribed values are ignored. + +Soil color determines dry and saturated soil albedo (section 3.2). Soil +colors are from Lawrence and Chase (2007) (section 3.2). + +The soil texture and organic matter content determine soil thermal and +hydrologic properties (sections 6.3 and 7.4.1). The International +Geosphere-Biosphere Programme (IGBP) soil dataset (Global Soil Data Task +2000) of 4931 soil mapping units and their sand and clay content for +each soil layer were used to create a mineral soil texture dataset +(Bonan et al. 2002b). Soil organic matter data is merged from two +sources. The majority of the globe is from ISRIC-WISE (Batjes, 2006). +The high latitudes come from the 0.25\ :math:`{}^\circ` version of the +Northern Circumpolar Soil Carbon Database (Hugelius et al. 2012). Both +datasets report carbon down to 1m depth. Carbon is partitioned across +the top seven CLM4 layers (:math:`\sim`\ 1m depth) as in Lawrence and +Slater (2008). + +The maximum fractional saturated area (:math:`f_{\max }` ) is used in +determining surface runoff and infiltration (section 7.3). Maximum +fractional saturated area at 0.125\ :math:`{}^{o}` resolution is +calculated from 1-km compound topographic indices (CTIs) based on the +USGS HYDRO1K dataset (Verdin and Greenlee 1996) following the algorithm +in Niu et al. (2005). :math:`f_{\max }` is the ratio between the number +of 1-km pixels with CTIs equal to or larger than the mean CTI and the +total number of pixels in a 0.125\ :math:`{}^\circ` grid cell. See +section 7.3.1 and Li et al. (2013b) for further details. Slope and +elevation are also obtained from the USGS HYDRO1K 1-km dataset (Verdin +and Greenlee 1996). Slope is used in the River Transport Model (Chapter +11) and in the surface water parameterization (section 7.3.2), and +elevation is used to calculate the grid cell standard deviation of +topography for the snow cover fraction parameterization (section 7.2.1). + +Biogenic Volatile Organic Compounds emissions factors are from the Model +of Emissions of Gases and Aerosols from Nature version 2.1 (MEGAN2.1; +Guenther et al. 2012). + +The default list of PFTs includes an unmanaged crop treated as a second +C3 grass (Table 2.1). The unmanaged crop has grid cell fractional cover +assigned from MODIS satellite data (Lawrence and Chase 2007). A managed +crop option uses grid cell fractional cover from the present-day crop +dataset of Ramankutty and Foley (1998) (CLM4CNcrop). Managed crops are +assigned in the proportions given by Ramankutty and Foley (1998) without +exceeding the area previously assigned to the unmanaged crop. The +unmanaged crop continues to occupy any of its original area that remains +and continues to be handled just by the CN part of CLM4CNcrop. The +managed crop types (corn, soybean, and temperate cereals) were chosen +based on the availability of corresponding algorithms in AgroIBIS +(Kucharik et al. 2000; Kucharik and Brye 2003). Temperate cereals +include wheat, barley, and rye here. All temperate cereals are treated +as summer crops (like spring wheat, for example) at this time. Winter +cereals (such as winter wheat) may be introduced in a future version of +the model. + +To allow crops to coexist with natural vegetation in a grid cell and be +treated by separate models (i.e., CLM4.5BGCcrop versus the Dynamic +Vegetation version (CLM4.5BGCDV)), we separate the vegetated land unit +into a naturally vegetated land unit and a human managed land unit. PFTs +in the naturally vegetated land unit share one soil column and compete +for water (default CLM setting). PFTs in the human managed land unit do +not share soil columns and thus permit for differences in land +management between crops. + +CLM includes the option to irrigate cropland areas that are equipped for +irrigation. The application of irrigation responds dynamically to +climate (see Chapter 20). In CLM, irrigation is implemented for the C3 +generic crop only. When irrigation is enabled, the cropland area of each +grid cell is divided into an irrigated and unirrigated fraction +according to a dataset of areas equipped for irrigation (Siebert et al. +2005). The area of irrigated cropland in each grid cell is given by the +smaller of the grid cell’s total cropland area, according to the default +CLM4 dataset, and the grid cell’s area equipped for irrigation. The +remainder of the grid cell’s cropland area (if any) is then assigned to +unirrigated cropland. Irrigated and unirrigated crops are placed on +separate soil columns, so that irrigation is only applied to the soil +beneath irrigated crops. + +Several input datasets are required for the fire model (Li et al. 2013a) +including population density, gross domestic production, peat area +fraction, and peak month of agricultural waste burning. Population +density at 0.5\ :math:`{}^{o}` resolution for 1850-2100 combines 5-min +resolution decadal population density data for 1850–1980 from the +Database of the Global Environment version 3.1 (HYDEv3.1) with +0.5\ :math:`{}^{o}` resolution population density data for 1990, 1995, +2000, and 2005 from the Gridded Population of the World version 3 +dataset (GPWv3) (CIESIN, 2005). Gross Domestic Production (GDP) per +capita in 2000 at 0.5\ :math:`{}^{o}` is from Van Vuuren et al. (2006), +which is the base-year GDP data for IPCC-SRES and derived from +country-level World Bank’s World Development Indicators (WDI) measured +in constant 1995 US$ (World Bank, 2004) and the UN Statistics Database +(UNSTAT, 2005). The peatland area fraction at 0.5\ :math:`{}^{o}` +resolution is derived from three vector datasets: peatland data in +Indonesia and Malaysian Borneo (Olson et al. 2001); peatland data in +Canada (Tarnocai et al. 2011); and bog, fen and mire data in boreal +regions (north of 45\ :math:`{}^{o}`\ N) outside Canada provided by the +Global Lakes and Wetlands Database (GLWD) (Lehner and Döll, 2004). The +climatological peak month for agricultural waste burning is from van der +Werf et al. (2010). + +Adjustable Parameters and Physical Constants +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Values of certain adjustable parameters inherent in the biogeophysical +or biogeochemical parameterizations have either been obtained from the +literature or calibrated based on comparisons with observations. These +are described in the text. Physical constants, generally shared by all +of the components in the coupled modeling system, are presented in Table +2.6. + +.. csv-table:: Table 2.6. Physical constants + :header: "description", "name", "value", "units" + :widths: 40, 20, 20, 20 + + "Pi", :math:`\pi`, 3.14159265358979323846, "\-" + "Acceleration of gravity", :math:`g`, 9.80616, m s\ :math:`{}^{-2}` + "Standard pressure", :math:`P_{std}`, 101325, "Pa" + "Stefan-Boltzmann constant", :math:`\sigma`, 5.67 :math:`\times 10^{-8}`, W m :math:`{}^{-2}` K :math:`{}^{-4}` + "Boltzmann constant", :math:`\kappa`, 1.38065 :math:`\times 10^{-23}`, J K :math:`{}^{-1}` molecule :math:`{}^{-1}` + "Avogadro’s number", :math:`N_{A}`, 6.02214 :math:`\times 10^{26}`, molecule kmol\ :math:`{}^{-1}` + "Universal gas constant", :math:`R_{gas}`, :math:`N_{A} \kappa`, J K :math:`{}^{-1}` kmol :math:`{}^{-1}` + "Molecular weight of dry air", :math:`MW_{da}`, 28.966, kg kmol :math:`{}^{-1}` + "Dry air gas constant", :math:`R_{da}`, :math:`{R_{gas} \mathord{\left/ {\vphantom {R_{gas} MW_{da} }} \right. \kern-\nulldelimiterspace} MW_{da} }`, J K :math:`{}^{-1}` kg :math:`{}^{-1}` + "Molecular weight of water vapor", :math:`MW_{wv}`, 18.016, kg kmol :math:`{}^{-1}` + "Water vapor gas constant", :math:`R_{wv}`, :math:`{R_{gas} \mathord{\left/ {\vphantom {R_{gas} MW_{wv} }} \right. \kern-\nulldelimiterspace} MW_{wv} }`, J K :math:`{}^{-1}` kg :math:`{}^{-1}` + "Von Karman constant", :math:`k`, 0.4, "\-" + "Freezing temperature of fresh water", :math:`T_{f}`, 273.5, K + "Density of liquid water", :math:`\rho _{liq}`, 1000, kg m :math:`{}^{-3}` + "Density of ice", :math:`\rho _{ice}`, 917, kg m :math:`{}^{-3}` + "Specific heat capacity of dry air", :math:`C_{p}`, 1.00464 :math:`\times 10^{3}`, J kg :math:`{}^{-1}` K :math:`{}^{-1}` + "Specific heat capacity of water", :math:`C_{liq}`, 4.188 :math:`\times 10^{3}`, J kg :math:`{}^{-1}` K :math:`{}^{-1}` + "Specific heat capacity of ice", :math:`C_{ice}`, 2.11727 :math:`\times 10^{3}`, J kg :math:`{}^{-1}` K :math:`{}^{-1}` + "Latent heat of vaporization", :math:`\lambda _{vap}`, 2.501 :math:`\times 10^{6}`, J kg :math:`{}^{-1}` + "Latent heat of fusion", :math:`L_{f}`, 3.337 :math:`\times 10^{5}`, J kg :math:`{}^{-1}` + "Latent heat of sublimation", :math:`\lambda _{sub}`, :math:`\lambda _{vap} +L_{f}`, J kg :math:`{}^{-1}` + :math:`{}^{1}` "Thermal conductivity of water", :math:`\lambda _{liq}`, 0.57, W m :math:`{}^{-1}` K :math:`{}^{-1}` + :math:`{}^{1}` "Thermal conductivity of ice", :math:`\lambda _{ice}`, 2.29, W m :math:`{}^{-1}` K :math:`{}^{-1}` + :math:`{}^{1}` "Thermal conductivity of air", :math:`\lambda _{air}`, 0.023 W m :math:`{}^{-1}` K :math:`{}^{-1}` + "Radius of the earth", :math:`R_{e}`, 6.37122, :math:`\times 10^{6}` m + +:math:`{}^{1}`\ Not shared by other components of the coupled modeling system. + diff --git a/doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst b/doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst new file mode 100644 index 0000000000..2c378b3aec --- /dev/null +++ b/doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst @@ -0,0 +1,722 @@ +**** + +Crops and Irrigation +======================== + +Summary of CLM4.5 updates relative to the CLM4.0 +----------------------------------------------------- + +We describe here the complete crop and irrigation parameterizations that +appear in CLM4.5. Corresponding information for CLM4.0 appeared on the +CLM4.0 web site in a pdf document independent of the CLM4.0 Technical +Note (Oleson et al. 2010a). The CLM4.0 crop model description also +appeared in Levis et al. (2012). + +CLM4.5 includes the following updates to the CROP option, where CROP +refers to the interactive crop management model: + +- Interactive irrigation + +- Interactive fertilization + +- Biological nitrogen fixation for soybeans + +- Modified C:N ratios for crops + +- Nitrogen retranslocation for crops + +- Separate reproductive pool + +These updates appear in detail in section 20.4. Most also appear in +Drewniak et al. (2013). + +The crop model +------------------- + +20.2.1 Introduction +^^^^^^^^^^^^^^^^^^^ + +Groups developing Earth System Models generally account for the human +footprint on the landscape in simulations of historical and future +climates. Traditionally we have represented this footprint with natural +vegetation types and particularly grasses because they resemble many +common crops. Most modeling efforts have not incorporated more explicit +representations of land management such as crop type, planting, +harvesting, tillage, fertilization, and irrigation, because global scale +datasets of these factors have lagged behind vegetation mapping. As this +begins to change, we increasingly find models that will simulate the +biogeophysical and biogeochemical effects not only of natural but also +human-managed land cover. + +AgroIBIS is a state-of-the-art land surface model with options to +simulate dynamic vegetation (Kucharik et al. ** 2000) and interactive +crop management (Kucharik and Brye 2003). The interactive crop +management parameterizations from AgroIBIS (March 2003 version) were +coupled as a proof-of-concept to the Community Land Model version 3 +[CLM3.0, Oleson et al. ** (2004)] (not published), then coupled to the +CLM3.5 (Levis et al. 2009) and later released to the community with +CLM4CN (Levis et al. 2012). + +With interactive crop management and, therefore, a more accurate +representation of agricultural landscapes, we hope to improve the CLM’s +simulated biogeophysics and biogeochemistry. These advances may improve +fully coupled simulations with the Community Earth System Model (CESM), +while helping human societies answer questions about changing food, +energy, and water resources in response to climate, environmental, land +use, and land management change (e.g., Kucharik and Brye 2003; Lobell et +al. ** 2006). + +20.2.2 Crop plant functional types +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +CLM’s default list of plant functional types (pfts) includes an +unmanaged crop (Table 2.1) treated as a second C3 grass. The unmanaged +crop has grid cell coverage assigned from satellite data, as do all +natural pfts when CLM’s dynamic vegetation model (CNDV; Castillo et al. +2012) is not active. + +The new crop pfts used in the CLM get grid cell coverage from the +present-day crop dataset of Portmann et al. (2010). We assign these +managed crops in the proportions given by Portmann et al. (2010) without +exceeding the area previously assigned to the unmanaged crop. The +unmanaged crop continues to occupy any of its original area that remains +and continues to be handled just by the carbon/nitrogen cycling part of +the CLM (i.e., CN). The managed crop types (corn, soybean, and temperate +cereals) were chosen based on the availability of corresponding +algorithms in AgroIBIS. Temperate cereals include wheat, barley, and rye +here. We treat all temperate cereals as summer crops (like spring wheat, +for example) at this time. We may introduce winter cereals (such as +winter wheat) in a future version of the model. + +To allow crops to coexist with natural vegetation in a grid cell and be +treated by separate models (i.e., CLM4.5CNcrop versus CLM4.5CNDV), we +separate the vegetated land unit into a naturally vegetated land unit +and a human managed land unit. Plant functional types in the naturally +vegetated land unit share one soil column and compete for water (default +CLM setting). Managed crop PFTs in the human managed land unit do not +share soil columns and thus permit for differences in land management +between crops. + +20.2.3 Phenology +^^^^^^^^^^^^^^^^ + +CLM4.5CN includes evergreen, seasonally deciduous (responding to changes +in day length), and stress deciduous (responding to changes in +temperature and/or soil moisture) phenology algorithms (Chapter 14). In +CLM4.5CNcrop we have added the AgroIBIS crop phenology algorithm, +consisting of three distinct phases. + +Phase 1 starts at planting and ends with leaf emergence, phase 2 +continues from leaf emergence to the beginning of grain fill, and phase +3 starts from the beginning of grain fill and ends with physiological +maturity and harvest. + +20.2.3.1 Planting +''''''''''''''''' + +Corn and temperate cereals must meet the following requirements between +April 1\ :math:`{}^{st}` and June 14\ :math:`{}^{th}` for planting in +the northern hemisphere (NH): + +.. math:: + + \label{ZEqnNum568682} + \begin{array}{l} {T_{10d} >T_{p} } \\ {T_{10d}^{\min } >T_{p}^{\min } } \\ {GDD_{8} \ge GDD_{\min } } \end{array} + +where *T*\ :math:`{}_{10}`\ *:math:`{}_{d}`* is the 10-day running mean +of *T*\ :math:`{}_{2}`\ *:math:`{}_{m}`*, (the simulated 2-m air +temperature at every model time step) and :math:`T_{10d}^{\min }` is +the 10-day running mean of :math:`T_{2m}^{\min }` (the daily minimum of +*T*\ :math:`{}_{2}`\ *:math:`{}_{m}`*). *T\ :math:`{}_{p}`* and +:math:`T_{p}^{\min }` are crop-specific coldest planting temperatures +(Table 20.1), *GDD*\ :math:`{}_{8}` is the 20-year running mean growing +degree-days (units are degree-days or :math:`{}^\circ`\ days) tracked +from April through September (NH) base 8\ :math:`{}^\circ`\ C with +maximum daily increments of 30\ :math:`{}^\circ`\ days (see Eq. ), and +*GDD*\ :math:`{}_{min }`\ is the minimum growing degree day requirement +(Table 20.1). Soy must meet the same requirements but between May +1\ :math:`{}^{st}` and June 14\ :math:`{}^{th}` for planting. If the +requirements in Eq. are not met by June 14\ :math:`{}^{th}`, then corn, +soybean, and temperate cereals are still planted on June +15\ :math:`{}^{th}` as long as *GDD*\ :math:`{}_{8}`\ :math:`>`\ 0. In +the southern hemisphere (SH) the NH requirements apply 6 months later. + +*GDD*\ :math:`{}_{8}` does not change as quickly as +*T*\ :math:`{}_{10}`\ *:math:`{}_{d}`* and :math:`T_{10d}^{\min }` , so +it determines whether the crop can be planted in a grid cell, while the +two faster-changing variables determine when the crop may be planted. + +At planting, each crop is assigned 1 g leaf C m\ :math:`{}^{-2}` pft +column area to be transferred to the leaves upon leaf emergence. An +equivalent amount of seed leaf N is assigned given the pft’s C to N +ratio for leaves (*CN\ :math:`{}_{leaf}`*). (This differs from AgroIBIS, +which uses a seed leaf area index instead of seed C.) + +At planting, the model updates the average growing degree-days necessary +for the crop to reach vegetative and physiological maturity, +*GDD*\ :math:`{}_{mat}`, according to the following AgroIBIS rules: + +.. math:: + + \label{20.2)} + \begin{array}{l} {GDD_{{\rm mat}}^{{\rm corn}} =0.85GDD_{{\rm 8}} {\rm \; \; \; and\; \; \; 950}` 0, and *:math:`\beta`\ :math:`{}_{t}`* :math:`<` 1, +i.e., water is limiting for photosynthesis (see section 8.4). + +If irrigation is required, the model computes the deficit between the +current soil moisture content and a target soil moisture content; this +deficit is the amount of water that will be added through irrigation. +The target soil moisture content in each soil layer *i* +(*w\ :math:`{}_{target,i}`*, kg m\ :math:`{}^{-2}`) is a weighted +average of the minimum soil moisture content that results in no water +stress in that layer (*w\ :math:`{}_{o,i}`*, kg m\ :math:`{}^{-2}`) and +the soil moisture content at saturation in that layer +(*w\ :math:`{}_{sat,i}`*, kg m\ :math:`{}^{-2}`): + +.. math:: + + \label{20.7)} + w_{target,i} =(1-0.7)\cdot w_{o,i} +0.7\cdot w_{sat,i} + +*w\ :math:`{}_{o,i}`* is determined by inverting equation 8.19 in Oleson +et al. (2010a) to solve for the value of *s\ :math:`{}_{i}`* (soil +wetness) that makes *:math:`\Psi`\ :math:`{}_{i}`* = +*:math:`\Psi`\ :math:`{}_{o}`* (where *:math:`\Psi`\ :math:`{}_{i}`* is +the soil water matric potential and *:math:`\Psi`\ :math:`{}_{o}`* is +the soil water potential when stomata are fully open), and then +converting this value to units of kg m\ :math:`{}^{-2}`. +*w\ :math:`{}_{sat,i}`* is calculated simply by converting effective +porosity (section 7.4) to units of kg m\ :math:`{}^{-2}`. The value 0.7 +was determined empirically, in order to give global, annual irrigation +amounts that approximately match observed gross irrigation water use +around the year 2000 (i.e., total water withdrawals for irrigation: +:math:`\sim` 2500 – 3000 km\ :math:`{}^{3}` year\ :math:`{}^{-1}` +(Shiklomanov 2000)). The total water deficit (*w\ :math:`{}_{deficit}`*, +kg m\ :math:`{}^{-2}`) of the column is then determined by: + +.. math:: + + \label{20.8)} + w_{deficit} =\sum _{i}\max \left(w_{target,i} -w_{liq,i} ,0\right) + +where *w\ :math:`{}_{liq,i}`* (kg m\ :math:`{}^{-2}`) is the current +soil water content of layer *i* (Chapter 7). The max function means that +a surplus in one layer cannot make up for a deficit in another layer. +The sum is taken only over soil layers that contain roots. In addition, +if the temperature of any soil layer is below freezing, then the sum +only includes layers above the top-most frozen soil layer. + +The amount of water added to this column through irrigation is then +equal to *w\ :math:`{}_{deficit}`*. This irrigation is applied at a +constant rate over the following four hours. Irrigation water is applied +directly to the ground surface, bypassing canopy interception (i.e., +added to *q\ :math:`{}_{grnd,liq}`*: section 7.1). Added irrigation is +removed from total liquid runoff (*R\ :math:`{}_{liq}`*: Chapter 11), +simulating removal from nearby rivers. + +The details about what is new in CLM4.5 +-------------------------------------------- + +20.4.1 Interactive irrigation for corn, temperate cereals, and soybean +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +CLM4.0 included interactive irrigation only for the generic C3 crops, +i.e. plant functional types (pfts) 15 (rainfed) and 16 (irrigated) in +the CLM list of pfts and not for the additional crops of the interactive +crop management model (CROP). Irrigation and CROP were mutually +exclusive in CLM4.0. + +In CLM4.5 we have reversed this situation. Now the irrigation model can +be used only while running with CROP. To accomplish this we downloaded +data of percent irrigated and percent rainfed corn, soybean, and +temperate cereals (wheat, barley, and rye) (Portmann et al. 2010), +available online from + +*ftp://ftp.rz.uni-frankfurt.de/pub/uni-frankfurt/physische\_geographie/hydrologie/public/data/MIRCA2000/harvested\_area\_grids.* + +We embedded this data in CLM’s high-resolution pft data for use with the +tool mksurfdat to generate surface datasets at any desired resolution. +Now this data includes percent cover for 24 pfts: + +1-16 as in the standard list of pfts, plus six more: + +17 corn + +18 irrigated\_corn + +19 spring\_temperate\_cereal + +20 irrigated\_spring\_temperate\_cereal + +21 winter\_temperate\_cereal + +22 irrigated\_winter\_temperate\_cereal + +23 soybean + +24 irrigated\_soybean + +We intend surface datasets with 24 pfts only for CROP simulations with +or without irrigation. In simulations without irrigation, the rainfed +and irrigated crops merge into just rainfed crops at run time. Surface +datasets with 16 pfts can be used for all other CLM simulations. + +20.4.2 Interactive fertilization +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +CLM adds nitrogen directly to the soil mineral nitrogen pool to meet +crop nitrogen demands. CLM’s separate crop land unit ensures that +natural vegetation will not access the fertilizer applied to crops. +Fertilizer amounts are obtained from the Agro-IBIS model (Kucharik and +Brye 2003), but can be modified in CLM’s pft-physiology input dataset. +Fertilizer is reported in g N/m\ :math:`{}^{2}` by plant functional +type. Total nitrogen fertilizer amounts are 150 g N/m\ :math:`{}^{2}` +for maize, 80 g N/m\ :math:`{}^{2}` for temperate cereals, and 25 g +N/m\ :math:`{}^{2}` for soybean, representative of central U.S. annual +fertilizer application amounts. Since CLM’s denitrification rate is high +and results in a 50% loss of the unused available nitrogen each day, +fertilizer is applied slowly to minimize the loss and maximize plant +uptake. Fertilizer application begins during the emergence phase of crop +development and continues for 20 days, which helps reduce large losses +of nitrogen from leaching and denitrification during the early stage of +crop development. The 20-day period is chosen as an optimization to +limit fertilizer application to the emergence stage. A fertilizer +counter in seconds, *f*, is set as soon as the onset growth for crops +initiates: + +*f* = *n* \* 86400 [20.9)] + +where *n* is set to 20 fertilizer application days. When the crop enters +phase 2 (leaf emergence to the beginning of grain fill) of its growth +cycle, fertilizer application begins by initializing fertilizer amount +to the total fertilizer divided by the initialized *f*. Fertilizer is +applied and *f* is decremented each time step until a zero balance on +the counter is reached. + +The crop fertilization scheme was developed in versions of the CLM prior +to CLM4.5. In CLM4.5, crops with fertilization may be simulated over +productive. + +20.4.3 Biological nitrogen fixation for soybeans +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Nitrogen fixation by soybeans is similar to that in the SWAT model +(Neitsch et al. 2005) and depends on soil moisture, nitrogen +availability, and growth stage. Soybean fixation is calculated only for +unmet nitrogen demand; if soil nitrogen meets soybean demand, there will +be no fixation during the time step. Soybean fixation is determined by + +.. math:: + + \label{20.10)} + N_{fix} \; =\; N_{plant\_ ndemand} \; *\; min\; \left(\; 1,\; fxw,\; fxn\; \right)*\; fxg + +where *N\ :math:`{}_{plant\_demand}`* is the balance of nitrogen needed +to reach potential growth that cannot be supplied from the soil mineral +nitrogen pool, *fxw* is the soil water factor, *fxn* is the soil +nitrogen factor, and *fxg* is the growth stage factor calculated by + +.. math:: + + \label{20.11)} + fxw=\frac{wf}{0.85} + +.. math:: + + \label{20.12)} + fxn=\; \left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }sminn\le 10} \\ {1.5-0.005\left(sminn\times 10\right)\qquad {\rm for\; 10\; <\; }sminn{\rm \; }\ge 30} \\ {1\qquad \qquad \qquad \qquad {\rm for\; }sminn>30} \end{array}\right\} + +.. math:: + + \label{20.13)} + fxg=\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad \qquad {\rm for\; }GDD_{T_{2m} } \le 0.15} \\ {6.67\times GDD_{T_{2m} } -1\qquad \qquad \qquad {\rm for\; }0.150.75} \end{array}\right\} + +where *wf* is the soil water content as a fraction of the water holding +capacity for the top 0.05 m, *sminn* is the total nitrogen in the soil +pool (g/m:math:`{}^{2}`), and :math:`{GDD}_{T_{2m}}` is the fraction of +growing degree-days accumulated during the growing season. +:math:`N\mathrm{fix}` is added directly to the soil mineral nitrogen +pool for use that time step. Nitrogen fixation occurs after the plant +has accumulated 15%\ *GDD\ :math:`{}_{mat}`* and before +75%\ *GDD\ :math:`{}_{mat}`*, so before grain fill begins. + +20.4.4 Modified C:N ratios for crops +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Typically, C:N ratios in plant tissue vary throughout the growing season +and tend to be lower during early growth stages and higher in later +growth stages. In order to account for this change, two sets of C:N +ratios are established in CLM for the leaf, stem, and fine root of +crops. This modified C:N ratio approach accounts for the nitrogen +retranslocation that occurs during phase 3 of crop growth. Leaf and stem +(and root for temperate cereals) C:N ratios for phases 1 and 2 are lower +than measurements (Table 20.3) to allow excess nitrogen storage in plant +tissue. During grain fill (phase 3) of the crop growth cycle, the +nitrogen in the plant tissues is moved to a storage pool to fulfill +nitrogen demands of organ (reproductive pool) development, such that the +resulting C:N ratio of the plant tissue is reflective of measurements at +harvest. All C:N ratios were determined by calibration process, through +comparisons of model output versus observations of plant carbon +throughout the growth season. + +20.4.5 Nitrogen retranslocation for crops +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Nitrogen retranslocation in crops occurs when nitrogen that was used for +tissue growth of leaves, stems, and fine roots during the early growth +season is remobilized and used for grain development (Pollmer et al. +1979; Crawford et al. 1982; Simpson et al. 1983; Ta and Weiland 1992; +Barbottin et al. 2005; Gallais et al. 2006, 2007). Nitrogen allocation +for crops follows that of natural vegetation, is supplied in CLM by the +soil mineral nitrogen pool, and depends on C:N ratios for leaves, stems, +roots, and organs. Nitrogen demand during organ development is fulfilled +through retranslocation from leaves, stems, and roots. Nitrogen +retranslocation is initiated at the beginning of the grain fill stage +for corn and temperate cereals, but not until after LAI decline in +soybean. Nitrogen stored in the leaf and stem is moved into a storage +retranslocation pool. For temperate cereals, nitrogen in roots is also +released into the retranslocation storage pool. The quantity of nitrogen +mobilized depends on the C:N ratio of the plant tissue, and is +calculated as + +.. math:: + + \label{20.14)} + leaf\_ to\_ retransn=\frac{c_{leaf} }{CN_{leaf} } -\frac{c_{leaf} }{CN_{leaf}^{f} } + +.. math:: + + \label{20.15)} + stemn\_ to\_ retransn=\frac{c_{stem} }{CN_{stem} } -\frac{c_{stem} }{CN_{stem}^{f} } + +.. math:: + + \label{20.16)} + frootn\_ to\_ retransn=\frac{c_{froot} }{CN_{froot} } -\frac{c_{froot} }{CN_{froot}^{f} } + +where *C\ :math:`{}_{leaf}`*, *C\ :math:`{}_{stem}`*, and +*C\ :math:`{}_{froot}`* is the carbon in the plant leaf, stem, and fine +root, respectively, *CN\ :math:`{}_{leaf}`*, *CN\ :math:`{}_{stem}`*, +and *CN\ :math:`{}_{froot}`* is the pre-grain fill C:N ratio of the +leaf, stem, and fine root respectively, and :math:`CN^f_{leaf}`, +:math:`CN^f_{stem}`, and :math:`CN^f_{froot}` is the post-grain fill C:N +ratio of the leaf, stem, and fine root respectively (Table 20.3). Since +C:N measurements are taken from mature crops, pre-grain development C:N +ratios for leaves, stems, and roots are optimized to allow maximum +nitrogen accumulation for later use during organ development. Post-grain +fill C:N ratios are assigned the same as crop residue. Once excess +nitrogen is moved into the retranslocated pool, during the remainder of +the growing season the retranslocated pool is used first to meet plant +nitrogen demand by assigning the available nitrogen from the +retranslocated pool equal to the plant nitrogen demand. Once the +retranslocation pool is depleted, soil mineral nitrogen pool is used to +fulfill plant nitrogen demands. + +Table 20.3. Pre- and post-grain fill C:N ratios for crop leaf, stem, +fine root, and reproductive pools. + ++----------------------------+--------+---------------------+-----------+ +| Pre-grain fill stage | Corn | Temperate Cereals | Soybean | ++============================+========+=====================+===========+ +| *CN\ :math:`{}_{leaf}`* | 10 | 15 | 25 | ++----------------------------+--------+---------------------+-----------+ +| *CN\ :math:`{}_{stem}`* | 50 | 50 | 50 | ++----------------------------+--------+---------------------+-----------+ +| *CN\ :math:`{}_{froot}`* | 42 | 30 | 42 | ++----------------------------+--------+---------------------+-----------+ +| Post-grain fill stage | | | | ++----------------------------+--------+---------------------+-----------+ +| :math:`CN_{leaf}^{f}` | 65 | 65 | 65 | ++----------------------------+--------+---------------------+-----------+ +| :math:`CN_{stem}^{f}` | 120 | 100 | 130 | ++----------------------------+--------+---------------------+-----------+ +| :math:`CN_{froot}^{f}` | 42 | 40 | 42 | ++----------------------------+--------+---------------------+-----------+ +| :math:`CN_{repr}^{f}` | 50 | 40 | 60 | ++----------------------------+--------+---------------------+-----------+ + +**** + +20.4.6 Separate reproductive pool +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +One notable difference between natural vegetation and crops is the +presence of a reproductive carbon pool (and nitrogen pool). Accounting +for the reproductive pool helps determine whether crops are performing +reasonably, through yield calculations, seasonal GPP and NEE changes, +etc. The reproductive pool is maintained similarly to the leaf, stem, +and fine root pools, but allocation of carbon and nitrogen does not +begin until the grain fill stage of crop development. Eq. shows the +carbon and nitrogen allocation coefficients to the reproductive pool. In +the CLM4.0, allocation of carbon to the reproductive pool was calculated +but merged with the stem pool. In the model, as allocation declines +during the grain fill stage of growth, increasing amounts of carbon and +nitrogen are available for grain development. diff --git a/doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst b/doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst new file mode 100644 index 0000000000..956e1aca1a --- /dev/null +++ b/doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst @@ -0,0 +1,359 @@ +.. math:: 1 + +Transient Landcover Change +============================== + +CLM includes a treatment of mass and energy fluxes associated with +prescribed temporal change in land cover. Using an annual time series of +the spatial distribution of PFTs and wood harvest, CLM diagnoses the +change in area for PFTs at each model time step and then performs mass +and energy balance accounting necessary to represent the expansion and +contraction of PFT area. This implementation currently only pertains to +the case where all PFTs for a particular grid cell coexist on a single +soil/snow column. In this case, the only biogeophysical state variable +affected is canopy water (:math:`W_{can}` ). The biogeochemical impacts +of land use and land cover change are simulated through changes in CLM +carbon pools and fluxes as shown in Figure 21.1 and described further in +Chapter 13. Other implementations are possible, such as changing the +area of soil/snow columns or land unit area, however these require +additional consideration of conservation of mass and energy among the +soil/snow columns and land units which will be implemented in future +versions of CLM. + +Annual Transient Land Cover Data and Time Interpolation +------------------------------------------------------------ + +The changes in area over time associated with individual PFTs are +prescribed through a forcing dataset, referred to here as the *dynpft* +dataset. The *dynpft* dataset consists of an annual time series of +global grids, where each annual time slice describes the fractional area +occupied by all PFTs and the annual wood harvest within each grid cell. +Changes in area and wood harvest for each PFT within a grid cell at each +model time step are inferred from a time-interpolation of the area +information for the PFT from the two bracketing annual time slices in +the *dynpft* dataset. + +As a special case, when the time dimension of the *dynpft* dataset +starts at a later year than the current model time step, the first time +slice from the *dynpft* dataset is used to represent the current time +step PFT fractional area distributions. Similarly, when the time +dimension of the *dynpft* dataset stops at an earlier year than the +current model time step, the last time slice of the *dynpft* dataset is +used. Thus, the simulation will have invariant representations of PFT +distributions through time for the periods prior to and following the +time duration of the *dynpft* dataset, with transient PFT distributions +during the period covered by the *dynpft* dataset. + +The following equations capture this logic, where :math:`year_{cur}` is +the calendar year for the current timestep, +:math:`dynpft\_ year\eqref{GrindEQ__1_}` and +:math:`dynpft\_ year(nyears)`\ are the first and last calendar years in +the *dynpft* dataset, respectively, :math:`nyears` is the number of +years in the *dynpft* dataset, :math:`nt_{1}` and :math:`nt_{2}` +:math:`{}_{ }`\ are the two bracketing years used in the interpolation +algorithm, and :math:`n` is the index value for the +:math:`dynpft\_ year` array corresponding to +:math:`dynpft\_ year(n)=year_{cur}` : + +.. math:: + + \label{21.1)} + nt_{1} =\left\{\begin{array}{l} {1\qquad {\rm for}\qquad year_{cur} 0` and decreases for +:math:`\Delta w_{p} <0`. + +Mass and Energy Conservation +--------------------------------- + +Mass conservation is maintained across a PFT weight transition by +summing up all the water state variables to get the total vegetated land +unit water content before (:math:`W_{tot,1}` ) and after +(:math:`W_{tot,2}` ) new PFT weights are calculated. For example, +:math:`W_{tot,1}` is + +.. math:: + + \label{21.6)} + W_{tot,1} =W_{a} +W_{sno} +\sum _{i=1}^{N_{levgrnd} }\left(w_{liq,i} +w_{ice,i} \right) +\sum _{j=1}^{npft}\left(W_{can,j} wt_{j,1} \right) + +where :math:`W_{a}` is the aquifer water, :math:`W_{sno}` is the snow +water, :math:`w_{liq,i}` and :math:`w_{ice,i}` \ are the liquid and ice +soil water contents, :math:`W_{can,j}` \ is the canopy water content for +PFT :math:`j`, and :math:`wt_{j,1}` is the PFT weight for PFT +:math:`j`. For the situation where only PFT weights are changing and all +other land unit fractions are constant, any difference between +:math:`W_{tot,1}` and :math:`W_{tot,2}` \ can only be due to +differences in the total canopy water before and after the PFT weight +change. To ensure water conservation, the typically very small +difference between :math:`W_{tot,2}` \ and :math:`W_{tot,1}` is +subtracted from the grid cell runoff + +.. math:: + + \label{21.7)} + R_{liq} =R_{liq} +W_{tot,2} -W_{tot,1} . + +Total energy is unperturbed in this case and therefore an energy +conservation treatment is not required. As noted above, other +implementations are possible and will be desirable in the future, such +as changing the area of soil/snow columns or land unit area, for example +in a situation in which crops are implemented on a separate soil column. +These would require additional consideration of conservation of mass and +energy among the soil/snow columns and land units. + +Annual Transient Land Cover Dataset Development +---------------------------------------------------- + +This section describes the development of the d\ *ynpft* dataset. +Development of this dataset requires adapting for use with the CLM a +harmonized dataset of land cover change for the historical period and +for different representations of the scenario period. + +21.3.1 UNH Transient Land Use and Land Cover Change Dataset +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To coordinate the processing and consistency of land use and land cover +change data between the historical period (1850-2005) and the four IPCC +representative concentration pathways (RCPs) derived from integrated +assessment models (IAM), the University of New Hampshire +(stocktickerUNH) research group (Louise Chini, George Hurtt, Steve +Frolking; luh.unh.edu) produced a harmonized transient dataset for use +in climate change simulations. The historical component of the transient +land use and land cover change dataset is Version 1 of the Land-Use +History A product (LUHa.v1) covering the period 1850-2005. The RCP +transient land use and land cover change components (2005-2100) are +referred to as the Future Land-Use Harmonization A products. Version 1 +(LUHa.v1\_future.v1) is used for the AIM, MESSAGE, and MiniCAM IAMs; +Version 1.1 (LUHa.v1\_future.v1.1) is used for the IMAGE IAM. The land +cover information is provided at 0.5 degree grid resolution and includes +fractional grid cell coverage by crops, pasture, and primary and +secondary natural vegetation. + +The crop fraction of the grid cell represents the area of the grid cell +used to grow any type of crop. Similarly, pasture represents the +fraction of a grid cell used for grazing livestock. The remaining area +in a half degree grid cell is partitioned into primary and secondary +vegetation. Primary vegetation represents the fractional area of a grid +cell with vegetation undisturbed by human activities. Secondary +vegetation represents vegetated areas that have recovered from some +human disturbance; this could include re-vegetation of pasture and crop +areas as well as primary vegetation areas that have been logged. + +The stocktickerUNH dataset provides a transition matrix that describes +the annual fraction of land that is transformed from one category to +another (e.g. primary land to crop, pasture to crop, etc.; Hurtt et al. +2006). Included in these transitions is the conversion of secondary land +to secondary land, representing the logging on land recovering from an +earlier disturbance. These transitions provide information on all +changes in land cover through the sum of all transitions in a given +year. Harmonized prescriptions of CMIP5 wood harvest statistics also are +provided by (Hurtt et al. 2011) for the historical and RCP time series. +The wood harvest is prescribed spatially on the same 0.5 degree grid as +the land use class transitions for each year. + +To ensure consistency with the various land use classes wood harvest is +prescribed as both the area of land harvested and the amount of carbon +extracted in the grid cell for a particular year. To account for the +differences in standing amount of wood carbon as well as the differences +in harvest intensity associated with the different land units, the +harvest area and carbon amounts are prescribed for the five classes of: +PlaceNamePrimary PlaceTypeForest, PlaceNamePrimary PlaceTypeNon-Forest, +PlaceNameSecondary PlaceNameMature PlaceTypeForest, PlaceNameSecondary +PlaceNameYoung PlaceTypeForest, and PlaceNameplaceSecondary +PlaceTypeNon-Forest. + +21.3.2 Representing Land Use and Land Cover Change in CLM +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +CLM represents the land surface as a hierarchy of sub-grid types: +glacier; lake; wetland; urban; and vegetated land. The vegetated land is +further divided into a mosaic of PFTs. To represent the UNH transient +land use and land cover change dataset in CLM, the annual fractional +composition of crop, pasture, primary vegetation, and secondary +vegetation land units specified in the UNH dataset needs to be +faithfully represented with a corresponding PFT mosaic in CLM using the +methods described in Lawrence et al (2012). This method translated each +of the UNH land units into fractional PFT values based on current day +and potential vegetation CLM land surface parameters for that grid cell +and for that year, as shown in Figure 21.2. + +The methodology for creating the transient PFT dataset is based on four +steps which are applied across the time series. First, crop PFT +composition is directly specified from the crop land unit fractional +area. Second, pasture PFTs are assigned based on grass PFTs found in the +potential vegetation and current day CLM land surface parameters scaled +by the area of pasture. Third, potential vegetation PFTs are assigned to +the grid cell scaled by the fractional area of the primary land unit. +Last, current day non-crop and non-pasture PFTs are assigned to the grid +cell scaled by the fractional area of the secondary land unit. The +annual tree harvest values also are calculated from the harvest +information of the UNH dataset used in conjunction with transient tree +PFT values. Separate datasets representing the extent of water, wetland, +ice and urban land cover are used to compile the final land cover +present in each CLM grid cell. These additional non-vegetated land cover +fractions are held constant throughout the time series. All datasets are +resolved at the half degree grid resolution. + +21.3.3 Present Day PFT Dataset +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The present day dataset is based on the methodology of Lawrence and +Chase (2007) and uses a variety of satellite products to develop present +day PFT distributions with matching leaf area index values. The dataset +initially derives fractions of bare ground and tree cover from the +Moderate Resolution Imaging Spectroradiometer (MODIS) vegetation +continuous fields product (Hansen et al. 2003). To further distinguish +tree types, the tree fraction is divided into broadleaf/needleleaf and +evergreen/deciduous types based on the Advanced Very High Resolution +Radiometer (AVHRR) continuous fields tree cover (DeFries et al. 2000). +The remaining grid cell area is assumed to be herbaceous grasses and +shrubs, including crops. The area of crop is initially determined from +Ramankutty et al. (2008) circa 2000 global crop land areas, and the +remaining grass and shrub fractions are derived from the MODIS land +cover (Friedl et al. 2002). Further subdivisions of grass, shrub and +tree PFTs into tropical, temperate and boreal types were based on the +physiology and climate rules from Nemani and Running (1996), and for +C3/C4 photosynthetic pathways based on MODIS derived leaf area index +values and the mapping methods of Still et al. (2003). In contrast to +Lawrence and Chase (2007), the understory grasses of forested areas have +been replaced with trees for the dataset. Some advantages of this +dataset are that it reproduces the physical properties as observed by +the MODIS land surface data (e.g. grid cell albedo and leaf area index +values) while maintaining the multiple PFT representation. + +21.3.4 Potential PFT Distribution +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Essential to any reconstruction of past vegetation distributions is the +need to know the potential vegetation that would be there prior to human +activities. Many researchers have worked to estimate potential +vegetation types at regional and global scales from remnant vegetation +and other field data or from bioclimatic models. The CLM potential PFT +distribution is derived from Ramankutty et al. (2008) at 5 arc-minute +resolution. However, this product is based on a biome type +classification system that is not directly compatible with the CLM PFT +distributions. + +The CLM potential vegetation is described by Lawrence and Chase (2010). +This reconstruction describes potential PFT distributions extrapolated +from the current day PFT composition of remnant natural biomes as mapped +by Ramankutty et al. (2008). The current day remnant natural PFT +parameters were taken from the Lawrence and Chase (2007) dataset with +the same forest understory changes as described above to ensure +consistency between the two datasets. The current day remnant natural +PFT biome compositions were spatially extrapolated to the potential +vegetation biome distributions provided by Ramankutty et al. (2008) +using inverse distance weighted methods. The resulting product is a CLM +PFT distribution that may have existed prior to human disturbance under +current day climate conditions. + +21.3.5 Transient Land Cover Change Dataset +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For each year from 1850 to 2005 and to 2100 for each of the four RCPs, +PFT distributions and wood harvest are adjusted based on the +stocktickerUNH dataset. Initially the grid cell is checked to adjust the +crop area based on the stocktickerUNH crop area. If the crop area +exceeds the available land area (i.e. the grid cell area minus the area +assigned to glacier, wetlands, lake and urban areas) then all the +available area is allocated to crops and no other PFTs are added. After +the crop area is assigned, any remaining area is considered available +for pasture. + +As the pasture data from the stocktickerUNH dataset represents grazing, +pasture areas are assigned in the present day based on the availability +of grasses (C3, C4 and boreal C3 PFTs) and shrubs relative to the bare +soil fraction. If the grazing area exceeds the total vegetated area from +both the potential and current day PFT data, then the grazed area is +limited to the larger of the potential or current day vegetated area. +This is done to prevent representing sparsely vegetated grazing areas as +100% vegetated pastures. Once the grazing area is less than or equal to +the total vegetated area, then grazing areas are assigned to the C3 and +C4 grass areas based on their potential vegetation and current day +fractions. In areas where the grazing area cannot be met through the +current day or potential vegetation grass fraction alone, the current +day tree PFTs are converted to grass PFTs, with the remaining shrub PFTs +included as being grazed. + +Once crop and pasture areas are assigned to a grid cell, the remaining +area is assigned to primary and secondary natural vegetation. Primary +vegetation is assumed to be undisturbed and reflects the potential +vegetation PFT distributions. In the secondary region, the PFT +distributions are based on the current day non-crop and non-pasture PFTs +in the grid cell. This process ensures that the PFT distributions are +kept consistent with the original current day and potential vegetation +CLM parameters, while remaining faithful to the stocktickerUNH assigned +areas. + +21.3.6 Forest Harvest Dataset Changes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Discussions following the initial analysis of CCSM4 land cover change +experiments found there were very high wood harvest areas compared to +wood harvest carbon in the RCP 6.0 and RCP 8.5 time series. The high +wood harvest areas were traced to using gridded spatially explicit wood +harvest targets from the MESSAGE and AIM groups for these two time +series, rather than using regional targets with spatial downscaling in +GLM as done with the other three time periods. As a result of these +discussions new amended wood harvest targets were generated with +regional targets through GLM for the RCP 6.0 and RCP 8.5 time series as +described in Lawrence et al. (2012). + +Figure 21.1. Schematic of land cover change impacts on CLM carbon pools +and fluxes. + +|image| + +Figure 21.2. Schematic of translation of annual UNH land units to CLM4 +plant functional types. + +|image| + +.. |image| image:: image1 +.. |image| image:: image2 diff --git a/doc/source/tech_note/CHAPTER_22/CLM45_Tech_Note_Chpt_22_DGVM.rst b/doc/source/tech_note/CHAPTER_22/CLM45_Tech_Note_Chpt_22_DGVM.rst new file mode 100644 index 0000000000..b90f8b4a16 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_22/CLM45_Tech_Note_Chpt_22_DGVM.rst @@ -0,0 +1,155 @@ +.. math:: 1 + +Dynamic Global Vegetation Model +=================================== + +In CLM the user may choose to run the CN model as a dgvm (dynamic global +vegetation model) (CNDV). Note that CN must be active to run the dgvm in +CLM. In this section, a general description of the dgvm processes and +how they integrate with CN are provided. Further details are available +in the CLM3DGVM Technical Note (Levis et al. 2004). The focus here is on +the differences relative to the corresponding processes in the CLM3DGVM. + +As with the CLM3DGVM, CNDV can simulate biogeographical changes only for +natural vegetation. Although the vegetated land unit may be separated +into naturally vegetated and human managed land units to permit a +coexistence of natural and human managed vegetation, CNDV only works if +the human managed land units are fixed. CLM’s transient land cover and +land use change capability (see Chapter 21), which permits transitions +between natural and human managed plant functional types (PFTs), is +incompatible with the CNDV option at this time. + +CNDV was implemented by introducing CLM3DGVM code to the hourly CN +framework only to the extent necessary to simulate annual biogeography +updates. This includes the annual processes of light competition, +establishment, and survival [see sections 2.7 and 2.10, Levis et al. +(2004)] as they pertain to the calculations of PFT cover (FPC) and +population (P) but not processes related to carbon pools, leaf area +index (LAI), or canopy height. In CNDV we added complexity to the gap +mortality calculation with annual heat stress and growth efficiency +considerations from the corresponding CLM3DGVM algorithm [section 2.8, +Levis et al. (2004)]. All other ecosystem processes (allocation, +phenology, fire, etc.) are handled by CN modules. Unlike in the +CLM3DGVM, in CNDV, annual biogeography updates are interpolated to +hourly intervals. + +Establishment and survival +------------------------------- + +The PFT distribution in the vegetated land unit is typically prescribed +in CLM (see section 2.1.2) except for the case when CNDV is active. In +CNDV the model begins with no PFT information per grid cell and +evaluates whether or not a PFT may establish or survive according to the +PFT’s bioclimatic limits (Table 22.1). Shrub PFTs are treated as trees +at establishment. + +CNDV omits the CLM3DGVM’s annual introduction of saplings when a PFT can +establish. The CLM3DGVM merged sapling carbon pools with a PFT’s +existing carbon. The resultant leaf carbon (annual maximum value) would +update the FPC, i.e. the foliar projective cover or fraction of the +vegetated land unit occupied by the PFT [section 2.10, Levis et al. +(2004)]. Instead, CNDV updates the FPC using the PFT’s annual maximum +leaf carbon without an addition from saplings. For newly established +PFTs, CNDV assigns seed leaf carbon equal to 1 g C m\ :math:`{}^{-2}` of +land unit area and seed FPC equal to 0.05 for grasses and 0.000844 for +trees (values determined from CLM3DGVM simulations). The addition of +establishing individuals to *P*, a PFT’s population, is handled as in +the CLM3DGVM. + +*FPC* changes annually as in the CLM3DGVM but now is interpolated to an +hourly increment using the algorithms designed to conserve energy and +mass in the CLM’s dynamic land use option. + +Light competition +---------------------- + +In CNDV’s order of annual processes, light competition is invoked before +establishment and survival. However, light competition does not affect a +simulation starting from bare ground until the vegetation fills the land +unit (a few years at least). + +Light competition starts with a calculation updating *FPC*. For +reference, this update was included at the end of allocation in the +CLM3DGVM [section 2.6, Levis et al. (2004)]. + +Due to their height advantage, trees will cover up to 95% of the land +unit when their productivity permits, as in the CLM3DGVM, regardless of +grass and shrub productivity. Grasses get second priority, as in the +CLM3DGVM, even with shrubs included now. Shrubs, then, have access to +the remaining space and follow the tree algorithm for self thinning +[section 2.7, Levis et al. (2004)]. As a result, trees typically +dominate in the most productive regions, grasses in less productive +regions, and shrubs in the least productive non-desert regions (Zeng et +al. 2008). + +CN processes modified for the CNDV coupling +------------------------------------------------ + +Gap mortality and mortality from fire: Constant annual mortality rate of +0.02 is changed for trees and shrubs to an annual rate calculated as in +the CLM3DGVM accounting for background and stress mortality [section +2.8, Levis et al. (2004)]. The CN module converts the annual rate to +hourly. + +The CLM3DGVM used the concepts of average plant individual and PFT +population, *P*. CNDV retains these concepts in the light competition, +establishment, and survival calculations. In CNDV we account for the +individuals removed hourly from *P* in response to CN’s fire and gap +mortality, while the carbon pools per individual and FPC remain +constant. Ultimately, *P* updates should only affect the annual +processes of light competition, establishment, and survival, so the *P* +update may be moved to the end of the year in a future version of CNDV. + +Vegetation Structure Update: CN stocking is a constant, while in CNDV +stocking changes as P and FPC change. This affects the top-of-canopy +height calculation. CN specific leaf area and stem diameter calculations +are kept, while the height calculation is replaced with the CLM3DGVM’s +[section 2.6, Levis et al. (2004)]. CN stem area index (SAI) is kept. + +Allocation: CN calculates a PFT’s fraction of currently allocated carbon +relative to the total allocation instead of obtaining a constant value +from CLM’s PFT-physiology file. In CNDV, we returned to the constant +values in the old PFT-physiology file to get a reasonable simulation of +PFTs. For CNDV to use the calculated fraction, we will need to change +the algorithm for PFTs in early stages of growth. + +Table 22.1. Plant functional type (PFT) biogeography rules with respect +to climate. + +Adapted from Table 1 of Levis et al. (2004) to include shrub PFTs. +:math:`T_{c,\min }` , coldest minimum monthly air temperature for +survival of previously established PFTs; :math:`T_{c,\max }` , warmest +minimum monthly air temperature for establishment of new PFTs; +:math:`GDD_{\min }` , minimum annual growing degree-days above +5\ :math:`{}^\circ`\ C for establishment of new PFTs. Levis et al. +(2004) include an explanation of these variables and their use. + ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| | Survival | | | | ++=============================================+==============================================+==============================================+=========================+========+ +| | *T*\ :math:`{}_{c,min}` (:math:`\circ`\ C) | *T*\ :math:`{}_{c,max}` (:math:`\circ`\ C) | GDD\ :math:`{}_{min}` | | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Tropical broadleaf evergreen tree (BET) | | 15.5 | No limit | 0 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Tropical broadleaf deciduous tree (BDT) | | 15.5 | No limit | 0 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Temperate needleleaf evergreen tree (NET) | | -2.0 | 22.0 | 900 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Temperate broadleaf evergreen tree (BET) | | 3.0 | 18.8 | 1200 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Temperate broadleaf deciduous tree (BDT) | | -17.0 | 15.5 | 1200 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Boreal needleleaf evergreen tree (NET) | | -32.5 | -2.0 | 600 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Boreal deciduous tree | | No limit | -2.0 | 350 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Temperate broadleaf deciduous shrub (BDS) | | -17.0 | No limit | 1200 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| Boreal broadleaf deciduous shrub (BDS) | | No limit | -2.0 | 350 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| C\ :math:`{}_{4}` | | 15.5 | No limit | 0 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| C\ :math:`{}_{3}` | | -17.0 | 15.5 | 0 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ +| C\ :math:`{}_{3}` arctic | | No limit | -17.0 | 0 | ++---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ diff --git a/doc/source/tech_note/CHAPTER_23/CLM45_Tech_Note_Chpt_23_BVOCs.rst b/doc/source/tech_note/CHAPTER_23/CLM45_Tech_Note_Chpt_23_BVOCs.rst new file mode 100644 index 0000000000..d19c09ca0b --- /dev/null +++ b/doc/source/tech_note/CHAPTER_23/CLM45_Tech_Note_Chpt_23_BVOCs.rst @@ -0,0 +1,66 @@ +.. math:: 2 + +.. math:: 1 + +Biogenic Volatile Organic Compounds (BVOCs) +=============================================== + +This chapter briefly describes the biogenic volatile organic compound +(BVOC) emissions model implemented in CLM. The CLM3 version (Levis et +al. 2003; Oleson et al. 2004) was based on Guenther et al. (1995). Heald +et al. (2008) updated this scheme in CLM4 based on Guenther et al. +(2006). The current version in CLM4.5 is based on MEGAN2.1 discussed in +detail in Guenther et al. (2012). This update of MEGAN incorporates four +main features: expansion to 147 chemical compounds the treatment of the +light-dependent fraction (LDF) for each compound inclusion of the +inhibition of isoprene emission by atmospheric CO\ :math:`{}_{2}` and +emission factors mapped to the specific PFTs of the CLM. + +MEGAN2.1 now describes the emissions of speciated monoterpenes, +sesquiterpenes, oxygenated VOC as well as isoprene. A flexible scheme +has been implemented in the CLM to specify a subset of emissions. This +allows for additional flexibility in grouping chemical compounds to form +the lumped species frequently used in atmospheric chemistry. The mapping +or grouping are therefore defined through a namelist parameter in +drv\_flds\_in, e.g. megan\_specifier = ’ISOP = isoprene’, ’BIGALK = +pentane + hexane + heptane + tricyclene’. + +Terrestrial BVOC emissions from plants to the atmosphere are expressed +as a flux, ** :math:`F_{i}` (:math:`\mu` \ g C m\ :math:`{}^{-2}` +ground area h\ :math:`{}^{-1}`), for emission of chemical compound +:math:`i` + +.. math:: + + \label{ZEqnNum964222} + F_{i} =\gamma _{i} \rho \sum _{j}\varepsilon _{i,j} \left(wt\right)_{j} + +where :math:`\gamma _{i}` is the emission activity factor accounting +for responses to meteorological and phenological conditions, +:math:`\rho` is the canopy loss and production factor also known as +escape efficiency (set to 1), and :math:`\varepsilon _{i,\, j}` +(:math:`\mu` \ g C m\ :math:`{}^{-2}` ground area h\ :math:`{}^{-1}`) is +the emission factor at standard conditions of light, temperature, and +leaf area for plant functional type *j* with fractional coverage +:math:`\left(wt\right)_{j}` (Guenther et al. 2012). The emission +activity factor :math:`\gamma _{i}` depends on plant functional type, +temperature, LAI, leaf age, and soil moisture (Guenther et al. 2012). +For isoprene only, the effect of CO\ :math:`{}_{2}` inhibition is now +included as described by Heald et al. (2009). Previously, only isoprene +was treated as a light-dependent emission. In MEGAN2.1, each chemical +compound is assigned a LDF (ranging from 1.0 for isoprene to 0.2 for +some monoterpenes, VOCs and acetone). The activity factor for the light +response of emissions is therefore estimated as: + +.. math:: + + \label{23.2)} + \gamma _{P,\, i} =\left(1-LDF_{i} \right)+\gamma _{P\_ LDF} LDF_{i} + +where the LDF activity factor (:math:`\gamma _{P\_ LDF}` ) is specified +as a function of PAR as in previous versions of MEGAN. + +The values for each emission factor :math:`\varepsilon _{i,\, j}` are +now available for each of the 15 plant functional types in the CLM and +each chemical compound. This information is distributed through an +external file, allowing for more frequent and easier updates. diff --git a/doc/source/tech_note/CHAPTER_24/CLM45_Tech_Note_Chpt_24_Dust.rst b/doc/source/tech_note/CHAPTER_24/CLM45_Tech_Note_Chpt_24_Dust.rst new file mode 100644 index 0000000000..ae371ca838 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_24/CLM45_Tech_Note_Chpt_24_Dust.rst @@ -0,0 +1,212 @@ +.. math:: 1 + +.. math:: 1 + +Dust Model +============== + +Atmospheric dust is mobilized from the land by wind in the CLM. The most +important factors determining soil erodibility and dust emission include +the wind friction speed, the vegetation cover, and the soil moisture. +The CLM dust mobilization scheme (Mahowald et al. ** 2006) accounts for +these factors based on the DEAD (Dust Entrainment and Deposition) model +of Zender et al. (2003). Please refer to the Zender et al. ** (2003) +article for additional information regarding the equations presented in +this section. + +The total vertical mass flux of dust, :math:`F_{j}` (kg +m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), from the ground into transport +bin :math:`j` is given by + +.. math:: + + \label{ZEqnNum146272} + F_{j} =TSf_{m} \alpha Q_{s} \sum _{i=1}^{I}M_{i,j} + +where :math:`T` is a global factor that compensates for the DEAD model’s +sensitivity to horizontal and temporal resolution and equals 5 x +10\ :math:`{}^{-4}` in the CLM instead of 7 x 10\ :math:`{}^{-4}` in +Zender et al. (2003). :math:`S` is the source erodibility factor set to +1 in the CLM and serves as a place holder at this time. + +The grid cell fraction of exposed bare soil suitable for dust +mobilization :math:`f_{m}` is given by + +.. math:: + + \label{24.2)} + f_{m} =\left(1-f_{lake} -f_{wetl} \right)\left(1-f_{sno} \right)\left(1-f_{v} \right)\frac{w_{liq,1} }{w_{liq,1} +w_{ice,1} } + +where ** :math:`f_{lake}` and ** :math:`f_{wetl}` and :math:`f_{sno}` +are the CLM grid cell fractions of lake and wetland (section 2.2.3) and +snow cover (section 7.2.1), all ranging from zero to one. Not mentioned +by Zender et al. (2003), :math:`w_{liq,\, 1}` and +:math:`{}_{w_{ice,\, 1} }` are the CLM top soil layer liquid water and +ice contents (mm) entered as a ratio expressing the decreasing ability +of dust to mobilize from increasingly frozen soil. The grid cell +fraction of vegetation cover,\ :math:`{}_{f_{v} }`, is defined as + +.. math:: + + \label{ZEqnNum242183} + 0\le f_{v} =\frac{L+S}{\left(L+S\right)_{t} } \le 1{\rm \; \; \; \; where\; }\left(L+S\right)_{t} =0.3{\rm \; m}^{2} {\rm m}^{-2} + +where equation applies only for dust mobilization and is not related to +the plant functional type fractions prescribed from the CLM input data +or simulated by the CLM dynamic vegetation model (Chapter 22). :math:`L` +and :math:`S` are the CLM leaf and stem area index values +(m:math:`{}^{2}` m\ :math:`{}^{-2}`) averaged at the land unit level so +as to include all the pfts and the bare ground present in a vegetated +land unit. ** :math:`L` and :math:`S` may be prescribed from the CLM +input data (section 2.1.4) or simulated by the CLM biogeochemistry model +(Chapter 13). + +The sandblasting mass efficiency :math:`\alpha` (m:math:`{}^{-1}`) is +calculated as + +.. math:: + + \label{24.4)} + \alpha =100e^{\left(13.4M_{clay} -6.0\right)\ln 10} {\rm \; \; }\left\{\begin{array}{l} {M_{clay} =\% clay\times 0.01{\rm \; \; \; 0}\le \% clay\le 20} \\ {M_{clay} =20\times 0.01{\rm \; \; \; \; \; \; \; \; 20<\% }clay\le 100} \end{array}\right. + +where :math:`M_{clay}` \ *:math:`{}_{ }`*\ is the mass fraction of clay +particles in the soil and %clay is determined from the surface dataset +(section 2.2.3). :math:`M_{clay} =0` corresponds to sand and +:math:`M_{clay} =0.2` to sandy loam. + +:math:`Q_{s}` is the total horizontally saltating mass flux (kg +m\ :math:`{}^{-1}` s\ :math:`{}^{-1}`) of “large” particles (Table +24.1), also referred to as the vertically integrated streamwise mass +flux + +.. math:: + + \label{ZEqnNum832592} + Q_{s} =\left\{\begin{array}{l} {\frac{c_{s} \rho _{atm} u_{*s}^{3} }{g} \left(1-\frac{u_{*t} }{u_{*s} } \right)\left(1+\frac{u_{*t} }{u_{*s} } \right)^{2} {\rm \; }\qquad {\rm for\; }u_{*t} w_{t} } \end{array}\right. + +where + +.. math:: + + \label{24.8)} + w_{t} =a\left(0.17M_{clay} +0.14M_{clay}^{2} \right){\rm \; \; \; \; \; \; 0}\le M_{clay} =\% clay\times 0.01\le 1 + +and + +.. math:: + + \label{24.9)} + w=\frac{\theta _{1} \rho _{liq} }{\rho _{d,1} } + +where :math:`a=M_{clay}^{-1}` for tuning purposes, +:math:`\theta _{1}` is the volumetric soil moisture in the top soil +layer (m:math:`{}^{3 }`\ m\ :math:`{}^{-3}`) (section 7.4), +:math:`\rho _{liq}` is the density of liquid water (kg +m\ :math:`{}^{-3}`) (Table 2.6), and :math:`\rho _{d,\, 1}` is the bulk +density of soil in the top soil layer (kg m\ :math:`{}^{-3}`) defined as +in section 6.3 rather than as in Zender et al. ** (2003). +:math:`Re_{*t}^{f}` from equation is the threshold friction Reynolds +factor + +.. math:: + + \label{24.10)} + Re_{*t}^{f} =\left\{\begin{array}{l} {\frac{0.1291^{2} }{-1+1.928Re_{*t} } {\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; 0.03}\le Re_{*t} \le 10} \\ {0.12^{2} \left(1-0.0858e^{-0.0617(Re_{*t} -10)} \right)^{2} {\rm \; for\; }Re_{*t} >10} \end{array}\right. + +and :math:`Re_{*t}` is the threshold friction Reynolds number +approximation for optimally sized particles + +.. math:: + + \label{24.11)} + Re_{*t} =0.38+1331\left(100D_{osp} \right)^{1.56} + +In equation , :math:`u_{*s}` ** is defined as the wind friction speed +(m s\ :math:`{}^{-1}`) accounting for the Owen effect (Owen 1964) + +.. math:: + + \label{24.12)} + u_{*s} =\left\{\begin{array}{l} {u_{*} {\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; }U_{10} ` 1.0 would indicate a preference for the +heavier isotope. Currently, in all cases where Eq. is used to calculate +a :math:`{}^{13}`\ C flux, *f\ :math:`{}_{frac}`* is set to 1.0. + +For :math:`{}^{1}`\ :math:`{}^{4}`\ C, no fractionation is used in +either the initial photosynthetic step, nor in subsequent fluxes from +upstream to downstream pools; as discussed below, this is because +observations of :math:`{}^{1}`\ :math:`{}^{4}`\ C are typically +described in units that implicitly correct out the fractionation of +:math:`{}^{1}`\ :math:`{}^{4}`\ C by referencing them to +:math:`{}^{1}`\ :math:`{}^{3}`\ C ratios. + +Isotope Symbols, Units, and Reference Standards +---------------------------------------------------- + +Carbon has two primary stable isotopes, :math:`{}^{12}`\ C and +:math:`{}^{13}`\ C. :math:`{}^{12}`\ C is the most abundant, comprising +about 99% of all carbon. The isotope ratio of a compound, +*R\ :math:`{}_{A}`*, is the mass ratio of the rare isotope to the +abundant isotope + +.. math:: + + \label{25.2)} + R_{A} =\frac{{}^{13} C_{A} }{{}^{12} C_{A} } . + +Carbon isotope ratios are often expressed using delta notation, +:math:`\deltaup`. The :math:`\deltaup`\ :math:`{}^{13}`\ C value of a +compound A, :math:`\deltaup`\ :math:`{}^{13}`\ C\ :math:`{}_{A}`, is the +difference between the isotope ratio of the compound, +*R\ :math:`{}_{A}`*, and that of the Pee Dee Belemnite standard, +*R\ :math:`{}_{PDB}`*, in parts per thousand + +.. math:: + + \label{25.3)} + \delta ^{13} C_{A} =\left(\frac{R_{A} }{R_{PDB} } -1\right)\times 1000 + +where *R\ :math:`{}_{PDB}`* = 0.0112372, and units of :math:`\deltaup` +are per mil (‰). + +Isotopic fractionation can be expressed in several ways. One expression +of the fractionation factor is with alpha (:math:`\alphaup`) notation. +For example, the equilibrium fractionation between two reservoirs A and +B can be written as: + +.. math:: + + \label{25.4)} + \alpha _{A-B} =\frac{R_{A} }{R_{B} } =\frac{\delta _{A} +1000}{\delta _{B} +1000} . + +This can also be expressed using epsilon notation +(:math:`\varepsilonup`), where + +.. math:: + + \label{25.5)} + \alpha _{A-B} =\frac{\varepsilon _{A-B} }{1000} +1 + +In other words, if :math:`{\varepsilon }_{A-B}=4.4\mathrm{\textrm{‰}}`, +then :math:`\alphaup`\ :math:`{}_{A-B}`\ =1.0044. + +In addition to the stable isotopes :math:`{}^{1}`\ :math:`{}^{2}`\ C and +:math:`{}^{1}`\ :math:`{}^{3}`\ C, the unstable isotope +:math:`{}^{1}`\ :math:`{}^{4}`\ C is included in CLM. +:math:`{}^{1}`\ :math:`{}^{4}`\ C can also be described using the delta +notation: + +.. math:: + + \label{25.6)} + \delta ^{14} C=\left(\frac{A_{s} }{A_{abs} } -1\right)\times 1000 + +However, observations of :math:`{}^{1}`\ :math:`{}^{4}`\ C are typically +fractionation-corrected using the following notation: + +.. math:: + + \label{25.7)} + \Delta {}^{14} C=1000\times \left(\left(1+\frac{\delta {}^{14} C}{1000} \right)\frac{0.975^{2} }{\left(1+\frac{\delta {}^{13} C}{1000} \right)^{2} } -1\right) + +where :math:`\deltaup`\ :math:`{}^{14}`\ C is the measured isotopic +fraction and :math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C corrects for +mass-dependent isotopic fractionation processes (assumed to be 0.975 for +fractionation of :math:`{}^{13}`\ C by photosynthesis). CLM assumes a +background preindustrial atmospheric :math:`{}^{14}`\ C /C ratio of +10\ :math:`{}^{-12}`, which is used for A\ :math:`{}_{abs}`. For the +reference standard A\ :math:`{}_{abs}`, which is a plant tissue and has +a :math:`\deltaup`\ :math:`{}^{13}`\ C value is :math:`\mathrm{-}`\ 25 ‰ +due to photosynthetic discrimination, +:math:`\deltaup`\ :math:`{}^{14}`\ C = +:math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C. For CLM, in order to use +the :math:`{}^{14}`\ C model independently of the :math:`{}^{13}`\ C +model, for the :math:`{}^{14}`\ C calculations, this fractionation is +set to zero, such that the 0.975 term becomes 1, the +:math:`\deltaup`\ :math:`{}^{13}`\ C term (for the calculation of +:math:`\deltaup`\ :math:`{}^{14}`\ C only) becomes 0, and thus +:math:`\deltaup`\ :math:`{}^{14}`\ C = +:math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C. + +Carbon Isotope Discrimination During Photosynthesis +-------------------------------------------------------- + +Photosynthesis is modeled in CLM as a two-step process: diffusion of +CO\ :math:`{}_{2}` into the stomatal cavity, followed by enzymatic +fixation (Chapter 8). Each step is associated with a kinetic isotope +effect. The kinetic isotope effect during diffusion of +CO\ :math:`{}_{2}` through the stomatal opening is 4.4‰. The kinetic +isotope effect during fixation of CO\ :math:`{}_{2}` with Rubisco is +:math:`\sim`\ 30‰; however, since about 5-10% of carbon in C3 plants +reacts with phosphoenolpyruvate carboxylase (PEPC) (Melzer and O’Leary, +1987), the net kinetic isotope effect during fixation is +:math:`\sim`\ 27‰ for C3 plants. In C4 plant photosynthesis, only the +diffusion effect is important. The fractionation factor equations for C3 +and C4 plants are given below: + +For C4 plants, + +.. math:: + + \label{25.8)} + \alpha _{psn} =1+\frac{4.4}{1000} + +For C3 plants, + +.. math:: + + \label{25.9)} + \alpha _{psn} =1+\frac{4.4+22.6\frac{c_{i}^{*} }{pCO_{2} } }{1000} + +where :math:`{\alpha }_{psn}` is the fractionation factor, and +:math:`c^*_i` and pCO\ :math:`{}_{2}` are the revised intracellular and +atmospheric CO\ :math:`{}_{2}` partial pressure, respectively. + +As can be seen from the above equation, kinetic isotope effect during +fixation of CO\ :math:`{}_{2}` is dependent on the intracellular +CO\ :math:`{}_{2}` concentration, which in turn depends on the net +carbon assimilation. That is calculated during the photosynthesis +calculation as follows: + +.. math:: + + \label{25.10)} + c_{i} =pCO_{2} -a_{n} p\frac{\left(1.4g_{s} \right)+\left(1.6g_{b} \right)}{g_{b} g_{s} } + +and + +.. math:: + + \label{25.11)} + c_{i}^{*} =pCO_{2} -a_{n} \left(1-d\right)p\frac{\left(1.4g_{s} \right)+\left(1.6g_{b} \right)}{g_{b} g_{s} } + +where :math:`a_n` is net carbon assimilation during photosynthesis, +:math:`d` is downscaling factor due to nitrogen limitation, :math:`p` is +atmospheric pressure, :math:`g_b` is leaf boundary layer conductance, +and :math:`g_s` is leaf stomatal conductance. + +The fractionation factor :math:`{\alpha }_{psn}` and net assimilation +:math:`a_n` are calculated during the radiation time-step in +CanopyFluxesMod.F90, whereas the downscaling factor :math:`d` is not +calculated until after the nitrogen limitation is computed in +CNAllocationMod.F90. That results in a difference between the actual +photosynthesis, which is downscaled by :math:`d`, and the potential +photosynthesis. In order to overcome this mismatch, downscaling due to +nitrogen limitation is factored in the calculation of the kinetic +isotope effect during fixation by defining a downscaled version of +intracellular CO\ :math:`{}_{2}` (:math:`c^*_i`), as a first order +approximation. However, since nitrogen down-regulation is calculated +after the photosynthesis calculation, down-regulation coefficient +calculated in the previous time step needs to be used. + +Isotopic fractionation code is compatible with multi-layered canopy +parameterization; i.e., it is possible to calculate varying +discrimination rates for each layer of a multi-layered canopy. However, +as with the rest of the photosynthesis model, the number of canopy +layers is currently set to one by default. + +:math:`{}^{14}`\ C radioactive decay and historical atmospheric :math:`{}^{14}`\ C concentrations +------------------------------------------------------------------------------------------------------ + +In the preindustrial biosphere, radioactive decay of :math:`{}^{14}`\ C +in carbon pools allows dating of long-term age since photosynthetic +uptake; while over the 20\ :math:`{}^{th}` century, radiocarbon in the +atmosphere was first diluted by radiocarbon-free fossil fuels and then +enriched by aboveground thermonuclear testing to approximately double +its long-term mean concentration. CLM includes both of these processes +to allow comparison of carbon that may vary on multiple timescales with +observed values. + +For radioactive decay, at each timestep all :math:`{}^{14}`\ C pools are +reduced at a rate of –log/:math:`\tau`, where :math:`\tau` is the +half-life (Libby half-life value of 5568 years). In order to rapidly +equilibrate the long-lived pools during accelerated decomposition +spinup, the radioactive decay of the accelerated pools is also +accelerated by the same degree as the decomposition, such that the +:math:`{}^{14}`\ C value of these pools is in equilibrium when taken out +of the spinup mode. + +For variation of atmospheric :math:`{}^{14}`\ C over the historical +period, :math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C values can be set to +either fixed concentration (:math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C += 0‰) or time-varying concentrations read in from a file. A default file +is provided that is based on a spline fit through several observational +datasets spanning the 20\ :math:`{}^{th}` century: (Levin and Kromer, +2004; Manning and Melhuish, 1994; Nydal and Lövseth, 1996; Turnbull et +al. 2007). This is shown in Figure 25.1. + +Figure 25.1. Atmospheric :math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C +used to drive :math:`{}^{14}`\ C model over the historical period. + +|image| + +.. |image| image:: image1 diff --git a/doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst b/doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst new file mode 100644 index 0000000000..9bf3495e0c --- /dev/null +++ b/doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst @@ -0,0 +1,210 @@ +.. math:: 1 + +Offline Mode +================ + +In offline mode (uncoupled to an atmospheric model), the atmospheric +forcing required by CLM (Table 2.3) is supplied by observed datasets. +The standard forcing provided with the model is a 110-year (1901-2010) +dataset (CRUNCEP; Viovy 2011) that is a combination of two existing +datasets; the CRU TS3.2 0.5\ :math:`{}^\circ` X 0.5\ :math:`{}^\circ` +monthly data covering the period 1901 to 2002 (Mitchell and Jones 2005) +and the NCEP reanalysis 2.5\ :math:`{}^\circ` X 2.5\ :math:`{}^\circ` +6-hourly data covering the period 1948 to 2010. The CRUNCEP dataset has +been used to force CLM for studies of vegetation growth, +evapotranspiration, and gross primary production (Mao et al. 2012, Mao +et al. 2013, Shi et al. 2013) and for the TRENDY (trends in net +land-atmosphere carbon exchange over the period 1980-2010) project (Piao +et al. 2012). Version 4 is used here (Viovy 2011). Alternative forcing +datasets can also be used (e.g., the Qian et al. (2006) dataset used for +previous versions of CLM is still available). + +Here, the CRUNCEP dataset, which does not include data over oceans, +lakes, and Antarctica is modified. This missing data is filled with Qian +et al. (2006) data from 1948 that is interpolated by the data atmosphere +model to the 0.5\ :math:`{}^\circ` CRUNCEP grid. This allows the model +to be run over Antarctica and ensures data is available along coastlines +regardless of model resolution. + +The forcing data is ingested into a data atmosphere model in three +“streams”; precipitation (:math:`P`) (mm s\ :math:`{}^{-1}`), solar +radiation (:math:`S_{atm}` ) (W m\ :math:`{}^{-2}`), and four other +fields [atmospheric pressure :math:`P_{atm}` (Pa), atmospheric specific +humidity :math:`q_{atm}` (kg kg\ :math:`{}^{-1}`), atmospheric +temperature :math:`T_{atm}` (K), and atmospheric wind :math:`W_{atm}` +(m s\ :math:`{}^{-1}`)]. These are separate streams because they are +handled differently according to the type of field. In the CRUNCEP +dataset, the precipitation stream is provided at six hour intervals and +the data atmosphere model prescribes the same precipitation rate for +each model time step within the six hour period. The four fields that +are grouped together in another stream (pressure, humidity, temperature, +and wind) are provided at six hour intervals and the data atmosphere +model linearly interpolates these fields to the time step of the model. + +The total solar radiation is also provided at six hour intervals. The +data is fit to the model time step using a diurnal function that depends +on the cosine of the solar zenith angle :math:`\mu` to provide a +smoother diurnal cycle of solar radiation and to ensure that all of the +solar radiation supplied by the six-hourly forcing data is actually +used. The solar radiation at model time step :math:`t_{M}` is + +.. math:: + + \label{ZEqnNum160435} + \begin{array}{l} {S_{atm} \left(t_{M} \right)=\frac{\frac{\Delta t_{FD} }{\Delta t_{M} } S_{atm} \left(t_{FD} \right)\mu \left(t_{M} \right)}{\sum _{i=1}^{\frac{\Delta t_{FD} }{\Delta t_{M} } }\mu \left(t_{M_{i} } \right) } \qquad {\rm for\; }\mu \left(t_{M} \right)>0.001} \\ {S_{atm} \left(t_{M} \right)=0\qquad {\rm for\; }\mu \left(t_{M} \right)\le 0.001} \end{array} + +where :math:`\Delta t_{FD}` is the time step of the forcing data (6 +hours :math:`\times` 3600 seconds hour\ :math:`{}^{-1}` = 21600 +seconds), :math:`\Delta t_{M}` is the model time step (seconds), +:math:`S_{atm} \left(t_{FD} \right)` is the six-hourly solar radiation +from the forcing data (W m\ :math:`{}^{-2}`), and +:math:`\mu \left(t_{M} \right)` is the cosine of the solar zenith angle +at model time step :math:`t_{M}` (section 3.3). The term in the +denominator of equation is the sum of the cosine of the solar zenith +angle for each model time step falling within the six hour period. For +numerical purposes, :math:`\mu \left(t_{M_{i} } \right)\ge 0.001`. + +The total incident solar radiation :math:`S_{atm}` at the model time +step :math:`t_{M}` is then split into near-infrared and visible +radiation and partitioned into direct and diffuse according to factors +derived from one year’s worth of hourly CAM output from CAM version +cam3\_5\_55 as + +.. math:: + + \label{26.2)} + S_{atm} \, \downarrow _{vis}^{\mu } =R_{vis} \left(\alpha S_{atm} \right) + +.. math:: + + \label{26.3)} + S_{atm} \, \downarrow _{nir}^{\mu } =R_{nir} \left[\left(1-\alpha \right)S_{atm} \right] + +.. math:: + + \label{26.4)} + S_{atm} \, \downarrow _{vis} =\left(1-R_{vis} \right)\left(\alpha S_{atm} \right) + +.. math:: + + \label{26.5)} + S_{atm} \, \downarrow _{nir} =\left(1-R_{nir} \right)\left[\left(1-\alpha \right)S_{atm} \right]. + +where :math:`\alpha` , the ratio of visible to total incident solar +radiation, is assumed to be + +.. math:: + + \label{26.6)} + \alpha =\frac{S_{atm} \, \downarrow _{vis}^{\mu } +S_{atm} \, \downarrow _{vis}^{} }{S_{atm} } =0.5. + +The ratio of direct to total incident radiation in the visible +:math:`R_{vis}` is + +.. math:: + + \label{26.7)} + R_{vis} =a_{0} +a_{1} \times \alpha S_{atm} +a_{2} \times \left(\alpha S_{atm} \right)^{2} +a_{3} \times \left(\alpha S_{atm} \right)^{3} \qquad 0.01\le R_{vis} \le 0.99 + +and in the near-infrared :math:`R_{nir}` is + +.. math:: + + \label{26.8)} + R_{nir} =b_{0} +b_{1} \times \left(1-\alpha \right)S_{atm} +b_{2} \times \left[\left(1-\alpha \right)S_{atm} \right]^{2} +b_{3} \times \left[\left(1-\alpha \right)S_{atm} \right]^{3} \qquad 0.01\le R_{nir} \le 0.99 + +where +:math:`a_{0} =0.17639,\, a_{1} =0.00380,\, a_{2} =-9.0039\times 10^{-6} ,\, a_{3} =8.1351\times 10^{-9}` +and +:math:`b_{0} =0.29548,b_{1} =0.00504,b_{2} =-1.4957\times 10^{-5} ,b_{3} =1.4881\times 10^{-8}` +are coefficients from polynomial fits to the placeCAM data. + +The additional atmospheric forcing variables required by Table 2.3 are +derived as follows. The atmospheric reference height :math:`z'_{atm}` +(m) is set to 30 m. The directional wind components are derived as +:math:`u_{atm} =v_{atm} ={W_{atm} \mathord{\left/ {\vphantom {W_{atm} \sqrt{2} }} \right. \kern-\nulldelimiterspace} \sqrt{2} }` . +The potential temperature :math:`\overline{\theta _{atm} }` (K) is set +to the atmospheric temperature :math:`T_{atm}` . The atmospheric +longwave radiation :math:`L_{atm} \, \downarrow` (W m\ :math:`{}^{-2}`) +is derived from the atmospheric vapor pressure :math:`e_{atm}` and +temperature :math:`T_{atm}` (Idso 1981) as + +.. math:: + + \label{26.9)} + L_{atm} \, \downarrow =\left[0.70+5.95\times 10^{-5} \times 0.01e_{atm} \exp \left(\frac{1500}{T_{atm} } \right)\right]\sigma T_{atm}^{4} + +where + +.. math:: + + \label{26.10)} + e_{atm} =\frac{P_{atm} q_{atm} }{0.622+0.378q_{atm} } + +and :math:`\sigma` is the Stefan-Boltzmann constant (W +m\ :math:`{}^{-2}` K\ :math:`{}^{-4}`) (Table 2.6). The fraction of +precipitation :math:`P` (mm s\ :math:`{}^{-1}`) falling as rain and/or +snow is + +.. math:: + + \label{ZEqnNum336485} + q_{rain} =P\left(f_{P} \right), + +.. math:: + + \label{26.12)} + q_{snow} =P\left(1-f_{P} \right) + +where + +.. math:: + + \label{26.13)} + f_{P} =0<0.5\left(T_{atm} -T_{f} \right)<1. + +The aerosol deposition rates :math:`D_{sp}` (14 rates as described in +Table 2.3) are provided by a time-varying, globally-gridded aerosol +deposition file developed by Lamarque et al. (2010). + +If the user wishes to provide atmospheric forcing data from another +source, the data format outlined above will need to be followed with the +following exceptions. The data atmosphere model will accept a +user-supplied relative humidity :math:`RH` (%) and derive specific +humidity :math:`q_{atm}` (kg kg\ :math:`{}^{-1}`) from + +.. math:: + + \label{26.14)} + q_{atm} =\frac{0.622e_{atm} }{P_{atm} -0.378e_{atm} } + +where the atmospheric vapor pressure :math:`e_{atm}` (Pa) is derived +from the water (:math:`T_{atm} >T_{f}` ) or ice +(:math:`T_{atm} \le T_{f}` ) saturation vapor pressure +:math:`e_{sat}^{T_{atm} }` as +:math:`e_{atm} =\frac{RH}{100} e_{sat}^{T_{atm} }` where :math:`T_{f}` +is the freezing temperature of water (K) (Table 2.6), and +:math:`P_{atm}` is the pressure at height :math:`z_{atm}` (Pa). The +data atmosphere model will also accept a user-supplied dew point +temperature :math:`T_{dew}` (K) and derive specific humidity +:math:`q_{atm}` from + +.. math:: + + \label{26.15)} + q_{atm} =\frac{0.622e_{sat}^{T_{dew} } }{P_{atm} -0.378e_{sat}^{T_{dew} } } . + +Here, :math:`e_{sat}^{T}` , the saturation vapor pressure as a function +of temperature, is derived from Lowe’s (1977) polynomials. If not +provided by the user, the atmospheric pressure :math:`P_{atm}` (Pa) is +set equal to the standard atmospheric pressure :math:`P_{std} =101325` +Pa, and surface pressure :math:`P_{srf}` (Pa) is set equal +to\ :math:`P_{atm}` . + +The user may provide the total direct and diffuse solar radiation, +:math:`S_{atm} \, \downarrow ^{\mu }` and +:math:`S_{atm} \, \downarrow` . These will be time-interpolated using +the procedure described above and then each term equally apportioned +into the visible and near-infrared wavebands (e.g., +:math:`S_{atm} \, \downarrow _{vis}^{\mu } =0.5S_{atm} \, \downarrow ^{\mu }` , +:math:`S_{atm} \, \downarrow _{nir}^{\mu } =0.5S_{atm} \, \downarrow ^{\mu }` ). diff --git a/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst b/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst new file mode 100644 index 0000000000..fb30a23e60 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst @@ -0,0 +1,1377 @@ +.. math:: 1 + +.. math:: 1 + +References +============== + +Aber, J.D., Melillo, J.M. and McClaugherty, C.A., 1990. Predicting +long-term patterns of mass loss, nitrogen dynamics, and soil organic +matter formation from initial fime litter chemistry in temperate forest +ecosystems. Canadian Journal of Botany, 68: 2201-2208. + +Aber, J.D., Goodale, C.L., Ollinger, S.V., Smith, M.-L., Magill, A.H., +Martin, M.E., Hallett, R.A., and Stoddard, J.L. 2003. Is nitrogen +deposition altering the nitrogen status of northeastern forests? +BioScience 53:375-389. + +Allen, C.B., Will, R.E., and Jacobson, M.A. 2005. Production efficiency +and radiation use efficiency of four tree species receiving irrigation +and fertilization. Forest Science 51:556-569. + +Anderson, E.A. 1976. A point energy and mass balance model of a snow +cover. NOAA Technical Report NWS 19, Office of Hydrology, National +Weather Service, Silver Spring, MD. + +André, J.-C., Goutorbe, J.-P., and Perrier, A. 1986. HAPEX-MOBILHY: A +hydrologic atmosphere experiment for the study of water budget and +evaporation flux at the climatic scale. Bull. Amer. Meteor. Soc. +67:138-144. + +Andrén, O. and Paustian, K., 1987. Barley straw decomposition in the +field: a comparison of models. Ecology 68:1190-1200. + +Arah, J.R.M. and Stephen, K.D., 1998. A model of the processes leading +to methane emission from peatland. Atmos. Environ. 32:3257-3264. + +Arah, J. and Vinten, A., 1995. Simplified models of anoxia and +denitrification in aggregated and simple-structured soils. European +Journal of Soil Science 46:507-517. + +Arendt, A., et al. 2012. Randolph Glacier Inventory: A Dataset of Global +Glacier Outlines Version: 1.0, Global Land Ice Measurements from Space, +Boulder Colorado, USA. Digital Media. + +Arora, V.K. and Boer, G.J. 2005. Fire as an interactive component of +dynamic vegetation models. J. Geophys. Res. 110:G02008. +DOI:10.1029/2005JG000042. + +Arya, S.P. 2001. Introduction to Meteorology. Academic Press, San Diego, +CA. + +Asner, G.P., Wessman, C.A., Schimel, D.S., and Archer, S. 1998. +Variability in leaf and litter optical properties: implications for BRDF +model inversions using AVHRR, MODIS, and MISR. Remote Sens. Environ. +63:243-257. + +Axelsson, E., and Axelsson, B. 1986. Changes in carbon allocation +patterns in spruce and pine trees following irrigation and +fertilization. Tree Phys. 2:189-204. + +Baird, A.J., Beckwith, C.W., Waldron, S. and Waddington, J.M., 2004. +Ebullition of methane-containing gas bubbles from near-surface Sphagnum +peat. Geophys. Res. Lett. 31. DOI:10.1029/2004GL021157. + +Baldocchi, D., et al. 2001. FLUXNET: A new tool to study the temporal +and spatial variability of ecosystem-scale carbon dioxide, water vapor, +and energy flux densities. Bull. Amer. Meteor. Soc. 82:2415-2433. + +Barbottin, A., Lecomte, C., Bouchard, C., and Jeuffroy, M.-H. 2005. +Nitrogen remobilization during grain filling in wheat: Genotypic and +environmental effects. Crop Sci. 45:1141-1150. + +Batjes, N.H., 2006. ISRIC-WISE derived soil properties on a 5 by 5 +arc-minutes global grid. Report 2006/02 (available through : +http://www.isric.org) + +Berger, A.L. 1978a. Long-term variations of daily insolation and +quaternary climatic changes. J. Atmos. Sci. 35:2362-2367. + +Berger, A.L. 1978b. A simple algorithm to compute long-term variations +of daily or monthly insolation. Contribution de l’Institut d’Astronomie +et de Géophysique, Université Catholique de Louvain, Louvain-la-Neuve, +No. 18. + +Berger, A., Loutre, M.-F., and Tricot, C. 1993. Insolation and Earth’s +orbital periods. J. Geophys. Res. 98:10341-10362. + +Berkowitz, B., and Balberg, I. 1992. Percolation approach to the problem +of hydraulic conductivity in porous media. Transport in Porous Media +9:275–286. + +Beven, K.J., and Kirkby, M.J. 1979. A physically based variable +contributing area model of basin hydrology. Hydrol. Sci. Bull. 24:43-69. + +Bohren, C. F., and Huffman, D. R. 1983. Absorption and scattering of +light by small particles. John Wiley & Sons, New York, NY. + +Bonan, G.B. 1996. A land surface model (LSM version 1.0) for ecological, +hydrological, and atmospheric studies: Technical description and user’s +guide. NCAR Technical Note NCAR/TN-417+STR, National Center for +Atmospheric Research, Boulder, CO, 150 pp. + +Bonan, G.B. 1998. The land surface climatology of the NCAR Land Surface +Model coupled to the NCAR Community Climate Model. J. Climate +11:1307-1326. + +Bonan, G.B. 2002. Ecological Climatology: Concepts and Applications. +Cambridge University Press. + +Bonan, G.B., Oleson, K.W., Vertenstein, M., Levis, S., Zeng, X., Dai, +Y., Dickinson, R.E., and Yang, Z.-L. 2002a. The land surface climatology +of the Community Land Model coupled to the NCAR Community Climate Model. +J. Climate 15: 3123-3149. + +Bonan, G.B., Levis, S., Kergoat, L., and Oleson, K.W. 2002b. Landscapes +as patches of plant functional types: An integrating concept for climate +and ecosystem models. Global Biogeochem. Cycles 16: 5.1-5.23. + +Bonan, G.B., and Levis, S. 2006. Evaluating aspects of the Community +Land and Atmosphere Models (CLM3 and CAM3) using a dynamic global +vegetation model. J. Climate 19:2290-2301. + +Bonan, G.B., Lawrence P.J., Oleson K.W., Levis S., Jung M., Reichstein +M., Lawrence, D.M., and Swenson, S.C. 2011. Improving canopy processes +in the Community Land Model (CLM4) using global flux fields empirically +inferred from FLUXNET data. J. Geophys. Res. 116, G02014. +DOI:10.1029/2010JG001593. + +Bonan, G. B., Oleson, K.W., Fisher, R.A., Lasslop, G., and Reichstein, +M. 2012. Reconciling leaf physiological traits and canopy flux data: Use +of the TRY and FLUXNET databases in the Community Land Model version 4, +J. Geophys. Res., 117, G02026. DOI:10.1029/2011JG001913. + +Branstetter, M.L., and Famiglietti, J.S. 1999. Testing the sensitivity +of GCM-simulated runoff to climate model resolution using a parallel +river transport algorithm. Preprints, 14\ :math:`{}^{th}` Conference on +Hydrology, Dallas, TX, Amer. Meteor. Soc., 391-392. + +Branstetter, M.L. 2001. Development of a parallel river transport +algorithm and applications to climate studies. Ph.D. dissertation, +University of Texas at Austin. + +Brun, E. 1989. Investigation of wet-snow metamorphism in respect of +liquid water content. Ann. Glaciol. 13:22-26. + +Bugmann, H., and Solomon, A.M. 2000. Explaining forest composition and +biomass across multiple biogeographical regions. Ecol. Appl. 10:95-114. + +Busing, R.T. 2005. Tree mortality, canopy turnover, and woody detritus +in old cove forests of the southern Appalachians. Ecology 86:73-84. + +Campbell, G.S., and Norman, J.M. 1998. An Introduction to Environmental +Biophysics (2:math:`{}^{nd}` edition). Springer-Verlag, New York. + +Castillo, G., Kendra, C., Levis, S., and Thornton, P. 2012. Evaluation +of the new CNDV option of the Community Land Model: effects of dynamic +vegetation and interactive nitrogen on CLM4 means and variability. J. +Climate 25:3702–3714. + +Cao, M., Marshall, S. and Gregson, K., 1996. Global carbon exchange and +methane emissions from natural wetlands: Application of a process-based +model. J. Geophys. Res. 101(D9):14,399-14,414. + +Churkina, G. et al., 2003. Analyzing the ecosystem carbon dynamics of +four European coniferous forests using a biogeochemistry model. +Ecosystems, 6: 168-184. + +CIESIN: Gridded population of the world version 3 (GPWv3), 2005. +Population density grids, Technical report, Socioeconomic Data and +Applications Center (SEDAC), Columbia University, Palisades, New York, +USA. + +Clapp, R.B., and Hornberger, G.M. 1978. Empirical equations for some +soil hydraulic properties. Water Resour. Res. 14:601-604. + +Clauser, C., and Huenges, E. 1995. Thermal conductivity of rocks and +minerals. pp. 105-126. In: T. J. Ahrens (editor) Rock Physics and Phase +Relations: A Handbook of Physical Constants. Washington, D.C. + +Cleveland, C.C., Townsend, A.R., Schimel, D.S., Fisher, H., Howarth, +R.W., Hedin, L.O., Perakis, S.S., Latty, E.F., Von Fischer, J.C., +Elseroad, A., and Wasson, M.F. 1999. Global patterns of terrestrial +biological nitrogen (N2) fixation in natural ecosystems. Global +Biogeochem. Cycles 13:623-645. + +Collatz, G.J., Ball, J.T., Grivet, C., and Berry, J.A. 1991. +Physiological and environmental regulation of stomatal conductance, +photosynthesis, and transpiration: A model that includes a laminar +boundary layer. Agric. For. Meteor. 54:107-136. + +Collatz, G.J., Ribas-Carbo, M., and Berry, J.A. 1992. Coupled +photosynthesis-stomatal conductance model for leaves of +C\ :math:`{}_{4}` plants. Aust. J. Plant Physiol. 19:519-538. + +Colmer, T.D., 2003. Long-distance transport of gases in plants: a +perspective on internal aeration and radial oxygen loss from roots. +Plant Cell and Environment 26:17-36. + +Conway, H., Gades, A., and Raymond, C.F. 1996. Albedo of dirty snow +during conditions of melt. Water Resour. Res. 32:1713-1718. + +Cosby, B.J., Hornberger, G.M., Clapp, R.B., and Ginn, T.R. 1984. A +statistical exploration of the relationships of soil moisture +characteristics to the physical properties of soils. Water Resour. Res. +20:682-690. + +Crawford, T. W., Rendig, V. V., and Broadent, F. E. 1982. Sources, +fluxes, and sinks of nitrogen during early reproductive growth of maize +(Zea mays L.). Plant Physiol. 70:1645-1660. + +Dai, Y., and Zeng, Q. 1997. A land surface model (IAP94) for climate +studies. Part I: formulation and validation in off-line experiments. +Adv. Atmos. Sci. 14:433-460. + +Dai, Y., et al. 2001. Common Land Model: Technical documentation and +user’s guide [Available online at +http://climate.eas.gatech.edu/dai/clmdoc.pdf]. + +Dai, Y., Zeng, X., Dickinson, R.E., Baker, I., Bonan, G.B., Bosilovich, +M.G., Denning, A.S., Dirmeyer, P.A., Houser, P.R., Niu, G., Oleson, +K.W., Schlosser, C.A., and Yang, Z.-L. 2003. The Common Land Model. +Bull. Amer. Meteor. Soc. 84:1013-1023. + +Dai, Y., Dickinson, R.E., and Wang, Y.-P. 2004. A two-big-leaf model for +canopy temperature, photosynthesis, and stomatal conductance. J. Climate +17:2281-2299. + +Dai, A., and Trenberth, K.E. 2002. Estimates of freshwater discharge +from continents: Latitudinal and seasonal variations. J. Hydrometeor. +3:660-687. + +DeFries, R.S., Hansen, M.C., Townshend, J.R.G., Janetos, A.C., and +Loveland, T.R. 2000. A new global 1-km dataset of percentage tree cover +derived from remote sensing. Global Change Biol. 6:247-254. + +Degens, B. and Sparling, G., 1996. Changes in aggregation do not +correspond with changes in labile organic C fractions in soil amended +with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): +453-462. + +de Vries, D.A. 1963. Thermal Properties of Soils. In: W.R. van Wijk +(editor) Physics of the Plant Environment. North-Holland, Amsterdam. + +Dickinson, R.E. 1983. Land surface processes and climate-surface albedos +and energy balance. Adv. Geophys. 25:305-353. + +Dickinson, R.E., Henderson-Sellers, A., and Kennedy, P.J. 1993. +Biosphere-Atmosphere Transfer Scheme (BATS) version 1e as coupled to the +NCAR Community Climate Model. NCAR Technical Note NCAR/TN-387+STR. +National Center for Atmospheric Research, Boulder, CO. + +Dickinson, R.E., Oleson, K.W., Bonan, G., Hoffman, F., Thornton, P., +Vertenstein, M., Yang, Z.-L., and Zeng, X. 2006. The Community Land +Model and its climate statistics as a component of the Community Climate +System Model. J. Climate 19:2302-2324. + +Dingman, S.L. 2002. Physical Hydrology. Second Edition. Prentice Hall, +NJ. + +Dirmeyer, P.A., Dolman, A.J., and Sato, N. 1999. The pilot phase of the +Global Soil Wetness Project. Bull. Amer. Meteor. Soc. 80:851-878. + +Dobson, J.E., Bright, E.A., Coleman, P.R., Durfee, R.C., and Worley, +B.A. 2000. LandScan: A global population database for estimating +populations at risk. Photogramm. Eng. Rem. Sens. 66:849-857. + +Dorman, J.L., and Sellers, P.J. 1989. A global climatology of albedo, +roughness length and stomatal resistance for atmospheric general +circulation models as represented by the simple biosphere model (SiB). +J. Appl. Meteor. 28:833-855. + +Dougherty, R.L., Bradford, J.A., Coyne, P.I., and Sims, P.L. 1994. +Applying an empirical model of stomatal conductance to three C4 grasses. +Agric. For. Meteor. 67:269-290. + +Drewniak, B., Song, J., Prell, J., Kotamarthi, V.R., and Jacob, R. 2013. +Modeling agriculture in the Community Land Model. Geosci. Model Dev. +6:495-515. DOI:10.5194/gmd-6-495-2013. + +Dunfield, P., Knowles, R., Dumont, R. and Moore, T.R., 1993. Methane +Production and Consumption in Temperate and Sub-Arctic Peat Soils - +Response to Temperature and Ph. Soil Biology & Biochemistry 25:321-326. + +Entekhabi, D., and Eagleson, P.S. 1989. Land surface hydrology +parameterization for atmospheric general circulation models including +subgrid scale spatial variability. J. Climate 2:816-831. + +Fang, X. and Stefan, H.G., 1996. Long-term lake water temperature and +ice cover simulations/measurements. Cold Regions Science and Technology +24:289-304. + +Farouki, O.T. 1981. The thermal properties of soils in cold regions. +Cold Regions Sci. and Tech. 5:67-75. + +Farquhar, G.D., von Caemmerer, S., and Berry, J.A. 1980. A biochemical +model of photosynthetic CO\ :math:`{}_{2}` assimilation in leaves of +C\ :math:`{}_{3}` species. Planta 149:78-90. + +Farquhar, G.D., and von Caemmerer, S. 1982. Modeling of photosynthetic +response to environmental conditions. pp. 549-587. In: O.L. Lange, P.S. +Nobel, C.B. Osmond, and H. Zeigler (editors) Encyclopedia of Plant +Physiology. Vol. 12B. Physiological Plant Ecology. II. Water Relations +and Carbon Assimilation. Springer-Verlag, New York. + +Ferrari, J.B., 1999. Fine-scale patterns of leaf litterfall and nitrogen +cycling in an old-growth forest. Canadian Journal of Forest Research, +29: 291-302. + +Firestone, M.K. and Davidson, E.A. 1989. Exchange of Trace Gases between +Terrestrial Ecosystems and the Atmosphere. In: M.O. Andreae and D.S. +Schimel (Editors). John Wiley and Sons, pp. 7-21. + +Flanner, M.G., and Zender. C.S. 2005. Snowpack radiative heating: +Influence on Tibetan Plateau climate. Geophys. Res. Lett. 32:L06501. +DOI:10.1029/2004GL022076. + +Flanner, M.G., and Zender, C.S. 2006. Linking snowpack microphysics and +albedo evolution. J. Geophys. Res. 111:D12208. DOI:10.1029/2005JD006834. + +Flanner, M.G., Zender, C.S., Randerson, J.T., and Rasch, P.J. 2007. +Present day climate forcing and response from black carbon in snow. J. +Geophys. Res. 112:D11202. DOI:10.1029/2006JD008003. + +Flatau, P.J., Walko, R.L., and Cotton, W.R. 1992. Polynomial fits to +saturation vapor pressure. J. Appl. Meteor. 31:1507-1513. + +Friedl, M.A., McIver, D.K., Hodges, J.C.F., Zhang, X.Y., Muchoney, D., +Strahler, A.H., Woodcock, C.E., Gopal, S., Schneider, A., Cooper, A., +Baccini, A., Gao, F., and Schaaf, C. 2002. Global land cover mapping +from MODIS: algorithms and early results. Remote Sens. Environ. +83:287-302. + +Frolking, S., et al. 2001. Modeling Northern Peatland Decomposition and +Peat Accumulation. Ecosystems. 4:479-498. + +Gallais, A., Coque, M. Quillere, I., Prioul, J., and Hirel, B. 2006. +Modeling postsilking nitrogen fluxes in maize (Zea mays) using +15N-labeling field experiments. New Phytologist 172:696-707. + +Gallais, A., Coque, M., Gouis, J. L., Prioul, J. L., Hirel, B., and +Quillere, I. 2007. Estimating the proportion of nitrogen remobilization +and of postsilking nitrogen uptake allocated to maize kernels by +Nitrogen-15 labeling. Crop Sci. 47:685-693. + +Galloway, J.N., et al. 2004. Nitrogen cycles: past, present, and future. +Biogeochem. 70:153-226. + +Garcia, R.L., Kanemasu, E.T., Blad, B.L., Bauer, A., Hatfield, J.L., +Major, D.A., Reginato, R.J., and Hubbard, K.G. 1988. Interception and +use efficiency of light in winter wheat under different nitrogen +regimes. Agric. For. Meteor. 44:175-186. + +Gash, J.H.C., Nobre, C.A., Roberts, J.M., and Victoria, R.L. 1996. An +overview of ABRACOS. pp. 1-14. In: J.H.C. Gash, C.A. Nobre, J.M. +Roberts, and R.L. Victoria (editors) Amazonian Deforestation and +Climate. John Wiley and Sons, Chichester, England. + +Gholz, H.L., Perry, C.S., Cropper, W.P., Jr. and Hendry, L.C., 1985. +Litterfall, decomposition, and nitrogen and phosphorous dynamics in a +chronosequence of slash pine (*Pinus elliottii*) plantations. Forest +Science, 31: 463-478. + +Giglio, L., Csiszar, I., and Justice, C.O. 2006. Global distribution and +seasonality of active fires as observed with the Terra and Aqua Moderate +Resolution Imaging Spectroradiometer (MODIS) sensors. J. Geophys. Res. +111:G02016. DOI:10.1029/2005JG000142. + +Global Soil Data Task 2000. Global soil data products CD-ROM (IGBP-DIS). +International Geosphere-Biosphere Programme-Data and Information +Available Services [Available online at http://www.daac.ornl.gov]. + +Gomes, E.P.C., Mantovani, W., and Kageyama, P.Y. 2003. Mortality and +recruitment of trees in a secondary montane rain forest in southeastern +Brazil. Brazilian Journal of Biology 63:47-60. + +Gosz, J.R., Likens, G.E., and Bormann, F.H. 1973. Nutrient release from +decomposing leaf and branch litter in the Hubbard Brook Forest, New +Hampshire. Ecological Monographs 43:173-191. + +Gotangco Castillo C., Levis S., and Thornton P. 2012. Evaluation of the +new CNDV option of the Community Land Model: Effects of dynamic +vegetation and interactive nitrogen on CLM4 means and variability. J. +Climate 25:3702-3714. DOI:10.1175/JCLID-11-00372.1. + +Graham, S.T., Famiglietti, J.S., and Maidment, D.R. 1999. Five-minute, +1/2º, and 1º data sets of continental watersheds and river networks for +use in regional and global hydrologic and climate system modeling +studies. Water Resour. Res. 35:583-587. + +Grenfell, T.C., and Warren, S.G. 1999. Representation of a nonspherical +ice particle by a collection of independent spheres for scattering and +absorption of radiation. J. Geophys. Res. 104(D24):37697-37709. + +del Grosso, S.J., et al. 2000. General model for N2O and N2 gas +emissions from soils due to dentrification. Global Biogeochem. Cycles +14:1045-1060. + +Guenther, A., Hewitt, C.N., Erickson, D., Fall, R., Geron, C., Graedel, +T., Harley, P., Klinger, L., Lerdau, M., McKay, W.A., Pierce, T., +Scholes, B., Steinbrecher, R., Tallamraju, R., Taylor, J., and +Zimmerman, P. 1995. A global model of natural volatile organic compound +emissions. J. Geophys. Res. 100:8873-8892. + +Guenther, A., Karl, T., Harley, P., Wiedinmyer, C., Palmer. P.I., and +Geron, C. 2006. Estimates of global terrestrial isoprene emissions using +MEGAN (Model of Emissions of Gases and Aerosols from Nature). Atmos. +Chem. Phys. 6:3181–3210. + +Guenther, A. B., Jiang, X., Heald, C. L., Sakulyanontvittaya, T., Duhl, +T., Emmons, L. K., & Wang, X., 2012. The Model of Emissions of Gases and +Aerosols from Nature version 2.1 (MEGAN2.1): an extended and updated +framework for modeling biogenic emissions, Geosci. Model Dev., 5, +1471–1492. DOI:10.5194. + +Hack, J.J., Caron, J.M., Yeager, S.G., Oleson, K.W., Holland, M.M., +Truesdale, J.E., and Rasch, P.J. 2006. Simulation of the global +hydrological cycle in the CCSM Community Atmosphere Model version 3 +(CAM3): mean features. J. Climate 19:2199-2221. + +Hansen, M., DeFries, R.S., Townshend, J.R.G., Carroll, M., Dimiceli, C., +and Sohlberg, R.A. 2003. Global percent tree cover at a spatial +resolution of 500 meters: first results of the MODIS vegetation +continuous fields algorithm. Earth Interactions 7:1-15. + +Hastings, D.A., Dunbar, P.K., Elphingstone, G.M., Bootz, M., Murakami, +H., Maruyama, H., Masaharu, H., Holland, P., Payne, J., Bryant, N.A., +Logan, T.L., Muller, J.-P., Schreier, G., and MacDonald, J.S., eds., +1999. The Global Land One-kilometer Base Elevation (GLOBE) Digital +Elevation Model, Version 1.0. National Oceanic and Atmospheric +Administration, National Geophysical Data Center, 325 Broadway, Boulder, +Colorado 80305-3328, U.S.A. + +Heald, C.L., Henze, D.K., Horowitz, L.W., Feddema, J., Lamarque, J.-F., +Guenther, A., Hess, P.G., Vitt, F., Seinfeld, J.H., Goldstein, A.H., and +Fung, I. 2008. Predicted change in global secondary organic aerosol +concentrations in response to future climate, emissions, and land use +change. J. Geophys. Res. 113:D05211. DOI:10.1029/2007JD009092. + +Heald, C.L., Wilkinson, M.J., Monson, R.K., Alo, C.A., Wang, G.L., and +Guenther, A. 2009. Response of isoprene emission to ambient +CO\ :math:`{}_{2}` changes and implications for global budgets. Global +Change Biol. 15:1127-1140. DOI:10.1111/j.1365-2486.2008.01802.x + +Henderson-Sellers, B. 1985. New formulation of eddy diffusion +thermocline models. Appl. Math. Modelling 9:441-446. + +Henderson-Sellers, B. 1986. Calculating the surface energy balance for +lake and reservoir modeling: A review. Rev. Geophys. 24:625-649. + +Henderson-Sellers, A., Yang, Z.-L., and Dickinson, R.E. 1993. The +project for intercomparison of land-surface parameterization schemes. +Bull. Amer. Meteor. Soc. 74: 1335-1349. + +Hostetler, S.W., and Bartlein, P.J. 1990. Simulation of lake evaporation +with application to modeling lake level variations of Harney-Malheur +Lake, Oregon. Water Resour. Res. 26:2603-2612. + +Hostetler, S.W., Bates, G.T., and Giorgi, F. 1993. Interactive coupling +of a lake thermal model with a regional climate model. J. Geophys. Res. +98:5045-5057. + +Hostetler, S.W., Giorgi, F., Bates, G.T., and Bartlein, P.J. 1994. +Lake-atmosphere feedbacks associated with paleolakes Bonneville and +Lahontan. Science 263:665-668. + +Hou, Z., Huang, M., Leung, L.R., Lin, G., and Ricciuto, D.M. 2012. +Sensitivity of surface flux simulations to hydrologic parameters based +on an uncertainty quantification framework applied to the Community Land +Model. J. Geophys. Res. 117:D15108. + +Huang, M., and Liang, X. 2006. On the assessment of the impact of +reducing parameters and identification of parameter uncertainties for a +hydrologic model with applications to ungauged basins. J. Hydrol. +320:37-61. + +Hugelius, G., C. Tarnocai, G. Broll, J.G. Canadell, P. Kuhry, adn D.K. +Swanson, 2012. The Northern Circumpolar Soil Carbon Database: spatially +distributed datasets of soil coverage and soil carbon storage in the +northern permafrost regions. Earth Syst. Sci. Data Discuss., 5, 707-733 +(available online at (http://dev1.geo.su.se/bbcc/dev/ncscd/). + +Hunt, H.W., Ingham, E.R., Coleman, D.C., Elliott, E.T., and Reid, C.P.P. +1988. Nitrogen limitation of production and decomposition in prairie, +mountain meadow, and pine forest. Ecology 69:1009-1016. + +Hunt, E.R., Jr. and Running, S.W., 1992. Simulated dry matter yields for +aspen and spruce stands in the north american boreal forest. Canadian +Journal of Remote Sensing, 18: 126-133. + +Hunt, E.R., Jr. et al., 1996. Global net carbon exchange and +intra-annual atmospheric CO\ :math:`{}_{2}` concentrations predicted by +an ecosystem process model and three-dimensional atmospheric transport +model. Global Biogeochemical Cycles, 10: 431-456. + +Hurtt, G.C., Frolking, S., Fearon, M.G., Moore, B., Shevliakova, E., +Malyshev, S., Pacala, S.W., and Houghton, R.A. 2006. The underpinnings +of land-use history: three centuries of global gridded land-use +transitions, wood-harvest activity, and resulting secondary lands. +Global Change Biol. 12:1208-1229. + +Hurtt, G.C., et al. 2011. Harmonization of land-use scenarios for the +period 1500-2100: 600 years of global gridded annual land-use +transitions, wood harvest, and resulting secondary lands. Climatic +Change 109:117-161. DOI:10.1007/s10584-011-0153-2. + +Idso, S.B. 1981. A set of equations for full spectrum and 8- to +14-\ :math:`\mu` \ m and 10.5- to 12.5-\ :math:`\mu` \ m thermal +radiation from cloudless skies. Water Resour. Res. 17:295-304. + +Iiyama, I. and Hasegawa, S., 2005. Gas diffusion coefficient of +undisturbed peat soils. Soil Science and Plant Nutrition 51:431-435. + +Jackson, R. B., Canadell, J., Ehleringer, J. R., Mooney, H. A., Sala, O. +E., and Schulze, E. D. 1996. A global analysis of root distributions for +terrestrial biomes Oecologia 108:389–411. DOI:10.1007/BF00333714. + +Jackson, T.L., Feddema, J.J., Oleson, K.W., Bonan, G.B., and Bauer, J.T. +2010. Parameterization of urban characteristics for global climate +modeling. Annals of the Association of American Geographers. +100:848-865. + +Jenkinson, D. and Coleman, K. 2008. The turnover of organic carbon in +subsoils. Part 2. Modelling carbon turnover. European Journal of Soil +Science 59:400-413. + +Jordan, R. 1991. A One-dimensional Temperature Model for a Snow Cover: +Technical Documentation for SNTHERM.89. U.S. Army Cold Regions Research +and Engineering Laboratory, Special Report 91-16. + +Kattge, J., and Knorr, W. 2007. Temperature acclimation in a biochemical +model of photosynthesis: a reanalysis of data from 36 species. Plant +Cell Environ. 30:1176-1190. DOI:10.1111/j.1365-3040.2007.01690.x. + +Kattge, J., Knorr, W., Raddatz, T., and Wirth C. 2009: Quantifying +photosynthetic capacity and its relationship to leaf nitrogen content +for global–scale terrestrial biosphere models. Global Change Biol. +15:976–991. + +Keller, M., Palace, M., Asner, G.P., Pereira, R., Jr. and Silva, J.N.M., +2004. Coarse woody debris in undisturbed and logged forests in the +eastern Brazilian Amazon. Global Change Biology, 10: 784-795. + +Kellner, E., Baird, A.J., Oosterwoud, M., Harrison, K. and Waddington, +J.M., 2006. Effect of temperature and atmospheric pressure on methane +(CH4) ebullition from near-surface peats. Geophys. Res. Lett. 33. +DOI:10.1029/2006GL027509. + +Kimball, J.S., Thornton, P.E., White, M.A. and Running, S.W. 1997. +Simulating forest productivity and surface-atmosphere exchange in the +BOREAS study region. Tree Physiology 17:589-599. + +Kohyama, T., Suzuki, E., Partomihardjo, T., and Yamada, T. 2001. Dynamic +steady state of patch-mosaic tree size structure of a mixed diptocarp +forest regulated by local crowding. Ecological Research 16:85-98. + +Kourzeneva, E., 2009. Global dataset for the parameterization of lakes +in Numerical Weather Prediction and Climate modeling. ALADIN Newsletter, +No 37, July-December, 2009, F. Bouttier and C. Fischer, Eds., +Meteo-France, Toulouse, France, 46-53. + +Kourzeneva, E., 2010: External data for lake parameterization in +Numerical Weather Prediction and climate modeling. Boreal Environment +Research, 15, 165-177. + +Kourzeneva, E., Asensio, H., Martin, E. and Faroux, S., 2012. Global +gridded dataset of lake coverage and lake depth for use in numerical +weather prediction and climate modelling. Tellus A 64. + +Koven, C., et al. 2009. On the formation of high-latitude soil carbon +stocks: The effects of cryoturbation and insulation by organic matter in +a land surface model. Geophys. Res. Lett. 36: L21501. + +Koven, C.D., et al. 2011. Permafrost carbon-climate feedbacks accelerate +global warming. Proceedings of the National Academy of Sciences +108:14769-14774. + +Koven, C.D. et al. 2013. The effect of vertically-resolved soil +biogeochemistry and alternate soil C and N models on C dynamics of CLM4. +Biogeosciences Discussions 10:7201-7256. + +Kucharik, C.J., Foley, J.A., Delire, C., Fisher, V.A., Coe, M.T., +Lenters, J.D., Young-Molling, C., and Ramankutty, N. 2000. Testing the +performance of a dynamic global ecosystem model: water balance, carbon +balance, and vegetation structure. Global Biogeochem. Cycles 14: +795–825. + +Kucharik, C.J., and Brye, K.R. 2003. Integrated BIosphere Simulator +(IBIS) yield and nitrate loss predictions for Wisconsin maize receiving +varied amounts of nitrogen fertilizer. Journal of Environmental Quality +32: 247–268. + +Ladd, J.N., Jocteur-Monrozier, L. and Amato, M., 1992. Carbon turnover +and nitrogen transformations in an alfisol and vertisol amended with +[U-:math:`{}^{14}`\ C] glucose and [:math:`{}^{15}`\ N] ammonium +sulfate. Soil Biology and Biochemistry, 24: 359-371. + +Lamarque, J.-F., et al. 2010. Historical (1850-2000) gridded +anthropogenic and biomass burning emissions of reactive gases and +aerosols: methodology and application. Atmos. Chem. Phys. Discuss. +10:4963-5019. DOI:10.5194/acpd-10-4963-2010. + +Larcher, W. 1995. Physiological Plant Ecology, Springer-Verlag, Berlin +Heidelberg. + +Lavigne, M.B., and Ryan, M.G. 1997. Growth and maintenance respiration +rates of aspen, black spruce, and jack pine stems at northern and +southern BOREAS sites. Tree Phys. 17:543-551. + +Law, B.E., Sun, O.J., Campbell, J., Van Tuyl, S. and Thornton, P.E. +2003. Changes in carbon storage and fluxes in a chronosequence of +ponderosa pine. Global Change Biology, 9: 510-514. + +Lawrence, D.M., Thornton, P.E., Oleson, K.W., and Bonan, G.B. 2007. The +partitioning of evapotranspiration into transpiration, soil evaporation, +and canopy evaporation in a GCM: Impacts on land-atmosphere interaction. +J. Hydrometeor. 8:862-880. + +Lawrence, D.M., and Slater, A.G. 2008. Incorporating organic soil into a +global climate model. Clim. Dyn. 30. DOI:10.1007/s00382-007-0278-1. + +Lawrence, D.M., Slater, A.G., Romanovsky, V.E., and Nicolsky, D.J. 2008. +The sensitivity of a model projection of near-surface permafrost +degradation to soil column depth and inclusion of soil organic matter. +J. Geophys. Res. 113:F02011. DOI:10.1029/2007JF000883. + +Lawrence, D.M., K.W. Oleson, M.G. Flanner, P.E. Thornton, S.C. Swenson, +P.J. Lawrence, X. Zeng, Z.-L. Yang, S. Levis, K. Sakaguchi, G.B. Bonan, +and A.G. Slater, 2011. Parameterization improvements and functional and +structural advances in version 4 of the Community Land Model. J. Adv. +Model. Earth Sys. 3. DOI:10.1029/2011MS000045. + +Lawrence, P.J., and Chase, T.N. 2007. Representing a MODIS consistent +land surface in the Community Land Model (CLM 3.0). J. Geophys. Res. +112:G01023. DOI:10.1029/2006JG000168. + +Lawrence, P.J., and Chase, T.N. 2010. Investigating the climate impacts +of global land cover change in the Community Climate System Model. Int. +J. Climatol. 30:2066-2087. DOI:10.1002/joc.2061. + +Lawrence, P.J., et al. 2012. Simulating the biogeochemical and +biogeophysical impacts of transient land cover change and wood harvest +in the Community Climate System Model (CCSM4) from 1850 to 2100. J. +Climate 25:3071-3095. DOI:10.1175/JCLI-D-11-00256.1. + +Lehner, B. and Döll, P., 2004. Development and validation of a global +database of lakes, reservoirs and wetlands, J. Hydrol., 296, 1–22. + +Le Page, Y., van der Werf, G.R., Morton, D.C., and Pereira, J.M.C. 2010. +Modeling fire-driven deforestation potential in Amazonia under current +and projected climate conditions. J. Geophys. Res. 115:G03012. +DOI:10.1029/2009JG001190. + +Lerman, A., 1979. Geochemical processes: Water and sediment +environments. John Wiley and Sons, New York, N.Y. + +Letts, M.G., Roulet, N.T., Comer, N.T., Skarupa, M.R., and Verseghy, +D.L. 2000. Parametrization of peatland hydraulic properties for the +Canadian Land Surface Scheme. Atmos.-Ocean 38:141-160. + +Levin, I. and Kromer, B. 2004. The tropospheric 14CO2 level in +mid-latitudes of the Northern Hemisphere (1959-2003) Radiocarbon 46:1. + +Levis, S., Wiedinmyer, C., Bonan, G.B., and Guenther, A. 2003. +Simulating biogenic volatile organic compound emissions in the Community +Climate System Model. J. Geophys. Res. 108:4659. +DOI:10.1029/2002JD003203. + +Levis, S., Bonan, G.B., Vertenstein, M., and Oleson, K.W. 2004. The +community land model’s dynamic global vegetation model (CLM-DGVM): +technical description and user’s guide. NCAR Technical Note +NCAR/TN-459+STR. National Center for Atmospheric Research, Boulder, +Colorado. 50 pp. + +Levis, S., Thornton, P., Bonan, G., and Kucharik, C. 2009. Modeling land +use and land management with the Community Land Model. iLeaps +newsletter, No. 7. + +Levis, S., Bonan, G., Kluzek, E., Thornton, P., Jones, A., Sacks, W., +and Kucharik, C 2012. Interactive crop management in the Community Earth +System Model (CESM1): Seasonal influences on land-atmosphere fluxes. J. +Climate 25: 4839-4859. DOI:10.1175/JCLI-D-11-00446.1. + +Li, C., Aber, J., Stange, F., Butterbach-Bahl, K. and Papen, H. 2000. A +process-oriented model of N2O and NO emissions from forest soils: 1. +Model development. J. Geophys. Res. 105(D4):4369-4384. + +Li, F., Zeng, X.-D., and Levis, S. 2012a. A process-based fire +parameterization of intermediate complexity in a Dynamic Global +Vegetation Model. Biogeosciences 9:2761-2780. + +Li, F., Zeng, X. D., and Levis, S. 2012b. Corrigendum to “A +process-based fire parameterization of intermediate complexity in a +Dynamic Global Vegetation Model” published in Biogeosciences, 9, +2761–2780, 2012”. Biogeosciences 9: 4771-4772. + +Li, F., Levis, S., and Ward, D. S. 2013a. Quantifying the role of fire +in the Earth system – Part 1: Improved global fire modeling in the +Community Earth System Model (CESM1). Biogeosciences 10:2293-2314. + +Li, H.-Y., Huang, M., Tesfa, T., Ke, Y., Sun, Y., Liu, Y., and Leung, L. +R. 2013b. A subbasin-based framework to represent land surface processes +in an Earth System Model, Geosci. Model Dev. Discuss. 6:2699-2730. +DOI:10.5194/gmdd-6-2699-2013. + +Li, H., Huang, M., Wigmosta, M.S., Ke, Y., Coleman, A.M., Leung, L.R., +Wang, A., and Ricciuto, D.M. 2011. Evaluating runoff simulations from +the Community Land Model 4.0 using observations from flux towers and a +mountainous watershed. J. Geophys. Res. 116:D24120. +DOI:10.1029/2011JD016276. + +Liang, X., Lettenmaier, D.P., Wood, E.F., and Burges, S.J. 1994. A +simple hydrologically based model of land surface water and energy +fluxes for GSMs. J. Geophys. Res. 99(D7):14,415–14,428. + +Lipscomb, W., and Sacks, W. 2012. The CESM land ice model documentation +and user’s guide. 46 pp. [Available online at +http://www.cesm.ucar.edu/models/cesm1.1/cism/]. + +Lloyd, J. and Taylor, J.A., 1994. On the temperature dependence of soil +respiration. Functional Ecology, 8: 315-323. + +Lloyd, J., et al. 2010. Optimisation of photosynthetic carbon gain and +within-canopy gradients of associated foliar traits for Amazon forest +trees. Biogeosci. 7:1833-1859. DOI:10.5194/bg-7-1833-2010. + +Lobell, D.B., Bala, G., and Duffy, P.B. 2006. Biogeophysical impacts of +cropland management changes on climate. Geophys. Res. Lett. 33:L06708. +DOI:10.1029/2005GL025492. + +Loveland, T.R., Reed, B.C., Brown, J.F., Ohlen, D.O., Zhu, Z., Yang, L., +and Merchant, J.W. 2000. Development of a global land cover +characteristics database and IGBP DISCover from 1 km AVHRR data. Int. J. +Remote Sens. 21:1303-1330. + +Lowe, P.R. 1977. An approximating polynomial for the computation of +saturation vapor pressure. J. Appl. Meteor. 16:100-103. + +Luo, Y., Hui, D., and Zhang, D. 2006. Elevated CO2 stimulates net +accumulations of carbon and nitrogen in land ecosystems: a +meta-analysis. Ecology 87:53-63. + +Magill, A.H. et al., 1997. Biogeochemical response of forest ecosystems +to simulated chronic nitrogen deposition. Ecological Applications, 7: +402-415. + +Mahowald, N.M., Muhs, D.R., Levis, S., Rasch, P.J., Yoshioka, M., +Zender, C.S., and Luo, C. 2006. Change in atmospheric mineral aerosols +in response to climate: last glacial period, pre-industrial, modern and +doubled CO\ :math:`{}_{2}` climates. J. Geophys. Res\ *.* 111:D10202. +DOI:10.1029/2005JD006653. + +Makela, A. 2002. Derivation of stem taper from the pipe model theory in +a carbon balance framework. Tree Phys. 22:891-905. + +Manning, M.R. and Melhuish, W.H. 1994. Trends: A Compendium of Data on +Global Change. Carbon Dioxide Information Analysis Center,. Oak Ridge +National Laboratory, U.S. Department of Energy, Oak Ridge, Tenn., U.S.A. + +Mao, J., Thornton, P.E., Shi, X., Zhao, M., and Post, W.M. 2012. Remote +sensing evaluation of CLM4 GPP for the period 2000 to 2009. J. Climate +25:5327-5342. + +Mao, J., Shi, X., Thornton, P.E., Hoffman, F.M., Zhu, Z., and Ranga B. +Myneni, R.B. 2013. Global latitudinal-asymmetric vegetation growth +trends and their driving mechanisms: 1982-2009. Remote Sensing +5:1484-1497. + +Martin, J.P., Haider, K. and Kassim, G., 1980. Biodegradation and +stabilization after 2 years of specific crop, lignin, and polysaccharide +carbons in soils. Soil Science Society of America Journal 44:1250-1255. + +Mary, B., Fresneau, C., Morel, J.L. and Mariotti, A., 1993. C and N +cycling during decomposition of root mucilage, roots and glucose in +soil. Soil Biology and Biochemistry 25:1005-1014. + +McGuire, A.D., Melillo, J.M., Joyce, L.A., Kicklighter, D.W., Grace, +A.L., Moore III, B., and Vorosmarty, C.J. 1992. Interactions between +carbon and nitrogen dynamics in estimating net primary productivity for +potential vegetation in North America. Global Biogeochem. Cycles +6:101-124. + +Melzer, E., and O’Leary, M.H. 1987. Anapleurotic CO2 Fixation by +Phosphoenolpyruvate Carboxylase in C3 Plants. Plant. Physiol. 84:58. + +Miller, J.R., Russell, G.L., and Caliri, G. 1994. Continental-scale +river flow in climate models. J. Climate 7:914-928. + +Millington, R. and Quirk, J.P., 1961. Permeability of Porous Solids. +Transactions of the Faraday Society 57:1200-1207. + +Mironov, D. et al., 2010. Implementation of the lake parameterisation +scheme FLake into the numerical weather prediction model COSMO. Boreal +Environment Research 15:218-230. + +Mitchell, T.D., and Jones, P.D. 2005. An improved method of constructing +a database of monthly climate observations and associated +high-resolution grids. Int. J. Climatol. 25:693-712. + +Moldrup, P. et al. 2003. Modeling diffusion and reaction in soils: X. A +unifying model for solute and gas diffusivity in unsaturated soil. Soil +Science 168:321-337. + +Myneni, R.B., et al. 2002. Global products of vegetation leaf area and +fraction absorbed PAR from year one of MODIS data. Remote Sens. Environ. +83:214-231. + +Neff, J.C., Harden, J.W. and Gleixner, G. 2005. Fire effects on soil +organic matter content, composition, and nutrients in boreal interior +Alaska. Canadian Journal of Forest Research-Revue Canadienne De +Recherche Forestiere 35:2178-2187. + +Neitsch, S.L., Arnold, J.G., Kiniry, J.R., and Williams J.R. 2005. Soil +and Water Assessment Tool, Theoretical Documentation: Version 2005. +Temple, TX. USDA Agricultural Research Service and Texas A&M Blackland +Research Center. + +Nemani, R.R., and Running, S.W. 1996. Implementation of a hierarchical +global vegetation classification in ecosystem function models. J. Veg. +Sci. 7:337-346. + +Niinemets, U., Kull, O., and Tenhunen, J.D. 1998. An analysis of light +effects on foliar morphology, physiology, and light interception in +temperate deciduous woody species of contrasting shade tolerance. Tree +Phys. 18:681-696. + +Niu, G.-Y., Yang, Z.-L., Dickinson, R.E., and Gulden, L.E. 2005. A +simple TOPMODEL-based runoff parameterization (SIMTOP) for use in global +climate models. J. Geophys. Res. 110:D21106. DOI:10.1029/2005JD006111. + +Niu, G.-Y., and Yang, Z.-L. 2006. Effects of frozen soil on snowmelt +runoff and soil water storage at a continental scale. J. Hydrometeor. +7:937-952. + +Niu, G.-Y., Yang, Z.-L., Dickinson, R.E., Gulden, L.E., and Su, H. 2007. +Development of a simple groundwater model for use in climate models and +evaluation with Gravity Recovery and Climate Experiment data. J. +Geophys. Res. 112:D07103. DOI:10.1029/2006JD007522. + +Niu, G.-Y., and Yang, Z.-L. 2007. An observation-based formulation of +snow cover fraction and its evaluation over large North American river +basins. J. Geophys. Res. 112:D21101. DOI:10.1029/2007JD008674. + +Nydal, R. and Lövseth, K. 1996. Carbon-14 Measurements In Atmospheric +CO2 From Northern And Southern Hemisphere Sites, 1962-1993, Carbon +Dioxide Information Analysis Center. + +Oikawa, S., Hikosaka, K. and Hirose, T., 2005. Dynamics of leaf area and +nitrogen in the canopy of an annual herb, Xanthium canadense. Oecologia, +143: 517-526. + +Oke, T. 1987. Boundary Layer Climates (2:math:`{}^{nd}` edition). +Routledge, London and New York. + +Oleson, K.W., and Bonan, G.B. 2000. The effects of remotely-sensed plant +functional type and leaf area index on simulations of boreal forest +surface fluxes by the NCAR land surface model. J. Hydrometeor. +1:431-446. + +Oleson, K.W., Dai, Y., Bonan, G., Bosilovich, M., Dickinson, R., +Dirmeyer, P., Hoffman, F., Houser, P., Levis, S., Niu, G.-Y., Thornton, +P., Vertenstein, M., Yang, Z.-L., and Zeng. X. 2004. Technical +description of the Community Land Model (CLM). NCAR Technical Note +NCAR/TN-461+STR. National Center for Atmospheric Research, Boulder, +Colorado. 173 pp. + +Oleson, K.W., Niu, G.-Y., Yang, Z.-L., Lawrence, D.M., Thornton, P.E., +Lawrence, P.J., Stöckli, R., Dickinson, R.E., Bonan, G.B., Levis, S., +Dai, A., and Qian, T. 2008a. Improvements to the Community Land Model +and their impact on the hydrological cycle. J. Geophys. Res. 113:G01021. +DOI:10.1029/2007JG000563. + +Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Grimmond, +C.S.B. 2008b. An urban parameterization for a global climate model. 1. +Formulation and evaluation for two cities. J. Appl. Meteor. Clim. +47:1038-1060. + +Oleson, K.W., Bonan, G.B., Feddema, J., and Vertenstein, M. 2008c. An +urban parameterization for a global climate model. 2. Sensitivity to +input parameters and the simulated urban heat island in offline +simulations. J. Appl. Meteor. Clim. 47:1061-1076. + +Oleson, K.W., et al. 2010a. Technical description of version 4.0 of the +Community Land model (CLM). NCAR Technical Note NCAR/TN-478+STR, +National Center for Atmospheric Research, Boulder, CO, 257 pp. + +Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Kluzek, E. +2010b. Technical description of an urban parameterization for the +Community Land Model (CLMU). NCAR Technical Note NCAR/TN-480+STR, +National Center for Atmospheric Research, Boulder, CO, 169 pp. + +Olson, J.S., 1963. Energy storage and the balance of producers and +decomposers in ecological systems. Ecology 44:322-331. + +Olson, D.M., Dinerstein, E., Wikramanayake, E.D., Burgess, N.D., Powell, +G.V.N., Underwood, E.C., D’Amico, J.A., Itoua, I., Strand, H. E., +Morrison, J. C., Loucks, C. J., Allnutt, T. F., Ricketts, T. H., Kura, +Y., Lamoreux, J. F., Wettengel, W. W., Heda, P., and Kassem, K. R., +2001. Terrestrial ecoregions of the world a new map of life on earth, +Bioscience, 51, 933–938. + +Orchard, V.A. and Cook, F.J., 1983. Relationship between soil +respiration and soil moisture. Soil Biology and Biochemistry, 15: +447-453. + +Owen, P.R. 1964. Saltation of uniform grains in air. J. Fluid Mech\ *.* +20:225-242. + +Ozdogan, M., Rodell, M., Beaudoing, H.K., and Toll, D.L. 2010. +Simulating the effects of irrigation over the United States in a land +surface model based on satellite-derived agricultural data. Journal of +Hydrometeorology 11:171-184. + +Page, S.E., Siegert, F., Rieley, J.O., Boehm, H-D.V., Jaya, A., and +Limin, S. 2002. The amount of carbon released from peat and forest fires +in Indonesia in 1997. Nature 420:61-65. + +Panofsky, H.A., and Dutton, J.A. 1984. Atmospheric Turbulence: Models +and Methods for Engineering Applications. John Wiley and Sons, New York. + +Parton, W., Stewart, J. and Cole, C., 1988. Dynamics of C, N, P And S in +Grassland Soils - A Model. Biogeochemistry 5:109-131. + +Parton, W.J., et al. 1993. Observations and modeling of biomass and soil +organic matter dynamics for the grassland biome worlwide. Global +Biogeochemical Cycles 7:785-809. + +Parton, W. et al. 1996. Generalized model for N2 and N2O production from +nitrification and denitrification. Global Biogeochemical Cycles +10:401-412. + +Parton, W.J. et al. 2001. Generalized model for NOx and N2O emissions +from soils. J. Geophys. Res. 106(D15):17403-17419. + +Paterson, W.S.B., 1994. The Physics of Glaciers. Elsevier Science Inc., +New York, 480 pp. + +Petrescu, A.M.R. et al. 2010. Modeling regional to global CH4 emissions +of boreal and arctic wetlands. Global Biogeochemical Cycles, 24(GB4009). + +Philip, J.R. 1957. Evaporation, and moisture and heat fields in the +soil. J. Meteor. 14:354-366. + +Piao, S.L., et al. 2012. The carbon budget of terrestrial ecosystems in +East Asia over the last two decades. Biogeosciences 9:3571-3586. + +Pivovarov, A.A., 1972. Thermal Conditions in Freezing Lakes and +Reservoirs. John Wiley, New York. + +Pollmer, W.G., Eberhard, D., Klein, D., and Dhillon, B.S. 1979. Genetic +control of nitrogen uptake and translocation in maize. Crop Sci. +19:82-86. + +Portmann, F.T., Siebert, S., and Döll, P. 2010. MIRCA2000 - Global +monthly irrigated and rainfed crop areas around the year 2000: A new +high-resolution data set for agricultural and hydrological modeling. +Global Biogeochem. Cycles. 24, GB1011. DOI:10.1029/2008GB003435. + +Press, W.H., Teukolsky, S.A., Vetterling, W.T., and Flannery, B.P. 1992. +Numerical Recipes in FORTRAN: The Art of Scientific Computing. Cambridge +University Press, New York. + +Prigent, C., Papa, F., Aires, F., Rossow, W.B. and Matthews, E. 2007. +Global inundation dynamics inferred from multiple satellite +observations, 1993-2000. J. Geophys. Res. 112(D12). + +Pritchard, M.S., Bush, A.B.G., and Marshall, S.J. 2008. Neglecting +ice-atmosphere interactions underestimates ice sheet melt in +millennial-scale deglaciation simulations. Geophys. Res. Lett. ** +35:L01503. DOI:10.1029/2007GL031738. + +Qian, T., Dai, A., Trenberth, K.E., and Oleson, K.W. 2006. Simulation of +global land surface conditions from 1948 to 2004: Part I: Forcing data +and evaluations. J. Hydrometeor. 7:953-975. + +Ramankutty, N., and Foley, J. A., 1998. Characterizing patterns of +global land use: An analysis of global croplands data. Global +Biogeochemical Cycles, 12, 667-685. + +Ramankutty, N., Evan, A., Monfreda, C., and Foley, J.A. 2008. Farming +the Planet. Part 1: The Geographic Distribution of Global Agricultural +Lands in the Year 2000. Global Biogeochem. Cycles. 22:GB1003. +DOI:10.1029/2007GB002952. + +Randlett, D.L., Zak, D.R., Pregitzer, K.S., and Curtis, P.S. 1996. +Elevated atmospheric carbon dioxide and leaf litter chemistry: +Influences on microbial respiration and net nitrogen mineralization. +Soil Sci. Soc. Am. J. 60:1571-1577. + +Rastetter, E.B., Ryan, M.G., Shaver, G.R., Melillo, J.M., Nadelhoffer, +K.J., Hobbie, J.E., and Aber, J.D. 1991. A general biogeochemical model +describing the responses of the C and N cycles in terrestrial ecosystems +to changes in CO2, climate and N deposition. Tree Phys. 9:101-126. + +Rastner, P., Bolch, T., Mölg, N., Machguth, H., and Paul, F., 2012. The +first complete glacier inventory for the whole of Greenland, The +Cryosphere Discuss., 6, 2399-2436, 10.5194/tcd-6-2399-2012. + +Riley, W. J., Z. M. Subin, D. M. Lawrence, S. C. Swenson, M. S. Torn, L. +Meng, N. Mahowald, and P. Hess, 2011a. Barriers to predicting global +terrestrial methane fluxes: Analyses using a methane biogeochemistry +model integrated in CESM. Biogeosciences, 8, 1925–1953. +DOI:10.5194/bg-8-1925-2011. + +Riley, W.J. et al. 2011b. CLM4Me, a Methane Biogeochemistry Model +Integrated in CESM, Land and Biogeochemistry Model Working Group +Meeting, Boulder, CO. + +Ryan, M. G. 1991. A simple method for estimating gross carbon budgets +for vegetation in forest ecosystems. Tree Phys. 9:255-266. + +Running, S.W. and Coughlan, J.C., 1988. A general model of forest +ecosystem processes for regional applications. I. Hydrological balance, +canopy gas exchange and primary production processes. Ecological +Modelling, 42: 125-154. + +Running, S.W. et al., 1989. Mapping regional forest evapotranspiration +and photosynthesis by coupling satellite data with ecosystem simlation. +Ecology, 70: 1090-1101. + +Running, S.W. and Gower, S.T., 1991. FOREST BGC, A general model of +forest ecosystem processes for regional applications. II. Dynamic carbon +allocation and nitrogen budgets. Tree Physiology, 9: 147-160. + +Running, S.W. and Hunt, E.R., Jr., 1993. Generalization of a forest +ecosystem process model for other biomes, BIOME-BGC, and an +applicationfor global-scale models. In: J.R. Ehleringer and C. Field +(Editors), Scaling Physiological Processes: Leaf to Globe. Academic +Press, San Diego, CA, pp. 141-158. + +Sacks, W. J., Cook, B. I., Buenning, N., Levis, S., and Helkowski, J. H. +2009. Effects of global irrigation on the near-surface climate. Climate +Dyn., 33, 159–175. DOI:10.1007/s00382-008-0445-z. + +Saggar, S., Tate, K.R., Feltham, C.W., Childs, C.W. and Parshotam, A., +1994. Carbon turnover in a range of allophanic soils amended with +:math:`{}^{14}`\ C-labelled glucose. Soil Biology and Biochemistry, 26: +1263-1271. + +Sakaguchi, K., and Zeng, X. 2009. Effects of soil wetness, plant litter, +and under-canopy atmospheric stability on ground evaporation in the +Community Land Model (CLM3.5). J. Geophys. Res. 114:D01107. +DOI:10.1029/2008JD010834. + +Schaaf, C.B., Gao, F., Strahler, A.H., Lucht, W., Li, X., Tsang, T., +Strugnell, N.C., Zhang, X., Jin, Y., and Muller, J.-P. 2002. First +operational BRDF, albedo nadir reflectance products from MODIS. Remote +Sens. Environ. 83:135-148. + +Schlesinger, W.H., 1997. Biogeochemistry: an analysis of global change. +Academic Press, London, 588 pp. + +Schnell, S. and King, G.M., 1996. Responses of methanotrophic activity +in soils and cultures to water stress. Applied and Environmental +Microbiology 62:3203-3209. + +Segers, R., 1998. Methane production and methane consumption: a review +of processes underlying wetland methane fluxes. Biogeochemistry +41:23-51. + +Sellers, P.J. 1985. Canopy reflectance, photosynthesis and +transpiration. Int. J. Remote Sens. 6:1335-1372. + +Sellers, P.J., Mintz, Y., Sud, Y.C., and Dalcher, A. 1986. A simple +biosphere model (SiB) for use within general circulation models. J. +Atmos. Sci. 43:505-531. + +Sellers, P.J., Hall, F.G., Asrar, G., Strebel, D.E., and Murphy, R.E. +1988. The First ISLSCP Field Experiment (FIFE). Bull. Amer. Meteor. Soc. +69:22-27. + +Sellers, P.J., Berry, J.A., Collatz, G.J., Field, C.B., and Hall, F.G. +1992. Canopy reflectance, photosynthesis, and transpiration. III. A +reanalysis using improved leaf models and a new canopy integration +scheme. Remote Sens. Environ. 42:187-216. + +Sellers, P.J., et al. 1995. The Boreal Ecosystem-Atmosphere Study +(BOREAS): An overview and early results from the 1994 field year. Bull. +Amer. Meteor. Soc. 76:1549-1577. + +Sellers, P.J., Randall, D.A., Collatz, G.J., Berry, J.A., Field, C.B., +Dazlich, D.A., Zhang, C., Collelo, G.D., and Bounoua, L. 1996. A revised +land surface parameterization (SiB2) for atmospheric GCMs. Part I: Model +formulation. J. Climate 9:676-705. + +Shi, X., Mao, J., Thornton, P.E., and Huang, M. 2013. Spatiotemporal +patterns of evapotranspiration in response to multiple environmental +factors simulated by the Community Land Model. Environ. Res. Lett. +8:024012. + +Shiklomanov, I.A. 2000. Appraisal and assessment of world water +resources. Water International 25:11-32. + +Siebert, S., Döll, P., Hoogeveen, J., Faures, J.M., Frenken, K., Feick, +S., 2005. Development and validation of the global map of irrigation +areas. Hydrol Earth Syst Sc 9:535–547 + +Simpson, R.J., Lambers, H., and Dalling, M.J. 1983. Nitrogen +redistribution during grain growth in wheat (Triticum avestivum L.). +Plant Physiol. 71:7-14. + +Smith, A.M.S., Wooster, M.J., Drake, N.A., Dipotso, F.M. and Perry, +G.L.W., 2005. Fire in African savanna: Testing the impact of incomplete +combustion on pyrogenic emissions estimates. Ecological Applications, +15: 1074-1082. + +Sollins, P., 1982. Input and decay of coarse woody debris in coniferous +stands in western Oregon and Washington. Canadian Journal of Forest +Research, 12: 18-28. + +Son, Y. and Gower, S.T., 1991. Aboveground nitrogen and phosphorus use +by five plantation-grown trees with different leaf longevities. +Biogeochemistry, 14: 167-191. + +Sørensen, L.H., 1981. Carbon-nitrogen relationships during the +humification of cellulose in soils containing different amounts of clay. +Soil Biology and Biochemistry, 13: 313-321. + +Sprugel, D.G., Ryan, M.G., Brooks, J.R., Vogt, K.A., and Martin, T.A. +1995. Respiration from the organ level to stand level. pp. 255-299. In: +W. K. Smith and T. M. Hinkley (editors) Resource Physiology of Conifers. +Academic Press, San Diego,CA. + +Stauffer, D., and Aharony, A. 1994. Introduction to Percolation Theory. +Taylor and Francis, London. + +Still, C.J., Berry, J.A., Collatz, G.J., and DeFries, R.S. 2003. Global +distribution of C3 and C4 vegetation: carbon cycle implications. Global +Biogeochem. Cycles 17:1006. DOI:10.1029/2001GB001807. + +Stöckli, R., Lawrence, D.M., Niu, G.-Y., Oleson, K.W., Thornton, P.E., +Yang, Z.-L., Bonan, G.B., Denning, A.S., and Running, S.W. 2008. Use of +FLUXNET in the Community Land Model development. J. Geophys. Res. +113:G01025. DOI:10.1029/2007JG000562. + +Strack, M., Kellner, E. and Waddington, J.M., 2006. Effect of entrapped +gas on peatland surface level fluctuations. Hydrological Processes +20:3611-3622. + +Strahler, A.H., Muchoney, D., Borak, J., Friedl, M., Gopal, S., Lambin, +E., and Moody. A. 1999. MODIS Land Cover Product: Algorithm Theoretical +Basis Document (Version 5.0). Boston University, Boston. + +Stull, R.B. 1988. An Introduction to Boundary Layer Meteorology. Kluwer +Academic Publishers, Dordrecht. + +Subin, Z.M., Riley, W.J. and Mironov, D. 2012a. Improved lake model for +climate simulations, J. Adv. Model. Earth Syst., 4, M02001. +DOI:10.1029/2011MS000072. + +Subin, Z.M., Murphy, L.N., Li, F., Bonfils, C. and Riley, W.J., 2012b. +Boreal lakes moderate seasonal and diurnal temperature variation and +perturb atmospheric circulation: analyses in the Community Earth System +Model 1 (CESM1). Tellus A, North America, 64. + +Sun, Y., Gu, L., and Dickinson, R. E. 2012. A numerical issue in +calculating the coupled carbon and water fluxes in a climate model, J. +Geophys. Res., 117, D22103. DOI:10.1029/2012JD018059. + +Swenson, S.C., Lawrence, D.M., and Lee, H. 2012. Improved Simulation of +the Terrestrial Hydrological Cycle in Permafrost Regions by the +Community Land Model. JAMES, 4, M08002. DOI:10.1029/2012MS000165. + +Swenson, S.C. and Lawrence, D.M. 2012. A New Fractional Snow Covered +Area Parameterization for the Community Land Model and its Effect on the +Surface Energy Balance. JGR, 117, D21107. DOI:10.1029/2012JD018178. + +Ta, C.T. and Weiland, R.T. 1992. Nitrogen partitioning in maize during +ear development. Crop Sci. 32:443-451. + +Tang, J.Y. and Riley, W.J. 2013. A new top boundary condition for +modeling surface diffusive exchange of a generic volatile tracer: +Theoretical analysis and application to soil evaporation. Hydrol. Earth +Syst. Sci. 17:873-893. + +Tarnocai, C., Kettles, I. M., and Lacelle, B., 2011. Peatlands of +Canada, Geological Survey of Canada, Open File 6561, CD-ROM. +DOI:10.495/288786. + +Taylor, B.R., Parkinson, D. and Parsons, W.F.J., 1989. Nitrogen and +lignin content as predictors of litter decay rates: A microcosm test. +Ecology, 70: 97-104. + +Thonicke, K., Venevsky, S., Sitch, S., and Cramer, W. 2001. The role of +fire disturbance for global vegetation dynamics: coupling fire into a +Dynamic Global Vegetation Model. Global Ecology and Biogeography +10:661-667. + +Thornton, P.E., 1998. Regional ecosystem simulation: combining surface- +and satellite-based observations to study linkages between terrestrial +energy and mass budgets. Ph.D. Thesis, The University of Montana, +Missoula, 280 pp. + +Thornton, P.E., Law, B.E., Gholz, H.L., Clark, K.L., Falge, E., +Ellsworth, D.S., Goldstein, A.H., Monson, R.K., Hollinger, D., Falk, M., +Chen, J., and Sparks, J.P. 2002. Modeling and measuring the effects of +disturbance history and climate on carbon and water budgets in evergreen +needleleaf forests. Agric. For. Meteor. 113:185-222. + +Thornton, P.E., and Rosenbloom, N.A. 2005. Ecosystem model spin-up: +estimating steady state conditions in a coupled terrestrial carbon and +nitrogen cycle model. Ecological Modelling 189:25-48. + +Thornton, P.E., and Zimmermann, N.E. 2007. An improved canopy +integration scheme for a land surface model with prognostic canopy +structure. J. Climate 20:3902-3923. + +Thornton, P.E., Lamarque, J.-F., Rosenbloom, N.A., and Mahowald, N.M. +2007. Influence of carbon-nitrogen cycle coupling on land model response +to CO\ :math:`{}_{2}` fertilization and climate variability. Global +Biogeochem. Cycles 21:GB4018. + +Thornton, P.E., Doney, S.C., Lindsay, K., Moore, J.K., Mahowald, N., +Randerson, J.T., Fung, I., Lamarque, J.F., Feddema, J.J., and Lee, Y.H. +2009. Carbon-nitrogen interactions regulate climate-carbon cycle +feedbacks: results from an atmosphere-ocean general circulation model. +Biogeosci. 6:2099-2120. + +Tian, H. et al. 2010. Spatial and temporal patterns of CH4 and N2O +fluxes in terrestrial ecosystems of North America during 1979-2008: +application of a global biogeochemistry model. Biogeosciences +7:2673-2694. + +Toon, O.B., McKay, C.P., Ackerman, T.P., and Santhanam, K. 1989. Rapid +calculation of radiative heating rates and photodissociation rates in +inhomogeneous multiple scattering atmospheres. J. Geophys. Res. +94(D13):16,287-16,301. + +Turetsky, M.R., Wieder, R.K., Halsey, L.A., and Vitt, D.H. 2002. Current +disturbance and the diminishing peatland carbon sink. Geophys. Res. +Lett. 29:1526. DOI:10.1029/2001GL014000. + +Turetsky, M.R., Amiro, B.D., Bosch, E., andBhatti, J.S. 2004. Historical +burn area in western Canadian peatlands and its relationship to fire +weather indices. Global Biogeochem. Cycles 18:GB4014. +DOI:10.1029/2004GB002222. + +Turnbull, J.C. et al. 2007. A new high precision (CO2)-C-14 time series +for North American continental air. Journal of Geophysical +Research-Atmospheres 112(D11). + +Tye, A.M., et al. 2005. The fate of N-15 added to high Arctic tundra to +mimic increased inputs of atmospheric nitrogen released from a melting +snowpack. Global Change Biology 11:1640-1654. + +Unland, H.E., Houser, P.R., Shuttleworth, W.J., and Yang, Z.-L. 1996. +Surface flux measurement and modeling at a semi-arid Sonoran Desert +site. Agric. For. Meteor. 82:119-153. + +UNSTAT, 2005. National Accounts Main Aggregates Database, United Nations +Statistics Division. + +Vallano, D.M. and Sparks, J.P. 2007. Quantifying foliar uptake of +gaseous itrogen dioxide using enriched foliar +:math:`\deltaup`\ :math:`{}^{15 }`\ N values. New Phytologist +177:946-955. + +van der Werf, G.R., Randerson, J.T., Giglio, L., Collatz, G.J., Mu, M., +Kasibhatla, S.P., Morton, D.C., DeFries, R.S., Jin, Y., van Leeuwen, +T.T. 2010. Global fire emissions and the contribution of deforestation, +savanna, forest, agricultural, and peat fires (1997-2009) Atmos. Chem. +Phys. 10:11707-11735. + +van Veen, J.A., Ladd, J.N. and Frissel, M.J., 1984. Modelling C and N +turnover through the microbial biomass in soil. Plant and Soil, 76: +257-274. + +Van Vuuren, D.P., Lucas, P.S., and Hilderink, H.B.M., 2006. Downscaling +drivers of global environmental change: enabling use of global SRES +scenarios at the national and grid levels, Report 550025001, Netherlands +Environmental Assessment Agency, 45 pp. + +Vanninen, P., and Makela, A. 2005. Carbon budget for Scots pine trees: +effects of size, competition and site fertility on growth allocation and +production. Tree Phys. 25:17-30. + +Verdin, K. L., and S. K. Greenlee, 1996. Development of continental +scale digital elevation models and extraction of hydrographic features, +paper presented at the Third International Conference/Workshop on +Integrating GIS and Environmental Modeling, Santa Fe, New Mexico, 21–26 +January, Natl. Cent. for Geogr. Inf. and Anal., Santa Barbara, Calif. + +Viovy, N. 2011. CRUNCEP dataset. [Description available at +http://dods.extra.cea.fr/data/p529viov/cruncep/readme.htm. Data +available at +http://dods.extra.cea.fr/store/p529viov/cruncep/V4\_1901\_2011/]. + +Vitousek, P.M., and Howarth, R.W. 1991. Nitrogen limitation on land and +in the sea: How can it occur? Biogeochem. 13:87-115. + +Walter, B.P., Heimann, M. and Matthews, E., 2001. Modeling modern +methane emissions from natural wetlands 1. Model description and +results. J. Geophys. Res. 106(D24):34189-34206. + +Wania, R., Ross, I. and Prentice, I.C. 2009. Integrating peatlands and +permafrost into a dynamic global vegetation model: 2. Evaluation and +sensitivity of vegetation and carbon cycle processes. Global Biogeochem. +Cycles 23. + +Wania, R., Ross, I. and Prentice, I.C. 2010. Implementation and +evaluation of a new methane model within a dynamic global vegetation +model LPJ-WHyMe v1.3. Geoscientific Model Development Discussions +3:1-59. + +Wang, A., and Zeng, X. 2009. Improving the treatment of vertical snow +burial fraction over short vegetation in the NCAR CLM3. Adv. Atmos. Sci. +26:877-886. DOI:10.1007/s00376-009-8098-3. + +White, M.A., Thornton, P.E., and Running, S.W. 1997. A continental +phenology model for monitoring vegetation responses to interannual +climatic variability. Global Biogeochem. Cycles 11:217-234. + +White, M.A., Thornton, P.E., Running, S.W., and Nemani, R.R. 2000. +Parameterization and sensitivity analysis of the Biome-BGC terrestrial +ecosystem model: net primary production controls. Earth Interactions +4:1-85. + +Wiscombe, W.J., and Warren, S.G. 1980. A model for the spectral albedo +of snow. I. Pure snow. J. Atmos. Sci. 37:2712-2733. + +Wood, E.F., Lettenmaier, D.P., and Zartarian, V.G. 1992. A land-surface +hydrology parameterization with subgrid variability for general +circulation models. J. Geophys. Res. 97(D3):2717–2728. +DOI:10.1029/91JD01786. + +World Bank, 2004. World development indicators 2004, Oxford University +Press, New York, 416 pp. + +Yang, Z.-L. 1998. Technical note of a 10-layer soil moisture and +temperature model. Unpublished manuscript. + +Zender, C.S., Bian, H., and Newman, D. 2003. Mineral dust entrainment +and deposition (DEAD) model: Description and 1990s dust climatology. ** +J. Geophys. Res\ *.* 108(D14):4416. DOI:10.1029/2002JD002775. + +Zeng, X., and Dickinson, R.E. 1998. Effect of surface sublayer on +surface skin temperature and fluxes. J.Climate 11:537-550. + +Zeng, X., Zhao, M., and Dickinson, R.E. 1998. Intercomparison of bulk +aerodynamic algorithms for the computation of sea surface fluxes using +the TOGA COARE and TAO data. J. Climate 11:2628-2644. + +Zeng, X. 2001. Global vegetation root distribution for land modeling. J. +Hydrometeor. 2:525-530. + +Zeng, X., Shaikh, M., Dai, Y., Dickinson, R.E., and Myneni, R. 2002. +Coupling of the Common Land Model to the NCAR Community Climate Model. +J. Climate 15:1832-1854. + +Zeng, X., Dickinson, R.E., Barlage, M., Dai, Y., Wang, G., and Oleson, +K. 2005. Treatment of under-canopy turbulence in land models. J. Climate +18:5086-5094. + +Zeng, X., and Wang, A. 2007. Consistent parameterization of roughness +length and displacement height for sparse and dense canopies in land +models. J. Hydrometeor. 8:730-737. + +Zeng, X., and Decker, M. 2009. Improving the numerical solution of soil +moisture-based Richards equation for land models with a deep or shallow +water table. J. Hydrometeor. 10:308-319. + +Zeng, X., Zeng, X., and Barlage, M. 2008. Growing temperate shrubs over +arid and semiarid regions in the Community Land Model - Dynamic Global +Vegetation Model. Global Biogeochem. Cycles 22:GB3003. +DOI:10.1029/2007GB003014. + +Zhang, Y., Li, C.S., Trettin, C.C., Li, H. and Sun, G., 2002. An +integrated model of soil, hydrology, and vegetation for carbon dynamics +in wetland ecosystems. Global Biogeochemical Cycles 16. +DOI:10.1029/2001GB001838. + +Zhuang, Q., et al. 2004. Methane fluxes between terrestrial ecosystems +and the atmosphere at northern high latitudes during the past century: A +retrospective analysis with a process-based biogeochemistry model. +Global Biogeochemical Cycles 18. DOI:10.1029/2004GB002239. + +Zilitinkevich, S.S. 1970. Dynamics of the Atmospheric Boundary Layer. +Leningrad Gidrometeor. diff --git a/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst b/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst new file mode 100644 index 0000000000..cc47ceedf1 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst @@ -0,0 +1,1137 @@ +Surface Albedos +================== + +Canopy Radiative Transfer +----------------------------- + +Radiative transfer within vegetative canopies is calculated from the +two-stream approximation of Dickinson (1983) and Sellers (1985) as +described by Bonan (1996) + +.. math:: + :label: 3.1 + + -\bar{\mu }\frac{dI\, \uparrow }{d\left(L+S\right)} +\left[1-\left(1-\beta \right)\omega \right]I\, \uparrow -\omega \beta I\, \downarrow =\omega \bar{\mu }K\beta _{0} e^{-K\left(L+S\right)} + +.. math:: + :label: 3.2 + + \bar{\mu }\frac{dI\, \downarrow }{d\left(L+S\right)} +\left[1-\left(1-\beta \right)\omega \right]I\, \downarrow -\omega \beta I\, \uparrow =\omega \bar{\mu }K\left(1-\beta _{0} \right)e^{-K\left(L+S\right)} + +where :math:`I\, \uparrow` and :math:`I\, \downarrow` are the upward +and downward diffuse radiative fluxes per unit incident flux, +:math:`K={G\left(\mu \right)\mathord{\left/ {\vphantom {G\left(\mu \right) \mu }} \right. \kern-\nulldelimiterspace} \mu }` +is the optical depth of direct beam per unit leaf and stem area, +:math:`\mu` is the cosine of the zenith angle of the incident beam, +:math:`G\left(\mu \right)` is the relative projected area of leaf and +stem elements in the direction :math:`\cos ^{-1} \mu` , +:math:`\bar{\mu }` is the average inverse diffuse optical depth per unit +leaf and stem area, :math:`\omega` is a scattering coefficient, +:math:`\beta` and :math:`\beta _{0}` are upscatter parameters for +diffuse and direct beam radiation, respectively, :math:`L` is the +exposed leaf area index (section 2.1.4), and :math:`S` is the exposed +stem area index (section 2.1.4). Given the direct beam albedo +:math:`\alpha _{g,\, \Lambda }^{\mu }` and diffuse albedo +:math:`\alpha _{g,\, \Lambda }` of the ground (section 3.2), these +equations are solved to calculate the fluxes, per unit incident flux, +absorbed by the vegetation, reflected by the vegetation, and transmitted +through the vegetation for direct and diffuse radiation and for visible +(:math:`<` 0.7\ :math:`\mu {\rm m}`) and near-infrared +(:math:`ge` 0.7\ :math:`\mu {\rm m}`) wavebands. The absorbed +radiation is partitioned to sunlit and shaded fractions of the canopy. +The optical parameters :math:`G\left(\mu \right)`, :math:`\bar{\mu }`, +:math:`\omega`, :math:`\beta`, and :math:`\beta _{0}` are calculated +based on work in Sellers (1985) as follows. + +The relative projected area of leaves and stems in the direction +:math:`\cos ^{-1} \mu` is + +.. math:: + :label: 3.3 + + G\left(\mu \right)=\phi _{1} +\phi _{2} \mu + +where :math:`\phi _{1} ={\rm 0.5}-0.633\chi _{L} -0.33\chi _{L}^{2}` +and :math:`\phi _{2} =0.877\left(1-2\phi _{1} \right)` for +:math:`-0.4\le \chi _{L} \le 0.6`. :math:`\chi _{L}` is the departure +of leaf angles from a random distribution and equals +1 for horizontal +leaves, 0 for random leaves, and –1 for vertical leaves. + +The average inverse diffuse optical depth per unit leaf and stem area is + +.. math:: + :label: 3.4 + + \bar{\mu }=\int _{0}^{1}\frac{\mu '}{G\left(\mu '\right)} d\mu '=\frac{1}{\phi _{2} } \left[1-\frac{\phi _{1} }{\phi _{2} } \ln \left(\frac{\phi _{1} +\phi _{2} }{\phi _{1} } \right)\right] + +where :math:`\mu '` is the direction of the scattered flux. + +The optical parameters :math:`\omega` , :math:`\beta` , and +:math:`\beta _{0}` , which vary with wavelength (:math:`\Lambda` ), are +weighted combinations of values for vegetation and snow. The model +determines that snow is on the canopy if :math:`T_{v} \le T_{f}` , where +:math:`T_{v}` is the vegetation temperature (K) (Chapter 5) and +:math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). In +this case, the optical parameters are + +.. math:: + :label: 3.5 + + \omega _{\Lambda } =\omega _{\Lambda }^{veg} \left(1-f_{wet} \right)+\omega _{\Lambda }^{sno} f_{wet} + +.. math:: + :label: 3.6 + + \omega _{\Lambda } \beta _{\Lambda } =\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} \left(1-f_{wet} \right)+\omega _{\Lambda }^{sno} \beta _{\Lambda }^{sno} f_{wet} + +.. math:: + :label: 3.7 + + \omega _{\Lambda } \beta _{0,\, \Lambda } =\omega _{\Lambda }^{veg} \beta _{0,\, \Lambda }^{veg} \left(1-f_{wet} \right)+\omega _{\Lambda }^{sno} \beta _{0,\, \Lambda }^{sno} f_{wet} + +where :math:`f_{wet}` is the wetted fraction of the canopy (section +7.1). The snow and vegetation weights are applied to the products +:math:`\omega _{\Lambda } \beta _{\Lambda }` and +:math:`\omega _{\Lambda } \beta _{0,\, \Lambda }` because these +products are used in the two-stream equations. If there is no snow on +the canopy, + +.. math:: + :label: 3.8 + + \omega _{\Lambda } =\omega _{\Lambda }^{veg} + +.. math:: + :label: 3.9 + + \omega _{\Lambda } \beta _{\Lambda } =\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} + +.. math:: + :label: 3.10 + + \omega _{\Lambda } \beta _{0,\, \Lambda } =\omega _{\Lambda }^{veg} \beta _{0,\, \Lambda }^{veg} . + +For vegetation, +:math:`\omega _{\Lambda }^{veg} =\alpha _{\Lambda } +\tau _{\Lambda }` . +:math:`\alpha _{\Lambda }` is a weighted combination of the leaf and +stem reflectances +(:math:`\alpha _{\Lambda }^{leaf} ,\alpha _{\Lambda }^{stem}` ) + +.. math:: + :label: 3.11 + + \alpha _{\Lambda } =\alpha _{\Lambda }^{leaf} w_{leaf} +\alpha _{\Lambda }^{stem} w_{stem} + +where +:math:`w_{leaf} ={L\mathord{\left/ {\vphantom {L \left(L+S\right)}} \right. \kern-\nulldelimiterspace} \left(L+S\right)}` +and +:math:`w_{stem} ={S\mathord{\left/ {\vphantom {S \left(L+S\right)}} \right. \kern-\nulldelimiterspace} \left(L+S\right)}` . +:math:`\tau _{\Lambda }` is a weighted combination of the leaf and stem transmittances (:math:`\tau _{\Lambda }^{leaf}, \tau _{\Lambda }^{stem}`) + +.. math:: + :label: 3.12 + + \tau _{\Lambda } =\tau _{\Lambda }^{leaf} w_{leaf} +\tau _{\Lambda }^{stem} w_{stem} . + +The upscatter for diffuse radiation is + +.. math:: + :label: ZEqnNum472968 + + \omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} =\frac{1}{2} \left[\alpha _{\Lambda } +\tau _{\Lambda } +\left(\alpha _{\Lambda } -\tau _{\Lambda } \right)\cos ^{2} \bar{\theta }\right] + +where :math:`\bar{\theta }` is the mean leaf inclination angle relative +to the horizontal plane (i.e., the angle between leaf normal and local +vertical) (Sellers 1985). Here, :math:`\cos \bar{\theta }` is +approximated by + +.. math:: + :label: ZEqnNum720349 + + \cos \bar{\theta }=\frac{1+\chi _{L} }{2} + +Using this approximation, for vertical leaves (:math:`\chi _{L} =-1`, +:math:`\bar{\theta }=90^{{\rm o}}` ), +:math:`\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} =0.5\left(\alpha _{\Lambda } +\tau _{\Lambda } \right)`, +and for horizontal leaves (:math:`\chi _{L} =1`, +:math:`\bar{\theta }=0^{{\rm o}}` ) , +:math:`\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} =\alpha _{\Lambda }` , +which agree with both Dickinson (1983) and Sellers (1985). For random +(spherically distributed) leaves (:math:`\chi _{L} =0`, +:math:`\bar{\theta }=60^{{\rm o}}` ), the approximation yields +:math:`\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} ={5\mathord{\left/ {\vphantom {5 8}} \right. \kern-\nulldelimiterspace} 8} \alpha _{\Lambda } +{3\mathord{\left/ {\vphantom {3 8}} \right. \kern-\nulldelimiterspace} 8} \tau _{\Lambda }` +whereas the approximate solution of Dickinson (1983) is +:math:`\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} ={2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} \alpha _{\Lambda } +{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} \tau _{\Lambda }` . +This discrepancy arises from the fact that a spherical leaf angle +distribution has a true mean leaf inclination +:math:`\bar{\theta }\approx 57` (Campbell and Norman 1998) in equation , +while :math:`\bar{\theta }=60` in equation . The upscatter for direct +beam radiation is + +.. math:: + :label: 3.15 + + \omega _{\Lambda }^{veg} \beta _{0,\, \Lambda }^{veg} =\frac{1+\bar{\mu }K}{\bar{\mu }K} a_{s} \left(\mu \right)_{\Lambda } + +where the single scattering albedo is + +.. math:: + :label: 3.16 + + \begin{array}{rcl} {a_{s} \left(\mu \right)_{\Lambda } } & {=} & {\frac{\omega _{\Lambda }^{veg} }{2} \int _{0}^{1}\frac{\mu 'G\left(\mu \right)}{\mu G\left(\mu '\right)+\mu 'G\left(\mu \right)} d\mu '} \\ {} & {=} & {\frac{\omega _{\Lambda }^{veg} }{2} \frac{G\left(\mu \right)}{\mu \phi _{2} +G\left(\mu \right)} \left[1-\frac{\mu \phi _{1} }{\mu \phi _{2} +G\left(\mu \right)} \ln \left(\frac{\mu \phi _{1} +\mu \phi _{2} +G\left(\mu \right)}{\mu \phi _{1} } \right)\right].} \end{array} + +The upward diffuse fluxes per unit incident direct beam and diffuse flux +(i.e., the surface albedos) are + +.. math:: + :label: 3.17 + + I\, \uparrow _{\Lambda }^{\mu } =\frac{h_{1} }{\sigma } +h_{2} +h_{3} + +.. math:: + :label: 3.18 + + I\, \uparrow _{\Lambda } =h_{7} +h_{8} . + +The downward diffuse fluxes per unit incident direct beam and diffuse +radiation, respectively, are + +.. math:: + :label: 3.19 + + I\, \downarrow _{\Lambda }^{\mu } =\frac{h_{4} }{\sigma } e^{-K\left(L+S\right)} +h_{5} s_{1} +\frac{h_{6} }{s_{1} } + +.. math:: + :label: 3.20 + + I\, \downarrow _{\Lambda } =h_{9} s_{1} +\frac{h_{10} }{s_{1} } . + +With reference to Figure 4.1, the direct beam flux transmitted through +the canopy, per unit incident flux, is :math:`e^{-K\left(L+S\right)}` , +and the direct beam and diffuse fluxes absorbed by the vegetation, per +unit incident flux, are + +.. math:: + :label: 3.21 + + \vec{I}_{\Lambda }^{\mu } =1-I\, \uparrow _{\Lambda }^{\mu } -\left(1-\alpha _{g,\, \Lambda } \right)I\, \downarrow _{\Lambda }^{\mu } -\left(1-\alpha _{g,\, \Lambda }^{\mu } \right)e^{-K\left(L+S\right)} + +.. math:: + :label: 3.22 + + \vec{I}_{\Lambda } =1-I\, \uparrow _{\Lambda } -\left(1-\alpha _{g,\, \Lambda } \right)I\, \downarrow _{\Lambda } . + +These fluxes are partitioned to the sunlit and shaded canopy using an +analytical solution to the two-stream approximation for sunlit and +shaded leaves (Dai et al. 2004), as described by Bonan et al. (2011). +The absorption of direct beam radiation by sunlit leaves is + +.. math:: + :label: 3.23 + + \vec{I}_{sun,\Lambda }^{\mu } =\left(1-\omega _{\Lambda } \right)\left[1-s_{2} +\frac{1}{\bar{\mu }} \left(a_{1} +a_{2} \right)\right] + +and for shaded leaves is + +.. math:: + :label: 3.24 + + \vec{I}_{sha,\Lambda }^{\mu } =\vec{I}_{\Lambda }^{\mu } -\vec{I}_{sun,\Lambda }^{\mu } + +with + +.. math:: + :label: 3.25 + + a_{1} =\frac{h_{1} }{\sigma } \left[\frac{1-s_{2}^{2} }{2K} \right]+h_{2} \left[\frac{1-s_{2} s_{1} }{K+h} \right]+h_{3} \left[\frac{1-{s_{2} \mathord{\left/ {\vphantom {s_{2} s_{1} }} \right. \kern-\nulldelimiterspace} s_{1} } }{K-h} \right] + +.. math:: + :label: 3.26 + + a_{2} =\frac{h_{4} }{\sigma } \left[\frac{1-s_{2}^{2} }{2K} \right]+h_{5} \left[\frac{1-s_{2} s_{1} }{K+h} \right]+h_{6} \left[\frac{1-{s_{2} \mathord{\left/ {\vphantom {s_{2} s_{1} }} \right. \kern-\nulldelimiterspace} s_{1} } }{K-h} \right]. + +For diffuse radiation, the absorbed radiation for sunlit leaves is + +.. math:: + :label: 3.27 + + \vec{I}_{sun,\Lambda }^{} =\left[\frac{1-\omega _{\Lambda } }{\bar{\mu }} \right]\left(a_{1} +a_{2} \right) + +and for shaded leaves is + +.. math:: + :label: 3.28 + + \vec{I}_{sha,\Lambda }^{} =\vec{I}_{\Lambda }^{} -\vec{I}_{sun,\Lambda }^{} + +with + +.. math:: + :label: 3.29 + + a_{1} =h_{7} \left[\frac{1-s_{2} s_{1} }{K+h} \right]+h_{8} \left[\frac{1-{s_{2} \mathord{\left/ {\vphantom {s_{2} s_{1} }} \right. \kern-\nulldelimiterspace} s_{1} } }{K-h} \right] + +.. math:: + :label: 3.30 + + a_{2} =h_{9} \left[\frac{1-s_{2} s_{1} }{K+h} \right]+h_{10} \left[\frac{1-{s_{2} \mathord{\left/ {\vphantom {s_{2} s_{1} }} \right. \kern-\nulldelimiterspace} s_{1} } }{K-h} \right]. + +The parameters :math:`h_{1}` –:math:`h_{10}` , :math:`\sigma` , +:math:`h`, :math:`s_{1}` , and :math:`s_{2}` are from Sellers (1985) +[note the error in :math:`h_{4}` in Sellers (1985)]: + +.. math:: + :label: 3.31 + + b=1-\omega _{\Lambda } +\omega _{\Lambda } \beta _{\Lambda } + +.. math:: + :label: 3.32 + + c=\omega _{\Lambda } \beta _{\Lambda } + +.. math:: + :label: 3.33 + + d=\omega _{\Lambda } \bar{\mu }K\beta _{0,\, \Lambda } + +.. math:: + :label: 3.34 + + f=\omega _{\Lambda } \bar{\mu }K\left(1-\beta _{0,\, \Lambda } \right) + +.. math:: + :label: 3.35 + + h=\frac{\sqrt{b^{2} -c^{2} } }{\bar{\mu }} + +.. math:: + :label: 3.36 + + \sigma =\left(\bar{\mu }K\right)^{2} +c^{2} -b^{2} + +.. math:: + :label: 3.37 + + u_{1} =b-{c\mathord{\left/ {\vphantom {c \alpha _{g,\, \Lambda }^{\mu } }} \right. \kern-\nulldelimiterspace} \alpha _{g,\, \Lambda }^{\mu } } {\rm \; or\; }u_{1} =b-{c\mathord{\left/ {\vphantom {c \alpha _{g,\, \Lambda } }} \right. \kern-\nulldelimiterspace} \alpha _{g,\, \Lambda } } + +.. math:: + :label: 3.38 + + u_{2} =b-c\alpha _{g,\, \Lambda }^{\mu } {\rm \; or\; }u_{2} =b-c\alpha _{g,\, \Lambda } + +.. math:: + :label: 3.39 + + u_{3} =f+c\alpha _{g,\, \Lambda }^{\mu } {\rm \; or\; }u_{3} =f+c\alpha _{g,\, \Lambda } + +.. math:: + :label: 3.40 + + s_{1} =\exp \left\{-\min \left[h\left(L+S\right),40\right]\right\} + +.. math:: + :label: 3.41 + + s_{2} =\exp \left\{-\min \left[K\left(L+S\right),40\right]\right\} + +.. math:: + :label: 3.42 + + p_{1} =b+\bar{\mu }h + +.. math:: + :label: 3.43 + + p_{2} =b-\bar{\mu }h + +.. math:: + :label: 3.44 + + p_{3} =b+\bar{\mu }K + +.. math:: + :label: 3.45 + + p_{4} =b-\bar{\mu }K + +.. math:: + :label: 3.46 + + d_{1} =\frac{p_{1} \left(u_{1} -\bar{\mu }h\right)}{s_{1} } -p_{2} \left(u_{1} +\bar{\mu }h\right)s_{1} + +.. math:: + :label: 3.47 + + d_{2} =\frac{u_{2} +\bar{\mu }h}{s_{1} } -\left(u_{2} -\bar{\mu }h\right)s_{1} + +.. math:: + :label: 3.48 + + h_{1} =-dp_{4} -cf + +.. math:: + :label: 3.49 + + h_{2} =\frac{1}{d_{1} } \left[\left(d-\frac{h_{1} }{\sigma } p_{3} \right)\frac{\left(u_{1} -\bar{\mu }h\right)}{s_{1} } -p_{2} \left(d-c-\frac{h_{1} }{\sigma } \left(u_{1} +\bar{\mu }K\right)\right)s_{2} \right] + +.. math:: + :label: 3.50 + + h_{3} =\frac{-1}{d_{1} } \left[\left(d-\frac{h_{1} }{\sigma } p_{3} \right)\left(u_{1} +\bar{\mu }h\right)s_{1} -p_{1} \left(d-c-\frac{h_{1} }{\sigma } \left(u_{1} +\bar{\mu }K\right)\right)s_{2} \right] + +.. math:: + :label: 3.51 + + h_{4} =-fp_{3} -cd + +.. math:: + :label: 3.52 + + h_{5} =\frac{-1}{d_{2} } \left[\left(\frac{h_{4} \left(u_{2} +\bar{\mu }h\right)}{\sigma s_{1} } \right)+\left(u_{3} -\frac{h_{4} }{\sigma } \left(u_{2} -\bar{\mu }K\right)\right)s_{2} \right] + +.. math:: + :label: 3.53 + + h_{6} =\frac{1}{d_{2} } \left[\frac{h_{4} }{\sigma } \left(u_{2} -\bar{\mu }h\right)s_{1} +\left(u_{3} -\frac{h_{4} }{\sigma } \left(u_{2} -\bar{\mu }K\right)\right)s_{2} \right] + +.. math:: + :label: 3.54 + + h_{7} =\frac{c\left(u_{1} -\bar{\mu }h\right)}{d_{1} s_{1} } + +.. math:: + :label: 3.55 + + h_{8} =\frac{-c\left(u_{1} +\bar{\mu }h\right)s_{1} }{d_{1} } + +.. math:: + :label: 3.56 + + h_{9} =\frac{u_{2} +\bar{\mu }h}{d_{2} s_{1} } + +.. math:: + :label: 3.57 + + h_{10} =\frac{-s_{1} \left(u_{2} -\bar{\mu }h\right)}{d_{2} } . + +Plant functional type optical properties (Table 3.1) for trees and +shrubs are from Dorman and Sellers (1989). Leaf and stem optical +properties (placeVIS and NIR reflectance and transmittance) were derived +for grasslands and crops from full optical range spectra of measured +optical properties (Asner et al. 1998). Optical properties for +intercepted snow (Table 3.2) are from Sellers et al. (1986). + +Table 3.1. Plant functional type optical properties + ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Plant Functional Type | :math:`\chi _{L}` | :math:`\alpha _{vis}^{leaf}` | :math:`\alpha _{nir}^{leaf}` | :math:`\alpha _{vis}^{stem}` | :math:`\alpha _{nir}^{stem}` | :math:`\tau _{vis}^{leaf}` | :math:`\tau _{nir}^{leaf}` | :math:`\tau _{vis}^{stem}` | :math:`\tau _{nir}^{stem}` | ++==================================+======================+=================================+=================================+=================================+=================================+===============================+===============================+===============================+===============================+ +| NET Temperate | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| NET Boreal | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| NDT Boreal | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| BET Tropical | 0.10 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| BET temperate | 0.10 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| BDT tropical | 0.01 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| BDT temperate | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| BDT boreal | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| BES temperate | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| BDS temperate | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| BDS boreal | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| C\ :math:`{}_{3}` arctic grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| C\ :math:`{}_{3}` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| C\ :math:`{}_{4}` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Crop R | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Crop I | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Corn R | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Corn I | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Temp Cereal R | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Temp Cereal I | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Winter Cereal R | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Winter Cereal I | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Soybean R | -0.5 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ +| Soybean I | -0.5 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | ++----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + +Table 3.2. Intercepted snow optical properties + ++-----------------------------+-------+-------+ +| Parameter | vis | nir | ++-----------------------------+-------+-------+ +| :math:`\omega ^{sno}` | 0.8 | 0.4 | ++-----------------------------+-------+-------+ +| :math:`\beta ^{sno}` | 0.5 | 0.5 | ++-----------------------------+-------+-------+ +| :math:`\beta _{0}^{sno}` | 0.5 | 0.5 | ++-----------------------------+-------+-------+ + +Ground Albedos +------------------ + +The overall direct beam :math:`\alpha _{g,\, \Lambda }^{\mu }` and +diffuse :math:`\alpha _{g,\, \Lambda }` ground albedos are weighted +combinations of “soil” and snow albedos + +.. math:: + :label: 3.58 + + \alpha _{g,\, \Lambda }^{\mu } =\alpha _{soi,\, \Lambda }^{\mu } \left(1-f_{sno} \right)+\alpha _{sno,\, \Lambda }^{\mu } f_{sno} + +.. math:: + :label: 3.59 + + \alpha _{g,\, \Lambda } =\alpha _{soi,\, \Lambda } \left(1-f_{sno} \right)+\alpha _{sno,\, \Lambda } f_{sno} + +where :math:`f_{sno}` is the fraction of the ground covered with snow +(section 7.2.1). + +:math:`\alpha _{soi,\, \Lambda }^{\mu }` and +:math:`\alpha _{soi,\, \Lambda }` vary with glacier, lake, wetland, and +soil surfaces. Glacier albedos are from Paterson (1994) + +.. math:: \alpha _{soi,\, vis}^{\mu } =\alpha _{soi,\, vis} =0.6 + +.. math:: \alpha _{soi,\, nir}^{\mu } =\alpha _{soi,\, nir} =0.4. + +Unfrozen lake and wetland albedos depend on the cosine of the solar +zenith angle :math:`\mu` + +.. math:: + :label: 3.60 + + \alpha _{soi,\, \Lambda }^{\mu } =\alpha _{soi,\, \Lambda } =0.05\left(\mu +0.15\right)^{-1} . + +Frozen lake and wetland albedos are from NCAR LSM (Bonan 1996) + +.. math:: \alpha _{soi,\, vis}^{\mu } =\alpha _{soi,\, vis} =0.60 + +.. math:: \alpha _{soi,\, nir}^{\mu } =\alpha _{soi,\, nir} =0.40. + +As in NCAR LSM (Bonan 1996), soil albedos vary with color class + +.. math:: + :label: 3.61 + + \alpha _{soi,\, \Lambda }^{\mu } =\alpha _{soi,\, \Lambda } =\left(\alpha _{sat,\, \Lambda } +\Delta \right)\le \alpha _{dry,\, \Lambda } + +where :math:`\Delta` depends on the volumetric water content of the +first soil layer :math:`\theta _{1}` (section 7.4) as +:math:`\Delta =0.11-0.40\theta _{1} >0`, and +:math:`\alpha _{sat,\, \Lambda }` and +:math:`\alpha _{dry,\, \Lambda }` are albedos for saturated and dry +soil color classes (Table 3.3). + +CLM soil colors are prescribed so that they best reproduce observed +MODIS local solar noon surface albedo values at the CLM grid cell +following the methods of Lawrence and Chase (2007). The soil colors are +fitted over the range of 20 soil classes shown in Table 3.3 and compared +to the MODIS monthly local solar noon all-sky surface albedo as +described in Strahler et al. (1999) and Schaaf et al. (2002). The CLM +two-stream radiation model was used to calculate the model equivalent +surface albedo using climatological monthly soil moisture along with the +vegetation parameters of PFT fraction, LAI, and SAI. The soil color that +produced the closest all-sky albedo in the two-stream radiation model +was selected as the best fit for the month. The fitted monthly soil +colors were averaged over all snow-free months to specify a +representative soil color for the grid cell. In cases where there was no +snow-free surface albedo for the year, the soil color derived from +snow-affected albedo was used to give a representative soil color that +included the effects of the minimum permanent snow cover. + +Table 3.3. Dry and saturated soil albedos + ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| Color Class | vis | nir | vis | nir | Color Class | vis | nir | vis | nir | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 1 | 0.36 | 0.61 | 0.25 | 0.50 | 11 | 0.24 | 0.37 | 0.13 | 0.26 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 2 | 0.34 | 0.57 | 0.23 | 0.46 | 12 | 0.23 | 0.35 | 0.12 | 0.24 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 3 | 0.32 | 0.53 | 0.21 | 0.42 | 13 | 0.22 | 0.33 | 0.11 | 0.22 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 4 | 0.31 | 0.51 | 0.20 | 0.40 | 14 | 0.20 | 0.31 | 0.10 | 0.20 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 5 | 0.30 | 0.49 | 0.19 | 0.38 | 15 | 0.18 | 0.29 | 0.09 | 0.18 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 6 | 0.29 | 0.48 | 0.18 | 0.36 | 16 | 0.16 | 0.27 | 0.08 | 0.16 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 7 | 0.28 | 0.45 | 0.17 | 0.34 | 17 | 0.14 | 0.25 | 0.07 | 0.14 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 8 | 0.27 | 0.43 | 0.16 | 0.32 | 18 | 0.12 | 0.23 | 0.06 | 0.12 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 9 | 0.26 | 0.41 | 0.15 | 0.30 | 19 | 0.10 | 0.21 | 0.05 | 0.10 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +| 10 | 0.25 | 0.39 | 0.14 | 0.28 | 20 | 0.08 | 0.16 | 0.04 | 0.08 | ++---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + +Snow Albedo +^^^^^^^^^^^^^^^^^ + +Snow albedo and solar absorption within each snow layer are simulated +with the Snow, Ice, and Aerosol Radiative Model (SNICAR), which +incorporates a two-stream radiative transfer solution from Toon et al. +(1989). Albedo and the vertical absorption profile depend on solar +zenith angle, albedo of the substrate underlying snow, mass +concentrations of atmospheric-deposited aerosols (black carbon, mineral +dust, and organic carbon), and ice effective grain size +(:math:`r_{e}`), which is simulated with a snow aging routine +described in section 3.2.3. Representation of impurity mass +concentrations within the snowpack is described in section 7.2.4. +Implementation of SNICAR in CLM is also described somewhat by Flanner +and Zender (2005) and Flanner et al. (2007). + +The two-stream solution requires the following bulk optical properties +for each snow layer and spectral band: extinction optical depth +(:math:`\tau`), single-scatter albedo (:math:`\omega`), and +scattering asymmetry parameter (*g*). The snow layers used for radiative +calculations are identical to snow layers applied elsewhere in CLM, +except for the case when snow mass is greater than zero but no snow +layers exist. When this occurs, a single radiative layer is specified to +have the column snow mass and an effective grain size of freshly-fallen +snow (section 3.2.3). The bulk optical properties are weighted functions +of each constituent *k*, computed for each snow layer and spectral band +as + +.. math:: + :label: 3.62 + + \tau =\sum _{1}^{k}\tau _{k} + +.. math:: + :label: 3.63 + + \omega =\frac{\sum _{1}^{k}\omega _{k} \tau _{k} }{\sum _{1}^{k}\tau _{k} } + +.. math:: + :label: 3.64 + + g=\frac{\sum _{1}^{k}g_{k} \omega _{k} \tau _{k} }{\sum _{1}^{k}\omega _{k} \tau _{k} } + +For each constituent (ice, two black carbon species, two organic carbon +species, and four dust species), :math:`\omega`, *g*, and +the mass extinction cross-section :math:`\psi` (:math:`\text{m}^{2} \text{kg}^{-1}`) +are computed offline with Mie Theory, e.g., +applying the computational technique from Bohren and Huffman (1983). The +extinction optical depth for each constituent depends on its mass +extinction cross-section and layer mass, :math:`w _{k} (\text{kg m} ^{-2}`) as + +.. math:: + :label: 3.65 + + \tau _{k} =\psi _{k} w_{k} + +The two-stream solution (Toon et al. 1989) applies a tri-diagonal matrix +solution to produce upward and downward radiative fluxes at each layer +interface, from which net radiation, layer absorption, and surface +albedo are easily derived. Solar fluxes are computed in five spectral +bands, listed in Table 3.4. Because snow albedo varies strongly across +the solar spectrum, it was determined that four bands were needed to +accurately represent the near-infrared (NIR) characteristics of snow, +whereas only one band was needed for the visible spectrum. Boundaries of +the NIR bands were selected to capture broad radiative features and +maximize accuracy and computational efficiency. We partition NIR +(0.7-5.0 :math:`\mu` m) surface downwelling flux from CLM +according to the weights listed in Table 3.4, which are unique for +diffuse and direct incident flux. These fixed weights were determined +with offline hyperspectral radiative transfer calculations for an +atmosphere typical of mid-latitude winter (Flanner et al. 2007). The +tri-diagonal solution includes intermediate terms that allow for easy +interchange of two-stream techniques. We apply the Eddington solution +for the visible band (following Wiscombe and Warren 1980) and the +hemispheric mean solution (Toon et al. 1989) for NIR bands. These +choices were made because the Eddington scheme works well for highly +scattering media, but can produce negative albedo for absorptive NIR +bands with diffuse incident flux. Delta scalings are applied to +:math:`\tau`, :math:`\omega`, and :math:`g` (Wiscombe and Warren 1980) in +all spectral bands, producing effective values (denoted with \*) that +are applied in the two-stream solution + +.. math:: + :label: 3.66 + + \tau ^{*} =\left(1-\omega g^{2} \right)\tau + +.. math:: + :label: 3.67 + + \omega ^{*} =\frac{\left(1-g^{2} \right)\omega }{1-g^{2} \omega } + +.. math:: + :label: 3.68 + + g^{*} =\frac{g}{1+g} + +Table 3.4. Spectral bands and weights used for snow radiative transfer + ++---------------------------------------------------------+----------------------+------------------+ +| Spectral band | Direct-beam weight | Diffuse weight | ++=========================================================+======================+==================+ +| Band 1: 0.3-0.7\ :math:`\mu`\ m (visible) | | | ++---------------------------------------------------------+----------------------+------------------+ +| Band 2: 0.7-1.0\ :math:`\mu`\ m (near-IR) | 0.494 | 0.586 | ++---------------------------------------------------------+----------------------+------------------+ +| Band 3: 1.0-1.2\ :math:`\mu`\ m (near-IR) | 0.181 | 0.202 | ++---------------------------------------------------------+----------------------+------------------+ +| Band 4: 1.2-1.5\ :math:`\mu`\ m (near-IR) | 0.121 | 0.109 | ++---------------------------------------------------------+----------------------+------------------+ +| Band 5: 1.5-5.0\ :math:`\mu`\ m (near-IR) | 0.204 | 0.103 | ++---------------------------------------------------------+----------------------+------------------+ + +Under direct-beam conditions, singularities in the radiative +approximation are occasionally approached in spectral bands 4 and 5 that +produce unrealistic conditions (negative energy absorption in a layer, +negative albedo, or total absorbed flux greater than incident flux). +When any of these three conditions occur, the Eddington approximation is +attempted instead, and if both approximations fail, the cosine of the +solar zenith angle is adjusted by 0.02 (conserving incident flux) and a +warning message is produced. This situation occurs in only about 1 in +10 :math:`{}^{6}` computations of snow albedo. After looping over the +five spectral bands, absorption fluxes and albedo are averaged back into +the bulk NIR band used by the rest of CLM. + +Soil albedo (or underlying substrate albedo), which is defined for +visible and NIR bands, is a required boundary condition for the snow +radiative transfer calculation. Currently, the bulk NIR soil albedo is +applied to all four NIR snow bands. With ground albedo as a lower +boundary condition, SNICAR simulates solar absorption in all snow layers +as well as the underlying soil or ground. With a thin snowpack, +penetrating solar radiation to the underlying soil can be quite large +and heat cannot be released from the soil to the atmosphere in this +situation. Thus, solar radiation penetration is limited to snowpacks +with total snow depth greater than or equal to 0.1 m +(:math:`z_{sno} \ge 0.1`) to prevent unrealistic soil warming within a +single timestep. + +The radiative transfer calculation is performed twice for each column +containing a mass of snow greater than +:math:`1 \times 10^{-30} \text{kg m}^{-2}` (excluding lake and urban columns); once each for +direct-beam and diffuse incident flux. Absorption in each layer +:math:`i` of pure snow is initially recorded as absorbed flux per unit +incident flux on the ground (:math:`S_{sno,\, i}` ), as albedos must be +calculated for the next timestep with unknown incident flux. The snow +absorption fluxes that are used for column temperature calculations are + +.. math:: + :label: ZEqnNum275338 + + S_{g,\, i} =S_{sno,\, i} \left(1-\alpha _{sno} \right) + +This weighting is performed for direct-beam and diffuse, visible and NIR +fluxes. After the ground-incident fluxes (transmitted through the +vegetation canopy) have been calculated for the current time step +(sections 3.1 and 4.1), the layer absorption factors + +(:math:`S_{g,\, i}`) are multiplied by the ground-incident fluxes to +produce solar absorption (W m\ :math:`{}^{-2}`) in each snow layer and +the underlying ground. + +Snowpack Optical Properties +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Ice optical properties for the five spectral bands are derived offline +and stored in a namelist-defined lookup table for online retrieval (see +CLM4.5 User’s Guide). Mie properties are first computed at fine spectral +resolution (470 bands), and are then weighted into the five bands +applied by CLM according to incident solar flux, +:math:`I^{\downarrow } (\lambda )`. For example, the broadband +mass-extinction cross section (:math:`\bar{\psi }`) over wavelength +interval :math:`\lambda _{1}` to :math:`\lambda _{2}` is + +.. math:: + :label: 3.70 + + \bar{\psi }=\frac{\int _{\lambda _{1} }^{\lambda _{2} }\psi \left(\lambda \right) I^{\downarrow } \left(\lambda \right){\rm d}\lambda }{\int _{\lambda _{1} }^{\lambda _{2} }I^{\downarrow } \left(\lambda \right){\rm d}\lambda } + +Broadband single-scatter albedo (:math:`\bar{\omega }`) is additionally +weighted by the diffuse albedo for a semi-infinite snowpack (:math:`\alpha _{sno}`) + +.. math:: + :label: 3.71 + + \bar{\omega }=\frac{\int _{\lambda _{1} }^{\lambda _{2} }\omega (\lambda )I^{\downarrow } ( \lambda )\alpha _{sno} (\lambda ){\rm d}\lambda }{\int _{\lambda _{1} }^{\lambda _{2} }I^{\downarrow } ( \lambda )\alpha _{sno} (\lambda ){\rm d}\lambda } + +Inclusion of this additional albedo weight was found to improve accuracy +of the five-band albedo solutions (relative to 470-band solutions) +because of the strong dependence of optically-thick snowpack albedo on +ice grain single-scatter albedo (Flanner et al. 2007). The lookup tables +contain optical properties for lognormal distributions of ice particles +over the range of effective radii: 30\ :math:`\mu`\ m +:math:`< r _{e} < \text{1500} \mu \text{m}`, at 1 :math:`\mu` m resolution. Single-scatter albedos for the end-members of this size +range are listed in Table 3.5. + +Optical properties for black carbon are described in Flanner et al. +(2007). Single-scatter albedo, mass extinction cross-section, and +asymmetry parameter values for all snowpack species, in the five +spectral bands used, are listed in Tables 3.5, 3.6, and 3.7. These +properties were also derived with Mie Theory, using various published +sources of indices of refraction and assumptions about particle size +distribution. Weighting into the five CLM spectral bands was determined +only with incident solar flux, as in equation . + +Table 3.5. Single-scatter albedo values used for snowpack impurities and ice + ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | ++================================================================+==========+==========+==========+==========+==========+ +| Hydrophilic black carbon | 0.516 | 0.434 | 0.346 | 0.276 | 0.139 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophobic black carbon | 0.288 | 0.187 | 0.123 | 0.089 | 0.040 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophilic organic carbon | 0.997 | 0.994 | 0.990 | 0.987 | 0.951 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophobic organic carbon | 0.963 | 0.921 | 0.860 | 0.814 | 0.744 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 1 | 0.979 | 0.994 | 0.993 | 0.993 | 0.953 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 2 | 0.944 | 0.984 | 0.989 | 0.992 | 0.983 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 3 | 0.904 | 0.965 | 0.969 | 0.973 | 0.978 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 4 | 0.850 | 0.940 | 0.948 | 0.953 | 0.955 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Ice (:math:`r _{e}` = 30 :math:`\mu` m) | 0.9999 | 0.9999 | 0.9992 | 0.9938 | 0.9413 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Ice (:math:`r _{e}` = 1500 :math:`\mu` m) | 0.9998 | 0.9960 | 0.9680 | 0.8730 | 0.5500 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ + +Table 3.6. Mass extinction values (:math:`\text{m}^{2} \text{kg}^{-1}`) used for snowpack impurities and ice. + ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | ++================================================================+==========+==========+==========+==========+==========+ +| Hydrophilic black carbon | 25369 | 12520 | 7739 | 5744 | 3527 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophobic black carbon | 11398 | 5923 | 4040 | 3262 | 2224 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophilic organic carbon | 37774 | 22112 | 14719 | 10940 | 5441 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophobic organic carbon | 3289 | 1486 | 872 | 606 | 248 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 1 | 2687 | 2420 | 1628 | 1138 | 466 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 2 | 841 | 987 | 1184 | 1267 | 993 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 3 | 388 | 419 | 400 | 397 | 503 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 4 | 197 | 203 | 208 | 205 | 229 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Ice (:math:`r _{e}` = 30 :math:`\mu` m) | 55.7 | 56.1 | 56.3 | 56.6 | 57.3 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Ice (:math:`r _{e}` = 1500 :math:`\mu` m) | 1.09 | 1.09 | 1.09 | 1.09 | 1.1 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ + +Table 3.7. Asymmetry scattering parameters used for snowpack impurities and ice. + ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | ++================================================================+==========+==========+==========+==========+==========+ +| Hydrophilic black carbon | 0.52 | 0.34 | 0.24 | 0.19 | 0.10 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophobic black carbon | 0.35 | 0.21 | 0.15 | 0.11 | 0.06 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophilic organic carbon | 0.77 | 0.75 | 0.72 | 0.70 | 0.64 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Hydrophobic organic carbon | 0.62 | 0.57 | 0.54 | 0.51 | 0.44 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 1 | 0.69 | 0.72 | 0.67 | 0.61 | 0.44 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 2 | 0.70 | 0.65 | 0.70 | 0.72 | 0.70 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 3 | 0.79 | 0.75 | 0.68 | 0.63 | 0.67 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Dust 4 | 0.83 | 0.79 | 0.77 | 0.76 | 0.73 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Ice (:math:`r _{e}` = 30\ :math:`\mu`\ m) | 0.88 | 0.88 | 0.88 | 0.88 | 0.90 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ +| Ice (:math:`r _{e}` = 1500\ :math:`\mu`\ m) | 0.89 | 0.90 | 0.90 | 0.92 | 0.97 | ++----------------------------------------------------------------+----------+----------+----------+----------+----------+ + +Snow Aging +^^^^^^^^^^^^^^^^ + +Snow aging is represented as evolution of the ice effective grain size +(:math:`r_{e}`). Previous studies have shown that use of spheres +which conserve the surface area-to-volume ratio (or specific surface +area) of ice media composed of more complex shapes produces relatively +small errors in simulated hemispheric fluxes (e.g., Grenfell and Warren +1999). Effective radius is the surface area-weighted mean radius of an +ensemble of spherical particles and is directly related to specific +surface area (*SSA*) as +:math:`r_{e} ={3\mathord{\left/ {\vphantom {3 \left(\rho _{ice} SSA\right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{ice} SSA\right)}` , +where :math:`\rho_{ice}` is the density of ice. Hence, +:math:`r_{e}` is a simple and practical metric for relating the +snowpack microphysical state to dry snow radiative characteristics. + +Wet snow processes can also drive rapid changes in albedo. The presence +of liquid water induces rapid coarsening of the surrounding ice grains +(e.g., Brun 1989), and liquid water tends to refreeze into large ice +clumps that darken the bulk snowpack. The presence of small liquid +drops, by itself, does not significantly darken snowpack, as ice and +water have very similar indices of refraction throughout the solar +spectrum. Pooled or ponded water, however, can significantly darken +snowpack by greatly reducing the number of refraction events per unit +mass. This influence is not currently accounted for. + +The net change in effective grain size occurring each time step is +represented in each snow layer as a summation of changes caused by dry +snow metamorphism (:math:`dr_{e,dry}`), liquid water-induced +metamorphism (:math:`dr_{e,wet}`), refreezing of liquid water, and +addition of freshly-fallen snow. The mass of each snow layer is +partitioned into fractions of snow carrying over from the previous time +step (:math:`f_{old}`), freshly-fallen snow +(:math:`f_{new}`), and refrozen liquid water +(:math:`f_{rfz}`), such that snow :math:`r_{e}` is updated +each time step *t* as + +.. math:: + :label: 3.72 + + r_{e} \left(t\right)=\left[r_{e} \left(t-1\right)+dr_{e,\, dry} +dr_{e,\, wet} \right]f_{old} +r_{e,\, 0} f_{new} +r_{e,\, rfz} f_{rfrz} + +Here, the effective radius of freshly-fallen snow +(:math:`r_{e,0}`) is fixed globally at 54.5 :math:`\mu` m (corresponding to a specific surface +area of 60 :math:`\text{m}^{2} \text{kg}^{-1}`), and the effective +radius of refrozen liquid water (:math:`r_{e,rfz}`) is set to 1000\ :math:`\mu` m. + +Dry snow aging is based on a microphysical model described by Flanner +and Zender (2006). This model simulates diffusive vapor flux amongst +collections of ice crystals with various size and inter-particle +spacing. Specific surface area and effective radius are prognosed for +any combination of snow temperature, temperature gradient, density, and +initial size distribution. The combination of warm snow, large +temperature gradient, and low density produces the most rapid snow +aging, whereas aging proceeds slowly in cold snow, regardless of +temperature gradient and density. Because this model is currently too +computationally expensive for inclusion in climate models, we fit +parametric curves to model output over a wide range of snow conditions +and apply these parameters in CLM. The functional form of the parametric +equation is + +.. math:: + :label: 3.73 + + \frac{dr_{e,\, dry} }{dt} =\left(\frac{dr_{e} }{dt} \right)_{0} \left(\frac{\eta }{\left(r_{e} -r_{e,\, 0} \right)+\eta } \right)^{{1\mathord{\left/ {\vphantom {1 \kappa }} \right. \kern-\nulldelimiterspace} \kappa } } + +The parameters :math:`{(\frac{dr_{e}}{dt}})_{0}`, +:math:`\eta`, and :math:`\kappa` are retrieved interactively from a +lookup table with dimensions corresponding to snow temperature, +temperature gradient, and density. The domain covered by this lookup +table includes temperature ranging from 223 to 273 K, temperature +gradient ranging from 0 to 300 K m\ :math:`{}^{-1}`, and density ranging +from 50 to 400 kg m\ :math:`{}^{-3}`. Temperature gradient is calculated +at the midpoint of each snow layer *n*, using mid-layer temperatures +(:math:`T_{n}`) and snow layer thicknesses (:math:`dz_{n}`), as + +.. math:: + :label: 3.74 + + \left(\frac{dT}{dz} \right)_{n} =\frac{1}{dz_{n} } abs\left[\frac{T_{n-1} dz_{n} +T_{n} dz_{n-1} }{dz_{n} +dz_{n-1} } +\frac{T_{n+1} dz_{n} +T_{n} dz_{n+1} }{dz_{n} +dz_{n+1} } \right] + +For the bottom snow layer (:math:`n=0`), +:math:`T_{n+1}` is taken as the temperature of the +top soil layer, and for the top snow layer it is assumed that +:math:`T_{n-1}` = :math:`T_{n}`. + +The contribution of liquid water to enhanced metamorphism is based on +parametric equations published by Brun (1989), who measured grain +growth rates under different liquid water contents. This relationship, +expressed in terms of :math:`r_{e} (\mu \text{m})` and +subtracting an offset due to dry aging, depends on the mass liquid water +fraction :math:`f_{liq}` as + +.. math:: + :label: 3.75 + + \frac{dr_{e} }{dt} =\frac{10^{18} C_{1} f_{liq} ^{3} }{4\pi r_{e} ^{2} } + +The constant *C*\ :math:`{}_{1}` is +4.22\ :math:`\times`\ 10\ :math:`{}^{-13}`, and: +:math:`f_{liq} =w_{liq} /(w_{liq} +w_{ice} )`\ (section 7.2). + +In cases where snow mass is greater than zero, but a snow layer has not +yet been defined, :math:`r_{e}` is set to :math:`r_{e,0}`. When snow layers are combined or +divided, :math:`r_{e}` is calculated as a mass-weighted mean of +the two layers, following computations of other state variables (section +7.2.7). Finally, the allowable range of :math:`r_{e}`, +corresponding to the range over which Mie optical properties have been +defined, is 30-1500\ :math:`\mu` m. + +Solar Zenith Angle +---------------------- + +The CLM uses the same formulation for solar zenith angle as the +Community Atmosphere Model. The cosine of the solar zenith angle +:math:`\mu` is + +.. math:: + :label: 3.76 + + \mu =\sin \phi \sin \delta -\cos \phi \cos \delta \cos h + +where :math:`h` is the solar hour angle (radians) (24 hour periodicity), +:math:`\delta` is the solar declination angle (radians), and +:math:`\phi` is latitude (radians) (positive in Northern Hemisphere). +The solar hour angle :math:`h` (radians) is + +.. math:: + :label: 3.77 + + h=2\pi d+\theta + +where :math:`d` is calendar day (:math:`d=0.0` at 0Z on January 1), and +:math:`\theta` is longitude (radians) (positive east of the +CityplaceGreenwich meridian). + +The solar declination angle :math:`\delta` is calculated as in Berger +(1978a,b) and is valid for one million years past or hence, relative to +1950 A.D. The orbital parameters may be specified directly or the +orbital parameters are calculated for the desired year. The required +orbital parameters to be input by the user are the obliquity of the +Earth :math:`\varepsilon` (degrees, +:math:`-90^{\circ } <\varepsilon <90^{\circ }` ), Earth’s eccentricity +:math:`e` (:math:`0.00} \\ {\tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right]+\pi \qquad {\rm for\; }e^{\cos } <{\rm -1}\times {\rm 10}^{{\rm -8}} } \\ {\tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right]+2\pi \qquad {\rm for\; }e^{\cos } >{\rm 1}\times {\rm 10}^{{\rm -8}} {\rm \; and\; }e^{\sin } <0} \\ {\tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right]\qquad {\rm for\; }e^{\cos } >{\rm 1}\times {\rm 10}^{{\rm -8}} {\rm \; and\; }e^{\sin } \ge 0} \end{array}\right\}. + +The numerical solution for the longitude of the perihelion +:math:`\tilde{\omega }` is constrained to be between 0 and 360 degrees +(measured from the autumn equinox). A constant 180 degrees is then added +to :math:`\tilde{\omega }` because the Sun is considered as revolving +around the Earth (geocentric coordinate system) (Berger et al. 1993). + +Table 3.8. Orbital parameters + ++--------------------------------------+-------------+ +| Parameter | | ++======================================+=============+ +| :math:`\varepsilon *` | 23.320556 | ++--------------------------------------+-------------+ +| :math:`\tilde{\psi }` (arcseconds) | 50.439273 | ++--------------------------------------+-------------+ +| :math:`\zeta` (degrees) | 3.392506 | ++--------------------------------------+-------------+ diff --git a/doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst b/doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst new file mode 100644 index 0000000000..45d03e83f8 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst @@ -0,0 +1,289 @@ +Radiative Fluxes +=================== + +The net radiation at the surface is +:math:`\left(\vec{S}_{v} +\vec{S}_{g} \right)-\left(\vec{L}_{v} +\vec{L}_{g} \right)`, +where :math:`\vec{S}` is the net solar flux absorbed by the vegetation +(“v”) and the ground (“g”) and :math:`\vec{L}` is the net longwave flux +(positive toward the atmosphere) (W m\ :math:`{}^{-2}`). + +Solar Fluxes +---------------- + +Figure 4.1 illustrates the direct beam and diffuse fluxes in the canopy. +:math:`I\, \uparrow _{\Lambda }^{\mu }` and +:math:`I\, \uparrow _{\Lambda }` are the upward diffuse fluxes, per +unit incident direct beam and diffuse flux (section 3.1). +:math:`I\, \downarrow _{\Lambda }^{\mu }` and +:math:`I\, \downarrow _{\Lambda }` \ are the downward diffuse fluxes +below the vegetation per unit incident direct beam and diffuse radiation +(section 3.1). The direct beam flux transmitted through the canopy, per +unit incident flux, is :math:`e^{-K\left(L+S\right)}` . +:math:`\vec{I}_{\Lambda }^{\mu }` and :math:`\vec{I}_{\Lambda }^{}` +are the fluxes absorbed by the vegetation, per unit incident direct beam +and diffuse radiation (section 3.1). +:math:`\alpha _{g,\, \Lambda }^{\mu }` and +:math:`\alpha _{g,\, \Lambda }` are the direct beam and diffuse ground +albedos (section 3.2). :math:`L` and :math:`S` are the exposed leaf area +index and stem area index (section 2.1.4). :math:`K` is the optical +depth of direct beam per unit leaf and stem area (section 3.1). + +Figure 4.1. Schematic diagram of (a) direct beam radiation, (b) diffuse +solar radiation, and (c) longwave radiation absorbed, transmitted, and +reflected by vegetation and ground. + +For clarity, terms involving :math:`T^{n+1} -T^{n}` are not shown in +(c). + +.. image:: image1.png + +The total solar radiation absorbed by the vegetation and ground is + +.. math:: + :label: 4.1 + + \vec{S}_{v} =\sum _{\Lambda }S_{atm} \, \downarrow _{\Lambda }^{\mu } \overrightarrow{I}_{\Lambda }^{\mu } +S_{atm} \, \downarrow _{\Lambda } \overrightarrow{I}_{\Lambda } + +.. math:: + :label: 4.2 + + \begin{array}{l} {\vec{S}_{g} =\sum _{\Lambda }S_{atm} \, \downarrow _{\Lambda }^{\mu } e^{-K\left(L+S\right)} \left(1-\alpha _{g,\, \Lambda }^{\mu } \right) +} \\ {\qquad \left(S_{atm} \, \downarrow _{\Lambda }^{\mu } I\downarrow _{\Lambda }^{\mu } +S_{atm} \downarrow _{\Lambda } I\downarrow _{\Lambda } \right)\left(1-\alpha _{g,\, \Lambda } \right)} \end{array} + +where :math:`S_{atm} \, \downarrow _{\Lambda }^{\mu }` and +:math:`S_{atm} \, \downarrow _{\Lambda }` are the incident direct beam +and diffuse solar fluxes (W m\ :math:`{}^{-2}`). For non-vegetated +surfaces, :math:`e^{-K\left(L+S\right)} =1`, +:math:`\overrightarrow{I}_{\Lambda }^{\mu } =\overrightarrow{I}_{\Lambda } =0`, +:math:`I\, \downarrow _{\Lambda }^{\mu } =0`, and +:math:`I\, \downarrow _{\Lambda } =1`, so that + +.. math:: + :label: 4.3 + + \begin{array}{l} {\vec{S}_{g} =\sum _{\Lambda }S_{atm} \, \downarrow _{\Lambda }^{\mu } \left(1-\alpha _{g,\, \Lambda }^{\mu } \right) +S_{atm} \, \downarrow _{\Lambda } \left(1-\alpha _{g,\, \Lambda } \right)} \\ {\vec{S}_{v} =0} \end{array}. + +Solar radiation is conserved as + +.. math:: + :label: 4.4 + + \sum _{\Lambda }\left(S_{atm} \, \downarrow _{\Lambda }^{\mu } +S_{atm} \, \downarrow _{\Lambda } \right)=\left(\vec{S}_{v} +\vec{S}_{g} \right) +\sum _{\Lambda }\left(S_{atm} \, \downarrow _{\Lambda }^{\mu } I\uparrow _{\Lambda }^{\mu } +S_{atm} \, \downarrow _{\Lambda } I\uparrow _{\Lambda } \right) + +where the latter term in parentheses is reflected solar radiation. + +Photosynthesis and transpiration depend non-linearly on solar radiation, +via the light response of stomata. The canopy is treated as two leaves +(sunlit and shaded) and the solar radiation in the visible waveband +(:math:`<` 0.7 µm) absorbed by the vegetation is apportioned to the +sunlit and shaded leaves (section 3.1). The absorbed photosynthetically +active (visible waveband) radiation averaged over the sunlit canopy (per +unit plant area) is + +.. math:: + :label: 4.5 + + \phi ^{sun} ={\left(\vec{I}_{sun,vis}^{\mu } S_{atm} \downarrow _{vis}^{\mu } +\vec{I}_{sun,vis}^{} S_{atm} \downarrow _{vis}^{} \right)\mathord{\left/ {\vphantom {\left(\vec{I}_{sun,vis}^{\mu } S_{atm} \downarrow _{vis}^{\mu } +\vec{I}_{sun,vis}^{} S_{atm} \downarrow _{vis}^{} \right) L^{sun} }} \right. \kern-\nulldelimiterspace} L^{sun} } + +and the absorbed radiation for the average shaded leaf (per unit plant +area) is + +.. math:: + :label: 4.6 + + \phi ^{sha} ={\left(\vec{I}_{sha,vis}^{\mu } S_{atm} \downarrow _{vis}^{\mu } +\vec{I}_{sha,vis}^{} S_{atm} \downarrow _{vis}^{} \right)\mathord{\left/ {\vphantom {\left(\vec{I}_{sha,vis}^{\mu } S_{atm} \downarrow _{vis}^{\mu } +\vec{I}_{sha,vis}^{} S_{atm} \downarrow _{vis}^{} \right) L^{sha} }} \right. \kern-\nulldelimiterspace} L^{sha} } + +with :math:`L^{sun}` and :math:`L^{sha}` the sunlit and shaded plant +area index, respectively. The sunlit plant area index is + +.. math:: + :label: 4.7 + + L^{sun} =\frac{1-e^{-K(L+S)} }{K} + +and the shaded leaf area index is :math:`L^{sha} =(L+S)-L^{sun}` . In +calculating :math:`L^{sun}` , + +.. math:: + :label: 4.8 + + K=\frac{G\left(\mu \right)}{\mu } + +where :math:`G\left(\mu \right)` and :math:`\mu` are parameters in the +two-stream approximation (section 3.1). + +The model uses the two-stream approximation to calculate radiative +transfer of direct and diffuse radiation through a canopy that is +differentiated into leaves that are sunlit and those that are shaded +(section 3.1). The two-stream equations are integrated over all plant +area (leaf and stem area) in the canopy. The model has an optional +(though not supported) multi-layer canopy, as described by Bonan et al. +(2012). The multi-layer model is only intended to address the +non-linearity of light profiles, photosynthesis, and stomatal +conductance in the plant canopy. + +In the multi-layer canopy, canopy-integrated radiative fluxes are +calculated from the two-stream approximation. The model additionally +derives the light profile with depth in the canopy by taking the +derivatives of the absorbed radiative fluxes with respect to plant area +index (:math:`L'=L+S`) and evaluating them incrementally through the +canopy with cumulative plant area index (:math:`x`). The terms +:math:`{d\vec{I}_{sun,\Lambda }^{\mu } (x)\mathord{\left/ {\vphantom {d\vec{I}_{sun,\Lambda }^{\mu } (x) dL'}} \right. \kern-\nulldelimiterspace} dL'}` +and +:math:`{d\vec{I}_{sun,\Lambda }^{} (x)\mathord{\left/ {\vphantom {d\vec{I}_{sun,\Lambda }^{} (x) dL'}} \right. \kern-\nulldelimiterspace} dL'}` +are the direct beam and diffuse solar radiation, respectively, absorbed +by the sunlit fraction of the canopy (per unit plant area) at a depth +defined by the cumulative plant area index :math:`x`; +:math:`{d\vec{I}_{sha,\Lambda }^{\mu } (x)\mathord{\left/ {\vphantom {d\vec{I}_{sha,\Lambda }^{\mu } (x) dL'}} \right. \kern-\nulldelimiterspace} dL'}` \ and +:math:`{d\vec{I}_{sha,\Lambda }^{} (x)\mathord{\left/ {\vphantom {d\vec{I}_{sha,\Lambda }^{} (x) dL'}} \right. \kern-\nulldelimiterspace} dL'}` +are the corresponding fluxes for the shaded fraction of the canopy at +depth :math:`x`. These fluxes are normalized by the sunlit or shaded +fraction at depth :math:`x`, defined by +:math:`f_{sun} =\exp \left(-Kx\right)`, to give fluxes per unit sunlit +or shaded plant area at depth :math:`x`. + +Longwave Fluxes +------------------- + +The net longwave radiation (W m\ :math:`{}^{-2}`) (positive toward the +atmosphere) at the surface is + +.. math:: + :label: 4.9 + + \vec{L}=L\, \uparrow -L_{atm} \, \downarrow + +where :math:`L\, \uparrow` is the upward longwave radiation from the +surface and :math:`L_{atm} \, \downarrow` is the downward atmospheric +longwave radiation (W m\ :math:`{}^{-2}`). The radiative temperature +:math:`T_{rad}` (K) is defined from the upward longwave radiation as + +.. math:: + :label: 4.10 + + T_{rad} =\left(\frac{L\, \uparrow }{\sigma } \right)^{{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} } + +where :math:`\sigma` is the Stefan-Boltzmann constant (W +m\ :math:`{}^{-2}` K\ :math:`{}^{-4}`) (Table 2.6). With reference to +Figure 4.1, the upward longwave radiation from the surface to the +atmosphere is + +.. math:: + :label: 4.11 + + \begin{array}{l} {L\, \uparrow =\delta _{veg} L_{vg} \, \uparrow +\left(1-\delta _{veg} \right)\left(1-\varepsilon _{g} \right)L_{atm} \, \downarrow +} \\ {\qquad \left(1-\delta _{veg} \right)\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{4} +4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} \left(T_{g}^{n+1} -T_{g}^{n} \right)} \end{array} + +where :math:`L_{vg} \, \uparrow` is the upward longwave radiation from +the vegetation/soil system for exposed leaf and stem area +:math:`L+S\ge 0.05`, :math:`\delta _{veg}` is a step function and is +zero for :math:`L+S<0.05` and one otherwise, :math:`\varepsilon _{g}` +is the ground emissivity, and :math:`T_{g}^{n+1}` and +:math:`T_{g}^{n}` are the snow/soil surface temperatures at the current +and previous time steps, respectively (Chapter 6). + +For non-vegetated surfaces, the above equation reduces to + +.. math:: + :label: 4.12 + + L\, \uparrow =\left(1-\varepsilon _{g} \right)L_{atm} \, \downarrow +\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{4} +4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} \left(T_{g}^{n+1} -T_{g}^{n} \right) + +where the first term is the atmospheric longwave radiation reflected by +the ground, the second term is the longwave radiation emitted by the +ground, and the last term is the increase (decrease) in longwave +radiation emitted by the ground due to an increase (decrease) in ground +temperature. + +For vegetated surfaces, the upward longwave radiation from the surface +reduces to + +.. math:: + :label: 4.13 + + L\, \uparrow =L_{vg} \, \uparrow +4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} \left(T_{g}^{n+1} -T_{g}^{n} \right) + +where + +.. math:: + :label: 4.14 + + \begin{array}{l} {L_{vg} \, \uparrow =\left(1-\varepsilon _{g} \right)\left(1-\varepsilon _{v} \right)\left(1-\varepsilon _{v} \right)L_{atm} \, \downarrow } \\ {\qquad \qquad +\varepsilon _{v} \left[1+\left(1-\varepsilon _{g} \right)\left(1-\varepsilon _{v} \right)\right]\sigma \left(T_{v}^{n} \right)^{3} \left[T_{v}^{n} +4\left(T_{v}^{n+1} -T_{v}^{n} \right)\right]} \\ {\qquad \qquad +\varepsilon _{g} \left(1-\varepsilon _{v} \right)\sigma \left(T_{g}^{n} \right)^{4} } \\ {\qquad =\left(1-\varepsilon _{g} \right)\left(1-\varepsilon _{v} \right)\left(1-\varepsilon _{v} \right)L_{atm} \, \downarrow } \\ {\qquad \qquad +\varepsilon _{v} \sigma \left(T_{v}^{n} \right)^{4} } \\ {\qquad \qquad +\varepsilon _{v} \left(1-\varepsilon _{g} \right)\left(1-\varepsilon _{v} \right)\sigma \left(T_{v}^{n} \right)^{4} } \\ {\qquad \qquad +4\varepsilon _{v} \sigma \left(T_{v}^{n} \right)^{3} \left(T_{v}^{n+1} -T_{v}^{n} \right)} \\ {\qquad \qquad +4\varepsilon _{v} \left(1-\varepsilon _{g} \right)\left(1-\varepsilon _{v} \right)\sigma \left(T_{v}^{n} \right)^{3} \left(T_{v}^{n+1} -T_{v}^{n} \right)} \\ {\qquad \qquad +\varepsilon _{g} \left(1-\varepsilon _{v} \right)\sigma \left(T_{g}^{n} \right)^{4} } \end{array} + +where :math:`\varepsilon _{v}` is the vegetation emissivity and +:math:`T_{v}^{n+1}` and :math:`T_{v}^{n}` are the vegetation +temperatures at the current and previous time steps, respectively +(Chapter 5). The first term in the equation above is the atmospheric +longwave radiation that is transmitted through the canopy, reflected by +the ground, and transmitted through the canopy to the atmosphere. The +second term is the longwave radiation emitted by the canopy directly to +the atmosphere. The third term is the longwave radiation emitted +downward from the canopy, reflected by the ground, and transmitted +through the canopy to the atmosphere. The fourth term is the increase +(decrease) in longwave radiation due to an increase (decrease) in canopy +temperature that is emitted by the canopy directly to the atmosphere. +The fifth term is the increase (decrease) in longwave radiation due to +an increase (decrease) in canopy temperature that is emitted downward +from the canopy, reflected from the ground, and transmitted through the +canopy to the atmosphere. The last term is the longwave radiation +emitted by the ground and transmitted through the canopy to the +atmosphere. + +The upward longwave radiation from the ground is + +.. math:: + :label: 4.15 + + L_{g} \, \uparrow =\left(1-\varepsilon _{g} \right)L_{v} \, \downarrow +\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{4} + +where :math:`L_{v} \, \downarrow` is the downward longwave radiation +below the vegetation + +.. math:: + :label: 4.16 + + L_{v} \, \downarrow =\left(1-\varepsilon _{v} \right)L_{atm} \, \downarrow +\varepsilon _{v} \sigma \left(T_{v}^{n} \right)^{4} +4\varepsilon _{v} \sigma \left(T_{v}^{n} \right)^{3} \left(T_{v}^{n+1} -T_{v}^{n} \right). + +The net longwave radiation flux for the ground is (positive toward the +atmosphere) + +.. math:: + :label: 4.17 + + \vec{L}_{g} =\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{4} -\delta _{veg} \varepsilon _{g} L_{v} \, \downarrow -\left(1-\delta _{veg} \right)\varepsilon _{g} L_{atm} \, \downarrow . + +The above expression for :math:`\vec{L}_{g}` is the net longwave +radiation forcing that is used in the soil temperature calculation +(Chapter 6). Once updated soil temperatures have been obtained, the term +:math:`4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} \left(T_{g}^{n+1} -T_{g}^{n} \right)` +is added to :math:`\vec{L}_{g}` to calculate the ground heat flux +(section 5.4) + +The net longwave radiation flux for vegetation is (positive toward the +atmosphere) + +.. math:: + :label: 4.18 + + \vec{L}_{v} =\left[2-\varepsilon _{v} \left(1-\varepsilon _{g} \right)\right]\varepsilon _{v} \sigma \left(T_{v} \right)^{4} -\varepsilon _{v} \varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{4} -\varepsilon _{v} \left[1+\left(1-\varepsilon _{g} \right)\left(1-\varepsilon _{v} \right)\right]L_{atm} \, \downarrow . + +These equations assume that absorptivity equals emissivity. The +emissivity of the ground is + +.. math:: + :label: 4.19 + + \varepsilon _{g} =\varepsilon _{soi} \left(1-f_{sno} \right)+\varepsilon _{sno} f_{sno} + +where :math:`\varepsilon _{soi} =0.96` for soil, 0.97 for glacier, and +0.96 for wetland, :math:`\varepsilon _{sno} =0.97`, and :math:`f_{sno}` +is the fraction of ground covered by snow (section 7.2.1). The +vegetation emissivity is + +.. math:: + :label: 4.20 + + \varepsilon _{v} =1-e^{-{\left(L+S\right)\mathord{\left/ {\vphantom {\left(L+S\right) \bar{\mu }}} \right. \kern-\nulldelimiterspace} \bar{\mu }} } + +where :math:`L` and :math:`S` are the leaf and stem area indices +(section 2.1.4) and :math:`\bar{\mu }=1` is the average inverse optical +depth for longwave radiation. + diff --git a/doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst b/doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst new file mode 100644 index 0000000000..336fde1b9f --- /dev/null +++ b/doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst @@ -0,0 +1,1773 @@ +Momentum, Sensible Heat, and Latent Heat Fluxes +================================================== + +The zonal :math:`\tau _{x}` and meridional :math:`\tau _{y}` momentum +fluxes (kg m\ :math:`{}^{-1}` s\ :math:`{}^{-2}`), sensible heat flux +:math:`H` (W m\ :math:`{}^{-2}`), and water vapor flux :math:`E` (kg +m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) between the atmosphere at +reference height :math:`z_{atm,\, x}` (m) [where :math:`x` is height +for wind (momentum) (:math:`m`), temperature (sensible heat) +(:math:`h`), and humidity (water vapor) (:math:`w`); with zonal and +meridional winds :math:`u_{atm}` and :math:`v_{atm}` (m +s\ :math:`{}^{-1}`), potential temperature :math:`\theta _{atm}` (K), +and specific humidity :math:`q_{atm}` (kg kg\ :math:`{}^{-1}`)] and the +surface [with :math:`u_{s}` , :math:`v_{s}` , :math:`\theta _{s}` , and +:math:`q_{s}` ] are + +.. math:: + :label: 5.1 + + \tau _{x} =-\rho _{atm} \frac{\left(u_{atm} -u_{s} \right)}{r_{am} } + +.. math:: + :label: 5.2 + + \tau _{y} =-\rho _{atm} \frac{\left(v_{atm} -v_{s} \right)}{r_{am} } + +.. math:: + :label: 5.3 + + H=-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -\theta _{s} \right)}{r_{ah} } + +.. math:: + :label: 5.4 + + E=-\rho _{atm} \frac{\left(q_{atm} -q_{s} \right)}{r_{aw} } . + +These fluxes are derived in the next section from Monin-Obukhov +similarity theory developed for the surface layer (i.e., the nearly +constant flux layer above the surface sublayer). In this derivation, +:math:`u_{s}` and :math:`v_{s}` are defined to equal zero at height +:math:`z_{0m} +d` (the apparent sink for momentum) so that +:math:`r_{am}` is the aerodynamic resistance (s m\ :math:`{}^{-1}`) for +momentum between the atmosphere at height :math:`z_{atm,\, m}` and the +surface at height :math:`z_{0m} +d`. Thus, the momentum fluxes become + +.. math:: + :label: + + \tau _{x} =-\rho _{atm} \frac{u_{atm} }{r_{am} } + +.. math:: + :label: + + \tau _{y} =-\rho _{atm} \frac{v_{atm} }{r_{am} } . + +Likewise, :math:`\theta _{s}` and :math:`q_{s}` are defined at +heights :math:`z_{0h} +d` and :math:`z_{0w} +d` (the apparent sinks for +heat and water vapor, respectively + +:math:`r_{aw}` are the aerodynamic resistances (s m\ :math:`{}^{-1}`) +to sensible heat and water vapor transfer between the atmosphere at +heights :math:`z_{atm,\, h}` and :math:`z_{atm,\, w}` and the surface +at heights :math:`z_{0h} +d` and :math:`z_{0w} +d`, respectively. The +specific heat capacity of air :math:`C_{p}` (J kg\ :math:`{}^{-1}` +K\ :math:`{}^{-1}`) is a constant (Table 2.6). The atmospheric potential +temperature used here is + +.. math:: + :label: 5.7 + + \theta _{atm} =T_{atm} +\Gamma _{d} z_{atm,\, h} + +where :math:`T_{atm}` is the air temperature (K) at height +:math:`z_{atm,\, h}` and :math:`\Gamma _{d} =0.0098` K +m\ :math:`{}^{-1}` is the negative of the dry adiabatic lapse rate [this +expression is first-order equivalent to +:math:`\theta _{atm} =T_{atm} \left({P_{srf} \mathord{\left/ {\vphantom {P_{srf} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } \right)^{{R_{da} \mathord{\left/ {\vphantom {R_{da} C_{p} }} \right. \kern-\nulldelimiterspace} C_{p} } }` +(Stull 1988), where :math:`P_{srf}` is the surface pressure (Pa), +:math:`P_{atm}` is the atmospheric pressure (Pa), and :math:`R_{da}` +is the gas constant for dry air (J kg\ :math:`{}^{-1}` +K\ :math:`{}^{-1}`) (Table 2.6)]. By definition, +:math:`\theta _{s} =T_{s}` . The density of moist air (kg +m\ :math:`{}^{-3}`) is + +.. math:: + :label: 5.8 + + \rho _{atm} =\frac{P_{atm} -0.378e_{atm} }{R_{da} T_{atm} } + +where the atmospheric vapor pressure :math:`e_{atm}` (Pa) is derived +from the atmospheric specific humidity :math:`q_{atm}` + +.. math:: + :label: 5.9 + + e_{atm} =\frac{q_{atm} P_{atm} }{0.622+0.378q_{atm} } . + +Monin-Obukhov Similarity Theory +----------------------------------- + +The surface vertical kinematic fluxes of momentum +:math:`\overline{u'w'}` and :math:`\overline{v'w'}` (:math:`\text{m}^{2} \text{s}^{-2}`), sensible heat :math:`\overline{\theta 'w'}` +(:math:`\text{K m} \text{s}^{-1}`), and latent heat :math:`\overline{q'w'}` (:math:`\text{kg kg }^{-1}` m s\ :math:`{}^{-1}`), where :math:`u'`, :math:`v'`, +:math:`w'`, :math:`\theta '`, and :math:`q'` are zonal horizontal wind, +meridional horizontal wind, vertical velocity, potential temperature, +and specific humidity turbulent fluctuations about the mean, are defined +from Monin-Obukhov similarity applied to the surface layer. This theory +states that when scaled appropriately, the dimensionless mean horizontal +wind speed, mean potential temperature, and mean specific humidity +profile gradients depend on unique functions of +:math:`\zeta =\frac{z-d}{L}` (Zeng et al. 1998) as + +.. math:: + :label: 5.10 + + \frac{k\left(z-d\right)}{u_{*} } \frac{\partial \left|{\it u}\right|}{\partial z} =\phi _{m} \left(\zeta \right) + +.. math:: + :label: 5.11 + + \frac{k\left(z-d\right)}{\theta _{*} } \frac{\partial \theta }{\partial z} =\phi _{h} \left(\zeta \right) + +.. math:: + :label: 5.12 + + \frac{k\left(z-d\right)}{q_{*} } \frac{\partial q}{\partial z} =\phi _{w} \left(\zeta \right) + +where :math:`z` is height in the surface layer (m), :math:`d` is the +displacement height (m), :math:`L` is the Monin-Obukhov length scale (m) +that accounts for buoyancy effects resulting from vertical density +gradients (i.e., the atmospheric stability), k is the von Karman +constant (Table 2.6), and :math:`\left|{\it u}\right|` is the +atmospheric wind speed (m s\ :math:`{}^{-1}`). :math:`\phi _{m}` , +:math:`\phi _{h}` , and :math:`\phi _{w}` are universal (over any +surface) similarity functions of :math:`\zeta` that relate the constant +fluxes of momentum, sensible heat, and latent heat to the mean profile +gradients of :math:`\left|{\it u}\right|`, :math:`\theta` , and +:math:`q` in the surface layer. In neutral conditions, +:math:`\phi _{m} =\phi _{h} =\phi _{w} =1`. The velocity (i.e., friction +velocity) :math:`u_{\*}` (m s\ :math:`{}^{-1}`), temperature +:math:`\theta _{\*}` (K), and moisture :math:`q_{\*}` (kg +kg\ :math:`{}^{-1}`) scales are + +.. math:: + :label: 5.13 + + u_{*}^{2} =\sqrt{\left(\overline{u'w'}\right)^{2} +\left(\overline{v'w'}\right)^{2} } =\frac{\left|{\it \tau }\right|}{\rho _{atm} } + +.. math:: + :label: 5.14 + + \theta _{*} u_{*} =-\overline{\theta 'w'}=-\frac{H}{\rho _{atm} C_{p} } + +.. math:: + :label: 5.15 + + q_{*} u_{*} =-\overline{q'w'}=-\frac{E}{\rho _{atm} } + +where :math:`\left|{\it \tau }\right|` is the shearing stress (kg +m\ :math:`{}^{-1}` s\ :math:`{}^{-2}`), with zonal and meridional +components :math:`\overline{u'w'}=-\frac{\tau _{x} }{\rho _{atm} }` and +:math:`\overline{v'w'}=-\frac{\tau _{y} }{\rho _{atm} }` , respectively, +:math:`H` is the sensible heat flux (W m\ :math:`{}^{-2}`) and :math:`E` +is the water vapor flux (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`). + +The dimensionless length scale :math:`L` is the Monin-Obukhov length +defined as + +.. math:: + :label: 5.16 + + L=-\frac{u_{*}^{3} }{k\left(\frac{g}{\overline{\theta _{v,\, atm} }} \right)\theta '_{v} w'} =\frac{u_{*}^{2} \overline{\theta _{v,\, atm} }}{kg\theta _{v*} } + +where :math:`g` is the acceleration of gravity (m s\ :math:`{}^{-2}`) +(Table 2.6), and +:math:`\overline{\theta _{v,\, atm} }=\overline{\theta _{atm} }\left(1+0.61q_{atm} \right)` +is the reference virtual potential temperature. :math:`L>0` indicates +stable conditions. :math:`L<0` indicates unstable conditions. +:math:`L=\infty` for neutral conditions. The temperature scale +:math:`\theta _{v*}` is defined as + +.. math:: + :label: ZEqnNum632600 + + \theta _{v*} u_{*} =\left[\theta _{*} \left(1+0.61q_{atm} \right)+0.61\overline{\theta _{atm} }q_{*} \right]u_{*} + +where :math:`\overline{\theta _{atm} }` is the atmospheric potential +temperature. + +Following Panofsky and Dutton (1984), the differential equations for +:math:`\phi _{m} \left(\zeta \right)`, +:math:`\phi _{h} \left(\zeta \right)`, and +:math:`\phi _{w} \left(\zeta \right)` can be integrated formally without +commitment to their exact forms. Integration between two arbitrary +heights in the surface layer :math:`z_{2}` and :math:`z_{1}` +(:math:`z_{2} >z_{1}` ) with horizontal winds +:math:`\left|{\it u}\right|_{1}` and :math:`\left|{\it u}\right|_{2}` , +potential temperatures :math:`\theta _{1}` and :math:`\theta _{2}` , +and specific humidities :math:`q_{1}` and :math:`q_{2}` results in + +.. math:: + :label: 5.18 + + \left|{\it u}\right|_{2} -\left|{\it u}\right|_{1} =\frac{u_{*} }{k} \left[\ln \left(\frac{z_{2} -d}{z_{1} -d} \right)-\psi _{m} \left(\frac{z_{2} -d}{L} \right)+\psi _{m} \left(\frac{z_{1} -d}{L} \right)\right] + +.. math:: + :label: 5.19 + + \theta _{2} -\theta _{1} =\frac{\theta _{*} }{k} \left[\ln \left(\frac{z_{2} -d}{z_{1} -d} \right)-\psi _{h} \left(\frac{z_{2} -d}{L} \right)+\psi _{h} \left(\frac{z_{1} -d}{L} \right)\right] + +.. math:: + :label: 5.20 + + q_{2} -q_{1} =\frac{q_{*} }{k} \left[\ln \left(\frac{z_{2} -d}{z_{1} -d} \right)-\psi _{w} \left(\frac{z_{2} -d}{L} \right)+\psi _{w} \left(\frac{z_{1} -d}{L} \right)\right]. + +The functions :math:`\psi _{m} \left(\zeta \right)`, +:math:`\psi _{h} \left(\zeta \right)`, and +:math:`\psi _{w} \left(\zeta \right)` are defined as + +.. math:: + :label: 5.21 + + \psi _{m} \left(\zeta \right)=\int _{{z_{0m} \mathord{\left/ {\vphantom {z_{0m} L}} \right. \kern-\nulldelimiterspace} L} }^{\zeta }\frac{\left[1-\phi _{m} \left(x\right)\right]}{x} \, dx + +.. math:: + :label: 5.22 + + \psi _{h} \left(\zeta \right)=\int _{{z_{0h} \mathord{\left/ {\vphantom {z_{0h} L}} \right. \kern-\nulldelimiterspace} L} }^{\zeta }\frac{\left[1-\phi _{h} \left(x\right)\right]}{x} \, dx + +.. math:: + :label: 5.23 + + \psi _{w} \left(\zeta \right)=\int _{{z_{0w} \mathord{\left/ {\vphantom {z_{0w} L}} \right. \kern-\nulldelimiterspace} L} }^{\zeta }\frac{\left[1-\phi _{w} \left(x\right)\right]}{x} \, dx + +where :math:`z_{0m}` , :math:`z_{0h}` , and :math:`z_{0w}` are the +roughness lengths (m) for momentum, sensible heat, and water vapor, +respectively. + +Defining the surface values + +.. math:: \left|{\it u}\right|_{1} =0{\rm \; at\; }z_{1} =z_{0m} +d, + +.. math:: \theta _{1} =\theta _{s} {\rm \; at\; }z_{1} =z_{0h} +d,{\rm \; and} + +.. math:: q_{1} =q_{s} {\rm \; at\; }z_{1} =z_{0w} +d, + +and the atmospheric values at :math:`z_{2} =z_{atm,\, x}` + +.. math:: + :label: ZEqnNum228149 + + \left|{\it u}\right|_{2} =V_{a} {\rm =\; }\sqrt{u_{atm}^{2} +v_{atm}^{2} +U_{c}^{2} } \ge 1, + +.. math:: \theta _{2} =\theta _{atm} {\rm ,\; and} + +.. math:: q_{2} =q_{atm} {\rm ,\; } + +the integral forms of the flux-gradient relations are + +.. math:: + :label: 5.25 + + V_{a} =\frac{u_{*} }{k} \left[\ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right] + +.. math:: + :label: 5.26 + + \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left[\ln \left(\frac{z_{atm,\, h} -d}{z_{0h} } \right)-\psi _{h} \left(\frac{z_{atm,\, h} -d}{L} \right)+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right] + +.. math:: + :label: 5.27 + + q_{atm} -q_{s} =\frac{q_{*} }{k} \left[\ln \left(\frac{z_{atm,\, w} -d}{z_{0w} } \right)-\psi _{w} \left(\frac{z_{atm,\, w} -d}{L} \right)+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right]. + +The constraint :math:`V_{a} \ge 1` is required simply for numerical +reasons to prevent :math:`H` and :math:`E` from becoming small with +small wind speeds. The convective velocity :math:`U_{c}` accounts for +the contribution of large eddies in the convective boundary layer to +surface fluxes as follows + +.. math:: + :label: 5.28 + + {U_{c} = 0\ \qquad \zeta \ge {\rm 0} {\rm (stable)}} \\ + {U_{c} = \beta w_{\*} \qquad \zeta <0 {\rm (unstable})} + +where :math:`w_{\*}` is the convective velocity scale + +.. math:: + :label: 5.29 + + w_{\*} =\left(\frac{-gu_{\*} \theta _{v*} z_{i} }{\overline{\theta _{v,\, atm} }} \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } , + +:math:`z_{i} =1000` is the convective boundary layer height (m), and :math:`\beta =1`. + +The momentum flux gradient relations are (Zeng et al. 1998) + +.. math:: + :label: 5.30 + + \begin{array}{l} {\phi _{m} \left(\zeta \right)=0.7k^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \left(-\zeta \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } \qquad {\rm for\; }\zeta <-1.574{\rm \; (very\; unstable)}} \\ {\phi _{m} \left(\zeta \right)=\left(1-16\zeta \right)^{-{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} } \qquad {\rm for\; -1.574}\le \zeta <0{\rm \; (unstable)}} \\ {\phi _{m} \left(\zeta \right)=1+5\zeta \qquad {\rm for\; }0\le \zeta \le 1{\rm \; (stable)}} \\ {\phi _{m} \left(\zeta \right)=5+\zeta \qquad {\rm for\; }\zeta {\rm >1\; (very\; stable).}} \end{array} + +The sensible and latent heat flux gradient relations are (Zeng et al. +1998) + +.. math:: + :label: 5.31 + + \begin{array}{l} {\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=0.9k^{{4\mathord{\left/ {\vphantom {4 3}} \right. \kern-\nulldelimiterspace} 3} } \left(-\zeta \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } \qquad {\rm for\; }\zeta <-0.465{\rm \; (very\; unstable)}} \\ {\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=\left(1-16\zeta \right)^{-{1\mathord{\left/ {\vphantom {1 2}} \right. \kern-\nulldelimiterspace} 2} } \qquad {\rm for\; -0.465}\le \zeta <0{\rm \; (unstable)}} \\ {\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=1+5\zeta \qquad {\rm for\; }0\le \zeta \le 1{\rm \; (stable)}} \\ {\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=5+\zeta \qquad {\rm for\; }\zeta {\rm >1\; (very\; stable).}} \end{array} + +To ensure continuous functions of +:math:`\phi _{m} \left(\zeta \right)`, +:math:`\phi _{h} \left(\zeta \right)`, and +:math:`\phi _{w} \left(\zeta \right)`, the simplest approach (i.e., +without considering any transition regimes) is to match the relations +for very unstable and unstable conditions at :math:`\zeta _{m} =-1.574` +for :math:`\phi _{m} \left(\zeta \right)` and +:math:`\zeta _{h} =\zeta _{w} =-0.465` for +:math:`\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)` +(Zeng et al. 1998). The flux gradient relations can be integrated to +yield wind profiles for the following conditions: + +Very unstable :math:`\left(\zeta <-1.574\right)` + +.. math:: + :label: ZEqnNum566843 + + V_{a} =\frac{u_{*} }{k} \left\{\left[\ln \frac{\zeta _{m} L}{z_{0m} } -\psi _{m} \left(\zeta _{m} \right)\right]+1.14\left[\left(-\zeta \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } -\left(-\zeta _{m} \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } \right]+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right\} + +Unstable :math:`\left(-1.574\le \zeta <0\right)` + +.. math:: + :label: ZEqnNum309568 + + V_{a} =\frac{u_{*} }{k} \left\{\left[\ln \frac{z_{atm,\, m} -d}{z_{0m} } -\psi _{m} \left(\zeta \right)\right]+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right\} + +Stable :math:`\left(0\le \zeta \le 1\right)` + +.. math:: + :label: ZEqnNum973766 + + V_{a} =\frac{u_{*} }{k} \left\{\left[\ln \frac{z_{atm,\, m} -d}{z_{0m} } +5\zeta \right]-5\frac{z_{0m} }{L} \right\} + +Very stable :math:`\left(\zeta >1\right)` + +.. math:: + :label: ZEqnNum310559 + + V_{a} =\frac{u_{*} }{k} \left\{\left[\ln \frac{L}{z_{0m} } +5\right]+\left[5\ln \zeta +\zeta -1\right]-5\frac{z_{0m} }{L} \right\} + +where + +.. math:: + :label: 5.36 + + \psi _{m} \left(\zeta \right)=2\ln \left(\frac{1+x}{2} \right)+\ln \left(\frac{1+x^{2} }{2} \right)-2\tan ^{-1} x+\frac{\pi }{2} + +and + +:math:`x=\left(1-16\zeta \right)^{{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} }` . + +The potential temperature profiles are: + +Very unstable :math:`\left(\zeta <-0.465\right)` + +.. math:: + :label: ZEqnNum382106 + + \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left\{\left[\ln \frac{\zeta _{h} L}{z_{0h} } -\psi _{h} \left(\zeta _{h} \right)\right]+0.8\left[\left(-\zeta _{h} \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } -\left(-\zeta \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } \right]+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right\} + +Unstable :math:`\left(-0.465\le \zeta <0\right)` + +.. math:: + :label: ZEqnNum767002 + + \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left\{\left[\ln \frac{z_{atm,\, h} -d}{z_{0h} } -\psi _{h} \left(\zeta \right)\right]+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right\} + + +Stable :math:`\left(0\le \zeta \le 1\right)` + +.. math:: + :label: ZEqnNum556410 + + \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left\{\left[\ln \frac{z_{atm,\, h} -d}{z_{0h} } +5\zeta \right]-5\frac{z_{0h} }{L} \right\} + +Very stable :math:`\left(\zeta >1\right)` + +.. math:: + :label: ZEqnNum846197 + + \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left\{\left[\ln \frac{L}{z_{0h} } +5\right]+\left[5\ln \zeta +\zeta -1\right]-5\frac{z_{0h} }{L} \right\}. + +The specific humidity profiles are: + +Very unstable :math:`\left(\zeta <-0.465\right)` + +.. math:: + :label: ZEqnNum299834 + + q_{atm} -q_{s} =\frac{q_{*} }{k} \left\{\left[\ln \frac{\zeta _{w} L}{z_{0w} } -\psi _{w} \left(\zeta _{w} \right)\right]+0.8\left[\left(-\zeta _{w} \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } -\left(-\zeta \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } \right]+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right\} + +Unstable :math:`\left(-0.465\le \zeta <0\right)` + +.. math:: + + \label{ZEqnNum142122} + q_{atm} -q_{s} =\frac{q_{*} }{k} \left\{\left[\ln \frac{z_{atm,\, w} -d}{z_{0w} } -\psi _{w} \left(\zeta \right)\right]+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right\} + +Stable :math:`\left(0\le \zeta \le 1\right)` + +.. math:: + :label: ZEqnNum350694 + + q_{atm} -q_{s} =\frac{q_{*} }{k} \left\{\left[\ln \frac{z_{atm,\, w} -d}{z_{0w} } +5\zeta \right]-5\frac{z_{0w} }{L} \right\} + +Very stable :math:`\left(\zeta >1\right)` + +.. math:: + :label: ZEqnNum211437 + + q_{atm} -q_{s} =\frac{q_{*} }{k} \left\{\left[\ln \frac{L}{z_{0w} } +5\right]+\left[5\ln \zeta +\zeta -1\right]-5\frac{z_{0w} }{L} \right\} + +where + +.. math:: + :label: 5.45 + + \psi _{h} \left(\zeta \right)=\psi _{w} \left(\zeta \right)=2\ln \left(\frac{1+x^{2} }{2} \right). + +Using the definitions of :math:`u_{*}` , :math:`\theta _{*}` , and +:math:`q_{*}` , an iterative solution of these equations can be used to +calculate the surface momentum, sensible heat, and water vapor flux +using atmospheric and surface values for :math:`\left|{\it u}\right|`, +:math:`\theta` , and :math:`q` except that :math:`L` depends on +:math:`u_{*}` , :math:`\theta _{*}` , and :math:`q_{*}` . However, the +bulk CityplaceRichardson number + +.. math:: + :label: ZEqnNum750428} + + R_{iB} =\frac{\theta _{v,\, atm} -\theta _{v,\, s} }{\overline{\theta _{v,\, atm} }} \frac{g\left(z_{atm,\, m} -d\right)}{V_{a}^{2} } + + +is related to :math:`\zeta` (Arya 2001) as + +.. math:: + :label: 5.47 + + R_{iB} =\zeta \left[\ln \left(\frac{z_{atm,\, h} -d}{z_{0h} } \right)-\psi _{h} \left(\zeta \right)\right]\left[\ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)-\psi _{m} \left(\zeta \right)\right]^{-2} . + +Using +:math:`\phi _{h} =\phi _{m}^{2} =\left(1-16\zeta \right)^{-{1\mathord{\left/ {\vphantom {1 2}} \right. \kern-\nulldelimiterspace} 2} }` +for unstable conditions and :math:`\phi _{h} =\phi _{m} =1+5\zeta` for +stable conditions to determine :math:`\psi _{m} \left(\zeta \right)` and +:math:`\psi _{h} \left(\zeta \right)`, the inverse relationship +:math:`\zeta =f\left(R_{iB} \right)` can be solved to obtain a first +guess for :math:`\zeta` and thus :math:`L` from + +.. math:: + + \label{ZEqnNum979946} + \begin{array}{l} {\zeta =\frac{R_{iB} \ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)}{1-5\min \left(R_{iB} ,0.19\right)} \qquad 0.01\le \zeta \le 2\qquad {\rm for\; }R_{iB} \ge 0{\rm \; (neutral\; or\; stable)}} \\ {\zeta =R_{iB} \ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)\qquad -100\le \zeta \le -0.01\qquad {\rm for\; }R_{iB} <0{\rm \; (unstable)}} \end{array}. + +Upon iteration (section 5.3.2), the following is used to determine +:math:`\zeta` and thus :math:`L` + +.. math:: + + \label{ZEqnNum153243} + \zeta =\frac{\left(z_{atm,\, m} -d\right)kg\theta _{v*} }{u_{*}^{2} \overline{\theta _{v,\, atm} }} + +where + +.. math:: \begin{array}{l} {0.01\le \zeta \le 2\qquad {\rm for\; }\zeta \ge 0{\rm \; (neutral\; or\; stable)}} \\ {{\rm -100}\le \zeta \le {\rm -0.01}\qquad {\rm for\; }\zeta <0{\rm \; (unstable)}} \end{array}. + +The difference in virtual potential air temperature between the +reference height and the surface is + +.. math:: + :label: ZEqnNum516498 + + \theta _{v,\, atm} -\theta _{v,\, s} =\left(\theta _{atm} -\theta _{s} \right)\left(1+0.61q_{atm} \right)+0.61\overline{\theta _{atm} }\left(q_{atm} -q_{s} \right). + +The momentum, sensible heat, and water vapor fluxes between the surface +and the atmosphere can also be written in the form + +.. math:: + :label: ZEqnNum567382 + + \tau _{x} =-\rho _{atm} \frac{\left(u_{atm} -u_{s} \right)}{r_{am} } + +.. math:: + :label: ZEqnNum615113 + + \tau _{y} =-\rho _{atm} \frac{\left(v_{atm} -v_{s} \right)}{r_{am} } + +.. math:: + :label: ZEqnNum588623 + + H=-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -\theta _{s} \right)}{r_{ah} } + +.. math:: + :label: ZEqnNum154565 + + E=-\rho _{atm} \frac{\left(q_{atm} -q_{s} \right)}{r_{aw} } + +where the aerodynamic resistances (s m\ :math:`{}^{-1}`) are + +.. math:: + :label: ZEqnNum660763 + + r_{am} =\frac{V_{a} }{u_{*}^{2} } =\frac{1}{k^{2} V_{a} } \left[\ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right]^{2} + +.. math:: + :label: ZEqnNum193138 + + \begin{array}{l} {r_{ah} =\frac{\theta _{atm} -\theta _{s} }{\theta _{*} u_{*} } =\frac{1}{k^{2} V_{a} } \left[\ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right]} \\ {\qquad \left[\ln \left(\frac{z_{atm,\, h} -d}{z_{0h} } \right)-\psi _{h} \left(\frac{z_{atm,\, h} -d}{L} \right)+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right]} \end{array} + +.. math:: + :label: ZEqnNum382229 + + \begin{array}{l} {r_{aw} =\frac{q_{atm} -q_{s} }{q_{*} u_{*} } =\frac{1}{k^{2} V_{a} } \left[\ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right]} \\ {\qquad \left[\ln \left(\frac{z_{atm,\, {\it w}} -d}{z_{0w} } \right)-\psi _{w} \left(\frac{z_{atm,\, w} -d}{L} \right)+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right]} \end{array}. + +A 2-m height “screen” temperature is useful for comparison with +observations + +.. math:: + :label: ZEqnNum664652 + + T_{2m} =\theta _{s} +\frac{\theta _{*} }{k} \left[\ln \left(\frac{2+z_{0h} }{z_{0h} } \right)-\psi _{h} \left(\frac{2+z_{0h} }{L} \right)+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right] + +where for convenience, “2-m” is defined as 2 m above the apparent sink +for sensible heat (:math:`z_{0h} +d`). Similarly, a 2-m height specific +humidity is defined as + +.. math:: + :label: ZEqnNum735237 + + q_{2m} =q_{s} +\frac{q_{*} }{k} \left[\ln \left(\frac{2+z_{0w} }{z_{0w} } \right)-\psi _{w} \left(\frac{2+z_{0w} }{L} \right)+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right]. + +Relative humidity is + +.. math:: + :label: ZEqnNum299365 + + RH_{2m} =\min \left(100,\, \frac{q_{2m} }{q_{sat}^{T_{2m} } } \times 100\right) + +where :math:`q_{sat}^{T_{2m} }` is the saturated specific humidity at +the 2-m temperature :math:`T_{2m}` (section 5.5). + +A 10-m wind speed is calculated as (note that this is not consistent +with the 10-m wind speed calculated for the dust model as described in +Chapter 24) + +.. math:: + :label: 5.61 + + u_{10m} =\left\{\begin{array}{l} {V_{a} \qquad z_{atm,\, m} \le 10} \\ {V_{a} -\frac{u_{*} }{k} \left[\ln \left(\frac{z_{atm,\, m} -d}{10+z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{10+z_{0m} }{L} \right)\right]\qquad z_{atm,\, m} >10} \end{array}\right\} + +Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces +-------------------------------------------------------------- + +Surfaces are considered non-vegetated for the surface flux calculations +if leaf plus stem area index :math:`L+S<0.05` (section 2.1.4). By +definition, this includes bare soil, wetlands, and glaciers. The +solution for lakes is described in Chapter 9. For these surfaces, the +surface may be exposed to the atmosphere, snow covered, and/or surface +water covered, so that the sensible heat flux :math:`H_{g}` (W +m\ :math:`{}^{-2}`) is, with reference to Figure 5.1, + +.. math:: + :label: ZEqnNum726771 + + H_{g} =\left(1-f_{sno} -f_{h2osfc} \right)H_{soil} +f_{sno} H_{snow} +f_{h2osfc} H_{h2osfc} + +where :math:`\left(1-f_{sno} -f_{h2osfc} \right)`, :math:`f_{sno}` , and +:math:`f_{h2osfc}` are the exposed, snow covered, and surface water +covered fractions of the grid cell. The individual fluxes based on the +temperatures of the soil :math:`T_{1}` , snow :math:`T_{snl+1}` , and +surface water :math:`T_{h2osfc}` are + +.. math:: + :label: 5.63 + + H_{soil} =-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{1} \right)}{r_{ah} } + +.. math:: + :label: 5.64 + + H_{sno} =-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{snl+1} \right)}{r_{ah} } + +.. math:: + :label: 5.65 + + H_{h2osfc} =-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{h2osfc} \right)}{r_{ah} } + +where :math:`\rho _{atm}` is the density of atmospheric air (kg +m\ :math:`{}^{-3}`), :math:`C_{p}` is the specific heat capacity of air +(J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), +:math:`\theta _{atm}` is the atmospheric potential temperature (K), and +:math:`r_{ah}` is the aerodynamic resistance to sensible heat transfer +(s m\ :math:`{}^{-1}`). + +The water vapor flux :math:`E_{g}` (kg m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`) is, with reference to Figure 5.2, + +.. math:: + :label: ZEqnNum419297 + + E_{g} =\left(1-f_{sno} -f_{h2osfc} \right)E_{soil} +f_{sno} E_{snow} +f_{h2osfc} E_{h2osfc} + +.. math:: + :label: 5.67 + + E_{soil} =-\frac{\beta _{soi} \rho _{atm} \left(q_{atm} -q_{soil} \right)}{r_{aw} } + +.. math:: + :label: 5.68 + + E_{sno} =-\frac{\rho _{atm} \left(q_{atm} -q_{sno} \right)}{r_{aw} } + +.. math:: + :label: 5.69 + + E_{h2osfc} =-\frac{\rho _{atm} \left(q_{atm} -q_{h2osfc} \right)}{r_{aw} } + +where :math:`\beta _{soi}` is an empirical function of soil water +(Sakaguchi and Zeng 2009), :math:`q_{atm}` is the atmospheric specific +humidity (kg kg\ :math:`{}^{-1}`), :math:`q_{soil}` , :math:`q_{sno}` , +and :math:`q_{h2osfc}` are the specific humidities (kg +kg\ :math:`{}^{-1}`) of the soil, snow, and surface water, respectively, +and :math:`r_{aw}` is the aerodynamic resistance to water vapor +transfer (s m\ :math:`{}^{-1}`). The specific humidities of the snow +:math:`q_{sno}` and surface water :math:`q_{h2osfc}` are assumed to be +at the saturation specific humidity of their respective temperatures + +.. math:: + :label: 5.70) + + q_{sno} =q_{sat}^{T_{snl+1} } + +.. math:: + :label: 5.71) + + q_{h2osfc} =q_{sat}^{T_{h2osfc} } + +The specific humidity of the soil surface :math:`q_{soil}` is assumed +to be proportional to the saturation specific humidity + +.. math:: + :label: 5.72) + + q_{soil} =\alpha _{soil} q_{sat}^{T_{1} } + +where :math:`q_{sat}^{T_{1} }` is the saturated specific humidity at +the soil surface temperature :math:`T_{1}` (section 5.5). The factor +:math:`\alpha _{soil}` is a function of the surface soil water matric +potential :math:`\psi` as in Philip (1957) + +.. math:: + :label: 5.73) + + \alpha _{soil} =\exp \left(\frac{\psi _{1} g}{1\times 10^{3} R_{wv} T_{1} } \right) + +where :math:`R_{wv}` is the gas constant for water vapor (J +kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), :math:`g` is the +gravitational acceleration (m s\ :math:`{}^{-2}`) (Table 2.6), and +:math:`\psi _{1}` is the soil water matric potential of the top soil +layer (mm). The soil water matric potential :math:`\psi _{1}` is + +.. math:: + :label: 5.74) + + \psi _{1} =\psi _{sat,\, 1} s_{1}^{-B_{1} } \ge -1\times 10^{8} + +where :math:`\psi _{sat,\, 1}` is the saturated matric potential (mm) +(section 7.4.1), :math:`B_{1}` is the Clapp and Hornberger (1978) +parameter (section 7.4.1), and :math:`s_{1}` is the wetness of the top +soil layer with respect to saturation. The surface wetness +:math:`s_{1}` is a function of the liquid water and ice content + +.. math:: + :label: 5.75) + + s_{1} =\frac{1}{\Delta z_{1} \theta _{sat,\, 1} } \left[\frac{w_{liq,\, 1} }{\rho _{liq} } +\frac{w_{ice,\, 1} }{\rho _{ice} } \right]\qquad 0.01\le s_{1} \le 1.0 + +where :math:`\Delta z_{1}` is the thickness of the top soil layer (m), +:math:`\rho _{liq}` and :math:`\rho _{ice}` are the density of liquid +water and ice (kg m\ :math:`{}^{-3}`) (Table 2.6), :math:`w_{liq,\, 1}` +and :math:`w_{ice,\, 1}` are the mass of liquid water and ice of the +top soil layer (:math:`\text{kg} \text{m}^{-2}`) (Chapter 7), and +:math:`\theta _{sat,\, 1}` is the saturated volumetric water content +(i.e., porosity) of the top soil layer (:math:`\text{mm}^{3}` :math:`\text{mm}^{-3}`) (section 7.4.1). If +:math:`q_{sat}^{T_{1} } >q_{atm}` and :math:`q_{atm} >q_{soil}` , then +:math:`q_{soil} =q_{atm}` and :math:`\frac{dq_{soil} }{dT} =0`. This +prevents large increases (decreases) in :math:`q_{soil}` for small +increases (decreases) in soil moisture in very dry soils. + +The function :math:`\beta _{soi}` ranges from 0 to 1 and is intended to +represent the molecular diffusion process from the soil pore to the +surface within the dry part of the soil (Sakaguchi and Zeng 2009) as + +.. math:: + :label: 5.76) + + \beta _{soi} =\left\{\begin{array}{l} {1\qquad \theta _{1} \ge \theta _{fc,\, 1} {\rm \; or\; }q_{atm} -q_{soil} >0} \\ {0.25\left(1-f_{sno} -f_{h2osfc} \right)\left[1-\cos \left(\pi \frac{\theta _{1} }{\theta _{fc,\, 1} } \right)\right]^{2} +f_{sno} +f_{h2osfc} \qquad \theta _{1} <\theta _{fc,\, 1} } \end{array}\right\}. + +where :math:`\theta _{fc,\, 1}` is the field capacity of the top soil +layer and +:math:`0.01{\le \theta _{1} \mathord{\left/ {\vphantom {\le \theta _{1} \theta _{fc,\, 1} \le 1}} \right. \kern-\nulldelimiterspace} \theta _{fc,\, 1} \le 1}` . +The volumetric water content of the top soil layer (:math:`\text{mm}^{3}` :math:`\text{mm}^{-3}`) is + +.. math:: + :label: 5.77) + + \theta _{1} =\frac{1}{\Delta z_{1} } \left[\frac{w_{liq,\, 1} }{\rho _{liq} } +\frac{w_{ice,\, 1} }{\rho _{ice} } \right]. + +The volumetric water content at field capacity is derived by assuming a +hydraulic conductivity of 0.1 mm day\ :math:`{}^{-1}` and inverting the +hydraulic conductivity function (section 7.4.1) as + +.. math:: + :label: 5.78) + + \theta _{fc,\, 1} =\theta _{sat,\, 1} \left[\frac{0.1}{86400k_{sat,\, 1} } \right]^{\frac{1}{2B_{i} +3} } + +where :math:`k_{sat,\, 1}` is the saturated hydraulic conductivity of +the top soil layer (mm s\ :math:`{}^{-1}`) (section 7.4.1) and the +exponent :math:`B_{1}` is a function of soil texture (section 7.4.1). + +The roughness lengths used to calculate :math:`r_{am}` , +:math:`r_{ah}` , and :math:`r_{aw}` are :math:`z_{0m} =z_{0m,\, g}` , +:math:`z_{0h} =z_{0h,\, g}` , and :math:`z_{0w} =z_{0w,\, g}` . The +displacement height :math:`d=0`. The momentum roughness length is +:math:`z_{0m,\, g} =0.01` for soil, glaciers, and wetland, and +:math:`z_{0m,\, g} =0.0024` for snow-covered surfaces +(:math:`f_{sno} >0`). In general, :math:`z_{0m}` is different from +:math:`z_{0h}` because the transfer of momentum is affected by pressure +fluctuations in the turbulent waves behind the roughness elements, while +for heat and water vapor transfer no such dynamical mechanism exists. +Rather, heat and water vapor must be transferred by molecular diffusion +across the interfacial sublayer. The following relation from +Zilitinkevich (1970) is adopted by Zeng and Dickinson (1998) + +.. math:: + :label: ZEqnNum844212 + + z_{0h,\, g} =z_{0w,\, g} =z_{0m,\, g} e^{-a\left({u_{*} z_{0m,\, g} \mathord{\left/ {\vphantom {u_{*} z_{0m,\, g} \upsilon }} \right. \kern-\nulldelimiterspace} \upsilon } \right)^{0.45} } + +where the quantity +:math:`{u_{*} z_{0m,\, g} \mathord{\left/ {\vphantom {u_{*} z_{0m,\, g} \upsilon }} \right. \kern-\nulldelimiterspace} \upsilon }` +is the roughness Reynolds number (and may be interpreted as the Reynolds +number of the smallest turbulent eddy in the flow) with the kinematic +viscosity of air :math:`\upsilon =1.5\times 10^{-5}` m\ :math:`{}^{2}` +s\ :math:`{}^{-1}` and :math:`a=0.13`. + +The numerical solution for the fluxes of momentum, sensible heat, and +water vapor flux from non-vegetated surfaces proceeds as follows: + +#. An initial guess for the wind speed :math:`V_{a}` is obtained from + eq. assuming an initial convective velocity :math:`U_{c} =0` m + s\ :math:`{}^{-1}` for stable conditions + (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` as evaluated from + eq. ) and :math:`U_{c} =0.5` for unstable conditions + (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). + +#. An initial guess for the Monin-Obukhov length :math:`L` is obtained + from the bulk Richardson number using eqs. and . + +#. The following system of equations is iterated three times: + +#. Friction velocity :math:`u_{*}` (eqs. , , , ) + +#. Potential temperature scale :math:`\theta _{*}` (eqs. , , , ) + +#. Humidity scale :math:`q_{*}` (eqs. , , , ) + +#. Roughness lengths for sensible :math:`z_{0h,\, g}` and latent heat + :math:`z_{0w,\, g}` (eq. ) + +#. Virtual potential temperature scale :math:`\theta _{v*}` (eq. ) + +#. Wind speed including the convective velocity, :math:`V_{a}` (eq. ) + +#. Monin-Obukhov length :math:`L` (eq. ) + +#. Aerodynamic resistances :math:`r_{am}` , :math:`r_{ah}` , and + :math:`r_{aw}` (eqs. , , ) + +#. Momentum fluxes :math:`\tau _{x}` , :math:`\tau _{y}` (eqs. , ) + +#. Sensible heat flux :math:`H_{g}` (eq. ) + +#. Water vapor flux :math:`E_{g}` (eq. ) + +#. 2-m height air temperature :math:`T_{2m}` and specific humidity + :math:`q_{2m}` (eqs. , ) + +The partial derivatives of the soil surface fluxes with respect to +ground temperature, which are needed for the soil temperature +calculations (section 6.1) and to update the soil surface fluxes +(section 5.4), are + +.. math:: + :label: ZEqnNum806472 + + \frac{\partial H_{g} }{\partial T_{g} } =\frac{\rho _{atm} C_{p} }{r_{ah} } + +.. math:: + :label: ZEqnNum497230 + + \frac{\partial E_{g} }{\partial T_{g} } =\frac{\beta _{soi} \rho _{atm} }{r_{aw} } \frac{dq_{g} }{dT_{g} } + +where + +.. math:: + :label: 5.82) + + \frac{dq_{g} }{dT_{g} } =\left(1-f_{sno} -f_{h2osfc} \right)\alpha _{soil} \frac{dq_{sat}^{T_{soil} } }{dT_{soil} } +f_{sno} \frac{dq_{sat}^{T_{sno} } }{dT_{sno} } +f_{h2osfc} \frac{dq_{sat}^{T_{h2osfc} } }{dT_{h2osfc} } . + +The partial derivatives +:math:`\frac{\partial r_{ah} }{\partial T_{g} }` and +:math:`\frac{\partial r_{aw} }{\partial T_{g} }` , which cannot be +determined analytically, are ignored for +:math:`\frac{\partial H_{g} }{\partial T_{g} }` and +:math:`\frac{\partial E_{g} }{\partial T_{g} }` . + +Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces +-------------------------------------------------------------------------- + +In the case of a vegetated surface, the sensible heat :math:`H` and +water vapor flux :math:`E` are partitioned into vegetation and ground +fluxes that depend on vegetation :math:`T_{v}` and ground +:math:`T_{g}` temperatures in addition to surface temperature +:math:`T_{s}` and specific humidity :math:`q_{s}` . Because of the +coupling between vegetation temperature and fluxes, Newton-Raphson +iteration is used to solve for the vegetation temperature and the +sensible heat and water vapor fluxes from vegetation simultaneously +using the ground temperature from the previous time step. In section +5.3.1, the equations used in the iteration scheme are derived. Details +on the numerical scheme are provided in section 5.3.2. + +Theory +^^^^^^^^^^^^ + +The air within the canopy is assumed to have negligible capacity to +store heat so that the sensible heat flux :math:`H` between the surface +at height :math:`z_{0h} +d` and the atmosphere at height +:math:`z_{atm,\, h}` must be balanced by the sum of the sensible heat +from the vegetation :math:`H_{v}` and the ground :math:`H_{g}` + +.. math:: + :label: ZEqnNum550014 + + H=H_{v} +H_{g} + +where, with reference to Figure 5.1, + +.. math:: + :label: 5.84) + + H=-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{s} \right)}{r_{ah} } + +.. math:: + :label: ZEqnNum675188 + + H_{v} =-\rho _{atm} C_{p} \left(T_{s} -T_{v} \right)\frac{\left(L+S\right)}{r_{b} } + +.. math:: + :label: ZEqnNum293573 + + H_{g} =\left(1-f_{sno} -f_{h2osfc} \right)H_{soil} +f_{sno} H_{snow} +f_{h2osfc} H_{h2osfc} + +.. math:: + :label: 5.87) + + H_{soil} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{1} \right)}{r_{ah} ^{{'} } } + +.. math:: + :label: 5.88) + + H_{sno} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{snl+1} \right)}{r_{ah} ^{{'} } } + +.. math:: + :label: 5.89) + + H_{h2osfc} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{h2osfc} \right)}{r_{ah} ^{{'} } } + +where :math:`\rho _{atm}` is the density of atmospheric air (kg +m\ :math:`{}^{-3}`), :math:`C_{p}` is the specific heat capacity of air +(J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), +:math:`\theta _{atm}` is the atmospheric potential temperature (K), and +:math:`r_{ah}` is the aerodynamic resistance to sensible heat transfer +(s m\ :math:`{}^{-1}`). + +Here, :math:`T_{s}` is the surface temperature at height +:math:`z_{0h} +d`, also referred to as the canopy air temperature. +:math:`L` and :math:`S` are the exposed leaf and stem area indices +(section 2.1.4), :math:`r_{b}` is the leaf boundary layer resistance (s +m\ :math:`{}^{-1}`), and :math:`r_{ah} ^{{'} }` is the aerodynamic +resistance (s m\ :math:`{}^{-1}`) to heat transfer between the ground at +height :math:`z_{0h} ^{{'} }` and the canopy air at height +:math:`z_{0h} +d`. + +Figure 5.1. Schematic diagram of sensible heat fluxes for (a) +non-vegetated surfaces and (b) vegetated surfaces. + +.. image:: image1.png + +Figure 5.2. Schematic diagram of water vapor fluxes for (a) +non-vegetated surfaces and (b) vegetated surfaces. + +.. image:: image2.png + +Equations - can be solved for the canopy air temperature :math:`T_{s}` + +.. math:: + :label: ZEqnNum103571 + + T_{s} =\frac{c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} +c_{v}^{h} T_{v} }{c_{a}^{h} +c_{g}^{h} +c_{v}^{h} } + +where + +.. math:: + :label: ZEqnNum298904 + + c_{a}^{h} =\frac{1}{r_{ah} } + +.. math:: + :label: ZEqnNum991533 + + c_{g}^{h} =\frac{1}{r_{ah} ^{{'} } } + +.. math:: + :label: ZEqnNum284616 + + c_{v}^{h} =\frac{\left(L+S\right)}{r_{b} } + +are the sensible heat conductances from the canopy air to the +atmosphere, the ground to canopy air, and leaf surface to canopy air, +respectively (m s\ :math:`{}^{-1}`). + +When the expression for :math:`T_{s}` is substituted into equation , +the sensible heat flux from vegetation :math:`H_{v}` is a function of +:math:`\theta _{atm}` , :math:`T_{g}` , and :math:`T_{v}` + +.. math:: + :label: ZEqnNum362496 + + H_{v} =-\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} -\left(c_{a}^{h} +c_{g}^{h} \right)T_{v} \right]\frac{c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } . + +Similarly, the expression for :math:`T_{s}` can be substituted into +equation to obtain the sensible heat flux from ground :math:`H_{g}` + +.. math:: + :label: ZEqnNum527667 + + H_{g} =-\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{v}^{h} T_{v} -\left(c_{a}^{h} +c_{v}^{h} \right)T_{g} \right]\frac{c_{g}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } . + +The air within the canopy is assumed to have negligible capacity to +store water vapor so that the water vapor flux :math:`E` between the +surface at height :math:`z_{0w} +d` and the atmosphere at height +:math:`z_{atm,\, w}` must be balanced by the sum of the water vapor +flux from the vegetation :math:`E_{v}` and the ground :math:`E_{g}` + +.. math:: + :label: ZEqnNum365017 + + E=E_{v} +E_{g} + +where, with reference to Figure 5.2, + +.. math:: + :label: 5.97) + + E=-\rho _{atm} \frac{\left(q_{atm} -q_{s} \right)}{r_{aw} } + +.. math:: + :label: ZEqnNum351492 + + E_{v} =-\rho _{atm} \frac{\left(q_{s} -q_{sat}^{T_{v} } \right)}{r_{total} } + +.. math:: + :label: ZEqnNum145330 + + E_{g} =\left(1-f_{sno} -f_{h2osfc} \right)E_{soil} +f_{sno} E_{snow} +f_{h2osfc} E_{h2osfc} + +.. math:: + :label: 5.100) + + E_{soil} =-\rho _{atm} \frac{\beta _{soi} \left(q_{s} -q_{soil} \right)}{r_{aw} ^{{'} } +r_{litter} } + +.. math:: + :label: 5.101) + + E_{sno} =-\rho _{atm} \frac{\left(q_{s} -q_{sno} \right)}{r_{aw} ^{{'} } +r_{litter} } + +.. math:: + :label: 5.102) + + E_{h2osfc} =-\rho _{atm} \frac{\left(q_{s} -q_{h2osfc} \right)}{r_{aw} ^{{'} } +r_{litter} } + +where :math:`q_{atm}` is the atmospheric specific humidity (kg +kg\ :math:`{}^{-1}`), :math:`r_{aw}` is the aerodynamic resistance to +water vapor transfer (s m\ :math:`{}^{-1}`), :math:`q_{sat}^{T_{v} }` +(kg kg\ :math:`{}^{-1}`) is the saturation water vapor specific humidity +at the vegetation temperature (section 5.5), :math:`q_{g}` , +:math:`q_{sno}` , and :math:`q_{h2osfc}` are the specific humidities +of the soil, snow, and surface water (section 5.2), +:math:`r_{aw} ^{{'} }` is the aerodynamic resistance (s +m\ :math:`{}^{-1}`) to water vapor transfer between the ground at height +:math:`z_{0w} ^{{'} }` and the canopy air at height :math:`z_{0w} +d`, +:math:`\beta _{soi}` is an empirical function of soil water (section +5.2), and :math:`r_{litter}` is a resistance for the plant litter layer +(s m\ :math:`{}^{-1}`). :math:`r_{total}` is the total resistance to +water vapor transfer from the canopy to the canopy air and includes +contributions from leaf boundary layer and sunlit and shaded stomatal +resistances :math:`r_{b}` , :math:`r_{s}^{sun}` , and +:math:`r_{s}^{sha}` (Figure 5.2). The water vapor flux from vegetation +is the sum of water vapor flux from wetted leaf and stem area +:math:`E_{v}^{w}` (evaporation of water intercepted by the canopy) and +transpiration from dry leaf surfaces :math:`E_{v}^{t}` + +.. math:: + :label: 5.103) + + E_{v} =E_{v}^{w} +E_{v}^{t} . + +Equations - can be solved for the canopy specific humidity +:math:`q_{s}` + +.. math:: + :label: ZEqnNum362168 + + q_{s} =\frac{c_{a}^{w} q_{atm} +c_{g}^{w} q_{g} +c_{v}^{w} q_{sat}^{T_{v} } }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } + +where + +.. math:: + :label: ZEqnNum533553 + + c_{a}^{w} =\frac{1}{r_{aw} } + +.. math:: + :label: ZEqnNum544982 + + c_{v}^{w} =\frac{\left(L+S\right)}{r_{b} } r'' + +.. math:: + :label: ZEqnNum888691 + + c_{g}^{w} =\frac{\beta _{soi} }{r_{aw} ^{{'} } +r_{litter} } + +are the water vapor conductances from the canopy air to the atmosphere, +the leaf to canopy air, and ground to canopy air, respectively. The term +:math:`r''` is determined from contributions by wet leaves and +transpiration and limited by available water and potential evaporation +as + +.. math:: + :label: ZEqnNum166006 + + r''=\left\{\begin{array}{l} {\min \left(f_{wet} +r_{dry} ^{{'} {'} } ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right)\qquad E_{v}^{w,\, pot} >0,\, \beta _{t} >0} \\ {\min \left(f_{wet} ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right)\qquad E_{v}^{w,\, pot} >0,\, \beta _{t} \le 0} \\ {1\qquad E_{v}^{w,\, pot} \le 0} \end{array}\right\} + +where :math:`f_{wet}` is the fraction of leaves and stems that are wet +(section 7.1), :math:`W_{can}` is canopy water (kg m\ :math:`{}^{-2}`) +(section 7.1), :math:`\Delta t` is the time step (s), and +:math:`\beta _{t}` is a soil moisture function limiting transpiration +(Chapter 8). The potential evaporation from wet foliage per unit wetted +area is + +.. math:: + :label: 5.109) + + E_{v}^{w,\, pot} =-\frac{\rho _{atm} \left(q_{s} -q_{sat}^{T_{v} } \right)}{r_{b} } . + +The term :math:`r_{dry} ^{{'} {'} }` is + +.. math:: + :label: 5.110) + + r_{dry} ^{{'} {'} } =\frac{f_{dry} r_{b} }{L} \left(\frac{L^{sun} }{r_{b} +r_{s}^{sun} } +\frac{L^{sha} }{r_{b} +r_{s}^{sha} } \right) + +where :math:`f_{dry}` is the fraction of leaves that are dry (section +7.1), :math:`L^{sun}` and :math:`L^{sha}` are the sunlit and shaded +leaf area indices (section 4.1), and :math:`r_{s}^{sun}` and +:math:`r_{s}^{sha}` are the sunlit and shaded stomatal resistances (s +m\ :math:`{}^{-1}`) (Chapter 8). + +When the expression for :math:`q_{s}` is substituted into equation , +the water vapor flux from vegetation :math:`E_{v}` is a function of +:math:`q_{atm}` , :math:`q_{g}` , and :math:`q_{sat}^{T_{v} }` + +.. math:: + :label: ZEqnNum256012 + + E_{v} =-\rho _{atm} \left[c_{a}^{w} q_{atm} +c_{g}^{w} q_{g} -\left(c_{a}^{w} +c_{g}^{w} \right)q_{sat}^{T_{v} } \right]\frac{c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } . + +Similarly, the expression for :math:`q_{s}` can be substituted into +equation to obtain the water vapor flux from the ground beneath the +canopy :math:`E_{g}` + +.. math:: + :label: ZEqnNum243941 + + E_{g} =-\rho _{atm} \left[c_{a}^{w} q_{atm} +c_{v}^{w} q_{sat}^{T_{v} } -\left(c_{a}^{w} +c_{v}^{w} \right)q_{g} \right]\frac{c_{g}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } . + +The aerodynamic resistances to heat (moisture) transfer between the +ground at height :math:`z_{0h} ^{{'} }` (:math:`z_{0w} ^{{'} }` ) and +the canopy air at height :math:`z_{0h} +d` (:math:`z_{0w} +d`) are + +.. math:: + :label: ZEqnNum496775 + + r_{ah} ^{{'} } =r_{aw} ^{{'} } =\frac{1}{C_{s} U_{av} } + +where + +.. math:: + :label: ZEqnNum781547 + + U_{av} =V_{a} \sqrt{\frac{1}{r_{am} V_{a} } } =u_{*} + +is the magnitude of the wind velocity incident on the leaves +(equivalent here to friction velocity) (m s\ :math:`{}^{-1}`) and +:math:`C_{s}` is the turbulent transfer coefficient between the +underlying soil and the canopy air. :math:`C_{s}` is obtained by +interpolation between values for dense canopy and bare soil (Zeng et al. +2005) + +.. math:: + :label: 5.115) + + C_{s} =C_{s,\, bare} W+C_{s,\, dense} (1-W) + +where the weight :math:`W` is + +.. math:: + :label: 5.116) + + W=e^{-\left(L+S\right)} . + +The dense canopy turbulent transfer coefficient in Zeng et al. (2005) +is modified from its original value of 0.004 (Dickinson et al. 1993) by +Sakaguchi and Zeng (2009) to account for stability as + +.. math:: + :label: 5.117) + + C_{s,\, dense} =\left\{\begin{array}{l} {0.004\qquad T_{s} -T_{g} \le 0} \\ {\frac{0.004}{1+\gamma \min \left(S,10\right)} \qquad T_{s} -T_{g} >0} \end{array}\right\} + +where :math:`\gamma =0.5` and :math:`S` is a stability parameter +determined from + +.. math:: + :label: 5.118) + + S=\frac{gz_{top} \left(T_{s} -T_{g} \right)}{T_{s} u_{*}^{2} } + +where :math:`g` is the gravitational acceleration (m +s\ :math:`{}^{-2}`) (Table 2.6), and :math:`z_{top}` is canopy top +height (m) (Table 2.2). The bare soil turbulent transfer coefficient is + +.. math:: + :label: 5.119) + + C_{s,\, bare} =\frac{k}{a} \left(\frac{z_{0m,\, g} U_{av} }{\upsilon } \right)^{-0.45} + +where the kinematic viscosity of air +:math:`\upsilon =1.5\times 10^{-5}` m\ :math:`{}^{2}` +s\ :math:`{}^{-1}` and :math:`a=0.13`. + +The litter resistance :math:`r_{litter}` (Sakaguchi and Zeng 2009) (s +m\ :math:`{}^{-1}`) is + +.. math:: + :label: 5.120) + + r_{litter} =\frac{1}{0.004u_{*} } \left(1-e^{-L_{litter}^{eff} } \right) + +where the effective litter area index :math:`L_{litter}^{eff}` +(:math:`\text{m}^{2}` :math:`\text{m}^{-2}`) is the fraction of plant litter +area index :math:`L_{litter}` (currently set to 0.5 :math:`\text{m}^{2}` +:math:`\text{m}^{-2}`) that is not covered by snow + +.. math:: + :label: 5.121) + + L_{litter}^{eff} =L_{litter} \left[1-\min \left(f_{litter}^{snow} ,\, 1\right)\right]. + +The effective snow cover of the litter layer is + +.. math:: + :label: 5.122) + + f_{litter}^{snow} =\frac{z_{sno} }{\Delta z_{litter} } + +where :math:`\Delta z_{litter} =0.05`\ m is assumed as a typical depth +for the litter layer, and :math:`z_{sno}` is the depth of snow (section +7.2) (m). + +The leaf boundary layer resistance :math:`r_{b}` is + +.. math:: + :label: ZEqnNum181758 + + r_{b} =\frac{1}{C_{v} } \left({U_{av} \mathord{\left/ {\vphantom {U_{av} d_{leaf} }} \right. \kern-\nulldelimiterspace} d_{leaf} } \right)^{{-1\mathord{\left/ {\vphantom {-1 2}} \right. \kern-\nulldelimiterspace} 2} } + +where :math:`C_{v} =0.01` m s\ :math:`{}^{-1/2}` is the turbulent +transfer coefficient between the canopy surface and canopy air, and +:math:`d_{leaf}` is the characteristic dimension of the leaves in the +direction of wind flow (Table 5.1). + +The partial derivatives of the fluxes from the soil beneath the canopy +with respect to ground temperature, which are needed for the soil +temperature calculations (section 6.1) and to update the soil surface +fluxes (section 5.4), are + +.. math:: + :label: ZEqnNum774729 + + \frac{\partial H_{g} }{\partial T_{g} } =\frac{\rho _{atm} C_{p} }{r'_{ah} } \frac{c_{a}^{h} +c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } + +.. math:: + :label: ZEqnNum562232 + + \frac{\partial E_{g} }{\partial T_{g} } =\frac{\beta _{soi} \rho _{atm} }{r'_{aw} +r_{litter} } \frac{c_{a}^{w} +c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } \frac{dq_{g} }{dT_{g} } . + +The partial derivatives +:math:`\frac{\partial r'_{ah} }{\partial T_{g} }` and +:math:`\frac{\partial r'_{aw} }{\partial T_{g} }` , which cannot be +determined analytically, are ignored for +:math:`\frac{\partial H_{g} }{\partial T_{g} }` and +:math:`\frac{\partial E_{g} }{\partial T_{g} }` . + +The roughness lengths used to calculate :math:`r_{am}` , +:math:`r_{ah}` , and :math:`r_{aw}` from equations , , and are +:math:`z_{0m} =z_{0m,\, v}` , :math:`z_{0h} =z_{0h,\, v}` , and +:math:`z_{0w} =z_{0w,\, v}` . The vegetation displacement height +:math:`d` and the roughness lengths are a function of plant height and +adjusted for canopy density following Zeng and Wang (2007) + +.. math:: + :label: 5.126) + + z_{0m,\, v} =z_{0h,\, v} =z_{0w,\, v} =\exp \left[V\ln \left(z_{top} R_{z0m} \right)+\left(1-V\right)\ln \left(z_{0m,\, g} \right)\right] + +.. math:: + :label: 5.127) + + d=z_{top} R_{d} V + +where :math:`z_{top}` is canopy top height (m) (Table 2.2), +:math:`R_{z0m}` and :math:`R_{d}` are the ratio of momentum roughness +length and displacement height to canopy top height, respectively (Table +5.1), and :math:`z_{0m,\, g}` is the ground momentum roughness length +(m) (section 5.2). The fractional weight :math:`V` is determined from + +.. math:: + :label: 5.128) + + V=\frac{1-\exp \left\{-\beta \min \left[L+S,\, \left(L+S\right)_{cr} \right]\right\}}{1-\exp \left[-\beta \left(L+S\right)_{cr} \right]} + +where :math:`\beta =1` and :math:`\left(L+S\right)_{cr} =2` (:math:`\text{m}^{2}` m\ :math:`{}^{-2}`) is a critical value of exposed leaf +plus stem area for which :math:`z_{0m}` reaches its maximum. + +Table 5.1. Plant functional type aerodynamic parameters + ++----------------------------------+--------------------+------------------+-------------------------+ +| Plant functional type | :math:`R_{z0m}` | :math:`R_{d}` | :math:`d_{leaf}` (m) | ++==================================+====================+==================+=========================+ +| NET Temperate | 0.055 | 0.67 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| NET Boreal | 0.055 | 0.67 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| NDT Boreal | 0.055 | 0.67 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| BET Tropical | 0.075 | 0.67 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| BET temperate | 0.075 | 0.67 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| BDT tropical | 0.055 | 0.67 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| BDT temperate | 0.055 | 0.67 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| BDT boreal | 0.055 | 0.67 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| BES temperate | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| BDS temperate | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| BDS boreal | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| C\ :math:`{}_{3}` arctic grass | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| C\ :math:`{}_{3}` grass | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| C\ :math:`{}_{4}` grass | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Crop R | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Crop I | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Corn R | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Corn I | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Temp Cereal R | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Temp Cereal I | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Winter Cereal R | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Winter Cereal I | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Soybean R | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ +| Soybean I | 0.120 | 0.68 | 0.04 | ++----------------------------------+--------------------+------------------+-------------------------+ + +Numerical Implementation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Canopy energy conservation gives + +.. math:: + :label: 5.129) + + -\overrightarrow{S}_{v} +\overrightarrow{L}_{v} \left(T_{v} \right)+H_{v} \left(T_{v} \right)+\lambda E_{v} \left(T_{v} \right)=0 + +where :math:`\overrightarrow{S}_{v}` is the solar radiation absorbed by +the vegetation (section 4.1), :math:`\overrightarrow{L}_{v}` is the net +longwave radiation absorbed by vegetation (section 4.2), and +:math:`H_{v}` and :math:`\lambda E_{v}` are the sensible and latent +heat fluxes from vegetation, respectively. The term :math:`\lambda` is +taken to be the latent heat of vaporization :math:`\lambda _{vap}` +(Table 2.6). + +:math:`\overrightarrow{L}_{v}` , :math:`H_{v}` , and +:math:`\lambda E_{v}` depend on the vegetation temperature +:math:`T_{v}` . The Newton-Raphson method for finding roots of +non-linear systems of equations can be applied to iteratively solve for +:math:`T_{v}` as + +.. math:: + :label: ZEqnNum247755 + + \Delta T_{v} =\frac{\overrightarrow{S}_{v} -\overrightarrow{L}_{v} -H_{v} -\lambda E_{v} }{\frac{\partial \overrightarrow{L}_{v} }{\partial T_{v} } +\frac{\partial H_{v} }{\partial T_{v} } +\frac{\partial \lambda E_{v} }{\partial T_{v} } } + +where :math:`\Delta T_{v} =T_{v}^{n+1} -T_{v}^{n}` and the subscript +“n” indicates the iteration. + +The partial derivatives are + +.. math:: + :label: 5.131) + + \frac{\partial \overrightarrow{L}_{v} }{\partial T_{v} } =4\varepsilon _{v} \sigma \left[2-\varepsilon _{v} \left(1-\varepsilon _{g} \right)\right]T_{v}^{3} + +.. math:: + :label: 5.132) + + \frac{\partial H_{v} }{\partial T_{v} } =\rho _{atm} C_{p} \left(c_{a}^{h} +c_{g}^{h} \right)\frac{c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } + +.. math:: + :label: 5.133) + + \frac{\partial \lambda E_{v} }{\partial T_{v} } =\lambda \rho _{atm} \left(c_{a}^{w} +c_{g}^{w} \right)\frac{c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } \frac{dq_{sat}^{T_{v} } }{dT_{v} } . + +The partial derivatives +:math:`\frac{\partial r_{ah} }{\partial T_{v} }` and +:math:`\frac{\partial r_{aw} }{\partial T_{v} }` , which cannot be +determined analytically, are ignored for +:math:`\frac{\partial H_{v} }{\partial T_{v} }` and +:math:`\frac{\partial \lambda E_{v} }{\partial T_{v} }` . However, if +:math:`\zeta` changes sign more than four times during the temperature +iteration, :math:`\zeta =-0.01`. This helps prevent “flip-flopping” +between stable and unstable conditions. The total water vapor flux +:math:`E_{v}` , transpiration flux :math:`E_{v}^{t}` , and sensible heat +flux :math:`H_{v}` are updated for changes in leaf temperature as + +.. math:: + :label: ZEqnNum420059 + + E_{v} =-\rho _{atm} \left[c_{a}^{w} q_{atm} +c_{g}^{w} q_{g} -\left(c_{a}^{w} +c_{g}^{w} \right)\left(q_{sat}^{T_{v} } +\frac{dq_{sat}^{T_{v} } }{dT_{v} } \Delta T_{v} \right)\right]\frac{c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } + +.. math:: + :label: ZEqnNum554100 + + E_{v}^{t} =-r_{dry} ^{{'} {'} } \rho _{atm} \left[c_{a}^{w} q_{atm} +c_{g}^{w} q_{g} -\left(c_{a}^{w} +c_{g}^{w} \right)\left(q_{sat}^{T_{v} } +\frac{dq_{sat}^{T_{v} } }{dT_{v} } \Delta T_{v} \right)\right]\frac{c_{v}^{h} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } + +.. math:: + :label: ZEqnNum839021 + + H_{v} =-\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} -\left(c_{a}^{h} +c_{g}^{h} \right)\left(T_{v} +\Delta T_{v} \right)\right]\frac{c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } . + +The numerical solution for vegetation temperature and the fluxes of +momentum, sensible heat, and water vapor flux from vegetated surfaces +proceeds as follows: + +#. Initial values for canopy air temperature and specific humidity are + obtained from + + .. math:: + :label: 5.137) + + T_{s} =\frac{T_{g} +\theta _{atm} }{2} + + .. math:: + :label: 5.138) + + q_{s} =\frac{q_{g} +q_{atm} }{2} . + +#. An initial guess for the wind speed :math:`V_{a}` is obtained from + eq. assuming an initial convective velocity :math:`U_{c} =0` m + s\ :math:`{}^{-1}` for stable conditions + (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` as evaluated from + eq. ) and :math:`U_{c} =0.5` for unstable conditions + (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). + +#. An initial guess for the Monin-Obukhov length :math:`L` is obtained + from the bulk Richardson number using equation and . + +#. Iteration proceeds on the following system of equations: + +#. Friction velocity :math:`u_{*}` (eqs. , , , ) + +#. Ratio :math:`\frac{\theta _{*} }{\theta _{atm} -\theta _{s} }` (eqs. + , , , ) + +#. Ratio :math:`\frac{q_{*} }{q_{atm} -q_{s} }` (eqs. , , , ) + +#. Aerodynamic resistances :math:`r_{am}` , :math:`r_{ah}` , and + :math:`r_{aw}` (eqs. , , ) + +#. Magnitude of the wind velocity incident on the leaves :math:`U_{av}` + (eq. ) + +#. Leaf boundary layer resistance :math:`r_{b}` (eq. ) + +#. Aerodynamic resistances :math:`r_{ah} ^{{'} }` and + :math:`r_{aw} ^{{'} }` (eq. ) + +#. Sunlit and shaded stomatal resistances :math:`r_{s}^{sun}` and + :math:`r_{s}^{sha}` (Chapter 8) + +#. Sensible heat conductances :math:`c_{a}^{h}` , :math:`c_{g}^{h}` , + and :math:`c_{v}^{h}` (eqs. , , ) + +#. Latent heat conductances :math:`c_{a}^{w}` , :math:`c_{v}^{w}` , and + :math:`c_{g}^{w}` (eqs. , , ) + +#. Sensible heat flux from vegetation :math:`H_{v}` (eq. ) + +#. Latent heat flux from vegetation :math:`\lambda E_{v}` (eq. ) + +#. If the latent heat flux has changed sign from the latent heat flux + computed at the previous iteration + (:math:`\lambda E_{v} ^{n+1} \times \lambda E_{v} ^{n} <0`), the + latent heat flux is constrained to be 10% of the computed value. The + difference between the constrained and computed value + (:math:`\Delta _{1} =0.1\lambda E_{v} ^{n+1} -\lambda E_{v} ^{n+1}` ) + is added to the sensible heat flux later. + +#. Change in vegetation temperature :math:`\Delta T_{v}` (eq. ) and + update the vegetation temperature as + :math:`T_{v}^{n+1} =T_{v}^{n} +\Delta T_{v}` . :math:`T_{v}` is + constrained to change by no more than 1ºK in one iteration. If this + limit is exceeded, the energy error is + + .. math:: + :label: 5.139) + + \Delta _{2} =\overrightarrow{S}_{v} -\overrightarrow{L}_{v} -\frac{\partial \overrightarrow{L}_{v} }{\partial T_{v} } \Delta T_{v} -H_{v} -\frac{\partial H_{v} }{\partial T_{v} } \Delta T_{v} -\lambda E_{v} -\frac{\partial \lambda E_{v} }{\partial T_{v} } \Delta T_{v} + +where :math:`\Delta T_{v} =1{\rm \; or\; }-1`. The error +:math:`\Delta _{2}` is added to the sensible heat flux later. + +#. Water vapor flux :math:`E_{v}` (eq. ) + +#. Transpiration :math:`E_{v}^{t}` (eq. if :math:`\beta _{t} >0`, + otherwise :math:`E_{v}^{t} =0`) + +#. The water vapor flux :math:`E_{v}` is constrained to be less than or + equal to the sum of transpiration :math:`E_{v}^{t}` and the water + available from wetted leaves and stems + :math:`{W_{can} \mathord{\left/ {\vphantom {W_{can} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t}` . + The energy error due to this constraint is + + .. math:: + :label: 5.140) + + \Delta _{3} =\max \left(0,\, E_{v} -E_{v}^{t} -\frac{W_{can} }{\Delta t} \right). + +The error :math:`\lambda \Delta _{3}` is added to the sensible heat +flux later. + +#. Sensible heat flux :math:`H_{v}` (eq. ). The three energy error + terms, :math:`\Delta _{1}` , :math:`\Delta _{2}` , and + :math:`\lambda \Delta _{3}` are also added to the sensible heat + flux. + +#. The saturated vapor pressure :math:`e_{i}` (Chapter 8), saturated + specific humidity :math:`q_{sat}^{T_{v} }` and its derivative + :math:`\frac{dq_{sat}^{T_{v} } }{dT_{v} }` at the leaf surface + (section 5.5), are re-evaluated based on the new :math:`T_{v}` . + +#. Canopy air temperature :math:`T_{s}` (eq. ) + +#. Canopy air specific humidity :math:`q_{s}` (eq. ) + +#. Temperature difference :math:`\theta _{atm} -\theta _{s}` + +#. Specific humidity difference :math:`q_{atm} -q_{s}` + +#. Potential temperature scale + :math:`\theta _{*} =\frac{\theta _{*} }{\theta _{atm} -\theta _{s} } \left(\theta _{atm} -\theta _{s} \right)` + where :math:`\frac{\theta _{*} }{\theta _{atm} -\theta _{s} }` was + calculated earlier in the iteration + +#. Humidity scale + :math:`q_{*} =\frac{q_{*} }{q_{atm} -q_{s} } \left(q_{atm} -q_{s} \right)` + where :math:`\frac{q_{*} }{q_{atm} -q_{s} }` was calculated earlier + in the iteration + +#. Virtual potential temperature scale :math:`\theta _{v*}` (eq. ) + +#. Wind speed including the convective velocity, :math:`V_{a}` (eq. ) + +#. Monin-Obukhov length :math:`L` (eq. ) + +#. The iteration is stopped after two or more steps if + :math:`\tilde{\Delta }T_{v} <0.01` and + :math:`\left|\lambda E_{v}^{n+1} -\lambda E_{v}^{n} \right|<0.1` + where + :math:`\tilde{\Delta }T_{v} =\max \left(\left|T_{v}^{n+1} -T_{v}^{n} \right|,\, \left|T_{v}^{n} -T_{v}^{n-1} \right|\right)`, + or after forty iterations have been carried out. + +#. Momentum fluxes :math:`\tau _{x}` , :math:`\tau _{y}` (eqs. , ) + +#. Sensible heat flux from ground :math:`H_{g}` (eq. ) + +#. Water vapor flux from ground :math:`E_{g}` (eq. ) + +#. 2-m height air temperature :math:`T_{2m}` , specific humidity + :math:`q_{2m}` , relative humidity :math:`RH_{2m}` \ (eqs. , , ) + +Update of Ground Sensible and Latent Heat Fluxes +---------------------------------------------------- + +The sensible and water vapor heat fluxes derived above for bare soil and +soil beneath canopy are based on the ground surface temperature from the +previous time step :math:`T_{g}^{n}` and are used as the surface +forcing for the solution of the soil temperature equations (section +6.1). This solution yields a new ground surface temperature +:math:`T_{g}^{n+1}` . The ground sensible and water vapor fluxes are +then updated for :math:`T_{g}^{n+1}` as + +.. math:: + :label: 5.141) + + H'_{g} =H_{g} +\left(T_{g}^{n+1} -T_{g}^{n} \right)\frac{\partial H_{g} }{\partial T_{g} } + +.. math:: + :label: 5.142) + + E'_{g} =E_{g} +\left(T_{g}^{n+1} -T_{g}^{n} \right)\frac{\partial E_{g} }{\partial T_{g} } + +where :math:`H_{g}` and :math:`E_{g}` are the sensible heat and water +vapor fluxes derived from equations and for non-vegetated surfaces and +equations and for vegetated surfaces using :math:`T_{g}^{n}` . One +further adjustment is made to :math:`H'_{g}` and :math:`E'_{g}` . If +the soil moisture in the top snow/soil layer is not sufficient to +support the updated ground evaporation, i.e., if :math:`E'_{g} >0` and +:math:`f_{evap} <1` where + +.. math:: + :label: 5.143) + + f_{evap} =\frac{{\left(w_{ice,\; snl+1} +w_{liq,\, snl+1} \right)\mathord{\left/ {\vphantom {\left(w_{ice,\; snl+1} +w_{liq,\, snl+1} \right) \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} }{\sum _{j=1}^{npft}\left(E'_{g} \right)_{j} \left(wt\right)_{j} } \le 1, + +an adjustment is made to reduce the ground evaporation accordingly as + +.. math:: + :label: 5.144) + + E''_{g} =f_{evap} E'_{g} . + +The term +:math:`\sum _{j=1}^{npft}\left(E'_{g} \right)_{j} \left(wt\right)_{j}` +is the sum of :math:`E'_{g}` over all evaporating PFTs where +:math:`\left(E'_{g} \right)_{j}` is the ground evaporation from the +:math:`j^{th}` PFT on the column, :math:`\left(wt\right)_{j}` is the +relative area of the :math:`j^{th}` PFT with respect to the column, and +:math:`npft` is the number of PFTs on the column. +:math:`w_{ice,\, snl+1}` and :math:`w_{liq,\, snl+1}` are the ice and +liquid water contents (kg m\ :math:`{}^{-2}`) of the top snow/soil layer +(Chapter 7). Any resulting energy deficit is assigned to sensible heat +as + +.. math:: + :label: 5.145) + + H''_{g} =H_{g} +\lambda \left(E'_{g} -E''_{g} \right). + +The ground water vapor flux :math:`E''_{g}` is partitioned into +evaporation of liquid water from snow/soil :math:`q_{seva}` (kg +m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), sublimation from snow/soil ice +:math:`q_{subl}` (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), liquid dew +on snow/soil :math:`q_{sdew}` (kg m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`), or frost on snow/soil :math:`q_{frost}` (kg +m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) as + +.. math:: + :label: 5.146) + + q_{seva} =\max \left(E''_{sno} \frac{w_{liq,\, snl+1} }{w_{ice,\; snl+1} +w_{liq,\, snl+1} } ,0\right)\qquad E''_{sno} \ge 0,\, w_{ice,\; snl+1} +w_{liq,\, snl+1} >0 + +.. math:: + :label: 5.147) + + q_{subl} =E''_{sno} -q_{seva} \qquad E''_{sno} \ge 0 + +.. math:: + :label: 5.148) + + q_{sdew} =\left|E''_{sno} \right|\qquad E''_{sno} <0{\rm \; and\; }T_{g} \ge T_{f} + +.. math:: + :label: 5.149) + + q_{frost} =\left|E''_{sno} \right|\qquad E''_{sno} <0{\rm \; and\; }T_{g} 0} \\ {\lambda _{vap} \qquad {\rm otherwise}} \end{array}\right\} + +where :math:`\lambda _{sub}` and :math:`\lambda _{vap}` are the latent +heat of sublimation and vaporization, respectively (J +kg\ :math:`{}^{-1}`) (Table 2.6). When converting vegetation water vapor +flux to an energy flux, :math:`\lambda _{vap}` is used. + +The system balances energy as + +.. math:: + :label: 5.154) + + \overrightarrow{S}_{g} +\overrightarrow{S}_{v} +L_{atm} \, \downarrow -L\, \uparrow -H_{v} -H_{g} -\lambda _{vap} E_{v} -\lambda E_{g} -G=0. + +Saturation Vapor Pressure +----------------------------- + +Saturation vapor pressure :math:`e_{sat}^{T}` (Pa) and its derivative +:math:`\frac{de_{sat}^{T} }{dT}` , as a function of temperature +:math:`T` (ºC), are calculated from the eighth-order polynomial fits of +Flatau et al. (1992) + +.. math:: + :label: 5.155) + + e_{sat}^{T} =100\left[a_{0} +a_{1} T+\cdots +a_{n} T^{n} \right] + +.. math:: + :label: 5.156) + + \frac{de_{sat}^{T} }{dT} =100\left[b_{0} +b_{1} T+\cdots +b_{n} T^{n} \right] + +where the coefficients for ice are valid for +:math:`-75\, ^{\circ } {\rm C}\le T<0\, ^{\circ } {\rm C}` and the +coefficients for water are valid for +:math:`0\, ^{\circ } {\rm C}\le T\le 100\, ^{\circ } {\rm C}` (Table 5.2 +and 5.3). The saturated water vapor specific humidity +:math:`q_{sat}^{T}` and its derivative +:math:`\frac{dq_{sat}^{T} }{dT}` are + +.. math:: + :label: 5.157) + + q_{sat}^{T} =\frac{0.622e_{sat}^{T} }{P_{atm} -0.378e_{sat}^{T} } + +.. math:: + :label: 5.158) + + \frac{dq_{sat}^{T} }{dT} =\frac{0.622P_{atm} }{\left(P_{atm} -0.378e_{sat}^{T} \right)^{2} } \frac{de_{sat}^{T} }{dT} . + +Table 5.2. Coefficients for :math:`e_{sat}^{T}` + ++------------------+------------------------------------------+----------------------------------------+ +| | water | ice | ++==================+==========================================+========================================+ +| :math:`a_{0}` | 6.11213476 | 6.11123516 | ++------------------+------------------------------------------+----------------------------------------+ +| :math:`a_{1}` | 4.44007856 :math:`\times 10^{-1}` | 5.03109514\ :math:`\times 10^{-1}` | ++------------------+-------------------------------------------+---------------------------------------+ +| :math:`a_{2}` | 1.43064234 :math:`\times 10^{-2}` | 1.88369801\ :math:`\times 10^{-2}` | ++------------------+-------------------------------------------+---------------------------------------+ +| :math:`a_{3}` | 2.64461437 :math:`\times 10^{-4}` | 4.20547422\ :math:`\times 10^{-4}` | ++------------------+-------------------------------------------+---------------------------------------+ +| :math:`a_{4}` | 3.05903558 :math:`\times 10^{-6}` | 6.14396778\ :math:`\times 10^{-6}` | ++------------------+-------------------------------------------+---------------------------------------+ +| :math:`a_{5}` | 1.96237241 :math:`\times 10^{-8}` | 6.02780717\ :math:`\times 10^{-8}` | ++------------------+-------------------------------------------+---------------------------------------+ +| :math:`a_{6}` | 8.92344772 :math:`\times 10^{-11}` | 3.87940929\ :math:`\times 10^{-10}` | ++------------------+-------------------------------------------+---------------------------------------+ +| :math:`a_{7}` | -3.73208410 :math:`\times 10^{-13}` | 1.49436277\ :math:`\times 10^{-12}` | ++------------------+-------------------------------------------+---------------------------------------+ +| :math:`a_{8}` | 2.09339997 :math:`\times 10^{-16}` | 2.62655803\ :math:`\times 10^{-15}` | ++------------------+------------------------------------------+----------------------------------------+ + +Table 5.3. Coefficients for :math:`\frac{de_{sat}^{T} }{dT}` + ++------------------+----------------------------------------+----------------------------------------+ +| | water | ice | ++==================+========================================+========================================+ +| :math:`b_{0}` | 4.44017302\ :math:`\times 10^{-1}` | 5.03277922\ :math:`\times 10^{-1}` | ++------------------+----------------------------------------+----------------------------------------+ +| :math:`b_{1}` | 2.86064092\ :math:`\times 10^{-2}` | 3.77289173\ :math:`\times 10^{-2}` | ++------------------+----------------------------------------+----------------------------------------+ +| :math:`b_{2}` | 7.94683137\ :math:`\times 10^{-4}` | 1.26801703\ :math:`\times 10^{-3}` | ++------------------+----------------------------------------+----------------------------------------+ +| :math:`b_{3}` | 1.21211669\ :math:`\times 10^{-5}` | 2.49468427\ :math:`\times 10^{-5}` | ++------------------+----------------------------------------+----------------------------------------+ +| :math:`b_{4}` | 1.03354611\ :math:`\times 10^{-7}` | 3.13703411\ :math:`\times 10^{-7}` | ++------------------+----------------------------------------+----------------------------------------+ +| :math:`b_{5}` | 4.04125005\ :math:`\times 10^{-10}` | 2.57180651\ :math:`\times 10^{-9}` | ++------------------+----------------------------------------+----------------------------------------+ +| :math:`b_{6}` | -7.88037859 :math:`\times 10^{-13}` | 1.33268878\ :math:`\times 10^{-11}` | ++------------------+----------------------------------------+----------------------------------------+ +| :math:`b_{7}` | -1.14596802 :math:`\times 10^{-14}` | 3.94116744\ :math:`\times 10^{-14}` | ++------------------+----------------------------------------+----------------------------------------+ +| :math:`b_{8}` | 3.81294516\ :math:`\times 10^{-17}` | 4.98070196\ :math:`\times 10^{-17}` | ++------------------+----------------------------------------+----------------------------------------+ + diff --git a/doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst b/doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst new file mode 100644 index 0000000000..d39a780958 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst @@ -0,0 +1,928 @@ +Soil and Snow Temperatures +============================= + +The first law of heat conduction is + +.. math:: + :label: 6.1) + + F=-\lambda \nabla T + +where :math:`F` is the amount of heat conducted across a unit +cross-sectional area in unit time (W m\ :math:`{}^{-2}`), +:math:`\lambda` is thermal conductivity (W m\ :math:`{}^{-1}` +K\ :math:`{}^{-1}`), and :math:`\nabla T` is the spatial gradient of +temperature (K m\ :math:`{}^{-1}`). In one-dimensional form + +.. math:: + :label: ZEqnNum105915 + + F_{z} =-\lambda \frac{\partial T}{\partial z} + +where :math:`z` is in the vertical direction (m) and is positive +downward and :math:`F_{z}` is positive upward. To account for +non-steady or transient conditions, the principle of energy conservation +in the form of the continuity equation is invoked as + +.. math:: + :label: ZEqnNum376834 + + c\frac{\partial T}{\partial t} =-\frac{\partial F_{z} }{\partial z} + +where :math:`c` is the volumetric snow/soil heat capacity (J +m\ :math:`{}^{-3}` K\ :math:`{}^{-1}`) and :math:`t` is time (s). +Combining equations and yields the second law of heat conduction in +one-dimensional form + +.. math:: + :label: 6.4) + + c\frac{\partial T}{\partial t} =\frac{\partial }{\partial z} \left[\lambda \frac{\partial T}{\partial z} \right]. + +This equation is solved numerically to calculate the soil, snow, and +surface water temperatures for a fifteen-layer soil column with up to +five overlying layers of snow and a single surface water layer with the +boundary conditions of :math:`h` as the heat flux into the top soil, +snow, and surface water layers from the overlying atmosphere (section +6.1) and zero heat flux at the bottom of the soil column. The +temperature profile is calculated first without phase change and then +readjusted for phase change (section 6.2). + +Numerical Solution +---------------------- + +The soil column is discretized into fifteen layers (Table 6.1) where the +depth of soil layer :math:`i`, or node depth, :math:`z_{i}` (m), is + +.. math:: + :label: ZEqnNum185766 + + z_{i} =f_{s} \left\{\exp \left[0.5\left(i-0.5\right)\right]-1\right\} + +where :math:`f_{s} =0.025` is a scaling factor. The thickness of each +layer :math:`\Delta z_{i}` (m) is + +.. math:: + :label: 6.6) + + \Delta z_{i} =\left\{\begin{array}{l} {0.5\left(z_{1} +z_{2} \right)\qquad i=1} \\ {0.5\left(z_{i+1} -z_{i-1} \right)\qquad i=2,3,\ldots ,N_{levgrnd} -1} \\ {z_{N} -z_{N-1} \qquad i=N_{levgrnd} } \end{array}\right\} + +where :math:`N_{levgrnd} =15` is the number of soil layers. The depths +at the layer interfaces :math:`z_{h,\, i}` (m) are + +.. math:: + :label: 6.7) + + z_{h,\, i} =\left\{\begin{array}{l} {0.5\left(z_{i} +z_{i+1} \right)\qquad i=1,2,\ldots ,N_{levgrnd} -1} \\ {z_{N_{levgrnd} } +0.5\Delta z_{N_{levgrnd} } \qquad i=N_{levgrnd} } \end{array}\right\}. + +The exponential form of equation is to obtain more soil layers near the +soil surface where the soil water gradient is generally strong (section +7.4). + +Table 6.1. Soil layer structure. + +Layer node depth (:math:`z_{i}` ), thickness (:math:`\Delta z_{i}` ), +and depth at layer interface (:math:`z_{h,\, i}` ) for fifteen-layer +soil column. All in meters. + ++---------------+------------------+-------------------------+-----------------------+ +| Layer | :math:`z_{i}` | :math:`\Delta z_{i}` | :math:`z_{h,\, i}` | ++===============+==================+=========================+=======================+ +| 1 (top) | 0.0071 | 0.0175 | 0.0175 | ++---------------+------------------+-------------------------+-----------------------+ +| 2 | 0.0279 | 0.0276 | 0.0451 | ++---------------+------------------+-------------------------+-----------------------+ +| 3 | 0.0623 | 0.0455 | 0.0906 | ++---------------+------------------+-------------------------+-----------------------+ +| 4 | 0.1189 | 0.0750 | 0.1655 | ++---------------+------------------+-------------------------+-----------------------+ +| 5 | 0.2122 | 0.1236 | 0.2891 | ++---------------+------------------+-------------------------+-----------------------+ +| 6 | 0.3661 | 0.2038 | 0.4929 | ++---------------+------------------+-------------------------+-----------------------+ +| 7 | 0.6198 | 0.3360 | 0.8289 | ++---------------+------------------+-------------------------+-----------------------+ +| 8 | 1.0380 | 0.5539 | 1.3828 | ++---------------+------------------+-------------------------+-----------------------+ +| 9 | 1.7276 | 0.9133 | 2.2961 | ++---------------+------------------+-------------------------+-----------------------+ +| 10 | 2.8646 | 1.5058 | 3.8019 | ++---------------+------------------+-------------------------+-----------------------+ +| 11 | 4.7392 | 2.4826 | 6.2845 | ++---------------+------------------+-------------------------+-----------------------+ +| 12 | 7.8298 | 4.0931 | 10.3775 | ++---------------+------------------+-------------------------+-----------------------+ +| 13 | 12.9253 | 6.7484 | 17.1259 | ++---------------+------------------+-------------------------+-----------------------+ +| 14 | 21.3265 | 11.1262 | 28.2520 | ++---------------+------------------+-------------------------+-----------------------+ +| 15 (bottom) | 35.1776 | 13.8512 | 42.1032 | ++---------------+------------------+-------------------------+-----------------------+ + +The overlying snow pack is modeled with up to five layers depending on +the total snow depth. The layers from top to bottom are indexed in the +Fortran code as :math:`i=-4,-3,-2,-1,0`, which permits the accumulation +or ablation of snow at the top of the snow pack without renumbering the +layers. Layer :math:`i=0` is the snow layer next to the soil surface and +layer :math:`i=snl+1` is the top layer, where the variable :math:`snl` +is the negative of the number of snow layers. The number of snow layers +and the thickness of each layer is a function of snow depth +:math:`z_{sno}` (m) as follows. + +.. math:: \left\{\begin{array}{l} {snl=-1} \\ {\Delta z_{0} =z_{sno} \qquad {\rm for\; 0.01}\le {\rm z}_{{\rm sno}} \le 0.03} \end{array}\right\}, + +.. math:: \left\{\begin{array}{l} {snl=-2} \\ {\Delta z_{-1} ={z_{sno} \mathord{\left/ {\vphantom {z_{sno} 2}} \right. \kern-\nulldelimiterspace} 2} \qquad {\rm for\; 0.03}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.04} \\ {\Delta z_{0} =\Delta z_{-1} } \end{array}\right\}, + +.. math:: \left\{\begin{array}{l} {snl=-2} \\ {\Delta z_{-1} =0.02\qquad {\rm for\; 0.04}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.07} \\ {\Delta z_{0} =z_{sno} -\Delta z_{-1} } \end{array}\right\}, + +.. math:: \left\{\begin{array}{l} {snl=-3} \\ {\Delta z_{-2} =0.02} \\ {\Delta z_{-1} ={\left(z_{sno} -0.02\right)\mathord{\left/ {\vphantom {\left(z_{sno} -0.02\right) 2}} \right. \kern-\nulldelimiterspace} 2} \qquad {\rm for\; 0.07}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.12} \\ {\Delta z_{0} =\Delta z_{-1} } \end{array}\right\}, + +.. math:: \left\{\begin{array}{l} {snl=-3} \\ {\Delta z_{-2} =0.02} \\ {\Delta z_{-1} =0.05\qquad {\rm for\; 0.12}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.18} \\ {\Delta z_{0} =z_{sno} -\Delta z_{-2} -\Delta z_{-1} } \end{array}\right\}, + +.. math:: \left\{\begin{array}{l} {snl=-4} \\ {\Delta z_{-3} =0.02} \\ {\Delta z_{-2} =0.05\qquad {\rm for\; 0.18}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.29} \\ {\Delta z_{-1} ={\left(z_{sno} -\Delta z_{-3} -\Delta z_{-2} \right)\mathord{\left/ {\vphantom {\left(z_{sno} -\Delta z_{-3} -\Delta z_{-2} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \\ {\Delta z_{0} =\Delta z_{-1} } \end{array}\right\}, + +.. math:: \left\{\begin{array}{l} {snl=-4} \\ {\Delta z_{-3} =0.02} \\ {\Delta z_{-2} =0.05\qquad {\rm for\; 0.29}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.41} \\ {\Delta z_{-1} =0.11} \\ {\Delta z_{0} =z_{sno} -\Delta z_{-3} -\Delta z_{-2} -\Delta z_{-1} } \end{array}\right\}, + +.. math:: \left\{\begin{array}{l} {snl=-5} \\ {\Delta z_{-4} =0.02} \\ {\Delta z_{-3} =0.05\qquad {\rm for\; 0.41}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.64} \\ {\Delta z_{-2} =0.11} \\ {\Delta z_{-1} ={\left(z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} \right)\mathord{\left/ {\vphantom {\left(z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \\ {\Delta z_{0} =\Delta z_{-1} } \end{array}\right\}, + +.. math:: \left\{\begin{array}{l} {snl=-5} \\ {\Delta z_{-4} =0.02} \\ {\Delta z_{-3} =0.05\qquad {\rm for\; 0.64}\, {\rm <}\, {\rm z}_{{\rm sno}} } \\ {\Delta z_{-2} =0.11} \\ {\Delta z_{-1} =0.23} \\ {\Delta z_{0} =z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} -\Delta z_{-1} } \end{array}\right\}. + +The node depths, which are located at the midpoint of the snow layers, +and the layer interfaces are both referenced from the soil surface and +are defined as negative values + +.. math:: + :label: 6.8) + + z_{i} =z_{h,\, i} -0.5\Delta z_{i} \qquad i=snl+1,\ldots ,0 + +.. math:: + :label: 6.9) + + z_{h,\, i} =z_{h,\, i+1} -\Delta z_{i+1} \qquad i=snl,\ldots ,-1. + +Note that :math:`z_{h,\, 0}` , the interface between the bottom snow +layer and the top soil layer, is zero. Thermal properties (i.e., +temperature :math:`T_{i}` [K]; thermal conductivity +:math:`\lambda _{i}` [W m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`]; +volumetric heat capacity :math:`c_{i}` [J m\ :math:`{}^{-3}` +K\ :math:`{}^{-1}`]) are defined for soil layers at the node depths +(Figure 6.1) and for snow layers at the layer midpoints. When present, +snow occupies a fraction of a grid cell’s area, therefore snow depth +represents the thickness of the snowpack averaged over only the snow +covered area. The grid cell average snow depth is related to the depth +of the snow covered area as :math:`\bar{z}_{sno} =f_{sno} z_{sno}` . By +default, the grid cell average snow depth is written to the history +file. + +The heat flux :math:`F_{i}` (W m\ :math:`{}^{-2}`) from layer :math:`i` +to layer :math:`i+1` is + +.. math:: + :label: ZEqnNum443713 + + F_{i} =-\lambda \left[z_{h,\, i} \right]\left(\frac{T_{i} -T_{i+1} }{z_{i+1} -z_{i} } \right) + +where the thermal conductivity at the interface +:math:`\lambda \left[z_{h,\, i} \right]` is + +.. math:: + :label: ZEqnNum604125 + + \lambda \left[z_{h,\, i} \right]=\left\{\begin{array}{l} {\frac{\lambda _{i} \lambda _{i+1} \left(z_{i+1} -z_{i} \right)}{\lambda _{i} \left(z_{i+1} -z_{h,\, i} \right)+\lambda _{i+1} \left(z_{h,\, i} -z_{i} \right)} \qquad i=snl+1,\ldots ,N_{levgrnd} -1} \\ {0\qquad i=N_{levgrnd} } \end{array}\right\}. + +These equations are derived, with reference to Figure 6.1, assuming +that the heat flux from :math:`i` (depth :math:`z_{i}` ) to the +interface between :math:`i` and :math:`i+1` (depth :math:`z_{h,\, i}` ) +equals the heat flux from the interface to :math:`i+1` (depth +:math:`z_{i+1}` ), i.e., + +.. math:: + :label: ZEqnNum726244 + + -\lambda _{i} \frac{T_{i} -T_{m} }{z_{h,\, i} -z_{i} } =-\lambda _{i+1} \frac{T_{m} -T_{i+1} }{z_{i+1} -z_{h,\, i} } + +where :math:`T_{m}` is the temperature at the interface of layers +:math:`i` and :math:`i+1`. + +Figure 6.1. Schematic diagram of numerical scheme used to solve for soil +temperature. + +Shown are three soil layers, :math:`i-1`, :math:`i`, and :math:`i+1`. +The thermal conductivity :math:`\lambda` , specific heat capacity +:math:`c`, and temperature :math:`T` are defined at the layer node depth +:math:`z`. :math:`T_{m}` is the interface temperature. The thermal +conductivity :math:`\lambda \left[z_{h} \right]` is defined at the +interface of two layers + +:math:`z_{h}` . The layer thickness is :math:`\Delta z`. The heat fluxes +:math:`F_{i-1}` and :math:`F_{i}` are defined as positive upwards. + +.. image:: image1.png + + +The energy balance for the :math:`i^{th}` layer is + +.. math:: + :label: 6.13) + + \frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=-F_{i-1} +F_{i} + +where the superscripts :math:`n` and :math:`n+1` indicate values at the +beginning and end of the time step, respectively, and :math:`\Delta t` +is the time step (s). This equation is solved using the Crank-Nicholson +method, which combines the explicit method with fluxes evaluated at +:math:`n` (:math:`F_{i-1}^{n} ,F_{i}^{n}` ) and the implicit method with +fluxes evaluated at :math:`n+1` (:math:`F_{i-1}^{n+1} ,F_{i}^{n+1}` ) + +.. math:: + :label: 6.14) + + \frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=\alpha \left(-F_{i-1}^{n} +F_{i}^{n} \right)+\left(1-\alpha \right)\left(-F_{i-1}^{n+1} +F_{i}^{n+1} \right) + +where :math:`\alpha =0.5`, resulting in a tridiagonal system of +equations + +.. math:: + :label: 6.15) + + r_{i} =a_{i} T_{i-1}^{n+1} +b_{i} T_{i}^{n+1} +c_{i} T_{i+1}^{n+1} + +where :math:`a_{i}` , :math:`b_{i}` , and :math:`c_{i}` are the +subdiagonal, diagonal, and superdiagonal elements in the tridiagonal +matrix and :math:`r_{i}` is a column vector of constants. When surface +water is present, the equation for the top soil layer has an additional +term representing the surface water temperature; this results in a four +element band-diagonal system of equations. + +For the top soil layer :math:`i=1` , top snow layer :math:`i=snl+1`, or +surface water layer, the heat flux from the overlying atmosphere +:math:`h` (W m\ :math:`{}^{-2}`, defined as positive into the surface) +is + +.. math:: + :label: 6.16) + + h^{n+1} =-\alpha F_{i-1}^{n} -\left(1-\alpha \right)F_{i-1}^{n+1} . + +The energy balance for these layers is then + +.. math:: + :label: 6.17) + + \frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=h^{n+1} +\alpha F_{i}^{n} +\left(1-\alpha \right)F_{i}^{n+1} . + +The heat flux :math:`h` at :math:`n+1` may be approximated as follows + +.. math:: + :label: 6.18) + + h^{n+1} =h^{n} +\frac{\partial h}{\partial T_{i} } \left(T_{i}^{n+1} -T_{i}^{n} \right). + +The resulting equations are then + +.. math:: + :label: ZEqnNum219926 + + \begin{array}{rcl} {\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)} & {=} & {h^{n} +\frac{\partial h}{\partial T_{i} } \left(T_{i}^{n+1} -T_{i} \right)} \\ {} & {} & {-\alpha \frac{\lambda \left[z_{h,\, i} \right]\left(T_{i}^{n} -T_{i+1}^{n} \right)}{z_{i+1} -z_{i} } -\left(1-\alpha \right)\frac{\lambda \left[z_{h,\, i} \right]\left(T_{i}^{n+1} -T_{i+1}^{n+1} \right)}{z_{i+1} -z_{i} } } \end{array} + +For the top snow layer, :math:`i=snl+1`, the coefficients are + +.. math:: + :label: 6.20) + + a_{i} =0 + +.. math:: + :label: 6.21) + + b_{i} =1+\frac{\Delta t}{c_{i} \Delta z_{i} } \left[\left(1-\alpha \right)\frac{\lambda \left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } -\frac{\partial h}{\partial T_{i} } \right] + +.. math:: + :label: 6.22) + + c_{i} =-\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } + +.. math:: + :label: 6.23) + + r_{i} =T_{i}^{n} +\frac{\Delta t}{c_{i} \Delta z_{i} } \left[h_{sno} ^{n} -\frac{\partial h}{\partial T_{i} } T_{i}^{n} +\alpha F_{i} \right] + +where + +.. math:: + :label: ZEqnNum455578 + + F_{i} =-\lambda \left[z_{h,\, i} \right]\left(\frac{T_{i}^{n} -T_{i+1}^{n} }{z_{i+1} -z_{i} } \right). + +The heat flux into the snow surface from the overlying atmosphere +:math:`h` is + +.. math:: + :label: 6.25) + + h=\overrightarrow{S}_{sno} -\overrightarrow{L}_{sno} -H_{sno} -\lambda E_{sno} + +where :math:`\overrightarrow{S}_{sno}` is the solar radiation absorbed +by the top snow layer (section 3.2.1), :math:`\overrightarrow{L}_{sno}` +is the longwave radiation absorbed by the snow (positive toward the +atmosphere) (section 4.2), :math:`H_{sno}` is the sensible heat flux +from the snow (Chapter 5), and :math:`\lambda E_{sno}` is the latent +heat flux from the snow (Chapter 5). The partial derivative of the heat +flux :math:`h` with respect to temperature is + +.. math:: + :label: 6.26) + + \frac{\partial h}{\partial T_{} } =-\frac{\partial \overrightarrow{L}_{} }{\partial T_{} } -\frac{\partial H_{} }{\partial T_{} } -\frac{\partial \lambda E_{} }{\partial T_{} } + +where the partial derivative of the net longwave radiation is + +.. math:: + :label: 6.27) + + \frac{\partial \overrightarrow{L}_{} }{\partial T_{} } =4\varepsilon _{g} \sigma \left(T_{}^{n} \right)^{3} + +and the partial derivatives of the sensible and latent heat fluxes are +given by equations and for non-vegetated surfaces, and by equations and +for vegetated surfaces. :math:`\sigma` is the Stefan-Boltzmann constant +(W m\ :math:`{}^{-2}` K\ :math:`{}^{-4}`) (Table 2.6) and +:math:`\varepsilon _{g}` is the ground emissivity (section 4.2). For +purposes of computing :math:`h` and +:math:`\frac{\partial h}{\partial T_{g} }` , the term :math:`\lambda` +is arbitrarily assumed to be + +.. math:: + :label: 6.28) + + \lambda =\left\{\begin{array}{l} {\lambda _{sub} \qquad {\rm if\; }w_{liq,\, snl+1} =0{\rm \; and\; }w_{ice,\, snl+1} >0} \\ {\lambda _{vap} \qquad {\rm otherwise}} \end{array}\right\} + +where :math:`\lambda _{sub}` and :math:`\lambda _{vap}` are the +latent heat of sublimation and vaporization, respectively (J +kg\ :math:`{}^{-1}`) (Table 2.6), and :math:`w_{liq,\, snl+1}` and +:math:`w_{ice,\, snl+1}` are the liquid water and ice contents of the +top snow/soil layer, respectively (kg m\ :math:`{}^{-2}`) (Chapter 7). + +For the top soil layer, :math:`i=1`, the coefficients are + +.. math:: + :label: 6.29) + + a_{i} =-f_{sno} \left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } + +.. math:: + :label: 6.30) + + b_{i} =1+\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \left[f_{sno} \frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } +\frac{\lambda \left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \right]-\left(1-f_{sno} \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} + +.. math:: + :label: 6.31) + + c_{i} =-\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } + +.. math:: + :label: 6.32) + + r_{i} =T_{i}^{n} +\frac{\Delta t}{c_{i} \Delta z_{i} } \left[\left(1-f_{sno} \right)\left(h_{soil} ^{n} -\frac{\partial h}{\partial T_{} } T_{i}^{n} \right)+\alpha \left(F_{i} -f_{sno} F_{i-1} \right)\right] + +The heat flux into the soil surface from the overlying atmosphere +:math:`h` is + +.. math:: + :label: 6.33) + + h=\overrightarrow{S}_{soil} -\overrightarrow{L}_{soil} -H_{soil} -\lambda E_{soil} + +It can be seen that when no snow is present (:math:`f_{sno} =0`), the +expressions for the coefficients of the top soil layer have the same +form as those for the top snow layer. + +The surface snow/soil layer temperature computed in this way is the +layer-averaged temperature and hence has somewhat reduced diurnal +amplitude compared with surface temperature. An accurate surface +temperature is provided that compensates for this effect and numerical +error by tuning the heat capacity of the top layer (through adjustment +of the layer thickness) to give an exact match to the analytic solution +for diurnal heating. The top layer thickness for :math:`i=snl+1` is +given by + +.. math:: + :label: 6.34) + + \Delta z_{i*} =0.5\left[z_{i} -z_{h,\, i-1} +c_{a} \left(z_{i+1} -z_{h,\, i-1} \right)\right] + +where :math:`c_{a}` is a tunable parameter, varying from 0 to 1, and is +taken as 0.34 by comparing the numerical solution with the analytic +solution (Z.-L. Yang 1998, unpublished manuscript). +:math:`\Delta z_{i*}` is used in place of :math:`\Delta z_{i}` for +:math:`i=snl+1` in equations -. The top snow/soil layer temperature +computed in this way is the ground surface temperature +:math:`T_{g}^{n+1}` . + +The boundary condition at the bottom of the snow/soil column is zero +heat flux, :math:`F_{i} =0`, resulting in, for :math:`i=N_{levgrnd}` , + +.. math:: + :label: 6.35) + + \frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=\alpha \frac{\lambda \left[z_{h,\, i-1} \right]\left(T_{i-1}^{n} -T_{i}^{n} \right)}{z_{i} -z_{i-1} } +\left(1-\alpha \right)\frac{\lambda \left[z_{h,\, i-1} \right]\left(T_{i-1}^{n+1} -T_{i}^{n+1} \right)}{z_{i} -z_{i-1} } + +.. math:: + :label: 6.36) + + a_{i} =-\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } + +.. math:: + :label: 6.37) + + b_{i} =1+\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } + +.. math:: + :label: 6.38) + + c_{i} =0 + +.. math:: + :label: 6.39) + + r_{i} =T_{i}^{n} -\alpha \frac{\Delta t}{c_{i} \Delta z_{i} } F_{i-1} + +where + +.. math:: + :label: ZEqnNum768674 + + F_{i-1} =-\frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \left(T_{i-1}^{n} -T_{i}^{n} \right). + +For the interior snow/soil layers, :math:`snl+1T_{f} {\rm \; and\; }w_{ice,\, i} >0\qquad i=snl+1,\ldots ,N_{levgrnd} \qquad {\rm melting}} \\ {T_{i}^{n+1} 0\qquad i=snl+1,\ldots ,0\qquad {\rm freezing}} \\ {T_{i}^{n+1} w_{liq,\, \max ,\, i} \qquad i=1,\ldots ,N_{levgrnd} \qquad {\rm freezing}} \end{array} + +where :math:`T_{i}^{n+1}` is the soil layer temperature after solution +of the tridiagonal equation set, :math:`w_{ice,\, i}` and +:math:`w_{liq,\, i}` are the mass of ice and liquid water (kg +m\ :math:`{}^{-2}`) in each snow/soil layer, respectively, and +:math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). For +the freezing process in soil layers, the concept of supercooled soil +water from Niu and Yang (2006) is adopted. The supercooled soil water is +the liquid water that coexists with ice over a wide range of +temperatures below freezing and is implemented through a freezing point +depression equation + +.. math:: + :label: ZEqnNum547401 + + w_{liq,\, \max ,\, i} =\Delta z_{i} \theta _{sat,\, i} \left[\frac{10^{3} L_{f} \left(T_{f} -T_{i} \right)}{gT_{i} \psi _{sat,\, i} } \right]^{{-1\mathord{\left/ {\vphantom {-1 B_{i} }} \right. \kern-\nulldelimiterspace} B_{i} } } \qquad T_{i} 0`) +but there are no explicit snow layers (:math:`snl=0`) (i.e., there is +not enough snow present to meet the minimum snow depth requirement of +0.01 m), snow melt will take place for soil layer :math:`i=1` if the +soil layer temperature is greater than the freezing temperature +(:math:`T_{1}^{n+1} >T_{f}` ). + +The rate of phase change is assessed from the energy excess (or deficit) +needed to change :math:`T_{i}` to freezing temperature, :math:`T_{f}` . +The excess or deficit of energy :math:`H_{i}` (W m\ :math:`{}^{-2}`) is +determined as follows + +.. math:: + :label: 6.55) + + H_{i} =\left\{\begin{array}{l} {\frac{\partial h}{\partial T} \left(T_{f} -T_{i}^{n} \right)-\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right)\qquad \quad \quad \quad i=snl+1} \\ {\left(1-f_{sno} -f_{h2osfc} \right)\frac{\partial h}{\partial T} \left(T_{f} -T_{i}^{n} \right)-\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right)\quad {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} i=1} \\ {-\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right)\qquad \quad \quad \quad i\ne \left\{1,snl+1\right\}} \end{array}\right\}. + +If the melting criteria is met (equation ) and +:math:`H_{m} =\frac{H_{i} \Delta t}{L_{f} } >0`, then the ice mass is +readjusted as + +.. math:: + :label: ZEqnNum547839 + + w_{ice,\, i}^{n+1} =w_{ice,\, i}^{n} -H_{m} \ge 0\qquad i=snl+1,\ldots ,N_{levgrnd} . + +If the freezing criteria is met (equation ) and :math:`H_{m} <0`, then +the ice mass is readjusted for :math:`i=snl+1,\ldots ,0` as + +.. math:: + :label: 6.57) + + w_{ice,\, i}^{n+1} =\min \left(w_{liq,\, i}^{n} +w_{ice,\, i}^{n} ,w_{ice,\, i}^{n} -H_{m} \right) + +and for :math:`i=1,\ldots ,N_{levgrnd}` as + +.. math:: + :label: 6.58) + + w_{ice,\, i}^{n+1} =\left\{\begin{array}{l} {\min \left(w_{liq,\, i}^{n} +w_{ice,\, i}^{n} -w_{liq,\, \max ,\, i}^{n} ,\, w_{ice,\, i}^{n} -H_{m} \right)\qquad w_{liq,\, i}^{n} +w_{ice,\, i}^{n} \ge w_{liq,\, \max ,\, i}^{n} {\rm \; }} \\ {{\rm 0}\qquad w_{liq,\, i}^{n} +w_{ice,\, i}^{n} 0`) as + +.. math:: + :label: ZEqnNum190862 + + T_{i}^{n+1} =\left\{\begin{array}{l} {T_{f} +{\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \mathord{\left/ {\vphantom {\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \left(1-\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)}} \right. \kern-\nulldelimiterspace} \left(1-\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)} \qquad \quad \quad \quad \quad \quad \, i=snl+1} \\ {T_{f} +{\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \mathord{\left/ {\vphantom {\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \left(1-\left(1-f_{sno} -f_{h2osfc} \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)}} \right. \kern-\nulldelimiterspace} \left(1-\left(1-f_{sno} -f_{h2osfc} \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)} \qquad i=1} \\ {T_{f} +\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \qquad \quad \quad \quad \quad \quad \, i\ne \left\{1,snl+1\right\}} \end{array}\right\}. + +For the special case when snow is present (:math:`W_{sno} >0`), there +are no explicit snow layers (:math:`snl=0`), and +:math:`\frac{H_{1} \Delta t}{L_{f} } >0` (melting), the snow mass +:math:`W_{sno}` (kg m\ :math:`{}^{-2}`) is reduced according to + +.. math:: + :label: 6.62) + + W_{sno}^{n+1} =W_{sno}^{n} -\frac{H_{1} \Delta t}{L_{f} } \ge 0. + +The snow depth is reduced proportionally + +.. math:: + :label: 6.63) + + z_{sno}^{n+1} =\frac{W_{sno}^{n+1} }{W_{sno}^{n} } z_{sno}^{n} . + +Again, because part of the energy may not be consumed in melting, the +energy for the surface soil layer :math:`i=1` is recalculated as + +.. math:: + :label: 6.64) + + H_{1*} =H_{1} -\frac{L_{f} \left(W_{sno}^{n} -W_{sno}^{n+1} \right)}{\Delta t} . + +If there is excess energy (:math:`H_{1*} >0`), this energy becomes +available to the top soil layer as + +.. math:: + :label: ZEqnNum985120 + + H_{1} =H_{1*} . + +The ice mass, liquid water content, and temperature of the top soil +layer are then determined from equations , , and using the recalculated +energy from equation . Snow melt :math:`M_{1S}` (kg m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`) and phase change energy :math:`E_{p,\, 1S}` (W +m\ :math:`{}^{-2}`) for this special case are + +.. math:: + :label: 6.66) + + M_{1S} =\frac{W_{sno}^{n} -W_{sno}^{n+1} }{\Delta t} \ge 0 + +.. math:: + :label: 6.67) + + E_{p,\, 1S} =L_{f} M_{1S} . + +The total energy of phase change :math:`E_{p}` (W m\ :math:`{}^{-2}`) +for the snow/soil column is + +.. math:: + :label: 6.68) + + E_{p} =E_{p,\, 1S} +\sum _{i=snl+1}^{N_{levgrnd} }E_{p,i} + +where + +.. math:: + :label: 6.69) + + E_{p,\, i} =L_{f} \frac{\left(w_{ice,\, i}^{n} -w_{ice,\, i}^{n+1} \right)}{\Delta t} . + +The total snow melt :math:`M` (kg m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`) is + +.. math:: + :label: 6.70) + + M=M_{1S} +\sum _{i=snl+1}^{i=0}M_{i} + +where + +.. math:: + :label: 6.71) + + M_{i} =\frac{\left(w_{ice,\, i}^{n} -w_{ice,\, i}^{n+1} \right)}{\Delta t} \ge 0. + +The solution for snow/soil temperatures conserves energy as + +.. math:: + :label: 6.72) + + G-E_{p} -\sum _{i=snl+1}^{i=N_{levgrnd} }\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=0 + +where :math:`G` is the ground heat flux (section 5.4). + +Surface Water +^^^^^^^^^^^^^^^^^^^ + +Phase change of surface water takes place when the surface water +temperature, :math:`T_{h2osfc}` , becomes less than :math:`T_{f}` . The +energy available for freezing is + +.. math:: + :label: 6.73) + + H_{h2osfc} =\frac{\partial h}{\partial T} \left(T_{f} -T_{h2osfc}^{n} \right)-\frac{c_{h2osfc} \Delta z_{h2osfc} }{\Delta t} \left(T_{f} -T_{h2osfc}^{n} \right) + +where :math:`c_{h2osfc}` is the volumetric heat capacity of water, and +:math:`\Delta z_{h2osfc}` is the depth of the surface water layer. If +:math:`H_{m} =\frac{H_{h2osfc} \Delta t}{L_{f} } >0` then :math:`H_{m}` +is removed from surface water and added to the snow column as ice + +.. math:: + :label: 6.74) + + H^{n+1} _{h2osfc} =H^{n} _{h2osfc} -H_{m} + +.. math:: + :label: 6.75) + + w_{ice,\, 0}^{n+1} =w_{ice,\, 0}^{n} +H_{m} + +The snow depth is adjusted to account for the additional ice mass + +.. math:: + :label: 6.76) + + \Delta z_{sno} =\frac{H_{m} }{\rho _{ice} } + +If :math:`H_{m}` \ is greater than :math:`W_{sfc}` , the excess heat +:math:`\frac{L_{f} \left(H_{m} -W_{sfc} \right)}{\Delta t}` is used to +cool the snow layer. + +Soil and Snow Thermal Properties +------------------------------------ + +The thermal and hydraulic (section 6.3 and 7.4.1) properties of the soil +are assumed to be a weighted combination of the mineral and organic +properties of the soil (Lawrence and Slater 2008). The soil layer +organic matter fraction :math:`f_{om,i}` is + +.. math:: + :label: 6.77) + + f_{om,i} =\rho _{om,i} /\rho _{om,\max } . + +Soil thermal conductivity :math:`\lambda _{i}` (W m\ :math:`{}^{-1}` +K\ :math:`{}^{-1}`) is from Farouki (1981) + +.. math:: + :label: 6.78) + + \begin{array}{l} {\lambda _{i} =\left\{\begin{array}{l} {K_{e,\, i} \lambda _{sat,\, i} +\left(1-K_{e,\, i} \right)\lambda _{dry,\, i} \qquad S_{r,\, i} >1\times 10^{-7} } \\ {\lambda _{dry,\, i} \qquad S_{r,\, i} \le 1\times 10^{-7} } \end{array}\right\}\qquad i=1,\ldots ,N_{levsoi} } \\ {\lambda _{i} =\lambda _{bedrock} \qquad i=N_{levsoi} +1,\ldots N_{levgrnd} } \end{array} + +where :math:`\lambda _{sat,\, i}` is the saturated thermal +conductivity, :math:`\lambda _{dry,\, i}` is the dry thermal +conductivity, :math:`K_{e,\, i}` is the Kersten number, +:math:`S_{r,\, i}` is the wetness of the soil with respect to +saturation, and :math:`\lambda _{bedrock} =3` W m\ :math:`{}^{-1}` +K\ :math:`{}^{-1}` is the thermal conductivity assumed for the deep +ground layers (typical of saturated granitic rock; Clauser and Huenges, +1995). For glaciers and wetlands, + +.. math:: + :label: 6.79) + + \lambda _{i} =\left\{\begin{array}{l} {\lambda _{liq,\, i} \qquad T_{i} \ge T_{f} } \\ {\lambda _{ice,\, i} \qquad T_{i} 0`) but +there are no explicit snow layers (:math:`snl=0`), the heat capacity of +the top layer is a blend of ice and soil heat capacity + +.. math:: + :label: 6.93) + + c_{1} =c_{1}^{\*} +\frac{C_{ice} W_{sno} }{\Delta z_{1} } + +where :math:`c_{1}^{\*}` is calculated from equation or . + +.. todo:: fill in the above - should be calculated form equation (6.89) or (6.92) + diff --git a/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst b/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst new file mode 100644 index 0000000000..47359c6b77 --- /dev/null +++ b/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst @@ -0,0 +1,2167 @@ +Hydrology +============ + +The model parameterizes interception, throughfall, canopy drip, snow +accumulation and melt, water transfer between snow layers, infiltration, +evaporation, surface runoff, sub-surface drainage, redistribution within +the soil column, and groundwater discharge and recharge to simulate +changes in canopy water :math:`\Delta W_{can}` , surface water +:math:`\Delta W_{sfc}` , snow water :math:`\Delta W_{sno}` , soil water +:math:`\Delta w_{liq,\, i}` , and soil ice :math:`\Delta w_{ice,\, i}` , +and water in the unconfined aquifer :math:`\Delta W_{a}` (all in kg +m\ :math:`{}^{-2}` or mm of H\ :math:`{}_{2}`\ O) (Figure 7.1). + +The total water balance of the system is + +.. math:: + :label: 7.1) + + \begin{array}{l} {\Delta W_{can} +\Delta W_{sfc} +\Delta W_{sno} +} \\ {\sum _{i=1}^{N_{levsoi} }\left(\Delta w_{liq,\, i} +\Delta w_{ice,\, i} \right)+\Delta W_{a} =\left(\begin{array}{l} {q_{rain} +q_{sno} -E_{v} -E_{g} -q_{over} } \\ {-q_{h2osfc} -q_{drai} -q_{rgwl} -q_{snwcp,\, ice} } \end{array}\right) \Delta t} \end{array} + +where :math:`q_{rain}` is the liquid part of precipitation, +:math:`q_{sno}` is the solid part of precipitation, :math:`E_{v}` is +ET from vegetation (Chapter 5), :math:`E_{g}` is ground evaporation +(Chapter 5), :math:`q_{over}` is surface runoff (section 7.3), +:math:`q_{h2osfc}` is runoff from surface water storage (section 7.3), +:math:`q_{drai}` is sub-surface drainage (section 7.6), +:math:`q_{rgwl}` and :math:`q_{snwcp,ice}` are liquid and solid runoff +from glaciers, wetlands, and lakes, and runoff from other surface types +due to snow capping (section 7.7) (all in kg m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`), :math:`N_{levsoi}` is the number of soil layers +(note that hydrology calculations are only done over soil layers 1 to +:math:`N_{levsoi}` ; ground levels :math:`N_{levsoi} +1`\ to +:math:`N_{levgrnd}` are currently hydrologically inactive; Lawrence et +al. 2008) and :math:`\Delta t` is the time step (s). + +Figure 7.1. Hydrologic processes represented in CLM. + +.. image:: image1.png + +Canopy Water +---------------- + +Precipitation is either intercepted by the canopy, falls directly to the +snow/soil surface (throughfall), or drips off the vegetation (canopy +drip). Interception by vegetation :math:`q_{intr}` (kg +m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) does not distinguish between +liquid and solid phases + +.. math:: + :label: 7.2) + + q_{intr} =\alpha \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} + +where :math:`L` and :math:`S` are the exposed leaf and stem area index, +respectively (section 2.1.4), and :math:`\alpha =0.25` scales +interception from point to grid cell (Lawrence et al. 2007). Throughfall +(kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), however, is divided into +liquid and solid phases reaching the ground (soil or snow surface) as + +.. math:: + :label: 7.3) + + q_{thru,\, liq} =q_{rain} \left[1-\alpha \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right] + +.. math:: + :label: 7.4) + + q_{thru,\, ice} =q_{sno} \left[1-\alpha \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right]. + +Similarly, the canopy drip is + +.. math:: + :label: 7.5) + + q_{drip,\, liq} =\frac{W_{can}^{intr} -W_{can,\, \max } }{\Delta t} \frac{q_{rain} }{q_{rain} +q_{sno} } \ge 0 + +.. math:: + :label: 7.6) + + q_{drip,\, ice} =\frac{W_{can}^{intr} -W_{can,\, \max } }{\Delta t} \frac{q_{sno} }{q_{rain} +q_{sno} } \ge 0 + +where + +.. math:: + :label: 7.7) + + W_{can}^{intr} =W_{can}^{n} +q_{intr} \Delta t\ge 0 + +is the canopy water after accounting for interception, +:math:`W_{can}^{n}` is the canopy water from the previous time step, +and :math:`W_{can,\, \max }` (kg m\ :math:`{}^{-2}`) is the maximum +amount of water the canopy can hold + +.. math:: + :label: 7.8) + + W_{can,\, \max } =p\left(L+S\right). + +The maximum storage of solid water is assumed to be the same as that of +liquid water, :math:`p=0.1` kg m\ :math:`{}^{-2}` (Dickinson et al. +1993). The canopy water is updated as + +.. math:: + :label: 7.9) + + W_{can}^{n+1} =W_{can}^{n} +q_{intr} \Delta t-\left(q_{drip,\, liq} +q_{drip,\, ice} \right)\Delta t-E_{v}^{w} \Delta t\ge 0. + +where :math:`E_{v}^{w}` is the flux of water vapor from stem and leaf +surfaces (Chapter 5). The total rate of liquid and solid precipitation +reaching the ground is then + +.. math:: + :label: ZEqnNum946822 + + q_{grnd,liq} =q_{thru,\, liq} +q_{drip,\, liq} + +.. math:: + :label: ZEqnNum339590 + + q_{grnd,ice} =q_{thru,\, ice} +q_{drip,\, ice} . + +Solid precipitation reaching the soil or snow surface, +:math:`q_{grnd,\, ice} \Delta t`, is added immediately to the snow pack +(section 7.2). The liquid part, :math:`q_{grnd,\, liq} \Delta t` is +added after surface fluxes (Chapter 5) and snow/soil temperatures +(Chapter 6) have been determined. + +The wetted fraction of the canopy (stems plus leaves), which is required +for the surface albedo (section 3.1) and surface flux (Chapter 5) +calculations is (Dickinson et al. 1993) + +.. math:: + :label: 7.12) + + f_{wet} =\left\{\begin{array}{l} {\left[\frac{W_{can} }{p\left(L+S\right)} \right]^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \le 1\qquad L+S>0} \\ {0\qquad L+S=0} \end{array}\right\} + +while the fraction of the canopy that is dry and transpiring is + +.. math:: + :label: 7.13) + + f_{dry} =\left\{\begin{array}{l} {\frac{\left(1-f_{wet} \right)L}{L+S} \qquad L+S>0} \\ {0\qquad L+S=0} \end{array}\right\}. + +Snow +-------- + +The parameterizations for snow are based primarily on Anderson (1976), +country-regionplaceJordan (1991), and Dai and Zeng (1997). The snowpack +can have up to five layers. These layers are indexed in the Fortran code +as :math:`i=-4,-3,-2,-1,0` where layer :math:`i=0` is the snow layer +next to the top soil layer and layer :math:`i=-4` is the top layer of a +five-layer snow pack. Since the number of snow layers varies according +to the snow depth, we use the notation :math:`snl+1` to describe the top +layer of snow for the variable layer snow pack, where :math:`snl` is the +negative of the number of snow layers. Refer to Figure 7.2 for an +example of the snow layer structure for a three layer snow pack. + +Figure 7.2. Example of three layer snow pack (:math:`snl=-3`). + +Shown are three snow layers, :math:`i=-2`, :math:`i=-1`, and +:math:`i=0`. The layer node depth is :math:`z`, the layer interface is +:math:`z_{h}` , and the layer thickness is :math:`\Delta z`. + +.. image:: image2.png + +The state variables for snow are the mass of water :math:`w_{liq,i}` +(kg m\ :math:`{}^{-2}`), mass of ice :math:`w_{ice,i}` (kg +m\ :math:`{}^{-2}`), layer thickness :math:`\Delta z_{i}` (m), and +temperature :math:`T_{i}` (Chapter 6). The water vapor phase is +neglected. Snow can also exist in the model without being represented by +explicit snow layers. This occurs when the snowpack is less than a +specified minimum snow depth (:math:`z_{sno} <0.01` m). In this case, +the state variable is the mass of snow :math:`W_{sno}` (kg +m\ :math:`{}^{-2}`). + +Section 7.2.1 describes the calculation of fractional snow covered area, +which is used in the surface albedo calculation (Chapter 3) and the +surface flux calculations (Chapter 5). The following two sections (7.2.2 +and 7.2.3) describe the ice and water content of the snow pack assuming +that at least one snow layer exists. Section 7.2.4 describes how black +and organic carbon and mineral dust particles are represented within +snow, including meltwater flushing. See section 7.2.5 for a description +of how a snow layer is initialized. + +Snow Covered Area Fraction +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The fraction of the ground covered by snow, :math:`f_{sno}` , is based +on the method of Swenson and Lawrence (2012). Because the processes +governing snowfall and snowmelt differ, changes in :math:`f_{sno}` are +calculated separately for accumulation and depletion. When snowfall +occurs, :math:`f_{sno}` is updated as + +.. math:: + :label: 7.14) + + f^{n+1} _{sno} =1-\left(\left(1-\tanh (k_{accum} q_{sno} \Delta t)\right)\left(1-f^{n} _{sno} \right)\right) + +where :math:`k_{accum}` is a constant whose default value is 0.1, +:math:`q_{sno} \Delta t` is the amount of new snow, +:math:`f^{n+1} _{sno}` is the updated snow covered fraction (SCF), and +:math:`f^{n} _{sno}` is the SCF from the previous time step. + +When snow melt occurs, :math:`f_{sno}` is calculated from the depletion +curve + +.. math:: + :label: 7.15) + + f_{sno} =1-\left(\frac{\cos ^{-1} \left(2R_{sno} -1\right)}{\pi } \right)^{N_{melt} } + +where :math:`R_{sno}` is the ratio of :math:`W_{sno}` to the maximum +accumulated snow :math:`W_{\max }` , and :math:`N_{melt}` is a +parameter that depends on the topographic variability within the grid +cell. Whenever :math:`W_{sno}` reaches zero, :math:`W_{\max }` is +reset to zero. The depletion curve shape parameter is defined as + +.. math:: + :label: 7.16) + + N_{melt} =\frac{200}{\min \left(10,\sigma _{topo} \right)} + +The standard deviation of the elevation within a grid cell, +:math:`\sigma _{topo}` , is calculated from a high resolution DEM (a +1km DEM is used for CLM). + +Ice Content +^^^^^^^^^^^^^^^^^ + +The conservation equation for mass of ice in snow layers is + +.. math:: + :label: 7.17) + + \frac{\partial w_{ice,\, i} }{\partial t} =\left\{\begin{array}{l} {f_{sno} q_{ice,\, i-1} -\frac{\left(\Delta w_{ice,\, i} \right)_{p} }{\Delta t} \qquad i=snl+1} \\ {-\frac{\left(\Delta w_{ice,\, i} \right)_{p} }{\Delta t} \qquad i=snl+2,\ldots ,0} \end{array}\right\} + +where :math:`q_{ice,\, i-1}` is the rate of ice accumulation from +precipitation or frost or the rate of ice loss from sublimation (kg +m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) in the top layer and +:math:`{\left(\Delta w_{ice,\, i} \right)_{p} \mathord{\left/ {\vphantom {\left(\Delta w_{ice,\, i} \right)_{p} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t}` +is the change in ice due to phase change (melting rate) (section 6.2). +The term :math:`q_{ice,\, i-1}` is computed in two steps as + +.. math:: + :label: 7.18) + + q_{ice,\, i-1} =q_{grnd,\, ice} +\left(q_{frost} -q_{subl} \right) + +where :math:`q_{grnd,\, ice}` is the rate of solid precipitation +reaching the ground (section 7.1) and :math:`q_{frost}` and +:math:`q_{subl}` are gains due to frost and losses due to sublimation, +respectively (section 5.4). In the first step, immediately after +:math:`q_{grnd,\, ice}` has been determined after accounting for +interception (section 7.1), a new snow depth :math:`z_{sno}` (m) is +calculated from + +.. math:: + :label: 7.19) + + z_{sno}^{n+1} =z_{sno}^{n} +\Delta z_{sno} + +where + +.. math:: + :label: 7.20) + + \Delta z_{sno} =\frac{q_{grnd,\, ice} \Delta t}{f_{sno} \rho _{sno} } + +and :math:`\rho _{sno}` is the bulk density of newly fallen snow (kg +m\ :math:`{}^{-3}`) (CityplaceAnderson 1976) + +.. math:: + :label: 7.21) + + \rho _{sno} =\left\{\begin{array}{l} {50+1.7\left(17\right)^{1.5} \qquad T_{atm} >T_{f} +2} \\ {50+1.7\left(T_{atm} -T_{f} +15\right)^{1.5} \qquad T_{f} -15T_{f}` ). In this case, the incoming solid precipitation +is assigned to the runoff term :math:`q_{rgwl}` (section 7.7). + +In the second step, after surface fluxes and snow/soil temperatures have +been determined (Chapters 5 and 6), :math:`w_{ice,\, snl+1}` is updated +for frost or sublimation as + +.. math:: + :label: ZEqnNum863244 + + w_{ice,\, snl+1}^{n+1} =w_{ice,\, snl+1}^{n} +f_{sno} \left(q_{frost} -q_{subl} \right)\Delta t. + +If :math:`w_{ice,\, snl+1}^{n+1} <0` upon solution of equation , the ice +content is reset to zero and the liquid water content +:math:`w_{liq,\, snl+1}` is reduced by the amount required to bring +:math:`w_{ice,\, snl+1}^{n+1}` up to zero. + +The snow water equivalent :math:`W_{sno}` is capped to not exceed 1000 +kg m\ :math:`{}^{-2}`. If the addition of :math:`q_{frost}` were to +result in :math:`W_{sno} >1000` kg m\ :math:`{}^{-2}`, the frost term +:math:`q_{frost}` is instead added to the ice runoff term +:math:`q_{snwcp,\, ice}` (section 7.7). + +Water Content +^^^^^^^^^^^^^^^^^^^ + +The conservation equation for mass of water in snow layers is + +.. math:: + :label: 7.26) + + \frac{\partial w_{liq,\, i} }{\partial t} =\left(q_{liq,\, i-1} -q_{liq,\, i} \right)+\frac{\left(\Delta w_{liq,\, i} \right)_{p} }{\Delta t} + +where :math:`q_{liq,\, i-1}` is the flow of liquid water into layer +:math:`i` from the layer above, :math:`q_{liq,\, i}` is the flow of +water out of layer :math:`i` to the layer below, +:math:`{\left(\Delta w_{liq,\, i} \right)_{p} \mathord{\left/ {\vphantom {\left(\Delta w_{liq,\, i} \right)_{p} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t}` +is the change in liquid water due to phase change (melting rate) +(section 6.2). For the top snow layer only, + +.. math:: + :label: 7.27) + + q_{liq,\, i-1} =f_{sno} \left(q_{grnd,\, liq} +\left(q_{sdew} -q_{seva} \right)\right) + +where :math:`q_{grnd,\, liq}` is the rate of liquid precipitation +reaching the snow (section 7.1), :math:`q_{seva}` is the evaporation of +liquid water and :math:`q_{sdew}` is the liquid dew (section 5.4). +After surface fluxes and snow/soil temperatures have been determined +(Chapters 5 and 6), :math:`w_{liq,\, snl+1}` is updated for the liquid +precipitation reaching the ground and dew or evaporation as + +.. math:: + :label: 7.28) + + w_{liq,\, snl+1}^{n+1} =w_{liq,\, snl+1}^{n} +f_{sno} \left(q_{grnd,\, liq} +q_{sdew} -q_{seva} \right)\Delta t. + +When the liquid water within a snow layer exceeds the layer’s holding +capacity, the excess water is added to the underlying layer, limited by +the effective porosity (:math:`1-\theta _{ice}` ) of the layer. The flow +of water is assumed to be zero (:math:`q_{liq,\, i} =0`) if the +effective porosity of either of the two layers +(:math:`1-\theta _{ice,\, i} {\rm \; and\; }1-\theta _{ice,\, i+1}` ) is +less than :math:`\theta _{imp} =0.05`, the water impermeable volumetric +water content. Thus, water flow between layers, :math:`q_{liq,\, i}` , +for layers :math:`i=snl+1,\ldots ,0`, is initially calculated as + +.. math:: + :label: ZEqnNum767577 + + q_{liq,\, i} =\frac{\rho _{liq} \left[\theta _{liq,\, i} -S_{r} \left(1-\theta _{ice,\, i} \right)\right]f_{sno} \Delta z_{i} }{\Delta t} \ge 0 + +where the volumetric liquid water :math:`\theta _{liq,\, i}` and ice +:math:`\theta _{ice,\, i}` contents are + +.. math:: + :label: 7.30) + + \theta _{ice,\, i} =\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} \rho _{ice} } \le 1 + +.. math:: + :label: 7.31) + + \theta _{liq,\, i} =\frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} \rho _{liq} } \le 1-\theta _{ice,\, i} , + +and :math:`S_{r} =0.033` is the irreducible water saturation (snow +holds a certain amount of liquid water due to capillary retention after +drainage has ceased (Anderson 1976)). The water holding capacity of the +underlying layer limits the flow of water :math:`q_{liq,\, i}` +calculated in equation , unless the underlying layer is the surface soil +layer, as + +.. math:: + :label: 7.32) + + q_{liq,\, i} \le \frac{\rho _{liq} \left[1-\theta _{ice,\, i+1} -\theta _{liq,\, i+1} \right]\Delta z_{i+1} }{\Delta t} \qquad i=snl+1,\ldots ,-1. + +The liquid water content :math:`w_{liq,\, i}` is updated as + +.. math:: + :label: ZEqnNum265203 + + w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\left(q_{i-1} -q_{i} \right)\Delta t. + +Equations - are solved sequentially from top (:math:`i=snl+1`) to +bottom (:math:`i=0`) snow layer in each time step. The total flow of +liquid water reaching the soil surface is then :math:`q_{liq,\, 0}` +which is used in the calculation of surface runoff and infiltration +(section 7.3). + +Black and organic carbon and mineral dust within snow +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Particles within snow originate from atmospheric aerosol deposition +(:math:`D_{sp}` in Table 2.3 (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) +and influence snow radiative transfer (sections 3.2.1, 3.2.2, and +3.3.3). Particle masses and mixing ratios are represented with a simple +mass-conserving scheme. The model maintains masses of the following +eight particle species within each snow layer: hydrophilic black carbon, +hydrophobic black carbon, hydrophilic organic carbon, hydrophobic +organic carbon, and four species of mineral dust with the following +particle sizes: 0.1-1.0, 1.0-2.5, 2.5-5.0, and 5.0-10.0 :math:`\mu m`. +Each of these species has unique optical properties (Table 3.5) and +meltwater removal efficiencies (Table 7.1). + +The black carbon and organic carbon deposition rates described in Table +2.3 are combined into four categories as follows + +.. math:: + :label: 7.34) + + D_{bc,\, hphil} =D_{bc,\, dryhphil} +D_{bc,\, wethphil} + +.. math:: + :label: 7.35) + + D_{bc,\, hphob} =D_{bc,\, dryhphob} + +.. math:: + :label: 7.36) + + D_{oc,\, hphil} =D_{oc,\, dryhphil} +D_{oc,\, wethphil} + +.. math:: + :label: 7.37) + + D_{oc,\, hphob} =D_{oc,\, dryhphob} + +Deposited particles are assumed to be instantly mixed (homogeneously) +within the surface snow layer and are added after the inter-layer water +fluxes are computed (section 7.2.3) so that some aerosol is in the top +layer after deposition and is not immediately washed out before +radiative calculations are done. Particle masses are then redistributed +each time step based on meltwater drainage through the snow column +(section 7.2.3) and snow layer combination and subdivision (section +7.2.7). The change in mass of each of the particle species +:math:`\Delta m_{sp,\, i}` (kg m\ :math:`{}^{-2}`) is + +.. math:: + :label: 7.38) + + \Delta m_{sp,\, i} =\left[k_{sp} \left(q_{liq,\, i-1} c_{sp,\, i-1} -q_{liq,\, i} c_{i} \right)+D_{sp} \right]\Delta t + +where :math:`k_{sp}` is the meltwater scavenging efficiency that is +unique for each species (Table 7.1), :math:`q_{liq,\, i-1}` is the flow +of liquid water into layer :math:`i` from the layer above, +:math:`q_{liq,\, i}` is the flow of water out of layer :math:`i` into +the layer below (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) (section +7.2.3), :math:`c_{sp,\, i-1}` and :math:`c_{sp,\, i}` are the particle +mass mixing ratios in layers :math:`i-1` and :math:`i` (kg +kg\ :math:`{}^{-1}`), :math:`D_{sp}` is the atmospheric deposition rate +(zero for all layers except layer :math:`snl+1`), and :math:`\Delta t` +is the model time step (s). The particle mass mixing ratio is + +.. math:: + :label: 7.39) + + c_{i} =\frac{m_{sp,\, i} }{w_{liq,\, i} +w_{ice,\, i} } . + +Values of :math:`k_{sp}` are partially derived from experiments +published by Conway et al. (1996). Particles masses are re-distributed +proportionately with snow mass when layers are combined or divided, thus +conserving particle mass within the snow column. The mass of particles +carried out with meltwater through the bottom snow layer is assumed to +be permanently lost from the snowpack, and is not maintained within the +model. + +Table 7.1. Meltwater scavenging efficiency for particles within snow + ++------------------------------------------+-------------------+ +| Species | :math:`k_{sp}` | ++==========================================+===================+ +| Hydrophilic black carbon | 0.20 | ++------------------------------------------+-------------------+ +| Hydrophobic black carbon | 0.03 | ++------------------------------------------+-------------------+ +| Hydrophilic organic carbon | 0.20 | ++------------------------------------------+-------------------+ +| Hydrophobic organic carbon | 0.03 | ++------------------------------------------+-------------------+ +| Dust species 1 (0.1-1.0 :math:`\mu m`) | 0.02 | ++------------------------------------------+-------------------+ +| Dust species 2 (1.0-2.5 :math:`\mu m`) | 0.02 | ++------------------------------------------+-------------------+ +| Dust species 3 (2.5-5.0 :math:`\mu m`) | 0.01 | ++------------------------------------------+-------------------+ +| Dust species 4 (5.0-10.0 :math:`\mu m`) | 0.01 | ++------------------------------------------+-------------------+ + +Initialization of snow layer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If there are no existing snow layers (:math:`snl+1=1`) but +:math:`z_{sno} \ge 0.01` m after accounting for solid precipitation +:math:`q_{sno}` , then a snow layer is initialized (:math:`snl=-1`) as +follows + +.. math:: + :label: 7.40) + + \begin{array}{l} {\Delta z_{0} =z_{sno} } \\ {z_{o} =-0.5\Delta z_{0} } \\ {z_{h,\, -1} =-\Delta z_{0} } \\ {T_{0} =\min \left(T_{f} ,T_{atm} \right)} \\ {w_{ice,\, 0} =W_{sno} } \\ {w_{liq,\, 0} =0} \end{array}. + +Snow Compaction +^^^^^^^^^^^^^^^^^^^^^ + +Snow compaction is initiated after the soil hydrology calculations +[surface runoff (section 7.3), infiltration (section 7.3), soil water +(section 7.4), groundwater-soilwater interactions (section 7.6)] are +complete. Compaction of snow includes three types of processes: +destructive metamorphism of new snow (crystal breakdown due to wind or +thermodynamic stress); snow load or overburden (pressure); and melting +(changes in snow structure due to melt-freeze cycles plus changes in +crystals due to liquid water). The total fractional compaction rate for +each snow layer :math:`C_{R,\, i}` (:math:`\text{s}^{-1}`) is the sum of the +three compaction processes + +.. math:: + :label: 7.41) + + C_{R,\, i} =\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} =C_{R1,\, i} +C_{R2,\, i} +C_{R3,\, i} . + +Compaction is not allowed if the layer is saturated + +.. math:: + :label: 7.42) + + 1-\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} \rho _{ice} } +\frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} \rho _{liq} } \right)\le 0.001 + +or if the ice content is below a minimum value +(:math:`w_{ice,\, i} \le 0.1`). + +Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` +(:math:`{\text s^{-1}}`) is temperature dependent (CityplaceAnderson 1976) + +.. math:: + :label: 7.43) + + C_{R1,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{metamorphism} =-c_{3} c_{1} c_{2} \exp \left[-c_{4} \left(T_{f} -T_{i} \right)\right] + +where :math:`c_{3} =2.777\times 10^{-6}` (:math:`\text{s}^{-1}`) is the +fractional compaction rate for :math:`T_{i} =T_{f}`, :math:`c_{4} =0.04` :math:`\text{K}^{-1}`, and + +.. math:: + :label: 7.44) + + c_{1} & = 1\qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \le 100{\rm \; kg\; m}^{{\rm -3}} \\ + c_{1} & = \exp \left[-0.046\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } -100\right)\right]\qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } >100{\rm \; kg\; m}^{{\rm -3}} \\ + c_{2} & = 2\qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } >0.01 \\ + c_{2} & = 1\qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } \le 0.01 + +where +:math:`{w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` +and +:math:`{w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` +are the bulk densities of liquid water and ice (kg m\ :math:`{}^{-3}`). + +The compaction rate as a result of overburden :math:`C_{R2,\; i}` +(:math:`\text{s}^{-1}`) is a linear function of the snow load pressure +:math:`P_{s,\, i}` (:math:`\text{k} \text{g} \text{m}^{-2}`) (CityplaceAnderson 1976) + +.. math:: + :label: 7.45) + + C_{R2,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{overburden} =-\frac{P_{s,\, i} }{\eta } + +where :math:`\eta` is a viscosity coefficient (:math:`\text{kg} \text{s} \text{m}^{-2}`) +that varies with density and temperature as + +.. math:: + :label: 7.46) + + \eta =\eta _{0} \exp \left[c_{5} \left(T_{f} -T_{i} \right)+c_{6} \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \right] + +where :math:`\eta _{0} =9\times 10^{5}` kg s m\ :math:`{}^{-2}`, and +:math:`c_{5} =0.08` K\ :math:`{}^{-1}`, :math:`c_{6} =0.023` +m\ :math:`{}^{3}` kg\ :math:`{}^{-1}` are constants. The snow load +pressure :math:`P_{s,\, i}` is calculated for each layer as the sum of +the ice :math:`w_{ice,\, i}` and liquid water contents +:math:`w_{liq,\, i}` of the layers above plus half the ice and liquid +water contents of the layer being compacted + +.. math:: + :label: 7.47) + + P_{s,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{2} +\sum _{j=snl+1}^{j=i-1}\left(w_{ice,\, j} +w_{liq,\, j} \right) . + +The compaction rate due to melting :math:`C_{R3,\; i}` +(:math:`\text{s}^{-1}`) is taken to be the ratio of the change in snow ice +mass after the melting to the mass before melting + +.. math:: + :label: 7.48) + + C_{R3,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{melt} =-\frac{1}{\Delta t} \max \left(0,\frac{W_{sno,\, i}^{n} -W_{sno,\, i}^{n+1} }{W_{sno,\, i}^{n} } \right) + +and melting is identified during the phase change calculations (section +6.2). Because snow depth is defined as the average depth of the snow +covered area, the snow depth must also be updated for changes in +:math:`f_{sno}` . + +.. math:: + :label: 7.49) + + C_{R4,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{fsno} =-\frac{1}{\Delta t} \max \left(0,\frac{f_{sno,\, i}^{n} -f_{sno,\, i}^{n+1} }{f_{sno,\, i}^{n} } \right) + +The snow layer thickness after compaction is then + +.. math:: + :label: 7.50) + + \Delta z_{i}^{n+1} =\Delta z_{i}^{n} \left(1+C_{R,\, i} \Delta t\right). + +Snow Layer Combination and Subdivision +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +After the determination of snow temperature including phase change +(Chapter 6), snow hydrology (sections 7.2.2, 7.2.3, and 7.2.4), and the +compaction calculations , the number of snow layers is adjusted by +either combining or subdividing layers. The combination and subdivision +of snow layers is based on Jordan (1991). + +7.2.7.1 Combination +''''''''''''''''''' + +If a snow layer has nearly melted or if its thickness +:math:`\Delta z_{i}` is less than the prescribed minimum thickness +:math:`\Delta z_{\min }` (Table 7.2), the layer is combined with a +neighboring layer. The overlying or underlying layer is selected as the +neighboring layer according to the following rules + +#. If the top layer is being removed, it is combined with the underlying + layer + +#. If the underlying layer is not snow (i.e., it is the top soil layer), + the layer is combined with the overlying layer + +#. If the layer is nearly completely melted, the layer is combined with + the underlying layer + +#. If none of the above rules apply, the layer is combined with the + thinnest neighboring layer. + +A first pass is made through all snow layers to determine if any layer +is nearly melted (:math:`w_{ice,\, i} \le 0.1`). If so, the remaining +liquid water and ice content of layer :math:`i` is combined with the +underlying neighbor :math:`i+1` as + +.. math:: + :label: 7.51) + + w_{liq,\, i+1} =w_{liq,\, i+1} +w_{liq,\, i} + +.. math:: + :label: 7.52) + + w_{ice,\, i+1} =w_{ice,\, i+1} +w_{ice,\, i} . + +This includes the snow layer directly above the top soil layer. In this +case, the liquid water and ice content of the melted snow layer is added +to the contents of the top soil layer. The layer properties, +:math:`T_{i}` , :math:`w_{ice,\, i}` , :math:`w_{liq,\, i}` , +:math:`\Delta z_{i}` , are then re-indexed so that the layers above the +eliminated layer are shifted down by one and the number of snow layers +is decremented accordingly. + +At this point, if there are no explicit snow layers remaining +(:math:`snl=0`), the snow water equivalent :math:`W_{sno}` and snow +depth :math:`z_{sno}` are set to zero, otherwise, :math:`W_{sno}` and +:math:`z_{sno}` are re-calculated as + +.. math:: + :label: 7.53) + + W_{sno} =\sum _{i=snl+1}^{i=0}\left(w_{ice,\, i} +w_{liq,\, i} \right) + +.. math:: + :label: 7.54) + + z_{sno} =\sum _{i=snl+1}^{i=0}\Delta z_{i} . + +If the snow depth :math:`0`\ 1 | 0.03 | 0.02 | ++--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ +| 2 | 0.015 | 2 | :math:`>`\ 2 | 0.07 | 0.05 | ++--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ +| 3 | 0.025 | 3 | :math:`>`\ 3 | 0.18 | 0.11 | ++--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ +| 4 | 0.055 | 4 | :math:`>`\ 4 | 0.41 | 0.23 | ++--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ +| 5 (bottom) | 0.115 | 5 | - | - | - | ++--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ + +The maximum snow layer thickness, :math:`\Delta z_{\max }` , depends on +the number of layers, :math:`N_{l}` and :math:`N_{u}` (section +7.2.7.2). + +7.2.7.2 Subdivision +''''''''''''''''''' + +The snow layers are subdivided when the layer thickness exceeds the +prescribed maximum thickness :math:`\Delta z_{\max }` with lower and +upper bounds that depend on the number of snow layers (Table 7.2). For +example, if there is only one layer, then the maximum thickness of that +layer is 0.03 m, however, if there is more than one layer, then the +maximum thickness of the top layer is 0.02 m. Layers are checked +sequentially from top to bottom for this limit. If there is only one +snow layer and its thickness is greater than 0.03 m (Table 7.2), the +layer is subdivided into two layers of equal thickness, liquid water and +ice contents, and temperature. If there is an existing layer below the +layer to be subdivided, the thickness :math:`\Delta z_{i}` , liquid +water and ice contents, :math:`w_{liq,\; i}` and :math:`w_{ice,\; i}` , +and temperature :math:`T_{i}` of the excess snow are combined with the +underlying layer according to equations -. If there is no underlying +layer after adjusting the layer for the excess snow, the layer is +subdivided into two layers of equal thickness, liquid water and ice +contents. The vertical snow temperature profile is maintained by +calculating the slope between the layer above the splitting layer +(:math:`T_{1}` ) and the splitting layer (:math:`T_{2}` ) and +constraining the new temperatures (:math:`T_{2}^{n+1}` , +:math:`T_{3}^{n+1}` ) to lie along this slope. The temperature of the +lower layer is first evaluated from + +.. math:: + :label: 7.62) + + T'_{3} =T_{2}^{n} -\left(\frac{T_{1}^{n} -T_{2}^{n} }{{\left(\Delta z_{1}^{n} +\Delta z_{2}^{n} \right)\mathord{\left/ {\vphantom {\left(\Delta z_{1}^{n} +\Delta z_{2}^{n} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \right)\left(\frac{\Delta z_{2}^{n+1} }{2} \right), + +then adjusted as, + +.. math:: + :label: 7.63) + + \begin{array}{l} {T_{3}^{n+1} =T_{2}^{n} \qquad T'_{3} \ge T_{f} } \\ {T_{2}^{n+1} =T_{2}^{n} +\left(\frac{T_{1}^{n} -T_{2}^{n} }{{\left(\Delta z_{1} +\Delta z_{2}^{n} \right)\mathord{\left/ {\vphantom {\left(\Delta z_{1} +\Delta z_{2}^{n} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \right)\left(\frac{\Delta z_{2}^{n+1} }{2} \right)\qquad T'_{3} f_{c} } \\ {f_{connected} =0\qquad \qquad \qquad for\, f_{h2osfc} \le f_{c} } \end{array} + +where :math:`f_{c}` is a threshold below which no single connected +inundated area spans the grid cell and :math:`\mu` is a scaling +exponent. Default values of :math:`f_{c}` and :math:`\mu` \ are 0.4 and +0.14, respectively. When the inundated fraction of the grid cell +surpasses :math:`f_{c}` , the surface water store acts as a linear +reservoir + +.. math:: + :label: 7.70) + + qout,h2osfc=kh2osfcf_{connected} (Wsfc-Wc)\frac{1}{\Delta t} + +where :math:`qout,h2osfc` is the surface water runoff, :math:`kh2osfc` +is a constant, :math:`Wc` is the amount of surface water present when +:math:`f_{h2osfc} =f_{c}` , and :math:`\Delta t` is the model time step. +The linear storage coefficent :math:`kh2osfc=\sin \left(\beta \right)` +is a function of grid cell mean topographic slope where :math:`\beta` +is the slope in radians. + +Infiltration +^^^^^^^^^^^^^^^^^^ + +The surface moisture flux remaining after surface runoff has been +removed, + +.. math:: + :label: 7.71) + + qin,surface=(1-f_{sat} )q_{liq,\, 0} + +is divided into inputs to surface water (:math:`q_{in,\, h2osfc}` ) and +the soil :math:`q_{in,soil}` . If :math:`q_{in,soil}` exceeds the +maximum soil infiltration capacity (kg m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}`), + +.. math:: + :label: ZEqnNum569150 + + q_{infl,\, \max } =(1-fsat){\rm \Theta }iceksat + +where :math:`{\rm \Theta }ice` is an ice impedance factor (section +7.4), infiltration excess (Hortonian) runoff is generated + +.. math:: + :label: 7.73) + + q_{infl,\, excess} =\max \left(q_{in,soil} -\left(1-f_{h2osfc} \right)q_{\inf l,\max } ,0\right) + +and transferred from :math:`q_{in,soil}` to :math:`q_{in,h2osfc}` . +After evaporative losses have been removed, these moisture fluxes are + +.. math:: + :label: 7.74) + + q_{in,\, h2osfc} =f_{h2osfc} q_{in,surface} +q_{infl,excess} -q_{evap,h2osfc} + +and + +.. math:: + :label: 7.75) + + qin,soil=(1-f_{h2osfc} )q_{in,surface} -q_{\inf l,excess} -(1-f_{sno} -f_{h2osfc} )qevap,soil. + +The balance of surface water is then calculated as + +.. math:: + :label: 7.76) + + \Delta W_{sfc} =\left(qin,h2osfc-qout,h2osfc-qdrain,h2osfc\right)\Delta t. + +Bottom drainage from the surface water store + +.. math:: + :label: 7.77) + + qdrain,h2osfc=\min \left(f_{h2osfc} q_{\inf l,\max } ,\frac{W_{sfc} }{\Delta t} \right) + +is then added to :math:`q_{in,soil}` giving the total infiltration +into the surface soil layer + +.. math:: + :label: 7.78) + + q_{infl} =q_{in,soil} +q_{drain,h2osfc} + +Infiltration :math:`q_{infl}` and explicit surface runoff +:math:`q_{over}` are not allowed for glaciers. + +Soil Water +-------------- + +Soil water is predicted from a multi-layer model, in which the vertical +soil moisture transport is governed by infiltration, surface and +sub-surface runoff, gradient diffusion, gravity, canopy transpiration +through root extraction, and interactions with groundwater (Figure 7.1). +The following derivation generally follows that of Z.-L. Yang (1998, +unpublished manuscript) with modifications by Zeng and Decker (2009). + +For one-dimensional vertical water flow in soils, the conservation of +mass is stated as + +.. math:: + :label: ZEqnNum790844 + + \frac{\partial \theta }{\partial t} =-\frac{\partial q}{\partial z} -Q + +where :math:`\theta` is the volumetric soil water content +(mm:math:`{}^{3}` of water mm\ :math:`{}^{-3}` of soil), :math:`t` is +time (s), :math:`z` is height above some datum in the soil column (mm) +(positive upwards), :math:`q` is soil water flux (kg m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}` or mm s\ :math:`{}^{-1}`) (positive upwards), and +:math:`Q` is a soil moisture sink term (mm of water mm\ :math:`{}^{-1}` +of soil s\ :math:`{}^{-1}`) (ET loss). This equation is solved +numerically by dividing the soil column into multiple layers in the +vertical and integrating downward over each layer with an upper boundary +condition of the infiltration flux into the top soil layer +:math:`q_{infl}` and a lower boundary condition that depends on the +depth of the water table. + +The soil water flux :math:`q` in equation can be described by Darcy’s +law + +.. math:: + :label: 7.80) + + q=-k\frac{\partial \psi _{h} }{\partial z} + +where :math:`k` is the hydraulic conductivity (mm s\ :math:`{}^{-1}`), +and :math:`\psi _{h}` is the hydraulic potential (mm). The hydraulic +potential is + +.. math:: + :label: 7.81) + + \psi _{h} =\psi _{m} +\psi _{z} + +where :math:`\psi _{m}` is the soil matric potential (mm) (which is +related to the adsorptive and capillary forces within the soil matrix), +and :math:`\psi _{z}` is the gravitational potential (mm) (the vertical +distance from an arbitrary reference elevation to a point in the soil). +If the reference elevation is the soil surface, then +:math:`\psi _{z} =z`. Letting :math:`\psi =\psi _{m}` , Darcy’s law +becomes + +.. math:: + :label: ZEqnNum186573 + + q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]. + +Darcy’s equation can be further manipulated to yield + +.. math:: + :label: 7.83) + + q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]=-k\left(\frac{\partial \psi }{\partial z} +1\right)=-k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right). + +Substitution of this equation into equation , with :math:`Q=0`, yields +the Richards equation + +.. math:: + :label: ZEqnNum670361 + + \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } \right)+1\right]. + +Zeng and Decker (2009) note that this :math:`\theta` -based form of the +Richards equation cannot maintain the hydrostatic equilibrium soil +moisture distribution because of the truncation errors of the +finite-difference numerical scheme. They show that this deficiency can +be overcome by subtracting the equilibrium state from equation as + +.. math:: + :label: ZEqnNum936839 + + q=-k\left[\frac{\partial \left(\psi +z-C\right)}{\partial z} \right] + +where :math:`C` is a constant hydraulic potential above the water table +:math:`z_{\nabla }` + +.. math:: + :label: ZEqnNum126975 + + C=\psi _{E} +z=\psi _{sat} \left[\frac{\theta _{E} \left(z\right)}{\theta _{sat} } \right]^{-B} +z=\psi _{sat} +z_{\nabla } + +so that + +.. math:: + :label: ZEqnNum537733 + + q=-k\left[\frac{\partial \left(\psi -\psi _{E} \right)}{\partial z} \right] + +where :math:`\psi _{E}` \ is the equilibrium soil matric potential +(mm). Substitution of equations and into equation yields Zeng and +Decker’s (2009) modified Richards equation + +.. math:: + :label: 7.88) + + \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \left(\psi -\psi _{E} \right)}{\partial z} \right)\right]-Q + +where the soil moisture sink term :math:`Q` is now included. + +Hydraulic Properties +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The hydraulic conductivity :math:`k_{i}` (mm s\ :math:`{}^{-1}`) and +the soil matric potential :math:`\psi _{i}` (mm) for layer :math:`i` +vary with volumetric soil water :math:`\theta _{i}` and soil texture. +As with the soil thermal properties (section 6.3) the hydraulic +properties of the soil are assumed to be a weighted combination of the +mineral properties, which are determined according to sand and clay +contents based on work by Clapp and Hornberger (1978) and Cosby et al. +(1984), and organic properties of the soil (Lawrence and Slater 2008). + +The hydraulic conductivity is defined at the depth of the interface of +two adjacent layers :math:`z_{h,\, i}` (Figure 7.3) and is a function +of the saturated hydraulic conductivity +:math:`k_{sat} \left[z_{h,\, i} \right]`, the liquid volumetric soil +moisture of the two layers :math:`\theta _{i}` and +:math:`\theta _{i+1}` and an ice impedance factor +:math:`\Theta _{ice}` + +.. math:: + :label: ZEqnNum398074 + + k\left[z_{h,\, i} \right]=\left\{\begin{array}{l} {\Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +3} \qquad 1\le i\le N_{levsoi} -1} \\ {\Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{2B_{i} +3} \qquad i=N_{levsoi} } \end{array}\right\}. + +The ice impedance factor is a function of ice content, and is meant to +quantify the increased tortuosity of the water flow when part of the +pore space is filled with ice. Swenson et al. (2012) used a power law +form :math:`\Theta _{ice} =10^{-\Omega F_{ice} }` where +:math:`\Omega =6`\ and +:math:`F_{ice} =\frac{\theta _{ice} }{\theta _{sat} }` is the +ice-filled fraction of the pore space. + +Because the hydraulic properties of mineral and organic soil may differ +significantly, the bulk hydraulic properties of each soil layer are +computed as weighted averages of the properties of the mineral and +organic components. The water content at saturation (i.e. porosity) is + +.. math:: + :label: 7.90) + + \theta _{sat,i} =(1-f_{om,i} )\theta _{sat,\min ,i} +f_{om,i} \theta _{sat,om} + +where :math:`f_{om,i}` is the soil organic matter fraction, +:math:`\theta _{sat,om} =0.9` (Farouki 1981; Letts et al. 2000) is the +porosity of organic matter and the porosity of the mineral soil +:math:`\theta _{sat,\min ,i}` is + +.. math:: + :label: 7.91) + + \theta _{sai,\min ,i} =0.489-0.00126(\% sand)_{i} . + +The exponent “:math:`B`” is + +.. math:: + :label: 7.92) + + B_{i} =(1-f_{om,i} )B_{\min ,i} +f_{om,i} B_{om} + +where :math:`B_{om} =2.7`\ (Letts et al. 2000) and + +.. math:: + :label: 7.93) + + B_{\min ,i} =2.91+0.159(\% clay)_{i} . + +The soil matric potential (mm) is defined at the node depth +:math:`z_{i}` of each layer :math:`i` (Figure 7.3) + +.. math:: + :label: ZEqnNum316201 + + \psi _{i} =\psi _{sat,\, i} \left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{-B_{i} } \ge -1\times 10^{8} \qquad 0.01\le \frac{\theta _{i} }{\theta _{sat,\, i} } \le 1 + +where the saturated soil matric potential (mm) is + +.. math:: + :label: 7.95) + + \psi _{sat,i} =(1-f_{om,i} )\psi _{sat,\min ,i} +f_{om,i} \psi _{sat,om} + +where :math:`\psi _{sat,om} =-10.3`\ mm (Letts et al. 2000) is the +saturated organic matter matric potential and the saturated mineral soil +matric potential :math:`\psi _{sat,\min ,i}` \ is + +.. math:: + :label: 7.96) + + \psi _{sat,\, \min ,\, i} =-10.0\times 10^{1.88-0.0131(\% sand)_{i} } . + +The saturated hydraulic conductivity, +:math:`k_{sat} \left[z_{h,\, i} \right]` (mm s\ :math:`{}^{-1}`), for +organic soils (:math:`k_{sat,\, om}` ) may be two to three orders of +magnitude larger than that of mineral soils (:math:`k_{sat,\, \min }` ). +Bulk soil layer values of :math:`k_{sat}` \ calculated as weighted +averages based on :math:`f_{om}` may therefore be determined primarily +by the organic soil properties even for values of :math:`f_{om}` as low +as 1 %. To better represent the influence of organic soil material on +the grid cell average saturated hydraulic conductivity, the soil organic +matter fraction is further subdivided into “connected” and “unconnected” +fractions using a result from percolation theory (Stauffer and Aharony +1994, Berkowitz and Balberg 1992). Assuming that the organic and mineral +fractions are randomly distributed throughout a soil layer, percolation +theory predicts that above a threshold value +:math:`f_{om} =f_{threshold}` , connected flow pathways consisting of +organic material only exist and span the soil space. Flow through these +pathways interacts only with organic material, and thus can be described +by :math:`k_{sat,\, om}` . This fraction of the grid cell is given by + +.. math:: + :label: 7.97) + + \begin{array}{l} {f_{perc} =\; N_{perc} \left(f_{om} {\rm \; }-f_{threshold} \right)^{\beta _{perc} } f_{om} {\rm \; }\qquad f_{om} \ge f_{threshold} } \\ {f_{perc} =0\qquad f_{om} 0} \\ {\left(r_{e,\, i} \right)_{j} =0\qquad \left(\beta _{t} \right)_{j} =0} \end{array} + +and :math:`\left(r_{i} \right)_{j}` is the fraction of roots in layer +:math:`i` (Chapter 8), :math:`\left(w_{i} \right)_{j}` is a soil +dryness or plant wilting factor for layer :math:`i` (Chapter 8), and +:math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total +soil column for the :math:`j^{th}` PFT (Chapter 8). + +The soil water fluxes in equation , which are a function of +:math:`\theta _{liq,\, i}` and :math:`\theta _{liq,\, i+1}` because of +their dependence on hydraulic conductivity and soil matric potential, +can be linearized about :math:`\theta` using a Taylor series expansion +as + +.. math:: + :label: 7.108) + + q_{i}^{n+1} =q_{i}^{n} +\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} +\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } \Delta \theta _{liq,\, i+1} + +.. math:: + :label: 7.109) + + q_{i-1}^{n+1} =q_{i-1}^{n} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } \Delta \theta _{liq,\, i-1} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} . + +Substitution of these expressions for :math:`q_{i}^{n+1}` and +:math:`q_{i-1}^{n+1}` into equation results in a general tridiagonal +equation set of the form + +.. math:: + :label: 7.110) + + r_{i} =a_{i} \Delta \theta _{liq,\, i-1} +b_{i} \Delta \theta _{liq,\, i} +c_{i} \Delta \theta _{liq,\, i+1} + +where + +.. math:: + :label: ZEqnNum557934 + + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } + +.. math:: + :label: 7.112) + + b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + +.. math:: + :label: 7.113) + + c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } + +.. math:: + :label: ZEqnNum981892 + + r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . + +The tridiagonal equation set is solved over +:math:`i=1,\ldots ,N_{levsoi} +1` where the layer +:math:`i=N_{levsoi} +1` is a virtual layer representing the aquifer. + +The finite-difference forms of the fluxes and partial derivatives in +equations - can be obtained from equation as + +.. math:: + :label: 7.115) + + q_{i-1}^{n} =-k\left[z_{h,\, i-1} \right]\left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] + +.. math:: + :label: 7.116) + + q_{i}^{n} =-k\left[z_{h,\, i} \right]\left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] + +.. math:: + :label: 7.117) + + \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } =-\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, i-1} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] + +.. math:: + :label: 7.118) + + \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } =\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] + +.. math:: + :label: 7.119) + + \frac{\partial q_{i} }{\partial \theta _{liq,\, i} } =-\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] + +.. math:: + :label: 7.120) + + \frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } =\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right]. + +The derivatives of the soil matric potential at the node depth are +derived from equation + +.. math:: + :label: 7.121) + + \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, \, i-1} } =-B_{i-1} \frac{\psi _{i-1} }{\theta _{\, \, i-1} } + +.. math:: + :label: 7.122) + + \frac{\partial \psi _{i} }{\partial \theta _{\, liq,\, i} } =-B_{i} \frac{\psi _{i} }{\theta _{i} } + +.. math:: + :label: 7.123) + + \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } =-B_{i+1} \frac{\psi _{i+1} }{\theta _{\, i+1} } + +with the constraint +:math:`0.01\, \theta _{sat,\, i} \le \theta _{\, i} \le \theta _{sat,\, i}` . + +The derivatives of the hydraulic conductivity at the layer interface are +derived from equation + +.. math:: + :label: 7.124) + + \begin{array}{l} {\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } =\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } =\left(1-\frac{f_{frz,\, i-1} +f_{frz,\, i} }{2} \right)\left(2B_{i-1} +3\right)k_{sat} \left[z_{h,\, i-1} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i-1} +\theta _{\, i} \right)}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right]^{2B_{i-1} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right)} \end{array} + +.. math:: + :label: 7.125) + + \begin{array}{l} {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } =\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } =\left(1-\frac{f_{frz,\, i} +f_{frz,\, i+1} }{2} \right)\left(2B_{i} +3\right)k_{sat} \left[z_{h,\, i} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right)} \end{array}. + +7.4.2.1 Equilibrium soil matric potential and volumetric moisture +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The equilibrium soil matric potential :math:`\psi _{E}` can be derived +from equation as + +.. math:: + :label: ZEqnNum899028 + + \psi _{E} =\psi _{sat} \left(\frac{\theta _{E} \left(z\right)}{\theta _{sat} } \right)^{-B} + +and the equilibrium volumetric water content +:math:`\theta _{E} \left(z\right)` at depth :math:`z` can also be +derived as + +.. math:: + :label: 7.127) + + \theta _{E} \left(z\right)=\theta _{sat} \left(\frac{\psi _{sat} +z_{\nabla } -z}{\psi _{sat} } \right)^{-\frac{1}{B} } . + +Here, the soil matric potentials, the water table depth +:math:`z_{\nabla }` and the soil depths have units of mm. For the +finite-difference scheme, a layer-average equilibrium volumetric water +content is used in equation and can be obtained from + +.. math:: + :label: 7.128) + + \overline{\theta _{E,\, i} }=\int _{z_{h,\, i-1} }^{z_{h,\, i} }\frac{\theta _{E} \left(z\right)}{z_{h,\, i} -z_{h,\, i-1} } \, dz + +which when integrated yields + +.. math:: + :label: ZEqnNum445442 + + \overline{\theta _{E,\, i} }=\frac{\theta _{sat,\, i} \psi _{sat,\, i} }{\left(z_{h,\, i} -z_{h,\, i-1} \right)\left(1-\frac{1}{B_{i} } \right)} \left[\left(\frac{\psi _{sat,\, i} -z_{\nabla } +z_{h,\, i} }{\psi _{sat,\, i} } \right)^{1-\frac{1}{B_{i} } } -\left(\frac{\psi _{sat,\, i} -z_{\nabla } +z_{h,\, i-1} }{\psi _{sat,\, i} } \right)^{1-\frac{1}{B_{i} } } \right]. + +Equation is valid when the water table :math:`z_{\nabla }` is deeper +than both interface depths :math:`z_{h,\, i-1}` and +:math:`z_{h,\, i}` . Since the water table can be within the soil +column, the equation is modified if the water table is within soil layer +:math:`i` (:math:`z_{h,\, i-1} z_{h,\, N_{levsoi} }` ), an equilibrium volumetric +soil moisture is calculated for a virtual layer :math:`i=N_{levsoi} +1` +as + +.. math:: + :label: ZEqnNum235293 + + \overline{\theta _{E,\, i=N_{levsoi+1} } }=\frac{\theta _{sat,i-1} \psi _{sat,\, i-1} }{\left(z_{\nabla } -z_{h,\, i-1} \right)\left(1-\frac{1}{B_{i-1} } \right)} \left[1-\left(\frac{\psi _{sat,\, i-1} -z_{\nabla } +z_{h,\, i-1} }{\psi _{sat,\, i-1} } \right)^{1-\frac{1}{B_{i-1} } } \right] + +The equilibrium volumetric soil moisture is constrained by + +.. math:: + :label: 7.133) + + 0\le \overline{\theta _{E,\, i} }\le \theta _{sat,\, i} + +The equilibrium soil matric potential is then + +.. math:: + :label: ZEqnNum533842 + + \psi _{E,\, i} =\psi _{sat,\, i} \left(\frac{\overline{\theta _{E,\, i} }}{\theta _{sat,\, i} } \right)^{-B_{i} } \ge -1\times 10^{8} \qquad \frac{\overline{\theta _{E,\, i} }}{\theta _{sat,\, i} } \ge 0.01 + +7.4.2.2 Equation set for layer :math:`i=1` +'''''''''''''''''''''''''''''''''''''''''' + +For the top soil layer (:math:`i=1`), the boundary condition is the +infiltration rate (section 7.3), +:math:`q_{i-1}^{n+1} =-q_{infl}^{n+1}` , and the water balance equation +is + +.. math:: + :label: 7.135) + + \frac{\Delta z_{i} \Delta \theta _{liq,\, i} }{\Delta t} =q_{infl}^{n+1} +q_{i}^{n+1} -e_{i} . + +After grouping like terms, the coefficients of the tridiagonal set of +equations for :math:`i=1` are + +.. math:: + :label: 7.136) + + a_{i} =0 + +.. math:: + :label: 7.137) + + b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + +.. math:: + :label: 7.138) + + c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } + +.. math:: + :label: 7.139) + + r_{i} =q_{infl}^{n+1} -q_{i}^{n} +e_{i} . + +7.4.2.3 Equation set for layers :math:`i=2,\ldots ,N_{levsoi} -1` +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The coefficients of the tridiagonal set of equations for +:math:`i=2,\ldots ,N_{levsoi} -1` are + +.. math:: + :label: 7.140) + + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } + +.. math:: + :label: 7.141) + + b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + +.. math:: + :label: 7.142) + + c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } + +.. math:: + :label: 7.143) + + r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . + +7.4.2.4 Equation set for layers :math:`i=N_{levsoi} ,\ldots N_{levsoi} +1` +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +For the lowest soil layer (:math:`i=N_{levsoi}` ), the bottom boundary +condition depends on the depth of the water table. If the water table is +within the soil column (:math:`z_{\nabla } \le z_{h,\, N_{levsoi} }` ), +a zero-flux bottom boundary condition is applied (:math:`q_{i}^{n} =0`) +and the coefficients of the tridiagonal set of equations for +:math:`i=N_{levsoi}` are + +.. math:: + :label: 7.144) + + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } + +.. math:: + :label: 7.145) + + b_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + +.. math:: + :label: 7.146) + + c_{i} =0 + +.. math:: + :label: 7.147) + + r_{i} =q_{i-1}^{n} +e_{i} . + +The coefficients for the aquifer layer :math:`i=N_{levsoi} +1` are then + +.. math:: + :label: 7.148) + + a_{i} =0 + +.. math:: + :label: 7.149) + + b_{i} =-\frac{\Delta z_{i} }{\Delta t} + +.. math:: + :label: 7.150) + + c_{i} =0 + +.. math:: + :label: 7.151) + + r_{i} =0. + +If the water table is below the soil column +(:math:`z_{\nabla } >z_{h,\, N_{levsoi} }` ), the coefficients for +:math:`i=N_{levsoi}` are + +.. math:: + :label: 7.152) + + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } + +.. math:: + :label: 7.153) + + b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + +.. math:: + :label: 7.154) + + c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } + +.. math:: + :label: 7.155) + + r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . + +The :math:`i=N_{levsoi} +1` terms are evaluated using + +.. math:: + :label: 7.156) + + \psi _{N_{levsoi} +1} =\psi _{sat,\, N_{levsoi} } \left[s_{N_{levsoi} +1} \right]^{-B_{N_{levsoi} } } \ge -1\times 10^{8} + +.. math:: + :label: 7.157) + + z_{N_{levsoi} +1} =0.5\left(z_{\nabla } +z_{N_{levsoi} } \right) + +where + +.. math:: + :label: 7.158) + + s_{N_{levsoi} +1} =0.5\left(\frac{\theta _{sat,\, N_{levsoi} } +\theta _{N_{levsoi} } }{\theta _{sat,\, N_{levsoi} } } \right)\qquad 0.01\le s_{N_{levsoi} +1} \le 1, + + :math:`\psi _{E,\, N_{levsoi} +1}` is evaluated from equations and , +and + +.. math:: + :label: 7.159) + + \frac{\partial \psi _{N_{levsoi} +1} }{\partial \theta _{liq,\, N_{levsoi} +1} } =-B_{N_{levsoi} } \frac{\psi _{N_{levsoi} +1} }{s_{\, N_{levsoi} } \theta _{sat,\, N_{levsoi} } } . + +The coefficients for the aquifer layer :math:`i=N_{levsoi} +1` are then + +.. math:: + :label: 7.160) + + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } + +.. math:: + :label: 7.161) + + b_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + +.. math:: + :label: 7.162) + + c_{i} =0 + +.. math:: + :label: 7.163) + + r_{i} =q_{i-1}^{n} . + +Upon solution of the tridiagonal equation set (Press et al. 1992), the +liquid water contents are updated as follows + +.. math:: + :label: 7.164) + + w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\Delta \theta _{liq,\, i} \Delta z_{i} \qquad i=1,\ldots ,N_{levsoi} . + +The volumetric water content is + +.. math:: + :label: 7.165) + + \theta _{i} =\frac{w_{liq,\, i} }{\Delta z_{i} \rho _{liq} } +\frac{w_{ice,\, i} }{\Delta z_{i} \rho _{ice} } . + +Frozen Soils and Perched Water Table +---------------------------------------- + +When soils freeze, the power-law form of the ice impedance factor +(section 7.4.1) can greatly decrease the hydraulic conductivity of the +soil, leading to nearly impermeable soil layers. When unfrozen soil +layers are present above relatively ice-rich frozen layers, the +possibility exists for perched saturated zones. Lateral drainage from +perched saturated regions is parameterized as a function of the +thickness of the saturated zone + +.. math:: + :label: 7.166) + + q_{drai,perch} =k_{drai,\, perch} \left(z_{frost} -z_{\nabla ,perch} \right) + +where :math:`k_{drai,\, perch}` depends on topographic slope and soil +hydraulic conductivity, + +.. math:: + :label: 7.167) + + k_{drai,\, perch} =10^{-5} \sin (\beta )\left(\frac{\sum _{i=N_{perch} }^{i=N_{frost} }\Theta _{ice,i} k_{sat} \left[z_{i} \right]\Delta z_{i} }{\sum _{i=N_{perch} }^{i=N_{frost} }\Delta z_{i} } \right) + +where :math:`\Theta _{ice}` is an ice impedance factor determined from +the ice content of the soil layers interacting with the water table +(section 7.6), :math:`\beta` is the mean grid cell topographic slope in +radians, :math:`z_{frost}` \ is the depth to the frost table, and +:math:`z_{\nabla ,perch}` is the depth to the perched saturated zone. +The frost table :math:`z_{frost}` is defined as the shallowest frozen +layer having an unfrozen layer above it, while the perched water table +:math:`z_{\nabla ,perch}` is defined as the depth at which the +volumetric water content drops below a specified threshold. The default +threshold is set to 0.9. Drainage from the perched saturated zone +:math:`q_{drai,perch}` is removed from layers :math:`N_{perch}` +through :math:`N_{frost}` , which are the layers containing +:math:`z_{\nabla ,perch}` and, :math:`z_{frost}` \ respectively. + +Groundwater-Soil Water Interactions +--------------------------------------- + +Drainage or sub-surface runoff is based on the SIMTOP scheme (Niu et al. +2005) with a modification to account for reduced drainage in frozen +soils. In the work of Niu et al. (2005), the drainage :math:`q_{drai}` +(kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) was formulated as + +.. math:: + :label: ZEqnNum924767 + + q_{drai} =q_{drai,\, \max } \exp \left(-f_{drai} z_{\nabla } \right). + +Here, the water table depth :math:`z_{\nabla }` has units of meters. To +restrict drainage in frozen soils, Niu et al. (2005) added the following +condition + +.. math:: + :label: 7.169) + + q_{drai} =0\qquad {\rm for\; \; }w_{ice,\, N_{levsoi} } >w_{liq,\, N_{levsoi} } . + +In preliminary testing it was found that a more gradual restriction of +drainage was required so that the water table depth remained dynamic +under partially frozen conditions. The following modification is made to +equation + +.. math:: + :label: ZEqnNum150955 + + q_{drai} =\Theta _{ice} q_{drai,\, \max } \exp \left(-f_{drai} z_{\nabla } \right) + +where :math:`\Theta _{ice}` is an ice impedance factor determined from +the ice content of the soil layers interacting with the water table + +.. math:: + :label: 7.171) + + \Theta _{ice} =10^{-\Omega \left(\frac{\sum _{i=jwt}^{i=N_{levsoi} }F_{ice,i} \Delta z_{i} }{\sum _{i=jwt}^{i=N_{levsoi} }\Delta z_{i} } \right)} + +where :math:`\Omega =6`\ is an adjustable parameter, :math:`jwt` is the +index of the layer directly above the water table, +:math:`F_{ice} =\frac{\theta _{ice} }{\theta _{sat} }` is the +ice-filled fraction of the pore space of soil layer :math:`i` (kg +m\ :math:`{}^{-2}`), and :math:`\Delta z_{i}` is the layer thickness +(mm). This expression is functionally the same as that used to determine +the ice impedance factor in section 7.4. In equation , the decay factor +:math:`f_{drai} =2.5` m\ :math:`{}^{-1}` and the maximum drainage when +the water table depth is at the surface +:math:`q_{drai,\, \max } =10\sin (\beta )` kg m\ :math:`{}^{-2}` +s\ :math:`{}^{-1}` , where :math:`\beta` is the mean grid cell +topographic slope in radians, were determined for global simulations +through sensitivity analysis and comparison with observed runoff. + +Determination of water table depth :math:`z_{\nabla }` is based on work +by Niu et al. (2007). In this approach, a groundwater component is added +in the form of an unconfined aquifer lying below the soil column (Figure +7.1). The groundwater solution is dependent on whether the water table +is within or below the soil column. The water stored in the unconfined +aquifer :math:`W_{a}` has a prescribed maximum value (5000 mm). When +the water table is within the soil column, :math:`W_{a}` is constant +because there is no water exchange between the soil column and the +underlying aquifer. In this case, recharge to the water table is +diagnosed by applying Darcy’s law across the water table + +.. math:: + :label: 7.172) + + q_{rech\arg e} =-k_{aq} \frac{\left(\Psi _{\nabla } -\Psi _{jwt} \right)}{\left(z_{\nabla } -z_{jwt} \right)} + +where :math:`\Psi _{\nabla } =0` is the matric potential at the water +table and\ :math:`k_{aq} =\Theta _{ice,jwt+1} k\left[z_{jwt+1} \right]` +is the hydraulic conductivity of the layer containing the water table. +Change in the water table is then calculated as the difference between +recharge and drainage, scaled by the specific yield of the layer +containing the water table + +.. math:: + :label: ZEqnNum287831 + + \Delta z_{\nabla } =\frac{\left(q_{rech\arg e} -q_{drai} \right)}{S_{y} } \Delta t. + +The specific yield, :math:`S_{y}` , which depends on the soil +properties and the water table location, is derived by taking the +difference between two equilibrium soil moisture profiles whose water +tables differ by an infinitesimal amount + +.. math:: + :label: 7.174) + + S_{y} =\theta _{sat} \left(1-\left(1+\frac{z_{\nabla } }{\Psi _{sat} } \right)^{\frac{-1}{B} } \right) + +where B is the Clapp-Hornberger exponent. Because :math:`S_{y}` is a +function of the soil properties, it results in water table dynamics that +are consistent with the soil water fluxes described in section 7.4. + +For the case when the water table is below the soil column, the change +in water stored in the unconfined aquifer :math:`W_{a}` (mm) is updated +as + +.. math:: + :label: 7.174) + + \Delta W_{a}^{} =\left(q_{recharge} -q_{drai} \right)\Delta t + +and the water table is updated using equation with the specific yield of +layer :math:`N_{levsoi}` . + +The recharge rate is defined as positive when water enters the aquifer + +.. math:: + :label: 7.174) + + q_{recharge} =\frac{\Delta \theta _{liq,\, N_{levsoi} +1} \Delta z_{N_{levsoi} +1} }{\Delta t} + +where +:math:`\Delta \theta _{liq,\, N_{levsoi} +1} =\theta _{liq,\, N_{levsoi} +1}^{n+1} -\theta _{liq,\, N_{levsoi} +1}^{n}` +is the change in liquid water content for layer :math:`i=N_{levsoi} +1` +calculated from the solution of the soil water equations (section 7.4), +and :math:`\Delta z_{N_{levsoi} +1}` (mm) is + +.. math:: + :label: 7.174) + + \Delta z_{N_{levsoi} +1} =z_{\nabla }^{n} -z_{h,\, N_{levsoi} } . + +After the above calculations, two numerical adjustments are implemented +to keep the liquid water content of each soil layer +(:math:`w_{liq,\, i}` ) within physical constraints of +:math:`w_{liq}^{\min } \le w_{liq,\, i} \le \left(\theta _{sat,\, i} -\theta _{ice,\, i} \right)\Delta z_{i}` +where :math:`w_{liq}^{\min } =0.01` (mm). First, beginning with the +bottom soil layer :math:`i=N_{levsoi}` , any excess liquid water in each +soil layer +(:math:`w_{liq,\, i}^{excess} =w_{liq,\, i} -\left(\theta _{sat,\, i} -\theta _{ice,\, i} \right)\Delta z_{i} \ge 0`) +is successively added to the layer above. Any excess liquid water that +remains after saturating the entire soil column (plus a maximum surface +ponding depth :math:`w_{liq}^{pond} =10` kg m\ :math:`{}^{-2}`), is +added to drainage :math:`q_{drai}` . Second, to prevent negative +:math:`w_{liq,\, i}` , each layer is successively brought up to +:math:`w_{liq,\, i} =w_{liq}^{\min }` by taking the required amount of +water from the layer below. If this results in +:math:`w_{liq,\, N_{levsoi} } T_{f} -2{\rm \; and\; }\theta _{liq,\, i} >0} \\ {0\qquad \qquad \qquad \qquad {\rm for\; }T_{i} \le T_{f} -2{\rm \; or\; }\theta _{liq,\, i} \le 0} \end{array}\right\} + +where :math:`\psi _{i}` is the soil water matric potential (mm) and +:math:`\psi _{c}` and :math:`\psi _{o}` are the soil water potential +(mm) when stomata are fully closed or fully open (respectively) (Table +8.1). The term in brackets scales :math:`w_{i}` by the ratio of the +effective porosity (accounting for the ice fraction; +:math:`\theta _{sat} -\theta _{ice}` ) relative to the total porosity. + +Here, the soil water matric potential :math:`\psi _{i}` \ is defined as + +.. math:: + :label: 8.28) + + \psi _{i} =\psi _{sat,i} \, s_{i}^{-B_{i} } \ge \psi _{c} + +where :math:`s_{i}` is the soil wetness for layer :math:`i` with +respect to the effective porosity and :math:`\psi _{sat,i}` and +:math:`B_{i}` are the saturated soil matric potential (mm) and the +Clapp and Hornberger (1978) parameter (section 7.4.1). The soil wetness +:math:`s_{i}` is + +.. math:: + :label: 8.29) + + s_{i} =\frac{\theta _{liq,\, i} }{\theta _{sat,\, i} -\theta _{ice,\, i} } \ge 0.01 + +where +:math:`\theta _{ice,\, i} ={w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(\rho _{ice} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{ice} \Delta z_{i} \right)} \le \theta _{sat,\, i}` \ and +:math:`\theta _{liq,\, i} ={w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(\rho _{liq} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{liq} \Delta z_{i} \right)} \le \theta _{sat,\, i} -\theta _{ice,\, i}` . +:math:`w_{ice,\, i}` and :math:`w_{liq,\, i}` are the ice and liquid +water contents (kg m\ :math:`{}^{-2}`) (Chapter 7), +:math:`\theta _{sat,\, i}` is the saturated volumetric water content +(section 7.4.1), :math:`\rho _{ice}` and :math:`\rho _{liq}` are the +densities of ice and liquid water (kg m\ :math:`{}^{-3}`) (Table 2.6), +and :math:`\Delta z_{i}` is the soil layer thickness (m) (section 6.1). + +The root fraction :math:`r_{i}` in each soil layer depends on the plant +functional type + +.. math:: + :label: 8.30) + + r_{i} =\left\{\begin{array}{l} {0.5\left[\begin{array}{l} {\exp \left(-r_{a} z_{h,\, i-1} \right)+\exp \left(-r_{b} z_{h,\, i-1} \right)-} \\ {\exp \left(-r_{a} z_{h,\, i} \right)-\exp \left(-r_{b} z_{h,\, i} \right)} \end{array}\right]\qquad {\rm for\; }1\le iT_{f} } \end{array}\right\}. + +The sensible heat flux (W m\ :math:`{}^{-2}`) is + +.. math:: + :label: ZEqnNum720553 + + H_{g} =-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{g} \right)}{r_{ah} } + +where :math:`\rho _{atm}` is the density of moist air (kg +m\ :math:`{}^{-3}`) (Chapter 5), :math:`C_{p}` is the specific heat +capacity of air (J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), +:math:`\theta _{atm}` is the atmospheric potential temperature (K) +(Chapter 5), :math:`T_{g}` is the lake surface temperature (K) (at an +infinitesimal interface just above the top resolved model layer: snow, +ice, or water), and :math:`r_{ah}` is the aerodynamic resistance to +sensible heat transfer (s m\ :math:`{}^{-1}`) (section 5.1). + +The water vapor flux (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is + +.. math:: + :label: 9.10) + + E_{g} =-\frac{\rho _{atm} \left(q_{atm} -q_{sat}^{T_{g} } \right)}{r_{aw} } + +where :math:`q_{atm}` is the atmospheric specific humidity (kg +kg\ :math:`{}^{-1}`) (section 2.2.1), :math:`q_{sat}^{T_{g} }` \ is the +saturated specific humidity (kg kg\ :math:`{}^{-1}`) (section 5.5) at +the lake surface temperature :math:`T_{g}` , and :math:`r_{aw}` is the +aerodynamic resistance to water vapor transfer (s m\ :math:`{}^{-1}`) +(section 5.1). + +The zonal and meridional momentum fluxes are + +.. math:: + :label: 9.11) + + \tau _{x} =-\rho _{atm} \frac{u_{atm} }{r_{atm} } + +.. math:: + :label: 9.12) + + \tau _{y} =-\rho _{atm} \frac{v_{atm} }{r_{atm} } + +where :math:`u_{atm}` and :math:`v_{atm}` are the zonal and +meridional atmospheric winds (m s\ :math:`{}^{-1}`) (section 2.2.1), and +:math:`r_{am}` is the aerodynamic resistance for momentum (s +m\ :math:`{}^{-1}`) (section 5.1). + +The heat flux into the lake surface :math:`G` (W m\ :math:`{}^{-2}`) is + +.. math:: + :label: ZEqnNum122376 + + G=\frac{2\lambda _{T} }{\Delta z_{T} } \left(T_{g} -T_{T} \right) + +where :math:`\lambda _{T}` is the thermal conductivity (W +m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`), :math:`\Delta z_{T}` is the +thickness (m), and :math:`T_{T}` is the temperature (K) of the top +resolved lake layer (snow, ice, or water). The top thermal conductivity +:math:`\lambda _{T}` of unfrozen lakes ( :math:`T_{g} >T_{f}` ) +includes conductivities due to molecular ( :math:`\lambda _{liq}` ) and +eddy (:math:`\lambda _{K}` ) diffusivities (section 9.5.4), as evaluated +in the top lake layer at the previous timestep, where +:math:`\lambda _{liq}` is the thermal conductivity of water (Table +2.6). For frozen lakes without resolved snow layers, +:math:`\lambda _{T} =\lambda _{ice}` . When resolved snow layers are +present, :math:`\lambda _{T}` \ is calculated based on the water +content, ice content, and thickness of the top snow layer, as for +non-vegetated surfaces. + +The absorbed solar radiation :math:`\vec{S}_{g}` is + +.. math:: + :label: 9.14) + + \vec{S}_{g} =\sum _{\Lambda }S_{atm} \, \downarrow _{\Lambda }^{\mu } \left(1-\alpha _{g,\, \Lambda }^{\mu } \right) +S_{atm} \, \downarrow _{\Lambda } \left(1-\alpha _{g,\, \Lambda } \right) + +where :math:`S_{atm} \, \downarrow _{\Lambda }^{\mu }` and +:math:`S_{atm} \, \downarrow _{\Lambda }` are the incident direct beam +and diffuse solar fluxes (W m\ :math:`{}^{-2}`) and :math:`\Lambda` +denotes the visible (:math:`<` 0.7\ :math:`\mu {\rm m}`) and +near-infrared (:math:`\ge` 0.7\ :math:`\mu {\rm m}`) wavebands (section +2.2.1), and :math:`\alpha _{g,\, \Lambda }^{\mu }` and +:math:`\alpha _{g,\, \mu }` are the direct beam and diffuse lake +albedos (section 9.3). + +The net emitted longwave radiation is + +.. math:: + :label: 9.15) + + \vec{L}_{g} =L_{g} \, \uparrow -L_{atm} \, \downarrow + +where :math:`L_{g} \, \uparrow` is the upward longwave radiation from +the surface, :math:`L_{atm} \, \downarrow` is the downward atmospheric +longwave radiation (section 2.2.1). The upward longwave radiation from +the surface is + +.. math:: + :label: 9.16) + + L\, \uparrow =\left(1-\varepsilon _{g} \right)L_{atm} \, \downarrow +\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{4} +4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} \left(T_{g}^{n+1} -T_{g}^{n} \right) + +where :math:`\varepsilon _{g} =0.97` is the lake surface emissivity, +:math:`\sigma` is the Stefan-Boltzmann constant (W m\ :math:`{}^{-2}` +K\ :math:`{}^{-4}`) (Table 2.6), and :math:`T_{g}^{n+1} -T_{g}^{n}` is +the difference in lake surface temperature between Newton-Raphson +iterations (see below). + +The sensible heat :math:`H_{g}` , the water vapor flux :math:`E_{g}` +through its dependence on the saturated specific humidity, the net +longwave radiation :math:`\vec{L}_{g}` , and the ground heat flux +:math:`G`, all depend on the lake surface temperature :math:`T_{g}` . +Newton-Raphson iteration is applied to solve for :math:`T_{g}` and the +surface fluxes as + +.. math:: + :label: ZEqnNum858039 + + \Delta T_{g} =\frac{\beta \overrightarrow{S}_{g} -\overrightarrow{L}_{g} -H_{g} -\lambda E_{g} -G}{\frac{\partial \overrightarrow{L}_{g} }{\partial T_{g} } +\frac{\partial H_{g} }{\partial T_{g} } +\frac{\partial \lambda E_{g} }{\partial T_{g} } +\frac{\partial G}{\partial T_{g} } } + +where :math:`\Delta T_{g} =T_{g}^{n+1} -T_{g}^{n}` and the subscript +“n” indicates the iteration. Therefore, the surface temperature +:math:`T_{g}^{n+1}` can be written as + +.. math:: + :label: ZEqnNum878786 + + T_{g}^{n+1} =\frac{\beta \overrightarrow{S}_{g} -\overrightarrow{L}_{g} -H_{g} -\lambda E_{g} -G+T_{g}^{n} \left(\frac{\partial \overrightarrow{L}_{g} }{\partial T_{g} } +\frac{\partial H_{g} }{\partial T_{g} } +\frac{\partial \lambda E_{g} }{\partial T_{g} } +\frac{\partial G}{\partial T_{g} } \right)}{\frac{\partial \overrightarrow{L}_{g} }{\partial T_{g} } +\frac{\partial H_{g} }{\partial T_{g} } +\frac{\partial \lambda E_{g} }{\partial T_{g} } +\frac{\partial G}{\partial T_{g} } } + +where the partial derivatives are + +.. math:: + :label: 9.19) + + \frac{\partial \overrightarrow{L}_{g} }{\partial T_{g} } =4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} , + +.. math:: + :label: 9.20) + + \frac{\partial H_{g} }{\partial T_{g} } =\frac{\rho _{atm} C_{p} }{r_{ah} } , + +.. math:: + :label: 9.21) + + \frac{\partial \lambda E_{g} }{\partial T_{g} } =\frac{\lambda \rho _{atm} }{r_{aw} } \frac{dq_{sat}^{T_{g} } }{dT_{g} } , + +.. math:: + :label: 9.22) + + \frac{\partial G}{\partial T_{g} } =\frac{2\lambda _{T} }{\Delta z_{T} } . + +The fluxes of momentum, sensible heat, and water vapor are solved for +simultaneously with lake surface temperature as follows. The +stability-related equations are the same as for non-vegetated surfaces +(section 5.2), except that the surface roughnesses are here (weakly +varying) functions of the friction velocity :math:`u_{\*}` . To begin, +*z* :math:`{}_{0}`\ :math:`{}_{m}` is set based on the value +calculated for the last timestep (for :math:`T_{g} >T_{f}` ) or based on +the values in section 9.4.2 (otherwise), and the scalar roughness +lengths are set based on the relationships in section 9.4.2. + +#. An initial guess for the wind speed :math:`V_{a}` including the + convective velocity :math:`U_{c}` is obtained from eq. assuming an + initial convective velocity :math:`U_{c} =0` m s\ :math:`{}^{-1}` for + stable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` + as evaluated from eq. ) and :math:`U_{c} =0.5` for unstable + conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). + +#. An initial guess for the Monin-Obukhov length :math:`L` is obtained + from the bulk Richardson number using equations and . + +#. The following system of equations is iterated four times: + +#. Heat of vaporization / sublimation :math:`\lambda` \ (eq. ) + +#. Thermal conductivity :math:`\lambda _{T}` \ (above) + +#. Friction velocity :math:`u_{\*}` (eqs. , , , ) + +#. Potential temperature scale :math:`\theta _{\*}` (eqs. , , , ) + +#. Humidity scale :math:`q_{\*}` (eqs. , , , ) + +#. Aerodynamic resistances :math:`r_{am}` , :math:`r_{ah}` , and + :math:`r_{aw}` (eqs. , , ) + +#. Lake surface temperature :math:`T_{g}^{n+1}` (eq.) + +#. Heat of vaporization / sublimation :math:`\lambda` (eq. ) + +#. Sensible heat flux :math:`H_{g}` is updated for :math:`T_{g}^{n+1}` + (eq.) + +#. Water vapor flux :math:`E_{g}` is updated for :math:`T_{g}^{n+1}` + as + + .. math:: + :label: ZEqnNum331835 + + E_{g} =-\frac{\rho _{atm} }{r_{aw} } \left[q_{atm} -q_{sat}^{T_{g} } -\frac{\partial q_{sat}^{T_{g} } }{\partial T_{g} } \left(T_{g}^{n+1} -T_{g}^{n} \right)\right] + +where the last term on the right side of equation is the change in +saturated specific humidity due to the change in :math:`T_{g}` between +iterations. + +#. Saturated specific humidity :math:`q_{sat}^{T_{g} }` and its + derivative :math:`\frac{dq_{sat}^{T_{g} } }{dT_{g} }` are updated + for :math:`T_{g}^{n+1}` (section 5.1). + +#. Virtual potential temperature scale :math:`\theta _{v\*}` (eq. ) + +#. Wind speed including the convective velocity, :math:`V_{a}` (eq. ) + +#. Monin-Obukhov length :math:`L` (eq. ). + +#. Roughness lengths (eq. , ). + +Once the four iterations for lake surface temperature have been yielded +a tentative solution :math:`T_{g} ^{{'} }` , several restrictions +are imposed in order to maintain consistency with the top lake model +layer temperature :math:`T_{T}` \ (Subin et al. 2012a). + +.. math:: + :label: ZEqnNum180534 + + \begin{array}{l} {{\rm 1)\; }T_{T} \le T_{f} T_{g} ^{{'} } >T_{m} \Rightarrow T_{g} =T_{T} ,} \\ {{\rm 3)\; }T_{m} >T_{g} ^{{'} } >T_{T} >T_{f} \Rightarrow T_{g} =T_{T} } \end{array} + +where :math:`T_{m}` \ is the temperature of maximum liquid water +density, 3.85\ :math:`{}^\circ`\ C (Hostetler and Bartlein 1990). The +first condition requires that, if there is any snow or ice present, the +surface temperature is restricted to be less than or equal to freezing. +The second and third conditions maintain convective stability in the top +lake layer. + +If eq. XXX is applied, the turbulent fluxes :math:`H_{g}` and +:math:`E_{g}` are re-evaluated. The emitted longwave radiation and +the momentum fluxes are re-evaluated in any case. The final ground heat +flux :math:`G` is calculated from the residual of the energy balance eq. +XXX in order to precisely conserve energy. XXX This ground heat flux +is taken as a prescribed flux boundary condition for the lake +temperature solution (section 9.5.3). An energy balance check is +included at each timestep to insure that eq. XXX is obeyed to within +0.1 W m\ :math:`{}^{-2}`. + +Lake Temperature +-------------------- + +Introduction +^^^^^^^^^^^^^^^^^^ + +The (optional-) snow, lake body (water and/or ice), soil, and bedrock +system is unified for the lake temperature solution. The governing +equation, similar to that for the snow-soil-bedrock system for vegetated +land units (Chapter 6), is + +.. math:: + :label: ZEqnNum239244 + + \tilde{c}_{v} \frac{\partial T}{\partial t} =\frac{\partial }{\partial z} \left(\tau \frac{\partial T}{\partial z} \right)-\frac{d\phi }{dz} + +where :math:`\tilde{c}_{v}` is the volumetric heat capacity (J +m\ :math:`{}^{-3}` K\ :math:`{}^{-1}`), :math:`t` is time (s), *T* is +the temperature (K), :math:`\tau` is the thermal conductivity (W +m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`), and :math:`\phi` is the solar +radiation (W m\ :math:`{}^{-2}`) penetrating to depth *z* (m). The +system is discretized into *N* layers, where + +.. math:: + :label: 9.26) + + N=n_{sno} +N_{levlak} +N_{levgrnd} , + + :math:`n_{sno}` is the number of actively modeled snow layers at the +current timestep (section 7.2), and :math:`N_{levgrnd}` \ is as for +vegetated land units (Chapter 6). Energy is conserved as + +.. math:: + :label: ZEqnNum317718 + + \frac{d}{dt} \sum _{j=1}^{N}\left[\tilde{c}_{v,j} (t)\left(T_{j} -T_{f} \right)+L_{j} (t)\right] \Delta z_{j} =G+\left(1-\beta \right)\vec{S}_{g} + +where :math:`\tilde{c}_{v,j} (t)`\ is the volumetric heat capacity of +the *j*\ th layer (section 9.5.5), :math:`L_{j} (t)`\ is the latent heat +of fusion per unit volume of the *j*\ th layer (proportional to the mass +of liquid water present), and the right-hand side represents the net +influx of energy to the lake system. Note that +:math:`\tilde{c}_{v,j} (t)` can only change due to phase change (except +for changing snow layer mass, which, apart from energy required to melt +snow, represents an untracked energy flux in the land model, along with +advected energy associated with water flows in general), and this is +restricted to occur at :math:`T_{j} =T_{f}` \ in the snow-lake-soil +system, allowing eq. to be precisely enforced and justifying the +exclusion of :math:`c_{v,j}` from the time derivative in eq. . + +Overview of Changes from CLM4 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Thermal conductivities include additional eddy diffusivity, beyond the +Hostetler and Bartlein (1990) formulation, due to unresolved processes +(Fang and Stefan 1996; Subin et al. 2012a). Lake water is now allowed to +freeze by an arbitrary fraction for each layer, which releases latent +heat and changes thermal properties. Convective mixing occurs for all +lakes, even if frozen. Soil and bedrock are included beneath the lake. +The full snow model is used if the snow thickness exceeds a threshold; +if there are resolved snow layers, radiation transfer is predicted by +the snow-optics submodel (Chapter 3), and the remaining radiation +penetrating the bottom snow layer is absorbed in the top layer of lake +ice; conversely, if there are no snow layers, the solar radiation +penetrating the bottom lake layer is absorbed in the top soil layer. The +lakes have variable depth, and all physics is assumed valid for +arbitrary depth, except for a depth-dependent enhanced mixing (section +9.5.4). Finally, a previous sign error in the calculation of eddy +diffusivity (specifically, the Brunt-Väisälä frequency term; eq. ) was +corrected. + +Boundary Conditions +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The top boundary condition, imposed at the top modeled layer +:math:`i=j_{top}` , where :math:`j_{top} =-n_{sno} +1`, is the +downwards surface flux *G* defined by the energy flux residual during +the surface temperature solution (section 9.4.3). The bottom boundary +condition, imposed at :math:`i=N_{levlak} +N_{levgrnd}` , is zero flux. +The 2-m windspeed :math:`u_{2}` \ (m s\ :math:`{}^{-1}`) is used in the +calculation of eddy diffusivity: + +.. math:: + :label: ZEqnNum997977 + + u_{2} =\frac{u_{*} }{k} \ln \left(\frac{2}{z_{0m} } \right)\ge 0.1. + +where :math:`u_{*}` \ is the friction velocity calculated in section +9.4.3 and *k* is the von Karman constant (Table 2.6). + +Eddy Diffusivity and Thermal Conductivities +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The total eddy diffusivity :math:`K_{W}` (:math:`\text{m}^{2}\,\text{s}^{-1}`) for liquid water in the lake body is given by (Subin et al. 2012a) + +.. math:: + :label: 9.29) + + K_{W} = m_{d} \left(\kappa _{e} +K_{ed} +\kappa _{m} \right) + +where :math:`\kappa _{e}` is due to wind-driven eddies (Hostetler and +Bartlein 1990), :math:`K_{ed}` is a modest enhanced diffusivity +intended to represent unresolved mixing processes (Fang and Stefan +1996), +:math:`\kappa _{m} =\frac{\lambda _{liq} }{c_{liq} \rho _{liq} }` \ is +the molecular diffusivity of water (given by the ratio of its thermal +conductivity (W m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) to the product of +its heat capacity (J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) and density +(kg m\ :math:`{}^{-3}`), values given in Table 2.6), and :math:`m_{d}` +(unitless) is a factor which increases the overall diffusivity for large +lakes, intended to represent 3-dimensional mixing processes such as +caused by horizontal temperature gradients. As currently implemented, + +.. math:: + :label: 9.30) + + m_{d} =\left\{\begin{array}{l} {1,\qquad d<25{\rm m}} \\ {10,\qquad d\ge 25{\rm m}} \end{array}\right\} + +where *d* is the lake depth. + +The wind-driven eddy diffusion coefficient :math:`\kappa _{e,\, i}` +( :math:`\text{m}^{2}\,\text{s}^{-1}` ) for layers :math:`1\le i\le N_{levlak}` is + +.. math:: + :label: 9.31) + + \kappa _{e,\, i} =\left\{\begin{array}{l} {\frac{kw^{*} z_{i} }{P_{0} \left(1+37Ri^{2} \right)} \exp \left(-k^{*} z_{i} \right)\qquad T_{g} >T_{f} } \\ {0\qquad T_{g} \le T_{f} } \end{array}\right\} + +where :math:`P_{0} =1` is the neutral value of the turbulent Prandtl +number, :math:`z_{i}` is the node depth (m), the surface friction +velocity (m s\ :math:`{}^{-1}`) is :math:`w^{*} =0.0012u_{2}` , and +:math:`k^{*}` varies with latitude :math:`\phi` as +:math:`k^{*} =6.6u_{2}^{-1.84} \sqrt{\left|\sin \phi \right|}` . For the +bottom layer, +:math:`\kappa _{e,\, N_{levlak} } =\kappa _{e,N_{levlak} -1\, }` . As in +Hostetler and Bartlein (1990), the 2-m wind speed :math:`u_{2}` (m +s\ :math:`{}^{-1}`) (eq. ) is used to evaluate :math:`w^{*}` and +:math:`k^{*}` rather than the 10-m wind used by Henderson-Sellers +(1985). + +The CityplaceRichardson number is + +.. math:: + :label: 9.32) + + R_{i} =\frac{-1+\sqrt{1+\frac{40N^{2} k^{2} z_{i}^{2} }{w^{*^{2} } \exp \left(-2k^{*} z_{i} \right)} } }{20} + +where + +.. math:: + :label: ZEqnNum230908 + + N^{2} =\frac{g}{\rho _{i} } \frac{\partial \rho }{\partial z} + +and :math:`g` is the acceleration due to gravity (m s\ :math:`{}^{-2}`) +(Table 2.6), :math:`\rho _{i}` is the density of water (kg +m\ :math:`{}^{-3}`), and :math:`\frac{\partial \rho }{\partial z}` is +approximated as +:math:`\frac{\rho _{i+1} -\rho _{i} }{z_{i+1} -z_{i} }` . Note that +because here, *z* is increasing downwards (unlike in Hostetler and +Bartlein (1990)), eq. contains no negative sign; this is a correction +from CLM4. The density of water is (Hostetler and Bartlein 1990) + +.. math:: + :label: 9.34) + + \rho _{i} =1000\left(1-1.9549\times 10^{-5} \left|T_{i} -277\right|^{1.68} \right). + +The enhanced diffusivity :math:`K_{ed}` is given by (Fang and Stefan +1996) + +.. math:: + :label: ZEqnNum809542 + + K_{ed} =1.04\times 10^{-8} \left(N^{2} \right)^{-0.43} ,N^{2} \ge 7.5\times 10^{-5} {\rm s}^{2} + +where :math:`N^{2}` \ is calculated as in eq. except for the minimum +value imposed in . + +The thermal conductivity for the liquid water portion of lake body layer +*i*, :math:`\tau _{liq,i}` (W m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) is +given by + +.. math:: + :label: 9.36) + + \tau _{liq,i} =K_{W} c_{liq} \rho _{liq} . + +The thermal conductivity of the ice portion of lake body layer *i*, +:math:`\tau _{ice,eff}` \ (W m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`), is +constant among layers, and is given by + +.. math:: + :label: 9.37) + + \tau _{ice,eff} =\tau _{ice} \frac{\rho _{ice} }{\rho _{liq} } + +where :math:`\tau _{ice}` \ (Table 2.6) is the nominal thermal +conductivity of ice: :math:`\tau _{ice,eff}` \ is adjusted for the fact +that the nominal model layer thicknesses remain constant even while the +physical ice thickness exceeds the water thickness. + +The overall thermal conductivity :math:`\tau _{i}` for layer *i* with +ice mass-fraction :math:`I_{i}` is the harmonic mean of the liquid +and water fractions, assuming that they will be physically vertically +stacked, and is given by + +.. math:: + :label: 9.38) + + \tau _{i} =\frac{\tau _{ice,eff} \tau _{liq,i} }{\tau _{liq,i} I_{i} +\tau _{ice} \left(1-I_{i} \right)} . + +The thermal conductivity of snow, soil, and bedrock layers above and +below the lake, respectively, are computed identically to those for +vegetated land units (Chapter 6), except for the adjustment of thermal +conductivity for frost heave or excess ice (Subin et al., 2012a, +Supporting Information). + +Radiation Penetration +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If there are no resolved snow layers, the surface absorption fraction :math:`\beta` is set according to the near-infrared fraction simulated +by the atmospheric model. This is apportioned to the surface energy +budget (section 9.4.2), and thus no additional radiation is absorbed in +the top :math:`z_{a}` (currently 0.6 m) of unfrozen lakes, for which +the light extinction coefficient :math:`\eta` ( :math:`\text{m}^{-1}` ) +varies between lake columns (eq. ). For frozen lakes +(:math:`T_{g} \le T_{f}` ), the remaining :math:`\left(1-\beta \right)\vec{S}_{g}` fraction of surface absorbed +radiation that is not apportioned to the surface energy budget is +absorbed in the top lake body layer. This is a simplification, as lake +ice is partially transparent. If there are resolved snow layers, then +the snow optics submodel (Chapter 3) is used to calculate the snow layer +absorption (except for the absorption predicted for the top layer by the +snow optics submodel, which is assigned to the surface energy budget), +with the remainder penetrating snow layers absorbed in the top lake body +ice layer. + +For unfrozen lakes, the solar radiation remaining at depth +:math:`z>z_{a}` in the lake body is given by + +.. math:: + :label: 9.39) + + \phi =\left(1-\beta \vec{S}_{g} \right)\exp \left\{-\eta \left(z-z_{a} \right)\right\} . + +For all lake body layers, the flux absorbed by the layer *i*, +:math:`\phi _{i}` , is + +.. math:: + :label: 9.40) + + \phi _{i} =\left(1-\beta \vec{S}_{g} \right)\left[\exp \left\{-\eta \left(z_{i} -\frac{\Delta z_{i} }{2} -z_{a} \right)\right\}-\exp \left\{-\eta \left(z_{i} +\frac{\Delta z_{i} }{2} -z_{a} \right)\right\}\right] . + +The argument of each exponent is constrained to be non-negative (so +:math:`\phi _{i}` = 0 for layers contained within :math:`\text{z}_{a}`). +The remaining flux exiting the bottom of layer :math:`i=N_{levlak}` is +absorbed in the top soil layer. + +The light extinction coefficient :math:`\eta` ( :math:`\text{m}^{-1}` ), if +not provided as external data, is a function of depth *d* (m) (Subin et +al. 2012a): + +.. math:: + :label: ZEqnNum284649 + + \eta =1.1925d^{-0.424} . + +Heat Capacities +^^^^^^^^^^^^^^^^^^^^^ + +The vertically-integrated heat capacity for each lake layer, +:math:`\text{c}_{v,i}\,\text{J\,m}^{-2}`) is +determined by the mass-weighted average over the heat capacities for the +water and ice fractions: + +.. math:: + :label: 9.42) + + c_{v,i} =\Delta z_{i} \rho _{liq} \left[c_{liq} \left(1-I_{i} \right)+c_{ice} I_{i} \right] . + +Note that the density of water is used for both ice and water fractions, +as the thickness of the layer is fixed. + +The total heat capacity :math:`c_{v,i}` for each soil, snow, and +bedrock layer (J m\ :math:`{}^{-2}`) is determined as for vegetated land +units (Chapter 6), as the sum of the heat capacities for the water, ice, +and mineral constituents. + +Crank-Nicholson Solution +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The solution method for thermal diffusion is similar to that used for +soil (Chapter 6), except that the lake body layers are sandwiched +between the snow and soil layers (section 9.5.1), and radiation flux is +absorbed throughout the lake layers. Before solution, layer temperatures +:math:`T_{i}` (K), thermal conductivities :math:`\tau _{i}` (W +m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`), heat capacities :math:`c_{v,i}` +(J m\ :math:`{}^{-2}`), and layer and interface depths from all +components are transformed into a uniform set of vectors with length +:math:`N=n_{sno} +N_{levlak} +N_{levgrnd}` and consistent units to +simplify the solution. Thermal conductivities at layer interfaces are +calculated as the harmonic mean of the conductivities of the neighboring +layers: + +.. math:: + :label: 9.43) + + \lambda _{i} =\frac{\tau _{i} \tau _{i+1} \left(z_{i+1} -z_{i} \right)}{\tau _{i} \left(z_{i+1} -\hat{z}_{i} \right)+\tau _{i+1} \left(\hat{z}_{i} -z_{i} \right)} , + +where :math:`\lambda _{i}` is the conductivity at the interface between +layer *i* and layer *i +* 1, :math:`z_{i}` is the depth of the node of +layer *i*, and :math:`\hat{z}_{i}` is the depth of the interface below +layer *i*. Care is taken at the boundaries between snow and lake and +between lake and soil. The governing equation is discretized for each +layer as + +.. math:: + :label: ZEqnNum991615 + + \frac{c_{v,i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=F_{i-1} -F_{i} +\phi _{i} + +where superscripts *n* + 1 and *n* denote values at the end and +beginning of the timestep :math:`\Delta t`, respectively, :math:`F_{i}` +(W m\ :math:`{}^{-2}`) is the downward heat flux at the bottom of layer +*i*, and :math:`\phi _{i}` is the solar radiation absorbed in layer +*i*. + +Eq. is solved using the semi-implicit Crank-Nicholson Method, resulting +in a tridiagonal system of equations: + +.. math:: + :label: 9.45) + + \begin{array}{l} {r_{i} =a_{i} T_{i-1}^{n+1} +b_{i} T_{i}^{n+1} +cT_{i+1}^{n+1} ,} \\ {a_{i} =-0.5\frac{\Delta t}{c_{v,i} } \frac{\partial F_{i-1} }{\partial T_{i-1}^{n} } ,} \\ {b_{i} =1+0.5\frac{\Delta t}{c_{v,i} } \left(\frac{\partial F_{i-1} }{\partial T_{i-1}^{n} } +\frac{\partial F_{i} }{\partial T_{i}^{n} } \right),} \\ {c_{i} =-0.5\frac{\Delta t}{c_{v,i} } \frac{\partial F_{i} }{\partial T_{i}^{n} } ,} \\ {r_{i} =T_{i}^{n} +0.5\frac{\Delta t}{c_{v,i} } \left(F_{i-1} -F_{i} \right)+\frac{\Delta t}{c_{v,i} } \phi _{i} .} \end{array} + +The fluxes :math:`F_{i}` are defined as follows: for the top layer, +:math:`F_{j_{top} -1} =2G;a_{j_{top} } =0`, where *G* is defined as in +section 9.4.3 (the factor of 2 merely cancels out the Crank-Nicholson +0.5 in the equation for :math:`r_{j_{top} }` ). For the bottom layer, +:math:`F_{N_{levlak} +N_{levgrnd} } =0`. For all other layers: + +.. math:: + :label: 9.46) + + F_{i} =\lambda _{i} \frac{T_{i} ^{n} -T_{i+1}^{n} }{z_{n+1} -z_{n} } . + +Phase Change +^^^^^^^^^^^^^^^^^^ + +Phase change in the lake, snow, and soil is done similarly to that done +for the soil and snow for vegetated land units (Chapter 6), except +without the allowance for freezing point depression in soil underlying +lakes. After the heat diffusion is calculated, phase change occurs in a +given layer if the temperature is below freezing and liquid water +remains, or if the temperature is above freezing and ice remains. + +If melting occurs, the available energy for melting, :math:`Q_{avail}` +(J m\ :math:`{}^{-2}`), is computed as + +.. math:: + :label: ZEqnNum598199 + + Q_{avail} =\left(T_{i} -T_{f} \right)c_{v,i} + +where :math:`T_{i}` is the temperature of the layer after thermal +diffusion (section 9.5.7), and :math:`c_{v,i}` \ is as calculated in +section 9.5.6. The mass of melt in the layer *M* (kg m\ :math:`{}^{-2}`) +is given by + +.. math:: + :label: 9.48) + + M=\min \left\{M_{ice} ,\frac{Q_{avail} }{H_{fus} } \right\} + +where :math:`H_{fus}` (J kg\ :math:`{}^{-1}`) is the latent heat of +fusion of water (Table 2.6), and :math:`M_{ice}` is the mass of ice in +the layer: :math:`I_{i} \rho _{liq} \Delta z_{i}` for a lake body +layer, or simply the soil / snow ice content state variable +(:math:`w_{ice}` ) for a soil / snow layer. The heat remainder, +:math:`Q_{rem}` \ is given by + +.. math:: + :label: ZEqnNum889387 + + Q_{rem} =Q_{avail} -MH_{fus} . + +Finally, the mass of ice in the layer :math:`M_{ice}` is adjusted +downwards by :math:`M`, and the temperature :math:`T_{i}` of the +layer is adjusted to + +.. math:: + :label: ZEqnNum926437 + + T_{i} =T_{f} +\frac{Q_{rem} }{c'_{v,i} } + +where :math:`c'_{v,i} =c_{v,i} +M\left(c_{liq} -c_{ice} \right)`. + +If freezing occurs, :math:`Q_{avail}` is again given by but will be +negative. The melt :math:`M`, also negative, is given by + +.. math:: + :label: 9.51) + + M=\max \left\{-M_{liq} ,\frac{Q_{avail} }{H_{fus} } \right\} + +where :math:`M_{liq}` is the mass of water in the layer: +:math:`\left(1-I_{i} \right)\rho _{liq} \Delta z_{i}` for a lake body +layer, or the soil / snow water content state variable +(:math:`w_{liq}` ). The heat remainder :math:`Q_{rem}` is given by eq. +and will be negative or zero. Finally, :math:`M_{liq}` is adjusted +downwards by :math:`-M` and the temperature is reset according to eq. . + +In the presence of nonzero snow water :math:`W_{sno}` without resolved +snow layers over + +an unfrozen top lake layer, the available energy in the top lake layer +:math:`\left(T_{1} -T_{f} \right)c_{v,1}` is used to melt the snow. +Similar to above, :math:`W_{sno}` is either completely melted and the +remainder of heat returned to the top lake layer, or the available heat +is exhausted and the top lake layer is set to freezing. The snow +thickness is adjusted downwards in proportion to the amount of melt, +maintaining constant density. + +Convection +^^^^^^^^^^^^^^^^ + +Convective mixing is based on Hostetler et al.’s (1993, 1994) coupled +lake-atmosphere model, adjusting the lake temperature after diffusion +and phase change to maintain a stable density profile. Unfrozen lakes +overturn when :math:`\rho _{i} >\rho _{i+1}` , in which case the layer +thickness weighted average temperature for layers 1 to :math:`i+1` is +applied to layers 1 to :math:`i+1` and the densities are updated. This +scheme is applied iteratively to layers :math:`1\le i 0`, then :math:`T_{froz} =T_{f}` , and :math:`T_{unfr}` +is given by + +.. math:: + :label: 9.54) + + T_{unfr} =\frac{Q}{\rho _{liq} Z_{i+1} \left[\left(1-I_{av} \right)c_{liq} \right]} +T_{f} . + +If :math:`Q < 0`, then :math:`T_{unfr} =T_{f}` , and :math:`T_{froz}` +is given by + +.. math:: + :label: 9.55) + + T_{froz} =\frac{Q}{\rho _{liq} Z_{i+1} \left[I_{av} c_{ice} \right]} +T_{f} . + +The ice is lumped together at the top. For each lake layer *j* from 1 +to *i* + 1, the ice fraction and temperature are set as follows, where +:math:`Z_{j} =\sum _{m=1}^{j}\Delta z_{m}` : + +#. If :math:`Z_{j} \le Z_{i+1} I_{av}` , then :math:`I_{j} =1` and + :math:`T_{j} =T_{froz}` . + +#. Otherwise, if :math:`Z_{j-1} 1000{\rm m}`, +in which case additional precipitation and frost deposition is added to +:math:`q_{snwcp,\, ice}` . + +If there are resolved snow layers, the generalized “evaporation” +:math:`E_{g}` (i.e., evaporation, dew, frost, and sublimation) is +treated as over other land units, except that the allowed evaporation +from the ground is unlimited (though the top snow layer cannot lose more +water mass than it contains). If there are no resolved snow layers but +:math:`W_{sno} >0` and :math:`E_{g} >0`, sublimation +:math:`q_{sub,sno}` \ (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) will be +given by + +.. math:: + :label: 9.60) + + q_{sub,sno} =\min \left\{E_{g} ,\frac{W_{sno} }{\Delta t} \right\} . + +If :math:`E_{g} <0,T_{g} \le T_{f}` , and there are no resolved snow +layers or the top snow layer is not unfrozen, then the rate of frost +production :math:`q_{frost} =\left|E_{g} \right|`. If :math:`E_{g} <0` +but the top snow layer has completely thawed during the Phase Change +step of the Lake Temperature solution (section 9.5.8), then frost (or +dew) is not allowed to accumulate (:math:`q_{frost} =0`), to insure that +the layer is eliminated by the Snow Hydrology (section 7.2) code. (If +:math:`T_{g} >T_{f}` , then no snow is present (section 9.4.3), and +evaporation or dew deposition is balanced by :math:`q_{rgwl}` .) The +snowpack is updated for frost and sublimation: + +.. math:: + :label: 9.61) + + W_{sno} =W_{sno} +\Delta t\left(q_{frost} -q_{sub,sno} \right) . + +If there are resolved snow layers, then this update occurs using the +Snow Hydrology submodel (section 7.2). Otherwise, the snow ice mass is +updated directly, and :math:`z_{sno}` is adjusted by the same +proportion as the snow ice (i.e., maintaining the same density), unless +there was no snow before adding the frost, in which case the density is +assumed to be 250 kg m\ :math:`{}^{-3}`. + +Soil Hydrology +^^^^^^^^^^^^^^^^^^^^ + +The combined water and ice soil volume fraction in a soil layer +:math:`\theta _{i}` is given by + +.. math:: + :label: 9.62) + + \theta _{i} =\frac{1}{\Delta z_{i} } \left(\frac{w_{ice,i} }{\rho _{ice} } +\frac{w_{liq,i} }{\rho _{liq} } \right) . + +If :math:`\theta _{i} <\theta _{sat,i}` , the pore volume fraction at +saturation (as may occur when ice melts), then the liquid water mass is +adjusted to + +.. math:: + :label: 9.63) + + w_{liq,i} =\left(\theta _{sat,i} \Delta z_{i} -\frac{w_{ice,i} }{\rho _{ice} } \right)\rho _{liq} . + +Otherwise, if excess ice is melting and +:math:`w_{liq,i} >\theta _{sat,i} \rho _{liq} \Delta z_{i}` , then the +water in the layer is reset to + +.. math:: + :label: 9.64) + + w_{liq,i} = \theta _{sat,i} \rho _{liq} \Delta z_{i} + +This allows excess ice to be initialized (and begin to be lost only +after the pore ice is melted, which is realistic if the excess ice is +found in heterogeneous chunks) but irreversibly lost when melt occurs. + +Modifications to Snow Layer Logic +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A thickness difference :math:`z_{lsa} =s_{\min } -\tilde{s}_{\min }` +adjusts the minimum resolved snow layer thickness for lake columns as +compared to non-lake columns. The value of :math:`z_{lsa}` is chosen to +satisfy the CFL condition for the model timestep. By default, +:math:`\tilde{s}_{\min }` \ = 1 cm and :math:`s_{\min }` \ = 4 cm. See +Subin et al. (2012a; including Supporting Information) for further +discussion. + +The rules for combining and sub-dividing snow layers (section 7.2.7) are +adjusted for lakes to maintain minimum thicknesses of :math:`s_{\min }` +and to increase all target layer thicknesses by :math:`z_{lsa}` . The +rules for combining layers are modified by simply increasing layer +thickness thresholds by :math:`z_{lsa}` . The rules for dividing snow +layers are contained in a separate subroutine that is modified for +lakes, and is a function of the number of layers and the layer +thicknesses. There are two types of operations: (a) subdividing layers +in half, and (b) shifting some volume from higher layers to lower layers +(without increasing the layer number). For subdivisions of type (a), the +thickness thresholds triggering subdivision are increased by +:math:`2z_{lsa}` for lakes. For shifts of type (b), the thickness +thresholds triggering the shifts are increased by :math:`z_{lsa}` . At +the end of the modified subroutine, a snow ice and liquid balance check +are performed. + +In rare instances, resolved snow layers may be present over an unfrozen +top lake body layer. In this case, the snow layers may be eliminated if +enough heat is present in the top layer to melt the snow: see Subin et +al. (2012a, Supporting Information). From 13fbf29398b215ebbaab54b3e87ce7f3f9bcf6ab Mon Sep 17 00:00:00 2001 From: mvertens Date: Mon, 27 Mar 2017 11:30:21 -0600 Subject: [PATCH 0003/1973] first pass at complete tech note --- doc/source/conf.py | 2 +- doc/source/index.rst | 1 + .../CLM45_Tech_Note_Chpt_1_Introduction.rst | 432 ++++++------------ .../CLM45_Tech_Note_Chpt_11_RTM.rst | 20 +- .../CLM45_Tech_Note_Chpt_12_Urban.rst | 6 +- ...Note_Chpt_13_CN_Allocation_Respiration.rst | 40 +- ...Tech_Note_Chpt_14_Vegetation_Phenology.rst | 350 +++++++------- .../CLM45_Tech_Note_Chpt_15_Decomposition.rst | 353 +++++++------- ...h_Note_Chpt_16_External_Nitrogen_Cycle.rst | 183 ++++---- ...LM45_Tech_Note_Chpt_17_Plant_Mortality.rst | 186 ++++---- .../CLM45_Tech_Note_Chpt_18_Fire.rst | 287 ++++++------ .../CLM45_Tech_Note_Chpt_19_Methane.rst | 323 ++++++------- .../CLM45_Tech_Note_Chpt_2_Ecosystem.rst | 277 ++++++----- ...LM45_Tech_Note_Chpt_20_Crop_Irrigation.rst | 294 ++++++------ ..._Tech_Note_Chpt_21_Transient_Landcover.rst | 25 +- .../CLM45_Tech_Note_Chpt_22_DGVM.rst | 12 +- .../CLM45_Tech_Note_Chpt_23_BVOCs.rst | 19 +- .../CLM45_Tech_Note_Chpt_24_Dust.rst | 83 ++-- .../CLM45_Tech_Note_Chpt_25_Isotopes.rst | 163 +++---- .../CLM45_Tech_Note_Chpt_26_Offline.rst | 54 ++- .../CLM45_Tech_Note_Chpt_27_References.rst | 14 +- ...CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst | 61 +-- ...LM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst | 14 +- .../CLM45_Tech_Note_Chpt_5_Fluxes.rst | 168 +++---- ...ech_Note_Chpt_6_Soil_Snow_Temperatures.rst | 102 ++--- .../CLM45_Tech_Note_Chpt_7_Hydrology.rst | 146 +++--- .../CLM45_Tech_Note_Chpt_8_Photosynthesis.rst | 202 ++++---- .../CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst | 149 +++--- doc/source/tech_note/index.rst | 43 ++ .../overview/scientific_validation.rst | 2 +- 30 files changed, 1836 insertions(+), 2175 deletions(-) create mode 100644 doc/source/tech_note/index.rst diff --git a/doc/source/conf.py b/doc/source/conf.py index bdf2be569c..dc9a7b7ea8 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -34,7 +34,7 @@ 'sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', - 'sphinx.ext.mathjax', + 'sphinx.ext.imgmath', 'sphinx.ext.githubpages'] # Add any paths that contain templates here, relative to this directory. diff --git a/doc/source/index.rst b/doc/source/index.rst index a5ec1eb158..cc7ec3c27c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -17,6 +17,7 @@ Table of contents :maxdepth: 1 users_guide/index.rst + tech_note/index.rst Indices and tables ================== diff --git a/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst b/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst index 1bcd54fca7..bb9b012bdc 100644 --- a/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst +++ b/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst @@ -1,17 +1,9 @@ -.. math:: 188 - **NCAR/TN-503+STR** **NCAR Technical Note** -**\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_** - -**** - **July 2013** -**** - **Technical Description of version 4.5 of the Community Land Model (CLM)** @@ -19,16 +11,12 @@ **Keith W. Oleson, David M. Lawrence** -**** - ***Lead Authors*** **Gordon B. Bonan, Beth Drewniak, Maoyi Huang, Charles D. Koven, Samuel Levis, Fang Li, William J. Riley, Zachary M. Subin, Sean C. Swenson, Peter E. Thornton** -**** - ***Contributing Authors*** **Anil Bozbiyik, Rosie Fisher, Colette L. Heald, Erik Kluzek, @@ -36,16 +24,9 @@ Jean-Francois Lamarque, Peter J. Lawrence, L. Ruby Leung, William Lipscomb, Stefan Muszala, Daniel M. Ricciuto, William Sacks, Ying Sun, Jinyun Tang, Zong-Liang Yang** -**** - -**** - -**** - **NCAR Earth System Laboratory** -**Climate and Global Dynamics -Division\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_** +**Climate and Global Dynamics Division** **NATIONAL CENTER FOR ATMOSPHERIC RESEARCH** @@ -57,13 +38,9 @@ Division\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ **ISSN Electronic Edition 2153-2400** -**** - **NCAR TECHNICAL NOTES** -http://library.ucar.edu/research/publish-technote\ **** - -**** +http://library.ucar.edu/research/publish-technote The Technical Notes series provides an outlet for a variety of NCAR Manuscripts that contribute in specialized ways to the body of @@ -75,35 +52,23 @@ include: **EDD – Engineering, Design, or Development Reports** -Equipment descriptions, test results, instrumentation, - -and operating and maintenance manuals. +Equipment descriptions, test results, instrumentation, and operating and maintenance manuals. **IA – Instructional Aids** -** Instruction manuals, bibliographies, film supplements, - -and other research or instructional aids. +Instruction manuals, bibliographies, film supplements, and other research or instructional aids. **PPR – Program Progress Reports** -** Field program reports, interim and working reports, - -survey reports, and plans for experiments. +Field program reports, interim and working reports, survey reports, and plans for experiments. **PROC – Proceedings** -** Documentation or symposia, colloquia, conferences, - -workshops, and lectures. (Distribution maybe limited to - -attendees). +Documentation or symposia, colloquia, conferences, workshops, and lectures. (Distribution maybe limited to attendees). **STR – Scientific and Technical Reports** -Data compilations, theoretical and numerical - -investigations, and experimental results. +Data compilations, theoretical and numerical investigations, and experimental results. The National Center for Atmospheric Research (NCAR) is operated by the nonprofit University Corporation for Atmospheric Research (UCAR) under @@ -113,61 +78,35 @@ are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. National Center for Atmospheric Research - -P. O. Box 3000 - -Boulder, Colorado 80307-300 - -**** - -ii +P. O. Box 3000, Boulder, Colorado 80307-300 **NCAR/TN-503+STR** **NCAR Technical Note** -**\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_** - -**** - **July 2013** -**** +**Technical Description of version 4.5 of the Community Land Model (CLM)** -**Technical Description of version 4.5 of the Community Land Model -(CLM)** - -***Coordinating Lead Authors*** +**Coordinating Lead Authors** **Keith W. Oleson, David M. Lawrence** -**** - -***Lead Authors*** +**Lead Authors** **Gordon B. Bonan, Beth Drewniak, Maoyi Huang, Charles D. Koven, Samuel -Levis, Fang Li, William J. Riley, Zachary M. Subin, Sean C. Swenson, -Peter E. Thornton** - -**** +Levis, Fang Li, William J. Riley, Zachary M. Subin, Sean C. Swenson, Peter E. Thornton** -***Contributing Authors*** +**Contributing Authors** **Anil Bozbiyik, Rosie Fisher, Colette L. Heald, Erik Kluzek, Jean-Francois Lamarque, Peter J. Lawrence, L. Ruby Leung, William Lipscomb, Stefan Muszala, Daniel M. Ricciuto, William Sacks, Ying Sun, Jinyun Tang, Zong-Liang Yang** -**** - -**** - -**** - **NCAR Earth System Laboratory** -**Climate and Global Dynamics -Division\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_** +**Climate and Global Dynamics Division** **NATIONAL CENTER FOR ATMOSPHERIC RESEARCH** @@ -179,219 +118,127 @@ Division\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ **ISSN Electronic Edition 2153-2400** -xi - -**TABLE OF CONTENTS** - -**** - -**1. Introduction 11.1 Model History 11.1.1 Inception of CLM 11.1.2 CLM2 -31.1.3 CLM3 51.1.4 CLM3.5 61.1.5 CLM4 71.1.6 CLM4.5 81.2 Biogeophysical -and Biogeochemical Processes 112. Surface Characterization and Model -Input Requirements 142.1 Surface Characterization 142.1.1 Surface -Heterogeneity and Data Structure 142.1.2 Vegetation Composition 172.1.3 -Vegetation Structure 192.1.4 Phenology and vegetation burial by snow -212.2 Model Input Requirements 212.2.1 Atmospheric Coupling 212.2.2 -Initialization 272.2.3 Surface Data 282.2.4 Adjustable Parameters and -Physical Constants 353. Surface Albedos 373.1 Canopy Radiative Transfer -373.2 Ground Albedos 463.2.1 Snow Albedo 483.2.2 Snowpack Optical -Properties 523.2.3 Snow Aging 563.3 Solar Zenith Angle 594. Radiative -Fluxes 634.1 Solar Fluxes 634.2 Longwave Fluxes 675. Momentum, Sensible -Heat, and Latent Heat Fluxes 715.1 Monin-Obukhov Similarity Theory 735.2 -Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces 825.3 -Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces -885.3.1 Theory 885.3.2 Numerical Implementation 1025.4 Update of Ground -Sensible and Latent Heat Fluxes 1075.5 Saturation Vapor Pressure 1106. -Soil and Snow Temperatures 1136.1 Numerical Solution 1146.2 Phase Change -1256.2.1 Soil and Snow Layers 1256.2.2 Surface Water 1296.3 Soil and -Snow Thermal Properties 1307. Hydrology 1347.1 Canopy Water 1357.2 Snow -1377.2.1 Snow Covered Area Fraction 1397.2.2 Ice Content 1407.2.3 Water -Content 1427.2.4 Black and organic carbon and mineral dust within snow -1437.2.5 Initialization of snow layer 1467.2.6 Snow Compaction 1467.2.7 -Snow Layer Combination and Subdivision 1497.2.7.1 Combination 1497.2.7.2 -Subdivision 1527.3 Surface Runoff, Surface Water Storage, and -Infiltration 1537.3.1 Surface Runoff 1537.3.2 Surface Water Storage -1557.3.3 Infiltration 1567.4 Soil Water 1587.4.1 Hydraulic Properties -1607.4.2 Numerical Solution 1637.4.2.1 Equilibrium soil matric potential -and volumetric moisture 1697.4.2.2 Equation set for layer i=1 1717.4.2.3 -Equation set for layers i=2,…,N\ :sub:`levsoi` -1 1717.4.2.4 Equation -set for layers i=N\ :sub:`levsoi` ,…N\ :sub:`levsoi` +1 1727.5 Frozen -Soils and Perched Water Table 1747.6 Groundwater-Soil Water Interactions -1757.7 Runoff from glaciers and snow-capped surfaces 1787.8 The Variable -Infiltration Capacity parameterizations as a hydrologic option 1798. -Stomatal Resistance and Photosynthesis 1838.1 Stomatal resistance 1838.2 -Photosynthesis 1868.3 Vcmax25 and canopy scaling 1918.4 Soil water -stress 1938.5 Numerical implementation 1979. Lake Model 2009.1 -Discretization 2019.2 External Data 2029.3 Surface Albedo 2029.4 Surface -Fluxes and Surface Temperature 2039.4.1 Overview of Changes from CLM4 -2039.4.2 Surface Properties 2039.4.3 Surface Flux Solution 2059.5 Lake -Temperature 2119.5.1 Introduction 2119.5.2 Overview of Changes from CLM4 -2129.5.3 Boundary Conditions 2139.5.4 Eddy Diffusivity and Thermal -Conductivities 2139.5.5 Radiation Penetration 2169.5.6 Heat Capacities -2179.5.7 Crank-Nicholson Solution 2179.5.8 Phase Change 2199.5.9 -Convection 2209.5.10 Energy Conservation 2239.6 Lake Hydrology 2239.6.1 -Overview 2239.6.2 Water Balance 2249.6.3 Precipitation, Evaporation, and -Runoff 2259.6.4 Soil Hydrology 2269.6.5 Modifications to Snow Layer -Logic 22710. Glaciers 22910.1 Overview 22910.2 Multiple elevation class -scheme 23110.3 Computation of the surface mass balance 23211. River -Transport Model (RTM) 23512. Urban Model (CLMU) 23913. Carbon and -Nitrogen Pools, Allocation, and Respiration 24413.1 Introduction 24413.2 -Carbon Allocation for Maintenance Respiration Costs 24613.3 Carbon and -Nitrogen Stoichiometry of New Growth 24813.4 Deployment of -retranslocated nitrogen 25213.5 Plant nitrogen uptake from soil mineral -nitrogen pool 25313.6 Final carbon and nitrogen allocation 25313.7 -Autotrophic Respiration 25613.7.1 Maintenance Respiration 25613.7.2 -Growth Respiration 25714. Vegetation Phenology 25914.1 General Phenology -Flux Parameterization 25914.1.1 Onset Periods 26014.1.2 Offset Periods -26214.1.3 Background Onset Growth 26414.1.4 Background Litterfall -26514.1.5 Livewood Turnover 26614.2 Evergreen Phenology 26714.3 -Seasonal-Deciduous Phenology 26814.3.1 Seasonal-Deciduous Onset Trigger -26814.3.2 Seasonal-Deciduous Offset Trigger 27114.4 Stress-Deciduous -Phenology 27114.4.1 Stress-Deciduous Onset Triggers 27114.4.2 -Stress-Deciduous Offset Triggers 27314.4.3 Stress-Deciduous: Long -Growing Season 27414.5 Litterfall Fluxes Merged to the Column Level -27615. Decomposition 27815.1 CLM-CN Pool Structure, Rate Constants and -Parameters 28115.2 Century-based Pool Structure, Rate Constants and -Parameters 28515.3 Environmental modifiers on decomposition rate 28615.4 -N-limitation of Decomposition Fluxes 28915.5 N Competition between plant -uptake and soil immobilization fluxes 29215.6 Final Decomposition Fluxes -29315.7 Vertical Distribution and Transport of Decomposing C and N pools -29515.8 Model Equilibration 29616. External Nitrogen Cycle 29816.1 -Atmospheric Nitrogen Deposition 29816.2 Biological Nitrogen Fixation -29916.3 Nitrification and Denitrification Losses of Nitrogen 30116.3.1 -CLM-CN formulation 30116.3.2 Century-based formulation 30416.4 Leaching -Losses of Nitrogen 30516.5 Losses of Nitrogen Due to Fire 30717. Plant -Mortality 30817.1 Mortality Fluxes Leaving Vegetation Pools 30817.2 -Mortality Fluxes Merged to the Column Level 31118. Fire 31618.1 Non-peat -fires outside cropland and tropical closed forest 31618.1.1 Fire counts -31618.1.2 Average spread area of a fire 32018.1.3 Fire impact 32318.2 -Agricultural fires 32518.3 Deforestation fires 32618.4 Peat fires 32919. -Methane Model 33219.1 Methane Model Structure and Flow 33219.2 Governing -Mass-Balance Relationship 33319.3 CH4 Production 33419.4 Ebullition -33819.5 Aerenchyma Transport 33819.6 CH4 Oxidation 34019.7 Reactive -Transport Solution 34019.7.1 Competition for CH4 and O2 34119.7.2 CH4 -and O2 Source Terms 34119.7.3 Aqueous and Gaseous Diffusion 34219.7.4 -Boundary Conditions 34319.7.5 Crank-Nicholson Solution 34419.7.6 -Interface between water table and unsaturated zone 34519.8 Inundated -Fraction Prediction 34619.9 Seasonal Inundation 34720. Crops and -Irrigation 34820.1 Summary of CLM4.5 updates relative to the CLM4.0 -34820.2 The crop model 34820.2.1 Introduction 34820.2.2 Crop plant -functional types 34920.2.3 Phenology 35020.2.3.1 Planting 35120.2.3.2 -Leaf emergence 35220.2.3.3 Grain fill 35320.2.3.4 Harvest 35320.2.4 -Allocation 35320.2.4.1 Leaf emergence to grain fill 35420.2.4.2 Grain -fill to harvest 35420.2.5 General comments 35520.3 The irrigation model -36020.4 The details about what is new in CLM4.5 36120.4.1 Interactive -irrigation for corn, temperate cereals, and soybean 36120.4.2 -Interactive fertilization 36320.4.3 Biological nitrogen fixation for -soybeans 36420.4.4 Modified C:N ratios for crops 36520.4.5 Nitrogen -retranslocation for crops 36520.4.6 Separate reproductive pool 36721. -Transient Landcover Change 36921.1 Annual Transient Land Cover Data and -Time Interpolation 36921.2 Mass and Energy Conservation 37121.3 Annual -Transient Land Cover Dataset Development 37221.3.1 UNH Transient Land -Use and Land Cover Change Dataset 37221.3.2 Representing Land Use and -Land Cover Change in CLM 37421.3.3 Present Day PFT Dataset 37521.3.4 -Potential PFT Distribution 37621.3.5 Transient Land Cover Change Dataset -37721.3.6 Forest Harvest Dataset Changes 37822. Dynamic Global -Vegetation Model 38122.1 Establishment and survival 38222.2 Light -competition 38322.3 CN processes modified for the CNDV coupling 38323. -Biogenic Volatile Organic Compounds (BVOCs) 38624. Dust Model 38825. -Carbon Isotopes 39325.1 General Form for Calculating 13C and 14C Flux -39325.2 Isotope Symbols, Units, and Reference Standards 39425.3 Carbon -Isotope Discrimination During Photosynthesis 39625.4 14C radioactive -decay and historical atmospheric 14C concentrations 39826. Offline Mode -40027. References 405** - **LIST OF FIGURES** -Figure 1.1. Land biogeophysical, biogeochemical, and landscape processes -simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). -13Figure 2.1. Configuration of the CLM subgrid hierarchy. 15Figure 4.1. -Schematic diagram of (a) direct beam radiation, (b) diffuse solar -radiation, and (c) longwave radiation absorbed, transmitted, and -reflected by vegetation and ground. 64Figure 5.1. Schematic diagram of -sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated -surfaces. 91Figure 5.2. Schematic diagram of water vapor fluxes for (a) -non-vegetated surfaces and (b) vegetated surfaces. 92Figure 6.1. -Schematic diagram of numerical scheme used to solve for soil -temperature. 119Figure 7.1. Hydrologic processes represented in CLM. -135Figure 7.2. Example of three layer snow pack (snl=-3). 137Figure 7.3. -Schematic diagram of numerical scheme used to solve for soil water -fluxes. 165Figure 12.1. Schematic representation of the urban land unit. -242Figure 12.2. Schematic of urban and atmospheric model coupling. -243Figure 13.1. Vegetation fluxes and pools. 245Figure 13.2: Carbon and -nitrogen pools. 246Figure 14.1. Example of annual phenology cycle for -seasonal deciduous. 260Figure 14.2. Example fluxes and pools sizes for -an onset growth period of 15 days, with initial transfer pool size of -100 gC m-2 and a timestep of one hour. a) Flux leaving transfer pool -(e.g. CFleaf\_xfer,leaf). b) Carbon content of transfer pool and its -associated display pool (e.g. CSleaf\_xfer and CSleaf, respectively). -262Figure 14.3. Example fluxes and pool sizes for an offset (litterfall) -period of 15 days, with initial display pool size of 100 gC m-2 and a -timestep of one hour. a) Litterfall flux (e.g CFleaf,litter). b) Carbon -content of display pool and litter pool through the litterfall period, -ignoring the losses from litter pool due to decomposition during this -period. 264Figure 15.1. Schematic of decomposition model in CLM. -279Figure 15.2. Pool structure, transitions, respired fractions (numbers -at end of arrows), and turnover times (numbers in boxes) for the 2 -alternate soil decomposition models included in CLM. 281Figure 16.1. -Biological nitrogen fixation as a function of annual net primary -production. 300Figure 19.1. Schematic representation of biological and -physical processes integrated in CLM that affect the net CH4 surface -flux. (left) Fully inundated portion of a CLM gridcell and (right) -variably saturated portion of a gridcell. 334Figure 21.1. Schematic of -land cover change impacts on CLM carbon pools and fluxes. 379Figure -21.2. Schematic of translation of annual UNH land units to CLM4 plant -functional types. 380Figure 25.1. Atmospheric -:math:`\mathrm{\Delta}`\ 14C used to drive 14C model over the historical -period. 399\ **** +- Figure 1.1. Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). + +- Figure 2.1. Configuration of the CLM subgrid hierarchy. + +- Figure 4.1. Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and reflected by vegetation and ground. + +- Figure 5.1. Schematic diagram of sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. + +- Figure 5.2. Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. + +- Figure 6.1. Schematic diagram of numerical scheme used to solve for soil temperature. + +- Figure 7.1. Hydrologic processes represented in CLM. + +- Figure 7.2. Example of three layer snow pack (snl=-3). + +- Figure 7.3. Schematic diagram of numerical scheme used to solve for soil water fluxes. + +- Figure 12.1. Schematic representation of the urban land unit. + +- Figure 12.2. Schematic of urban and atmospheric model coupling. + +- Figure 13.1. Vegetation fluxes and pools. + +- Figure 13.2: Carbon and nitrogen pools. + +- Figure 14.1. Example of annual phenology cycle for seasonal deciduous. + +- Figure 14.2. Example fluxes and pools sizes for an onset growth period of 15 days, with initial transfer pool size of 100 gC m-2 and a timestep of one hour. a) Flux leaving transfer pool (e.g. CFleaf\_xfer,leaf). b) Carbon content of transfer pool and its associated display pool (e.g. CSleaf\_xfer and CSleaf, respectively). + +- Figure 14.3. Example fluxes and pool sizes for an offset (litterfall) period of 15 days, with initial display pool size of 100 gC m-2 and a timestep of one hour. a) Litterfall flux (e.g CFleaf,litter). b) Carbon content of display pool and litter pool through the litterfall period, ignoring the losses from litter pool due to decomposition during this period. + +- Figure 15.1. Schematic of decomposition model in CLM. + +- Figure 15.2. Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 alternate soil decomposition models included in CLM. + +- Figure 16.1. Biological nitrogen fixation as a function of annual net primary production. 300Figure 19.1. Schematic representation of biological and physical processes integrated in CLM that affect the net CH4 surface flux. (left) Fully inundated portion of a CLM gridcell and (right) variably saturated portion of a gridcell. + +- Figure 21.1. Schematic of land cover change impacts on CLM carbon pools and fluxes. + +- Figure 21.2. Schematic of translation of annual UNH land units to CLM4 plant functional types. + +- Figure 25.1. Atmospheric :math:`\mathrm{\Delta}` 14C used to drive 14C model over the historical period. **LIST OF TABLES** -Table 2.1. Plant functional types 18Table 2.2. Prescribed plant -functional type heights 20Table 2.3. Atmospheric input to land model -23Table 2.4. Land model output to atmospheric model 26Table 2.5. Surface -data required for CLM4.5 and their base spatial resolution 29Table 2.6. -Physical constants 36Table 3.1. Plant functional type optical properties -44Table 3.2. Intercepted snow optical properties 46Table 3.3. Dry and -saturated soil albedos 48Table 3.4. Spectral bands and weights used for -snow radiative transfer 51Table 3.5. Single-scatter albedo values used -for snowpack impurities and ice 54Table 3.6. Mass extinction values (m2 -kg-1) used for snowpack impurities and ice. 55Table 3.7. Asymmetry -scattering parameters used for snowpack impurities and ice. 56Table 3.8. -Orbital parameters 62Table 5.1. Plant functional type aerodynamic -parameters 101Table 5.2. Coefficients for e\ :sub:`sat`\ :sup:`T` -111Table 5.3. Coefficients for 112Table 6.1. Soil layer structure. -115Table 7.1. Meltwater scavenging efficiency for particles within snow -146Table 7.2. Minimum and maximum thickness of snow layers (m) 152Table -8.1. Plant functional type (PFT) photosynthetic parameters. 185Table -8.2. Temperature dependence parameters for C3 photosynthesis. 190Table -8.3. Plant functional type root distribution parameters. 196Table 13.1. -Allocation and carbon:nitrogen ratio parameters 250Table 15.1. -Decomposition rate constants for litter and SOM pools, C:N ratios, and -acceleration parameters (see section 15.8 for explanation) for the -CLM-CN decomposition pool structure. 283Table 15.2. Respiration -fractions for litter and SOM pools 284Table 15.3. Respiration fractions -for litter and SOM pools for Century-based structure 285Table 15.4. -Turnover times, C:N ratios, and acceleration parameters (see section -15.8 for explanation) for the Century-based decomposition cascade. -286Table 18.1. PFT-specific combustion completeness and fire mortality -factors. 331Table 19.1. Parameter descriptions and sensitivity analysis -ranges applied in the methane model. 337Table 19.2. Temperature -dependence of aqueous and gaseous diffusion coefficients for CH4 and O2. -342Table 20.1. Crop plant functional types (pfts) in CLM4.5CNcrop and -their parameters relating to phenology and morphology. Numbers in the -first column correspond to the list of pfts in Table 2.1. 357Table 20.2. -Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. -Numbers in the first column correspond to the list of pfts in Table 2.1. -359Table 20.3. Pre- and post-grain fill C:N ratios for crop leaf, stem, -fine root, and reproductive pools. 367Table 22.1. Plant functional type -(PFT) biogeography rules with respect to climate. 385Table 24.1. Mass -fraction m\ :sub:`i` , mass median diameter :sub:`v, i` , and geometric -standard deviation :sub:`g, i` , per dust source mode i 392Table 24.2. -Minimum and maximum particle diameters in each dust transport bin j -392\ **** - -ACKNOWLEDGEMENTS +- Table 2.1. Plant functional types + +- Table 2.2. Prescribed plant functional type heights + +- Table 2.3. Atmospheric input to land model + +- Table 2.4. Land model output to atmospheric model + +- Table 2.5. Surface data required for CLM4.5 and their base spatial resolution + +- Table 2.6. Physical constants + +- Table 3.1. Plant functional type optical properties + +- Table 3.2. Intercepted snow optical properties + +- Table 3.3. Dry and saturated soil albedos + +- Table 3.4. Spectral bands and weights used for snow radiative transfer + +- Table 3.5. Single-scatter albedo values used for snowpack impurities and ice + +- Table 3.6. Mass extinction values (m2 kg-1) used for snowpack impurities and ice. + +- Table 3.7. Asymmetry scattering parameters used for snowpack impurities and ice. + +- Table 3.8. Orbital parameters + +- Table 5.1. Plant functional type aerodynamic parameters + +- Table 5.2. Coefficients for e\ :sub:`sat`\ :sup:`T` + +- Table 5.3. Coefficients for 112Table 6.1. Soil layer structure. + +- Table 7.1. Meltwater scavenging efficiency for particles within snow + +- Table 7.2. Minimum and maximum thickness of snow layers (m) + +- Table 8.1. Plant functional type (PFT) photosynthetic parameters. + +- Table 8.2. Temperature dependence parameters for C3 photosynthesis. + +- Table8.3. Plant functional type root distribution parameters. + +- Table 13.1. Allocation and carbon:nitrogen ratio parameters + +- Table 15.1. Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. + +- Table 15.2. Respiration fractions for litter and SOM pools + +- Table 15.3. Respiration fractions for litter and SOM pools for Century-based structure + +- Table 15.4.Turnover times, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the Century-based decomposition cascade. + +- Table 18.1. PFT-specific combustion completeness and fire mortality factors. + +- Table 19.1. Parameter descriptions and sensitivity analysis ranges applied in the methane model. + +- Table 19.2. Temperature dependence of aqueous and gaseous diffusion coefficients for CH4 and O2. + +- Table 20.1. Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in Table 2.1. + +- Table 20.2. Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in Table 2.1. + +- Table 20.3. Pre- and post-grain fill C:N ratios for crop leaf, stem, fine root, and reproductive pools. + +- Table 22.1. Plant functional type (PFT) biogeography rules with respect to climate. + +- Table 24.1. Mass fraction m\ :sub:`i` , mass median diameter :sub:`v, i` , and geometric standard deviation :sub:`g, i` , per dust source mode i + +- Table 24.2. Minimum and maximum particle diameters in each dust transport bin j + +**ACKNOWLEDGEMENTS** The authors would like to acknowledge the substantial contributions of the following members of the Land Model and Biogeochemistry Working @@ -426,12 +273,9 @@ National Laboratory); A. Bozbiyik (Bern University); C. Heald National Laboratory); Ying Sun and Z.-L. Yang (University of Texas at Austin) -.. math:: 188 - -.. math:: 7 - -Introduction -=============== +================= + 1. Introduction +================= The purpose of this technical note is to describe the biogeophysical and biogeochemical parameterizations and numerical implementation of version @@ -690,7 +534,11 @@ problems or biases. The main modifications include updates to canopy processes including a revised canopy radiation scheme and canopy scaling of leaf processes, co-limitations on photosynthesis, revisions to photosynthetic parameters -(Bonan et al. 2011), **** temperature acclimation of photosynthesis, and +(Bonan et al. 2011), + +.. todo:: had three stars here - need to resolve this + +temperature acclimation of photosynthesis, and improved stability of the iterative solution in the photosynthesis and stomatal conductance model (Sun et al. 2012). Hydrology updates include modifications such that hydraulic properties of frozen soils are @@ -827,6 +675,4 @@ processes simulated include (Figure 1.1): Figure 1.1. Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). -**|image|** - -.. |image| image:: image1 +.. image:: image1.png diff --git a/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst b/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst index 2f1fd04e7b..032589055f 100644 --- a/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst +++ b/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst @@ -20,7 +20,7 @@ ocean separately. The RTM uses a linear transport scheme to route water from each grid cell to its downstream neighboring grid cell. The change in storage :math:`S` of river water, whether it be liquid or ice, within a RTM grid -cell (m\ :math:`{}^{3}` s\ :math:`{}^{-1}`) is +cell (m\ :sup:`3` s\ :sup:`-1`) is .. math:: :label: ZEqnNum723341 @@ -28,11 +28,11 @@ cell (m\ :math:`{}^{3}` s\ :math:`{}^{-1}`) is \frac{dS}{dt} =\sum F_{in} -F_{out} +R where :math:`\sum F_{in}` is the sum of inflows of water from -neighboring upstream grid cells (m\ :math:`{}^{3}` s\ :math:`{}^{-1}`), +neighboring upstream grid cells (m\ :sup:`3` s\ :sup:`-1`), :math:`F_{out}` is the flux of water leaving the grid cell in the -downstream direction (m :math:`{}^{3}` s\ :math:`{}^{-1}`), and :math:`R` +downstream direction (m :sup:`3` s\ :sup:`-1`), and :math:`R` is the total runoff generated by the land model grid cell -(m\ :math:`{}^{3}` s\ :math:`{}^{-1}`). Downstream water flow direction in +(m\ :sup:`3` s\ :sup:`-1`). Downstream water flow direction in each grid cell is determined as one of eight compass points (north, northeast, east, southeast, south, southwest, west, and northwest) based on the steepest downhill slope as determined from a digital elevation @@ -45,9 +45,9 @@ model (Graham et al. 1999). The flux of water leaving the grid cell F_{out} =\frac{v}{d} S where :math:`v` is the effective water flow velocity (m -s\ :math:`{}^{-1}`), :math:`d` is the distance between centers of +s\ :sup:`-1`), :math:`d` is the distance between centers of neighboring grid cells (m), and :math:`S` is the volume of river water -stored within the grid cell (m\ :math:`{}^{3}`). The effective water flow +stored within the grid cell (m\ :sup:`3`). The effective water flow velocity can be estimated from Manning’s equation, which is a function of surface water slope, the hydraulic radius of the river channel, and a channel roughness coefficient (Dingman, 2002). However, hydraulic radius @@ -94,7 +94,7 @@ The RTM is generally run at a time step greater than that of the CLM because of computational constraints. The total runoff from the land model at each time step is accumulated until the RTM is invoked. The total liquid water runoff at the land model resolution (kg -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is +m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 11.6) @@ -104,7 +104,7 @@ m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is where :math:`q_{over}` is surface runoff (section 7.3), :math:`q_{drai}` is sub-surface drainage (section 7.6), and :math:`q_{rgwl}` is liquid runoff from glaciers, wetlands, and lakes -(all in kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) (sections 7.7 and +(all in kg m\ :sup:`-2` s\ :sup:`-1`) (sections 7.7 and 9.6.3). The total ice water runoff, also at the land model resolution is .. math:: @@ -115,9 +115,9 @@ where :math:`q_{over}` is surface runoff (section 7.3), where :math:`q_{snwcp,ice}` is the ice runoff from snow-capped surfaces (section 7.7). The runoff at the land model resolution is interpolated to the resolution of RTM and converted to units of -m\ :math:`{}^{3}` s\ :math:`{}^{-1}` for use in equation by multiplying +m\ :sup:`3` s\ :sup:`-1` for use in equation by multiplying by :math:`1\times 10^{-3} A` where :math:`A` is the area -(m\ :math:`{}^{2}`) of the RTM grid cell. +(m\ :sup:`2`) of the RTM grid cell. The RTM grid cells that are at river mouths, hence providing freshwater flux to the ocean, are identified by examining each RTM ocean grid cell diff --git a/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst b/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst index f4e74d3731..7e78b328d2 100644 --- a/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst +++ b/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst @@ -83,9 +83,9 @@ LD)], was derived from LandScan 2004, a population density dataset derived from census data, nighttime lights satellite observations, road proximity, and slope (Dobson et al. 2000). The urban extent data for TBD, HD, and MD classes are aggregated from the original 1 km resolution -to both a 0.05\ :math:`{}^\circ` by 0.05\ :math:`{}^\circ` global grid -for high-resolution studies or a 0.5\ :math:`{}^\circ` by -0.5\ :math:`{}^\circ` grid. For the current implementation, the LD class +to both a 0.05\ :sup:`o` by 0.05\ :sup:`o` global grid +for high-resolution studies or a 0.5\ :sup:`o` by +0.5\ :sup:`o` grid. For the current implementation, the LD class is not used because it is highly rural and better modeled as a vegetated/soil surface. Although the TBD, HD, and MD classes are represented as individual urban landunits, urban model history output is diff --git a/doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst b/doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst index c4a4ab2345..a4173834b5 100644 --- a/doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst +++ b/doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst @@ -64,14 +64,14 @@ storage pools from which new growth will be displayed in subsequent time steps. The total maintenance respiration demand (:math:`CF_{mr}`, gC -m\ :sup:`-2` s\ :math:`{}^{-1}`) is calculated as a function of +m\ :sup:`-2` s\ :sup:`-1`) is calculated as a function of tissue mass and nitrogen concentration, and temperature (section 13.7). The carbon supply to support this demand is composed of fluxes allocated from carbon assimilated in the current timestep -(:math:`CF_{GPP,mr}`, gC m\ :sup:`-2` s\ :math:`{}^{-1}`) +(:math:`CF_{GPP,mr}`, gC m\ :sup:`-2` s\ :sup:`-1`) and from a storage pool that is drawn down when total demand exceeds photosynthesis ( :math:`CF_{xs,mr}`, gC m\ :sup:`-2` -s\ :math:`{}^{-1}`): +s\ :sup:`-1`): .. math:: :label: 13.1) @@ -105,7 +105,7 @@ and plant type are not suitable to sustained growth, the deficit in this pool increases until the available carbon is being allocated mostly to alleviate the deficit, and new growth approaches zero. The allocation flux to :math:`CS_{xs}` (:math:`CF_{GPP,xs}`, gC -m\ :sup:`-2` s\ :math:`{}^{-1}`) is given as +m\ :sup:`-2` s\ :sup:`-1`) is given as .. math:: :label: 13.4) @@ -131,7 +131,7 @@ Carbon and Nitrogen Stoichiometry of New Growth After accounting for the carbon cost of maintenance respiration, the remaining carbon flux from photosynthesis which can be allocated to new -growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :math:`{}^{-1}`) is +growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 13.6) @@ -197,11 +197,11 @@ Table 13.1. Allocation and carbon:nitrogen ratio parameters +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ | BDS boreal | 1 | 0.3 | 0.2 | 0.1 | 25 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :math:`{}_{3}` arctic grass | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | +| C\ :sub:`3` arctic grass | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :math:`{}_{3}` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | +| C\ :sub:`3` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :math:`{}_{4}` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | +| C\ :sub:`4` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ | Crop R | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ @@ -237,10 +237,10 @@ where all C:N parameters are defined as constants for a given PFT (Table Given values for the parameters in and , total carbon and nitrogen allocation to new growth ( :math:`CF_{alloc}`, gC -m\ :sup:`-2` s\ :math:`{}^{-1}`, and :math:`NF_{alloc}`, gN -m\ :sup:`-2` s\ :math:`{}^{-1}`, respectively) can be expressed as +m\ :sup:`-2` s\ :sup:`-1`, and :math:`NF_{alloc}`, gN +m\ :sup:`-2` s\ :sup:`-1`, respectively) can be expressed as functions of new leaf carbon allocation (:math:`CF_{GPP,leaf}`, gC -m\ :sup:`-2` s\ :math:`{}^{-1}`): +m\ :sup:`-2` s\ :sup:`-1`): .. math:: :label: ZEqnNum555154 @@ -263,7 +263,7 @@ Since the C:N stoichiometry for new growth allocation is defined, from Eq. , as :math:`C_{allom}`/ :math:`N_{allom}`, the total carbon available for new growth allocation (:math:`CF_{avail\_alloc}`) can be used to calculate the total plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, -gN m\ :sup:`-2` s\ :math:`{}^{-1}`) as: +gN m\ :sup:`-2` s\ :sup:`-1`) as: .. math:: :label: 13.13) @@ -282,16 +282,16 @@ Son and Gower, 1991). CLM includes one pool of retranslocated nitrogen (:math:`NS_{retrans}`, gN m\ :sup:`-2`), and the availability of nitrogen from this pool to support new growth (:math:`NF_{avail\_retrans}`, gN m\ :sup:`-2` -s\ :math:`{}^{-1}`) is proportional to the plant nitrogen demand, as: +s\ :sup:`-1`) is proportional to the plant nitrogen demand, as: .. math:: :label: 13.14) NF_{avail\_ retrans} =\min \left(\frac{NF_{retrans\_ ann} \frac{NF_{plant\_ demand} }{NF_{plant\_ demand\_ ann} } }{\Delta t} ,\; \frac{NS_{retrans} }{\Delta t} \right) -where :math:`NF_{retrans\_ann}` (gN m\ :sup:`-2` y\ :math:`{}^{-1}`) is the previous year’s annual sum of retranslocated +where :math:`NF_{retrans\_ann}` (gN m\ :sup:`-2` y\ :sup:`-1`) is the previous year’s annual sum of retranslocated nitrogen extracted from senescing tissues, -:math:`NF_{plant\_demand\_ann}` (gN m\ :sup:`-2` y\ :math:`{}^{-1}`) is the previous year’s annual sum of +:math:`NF_{plant\_demand\_ann}` (gN m\ :sup:`-2` y\ :sup:`-1`) is the previous year’s annual sum of :math:`NF_{plant\_demand}`, and :math:`\Delta`\ *t* (s) is the model’s biogeochemistry time step. This formulation produces an annual cycle in the extraction of nitrogen from :math:`NS_{retrans}` @@ -307,7 +307,7 @@ simulation, before :math:`NF_{plant\_demand\_ann}` and The actual flux of nitrogen from the retranslocated N pool into allocation of new growth (:math:`NF_{retrans,alloc}`, gN -m\ :sup:`-2` s\ :math:`{}^{-1}`) is never greater than the plant +m\ :sup:`-2` s\ :sup:`-1`) is never greater than the plant demand for new nitrogen: .. math:: @@ -321,7 +321,7 @@ Plant nitrogen uptake from soil mineral nitrogen pool The total plant nitrogen demand is reduced by the nitrogen flux from :math:`NS_{retrans}` to give the plant demand for mineral nitrogen from the soil (:math:`NF_{plant\_demand\_soil}`, gN -m\ :sup:`-2` s\ :math:`{}^{-1}`): +m\ :sup:`-2` s\ :sup:`-1`): .. math:: :label: ZEqnNum491412 @@ -368,7 +368,7 @@ The downregulation of photosynthesis can then be calculated as: f_{dreg} =\frac{CF_{alloc} -CF_{avail\_ alloc} }{CF_{GPPpot} } . Total allocation to new leaf carbon -(:math:`CF_{alloc,leaf\_tot}`, gC m\ :sup:`-2` s\ :math:`{}^{-1}`) is calculated as: +(:math:`CF_{alloc,leaf\_tot}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as: .. math:: :label: 13.21) @@ -550,8 +550,8 @@ following the empirical relationship reported by Ryan (1991): where :math:`MR_{base}` (= 2.525e\ :sup:`-6` gC gN\ :sup:`-1` s\ :sup:`-1`) is the base rate of maintenance respiration per unit nitrogen content, :math:`MR_{q10}` (= 2.0) is the temperature sensitivity for maintenance respiration, -:math:`T_{2m}` (:math:`{}^\circ`\ C) is the air temperature at 2m -height, :math:`Ts_{j}`* (:math:`{}^\circ`\ C) is the soil +:math:`T_{2m}` (:sup:`o`\ C) is the air temperature at 2m +height, :math:`Ts_{j}`* (:sup:`o`\ C) is the soil temperature at level *j*, and :math:`rootfr_{j}` is the fraction of fine roots distributed in soil level *j*. diff --git a/doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst b/doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst index 65a0cf17a7..305e532552 100644 --- a/doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst +++ b/doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst @@ -1,5 +1,3 @@ -.. math:: 10 - Vegetation Phenology ======================== @@ -33,7 +31,7 @@ storage over the course of a single growing season. Figure 14.1. Example of annual phenology cycle for seasonal deciduous. -|image| +.. image:: image1.png 14.1.1 Onset Periods ^^^^^^^^^^^^^^^^^^^^ @@ -43,78 +41,77 @@ growth periods (Figure 14.1). Carbon fluxes from the transfer pools into displayed growth are calculated during these periods as: .. math:: + :label: 14.1) - \label{14.1)} CF_{leaf\_ xfer,leaf} =r_{xfer\_ on} CS_{leaf\_ xfer} .. math:: + :label: 14.2) - \label{14.2)} CF_{froot\_ xfer,froot} =r_{xfer\_ on} CS_{froot\_ xfer} .. math:: + :label: 14.3) - \label{14.3)} CF_{livestem\_ xfer,livestem} =r_{xfer\_ on} CS_{livestem\_ xfer} .. math:: + :label: 14.4) - \label{14.4)} CF_{deadstem\_ xfer,deadstem} =r_{xfer\_ on} CS_{deadstem\_ xfer} .. math:: + :label: 14.5) - \label{14.5)} CF_{livecroot\_ xfer,livecroot} =r_{xfer\_ on} CS_{livecroot\_ xfer} .. math:: + :label: 14.6) - \label{14.6)} CF_{deadcroot\_ xfer,deadcroot} =r_{xfer\_ on} CS_{deadcroot\_ xfer} , with corresponding nitrogen fluxes: .. math:: + :label: 14.7) - \label{14.7)} NF_{leaf\_ xfer,leaf} =r_{xfer\_ on} NS_{leaf\_ xfer} .. math:: + :label: 14.8) - \label{14.8)} NF_{froot\_ xfer,froot} =r_{xfer\_ on} NS_{froot\_ xfer} .. math:: + :label: 14.9) - \label{14.9)} NF_{livestem\_ xfer,livestem} =r_{xfer\_ on} NS_{livestem\_ xfer} .. math:: + :label: 14.10) - \label{14.10)} NF_{deadstem\_ xfer,deadstem} =r_{xfer\_ on} NS_{deadstem\_ xfer} .. math:: + :label: 14.11) - \label{14.11)} NF_{livecroot\_ xfer,livecroot} =r_{xfer\_ on} NS_{livecroot\_ xfer} .. math:: + :label: 14.12) - \label{14.12)} NF_{deadcroot\_ xfer,deadcroot} =r_{xfer\_ on} NS_{deadcroot\_ xfer} , where CF is the carbon flux, CS is stored carbon, NF is the nitrogen -flux, NS is stored nitrogen, *r\ :math:`{}_{xfer\_on}`* -(s:math:`{}^{-1}`) is a time-varying rate coefficient controlling flux +flux, NS is stored nitrogen, :math:`{r}_{xfer\_on}` (s\ :sup:`-1`) is a time-varying rate coefficient controlling flux out of the transfer pool: .. math:: + :label: ZEqnNum852972 - \label{ZEqnNum852972} r_{xfer\_ on} =\left\{\begin{array}{l} {{2\mathord{\left/ {\vphantom {2 t_{onset} }} \right. \kern-\nulldelimiterspace} t_{onset} } \qquad {\rm for\; }t_{onset} \ne \Delta t} \\ {{1\mathord{\left/ {\vphantom {1 \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \qquad {\rm for\; }t_{onset} =\Delta t} \end{array}\right. -and *t\ :math:`{}_{onset}`* (s) is the number of seconds remaining in +and *t*\ :sub:`onset` (s) is the number of seconds remaining in the current phenology onset growth period (Figure 14.1). The form of Eq. produces a flux from the transfer pool which declines linearly over the onset growth period, approaching zero flux in the final timestep. @@ -129,47 +126,44 @@ Carbon fluxes from display pools into litter are calculated during these periods as: .. math:: + :label: 14.14) - \label{14.14)} CF_{leaf,litter}^{n} =\left\{\begin{array}{l} {CF_{leaf,litter}^{n-1} +r_{xfer\_ off} \left(CS_{leaf} -CF_{leaf,litter}^{n-1} {\kern 1pt} t_{offset} \right)\qquad {\rm for\; }t_{offset} \ne \Delta t} \\ {\left({CS_{leaf} \mathord{\left/ {\vphantom {CS_{leaf} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right)+CF_{alloc,leaf} \qquad \qquad \qquad \qquad {\rm for\; }t_{offset} =\Delta t} \end{array}\right. .. math:: + :label: 14.15) - \label{14.15)} CF_{froot,litter}^{n} =\left\{\begin{array}{l} {CF_{froot,litter}^{n-1} +r_{xfer\_ off} \left(CS_{froot} -CF_{froot,litter}^{n-1} {\kern 1pt} t_{offset} \right)\qquad {\rm for\; }t_{offset} \ne \Delta t} \\ {\left({CS_{froot} \mathord{\left/ {\vphantom {CS_{froot} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right)+CF_{alloc,\, froot} \qquad \qquad \qquad {\rm for\; }t_{offset} =\Delta t} \end{array}\right. .. math:: + :label: 14.16) - \label{14.16)} r_{xfer\_ off} =\frac{2\Delta t}{t_{offset} ^{2} } where superscripts *n* and *n-1* refer to fluxes on the current and -previous timesteps, respectively. The rate coefficient -*r\ :math:`{}_{xfer\_off}`* varies with time to produce a linearly +previous timesteps, respectively. The rate coefficient :math:`{r}_{xfer\_off}` varies with time to produce a linearly increasing litterfall rate throughout the offset period, and the special case for fluxes in the final litterfall timestep -(*t\ :math:`{}_{offset}`* = *:math:`\Delta`\ t*) ensures that all of the +(:math:`{t}_{offset}` = :math:`\Delta t`\ ) ensures that all of the displayed growth is sent to the litter pools for deciduous plant types. -Corresponding nitrogen fluxes during litterfall take into account -retranslocation of nitrogen out of the displayed leaf pool prior to -litterfall (*NF\ :math:`{}_{leaf,retrans}`*, gN m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`). Retranslocation of nitrogen out of fine roots is +Corresponding nitrogen fluxes during litterfall take into account retranslocation of nitrogen out of the displayed leaf pool prior to +litterfall (:math:`{NF}_{leaf,retrans}`, gN m\ :sup:`-2` s\ :sup:`-1`). Retranslocation of nitrogen out of fine roots is assumed to be negligible. The fluxes are: .. math:: + :label: 14.17) - \label{14.17)} NF_{leaf,litter} ={CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{leaf\_ litter} }} \right. \kern-\nulldelimiterspace} CN_{leaf\_ litter} } .. math:: + :label: 14.18) - \label{14.18)} NF_{froot,litter} ={CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{froot} }} \right. \kern-\nulldelimiterspace} CN_{froot} } .. math:: + :label: 14.19) - \label{14.19)} NF_{leaf,retrans} =\left({CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{leaf} }} \right. \kern-\nulldelimiterspace} CN_{leaf} } \right)-NF_{leaf,litter} . where CN is C:N. @@ -182,7 +176,7 @@ case when stress signals are absent, and the vegetation shifts from a deciduous habit to an evergreen habit, until the next occurrence of an offset stress trigger . In that case, the regular onset flux mechanism is switched off and a background onset growth algorithm is invoked -(*r\ :math:`{}_{bgtr}`* :math:`>` 0). During this period, small fluxes +(:math:`{r}_{bgtr} > 0`). During this period, small fluxes of carbon and nitrogen from the storage pools into the associated transfer pools are calculated on each time step, and the entire contents of the transfer pool are added to the associated displayed growth pool @@ -190,65 +184,65 @@ on each time step. The carbon fluxes from transfer to display pools under these conditions are: .. math:: + :label: 14.20) - \label{14.20)} CF_{leaf\_ xfer,leaf} ={CS_{leaf\_ xfer} \mathord{\left/ {\vphantom {CS_{leaf\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.21) - \label{14.21)} CF_{froot\_ xfer,froot} ={CS_{froot\_ xfer} \mathord{\left/ {\vphantom {CS_{froot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.22) - \label{14.22)} CF_{livestem\_ xfer,livestem} ={CS_{livestem\_ xfer} \mathord{\left/ {\vphantom {CS_{livestem\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.23) - \label{14.23)} CF_{deadstem\_ xfer,deadstem} ={CS_{deadstem\_ xfer} \mathord{\left/ {\vphantom {CS_{deadstem\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.24) - \label{14.24)} CF_{livecroot\_ xfer,livecroot} ={CS_{livecroot\_ xfer} \mathord{\left/ {\vphantom {CS_{livecroot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.25) - \label{14.25)} CF_{deadcroot\_ xfer,deadcroot} ={CS_{deadcroot\_ xfer} \mathord{\left/ {\vphantom {CS_{deadcroot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} , and the corresponding nitrogen fluxes are: .. math:: + :label: 14.26) - \label{14.26)} NF_{leaf\_ xfer,leaf} ={NS_{leaf\_ xfer} \mathord{\left/ {\vphantom {NS_{leaf\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.27) - \label{14.27)} NF_{froot\_ xfer,froot} ={NS_{froot\_ xfer} \mathord{\left/ {\vphantom {NS_{froot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.28) - \label{14.28)} NF_{livestem\_ xfer,livestem} ={NS_{livestem\_ xfer} \mathord{\left/ {\vphantom {NS_{livestem\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.29) - \label{14.29)} NF_{deadstem\_ xfer,deadstem} ={NS_{deadstem\_ xfer} \mathord{\left/ {\vphantom {NS_{deadstem\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.30) - \label{14.30)} NF_{livecroot\_ xfer,livecroot} ={NS_{livecroot\_ xfer} \mathord{\left/ {\vphantom {NS_{livecroot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.31) - \label{14.31)} NF_{deadcroot\_ xfer,deadcroot} ={NS_{deadcroot\_ xfer} \mathord{\left/ {\vphantom {NS_{deadcroot\_ xfer} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} . 14.1.4 Background Litterfall @@ -261,34 +255,33 @@ referred to as background litterfall. For evergreen types the background litterfall is the only litterfall flux. For stress-deciduous types either the offset period litterfall or the background litterfall mechanism may be active, but not both at once. Given a specification of -the background litterfall rate (*r\ :math:`{}_{bglf}`*, -s\ :math:`{}^{-1}`), litterfall carbon fluxes are calculated as +the background litterfall rate (:math:`{r}_{bglf}`, s\ :sup:`-1`), litterfall carbon fluxes are calculated as .. math:: + :label: 14.32) - \label{14.32)} CF_{leaf,litter} =r_{bglf} CS_{leaf} .. math:: + :label: 14.33) - \label{14.33)} CS_{froot,litter} =r_{bglf} CS_{froot} , with corresponding nitrogen litterfall and retranslocation fluxes: .. math:: + :label: 14.34) - \label{14.34)} NF_{leaf,litter} ={CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{leaf\_ litter} }} \right. \kern-\nulldelimiterspace} CN_{leaf\_ litter} } .. math:: + :label: 14.35) - \label{14.35)} NF_{froot,litter} ={CF_{froot,litter} \mathord{\left/ {\vphantom {CF_{froot,litter} CN_{froot} }} \right. \kern-\nulldelimiterspace} CN_{froot} } .. math:: + :label: 14.36) - \label{14.36)} NF_{leaf,retrans} =\left({CF_{leaf,litter} \mathord{\left/ {\vphantom {CF_{leaf,litter} CN_{leaf} }} \right. \kern-\nulldelimiterspace} CN_{leaf} } \right)-NF_{leaf,litter} . 14.1.5 Livewood Turnover @@ -305,48 +298,48 @@ effect the transfer of live wood to dead wood pools, which also takes into account the different nitrogen concentrations typical of these tissue types. -A live wood turnover rate (*r\ :math:`{}_{lwt}`*, s\ :math:`{}^{-1}`) is +A live wood turnover rate (:math:`{r}_{lwt}`, s\ :sup:`-1`) is defined as .. math:: + :label: 14.37) - \label{14.37)} r_{lwt} ={p_{lwt} \mathord{\left/ {\vphantom {p_{lwt} \left(365\cdot 86400\right)}} \right. \kern-\nulldelimiterspace} \left(365\cdot 86400\right)} -where *p\ :math:`{}_{lwt}`* = 0.7 is the assumed annual live wood +where :math:`{p}_{lwt} = 0.7` is the assumed annual live wood turnover fraction. Carbon fluxes from live to dead wood pools are: .. math:: + :label: 14.38) - \label{14.38)} CF_{livestem,deadstem} =CS_{livestem} r_{lwt} .. math:: + :label: 14.39) - \label{14.39)} CF_{livecroot,deadcroot} =CS_{livecroot} r_{lwt} , and the associated nitrogen fluxes, including retranslocation of nitrogen out of live wood during turnover, are: .. math:: + :label: 14.40) - \label{14.40)} NF_{livestem,deadstem} ={CF_{livestem,deadstem} \mathord{\left/ {\vphantom {CF_{livestem,deadstem} CN_{dw} }} \right. \kern-\nulldelimiterspace} CN_{dw} } .. math:: + :label: 14.41) - \label{14.41)} NF_{livestem,retrans} =\left({CF_{livestem,deadstem} \mathord{\left/ {\vphantom {CF_{livestem,deadstem} CN_{lw} }} \right. \kern-\nulldelimiterspace} CN_{lw} } \right)-NF_{livestem,deadstem} .. math:: + :label: 14.42) - \label{14.42)} NF_{livecroot,deadcroot} ={CF_{livecroot,deadcroot} \mathord{\left/ {\vphantom {CF_{livecroot,deadcroot} CN_{dw} }} \right. \kern-\nulldelimiterspace} CN_{dw} } .. math:: + :label: 14.43) - \label{14.43)} NF_{livecroot,retrans} =\left({CF_{livecroot,deadcroot} \mathord{\left/ {\vphantom {CF_{livecroot,deadcroot} CN_{lw} }} \right. \kern-\nulldelimiterspace} CN_{lw} } \right)-NF_{livecroot,deadcroot} . Evergreen Phenology @@ -355,7 +348,7 @@ Evergreen Phenology The evergreen phenology algorithm is by far the simplest of the three possible types. It is assumed for all evergreen types that all carbon and nitrogen allocated for new growth in the current timestep goes -immediately to the displayed growth pools (i.e. *f\ :math:`{}_{cur}`* = +immediately to the displayed growth pools (i.e. f\ :math:`{f}_{cur} = 1.0` (Chapter 13)). As such, there is never an accumulation of carbon or nitrogen in the storage or transfer pools, and so the onset growth and background onset growth mechanisms are never invoked for this type. @@ -366,13 +359,12 @@ roots. This is an obvious area for potential improvements in the model, since it is known, at least for evergreen needleleaf trees in the temperate and boreal zones, that there are distinct periods of higher and lower leaf litterfall (Ferrari, 1999; Gholz et al., 1985). The rate -of background litterfall (*r\ :math:`{}_{bglf}`*, section 14.1.4) -depends on the specified leaf longevity -(*:math:`\tau`\ :math:`{}_{leaf}`*, y), as +of background litterfall (:math:`{r}_{bglf}`, section 14.1.4) +depends on the specified leaf longevity (:math:`\tau_{leaf}`\ , y), as .. math:: + :label: 14.44) - \label{14.44)} r_{bglf} =\frac{1}{\tau _{leaf} \cdot 365\cdot 86400} . Seasonal-Deciduous Phenology @@ -394,16 +386,15 @@ of one onset period and one offset period each year. The algorithms for initiation of onset and offset periods use the winter and summer solstices as coordination signals. The period between winter -and summer solstice is identified as *dayl\ :math:`{}_{n}`* :math:`>` -*dayl\ :math:`{}_{n-1}`*, and the period between summer and winter -solstice is identified as *dayl\ :math:`{}_{n}`* :math:`<` -*dayl\ :math:`{}_{n-1}`*, where *dayl\ :math:`{}_{n}`* and -*dayl\ :math:`{}_{n-1}`* are the daylength (s) calculated for the +and summer solstice is identified as :math:`{dayl}_{n} > {dayl}_{n-1}`, +and the period between summer and winter +solstice is identified as :math:`{dayl}_{n} < {dayl}_{n-1}`, +where :math:`{dayl}_{n}` and :math:`{dayl}_{n-1}` are the day length(s) calculated for the current and previous timesteps, respectively, using .. math:: + :label: 14.45) - \label{14.45)} dayl=2\cdot 13750.9871\cdot acos\left(\frac{-\sin (lat)\sin (decl)}{\cos (lat)\cos (decl)} \right), where *lat* and *decl* are the latitude and solar declination (radians), @@ -415,124 +406,120 @@ radian of hour-angle. The onset trigger for the seasonal-deciduous phenology algorithm is based on an accumulated growing-degree-day approach (White et al., -1997). The growing-degree-day summation (*GDD\ :math:`{}_{sum}`*) is -initiated (*GDD\ :math:`{}_{sum}`* = 0) when the phenological state is +1997). The growing-degree-day summation (:math:`{GDD}_{sum}`) is +initiated ( :math:`{GDD}_{sum} = 0`) when the phenological state is dormant and the model timestep crosses the winter solstice. Once these -conditions are met, *GDD\ :math:`{}_{sum}`* is updated on each timestep -as +conditions are met, :math:`{GDD}_{sum}` is updated on each timestep as .. math:: + :label: ZEqnNum510730 - \label{ZEqnNum510730} GDD_{sum}^{n} =\left\{\begin{array}{l} {GDD_{sum}^{n-1} +\left(T_{s,3} -TKFRZ\right)f_{day} \qquad {\rm for\; }T_{s,3} >TKFRZ} \\ {GDD_{sum}^{n-1} \qquad \qquad \qquad {\rm for\; }T_{s,3} \le TKFRZ} \end{array}\right. -where *T\ :math:`{}_{s,3}`* (K) is the temperature of the third soil -layer, and +where :math:`{T}_{s,3}` (K) is the temperature of the third soil layer, and :math:`f_{day} ={\Delta t\mathord{\left/ {\vphantom {\Delta t 86400}} \right. \kern-\nulldelimiterspace} 86400}` . The onset period is initiated if :math:`GDD_{sum} >GDD_{sum\_ crit}` , where .. math:: + :label: ZEqnNum598907 - \label{ZEqnNum598907} GDD_{sum\_ crit} =\exp \left(4.8+0.13{\kern 1pt} \left(T_{2m,ann\_ avg} -TKFRZ\right)\right) -and where *T\ :math:`{}_{2m,ann\_avg}`* (K) is the annual average of -the 2m air temperature, and TKFRZ is the freezing point of water (273.15 -K). The following control variables are set when a new onset growth +and where :math:`{T}_{2m,ann\_avg}` (K) is the annual average of +the 2m air temperature, and TKFRZ is the freezing point of water (273.15 K). The following control variables are set when a new onset growth period is initiated: .. math:: + :label: 14.48) - \label{14.48)} GDD_{sum} =0 .. math:: + :label: 14.49) - \label{14.49)} t_{onset} =86400\cdot n_{days\_ on} , -where *n\ :math:`{}_{days\_on}`* is set to a constant value of 30 days. +where :math:`{n}_{days\_on}` is set to a constant value of 30 days. Fluxes from storage into transfer pools occur in the timestep when a new onset growth period is initiated. Carbon fluxes are: .. math:: + :label: ZEqnNum904388 - \label{ZEqnNum904388} CF_{leaf\_ stor,leaf\_ xfer} ={f_{stor,xfer} CS_{leaf\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{leaf\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.51) - \label{14.51)} CF_{froot\_ stor,froot\_ xfer} ={f_{stor,xfer} CS_{froot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{froot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.52) - \label{14.52)} CF_{livestem\_ stor,livestem\_ xfer} ={f_{stor,xfer} CS_{livestem\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{livestem\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.53) - \label{14.53)} CF_{deadstem\_ stor,deadstem\_ xfer} ={f_{stor,xfer} CS_{deadstem\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{deadstem\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.54) - \label{14.54)} CF_{livecroot\_ stor,livecroot\_ xfer} ={f_{stor,xfer} CS_{livecroot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{livecroot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.55) - \label{14.55)} CF_{deadcroot\_ stor,deadcroot\_ xfer} ={f_{stor,xfer} CS_{deadcroot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{deadcroot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: ZEqnNum195642 - \label{ZEqnNum195642} CF_{gresp\_ stor,gresp\_ xfer} ={f_{stor,xfer} CS_{gresp\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} CS_{gresp\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} and the associated nitrogen fluxes are: .. math:: + :label: ZEqnNum812152 - \label{ZEqnNum812152} NF_{leaf\_ stor,leaf\_ xfer} ={f_{stor,xfer} NS_{leaf\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{leaf\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.58) - \label{14.58)} NF_{froot\_ stor,froot\_ xfer} ={f_{stor,xfer} NS_{froot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{froot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.59) - \label{14.59)} NF_{livestem\_ stor,livestem\_ xfer} ={f_{stor,xfer} NS_{livestem\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{livestem\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.60) - \label{14.60)} NF_{deadstem\_ stor,deadstem\_ xfer} ={f_{stor,xfer} NS_{deadstem\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{deadstem\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 14.61) - \label{14.61)} NF_{livecroot\_ stor,livecroot\_ xfer} ={f_{stor,xfer} NS_{livecroot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{livecroot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: ZEqnNum605338 - \label{ZEqnNum605338} NF_{deadcroot\_ stor,deadcroot\_ xfer} ={f_{stor,xfer} NS_{deadcroot\_ stor} \mathord{\left/ {\vphantom {f_{stor,xfer} NS_{deadcroot\_ stor} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} -where *f\ :math:`{}_{stor,xfer}`* is the fraction of current storage +where :math:`{f}_{stor,xfer}` is the fraction of current storage pool moved into the transfer pool for display over the incipient onset period. This fraction is set to 0.5, based on the observation that seasonal deciduous trees are capable of replacing their canopies from storage reserves in the event of a severe early-season disturbance such as frost damage or defoliation due to insect herbivory. -If the onset criterion (*GDD\ :math:`{}_{sum}`* :math:`>` -*GDD\ :math:`{}_{sum\_crit}`*) is not met before the summer solstice, -then *GDD\ :math:`{}_{sum}`* is set to 0.0 and the growing-degree-day +If the onset criterion (:math:`{GDD}_{sum} > {GDD}_{sum\_crit}`) is not met before the summer solstice, +then :math:`{GDD}_{sum}` is set to 0.0 and the growing-degree-day accumulation will not start again until the following winter solstice. This mechanism prevents the initiation of very short growing seasons late in the summer in cold climates. The onset counter is decremented on @@ -540,8 +527,8 @@ each time step after initiation of the onset period, until it reaches zero, signaling the end of the onset period: .. math:: + :label: 14.63) - \label{14.63)} t_{onfset}^{n} =t_{onfset}^{n-1} -\Delta t 14.3.2 Seasonal-Deciduous Offset Trigger @@ -551,14 +538,14 @@ After the completion of an onset period, and once past the summer solstice, the offset (litterfall) period is triggered when daylength is shorter than 39300 s. The offset counter is set at the initiation of the offset period: :math:`t_{offset} =86400\cdot n_{days\_ off}` , where -*n\ :math:`{}_{days\_off}`* is set to a constant value of 15 days. The +:math:`{n}_{days\_off}` is set to a constant value of 15 days. The offset counter is decremented on each time step after initiation of the offset period, until it reaches zero, signaling the end of the offset period: .. math:: + :label: 14.64) - \label{14.64)} t_{offset}^{n} =t_{offset}^{n-1} -\Delta t Stress-Deciduous Phenology @@ -581,22 +568,21 @@ the next stress trigger. In climates that are warm year-round, onset triggering depends on soil water availability. At the beginning of a dormant period (end of previous offset period), an accumulated soil water index -(*SWI\ :math:`{}_{sum}`*, d) is initialized (*SWI\ :math:`{}_{sum}`* = -0), with subsequent accumulation calculated as: +(:math:`{SWI}_{sum}`, d) is initialized (:math:`{SWI}_{sum} = 0`), with subsequent accumulation calculated as: .. math:: + :label: ZEqnNum503826 - \label{ZEqnNum503826} SWI_{sum}^{n} =\left\{\begin{array}{l} {SWI_{sum}^{n-1} +f_{day} \qquad {\rm for\; }\Psi _{s,3} \ge \Psi _{onset} } \\ {SWI_{sum}^{n-1} \qquad \qquad {\rm for\; }\Psi _{s,3} <\Psi _{onset} } \end{array}\right. -where :math:`\Psi`\ *:math:`{}_{s,3}`* is the soil water potential (MPa) -in the third soil layer and :math:`\Psi`\ *:math:`{}_{onset}`* = -2 MPa +where :math:`\Psi`\ :sub:`s,3` is the soil water potential (MPa) +in the third soil layer and :math:`{\Psi}_{onset} = -2 MPa` is the onset soil water potential threshold. Onset triggering is -possible once *SWI\ :math:`{}_{sum}`* :math:`>` 15. If the cold climate +possible once :math:`{SWI}_{sum} > 15`. If the cold climate growing degree-day accumulator is not active at the time when this threshold is reached (see below), and if the daylength is greater than 6 hours, then onset is triggered. Except as noted below, -*SWI\ :math:`{}_{sum}`* continues to accumulate according to Eq. during +:math:`{SWI}_{sum}` continues to accumulate according to Eq. during the dormant period if the daylength criterion prevents onset triggering, and onset is then triggered at the timestep when daylength exceeds 6 hours. @@ -604,37 +590,32 @@ hours. In climates with a cold season, onset triggering depends on both accumulated soil temperature summation and adequate soil moisture. At the beginning of a dormant period a freezing day accumulator -(*FD\ :math:`{}_{sum}`*, d) is initialized (*FD\ :math:`{}_{sum}`* = 0), +(:math:`{FD}_{sum}`, d) is initialized (:math:`{FD}_{sum} = 0`), with subsequent accumulation calculated as: .. math:: + :label: 14.66) - \label{14.66)} FD_{sum}^{n} =\left\{\begin{array}{l} {FD_{sum}^{n-1} +f_{day} \qquad {\rm for\; }T_{s,3} >TKFRZ} \\ {FD_{sum}^{n-1} \qquad \qquad {\rm for\; }T_{s,3} \le TKFRZ} \end{array}\right. . -If *FD\ :math:`{}_{sum}`* :math:`>` 15 during the dormant period, then a +If :math:`{FD}_{sum} > 15` during the dormant period, then a cold-climate onset triggering criterion is introduced, following exactly -the growing degree-day summation (*GDD\ :math:`{}_{sum}`*) logic of Eqs. -and . At that time *SWI\ :math:`{}_{sum}`* is reset -(*SWI\ :math:`{}_{sum}`* = 0). Onset triggering under these conditions +the growing degree-day summation (:math:`{GDD}_{sum}`) logic of Eqs. +and . At that time :math:`{SWI}_{sum}` is reset +(:math:`{SWI}_{sum} = 0`). Onset triggering under these conditions depends on meeting all three of the following criteria: -*SWI\ :math:`{}_{sum}`* :math:`>` 15, *GDD\ :math:`{}_{sum}`* :math:`>` -*GDD\ :math:`{}_{sum\_crit}`*, and daylength greater than 6 hrs. +:math:`{SWI}_{sum} > 15`, :math:`{GDD}_{sum} > {GDD}_{sum\_crit}`, and daylength greater than 6 hrs. The following control variables are set when a new onset growth period -is initiated: *SWI\ :math:`{}_{sum}`* = 0, *FD\ :math:`{}_{sum}`* = 0, -*GDD\ :math:`{}_{sum}`* = 0, *n\ :math:`{}_{days\_active}`* = 0, and -:math:`t_{onset} =86400\cdot n_{days\_ on}` , where -*n\ :math:`{}_{days\_on}`* is set to a constant value of 30 days. Fluxes -from storage into transfer pools occur in the timestep when a new onset -growth period is initiated, and are handled identically to Eqs. - for -carbon fluxes, and to Eqs. - for nitrogen fluxes. The onset counter is -decremented on each time step after initiation of the onset period, +is initiated: :math:`{SWI}_{sum} = 0`, :math:`{FD}_{sum} = 0`, :math:`{GDD}_{sum} = 0`, :math:`{n}_{days\_active} = 0`, and +:math:`t_{onset} = 86400\cdot n_{days\_ on}` , where :math:`{n}_{days\_on}` is set to a constant value of 30 days. Fluxes +from storage into transfer pools occur in the timestep when a new onset growth period is initiated, and are handled identically to Eqs. - for +carbon fluxes, and to Eqs. - for nitrogen fluxes. The onset counter is decremented on each time step after initiation of the onset period, until it reaches zero, signaling the end of the onset period: .. math:: + :label: 14.67) - \label{14.67)} t_{onfset}^{n} =t_{onfset}^{n-1} -\Delta t 14.4.2 Stress-Deciduous Offset Triggers @@ -646,44 +627,43 @@ period of dry soil, sustained period of cold temperature, or daylength shorter than 6 hours. Offset triggering due to dry soil or cold temperature conditions is only allowed once the most recent onset period is complete. Dry soil condition is evaluated with an offset soil water -index accumulator (*OSWI\ :math:`{}_{sum}`*, d). To test for a sustained +index accumulator (:math:`{OSWI}_{sum}`, d). To test for a sustained period of dry soils, this control variable can increase or decrease, as follows: .. math:: + :label: 14.68) - \label{14.68)} OSWI_{sum}^{n} =\left\{\begin{array}{l} {OSWI_{sum}^{n-1} +f_{day} \qquad \qquad \qquad {\rm for\; }\Psi _{s,3} \le \Psi _{offset} } \\ {{\rm max}\left(OSWI_{sum}^{n-1} -f_{day} ,0\right)\qquad {\rm for\; }\Psi _{s,3} >\Psi _{onset} } \end{array}\right. -where :math:`\Psi`\ *:math:`{}_{offset}`* = -2 MPa is the offset soil +where :math:`{\Psi}_{offset} = -2 MPa` is the offset soil water potential threshold. An offset period is triggered if the previous -onset period is complete and *OSWI\ :math:`{}_{sum}`* -:math:`\mathrm{\ge}` *OSWI\ :math:`{}_{sum\_crit}`*, where -*OSWI\ :math:`{}_{sum\_crit}`* = 15. +onset period is complete and :math:`{OSWI}_{sum}` +:math:`\mathrm{\ge}` :math:`{OSWI}_{sum\_crit}`, where :math:`{OSWI}_{sum\_crit} = 15`. The cold temperature trigger is calculated with an offset freezing day -accumulator (*OFD\ :math:`{}_{sum}`*, d). To test for a sustained period +accumulator (:math:`{OFD}_{sum}`, d). To test for a sustained period of cold temperature, this variable can increase or decrease, as follows: .. math:: + :label: 14.69) - \label{14.69)} OFD_{sum}^{n} =\left\{\begin{array}{l} {OFD_{sum}^{n-1} +f_{day} \qquad \qquad \qquad {\rm for\; }T_{s,3} \le TKFRZ} \\ {{\rm max}\left(OFD_{sum}^{n-1} -f_{day} ,0\right)\qquad \qquad {\rm for\; }T_{s,3} >TKFRZ} \end{array}\right. An offset period is triggered if the previous onset period is complete -and *OFD\ :math:`{}_{sum}`* :math:`>` *OFD\ :math:`{}_{sum\_crit}`*, -where *OFD\ :math:`{}_{sum\_crit}`* = 15. +and :math:`{OFD}_{sum} > {OFD}_{sum\_crit}`, +where :math:`{OFD}_{sum\_crit} = 15`. The offset counter is set at the initiation of the offset period: :math:`t_{offset} =86400\cdot n_{days\_ off}` , where -*n\ :math:`{}_{days\_off}`* is set to a constant value of 15 days. The +:math:`{n}_{days\_off}` is set to a constant value of 15 days. The offset counter is decremented on each time step after initiation of the offset period, until it reaches zero, signaling the end of the offset period: .. math:: + :label: 14.70) - \label{14.70)} t_{offset}^{n} =t_{offset}^{n-1} -\Delta t 14.4.3 Stress-Deciduous: Long Growing Season @@ -695,99 +675,94 @@ shifts toward the evergreen behavior. This can happen in cases where a stress-deciduous vegetation type is assigned in a climate where suitably strong stresses occur less frequently than once per year. This condition is evaluated by tracking the number of days since the beginning of the -most recent onset period (*n\ :math:`{}_{days\_active}`*, d). At the end -of an offset period *n\ :math:`{}_{days\_active}`* is reset to 0. A long +most recent onset period (:math:`{n}_{days\_active}`, d). At the end +of an offset period :math:`{n}_{days\_active}` is reset to 0. A long growing season control variable (*LGS*, range 0 to 1) is calculated as: .. math:: + :label: 14.71) - \label{14.71)} LGS=\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }n_{days\_ active} <365} \\ {\left({n_{days\_ active} \mathord{\left/ {\vphantom {n_{days\_ active} 365}} \right. \kern-\nulldelimiterspace} 365} \right)-1\qquad {\rm for\; }365\le n_{days\_ active} <730} \\ {1\qquad \qquad \qquad {\rm for\; }n_{days\_ active} \ge 730} \end{array}\right. . -The rate coefficient for background litterfall (*r\ :math:`{}_{bglf}`*, -s\ :math:`{}^{-1}`) is calculated as a function of *LGS*: +The rate coefficient for background litterfall (:math:`{r}_{bglf}`, s\ :sup:`-1`) is calculated as a function of *LGS*: .. math:: + :label: 14.72) - \label{14.72)} r_{bglf} =\frac{LGS}{\tau _{leaf} \cdot 365\cdot 86400} -where *:math:`\tau`\ :math:`{}_{leaf}`* is the leaf longevity. The -result is a shift to continuous litterfall as -*n\ :math:`{}_{days\_active}`* increases from 365 to 730. When a new -offset period is triggered *r\ :math:`{}_{bglf}`* is set to 0. +where :math:`{\tau}_{leaf}` is the leaf longevity. The result is a shift to continuous litterfall as +:math:`{n}_{days\_active}` increases from 365 to 730. When a new offset period is triggered :math:`{r}_{bglf}` is set to 0. -The rate coefficient for background onset growth from the transfer pools -(*r\ :math:`{}_{bgtr}`*, s\ :math:`{}^{-1}`) also depends on *LGS*, as: +The rate coefficient for background onset growth from the transfer pools ( :math:`{r}_{bgtr}`, s\ :sup:`-1`) also depends on *LGS*, as: .. math:: + :label: 14.73) - \label{14.73)} r_{bgtr} =\frac{LGS}{365\cdot 86400} . -On each timestep with *r\ :math:`{}_{bgtr}`* :math:`\neq` 0, carbon -fluxes from storage to transfer pools are calculated as: +On each timestep with :math:`{r}_{bgtr}` :math:`\neq` 0, carbon fluxes from storage to transfer pools are calculated as: .. math:: + :label: 14.74) - \label{14.74)} CF_{leaf\_ stor,leaf\_ xfer} =CS_{leaf\_ stor} r_{bgtr} .. math:: + :label: 14.75) - \label{14.75)} CF_{froot\_ stor,froot\_ xfer} =CS_{froot\_ stor} r_{bgtr} .. math:: + :label: 14.76) - \label{14.76)} CF_{livestem\_ stor,livestem\_ xfer} =CS_{livestem\_ stor} r_{bgtr} .. math:: + :label: 14.77) - \label{14.77)} CF_{deadstem\_ stor,deadstem\_ xfer} =CS_{deadstem\_ stor} r_{bgtr} .. math:: + :label: 14.78) - \label{14.78)} CF_{livecroot\_ stor,livecroot\_ xfer} =CS_{livecroot\_ stor} r_{bgtr} .. math:: + :label: 14.79) - \label{14.79)} CF_{deadcroot\_ stor,deadcroot\_ xfer} =CS_{deadcroot\_ stor} r_{bgtr} , with corresponding nitrogen fluxes: .. math:: + :label: 14.80) - \label{14.80)} NF_{leaf\_ stor,leaf\_ xfer} =NS_{leaf\_ stor} r_{bgtr} .. math:: + :label: 14.81) - \label{14.81)} NF_{froot\_ stor,froot\_ xfer} =NS_{froot\_ stor} r_{bgtr} .. math:: + :label: 14.82) - \label{14.82)} NF_{livestem\_ stor,livestem\_ xfer} =NS_{livestem\_ stor} r_{bgtr} .. math:: + :label: 14.83) - \label{14.83)} NF_{deadstem\_ stor,deadstem\_ xfer} =NS_{deadstem\_ stor} r_{bgtr} .. math:: + :label: 14.84) - \label{14.84)} NF_{livecroot\_ stor,livecroot\_ xfer} =NS_{livecroot\_ stor} r_{bgtr} .. math:: + :label: 14.85) - \label{14.85)} NF_{deadcroot\_ stor,deadcroot\_ xfer} =NS_{deadcroot\_ stor} r_{bgtr} . The result, in conjunction with the treatment of background onset @@ -795,7 +770,7 @@ growth, is a shift to continuous transfer from storage to display pools at a rate that would result in complete turnover of the storage pools in one year at steady state, once *LGS* reaches 1 (i.e. after two years without stress-deciduous offset conditions). If and when conditions -cause stress-deciduous triggering again, *r\ :math:`{}_{bgtr}`* is rest +cause stress-deciduous triggering again, :math:`{r}_{bgtr}` is rest to 0. Litterfall Fluxes Merged to the Column Level @@ -813,75 +788,74 @@ calculated using a weighted average of the fluxes originating at the PFT level. Carbon fluxes are calculated as: .. math:: + :label: 14.86) - \label{14.86)} CF_{leaf,lit1} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{lab\_ leaf,p} wcol_{p} .. math:: + :label: 14.87) - \label{14.87)} CF_{leaf,lit2} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{cel\_ leaf,p} wcol_{p} .. math:: + :label: 14.88) - \label{14.88)} CF_{leaf,lit3} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{lig\_ leaf,p} wcol_{p} .. math:: + :label: 14.89) - \label{14.89)} CF_{froot,lit1} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{lab\_ froot,p} wcol_{p} .. math:: + :label: 14.90) - \label{14.90)} CF_{froot,lit2} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{cel\_ froot,p} wcol_{p} .. math:: + :label: 14.91) - \label{14.91)} CF_{froot,lit3} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{lig\_ froot,p} wcol_{p} , -where *f\ :math:`{}_{lab\_leaf,p}`*, *f\ :math:`{}_{cel\_leaf,p}`*, and -*f\ :math:`{}_{lig\_leaf,p}`* are the labile, cellulose/hemicellulose, +where :math:`{f}_{lab\_leaf,p}`, :math:`{f}_{cel\_leaf,p}`, and +:math:`{f}_{lig\_leaf,p}` are the labile, cellulose/hemicellulose, and lignin fractions of leaf litter for PFT *p*, -*f\ :math:`{}_{lab\_froot,p}`*, *f\ :math:`{}_{cel\_froot,p}`*, and -*f\ :math:`{}_{lig\_froot,p}`* are the labile, cellulose/hemicellulose, +:math:`{f}_{lab\_froot,p}`, :math:`{f}_{cel\_froot,p}`, and +:math:`{f}_{lig\_froot,p}` are the labile, cellulose/hemicellulose, and lignin fractions of fine root litter for PFT *p*, -*wtcol\ :math:`{}_{p}`* is the weight relative to the column for PFT +:math:`{wtcol}_{p}` is the weight relative to the column for PFT *p*, and *p* is an index through the plant functional types occurring on a column. Nitrogen fluxes to the litter pools are assumed to follow the C:N of the senescent tissue, and so are distributed using the same fractions used for carbon fluxes: .. math:: + :label: 14.92) - \label{14.92)} NF_{leaf,lit1} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{lab\_ leaf,p} wcol_{p} .. math:: + :label: 14.93) - \label{14.93)} NF_{leaf,lit2} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{cel\_ leaf,p} wcol_{p} .. math:: + :label: 14.94) - \label{14.94)} NF_{leaf,lit3} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{lig\_ leaf,p} wcol_{p} .. math:: + :label: 14.95) - \label{14.95)} NF_{froot,lit1} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{lab\_ froot,p} wcol_{p} .. math:: + :label: 14.96) - \label{14.96)} NF_{froot,lit2} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{cel\_ froot,p} wcol_{p} .. math:: + :label: 14.97) - \label{14.97)} NF_{froot,lit3} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{lig\_ froot,p} wcol_{p} . -.. |image| image:: image1 diff --git a/doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst b/doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst index eefab609fb..89e12a7b94 100644 --- a/doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst +++ b/doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst @@ -3,16 +3,16 @@ Decomposition Decomposition of fresh litter material into progressively more recalcitrant forms of soil organic matter is represented in CLM is -defined as a cascade of *k\ :math:`{}_{tras}`* transformations between -*m\ :math:`{}_{pool}`* decomposing coarse woody debris (CWD), litter, +defined as a cascade of :math:`{k}_{tras}` transformations between +:math:`{m}_{pool}` decomposing coarse woody debris (CWD), litter, and soil organic matter (SOM) pools, each defined at -*n\ :math:`{}_{lev}`* vertical levels. CLM allows the user to define, at +:math:`{n}_{lev}` vertical levels. CLM allows the user to define, at compile time, between 2 contrasting hypotheses of decomposition as embodied by two separate decomposition submodels: the CLM-CN pool structure used in CLM4.0, or a second pool structure, characterized by slower decomposition rates, based on the Century model (Parton et al. 1988). In addition, the user can choose, at compile time, whether to -allow *n\ :math:`{}_{lev}`* to equal 1, as in CLM4.0, or to equal the +allow :math:`{n}_{lev}` to equal 1, as in CLM4.0, or to equal the number of soil levels used for the soil hydrology (default 10). Figure 15.1. Schematic of decomposition model in CLM. @@ -21,41 +21,40 @@ Model is structured to allow different representations of the soil C and N decomposition cascade, as well as a vertically-explicit treatment of soil biogeochemistry. -|image| +.. image:: image1.png For the single-level model structure, the fundamental equation for carbon balance of the decomposing pools is: .. math:: + :label: 15.1) - \label{15.1)} \frac{\partial C_{i} }{\partial t} =R_{i} +\sum _{j\ne i}\left(i-r_{j} \right)T_{ji} k_{j} C_{j} -k_{i} C_{i} -where *C\ :math:`{}_{i}`* is the carbon content of pool *i*, -*R\ :math:`{}_{i}`* are the carbon inputs from plant tissues directly to -pool *i* (only non-zero for CWD and litter pools), *k\ :math:`{}_{i}`* -is the decay constant of pool *i*; *T\ :math:`{}_{ji}`* is the fraction +where :math:`{C}_{i}` is the carbon content of pool *i*, +:math:`{R}_{i}` are the carbon inputs from plant tissues directly to +pool *i* (only non-zero for CWD and litter pools), :math:`{k}_{i}` +is the decay constant of pool *i*; :math:`{T}_{ji}` is the fraction of carbon directed from pool *j* to pool *i* with fraction -*r\ :math:`{}_{j}`* lost as a respiration flux along the way. +:math:`{r}_{j}` lost as a respiration flux along the way. Adding the vertical dimension to the decomposing pools changes the balance equation to the following: .. math:: + :label: 15.2) - \label{15.2)} \begin{array}{l} {\frac{\partial C_{i} (z)}{\partial t} =R_{i} (z)+\sum _{i\ne j}\left(1-r_{j} \right)T_{ji} k_{j} (z)C_{j} (z) -k_{i} (z)C_{i} (z)} \\ {+\frac{\partial }{\partial z} \left(D(z)\frac{\partial C_{i} }{\partial z} \right)+\frac{\partial }{\partial z} \left(A(z)C_{i} \right)} \end{array} -where *C\ :math:`{}_{i}`\ (z)* is now defined at each model level, and -in volumetric (gC m\ :math:`{}^{-3}`) rather than areal (gC -m\ :math:`{}^{-2}`) units, along with *R\ :math:`{}_{i}`\ (z)* and -*k\ :math:`{}_{j}`\ (z)*. In addition, vertical transport is handled by +where :math:`{C}_{i}`\ (z) is now defined at each model level, and +in volumetric (gC m\ :sup:`-3`) rather than areal (gC m\ :sup:`-2`) units, along with :math:`{R}_{i}`\ (z) and +:math:`{k}_{j}`\ (z). In addition, vertical transport is handled by the last two terms, for diffusive and advective transport. In the base model, advective transport is set to zero, leaving only a diffusive flux with diffusivity *D(z)* defined for all decomposing carbon and nitrogen pools. Further discussion of the vertical distribution of carbon inputs -*R\ :math:`{}_{i}`\ (z)*, vertical turnover times -*k\ :math:`{}_{j}`\ (z)*, and vertical transport *D(z)* is below. +:math:`{R}_{i}`\ (z), vertical turnover times +:math:`{k}_{j}`\ (z), and vertical transport *D(z)* is below. Discussion of the vertical model and analysis of both decomposition structures is in Koven et al (2013). @@ -63,7 +62,7 @@ Figure 15.2. Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 alternate soil decomposition models included in CLM. -|image| +.. image:: image2.png CLM-CN Pool Structure, Rate Constants and Parameters --------------------------------------------------------- @@ -100,52 +99,52 @@ for the CLM-CN decomposition pool structure. +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ | | Biome-BGC | CLM-CN | | | +==========================+================================================+===============================================+===============+=========================================+ -| | *k\ :math:`{}_{disc1 }`*\ (d:math:`{}^{-1}`) | *k\ :math:`{}_{disc2}`* (hr:math:`{}^{-1}`) | *C:N ratio* | *Acceleration term (a:math:`{}_{i}`)* | +| | :math:`{k}_{disc1}`\ (d\ :sup:`-1`) | :math:`{k}_{disc2}` (hr\ :sup:`-1`) | *C:N ratio* | Acceleration term (:math:`{a}_{i}`) | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| *k\ :math:`{}_{Lit1}`* | 0.7 | 0.04892 | - | 1 | +| :math:`{k}_{Lit1}` | 0.7 | 0.04892 | - | 1 | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| *k\ :math:`{}_{Lit2}`* | 0.07 | 0.00302 | - | 1 | +| :math:`{k}_{Lit2}` | 0.07 | 0.00302 | - | 1 | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| *k\ :math:`{}_{Lit3}`* | 0.014 | 0.00059 | - | 1 | +| :math:`{k}_{Lit3}` | 0.014 | 0.00059 | - | 1 | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| *k\ :math:`{}_{SOM1}`* | 0.07 | 0.00302 | 12 | 1 | +| :math:`{k}_{SOM1}` | 0.07 | 0.00302 | 12 | 1 | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| *k\ :math:`{}_{SOM2}`* | 0.014 | 0.00059 | 12 | 1 | +| :math:`{k}_{SOM2}` | 0.014 | 0.00059 | 12 | 1 | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| *k\ :math:`{}_{SOM3}`* | 0.0014 | 0.00006 | 10 | 5 | +| :math:`{k}_{SOM3}` | 0.0014 | 0.00006 | 10 | 5 | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| *k\ :math:`{}_{SOM4}`* | 0.0001 | 0.000004 | 10 | 70 | +| :math:`{k}_{SOM4}` | 0.0001 | 0.000004 | 10 | 70 | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| *k\ :math:`{}_{CWD}`* | 0.001 | 0.00004 | - | 1 | +| :math:`{k}_{CWD}` | 0.001 | 0.00004 | - | 1 | +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ The first column of Table 15.1 gives the rates as used for the Biome-BGC model, which uses a discrete-time model with a daily timestep. The second column of Table 15.1 shows the rates transformed for a one-hour discrete timestep typical of CLM-CN. The transformation is based on the -conversion of the initial discrete-time value (*k\ :math:`{}_{disc1}`*) -first to a continuous time value (*k\ :math:`{}_{cont}`*), then to the +conversion of the initial discrete-time value (:math:`{k}_{disc1}`) +first to a continuous time value (:math:`{k}_{cont}`), then to the new discrete-time value with a different timestep -(*k\ :math:`{}_{disc2}`*) , following Olson (1963): +(:math:`{k}_{disc2}`) , following Olson (1963): .. math:: + :label: ZEqnNum608251 - \label{ZEqnNum608251} k_{cont} =-\log \left(1-k_{disc1} \right) .. math:: + :label: ZEqnNum772630 - \label{ZEqnNum772630} k_{disc2} =1-\exp \left(-k_{cont} \frac{\Delta t_{2} }{\Delta t_{1} } \right) -where :math:`\Delta`\ *t\ :math:`{}_{1}`* (s) and -:math:`\Delta`\ *t\ :math:`{}_{2}`* (s) are the time steps of the +where :math:`\Delta`\ :math:`{t}_{1}` (s) and +:math:`\Delta`\ t\ :sub:`2` (s) are the time steps of the initial and new discrete-time models, respectively. Respiration fractions are parameterized for decomposition fluxes out of each litter and SOM pool. The respiration fraction (*rf*, unitless) is the fraction of the decomposition carbon flux leaving one of the litter -or SOM pools that is released as CO\ :math:`{}_{2}` due to heterotrophic +or SOM pools that is released as CO\ :sub:`2` due to heterotrophic respiration. Respiration fractions and exponential decay rates are estimated simultaneously from the results of microcosm decomposition experiments (Thornton, 1998). The same values are used in CLM-CN and @@ -156,24 +155,24 @@ Table 15.2. Respiration fractions for litter and SOM pools +---------------------------+-----------------------+ | Pool | *rf* | +===========================+=======================+ -| *rf\ :math:`{}_{Lit1}`* | 0.39 | +| :math:`{rf}_{Lit1}` | 0.39 | +---------------------------+-----------------------+ -| *rf\ :math:`{}_{Lit2}`* | 0.55 | +| :math:`{rf}_{Lit2}` | 0.55 | +---------------------------+-----------------------+ -| *rf\ :math:`{}_{Lit3}`* | 0.29 | +| :math:`{rf}_{Lit3}` | 0.29 | +---------------------------+-----------------------+ -| *rf\ :math:`{}_{SOM1}`* | 0.28 | +| :math:`{rf}_{SOM1}` | 0.28 | +---------------------------+-----------------------+ -| *rf\ :math:`{}_{SOM2}`* | 0.46 | +| :math:`{rf}_{SOM2}` | 0.46 | +---------------------------+-----------------------+ -| *rf\ :math:`{}_{SOM3}`* | 0.55 | +| :math:`{rf}_{SOM3}` | 0.55 | +---------------------------+-----------------------+ -| *rf\ :math:`{}_{SOM4}`* | 1.0\ :math:`{}^{a}` | +| :math:`{rf}_{SOM4}` | :math:`{1.0}^{a}` | +---------------------------+-----------------------+ -:math:`{}^{a}` The respiration fraction for pool SOM4 is 1.0 by +:sup:`a`:math:`{}^{a}` The respiration fraction for pool SOM4 is 1.0 by definition: since there is no pool downstream of SOM4, the entire carbon -flux leaving this pool is assumed to be respired as CO\ :math:`{}_{2}`. +flux leaving this pool is assumed to be respired as CO\ :sub:`2`. Century-based Pool Structure, Rate Constants and Parameters ---------------------------------------------------------------- @@ -190,7 +189,7 @@ section 15.8 for explanation) for the Century-based decomposition cascade. +------------+------------------------+-------------+-------------------------------------------+ -| | Turnover time (year) | C:N ratio | Acceleration term (*a\ :math:`{}_{i}`*) | +| | Turnover time (year) | C:N ratio | Acceleration term (:math:`{a}_{i}`) | +============+========================+=============+===========================================+ | CWD | 4.1 | - | 1 | +------------+------------------------+-------------+-------------------------------------------+ @@ -207,26 +206,24 @@ cascade. | SOM 3 | 270 | 11 | 675 | +------------+------------------------+-------------+-------------------------------------------+ -Likewise, values for the respiration fraction of Century-based structure -are in Table 15.4. +Likewise, values for the respiration fraction of Century-based structure are in Table 15.4. -Table 15.4. Respiration fractions for litter and SOM pools for -Century-based structure +Table 15.4. Respiration fractions for litter and SOM pools for Century-based structure +---------------------------+----------+ | Pool | *rf* | +===========================+==========+ -| *rf\ :math:`{}_{Lit1}`* | 0.55 | +| :math:`{rf}_{Lit1}` | 0.55 | +---------------------------+----------+ -| *rf\ :math:`{}_{Lit2}`* | 0.5 | +| :math:`{rf}_{Lit2}` | 0.5 | +---------------------------+----------+ -| *rf\ :math:`{}_{Lit3}`* | 0.5 | +| :math:`{rf}_{Lit3}` | 0.5 | +---------------------------+----------+ -| *rf\ :math:`{}_{SOM1}`* | f(txt) | +| :math:`{rf}_{SOM1}` | f(txt) | +---------------------------+----------+ -| *rf\ :math:`{}_{SOM2}`* | 0.55 | +| :math:`{rf}_{SOM2}` | 0.55 | +---------------------------+----------+ -| *rf\ :math:`{}_{SOM3}`* | 0.55 | +| :math:`{rf}_{SOM3}` | 0.55 | +---------------------------+----------+ Environmental modifiers on decomposition rate @@ -234,48 +231,46 @@ Environmental modifiers on decomposition rate These base rates are modified on each timestep by functions of the current soil environment. For the single-level model, there are two rate -modifiers, temperature (*r\ :math:`{}_{tsoil}`*, unitless) and moisture -(*r\ :math:`{}_{water}`*, unitless), both of which are calculated using +modifiers, temperature (:math:`{r}_{tsoil}`, unitless) and moisture +(:math:`{r}_{water}`, unitless), both of which are calculated using the average environmental conditions of the top five model levels (top 29 cm of soil column). For the vertically-resolved model, two additional environmental modifiers are calculated beyond the temperature and -moisture limitations: an oxygen scalar (*r\ :math:`{}_{oxygen}`*, -unitless), and a depth scalar (*r\ :math:`{}_{depth}`*, unitless). +moisture limitations: an oxygen scalar (:math:`{r}_{oxygen}`, +unitless), and a depth scalar (:math:`{r}_{depth}`, unitless). -The Temperature scalar *r\ :math:`{}_{tsoil}`* is calculated in CLM -using a *Q\ :math:`{}_{10}`* approach, with *Q\ :math:`{}_{10}`\ =1.5:* +The Temperature scalar :math:`{r}_{tsoil}` is calculated in CLM +using a :math:`{Q}_{10}` approach, with :math:`{Q}_{10} = 1.5`. .. math:: + :label: 15.5) - \label{15.5)} r_{tsoil} =Q_{10} ^{\left(\frac{T_{soil,\, j} -T_{ref} }{10} \right)} -where *j* is the soil layer index, *T\ :math:`{}_{soil,j}`* (K) is the -temperature of soil level *j*. The reference temperature -*T\ :math:`{}_{ref}`* = 25C. +where *j* is the soil layer index, :math:`{T}_{soil,j}` (K) is the +temperature of soil level *j*. The reference temperature :math:`{T}_{ref}` = 25C. -The rate scalar for soil water potential (*r\ :math:`{}_{water}`*, +The rate scalar for soil water potential (:math:`{r}_{water}`, unitless) is calculated using a relationship from Andrén and Paustian (1987) and supported by additional data in Orchard and Cook (1983): .. math:: + :label: 15.6) - \label{15.6)} r_{water} =\sum _{j=1}^{5}\left\{\begin{array}{l} {0\qquad {\rm for\; }\Psi _{j} <\Psi _{\min } } \\ {\frac{\log \left({\Psi _{\min } \mathord{\left/ {\vphantom {\Psi _{\min } \Psi _{j} }} \right. \kern-\nulldelimiterspace} \Psi _{j} } \right)}{\log \left({\Psi _{\min } \mathord{\left/ {\vphantom {\Psi _{\min } \Psi _{\max } }} \right. \kern-\nulldelimiterspace} \Psi _{\max } } \right)} w_{soil,\, j} \qquad {\rm for\; }\Psi _{\min } \le \Psi _{j} \le \Psi _{\max } } \\ {1\qquad {\rm for\; }\Psi _{j} >\Psi _{\max } \qquad \qquad } \end{array}\right\} -where :math:`\Psi`\ *:math:`{}_{j}`* is the soil water potential in -layer *j*, :math:`\Psi`\ *:math:`{}_{min}`* is a lower limit for soil +where :math:`{\Psi}_{j}` is the soil water potential in +layer *j*, :math:`{\Psi}_{min}` is a lower limit for soil water potential control on decomposition rate (set to -10 MPa). -:math:`\Psi`\ *:math:`{}_{sat,j}`* (MPa) is the saturated soil water -potential, calculated using the multivariate regression model from Cosby -et al. (1984): +:math:`{\Psi}_{sat,j}` (MPa) is the saturated soil water +potential, calculated using the multivariate regression model from Cosby et al. (1984): .. math:: + :label: 15.7) - \label{15.7)} \Psi _{sat,\, j} =-\left(9.8e-5\right)\exp \left(\left(1.54-0.0095P_{sand,\, j} +0.0063\left(100-P_{sand,\, j} -P_{clay,\, j} \right)\right)\log \left(10\right)\right) -where *P\ :math:`{}_{sand,j}`* and *P\ :math:`{}_{clay,j}`* are the +where :math:`{P}_{sand,j}` and :math:`{P}_{clay,j}` are the volume percentages of sand and clay in soil layer *j*. For frozen soils, the bulk of the rapid dropoff in decomposition with @@ -284,32 +279,32 @@ potential is limited by temperature in the supercooled water formulation of Niu and Yang (2006), .. math:: + :label: 15.8) - \label{15.8)} \psi \left(T\right)=-\frac{L_{f} \left(T-T_{f} \right)}{10^{3} T} An additional frozen decomposition limitation can be specified using a -‘frozen Q\ :math:`{}_{10}`’ following Koven et al. (2011), however the -default value of this is the same as the unfrozen Q\ :math:`{}_{10}` +‘frozen Q\ :sub:`10` following Koven et al. (2011), however the +default value of this is the same as the unfrozen Q\ :sub:`10` value, and therefore the basic hypothesis is that frozen respiration is limited by liquid water availability, and can be modeled following the same approach as thawed but dry soils. -An additional rate scalar, *r\ :math:`{}_{oxygen}`* is enabled when the -CH\ :math:`{}_{4}` submodel is used (set equal to 1 for the single layer -model or when the CH\ :math:`{}_{4}` submodel is disabled). This limits +An additional rate scalar, :math:`{r}_{oxygen}` is enabled when the +CH\ :sub:`4` submodel is used (set equal to 1 for the single layer +model or when the CH\ :sub:`4` submodel is disabled). This limits decomposition when there is insufficient molecular oxygen to satisfy -stoichiometric demand (1 mol O\ :math:`{}_{2}` consumed per mol -CO\ :math:`{}_{2}` produced) from heterotrophic decomposers, and supply +stoichiometric demand (1 mol O\ :sub:`2` consumed per mol +CO\ :sub:`2` produced) from heterotrophic decomposers, and supply from diffusion through soil layers (unsaturated and saturated) or -aerenchyma (Chapter 19). A minimum value of *r\ :math:`{}_{oxygen}`* is +aerenchyma (Chapter 19). A minimum value of :math:`{r}_{oxygen}` is set at 0.2, with the assumption that oxygen within organic tissues can supply the necessary stoichiometric demand at this rate. This value lies between estimates of 0.025–0.1 (Frolking et al. 2001), and 0.35 (Wania et al. 2009); the large range of these estimates poses a large unresolved uncertainty. -Lastly, a possible explicit depth dependence, *r\ :math:`{}_{depth}`*, +Lastly, a possible explicit depth dependence, :math:`{r}_{depth}`, (set equal to 1 for the single layer model) can be applied to soil C decomposition rates to account for processes other than temperature, moisture, and anoxia that can limit decomposition. This depth dependence @@ -322,19 +317,17 @@ includes these unresolved depth controls via an exponential decrease in the soil turnover time with depth: .. math:: + :label: 15.9) - \label{15.9)} r_{depth} =\exp \left(-\frac{z}{z_{\tau } } \right) -where *z\ :math:`{}_{\tau}`* is the e-folding depth for decomposition, -set by default to 0.5m. +where :math:`{z}_{\tau}` is the e-folding depth for decomposition, set by default to 0.5m. -The combined decomposition rate scalar (*r\ :math:`{}_{total}`*, -unitless) is: +The combined decomposition rate scalar (:math:`{r}_{total}`,unitless) is: .. math:: + :label: 15.10) - \label{15.10)} r_{total} =r_{tsoil} r_{water} r_{oxygen} r_{depth} . N-limitation of Decomposition Fluxes @@ -347,35 +340,34 @@ nitrogen supply. The general case is described here first, referring to a generic decomposition flux from an “upstream” pool (*u*) to a “downstream” pool (*d*), with an intervening loss due to respiration. The potential carbon flux out of the upstream pool -(*CF\ :math:`{}_{pot,u}`*, gC m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is: +(:math:`{CF}_{pot,u}`, gC m\ :sup:`-2` s\ :sup:`-1`) is: .. math:: + :label: 15.11) - \label{15.11)} CF_{pot,\, u} =CS_{u} k_{u} -where *CS\ :math:`{}_{u}`* (gC m\ :math:`{}^{-2}`) is the initial mass -in the upstream pool and *k\ :math:`{}_{u}`* is the decay rate constant -(s:math:`{}^{-1}`) for the upstream pool, adjusted for temperature and +where :math:`{CS}_{u}` (gC m\ :sup:`-2`) is the initial mass +in the upstream pool and :math:`{k}_{u}` is the decay rate constant +(s:sup:`-1`) for the upstream pool, adjusted for temperature and moisture conditions. Depending on the C:N ratios of the upstream and downstream pools and the amount of carbon lost in the transformation due to respiration (the respiration fraction), the execution of this potential carbon flux can generate either a source or a sink of new mineral nitrogen -(*NF\ :math:`{}_{pot\_min,u}`\ :math:`{}_{\rightarrow}`\ :math:`{}_{d}`*, -gN m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`). The governing equation +(:math:`{NF}_{pot\_min,u}`\ :math:`{}_{\rightarrow}`\ :math:`{}_{d}`, gN m\ :sup:`-2` s\ :sup:`-1`). The governing equation (Thornton and Rosenbloom, 2005) is: .. math:: + :label: 15.12) - \label{15.12)} NF_{pot\_ min,\, u\to d} =\frac{CF_{pot,\, u} \left(1-rf_{u} -\frac{CN_{d} }{CN_{u} } \right)}{CN_{d} } -where *rf\ :math:`{}_{u}`* is the respiration fraction for fluxes -leaving the upstream pool, *CN\ :math:`{}_{u}`* and *CN\ :math:`{}_{d}`* +where :math:`{rf}_{u}` is the respiration fraction for fluxes +leaving the upstream pool, :math:`{CN}_{u}` and :math:`{CN}_{d}` are the C:N ratios for upstream and downstream pools, respectively. Negative values of -*NF\ :math:`{}_{pot\_min,u}`\ :math:`{}_{\rightarrow}`\ :math:`{}_{d}`* +:math:`{NF}_{pot\_min,u}`\ :math:`{}_{\rightarrow}`\ :math:`{}_{d}` indicate that the decomposition flux results in a source of new mineral nitrogen, while positive values indicate that the potential decomposition flux results in a sink (demand) for mineral nitrogen. @@ -385,38 +377,38 @@ individual pools in the decomposition cascade, for the example of the CLM-CN pool structure, are given as: .. math:: + :label: 15.13) - \label{15.13)} CF_{pot,\, Lit1} ={CS_{Lit1} k_{Lit1} r_{total} \mathord{\left/ {\vphantom {CS_{Lit1} k_{Lit1} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 15.14) - \label{15.14)} CF_{pot,\, Lit2} ={CS_{Lit2} k_{Lit2} r_{total} \mathord{\left/ {\vphantom {CS_{Lit2} k_{Lit2} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 15.15) - \label{15.15)} CF_{pot,\, Lit3} ={CS_{Lit3} k_{Lit3} r_{total} \mathord{\left/ {\vphantom {CS_{Lit3} k_{Lit3} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 15.16) - \label{15.16)} CF_{pot,\, SOM1} ={CS_{SOM1} k_{SOM1} r_{total} \mathord{\left/ {\vphantom {CS_{SOM1} k_{SOM1} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 15.17) - \label{15.17)} CF_{pot,\, SOM2} ={CS_{SOM2} k_{SOM2} r_{total} \mathord{\left/ {\vphantom {CS_{SOM2} k_{SOM2} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 15.18) - \label{15.18)} CF_{pot,\, SOM3} ={CS_{SOM3} k_{SOM3} r_{total} \mathord{\left/ {\vphantom {CS_{SOM3} k_{SOM3} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: + :label: 15.19) - \label{15.19)} CF_{pot,\, SOM4} ={CS_{SOM4} k_{SOM4} r_{total} \mathord{\left/ {\vphantom {CS_{SOM4} k_{SOM4} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} where the factor (1/:math:`\Delta`\ *t*) is included because the rate @@ -427,43 +419,43 @@ again for the example of the CLM-CN pool structure (the CENTURY structure will be similar but without the different terminal step): .. math:: + :label: ZEqnNum934998 - \label{ZEqnNum934998} NF_{pot\_ min,\, Lit1\to SOM1} ={CF_{pot,\, Lit1} \left(1-rf_{Lit1} -\frac{CN_{SOM1} }{CN_{Lit1} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit1} \left(1-rf_{Lit1} -\frac{CN_{SOM1} }{CN_{Lit1} } \right) CN_{SOM1} }} \right. \kern-\nulldelimiterspace} CN_{SOM1} } .. math:: + :label: 15.21) - \label{15.21)} NF_{pot\_ min,\, Lit2\to SOM2} ={CF_{pot,\, Lit2} \left(1-rf_{Lit2} -\frac{CN_{SOM2} }{CN_{Lit2} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit2} \left(1-rf_{Lit2} -\frac{CN_{SOM2} }{CN_{Lit2} } \right) CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } .. math:: + :label: 15.22) - \label{15.22)} NF_{pot\_ min,\, Lit3\to SOM3} ={CF_{pot,\, Lit3} \left(1-rf_{Lit3} -\frac{CN_{SOM3} }{CN_{Lit3} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit3} \left(1-rf_{Lit3} -\frac{CN_{SOM3} }{CN_{Lit3} } \right) CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } .. math:: + :label: 15.23) - \label{15.23)} NF_{pot\_ min,\, SOM1\to SOM2} ={CF_{pot,\, SOM1} \left(1-rf_{SOM1} -\frac{CN_{SOM2} }{CN_{SOM1} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM1} \left(1-rf_{SOM1} -\frac{CN_{SOM2} }{CN_{SOM1} } \right) CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } .. math:: + :label: 15.24) - \label{15.24)} NF_{pot\_ min,\, SOM2\to SOM3} ={CF_{pot,\, SOM2} \left(1-rf_{SOM2} -\frac{CN_{SOM3} }{CN_{SOM2} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM2} \left(1-rf_{SOM2} -\frac{CN_{SOM3} }{CN_{SOM2} } \right) CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } .. math:: + :label: 15.25) - \label{15.25)} NF_{pot\_ min,\, SOM3\to SOM4} ={CF_{pot,\, SOM3} \left(1-rf_{SOM3} -\frac{CN_{SOM4} }{CN_{SOM3} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM3} \left(1-rf_{SOM3} -\frac{CN_{SOM4} }{CN_{SOM3} } \right) CN_{SOM4} }} \right. \kern-\nulldelimiterspace} CN_{SOM4} } .. math:: + :label: ZEqnNum473594 - \label{ZEqnNum473594} NF_{pot\_ min,\, SOM4} =-{CF_{pot,\, SOM4} \mathord{\left/ {\vphantom {CF_{pot,\, SOM4} CN_{SOM4} }} \right. \kern-\nulldelimiterspace} CN_{SOM4} } where the special form of Eq. arises because there is no SOM pool downstream of SOM4 in the converging cascade: all carbon fluxes leaving -that pool are assumed to be in the form of respired CO\ :math:`{}_{2}`, +that pool are assumed to be in the form of respired CO\ :sub:`2`, and all nitrogen fluxes leaving that pool are assumed to be sources of new mineral nitrogen. @@ -476,11 +468,9 @@ nitrogen, the total immobilization demand, and the total demand for soil mineral nitrogen to support new plant growth. The potential mineral nitrogen fluxes from Eqs. - are evaluated, summing all the positive fluxes to generate the total potential nitrogen immobilization flux -(*NF\ :math:`{}_{immob\_demand}`*, gN m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`), and summing absolute values of all the negative +(:math:`{NF}_{immob\_demand}`, gN m\ :sup:`-2` s\ :sup:`-1`), and summing absolute values of all the negative fluxes to generate the total nitrogen mineralization flux -(*NF\ :math:`{}_{gross\_nmin}`*, gN m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`). Since *NF\ :math:`{}_{griss\_nmin}`* is a source of +(:math:`{NF}_{gross\_nmin}`, gN m\ :sup:`-2` s\ :sup:`-1`). Since :math:`{NF}_{griss\_nmin}` is a source of new mineral nitrogen to the soil mineral nitrogen pool it is not limited by the availability of soil mineral nitrogen, and is therefore an actual as opposed to a potential flux. @@ -488,42 +478,39 @@ as opposed to a potential flux. N Competition between plant uptake and soil immobilization fluxes ---------------------------------------------------------------------- -Once *NF\ :math:`{}_{immob\_demand }`* is known, the competition between +Once :math:`{NF}_{immob\_demand }` is known, the competition between plant and microbial nitrogen demand can be resolved. Mineral nitrogen in -the soil pool (*NS\ :math:`{}_{sminn}`*, gN m\ :math:`{}^{-2}`) at the +the soil pool (:math:`{NS}_{sminn}`, gN m\ :sup:`-2`) at the beginning of the timestep is considered the available supply. Total -demand for mineral nitrogen from this pool -(*NF\ :math:`{}_{total\_demand}`*, gN m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`) is: +demand for mineral nitrogen from this pool (:math:`{NF}_{total\_demand}`, gN m\ :sup:`-2` s\ :sup:`-1`) is: .. math:: + :label: 15.27) - \label{15.27)} NF_{total\_ demand} =NF_{immob\_ demand} +NF_{plant\_ demand\_ soil} -If *NF\ :math:`{}_{total\_demand}`*\ :math:`\Delta`\ *t* :math:`<` -*NS\ :math:`{}_{sminn}`*, then the available pool is large enough to +If :math:`{NF}_{total\_demand}`\ :math:`\Delta`\ *t* :math:`<` +:math:`{NS}_{sminn}`, then the available pool is large enough to meet both plant and microbial demand, and neither plant growth nor immobilization steps in the decomposition cascade are limited by nitrogen availability in the timestep. In that case, the signaling -variables *f\ :math:`{}_{plant\_demand}`* and -*f\ :math:`{}_{immob\_demand}`* are both set to 1.0, where -*f\ :math:`{}_{plant\_demand}`* is defined and used in section 15.4, and -*f\ :math:`{}_{immob\_demand}`* is the fraction of potential -immobilization demand that can be met given current supply of mineral -nitrogen. - -If *NF\ :math:`{}_{total\_demand}`*\ :math:`\Delta`\ *t* -:math:`\mathrm{\ge}` *NS\ :math:`{}_{sminn}`*, then there is not enough +variables :math:`{f}_{plant\_demand}` and +:math:`{f}_{immob\_demand}` are both set to 1.0, where +:math:`{f}_{plant\_demand}` is defined and used in section 15.4, and +:math:`{f}_{immob\_demand}` is the fraction of potential +immobilization demand that can be met given current supply of mineral nitrogen. + +If :math:`{NF}_{total\_demand}`\ :math:`\Delta`\ *t* +:math:`\mathrm{\ge}` :math:`{NS}_{sminn}`, then there is not enough mineral nitrogen to meet the combined demands for plant growth and heterotrophic immobilization, and both of these processes proceed at lower-than-potential rates, defined by the fractions -*f\ :math:`{}_{plant\_demand}`* and *f\ :math:`{}_{immob\_demand}`*, +:math:`{f}_{plant\_demand}` and :math:`{f}_{immob\_demand}`, where: .. math:: + :label: 15.28) - \label{15.28)} f_{plant\_ demand} =f_{immob\_ demand} =\frac{NS_{sminn} }{\Delta t\, NF_{total\_ demand} } This treatment of competition for nitrogen as a limiting resource is @@ -536,116 +523,116 @@ fraction of the available resource. Final Decomposition Fluxes ------------------------------- -With *f\ :math:`{}_{immob\_demand}`* known, final decomposition fluxes +With :math:`{f}_{immob\_demand}` known, final decomposition fluxes can be calculated. Actual carbon fluxes leaving the individual litter and SOM pools, again for the example of the CLM-CN pool structure (the CENTURY structure will be similar but, again without the different terminal step), are calculated as: .. math:: + :label: 15.29) - \label{15.29)} CF_{Lit1} =\left\{\begin{array}{l} {CF_{pot,\, Lit1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} >0} \\ {CF_{pot,\, Lit1} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} \le 0} \end{array}\right\} .. math:: + :label: 15.30) - \label{15.30)} CF_{Lit2} =\left\{\begin{array}{l} {CF_{pot,\, Lit2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} >0} \\ {CF_{pot,\, Lit2} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} \le 0} \end{array}\right\} .. math:: + :label: 15.31) - \label{15.31)} CF_{Lit3} =\left\{\begin{array}{l} {CF_{pot,\, Lit3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} >0} \\ {CF_{pot,\, Lit3} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} \le 0} \end{array}\right\} .. math:: + :label: 15.32) - \label{15.32)} CF_{SOM1} =\left\{\begin{array}{l} {CF_{pot,\, SOM1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} >0} \\ {CF_{pot,\, SOM1} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} \le 0} \end{array}\right\} .. math:: + :label: 15.33) - \label{15.33)} CF_{SOM2} =\left\{\begin{array}{l} {CF_{pot,\, SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} >0} \\ {CF_{pot,\, SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} \le 0} \end{array}\right\} .. math:: + :label: 15.34) - \label{15.34)} CF_{SOM3} =\left\{\begin{array}{l} {CF_{pot,\, SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} >0} \\ {CF_{pot,\, SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} \le 0} \end{array}\right\} .. math:: + :label: 15.35) - \label{15.35)} CF_{SOM4} =CF_{pot,\, SOM4} Heterotrophic respiration fluxes (losses of carbon as -CO\ :math:`{}_{2}` to the atmosphere) are: +CO\ :sub:`2` to the atmosphere) are: .. math:: + :label: 15.36) - \label{15.36)} CF_{Lit1,\, HR} =CF_{Lit1} rf_{Lit1} .. math:: + :label: 15.37) - \label{15.37)} CF_{Lit2,\, HR} =CF_{Lit2} rf_{Lit2} .. math:: + :label: 15.38) - \label{15.38)} CF_{Lit3,\, HR} =CF_{Lit3} rf_{Lit3} .. math:: + :label: 15.39) - \label{15.39)} CF_{SOM1,\, HR} =CF_{SOM1} rf_{SOM1} .. math:: + :label: 15.40) - \label{15.40)} CF_{SOM2,\, HR} =CF_{SOM2} rf_{SOM2} .. math:: + :label: 15.41) - \label{15.41)} CF_{SOM3,\, HR} =CF_{SOM3} rf_{SOM3} .. math:: + :label: 15.42) - \label{15.42)} CF_{SOM4,\, HR} =CF_{SOM4} rf_{SOM4} Transfers of carbon from upstream to downstream pools in the decomposition cascade are given as: .. math:: + :label: 15.43) - \label{15.43)} CF_{Lit1,\, SOM1} =CF_{Lit1} \left(1-rf_{Lit1} \right) .. math:: + :label: 15.44) - \label{15.44)} CF_{Lit2,\, SOM2} =CF_{Lit2} \left(1-rf_{Lit2} \right) .. math:: + :label: 15.45) - \label{15.45)} CF_{Lit3,\, SOM3} =CF_{Lit3} \left(1-rf_{Lit3} \right) .. math:: + :label: 15.46) - \label{15.46)} CF_{SOM1,\, SOM2} =CF_{SOM1} \left(1-rf_{SOM1} \right) .. math:: + :label: 15.47) - \label{15.47)} CF_{SOM2,\, SOM3} =CF_{SOM2} \left(1-rf_{SOM2} \right) .. math:: + :label: 15.48) - \label{15.48)} CF_{SOM3,\, SOM4} =CF_{SOM3} \left(1-rf_{SOM3} \right) In accounting for the fluxes of nitrogen between pools in the @@ -658,33 +645,33 @@ or from the downstream pool to the soil mineral nitrogen pool pools in the decomposition cascade are given as: .. math:: + :label: 15.49) - \label{15.49)} NF_{Lit1,\, SOM1} ={CF_{Lit1} \mathord{\left/ {\vphantom {CF_{Lit1} CN_{Lit1} }} \right. \kern-\nulldelimiterspace} CN_{Lit1} } .. math:: + :label: 15.50) - \label{15.50)} NF_{Lit2,\, SOM2} ={CF_{Lit2} \mathord{\left/ {\vphantom {CF_{Lit2} CN_{Lit2} }} \right. \kern-\nulldelimiterspace} CN_{Lit2} } .. math:: + :label: 15.51) - \label{15.51)} NF_{Lit3,\, SOM3} ={CF_{Lit3} \mathord{\left/ {\vphantom {CF_{Lit3} CN_{Lit3} }} \right. \kern-\nulldelimiterspace} CN_{Lit3} } .. math:: + :label: 15.52) - \label{15.52)} NF_{SOM1,\, SOM2} ={CF_{SOM1} \mathord{\left/ {\vphantom {CF_{SOM1} CN_{SOM1} }} \right. \kern-\nulldelimiterspace} CN_{SOM1} } .. math:: + :label: 15.53) - \label{15.53)} NF_{SOM2,\, SOM3} ={CF_{SOM2} \mathord{\left/ {\vphantom {CF_{SOM2} CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } .. math:: + :label: 15.54) - \label{15.54)} NF_{SOM3,\, SOM4} ={CF_{SOM3} \mathord{\left/ {\vphantom {CF_{SOM3} CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } Corresponding fluxes to or from the soil mineral nitrogen pool depend on @@ -692,38 +679,38 @@ whether the decomposition step is an immobilization flux or a mineralization flux: .. math:: + :label: 15.55) - \label{15.55)} NF_{sminn,\, Lit1\to SOM1} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit1\to SOM1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} >0} \\ {NF_{pot\_ min,\, Lit1\to SOM1} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} \le 0} \end{array}\right\} .. math:: + :label: 15.56) - \label{15.56)} NF_{sminn,\, Lit2\to SOM2} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit2\to SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} >0} \\ {NF_{pot\_ min,\, Lit2\to SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} \le 0} \end{array}\right\} .. math:: + :label: 15.57) - \label{15.57)} NF_{sminn,\, Lit3\to SOM3} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit3\to SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} >0} \\ {NF_{pot\_ min,\, Lit3\to SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} \le 0} \end{array}\right\} .. math:: + :label: 15.58) - \label{15.58)} NF_{sminn,SOM1\to SOM2} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM1\to SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} >0} \\ {NF_{pot\_ min,\, SOM1\to SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} \le 0} \end{array}\right\} .. math:: + :label: 15.59) - \label{15.59)} NF_{sminn,SOM2\to SOM3} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM2\to SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} >0} \\ {NF_{pot\_ min,\, SOM2\to SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} \le 0} \end{array}\right\} .. math:: + :label: 15.60) - \label{15.60)} NF_{sminn,SOM3\to SOM4} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM3\to SOM4} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} >0} \\ {NF_{pot\_ min,\, SOM3\to SOM4} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} \le 0} \end{array}\right\} .. math:: + :label: 15.61) - \label{15.61)} NF_{sminn,\, SOM4} =NF_{pot\_ min,\, SOM4} Vertical Distribution and Transport of Decomposing C and N pools @@ -753,8 +740,8 @@ parameterization based on that of Koven et al. (2009) is used: the diffusivity parameter is constant through the active layer, and decreases linearly from the base of the active layer to zero at a set depth (default 3m); the default permafrost diffusivity is 5 -cm\ :math:`{}^{2}`/yr. For non-permafrost soils, the default diffusivity -is 1 cm\ :math:`{}^{2}`/yr. +cm\ :sup:`2`/yr. For non-permafrost soils, the default diffusivity +is 1 cm\ :sup:`2`/yr. Model Equilibration ------------------------ @@ -769,23 +756,23 @@ decomposition” (Thornton and Rosenbloom, 2005) is used. The fundamental idea of this approach is to allow fluxes between the various pools (both turnover-defined and vertically-defined fluxes) adjust rapidly, while keeping the pool sizes themselves small so that they can fill quickly. -To do this, the base decomposition rate *k\ :math:`{}_{i}`* for each -pool *i* is accelerated by a term *a\ :math:`{}_{i}`* such that the slow +To do this, the base decomposition rate :math:`{k}_{i}` for each +pool *i* is accelerated by a term :math:`{a}_{i}` such that the slow pools are collapsed onto an approximately annual timescale (Koven et al. 2013). Accelerating the pools beyond this timescale distorts the seasonal and/or diurnal cycles of decomposition and N mineralization, thus leading to a substantially different ecosystem productivity than the full model. For the vertical model, the vertical transport terms are -also accelerated by the same term *a\ :math:`{}_{i}`*, as is the +also accelerated by the same term :math:`{a}_{i}`, as is the radioactive decay when :math:`{}^{14}`\ C is enabled, following the same principle of keeping fluxes between pools (or fluxes lost to decay) close to the full model while keeping the pools sizes small. When leaving the accelerated decomposition mode, the concentration of C and N in pools that had been accelerated are multiplied by the same term -*a\ :math:`{}_{i}`*, to bring the model into approximate equilibrium. +:math:`{a}_{i}`, to bring the model into approximate equilibrium. Note that in CLM, the model can also transition into accelerated decomposition mode from the standard mode (by dividing the pools by -*a\ :math:`{}_{i}`*), and that the transitions into and out of +:math:`{a}_{i}`), and that the transitions into and out of accelerated decomposition mode are handled automatically by CLM upon loading from restart files (which preserve information about the mode of the model when restart files were written). @@ -793,5 +780,3 @@ the model when restart files were written). The acceleration terms for the two decomposition cascades are shown in Tables 15.1 and 15.3. -.. |image| image:: image1 -.. |image| image:: image2 diff --git a/doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst b/doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst index b6dd7a2b1a..07bb1567f9 100644 --- a/doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst +++ b/doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst @@ -1,7 +1,3 @@ -.. math:: 1 - -.. math:: 1 - External Nitrogen Cycle =========================== @@ -19,13 +15,12 @@ sinks in the external nitrogen cycle. CLM includes two separate treatments of the slow nitrogen cycle. The first is the original CLM-CN formulations, which includes a single soil mineral nitrogen pool to represent both -NO\ :math:`{}_{3}`\ :math:`{}^{-}` and -NH\ :math:`{}_{4}`\ :math:`{}^{+}`, and with nitrogen losses via +NO\ :sub:`3`\ :sup:`-` and NH\ :sub:`4`\ :sup:`+`, and with nitrogen losses via denitrification calculated as a constant fraction of mineralization plus a fixed first-order loss of unutilized mineral nitrogen at the end of every timestep. The second is based on the Century N-gas model; this -includes separate NH\ :math:`{}_{4}`\ :math:`{}^{+}` and -NO\ :math:`{}_{3}`\ :math:`{}^{-}`\ :math:`{}^{ }`\ pools, as well as +includes separate NH\ :sub:`4`\ :sup:`+` and +NO\ :sub:`3`\ :sup:`-` pools, as well as environmentally controlled nitrification and denitrification rates. Both are described below. @@ -34,42 +29,41 @@ Atmospheric Nitrogen Deposition CLM uses a single variable to represent the total deposition of mineral nitrogen onto the land surface, combining wet and dry deposition of -NO\ :math:`{}_{y}` and NH\ :math:`{}_{x}` as a single flux -(*NF\ :math:`{}_{ndep\_sminn}`*, gN m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`). This flux is intended to represent total reactive +NO\ :sub:`y` and NH\ :sub:`x` as a single flux +(:math:`{NF}_{ndep\_sminn}`, gN m\ :sup:`-2` s\ :sup:`-1`). This flux is intended to represent total reactive nitrogen deposited to the land surface which originates from the following natural and anthropogenic sources (Galloway et al. 2004): -formation of NO\ :math:`{}_{x}` during lightning, -NO\ :math:`{}_{x }`\ and NH\ :math:`{}_{3}` emission from wildfire, -NO\ :math:`{}_{x}` emission from natural soils, NH\ :math:`{}_{3}` +formation of NO\ :sub:`x` during lightning, +NO\ :math:`{}_{x }`\ and NH\ :sub:`3` emission from wildfire, +NO\ :sub:`x` emission from natural soils, NH\ :sub:`3` emission from natural soils, vegetation, and wild animals, -NO\ :math:`{}_{x}` and NH\ :math:`{}_{3}` emission during fossil fuel -combustion (both thermal and fuel NO\ :math:`{}_{x}` production), -NO\ :math:`{}_{x}` and NH\ :math:`{}_{3}` emission from other industrial -processes, NO\ :math:`{}_{x}` and NH\ :math:`{}_{3}` emission from fire -associated with deforestation, NO\ :math:`{}_{x}` and NH\ :math:`{}_{3}` -emission from agricultural burning, NO\ :math:`{}_{x}` emission from -agricultural soils, NH\ :math:`{}_{3}` emission from agricultural crops, -NH\ :math:`{}_{3}` emission from agricultural animal waste, and -NH\ :math:`{}_{3}` emission from human waste and waste water. The +NO\ :sub:`x` and NH\ :sub:`3` emission during fossil fuel +combustion (both thermal and fuel NO\ :sub:`x` production), +NO\ :sub:`x` and NH\ :sub:`3` emission from other industrial +processes, NO\ :sub:`x` and NH\ :sub:`3` emission from fire +associated with deforestation, NO\ :sub:`x` and NH\ :sub:`3` +emission from agricultural burning, NO\ :sub:`x` emission from +agricultural soils, NH\ :sub:`3` emission from agricultural crops, +NH\ :sub:`3` emission from agricultural animal waste, and +NH\ :sub:`3` emission from human waste and waste water. The deposition flux is provided as a spatially and (potentially) temporally varying dataset (see section 2.2.3 for a description of the default input dataset). In the CLM-CN mineral N pool model, the nitrogen deposition flux is assumed to enter the soil mineral nitrogen pool -(*NS\ :math:`{}_{sminn}`*) directly; while in the Century-based model, +(:math:`{NS}_{sminn}`) directly; while in the Century-based model, all of the nitrogen is assumed to enter the -NH\ :math:`{}_{4}`\ :math:`{}^{+}` pool. Real pathways for wet and dry +NH\ :sub:`4`\ :sup:`+` pool. Real pathways for wet and dry nitrogen deposition can be more complex than currently represented in the CLM-CN, including release from melting snowpack and direct foliar -uptake of deposited NO\ :math:`{}_{y}` (e.g. Tye et al. 2005; Vallano +uptake of deposited NO\ :sub:`y` (e.g. Tye et al. 2005; Vallano and Sparks, 2007). Biological Nitrogen Fixation --------------------------------- -The fixation of new reactive nitrogen from atmospheric N\ :math:`{}_{2}` +The fixation of new reactive nitrogen from atmospheric N\ :sub:`2` by soil microorganisms is an important component of both preindustrial and modern-day nitrogen budgets, but a mechanistic understanding of global-scale controls on biological nitrogen fixation (BNF) is still @@ -77,8 +71,7 @@ only poorly developed (Cleveland et al. 1999; Galloway et al. 2004). Cleveland et al. (1999) suggested empirical relationships that predict BNF as a function of either evapotranspiration rate or net primary productivity for natural vegetation. CLM assumes that BNF is a function -of net primary production (*CF\ :math:`{}_{ann\_NPP}`*, gC -m\ :math:`{}^{-2}` y\ :math:`{}^{-1}`). The rationale for choosing net +of net primary production (:math:`{CF}_{ann\_NPP}`, gC m\ :sup:`-2` y\ :sup:`-1`). The rationale for choosing net primary production over evapotranspiration as the predictor is that the two are well-correlated (Parton et al. 1993; Running et al. 1989), and the use of primary production also introduces a known dependence of BNF @@ -86,18 +79,17 @@ on the carbon supply to nitrogen fixing microorganisms (Cleveland et al. 1999). The expression used is: .. math:: + :label: ZEqnNum802819: - \label{ZEqnNum802819} NF_{nfix,sminn} ={1.8\left(1-\exp \left(-0.003{\kern 1pt} CF_{ann\_ NPP} \right)\right)\mathord{\left/ {\vphantom {1.8\left(1-\exp \left(-0.003{\kern 1pt} CF_{ann\_ NPP} \right)\right) \left(86400\cdot 365\right)}} \right. \kern-\nulldelimiterspace} \left(86400\cdot 365\right)} -where *NF\ :math:`{}_{nfix,sminn}`* (gN m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`) is the rate of BNF. Eq. is plotted over a range of +where :math:`{NF}_{nfix,sminn}` (gN m\ :sup:`-2` s\ :sup:`-1`) is the rate of BNF. Eq. is plotted over a range of annual NPP in Figure 16.1. Figure 16.1. Biological nitrogen fixation as a function of annual net primary production. -|image| +.. image:: image1.png Because of the empirical nature of this NPP-BNF relationship, the timescale for calculating NPP and thus BNF is unconstrained. Using @@ -111,7 +103,7 @@ and BNF calculated from that using equation 16.1. As with Atmospheric N deposition, BNF N inputs are added directly to the mineral N pools. In the CLM-CN N model, this is the single mineral N pool; in the Century-based model, this is the -NH\ :math:`{}_{4}`\ :math:`{}^{+}` pool. +NH\ :sub:`4`\ :sup:`+` pool. Nitrification and Denitrification Losses of Nitrogen --------------------------------------------------------- @@ -129,8 +121,8 @@ acceptor supporting the metabolism of heterotrophs, but anaerobic conditions favor the activity of soil heterotrophs which use nitrate as an electron acceptor (e.g. *Pseudomonas* and *Clostridium*) supporting respiration. This process, known as denitrification, results in the -transformation of nitrate to gaseous N\ :math:`{}_{2}`, with smaller -associated production of NO\ :math:`{}_{x}` and N\ :math:`{}_{2}`\ O. It +transformation of nitrate to gaseous N\ :sub:`2`, with smaller +associated production of NO\ :sub:`x` and N\ :sub:`2`\ O. It is typically assumed that nitrogen fixation and denitrification were approximately balanced in the preindustrial biosphere (Galloway et al. 2004). It is likely that denitrification can occur within anaerobic @@ -155,46 +147,46 @@ Denitrification fluxes associated with gross mineralization in the decomposition cascade are calculated as follows: .. math:: + :label: 16.2) - \label{16.2)} NF_{denit,Lit1\to SOM1} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit1\to SOM1} >0} \\ {-NF_{pot\_ min,Lit1\to SOM1} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit1\to SOM1} \le 0} \end{array}\right. .. math:: + :label: 16.3) - \label{16.3)} NF_{denit,Lit2\to SOM2} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit2\to SOM2} >0} \\ {-NF_{pot\_ min,Lit2\to SOM2} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit2\to SOM2} \le 0} \end{array}\right. .. math:: + :label: 16.4) - \label{16.4)} NF_{denit,Lit3\to SOM3} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit3\to SOM3} >0} \\ {-NF_{pot\_ min,Lit3\to SOM3} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit3\to SOM3} \le 0} \end{array}\right. .. math:: + :label: 16.5) - \label{16.5)} NF_{denit,SOM1\to SOM2} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM1\to SOM2} >0} \\ {-NF_{pot\_ min,SOM1\to SOM2} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM1\to SOM2} \le 0} \end{array}\right. .. math:: + :label: 16.6) - \label{16.6)} NF_{denit,SOM2\to SOM3} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM2\to SOM3} >0} \\ {-NF_{pot\_ min,SOM2\to SOM3} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM2\to SOM3} \le 0} \end{array}\right. .. math:: + :label: 16.7) - \label{16.7)} NF_{denit,SOM3\to SOM4} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM3\to SOM4} >0} \\ {-NF_{pot\_ min,SOM3\to SOM4} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM3\to SOM4} \le 0} \end{array}\right. .. math:: + :label: 16.8) - \label{16.8)} NF_{denit,SOM4} =-NF_{pot\_ min,SOM4} -where *f\ :math:`{}_{denit}`* = 0.01 is the constant denitrification +where :math:`{f}_{denit} = 0.01` is the constant denitrification fraction of gross mineralization, and the denitrification fluxes are assumed to be leaving the soil mineral nitrogen pool -(*NS\ :math:`{}_{sminn}`*) and entering the atmosphere. The speciation +(:math:`{NS}_{sminn}`) and entering the atmosphere. The speciation of gaseous nitrogen fluxes entering the atmosphere (e.g. -N\ :math:`{}_{2}` vs. NO\ :math:`{}_{x}` or N\ :math:`{}_{2}`\ O) is not +N\ :sub:`2` vs. NO\ :sub:`x` or N\ :sub:`2`\ O) is not specified. Providing an explicit speciation of these nitrogen losses is another high-priority area for future model development. @@ -220,18 +212,18 @@ pool. The denitrification of excess soil mineral nitrogen is non-zero whenever the supply of mineral nitrogen exceeds the demand: .. math:: + :label: 16.9) - \label{16.9)} NF_{sminn,denit} =\left\{\begin{array}{l} {\left(\frac{NS_{sminn} }{\Delta t} \right)-NF_{total\_ demand} f_{dnx} \qquad {\rm for\; }NF_{total\_ demand} \Delta tB_{up} } \end{array} -where :math:`B_{ag}` (g C m\ :math:`{}^{--2}`) is the aboveground +where :math:`B_{ag}` (g C m\ :sup:`-2`) is the aboveground biomass of combined leaf, stem and aboveground litter (leaf litter and -woody debris) pools; :math:`B_{low}` \ =155 g C m\ :math:`{}^{--2 }`\ is +woody debris) pools; :math:`B_{low}` \ =155 g C m\ :sup:`-2` is the lower fuel threshold below which fire does not occur; -:math:`B_{up}` \ = 1050 g C m\ :math:`{}^{--2}` is the upper fuel +:math:`B_{up}` \ = 1050 g C m\ :sup:`-2` is the upper fuel threshold above which fire occurrence is not limited by fuel -availability. **** +availability. -Fuel combustibility :math:`f_{m}` is estimated by +Fuel combustibility :math:`f_{m}` is estimated by .. math:: + :label: 18.7) - \label{18.7)} f_{m} =f_{RH} f_{\theta } f_{T} -where\ :math:`f_{RH}` , **:math:`f_{\theta }` **, :math:`f_{T}` +where :math:`f_{RH}`, :math:`f_{\theta }`, :math:`f_{T}` represent the dependence of fuel combustibility on relative humidity *RH* (%), surface soil wetness :math:`\theta` , and surface air -temperature *T* (ºC), respectively.\ :math:`f_{RH}` is calculated by +temperature *T* (ºC), respectively. :math:`f_{RH}` is calculated by .. math:: + :label: 18.8) - \label{18.8)} f_{RH} =\left\{\begin{array}{cccc} {1} & {} & {} & {RH\le RH_{low} } \\ {\frac{RH_{up} -RH}{RH_{up} -RH_{low} } ,} & {} & {} & {RH_{low} 0.1` person km\ :math:`{}^{-2}`, we parameterize the +:math:`D_{p} >0.1` person km\ :sup:`-2`, we parameterize the fraction of anthropogenic and natural fires unsuppressed by human activities as .. math:: + :label: 18.10) - \label{18.10)} f_{se,o} =f_{d} f_{e} -where *f\ :math:`{}_{d}`* and *:math:`{}_{ }`\ f\ :math:`{}_{e}`* are +where :math:`{f}_{d}` and :math:`{f}_{e}` are the effects of the demographic and economic conditions on fire occurrence. The demographic influence on fire occurrence is .. math:: + :label: 18.11) - \label{18.11)} f_{d} =0.01+0.98\exp (-0.025D_{P} ). For shrub and grass PFTs, the economic influence on fire occurrence is parameterized as a function of Gross Domestic Product GDP (k 1995US$ -capita\ :math:`{}^{-1}`): +capita\ :sup:`-1`): .. math:: + :label: 18.12) - \label{18.12)} f_{e} =0.1+0.9\times \exp [-\pi (\frac{GDP}{8} )^{0.5} ] which captures 73% of the observed MODIS fire counts with variable GDP @@ -175,17 +166,17 @@ in regions where shrub and grass PFTs are dominant (fractional coverage of shrub and grass PFTs :math:`>` 50%). In regions outside tropical closed forests and dominated by trees (fractional coverage of tree PFTs :math:`>` 50%), we divide the MODIS fire counts into only two bins -(:math:`GDP\ge 20` k 1995US$ capita\ :math:`{}^{-1}`, and :math:`GDP<20` -k 1995US$ capita\ :math:`{}^{-1}`) and parameterize the economic +(:math:`GDP\ge 20` k 1995US$ capita\ :sup:`-1`, and :math:`GDP<20` +k 1995US$ capita\ :sup:`-1`) and parameterize the economic influence on fire occurrence for tree PFTs as .. math:: + :label: 18.13) - \label{18.13)} f_{e} =\left\{\begin{array}{cc} {0.39,} & {GDP\ge 20} \\ {1} & {GDP<20} \end{array}\right. to reproduce that the MODIS fire counts in tree-dominated regions of -GDP\ :math:`\ge 20` k 1995US$ capita\ :math:`{}^{-1}` is 39% of that in +GDP\ :math:`\ge 20` k 1995US$ capita\ :sup:`-1` is 39% of that in other **** tree-dominated regions. 18.1.2 Average spread area of a fire @@ -197,8 +188,8 @@ socioeconomic impact on the average burned area rather than separately on fire spread rate and fire duration: .. math:: + :label: 18.14) - \label{18.14)} a=a^{*} F_{se} where :math:`a^{*}` is the average burned area of a fire without @@ -212,47 +203,45 @@ formula for an ellipse, average burned area of a fire can be represented as: .. math:: + :label: 18.15) - \label{18.15)} a^{*} =\pi \frac{l}{2} \frac{w}{2} \times 10^{-6} =\frac{\pi u_{p}^{2} \tau ^{2} }{4L_{B} } (1+\frac{1}{H_{B} } )^{2} \times 10^{-6} -where :math:`u_{p}` \ (m s\ :math:`{}^{--1}`) is the fire spread rate in +where :math:`u_{p}` \ (m s\ :sup:`-1`) is the fire spread rate in the downwind direction; :math:`\tau` \ (s) is average fire duration;\ :math:`L_{B}` and :math:`H_{B}` are length-to-breadth ratio -and head-to-back ratio of the ellipse; 10\ :math:`{}^{-6 }`\ converts -m\ :math:`{}^{2}` to km\ :math:`{}^{2}`. +and head-to-back ratio of the ellipse; 10\ :sup:`-6` converts m\ :sup:`2` to km\ :sup:`2`. According to Arora and Boer (2005), .. math:: + :label: ZEqnNum696342 - \label{ZEqnNum696342} L_{B} =1.0+10.0[1-\exp (-0.06W)] -where :math:`W`\ (m s\ :math:`{}^{--1}`) is the wind speed. According to +where :math:`W`\ (m s\ :sup:`-1`) is the wind speed. According to the mathematical properties of the ellipse, the head-to-back ratio :math:`H_{B}` is .. math:: + :label: ZEqnNum179757 - \label{ZEqnNum179757} H_{B} =\frac{u_{p} }{u_{b} } =\frac{L_{B} +(L_{B} ^{2} -1)^{0.5} }{L_{B} -(L_{B} ^{2} -1)^{0.5} } . The fire spread rate in the downwind direction is represented as .. math:: + :label: 18.18) - \label{18.18)} u_{p} =u_{\max } C_{m} g(W) (Arora and Boer, 2005), where :math:`u_{\max }` (m -s\ :math:`{}^{--1}`) is the PFT-dependent average maximum fire spread +s\ :sup:`-1`) is the PFT-dependent average maximum fire spread rate in natural vegetation regions; :math:`C_{m}` and :math:`g(W)` represent the dependence of :math:`u_{p}` on fuel wetness and wind speed :math:`W`, respectively. :math:`u_{\max }` is set to 0.55 m -s\ :math:`{}^{--1 }`\ for grass PFTs, 0.46 m s\ :math:`{}^{--1}` for -shrub PFTs, 0.43 m s\ :math:`{}^{--1}` for\ :math:`{}^{ }`\ needleleaf -tree PFTs, and 0.40 m s\ :math:`{}^{--1}` for other tree PFTs. +s\ :sup:`-1`\ for grass PFTs, 0.46 m s\ :sup:`-1` for +shrub PFTs, 0.43 m s\ :sup:`-1` for needleleaf tree PFTs, and 0.40 m s\ :sup:`-1` for other tree PFTs. :math:`C_{m} =C_{\beta } C_{RH}` is estimated by the dependence of :math:`u_{p}` \ on root zone soil wetness (:math:`C_{\beta }` ) and relative humidity (:math:`C_{RH}` ). Here,\ :math:`\beta` is a root @@ -264,8 +253,8 @@ and upper thresholds of root zone soil wetness, respectively. derived from the mathematical properties of the ellipse and Eqs and .. math:: + :label: 18.19) - \label{18.19)} g(W)=\frac{2L_{B} }{1+\frac{1}{H_{B} } } g(0). Since g(\ *W*)=1.0, and\ :math:`L_{B}` and :math:`H_{B}` are at their @@ -273,8 +262,8 @@ maxima\ :math:`L_{B} ^{\max } =11.0`\ and :math:`H_{B} ^{\max } =482.0` when :math:`W\to \infty` , g(0) can be derived as .. math:: + :label: 18.20) - \label{18.20)} g(0)=\frac{1+\frac{1}{H_{B} ^{\max } } }{2L_{B} ^{\max } } =0.05. In the absence of globally gridded data on barriers to fire (e.g. @@ -285,16 +274,16 @@ average fire duration is simply assumed equal to 1 which is the observed As with the socioeconomic influence on fire occurrence, we assume that the socioeconomic influence on fire spreading is negligible in regions -of\ :math:`D_{p} \le 0.1` person km\ :math:`{}^{-2}`, i.e., +of\ :math:`D_{p} \le 0.1` person km\ :sup:`-2`, i.e., :math:`F_{se} =1.0`. In regions of :math:`D_{p} >0.1` person -km\ :math:`{}^{-2}`, we parameterize such socioeconomic influence as: +km\ :sup:`-2`, we parameterize such socioeconomic influence as: .. math:: + :label: 18.21) - \label{18.21)} F_{se} =F_{d} F_{e} -where *F\ :math:`{}_{d}`* and\ *:math:`{}_{ }`\ F\ :math:`{}_{e}`* are +where :math:`{F}_{d}` and :math:`{F}_{e}` are effects of the demographic and economic conditions on the average spread area of a fire, and are identified by maximizing the explained variability of the GFED3 burned area fraction with both socioeconomic @@ -302,30 +291,30 @@ indices in grid cells with various dominant vegetation types. For shrub and grass PFTs, the demographic impact factor is .. math:: + :label: ZEqnNum900584 - \label{ZEqnNum900584} F_{d} =0.2+0.8\times \exp [-\pi (\frac{D_{p} }{450} )^{0.5} ] and the economic impact factor is .. math:: + :label: ZEqnNum213480 - \label{ZEqnNum213480} F_{e} =0.2+0.8\times \exp (-\pi \frac{GDP}{7} ). For tree PFTs outside tropical closed forests, the demographic and economic impact factors are given as .. math:: + :label: 18.24) - \label{18.24)} F_{d} =0.4+0.6\times \exp (-\pi \frac{D_{p} }{125} ) and .. math:: + :label: ZEqnNum543524 - \label{ZEqnNum543524} F_{e} =\left\{\begin{array}{cc} {0.62,} & {GDP>20} \\ {0.83,} & {8`\ *T\ :math:`{}_{f}`* if no agricultural fires occurred -earlier in the year; *f\ :math:`{}_{t}`* is set to 0 otherwise. Peak +*T*\ :math:`>`\ :math:`{T}_{f}` if no agricultural fires occurred +earlier in the year; :math:`{f}_{t}` is set to 0 otherwise. Peak month in this dataset correlates with the month after harvesting or the month before planting. In CLM we use this dataset the same way whether the CROP option is active or not, without regard to the CROP option’s @@ -473,59 +451,59 @@ these grid cells. Burned area is controlled by the deforestation rate and climate: .. math:: + :label: 18.34) - \label{18.34)} A_{b} =bf_{lu} f_{cli,d} A_{g} -where *b* (time step)\ :math:`{}^{-1 }`\ is a global constant; +where *b* (time step)\ :sup:`-1` is a global constant; :math:`f_{lu}` (fraction) represents the effect of decreasing fractional coverage of tree PFTs derived from land use data; and :math:`f_{cli,d}` (fraction) represents the effect of climate conditions on the burned area. -Constants *b* and\ :math:`{}^{ }`\ :math:`{}^{f_{lu} }` are calibrated +Constants *b* and :math:`{f}_{lu}` are calibrated based on observations and reanalysis datasets in the Amazon rainforest -(tropical closed forests within 15.5ºS\ :math:`\mathrm{-}`\ 10.5ºN, -30.5ºW\ :math:`\mathrm{-}`\ 91ºW). *b=*\ 0.035 d\ :math:`{}^{-1}` and +(tropical closed forests within 15.5ºS\ :math:`\text{-}`\ 10.5ºN, +30.5ºW\ :math:`\text{-}`\ 91ºW). *b=*\ 0.035 d\ :sup:`-1` and :math:`f_{lu}` is defined as .. math:: + :label: 18.35) - \label{18.35)} f_{lu} =\max (0.0005,0.19D-0.0011) -where :math:`D`\ (yr:math:`{}^{-1}`) is the annual loss of tree cover +where :math:`D`\ (yr:sup:`-1`) is the annual loss of tree cover based on CLM4’s land use and land cover change data. The effect of climate on deforestation fires is parameterized as: .. math:: + :label: ZEqnNum336915 - \label{ZEqnNum336915} \begin{array}{l} {f_{cli,d} =\max [0,\min (1,\frac{b_{2} -P_{60d} }{b_{2} } )]^{0.5} \max [0,\min (1,\frac{b_{3} -P_{10d} }{b_{3} } )]^{0.5} } \\ {\qquad \max [0,\min (1,\frac{0.25-P}{0.25} )]} \end{array} -where\ :math:`P`\ (mm d\ :math:`{}^{-1}`) is instantaneous -precipitation, while :math:`P_{60d}` (mm d\ :math:`{}^{-1}`) and -:math:`P_{10d}` (mm d\ :math:`{}^{-1}`) are 60-day and 10-day running +where\ :math:`P`\ (mm d\ :sup:`-1`) is instantaneous +precipitation, while :math:`P_{60d}` (mm d\ :sup:`-1`) and +:math:`P_{10d}` (mm d\ :sup:`-1`) are 60-day and 10-day running means of precipitation, respectively; :math:`b_{2}` (mm -d\ :math:`{}^{-1}`) and :math:`b_{3}` (mm d\ :math:`{}^{-1}`) are the +d\ :sup:`-1`) and :math:`b_{3}` (mm d\ :sup:`-1`) are the grid-cell dependent thresholds of :math:`P_{60d}` and :math:`P_{10d}` ; -0.25 mm d\ :math:`{}^{-1}` is the maximum precipitation rate for +0.25 mm d\ :sup:`-1` is the maximum precipitation rate for drizzle. Le Page et al. (2010) analyzed the relationship between large-scale deforestation fire counts and precipitation during -2003\ :math:`\mathrm{-}`\ 2006 in southern Amazonia where tropical +2003\ :math:`\text{-}`\ 2006 in southern Amazonia where tropical evergreen trees (BET Tropical) are dominant. Figure 2 in Le Page et al. (2010) showed that fires generally occurred if both :math:`P_{60d}` and -:math:`P_{10d}` were less than about 4.0 mm d\ :math:`{}^{-1}`, and +:math:`P_{10d}` were less than about 4.0 mm d\ :sup:`-1`, and fires occurred more frequently in a drier environment. Based on the -30-yr (1985:math:`\mathrm{-}`\ 2004) precipitation data in Qian et al. +30-yr (1985:math:`\text{-}`\ 2004) precipitation data in Qian et al. (2006), the climatological precipitation of dry months (P:math:`<`\ 4.0 -mm d\ :math:`{}^{-1}`) in a year over tropical deciduous tree (BDT +mm d\ :sup:`-1`) in a year over tropical deciduous tree (BDT Tropical) dominated regions is 46% of that over BET Tropical dominated regions, so we set the PFT-dependent thresholds of :math:`P_{60d}` and -:math:`P_{10d}` as 4.0 mm d\ :math:`{}^{-1}` for BET Tropical and 1.8 -mm d\ :math:`{}^{-1}` (= 4.0 mm d\ :math:`{}^{-1}` :math:`\times` 46%) -for BDT Tropical, and *b\ :math:`{}_{2}`* and *b\ :math:`{}_{3}`* are +:math:`P_{10d}` as 4.0 mm d\ :sup:`-1` for BET Tropical and 1.8 +mm d\ :sup:`-1` (= 4.0 mm d\ :sup:`-1` :math:`\times` 46%) +for BDT Tropical, and *b*\ :sub:`2` and *b*\ :sub:`3` are the average of thresholds of BET Tropical and BDT Tropical weighted by their coverage. @@ -536,7 +514,7 @@ to the fraction of conversion flux for tropical trees in the tree-reduced region (60%) assigned by CLM, to reach the maximum fire carbon emissions in a conversion region requires burning this region about twice when we set PFT-dependent combustion completeness factors to -about 0.3 for stem [the mean of 0.2\ :math:`\mathrm{-}`\ 0.4 used in van +about 0.3 for stem [the mean of 0.2\ :math:`{-}`\ 0.4 used in van der Werf (2010)]. Therefore, when the burned area calculated from Eq. is no more than twice the tree-reduced area, we assume no escaped fires outside the land-type conversion region, and the fire-related fraction @@ -550,43 +528,41 @@ section 18.1.3. Peat fires --------------- -The burned area due to peat fires is given as *A\ :math:`{}_{b}`*: +The burned area due to peat fires is given as :math:`{A}_{b}`: .. math:: + :label: 18.37) - \label{18.37)} A_{b} =cf_{cli,p} f_{peat} (1-f_{sat} )A_{g} -where *c* (time step)\ :math:`{}^{-1}` is a constant; :math:`f_{cli,p}` +where *c* (time step)\ :sup:`-1` is a constant; :math:`f_{cli,p}` represents the effect of climate on the burned area;\ :math:`f_{peat}` is the fractional coverage of peatland in the grid cell; and :math:`f_{sat}` is the fraction of the grid cell with a water table at -the surface or higher. *c*\ =1.0\ :math:`\times`\ 10\ :math:`{}^{-3}` -hr\ :math:`{}^{-1 }`\ for tropical peat fires and -*c*\ =4.2\ :math:`\times`\ 10\ :math:`{}^{-5}`\ :math:`{}^{ }`\ hr\ :math:`{}^{-1 }`\ for -boreal peat fires are derived using an inverse -method,\ :math:`{}^{ }`\ by matching simulations from an unreleased +the surface or higher. *c*\ =1.0\ :math:`\times`\ 10\ :sup:`-3` hr\ :sup:`-1` for tropical peat fires and +*c*\ =4.2\ :math:`\times`\ 10\ :sup:`-5` hr\ :sup:`-1` for boreal peat fires are derived using an inverse +method, by matching simulations from an unreleased CLM4.5 version driven by Qian et al. (2006) atmospheric forcing and climatological lightning data to earlier studies: about 2.4 Mha peatland was burned over Indonesia in 1997 (Page et al. 2002) and the average burned area of peat fires in Western Canada was 0.2 Mha -yr\ :math:`{}^{-1}` for 1980\ :math:`\mathrm{-}`\ 1999 (Turestky et al. +yr\ :sup:`-1` for 1980\ :math:`\math{-}`\ 1999 (Turestky et al. 2004). For tropical peat fires, :math:`f_{cli,p}` is set as a function of long-term precipitation :math:`P_{60d}` : .. math:: + :label: 18.38) - \label{18.38)} f_{cli,p} =\max [0,\min (1,\frac{4-P_{60d} }{4} )]^{2} . For boreal peat fires, :math:`f_{cli,p}` is set to .. math:: + :label: 18.39) - \label{18.39)} - f_{cli,p} =\exp (-\pi \frac{\theta _{17cm} }{0.3} )\cdot \max [0,\min (1,\frac{T_{17cm} -T_{f} }{10} )] + f_{cli,p} = \exp (-\pi \frac{\theta _{17cm} }{0.3} )\cdot \max [0,\min (1,\frac{T_{17cm} -T_{f} }{10} )] where :math:`\theta _{17cm}` and :math:`T_{17cm}` are the wetness and temperature of the top 17 cm of soil; :math:`T_{f}` \ =273.15 K is the @@ -595,13 +571,10 @@ freezing temperature. Peat fires lead to peat combustion and the combustion and mortality of vegetation in peatlands. For tropical peat fires, based on Page et al. (2002), about 6% of the peat carbon loss from stored carbon is caused by -33.9% of the peatland burned. Carbon emissions due to peat combustion (g -C m\ :math:`{}^{-2}` (time step)\ :math:`{}^{-1}`) are therefore set as +33.9% of the peatland burned. Carbon emissions due to peat combustion (g C m\ :sup:`-2` (time step)\ :sup:`-1`) are therefore set as the product of 6%/33.9%, by burned area fraction of peat fire ((time -step)\ :math:`{}^{-1}`), by soil organic carbon (g C -m\ :math:`{}^{-2}`). For boreal peat fires, the carbon emissions due to -peat combustion are set as 2.2 kg C -m\ :math:`{}^{-}`\ :math:`{}^{2 }`\ peat fire area (Turetsky et al. +step)\ :sup:`-1`), by soil organic carbon (g C m\ :sup:`-2`). For boreal peat fires, the carbon emissions due to +peat combustion are set as 2.2 kg C m\ :sup:`-2`\ peat fire area (Turetsky et al. 2002). Biomass combustion and vegetation mortality in post-fire peatlands are set the same as section 18.1.3 for non-crop PFTs and as section 18.2 for crops PFTs. @@ -610,7 +583,7 @@ Table 18.1. PFT-specific combustion completeness and fire mortality factors. +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| PFT | *CC*\ :math:`{}_{leaf}` | *CC*\ :math:`{}_{stem}` | *CC*\ :math:`{}_{root}` | *CC*\ :math:`{}_{ts}` | *M*\ :math:`{}_{leaf}` | *M*\ :math:`{}_{livestem}` | *M*\ :math:`{}_{deadstem}` | *M*\ :math:`{}_{root}` | *M*\ :math:`{}_{ts}` | *M*\ :math:`{}_{livestem}` | *:math:`\xi`*\ :math:`{}_{j}` | +| PFT | *CC*\ :sub:`leaf` | *CC*\ :sub:`stem` | *CC*\ :sub:`root` | *CC*\ :sub:`ts` | *M*\ :sub:`leaf` | *M*\ :sub:`livestem` | *M*\ :sub:`deadstem` | *M*\ :sub:`root` | *M*\ :sub:`ts` | *M*\ :sub:`livestem` | :math:`\xi`\ :sub:`j` | +==================================+===========================+===========================+===========================+=========================+==========================+==============================+==============================+==========================+========================+==============================+=================================+ | NET Temperate | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ @@ -634,11 +607,11 @@ factors. +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ | BDS Boreal | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| C\ :math:`{}_{3}` Grass Arctic | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | +| C\ :sub:`3` Grass Arctic | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| C\ :math:`{}_{3}` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | +| C\ :sub:`3` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| C\ :math:`{}_{4}` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | +| C\ :sub:`4` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ | Crop 1 | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ diff --git a/doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst b/doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst index 980ed65268..7bdea2fefb 100644 --- a/doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst +++ b/doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst @@ -9,15 +9,15 @@ Zhuang et al. 2004). Although the model has similarities with these precursor models, a number of new process representations and parameterization have been integrated into CLM. -Mechanistically modeling net surface CH\ :math:`{}_{4}` emissions +Mechanistically modeling net surface CH\ :sub:`4` emissions requires representing a complex and interacting series of processes. We first (section 19.1) describe the overall model structure and flow of -information in the CH\ :math:`{}_{4}` model, then describe the methods -used to represent: CH\ :math:`{}_{4}` mass balance; CH\ :math:`{}_{4}` -production; ebullition; aerenchyma transport; CH\ :math:`{}_{4}` +information in the CH\ :sub:`4` model, then describe the methods +used to represent: CH\ :sub:`4` mass balance; CH\ :sub:`4` +production; ebullition; aerenchyma transport; CH\ :sub:`4` oxidation; reactive transport solution, including boundary conditions, numerical solution, water table interface, etc.; seasonal inundation -effects; and impact of seasonal inundation on CH\ :math:`{}_{4}` +effects; and impact of seasonal inundation on CH\ :sub:`4` production. Methane Model Structure and Flow @@ -26,97 +26,90 @@ Methane Model Structure and Flow The driver routine for the methane biogeochemistry calculations (ch4, in ch4Mod.F) controls the initialization of boundary conditions, inundation, and impact of redox conditions; calls to routines to -calculate CH\ :math:`{}_{4}` production, oxidation, transport through +calculate CH\ :sub:`4` production, oxidation, transport through aerenchyma, ebullition, and the overall mass balance (for unsaturated and saturated soils and, if desired, lakes); resolves changes to -CH\ :math:`{}_{4}` calculations associated with a changing inundated +CH\ :sub:`4` calculations associated with a changing inundated fraction; performs a mass balance check; and calculates the average -gridcell CH\ :math:`{}_{4}` production, oxidation, and exchanges with +gridcell CH\ :sub:`4` production, oxidation, and exchanges with the atmosphere. Governing Mass-Balance Relationship ---------------------------------------- -The model (Figure 19.1) accounts for CH\ :math:`{}_{4}` production in -the anaerobic fraction of soil (*P*, mol m\ :math:`{}^{-3}` -s\ :math:`{}^{-1}`), ebullition (*E*, mol m\ :math:`{}^{-3}` -s\ :math:`{}^{-1}`), aerenchyma transport (*A*, mol m\ :math:`{}^{-3}` -s\ :math:`{}^{-1}`), aqueous and gaseous diffusion (*F\ :math:`{}_{D}`*, -mol m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), and oxidation (*O*, mol -m\ :math:`{}^{-3}` s\ :math:`{}^{-1}`) via a transient reaction +The model (Figure 19.1) accounts for CH\ :sub:`4` production in +the anaerobic fraction of soil (*P*, mol m\ :sup:`-3` s\ :sup:`-1`), ebullition (*E*, mol m\ :sup:`-3` s\ :sup:`-1`), +aerenchyma transport (*A*, mol m\ :sup:`-3` s\ :sup:`-1`), aqueous and gaseous diffusion (:math:`{F}_{D}`, +mol m\ :sup:`-2` s\ :sup:`-1`), and oxidation (*O*, mol m\ :sup:`-3` s\ :sup:`-1`) via a transient reaction diffusion equation: .. math:: + :label: ZEqnNum628535 - \label{ZEqnNum628535} \frac{\partial \left(RC\right)}{\partial t} =\frac{\partial F_{D} }{\partial z} +P\left(z,t\right)-E\left(z,t\right)-A\left(z,t\right)-O\left(z,t\right) Here *z* (m) represents the vertical dimension, *t* (s) is time, and *R* accounts for gas in both the aqueous and gaseous -phases:\ :math:`R=\varepsilon _{a} +K_{H}^{} \varepsilon _{w}` , with -*:math:`\epsilon`\ :math:`{}_{a}`*, *:math:`\epsilon`\ :math:`{}_{w}`,* -and :math:`K_{H}^{}` (-) the air-filled porosity, water-filled +phases:\ :math:`R = \epsilon _{a} +K_{H} \epsilon _{w}`, with +:math:`\epsilon _{a}`, :math:`\epsilon _{w}`, and :math:`K_{H}` (-) the air-filled porosity, water-filled porosity, and partitioning coefficient for the species of interest, -respectively, and :math:`C` represents CH\ :math:`{}_{4}` or -O\ :math:`{}_{2}` concentration with respect to water volume (mol -m\ :math:`{}^{-3}`). +respectively, and :math:`C` represents CH\ :sub:`4` or O\ :sub:`2` concentration with respect to water volume (mol m\ :sup:`-3`). An analogous version of equation is concurrently solved for -O\ :math:`{}_{2}`, but with the following differences relative to -CH\ :math:`{}_{4}`: *P* = *E* = 0 (i.e., no production or ebullition), -and the oxidation sink includes the O\ :math:`{}_{2}` demanded by +O\ :sub:`2`, but with the following differences relative to +CH\ :sub:`4`: *P* = *E* = 0 (i.e., no production or ebullition), +and the oxidation sink includes the O\ :sub:`2` demanded by methanotrophs, heterotroph decomposers, nitrifiers, and autotrophic root respiration. As currently implemented, each gridcell contains an inundated and a non-inundated fraction. Therefore, equation is solved four times for each gridcell and time step: in the inundated and non-inundated -fractions, and for CH\ :math:`{}_{4}` and O\ :math:`{}_{2}`. If desired, -the CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` mass balance equation is +fractions, and for CH\ :sub:`4` and O\ :sub:`2`. If desired, +the CH\ :sub:`4` and O\ :sub:`2` mass balance equation is solved again for lakes (Chapter 9). For non-inundated areas, the water table interface is defined at the deepest transition from greater than 95% saturated to less than 95% saturated that occurs above frozen soil layers. The inundated fraction is allowed to change at each time step, -and the total soil CH\ :math:`{}_{4}` quantity is conserved by evolving -CH\ :math:`{}_{4}` to the atmosphere when the inundated fraction +and the total soil CH\ :sub:`4` quantity is conserved by evolving +CH\ :sub:`4` to the atmosphere when the inundated fraction decreases, and averaging a portion of the non-inundated concentration into the inundated concentration when the inundated fraction increases. Figure 19.1. Schematic representation of biological and physical -processes integrated in CLM that affect the net CH\ :math:`{}_{4}` +processes integrated in CLM that affect the net CH\ :sub:`4` surface flux (Riley et al. 2011a). (left) Fully inundated portion of a CLM gridcell and (right) variably saturated portion of a gridcell. -|image| +.. image:: image1.png -19.3 CH\ :math:`{}_{4}` Production +CH\ :sub:`4` Production ---------------------------------- Because CLM does not currently specifically represent wetland plant functional types or soil biogeochemical processes, we used gridcell-averaged decomposition rates as proxies. Thus, the upland (default) heterotrophic respiration is used to estimate the wetland -decomposition rate after first dividing off the O\ :math:`{}_{2}` -limitation. The O\ :math:`{}_{2}` consumption associated with anaerobic +decomposition rate after first dividing off the O\ :sub:`2` +limitation. The O\ :sub:`2` consumption associated with anaerobic decomposition is then set to the unlimited version so that it will be -reduced appropriately during O\ :math:`{}_{2}` competition. -CH\ :math:`{}_{4}` production at each soil level in the anaerobic +reduced appropriately during O\ :sub:`2` competition. +CH\ :sub:`4` production at each soil level in the anaerobic portion (i.e., below the water table) of the column is related to the gridcell estimate of heterotrophic respiration from soil and litter -(*R\ :math:`{}_{H}`*; mol C m\ :math:`{}^{-2}` -s\ :math:`{}^{-}`\ :math:`{}^{1}`) corrected for its soil temperature -(*T\ :math:`{}_{s}`*) dependence, soil temperature through a -*Q*\ :math:`{}_{10}` factor (:math:`f_{T}` ), pH (:math:`f_{pH}` ), -redox potential (:math:`f_{pE}` ), and a factor accounting for the +(R\ :sub:`H`; mol C m\ :sup:`-2` s\ :sub:`-1`) corrected for its soil temperature +(:math:`{T}_{s}`) dependence, soil temperature through a +:math:`{A}_{10}` factor (:math:`f_{T}`), pH (:math:`f_{pH}`), +redox potential (:math:`f_{pE}`), and a factor accounting for the seasonal inundation fraction (*S*, described below): .. math:: + :label: ZEqnNum109798 - \label{ZEqnNum109798} P=R_{H} f_{CH_{4} } f_{T} f_{pH} f_{pE} S. Here, :math:`f_{CH_{4} }` is the baseline ratio between -CO\ :math:`{}_{2}` and CH\ :math:`{}_{4}` production (all parameters +CO\ :sub:`2` and CH\ :sub:`4` production (all parameters values are given in Table 19.1). Currently, :math:`f_{CH_{4} }` is modified to account for our assumptions that methanogens may have a higher Q\ :math:`{}_{10}` than aerobic decomposers; are not N limited; @@ -126,27 +119,24 @@ When the single BGC soil level is used in CLM (Chapter 15), the temperature factor, :math:`f_{T}` , is set to 0 for temperatures equal to or below freezing, even though CLM allows heterotrophic respiration below freezing. However, if the vertically resolved BGC soil column is -used, CH\ :math:`{}_{4}` production continues below freezing because +used, CH\ :sub:`4` production continues below freezing because liquid water stress limits decomposition. The base temperature for the -*Q*\ :math:`{}_{10}` factor, *T\ :math:`{}_{B}`*, is 22 -:math:`{}^\circ`\ C and effectively modified the base -:math:`f_{CH_{4} }` value. +:math:`{Q}_{10}` factor, :math:`{T}_{B}`, is 22\ :sup:`o` C and effectively modified the base +:math:`f_{CH_{4}}` value. -For the single-layer BGC version, *R\ :math:`{}_{H}`* is distributed ** +For the single-layer BGC version, :math:`{R}_{H}` is distributed among soil levels by assuming that 50% is associated with the roots (using the CLM PFT-specific rooting distribution) and the rest is evenly divided among the top 0.28 m of soil (to be consistent with CLM’s soil decomposition algorithm). For the vertically resolved BGC version, the -prognosed distribution of *R\ :math:`{}_{H}`* is used to estimate -CH\ :math:`{}_{4}` production. +prognosed distribution of :math:`{R}_{H}` is used to estimate CH\ :sub:`4` production. The factor :math:`f_{pH}` is nominally set to 1, although a static -spatial map of *pH* can be used to determine this factor (Dunfield et -al. 1993) by applying: +spatial map of *pH* can be used to determine this factor (Dunfield et al. 1993) by applying: .. math:: + :label: 19.3) - \label{19.3)} f_{pH} =10^{-0.2235pH^{2} +2.7727pH-8.6} . The :math:`f_{pE}` factor assumes that alternative electron acceptors @@ -157,26 +147,26 @@ in the upland fraction of the gridcell. We consider both :math:`f_{pH}` and :math:`f_{pE}` to be poorly constrained in the model and identify these controllers as important areas for model improvement. -As a non-default option to account for CH\ :math:`{}_{4}` production in +As a non-default option to account for CH\ :sub:`4` production in anoxic microsites above the water table, we apply the Arah and Stephen (1998) estimate of anaerobic fraction: .. math:: + :label: 19.4) - \label{19.4)} \varphi =\frac{1}{1+\eta C_{O_{2} } } . -Here, *:math:`\varphi`* is the factor by which production is inhibited +Here, :math:`\phi` is the factor by which production is inhibited above the water table (compared to production as calculated in equation -, :math:`C_{O_{2} }` (mol m\ :math:`{}^{-3}`) is the bulk soil oxygen -concentration, and *:math:`\eta`* = 400 mol m\ :math:`{}^{-3}`. +, :math:`C_{O_{2}}` (mol m\ :sup:`-3`) is the bulk soil oxygen +concentration, and :math:`\eta` = 400 mol m\ :sup:`-3`. -The O\ :math:`{}_{2}` required to facilitate the vertically resolved +The O\ :sub:`2` required to facilitate the vertically resolved heterotrophic decomposition and root respiration is estimated assuming 1 -mol O\ :math:`{}_{2}` is required per mol CO\ :math:`{}_{2}` produced. -The model also calculates the O\ :math:`{}_{2}` required during -nitrification, and the total O\ :math:`{}_{2}` demand is used in the -O\ :math:`{}_{2}` mass balance solution. +mol O\ :sub:`2` is required per mol CO\ :sub:`2` produced. +The model also calculates the O\ :sub:`2` required during +nitrification, and the total O\ :sub:`2` demand is used in the +O\ :sub:`2` mass balance solution. Table 19.1. Parameter descriptions and sensitivity analysis ranges applied in the methane model. @@ -184,79 +174,74 @@ applied in the methane model. +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ | Mechanism | Parameter | Baseline Value | Range for Sensitivity Analysis | Units | Description | +==============+============================+==============================================+==================================================================================================+=============================================+============================================================================================+ -| Production | *Q\ :math:`{}_{10}`* | 2 | 1.5 – 4 | - | CH\ :math:`{}_{4}` production Q\ :math:`{}_{10}` | +| Production | :math:`{Q}_{10}` | 2 | 1.5 – 4 | - | CH\ :sub:`4` production :math:`{Q}_{10}` | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`f_{pH}` | 1 | On, off | - | Impact of pH on CH\ :math:`{}_{4}` production | +| | :math:`f_{pH}` | 1 | On, off | - | Impact of pH on CH\ :sub:`4` production | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`f_{pE}` | 1 | On, off | - | Impact of redox potential on CH\ :math:`{}_{4}` production | +| | :math:`f_{pE}` | 1 | On, off | - | Impact of redox potential on CH\ :sub:`4` production | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| ** | *S* | Varies | NA | - | Seasonal inundation factor | +| | *S* | Varies | NA | - | Seasonal inundation factor | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | *:math:`\beta`* | 0.2 | NA | - | Effect of anoxia on decomposition rate (used to calculate *S* only) | +| | :math:`\beta` | 0.2 | NA | - | Effect of anoxia on decomposition rate (used to calculate *S* only) | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`f_{CH_{4} }` | 0.2 | NA | - | Ratio between CH\ :math:`{}_{4}` and CO\ :math:`{}_{2}` production below the water table | +| | :math:`f_{CH_{4} }` | 0.2 | NA | - | Ratio between CH\ :sub:`4` and CO\ :sub:`2` production below the water table | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| Ebullition | *C\ :math:`{}_{e,max}`* | 0.15 | NA | mol m\ :math:`{}^{-3}` | CH\ :math:`{}_{4}` concentration to start ebullition | +| Ebullition | :math:`{C}_{e,max}` | 0.15 | NA | mol m\ :sup:`-3` | CH\ :sub:`4` concentration to start ebullition | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| ** | *C\ :math:`{}_{e,min}`* | 0.15 | NA | - | CH\ :math:`{}_{4}` concentration to end ebullition | +| | :math:`{C}_{e,min}` | 0.15 | NA | - | CH\ :sub:`4` concentration to end ebullition | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| Diffusion | :math:`f_{D_{0} }` \ ** | 1 | 1, 10 | m\ :math:`{}^{2}` s\ :math:`{}^{-1}` | Diffusion coefficient multiplier (Table 19.2) | +| Diffusion | :math:`f_{D_{0} }` | 1 | 1, 10 | m\ :sup:`2` s\ :sup:`-1` | Diffusion coefficient multiplier (Table 19.2) | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ | Aerenchyma | *p* | 0.3 | NA | - | Grass aerenchyma porosity | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| ** | *R* | 2.9\ :math:`\times`\ 10\ :math:`{}^{-3}` m | NA | m | Aerenchyma radius | +| | *R* | 2.9\ :math:`\times`\ 10\ :sup:`-3` m | NA | m | Aerenchyma radius | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| ** | *r\ :math:`{}_{L}`* | 3 | NA | - | Root length to depth ratio | +| | :math:`{r}_{L}` | 3 | NA | - | Root length to depth ratio | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | *F\ :math:`{}_{a}`* | 1 | 0.5 – 1.5 | - | Aerenchyma conductance multiplier | +| | :math:`{F}_{a}` | 1 | 0.5 – 1.5 | - | Aerenchyma conductance multiplier | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| Oxidation | :math:`K_{CH_{4} }` | 5 x 10\ :math:`{}^{-3}` | 5\ :math:`\times`\ 10\ :math:`{}^{-4}`\ :math:`{}_{ }`- 5\ :math:`\times`\ 10\ :math:`{}^{-2}` | mol m\ :math:`{}^{-3}` | CH\ :math:`{}_{4}` half-saturation oxidation coefficient (wetlands) | +| Oxidation | :math:`K_{CH_{4} }` | 5 x 10\ :sup:`-3` | 5\ :math:`\times`\ 10\ :math:`{}^{-4}`\ :math:`{}_{ }`- 5\ :math:`\times`\ 10\ :sup:`-2` | mol m\ :sup:`-3` | CH\ :sub:`4` half-saturation oxidation coefficient (wetlands) | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| ** | :math:`K_{O_{2} }` \ ** | 2 x 10\ :math:`{}^{-2}` | 2\ :math:`\times`\ 10\ :math:`{}^{-3}` - 2\ :math:`\times`\ 10\ :math:`{}^{-1}` | mol m\ :math:`{}^{-3}` | O\ :math:`{}_{2}` half-saturation oxidation coefficient | +| | :math:`K_{O_{2} }` | 2 x 10\ :sup:`-2` | 2\ :math:`\times`\ 10\ :sup:`-3` - 2\ :math:`\times`\ 10\ :sup:`-1` | mol m\ :sup:`-3` | O\ :sub:`2` half-saturation oxidation coefficient | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`R_{o,\max }` \ ** | 1.25 x 10\ :math:`{}^{-5}` | 1.25\ :math:`\times`\ 10\ :math:`{}^{-6}` - 1.25\ :math:`\times`\ 10\ :math:`{}^{-4}` | mol m\ :math:`{}^{-3}` s\ :math:`{}^{-1}` | Maximum oxidation rate (wetlands) | +| | :math:`R_{o,\max }` | 1.25 x 10\ :math:`{}^{-5}` | 1.25\ :math:`\times`\ 10\ :math:`{}^{-6}` - 1.25\ :math:`\times`\ 10\ :math:`{}^{-4}` | mol m\ :sup:`-3` s\ :sup:`-1` | Maximum oxidation rate (wetlands) | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -.. math:: 8 - -.. math:: 17 - Ebullition --------------- -Briefly, the simulated aqueous CH\ :math:`{}_{4}` concentration in each +Briefly, the simulated aqueous CH\ :sub:`4` concentration in each soil level is used to estimate the expected equilibrium gaseous partial pressure (:math:`C_{e}` ), as a function of temperature and depth below the water table, by first estimating the Henry’s law partitioning -coefficient (:math:`k_{h}^{C}` ) by the method described in Wania et al. -(2010): +coefficient (:math:`k_{h}^{C}` ) by the method described in Wania et al. (2010): .. math:: + :label: 19.5) - \label{19.5)} \log \left(\frac{1}{k_{H} } \right)=\log k_{H}^{s} -\frac{1}{C_{H} } \left(\frac{1}{T} -\frac{1}{T^{s} } \right) .. math:: + :label: ZEqnNum493232 - \label{ZEqnNum493232} k_{h}^{C} =Tk_{H} R_{g} .. math:: + :label: 19.7) - \label{19.7)} C_{e} =\frac{C_{w} R_{g} T}{\theta _{s} k_{H}^{C} p} where :math:`C_{H}` \ is a constant, :math:`R_{g}` is the universal gas constant, :math:`k_{H}^{s}` is Henry’s law partitioning coefficient at standard temperature (:math:`T^{s}` ),\ :math:`C_{w}` \ is local -aqueous CH\ :math:`{}_{4}` concentration, and *p* is pressure. +aqueous CH\ :sub:`4` concentration, and *p* is pressure. The local pressure is calculated as the sum of the ambient pressure, water pressure down to the local depth, and pressure from surface -ponding (if applicable). When the CH\ :math:`{}_{4}` partial pressure +ponding (if applicable). When the CH\ :sub:`4` partial pressure exceeds 15% of the local pressure (Baird et al. 2004; Strack et al. -2006; Wania et al. 2010), bubbling occurs to remove CH\ :math:`{}_{4}` -to below this value, modified by the fraction of CH\ :math:`{}_{4}` in +2006; Wania et al. 2010), bubbling occurs to remove CH\ :sub:`4` +to below this value, modified by the fraction of CH\ :sub:`4` in the bubbles [taken as 57%; (Kellner et al. 2006; Wania et al. 2010)]. Bubbles are immediately added to the surface flux for saturated columns and are placed immediately above the water table interface in @@ -271,21 +256,19 @@ atmosphere and, if specified, by vertical advection with the transpiration stream. There is evidence that pressure driven flow can also occur, but we did not include that mechanism in the current model. -The diffusive transport through aerenchyma (*A*, mol m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`) from each soil layer is represented in the model as: +The diffusive transport through aerenchyma (*A*, mol m\ :sup:`-2` s\ :sup:`-1`) from each soil layer is represented in the model as: .. math:: + :label: ZEqnNum158128 - \label{ZEqnNum158128} A=\frac{C\left(z\right)-C_{a} }{{\raise0.7ex\hbox{$ r_{L} z $}\!\mathord{\left/ {\vphantom {r_{L} z D}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ D $}} +r_{a} } pT\rho _{r} , - -where *D* is the free-air gas diffusion coefficient (m:math:`{}^{2}` -s\ :math:`{}^{-1}`); *C(z)* (mol m\ :math:`{}^{-3}`) is the gaseous + +where *D* is the free-air gas diffusion coefficient (m:sup:`2` s\ :sup:`-1`); *C(z)* (mol m\ :sup:`-3`) is the gaseous concentration at depth *z* (m); :math:`r_{L}` is the ratio of root length to depth; *p* is the porosity (-); *T* is specific aerenchyma -area (m:math:`{}^{2}` m\ :math:`{}^{-2}`); *r\ :math:`{}_{a}`* is the +area (m:sup:`2` m\ :sup:`-2`); :math:`{r}_{a}` is the aerodynamic resistance between the surface and the atmospheric reference -height (s m:math:`{}^{-1}`); and :math:`\rho _{r}` is the rooting +height (s m:sup:`-1`); and :math:`\rho _{r}` is the rooting density as a function of depth (-). The gaseous concentration is calculated with Henry’s law as described in equation . @@ -293,125 +276,121 @@ Based on the ranges reported in Colmer (2003), we have chosen baseline aerenchyma porosity values of 0.3 for grass and crop PFTs and 0.1 for tree and shrub PFTs. The aerenchyma area varies over the course of the growing season; we parameterize this dependency using the simulated leaf -area index *L* (m:math:`{}^{2}` m\ :math:`{}^{-2}`), as in Wania et al. +area index *L* (m:sup:`2` m\ :sup:`-2`), as in Wania et al. (2010): .. math:: + :label: 19.9) - \label{19.9)} T=\frac{f_{N} N_{a} L}{0.22} \pi R^{2} . Here :math:`N_{a}` is annual net primary production (NPP, mol -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`); *R* is the aerenchyma radius -(2.9:math:`\times`\ 10\ :math:`{}^{-3}` m); *f\ :math:`{}_{N}`* is the +m\ :sup:`-2` s\ :sup:`-1`); *R* is the aerenchyma radius +(2.9:math:`\times`\ 10\ :sup:`-3` m); :math:`{f}_{N}` is the belowground fraction of annual NPP; and the 0.22 factor represents the -amount of C per tiller. O\ :math:`{}_{2}` can also diffuse in from the +amount of C per tiller. O\ :sub:`2` can also diffuse in from the atmosphere to the soil layer via the reverse of the same pathway, with the same representation as Equation but with the gas diffusivity of oxygen. -CLM also simulates the direct emission of CH\ :math:`{}_{4}` from leaves +CLM also simulates the direct emission of CH\ :sub:`4` from leaves to the atmosphere via transpiration of dissolved methane. We calculate -this flux (:math:`F_{CH_{4} -T}` ; mol m\ :math:`{}^{-}`\ :math:`{}^{2}` -s\ :math:`{}^{-1}`) using the simulated soil water methane concentration -(:math:`C_{CH_{4} ,j}` (mol m\ :math:`{}^{-3}`)) in each soil layer *j* +this flux (:math:`F_{CH_{4} -T}` ; mol m\ :math:`{}^{-}`\ :sup:`2` +s\ :sup:`-1`) using the simulated soil water methane concentration +(:math:`C_{CH_{4} ,j}` (mol m\ :sup:`-3`)) in each soil layer *j* and the CLM predicted transpiration (:math:`F_{T}` ) for each PFT, assuming that no methane was oxidized inside the plant tissue: .. math:: + :label: 19.10) - \label{19.10)} F_{CH_{4} -T} =\sum _{j}\rho _{r,j} F_{T} C_{CH_{4} ,j} . -CH\ :math:`{}_{4}` Oxidation +CH\ :sub:`4` Oxidation --------------------------------- -CLM represents CH\ :math:`{}_{4}` oxidation with double Michaelis-Menten +CLM represents CH\ :sub:`4` oxidation with double Michaelis-Menten kinetics (Arah and Stephen 1998; Segers 1998), dependent on both the -gaseous CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` concentrations: +gaseous CH\ :sub:`4` and O\ :sub:`2` concentrations: .. math:: + :label: 19.11) - \label{19.11)} R_{oxic} =R_{o,\max } \left[\frac{C_{CH_{4} } }{K_{CH_{4} } +C_{CH_{4} } } \right]\left[\frac{C_{O_{2} } }{K_{O_{2} } +C_{O_{2} } } \right]Q_{10} F_{\vartheta } where :math:`K_{CH_{4} }` and :math:`K_{O_{2} }` \ are the half -saturation coefficients (mol m\ :math:`{}^{-3}`) with respect to -CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` concentrations, respectively; +saturation coefficients (mol m\ :sup:`-3`) with respect to +CH\ :sub:`4` and O\ :sub:`2` concentrations, respectively; :math:`R_{o,\max }` is the maximum oxidation rate (mol -m\ :math:`{}^{-3}` s\ :math:`{}^{-1}`); and *Q\ :math:`{}_{10}`* +m\ :sup:`-3` s\ :sup:`-1`); and :math:`{Q}_{10}` specifies the temperature dependence of the reaction with a base -temperature set to 12 :math:`{}^\circ`\ C. The soil moisture limitation -factor :math:`F_{\vartheta }` is applied above the water table to +temperature set to 12 :sup:`o` C. The soil moisture limitation +factor :math:`F_{\theta }` is applied above the water table to represent water stress for methanotrophs. Based on the data in Schnell -and King (1996), we take :math:`F_{\vartheta } =e^{{\raise0.7ex\hbox{` --P -:math:`}\!\mathord{\left/ {\vphantom {-P P_{c} }} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{` -P\ :sub:`c` :math:`}} }` , where *P* is the soil moisture potential and -*P\ :math:`{}_{c}`* = -2.4:math:`\times`\ 10\ :math:`{}^{5}` mm. +and King (1996), we take :math:`F_{\theta } = {e}^{-P/{P}_{c}}`, where *P* is the soil moisture potential and +:math:`{P}_{c} = -2.4 \times {10}^{5}` mm. Reactive Transport Solution -------------------------------- The solution to equation is solved in several sequential steps: resolve -competition for CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` (section +competition for CH\ :sub:`4` and O\ :sub:`2` (section 19.7.1); add the ebullition flux into the layer directly above the water -table or into the atmosphere; calculate the overall CH\ :math:`{}_{4}` -or O\ :math:`{}_{2}` source term based on production, aerenchyma +table or into the atmosphere; calculate the overall CH\ :sub:`4` +or O\ :sub:`2` source term based on production, aerenchyma transport, ebullition, and oxidation; establish boundary conditions, including surface conductance to account for snow, ponding, and turbulent conductances and bottom flux condition (section 19.7.2); calculate diffusivity (section 19.7.3); and solve the resulting mass balance using a tridiagonal solver (section 19.7.5). -19.7.1 Competition for CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` +Competition for CH\ :sub:`4` and O\ :sub:`2` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -For each time step, the unlimited CH\ :math:`{}_{4}` and -O\ :math:`{}_{2}` demands in each model depth interval are computed. If +For each time step, the unlimited CH\ :sub:`4` and +O\ :sub:`2` demands in each model depth interval are computed. If the total demand over a time step for one of the species exceeds the amount available in a particular control volume, the demand from each process associated with the sink is scaled by the fraction required to ensure non-negative concentrations. Since the methanotrophs are limited -by both CH\ :math:`{}_{4}` and O\ :math:`{}_{2}`, the stricter +by both CH\ :sub:`4` and O\ :sub:`2`, the stricter limitation is applied to methanotroph oxidation, and then the limitations are scaled back for the other processes. The competition is designed so that the sinks must not exceed the available concentration over the time step, and if any limitation exists, the sinks must sum to this value. Because the sinks are calculated explicitly while the transport is semi-implicit, negative concentrations can occur after the -tridiagonal solution. When this condition occurs for O\ :math:`{}_{2}`, +tridiagonal solution. When this condition occurs for O\ :sub:`2`, the concentrations are reset to zero; if it occurs for -CH\ :math:`{}_{4}`, the surface flux is adjusted and the concentration +CH\ :sub:`4`, the surface flux is adjusted and the concentration is set to zero if the adjustment is not too large. -19.7.2 CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` Source Terms +19.7.2 CH\ :sub:`4` and O\ :sub:`2` Source Terms ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The overall CH\ :math:`{}_{4}` net source term consists of production, +The overall CH\ :sub:`4` net source term consists of production, oxidation at the base of aerenchyma, transport through aerenchyma, methanotrophic oxidation, and ebullition (either to the control volume above the water table if unsaturated or directly to the atmosphere if -saturated). For O\ :math:`{}_{2}` below the top control volume, the net -source term consists of O\ :math:`{}_{2}` losses from methanotrophy, SOM -decomposition, and autotrophic respiration, and an O\ :math:`{}_{2}` +saturated). For O\ :sub:`2` below the top control volume, the net +source term consists of O\ :sub:`2` losses from methanotrophy, SOM +decomposition, and autotrophic respiration, and an O\ :sub:`2` source through aerenchyma. 19.7.3 Aqueous and Gaseous Diffusion ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ For gaseous diffusion, we adopted the temperature dependence of -molecular free-air diffusion coefficients (*D\ :math:`{}_{0}`* -(m:math:`{}^{2}` s\ :math:`{}^{-1}`)) as described by Lerman et al. -(1979) and applied by Wania et al. (2010) (Table 19.2). +molecular free-air diffusion coefficients (:math:`{D}_{0}` +(m:sup:`2` s\ :sup:`-1`)) as described by Lerman et al. (1979) and applied by Wania et al. (2010) (Table 19.2). Table 19.2. Temperature dependence of aqueous and gaseous diffusion -coefficients for CH\ :math:`{}_{4}` and O\ :math:`{}_{2}`. +coefficients for CH\ :sub:`4` and O\ :sub:`2`. +----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ -| D\ :math:`{}_{0}` (m:math:`{}^{2}` s\ :math:`{}^{-1}`) | CH\ :math:`{}_{4}` | O\ :math:`{}_{2}` | +| :math:`{D}_{0}` (m\ :sup:`2` s\ :sup:`-1`) | CH\ :sub:`4` | O\ :sub:`2` | +==========================================================+==========================================================+========================================================+ -| Aqueous | 0.9798 + 0.02986\ *T* + 0.0004381\ *T*\ :math:`{}^{2}` | 1.172+ 0.03443\ *T* + 0.0005048\ *T*\ :math:`{}^{2}` | +| Aqueous | 0.9798 + 0.02986\ *T* + 0.0004381\ *T*\ :sup:`2` | 1.172+ 0.03443\ *T* + 0.0005048\ *T*\ :sup:`2` | +----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ | Gaseous | 0.1875 + 0.0013\ *T* | 0.1759 + 0.0011\ *T* | +----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ @@ -420,12 +399,12 @@ Gaseous diffusivity in soils also depends on the molecular diffusivity, soil structure, porosity, and organic matter content. Moldrup et al. (2003), using observations across a range of unsaturated mineral soils, showed that the relationship between effective diffusivity -(:math:`D_{e}` (m:math:`{}^{2}` s\ :math:`{}^{-1}`)) and soil +(:math:`D_{e}` (m:sup:`2` s\ :sup:`-1`)) and soil properties can be represented as: .. math:: + :label: ZEqnNum730978 - \label{ZEqnNum730978} D_{e} =D_{0} \theta _{a}^{2} \left(\frac{\theta _{a} }{\theta _{s} } \right)^{{\raise0.7ex\hbox{$ 3 $}\!\mathord{\left/ {\vphantom {3 b}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ b $}} } , where :math:`\theta _{a}` and :math:`\theta _{s}` are the air-filled @@ -436,26 +415,26 @@ Hasegawa (2005) have shown that the original Millington-Quirk closely in unsaturated peat soils: .. math:: + :label: ZEqnNum437147 - \label{ZEqnNum437147} D_{e} =D_{0} \frac{\theta _{a} ^{{\raise0.7ex\hbox{$ 10 $}\!\mathord{\left/ {\vphantom {10 3}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ 3 $}} } }{\theta _{s} ^{2} } In CLM, we applied equation for soils with zero organic matter content -and equation for soils with more than 130 kg m\ :math:`{}^{-3}` organic +and equation for soils with more than 130 kg m\ :sup:`-3` organic matter content. A linear interpolation between these two limits is -applied for soils with SOM content below 130 kg m\ :math:`{}^{-3}`. For +applied for soils with SOM content below 130 kg m\ :sup:`-3`. For aqueous diffusion in the saturated part of the soil column, we applied (Moldrup et al. 2003): .. math:: + :label: 19.14) - \label{19.14)} D_{e} =D_{0} \theta _{s} ^{2} . To simplify the solution, we assumed that gaseous diffusion dominates above the water table interface and aqueous diffusion below the water table interface. Descriptions, baseline values, and dimensions for -parameters specific to the CH\ :math:`{}_{4}` model are given in Table +parameters specific to the CH\ :sub:`4` model are given in Table 19.1. For freezing or frozen soils below the water table, diffusion is limited to the remaining liquid (CLM allows for some freezing point depression), and the diffusion coefficients are scaled by the @@ -465,7 +444,7 @@ equilibrium is assumed at the interface with the water table. 19.7.4 Boundary Conditions ^^^^^^^^^^^^^^^^^^^^^^^^^^ -We assume the CH\ :math:`{}_{4}` and O\ :math:`{}_{2}` surface fluxes +We assume the CH\ :sub:`4` and O\ :sub:`2` surface fluxes can be calculated from an effective conductance and a gaseous concentration gradient between the atmospheric concentration and either the gaseous concentration in the first soil layer (unsaturated soils) or @@ -481,7 +460,7 @@ with a series combination: :math:`\left[\frac{1}{w} +\frac{\Delta x_{1} }{D_{1} } \right]^{-1}` , and if the top layer is saturated, this term is replaced with :math:`\left[\frac{K_{H} }{w} +\frac{\frac{1}{2} \Delta x_{1} }{D_{1} } \right]^{-1}` , -where *K\ :math:`{}_{H}`* is the Henry’s law equilibrium constant. +where :math:`{K}_{H}` is the Henry’s law equilibrium constant. When snow is present, a resistance is added to account for diffusion through the snow based on the Millington-Quirk expression (equation ) @@ -492,7 +471,7 @@ ponding depth to diffusivity. The overall conductance is taken as the series combination of surface, snow, and ponding resistances. We assume a zero flux gradient at the bottom of the soil column. -19.7.5 Crank-Nicholson Solution +Crank-Nicholson Solution ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Equation is solved using a Crank-Nicholson solution (Press et al. 1992), @@ -500,13 +479,13 @@ which combines fully explicit and implicit representations of the mass balance. The fully explicit decomposition of equation can be written as .. math:: + :label: ZEqnNum395184 - \label{ZEqnNum395184} \frac{R_{j}^{n+1} C_{j}^{n+1} -R_{j}^{n} C_{j}^{n} }{\Delta t} =\frac{1}{\Delta x_{j} } \left[\frac{D_{p1}^{n} }{\Delta x_{p1}^{} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{n} }{\Delta x_{m1}^{} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+S_{j}^{n} , where *j* refers to the cell in the vertically discretized soil column (increasing downward), *n* refers to the current time step, -*:math:`\Delta`\ t* is the time step (s), *p1* is *j+½*, *m1* is *j-½*, +:math:`\Delta`\ *t* is the time step (s), *p1* is *j+½*, *m1* is *j-½*, and :math:`S_{j}^{n}` is the net source at time step *n* and position *j*, i.e., :math:`S_{j}^{n} =P\left(j,n\right)-E\left(j,n\right)-A\left(j,n\right)-O\left(j,n\right)`. @@ -520,15 +499,15 @@ Using an average of the fully implicit and fully explicit relationships gives: .. math:: + :label: ZEqnNum463314 - \label{ZEqnNum463314} \begin{array}{l} {-\frac{1}{2\Delta x_{j} } \frac{D_{m1}^{} }{\Delta x_{m1}^{} } C_{j-1}^{n+1} +\left[\frac{R_{j}^{n+1} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left(\frac{D_{p1}^{} }{\Delta x_{p1}^{} } +\frac{D_{m1}^{} }{\Delta x_{m1}^{} } \right)\right]C_{j}^{n+1} -\frac{1}{2\Delta x_{j} } \frac{D_{p1}^{} }{\Delta x_{p1}^{} } C_{j+1}^{n+1} =} \\ {\frac{R_{j}^{n} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1}^{} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1}^{} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right]} \end{array}, Equation is solved with a standard tridiagonal solver, i.e.: .. math:: + :label: 19.17) - \label{19.17)} aC_{j-1}^{n+1} +bC_{j}^{n+1} +cC_{j+1}^{n+1} =r, with coefficients specified in equation . @@ -538,7 +517,7 @@ the diffusion solution and the time-varying aggregation over inundated and non-inundated areas strictly conserves methane molecules (except for production minus consumption) and carbon atoms. -19.7.6 Interface between water table and unsaturated zone +Interface between water table and unsaturated zone ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We assume Henry’s Law equilibrium at the interface between the saturated @@ -552,8 +531,8 @@ soil element above the interface: .. math:: b=\left[\frac{R_{j}^{n+1} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left(K_{H} \frac{D_{p1}^{} }{\Delta x_{p1} } +\frac{D_{m1}^{} }{\Delta x_{m1} } \right)\right] .. math:: + :label: 19.18) - \label{19.18)} r=\frac{R_{j}^{n} }{\Delta t} C_{j}^{n} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1} } \left(C_{j+1}^{n} -K_{H} C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right] and the soil element below the interface: @@ -563,8 +542,8 @@ and the soil element below the interface: .. math:: a=-K_{H} \frac{1}{2\Delta x_{j} } \frac{D_{m1}^{} }{\Delta x_{m1} } .. math:: + :label: 19.19) - \label{19.19)} r=\frac{R_{j}^{n} }{\Delta t} +C_{j}^{n} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1} } \left(C_{j}^{n} -K_{H} C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right] Inundated Fraction Prediction @@ -573,26 +552,25 @@ Inundated Fraction Prediction We developed a simplified dynamic representation of spatial inundation based on recent work by Prigent et al. (2007), who described a multi-satellite approach to estimate the global monthly inundated -fraction (*F\ :math:`{}_{i}`*) over an equal area grid +fraction (:math:`{F}_{i}`) over an equal area grid (0.25:math:`\circ`\ :math:`\times`\ 0.25\ :math:`\circ` at the equator) from 1993 - 2000. They suggested that the IGBP estimate for inundation could be used as a measure of sensitivity of their detection approach at low inundation. We therefore used the sum of their satellite-derived -*F\ :math:`{}_{i}`* and the constant IGBP estimate when it was less than +:math:`{F}_{i}` and the constant IGBP estimate when it was less than 10% to perform a simple inversion for the inundated fraction for methane -production (*f\ :math:`{}_{s}`*). The method optimized three parameters -(*p\ :math:`{}_{1}`*, *p\ :math:`{}_{2}`*, *p\ :math:`{}_{3}`*) for each +production (:math:`{f}_{s}`). The method optimized three parameters +(:math:`{p}_{1}`, *p*\ :sub:`2`, :math:`{p}_{3}`) for each grid cell in a simple model based on simulated water table depth -(*z\ :math:`{}_{w}`*) and surface runoff (*Q\ :math:`{}_{r}`* (mm -s\ :math:`{}^{-1}`)): +(:math:`{z}_{w}`) and surface runoff (:math:`{Q}_{r}` (mm s\ :sup:`-1`)): .. math:: + :label: 19.20) - \label{19.20)} f_{s} =P_{1} e^{{\raise0.7ex\hbox{$ -z_{w} $}\!\mathord{\left/ {\vphantom {-z_{w} p_{2} }} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ p_{2} $}} } +p_{3} Q_{r} . These parameters were evaluated at the -0.5\ **:math:`\boldsymbol{{}^\circ}`** resolution, and aggregated for +0.5\ :sup:`o` resolution, and aggregated for coarser simulations. We expect that ongoing work in the hydrology submodel of CLM will alleviate the need for this crude simplification of inundated fraction in future model versions. @@ -601,19 +579,18 @@ Seasonal Inundation ------------------------ We have developed a simplified scaling factor to mimic the impact of -seasonal inundation on CH\ :math:`{}_{4}` production (see appendix B in +seasonal inundation on CH\ :sub:`4` production (see appendix B in Riley et al. (2011a) for a discussion of this simplified expression): .. math:: + :label: 19.21) - \label{19.21)} S=\frac{\beta \left(f-\bar{f}\right)+\bar{f}}{f} ,S\le 1. Here, *f* is the instantaneous inundated fraction, :math:`\bar{f}` is the annual average inundated fraction (evaluated for the previous calendar year) weighted by heterotrophic respiration, and -*:math:`\beta`* is the anoxia factor that relates the fully anoxic +:math:`\beta` is the anoxia factor that relates the fully anoxic decomposition rate to the fully oxygen-unlimited decomposition rate, all other conditions being equal. -.. |image| image:: image1 diff --git a/doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst b/doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst index 0e29f00078..d19fdd3f5d 100644 --- a/doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst +++ b/doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst @@ -135,52 +135,46 @@ Table 2.1. Plant functional types +--------------------------------------------------------------+-------------------+ | Broadleaf deciduous shrub – boreal | BDS Boreal | +--------------------------------------------------------------+-------------------+ -| C\ :math:`{}_{3}` arctic grass | - | +| C\ :sub:`3` arctic grass | - | +--------------------------------------------------------------+-------------------+ -| C\ :math:`{}_{3}` grass | - | +| C\ :sub:`3` grass | - | +--------------------------------------------------------------+-------------------+ -| C\ :math:`{}_{4}` grass | - | +| C\ :sub:`4` grass | - | +--------------------------------------------------------------+-------------------+ -| C\ :math:`{}_{3}` Unmanaged Rainfed Crop | Crop R | +| C\ :sub:`3` Unmanaged Rainfed Crop | Crop R | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{1}`\ C\ :math:`{}_{3}` Unmanaged Irrigated Crop | Crop I | +| :sup:`1`\ C\ :sub:`3` Unmanaged Irrigated Crop | Crop I | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{2}`\ Rainfed Corn | Corn R | +| :sup:`2`\ Rainfed Corn | Corn R | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{2}`\ Irrigated Corn | Corn I | +| :sup:`2`\ Irrigated Corn | Corn I | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{2}`\ Rainfed Temperate Cereals | Temp Cereal R | +| :sup:`2`\ Rainfed Temperate Cereals | Temp Cereal R | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{2}`\ Irrigated Temperate Cereals | Temp Cereal I | +| :sup:`2`\ Irrigated Temperate Cereals | Temp Cereal I | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{3}`\ Rainfed Winter Cereals | Winter Cereal R | +| :sup:`3`\ Rainfed Winter Cereals | Winter Cereal R | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{3}`\ Irrigated Winter Cereals | Winter Cereal I | +| :sup:`3`\ Irrigated Winter Cereals | Winter Cereal I | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{2}`\ Rainfed Soybean | Soybean R | +| :sup:`2`\ Rainfed Soybean | Soybean R | +--------------------------------------------------------------+-------------------+ -| :math:`{}^{2}`\ Irrigated Soybean | Soybean I | +| :sup:`2`\ Irrigated Soybean | Soybean I | +--------------------------------------------------------------+-------------------+ -:math:`{}^{1}`\ Only used if irrigation is active (Chapter 20). -:math:`{}^{2}`\ Only used if crop model is active (Chapter 20). -:math:`{}^{3}`\ Reserved for future implementations of crop model -(Chapter 20). +:sup:`1`\ Only used if irrigation is active (Chapter 20). +:sup:`2`\ Only used if crop model is active (Chapter 20). +:sup:`3`\ Reserved for future implementations of crop model (Chapter 20). Vegetation Structure ^^^^^^^^^^^^^^^^^^^^^^^^^^ Vegetation structure is defined by leaf and stem area indices -(:math:`L,\, S`) and canopy top and bottom heights -(:math:`z_{top}` ,\ :math:`z_{bot}` ) (Table 2.2). Separate leaf and -stem area indices and canopy heights are prescribed or calculated for -each PFT. Daily leaf and stem area indices are obtained from gridded -datasets of monthly values (section 2.2.3). Canopy top and bottom -heights are also obtained from gridded datasets. However, these are -currently invariant in space and time and were obtained from -PFT-specific values (Bonan et al. 2002a). When the biogeochemistry model -is active, vegetation state (LAI, SAI, canopy top and bottom heights) -are calculated prognostically (see Chapter 14). +(:math:`L,\, S`) and canopy top and bottom heights (:math:`z_{top}`,\ :math:`z_{bot}` ) (Table 2.2). Separate leaf and +stem area indices and canopy heights are prescribed or calculated for each PFT. Daily leaf and stem area indices are obtained from gridded +datasets of monthly values (section 2.2.3). Canopy top and bottom heights are also obtained from gridded datasets. However, these are +currently invariant in space and time and were obtained from PFT-specific values (Bonan et al. 2002a). When the biogeochemistry model +is active, vegetation state (LAI, SAI, canopy top and bottom heights) are calculated prognostically (see Chapter 14). Table 2.2. Prescribed plant functional type heights @@ -219,30 +213,30 @@ Table 2.2. Prescribed plant functional type heights +-----------------------------------+------------------------+------------------------+ | Crop I | 0.5 | 0.01 | +-----------------------------------+------------------------+------------------------+ -| :math:`{}^{1}`\ Corn R | - | - | +| :sup:`1`\ Corn R | - | - | +-----------------------------------+------------------------+------------------------+ -| :math:`{}^{1}`\ Corn I | - | - | +| :sup:`1`\ Corn I | - | - | +-----------------------------------+------------------------+------------------------+ -| :math:`{}^{1}`\ Temp Cereal R | - | - | +| :sup:`1`\ Temp Cereal R | - | - | +-----------------------------------+------------------------+------------------------+ -| :math:`{}^{1}`\ Temp Cereal I | - | - | +| :sup:`1`\ Temp Cereal I | - | - | +-----------------------------------+------------------------+------------------------+ -| :math:`{}^{1}`\ Winter Cereal R | - | - | +| :sup:`1`\ Winter Cereal R | - | - | +-----------------------------------+------------------------+------------------------+ -| :math:`{}^{1}`\ Winter Cereal I | - | - | +| :sup:`1`\ Winter Cereal I | - | - | +-----------------------------------+------------------------+------------------------+ -| :math:`{}^{1}`\ Soybean R | - | - | +| :sup:`1`\ Soybean R | - | - | +-----------------------------------+------------------------+------------------------+ -| :math:`{}^{1}`\ Soybean I | - | - | +| :sup:`1`\ Soybean I | - | - | +-----------------------------------+------------------------+------------------------+ -:math:`{}^{1}`\ Determined by the crop model (Chapter 20) +:sup:`1`\ Determined by the crop model (Chapter 20) Phenology and vegetation burial by snow ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ When the biogeochemistry model is inactive, leaf and stem area indices -(m:math:`{}^{2}` leaf area m\ :math:`{}^{-2}` ground area) are updated +(m\ :sup:`2` leaf area m\ :sup:`-2` ground area) are updated daily by linearly interpolating between monthly values. Monthly PFT leaf area index values are developed from the 1-km MODIS-derived monthly grid cell average leaf area index of Myneni et al. (2002), as described in @@ -266,12 +260,9 @@ snow, :math:`A` is the remaining exposed leaf or stem area, {f_{veg}^{sno} = \frac{z_{sno} -z_{bot} }{z_{top} -z_{bot} } \qquad {\rm for\; tree\; and\; shrub}} \\ {f_{veg}^{sno} = \frac{\min \left(z_{sno} ,\, z_{c} \right)}{z_{c} } \qquad {\rm for\; grass\; and\; crop}} -where :math:`z_{sno} -z_{bot} \ge 0,{\rm \; }0\le f_{veg}^{sno} \le 1`, -:math:`z_{sno}` is the depth of snow (m) (section 7.2), and -:math:`z_{c} =0.2` is the snow depth when short vegetation is assumed to -be completely buried by snow (m). For numerical reasons, exposed leaf -and stem area are set to zero if less than 0.05. If the sum of exposed -leaf and stem area is zero, then the surface is treated as snow-covered +where :math:`z_{sno} -z_{bot} \ge 0,{\rm \; }0\le f_{veg}^{sno} \le 1`, :math:`z_{sno}` is the depth of snow (m) (section 7.2), and +:math:`z_{c} = 0.2` is the snow depth when short vegetation is assumed to be completely buried by snow (m). For numerical reasons, exposed leaf +and stem area are set to zero if less than 0.05. If the sum of exposed leaf and stem area is zero, then the surface is treated as snow-covered ground. Model Input Requirements @@ -299,44 +290,44 @@ Table 2.3. Atmospheric input to land model +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ | Field | variable name | units | +======================================================+================================================+=================================================+ -| :math:`{}^{1}`\ Reference height | :math:`z'_{atm}` | m | +| :sup:`1`\ Reference height | :math:`z'_{atm}` | m | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Zonal wind at :math:`z_{atm}` | :math:`u_{atm}` | m s\ :math:`{}^{-1}` | +| Zonal wind at :math:`z_{atm}` | :math:`u_{atm}` | m s\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Meridional wind at :math:`z_{atm}` | :math:`v_{atm}` | m s\ :math:`{}^{-1}` | +| Meridional wind at :math:`z_{atm}` | :math:`v_{atm}` | m s\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ | Potential temperature | :math:`\overline{\theta _{atm} }` | K | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Specific humidity at :math:`z_{atm}` | :math:`q_{atm}` | kg kg\ :math:`{}^{-1}` | +| Specific humidity at :math:`z_{atm}` | :math:`q_{atm}` | kg kg\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ | Pressure at :math:`z_{atm}` | :math:`P_{atm}` | Pa | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ | Temperature at :math:`z_{atm}` | :math:`T_{atm}` | K | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident longwave radiation | :math:`L_{atm} \, \downarrow` | W m\ :math:`{}^{-2}` | +| Incident longwave radiation | :math:`L_{atm} \, \downarrow` | W m\ :sup:`-2` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :math:`{}^{2}`\ Liquid precipitation | :math:`q_{rain}` | mm s\ :math:`{}^{-1}` | +| :sup:`2`\ Liquid precipitation | :math:`q_{rain}` | mm s\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :math:`{}^{2}`\ Solid precipitation | :math:`q_{sno}` | mm s\ :math:`{}^{-1}` | +| :sup:`2`\ Solid precipitation | :math:`q_{sno}` | mm s\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident direct beam visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}^{\mu }` | W m\ :math:`{}^{-2}` | +| Incident direct beam visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}^{\mu }` | W m\ :sup:`-2` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident direct beam near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}^{\mu }` | W m\ :math:`{}^{-2}` | +| Incident direct beam near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}^{\mu }` | W m\ :sup:`-2` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident diffuse visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}` | W m\ :math:`{}^{-2}` | +| Incident diffuse visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}` | W m\ :sup:`-2` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident diffuse near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}` | W m\ :math:`{}^{-2}` | +| Incident diffuse near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}` | W m\ :sup:`-2` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Carbon dioxide (CO:math:`{}_{2}`) concentration | :math:`c_{a}` | ppmv | +| Carbon dioxide (CO:sub:`2`) concentration | :math:`c_{a}` | ppmv | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :math:`{}^{3}`\ Aerosol deposition rate | :math:`D_{sp}` | kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}` | +| :sup:`3`\ Aerosol deposition rate | :math:`D_{sp}` | kg m\ :sup:`-2` s\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :math:`{}^{4}`\ Nitrogen deposition rate | :math:`NF_{ndep\_ s{\it min}n}` | g (N) m\ :math:`{}^{-2}` yr\ :math:`{}^{-1}` | +| :sup:`4`\ Nitrogen deposition rate | :math:`NF_{ndep\_ s{\it min}n}` | g (N) m\ :sup:`-2` yr\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :math:`{}^{5}`\ Lightning frequency | :math:`I_{l}` | flash km\ :math:`{}^{-2}` hr\ :math:`{}^{-1}` | +| :sup:`5`\ Lightning frequency | :math:`I_{l}` | flash km\ :sup:`-2` hr\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -:math:`{}^{1}`\ The atmospheric reference height received from the +:sup:`1`\ The atmospheric reference height received from the atmospheric model :math:`z'_{atm}` is assumed to be the height above the surface as defined by the roughness length :math:`z_{0}` plus displacement height :math:`d`. Thus, the reference height used for flux @@ -346,12 +337,12 @@ reference heights for temperature, wind, and specific humidity :math:`z_{atm,\, w}` ) are required. These are set equal to\ :math:`z_{atm}` . -:math:`{}^{2}`\ The placeCAM provides convective and large-scale liquid +:sup:`2`\ The placeCAM provides convective and large-scale liquid and solid precipitation, which are added to yield total liquid precipitation :math:`q_{rain}` and solid precipitation :math:`q_{sno}` . -:math:`{}^{3}`\ There are 14 aerosol deposition rates required depending +:sup:`3`\ There are 14 aerosol deposition rates required depending on species and affinity for bonding with water; 8 of these are dust deposition rates (dry and wet rates for 4 dust size bins, :math:`D_{dst,\, dry1} ,\, D_{dst,\, dry2} ,\, D_{dst,\, dry3} ,\, D_{dst,\, dry4}` , @@ -368,41 +359,41 @@ time-varying (annual cycle or transient), globally-gridded deposition file defined in the namelist (see the CLM4.5 User’s Guide). Aerosol deposition rates were calculated in a transient 1850-2009 CAM simulation (at a resolution of 1.9x2.5x26L) with interactive chemistry (troposphere -and stratosphere) driven by CCSM3 20\ :math:`{}^{th}` century +and stratosphere) driven by CCSM3 20\ :sup:`th` century sea-surface temperatures and emissions (Lamarque et al. 2010) for short-lived gases and aerosols; observed concentrations were specified -for methane, N\ :math:`{}_{2}`\ O, the ozone-depleting substances (CFCs) -,and CO\ :math:`{}_{2}`. The fluxes are used by the snow-related +for methane, N\ :sub:`2`\ O, the ozone-depleting substances (CFCs) +,and CO\ :sub:`2`. The fluxes are used by the snow-related parameterizations (Chapters 3 and 7). -:math:`{}^{4}`\ The nitrogen deposition rate is required by the +:sup:`4`\ The nitrogen deposition rate is required by the biogeochemistry model when active and represents the total deposition of mineral nitrogen onto the land surface, combining deposition of -NO\ :math:`{}_{y}` and NH\ :math:`{}_{x}`. The rate is supplied either +NO\ :sub:`y` and NH\ :sub:`x`. The rate is supplied either as a time-invariant spatially-varying annual mean rate or time-varying for a transient simulation. Nitrogen deposition rates were calculated from the same CAM chemistry simulation that generated the aerosol deposition rates. -:math:`{}^{5}`\ Climatological 3-hourly lightning frequency at -:math:`\sim`\ 1.8\ :math:`{}^{o}` resolution is provided, which was +:sup:`5`\ Climatological 3-hourly lightning frequency at +:math:`\sim`\ 1.8\ :sup:`o` resolution is provided, which was calculated via bilinear interpolation from 1995-2011 NASA LIS/OTD grid -product v2.2 (http://ghrc.msfc.nasa.gov) 2-hourly, 2.5\ :math:`{}^{o}` +product v2.2 (http://ghrc.msfc.nasa.gov) 2-hourly, 2.5\ :sup:`o` lightning frequency data. In future versions of the model, lightning data may be obtained directly from the atmosphere model. -Density of air (:math:`\rho _{atm}` ) (kg m\ :math:`{}^{-3}`) is also +Density of air (:math:`\rho _{atm}` ) (kg m\ :sup:`-3`) is also required but is calculated directly from :math:`\rho _{atm} =\frac{P_{atm} -0.378e_{atm} }{R_{da} T_{atm} }` where :math:`P_{atm}` is atmospheric pressure (Pa), :math:`e_{atm}` is atmospheric vapor pressure (Pa), :math:`R_{da}` is the gas constant for -dry air (J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), and +dry air (J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), and :math:`T_{atm}` is the atmospheric temperature (K). The atmospheric vapor pressure :math:`e_{atm}` is derived from atmospheric specific -humidity :math:`q_{atm}` (kg kg\ :math:`{}^{-1}`) as +humidity :math:`q_{atm}` (kg kg\ :sup:`-1`) as :math:`e_{atm} =\frac{q_{atm} P_{atm} }{0.622+0.378q_{atm} }` . -The O\ :math:`{}_{2}` partial pressure (Pa) is required but is +The O\ :sub:`2` partial pressure (Pa) is required but is calculated from molar ratio and the atmospheric pressure :math:`P_{atm}` as :math:`o_{i} =0.209P_{atm}` . @@ -411,17 +402,17 @@ Table 2.4. Land model output to atmospheric model +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Field | Variable name | units | +=======================================+================================================+==============================================================+ -| :math:`{}^{1}`\ Latent heat flux | :math:`\lambda _{vap} E_{v} +\lambda E_{g}` | W m\ :math:`{}^{-2}` | +| :sup:`1`\ Latent heat flux | :math:`\lambda _{vap} E_{v} +\lambda E_{g}` | W m\ :sup:`-2` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Sensible heat flux | :math:`H_{v} +H_{g}` | W m\ :math:`{}^{-2}` | +| Sensible heat flux | :math:`H_{v} +H_{g}` | W m\ :sup:`-2` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Water vapor flux | :math:`E_{v} +E_{g}` | mm s\ :math:`{}^{-1}` | +| Water vapor flux | :math:`E_{v} +E_{g}` | mm s\ :sup:`-1` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Zonal momentum flux | :math:`\tau _{x}` | kg m\ :math:`{}^{-1}` s\ :math:`{}^{-2}` | +| Zonal momentum flux | :math:`\tau _{x}` | kg m\ :sup:`-1` s\ :sup:`-2` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Meridional momentum flux | :math:`\tau _{y}` | kg m\ :math:`{}^{-1}` s\ :math:`{}^{-2}` | +| Meridional momentum flux | :math:`\tau _{y}` | kg m\ :sup:`-1` s\ :sup:`-2` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Emitted longwave radiation | :math:`L\, \uparrow` | W m\ :math:`{}^{-2}` | +| Emitted longwave radiation | :math:`L\, \uparrow` | W m\ :sup:`-2` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Direct beam visible albedo | :math:`I\, \uparrow _{vis}^{\mu }` | - | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ @@ -431,33 +422,33 @@ Table 2.4. Land model output to atmospheric model +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Diffuse near-infrared albedo | :math:`I\, \uparrow _{nir}` | - | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Absorbed solar radiation | :math:`\vec{S}` | W m\ :math:`{}^{-2}` | +| Absorbed solar radiation | :math:`\vec{S}` | W m\ :sup:`-2` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Radiative temperature | :math:`T_{rad}` | K | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Temperature at 2 meter height | :math:`T_{2m}` | K | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Specific humidity at 2 meter height | :math:`q_{2m}` | kg kg\ :math:`{}^{-1}` | +| Specific humidity at 2 meter height | :math:`q_{2m}` | kg kg\ :sup:`-1` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Snow water equivalent | :math:`W_{sno}` | m | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Aerodynamic resistance | :math:`r_{am}` | s m\ :math:`{}^{-1}` | +| Aerodynamic resistance | :math:`r_{am}` | s m\ :sup:`-1` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Friction velocity | :math:`u_{*}` | m s\ :math:`{}^{-1}` | +| Friction velocity | :math:`u_{*}` | m s\ :sup:`-1` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| :math:`{}^{2}`\ Dust flux | :math:`F_{j}` | kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}` | +| :sup:`2`\ Dust flux | :math:`F_{j}` | kg m\ :sup:`-2` s\ :sup:`-1` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Net ecosystem exchange | NEE | kgCO\ :math:`{}_{2}` m\ :math:`{}^{-2}` s\ :math:`{}^{-1}` | +| Net ecosystem exchange | NEE | kgCO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -:math:`{}^{1}`\ :math:`\lambda _{vap}` is the latent heat of -vaporization (J kg\ :math:`{}^{-1}`) (Table 2.6) and :math:`\lambda` is +:sup:`1`\ :math:`\lambda _{vap}` is the latent heat of +vaporization (J kg\ :sup:`-1`) (Table 2.6) and :math:`\lambda` is either the latent heat of vaporization :math:`\lambda _{vap}` or latent -heat of sublimation :math:`\lambda _{sub}` (J kg\ :math:`{}^{-1}`) +heat of sublimation :math:`\lambda _{sub}` (J kg\ :sup:`-1`) (Table 2.6) depending on the liquid water and ice content of the top snow/soil layer (section 5.4). -:math:`{}^{2}`\ There are :math:`j=1,\ldots ,4` dust transport bins. +:sup:`2`\ There are :math:`j=1,\ldots ,4` dust transport bins. Initialization ^^^^^^^^^^^^^^^^^^^^ @@ -485,9 +476,9 @@ surface ground temperature :math:`T_{g}` and soil layer temperature :math:`T_{i}` , for :math:`i=1,\ldots ,N_{levgrnd}` , of 274 K, vegetation temperature :math:`T_{v}` of 283 K, no snow or canopy water (:math:`W_{sno} =0`, :math:`W_{can} =0`), and volumetric soil water -content :math:`\theta _{i} =0.15` mm\ :math:`{}^{3}` mm\ :math:`{}^{-3}` +content :math:`\theta _{i} =0.15` mm\ :sup:`3` mm\ :sup:`-3` for layers :math:`i=1,\ldots ,N_{levsoi}` and :math:`\theta _{i} =0.0` -mm\ :math:`{}^{3}` mm\ :math:`{}^{-3}` for layers +mm\ :sup:`3` mm\ :sup:`-3` for layers :math:`i=N_{levsoi} +1,\ldots ,N_{levgrnd}` . placeLake temperatures (:math:`T_{g}` and :math:`T_{i}` ) are initialized at 277 K and :math:`W_{sno} =0`. @@ -497,12 +488,12 @@ Glacier temperatures (:math:`T_{g} =T_{snl+1}` and :math:`T_{i}` for of the number of snow layers, i.e., :math:`snl` ranges from –5 to 0) are initialized to 250 K with a snow water equivalent :math:`W_{sno} =1000` mm, snow depth :math:`z_{sno} =\frac{W_{sno} }{\rho _{sno} }` (m) where -:math:`\rho _{sno} =250` kg m\ :math:`{}^{-3}` is an initial estimate +:math:`\rho _{sno} =250` kg m\ :sup:`-3` is an initial estimate for the bulk density of snow, and :math:`\theta _{i}` \ =1.0 for :math:`i=1,\ldots ,N_{levgrnd}` . The snow layer structure (e.g., number of snow layers :math:`snl` and layer thickness) is initialized based on the snow depth (section 6.1). The snow liquid water and ice contents (kg -m\ :math:`{}^{-2}`) are initialized as :math:`w_{liq,\, i} =0` and +m\ :sup:`-2`) are initialized as :math:`w_{liq,\, i} =0` and :math:`w_{ice,\, i} =\Delta z_{i} \rho _{sno}` , respectively, where :math:`i=snl+1,\ldots ,0` are the snow layers, and :math:`\Delta z_{i}` is the thickness of snow layer :math:`i` (m). The soil liquid water and @@ -512,7 +503,7 @@ ice contents are initialized as :math:`w_{liq,\, i} =0` and :math:`w_{liq,\, i} =\Delta z_{i} \rho _{liq} \theta _{i}` and :math:`w_{ice,\, i} =0` for :math:`T_{i} >T_{f}` , where :math:`\rho _{ice}` and :math:`\rho _{liq}` are the densities of ice -and liquid water (kg m\ :math:`{}^{-3}`) (Table 2.6), and :math:`T_{f}` +and liquid water (kg m\ :sup:`-3`) (Table 2.6), and :math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). All vegetated and glacier land units are initialized with water stored in the unconfined aquifer and unsaturated soil :math:`W_{a} =4000` mm and water table @@ -540,46 +531,46 @@ resolution +--------------------------------------------+---------------------------+ | Surface Field | Resolution | +============================================+===========================+ -| Percent glacier | 0.05\ :math:`\circ` | +| Percent glacier | 0.05\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Percent lake and lake depth | 0.05\ :math:`\circ` | +| Percent lake and lake depth | 0.05\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Percent urban | 0.05\ :math:`\circ` | +| Percent urban | 0.05\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Percent plant functional types (PFTs) | 0.05\ :math:`\circ` | +| Percent plant functional types (PFTs) | 0.05\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Monthly leaf and stem area index | 0.5\ :math:`\circ` | +| Monthly leaf and stem area index | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Canopy height (top, bottom) | 0.5\ :math:`\circ` | +| Canopy height (top, bottom) | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Soil color | 0.5\ :math:`\circ` | +| Soil color | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Percent sand, percent clay | 0.083\ :math:`{}^\circ` | +| Percent sand, percent clay | 0.083\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Soil organic matter density | 0.083\ :math:`\circ` | +| Soil organic matter density | 0.083\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Maximum fractional saturated area | 0.125\ :math:`\circ` | +| Maximum fractional saturated area | 0.125\ :sup:`o` | +--------------------------------------------+---------------------------+ | Elevation | 1km | +--------------------------------------------+---------------------------+ | Slope | 1km | +--------------------------------------------+---------------------------+ -| Biogenic Volatile Organic Compounds | 0.5\ :math:`{}^\circ` | +| Biogenic Volatile Organic Compounds | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Crop Irrigation | 0.083\ :math:`{}^\circ` | +| Crop Irrigation | 0.083\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Managed crops | 0.5\ :math:`{}^\circ` | +| Managed crops | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Population density | 0.5\ :math:`{}^\circ` | +| Population density | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Gross domestic production | 0.5\ :math:`{}^\circ` | +| Gross domestic production | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Peat area fraction | 0.5\ :math:`{}^\circ` | +| Peat area fraction | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -| Peak month of agricultural waste burning | 0.5\ :math:`{}^\circ` | +| Peak month of agricultural waste burning | 0.5\ :sup:`o` | +--------------------------------------------+---------------------------+ -At the base spatial resolution of 0.05\ :math:`\circ`, the percentage of +At the base spatial resolution of 0.05\ :sup:`o`, the percentage of each PFT is defined with respect to the vegetated portion of the grid cell and the sum of the PFTs is 100%. The percent lake, wetland, glacier, and urban at their base resolution are specified with respect @@ -619,12 +610,12 @@ elevation are needed when running CLM4 with multiple glacier elevation classes. Percent lake and lake depth are area-averaged from the 90-second -resolution data of Kourzeneva (2009, 2010) to the 0.05\ :math:`{}^\circ` +resolution data of Kourzeneva (2009, 2010) to the 0.05\ :sup:`o` resolution using the MODIS land-mask. Percent urban is derived from LandScan 2004, a population density dataset derived from census data, nighttime lights satellite observations, road proximity and slope (Dobson et al. 2000) as described by Jackson et al. (2010) at 1km -resolution and aggregated to 0.05\ :math:`{}^\circ`. A number of urban +resolution and aggregated to 0.05\ :sup:`o`. A number of urban radiative, thermal, and morphological fields are also required and are obtained from Jackson et al. (2010). Their description can be found in Table 3 of the Community Land Model Urban (CLMU) technical note (Oleson @@ -651,7 +642,7 @@ Geosphere-Biosphere Programme (IGBP) soil dataset (Global Soil Data Task each soil layer were used to create a mineral soil texture dataset (Bonan et al. 2002b). Soil organic matter data is merged from two sources. The majority of the globe is from ISRIC-WISE (Batjes, 2006). -The high latitudes come from the 0.25\ :math:`{}^\circ` version of the +The high latitudes come from the 0.25\ :sup:`o` version of the Northern Circumpolar Soil Carbon Database (Hugelius et al. 2012). Both datasets report carbon down to 1m depth. Carbon is partitioned across the top seven CLM4 layers (:math:`\sim`\ 1m depth) as in Lawrence and @@ -659,12 +650,12 @@ Slater (2008). The maximum fractional saturated area (:math:`f_{\max }` ) is used in determining surface runoff and infiltration (section 7.3). Maximum -fractional saturated area at 0.125\ :math:`{}^{o}` resolution is +fractional saturated area at 0.125\ :sup:`o` resolution is calculated from 1-km compound topographic indices (CTIs) based on the USGS HYDRO1K dataset (Verdin and Greenlee 1996) following the algorithm in Niu et al. (2005). :math:`f_{\max }` is the ratio between the number of 1-km pixels with CTIs equal to or larger than the mean CTI and the -total number of pixels in a 0.125\ :math:`{}^\circ` grid cell. See +total number of pixels in a 0.125\ :sup:`o` grid cell. See section 7.3.1 and Li et al. (2013b) for further details. Slope and elevation are also obtained from the USGS HYDRO1K 1-km dataset (Verdin and Greenlee 1996). Slope is used in the River Transport Model (Chapter @@ -719,21 +710,21 @@ beneath irrigated crops. Several input datasets are required for the fire model (Li et al. 2013a) including population density, gross domestic production, peat area fraction, and peak month of agricultural waste burning. Population -density at 0.5\ :math:`{}^{o}` resolution for 1850-2100 combines 5-min +density at 0.5\ :sup:`o` resolution for 1850-2100 combines 5-min resolution decadal population density data for 1850–1980 from the Database of the Global Environment version 3.1 (HYDEv3.1) with -0.5\ :math:`{}^{o}` resolution population density data for 1990, 1995, +0.5\ :sup:`o` resolution population density data for 1990, 1995, 2000, and 2005 from the Gridded Population of the World version 3 dataset (GPWv3) (CIESIN, 2005). Gross Domestic Production (GDP) per -capita in 2000 at 0.5\ :math:`{}^{o}` is from Van Vuuren et al. (2006), +capita in 2000 at 0.5\ :sup:`o` is from Van Vuuren et al. (2006), which is the base-year GDP data for IPCC-SRES and derived from country-level World Bank’s World Development Indicators (WDI) measured in constant 1995 US$ (World Bank, 2004) and the UN Statistics Database -(UNSTAT, 2005). The peatland area fraction at 0.5\ :math:`{}^{o}` +(UNSTAT, 2005). The peatland area fraction at 0.5\ :sup:`o` resolution is derived from three vector datasets: peatland data in Indonesia and Malaysian Borneo (Olson et al. 2001); peatland data in Canada (Tarnocai et al. 2011); and bog, fen and mire data in boreal -regions (north of 45\ :math:`{}^{o}`\ N) outside Canada provided by the +regions (north of 45\ :sup:`o`\ N) outside Canada provided by the Global Lakes and Wetlands Database (GLWD) (Lehner and Döll, 2004). The climatological peak month for agricultural waste burning is from van der Werf et al. (2010). @@ -753,30 +744,30 @@ of the components in the coupled modeling system, are presented in Table :widths: 40, 20, 20, 20 "Pi", :math:`\pi`, 3.14159265358979323846, "\-" - "Acceleration of gravity", :math:`g`, 9.80616, m s\ :math:`{}^{-2}` + "Acceleration of gravity", :math:`g`, 9.80616, m s\ :sup:`-2` "Standard pressure", :math:`P_{std}`, 101325, "Pa" - "Stefan-Boltzmann constant", :math:`\sigma`, 5.67 :math:`\times 10^{-8}`, W m :math:`{}^{-2}` K :math:`{}^{-4}` - "Boltzmann constant", :math:`\kappa`, 1.38065 :math:`\times 10^{-23}`, J K :math:`{}^{-1}` molecule :math:`{}^{-1}` - "Avogadro’s number", :math:`N_{A}`, 6.02214 :math:`\times 10^{26}`, molecule kmol\ :math:`{}^{-1}` - "Universal gas constant", :math:`R_{gas}`, :math:`N_{A} \kappa`, J K :math:`{}^{-1}` kmol :math:`{}^{-1}` - "Molecular weight of dry air", :math:`MW_{da}`, 28.966, kg kmol :math:`{}^{-1}` - "Dry air gas constant", :math:`R_{da}`, :math:`{R_{gas} \mathord{\left/ {\vphantom {R_{gas} MW_{da} }} \right. \kern-\nulldelimiterspace} MW_{da} }`, J K :math:`{}^{-1}` kg :math:`{}^{-1}` - "Molecular weight of water vapor", :math:`MW_{wv}`, 18.016, kg kmol :math:`{}^{-1}` - "Water vapor gas constant", :math:`R_{wv}`, :math:`{R_{gas} \mathord{\left/ {\vphantom {R_{gas} MW_{wv} }} \right. \kern-\nulldelimiterspace} MW_{wv} }`, J K :math:`{}^{-1}` kg :math:`{}^{-1}` + "Stefan-Boltzmann constant", :math:`\sigma`, 5.67 :math:`\times 10^{-8}`, W m :sup:`-2` K :math:`{}^{-4}` + "Boltzmann constant", :math:`\kappa`, 1.38065 :math:`\times 10^{-23}`, J K :sup:`-1` molecule :sup:`-1` + "Avogadro’s number", :math:`N_{A}`, 6.02214 :math:`\times 10^{26}`, molecule kmol\ :sup:`-1` + "Universal gas constant", :math:`R_{gas}`, :math:`N_{A} \kappa`, J K :sup:`-1` kmol :sup:`-1` + "Molecular weight of dry air", :math:`MW_{da}`, 28.966, kg kmol :sup:`-1` + "Dry air gas constant", :math:`R_{da}`, :math:`{R_{gas} \mathord{\left/ {\vphantom {R_{gas} MW_{da} }} \right. \kern-\nulldelimiterspace} MW_{da} }`, J K :sup:`-1` kg :sup:`-1` + "Molecular weight of water vapor", :math:`MW_{wv}`, 18.016, kg kmol :sup:`-1` + "Water vapor gas constant", :math:`R_{wv}`, :math:`{R_{gas} \mathord{\left/ {\vphantom {R_{gas} MW_{wv} }} \right. \kern-\nulldelimiterspace} MW_{wv} }`, J K :sup:`-1` kg :sup:`-1` "Von Karman constant", :math:`k`, 0.4, "\-" "Freezing temperature of fresh water", :math:`T_{f}`, 273.5, K - "Density of liquid water", :math:`\rho _{liq}`, 1000, kg m :math:`{}^{-3}` - "Density of ice", :math:`\rho _{ice}`, 917, kg m :math:`{}^{-3}` - "Specific heat capacity of dry air", :math:`C_{p}`, 1.00464 :math:`\times 10^{3}`, J kg :math:`{}^{-1}` K :math:`{}^{-1}` - "Specific heat capacity of water", :math:`C_{liq}`, 4.188 :math:`\times 10^{3}`, J kg :math:`{}^{-1}` K :math:`{}^{-1}` - "Specific heat capacity of ice", :math:`C_{ice}`, 2.11727 :math:`\times 10^{3}`, J kg :math:`{}^{-1}` K :math:`{}^{-1}` - "Latent heat of vaporization", :math:`\lambda _{vap}`, 2.501 :math:`\times 10^{6}`, J kg :math:`{}^{-1}` - "Latent heat of fusion", :math:`L_{f}`, 3.337 :math:`\times 10^{5}`, J kg :math:`{}^{-1}` - "Latent heat of sublimation", :math:`\lambda _{sub}`, :math:`\lambda _{vap} +L_{f}`, J kg :math:`{}^{-1}` - :math:`{}^{1}` "Thermal conductivity of water", :math:`\lambda _{liq}`, 0.57, W m :math:`{}^{-1}` K :math:`{}^{-1}` - :math:`{}^{1}` "Thermal conductivity of ice", :math:`\lambda _{ice}`, 2.29, W m :math:`{}^{-1}` K :math:`{}^{-1}` - :math:`{}^{1}` "Thermal conductivity of air", :math:`\lambda _{air}`, 0.023 W m :math:`{}^{-1}` K :math:`{}^{-1}` + "Density of liquid water", :math:`\rho _{liq}`, 1000, kg m :sup:`-3` + "Density of ice", :math:`\rho _{ice}`, 917, kg m :sup:`-3` + "Specific heat capacity of dry air", :math:`C_{p}`, 1.00464 :math:`\times 10^{3}`, J kg :sup:`-1` K :sup:`-1` + "Specific heat capacity of water", :math:`C_{liq}`, 4.188 :math:`\times 10^{3}`, J kg :sup:`-1` K :sup:`-1` + "Specific heat capacity of ice", :math:`C_{ice}`, 2.11727 :math:`\times 10^{3}`, J kg :sup:`-1` K :sup:`-1` + "Latent heat of vaporization", :math:`\lambda _{vap}`, 2.501 :math:`\times 10^{6}`, J kg :sup:`-1` + "Latent heat of fusion", :math:`L_{f}`, 3.337 :math:`\times 10^{5}`, J kg :sup:`-1` + "Latent heat of sublimation", :math:`\lambda _{sub}`, :math:`\lambda _{vap} +L_{f}`, J kg :sup:`-1` + :sup:`1` "Thermal conductivity of water", :math:`\lambda _{liq}`, 0.57, W m :sup:`-1` K :sup:`-1` + :sup:`1` "Thermal conductivity of ice", :math:`\lambda _{ice}`, 2.29, W m :sup:`-1` K :sup:`-1` + :sup:`1` "Thermal conductivity of air", :math:`\lambda _{air}`, 0.023 W m :sup:`-1` K :sup:`-1` "Radius of the earth", :math:`R_{e}`, 6.37122, :math:`\times 10^{6}` m -:math:`{}^{1}`\ Not shared by other components of the coupled modeling system. +:sup:`1`\ Not shared by other components of the coupled modeling system. diff --git a/doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst b/doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst index 2c378b3aec..570028bc8b 100644 --- a/doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst +++ b/doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst @@ -1,5 +1,3 @@ -**** - Crops and Irrigation ======================== @@ -33,7 +31,7 @@ Drewniak et al. (2013). The crop model ------------------- -20.2.1 Introduction +Introduction ^^^^^^^^^^^^^^^^^^^ Groups developing Earth System Models generally account for the human @@ -49,11 +47,11 @@ biogeophysical and biogeochemical effects not only of natural but also human-managed land cover. AgroIBIS is a state-of-the-art land surface model with options to -simulate dynamic vegetation (Kucharik et al. ** 2000) and interactive +simulate dynamic vegetation (Kucharik et al. 2000) and interactive crop management (Kucharik and Brye 2003). The interactive crop management parameterizations from AgroIBIS (March 2003 version) were coupled as a proof-of-concept to the Community Land Model version 3 -[CLM3.0, Oleson et al. ** (2004)] (not published), then coupled to the +[CLM3.0, Oleson et al. (2004)] (not published), then coupled to the CLM3.5 (Levis et al. 2009) and later released to the community with CLM4CN (Levis et al. 2012). @@ -63,17 +61,15 @@ simulated biogeophysics and biogeochemistry. These advances may improve fully coupled simulations with the Community Earth System Model (CESM), while helping human societies answer questions about changing food, energy, and water resources in response to climate, environmental, land -use, and land management change (e.g., Kucharik and Brye 2003; Lobell et -al. ** 2006). +use, and land management change (e.g., Kucharik and Brye 2003; Lobell et al. 2006). -20.2.2 Crop plant functional types +Crop plant functional types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CLM’s default list of plant functional types (pfts) includes an unmanaged crop (Table 2.1) treated as a second C3 grass. The unmanaged crop has grid cell coverage assigned from satellite data, as do all -natural pfts when CLM’s dynamic vegetation model (CNDV; Castillo et al. -2012) is not active. +natural pfts when CLM’s dynamic vegetation model (CNDV; Castillo et al. 2012) is not active. The new crop pfts used in the CLM get grid cell coverage from the present-day crop dataset of Portmann et al. (2010). We assign these @@ -97,7 +93,7 @@ CLM setting). Managed crop PFTs in the human managed land unit do not share soil columns and thus permit for differences in land management between crops. -20.2.3 Phenology +Phenology ^^^^^^^^^^^^^^^^ CLM4.5CN includes evergreen, seasonally deciduous (responding to changes @@ -111,104 +107,102 @@ continues from leaf emergence to the beginning of grain fill, and phase 3 starts from the beginning of grain fill and ends with physiological maturity and harvest. -20.2.3.1 Planting +Planting ''''''''''''''''' Corn and temperate cereals must meet the following requirements between -April 1\ :math:`{}^{st}` and June 14\ :math:`{}^{th}` for planting in -the northern hemisphere (NH): +April 1\ :sup:`st` and June 14\ :sup:`th` for planting in the northern hemisphere (NH): .. math:: + :label: ZEqnNum568682 - \label{ZEqnNum568682} - \begin{array}{l} {T_{10d} >T_{p} } \\ {T_{10d}^{\min } >T_{p}^{\min } } \\ {GDD_{8} \ge GDD_{\min } } \end{array} + \begin{array}{l} + {T_{10d} >T_{p} } \\ + {T_{10d}^{\min } >T_{p}^{\min } } \\ + {GDD_{8} \ge GDD_{\min } } + \end{array} -where *T*\ :math:`{}_{10}`\ *:math:`{}_{d}`* is the 10-day running mean -of *T*\ :math:`{}_{2}`\ *:math:`{}_{m}`*, (the simulated 2-m air -temperature at every model time step) and :math:`T_{10d}^{\min }` is +where :math:`{T}_{10d}` is the 10-day running mean of :math:`{T}_{2m}`, (the simulated 2-m air +temperature at every model time step) and :math:`T_{10d}^{\min}` is the 10-day running mean of :math:`T_{2m}^{\min }` (the daily minimum of -*T*\ :math:`{}_{2}`\ *:math:`{}_{m}`*). *T\ :math:`{}_{p}`* and -:math:`T_{p}^{\min }` are crop-specific coldest planting temperatures -(Table 20.1), *GDD*\ :math:`{}_{8}` is the 20-year running mean growing -degree-days (units are degree-days or :math:`{}^\circ`\ days) tracked -from April through September (NH) base 8\ :math:`{}^\circ`\ C with -maximum daily increments of 30\ :math:`{}^\circ`\ days (see Eq. ), and -*GDD*\ :math:`{}_{min }`\ is the minimum growing degree day requirement +:math:`{T}_{2m}`. :math:`{T}_{p}` and :math:`T_{p}^{\min }` are crop-specific coldest planting temperatures +(Table 20.1), :math:`{GDD}_{8}` is the 20-year running mean growing +degree-days (units are degree-days or :sup:`o` days) tracked +from April through September (NH) base 8\ :sup:`o` C with +maximum daily increments of 30\ :sup:`o` days (see Eq.XXX ), and +:math:`{GDD}_{min }`\ is the minimum growing degree day requirement (Table 20.1). Soy must meet the same requirements but between May -1\ :math:`{}^{st}` and June 14\ :math:`{}^{th}` for planting. If the -requirements in Eq. are not met by June 14\ :math:`{}^{th}`, then corn, +1\ :sup:`st` and June 14\ :sup:`th` for planting. If the +requirements in Eq. are not met by June 14\ :sup:`th`, then corn, soybean, and temperate cereals are still planted on June -15\ :math:`{}^{th}` as long as *GDD*\ :math:`{}_{8}`\ :math:`>`\ 0. In +15\ :sup:`th` as long as :math:`{GDD}_{8} > 0`. In the southern hemisphere (SH) the NH requirements apply 6 months later. -*GDD*\ :math:`{}_{8}` does not change as quickly as -*T*\ :math:`{}_{10}`\ *:math:`{}_{d}`* and :math:`T_{10d}^{\min }` , so +:math:`{GDD}_{8}` does not change as quickly as :math:`{T}_{10d}` and :math:`T_{10d}^{\min }`, so it determines whether the crop can be planted in a grid cell, while the two faster-changing variables determine when the crop may be planted. -At planting, each crop is assigned 1 g leaf C m\ :math:`{}^{-2}` pft +At planting, each crop is assigned 1 g leaf C m\ :sup:`-2` pft column area to be transferred to the leaves upon leaf emergence. An equivalent amount of seed leaf N is assigned given the pft’s C to N -ratio for leaves (*CN\ :math:`{}_{leaf}`*). (This differs from AgroIBIS, +ratio for leaves (:math:`{CN}_{leaf}`). (This differs from AgroIBIS, which uses a seed leaf area index instead of seed C.) At planting, the model updates the average growing degree-days necessary for the crop to reach vegetative and physiological maturity, -*GDD*\ :math:`{}_{mat}`, according to the following AgroIBIS rules: +:math:`{GDD}_{mat}`, according to the following AgroIBIS rules: .. math:: + :label: 20.2) - \label{20.2)} \begin{array}{l} {GDD_{{\rm mat}}^{{\rm corn}} =0.85GDD_{{\rm 8}} {\rm \; \; \; and\; \; \; 950}` 0, and *:math:`\beta`\ :math:`{}_{t}`* :math:`<` 1, -i.e., water is limiting for photosynthesis (see section 8.4). +leaf area :math:`>` 0, and :math:`\beta_{t} < 1`, i.e., water is limiting for photosynthesis (see section 8.4). If irrigation is required, the model computes the deficit between the current soil moisture content and a target soil moisture content; this deficit is the amount of water that will be added through irrigation. The target soil moisture content in each soil layer *i* -(*w\ :math:`{}_{target,i}`*, kg m\ :math:`{}^{-2}`) is a weighted +(:math:`{s}_{target,i}`, kg m\ :sup:`-2`) is a weighted average of the minimum soil moisture content that results in no water -stress in that layer (*w\ :math:`{}_{o,i}`*, kg m\ :math:`{}^{-2}`) and -the soil moisture content at saturation in that layer -(*w\ :math:`{}_{sat,i}`*, kg m\ :math:`{}^{-2}`): +stress in that layer (:math:`{s}_{o,i}`, kg m\ :sup:`-2`) and +the soil moisture content at saturation in that layer (:math:`{w}_{sat,i}`, kg m\ :sup:`-2`): .. math:: + :label: 20.7) - \label{20.7)} w_{target,i} =(1-0.7)\cdot w_{o,i} +0.7\cdot w_{sat,i} -*w\ :math:`{}_{o,i}`* is determined by inverting equation 8.19 in Oleson -et al. (2010a) to solve for the value of *s\ :math:`{}_{i}`* (soil -wetness) that makes *:math:`\Psi`\ :math:`{}_{i}`* = -*:math:`\Psi`\ :math:`{}_{o}`* (where *:math:`\Psi`\ :math:`{}_{i}`* is -the soil water matric potential and *:math:`\Psi`\ :math:`{}_{o}`* is +:math:`{w}_{o,i}` is determined by inverting equation 8.19 in Oleson +et al. (2010a) to solve for the value of :math:`{s}_{i}` (soil +wetness) that makes :math:`\Psi_{i} = \Psi_{o}` (where :math:`\Psi_{i}` is +the soil water matric potential and :math:`\Psi_{o}` is the soil water potential when stomata are fully open), and then -converting this value to units of kg m\ :math:`{}^{-2}`. -*w\ :math:`{}_{sat,i}`* is calculated simply by converting effective -porosity (section 7.4) to units of kg m\ :math:`{}^{-2}`. The value 0.7 +converting this value to units of kg m\ :sup:`-2`. +:math:`{w}_{sat,i}` is calculated simply by converting effective +porosity (section 7.4) to units of kg m\ :sup:`-2`. The value 0.7 was determined empirically, in order to give global, annual irrigation amounts that approximately match observed gross irrigation water use around the year 2000 (i.e., total water withdrawals for irrigation: -:math:`\sim` 2500 – 3000 km\ :math:`{}^{3}` year\ :math:`{}^{-1}` -(Shiklomanov 2000)). The total water deficit (*w\ :math:`{}_{deficit}`*, -kg m\ :math:`{}^{-2}`) of the column is then determined by: +:math:`\sim` 2500 – 3000 km\ :sup:`3` year\ :sup:`-1` +(Shiklomanov 2000)). The total water deficit (:math:`{w}_{deficit}`, +kg m\ :sup:`-2`) of the column is then determined by: .. math:: + :label: 20.8) - \label{20.8)} w_{deficit} =\sum _{i}\max \left(w_{target,i} -w_{liq,i} ,0\right) -where *w\ :math:`{}_{liq,i}`* (kg m\ :math:`{}^{-2}`) is the current +where :math:`{w}_{liq,i}` (kg m\ :sup:`-2`) is the current soil water content of layer *i* (Chapter 7). The max function means that a surplus in one layer cannot make up for a deficit in another layer. The sum is taken only over soil layers that contain roots. In addition, @@ -475,17 +471,17 @@ if the temperature of any soil layer is below freezing, then the sum only includes layers above the top-most frozen soil layer. The amount of water added to this column through irrigation is then -equal to *w\ :math:`{}_{deficit}`*. This irrigation is applied at a +equal to :math:`{w}_{deficit}`. This irrigation is applied at a constant rate over the following four hours. Irrigation water is applied directly to the ground surface, bypassing canopy interception (i.e., -added to *q\ :math:`{}_{grnd,liq}`*: section 7.1). Added irrigation is -removed from total liquid runoff (*R\ :math:`{}_{liq}`*: Chapter 11), +added to :math:`{q}_{grnd,liq}`: section 7.1). Added irrigation is +removed from total liquid runoff ( :math:`{R}_{liq}`: Chapter 11), simulating removal from nearby rivers. The details about what is new in CLM4.5 -------------------------------------------- -20.4.1 Interactive irrigation for corn, temperate cereals, and soybean +Interactive irrigation for corn, temperate cereals, and soybean ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CLM4.0 included interactive irrigation only for the generic C3 crops, @@ -529,7 +525,7 @@ or without irrigation. In simulations without irrigation, the rainfed and irrigated crops merge into just rainfed crops at run time. Surface datasets with 16 pfts can be used for all other CLM simulations. -20.4.2 Interactive fertilization +Interactive fertilization ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CLM adds nitrogen directly to the soil mineral nitrogen pool to meet @@ -537,10 +533,10 @@ crop nitrogen demands. CLM’s separate crop land unit ensures that natural vegetation will not access the fertilizer applied to crops. Fertilizer amounts are obtained from the Agro-IBIS model (Kucharik and Brye 2003), but can be modified in CLM’s pft-physiology input dataset. -Fertilizer is reported in g N/m\ :math:`{}^{2}` by plant functional -type. Total nitrogen fertilizer amounts are 150 g N/m\ :math:`{}^{2}` -for maize, 80 g N/m\ :math:`{}^{2}` for temperate cereals, and 25 g -N/m\ :math:`{}^{2}` for soybean, representative of central U.S. annual +Fertilizer is reported in g N/m\ :sup:`2` by plant functional +type. Total nitrogen fertilizer amounts are 150 g N/m\ :sup:`2` +for maize, 80 g N/m\ :sup:`2` for temperate cereals, and 25 g +N/m\ :sup:`2` for soybean, representative of central U.S. annual fertilizer application amounts. Since CLM’s denitrification rate is high and results in a 50% loss of the unused available nitrogen each day, fertilizer is applied slowly to minimize the loss and maximize plant @@ -565,7 +561,7 @@ The crop fertilization scheme was developed in versions of the CLM prior to CLM4.5. In CLM4.5, crops with fertilization may be simulated over productive. -20.4.3 Biological nitrogen fixation for soybeans +Biological nitrogen fixation for soybeans ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Nitrogen fixation by soybeans is similar to that in the SWAT model @@ -575,40 +571,40 @@ unmet nitrogen demand; if soil nitrogen meets soybean demand, there will be no fixation during the time step. Soybean fixation is determined by .. math:: + :label: 20.10) - \label{20.10)} N_{fix} \; =\; N_{plant\_ ndemand} \; *\; min\; \left(\; 1,\; fxw,\; fxn\; \right)*\; fxg -where *N\ :math:`{}_{plant\_demand}`* is the balance of nitrogen needed +where :math:`{N}_{plant\_demand}` is the balance of nitrogen needed to reach potential growth that cannot be supplied from the soil mineral nitrogen pool, *fxw* is the soil water factor, *fxn* is the soil nitrogen factor, and *fxg* is the growth stage factor calculated by .. math:: + :label: 20.11) - \label{20.11)} fxw=\frac{wf}{0.85} .. math:: + :label: 20.12) - \label{20.12)} fxn=\; \left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }sminn\le 10} \\ {1.5-0.005\left(sminn\times 10\right)\qquad {\rm for\; 10\; <\; }sminn{\rm \; }\ge 30} \\ {1\qquad \qquad \qquad \qquad {\rm for\; }sminn>30} \end{array}\right\} .. math:: + :label: 20.13) - \label{20.13)} fxg=\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad \qquad {\rm for\; }GDD_{T_{2m} } \le 0.15} \\ {6.67\times GDD_{T_{2m} } -1\qquad \qquad \qquad {\rm for\; }0.150.75} \end{array}\right\} where *wf* is the soil water content as a fraction of the water holding capacity for the top 0.05 m, *sminn* is the total nitrogen in the soil -pool (g/m:math:`{}^{2}`), and :math:`{GDD}_{T_{2m}}` is the fraction of +pool (g/m:sup:`2`), and :math:`{GDD}_{T_{2m}}` is the fraction of growing degree-days accumulated during the growing season. :math:`N\mathrm{fix}` is added directly to the soil mineral nitrogen pool for use that time step. Nitrogen fixation occurs after the plant -has accumulated 15%\ *GDD\ :math:`{}_{mat}`* and before -75%\ *GDD\ :math:`{}_{mat}`*, so before grain fill begins. +has accumulated 15%\ :math:`{GDD}_{mat}` and before +75%\ :math:`{GDD}_{mat}`, so before grain fill begins. -20.4.4 Modified C:N ratios for crops +Modified C:N ratios for crops ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Typically, C:N ratios in plant tissue vary throughout the growing season @@ -627,7 +623,7 @@ harvest. All C:N ratios were determined by calibration process, through comparisons of model output versus observations of plant carbon throughout the growth season. -20.4.5 Nitrogen retranslocation for crops +Nitrogen retranslocation for crops ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Nitrogen retranslocation in crops occurs when nitrogen that was used for @@ -648,24 +644,22 @@ mobilized depends on the C:N ratio of the plant tissue, and is calculated as .. math:: + :label: 20.14) - \label{20.14)} leaf\_ to\_ retransn=\frac{c_{leaf} }{CN_{leaf} } -\frac{c_{leaf} }{CN_{leaf}^{f} } .. math:: + :label: 20.15) - \label{20.15)} stemn\_ to\_ retransn=\frac{c_{stem} }{CN_{stem} } -\frac{c_{stem} }{CN_{stem}^{f} } .. math:: + :label: 20.16) - \label{20.16)} frootn\_ to\_ retransn=\frac{c_{froot} }{CN_{froot} } -\frac{c_{froot} }{CN_{froot}^{f} } -where *C\ :math:`{}_{leaf}`*, *C\ :math:`{}_{stem}`*, and -*C\ :math:`{}_{froot}`* is the carbon in the plant leaf, stem, and fine -root, respectively, *CN\ :math:`{}_{leaf}`*, *CN\ :math:`{}_{stem}`*, -and *CN\ :math:`{}_{froot}`* is the pre-grain fill C:N ratio of the +where :math:`{C}_{leaf}`, :math:`{C}_{stem}`, and :math:`{C}_{froot}` is the carbon in the plant leaf, stem, and fine +root, respectively, :math:`{CN}_{leaf}`, :math:`{CN}_{stem}`, and :math:`{CN}_{froot}` is the pre-grain fill C:N ratio of the leaf, stem, and fine root respectively, and :math:`CN^f_{leaf}`, :math:`CN^f_{stem}`, and :math:`CN^f_{froot}` is the post-grain fill C:N ratio of the leaf, stem, and fine root respectively (Table 20.3). Since @@ -686,11 +680,11 @@ fine root, and reproductive pools. +----------------------------+--------+---------------------+-----------+ | Pre-grain fill stage | Corn | Temperate Cereals | Soybean | +============================+========+=====================+===========+ -| *CN\ :math:`{}_{leaf}`* | 10 | 15 | 25 | +| :math:`{CN}_{leaf}` | 10 | 15 | 25 | +----------------------------+--------+---------------------+-----------+ -| *CN\ :math:`{}_{stem}`* | 50 | 50 | 50 | +| :math:`{CN}_{stem}` | 50 | 50 | 50 | +----------------------------+--------+---------------------+-----------+ -| *CN\ :math:`{}_{froot}`* | 42 | 30 | 42 | +| :math:`{CN}_{froot}` | 42 | 30 | 42 | +----------------------------+--------+---------------------+-----------+ | Post-grain fill stage | | | | +----------------------------+--------+---------------------+-----------+ @@ -703,9 +697,7 @@ fine root, and reproductive pools. | :math:`CN_{repr}^{f}` | 50 | 40 | 60 | +----------------------------+--------+---------------------+-----------+ -**** - -20.4.6 Separate reproductive pool +Separate reproductive pool ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ One notable difference between natural vegetation and crops is the diff --git a/doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst b/doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst index 956e1aca1a..661b1f2e6e 100644 --- a/doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst +++ b/doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst @@ -1,5 +1,3 @@ -.. math:: 1 - Transient Landcover Change ============================== @@ -56,13 +54,13 @@ algorithm, and :math:`n` is the index value for the :math:`dynpft\_ year(n)=year_{cur}` : .. math:: + :label: 21.1) - \label{21.1)} nt_{1} =\left\{\begin{array}{l} {1\qquad {\rm for}\qquad year_{cur} w_{t} } \end{array}\right. where .. math:: + :label: 24.8) - \label{24.8)} w_{t} =a\left(0.17M_{clay} +0.14M_{clay}^{2} \right){\rm \; \; \; \; \; \; 0}\le M_{clay} =\% clay\times 0.01\le 1 and .. math:: + :label: 24.9) - \label{24.9)} w=\frac{\theta _{1} \rho _{liq} }{\rho _{d,1} } where :math:`a=M_{clay}^{-1}` for tuning purposes, :math:`\theta _{1}` is the volumetric soil moisture in the top soil -layer (m:math:`{}^{3 }`\ m\ :math:`{}^{-3}`) (section 7.4), +layer (m:math:`{}^{3 }`\ m\ :sup:`-3`) (section 7.4), :math:`\rho _{liq}` is the density of liquid water (kg -m\ :math:`{}^{-3}`) (Table 2.6), and :math:`\rho _{d,\, 1}` is the bulk -density of soil in the top soil layer (kg m\ :math:`{}^{-3}`) defined as -in section 6.3 rather than as in Zender et al. ** (2003). +m\ :sup:`-3`) (Table 2.6), and :math:`\rho _{d,\, 1}` is the bulk +density of soil in the top soil layer (kg m\ :sup:`-3`) defined as +in section 6.3 rather than as in Zender et al. (2003). :math:`Re_{*t}^{f}` from equation is the threshold friction Reynolds factor .. math:: + :label: 24.10) - \label{24.10)} Re_{*t}^{f} =\left\{\begin{array}{l} {\frac{0.1291^{2} }{-1+1.928Re_{*t} } {\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; 0.03}\le Re_{*t} \le 10} \\ {0.12^{2} \left(1-0.0858e^{-0.0617(Re_{*t} -10)} \right)^{2} {\rm \; for\; }Re_{*t} >10} \end{array}\right. and :math:`Re_{*t}` is the threshold friction Reynolds number approximation for optimally sized particles .. math:: + :label: 24.11) - \label{24.11)} Re_{*t} =0.38+1331\left(100D_{osp} \right)^{1.56} In equation , :math:`u_{*s}` ** is defined as the wind friction speed -(m s\ :math:`{}^{-1}`) accounting for the Owen effect (Owen 1964) +(m s\ :sup:`-1`) accounting for the Owen effect (Owen 1964) .. math:: + :label: 24.12) - \label{24.12)} - u_{*s} =\left\{\begin{array}{l} {u_{*} {\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; }U_{10} ` 1.0 would indicate a preference for the +If the :math:`{f}_{frac}` = 1.0 (no fractionation), then the fluxes +:math:`{CF}_{13C}` and :math:`{CF}_{totC}`* will be in simple +proportion to the masses :math:`{CS}_{13C\_up}` and +:math:`{CS}_{totC\_up}`. Values of :math:`{f}_{frac} < 1.0` indicate a discrimination against the heavier isotope +(:sup:`13`\ C) in the flux-generating process, while +:math:`{f}_{frac}` :math:`>` 1.0 would indicate a preference for the heavier isotope. Currently, in all cases where Eq. is used to calculate -a :math:`{}^{13}`\ C flux, *f\ :math:`{}_{frac}`* is set to 1.0. +a :sup:`13`\ C flux, :math:`{f}_{frac}` is set to 1.0. -For :math:`{}^{1}`\ :math:`{}^{4}`\ C, no fractionation is used in +For :sup:`1`\ :sup:`4`\ C, no fractionation is used in either the initial photosynthetic step, nor in subsequent fluxes from upstream to downstream pools; as discussed below, this is because -observations of :math:`{}^{1}`\ :math:`{}^{4}`\ C are typically +observations of :sup:`1`\ :sup:`4`\ C are typically described in units that implicitly correct out the fractionation of -:math:`{}^{1}`\ :math:`{}^{4}`\ C by referencing them to -:math:`{}^{1}`\ :math:`{}^{3}`\ C ratios. +:sup:`1`\ :sup:`4`\ C by referencing them to +:sup:`1`\ :sup:`3`\ C ratios. Isotope Symbols, Units, and Reference Standards ---------------------------------------------------- Carbon has two primary stable isotopes, :math:`{}^{12}`\ C and -:math:`{}^{13}`\ C. :math:`{}^{12}`\ C is the most abundant, comprising +:sup:`13`\ C. :math:`{}^{12}`\ C is the most abundant, comprising about 99% of all carbon. The isotope ratio of a compound, -*R\ :math:`{}_{A}`*, is the mass ratio of the rare isotope to the -abundant isotope +:math:`{R}_{A}`, is the mass ratio of the rare isotope to the abundant isotope .. math:: + :label: 25.2) - \label{25.2)} R_{A} =\frac{{}^{13} C_{A} }{{}^{12} C_{A} } . Carbon isotope ratios are often expressed using delta notation, -:math:`\deltaup`. The :math:`\deltaup`\ :math:`{}^{13}`\ C value of a -compound A, :math:`\deltaup`\ :math:`{}^{13}`\ C\ :math:`{}_{A}`, is the +:math:`\delta`. The :math:`\delta^{13}`\ C value of a +compound A, :math:`\delta^{13}`\ C\ :sub:`A`, is the difference between the isotope ratio of the compound, -*R\ :math:`{}_{A}`*, and that of the Pee Dee Belemnite standard, -*R\ :math:`{}_{PDB}`*, in parts per thousand +:math:`{R}_{A}`, and that of the Pee Dee Belemnite standard, :math:`{R}_{PDB}`, in parts per thousand .. math:: + :label: 25.3) - \label{25.3)} \delta ^{13} C_{A} =\left(\frac{R_{A} }{R_{PDB} } -1\right)\times 1000 -where *R\ :math:`{}_{PDB}`* = 0.0112372, and units of :math:`\deltaup` -are per mil (‰). +where :math:`{R}_{PDB}` = 0.0112372, and units of :math:`\delta` are per mil (‰). Isotopic fractionation can be expressed in several ways. One expression -of the fractionation factor is with alpha (:math:`\alphaup`) notation. +of the fractionation factor is with alpha (:math:`\alpha`) notation. For example, the equilibrium fractionation between two reservoirs A and B can be written as: .. math:: + :label: 25.4) - \label{25.4)} \alpha _{A-B} =\frac{R_{A} }{R_{B} } =\frac{\delta _{A} +1000}{\delta _{B} +1000} . -This can also be expressed using epsilon notation -(:math:`\varepsilonup`), where +This can also be expressed using epsilon notation (:math:`\epsilon`), where .. math:: + :label: 25.5) - \label{25.5)} \alpha _{A-B} =\frac{\varepsilon _{A-B} }{1000} +1 -In other words, if :math:`{\varepsilon }_{A-B}=4.4\mathrm{\textrm{‰}}`, -then :math:`\alphaup`\ :math:`{}_{A-B}`\ =1.0044. +In other words, if :math:`{\epsilon }_{A-B} = 4.4{\mathrm{‰}}`, then :math:`{\alpha}_{A-B} =1.0044`. -In addition to the stable isotopes :math:`{}^{1}`\ :math:`{}^{2}`\ C and -:math:`{}^{1}`\ :math:`{}^{3}`\ C, the unstable isotope -:math:`{}^{1}`\ :math:`{}^{4}`\ C is included in CLM. -:math:`{}^{1}`\ :math:`{}^{4}`\ C can also be described using the delta -notation: +In addition to the stable isotopes :sup:`1`\ :sup:`2`\ C and :sup:`1`\ :sup:`3`\ C, the unstable isotope +:sup:`1`\ :sup:`4`\ C is included in CLM. :sup:`1`\ :sup:`4`\ C can also be described using the delta notation: .. math:: + :label: 25.6) - \label{25.6)} \delta ^{14} C=\left(\frac{A_{s} }{A_{abs} } -1\right)\times 1000 -However, observations of :math:`{}^{1}`\ :math:`{}^{4}`\ C are typically +However, observations of :sup:`1`\ :sup:`4`\ C are typically fractionation-corrected using the following notation: .. math:: + :label: 25.7) - \label{25.7)} \Delta {}^{14} C=1000\times \left(\left(1+\frac{\delta {}^{14} C}{1000} \right)\frac{0.975^{2} }{\left(1+\frac{\delta {}^{13} C}{1000} \right)^{2} } -1\right) -where :math:`\deltaup`\ :math:`{}^{14}`\ C is the measured isotopic -fraction and :math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C corrects for +where :math:`\delta^{14}`\ C is the measured isotopic +fraction and :math:`\mathrm{\Delta}^{14}`\ C corrects for mass-dependent isotopic fractionation processes (assumed to be 0.975 for -fractionation of :math:`{}^{13}`\ C by photosynthesis). CLM assumes a -background preindustrial atmospheric :math:`{}^{14}`\ C /C ratio of -10\ :math:`{}^{-12}`, which is used for A\ :math:`{}_{abs}`. For the -reference standard A\ :math:`{}_{abs}`, which is a plant tissue and has -a :math:`\deltaup`\ :math:`{}^{13}`\ C value is :math:`\mathrm{-}`\ 25 ‰ -due to photosynthetic discrimination, -:math:`\deltaup`\ :math:`{}^{14}`\ C = -:math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C. For CLM, in order to use -the :math:`{}^{14}`\ C model independently of the :math:`{}^{13}`\ C -model, for the :math:`{}^{14}`\ C calculations, this fractionation is +fractionation of :sup:`13`\ C by photosynthesis). CLM assumes a +background preindustrial atmospheric :sup:`14`\ C /C ratio of 10\ :sup:`-12`, which is used for A\ :sub::`abs`. +For the reference standard A\ :math:`{}_{abs}`, which is a plant tissue and has +a :math:`\delta^{13}`\ C value is :math:`\mathrm{-}`\ 25 ‰ due to photosynthetic discrimination, +:math:`\delta`\ :sup:`14`\ C = :math:`\mathrm{\Delta}`\ :sup:`14`\ C. For CLM, in order to use +the :sup:`14`\ C model independently of the :sup:`13`\ C +model, for the :sup:`14`\ C calculations, this fractionation is set to zero, such that the 0.975 term becomes 1, the -:math:`\deltaup`\ :math:`{}^{13}`\ C term (for the calculation of -:math:`\deltaup`\ :math:`{}^{14}`\ C only) becomes 0, and thus -:math:`\deltaup`\ :math:`{}^{14}`\ C = -:math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C. +:math:`\delta^{13}`\ C term (for the calculation of +:math:`\delta^{14}`\ C only) becomes 0, and thus +:math:`\delta^{14}`\ C = :math:`\mathrm{\Delta}`\ :sup:`14`\ C. Carbon Isotope Discrimination During Photosynthesis -------------------------------------------------------- Photosynthesis is modeled in CLM as a two-step process: diffusion of -CO\ :math:`{}_{2}` into the stomatal cavity, followed by enzymatic +CO\ :sub:`2` into the stomatal cavity, followed by enzymatic fixation (Chapter 8). Each step is associated with a kinetic isotope effect. The kinetic isotope effect during diffusion of -CO\ :math:`{}_{2}` through the stomatal opening is 4.4‰. The kinetic -isotope effect during fixation of CO\ :math:`{}_{2}` with Rubisco is +CO\ :sub:`2` through the stomatal opening is 4.4‰. The kinetic +isotope effect during fixation of CO\ :sub:`2` with Rubisco is :math:`\sim`\ 30‰; however, since about 5-10% of carbon in C3 plants reacts with phosphoenolpyruvate carboxylase (PEPC) (Melzer and O’Leary, 1987), the net kinetic isotope effect during fixation is @@ -160,37 +145,37 @@ and C4 plants are given below: For C4 plants, .. math:: + :label: 25.8) - \label{25.8)} \alpha _{psn} =1+\frac{4.4}{1000} For C3 plants, .. math:: + :label: 25.9) - \label{25.9)} \alpha _{psn} =1+\frac{4.4+22.6\frac{c_{i}^{*} }{pCO_{2} } }{1000} where :math:`{\alpha }_{psn}` is the fractionation factor, and -:math:`c^*_i` and pCO\ :math:`{}_{2}` are the revised intracellular and -atmospheric CO\ :math:`{}_{2}` partial pressure, respectively. +:math:`c^*_i` and pCO\ :sub:`2` are the revised intracellular and +atmospheric CO\ :sub:`2` partial pressure, respectively. As can be seen from the above equation, kinetic isotope effect during -fixation of CO\ :math:`{}_{2}` is dependent on the intracellular -CO\ :math:`{}_{2}` concentration, which in turn depends on the net +fixation of CO\ :sub:`2` is dependent on the intracellular +CO\ :sub:`2` concentration, which in turn depends on the net carbon assimilation. That is calculated during the photosynthesis calculation as follows: .. math:: + :label: 25.10) - \label{25.10)} c_{i} =pCO_{2} -a_{n} p\frac{\left(1.4g_{s} \right)+\left(1.6g_{b} \right)}{g_{b} g_{s} } and .. math:: + :label: 25.11) - \label{25.11)} c_{i}^{*} =pCO_{2} -a_{n} \left(1-d\right)p\frac{\left(1.4g_{s} \right)+\left(1.6g_{b} \right)}{g_{b} g_{s} } where :math:`a_n` is net carbon assimilation during photosynthesis, @@ -207,7 +192,7 @@ photosynthesis, which is downscaled by :math:`d`, and the potential photosynthesis. In order to overcome this mismatch, downscaling due to nitrogen limitation is factored in the calculation of the kinetic isotope effect during fixation by defining a downscaled version of -intracellular CO\ :math:`{}_{2}` (:math:`c^*_i`), as a first order +intracellular CO\ :sub:`2` (:math:`c^*_i`), as a first order approximation. However, since nitrogen down-regulation is calculated after the photosynthesis calculation, down-regulation coefficient calculated in the previous time step needs to be used. @@ -218,10 +203,10 @@ discrimination rates for each layer of a multi-layered canopy. However, as with the rest of the photosynthesis model, the number of canopy layers is currently set to one by default. -:math:`{}^{14}`\ C radioactive decay and historical atmospheric :math:`{}^{14}`\ C concentrations +:sup:`14`\ C radioactive decay and historical atmospheric :sup:`14`\ C concentrations ------------------------------------------------------------------------------------------------------ -In the preindustrial biosphere, radioactive decay of :math:`{}^{14}`\ C +In the preindustrial biosphere, radioactive decay of :sup:`14`\ C in carbon pools allows dating of long-term age since photosynthetic uptake; while over the 20\ :math:`{}^{th}` century, radiocarbon in the atmosphere was first diluted by radiocarbon-free fossil fuels and then @@ -230,27 +215,25 @@ its long-term mean concentration. CLM includes both of these processes to allow comparison of carbon that may vary on multiple timescales with observed values. -For radioactive decay, at each timestep all :math:`{}^{14}`\ C pools are +For radioactive decay, at each timestep all :sup:`14`\ C pools are reduced at a rate of –log/:math:`\tau`, where :math:`\tau` is the half-life (Libby half-life value of 5568 years). In order to rapidly equilibrate the long-lived pools during accelerated decomposition spinup, the radioactive decay of the accelerated pools is also accelerated by the same degree as the decomposition, such that the -:math:`{}^{14}`\ C value of these pools is in equilibrium when taken out +:sup:`14`\ C value of these pools is in equilibrium when taken out of the spinup mode. -For variation of atmospheric :math:`{}^{14}`\ C over the historical -period, :math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C values can be set to -either fixed concentration (:math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C -= 0‰) or time-varying concentrations read in from a file. A default file +For variation of atmospheric :sup:`14`\ C over the historical +period, :math:`\mathrm{\Delta}`\ :sup:`14`\ C values can be set to +either fixed concentration (:math:`\mathrm{\Delta}`\ :sup:`14`\ C = 0‰) +or time-varying concentrations read in from a file. A default file is provided that is based on a spline fit through several observational datasets spanning the 20\ :math:`{}^{th}` century: (Levin and Kromer, 2004; Manning and Melhuish, 1994; Nydal and Lövseth, 1996; Turnbull et al. 2007). This is shown in Figure 25.1. -Figure 25.1. Atmospheric :math:`\mathrm{\Delta}`\ :math:`{}^{14}`\ C -used to drive :math:`{}^{14}`\ C model over the historical period. - -|image| +Figure 25.1. Atmospheric :math:`\mathrm{\Delta}`\ :sup:`14`\ C +used to drive :sup:`14`\ C model over the historical period. -.. |image| image:: image1 +.. image:: image1.png diff --git a/doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst b/doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst index 9bf3495e0c..c6a78b34d9 100644 --- a/doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst +++ b/doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst @@ -1,5 +1,3 @@ -.. math:: 1 - Offline Mode ================ @@ -27,12 +25,12 @@ to be run over Antarctica and ensures data is available along coastlines regardless of model resolution. The forcing data is ingested into a data atmosphere model in three -“streams”; precipitation (:math:`P`) (mm s\ :math:`{}^{-1}`), solar -radiation (:math:`S_{atm}` ) (W m\ :math:`{}^{-2}`), and four other +“streams”; precipitation (:math:`P`) (mm s\ :sup:`-1`), solar +radiation (:math:`S_{atm}` ) (W m\ :sup:`-2`), and four other fields [atmospheric pressure :math:`P_{atm}` (Pa), atmospheric specific -humidity :math:`q_{atm}` (kg kg\ :math:`{}^{-1}`), atmospheric +humidity :math:`q_{atm}` (kg kg\ :sup:`-1`), atmospheric temperature :math:`T_{atm}` (K), and atmospheric wind :math:`W_{atm}` -(m s\ :math:`{}^{-1}`)]. These are separate streams because they are +(m s\ :sup:`-1`)]. These are separate streams because they are handled differently according to the type of field. In the CRUNCEP dataset, the precipitation stream is provided at six hour intervals and the data atmosphere model prescribes the same precipitation rate for @@ -49,15 +47,15 @@ solar radiation supplied by the six-hourly forcing data is actually used. The solar radiation at model time step :math:`t_{M}` is .. math:: + :label: ZEqnNum160435 - \label{ZEqnNum160435} \begin{array}{l} {S_{atm} \left(t_{M} \right)=\frac{\frac{\Delta t_{FD} }{\Delta t_{M} } S_{atm} \left(t_{FD} \right)\mu \left(t_{M} \right)}{\sum _{i=1}^{\frac{\Delta t_{FD} }{\Delta t_{M} } }\mu \left(t_{M_{i} } \right) } \qquad {\rm for\; }\mu \left(t_{M} \right)>0.001} \\ {S_{atm} \left(t_{M} \right)=0\qquad {\rm for\; }\mu \left(t_{M} \right)\le 0.001} \end{array} where :math:`\Delta t_{FD}` is the time step of the forcing data (6 -hours :math:`\times` 3600 seconds hour\ :math:`{}^{-1}` = 21600 +hours :math:`\times` 3600 seconds hour\ :sup:`-1` = 21600 seconds), :math:`\Delta t_{M}` is the model time step (seconds), :math:`S_{atm} \left(t_{FD} \right)` is the six-hourly solar radiation -from the forcing data (W m\ :math:`{}^{-2}`), and +from the forcing data (W m\ :sup:`-2`), and :math:`\mu \left(t_{M} \right)` is the cosine of the solar zenith angle at model time step :math:`t_{M}` (section 3.3). The term in the denominator of equation is the sum of the cosine of the solar zenith @@ -71,46 +69,46 @@ derived from one year’s worth of hourly CAM output from CAM version cam3\_5\_55 as .. math:: + :label: 26.2) - \label{26.2)} S_{atm} \, \downarrow _{vis}^{\mu } =R_{vis} \left(\alpha S_{atm} \right) .. math:: + :label: 26.3) - \label{26.3)} S_{atm} \, \downarrow _{nir}^{\mu } =R_{nir} \left[\left(1-\alpha \right)S_{atm} \right] .. math:: + :label: 26.4) - \label{26.4)} S_{atm} \, \downarrow _{vis} =\left(1-R_{vis} \right)\left(\alpha S_{atm} \right) .. math:: + :label: 26.5) - \label{26.5)} S_{atm} \, \downarrow _{nir} =\left(1-R_{nir} \right)\left[\left(1-\alpha \right)S_{atm} \right]. where :math:`\alpha` , the ratio of visible to total incident solar radiation, is assumed to be .. math:: + :label: 26.6) - \label{26.6)} \alpha =\frac{S_{atm} \, \downarrow _{vis}^{\mu } +S_{atm} \, \downarrow _{vis}^{} }{S_{atm} } =0.5. The ratio of direct to total incident radiation in the visible :math:`R_{vis}` is .. math:: + :label: 26.7) - \label{26.7)} R_{vis} =a_{0} +a_{1} \times \alpha S_{atm} +a_{2} \times \left(\alpha S_{atm} \right)^{2} +a_{3} \times \left(\alpha S_{atm} \right)^{3} \qquad 0.01\le R_{vis} \le 0.99 and in the near-infrared :math:`R_{nir}` is .. math:: + :label: 26.8) - \label{26.8)} R_{nir} =b_{0} +b_{1} \times \left(1-\alpha \right)S_{atm} +b_{2} \times \left[\left(1-\alpha \right)S_{atm} \right]^{2} +b_{3} \times \left[\left(1-\alpha \right)S_{atm} \right]^{3} \qquad 0.01\le R_{nir} \le 0.99 where @@ -125,42 +123,42 @@ derived as follows. The atmospheric reference height :math:`z'_{atm}` :math:`u_{atm} =v_{atm} ={W_{atm} \mathord{\left/ {\vphantom {W_{atm} \sqrt{2} }} \right. \kern-\nulldelimiterspace} \sqrt{2} }` . The potential temperature :math:`\overline{\theta _{atm} }` (K) is set to the atmospheric temperature :math:`T_{atm}` . The atmospheric -longwave radiation :math:`L_{atm} \, \downarrow` (W m\ :math:`{}^{-2}`) +longwave radiation :math:`L_{atm} \, \downarrow` (W m\ :sup:`-2`) is derived from the atmospheric vapor pressure :math:`e_{atm}` and temperature :math:`T_{atm}` (Idso 1981) as .. math:: + :label: 26.9) - \label{26.9)} L_{atm} \, \downarrow =\left[0.70+5.95\times 10^{-5} \times 0.01e_{atm} \exp \left(\frac{1500}{T_{atm} } \right)\right]\sigma T_{atm}^{4} where .. math:: + :label: 26.10) - \label{26.10)} e_{atm} =\frac{P_{atm} q_{atm} }{0.622+0.378q_{atm} } and :math:`\sigma` is the Stefan-Boltzmann constant (W -m\ :math:`{}^{-2}` K\ :math:`{}^{-4}`) (Table 2.6). The fraction of -precipitation :math:`P` (mm s\ :math:`{}^{-1}`) falling as rain and/or +m\ :sup:`-2` K\ :math:`{}^{-4}`) (Table 2.6). The fraction of +precipitation :math:`P` (mm s\ :sup:`-1`) falling as rain and/or snow is .. math:: + :label: ZEqnNum336485 - \label{ZEqnNum336485} q_{rain} =P\left(f_{P} \right), .. math:: + :label: 26.12) - \label{26.12)} q_{snow} =P\left(1-f_{P} \right) where .. math:: + :label: 26.13) - \label{26.13)} f_{P} =0<0.5\left(T_{atm} -T_{f} \right)<1. The aerosol deposition rates :math:`D_{sp}` (14 rates as described in @@ -171,11 +169,11 @@ If the user wishes to provide atmospheric forcing data from another source, the data format outlined above will need to be followed with the following exceptions. The data atmosphere model will accept a user-supplied relative humidity :math:`RH` (%) and derive specific -humidity :math:`q_{atm}` (kg kg\ :math:`{}^{-1}`) from +humidity :math:`q_{atm}` (kg kg\ :sup:`-1`) from .. math:: + :label: 26.14) - \label{26.14)} q_{atm} =\frac{0.622e_{atm} }{P_{atm} -0.378e_{atm} } where the atmospheric vapor pressure :math:`e_{atm}` (Pa) is derived @@ -190,9 +188,9 @@ temperature :math:`T_{dew}` (K) and derive specific humidity :math:`q_{atm}` from .. math:: + :label: 26.15) - \label{26.15)} - q_{atm} =\frac{0.622e_{sat}^{T_{dew} } }{P_{atm} -0.378e_{sat}^{T_{dew} } } . + q_{atm} = \frac{0.622e_{sat}^{T_{dew} } }{P_{atm} -0.378e_{sat}^{T_{dew} } } . Here, :math:`e_{sat}^{T}` , the saturation vapor pressure as a function of temperature, is derived from Lowe’s (1977) polynomials. If not diff --git a/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst b/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst index fb30a23e60..5b73e1a70a 100644 --- a/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst +++ b/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst @@ -1,7 +1,3 @@ -.. math:: 1 - -.. math:: 1 - References ============== @@ -293,7 +289,7 @@ Farouki, O.T. 1981. The thermal properties of soils in cold regions. Cold Regions Sci. and Tech. 5:67-75. Farquhar, G.D., von Caemmerer, S., and Berry, J.A. 1980. A biochemical -model of photosynthetic CO\ :math:`{}_{2}` assimilation in leaves of +model of photosynthetic CO\ :sub:`2` assimilation in leaves of C\ :math:`{}_{3}` species. Planta 149:78-90. Farquhar, G.D., and von Caemmerer, S. 1982. Modeling of photosynthetic @@ -438,7 +434,7 @@ change. J. Geophys. Res. 113:D05211. DOI:10.1029/2007JD009092. Heald, C.L., Wilkinson, M.J., Monson, R.K., Alo, C.A., Wang, G.L., and Guenther, A. 2009. Response of isoprene emission to ambient -CO\ :math:`{}_{2}` changes and implications for global budgets. Global +CO\ :sub:`2` changes and implications for global budgets. Global Change Biol. 15:1127-1140. DOI:10.1111/j.1365-2486.2008.01802.x Henderson-Sellers, B. 1985. New formulation of eddy diffusion @@ -488,7 +484,7 @@ aspen and spruce stands in the north american boreal forest. Canadian Journal of Remote Sensing, 18: 126-133. Hunt, E.R., Jr. et al., 1996. Global net carbon exchange and -intra-annual atmospheric CO\ :math:`{}_{2}` concentrations predicted by +intra-annual atmospheric CO\ :sub:`2` concentrations predicted by an ecosystem process model and three-dimensional atmospheric transport model. Global Biogeochemical Cycles, 10: 431-456. @@ -746,7 +742,7 @@ to simulated chronic nitrogen deposition. Ecological Applications, 7: Mahowald, N.M., Muhs, D.R., Levis, S., Rasch, P.J., Yoshioka, M., Zender, C.S., and Luo, C. 2006. Change in atmospheric mineral aerosols in response to climate: last glacial period, pre-industrial, modern and -doubled CO\ :math:`{}_{2}` climates. J. Geophys. Res\ *.* 111:D10202. +doubled CO\ :sub:`2` climates. J. Geophys. Res\ *.* 111:D10202. DOI:10.1029/2005JD006653. Makela, A. 2002. Derivation of stem taper from the pipe model theory in @@ -1206,7 +1202,7 @@ structure. J. Climate 20:3902-3923. Thornton, P.E., Lamarque, J.-F., Rosenbloom, N.A., and Mahowald, N.M. 2007. Influence of carbon-nitrogen cycle coupling on land model response -to CO\ :math:`{}_{2}` fertilization and climate variability. Global +to CO\ :sub:`2` fertilization and climate variability. Global Biogeochem. Cycles 21:GB4018. Thornton, P.E., Doney, S.C., Lindsay, K., Moore, J.K., Mahowald, N., diff --git a/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst b/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst index cc47ceedf1..e4320a9933 100644 --- a/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst +++ b/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst @@ -66,12 +66,9 @@ The average inverse diffuse optical depth per unit leaf and stem area is where :math:`\mu '` is the direction of the scattered flux. -The optical parameters :math:`\omega` , :math:`\beta` , and -:math:`\beta _{0}` , which vary with wavelength (:math:`\Lambda` ), are -weighted combinations of values for vegetation and snow. The model -determines that snow is on the canopy if :math:`T_{v} \le T_{f}` , where -:math:`T_{v}` is the vegetation temperature (K) (Chapter 5) and -:math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). In +The optical parameters :math:`\omega`, :math:`\beta`, and :math:`\beta _{0}`, which vary with wavelength (:math:`\Lambda` ), are +weighted combinations of values for vegetation and snow. The model determines that snow is on the canopy if :math:`T_{v} \le T_{f}` , where +:math:`T_{v}` is the vegetation temperature (K) (Chapter 5) and :math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). In this case, the optical parameters are .. math:: @@ -89,12 +86,9 @@ this case, the optical parameters are \omega _{\Lambda } \beta _{0,\, \Lambda } =\omega _{\Lambda }^{veg} \beta _{0,\, \Lambda }^{veg} \left(1-f_{wet} \right)+\omega _{\Lambda }^{sno} \beta _{0,\, \Lambda }^{sno} f_{wet} -where :math:`f_{wet}` is the wetted fraction of the canopy (section -7.1). The snow and vegetation weights are applied to the products -:math:`\omega _{\Lambda } \beta _{\Lambda }` and -:math:`\omega _{\Lambda } \beta _{0,\, \Lambda }` because these -products are used in the two-stream equations. If there is no snow on -the canopy, +where :math:`f_{wet}` is the wetted fraction of the canopy (section 7.1). The snow and vegetation weights are applied to the products +:math:`\omega _{\Lambda } \beta _{\Lambda }` and :math:`\omega _{\Lambda } \beta _{0,\, \Lambda }` because these +products are used in the two-stream equations. If there is no snow on the canopy, .. math:: :label: 3.8 @@ -449,11 +443,11 @@ Table 3.1. Plant functional type optical properties +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ | BDS boreal | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| C\ :math:`{}_{3}` arctic grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +| C\ :sub:`3` arctic grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| C\ :math:`{}_{3}` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +| C\ :sub:`3` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| C\ :math:`{}_{4}` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +| C\ :sub:`4` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ | Crop R | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ @@ -480,7 +474,7 @@ Table 3.2. Intercepted snow optical properties +-----------------------------+-------+-------+ | Parameter | vis | nir | -+-----------------------------+-------+-------+ ++=============================+=======+=======+ | :math:`\omega ^{sno}` | 0.8 | 0.4 | +-----------------------------+-------+-------+ | :math:`\beta ^{sno}` | 0.5 | 0.5 | @@ -491,8 +485,7 @@ Table 3.2. Intercepted snow optical properties Ground Albedos ------------------ -The overall direct beam :math:`\alpha _{g,\, \Lambda }^{\mu }` and -diffuse :math:`\alpha _{g,\, \Lambda }` ground albedos are weighted +The overall direct beam :math:`\alpha _{g,\, \Lambda }^{\mu }` and diffuse :math:`\alpha _{g,\, \Lambda }` ground albedos are weighted combinations of “soil” and snow albedos .. math:: @@ -505,8 +498,7 @@ combinations of “soil” and snow albedos \alpha _{g,\, \Lambda } =\alpha _{soi,\, \Lambda } \left(1-f_{sno} \right)+\alpha _{sno,\, \Lambda } f_{sno} -where :math:`f_{sno}` is the fraction of the ground covered with snow -(section 7.2.1). +where :math:`f_{sno}` is the fraction of the ground covered with snow (section 7.2.1). :math:`\alpha _{soi,\, \Lambda }^{\mu }` and :math:`\alpha _{soi,\, \Lambda }` vary with glacier, lake, wetland, and @@ -630,13 +622,10 @@ as g=\frac{\sum _{1}^{k}g_{k} \omega _{k} \tau _{k} }{\sum _{1}^{k}\omega _{k} \tau _{k} } -For each constituent (ice, two black carbon species, two organic carbon -species, and four dust species), :math:`\omega`, *g*, and -the mass extinction cross-section :math:`\psi` (:math:`\text{m}^{2} \text{kg}^{-1}`) -are computed offline with Mie Theory, e.g., -applying the computational technique from Bohren and Huffman (1983). The -extinction optical depth for each constituent depends on its mass -extinction cross-section and layer mass, :math:`w _{k} (\text{kg m} ^{-2}`) as +For each constituent (ice, two black carbon species, two organic carbon species, and four dust species), :math:`\omega`, *g*, and +the mass extinction cross-section :math:`\psi` (m\ :sup:`2` kg\ :sub:`-1`) +are computed offline with Mie Theory, e.g., applying the computational technique from Bohren and Huffman (1983). The +extinction optical depth for each constituent depends on its mass extinction cross-section and layer mass, :math:`w _{k}` (kg\ m\ :sup:`-1`) as .. math:: :label: 3.65 @@ -708,7 +697,7 @@ When any of these three conditions occur, the Eddington approximation is attempted instead, and if both approximations fail, the cosine of the solar zenith angle is adjusted by 0.02 (conserving incident flux) and a warning message is produced. This situation occurs in only about 1 in -10 :math:`{}^{6}` computations of snow albedo. After looping over the +10 :sup:`6` computations of snow albedo. After looping over the five spectral bands, absorption fluxes and albedo are averaged back into the bulk NIR band used by the rest of CLM. @@ -727,7 +716,7 @@ single timestep. The radiative transfer calculation is performed twice for each column containing a mass of snow greater than -:math:`1 \times 10^{-30} \text{kg m}^{-2}` (excluding lake and urban columns); once each for +:math:`1 \times 10^{-30}` kg\ m\ :sup:`-2` (excluding lake and urban columns); once each for direct-beam and diffuse incident flux. Absorption in each layer :math:`i` of pure snow is initially recorded as absorbed flux per unit incident flux on the ground (:math:`S_{sno,\, i}` ), as albedos must be @@ -745,7 +734,7 @@ vegetation canopy) have been calculated for the current time step (sections 3.1 and 4.1), the layer absorption factors (:math:`S_{g,\, i}`) are multiplied by the ground-incident fluxes to -produce solar absorption (W m\ :math:`{}^{-2}`) in each snow layer and +produce solar absorption (W m\ :sup:`-2`) in each snow layer and the underlying ground. Snowpack Optical Properties @@ -817,7 +806,7 @@ Table 3.5. Single-scatter albedo values used for snowpack impurities and ice | Ice (:math:`r _{e}` = 1500 :math:`\mu` m) | 0.9998 | 0.9960 | 0.9680 | 0.8730 | 0.5500 | +----------------------------------------------------------------+----------+----------+----------+----------+----------+ -Table 3.6. Mass extinction values (:math:`\text{m}^{2} \text{kg}^{-1}`) used for snowpack impurities and ice. +Table 3.6. Mass extinction values (m\ :sup:`2` kg\ :sub:`-1`) used for snowpack impurities and ice. +----------------------------------------------------------------+----------+----------+----------+----------+----------+ | Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | @@ -912,8 +901,7 @@ each time step *t* as r_{e} \left(t\right)=\left[r_{e} \left(t-1\right)+dr_{e,\, dry} +dr_{e,\, wet} \right]f_{old} +r_{e,\, 0} f_{new} +r_{e,\, rfz} f_{rfrz} Here, the effective radius of freshly-fallen snow -(:math:`r_{e,0}`) is fixed globally at 54.5 :math:`\mu` m (corresponding to a specific surface -area of 60 :math:`\text{m}^{2} \text{kg}^{-1}`), and the effective +(:math:`r_{e,0}`) is fixed globally at 54.5 :math:`\mu` m (corresponding to a specific surface area of 60 m\ :sup:`2` kg\ :sub:`-1`), and the effective radius of refrozen liquid water (:math:`r_{e,rfz}`) is set to 1000\ :math:`\mu` m. Dry snow aging is based on a microphysical model described by Flanner @@ -940,8 +928,8 @@ The parameters :math:`{(\frac{dr_{e}}{dt}})_{0}`, lookup table with dimensions corresponding to snow temperature, temperature gradient, and density. The domain covered by this lookup table includes temperature ranging from 223 to 273 K, temperature -gradient ranging from 0 to 300 K m\ :math:`{}^{-1}`, and density ranging -from 50 to 400 kg m\ :math:`{}^{-3}`. Temperature gradient is calculated +gradient ranging from 0 to 300 K m\ :sup:`-1`, and density ranging +from 50 to 400 kg m\ :sup:`-3`. Temperature gradient is calculated at the midpoint of each snow layer *n*, using mid-layer temperatures (:math:`T_{n}`) and snow layer thicknesses (:math:`dz_{n}`), as @@ -967,8 +955,7 @@ fraction :math:`f_{liq}` as \frac{dr_{e} }{dt} =\frac{10^{18} C_{1} f_{liq} ^{3} }{4\pi r_{e} ^{2} } -The constant *C*\ :math:`{}_{1}` is -4.22\ :math:`\times`\ 10\ :math:`{}^{-13}`, and: +The constant *C*\ :sub:`1` is 4.22\ :math:`\times`\ 10\ :sup:`-13`, and: :math:`f_{liq} =w_{liq} /(w_{liq} +w_{ice} )`\ (section 7.2). In cases where snow mass is greater than zero, but a snow layer has not diff --git a/doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst b/doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst index 45d03e83f8..64506d1032 100644 --- a/doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst +++ b/doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst @@ -5,7 +5,7 @@ The net radiation at the surface is :math:`\left(\vec{S}_{v} +\vec{S}_{g} \right)-\left(\vec{L}_{v} +\vec{L}_{g} \right)`, where :math:`\vec{S}` is the net solar flux absorbed by the vegetation (“v”) and the ground (“g”) and :math:`\vec{L}` is the net longwave flux -(positive toward the atmosphere) (W m\ :math:`{}^{-2}`). +(positive toward the atmosphere) (W m\ :sup:`-2`). Solar Fluxes ---------------- @@ -51,7 +51,7 @@ The total solar radiation absorbed by the vegetation and ground is where :math:`S_{atm} \, \downarrow _{\Lambda }^{\mu }` and :math:`S_{atm} \, \downarrow _{\Lambda }` are the incident direct beam -and diffuse solar fluxes (W m\ :math:`{}^{-2}`). For non-vegetated +and diffuse solar fluxes (W m\ :sup:`-2`). For non-vegetated surfaces, :math:`e^{-K\left(L+S\right)} =1`, :math:`\overrightarrow{I}_{\Lambda }^{\mu } =\overrightarrow{I}_{\Lambda } =0`, :math:`I\, \downarrow _{\Lambda }^{\mu } =0`, and @@ -144,7 +144,7 @@ or shaded plant area at depth :math:`x`. Longwave Fluxes ------------------- -The net longwave radiation (W m\ :math:`{}^{-2}`) (positive toward the +The net longwave radiation (W m\ :sup:`-2`) (positive toward the atmosphere) at the surface is .. math:: @@ -154,7 +154,7 @@ atmosphere) at the surface is where :math:`L\, \uparrow` is the upward longwave radiation from the surface and :math:`L_{atm} \, \downarrow` is the downward atmospheric -longwave radiation (W m\ :math:`{}^{-2}`). The radiative temperature +longwave radiation (W m\ :sup:`-2`). The radiative temperature :math:`T_{rad}` (K) is defined from the upward longwave radiation as .. math:: @@ -162,10 +162,8 @@ longwave radiation (W m\ :math:`{}^{-2}`). The radiative temperature T_{rad} =\left(\frac{L\, \uparrow }{\sigma } \right)^{{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} } -where :math:`\sigma` is the Stefan-Boltzmann constant (W -m\ :math:`{}^{-2}` K\ :math:`{}^{-4}`) (Table 2.6). With reference to -Figure 4.1, the upward longwave radiation from the surface to the -atmosphere is +where :math:`\sigma` is the Stefan-Boltzmann constant (W\ m\ :sup:`-2` K\ :sup:`-4`) (Table 2.6). With reference to +Figure 4.1, the upward longwave radiation from the surface to the atmosphere is .. math:: :label: 4.11 diff --git a/doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst b/doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst index 336fde1b9f..81c25ee0e8 100644 --- a/doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst +++ b/doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst @@ -2,15 +2,14 @@ Momentum, Sensible Heat, and Latent Heat Fluxes ================================================== The zonal :math:`\tau _{x}` and meridional :math:`\tau _{y}` momentum -fluxes (kg m\ :math:`{}^{-1}` s\ :math:`{}^{-2}`), sensible heat flux -:math:`H` (W m\ :math:`{}^{-2}`), and water vapor flux :math:`E` (kg -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) between the atmosphere at +fluxes (kg m\ :sup:`-1` s\ :sup:`-2`), sensible heat flux +:math:`H` (W m\ :sup:`-2`), and water vapor flux :math:`E` (kg m\ :sup:`-2` s\ :sup:`-1`) between the atmosphere at reference height :math:`z_{atm,\, x}` (m) [where :math:`x` is height for wind (momentum) (:math:`m`), temperature (sensible heat) (:math:`h`), and humidity (water vapor) (:math:`w`); with zonal and meridional winds :math:`u_{atm}` and :math:`v_{atm}` (m -s\ :math:`{}^{-1}`), potential temperature :math:`\theta _{atm}` (K), -and specific humidity :math:`q_{atm}` (kg kg\ :math:`{}^{-1}`)] and the +s\ :sup:`-1`), potential temperature :math:`\theta _{atm}` (K), +and specific humidity :math:`q_{atm}` (kg kg\ :sup:`-1`)] and the surface [with :math:`u_{s}` , :math:`v_{s}` , :math:`\theta _{s}` , and :math:`q_{s}` ] are @@ -39,7 +38,7 @@ similarity theory developed for the surface layer (i.e., the nearly constant flux layer above the surface sublayer). In this derivation, :math:`u_{s}` and :math:`v_{s}` are defined to equal zero at height :math:`z_{0m} +d` (the apparent sink for momentum) so that -:math:`r_{am}` is the aerodynamic resistance (s m\ :math:`{}^{-1}`) for +:math:`r_{am}` is the aerodynamic resistance (s m\ :sup:`-1`) for momentum between the atmosphere at height :math:`z_{atm,\, m}` and the surface at height :math:`z_{0m} +d`. Thus, the momentum fluxes become @@ -57,12 +56,12 @@ Likewise, :math:`\theta _{s}` and :math:`q_{s}` are defined at heights :math:`z_{0h} +d` and :math:`z_{0w} +d` (the apparent sinks for heat and water vapor, respectively -:math:`r_{aw}` are the aerodynamic resistances (s m\ :math:`{}^{-1}`) +:math:`r_{aw}` are the aerodynamic resistances (s m\ :sup:`-1`) to sensible heat and water vapor transfer between the atmosphere at heights :math:`z_{atm,\, h}` and :math:`z_{atm,\, w}` and the surface at heights :math:`z_{0h} +d` and :math:`z_{0w} +d`, respectively. The -specific heat capacity of air :math:`C_{p}` (J kg\ :math:`{}^{-1}` -K\ :math:`{}^{-1}`) is a constant (Table 2.6). The atmospheric potential +specific heat capacity of air :math:`C_{p}` (J kg\ :sup:`-1` +K\ :sup:`-1`) is a constant (Table 2.6). The atmospheric potential temperature used here is .. math:: @@ -72,15 +71,13 @@ temperature used here is where :math:`T_{atm}` is the air temperature (K) at height :math:`z_{atm,\, h}` and :math:`\Gamma _{d} =0.0098` K -m\ :math:`{}^{-1}` is the negative of the dry adiabatic lapse rate [this +m\ :sup:`-1` is the negative of the dry adiabatic lapse rate [this expression is first-order equivalent to :math:`\theta _{atm} =T_{atm} \left({P_{srf} \mathord{\left/ {\vphantom {P_{srf} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } \right)^{{R_{da} \mathord{\left/ {\vphantom {R_{da} C_{p} }} \right. \kern-\nulldelimiterspace} C_{p} } }` (Stull 1988), where :math:`P_{srf}` is the surface pressure (Pa), :math:`P_{atm}` is the atmospheric pressure (Pa), and :math:`R_{da}` -is the gas constant for dry air (J kg\ :math:`{}^{-1}` -K\ :math:`{}^{-1}`) (Table 2.6)]. By definition, -:math:`\theta _{s} =T_{s}` . The density of moist air (kg -m\ :math:`{}^{-3}`) is +is the gas constant for dry air (J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6)]. By definition, +:math:`\theta _{s} =T_{s}` . The density of moist air (kg m\ :sup:`-3`) is .. math:: :label: 5.8 @@ -99,8 +96,8 @@ Monin-Obukhov Similarity Theory ----------------------------------- The surface vertical kinematic fluxes of momentum -:math:`\overline{u'w'}` and :math:`\overline{v'w'}` (:math:`\text{m}^{2} \text{s}^{-2}`), sensible heat :math:`\overline{\theta 'w'}` -(:math:`\text{K m} \text{s}^{-1}`), and latent heat :math:`\overline{q'w'}` (:math:`\text{kg kg }^{-1}` m s\ :math:`{}^{-1}`), where :math:`u'`, :math:`v'`, +:math:`\overline{u'w'}` and :math:`\overline{v'w'}` (m\ :sup:`2` s\ :sub:`-2`), sensible heat :math:`\overline{\theta 'w'}` +(K m s :sup:`-1`), and latent heat :math:`\overline{q'w'}` (kg kg\ :sup:`-1` m s\ :sup:`-1`), where :math:`u'`, :math:`v'`, :math:`w'`, :math:`\theta '`, and :math:`q'` are zonal horizontal wind, meridional horizontal wind, vertical velocity, potential temperature, and specific humidity turbulent fluctuations about the mean, are defined @@ -130,16 +127,15 @@ displacement height (m), :math:`L` is the Monin-Obukhov length scale (m) that accounts for buoyancy effects resulting from vertical density gradients (i.e., the atmospheric stability), k is the von Karman constant (Table 2.6), and :math:`\left|{\it u}\right|` is the -atmospheric wind speed (m s\ :math:`{}^{-1}`). :math:`\phi _{m}` , +atmospheric wind speed (m s\ :sup:`-1`). :math:`\phi _{m}` , :math:`\phi _{h}` , and :math:`\phi _{w}` are universal (over any surface) similarity functions of :math:`\zeta` that relate the constant fluxes of momentum, sensible heat, and latent heat to the mean profile gradients of :math:`\left|{\it u}\right|`, :math:`\theta` , and :math:`q` in the surface layer. In neutral conditions, :math:`\phi _{m} =\phi _{h} =\phi _{w} =1`. The velocity (i.e., friction -velocity) :math:`u_{\*}` (m s\ :math:`{}^{-1}`), temperature -:math:`\theta _{\*}` (K), and moisture :math:`q_{\*}` (kg -kg\ :math:`{}^{-1}`) scales are +velocity) :math:`u_{\*}` (m s\ :sup:`-1`), temperature +:math:`\theta _{\*}` (K), and moisture :math:`q_{\*}` (kg kg\ :sup:`-1`) scales are .. math:: :label: 5.13 @@ -156,12 +152,11 @@ kg\ :math:`{}^{-1}`) scales are q_{*} u_{*} =-\overline{q'w'}=-\frac{E}{\rho _{atm} } -where :math:`\left|{\it \tau }\right|` is the shearing stress (kg -m\ :math:`{}^{-1}` s\ :math:`{}^{-2}`), with zonal and meridional +where :math:`\left|{\it \tau }\right|` is the shearing stress (kg m\ :sup:`-1` s\ :sup:`-2`), with zonal and meridional components :math:`\overline{u'w'}=-\frac{\tau _{x} }{\rho _{atm} }` and :math:`\overline{v'w'}=-\frac{\tau _{y} }{\rho _{atm} }` , respectively, -:math:`H` is the sensible heat flux (W m\ :math:`{}^{-2}`) and :math:`E` -is the water vapor flux (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`). +:math:`H` is the sensible heat flux (W m\ :sup:`-2`) and :math:`E` +is the water vapor flux (kg m\ :sup:`-2` s\ :sup:`-1`). The dimensionless length scale :math:`L` is the Monin-Obukhov length defined as @@ -171,7 +166,7 @@ defined as L=-\frac{u_{*}^{3} }{k\left(\frac{g}{\overline{\theta _{v,\, atm} }} \right)\theta '_{v} w'} =\frac{u_{*}^{2} \overline{\theta _{v,\, atm} }}{kg\theta _{v*} } -where :math:`g` is the acceleration of gravity (m s\ :math:`{}^{-2}`) +where :math:`g` is the acceleration of gravity (m s\ :sup:`-2`) (Table 2.6), and :math:`\overline{\theta _{v,\, atm} }=\overline{\theta _{atm} }\left(1+0.61q_{atm} \right)` is the reference virtual potential temperature. :math:`L>0` indicates @@ -504,7 +499,7 @@ and the atmosphere can also be written in the form E=-\rho _{atm} \frac{\left(q_{atm} -q_{s} \right)}{r_{aw} } -where the aerodynamic resistances (s m\ :math:`{}^{-1}`) are +where the aerodynamic resistances (s m\ :sup:`-1`) are .. math:: :label: ZEqnNum660763 @@ -566,7 +561,7 @@ definition, this includes bare soil, wetlands, and glaciers. The solution for lakes is described in Chapter 9. For these surfaces, the surface may be exposed to the atmosphere, snow covered, and/or surface water covered, so that the sensible heat flux :math:`H_{g}` (W -m\ :math:`{}^{-2}`) is, with reference to Figure 5.1, +m\ :sup:`-2`) is, with reference to Figure 5.1, .. math:: :label: ZEqnNum726771 @@ -594,15 +589,13 @@ surface water :math:`T_{h2osfc}` are H_{h2osfc} =-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{h2osfc} \right)}{r_{ah} } -where :math:`\rho _{atm}` is the density of atmospheric air (kg -m\ :math:`{}^{-3}`), :math:`C_{p}` is the specific heat capacity of air -(J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), +where :math:`\rho _{atm}` is the density of atmospheric air (kg m\ :sup:`-3`), :math:`C_{p}` is the specific heat capacity of air +(J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), :math:`\theta _{atm}` is the atmospheric potential temperature (K), and :math:`r_{ah}` is the aerodynamic resistance to sensible heat transfer -(s m\ :math:`{}^{-1}`). +(s m\ :sup:`-1`). -The water vapor flux :math:`E_{g}` (kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`) is, with reference to Figure 5.2, +The water vapor flux :math:`E_{g}` (kg m\ :sup:`-2` s\ :sup:`-1`) is, with reference to Figure 5.2, .. math:: :label: ZEqnNum419297 @@ -624,14 +617,10 @@ s\ :math:`{}^{-1}`) is, with reference to Figure 5.2, E_{h2osfc} =-\frac{\rho _{atm} \left(q_{atm} -q_{h2osfc} \right)}{r_{aw} } -where :math:`\beta _{soi}` is an empirical function of soil water -(Sakaguchi and Zeng 2009), :math:`q_{atm}` is the atmospheric specific -humidity (kg kg\ :math:`{}^{-1}`), :math:`q_{soil}` , :math:`q_{sno}` , -and :math:`q_{h2osfc}` are the specific humidities (kg -kg\ :math:`{}^{-1}`) of the soil, snow, and surface water, respectively, -and :math:`r_{aw}` is the aerodynamic resistance to water vapor -transfer (s m\ :math:`{}^{-1}`). The specific humidities of the snow -:math:`q_{sno}` and surface water :math:`q_{h2osfc}` are assumed to be +where :math:`\beta _{soi}` is an empirical function of soil water (Sakaguchi and Zeng 2009), :math:`q_{atm}` is the atmospheric specific +humidity (kg kg\ :sup:`-1`), :math:`q_{soil}` , :math:`q_{sno}` , and :math:`q_{h2osfc}` are the specific humidities +(kg kg\ :sup:`-1`) of the soil, snow, and surface water, respectively, and :math:`r_{aw}` is the aerodynamic resistance to water vapor +transfer (s m\ :sup:`-1`). The specific humidities of the snow :math:`q_{sno}` and surface water :math:`q_{h2osfc}` are assumed to be at the saturation specific humidity of their respective temperatures .. math:: @@ -662,9 +651,8 @@ potential :math:`\psi` as in Philip (1957) \alpha _{soil} =\exp \left(\frac{\psi _{1} g}{1\times 10^{3} R_{wv} T_{1} } \right) -where :math:`R_{wv}` is the gas constant for water vapor (J -kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), :math:`g` is the -gravitational acceleration (m s\ :math:`{}^{-2}`) (Table 2.6), and +where :math:`R_{wv}` is the gas constant for water vapor (J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), :math:`g` is the +gravitational acceleration (m s\ :sup:`-2`) (Table 2.6), and :math:`\psi _{1}` is the soil water matric potential of the top soil layer (mm). The soil water matric potential :math:`\psi _{1}` is @@ -686,11 +674,11 @@ soil layer with respect to saturation. The surface wetness where :math:`\Delta z_{1}` is the thickness of the top soil layer (m), :math:`\rho _{liq}` and :math:`\rho _{ice}` are the density of liquid -water and ice (kg m\ :math:`{}^{-3}`) (Table 2.6), :math:`w_{liq,\, 1}` +water and ice (kg m\ :sup:`-3`) (Table 2.6), :math:`w_{liq,\, 1}` and :math:`w_{ice,\, 1}` are the mass of liquid water and ice of the -top soil layer (:math:`\text{kg} \text{m}^{-2}`) (Chapter 7), and +top soil layer (kg m\ :sup:`-2`) (Chapter 7), and :math:`\theta _{sat,\, 1}` is the saturated volumetric water content -(i.e., porosity) of the top soil layer (:math:`\text{mm}^{3}` :math:`\text{mm}^{-3}`) (section 7.4.1). If +(i.e., porosity) of the top soil layer (mm\ :sup:`3` mm\ :sup:`-3`) (section 7.4.1). If :math:`q_{sat}^{T_{1} } >q_{atm}` and :math:`q_{atm} >q_{soil}` , then :math:`q_{soil} =q_{atm}` and :math:`\frac{dq_{soil} }{dT} =0`. This prevents large increases (decreases) in :math:`q_{soil}` for small @@ -708,7 +696,7 @@ surface within the dry part of the soil (Sakaguchi and Zeng 2009) as where :math:`\theta _{fc,\, 1}` is the field capacity of the top soil layer and :math:`0.01{\le \theta _{1} \mathord{\left/ {\vphantom {\le \theta _{1} \theta _{fc,\, 1} \le 1}} \right. \kern-\nulldelimiterspace} \theta _{fc,\, 1} \le 1}` . -The volumetric water content of the top soil layer (:math:`\text{mm}^{3}` :math:`\text{mm}^{-3}`) is +The volumetric water content of the top soil layer (mm\ :sup:`3` mm\ :sup:`-3`) is .. math:: :label: 5.77) @@ -716,7 +704,7 @@ The volumetric water content of the top soil layer (:math:`\text{mm}^{3}` :math: \theta _{1} =\frac{1}{\Delta z_{1} } \left[\frac{w_{liq,\, 1} }{\rho _{liq} } +\frac{w_{ice,\, 1} }{\rho _{ice} } \right]. The volumetric water content at field capacity is derived by assuming a -hydraulic conductivity of 0.1 mm day\ :math:`{}^{-1}` and inverting the +hydraulic conductivity of 0.1 mm day\ :sup:`-1` and inverting the hydraulic conductivity function (section 7.4.1) as .. math:: @@ -725,7 +713,7 @@ hydraulic conductivity function (section 7.4.1) as \theta _{fc,\, 1} =\theta _{sat,\, 1} \left[\frac{0.1}{86400k_{sat,\, 1} } \right]^{\frac{1}{2B_{i} +3} } where :math:`k_{sat,\, 1}` is the saturated hydraulic conductivity of -the top soil layer (mm s\ :math:`{}^{-1}`) (section 7.4.1) and the +the top soil layer (mm s\ :sup:`-1`) (section 7.4.1) and the exponent :math:`B_{1}` is a function of soil texture (section 7.4.1). The roughness lengths used to calculate :math:`r_{am}` , @@ -748,18 +736,16 @@ Zilitinkevich (1970) is adopted by Zeng and Dickinson (1998) z_{0h,\, g} =z_{0w,\, g} =z_{0m,\, g} e^{-a\left({u_{*} z_{0m,\, g} \mathord{\left/ {\vphantom {u_{*} z_{0m,\, g} \upsilon }} \right. \kern-\nulldelimiterspace} \upsilon } \right)^{0.45} } where the quantity -:math:`{u_{*} z_{0m,\, g} \mathord{\left/ {\vphantom {u_{*} z_{0m,\, g} \upsilon }} \right. \kern-\nulldelimiterspace} \upsilon }` -is the roughness Reynolds number (and may be interpreted as the Reynolds -number of the smallest turbulent eddy in the flow) with the kinematic -viscosity of air :math:`\upsilon =1.5\times 10^{-5}` m\ :math:`{}^{2}` -s\ :math:`{}^{-1}` and :math:`a=0.13`. +:math:`{u_{\*} z_{0m,\, g} \mathord{\left/ {\vphantom {u_{*} z_{0m,\, g} \upsilon }} \right. \kern-\nulldelimiterspace} \upsilon }` +is the roughness Reynolds number (and may be interpreted as the Reynolds number of the smallest turbulent eddy in the flow) with the kinematic +viscosity of air :math:`\upsilon =1.5\times 10^{-5}` m\ :sup:`2` s\ :sup:`-1` and :math:`a=0.13`. The numerical solution for the fluxes of momentum, sensible heat, and water vapor flux from non-vegetated surfaces proceeds as follows: #. An initial guess for the wind speed :math:`V_{a}` is obtained from eq. assuming an initial convective velocity :math:`U_{c} =0` m - s\ :math:`{}^{-1}` for stable conditions + s\ :sup:`-1` for stable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` as evaluated from eq. ) and :math:`U_{c} =0.5` for unstable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). @@ -886,19 +872,18 @@ where, with reference to Figure 5.1, H_{h2osfc} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{h2osfc} \right)}{r_{ah} ^{{'} } } -where :math:`\rho _{atm}` is the density of atmospheric air (kg -m\ :math:`{}^{-3}`), :math:`C_{p}` is the specific heat capacity of air -(J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), +where :math:`\rho _{atm}` is the density of atmospheric air (kg m\ :sup:`-3`), :math:`C_{p}` is the specific heat capacity of air +(J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), :math:`\theta _{atm}` is the atmospheric potential temperature (K), and :math:`r_{ah}` is the aerodynamic resistance to sensible heat transfer -(s m\ :math:`{}^{-1}`). +(s m\ :sup:`-1`). Here, :math:`T_{s}` is the surface temperature at height :math:`z_{0h} +d`, also referred to as the canopy air temperature. :math:`L` and :math:`S` are the exposed leaf and stem area indices (section 2.1.4), :math:`r_{b}` is the leaf boundary layer resistance (s -m\ :math:`{}^{-1}`), and :math:`r_{ah} ^{{'} }` is the aerodynamic -resistance (s m\ :math:`{}^{-1}`) to heat transfer between the ground at +m\ :sup:`-1`), and :math:`r_{ah} ^{{'} }` is the aerodynamic +resistance (s m\ :sup:`-1`) to heat transfer between the ground at height :math:`z_{0h} ^{{'} }` and the canopy air at height :math:`z_{0h} +d`. @@ -938,7 +923,7 @@ where are the sensible heat conductances from the canopy air to the atmosphere, the ground to canopy air, and leaf surface to canopy air, -respectively (m s\ :math:`{}^{-1}`). +respectively (m s\ :sup:`-1`). When the expression for :math:`T_{s}` is substituted into equation , the sensible heat flux from vegetation :math:`H_{v}` is a function of @@ -1000,19 +985,18 @@ where, with reference to Figure 5.2, E_{h2osfc} =-\rho _{atm} \frac{\left(q_{s} -q_{h2osfc} \right)}{r_{aw} ^{{'} } +r_{litter} } -where :math:`q_{atm}` is the atmospheric specific humidity (kg -kg\ :math:`{}^{-1}`), :math:`r_{aw}` is the aerodynamic resistance to -water vapor transfer (s m\ :math:`{}^{-1}`), :math:`q_{sat}^{T_{v} }` -(kg kg\ :math:`{}^{-1}`) is the saturation water vapor specific humidity +where :math:`q_{atm}` is the atmospheric specific humidity (kg kg\ :sup:`-1`), :math:`r_{aw}` is the aerodynamic resistance to +water vapor transfer (s m\ :sup:`-1`), :math:`q_{sat}^{T_{v} }` +(kg kg\ :sup:`-1`) is the saturation water vapor specific humidity at the vegetation temperature (section 5.5), :math:`q_{g}` , :math:`q_{sno}` , and :math:`q_{h2osfc}` are the specific humidities of the soil, snow, and surface water (section 5.2), :math:`r_{aw} ^{{'} }` is the aerodynamic resistance (s -m\ :math:`{}^{-1}`) to water vapor transfer between the ground at height +m\ :sup:`-1`) to water vapor transfer between the ground at height :math:`z_{0w} ^{{'} }` and the canopy air at height :math:`z_{0w} +d`, :math:`\beta _{soi}` is an empirical function of soil water (section 5.2), and :math:`r_{litter}` is a resistance for the plant litter layer -(s m\ :math:`{}^{-1}`). :math:`r_{total}` is the total resistance to +(s m\ :sup:`-1`). :math:`r_{total}` is the total resistance to water vapor transfer from the canopy to the canopy air and includes contributions from leaf boundary layer and sunlit and shaded stomatal resistances :math:`r_{b}` , :math:`r_{s}^{sun}` , and @@ -1063,7 +1047,7 @@ as r''=\left\{\begin{array}{l} {\min \left(f_{wet} +r_{dry} ^{{'} {'} } ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right)\qquad E_{v}^{w,\, pot} >0,\, \beta _{t} >0} \\ {\min \left(f_{wet} ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right)\qquad E_{v}^{w,\, pot} >0,\, \beta _{t} \le 0} \\ {1\qquad E_{v}^{w,\, pot} \le 0} \end{array}\right\} where :math:`f_{wet}` is the fraction of leaves and stems that are wet -(section 7.1), :math:`W_{can}` is canopy water (kg m\ :math:`{}^{-2}`) +(section 7.1), :math:`W_{can}` is canopy water (kg m\ :sup:`-2`) (section 7.1), :math:`\Delta t` is the time step (s), and :math:`\beta _{t}` is a soil moisture function limiting transpiration (Chapter 8). The potential evaporation from wet foliage per unit wetted @@ -1085,7 +1069,7 @@ where :math:`f_{dry}` is the fraction of leaves that are dry (section 7.1), :math:`L^{sun}` and :math:`L^{sha}` are the sunlit and shaded leaf area indices (section 4.1), and :math:`r_{s}^{sun}` and :math:`r_{s}^{sha}` are the sunlit and shaded stomatal resistances (s -m\ :math:`{}^{-1}`) (Chapter 8). +m\ :sup:`-1`) (Chapter 8). When the expression for :math:`q_{s}` is substituted into equation , the water vapor flux from vegetation :math:`E_{v}` is a function of @@ -1122,7 +1106,7 @@ where U_{av} =V_{a} \sqrt{\frac{1}{r_{am} V_{a} } } =u_{*} is the magnitude of the wind velocity incident on the leaves -(equivalent here to friction velocity) (m s\ :math:`{}^{-1}`) and +(equivalent here to friction velocity) (m s\ :sup:`-1`) and :math:`C_{s}` is the turbulent transfer coefficient between the underlying soil and the canopy air. :math:`C_{s}` is obtained by interpolation between values for dense canopy and bare soil (Zeng et al. @@ -1158,7 +1142,7 @@ determined from S=\frac{gz_{top} \left(T_{s} -T_{g} \right)}{T_{s} u_{*}^{2} } where :math:`g` is the gravitational acceleration (m -s\ :math:`{}^{-2}`) (Table 2.6), and :math:`z_{top}` is canopy top +s\ :sup:`-2`) (Table 2.6), and :math:`z_{top}` is canopy top height (m) (Table 2.2). The bare soil turbulent transfer coefficient is .. math:: @@ -1167,21 +1151,19 @@ height (m) (Table 2.2). The bare soil turbulent transfer coefficient is C_{s,\, bare} =\frac{k}{a} \left(\frac{z_{0m,\, g} U_{av} }{\upsilon } \right)^{-0.45} where the kinematic viscosity of air -:math:`\upsilon =1.5\times 10^{-5}` m\ :math:`{}^{2}` -s\ :math:`{}^{-1}` and :math:`a=0.13`. +:math:`\upsilon =1.5\times 10^{-5}` m\ :sup:`2` +s\ :sup:`-1` and :math:`a=0.13`. The litter resistance :math:`r_{litter}` (Sakaguchi and Zeng 2009) (s -m\ :math:`{}^{-1}`) is +m\ :sup:`-1`) is .. math:: :label: 5.120) r_{litter} =\frac{1}{0.004u_{*} } \left(1-e^{-L_{litter}^{eff} } \right) -where the effective litter area index :math:`L_{litter}^{eff}` -(:math:`\text{m}^{2}` :math:`\text{m}^{-2}`) is the fraction of plant litter -area index :math:`L_{litter}` (currently set to 0.5 :math:`\text{m}^{2}` -:math:`\text{m}^{-2}`) that is not covered by snow +where the effective litter area index :math:`L_{litter}^{eff}` (m\ :sup:`2` m\ :sup:`-2`) is the fraction of plant litter +area index :math:`L_{litter}` (currently set to 0.5 m\ :sup:`2` m\ :sup:`-2`) that is not covered by snow .. math:: :label: 5.121) @@ -1206,7 +1188,7 @@ The leaf boundary layer resistance :math:`r_{b}` is r_{b} =\frac{1}{C_{v} } \left({U_{av} \mathord{\left/ {\vphantom {U_{av} d_{leaf} }} \right. \kern-\nulldelimiterspace} d_{leaf} } \right)^{{-1\mathord{\left/ {\vphantom {-1 2}} \right. \kern-\nulldelimiterspace} 2} } -where :math:`C_{v} =0.01` m s\ :math:`{}^{-1/2}` is the turbulent +where :math:`C_{v} =0.01` m\ s\ :sup:`-1/2` is the turbulent transfer coefficient between the canopy surface and canopy air, and :math:`d_{leaf}` is the characteristic dimension of the leaves in the direction of wind flow (Table 5.1). @@ -1261,7 +1243,7 @@ length and displacement height to canopy top height, respectively (Table V=\frac{1-\exp \left\{-\beta \min \left[L+S,\, \left(L+S\right)_{cr} \right]\right\}}{1-\exp \left[-\beta \left(L+S\right)_{cr} \right]} -where :math:`\beta =1` and :math:`\left(L+S\right)_{cr} =2` (:math:`\text{m}^{2}` m\ :math:`{}^{-2}`) is a critical value of exposed leaf +where :math:`\beta =1` and :math:`\left(L+S\right)_{cr} =2` (m\ :sup:`2` m\ :sup:`-2`) is a critical value of exposed leaf plus stem area for which :math:`z_{0m}` reaches its maximum. Table 5.1. Plant functional type aerodynamic parameters @@ -1291,11 +1273,11 @@ Table 5.1. Plant functional type aerodynamic parameters +----------------------------------+--------------------+------------------+-------------------------+ | BDS boreal | 0.120 | 0.68 | 0.04 | +----------------------------------+--------------------+------------------+-------------------------+ -| C\ :math:`{}_{3}` arctic grass | 0.120 | 0.68 | 0.04 | +| C\ :sub:`3` arctic grass | 0.120 | 0.68 | 0.04 | +----------------------------------+--------------------+------------------+-------------------------+ -| C\ :math:`{}_{3}` grass | 0.120 | 0.68 | 0.04 | +| C\ :sub:`3` grass | 0.120 | 0.68 | 0.04 | +----------------------------------+--------------------+------------------+-------------------------+ -| C\ :math:`{}_{4}` grass | 0.120 | 0.68 | 0.04 | +| C\ :sub:`4` grass | 0.120 | 0.68 | 0.04 | +----------------------------------+--------------------+------------------+-------------------------+ | Crop R | 0.120 | 0.68 | 0.04 | +----------------------------------+--------------------+------------------+-------------------------+ @@ -1413,7 +1395,7 @@ proceeds as follows: #. An initial guess for the wind speed :math:`V_{a}` is obtained from eq. assuming an initial convective velocity :math:`U_{c} =0` m - s\ :math:`{}^{-1}` for stable conditions + s\ :sup:`-1` for stable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` as evaluated from eq. ) and :math:`U_{c} =0.5` for unstable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). @@ -1594,7 +1576,7 @@ is the sum of :math:`E'_{g}` over all evaporating PFTs where relative area of the :math:`j^{th}` PFT with respect to the column, and :math:`npft` is the number of PFTs on the column. :math:`w_{ice,\, snl+1}` and :math:`w_{liq,\, snl+1}` are the ice and -liquid water contents (kg m\ :math:`{}^{-2}`) of the top snow/soil layer +liquid water contents (kg m\ :sup:`-2`) of the top snow/soil layer (Chapter 7). Any resulting energy deficit is assigned to sensible heat as @@ -1603,13 +1585,9 @@ as H''_{g} =H_{g} +\lambda \left(E'_{g} -E''_{g} \right). -The ground water vapor flux :math:`E''_{g}` is partitioned into -evaporation of liquid water from snow/soil :math:`q_{seva}` (kg -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), sublimation from snow/soil ice -:math:`q_{subl}` (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), liquid dew -on snow/soil :math:`q_{sdew}` (kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`), or frost on snow/soil :math:`q_{frost}` (kg -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) as +The ground water vapor flux :math:`E''_{g}` is partitioned into evaporation of liquid water from snow/soil :math:`q_{seva}` +(kg\ m\ :sup:`-2` s\ :sup:`-1`), sublimation from snow/soil ice :math:`q_{subl}` (kg m\ :sup:`-2` s\ :sup:`-1`), liquid dew +on snow/soil :math:`q_{sdew}` (kg m\ :sup:`-2` s\ :sup:`-1`), or frost on snow/soil :math:`q_{frost}` (kg m\ :sup:`-2` s\ :sup:`-1`) as .. math:: :label: 5.146) @@ -1677,7 +1655,7 @@ When converting ground water vapor flux to an energy flux, the term where :math:`\lambda _{sub}` and :math:`\lambda _{vap}` are the latent heat of sublimation and vaporization, respectively (J -kg\ :math:`{}^{-1}`) (Table 2.6). When converting vegetation water vapor +(kg\ :sup:`-1`) (Table 2.6). When converting vegetation water vapor flux to an energy flux, :math:`\lambda _{vap}` is used. The system balances energy as diff --git a/doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst b/doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst index d39a780958..83dc1e3579 100644 --- a/doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst @@ -9,10 +9,10 @@ The first law of heat conduction is F=-\lambda \nabla T where :math:`F` is the amount of heat conducted across a unit -cross-sectional area in unit time (W m\ :math:`{}^{-2}`), -:math:`\lambda` is thermal conductivity (W m\ :math:`{}^{-1}` -K\ :math:`{}^{-1}`), and :math:`\nabla T` is the spatial gradient of -temperature (K m\ :math:`{}^{-1}`). In one-dimensional form +cross-sectional area in unit time (W m\ :sup:`-2`), +:math:`\lambda` is thermal conductivity (W m\ :sup:`-1` +K\ :sup:`-1`), and :math:`\nabla T` is the spatial gradient of +temperature (K m\ :sup:`-1`). In one-dimensional form .. math:: :label: ZEqnNum105915 @@ -30,7 +30,7 @@ in the form of the continuity equation is invoked as c\frac{\partial T}{\partial t} =-\frac{\partial F_{z} }{\partial z} where :math:`c` is the volumetric snow/soil heat capacity (J -m\ :math:`{}^{-3}` K\ :math:`{}^{-1}`) and :math:`t` is time (s). +m\ :sup:`-3` K\ :sup:`-1`) and :math:`t` is time (s). Combining equations and yields the second law of heat conduction in one-dimensional form @@ -164,9 +164,9 @@ are defined as negative values Note that :math:`z_{h,\, 0}` , the interface between the bottom snow layer and the top soil layer, is zero. Thermal properties (i.e., temperature :math:`T_{i}` [K]; thermal conductivity -:math:`\lambda _{i}` [W m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`]; -volumetric heat capacity :math:`c_{i}` [J m\ :math:`{}^{-3}` -K\ :math:`{}^{-1}`]) are defined for soil layers at the node depths +:math:`\lambda _{i}` [W m\ :sup:`-1` K\ :sup:`-1`]; +volumetric heat capacity :math:`c_{i}` [J m\ :sup:`-3` +K\ :sup:`-1`]) are defined for soil layers at the node depths (Figure 6.1) and for snow layers at the layer midpoints. When present, snow occupies a fraction of a grid cell’s area, therefore snow depth represents the thickness of the snowpack averaged over only the snow @@ -175,7 +175,7 @@ of the snow covered area as :math:`\bar{z}_{sno} =f_{sno} z_{sno}` . By default, the grid cell average snow depth is written to the history file. -The heat flux :math:`F_{i}` (W m\ :math:`{}^{-2}`) from layer :math:`i` +The heat flux :math:`F_{i}` (W m\ :sup:`-2`) from layer :math:`i` to layer :math:`i+1` is .. math:: @@ -257,7 +257,7 @@ element band-diagonal system of equations. For the top soil layer :math:`i=1` , top snow layer :math:`i=snl+1`, or surface water layer, the heat flux from the overlying atmosphere -:math:`h` (W m\ :math:`{}^{-2}`, defined as positive into the surface) +:math:`h` (W m\ :sup:`-2`, defined as positive into the surface) is .. math:: @@ -346,10 +346,8 @@ where the partial derivative of the net longwave radiation is and the partial derivatives of the sensible and latent heat fluxes are given by equations and for non-vegetated surfaces, and by equations and for vegetated surfaces. :math:`\sigma` is the Stefan-Boltzmann constant -(W m\ :math:`{}^{-2}` K\ :math:`{}^{-4}`) (Table 2.6) and -:math:`\varepsilon _{g}` is the ground emissivity (section 4.2). For -purposes of computing :math:`h` and -:math:`\frac{\partial h}{\partial T_{g} }` , the term :math:`\lambda` +(W m\ :sup:`-2` K\ :sup:`-4`) (Table 2.6) and :math:`\varepsilon _{g}` is the ground emissivity (section 4.2). For +purposes of computing :math:`h` and :math:`\frac{\partial h}{\partial T_{g} }` , the term :math:`\lambda` is arbitrarily assumed to be .. math:: @@ -359,9 +357,9 @@ is arbitrarily assumed to be where :math:`\lambda _{sub}` and :math:`\lambda _{vap}` are the latent heat of sublimation and vaporization, respectively (J -kg\ :math:`{}^{-1}`) (Table 2.6), and :math:`w_{liq,\, snl+1}` and +kg\ :sup:`-1`) (Table 2.6), and :math:`w_{liq,\, snl+1}` and :math:`w_{ice,\, snl+1}` are the liquid water and ice contents of the -top snow/soil layer, respectively (kg m\ :math:`{}^{-2}`) (Chapter 7). +top snow/soil layer, respectively (kg m\ :sup:`-2`) (Chapter 7). For the top soil layer, :math:`i=1`, the coefficients are @@ -544,7 +542,7 @@ phase change will take place as where :math:`T_{i}^{n+1}` is the soil layer temperature after solution of the tridiagonal equation set, :math:`w_{ice,\, i}` and :math:`w_{liq,\, i}` are the mass of ice and liquid water (kg -m\ :math:`{}^{-2}`) in each snow/soil layer, respectively, and +m\ :sup:`-2`) in each snow/soil layer, respectively, and :math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). For the freezing process in soil layers, the concept of supercooled soil water from Niu and Yang (2006) is adopted. The supercooled soil water is @@ -558,11 +556,11 @@ depression equation w_{liq,\, \max ,\, i} =\Delta z_{i} \theta _{sat,\, i} \left[\frac{10^{3} L_{f} \left(T_{f} -T_{i} \right)}{gT_{i} \psi _{sat,\, i} } \right]^{{-1\mathord{\left/ {\vphantom {-1 B_{i} }} \right. \kern-\nulldelimiterspace} B_{i} } } \qquad T_{i} 0`), there are no explicit snow layers (:math:`snl=0`), and :math:`\frac{H_{1} \Delta t}{L_{f} } >0` (melting), the snow mass -:math:`W_{sno}` (kg m\ :math:`{}^{-2}`) is reduced according to +:math:`W_{sno}` (kg m\ :sup:`-2`) is reduced according to .. math:: :label: 6.62) @@ -665,9 +663,9 @@ available to the top soil layer as The ice mass, liquid water content, and temperature of the top soil layer are then determined from equations , , and using the recalculated -energy from equation . Snow melt :math:`M_{1S}` (kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`) and phase change energy :math:`E_{p,\, 1S}` (W -m\ :math:`{}^{-2}`) for this special case are +energy from equation . Snow melt :math:`M_{1S}` (kg m\ :sup:`-2` +s\ :sup:`-1`) and phase change energy :math:`E_{p,\, 1S}` (W +m\ :sup:`-2`) for this special case are .. math:: :label: 6.66) @@ -679,7 +677,7 @@ m\ :math:`{}^{-2}`) for this special case are E_{p,\, 1S} =L_{f} M_{1S} . -The total energy of phase change :math:`E_{p}` (W m\ :math:`{}^{-2}`) +The total energy of phase change :math:`E_{p}` (W m\ :sup:`-2`) for the snow/soil column is .. math:: @@ -694,8 +692,8 @@ where E_{p,\, i} =L_{f} \frac{\left(w_{ice,\, i}^{n} -w_{ice,\, i}^{n+1} \right)}{\Delta t} . -The total snow melt :math:`M` (kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`) is +The total snow melt :math:`M` (kg m\ :sup:`-2` +s\ :sup:`-1`) is .. math:: :label: 6.70) @@ -769,8 +767,8 @@ organic matter fraction :math:`f_{om,i}` is f_{om,i} =\rho _{om,i} /\rho _{om,\max } . -Soil thermal conductivity :math:`\lambda _{i}` (W m\ :math:`{}^{-1}` -K\ :math:`{}^{-1}`) is from Farouki (1981) +Soil thermal conductivity :math:`\lambda _{i}` (W m\ :sup:`-1` +K\ :sup:`-1`) is from Farouki (1981) .. math:: :label: 6.78) @@ -781,8 +779,8 @@ where :math:`\lambda _{sat,\, i}` is the saturated thermal conductivity, :math:`\lambda _{dry,\, i}` is the dry thermal conductivity, :math:`K_{e,\, i}` is the Kersten number, :math:`S_{r,\, i}` is the wetness of the soil with respect to -saturation, and :math:`\lambda _{bedrock} =3` W m\ :math:`{}^{-1}` -K\ :math:`{}^{-1}` is the thermal conductivity assumed for the deep +saturation, and :math:`\lambda _{bedrock} =3` W m\ :sup:`-1` +K\ :sup:`-1` is the thermal conductivity assumed for the deep ground layers (typical of saturated granitic rock; Clauser and Huenges, 1995). For glaciers and wetlands, @@ -794,7 +792,7 @@ ground layers (typical of saturated granitic rock; Clauser and Huenges, where :math:`\lambda _{liq}` and :math:`\lambda _{ice}` are the thermal conductivities of liquid water and ice, respectively (Table 2.6). The saturated thermal conductivity :math:`\lambda _{sat,\, i}` (W -m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) depends on the thermal +m\ :sup:`-1` K\ :sup:`-1`) depends on the thermal conductivities of the soil solid, liquid water, and ice constituents .. math:: @@ -819,8 +817,8 @@ where the mineral soil solid thermal conductivity \lambda _{s,\, \min ,i} =\frac{8.80{\rm \; }\left(\% sand\right)_{i} +{\rm 2.92\; }\left(\% clay\right)_{i} }{\left(\% sand\right)_{i} +\left(\% clay\right)_{i} } , -and :math:`\lambda _{s,om} =0.25`\ W m\ :math:`{}^{-1}` -K\ :math:`{}^{-1}` (Farouki, 1981). :math:`\theta _{sat,\, i}` is the +and :math:`\lambda _{s,om} =0.25`\ W m\ :sup:`-1` +K\ :sup:`-1` (Farouki, 1981). :math:`\theta _{sat,\, i}` is the volumetric water content at saturation (porosity) (section 7.4.1). The thermal conductivity of dry soil is @@ -831,18 +829,18 @@ The thermal conductivity of dry soil is \lambda _{dry,i} =(1-f_{om,i} )\lambda _{dry,\min ,i} +f_{om,i} \lambda _{dry,om} where the thermal conductivity of dry mineral soil -:math:`\lambda _{dry,\min ,i}` \ (W m\ :math:`{}^{-1}` -K\ :math:`{}^{-1}`) depends on the bulk density +:math:`\lambda _{dry,\min ,i}` \ (W m\ :sup:`-1` +K\ :sup:`-1`) depends on the bulk density :math:`\rho _{d,\, i} =2700\left(1-\theta _{sat,\, i} \right)` (kg -m\ :math:`{}^{-3}`) as +m\ :sup:`-3`) as .. math:: :label: 6.84) \lambda _{dry,\, \min ,i} =\frac{0.135\rho _{d,\, i} +64.7}{2700-0.947\rho _{d,\, i} } -and :math:`\lambda _{dry,om} =0.05` W m\ :math:`{}^{-1}` -K\ :math:`{}^{-1}` (Farouki, 1981) is the dry thermal conductivity of +and :math:`\lambda _{dry,om} =0.05` W m\ :sup:`-1` +K\ :sup:`-1` (Farouki, 1981) is the dry thermal conductivity of organic matter. The Kersten number :math:`K_{e,\, i}` is a function of the degree of saturation :math:`S_{r}` and phase of water @@ -858,8 +856,8 @@ where S_{r,\, i} =\left(\frac{w_{liq,\, i} }{\rho _{liq} \Delta z_{i} } +\frac{w_{ice,\, i} }{\rho _{ice} \Delta z_{i} } \right)\frac{1}{\theta _{sat,\, i} } =\frac{\theta _{liq,\, i} +\theta _{ice,\, i} }{\theta _{sat,\, i} } \le 1. -Thermal conductivity :math:`\lambda _{i}` (W m\ :math:`{}^{-1}` -K\ :math:`{}^{-1}`) for snow is from Jordan (1991) +Thermal conductivity :math:`\lambda _{i}` (W m\ :sup:`-1` +K\ :sup:`-1`) for snow is from Jordan (1991) .. math:: :label: 6.87) @@ -868,15 +866,15 @@ K\ :math:`{}^{-1}`) for snow is from Jordan (1991) where :math:`\lambda _{air}` is the thermal conductivity of air (Table 2.6) and :math:`\rho _{sno,\, i}` is the bulk density of snow (kg -m\ :math:`{}^{-3}`) +m\ :sup:`-3`) .. math:: :label: 6.88) \rho _{sno,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{\Delta z_{i} } . -The volumetric heat capacity :math:`c_{i}` (J m\ :math:`{}^{-3}` -K\ :math:`{}^{-1}`) for soil is from de Vries (1963) and depends on the +The volumetric heat capacity :math:`c_{i}` (J m\ :sup:`-3` +K\ :sup:`-1`) for soil is from de Vries (1963) and depends on the heat capacities of the soil solid, liquid water, and ice constituents .. math:: @@ -885,9 +883,9 @@ heat capacities of the soil solid, liquid water, and ice constituents c_{i} =c_{s,\, i} \left(1-\theta _{sat,\, i} \right)+\frac{w_{ice,\, i} }{\Delta z_{i} } C_{ice} +\frac{w_{liq,\, i} }{\Delta z_{i} } C_{liq} where :math:`C_{liq}` and :math:`C_{ice}` are the specific heat -capacities (J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) of liquid water +capacities (J kg\ :sup:`-1` K\ :sup:`-1`) of liquid water and ice, respectively (Table 2.6). The heat capacity of soil solids -:math:`c_{s,i}` \ (J m\ :math:`{}^{-3}` K\ :math:`{}^{-1}`) is +:math:`c_{s,i}` \ (J m\ :sup:`-3` K\ :sup:`-1`) is .. math:: :label: 6.90) @@ -895,17 +893,17 @@ and ice, respectively (Table 2.6). The heat capacity of soil solids c_{s,i} =(1-f_{om,i} )c_{s,\min ,i} +f_{om,i} c_{s,om} where the heat capacity of mineral soil solids -:math:`c_{s,\min ,\, i}` (J m\ :math:`{}^{-3}` K\ :math:`{}^{-1}`) is +:math:`c_{s,\min ,\, i}` (J m\ :sup:`-3` K\ :sup:`-1`) is .. math:: :label: 6.91) \begin{array}{l} {c_{s,\min ,\, i} =\left(\frac{2.128{\rm \; }\left(\% sand\right)_{i} +{\rm 2.385\; }\left(\% clay\right)_{i} }{\left(\% sand\right)_{i} +\left(\% clay\right)_{i} } \right)\times 10^{6} \qquad i=1,\ldots ,N_{levsoi} } \\ {c_{s,\, \min ,i} =c_{s,\, bedrock} \qquad i=N_{levsoi} +1,\ldots ,N_{levgrnd} } \end{array} -where :math:`c_{s,bedrock} =2\times 10^{6}` J m\ :math:`{}^{-3}` -K\ :math:`{}^{-1}` is the heat capacity of bedrock and -:math:`c_{s,om} =2.5\times 10^{6}` \ J m\ :math:`{}^{-3}` -K\ :math:`{}^{-1}` (Farouki, 1981) is the heat capacity of organic +where :math:`c_{s,bedrock} =2\times 10^{6}` J m\ :sup:`-3` +K\ :sup:`-1` is the heat capacity of bedrock and +:math:`c_{s,om} =2.5\times 10^{6}` \ J m\ :sup:`-3` +K\ :sup:`-1` (Farouki, 1981) is the heat capacity of organic matter. For glaciers, wetlands, and snow .. math:: diff --git a/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst b/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst index 47359c6b77..20ed6594d2 100644 --- a/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst +++ b/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst @@ -9,7 +9,7 @@ changes in canopy water :math:`\Delta W_{can}` , surface water :math:`\Delta W_{sfc}` , snow water :math:`\Delta W_{sno}` , soil water :math:`\Delta w_{liq,\, i}` , and soil ice :math:`\Delta w_{ice,\, i}` , and water in the unconfined aquifer :math:`\Delta W_{a}` (all in kg -m\ :math:`{}^{-2}` or mm of H\ :math:`{}_{2}`\ O) (Figure 7.1). +m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (Figure 7.1). The total water balance of the system is @@ -26,8 +26,8 @@ ET from vegetation (Chapter 5), :math:`E_{g}` is ground evaporation :math:`q_{drai}` is sub-surface drainage (section 7.6), :math:`q_{rgwl}` and :math:`q_{snwcp,ice}` are liquid and solid runoff from glaciers, wetlands, and lakes, and runoff from other surface types -due to snow capping (section 7.7) (all in kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`), :math:`N_{levsoi}` is the number of soil layers +due to snow capping (section 7.7) (all in kg m\ :sup:`-2` +s\ :sup:`-1`), :math:`N_{levsoi}` is the number of soil layers (note that hydrology calculations are only done over soil layers 1 to :math:`N_{levsoi}` ; ground levels :math:`N_{levsoi} +1`\ to :math:`N_{levgrnd}` are currently hydrologically inactive; Lawrence et @@ -43,7 +43,7 @@ Canopy Water Precipitation is either intercepted by the canopy, falls directly to the snow/soil surface (throughfall), or drips off the vegetation (canopy drip). Interception by vegetation :math:`q_{intr}` (kg -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) does not distinguish between +m\ :sup:`-2` s\ :sup:`-1`) does not distinguish between liquid and solid phases .. math:: @@ -54,7 +54,7 @@ liquid and solid phases where :math:`L` and :math:`S` are the exposed leaf and stem area index, respectively (section 2.1.4), and :math:`\alpha =0.25` scales interception from point to grid cell (Lawrence et al. 2007). Throughfall -(kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), however, is divided into +(kg m\ :sup:`-2` s\ :sup:`-1`), however, is divided into liquid and solid phases reaching the ground (soil or snow surface) as .. math:: @@ -88,7 +88,7 @@ where is the canopy water after accounting for interception, :math:`W_{can}^{n}` is the canopy water from the previous time step, -and :math:`W_{can,\, \max }` (kg m\ :math:`{}^{-2}`) is the maximum +and :math:`W_{can,\, \max }` (kg m\ :sup:`-2`) is the maximum amount of water the canopy can hold .. math:: @@ -97,7 +97,7 @@ amount of water the canopy can hold W_{can,\, \max } =p\left(L+S\right). The maximum storage of solid water is assumed to be the same as that of -liquid water, :math:`p=0.1` kg m\ :math:`{}^{-2}` (Dickinson et al. +liquid water, :math:`p=0.1` kg m\ :sup:`-2` (Dickinson et al. 1993). The canopy water is updated as .. math:: @@ -164,14 +164,14 @@ Shown are three snow layers, :math:`i=-2`, :math:`i=-1`, and .. image:: image2.png The state variables for snow are the mass of water :math:`w_{liq,i}` -(kg m\ :math:`{}^{-2}`), mass of ice :math:`w_{ice,i}` (kg -m\ :math:`{}^{-2}`), layer thickness :math:`\Delta z_{i}` (m), and +(kg m\ :sup:`-2`), mass of ice :math:`w_{ice,i}` (kg +m\ :sup:`-2`), layer thickness :math:`\Delta z_{i}` (m), and temperature :math:`T_{i}` (Chapter 6). The water vapor phase is neglected. Snow can also exist in the model without being represented by explicit snow layers. This occurs when the snowpack is less than a specified minimum snow depth (:math:`z_{sno} <0.01` m). In this case, the state variable is the mass of snow :math:`W_{sno}` (kg -m\ :math:`{}^{-2}`). +m\ :sup:`-2`). Section 7.2.1 describes the calculation of fractional snow covered area, which is used in the surface albedo calculation (Chapter 3) and the @@ -236,7 +236,7 @@ The conservation equation for mass of ice in snow layers is where :math:`q_{ice,\, i-1}` is the rate of ice accumulation from precipitation or frost or the rate of ice loss from sublimation (kg -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) in the top layer and +m\ :sup:`-2` s\ :sup:`-1`) in the top layer and :math:`{\left(\Delta w_{ice,\, i} \right)_{p} \mathord{\left/ {\vphantom {\left(\Delta w_{ice,\, i} \right)_{p} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t}` is the change in ice due to phase change (melting rate) (section 6.2). The term :math:`q_{ice,\, i-1}` is computed in two steps as @@ -267,7 +267,7 @@ where \Delta z_{sno} =\frac{q_{grnd,\, ice} \Delta t}{f_{sno} \rho _{sno} } and :math:`\rho _{sno}` is the bulk density of newly fallen snow (kg -m\ :math:`{}^{-3}`) (CityplaceAnderson 1976) +m\ :sup:`-3`) (CityplaceAnderson 1976) .. math:: :label: 7.21) @@ -315,8 +315,8 @@ content is reset to zero and the liquid water content :math:`w_{ice,\, snl+1}^{n+1}` up to zero. The snow water equivalent :math:`W_{sno}` is capped to not exceed 1000 -kg m\ :math:`{}^{-2}`. If the addition of :math:`q_{frost}` were to -result in :math:`W_{sno} >1000` kg m\ :math:`{}^{-2}`, the frost term +kg m\ :sup:`-2`. If the addition of :math:`q_{frost}` were to +result in :math:`W_{sno} >1000` kg m\ :sup:`-2`, the frost term :math:`q_{frost}` is instead added to the ice runoff term :math:`q_{snwcp,\, ice}` (section 7.7). @@ -411,7 +411,7 @@ Black and organic carbon and mineral dust within snow ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Particles within snow originate from atmospheric aerosol deposition -(:math:`D_{sp}` in Table 2.3 (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) +(:math:`D_{sp}` in Table 2.3 (kg m\ :sup:`-2` s\ :sup:`-1`) and influence snow radiative transfer (sections 3.2.1, 3.2.2, and 3.3.3). Particle masses and mixing ratios are represented with a simple mass-conserving scheme. The model maintains masses of the following @@ -453,7 +453,7 @@ radiative calculations are done. Particle masses are then redistributed each time step based on meltwater drainage through the snow column (section 7.2.3) and snow layer combination and subdivision (section 7.2.7). The change in mass of each of the particle species -:math:`\Delta m_{sp,\, i}` (kg m\ :math:`{}^{-2}`) is +:math:`\Delta m_{sp,\, i}` (kg m\ :sup:`-2`) is .. math:: :label: 7.38) @@ -464,10 +464,10 @@ where :math:`k_{sp}` is the meltwater scavenging efficiency that is unique for each species (Table 7.1), :math:`q_{liq,\, i-1}` is the flow of liquid water into layer :math:`i` from the layer above, :math:`q_{liq,\, i}` is the flow of water out of layer :math:`i` into -the layer below (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) (section +the layer below (kg m\ :sup:`-2` s\ :sup:`-1`) (section 7.2.3), :math:`c_{sp,\, i-1}` and :math:`c_{sp,\, i}` are the particle mass mixing ratios in layers :math:`i-1` and :math:`i` (kg -kg\ :math:`{}^{-1}`), :math:`D_{sp}` is the atmospheric deposition rate +kg\ :sup:`-1`), :math:`D_{sp}` is the atmospheric deposition rate (zero for all layers except layer :math:`snl+1`), and :math:`\Delta t` is the model time step (s). The particle mass mixing ratio is @@ -530,7 +530,7 @@ destructive metamorphism of new snow (crystal breakdown due to wind or thermodynamic stress); snow load or overburden (pressure); and melting (changes in snow structure due to melt-freeze cycles plus changes in crystals due to liquid water). The total fractional compaction rate for -each snow layer :math:`C_{R,\, i}` (:math:`\text{s}^{-1}`) is the sum of the +each snow layer :math:`C_{R,\, i}` (s\ :sup:`-1`) is the sum of the three compaction processes .. math:: @@ -548,16 +548,14 @@ Compaction is not allowed if the layer is saturated or if the ice content is below a minimum value (:math:`w_{ice,\, i} \le 0.1`). -Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` -(:math:`{\text s^{-1}}`) is temperature dependent (CityplaceAnderson 1976) +Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` (s\ :sub:`-1`) is temperature dependent (CityplaceAnderson 1976) .. math:: :label: 7.43) C_{R1,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{metamorphism} =-c_{3} c_{1} c_{2} \exp \left[-c_{4} \left(T_{f} -T_{i} \right)\right] -where :math:`c_{3} =2.777\times 10^{-6}` (:math:`\text{s}^{-1}`) is the -fractional compaction rate for :math:`T_{i} =T_{f}`, :math:`c_{4} =0.04` :math:`\text{K}^{-1}`, and +where :math:`c_{3} =2.777\times 10^{-6}` (s\ :sup:`-1`) is the fractional compaction rate for :math:`T_{i} =T_{f}`, :math:`c_{4} =0.04` K\ :sup:`-1`, and .. math:: :label: 7.44) @@ -571,28 +569,25 @@ where :math:`{w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` and :math:`{w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` -are the bulk densities of liquid water and ice (kg m\ :math:`{}^{-3}`). +are the bulk densities of liquid water and ice (kg m\ :sup:`-3`). -The compaction rate as a result of overburden :math:`C_{R2,\; i}` -(:math:`\text{s}^{-1}`) is a linear function of the snow load pressure -:math:`P_{s,\, i}` (:math:`\text{k} \text{g} \text{m}^{-2}`) (CityplaceAnderson 1976) +The compaction rate as a result of overburden :math:`C_{R2,\; i}` (s\ :sup:`-1`) is a linear function of the snow load pressure :math:`P_{s,\, i}` (kg m\ :sup:`-2`) (CityplaceAnderson 1976) .. math:: :label: 7.45) C_{R2,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{overburden} =-\frac{P_{s,\, i} }{\eta } -where :math:`\eta` is a viscosity coefficient (:math:`\text{kg} \text{s} \text{m}^{-2}`) -that varies with density and temperature as +where :math:`\eta` is a viscosity coefficient (kg s m\ :sup:`-2`) that varies with density and temperature as .. math:: :label: 7.46) \eta =\eta _{0} \exp \left[c_{5} \left(T_{f} -T_{i} \right)+c_{6} \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \right] -where :math:`\eta _{0} =9\times 10^{5}` kg s m\ :math:`{}^{-2}`, and -:math:`c_{5} =0.08` K\ :math:`{}^{-1}`, :math:`c_{6} =0.023` -m\ :math:`{}^{3}` kg\ :math:`{}^{-1}` are constants. The snow load +where :math:`\eta _{0} =9\times 10^{5}` kg s m\ :sup:`-2`, and +:math:`c_{5} =0.08` K\ :sup:`-1`, :math:`c_{6} =0.023` +m\ :sup:`3` kg\ :sup:`-1` are constants. The snow load pressure :math:`P_{s,\, i}` is calculated for each layer as the sum of the ice :math:`w_{ice,\, i}` and liquid water contents :math:`w_{liq,\, i}` of the layers above plus half the ice and liquid @@ -603,8 +598,7 @@ water contents of the layer being compacted P_{s,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{2} +\sum _{j=snl+1}^{j=i-1}\left(w_{ice,\, j} +w_{liq,\, j} \right) . -The compaction rate due to melting :math:`C_{R3,\; i}` -(:math:`\text{s}^{-1}`) is taken to be the ratio of the change in snow ice +The compaction rate due to melting :math:`C_{R3,\; i}` (s\ :sup:`-1`) is taken to be the ratio of the change in snow ice mass after the melting to the mass before melting .. math:: @@ -741,8 +735,8 @@ where :math:`h_{c} =h_{1} +h_{2}` is the combined enthalpy h_{i} =\left(C_{ice} w_{ice,\, i} +C_{liq} w_{liq,\, i} \right)\left(T_{i} -T_{f} \right)+L_{f} w_{liq,\, i} . In these equations, :math:`L_{f}` is the latent heat of fusion (J -kg\ :math:`{}^{-1}`) and :math:`C_{liq}` and :math:`C_{ice}` are the -specific heat capacities (J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) of +kg\ :sup:`-1`) and :math:`C_{liq}` and :math:`C_{ice}` are the +specific heat capacities (J kg\ :sup:`-1` K\ :sup:`-1`) of liquid water and ice, respectively (Table 2.6). After layer combination, the node depths and layer interfaces (Figure 7.2) are recalculated from @@ -825,7 +819,7 @@ Surface Runoff, Surface Water Storage, and Infiltration The moisture input at the grid cell surface ,\ :math:`q_{liq,\, 0}` , is the sum of liquid precipitation reaching the ground and melt water from -snow (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`). The moisture flux is +snow (kg m\ :sup:`-2` s\ :sup:`-1`). The moisture flux is then partitioned between surface runoff, surface water storage, and infiltration into the soil. @@ -854,7 +848,7 @@ The fractional saturated area is a function of soil moisture where :math:`f_{\max }` is the potential or maximum value of :math:`f_{sat}` , :math:`f_{over}` is a decay factor -(:math:`\text{m}^{-1}`), and :math:`z_{\nabla}` is the water table depth +(m\ :sup:`-1`), and :math:`z_{\nabla}` is the water table depth (m) (section 7.6). The maximum saturated fraction, :math:`f_{\max }` , is defined as the value of the discrete cumulative distribution function (CDF) of the topographic index when the grid cell mean water table depth @@ -864,19 +858,19 @@ mean topographic index. It should be calculated explicitly from the CDF at each grid cell at the resolution that the model is run. However, because this is a computationally intensive task for global applications, :math:`f_{\max }` is calculated once at -0.125\ :math:`{}^\circ` resolution using the 1-km compound topographic +0.125\ :sup:`o` resolution using the 1-km compound topographic indices (CTIs) based on the HYDRO1K dataset (Verdin and Greenlee 1996) from USGS following the algorithm in Niu et al. (2005) and then area-averaged to the desired model resolution (section 2.2.3). Pixels with CTIs exceeding the 95 percentile threshold in each -0.125\ :math:`{}^\circ` grid cell are excluded from the calculation to +0.125\ :sup:`o` grid cell are excluded from the calculation to eliminate biased estimation of statistics due to large CTI values at pixels on stream networks. For grid cells over regions without CTIs such as Australia, the global mean :math:`f_{\max }` is used to fill the gaps. See Li et al. (2013b) for additional details. The decay factor :math:`f_{over}` for global simulations was determined through sensitivity analysis and comparison with observed runoff to be 0.5 -m\ :math:`{}^{-1}`. +m\ :sup:`-1`. Surface Water Storage ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -884,7 +878,7 @@ Surface Water Storage A surface water store has been added to the model to represent wetlands and small, sub-grid scale water bodies. As a result, the wetland land unit has been removed. The state variables for surface water are the -mass of water :math:`W_{sfc}` (kg m\ :math:`{}^{-2}`) and temperature +mass of water :math:`W_{sfc}` (kg m\ :sup:`-2`) and temperature :math:`T_{h2osfc}` (Chapter 6). Surface water storage and outflow are functions of fine spatial scale elevation variations called microtopography. The microtopography is assumed to be distributed @@ -967,8 +961,8 @@ removed, is divided into inputs to surface water (:math:`q_{in,\, h2osfc}` ) and the soil :math:`q_{in,soil}` . If :math:`q_{in,soil}` exceeds the -maximum soil infiltration capacity (kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`), +maximum soil infiltration capacity (kg m\ :sup:`-2` +s\ :sup:`-1`), .. math:: :label: ZEqnNum569150 @@ -1042,12 +1036,12 @@ mass is stated as \frac{\partial \theta }{\partial t} =-\frac{\partial q}{\partial z} -Q where :math:`\theta` is the volumetric soil water content -(mm:math:`{}^{3}` of water mm\ :math:`{}^{-3}` of soil), :math:`t` is +(mm:sup:`3` of water mm\ :sup:`-3` of soil), :math:`t` is time (s), :math:`z` is height above some datum in the soil column (mm) -(positive upwards), :math:`q` is soil water flux (kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}` or mm s\ :math:`{}^{-1}`) (positive upwards), and -:math:`Q` is a soil moisture sink term (mm of water mm\ :math:`{}^{-1}` -of soil s\ :math:`{}^{-1}`) (ET loss). This equation is solved +(positive upwards), :math:`q` is soil water flux (kg m\ :sup:`-2` +s\ :sup:`-1` or mm s\ :sup:`-1`) (positive upwards), and +:math:`Q` is a soil moisture sink term (mm of water mm\ :sup:`-1` +of soil s\ :sup:`-1`) (ET loss). This equation is solved numerically by dividing the soil column into multiple layers in the vertical and integrating downward over each layer with an upper boundary condition of the infiltration flux into the top soil layer @@ -1062,7 +1056,7 @@ law q=-k\frac{\partial \psi _{h} }{\partial z} -where :math:`k` is the hydraulic conductivity (mm s\ :math:`{}^{-1}`), +where :math:`k` is the hydraulic conductivity (mm s\ :sup:`-1`), and :math:`\psi _{h}` is the hydraulic potential (mm). The hydraulic potential is @@ -1139,7 +1133,7 @@ where the soil moisture sink term :math:`Q` is now included. Hydraulic Properties ^^^^^^^^^^^^^^^^^^^^^^^^^^ -The hydraulic conductivity :math:`k_{i}` (mm s\ :math:`{}^{-1}`) and +The hydraulic conductivity :math:`k_{i}` (mm s\ :sup:`-1`) and the soil matric potential :math:`\psi _{i}` (mm) for layer :math:`i` vary with volumetric soil water :math:`\theta _{i}` and soil texture. As with the soil thermal properties (section 6.3) the hydraulic @@ -1228,7 +1222,7 @@ matric potential :math:`\psi _{sat,\min ,i}` \ is \psi _{sat,\, \min ,\, i} =-10.0\times 10^{1.88-0.0131(\% sand)_{i} } . The saturated hydraulic conductivity, -:math:`k_{sat} \left[z_{h,\, i} \right]` (mm s\ :math:`{}^{-1}`), for +:math:`k_{sat} \left[z_{h,\, i} \right]` (mm s\ :sup:`-1`), for organic soils (:math:`k_{sat,\, om}` ) may be two to three orders of magnitude larger than that of mineral soils (:math:`k_{sat,\, \min }` ). Bulk soil layer values of :math:`k_{sat}` \ calculated as weighted @@ -1303,7 +1297,7 @@ where :math:`q_{i}` is the flux of water across interface :math:`z_{h,\, i}` , :math:`q_{i-1}` is the flux of water across interface :math:`z_{h,\, i-1}` , and :math:`e_{i}` is a layer-averaged soil moisture sink term (ET loss) defined as positive for flow out of -the layer (mm s\ :math:`{}^{-1}`). Taking the finite difference with +the layer (mm s\ :sup:`-1`). Taking the finite difference with time and evaluating the fluxes implicitly at time :math:`n+1` yields .. math:: @@ -1339,7 +1333,7 @@ the interface of two layers :math:`z_{h}` . The layer thickness is term :math:`e` (ET loss) is defined as positive for flow out of the layer. -.. image:: image3 +.. image:: image3.png Note that because more than one plant functional type (PFT) may share a soil column, the transpiration :math:`E_{v}^{t}` is a weighted sum of @@ -1495,7 +1489,7 @@ derived from equation \begin{array}{l} {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } =\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } =\left(1-\frac{f_{frz,\, i} +f_{frz,\, i+1} }{2} \right)\left(2B_{i} +3\right)k_{sat} \left[z_{h,\, i} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right)} \end{array}. -7.4.2.1 Equilibrium soil matric potential and volumetric moisture +Equilibrium soil matric potential and volumetric moisture ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' The equilibrium soil matric potential :math:`\psi _{E}` can be derived @@ -1579,7 +1573,7 @@ The equilibrium soil matric potential is then \psi _{E,\, i} =\psi _{sat,\, i} \left(\frac{\overline{\theta _{E,\, i} }}{\theta _{sat,\, i} } \right)^{-B_{i} } \ge -1\times 10^{8} \qquad \frac{\overline{\theta _{E,\, i} }}{\theta _{sat,\, i} } \ge 0.01 -7.4.2.2 Equation set for layer :math:`i=1` +Equation set for layer :math:`i=1` '''''''''''''''''''''''''''''''''''''''''' For the top soil layer (:math:`i=1`), the boundary condition is the @@ -1615,7 +1609,7 @@ equations for :math:`i=1` are r_{i} =q_{infl}^{n+1} -q_{i}^{n} +e_{i} . -7.4.2.3 Equation set for layers :math:`i=2,\ldots ,N_{levsoi} -1` +Equation set for layers :math:`i=2,\ldots ,N_{levsoi} -1` ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' The coefficients of the tridiagonal set of equations for @@ -1641,7 +1635,7 @@ The coefficients of the tridiagonal set of equations for r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . -7.4.2.4 Equation set for layers :math:`i=N_{levsoi} ,\ldots N_{levsoi} +1` +Equation set for layers :math:`i=N_{levsoi} ,\ldots N_{levsoi} +1` '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' For the lowest soil layer (:math:`i=N_{levsoi}` ), the bottom boundary @@ -1825,7 +1819,7 @@ Groundwater-Soil Water Interactions Drainage or sub-surface runoff is based on the SIMTOP scheme (Niu et al. 2005) with a modification to account for reduced drainage in frozen soils. In the work of Niu et al. (2005), the drainage :math:`q_{drai}` -(kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) was formulated as +(kg m\ :sup:`-2` s\ :sup:`-1`) was formulated as .. math:: :label: ZEqnNum924767 @@ -1863,13 +1857,13 @@ where :math:`\Omega =6`\ is an adjustable parameter, :math:`jwt` is the index of the layer directly above the water table, :math:`F_{ice} =\frac{\theta _{ice} }{\theta _{sat} }` is the ice-filled fraction of the pore space of soil layer :math:`i` (kg -m\ :math:`{}^{-2}`), and :math:`\Delta z_{i}` is the layer thickness +m\ :sup:`-2`), and :math:`\Delta z_{i}` is the layer thickness (mm). This expression is functionally the same as that used to determine the ice impedance factor in section 7.4. In equation , the decay factor -:math:`f_{drai} =2.5` m\ :math:`{}^{-1}` and the maximum drainage when +:math:`f_{drai} =2.5` m\ :sup:`-1` and the maximum drainage when the water table depth is at the surface -:math:`q_{drai,\, \max } =10\sin (\beta )` kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}` , where :math:`\beta` is the mean grid cell +:math:`q_{drai,\, \max } =10\sin (\beta )` kg m\ :sup:`-2` +s\ :sup:`-1` , where :math:`\beta` is the mean grid cell topographic slope in radians, were determined for global simulations through sensitivity analysis and comparison with observed runoff. @@ -1955,7 +1949,7 @@ soil layer (:math:`w_{liq,\, i}^{excess} =w_{liq,\, i} -\left(\theta _{sat,\, i} -\theta _{ice,\, i} \right)\Delta z_{i} \ge 0`) is successively added to the layer above. Any excess liquid water that remains after saturating the entire soil column (plus a maximum surface -ponding depth :math:`w_{liq}^{pond} =10` kg m\ :math:`{}^{-2}`), is +ponding depth :math:`w_{liq}^{pond} =10` kg m\ :sup:`-2`), is added to drainage :math:`q_{drai}` . Second, to prevent negative :math:`w_{liq,\, i}` , each layer is successively brought up to :math:`w_{liq,\, i} =w_{liq}^{\min }` by taking the required amount of @@ -1993,7 +1987,7 @@ Runoff from glaciers and snow-capped surfaces ------------------------------------------------- All surfaces are constrained to have a snow water equivalent -:math:`W_{sno} \le 1000` kg m\ :math:`{}^{-2}`. For snow-capped +:math:`W_{sno} \le 1000` kg m\ :sup:`-2`. For snow-capped surfaces, the solid and liquid precipitation reaching the snow surface and dew in solid or liquid form, is separated into solid :math:`q_{snwcp,ice}` \ and liquid :math:`q_{snwcp,liq}` runoff terms @@ -2065,7 +2059,7 @@ CLM soil column with thicknesses of :math:`\sum^3_{i=1}{\Delta z_i}`, step, the soil moisture profile is determined following the algorithms detailed in section 7.4, and aggregated to the three VIC layers for runoff generation calculations. The surface runoff generated by the -saturation excess runoff mechanism, *q\ :math:`{}_{over}`*, is +saturation excess runoff mechanism, q\ :sub:`over`, is calculated using equation , but with the fractional saturated area defined as @@ -2077,8 +2071,8 @@ defined as where :math:`w_{top}` and :math:`w_{m,top}` are calculated as :math:`\sum^6_{i=1}{{\theta }_i\Delta z_i}` and :math:`\sum^6_{i=1}{{\theta }_{s,i}\Delta z_i}`, respectively, and -represent the soil moisture (kg m\ :math:`{}^{-2}`) and maximum soil -moisture (kg m\ :math:`{}^{-2}`) in the top two VIC layers combined. +represent the soil moisture (kg m\ :sup:`-2`) and maximum soil +moisture (kg m\ :sup:`-2`) in the top two VIC layers combined. In equation , it is hypothesized that the spatial heterogeneity of soil moisture holding capacity in the top VIC layers can be represented by a @@ -2095,13 +2089,13 @@ conceptually as i=i_m\left(1-{\left(1-A\right)}^{1/b_{inf}}\right) where :math:`i` and :math:`i_{m}` are the point and maximum point soil -moisture holding capacities (kg m\ :math:`{}^{-2}`), respectively; +moisture holding capacities (kg m\ :sup:`-2`), respectively; :math:`A` is the fraction of a grid cell for which the soil moisture holding capacity is less than or equal to :math:`i`; and :math:`i_m=w_{m,top}\left(1+b_{inf}\right)`. When :math:`A` is equal to :math:`f_{sat}`, the corresponding point soil moisture holding capacity is denoted as :math:`i_0`. The maximum soil infiltration capacity (kg -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) in equation becomes +m\ :sup:`-2` s\ :sup:`-1`) in equation becomes .. math:: :label: ZEqnNum202398 @@ -2124,9 +2118,9 @@ The subsurface runoff in equation is parameterized as \right]/\mathrm{\Delta }t where :math:`w_{bot}` and :math:`w_{m,bot}` are the soil moisture (kg -m\ :math:`{}^{-2}`) and maximum soil moisture (kg m\ :math:`{}^{-2}`) in +m\ :sup:`-2`) and maximum soil moisture (kg m\ :sup:`-2`) in the bottom VIC layer, respectively, :math:`D_{smax}` is the maximum -subsurface flow rate (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), +subsurface flow rate (kg m\ :sup:`-2` s\ :sup:`-1`), :math:`D_s` is a fraction of :math:`D_{smax}`, :math:`W_s` is a fraction of :math:`w_{m,bot}`, and :math:`{\mathrm{\Theta }}_{ice,bot}` is an ice impedance factor determined from the ice content of the bottom VIC @@ -2143,9 +2137,9 @@ other four parameters, :math:`b_{inf}` , :math:`D_{smax}` , :math:`D_s` dataset. Users can provide calibrated parameter values determined manually or automatically by modifying the surface dataset. Note that the units of :math:`D_{smax}` on the surface dataset are mm -d\ :math:`{}^{-1}` (the traditional units for other standard VIC -applications) which are then converted to kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}` for use in CLM. A preliminary calibration was +d\ :sup:`-1` (the traditional units for other standard VIC +applications) which are then converted to kg m\ :sup:`-2` +s\ :sup:`-1` for use in CLM. A preliminary calibration was performed by perturbing the three parameters :math:`b_{inf}` , :math:`D_{smax}` , and :math:`W_s`, and fixing :math:`D_s=0.1` globally. The parameter space for :math:`b_{inf}` , :math:`D_{smax}` , and @@ -2154,7 +2148,7 @@ described by Hou et al. (2012) to produce 64 combinations of parameter values based on *a priori* information about the parameters. For each set of parameter values, a global simulation was performed using the compset I\_2000 (i.e., driven by satellite phenology) at a resolution of -0.9\ :math:`{}^\circ`\ x1.25\ :math:`{}^\circ` on the basis of the +0.9\ :sup:`o`\ x1.25\ :sup:`o` on the basis of the development tag betr\_m\_sci10\_clm45sci13\_clm4\_0\_54. At each model grid cell, the set of :math:`b_{inf}` , :math:`D_{smax}` , and :math:`W_s` values corresponding to the simulation that produced the diff --git a/doc/source/tech_note/CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst b/doc/source/tech_note/CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst index f8ac82d263..6cd61d641c 100644 --- a/doc/source/tech_note/CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst +++ b/doc/source/tech_note/CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst @@ -6,11 +6,10 @@ Leaf stomatal resistance, which is needed for the water vapor flux (1991, 1992). These equations are solved separately for sunlit and shaded leaves using average absorbed photosynthetically active radiation for sunlit and shaded leaves -[:math:`\phi ^{sun}` ,\ :math:`\phi ^{sha}` :math:`\text{W} \text{m}^{-2}` +[:math:`\phi ^{sun}` ,\ :math:`\phi ^{sha}` W m\ :sup:`-2` (section 4.1)] to give sunlit and shaded stomatal resistance -(:math:`r_{s}^{sun}` ,\ :math:`r_{s}^{sha}` :math:`\text{sm}^{-1}`) and -photosynthesis (:math:`A^{sun}` ,\ :math:`A^{sha}` µmol -:math:`\text{CO}_{2}` m\ :math:`{}^{-2}` :math:`\text{s}^{-1}`). Canopy +(:math:`r_{s}^{sun}` ,\ :math:`r_{s}^{sha}` s m\ :sup:`-1`) and +photosynthesis (:math:`A^{sun}` ,\ :math:`A^{sha}` µmol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`). Canopy photosynthesis is :math:`A^{sun} L^{sun} +A^{sha} L^{sha}` , where :math:`L^{sun}` and :math:`L^{sha}` are the sunlit and shaded leaf area indices (section 4.1). Canopy conductance is @@ -26,7 +25,7 @@ model as described by Collatz et al. (1991) and implemented in global climate models (Sellers et al. 1996). The model relates stomatal conductance (i.e., the inverse of resistance) to net leaf photosynthesis, scaled by the relative humidity at the leaf surface and -the :math:`\text{CO}_{2}` concentration at the leaf surface. Leaf stomatal +the CO\ :sub:`1` concentration at the leaf surface. Leaf stomatal resistance is .. math:: @@ -34,22 +33,22 @@ resistance is \frac{1}{r_{s} } =g_{s} =m\frac{A_{n} }{{c_{s} \mathord{\left/ {\vphantom {c_{s} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } } h_{s} +b\, \beta _{t} -where :math:`r_{s}` is leaf stomatal resistance (s m\ :math:`{}^{2}` -:math:`\mu`\ mol\ :math:`{}^{-1}`), :math:`m` is a plant functional +where :math:`r_{s}` is leaf stomatal resistance (s m\ :sup:`2` +:math:`\mu`\ mol\ :sup:`-1`), :math:`m` is a plant functional type dependent parameter (Table 8.1), :math:`A_{n}` is leaf net -photosynthesis (:math:`\mu`\ mol CO\ :math:`{}_{2}` m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`), :math:`c_{s}` is the CO\ :math:`{}_{2}` partial +photosynthesis (:math:`\mu`\ mol CO\ :sub:`2` m\ :sup:`-2` +s\ :sup:`-1`), :math:`c_{s}` is the CO\ :sub:`2` partial pressure at the leaf surface (Pa), :math:`P_{atm}` is the atmospheric pressure (Pa), :math:`h_{s} =e_{s} /e_{i}` is the leaf surface humidity with :math:`e_{s}` the vapor pressure at the leaf surface (Pa) and :math:`e_{i}` the saturation vapor pressure (Pa) inside the leaf at the vegetation temperature\ :math:`T_{v}`, and :math:`b` is the minimum -stomatal conductance (:math:`\mu` mol m :math:`{}^{-2}` -s\ :math:`{}^{-1}`). Parameter values are :math:`m=9` for -C\ :math:`{}_{3}` plants and :math:`m=4` for C\ :math:`{}_{4}` plants +stomatal conductance (:math:`\mu` mol m :sup:`-2` +s\ :sup:`-1`). Parameter values are :math:`m=9` for +C\ :sub:`3` plants and :math:`m=4` for C\ :sub:`4` plants (Collatz et al. 1991, 1992, Sellers et al. 1996). Sellers et al. (1996) -used :math:`b=10000` for C :math:`{}_{3}` plants and -:math:`b=40000` for C :math:`{}_{4}` plants, also used here. +used :math:`b=10000` for C\ :sub:`3` plants and +:math:`b=40000` for C\ :sub:`4` plants, also used here. Photosynthesis is calculated for sunlit (:math:`A^{sun}`) and shaded (:math:`A^{sha}`) leaves to give :math:`r_{s}^{sun}` and :math:`r_{s}^{sha}`. Additionally, soil water influences stomatal @@ -58,12 +57,10 @@ water stress function :math:`\beta _{t}` (which ranges from 0 to 1) and also indirectly through :math:`A_{n}`, as in (Sellers et al. 1996). Resistance is converted from units of -:math:`\textrm{s\,m}^{2}\, \mu \, \textrm{mol}^{-1}` to -:math:`\textrm{s\,m}^{-1}` as: -:math:`\text{1\,s\,m}^{-1}` = :math:`1\times 10^{-9} R_{gas} \frac{\theta _{atm} }{P_{atm} }` -:math:`\mu\,\text{mol}^{-1}` m\ :math:`{}^{2}` s, where -:math:`R_{gas}` is the universal gas constant (J K\ :math:`{}^{-1}` -kmol\ :math:`{}^{-1}`) (Table 2.6) and :math:`\theta _{atm}` is the +s m\ :sup:`2` :math:`\mu` mol\ :sub:`-1` to s m\ :sup:`-1` as: +1 s m\ sup:`-1` = :math:`1\times 10^{-9} R_{gas} \frac{\theta _{atm} }{P_{atm} }` +:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, where :math:`R_{gas}` is the universal gas constant (J K\ :sup:`-1` +kmol\ :sup:`-1`) (Table 2.6) and :math:`\theta _{atm}` is the atmospheric potential temperature (K). Table 8.1. Plant functional type (PFT) photosynthetic parameters. @@ -93,11 +90,11 @@ Table 8.1. Plant functional type (PFT) photosynthetic parameters. +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ | BDS boreal | 9 | – | 25 | 0.0943 | 0.030 | -83000 | -428000 | 54.0 | +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| C\ :math:`{}_{3}` arctic grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | +| C\ :sub:`3` arctic grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| C\ :math:`{}_{3}` grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | +| C\ :sub:`3` grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| C\ :math:`{}_{4}` grass | 4 | 0.05 | 25 | 0.0900 | 0.030 | -74000 | -275000 | 51.6 | +| C\ :sub:`4` grass | 4 | 0.05 | 25 | 0.0900 | 0.030 | -74000 | -275000 | 51.6 | +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ | Crop R | 9 | – | 25 | 0.1758 | 0.030 | -74000 | -275000 | 100.7 | +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ @@ -120,18 +117,16 @@ Table 8.1. Plant functional type (PFT) photosynthetic parameters. | Soybean I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -:math:`\alpha` (mol CO\ :math:`{}_{2}` mol\ :math:`{}^{-1}` photon); -:math:`CN_{L}` (g C g\ :math:`{}^{-1}` N); :math:`F_{LNR}` (g N -Rubisco g\ :math:`{}^{-1}` N); :math:`SLA_{0}` (m:math:`{}^{2}` -:math:`\text{g}^{-1}` C); :math:`\psi _{o}` and :math:`\psi _{c}` (mm); -:math:`\text{V}_{cmax25}` (:math:`\mu`\ mol m\ :math:`{}^{-2}` -:math:`\text{s}^{-1}`, calculated from equation for canopy top). +:math:`\alpha` (mol CO\ :sub:`2` mol\ :sup:`-1` photon); +:math:`CN_{L}` (g C g\ :sup:`-1` N); :math:`F_{LNR}` (g N Rubisco g\ :sup:`-1` N); :math:`SLA_{0}` (m\ :sup:`2` g\ :sup:`-1` C); +:math:`\psi _{o}` and :math:`\psi _{c}` (mm); +V\ :sub:`cmax25` (:math:`\mu`\ mol m\ :sup:`-2` s\ :sup:`-1`, calculated from equation for canopy top). Photosynthesis ------------------ -Photosynthesis in C\ :math:`{}_{3}` plants is based on the model of -Farquhar et al. (1980). Photosynthesis in C\ :math:`{}_{4}` plants is +Photosynthesis in C\ :sub:`3` plants is based on the model of +Farquhar et al. (1980). Photosynthesis in C\ :sub:`4` plants is based on the model of Collatz et al. (1992). Bonan et al. (2011) describe the implementation, modified here. In its simplest form, leaf net photosynthesis after accounting for respiration (:math:`R_{d}` ) is @@ -142,8 +137,8 @@ net photosynthesis after accounting for respiration (:math:`R_{d}` ) is A_{n} =\min \left(A_{c} ,A_{j} ,A_{p} \right)-R_{d} . The RuBP carboxylase (Rubisco) limited rate of carboxylation -:math:`A_{c}` (:math:`\mu` \ mol CO\ :math:`{}_{2}` m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`) is +:math:`A_{c}` (:math:`\mu` \ mol CO\ :sub:`2` m\ :sup:`-2` +s\ :sup:`-1`) is .. math:: :label: ZEqnNum141081 @@ -153,17 +148,17 @@ s\ :math:`{}^{-1}`) is The maximum rate of carboxylation allowed by the capacity to regenerate RuBP (i.e., the light-limited rate) :math:`A_{j}` (:math:`\mu` \ mol -CO\ :math:`{}_{2}` m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is +CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 8.4) A_{j} =\left\{\begin{array}{l} {\frac{J\left(c_{i} -\Gamma _{\*} \right)}{4c_{i} +8\Gamma _{\*} } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {\alpha (4.6\phi )\qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}\qquad \qquad c_{i} -\Gamma _{\*} \ge 0. -The product-limited rate of carboxylation for C\ :math:`{}_{3}` plants +The product-limited rate of carboxylation for C\ :sub:`3` plants and the PEP carboxylase-limited rate of carboxylation for -C\ :math:`{}_{4}` plants :math:`A_{p}` (:math:`\mu` \ mol -CO\ :math:`{}_{2}` m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is +C\ :sub:`4` plants :math:`A_{p}` (:math:`\mu` \ mol +CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: ZEqnNum104028 @@ -171,27 +166,27 @@ CO\ :math:`{}_{2}` m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is A_{p} =\left\{\begin{array}{l} {3T_{p\qquad } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {k_{p} \frac{c_{i} }{P_{atm} } \qquad \qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}. In these equations, :math:`c_{i}` is the internal leaf -CO\ :math:`{}_{2}` partial pressure (Pa) and :math:`o_{i} =0.20P_{atm}` -is the O\ :math:`{}_{2}` partial pressure (Pa). :math:`K_{c}` and +CO\ :sub:`2` partial pressure (Pa) and :math:`o_{i} =0.20P_{atm}` +is the O\ :sub:`2` partial pressure (Pa). :math:`K_{c}` and :math:`K_{o}` are the Michaelis-Menten constants (Pa) for -CO\ :math:`{}_{2}` and O\ :math:`{}_{2}`. :math:`\Gamma _{\*}` (Pa) is -the CO\ :math:`{}_{2}` compensation point. :math:`V_{c\max }` is the -maximum rate of carboxylation (µmol m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`) and :math:`J` is the electron transport rate (µmol -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`). :math:`T_{p}` is the triose -phosphate utilization rate (µmol m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), +CO\ :sub:`2` and O\ :sub:`2`. :math:`\Gamma _{\*}` (Pa) is +the CO\ :sub:`2` compensation point. :math:`V_{c\max }` is the +maximum rate of carboxylation (µmol m\ :sup:`-2` +s\ :sup:`-1`) and :math:`J` is the electron transport rate (µmol +m\ :sup:`-2` s\ :sup:`-1`). :math:`T_{p}` is the triose +phosphate utilization rate (µmol m\ :sup:`-2` s\ :sup:`-1`), taken as :math:`T_{p} =0.167V_{c\max }` so that -:math:`A_{p} =0.5V_{c\max }` for C\ :math:`{}_{3}` plants (as in -Collatz et al. 1991). For C\ :math:`{}_{4}` plants, the light-limited +:math:`A_{p} =0.5V_{c\max }` for C\ :sub:`3` plants (as in +Collatz et al. 1991). For C\ :sub:`4` plants, the light-limited rate :math:`A_{j}` varies with :math:`\phi` in relation to the quantum -efficiency (:math:`\alpha =0.05` mol CO\ :math:`{}_{2}` -mol\ :math:`{}^{-1}` photon). :math:`\phi` is the absorbed -photosynthetically active radiation (W m\ :math:`{}^{-2}`) (section +efficiency (:math:`\alpha =0.05` mol CO\ :sub:`2` +mol\ :sup:`-1` photon). :math:`\phi` is the absorbed +photosynthetically active radiation (W m\ :sup:`-2`) (section 4.1), which is converted to photosynthetic photon flux assuming 4.6 :math:`\mu` \ mol photons per joule. :math:`k_{p}` is the initial slope -of C\ :math:`{}_{4}` CO\ :math:`{}_{2}` response curve. +of C\ :sub:`4` CO\ :sub:`2` response curve. -For C\ :math:`{}_{3}` plants, the electron transport rate depends on the +For C\ :sub:`3` plants, the electron transport rate depends on the photosynthetically active radiation absorbed by the leaf. A common expression is the smaller of the two roots of the equation @@ -201,13 +196,13 @@ expression is the smaller of the two roots of the equation \Theta _{PSII} J^{2} -\left(I_{PSII} +J_{\max } \right)J+I_{PSII} J_{\max } =0 where :math:`J_{\max }` is the maximum potential rate of electron -transport (:math:`\mu`\ mol m\ :math:`{}^{--2}` s\ :math:`{}^{--1}`), +transport (:math:`\mu`\ mol m\ :sup:`-2` s\ :sup:`-1`), :math:`I_{PSII}` is the light utilized in electron transport by -photosystem II (µmol m\ :math:`{}^{--2}` s\ :math:`{}^{--1}`), and +photosystem II (µmol m\ :sup:`-2` s\ :sup:`-1`), and :math:`\Theta _{PSII}` is a curvature parameter. For a given amount of photosynthetically active radiation absorbed by a leaf :math:`\phi` (W -m\ :math:`{}^{-2}`), converted to photosynthetic photon flux density -with 4.6 :math:`\mu`\ mol J\ :math:`{}^{-1}`, the light utilized in +m\ :sup:`-2`), converted to photosynthetic photon flux density +with 4.6 :math:`\mu`\ mol J\ :sup:`-1`, the light utilized in electron transport is .. math:: @@ -219,8 +214,8 @@ where :math:`\Phi _{PSII}` is the quantum yield of photosystem II, and the term 0.5 arises because one photon is absorbed by each of the two photosystems to move one electron. Parameter values are :math:`\Theta _{PSII}` \ = 0.7 and :math:`\Phi _{PSII}` \ = 0.85. In -calculating :math:`A_{j}` (for both C\ :math:`{}_{3}` and -C\ :math:`{}_{4}` plants), :math:`\phi =\phi ^{sun}` for sunlit leaves +calculating :math:`A_{j}` (for both C\ :sub:`3` and +C\ :sub:`4` plants), :math:`\phi =\phi ^{sun}` for sunlit leaves and :math:`\phi =\phi ^{sha}` for shaded leaves. The model uses co-limitation as described by Collatz et al. (1991, @@ -233,12 +228,12 @@ smaller root of the equations \begin{array}{rcl} {\Theta _{cj} A_{i}^{2} -\left(A_{c} +A_{j} \right)A_{i} +A_{c} A_{j} } & {=} & {0} \\ {\Theta _{ip} A^{2} -\left(A_{i} +A_{p} \right)A+A_{i} A_{p} } & {=} & {0} \end{array} . Values are :math:`\Theta _{cj} =0.98` and :math:`\Theta _{ip} =0.95` for -C\ :math:`{}_{3}` plants; and :math:`\Theta _{cj} =0.80`\ and -:math:`\Theta _{ip} =0.95` for C\ :math:`{}_{4}` plants. +C\ :sub:`3` plants; and :math:`\Theta _{cj} =0.80`\ and +:math:`\Theta _{ip} =0.95` for C\ :sub:`4` plants. :math:`A_{n} =A-R_{d}` . The parameters :math:`K_{c}`, :math:`K_{o}` , and :math:`\Gamma _{*}` -depend on temperature. Values at 25 :math:`{}^\circ` \ C are +depend on temperature. Values at 25 :sup:`o` \ C are :math:`K_{c25} ={\rm 4}0{\rm 4}.{\rm 9}\times 10^{-6} P_{atm}` , :math:`K_{o25} =278.4\times 10^{-3} P_{atm}` , and :math:`\Gamma _{*25} {\rm =42}.75\times 10^{-6} P_{atm}` . @@ -247,14 +242,14 @@ and :math:`R_{d}` also vary with temperature. Parameter values at 25 :math:`\circ`\ C are calculated from :math:`V_{c\max }` \ at 25 :math:`\circ`\ C: :math:`J_{\max 25} =1.97V_{c\max 25}` , :math:`T_{p25} =0.167V_{c\max 25}` , and -:math:`R_{d25} =0.015V_{c\max 25}` (C :math:`\text{}_{3}`) and -:math:`R_{d25} =0.025V_{c\max 25}` (C :math:`{}_{4}`). For -C\ :math:`{}_{4}` plants, :math:`k_{p25} =20000\; V_{c\max 25}` . +:math:`R_{d25} =0.015V_{c\max 25}` (C\ :sub:`3`) and +:math:`R_{d25} =0.025V_{c\max 25}` (C\ :sub:`4`). For +C\ :sub:`4` plants, :math:`k_{p25} =20000\; V_{c\max 25}` . However, when the biogeochemistry is active, :math:`R_{d25}` is calculated from leaf nitrogen as :math:`R_{d25} =0.2577N_{a}` , where :math:`N_{a}` is the area-based leaf nitrogen concentration (g N -m\ :math:`{}^{-2}` leaf area, equation ) and 0.2577 :math:`\mu`\ mol -CO\ :math:`{}_{2}` g\ :math:`{}^{-1}` N s\ :math:`{}^{-1}` the base +m\ :sup:`-2` leaf area, equation ) and 0.2577 :math:`\mu`\ mol +CO\ :sub:`2` g\ :sup:`-1` N s\ :sup:`-1` the base respiration rate. The parameters :math:`V_{c\max 25}` , :math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}` , and :math:`R_{d25}` are scaled over the canopy for sunlit and shaded leaves @@ -284,7 +279,7 @@ Table 8.2 list parameter values for :math:`\Delta H_{a}` , :math:`\Delta H_{d}` , and :math:`\Delta S`, from Bonan et al. (2011). Because :math:`T_{p}` as implemented here varies with :math:`V_{c\max }` , the same temperature parameters are used for -:math:`T_{p}` . For C\ :math:`{}_{4}` plants, +:math:`T_{p}` . For C\ :sub:`4` plants, .. math:: :label: 8.12) @@ -292,10 +287,10 @@ Because :math:`T_{p}` as implemented here varies with \begin{array}{l} {V_{c\max } =V_{c\max 25} \left[\frac{Q_{10} ^{(T_{v} -298.15)/10} }{f_{H} \left(T_{v} \right)f_{L} \left(T_{v} \right)} \right]} \\ {f_{H} \left(T_{v} \right)=1+\exp \left[s_{1} \left(T_{v} -s_{2} \right)\right]} \\ {f_{L} \left(T_{v} \right)=1+\exp \left[s_{3} \left(s_{4} -T_{v} \right)\right]} \end{array} with :math:`Q_{10} =2`, -:math:`s_{1} =0.3`\ K\ :math:`{}^{-}`\ :math:`{}^{1}`, +:math:`s_{1} =0.3`\ K\ :sup:`-1` :math:`s_{2} =313.15` K, -:math:`s_{3} =0.2`\ K\ :math:`{}^{-}`\ :math:`{}^{1}`, and -:math:`s_{4} =288.15` K. Additionally, +:math:`s_{3} =0.2`\ K\ :sup:`-1`, and :math:`s_{4} =288.15` K. +Additionally, .. math:: :label: 8.13) @@ -303,7 +298,7 @@ with :math:`Q_{10} =2`, R_{d} =R_{d25} \left\{\frac{Q_{10} ^{(T_{v} -298.15)/10} }{1+\exp \left[s_{5} \left(T_{v} -s_{6} \right)\right]} \right\} with :math:`Q_{10} =2`, :math:`s_{5} =1.3` -K\ :math:`{}^{-}`\ :math:`{}^{1}`, and :math:`s_{6} =328.15`\ K, and +K\ :sup:`-1` and :math:`s_{6} =328.15`\ K, and .. math:: :label: 8.14) @@ -315,7 +310,7 @@ with :math:`Q_{10} =2`. Table 8.2. Temperature dependence parameters for C3 photosynthesis. +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -| Parameter | :math:`\Delta H_{a}` (J mol\ :math:`{}^{-}`\ :math:`{}^{1}`) | :math:`\Delta H_{d}` (J mol\ :math:`{}^{-}`\ :math:`{}^{1}`) | :math:`\Delta S` (J mol\ :math:`{}^{-}`\ :math:`{}^{1}` K\ :math:`{}^{-}`\ :math:`{}^{1}`) | +| Parameter | :math:`\Delta H_{a}` (J mol\ :sup:`-1`) | :math:`\Delta H_{d}` (J mol\ :sup:`-1`) | :math:`\Delta S` (J mol\ :sup:`-1` K\ :sup:`-1`) | +========================+=================================================================+=================================================================+==============================================================================================+ | :math:`V_{c\max }` | 65330 | 149250 | 485 | +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ @@ -349,8 +344,7 @@ and :math:`J_{\max }` to increase with warmer temperature. In this parameterization, :math:`\Delta H_{d}` \ = 200000, :math:`\Delta H_{a}` \ = 72000 for :math:`V_{c\max }` , and :math:`\Delta H_{a}` \ = 50000 for :math:`J_{\max }` . Additionally, the -ratio :math:`J_{\max 25} /V_{c\max 25}` at 25 :math:`{}^\circ`\ C -decreases with growth temperature as +ratio :math:`J_{\max 25} /V_{c\max 25}` at 25 :sup:`o`\ C decreases with growth temperature as .. math:: :label: 8.16) @@ -359,15 +353,13 @@ decreases with growth temperature as In these acclimation functions, :math:`T_{10}` is the 10-day mean air temperature (K) and :math:`T_{f}` is the freezing point of water (K). -For lack of data, :math:`T_{p}` acclimates similar to -:math:`V_{c\max }` . Acclimation is restricted over the temperature -range :math:`T_{10} -T_{f} \ge 11`\ :math:`{}^\circ`\ C and -:math:`T_{10} -T_{f} \le 35`\ :math:`{}^\circ`\ C. +For lack of data, :math:`T_{p}` acclimates similar to V :sub:`cmax` . Acclimation is restricted over the temperature +range :math:`T_{10} -T_{f} \ge 11`\ :sup:`o`\ C and :math:`T_{10} -T_{f} \le 35`\ :sup:`o`\ C. -:math:`\text{V}_{cmax25}` and Canopy scaling +V\ :sub:`cmax25` and Canopy scaling -------------------------------------------- -The maximum rate of carboxylation at 25 :math:`{}^\circ`\ C varies with +The maximum rate of carboxylation at 25 :sup:`o`\ C varies with foliage nitrogen concentration and specific leaf area and is calculated as in Thornton and Zimmermann (2007). At 25ºC, @@ -377,12 +369,12 @@ as in Thornton and Zimmermann (2007). At 25ºC, V_{c\max 25} =N_{a} F_{LNR} F_{NR} a_{R25} where :math:`N_{a}` is the area-based leaf nitrogen concentration (g N -m\ :math:`{}^{-2}` leaf area), :math:`F_{LNR}` is the fraction of leaf -nitrogen in Rubisco (g N in Rubisco g\ :math:`{}^{-1}` N), +m\ :sup:`-2` leaf area), :math:`F_{LNR}` is the fraction of leaf +nitrogen in Rubisco (g N in Rubisco g\ :sup:`-1` N), :math:`F_{NR} =7.16` is the mass ratio of total Rubisco molecular mass -to nitrogen in Rubisco (g Rubisco g\ :math:`{}^{-1}` N in Rubisco), and +to nitrogen in Rubisco (g Rubisco g\ :sup:`-1` N in Rubisco), and :math:`a_{R25} =60` is the specific activity of Rubisco (µmol -CO\ :math:`{}_{2}` g\ :math:`{}^{-1}` Rubisco s\ :math:`{}^{-1}`). +CO\ :sub:`2` g\ :sup:`-1` Rubisco s\ :sup:`-1`). :math:`N_{a}` is calculated from mass-based leaf N concentration and specific leaf area @@ -392,8 +384,8 @@ specific leaf area N_{a} =\frac{1}{CN_{L} \; SLA_{0} } where :math:`CN_{L}` is the leaf carbon-to-nitrogen ratio (g C -g\ :math:`{}^{-1}` N) and :math:`SLA_{0}` is specific leaf area at the -canopy top ( :math:`\text{m}^{2}\,\text{leaf area}\,\text{g}^{-1}\,\text{C}` ). Table 8.1 +g\ :sup:`-1` N) and :math:`SLA_{0}` is specific leaf area at the +canopy top ( m\ :sup:`2` leaf area g\ :sup:`-1` C ). Table 8.1 lists values of :math:`F_{LNR}` , :math:`CN_{L}` , and :math:`SLA_{0}` for each plant functional type. :math:`F_{LNR}` was chosen to give :math:`V_{c\max 25}` consistent with Kattge et al. (2009), as discussed @@ -450,7 +442,7 @@ extinction coefficient (equation 4.9). Photosynthetic parameters The value :math:`K_{n} = 0.11` chosen by Bonan et al. (2011) is consistent with observationally-derived estimates for forests, mostly -tropical, and provides a gradient in :math:`\text{V}_{cmax}` similar to +tropical, and provides a gradient in V\ :sub:`cmax` similar to the original CLM4 specific leaf area scaling. However, Bonan et al. (2012) showed that the sunlit/shaded canopy parameterization does not match an explicit multi-layer canopy parameterization. The discrepancy @@ -487,8 +479,8 @@ Soil water stress Soil water influences stomatal conductance directly by multiplying the minimum conductance by a soil water stress function :math:`\beta _{t}` -and also indirectly through :math:`A_{n}` in the C\ :math:`{}_{3}` and -C\ :math:`{}_{4}` photosynthesis models, as in Sellers et al. (1996). +and also indirectly through :math:`A_{n}` in the C\ :sub:`3` and +C\ :sub:`4` photosynthesis models, as in Sellers et al. (1996). The latter effect is achieved by multiplying :math:`V_{c\; \max }` and :math:`R_{d}` by :math:`\beta _{t}` . @@ -540,10 +532,10 @@ where :math:`\theta _{ice,\, i} ={w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(\rho _{ice} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{ice} \Delta z_{i} \right)} \le \theta _{sat,\, i}` \ and :math:`\theta _{liq,\, i} ={w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(\rho _{liq} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{liq} \Delta z_{i} \right)} \le \theta _{sat,\, i} -\theta _{ice,\, i}` . :math:`w_{ice,\, i}` and :math:`w_{liq,\, i}` are the ice and liquid -water contents (kg m\ :math:`{}^{-2}`) (Chapter 7), +water contents (kg m\ :sup:`-2`) (Chapter 7), :math:`\theta _{sat,\, i}` is the saturated volumetric water content (section 7.4.1), :math:`\rho _{ice}` and :math:`\rho _{liq}` are the -densities of ice and liquid water (kg m\ :math:`{}^{-3}`) (Table 2.6), +densities of ice and liquid water (kg m\ :sup:`-3`) (Table 2.6), and :math:`\Delta z_{i}` is the soil layer thickness (m) (section 6.1). The root fraction :math:`r_{i}` in each soil layer depends on the plant @@ -587,11 +579,11 @@ Table 8.3. Plant functional type root distribution parameters. +----------------------------------+------------------+------------------+ | BDS boreal | 7.0 | 1.5 | +----------------------------------+------------------+------------------+ -| C\ :math:`{}_{3}` grass arctic | 11.0 | 2.0 | +| C\ :sub:`3` grass arctic | 11.0 | 2.0 | +----------------------------------+------------------+------------------+ -| C\ :math:`{}_{3}` grass | 11.0 | 2.0 | +| C\ :sub:`3` grass | 11.0 | 2.0 | +----------------------------------+------------------+------------------+ -| C\ :math:`{}_{4}` grass | 11.0 | 2.0 | +| C\ :sub:`4` grass | 11.0 | 2.0 | +----------------------------------+------------------+------------------+ | Crop R | 6.0 | 3.0 | +----------------------------------+------------------+------------------+ @@ -617,13 +609,13 @@ Table 8.3. Plant functional type root distribution parameters. Numerical implementation ---------------------------- -The CO\ :math:`{}_{2}` partial pressure at the leaf surface +The CO\ :sub:`2` partial pressure at the leaf surface :math:`c_{s}` (Pa) and the vapor pressure at the leaf surface :math:`e_{s}` (Pa), needed for the stomatal resistance model in -equation , and the internal leaf CO\ :math:`{}_{2}` partial pressure +equation , and the internal leaf CO\ :sub:`2` partial pressure :math:`c_{i}` (Pa), needed for the photosynthesis model in equations -, are calculated assuming there is negligible capacity to store -CO\ :math:`{}_{2}` and water vapor at the leaf surface so that +CO\ :sub:`2` and water vapor at the leaf surface so that .. math:: :label: ZEqnNum581596 @@ -638,13 +630,13 @@ and the transpiration fluxes are related as \frac{e_{a} -e_{i} }{r_{b} +r_{s} } =\frac{e_{a} -e_{s} }{r_{b} } =\frac{e_{s} -e_{i} }{r_{s} } where :math:`r_{b}` is leaf boundary layer resistance (s -m\ :math:`{}^{2}` :math:`\mu` \ mol\ :math:`{}^{-1}`) (section 5.3), the -terms 1.4 and 1.6 are the ratios of diffusivity of CO\ :math:`{}_{2}` to -H\ :math:`{}_{2}`\ O for the leaf boundary layer resistance and stomatal +m\ :sup:`2` :math:`\mu` \ mol\ :sup:`-1`) (section 5.3), the +terms 1.4 and 1.6 are the ratios of diffusivity of CO\ :sub:`2` to +H\ :sub:`2`\ O for the leaf boundary layer resistance and stomatal resistance, :math:`c_{a} ={\rm CO}_{{\rm 2}} \left({\rm mol\; mol}^{{\rm -1}} \right)P_{atm}` -is the atmospheric CO\ :math:`{}_{2}` partial pressure (Pa) calculated -from CO\ :math:`{}_{2}` concentration (ppmv), :math:`e_{i}` is the +is the atmospheric CO\ :sub:`2` partial pressure (Pa) calculated +from CO\ :sub:`2` concentration (ppmv), :math:`e_{i}` is the saturation vapor pressure (Pa) evaluated at the leaf temperature :math:`T_{v}` , and :math:`e_{a}` is the vapor pressure of air (Pa). The vapor pressure of air in the plant canopy :math:`e_{a}` (Pa) is @@ -656,7 +648,7 @@ determined from e_{a} =\frac{P_{atm} q_{s} }{0.622} where :math:`q_{s}` is the specific humidity of canopy air (kg -kg\ :math:`{}^{-1}`) (section 5.3). Equations and are solved for +kg\ :sup:`-1`) (section 5.3). Equations and are solved for :math:`c_{s}` and :math:`e_{s}` .. math:: @@ -706,13 +698,13 @@ resolved at depths in the canopy using a light profile (Chapter 4). In this case, :math:`V_{c\max 25}` is not integrated over the canopy, but is instead given explicitly for each canopy layer using equation . This also uses the Lloyd et al. (2010) relationship whereby -:math:`\text{K}_{n}` scales with :math:`\text{V}_{cmax}` as +K\ :sub:`n` scales with V\ :sub:`cmax` as .. math:: :label: 8.38) K_{n} =\exp \left(0.00963V_{c\max } -2.43\right) -such that higher values of :math:`\text{V}_{cmax}` imply steeper declines +such that higher values of V\ :sub:`cmax` imply steeper declines in photosynthetic capacity through the canopy with respect to cumulative leaf area. diff --git a/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst b/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst index b13328cecb..900f8873a9 100644 --- a/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst +++ b/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst @@ -41,7 +41,7 @@ implemented, the lake consists of 0-5 snow layers; water and ice layers layer has a fixed water mass (set by the nominal layer thickness and the liquid density), with frozen mass-fraction *I* a state variable. Resolved snow layers are present if the snow thickness -:math:`z_{sno} \ge s_{\min }` , where *s* :math:`{}_{min}` = 4 cm by +:math:`z_{sno} \ge s_{\min }` , where *s*\ :sub:`min` = 4 cm by default, and is adjusted for model timesteps other than 1800 s in order to maintain numerical stability (section 9.6.5). For global simulations with 10 body layers, the default (50 m lake) body layer thicknesses are @@ -58,7 +58,7 @@ maintain fixed proportions. For lakes with *d* :math:`<` 1 m, all layers have equal thickness. Thicknesses of snow, soil, and bedrock layers follow the scheme used over non-vegetated surfaces (Chapter 6), with modifications to the snow layer thickness rules to keep snow layers at -least as thick as *s*\ :math:`{}_{min}` (section 9.6.5). +least as thick as *s*\ :sub:`min` (section 9.6.5). External Data ----------------- @@ -66,7 +66,7 @@ External Data As discussed in Subin et al (2012a, b), the Global Lake and Wetland Database (Lehner and Doll 2004) is currently used to prescribe lake fraction in each land model grid cell, for a total of 2.3 million -km\ :math:`{}^{-2}`. As in Subin et al. (2012a, b), the Kourzeneva +km\ :sup:`-2`. As in Subin et al. (2012a, b), the Kourzeneva (2012) global gridded dataset is currently used to estimate a mean lake depth in each grid cell, based on interpolated compilations of geographic information. @@ -75,7 +75,7 @@ Surface Albedo ------------------ For direct radiation, the albedo *a* for lakes with ground temperature -:math:`\text{T}_{g}` * (K) above freezing is given by (Pivovarov, 1972) +:math:`{T}_{g}` (K) above freezing is given by (Pivovarov, 1972) .. math:: :label: ZEqnNum194122 @@ -86,9 +86,9 @@ where *z* is the zenith angle. For diffuse radiation, the expression in eq. is integrated over the full sky to yield *a* = 0.10. For frozen lakes without resolved snow layers, the albedo at cold -temperatures *a* :math:`{}_{0}` is 0.60 for visible and 0.40 for near +temperatures *a*\ :sub:`0` is 0.60 for visible and 0.40 for near infrared radiation. As the temperature at the ice surface, -:math:`\text{T}_{g}`, approaches freezing [ :math:`\text{T}_{f}` (K) (Table +:math:`{T}_{g}`, approaches freezing [ :math:`{T}_{f}` (K) (Table 2.6)], the albedo is relaxed towards 0.10 based on Mironov et al. (2010): .. math:: @@ -99,7 +99,7 @@ infrared radiation. As the temperature at the ice surface, where *a* is restricted to be no less than that given in eq. . For frozen lakes with resolved snow layers, the reflectance of the ice -surface is fixed at *a* :math:`{}_{0}`, and the snow reflectance is +surface is fixed at *a*\ :sub:`0`, and the snow reflectance is calculated as over non-vegetated surfaces (Chapter 3). These two reflectances are combined to obtain the snow-fraction-weighted albedo as in over non-vegetated surfaces (Chapter 3). @@ -115,12 +115,12 @@ Overview of Changes from CLM4 roughnesses depend (weakly) on the friction velocity :math:`u_{\*}` (which itself depends weakly on the surface roughnesses), their calculation has been incorporated into the iteration solution for - :math:`\text{T}_{g}`, and the maximum number of iterations has been + :math:`{T}_{g}`, and the maximum number of iterations has been increased to 4. Convergence of the modified solution was tested during development. #. A coefficient of :math:`\beta` has been added to - :math:`\text{S}_{g}` in eq. , correcting a previous error. + :math:`{S}_{g}` in eq. , correcting a previous error. .. todo:: fill this equation number in #. The top layer thickness :math:`\Delta z_{T}` used in eq. has been @@ -132,7 +132,7 @@ Overview of Changes from CLM4 conductivity calculated in the previous timestep. #. Several conditions are imposed on the ground temperature - :math:`\text{T}_{g}` to maintain a stable density profile at the lake + :math:`{T}_{g}` to maintain a stable density profile at the lake surface eq. . Surface Properties @@ -154,7 +154,7 @@ forcing. For frozen lakes ( :math:`T_{g} \le T_{f}` ) with resolved snow layers, the momentum roughness length :math:`z_{0m} =2.4\times 10^{-3} {\rm m}` (as over non-vegetated surfaces; Chapter 5), and the scalar roughness lengths -(*z* :math:`{}_{0}`\ :math:`{}_{q}`, for latent heat; and *z* :math:`{}_{0}`\ :math:`{}_{h}`, for sensible heat) are given by +(*z*\ :sub:`0q` for latent heat; and *z*\ :sub:`0h`, for sensible heat) are given by (Zilitinkevich 1970) .. math:: @@ -165,14 +165,13 @@ surfaces; Chapter 5), and the scalar roughness lengths where :math:`R_{0}` is the near-surface atmospheric roughness Reynolds number, :math:`z_{0h}` is the roughness length for sensible heat, :math:`z_{0q}` is the -roughness length for latent heat, :math:`\nu` ( :math:`\text{m}^{2}\,\text{s}^{-1}`) is the kinematic viscosity of air, and -:math:`u_{\*}` ( :math:`\text{m\,s}^{-1}` ) is the friction velocity in the +roughness length for latent heat, :math:`\nu` (m\ :sup:`2` s\ :sup:`-1`) is the kinematic viscosity of air, and +:math:`u_{\*}` (m s\ :sup:`-1`) is the friction velocity in the atmospheric surface layer. For frozen lakes without resolved snow layers, :math:`z_{0m} =1\times 10^{-3} {\rm m}` (Subin et al. 2012a), and the scalar roughness lengths are given by . -For unfrozen lakes, *z* :math:`{}_{0}`\ :math:`{}_{m}` is given by -(Subin et al. 2012a) +For unfrozen lakes, *z*\ :sub:`0m` is given by (Subin et al. 2012a) .. math:: :label: ZEqnNum864823 @@ -193,7 +192,7 @@ where :math:`\nu _{0} =1.51\times 10^{-5} {\textstyle\frac{{\rm m}^{{\rm 2}} }{{\rm s}}}` , :math:`T_{0} ={\rm 293.15\; K}`, :math:`P_{0} =1.013\times 10^{5} {\rm \; Pa}` , and -:math:`\text{P}_{ref}` is the pressure at the atmospheric reference +:math:`\{P}_{ref}` is the pressure at the atmospheric reference height. The Charnock coefficient *C* is a function of the lake fetch *F* (m), given in the surface data or set to 25 times the lake depth *d* by default: @@ -206,7 +205,7 @@ default: where *A* and *B* define the fetch- and depth-limitation, respectively; :math:`C_{\min } =0.01` , :math:`C_{\max } =0.01`, :math:`\varepsilon =1` , :math:`f_{c} =100` , and *u* (m -s\ :math:`{}^{-1}`) is the atmospheric forcing wind. +s\ :sup:`-1`) is the atmospheric forcing wind. Surface Flux Solution ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -224,7 +223,7 @@ where :math:`\vec{S}_{g}` \ is the absorbed solar radiation in the lake, :math:`H_{g}` \ is the sensible heat flux (+ upwards), :math:`E_{g}` \ is the water vapor flux (+ upwards), and *G* is the ground heat flux (+ downwards). All of these fluxes depend implicitly on -the temperature at the lake surface :math:`\text{T}_{g}`. +the temperature at the lake surface :math:`{T}_{g}`. :math:`\lambda` converts :math:`E_{g}` to an energy flux based on .. math:: @@ -232,7 +231,7 @@ the temperature at the lake surface :math:`\text{T}_{g}`. \lambda =\left\{\begin{array}{l} {\lambda _{sub} \qquad T_{g} \le T_{f} } \\ {\lambda _{vap} \qquad T_{g} >T_{f} } \end{array}\right\}. -The sensible heat flux (W m\ :math:`{}^{-2}`) is +The sensible heat flux (W m\ :sup:`-2`) is .. math:: :label: ZEqnNum720553 @@ -240,15 +239,15 @@ The sensible heat flux (W m\ :math:`{}^{-2}`) is H_{g} =-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{g} \right)}{r_{ah} } where :math:`\rho _{atm}` is the density of moist air (kg -m\ :math:`{}^{-3}`) (Chapter 5), :math:`C_{p}` is the specific heat -capacity of air (J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) (Table 2.6), +m\ :sup:`-3`) (Chapter 5), :math:`C_{p}` is the specific heat +capacity of air (J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), :math:`\theta _{atm}` is the atmospheric potential temperature (K) (Chapter 5), :math:`T_{g}` is the lake surface temperature (K) (at an infinitesimal interface just above the top resolved model layer: snow, ice, or water), and :math:`r_{ah}` is the aerodynamic resistance to -sensible heat transfer (s m\ :math:`{}^{-1}`) (section 5.1). +sensible heat transfer (s m\ :sup:`-1`) (section 5.1). -The water vapor flux (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is +The water vapor flux (kg m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 9.10) @@ -256,10 +255,10 @@ The water vapor flux (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) is E_{g} =-\frac{\rho _{atm} \left(q_{atm} -q_{sat}^{T_{g} } \right)}{r_{aw} } where :math:`q_{atm}` is the atmospheric specific humidity (kg -kg\ :math:`{}^{-1}`) (section 2.2.1), :math:`q_{sat}^{T_{g} }` \ is the -saturated specific humidity (kg kg\ :math:`{}^{-1}`) (section 5.5) at +kg\ :sup:`-1`) (section 2.2.1), :math:`q_{sat}^{T_{g} }` \ is the +saturated specific humidity (kg kg\ :sup:`-1`) (section 5.5) at the lake surface temperature :math:`T_{g}` , and :math:`r_{aw}` is the -aerodynamic resistance to water vapor transfer (s m\ :math:`{}^{-1}`) +aerodynamic resistance to water vapor transfer (s m\ :sup:`-1`) (section 5.1). The zonal and meridional momentum fluxes are @@ -275,11 +274,11 @@ The zonal and meridional momentum fluxes are \tau _{y} =-\rho _{atm} \frac{v_{atm} }{r_{atm} } where :math:`u_{atm}` and :math:`v_{atm}` are the zonal and -meridional atmospheric winds (m s\ :math:`{}^{-1}`) (section 2.2.1), and +meridional atmospheric winds (m s\ :sup:`-1`) (section 2.2.1), and :math:`r_{am}` is the aerodynamic resistance for momentum (s -m\ :math:`{}^{-1}`) (section 5.1). +m\ :sup:`-1`) (section 5.1). -The heat flux into the lake surface :math:`G` (W m\ :math:`{}^{-2}`) is +The heat flux into the lake surface :math:`G` (W m\ :sup:`-2`) is .. math:: :label: ZEqnNum122376 @@ -287,7 +286,7 @@ The heat flux into the lake surface :math:`G` (W m\ :math:`{}^{-2}`) is G=\frac{2\lambda _{T} }{\Delta z_{T} } \left(T_{g} -T_{T} \right) where :math:`\lambda _{T}` is the thermal conductivity (W -m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`), :math:`\Delta z_{T}` is the +m\ :sup:`-1` K\ :sup:`-1`), :math:`\Delta z_{T}` is the thickness (m), and :math:`T_{T}` is the temperature (K) of the top resolved lake layer (snow, ice, or water). The top thermal conductivity :math:`\lambda _{T}` of unfrozen lakes ( :math:`T_{g} >T_{f}` ) @@ -310,7 +309,7 @@ The absorbed solar radiation :math:`\vec{S}_{g}` is where :math:`S_{atm} \, \downarrow _{\Lambda }^{\mu }` and :math:`S_{atm} \, \downarrow _{\Lambda }` are the incident direct beam -and diffuse solar fluxes (W m\ :math:`{}^{-2}`) and :math:`\Lambda` +and diffuse solar fluxes (W m\ :sup:`-2`) and :math:`\Lambda` denotes the visible (:math:`<` 0.7\ :math:`\mu {\rm m}`) and near-infrared (:math:`\ge` 0.7\ :math:`\mu {\rm m}`) wavebands (section 2.2.1), and :math:`\alpha _{g,\, \Lambda }^{\mu }` and @@ -335,10 +334,8 @@ the surface is L\, \uparrow =\left(1-\varepsilon _{g} \right)L_{atm} \, \downarrow +\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{4} +4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} \left(T_{g}^{n+1} -T_{g}^{n} \right) where :math:`\varepsilon _{g} =0.97` is the lake surface emissivity, -:math:`\sigma` is the Stefan-Boltzmann constant (W m\ :math:`{}^{-2}` -K\ :math:`{}^{-4}`) (Table 2.6), and :math:`T_{g}^{n+1} -T_{g}^{n}` is -the difference in lake surface temperature between Newton-Raphson -iterations (see below). +:math:`\sigma` is the Stefan-Boltzmann constant (W m\ :sup:`-2` K\ :sup:`-4`) (Table 2.6), and :math:`T_{g}^{n+1} -T_{g}^{n}` is +the difference in lake surface temperature between Newton-Raphson iterations (see below). The sensible heat :math:`H_{g}` , the water vapor flux :math:`E_{g}` through its dependence on the saturated specific humidity, the net @@ -388,14 +385,14 @@ simultaneously with lake surface temperature as follows. The stability-related equations are the same as for non-vegetated surfaces (section 5.2), except that the surface roughnesses are here (weakly varying) functions of the friction velocity :math:`u_{\*}` . To begin, -*z* :math:`{}_{0}`\ :math:`{}_{m}` is set based on the value +*z*\ :sub:`0m` is set based on the value calculated for the last timestep (for :math:`T_{g} >T_{f}` ) or based on the values in section 9.4.2 (otherwise), and the scalar roughness lengths are set based on the relationships in section 9.4.2. #. An initial guess for the wind speed :math:`V_{a}` including the convective velocity :math:`U_{c}` is obtained from eq. assuming an - initial convective velocity :math:`U_{c} =0` m s\ :math:`{}^{-1}` for + initial convective velocity :math:`U_{c} =0` m s\ :sup:`-1` for stable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` as evaluated from eq. ) and :math:`U_{c} =0.5` for unstable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). @@ -460,7 +457,7 @@ layer temperature :math:`T_{T}` \ (Subin et al. 2012a). \begin{array}{l} {{\rm 1)\; }T_{T} \le T_{f} T_{g} ^{{'} } >T_{m} \Rightarrow T_{g} =T_{T} ,} \\ {{\rm 3)\; }T_{m} >T_{g} ^{{'} } >T_{T} >T_{f} \Rightarrow T_{g} =T_{T} } \end{array} where :math:`T_{m}` \ is the temperature of maximum liquid water -density, 3.85\ :math:`{}^\circ`\ C (Hostetler and Bartlein 1990). The +density, 3.85\ :sup:`o` C (Hostetler and Bartlein 1990). The first condition requires that, if there is any snow or ice present, the surface temperature is restricted to be less than or equal to freezing. The second and third conditions maintain convective stability in the top @@ -474,7 +471,7 @@ XXX in order to precisely conserve energy. XXX This ground heat flux is taken as a prescribed flux boundary condition for the lake temperature solution (section 9.5.3). An energy balance check is included at each timestep to insure that eq. XXX is obeyed to within -0.1 W m\ :math:`{}^{-2}`. +0.1 W m\ :sup:`-2`. Lake Temperature -------------------- @@ -493,10 +490,10 @@ land units (Chapter 6), is \tilde{c}_{v} \frac{\partial T}{\partial t} =\frac{\partial }{\partial z} \left(\tau \frac{\partial T}{\partial z} \right)-\frac{d\phi }{dz} where :math:`\tilde{c}_{v}` is the volumetric heat capacity (J -m\ :math:`{}^{-3}` K\ :math:`{}^{-1}`), :math:`t` is time (s), *T* is +m\ :sup:`-3` K\ :sup:`-1`), :math:`t` is time (s), *T* is the temperature (K), :math:`\tau` is the thermal conductivity (W -m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`), and :math:`\phi` is the solar -radiation (W m\ :math:`{}^{-2}`) penetrating to depth *z* (m). The +m\ :sup:`-1` K\ :sup:`-1`), and :math:`\phi` is the solar +radiation (W m\ :sup:`-2`) penetrating to depth *z* (m). The system is discretized into *N* layers, where .. math:: @@ -555,7 +552,7 @@ The top boundary condition, imposed at the top modeled layer downwards surface flux *G* defined by the energy flux residual during the surface temperature solution (section 9.4.3). The bottom boundary condition, imposed at :math:`i=N_{levlak} +N_{levgrnd}` , is zero flux. -The 2-m windspeed :math:`u_{2}` \ (m s\ :math:`{}^{-1}`) is used in the +The 2-m windspeed :math:`u_{2}` \ (m s\ :sup:`-1`) is used in the calculation of eddy diffusivity: .. math:: @@ -569,7 +566,7 @@ where :math:`u_{*}` \ is the friction velocity calculated in section Eddy Diffusivity and Thermal Conductivities ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The total eddy diffusivity :math:`K_{W}` (:math:`\text{m}^{2}\,\text{s}^{-1}`) for liquid water in the lake body is given by (Subin et al. 2012a) +The total eddy diffusivity :math:`K_{W}` (m\ :sup:`2` s\ :sup:`-1`) for liquid water in the lake body is given by (Subin et al. 2012a) .. math:: :label: 9.29) @@ -582,9 +579,9 @@ intended to represent unresolved mixing processes (Fang and Stefan 1996), :math:`\kappa _{m} =\frac{\lambda _{liq} }{c_{liq} \rho _{liq} }` \ is the molecular diffusivity of water (given by the ratio of its thermal -conductivity (W m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) to the product of -its heat capacity (J kg\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) and density -(kg m\ :math:`{}^{-3}`), values given in Table 2.6), and :math:`m_{d}` +conductivity (W m\ :sup:`-1` K\ :sup:`-1`) to the product of +its heat capacity (J kg\ :sup:`-1` K\ :sup:`-1`) and density +(kg m\ :sup:`-3`), values given in Table 2.6), and :math:`m_{d}` (unitless) is a factor which increases the overall diffusivity for large lakes, intended to represent 3-dimensional mixing processes such as caused by horizontal temperature gradients. As currently implemented, @@ -596,8 +593,7 @@ caused by horizontal temperature gradients. As currently implemented, where *d* is the lake depth. -The wind-driven eddy diffusion coefficient :math:`\kappa _{e,\, i}` -( :math:`\text{m}^{2}\,\text{s}^{-1}` ) for layers :math:`1\le i\le N_{levlak}` is +The wind-driven eddy diffusion coefficient :math:`\kappa _{e,\, i}` (m\ :sup:`2` s\ :sup:`-1`) for layers :math:`1\le i\le N_{levlak}` is .. math:: :label: 9.31) @@ -606,13 +602,13 @@ The wind-driven eddy diffusion coefficient :math:`\kappa _{e,\, i}` where :math:`P_{0} =1` is the neutral value of the turbulent Prandtl number, :math:`z_{i}` is the node depth (m), the surface friction -velocity (m s\ :math:`{}^{-1}`) is :math:`w^{*} =0.0012u_{2}` , and +velocity (m s\ :sup:`-1`) is :math:`w^{*} =0.0012u_{2}` , and :math:`k^{*}` varies with latitude :math:`\phi` as :math:`k^{*} =6.6u_{2}^{-1.84} \sqrt{\left|\sin \phi \right|}` . For the bottom layer, :math:`\kappa _{e,\, N_{levlak} } =\kappa _{e,N_{levlak} -1\, }` . As in Hostetler and Bartlein (1990), the 2-m wind speed :math:`u_{2}` (m -s\ :math:`{}^{-1}`) (eq. ) is used to evaluate :math:`w^{*}` and +s\ :sup:`-1`) (eq. ) is used to evaluate :math:`w^{*}` and :math:`k^{*}` rather than the 10-m wind used by Henderson-Sellers (1985). @@ -630,9 +626,9 @@ where N^{2} =\frac{g}{\rho _{i} } \frac{\partial \rho }{\partial z} -and :math:`g` is the acceleration due to gravity (m s\ :math:`{}^{-2}`) +and :math:`g` is the acceleration due to gravity (m s\ :sup:`-2`) (Table 2.6), :math:`\rho _{i}` is the density of water (kg -m\ :math:`{}^{-3}`), and :math:`\frac{\partial \rho }{\partial z}` is +m\ :sup:`-3`), and :math:`\frac{\partial \rho }{\partial z}` is approximated as :math:`\frac{\rho _{i+1} -\rho _{i} }{z_{i+1} -z_{i} }` . Note that because here, *z* is increasing downwards (unlike in Hostetler and @@ -656,7 +652,7 @@ where :math:`N^{2}` \ is calculated as in eq. except for the minimum value imposed in . The thermal conductivity for the liquid water portion of lake body layer -*i*, :math:`\tau _{liq,i}` (W m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`) is +*i*, :math:`\tau _{liq,i}` (W m\ :sup:`-1` K\ :sup:`-1`) is given by .. math:: @@ -665,7 +661,7 @@ given by \tau _{liq,i} =K_{W} c_{liq} \rho _{liq} . The thermal conductivity of the ice portion of lake body layer *i*, -:math:`\tau _{ice,eff}` \ (W m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`), is +:math:`\tau _{ice,eff}` \ (W m\ :sup:`-1` K\ :sup:`-1`), is constant among layers, and is given by .. math:: @@ -701,7 +697,7 @@ If there are no resolved snow layers, the surface absorption fraction :math:`\be by the atmospheric model. This is apportioned to the surface energy budget (section 9.4.2), and thus no additional radiation is absorbed in the top :math:`z_{a}` (currently 0.6 m) of unfrozen lakes, for which -the light extinction coefficient :math:`\eta` ( :math:`\text{m}^{-1}` ) +the light extinction coefficient :math:`\eta` (m\ :sup:`-1`) varies between lake columns (eq. ). For frozen lakes (:math:`T_{g} \le T_{f}` ), the remaining :math:`\left(1-\beta \right)\vec{S}_{g}` fraction of surface absorbed radiation that is not apportioned to the surface energy budget is @@ -730,11 +726,11 @@ For all lake body layers, the flux absorbed by the layer *i*, \phi _{i} =\left(1-\beta \vec{S}_{g} \right)\left[\exp \left\{-\eta \left(z_{i} -\frac{\Delta z_{i} }{2} -z_{a} \right)\right\}-\exp \left\{-\eta \left(z_{i} +\frac{\Delta z_{i} }{2} -z_{a} \right)\right\}\right] . The argument of each exponent is constrained to be non-negative (so -:math:`\phi _{i}` = 0 for layers contained within :math:`\text{z}_{a}`). +:math:`\phi _{i}` = 0 for layers contained within :math:`{z}_{a}`). The remaining flux exiting the bottom of layer :math:`i=N_{levlak}` is absorbed in the top soil layer. -The light extinction coefficient :math:`\eta` ( :math:`\text{m}^{-1}` ), if +The light extinction coefficient :math:`\eta` (m\ :sup:`-1`), if not provided as external data, is a function of depth *d* (m) (Subin et al. 2012a): @@ -747,8 +743,7 @@ Heat Capacities ^^^^^^^^^^^^^^^^^^^^^ The vertically-integrated heat capacity for each lake layer, -:math:`\text{c}_{v,i}\,\text{J\,m}^{-2}`) is -determined by the mass-weighted average over the heat capacities for the +:math:`\text{c}_{v,i}` (J m\ :sup:`-2`) is determined by the mass-weighted average over the heat capacities for the water and ice fractions: .. math:: @@ -760,7 +755,7 @@ Note that the density of water is used for both ice and water fractions, as the thickness of the layer is fixed. The total heat capacity :math:`c_{v,i}` for each soil, snow, and -bedrock layer (J m\ :math:`{}^{-2}`) is determined as for vegetated land +bedrock layer (J m\ :sup:`-2`) is determined as for vegetated land units (Chapter 6), as the sum of the heat capacities for the water, ice, and mineral constituents. @@ -772,8 +767,8 @@ soil (Chapter 6), except that the lake body layers are sandwiched between the snow and soil layers (section 9.5.1), and radiation flux is absorbed throughout the lake layers. Before solution, layer temperatures :math:`T_{i}` (K), thermal conductivities :math:`\tau _{i}` (W -m\ :math:`{}^{-1}` K\ :math:`{}^{-1}`), heat capacities :math:`c_{v,i}` -(J m\ :math:`{}^{-2}`), and layer and interface depths from all +m\ :sup:`-1` K\ :sup:`-1`), heat capacities :math:`c_{v,i}` +(J m\ :sup:`-2`), and layer and interface depths from all components are transformed into a uniform set of vectors with length :math:`N=n_{sno} +N_{levlak} +N_{levgrnd}` and consistent units to simplify the solution. Thermal conductivities at layer interfaces are @@ -799,7 +794,7 @@ layer as where superscripts *n* + 1 and *n* denote values at the end and beginning of the timestep :math:`\Delta t`, respectively, :math:`F_{i}` -(W m\ :math:`{}^{-2}`) is the downward heat flux at the bottom of layer +(W m\ :sup:`-2`) is the downward heat flux at the bottom of layer *i*, and :math:`\phi _{i}` is the solar radiation absorbed in layer *i*. @@ -833,7 +828,7 @@ given layer if the temperature is below freezing and liquid water remains, or if the temperature is above freezing and ice remains. If melting occurs, the available energy for melting, :math:`Q_{avail}` -(J m\ :math:`{}^{-2}`), is computed as +(J m\ :sup:`-2`), is computed as .. math:: :label: ZEqnNum598199 @@ -842,7 +837,7 @@ If melting occurs, the available energy for melting, :math:`Q_{avail}` where :math:`T_{i}` is the temperature of the layer after thermal diffusion (section 9.5.7), and :math:`c_{v,i}` \ is as calculated in -section 9.5.6. The mass of melt in the layer *M* (kg m\ :math:`{}^{-2}`) +section 9.5.6. The mass of melt in the layer *M* (kg m\ :sup:`-2`) is given by .. math:: @@ -850,7 +845,7 @@ is given by M=\min \left\{M_{ice} ,\frac{Q_{avail} }{H_{fus} } \right\} -where :math:`H_{fus}` (J kg\ :math:`{}^{-1}`) is the latent heat of +where :math:`H_{fus}` (J kg\ :sup:`-1`) is the latent heat of fusion of water (Table 2.6), and :math:`M_{ice}` is the mass of ice in the layer: :math:`I_{i} \rho _{liq} \Delta z_{i}` for a lake body layer, or simply the soil / snow ice content state variable @@ -991,7 +986,7 @@ Energy Conservation To check energy conservation, the left-hand side of eq. XXX is re-written to yield the total enthalpy of the lake system (J -m\ :math:`{}^{-2}`) :math:`H_{tot}` : +m\ :sup:`-2`) :math:`H_{tot}` : .. math:: :label: 9.57) @@ -1004,14 +999,14 @@ present in resolved snow layers. This expression is evaluated once at the beginning and once at the end of the timestep (re-evaluating each :math:`c_{v,i}` ), and the change is compared with the net surface energy flux to yield the error flux :math:`E_{soi}` (W -m\ :math:`{}^{-2}`): +m\ :sup:`-2`): .. math:: :label: 9.58) E_{soi} =\frac{\Delta H_{tot} }{\Delta t} -G-\sum _{i=j_{top} }^{N_{levlak} +N_{levgrnd} }\phi _{i} -If :math:`\left|E_{soi} \right|<0.1`\ W m\ :math:`{}^{-2}`, it is +If :math:`\left|E_{soi} \right|<0.1`\ W m\ :sup:`-2`, it is subtracted from the sensible heat flux and added to *G*. Otherwise, the model is aborted. @@ -1025,8 +1020,8 @@ Hydrology is done similarly to other impervious non-vegetated columns (e.g., glaciers) where snow layers may be resolved but infiltration into the permanent ground is not allowed. The water mass of lake columns is currently maintained constant, aside from overlying snow. The water -budget is balanced with :math:`q_{rgwl}` (eq. ; kg m\ :math:`{}^{-2}` -s\ :math:`{}^{-1}`), a generalized runoff term for impervious land units +budget is balanced with :math:`q_{rgwl}` (eq. ; kg m\ :sup:`-2` +s\ :sup:`-1`), a generalized runoff term for impervious land units that may be negative. There are some modifications to the soil and snow parameterizations as @@ -1055,12 +1050,12 @@ The total water balance of the system is given by \Delta W_{sno} +\sum _{i=1}^{n_{levsoi} }\left(\Delta w_{liq,i} +\Delta w_{ice,i} \right) =\left(q_{rain} +q_{sno} -E_{g} -q_{rgwl} -q_{snwcp,\, ice} \right)\Delta t -where :math:`W_{sno}` (kg m\ :math:`{}^{-2}`) is the total mass of snow +where :math:`W_{sno}` (kg m\ :sup:`-2`) is the total mass of snow (both liquid and ice, in resolved snow layers or bulk snow), :math:`w_{liq,i}` and :math:`w_{ice,i}` are the masses of water phases -(kg m\ :math:`{}^{-2}`) in soil layer *i*, :math:`q_{rain}` and +(kg m\ :sup:`-2`) in soil layer *i*, :math:`q_{rain}` and :math:`q_{sno}` are the precipitation forcing from the atmosphere (kg -m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`), :math:`q_{snwcp,\, ice}` is the +m\ :sup:`-2` s\ :sup:`-1`), :math:`q_{snwcp,\, ice}` is the ice runoff associated with snow-capping (below), :math:`E_{g}` is the ground evaporation (section 9.4.3), and :math:`n_{levsoi}` is the number of hydrologically active soil layers (as opposed to dry bedrock @@ -1092,7 +1087,7 @@ treated as over other land units, except that the allowed evaporation from the ground is unlimited (though the top snow layer cannot lose more water mass than it contains). If there are no resolved snow layers but :math:`W_{sno} >0` and :math:`E_{g} >0`, sublimation -:math:`q_{sub,sno}` \ (kg m\ :math:`{}^{-2}` s\ :math:`{}^{-1}`) will be +:math:`q_{sub,sno}` \ (kg m\ :sup:`-2` s\ :sup:`-1`) will be given by .. math:: @@ -1121,7 +1116,7 @@ Snow Hydrology submodel (section 7.2). Otherwise, the snow ice mass is updated directly, and :math:`z_{sno}` is adjusted by the same proportion as the snow ice (i.e., maintaining the same density), unless there was no snow before adding the frost, in which case the density is -assumed to be 250 kg m\ :math:`{}^{-3}`. +assumed to be 250 kg m\ :sup:`-3`. Soil Hydrology ^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst new file mode 100644 index 0000000000..6adf6f9db7 --- /dev/null +++ b/doc/source/tech_note/index.rst @@ -0,0 +1,43 @@ +.. on documentation master file, created by + sphinx-quickstart on Tue Jan 31 19:46:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root`toctree` directive. + +.. _tech_note: + +##################################### +CLM Technical Note +##################################### + +.. toctree:: + :maxdepth: 2 + :numbered: + + CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst + CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst + CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst + CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst + CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst + CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst + CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst + CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst + CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst + CHAPTER_10/CLM45_Tech_Note_Chpt_10_Glacier.rst + CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst + CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst + CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst + CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst + CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst + CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst + CHAPTER_17/CLM45_Tech_Note_Chpt_17_Plant_Mortality.rst + CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst + CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst + CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst + CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst + CHAPTER_22/CLM45_Tech_Note_Chpt_22_DGVM.rst + CHAPTER_23/CLM45_Tech_Note_Chpt_23_BVOCs.rst + CHAPTER_24/CLM45_Tech_Note_Chpt_24_Dust.rst + CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst + CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst + CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst + diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst index 6ad113adc5..7d4408bcc8 100644 --- a/doc/source/users_guide/overview/scientific_validation.rst +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -1,7 +1,7 @@ .. _scientific-validiation: ======================== - Scientific Validiation + Scientific Validation ======================== In this section we go over what has been extensively tested and scientifically validated with CLM4.5, and maybe more importantly what has NOT been tested and may NOT be scientifically validated. You can use all features of CLM, but need to realize that some things haven't been tested extensively or validated scientifically. When you use these features you may run into trouble doing so, and will need to do your own work to make sure the science is reasonable. From d910ae506c43b1b3ba84cb43e0ce3ef72cdf224a Mon Sep 17 00:00:00 2001 From: mvertens Date: Tue, 28 Mar 2017 11:19:41 -0600 Subject: [PATCH 0004/1973] added all the html for the tech_note --- .../CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst | 3 +-- .../CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst | 10 +++++----- .../CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst | 9 +++++---- .../CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst b/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst index afffe5fec1..c455e50387 100644 --- a/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst +++ b/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst @@ -235,8 +235,7 @@ The fire spread rate in the downwind direction is represented as u_{p} =u_{\max } C_{m} g(W) - (Arora and Boer, 2005), where :math:`u_{\max }` (m -s\ :sup:`-1`) is the PFT-dependent average maximum fire spread +(Arora and Boer, 2005), where :math:`u_{\max }` (m s\ :sup:`-1`) is the PFT-dependent average maximum fire spread rate in natural vegetation regions; :math:`C_{m}` and :math:`g(W)` represent the dependence of :math:`u_{p}` on fuel wetness and wind speed :math:`W`, respectively. :math:`u_{\max }` is set to 0.55 m diff --git a/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst b/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst index e4320a9933..da7150bda6 100644 --- a/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst +++ b/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst @@ -678,15 +678,15 @@ Table 3.4. Spectral bands and weights used for snow radiative transfer +---------------------------------------------------------+----------------------+------------------+ | Spectral band | Direct-beam weight | Diffuse weight | +=========================================================+======================+==================+ -| Band 1: 0.3-0.7\ :math:`\mu`\ m (visible) | | | +| Band 1: 0.3-0.7\ :math:`\mu`\ m (visible) | | | +---------------------------------------------------------+----------------------+------------------+ -| Band 2: 0.7-1.0\ :math:`\mu`\ m (near-IR) | 0.494 | 0.586 | +| Band 2: 0.7-1.0\ :math:`\mu`\ m (near-IR) | 0.494 | 0.586 | +---------------------------------------------------------+----------------------+------------------+ -| Band 3: 1.0-1.2\ :math:`\mu`\ m (near-IR) | 0.181 | 0.202 | +| Band 3: 1.0-1.2\ :math:`\mu`\ m (near-IR) | 0.181 | 0.202 | +---------------------------------------------------------+----------------------+------------------+ -| Band 4: 1.2-1.5\ :math:`\mu`\ m (near-IR) | 0.121 | 0.109 | +| Band 4: 1.2-1.5\ :math:`\mu`\ m (near-IR) | 0.121 | 0.109 | +---------------------------------------------------------+----------------------+------------------+ -| Band 5: 1.5-5.0\ :math:`\mu`\ m (near-IR) | 0.204 | 0.103 | +| Band 5: 1.5-5.0\ :math:`\mu`\ m (near-IR) | 0.204 | 0.103 | +---------------------------------------------------------+----------------------+------------------+ Under direct-beam conditions, singularities in the radiative diff --git a/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst b/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst index 20ed6594d2..48fe2dd742 100644 --- a/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst +++ b/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst @@ -1730,7 +1730,8 @@ where s_{N_{levsoi} +1} =0.5\left(\frac{\theta _{sat,\, N_{levsoi} } +\theta _{N_{levsoi} } }{\theta _{sat,\, N_{levsoi} } } \right)\qquad 0.01\le s_{N_{levsoi} +1} \le 1, - :math:`\psi _{E,\, N_{levsoi} +1}` is evaluated from equations and , +:math:`\psi _{E,\, N_{levsoi} +1}` is evaluated from equations and , + and .. math:: @@ -1914,7 +1915,7 @@ in water stored in the unconfined aquifer :math:`W_{a}` (mm) is updated as .. math:: - :label: 7.174) + :label: 7.174a) \Delta W_{a}^{} =\left(q_{recharge} -q_{drai} \right)\Delta t @@ -1924,7 +1925,7 @@ layer :math:`N_{levsoi}` . The recharge rate is defined as positive when water enters the aquifer .. math:: - :label: 7.174) + :label: 7.174b) q_{recharge} =\frac{\Delta \theta _{liq,\, N_{levsoi} +1} \Delta z_{N_{levsoi} +1} }{\Delta t} @@ -1935,7 +1936,7 @@ calculated from the solution of the soil water equations (section 7.4), and :math:`\Delta z_{N_{levsoi} +1}` (mm) is .. math:: - :label: 7.174) + :label: 7.174c) \Delta z_{N_{levsoi} +1} =z_{\nabla }^{n} -z_{h,\, N_{levsoi} } . diff --git a/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst b/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst index 900f8873a9..40cff9b8d8 100644 --- a/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst +++ b/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst @@ -501,7 +501,7 @@ system is discretized into *N* layers, where N=n_{sno} +N_{levlak} +N_{levgrnd} , - :math:`n_{sno}` is the number of actively modeled snow layers at the +:math:`n_{sno}` is the number of actively modeled snow layers at the current timestep (section 7.2), and :math:`N_{levgrnd}` \ is as for vegetated land units (Chapter 6). Energy is conserved as From 428ad361d85f027c76b8246e457dbec4d54c248f Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 31 Mar 2017 11:57:40 -0600 Subject: [PATCH 0005/1973] Fixed some latex errors --- .../CLM45_Tech_Note_Chpt_11_RTM.rst | 18 ++++++------- .../CLM45_Tech_Note_Chpt_12_Urban.rst | 2 +- .../CLM45_Tech_Note_Chpt_18_Fire.rst | 27 +++++++++---------- .../CLM45_Tech_Note_Chpt_25_Isotopes.rst | 2 +- .../CLM45_Tech_Note_Chpt_27_References.rst | 2 +- .../CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst | 2 +- .../customizing-the-clm-configuration.rst | 8 +++--- 7 files changed, 30 insertions(+), 31 deletions(-) diff --git a/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst b/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst index 032589055f..fd0702da94 100644 --- a/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst +++ b/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst @@ -23,7 +23,7 @@ cell to its downstream neighboring grid cell. The change in storage cell (m\ :sup:`3` s\ :sup:`-1`) is .. math:: - :label: ZEqnNum723341 + :label: 11.1) \frac{dS}{dt} =\sum F_{in} -F_{out} +R @@ -55,7 +55,7 @@ and channel roughness data are not available globally, so a simplified effective flow velocity expression is used in RTM .. math:: - :label: 11.2) + :label: 11.3) v=\max \left(0.05,k\beta ^{1/2} \right) @@ -66,14 +66,14 @@ The distance :math:`d` between two grid cell centers depends on river direction, latitude, and longitude as .. math:: - :label: 11.3) + :label: 11.4) d=\sqrt{\Delta x^{2} +\Delta y^{2} } . The distance in the zonal direction :math:`\Delta x` (m) is .. math:: - :label: 11.4) + :label: 11.5) \Delta x=\left(1\times 10^{3} \left|\theta _{i,\, j} -\theta _{i*,\, j*} \right|R_{e} \right)\left[0.5\left(\cos \phi _{i,\, j} +\cos \phi _{i*,\, j*} \right)\right] @@ -86,7 +86,7 @@ are grid cell indices. The distance in the meridional direction :math:`\Delta y` (m) is .. math:: - :label: 11.5) + :label: 11.6) \Delta y=\left(1\times 10^{3} \left|\theta _{i,\, j} -\theta _{i*,\, j*} \right|R_{e} \right). @@ -97,7 +97,7 @@ total liquid water runoff at the land model resolution (kg m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 11.6) + :label: 11.7) R_{liq} =q_{over} +q_{drai} +q_{rgwl} @@ -108,14 +108,14 @@ where :math:`q_{over}` is surface runoff (section 7.3), 9.6.3). The total ice water runoff, also at the land model resolution is .. math:: - :label: 11.7) + :label: 11.8) R_{ice} =q_{snwcp,ice} where :math:`q_{snwcp,ice}` is the ice runoff from snow-capped surfaces (section 7.7). The runoff at the land model resolution is interpolated to the resolution of RTM and converted to units of -m\ :sup:`3` s\ :sup:`-1` for use in equation by multiplying +m\ :sup:`3` s\ :sup:`-1` for use in equation (11.1) by multiplying by :math:`1\times 10^{-3} A` where :math:`A` is the area (m\ :sup:`2`) of the RTM grid cell. @@ -132,7 +132,7 @@ as a diagnostic tool. The river-routing scheme conserves water globally as .. math:: - :label: 11.8) + :label: 11.9) \sum _{i,\, j}\left(\frac{dS}{dt} \right) _{i,\, j} =\sum _{i,\, j}R_{i,\, j} . diff --git a/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst b/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst index 7e78b328d2..b5415474b1 100644 --- a/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst +++ b/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst @@ -112,7 +112,7 @@ but are not shown for clarity. Figure 12.2. Schematic of urban and atmospheric model coupling. The urban model is forced by the atmospheric model wind -(:math:`u_{atm}` ), temperature (**:math:`T_{atm}` **), specific +(:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar (:math:`S_{atm} \, \downarrow` ) and longwave (:math:`L_{atm} \, \downarrow` ) radiation at reference height diff --git a/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst b/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst index c455e50387..df1842bde1 100644 --- a/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst +++ b/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst @@ -27,7 +27,7 @@ where :math:`N_{f}` (count (time step)\ :sup:`-1`) is fire counts in the grid cell; :math:`a` (km:sup:`2`) is average fire spread area of a fire. -18.1.1 Fire counts +Fire counts ^^^^^^^^^^^^^^^^^^ Fire counts :math:`N_{f}` is taken as @@ -176,10 +176,10 @@ influence on fire occurrence for tree PFTs as f_{e} =\left\{\begin{array}{cc} {0.39,} & {GDP\ge 20} \\ {1} & {GDP<20} \end{array}\right. to reproduce that the MODIS fire counts in tree-dominated regions of -GDP\ :math:`\ge 20` k 1995US$ capita\ :sup:`-1` is 39% of that in -other **** tree-dominated regions. +GDP (:math:`\ge 20` k 1995US$ capita\ :sup:`-1` is 39% of that in +other tree-dominated regions. -18.1.2 Average spread area of a fire +Average spread area of a fire ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Fire fighting capacity depends on socioeconomic conditions and affects @@ -235,7 +235,7 @@ The fire spread rate in the downwind direction is represented as u_{p} =u_{\max } C_{m} g(W) -(Arora and Boer, 2005), where :math:`u_{\max }` (m s\ :sup:`-1`) is the PFT-dependent average maximum fire spread +(Arora and Boer, 2005), where :math:`u_{\max }`\ (m s\ :sup:`-1`) is the PFT-dependent average maximum fire spread rate in natural vegetation regions; :math:`C_{m}` and :math:`g(W)` represent the dependence of :math:`u_{p}` on fuel wetness and wind speed :math:`W`, respectively. :math:`u_{\max }` is set to 0.55 m @@ -319,7 +319,7 @@ and Eqs. - reflect that more developed and more densely populated regions have a higher fire fighting capability. -18.1.3 Fire impact +Fire impact ^^^^^^^^^^^^^^^^^^ In post-fire regions, we calculate PFT-level fire carbon emissions from @@ -328,25 +328,25 @@ the *j*\ th PFT, :math:`{\phi}_{j}` (g C (time step)\ :sup:`-1`, as .. math:: :label: 18.26) - \phi _{j} =A_{b,} _{j} C_{j} \bullet CC_{j} + \phi _{j} =A_{b,j} C_{j} \bullet CC_{j} where :math:`A_{b,j}` (km\ :sup:`2`\ (time step)\ :sup:`-1`) is burned area for the *j*\ th PFT; **C**\ :sub:`j` =(*C*\ :sub:`leaf`, *C*\ :sub:`stem`, *C*\ :sub:`root`, *C*\ :sub:`ts`) is a vector with carbon density (g C km\ :sup:`-2`) for leaf, stem (live and dead stem), root (fine, live coarse and dead coarse root), and transfer and storage carbon pools -as elements; **CC**\ :sub:`j` = (*CC*\ :sub:`leaf`, *CC*\ :sub:`stem`, *CC*\ :sub:`root`, *CC*\ sub:`ts`) is the corresponding combustion +as elements; **CC**\ :sub:`j` = (*CC*\ :sub:`leaf`, *CC*\ :sub:`stem`, *CC*\ :sub:`root`, *CC*\ :sub:`ts`) is the corresponding combustion completeness factor vector (Table 18.1). Moreover, we assume that 30% and 20% of column-level litter and coarse woody debris are burned and the corresponding carbon is transferred to atmosphere. Tissue mortality due to fire leads to carbon transfers in two ways. First, carbon from uncombusted leaf, live stem, dead stem, root, and transfer and storage pools -:math:`C^{'} _{j1} =(C_{{\rm leaf}} (1-CC_{{\rm leaf}} ),C_{{\rm livestem}} (1-CC_{{\rm stem}} ),C_{{\rm deadstem}} (1-CC_{{\rm stem}} ),C_{{\rm root}} (1-CC_{{\rm root}} ),C_{{\rm ts}} (1-CC_{{\rm ts}} ))_{j}` +:math:`C^{'} _{j1} =(C_{{\rm leaf}} (1-CC_{{\rm leaf}} ) ,C_{{\rm livestem}} (1-CC_{{\rm stem}} ) ,C_{{\rm deadstem}} (1-CC_{{\rm stem}} ),C_{{\rm root}} (1-CC_{{\rm root}} ),C_{{\rm ts}} (1-CC_{{\rm ts}} )) _{j}` (g C km\ :sup:`-2`) is transferred to litter as .. math:: :label: 18.27) - \Psi _{j1} =\frac{A_{b,} _{j} }{f_{j} A_{g} } C^{'} _{j1} \bullet M_{j1} + \Psi _{j1} =\frac{A_{b,j} }{f_{j} A_{g} } C^{'} _{j1} \bullet M_{j1} where :math:`M_{j1} =(M_{{\rm leaf}} ,M_{{\rm livestem,1}} ,M_{{\rm deadstem}} ,M_{{\rm root}} ,M_{{\rm ts}} )_{j}` @@ -356,7 +356,7 @@ carbon from uncombusted live stems is transferred to dead stems as: .. math:: :label: 18.28) - \Psi _{j2} =\frac{A_{b,} _{j} }{f_{j} A_{g} } C_{livestem} (1-CC_{stem} )M_{livestem,2} + \Psi _{j2} =\frac{A_{b,j} }{f_{j} A_{g} } C_{livestem} (1-CC_{stem} )M_{livestem,2} where :math:`M_{livestem,2}` is the corresponding mortality factor (Table 18.1). @@ -371,7 +371,7 @@ killed by fire per km\ :sup:`2` (individual km\ :sup:`-2` .. math:: :label: 18.29) - P_{disturb,} _{j} =\frac{A_{b,} _{j} }{f_{j} A_{g} } P_{j} \xi _{j} + P_{disturb,j} =\frac{A_{b,j} }{f_{j} A_{g} } P_{j} \xi _{j} where :math:`P_{j}` (individual km\ :sup:`-2`) is the population density for the *j*\ th tree PFT and :math:`\xi _{j}` is the @@ -545,8 +545,7 @@ CLM4.5 version driven by Qian et al. (2006) atmospheric forcing and climatological lightning data to earlier studies: about 2.4 Mha peatland was burned over Indonesia in 1997 (Page et al. 2002) and the average burned area of peat fires in Western Canada was 0.2 Mha -yr\ :sup:`-1` for 1980\ :math:`\math{-}`\ 1999 (Turestky et al. -2004). +yr\ :sup:`-1` for 1980-1999 (Turestky et al. 2004). For tropical peat fires, :math:`f_{cli,p}` is set as a function of long-term precipitation :math:`P_{60d}` : diff --git a/doc/source/tech_note/CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst b/doc/source/tech_note/CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst index 024b447962..2138ab143a 100644 --- a/doc/source/tech_note/CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst +++ b/doc/source/tech_note/CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst @@ -93,7 +93,7 @@ This can also be expressed using epsilon notation (:math:`\epsilon`), where \alpha _{A-B} =\frac{\varepsilon _{A-B} }{1000} +1 -In other words, if :math:`{\epsilon }_{A-B} = 4.4{\mathrm{‰}}`, then :math:`{\alpha}_{A-B} =1.0044`. +In other words, if :math:`{\epsilon }_{A-B} = 4.4` ‰ , then :math:`{\alpha}_{A-B} =1.0044`. In addition to the stable isotopes :sup:`1`\ :sup:`2`\ C and :sup:`1`\ :sup:`3`\ C, the unstable isotope :sup:`1`\ :sup:`4`\ C is included in CLM. :sup:`1`\ :sup:`4`\ C can also be described using the delta notation: diff --git a/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst b/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst index 5b73e1a70a..9a63855c9c 100644 --- a/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst +++ b/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst @@ -1247,7 +1247,7 @@ Statistics Division. Vallano, D.M. and Sparks, J.P. 2007. Quantifying foliar uptake of gaseous itrogen dioxide using enriched foliar -:math:`\deltaup`\ :math:`{}^{15 }`\ N values. New Phytologist +:math:`\delta^{15}`\ N values. New Phytologist 177:946-955. van der Werf, G.R., Randerson, J.T., Giglio, L., Collatz, G.J., Mu, M., diff --git a/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst b/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst index 40cff9b8d8..63bf60ba22 100644 --- a/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst +++ b/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst @@ -192,7 +192,7 @@ where :math:`\nu _{0} =1.51\times 10^{-5} {\textstyle\frac{{\rm m}^{{\rm 2}} }{{\rm s}}}` , :math:`T_{0} ={\rm 293.15\; K}`, :math:`P_{0} =1.013\times 10^{5} {\rm \; Pa}` , and -:math:`\{P}_{ref}` is the pressure at the atmospheric reference +:math:`P_{ref}` is the pressure at the atmospheric reference height. The Charnock coefficient *C* is a function of the lake fetch *F* (m), given in the surface data or set to 25 times the lake depth *d* by default: diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst index ed00d99483..e4cafcf046 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst @@ -102,7 +102,7 @@ CLM_NML_USE_CASE glacierMEC_pd = Running an IG case with the ice sheet model glimmer stdurbpt_pd = Standard Urban Point Namelist Settings - .. note::See the `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. + .. note::See `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. CLM_BLDNML_OPTS The option CLM_BLDNML_OPTS is for passing options to the CLM "build-namelist" script. @@ -343,7 +343,7 @@ When "-irrig" is used **build-namelist** will try to find surface datasets that For a list of the history fields available see `CLM History Fields `_. - .. note: See the `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. + .. note::See `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. ``CLM_FORCE_COLDSTART`` when set to on, *requires* that your simulation do a cold start from arbitrary initial conditions. If this is NOT set, it will use an initial condition file if it can find an appropriate one, and otherwise do a cold start. ``CLM_FORCE_COLDSTART`` is a good way to ensure that you are doing a cold start if that is what you want to do. @@ -360,7 +360,7 @@ When "-irrig" is used **build-namelist** will try to find surface datasets that An example of using ``CLM_USRDAT_NAME`` for a simulation is given in `Example 5-4 `_. - .. note:: See `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. + .. note: See `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. ``CLM_CO2_TYPE`` sets the type of input CO2 for either "constant", "diagnostic" or prognostic". @@ -421,7 +421,7 @@ Example: user_nl_clm namelist file **Note:** The comments at the top are some guidance given in the default user_nl_clm and just give some guidance on how to set variables and use the file. -**Note:** See the `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. +**Note:** See `the Section called Precedence of Options `_ section for the precedence of this option relative to the others. **Note:** You do NOT need to specify the namelist group that the variables are in because the CLM **build-namelist** knows the namelist that specific variable names belong to, and it puts them there. From 5118ba09dafd6cead0ed3be06bd5f664d21cdc08 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 7 Apr 2017 16:35:03 -0600 Subject: [PATCH 0006/1973] Testing change to Chapter 1 --- .../tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst b/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst index bb9b012bdc..6c2db760a5 100644 --- a/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst +++ b/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst @@ -4,7 +4,7 @@ **July 2013** -**Technical Description of version 4.5 of the Community Land Model +**Technical Description of version 5.0 of the Community Land Model (CLM)** ***Coordinating Lead Authors*** From 0ec3302fa4be700af496e2ea3fb4f18d22d5d383 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 10 Apr 2017 10:18:06 -0600 Subject: [PATCH 0007/1973] Test of Chapter 1 rename --- ...Introduction.rst => CLM50_Tech_Note_Chpt_1_Introduction.rst} | 0 doc/source/tech_note/index.rst | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename doc/source/tech_note/CHAPTER_1/{CLM45_Tech_Note_Chpt_1_Introduction.rst => CLM50_Tech_Note_Chpt_1_Introduction.rst} (100%) diff --git a/doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst b/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst rename to doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index 6adf6f9db7..a6d675ffed 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -13,7 +13,7 @@ CLM Technical Note :maxdepth: 2 :numbered: - CHAPTER_1/CLM45_Tech_Note_Chpt_1_Introduction.rst + CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst From b7a0c619d0f4387d24b1c992f680fa76a055f82b Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 10 Apr 2017 15:49:20 -0600 Subject: [PATCH 0008/1973] 3rd Test of Chapter 1 rename --- .../tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst | 2 +- .../tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst b/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst index 6c2db760a5..7074842c5b 100644 --- a/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst +++ b/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst @@ -281,7 +281,7 @@ The purpose of this technical note is to describe the biogeophysical and biogeochemical parameterizations and numerical implementation of version 4.5 of the Community Land Model (CLM4.5). Scientific justification and evaluation of these parameterizations can be found in the referenced -scientific papers (Chapter 27). This technical note and the CLM4.5 +scientific papers (:ref:`rst_References`). This technical note and the CLM4.5 User’s Guide together provide the user with the scientific description and operating instructions for CLM. diff --git a/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst b/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst index 9a63855c9c..b953d98b3d 100644 --- a/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst +++ b/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst @@ -1,3 +1,5 @@ +.. _rst_References: + References ============== From f5e4f1304b0bad4976d34f5c44193996e30956bc Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 10 Apr 2017 16:15:30 -0600 Subject: [PATCH 0009/1973] 1st Test of Chapter 2 rename --- ..._Chpt_2_Ecosystem.rst => CLM50_Tech_Note_Chpt_2_Ecosystem.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/source/tech_note/CHAPTER_2/{CLM45_Tech_Note_Chpt_2_Ecosystem.rst => CLM50_Tech_Note_Chpt_2_Ecosystem.rst} (100%) diff --git a/doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst b/doc/source/tech_note/CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst rename to doc/source/tech_note/CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst From 00425245d755df802c3195b4929ae7ecb1a2fa75 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 10 Apr 2017 16:45:31 -0600 Subject: [PATCH 0010/1973] 2nd Test of Chapter 2 rename --- doc/source/tech_note/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index a6d675ffed..1848b3d8d5 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -14,7 +14,7 @@ CLM Technical Note :numbered: CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst - CHAPTER_2/CLM45_Tech_Note_Chpt_2_Ecosystem.rst + CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst From c81e2d64e67c2fbfa1cd2f736e7551e3e2f00eca Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 11 Apr 2017 09:45:38 -0600 Subject: [PATCH 0011/1973] Change chapter titles to CLM50 --- ...st => CLM50_Tech_Note_Chpt_10_Glacier.rst} | 0 ...TM.rst => CLM50_Tech_Note_Chpt_11_RTM.rst} | 0 ....rst => CLM50_Tech_Note_Chpt_12_Urban.rst} | 0 ...ote_Chpt_13_CN_Allocation_Respiration.rst} | 0 ...ech_Note_Chpt_14_Vegetation_Phenology.rst} | 0 ...CLM50_Tech_Note_Chpt_15_Decomposition.rst} | 0 ..._Note_Chpt_16_External_Nitrogen_Cycle.rst} | 0 ...M50_Tech_Note_Chpt_17_Plant_Mortality.rst} | 0 ...e.rst => CLM50_Tech_Note_Chpt_18_Fire.rst} | 0 ...st => CLM50_Tech_Note_Chpt_19_Methane.rst} | 0 ...M50_Tech_Note_Chpt_20_Crop_Irrigation.rst} | 0 ...Tech_Note_Chpt_21_Transient_Landcover.rst} | 0 ...M.rst => CLM50_Tech_Note_Chpt_22_DGVM.rst} | 0 ....rst => CLM50_Tech_Note_Chpt_23_BVOCs.rst} | 0 ...t.rst => CLM50_Tech_Note_Chpt_24_Dust.rst} | 0 ...t => CLM50_Tech_Note_Chpt_25_Isotopes.rst} | 0 ...st => CLM50_Tech_Note_Chpt_26_Offline.rst} | 0 ...=> CLM50_Tech_Note_Chpt_27_References.rst} | 0 ...LM50_Tech_Note_Chpt_3_Surface_Albedos.rst} | 0 ...M50_Tech_Note_Chpt_4_Radiative_Fluxes.rst} | 0 ....rst => CLM50_Tech_Note_Chpt_5_Fluxes.rst} | 0 ...ch_Note_Chpt_6_Soil_Snow_Temperatures.rst} | 0 ...t => CLM50_Tech_Note_Chpt_7_Hydrology.rst} | 0 ...CLM50_Tech_Note_Chpt_8_Photosynthesis.rst} | 0 ...ke.rst => CLM50_Tech_Note_Chpt_9_Lake.rst} | 0 doc/source/tech_note/index.rst | 50 +++++++++---------- 26 files changed, 25 insertions(+), 25 deletions(-) rename doc/source/tech_note/CHAPTER_10/{CLM45_Tech_Note_Chpt_10_Glacier.rst => CLM50_Tech_Note_Chpt_10_Glacier.rst} (100%) rename doc/source/tech_note/CHAPTER_11/{CLM45_Tech_Note_Chpt_11_RTM.rst => CLM50_Tech_Note_Chpt_11_RTM.rst} (100%) rename doc/source/tech_note/CHAPTER_12/{CLM45_Tech_Note_Chpt_12_Urban.rst => CLM50_Tech_Note_Chpt_12_Urban.rst} (100%) rename doc/source/tech_note/CHAPTER_13/{CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst => CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst} (100%) rename doc/source/tech_note/CHAPTER_14/{CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst => CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst} (100%) rename doc/source/tech_note/CHAPTER_15/{CLM45_Tech_Note_Chpt_15_Decomposition.rst => CLM50_Tech_Note_Chpt_15_Decomposition.rst} (100%) rename doc/source/tech_note/CHAPTER_16/{CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst => CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst} (100%) rename doc/source/tech_note/CHAPTER_17/{CLM45_Tech_Note_Chpt_17_Plant_Mortality.rst => CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst} (100%) rename doc/source/tech_note/CHAPTER_18/{CLM45_Tech_Note_Chpt_18_Fire.rst => CLM50_Tech_Note_Chpt_18_Fire.rst} (100%) rename doc/source/tech_note/CHAPTER_19/{CLM45_Tech_Note_Chpt_19_Methane.rst => CLM50_Tech_Note_Chpt_19_Methane.rst} (100%) rename doc/source/tech_note/CHAPTER_20/{CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst => CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst} (100%) rename doc/source/tech_note/CHAPTER_21/{CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst => CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst} (100%) rename doc/source/tech_note/CHAPTER_22/{CLM45_Tech_Note_Chpt_22_DGVM.rst => CLM50_Tech_Note_Chpt_22_DGVM.rst} (100%) rename doc/source/tech_note/CHAPTER_23/{CLM45_Tech_Note_Chpt_23_BVOCs.rst => CLM50_Tech_Note_Chpt_23_BVOCs.rst} (100%) rename doc/source/tech_note/CHAPTER_24/{CLM45_Tech_Note_Chpt_24_Dust.rst => CLM50_Tech_Note_Chpt_24_Dust.rst} (100%) rename doc/source/tech_note/CHAPTER_25/{CLM45_Tech_Note_Chpt_25_Isotopes.rst => CLM50_Tech_Note_Chpt_25_Isotopes.rst} (100%) rename doc/source/tech_note/CHAPTER_26/{CLM45_Tech_Note_Chpt_26_Offline.rst => CLM50_Tech_Note_Chpt_26_Offline.rst} (100%) rename doc/source/tech_note/CHAPTER_27/{CLM45_Tech_Note_Chpt_27_References.rst => CLM50_Tech_Note_Chpt_27_References.rst} (100%) rename doc/source/tech_note/CHAPTER_3/{CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst => CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst} (100%) rename doc/source/tech_note/CHAPTER_4/{CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst => CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst} (100%) rename doc/source/tech_note/CHAPTER_5/{CLM45_Tech_Note_Chpt_5_Fluxes.rst => CLM50_Tech_Note_Chpt_5_Fluxes.rst} (100%) rename doc/source/tech_note/CHAPTER_6/{CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst => CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst} (100%) rename doc/source/tech_note/CHAPTER_7/{CLM45_Tech_Note_Chpt_7_Hydrology.rst => CLM50_Tech_Note_Chpt_7_Hydrology.rst} (100%) rename doc/source/tech_note/CHAPTER_8/{CLM45_Tech_Note_Chpt_8_Photosynthesis.rst => CLM50_Tech_Note_Chpt_8_Photosynthesis.rst} (100%) rename doc/source/tech_note/CHAPTER_9/{CLM45_Tech_Note_Chpt_9_Lake.rst => CLM50_Tech_Note_Chpt_9_Lake.rst} (100%) diff --git a/doc/source/tech_note/CHAPTER_10/CLM45_Tech_Note_Chpt_10_Glacier.rst b/doc/source/tech_note/CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_10/CLM45_Tech_Note_Chpt_10_Glacier.rst rename to doc/source/tech_note/CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst diff --git a/doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst b/doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst rename to doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst diff --git a/doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst b/doc/source/tech_note/CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst rename to doc/source/tech_note/CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst diff --git a/doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst b/doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst rename to doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst diff --git a/doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst b/doc/source/tech_note/CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst rename to doc/source/tech_note/CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst diff --git a/doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst b/doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst rename to doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst diff --git a/doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst b/doc/source/tech_note/CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst rename to doc/source/tech_note/CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst diff --git a/doc/source/tech_note/CHAPTER_17/CLM45_Tech_Note_Chpt_17_Plant_Mortality.rst b/doc/source/tech_note/CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_17/CLM45_Tech_Note_Chpt_17_Plant_Mortality.rst rename to doc/source/tech_note/CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst diff --git a/doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst b/doc/source/tech_note/CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst rename to doc/source/tech_note/CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst diff --git a/doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst b/doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst rename to doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst diff --git a/doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst b/doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst rename to doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst diff --git a/doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst b/doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst rename to doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst diff --git a/doc/source/tech_note/CHAPTER_22/CLM45_Tech_Note_Chpt_22_DGVM.rst b/doc/source/tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_22/CLM45_Tech_Note_Chpt_22_DGVM.rst rename to doc/source/tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst diff --git a/doc/source/tech_note/CHAPTER_23/CLM45_Tech_Note_Chpt_23_BVOCs.rst b/doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_23/CLM45_Tech_Note_Chpt_23_BVOCs.rst rename to doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst diff --git a/doc/source/tech_note/CHAPTER_24/CLM45_Tech_Note_Chpt_24_Dust.rst b/doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_24/CLM45_Tech_Note_Chpt_24_Dust.rst rename to doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst diff --git a/doc/source/tech_note/CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst b/doc/source/tech_note/CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst rename to doc/source/tech_note/CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst diff --git a/doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst b/doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst rename to doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst diff --git a/doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst b/doc/source/tech_note/CHAPTER_27/CLM50_Tech_Note_Chpt_27_References.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst rename to doc/source/tech_note/CHAPTER_27/CLM50_Tech_Note_Chpt_27_References.rst diff --git a/doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst b/doc/source/tech_note/CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst rename to doc/source/tech_note/CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst diff --git a/doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst b/doc/source/tech_note/CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst rename to doc/source/tech_note/CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst diff --git a/doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst b/doc/source/tech_note/CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst rename to doc/source/tech_note/CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst diff --git a/doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst b/doc/source/tech_note/CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst rename to doc/source/tech_note/CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst diff --git a/doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst b/doc/source/tech_note/CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst rename to doc/source/tech_note/CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst diff --git a/doc/source/tech_note/CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst b/doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst rename to doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst diff --git a/doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst b/doc/source/tech_note/CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst rename to doc/source/tech_note/CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index 1848b3d8d5..4141a560bc 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -15,29 +15,29 @@ CLM Technical Note CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst - CHAPTER_3/CLM45_Tech_Note_Chpt_3_Surface_Albedos.rst - CHAPTER_4/CLM45_Tech_Note_Chpt_4_Radiative_Fluxes.rst - CHAPTER_5/CLM45_Tech_Note_Chpt_5_Fluxes.rst - CHAPTER_6/CLM45_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst - CHAPTER_7/CLM45_Tech_Note_Chpt_7_Hydrology.rst - CHAPTER_8/CLM45_Tech_Note_Chpt_8_Photosynthesis.rst - CHAPTER_9/CLM45_Tech_Note_Chpt_9_Lake.rst - CHAPTER_10/CLM45_Tech_Note_Chpt_10_Glacier.rst - CHAPTER_11/CLM45_Tech_Note_Chpt_11_RTM.rst - CHAPTER_12/CLM45_Tech_Note_Chpt_12_Urban.rst - CHAPTER_13/CLM45_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst - CHAPTER_14/CLM45_Tech_Note_Chpt_14_Vegetation_Phenology.rst - CHAPTER_15/CLM45_Tech_Note_Chpt_15_Decomposition.rst - CHAPTER_16/CLM45_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst - CHAPTER_17/CLM45_Tech_Note_Chpt_17_Plant_Mortality.rst - CHAPTER_18/CLM45_Tech_Note_Chpt_18_Fire.rst - CHAPTER_19/CLM45_Tech_Note_Chpt_19_Methane.rst - CHAPTER_20/CLM45_Tech_Note_Chpt_20_Crop_Irrigation.rst - CHAPTER_21/CLM45_Tech_Note_Chpt_21_Transient_Landcover.rst - CHAPTER_22/CLM45_Tech_Note_Chpt_22_DGVM.rst - CHAPTER_23/CLM45_Tech_Note_Chpt_23_BVOCs.rst - CHAPTER_24/CLM45_Tech_Note_Chpt_24_Dust.rst - CHAPTER_25/CLM45_Tech_Note_Chpt_25_Isotopes.rst - CHAPTER_26/CLM45_Tech_Note_Chpt_26_Offline.rst - CHAPTER_27/CLM45_Tech_Note_Chpt_27_References.rst + CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst + CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst + CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst + CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst + CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst + CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst + CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst + CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst + CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst + CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst + CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst + CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst + CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst + CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst + CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst + CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst + CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst + CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst + CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst + CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst + CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst + CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst + CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst + CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst + CHAPTER_27/CLM50_Tech_Note_Chpt_27_References.rst From 5f3c4fa68feb3b8f588c2d442962de72d5c5a556 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 11 Apr 2017 11:46:31 -0600 Subject: [PATCH 0012/1973] Add links to chapters --- .../CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst | 5 +++-- .../tech_note/CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst | 2 ++ .../tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst | 2 ++ .../tech_note/CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst | 2 ++ .../CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst | 2 ++ .../CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst | 2 ++ .../CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst | 2 ++ .../CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst | 2 ++ .../CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst | 2 ++ .../tech_note/CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst | 2 ++ .../tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst | 2 ++ .../tech_note/CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst | 1 + .../CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst | 2 ++ .../CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst | 2 ++ .../tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst | 2 ++ .../tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst | 2 ++ .../tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst | 2 ++ .../CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst | 2 ++ .../tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst | 2 ++ .../CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst | 2 ++ .../CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst | 2 ++ .../tech_note/CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst | 2 ++ .../CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst | 2 ++ .../tech_note/CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst | 2 ++ .../CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst | 2 ++ .../tech_note/CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst | 2 ++ 26 files changed, 52 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst b/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst index 7074842c5b..2a5ba1d3ae 100644 --- a/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst +++ b/doc/source/tech_note/CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst @@ -273,8 +273,9 @@ National Laboratory); A. Bozbiyik (Bern University); C. Heald National Laboratory); Ying Sun and Z.-L. Yang (University of Texas at Austin) -================= - 1. Introduction +.. _rst_Introduction: + +Introduction ================= The purpose of this technical note is to describe the biogeophysical and diff --git a/doc/source/tech_note/CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst b/doc/source/tech_note/CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst index 9bd3e1e11d..6ba68086db 100644 --- a/doc/source/tech_note/CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst +++ b/doc/source/tech_note/CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst @@ -1,3 +1,5 @@ +.. _rst_Glaciers: + Glaciers ============ diff --git a/doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst b/doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst index fd0702da94..9568b91b16 100644 --- a/doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst +++ b/doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst @@ -1,3 +1,5 @@ +.. _rst_River Transport Model (RTM): + River Transport Model (RTM) =============================== diff --git a/doc/source/tech_note/CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst b/doc/source/tech_note/CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst index b5415474b1..b95589f7b4 100644 --- a/doc/source/tech_note/CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst +++ b/doc/source/tech_note/CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst @@ -1,3 +1,5 @@ +.. _rst_Urban Model (CLMU): + Urban Model (CLMU) ====================== diff --git a/doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst b/doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst index a4173834b5..4512d906c4 100644 --- a/doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst +++ b/doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst @@ -1,3 +1,5 @@ +.. _rst_Carbon and Nitrogen Pools, Allocation, and Respiration: + Carbon and Nitrogen Pools, Allocation, and Respiration ========================================================== diff --git a/doc/source/tech_note/CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst b/doc/source/tech_note/CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst index 305e532552..df022465a8 100644 --- a/doc/source/tech_note/CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst +++ b/doc/source/tech_note/CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst @@ -1,3 +1,5 @@ +.. _rst_Vegetation Phenology: + Vegetation Phenology ======================== diff --git a/doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst b/doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst index 89e12a7b94..34a71b2b24 100644 --- a/doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst +++ b/doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst @@ -1,3 +1,5 @@ +.. _rst_Decomposition: + Decomposition ================= diff --git a/doc/source/tech_note/CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst b/doc/source/tech_note/CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst index 07bb1567f9..20d76e38ad 100644 --- a/doc/source/tech_note/CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst +++ b/doc/source/tech_note/CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst @@ -1,3 +1,5 @@ +.. _rst_External Nitrogen Cycle: + External Nitrogen Cycle =========================== diff --git a/doc/source/tech_note/CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst b/doc/source/tech_note/CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst index 348c0a3649..ba880609bf 100644 --- a/doc/source/tech_note/CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst +++ b/doc/source/tech_note/CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst @@ -1,3 +1,5 @@ +.. _rst_Plant Mortality: + Plant Mortality =================== diff --git a/doc/source/tech_note/CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst b/doc/source/tech_note/CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst index df1842bde1..f2236018f6 100644 --- a/doc/source/tech_note/CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst +++ b/doc/source/tech_note/CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst @@ -1,3 +1,5 @@ +.. _rst_Fire: + Fire ======== diff --git a/doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst b/doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst index 7bdea2fefb..fc71c600dd 100644 --- a/doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst +++ b/doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst @@ -1,3 +1,5 @@ +.. _rst_Methane Model: + Methane Model ================= diff --git a/doc/source/tech_note/CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst b/doc/source/tech_note/CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst index d19fdd3f5d..888c379382 100644 --- a/doc/source/tech_note/CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst +++ b/doc/source/tech_note/CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst @@ -1,3 +1,4 @@ +.. _rst_Surface Characterization and Model Input Requirements: Surface Characterization and Model Input Requirements ======================================================== diff --git a/doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst b/doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst index 570028bc8b..9d2aeb71f4 100644 --- a/doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst +++ b/doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst @@ -1,3 +1,5 @@ +.. _rst_Crops and Irrigation: + Crops and Irrigation ======================== diff --git a/doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst b/doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst index 661b1f2e6e..d967dae888 100644 --- a/doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst +++ b/doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst @@ -1,3 +1,5 @@ +.. _rst_Transient Landcover Change: + Transient Landcover Change ============================== diff --git a/doc/source/tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst b/doc/source/tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst index 0ee97d23e3..4a7d378379 100644 --- a/doc/source/tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst +++ b/doc/source/tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst @@ -1,3 +1,5 @@ +.. _rst_Dynamic Global Vegetation Model: + Dynamic Global Vegetation Model =================================== diff --git a/doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst b/doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst index f5f23f8644..bd8259e57c 100644 --- a/doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst +++ b/doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst @@ -1,3 +1,5 @@ +.. _rst_Biogenic Volatile Organic Compounds (BVOCs): + Biogenic Volatile Organic Compounds (BVOCs) =============================================== diff --git a/doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst b/doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst index 92dcefad3e..8126f09774 100644 --- a/doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst +++ b/doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst @@ -1,3 +1,5 @@ +.. _rst_Dust Model: + Dust Model ============== diff --git a/doc/source/tech_note/CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst b/doc/source/tech_note/CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst index 2138ab143a..acb4cf595d 100644 --- a/doc/source/tech_note/CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst +++ b/doc/source/tech_note/CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst @@ -1,3 +1,5 @@ +.. _rst_Carbon Isotopes: + Carbon Isotopes =================== diff --git a/doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst b/doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst index c6a78b34d9..db2b04d5cf 100644 --- a/doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst +++ b/doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst @@ -1,3 +1,5 @@ +.. _rst_Offline Mode: + Offline Mode ================ diff --git a/doc/source/tech_note/CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst b/doc/source/tech_note/CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst index da7150bda6..039691c090 100644 --- a/doc/source/tech_note/CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst +++ b/doc/source/tech_note/CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst @@ -1,3 +1,5 @@ +.. _rst_Surface Albedos: + Surface Albedos ================== diff --git a/doc/source/tech_note/CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst b/doc/source/tech_note/CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst index 64506d1032..741801942d 100644 --- a/doc/source/tech_note/CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst +++ b/doc/source/tech_note/CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst @@ -1,3 +1,5 @@ +.. _rst_Radiative Fluxes: + Radiative Fluxes =================== diff --git a/doc/source/tech_note/CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst b/doc/source/tech_note/CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst index 81c25ee0e8..2d2eb57337 100644 --- a/doc/source/tech_note/CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst +++ b/doc/source/tech_note/CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst @@ -1,3 +1,5 @@ +.. _rst_Momentum, Sensible Heat, and Latent Heat Fluxes: + Momentum, Sensible Heat, and Latent Heat Fluxes ================================================== diff --git a/doc/source/tech_note/CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst b/doc/source/tech_note/CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst index 83dc1e3579..002aac2b0d 100644 --- a/doc/source/tech_note/CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst @@ -1,3 +1,5 @@ +.. _rst_Soil and Snow Temperatures: + Soil and Snow Temperatures ============================= diff --git a/doc/source/tech_note/CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst b/doc/source/tech_note/CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst index 48fe2dd742..59751de56c 100644 --- a/doc/source/tech_note/CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst +++ b/doc/source/tech_note/CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst @@ -1,3 +1,5 @@ +.. _rst_Hydrology: + Hydrology ============ diff --git a/doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst b/doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst index 6cd61d641c..c380f0d75a 100644 --- a/doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst +++ b/doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst @@ -1,3 +1,5 @@ +.. _rst_Stomatal Resistance and Photosynthesis: + Stomatal Resistance and Photosynthesis ========================================= diff --git a/doc/source/tech_note/CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst b/doc/source/tech_note/CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst index 63bf60ba22..1356ca27a9 100644 --- a/doc/source/tech_note/CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst +++ b/doc/source/tech_note/CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst @@ -1,3 +1,5 @@ +.. _rst_Lake Model: + Lake Model ============= From 8efdfff444c171833356f3702b701b1a61f83ea8 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 12 Apr 2017 08:00:40 -0600 Subject: [PATCH 0013/1973] Rename chapters --- .../CLM50_Tech_Note_BVOCs.rst} | 2 +- .../CLM50_Tech_Note_CN_Allocation.rst} | 98 +-- .../CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 4 + .../CLM50_Tech_Note_Crop_Irrigation.rst} | 24 +- .../CLM50_Tech_Note_DGVM.rst} | 0 .../CLM50_Tech_Note_Decomposition.rst} | 114 ++-- .../CLM50_Tech_Note_Dust.rst} | 20 +- .../CLM50_Tech_Note_Ecosystem.rst} | 0 ...M50_Tech_Note_External_Nitrogen_Cycle.rst} | 36 +- .../tech_note/FUN/CLM50_Tech_Note_FUN.rst | 4 + .../CLM50_Tech_Note_Fire.rst} | 64 +- .../CLM50_Tech_Note_Fluxes.rst} | 0 .../CLM50_Tech_Note_Glacier.rst} | 0 .../CLM50_Tech_Note_Hydrology.rst} | 0 .../CLM50_Tech_Note_Introduction.rst} | 0 .../CLM50_Tech_Note_Isotopes.rst} | 20 +- .../CLM50_Tech_Note_Lake.rst} | 84 +-- .../CLM50_Tech_Note_Methane.rst} | 26 +- .../CLM50_Tech_Note_Offline.rst} | 26 +- .../CLM50_Tech_Note_Photosynthesis.rst} | 58 +- ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 4 + ...CLM50_Tech_Note_Plant_Hydraulic_Stress.rst | 4 + .../CLM50_Tech_Note_Plant_Mortality.rst} | 172 ++--- .../CLM50_Tech_Note_Plant_Respiration.rst | 601 ++++++++++++++++++ .../CLM50_Tech_Note_RTM.rst} | 18 +- .../CLM50_Tech_Note_Radiative_Fluxes.rst} | 0 .../CLM50_Tech_Note_References.rst} | 0 .../CLM50_Tech_Note_Snow_Hydrology.rst | 4 + ...LM50_Tech_Note_Soil_Snow_Temperatures.rst} | 0 .../CLM50_Tech_Note_Surface_Albedos.rst} | 0 .../CLM50_Tech_Note_Transient_Landcover.rst} | 14 +- .../CLM50_Tech_Note_Urban.rst} | 0 ...ch_Note_Vegetation_Phenology_Turnover.rst} | 184 +++--- doc/source/tech_note/index.rst | 59 +- 34 files changed, 1133 insertions(+), 507 deletions(-) rename doc/source/tech_note/{CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst => BVOCs/CLM50_Tech_Note_BVOCs.rst} (99%) rename doc/source/tech_note/{CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst => CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst} (96%) create mode 100644 doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst rename doc/source/tech_note/{CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst => Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst} (99%) rename doc/source/tech_note/{CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst => DGVM/CLM50_Tech_Note_DGVM.rst} (100%) rename doc/source/tech_note/{CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst => Decomposition/CLM50_Tech_Note_Decomposition.rst} (97%) rename doc/source/tech_note/{CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst => Dust/CLM50_Tech_Note_Dust.rst} (98%) rename doc/source/tech_note/{CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst => Ecosystem/CLM50_Tech_Note_Ecosystem.rst} (100%) rename doc/source/tech_note/{CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst => External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst} (98%) create mode 100644 doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst rename doc/source/tech_note/{CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst => Fire/CLM50_Tech_Note_Fire.rst} (98%) rename doc/source/tech_note/{CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst => Fluxes/CLM50_Tech_Note_Fluxes.rst} (100%) rename doc/source/tech_note/{CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst => Glacier/CLM50_Tech_Note_Glacier.rst} (100%) rename doc/source/tech_note/{CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst => Hydrology/CLM50_Tech_Note_Hydrology.rst} (100%) rename doc/source/tech_note/{CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst => Introduction/CLM50_Tech_Note_Introduction.rst} (100%) rename doc/source/tech_note/{CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst => Isotopes/CLM50_Tech_Note_Isotopes.rst} (98%) rename doc/source/tech_note/{CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst => Lake/CLM50_Tech_Note_Lake.rst} (98%) rename doc/source/tech_note/{CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst => Methane/CLM50_Tech_Note_Methane.rst} (99%) rename doc/source/tech_note/{CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst => Offline/CLM50_Tech_Note_Offline.rst} (97%) rename doc/source/tech_note/{CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst => Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst} (98%) create mode 100644 doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst create mode 100644 doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst rename doc/source/tech_note/{CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst => Plant_Mortality/CLM50_Tech_Note_Plant_Mortality.rst} (86%) create mode 100644 doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst rename doc/source/tech_note/{CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst => RTM/CLM50_Tech_Note_RTM.rst} (97%) rename doc/source/tech_note/{CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst => Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst} (100%) rename doc/source/tech_note/{CHAPTER_27/CLM50_Tech_Note_Chpt_27_References.rst => References/CLM50_Tech_Note_References.rst} (100%) create mode 100644 doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst rename doc/source/tech_note/{CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst => Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst} (100%) rename doc/source/tech_note/{CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst => Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst} (100%) rename doc/source/tech_note/{CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst => Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst} (99%) rename doc/source/tech_note/{CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst => Urban/CLM50_Tech_Note_Urban.rst} (100%) rename doc/source/tech_note/{CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst => Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst} (94%) diff --git a/doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst b/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst similarity index 99% rename from doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst rename to doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst index bd8259e57c..8c5737f171 100644 --- a/doc/source/tech_note/CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst +++ b/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst @@ -50,7 +50,7 @@ some monoterpenes, VOCs and acetone). The activity factor for the light response of emissions is therefore estimated as: .. math:: - :label: 23.2) + :label: 28.2) \gamma _{P,\, i} =\left(1-LDF_{i} \right)+\gamma _{P\_ LDF} LDF_{i} diff --git a/doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst similarity index 96% rename from doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst rename to doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 4512d906c4..c6a6fa4aa0 100644 --- a/doc/source/tech_note/CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -1,7 +1,7 @@ -.. _rst_Carbon and Nitrogen Pools, Allocation, and Respiration: +.. _rst_CN Allocation: -Carbon and Nitrogen Pools, Allocation, and Respiration -========================================================== +Carbon and Nitrogen Allocation +============================== Introduction ----------------- @@ -76,17 +76,17 @@ photosynthesis ( :math:`CF_{xs,mr}`, gC m\ :sup:`-2` s\ :sup:`-1`): .. math:: - :label: 13.1) + :label: 19.1) CF_{mr} =CF_{GPP,mr} +CF_{xs,mr} .. math:: - :label: 13.2) + :label: 19.2) CF_{GPP,mr} =\_ \left\{\begin{array}{l} {CF_{mr} \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. .. math:: - :label: 13.3) + :label: 19.3) CF_{xs,mr} =\_ \left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{mr} -CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. @@ -110,12 +110,12 @@ flux to :math:`CS_{xs}` (:math:`CF_{GPP,xs}`, gC m\ :sup:`-2` s\ :sup:`-1`) is given as .. math:: - :label: 13.4) + :label: 19.4) CF_{GPP,xs,pot} =\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CS_{xs} \ge 0} \\ {-CS_{xs} /(86400\tau _{xs} )\qquad {\rm for\; }CS_{xs} <0} \end{array}\right. .. math:: - :label: 13.5) + :label: 19.5) CF_{GPP,xs} =\left\{\begin{array}{l} {CF_{GPP,xs,pot} \qquad \qquad \qquad {\rm for\; }CF_{GPP,xs,pot} \le CF_{GPPpot} -CF_{GPP,mr} } \\ {\max (CF_{GPPpot} -CF_{GPP,mr} ,0)\qquad {\rm for\; }CF_{GPP,xs,pot} >CF_{GPPpot} -CF_{GPP,mr} } \end{array}\right. @@ -136,7 +136,7 @@ remaining carbon flux from photosynthesis which can be allocated to new growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 13.6) + :label: 19.6) CF_{avail\_ alloc} =CF_{GPPpot} -CF_{GPP,mr} -CF_{GPP,xs} . @@ -162,7 +162,7 @@ ratio for carbon allocation between new stem and new leaf increases with increasing net primary production (NPP), as .. math:: - :label: 13.8) + :label: 19.8) a_{3} =\frac{2.7}{1+e^{-0.004NPP_{ann} -300} } -0.4 @@ -252,12 +252,12 @@ m\ :sup:`-2` s\ :sup:`-1`): where .. math:: - :label: 13.11) + :label: 19.11) \begin{array}{l} {C_{allom} =\left\{\begin{array}{l} {\left(1+g_{1} \right)\left(1+a_{1} +a_{3} \left(1+a_{2} \right)\right)\qquad {\rm for\; woody\; PFT}} \\ {1+g_{1} +a_{1} \left(1+g_{1} \right)\qquad \qquad {\rm for\; non-woody\; PFT}} \end{array}\right. } \\ {} \end{array} .. math:: - :label: 13.12) + :label: 19.12) N_{allom} =\left\{\begin{array}{l} {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } +\frac{a_{3} a_{4} \left(1+a_{2} \right)}{CN_{lw} } +} \\ {\qquad \frac{a_{3} \left(1-a_{4} \right)\left(1+a_{2} \right)}{CN_{dw} } \qquad {\rm for\; woody\; PFT}} \\ {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } \qquad \qquad \qquad {\rm for\; non-woody\; PFT.}} \end{array}\right. @@ -268,7 +268,7 @@ plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, gN m\ :sup:`-2` s\ :sup:`-1`) as: .. math:: - :label: 13.13) + :label: 19.13) NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . @@ -287,7 +287,7 @@ availability of nitrogen from this pool to support new growth s\ :sup:`-1`) is proportional to the plant nitrogen demand, as: .. math:: - :label: 13.14) + :label: 19.14) NF_{avail\_ retrans} =\min \left(\frac{NF_{retrans\_ ann} \frac{NF_{plant\_ demand} }{NF_{plant\_ demand\_ ann} } }{\Delta t} ,\; \frac{NS_{retrans} }{\Delta t} \right) @@ -313,7 +313,7 @@ m\ :sup:`-2` s\ :sup:`-1`) is never greater than the plant demand for new nitrogen: .. math:: - :label: 13.15) + :label: 19.15) NF_{retrans,alloc} =\min \left(NF_{plant\_ demand} ,NF_{avail\_ retrans} \right) @@ -340,7 +340,7 @@ mineral nitrogen supply and competition with heterotrophs. Plant uptake from the soil mineral nitrogen pool is then given as: .. math:: - :label: 13.17) + :label: 19.17) NF_{sminn,alloc} =NF_{plant\_ demand\_ soil} f_{plant\_ demand} @@ -350,7 +350,7 @@ Final carbon and nitrogen allocation The total flux of allocated nitrogen is given as: .. math:: - :label: 13.18) + :label: 19.18) NF_{alloc} =NF_{retrans,alloc} +NF_{sminn,alloc} @@ -358,14 +358,14 @@ From the stoichiometric relationship in Eq. , the associated carbon allocation flux is: .. math:: - :label: 13.19) + :label: 19.19) CF_{alloc} =NF_{alloc} \frac{C_{allom} }{N_{allom} } . The downregulation of photosynthesis can then be calculated as: .. math:: - :label: 13.20) + :label: 19.20) f_{dreg} =\frac{CF_{alloc} -CF_{avail\_ alloc} }{CF_{GPPpot} } . @@ -373,7 +373,7 @@ Total allocation to new leaf carbon (:math:`CF_{alloc,leaf\_tot}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as: .. math:: - :label: 13.21) + :label: 19.21) CF_{alloc,leaf\_ tot} =\frac{CF_{alloc} }{C_{allom} } . @@ -389,124 +389,124 @@ storage pools (where storage is indicated with *\_stor*) for the various tissue types are given as: .. math:: - :label: 13.22) + :label: 19.22) CF_{alloc,leaf} \_ =CF_{alloc,leaf\_ tot} f_{cur} .. math:: - :label: 13.23) + :label: 19.23) CF_{alloc,leaf\_ stor} \_ =CF_{alloc,leaf\_ tot} \left(1-f_{cur} \right) .. math:: - :label: 13.24) + :label: 19.24) CF_{alloc,froot} \_ =CF_{alloc,leaf\_ tot} a_{1} f_{cur} .. math:: - :label: 13.25) + :label: 19.25) CF_{alloc,froot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{1} \left(1-f_{cur} \right) .. math:: - :label: 13.26) + :label: 19.26) CF_{alloc,livestem} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} f_{cur} .. math:: - :label: 13.27) + :label: 19.27) CF_{alloc,livestem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} \left(1-f_{cur} \right) .. math:: - :label: 13.28) + :label: 19.28) CF_{alloc,deadstem} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)f_{cur} .. math:: - :label: 13.29) + :label: 19.29) CF_{alloc,deadstem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right) .. math:: - :label: 13.30) + :label: 19.30) CF_{alloc,livecroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} f_{cur} .. math:: - :label: 13.31) + :label: 19.31) CF_{alloc,livecroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} \left(1-f_{cur} \right) .. math:: - :label: 13.32) + :label: 19.32) CF_{alloc,deadcroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)f_{cur} .. math:: - :label: 13.33) + :label: 19.33) CF_{alloc,deadcroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). The corresponding nitrogen allocation fluxes are given as: .. math:: - :label: 13.34) + :label: 19.34) NF_{alloc,leaf} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } f_{cur} .. math:: - :label: 13.35) + :label: 19.35) NF_{alloc,leaf\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } \left(1-f_{cur} \right) .. math:: - :label: 13.36) + :label: 19.36) NF_{alloc,froot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } f_{cur} .. math:: - :label: 13.37) + :label: 19.37) NF_{alloc,froot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } \left(1-f_{cur} \right) .. math:: - :label: 13.38) + :label: 19.38) NF_{alloc,livestem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } f_{cur} .. math:: - :label: 13.39) + :label: 19.39) NF_{alloc,livestem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) .. math:: - :label: 13.40) + :label: 19.40) NF_{alloc,deadstem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} .. math:: - :label: 13.41) + :label: 19.41) NF_{alloc,deadstem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right) .. math:: - :label: 13.42) + :label: 19.42) NF_{alloc,livecroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } f_{cur} .. math:: - :label: 13.43) + :label: 19.43) NF_{alloc,livecroot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) .. math:: - :label: 13.44) + :label: 19.44) NF_{alloc,deadcroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} .. math:: - :label: 13.45) + :label: 19.45) NF_{alloc,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). @@ -530,22 +530,22 @@ functions tissue nitrogen content and the relevant temperature, following the empirical relationship reported by Ryan (1991): .. math:: - :label: 13.46) + :label: 19.46) CF_{mr\_ leaf} \_ =NS_{leaf} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} .. math:: - :label: 13.47) + :label: 19.47) CF_{mr\_ livestem} \_ =NS_{livestem} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} .. math:: - :label: 13.48) + :label: 19.48) CF_{mr\_ livecroot} \_ =NS_{livecroot} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} .. math:: - :label: 13.49) + :label: 19.49) CF_{mr\_ froot} \_ =\sum _{j=1}^{nlevsoi}NS_{froot} rootfr_{j} MR_{base} MR_{Q10} ^{(Ts_{j} -20)/10} @@ -568,7 +568,7 @@ common base maintenance respiration rate for all live tissue types. The total maintenance respiration cost is then given as: .. math:: - :label: 13.50) + :label: 19.50) CF_{mr} =CF_{mr\_ leaf} +CF_{mr\_ froot} +CF_{mr\_ livestem} +CF_{mr\_ livecroot} . diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst new file mode 100644 index 0000000000..92903f02e0 --- /dev/null +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -0,0 +1,4 @@ +.. _rst_CN Pools: + +CN Pools +=================== diff --git a/doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst similarity index 99% rename from doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst rename to doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 9d2aeb71f4..80cd1e3527 100644 --- a/doc/source/tech_note/CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -155,7 +155,7 @@ for the crop to reach vegetative and physiological maturity, :math:`{GDD}_{mat}`, according to the following AgroIBIS rules: .. math:: - :label: 20.2) + :label: 25.2) \begin{array}{l} {GDD_{{\rm mat}}^{{\rm corn}} =0.85GDD_{{\rm 8}} {\rm \; \; \; and\; \; \; 950}30} \end{array}\right\} .. math:: - :label: 20.13) + :label: 25.13) fxg=\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad \qquad {\rm for\; }GDD_{T_{2m} } \le 0.15} \\ {6.67\times GDD_{T_{2m} } -1\qquad \qquad \qquad {\rm for\; }0.150.75} \end{array}\right\} @@ -646,17 +646,17 @@ mobilized depends on the C:N ratio of the plant tissue, and is calculated as .. math:: - :label: 20.14) + :label: 25.14) leaf\_ to\_ retransn=\frac{c_{leaf} }{CN_{leaf} } -\frac{c_{leaf} }{CN_{leaf}^{f} } .. math:: - :label: 20.15) + :label: 25.15) stemn\_ to\_ retransn=\frac{c_{stem} }{CN_{stem} } -\frac{c_{stem} }{CN_{stem}^{f} } .. math:: - :label: 20.16) + :label: 25.16) frootn\_ to\_ retransn=\frac{c_{froot} }{CN_{froot} } -\frac{c_{froot} }{CN_{froot}^{f} } diff --git a/doc/source/tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst rename to doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst diff --git a/doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst similarity index 97% rename from doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst rename to doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index 34a71b2b24..4686f649c2 100644 --- a/doc/source/tech_note/CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -29,7 +29,7 @@ For the single-level model structure, the fundamental equation for carbon balance of the decomposing pools is: .. math:: - :label: 15.1) + :label: 21.1) \frac{\partial C_{i} }{\partial t} =R_{i} +\sum _{j\ne i}\left(i-r_{j} \right)T_{ji} k_{j} C_{j} -k_{i} C_{i} @@ -44,7 +44,7 @@ Adding the vertical dimension to the decomposing pools changes the balance equation to the following: .. math:: - :label: 15.2) + :label: 21.2) \begin{array}{l} {\frac{\partial C_{i} (z)}{\partial t} =R_{i} (z)+\sum _{i\ne j}\left(1-r_{j} \right)T_{ji} k_{j} (z)C_{j} (z) -k_{i} (z)C_{i} (z)} \\ {+\frac{\partial }{\partial z} \left(D(z)\frac{\partial C_{i} }{\partial z} \right)+\frac{\partial }{\partial z} \left(A(z)C_{i} \right)} \end{array} @@ -245,7 +245,7 @@ The Temperature scalar :math:`{r}_{tsoil}` is calculated in CLM using a :math:`{Q}_{10}` approach, with :math:`{Q}_{10} = 1.5`. .. math:: - :label: 15.5) + :label: 21.5) r_{tsoil} =Q_{10} ^{\left(\frac{T_{soil,\, j} -T_{ref} }{10} \right)} @@ -257,7 +257,7 @@ unitless) is calculated using a relationship from Andrén and Paustian (1987) and supported by additional data in Orchard and Cook (1983): .. math:: - :label: 15.6) + :label: 21.6) r_{water} =\sum _{j=1}^{5}\left\{\begin{array}{l} {0\qquad {\rm for\; }\Psi _{j} <\Psi _{\min } } \\ {\frac{\log \left({\Psi _{\min } \mathord{\left/ {\vphantom {\Psi _{\min } \Psi _{j} }} \right. \kern-\nulldelimiterspace} \Psi _{j} } \right)}{\log \left({\Psi _{\min } \mathord{\left/ {\vphantom {\Psi _{\min } \Psi _{\max } }} \right. \kern-\nulldelimiterspace} \Psi _{\max } } \right)} w_{soil,\, j} \qquad {\rm for\; }\Psi _{\min } \le \Psi _{j} \le \Psi _{\max } } \\ {1\qquad {\rm for\; }\Psi _{j} >\Psi _{\max } \qquad \qquad } \end{array}\right\} @@ -268,7 +268,7 @@ water potential control on decomposition rate (set to -10 MPa). potential, calculated using the multivariate regression model from Cosby et al. (1984): .. math:: - :label: 15.7) + :label: 21.7) \Psi _{sat,\, j} =-\left(9.8e-5\right)\exp \left(\left(1.54-0.0095P_{sand,\, j} +0.0063\left(100-P_{sand,\, j} -P_{clay,\, j} \right)\right)\log \left(10\right)\right) @@ -281,7 +281,7 @@ potential is limited by temperature in the supercooled water formulation of Niu and Yang (2006), .. math:: - :label: 15.8) + :label: 21.8) \psi \left(T\right)=-\frac{L_{f} \left(T-T_{f} \right)}{10^{3} T} @@ -319,7 +319,7 @@ includes these unresolved depth controls via an exponential decrease in the soil turnover time with depth: .. math:: - :label: 15.9) + :label: 21.9) r_{depth} =\exp \left(-\frac{z}{z_{\tau } } \right) @@ -328,7 +328,7 @@ where :math:`{z}_{\tau}` is the e-folding depth for decomposition, set by defaul The combined decomposition rate scalar (:math:`{r}_{total}`,unitless) is: .. math:: - :label: 15.10) + :label: 21.10) r_{total} =r_{tsoil} r_{water} r_{oxygen} r_{depth} . @@ -345,7 +345,7 @@ The potential carbon flux out of the upstream pool (:math:`{CF}_{pot,u}`, gC m\ :sup:`-2` s\ :sup:`-1`) is: .. math:: - :label: 15.11) + :label: 21.11) CF_{pot,\, u} =CS_{u} k_{u} @@ -361,7 +361,7 @@ mineral nitrogen (Thornton and Rosenbloom, 2005) is: .. math:: - :label: 15.12) + :label: 21.12) NF_{pot\_ min,\, u\to d} =\frac{CF_{pot,\, u} \left(1-rf_{u} -\frac{CN_{d} }{CN_{u} } \right)}{CN_{d} } @@ -379,37 +379,37 @@ individual pools in the decomposition cascade, for the example of the CLM-CN pool structure, are given as: .. math:: - :label: 15.13) + :label: 21.13) CF_{pot,\, Lit1} ={CS_{Lit1} k_{Lit1} r_{total} \mathord{\left/ {\vphantom {CS_{Lit1} k_{Lit1} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: - :label: 15.14) + :label: 21.14) CF_{pot,\, Lit2} ={CS_{Lit2} k_{Lit2} r_{total} \mathord{\left/ {\vphantom {CS_{Lit2} k_{Lit2} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: - :label: 15.15) + :label: 21.15) CF_{pot,\, Lit3} ={CS_{Lit3} k_{Lit3} r_{total} \mathord{\left/ {\vphantom {CS_{Lit3} k_{Lit3} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: - :label: 15.16) + :label: 21.16) CF_{pot,\, SOM1} ={CS_{SOM1} k_{SOM1} r_{total} \mathord{\left/ {\vphantom {CS_{SOM1} k_{SOM1} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: - :label: 15.17) + :label: 21.17) CF_{pot,\, SOM2} ={CS_{SOM2} k_{SOM2} r_{total} \mathord{\left/ {\vphantom {CS_{SOM2} k_{SOM2} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: - :label: 15.18) + :label: 21.18) CF_{pot,\, SOM3} ={CS_{SOM3} k_{SOM3} r_{total} \mathord{\left/ {\vphantom {CS_{SOM3} k_{SOM3} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} .. math:: - :label: 15.19) + :label: 21.19) CF_{pot,\, SOM4} ={CS_{SOM4} k_{SOM4} r_{total} \mathord{\left/ {\vphantom {CS_{SOM4} k_{SOM4} r_{total} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} @@ -426,27 +426,27 @@ structure will be similar but without the different terminal step): NF_{pot\_ min,\, Lit1\to SOM1} ={CF_{pot,\, Lit1} \left(1-rf_{Lit1} -\frac{CN_{SOM1} }{CN_{Lit1} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit1} \left(1-rf_{Lit1} -\frac{CN_{SOM1} }{CN_{Lit1} } \right) CN_{SOM1} }} \right. \kern-\nulldelimiterspace} CN_{SOM1} } .. math:: - :label: 15.21) + :label: 21.21) NF_{pot\_ min,\, Lit2\to SOM2} ={CF_{pot,\, Lit2} \left(1-rf_{Lit2} -\frac{CN_{SOM2} }{CN_{Lit2} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit2} \left(1-rf_{Lit2} -\frac{CN_{SOM2} }{CN_{Lit2} } \right) CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } .. math:: - :label: 15.22) + :label: 21.22) NF_{pot\_ min,\, Lit3\to SOM3} ={CF_{pot,\, Lit3} \left(1-rf_{Lit3} -\frac{CN_{SOM3} }{CN_{Lit3} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, Lit3} \left(1-rf_{Lit3} -\frac{CN_{SOM3} }{CN_{Lit3} } \right) CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } .. math:: - :label: 15.23) + :label: 21.23) NF_{pot\_ min,\, SOM1\to SOM2} ={CF_{pot,\, SOM1} \left(1-rf_{SOM1} -\frac{CN_{SOM2} }{CN_{SOM1} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM1} \left(1-rf_{SOM1} -\frac{CN_{SOM2} }{CN_{SOM1} } \right) CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } .. math:: - :label: 15.24) + :label: 21.24) NF_{pot\_ min,\, SOM2\to SOM3} ={CF_{pot,\, SOM2} \left(1-rf_{SOM2} -\frac{CN_{SOM3} }{CN_{SOM2} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM2} \left(1-rf_{SOM2} -\frac{CN_{SOM3} }{CN_{SOM2} } \right) CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } .. math:: - :label: 15.25) + :label: 21.25) NF_{pot\_ min,\, SOM3\to SOM4} ={CF_{pot,\, SOM3} \left(1-rf_{SOM3} -\frac{CN_{SOM4} }{CN_{SOM3} } \right)\mathord{\left/ {\vphantom {CF_{pot,\, SOM3} \left(1-rf_{SOM3} -\frac{CN_{SOM4} }{CN_{SOM3} } \right) CN_{SOM4} }} \right. \kern-\nulldelimiterspace} CN_{SOM4} } @@ -487,7 +487,7 @@ beginning of the timestep is considered the available supply. Total demand for mineral nitrogen from this pool (:math:`{NF}_{total\_demand}`, gN m\ :sup:`-2` s\ :sup:`-1`) is: .. math:: - :label: 15.27) + :label: 21.27) NF_{total\_ demand} =NF_{immob\_ demand} +NF_{plant\_ demand\_ soil} @@ -511,7 +511,7 @@ lower-than-potential rates, defined by the fractions where: .. math:: - :label: 15.28) + :label: 21.28) f_{plant\_ demand} =f_{immob\_ demand} =\frac{NS_{sminn} }{\Delta t\, NF_{total\_ demand} } @@ -532,37 +532,37 @@ CENTURY structure will be similar but, again without the different terminal step), are calculated as: .. math:: - :label: 15.29) + :label: 21.29) CF_{Lit1} =\left\{\begin{array}{l} {CF_{pot,\, Lit1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} >0} \\ {CF_{pot,\, Lit1} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} \le 0} \end{array}\right\} .. math:: - :label: 15.30) + :label: 21.30) CF_{Lit2} =\left\{\begin{array}{l} {CF_{pot,\, Lit2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} >0} \\ {CF_{pot,\, Lit2} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} \le 0} \end{array}\right\} .. math:: - :label: 15.31) + :label: 21.31) CF_{Lit3} =\left\{\begin{array}{l} {CF_{pot,\, Lit3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} >0} \\ {CF_{pot,\, Lit3} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} \le 0} \end{array}\right\} .. math:: - :label: 15.32) + :label: 21.32) CF_{SOM1} =\left\{\begin{array}{l} {CF_{pot,\, SOM1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} >0} \\ {CF_{pot,\, SOM1} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} \le 0} \end{array}\right\} .. math:: - :label: 15.33) + :label: 21.33) CF_{SOM2} =\left\{\begin{array}{l} {CF_{pot,\, SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} >0} \\ {CF_{pot,\, SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} \le 0} \end{array}\right\} .. math:: - :label: 15.34) + :label: 21.34) CF_{SOM3} =\left\{\begin{array}{l} {CF_{pot,\, SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} >0} \\ {CF_{pot,\, SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} \le 0} \end{array}\right\} .. math:: - :label: 15.35) + :label: 21.35) CF_{SOM4} =CF_{pot,\, SOM4} @@ -570,37 +570,37 @@ Heterotrophic respiration fluxes (losses of carbon as CO\ :sub:`2` to the atmosphere) are: .. math:: - :label: 15.36) + :label: 21.36) CF_{Lit1,\, HR} =CF_{Lit1} rf_{Lit1} .. math:: - :label: 15.37) + :label: 21.37) CF_{Lit2,\, HR} =CF_{Lit2} rf_{Lit2} .. math:: - :label: 15.38) + :label: 21.38) CF_{Lit3,\, HR} =CF_{Lit3} rf_{Lit3} .. math:: - :label: 15.39) + :label: 21.39) CF_{SOM1,\, HR} =CF_{SOM1} rf_{SOM1} .. math:: - :label: 15.40) + :label: 21.40) CF_{SOM2,\, HR} =CF_{SOM2} rf_{SOM2} .. math:: - :label: 15.41) + :label: 21.41) CF_{SOM3,\, HR} =CF_{SOM3} rf_{SOM3} .. math:: - :label: 15.42) + :label: 21.42) CF_{SOM4,\, HR} =CF_{SOM4} rf_{SOM4} @@ -608,32 +608,32 @@ Transfers of carbon from upstream to downstream pools in the decomposition cascade are given as: .. math:: - :label: 15.43) + :label: 21.43) CF_{Lit1,\, SOM1} =CF_{Lit1} \left(1-rf_{Lit1} \right) .. math:: - :label: 15.44) + :label: 21.44) CF_{Lit2,\, SOM2} =CF_{Lit2} \left(1-rf_{Lit2} \right) .. math:: - :label: 15.45) + :label: 21.45) CF_{Lit3,\, SOM3} =CF_{Lit3} \left(1-rf_{Lit3} \right) .. math:: - :label: 15.46) + :label: 21.46) CF_{SOM1,\, SOM2} =CF_{SOM1} \left(1-rf_{SOM1} \right) .. math:: - :label: 15.47) + :label: 21.47) CF_{SOM2,\, SOM3} =CF_{SOM2} \left(1-rf_{SOM2} \right) .. math:: - :label: 15.48) + :label: 21.48) CF_{SOM3,\, SOM4} =CF_{SOM3} \left(1-rf_{SOM3} \right) @@ -647,32 +647,32 @@ or from the downstream pool to the soil mineral nitrogen pool pools in the decomposition cascade are given as: .. math:: - :label: 15.49) + :label: 21.49) NF_{Lit1,\, SOM1} ={CF_{Lit1} \mathord{\left/ {\vphantom {CF_{Lit1} CN_{Lit1} }} \right. \kern-\nulldelimiterspace} CN_{Lit1} } .. math:: - :label: 15.50) + :label: 21.50) NF_{Lit2,\, SOM2} ={CF_{Lit2} \mathord{\left/ {\vphantom {CF_{Lit2} CN_{Lit2} }} \right. \kern-\nulldelimiterspace} CN_{Lit2} } .. math:: - :label: 15.51) + :label: 21.51) NF_{Lit3,\, SOM3} ={CF_{Lit3} \mathord{\left/ {\vphantom {CF_{Lit3} CN_{Lit3} }} \right. \kern-\nulldelimiterspace} CN_{Lit3} } .. math:: - :label: 15.52) + :label: 21.52) NF_{SOM1,\, SOM2} ={CF_{SOM1} \mathord{\left/ {\vphantom {CF_{SOM1} CN_{SOM1} }} \right. \kern-\nulldelimiterspace} CN_{SOM1} } .. math:: - :label: 15.53) + :label: 21.53) NF_{SOM2,\, SOM3} ={CF_{SOM2} \mathord{\left/ {\vphantom {CF_{SOM2} CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } .. math:: - :label: 15.54) + :label: 21.54) NF_{SOM3,\, SOM4} ={CF_{SOM3} \mathord{\left/ {\vphantom {CF_{SOM3} CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } @@ -681,37 +681,37 @@ whether the decomposition step is an immobilization flux or a mineralization flux: .. math:: - :label: 15.55) + :label: 21.55) NF_{sminn,\, Lit1\to SOM1} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit1\to SOM1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} >0} \\ {NF_{pot\_ min,\, Lit1\to SOM1} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} \le 0} \end{array}\right\} .. math:: - :label: 15.56) + :label: 21.56) NF_{sminn,\, Lit2\to SOM2} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit2\to SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} >0} \\ {NF_{pot\_ min,\, Lit2\to SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} \le 0} \end{array}\right\} .. math:: - :label: 15.57) + :label: 21.57) NF_{sminn,\, Lit3\to SOM3} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit3\to SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} >0} \\ {NF_{pot\_ min,\, Lit3\to SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} \le 0} \end{array}\right\} .. math:: - :label: 15.58) + :label: 21.58) NF_{sminn,SOM1\to SOM2} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM1\to SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} >0} \\ {NF_{pot\_ min,\, SOM1\to SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} \le 0} \end{array}\right\} .. math:: - :label: 15.59) + :label: 21.59) NF_{sminn,SOM2\to SOM3} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM2\to SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} >0} \\ {NF_{pot\_ min,\, SOM2\to SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} \le 0} \end{array}\right\} .. math:: - :label: 15.60) + :label: 21.60) NF_{sminn,SOM3\to SOM4} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM3\to SOM4} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} >0} \\ {NF_{pot\_ min,\, SOM3\to SOM4} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} \le 0} \end{array}\right\} .. math:: - :label: 15.61) + :label: 21.61) NF_{sminn,\, SOM4} =NF_{pot\_ min,\, SOM4} diff --git a/doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst b/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst similarity index 98% rename from doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst rename to doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst index 8126f09774..381367a4c0 100644 --- a/doc/source/tech_note/CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst +++ b/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst @@ -30,7 +30,7 @@ The grid cell fraction of exposed bare soil suitable for dust mobilization :math:`f_{m}` is given by .. math:: - :label: 24.2) + :label: 29.2) f_{m} =\left(1-f_{lake} -f_{wetl} \right)\left(1-f_{sno} \right)\left(1-f_{v} \right)\frac{w_{liq,1} }{w_{liq,1} +w_{ice,1} } @@ -62,7 +62,7 @@ The sandblasting mass efficiency :math:`\alpha` (m:sup:`-1`) is calculated as .. math:: - :label: 24.4) + :label: 29.4) \alpha =100e^{\left(13.4M_{clay} -6.0\right)\ln 10} {\rm \; \; }\left\{\begin{array}{l} {M_{clay} =\% clay\times 0.01{\rm \; \; \; 0}\le \% clay\le 20} \\ {M_{clay} =20\times 0.01{\rm \; \; \; \; \; \; \; \; 20<\% }clay\le 100} \end{array}\right. @@ -98,21 +98,21 @@ diameter (75 x 10\ :math:`{}^{-6}` m) of optimal saltation particles, and :math:`f_{w}` is a factor dependent on soil moisture: .. math:: - :label: 24.7) + :label: 29.7) f_{w} =\left\{\begin{array}{l} {1{\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; }w\le w_{t} } \\ {\sqrt{1+1.21\left[100\left(w-w_{t} \right)\right]^{0.68} } {\rm \; \; for\; }w>w_{t} } \end{array}\right. where .. math:: - :label: 24.8) + :label: 29.8) w_{t} =a\left(0.17M_{clay} +0.14M_{clay}^{2} \right){\rm \; \; \; \; \; \; 0}\le M_{clay} =\% clay\times 0.01\le 1 and .. math:: - :label: 24.9) + :label: 29.9) w=\frac{\theta _{1} \rho _{liq} }{\rho _{d,1} } @@ -127,7 +127,7 @@ in section 6.3 rather than as in Zender et al. (2003). factor .. math:: - :label: 24.10) + :label: 29.10) Re_{*t}^{f} =\left\{\begin{array}{l} {\frac{0.1291^{2} }{-1+1.928Re_{*t} } {\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; 0.03}\le Re_{*t} \le 10} \\ {0.12^{2} \left(1-0.0858e^{-0.0617(Re_{*t} -10)} \right)^{2} {\rm \; for\; }Re_{*t} >10} \end{array}\right. @@ -135,7 +135,7 @@ and :math:`Re_{*t}` is the threshold friction Reynolds number approximation for optimally sized particles .. math:: - :label: 24.11) + :label: 29.11) Re_{*t} =0.38+1331\left(100D_{osp} \right)^{1.56} @@ -143,7 +143,7 @@ In equation , :math:`u_{*s}` ** is defined as the wind friction speed (m s\ :sup:`-1`) accounting for the Owen effect (Owen 1964) .. math:: - :label: 24.12) + :label: 29.12) u_{\*s} =\left\{\begin{array}{l} {u_{\*} {\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; }U_{10} 0} \\ {-NF_{pot\_ min,Lit1\to SOM1} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit1\to SOM1} \le 0} \end{array}\right. .. math:: - :label: 16.3) + :label: 22.3) NF_{denit,Lit2\to SOM2} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit2\to SOM2} >0} \\ {-NF_{pot\_ min,Lit2\to SOM2} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit2\to SOM2} \le 0} \end{array}\right. .. math:: - :label: 16.4) + :label: 22.4) NF_{denit,Lit3\to SOM3} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit3\to SOM3} >0} \\ {-NF_{pot\_ min,Lit3\to SOM3} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit3\to SOM3} \le 0} \end{array}\right. .. math:: - :label: 16.5) + :label: 22.5) NF_{denit,SOM1\to SOM2} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM1\to SOM2} >0} \\ {-NF_{pot\_ min,SOM1\to SOM2} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM1\to SOM2} \le 0} \end{array}\right. .. math:: - :label: 16.6) + :label: 22.6) NF_{denit,SOM2\to SOM3} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM2\to SOM3} >0} \\ {-NF_{pot\_ min,SOM2\to SOM3} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM2\to SOM3} \le 0} \end{array}\right. .. math:: - :label: 16.7) + :label: 22.7) NF_{denit,SOM3\to SOM4} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM3\to SOM4} >0} \\ {-NF_{pot\_ min,SOM3\to SOM4} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM3\to SOM4} \le 0} \end{array}\right. .. math:: - :label: 16.8) + :label: 22.8) NF_{denit,SOM4} =-NF_{pot\_ min,SOM4} @@ -214,7 +214,7 @@ pool. The denitrification of excess soil mineral nitrogen is non-zero whenever the supply of mineral nitrogen exceeds the demand: .. math:: - :label: 16.9) + :label: 22.9) NF_{sminn,denit} =\left\{\begin{array}{l} {\left(\frac{NS_{sminn} }{\Delta t} \right)-NF_{total\_ demand} f_{dnx} \qquad {\rm for\; }NF_{total\_ demand} \Delta tT_{f} } \\ {0\qquad T_{g} \le T_{f} } \end{array}\right\} @@ -617,7 +617,7 @@ s\ :sup:`-1`) (eq. ) is used to evaluate :math:`w^{*}` and The CityplaceRichardson number is .. math:: - :label: 9.32) + :label: 12.32) R_{i} =\frac{-1+\sqrt{1+\frac{40N^{2} k^{2} z_{i}^{2} }{w^{*^{2} } \exp \left(-2k^{*} z_{i} \right)} } }{20} @@ -638,7 +638,7 @@ Bartlein (1990)), eq. contains no negative sign; this is a correction from CLM4. The density of water is (Hostetler and Bartlein 1990) .. math:: - :label: 9.34) + :label: 12.34) \rho _{i} =1000\left(1-1.9549\times 10^{-5} \left|T_{i} -277\right|^{1.68} \right). @@ -658,7 +658,7 @@ The thermal conductivity for the liquid water portion of lake body layer given by .. math:: - :label: 9.36) + :label: 12.36) \tau _{liq,i} =K_{W} c_{liq} \rho _{liq} . @@ -667,7 +667,7 @@ The thermal conductivity of the ice portion of lake body layer *i*, constant among layers, and is given by .. math:: - :label: 9.37) + :label: 12.37) \tau _{ice,eff} =\tau _{ice} \frac{\rho _{ice} }{\rho _{liq} } @@ -682,7 +682,7 @@ and water fractions, assuming that they will be physically vertically stacked, and is given by .. math:: - :label: 9.38) + :label: 12.38) \tau _{i} =\frac{\tau _{ice,eff} \tau _{liq,i} }{\tau _{liq,i} I_{i} +\tau _{ice} \left(1-I_{i} \right)} . @@ -715,7 +715,7 @@ For unfrozen lakes, the solar radiation remaining at depth :math:`z>z_{a}` in the lake body is given by .. math:: - :label: 9.39) + :label: 12.39) \phi =\left(1-\beta \vec{S}_{g} \right)\exp \left\{-\eta \left(z-z_{a} \right)\right\} . @@ -723,7 +723,7 @@ For all lake body layers, the flux absorbed by the layer *i*, :math:`\phi _{i}` , is .. math:: - :label: 9.40) + :label: 12.40) \phi _{i} =\left(1-\beta \vec{S}_{g} \right)\left[\exp \left\{-\eta \left(z_{i} -\frac{\Delta z_{i} }{2} -z_{a} \right)\right\}-\exp \left\{-\eta \left(z_{i} +\frac{\Delta z_{i} }{2} -z_{a} \right)\right\}\right] . @@ -749,7 +749,7 @@ The vertically-integrated heat capacity for each lake layer, water and ice fractions: .. math:: - :label: 9.42) + :label: 12.42) c_{v,i} =\Delta z_{i} \rho _{liq} \left[c_{liq} \left(1-I_{i} \right)+c_{ice} I_{i} \right] . @@ -778,7 +778,7 @@ calculated as the harmonic mean of the conductivities of the neighboring layers: .. math:: - :label: 9.43) + :label: 12.43) \lambda _{i} =\frac{\tau _{i} \tau _{i+1} \left(z_{i+1} -z_{i} \right)}{\tau _{i} \left(z_{i+1} -\hat{z}_{i} \right)+\tau _{i+1} \left(\hat{z}_{i} -z_{i} \right)} , @@ -804,7 +804,7 @@ Eq. is solved using the semi-implicit Crank-Nicholson Method, resulting in a tridiagonal system of equations: .. math:: - :label: 9.45) + :label: 12.45) \begin{array}{l} {r_{i} =a_{i} T_{i-1}^{n+1} +b_{i} T_{i}^{n+1} +cT_{i+1}^{n+1} ,} \\ {a_{i} =-0.5\frac{\Delta t}{c_{v,i} } \frac{\partial F_{i-1} }{\partial T_{i-1}^{n} } ,} \\ {b_{i} =1+0.5\frac{\Delta t}{c_{v,i} } \left(\frac{\partial F_{i-1} }{\partial T_{i-1}^{n} } +\frac{\partial F_{i} }{\partial T_{i}^{n} } \right),} \\ {c_{i} =-0.5\frac{\Delta t}{c_{v,i} } \frac{\partial F_{i} }{\partial T_{i}^{n} } ,} \\ {r_{i} =T_{i}^{n} +0.5\frac{\Delta t}{c_{v,i} } \left(F_{i-1} -F_{i} \right)+\frac{\Delta t}{c_{v,i} } \phi _{i} .} \end{array} @@ -815,7 +815,7 @@ section 9.4.3 (the factor of 2 merely cancels out the Crank-Nicholson :math:`F_{N_{levlak} +N_{levgrnd} } =0`. For all other layers: .. math:: - :label: 9.46) + :label: 12.46) F_{i} =\lambda _{i} \frac{T_{i} ^{n} -T_{i+1}^{n} }{z_{n+1} -z_{n} } . @@ -843,7 +843,7 @@ section 9.5.6. The mass of melt in the layer *M* (kg m\ :sup:`-2`) is given by .. math:: - :label: 9.48) + :label: 12.48) M=\min \left\{M_{ice} ,\frac{Q_{avail} }{H_{fus} } \right\} @@ -874,7 +874,7 @@ If freezing occurs, :math:`Q_{avail}` is again given by but will be negative. The melt :math:`M`, also negative, is given by .. math:: - :label: 9.51) + :label: 12.51) M=\max \left\{-M_{liq} ,\frac{Q_{avail} }{H_{fus} } \right\} @@ -925,14 +925,14 @@ When this occurs, these two lake layers and all those above mix. Total enthalpy *Q* is conserved as .. math:: - :label: 9.52) + :label: 12.52) Q=\sum _{j=1}^{i+1}\Delta z_{j} \rho _{liq} \left(T_{j} -T_{f} \right)\left[\left(1-I_{j} \right)c_{liq} +I_{j} c_{ice} \right] . Once the average ice fraction :math:`I_{av}` is calculated from .. math:: - :label: 9.53) + :label: 12.53) \begin{array}{l} {I_{av} =\frac{\sum _{j=1}^{i+1}I_{j} \Delta z_{j} }{Z_{i+1} } ,} \\ {Z_{i+1} =\sum _{j=1}^{i+1}\Delta z_{j} ,} \end{array} @@ -950,7 +950,7 @@ If :math:`Q > 0`, then :math:`T_{froz} =T_{f}` , and :math:`T_{unfr}` is given by .. math:: - :label: 9.54) + :label: 12.54) T_{unfr} =\frac{Q}{\rho _{liq} Z_{i+1} \left[\left(1-I_{av} \right)c_{liq} \right]} +T_{f} . @@ -958,7 +958,7 @@ If :math:`Q < 0`, then :math:`T_{unfr} =T_{f}` , and :math:`T_{froz}` is given by .. math:: - :label: 9.55) + :label: 12.55) T_{froz} =\frac{Q}{\rho _{liq} Z_{i+1} \left[I_{av} c_{ice} \right]} +T_{f} . @@ -977,7 +977,7 @@ to *i* + 1, the ice fraction and temperature are set as follows, where by the heat capacity of the layer to yield .. math:: - :label: 9.56) + :label: 12.56) T_{j} =\frac{T_{froz} I_{j} c_{ice} +T_{unfr} \left(1-I_{j} \right)c_{liq} }{I_{j} c_{ice} +\left(1-I_{j} \right)c_{liq} } . @@ -991,7 +991,7 @@ re-written to yield the total enthalpy of the lake system (J m\ :sup:`-2`) :math:`H_{tot}` : .. math:: - :label: 9.57) + :label: 12.57) H_{tot} =\sum _{i=j_{top} }^{N_{levlak} +N_{levgrnd} }\left[c_{v,i} \left(T_{i} -T_{f} \right)+M_{liq,i} H_{fus} \right] -W_{sno,bulk} H_{fus} @@ -1004,7 +1004,7 @@ energy flux to yield the error flux :math:`E_{soi}` (W m\ :sup:`-2`): .. math:: - :label: 9.58) + :label: 12.58) E_{soi} =\frac{\Delta H_{tot} }{\Delta t} -G-\sum _{i=j_{top} }^{N_{levlak} +N_{levgrnd} }\phi _{i} @@ -1093,7 +1093,7 @@ water mass than it contains). If there are no resolved snow layers but given by .. math:: - :label: 9.60) + :label: 12.60) q_{sub,sno} =\min \left\{E_{g} ,\frac{W_{sno} }{\Delta t} \right\} . @@ -1109,7 +1109,7 @@ evaporation or dew deposition is balanced by :math:`q_{rgwl}` .) The snowpack is updated for frost and sublimation: .. math:: - :label: 9.61) + :label: 12.61) W_{sno} =W_{sno} +\Delta t\left(q_{frost} -q_{sub,sno} \right) . @@ -1127,7 +1127,7 @@ The combined water and ice soil volume fraction in a soil layer :math:`\theta _{i}` is given by .. math:: - :label: 9.62) + :label: 12.62) \theta _{i} =\frac{1}{\Delta z_{i} } \left(\frac{w_{ice,i} }{\rho _{ice} } +\frac{w_{liq,i} }{\rho _{liq} } \right) . @@ -1136,7 +1136,7 @@ saturation (as may occur when ice melts), then the liquid water mass is adjusted to .. math:: - :label: 9.63) + :label: 12.63) w_{liq,i} =\left(\theta _{sat,i} \Delta z_{i} -\frac{w_{ice,i} }{\rho _{ice} } \right)\rho _{liq} . @@ -1145,7 +1145,7 @@ Otherwise, if excess ice is melting and water in the layer is reset to .. math:: - :label: 9.64) + :label: 12.64) w_{liq,i} = \theta _{sat,i} \rho _{liq} \Delta z_{i} diff --git a/doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst similarity index 99% rename from doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst rename to doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst index fc71c600dd..6a29802004 100644 --- a/doc/source/tech_note/CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst +++ b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst @@ -137,7 +137,7 @@ The factor :math:`f_{pH}` is nominally set to 1, although a static spatial map of *pH* can be used to determine this factor (Dunfield et al. 1993) by applying: .. math:: - :label: 19.3) + :label: 24.3) f_{pH} =10^{-0.2235pH^{2} +2.7727pH-8.6} . @@ -154,7 +154,7 @@ anoxic microsites above the water table, we apply the Arah and Stephen (1998) estimate of anaerobic fraction: .. math:: - :label: 19.4) + :label: 24.4) \varphi =\frac{1}{1+\eta C_{O_{2} } } . @@ -219,7 +219,7 @@ the water table, by first estimating the Henry’s law partitioning coefficient (:math:`k_{h}^{C}` ) by the method described in Wania et al. (2010): .. math:: - :label: 19.5) + :label: 24.5) \log \left(\frac{1}{k_{H} } \right)=\log k_{H}^{s} -\frac{1}{C_{H} } \left(\frac{1}{T} -\frac{1}{T^{s} } \right) @@ -229,7 +229,7 @@ coefficient (:math:`k_{h}^{C}` ) by the method described in Wania et al. (2010): k_{h}^{C} =Tk_{H} R_{g} .. math:: - :label: 19.7) + :label: 24.7) C_{e} =\frac{C_{w} R_{g} T}{\theta _{s} k_{H}^{C} p} @@ -282,7 +282,7 @@ area index *L* (m:sup:`2` m\ :sup:`-2`), as in Wania et al. (2010): .. math:: - :label: 19.9) + :label: 24.9) T=\frac{f_{N} N_{a} L}{0.22} \pi R^{2} . @@ -304,7 +304,7 @@ and the CLM predicted transpiration (:math:`F_{T}` ) for each PFT, assuming that no methane was oxidized inside the plant tissue: .. math:: - :label: 19.10) + :label: 24.10) F_{CH_{4} -T} =\sum _{j}\rho _{r,j} F_{T} C_{CH_{4} ,j} . @@ -316,7 +316,7 @@ kinetics (Arah and Stephen 1998; Segers 1998), dependent on both the gaseous CH\ :sub:`4` and O\ :sub:`2` concentrations: .. math:: - :label: 19.11) + :label: 24.11) R_{oxic} =R_{o,\max } \left[\frac{C_{CH_{4} } }{K_{CH_{4} } +C_{CH_{4} } } \right]\left[\frac{C_{O_{2} } }{K_{O_{2} } +C_{O_{2} } } \right]Q_{10} F_{\vartheta } @@ -429,7 +429,7 @@ aqueous diffusion in the saturated part of the soil column, we applied (Moldrup et al. 2003): .. math:: - :label: 19.14) + :label: 24.14) D_{e} =D_{0} \theta _{s} ^{2} . @@ -508,7 +508,7 @@ gives: Equation is solved with a standard tridiagonal solver, i.e.: .. math:: - :label: 19.17) + :label: 24.17) aC_{j-1}^{n+1} +bC_{j}^{n+1} +cC_{j+1}^{n+1} =r, @@ -533,7 +533,7 @@ soil element above the interface: .. math:: b=\left[\frac{R_{j}^{n+1} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left(K_{H} \frac{D_{p1}^{} }{\Delta x_{p1} } +\frac{D_{m1}^{} }{\Delta x_{m1} } \right)\right] .. math:: - :label: 19.18) + :label: 24.18) r=\frac{R_{j}^{n} }{\Delta t} C_{j}^{n} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1} } \left(C_{j+1}^{n} -K_{H} C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right] @@ -544,7 +544,7 @@ and the soil element below the interface: .. math:: a=-K_{H} \frac{1}{2\Delta x_{j} } \frac{D_{m1}^{} }{\Delta x_{m1} } .. math:: - :label: 19.19) + :label: 24.19) r=\frac{R_{j}^{n} }{\Delta t} +C_{j}^{n} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1} } \left(C_{j}^{n} -K_{H} C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right] @@ -567,7 +567,7 @@ grid cell in a simple model based on simulated water table depth (:math:`{z}_{w}`) and surface runoff (:math:`{Q}_{r}` (mm s\ :sup:`-1`)): .. math:: - :label: 19.20) + :label: 24.20) f_{s} =P_{1} e^{{\raise0.7ex\hbox{$ -z_{w} $}\!\mathord{\left/ {\vphantom {-z_{w} p_{2} }} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ p_{2} $}} } +p_{3} Q_{r} . @@ -585,7 +585,7 @@ seasonal inundation on CH\ :sub:`4` production (see appendix B in Riley et al. (2011a) for a discussion of this simplified expression): .. math:: - :label: 19.21) + :label: 24.21) S=\frac{\beta \left(f-\bar{f}\right)+\bar{f}}{f} ,S\le 1. diff --git a/doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst similarity index 97% rename from doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst rename to doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst index db2b04d5cf..7219e7a293 100644 --- a/doc/source/tech_note/CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst +++ b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst @@ -71,22 +71,22 @@ derived from one year’s worth of hourly CAM output from CAM version cam3\_5\_55 as .. math:: - :label: 26.2) + :label: 31.2) S_{atm} \, \downarrow _{vis}^{\mu } =R_{vis} \left(\alpha S_{atm} \right) .. math:: - :label: 26.3) + :label: 31.3) S_{atm} \, \downarrow _{nir}^{\mu } =R_{nir} \left[\left(1-\alpha \right)S_{atm} \right] .. math:: - :label: 26.4) + :label: 31.4) S_{atm} \, \downarrow _{vis} =\left(1-R_{vis} \right)\left(\alpha S_{atm} \right) .. math:: - :label: 26.5) + :label: 31.5) S_{atm} \, \downarrow _{nir} =\left(1-R_{nir} \right)\left[\left(1-\alpha \right)S_{atm} \right]. @@ -94,7 +94,7 @@ where :math:`\alpha` , the ratio of visible to total incident solar radiation, is assumed to be .. math:: - :label: 26.6) + :label: 31.6) \alpha =\frac{S_{atm} \, \downarrow _{vis}^{\mu } +S_{atm} \, \downarrow _{vis}^{} }{S_{atm} } =0.5. @@ -102,14 +102,14 @@ The ratio of direct to total incident radiation in the visible :math:`R_{vis}` is .. math:: - :label: 26.7) + :label: 31.7) R_{vis} =a_{0} +a_{1} \times \alpha S_{atm} +a_{2} \times \left(\alpha S_{atm} \right)^{2} +a_{3} \times \left(\alpha S_{atm} \right)^{3} \qquad 0.01\le R_{vis} \le 0.99 and in the near-infrared :math:`R_{nir}` is .. math:: - :label: 26.8) + :label: 31.8) R_{nir} =b_{0} +b_{1} \times \left(1-\alpha \right)S_{atm} +b_{2} \times \left[\left(1-\alpha \right)S_{atm} \right]^{2} +b_{3} \times \left[\left(1-\alpha \right)S_{atm} \right]^{3} \qquad 0.01\le R_{nir} \le 0.99 @@ -130,14 +130,14 @@ is derived from the atmospheric vapor pressure :math:`e_{atm}` and temperature :math:`T_{atm}` (Idso 1981) as .. math:: - :label: 26.9) + :label: 31.9) L_{atm} \, \downarrow =\left[0.70+5.95\times 10^{-5} \times 0.01e_{atm} \exp \left(\frac{1500}{T_{atm} } \right)\right]\sigma T_{atm}^{4} where .. math:: - :label: 26.10) + :label: 31.10) e_{atm} =\frac{P_{atm} q_{atm} }{0.622+0.378q_{atm} } @@ -152,14 +152,14 @@ snow is q_{rain} =P\left(f_{P} \right), .. math:: - :label: 26.12) + :label: 31.12) q_{snow} =P\left(1-f_{P} \right) where .. math:: - :label: 26.13) + :label: 31.13) f_{P} =0<0.5\left(T_{atm} -T_{f} \right)<1. @@ -174,7 +174,7 @@ user-supplied relative humidity :math:`RH` (%) and derive specific humidity :math:`q_{atm}` (kg kg\ :sup:`-1`) from .. math:: - :label: 26.14) + :label: 31.14) q_{atm} =\frac{0.622e_{atm} }{P_{atm} -0.378e_{atm} } @@ -190,7 +190,7 @@ temperature :math:`T_{dew}` (K) and derive specific humidity :math:`q_{atm}` from .. math:: - :label: 26.15) + :label: 31.15) q_{atm} = \frac{0.622e_{sat}^{T_{dew} } }{P_{atm} -0.378e_{sat}^{T_{dew} } } . diff --git a/doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst similarity index 98% rename from doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst rename to doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index c380f0d75a..e48ba34933 100644 --- a/doc/source/tech_note/CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -134,7 +134,7 @@ describe the implementation, modified here. In its simplest form, leaf net photosynthesis after accounting for respiration (:math:`R_{d}` ) is .. math:: - :label: 8.2) + :label: 9.2) A_{n} =\min \left(A_{c} ,A_{j} ,A_{p} \right)-R_{d} . @@ -153,7 +153,7 @@ RuBP (i.e., the light-limited rate) :math:`A_{j}` (:math:`\mu` \ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 8.4) + :label: 9.4) A_{j} =\left\{\begin{array}{l} {\frac{J\left(c_{i} -\Gamma _{\*} \right)}{4c_{i} +8\Gamma _{\*} } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {\alpha (4.6\phi )\qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}\qquad \qquad c_{i} -\Gamma _{\*} \ge 0. @@ -193,7 +193,7 @@ photosynthetically active radiation absorbed by the leaf. A common expression is the smaller of the two roots of the equation .. math:: - :label: 8.6) + :label: 9.6) \Theta _{PSII} J^{2} -\left(I_{PSII} +J_{\max } \right)J+I_{PSII} J_{\max } =0 @@ -208,7 +208,7 @@ with 4.6 :math:`\mu`\ mol J\ :sup:`-1`, the light utilized in electron transport is .. math:: - :label: 8.7) + :label: 9.7) I_{PSII} =0.5\Phi _{PSII} (4.6\phi ) @@ -225,7 +225,7 @@ The model uses co-limitation as described by Collatz et al. (1991, smaller root of the equations .. math:: - :label: 8.8) + :label: 9.8) \begin{array}{rcl} {\Theta _{cj} A_{i}^{2} -\left(A_{c} +A_{j} \right)A_{i} +A_{c} A_{j} } & {=} & {0} \\ {\Theta _{ip} A^{2} -\left(A_{i} +A_{p} \right)A+A_{i} A_{p} } & {=} & {0} \end{array} . @@ -259,21 +259,21 @@ respiration rate. The parameters :math:`V_{c\max 25}` , :math:`T_{v}` (K) as: .. math:: - :label: 8.9) + :label: 9.9) \begin{array}{rcl} {V_{c\max } } & {=} & {V_{c\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {J_{\max } } & {=} & {J_{\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {T_{p} } & {=} & {T_{p25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {R_{d} } & {=} & {R_{d25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {K_{c} } & {=} & {K_{c25} \; f\left(T_{v} \right)} \\ {K_{o} } & {=} & {K_{o25} \; f\left(T_{v} \right)} \\ {\Gamma _{*} } & {=} & {\Gamma _{*25} \; f\left(T_{v} \right)} \end{array} with .. math:: - :label: 8.10) + :label: 9.10) f\left(T_{v} \right)=\; \exp \left[\frac{\Delta H_{a} }{298.15\times 0.001R_{gas} } \left(1-\frac{298.15}{T_{v} } \right)\right] and .. math:: - :label: 8.11) + :label: 9.11) f_{H} \left(T_{v} \right)=\frac{1+\exp \left(\frac{298.15\Delta S-\Delta H_{d} }{298.15\times 0.001R_{gas} } \right)}{1+\exp \left(\frac{\Delta ST_{v} -\Delta H_{d} }{0.001R_{gas} T_{v} } \right)} . @@ -284,7 +284,7 @@ Because :math:`T_{p}` as implemented here varies with :math:`T_{p}` . For C\ :sub:`4` plants, .. math:: - :label: 8.12) + :label: 9.12) \begin{array}{l} {V_{c\max } =V_{c\max 25} \left[\frac{Q_{10} ^{(T_{v} -298.15)/10} }{f_{H} \left(T_{v} \right)f_{L} \left(T_{v} \right)} \right]} \\ {f_{H} \left(T_{v} \right)=1+\exp \left[s_{1} \left(T_{v} -s_{2} \right)\right]} \\ {f_{L} \left(T_{v} \right)=1+\exp \left[s_{3} \left(s_{4} -T_{v} \right)\right]} \end{array} @@ -295,7 +295,7 @@ with :math:`Q_{10} =2`, Additionally, .. math:: - :label: 8.13) + :label: 9.13) R_{d} =R_{d25} \left\{\frac{Q_{10} ^{(T_{v} -298.15)/10} }{1+\exp \left[s_{5} \left(T_{v} -s_{6} \right)\right]} \right\} @@ -303,7 +303,7 @@ with :math:`Q_{10} =2`, :math:`s_{5} =1.3` K\ :sup:`-1` and :math:`s_{6} =328.15`\ K, and .. math:: - :label: 8.14) + :label: 9.14) k_{p} =k_{p25} \, Q_{10} ^{(T_{v} -298.15)/10} @@ -337,7 +337,7 @@ achieved by allowing :math:`\Delta S`\ to vary with growth temperature according to .. math:: - :label: 8.15) + :label: 9.15) \begin{array}{l} {\Delta S=668.39-1.07(T_{10} -T_{f} )\qquad \qquad {\rm for\; }V_{c\max } } \\ {\Delta S=659.70-0.75(T_{10} -T_{f} )\qquad \qquad {\rm for\; }J_{\max } } \end{array} @@ -349,7 +349,7 @@ parameterization, :math:`\Delta H_{d}` \ = 200000, ratio :math:`J_{\max 25} /V_{c\max 25}` at 25 :sup:`o`\ C decreases with growth temperature as .. math:: - :label: 8.16) + :label: 9.16) J_{\max 25} /V_{c\max 25} =2.59-0.035(T_{10} -T_{f} ). @@ -415,24 +415,24 @@ coefficient for nitrogen. The canopy integrated value for sunlit and shaded leaves is .. math:: - :label: 8.20) + :label: 9.20) \begin{array}{rcl} {V_{c\; \max 25}^{sun} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)f_{sun} \left(x\right)\, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} } \end{array} .. math:: - :label: 8.21) + :label: 9.21) \begin{array}{rcl} {V_{c\; \max 25}^{sha} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)\left[1-f_{sun} \left(x\right)\right] \, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left\{\left[1-e^{-K_{n} L} \right]\frac{1}{K_{n} } -\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} \right\}} \end{array} and the average value for the sunlit and shaded leaves is .. math:: - :label: 8.22) + :label: 9.22) \bar{V}_{c\; \max 25}^{sun} ={V_{c\; \max 25}^{sun} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sun} L^{sun} }} \right. \kern-\nulldelimiterspace} L^{sun} } .. math:: - :label: 8.23) + :label: 9.23) \bar{V}_{c\; \max 25}^{sha} ={V_{c\; \max 25}^{sha} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sha} L^{sha} }} \right. \kern-\nulldelimiterspace} L^{sha} } . @@ -457,7 +457,7 @@ using the function :math:`f(DYL)`, which introduces seasonal variation to :math:`V_{c\max }` .. math:: - :label: 8.24) + :label: 9.24) f\left(DYL\right)=\frac{\left(DYL\right)^{2} }{\left(DYL_{\max } \right)^{2} } @@ -465,7 +465,7 @@ with :math:`0.01\le f\left(DYL\right)\le 1`. Daylength (seconds) is given by .. math:: - :label: 8.25) + :label: 9.25) DYL=2\times 13750.9871\cos ^{-1} \left[\frac{-\sin \left(lat\right)\sin \left(decl\right)}{\cos \left(lat\right)\cos \left(decl\right)} \right] @@ -492,7 +492,7 @@ of each soil layer, the root distribution of the plant functional type, and a plant-dependent response to soil water stress .. math:: - :label: 8.26) + :label: 9.26) \beta _{t} =\sum _{i}w_{i} r_{i} @@ -501,7 +501,7 @@ where :math:`w_{i}` is a plant wilting factor for layer :math:`i` and wilting factor :math:`w_{i}` is .. math:: - :label: 8.27) + :label: 9.27) w_{i} =\left\{\begin{array}{l} {\frac{\psi _{c} -\psi _{i} }{\psi _{c} -\psi _{o} } \left[\frac{\theta _{sat,i} -\theta _{ice,i} }{\theta _{sat,i} } \right]\le 1\qquad {\rm for\; }T_{i} >T_{f} -2{\rm \; and\; }\theta _{liq,\, i} >0} \\ {0\qquad \qquad \qquad \qquad {\rm for\; }T_{i} \le T_{f} -2{\rm \; or\; }\theta _{liq,\, i} \le 0} \end{array}\right\} @@ -515,7 +515,7 @@ effective porosity (accounting for the ice fraction; Here, the soil water matric potential :math:`\psi _{i}` \ is defined as .. math:: - :label: 8.28) + :label: 9.28) \psi _{i} =\psi _{sat,i} \, s_{i}^{-B_{i} } \ge \psi _{c} @@ -526,7 +526,7 @@ Clapp and Hornberger (1978) parameter (section 7.4.1). The soil wetness :math:`s_{i}` is .. math:: - :label: 8.29) + :label: 9.29) s_{i} =\frac{\theta _{liq,\, i} }{\theta _{sat,\, i} -\theta _{ice,\, i} } \ge 0.01 @@ -544,7 +544,7 @@ The root fraction :math:`r_{i}` in each soil layer depends on the plant functional type .. math:: - :label: 8.30) + :label: 9.30) r_{i} =\left\{\begin{array}{l} {0.5\left[\begin{array}{l} {\exp \left(-r_{a} z_{h,\, i-1} \right)+\exp \left(-r_{b} z_{h,\, i-1} \right)-} \\ {\exp \left(-r_{a} z_{h,\, i} \right)-\exp \left(-r_{b} z_{h,\, i} \right)} \end{array}\right]\qquad {\rm for\; }1\le iCF_{GPPpot} } \end{array}\right. + +.. math:: + :label: 17.3) + + CF_{xs,mr} =\_ \left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{mr} -CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. + +The storage pool that supplies carbon for maintenance respiration in +excess of current :math:`CF_{GPPpot}` ( :math:`CS_{xs}`, gC +m\ :sup:`-2`) is permitted to run a deficit (negative state), and +the magnitude of this deficit determines an allocation demand which +gradually replenishes :math:`CS_{xs}`. The logic for allowing a +negative state for this pool is to eliminate the need to know in advance +what the total maintenance respiration demand will be for a particular +combination of climate and plant type. Using the deficit approach, the +allocation to alleviate the deficit increases as the deficit increases, +until the supply of carbon into the pool balances the demand for carbon +leaving the pool in a quasi-steady state, with variability driven by the +seasonal cycle, climate variation, disturbance, and internal dynamics of +the plant-litter-soil system. In cases where the combination of climate +and plant type are not suitable to sustained growth, the deficit in this +pool increases until the available carbon is being allocated mostly to +alleviate the deficit, and new growth approaches zero. The allocation +flux to :math:`CS_{xs}` (:math:`CF_{GPP,xs}`, gC +m\ :sup:`-2` s\ :sup:`-1`) is given as + +.. math:: + :label: 17.4) + + CF_{GPP,xs,pot} =\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CS_{xs} \ge 0} \\ {-CS_{xs} /(86400\tau _{xs} )\qquad {\rm for\; }CS_{xs} <0} \end{array}\right. + +.. math:: + :label: 17.5) + + CF_{GPP,xs} =\left\{\begin{array}{l} {CF_{GPP,xs,pot} \qquad \qquad \qquad {\rm for\; }CF_{GPP,xs,pot} \le CF_{GPPpot} -CF_{GPP,mr} } \\ {\max (CF_{GPPpot} -CF_{GPP,mr} ,0)\qquad {\rm for\; }CF_{GPP,xs,pot} >CF_{GPPpot} -CF_{GPP,mr} } \end{array}\right. + +where :math:`\tau_{xs}` is the time constant (currently +set to 30 days) controlling the rate of replenishment of :math:`CS_{xs}`. + +Note that these two top-priority carbon allocation fluxes +(:math:`CF_{GPP,mr}` and :math:`CF_{GPP,xs}`) are not +stoichiometrically associated with any nitrogen fluxes, and so this +initial allocation step can proceed without reference to (or limitation +from) the available mineral nitrogen supply. + +Carbon and Nitrogen Stoichiometry of New Growth +---------------------------------------------------- + +After accounting for the carbon cost of maintenance respiration, the +remaining carbon flux from photosynthesis which can be allocated to new +growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is + +.. math:: + :label: 17.6) + + CF_{avail\_ alloc} =CF_{GPPpot} -CF_{GPP,mr} -CF_{GPP,xs} . + +Potential allocation to new growth is calculated for all of the plant +carbon and nitrogen state variables based on specified C:N ratios for +each tissue type and allometric parameters that relate allocation +between various tissue types. The allometric parameters are defined as +follows: + +.. math:: + :label: ZEqnNum650137 + + \begin{array}{l} {a_{1} ={\rm \; ratio\; of\; new\; fine\; root\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{2} ={\rm \; ratio\; of\; new\; coarse\; root\; :\; new\; stem\; carbon\; allocation}} \\ {a_{3} ={\rm \; ratio\; of\; new\; stem\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{4} ={\rm \; ratio\; new\; live\; wood\; :\; new\; total\; wood\; allocation}} \\ {g_{1} ={\rm ratio\; of\; growth\; respiration\; carbon\; :\; new\; growth\; carbon.\; }} \end{array} + +Parameters :math:`a_{1}`, :math:`a_{2}`, and :math:`a_{4}` are defined as constants for a given PFT (Table +13.1), while :math:`g_{l }` = 0.3 (unitless) is prescribed as a +constant for all PFTs, based on construction costs for a range of woody +and non-woody tissues (Larcher, 1995). + +The model includes a dynamic allocation scheme for woody vegetation +(parameter :math:`a_{3}` = -1, Table 13.1), in which case the +ratio for carbon allocation between new stem and new leaf increases with +increasing net primary production (NPP), as + +.. math:: + :label: 17.8) + + a_{3} =\frac{2.7}{1+e^{-0.004NPP_{ann} -300} } -0.4 + +where :math:`NPP_{ann}` is the annual sum of NPP from the previous +year. This mechanism has the effect of increasing woody allocation in +favorable growth environments (Allen et al., 2005; Vanninen and Makela, +2005) and during the phase of stand growth prior to canopy closure +(Axelsson and Axelsson, 1986). + +Table 13.1. Allocation and carbon:nitrogen ratio parameters + ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`CN_{leaf}` | :math:`CN_{fr}` | :math:`CN_{lw}` | :math:`CN_{dw}` | ++==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ +| NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| NET Boreal | 1 | 0.3 | -1 | 0.1 | 40 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| NDT Boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BET Tropical | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BET temperate | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDT tropical | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDT temperate | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDT boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BES temperate | 1 | 0.3 | 0.2 | 0.5 | 30 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDS temperate | 1 | 0.3 | 0.2 | 0.5 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| BDS boreal | 1 | 0.3 | 0.2 | 0.1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| C\ :sub:`3` arctic grass | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| C\ :sub:`3` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| C\ :sub:`4` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Crop R | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Crop I | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Corn R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Corn I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Temp Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Temp Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Winter Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Winter Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Soybean R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +| Soybean I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | ++----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + +Carbon to nitrogen ratios are defined for different tissue types as +follows: + +.. math:: + :label: ZEqnNum413927 + + \begin{array}{l} {CN_{leaf} =\_ {\rm \; C:N\; for\; leaf}} \\ {CN_{fr} =\_ {\rm \; C:N\; for\; fine\; root}} \\ {CN_{lw} =\_ {\rm \; C:N\; for\; live\; wood\; (in\; stem\; and\; coarse\; root)}} \\ {CN_{dw} =\_ {\rm \; C:N\; for\; dead\; wood\; (in\; stem\; and\; coarse\; root)}} \end{array} + +where all C:N parameters are defined as constants for a given PFT (Table +13.1). + +Given values for the parameters in and , total carbon and nitrogen +allocation to new growth ( :math:`CF_{alloc}`, gC +m\ :sup:`-2` s\ :sup:`-1`, and :math:`NF_{alloc}`, gN +m\ :sup:`-2` s\ :sup:`-1`, respectively) can be expressed as +functions of new leaf carbon allocation (:math:`CF_{GPP,leaf}`, gC +m\ :sup:`-2` s\ :sup:`-1`): + +.. math:: + :label: ZEqnNum555154 + + \begin{array}{l} {CF_{alloc} =CF_{GPP,leaf} {\kern 1pt} C_{allom} } \\ {NF_{alloc} =CF_{GPP,leaf} {\kern 1pt} N_{allom} } \end{array} + +where + +.. math:: + :label: 17.11) + + \begin{array}{l} {C_{allom} =\left\{\begin{array}{l} {\left(1+g_{1} \right)\left(1+a_{1} +a_{3} \left(1+a_{2} \right)\right)\qquad {\rm for\; woody\; PFT}} \\ {1+g_{1} +a_{1} \left(1+g_{1} \right)\qquad \qquad {\rm for\; non-woody\; PFT}} \end{array}\right. } \\ {} \end{array} + +.. math:: + :label: 17.12) + + N_{allom} =\left\{\begin{array}{l} {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } +\frac{a_{3} a_{4} \left(1+a_{2} \right)}{CN_{lw} } +} \\ {\qquad \frac{a_{3} \left(1-a_{4} \right)\left(1+a_{2} \right)}{CN_{dw} } \qquad {\rm for\; woody\; PFT}} \\ {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } \qquad \qquad \qquad {\rm for\; non-woody\; PFT.}} \end{array}\right. + +Since the C:N stoichiometry for new growth allocation is defined, from +Eq. , as :math:`C_{allom}`/ :math:`N_{allom}`, the total carbon available for new growth allocation +(:math:`CF_{avail\_alloc}`) can be used to calculate the total +plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, +gN m\ :sup:`-2` s\ :sup:`-1`) as: + +.. math:: + :label: 17.13) + + NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . + +Deployment of retranslocated nitrogen +------------------------------------------ + +In many plants, some portion of the nitrogen used to construct new +tissues is mobilized from senescing tissues, especially leaves, and +retained within the plant when the tissues are lost as litter. This +store of retranslocated nitrogen is used to supply part of the nitrogen +demand for subsequent growth (Magill et al., 1997; Oikawa et al., 2005; +Son and Gower, 1991). CLM includes one pool of retranslocated nitrogen +(:math:`NS_{retrans}`, gN m\ :sup:`-2`), and the +availability of nitrogen from this pool to support new growth +(:math:`NF_{avail\_retrans}`, gN m\ :sup:`-2` +s\ :sup:`-1`) is proportional to the plant nitrogen demand, as: + +.. math:: + :label: 17.14) + + NF_{avail\_ retrans} =\min \left(\frac{NF_{retrans\_ ann} \frac{NF_{plant\_ demand} }{NF_{plant\_ demand\_ ann} } }{\Delta t} ,\; \frac{NS_{retrans} }{\Delta t} \right) + +where :math:`NF_{retrans\_ann}` (gN m\ :sup:`-2` y\ :sup:`-1`) is the previous year’s annual sum of retranslocated +nitrogen extracted from senescing tissues, +:math:`NF_{plant\_demand\_ann}` (gN m\ :sup:`-2` y\ :sup:`-1`) is the previous year’s annual sum of +:math:`NF_{plant\_demand}`, and :math:`\Delta`\ *t* (s) is the +model’s biogeochemistry time step. This formulation produces an annual +cycle in the extraction of nitrogen from :math:`NS_{retrans}` +which corresponds to the annual cycle of plant nitrogen demand, and +which is scaled to give :math:`NS_{retrans}` approximately a +one-year turnover time. The minimum function prevents extraction of more +than the remaining pool of retranslocated nitrogen, which can be an +important constraint under conditions where high rates of mortality are +modifying the size of the pool. During the first year of an initial +simulation, before :math:`NF_{plant\_demand\_ann}` and +:math:`NF_{retrans\_ann}` have valid values, +:math:`NF_{avail\_retrans}` is set to 0.0. + +The actual flux of nitrogen from the retranslocated N pool into +allocation of new growth (:math:`NF_{retrans,alloc}`, gN +m\ :sup:`-2` s\ :sup:`-1`) is never greater than the plant +demand for new nitrogen: + +.. math:: + :label: 17.15) + + NF_{retrans,alloc} =\min \left(NF_{plant\_ demand} ,NF_{avail\_ retrans} \right) + +Plant nitrogen uptake from soil mineral nitrogen pool +---------------------------------------------------------- + +The total plant nitrogen demand is reduced by the nitrogen flux from +:math:`NS_{retrans}` to give the plant demand for mineral nitrogen +from the soil (:math:`NF_{plant\_demand\_soil}`, gN +m\ :sup:`-2` s\ :sup:`-1`): + +.. math:: + :label: ZEqnNum491412 + + NF_{plant\_ demand\_ soil} =NF_{plant\_ demand} -NF_{retrans,alloc} . + +The combined demand from all PFTs sharing space on a soil column and the +demand from the heterotrophic community in the soil (nitrogen +immobilization demand) compete for the available soil mineral nitrogen +pool. The result of this competition is passed back to the allocation +algorithm as :math:`f_{plant\_demand}`, the fraction (from 0 to 1) +of the plant nitrogen demand which can be met given the current soil +mineral nitrogen supply and competition with heterotrophs. Plant uptake +from the soil mineral nitrogen pool is then given as: + +.. math:: + :label: 17.17) + + NF_{sminn,alloc} =NF_{plant\_ demand\_ soil} f_{plant\_ demand} + +Final carbon and nitrogen allocation +----------------------------------------- + +The total flux of allocated nitrogen is given as: + +.. math:: + :label: 17.18) + + NF_{alloc} =NF_{retrans,alloc} +NF_{sminn,alloc} + +From the stoichiometric relationship in Eq. , the associated carbon +allocation flux is: + +.. math:: + :label: 17.19) + + CF_{alloc} =NF_{alloc} \frac{C_{allom} }{N_{allom} } . + +The downregulation of photosynthesis can then be calculated as: + +.. math:: + :label: 17.20) + + f_{dreg} =\frac{CF_{alloc} -CF_{avail\_ alloc} }{CF_{GPPpot} } . + +Total allocation to new leaf carbon +(:math:`CF_{alloc,leaf\_tot}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as: + +.. math:: + :label: 17.21) + + CF_{alloc,leaf\_ tot} =\frac{CF_{alloc} }{C_{allom} } . + +There are two carbon pools associated with each plant tissue – one which +represents the currently displayed tissue, and another which represents +carbon stored for display in a subsequent growth period. The nitrogen +pools follow this same organization. The model keeps track of stored +carbon according to which tissue type it will eventually be displayed +as, and the separation between display in the current timestep and +storage for later display depends on the parameter :math:`f_{cur}` +(values 0 to 1). Given :math:`CF_{alloc,leaf}` and :math:`f_{cur}`, the allocation fluxes of carbon to display and +storage pools (where storage is indicated with *\_stor*) for the various +tissue types are given as: + +.. math:: + :label: 17.22) + + CF_{alloc,leaf} \_ =CF_{alloc,leaf\_ tot} f_{cur} + +.. math:: + :label: 17.23) + + CF_{alloc,leaf\_ stor} \_ =CF_{alloc,leaf\_ tot} \left(1-f_{cur} \right) + +.. math:: + :label: 17.24) + + CF_{alloc,froot} \_ =CF_{alloc,leaf\_ tot} a_{1} f_{cur} + +.. math:: + :label: 17.25) + + CF_{alloc,froot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{1} \left(1-f_{cur} \right) + +.. math:: + :label: 17.26) + + CF_{alloc,livestem} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} f_{cur} + +.. math:: + :label: 17.27) + + CF_{alloc,livestem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} \left(1-f_{cur} \right) + +.. math:: + :label: 17.28) + + CF_{alloc,deadstem} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)f_{cur} + +.. math:: + :label: 17.29) + + CF_{alloc,deadstem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right) + +.. math:: + :label: 17.30) + + CF_{alloc,livecroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} f_{cur} + +.. math:: + :label: 17.31) + + CF_{alloc,livecroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} \left(1-f_{cur} \right) + +.. math:: + :label: 17.32) + + CF_{alloc,deadcroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)f_{cur} + +.. math:: + :label: 17.33) + + CF_{alloc,deadcroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). + +The corresponding nitrogen allocation fluxes are given as: + +.. math:: + :label: 17.34) + + NF_{alloc,leaf} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } f_{cur} + +.. math:: + :label: 17.35) + + NF_{alloc,leaf\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } \left(1-f_{cur} \right) + +.. math:: + :label: 17.36) + + NF_{alloc,froot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } f_{cur} + +.. math:: + :label: 17.37) + + NF_{alloc,froot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } \left(1-f_{cur} \right) + +.. math:: + :label: 17.38) + + NF_{alloc,livestem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } f_{cur} + +.. math:: + :label: 17.39) + + NF_{alloc,livestem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) + +.. math:: + :label: 17.40) + + NF_{alloc,deadstem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} + +.. math:: + :label: 17.41) + + NF_{alloc,deadstem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right) + +.. math:: + :label: 17.42) + + NF_{alloc,livecroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } f_{cur} + +.. math:: + :label: 17.43) + + NF_{alloc,livecroot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) + +.. math:: + :label: 17.44) + + NF_{alloc,deadcroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} + +.. math:: + :label: 17.45) + + NF_{alloc,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). + +Autotrophic Respiration +---------------------------- + +The model treats maintenance and growth respiration fluxes separately, +even though it is difficult to measure them as separate fluxes (Lavigne +and Ryan, 1997; Sprugel et al., 1995). Maintenance respiration is +defined as the carbon cost to support the metabolic activity of existing +live tissue, while growth respiration is defined as the additional +carbon cost for the synthesis of new growth. + +13.7.1 Maintenance Respiration +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Under the assumption that tissue nitrogen content is a suitable index of +cellular metabolic rate, maintenance respiration costs for live tissues +(leaf, live stem, live coarse root, and fine root) are calculated as +functions tissue nitrogen content and the relevant temperature, +following the empirical relationship reported by Ryan (1991): + +.. math:: + :label: 17.46) + + CF_{mr\_ leaf} \_ =NS_{leaf} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} + +.. math:: + :label: 17.47) + + CF_{mr\_ livestem} \_ =NS_{livestem} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} + +.. math:: + :label: 17.48) + + CF_{mr\_ livecroot} \_ =NS_{livecroot} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} + +.. math:: + :label: 17.49) + + CF_{mr\_ froot} \_ =\sum _{j=1}^{nlevsoi}NS_{froot} rootfr_{j} MR_{base} MR_{Q10} ^{(Ts_{j} -20)/10} + +where :math:`MR_{base}` (= 2.525e\ :sup:`-6` gC gN\ :sup:`-1` s\ :sup:`-1`) is the base rate of maintenance +respiration per unit nitrogen content, :math:`MR_{q10}` (= 2.0) is +the temperature sensitivity for maintenance respiration, +:math:`T_{2m}` (:sup:`o`\ C) is the air temperature at 2m +height, :math:`Ts_{j}`* (:sup:`o`\ C) is the soil +temperature at level *j*, and :math:`rootfr_{j}` is the fraction +of fine roots distributed in soil level *j*. + +Note that, for woody vegetation, maintenance respiration costs are not +calculated for the dead stem and dead coarse root components. These +components are assumed to consist of dead xylem cells, with no metabolic +function. By separating the small live component of the woody tissue +(ray parenchyma, phloem, and sheathing lateral meristem cells) from the +larger fraction of dead woody tissue, it is reasonable to assume a +common base maintenance respiration rate for all live tissue types. + +The total maintenance respiration cost is then given as: + +.. math:: + :label: 17.50) + + CF_{mr} =CF_{mr\_ leaf} +CF_{mr\_ froot} +CF_{mr\_ livestem} +CF_{mr\_ livecroot} . + +13.7.2 Growth Respiration +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Growth respiration is calculated as a factor of 0.3 times the total +carbon in new growth on a given timestep, based on construction costs +for a range of woody and non-woody tissues (Larcher, 1995). For new +carbon and nitrogen allocation that enters storage pools for subsequent +display, it is not clear what fraction of the associated growth +respiration should occur at the time of initial allocation, and what +fraction should occur later, at the time of display of new growth from +storage. Eddy covariance estimates of carbon fluxes in forest ecosystems +suggest that the growth respiration associated with transfer of +allocated carbon and nitrogen from storage into displayed tissue is not +significant (Churkina et al., 2003), and so it is assumed in CLM that +all of the growth respiration cost is incurred at the time of initial +allocation, regardless of the fraction of allocation that is displayed +immediately (i.e. regardless of the value of :math:`f_{cur}`, +section 13.5). This behavior is parameterized in such a way that if +future research suggests that some fraction of the growth respiration +cost should be incurred at the time of display from storage, a simple +parameter modification will effect the change. [1]_ + +.. [1] + Parameter :math:`\text{grpnow}` in routines CNGResp and CNAllocation, currently set to 1.0, could be changed to a smaller + value to transfer some portion (1 - :math:`\text{grpnow}` ) of the growth respiration forward in time to occur at the time of growth + display from storage. + diff --git a/doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst b/doc/source/tech_note/RTM/CLM50_Tech_Note_RTM.rst similarity index 97% rename from doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst rename to doc/source/tech_note/RTM/CLM50_Tech_Note_RTM.rst index 9568b91b16..773b3f2fe6 100644 --- a/doc/source/tech_note/CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst +++ b/doc/source/tech_note/RTM/CLM50_Tech_Note_RTM.rst @@ -25,7 +25,7 @@ cell to its downstream neighboring grid cell. The change in storage cell (m\ :sup:`3` s\ :sup:`-1`) is .. math:: - :label: 11.1) + :label: 14.1) \frac{dS}{dt} =\sum F_{in} -F_{out} +R @@ -42,7 +42,7 @@ model (Graham et al. 1999). The flux of water leaving the grid cell :math:`F_{out}` is .. math:: - :label: 11.2) + :label: 14.2) F_{out} =\frac{v}{d} S @@ -57,7 +57,7 @@ and channel roughness data are not available globally, so a simplified effective flow velocity expression is used in RTM .. math:: - :label: 11.3) + :label: 14.3) v=\max \left(0.05,k\beta ^{1/2} \right) @@ -68,14 +68,14 @@ The distance :math:`d` between two grid cell centers depends on river direction, latitude, and longitude as .. math:: - :label: 11.4) + :label: 14.4) d=\sqrt{\Delta x^{2} +\Delta y^{2} } . The distance in the zonal direction :math:`\Delta x` (m) is .. math:: - :label: 11.5) + :label: 14.5) \Delta x=\left(1\times 10^{3} \left|\theta _{i,\, j} -\theta _{i*,\, j*} \right|R_{e} \right)\left[0.5\left(\cos \phi _{i,\, j} +\cos \phi _{i*,\, j*} \right)\right] @@ -88,7 +88,7 @@ are grid cell indices. The distance in the meridional direction :math:`\Delta y` (m) is .. math:: - :label: 11.6) + :label: 14.6) \Delta y=\left(1\times 10^{3} \left|\theta _{i,\, j} -\theta _{i*,\, j*} \right|R_{e} \right). @@ -99,7 +99,7 @@ total liquid water runoff at the land model resolution (kg m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 11.7) + :label: 14.7) R_{liq} =q_{over} +q_{drai} +q_{rgwl} @@ -110,7 +110,7 @@ where :math:`q_{over}` is surface runoff (section 7.3), 9.6.3). The total ice water runoff, also at the land model resolution is .. math:: - :label: 11.8) + :label: 14.8) R_{ice} =q_{snwcp,ice} @@ -134,7 +134,7 @@ as a diagnostic tool. The river-routing scheme conserves water globally as .. math:: - :label: 11.9) + :label: 14.9) \sum _{i,\, j}\left(\frac{dS}{dt} \right) _{i,\, j} =\sum _{i,\, j}R_{i,\, j} . diff --git a/doc/source/tech_note/CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst rename to doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst diff --git a/doc/source/tech_note/CHAPTER_27/CLM50_Tech_Note_Chpt_27_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_27/CLM50_Tech_Note_Chpt_27_References.rst rename to doc/source/tech_note/References/CLM50_Tech_Note_References.rst diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst new file mode 100644 index 0000000000..d84d3c8a3d --- /dev/null +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -0,0 +1,4 @@ +.. _rst_Snow Hydrology: + +Snow Hydrology +============== diff --git a/doc/source/tech_note/CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst rename to doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst diff --git a/doc/source/tech_note/CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst similarity index 100% rename from doc/source/tech_note/CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst rename to doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst diff --git a/doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst similarity index 99% rename from doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst rename to doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index d967dae888..fad229fe7c 100644 --- a/doc/source/tech_note/CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -56,12 +56,12 @@ algorithm, and :math:`n` is the index value for the :math:`dynpft\_ year(n)=year_{cur}` : .. math:: - :label: 21.1) + :label: 26.1) nt_{1} =\left\{\begin{array}{l} {1\qquad {\rm for}\qquad year_{cur} TKFRZ} \\ {FD_{sum}^{n-1} \qquad \qquad {\rm for\; }T_{s,3} \le TKFRZ} \end{array}\right. . @@ -616,7 +616,7 @@ carbon fluxes, and to Eqs. - for nitrogen fluxes. The onset counter is decrement until it reaches zero, signaling the end of the onset period: .. math:: - :label: 14.67) + :label: 20.67) t_{onfset}^{n} =t_{onfset}^{n-1} -\Delta t @@ -634,7 +634,7 @@ period of dry soils, this control variable can increase or decrease, as follows: .. math:: - :label: 14.68) + :label: 20.68) OSWI_{sum}^{n} =\left\{\begin{array}{l} {OSWI_{sum}^{n-1} +f_{day} \qquad \qquad \qquad {\rm for\; }\Psi _{s,3} \le \Psi _{offset} } \\ {{\rm max}\left(OSWI_{sum}^{n-1} -f_{day} ,0\right)\qquad {\rm for\; }\Psi _{s,3} >\Psi _{onset} } \end{array}\right. @@ -648,7 +648,7 @@ accumulator (:math:`{OFD}_{sum}`, d). To test for a sustained period of cold temperature, this variable can increase or decrease, as follows: .. math:: - :label: 14.69) + :label: 20.69) OFD_{sum}^{n} =\left\{\begin{array}{l} {OFD_{sum}^{n-1} +f_{day} \qquad \qquad \qquad {\rm for\; }T_{s,3} \le TKFRZ} \\ {{\rm max}\left(OFD_{sum}^{n-1} -f_{day} ,0\right)\qquad \qquad {\rm for\; }T_{s,3} >TKFRZ} \end{array}\right. @@ -664,7 +664,7 @@ offset period, until it reaches zero, signaling the end of the offset period: .. math:: - :label: 14.70) + :label: 20.70) t_{offset}^{n} =t_{offset}^{n-1} -\Delta t @@ -682,14 +682,14 @@ of an offset period :math:`{n}_{days\_active}` is reset to 0. A long growing season control variable (*LGS*, range 0 to 1) is calculated as: .. math:: - :label: 14.71) + :label: 20.71) LGS=\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }n_{days\_ active} <365} \\ {\left({n_{days\_ active} \mathord{\left/ {\vphantom {n_{days\_ active} 365}} \right. \kern-\nulldelimiterspace} 365} \right)-1\qquad {\rm for\; }365\le n_{days\_ active} <730} \\ {1\qquad \qquad \qquad {\rm for\; }n_{days\_ active} \ge 730} \end{array}\right. . The rate coefficient for background litterfall (:math:`{r}_{bglf}`, s\ :sup:`-1`) is calculated as a function of *LGS*: .. math:: - :label: 14.72) + :label: 20.72) r_{bglf} =\frac{LGS}{\tau _{leaf} \cdot 365\cdot 86400} @@ -699,71 +699,71 @@ where :math:`{\tau}_{leaf}` is the leaf longevity. The result is a shift to cont The rate coefficient for background onset growth from the transfer pools ( :math:`{r}_{bgtr}`, s\ :sup:`-1`) also depends on *LGS*, as: .. math:: - :label: 14.73) + :label: 20.73) r_{bgtr} =\frac{LGS}{365\cdot 86400} . On each timestep with :math:`{r}_{bgtr}` :math:`\neq` 0, carbon fluxes from storage to transfer pools are calculated as: .. math:: - :label: 14.74) + :label: 20.74) CF_{leaf\_ stor,leaf\_ xfer} =CS_{leaf\_ stor} r_{bgtr} .. math:: - :label: 14.75) + :label: 20.75) CF_{froot\_ stor,froot\_ xfer} =CS_{froot\_ stor} r_{bgtr} .. math:: - :label: 14.76) + :label: 20.76) CF_{livestem\_ stor,livestem\_ xfer} =CS_{livestem\_ stor} r_{bgtr} .. math:: - :label: 14.77) + :label: 20.77) CF_{deadstem\_ stor,deadstem\_ xfer} =CS_{deadstem\_ stor} r_{bgtr} .. math:: - :label: 14.78) + :label: 20.78) CF_{livecroot\_ stor,livecroot\_ xfer} =CS_{livecroot\_ stor} r_{bgtr} .. math:: - :label: 14.79) + :label: 20.79) CF_{deadcroot\_ stor,deadcroot\_ xfer} =CS_{deadcroot\_ stor} r_{bgtr} , with corresponding nitrogen fluxes: .. math:: - :label: 14.80) + :label: 20.80) NF_{leaf\_ stor,leaf\_ xfer} =NS_{leaf\_ stor} r_{bgtr} .. math:: - :label: 14.81) + :label: 20.81) NF_{froot\_ stor,froot\_ xfer} =NS_{froot\_ stor} r_{bgtr} .. math:: - :label: 14.82) + :label: 20.82) NF_{livestem\_ stor,livestem\_ xfer} =NS_{livestem\_ stor} r_{bgtr} .. math:: - :label: 14.83) + :label: 20.83) NF_{deadstem\_ stor,deadstem\_ xfer} =NS_{deadstem\_ stor} r_{bgtr} .. math:: - :label: 14.84) + :label: 20.84) NF_{livecroot\_ stor,livecroot\_ xfer} =NS_{livecroot\_ stor} r_{bgtr} .. math:: - :label: 14.85) + :label: 20.85) NF_{deadcroot\_ stor,deadcroot\_ xfer} =NS_{deadcroot\_ stor} r_{bgtr} . @@ -790,32 +790,32 @@ calculated using a weighted average of the fluxes originating at the PFT level. Carbon fluxes are calculated as: .. math:: - :label: 14.86) + :label: 20.86) CF_{leaf,lit1} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{lab\_ leaf,p} wcol_{p} .. math:: - :label: 14.87) + :label: 20.87) CF_{leaf,lit2} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{cel\_ leaf,p} wcol_{p} .. math:: - :label: 14.88) + :label: 20.88) CF_{leaf,lit3} =\sum _{p=0}^{npfts}CF_{leaf,litter} f_{lig\_ leaf,p} wcol_{p} .. math:: - :label: 14.89) + :label: 20.89) CF_{froot,lit1} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{lab\_ froot,p} wcol_{p} .. math:: - :label: 14.90) + :label: 20.90) CF_{froot,lit2} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{cel\_ froot,p} wcol_{p} .. math:: - :label: 14.91) + :label: 20.91) CF_{froot,lit3} =\sum _{p=0}^{npfts}CF_{froot,litter} f_{lig\_ froot,p} wcol_{p} , @@ -832,32 +832,32 @@ C:N of the senescent tissue, and so are distributed using the same fractions used for carbon fluxes: .. math:: - :label: 14.92) + :label: 20.92) NF_{leaf,lit1} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{lab\_ leaf,p} wcol_{p} .. math:: - :label: 14.93) + :label: 20.93) NF_{leaf,lit2} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{cel\_ leaf,p} wcol_{p} .. math:: - :label: 14.94) + :label: 20.94) NF_{leaf,lit3} =\sum _{p=0}^{npfts}NF_{leaf,litter} f_{lig\_ leaf,p} wcol_{p} .. math:: - :label: 14.95) + :label: 20.95) NF_{froot,lit1} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{lab\_ froot,p} wcol_{p} .. math:: - :label: 14.96) + :label: 20.96) NF_{froot,lit2} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{cel\_ froot,p} wcol_{p} .. math:: - :label: 14.97) + :label: 20.97) NF_{froot,lit3} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{lig\_ froot,p} wcol_{p} . diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index 4141a560bc..74a39e908b 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -13,31 +13,36 @@ CLM Technical Note :maxdepth: 2 :numbered: - CHAPTER_1/CLM50_Tech_Note_Chpt_1_Introduction.rst - CHAPTER_2/CLM50_Tech_Note_Chpt_2_Ecosystem.rst - CHAPTER_3/CLM50_Tech_Note_Chpt_3_Surface_Albedos.rst - CHAPTER_4/CLM50_Tech_Note_Chpt_4_Radiative_Fluxes.rst - CHAPTER_5/CLM50_Tech_Note_Chpt_5_Fluxes.rst - CHAPTER_6/CLM50_Tech_Note_Chpt_6_Soil_Snow_Temperatures.rst - CHAPTER_7/CLM50_Tech_Note_Chpt_7_Hydrology.rst - CHAPTER_8/CLM50_Tech_Note_Chpt_8_Photosynthesis.rst - CHAPTER_9/CLM50_Tech_Note_Chpt_9_Lake.rst - CHAPTER_10/CLM50_Tech_Note_Chpt_10_Glacier.rst - CHAPTER_11/CLM50_Tech_Note_Chpt_11_RTM.rst - CHAPTER_12/CLM50_Tech_Note_Chpt_12_Urban.rst - CHAPTER_13/CLM50_Tech_Note_Chpt_13_CN_Allocation_Respiration.rst - CHAPTER_14/CLM50_Tech_Note_Chpt_14_Vegetation_Phenology.rst - CHAPTER_15/CLM50_Tech_Note_Chpt_15_Decomposition.rst - CHAPTER_16/CLM50_Tech_Note_Chpt_16_External_Nitrogen_Cycle.rst - CHAPTER_17/CLM50_Tech_Note_Chpt_17_Plant_Mortality.rst - CHAPTER_18/CLM50_Tech_Note_Chpt_18_Fire.rst - CHAPTER_19/CLM50_Tech_Note_Chpt_19_Methane.rst - CHAPTER_20/CLM50_Tech_Note_Chpt_20_Crop_Irrigation.rst - CHAPTER_21/CLM50_Tech_Note_Chpt_21_Transient_Landcover.rst - CHAPTER_22/CLM50_Tech_Note_Chpt_22_DGVM.rst - CHAPTER_23/CLM50_Tech_Note_Chpt_23_BVOCs.rst - CHAPTER_24/CLM50_Tech_Note_Chpt_24_Dust.rst - CHAPTER_25/CLM50_Tech_Note_Chpt_25_Isotopes.rst - CHAPTER_26/CLM50_Tech_Note_Chpt_26_Offline.rst - CHAPTER_27/CLM50_Tech_Note_Chpt_27_References.rst + Introduction/CLM50_Tech_Note_Introduction.rst + Ecosystem/CLM50_Tech_Note_Ecosystem.rst + Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst + Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst + Fluxes/CLM50_Tech_Note_Fluxes.rst + Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst + Hydrology/CLM50_Tech_Note_Hydrology.rst + Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst + Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst + Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst + Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst + Lake/CLM50_Tech_Note_Lake.rst + Glacier/CLM50_Tech_Note_Glacier.rst + RTM/CLM50_Tech_Note_RTM.rst + Urban/CLM50_Tech_Note_Urban.rst + CN_Pools/CLM50_Tech_Note_CN_Pools.rst + Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst + FUN/CLM50_Tech_Note_FUN.rst + CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst + Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst + Decomposition/CLM50_Tech_Note_Decomposition.rst + External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst + Fire/CLM50_Tech_Note_Fire.rst + Methane/CLM50_Tech_Note_Methane.rst + Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst + Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst + DGVM/CLM50_Tech_Note_DGVM.rst + BVOCs/CLM50_Tech_Note_BVOCs.rst + Dust/CLM50_Tech_Note_Dust.rst + Isotopes/CLM50_Tech_Note_Isotopes.rst + Offline/CLM50_Tech_Note_Offline.rst + References/CLM50_Tech_Note_References.rst From 0024f6a24bb609555e8220d3f57d870723f0b5c2 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 18 May 2017 13:07:45 -0600 Subject: [PATCH 0014/1973] split hydrology & snow hydrology --- doc/source/conf.py | 7 + .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 16 +- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 697 +---------------- .../CLM50_Tech_Note_Snow_Hydrology.rst | 710 +++++++++++++++++- ...CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 10 + .../CLM50_Tech_Note_Surface_Albedos.rst | 10 + 6 files changed, 775 insertions(+), 675 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index dc9a7b7ea8..2d69cb46bd 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -162,3 +162,10 @@ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'https://docs.python.org/': None} + +numfig = True +numfig_format = {'figure': 'Figure %s', + 'table': 'Table %s', + 'code-block': 'Code %s', + 'section': '%s', + } diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 2d2eb57337..868d8409a6 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -94,6 +94,8 @@ from the atmospheric specific humidity :math:`q_{atm}` e_{atm} =\frac{q_{atm} P_{atm} }{0.622+0.378q_{atm} } . +.. _Monin-Obukhov Similarity Theory: + Monin-Obukhov Similarity Theory ----------------------------------- @@ -430,7 +432,7 @@ calculate the surface momentum, sensible heat, and water vapor flux using atmospheric and surface values for :math:`\left|{\it u}\right|`, :math:`\theta` , and :math:`q` except that :math:`L` depends on :math:`u_{*}` , :math:`\theta _{*}` , and :math:`q_{*}` . However, the -bulk CityplaceRichardson number +bulk Richardson number .. math:: :label: ZEqnNum750428} @@ -554,6 +556,8 @@ Chapter 24) u_{10m} =\left\{\begin{array}{l} {V_{a} \qquad z_{atm,\, m} \le 10} \\ {V_{a} -\frac{u_{*} }{k} \left[\ln \left(\frac{z_{atm,\, m} -d}{10+z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{10+z_{0m} }{L} \right)\right]\qquad z_{atm,\, m} >10} \end{array}\right\} +.. _Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces: + Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces -------------------------------------------------------------- @@ -813,6 +817,8 @@ determined analytically, are ignored for :math:`\frac{\partial H_{g} }{\partial T_{g} }` and :math:`\frac{\partial E_{g} }{\partial T_{g} }` . +.. _Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces: + Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces -------------------------------------------------------------------------- @@ -828,6 +834,8 @@ using the ground temperature from the previous time step. In section 5.3.1, the equations used in the iteration scheme are derived. Details on the numerical scheme are provided in section 5.3.2. +.. _Theory: + Theory ^^^^^^^^^^^^ @@ -1302,6 +1310,8 @@ Table 5.1. Plant functional type aerodynamic parameters | Soybean I | 0.120 | 0.68 | 0.04 | +----------------------------------+--------------------+------------------+-------------------------+ +.. _Numerical Implementation: + Numerical Implementation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1529,6 +1539,8 @@ flux later. #. 2-m height air temperature :math:`T_{2m}` , specific humidity :math:`q_{2m}` , relative humidity :math:`RH_{2m}` \ (eqs. , , ) +.. _Update of Ground Sensible and Latent Heat Fluxes: + Update of Ground Sensible and Latent Heat Fluxes ---------------------------------------------------- @@ -1667,6 +1679,8 @@ The system balances energy as \overrightarrow{S}_{g} +\overrightarrow{S}_{v} +L_{atm} \, \downarrow -L\, \uparrow -H_{v} -H_{g} -\lambda _{vap} E_{v} -\lambda E_{g} -G=0. +.. _Saturation Vapor Pressure: + Saturation Vapor Pressure ----------------------------- diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 59751de56c..205a14c0e6 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -39,6 +39,8 @@ Figure 7.1. Hydrologic processes represented in CLM. .. image:: image1.png +.. _Canopy Water: + Canopy Water ---------------- @@ -143,678 +145,7 @@ while the fraction of the canopy that is dry and transpiring is f_{dry} =\left\{\begin{array}{l} {\frac{\left(1-f_{wet} \right)L}{L+S} \qquad L+S>0} \\ {0\qquad L+S=0} \end{array}\right\}. -Snow --------- - -The parameterizations for snow are based primarily on Anderson (1976), -country-regionplaceJordan (1991), and Dai and Zeng (1997). The snowpack -can have up to five layers. These layers are indexed in the Fortran code -as :math:`i=-4,-3,-2,-1,0` where layer :math:`i=0` is the snow layer -next to the top soil layer and layer :math:`i=-4` is the top layer of a -five-layer snow pack. Since the number of snow layers varies according -to the snow depth, we use the notation :math:`snl+1` to describe the top -layer of snow for the variable layer snow pack, where :math:`snl` is the -negative of the number of snow layers. Refer to Figure 7.2 for an -example of the snow layer structure for a three layer snow pack. - -Figure 7.2. Example of three layer snow pack (:math:`snl=-3`). - -Shown are three snow layers, :math:`i=-2`, :math:`i=-1`, and -:math:`i=0`. The layer node depth is :math:`z`, the layer interface is -:math:`z_{h}` , and the layer thickness is :math:`\Delta z`. - -.. image:: image2.png - -The state variables for snow are the mass of water :math:`w_{liq,i}` -(kg m\ :sup:`-2`), mass of ice :math:`w_{ice,i}` (kg -m\ :sup:`-2`), layer thickness :math:`\Delta z_{i}` (m), and -temperature :math:`T_{i}` (Chapter 6). The water vapor phase is -neglected. Snow can also exist in the model without being represented by -explicit snow layers. This occurs when the snowpack is less than a -specified minimum snow depth (:math:`z_{sno} <0.01` m). In this case, -the state variable is the mass of snow :math:`W_{sno}` (kg -m\ :sup:`-2`). - -Section 7.2.1 describes the calculation of fractional snow covered area, -which is used in the surface albedo calculation (Chapter 3) and the -surface flux calculations (Chapter 5). The following two sections (7.2.2 -and 7.2.3) describe the ice and water content of the snow pack assuming -that at least one snow layer exists. Section 7.2.4 describes how black -and organic carbon and mineral dust particles are represented within -snow, including meltwater flushing. See section 7.2.5 for a description -of how a snow layer is initialized. - -Snow Covered Area Fraction -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The fraction of the ground covered by snow, :math:`f_{sno}` , is based -on the method of Swenson and Lawrence (2012). Because the processes -governing snowfall and snowmelt differ, changes in :math:`f_{sno}` are -calculated separately for accumulation and depletion. When snowfall -occurs, :math:`f_{sno}` is updated as - -.. math:: - :label: 7.14) - - f^{n+1} _{sno} =1-\left(\left(1-\tanh (k_{accum} q_{sno} \Delta t)\right)\left(1-f^{n} _{sno} \right)\right) - -where :math:`k_{accum}` is a constant whose default value is 0.1, -:math:`q_{sno} \Delta t` is the amount of new snow, -:math:`f^{n+1} _{sno}` is the updated snow covered fraction (SCF), and -:math:`f^{n} _{sno}` is the SCF from the previous time step. - -When snow melt occurs, :math:`f_{sno}` is calculated from the depletion -curve - -.. math:: - :label: 7.15) - - f_{sno} =1-\left(\frac{\cos ^{-1} \left(2R_{sno} -1\right)}{\pi } \right)^{N_{melt} } - -where :math:`R_{sno}` is the ratio of :math:`W_{sno}` to the maximum -accumulated snow :math:`W_{\max }` , and :math:`N_{melt}` is a -parameter that depends on the topographic variability within the grid -cell. Whenever :math:`W_{sno}` reaches zero, :math:`W_{\max }` is -reset to zero. The depletion curve shape parameter is defined as - -.. math:: - :label: 7.16) - - N_{melt} =\frac{200}{\min \left(10,\sigma _{topo} \right)} - -The standard deviation of the elevation within a grid cell, -:math:`\sigma _{topo}` , is calculated from a high resolution DEM (a -1km DEM is used for CLM). - -Ice Content -^^^^^^^^^^^^^^^^^ - -The conservation equation for mass of ice in snow layers is - -.. math:: - :label: 7.17) - - \frac{\partial w_{ice,\, i} }{\partial t} =\left\{\begin{array}{l} {f_{sno} q_{ice,\, i-1} -\frac{\left(\Delta w_{ice,\, i} \right)_{p} }{\Delta t} \qquad i=snl+1} \\ {-\frac{\left(\Delta w_{ice,\, i} \right)_{p} }{\Delta t} \qquad i=snl+2,\ldots ,0} \end{array}\right\} - -where :math:`q_{ice,\, i-1}` is the rate of ice accumulation from -precipitation or frost or the rate of ice loss from sublimation (kg -m\ :sup:`-2` s\ :sup:`-1`) in the top layer and -:math:`{\left(\Delta w_{ice,\, i} \right)_{p} \mathord{\left/ {\vphantom {\left(\Delta w_{ice,\, i} \right)_{p} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t}` -is the change in ice due to phase change (melting rate) (section 6.2). -The term :math:`q_{ice,\, i-1}` is computed in two steps as - -.. math:: - :label: 7.18) - - q_{ice,\, i-1} =q_{grnd,\, ice} +\left(q_{frost} -q_{subl} \right) - -where :math:`q_{grnd,\, ice}` is the rate of solid precipitation -reaching the ground (section 7.1) and :math:`q_{frost}` and -:math:`q_{subl}` are gains due to frost and losses due to sublimation, -respectively (section 5.4). In the first step, immediately after -:math:`q_{grnd,\, ice}` has been determined after accounting for -interception (section 7.1), a new snow depth :math:`z_{sno}` (m) is -calculated from - -.. math:: - :label: 7.19) - - z_{sno}^{n+1} =z_{sno}^{n} +\Delta z_{sno} - -where - -.. math:: - :label: 7.20) - - \Delta z_{sno} =\frac{q_{grnd,\, ice} \Delta t}{f_{sno} \rho _{sno} } - -and :math:`\rho _{sno}` is the bulk density of newly fallen snow (kg -m\ :sup:`-3`) (CityplaceAnderson 1976) - -.. math:: - :label: 7.21) - - \rho _{sno} =\left\{\begin{array}{l} {50+1.7\left(17\right)^{1.5} \qquad T_{atm} >T_{f} +2} \\ {50+1.7\left(T_{atm} -T_{f} +15\right)^{1.5} \qquad T_{f} -15T_{f}` ). In this case, the incoming solid precipitation -is assigned to the runoff term :math:`q_{rgwl}` (section 7.7). - -In the second step, after surface fluxes and snow/soil temperatures have -been determined (Chapters 5 and 6), :math:`w_{ice,\, snl+1}` is updated -for frost or sublimation as - -.. math:: - :label: ZEqnNum863244 - - w_{ice,\, snl+1}^{n+1} =w_{ice,\, snl+1}^{n} +f_{sno} \left(q_{frost} -q_{subl} \right)\Delta t. - -If :math:`w_{ice,\, snl+1}^{n+1} <0` upon solution of equation , the ice -content is reset to zero and the liquid water content -:math:`w_{liq,\, snl+1}` is reduced by the amount required to bring -:math:`w_{ice,\, snl+1}^{n+1}` up to zero. - -The snow water equivalent :math:`W_{sno}` is capped to not exceed 1000 -kg m\ :sup:`-2`. If the addition of :math:`q_{frost}` were to -result in :math:`W_{sno} >1000` kg m\ :sup:`-2`, the frost term -:math:`q_{frost}` is instead added to the ice runoff term -:math:`q_{snwcp,\, ice}` (section 7.7). - -Water Content -^^^^^^^^^^^^^^^^^^^ - -The conservation equation for mass of water in snow layers is - -.. math:: - :label: 7.26) - - \frac{\partial w_{liq,\, i} }{\partial t} =\left(q_{liq,\, i-1} -q_{liq,\, i} \right)+\frac{\left(\Delta w_{liq,\, i} \right)_{p} }{\Delta t} - -where :math:`q_{liq,\, i-1}` is the flow of liquid water into layer -:math:`i` from the layer above, :math:`q_{liq,\, i}` is the flow of -water out of layer :math:`i` to the layer below, -:math:`{\left(\Delta w_{liq,\, i} \right)_{p} \mathord{\left/ {\vphantom {\left(\Delta w_{liq,\, i} \right)_{p} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t}` -is the change in liquid water due to phase change (melting rate) -(section 6.2). For the top snow layer only, - -.. math:: - :label: 7.27) - - q_{liq,\, i-1} =f_{sno} \left(q_{grnd,\, liq} +\left(q_{sdew} -q_{seva} \right)\right) - -where :math:`q_{grnd,\, liq}` is the rate of liquid precipitation -reaching the snow (section 7.1), :math:`q_{seva}` is the evaporation of -liquid water and :math:`q_{sdew}` is the liquid dew (section 5.4). -After surface fluxes and snow/soil temperatures have been determined -(Chapters 5 and 6), :math:`w_{liq,\, snl+1}` is updated for the liquid -precipitation reaching the ground and dew or evaporation as - -.. math:: - :label: 7.28) - - w_{liq,\, snl+1}^{n+1} =w_{liq,\, snl+1}^{n} +f_{sno} \left(q_{grnd,\, liq} +q_{sdew} -q_{seva} \right)\Delta t. - -When the liquid water within a snow layer exceeds the layer’s holding -capacity, the excess water is added to the underlying layer, limited by -the effective porosity (:math:`1-\theta _{ice}` ) of the layer. The flow -of water is assumed to be zero (:math:`q_{liq,\, i} =0`) if the -effective porosity of either of the two layers -(:math:`1-\theta _{ice,\, i} {\rm \; and\; }1-\theta _{ice,\, i+1}` ) is -less than :math:`\theta _{imp} =0.05`, the water impermeable volumetric -water content. Thus, water flow between layers, :math:`q_{liq,\, i}` , -for layers :math:`i=snl+1,\ldots ,0`, is initially calculated as - -.. math:: - :label: ZEqnNum767577 - - q_{liq,\, i} =\frac{\rho _{liq} \left[\theta _{liq,\, i} -S_{r} \left(1-\theta _{ice,\, i} \right)\right]f_{sno} \Delta z_{i} }{\Delta t} \ge 0 - -where the volumetric liquid water :math:`\theta _{liq,\, i}` and ice -:math:`\theta _{ice,\, i}` contents are - -.. math:: - :label: 7.30) - - \theta _{ice,\, i} =\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} \rho _{ice} } \le 1 - -.. math:: - :label: 7.31) - - \theta _{liq,\, i} =\frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} \rho _{liq} } \le 1-\theta _{ice,\, i} , - -and :math:`S_{r} =0.033` is the irreducible water saturation (snow -holds a certain amount of liquid water due to capillary retention after -drainage has ceased (Anderson 1976)). The water holding capacity of the -underlying layer limits the flow of water :math:`q_{liq,\, i}` -calculated in equation , unless the underlying layer is the surface soil -layer, as - -.. math:: - :label: 7.32) - - q_{liq,\, i} \le \frac{\rho _{liq} \left[1-\theta _{ice,\, i+1} -\theta _{liq,\, i+1} \right]\Delta z_{i+1} }{\Delta t} \qquad i=snl+1,\ldots ,-1. - -The liquid water content :math:`w_{liq,\, i}` is updated as - -.. math:: - :label: ZEqnNum265203 - - w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\left(q_{i-1} -q_{i} \right)\Delta t. - -Equations - are solved sequentially from top (:math:`i=snl+1`) to -bottom (:math:`i=0`) snow layer in each time step. The total flow of -liquid water reaching the soil surface is then :math:`q_{liq,\, 0}` -which is used in the calculation of surface runoff and infiltration -(section 7.3). - -Black and organic carbon and mineral dust within snow -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Particles within snow originate from atmospheric aerosol deposition -(:math:`D_{sp}` in Table 2.3 (kg m\ :sup:`-2` s\ :sup:`-1`) -and influence snow radiative transfer (sections 3.2.1, 3.2.2, and -3.3.3). Particle masses and mixing ratios are represented with a simple -mass-conserving scheme. The model maintains masses of the following -eight particle species within each snow layer: hydrophilic black carbon, -hydrophobic black carbon, hydrophilic organic carbon, hydrophobic -organic carbon, and four species of mineral dust with the following -particle sizes: 0.1-1.0, 1.0-2.5, 2.5-5.0, and 5.0-10.0 :math:`\mu m`. -Each of these species has unique optical properties (Table 3.5) and -meltwater removal efficiencies (Table 7.1). - -The black carbon and organic carbon deposition rates described in Table -2.3 are combined into four categories as follows - -.. math:: - :label: 7.34) - - D_{bc,\, hphil} =D_{bc,\, dryhphil} +D_{bc,\, wethphil} - -.. math:: - :label: 7.35) - - D_{bc,\, hphob} =D_{bc,\, dryhphob} - -.. math:: - :label: 7.36) - - D_{oc,\, hphil} =D_{oc,\, dryhphil} +D_{oc,\, wethphil} - -.. math:: - :label: 7.37) - - D_{oc,\, hphob} =D_{oc,\, dryhphob} - -Deposited particles are assumed to be instantly mixed (homogeneously) -within the surface snow layer and are added after the inter-layer water -fluxes are computed (section 7.2.3) so that some aerosol is in the top -layer after deposition and is not immediately washed out before -radiative calculations are done. Particle masses are then redistributed -each time step based on meltwater drainage through the snow column -(section 7.2.3) and snow layer combination and subdivision (section -7.2.7). The change in mass of each of the particle species -:math:`\Delta m_{sp,\, i}` (kg m\ :sup:`-2`) is - -.. math:: - :label: 7.38) - - \Delta m_{sp,\, i} =\left[k_{sp} \left(q_{liq,\, i-1} c_{sp,\, i-1} -q_{liq,\, i} c_{i} \right)+D_{sp} \right]\Delta t - -where :math:`k_{sp}` is the meltwater scavenging efficiency that is -unique for each species (Table 7.1), :math:`q_{liq,\, i-1}` is the flow -of liquid water into layer :math:`i` from the layer above, -:math:`q_{liq,\, i}` is the flow of water out of layer :math:`i` into -the layer below (kg m\ :sup:`-2` s\ :sup:`-1`) (section -7.2.3), :math:`c_{sp,\, i-1}` and :math:`c_{sp,\, i}` are the particle -mass mixing ratios in layers :math:`i-1` and :math:`i` (kg -kg\ :sup:`-1`), :math:`D_{sp}` is the atmospheric deposition rate -(zero for all layers except layer :math:`snl+1`), and :math:`\Delta t` -is the model time step (s). The particle mass mixing ratio is - -.. math:: - :label: 7.39) - - c_{i} =\frac{m_{sp,\, i} }{w_{liq,\, i} +w_{ice,\, i} } . - -Values of :math:`k_{sp}` are partially derived from experiments -published by Conway et al. (1996). Particles masses are re-distributed -proportionately with snow mass when layers are combined or divided, thus -conserving particle mass within the snow column. The mass of particles -carried out with meltwater through the bottom snow layer is assumed to -be permanently lost from the snowpack, and is not maintained within the -model. - -Table 7.1. Meltwater scavenging efficiency for particles within snow - -+------------------------------------------+-------------------+ -| Species | :math:`k_{sp}` | -+==========================================+===================+ -| Hydrophilic black carbon | 0.20 | -+------------------------------------------+-------------------+ -| Hydrophobic black carbon | 0.03 | -+------------------------------------------+-------------------+ -| Hydrophilic organic carbon | 0.20 | -+------------------------------------------+-------------------+ -| Hydrophobic organic carbon | 0.03 | -+------------------------------------------+-------------------+ -| Dust species 1 (0.1-1.0 :math:`\mu m`) | 0.02 | -+------------------------------------------+-------------------+ -| Dust species 2 (1.0-2.5 :math:`\mu m`) | 0.02 | -+------------------------------------------+-------------------+ -| Dust species 3 (2.5-5.0 :math:`\mu m`) | 0.01 | -+------------------------------------------+-------------------+ -| Dust species 4 (5.0-10.0 :math:`\mu m`) | 0.01 | -+------------------------------------------+-------------------+ - -Initialization of snow layer -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -If there are no existing snow layers (:math:`snl+1=1`) but -:math:`z_{sno} \ge 0.01` m after accounting for solid precipitation -:math:`q_{sno}` , then a snow layer is initialized (:math:`snl=-1`) as -follows - -.. math:: - :label: 7.40) - - \begin{array}{l} {\Delta z_{0} =z_{sno} } \\ {z_{o} =-0.5\Delta z_{0} } \\ {z_{h,\, -1} =-\Delta z_{0} } \\ {T_{0} =\min \left(T_{f} ,T_{atm} \right)} \\ {w_{ice,\, 0} =W_{sno} } \\ {w_{liq,\, 0} =0} \end{array}. - -Snow Compaction -^^^^^^^^^^^^^^^^^^^^^ - -Snow compaction is initiated after the soil hydrology calculations -[surface runoff (section 7.3), infiltration (section 7.3), soil water -(section 7.4), groundwater-soilwater interactions (section 7.6)] are -complete. Compaction of snow includes three types of processes: -destructive metamorphism of new snow (crystal breakdown due to wind or -thermodynamic stress); snow load or overburden (pressure); and melting -(changes in snow structure due to melt-freeze cycles plus changes in -crystals due to liquid water). The total fractional compaction rate for -each snow layer :math:`C_{R,\, i}` (s\ :sup:`-1`) is the sum of the -three compaction processes - -.. math:: - :label: 7.41) - - C_{R,\, i} =\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} =C_{R1,\, i} +C_{R2,\, i} +C_{R3,\, i} . - -Compaction is not allowed if the layer is saturated - -.. math:: - :label: 7.42) - - 1-\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} \rho _{ice} } +\frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} \rho _{liq} } \right)\le 0.001 - -or if the ice content is below a minimum value -(:math:`w_{ice,\, i} \le 0.1`). - -Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` (s\ :sub:`-1`) is temperature dependent (CityplaceAnderson 1976) - -.. math:: - :label: 7.43) - - C_{R1,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{metamorphism} =-c_{3} c_{1} c_{2} \exp \left[-c_{4} \left(T_{f} -T_{i} \right)\right] - -where :math:`c_{3} =2.777\times 10^{-6}` (s\ :sup:`-1`) is the fractional compaction rate for :math:`T_{i} =T_{f}`, :math:`c_{4} =0.04` K\ :sup:`-1`, and - -.. math:: - :label: 7.44) - - c_{1} & = 1\qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \le 100{\rm \; kg\; m}^{{\rm -3}} \\ - c_{1} & = \exp \left[-0.046\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } -100\right)\right]\qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } >100{\rm \; kg\; m}^{{\rm -3}} \\ - c_{2} & = 2\qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } >0.01 \\ - c_{2} & = 1\qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } \le 0.01 - -where -:math:`{w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` -and -:math:`{w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` -are the bulk densities of liquid water and ice (kg m\ :sup:`-3`). - -The compaction rate as a result of overburden :math:`C_{R2,\; i}` (s\ :sup:`-1`) is a linear function of the snow load pressure :math:`P_{s,\, i}` (kg m\ :sup:`-2`) (CityplaceAnderson 1976) - -.. math:: - :label: 7.45) - - C_{R2,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{overburden} =-\frac{P_{s,\, i} }{\eta } - -where :math:`\eta` is a viscosity coefficient (kg s m\ :sup:`-2`) that varies with density and temperature as - -.. math:: - :label: 7.46) - - \eta =\eta _{0} \exp \left[c_{5} \left(T_{f} -T_{i} \right)+c_{6} \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \right] - -where :math:`\eta _{0} =9\times 10^{5}` kg s m\ :sup:`-2`, and -:math:`c_{5} =0.08` K\ :sup:`-1`, :math:`c_{6} =0.023` -m\ :sup:`3` kg\ :sup:`-1` are constants. The snow load -pressure :math:`P_{s,\, i}` is calculated for each layer as the sum of -the ice :math:`w_{ice,\, i}` and liquid water contents -:math:`w_{liq,\, i}` of the layers above plus half the ice and liquid -water contents of the layer being compacted - -.. math:: - :label: 7.47) - - P_{s,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{2} +\sum _{j=snl+1}^{j=i-1}\left(w_{ice,\, j} +w_{liq,\, j} \right) . - -The compaction rate due to melting :math:`C_{R3,\; i}` (s\ :sup:`-1`) is taken to be the ratio of the change in snow ice -mass after the melting to the mass before melting - -.. math:: - :label: 7.48) - - C_{R3,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{melt} =-\frac{1}{\Delta t} \max \left(0,\frac{W_{sno,\, i}^{n} -W_{sno,\, i}^{n+1} }{W_{sno,\, i}^{n} } \right) - -and melting is identified during the phase change calculations (section -6.2). Because snow depth is defined as the average depth of the snow -covered area, the snow depth must also be updated for changes in -:math:`f_{sno}` . - -.. math:: - :label: 7.49) - - C_{R4,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{fsno} =-\frac{1}{\Delta t} \max \left(0,\frac{f_{sno,\, i}^{n} -f_{sno,\, i}^{n+1} }{f_{sno,\, i}^{n} } \right) - -The snow layer thickness after compaction is then - -.. math:: - :label: 7.50) - - \Delta z_{i}^{n+1} =\Delta z_{i}^{n} \left(1+C_{R,\, i} \Delta t\right). - -Snow Layer Combination and Subdivision -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -After the determination of snow temperature including phase change -(Chapter 6), snow hydrology (sections 7.2.2, 7.2.3, and 7.2.4), and the -compaction calculations , the number of snow layers is adjusted by -either combining or subdividing layers. The combination and subdivision -of snow layers is based on Jordan (1991). - -7.2.7.1 Combination -''''''''''''''''''' - -If a snow layer has nearly melted or if its thickness -:math:`\Delta z_{i}` is less than the prescribed minimum thickness -:math:`\Delta z_{\min }` (Table 7.2), the layer is combined with a -neighboring layer. The overlying or underlying layer is selected as the -neighboring layer according to the following rules - -#. If the top layer is being removed, it is combined with the underlying - layer - -#. If the underlying layer is not snow (i.e., it is the top soil layer), - the layer is combined with the overlying layer - -#. If the layer is nearly completely melted, the layer is combined with - the underlying layer - -#. If none of the above rules apply, the layer is combined with the - thinnest neighboring layer. - -A first pass is made through all snow layers to determine if any layer -is nearly melted (:math:`w_{ice,\, i} \le 0.1`). If so, the remaining -liquid water and ice content of layer :math:`i` is combined with the -underlying neighbor :math:`i+1` as - -.. math:: - :label: 7.51) - - w_{liq,\, i+1} =w_{liq,\, i+1} +w_{liq,\, i} - -.. math:: - :label: 7.52) - - w_{ice,\, i+1} =w_{ice,\, i+1} +w_{ice,\, i} . - -This includes the snow layer directly above the top soil layer. In this -case, the liquid water and ice content of the melted snow layer is added -to the contents of the top soil layer. The layer properties, -:math:`T_{i}` , :math:`w_{ice,\, i}` , :math:`w_{liq,\, i}` , -:math:`\Delta z_{i}` , are then re-indexed so that the layers above the -eliminated layer are shifted down by one and the number of snow layers -is decremented accordingly. - -At this point, if there are no explicit snow layers remaining -(:math:`snl=0`), the snow water equivalent :math:`W_{sno}` and snow -depth :math:`z_{sno}` are set to zero, otherwise, :math:`W_{sno}` and -:math:`z_{sno}` are re-calculated as - -.. math:: - :label: 7.53) - - W_{sno} =\sum _{i=snl+1}^{i=0}\left(w_{ice,\, i} +w_{liq,\, i} \right) - -.. math:: - :label: 7.54) - - z_{sno} =\sum _{i=snl+1}^{i=0}\Delta z_{i} . - -If the snow depth :math:`0`\ 1 | 0.03 | 0.02 | -+--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ -| 2 | 0.015 | 2 | :math:`>`\ 2 | 0.07 | 0.05 | -+--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ -| 3 | 0.025 | 3 | :math:`>`\ 3 | 0.18 | 0.11 | -+--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ -| 4 | 0.055 | 4 | :math:`>`\ 4 | 0.41 | 0.23 | -+--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ -| 5 (bottom) | 0.115 | 5 | - | - | - | -+--------------+-----------------------------+------------------+------------------+-----------------------------------------------+-----------------------------------------------+ - -The maximum snow layer thickness, :math:`\Delta z_{\max }` , depends on -the number of layers, :math:`N_{l}` and :math:`N_{u}` (section -7.2.7.2). - -7.2.7.2 Subdivision -''''''''''''''''''' - -The snow layers are subdivided when the layer thickness exceeds the -prescribed maximum thickness :math:`\Delta z_{\max }` with lower and -upper bounds that depend on the number of snow layers (Table 7.2). For -example, if there is only one layer, then the maximum thickness of that -layer is 0.03 m, however, if there is more than one layer, then the -maximum thickness of the top layer is 0.02 m. Layers are checked -sequentially from top to bottom for this limit. If there is only one -snow layer and its thickness is greater than 0.03 m (Table 7.2), the -layer is subdivided into two layers of equal thickness, liquid water and -ice contents, and temperature. If there is an existing layer below the -layer to be subdivided, the thickness :math:`\Delta z_{i}` , liquid -water and ice contents, :math:`w_{liq,\; i}` and :math:`w_{ice,\; i}` , -and temperature :math:`T_{i}` of the excess snow are combined with the -underlying layer according to equations -. If there is no underlying -layer after adjusting the layer for the excess snow, the layer is -subdivided into two layers of equal thickness, liquid water and ice -contents. The vertical snow temperature profile is maintained by -calculating the slope between the layer above the splitting layer -(:math:`T_{1}` ) and the splitting layer (:math:`T_{2}` ) and -constraining the new temperatures (:math:`T_{2}^{n+1}` , -:math:`T_{3}^{n+1}` ) to lie along this slope. The temperature of the -lower layer is first evaluated from - -.. math:: - :label: 7.62) - - T'_{3} =T_{2}^{n} -\left(\frac{T_{1}^{n} -T_{2}^{n} }{{\left(\Delta z_{1}^{n} +\Delta z_{2}^{n} \right)\mathord{\left/ {\vphantom {\left(\Delta z_{1}^{n} +\Delta z_{2}^{n} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \right)\left(\frac{\Delta z_{2}^{n+1} }{2} \right), - -then adjusted as, - -.. math:: - :label: 7.63) - - \begin{array}{l} {T_{3}^{n+1} =T_{2}^{n} \qquad T'_{3} \ge T_{f} } \\ {T_{2}^{n+1} =T_{2}^{n} +\left(\frac{T_{1}^{n} -T_{2}^{n} }{{\left(\Delta z_{1} +\Delta z_{2}^{n} \right)\mathord{\left/ {\vphantom {\left(\Delta z_{1} +\Delta z_{2}^{n} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \right)\left(\frac{\Delta z_{2}^{n+1} }{2} \right)\qquad T'_{3} T_{f} +2} \\ {50+1.7\left(T_{atm} -T_{f} +15\right)^{1.5} \qquad T_{f} -15T_{f}` ). In this case, the incoming solid precipitation +is assigned to the runoff term :math:`q_{rgwl}` (section :numref:`Runoff from glaciers and snow-capped surfaces`). + +In the second step, after surface fluxes and snow/soil temperatures have +been determined (Chapters :numref:`rst_Momentum, Sensible Heat, and Latent Heat +Fluxes` and :numref:`rst_Soil and Snow Temperatures`), +:math:`w_{ice,\, snl+1}` is updated for frost or sublimation as + +.. math:: + :label: ZEqnNum863244 + + w_{ice,\, snl+1}^{n+1} =w_{ice,\, snl+1}^{n} +f_{sno} \left(q_{frost} -q_{subl} \right)\Delta t. + +If :math:`w_{ice,\, snl+1}^{n+1} <0` upon solution of equation , the ice +content is reset to zero and the liquid water content +:math:`w_{liq,\, snl+1}` is reduced by the amount required to bring +:math:`w_{ice,\, snl+1}^{n+1}` up to zero. + +The snow water equivalent :math:`W_{sno}` is capped to not exceed 1000 +kg m\ :sup:`-2`. If the addition of :math:`q_{frost}` were to +result in :math:`W_{sno} >1000` kg m\ :sup:`-2`, the frost term +:math:`q_{frost}` is instead added to the ice runoff term +:math:`q_{snwcp,\, ice}` (section :numref:`Runoff from glaciers and snow-capped surfaces`). + +.. _Water Content: + +Water Content +^^^^^^^^^^^^^^^^^^^ + +The conservation equation for mass of water in snow layers is + +.. math:: + :label: 8.26) + + \frac{\partial w_{liq,\, i} }{\partial t} =\left(q_{liq,\, i-1} -q_{liq,\, i} \right)+\frac{\left(\Delta w_{liq,\, i} \right)_{p} }{\Delta t} + +where :math:`q_{liq,\, i-1}` is the flow of liquid water into layer +:math:`i` from the layer above, :math:`q_{liq,\, i}` is the flow of +water out of layer :math:`i` to the layer below, +:math:`{\left(\Delta w_{liq,\, i} \right)_{p} \mathord{\left/ {\vphantom {\left(\Delta w_{liq,\, i} \right)_{p} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t}` +is the change in liquid water due to phase change (melting rate) +(section :numref:`Phase Change`). For the top snow layer only, + +.. math:: + :label: 8.27) + + q_{liq,\, i-1} =f_{sno} \left(q_{grnd,\, liq} +\left(q_{sdew} -q_{seva} \right)\right) + +where :math:`q_{grnd,\, liq}` is the rate of liquid precipitation +reaching the snow (section :numref:`Canopy Water`), :math:`q_{seva}` is the +evaporation of liquid water and :math:`q_{sdew}` is the liquid dew (section +5.4). After surface fluxes and snow/soil temperatures have been determined +(Chapters :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes` and +:numref:`rst_Soil and Snow Temperatures`), :math:`w_{liq,\, snl+1}` is +updated for the liquid precipitation reaching the ground and dew or +evaporation as + +.. math:: + :label: 8.28) + + w_{liq,\, snl+1}^{n+1} =w_{liq,\, snl+1}^{n} +f_{sno} \left(q_{grnd,\, liq} +q_{sdew} -q_{seva} \right)\Delta t. + +When the liquid water within a snow layer exceeds the layer’s holding +capacity, the excess water is added to the underlying layer, limited by +the effective porosity (:math:`1-\theta _{ice}` ) of the layer. The flow +of water is assumed to be zero (:math:`q_{liq,\, i} =0`) if the +effective porosity of either of the two layers +(:math:`1-\theta _{ice,\, i} {\rm \; and\; }1-\theta _{ice,\, i+1}` ) is +less than :math:`\theta _{imp} =0.05`, the water impermeable volumetric +water content. Thus, water flow between layers, :math:`q_{liq,\, i}` , +for layers :math:`i=snl+1,\ldots ,0`, is initially calculated as + +.. math:: + :label: ZEqnNum767577 + + q_{liq,\, i} =\frac{\rho _{liq} \left[\theta _{liq,\, i} -S_{r} \left(1-\theta _{ice,\, i} \right)\right]f_{sno} \Delta z_{i} }{\Delta t} \ge 0 + +where the volumetric liquid water :math:`\theta _{liq,\, i}` and ice +:math:`\theta _{ice,\, i}` contents are + +.. math:: + :label: 8.30) + + \theta _{ice,\, i} =\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} \rho _{ice} } \le 1 + +.. math:: + :label: 8.31) + + \theta _{liq,\, i} =\frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} \rho _{liq} } \le 1-\theta _{ice,\, i} , + +and :math:`S_{r} =0.033` is the irreducible water saturation (snow +holds a certain amount of liquid water due to capillary retention after +drainage has ceased (Anderson 1976)). The water holding capacity of the +underlying layer limits the flow of water :math:`q_{liq,\, i}` +calculated in equation , unless the underlying layer is the surface soil +layer, as + +.. math:: + :label: 8.32) + + q_{liq,\, i} \le \frac{\rho _{liq} \left[1-\theta _{ice,\, i+1} -\theta _{liq,\, i+1} \right]\Delta z_{i+1} }{\Delta t} \qquad i=snl+1,\ldots ,-1. + +The liquid water content :math:`w_{liq,\, i}` is updated as + +.. math:: + :label: ZEqnNum265203 + + w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\left(q_{i-1} -q_{i} \right)\Delta t. + +Equations - are solved sequentially from top (:math:`i=snl+1`) to +bottom (:math:`i=0`) snow layer in each time step. The total flow of +liquid water reaching the soil surface is then :math:`q_{liq,\, 0}` +which is used in the calculation of surface runoff and infiltration +(sections :numref:`Surface Runoff` and :numref:`Infiltration`). + +.. _Black and organic carbon and mineral dust within snow: + +Black and organic carbon and mineral dust within snow +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Particles within snow originate from atmospheric aerosol deposition +(:math:`D_{sp}` in Table 2.3 (kg m\ :sup:`-2` s\ :sup:`-1`) +and influence snow radiative transfer (sections :numref:`Snow Albedo`, +:numref:`Snowpack Optical Properties`, and :numref:`Snow Aging`). +Particle masses and mixing ratios are represented with a simple +mass-conserving scheme. The model maintains masses of the following +eight particle species within each snow layer: hydrophilic black carbon, +hydrophobic black carbon, hydrophilic organic carbon, hydrophobic +organic carbon, and four species of mineral dust with the following +particle sizes: 0.1-1.0, 1.0-2.5, 2.5-5.0, and 5.0-10.0 :math:`\mu m`. +Each of these species has unique optical properties (Table 3.5) and +meltwater removal efficiencies (:numref:`Table Meltwater scavenging`). + +The black carbon and organic carbon deposition rates described in Table +2.3 are combined into four categories as follows + +.. math:: + :label: 8.34) + + D_{bc,\, hphil} =D_{bc,\, dryhphil} +D_{bc,\, wethphil} + +.. math:: + :label: 8.35) + + D_{bc,\, hphob} =D_{bc,\, dryhphob} + +.. math:: + :label: 8.36) + + D_{oc,\, hphil} =D_{oc,\, dryhphil} +D_{oc,\, wethphil} + +.. math:: + :label: 8.37) + + D_{oc,\, hphob} =D_{oc,\, dryhphob} + +Deposited particles are assumed to be instantly mixed (homogeneously) +within the surface snow layer and are added after the inter-layer water +fluxes are computed (section :numref:`Water Content`) so that some aerosol is in the top +layer after deposition and is not immediately washed out before radiative +calculations are done. Particle masses are then redistributed each time +step based on meltwater drainage through the snow column (section +:numref:`Water Content`) and snow layer combination and subdivision +(section :numref:`Snow Layer Combination and Subdivision`). The change in +mass of each of the particle species :math:`\Delta m_{sp,\, i}` +(kg m\ :sup:`-2`) is + +.. math:: + :label: 8.38) + + \Delta m_{sp,\, i} =\left[k_{sp} \left(q_{liq,\, i-1} c_{sp,\, i-1} -q_{liq,\, i} c_{i} \right)+D_{sp} \right]\Delta t + +where :math:`k_{sp}` is the meltwater scavenging efficiency that is +unique for each species (:numref:`Table Meltwater scavenging`), :math:`q_{liq,\, i-1}` is the flow +of liquid water into layer :math:`i` from the layer above, +:math:`q_{liq,\, i}` is the flow of water out of layer :math:`i` into +the layer below (kg m\ :sup:`-2` s\ :sup:`-1`) (section +:numref:`Water Content`), :math:`c_{sp,\, i-1}` and :math:`c_{sp,\, i}` are the particle +mass mixing ratios in layers :math:`i-1` and :math:`i` (kg +kg\ :sup:`-1`), :math:`D_{sp}` is the atmospheric deposition rate +(zero for all layers except layer :math:`snl+1`), and :math:`\Delta t` +is the model time step (s). The particle mass mixing ratio is + +.. math:: + :label: 8.39) + + c_{i} =\frac{m_{sp,\, i} }{w_{liq,\, i} +w_{ice,\, i} } . + +Values of :math:`k_{sp}` are partially derived from experiments +published by Conway et al. (1996). Particles masses are re-distributed +proportionately with snow mass when layers are combined or divided, thus +conserving particle mass within the snow column. The mass of particles +carried out with meltwater through the bottom snow layer is assumed to +be permanently lost from the snowpack, and is not maintained within the +model. + +.. _Table Meltwater scavenging: + +.. table:: Meltwater scavenging efficiency for particles within snow + + +------------------------------------------+-------------------+ + | Species | :math:`k_{sp}` | + +==========================================+===================+ + | Hydrophilic black carbon | 0.20 | + +------------------------------------------+-------------------+ + | Hydrophobic black carbon | 0.03 | + +------------------------------------------+-------------------+ + | Hydrophilic organic carbon | 0.20 | + +------------------------------------------+-------------------+ + | Hydrophobic organic carbon | 0.03 | + +------------------------------------------+-------------------+ + | Dust species 1 (0.1-1.0 :math:`\mu m`) | 0.02 | + +------------------------------------------+-------------------+ + | Dust species 2 (1.0-2.5 :math:`\mu m`) | 0.02 | + +------------------------------------------+-------------------+ + | Dust species 3 (2.5-5.0 :math:`\mu m`) | 0.01 | + +------------------------------------------+-------------------+ + | Dust species 4 (5.0-10.0 :math:`\mu m`) | 0.01 | + +------------------------------------------+-------------------+ + +.. _Initialization of snow layer: + +Initialization of snow layer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If there are no existing snow layers (:math:`snl+1=1`) but +:math:`z_{sno} \ge 0.01` m after accounting for solid precipitation +:math:`q_{sno}` , then a snow layer is initialized (:math:`snl=-1`) as +follows + +.. math:: + :label: 8.40) + + \begin{array}{l} {\Delta z_{0} =z_{sno} } \\ {z_{o} =-0.5\Delta z_{0} } \\ {z_{h,\, -1} =-\Delta z_{0} } \\ {T_{0} =\min \left(T_{f} ,T_{atm} \right)} \\ {w_{ice,\, 0} =W_{sno} } \\ {w_{liq,\, 0} =0} \end{array}. + +.. _Snow Compaction: + +Snow Compaction +^^^^^^^^^^^^^^^^^^^^^ + +Snow compaction is initiated after the soil hydrology calculations +[surface runoff (section :numref:`Surface Runoff`), infiltration (section +:numref:`Infiltration`), soil water (section :numref:`Soil Water`), +groundwater-soilwater interactions (section 8.6)] are +complete. Compaction of snow includes three types of processes: +destructive metamorphism of new snow (crystal breakdown due to wind or +thermodynamic stress); snow load or overburden (pressure); and melting +(changes in snow structure due to melt-freeze cycles plus changes in +crystals due to liquid water). The total fractional compaction rate for +each snow layer :math:`C_{R,\, i}` (s\ :sup:`-1`) is the sum of the +three compaction processes + +.. math:: + :label: 8.41) + + C_{R,\, i} =\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} =C_{R1,\, i} +C_{R2,\, i} +C_{R3,\, i} . + +Compaction is not allowed if the layer is saturated + +.. math:: + :label: 8.42) + + 1-\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} \rho _{ice} } +\frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} \rho _{liq} } \right)\le 0.001 + +or if the ice content is below a minimum value +(:math:`w_{ice,\, i} \le 0.1`). + +Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` (s\ :sub:`-1`) is temperature dependent (CityplaceAnderson 1976) + +.. math:: + :label: 8.43) + + C_{R1,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{metamorphism} =-c_{3} c_{1} c_{2} \exp \left[-c_{4} \left(T_{f} -T_{i} \right)\right] + +where :math:`c_{3} =2.777\times 10^{-6}` (s\ :sup:`-1`) is the fractional compaction rate for :math:`T_{i} =T_{f}`, :math:`c_{4} =0.04` K\ :sup:`-1`, and + +.. math:: + :label: 8.44) + + c_{1} & = 1\qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \le 100{\rm \; kg\; m}^{{\rm -3}} \\ + c_{1} & = \exp \left[-0.046\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } -100\right)\right]\qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } >100{\rm \; kg\; m}^{{\rm -3}} \\ + c_{2} & = 2\qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } >0.01 \\ + c_{2} & = 1\qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } \le 0.01 + +where +:math:`{w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` +and +:math:`{w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` +are the bulk densities of liquid water and ice (kg m\ :sup:`-3`). + +The compaction rate as a result of overburden :math:`C_{R2,\; i}` (s\ :sup:`-1`) is a linear function of the snow load pressure :math:`P_{s,\, i}` (kg m\ :sup:`-2`) (CityplaceAnderson 1976) + +.. math:: + :label: 8.45) + + C_{R2,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{overburden} =-\frac{P_{s,\, i} }{\eta } + +where :math:`\eta` is a viscosity coefficient (kg s m\ :sup:`-2`) that varies with density and temperature as + +.. math:: + :label: 8.46) + + \eta =\eta _{0} \exp \left[c_{5} \left(T_{f} -T_{i} \right)+c_{6} \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \right] + +where :math:`\eta _{0} =9\times 10^{5}` kg s m\ :sup:`-2`, and +:math:`c_{5} =0.08` K\ :sup:`-1`, :math:`c_{6} =0.023` +m\ :sup:`3` kg\ :sup:`-1` are constants. The snow load +pressure :math:`P_{s,\, i}` is calculated for each layer as the sum of +the ice :math:`w_{ice,\, i}` and liquid water contents +:math:`w_{liq,\, i}` of the layers above plus half the ice and liquid +water contents of the layer being compacted + +.. math:: + :label: 8.47) + + P_{s,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{2} +\sum _{j=snl+1}^{j=i-1}\left(w_{ice,\, j} +w_{liq,\, j} \right) . + +The compaction rate due to melting :math:`C_{R3,\; i}` (s\ :sup:`-1`) is taken to be the ratio of the change in snow ice +mass after the melting to the mass before melting + +.. math:: + :label: 8.48) + + C_{R3,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{melt} =-\frac{1}{\Delta t} \max \left(0,\frac{W_{sno,\, i}^{n} -W_{sno,\, i}^{n+1} }{W_{sno,\, i}^{n} } \right) + +and melting is identified during the phase change calculations (section +:numref:`Phase Change`). Because snow depth is defined as the average depth of the snow +covered area, the snow depth must also be updated for changes in +:math:`f_{sno}` . + +.. math:: + :label: 8.49) + + C_{R4,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{fsno} =-\frac{1}{\Delta t} \max \left(0,\frac{f_{sno,\, i}^{n} -f_{sno,\, i}^{n+1} }{f_{sno,\, i}^{n} } \right) + +The snow layer thickness after compaction is then + +.. math:: + :label: 8.50) + + \Delta z_{i}^{n+1} =\Delta z_{i}^{n} \left(1+C_{R,\, i} \Delta t\right). + +.. _Snow Layer Combination and Subdivision: + +Snow Layer Combination and Subdivision +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +After the determination of snow temperature including phase change(Chapter +:numref:`rst_Soil and Snow Temperatures`), snow hydrology (Chapter +:numref:`rst_Snow Hydrology`), and the compaction calculations (section +:numref:`Snow Compaction`) , the number of snow layers is adjusted by +either combining or subdividing layers. The combination and subdivision +of snow layers is based on Jordan (1991). + +.. _Combination: + +Combination +''''''''''''''''''' + +If a snow layer has nearly melted or if its thickness +:math:`\Delta z_{i}` is less than the prescribed minimum thickness +:math:`\Delta z_{\min }` (:numref:`Table snow layer thickness`), the layer is combined with a +neighboring layer. The overlying or underlying layer is selected as the +neighboring layer according to the following rules + +#. If the top layer is being removed, it is combined with the underlying + layer + +#. If the underlying layer is not snow (i.e., it is the top soil layer), + the layer is combined with the overlying layer + +#. If the layer is nearly completely melted, the layer is combined with + the underlying layer + +#. If none of the above rules apply, the layer is combined with the + thinnest neighboring layer. + +A first pass is made through all snow layers to determine if any layer +is nearly melted (:math:`w_{ice,\, i} \le 0.1`). If so, the remaining +liquid water and ice content of layer :math:`i` is combined with the +underlying neighbor :math:`i+1` as + +.. math:: + :label: 8.51) + + w_{liq,\, i+1} =w_{liq,\, i+1} +w_{liq,\, i} + +.. math:: + :label: 8.52) + + w_{ice,\, i+1} =w_{ice,\, i+1} +w_{ice,\, i} . + +This includes the snow layer directly above the top soil layer. In this +case, the liquid water and ice content of the melted snow layer is added +to the contents of the top soil layer. The layer properties, +:math:`T_{i}` , :math:`w_{ice,\, i}` , :math:`w_{liq,\, i}` , +:math:`\Delta z_{i}` , are then re-indexed so that the layers above the +eliminated layer are shifted down by one and the number of snow layers +is decremented accordingly. + +At this point, if there are no explicit snow layers remaining +(:math:`snl=0`), the snow water equivalent :math:`W_{sno}` and snow +depth :math:`z_{sno}` are set to zero, otherwise, :math:`W_{sno}` and +:math:`z_{sno}` are re-calculated as + +.. math:: + :label: 8.53) + + W_{sno} =\sum _{i=snl+1}^{i=0}\left(w_{ice,\, i} +w_{liq,\, i} \right) + +.. math:: + :label: 8.54) + + z_{sno} =\sum _{i=snl+1}^{i=0}\Delta z_{i} . + +If the snow depth :math:`0`\ 1 | 0.03 | 0.02 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 2 | 0.015 | 2 | :math:`>`\ 2 | 0.07 | 0.05 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 3 | 0.025 | 3 | :math:`>`\ 3 | 0.18 | 0.11 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 4 | 0.055 | 4 | :math:`>`\ 4 | 0.41 | 0.23 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 5 (bottom) | 0.115 | 5 | - | - | - | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + +The maximum snow layer thickness, :math:`\Delta z_{\max }` , depends on +the number of layers, :math:`N_{l}` and :math:`N_{u}` (section +:numref:`Subdivision`). + +.. _Subdivision: + +Subdivision +''''''''''''''''''' + +The snow layers are subdivided when the layer thickness exceeds the +prescribed maximum thickness :math:`\Delta z_{\max }` with lower and +upper bounds that depend on the number of snow layers (numref:`Table snow layer thickness`). For +example, if there is only one layer, then the maximum thickness of that +layer is 0.03 m, however, if there is more than one layer, then the +maximum thickness of the top layer is 0.02 m. Layers are checked +sequentially from top to bottom for this limit. If there is only one +snow layer and its thickness is greater than 0.03 m (:numref:`Table snow layer thickness`), the +layer is subdivided into two layers of equal thickness, liquid water and +ice contents, and temperature. If there is an existing layer below the +layer to be subdivided, the thickness :math:`\Delta z_{i}` , liquid +water and ice contents, :math:`w_{liq,\; i}` and :math:`w_{ice,\; i}` , +and temperature :math:`T_{i}` of the excess snow are combined with the +underlying layer according to equations -. If there is no underlying +layer after adjusting the layer for the excess snow, the layer is +subdivided into two layers of equal thickness, liquid water and ice +contents. The vertical snow temperature profile is maintained by +calculating the slope between the layer above the splitting layer +(:math:`T_{1}` ) and the splitting layer (:math:`T_{2}` ) and +constraining the new temperatures (:math:`T_{2}^{n+1}` , +:math:`T_{3}^{n+1}` ) to lie along this slope. The temperature of the +lower layer is first evaluated from + +.. math:: + :label: 8.62) + + T'_{3} =T_{2}^{n} -\left(\frac{T_{1}^{n} -T_{2}^{n} }{{\left(\Delta z_{1}^{n} +\Delta z_{2}^{n} \right)\mathord{\left/ {\vphantom {\left(\Delta z_{1}^{n} +\Delta z_{2}^{n} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \right)\left(\frac{\Delta z_{2}^{n+1} }{2} \right), + +then adjusted as, + +.. math:: + :label: 8.63) + + \begin{array}{l} {T_{3}^{n+1} =T_{2}^{n} \qquad T'_{3} \ge T_{f} } \\ {T_{2}^{n+1} =T_{2}^{n} +\left(\frac{T_{1}^{n} -T_{2}^{n} }{{\left(\Delta z_{1} +\Delta z_{2}^{n} \right)\mathord{\left/ {\vphantom {\left(\Delta z_{1} +\Delta z_{2}^{n} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \right)\left(\frac{\Delta z_{2}^{n+1} }{2} \right)\qquad T'_{3} Date: Fri, 19 May 2017 14:17:31 -0600 Subject: [PATCH 0015/1973] labeled references --- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 593 ++++++++-------- .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 399 +++++------ .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 267 +++----- .../tech_note/Lake/CLM50_Tech_Note_Lake.rst | 66 +- .../Offline/CLM50_Tech_Note_Offline.rst | 41 +- .../CLM50_Tech_Note_Radiative_Fluxes.rst | 4 + .../References/CLM50_Tech_Note_References.rst | 632 +++++++++++++++++- .../CLM50_Tech_Note_Snow_Hydrology.rst | 25 +- ...CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 2 +- 9 files changed, 1328 insertions(+), 701 deletions(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 888c379382..959a8cbd73 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -3,15 +3,20 @@ Surface Characterization and Model Input Requirements ======================================================== +.. _Surface Characterization: + Surface Characterization ----------------------------- +.. _Surface Heterogeneity and Data Structure: + Surface Heterogeneity and Data Structure ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Spatial land surface heterogeneity in CLM is represented as a nested subgrid hierarchy in which grid cells are composed of multiple land -units, snow/soil columns, and PFTs (Figure 2.1). Each grid cell can have +units, snow/soil columns, and PFTs (:numref:`Figure CLM subgrid hierarchy`). +Each grid cell can have a different number of land units, each land unit can have a different number of columns, and each column can have multiple PFTs. The first subgrid level, the land unit, is intended to capture the broadest @@ -43,7 +48,11 @@ single crop occupying each column. The urban land units have five columns (roof, sunlit walls and shaded walls, and pervious and impervious canyon floor) (Oleson et al. 2010b). -Figure 2.1. Configuration of the CLM subgrid hierarchy. +.. _Figure CLM subgrid hierarchy: + +.. Figure:: image1.png + + Configuration of the CLM subgrid hierarchy. Note that the Crop land unit is only used when the model is run with the crop model active. Abbreviations: TBD – Tall Building District; HD – @@ -51,8 +60,6 @@ High Density; MD – Medium Density, G – Glacier, L – Lake, U – Urban, C Crop, V – Vegetated, PFT – Plant Functional Type, I – Irrigated, U – Unirrigated . -.. image:: image1.png - The third subgrid level is referred to as the PFT level, but it also includes the treatment for bare ground. It is intended to capture the biogeophysical and biogeochemical differences between broad categories @@ -62,7 +69,7 @@ structure may coexist on a single column. All fluxes to and from the surface are defined at the PFT level, as are the vegetation state variables (e.g. vegetation temperature and canopy water storage). On the crop land unit, several different crop types can be represented on each -crop land unit column (see Chapter 20 for details). +crop land unit column (see Chapter :numref:`rst_Crops and Irrigation` for details). In addition to state and flux variable data structures for conserved components at each subgrid level (e.g., energy, water, carbon), each @@ -76,7 +83,8 @@ and the fraction of canopy that is wet are defined as physical state variables at the PFT level. The standard configuration of the model subgrid hierarchy is illustrated -in Figure 2.1. Here, only four PFTs are shown associated with the single +in :numref:`Figure CLM subgrid hierarchy`. Here, only four PFTs are shown +associated with the single column beneath the vegetated land unit but up to sixteen are possible. The crop land unit is present only when the crop model is active. @@ -90,13 +98,17 @@ by computing a weighted sum of the desired quantity over all PFTs whose weighting depends on the PFT area relative to all PFTs, unless otherwise noted in the text. +.. _Vegetation Composition: + Vegetation Composition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Vegetated surfaces are comprised of up to 15 possible plant functional -types (PFTs) plus bare ground (Table 2.1). An additional PFT is -added if the irrigation model is active and six additional PFTs are -added if the crop model is active (Chapter 20). These plant types differ +types (PFTs) plus bare ground (:numref:`Table Plant functional types`). An +additional PFT is added if +the irrigation model is active and six additional PFTs are added if the +crop model is active (Chapter :numref:`rst_Crops and Irrigation`). These +plant types differ in leaf and stem optical properties that determine reflection, transmittance, and absorption of solar radiation (Table 3.1), root distribution parameters that control the uptake of water from the soil @@ -109,129 +121,141 @@ within a grid cell can either be prescribed as time-invariant fields evolve with time if the model is run in transient landcover mode (Chapter 21). -Table 2.1. Plant functional types - -+--------------------------------------------------------------+-------------------+ -| Plant functional type | Acronym | -+==============================================================+===================+ -| Needleleaf evergreen tree – temperate | NET Temperate | -+--------------------------------------------------------------+-------------------+ -| Needleleaf evergreen tree - boreal | NET Boreal | -+--------------------------------------------------------------+-------------------+ -| Needleleaf deciduous tree – boreal | NDT Boreal | -+--------------------------------------------------------------+-------------------+ -| Broadleaf evergreen tree – tropical | BET Tropical | -+--------------------------------------------------------------+-------------------+ -| Broadleaf evergreen tree – temperate | BET Temperate | -+--------------------------------------------------------------+-------------------+ -| Broadleaf deciduous tree – tropical | BDT Tropical | -+--------------------------------------------------------------+-------------------+ -| Broadleaf deciduous tree – temperate | BDT Temperate | -+--------------------------------------------------------------+-------------------+ -| Broadleaf deciduous tree – boreal | BDT Boreal | -+--------------------------------------------------------------+-------------------+ -| Broadleaf evergreen shrub - temperate | BES Temperate | -+--------------------------------------------------------------+-------------------+ -| Broadleaf deciduous shrub – temperate | BDS Temperate | -+--------------------------------------------------------------+-------------------+ -| Broadleaf deciduous shrub – boreal | BDS Boreal | -+--------------------------------------------------------------+-------------------+ -| C\ :sub:`3` arctic grass | - | -+--------------------------------------------------------------+-------------------+ -| C\ :sub:`3` grass | - | -+--------------------------------------------------------------+-------------------+ -| C\ :sub:`4` grass | - | -+--------------------------------------------------------------+-------------------+ -| C\ :sub:`3` Unmanaged Rainfed Crop | Crop R | -+--------------------------------------------------------------+-------------------+ -| :sup:`1`\ C\ :sub:`3` Unmanaged Irrigated Crop | Crop I | -+--------------------------------------------------------------+-------------------+ -| :sup:`2`\ Rainfed Corn | Corn R | -+--------------------------------------------------------------+-------------------+ -| :sup:`2`\ Irrigated Corn | Corn I | -+--------------------------------------------------------------+-------------------+ -| :sup:`2`\ Rainfed Temperate Cereals | Temp Cereal R | -+--------------------------------------------------------------+-------------------+ -| :sup:`2`\ Irrigated Temperate Cereals | Temp Cereal I | -+--------------------------------------------------------------+-------------------+ -| :sup:`3`\ Rainfed Winter Cereals | Winter Cereal R | -+--------------------------------------------------------------+-------------------+ -| :sup:`3`\ Irrigated Winter Cereals | Winter Cereal I | -+--------------------------------------------------------------+-------------------+ -| :sup:`2`\ Rainfed Soybean | Soybean R | -+--------------------------------------------------------------+-------------------+ -| :sup:`2`\ Irrigated Soybean | Soybean I | -+--------------------------------------------------------------+-------------------+ - -:sup:`1`\ Only used if irrigation is active (Chapter 20). -:sup:`2`\ Only used if crop model is active (Chapter 20). -:sup:`3`\ Reserved for future implementations of crop model (Chapter 20). +.. _Table Plant functional types: + +.. table:: Plant functional types + + +--------------------------------------------------------------+-------------------+ + | Plant functional type | Acronym | + +==============================================================+===================+ + | Needleleaf evergreen tree – temperate | NET Temperate | + +--------------------------------------------------------------+-------------------+ + | Needleleaf evergreen tree - boreal | NET Boreal | + +--------------------------------------------------------------+-------------------+ + | Needleleaf deciduous tree – boreal | NDT Boreal | + +--------------------------------------------------------------+-------------------+ + | Broadleaf evergreen tree – tropical | BET Tropical | + +--------------------------------------------------------------+-------------------+ + | Broadleaf evergreen tree – temperate | BET Temperate | + +--------------------------------------------------------------+-------------------+ + | Broadleaf deciduous tree – tropical | BDT Tropical | + +--------------------------------------------------------------+-------------------+ + | Broadleaf deciduous tree – temperate | BDT Temperate | + +--------------------------------------------------------------+-------------------+ + | Broadleaf deciduous tree – boreal | BDT Boreal | + +--------------------------------------------------------------+-------------------+ + | Broadleaf evergreen shrub - temperate | BES Temperate | + +--------------------------------------------------------------+-------------------+ + | Broadleaf deciduous shrub – temperate | BDS Temperate | + +--------------------------------------------------------------+-------------------+ + | Broadleaf deciduous shrub – boreal | BDS Boreal | + +--------------------------------------------------------------+-------------------+ + | C\ :sub:`3` arctic grass | - | + +--------------------------------------------------------------+-------------------+ + | C\ :sub:`3` grass | - | + +--------------------------------------------------------------+-------------------+ + | C\ :sub:`4` grass | - | + +--------------------------------------------------------------+-------------------+ + | C\ :sub:`3` Unmanaged Rainfed Crop | Crop R | + +--------------------------------------------------------------+-------------------+ + | :sup:`1`\ C\ :sub:`3` Unmanaged Irrigated Crop | Crop I | + +--------------------------------------------------------------+-------------------+ + | :sup:`2`\ Rainfed Corn | Corn R | + +--------------------------------------------------------------+-------------------+ + | :sup:`2`\ Irrigated Corn | Corn I | + +--------------------------------------------------------------+-------------------+ + | :sup:`2`\ Rainfed Temperate Cereals | Temp Cereal R | + +--------------------------------------------------------------+-------------------+ + | :sup:`2`\ Irrigated Temperate Cereals | Temp Cereal I | + +--------------------------------------------------------------+-------------------+ + | :sup:`3`\ Rainfed Winter Cereals | Winter Cereal R | + +--------------------------------------------------------------+-------------------+ + | :sup:`3`\ Irrigated Winter Cereals | Winter Cereal I | + +--------------------------------------------------------------+-------------------+ + | :sup:`2`\ Rainfed Soybean | Soybean R | + +--------------------------------------------------------------+-------------------+ + | :sup:`2`\ Irrigated Soybean | Soybean I | + +--------------------------------------------------------------+-------------------+ + +:sup:`1`\ Only used if irrigation is active (Chapter :numref:`rst_Crops and Irrigation`). +:sup:`2`\ Only used if crop model is active (Chapter :numref:`rst_Crops and Irrigation`). +:sup:`3`\ Reserved for future implementations of crop model (Chapter :numref:`rst_Crops and Irrigation`). + +.. _Vegetation Structure: Vegetation Structure ^^^^^^^^^^^^^^^^^^^^^^^^^^ Vegetation structure is defined by leaf and stem area indices -(:math:`L,\, S`) and canopy top and bottom heights (:math:`z_{top}`,\ :math:`z_{bot}` ) (Table 2.2). Separate leaf and -stem area indices and canopy heights are prescribed or calculated for each PFT. Daily leaf and stem area indices are obtained from gridded -datasets of monthly values (section 2.2.3). Canopy top and bottom heights are also obtained from gridded datasets. However, these are -currently invariant in space and time and were obtained from PFT-specific values (Bonan et al. 2002a). When the biogeochemistry model -is active, vegetation state (LAI, SAI, canopy top and bottom heights) are calculated prognostically (see Chapter 14). - -Table 2.2. Prescribed plant functional type heights - -+-----------------------------------+------------------------+------------------------+ -| Plant functional type | :math:`z_{top}` (m) | :math:`z_{bot}` (m) | -+===================================+========================+========================+ -| NET Temperate | 17 | 8.5 | -+-----------------------------------+------------------------+------------------------+ -| NET Boreal | 17 | 8.5 | -+-----------------------------------+------------------------+------------------------+ -| NDT Boreal | 14 | 7 | -+-----------------------------------+------------------------+------------------------+ -| BET Tropical | 35 | 1 | -+-----------------------------------+------------------------+------------------------+ -| BET temperate | 35 | 1 | -+-----------------------------------+------------------------+------------------------+ -| BDT tropical | 18 | 10 | -+-----------------------------------+------------------------+------------------------+ -| BDT temperate | 20 | 11.5 | -+-----------------------------------+------------------------+------------------------+ -| BDT boreal | 20 | 11.5 | -+-----------------------------------+------------------------+------------------------+ -| BES temperate | 0.5 | 0.1 | -+-----------------------------------+------------------------+------------------------+ -| BDS temperate | 0.5 | 0.1 | -+-----------------------------------+------------------------+------------------------+ -| BDS boreal | 0.5 | 0.1 | -+-----------------------------------+------------------------+------------------------+ -| C\ :math:`{}_{3}` arctic grass | 0.5 | 0.01 | -+-----------------------------------+------------------------+------------------------+ -| C\ :math:`{}_{3}` grass | 0.5 | 0.01 | -+-----------------------------------+------------------------+------------------------+ -| C\ :math:`{}_{4}` grass | 0.5 | 0.01 | -+-----------------------------------+------------------------+------------------------+ -| Crop R | 0.5 | 0.01 | -+-----------------------------------+------------------------+------------------------+ -| Crop I | 0.5 | 0.01 | -+-----------------------------------+------------------------+------------------------+ -| :sup:`1`\ Corn R | - | - | -+-----------------------------------+------------------------+------------------------+ -| :sup:`1`\ Corn I | - | - | -+-----------------------------------+------------------------+------------------------+ -| :sup:`1`\ Temp Cereal R | - | - | -+-----------------------------------+------------------------+------------------------+ -| :sup:`1`\ Temp Cereal I | - | - | -+-----------------------------------+------------------------+------------------------+ -| :sup:`1`\ Winter Cereal R | - | - | -+-----------------------------------+------------------------+------------------------+ -| :sup:`1`\ Winter Cereal I | - | - | -+-----------------------------------+------------------------+------------------------+ -| :sup:`1`\ Soybean R | - | - | -+-----------------------------------+------------------------+------------------------+ -| :sup:`1`\ Soybean I | - | - | -+-----------------------------------+------------------------+------------------------+ - -:sup:`1`\ Determined by the crop model (Chapter 20) +(:math:`L,\, S`) and canopy top and bottom heights (:math:`z_{top}`,\ :math:`z_{bot}` ) +(:numref:`Table Prescribed plant functional type heights`). Separate leaf and +stem area indices and canopy heights are prescribed or calculated for each PFT. Daily leaf +and stem area indices are obtained from griddeddatasets of monthly values (section +:numref:`Surface Data`). Canopy top and bottom heights are also obtained from gridded datasets. +However, these are currently invariant in space and time and were obtained from PFT-specific +values (:ref:`Bonan et al. 2002a `). When the biogeochemistry model is active, +vegetation state (LAI, SAI, canopy top and bottom heights) are calculated prognostically +(see Chapter :numref:`rst_Vegetation Phenology and Turnover`). + +.. _Table Prescribed plant functional type heights: + +.. table:: Prescribed plant functional type heights + + +-----------------------------------+------------------------+------------------------+ + | Plant functional type | :math:`z_{top}` (m) | :math:`z_{bot}` (m) | + +===================================+========================+========================+ + | NET Temperate | 17 | 8.5 | + +-----------------------------------+------------------------+------------------------+ + | NET Boreal | 17 | 8.5 | + +-----------------------------------+------------------------+------------------------+ + | NDT Boreal | 14 | 7 | + +-----------------------------------+------------------------+------------------------+ + | BET Tropical | 35 | 1 | + +-----------------------------------+------------------------+------------------------+ + | BET temperate | 35 | 1 | + +-----------------------------------+------------------------+------------------------+ + | BDT tropical | 18 | 10 | + +-----------------------------------+------------------------+------------------------+ + | BDT temperate | 20 | 11.5 | + +-----------------------------------+------------------------+------------------------+ + | BDT boreal | 20 | 11.5 | + +-----------------------------------+------------------------+------------------------+ + | BES temperate | 0.5 | 0.1 | + +-----------------------------------+------------------------+------------------------+ + | BDS temperate | 0.5 | 0.1 | + +-----------------------------------+------------------------+------------------------+ + | BDS boreal | 0.5 | 0.1 | + +-----------------------------------+------------------------+------------------------+ + | C\ :math:`{}_{3}` arctic grass | 0.5 | 0.01 | + +-----------------------------------+------------------------+------------------------+ + | C\ :math:`{}_{3}` grass | 0.5 | 0.01 | + +-----------------------------------+------------------------+------------------------+ + | C\ :math:`{}_{4}` grass | 0.5 | 0.01 | + +-----------------------------------+------------------------+------------------------+ + | Crop R | 0.5 | 0.01 | + +-----------------------------------+------------------------+------------------------+ + | Crop I | 0.5 | 0.01 | + +-----------------------------------+------------------------+------------------------+ + | :sup:`1`\ Corn R | - | - | + +-----------------------------------+------------------------+------------------------+ + | :sup:`1`\ Corn I | - | - | + +-----------------------------------+------------------------+------------------------+ + | :sup:`1`\ Temp Cereal R | - | - | + +-----------------------------------+------------------------+------------------------+ + | :sup:`1`\ Temp Cereal I | - | - | + +-----------------------------------+------------------------+------------------------+ + | :sup:`1`\ Winter Cereal R | - | - | + +-----------------------------------+------------------------+------------------------+ + | :sup:`1`\ Winter Cereal I | - | - | + +-----------------------------------+------------------------+------------------------+ + | :sup:`1`\ Soybean R | - | - | + +-----------------------------------+------------------------+------------------------+ + | :sup:`1`\ Soybean I | - | - | + +-----------------------------------+------------------------+------------------------+ + +:sup:`1`\ Determined by the crop model (Chapter :numref:`rst_Crops and Irrigation`) + +.. _Phenology and vegetation burial by snow: Phenology and vegetation burial by snow ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -266,67 +290,74 @@ where :math:`z_{sno} -z_{bot} \ge 0,{\rm \; }0\le f_{veg}^{sno} \le 1`, :math:`z and stem area are set to zero if less than 0.05. If the sum of exposed leaf and stem area is zero, then the surface is treated as snow-covered ground. +.. _Model Input Requirements: + Model Input Requirements ---------------------------- +.. _Atmospheric Coupling: + Atmospheric Coupling ^^^^^^^^^^^^^^^^^^^^^^^^^^ -The current state of the atmosphere (Table 2.3) at a given time step is +The current state of the atmosphere (:numref:`Table Atmospheric input to land model`) +at a given time step is used to force the land model. This atmospheric state is provided by an atmospheric model in coupled mode or from an observed dataset in offline -mode (Chapter 26). The land model then initiates a full set of +mode (Chapter :numref:`rst_Offline Mode`). The land model then initiates a full set of calculations for surface energy, constituent, momentum, and radiative fluxes. The land model calculations are implemented in two steps. The land model proceeds with the calculation of surface energy, constituent, momentum, and radiative fluxes using the snow and soil hydrologic states from the previous time step. The land model then updates the soil and snow hydrology calculations based on these fluxes. These fields are -passed to the atmosphere (Table 2.4). The albedos sent to the atmosphere +passed to the atmosphere (:numref:`Table Land model output to atmospheric model`). The albedos sent to the atmosphere are for the solar zenith angle at the next time step but with surface conditions from the current time step. -Table 2.3. Atmospheric input to land model - -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Field | variable name | units | -+======================================================+================================================+=================================================+ -| :sup:`1`\ Reference height | :math:`z'_{atm}` | m | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Zonal wind at :math:`z_{atm}` | :math:`u_{atm}` | m s\ :sup:`-1` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Meridional wind at :math:`z_{atm}` | :math:`v_{atm}` | m s\ :sup:`-1` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Potential temperature | :math:`\overline{\theta _{atm} }` | K | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Specific humidity at :math:`z_{atm}` | :math:`q_{atm}` | kg kg\ :sup:`-1` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Pressure at :math:`z_{atm}` | :math:`P_{atm}` | Pa | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Temperature at :math:`z_{atm}` | :math:`T_{atm}` | K | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident longwave radiation | :math:`L_{atm} \, \downarrow` | W m\ :sup:`-2` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :sup:`2`\ Liquid precipitation | :math:`q_{rain}` | mm s\ :sup:`-1` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :sup:`2`\ Solid precipitation | :math:`q_{sno}` | mm s\ :sup:`-1` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident direct beam visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}^{\mu }` | W m\ :sup:`-2` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident direct beam near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}^{\mu }` | W m\ :sup:`-2` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident diffuse visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}` | W m\ :sup:`-2` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Incident diffuse near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}` | W m\ :sup:`-2` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| Carbon dioxide (CO:sub:`2`) concentration | :math:`c_{a}` | ppmv | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :sup:`3`\ Aerosol deposition rate | :math:`D_{sp}` | kg m\ :sup:`-2` s\ :sup:`-1` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :sup:`4`\ Nitrogen deposition rate | :math:`NF_{ndep\_ s{\it min}n}` | g (N) m\ :sup:`-2` yr\ :sup:`-1` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ -| :sup:`5`\ Lightning frequency | :math:`I_{l}` | flash km\ :sup:`-2` hr\ :sup:`-1` | -+------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ +.. _Table Atmospheric input to land model: + +.. table:: Atmospheric input to land model + + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Field | variable name | units | + +======================================================+================================================+=================================================+ + | :sup:`1`\ Reference height | :math:`z'_{atm}` | m | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Zonal wind at :math:`z_{atm}` | :math:`u_{atm}` | m s\ :sup:`-1` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Meridional wind at :math:`z_{atm}` | :math:`v_{atm}` | m s\ :sup:`-1` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Potential temperature | :math:`\overline{\theta _{atm} }` | K | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Specific humidity at :math:`z_{atm}` | :math:`q_{atm}` | kg kg\ :sup:`-1` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Pressure at :math:`z_{atm}` | :math:`P_{atm}` | Pa | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Temperature at :math:`z_{atm}` | :math:`T_{atm}` | K | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Incident longwave radiation | :math:`L_{atm} \, \downarrow` | W m\ :sup:`-2` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | :sup:`2`\ Liquid precipitation | :math:`q_{rain}` | mm s\ :sup:`-1` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | :sup:`2`\ Solid precipitation | :math:`q_{sno}` | mm s\ :sup:`-1` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Incident direct beam visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}^{\mu }` | W m\ :sup:`-2` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Incident direct beam near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}^{\mu }` | W m\ :sup:`-2` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Incident diffuse visible solar radiation | :math:`S_{atm} \, \downarrow _{vis}` | W m\ :sup:`-2` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Incident diffuse near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}` | W m\ :sup:`-2` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Carbon dioxide (CO:sub:`2`) concentration | :math:`c_{a}` | ppmv | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | :sup:`3`\ Aerosol deposition rate | :math:`D_{sp}` | kg m\ :sup:`-2` s\ :sup:`-1` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | :sup:`4`\ Nitrogen deposition rate | :math:`NF_{ndep\_ s{\it min}n}` | g (N) m\ :sup:`-2` yr\ :sup:`-1` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | :sup:`5`\ Lightning frequency | :math:`I_{l}` | flash km\ :sup:`-2` hr\ :sup:`-1` | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ :sup:`1`\ The atmospheric reference height received from the atmospheric model :math:`z'_{atm}` is assumed to be the height above @@ -388,7 +419,7 @@ required but is calculated directly from :math:`\rho _{atm} =\frac{P_{atm} -0.378e_{atm} }{R_{da} T_{atm} }` where :math:`P_{atm}` is atmospheric pressure (Pa), :math:`e_{atm}` is atmospheric vapor pressure (Pa), :math:`R_{da}` is the gas constant for -dry air (J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), and +dry air (J kg\ :sup:`-1` K\ :sup:`-1`) (:numref:`Table Physical constants`), and :math:`T_{atm}` is the atmospheric temperature (K). The atmospheric vapor pressure :math:`e_{atm}` is derived from atmospheric specific humidity :math:`q_{atm}` (kg kg\ :sup:`-1`) as @@ -398,59 +429,63 @@ The O\ :sub:`2` partial pressure (Pa) is required but is calculated from molar ratio and the atmospheric pressure :math:`P_{atm}` as :math:`o_{i} =0.209P_{atm}` . -Table 2.4. Land model output to atmospheric model - -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Field | Variable name | units | -+=======================================+================================================+==============================================================+ -| :sup:`1`\ Latent heat flux | :math:`\lambda _{vap} E_{v} +\lambda E_{g}` | W m\ :sup:`-2` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Sensible heat flux | :math:`H_{v} +H_{g}` | W m\ :sup:`-2` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Water vapor flux | :math:`E_{v} +E_{g}` | mm s\ :sup:`-1` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Zonal momentum flux | :math:`\tau _{x}` | kg m\ :sup:`-1` s\ :sup:`-2` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Meridional momentum flux | :math:`\tau _{y}` | kg m\ :sup:`-1` s\ :sup:`-2` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Emitted longwave radiation | :math:`L\, \uparrow` | W m\ :sup:`-2` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Direct beam visible albedo | :math:`I\, \uparrow _{vis}^{\mu }` | - | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Direct beam near-infrared albedo | :math:`I\, \uparrow _{nir}^{\mu }` | - | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Diffuse visible albedo | :math:`I\, \uparrow _{vis}` | - | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Diffuse near-infrared albedo | :math:`I\, \uparrow _{nir}` | - | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Absorbed solar radiation | :math:`\vec{S}` | W m\ :sup:`-2` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Radiative temperature | :math:`T_{rad}` | K | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Temperature at 2 meter height | :math:`T_{2m}` | K | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Specific humidity at 2 meter height | :math:`q_{2m}` | kg kg\ :sup:`-1` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Snow water equivalent | :math:`W_{sno}` | m | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Aerodynamic resistance | :math:`r_{am}` | s m\ :sup:`-1` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Friction velocity | :math:`u_{*}` | m s\ :sup:`-1` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| :sup:`2`\ Dust flux | :math:`F_{j}` | kg m\ :sup:`-2` s\ :sup:`-1` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ -| Net ecosystem exchange | NEE | kgCO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1` | -+---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ +.. _Table Land model output to atmospheric model: + +.. table:: Land model output to atmospheric model + + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Field | Variable name | units | + +=======================================+================================================+==============================================================+ + | :sup:`1`\ Latent heat flux | :math:`\lambda _{vap} E_{v} +\lambda E_{g}` | W m\ :sup:`-2` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Sensible heat flux | :math:`H_{v} +H_{g}` | W m\ :sup:`-2` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Water vapor flux | :math:`E_{v} +E_{g}` | mm s\ :sup:`-1` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Zonal momentum flux | :math:`\tau _{x}` | kg m\ :sup:`-1` s\ :sup:`-2` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Meridional momentum flux | :math:`\tau _{y}` | kg m\ :sup:`-1` s\ :sup:`-2` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Emitted longwave radiation | :math:`L\, \uparrow` | W m\ :sup:`-2` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Direct beam visible albedo | :math:`I\, \uparrow _{vis}^{\mu }` | - | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Direct beam near-infrared albedo | :math:`I\, \uparrow _{nir}^{\mu }` | - | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Diffuse visible albedo | :math:`I\, \uparrow _{vis}` | - | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Diffuse near-infrared albedo | :math:`I\, \uparrow _{nir}` | - | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Absorbed solar radiation | :math:`\vec{S}` | W m\ :sup:`-2` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Radiative temperature | :math:`T_{rad}` | K | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Temperature at 2 meter height | :math:`T_{2m}` | K | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Specific humidity at 2 meter height | :math:`q_{2m}` | kg kg\ :sup:`-1` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Snow water equivalent | :math:`W_{sno}` | m | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Aerodynamic resistance | :math:`r_{am}` | s m\ :sup:`-1` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Friction velocity | :math:`u_{*}` | m s\ :sup:`-1` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | :sup:`2`\ Dust flux | :math:`F_{j}` | kg m\ :sup:`-2` s\ :sup:`-1` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Net ecosystem exchange | NEE | kgCO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ :sup:`1`\ :math:`\lambda _{vap}` is the latent heat of -vaporization (J kg\ :sup:`-1`) (Table 2.6) and :math:`\lambda` is +vaporization (J kg\ :sup:`-1`) (:numref:`Table Physical constants`) and :math:`\lambda` is either the latent heat of vaporization :math:`\lambda _{vap}` or latent heat of sublimation :math:`\lambda _{sub}` (J kg\ :sup:`-1`) -(Table 2.6) depending on the liquid water and ice content of the top +(:numref:`Table Physical constants`) depending on the liquid water and ice content of the top snow/soil layer (section 5.4). :sup:`2`\ There are :math:`j=1,\ldots ,4` dust transport bins. +.. _Initialization: + Initialization ^^^^^^^^^^^^^^^^^^^^ @@ -504,16 +539,19 @@ ice contents are initialized as :math:`w_{liq,\, i} =0` and :math:`w_{liq,\, i} =\Delta z_{i} \rho _{liq} \theta _{i}` and :math:`w_{ice,\, i} =0` for :math:`T_{i} >T_{f}` , where :math:`\rho _{ice}` and :math:`\rho _{liq}` are the densities of ice -and liquid water (kg m\ :sup:`-3`) (Table 2.6), and :math:`T_{f}` -is the freezing temperature of water (K) (Table 2.6). All vegetated and +and liquid water (kg m\ :sup:`-3`) (:numref:`Table Physical constants`), and :math:`T_{f}` +is the freezing temperature of water (K) (:numref:`Table Physical constants`). All vegetated and glacier land units are initialized with water stored in the unconfined aquifer and unsaturated soil :math:`W_{a} =4000` mm and water table depth :math:`z_{\nabla }` at five meters below the soil column. +.. _Surface Data: + Surface Data ^^^^^^^^^^^^^^^^^^ -Required surface data for each land grid cell are listed in Table 2.5 +Required surface data for each land grid cell are listed in +:numref:`Table Surface data required for CLM and their base spatial resolution` and include the glacier, lake, and urban fractions of the grid cell (vegetated and crop occupy the remainder), the fractional cover of each plant functional type (PFT), monthly leaf and stem area index and canopy @@ -523,53 +561,55 @@ elevation, biogenic volatile organic compounds (BVOCs) emissions factors, population density, gross domestic production, peat area fraction, and peak month of agricultural burning. Optional surface data include crop irrigation and managed crops. All fields are aggregated to -the model’s grid from high-resolution input datasets (Table 2.5) that +the model’s grid from high-resolution input datasets ( +:numref:`Table Surface data required for CLM and their base spatial resolution`) that are obtained from a variety of sources described below. -Table 2.5. Surface data required for CLM and their base spatial -resolution - -+--------------------------------------------+---------------------------+ -| Surface Field | Resolution | -+============================================+===========================+ -| Percent glacier | 0.05\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Percent lake and lake depth | 0.05\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Percent urban | 0.05\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Percent plant functional types (PFTs) | 0.05\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Monthly leaf and stem area index | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Canopy height (top, bottom) | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Soil color | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Percent sand, percent clay | 0.083\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Soil organic matter density | 0.083\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Maximum fractional saturated area | 0.125\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Elevation | 1km | -+--------------------------------------------+---------------------------+ -| Slope | 1km | -+--------------------------------------------+---------------------------+ -| Biogenic Volatile Organic Compounds | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Crop Irrigation | 0.083\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Managed crops | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Population density | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Gross domestic production | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Peat area fraction | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ -| Peak month of agricultural waste burning | 0.5\ :sup:`o` | -+--------------------------------------------+---------------------------+ +.. _Table Surface data required for CLM and their base spatial resolution: + +.. table:: Surface data required for CLM and their base spatial resolution + + +--------------------------------------------+---------------------------+ + | Surface Field | Resolution | + +============================================+===========================+ + | Percent glacier | 0.05\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Percent lake and lake depth | 0.05\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Percent urban | 0.05\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Percent plant functional types (PFTs) | 0.05\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Monthly leaf and stem area index | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Canopy height (top, bottom) | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Soil color | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Percent sand, percent clay | 0.083\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Soil organic matter density | 0.083\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Maximum fractional saturated area | 0.125\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Elevation | 1km | + +--------------------------------------------+---------------------------+ + | Slope | 1km | + +--------------------------------------------+---------------------------+ + | Biogenic Volatile Organic Compounds | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Crop Irrigation | 0.083\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Managed crops | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Population density | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Gross domestic production | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Peat area fraction | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ + | Peak month of agricultural waste burning | 0.5\ :sup:`o` | + +--------------------------------------------+---------------------------+ At the base spatial resolution of 0.05\ :sup:`o`, the percentage of each PFT is defined with respect to the vegetated portion of the grid @@ -669,7 +709,7 @@ of Emissions of Gases and Aerosols from Nature version 2.1 (MEGAN2.1; Guenther et al. 2012). The default list of PFTs includes an unmanaged crop treated as a second -C3 grass (Table 2.1). The unmanaged crop has grid cell fractional cover +C3 grass (:numref:`Table Plant functional types`). The unmanaged crop has grid cell fractional cover assigned from MODIS satellite data (Lawrence and Chase 2007). A managed crop option uses grid cell fractional cover from the present-day crop dataset of Ramankutty and Foley (1998) (CLM4CNcrop). Managed crops are @@ -695,12 +735,12 @@ not share soil columns and thus permit for differences in land management between crops. CLM includes the option to irrigate cropland areas that are equipped for -irrigation. The application of irrigation responds dynamically to -climate (see Chapter 20). In CLM, irrigation is implemented for the C3 +irrigation. The application of irrigation responds dynamically to climate +(see Chapter :numref:`rst_Crops and Irrigation`). In CLM, irrigation is +implemented for the C3 generic crop only. When irrigation is enabled, the cropland area of each grid cell is divided into an irrigated and unirrigated fraction -according to a dataset of areas equipped for irrigation (Siebert et al. -2005). The area of irrigated cropland in each grid cell is given by the +according to a dataset of areas equipped for irrigation (:ref:`Siebert et al. (2005) `). The area of irrigated cropland in each grid cell is given by the smaller of the grid cell’s total cropland area, according to the default CLM4 dataset, and the grid cell’s area equipped for irrigation. The remainder of the grid cell’s cropland area (if any) is then assigned to @@ -708,7 +748,7 @@ unirrigated cropland. Irrigated and unirrigated crops are placed on separate soil columns, so that irrigation is only applied to the soil beneath irrigated crops. -Several input datasets are required for the fire model (Li et al. 2013a) +Several input datasets are required for the fire model (:ref:`Li et al. 2013a `) including population density, gross domestic production, peat area fraction, and peak month of agricultural waste burning. Population density at 0.5\ :sup:`o` resolution for 1850-2100 combines 5-min @@ -730,6 +770,8 @@ Global Lakes and Wetlands Database (GLWD) (Lehner and Döll, 2004). The climatological peak month for agricultural waste burning is from van der Werf et al. (2010). +.. _Adjustable Parameters and Physical Constants: + Adjustable Parameters and Physical Constants ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -737,10 +779,13 @@ Values of certain adjustable parameters inherent in the biogeophysical or biogeochemical parameterizations have either been obtained from the literature or calibrated based on comparisons with observations. These are described in the text. Physical constants, generally shared by all -of the components in the coupled modeling system, are presented in Table -2.6. +of the components in the coupled modeling system, are presented in +:numref:`Table Physical constants`. + + +.. _Table Physical constants: -.. csv-table:: Table 2.6. Physical constants +.. csv-table:: Physical constants :header: "description", "name", "value", "units" :widths: 40, 20, 20, 20 diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 868d8409a6..0bfdaf6217 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -63,7 +63,7 @@ to sensible heat and water vapor transfer between the atmosphere at heights :math:`z_{atm,\, h}` and :math:`z_{atm,\, w}` and the surface at heights :math:`z_{0h} +d` and :math:`z_{0w} +d`, respectively. The specific heat capacity of air :math:`C_{p}` (J kg\ :sup:`-1` -K\ :sup:`-1`) is a constant (Table 2.6). The atmospheric potential +K\ :sup:`-1`) is a constant (:numref:`Table Physical constants`). The atmospheric potential temperature used here is .. math:: @@ -78,7 +78,7 @@ expression is first-order equivalent to :math:`\theta _{atm} =T_{atm} \left({P_{srf} \mathord{\left/ {\vphantom {P_{srf} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } \right)^{{R_{da} \mathord{\left/ {\vphantom {R_{da} C_{p} }} \right. \kern-\nulldelimiterspace} C_{p} } }` (Stull 1988), where :math:`P_{srf}` is the surface pressure (Pa), :math:`P_{atm}` is the atmospheric pressure (Pa), and :math:`R_{da}` -is the gas constant for dry air (J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6)]. By definition, +is the gas constant for dry air (J kg\ :sup:`-1` K\ :sup:`-1`) (:numref:`Table Physical constants`)]. By definition, :math:`\theta _{s} =T_{s}` . The density of moist air (kg m\ :sup:`-3`) is .. math:: @@ -130,7 +130,7 @@ where :math:`z` is height in the surface layer (m), :math:`d` is the displacement height (m), :math:`L` is the Monin-Obukhov length scale (m) that accounts for buoyancy effects resulting from vertical density gradients (i.e., the atmospheric stability), k is the von Karman -constant (Table 2.6), and :math:`\left|{\it u}\right|` is the +constant (:numref:`Table Physical constants`), and :math:`\left|{\it u}\right|` is the atmospheric wind speed (m s\ :sup:`-1`). :math:`\phi _{m}` , :math:`\phi _{h}` , and :math:`\phi _{w}` are universal (over any surface) similarity functions of :math:`\zeta` that relate the constant @@ -171,7 +171,7 @@ defined as L=-\frac{u_{*}^{3} }{k\left(\frac{g}{\overline{\theta _{v,\, atm} }} \right)\theta '_{v} w'} =\frac{u_{*}^{2} \overline{\theta _{v,\, atm} }}{kg\theta _{v*} } where :math:`g` is the acceleration of gravity (m s\ :sup:`-2`) -(Table 2.6), and +(:numref:`Table Physical constants`), and :math:`\overline{\theta _{v,\, atm} }=\overline{\theta _{atm} }\left(1+0.61q_{atm} \right)` is the reference virtual potential temperature. :math:`L>0` indicates stable conditions. :math:`L<0` indicates unstable conditions. @@ -186,7 +186,7 @@ stable conditions. :math:`L<0` indicates unstable conditions. where :math:`\overline{\theta _{atm} }` is the atmospheric potential temperature. -Following Panofsky and Dutton (1984), the differential equations for +Following :ref:`Panofsky and Dutton (1984)`, the differential equations for :math:`\phi _{m} \left(\zeta \right)`, :math:`\phi _{h} \left(\zeta \right)`, and :math:`\phi _{w} \left(\zeta \right)` can be integrated formally without @@ -292,15 +292,14 @@ where :math:`w_{\*}` is the convective velocity scale :math:`z_{i} =1000` is the convective boundary layer height (m), and :math:`\beta =1`. -The momentum flux gradient relations are (Zeng et al. 1998) +The momentum flux gradient relations are (:ref:`Zeng et al. 1998 `) .. math:: :label: 5.30 \begin{array}{l} {\phi _{m} \left(\zeta \right)=0.7k^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \left(-\zeta \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } \qquad {\rm for\; }\zeta <-1.574{\rm \; (very\; unstable)}} \\ {\phi _{m} \left(\zeta \right)=\left(1-16\zeta \right)^{-{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} } \qquad {\rm for\; -1.574}\le \zeta <0{\rm \; (unstable)}} \\ {\phi _{m} \left(\zeta \right)=1+5\zeta \qquad {\rm for\; }0\le \zeta \le 1{\rm \; (stable)}} \\ {\phi _{m} \left(\zeta \right)=5+\zeta \qquad {\rm for\; }\zeta {\rm >1\; (very\; stable).}} \end{array} -The sensible and latent heat flux gradient relations are (Zeng et al. -1998) +The sensible and latent heat flux gradient relations are (:ref:`Zeng et al. 1998 `) .. math:: :label: 5.31 @@ -316,7 +315,7 @@ for very unstable and unstable conditions at :math:`\zeta _{m} =-1.574` for :math:`\phi _{m} \left(\zeta \right)` and :math:`\zeta _{h} =\zeta _{w} =-0.465` for :math:`\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)` -(Zeng et al. 1998). The flux gradient relations can be integrated to +(:ref:`Zeng et al. 1998 `). The flux gradient relations can be integrated to yield wind profiles for the following conditions: Very unstable :math:`\left(\zeta <-1.574\right)` @@ -440,7 +439,7 @@ bulk Richardson number R_{iB} =\frac{\theta _{v,\, atm} -\theta _{v,\, s} }{\overline{\theta _{v,\, atm} }} \frac{g\left(z_{atm,\, m} -d\right)}{V_{a}^{2} } -is related to :math:`\zeta` (Arya 2001) as +is related to :math:`\zeta` (:ref:`Arya 2001 `) as .. math:: :label: 5.47 @@ -460,7 +459,7 @@ guess for :math:`\zeta` and thus :math:`L` from \label{ZEqnNum979946} \begin{array}{l} {\zeta =\frac{R_{iB} \ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)}{1-5\min \left(R_{iB} ,0.19\right)} \qquad 0.01\le \zeta \le 2\qquad {\rm for\; }R_{iB} \ge 0{\rm \; (neutral\; or\; stable)}} \\ {\zeta =R_{iB} \ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)\qquad -100\le \zeta \le -0.01\qquad {\rm for\; }R_{iB} <0{\rm \; (unstable)}} \end{array}. -Upon iteration (section 5.3.2), the following is used to determine +Upon iteration (section :numref:`Numerical Implementation`), the following is used to determine :math:`\zeta` and thus :math:`L` .. math:: @@ -545,11 +544,11 @@ Relative humidity is RH_{2m} =\min \left(100,\, \frac{q_{2m} }{q_{sat}^{T_{2m} } } \times 100\right) where :math:`q_{sat}^{T_{2m} }` is the saturated specific humidity at -the 2-m temperature :math:`T_{2m}` (section 5.5). +the 2-m temperature :math:`T_{2m}` (section :numref:`Saturation Vapor Pressure`). A 10-m wind speed is calculated as (note that this is not consistent with the 10-m wind speed calculated for the dust model as described in -Chapter 24) +Chapter :numref:`rst_Dust Model`) .. math:: :label: 5.61 @@ -562,12 +561,13 @@ Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces -------------------------------------------------------------- Surfaces are considered non-vegetated for the surface flux calculations -if leaf plus stem area index :math:`L+S<0.05` (section 2.1.4). By +if leaf plus stem area index :math:`L+S<0.05` (section +:numref:`Phenology and vegetation burial by snow`). By definition, this includes bare soil, wetlands, and glaciers. The -solution for lakes is described in Chapter 9. For these surfaces, the +solution for lakes is described in Chapter :numref:`rst_Lake Model`. For these surfaces, the surface may be exposed to the atmosphere, snow covered, and/or surface water covered, so that the sensible heat flux :math:`H_{g}` (W -m\ :sup:`-2`) is, with reference to Figure 5.1, +m\ :sup:`-2`) is, with reference to :numref:`Figure Schematic diagram of sensible heat fluxes`, .. math:: :label: ZEqnNum726771 @@ -596,12 +596,13 @@ surface water :math:`T_{h2osfc}` are H_{h2osfc} =-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{h2osfc} \right)}{r_{ah} } where :math:`\rho _{atm}` is the density of atmospheric air (kg m\ :sup:`-3`), :math:`C_{p}` is the specific heat capacity of air -(J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), +(J kg\ :sup:`-1` K\ :sup:`-1`) (:numref:`Table Physical constants`), :math:`\theta _{atm}` is the atmospheric potential temperature (K), and :math:`r_{ah}` is the aerodynamic resistance to sensible heat transfer (s m\ :sup:`-1`). -The water vapor flux :math:`E_{g}` (kg m\ :sup:`-2` s\ :sup:`-1`) is, with reference to Figure 5.2, +The water vapor flux :math:`E_{g}` (kg m\ :sup:`-2` s\ :sup:`-1`) is, with reference to +:numref:`Figure Schematic diagram of latent heat fluxes`, .. math:: :label: ZEqnNum419297 @@ -648,7 +649,7 @@ to be proportional to the saturation specific humidity q_{soil} =\alpha _{soil} q_{sat}^{T_{1} } where :math:`q_{sat}^{T_{1} }` is the saturated specific humidity at -the soil surface temperature :math:`T_{1}` (section 5.5). The factor +the soil surface temperature :math:`T_{1}` (section :numref:`Saturation Vapor Pressure`). The factor :math:`\alpha _{soil}` is a function of the surface soil water matric potential :math:`\psi` as in Philip (1957) @@ -657,8 +658,8 @@ potential :math:`\psi` as in Philip (1957) \alpha _{soil} =\exp \left(\frac{\psi _{1} g}{1\times 10^{3} R_{wv} T_{1} } \right) -where :math:`R_{wv}` is the gas constant for water vapor (J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), :math:`g` is the -gravitational acceleration (m s\ :sup:`-2`) (Table 2.6), and +where :math:`R_{wv}` is the gas constant for water vapor (J kg\ :sup:`-1` K\ :sup:`-1`) (:numref:`Table Physical constants`), :math:`g` is the +gravitational acceleration (m s\ :sup:`-2`) (:numref:`Table Physical constants`), and :math:`\psi _{1}` is the soil water matric potential of the top soil layer (mm). The soil water matric potential :math:`\psi _{1}` is @@ -668,10 +669,11 @@ layer (mm). The soil water matric potential :math:`\psi _{1}` is \psi _{1} =\psi _{sat,\, 1} s_{1}^{-B_{1} } \ge -1\times 10^{8} where :math:`\psi _{sat,\, 1}` is the saturated matric potential (mm) -(section 7.4.1), :math:`B_{1}` is the Clapp and Hornberger (1978) -parameter (section 7.4.1), and :math:`s_{1}` is the wetness of the top -soil layer with respect to saturation. The surface wetness -:math:`s_{1}` is a function of the liquid water and ice content +(section :numref:`Hydraulic Properties`), +:math:`B_{1}` is the :ref:`Clapp and Hornberger (1978) ` +parameter (section :numref:`Hydraulic Properties`), +and :math:`s_{1}` is the wetness of the top soil layer with respect to saturation. +The surface wetness :math:`s_{1}` is a function of the liquid water and ice content .. math:: :label: 5.75) @@ -680,11 +682,11 @@ soil layer with respect to saturation. The surface wetness where :math:`\Delta z_{1}` is the thickness of the top soil layer (m), :math:`\rho _{liq}` and :math:`\rho _{ice}` are the density of liquid -water and ice (kg m\ :sup:`-3`) (Table 2.6), :math:`w_{liq,\, 1}` +water and ice (kg m\ :sup:`-3`) (:numref:`Table Physical constants`), :math:`w_{liq,\, 1}` and :math:`w_{ice,\, 1}` are the mass of liquid water and ice of the -top soil layer (kg m\ :sup:`-2`) (Chapter 7), and +top soil layer (kg m\ :sup:`-2`) (Chapter :numref:`rst_Hydrology`), and :math:`\theta _{sat,\, 1}` is the saturated volumetric water content -(i.e., porosity) of the top soil layer (mm\ :sup:`3` mm\ :sup:`-3`) (section 7.4.1). If +(i.e., porosity) of the top soil layer (mm\ :sup:`3` mm\ :sup:`-3`) (section :numref:`Hydraulic Properties`). If :math:`q_{sat}^{T_{1} } >q_{atm}` and :math:`q_{atm} >q_{soil}` , then :math:`q_{soil} =q_{atm}` and :math:`\frac{dq_{soil} }{dT} =0`. This prevents large increases (decreases) in :math:`q_{soil}` for small @@ -711,7 +713,7 @@ The volumetric water content of the top soil layer (mm\ :sup:`3` mm\ :sup:`-3`) The volumetric water content at field capacity is derived by assuming a hydraulic conductivity of 0.1 mm day\ :sup:`-1` and inverting the -hydraulic conductivity function (section 7.4.1) as +hydraulic conductivity function (section :numref:`Hydraulic Properties`) as .. math:: :label: 5.78) @@ -719,8 +721,8 @@ hydraulic conductivity function (section 7.4.1) as \theta _{fc,\, 1} =\theta _{sat,\, 1} \left[\frac{0.1}{86400k_{sat,\, 1} } \right]^{\frac{1}{2B_{i} +3} } where :math:`k_{sat,\, 1}` is the saturated hydraulic conductivity of -the top soil layer (mm s\ :sup:`-1`) (section 7.4.1) and the -exponent :math:`B_{1}` is a function of soil texture (section 7.4.1). +the top soil layer (mm s\ :sup:`-1`) (section :numref:`Hydraulic Properties`) and the +exponent :math:`B_{1}` is a function of soil texture (section :numref:`Hydraulic Properties`). The roughness lengths used to calculate :math:`r_{am}` , :math:`r_{ah}` , and :math:`r_{aw}` are :math:`z_{0m} =z_{0m,\, g}` , @@ -734,7 +736,8 @@ fluctuations in the turbulent waves behind the roughness elements, while for heat and water vapor transfer no such dynamical mechanism exists. Rather, heat and water vapor must be transferred by molecular diffusion across the interfacial sublayer. The following relation from -Zilitinkevich (1970) is adopted by Zeng and Dickinson (1998) +:ref:`Zilitinkevich (1970) ` is adopted by +:ref:`Zeng and Dickinson 1998 ` .. math:: :label: ZEqnNum844212 @@ -789,9 +792,9 @@ water vapor flux from non-vegetated surfaces proceeds as follows: :math:`q_{2m}` (eqs. , ) The partial derivatives of the soil surface fluxes with respect to -ground temperature, which are needed for the soil temperature -calculations (section 6.1) and to update the soil surface fluxes -(section 5.4), are +ground temperature, which are needed for the soil temperature calculations (section +:numref:`Numerical Solution Temperature`) and to update the soil surface fluxes +(section :numref:`Update of Ground Sensible and Latent Heat Fluxes`), are .. math:: :label: ZEqnNum806472 @@ -831,8 +834,8 @@ coupling between vegetation temperature and fluxes, Newton-Raphson iteration is used to solve for the vegetation temperature and the sensible heat and water vapor fluxes from vegetation simultaneously using the ground temperature from the previous time step. In section -5.3.1, the equations used in the iteration scheme are derived. Details -on the numerical scheme are provided in section 5.3.2. +:numref:`Theory`, the equations used in the iteration scheme are derived. Details +on the numerical scheme are provided in section :numref:`Numerical Implementation`. .. _Theory: @@ -850,7 +853,7 @@ from the vegetation :math:`H_{v}` and the ground :math:`H_{g}` H=H_{v} +H_{g} -where, with reference to Figure 5.1, +where, with reference to :numref:`Figure Schematic diagram of sensible heat fluxes`, .. math:: :label: 5.84) @@ -883,7 +886,7 @@ where, with reference to Figure 5.1, H_{h2osfc} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{h2osfc} \right)}{r_{ah} ^{{'} } } where :math:`\rho _{atm}` is the density of atmospheric air (kg m\ :sup:`-3`), :math:`C_{p}` is the specific heat capacity of air -(J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), +(J kg\ :sup:`-1` K\ :sup:`-1`) (:numref:`Table Physical constants`), :math:`\theta _{atm}` is the atmospheric potential temperature (K), and :math:`r_{ah}` is the aerodynamic resistance to sensible heat transfer (s m\ :sup:`-1`). @@ -891,21 +894,25 @@ where :math:`\rho _{atm}` is the density of atmospheric air (kg m\ :sup:`-3`), Here, :math:`T_{s}` is the surface temperature at height :math:`z_{0h} +d`, also referred to as the canopy air temperature. :math:`L` and :math:`S` are the exposed leaf and stem area indices -(section 2.1.4), :math:`r_{b}` is the leaf boundary layer resistance (s +(section :numref:`Phenology and vegetation burial by snow`), :math:`r_{b}` is the leaf boundary layer resistance (s m\ :sup:`-1`), and :math:`r_{ah} ^{{'} }` is the aerodynamic resistance (s m\ :sup:`-1`) to heat transfer between the ground at height :math:`z_{0h} ^{{'} }` and the canopy air at height :math:`z_{0h} +d`. -Figure 5.1. Schematic diagram of sensible heat fluxes for (a) -non-vegetated surfaces and (b) vegetated surfaces. +.. _Figure Schematic diagram of sensible heat fluxes: -.. image:: image1.png +.. figure:: image1.png -Figure 5.2. Schematic diagram of water vapor fluxes for (a) -non-vegetated surfaces and (b) vegetated surfaces. + Figure Schematic diagram of sensible heat fluxes for (a) + non-vegetated surfaces and (b) vegetated surfaces. -.. image:: image2.png +.. _Figure Schematic diagram of latent heat fluxes: + +.. figure:: image2.png + + Figure Schematic diagram of water vapor fluxes for (a) + non-vegetated surfaces and (b) vegetated surfaces. Equations - can be solved for the canopy air temperature :math:`T_{s}` @@ -963,7 +970,7 @@ flux from the vegetation :math:`E_{v}` and the ground :math:`E_{g}` E=E_{v} +E_{g} -where, with reference to Figure 5.2, +where, with reference to :numref:`Figure Schematic diagram of latent heat fluxes`, .. math:: :label: 5.97) @@ -998,19 +1005,21 @@ where, with reference to Figure 5.2, where :math:`q_{atm}` is the atmospheric specific humidity (kg kg\ :sup:`-1`), :math:`r_{aw}` is the aerodynamic resistance to water vapor transfer (s m\ :sup:`-1`), :math:`q_{sat}^{T_{v} }` (kg kg\ :sup:`-1`) is the saturation water vapor specific humidity -at the vegetation temperature (section 5.5), :math:`q_{g}` , +at the vegetation temperature (section :numref:`Saturation Vapor Pressure`), :math:`q_{g}` , :math:`q_{sno}` , and :math:`q_{h2osfc}` are the specific humidities -of the soil, snow, and surface water (section 5.2), +of the soil, snow, and surface water (section :numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`), :math:`r_{aw} ^{{'} }` is the aerodynamic resistance (s m\ :sup:`-1`) to water vapor transfer between the ground at height :math:`z_{0w} ^{{'} }` and the canopy air at height :math:`z_{0w} +d`, :math:`\beta _{soi}` is an empirical function of soil water (section -5.2), and :math:`r_{litter}` is a resistance for the plant litter layer +:numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`), +and :math:`r_{litter}` is a resistance for the plant litter layer (s m\ :sup:`-1`). :math:`r_{total}` is the total resistance to water vapor transfer from the canopy to the canopy air and includes contributions from leaf boundary layer and sunlit and shaded stomatal resistances :math:`r_{b}` , :math:`r_{s}^{sun}` , and -:math:`r_{s}^{sha}` (Figure 5.2). The water vapor flux from vegetation +:math:`r_{s}^{sha}` (:numref:`Figure Schematic diagram of latent heat fluxes`). +The water vapor flux from vegetation is the sum of water vapor flux from wetted leaf and stem area :math:`E_{v}^{w}` (evaporation of water intercepted by the canopy) and transpiration from dry leaf surfaces :math:`E_{v}^{t}` @@ -1057,11 +1066,11 @@ as r''=\left\{\begin{array}{l} {\min \left(f_{wet} +r_{dry} ^{{'} {'} } ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right)\qquad E_{v}^{w,\, pot} >0,\, \beta _{t} >0} \\ {\min \left(f_{wet} ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right)\qquad E_{v}^{w,\, pot} >0,\, \beta _{t} \le 0} \\ {1\qquad E_{v}^{w,\, pot} \le 0} \end{array}\right\} where :math:`f_{wet}` is the fraction of leaves and stems that are wet -(section 7.1), :math:`W_{can}` is canopy water (kg m\ :sup:`-2`) -(section 7.1), :math:`\Delta t` is the time step (s), and +(section :numref:`Canopy Water`), :math:`W_{can}` is canopy water (kg m\ :sup:`-2`) +(section :numref:`Canopy Water`), :math:`\Delta t` is the time step (s), and :math:`\beta _{t}` is a soil moisture function limiting transpiration -(Chapter 8). The potential evaporation from wet foliage per unit wetted -area is +(Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). The potential +evaporation from wet foliage per unit wetted area is .. math:: :label: 5.109) @@ -1076,10 +1085,10 @@ The term :math:`r_{dry} ^{{'} {'} }` is r_{dry} ^{{'} {'} } =\frac{f_{dry} r_{b} }{L} \left(\frac{L^{sun} }{r_{b} +r_{s}^{sun} } +\frac{L^{sha} }{r_{b} +r_{s}^{sha} } \right) where :math:`f_{dry}` is the fraction of leaves that are dry (section -7.1), :math:`L^{sun}` and :math:`L^{sha}` are the sunlit and shaded -leaf area indices (section 4.1), and :math:`r_{s}^{sun}` and +:numref:`Canopy Water`), :math:`L^{sun}` and :math:`L^{sha}` are the sunlit and shaded +leaf area indices (section :numref:`Solar Fluxes`), and :math:`r_{s}^{sun}` and :math:`r_{s}^{sha}` are the sunlit and shaded stomatal resistances (s -m\ :sup:`-1`) (Chapter 8). +m\ :sup:`-1`) (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). When the expression for :math:`q_{s}` is substituted into equation , the water vapor flux from vegetation :math:`E_{v}` is a function of @@ -1119,8 +1128,7 @@ is the magnitude of the wind velocity incident on the leaves (equivalent here to friction velocity) (m s\ :sup:`-1`) and :math:`C_{s}` is the turbulent transfer coefficient between the underlying soil and the canopy air. :math:`C_{s}` is obtained by -interpolation between values for dense canopy and bare soil (Zeng et al. -2005) +interpolation between values for dense canopy and bare soil (:ref:`Zeng et al. 2005 `) .. math:: :label: 5.115) @@ -1134,8 +1142,8 @@ where the weight :math:`W` is W=e^{-\left(L+S\right)} . -The dense canopy turbulent transfer coefficient in Zeng et al. (2005) -is modified from its original value of 0.004 (Dickinson et al. 1993) by +The dense canopy turbulent transfer coefficient in :ref:`Zeng et al. (2005) ` +is modified from its original value of 0.004 (:ref:`Dickinson et al. 1993 `) by Sakaguchi and Zeng (2009) to account for stability as .. math:: @@ -1152,8 +1160,8 @@ determined from S=\frac{gz_{top} \left(T_{s} -T_{g} \right)}{T_{s} u_{*}^{2} } where :math:`g` is the gravitational acceleration (m -s\ :sup:`-2`) (Table 2.6), and :math:`z_{top}` is canopy top -height (m) (Table 2.2). The bare soil turbulent transfer coefficient is +s\ :sup:`-2`) (:numref:`Table Physical constants`), and :math:`z_{top}` is canopy top +height (m) (:numref:`Table Prescribed plant functional type heights`). The bare soil turbulent transfer coefficient is .. math:: :label: 5.119) @@ -1188,8 +1196,7 @@ The effective snow cover of the litter layer is f_{litter}^{snow} =\frac{z_{sno} }{\Delta z_{litter} } where :math:`\Delta z_{litter} =0.05`\ m is assumed as a typical depth -for the litter layer, and :math:`z_{sno}` is the depth of snow (section -7.2) (m). +for the litter layer, and :math:`z_{sno}` is the depth of snow (Chapter :numref:`rst_Snow Hydrology`) (m). The leaf boundary layer resistance :math:`r_{b}` is @@ -1201,12 +1208,12 @@ The leaf boundary layer resistance :math:`r_{b}` is where :math:`C_{v} =0.01` m\ s\ :sup:`-1/2` is the turbulent transfer coefficient between the canopy surface and canopy air, and :math:`d_{leaf}` is the characteristic dimension of the leaves in the -direction of wind flow (Table 5.1). +direction of wind flow (:numref:`Table Coefficients for saturation vapor pressure`). The partial derivatives of the fluxes from the soil beneath the canopy with respect to ground temperature, which are needed for the soil -temperature calculations (section 6.1) and to update the soil surface -fluxes (section 5.4), are +temperature calculations (section :numref:`Numerical Solution Temperature`) and to update the soil surface +fluxes (section :numref:`Update of Ground Sensible and Latent Heat Fluxes`), are .. math:: :label: ZEqnNum774729 @@ -1230,7 +1237,7 @@ The roughness lengths used to calculate :math:`r_{am}` , :math:`z_{0m} =z_{0m,\, v}` , :math:`z_{0h} =z_{0h,\, v}` , and :math:`z_{0w} =z_{0w,\, v}` . The vegetation displacement height :math:`d` and the roughness lengths are a function of plant height and -adjusted for canopy density following Zeng and Wang (2007) +adjusted for canopy density following :ref:`Zeng and Wang (2007) ` .. math:: :label: 5.126) @@ -1242,11 +1249,12 @@ adjusted for canopy density following Zeng and Wang (2007) d=z_{top} R_{d} V -where :math:`z_{top}` is canopy top height (m) (Table 2.2), +where :math:`z_{top}` is canopy top height (m) (:numref:`Table Prescribed plant functional type heights`), :math:`R_{z0m}` and :math:`R_{d}` are the ratio of momentum roughness -length and displacement height to canopy top height, respectively (Table -5.1), and :math:`z_{0m,\, g}` is the ground momentum roughness length -(m) (section 5.2). The fractional weight :math:`V` is determined from +length and displacement height to canopy top height, respectively +(:numref:`Table Plant functional type aerodynamic parameters`), and +:math:`z_{0m,\, g}` is the ground momentum roughness length +(m) (section :numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`). The fractional weight :math:`V` is determined from .. math:: :label: 5.128) @@ -1256,59 +1264,61 @@ length and displacement height to canopy top height, respectively (Table where :math:`\beta =1` and :math:`\left(L+S\right)_{cr} =2` (m\ :sup:`2` m\ :sup:`-2`) is a critical value of exposed leaf plus stem area for which :math:`z_{0m}` reaches its maximum. -Table 5.1. Plant functional type aerodynamic parameters - -+----------------------------------+--------------------+------------------+-------------------------+ -| Plant functional type | :math:`R_{z0m}` | :math:`R_{d}` | :math:`d_{leaf}` (m) | -+==================================+====================+==================+=========================+ -| NET Temperate | 0.055 | 0.67 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| NET Boreal | 0.055 | 0.67 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| NDT Boreal | 0.055 | 0.67 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| BET Tropical | 0.075 | 0.67 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| BET temperate | 0.075 | 0.67 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| BDT tropical | 0.055 | 0.67 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| BDT temperate | 0.055 | 0.67 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| BDT boreal | 0.055 | 0.67 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| BES temperate | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| BDS temperate | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| BDS boreal | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| C\ :sub:`3` arctic grass | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| C\ :sub:`3` grass | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| C\ :sub:`4` grass | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Crop R | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Crop I | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Corn R | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Corn I | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Temp Cereal R | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Temp Cereal I | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Winter Cereal R | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Winter Cereal I | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Soybean R | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ -| Soybean I | 0.120 | 0.68 | 0.04 | -+----------------------------------+--------------------+------------------+-------------------------+ +.. _Table Plant functional type aerodynamic parameters: + +.. table:: Plant functional type aerodynamic parameters + + +----------------------------------+--------------------+------------------+-------------------------+ + | Plant functional type | :math:`R_{z0m}` | :math:`R_{d}` | :math:`d_{leaf}` (m) | + +==================================+====================+==================+=========================+ + | NET Temperate | 0.055 | 0.67 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | NET Boreal | 0.055 | 0.67 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | NDT Boreal | 0.055 | 0.67 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | BET Tropical | 0.075 | 0.67 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | BET temperate | 0.075 | 0.67 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | BDT tropical | 0.055 | 0.67 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | BDT temperate | 0.055 | 0.67 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | BDT boreal | 0.055 | 0.67 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | BES temperate | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | BDS temperate | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | BDS boreal | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | C\ :sub:`3` arctic grass | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | C\ :sub:`3` grass | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | C\ :sub:`4` grass | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Crop R | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Crop I | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Corn R | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Corn I | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Temp Cereal R | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Temp Cereal I | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Winter Cereal R | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Winter Cereal I | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Soybean R | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Soybean I | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ .. _Numerical Implementation: @@ -1323,12 +1333,12 @@ Canopy energy conservation gives -\overrightarrow{S}_{v} +\overrightarrow{L}_{v} \left(T_{v} \right)+H_{v} \left(T_{v} \right)+\lambda E_{v} \left(T_{v} \right)=0 where :math:`\overrightarrow{S}_{v}` is the solar radiation absorbed by -the vegetation (section 4.1), :math:`\overrightarrow{L}_{v}` is the net -longwave radiation absorbed by vegetation (section 4.2), and +the vegetation (section :numref:`Solar Fluxes`), :math:`\overrightarrow{L}_{v}` is the net +longwave radiation absorbed by vegetation (section :numref:`Longwave Fluxes`), and :math:`H_{v}` and :math:`\lambda E_{v}` are the sensible and latent heat fluxes from vegetation, respectively. The term :math:`\lambda` is taken to be the latent heat of vaporization :math:`\lambda _{vap}` -(Table 2.6). +(:numref:`Table Physical constants`). :math:`\overrightarrow{L}_{v}` , :math:`H_{v}` , and :math:`\lambda E_{v}` depend on the vegetation temperature @@ -1436,7 +1446,7 @@ proceeds as follows: :math:`r_{aw} ^{{'} }` (eq. ) #. Sunlit and shaded stomatal resistances :math:`r_{s}^{sun}` and - :math:`r_{s}^{sha}` (Chapter 8) + :math:`r_{s}^{sha}` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`) #. Sensible heat conductances :math:`c_{a}^{h}` , :math:`c_{g}^{h}` , and :math:`c_{v}^{h}` (eqs. , , ) @@ -1494,10 +1504,10 @@ flux later. :math:`\lambda \Delta _{3}` are also added to the sensible heat flux. -#. The saturated vapor pressure :math:`e_{i}` (Chapter 8), saturated +#. The saturated vapor pressure :math:`e_{i}` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), saturated specific humidity :math:`q_{sat}^{T_{v} }` and its derivative :math:`\frac{dq_{sat}^{T_{v} } }{dT_{v} }` at the leaf surface - (section 5.5), are re-evaluated based on the new :math:`T_{v}` . + (section :numref:`Saturation Vapor Pressure`), are re-evaluated based on the new :math:`T_{v}` . #. Canopy air temperature :math:`T_{s}` (eq. ) @@ -1548,7 +1558,7 @@ The sensible and water vapor heat fluxes derived above for bare soil and soil beneath canopy are based on the ground surface temperature from the previous time step :math:`T_{g}^{n}` and are used as the surface forcing for the solution of the soil temperature equations (section -6.1). This solution yields a new ground surface temperature +:numref:`Numerical Solution Temperature`). This solution yields a new ground surface temperature :math:`T_{g}^{n+1}` . The ground sensible and water vapor fluxes are then updated for :math:`T_{g}^{n+1}` as @@ -1591,7 +1601,7 @@ relative area of the :math:`j^{th}` PFT with respect to the column, and :math:`npft` is the number of PFTs on the column. :math:`w_{ice,\, snl+1}` and :math:`w_{liq,\, snl+1}` are the ice and liquid water contents (kg m\ :sup:`-2`) of the top snow/soil layer -(Chapter 7). Any resulting energy deficit is assigned to sensible heat +(Chapter :numref:`rst_Hydrology`). Any resulting energy deficit is assigned to sensible heat as .. math:: @@ -1626,9 +1636,9 @@ on snow/soil :math:`q_{sdew}` (kg m\ :sup:`-2` s\ :sup:`-1`), or frost on snow/ The loss or gain in snow mass due to :math:`q_{seva}` , :math:`q_{subl}` , :math:`q_{sdew}` , and :math:`q_{frost}` on a snow surface are accounted for during the snow hydrology calculations -(section 7.2). The loss of soil and surface water due to +(Chapter :numref:`rst_Snow Hydrology`). The loss of soil and surface water due to :math:`q_{seva}` is accounted for in the calculation of infiltration -(section 7.3), while losses or gains due to :math:`q_{subl}` , +(section :numref:`Infiltration`), while losses or gains due to :math:`q_{subl}` , :math:`q_{sdew}` , and :math:`q_{frost}` on a soil surface are accounted for following the sub-surface drainage calculations (section 7.6). @@ -1641,8 +1651,8 @@ The ground heat flux :math:`G` is calculated as G=\overrightarrow{S}_{g} -\overrightarrow{L}_{g} -H_{g} -\lambda E_{g} where :math:`\overrightarrow{S}_{g}` is the solar radiation absorbed by -the ground (section 4.1), :math:`\overrightarrow{L}_{g}` is the net -longwave radiation absorbed by the ground (section 4.2) +the ground (section :numref:`Solar Fluxes`), :math:`\overrightarrow{L}_{g}` is the net +longwave radiation absorbed by the ground (section :numref:`Longwave Fluxes`) .. math:: :label: 5.151) @@ -1669,7 +1679,7 @@ When converting ground water vapor flux to an energy flux, the term where :math:`\lambda _{sub}` and :math:`\lambda _{vap}` are the latent heat of sublimation and vaporization, respectively (J -(kg\ :sup:`-1`) (Table 2.6). When converting vegetation water vapor +(kg\ :sup:`-1`) (:numref:`Table Physical constants`). When converting vegetation water vapor flux to an energy flux, :math:`\lambda _{vap}` is used. The system balances energy as @@ -1687,7 +1697,7 @@ Saturation Vapor Pressure Saturation vapor pressure :math:`e_{sat}^{T}` (Pa) and its derivative :math:`\frac{de_{sat}^{T} }{dT}` , as a function of temperature :math:`T` (ºC), are calculated from the eighth-order polynomial fits of -Flatau et al. (1992) +:ref:`Flatau et al. (1992) ` .. math:: :label: 5.155) @@ -1702,10 +1712,11 @@ Flatau et al. (1992) where the coefficients for ice are valid for :math:`-75\, ^{\circ } {\rm C}\le T<0\, ^{\circ } {\rm C}` and the coefficients for water are valid for -:math:`0\, ^{\circ } {\rm C}\le T\le 100\, ^{\circ } {\rm C}` (Table 5.2 -and 5.3). The saturated water vapor specific humidity -:math:`q_{sat}^{T}` and its derivative -:math:`\frac{dq_{sat}^{T} }{dT}` are +:math:`0\, ^{\circ } {\rm C}\le T\le 100\, ^{\circ } {\rm C}` +(:numref:`Table Coefficients for saturation vapor pressure` and +:numref:`Table Coefficients for derivative of esat`). +The saturated water vapor specific humidity :math:`q_{sat}^{T}` and its derivative +:math:`\frac{dq_{sat}^{T} }{dT}` are .. math:: :label: 5.157) @@ -1717,51 +1728,55 @@ and 5.3). The saturated water vapor specific humidity \frac{dq_{sat}^{T} }{dT} =\frac{0.622P_{atm} }{\left(P_{atm} -0.378e_{sat}^{T} \right)^{2} } \frac{de_{sat}^{T} }{dT} . -Table 5.2. Coefficients for :math:`e_{sat}^{T}` - -+------------------+------------------------------------------+----------------------------------------+ -| | water | ice | -+==================+==========================================+========================================+ -| :math:`a_{0}` | 6.11213476 | 6.11123516 | -+------------------+------------------------------------------+----------------------------------------+ -| :math:`a_{1}` | 4.44007856 :math:`\times 10^{-1}` | 5.03109514\ :math:`\times 10^{-1}` | -+------------------+-------------------------------------------+---------------------------------------+ -| :math:`a_{2}` | 1.43064234 :math:`\times 10^{-2}` | 1.88369801\ :math:`\times 10^{-2}` | -+------------------+-------------------------------------------+---------------------------------------+ -| :math:`a_{3}` | 2.64461437 :math:`\times 10^{-4}` | 4.20547422\ :math:`\times 10^{-4}` | -+------------------+-------------------------------------------+---------------------------------------+ -| :math:`a_{4}` | 3.05903558 :math:`\times 10^{-6}` | 6.14396778\ :math:`\times 10^{-6}` | -+------------------+-------------------------------------------+---------------------------------------+ -| :math:`a_{5}` | 1.96237241 :math:`\times 10^{-8}` | 6.02780717\ :math:`\times 10^{-8}` | -+------------------+-------------------------------------------+---------------------------------------+ -| :math:`a_{6}` | 8.92344772 :math:`\times 10^{-11}` | 3.87940929\ :math:`\times 10^{-10}` | -+------------------+-------------------------------------------+---------------------------------------+ -| :math:`a_{7}` | -3.73208410 :math:`\times 10^{-13}` | 1.49436277\ :math:`\times 10^{-12}` | -+------------------+-------------------------------------------+---------------------------------------+ -| :math:`a_{8}` | 2.09339997 :math:`\times 10^{-16}` | 2.62655803\ :math:`\times 10^{-15}` | -+------------------+------------------------------------------+----------------------------------------+ - -Table 5.3. Coefficients for :math:`\frac{de_{sat}^{T} }{dT}` - -+------------------+----------------------------------------+----------------------------------------+ -| | water | ice | -+==================+========================================+========================================+ -| :math:`b_{0}` | 4.44017302\ :math:`\times 10^{-1}` | 5.03277922\ :math:`\times 10^{-1}` | -+------------------+----------------------------------------+----------------------------------------+ -| :math:`b_{1}` | 2.86064092\ :math:`\times 10^{-2}` | 3.77289173\ :math:`\times 10^{-2}` | -+------------------+----------------------------------------+----------------------------------------+ -| :math:`b_{2}` | 7.94683137\ :math:`\times 10^{-4}` | 1.26801703\ :math:`\times 10^{-3}` | -+------------------+----------------------------------------+----------------------------------------+ -| :math:`b_{3}` | 1.21211669\ :math:`\times 10^{-5}` | 2.49468427\ :math:`\times 10^{-5}` | -+------------------+----------------------------------------+----------------------------------------+ -| :math:`b_{4}` | 1.03354611\ :math:`\times 10^{-7}` | 3.13703411\ :math:`\times 10^{-7}` | -+------------------+----------------------------------------+----------------------------------------+ -| :math:`b_{5}` | 4.04125005\ :math:`\times 10^{-10}` | 2.57180651\ :math:`\times 10^{-9}` | -+------------------+----------------------------------------+----------------------------------------+ -| :math:`b_{6}` | -7.88037859 :math:`\times 10^{-13}` | 1.33268878\ :math:`\times 10^{-11}` | -+------------------+----------------------------------------+----------------------------------------+ -| :math:`b_{7}` | -1.14596802 :math:`\times 10^{-14}` | 3.94116744\ :math:`\times 10^{-14}` | -+------------------+----------------------------------------+----------------------------------------+ -| :math:`b_{8}` | 3.81294516\ :math:`\times 10^{-17}` | 4.98070196\ :math:`\times 10^{-17}` | -+------------------+----------------------------------------+----------------------------------------+ +.. _Table Coefficients for saturation vapor pressure: + +.. table:: Coefficients for :math:`e_{sat}^{T}` + + +------------------+------------------------------------------+----------------------------------------+ + | | water | ice | + +==================+==========================================+========================================+ + | :math:`a_{0}` | 6.11213476 | 6.11123516 | + +------------------+------------------------------------------+----------------------------------------+ + | :math:`a_{1}` | 4.44007856 :math:`\times 10^{-1}` | 5.03109514\ :math:`\times 10^{-1}` | + +------------------+-------------------------------------------+---------------------------------------+ + | :math:`a_{2}` | 1.43064234 :math:`\times 10^{-2}` | 1.88369801\ :math:`\times 10^{-2}` | + +------------------+-------------------------------------------+---------------------------------------+ + | :math:`a_{3}` | 2.64461437 :math:`\times 10^{-4}` | 4.20547422\ :math:`\times 10^{-4}` | + +------------------+-------------------------------------------+---------------------------------------+ + | :math:`a_{4}` | 3.05903558 :math:`\times 10^{-6}` | 6.14396778\ :math:`\times 10^{-6}` | + +------------------+-------------------------------------------+---------------------------------------+ + | :math:`a_{5}` | 1.96237241 :math:`\times 10^{-8}` | 6.02780717\ :math:`\times 10^{-8}` | + +------------------+-------------------------------------------+---------------------------------------+ + | :math:`a_{6}` | 8.92344772 :math:`\times 10^{-11}` | 3.87940929\ :math:`\times 10^{-10}` | + +------------------+-------------------------------------------+---------------------------------------+ + | :math:`a_{7}` | -3.73208410 :math:`\times 10^{-13}` | 1.49436277\ :math:`\times 10^{-12}` | + +------------------+-------------------------------------------+---------------------------------------+ + | :math:`a_{8}` | 2.09339997 :math:`\times 10^{-16}` | 2.62655803\ :math:`\times 10^{-15}` | + +------------------+------------------------------------------+----------------------------------------+ + +.. _Table Coefficients for derivative of esat: + +.. table:: Coefficients for :math:`\frac{de_{sat}^{T} }{dT}` + + +------------------+----------------------------------------+----------------------------------------+ + | | water | ice | + +==================+========================================+========================================+ + | :math:`b_{0}` | 4.44017302\ :math:`\times 10^{-1}` | 5.03277922\ :math:`\times 10^{-1}` | + +------------------+----------------------------------------+----------------------------------------+ + | :math:`b_{1}` | 2.86064092\ :math:`\times 10^{-2}` | 3.77289173\ :math:`\times 10^{-2}` | + +------------------+----------------------------------------+----------------------------------------+ + | :math:`b_{2}` | 7.94683137\ :math:`\times 10^{-4}` | 1.26801703\ :math:`\times 10^{-3}` | + +------------------+----------------------------------------+----------------------------------------+ + | :math:`b_{3}` | 1.21211669\ :math:`\times 10^{-5}` | 2.49468427\ :math:`\times 10^{-5}` | + +------------------+----------------------------------------+----------------------------------------+ + | :math:`b_{4}` | 1.03354611\ :math:`\times 10^{-7}` | 3.13703411\ :math:`\times 10^{-7}` | + +------------------+----------------------------------------+----------------------------------------+ + | :math:`b_{5}` | 4.04125005\ :math:`\times 10^{-10}` | 2.57180651\ :math:`\times 10^{-9}` | + +------------------+----------------------------------------+----------------------------------------+ + | :math:`b_{6}` | -7.88037859 :math:`\times 10^{-13}` | 1.33268878\ :math:`\times 10^{-11}` | + +------------------+----------------------------------------+----------------------------------------+ + | :math:`b_{7}` | -1.14596802 :math:`\times 10^{-14}` | 3.94116744\ :math:`\times 10^{-14}` | + +------------------+----------------------------------------+----------------------------------------+ + | :math:`b_{8}` | 3.81294516\ :math:`\times 10^{-17}` | 4.98070196\ :math:`\times 10^{-17}` | + +------------------+----------------------------------------+----------------------------------------+ diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 205a14c0e6..f850a383b4 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -11,7 +11,7 @@ changes in canopy water :math:`\Delta W_{can}` , surface water :math:`\Delta W_{sfc}` , snow water :math:`\Delta W_{sno}` , soil water :math:`\Delta w_{liq,\, i}` , and soil ice :math:`\Delta w_{ice,\, i}` , and water in the unconfined aquifer :math:`\Delta W_{a}` (all in kg -m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (Figure 7.1). +m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (:numref:`Hydrologic processes figure`). The total water balance of the system is @@ -22,22 +22,24 @@ The total water balance of the system is where :math:`q_{rain}` is the liquid part of precipitation, :math:`q_{sno}` is the solid part of precipitation, :math:`E_{v}` is -ET from vegetation (Chapter 5), :math:`E_{g}` is ground evaporation -(Chapter 5), :math:`q_{over}` is surface runoff (section 7.3), -:math:`q_{h2osfc}` is runoff from surface water storage (section 7.3), +ET from vegetation (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), :math:`E_{g}` is ground evaporation +(Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), :math:`q_{over}` is surface runoff (section :numref:`Surface Runoff`), +:math:`q_{h2osfc}` is runoff from surface water storage (section :numref:`Surface Runoff`), :math:`q_{drai}` is sub-surface drainage (section 7.6), :math:`q_{rgwl}` and :math:`q_{snwcp,ice}` are liquid and solid runoff from glaciers, wetlands, and lakes, and runoff from other surface types -due to snow capping (section 7.7) (all in kg m\ :sup:`-2` +due to snow capping (section :numref:`Runoff from glaciers and snow-capped surfaces`) (all in kg m\ :sup:`-2` s\ :sup:`-1`), :math:`N_{levsoi}` is the number of soil layers (note that hydrology calculations are only done over soil layers 1 to :math:`N_{levsoi}` ; ground levels :math:`N_{levsoi} +1`\ to -:math:`N_{levgrnd}` are currently hydrologically inactive; Lawrence et -al. 2008) and :math:`\Delta t` is the time step (s). +:math:`N_{levgrnd}` are currently hydrologically inactive; :ref:`(Lawrence et +al. 2008) ` and :math:`\Delta t` is the time step (s). -Figure 7.1. Hydrologic processes represented in CLM. +.. _Hydrologic processes figure: -.. image:: image1.png +.. Figure:: image1.png + + Hydrologic processes represented in CLM. .. _Canopy Water: @@ -57,7 +59,7 @@ liquid and solid phases where :math:`L` and :math:`S` are the exposed leaf and stem area index, respectively (section 2.1.4), and :math:`\alpha =0.25` scales -interception from point to grid cell (Lawrence et al. 2007). Throughfall +interception from point to grid cell (:ref:`Lawrence et al. 2007 `). Throughfall (kg m\ :sup:`-2` s\ :sup:`-1`), however, is divided into liquid and solid phases reaching the ground (soil or snow surface) as @@ -101,8 +103,8 @@ amount of water the canopy can hold W_{can,\, \max } =p\left(L+S\right). The maximum storage of solid water is assumed to be the same as that of -liquid water, :math:`p=0.1` kg m\ :sup:`-2` (Dickinson et al. -1993). The canopy water is updated as +liquid water, :math:`p=0.1` kg m\ :sup:`-2` (:ref:`Dickinson et al. +1993 `). The canopy water is updated as .. math:: :label: 7.9) @@ -110,7 +112,7 @@ liquid water, :math:`p=0.1` kg m\ :sup:`-2` (Dickinson et al. W_{can}^{n+1} =W_{can}^{n} +q_{intr} \Delta t-\left(q_{drip,\, liq} +q_{drip,\, ice} \right)\Delta t-E_{v}^{w} \Delta t\ge 0. where :math:`E_{v}^{w}` is the flux of water vapor from stem and leaf -surfaces (Chapter 5). The total rate of liquid and solid precipitation +surfaces (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`). The total rate of liquid and solid precipitation reaching the ground is then .. math:: @@ -125,13 +127,15 @@ reaching the ground is then Solid precipitation reaching the soil or snow surface, :math:`q_{grnd,\, ice} \Delta t`, is added immediately to the snow pack -(section 7.2). The liquid part, :math:`q_{grnd,\, liq} \Delta t` is -added after surface fluxes (Chapter 5) and snow/soil temperatures -(Chapter 6) have been determined. +(Chapter :numref:`rst_Snow Hydrology`). The liquid part, +:math:`q_{grnd,\, liq} \Delta t` is added after surface fluxes +(Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) +and snow/soil temperatures (Chapter :numref:`rst_Soil and Snow Temperatures`) +have been determined. The wetted fraction of the canopy (stems plus leaves), which is required -for the surface albedo (section 3.1) and surface flux (Chapter 5) -calculations is (Dickinson et al. 1993) +for the surface albedo (section :numref:`Canopy Radiative Transfer`) and surface flux (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) +calculations is (:ref:`Dickinson et al.1993 `) .. math:: :label: 7.12) @@ -161,8 +165,9 @@ infiltration into the soil. Surface Runoff ^^^^^^^^^^^^^^^^^^^^ -The simple TOPMODEL-based (Beven and Kirkby 1979) runoff model (SIMTOP) -described by Niu et al. (2005) is implemented to parameterize runoff. A +The simple TOPMODEL-based (:ref:`Beven and Kirkby 1979 `) +runoff model (SIMTOP) described by :ref:`Niu et al. (2005) ` +is implemented to parameterize runoff. A key concept underlying this approach is that of fractional saturated area :math:`f_{sat}` , which is determined by the topographic characteristics and soil moisture state of a grid cell. The saturated @@ -192,17 +197,18 @@ cell whose topographic index is larger than or equal to the grid cell mean topographic index. It should be calculated explicitly from the CDF at each grid cell at the resolution that the model is run. However, because this is a computationally intensive task for global -applications, :math:`f_{\max }` is calculated once at -0.125\ :sup:`o` resolution using the 1-km compound topographic -indices (CTIs) based on the HYDRO1K dataset (Verdin and Greenlee 1996) -from USGS following the algorithm in Niu et al. (2005) and then -area-averaged to the desired model resolution (section 2.2.3). Pixels +applications, :math:`f_{\max }` is calculated once at 0.125\ :sup:`o` +resolution using the 1-km compound topographic indices (CTIs) based on +the HYDRO1K dataset (:ref:`Verdin and Greenlee 1996 `) +from USGS following the algorithm in :ref:`Niu et al. (2005) ` +and then area-averaged to the desired model resolution (section +:numref:`Surface Data`). Pixels with CTIs exceeding the 95 percentile threshold in each 0.125\ :sup:`o` grid cell are excluded from the calculation to eliminate biased estimation of statistics due to large CTI values at pixels on stream networks. For grid cells over regions without CTIs such as Australia, the global mean :math:`f_{\max }` is used to fill the -gaps. See Li et al. (2013b) for additional details. The decay factor +gaps. See :ref:`Li et al. (2013b) ` for additional details. The decay factor :math:`f_{over}` for global simulations was determined through sensitivity analysis and comparison with observed runoff to be 0.5 m\ :sup:`-1`. @@ -216,7 +222,8 @@ A surface water store has been added to the model to represent wetlands and small, sub-grid scale water bodies. As a result, the wetland land unit has been removed. The state variables for surface water are the mass of water :math:`W_{sfc}` (kg m\ :sup:`-2`) and temperature -:math:`T_{h2osfc}` (Chapter 6). Surface water storage and outflow are +:math:`T_{h2osfc}` (Chapter :numref:`rst_Soil and Snow Temperatures`). +Surface water storage and outflow are functions of fine spatial scale elevation variations called microtopography. The microtopography is assumed to be distributed normally around the grid cell mean elevation. Given the standard @@ -364,9 +371,10 @@ Soil Water Soil water is predicted from a multi-layer model, in which the vertical soil moisture transport is governed by infiltration, surface and sub-surface runoff, gradient diffusion, gravity, canopy transpiration -through root extraction, and interactions with groundwater (Figure 7.1). -The following derivation generally follows that of Z.-L. Yang (1998, -unpublished manuscript) with modifications by Zeng and Decker (2009). +through root extraction, and interactions with groundwater +(:numref:`Hydrologic processes figure`). +The following derivation generally follows that of :ref:`Z.-L. Yang (1998, +unpublished manuscript) ` with modifications by Zeng and Decker (2009). For one-dimensional vertical water flow in soils, the conservation of mass is stated as @@ -482,11 +490,13 @@ vary with volumetric soil water :math:`\theta _{i}` and soil texture. As with the soil thermal properties (section 6.3) the hydraulic properties of the soil are assumed to be a weighted combination of the mineral properties, which are determined according to sand and clay -contents based on work by Clapp and Hornberger (1978) and Cosby et al. -(1984), and organic properties of the soil (Lawrence and Slater 2008). +contents based on work by :ref:`Clapp and Hornberger (1978) +` and :ref:`Cosby et al. (1984) `, +and organic properties of the soil +(:ref:`Lawrence and Slater 2008 `). The hydraulic conductivity is defined at the depth of the interface of -two adjacent layers :math:`z_{h,\, i}` (Figure 7.3) and is a function +two adjacent layers :math:`z_{h,\, i}` (:numref:`Water flux schematic figure`) and is a function of the saturated hydraulic conductivity :math:`k_{sat} \left[z_{h,\, i} \right]`, the liquid volumetric soil moisture of the two layers :math:`\theta _{i}` and @@ -500,8 +510,8 @@ moisture of the two layers :math:`\theta _{i}` and The ice impedance factor is a function of ice content, and is meant to quantify the increased tortuosity of the water flow when part of the -pore space is filled with ice. Swenson et al. (2012) used a power law -form :math:`\Theta _{ice} =10^{-\Omega F_{ice} }` where +pore space is filled with ice. :ref:`Swenson et al. (2012) ` +used a power law form :math:`\Theta _{ice} =10^{-\Omega F_{ice} }` where :math:`\Omega =6`\ and :math:`F_{ice} =\frac{\theta _{ice} }{\theta _{sat} }` is the ice-filled fraction of the pore space. @@ -517,7 +527,8 @@ organic components. The water content at saturation (i.e. porosity) is \theta _{sat,i} =(1-f_{om,i} )\theta _{sat,\min ,i} +f_{om,i} \theta _{sat,om} where :math:`f_{om,i}` is the soil organic matter fraction, -:math:`\theta _{sat,om} =0.9` (Farouki 1981; Letts et al. 2000) is the +:math:`\theta _{sat,om} =0.9` (:ref:`Farouki 1981 `; +:ref:`Letts et al. 2000 `) is the porosity of organic matter and the porosity of the mineral soil :math:`\theta _{sat,\min ,i}` is @@ -533,7 +544,7 @@ The exponent “:math:`B`” is B_{i} =(1-f_{om,i} )B_{\min ,i} +f_{om,i} B_{om} -where :math:`B_{om} =2.7`\ (Letts et al. 2000) and +where :math:`B_{om} =2.7`\ (:ref:`Letts et al. 2000 `) and .. math:: :label: 7.93) @@ -541,7 +552,7 @@ where :math:`B_{om} =2.7`\ (Letts et al. 2000) and B_{\min ,i} =2.91+0.159(\% clay)_{i} . The soil matric potential (mm) is defined at the node depth -:math:`z_{i}` of each layer :math:`i` (Figure 7.3) +:math:`z_{i}` of each layer :math:`i` (:numref:`Water flux schematic figure`) .. math:: :label: ZEqnNum316201 @@ -574,8 +585,8 @@ by the organic soil properties even for values of :math:`f_{om}` as low as 1 %. To better represent the influence of organic soil material on the grid cell average saturated hydraulic conductivity, the soil organic matter fraction is further subdivided into “connected” and “unconnected” -fractions using a result from percolation theory (Stauffer and Aharony -1994, Berkowitz and Balberg 1992). Assuming that the organic and mineral +fractions using a result from percolation theory (:ref:`Stauffer and Aharony +1994 `, :ref:`Berkowitz and Balberg 1992 `). Assuming that the organic and mineral fractions are randomly distributed throughout a soil layer, percolation theory predicts that above a threshold value :math:`f_{om} =f_{threshold}` , connected flow pathways consisting of @@ -601,7 +612,7 @@ pass through the mineral and organic components in series k_{sat,\, uncon} =f_{uncon} \left(\frac{\left(1-f_{om} \right)}{k_{sat,\, \min } } +\frac{\left(f_{om} -f_{perc} \right)}{k_{sat,\, om} } \right)^{-1} . where saturated hydraulic conductivity for mineral soil depends on soil -texture (Cosby et al. 1984) as +texture (:ref:`Cosby et al. (1984) `) as .. math:: :label: 7.99) @@ -621,7 +632,7 @@ as Numerical Solution ^^^^^^^^^^^^^^^^^^^^^^^^ -With reference to Figure 7.3, the equation for conservation of mass +With reference to :numref:`Water flux schematic figure`, the equation for conservation of mass (equation ) can be integrated over each layer as .. math:: @@ -657,7 +668,7 @@ is the change in volumetric soil liquid water of layer :math:`i` in time :math:`i` (mm). The water removed by transpiration in each layer :math:`e_{i}` is a -function of the total transpiration :math:`E_{v}^{t}` (Chapter 5) and +function of the total transpiration :math:`E_{v}^{t}` (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) and the effective root fraction :math:`r_{e,\, i}` .. math:: @@ -665,8 +676,11 @@ the effective root fraction :math:`r_{e,\, i}` e_{i} =r_{e,\, i} E_{v}^{t} . -Figure 7.3. Schematic diagram of numerical scheme used to solve for soil -water fluxes. +.. _Water flux schematic figure: + +.. Figure:: image2.png + + Schematic diagram of numerical scheme used to solve for soil water fluxes. Shown are three soil layers, :math:`i-1`, :math:`i`, and :math:`i+1`. The soil matric potential :math:`\psi` and volumetric soil water @@ -678,7 +692,6 @@ the interface of two layers :math:`z_{h}` . The layer thickness is term :math:`e` (ET loss) is defined as positive for flow out of the layer. -.. image:: image2.png Note that because more than one plant functional type (PFT) may share a soil column, the transpiration :math:`E_{v}^{t}` is a weighted sum of @@ -711,10 +724,10 @@ fraction for the :math:`j^{th}` PFT \begin{array}{l} {\left(r_{e,\, i} \right)_{j} =\frac{\left(r_{i} \right)_{j} \left(w_{i} \right)_{j} }{\left(\beta _{t} \right)_{j} } \qquad \left(\beta _{t} \right)_{j} >0} \\ {\left(r_{e,\, i} \right)_{j} =0\qquad \left(\beta _{t} \right)_{j} =0} \end{array} and :math:`\left(r_{i} \right)_{j}` is the fraction of roots in layer -:math:`i` (Chapter 8), :math:`\left(w_{i} \right)_{j}` is a soil -dryness or plant wilting factor for layer :math:`i` (Chapter 8), and -:math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total -soil column for the :math:`j^{th}` PFT (Chapter 8). +:math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), +:math:`\left(w_{i} \right)_{j}` is a soil dryness or plant wilting factor +for layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), and :math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total +soil column for the :math:`j^{th}` PFT (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). The soil water fluxes in equation , which are a function of :math:`\theta _{liq,\, i}` and :math:`\theta _{liq,\, i+1}` because of @@ -922,7 +935,7 @@ Equation set for layer :math:`i=1` '''''''''''''''''''''''''''''''''''''''''' For the top soil layer (:math:`i=1`), the boundary condition is the -infiltration rate (section 7.3), +infiltration rate (section :numref:`Surface Runoff`), :math:`q_{i-1}^{n+1} =-q_{infl}^{n+1}` , and the water balance equation is @@ -1127,7 +1140,7 @@ Frozen Soils and Perched Water Table ---------------------------------------- When soils freeze, the power-law form of the ice impedance factor -(section 7.4.1) can greatly decrease the hydraulic conductivity of the +(section :numref:`Hydraulic Properties`) can greatly decrease the hydraulic conductivity of the soil, leading to nearly impermeable soil layers. When unfrozen soil layers are present above relatively ice-rich frozen layers, the possibility exists for perched saturated zones. Lateral drainage from @@ -1206,12 +1219,12 @@ the ice content of the soil layers interacting with the water table where :math:`\Omega =6`\ is an adjustable parameter, :math:`jwt` is the index of the layer directly above the water table, :math:`F_{ice} =\frac{\theta _{ice} }{\theta _{sat} }` is the -ice-filled fraction of the pore space of soil layer :math:`i` (kg -m\ :sup:`-2`), and :math:`\Delta z_{i}` is the layer thickness -(mm). This expression is functionally the same as that used to determine -the ice impedance factor in section 7.4. In equation , the decay factor -:math:`f_{drai} =2.5` m\ :sup:`-1` and the maximum drainage when -the water table depth is at the surface +ice-filled fraction of the pore space of soil layer :math:`i` (kg +m\ :sup:`-2`), and :math:`\Delta z_{i}` is the layer thickness (mm). This +expression is functionally the same as that used to determine the ice +impedance factor in section :numref:`Hydraulic Properties`. In equation , +the decay factor :math:`f_{drai} =2.5` m\ :sup:`-1` and the maximum drainage +when the water table depth is at the surface :math:`q_{drai,\, \max } =10\sin (\beta )` kg m\ :sup:`-2` s\ :sup:`-1` , where :math:`\beta` is the mean grid cell topographic slope in radians, were determined for global simulations @@ -1219,8 +1232,7 @@ through sensitivity analysis and comparison with observed runoff. Determination of water table depth :math:`z_{\nabla }` is based on work by Niu et al. (2007). In this approach, a groundwater component is added -in the form of an unconfined aquifer lying below the soil column (Figure -7.1). The groundwater solution is dependent on whether the water table +in the form of an unconfined aquifer lying below the soil column (:numref:`Hydrologic processes figure`). The groundwater solution is dependent on whether the water table is within or below the soil column. The water stored in the unconfined aquifer :math:`W_{a}` has a prescribed maximum value (5000 mm). When the water table is within the soil column, :math:`W_{a}` is constant @@ -1380,136 +1392,7 @@ at the beginning and ending of the time step defined as Currently, glaciers are non-vegetated and :math:`E_{v} =W_{can} =0`. The contribution of lake runoff to :math:`q_{rgwl}` is described in -section 9.6.3. The runoff term :math:`q_{rgwl}` may be negative for -glaciers and lakes, which reduces the total amount of runoff available -to the RTM. - -.. _The Variable Infiltration Capacity parameterizations as a hydrologic option: - -The Variable Infiltration Capacity parameterizations as a hydrologic option -------------------------------------------------------------------------------- - -The hydrologic parameterizations from the Variable Infiltration Capacity -(VIC) land surface model (Liang et al. 1994) have been implemented as a -hydrologic option. VIC includes two different time scales of runoff -generation. To capture such dynamics, the soil column in the original -VIC model -(http://www.hydro.washington.edu/Lettenmaier/Models/VIC/Overview/ModelOverview.shtml) -is typically divided into three layers with variable soil depths. The -upper two layers are designed to represent the dynamic responses of the -soil to rainfall events for surface runoff generation, and the lower -layer is used to characterize the seasonal soil moisture behavior and -subsurface runoff generation. The implementation of the VIC -parameterizations are as described in Li et al. (2011) except where -updated for consistency with modifications to CLM hydrology in CLM4.5. -Note that unless explicitly mentioned in this section, any descriptions -from sections 7.1-7.7 are intact and remain valid when the VIC hydrology -option is turned on. - -Three VIC soil layers are defined by aggregating multiple layers in the -CLM soil column with thicknesses of :math:`\sum^3_{i=1}{\Delta z_i}`, -:math:`\sum^6_{i=4}{\Delta z_i}`, -:math:`\sum^{N_{levsoi}}_{i=7}{\Delta z_i}`, respectively. At each time -step, the soil moisture profile is determined following the algorithms -detailed in section 7.4, and aggregated to the three VIC layers for -runoff generation calculations. The surface runoff generated by the -saturation excess runoff mechanism, q\ :sub:`over`, is -calculated using equation , but with the fractional saturated area -defined as - -.. math:: - :label: ZEqnNum627546 - - f_{sat} =1-\left(1-{w_{top} \mathord{\left/ {\vphantom {w_{top} w_{m,\, top} }} \right. \kern-\nulldelimiterspace} w_{m,\, top} } \right)^{{1\mathord{\left/ {\vphantom {1 \left(1+b_{inf} \right)}} \right. \kern-\nulldelimiterspace} \left(1+b_{inf} \right)} } - -where :math:`w_{top}` and :math:`w_{m,top}` are calculated as -:math:`\sum^6_{i=1}{{\theta }_i\Delta z_i}` and -:math:`\sum^6_{i=1}{{\theta }_{s,i}\Delta z_i}`, respectively, and -represent the soil moisture (kg m\ :sup:`-2`) and maximum soil -moisture (kg m\ :sup:`-2`) in the top two VIC layers combined. - -In equation , it is hypothesized that the spatial heterogeneity of soil -moisture holding capacity in the top VIC layers can be represented by a -soil moisture holding capacity curve as defined in equation , in which -:math:`b_{inf}` is a parameter that controls the shape of the curve. -That is, if one assumes that a grid cell (or soil column in this case) -is composed of many pixels (or points) with varying soil moisture -capacity, this variation across the grid cell can be represented -conceptually as - -.. math:: - :label: ZEqnNum929519 - - i=i_m\left(1-{\left(1-A\right)}^{1/b_{inf}}\right) - -where :math:`i` and :math:`i_{m}` are the point and maximum point soil -moisture holding capacities (kg m\ :sup:`-2`), respectively; -:math:`A` is the fraction of a grid cell for which the soil moisture -holding capacity is less than or equal to :math:`i`; and -:math:`i_m=w_{m,top}\left(1+b_{inf}\right)`. When :math:`A` is equal to -:math:`f_{sat}`, the corresponding point soil moisture holding capacity -is denoted as :math:`i_0`. The maximum soil infiltration capacity (kg -m\ :sup:`-2` s\ :sup:`-1`) in equation becomes - -.. math:: - :label: ZEqnNum202398 - - q_{inf,\, max} =\left\{\begin{array}{l} {\left(1-f_{sat} \right)\theta _{ice,\, top} \left(\frac{w_{m,\, top} -w_{top} }{\Delta t} \right)\qquad i_{o} +q_{in,\, soil} \Delta t\ge i_{m} } \\ {\left(1-f_{sat} \right)\frac{\theta _{ice,\, top} }{\Delta t} \left\{\begin{array}{l} {\left(w_{m,\, top} -w_{top} \right)-w_{m,\, top} \times } \\ {\left[1-\max \left(1,\, \frac{\left(i_{o} +q_{in,\, soil} \Delta t\right)}{i_{m} } \right)^{1+b_{inf} } \right]} \end{array}\right\}\qquad i_{o} +q_{in,\, soil} \Delta t`. +It includes extensive modifications to the lake code of +:numref:`Zeng et al. (2002) ` used in CLM versions 2 through 4, which utilized concepts from the lake models of -Bonan (1996), Henderson-Sellers (1985, 1986), Hostetler and Bartlein -(1990) and the coupled lake-atmosphere model of Hostetler et al. (1993, -1994). Lakes have spatially variable depth prescribed in the surface -data (section 9.2); the surface data optionally includes lake optical +:numref:`Bonan (1996) `, +:numref:`Henderson-Sellers (1985) `, +:numref:`Henderson-Sellers (1986) `, +:numref:`Hostetler and Bartlein (1990) `, +and the coupled lake-atmosphere model of :numref:`Hostetler et al. (1993) `, :numref:`Hostetler et al. (1993) `. +Lakes have spatially variable depth prescribed in the surface data (section +:numref:`External Data Lake`); the surface data optionally includes lake optical extinction coeffient and horizontal fetch, currently only used for site simulations. Lake physics includes freezing and thawing in the lake body, resolved snow layers, and “soil” and bedrock layers below the lake @@ -30,6 +34,8 @@ ground heat flux *G* as a top boundary condition. Snow, soil, and bedrock models generally follow the formulations for non-vegetated surfaces (Chapter 6), with modifications described below. +.. _Vertical Discretization Lake: + Vertical Discretization --------------------------- @@ -62,6 +68,8 @@ follow the scheme used over non-vegetated surfaces (Chapter 6), with modifications to the snow layer thickness rules to keep snow layers at least as thick as *s*\ :sub:`min` (section 9.6.5). +.. _External Data Lake: + External Data ----------------- @@ -73,6 +81,8 @@ km\ :sup:`-2`. As in Subin et al. (2012a, b), the Kourzeneva depth in each grid cell, based on interpolated compilations of geographic information. +.. _Surface Albedo Lake: + Surface Albedo ------------------ @@ -106,9 +116,13 @@ calculated as over non-vegetated surfaces (Chapter 3). These two reflectances are combined to obtain the snow-fraction-weighted albedo as in over non-vegetated surfaces (Chapter 3). +.. _Surface Fluxes and Surface Temperature Lake: + Surface Fluxes and Surface Temperature ------------------------------------------ +.. _Overview of Changes from CLM4: + Overview of Changes from CLM4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -137,6 +151,8 @@ Overview of Changes from CLM4 :math:`{T}_{g}` to maintain a stable density profile at the lake surface eq. . +.. _Surface Properties Lake: + Surface Properties ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -209,6 +225,8 @@ where *A* and *B* define the fetch- and depth-limitation, respectively; :math:`\varepsilon =1` , :math:`f_{c} =100` , and *u* (m s\ :sup:`-1`) is the atmospheric forcing wind. +.. _Surface Flux Solution Lake: + Surface Flux Solution ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -475,9 +493,13 @@ temperature solution (section 9.5.3). An energy balance check is included at each timestep to insure that eq. XXX is obeyed to within 0.1 W m\ :sup:`-2`. +.. _Lake Temperature: + Lake Temperature -------------------- +.. _Introduction Lake: + Introduction ^^^^^^^^^^^^^^^^^^ @@ -525,6 +547,8 @@ restricted to occur at :math:`T_{j} =T_{f}` \ in the snow-lake-soil system, allowing eq. to be precisely enforced and justifying the exclusion of :math:`c_{v,j}` from the time derivative in eq. . +.. _Overview of Changes from CLM4 2: + Overview of Changes from CLM4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -546,6 +570,8 @@ arbitrary depth, except for a depth-dependent enhanced mixing (section diffusivity (specifically, the Brunt-Väisälä frequency term; eq. ) was corrected. +.. _Boundary Conditions Lake: + Boundary Conditions ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -565,6 +591,8 @@ calculation of eddy diffusivity: where :math:`u_{*}` \ is the friction velocity calculated in section 9.4.3 and *k* is the von Karman constant (Table 2.6). +.. _Eddy Diffusivity and Thermal Conductivities: + Eddy Diffusivity and Thermal Conductivities ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -614,7 +642,7 @@ s\ :sup:`-1`) (eq. ) is used to evaluate :math:`w^{*}` and :math:`k^{*}` rather than the 10-m wind used by Henderson-Sellers (1985). -The CityplaceRichardson number is +The Richardson number is .. math:: :label: 12.32) @@ -692,6 +720,8 @@ vegetated land units (Chapter 6), except for the adjustment of thermal conductivity for frost heave or excess ice (Subin et al., 2012a, Supporting Information). +.. _Radiation Penetration: + Radiation Penetration ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -741,6 +771,8 @@ al. 2012a): \eta =1.1925d^{-0.424} . +.. _Heat Capacities Lake: + Heat Capacities ^^^^^^^^^^^^^^^^^^^^^ @@ -761,6 +793,8 @@ bedrock layer (J m\ :sup:`-2`) is determined as for vegetated land units (Chapter 6), as the sum of the heat capacities for the water, ice, and mineral constituents. +.. _Crank-Nicholson Solution Lake: + Crank-Nicholson Solution ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -819,6 +853,8 @@ section 9.4.3 (the factor of 2 merely cancels out the Crank-Nicholson F_{i} =\lambda _{i} \frac{T_{i} ^{n} -T_{i+1}^{n} }{z_{n+1} -z_{n} } . +.. _Phase Change Lake: + Phase Change ^^^^^^^^^^^^^^^^^^ @@ -896,6 +932,8 @@ is exhausted and the top lake layer is set to freezing. The snow thickness is adjusted downwards in proportion to the amount of melt, maintaining constant density. +.. _Convection Lake: + Convection ^^^^^^^^^^^^^^^^ @@ -983,6 +1021,8 @@ to *i* + 1, the ice fraction and temperature are set as follows, where #. Otherwise, :math:`I_{j} =0` and :math:`T_{j} =T_{unfr}` . +.. _Energy Conservation Lake: + Energy Conservation ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1012,9 +1052,13 @@ If :math:`\left|E_{soi} \right|<0.1`\ W m\ :sup:`-2`, it is subtracted from the sensible heat flux and added to *G*. Otherwise, the model is aborted. +.. _Lake Hydrology: + Lake Hydrology ------------------ +.. _Overview Lake Hydrology: + Overview ^^^^^^^^^^^^^^ @@ -1042,6 +1086,8 @@ explicit time-stepping integration of the surface flux solution, resolved snow layers must be a minimum of :math:`s_{\min }` = 4 cm thick rather than 1 cm when the default timestep of 1800 s is used. +.. _Water Balance Lake: + Water Balance ^^^^^^^^^^^^^^^^^^^ @@ -1063,6 +1109,8 @@ ground evaporation (section 9.4.3), and :math:`n_{levsoi}` is the number of hydrologically active soil layers (as opposed to dry bedrock layers). +.. _Precipitation, Evaporation, and Runoff Lake: + Precipitation, Evaporation, and Runoff ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1120,6 +1168,8 @@ proportion as the snow ice (i.e., maintaining the same density), unless there was no snow before adding the frost, in which case the density is assumed to be 250 kg m\ :sup:`-3`. +.. _Soil Hydrology Lake: + Soil Hydrology ^^^^^^^^^^^^^^^^^^^^ @@ -1153,6 +1203,8 @@ This allows excess ice to be initialized (and begin to be lost only after the pore ice is melted, which is realistic if the excess ice is found in heterogeneous chunks) but irreversibly lost when melt occurs. +.. _Modifications to Snow Layer Logic Lake: + Modifications to Snow Layer Logic ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst index 7219e7a293..e4e2db66fa 100644 --- a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst +++ b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst @@ -4,24 +4,26 @@ Offline Mode ================ In offline mode (uncoupled to an atmospheric model), the atmospheric -forcing required by CLM (Table 2.3) is supplied by observed datasets. -The standard forcing provided with the model is a 110-year (1901-2010) -dataset (CRUNCEP; Viovy 2011) that is a combination of two existing -datasets; the CRU TS3.2 0.5\ :math:`{}^\circ` X 0.5\ :math:`{}^\circ` -monthly data covering the period 1901 to 2002 (Mitchell and Jones 2005) +forcing required by CLM (:numref:`Table Atmospheric input to land model`) +is supplied by observed datasets. The standard forcing provided with the +model is a 110-year (1901-2010) dataset (CRUNCEP; :ref:`Viovy 2011 `) +that is a combination of two existing datasets; the CRU TS3.2 0.5\ +:math:`{}^\circ` X 0.5\ :math:`{}^\circ` monthly data covering the period +1901 to 2002 (:ref:`Mitchell and Jones 2005 `) and the NCEP reanalysis 2.5\ :math:`{}^\circ` X 2.5\ :math:`{}^\circ` 6-hourly data covering the period 1948 to 2010. The CRUNCEP dataset has been used to force CLM for studies of vegetation growth, -evapotranspiration, and gross primary production (Mao et al. 2012, Mao -et al. 2013, Shi et al. 2013) and for the TRENDY (trends in net -land-atmosphere carbon exchange over the period 1980-2010) project (Piao -et al. 2012). Version 4 is used here (Viovy 2011). Alternative forcing -datasets can also be used (e.g., the Qian et al. (2006) dataset used for +evapotranspiration, and gross primary production (:ref:`Mao et al. 2012 `, +:ref:`Mao et al. 2013 `, :ref:`Shi et al. 2013 `) +and for the TRENDY (trends in net land-atmosphere carbon exchange over the period +1980-2010) project (:ref:`Piao et al. 2012 `). Version 4 is used +here (:ref:`Viovy 2011 `). Alternative forcing datasets can also be used +(e.g., the :ref:`Qian et al. (2006) ` dataset used for previous versions of CLM is still available). Here, the CRUNCEP dataset, which does not include data over oceans, -lakes, and Antarctica is modified. This missing data is filled with Qian -et al. (2006) data from 1948 that is interpolated by the data atmosphere +lakes, and Antarctica is modified. This missing data is filled with +:ref:`Qian et al. (2006) ` data from 1948 that is interpolated by the data atmosphere model to the 0.5\ :math:`{}^\circ` CRUNCEP grid. This allows the model to be run over Antarctica and ensures data is available along coastlines regardless of model resolution. @@ -119,7 +121,7 @@ and :math:`b_{0} =0.29548,b_{1} =0.00504,b_{2} =-1.4957\times 10^{-5} ,b_{3} =1.4881\times 10^{-8}` are coefficients from polynomial fits to the placeCAM data. -The additional atmospheric forcing variables required by Table 2.3 are +The additional atmospheric forcing variables required by :numref:`Table Atmospheric input to land model` are derived as follows. The atmospheric reference height :math:`z'_{atm}` (m) is set to 30 m. The directional wind components are derived as :math:`u_{atm} =v_{atm} ={W_{atm} \mathord{\left/ {\vphantom {W_{atm} \sqrt{2} }} \right. \kern-\nulldelimiterspace} \sqrt{2} }` . @@ -141,8 +143,8 @@ where e_{atm} =\frac{P_{atm} q_{atm} }{0.622+0.378q_{atm} } -and :math:`\sigma` is the Stefan-Boltzmann constant (W -m\ :sup:`-2` K\ :math:`{}^{-4}`) (Table 2.6). The fraction of +and :math:`\sigma` is the Stefan-Boltzmann constant (W m\ :sup:`-2` K\ +:math:`{}^{-4}`) (:numref:`Table Physical constants`). The fraction of precipitation :math:`P` (mm s\ :sup:`-1`) falling as rain and/or snow is @@ -164,8 +166,9 @@ where f_{P} =0<0.5\left(T_{atm} -T_{f} \right)<1. The aerosol deposition rates :math:`D_{sp}` (14 rates as described in -Table 2.3) are provided by a time-varying, globally-gridded aerosol -deposition file developed by Lamarque et al. (2010). +:numref:`Table Atmospheric input to land model`) are provided by a +time-varying, globally-gridded aerosol deposition file developed by +:ref:`Lamarque et al. (2010) `. If the user wishes to provide atmospheric forcing data from another source, the data format outlined above will need to be followed with the @@ -183,7 +186,7 @@ from the water (:math:`T_{atm} >T_{f}` ) or ice (:math:`T_{atm} \le T_{f}` ) saturation vapor pressure :math:`e_{sat}^{T_{atm} }` as :math:`e_{atm} =\frac{RH}{100} e_{sat}^{T_{atm} }` where :math:`T_{f}` -is the freezing temperature of water (K) (Table 2.6), and +is the freezing temperature of water (K) (:numref:`Table Physical constants`), and :math:`P_{atm}` is the pressure at height :math:`z_{atm}` (Pa). The data atmosphere model will also accept a user-supplied dew point temperature :math:`T_{dew}` (K) and derive specific humidity @@ -195,7 +198,7 @@ temperature :math:`T_{dew}` (K) and derive specific humidity q_{atm} = \frac{0.622e_{sat}^{T_{dew} } }{P_{atm} -0.378e_{sat}^{T_{dew} } } . Here, :math:`e_{sat}^{T}` , the saturation vapor pressure as a function -of temperature, is derived from Lowe’s (1977) polynomials. If not +of temperature, is derived from :ref:`Lowe’s (1977) ` polynomials. If not provided by the user, the atmospheric pressure :math:`P_{atm}` (Pa) is set equal to the standard atmospheric pressure :math:`P_{std} =101325` Pa, and surface pressure :math:`P_{srf}` (Pa) is set equal diff --git a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst index 741801942d..28f43fce9a 100644 --- a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst +++ b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst @@ -9,6 +9,8 @@ where :math:`\vec{S}` is the net solar flux absorbed by the vegetation (“v”) and the ground (“g”) and :math:`\vec{L}` is the net longwave flux (positive toward the atmosphere) (W m\ :sup:`-2`). +.. _Solar Fluxes: + Solar Fluxes ---------------- @@ -143,6 +145,8 @@ fraction at depth :math:`x`, defined by :math:`f_{sun} =\exp \left(-Kx\right)`, to give fluxes per unit sunlit or shaded plant area at depth :math:`x`. +.. _Longwave Fluxes: + Longwave Fluxes ------------------- diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index b953d98b3d..4b81731fb0 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -3,127 +3,187 @@ References ============== +.. _Aberetal1990: + Aber, J.D., Melillo, J.M. and McClaugherty, C.A., 1990. Predicting long-term patterns of mass loss, nitrogen dynamics, and soil organic matter formation from initial fime litter chemistry in temperate forest ecosystems. Canadian Journal of Botany, 68: 2201-2208. +.. _Aberetal2003: + Aber, J.D., Goodale, C.L., Ollinger, S.V., Smith, M.-L., Magill, A.H., Martin, M.E., Hallett, R.A., and Stoddard, J.L. 2003. Is nitrogen deposition altering the nitrogen status of northeastern forests? BioScience 53:375-389. +.. _Allenetal2005: + Allen, C.B., Will, R.E., and Jacobson, M.A. 2005. Production efficiency and radiation use efficiency of four tree species receiving irrigation and fertilization. Forest Science 51:556-569. +.. _Anderson1976: + Anderson, E.A. 1976. A point energy and mass balance model of a snow cover. NOAA Technical Report NWS 19, Office of Hydrology, National Weather Service, Silver Spring, MD. +.. _Andréetal1986: + André, J.-C., Goutorbe, J.-P., and Perrier, A. 1986. HAPEX-MOBILHY: A hydrologic atmosphere experiment for the study of water budget and evaporation flux at the climatic scale. Bull. Amer. Meteor. Soc. 67:138-144. +.. _AndrénPaustian1987: + Andrén, O. and Paustian, K., 1987. Barley straw decomposition in the field: a comparison of models. Ecology 68:1190-1200. +.. _ArahStephen1998: + Arah, J.R.M. and Stephen, K.D., 1998. A model of the processes leading to methane emission from peatland. Atmos. Environ. 32:3257-3264. +.. _ArahVinten1995: + Arah, J. and Vinten, A., 1995. Simplified models of anoxia and denitrification in aggregated and simple-structured soils. European Journal of Soil Science 46:507-517. +.. _Arendt, A., et al. 2012. Randolph Glacier Inventory: A Dataset of Global + Arendt, A., et al. 2012. Randolph Glacier Inventory: A Dataset of Global Glacier Outlines Version: 1.0, Global Land Ice Measurements from Space, Boulder Colorado, USA. Digital Media. +.. _AroraBoer2005: + Arora, V.K. and Boer, G.J. 2005. Fire as an interactive component of dynamic vegetation models. J. Geophys. Res. 110:G02008. DOI:10.1029/2005JG000042. +.. _Arya2001: + Arya, S.P. 2001. Introduction to Meteorology. Academic Press, San Diego, CA. +.. _Asneretal1998: + Asner, G.P., Wessman, C.A., Schimel, D.S., and Archer, S. 1998. Variability in leaf and litter optical properties: implications for BRDF model inversions using AVHRR, MODIS, and MISR. Remote Sens. Environ. 63:243-257. +.. _AxelssonAxelsson1986: + Axelsson, E., and Axelsson, B. 1986. Changes in carbon allocation patterns in spruce and pine trees following irrigation and fertilization. Tree Phys. 2:189-204. +.. _Bairdetal2004: + Baird, A.J., Beckwith, C.W., Waldron, S. and Waddington, J.M., 2004. Ebullition of methane-containing gas bubbles from near-surface Sphagnum peat. Geophys. Res. Lett. 31. DOI:10.1029/2004GL021157. +.. _Baldocchietal2001: + Baldocchi, D., et al. 2001. FLUXNET: A new tool to study the temporal and spatial variability of ecosystem-scale carbon dioxide, water vapor, and energy flux densities. Bull. Amer. Meteor. Soc. 82:2415-2433. +.. _Barbottinetal2005: + Barbottin, A., Lecomte, C., Bouchard, C., and Jeuffroy, M.-H. 2005. Nitrogen remobilization during grain filling in wheat: Genotypic and environmental effects. Crop Sci. 45:1141-1150. +.. _Batjes2006: + Batjes, N.H., 2006. ISRIC-WISE derived soil properties on a 5 by 5 arc-minutes global grid. Report 2006/02 (available through : http://www.isric.org) +.. _Berger1978a: + Berger, A.L. 1978a. Long-term variations of daily insolation and quaternary climatic changes. J. Atmos. Sci. 35:2362-2367. +.. _Berger1978b: + Berger, A.L. 1978b. A simple algorithm to compute long-term variations of daily or monthly insolation. Contribution de l’Institut d’Astronomie et de Géophysique, Université Catholique de Louvain, Louvain-la-Neuve, No. 18. +.. _Bergeretal1993: + Berger, A., Loutre, M.-F., and Tricot, C. 1993. Insolation and Earth’s orbital periods. J. Geophys. Res. 98:10341-10362. +.. _BerkowitzBalberg1992: + Berkowitz, B., and Balberg, I. 1992. Percolation approach to the problem of hydraulic conductivity in porous media. Transport in Porous Media 9:275–286. +.. _BevenKirkby1979: + Beven, K.J., and Kirkby, M.J. 1979. A physically based variable contributing area model of basin hydrology. Hydrol. Sci. Bull. 24:43-69. Bohren, C. F., and Huffman, D. R. 1983. Absorption and scattering of light by small particles. John Wiley & Sons, New York, NY. +.. _Bonan1996: + Bonan, G.B. 1996. A land surface model (LSM version 1.0) for ecological, hydrological, and atmospheric studies: Technical description and user’s guide. NCAR Technical Note NCAR/TN-417+STR, National Center for Atmospheric Research, Boulder, CO, 150 pp. +.. _Bonan1998: + Bonan, G.B. 1998. The land surface climatology of the NCAR Land Surface Model coupled to the NCAR Community Climate Model. J. Climate 11:1307-1326. +.. _Bonan2002: + Bonan, G.B. 2002. Ecological Climatology: Concepts and Applications. Cambridge University Press. +.. _Bonanetal2002a: + Bonan, G.B., Oleson, K.W., Vertenstein, M., Levis, S., Zeng, X., Dai, Y., Dickinson, R.E., and Yang, Z.-L. 2002a. The land surface climatology of the Community Land Model coupled to the NCAR Community Climate Model. J. Climate 15: 3123-3149. +.. _Bonanetal2002b: + Bonan, G.B., Levis, S., Kergoat, L., and Oleson, K.W. 2002b. Landscapes as patches of plant functional types: An integrating concept for climate and ecosystem models. Global Biogeochem. Cycles 16: 5.1-5.23. +.. _BonanLevis2006: + Bonan, G.B., and Levis, S. 2006. Evaluating aspects of the Community Land and Atmosphere Models (CLM3 and CAM3) using a dynamic global vegetation model. J. Climate 19:2290-2301. +.. _Bonanetal2011: + Bonan, G.B., Lawrence P.J., Oleson K.W., Levis S., Jung M., Reichstein M., Lawrence, D.M., and Swenson, S.C. 2011. Improving canopy processes in the Community Land Model (CLM4) using global flux fields empirically inferred from FLUXNET data. J. Geophys. Res. 116, G02014. DOI:10.1029/2010JG001593. +.. _Bonanetal2012: + Bonan, G. B., Oleson, K.W., Fisher, R.A., Lasslop, G., and Reichstein, M. 2012. Reconciling leaf physiological traits and canopy flux data: Use of the TRY and FLUXNET databases in the Community Land Model version 4, @@ -138,99 +198,147 @@ Branstetter, M.L. 2001. Development of a parallel river transport algorithm and applications to climate studies. Ph.D. dissertation, University of Texas at Austin. +.. _Brun1989: + Brun, E. 1989. Investigation of wet-snow metamorphism in respect of liquid water content. Ann. Glaciol. 13:22-26. +.. _BugmannSolomon2000: + Bugmann, H., and Solomon, A.M. 2000. Explaining forest composition and biomass across multiple biogeographical regions. Ecol. Appl. 10:95-114. +.. _Busing2005: + Busing, R.T. 2005. Tree mortality, canopy turnover, and woody detritus in old cove forests of the southern Appalachians. Ecology 86:73-84. +.. _CampbellNorman1998: + Campbell, G.S., and Norman, J.M. 1998. An Introduction to Environmental Biophysics (2:math:`{}^{nd}` edition). Springer-Verlag, New York. +.. _Castilloetal2012: + Castillo, G., Kendra, C., Levis, S., and Thornton, P. 2012. Evaluation of the new CNDV option of the Community Land Model: effects of dynamic vegetation and interactive nitrogen on CLM4 means and variability. J. Climate 25:3702–3714. +.. _Caoetal1996: + Cao, M., Marshall, S. and Gregson, K., 1996. Global carbon exchange and methane emissions from natural wetlands: Application of a process-based model. J. Geophys. Res. 101(D9):14,399-14,414. +.. _Churkinaetal2003: + Churkina, G. et al., 2003. Analyzing the ecosystem carbon dynamics of four European coniferous forests using a biogeochemistry model. Ecosystems, 6: 168-184. +.. _CIESIN2005: + CIESIN: Gridded population of the world version 3 (GPWv3), 2005. Population density grids, Technical report, Socioeconomic Data and Applications Center (SEDAC), Columbia University, Palisades, New York, USA. +.. _ClappHornberger1978: + Clapp, R.B., and Hornberger, G.M. 1978. Empirical equations for some soil hydraulic properties. Water Resour. Res. 14:601-604. +.. _ClauserHuenges1995: + Clauser, C., and Huenges, E. 1995. Thermal conductivity of rocks and minerals. pp. 105-126. In: T. J. Ahrens (editor) Rock Physics and Phase Relations: A Handbook of Physical Constants. Washington, D.C. +.. _Clevelandetal1999: + Cleveland, C.C., Townsend, A.R., Schimel, D.S., Fisher, H., Howarth, R.W., Hedin, L.O., Perakis, S.S., Latty, E.F., Von Fischer, J.C., Elseroad, A., and Wasson, M.F. 1999. Global patterns of terrestrial biological nitrogen (N2) fixation in natural ecosystems. Global Biogeochem. Cycles 13:623-645. +.. _Collatzetal1991: + Collatz, G.J., Ball, J.T., Grivet, C., and Berry, J.A. 1991. Physiological and environmental regulation of stomatal conductance, photosynthesis, and transpiration: A model that includes a laminar boundary layer. Agric. For. Meteor. 54:107-136. +.. _Collatzetal1992: + Collatz, G.J., Ribas-Carbo, M., and Berry, J.A. 1992. Coupled photosynthesis-stomatal conductance model for leaves of C\ :math:`{}_{4}` plants. Aust. J. Plant Physiol. 19:519-538. +.. _Colmer2003: + Colmer, T.D., 2003. Long-distance transport of gases in plants: a perspective on internal aeration and radial oxygen loss from roots. Plant Cell and Environment 26:17-36. +.. _Conwayetal1996: + Conway, H., Gades, A., and Raymond, C.F. 1996. Albedo of dirty snow during conditions of melt. Water Resour. Res. 32:1713-1718. +.. _Cosbyetal1984: + Cosby, B.J., Hornberger, G.M., Clapp, R.B., and Ginn, T.R. 1984. A statistical exploration of the relationships of soil moisture characteristics to the physical properties of soils. Water Resour. Res. 20:682-690. +.. _Crawfordetal1982: + Crawford, T. W., Rendig, V. V., and Broadent, F. E. 1982. Sources, fluxes, and sinks of nitrogen during early reproductive growth of maize (Zea mays L.). Plant Physiol. 70:1645-1660. +.. _DaiZeng1997: + Dai, Y., and Zeng, Q. 1997. A land surface model (IAP94) for climate studies. Part I: formulation and validation in off-line experiments. Adv. Atmos. Sci. 14:433-460. +.. _Daietal2001: + Dai, Y., et al. 2001. Common Land Model: Technical documentation and user’s guide [Available online at http://climate.eas.gatech.edu/dai/clmdoc.pdf]. +.. _Daietal2003: + Dai, Y., Zeng, X., Dickinson, R.E., Baker, I., Bonan, G.B., Bosilovich, M.G., Denning, A.S., Dirmeyer, P.A., Houser, P.R., Niu, G., Oleson, K.W., Schlosser, C.A., and Yang, Z.-L. 2003. The Common Land Model. Bull. Amer. Meteor. Soc. 84:1013-1023. +.. _Daietal2004: + Dai, Y., Dickinson, R.E., and Wang, Y.-P. 2004. A two-big-leaf model for canopy temperature, photosynthesis, and stomatal conductance. J. Climate 17:2281-2299. +.. _DaiTrenberth2002: + Dai, A., and Trenberth, K.E. 2002. Estimates of freshwater discharge from continents: Latitudinal and seasonal variations. J. Hydrometeor. 3:660-687. +.. _DeFriesetal2000: + DeFries, R.S., Hansen, M.C., Townshend, J.R.G., Janetos, A.C., and Loveland, T.R. 2000. A new global 1-km dataset of percentage tree cover derived from remote sensing. Global Change Biol. 6:247-254. +.. _DegensSparling1996: + Degens, B. and Sparling, G., 1996. Changes in aggregation do not correspond with changes in labile organic C fractions in soil amended with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): @@ -239,187 +347,273 @@ with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): de Vries, D.A. 1963. Thermal Properties of Soils. In: W.R. van Wijk (editor) Physics of the Plant Environment. North-Holland, Amsterdam. +.. _Dickinson1983: + Dickinson, R.E. 1983. Land surface processes and climate-surface albedos and energy balance. Adv. Geophys. 25:305-353. +.. _Dickinsonetal1993: + Dickinson, R.E., Henderson-Sellers, A., and Kennedy, P.J. 1993. Biosphere-Atmosphere Transfer Scheme (BATS) version 1e as coupled to the NCAR Community Climate Model. NCAR Technical Note NCAR/TN-387+STR. National Center for Atmospheric Research, Boulder, CO. +.. _Dickinsonetal2006: + Dickinson, R.E., Oleson, K.W., Bonan, G., Hoffman, F., Thornton, P., Vertenstein, M., Yang, Z.-L., and Zeng, X. 2006. The Community Land Model and its climate statistics as a component of the Community Climate System Model. J. Climate 19:2302-2324. +.. _Dingman2002: + Dingman, S.L. 2002. Physical Hydrology. Second Edition. Prentice Hall, NJ. +.. _Dirmeyeretal1999: + Dirmeyer, P.A., Dolman, A.J., and Sato, N. 1999. The pilot phase of the Global Soil Wetness Project. Bull. Amer. Meteor. Soc. 80:851-878. +.. _Dobsonetal2000: + Dobson, J.E., Bright, E.A., Coleman, P.R., Durfee, R.C., and Worley, B.A. 2000. LandScan: A global population database for estimating populations at risk. Photogramm. Eng. Rem. Sens. 66:849-857. +.. _DormanSellers1989: + Dorman, J.L., and Sellers, P.J. 1989. A global climatology of albedo, roughness length and stomatal resistance for atmospheric general circulation models as represented by the simple biosphere model (SiB). J. Appl. Meteor. 28:833-855. +.. _Doughertyetal1994: + Dougherty, R.L., Bradford, J.A., Coyne, P.I., and Sims, P.L. 1994. Applying an empirical model of stomatal conductance to three C4 grasses. Agric. For. Meteor. 67:269-290. +.. _Drewniaketal2013: + Drewniak, B., Song, J., Prell, J., Kotamarthi, V.R., and Jacob, R. 2013. Modeling agriculture in the Community Land Model. Geosci. Model Dev. 6:495-515. DOI:10.5194/gmd-6-495-2013. +.. _Dunfieldetal1993: + Dunfield, P., Knowles, R., Dumont, R. and Moore, T.R., 1993. Methane Production and Consumption in Temperate and Sub-Arctic Peat Soils - Response to Temperature and Ph. Soil Biology & Biochemistry 25:321-326. +.. _EntekhabiEagleson1989: + Entekhabi, D., and Eagleson, P.S. 1989. Land surface hydrology parameterization for atmospheric general circulation models including subgrid scale spatial variability. J. Climate 2:816-831. +.. _FangStefan1996: + Fang, X. and Stefan, H.G., 1996. Long-term lake water temperature and ice cover simulations/measurements. Cold Regions Science and Technology 24:289-304. +.. _Farouki1981: + Farouki, O.T. 1981. The thermal properties of soils in cold regions. Cold Regions Sci. and Tech. 5:67-75. +.. _Farquharetal1980: + Farquhar, G.D., von Caemmerer, S., and Berry, J.A. 1980. A biochemical model of photosynthetic CO\ :sub:`2` assimilation in leaves of C\ :math:`{}_{3}` species. Planta 149:78-90. +.. _FarquharvonCaemmerer1982: + Farquhar, G.D., and von Caemmerer, S. 1982. Modeling of photosynthetic response to environmental conditions. pp. 549-587. In: O.L. Lange, P.S. Nobel, C.B. Osmond, and H. Zeigler (editors) Encyclopedia of Plant Physiology. Vol. 12B. Physiological Plant Ecology. II. Water Relations and Carbon Assimilation. Springer-Verlag, New York. +.. _Ferrari1999: + Ferrari, J.B., 1999. Fine-scale patterns of leaf litterfall and nitrogen cycling in an old-growth forest. Canadian Journal of Forest Research, 29: 291-302. +.. _FirestoneDavidson1989: + Firestone, M.K. and Davidson, E.A. 1989. Exchange of Trace Gases between Terrestrial Ecosystems and the Atmosphere. In: M.O. Andreae and D.S. Schimel (Editors). John Wiley and Sons, pp. 7-21. +.. _FlannerZender2005: + Flanner, M.G., and Zender. C.S. 2005. Snowpack radiative heating: Influence on Tibetan Plateau climate. Geophys. Res. Lett. 32:L06501. DOI:10.1029/2004GL022076. +.. _FlannerZender2006: + Flanner, M.G., and Zender, C.S. 2006. Linking snowpack microphysics and albedo evolution. J. Geophys. Res. 111:D12208. DOI:10.1029/2005JD006834. +.. _Flanneretal2007: + Flanner, M.G., Zender, C.S., Randerson, J.T., and Rasch, P.J. 2007. Present day climate forcing and response from black carbon in snow. J. Geophys. Res. 112:D11202. DOI:10.1029/2006JD008003. +.. _Flatauetal1992: + Flatau, P.J., Walko, R.L., and Cotton, W.R. 1992. Polynomial fits to saturation vapor pressure. J. Appl. Meteor. 31:1507-1513. +.. _Friedl,etal2002: + Friedl, M.A., McIver, D.K., Hodges, J.C.F., Zhang, X.Y., Muchoney, D., Strahler, A.H., Woodcock, C.E., Gopal, S., Schneider, A., Cooper, A., Baccini, A., Gao, F., and Schaaf, C. 2002. Global land cover mapping from MODIS: algorithms and early results. Remote Sens. Environ. 83:287-302. +.. _Frolkingetal2001: + Frolking, S., et al. 2001. Modeling Northern Peatland Decomposition and Peat Accumulation. Ecosystems. 4:479-498. +.. _Gallaisetal2006: + Gallais, A., Coque, M. Quillere, I., Prioul, J., and Hirel, B. 2006. Modeling postsilking nitrogen fluxes in maize (Zea mays) using 15N-labeling field experiments. New Phytologist 172:696-707. +.. _Gallaisetal2007: + Gallais, A., Coque, M., Gouis, J. L., Prioul, J. L., Hirel, B., and Quillere, I. 2007. Estimating the proportion of nitrogen remobilization and of postsilking nitrogen uptake allocated to maize kernels by Nitrogen-15 labeling. Crop Sci. 47:685-693. +.. _Gallowayetal2004: + Galloway, J.N., et al. 2004. Nitrogen cycles: past, present, and future. Biogeochem. 70:153-226. +.. _Garciaetal1988: + Garcia, R.L., Kanemasu, E.T., Blad, B.L., Bauer, A., Hatfield, J.L., Major, D.A., Reginato, R.J., and Hubbard, K.G. 1988. Interception and use efficiency of light in winter wheat under different nitrogen regimes. Agric. For. Meteor. 44:175-186. +.. _Gashetal1996: + Gash, J.H.C., Nobre, C.A., Roberts, J.M., and Victoria, R.L. 1996. An overview of ABRACOS. pp. 1-14. In: J.H.C. Gash, C.A. Nobre, J.M. Roberts, and R.L. Victoria (editors) Amazonian Deforestation and Climate. John Wiley and Sons, Chichester, England. +.. _Gholzetal1985: + Gholz, H.L., Perry, C.S., Cropper, W.P., Jr. and Hendry, L.C., 1985. Litterfall, decomposition, and nitrogen and phosphorous dynamics in a chronosequence of slash pine (*Pinus elliottii*) plantations. Forest Science, 31: 463-478. +.. _Giglioetal2006: + Giglio, L., Csiszar, I., and Justice, C.O. 2006. Global distribution and seasonality of active fires as observed with the Terra and Aqua Moderate Resolution Imaging Spectroradiometer (MODIS) sensors. J. Geophys. Res. 111:G02016. DOI:10.1029/2005JG000142. +.. _GlobalSoilDataTask2000: + Global Soil Data Task 2000. Global soil data products CD-ROM (IGBP-DIS). International Geosphere-Biosphere Programme-Data and Information Available Services [Available online at http://www.daac.ornl.gov]. +.. _Gomesetal2003: + Gomes, E.P.C., Mantovani, W., and Kageyama, P.Y. 2003. Mortality and recruitment of trees in a secondary montane rain forest in southeastern Brazil. Brazilian Journal of Biology 63:47-60. +.. _Goszetal1973: + Gosz, J.R., Likens, G.E., and Bormann, F.H. 1973. Nutrient release from decomposing leaf and branch litter in the Hubbard Brook Forest, New Hampshire. Ecological Monographs 43:173-191. +.. _GotangcoCastilloetal2012: + Gotangco Castillo C., Levis S., and Thornton P. 2012. Evaluation of the new CNDV option of the Community Land Model: Effects of dynamic vegetation and interactive nitrogen on CLM4 means and variability. J. Climate 25:3702-3714. DOI:10.1175/JCLID-11-00372.1. +.. _Grahametal1999: + Graham, S.T., Famiglietti, J.S., and Maidment, D.R. 1999. Five-minute, 1/2º, and 1º data sets of continental watersheds and river networks for use in regional and global hydrologic and climate system modeling studies. Water Resour. Res. 35:583-587. +.. _GrenfellWarren1999: + Grenfell, T.C., and Warren, S.G. 1999. Representation of a nonspherical ice particle by a collection of independent spheres for scattering and absorption of radiation. J. Geophys. Res. 104(D24):37697-37709. +.. _delGrossoetal2000: + del Grosso, S.J., et al. 2000. General model for N2O and N2 gas emissions from soils due to dentrification. Global Biogeochem. Cycles 14:1045-1060. +.. _Guentheretal1995: + Guenther, A., Hewitt, C.N., Erickson, D., Fall, R., Geron, C., Graedel, T., Harley, P., Klinger, L., Lerdau, M., McKay, W.A., Pierce, T., Scholes, B., Steinbrecher, R., Tallamraju, R., Taylor, J., and Zimmerman, P. 1995. A global model of natural volatile organic compound emissions. J. Geophys. Res. 100:8873-8892. +.. _Guentheretal2006: + Guenther, A., Karl, T., Harley, P., Wiedinmyer, C., Palmer. P.I., and Geron, C. 2006. Estimates of global terrestrial isoprene emissions using MEGAN (Model of Emissions of Gases and Aerosols from Nature). Atmos. Chem. Phys. 6:3181–3210. +.. _Guentheretal2012: + Guenther, A. B., Jiang, X., Heald, C. L., Sakulyanontvittaya, T., Duhl, T., Emmons, L. K., & Wang, X., 2012. The Model of Emissions of Gases and Aerosols from Nature version 2.1 (MEGAN2.1): an extended and updated framework for modeling biogenic emissions, Geosci. Model Dev., 5, 1471–1492. DOI:10.5194. +.. _Hacketal2006: + Hack, J.J., Caron, J.M., Yeager, S.G., Oleson, K.W., Holland, M.M., Truesdale, J.E., and Rasch, P.J. 2006. Simulation of the global hydrological cycle in the CCSM Community Atmosphere Model version 3 (CAM3): mean features. J. Climate 19:2199-2221. +.. _Hansenetal2003: + Hansen, M., DeFries, R.S., Townshend, J.R.G., Carroll, M., Dimiceli, C., and Sohlberg, R.A. 2003. Global percent tree cover at a spatial resolution of 500 meters: first results of the MODIS vegetation continuous fields algorithm. Earth Interactions 7:1-15. +.. _Hastingsetal1999: + Hastings, D.A., Dunbar, P.K., Elphingstone, G.M., Bootz, M., Murakami, H., Maruyama, H., Masaharu, H., Holland, P., Payne, J., Bryant, N.A., Logan, T.L., Muller, J.-P., Schreier, G., and MacDonald, J.S., eds., @@ -428,399 +622,583 @@ Elevation Model, Version 1.0. National Oceanic and Atmospheric Administration, National Geophysical Data Center, 325 Broadway, Boulder, Colorado 80305-3328, U.S.A. +.. _Healdetal2008: + Heald, C.L., Henze, D.K., Horowitz, L.W., Feddema, J., Lamarque, J.-F., Guenther, A., Hess, P.G., Vitt, F., Seinfeld, J.H., Goldstein, A.H., and Fung, I. 2008. Predicted change in global secondary organic aerosol concentrations in response to future climate, emissions, and land use change. J. Geophys. Res. 113:D05211. DOI:10.1029/2007JD009092. +.. _Healdetal2009: + Heald, C.L., Wilkinson, M.J., Monson, R.K., Alo, C.A., Wang, G.L., and Guenther, A. 2009. Response of isoprene emission to ambient CO\ :sub:`2` changes and implications for global budgets. Global Change Biol. 15:1127-1140. DOI:10.1111/j.1365-2486.2008.01802.x +.. _Henderson-Sellers1985: + Henderson-Sellers, B. 1985. New formulation of eddy diffusion thermocline models. Appl. Math. Modelling 9:441-446. +.. _Henderson-Sellers1986: + Henderson-Sellers, B. 1986. Calculating the surface energy balance for lake and reservoir modeling: A review. Rev. Geophys. 24:625-649. +.. _Henderson-Sellersetal1993: + Henderson-Sellers, A., Yang, Z.-L., and Dickinson, R.E. 1993. The project for intercomparison of land-surface parameterization schemes. Bull. Amer. Meteor. Soc. 74: 1335-1349. +.. _HostetlerBartlein1990: + Hostetler, S.W., and Bartlein, P.J. 1990. Simulation of lake evaporation with application to modeling lake level variations of Harney-Malheur Lake, Oregon. Water Resour. Res. 26:2603-2612. +.. _Hostetleretal1993: + Hostetler, S.W., Bates, G.T., and Giorgi, F. 1993. Interactive coupling of a lake thermal model with a regional climate model. J. Geophys. Res. 98:5045-5057. +.. _Hostetleretal1994: + Hostetler, S.W., Giorgi, F., Bates, G.T., and Bartlein, P.J. 1994. Lake-atmosphere feedbacks associated with paleolakes Bonneville and Lahontan. Science 263:665-668. +.. _Houetal2012: + Hou, Z., Huang, M., Leung, L.R., Lin, G., and Ricciuto, D.M. 2012. Sensitivity of surface flux simulations to hydrologic parameters based on an uncertainty quantification framework applied to the Community Land Model. J. Geophys. Res. 117:D15108. +.. _HuangLiang2006: + Huang, M., and Liang, X. 2006. On the assessment of the impact of reducing parameters and identification of parameter uncertainties for a hydrologic model with applications to ungauged basins. J. Hydrol. 320:37-61. +.. _Hugeliusetal2012: + Hugelius, G., C. Tarnocai, G. Broll, J.G. Canadell, P. Kuhry, adn D.K. Swanson, 2012. The Northern Circumpolar Soil Carbon Database: spatially distributed datasets of soil coverage and soil carbon storage in the northern permafrost regions. Earth Syst. Sci. Data Discuss., 5, 707-733 (available online at (http://dev1.geo.su.se/bbcc/dev/ncscd/). +.. _Huntetal1988: + Hunt, H.W., Ingham, E.R., Coleman, D.C., Elliott, E.T., and Reid, C.P.P. 1988. Nitrogen limitation of production and decomposition in prairie, mountain meadow, and pine forest. Ecology 69:1009-1016. +.. _HuntRunning1992: + Hunt, E.R., Jr. and Running, S.W., 1992. Simulated dry matter yields for aspen and spruce stands in the north american boreal forest. Canadian Journal of Remote Sensing, 18: 126-133. +.. _Huntetal1996: + Hunt, E.R., Jr. et al., 1996. Global net carbon exchange and intra-annual atmospheric CO\ :sub:`2` concentrations predicted by an ecosystem process model and three-dimensional atmospheric transport model. Global Biogeochemical Cycles, 10: 431-456. +.. _Hurttetal2006: + Hurtt, G.C., Frolking, S., Fearon, M.G., Moore, B., Shevliakova, E., Malyshev, S., Pacala, S.W., and Houghton, R.A. 2006. The underpinnings of land-use history: three centuries of global gridded land-use transitions, wood-harvest activity, and resulting secondary lands. Global Change Biol. 12:1208-1229. +.. _Hurttetal2011: + Hurtt, G.C., et al. 2011. Harmonization of land-use scenarios for the period 1500-2100: 600 years of global gridded annual land-use transitions, wood harvest, and resulting secondary lands. Climatic Change 109:117-161. DOI:10.1007/s10584-011-0153-2. +.. _Idso1981: + Idso, S.B. 1981. A set of equations for full spectrum and 8- to 14-\ :math:`\mu` \ m and 10.5- to 12.5-\ :math:`\mu` \ m thermal radiation from cloudless skies. Water Resour. Res. 17:295-304. +.. _IiyamaHasegawa2005: + Iiyama, I. and Hasegawa, S., 2005. Gas diffusion coefficient of undisturbed peat soils. Soil Science and Plant Nutrition 51:431-435. -Jackson, R. B., Canadell, J., Ehleringer, J. R., Mooney, H. A., Sala, O. +.. _Jacksonetal1996: + +Jacksonetal1996: E., and Schulze, E. D. 1996. A global analysis of root distributions for terrestrial biomes Oecologia 108:389–411. DOI:10.1007/BF00333714. +.. _Jacksonetal2010: + Jackson, T.L., Feddema, J.J., Oleson, K.W., Bonan, G.B., and Bauer, J.T. 2010. Parameterization of urban characteristics for global climate modeling. Annals of the Association of American Geographers. 100:848-865. +.. _JenkinsonColeman2008: + Jenkinson, D. and Coleman, K. 2008. The turnover of organic carbon in subsoils. Part 2. Modelling carbon turnover. European Journal of Soil Science 59:400-413. +.. _Jordan1991: + Jordan, R. 1991. A One-dimensional Temperature Model for a Snow Cover: Technical Documentation for SNTHERM.89. U.S. Army Cold Regions Research and Engineering Laboratory, Special Report 91-16. +.. _KattgeKnorr2007: + Kattge, J., and Knorr, W. 2007. Temperature acclimation in a biochemical model of photosynthesis: a reanalysis of data from 36 species. Plant Cell Environ. 30:1176-1190. DOI:10.1111/j.1365-3040.2007.01690.x. +.. _Kattgeetal2009: + Kattge, J., Knorr, W., Raddatz, T., and Wirth C. 2009: Quantifying photosynthetic capacity and its relationship to leaf nitrogen content for global–scale terrestrial biosphere models. Global Change Biol. 15:976–991. +.. _Kelleretal2004: + Keller, M., Palace, M., Asner, G.P., Pereira, R., Jr. and Silva, J.N.M., 2004. Coarse woody debris in undisturbed and logged forests in the eastern Brazilian Amazon. Global Change Biology, 10: 784-795. +.. _Kellneretal2006: + Kellner, E., Baird, A.J., Oosterwoud, M., Harrison, K. and Waddington, J.M., 2006. Effect of temperature and atmospheric pressure on methane (CH4) ebullition from near-surface peats. Geophys. Res. Lett. 33. DOI:10.1029/2006GL027509. +.. _Kimballetal1997: + Kimball, J.S., Thornton, P.E., White, M.A. and Running, S.W. 1997. Simulating forest productivity and surface-atmosphere exchange in the BOREAS study region. Tree Physiology 17:589-599. +.. _Kohyamaetal2001: + Kohyama, T., Suzuki, E., Partomihardjo, T., and Yamada, T. 2001. Dynamic steady state of patch-mosaic tree size structure of a mixed diptocarp forest regulated by local crowding. Ecological Research 16:85-98. +.. _Kourzeneva2009: + Kourzeneva, E., 2009. Global dataset for the parameterization of lakes in Numerical Weather Prediction and Climate modeling. ALADIN Newsletter, No 37, July-December, 2009, F. Bouttier and C. Fischer, Eds., Meteo-France, Toulouse, France, 46-53. +.. _Kourzeneva2010: + Kourzeneva, E., 2010: External data for lake parameterization in Numerical Weather Prediction and climate modeling. Boreal Environment Research, 15, 165-177. +.. _Kourzenevaetal2012: + Kourzeneva, E., Asensio, H., Martin, E. and Faroux, S., 2012. Global gridded dataset of lake coverage and lake depth for use in numerical weather prediction and climate modelling. Tellus A 64. +.. _Kovenetal2009: + Koven, C., et al. 2009. On the formation of high-latitude soil carbon stocks: The effects of cryoturbation and insulation by organic matter in a land surface model. Geophys. Res. Lett. 36: L21501. +.. _Kovenetal2011: + Koven, C.D., et al. 2011. Permafrost carbon-climate feedbacks accelerate global warming. Proceedings of the National Academy of Sciences 108:14769-14774. +.. _Kovenetal2013: + Koven, C.D. et al. 2013. The effect of vertically-resolved soil biogeochemistry and alternate soil C and N models on C dynamics of CLM4. Biogeosciences Discussions 10:7201-7256. +.. _Kuchariketal2000: + Kucharik, C.J., Foley, J.A., Delire, C., Fisher, V.A., Coe, M.T., Lenters, J.D., Young-Molling, C., and Ramankutty, N. 2000. Testing the performance of a dynamic global ecosystem model: water balance, carbon balance, and vegetation structure. Global Biogeochem. Cycles 14: 795–825. +.. _KucharikBrye2003: + Kucharik, C.J., and Brye, K.R. 2003. Integrated BIosphere Simulator (IBIS) yield and nitrate loss predictions for Wisconsin maize receiving varied amounts of nitrogen fertilizer. Journal of Environmental Quality 32: 247–268. +.. _Laddetal2992: + Ladd, J.N., Jocteur-Monrozier, L. and Amato, M., 1992. Carbon turnover and nitrogen transformations in an alfisol and vertisol amended with [U-:math:`{}^{14}`\ C] glucose and [:math:`{}^{15}`\ N] ammonium sulfate. Soil Biology and Biochemistry, 24: 359-371. +.. _Lamarqueetal2010: + Lamarque, J.-F., et al. 2010. Historical (1850-2000) gridded anthropogenic and biomass burning emissions of reactive gases and aerosols: methodology and application. Atmos. Chem. Phys. Discuss. 10:4963-5019. DOI:10.5194/acpd-10-4963-2010. +.. _Larcher1995: + Larcher, W. 1995. Physiological Plant Ecology, Springer-Verlag, Berlin Heidelberg. +.. _LavigneRyan1997: + Lavigne, M.B., and Ryan, M.G. 1997. Growth and maintenance respiration rates of aspen, black spruce, and jack pine stems at northern and southern BOREAS sites. Tree Phys. 17:543-551. +.. _Lawetal2003: + Law, B.E., Sun, O.J., Campbell, J., Van Tuyl, S. and Thornton, P.E. 2003. Changes in carbon storage and fluxes in a chronosequence of ponderosa pine. Global Change Biology, 9: 510-514. +.. _Lawrenceetal2007: + Lawrence, D.M., Thornton, P.E., Oleson, K.W., and Bonan, G.B. 2007. The partitioning of evapotranspiration into transpiration, soil evaporation, and canopy evaporation in a GCM: Impacts on land-atmosphere interaction. J. Hydrometeor. 8:862-880. +.. _LawrenceSlater2008: + Lawrence, D.M., and Slater, A.G. 2008. Incorporating organic soil into a global climate model. Clim. Dyn. 30. DOI:10.1007/s00382-007-0278-1. +.. _Lawrenceetal2008: + Lawrence, D.M., Slater, A.G., Romanovsky, V.E., and Nicolsky, D.J. 2008. The sensitivity of a model projection of near-surface permafrost degradation to soil column depth and inclusion of soil organic matter. J. Geophys. Res. 113:F02011. DOI:10.1029/2007JF000883. +.. _Lawrenceetal2011: + Lawrence, D.M., K.W. Oleson, M.G. Flanner, P.E. Thornton, S.C. Swenson, P.J. Lawrence, X. Zeng, Z.-L. Yang, S. Levis, K. Sakaguchi, G.B. Bonan, and A.G. Slater, 2011. Parameterization improvements and functional and structural advances in version 4 of the Community Land Model. J. Adv. Model. Earth Sys. 3. DOI:10.1029/2011MS000045. +.. _LawrenceChase2007: + Lawrence, P.J., and Chase, T.N. 2007. Representing a MODIS consistent land surface in the Community Land Model (CLM 3.0). J. Geophys. Res. 112:G01023. DOI:10.1029/2006JG000168. +.. _LawrenceChase2010: + Lawrence, P.J., and Chase, T.N. 2010. Investigating the climate impacts of global land cover change in the Community Climate System Model. Int. J. Climatol. 30:2066-2087. DOI:10.1002/joc.2061. +.. _Lawrenceetal2012: + Lawrence, P.J., et al. 2012. Simulating the biogeochemical and biogeophysical impacts of transient land cover change and wood harvest in the Community Climate System Model (CCSM4) from 1850 to 2100. J. Climate 25:3071-3095. DOI:10.1175/JCLI-D-11-00256.1. +.. _LehnerDoll2004: + Lehner, B. and Döll, P., 2004. Development and validation of a global database of lakes, reservoirs and wetlands, J. Hydrol., 296, 1–22. +.. _LePageetal2010: + Le Page, Y., van der Werf, G.R., Morton, D.C., and Pereira, J.M.C. 2010. Modeling fire-driven deforestation potential in Amazonia under current and projected climate conditions. J. Geophys. Res. 115:G03012. DOI:10.1029/2009JG001190. +.. _Lerman1979: + Lerman, A., 1979. Geochemical processes: Water and sediment environments. John Wiley and Sons, New York, N.Y. +.. _Lettsetal2000: + Letts, M.G., Roulet, N.T., Comer, N.T., Skarupa, M.R., and Verseghy, D.L. 2000. Parametrization of peatland hydraulic properties for the Canadian Land Surface Scheme. Atmos.-Ocean 38:141-160. +.. _LevinKromer2004: + Levin, I. and Kromer, B. 2004. The tropospheric 14CO2 level in mid-latitudes of the Northern Hemisphere (1959-2003) Radiocarbon 46:1. +.. _Levisetal2003: + Levis, S., Wiedinmyer, C., Bonan, G.B., and Guenther, A. 2003. Simulating biogenic volatile organic compound emissions in the Community Climate System Model. J. Geophys. Res. 108:4659. DOI:10.1029/2002JD003203. +.. _Levisetal2004: + Levis, S., Bonan, G.B., Vertenstein, M., and Oleson, K.W. 2004. The community land model’s dynamic global vegetation model (CLM-DGVM): technical description and user’s guide. NCAR Technical Note NCAR/TN-459+STR. National Center for Atmospheric Research, Boulder, Colorado. 50 pp. +.. _Levisetal2009: + Levis, S., Thornton, P., Bonan, G., and Kucharik, C. 2009. Modeling land use and land management with the Community Land Model. iLeaps newsletter, No. 7. +.. _Levisetal2012: + Levis, S., Bonan, G., Kluzek, E., Thornton, P., Jones, A., Sacks, W., and Kucharik, C 2012. Interactive crop management in the Community Earth System Model (CESM1): Seasonal influences on land-atmosphere fluxes. J. Climate 25: 4839-4859. DOI:10.1175/JCLI-D-11-00446.1. +.. _Lietal2000: + Li, C., Aber, J., Stange, F., Butterbach-Bahl, K. and Papen, H. 2000. A process-oriented model of N2O and NO emissions from forest soils: 1. Model development. J. Geophys. Res. 105(D4):4369-4384. +.. _Lietal2012a: + Li, F., Zeng, X.-D., and Levis, S. 2012a. A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model. Biogeosciences 9:2761-2780. +.. _Lietal2012b: + Li, F., Zeng, X. D., and Levis, S. 2012b. Corrigendum to “A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model” published in Biogeosciences, 9, 2761–2780, 2012”. Biogeosciences 9: 4771-4772. +.. _Lietal2013a: + Li, F., Levis, S., and Ward, D. S. 2013a. Quantifying the role of fire in the Earth system – Part 1: Improved global fire modeling in the Community Earth System Model (CESM1). Biogeosciences 10:2293-2314. +.. _Lietal2013b: + Li, H.-Y., Huang, M., Tesfa, T., Ke, Y., Sun, Y., Liu, Y., and Leung, L. R. 2013b. A subbasin-based framework to represent land surface processes in an Earth System Model, Geosci. Model Dev. Discuss. 6:2699-2730. DOI:10.5194/gmdd-6-2699-2013. +.. _Lietal2011: + Li, H., Huang, M., Wigmosta, M.S., Ke, Y., Coleman, A.M., Leung, L.R., Wang, A., and Ricciuto, D.M. 2011. Evaluating runoff simulations from the Community Land Model 4.0 using observations from flux towers and a mountainous watershed. J. Geophys. Res. 116:D24120. DOI:10.1029/2011JD016276. +.. _Liangetal1994: + Liang, X., Lettenmaier, D.P., Wood, E.F., and Burges, S.J. 1994. A simple hydrologically based model of land surface water and energy fluxes for GSMs. J. Geophys. Res. 99(D7):14,415–14,428. +.. _LipscombSacks2012: + Lipscomb, W., and Sacks, W. 2012. The CESM land ice model documentation and user’s guide. 46 pp. [Available online at http://www.cesm.ucar.edu/models/cesm1.1/cism/]. +.. _LloydTaylor1994: + Lloyd, J. and Taylor, J.A., 1994. On the temperature dependence of soil respiration. Functional Ecology, 8: 315-323. +.. _Lloydetal2010: + Lloyd, J., et al. 2010. Optimisation of photosynthetic carbon gain and within-canopy gradients of associated foliar traits for Amazon forest trees. Biogeosci. 7:1833-1859. DOI:10.5194/bg-7-1833-2010. +.. _Lobelletal2006: + Lobell, D.B., Bala, G., and Duffy, P.B. 2006. Biogeophysical impacts of cropland management changes on climate. Geophys. Res. Lett. 33:L06708. DOI:10.1029/2005GL025492. +.. _Lovelandetal2000: + Loveland, T.R., Reed, B.C., Brown, J.F., Ohlen, D.O., Zhu, Z., Yang, L., and Merchant, J.W. 2000. Development of a global land cover characteristics database and IGBP DISCover from 1 km AVHRR data. Int. J. Remote Sens. 21:1303-1330. +.. _Lowe1977: + Lowe, P.R. 1977. An approximating polynomial for the computation of saturation vapor pressure. J. Appl. Meteor. 16:100-103. +.. _Luoetal2006: + Luo, Y., Hui, D., and Zhang, D. 2006. Elevated CO2 stimulates net accumulations of carbon and nitrogen in land ecosystems: a meta-analysis. Ecology 87:53-63. +.. _Magilletal1997: + Magill, A.H. et al., 1997. Biogeochemical response of forest ecosystems to simulated chronic nitrogen deposition. Ecological Applications, 7: 402-415. +.. _Mahowaldetal2006: + Mahowald, N.M., Muhs, D.R., Levis, S., Rasch, P.J., Yoshioka, M., Zender, C.S., and Luo, C. 2006. Change in atmospheric mineral aerosols in response to climate: last glacial period, pre-industrial, modern and doubled CO\ :sub:`2` climates. J. Geophys. Res\ *.* 111:D10202. DOI:10.1029/2005JD006653. +.. _Makela2002: + Makela, A. 2002. Derivation of stem taper from the pipe model theory in a carbon balance framework. Tree Phys. 22:891-905. +.. _Manning, M.R. and Melhuish, W.H. 1994. Trends: A Compendium of Data on + Manning, M.R. and Melhuish, W.H. 1994. Trends: A Compendium of Data on Global Change. Carbon Dioxide Information Analysis Center,. Oak Ridge National Laboratory, U.S. Department of Energy, Oak Ridge, Tenn., U.S.A. +.. _Maoetal2012: + Mao, J., Thornton, P.E., Shi, X., Zhao, M., and Post, W.M. 2012. Remote sensing evaluation of CLM4 GPP for the period 2000 to 2009. J. Climate 25:5327-5342. +.. _Maoetal2013: + Mao, J., Shi, X., Thornton, P.E., Hoffman, F.M., Zhu, Z., and Ranga B. Myneni, R.B. 2013. Global latitudinal-asymmetric vegetation growth trends and their driving mechanisms: 1982-2009. Remote Sensing 5:1484-1497. +.. _Martinetal1980: + Martin, J.P., Haider, K. and Kassim, G., 1980. Biodegradation and stabilization after 2 years of specific crop, lignin, and polysaccharide carbons in soils. Soil Science Society of America Journal 44:1250-1255. +.. _Maryetal1993: + Mary, B., Fresneau, C., Morel, J.L. and Mariotti, A., 1993. C and N cycling during decomposition of root mucilage, roots and glucose in soil. Soil Biology and Biochemistry 25:1005-1014. +.. _McGuireetal1992: + McGuire, A.D., Melillo, J.M., Joyce, L.A., Kicklighter, D.W., Grace, A.L., Moore III, B., and Vorosmarty, C.J. 1992. Interactions between carbon and nitrogen dynamics in estimating net primary productivity for potential vegetation in North America. Global Biogeochem. Cycles 6:101-124. +.. _MelzerOLeary1987: + Melzer, E., and O’Leary, M.H. 1987. Anapleurotic CO2 Fixation by Phosphoenolpyruvate Carboxylase in C3 Plants. Plant. Physiol. 84:58. +.. _Milleretal1994: + Miller, J.R., Russell, G.L., and Caliri, G. 1994. Continental-scale river flow in climate models. J. Climate 7:914-928. +.. _MillingtonQuirk1961: + Millington, R. and Quirk, J.P., 1961. Permeability of Porous Solids. Transactions of the Faraday Society 57:1200-1207. +.. _Mironovetal2010: + Mironov, D. et al., 2010. Implementation of the lake parameterisation scheme FLake into the numerical weather prediction model COSMO. Boreal Environment Research 15:218-230. +.. _MitchellJones2005: + Mitchell, T.D., and Jones, P.D. 2005. An improved method of constructing a database of monthly climate observations and associated high-resolution grids. Int. J. Climatol. 25:693-712. +.. _Moldrupetal2003: + Moldrup, P. et al. 2003. Modeling diffusion and reaction in soils: X. A unifying model for solute and gas diffusivity in unsaturated soil. Soil Science 168:321-337. +.. _Mynenietal2002: + Myneni, R.B., et al. 2002. Global products of vegetation leaf area and fraction absorbed PAR from year one of MODIS data. Remote Sens. Environ. 83:214-231. +.. _Neffetal2005: + Neff, J.C., Harden, J.W. and Gleixner, G. 2005. Fire effects on soil organic matter content, composition, and nutrients in boreal interior Alaska. Canadian Journal of Forest Research-Revue Canadienne De Recherche Forestiere 35:2178-2187. +.. _Neitschetal2005: + Neitsch, S.L., Arnold, J.G., Kiniry, J.R., and Williams J.R. 2005. Soil and Water Assessment Tool, Theoretical Documentation: Version 2005. Temple, TX. USDA Agricultural Research Service and Texas A&M Blackland Research Center. +.. _NemaniRunning1996: + Nemani, R.R., and Running, S.W. 1996. Implementation of a hierarchical global vegetation classification in ecosystem function models. J. Veg. Sci. 7:337-346. +.. _Niinemetstal1998: + Niinemets, U., Kull, O., and Tenhunen, J.D. 1998. An analysis of light effects on foliar morphology, physiology, and light interception in temperate deciduous woody species of contrasting shade tolerance. Tree Phys. 18:681-696. +.. _Niuetal2005: + Niu, G.-Y., Yang, Z.-L., Dickinson, R.E., and Gulden, L.E. 2005. A simple TOPMODEL-based runoff parameterization (SIMTOP) for use in global climate models. J. Geophys. Res. 110:D21106. DOI:10.1029/2005JD006111. @@ -838,22 +1216,32 @@ Niu, G.-Y., and Yang, Z.-L. 2007. An observation-based formulation of snow cover fraction and its evaluation over large North American river basins. J. Geophys. Res. 112:D21101. DOI:10.1029/2007JD008674. +.. _NydalLovseth1996: + Nydal, R. and Lövseth, K. 1996. Carbon-14 Measurements In Atmospheric CO2 From Northern And Southern Hemisphere Sites, 1962-1993, Carbon Dioxide Information Analysis Center. +.. _Oikawaetal2005: + Oikawa, S., Hikosaka, K. and Hirose, T., 2005. Dynamics of leaf area and nitrogen in the canopy of an annual herb, Xanthium canadense. Oecologia, 143: 517-526. +.. _Oke1987: + Oke, T. 1987. Boundary Layer Climates (2:math:`{}^{nd}` edition). Routledge, London and New York. +.. _OlesonBonan2000: + Oleson, K.W., and Bonan, G.B. 2000. The effects of remotely-sensed plant functional type and leaf area index on simulations of boreal forest surface fluxes by the NCAR land surface model. J. Hydrometeor. 1:431-446. +.. _Olesonetal2004: + Oleson, K.W., Dai, Y., Bonan, G., Bosilovich, M., Dickinson, R., Dirmeyer, P., Hoffman, F., Houser, P., Levis, S., Niu, G.-Y., Thornton, P., Vertenstein, M., Yang, Z.-L., and Zeng. X. 2004. Technical @@ -861,34 +1249,48 @@ description of the Community Land Model (CLM). NCAR Technical Note NCAR/TN-461+STR. National Center for Atmospheric Research, Boulder, Colorado. 173 pp. +.. _Olesonetal2008a: + Oleson, K.W., Niu, G.-Y., Yang, Z.-L., Lawrence, D.M., Thornton, P.E., Lawrence, P.J., Stöckli, R., Dickinson, R.E., Bonan, G.B., Levis, S., Dai, A., and Qian, T. 2008a. Improvements to the Community Land Model and their impact on the hydrological cycle. J. Geophys. Res. 113:G01021. DOI:10.1029/2007JG000563. +.. _Olesonetal2008b: + Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Grimmond, C.S.B. 2008b. An urban parameterization for a global climate model. 1. Formulation and evaluation for two cities. J. Appl. Meteor. Clim. 47:1038-1060. +.. _Olesonetal2008c: + Oleson, K.W., Bonan, G.B., Feddema, J., and Vertenstein, M. 2008c. An urban parameterization for a global climate model. 2. Sensitivity to input parameters and the simulated urban heat island in offline simulations. J. Appl. Meteor. Clim. 47:1061-1076. +.. _Olesonetal2010a: + Oleson, K.W., et al. 2010a. Technical description of version 4.0 of the Community Land model (CLM). NCAR Technical Note NCAR/TN-478+STR, National Center for Atmospheric Research, Boulder, CO, 257 pp. +.. _Olesonetal2010b: + Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Kluzek, E. 2010b. Technical description of an urban parameterization for the Community Land Model (CLMU). NCAR Technical Note NCAR/TN-480+STR, National Center for Atmospheric Research, Boulder, CO, 169 pp. +.. _Olson1963: + Olson, J.S., 1963. Energy storage and the balance of producers and decomposers in ecological systems. Ecology 44:322-331. +.. _Olsonetal2001: + Olson, D.M., Dinerstein, E., Wikramanayake, E.D., Burgess, N.D., Powell, G.V.N., Underwood, E.C., D’Amico, J.A., Itoua, I., Strand, H. E., Morrison, J. C., Loucks, C. J., Allnutt, T. F., Ricketts, T. H., Kura, @@ -896,139 +1298,207 @@ Y., Lamoreux, J. F., Wettengel, W. W., Heda, P., and Kassem, K. R., 2001. Terrestrial ecoregions of the world a new map of life on earth, Bioscience, 51, 933–938. +.. _OrchardCook1983: + Orchard, V.A. and Cook, F.J., 1983. Relationship between soil respiration and soil moisture. Soil Biology and Biochemistry, 15: 447-453. +.. _Owen1964: + Owen, P.R. 1964. Saltation of uniform grains in air. J. Fluid Mech\ *.* 20:225-242. +.. _Ozdoganetal2010: + Ozdogan, M., Rodell, M., Beaudoing, H.K., and Toll, D.L. 2010. Simulating the effects of irrigation over the United States in a land surface model based on satellite-derived agricultural data. Journal of Hydrometeorology 11:171-184. +.. _Pageetal2002: + Page, S.E., Siegert, F., Rieley, J.O., Boehm, H-D.V., Jaya, A., and Limin, S. 2002. The amount of carbon released from peat and forest fires in Indonesia in 1997. Nature 420:61-65. +.. _PanofskyDutton1984: + Panofsky, H.A., and Dutton, J.A. 1984. Atmospheric Turbulence: Models and Methods for Engineering Applications. John Wiley and Sons, New York. +.. _Partonetal1988: + Parton, W., Stewart, J. and Cole, C., 1988. Dynamics of C, N, P And S in Grassland Soils - A Model. Biogeochemistry 5:109-131. +.. _Partonetal1993: + Parton, W.J., et al. 1993. Observations and modeling of biomass and soil organic matter dynamics for the grassland biome worlwide. Global Biogeochemical Cycles 7:785-809. +.. _Partonetal1996: + Parton, W. et al. 1996. Generalized model for N2 and N2O production from nitrification and denitrification. Global Biogeochemical Cycles 10:401-412. +.. _Partonetal2001: + Parton, W.J. et al. 2001. Generalized model for NOx and N2O emissions from soils. J. Geophys. Res. 106(D15):17403-17419. +.. _Paterson1994: + Paterson, W.S.B., 1994. The Physics of Glaciers. Elsevier Science Inc., New York, 480 pp. +.. _Petrescuetal2010: + Petrescu, A.M.R. et al. 2010. Modeling regional to global CH4 emissions of boreal and arctic wetlands. Global Biogeochemical Cycles, 24(GB4009). +.. _Philip1957: + Philip, J.R. 1957. Evaporation, and moisture and heat fields in the soil. J. Meteor. 14:354-366. +.. _Piaoetal2012: + Piao, S.L., et al. 2012. The carbon budget of terrestrial ecosystems in East Asia over the last two decades. Biogeosciences 9:3571-3586. +.. _Pivovarov1972: + Pivovarov, A.A., 1972. Thermal Conditions in Freezing Lakes and Reservoirs. John Wiley, New York. +.. _Pollmeretal1979: + Pollmer, W.G., Eberhard, D., Klein, D., and Dhillon, B.S. 1979. Genetic control of nitrogen uptake and translocation in maize. Crop Sci. 19:82-86. +.. _Portmann2010: + Portmann, F.T., Siebert, S., and Döll, P. 2010. MIRCA2000 - Global monthly irrigated and rainfed crop areas around the year 2000: A new high-resolution data set for agricultural and hydrological modeling. Global Biogeochem. Cycles. 24, GB1011. DOI:10.1029/2008GB003435. +.. _Pressetal1992: + Press, W.H., Teukolsky, S.A., Vetterling, W.T., and Flannery, B.P. 1992. Numerical Recipes in FORTRAN: The Art of Scientific Computing. Cambridge University Press, New York. +.. _Prigentetal2007: + Prigent, C., Papa, F., Aires, F., Rossow, W.B. and Matthews, E. 2007. Global inundation dynamics inferred from multiple satellite observations, 1993-2000. J. Geophys. Res. 112(D12). +.. _Pritchardetal2008: + Pritchard, M.S., Bush, A.B.G., and Marshall, S.J. 2008. Neglecting ice-atmosphere interactions underestimates ice sheet melt in millennial-scale deglaciation simulations. Geophys. Res. Lett. ** 35:L01503. DOI:10.1029/2007GL031738. +.. _Qianetal2006: + Qian, T., Dai, A., Trenberth, K.E., and Oleson, K.W. 2006. Simulation of global land surface conditions from 1948 to 2004: Part I: Forcing data and evaluations. J. Hydrometeor. 7:953-975. +.. _RamankuttyFoley1998: + Ramankutty, N., and Foley, J. A., 1998. Characterizing patterns of global land use: An analysis of global croplands data. Global Biogeochemical Cycles, 12, 667-685. +.. _Ramankuttyetal2008: + Ramankutty, N., Evan, A., Monfreda, C., and Foley, J.A. 2008. Farming the Planet. Part 1: The Geographic Distribution of Global Agricultural Lands in the Year 2000. Global Biogeochem. Cycles. 22:GB1003. DOI:10.1029/2007GB002952. +.. _Randlettetal1996: + Randlett, D.L., Zak, D.R., Pregitzer, K.S., and Curtis, P.S. 1996. Elevated atmospheric carbon dioxide and leaf litter chemistry: Influences on microbial respiration and net nitrogen mineralization. Soil Sci. Soc. Am. J. 60:1571-1577. +.. _Rastetteretal1991: + Rastetter, E.B., Ryan, M.G., Shaver, G.R., Melillo, J.M., Nadelhoffer, K.J., Hobbie, J.E., and Aber, J.D. 1991. A general biogeochemical model describing the responses of the C and N cycles in terrestrial ecosystems to changes in CO2, climate and N deposition. Tree Phys. 9:101-126. +.. _Rastneretal2012: + Rastner, P., Bolch, T., Mölg, N., Machguth, H., and Paul, F., 2012. The first complete glacier inventory for the whole of Greenland, The Cryosphere Discuss., 6, 2399-2436, 10.5194/tcd-6-2399-2012. +.. _Rileyetal2011a: + Riley, W. J., Z. M. Subin, D. M. Lawrence, S. C. Swenson, M. S. Torn, L. Meng, N. Mahowald, and P. Hess, 2011a. Barriers to predicting global terrestrial methane fluxes: Analyses using a methane biogeochemistry model integrated in CESM. Biogeosciences, 8, 1925–1953. DOI:10.5194/bg-8-1925-2011. +.. _Rileyetal2011b: + Riley, W.J. et al. 2011b. CLM4Me, a Methane Biogeochemistry Model Integrated in CESM, Land and Biogeochemistry Model Working Group Meeting, Boulder, CO. +.. _Ryan1991: + Ryan, M. G. 1991. A simple method for estimating gross carbon budgets for vegetation in forest ecosystems. Tree Phys. 9:255-266. +.. _RunningCoughlan1988: + Running, S.W. and Coughlan, J.C., 1988. A general model of forest ecosystem processes for regional applications. I. Hydrological balance, canopy gas exchange and primary production processes. Ecological Modelling, 42: 125-154. +.. _Runningetal1989: + Running, S.W. et al., 1989. Mapping regional forest evapotranspiration and photosynthesis by coupling satellite data with ecosystem simlation. Ecology, 70: 1090-1101. +.. _RunningGower1991: + Running, S.W. and Gower, S.T., 1991. FOREST BGC, A general model of forest ecosystem processes for regional applications. II. Dynamic carbon allocation and nitrogen budgets. Tree Physiology, 9: 147-160. +.. _RunningHunt1993: + Running, S.W. and Hunt, E.R., Jr., 1993. Generalization of a forest ecosystem process model for other biomes, BIOME-BGC, and an applicationfor global-scale models. In: J.R. Ehleringer and C. Field (Editors), Scaling Physiological Processes: Leaf to Globe. Academic Press, San Diego, CA, pp. 141-158. -Sacks, W. J., Cook, B. I., Buenning, N., Levis, S., and Helkowski, J. H. +.. _Sacksetal2009: + +Sacks, W. J., Cook, B. I., Buenning, N., Levis, S., and Helkowski, J. H. 2009. Effects of global irrigation on the near-surface climate. Climate Dyn., 33, 159–175. DOI:10.1007/s00382-008-0445-z. +.. _Saggaretal1994: + Saggar, S., Tate, K.R., Feltham, C.W., Childs, C.W. and Parshotam, A., 1994. Carbon turnover in a range of allophanic soils amended with :math:`{}^{14}`\ C-labelled glucose. Soil Biology and Biochemistry, 26: @@ -1039,315 +1509,463 @@ and under-canopy atmospheric stability on ground evaporation in the Community Land Model (CLM3.5). J. Geophys. Res. 114:D01107. DOI:10.1029/2008JD010834. +.. _Schaafetal2002: + Schaaf, C.B., Gao, F., Strahler, A.H., Lucht, W., Li, X., Tsang, T., Strugnell, N.C., Zhang, X., Jin, Y., and Muller, J.-P. 2002. First operational BRDF, albedo nadir reflectance products from MODIS. Remote Sens. Environ. 83:135-148. +.. _Schlesinger, W.H., 1997. Biogeochemistry: an analysis of global change. + Schlesinger, W.H., 1997. Biogeochemistry: an analysis of global change. Academic Press, London, 588 pp. +.. _SchnellKing1996: + Schnell, S. and King, G.M., 1996. Responses of methanotrophic activity in soils and cultures to water stress. Applied and Environmental Microbiology 62:3203-3209. +.. _Segers, R., 1998. Methane production and methane consumption: a review + Segers, R., 1998. Methane production and methane consumption: a review of processes underlying wetland methane fluxes. Biogeochemistry 41:23-51. +.. _Sellers1985: + Sellers, P.J. 1985. Canopy reflectance, photosynthesis and transpiration. Int. J. Remote Sens. 6:1335-1372. +.. _Sellersetal1986: + Sellers, P.J., Mintz, Y., Sud, Y.C., and Dalcher, A. 1986. A simple biosphere model (SiB) for use within general circulation models. J. Atmos. Sci. 43:505-531. +.. _Sellersetal1988: + Sellers, P.J., Hall, F.G., Asrar, G., Strebel, D.E., and Murphy, R.E. 1988. The First ISLSCP Field Experiment (FIFE). Bull. Amer. Meteor. Soc. 69:22-27. +.. _Sellersetal1992: + Sellers, P.J., Berry, J.A., Collatz, G.J., Field, C.B., and Hall, F.G. 1992. Canopy reflectance, photosynthesis, and transpiration. III. A reanalysis using improved leaf models and a new canopy integration scheme. Remote Sens. Environ. 42:187-216. +.. _Sellersetal1995: + Sellers, P.J., et al. 1995. The Boreal Ecosystem-Atmosphere Study (BOREAS): An overview and early results from the 1994 field year. Bull. Amer. Meteor. Soc. 76:1549-1577. +.. _Sellersetal1996: + Sellers, P.J., Randall, D.A., Collatz, G.J., Berry, J.A., Field, C.B., Dazlich, D.A., Zhang, C., Collelo, G.D., and Bounoua, L. 1996. A revised land surface parameterization (SiB2) for atmospheric GCMs. Part I: Model formulation. J. Climate 9:676-705. +.. _Shietal2013: + Shi, X., Mao, J., Thornton, P.E., and Huang, M. 2013. Spatiotemporal patterns of evapotranspiration in response to multiple environmental factors simulated by the Community Land Model. Environ. Res. Lett. 8:024012. +.. _Shiklomanov2000: + Shiklomanov, I.A. 2000. Appraisal and assessment of world water resources. Water International 25:11-32. +.. _Siebertetal2005: + Siebert, S., Döll, P., Hoogeveen, J., Faures, J.M., Frenken, K., Feick, S., 2005. Development and validation of the global map of irrigation areas. Hydrol Earth Syst Sc 9:535–547 +.. _Simpsonetal1983: + Simpson, R.J., Lambers, H., and Dalling, M.J. 1983. Nitrogen redistribution during grain growth in wheat (Triticum avestivum L.). Plant Physiol. 71:7-14. +.. _Smithetal2005: + Smith, A.M.S., Wooster, M.J., Drake, N.A., Dipotso, F.M. and Perry, G.L.W., 2005. Fire in African savanna: Testing the impact of incomplete combustion on pyrogenic emissions estimates. Ecological Applications, 15: 1074-1082. +.. _Sollins1982: + Sollins, P., 1982. Input and decay of coarse woody debris in coniferous stands in western Oregon and Washington. Canadian Journal of Forest Research, 12: 18-28. +.. _SonGower1991: + Son, Y. and Gower, S.T., 1991. Aboveground nitrogen and phosphorus use by five plantation-grown trees with different leaf longevities. Biogeochemistry, 14: 167-191. +.. _Sorensen1981: + Sørensen, L.H., 1981. Carbon-nitrogen relationships during the humification of cellulose in soils containing different amounts of clay. Soil Biology and Biochemistry, 13: 313-321. +.. _Sprugeletal1995: + Sprugel, D.G., Ryan, M.G., Brooks, J.R., Vogt, K.A., and Martin, T.A. 1995. Respiration from the organ level to stand level. pp. 255-299. In: W. K. Smith and T. M. Hinkley (editors) Resource Physiology of Conifers. Academic Press, San Diego,CA. +.. _StaufferAharony1994: + Stauffer, D., and Aharony, A. 1994. Introduction to Percolation Theory. Taylor and Francis, London. +.. _Stilletal2003: + Still, C.J., Berry, J.A., Collatz, G.J., and DeFries, R.S. 2003. Global distribution of C3 and C4 vegetation: carbon cycle implications. Global Biogeochem. Cycles 17:1006. DOI:10.1029/2001GB001807. +.. _Stocklietal2008: + Stöckli, R., Lawrence, D.M., Niu, G.-Y., Oleson, K.W., Thornton, P.E., Yang, Z.-L., Bonan, G.B., Denning, A.S., and Running, S.W. 2008. Use of FLUXNET in the Community Land Model development. J. Geophys. Res. 113:G01025. DOI:10.1029/2007JG000562. +.. _Stracketal2006: + Strack, M., Kellner, E. and Waddington, J.M., 2006. Effect of entrapped gas on peatland surface level fluctuations. Hydrological Processes 20:3611-3622. +.. _Strahleretal1999: + Strahler, A.H., Muchoney, D., Borak, J., Friedl, M., Gopal, S., Lambin, E., and Moody. A. 1999. MODIS Land Cover Product: Algorithm Theoretical Basis Document (Version 5.0). Boston University, Boston. +.. _Stull1988: + Stull, R.B. 1988. An Introduction to Boundary Layer Meteorology. Kluwer Academic Publishers, Dordrecht. +.. _Subinetal2012a: + Subin, Z.M., Riley, W.J. and Mironov, D. 2012a. Improved lake model for climate simulations, J. Adv. Model. Earth Syst., 4, M02001. DOI:10.1029/2011MS000072. +.. _Subinetal2012b: + Subin, Z.M., Murphy, L.N., Li, F., Bonfils, C. and Riley, W.J., 2012b. Boreal lakes moderate seasonal and diurnal temperature variation and perturb atmospheric circulation: analyses in the Community Earth System Model 1 (CESM1). Tellus A, North America, 64. +.. _Sunetal2012: + Sun, Y., Gu, L., and Dickinson, R. E. 2012. A numerical issue in calculating the coupled carbon and water fluxes in a climate model, J. Geophys. Res., 117, D22103. DOI:10.1029/2012JD018059. +.. _Swensonetal2012: + Swenson, S.C., Lawrence, D.M., and Lee, H. 2012. Improved Simulation of the Terrestrial Hydrological Cycle in Permafrost Regions by the Community Land Model. JAMES, 4, M08002. DOI:10.1029/2012MS000165. +.. _SwensonLawrence2012: + Swenson, S.C. and Lawrence, D.M. 2012. A New Fractional Snow Covered Area Parameterization for the Community Land Model and its Effect on the Surface Energy Balance. JGR, 117, D21107. DOI:10.1029/2012JD018178. +.. _TaWeiland1992: + Ta, C.T. and Weiland, R.T. 1992. Nitrogen partitioning in maize during ear development. Crop Sci. 32:443-451. +.. _TangRiley2013: + Tang, J.Y. and Riley, W.J. 2013. A new top boundary condition for modeling surface diffusive exchange of a generic volatile tracer: Theoretical analysis and application to soil evaporation. Hydrol. Earth Syst. Sci. 17:873-893. +.. _Tarnocaietal2011: + Tarnocai, C., Kettles, I. M., and Lacelle, B., 2011. Peatlands of Canada, Geological Survey of Canada, Open File 6561, CD-ROM. DOI:10.495/288786. +.. _Tayloretal1989: + Taylor, B.R., Parkinson, D. and Parsons, W.F.J., 1989. Nitrogen and lignin content as predictors of litter decay rates: A microcosm test. Ecology, 70: 97-104. +.. _Thonickeetal2001: + Thonicke, K., Venevsky, S., Sitch, S., and Cramer, W. 2001. The role of fire disturbance for global vegetation dynamics: coupling fire into a Dynamic Global Vegetation Model. Global Ecology and Biogeography 10:661-667. +.. _Thornton1998: + Thornton, P.E., 1998. Regional ecosystem simulation: combining surface- and satellite-based observations to study linkages between terrestrial energy and mass budgets. Ph.D. Thesis, The University of Montana, Missoula, 280 pp. +.. _Thorntonetal2002: + Thornton, P.E., Law, B.E., Gholz, H.L., Clark, K.L., Falge, E., Ellsworth, D.S., Goldstein, A.H., Monson, R.K., Hollinger, D., Falk, M., Chen, J., and Sparks, J.P. 2002. Modeling and measuring the effects of disturbance history and climate on carbon and water budgets in evergreen needleleaf forests. Agric. For. Meteor. 113:185-222. +.. _ThorntonRosenbloom2005: + Thornton, P.E., and Rosenbloom, N.A. 2005. Ecosystem model spin-up: estimating steady state conditions in a coupled terrestrial carbon and nitrogen cycle model. Ecological Modelling 189:25-48. +.. _ThorntonZimmermann2007: + Thornton, P.E., and Zimmermann, N.E. 2007. An improved canopy integration scheme for a land surface model with prognostic canopy structure. J. Climate 20:3902-3923. +.. _Thorntonetal2007: + Thornton, P.E., Lamarque, J.-F., Rosenbloom, N.A., and Mahowald, N.M. 2007. Influence of carbon-nitrogen cycle coupling on land model response to CO\ :sub:`2` fertilization and climate variability. Global Biogeochem. Cycles 21:GB4018. +.. _Thorntonetal2009: + Thornton, P.E., Doney, S.C., Lindsay, K., Moore, J.K., Mahowald, N., Randerson, J.T., Fung, I., Lamarque, J.F., Feddema, J.J., and Lee, Y.H. 2009. Carbon-nitrogen interactions regulate climate-carbon cycle feedbacks: results from an atmosphere-ocean general circulation model. Biogeosci. 6:2099-2120. +.. _Tianetal2010: + Tian, H. et al. 2010. Spatial and temporal patterns of CH4 and N2O fluxes in terrestrial ecosystems of North America during 1979-2008: application of a global biogeochemistry model. Biogeosciences 7:2673-2694. +.. _Toonetal1989: + Toon, O.B., McKay, C.P., Ackerman, T.P., and Santhanam, K. 1989. Rapid calculation of radiative heating rates and photodissociation rates in inhomogeneous multiple scattering atmospheres. J. Geophys. Res. 94(D13):16,287-16,301. +.. _Turetskyetal2002: + Turetsky, M.R., Wieder, R.K., Halsey, L.A., and Vitt, D.H. 2002. Current disturbance and the diminishing peatland carbon sink. Geophys. Res. Lett. 29:1526. DOI:10.1029/2001GL014000. -Turetsky, M.R., Amiro, B.D., Bosch, E., andBhatti, J.S. 2004. Historical +.. _Turetskyetal2004: + +Turetsky, M.R., Amiro, B.D., Bosch, E., and Bhatti, J.S. 2004. Historical burn area in western Canadian peatlands and its relationship to fire weather indices. Global Biogeochem. Cycles 18:GB4014. DOI:10.1029/2004GB002222. +.. _Turnbulletal2007: + Turnbull, J.C. et al. 2007. A new high precision (CO2)-C-14 time series for North American continental air. Journal of Geophysical Research-Atmospheres 112(D11). +.. _Tyeetal2005: + Tye, A.M., et al. 2005. The fate of N-15 added to high Arctic tundra to mimic increased inputs of atmospheric nitrogen released from a melting snowpack. Global Change Biology 11:1640-1654. +.. _Unlandetal1996: + Unland, H.E., Houser, P.R., Shuttleworth, W.J., and Yang, Z.-L. 1996. Surface flux measurement and modeling at a semi-arid Sonoran Desert site. Agric. For. Meteor. 82:119-153. +.. _UNSTAT2005: + UNSTAT, 2005. National Accounts Main Aggregates Database, United Nations Statistics Division. +.. _VallanoSparks2007: + Vallano, D.M. and Sparks, J.P. 2007. Quantifying foliar uptake of gaseous itrogen dioxide using enriched foliar :math:`\delta^{15}`\ N values. New Phytologist 177:946-955. +.. _vanderWerfetal2010: + van der Werf, G.R., Randerson, J.T., Giglio, L., Collatz, G.J., Mu, M., Kasibhatla, S.P., Morton, D.C., DeFries, R.S., Jin, Y., van Leeuwen, T.T. 2010. Global fire emissions and the contribution of deforestation, savanna, forest, agricultural, and peat fires (1997-2009) Atmos. Chem. Phys. 10:11707-11735. +.. _van Veenetal1984: + van Veen, J.A., Ladd, J.N. and Frissel, M.J., 1984. Modelling C and N turnover through the microbial biomass in soil. Plant and Soil, 76: 257-274. +.. _VanVuurenetal2006: + Van Vuuren, D.P., Lucas, P.S., and Hilderink, H.B.M., 2006. Downscaling drivers of global environmental change: enabling use of global SRES scenarios at the national and grid levels, Report 550025001, Netherlands Environmental Assessment Agency, 45 pp. +.. _Vanninen, P., and Makela, A. 2005. Carbon budget for Scots pine trees: + Vanninen, P., and Makela, A. 2005. Carbon budget for Scots pine trees: effects of size, competition and site fertility on growth allocation and production. Tree Phys. 25:17-30. +.. _VerdinGreenlee1996: + Verdin, K. L., and S. K. Greenlee, 1996. Development of continental scale digital elevation models and extraction of hydrographic features, paper presented at the Third International Conference/Workshop on Integrating GIS and Environmental Modeling, Santa Fe, New Mexico, 21–26 January, Natl. Cent. for Geogr. Inf. and Anal., Santa Barbara, Calif. +.. _Viovy2011: + Viovy, N. 2011. CRUNCEP dataset. [Description available at http://dods.extra.cea.fr/data/p529viov/cruncep/readme.htm. Data available at http://dods.extra.cea.fr/store/p529viov/cruncep/V4\_1901\_2011/]. +.. _VitousekHowarth1991: + Vitousek, P.M., and Howarth, R.W. 1991. Nitrogen limitation on land and in the sea: How can it occur? Biogeochem. 13:87-115. +.. _Walteretal2001: + Walter, B.P., Heimann, M. and Matthews, E., 2001. Modeling modern methane emissions from natural wetlands 1. Model description and results. J. Geophys. Res. 106(D24):34189-34206. +.. _Waniaetal2009: + Wania, R., Ross, I. and Prentice, I.C. 2009. Integrating peatlands and permafrost into a dynamic global vegetation model: 2. Evaluation and sensitivity of vegetation and carbon cycle processes. Global Biogeochem. Cycles 23. +.. _Waniaetal2010: + Wania, R., Ross, I. and Prentice, I.C. 2010. Implementation and evaluation of a new methane model within a dynamic global vegetation model LPJ-WHyMe v1.3. Geoscientific Model Development Discussions 3:1-59. +.. _WangZeng2009: + Wang, A., and Zeng, X. 2009. Improving the treatment of vertical snow burial fraction over short vegetation in the NCAR CLM3. Adv. Atmos. Sci. 26:877-886. DOI:10.1007/s00376-009-8098-3. +.. _Whiteetal1997: + White, M.A., Thornton, P.E., and Running, S.W. 1997. A continental phenology model for monitoring vegetation responses to interannual climatic variability. Global Biogeochem. Cycles 11:217-234. +.. _Whiteetal2000: + White, M.A., Thornton, P.E., Running, S.W., and Nemani, R.R. 2000. Parameterization and sensitivity analysis of the Biome-BGC terrestrial ecosystem model: net primary production controls. Earth Interactions 4:1-85. +.. _WiscombeWarren1980: + Wiscombe, W.J., and Warren, S.G. 1980. A model for the spectral albedo of snow. I. Pure snow. J. Atmos. Sci. 37:2712-2733. +.. _Woodetal1992: + Wood, E.F., Lettenmaier, D.P., and Zartarian, V.G. 1992. A land-surface hydrology parameterization with subgrid variability for general circulation models. J. Geophys. Res. 97(D3):2717–2728. DOI:10.1029/91JD01786. +.. _World Bank2004: + World Bank, 2004. World development indicators 2004, Oxford University Press, New York, 416 pp. +.. _Yang1998: + Yang, Z.-L. 1998. Technical note of a 10-layer soil moisture and temperature model. Unpublished manuscript. +.. _Zenderetal2003: + Zender, C.S., Bian, H., and Newman, D. 2003. Mineral dust entrainment and deposition (DEAD) model: Description and 1990s dust climatology. ** J. Geophys. Res\ *.* 108(D14):4416. DOI:10.1029/2002JD002775. +.. _ZengDickinson1998: + Zeng, X., and Dickinson, R.E. 1998. Effect of surface sublayer on surface skin temperature and fluxes. J.Climate 11:537-550. +.. _Zengetal1998: + Zeng, X., Zhao, M., and Dickinson, R.E. 1998. Intercomparison of bulk aerodynamic algorithms for the computation of sea surface fluxes using the TOGA COARE and TAO data. J. Climate 11:2628-2644. +.. _Zeng2001: + Zeng, X. 2001. Global vegetation root distribution for land modeling. J. Hydrometeor. 2:525-530. +.. _Zengetal2002: + Zeng, X., Shaikh, M., Dai, Y., Dickinson, R.E., and Myneni, R. 2002. Coupling of the Common Land Model to the NCAR Community Climate Model. J. Climate 15:1832-1854. +.. _Zengetal2005: + Zeng, X., Dickinson, R.E., Barlage, M., Dai, Y., Wang, G., and Oleson, K. 2005. Treatment of under-canopy turbulence in land models. J. Climate 18:5086-5094. +.. _ZengWang2007: + Zeng, X., and Wang, A. 2007. Consistent parameterization of roughness length and displacement height for sparse and dense canopies in land models. J. Hydrometeor. 8:730-737. @@ -1356,20 +1974,28 @@ Zeng, X., and Decker, M. 2009. Improving the numerical solution of soil moisture-based Richards equation for land models with a deep or shallow water table. J. Hydrometeor. 10:308-319. +.. _Zengetal2008: + Zeng, X., Zeng, X., and Barlage, M. 2008. Growing temperate shrubs over arid and semiarid regions in the Community Land Model - Dynamic Global Vegetation Model. Global Biogeochem. Cycles 22:GB3003. DOI:10.1029/2007GB003014. +.. _Zhangetal2002: + Zhang, Y., Li, C.S., Trettin, C.C., Li, H. and Sun, G., 2002. An integrated model of soil, hydrology, and vegetation for carbon dynamics in wetland ecosystems. Global Biogeochemical Cycles 16. DOI:10.1029/2001GB001838. +.. _Zhuangetal2004: + Zhuang, Q., et al. 2004. Methane fluxes between terrestrial ecosystems and the atmosphere at northern high latitudes during the past century: A retrospective analysis with a process-based biogeochemistry model. Global Biogeochemical Cycles 18. DOI:10.1029/2004GB002239. +.. _Zilitinkevich1970: + Zilitinkevich, S.S. 1970. Dynamics of the Atmospheric Boundary Layer. Leningrad Gidrometeor. diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index f586313340..f033832ceb 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -3,9 +3,8 @@ Snow Hydrology =============== -The model parameterizes -The parameterizations for snow are based primarily on Anderson (1976), -country-regionplaceJordan (1991), and Dai and Zeng (1997). The snowpack +The parameterizations for snow are based primarily on :ref:`Anderson (1976) `, +:ref:`Jordan (1991) `, and :ref:`Dai and Zeng (1997) `. The snowpack can have up to five layers. These layers are indexed in the Fortran code as :math:`i=-4,-3,-2,-1,0` where layer :math:`i=0` is the snow layer next to the top soil layer and layer :math:`i=-4` is the top layer of a @@ -55,7 +54,8 @@ Snow Covered Area Fraction ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The fraction of the ground covered by snow, :math:`f_{sno}` , is based -on the method of Swenson and Lawrence (2012). Because the processes +on the method of :ref:`Swenson and Lawrence (2012) `. +Because the processes governing snowfall and snowmelt differ, changes in :math:`f_{sno}` are calculated separately for accumulation and depletion. When snowfall occurs, :math:`f_{sno}` is updated as @@ -138,7 +138,7 @@ where \Delta z_{sno} =\frac{q_{grnd,\, ice} \Delta t}{f_{sno} \rho _{sno} } and :math:`\rho _{sno}` is the bulk density of newly fallen snow (kg -m\ :sup:`-3`) (CityplaceAnderson 1976) +m\ :sup:`-3`) (:ref:`Anderson (1976) `) .. math:: :label: 8.21) @@ -260,7 +260,7 @@ where the volumetric liquid water :math:`\theta _{liq,\, i}` and ice and :math:`S_{r} =0.033` is the irreducible water saturation (snow holds a certain amount of liquid water due to capillary retention after -drainage has ceased (Anderson 1976)). The water holding capacity of the +drainage has ceased (:ref:`Anderson (1976) `)). The water holding capacity of the underlying layer limits the flow of water :math:`q_{liq,\, i}` calculated in equation , unless the underlying layer is the surface soil layer, as @@ -357,7 +357,7 @@ is the model time step (s). The particle mass mixing ratio is c_{i} =\frac{m_{sp,\, i} }{w_{liq,\, i} +w_{ice,\, i} } . Values of :math:`k_{sp}` are partially derived from experiments -published by Conway et al. (1996). Particles masses are re-distributed +published by :ref:`Conway et al. (1996) `. Particles masses are re-distributed proportionately with snow mass when layers are combined or divided, thus conserving particle mass within the snow column. The mass of particles carried out with meltwater through the bottom snow layer is assumed to @@ -367,7 +367,7 @@ model. .. _Table Meltwater scavenging: .. table:: Meltwater scavenging efficiency for particles within snow - + +------------------------------------------+-------------------+ | Species | :math:`k_{sp}` | +==========================================+===================+ @@ -410,8 +410,7 @@ Snow Compaction Snow compaction is initiated after the soil hydrology calculations [surface runoff (section :numref:`Surface Runoff`), infiltration (section -:numref:`Infiltration`), soil water (section :numref:`Soil Water`), -groundwater-soilwater interactions (section 8.6)] are +:numref:`Infiltration`), soil water (section :numref:`Soil Water`)] are complete. Compaction of snow includes three types of processes: destructive metamorphism of new snow (crystal breakdown due to wind or thermodynamic stress); snow load or overburden (pressure); and melting @@ -435,7 +434,7 @@ Compaction is not allowed if the layer is saturated or if the ice content is below a minimum value (:math:`w_{ice,\, i} \le 0.1`). -Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` (s\ :sub:`-1`) is temperature dependent (CityplaceAnderson 1976) +Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` (s\ :sub:`-1`) is temperature dependent (:ref:`Anderson (1976) `) .. math:: :label: 8.43) @@ -458,7 +457,7 @@ and :math:`{w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` are the bulk densities of liquid water and ice (kg m\ :sup:`-3`). -The compaction rate as a result of overburden :math:`C_{R2,\; i}` (s\ :sup:`-1`) is a linear function of the snow load pressure :math:`P_{s,\, i}` (kg m\ :sup:`-2`) (CityplaceAnderson 1976) +The compaction rate as a result of overburden :math:`C_{R2,\; i}` (s\ :sup:`-1`) is a linear function of the snow load pressure :math:`P_{s,\, i}` (kg m\ :sup:`-2`) (:ref:`Anderson (1976) `) .. math:: :label: 8.45) @@ -520,7 +519,7 @@ After the determination of snow temperature including phase change(Chapter :numref:`rst_Snow Hydrology`), and the compaction calculations (section :numref:`Snow Compaction`) , the number of snow layers is adjusted by either combining or subdividing layers. The combination and subdivision -of snow layers is based on Jordan (1991). +of snow layers is based on :ref:`Jordan (1991) `. .. _Combination: diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst index 946dbd4c45..c1971be79a 100644 --- a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst @@ -50,7 +50,7 @@ snow, and surface water layers from the overlying atmosphere (section temperature profile is calculated first without phase change and then readjusted for phase change (section 6.2). -.. _Numerical Solution: +.. _Numerical Solution Temperature: Numerical Solution ---------------------- From cdbd9fe94196b30ffb3b4f7e17df16a37bae29ac Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 23 May 2017 10:57:23 -0600 Subject: [PATCH 0016/1973] add vertical discretization --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 40 ++ .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 249 +++++++--- .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 84 +++- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 440 ++++-------------- .../CLM50_Tech_Note_Photosynthesis.rst | 282 +++++------ .../References/CLM50_Tech_Note_References.rst | 17 +- .../CLM50_Tech_Note_Snow_Hydrology.rst | 13 +- ...CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 141 ++---- .../CLM50_Tech_Note_Surface_Albedos.rst | 134 +++--- 9 files changed, 649 insertions(+), 751 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 80cd1e3527..f0f31eac92 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -3,6 +3,8 @@ Crops and Irrigation ======================== +.. _Summary of CLM4.5 updates relative to the CLM4.0: + Summary of CLM4.5 updates relative to the CLM4.0 ----------------------------------------------------- @@ -30,6 +32,8 @@ refers to the interactive crop management model: These updates appear in detail in section 20.4. Most also appear in Drewniak et al. (2013). +.. _The crop model: + The crop model ------------------- @@ -65,6 +69,8 @@ while helping human societies answer questions about changing food, energy, and water resources in response to climate, environmental, land use, and land management change (e.g., Kucharik and Brye 2003; Lobell et al. 2006). +.. _Crop plant functional types: + Crop plant functional types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,6 +101,8 @@ CLM setting). Managed crop PFTs in the human managed land unit do not share soil columns and thus permit for differences in land management between crops. +.. _Phenology: + Phenology ^^^^^^^^^^^^^^^^ @@ -109,6 +117,8 @@ continues from leaf emergence to the beginning of grain fill, and phase 3 starts from the beginning of grain fill and ends with physiological maturity and harvest. +.. _Planting: + Planting ''''''''''''''''' @@ -175,6 +185,8 @@ outside the above ranges, then it equals the minimum or maximum value in the range. Also :math:`{T}_{f}` equals 273.15 K, :math:`{T}_{2m}` has units of K, and *GDD* has units of :sup:`o`\ days. +.. _Leaf emergence: + Leaf emergence ''''''''''''''''''''''' @@ -188,6 +200,8 @@ time step of phase 2, at which moment all seed C is transferred to leaf C. Subsequently, the leaf area index generally increases and reaches a maximum value during phase 2. +.. _Grain fill: + Grain fill ''''''''''''''''''' @@ -200,6 +214,8 @@ percentage itself is an empirical function of :math:`{GDD}_{mat}` response to a background litterfall rate calculated as the inverse of leaf longevity for the pft as done in the CN part of the model. +.. _Harvest: + Harvest '''''''''''''''' @@ -215,6 +231,8 @@ flow of live stem C and N to litter for corn, soybean, and temperate cereals. This is in contrast to the approach for unmanaged PFTs which puts live stem C and N to dead stems first, rather than to litter. +.. _Allocation: + Allocation ^^^^^^^^^^^^^^^^^ @@ -224,6 +242,8 @@ Simulated C assimilation begins every year upon leaf emergence in phase allocation of such C to the crop’s leaf, live stem, fine root, and reproductive pools. +.. _Leaf emergence to grain fill: + Leaf emergence to grain fill ''''''''''''''''''''''''''''''''''''' @@ -242,6 +262,8 @@ section 20.2.3. At a crop-specific maximum leaf area index, :math:`{L}_{max}` (Table 20.2), carbon allocation is directed exclusively to the fine roots. +.. _Grain fill to harvest: + Grain fill to harvest '''''''''''''''''''''''''''''' @@ -269,6 +291,8 @@ allocation decline factors, and :math:`a_{leaf}^{f}` and :math:`a_{livestem}^{f}` are final values of these allocation coefficients (Table 20.2). +.. _General comments: + General comments ^^^^^^^^^^^^^^^^^^^^^^^ @@ -411,6 +435,8 @@ allocation. Numbers in the first column correspond to the list of pfts in Table Notes: Crop growth phases and corresponding variables are described in the text +.. _The irrigation model: + The irrigation model ------------------------- @@ -480,9 +506,13 @@ added to :math:`{q}_{grnd,liq}`: section 7.1). Added irrigation is removed from total liquid runoff ( :math:`{R}_{liq}`: Chapter 11), simulating removal from nearby rivers. +.. _The details about what is new in CLM4.5: + The details about what is new in CLM4.5 -------------------------------------------- +.. _Interactive irrigation for corn, temperate cereals, and soybean: + Interactive irrigation for corn, temperate cereals, and soybean ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -527,6 +557,8 @@ or without irrigation. In simulations without irrigation, the rainfed and irrigated crops merge into just rainfed crops at run time. Surface datasets with 16 pfts can be used for all other CLM simulations. +.. _Interactive fertilization: + Interactive fertilization ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -563,6 +595,8 @@ The crop fertilization scheme was developed in versions of the CLM prior to CLM4.5. In CLM4.5, crops with fertilization may be simulated over productive. +.. _Biological nitrogen fixation for soybeans: + Biological nitrogen fixation for soybeans ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -606,6 +640,8 @@ pool for use that time step. Nitrogen fixation occurs after the plant has accumulated 15%\ :math:`{GDD}_{mat}` and before 75%\ :math:`{GDD}_{mat}`, so before grain fill begins. +.. _Modified C\:N ratios for crops: + Modified C:N ratios for crops ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -625,6 +661,8 @@ harvest. All C:N ratios were determined by calibration process, through comparisons of model output versus observations of plant carbon throughout the growth season. +.. _Nitrogen retranslocation for crops: + Nitrogen retranslocation for crops ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -699,6 +737,8 @@ fine root, and reproductive pools. | :math:`CN_{repr}^{f}` | 50 | 40 | 60 | +----------------------------+--------+---------------------+-----------+ +.. _Separate reproductive pool: + Separate reproductive pool ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 959a8cbd73..df44ae6fe1 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -1,7 +1,7 @@ -.. _rst_Surface Characterization and Model Input Requirements: +.. _rst_Surface Characterization, Vertical Discretization, and Model Input Requirements: -Surface Characterization and Model Input Requirements -======================================================== +Surface Characterization, Vertical Discretization, and Model Input Requirements +=================================================================================== .. _Surface Characterization: @@ -91,7 +91,7 @@ The crop land unit is present only when the crop model is active. Note that the biogeophysical processes related to soil and snow require PFT level properties to be aggregated to the column level. For example, the net heat flux into the ground is required as a boundary condition -for the solution of snow/soil temperatures (Chapter 6). This column +for the solution of snow/soil temperatures (Chapter :numref:`rst_Soil and Snow Temperatures`). This column level property must be determined by aggregating the net heat flux from all PFTs sharing the column. This is generally accomplished in the model by computing a weighted sum of the desired quantity over all PFTs whose @@ -108,18 +108,18 @@ types (PFTs) plus bare ground (:numref:`Table Plant functional types`). An additional PFT is added if the irrigation model is active and six additional PFTs are added if the crop model is active (Chapter :numref:`rst_Crops and Irrigation`). These -plant types differ -in leaf and stem optical properties that determine reflection, -transmittance, and absorption of solar radiation (Table 3.1), root +plant types differ in leaf and stem optical properties that determine reflection, +transmittance, and absorption of solar radiation (:numref:`Table Plant functional type optical properties`), root distribution parameters that control the uptake of water from the soil -(Table 8.3), aerodynamic parameters that determine resistance to heat, -moisture, and momentum transfer (Table 5.1), and photosynthetic +(:numref:`Table Plant functional type root distribution parameters`), aerodynamic parameters that determine resistance to heat, +moisture, and momentum transfer (:numref:`Table Plant functional type aerodynamic parameters`), and photosynthetic parameters that determine stomatal resistance, photosynthesis, and -transpiration (Tables 8.1, 8.2). The composition and abundance of PFTs +transpiration (:numref:`Table Plant functional type (PFT) photosynthetic parameters`, +:numref:`Table Temperature dependence parameters for C3 photosynthesis`). The composition and abundance of PFTs within a grid cell can either be prescribed as time-invariant fields (e.g., using the present day dataset described in section 21.3.3) or can evolve with time if the model is run in transient landcover mode -(Chapter 21). +(Chapter :numref:`rst_Transient Landcover Change`). .. _Table Plant functional types: @@ -264,11 +264,12 @@ When the biogeochemistry model is inactive, leaf and stem area indices (m\ :sup:`2` leaf area m\ :sup:`-2` ground area) are updated daily by linearly interpolating between monthly values. Monthly PFT leaf area index values are developed from the 1-km MODIS-derived monthly grid -cell average leaf area index of Myneni et al. (2002), as described in -Lawrence and Chase (2007). Stem area index is calculated from the -monthly PFT leaf area index using the methods of Zeng et al. (2002). The -leaf and stem area indices are adjusted for vertical burying by snow -(Wang and Zeng 2009) as +cell average leaf area index of :ref:`Myneni et al. (2002) `, +as described in :ref:`Lawrence and Chase (2007) `. Stem area +ndex is calculated from the monthly PFT leaf area index using the methods of +:ref:`Zeng et al. (2002) `. The leaf and stem area indices are +adjusted for vertical burying by snow (:ref:`Wang and Zeng 2009 `) +as .. math:: :label: 2.1 @@ -285,10 +286,110 @@ snow, :math:`A` is the remaining exposed leaf or stem area, {f_{veg}^{sno} = \frac{z_{sno} -z_{bot} }{z_{top} -z_{bot} } \qquad {\rm for\; tree\; and\; shrub}} \\ {f_{veg}^{sno} = \frac{\min \left(z_{sno} ,\, z_{c} \right)}{z_{c} } \qquad {\rm for\; grass\; and\; crop}} -where :math:`z_{sno} -z_{bot} \ge 0,{\rm \; }0\le f_{veg}^{sno} \le 1`, :math:`z_{sno}` is the depth of snow (m) (section 7.2), and -:math:`z_{c} = 0.2` is the snow depth when short vegetation is assumed to be completely buried by snow (m). For numerical reasons, exposed leaf -and stem area are set to zero if less than 0.05. If the sum of exposed leaf and stem area is zero, then the surface is treated as snow-covered -ground. +where :math:`z_{sno} -z_{bot} \ge 0,{\rm \; }0\le f_{veg}^{sno} \le 1`, :math:`z_{sno}` is the depth of snow (m) +(Chapter :numref:`rst_Snow Hydrology`), and :math:`z_{c} = 0.2` is the snow depth when short vegetation is assumed to +be completely buried by snow (m). For numerical reasons, exposed leaf and stem area are set to zero if less than +0.05. If the sum of exposed leaf and stem area is zero, then the surface is treated as snow-covered ground. + +.. _Vertical Discretization: + +Vertical Discretization +---------------------------- +.. + (this was taken from Initialization; is it still needed? + Vegetated and glacier land units have fifteen vertical layers, while + lakes have ten. For soil points, temperature calculations are done over + all layers, :math:`N_{levgrnd} =15`, while hydrology calculations are + done over the top ten layers, :math:`N_{levsoi} =10`, the bottom five + layers being specified as bedrock. + +.. _Soil Layers: + +Soil Layers +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The soil column can be discretized into an arbitrary number of layers. The default +vertical discretization (:numref:`Table Soil layer structure`) uses +:math:`N_{levgrnd} = 25` layers, of which :math:`N_{levsoi} = 20` are hydrologically and +biogeochemically active. The deepest 5 layers are only included in the thermodynamical +calculations (:ref:`Lawrence et al. 2008 `) described in Chapter +:numref:`rst_Soil and Snow Temperatures`. + +The layer structure of the soil is described by the node depth, :math:`z_{i}` +(m), the thickness of each layer, :math:`\Delta z_{i}` (m), and the depths +at the layer interfaces :math:`z_{h,\, i}` (m). + +.. _Table Soil layer structure: + +.. table:: Soil layer structure + + +---------------+------------------+------------------------+------------------------+ + | Layer | :math:`z_{i}` | :math:`\Delta z_{i}` | :math:`z_{h,\, i}` | + +===============+==================+========================+========================+ + | 1 | 0.010 | 0.020 | 0.020 | + +---------------+------------------+------------------------+------------------------+ + | 2 | 0.040 | 0.040 | 0.060 | + +---------------+------------------+------------------------+------------------------+ + | 3 | 0.090 | 0.060 | 0.120 | + +---------------+------------------+------------------------+------------------------+ + | 4 | 0.160 | 0.080 | 0.200 | + +---------------+------------------+------------------------+------------------------+ + | 5 | 0.260 | 0.120 | 0.320 | + +---------------+------------------+------------------------+------------------------+ + | 6 | 0.400 | 0.160 | 0.480 | + +---------------+------------------+------------------------+------------------------+ + | 7 | 0.580 | 0.200 | 0.680 | + +---------------+------------------+------------------------+------------------------+ + | 8 | 0.800 | 0.240 | 0.920 | + +---------------+------------------+------------------------+------------------------+ + | 9 | 1.060 | 0.280 | 1.200 | + +---------------+------------------+------------------------+------------------------+ + | 10 | 1.360 | 0.320 | 1.520 | + +---------------+------------------+------------------------+------------------------+ + | 11 | 1.700 | 0.360 | 1.880 | + +---------------+------------------+------------------------+------------------------+ + | 12 | 2.080 | 0.400 | 2.280 | + +---------------+------------------+------------------------+------------------------+ + | 13 | 2.500 | 0.440 | 2.720 | + +---------------+------------------+------------------------+------------------------+ + | 14 | 2.990 | 0.540 | 3.260 | + +---------------+------------------+------------------------+------------------------+ + | 15 | 3.580 | 0.640 | 3.900 | + +---------------+------------------+------------------------+------------------------+ + | 16 | 4.270 | 0.740 | 4.640 | + +---------------+------------------+------------------------+------------------------+ + | 17 | 5.060 | 0.840 | 5.480 | + +---------------+------------------+------------------------+------------------------+ + | 18 | 5.950 | 0.940 | 6.420 | + +---------------+------------------+------------------------+------------------------+ + | 19 | 6.940 | 1.040 | 7.460 | + +---------------+------------------+------------------------+------------------------+ + | 20 | 8.030 | 1.140 | 8.600 | + +---------------+------------------+------------------------+------------------------+ + | 21 | 9.795 | 2.390 | 10.990 | + +---------------+------------------+------------------------+------------------------+ + | 22 | 13.328 | 4.676 | 15.666 | + +---------------+------------------+------------------------+------------------------+ + | 23 | 19.483 | 7.635 | 23.301 | + +---------------+------------------+------------------------+------------------------+ + | 24 | 28.871 | 11.140 | 34.441 | + +---------------+------------------+------------------------+------------------------+ + | 25 | 41.998 | 15.115 | 49.556 | + +---------------+------------------+------------------------+------------------------+ + +Layer node depth (:math:`z_{i}` ), thickness (:math:`\Delta z_{i}` ), and depth at +layer interface (:math:`z_{h,\, i}` ) for default soil column. All in meters. + +.. _Depth to Bedrock: + +Depth to Bedrock +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The hydrologically and biogeochemically active portion of the soil column can be +restricted to a thickness less than that of the maximum soil depth. By providing +a depth-to-bedrock dataset, which may vary spatially, the number of layers used +in the hydrologic and biogeochemical calculations, :math:`N_{bedrock}`, may be +specified, subject to the constraint :math:`N_{bedrock} \le N_{levsoi}` .. _Model Input Requirements: @@ -363,7 +464,8 @@ conditions from the current time step. atmospheric model :math:`z'_{atm}` is assumed to be the height above the surface as defined by the roughness length :math:`z_{0}` plus displacement height :math:`d`. Thus, the reference height used for flux -computations (Chapter 5) is :math:`z_{atm} =z'_{atm} +z_{0} +d`. The +computations (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) +is :math:`z_{atm} =z'_{atm} +z_{0} +d`. The reference heights for temperature, wind, and specific humidity (:math:`z_{atm,\, h}` , :math:`z_{atm,\, {\it m}}` , :math:`z_{atm,\, w}` ) are required. These are set equal @@ -396,7 +498,7 @@ sea-surface temperatures and emissions (Lamarque et al. 2010) for short-lived gases and aerosols; observed concentrations were specified for methane, N\ :sub:`2`\ O, the ozone-depleting substances (CFCs) ,and CO\ :sub:`2`. The fluxes are used by the snow-related -parameterizations (Chapters 3 and 7). +parameterizations (Chapters :numref:`rst_Surface Albedos` and numref:`rst_Snow Hydrology`). :sup:`4`\ The nitrogen deposition rate is required by the biogeochemistry model when active and represents the total deposition of @@ -503,11 +605,7 @@ fields that are required from the restart or initial conditions files can be obtained by examining the code. Arbitrary initial conditions are specified as follows. -Vegetated and glacier land units have fifteen vertical layers, while -lakes have ten. For soil points, temperature calculations are done over -all layers, :math:`N_{levgrnd} =15`, while hydrology calculations are -done over the top ten layers, :math:`N_{levsoi} =10`, the bottom five -layers being specified as bedrock. Soil points are initialized with +Soil points are initialized with surface ground temperature :math:`T_{g}` and soil layer temperature :math:`T_{i}` , for :math:`i=1,\ldots ,N_{levgrnd}` , of 274 K, vegetation temperature :math:`T_{v}` of 283 K, no snow or canopy water @@ -624,9 +722,10 @@ The percentage glacier mask was derived from vector data of global glacier and ice sheet spatial coverage. Vector data for glaciers (ice caps, icefields and mountain glaciers) were taken from the first globally complete glacier inventory, the Randolph Glacier Inventory -version 1.0 (RGIv1.0: Arendt et al. 2012). Vector data for the Greenland -Ice Sheet were provided by Frank Paul and Tobias Bolch (University of -Zurich: Rastner et al. 2012). Antarctic Ice Sheet data were provided by +version 1.0 (RGIv1.0: :ref:`Arendt et al. 2012 `). +Vector data for the Greenland Ice Sheet were provided by Frank Paul and +Tobias Bolch (University of Zurich: :ref:`Rastner et al. 2012 `). +Antarctic Ice Sheet data were provided by Andrew Bliss (University of Alaska) and were extracted from the Scientific Committee on Antarctic Research (SCAR) Antarctic Digital Database version 5.0. Floating ice is only provided for the Antarctic @@ -651,75 +750,80 @@ elevation are needed when running CLM4 with multiple glacier elevation classes. Percent lake and lake depth are area-averaged from the 90-second -resolution data of Kourzeneva (2009, 2010) to the 0.05\ :sup:`o` +resolution data of :ref:`Kourzeneva (2009, 2010) ` to the 0.05\ :sup:`o` resolution using the MODIS land-mask. Percent urban is derived from LandScan 2004, a population density dataset derived from census data, nighttime lights satellite observations, road proximity and slope -(Dobson et al. 2000) as described by Jackson et al. (2010) at 1km +(:ref:`Dobson et al. 2000 `) as described by +:ref:`Jackson et al. (2010) ` at 1km resolution and aggregated to 0.05\ :sup:`o`. A number of urban radiative, thermal, and morphological fields are also required and are -obtained from Jackson et al. (2010). Their description can be found in -Table 3 of the Community Land Model Urban (CLMU) technical note (Oleson -et al. 2010b). +obtained from :ref:`Jackson et al. (2010) `. Their description can be found in +Table 3 of the Community Land Model Urban (CLMU) technical note (:ref:`Oleson +et al. 2010b `). Percent PFTs are derived from MODIS satellite data as described in -Lawrence and Chase (2007) (section 21.3.3). Prescribed PFT leaf area -index is derived from the MODIS satellite data of Myneni et al. (2002) -using the de-aggregation methods described in Lawrence and Chase (2007) +:ref:`Lawrence and Chase (2007) ` (section 21.3.3). +Prescribed PFT leaf area index is derived from the MODIS satellite data of +:ref:`Myneni et al. (2002) ` using the de-aggregation methods +described in :ref:`Lawrence and Chase (2007) ` (section 2.2.3). Prescribed PFT stem area index is derived from PFT leaf -area index phenology combined with the methods of Zeng et al. (2002). -Prescribed canopy top and bottom heights are from Bonan (1996) as -described in Bonan et al. (2002b). If the biogeochemistry model is +area index phenology combined with the methods of :ref:`Zeng et al. (2002) `. +Prescribed canopy top and bottom heights are from :ref:`Bonan (1996) ` as +described in :ref:`Bonan et al. (2002b) `. If the biogeochemistry model is active, it supplies the leaf and stem area index and canopy top and bottom heights dynamically, and the prescribed values are ignored. -Soil color determines dry and saturated soil albedo (section 3.2). Soil -colors are from Lawrence and Chase (2007) (section 3.2). +Soil color determines dry and saturated soil albedo (section :numref:`Ground Albedos`). +Soil colors are from :ref:`Lawrence and Chase (2007) `. The soil texture and organic matter content determine soil thermal and hydrologic properties (sections 6.3 and 7.4.1). The International Geosphere-Biosphere Programme (IGBP) soil dataset (Global Soil Data Task 2000) of 4931 soil mapping units and their sand and clay content for each soil layer were used to create a mineral soil texture dataset -(Bonan et al. 2002b). Soil organic matter data is merged from two -sources. The majority of the globe is from ISRIC-WISE (Batjes, 2006). +:ref:`(Bonan et al. 2002b) `. Soil organic matter data is merged from two +sources. The majority of the globe is from ISRIC-WISE (:ref:`Batjes, 2006 `). The high latitudes come from the 0.25\ :sup:`o` version of the -Northern Circumpolar Soil Carbon Database (Hugelius et al. 2012). Both +Northern Circumpolar Soil Carbon Database (:ref:`Hugelius et al. 2012 `). Both datasets report carbon down to 1m depth. Carbon is partitioned across -the top seven CLM4 layers (:math:`\sim`\ 1m depth) as in Lawrence and -Slater (2008). +the top seven CLM4 layers (:math:`\sim`\ 1m depth) as in +:ref:`Lawrence and Slater (2008) `. The maximum fractional saturated area (:math:`f_{\max }` ) is used in determining surface runoff and infiltration (section 7.3). Maximum fractional saturated area at 0.125\ :sup:`o` resolution is calculated from 1-km compound topographic indices (CTIs) based on the -USGS HYDRO1K dataset (Verdin and Greenlee 1996) following the algorithm -in Niu et al. (2005). :math:`f_{\max }` is the ratio between the number +USGS HYDRO1K dataset (:ref:`Verdin and Greenlee 1996 `) +following the algorithm in :ref:`Niu et al. (2005) `. +:math:`f_{\max }` is the ratio between the number of 1-km pixels with CTIs equal to or larger than the mean CTI and the total number of pixels in a 0.125\ :sup:`o` grid cell. See -section 7.3.1 and Li et al. (2013b) for further details. Slope and -elevation are also obtained from the USGS HYDRO1K 1-km dataset (Verdin -and Greenlee 1996). Slope is used in the River Transport Model (Chapter -11) and in the surface water parameterization (section 7.3.2), and +section 7.3.1 and :ref:`Li et al. (2013b) ` for further details. Slope and +elevation are also obtained from the USGS HYDRO1K 1-km dataset +(:ref:`Verdin and Greenlee 1996 `). Slope is used in the +surface water parameterization (section :numref:`Surface Water Storage`), and elevation is used to calculate the grid cell standard deviation of -topography for the snow cover fraction parameterization (section 7.2.1). +topography for the snow cover fraction parameterization (section :numref:`Snow Covered Area Fraction`). Biogenic Volatile Organic Compounds emissions factors are from the Model of Emissions of Gases and Aerosols from Nature version 2.1 (MEGAN2.1; -Guenther et al. 2012). +:ref:`Guenther et al. 2012 `). The default list of PFTs includes an unmanaged crop treated as a second C3 grass (:numref:`Table Plant functional types`). The unmanaged crop has grid cell fractional cover -assigned from MODIS satellite data (Lawrence and Chase 2007). A managed +assigned from MODIS satellite data (:ref:`Lawrence and Chase (2007) `). A managed crop option uses grid cell fractional cover from the present-day crop -dataset of Ramankutty and Foley (1998) (CLM4CNcrop). Managed crops are -assigned in the proportions given by Ramankutty and Foley (1998) without +dataset of :ref:`Ramankutty and Foley (1998) ` +(CLM4CNcrop). Managed crops are assigned in the proportions given by +:ref:`Ramankutty and Foley (1998) ` without exceeding the area previously assigned to the unmanaged crop. The unmanaged crop continues to occupy any of its original area that remains and continues to be handled just by the CN part of CLM4CNcrop. The managed crop types (corn, soybean, and temperate cereals) were chosen based on the availability of corresponding algorithms in AgroIBIS -(Kucharik et al. 2000; Kucharik and Brye 2003). Temperate cereals +(:ref:`Kucharik et al. 2000 `; +:ref:`Kucharik and Brye 2003 `). Temperate cereals include wheat, barley, and rye here. All temperate cereals are treated as summer crops (like spring wheat, for example) at this time. Winter cereals (such as winter wheat) may be introduced in a future version of @@ -737,10 +841,11 @@ management between crops. CLM includes the option to irrigate cropland areas that are equipped for irrigation. The application of irrigation responds dynamically to climate (see Chapter :numref:`rst_Crops and Irrigation`). In CLM, irrigation is -implemented for the C3 -generic crop only. When irrigation is enabled, the cropland area of each -grid cell is divided into an irrigated and unirrigated fraction -according to a dataset of areas equipped for irrigation (:ref:`Siebert et al. (2005) `). The area of irrigated cropland in each grid cell is given by the +implemented for the C3 generic crop only. When irrigation is enabled, the +cropland area of each grid cell is divided into an irrigated and unirrigated +fraction according to a dataset of areas equipped for irrigation +(:ref:`Siebert et al. (2005) `). The area of irrigated +cropland in each grid cell is given by the smaller of the grid cell’s total cropland area, according to the default CLM4 dataset, and the grid cell’s area equipped for irrigation. The remainder of the grid cell’s cropland area (if any) is then assigned to @@ -757,18 +862,18 @@ Database of the Global Environment version 3.1 (HYDEv3.1) with 0.5\ :sup:`o` resolution population density data for 1990, 1995, 2000, and 2005 from the Gridded Population of the World version 3 dataset (GPWv3) (CIESIN, 2005). Gross Domestic Production (GDP) per -capita in 2000 at 0.5\ :sup:`o` is from Van Vuuren et al. (2006), +capita in 2000 at 0.5\ :sup:`o` is from :ref:`Van Vuuren et al. (2006) `, which is the base-year GDP data for IPCC-SRES and derived from country-level World Bank’s World Development Indicators (WDI) measured -in constant 1995 US$ (World Bank, 2004) and the UN Statistics Database -(UNSTAT, 2005). The peatland area fraction at 0.5\ :sup:`o` +in constant 1995 US$ (:ref:`World Bank, 2004 `) and the UN Statistics Database +(:ref:`UNSTAT, 2005 `). The peatland area fraction at 0.5\ :sup:`o` resolution is derived from three vector datasets: peatland data in -Indonesia and Malaysian Borneo (Olson et al. 2001); peatland data in -Canada (Tarnocai et al. 2011); and bog, fen and mire data in boreal +Indonesia and Malaysian Borneo (:ref:`Olson et al. 2001 `); peatland data in +Canada (:ref:`Tarnocai et al. 2011 `); and bog, fen and mire data in boreal regions (north of 45\ :sup:`o`\ N) outside Canada provided by the -Global Lakes and Wetlands Database (GLWD) (Lehner and Döll, 2004). The -climatological peak month for agricultural waste burning is from van der -Werf et al. (2010). +Global Lakes and Wetlands Database (GLWD) (:ref:`Lehner and Döll, 2004 `). The +climatological peak month for agricultural waste burning is from :ref:`van der +Werf et al. (2010) `. .. _Adjustable Parameters and Physical Constants: diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 0bfdaf6217..0d8d213cb4 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -612,7 +612,7 @@ The water vapor flux :math:`E_{g}` (kg m\ :sup:`-2` s\ :sup:`-1`) is, with refe .. math:: :label: 5.67 - E_{soil} =-\frac{\beta _{soi} \rho _{atm} \left(q_{atm} -q_{soil} \right)}{r_{aw} } + E_{soil} =-\frac{\rho _{atm} \left(q_{atm} -q_{soil} \right)}{r_{aw} + r_{soil}} .. math:: :label: 5.68 @@ -624,11 +624,11 @@ The water vapor flux :math:`E_{g}` (kg m\ :sup:`-2` s\ :sup:`-1`) is, with refe E_{h2osfc} =-\frac{\rho _{atm} \left(q_{atm} -q_{h2osfc} \right)}{r_{aw} } -where :math:`\beta _{soi}` is an empirical function of soil water (Sakaguchi and Zeng 2009), :math:`q_{atm}` is the atmospheric specific -humidity (kg kg\ :sup:`-1`), :math:`q_{soil}` , :math:`q_{sno}` , and :math:`q_{h2osfc}` are the specific humidities -(kg kg\ :sup:`-1`) of the soil, snow, and surface water, respectively, and :math:`r_{aw}` is the aerodynamic resistance to water vapor -transfer (s m\ :sup:`-1`). The specific humidities of the snow :math:`q_{sno}` and surface water :math:`q_{h2osfc}` are assumed to be -at the saturation specific humidity of their respective temperatures +where :math:`q_{atm}` is the atmospheric specific humidity (kg kg\ :sup:`-1`), :math:`q_{soil}` , :math:`q_{sno}` , +and :math:`q_{h2osfc}` are the specific humidities (kg kg\ :sup:`-1`) of the soil, snow, and surface water, respectively, +:math:`r_{aw}` is the aerodynamic resistance to water vapor transfer (s m\ :sup:`-1`), and :math:`r _{soi}` is the soil +resistance to water vapor transfer (s m\ :sup:`-1`). The specific humidities of the snow :math:`q_{sno}` and surface water +:math:`q_{h2osfc}` are assumed to be at the saturation specific humidity of their respective temperatures .. math:: :label: 5.70) @@ -692,37 +692,71 @@ top soil layer (kg m\ :sup:`-2`) (Chapter :numref:`rst_Hydrology`), and prevents large increases (decreases) in :math:`q_{soil}` for small increases (decreases) in soil moisture in very dry soils. -The function :math:`\beta _{soi}` ranges from 0 to 1 and is intended to -represent the molecular diffusion process from the soil pore to the -surface within the dry part of the soil (Sakaguchi and Zeng 2009) as +The resistance to water vapor transfer occurring within the soil matrix +:math:`r_{soil}` is .. math:: :label: 5.76) - \beta _{soi} =\left\{\begin{array}{l} {1\qquad \theta _{1} \ge \theta _{fc,\, 1} {\rm \; or\; }q_{atm} -q_{soil} >0} \\ {0.25\left(1-f_{sno} -f_{h2osfc} \right)\left[1-\cos \left(\pi \frac{\theta _{1} }{\theta _{fc,\, 1} } \right)\right]^{2} +f_{sno} +f_{h2osfc} \qquad \theta _{1} <\theta _{fc,\, 1} } \end{array}\right\}. + r_{soil} = \frac{DSL}{D_{v} \tau} -where :math:`\theta _{fc,\, 1}` is the field capacity of the top soil -layer and -:math:`0.01{\le \theta _{1} \mathord{\left/ {\vphantom {\le \theta _{1} \theta _{fc,\, 1} \le 1}} \right. \kern-\nulldelimiterspace} \theta _{fc,\, 1} \le 1}` . -The volumetric water content of the top soil layer (mm\ :sup:`3` mm\ :sup:`-3`) is +where :math:`DSL` is the thickness of the dry surface layer, :math:`D_{v}` +is the molecular diffusivity of water vapor in air and :math:`\tau` +describes the tortuosity of the vapor flow paths through +the soil matrix (:ref:`Swenson and Lawrence 2014 `). + +The thickness of the dry surface layer is given by + +.. math:: + :label: 5.77) + + DSL = + \begin{array}{lr} + D_{max} \ \frac{\left( \theta_{init} - \theta_{1}\right)} + {\left(\theta_{init} - \theta_{air}\right)} & \qquad \theta_{1} < \theta_{init} \\ + 0 & \qquad \theta_{1} \ge \theta_{init} + \end{array} + +where :math:`D_{max}` is a parameter specifying the length scale +of the maximum DSL thickness (default value = 15 mm), +:math:`\theta_{init}` is the moisture value at which the DSL initiates, +:math:`\theta_{1}` is the moisture value of the top model soil layer, +and :math:`\theta_{air}` is the 'air dry' soil moisture value +(:ref:`Dingman 2002 `): + +.. math:: + :label: 5.78) + + \theta_{air} = \Phi \left( \frac{\Psi_{sat}}{\Psi_{air}} \right)^{\frac{1}{B_{1}}} \ . + +where :math:`\Phi` is the porosity, :math:`\Psi_{sat}` is the saturated +soil matric potential, :math:`\Psi_{air} = 10^{7}` mm is the air dry +matric potential, and :math:`B_{1}` is a function of soil texture (section +:numref:`Hydraulic Properties`). + +The soil tortuosity is + +.. math:: + :label: 5.79) + + \tau = \Phi^{2}_{air}\left(\frac{\Phi_{air}}{\Phi}\right)^{\frac{3}{B_{1}}} + +where :math:`\Phi_{air}` is the air filled pore space .. math:: - :label: 5.77) + :label: 5.80) - \theta _{1} =\frac{1}{\Delta z_{1} } \left[\frac{w_{liq,\, 1} }{\rho _{liq} } +\frac{w_{ice,\, 1} }{\rho _{ice} } \right]. + \Phi_{air} = \Phi - \theta_{air} \ . -The volumetric water content at field capacity is derived by assuming a -hydraulic conductivity of 0.1 mm day\ :sup:`-1` and inverting the -hydraulic conductivity function (section :numref:`Hydraulic Properties`) as +:math:`D_{v}` depends on temperature .. math:: - :label: 5.78) + :label: 5.81) - \theta _{fc,\, 1} =\theta _{sat,\, 1} \left[\frac{0.1}{86400k_{sat,\, 1} } \right]^{\frac{1}{2B_{i} +3} } + D_{v} = 2.12 \times 10^{-5} \left(\frac{T_{1}}{T_{f}}\right)^{1.75} \ . -where :math:`k_{sat,\, 1}` is the saturated hydraulic conductivity of -the top soil layer (mm s\ :sup:`-1`) (section :numref:`Hydraulic Properties`) and the -exponent :math:`B_{1}` is a function of soil texture (section :numref:`Hydraulic Properties`). +where :math:`T_{1}` is the temperature of the top soil layer and +:math:`T_{f}` is the freezing temperature of water (:numref:`Table Physical Constants`). The roughness lengths used to calculate :math:`r_{am}` , :math:`r_{ah}` , and :math:`r_{aw}` are :math:`z_{0m} =z_{0m,\, g}` , @@ -942,7 +976,7 @@ are the sensible heat conductances from the canopy air to the atmosphere, the ground to canopy air, and leaf surface to canopy air, respectively (m s\ :sup:`-1`). -When the expression for :math:`T_{s}` is substituted into equation , +When the expression for :math:`T_{s}` is substituted into equation :eq:`ZEqnNum675188`, the sensible heat flux from vegetation :math:`H_{v}` is a function of :math:`\theta _{atm}` , :math:`T_{g}` , and :math:`T_{v}` diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index f850a383b4..e6f45af8ff 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -25,7 +25,7 @@ where :math:`q_{rain}` is the liquid part of precipitation, ET from vegetation (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), :math:`E_{g}` is ground evaporation (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), :math:`q_{over}` is surface runoff (section :numref:`Surface Runoff`), :math:`q_{h2osfc}` is runoff from surface water storage (section :numref:`Surface Runoff`), -:math:`q_{drai}` is sub-surface drainage (section 7.6), +:math:`q_{drai}` is sub-surface drainage (section :numref:`Lateral Sub-surface Runoff`), :math:`q_{rgwl}` and :math:`q_{snwcp,ice}` are liquid and solid runoff from glaciers, wetlands, and lakes, and runoff from other surface types due to snow capping (section :numref:`Runoff from glaciers and snow-capped surfaces`) (all in kg m\ :sup:`-2` @@ -140,14 +140,22 @@ calculations is (:ref:`Dickinson et al.1993 `) .. math:: :label: 7.12) - f_{wet} =\left\{\begin{array}{l} {\left[\frac{W_{can} }{p\left(L+S\right)} \right]^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \le 1\qquad L+S>0} \\ {0\qquad L+S=0} \end{array}\right\} + f_{wet} = + \left\{\begin{array}{lr} + \left[\frac{W_{can} }{p\left(L+S\right)} \right]^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \le 1 & \qquad L+S > 0 \\ + 0 &\qquad L+S = 0 + \end{array}\right\} while the fraction of the canopy that is dry and transpiring is .. math:: :label: 7.13) - f_{dry} =\left\{\begin{array}{l} {\frac{\left(1-f_{wet} \right)L}{L+S} \qquad L+S>0} \\ {0\qquad L+S=0} \end{array}\right\}. + f_{dry} = + \left\{\begin{array}{lr} + \frac{\left(1-f_{wet} \right)L}{L+S} & \qquad L+S > 0 \\ + 0 &\qquad L+S = 0 + \end{array}\right\}. .. _Surface Runoff, Surface Water Storage, and Infiltration: @@ -271,7 +279,7 @@ portion of the grid cell that is interconnected .. math:: :label: 7.69) - \begin{array}{l} {f_{connected} =\left(f_{h2osfc} -f_{c} \right)^{\mu } \qquad for\, f_{h2osfc} >f_{c} } \\ {f_{connected} =0\qquad \qquad \qquad for\, f_{h2osfc} \le f_{c} } \end{array} + \begin{array}{lr} f_{connected} =\left(f_{h2osfc} -f_{c} \right)^{\mu } & \qquad f_{h2osfc} >f_{c} \\ f_{connected} =0 &\qquad f_{h2osfc} \le f_{c} \end{array} where :math:`f_{c}` is a threshold below which no single connected inundated area spans the grid cell and :math:`\mu` is a scaling @@ -316,7 +324,7 @@ s\ :sup:`-1`), q_{infl,\, \max } =(1-fsat){\rm \Theta }iceksat where :math:`{\rm \Theta }ice` is an ice impedance factor (section -7.4), infiltration excess (Hortonian) runoff is generated +:numref:`Hydraulic Properties`), infiltration excess (Hortonian) runoff is generated .. math:: :label: 7.73) @@ -370,11 +378,10 @@ Soil Water Soil water is predicted from a multi-layer model, in which the vertical soil moisture transport is governed by infiltration, surface and -sub-surface runoff, gradient diffusion, gravity, canopy transpiration -through root extraction, and interactions with groundwater -(:numref:`Hydrologic processes figure`). +sub-surface runoff, gradient diffusion, gravity, and canopy transpiration +through root extraction (:numref:`Hydrologic processes figure`). The following derivation generally follows that of :ref:`Z.-L. Yang (1998, -unpublished manuscript) ` with modifications by Zeng and Decker (2009). +unpublished manuscript) `. For one-dimensional vertical water flow in soils, the conservation of mass is stated as @@ -394,11 +401,12 @@ of soil s\ :sup:`-1`) (ET loss). This equation is solved numerically by dividing the soil column into multiple layers in the vertical and integrating downward over each layer with an upper boundary condition of the infiltration flux into the top soil layer -:math:`q_{infl}` and a lower boundary condition that depends on the -depth of the water table. +:math:`q_{infl}` and a zero-flux lower boundary condition at the +bottom of the soil column (sub-surface runoff is removed later in the +timestep, section :numref:`Lateral Sub-surface Runoff`). The soil water flux :math:`q` in equation can be described by Darcy’s -law +law :ref:`(Dingman 2002) ` .. math:: :label: 7.80) @@ -427,57 +435,20 @@ becomes q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]. -Darcy’s equation can be further manipulated to yield +Equation :eq:`ZEqnNum186573` can be further manipulated to yield .. math:: :label: 7.83) q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]=-k\left(\frac{\partial \psi }{\partial z} +1\right)=-k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right). -Substitution of this equation into equation , with :math:`Q=0`, yields +Substitution of this equation into equation :eq:`ZEqnNum790844`, with :math:`Q=0`, yields the Richards equation .. math:: :label: ZEqnNum670361 - \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } \right)+1\right]. - -Zeng and Decker (2009) note that this :math:`\theta` -based form of the -Richards equation cannot maintain the hydrostatic equilibrium soil -moisture distribution because of the truncation errors of the -finite-difference numerical scheme. They show that this deficiency can -be overcome by subtracting the equilibrium state from equation as - -.. math:: - :label: ZEqnNum936839 - - q=-k\left[\frac{\partial \left(\psi +z-C\right)}{\partial z} \right] - -where :math:`C` is a constant hydraulic potential above the water table -:math:`z_{\nabla }` - -.. math:: - :label: ZEqnNum126975 - - C=\psi _{E} +z=\psi _{sat} \left[\frac{\theta _{E} \left(z\right)}{\theta _{sat} } \right]^{-B} +z=\psi _{sat} +z_{\nabla } - -so that - -.. math:: - :label: ZEqnNum537733 - - q=-k\left[\frac{\partial \left(\psi -\psi _{E} \right)}{\partial z} \right] - -where :math:`\psi _{E}` \ is the equilibrium soil matric potential -(mm). Substitution of equations and into equation yields Zeng and -Decker’s (2009) modified Richards equation - -.. math:: - :label: 7.88) - - \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \left(\psi -\psi _{E} \right)}{\partial z} \right)\right]-Q - -where the soil moisture sink term :math:`Q` is now included. + \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right)\right]. .. _Hydraulic Properties: @@ -487,7 +458,7 @@ Hydraulic Properties The hydraulic conductivity :math:`k_{i}` (mm s\ :sup:`-1`) and the soil matric potential :math:`\psi _{i}` (mm) for layer :math:`i` vary with volumetric soil water :math:`\theta _{i}` and soil texture. -As with the soil thermal properties (section 6.3) the hydraulic +As with the soil thermal properties (section :numref:`Soil And Snow Thermal Properties`) the hydraulic properties of the soil are assumed to be a weighted combination of the mineral properties, which are determined according to sand and clay contents based on work by :ref:`Clapp and Hornberger (1978) @@ -506,14 +477,18 @@ moisture of the two layers :math:`\theta _{i}` and .. math:: :label: ZEqnNum398074 - k\left[z_{h,\, i} \right]=\left\{\begin{array}{l} {\Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +3} \qquad 1\le i\le N_{levsoi} -1} \\ {\Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{2B_{i} +3} \qquad i=N_{levsoi} } \end{array}\right\}. + k\left[z_{h,\, i} \right] = + \left\{\begin{array}{lr} + \Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +3} & \qquad 1 \le i \le N_{levsoi} - 1 \\ + \Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{2B_{i} +3} & \qquad i = N_{levsoi} + \end{array}\right\}. The ice impedance factor is a function of ice content, and is meant to quantify the increased tortuosity of the water flow when part of the pore space is filled with ice. :ref:`Swenson et al. (2012) ` -used a power law form :math:`\Theta _{ice} =10^{-\Omega F_{ice} }` where -:math:`\Omega =6`\ and -:math:`F_{ice} =\frac{\theta _{ice} }{\theta _{sat} }` is the +used a power law form :math:`\Theta _{ice} = 10^{-\Omega F_{ice} }` where +:math:`\Omega = 6`\ and +:math:`F_{ice} = \frac{\theta_{ice} }{\theta_{sat} }` is the ice-filled fraction of the pore space. Because the hydraulic properties of mineral and organic soil may differ @@ -535,16 +510,16 @@ porosity of organic matter and the porosity of the mineral soil .. math:: :label: 7.91) - \theta _{sai,\min ,i} =0.489-0.00126(\% sand)_{i} . + \theta _{sai,\min ,i} = 0.489 - 0.00126(\% sand)_{i} . -The exponent “:math:`B`” is +The exponent :math:`B_{i}` is .. math:: :label: 7.92) B_{i} =(1-f_{om,i} )B_{\min ,i} +f_{om,i} B_{om} -where :math:`B_{om} =2.7`\ (:ref:`Letts et al. 2000 `) and +where :math:`B_{om} = 2.7` \ (:ref:`Letts et al. 2000 `) and .. math:: :label: 7.93) @@ -566,7 +541,7 @@ where the saturated soil matric potential (mm) is \psi _{sat,i} =(1-f_{om,i} )\psi _{sat,\min ,i} +f_{om,i} \psi _{sat,om} -where :math:`\psi _{sat,om} =-10.3`\ mm (Letts et al. 2000) is the +where :math:`\psi _{sat,om} = -10.3` \ mm (:ref:`Letts et al. 2000 `) is the saturated organic matter matric potential and the saturated mineral soil matric potential :math:`\psi _{sat,\min ,i}` \ is @@ -586,9 +561,9 @@ as 1 %. To better represent the influence of organic soil material on the grid cell average saturated hydraulic conductivity, the soil organic matter fraction is further subdivided into “connected” and “unconnected” fractions using a result from percolation theory (:ref:`Stauffer and Aharony -1994 `, :ref:`Berkowitz and Balberg 1992 `). Assuming that the organic and mineral -fractions are randomly distributed throughout a soil layer, percolation -theory predicts that above a threshold value +1994 `, :ref:`Berkowitz and Balberg 1992 `). +Assuming that the organic and mineral fractions are randomly distributed throughout +a soil layer, percolation theory predicts that above a threshold value :math:`f_{om} =f_{threshold}` , connected flow pathways consisting of organic material only exist and span the soil space. Flow through these pathways interacts only with organic material, and thus can be described @@ -597,7 +572,10 @@ by :math:`k_{sat,\, om}` . This fraction of the grid cell is given by .. math:: :label: 7.97) - \begin{array}{l} {f_{perc} =\; N_{perc} \left(f_{om} {\rm \; }-f_{threshold} \right)^{\beta _{perc} } f_{om} {\rm \; }\qquad f_{om} \ge f_{threshold} } \\ {f_{perc} =0\qquad f_{om} `) as +texture (:ref:`Cosby et al. 1984 `) as .. math:: :label: 7.99) @@ -633,7 +611,7 @@ Numerical Solution ^^^^^^^^^^^^^^^^^^^^^^^^ With reference to :numref:`Water flux schematic figure`, the equation for conservation of mass -(equation ) can be integrated over each layer as +(equation :eq:`ZEqnNum790844`) can be integrated over each layer as .. math:: :label: 7.101) @@ -777,8 +755,7 @@ where r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . The tridiagonal equation set is solved over -:math:`i=1,\ldots ,N_{levsoi} +1` where the layer -:math:`i=N_{levsoi} +1` is a virtual layer representing the aquifer. +:math:`i=1,\ldots ,N_{levsoi}`. The finite-difference forms of the fluxes and partial derivatives in equations - can be obtained from equation as @@ -847,90 +824,6 @@ derived from equation \begin{array}{l} {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } =\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } =\left(1-\frac{f_{frz,\, i} +f_{frz,\, i+1} }{2} \right)\left(2B_{i} +3\right)k_{sat} \left[z_{h,\, i} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right)} \end{array}. -Equilibrium soil matric potential and volumetric moisture -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -The equilibrium soil matric potential :math:`\psi _{E}` can be derived -from equation as - -.. math:: - :label: ZEqnNum899028 - - \psi _{E} =\psi _{sat} \left(\frac{\theta _{E} \left(z\right)}{\theta _{sat} } \right)^{-B} - -and the equilibrium volumetric water content -:math:`\theta _{E} \left(z\right)` at depth :math:`z` can also be -derived as - -.. math:: - :label: 7.127) - - \theta _{E} \left(z\right)=\theta _{sat} \left(\frac{\psi _{sat} +z_{\nabla } -z}{\psi _{sat} } \right)^{-\frac{1}{B} } . - -Here, the soil matric potentials, the water table depth -:math:`z_{\nabla }` and the soil depths have units of mm. For the -finite-difference scheme, a layer-average equilibrium volumetric water -content is used in equation and can be obtained from - -.. math:: - :label: 7.128) - - \overline{\theta _{E,\, i} }=\int _{z_{h,\, i-1} }^{z_{h,\, i} }\frac{\theta _{E} \left(z\right)}{z_{h,\, i} -z_{h,\, i-1} } \, dz - -which when integrated yields - -.. math:: - :label: ZEqnNum445442 - - \overline{\theta _{E,\, i} }=\frac{\theta _{sat,\, i} \psi _{sat,\, i} }{\left(z_{h,\, i} -z_{h,\, i-1} \right)\left(1-\frac{1}{B_{i} } \right)} \left[\left(\frac{\psi _{sat,\, i} -z_{\nabla } +z_{h,\, i} }{\psi _{sat,\, i} } \right)^{1-\frac{1}{B_{i} } } -\left(\frac{\psi _{sat,\, i} -z_{\nabla } +z_{h,\, i-1} }{\psi _{sat,\, i} } \right)^{1-\frac{1}{B_{i} } } \right]. - -Equation is valid when the water table :math:`z_{\nabla }` is deeper -than both interface depths :math:`z_{h,\, i-1}` and -:math:`z_{h,\, i}` . Since the water table can be within the soil -column, the equation is modified if the water table is within soil layer -:math:`i` (:math:`z_{h,\, i-1} z_{h,\, N_{levsoi} }` ), an equilibrium volumetric -soil moisture is calculated for a virtual layer :math:`i=N_{levsoi} +1` -as - -.. math:: - :label: ZEqnNum235293 - - \overline{\theta _{E,\, i=N_{levsoi+1} } }=\frac{\theta _{sat,i-1} \psi _{sat,\, i-1} }{\left(z_{\nabla } -z_{h,\, i-1} \right)\left(1-\frac{1}{B_{i-1} } \right)} \left[1-\left(\frac{\psi _{sat,\, i-1} -z_{\nabla } +z_{h,\, i-1} }{\psi _{sat,\, i-1} } \right)^{1-\frac{1}{B_{i-1} } } \right] - -The equilibrium volumetric soil moisture is constrained by - -.. math:: - :label: 7.133) - - 0\le \overline{\theta _{E,\, i} }\le \theta _{sat,\, i} - -The equilibrium soil matric potential is then - -.. math:: - :label: ZEqnNum533842 - - \psi _{E,\, i} =\psi _{sat,\, i} \left(\frac{\overline{\theta _{E,\, i} }}{\theta _{sat,\, i} } \right)^{-B_{i} } \ge -1\times 10^{8} \qquad \frac{\overline{\theta _{E,\, i} }}{\theta _{sat,\, i} } \ge 0.01 - Equation set for layer :math:`i=1` '''''''''''''''''''''''''''''''''''''''''' @@ -993,47 +886,23 @@ The coefficients of the tridiagonal set of equations for r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . -Equation set for layers :math:`i=N_{levsoi} ,\ldots N_{levsoi} +1` +Equation set for layer :math:`i=N_{levsoi}` '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' -For the lowest soil layer (:math:`i=N_{levsoi}` ), the bottom boundary -condition depends on the depth of the water table. If the water table is -within the soil column (:math:`z_{\nabla } \le z_{h,\, N_{levsoi} }` ), -a zero-flux bottom boundary condition is applied (:math:`q_{i}^{n} =0`) +For the lowest soil layer (:math:`i=N_{levsoi}` ), a zero-flux bottom boundary +condition is applied (:math:`q_{i}^{n} =0`) and the coefficients of the tridiagonal set of equations for :math:`i=N_{levsoi}` are -.. math:: - :label: 7.144) - - a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } - -.. math:: - :label: 7.145) - - b_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} - -.. math:: - :label: 7.146) - - c_{i} =0 - -.. math:: - :label: 7.147) - - r_{i} =q_{i-1}^{n} +e_{i} . - -The coefficients for the aquifer layer :math:`i=N_{levsoi} +1` are then - .. math:: :label: 7.148) - a_{i} =0 + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } .. math:: :label: 7.149) - b_{i} =-\frac{\Delta z_{i} }{\Delta t} + b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: :label: 7.150) @@ -1043,83 +912,28 @@ The coefficients for the aquifer layer :math:`i=N_{levsoi} +1` are then .. math:: :label: 7.151) - r_{i} =0. + r_{i} =q_{i-1}^{n} +e_{i} . -If the water table is below the soil column -(:math:`z_{\nabla } >z_{h,\, N_{levsoi} }` ), the coefficients for -:math:`i=N_{levsoi}` are +Adaptive Time Stepping +''''''''''''''''''''''''''''' +The tridiagonal equation set is solved using an adaptive time-stepping procedure. +An initial solution is found by setting :math:`\Delta t` equal to the model time +step. An estimate of the error is calculated from .. math:: :label: 7.152) - a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } - -.. math:: - :label: 7.153) - - b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} - -.. math:: - :label: 7.154) - - c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } - -.. math:: - :label: 7.155) - - r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . - -The :math:`i=N_{levsoi} +1` terms are evaluated using - -.. math:: - :label: 7.156) - - \psi _{N_{levsoi} +1} =\psi _{sat,\, N_{levsoi} } \left[s_{N_{levsoi} +1} \right]^{-B_{N_{levsoi} } } \ge -1\times 10^{8} - -.. math:: - :label: 7.157) - - z_{N_{levsoi} +1} =0.5\left(z_{\nabla } +z_{N_{levsoi} } \right) - -where - -.. math:: - :label: 7.158) - - s_{N_{levsoi} +1} =0.5\left(\frac{\theta _{sat,\, N_{levsoi} } +\theta _{N_{levsoi} } }{\theta _{sat,\, N_{levsoi} } } \right)\qquad 0.01\le s_{N_{levsoi} +1} \le 1, - -:math:`\psi _{E,\, N_{levsoi} +1}` is evaluated from equations and , - -and - -.. math:: - :label: 7.159) - - \frac{\partial \psi _{N_{levsoi} +1} }{\partial \theta _{liq,\, N_{levsoi} +1} } =-B_{N_{levsoi} } \frac{\psi _{N_{levsoi} +1} }{s_{\, N_{levsoi} } \theta _{sat,\, N_{levsoi} } } . - -The coefficients for the aquifer layer :math:`i=N_{levsoi} +1` are then - -.. math:: - :label: 7.160) - - a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } - -.. math:: - :label: 7.161) + \epsilon = max \left[ \frac{\Delta \theta_{liq,\, i} \Delta z_{i}}{\Delta t} - + \left( q_{i-1}^{n} - q_{i}^{n} + e_{i}\right) \right] - b_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} +If :math:`\epsilon` is greater than a specified error tolerance, the solution is +rejected, :math:`\Delta t` is halved and a new solution is determined. If the solution +is accepted, the procedure repeats until the adaptive sub-stepping spans the full +model time step. During the solution, the sub-steps may be halved until a +specified minimum time step length is reached, and the sub-steps may be doubled +when :math:`\epsilon` is less than a specified error tolerance. -.. math:: - :label: 7.162) - - c_{i} =0 - -.. math:: - :label: 7.163) - - r_{i} =q_{i-1}^{n} . - -Upon solution of the tridiagonal equation set (Press et al. 1992), the +Upon solution of the tridiagonal equation set, the liquid water contents are updated as follows .. math:: @@ -1160,9 +974,8 @@ hydraulic conductivity, k_{drai,\, perch} =10^{-5} \sin (\beta )\left(\frac{\sum _{i=N_{perch} }^{i=N_{frost} }\Theta _{ice,i} k_{sat} \left[z_{i} \right]\Delta z_{i} }{\sum _{i=N_{perch} }^{i=N_{frost} }\Delta z_{i} } \right) -where :math:`\Theta _{ice}` is an ice impedance factor determined from -the ice content of the soil layers interacting with the water table -(section 7.6), :math:`\beta` is the mean grid cell topographic slope in +where :math:`\Theta_{ice}` is an ice impedance factor, :math:`\beta` +is the mean grid cell topographic slope in radians, :math:`z_{frost}` \ is the depth to the frost table, and :math:`z_{\nabla ,perch}` is the depth to the perched saturated zone. The frost table :math:`z_{frost}` is defined as the shallowest frozen @@ -1174,88 +987,33 @@ threshold is set to 0.9. Drainage from the perched saturated zone through :math:`N_{frost}` , which are the layers containing :math:`z_{\nabla ,perch}` and, :math:`z_{frost}` \ respectively. -.. _Groundwater-Soil Water Interactions: +.. _Lateral Sub-surface Runoff: -Groundwater-Soil Water Interactions +Lateral Sub-surface Runoff --------------------------------------- - -Drainage or sub-surface runoff is based on the SIMTOP scheme (Niu et al. -2005) with a modification to account for reduced drainage in frozen -soils. In the work of Niu et al. (2005), the drainage :math:`q_{drai}` -(kg m\ :sup:`-2` s\ :sup:`-1`) was formulated as - -.. math:: - :label: ZEqnNum924767 - - q_{drai} =q_{drai,\, \max } \exp \left(-f_{drai} z_{\nabla } \right). - -Here, the water table depth :math:`z_{\nabla }` has units of meters. To -restrict drainage in frozen soils, Niu et al. (2005) added the following -condition - -.. math:: - :label: 7.169) - - q_{drai} =0\qquad {\rm for\; \; }w_{ice,\, N_{levsoi} } >w_{liq,\, N_{levsoi} } . - -In preliminary testing it was found that a more gradual restriction of -drainage was required so that the water table depth remained dynamic -under partially frozen conditions. The following modification is made to -equation - -.. math:: - :label: ZEqnNum150955 - - q_{drai} =\Theta _{ice} q_{drai,\, \max } \exp \left(-f_{drai} z_{\nabla } \right) - -where :math:`\Theta _{ice}` is an ice impedance factor determined from -the ice content of the soil layers interacting with the water table +Lateral sub-surface runoff occurs when saturated soil moisture conditions +exist within the soil column. Sub-surface runoff is .. math:: - :label: 7.171) + :label: 7.168) - \Theta _{ice} =10^{-\Omega \left(\frac{\sum _{i=jwt}^{i=N_{levsoi} }F_{ice,i} \Delta z_{i} }{\sum _{i=jwt}^{i=N_{levsoi} }\Delta z_{i} } \right)} + q_{subsurface} = \Theta_{ice} K_{baseflow} tan \left( \beta \right) + \Delta z_{sat}^{N_{baseflow}} \ , -where :math:`\Omega =6`\ is an adjustable parameter, :math:`jwt` is the -index of the layer directly above the water table, -:math:`F_{ice} =\frac{\theta _{ice} }{\theta _{sat} }` is the -ice-filled fraction of the pore space of soil layer :math:`i` (kg -m\ :sup:`-2`), and :math:`\Delta z_{i}` is the layer thickness (mm). This -expression is functionally the same as that used to determine the ice -impedance factor in section :numref:`Hydraulic Properties`. In equation , -the decay factor :math:`f_{drai} =2.5` m\ :sup:`-1` and the maximum drainage -when the water table depth is at the surface -:math:`q_{drai,\, \max } =10\sin (\beta )` kg m\ :sup:`-2` -s\ :sup:`-1` , where :math:`\beta` is the mean grid cell -topographic slope in radians, were determined for global simulations -through sensitivity analysis and comparison with observed runoff. +where :math:`K_{baseflow}` is a calibration parameter, :math:`\beta` is the +topographic slope, the exponent :math:`N_{baseflow}` = 1, and :math:`\Delta z_{sat}` +is the thickness of the saturated portion of the soil column. -Determination of water table depth :math:`z_{\nabla }` is based on work -by Niu et al. (2007). In this approach, a groundwater component is added -in the form of an unconfined aquifer lying below the soil column (:numref:`Hydrologic processes figure`). The groundwater solution is dependent on whether the water table -is within or below the soil column. The water stored in the unconfined -aquifer :math:`W_{a}` has a prescribed maximum value (5000 mm). When -the water table is within the soil column, :math:`W_{a}` is constant -because there is no water exchange between the soil column and the -underlying aquifer. In this case, recharge to the water table is -diagnosed by applying Darcy’s law across the water table +The saturated thickness is .. math:: - :label: 7.172) - - q_{rech\arg e} =-k_{aq} \frac{\left(\Psi _{\nabla } -\Psi _{jwt} \right)}{\left(z_{\nabla } -z_{jwt} \right)} + :label: 7.1681) -where :math:`\Psi _{\nabla } =0` is the matric potential at the water -table and\ :math:`k_{aq} =\Theta _{ice,jwt+1} k\left[z_{jwt+1} \right]` -is the hydraulic conductivity of the layer containing the water table. -Change in the water table is then calculated as the difference between -recharge and drainage, scaled by the specific yield of the layer -containing the water table + \Delta z_{sat} = z_{bedrock} - z_{\nabla}, -.. math:: - :label: ZEqnNum287831 - - \Delta z_{\nabla } =\frac{\left(q_{rech\arg e} -q_{drai} \right)}{S_{y} } \Delta t. +where the water table :math:`z_{\nabla}` is determined by finding the +first soil layer above the bedrock depth (section ) in which the volumetric water +content drops below a specified threshold. The default threshold is set to 0.9. The specific yield, :math:`S_{y}` , which depends on the soil properties and the water table location, is derived by taking the @@ -1271,36 +1029,6 @@ where B is the Clapp-Hornberger exponent. Because :math:`S_{y}` is a function of the soil properties, it results in water table dynamics that are consistent with the soil water fluxes described in section 7.4. -For the case when the water table is below the soil column, the change -in water stored in the unconfined aquifer :math:`W_{a}` (mm) is updated -as - -.. math:: - :label: 7.174a) - - \Delta W_{a}^{} =\left(q_{recharge} -q_{drai} \right)\Delta t - -and the water table is updated using equation with the specific yield of -layer :math:`N_{levsoi}` . - -The recharge rate is defined as positive when water enters the aquifer - -.. math:: - :label: 7.174b) - - q_{recharge} =\frac{\Delta \theta _{liq,\, N_{levsoi} +1} \Delta z_{N_{levsoi} +1} }{\Delta t} - -where -:math:`\Delta \theta _{liq,\, N_{levsoi} +1} =\theta _{liq,\, N_{levsoi} +1}^{n+1} -\theta _{liq,\, N_{levsoi} +1}^{n}` -is the change in liquid water content for layer :math:`i=N_{levsoi} +1` -calculated from the solution of the soil water equations (section 7.4), -and :math:`\Delta z_{N_{levsoi} +1}` (mm) is - -.. math:: - :label: 7.174c) - - \Delta z_{N_{levsoi} +1} =z_{\nabla }^{n} -z_{h,\, N_{levsoi} } . - After the above calculations, two numerical adjustments are implemented to keep the liquid water content of each soil layer (:math:`w_{liq,\, i}` ) within physical constraints of diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index e48ba34933..ca5fa9f660 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -19,6 +19,8 @@ area indices (section 4.1). Canopy conductance is where :math:`r_{b}` is the leaf boundary layer resistance (section 5.3). The equation set is described by Bonan et al. (2011). +.. _Stomatal resistance: + Stomatal resistance ----------------------- @@ -65,65 +67,69 @@ s m\ :sup:`2` :math:`\mu` mol\ :sub:`-1` to s m\ :sup:`-1` as: kmol\ :sup:`-1`) (Table 2.6) and :math:`\theta _{atm}` is the atmospheric potential temperature (K). -Table 8.1. Plant functional type (PFT) photosynthetic parameters. - -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| PFT | m | :math:`\alpha` | :math:`CN_{L}` | :math:`F_{LNR}` | :math:`SLA_{0}` | :math:`\psi _{o}` | :math:`\psi _{c}` | :math:`{V}_{cmax25}` | -+==================================+=====+====================+===================+====================+====================+======================+======================+===========================+ -| NET Temperate | 9 | – | 35 | 0.0509 | 0.010 | -66000 | -255000 | 62.5 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| NET Boreal | 9 | – | 40 | 0.0466 | 0.008 | -66000 | -255000 | 62.6 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| NDT Boreal | 9 | – | 25 | 0.0546 | 0.024 | -66000 | -255000 | 39.1 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| BET Tropical | 9 | – | 30 | 0.0461 | 0.012 | -66000 | -255000 | 55.0 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| BET temperate | 9 | – | 30 | 0.0515 | 0.012 | -66000 | -255000 | 61.5 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| BDT tropical | 9 | – | 25 | 0.0716 | 0.030 | -35000 | -224000 | 41.0 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| BDT temperate | 9 | – | 25 | 0.1007 | 0.030 | -35000 | -224000 | 57.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| BDT boreal | 9 | – | 25 | 0.1007 | 0.030 | -35000 | -224000 | 57.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| BES temperate | 9 | – | 30 | 0.0517 | 0.012 | -83000 | -428000 | 61.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| BDS temperate | 9 | – | 25 | 0.0943 | 0.030 | -83000 | -428000 | 54.0 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| BDS boreal | 9 | – | 25 | 0.0943 | 0.030 | -83000 | -428000 | 54.0 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| C\ :sub:`3` arctic grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| C\ :sub:`3` grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| C\ :sub:`4` grass | 4 | 0.05 | 25 | 0.0900 | 0.030 | -74000 | -275000 | 51.6 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Crop R | 9 | – | 25 | 0.1758 | 0.030 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Crop I | 9 | – | 25 | 0.1758 | 0.030 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Corn R | 4 | 0.05 | 25 | 0.2930 | 0.050 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Corn I | 4 | 0.05 | 25 | 0.2930 | 0.050 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Temp Cereal R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Temp Cereal I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Winter Cereal R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Winter Cereal I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Soybean R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ -| Soybean I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | -+----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ +.. _Table Plant functional type (PFT) photosynthetic parameters: + +.. table:: Plant functional type (PFT) photosynthetic parameters. + + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | PFT | m | :math:`\alpha` | :math:`CN_{L}` | :math:`F_{LNR}` | :math:`SLA_{0}` | :math:`\psi _{o}` | :math:`\psi _{c}` | :math:`{V}_{cmax25}` | + +==================================+=====+====================+===================+====================+====================+======================+======================+===========================+ + | NET Temperate | 9 | – | 35 | 0.0509 | 0.010 | -66000 | -255000 | 62.5 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | NET Boreal | 9 | – | 40 | 0.0466 | 0.008 | -66000 | -255000 | 62.6 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | NDT Boreal | 9 | – | 25 | 0.0546 | 0.024 | -66000 | -255000 | 39.1 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | BET Tropical | 9 | – | 30 | 0.0461 | 0.012 | -66000 | -255000 | 55.0 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | BET temperate | 9 | – | 30 | 0.0515 | 0.012 | -66000 | -255000 | 61.5 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | BDT tropical | 9 | – | 25 | 0.0716 | 0.030 | -35000 | -224000 | 41.0 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | BDT temperate | 9 | – | 25 | 0.1007 | 0.030 | -35000 | -224000 | 57.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | BDT boreal | 9 | – | 25 | 0.1007 | 0.030 | -35000 | -224000 | 57.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | BES temperate | 9 | – | 30 | 0.0517 | 0.012 | -83000 | -428000 | 61.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | BDS temperate | 9 | – | 25 | 0.0943 | 0.030 | -83000 | -428000 | 54.0 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | BDS boreal | 9 | – | 25 | 0.0943 | 0.030 | -83000 | -428000 | 54.0 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | C\ :sub:`3` arctic grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | C\ :sub:`3` grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | C\ :sub:`4` grass | 4 | 0.05 | 25 | 0.0900 | 0.030 | -74000 | -275000 | 51.6 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Crop R | 9 | – | 25 | 0.1758 | 0.030 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Crop I | 9 | – | 25 | 0.1758 | 0.030 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Corn R | 4 | 0.05 | 25 | 0.2930 | 0.050 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Corn I | 4 | 0.05 | 25 | 0.2930 | 0.050 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Temp Cereal R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Temp Cereal I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Winter Cereal R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Winter Cereal I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Soybean R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ + | Soybean I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | + +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ :math:`\alpha` (mol CO\ :sub:`2` mol\ :sup:`-1` photon); :math:`CN_{L}` (g C g\ :sup:`-1` N); :math:`F_{LNR}` (g N Rubisco g\ :sup:`-1` N); :math:`SLA_{0}` (m\ :sup:`2` g\ :sup:`-1` C); :math:`\psi _{o}` and :math:`\psi _{c}` (mm); V\ :sub:`cmax25` (:math:`\mu`\ mol m\ :sup:`-2` s\ :sup:`-1`, calculated from equation for canopy top). +.. _Photosynthesis: + Photosynthesis ------------------ @@ -309,30 +315,32 @@ K\ :sup:`-1` and :math:`s_{6} =328.15`\ K, and with :math:`Q_{10} =2`. -Table 8.2. Temperature dependence parameters for C3 photosynthesis. - -+------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -| Parameter | :math:`\Delta H_{a}` (J mol\ :sup:`-1`) | :math:`\Delta H_{d}` (J mol\ :sup:`-1`) | :math:`\Delta S` (J mol\ :sup:`-1` K\ :sup:`-1`) | -+========================+=================================================================+=================================================================+==============================================================================================+ -| :math:`V_{c\max }` | 65330 | 149250 | 485 | -+------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -| :math:`J_{\max }` | 43540 | 152040 | 495 | -+------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -| :math:`T_{p}` | 65330 | 149250 | 485 | -+------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -| :math:`R_{d}` | 46390 | 150650 | 490 | -+------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -| :math:`K_{c}` | 79430 | – | – | -+------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -| :math:`K_{o}` | 36380 | – | – | -+------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -| :math:`\Gamma _{\*}` | 37830 | – | – | -+------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - -The parameters in Table 8.2 do not allow for temperature acclimation of -photosynthesis. In the model, acclimation is implemented as in Kattge -and Knorr (2007). In this parameterization, :math:`V_{c\max }` and -:math:`J_{\max }` vary with the plant growth temperature. This is +.. _Table Temperature dependence parameters for C3 photosynthesis: + +.. table:: Temperature dependence parameters for C3 photosynthesis. + + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ + | Parameter | :math:`\Delta H_{a}` (J mol\ :sup:`-1`) | :math:`\Delta H_{d}` (J mol\ :sup:`-1`) | :math:`\Delta S` (J mol\ :sup:`-1` K\ :sup:`-1`) | + +========================+=================================================================+=================================================================+==============================================================================================+ + | :math:`V_{c\max }` | 65330 | 149250 | 485 | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ + | :math:`J_{\max }` | 43540 | 152040 | 495 | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ + | :math:`T_{p}` | 65330 | 149250 | 485 | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ + | :math:`R_{d}` | 46390 | 150650 | 490 | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ + | :math:`K_{c}` | 79430 | – | – | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ + | :math:`K_{o}` | 36380 | – | – | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ + | :math:`\Gamma _{\*}` | 37830 | – | – | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ + +The parameters in numref:`Table Temperature dependence parameters for C3 photosynthesis` +do not allow for temperature acclimation of photosynthesis. In the model, acclimation is +implemented as in :ref:`Kattge and Knorr (2007) `. In this parameterization, +:math:`V_{c\max }` and :math:`J_{\max }` vary with the plant growth temperature. This is achieved by allowing :math:`\Delta S`\ to vary with growth temperature according to @@ -358,6 +366,8 @@ temperature (K) and :math:`T_{f}` is the freezing point of water (K). For lack of data, :math:`T_{p}` acclimates similar to V :sub:`cmax` . Acclimation is restricted over the temperature range :math:`T_{10} -T_{f} \ge 11`\ :sup:`o`\ C and :math:`T_{10} -T_{f} \le 35`\ :sup:`o`\ C. +.. _V\ :sub:`cmax25` and Canopy scaling: + V\ :sub:`cmax25` and Canopy scaling -------------------------------------------- @@ -476,6 +486,8 @@ orbital geometry (:math:`\pm`\ 23.4667º [:math:`\pm`\ 0.409571 radians], positive for Northern Hemisphere latitudes and negative for Southern Hemisphere). +.. _Soil water stress: + Soil water stress --------------------- @@ -551,62 +563,66 @@ functional type where :math:`z_{h,\, i}` (m) is the depth from the soil surface to the interface between layers :math:`i` and :math:`i+1` (:math:`z_{h,\, 0}` , the soil surface) (section 6.1), and :math:`r_{a}` and :math:`r_{b}` -are plant-dependent root distribution parameters adopted from Zeng -(2001) (Table 8.3). - -Table 8.3. Plant functional type root distribution parameters. - -+----------------------------------+------------------+------------------+ -| Plant Functional Type | :math:`r_{a}` | :math:`r_{b}` | -+==================================+==================+==================+ -| NET Temperate | 7.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| NET Boreal | 7.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| NDT Boreal | 7.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| BET Tropical | 7.0 | 1.0 | -+----------------------------------+------------------+------------------+ -| BET temperate | 7.0 | 1.0 | -+----------------------------------+------------------+------------------+ -| BDT tropical | 6.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| BDT temperate | 6.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| BDT boreal | 6.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| BES temperate | 7.0 | 1.5 | -+----------------------------------+------------------+------------------+ -| BDS temperate | 7.0 | 1.5 | -+----------------------------------+------------------+------------------+ -| BDS boreal | 7.0 | 1.5 | -+----------------------------------+------------------+------------------+ -| C\ :sub:`3` grass arctic | 11.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| C\ :sub:`3` grass | 11.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| C\ :sub:`4` grass | 11.0 | 2.0 | -+----------------------------------+------------------+------------------+ -| Crop R | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Crop I | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Corn R | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Corn I | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Temp Cereal R | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Temp Cereal I | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Winter Cereal R | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Winter Cereal I | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Soybean R | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ -| Soybean I | 6.0 | 3.0 | -+----------------------------------+------------------+------------------+ +are plant-dependent root distribution parameters adopted from :ref:`Zeng (2001) ` +(:numref:`Table Plant functional type root distribution parameters`). + +.. _Table Plant functional type root distribution parameters: + +.. table:: Plant functional type root distribution parameters + + +----------------------------------+------------------+------------------+ + | Plant Functional Type | :math:`r_{a}` | :math:`r_{b}` | + +==================================+==================+==================+ + | NET Temperate | 7.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | NET Boreal | 7.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | NDT Boreal | 7.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | BET Tropical | 7.0 | 1.0 | + +----------------------------------+------------------+------------------+ + | BET temperate | 7.0 | 1.0 | + +----------------------------------+------------------+------------------+ + | BDT tropical | 6.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | BDT temperate | 6.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | BDT boreal | 6.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | BES temperate | 7.0 | 1.5 | + +----------------------------------+------------------+------------------+ + | BDS temperate | 7.0 | 1.5 | + +----------------------------------+------------------+------------------+ + | BDS boreal | 7.0 | 1.5 | + +----------------------------------+------------------+------------------+ + | C\ :sub:`3` grass arctic | 11.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | C\ :sub:`3` grass | 11.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | C\ :sub:`4` grass | 11.0 | 2.0 | + +----------------------------------+------------------+------------------+ + | Crop R | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Crop I | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Corn R | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Corn I | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Temp Cereal R | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Temp Cereal I | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Winter Cereal R | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Winter Cereal I | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Soybean R | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + | Soybean I | 6.0 | 3.0 | + +----------------------------------+------------------+------------------+ + +.. _Numerical implementation photosynthesis: Numerical implementation ---------------------------- diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 4b81731fb0..3e52821ef7 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -52,7 +52,7 @@ Arah, J. and Vinten, A., 1995. Simplified models of anoxia and denitrification in aggregated and simple-structured soils. European Journal of Soil Science 46:507-517. -.. _Arendt, A., et al. 2012. Randolph Glacier Inventory: A Dataset of Global +.. _Arendtetal2012: Arendt, A., et al. 2012. Randolph Glacier Inventory: A Dataset of Global Glacier Outlines Version: 1.0, Global Land Ice Measurements from Space, @@ -344,6 +344,8 @@ correspond with changes in labile organic C fractions in soil amended with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): 453-462. +.. _deVries1963: + de Vries, D.A. 1963. Thermal Properties of Soils. In: W.R. van Wijk (editor) Physics of the Plant Environment. North-Holland, Amsterdam. @@ -1692,6 +1694,17 @@ Swenson, S.C. and Lawrence, D.M. 2012. A New Fractional Snow Covered Area Parameterization for the Community Land Model and its Effect on the Surface Energy Balance. JGR, 117, D21107. DOI:10.1029/2012JD018178. +.. _SwensonLawrence2014: +Swenson, S.C., and D. M. Lawrence. 2014. Assessing a dry surface +layer-based soil resistance parameterization for the Community Land Model +using GRACE and FLUXNET-MTE data. JGR, 119, 10, 299–10,312, +DOI:10.1002/2014JD022314. + +.. _SwensonLawrence2015: +Swenson, S.C., and D. M. Lawrence. 2015. A GRACE-based assessment of +interannual groundwater dynamics in the Community Land Model. WRR, 51, +doi:10.1002/2015WR017582. + .. _TaWeiland1992: Ta, C.T. and Weiland, R.T. 1992. Nitrogen partitioning in maize during @@ -1920,7 +1933,7 @@ hydrology parameterization with subgrid variability for general circulation models. J. Geophys. Res. 97(D3):2717–2728. DOI:10.1029/91JD01786. -.. _World Bank2004: +.. _WorldBank2004: World Bank, 2004. World development indicators 2004, Oxford University Press, New York, 416 pp. diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index f033832ceb..dbe949bd34 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -103,7 +103,11 @@ The conservation equation for mass of ice in snow layers is .. math:: :label: 8.17) - \frac{\partial w_{ice,\, i} }{\partial t} =\left\{\begin{array}{l} {f_{sno} q_{ice,\, i-1} -\frac{\left(\Delta w_{ice,\, i} \right)_{p} }{\Delta t} \qquad i=snl+1} \\ {-\frac{\left(\Delta w_{ice,\, i} \right)_{p} }{\Delta t} \qquad i=snl+2,\ldots ,0} \end{array}\right\} + \frac{\partial w_{ice,\, i} }{\partial t} = + \left\{\begin{array}{lr} + f_{sno} \ q_{ice,\, i-1} -\frac{\left(\Delta w_{ice,\, i} \right)_{p} }{\Delta t} & \qquad i=snl+1 \\ + -\frac{\left(\Delta w_{ice,\, i} \right)_{p} }{\Delta t} & \qquad i=snl+2,\ldots ,0 + \end{array}\right\} where :math:`q_{ice,\, i-1}` is the rate of ice accumulation from precipitation or frost or the rate of ice loss from sublimation (kg @@ -143,7 +147,12 @@ m\ :sup:`-3`) (:ref:`Anderson (1976) `) .. math:: :label: 8.21) - \rho _{sno} =\left\{\begin{array}{l} {50+1.7\left(17\right)^{1.5} \qquad T_{atm} >T_{f} +2} \\ {50+1.7\left(T_{atm} -T_{f} +15\right)^{1.5} \qquad T_{f} -15T_{f} +2 \ \\ + 50+1.7 \left(T_{atm} -T_{f} + 15\right)^{1.5} & \qquad T_{f} - 15 < T_{atm} \le T_{f} + 2 \ \\ + 50 &\qquad T_{atm} \le T_{f} - 15 + \end{array}\right\} where :math:`T_{atm}` is the atmospheric temperature (K), and :math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). The diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst index c1971be79a..083c6b651e 100644 --- a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst @@ -46,82 +46,17 @@ surface water temperatures for a fifteen-layer soil column with up to five overlying layers of snow and a single surface water layer with the boundary conditions of :math:`h` as the heat flux into the top soil, snow, and surface water layers from the overlying atmosphere (section -6.1) and zero heat flux at the bottom of the soil column. The -temperature profile is calculated first without phase change and then -readjusted for phase change (section 6.2). +:numref:`Numerical Solution Temperature`) and zero heat flux at the bottom +of the soil column. The temperature profile is calculated first without +phase change and then readjusted for phase change (section :numref:`Phase Change`). .. _Numerical Solution Temperature: Numerical Solution ---------------------- -The soil column is discretized into fifteen layers (Table 6.1) where the -depth of soil layer :math:`i`, or node depth, :math:`z_{i}` (m), is - -.. math:: - :label: ZEqnNum185766 - - z_{i} =f_{s} \left\{\exp \left[0.5\left(i-0.5\right)\right]-1\right\} - -where :math:`f_{s} =0.025` is a scaling factor. The thickness of each -layer :math:`\Delta z_{i}` (m) is - -.. math:: - :label: 6.6) - - \Delta z_{i} =\left\{\begin{array}{l} {0.5\left(z_{1} +z_{2} \right)\qquad i=1} \\ {0.5\left(z_{i+1} -z_{i-1} \right)\qquad i=2,3,\ldots ,N_{levgrnd} -1} \\ {z_{N} -z_{N-1} \qquad i=N_{levgrnd} } \end{array}\right\} - -where :math:`N_{levgrnd} =15` is the number of soil layers. The depths -at the layer interfaces :math:`z_{h,\, i}` (m) are - -.. math:: - :label: 6.7) - - z_{h,\, i} =\left\{\begin{array}{l} {0.5\left(z_{i} +z_{i+1} \right)\qquad i=1,2,\ldots ,N_{levgrnd} -1} \\ {z_{N_{levgrnd} } +0.5\Delta z_{N_{levgrnd} } \qquad i=N_{levgrnd} } \end{array}\right\}. - -The exponential form of equation is to obtain more soil layers near the -soil surface where the soil water gradient is generally strong (section -7.4). - -Table 6.1. Soil layer structure. - -Layer node depth (:math:`z_{i}` ), thickness (:math:`\Delta z_{i}` ), -and depth at layer interface (:math:`z_{h,\, i}` ) for fifteen-layer -soil column. All in meters. - -+---------------+------------------+-------------------------+-----------------------+ -| Layer | :math:`z_{i}` | :math:`\Delta z_{i}` | :math:`z_{h,\, i}` | -+===============+==================+=========================+=======================+ -| 1 (top) | 0.0071 | 0.0175 | 0.0175 | -+---------------+------------------+-------------------------+-----------------------+ -| 2 | 0.0279 | 0.0276 | 0.0451 | -+---------------+------------------+-------------------------+-----------------------+ -| 3 | 0.0623 | 0.0455 | 0.0906 | -+---------------+------------------+-------------------------+-----------------------+ -| 4 | 0.1189 | 0.0750 | 0.1655 | -+---------------+------------------+-------------------------+-----------------------+ -| 5 | 0.2122 | 0.1236 | 0.2891 | -+---------------+------------------+-------------------------+-----------------------+ -| 6 | 0.3661 | 0.2038 | 0.4929 | -+---------------+------------------+-------------------------+-----------------------+ -| 7 | 0.6198 | 0.3360 | 0.8289 | -+---------------+------------------+-------------------------+-----------------------+ -| 8 | 1.0380 | 0.5539 | 1.3828 | -+---------------+------------------+-------------------------+-----------------------+ -| 9 | 1.7276 | 0.9133 | 2.2961 | -+---------------+------------------+-------------------------+-----------------------+ -| 10 | 2.8646 | 1.5058 | 3.8019 | -+---------------+------------------+-------------------------+-----------------------+ -| 11 | 4.7392 | 2.4826 | 6.2845 | -+---------------+------------------+-------------------------+-----------------------+ -| 12 | 7.8298 | 4.0931 | 10.3775 | -+---------------+------------------+-------------------------+-----------------------+ -| 13 | 12.9253 | 6.7484 | 17.1259 | -+---------------+------------------+-------------------------+-----------------------+ -| 14 | 21.3265 | 11.1262 | 28.2520 | -+---------------+------------------+-------------------------+-----------------------+ -| 15 (bottom) | 35.1776 | 13.8512 | 42.1032 | -+---------------+------------------+-------------------------+-----------------------+ +The soil column is discretized into 25 layers (section :numref:`Vertical Discretization`) +where :math:`N_{levgrnd} = 25` is the number of soil layers (:numref:`Table Soil layer structure`). The overlying snow pack is modeled with up to five layers depending on the total snow depth. The layers from top to bottom are indexed in the @@ -209,9 +144,6 @@ equals the heat flux from the interface to :math:`i+1` (depth where :math:`T_{m}` is the temperature at the interface of layers :math:`i` and :math:`i+1`. -Figure 6.1. Schematic diagram of numerical scheme used to solve for soil -temperature. - Shown are three soil layers, :math:`i-1`, :math:`i`, and :math:`i+1`. The thermal conductivity :math:`\lambda` , specific heat capacity :math:`c`, and temperature :math:`T` are defined at the layer node depth @@ -222,8 +154,11 @@ interface of two layers :math:`z_{h}` . The layer thickness is :math:`\Delta z`. The heat fluxes :math:`F_{i-1}` and :math:`F_{i}` are defined as positive upwards. -.. image:: image1.png +.. _Figure Soil Temperature Schematic: +.. figure:: image1.png + + Schematic diagram of numerical scheme used to solve for soil temperature. The energy balance for the :math:`i^{th}` layer is @@ -769,23 +704,31 @@ cool the snow layer. Soil and Snow Thermal Properties ------------------------------------ -The thermal and hydraulic (section 6.3 and 7.4.1) properties of the soil -are assumed to be a weighted combination of the mineral and organic -properties of the soil (Lawrence and Slater 2008). The soil layer -organic matter fraction :math:`f_{om,i}` is +The thermal properties of the soil are assumed to be a weighted combination of +the mineral and organic properties of the soil +(:ref:`Lawrence and Slater 2008 `). +The soil layer organic matter fraction :math:`f_{om,i}` is .. math:: :label: 6.77) f_{om,i} =\rho _{om,i} /\rho _{om,\max } . -Soil thermal conductivity :math:`\lambda _{i}` (W m\ :sup:`-1` -K\ :sup:`-1`) is from Farouki (1981) +Soil thermal conductivity :math:`\lambda _{i}` (W m\ :sup:`-1` K\ :sup:`-1`) +is from :ref:`Farouki (1981) ` .. math:: :label: 6.78) - \begin{array}{l} {\lambda _{i} =\left\{\begin{array}{l} {K_{e,\, i} \lambda _{sat,\, i} +\left(1-K_{e,\, i} \right)\lambda _{dry,\, i} \qquad S_{r,\, i} >1\times 10^{-7} } \\ {\lambda _{dry,\, i} \qquad S_{r,\, i} \le 1\times 10^{-7} } \end{array}\right\}\qquad i=1,\ldots ,N_{levsoi} } \\ {\lambda _{i} =\lambda _{bedrock} \qquad i=N_{levsoi} +1,\ldots N_{levgrnd} } \end{array} + \begin{array}{lr} + \lambda _{i} = \left\{ + \begin{array}{lr} + K_{e,\, i} \lambda _{sat,\, i} +\left(1-K_{e,\, i} \right)\lambda _{dry,\, i} &\qquad S_{r,\, i} > 1\times 10^{-7} \\ + \lambda _{dry,\, i} &\qquad S_{r,\, i} \le 1\times 10^{-7} + \end{array}\right\} &\qquad i=1,\ldots ,N_{levsoi} \\ + + \lambda _{i} =\lambda _{bedrock} &\qquad i=N_{levsoi} +1,\ldots N_{levgrnd} + \end{array} where :math:`\lambda _{sat,\, i}` is the saturated thermal conductivity, :math:`\lambda _{dry,\, i}` is the dry thermal @@ -793,8 +736,8 @@ conductivity, :math:`K_{e,\, i}` is the Kersten number, :math:`S_{r,\, i}` is the wetness of the soil with respect to saturation, and :math:`\lambda _{bedrock} =3` W m\ :sup:`-1` K\ :sup:`-1` is the thermal conductivity assumed for the deep -ground layers (typical of saturated granitic rock; Clauser and Huenges, -1995). For glaciers and wetlands, +ground layers (typical of saturated granitic rock; +:ref:`Clauser and Huenges 1995 `). For glaciers and wetlands, .. math:: :label: 6.79) @@ -830,8 +773,8 @@ where the mineral soil solid thermal conductivity \lambda _{s,\, \min ,i} =\frac{8.80{\rm \; }\left(\% sand\right)_{i} +{\rm 2.92\; }\left(\% clay\right)_{i} }{\left(\% sand\right)_{i} +\left(\% clay\right)_{i} } , and :math:`\lambda _{s,om} =0.25`\ W m\ :sup:`-1` -K\ :sup:`-1` (Farouki, 1981). :math:`\theta _{sat,\, i}` is the -volumetric water content at saturation (porosity) (section 7.4.1). +K\ :sup:`-1` (:ref:`Farouki 1981 `). :math:`\theta _{sat,\, i}` is the +volumetric water content at saturation (porosity) (section :numref:`Hydraulic Properties`). The thermal conductivity of dry soil is @@ -852,14 +795,18 @@ m\ :sup:`-3`) as \lambda _{dry,\, \min ,i} =\frac{0.135\rho _{d,\, i} +64.7}{2700-0.947\rho _{d,\, i} } and :math:`\lambda _{dry,om} =0.05` W m\ :sup:`-1` -K\ :sup:`-1` (Farouki, 1981) is the dry thermal conductivity of +K\ :sup:`-1` (:ref:`Farouki 1981 `) is the dry thermal conductivity of organic matter. The Kersten number :math:`K_{e,\, i}` is a function of the degree of saturation :math:`S_{r}` and phase of water .. math:: :label: 6.85) - K_{e,\, i} =\left\{\begin{array}{l} {\log \left(S_{r,\, i} \right)+1\ge 0\qquad T_{i} \ge T_{f} } \\ {S_{r,\, i} \qquad T_{i} ` .. math:: :label: 6.87) \lambda _{i} =\lambda _{air} +\left(7.75\times 10^{-5} \rho _{sno,\, i} +1.105\times 10^{-6} \rho _{sno,\, i}^{2} \right)\left(\lambda _{ice} -\lambda _{air} \right) -where :math:`\lambda _{air}` is the thermal conductivity of air (Table -2.6) and :math:`\rho _{sno,\, i}` is the bulk density of snow (kg -m\ :sup:`-3`) +where :math:`\lambda _{air}` is the thermal conductivity of air (:numref:`Table Physical Constants`) +and :math:`\rho _{sno,\, i}` is the bulk density of snow (kg m\ :sup:`-3`) .. math:: :label: 6.88) \rho _{sno,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{\Delta z_{i} } . -The volumetric heat capacity :math:`c_{i}` (J m\ :sup:`-3` -K\ :sup:`-1`) for soil is from de Vries (1963) and depends on the +The volumetric heat capacity :math:`c_{i}` (J m\ :sup:`-3` K\ :sup:`-1`) for +soil is from :ref:`de Vries (1963) ` and depends on the heat capacities of the soil solid, liquid water, and ice constituents .. math:: @@ -896,7 +842,7 @@ heat capacities of the soil solid, liquid water, and ice constituents where :math:`C_{liq}` and :math:`C_{ice}` are the specific heat capacities (J kg\ :sup:`-1` K\ :sup:`-1`) of liquid water -and ice, respectively (Table 2.6). The heat capacity of soil solids +and ice, respectively (:numref:`Table Physical Constants`). The heat capacity of soil solids :math:`c_{s,i}` \ (J m\ :sup:`-3` K\ :sup:`-1`) is .. math:: @@ -910,12 +856,15 @@ where the heat capacity of mineral soil solids .. math:: :label: 6.91) - \begin{array}{l} {c_{s,\min ,\, i} =\left(\frac{2.128{\rm \; }\left(\% sand\right)_{i} +{\rm 2.385\; }\left(\% clay\right)_{i} }{\left(\% sand\right)_{i} +\left(\% clay\right)_{i} } \right)\times 10^{6} \qquad i=1,\ldots ,N_{levsoi} } \\ {c_{s,\, \min ,i} =c_{s,\, bedrock} \qquad i=N_{levsoi} +1,\ldots ,N_{levgrnd} } \end{array} + \begin{array}{lr} + c_{s,\min ,\, i} =\left(\frac{2.128{\rm \; }\left(\% sand\right)_{i} +{\rm 2.385\; }\left(\% clay\right)_{i} }{\left(\% sand\right)_{i} +\left(\% clay\right)_{i} } \right)\times 10^{6} &\qquad i=1,\ldots ,N_{levsoi} \\ + c_{s,\, \min ,i} =c_{s,\, bedrock} &\qquad i=N_{levsoi} +1,\ldots ,N_{levgrnd} + \end{array} where :math:`c_{s,bedrock} =2\times 10^{6}` J m\ :sup:`-3` K\ :sup:`-1` is the heat capacity of bedrock and :math:`c_{s,om} =2.5\times 10^{6}` \ J m\ :sup:`-3` -K\ :sup:`-1` (Farouki, 1981) is the heat capacity of organic +K\ :sup:`-1` (ref:`Farouki 1981 `) is the heat capacity of organic matter. For glaciers, wetlands, and snow .. math:: diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index f2d54987f9..82a25eba77 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -420,71 +420,75 @@ for grasslands and crops from full optical range spectra of measured optical properties (Asner et al. 1998). Optical properties for intercepted snow (Table 3.2) are from Sellers et al. (1986). -Table 3.1. Plant functional type optical properties - -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Plant Functional Type | :math:`\chi _{L}` | :math:`\alpha _{vis}^{leaf}` | :math:`\alpha _{nir}^{leaf}` | :math:`\alpha _{vis}^{stem}` | :math:`\alpha _{nir}^{stem}` | :math:`\tau _{vis}^{leaf}` | :math:`\tau _{nir}^{leaf}` | :math:`\tau _{vis}^{stem}` | :math:`\tau _{nir}^{stem}` | -+==================================+======================+=================================+=================================+=================================+=================================+===============================+===============================+===============================+===============================+ -| NET Temperate | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| NET Boreal | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| NDT Boreal | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| BET Tropical | 0.10 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| BET temperate | 0.10 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| BDT tropical | 0.01 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| BDT temperate | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| BDT boreal | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| BES temperate | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| BDS temperate | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| BDS boreal | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| C\ :sub:`3` arctic grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| C\ :sub:`3` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| C\ :sub:`4` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Crop R | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Crop I | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Corn R | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Corn I | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Temp Cereal R | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Temp Cereal I | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Winter Cereal R | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Winter Cereal I | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Soybean R | -0.5 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ -| Soybean I | -0.5 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | -+----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - -Table 3.2. Intercepted snow optical properties - -+-----------------------------+-------+-------+ -| Parameter | vis | nir | -+=============================+=======+=======+ -| :math:`\omega ^{sno}` | 0.8 | 0.4 | -+-----------------------------+-------+-------+ -| :math:`\beta ^{sno}` | 0.5 | 0.5 | -+-----------------------------+-------+-------+ -| :math:`\beta _{0}^{sno}` | 0.5 | 0.5 | -+-----------------------------+-------+-------+ +.. _Table Plant functional type optical properties: + +.. table:: Plant functional type optical properties + + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Plant Functional Type | :math:`\chi _{L}` | :math:`\alpha _{vis}^{leaf}` | :math:`\alpha _{nir}^{leaf}` | :math:`\alpha _{vis}^{stem}` | :math:`\alpha _{nir}^{stem}` | :math:`\tau _{vis}^{leaf}` | :math:`\tau _{nir}^{leaf}` | :math:`\tau _{vis}^{stem}` | :math:`\tau _{nir}^{stem}` | + +==================================+======================+=================================+=================================+=================================+=================================+===============================+===============================+===============================+===============================+ + | NET Temperate | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | NET Boreal | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | NDT Boreal | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | BET Tropical | 0.10 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | BET temperate | 0.10 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | BDT tropical | 0.01 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | BDT temperate | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | BDT boreal | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | BES temperate | 0.01 | 0.07 | 0.35 | 0.16 | 0.39 | 0.05 | 0.10 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | BDS temperate | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | BDS boreal | 0.25 | 0.10 | 0.45 | 0.16 | 0.39 | 0.05 | 0.25 | 0.001 | 0.001 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | C\ :sub:`3` arctic grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | C\ :sub:`3` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | C\ :sub:`4` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Crop R | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Crop I | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Corn R | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Corn I | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Temp Cereal R | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Temp Cereal I | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Winter Cereal R | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Winter Cereal I | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Soybean R | -0.5 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Soybean I | -0.5 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + +.. _Table Intercepted snow optical properties: + +.. table:: Intercepted snow optical properties + + +-----------------------------+-------+-------+ + | Parameter | vis | nir | + +=============================+=======+=======+ + | :math:`\omega ^{sno}` | 0.8 | 0.4 | + +-----------------------------+-------+-------+ + | :math:`\beta ^{sno}` | 0.5 | 0.5 | + +-----------------------------+-------+-------+ + | :math:`\beta _{0}^{sno}` | 0.5 | 0.5 | + +-----------------------------+-------+-------+ .. _Ground Albedos: From 500487cd7a735c37f09562a142c91c10e5c10397 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 24 May 2017 09:06:54 -0600 Subject: [PATCH 0017/1973] revise irrigation section --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 136 ++++-- .../CLM50_Tech_Note_Photosynthesis.rst | 5 +- .../References/CLM50_Tech_Note_References.rst | 6 +- .../CLM50_Tech_Note_Surface_Albedos.rst | 450 ++++++++++-------- 4 files changed, 337 insertions(+), 260 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index f0f31eac92..449341c0f9 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -443,68 +443,110 @@ The irrigation model The CLM includes the option to irrigate cropland areas that are equipped for irrigation. The application of irrigation responds dynamically to the soil moisture conditions simulated by the CLM. This irrigation -algorithm is based loosely on the implementation of Ozdogan et al. -(2010). +algorithm is based loosely on the implementation of +:ref:`Ozdogan et al. (2010) `. When irrigation is enabled, the crop areas of each grid cell are divided into irrigated and rainfed fractions according to a dataset of areas -equipped for irrigation (Portmann et al. 2010). Irrigated and rainfed -crops are placed on separate soil columns, so that irrigation is only -applied to the soil beneath irrigated crops. +equipped for irrigation (:ref:`Portmann et al. 2010 `). +Irrigated and rainfed crops are placed on separate soil columns, so that +irrigation is only applied to the soil beneath irrigated crops. In irrigated croplands, a check is made once per day to determine whether irrigation is required on that day. This check is made in the first time step after 6 AM local time. Irrigation is required if crop -leaf area :math:`>` 0, and :math:`\beta_{t} < 1`, i.e., water is limiting for photosynthesis (see section 8.4). +leaf area :math:`>` 0, and the available soil water is below a specified +threshold. -If irrigation is required, the model computes the deficit between the -current soil moisture content and a target soil moisture content; this -deficit is the amount of water that will be added through irrigation. -The target soil moisture content in each soil layer *i* -(:math:`{s}_{target,i}`, kg m\ :sup:`-2`) is a weighted -average of the minimum soil moisture content that results in no water -stress in that layer (:math:`{s}_{o,i}`, kg m\ :sup:`-2`) and -the soil moisture content at saturation in that layer (:math:`{w}_{sat,i}`, kg m\ :sup:`-2`): +The soil moisture deficit :math:`D_{irrig}` is .. math:: - :label: 25.7) - - w_{target,i} =(1-0.7)\cdot w_{o,i} +0.7\cdot w_{sat,i} - -:math:`{w}_{o,i}` is determined by inverting equation 8.19 in Oleson -et al. (2010a) to solve for the value of :math:`{s}_{i}` (soil -wetness) that makes :math:`\Psi_{i} = \Psi_{o}` (where :math:`\Psi_{i}` is -the soil water matric potential and :math:`\Psi_{o}` is -the soil water potential when stomata are fully open), and then -converting this value to units of kg m\ :sup:`-2`. -:math:`{w}_{sat,i}` is calculated simply by converting effective -porosity (section 7.4) to units of kg m\ :sup:`-2`. The value 0.7 -was determined empirically, in order to give global, annual irrigation -amounts that approximately match observed gross irrigation water use -around the year 2000 (i.e., total water withdrawals for irrigation: -:math:`\sim` 2500 – 3000 km\ :sup:`3` year\ :sup:`-1` -(Shiklomanov 2000)). The total water deficit (:math:`{w}_{deficit}`, -kg m\ :sup:`-2`) of the column is then determined by: + :label: 25.61) + + D_{irrig} = \left\{ + \begin{array}{lr} + w_{thresh} - w_{avail} &\qquad w_{thresh} > w_{avail} \\ + 0 &\qquad w_{thresh} \le w_{avail} + \end{array} \right\} + +where :math:`w_{thresh}` is the irrigation moisture threshold (mm) and +:math:`w_{avail}` is the available moisture (mm). The moisture threshold +is + +.. math:: + :label: 25.62) + + w_{thresh} = f_{thresh} \left(w_{target} - w_{wilt}\right) + w_{wilt} + +where :math:`w_{target}` is the irrigation target soil moisture (mm) + +.. math:: + :label: 25.63) + + w_{target} = \sum_{j=1}^{N_{irr}} \theta_{target} \Delta z_{j} \ , + +:math:`w_{wilt}` is the wilting point soil moisture (mm) .. math:: - :label: 25.8) + :label: 25.64) - w_{deficit} =\sum _{i}\max \left(w_{target,i} -w_{liq,i} ,0\right) + w_{wilt} = \sum_{j=1}^{N_{irr}} \theta_{wilt} \Delta z_{j} \ , -where :math:`{w}_{liq,i}` (kg m\ :sup:`-2`) is the current -soil water content of layer *i* (Chapter 7). The max function means that -a surplus in one layer cannot make up for a deficit in another layer. -The sum is taken only over soil layers that contain roots. In addition, -if the temperature of any soil layer is below freezing, then the sum -only includes layers above the top-most frozen soil layer. +and :math:`f_{thresh}` is a tuning parameter. The available moisture in +the soil is -The amount of water added to this column through irrigation is then -equal to :math:`{w}_{deficit}`. This irrigation is applied at a -constant rate over the following four hours. Irrigation water is applied +.. math:: + :label: 25.65) + + w_{avail} = \sum_{j=1}^{N_{irr}} \theta_{j} \Delta z_{j} \ , + +:math:`N_{irr}` is the index of the soil layer corresponding to a specified +depth :math:`z_{irrig}` (:numref:`Table Irrigation parameters`) and +:math:`\Delta z` is the thickness of the soil layer (section +:numref:`Vertical Discretization`). :math:`\theta_{j}` is the +volumetric soil moisture in layer :math:`j` (section :numref:`Soil Water`). +:math:`\theta_{target}` and +:math:`\theta_{wilt}` are the target and wilting point volumetric +soil moisture values, respectively, and are determined by inverting +:eq:`ZEqnNum316201` using soil matric +potential parameters :math:`\Psi_{target}` and :math:`\Psi_{wilt}` +(:numref:`Table Irrigation parameters`). After the soil moisture deficit +:math:`D_{irrig}` is calculated, irrigation in an amount equal to +:math:`\frac{D_{irrig}}{T_{irrig}}` (mm/s) is applied uniformly over +the irrigation period :math:`T_{irrig}` (s). Irrigation water is applied directly to the ground surface, bypassing canopy interception (i.e., -added to :math:`{q}_{grnd,liq}`: section 7.1). Added irrigation is -removed from total liquid runoff ( :math:`{R}_{liq}`: Chapter 11), -simulating removal from nearby rivers. +added to :math:`{q}_{grnd,liq}`: section :numref:`Canopy Water`). + +To conserve mass, irrigation is removed from river water storage (Chapter 11). +When river water storage is inadequate to meet irrigation demand, +there are two options: 1) the additional water can be removed from the +ocean model, or 2) the irrigation demand can be reduced such that +river water storage is maintained above a specified threshold. + +.. _Table Irrigation parameters: + +.. table:: Irrigation parameters + + +--------------------------------------+-------------+ + | Parameter | | + +======================================+=============+ + | :math:`f_{thresh}` | 1.0 | + +--------------------------------------+-------------+ + | :math:`z_{irrig}` (m) | 0.6 | + +--------------------------------------+-------------+ + | :math:`\Psi_{target}` (mm) | -3400 | + +--------------------------------------+-------------+ + | :math:`\Psi_{wilt}` (mm) | -150000 | + +--------------------------------------+-------------+ + +.. add a reference to surface data in chapter2 + To accomplish this we downloaded + data of percent irrigated and percent rainfed corn, soybean, and + temperate cereals (wheat, barley, and rye) (:ref:`Portmann et al. 2010 `), + available online from + *ftp://ftp.rz.uni-frankfurt.de/pub/uni-frankfurt/physische\_geographie/hydrologie/public/data/MIRCA2000/harvested\_area\_grids.* + + .. _The details about what is new in CLM4.5: @@ -525,7 +567,7 @@ exclusive in CLM4.0. In CLM4.5 we have reversed this situation. Now the irrigation model can be used only while running with CROP. To accomplish this we downloaded data of percent irrigated and percent rainfed corn, soybean, and -temperate cereals (wheat, barley, and rye) (Portmann et al. 2010), +temperate cereals (wheat, barley, and rye) (:ref:`Portmann et al. 2010 `), available online from *ftp://ftp.rz.uni-frankfurt.de/pub/uni-frankfurt/physische\_geographie/hydrologie/public/data/MIRCA2000/harvested\_area\_grids.* diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index ca5fa9f660..70fa76baf7 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -562,8 +562,9 @@ functional type where :math:`z_{h,\, i}` (m) is the depth from the soil surface to the interface between layers :math:`i` and :math:`i+1` (:math:`z_{h,\, 0}` , -the soil surface) (section 6.1), and :math:`r_{a}` and :math:`r_{b}` -are plant-dependent root distribution parameters adopted from :ref:`Zeng (2001) ` +the soil surface) (section :numref:`Vertical Discretization`), and :math:`r_{a}` +and :math:`r_{b}` are plant-dependent root distribution parameters adopted from +:ref:`Zeng (2001) ` (:numref:`Table Plant functional type root distribution parameters`). .. _Table Plant functional type root distribution parameters: diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 3e52821ef7..f884270f62 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -134,6 +134,8 @@ of hydraulic conductivity in porous media. Transport in Porous Media Beven, K.J., and Kirkby, M.J. 1979. A physically based variable contributing area model of basin hydrology. Hydrol. Sci. Bull. 24:43-69. +.. _BohrenHuffman1983: + Bohren, C. F., and Huffman, D. R. 1983. Absorption and scattering of light by small particles. John Wiley & Sons, New York, NY. @@ -1382,7 +1384,7 @@ Pollmer, W.G., Eberhard, D., Klein, D., and Dhillon, B.S. 1979. Genetic control of nitrogen uptake and translocation in maize. Crop Sci. 19:82-86. -.. _Portmann2010: +.. _Portmannetal2010: Portmann, F.T., Siebert, S., and Döll, P. 2010. MIRCA2000 - Global monthly irrigated and rainfed crop areas around the year 2000: A new @@ -1695,12 +1697,14 @@ Area Parameterization for the Community Land Model and its Effect on the Surface Energy Balance. JGR, 117, D21107. DOI:10.1029/2012JD018178. .. _SwensonLawrence2014: + Swenson, S.C., and D. M. Lawrence. 2014. Assessing a dry surface layer-based soil resistance parameterization for the Community Land Model using GRACE and FLUXNET-MTE data. JGR, 119, 10, 299–10,312, DOI:10.1002/2014JD022314. .. _SwensonLawrence2015: + Swenson, S.C., and D. M. Lawrence. 2015. A GRACE-based assessment of interannual groundwater dynamics in the Community Land Model. WRR, 51, doi:10.1002/2015WR017582. diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 82a25eba77..0cd135e220 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -9,8 +9,8 @@ Canopy Radiative Transfer ----------------------------- Radiative transfer within vegetative canopies is calculated from the -two-stream approximation of Dickinson (1983) and Sellers (1985) as -described by Bonan (1996) +two-stream approximation of :ref:`Dickinson (1983) ` and +:ref:`Sellers (1985) ` as described by :ref:`Bonan (1996) ` .. math:: :label: 3.1 @@ -33,10 +33,10 @@ stem elements in the direction :math:`\cos ^{-1} \mu` , leaf and stem area, :math:`\omega` is a scattering coefficient, :math:`\beta` and :math:`\beta _{0}` are upscatter parameters for diffuse and direct beam radiation, respectively, :math:`L` is the -exposed leaf area index (section 2.1.4), and :math:`S` is the exposed -stem area index (section 2.1.4). Given the direct beam albedo -:math:`\alpha _{g,\, \Lambda }^{\mu }` and diffuse albedo -:math:`\alpha _{g,\, \Lambda }` of the ground (section 3.2), these +exposed leaf area index , and :math:`S` is the exposed stem area index +(section :numref:`Phenology and vegetation burial by snow`). Given the +direct beam albedo :math:`\alpha _{g,\, \Lambda }^{\mu }` and diffuse albedo +:math:`\alpha _{g,\, \Lambda }` of the ground (section :numref:`Ground Albedos`), these equations are solved to calculate the fluxes, per unit incident flux, absorbed by the vegetation, reflected by the vegetation, and transmitted through the vegetation for direct and diffuse radiation and for visible @@ -45,7 +45,7 @@ through the vegetation for direct and diffuse radiation and for visible radiation is partitioned to sunlit and shaded fractions of the canopy. The optical parameters :math:`G\left(\mu \right)`, :math:`\bar{\mu }`, :math:`\omega`, :math:`\beta`, and :math:`\beta _{0}` are calculated -based on work in Sellers (1985) as follows. +based on work in :ref:`Sellers (1985) ` as follows. The relative projected area of leaves and stems in the direction :math:`\cos ^{-1} \mu` is @@ -70,10 +70,12 @@ The average inverse diffuse optical depth per unit leaf and stem area is where :math:`\mu '` is the direction of the scattered flux. -The optical parameters :math:`\omega`, :math:`\beta`, and :math:`\beta _{0}`, which vary with wavelength (:math:`\Lambda` ), are -weighted combinations of values for vegetation and snow. The model determines that snow is on the canopy if :math:`T_{v} \le T_{f}` , where -:math:`T_{v}` is the vegetation temperature (K) (Chapter 5) and :math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). In -this case, the optical parameters are +The optical parameters :math:`\omega`, :math:`\beta`, and :math:`\beta _{0}`, +which vary with wavelength (:math:`\Lambda` ), are weighted combinations of values +for vegetation and snow. The model determines that snow is on the canopy if +:math:`T_{v} \le T_{f}` , where :math:`T_{v}` is the vegetation temperature (K) (Chapter +:numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) and :math:`T_{f}` is the +freezing temperature of water (K) (:numref:`Table Physical Constants`). In this case, the optical parameters are .. math:: :label: 3.5 @@ -90,7 +92,7 @@ this case, the optical parameters are \omega _{\Lambda } \beta _{0,\, \Lambda } =\omega _{\Lambda }^{veg} \beta _{0,\, \Lambda }^{veg} \left(1-f_{wet} \right)+\omega _{\Lambda }^{sno} \beta _{0,\, \Lambda }^{sno} f_{wet} -where :math:`f_{wet}` is the wetted fraction of the canopy (section 7.1). The snow and vegetation weights are applied to the products +where :math:`f_{wet}` is the wetted fraction of the canopy (section :numref:`Canopy Water`). The snow and vegetation weights are applied to the products :math:`\omega _{\Lambda } \beta _{\Lambda }` and :math:`\omega _{\Lambda } \beta _{0,\, \Lambda }` because these products are used in the two-stream equations. If there is no snow on the canopy, @@ -413,12 +415,13 @@ The parameters :math:`h_{1}` –:math:`h_{10}` , :math:`\sigma` , h_{10} =\frac{-s_{1} \left(u_{2} -\bar{\mu }h\right)}{d_{2} } . -Plant functional type optical properties (Table 3.1) for trees and -shrubs are from Dorman and Sellers (1989). Leaf and stem optical +Plant functional type optical properties (:numref:`Table Plant functional type optical properties`) +for trees and shrubs are from :ref:`Dorman and Sellers (1989) `. Leaf and stem optical properties (placeVIS and NIR reflectance and transmittance) were derived for grasslands and crops from full optical range spectra of measured -optical properties (Asner et al. 1998). Optical properties for -intercepted snow (Table 3.2) are from Sellers et al. (1986). +optical properties (:ref:`Asner et al. 1998 `). Optical properties for +intercepted snow (:numref:`Table Intercepted snow optical properties`) are +:ref:`from Sellers et al. (1986) `. .. _Table Plant functional type optical properties: @@ -495,7 +498,8 @@ intercepted snow (Table 3.2) are from Sellers et al. (1986). Ground Albedos ------------------ -The overall direct beam :math:`\alpha _{g,\, \Lambda }^{\mu }` and diffuse :math:`\alpha _{g,\, \Lambda }` ground albedos are weighted +The overall direct beam :math:`\alpha _{g,\, \Lambda }^{\mu }` and diffuse +:math:`\alpha _{g,\, \Lambda }` ground albedos are weighted combinations of “soil” and snow albedos .. math:: @@ -508,11 +512,12 @@ combinations of “soil” and snow albedos \alpha _{g,\, \Lambda } =\alpha _{soi,\, \Lambda } \left(1-f_{sno} \right)+\alpha _{sno,\, \Lambda } f_{sno} -where :math:`f_{sno}` is the fraction of the ground covered with snow (section 7.2.1). +where :math:`f_{sno}` is the fraction of the ground covered with snow +(section :numref:`Snow Covered Area Fraction`). :math:`\alpha _{soi,\, \Lambda }^{\mu }` and :math:`\alpha _{soi,\, \Lambda }` vary with glacier, lake, wetland, and -soil surfaces. Glacier albedos are from Paterson (1994) +soil surfaces. Glacier albedos are from :ref:`Paterson (1994) ` .. math:: \alpha _{soi,\, vis}^{\mu } =\alpha _{soi,\, vis} =0.6 @@ -526,13 +531,13 @@ zenith angle :math:`\mu` \alpha _{soi,\, \Lambda }^{\mu } =\alpha _{soi,\, \Lambda } =0.05\left(\mu +0.15\right)^{-1} . -Frozen lake and wetland albedos are from NCAR LSM (Bonan 1996) +Frozen lake and wetland albedos are from NCAR LSM (:ref:`Bonan 1996 `) .. math:: \alpha _{soi,\, vis}^{\mu } =\alpha _{soi,\, vis} =0.60 .. math:: \alpha _{soi,\, nir}^{\mu } =\alpha _{soi,\, nir} =0.40. -As in NCAR LSM (Bonan 1996), soil albedos vary with color class +As in NCAR LSM (:ref:`Bonan 1996 `), soil albedos vary with color class .. math:: :label: 3.61 @@ -540,18 +545,20 @@ As in NCAR LSM (Bonan 1996), soil albedos vary with color class \alpha _{soi,\, \Lambda }^{\mu } =\alpha _{soi,\, \Lambda } =\left(\alpha _{sat,\, \Lambda } +\Delta \right)\le \alpha _{dry,\, \Lambda } where :math:`\Delta` depends on the volumetric water content of the -first soil layer :math:`\theta _{1}` (section 7.4) as +first soil layer :math:`\theta _{1}` (section :numref:`Soil Water`) as :math:`\Delta =0.11-0.40\theta _{1} >0`, and :math:`\alpha _{sat,\, \Lambda }` and :math:`\alpha _{dry,\, \Lambda }` are albedos for saturated and dry -soil color classes (Table 3.3). +soil color classes (:numref:`Table Dry and saturated soil albedos`). CLM soil colors are prescribed so that they best reproduce observed MODIS local solar noon surface albedo values at the CLM grid cell -following the methods of Lawrence and Chase (2007). The soil colors are -fitted over the range of 20 soil classes shown in Table 3.3 and compared +following the methods of :ref:`Lawrence and Chase (2007) `. +The soil colors are fitted over the range of 20 soil classes shown in +:numref:`Table Dry and saturated soil albedos` and compared to the MODIS monthly local solar noon all-sky surface albedo as -described in Strahler et al. (1999) and Schaaf et al. (2002). The CLM +described in :ref:`Strahler et al. (1999) ` and +:ref:`Schaaf et al. (2002) `. The CLM two-stream radiation model was used to calculate the model equivalent surface albedo using climatological monthly soil moisture along with the vegetation parameters of PFT fraction, LAI, and SAI. The soil color that @@ -563,31 +570,33 @@ snow-free surface albedo for the year, the soil color derived from snow-affected albedo was used to give a representative soil color that included the effects of the minimum permanent snow cover. -Table 3.3. Dry and saturated soil albedos - -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| Color Class | vis | nir | vis | nir | Color Class | vis | nir | vis | nir | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 1 | 0.36 | 0.61 | 0.25 | 0.50 | 11 | 0.24 | 0.37 | 0.13 | 0.26 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 2 | 0.34 | 0.57 | 0.23 | 0.46 | 12 | 0.23 | 0.35 | 0.12 | 0.24 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 3 | 0.32 | 0.53 | 0.21 | 0.42 | 13 | 0.22 | 0.33 | 0.11 | 0.22 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 4 | 0.31 | 0.51 | 0.20 | 0.40 | 14 | 0.20 | 0.31 | 0.10 | 0.20 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 5 | 0.30 | 0.49 | 0.19 | 0.38 | 15 | 0.18 | 0.29 | 0.09 | 0.18 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 6 | 0.29 | 0.48 | 0.18 | 0.36 | 16 | 0.16 | 0.27 | 0.08 | 0.16 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 7 | 0.28 | 0.45 | 0.17 | 0.34 | 17 | 0.14 | 0.25 | 0.07 | 0.14 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 8 | 0.27 | 0.43 | 0.16 | 0.32 | 18 | 0.12 | 0.23 | 0.06 | 0.12 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 9 | 0.26 | 0.41 | 0.15 | 0.30 | 19 | 0.10 | 0.21 | 0.05 | 0.10 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ -| 10 | 0.25 | 0.39 | 0.14 | 0.28 | 20 | 0.08 | 0.16 | 0.04 | 0.08 | -+---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ +.. _Table Dry and saturated soil albedos: + +.. table:: Dry and saturated soil albedos + + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | Color Class | vis | nir | vis | nir | Color Class | vis | nir | vis | nir | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 1 | 0.36 | 0.61 | 0.25 | 0.50 | 11 | 0.24 | 0.37 | 0.13 | 0.26 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 2 | 0.34 | 0.57 | 0.23 | 0.46 | 12 | 0.23 | 0.35 | 0.12 | 0.24 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 3 | 0.32 | 0.53 | 0.21 | 0.42 | 13 | 0.22 | 0.33 | 0.11 | 0.22 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 4 | 0.31 | 0.51 | 0.20 | 0.40 | 14 | 0.20 | 0.31 | 0.10 | 0.20 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 5 | 0.30 | 0.49 | 0.19 | 0.38 | 15 | 0.18 | 0.29 | 0.09 | 0.18 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 6 | 0.29 | 0.48 | 0.18 | 0.36 | 16 | 0.16 | 0.27 | 0.08 | 0.16 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 7 | 0.28 | 0.45 | 0.17 | 0.34 | 17 | 0.14 | 0.25 | 0.07 | 0.14 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 8 | 0.27 | 0.43 | 0.16 | 0.32 | 18 | 0.12 | 0.23 | 0.06 | 0.12 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 9 | 0.26 | 0.41 | 0.15 | 0.30 | 19 | 0.10 | 0.21 | 0.05 | 0.10 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | 10 | 0.25 | 0.39 | 0.14 | 0.28 | 20 | 0.08 | 0.16 | 0.04 | 0.08 | + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ .. _Snow Albedo: @@ -596,16 +605,18 @@ Snow Albedo Snow albedo and solar absorption within each snow layer are simulated with the Snow, Ice, and Aerosol Radiative Model (SNICAR), which -incorporates a two-stream radiative transfer solution from Toon et al. -(1989). Albedo and the vertical absorption profile depend on solar -zenith angle, albedo of the substrate underlying snow, mass +incorporates a two-stream radiative transfer solution from +:ref:`Toon et al. (1989) `. Albedo and the vertical absorption +profile depend on solar zenith angle, albedo of the substrate underlying snow, mass concentrations of atmospheric-deposited aerosols (black carbon, mineral dust, and organic carbon), and ice effective grain size (:math:`r_{e}`), which is simulated with a snow aging routine -described in section 3.2.3. Representation of impurity mass -concentrations within the snowpack is described in section 7.2.4. -Implementation of SNICAR in CLM is also described somewhat by Flanner -and Zender (2005) and Flanner et al. (2007). +described in section :numref:`Snow Aging`. Representation of impurity mass +concentrations within the snowpack is described in section +:numref:`Black and organic carbon and mineral dust within snow`. +Implementation of SNICAR in CLM is also described somewhat by +:ref:`Flanner and Zender (2005) ` and +:ref:`Flanner et al. (2007) `. The two-stream solution requires the following bulk optical properties for each snow layer and spectral band: extinction optical depth @@ -615,7 +626,7 @@ calculations are identical to snow layers applied elsewhere in CLM, except for the case when snow mass is greater than zero but no snow layers exist. When this occurs, a single radiative layer is specified to have the column snow mass and an effective grain size of freshly-fallen -snow (section 3.2.3). The bulk optical properties are weighted functions +snow (section :numref:`Snow Aging`). The bulk optical properties are weighted functions of each constituent *k*, computed for each snow layer and spectral band as @@ -634,39 +645,42 @@ as g=\frac{\sum _{1}^{k}g_{k} \omega _{k} \tau _{k} }{\sum _{1}^{k}\omega _{k} \tau _{k} } -For each constituent (ice, two black carbon species, two organic carbon species, and four dust species), :math:`\omega`, *g*, and -the mass extinction cross-section :math:`\psi` (m\ :sup:`2` kg\ :sub:`-1`) -are computed offline with Mie Theory, e.g., applying the computational technique from Bohren and Huffman (1983). The -extinction optical depth for each constituent depends on its mass extinction cross-section and layer mass, :math:`w _{k}` (kg\ m\ :sup:`-1`) as +For each constituent (ice, two black carbon species, two organic carbon species, and +four dust species), :math:`\omega`, *g*, and the mass extinction cross-section +:math:`\psi` (m\ :sup:`2` kg\ :sub:`-1`) are computed offline with Mie Theory, e.g., +applying the computational technique from :ref:`Bohren and Huffman (1983) `. +The extinction optical depth for each constituent depends on its mass extinction +cross-section and layer mass, :math:`w _{k}` (kg\ m\ :sup:`-1`) as .. math:: :label: 3.65 \tau _{k} =\psi _{k} w_{k} -The two-stream solution (Toon et al. 1989) applies a tri-diagonal matrix +The two-stream solution (:ref:`Toon et al. (1989) `) applies a tri-diagonal matrix solution to produce upward and downward radiative fluxes at each layer interface, from which net radiation, layer absorption, and surface albedo are easily derived. Solar fluxes are computed in five spectral -bands, listed in Table 3.4. Because snow albedo varies strongly across +bands, listed in :numref:`Table Spectral bands and weights used for snow radiative transfer`. +Because snow albedo varies strongly across the solar spectrum, it was determined that four bands were needed to accurately represent the near-infrared (NIR) characteristics of snow, whereas only one band was needed for the visible spectrum. Boundaries of the NIR bands were selected to capture broad radiative features and -maximize accuracy and computational efficiency. We partition NIR -(0.7-5.0 :math:`\mu` m) surface downwelling flux from CLM -according to the weights listed in Table 3.4, which are unique for -diffuse and direct incident flux. These fixed weights were determined -with offline hyperspectral radiative transfer calculations for an -atmosphere typical of mid-latitude winter (Flanner et al. 2007). The -tri-diagonal solution includes intermediate terms that allow for easy +maximize accuracy and computational efficiency. We partition NIR (0.7-5.0 +:math:`\mu` m) surface downwelling flux from CLM according to the weights listed +in :numref:`Table Spectral bands and weights used for snow radiative transfer`, +which are unique for diffuse and direct incident flux. These fixed weights were +determined with offline hyperspectral radiative transfer calculations for an +atmosphere typical of mid-latitude winter (:ref:`Flanner et al. (2007) `). +The tri-diagonal solution includes intermediate terms that allow for easy interchange of two-stream techniques. We apply the Eddington solution -for the visible band (following Wiscombe and Warren 1980) and the -hemispheric mean solution (Toon et al. 1989) for NIR bands. These +for the visible band (following :ref:`Wiscombe and Warren 1980 `) and the +hemispheric mean solution ((:ref:`Toon et al. (1989) `) for NIR bands. These choices were made because the Eddington scheme works well for highly scattering media, but can produce negative albedo for absorptive NIR bands with diffuse incident flux. Delta scalings are applied to -:math:`\tau`, :math:`\omega`, and :math:`g` (Wiscombe and Warren 1980) in +:math:`\tau`, :math:`\omega`, and :math:`g` (:ref:`Wiscombe and Warren 1980 `) in all spectral bands, producing effective values (denoted with \*) that are applied in the two-stream solution @@ -685,21 +699,23 @@ are applied in the two-stream solution g^{*} =\frac{g}{1+g} -Table 3.4. Spectral bands and weights used for snow radiative transfer - -+---------------------------------------------------------+----------------------+------------------+ -| Spectral band | Direct-beam weight | Diffuse weight | -+=========================================================+======================+==================+ -| Band 1: 0.3-0.7\ :math:`\mu`\ m (visible) | | | -+---------------------------------------------------------+----------------------+------------------+ -| Band 2: 0.7-1.0\ :math:`\mu`\ m (near-IR) | 0.494 | 0.586 | -+---------------------------------------------------------+----------------------+------------------+ -| Band 3: 1.0-1.2\ :math:`\mu`\ m (near-IR) | 0.181 | 0.202 | -+---------------------------------------------------------+----------------------+------------------+ -| Band 4: 1.2-1.5\ :math:`\mu`\ m (near-IR) | 0.121 | 0.109 | -+---------------------------------------------------------+----------------------+------------------+ -| Band 5: 1.5-5.0\ :math:`\mu`\ m (near-IR) | 0.204 | 0.103 | -+---------------------------------------------------------+----------------------+------------------+ +.. _Table Spectral bands and weights used for snow radiative transfer: + +.. table:: Spectral bands and weights used for snow radiative transfer + + +---------------------------------------------------------+----------------------+------------------+ + | Spectral band | Direct-beam weight | Diffuse weight | + +=========================================================+======================+==================+ + | Band 1: 0.3-0.7\ :math:`\mu`\ m (visible) | | | + +---------------------------------------------------------+----------------------+------------------+ + | Band 2: 0.7-1.0\ :math:`\mu`\ m (near-IR) | 0.494 | 0.586 | + +---------------------------------------------------------+----------------------+------------------+ + | Band 3: 1.0-1.2\ :math:`\mu`\ m (near-IR) | 0.181 | 0.202 | + +---------------------------------------------------------+----------------------+------------------+ + | Band 4: 1.2-1.5\ :math:`\mu`\ m (near-IR) | 0.121 | 0.109 | + +---------------------------------------------------------+----------------------+------------------+ + | Band 5: 1.5-5.0\ :math:`\mu`\ m (near-IR) | 0.204 | 0.103 | + +---------------------------------------------------------+----------------------+------------------+ Under direct-beam conditions, singularities in the radiative approximation are occasionally approached in spectral bands 4 and 5 that @@ -743,7 +759,8 @@ absorption fluxes that are used for column temperature calculations are This weighting is performed for direct-beam and diffuse, visible and NIR fluxes. After the ground-incident fluxes (transmitted through the vegetation canopy) have been calculated for the current time step -(sections 3.1 and 4.1), the layer absorption factors +(sections :numref:`Canopy Radiative Transfer` and :numref:`Solar Fluxes`), +the layer absorption factors (:math:`S_{g,\, i}`) are multiplied by the ground-incident fluxes to produce solar absorption (W m\ :sup:`-2`) in each snow layer and @@ -779,98 +796,107 @@ weighted by the diffuse albedo for a semi-infinite snowpack (:math:`\alpha _{sno Inclusion of this additional albedo weight was found to improve accuracy of the five-band albedo solutions (relative to 470-band solutions) because of the strong dependence of optically-thick snowpack albedo on -ice grain single-scatter albedo (Flanner et al. 2007). The lookup tables -contain optical properties for lognormal distributions of ice particles -over the range of effective radii: 30\ :math:`\mu`\ m -:math:`< r _{e} < \text{1500} \mu \text{m}`, at 1 :math:`\mu` m resolution. Single-scatter albedos for the end-members of this size -range are listed in Table 3.5. - -Optical properties for black carbon are described in Flanner et al. -(2007). Single-scatter albedo, mass extinction cross-section, and +ice grain single-scatter albedo (:ref:`Flanner et al. (2007) `). +The lookup tables contain optical properties for lognormal distributions of ice +particles over the range of effective radii: 30\ :math:`\mu`\ m +:math:`< r _{e} < \text{1500} \mu \text{m}`, at 1 :math:`\mu` m resolution. +Single-scatter albedos for the end-members of this size range are listed in +:numref:`Table Single-scatter albedo values used for snowpack impurities and ice`. + +Optical properties for black carbon are described in :ref:`Flanner et al. (2007) `. +Single-scatter albedo, mass extinction cross-section, and asymmetry parameter values for all snowpack species, in the five -spectral bands used, are listed in Tables 3.5, 3.6, and 3.7. These -properties were also derived with Mie Theory, using various published +spectral bands used, are listed in :numref:`Table Single-scatter albedo values used for snowpack impurities and ice`, +:numref:`Table Mass extinction values`, and +:numref:`Table Asymmetry scattering parameters used for snowpack impurities and ice`. +These properties were also derived with Mie Theory, using various published sources of indices of refraction and assumptions about particle size distribution. Weighting into the five CLM spectral bands was determined only with incident solar flux, as in equation . -Table 3.5. Single-scatter albedo values used for snowpack impurities and ice - -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | -+================================================================+==========+==========+==========+==========+==========+ -| Hydrophilic black carbon | 0.516 | 0.434 | 0.346 | 0.276 | 0.139 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophobic black carbon | 0.288 | 0.187 | 0.123 | 0.089 | 0.040 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophilic organic carbon | 0.997 | 0.994 | 0.990 | 0.987 | 0.951 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophobic organic carbon | 0.963 | 0.921 | 0.860 | 0.814 | 0.744 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 1 | 0.979 | 0.994 | 0.993 | 0.993 | 0.953 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 2 | 0.944 | 0.984 | 0.989 | 0.992 | 0.983 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 3 | 0.904 | 0.965 | 0.969 | 0.973 | 0.978 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 4 | 0.850 | 0.940 | 0.948 | 0.953 | 0.955 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Ice (:math:`r _{e}` = 30 :math:`\mu` m) | 0.9999 | 0.9999 | 0.9992 | 0.9938 | 0.9413 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Ice (:math:`r _{e}` = 1500 :math:`\mu` m) | 0.9998 | 0.9960 | 0.9680 | 0.8730 | 0.5500 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ - -Table 3.6. Mass extinction values (m\ :sup:`2` kg\ :sub:`-1`) used for snowpack impurities and ice. - -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | -+================================================================+==========+==========+==========+==========+==========+ -| Hydrophilic black carbon | 25369 | 12520 | 7739 | 5744 | 3527 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophobic black carbon | 11398 | 5923 | 4040 | 3262 | 2224 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophilic organic carbon | 37774 | 22112 | 14719 | 10940 | 5441 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophobic organic carbon | 3289 | 1486 | 872 | 606 | 248 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 1 | 2687 | 2420 | 1628 | 1138 | 466 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 2 | 841 | 987 | 1184 | 1267 | 993 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 3 | 388 | 419 | 400 | 397 | 503 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 4 | 197 | 203 | 208 | 205 | 229 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Ice (:math:`r _{e}` = 30 :math:`\mu` m) | 55.7 | 56.1 | 56.3 | 56.6 | 57.3 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Ice (:math:`r _{e}` = 1500 :math:`\mu` m) | 1.09 | 1.09 | 1.09 | 1.09 | 1.1 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ - -Table 3.7. Asymmetry scattering parameters used for snowpack impurities and ice. - -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | -+================================================================+==========+==========+==========+==========+==========+ -| Hydrophilic black carbon | 0.52 | 0.34 | 0.24 | 0.19 | 0.10 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophobic black carbon | 0.35 | 0.21 | 0.15 | 0.11 | 0.06 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophilic organic carbon | 0.77 | 0.75 | 0.72 | 0.70 | 0.64 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Hydrophobic organic carbon | 0.62 | 0.57 | 0.54 | 0.51 | 0.44 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 1 | 0.69 | 0.72 | 0.67 | 0.61 | 0.44 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 2 | 0.70 | 0.65 | 0.70 | 0.72 | 0.70 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 3 | 0.79 | 0.75 | 0.68 | 0.63 | 0.67 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Dust 4 | 0.83 | 0.79 | 0.77 | 0.76 | 0.73 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Ice (:math:`r _{e}` = 30\ :math:`\mu`\ m) | 0.88 | 0.88 | 0.88 | 0.88 | 0.90 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ -| Ice (:math:`r _{e}` = 1500\ :math:`\mu`\ m) | 0.89 | 0.90 | 0.90 | 0.92 | 0.97 | -+----------------------------------------------------------------+----------+----------+----------+----------+----------+ +.. _Table Single-scatter albedo values used for snowpack impurities and ice: + +.. table:: Single-scatter albedo values used for snowpack impurities and ice + + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | + +================================================================+==========+==========+==========+==========+==========+ + | Hydrophilic black carbon | 0.516 | 0.434 | 0.346 | 0.276 | 0.139 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophobic black carbon | 0.288 | 0.187 | 0.123 | 0.089 | 0.040 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophilic organic carbon | 0.997 | 0.994 | 0.990 | 0.987 | 0.951 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophobic organic carbon | 0.963 | 0.921 | 0.860 | 0.814 | 0.744 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 1 | 0.979 | 0.994 | 0.993 | 0.993 | 0.953 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 2 | 0.944 | 0.984 | 0.989 | 0.992 | 0.983 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 3 | 0.904 | 0.965 | 0.969 | 0.973 | 0.978 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 4 | 0.850 | 0.940 | 0.948 | 0.953 | 0.955 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Ice (:math:`r _{e}` = 30 :math:`\mu` m) | 0.9999 | 0.9999 | 0.9992 | 0.9938 | 0.9413 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Ice (:math:`r _{e}` = 1500 :math:`\mu` m) | 0.9998 | 0.9960 | 0.9680 | 0.8730 | 0.5500 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + +.. _Table Mass extinction values: + +.. table:: Mass extinction values (m\ :sup:`2` kg\ :sub:`-1`) used for snowpack impurities and ice + + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | + +================================================================+==========+==========+==========+==========+==========+ + | Hydrophilic black carbon | 25369 | 12520 | 7739 | 5744 | 3527 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophobic black carbon | 11398 | 5923 | 4040 | 3262 | 2224 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophilic organic carbon | 37774 | 22112 | 14719 | 10940 | 5441 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophobic organic carbon | 3289 | 1486 | 872 | 606 | 248 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 1 | 2687 | 2420 | 1628 | 1138 | 466 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 2 | 841 | 987 | 1184 | 1267 | 993 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 3 | 388 | 419 | 400 | 397 | 503 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 4 | 197 | 203 | 208 | 205 | 229 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Ice (:math:`r _{e}` = 30 :math:`\mu` m) | 55.7 | 56.1 | 56.3 | 56.6 | 57.3 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Ice (:math:`r _{e}` = 1500 :math:`\mu` m) | 1.09 | 1.09 | 1.09 | 1.09 | 1.1 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + +.. _Table Asymmetry scattering parameters used for snowpack impurities and ice: + +.. table:: Asymmetry scattering parameters used for snowpack impurities and ice. + + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | + +================================================================+==========+==========+==========+==========+==========+ + | Hydrophilic black carbon | 0.52 | 0.34 | 0.24 | 0.19 | 0.10 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophobic black carbon | 0.35 | 0.21 | 0.15 | 0.11 | 0.06 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophilic organic carbon | 0.77 | 0.75 | 0.72 | 0.70 | 0.64 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Hydrophobic organic carbon | 0.62 | 0.57 | 0.54 | 0.51 | 0.44 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 1 | 0.69 | 0.72 | 0.67 | 0.61 | 0.44 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 2 | 0.70 | 0.65 | 0.70 | 0.72 | 0.70 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 3 | 0.79 | 0.75 | 0.68 | 0.63 | 0.67 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Dust 4 | 0.83 | 0.79 | 0.77 | 0.76 | 0.73 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Ice (:math:`r _{e}` = 30\ :math:`\mu`\ m) | 0.88 | 0.88 | 0.88 | 0.88 | 0.90 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ + | Ice (:math:`r _{e}` = 1500\ :math:`\mu`\ m) | 0.89 | 0.90 | 0.90 | 0.92 | 0.97 | + +----------------------------------------------------------------+----------+----------+----------+----------+----------+ .. _Snow Aging: @@ -881,9 +907,9 @@ Snow aging is represented as evolution of the ice effective grain size (:math:`r_{e}`). Previous studies have shown that use of spheres which conserve the surface area-to-volume ratio (or specific surface area) of ice media composed of more complex shapes produces relatively -small errors in simulated hemispheric fluxes (e.g., Grenfell and Warren -1999). Effective radius is the surface area-weighted mean radius of an -ensemble of spherical particles and is directly related to specific +small errors in simulated hemispheric fluxes (e.g., :ref:`Grenfell and Warren +1999 `). Effective radius is the surface area-weighted mean +radius of an ensemble of spherical particles and is directly related to specific surface area (*SSA*) as :math:`r_{e} ={3\mathord{\left/ {\vphantom {3 \left(\rho _{ice} SSA\right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{ice} SSA\right)}` , where :math:`\rho_{ice}` is the density of ice. Hence, @@ -892,7 +918,7 @@ snowpack microphysical state to dry snow radiative characteristics. Wet snow processes can also drive rapid changes in albedo. The presence of liquid water induces rapid coarsening of the surrounding ice grains -(e.g., Brun 1989), and liquid water tends to refreeze into large ice +(e.g., :ref:`Brun 1989 `), and liquid water tends to refreeze into large ice clumps that darken the bulk snowpack. The presence of small liquid drops, by itself, does not significantly darken snowpack, as ice and water have very similar indices of refraction throughout the solar @@ -920,9 +946,9 @@ Here, the effective radius of freshly-fallen snow (:math:`r_{e,0}`) is fixed globally at 54.5 :math:`\mu` m (corresponding to a specific surface area of 60 m\ :sup:`2` kg\ :sub:`-1`), and the effective radius of refrozen liquid water (:math:`r_{e,rfz}`) is set to 1000\ :math:`\mu` m. -Dry snow aging is based on a microphysical model described by Flanner -and Zender (2006). This model simulates diffusive vapor flux amongst -collections of ice crystals with various size and inter-particle +Dry snow aging is based on a microphysical model described by :ref:`Flanner +and Zender (2006) `. This model simulates diffusive vapor flux +amongst collections of ice crystals with various size and inter-particle spacing. Specific surface area and effective radius are prognosed for any combination of snow temperature, temperature gradient, density, and initial size distribution. The combination of warm snow, large @@ -960,7 +986,7 @@ top soil layer, and for the top snow layer it is assumed that :math:`T_{n-1}` = :math:`T_{n}`. The contribution of liquid water to enhanced metamorphism is based on -parametric equations published by Brun (1989), who measured grain +parametric equations published by :ref:`Brun (1989) `, who measured grain growth rates under different liquid water contents. This relationship, expressed in terms of :math:`r_{e} (\mu \text{m})` and subtracting an offset due to dry aging, depends on the mass liquid water @@ -972,16 +998,18 @@ fraction :math:`f_{liq}` as \frac{dr_{e} }{dt} =\frac{10^{18} C_{1} f_{liq} ^{3} }{4\pi r_{e} ^{2} } The constant *C*\ :sub:`1` is 4.22\ :math:`\times`\ 10\ :sup:`-13`, and: -:math:`f_{liq} =w_{liq} /(w_{liq} +w_{ice} )`\ (section 7.2). +:math:`f_{liq} =w_{liq} /(w_{liq} +w_{ice} )`\ (Chapter :numref:`rst_Snow Hydrology`). In cases where snow mass is greater than zero, but a snow layer has not yet been defined, :math:`r_{e}` is set to :math:`r_{e,0}`. When snow layers are combined or divided, :math:`r_{e}` is calculated as a mass-weighted mean of the two layers, following computations of other state variables (section -7.2.7). Finally, the allowable range of :math:`r_{e}`, +:numref:`Snow Layer Combination and Subdivision`). Finally, the allowable range of :math:`r_{e}`, corresponding to the range over which Mie optical properties have been defined, is 30-1500\ :math:`\mu` m. +.. _Solar Zenith Angle: + Solar Zenith Angle ---------------------- @@ -1008,8 +1036,8 @@ where :math:`d` is calendar day (:math:`d=0.0` at 0Z on January 1), and :math:`\theta` is longitude (radians) (positive east of the CityplaceGreenwich meridian). -The solar declination angle :math:`\delta` is calculated as in Berger -(1978a,b) and is valid for one million years past or hence, relative to +The solar declination angle :math:`\delta` is calculated as in :ref:`Berger +(1978a,b) ` and is valid for one million years past or hence, relative to 1950 A.D. The orbital parameters may be specified directly or the orbital parameters are calculated for the desired year. The required orbital parameters to be input by the user are the obliquity of the @@ -1018,7 +1046,7 @@ Earth :math:`\varepsilon` (degrees, :math:`e` (:math:`0.0`)). The solar declination :math:`\delta` (radians) is .. math:: @@ -1036,10 +1064,10 @@ The obliquity of the Earth :math:`\varepsilon` (degrees) is \varepsilon =\varepsilon *+\sum _{i=1}^{i=47}A_{i} \cos \left(f_{i} t+\delta _{i} \right) -where :math:`\varepsilon *` is a constant of integration (Table 3.8), +where :math:`\varepsilon *` is a constant of integration (:numref:`Table Orbital parameters`), :math:`A_{i}` , :math:`f_{i}` , and :math:`\delta _{i}` are amplitude, -mean rate, and phase terms in the cosine series expansion (Berger -1978a,b), and :math:`t=t_{0} -1950` where :math:`t_{0}` is the year. +mean rate, and phase terms in the cosine series expansion (:ref:`Berger +(1978a,b) `, and :math:`t=t_{0} -1950` where :math:`t_{0}` is the year. The series expansion terms are not shown here but can be found in the source code file shr\_orb\_mod.F90. @@ -1087,7 +1115,7 @@ where are the cosine and sine series expansions for :math:`e`, and :math:`M_{j}` , :math:`g_{j}` , and :math:`B_{j}` are amplitude, mean -rate, and phase terms in the series expansions (Berger 1978a,b). The +rate, and phase terms in the series expansions (:ref:`Berger (1978a,b) `). The longitude of the perihelion relative to the moving vernal equinox :math:`\tilde{\omega }` (degrees) is @@ -1110,9 +1138,9 @@ orbit relative to the fixed stars. The general precession :math:`\psi` \psi =\frac{\tilde{\psi }t}{3600} +\zeta +\sum _{i=1}^{78}F_{i} \sin \left(f_{i} ^{{'} } t+\delta _{i} ^{{'} } \right) where :math:`\tilde{\psi }` (arcseconds) and :math:`\zeta` (degrees) -are constants (Table 3.8), and :math:`F_{i}` , :math:`f_{i} ^{{'} }` , +are constants (:numref:`Table Orbital parameters`), and :math:`F_{i}` , :math:`f_{i} ^{{'} }` , and :math:`\delta _{i} ^{{'} }` are amplitude, mean rate, and phase -terms in the sine series expansion (Berger 1978a,b). The longitude of +terms in the sine series expansion (:ref:`Berger (1978a,b) `)). The longitude of the perihelion :math:`\Pi` (radians) depends on the sine and cosine series expansions for the eccentricity :math:`e`\ as follows: @@ -1125,16 +1153,18 @@ The numerical solution for the longitude of the perihelion :math:`\tilde{\omega }` is constrained to be between 0 and 360 degrees (measured from the autumn equinox). A constant 180 degrees is then added to :math:`\tilde{\omega }` because the Sun is considered as revolving -around the Earth (geocentric coordinate system) (Berger et al. 1993). - -Table 3.8. Orbital parameters - -+--------------------------------------+-------------+ -| Parameter | | -+======================================+=============+ -| :math:`\varepsilon *` | 23.320556 | -+--------------------------------------+-------------+ -| :math:`\tilde{\psi }` (arcseconds) | 50.439273 | -+--------------------------------------+-------------+ -| :math:`\zeta` (degrees) | 3.392506 | -+--------------------------------------+-------------+ +around the Earth (geocentric coordinate system) (:ref:`Berger et al. 1993 `)). + +.. _Table Orbital parameters: + +.. table:: Orbital parameters + + +--------------------------------------+-------------+ + | Parameter | | + +======================================+=============+ + | :math:`\varepsilon *` | 23.320556 | + +--------------------------------------+-------------+ + | :math:`\tilde{\psi }` (arcseconds) | 50.439273 | + +--------------------------------------+-------------+ + | :math:`\zeta` (degrees) | 3.392506 | + +--------------------------------------+-------------+ From 76f93f7ff0c06d7c98ea478d8d3989c3ac777c5b Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Wed, 24 May 2017 12:12:18 -0600 Subject: [PATCH 0018/1973] Updated Crop chapter summary and added CLM4.5 tech note reference --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 39 ++++++++++++------- .../References/CLM50_Tech_Note_References.rst | 4 ++ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 80cd1e3527..aa2e130e68 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -3,32 +3,43 @@ Crops and Irrigation ======================== -Summary of CLM4.5 updates relative to the CLM4.0 +Summary of CLM5.0 updates relative to the CLM4.5 ----------------------------------------------------- We describe here the complete crop and irrigation parameterizations that -appear in CLM4.5. Corresponding information for CLM4.0 appeared on the -CLM4.0 web site in a pdf document independent of the CLM4.0 Technical +appear in CLM5.0. Corresponding information for CLM4.5 appeared on the +CLM4.5 web site in a pdf document independent of the CLM4.5 Technical Note (Oleson et al. 2010a). The CLM4.0 crop model description also appeared in Levis et al. (2012). -CLM4.5 includes the following updates to the CROP option, where CROP -refers to the interactive crop management model: +CLM5.0 includes the following updates to the CROP option, where CROP +refers to the interactive crop management model and is included by default with the BGC configuration: -- Interactive irrigation +- New crop functional types -- Interactive fertilization +- All crop areas are actively managed -- Biological nitrogen fixation for soybeans +- Fertilization rates updated based on crop type and geographic region -- Modified C:N ratios for crops +- Irrigation updates -- Nitrogen retranslocation for crops +- Phenological triggers vary by latitude for some crop types -- Separate reproductive pool +- Ability to simulate transient crop management -These updates appear in detail in section 20.4. Most also appear in -Drewniak et al. (2013). +- Adjustments to allocation and phenological parameters + +- Crops reaching their maximum LAI triggers the grain fill phase + +- Grain C and N pools are included in a 1-year product pool + +- C for annual crop seeding comes from the grain C pool + +- Initial seed C for planting is increased from 1 to 3 g C/m^2 + + +These updates appear in detail in the sections below. Many also appear in +Levis et al. (2016). The crop model ------------------- @@ -55,7 +66,7 @@ management parameterizations from AgroIBIS (March 2003 version) were coupled as a proof-of-concept to the Community Land Model version 3 [CLM3.0, Oleson et al. (2004)] (not published), then coupled to the CLM3.5 (Levis et al. 2009) and later released to the community with -CLM4CN (Levis et al. 2012). +CLM4CN (Levis et al. 2012) and CLM4.5. With interactive crop management and, therefore, a more accurate representation of agricultural landscapes, we hope to improve the CLM’s diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index b953d98b3d..a7c59328dd 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -886,6 +886,10 @@ Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Kluzek, E. Community Land Model (CLMU). NCAR Technical Note NCAR/TN-480+STR, National Center for Atmospheric Research, Boulder, CO, 169 pp. +Oleson, K.W., et al. 2013. Technical description of version 4.5 of the +Community Land Model (CLM). NCAR Technical Note NCAR/TN-503+STR, +National Center for Atmospheric Research, Boulder, CO, 420 pp. + Olson, J.S., 1963. Energy storage and the balance of producers and decomposers in ecological systems. Ecology 44:322-331. From 9255276dd7f087458921c1cb663818e39dc58f74 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 24 May 2017 13:56:30 -0600 Subject: [PATCH 0019/1973] update irrigation --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 449341c0f9..ef249b0ee0 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -273,14 +273,14 @@ phase 3. Other allocation coefficients change to: .. math:: :label: ZEqnNum833921 - \begin{array}{l} - {a_{leaf} =a_{leaf}^{i,3} {\rm \; \; \; when\; \; \; }a_{leaf}^{i,3} \le a_{leaf}^{f} {\rm \; \; \; else...}} \\ - {a_{leaf} =a_{leaf} \left(1-\frac{GDD_{T_{{\rm 2m}} } -h}{GDD_{{\rm mat}} d_{L} -h} \right)^{d_{alloc}^{leaf} } \ge a_{leaf}^{f} {\rm \; \; \; where\; \; \; }\frac{GDD_{T_{{\rm 2m}} } -h}{GDD_{{\rm mat}} d_{L} -h} \le 1} \\ - {} \\ - {a_{livestem} =a_{livestem}^{i,3} {\rm \; \; \; when\; \; \; }a_{livestem}^{i,3} \le a_{livestem}^{f} {\rm \; \; \; else...}} \\ - {a_{livestem} =a_{livestem} \left(1-\frac{GDD_{T_{{\rm 2m}} } -h}{GDD_{{\rm mat}} d_{L} -h} \right)^{d_{alloc}^{stem} } \ge a_{livestem}^{f} {\rm \; \; \; where\; \; \; }\frac{GDD_{T_{{\rm 2m}} } -h}{GDD_{{\rm mat}} d_{L} -h} \le 1} \\ - {} \\ - {a_{repr} =1-a_{froot} -a_{livestem} -a_{leaf} } + \begin{array}{lr} + a_{leaf} =a_{leaf}^{i,3} & {\rm when} \quad a_{leaf}^{i,3} \le a_{leaf}^{f} \quad {\rm else} \\ + a_{leaf} =a_{leaf} \left(1-\frac{GDD_{T_{{\rm 2m}} } -h}{GDD_{{\rm mat}} d_{L} -h} \right)^{d_{alloc}^{leaf} } \ge a_{leaf}^{f} & {\rm where} \quad \frac{GDD_{T_{{\rm 2m}} } -h}{GDD_{{\rm mat}} d_{L} -h} \le 1 \\ + \\ + a_{livestem} =a_{livestem}^{i,3} & {\rm when} \quad a_{livestem}^{i,3} \le a_{livestem}^{f} \quad {\rm else} \\ + a_{livestem} =a_{livestem} \left(1-\frac{GDD_{T_{{\rm 2m}} } -h}{GDD_{{\rm mat}} d_{L} -h} \right)^{d_{alloc}^{stem} } \ge a_{livestem}^{f} & {\rm where} \quad \frac{GDD_{T_{{\rm 2m}} } -h}{GDD_{{\rm mat}} d_{L} -h} \le 1 \\ + \\ + a_{repr} =1-a_{froot} -a_{livestem} -a_{leaf} \end{array} where :math:`a_{leaf}^{i,3}` and :math:`a_{livestem}^{i,3}` (initial From c5821ded00e5980d12937106ee4b0814df4dca08 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 24 May 2017 16:22:26 -0600 Subject: [PATCH 0020/1973] Add html files back in, and make a few changes to getting-help for Users Guide --- doc/source/users_guide/overview/getting-help.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst index fb5069226b..8d45c71bcb 100644 --- a/doc/source/users_guide/overview/getting-help.rst +++ b/doc/source/users_guide/overview/getting-help.rst @@ -3,13 +3,13 @@ ============== Getting Help ============== -In addition to this users-guide there are several other resources that are available to help you use CLM4.5. The first one is the CESM1.2.0 User's-Guide, which documents the entire process of creating cases with CESM1.2.0. The next is the CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in CESM1.2.0. +In addition to this users-guide there are several other resources that are available to help you use CLM5.0. The first one is the CESM1.2.0 User's-Guide, which documents the entire process of creating cases with CESM1.2.0. The next is the CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in CESM1.2.0. --------------------------- The CESM User's-Guide --------------------------- -CLM4.5 in CESM1.2.0 is always run from within the standard CESM1.2.0 build and run scripts. Therefore, the user of CLM4.5 should familiarize themselves with the CESM1.2.0 scripts and understand how to work with them. User's-Guide documentation on the CESM1.2.0 scripts are available from the following web-page. The purpose of this CLM4.5 in CESM1.2.0 User's Guide is to give the CLM4.5 user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the CESM1.2.0 Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. +CLM5.0 in CESM2.0 is always run from within the standard CESM2.0 build and run scripts. Therefore, the user of CLM4.5 should familiarize themselves with the CESM1.2.0 scripts and understand how to work with them. User's-Guide documentation on the CESM1.2.0 scripts are available from the following web-page. The purpose of this CLM4.5 in CESM1.2.0 User's Guide is to give the CLM4.5 user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the CESM1.2.0 Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. `cesmrel; Scripts User's-Guide (http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/book1.html) `_ From 804853929eebc035575551ddd98a369126f9d7c7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 24 May 2017 16:51:39 -0600 Subject: [PATCH 0021/1973] More update to clm50 in users guide --- doc/source/users_guide/overview/introduction.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index 37eb0cb82d..de8dcc25fa 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -4,21 +4,21 @@ Introduction ============== -The Community Land Model (CLM4.5 in CESM1.2.0) is the latest in a +The Community Land Model (CLM5.0 in CESM2.0) is the latest in a series of global land models developed by t he CESM Land Model Working Group (LMWG) and maintained at the National Center for Atmospheric Research (NCAR). This guide is intended to instruct both the novice and experienced user on running CLM. This guide pertains to the latest -version CLM4.5 in CESM1.2.0 available for download from the public +version CLM5.0 in CESM2.0 available for download from the public release subversion repository as a part of CESM1.2.0. Documentation may be different if you are using an older version, you should either use the documentation for that release version, update to the latest version, or use the documentation inside your own source tree. There is information in the ChangeLog file and in the `What is new with -CLM4.5 in CESM1.2.0 since previous public releases? `_ +CLM5.0 in CESM2.0 since previous public releases? `_ regarding the changes from previous versions of CESM. -.. note:: This release of CLM4.5 in CESM1.2.0 includes BOTH CLM4.0 +.. note:: This release of CLM5.0 in CESM1.2.0 includes BOTH CLM4.0 physics used in previous releases as well as the updated CLM4.5 physics. Both CLM as well as CLM support tools allow you to trigger between the two physics modes. Most often when we refer to CLM4.0 we From aa96a511b92f111f5b835f8c03010707459898d8 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Thu, 25 May 2017 16:55:33 -0600 Subject: [PATCH 0022/1973] Updated references, added reference links & updated text in Crop chapter, added Vcmax text to Photosynthetic Capacity chapter for Chonggang to edit --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 66 +++++----- ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 120 ++++++++++++++++++ .../References/CLM50_Tech_Note_References.rst | 12 ++ 3 files changed, 164 insertions(+), 34 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index b8791663a2..98c5ddcea3 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -11,8 +11,7 @@ Summary of CLM5.0 updates relative to the CLM4.5 We describe here the complete crop and irrigation parameterizations that appear in CLM5.0. Corresponding information for CLM4.5 appeared on the CLM4.5 web site in a pdf document independent of the CLM4.5 Technical -Note (Oleson et al. 2010a). The CLM4.0 crop model description also -appeared in Levis et al. (2012). +Note (:ref:`Oleson et al. 2013 `). CLM5.0 includes the following updates to the CROP option, where CROP refers to the interactive crop management model and is included by default with the BGC configuration: @@ -23,7 +22,7 @@ refers to the interactive crop management model and is included by default with - Fertilization rates updated based on crop type and geographic region -- Irrigation updates +- New Irrigation triggers - Phenological triggers vary by latitude for some crop types @@ -41,7 +40,7 @@ refers to the interactive crop management model and is included by default with These updates appear in detail in the sections below. Many also appear in -Levis et al. (2016). +Levis et al. (:ref:`2016 `). .. _The crop model: @@ -64,13 +63,14 @@ biogeophysical and biogeochemical effects not only of natural but also human-managed land cover. AgroIBIS is a state-of-the-art land surface model with options to -simulate dynamic vegetation (Kucharik et al. 2000) and interactive -crop management (Kucharik and Brye 2003). The interactive crop +simulate dynamic vegetation (:ref:`Kucharik et al. 2000 `) and interactive +crop management (:ref:`Kucharik and Brye 2003 `). The interactive crop management parameterizations from AgroIBIS (March 2003 version) were coupled as a proof-of-concept to the Community Land Model version 3 -[CLM3.0, Oleson et al. (2004)] (not published), then coupled to the -CLM3.5 (Levis et al. 2009) and later released to the community with -CLM4CN (Levis et al. 2012) and CLM4.5. +[CLM3.0, :ref:`Oleson et al. (2004) `] (not published), then coupled to the +CLM3.5 (:ref:`Levis et al. 2009 `) and later released to the community with +CLM4CN (:ref:`Levis et al. 2012 `), with additional updates +available by request after the release of CLM4.5 (:ref:`Levis et al. 2016 `). With interactive crop management and, therefore, a more accurate representation of agricultural landscapes, we hope to improve the CLM’s @@ -78,39 +78,37 @@ simulated biogeophysics and biogeochemistry. These advances may improve fully coupled simulations with the Community Earth System Model (CESM), while helping human societies answer questions about changing food, energy, and water resources in response to climate, environmental, land -use, and land management change (e.g., Kucharik and Brye 2003; Lobell et al. 2006). +use, and land management change (e.g., :ref:`Kucharik and Brye 2003 ; Lobell et al. 2006 `). .. _Crop plant functional types: Crop plant functional types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +To allow crops to coexist with natural vegetation in a grid cell, the +vegetated land unit is separated into a naturally vegetated land unit and +a managed crop land unit. Unlike the plant functional types (pfts) in the +naturally vegetated land unit, the managed crop pfts in the managed crop +land unit do not share soil columns and thus permit for differences in the +land management between crops. Crop grid cell coverage is assigned from +satellite data (similar to all natural pfts), and the managed crop type +proportions within the crop area is based on the dataset created by +(:ref:`Portmann et al. 2010 `) for present day and +extrapolated through time using the LUMIP data (insert citation). Each +actively managed crop type has a rainfed and an irrigated pft that are on +independent soil columns. Actively managed crop types (Table XX) are chosen +based on the availability of corresponding algorithms in AgroIBIS and as +developed by Badger and Dirmeyer (:ref:`2015 `) and +described by Levis et al. (:ref:`2016 `). A parameterization +for winter cereals is developed but is not included in CLM5.0 due to the +inability to distinguish between winter and summer cereals in the LUMIP dataset (insert citation). + CLM’s default list of plant functional types (pfts) includes an -unmanaged crop (Table 2.1) treated as a second C3 grass. The unmanaged +unmanaged crop (Table 2.1) treated as a second C3 grass, as well as several +additional crop types that do not have associated parameters. The unmanaged crop has grid cell coverage assigned from satellite data, as do all -natural pfts when CLM’s dynamic vegetation model (CNDV; Castillo et al. 2012) is not active. - -The new crop pfts used in the CLM get grid cell coverage from the -present-day crop dataset of Portmann et al. (2010). We assign these -managed crops in the proportions given by Portmann et al. (2010) without -exceeding the area previously assigned to the unmanaged crop. The -unmanaged crop continues to occupy any of its original area that remains -and continues to be handled just by the carbon/nitrogen cycling part of -the CLM (i.e., CN). The managed crop types (corn, soybean, and temperate -cereals) were chosen based on the availability of corresponding -algorithms in AgroIBIS. Temperate cereals include wheat, barley, and rye -here. We treat all temperate cereals as summer crops (like spring wheat, -for example) at this time. We may introduce winter cereals (such as -winter wheat) in a future version of the model. - -To allow crops to coexist with natural vegetation in a grid cell and be -treated by separate models (i.e., CLM4.5CNcrop versus CLM4.5CNDV), we -separate the vegetated land unit into a naturally vegetated land unit -and a human managed land unit. Plant functional types in the naturally -vegetated land unit share one soil column and compete for water (default -CLM setting). Managed crop PFTs in the human managed land unit do not -share soil columns and thus permit for differences in land management -between crops. +natural pfts when CLM’s crop model is not active. [include remapping text here]. + .. _Phenology: diff --git a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst index c294531b44..803964c6df 100644 --- a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst +++ b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst @@ -2,3 +2,123 @@ Photosynthetic Capacity ======================= + +.. _V\ :sub:`cmax25` and Canopy scaling: + +V\ :sub:`cmax25` and Canopy scaling +-------------------------------------------- + +The maximum rate of carboxylation at 25 :sup:`o`\ C varies with +foliage nitrogen concentration and specific leaf area and is calculated +as in Thornton and Zimmermann (2007). At 25ºC, + +.. math:: + :label: ZEqnNum217783 + + V_{c\max 25} =N_{a} F_{LNR} F_{NR} a_{R25} + +where :math:`N_{a}` is the area-based leaf nitrogen concentration (g N +m\ :sup:`-2` leaf area), :math:`F_{LNR}` is the fraction of leaf +nitrogen in Rubisco (g N in Rubisco g\ :sup:`-1` N), +:math:`F_{NR} =7.16` is the mass ratio of total Rubisco molecular mass +to nitrogen in Rubisco (g Rubisco g\ :sup:`-1` N in Rubisco), and +:math:`a_{R25} =60` is the specific activity of Rubisco (µmol +CO\ :sub:`2` g\ :sup:`-1` Rubisco s\ :sup:`-1`). +:math:`N_{a}` is calculated from mass-based leaf N concentration and +specific leaf area + +.. math:: + :label: ZEqnNum561340 + + N_{a} =\frac{1}{CN_{L} \; SLA_{0} } + +where :math:`CN_{L}` is the leaf carbon-to-nitrogen ratio (g C +g\ :sup:`-1` N) and :math:`SLA_{0}` is specific leaf area at the +canopy top ( m\ :sup:`2` leaf area g\ :sup:`-1` C ). Table 8.1 +lists values of :math:`F_{LNR}` , :math:`CN_{L}` , and :math:`SLA_{0}` +for each plant functional type. :math:`F_{LNR}` was chosen to give +:math:`V_{c\max 25}` consistent with Kattge et al. (2009), as discussed +by Bonan et al. (2011, 2012). Table 8.1 lists derived values for +:math:`V_{c\max 25}` at the top of the canopy using :math:`SLA_{0}` . +Tropical broadleaf evergreen trees are an exception, and a higher +:math:`V_{c\max 25}` is used to alleviate model biases (Bonan et al. +2012). + +:math:`V_{c\max 25}` is calculated separately for sunlit and shaded +leaves using an exponential profile to area-based leaf nitrogen +(:math:`N_{a}` ), as in Bonan et al. (2011). :math:`V_{c\max 25}` at +cumulative leaf area index :math:`x` from the canopy top scales directly +with :math:`N_{a}` , which decreases exponentially with greater +cumulative leaf area, so that + +.. math:: + :label: ZEqnNum745439 + + V_{c\; \max 25}^{} \left(x\right)=V_{c\; \max 25}^{} \left(0\right)e^{-K_{n} x} + +where :math:`V_{c\; \max 25}^{} \left(0\right)` is defined at the top of +the canopy using :math:`SLA_{0}` , and :math:`K_{n}` is the decay +coefficient for nitrogen. The canopy integrated value for sunlit and +shaded leaves is + +.. math:: + :label: 9.20) + + \begin{array}{rcl} {V_{c\; \max 25}^{sun} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)f_{sun} \left(x\right)\, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} } \end{array} + +.. math:: + :label: 9.21) + + \begin{array}{rcl} {V_{c\; \max 25}^{sha} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)\left[1-f_{sun} \left(x\right)\right] \, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left\{\left[1-e^{-K_{n} L} \right]\frac{1}{K_{n} } -\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} \right\}} \end{array} + +and the average value for the sunlit and shaded leaves is + +.. math:: + :label: 9.22) + + \bar{V}_{c\; \max 25}^{sun} ={V_{c\; \max 25}^{sun} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sun} L^{sun} }} \right. \kern-\nulldelimiterspace} L^{sun} } + +.. math:: + :label: 9.23) + + \bar{V}_{c\; \max 25}^{sha} ={V_{c\; \max 25}^{sha} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sha} L^{sha} }} \right. \kern-\nulldelimiterspace} L^{sha} } . + +This integration is over all leaf area (:math:`L`) with +:math:`f_{sun} (x)=\exp \left(-Kx\right)` and :math:`K` the direct beam +extinction coefficient (equation 4.9). Photosynthetic parameters +:math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}` , and +:math:`R_{d25}` scale similarly. + +The value :math:`K_{n} = 0.11` chosen by Bonan et al. (2011) is +consistent with observationally-derived estimates for forests, mostly +tropical, and provides a gradient in V\ :sub:`cmax` similar to +the original CLM4 specific leaf area scaling. However, Bonan et al. +(2012) showed that the sunlit/shaded canopy parameterization does not +match an explicit multi-layer canopy parameterization. The discrepancy +arises from absorption of scattered radiation by shaded leaves and can +be tuned out with higher :math:`K_{n}` . The model uses +:math:`K_{n} =0.30` to match an explicit multi-layer canopy. + +:math:`V_{c\max 25}` additionally varies with daylength (:math:`DYL`) +using the function :math:`f(DYL)`, which introduces seasonal variation +to :math:`V_{c\max }` + +.. math:: + :label: 9.24) + + f\left(DYL\right)=\frac{\left(DYL\right)^{2} }{\left(DYL_{\max } \right)^{2} } + +with :math:`0.01\le f\left(DYL\right)\le 1`. Daylength (seconds) is +given by + +.. math:: + :label: 9.25) + + DYL=2\times 13750.9871\cos ^{-1} \left[\frac{-\sin \left(lat\right)\sin \left(decl\right)}{\cos \left(lat\right)\cos \left(decl\right)} \right] + +where :math:`lat` (latitude) and :math:`decl` (declination angle) are +from section 3.3. Maximum daylength (:math:`DYL_{\max }` ) is calculated +similarly but using the maximum declination angle for present-day +orbital geometry (:math:`\pm`\ 23.4667º [:math:`\pm`\ 0.409571 radians], +positive for Northern Hemisphere latitudes and negative for Southern +Hemisphere). diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index fcbbde344d..7fb1521105 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -82,6 +82,12 @@ Axelsson, E., and Axelsson, B. 1986. Changes in carbon allocation patterns in spruce and pine trees following irrigation and fertilization. Tree Phys. 2:189-204. +.. _BadgerandDirmeyer2015: + +Badger, A.M., and Dirmeyer, P.A., 2015. Climate response to Amazon forest +replacement by heterogeneous crop cover. Hydrol. Earth. Syst. Sci. 19:4547- +4557. + .. _Bairdetal2004: Baird, A.J., Beckwith, C.W., Waldron, S. and Waddington, J.M., 2004. @@ -990,6 +996,12 @@ and Kucharik, C 2012. Interactive crop management in the Community Earth System Model (CESM1): Seasonal influences on land-atmosphere fluxes. J. Climate 25: 4839-4859. DOI:10.1175/JCLI-D-11-00446.1. +.. _Levisetal2016: + +Levis, S., Badger, A., Drewniak, B., Nevison, C., Ren, X. 2016. CLMcrop +yields and water requirements: avoided impacts by choosing RCP 4.5 over 8.5. +Climatic Change. DOI:10.1007/s10584-016-1654-9. + .. _Lietal2000: Li, C., Aber, J., Stange, F., Butterbach-Bahl, K. and Papen, H. 2000. A From 48450d9730fbfef31a5bdde1eef6c5afe0fd8257 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 26 May 2017 07:17:12 -0600 Subject: [PATCH 0023/1973] correct lake references --- .../tech_note/Lake/CLM50_Tech_Note_Lake.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst b/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst index aa0489964d..860bc2ae7c 100644 --- a/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst +++ b/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst @@ -4,17 +4,17 @@ Lake Model ============= The lake model, denoted the *Lake, Ice, Snow, and Sediment Simulator* -(LISSS), is from :numref:`Subin et al. (2012a) `. +(LISSS), is from :ref:`Subin et al. (2012a) `. It includes extensive modifications to the lake code of -:numref:`Zeng et al. (2002) ` used in CLM +:ref:`Zeng et al. (2002) ` used in CLM versions 2 through 4, which utilized concepts from the lake models of -:numref:`Bonan (1996) `, -:numref:`Henderson-Sellers (1985) `, -:numref:`Henderson-Sellers (1986) `, -:numref:`Hostetler and Bartlein (1990) `, -and the coupled lake-atmosphere model of :numref:`Hostetler et al. (1993) `, :numref:`Hostetler et al. (1993) `. +:ref:`Bonan (1996) `, +:ref:`Henderson-Sellers (1985) `, +:ref:`Henderson-Sellers (1986) `, +:ref:`Hostetler and Bartlein (1990) `, +and the coupled lake-atmosphere model of :ref:`Hostetler et al. (1993) `, :ref:`Hostetler et al. (1993) `. Lakes have spatially variable depth prescribed in the surface data (section -:numref:`External Data Lake`); the surface data optionally includes lake optical +:ref:`External Data Lake`); the surface data optionally includes lake optical extinction coeffient and horizontal fetch, currently only used for site simulations. Lake physics includes freezing and thawing in the lake body, resolved snow layers, and “soil” and bedrock layers below the lake From 95c43a0bafd9c8d4deb67603816777db52f5a039 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 26 May 2017 10:52:56 -0600 Subject: [PATCH 0024/1973] Updates to radiative fluxes and surface albedos --- .../CLM50_Tech_Note_Radiative_Fluxes.rst | 11 +++-- .../CLM50_Tech_Note_Surface_Albedos.rst | 48 ++++++++++--------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst index 28f43fce9a..1115bf1dc6 100644 --- a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst +++ b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst @@ -32,14 +32,17 @@ albedos (section 3.2). :math:`L` and :math:`S` are the exposed leaf area index and stem area index (section 2.1.4). :math:`K` is the optical depth of direct beam per unit leaf and stem area (section 3.1). -Figure 4.1. Schematic diagram of (a) direct beam radiation, (b) diffuse -solar radiation, and (c) longwave radiation absorbed, transmitted, and -reflected by vegetation and ground. +.. Figure 4.1. Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and reflected by vegetation and ground. + +.. _Figure schematic diagram of radiation: + +.. Figure:: image1.png + + Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and reflected by vegetation and ground. For clarity, terms involving :math:`T^{n+1} -T^{n}` are not shown in (c). -.. image:: image1.png The total solar radiation absorbed by the vegetation and ground is diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 0cd135e220..33fd1c0792 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -41,7 +41,7 @@ equations are solved to calculate the fluxes, per unit incident flux, absorbed by the vegetation, reflected by the vegetation, and transmitted through the vegetation for direct and diffuse radiation and for visible (:math:`<` 0.7\ :math:`\mu {\rm m}`) and near-infrared -(:math:`ge` 0.7\ :math:`\mu {\rm m}`) wavebands. The absorbed +(:math:`\geq` 0.7\ :math:`\mu {\rm m}`) wavebands. The absorbed radiation is partitioned to sunlit and shaded fractions of the canopy. The optical parameters :math:`G\left(\mu \right)`, :math:`\bar{\mu }`, :math:`\omega`, :math:`\beta`, and :math:`\beta _{0}` are calculated @@ -156,15 +156,15 @@ Using this approximation, for vertical leaves (:math:`\chi _{L} =-1`, and for horizontal leaves (:math:`\chi _{L} =1`, :math:`\bar{\theta }=0^{{\rm o}}` ) , :math:`\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} =\alpha _{\Lambda }` , -which agree with both Dickinson (1983) and Sellers (1985). For random +which agree with both :ref:`Dickinson (1983) ` and :ref:`Sellers (1985) `. For random (spherically distributed) leaves (:math:`\chi _{L} =0`, :math:`\bar{\theta }=60^{{\rm o}}` ), the approximation yields :math:`\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} ={5\mathord{\left/ {\vphantom {5 8}} \right. \kern-\nulldelimiterspace} 8} \alpha _{\Lambda } +{3\mathord{\left/ {\vphantom {3 8}} \right. \kern-\nulldelimiterspace} 8} \tau _{\Lambda }` -whereas the approximate solution of Dickinson (1983) is +whereas the approximate solution of :ref:`Dickinson (1983) ` is :math:`\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} ={2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} \alpha _{\Lambda } +{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} \tau _{\Lambda }` . This discrepancy arises from the fact that a spherical leaf angle distribution has a true mean leaf inclination -:math:`\bar{\theta }\approx 57` (Campbell and Norman 1998) in equation , +:math:`\bar{\theta }\approx 57` :ref:`(Campbell and Norman 1998) ` in equation , while :math:`\bar{\theta }=60` in equation . The upscatter for direct beam radiation is @@ -178,7 +178,11 @@ where the single scattering albedo is .. math:: :label: 3.16 - \begin{array}{rcl} {a_{s} \left(\mu \right)_{\Lambda } } & {=} & {\frac{\omega _{\Lambda }^{veg} }{2} \int _{0}^{1}\frac{\mu 'G\left(\mu \right)}{\mu G\left(\mu '\right)+\mu 'G\left(\mu \right)} d\mu '} \\ {} & {=} & {\frac{\omega _{\Lambda }^{veg} }{2} \frac{G\left(\mu \right)}{\mu \phi _{2} +G\left(\mu \right)} \left[1-\frac{\mu \phi _{1} }{\mu \phi _{2} +G\left(\mu \right)} \ln \left(\frac{\mu \phi _{1} +\mu \phi _{2} +G\left(\mu \right)}{\mu \phi _{1} } \right)\right].} \end{array} + \begin{array}{rcl} {a_{s} \left(\mu \right)_{\Lambda } } & {=} & {\frac{\omega _{\Lambda }^{veg} }{2} \int _{0}^{1}\frac{\mu 'G\left(\mu \right)}{\mu G\left(\mu '\right)+\mu 'G\left(\mu \right)} d\mu '} \\ {} & {=} & {\frac{\omega _{\Lambda }^{veg} }{2} \frac{G\left(\mu \right)}{\min (\mu \phi _{2} +G\left(\mu \right),1e-6)} \left[1-\frac{\mu \phi _{1} }{\min (\mu \phi _{2} +G\left(\mu \right),1e-6)} \ln \left(\frac{\mu \phi _{1} +\min (\mu \phi _{2} +G\left(\mu \right),1e-6)}{\mu \phi _{1} } \right)\right].} \end{array} + +Note here the restriction on :math:`\mu \phi _{2} +G\left(\mu \right)`. We have seen cases where small values +can cause unrealistic single scattering albedo associated with the log calculation, +thereby eventually causing a negative soil albedo. The upward diffuse fluxes per unit incident direct beam and diffuse flux (i.e., the surface albedos) are @@ -206,7 +210,7 @@ radiation, respectively, are I\, \downarrow _{\Lambda } =h_{9} s_{1} +\frac{h_{10} }{s_{1} } . -With reference to Figure 4.1, the direct beam flux transmitted through +With reference to :numref:`Figure schematic diagram of radiation`, the direct beam flux transmitted through the canopy, per unit incident flux, is :math:`e^{-K\left(L+S\right)}` , and the direct beam and diffuse fluxes absorbed by the vegetation, per unit incident flux, are @@ -223,7 +227,7 @@ unit incident flux, are These fluxes are partitioned to the sunlit and shaded canopy using an analytical solution to the two-stream approximation for sunlit and -shaded leaves (Dai et al. 2004), as described by Bonan et al. (2011). +shaded leaves :ref:`(Dai et al. 2004) `, as described by :ref:`Bonan et al. (2011) `. The absorption of direct beam radiation by sunlit leaves is .. math:: @@ -277,8 +281,8 @@ with a_{2} =h_{9} \left[\frac{1-s_{2} s_{1} }{K+h} \right]+h_{10} \left[\frac{1-{s_{2} \mathord{\left/ {\vphantom {s_{2} s_{1} }} \right. \kern-\nulldelimiterspace} s_{1} } }{K-h} \right]. The parameters :math:`h_{1}` –:math:`h_{10}` , :math:`\sigma` , -:math:`h`, :math:`s_{1}` , and :math:`s_{2}` are from Sellers (1985) -[note the error in :math:`h_{4}` in Sellers (1985)]: +:math:`h`, :math:`s_{1}` , and :math:`s_{2}` are from :ref:`Sellers (1985) ` +[note the error in :math:`h_{4}` in :ref:`Sellers (1985) `]: .. math:: :label: 3.31 @@ -417,11 +421,11 @@ The parameters :math:`h_{1}` –:math:`h_{10}` , :math:`\sigma` , Plant functional type optical properties (:numref:`Table Plant functional type optical properties`) for trees and shrubs are from :ref:`Dorman and Sellers (1989) `. Leaf and stem optical -properties (placeVIS and NIR reflectance and transmittance) were derived +properties (VIS and NIR reflectance and transmittance) were derived for grasslands and crops from full optical range spectra of measured optical properties (:ref:`Asner et al. 1998 `). Optical properties for -intercepted snow (:numref:`Table Intercepted snow optical properties`) are -:ref:`from Sellers et al. (1986) `. +intercepted snow (:numref:`Table Intercepted snow optical properties`) are from +:ref:`Sellers et al. (1986) `. .. _Table Plant functional type optical properties: @@ -458,25 +462,23 @@ intercepted snow (:numref:`Table Intercepted snow optical properties`) are +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ | C\ :sub:`4` grass | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Crop R | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | - +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Crop I | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | C\ :sub:`3` Crop | -0.30 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Corn R | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Temp Corn | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Corn I | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Spring Wheat | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Temp Cereal R | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Temp Soybean | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Temp Cereal I | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Cotton | -0.50 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Winter Cereal R | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Rice | 0.65 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Winter Cereal I | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Sugarcane | -0.50 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Soybean R | -0.5 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Tropical Corn | -0.50 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Soybean I | -0.5 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Tropical Soybean | -0.50 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ .. _Table Intercepted snow optical properties: From 8d902b3761bd4453c5622afb45417dac7b19a431 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 30 May 2017 11:32:20 -0600 Subject: [PATCH 0025/1973] Chapter 3 Surface Albedos updates and cleanup --- .../CLM50_Tech_Note_Surface_Albedos.rst | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 33fd1c0792..0b45f9faec 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -576,6 +576,8 @@ included the effects of the minimum permanent snow cover. .. table:: Dry and saturated soil albedos + +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ + | | Dry | Saturated | | Dry | Saturated | +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ | Color Class | vis | nir | vis | nir | Color Class | vis | nir | vis | nir | +---------------+--------+--------+--------+--------+---------------+--------+--------+--------+--------+ @@ -708,7 +710,7 @@ are applied in the two-stream solution +---------------------------------------------------------+----------------------+------------------+ | Spectral band | Direct-beam weight | Diffuse weight | +=========================================================+======================+==================+ - | Band 1: 0.3-0.7\ :math:`\mu`\ m (visible) | | | + | Band 1: 0.3-0.7\ :math:`\mu`\ m (visible) | (1.0) | (1.0) | +---------------------------------------------------------+----------------------+------------------+ | Band 2: 0.7-1.0\ :math:`\mu`\ m (near-IR) | 0.494 | 0.586 | +---------------------------------------------------------+----------------------+------------------+ @@ -739,15 +741,18 @@ boundary condition, SNICAR simulates solar absorption in all snow layers as well as the underlying soil or ground. With a thin snowpack, penetrating solar radiation to the underlying soil can be quite large and heat cannot be released from the soil to the atmosphere in this -situation. Thus, solar radiation penetration is limited to snowpacks -with total snow depth greater than or equal to 0.1 m -(:math:`z_{sno} \ge 0.1`) to prevent unrealistic soil warming within a -single timestep. +situation. Thus, if the snowpack has total snow depth less than 0.1 m +(:math:`z_{sno} < 0.1`) and there are no explicit snow layers, the solar +radiation is absorbed by the top soil layer. If there is a single snow layer, +the solar radiation is absorbed in that layer. If there is more than a single +snow layer, 75% of the solar radiation is absorbed in the top snow layer, +and 25% is absorbed in the next lowest snow layer. This prevents unrealistic +soil warming within a single timestep. The radiative transfer calculation is performed twice for each column containing a mass of snow greater than :math:`1 \times 10^{-30}` kg\ m\ :sup:`-2` (excluding lake and urban columns); once each for -direct-beam and diffuse incident flux. Absorption in each layer +direct-beam and diffuse incident flux. Absorption in each layer :math:`i` of pure snow is initially recorded as absorbed flux per unit incident flux on the ground (:math:`S_{sno,\, i}` ), as albedos must be calculated for the next timestep with unknown incident flux. The snow @@ -775,7 +780,7 @@ Snowpack Optical Properties Ice optical properties for the five spectral bands are derived offline and stored in a namelist-defined lookup table for online retrieval (see -CLM4.5 User’s Guide). Mie properties are first computed at fine spectral +CLM5.0 User’s Guide). Mie properties are first computed at fine spectral resolution (470 bands), and are then weighted into the five bands applied by CLM according to incident solar flux, :math:`I^{\downarrow } (\lambda )`. For example, the broadband @@ -846,7 +851,7 @@ only with incident solar flux, as in equation . .. _Table Mass extinction values: -.. table:: Mass extinction values (m\ :sup:`2` kg\ :sub:`-1`) used for snowpack impurities and ice +.. table:: Mass extinction values (m\ :sup:`2` kg\ :sup:`-1`) used for snowpack impurities and ice +----------------------------------------------------------------+----------+----------+----------+----------+----------+ | Species | Band 1 | Band 2 | Band 3 | Band 4 | Band 5 | @@ -945,7 +950,7 @@ each time step *t* as r_{e} \left(t\right)=\left[r_{e} \left(t-1\right)+dr_{e,\, dry} +dr_{e,\, wet} \right]f_{old} +r_{e,\, 0} f_{new} +r_{e,\, rfz} f_{rfrz} Here, the effective radius of freshly-fallen snow -(:math:`r_{e,0}`) is fixed globally at 54.5 :math:`\mu` m (corresponding to a specific surface area of 60 m\ :sup:`2` kg\ :sub:`-1`), and the effective +(:math:`r_{e,0}`) is fixed globally at 54.5 :math:`\mu` m (corresponding to a specific surface area of 60 m\ :sup:`2` kg\ :sup:`-1`), and the effective radius of refrozen liquid water (:math:`r_{e,rfz}`) is set to 1000\ :math:`\mu` m. Dry snow aging is based on a microphysical model described by :ref:`Flanner @@ -1036,7 +1041,7 @@ The solar hour angle :math:`h` (radians) is where :math:`d` is calendar day (:math:`d=0.0` at 0Z on January 1), and :math:`\theta` is longitude (radians) (positive east of the -CityplaceGreenwich meridian). +Greenwich meridian). The solar declination angle :math:`\delta` is calculated as in :ref:`Berger (1978a,b) ` and is valid for one million years past or hence, relative to From a890a94e4d26d4174e74ac77bc84de5ff39e567a Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 30 May 2017 14:50:22 -0600 Subject: [PATCH 0026/1973] Chapter 4 updates and cleanup --- .../CLM50_Tech_Note_Radiative_Fluxes.rst | 51 +++++++++++-------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst index 1115bf1dc6..af386af482 100644 --- a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst +++ b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst @@ -14,23 +14,25 @@ where :math:`\vec{S}` is the net solar flux absorbed by the vegetation Solar Fluxes ---------------- -Figure 4.1 illustrates the direct beam and diffuse fluxes in the canopy. +:numref:`Figure schematic diagram of radiation` illustrates the direct beam and diffuse fluxes in the canopy. :math:`I\, \uparrow _{\Lambda }^{\mu }` and :math:`I\, \uparrow _{\Lambda }` are the upward diffuse fluxes, per -unit incident direct beam and diffuse flux (section 3.1). +unit incident direct beam and diffuse flux (section :numref:`Canopy Radiative Transfer`). :math:`I\, \downarrow _{\Lambda }^{\mu }` and :math:`I\, \downarrow _{\Lambda }` \ are the downward diffuse fluxes below the vegetation per unit incident direct beam and diffuse radiation -(section 3.1). The direct beam flux transmitted through the canopy, per +(section :numref:`Canopy Radiative Transfer`). The direct beam flux +transmitted through the canopy, per unit incident flux, is :math:`e^{-K\left(L+S\right)}` . :math:`\vec{I}_{\Lambda }^{\mu }` and :math:`\vec{I}_{\Lambda }^{}` are the fluxes absorbed by the vegetation, per unit incident direct beam -and diffuse radiation (section 3.1). +and diffuse radiation (section :numref:`Canopy Radiative Transfer`). :math:`\alpha _{g,\, \Lambda }^{\mu }` and :math:`\alpha _{g,\, \Lambda }` are the direct beam and diffuse ground -albedos (section 3.2). :math:`L` and :math:`S` are the exposed leaf area -index and stem area index (section 2.1.4). :math:`K` is the optical -depth of direct beam per unit leaf and stem area (section 3.1). +albedos (section :numref:`Ground Albedos`). :math:`L` and :math:`S` are the exposed leaf area +index and stem area index (section :numref:`Phenology and vegetation burial by snow`). +:math:`K` is the optical +depth of direct beam per unit leaf and stem area (section :numref:`Canopy Radiative Transfer`). .. Figure 4.1. Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and reflected by vegetation and ground. @@ -82,7 +84,8 @@ Photosynthesis and transpiration depend non-linearly on solar radiation, via the light response of stomata. The canopy is treated as two leaves (sunlit and shaded) and the solar radiation in the visible waveband (:math:`<` 0.7 µm) absorbed by the vegetation is apportioned to the -sunlit and shaded leaves (section 3.1). The absorbed photosynthetically +sunlit and shaded leaves (section :numref:`Canopy Radiative Transfer`). +The absorbed photosynthetically active (visible waveband) radiation averaged over the sunlit canopy (per unit plant area) is @@ -116,15 +119,17 @@ calculating :math:`L^{sun}` , K=\frac{G\left(\mu \right)}{\mu } where :math:`G\left(\mu \right)` and :math:`\mu` are parameters in the -two-stream approximation (section 3.1). +two-stream approximation (section :numref:`Canopy Radiative Transfer`). The model uses the two-stream approximation to calculate radiative transfer of direct and diffuse radiation through a canopy that is differentiated into leaves that are sunlit and those that are shaded -(section 3.1). The two-stream equations are integrated over all plant +(section :numref:`Canopy Radiative Transfer`). The two-stream equations +are integrated over all plant area (leaf and stem area) in the canopy. The model has an optional -(though not supported) multi-layer canopy, as described by Bonan et al. -(2012). The multi-layer model is only intended to address the +(though not supported) multi-layer canopy, as described by +:ref:`Bonan et al. (2012) `. +The multi-layer model is only intended to address the non-linearity of light profiles, photosynthesis, and stomatal conductance in the plant canopy. @@ -171,8 +176,10 @@ longwave radiation (W m\ :sup:`-2`). The radiative temperature T_{rad} =\left(\frac{L\, \uparrow }{\sigma } \right)^{{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} } -where :math:`\sigma` is the Stefan-Boltzmann constant (W\ m\ :sup:`-2` K\ :sup:`-4`) (Table 2.6). With reference to -Figure 4.1, the upward longwave radiation from the surface to the atmosphere is +where :math:`\sigma` is the Stefan-Boltzmann constant (W\ m\ :sup:`-2` K\ :sup:`-4`) +(:numref:`Table Physical constants`). With reference to +:numref:`Figure schematic diagram of radiation`, the upward longwave radiation +from the surface to the atmosphere is .. math:: :label: 4.11 @@ -185,7 +192,7 @@ the vegetation/soil system for exposed leaf and stem area zero for :math:`L+S<0.05` and one otherwise, :math:`\varepsilon _{g}` is the ground emissivity, and :math:`T_{g}^{n+1}` and :math:`T_{g}^{n}` are the snow/soil surface temperatures at the current -and previous time steps, respectively (Chapter 6). +and previous time steps, respectively (:ref:`rst_Soil and Snow Temperatures`). For non-vegetated surfaces, the above equation reduces to @@ -218,7 +225,8 @@ where where :math:`\varepsilon _{v}` is the vegetation emissivity and :math:`T_{v}^{n+1}` and :math:`T_{v}^{n}` are the vegetation temperatures at the current and previous time steps, respectively -(Chapter 5). The first term in the equation above is the atmospheric +(:ref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`). +The first term in the equation above is the atmospheric longwave radiation that is transmitted through the canopy, reflected by the ground, and transmitted through the canopy to the atmosphere. The second term is the longwave radiation emitted by the canopy directly to @@ -259,10 +267,11 @@ atmosphere) The above expression for :math:`\vec{L}_{g}` is the net longwave radiation forcing that is used in the soil temperature calculation -(Chapter 6). Once updated soil temperatures have been obtained, the term +(:ref:`rst_Soil and Snow Temperatures`). Once updated soil +temperatures have been obtained, the term :math:`4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} \left(T_{g}^{n+1} -T_{g}^{n} \right)` is added to :math:`\vec{L}_{g}` to calculate the ground heat flux -(section 5.4) +(section :numref:`Update of Ground Sensible and Latent Heat Fluxes`) The net longwave radiation flux for vegetation is (positive toward the atmosphere) @@ -282,7 +291,8 @@ emissivity of the ground is where :math:`\varepsilon _{soi} =0.96` for soil, 0.97 for glacier, and 0.96 for wetland, :math:`\varepsilon _{sno} =0.97`, and :math:`f_{sno}` -is the fraction of ground covered by snow (section 7.2.1). The +is the fraction of ground covered by snow +(section :numref:`Snow Covered Area Fraction`). The vegetation emissivity is .. math:: @@ -291,6 +301,7 @@ vegetation emissivity is \varepsilon _{v} =1-e^{-{\left(L+S\right)\mathord{\left/ {\vphantom {\left(L+S\right) \bar{\mu }}} \right. \kern-\nulldelimiterspace} \bar{\mu }} } where :math:`L` and :math:`S` are the leaf and stem area indices -(section 2.1.4) and :math:`\bar{\mu }=1` is the average inverse optical +(section :numref:`Phenology and vegetation burial by snow`) and +:math:`\bar{\mu }=1` is the average inverse optical depth for longwave radiation. From cd853dffbcbd962316c06c6bde789197e38bbf74 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 30 May 2017 15:14:05 -0600 Subject: [PATCH 0027/1973] add links to Introduction --- .../CLM50_Tech_Note_CN_Allocation.rst | 126 ++++---- .../CLM50_Tech_Note_Crop_Irrigation.rst | 166 +++++----- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 66 ++-- .../CLM50_Tech_Note_Decomposition.rst | 208 ++++++------ .../tech_note/Dust/CLM50_Tech_Note_Dust.rst | 68 ++-- ...LM50_Tech_Note_External_Nitrogen_Cycle.rst | 8 +- .../tech_note/Fire/CLM50_Tech_Note_Fire.rst | 87 ++--- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 14 +- .../CLM50_Tech_Note_Introduction.rst | 296 +++++++++--------- .../Isotopes/CLM50_Tech_Note_Isotopes.rst | 8 +- .../Methane/CLM50_Tech_Note_Methane.rst | 119 +++---- .../CLM50_Tech_Note_Radiative_Fluxes.rst | 15 +- ...CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 5 +- .../CLM50_Tech_Note_Transient_Landcover.rst | 14 +- .../tech_note/Urban/CLM50_Tech_Note_Urban.rst | 15 +- ...ech_Note_Vegetation_Phenology_Turnover.rst | 6 +- 16 files changed, 636 insertions(+), 585 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index c6a6fa4aa0..3206f3ab28 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -29,18 +29,22 @@ nitrogen pool tracks retranslocated nitrogen, mobilized from leaf tissue prior to abscission and litterfall. Altogether there are 20 state variables for vegetation carbon, and 19 for vegetation nitrogen. -Figure 13.1. Vegetation fluxes and pools. +.. _Figure Vegetation fluxes and pools: -.. image:: image1.png +.. figure:: image1.png :width: 800px :height: 800px -Figure 13.2: Carbon and nitrogen pools. + Vegetation fluxes and pools. -.. image:: image2.png +.. _Figure Carbon and nitrogen pools: + +.. figure:: image2.png :width: 400px :height: 400px + Carbon and nitrogen pools. + Carbon Allocation for Maintenance Respiration Costs -------------------------------------------------------- @@ -157,7 +161,7 @@ constant for all PFTs, based on construction costs for a range of woody and non-woody tissues (Larcher, 1995). The model includes a dynamic allocation scheme for woody vegetation -(parameter :math:`a_{3}` = -1, Table 13.1), in which case the +(parameter :math:`a_{3}` = -1, :numref:`Table Allocation and CN ratio parameters`), in which case the ratio for carbon allocation between new stem and new leaf increases with increasing net primary production (NPP), as @@ -172,59 +176,61 @@ favorable growth environments (Allen et al., 2005; Vanninen and Makela, 2005) and during the phase of stand growth prior to canopy closure (Axelsson and Axelsson, 1986). -Table 13.1. Allocation and carbon:nitrogen ratio parameters - -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`CN_{leaf}` | :math:`CN_{fr}` | :math:`CN_{lw}` | :math:`CN_{dw}` | -+==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ -| NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| NET Boreal | 1 | 0.3 | -1 | 0.1 | 40 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| NDT Boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BET Tropical | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BET temperate | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDT tropical | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDT temperate | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDT boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BES temperate | 1 | 0.3 | 0.2 | 0.5 | 30 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDS temperate | 1 | 0.3 | 0.2 | 0.5 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDS boreal | 1 | 0.3 | 0.2 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :sub:`3` arctic grass | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :sub:`3` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :sub:`4` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Crop R | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Crop I | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Corn R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Corn I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Temp Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Temp Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Winter Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Winter Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Soybean R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Soybean I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +.. _Table Allocation and CN ratio parameters: + +.. table:: Allocation and carbon\:nitrogen ratio parameters + + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`CN_{leaf}` | :math:`CN_{fr}` | :math:`CN_{lw}` | :math:`CN_{dw}` | + +==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ + | NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | NET Boreal | 1 | 0.3 | -1 | 0.1 | 40 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | NDT Boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | BET Tropical | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | BET temperate | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | BDT tropical | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | BDT temperate | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | BDT boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | BES temperate | 1 | 0.3 | 0.2 | 0.5 | 30 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | BDS temperate | 1 | 0.3 | 0.2 | 0.5 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | BDS boreal | 1 | 0.3 | 0.2 | 0.1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | C\ :sub:`3` arctic grass | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | C\ :sub:`3` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | C\ :sub:`4` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Crop R | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Crop I | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Corn R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Corn I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Temp Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Temp Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Winter Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Winter Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Soybean R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Soybean I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ Carbon to nitrogen ratios are defined for different tissue types as follows: @@ -234,8 +240,8 @@ follows: \begin{array}{l} {CN_{leaf} =\_ {\rm \; C:N\; for\; leaf}} \\ {CN_{fr} =\_ {\rm \; C:N\; for\; fine\; root}} \\ {CN_{lw} =\_ {\rm \; C:N\; for\; live\; wood\; (in\; stem\; and\; coarse\; root)}} \\ {CN_{dw} =\_ {\rm \; C:N\; for\; dead\; wood\; (in\; stem\; and\; coarse\; root)}} \end{array} -where all C:N parameters are defined as constants for a given PFT (Table -13.1). +where all C:N parameters are defined as constants for a given PFT +(:numref:`Table Allocation and CN ratio parameters`). Given values for the parameters in and , total carbon and nitrogen allocation to new growth ( :math:`CF_{alloc}`, gC diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index dc14d45c6b..2961569d3a 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -78,7 +78,7 @@ simulated biogeophysics and biogeochemistry. These advances may improve fully coupled simulations with the Community Earth System Model (CESM), while helping human societies answer questions about changing food, energy, and water resources in response to climate, environmental, land -use, and land management change (e.g., :ref:`Kucharik and Brye 2003 ; Lobell et al. 2006 `). +use, and land management change (e.g., :ref:`Kucharik and Brye 2003 `; :ref:`Lobell et al. 2006 `). .. _Crop plant functional types: @@ -147,12 +147,12 @@ where :math:`{T}_{10d}` is the 10-day running mean of :math:`{T}_{2m}`, (the sim temperature at every model time step) and :math:`T_{10d}^{\min}` is the 10-day running mean of :math:`T_{2m}^{\min }` (the daily minimum of :math:`{T}_{2m}`. :math:`{T}_{p}` and :math:`T_{p}^{\min }` are crop-specific coldest planting temperatures -(Table 20.1), :math:`{GDD}_{8}` is the 20-year running mean growing +(:numref:`Table Crop plant functional types`), :math:`{GDD}_{8}` is the 20-year running mean growing degree-days (units are degree-days or :sup:`o` days) tracked from April through September (NH) base 8\ :sup:`o` C with maximum daily increments of 30\ :sup:`o` days (see Eq.XXX ), and :math:`{GDD}_{min }`\ is the minimum growing degree day requirement -(Table 20.1). Soy must meet the same requirements but between May +(:numref:`Table Crop plant functional types`). Soy must meet the same requirements but between May 1\ :sup:`st` and June 14\ :sup:`th` for planting. If the requirements in Eq. are not met by June 14\ :sup:`th`, then corn, soybean, and temperate cereals are still planted on June @@ -202,7 +202,7 @@ Leaf emergence According to AgroIBIS, leaves may emerge when the growing degree-days of soil temperature to 0.05 m depth tracked since planting (:math:`GDD_{T_{soi} }` ) reaches 3 to 5% of :math:`{GDD}_{mat}` -(Table 20.1). :math:`GDD_{T_{soi} }` is base 8, 0, and +(:numref:`Table Crop plant functional types`). :math:`GDD_{T_{soi} }` is base 8, 0, and 10\ :math:`{}^\circ`\ C for corn, soybean, and temperate cereals. Leaf onset, as defined in the CN part of the model, occurs in the first time step of phase 2, at which moment all seed C is transferred to leaf @@ -217,7 +217,7 @@ Grain fill Phase 3 begins in a similar way to phase 2. A variable tracked since planting like :math:`GDD_{T_{soi} }` but for 2-m air temperature, :math:`GDD_{T_{{\rm 2m}} }`, must reach a heat unit threshold, *h*, -of 40 to 70% of :math:`{GDD}_{mat}` (Table 20.1). For corn the +of 40 to 70% of :math:`{GDD}_{mat}` (:numref:`Table Crop plant functional types`). For corn the percentage itself is an empirical function of :math:`{GDD}_{mat}` (not shown). In phase 3, the leaf area index begins to decline in response to a background litterfall rate calculated as the inverse of @@ -365,42 +365,42 @@ crop and from each other: #. Slope, *m*, of conductance-to-photosynthesis relationship from 9 to 4 for C4 crops as in AgroIBIS. -#. Specific leaf areas, *SLA*, to the AgroIBIS values (Table 20.1). +#. Specific leaf areas, *SLA*, to the AgroIBIS values (:numref:`Table Crop plant functional types`). -#. Leaf orientation, :math:`\chi _{L}`, to the AgroIBIS values (Table 20.1). +#. Leaf orientation, :math:`\chi _{L}`, to the AgroIBIS values (:numref:`Table Crop plant functional types`). #. Soil moisture photosynthesis limitation factor, :math:`\beta _{t}`, for soybeans multiplied as in AgroIBIS by 1.25 for increased drought tolerance. -Table 20.1. Crop plant functional types (pfts) in CLM4.5CNcrop and their -parameters relating to phenology and morphology. Numbers in the first -column correspond to the list of pfts in Table 2.1. - -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| | Phenological | :math:`T_{p}` | :math:`T_{p}^{\min }` | :math:`{GDD}_{min}` | :math:`{GDD}_{mat}` | Phase 2 | Phase 3 | Harvest: days | :math:`z_{top}^{\max }` | *SLA* | :math:`\chi _{L}` | | -| | Type | K | K | ºdays | ºdays | %\ :math:`{GDD}_{mat}` | %\ :math:`{GDD}_{mat}` | past planting | m | m\ :sup:`2`\ leaf g\ :sup:`-1`\ C | index | | -+=======+==============================================+======================+==============================+===========================+===========================+==============================+==============================+=================+==============================+=================================================+========================+====+ -| 15. | C\ :sub:`3` unmanaged rainfed crop | | | | | | | 0.03 | -0.30 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 16. | C\ :sub:`3` unmanaged irrigated crop | | | | | | | 0.03 | -0.30 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 17. | Rainfed Corn (also known as Maize) | | 950-1850 | 3 | 55-65 | :math:`\mathrm{\le}`\ 165 | 2.50 | 0.05 | -0.50 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 18. | Irrigated Corn (also known as Maize) | | 950-1850 | 3 | 55-65 | :math:`\mathrm{\le}`\ 165 | 2.50 | 0.05 | -0.50 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 19. | Rainfed Temperate Cereals | | :math:`\mathrm{\le}`\ 1700 | 5 | 60 | :math:`\mathrm{\le}`\ 150 | 1.20 | 0.07 | 0.65 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 20. | Irrigated Temperate Cereals | | :math:`\mathrm{\le}`\ 1700 | 5 | 60 | :math:`\mathrm{\le}`\ 150 | 1.20 | 0.07 | 0.65 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 21. | Rainfed Winter cereals (place holder) | | 1900 | 5 | 40 | :math:`\mathrm{\le}`\ 265 | 1.20 | 0.07 | 0.65 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 22. | Irrigated Winter cereals (place holder) | | 1900 | 5 | 40 | :math:`\mathrm{\le}`\ 265 | 1.20 | 0.07 | 0.65 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 23. | Rainfed Soybean | | :math:`\mathrm{\le}`\ 1700 | 3 | 70 | :math:`\mathrm{\le}`\ 150 | 0.75 | 0.07 | -0.50 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ -| 24. | Irrigated Soybean | | :math:`\mathrm{\le}`\ 1700 | 3 | 70 | :math:`\mathrm{\le}`\ 150 | 0.75 | 0.07 | -0.50 | | | | -+-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ +.. _Table Crop plant functional types: + +.. table:: Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. + + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | | Phenological | :math:`T_{p}` | :math:`T_{p}^{\min }` | :math:`{GDD}_{min}` | :math:`{GDD}_{mat}` | Phase 2 | Phase 3 | Harvest: days | :math:`z_{top}^{\max }` | *SLA* | :math:`\chi _{L}` | | + | | Type | K | K | ºdays | ºdays | %\ :math:`{GDD}_{mat}` | %\ :math:`{GDD}_{mat}` | past planting | m | m\ :sup:`2`\ leaf g\ :sup:`-1`\ C | index | | + +=======+==============================================+======================+==============================+===========================+===========================+==============================+==============================+=================+==============================+=================================================+========================+====+ + | 15. | C\ :sub:`3` unmanaged rainfed crop | | | | | | | 0.03 | -0.30 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 16. | C\ :sub:`3` unmanaged irrigated crop | | | | | | | 0.03 | -0.30 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 17. | Rainfed Corn (also known as Maize) | | 950-1850 | 3 | 55-65 | :math:`\mathrm{\le}`\ 165 | 2.50 | 0.05 | -0.50 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 18. | Irrigated Corn (also known as Maize) | | 950-1850 | 3 | 55-65 | :math:`\mathrm{\le}`\ 165 | 2.50 | 0.05 | -0.50 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 19. | Rainfed Temperate Cereals | | :math:`\mathrm{\le}`\ 1700 | 5 | 60 | :math:`\mathrm{\le}`\ 150 | 1.20 | 0.07 | 0.65 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 20. | Irrigated Temperate Cereals | | :math:`\mathrm{\le}`\ 1700 | 5 | 60 | :math:`\mathrm{\le}`\ 150 | 1.20 | 0.07 | 0.65 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 21. | Rainfed Winter cereals (place holder) | | 1900 | 5 | 40 | :math:`\mathrm{\le}`\ 265 | 1.20 | 0.07 | 0.65 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 22. | Irrigated Winter cereals (place holder) | | 1900 | 5 | 40 | :math:`\mathrm{\le}`\ 265 | 1.20 | 0.07 | 0.65 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 23. | Rainfed Soybean | | :math:`\mathrm{\le}`\ 1700 | 3 | 70 | :math:`\mathrm{\le}`\ 150 | 0.75 | 0.07 | -0.50 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ + | 24. | Irrigated Soybean | | :math:`\mathrm{\le}`\ 1700 | 3 | 70 | :math:`\mathrm{\le}`\ 150 | 0.75 | 0.07 | -0.50 | | | | + +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ Notes: :math:`T_{p}` and :math:`T_{p}^{\min }` are coldest planting temperatures but for winter cereals :math:`T_{p}^{\min }` @@ -416,30 +416,31 @@ top-of-canopy height of a crop, *SLA* is specific leaf area, and leaf orientation index, :math:`\chi _{L}` , equals -1 for vertical, 0 for random, and 1 for horizontal leaf orientation. -Table 20.2. Crop pfts in CLM4.5CNcrop and their parameters relating to -allocation. Numbers in the first column correspond to the list of pfts in Table 2.1. - -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| | :math:`a_{leaf}^{i}` | :math:`{L}_{max}` | :math:`a_{froot}^{i}` | :math:`a_{froot}^{f}` | :math:`a_{leaf}^{f}` | :math:`a_{livestem}^{f}` | :math:`d_{L}` | :math:`d_{alloc}^{stem}` | :math:`d_{alloc}^{leaf}` | | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| | fraction | m\ :sup:`2` m\ :sup:`-2` | | | | | | | | | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| 17. | Rainfed Corn (also referred to as Maize) | 0.800 | 5 | 0.400 | 0.050 | 0.000 | 0.000 | 1.05 | 2 | 5 | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| 18. | Irrigated Corn (also referred to as Maize) | 0.800 | 5 | 0.400 | 0.050 | 0.000 | 0.000 | 1.05 | 2 | 5 | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| 19. | Rainfed Temperate Cereals | 0.750 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| 20. | Irrigated Temperate Cereals | 0.750 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| 21. | Rainfed Winter cereals (place holder) | 0.425 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| 22. | Irrigated Winter cereals (place holder) | 0.425 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| 23. | Rainfed Soybean | 0.850 | 6 | 0.500 | 0.200 | 0.000 | 0.300 | 1.05 | 5 | 2 | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ -| 24. | Irrigated Soybean | 0.850 | 6 | 0.500 | 0.200 | 0.000 | 0.300 | 1.05 | 5 | 2 | -+-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ +.. _Table Crop pfts in CLM4.5CNcrop and their parameters: + +.. table:: Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. + + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | | :math:`a_{leaf}^{i}` | :math:`{L}_{max}` | :math:`a_{froot}^{i}` | :math:`a_{froot}^{f}` | :math:`a_{leaf}^{f}` | :math:`a_{livestem}^{f}` | :math:`d_{L}` | :math:`d_{alloc}^{stem}` | :math:`d_{alloc}^{leaf}` | | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | | fraction | m\ :sup:`2` m\ :sup:`-2` | | | | | | | | | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | 17. | Rainfed Corn (also referred to as Maize) | 0.800 | 5 | 0.400 | 0.050 | 0.000 | 0.000 | 1.05 | 2 | 5 | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | 18. | Irrigated Corn (also referred to as Maize) | 0.800 | 5 | 0.400 | 0.050 | 0.000 | 0.000 | 1.05 | 2 | 5 | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | 19. | Rainfed Temperate Cereals | 0.750 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | 20. | Irrigated Temperate Cereals | 0.750 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | 21. | Rainfed Winter cereals (place holder) | 0.425 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | 22. | Irrigated Winter cereals (place holder) | 0.425 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | 23. | Rainfed Soybean | 0.850 | 6 | 0.500 | 0.200 | 0.000 | 0.300 | 1.05 | 5 | 2 | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ + | 24. | Irrigated Soybean | 0.850 | 6 | 0.500 | 0.200 | 0.000 | 0.300 | 1.05 | 5 | 2 | + +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ Notes: Crop growth phases and corresponding variables are described in the text @@ -753,7 +754,7 @@ where :math:`{C}_{leaf}`, :math:`{C}_{stem}`, and :math:`{C}_{froot}` is the car root, respectively, :math:`{CN}_{leaf}`, :math:`{CN}_{stem}`, and :math:`{CN}_{froot}` is the pre-grain fill C:N ratio of the leaf, stem, and fine root respectively, and :math:`CN^f_{leaf}`, :math:`CN^f_{stem}`, and :math:`CN^f_{froot}` is the post-grain fill C:N -ratio of the leaf, stem, and fine root respectively (Table 20.3). Since +ratio of the leaf, stem, and fine root respectively (:numref:`Table Pre- and post-grain fill CN ratios`). Since C:N measurements are taken from mature crops, pre-grain development C:N ratios for leaves, stems, and roots are optimized to allow maximum nitrogen accumulation for later use during organ development. Post-grain @@ -765,28 +766,29 @@ retranslocated pool equal to the plant nitrogen demand. Once the retranslocation pool is depleted, soil mineral nitrogen pool is used to fulfill plant nitrogen demands. -Table 20.3. Pre- and post-grain fill C:N ratios for crop leaf, stem, -fine root, and reproductive pools. - -+----------------------------+--------+---------------------+-----------+ -| Pre-grain fill stage | Corn | Temperate Cereals | Soybean | -+============================+========+=====================+===========+ -| :math:`{CN}_{leaf}` | 10 | 15 | 25 | -+----------------------------+--------+---------------------+-----------+ -| :math:`{CN}_{stem}` | 50 | 50 | 50 | -+----------------------------+--------+---------------------+-----------+ -| :math:`{CN}_{froot}` | 42 | 30 | 42 | -+----------------------------+--------+---------------------+-----------+ -| Post-grain fill stage | | | | -+----------------------------+--------+---------------------+-----------+ -| :math:`CN_{leaf}^{f}` | 65 | 65 | 65 | -+----------------------------+--------+---------------------+-----------+ -| :math:`CN_{stem}^{f}` | 120 | 100 | 130 | -+----------------------------+--------+---------------------+-----------+ -| :math:`CN_{froot}^{f}` | 42 | 40 | 42 | -+----------------------------+--------+---------------------+-----------+ -| :math:`CN_{repr}^{f}` | 50 | 40 | 60 | -+----------------------------+--------+---------------------+-----------+ +.. _Table Pre- and post-grain fill CN ratios: + +.. table:: Pre- and post-grain fill C:N ratios for crop leaf, stem, fine root, and reproductive pools. + + +----------------------------+--------+---------------------+-----------+ + | Pre-grain fill stage | Corn | Temperate Cereals | Soybean | + +============================+========+=====================+===========+ + | :math:`{CN}_{leaf}` | 10 | 15 | 25 | + +----------------------------+--------+---------------------+-----------+ + | :math:`{CN}_{stem}` | 50 | 50 | 50 | + +----------------------------+--------+---------------------+-----------+ + | :math:`{CN}_{froot}` | 42 | 30 | 42 | + +----------------------------+--------+---------------------+-----------+ + | Post-grain fill stage | | | | + +----------------------------+--------+---------------------+-----------+ + | :math:`CN_{leaf}^{f}` | 65 | 65 | 65 | + +----------------------------+--------+---------------------+-----------+ + | :math:`CN_{stem}^{f}` | 120 | 100 | 130 | + +----------------------------+--------+---------------------+-----------+ + | :math:`CN_{froot}^{f}` | 42 | 40 | 42 | + +----------------------------+--------+---------------------+-----------+ + | :math:`CN_{repr}^{f}` | 50 | 40 | 60 | + +----------------------------+--------+---------------------+-----------+ .. _Separate reproductive pool: diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 4a7d378379..8608521802 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -40,7 +40,7 @@ The PFT distribution in the vegetated land unit is typically prescribed in CLM (see section 2.1.2) except for the case when CNDV is active. In CNDV the model begins with no PFT information per grid cell and evaluates whether or not a PFT may establish or survive according to the -PFT’s bioclimatic limits (Table 22.1). Shrub PFTs are treated as trees +PFT’s bioclimatic limits (:numref:`Table Plant functional type (PFT) biogeography rules`). Shrub PFTs are treated as trees at establishment. CNDV omits the CLM3DGVM’s annual introduction of saplings when a PFT can @@ -113,8 +113,39 @@ values in the old PFT-physiology file to get a reasonable simulation of PFTs. For CNDV to use the calculated fraction, we will need to change the algorithm for PFTs in early stages of growth. -Table 22.1. Plant functional type (PFT) biogeography rules with respect -to climate. +.. _Table Plant functional type (PFT) biogeography rules: + +.. table:: Plant functional type (PFT) biogeography rules with respect to climate. + + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | | Survival | | | | + +=============================================+==============================================+==============================================+=========================+========+ + | | :math:`{T}_{c,min}` (:math:`\circ`\ C) | :math:`{T}_{c,max}` (:math:`\circ`\ C) | :math:`{GDD}_{min}` | | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Tropical broadleaf evergreen tree (BET) | | 15.5 | No limit | 0 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Tropical broadleaf deciduous tree (BDT) | | 15.5 | No limit | 0 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Temperate needleleaf evergreen tree (NET) | | -2.0 | 22.0 | 900 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Temperate broadleaf evergreen tree (BET) | | 3.0 | 18.8 | 1200 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Temperate broadleaf deciduous tree (BDT) | | -17.0 | 15.5 | 1200 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Boreal needleleaf evergreen tree (NET) | | -32.5 | -2.0 | 600 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Boreal deciduous tree | | No limit | -2.0 | 350 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Temperate broadleaf deciduous shrub (BDS) | | -17.0 | No limit | 1200 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | Boreal broadleaf deciduous shrub (BDS) | | No limit | -2.0 | 350 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | C\ :sub:`4` | | 15.5 | No limit | 0 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | C\ :sub:`3` | | -17.0 | 15.5 | 0 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ + | C\ :sub:`3` arctic | | No limit | -17.0 | 0 | + +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ Adapted from Table 1 of Levis et al. (2004) to include shrub PFTs. :math:`T_{c,\min }` , coldest minimum monthly air temperature for @@ -124,32 +155,3 @@ minimum monthly air temperature for establishment of new PFTs; 5\ :math:`{}^\circ`\ C for establishment of new PFTs. Levis et al. (2004) include an explanation of these variables and their use. -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| | Survival | | | | -+=============================================+==============================================+==============================================+=========================+========+ -| | :math:`{T}_{c,min}` (:math:`\circ`\ C) | :math:`{T}_{c,max}` (:math:`\circ`\ C) | :math:`{GDD}_{min}` | | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Tropical broadleaf evergreen tree (BET) | | 15.5 | No limit | 0 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Tropical broadleaf deciduous tree (BDT) | | 15.5 | No limit | 0 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Temperate needleleaf evergreen tree (NET) | | -2.0 | 22.0 | 900 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Temperate broadleaf evergreen tree (BET) | | 3.0 | 18.8 | 1200 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Temperate broadleaf deciduous tree (BDT) | | -17.0 | 15.5 | 1200 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Boreal needleleaf evergreen tree (NET) | | -32.5 | -2.0 | 600 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Boreal deciduous tree | | No limit | -2.0 | 350 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Temperate broadleaf deciduous shrub (BDS) | | -17.0 | No limit | 1200 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| Boreal broadleaf deciduous shrub (BDS) | | No limit | -2.0 | 350 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| C\ :sub:`4` | | 15.5 | No limit | 0 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| C\ :sub:`3` | | -17.0 | 15.5 | 0 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ -| C\ :sub:`3` arctic | | No limit | -17.0 | 0 | -+---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index 4686f649c2..d35feab5be 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -17,14 +17,16 @@ slower decomposition rates, based on the Century model (Parton et al. allow :math:`{n}_{lev}` to equal 1, as in CLM4.0, or to equal the number of soil levels used for the soil hydrology (default 10). -Figure 15.1. Schematic of decomposition model in CLM. +.. _Figure Schematic of decomposition model in CLM: + +.. figure:: image1.png + + Schematic of decomposition model in CLM. Model is structured to allow different representations of the soil C and N decomposition cascade, as well as a vertically-explicit treatment of soil biogeochemistry. -.. image:: image1.png - For the single-level model structure, the fundamental equation for carbon balance of the decomposing pools is: @@ -60,11 +62,13 @@ pools. Further discussion of the vertical distribution of carbon inputs Discussion of the vertical model and analysis of both decomposition structures is in Koven et al (2013). -Figure 15.2. Pool structure, transitions, respired fractions (numbers at -end of arrows), and turnover times (numbers in boxes) for the 2 -alternate soil decomposition models included in CLM. +.. _Figure Pool structure: + +.. figure:: image2.png -.. image:: image2.png + Pool structure, transitions, respired fractions (numbers at + end of arrows), and turnover times (numbers in boxes) for the 2 + alternate soil decomposition models included in CLM. CLM-CN Pool Structure, Rate Constants and Parameters --------------------------------------------------------- @@ -90,39 +94,39 @@ estimate exponential decay rates and respiration fractions (Thornton, conducted at constant temperature and under moist conditions with relatively high mineral nitrogen concentrations, and so the resulting rate constants are assumed not limited by the availability of water or -mineral nitrogen. Table 15.1 lists the base decomposition rates for each +mineral nitrogen. :numref:`Table Decomposition rate constants` lists the base decomposition rates for each litter and SOM pool, as well as a base rate for physical fragmentation for the coarse woody debris pool (CWD). -Table 15.1. Decomposition rate constants for litter and SOM pools, C:N -ratios, and acceleration parameters (see section 15.8 for explanation) -for the CLM-CN decomposition pool structure. - -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| | Biome-BGC | CLM-CN | | | -+==========================+================================================+===============================================+===============+=========================================+ -| | :math:`{k}_{disc1}`\ (d\ :sup:`-1`) | :math:`{k}_{disc2}` (hr\ :sup:`-1`) | *C:N ratio* | Acceleration term (:math:`{a}_{i}`) | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| :math:`{k}_{Lit1}` | 0.7 | 0.04892 | - | 1 | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| :math:`{k}_{Lit2}` | 0.07 | 0.00302 | - | 1 | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| :math:`{k}_{Lit3}` | 0.014 | 0.00059 | - | 1 | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| :math:`{k}_{SOM1}` | 0.07 | 0.00302 | 12 | 1 | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| :math:`{k}_{SOM2}` | 0.014 | 0.00059 | 12 | 1 | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| :math:`{k}_{SOM3}` | 0.0014 | 0.00006 | 10 | 5 | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| :math:`{k}_{SOM4}` | 0.0001 | 0.000004 | 10 | 70 | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ -| :math:`{k}_{CWD}` | 0.001 | 0.00004 | - | 1 | -+--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ - -The first column of Table 15.1 gives the rates as used for the Biome-BGC +.. _Table Decomposition rate constants: + +.. table:: Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. + + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | | Biome-BGC | CLM-CN | | | + +==========================+================================================+===============================================+===============+=========================================+ + | | :math:`{k}_{disc1}`\ (d\ :sup:`-1`) | :math:`{k}_{disc2}` (hr\ :sup:`-1`) | *C:N ratio* | Acceleration term (:math:`{a}_{i}`) | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | :math:`{k}_{Lit1}` | 0.7 | 0.04892 | - | 1 | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | :math:`{k}_{Lit2}` | 0.07 | 0.00302 | - | 1 | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | :math:`{k}_{Lit3}` | 0.014 | 0.00059 | - | 1 | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | :math:`{k}_{SOM1}` | 0.07 | 0.00302 | 12 | 1 | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | :math:`{k}_{SOM2}` | 0.014 | 0.00059 | 12 | 1 | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | :math:`{k}_{SOM3}` | 0.0014 | 0.00006 | 10 | 5 | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | :math:`{k}_{SOM4}` | 0.0001 | 0.000004 | 10 | 70 | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + | :math:`{k}_{CWD}` | 0.001 | 0.00004 | - | 1 | + +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ + +The first column of :numref:`Table Decomposition rate constants` gives the rates as used for the Biome-BGC model, which uses a discrete-time model with a daily timestep. The -second column of Table 15.1 shows the rates transformed for a one-hour +second column of :numref:`Table Decomposition rate constants` shows the rates transformed for a one-hour discrete timestep typical of CLM-CN. The transformation is based on the conversion of the initial discrete-time value (:math:`{k}_{disc1}`) first to a continuous time value (:math:`{k}_{cont}`), then to the @@ -150,27 +154,29 @@ or SOM pools that is released as CO\ :sub:`2` due to heterotrophic respiration. Respiration fractions and exponential decay rates are estimated simultaneously from the results of microcosm decomposition experiments (Thornton, 1998). The same values are used in CLM-CN and -Biome-BGC (Table 15.2). - -Table 15.2. Respiration fractions for litter and SOM pools - -+---------------------------+-----------------------+ -| Pool | *rf* | -+===========================+=======================+ -| :math:`{rf}_{Lit1}` | 0.39 | -+---------------------------+-----------------------+ -| :math:`{rf}_{Lit2}` | 0.55 | -+---------------------------+-----------------------+ -| :math:`{rf}_{Lit3}` | 0.29 | -+---------------------------+-----------------------+ -| :math:`{rf}_{SOM1}` | 0.28 | -+---------------------------+-----------------------+ -| :math:`{rf}_{SOM2}` | 0.46 | -+---------------------------+-----------------------+ -| :math:`{rf}_{SOM3}` | 0.55 | -+---------------------------+-----------------------+ -| :math:`{rf}_{SOM4}` | :math:`{1.0}^{a}` | -+---------------------------+-----------------------+ +Biome-BGC (:numref:`Table Respiration fractions for litter and SOM pools`). + +.. _Table Respiration fractions for litter and SOM pools: + +.. table:: Respiration fractions for litter and SOM pools + + +---------------------------+-----------------------+ + | Pool | *rf* | + +===========================+=======================+ + | :math:`{rf}_{Lit1}` | 0.39 | + +---------------------------+-----------------------+ + | :math:`{rf}_{Lit2}` | 0.55 | + +---------------------------+-----------------------+ + | :math:`{rf}_{Lit3}` | 0.29 | + +---------------------------+-----------------------+ + | :math:`{rf}_{SOM1}` | 0.28 | + +---------------------------+-----------------------+ + | :math:`{rf}_{SOM2}` | 0.46 | + +---------------------------+-----------------------+ + | :math:`{rf}_{SOM3}` | 0.55 | + +---------------------------+-----------------------+ + | :math:`{rf}_{SOM4}` | :math:`{1.0}^{a}` | + +---------------------------+-----------------------+ :sup:`a`:math:`{}^{a}` The respiration fraction for pool SOM4 is 1.0 by definition: since there is no pool downstream of SOM4, the entire carbon @@ -184,49 +190,51 @@ decay model; the two structures differ in the number of pools, the connections between those pools, the turnover times of the pools, and the respired fraction during each transition (Figure 15.2). The turnover times are different for the Century-based pool structure, following -those described in Parton et al. (1988) (Table 15.3). - -Table 15.3. Turnover times, C:N ratios, and acceleration parameters (see -section 15.8 for explanation) for the Century-based decomposition -cascade. - -+------------+------------------------+-------------+-------------------------------------------+ -| | Turnover time (year) | C:N ratio | Acceleration term (:math:`{a}_{i}`) | -+============+========================+=============+===========================================+ -| CWD | 4.1 | - | 1 | -+------------+------------------------+-------------+-------------------------------------------+ -| Litter 1 | 0.066 | - | 1 | -+------------+------------------------+-------------+-------------------------------------------+ -| Litter 2 | 0.25 | - | 1 | -+------------+------------------------+-------------+-------------------------------------------+ -| Litter 3 | 0.25 | - | 1 | -+------------+------------------------+-------------+-------------------------------------------+ -| SOM 1 | 0.17 | 8 | 1 | -+------------+------------------------+-------------+-------------------------------------------+ -| SOM 2 | 6.1 | 11 | 15 | -+------------+------------------------+-------------+-------------------------------------------+ -| SOM 3 | 270 | 11 | 675 | -+------------+------------------------+-------------+-------------------------------------------+ - -Likewise, values for the respiration fraction of Century-based structure are in Table 15.4. - -Table 15.4. Respiration fractions for litter and SOM pools for Century-based structure - -+---------------------------+----------+ -| Pool | *rf* | -+===========================+==========+ -| :math:`{rf}_{Lit1}` | 0.55 | -+---------------------------+----------+ -| :math:`{rf}_{Lit2}` | 0.5 | -+---------------------------+----------+ -| :math:`{rf}_{Lit3}` | 0.5 | -+---------------------------+----------+ -| :math:`{rf}_{SOM1}` | f(txt) | -+---------------------------+----------+ -| :math:`{rf}_{SOM2}` | 0.55 | -+---------------------------+----------+ -| :math:`{rf}_{SOM3}` | 0.55 | -+---------------------------+----------+ +those described in Parton et al. (1988) (:numref:`Table Turnover times`). + +.. _Table Turnover times: + +.. table:: Turnover times, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the Century-based decomposition cascade. + + +------------+------------------------+-------------+-------------------------------------------+ + | | Turnover time (year) | C:N ratio | Acceleration term (:math:`{a}_{i}`) | + +============+========================+=============+===========================================+ + | CWD | 4.1 | - | 1 | + +------------+------------------------+-------------+-------------------------------------------+ + | Litter 1 | 0.066 | - | 1 | + +------------+------------------------+-------------+-------------------------------------------+ + | Litter 2 | 0.25 | - | 1 | + +------------+------------------------+-------------+-------------------------------------------+ + | Litter 3 | 0.25 | - | 1 | + +------------+------------------------+-------------+-------------------------------------------+ + | SOM 1 | 0.17 | 8 | 1 | + +------------+------------------------+-------------+-------------------------------------------+ + | SOM 2 | 6.1 | 11 | 15 | + +------------+------------------------+-------------+-------------------------------------------+ + | SOM 3 | 270 | 11 | 675 | + +------------+------------------------+-------------+-------------------------------------------+ + +Likewise, values for the respiration fraction of Century-based structure are in :numref:`Table Respiration fractions for Century-based structure`. + +.. _Table Respiration fractions for Century-based structure: + +.. table:: Respiration fractions for litter and SOM pools for Century-based structure + + +---------------------------+----------+ + | Pool | *rf* | + +===========================+==========+ + | :math:`{rf}_{Lit1}` | 0.55 | + +---------------------------+----------+ + | :math:`{rf}_{Lit2}` | 0.5 | + +---------------------------+----------+ + | :math:`{rf}_{Lit3}` | 0.5 | + +---------------------------+----------+ + | :math:`{rf}_{SOM1}` | f(txt) | + +---------------------------+----------+ + | :math:`{rf}_{SOM2}` | 0.55 | + +---------------------------+----------+ + | :math:`{rf}_{SOM3}` | 0.55 | + +---------------------------+----------+ Environmental modifiers on decomposition rate -------------------------------------------------- diff --git a/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst b/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst index 381367a4c0..2b3bfa6dd7 100644 --- a/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst +++ b/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst @@ -83,8 +83,8 @@ flux where the saltation constant :math:`c_{s}` equals 2.61 and :math:`\rho _{atm}` is the atmospheric density (kg m\ :sup:`-3`) -(Table 2.3), :math:`g` the acceleration of gravity (m -s\ :sup:`-2`) (Table 2.6). The threshold wind friction speed for saltation :math:`u_{*t}` (m s\ :sup:`-1`) is +(:numref:`Table Atmospheric input to land model`), :math:`g` the acceleration of gravity (m +s\ :sup:`-2`) (:numref:`Table Physical constants`). The threshold wind friction speed for saltation :math:`u_{*t}` (m s\ :sup:`-1`) is .. math:: :label: ZEqnNum888452 @@ -120,7 +120,7 @@ where :math:`a=M_{clay}^{-1}` for tuning purposes, :math:`\theta _{1}` is the volumetric soil moisture in the top soil layer (m:math:`{}^{3 }`\ m\ :sup:`-3`) (section 7.4), :math:`\rho _{liq}` is the density of liquid water (kg -m\ :sup:`-3`) (Table 2.6), and :math:`\rho _{d,\, 1}` is the bulk +m\ :sup:`-3`) (:numref:`Table Physical constants`), and :math:`\rho _{d,\, 1}` is the bulk density of soil in the top soil layer (kg m\ :sup:`-3`) defined as in section 6.3 rather than as in Zender et al. (2003). :math:`Re_{*t}^{f}` from equation is the threshold friction Reynolds @@ -172,34 +172,36 @@ mode :math:`i` carried in each of *:math:`J=4`* transport bins :math:`j` where :math:`m_{i}` , :math:`\tilde{D}_{v,\, i}` , and :math:`\sigma _{g,\, i}` are the mass fraction, mass median diameter, and geometric standard deviation assigned to each particle source mode -:math:`i` (Table 24.1), while :math:`D_{j,\, \min }` and +:math:`i` (:numref:`Table Dust Mass fraction`), while :math:`D_{j,\, \min }` and :math:`D_{j,\, \max }` are the minimum and maximum diameters (m) in -each transport bin :math:`j` ** (Table 24.2). - -Table 24.1. Mass fraction :math:`m_{i}` , mass median diameter -:math:`\tilde{D}_{v,\, i}` , and geometric standard deviation -:math:`\sigma _{g,\, i}` , per dust source mode :math:`i` - -+-------------+-----------------------------+-----------------------------------+-----------------------------+ -| :math:`i` | :math:`m_{i}` (fraction) | :math:`\tilde{D}_{v,\, i}` (m) | :math:`\sigma _{g,\, i}` | -+=============+=============================+===================================+=============================+ -| 1 | 0.036 | 0.832 x 10\ :math:`{}^{-6}` | 2.1 | -+-------------+-----------------------------+-----------------------------------+-----------------------------+ -| 2 | 0.957 | 4.820 x 10\ :math:`{}^{-6}` | 1.9 | -+-------------+-----------------------------+-----------------------------------+-----------------------------+ -| 3 | 0.007 | 19.38 x 10\ :math:`{}^{-6}` | 1.6 | -+-------------+-----------------------------+-----------------------------------+-----------------------------+ - -Table 24.2. Minimum and maximum particle diameters in each dust transport bin :math:`j` - -+-------------+-------------------------------+-------------------------------+ -| :math:`j` | :math:`D_{j,\, \min }` (m) | :math:`D_{j,\, \max }` (m) | -+=============+===============================+===============================+ -| 1 | 0.1 x 10\ :math:`{}^{-6}` | 1.0 x 10\ :math:`{}^{-6}` | -+-------------+-------------------------------+-------------------------------+ -| 2 | 1.0 x 10\ :math:`{}^{-6}` | 2.5 x 10\ :math:`{}^{-6}` | -+-------------+-------------------------------+-------------------------------+ -| 3 | 2.5 x 10\ :math:`{}^{-6}` | 5.0 x 10\ :math:`{}^{-6}` | -+-------------+-------------------------------+-------------------------------+ -| 4 | 5.0 x 10\ :math:`{}^{-6}` | 10.0 x 10\ :math:`{}^{-6}` | -+-------------+-------------------------------+-------------------------------+ +each transport bin :math:`j` ** (:numref:`Table Dust Minimum and maximum particle diameters`). + +.. _Table Dust Mass fraction: + +.. table:: Mass fraction :math:`m_{i}` , mass median diameter :math:`\tilde{D}_{v,\, i}` , and geometric standard deviation :math:`\sigma _{g,\, i}` , per dust source mode :math:`i` + + +-------------+-----------------------------+-----------------------------------+-----------------------------+ + | :math:`i` | :math:`m_{i}` (fraction) | :math:`\tilde{D}_{v,\, i}` (m) | :math:`\sigma _{g,\, i}` | + +=============+=============================+===================================+=============================+ + | 1 | 0.036 | 0.832 x 10\ :math:`{}^{-6}` | 2.1 | + +-------------+-----------------------------+-----------------------------------+-----------------------------+ + | 2 | 0.957 | 4.820 x 10\ :math:`{}^{-6}` | 1.9 | + +-------------+-----------------------------+-----------------------------------+-----------------------------+ + | 3 | 0.007 | 19.38 x 10\ :math:`{}^{-6}` | 1.6 | + +-------------+-----------------------------+-----------------------------------+-----------------------------+ + +.. _Table Dust Minimum and maximum particle diameters: + +.. table:: Minimum and maximum particle diameters in each dust transport bin :math:`j` + + +-------------+-------------------------------+-------------------------------+ + | :math:`j` | :math:`D_{j,\, \min }` (m) | :math:`D_{j,\, \max }` (m) | + +=============+===============================+===============================+ + | 1 | 0.1 x 10\ :math:`{}^{-6}` | 1.0 x 10\ :math:`{}^{-6}` | + +-------------+-------------------------------+-------------------------------+ + | 2 | 1.0 x 10\ :math:`{}^{-6}` | 2.5 x 10\ :math:`{}^{-6}` | + +-------------+-------------------------------+-------------------------------+ + | 3 | 2.5 x 10\ :math:`{}^{-6}` | 5.0 x 10\ :math:`{}^{-6}` | + +-------------+-------------------------------+-------------------------------+ + | 4 | 5.0 x 10\ :math:`{}^{-6}` | 10.0 x 10\ :math:`{}^{-6}` | + +-------------+-------------------------------+-------------------------------+ diff --git a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst index 2678b845e7..b8f6536a46 100644 --- a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst +++ b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst @@ -88,10 +88,12 @@ on the carbon supply to nitrogen fixing microorganisms (Cleveland et al. where :math:`{NF}_{nfix,sminn}` (gN m\ :sup:`-2` s\ :sup:`-1`) is the rate of BNF. Eq. is plotted over a range of annual NPP in Figure 16.1. -Figure 16.1. Biological nitrogen fixation as a function of annual net -primary production. +.. _Figure Biological nitrogen fixation: + +.. figure:: image1.png -.. image:: image1.png + Biological nitrogen fixation as a function of annual net +primary production. Because of the empirical nature of this NPP-BNF relationship, the timescale for calculating NPP and thus BNF is unconstrained. Using diff --git a/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst b/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst index 74e2c334da..d6b6495827 100644 --- a/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst +++ b/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst @@ -336,7 +336,7 @@ where :math:`A_{b,j}` (km\ :sup:`2`\ (time step)\ :sup:`-1`) is burned area for **C**\ :sub:`j` =(*C*\ :sub:`leaf`, *C*\ :sub:`stem`, *C*\ :sub:`root`, *C*\ :sub:`ts`) is a vector with carbon density (g C km\ :sup:`-2`) for leaf, stem (live and dead stem), root (fine, live coarse and dead coarse root), and transfer and storage carbon pools as elements; **CC**\ :sub:`j` = (*CC*\ :sub:`leaf`, *CC*\ :sub:`stem`, *CC*\ :sub:`root`, *CC*\ :sub:`ts`) is the corresponding combustion -completeness factor vector (Table 18.1). Moreover, we assume that 30% and 20% of column-level litter and coarse woody debris are burned and +completeness factor vector (:numref:`Table PFT-specific combustion completeness and fire mortality`). Moreover, we assume that 30% and 20% of column-level litter and coarse woody debris are burned and the corresponding carbon is transferred to atmosphere. Tissue mortality due to fire leads to carbon transfers in two ways. @@ -352,7 +352,7 @@ transfer and storage pools where :math:`M_{j1} =(M_{{\rm leaf}} ,M_{{\rm livestem,1}} ,M_{{\rm deadstem}} ,M_{{\rm root}} ,M_{{\rm ts}} )_{j}` -is the corresponding mortality factor vector (Table 18.1). Second, +is the corresponding mortality factor vector (:numref:`Table PFT-specific combustion completeness and fire mortality`). Second, carbon from uncombusted live stems is transferred to dead stems as: .. math:: @@ -361,7 +361,7 @@ carbon from uncombusted live stems is transferred to dead stems as: \Psi _{j2} =\frac{A_{b,j} }{f_{j} A_{g} } C_{livestem} (1-CC_{stem} )M_{livestem,2} where :math:`M_{livestem,2}` is the corresponding mortality factor -(Table 18.1). +(:numref:`Table PFT-specific combustion completeness and fire mortality`). Fire nitrogen emissions and nitrogen transfers due to fire-induced mortality are calculated the same way as for carbon, using the same @@ -377,7 +377,7 @@ killed by fire per km\ :sup:`2` (individual km\ :sup:`-2` where :math:`P_{j}` (individual km\ :sup:`-2`) is the population density for the *j*\ th tree PFT and :math:`\xi _{j}` is the -whole-plant mortality factor (Table 18.1). +whole-plant mortality factor (:numref:`Table PFT-specific combustion completeness and fire mortality`). Agricultural fires ----------------------- @@ -437,7 +437,7 @@ simulated planting and harvesting dates. In the post-fire region, fire impact is parameterized similar to section 18.1.3 but with combustion completeness factors and tissue mortality -factors for crop PFTs (Table 18.1). +factors for crop PFTs (:numref:`Table PFT-specific combustion completeness and fire mortality`). Deforestation fires ------------------------ @@ -579,44 +579,45 @@ peat combustion are set as 2.2 kg C m\ :sup:`-2`\ peat fire area (Turetsky et al peatlands are set the same as section 18.1.3 for non-crop PFTs and as section 18.2 for crops PFTs. -Table 18.1. PFT-specific combustion completeness and fire mortality -factors. - -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| PFT | *CC*\ :sub:`leaf` | *CC*\ :sub:`stem` | *CC*\ :sub:`root` | *CC*\ :sub:`ts` | *M*\ :sub:`leaf` | *M*\ :sub:`livestem` | *M*\ :sub:`deadstem` | *M*\ :sub:`root` | *M*\ :sub:`ts` | *M*\ :sub:`livestem` | :math:`\xi`\ :sub:`j` | -+==================================+===========================+===========================+===========================+=========================+==========================+==============================+==============================+==========================+========================+==============================+=================================+ -| NET Temperate | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| NET Boreal | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| NDT Boreal | - | - | - | - | - | - | - | - | - | - | - | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| BET Tropical | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| BET Temperate | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| BDT Tropical | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| BDT Temperate | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| BDT Boreal | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| BES Temperate | - | - | - | - | - | - | - | - | - | - | - | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| BDS Temperate | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| BDS Boreal | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| C\ :sub:`3` Grass Arctic | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| C\ :sub:`3` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| C\ :sub:`4` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| Crop 1 | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -| Crop 2 | - | - | - | - | - | - | - | - | - | - | - | -+----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ +.. _Table PFT-specific combustion completeness and fire mortality: + +.. table:: PFT-specific combustion completeness and fire mortality factors. + + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | PFT | *CC*\ :sub:`leaf` | *CC*\ :sub:`stem` | *CC*\ :sub:`root` | *CC*\ :sub:`ts` | *M*\ :sub:`leaf` | *M*\ :sub:`livestem` | *M*\ :sub:`deadstem` | *M*\ :sub:`root` | *M*\ :sub:`ts` | *M*\ :sub:`livestem` | :math:`\xi`\ :sub:`j` | + +==================================+===========================+===========================+===========================+=========================+==========================+==============================+==============================+==========================+========================+==============================+=================================+ + | NET Temperate | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | NET Boreal | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | NDT Boreal | - | - | - | - | - | - | - | - | - | - | - | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | BET Tropical | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | BET Temperate | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | BDT Tropical | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | BDT Temperate | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | BDT Boreal | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | BES Temperate | - | - | - | - | - | - | - | - | - | - | - | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | BDS Temperate | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | BDS Boreal | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | C\ :sub:`3` Grass Arctic | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | C\ :sub:`3` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | C\ :sub:`4` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | Crop 1 | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ + | Crop 2 | - | - | - | - | - | - | - | - | - | - | - | + +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ Leaves (:math:`CC_{{\rm leaf}}` ), stems (:math:`CC_{{\rm stem}}` ), roots (:math:`CC_{{\rm root}}` ) , and transfer and storage carbon diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index e6f45af8ff..f1f78574df 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -11,7 +11,7 @@ changes in canopy water :math:`\Delta W_{can}` , surface water :math:`\Delta W_{sfc}` , snow water :math:`\Delta W_{sno}` , soil water :math:`\Delta w_{liq,\, i}` , and soil ice :math:`\Delta w_{ice,\, i}` , and water in the unconfined aquifer :math:`\Delta W_{a}` (all in kg -m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (:numref:`Hydrologic processes figure`). +m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (:numref:`Figure Hydrologic processes`). The total water balance of the system is @@ -35,7 +35,7 @@ s\ :sup:`-1`), :math:`N_{levsoi}` is the number of soil layers :math:`N_{levgrnd}` are currently hydrologically inactive; :ref:`(Lawrence et al. 2008) ` and :math:`\Delta t` is the time step (s). -.. _Hydrologic processes figure: +.. _Figure Hydrologic processes: .. Figure:: image1.png @@ -379,7 +379,7 @@ Soil Water Soil water is predicted from a multi-layer model, in which the vertical soil moisture transport is governed by infiltration, surface and sub-surface runoff, gradient diffusion, gravity, and canopy transpiration -through root extraction (:numref:`Hydrologic processes figure`). +through root extraction (:numref:`Figure Hydrologic processes`). The following derivation generally follows that of :ref:`Z.-L. Yang (1998, unpublished manuscript) `. @@ -467,7 +467,7 @@ and organic properties of the soil (:ref:`Lawrence and Slater 2008 `). The hydraulic conductivity is defined at the depth of the interface of -two adjacent layers :math:`z_{h,\, i}` (:numref:`Water flux schematic figure`) and is a function +two adjacent layers :math:`z_{h,\, i}` (:numref:`Figure Water flux schematic`) and is a function of the saturated hydraulic conductivity :math:`k_{sat} \left[z_{h,\, i} \right]`, the liquid volumetric soil moisture of the two layers :math:`\theta _{i}` and @@ -527,7 +527,7 @@ where :math:`B_{om} = 2.7` \ (:ref:`Letts et al. 2000 `) and B_{\min ,i} =2.91+0.159(\% clay)_{i} . The soil matric potential (mm) is defined at the node depth -:math:`z_{i}` of each layer :math:`i` (:numref:`Water flux schematic figure`) +:math:`z_{i}` of each layer :math:`i` (:numref:`Figure Water flux schematic`) .. math:: :label: ZEqnNum316201 @@ -610,7 +610,7 @@ as Numerical Solution ^^^^^^^^^^^^^^^^^^^^^^^^ -With reference to :numref:`Water flux schematic figure`, the equation for conservation of mass +With reference to :numref:`Figure Water flux schematic`, the equation for conservation of mass (equation :eq:`ZEqnNum790844`) can be integrated over each layer as .. math:: @@ -654,7 +654,7 @@ the effective root fraction :math:`r_{e,\, i}` e_{i} =r_{e,\, i} E_{v}^{t} . -.. _Water flux schematic figure: +.. _Figure Water flux schematic: .. Figure:: image2.png diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 2a5ba1d3ae..9e6c3f2fd0 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -120,123 +120,127 @@ Jinyun Tang, Zong-Liang Yang** **LIST OF FIGURES** -- Figure 1.1. Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). +- :numref:`Figure Land processes` Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). -- Figure 2.1. Configuration of the CLM subgrid hierarchy. +- :numref:`Figure CLM subgrid hierarchy` Configuration of the CLM subgrid hierarchy. -- Figure 4.1. Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and reflected by vegetation and ground. +- :numref:`Figure Radiation Schematic` Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and reflected by vegetation and ground. -- Figure 5.1. Schematic diagram of sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. +- :numref:`Figure Schematic diagram of sensible heat fluxes` Schematic diagram of sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. -- Figure 5.2. Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. +- :numref:`Figure Schematic diagram of latent heat fluxes` Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. -- Figure 6.1. Schematic diagram of numerical scheme used to solve for soil temperature. +- :numref:`Figure Soil Temperature Schematic`. Schematic diagram of numerical scheme used to solve for soil temperature. -- Figure 7.1. Hydrologic processes represented in CLM. +- :numref:`Figure Hydrologic processes` Hydrologic processes represented in CLM. -- Figure 7.2. Example of three layer snow pack (snl=-3). +- :numref:`Figure Water flux schematic` Schematic diagram of numerical scheme used to solve for soil water fluxes. -- Figure 7.3. Schematic diagram of numerical scheme used to solve for soil water fluxes. +- :numref:`three layer snow pack` Example of three layer snow pack (snl=-3). -- Figure 12.1. Schematic representation of the urban land unit. +- :numref:`Figure Schematic representation of the urban land unit` Schematic representation of the urban land unit. -- Figure 12.2. Schematic of urban and atmospheric model coupling. +- :numref:`Figure Schematic of urban and atmospheric model coupling` Schematic of urban and atmospheric model coupling. -- Figure 13.1. Vegetation fluxes and pools. +- :numref:`Figure Vegetation fluxes and pools` Vegetation fluxes and pools. -- Figure 13.2: Carbon and nitrogen pools. +- :numref:`Figure Carbon and nitrogen pools` Carbon and nitrogen pools. -- Figure 14.1. Example of annual phenology cycle for seasonal deciduous. +- :numref:`Figure annual phenology cycle` Example of annual phenology cycle for seasonal deciduous. -- Figure 14.2. Example fluxes and pools sizes for an onset growth period of 15 days, with initial transfer pool size of 100 gC m-2 and a timestep of one hour. a) Flux leaving transfer pool (e.g. CFleaf\_xfer,leaf). b) Carbon content of transfer pool and its associated display pool (e.g. CSleaf\_xfer and CSleaf, respectively). +- 14.2. Example fluxes and pools sizes for an onset growth period of 15 days, with initial transfer pool size of 100 gC m-2 and a timestep of one hour. a) Flux leaving transfer pool (e.g. CFleaf\_xfer,leaf). b) Carbon content of transfer pool and its associated display pool (e.g. CSleaf\_xfer and CSleaf, respectively). -- Figure 14.3. Example fluxes and pool sizes for an offset (litterfall) period of 15 days, with initial display pool size of 100 gC m-2 and a timestep of one hour. a) Litterfall flux (e.g CFleaf,litter). b) Carbon content of display pool and litter pool through the litterfall period, ignoring the losses from litter pool due to decomposition during this period. +- 14.3. Example fluxes and pool sizes for an offset (litterfall) period of 15 days, with initial display pool size of 100 gC m-2 and a timestep of one hour. a) Litterfall flux (e.g CFleaf,litter). b) Carbon content of display pool and litter pool through the litterfall period, ignoring the losses from litter pool due to decomposition during this period. -- Figure 15.1. Schematic of decomposition model in CLM. +- :numref:`Figure Schematic of decomposition model in CLM` Schematic of decomposition model in CLM. -- Figure 15.2. Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 alternate soil decomposition models included in CLM. +- :numref:`Figure Pool structure` Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 alternate soil decomposition models included in CLM. -- Figure 16.1. Biological nitrogen fixation as a function of annual net primary production. 300Figure 19.1. Schematic representation of biological and physical processes integrated in CLM that affect the net CH4 surface flux. (left) Fully inundated portion of a CLM gridcell and (right) variably saturated portion of a gridcell. +- :numref:`Figure Biological nitrogen fixation` Biological nitrogen fixation as a function of annual net primary production. -- Figure 21.1. Schematic of land cover change impacts on CLM carbon pools and fluxes. +- :numref:`Figure Methane Schematic` Schematic representation of biological and physical processes integrated in CLM that affect the net CH4 surface flux. (left) Fully inundated portion of a CLM gridcell and (right) variably saturated portion of a gridcell. -- Figure 21.2. Schematic of translation of annual UNH land units to CLM4 plant functional types. +- :numref:`Figure Schematic of land cover change` Schematic of land cover change impacts on CLM carbon pools and fluxes. -- Figure 25.1. Atmospheric :math:`\mathrm{\Delta}` 14C used to drive 14C model over the historical period. +- :numref:`Figure Schematic of translation of annual UNH land units` Schematic of translation of annual UNH land units to CLM4 plant functional types. + +- :numref:`Figure Atmospheric Delta C14` Atmospheric :math:`\mathrm{\Delta}` 14C used to drive 14C model over the historical period. **LIST OF TABLES** -- Table 2.1. Plant functional types +- :numref:`Table Plant functional types` Plant functional types + +- :numref:`Table Prescribed plant functional type heights` Prescribed plant functional type heights -- Table 2.2. Prescribed plant functional type heights +- :numref:`Table Soil layer structure` Soil layer structure -- Table 2.3. Atmospheric input to land model +- :numref:`Table Atmospheric input to land model` Atmospheric input to land model -- Table 2.4. Land model output to atmospheric model +- :numref:`Table Land model output to atmospheric model` Land model output to atmospheric model -- Table 2.5. Surface data required for CLM4.5 and their base spatial resolution +- :numref:`Table Surface data required for CLM and their base spatial resolution` Surface data required for CLM4.5 and their base spatial resolution -- Table 2.6. Physical constants +- :numref:`Table Physical constants` Physical constants -- Table 3.1. Plant functional type optical properties +- :numref:`Table Plant functional type optical properties` Plant functional type optical properties -- Table 3.2. Intercepted snow optical properties +- :numref:`Table Intercepted snow optical properties` Intercepted snow optical properties -- Table 3.3. Dry and saturated soil albedos +- :numref:`Table Dry and saturated soil albedos` Dry and saturated soil albedos -- Table 3.4. Spectral bands and weights used for snow radiative transfer +- :numref:`Table Spectral bands and weights used for snow radiative transfer` Spectral bands and weights used for snow radiative transfer -- Table 3.5. Single-scatter albedo values used for snowpack impurities and ice +- :numref:`Table Single-scatter albedo values used for snowpack impurities and ice` Single-scatter albedo values used for snowpack impurities and ice -- Table 3.6. Mass extinction values (m2 kg-1) used for snowpack impurities and ice. +- :numref:`Table Mass extinction values` Mass extinction values (m2 kg-1) used for snowpack impurities and ice. -- Table 3.7. Asymmetry scattering parameters used for snowpack impurities and ice. +- :numref:`Table Asymmetry scattering parameters used for snowpack impurities and ice` Asymmetry scattering parameters used for snowpack impurities and ice. -- Table 3.8. Orbital parameters +- :numref:`Table Orbital parameters` Orbital parameters -- Table 5.1. Plant functional type aerodynamic parameters +- :numref:`Table Plant functional type aerodynamic parameters` Plant functional type aerodynamic parameters -- Table 5.2. Coefficients for e\ :sub:`sat`\ :sup:`T` +- :numref:`Table Coefficients for saturation vapor pressure` Coefficients for e\ :sub:`sat`\ :sup:`T` -- Table 5.3. Coefficients for 112Table 6.1. Soil layer structure. +- :numref:`Table Coefficients for derivative of esat` Coefficients for 112:numref:`` 6.1. Soil layer structure. -- Table 7.1. Meltwater scavenging efficiency for particles within snow +- :numref:`Table Meltwater scavenging` Meltwater scavenging efficiency for particles within snow -- Table 7.2. Minimum and maximum thickness of snow layers (m) +- :numref:`Table snow layer thickness` Minimum and maximum thickness of snow layers (m) -- Table 8.1. Plant functional type (PFT) photosynthetic parameters. +- :numref:`Table Plant functional type (PFT) photosynthetic parameters` Plant functional type (PFT) photosynthetic parameters. -- Table 8.2. Temperature dependence parameters for C3 photosynthesis. +- :numref:`Table Temperature dependence parameters for C3 photosynthesis` Temperature dependence parameters for C3 photosynthesis. -- Table8.3. Plant functional type root distribution parameters. +- :numref:`Table Plant functional type root distribution parameters` Plant functional type root distribution parameters. -- Table 13.1. Allocation and carbon:nitrogen ratio parameters +- :numref:`Table Allocation and CN ratio parameters` Allocation and carbon:nitrogen ratio parameters -- Table 15.1. Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. +- :numref:`Table Decomposition rate constants` Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. -- Table 15.2. Respiration fractions for litter and SOM pools +- :numref:`Table Respiration fractions for litter and SOM pools` Respiration fractions for litter and SOM pools -- Table 15.3. Respiration fractions for litter and SOM pools for Century-based structure +- :numref:`Table Turnover times` Turnover times, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the Century-based decomposition cascade. -- Table 15.4.Turnover times, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the Century-based decomposition cascade. +- :numref:`Table Respiration fractions for Century-based structure` Respiration fractions for litter and SOM pools for Century-based structure -- Table 18.1. PFT-specific combustion completeness and fire mortality factors. +- :numref:`Table PFT-specific combustion completeness and fire mortality` PFT-specific combustion completeness and fire mortality factors. -- Table 19.1. Parameter descriptions and sensitivity analysis ranges applied in the methane model. +- :numref:`Table Methane Parameter descriptions` Parameter descriptions and sensitivity analysis ranges applied in the methane model. -- Table 19.2. Temperature dependence of aqueous and gaseous diffusion coefficients for CH4 and O2. +- :numref:`Table Temperature dependence of aqueous and gaseous diffusion` Temperature dependence of aqueous and gaseous diffusion coefficients for CH4 and O2. -- Table 20.1. Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in Table 2.1. +- :numref:`Table Crop plant functional types` Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. -- Table 20.2. Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in Table 2.1. +- :numref:`Table Crop pfts in CLM4.5CNcrop and their parameters` Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. -- Table 20.3. Pre- and post-grain fill C:N ratios for crop leaf, stem, fine root, and reproductive pools. +- :numref:`Table Pre- and post-grain fill CN ratios` Pre- and post-grain fill C:N ratios for crop leaf, stem, fine root, and reproductive pools. -- Table 22.1. Plant functional type (PFT) biogeography rules with respect to climate. +- :numref:`Table Plant functional type (PFT) biogeography rules` Plant functional type (PFT) biogeography rules with respect to climate. -- Table 24.1. Mass fraction m\ :sub:`i` , mass median diameter :sub:`v, i` , and geometric standard deviation :sub:`g, i` , per dust source mode i +- :numref:`Table Dust Mass fraction` Mass fraction m\ :sub:`i` , mass median diameter :sub:`v, i` , and geometric standard deviation :sub:`g, i` , per dust source mode i -- Table 24.2. Minimum and maximum particle diameters in each dust transport bin j +- :numref:`Table Dust Minimum and maximum particle diameters` Minimum and maximum particle diameters in each dust transport bin j **ACKNOWLEDGEMENTS** @@ -295,17 +299,17 @@ Inception of CLM The early development of the Community Land Model can be described as the merging of a community-developed land model focusing on biogeophysics and a concurrent effort at NCAR to expand the NCAR Land -Surface Model (NCAR LSM, Bonan 1996) to include the carbon cycle, +Surface Model (NCAR LSM, :ref:`Bonan 1996`) to include the carbon cycle, vegetation dynamics, and river routing. The concept of a community-developed land component of the Community Climate System Model (CCSM) was initially proposed at the CCSM Land Model Working Group (LMWG) meeting in February 1996. Initial software specifications and development focused on evaluating the best features of three existing -land models: the NCAR LSM (Bonan 1996, 1998) used in the Community +land models: the NCAR LSM (:ref:`Bonan 1996, 1998`) used in the Community Climate Model (CCM3) and the initial version of CCSM; the Institute of -Atmospheric Physics, Chinese Academy of Sciences land model (IAP94) (Dai -and Zeng 1997); and the Biosphere-Atmosphere Transfer Scheme (BATS) -(Dickinson et al. 1993) used with CCM2. A scientific steering committee +Atmospheric Physics, Chinese Academy of Sciences land model (IAP94) (:ref:`Dai +and Zeng 1997`); and the Biosphere-Atmosphere Transfer Scheme (BATS) +(:ref:`Dickinson et al. 1993`) used with CCM2. A scientific steering committee was formed to review the initial specifications of the design provided by Robert Dickinson, Gordon Bonan, Xubin Zeng, and Yongjiu Dai and to facilitate further development. Steering committee members were selected @@ -329,11 +333,11 @@ Oleson, M. Bosilovich, Zong-Liang Yang, Ian Baker, P. Houser, and P. Dirmeyer at the LMWG meeting hosted by COLA (Center for Ocean-Land-Atmosphere Studies) in November 1999. Field data used for validation included sites adopted by the Project for Intercomparison of -Land-surface Parameterization Schemes (Henderson-Sellers et al. 1993) -(Cabauw, Valdai, Red-Arkansas river basin) and others [FIFE (Sellers et -al. 1988), BOREAS (Sellers et al. 1995), HAPEX-MOBILHY (André et al. -1986), ABRACOS (Gash et al. 1996), Sonoran Desert (Unland et al. 1996), -GSWP (Dirmeyer et al. 1999)]. Y. Dai also presented results from a +Land-surface Parameterization Schemes (:ref:`Henderson-Sellers et al. 1993`) +(Cabauw, Valdai, Red-Arkansas river basin) and others [FIFE (:ref:`Sellers et +al. 1988`), BOREAS :ref:`(Sellers et al. 1995`), HAPEX-MOBILHY (:ref:`André et al. +1986`), ABRACOS (:ref:`Gash et al. 1996`), Sonoran Desert (:ref:`Unland et al. 1996`), +GSWP (:ref:`Dirmeyer et al. 1999`)]. Y. Dai also presented results from a preliminary coupling of the Common Land Model to CCM3, indicating that the land model could be successfully coupled to a climate model. @@ -348,9 +352,9 @@ and soil temperatures. Sam Levis reported on efforts to incorporate a river routing model to deliver runoff to the ocean model in CCSM. Soon after the workshop, the code was delivered to NCAR for implementation into the CCSM framework. Documentation for the Common Land Model is -provided by Dai et al. (2001) while the coupling with CCM3 is described -in Zeng et al. (2002). The model was introduced to the modeling -community in Dai et al. (2003). +provided by :ref:`Dai et al. (2001)` while the coupling with CCM3 is described +in :ref:`Zeng et al. (2002)`. The model was introduced to the modeling +community in :ref:`Dai et al. (2003)`. CLM2 ^^^^^^^^^^ @@ -361,8 +365,8 @@ cycling, vegetation dynamics, and river routing. The preservation of these advancements necessitated several modifications to the Common Land Model. The biome-type land cover classification scheme was replaced with a plant functional type (PFT) representation with the specification of -PFTs and leaf area index from satellite data (Oleson and Bonan 2000; -Bonan et al. 2002a, b). This also required modifications to +PFTs and leaf area index from satellite data (:ref:`Oleson and Bonan 2000`; +:ref:`Bonan et al. 2002a, b`). This also required modifications to parameterizations for vegetation albedo and vertical burying of vegetation by snow. Changes were made to canopy scaling, leaf physiology, and soil water limitations on photosynthesis to resolve @@ -382,7 +386,7 @@ K. Oleson reported on initial results from a coupling of CCM3 with CLM2 at the June 2001 CCSM Workshop LMWG meeting. Generally, the CLM2 preserved most of the improvements seen in the Common Land Model, particularly with respect to surface air temperature, runoff, and snow. -These simulations are documented in Bonan et al. (2002a). Further small +These simulations are documented in :ref:`Bonan et al. (2002a)`. Further small improvements to the biogeophysical parameterizations, ongoing software development, and extensive analysis and validation within CAM2 and CCSM2 culminated in the release of CLM2 to the community in May 2002. @@ -414,14 +418,14 @@ added stability corrections to the diagnostic 2-m air temperature calculation which reduced biases in this temperature. Competition between PFTs for water, in which PFTs share a single soil column, is the default mode of operation in this model version. CLM3 was released to -the community in June 2004. Dickinson et al. (2006) describe the climate -statistics of CLM3 when coupled to CCSM3.0. Hack et al. (2006) provide +the community in June 2004.:ref:`Dickinson et al. (2006)` describe the climate +statistics of CLM3 when coupled to CCSM3.0. :ref:`Hack et al. (2006)` provide an analysis of selected features of the land hydrological cycle. -Lawrence et al. (2007) examine the impact of changes in CLM3 +:ref:`Lawrence et al. (2007)` examine the impact of changes in CLM3 hydrological parameterizations on partitioning of evapotranspiration (ET) and its effect on the timescales of ET response to precipitation events, interseasonal soil moisture storage, soil moisture memory, and -land-atmosphere coupling. Qian et al. (2006) evaluate CLM3’s performance +land-atmosphere coupling. :ref:`Qian et al. (2006)` evaluate CLM3’s performance in simulating soil moisture content, runoff, and river discharge when forced by observed precipitation, temperature and other atmospheric data. @@ -442,16 +446,16 @@ integration, canopy interception, frozen soil, soil water availability, and soil evaporation, a TOPMODEL-based model for surface and subsurface runoff, a groundwater model for determining water table depth, and the introduction of a factor to simulate nitrogen limitation on plant -productivity. Oleson et al. (2008a) show that CLM3.5 exhibits +productivity. :ref:`Oleson et al. (2008a)` show that CLM3.5 exhibits significant improvements over CLM3 in its partitioning of global ET which result in wetter soils, less plant water stress, increased transpiration and photosynthesis, and an improved annual cycle of total water storage. Phase and amplitude of the runoff annual cycle is generally improved. Dramatic improvements in vegetation biogeography result when CLM3.5 is coupled to a dynamic global vegetation model. -Stöckli et al. (2008) examine the performance of CLM3.5 at local scales +:ref:`Stöckli et al. (2008)` examine the performance of CLM3.5 at local scales by making use of a network of long-term ground-based ecosystem -observations [FLUXNET (Baldocchi et al. 2001)]. Data from 15 FLUXNET +observations [FLUXNET (:ref:`Baldocchi et al. 2001`)]. Data from 15 FLUXNET sites were used to demonstrate significantly improved soil hydrology and energy partitioning in CLM3.5. CLM3.5 was released to the community in May, 2007. @@ -462,7 +466,7 @@ CLM4 The motivation for the next version of the model, CLM4, was to incorporate several recent scientific advances in the understanding and representation of land surface processes, expand model capabilities, and -improve surface and atmospheric forcing datasets (Lawrence et al. 2011). +improve surface and atmospheric forcing datasets (:ref:`Lawrence et al. 2011`). Included in the first category are more sophisticated representations of soil hydrology and snow processes. In particular, new treatments of soil column-groundwater interactions, soil evaporation, aerodynamic @@ -488,25 +492,25 @@ ecosystem process model Biome-BGC (Biome BioGeochemical Cycles), originating at the Numerical Terradynamic Simulation Group (NTSG) at the University of Montana, under the guidance of Prof. Steven Running. Biome-BGC itself is an extension of an earlier model, Forest-BGC -**(Running and Coughlan, 1988; Running and Gower, 1991)**, which +(:ref:`Running and Coughlan, 1988`; :ref:`Running and Gower, 1991`), which simulates water, carbon, and, to a limited extent, nitrogen fluxes for forest ecosystems. Forest-BGC was designed to be driven by remote sensing inputs of vegetation structure, and so used a diagnostic (prescribed) leaf area index, or, in the case of the dynamic allocation -version of the model **(Running and Gower, 1991)**, prescribed maximum +version of the model (:ref:`Running and Gower, 1991`), prescribed maximum leaf area index. Biome-BGC expanded on the Forest-BGC logic by introducing a more -mechanistic calculation of leaf and canopy scale photosynthesis **(Hunt -and Running, 1992)**, and extending the physiological parameterizations -to include multiple woody and non-woody vegetation types **(Hunt et al. -1996; Running and Hunt, 1993)**. Later versions of Biome-BGC introduced +mechanistic calculation of leaf and canopy scale photosynthesis (:ref:`Hunt +and Running, 1992`), and extending the physiological parameterizations +to include multiple woody and non-woody vegetation types (:ref:`Hunt et al. +1996`; :ref:`Running and Hunt, 1993`). Later versions of Biome-BGC introduced more mechanistic descriptions of belowground carbon and nitrogen cycles, nitrogen controls on photosynthesis and decomposition, sunlit and shaded canopies, vertical gradient in leaf morphology, and explicit treatment -of fire and harvest disturbance and regrowth dynamics **(Kimball et al. -1997; Thornton, 1998; Thornton et al. 2002; White et al. 2000)**. -Biome-BGC version 4.1.2 **(Thornton et al. 2002)** provided a point of +of fire and harvest disturbance and regrowth dynamics (:ref:`Kimball et al. +1997`; :ref:`Thornton, 1998`; :ref:`Thornton et al. 2002`; :ref:`White et al. 2000`). +Biome-BGC version 4.1.2 (:ref:`Thornton et al. 2002`) provided a point of departure for integrating new biogeochemistry components into CLM4. CLM4 was released to the community in June, 2010 along with the @@ -535,26 +539,26 @@ problems or biases. The main modifications include updates to canopy processes including a revised canopy radiation scheme and canopy scaling of leaf processes, co-limitations on photosynthesis, revisions to photosynthetic parameters -(Bonan et al. 2011), +(:ref:`Bonan et al. 2011`), .. todo:: had three stars here - need to resolve this temperature acclimation of photosynthesis, and improved stability of the iterative solution in the photosynthesis and -stomatal conductance model (Sun et al. 2012). Hydrology updates include +stomatal conductance model (:ref:`Sun et al. 2012`). Hydrology updates include modifications such that hydraulic properties of frozen soils are determined by liquid water content only rather than total water content and the introduction of an ice impedance function, and other corrections that increase the consistency between soil water state and water table position and allow for a perched water table above icy permafrost ground -(Swenson et al. 2012). A new snow cover fraction parameterization is +(:ref:`Swenson et al. 2012`). A new snow cover fraction parameterization is incorporated that reflects the hysteresis in fractional snow cover for a -given snow depth between accumulation and melt phases (Swenson and -Lawrence, 2012). The lake model in CLM4 is replaced with a completely -revised and more realistic lake model (Subin et al. 2012a). A surface +given snow depth between accumulation and melt phases (:ref:`Swenson and +Lawrence, 2012`). The lake model in CLM4 is replaced with a completely +revised and more realistic lake model (:ref:`Subin et al. 2012a`). A surface water store is introduced, replacing the wetland land unit and permitting prognostic wetland distribution modeling, and the surface -energy fluxes are calculated separately (Swenson and Lawrence, 2012) for +energy fluxes are calculated separately (:ref:`Swenson and Lawrence, 2012`) for snow-covered, water-covered, and snow/water-free portions of vegetated and crop land units, and snow-covered and snow-free portions of glacier land units. Globally constant river flow velocity is replaced with @@ -562,28 +566,28 @@ variable flow velocity based on mean grid cell slope. A vertically resolved soil biogeochemistry scheme is introduced with base decomposition rates modified by soil temperature, water, and oxygen limitations and also including vertical mixing of soil carbon and -nitrogen due to bioturbation, cryoturbation, and diffusion (Koven et al. -2013). The litter and soil carbon and nitrogen pool structure as well as +nitrogen due to bioturbation, cryoturbation, and diffusion (:ref:`Koven et al. +2013`). The litter and soil carbon and nitrogen pool structure as well as nitrification and denitrification are modified based on the Century model and biological fixation is revised to distribute fixation more -realistically over the year (Koven et al. 2013). The fire model is +realistically over the year (:ref:`Koven et al. 2013`). The fire model is replaced with a model that includes representations of natural and anthropogenic triggers and suppression as well as agricultural, -deforestation, and peat fires (Li et al. 2012a,b; Li et al. 2013a). The +deforestation, and peat fires (:ref:`Li et al. 2012a,b`; :ref:`Li et al. 2013a`). The biogenic volatile organic compounds model is updated to MEGAN2.1 -(Guenther et al. 2012). +(:ref:`Guenther et al. 2012`). Additions to the model include a methane production, oxidation, and -emissions model (Riley et al. 2011a) and an extension of the crop model -to include interactive fertilization, organ pools (Drewniak et al. -2013), and irrigation (Sacks et al. 2009). Elements of the Variable +emissions model (:ref:`Riley et al. 2011a`) and an extension of the crop model +to include interactive fertilization, organ pools (:ref:`Drewniak et al. +2013`), and irrigation (:ref:`Sacks et al. 2009`). Elements of the Variable Infiltration Capacity (VIC) model are included as an alternative -optional runoff generation scheme (Li et al. 2011). There is also an -option to run with a multilayer canopy (Bonan et al. 2012). Multiple +optional runoff generation scheme (:ref:`Li et al. 2011`). There is also an +option to run with a multilayer canopy (:ref:`Bonan et al. 2012`). Multiple urban density classes, rather than the single dominant urban density class used in CLM4, are modeled in the urban land unit. Carbon -(:math:`{}^{13}`\ C and :math:`{}^{14}`\ C) isotopes are enabled (Koven -et al. 2013). Minor changes include a switch of the C3 Arctic grass and +(:math:`{}^{13}`\ C and :math:`{}^{14}`\ C) isotopes are enabled (:ref:`Koven +et al. 2013`). Minor changes include a switch of the C3 Arctic grass and shrub phenology from stress deciduous to seasonal deciduous and a change in the glacier bare ice albedo to better reflect recent estimates. Finally, the carbon and nitrogen cycle spinup is accelerated and @@ -594,9 +598,9 @@ Finally, the predominantly low resolution input data for provided with CLM4 to create CLM4 surface datasets is replaced with newer and higher resolution input datasets where possible (see section 2.2.3 for details). The default meteorological forcing dataset provided with CLM4 -(Qian et al. 2006) is replaced with the 1901-2010 CRUNCEP forcing +(:ref:`Qian et al. 2006)` is replaced with the 1901-2010 CRUNCEP forcing dataset (see Chapter 26) for CLM4.5, though users can also still use the -Qian et al. (2006) dataset or other alternative forcing datasets. +:ref:`Qian et al. (2006)` dataset or other alternative forcing datasets. CLM4.5 was released to the community in June 2013 along with the Community Earth System Model version 1.2 (CESM1.2). @@ -607,73 +611,75 @@ Biogeophysical and Biogeochemical Processes Biogeophysical and biogeochemical processes are simulated for each subgrid land unit, column, and plant functional type (PFT) independently and each subgrid unit maintains its own prognostic variables (see -section 2.1.1 for definitions of subgrid units). The same atmospheric +section :numref:`Surface Heterogeneity and Data Structure` for definitions +of subgrid units). The same atmospheric forcing is used to force all subgrid units within a grid cell. The surface variables and fluxes required by the atmosphere are obtained by averaging the subgrid quantities weighted by their fractional areas. The -processes simulated include (Figure 1.1): +processes simulated include (:numref:`Figure Land processes`): #. Surface characterization including land type heterogeneity and - ecosystem structure (Chapter 2) + ecosystem structure (Chapter :numref:`rst_Surface Characterization, Vertical Discretization, and Model Input Requirements`) #. Absorption, reflection, and transmittance of solar radiation (Chapter - 3, 4) + :numref:`rst_Surface Albedos`, :numref:`rst_Radiative Fluxes`) -#. Absorption and emission of longwave radiation (Chapter 4) +#. Absorption and emission of longwave radiation (Chapter :numref:`rst_Radiative Fluxes`) #. Momentum, sensible heat (ground and canopy), and latent heat (ground - evaporation, canopy evaporation, transpiration) fluxes (Chapter 5) + evaporation, canopy evaporation, transpiration) fluxes (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) -#. Heat transfer in soil and snow including phase change (Chapter 6) +#. Heat transfer in soil and snow including phase change (Chapter :numref:`rst_Soil and Snow Temperatures`) -#. Canopy hydrology (interception, throughfall, and drip) (Chapter 7) - -#. Snow hydrology (snow accumulation and melt, compaction, water - transfer between snow layers) (Chapter 7) +#. Canopy hydrology (interception, throughfall, and drip) (Chapter :numref:`rst_Hydrology`) #. Soil hydrology (surface runoff, infiltration, redistribution of water - within the column, sub-surface drainage, groundwater) (Chapter 7) + within the column, sub-surface drainage, groundwater) (Chapter :numref:`rst_Hydrology`) -#. Stomatal physiology and photosynthesis (Chapter 8) +#. Snow hydrology (snow accumulation and melt, compaction, water + transfer between snow layers) (Chapter :numref:`rst_Snow Hydrology`) + +#. Stomatal physiology and photosynthesis (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`) -#. place Lake temperatures and fluxes (Chapter 9) +#. Lake temperatures and fluxes (Chapter :numref:`rst_Lake Model`) -#. Glacier processes (Chapter 10) +#. Glacier processes (Chapter :numref:`rst_Glaciers`) -#. Routing of runoff from rivers to ocean (Chapter 11) +#. Routing of runoff from rivers to ocean (Chapter :numref:`rst_River Transport Model (RTM)`) -#. Urban energy balance and climate (Chapter 12) +#. Urban energy balance and climate (Chapter :numref:`rst_Urban Model (CLMU)`) #. Vegetation carbon and nitrogen allocation and respiration (Chapter - 13) + :numref:`rst_CN Allocation`) -#. Vegetation phenology (Chapter 14) +#. Vegetation phenology (Chapter :numref:`rst_Vegetation Phenology and Turnover`) -#. Soil and litter carbon decomposition (Chapter 15) +#. Soil and litter carbon decomposition (Chapter :numref:`rst_Decomposition`) #. Nitrogen cycling including deposition, biological fixation, - denitrification, leaching, and losses due to fire (Chapter 16) + denitrification, leaching, and losses due to fire (Chapter :numref:`rst_External Nitrogen Cycle`) -#. Plant mortality (Chapter 17) +#. Plant mortality (Chapter :numref:`rst_Plant Mortality`) #. Fire ignition and suppression, including natural, deforestation, and - agricultural fire (Chapter 18) + agricultural fire (Chapter :numref:`rst_Fire`) + +#. Methane production, oxidation, and emissions (Chapter :numref:`rst_Methane Model`) -#. Methane production, oxidation, and emissions (Chapter 19) +#. Crop dynamics and irrigation (Chapter :numref:`rst_Crops and Irrigation`) -#. Crop dynamics and irrigation (Chapter 20) +#. Land cover and land use change including wood harvest (Chapter :numref:`rst_Transient Landcover Change`) -#. Land cover and land use change including wood harvest (Chapter 21) +#. Dynamic global vegetation distribution (Chapter :numref:`rst_Dynamic Global Vegetation Model`) -#. Dynamic global vegetation distribution (Chapter 22) +#. Biogenic volatile organic compound emissions (Chapter :numref:`rst_Biogenic Volatile Organic Compounds (BVOCs)`) -#. Biogenic volatile organic compound emissions (Chapter 23) +#. Dust mobilization and deposition (Chapter :numref:`rst_Dust Model`) -#. Dust mobilization and deposition (Chapter 24) +#. Carbon isotope fractionation (Chapter :numref:`rst_Carbon Isotopes`) -#. Carbon isotope fractionation (Chapter 25) +.. _Figure Land processes: -Figure 1.1. Land biogeophysical, biogeochemical, and landscape processes -simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). +.. figure:: image1.png -.. image:: image1.png + Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from :ref:`Lawrence et al. (2011)` for CLM4.5). diff --git a/doc/source/tech_note/Isotopes/CLM50_Tech_Note_Isotopes.rst b/doc/source/tech_note/Isotopes/CLM50_Tech_Note_Isotopes.rst index f4b8127a2c..093b7d7a37 100644 --- a/doc/source/tech_note/Isotopes/CLM50_Tech_Note_Isotopes.rst +++ b/doc/source/tech_note/Isotopes/CLM50_Tech_Note_Isotopes.rst @@ -235,7 +235,9 @@ datasets spanning the 20\ :math:`{}^{th}` century: (Levin and Kromer, 2004; Manning and Melhuish, 1994; Nydal and Lövseth, 1996; Turnbull et al. 2007). This is shown in Figure 25.1. -Figure 25.1. Atmospheric :math:`\mathrm{\Delta}`\ :sup:`14`\ C -used to drive :sup:`14`\ C model over the historical period. +.. _Figure Atmospheric Delta C14: -.. image:: image1.png +.. figure:: image1.png + + Atmospheric :math:`\mathrm{\Delta}`\ :sup:`14`\ C + used to drive :sup:`14`\ C model over the historical period. diff --git a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst index 6a29802004..c881a2c7c2 100644 --- a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst +++ b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst @@ -39,7 +39,7 @@ the atmosphere. Governing Mass-Balance Relationship ---------------------------------------- -The model (Figure 19.1) accounts for CH\ :sub:`4` production in +The model (:numref:`Figure Methane Schematic`) accounts for CH\ :sub:`4` production in the anaerobic fraction of soil (*P*, mol m\ :sup:`-3` s\ :sup:`-1`), ebullition (*E*, mol m\ :sup:`-3` s\ :sup:`-1`), aerenchyma transport (*A*, mol m\ :sup:`-3` s\ :sup:`-1`), aqueous and gaseous diffusion (:math:`{F}_{D}`, mol m\ :sup:`-2` s\ :sup:`-1`), and oxidation (*O*, mol m\ :sup:`-3` s\ :sup:`-1`) via a transient reaction @@ -78,12 +78,14 @@ CH\ :sub:`4` to the atmosphere when the inundated fraction decreases, and averaging a portion of the non-inundated concentration into the inundated concentration when the inundated fraction increases. -Figure 19.1. Schematic representation of biological and physical -processes integrated in CLM that affect the net CH\ :sub:`4` -surface flux (Riley et al. 2011a). (left) Fully inundated portion of a -CLM gridcell and (right) variably saturated portion of a gridcell. +.. _Figure Methane Schematic: -.. image:: image1.png +.. figure:: image1.png + + Schematic representation of biological and physical + processes integrated in CLM that affect the net CH\ :sub:`4` + surface flux (:ref:`Riley et al. 2011a`). (left) Fully inundated portion of a + CLM gridcell and (right) variably saturated portion of a gridcell. CH\ :sub:`4` Production ---------------------------------- @@ -112,7 +114,7 @@ seasonal inundation fraction (*S*, described below): Here, :math:`f_{CH_{4} }` is the baseline ratio between CO\ :sub:`2` and CH\ :sub:`4` production (all parameters -values are given in Table 19.1). Currently, :math:`f_{CH_{4} }` is +values are given in :numref:`Table Methane Parameter descriptions`). Currently, :math:`f_{CH_{4} }` is modified to account for our assumptions that methanogens may have a higher Q\ :math:`{}_{10}` than aerobic decomposers; are not N limited; and do not have a low-moisture limitation. @@ -170,44 +172,46 @@ The model also calculates the O\ :sub:`2` required during nitrification, and the total O\ :sub:`2` demand is used in the O\ :sub:`2` mass balance solution. -Table 19.1. Parameter descriptions and sensitivity analysis ranges -applied in the methane model. - -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| Mechanism | Parameter | Baseline Value | Range for Sensitivity Analysis | Units | Description | -+==============+============================+==============================================+==================================================================================================+=============================================+============================================================================================+ -| Production | :math:`{Q}_{10}` | 2 | 1.5 – 4 | - | CH\ :sub:`4` production :math:`{Q}_{10}` | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`f_{pH}` | 1 | On, off | - | Impact of pH on CH\ :sub:`4` production | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`f_{pE}` | 1 | On, off | - | Impact of redox potential on CH\ :sub:`4` production | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | *S* | Varies | NA | - | Seasonal inundation factor | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`\beta` | 0.2 | NA | - | Effect of anoxia on decomposition rate (used to calculate *S* only) | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`f_{CH_{4} }` | 0.2 | NA | - | Ratio between CH\ :sub:`4` and CO\ :sub:`2` production below the water table | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| Ebullition | :math:`{C}_{e,max}` | 0.15 | NA | mol m\ :sup:`-3` | CH\ :sub:`4` concentration to start ebullition | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`{C}_{e,min}` | 0.15 | NA | - | CH\ :sub:`4` concentration to end ebullition | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| Diffusion | :math:`f_{D_{0} }` | 1 | 1, 10 | m\ :sup:`2` s\ :sup:`-1` | Diffusion coefficient multiplier (Table 19.2) | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| Aerenchyma | *p* | 0.3 | NA | - | Grass aerenchyma porosity | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | *R* | 2.9\ :math:`\times`\ 10\ :sup:`-3` m | NA | m | Aerenchyma radius | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`{r}_{L}` | 3 | NA | - | Root length to depth ratio | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`{F}_{a}` | 1 | 0.5 – 1.5 | - | Aerenchyma conductance multiplier | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| Oxidation | :math:`K_{CH_{4} }` | 5 x 10\ :sup:`-3` | 5\ :math:`\times`\ 10\ :math:`{}^{-4}`\ :math:`{}_{ }`- 5\ :math:`\times`\ 10\ :sup:`-2` | mol m\ :sup:`-3` | CH\ :sub:`4` half-saturation oxidation coefficient (wetlands) | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`K_{O_{2} }` | 2 x 10\ :sup:`-2` | 2\ :math:`\times`\ 10\ :sup:`-3` - 2\ :math:`\times`\ 10\ :sup:`-1` | mol m\ :sup:`-3` | O\ :sub:`2` half-saturation oxidation coefficient | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ -| | :math:`R_{o,\max }` | 1.25 x 10\ :math:`{}^{-5}` | 1.25\ :math:`\times`\ 10\ :math:`{}^{-6}` - 1.25\ :math:`\times`\ 10\ :math:`{}^{-4}` | mol m\ :sup:`-3` s\ :sup:`-1` | Maximum oxidation rate (wetlands) | -+--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ +.. _Table Methane Parameter descriptions: + +.. table:: Parameter descriptions and sensitivity analysis ranges applied in the methane model + + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | Mechanism | Parameter | Baseline Value | Range for Sensitivity Analysis | Units | Description | + +==============+============================+==============================================+==================================================================================================+=============================================+============================================================================================+ + | Production | :math:`{Q}_{10}` | 2 | 1.5 – 4 | - | CH\ :sub:`4` production :math:`{Q}_{10}` | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`f_{pH}` | 1 | On, off | - | Impact of pH on CH\ :sub:`4` production | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`f_{pE}` | 1 | On, off | - | Impact of redox potential on CH\ :sub:`4` production | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | *S* | Varies | NA | - | Seasonal inundation factor | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`\beta` | 0.2 | NA | - | Effect of anoxia on decomposition rate (used to calculate *S* only) | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`f_{CH_{4} }` | 0.2 | NA | - | Ratio between CH\ :sub:`4` and CO\ :sub:`2` production below the water table | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | Ebullition | :math:`{C}_{e,max}` | 0.15 | NA | mol m\ :sup:`-3` | CH\ :sub:`4` concentration to start ebullition | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`{C}_{e,min}` | 0.15 | NA | - | CH\ :sub:`4` concentration to end ebullition | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | Diffusion | :math:`f_{D_{0} }` | 1 | 1, 10 | m\ :sup:`2` s\ :sup:`-1` | Diffusion coefficient multiplier (Table 19.2) | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | Aerenchyma | *p* | 0.3 | NA | - | Grass aerenchyma porosity | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | *R* | 2.9\ :math:`\times`\ 10\ :sup:`-3` m | NA | m | Aerenchyma radius | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`{r}_{L}` | 3 | NA | - | Root length to depth ratio | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`{F}_{a}` | 1 | 0.5 – 1.5 | - | Aerenchyma conductance multiplier | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | Oxidation | :math:`K_{CH_{4} }` | 5 x 10\ :sup:`-3` | 5\ :math:`\times`\ 10\ :math:`{}^{-4}`\ :math:`{}_{ }`- 5\ :math:`\times`\ 10\ :sup:`-2` | mol m\ :sup:`-3` | CH\ :sub:`4` half-saturation oxidation coefficient (wetlands) | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`K_{O_{2} }` | 2 x 10\ :sup:`-2` | 2\ :math:`\times`\ 10\ :sup:`-3` - 2\ :math:`\times`\ 10\ :sup:`-1` | mol m\ :sup:`-3` | O\ :sub:`2` half-saturation oxidation coefficient | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + | | :math:`R_{o,\max }` | 1.25 x 10\ :math:`{}^{-5}` | 1.25\ :math:`\times`\ 10\ :math:`{}^{-6}` - 1.25\ :math:`\times`\ 10\ :math:`{}^{-4}` | mol m\ :sup:`-3` s\ :sup:`-1` | Maximum oxidation rate (wetlands) | + +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ + Ebullition --------------- @@ -384,18 +388,19 @@ source through aerenchyma. For gaseous diffusion, we adopted the temperature dependence of molecular free-air diffusion coefficients (:math:`{D}_{0}` -(m:sup:`2` s\ :sup:`-1`)) as described by Lerman et al. (1979) and applied by Wania et al. (2010) (Table 19.2). - -Table 19.2. Temperature dependence of aqueous and gaseous diffusion -coefficients for CH\ :sub:`4` and O\ :sub:`2`. - -+----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ -| :math:`{D}_{0}` (m\ :sup:`2` s\ :sup:`-1`) | CH\ :sub:`4` | O\ :sub:`2` | -+==========================================================+==========================================================+========================================================+ -| Aqueous | 0.9798 + 0.02986\ *T* + 0.0004381\ *T*\ :sup:`2` | 1.172+ 0.03443\ *T* + 0.0005048\ *T*\ :sup:`2` | -+----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ -| Gaseous | 0.1875 + 0.0013\ *T* | 0.1759 + 0.0011\ *T* | -+----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ +(m:sup:`2` s\ :sup:`-1`)) as described by Lerman et al. (1979) and applied by Wania et al. (2010) (:numref:`Table Temperature dependence of aqueous and gaseous diffusion`). + +.. _Table Temperature dependence of aqueous and gaseous diffusion: + +.. table:: Temperature dependence of aqueous and gaseous diffusion coefficients for CH\ :sub:`4` and O\ :sub:`2` + + +----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ + | :math:`{D}_{0}` (m\ :sup:`2` s\ :sup:`-1`) | CH\ :sub:`4` | O\ :sub:`2` | + +==========================================================+==========================================================+========================================================+ + | Aqueous | 0.9798 + 0.02986\ *T* + 0.0004381\ *T*\ :sup:`2` | 1.172+ 0.03443\ *T* + 0.0005048\ *T*\ :sup:`2` | + +----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ + | Gaseous | 0.1875 + 0.0013\ *T* | 0.1759 + 0.0011\ *T* | + +----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ Gaseous diffusivity in soils also depends on the molecular diffusivity, soil structure, porosity, and organic matter content. Moldrup et al. diff --git a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst index 28f43fce9a..c451a6dbef 100644 --- a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst +++ b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst @@ -14,7 +14,7 @@ where :math:`\vec{S}` is the net solar flux absorbed by the vegetation Solar Fluxes ---------------- -Figure 4.1 illustrates the direct beam and diffuse fluxes in the canopy. +:numref:`Figure Radiation Schematic` illustrates the direct beam and diffuse fluxes in the canopy. :math:`I\, \uparrow _{\Lambda }^{\mu }` and :math:`I\, \uparrow _{\Lambda }` are the upward diffuse fluxes, per unit incident direct beam and diffuse flux (section 3.1). @@ -32,14 +32,17 @@ albedos (section 3.2). :math:`L` and :math:`S` are the exposed leaf area index and stem area index (section 2.1.4). :math:`K` is the optical depth of direct beam per unit leaf and stem area (section 3.1). -Figure 4.1. Schematic diagram of (a) direct beam radiation, (b) diffuse -solar radiation, and (c) longwave radiation absorbed, transmitted, and -reflected by vegetation and ground. +.. _Figure Radiation Schematic: + +.. figure:: image1.png + + Schematic diagram of (a) direct beam radiation, (b) diffuse + solar radiation, and (c) longwave radiation absorbed, transmitted, and + reflected by vegetation and ground. For clarity, terms involving :math:`T^{n+1} -T^{n}` are not shown in (c). -.. image:: image1.png The total solar radiation absorbed by the vegetation and ground is @@ -169,7 +172,7 @@ longwave radiation (W m\ :sup:`-2`). The radiative temperature T_{rad} =\left(\frac{L\, \uparrow }{\sigma } \right)^{{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} } where :math:`\sigma` is the Stefan-Boltzmann constant (W\ m\ :sup:`-2` K\ :sup:`-4`) (Table 2.6). With reference to -Figure 4.1, the upward longwave radiation from the surface to the atmosphere is +:numref:`Figure Radiation Schematic`, the upward longwave radiation from the surface to the atmosphere is .. math:: :label: 4.11 diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst index 083c6b651e..0a7b941359 100644 --- a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst @@ -106,7 +106,7 @@ temperature :math:`T_{i}` [K]; thermal conductivity :math:`\lambda _{i}` [W m\ :sup:`-1` K\ :sup:`-1`]; volumetric heat capacity :math:`c_{i}` [J m\ :sup:`-3` K\ :sup:`-1`]) are defined for soil layers at the node depths -(Figure 6.1) and for snow layers at the layer midpoints. When present, +(:numref:`Figure Soil Temperature Schematic`) and for snow layers at the layer midpoints. When present, snow occupies a fraction of a grid cell’s area, therefore snow depth represents the thickness of the snowpack averaged over only the snow covered area. The grid cell average snow depth is related to the depth @@ -130,7 +130,8 @@ where the thermal conductivity at the interface \lambda \left[z_{h,\, i} \right]=\left\{\begin{array}{l} {\frac{\lambda _{i} \lambda _{i+1} \left(z_{i+1} -z_{i} \right)}{\lambda _{i} \left(z_{i+1} -z_{h,\, i} \right)+\lambda _{i+1} \left(z_{h,\, i} -z_{i} \right)} \qquad i=snl+1,\ldots ,N_{levgrnd} -1} \\ {0\qquad i=N_{levgrnd} } \end{array}\right\}. -These equations are derived, with reference to Figure 6.1, assuming +These equations are derived, with reference to +:numref:`Figure Soil Temperature Schematic`, assuming that the heat flux from :math:`i` (depth :math:`z_{i}` ) to the interface between :math:`i` and :math:`i+1` (depth :math:`z_{h,\, i}` ) equals the heat flux from the interface to :math:`i+1` (depth diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index fad229fe7c..e6f40c34ef 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -345,12 +345,14 @@ discussions new amended wood harvest targets were generated with regional targets through GLM for the RCP 6.0 and RCP 8.5 time series as described in Lawrence et al. (2012). -Figure 21.1. Schematic of land cover change impacts on CLM carbon pools -and fluxes. +.. _Figure Schematic of land cover change: -.. image:: image1.png +.. figure:: image1.png -Figure 21.2. Schematic of translation of annual UNH land units to CLM4 -plant functional types. + Schematic of land cover change impacts on CLM carbon pools and fluxes. -.. image:: image2.png +.. _Figure Schematic of translation of annual UNH land units: + +.. figure:: image2.png + + Schematic of translation of annual UNH land units to CLM4 plant functional types. diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index b95589f7b4..df42e024e9 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -103,15 +103,22 @@ climate and socioeconomic considerations. The surface dataset creation routines (see CLM4.5 User’s Guide) aggregate the data to the desired resolution. -Figure 12.1. Schematic representation of the urban land unit. +.. _Figure Schematic representation of the urban land unit: + +.. figure:: image1.png + + Schematic representation of the urban land unit. See the text for description of notation. Incident, reflected, and net solar and longwave radiation are calculated for each individual surface but are not shown for clarity. -.. image:: image1.png -Figure 12.2. Schematic of urban and atmospheric model coupling. +.. _Figure Schematic of urban and atmospheric model coupling: + +.. figure:: image2.png + + Schematic of urban and atmospheric model coupling. The urban model is forced by the atmospheric model wind (:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific @@ -129,4 +136,4 @@ absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature (:math:`u_{c}` ) within the urban canopy layer are diagnosed by the urban model. :math:`H` is the average building height. -.. image:: image2.png + diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index de270ebdc6..251e1acfcd 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -31,9 +31,11 @@ maintained as a separate state variable for each tissue type. Storage reduce the complexity of accounting for transfers into and out of storage over the course of a single growing season. -Figure 14.1. Example of annual phenology cycle for seasonal deciduous. +.. _Figure annual phenology cycle: -.. image:: image1.png +.. figure:: image1.png + + Example of annual phenology cycle for seasonal deciduous. 14.1.1 Onset Periods ^^^^^^^^^^^^^^^^^^^^ From 9b9e27d1a21af2007037f38d3a7f7d381b3524c0 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 30 May 2017 15:39:12 -0600 Subject: [PATCH 0028/1973] Chapter 15 urban model updates and cleanup --- .../tech_note/Urban/CLM50_Tech_Note_Urban.rst | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index b95589f7b4..e53b33463f 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -5,7 +5,8 @@ Urban Model (CLMU) At the global scale, and at the coarse spatial resolution of current climate models, urbanization has negligible impact on climate. However, -the urban parameterization (CLMU; Oleson et al. 2008b,c) allows +the urban parameterization (CLMU; :ref:`Oleson et al. (2008b) `; +:ref:`Oleson et al. (2008c) `) allows simulation of the urban environment within a climate model, and particularly the temperature where people live. As such, the urban model allows scientific study of how climate change affects the urban heat @@ -13,7 +14,8 @@ island and possible urban planning and design strategies to mitigate warming (e.g., white roofs). The urban model that was released as a component of CLM4.0 is separately -described in the urban technical note (Oleson et al. 2010b). Here, we +described in the urban technical note (:ref:`Oleson et al. (2010b) `). +Here, we provide a brief overview of the urban model released as a component of CLM4.5. The main changes in the urban model from CLM4.0 to CLM4.5 are 1) an expansion of the single urban landunit to up to three landunits per @@ -28,9 +30,11 @@ calculations for the pervious road now follows CLM4.5 parameterizations. Urban areas in CLM are represented by up to three urban landunits per gridcell according to density class. The urban landunit is based on the -“urban canyon” concept of Oke (1987) in which the canyon geometry is +“urban canyon” concept of :ref:`Oke (1987) ` in which +the canyon geometry is described by building height (:math:`H`) and street width (:math:`W`) -(Figure 12.1). The canyon system consists of roofs, walls, and canyon +(:numref:`Figure schematic representation of urban`). The canyon system +consists of roofs, walls, and canyon floor. Walls are further divided into shaded and sunlit components. The canyon floor is divided into pervious (e.g., to represent residential lawns, parks) and impervious (e.g., to represent roads, parking lots, @@ -39,12 +43,13 @@ pervious fraction; instead evaporation is parameterized by a simplified bulk scheme. Each of the five urban surfaces is treated as a column within the -landunit (Figure 12.1). Radiation parameterizations account for trapping +landunit (:numref:`Figure schematic representation of urban`). +Radiation parameterizations account for trapping of solar and longwave radiation inside the canyon. Momentum fluxes are determined for the urban landunit using a roughness length and displacement height appropriate for the urban canyon and stability formulations from CLM. A one-dimensional heat conduction equation is -solved numerically for a multiple-layer (:math:`N_{levurb} =5`) column +solved numerically for a multiple-layer (:math:`N_{levurb} =10`) column to determine conduction fluxes into and out of canyon surfaces. The interior boundary conditions for roofs and walls are determined by an interior building temperature (:math:`T_{iB}` ) held between prescribed @@ -67,7 +72,8 @@ maximum ponding depth runs off The heat and moisture fluxes from each surface interact with each other through a bulk air mass that represents air in the urban canopy layer for which specific humidity (:math:`q_{ac}` ) and temperature -(:math:`T_{ac}` ) are prognosed (Figure 12.2). The air temperature can +(:math:`T_{ac}` ) are prognosed (:numref:`Figure schematic of urban and atmospheric model coupling`). +The air temperature can be compared with that from surrounding vegetated/soil (rural) surfaces in the model to ascertain heat island characteristics. As with other landunits, the CLMU is forced either with output from a host atmospheric @@ -103,30 +109,19 @@ climate and socioeconomic considerations. The surface dataset creation routines (see CLM4.5 User’s Guide) aggregate the data to the desired resolution. -Figure 12.1. Schematic representation of the urban land unit. +.. Figure 12.1. Schematic representation of the urban land unit -See the text for description of notation. Incident, reflected, and net -solar and longwave radiation are calculated for each individual surface -but are not shown for clarity. +.. _Figure schematic representation of urban: -.. image:: image1.png +.. Figure:: image1.png -Figure 12.2. Schematic of urban and atmospheric model coupling. + Schematic representation of the urban land unit. See the text for description of notation. Incident, reflected, and net solar and longwave radiation are calculated for each individual surface but are not shown for clarity. -The urban model is forced by the atmospheric model wind -(:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific -humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar -(:math:`S_{atm} \, \downarrow` ) and longwave -(:math:`L_{atm} \, \downarrow` ) radiation at reference height -:math:`z'_{atm}` (section 2.2.1). Fluxes from the urban landunit to the -atmosphere are turbulent sensible (:math:`H`) and latent heat -(:math:`\lambda E`), momentum (:math:`\tau` ), albedo -(:math:`I\uparrow` ), emitted longwave (:math:`L\uparrow` ), and -absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature +.. Figure 12.2. Schematic of urban and atmospheric model coupling -(:math:`T_{ac}` ), specific humidity (:math:`q_{ac}` ), and wind speed -(:math:`u_{c}` ) within the urban canopy layer are diagnosed by the -urban model. :math:`H` is the average building height. +.. _Figure schematic of urban and atmospheric model coupling: -.. image:: image2.png +.. Figure:: image2.png + + Schematic of urban and atmospheric model coupling. The urban model is forced by the atmospheric model wind (:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar (:math:`S_{atm} \, \downarrow` ) and longwave (:math:`L_{atm} \, \downarrow` ) radiation at reference height :math:`z'_{atm}` (section 2.2.1). Fluxes from the urban landunit to the atmosphere are turbulent sensible (:math:`H`) and latent heat (:math:`\lambda E`), momentum (:math:`\tau` ), albedo (:math:`I\uparrow` ), emitted longwave (:math:`L\uparrow` ), and absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature (:math:`T_{ac}` ), specific humidity (:math:`q_{ac}` ), and wind speed (:math:`u_{c}` ) within the urban canopy layer are diagnosed by the urban model. :math:`H` is the average building height. From 0bdb352242c6bc6d4b88b67786325e3748325004 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 30 May 2017 17:46:39 -0600 Subject: [PATCH 0029/1973] Chapter 15 Urban model updates and cleanup --- .../References/CLM50_Tech_Note_References.rst | 12 +++ .../tech_note/Urban/CLM50_Tech_Note_Urban.rst | 80 ++++++++++++------- 2 files changed, 64 insertions(+), 28 deletions(-) diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 7fb1521105..5c278d1e0f 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -221,6 +221,12 @@ biomass across multiple biogeographical regions. Ecol. Appl. 10:95-114. Busing, R.T. 2005. Tree mortality, canopy turnover, and woody detritus in old cove forests of the southern Appalachians. Ecology 86:73-84. +.. _Buzanetal2015: + +Buzan, J.R., Oleson, K., and Huber, M. 2015: Implementation and +comparison of a suite of heat stress metrics within the Community Land +Model version 4.5, Geosci. Model Dev., 8, 151-170, doi:10.5194/gmd-8-151-2015. + .. _CampbellNorman1998: Campbell, G.S., and Norman, J.M. 1998. An Introduction to Environmental @@ -1616,6 +1622,12 @@ Simpson, R.J., Lambers, H., and Dalling, M.J. 1983. Nitrogen redistribution during grain growth in wheat (Triticum avestivum L.). Plant Physiol. 71:7-14. +.. _Sivak2013: + +Sivak, M. 2013. Air conditioning versus heating: climate control is more +energy demanding in Minneapolis than in Miami. Environ. Res. Lett., 8, +doi:10.1088/1748-9326/8/1/014050. + .. _Smithetal2005: Smith, A.M.S., Wooster, M.J., Drake, N.A., Dipotso, F.M. and Perry, diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index 8292ea3394..35a77b901f 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -13,21 +13,6 @@ allows scientific study of how climate change affects the urban heat island and possible urban planning and design strategies to mitigate warming (e.g., white roofs). -The urban model that was released as a component of CLM4.0 is separately -described in the urban technical note (:ref:`Oleson et al. (2010b) `). -Here, we -provide a brief overview of the urban model released as a component of -CLM4.5. The main changes in the urban model from CLM4.0 to CLM4.5 are 1) -an expansion of the single urban landunit to up to three landunits per -grid cell stratified by urban density types, 2) the number of urban -layers for roofs and walls is no longer constrained to be equal to the -number of ground layers, 3) space heating and air conditioning wasteheat -factors are now set to zero by default so that the user can customize -these factors for their own application, 4) the elevation threshold used -to eliminate urban areas in the surface dataset creation routines has -been changed from 2200 meters to 2600 meters, 5) hydrologic and thermal -calculations for the pervious road now follows CLM4.5 parameterizations. - Urban areas in CLM are represented by up to three urban landunits per gridcell according to density class. The urban landunit is based on the “urban canyon” concept of :ref:`Oke (1987) ` in which @@ -50,15 +35,25 @@ determined for the urban landunit using a roughness length and displacement height appropriate for the urban canyon and stability formulations from CLM. A one-dimensional heat conduction equation is solved numerically for a multiple-layer (:math:`N_{levurb} =10`) column -to determine conduction fluxes into and out of canyon surfaces. The -interior boundary conditions for roofs and walls are determined by an -interior building temperature (:math:`T_{iB}` ) held between prescribed -maximum and minimum temperatures +to determine conduction fluxes into and out of canyon surfaces. + +A new building energy model has been developed for CLM5.0. It accounts +for the conduction of heat through interior surfaces (roof, sunlit and +shaded walls, and floors), convection (sensible heat exchange) between +interior surfaces and building air, longwave radiation exchange between +interior surfaces, and ventilation (natural infiltration and exfiltration). +Idealized HAC systems are assumed where the system capacity is infinite and +the system supplies the amount of energy needed to keep the indoor air +temperature (:math:`T_{iB}`) within maximum and minimum emperatures (:math:`T_{iB,\, \max } ,\, T_{iB,\, \min }` ), thus explicitly -resolving space heating and air conditioning fluxes. Anthropogenic -sources of waste heat (:math:`Q_{H,\, waste}` ) from air conditioning -and space heating can be optionally incorporated as modifications to the -canyon energy budget. Turbulent [sensible heat (:math:`Q_{H,\, u}` ) and +resolving space heating and air conditioning fluxes. Anthropogenic sources +of waste heat (:math:`Q_{H,\, waste}` ) from HAC that account for inefficiencies +in the heating and air conditioning equipment and from energy lost in the +conversion of primary energy sources to end use energy are derived from +:ref:`Sivak (2013) `. These sources of waste heat are incorporated +as modifications to the canyon energy budget. + +Turbulent [sensible heat (:math:`Q_{H,\, u}` ) and latent heat (:math:`Q_{E,\, u}` )] and storage (:math:`Q_{S,\, u}` ) heat fluxes and surface (:math:`T_{u,\, s}` ) and internal (:math:`T_{u,\, i=1,\, N_{levgrnd} }` ) temperatures are determined for @@ -77,7 +72,7 @@ The air temperature can be compared with that from surrounding vegetated/soil (rural) surfaces in the model to ascertain heat island characteristics. As with other landunits, the CLMU is forced either with output from a host atmospheric -model (e.g., the Community Atmosphere Model (stocktickerCAM)) or +model (e.g., the Community Atmosphere Model (CAM)) or observed forcing (e.g., reanalysis or field observations). The urban model produces sensible, latent heat, and momentum fluxes, emitted longwave, and reflected solar radiation, which are area-averaged with @@ -85,11 +80,11 @@ fluxes from non-urban “landunits” (e.g., vegetation, lakes) to supply grid cell averaged fluxes to the atmospheric model. Present day global urban extent and urban properties were developed by -Jackson et al. (2010). Urban extent, defined for four classes [tall +:ref:`Jackson et al. (2010) `. Urban extent, defined for four classes [tall building district (TBD), and high, medium, and low density (HD, MD, LD)], was derived from LandScan 2004, a population density dataset derived from census data, nighttime lights satellite observations, road -proximity, and slope (Dobson et al. 2000). The urban extent data for +proximity, and slope (:ref:`Dobson et al. 2000 `). The urban extent data for TBD, HD, and MD classes are aggregated from the original 1 km resolution to both a 0.05\ :sup:`o` by 0.05\ :sup:`o` global grid for high-resolution studies or a 0.5\ :sup:`o` by @@ -106,7 +101,7 @@ fraction, average building height, and pervious fraction of the canyon floor) properties are provided for each of the density classes. Building interior minimum and maximum temperatures are prescribed based on climate and socioeconomic considerations. The surface dataset creation -routines (see CLM4.5 User’s Guide) aggregate the data to the desired +routines (see CLM5.0 User’s Guide) aggregate the data to the desired resolution. .. Figure 12.1. Schematic representation of the urban land unit @@ -123,4 +118,33 @@ resolution. .. Figure:: image2.png - Schematic of urban and atmospheric model coupling. The urban model is forced by the atmospheric model wind (:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar (:math:`S_{atm} \, \downarrow` ) and longwave (:math:`L_{atm} \, \downarrow` ) radiation at reference height :math:`z'_{atm}` (section 2.2.1). Fluxes from the urban landunit to the atmosphere are turbulent sensible (:math:`H`) and latent heat (:math:`\lambda E`), momentum (:math:`\tau` ), albedo (:math:`I\uparrow` ), emitted longwave (:math:`L\uparrow` ), and absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature (:math:`T_{ac}` ), specific humidity (:math:`q_{ac}` ), and wind speed (:math:`u_{c}` ) within the urban canopy layer are diagnosed by the urban model. :math:`H` is the average building height. + Schematic of urban and atmospheric model coupling. The urban model is forced by the atmospheric model wind (:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar (:math:`S_{atm} \, \downarrow` ) and longwave (:math:`L_{atm} \, \downarrow` ) radiation at reference height :math:`z'_{atm}` (section :numref:`Atmospheric Coupling`). Fluxes from the urban landunit to the atmosphere are turbulent sensible (:math:`H`) and latent heat (:math:`\lambda E`), momentum (:math:`\tau` ), albedo (:math:`I\uparrow` ), emitted longwave (:math:`L\uparrow` ), and absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature (:math:`T_{ac}` ), specific humidity (:math:`q_{ac}` ), and wind speed (:math:`u_{c}` ) within the urban canopy layer are diagnosed by the urban model. :math:`H` is the average building height. + +The urban model that was first lreleased as a component of CLM4.0 is separately +described in the urban technical note (:ref:`Oleson et al. (2010b) `). +The main changes in the urban model from CLM4.0 to CLM4.5 were 1) +an expansion of the single urban landunit to up to three landunits per +grid cell stratified by urban density types, 2) the number of urban +layers for roofs and walls was no longer constrained to be equal to the +number of ground layers, 3) space heating and air conditioning wasteheat +factors were set to zero by default so that the user could customize +these factors for their own application, 4) the elevation threshold used +to eliminate urban areas in the surface dataset creation routines was +increased from 2200 meters to 2600 meters, 5) hydrologic and thermal +calculations for the pervious road followed CLM4.5 parameterizations. + +The main changes in the urban model from CLM4.5 to CLM5.0 are 1) a more +sophisticated and realistic building space heating and air conditioning +submodel that prognoses interior building air temperature and includes more +realistic space heating and air conditioning wasteheat factors (see above), 2) the maximum +building temperature (which determines air conditioning demand) is now read in +from a namelist-defined file which allows for dynamic control of this input +variable. The maximum building temperatures that are defined in +:ref:`Jackson et al. (2010) ` are implemented in year 1950 (thus +air conditioning is off in prior years) and air conditioning is turned off in year +2100 (because the buildings are not suitable for air conditioning in some extreme +global warming scenarios). These feature will be described in more detail in +a forthcoming paper. In addition, a module of heat stress indices calculated online +in the model that can be used to assess human thermal comfort for rural and urban +areas has been added. This last development is described and evaluated by +:ref:`Buzan et al. (2015) `. From a9fcbcfb792a6f63adec14e59e68d4ba0f036a1f Mon Sep 17 00:00:00 2001 From: djk2120 Date: Wed, 31 May 2017 11:08:47 -0400 Subject: [PATCH 0030/1973] Update PHS equations for sections 11.1-3 --- ...CLM50_Tech_Note_Plant_Hydraulic_Stress.rst | 253 ++++++++++++++++++ 1 file changed, 253 insertions(+) diff --git a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst b/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst index ed75965d41..e5541bf2b4 100644 --- a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst +++ b/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst @@ -2,3 +2,256 @@ Plant Hydraulic Stress ====================== + +Hello + +.. _Plant Water Supply: + +Plant Water Supply +----------------------- + +PHS explicitly models water transport through the vegetation according to a simple hydraulic framework following Darcy's Law for porous media flow equations. The supply equations are used to solve for vegetation water potential forced by a given transpiration and the set of layer-by-layer soil water potentials. + +The water supply is discretized into segments: soil-to-root, root-to-stem, and stem-to-leaf. There are typically several (1-49) soil-to-root flows operating in parallel, one per soil layer. There are two stem-to-leaf flows operating in parallel, corresponding to the sunlit and shaded "leaves". + +In general the water fluxes (e.g. soil-to-root, root-to-stem, etc) are calculated as: + +.. math:: + :label: 11.1) + + q = kA\Delta\psi + + +:math:`q` is the flux of water (mmH\ :sub:`2`\ O) + +:math:`k` is the hydraulic conductance (s\ :sup:`-1`\ ) + +:math:`A` is the area basis (m\ :sup:`2`\ /m\ :sup:`2`\ ) + +:math:`\Delta\psi` is the gradient in water potential (mmH\ :sub:`2`\ O) + +.. math:: + :label: 11.2) + + k=k_{max}\cdot 2^{-\left(\dfrac{\psi}{p50}\right)^{c_k}} + +:math:`k_{max}` is the maximum segment conductance (s-1) + +:math:`p50` is the water potential at 50% loss of conductivity (mmH2O) + +:math:`\psi` is the water potential of the lower segment terminus (mmH2O) + +.. math:: + :label: 11.3) + + q_{1a}=k_{1a}*\mbox{LAI}_{sun}*\left(\psi_{stem}-\psi_{sunleaf} \right) + +.. math:: + :label: 11.4) + + q_{1b}=k_{1b}*\mbox{LAI}_{shade}*\left(\psi_{stem}-\psi_{shadeleaf} \right) + +.. math:: + :label: 11.5) + + k_{1a}=k_{1a,max}*2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} + +.. math:: + :label: 11.6) + + k_{1b}=k_{1b,max}*2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} + +Variables: + +:math:`LAI_{sun}` = sunlit leaf area index (m2/m2) + +:math:`LAI_{shade}` = shaded leaf area index (m2/m2) + +:math:`\psi_{stem}` = stem water potential (mmH20) + +:math:`\psi_{sunleaf}` = sunlit leaf water potential (mmH20) + +:math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH20) + +Parameters: + +:math:`k_{1a,max}` = maximum leaf conductance (s-1) + +:math:`k_{1b,max}` = maximum leaf conductance (s-1) + +:math:`p50_{1}` = water potential at 50% loss of conductance (mmH2O) + +:math:`c_{k}` = vulnerability curve shape-fitting parameter (-) + +.. math:: + :label: 11.7) + + q_2=k_2 \cdot SAI \cdot \left( \psi_{root} - \psi_{stem} - \Delta \psi_z \right) + +.. math:: + :label: 11.8) + + k_2=\dfrac{k_{2,max}}{z_2} \cdot 2^{-\left(\dfrac{\psi_{root}}{p50_2}\right)^{c_k}} + +Variables: + +:math:`SAI` = stem area index (m2/m2) + +:math:`\Delta\psi_z` = gravitational potential (mmH2O) + +:math:`\psi_{root}` = root water potential (mmH2O) + +:math:`\psi_{stem}` = stem water potential (mmH2O) + +Parameters: + +:math:`k_{2,max}` = maximum stem conductivity (m/s) + +:math:`p50_2` = water potential at 50% loss of conductivity (mmH2O) + +:math:`z_2` = vegetation height (m) + +.. math:: + :label: 11.9) + + q_{3,i}=k_{3,i}*RAI*\left(\psi_{soil,i}-\psi_{root} + \Delta\psi_{z,i} \right) + +.. math:: + :label: 11.10) + + RAI=\left(LAI+SAI \right)\cdot r_i \cdot f_{root-leaf} + +.. math:: + :label: 11.11) + + k_{3,i}=\dfrac{k_{root}*k_{soil-to-root}}{k_{root}+k_{soil-to-root}} + +.. math:: + :label: 11.12) + + k_{root,i}=\dfrac{k_{3,max}}{z_{3,i}}*2^{-\left(\dfrac{\psi_{soil,i}}{p50_3}\right)^{c_k}} + +.. math:: + :label: 11.13) + + k_{soil-to-root} = \dfrac{k_{soil,i}}{dx_{root,i}} + +.. math:: + :label: 11.14) + + dx_{root,i} = \left(\pi*\mbox{root-length-density}_i\right)^{-0.5} + +.. math:: + :label: 11.15) + + \mbox{root-length-density} = \dfrac{\mbox{total root length}}{\mbox{soil volume}} + +Variables: + +:math:`\Delta\psi_{z,i}` = change in gravitational potential from soil layer :math:`i` to surface (mmH2O) + +:math:`LAI` = total leaf area index (m2/m2) + +:math:`SAI` = stem area index (m2/m2) + +:math:`\psi_{soil,i}` = water potential in soil layer :math:`i` (mmH2O) + +:math:`\psi_{root}` = root water potential (mmH2O) + +:math:`z_{3,i}` = length of root tissue conducting path = soil layer depth + root lateral length (m) + +:math:`r_i` = root fraction in soil layer :math:`i` (-) + +:math:`k_{soil,i}` = Brooks-Corey soil conductivity in soil layer :math:`i` (m/s) + +Parameters: + +:math:`f_{root-leaf}` = root-to-shoot ratio (-) + +:math:`p50_3` = water potential at 50% loss of root tissue conductance (mmH2O) + +:math:`ck` = shape-fitting parameter for vulnerability curve (-) + +.. _Plant Water Demand: + +Plant Water Demand +----------------------- + +.. math:: + :label: 11.16) + + E_{sun} = E_{sun,max}*2^{-\left(\dfrac{\psi_{sunleaf}}{p50_e}\right)^{c_k}} + +.. math:: + :label: 11.17) + + E_{shade} = E_{shade,max}*2^{-\left(\dfrac{\psi_{shadeleaf}}{p50_e}\right)^{c_k}} + +.. math:: + :label: 11.18) + + B_{t,sun} = \dfrac{g_{s,sun}}{g_{s,sun,B_t=1}} + +.. math:: + :label: 11.19) + + B_{t,shade} = \dfrac{g_{s,shade}}{g_{s,shade,B_t=1}} + +:math:`E_{sun}` = sunlit leaf transpiration (mm/s) + +:math:`E_{shade}` = shaded leaf transpiration (mm/s) + +:math:`E_{sun,max}` = sunlit leaf transpiration absent water stress (mm/s) + +:math:`E_{shade,max}` = shaded leaf transpiration absent water stress (mm/s) + +:math:`\psi_{sunleaf}` = sunlit leaf water potential (mmH2O) + +:math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH2O) + +:math:`g_{s,sun}` = stomatal conductance of water corresponding to :math:`E_{sun}` + +:math:`g_{s,shade}` = stomatal conductance of water corresponding to :math:`E_{shade}` + +:math:`g_{s,sun,max}` = stomatal conductance of water corresponding to :math:`E_{sun,max}` + +:math:`g_{s,shade,max}` = stomatal conductance of water corresponding to :math:`E_{shade,max}` + +.. _Vegetation Water Potential: + +Vegetation Water Potential +----------------------------- + +PHS explicitly models root, stem, shaded leaf, and sunlit leaf water potential at each timestep. PHS iterates to find the vegetation water potential vector :math:`\psi` that satisfies continuity in the non-linear vegetation water supply and demand equations. + +.. math:: + :label: 11.20) + + \psi=\left[\psi_{sunleaf},\psi_{shadeleaf},\psi_{stem},\psi_{root}\right] + +.. math:: + :label: 11.21) + + \begin{aligned} + E_{sun}&=q_{1a}\\ + E_{shade}&=q_{1b}\\ + E_{sun}+E_{shade}&=q_{1a}+q_{1b}\\ + &=q_2\\ + &=\sum_{i=1}^{nlevsoi}{q_{3,i}} + \end{aligned} + +The demand terms (left-hand side) are decreasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, water stress increases, causing a decrease in transpiration demand. The supply terms (right-hand side) are increasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, the gradients in water potential increase, causing an increase in vegetation water supply. PHS takes a Newton's method approach to iteratively solve for the vegetation water potentials that satisfy equations in (11.21). + +.. math:: + :label: 11.21) + + ff + + + +Yo + + + + + From a6688bd5ff15bf17801cca034cd4b0ad57e52af6 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 31 May 2017 11:20:53 -0600 Subject: [PATCH 0031/1973] update Fluxes chapter --- .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 555 +++++++++--------- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 2 +- .../tech_note/Urban/CLM50_Tech_Note_Urban.rst | 2 +- 3 files changed, 282 insertions(+), 277 deletions(-) diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 0d8d213cb4..0ffe6e43f3 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -45,12 +45,12 @@ momentum between the atmosphere at height :math:`z_{atm,\, m}` and the surface at height :math:`z_{0m} +d`. Thus, the momentum fluxes become .. math:: - :label: + :label: 5.5 \tau _{x} =-\rho _{atm} \frac{u_{atm} }{r_{am} } .. math:: - :label: + :label: 5.6 \tau _{y} =-\rho _{atm} \frac{v_{atm} }{r_{am} } . @@ -76,7 +76,7 @@ where :math:`T_{atm}` is the air temperature (K) at height m\ :sup:`-1` is the negative of the dry adiabatic lapse rate [this expression is first-order equivalent to :math:`\theta _{atm} =T_{atm} \left({P_{srf} \mathord{\left/ {\vphantom {P_{srf} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } \right)^{{R_{da} \mathord{\left/ {\vphantom {R_{da} C_{p} }} \right. \kern-\nulldelimiterspace} C_{p} } }` -(Stull 1988), where :math:`P_{srf}` is the surface pressure (Pa), +(:ref:`Stull 1988 `), where :math:`P_{srf}` is the surface pressure (Pa), :math:`P_{atm}` is the atmospheric pressure (Pa), and :math:`R_{da}` is the gas constant for dry air (J kg\ :sup:`-1` K\ :sup:`-1`) (:numref:`Table Physical constants`)]. By definition, :math:`\theta _{s} =T_{s}` . The density of moist air (kg m\ :sup:`-3`) is @@ -109,7 +109,7 @@ from Monin-Obukhov similarity applied to the surface layer. This theory states that when scaled appropriately, the dimensionless mean horizontal wind speed, mean potential temperature, and mean specific humidity profile gradients depend on unique functions of -:math:`\zeta =\frac{z-d}{L}` (Zeng et al. 1998) as +:math:`\zeta =\frac{z-d}{L}` (:ref:`Zeng et al. 1998`) as .. math:: :label: 5.10 @@ -162,8 +162,7 @@ components :math:`\overline{u'w'}=-\frac{\tau _{x} }{\rho _{atm} }` and :math:`H` is the sensible heat flux (W m\ :sup:`-2`) and :math:`E` is the water vapor flux (kg m\ :sup:`-2` s\ :sup:`-1`). -The dimensionless length scale :math:`L` is the Monin-Obukhov length -defined as +The length scale :math:`L` is the Monin-Obukhov length defined as .. math:: :label: 5.16 @@ -179,7 +178,7 @@ stable conditions. :math:`L<0` indicates unstable conditions. :math:`\theta _{v*}` is defined as .. math:: - :label: ZEqnNum632600 + :label: 5.17 \theta _{v*} u_{*} =\left[\theta _{*} \left(1+0.61q_{atm} \right)+0.61\overline{\theta _{atm} }q_{*} \right]u_{*} @@ -246,7 +245,7 @@ Defining the surface values and the atmospheric values at :math:`z_{2} =z_{atm,\, x}` .. math:: - :label: ZEqnNum228149 + :label: 5.24 \left|{\it u}\right|_{2} =V_{a} {\rm =\; }\sqrt{u_{atm}^{2} +v_{atm}^{2} +U_{c}^{2} } \ge 1, @@ -280,15 +279,18 @@ surface fluxes as follows .. math:: :label: 5.28 - {U_{c} = 0\ \qquad \zeta \ge {\rm 0} {\rm (stable)}} \\ - {U_{c} = \beta w_{\*} \qquad \zeta <0 {\rm (unstable})} + U_{c} = \left\{ + \begin{array}{ll} + 0 & \qquad \zeta \ge {\rm 0} \quad {\rm (stable)} \\ + \beta w_{*} & \qquad \zeta < 0 \quad {\rm (unstable)} + \end{array} \right\} -where :math:`w_{\*}` is the convective velocity scale +where :math:`w_{*}` is the convective velocity scale .. math:: :label: 5.29 - w_{\*} =\left(\frac{-gu_{\*} \theta _{v*} z_{i} }{\overline{\theta _{v,\, atm} }} \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } , + w_{*} =\left(\frac{-gu_{\*} \theta _{v*} z_{i} }{\overline{\theta _{v,\, atm} }} \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } , :math:`z_{i} =1000` is the convective boundary layer height (m), and :math:`\beta =1`. @@ -297,14 +299,24 @@ The momentum flux gradient relations are (:ref:`Zeng et al. 1998 ` .. math:: :label: 5.30 - \begin{array}{l} {\phi _{m} \left(\zeta \right)=0.7k^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \left(-\zeta \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } \qquad {\rm for\; }\zeta <-1.574{\rm \; (very\; unstable)}} \\ {\phi _{m} \left(\zeta \right)=\left(1-16\zeta \right)^{-{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} } \qquad {\rm for\; -1.574}\le \zeta <0{\rm \; (unstable)}} \\ {\phi _{m} \left(\zeta \right)=1+5\zeta \qquad {\rm for\; }0\le \zeta \le 1{\rm \; (stable)}} \\ {\phi _{m} \left(\zeta \right)=5+\zeta \qquad {\rm for\; }\zeta {\rm >1\; (very\; stable).}} \end{array} + \begin{array}{llr} + \phi _{m} \left(\zeta \right)=0.7k^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \left(-\zeta \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } & \qquad {\rm for\; }\zeta <-1.574 & \ {\rm \; (very\; unstable)} \\ + \phi _{m} \left(\zeta \right)=\left(1-16\zeta \right)^{-{1\mathord{\left/ {\vphantom {1 4}} \right. \kern-\nulldelimiterspace} 4} } & \qquad {\rm for\; -1.574}\le \zeta <0 & \ {\rm \; (unstable)} \\ + \phi _{m} \left(\zeta \right)=1+5\zeta & \qquad {\rm for\; }0\le \zeta \le 1& \ {\rm \; (stable)} \\ + \phi _{m} \left(\zeta \right)=5+\zeta & \qquad {\rm for\; }\zeta >1 & \ {\rm\; (very\; stable).} + \end{array} The sensible and latent heat flux gradient relations are (:ref:`Zeng et al. 1998 `) .. math:: :label: 5.31 - \begin{array}{l} {\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=0.9k^{{4\mathord{\left/ {\vphantom {4 3}} \right. \kern-\nulldelimiterspace} 3} } \left(-\zeta \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } \qquad {\rm for\; }\zeta <-0.465{\rm \; (very\; unstable)}} \\ {\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=\left(1-16\zeta \right)^{-{1\mathord{\left/ {\vphantom {1 2}} \right. \kern-\nulldelimiterspace} 2} } \qquad {\rm for\; -0.465}\le \zeta <0{\rm \; (unstable)}} \\ {\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=1+5\zeta \qquad {\rm for\; }0\le \zeta \le 1{\rm \; (stable)}} \\ {\phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=5+\zeta \qquad {\rm for\; }\zeta {\rm >1\; (very\; stable).}} \end{array} + \begin{array}{llr} + \phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=0.9k^{{4\mathord{\left/ {\vphantom {4 3}} \right. \kern-\nulldelimiterspace} 3} } \left(-\zeta \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } & \qquad {\rm for\; }\zeta <-0.465 & \ {\rm \; (very\; unstable)} \\ + \phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=\left(1-16\zeta \right)^{-{1\mathord{\left/ {\vphantom {1 2}} \right. \kern-\nulldelimiterspace} 2} } & \qquad {\rm for\; -0.465}\le \zeta <0 & \ {\rm \; (unstable)} \\ + \phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=1+5\zeta & \qquad {\rm for\; }0\le \zeta \le 1 & \ {\rm \; (stable)} \\ + \phi _{h} \left(\zeta \right)=\phi _{w} \left(\zeta \right)=5+\zeta & \qquad {\rm for\; }\zeta >1 & \ {\rm \; (very\; stable).} + \end{array} To ensure continuous functions of :math:`\phi _{m} \left(\zeta \right)`, @@ -321,28 +333,28 @@ yield wind profiles for the following conditions: Very unstable :math:`\left(\zeta <-1.574\right)` .. math:: - :label: ZEqnNum566843 + :label: 5.32 V_{a} =\frac{u_{*} }{k} \left\{\left[\ln \frac{\zeta _{m} L}{z_{0m} } -\psi _{m} \left(\zeta _{m} \right)\right]+1.14\left[\left(-\zeta \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } -\left(-\zeta _{m} \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } \right]+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right\} Unstable :math:`\left(-1.574\le \zeta <0\right)` .. math:: - :label: ZEqnNum309568 + :label: 5.33 V_{a} =\frac{u_{*} }{k} \left\{\left[\ln \frac{z_{atm,\, m} -d}{z_{0m} } -\psi _{m} \left(\zeta \right)\right]+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right\} Stable :math:`\left(0\le \zeta \le 1\right)` .. math:: - :label: ZEqnNum973766 + :label: 5.34 V_{a} =\frac{u_{*} }{k} \left\{\left[\ln \frac{z_{atm,\, m} -d}{z_{0m} } +5\zeta \right]-5\frac{z_{0m} }{L} \right\} Very stable :math:`\left(\zeta >1\right)` .. math:: - :label: ZEqnNum310559 + :label: 5.35 V_{a} =\frac{u_{*} }{k} \left\{\left[\ln \frac{L}{z_{0m} } +5\right]+\left[5\ln \zeta +\zeta -1\right]-5\frac{z_{0m} }{L} \right\} @@ -362,14 +374,14 @@ The potential temperature profiles are: Very unstable :math:`\left(\zeta <-0.465\right)` .. math:: - :label: ZEqnNum382106 + :label: 5.37 \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left\{\left[\ln \frac{\zeta _{h} L}{z_{0h} } -\psi _{h} \left(\zeta _{h} \right)\right]+0.8\left[\left(-\zeta _{h} \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } -\left(-\zeta \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } \right]+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right\} Unstable :math:`\left(-0.465\le \zeta <0\right)` .. math:: - :label: ZEqnNum767002 + :label: 5.38 \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left\{\left[\ln \frac{z_{atm,\, h} -d}{z_{0h} } -\psi _{h} \left(\zeta \right)\right]+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right\} @@ -377,14 +389,14 @@ Unstable :math:`\left(-0.465\le \zeta <0\right)` Stable :math:`\left(0\le \zeta \le 1\right)` .. math:: - :label: ZEqnNum556410 + :label: 5.39 \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left\{\left[\ln \frac{z_{atm,\, h} -d}{z_{0h} } +5\zeta \right]-5\frac{z_{0h} }{L} \right\} Very stable :math:`\left(\zeta >1\right)` .. math:: - :label: ZEqnNum846197 + :label: 5.40 \theta _{atm} -\theta _{s} =\frac{\theta _{*} }{k} \left\{\left[\ln \frac{L}{z_{0h} } +5\right]+\left[5\ln \zeta +\zeta -1\right]-5\frac{z_{0h} }{L} \right\}. @@ -393,28 +405,28 @@ The specific humidity profiles are: Very unstable :math:`\left(\zeta <-0.465\right)` .. math:: - :label: ZEqnNum299834 + :label: 5.41 q_{atm} -q_{s} =\frac{q_{*} }{k} \left\{\left[\ln \frac{\zeta _{w} L}{z_{0w} } -\psi _{w} \left(\zeta _{w} \right)\right]+0.8\left[\left(-\zeta _{w} \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } -\left(-\zeta \right)^{{-1\mathord{\left/ {\vphantom {-1 3}} \right. \kern-\nulldelimiterspace} 3} } \right]+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right\} Unstable :math:`\left(-0.465\le \zeta <0\right)` .. math:: + :label: 5.42 - \label{ZEqnNum142122} q_{atm} -q_{s} =\frac{q_{*} }{k} \left\{\left[\ln \frac{z_{atm,\, w} -d}{z_{0w} } -\psi _{w} \left(\zeta \right)\right]+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right\} Stable :math:`\left(0\le \zeta \le 1\right)` .. math:: - :label: ZEqnNum350694 + :label: 5.43 q_{atm} -q_{s} =\frac{q_{*} }{k} \left\{\left[\ln \frac{z_{atm,\, w} -d}{z_{0w} } +5\zeta \right]-5\frac{z_{0w} }{L} \right\} Very stable :math:`\left(\zeta >1\right)` .. math:: - :label: ZEqnNum211437 + :label: 5.44 q_{atm} -q_{s} =\frac{q_{*} }{k} \left\{\left[\ln \frac{L}{z_{0w} } +5\right]+\left[5\ln \zeta +\zeta -1\right]-5\frac{z_{0w} }{L} \right\} @@ -434,7 +446,7 @@ using atmospheric and surface values for :math:`\left|{\it u}\right|`, bulk Richardson number .. math:: - :label: ZEqnNum750428} + :label: 5.46 R_{iB} =\frac{\theta _{v,\, atm} -\theta _{v,\, s} }{\overline{\theta _{v,\, atm} }} \frac{g\left(z_{atm,\, m} -d\right)}{V_{a}^{2} } @@ -455,27 +467,35 @@ stable conditions to determine :math:`\psi _{m} \left(\zeta \right)` and guess for :math:`\zeta` and thus :math:`L` from .. math:: + :label: 5.48 - \label{ZEqnNum979946} - \begin{array}{l} {\zeta =\frac{R_{iB} \ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)}{1-5\min \left(R_{iB} ,0.19\right)} \qquad 0.01\le \zeta \le 2\qquad {\rm for\; }R_{iB} \ge 0{\rm \; (neutral\; or\; stable)}} \\ {\zeta =R_{iB} \ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)\qquad -100\le \zeta \le -0.01\qquad {\rm for\; }R_{iB} <0{\rm \; (unstable)}} \end{array}. + \begin{array}{lcr} + \zeta =\frac{R_{iB} \ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)}{1-5\min \left(R_{iB} ,0.19\right)} & \qquad 0.01\le \zeta \le 2 & \qquad {\rm for\; }R_{iB} \ge 0 {\rm \; (neutral\; or\; stable)} \\ + \zeta =R_{iB} \ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right) & \qquad -100\le \zeta \le -0.01 & \qquad {\rm for\; }R_{iB} <0 \ {\rm \; (unstable)} + \end{array}. Upon iteration (section :numref:`Numerical Implementation`), the following is used to determine :math:`\zeta` and thus :math:`L` .. math:: + :label: 5.49 - \label{ZEqnNum153243} \zeta =\frac{\left(z_{atm,\, m} -d\right)kg\theta _{v*} }{u_{*}^{2} \overline{\theta _{v,\, atm} }} where -.. math:: \begin{array}{l} {0.01\le \zeta \le 2\qquad {\rm for\; }\zeta \ge 0{\rm \; (neutral\; or\; stable)}} \\ {{\rm -100}\le \zeta \le {\rm -0.01}\qquad {\rm for\; }\zeta <0{\rm \; (unstable)}} \end{array}. +.. math:: + + \begin{array}{cr} + 0.01\le \zeta \le 2 & \qquad {\rm for\; }\zeta \ge 0{\rm \; (neutral\; or\; stable)} \\ + {\rm -100}\le \zeta \le {\rm -0.01} & \qquad {\rm for\; }\zeta <0{\rm \; (unstable)} + \end{array}. The difference in virtual potential air temperature between the reference height and the surface is .. math:: - :label: ZEqnNum516498 + :label: 5.50 \theta _{v,\, atm} -\theta _{v,\, s} =\left(\theta _{atm} -\theta _{s} \right)\left(1+0.61q_{atm} \right)+0.61\overline{\theta _{atm} }\left(q_{atm} -q_{s} \right). @@ -483,39 +503,39 @@ The momentum, sensible heat, and water vapor fluxes between the surface and the atmosphere can also be written in the form .. math:: - :label: ZEqnNum567382 + :label: 5.51 \tau _{x} =-\rho _{atm} \frac{\left(u_{atm} -u_{s} \right)}{r_{am} } .. math:: - :label: ZEqnNum615113 + :label: 5.52 \tau _{y} =-\rho _{atm} \frac{\left(v_{atm} -v_{s} \right)}{r_{am} } .. math:: - :label: ZEqnNum588623 + :label: 5.53 H=-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -\theta _{s} \right)}{r_{ah} } .. math:: - :label: ZEqnNum154565 + :label: 5.54 E=-\rho _{atm} \frac{\left(q_{atm} -q_{s} \right)}{r_{aw} } where the aerodynamic resistances (s m\ :sup:`-1`) are .. math:: - :label: ZEqnNum660763 + :label: 5.55 r_{am} =\frac{V_{a} }{u_{*}^{2} } =\frac{1}{k^{2} V_{a} } \left[\ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right]^{2} .. math:: - :label: ZEqnNum193138 + :label: 5.56 \begin{array}{l} {r_{ah} =\frac{\theta _{atm} -\theta _{s} }{\theta _{*} u_{*} } =\frac{1}{k^{2} V_{a} } \left[\ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right]} \\ {\qquad \left[\ln \left(\frac{z_{atm,\, h} -d}{z_{0h} } \right)-\psi _{h} \left(\frac{z_{atm,\, h} -d}{L} \right)+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right]} \end{array} .. math:: - :label: ZEqnNum382229 + :label: 5.57 \begin{array}{l} {r_{aw} =\frac{q_{atm} -q_{s} }{q_{*} u_{*} } =\frac{1}{k^{2} V_{a} } \left[\ln \left(\frac{z_{atm,\, m} -d}{z_{0m} } \right)-\psi _{m} \left(\frac{z_{atm,\, m} -d}{L} \right)+\psi _{m} \left(\frac{z_{0m} }{L} \right)\right]} \\ {\qquad \left[\ln \left(\frac{z_{atm,\, {\it w}} -d}{z_{0w} } \right)-\psi _{w} \left(\frac{z_{atm,\, w} -d}{L} \right)+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right]} \end{array}. @@ -523,7 +543,7 @@ A 2-m height “screen” temperature is useful for comparison with observations .. math:: - :label: ZEqnNum664652 + :label: 5.58 T_{2m} =\theta _{s} +\frac{\theta _{*} }{k} \left[\ln \left(\frac{2+z_{0h} }{z_{0h} } \right)-\psi _{h} \left(\frac{2+z_{0h} }{L} \right)+\psi _{h} \left(\frac{z_{0h} }{L} \right)\right] @@ -532,14 +552,14 @@ for sensible heat (:math:`z_{0h} +d`). Similarly, a 2-m height specific humidity is defined as .. math:: - :label: ZEqnNum735237 + :label: 5.59 q_{2m} =q_{s} +\frac{q_{*} }{k} \left[\ln \left(\frac{2+z_{0w} }{z_{0w} } \right)-\psi _{w} \left(\frac{2+z_{0w} }{L} \right)+\psi _{w} \left(\frac{z_{0w} }{L} \right)\right]. Relative humidity is .. math:: - :label: ZEqnNum299365 + :label: 5.60 RH_{2m} =\min \left(100,\, \frac{q_{2m} }{q_{sat}^{T_{2m} } } \times 100\right) @@ -570,7 +590,7 @@ water covered, so that the sensible heat flux :math:`H_{g}` (W m\ :sup:`-2`) is, with reference to :numref:`Figure Schematic diagram of sensible heat fluxes`, .. math:: - :label: ZEqnNum726771 + :label: 5.62 H_{g} =\left(1-f_{sno} -f_{h2osfc} \right)H_{soil} +f_{sno} H_{snow} +f_{h2osfc} H_{h2osfc} @@ -605,7 +625,7 @@ The water vapor flux :math:`E_{g}` (kg m\ :sup:`-2` s\ :sup:`-1`) is, with refe :numref:`Figure Schematic diagram of latent heat fluxes`, .. math:: - :label: ZEqnNum419297 + :label: 5.66 E_{g} =\left(1-f_{sno} -f_{h2osfc} \right)E_{soil} +f_{sno} E_{snow} +f_{h2osfc} E_{h2osfc} @@ -631,12 +651,12 @@ resistance to water vapor transfer (s m\ :sup:`-1`). The specific humidities of :math:`q_{h2osfc}` are assumed to be at the saturation specific humidity of their respective temperatures .. math:: - :label: 5.70) + :label: 5.70 q_{sno} =q_{sat}^{T_{snl+1} } .. math:: - :label: 5.71) + :label: 5.71 q_{h2osfc} =q_{sat}^{T_{h2osfc} } @@ -644,17 +664,17 @@ The specific humidity of the soil surface :math:`q_{soil}` is assumed to be proportional to the saturation specific humidity .. math:: - :label: 5.72) + :label: 5.72 q_{soil} =\alpha _{soil} q_{sat}^{T_{1} } where :math:`q_{sat}^{T_{1} }` is the saturated specific humidity at the soil surface temperature :math:`T_{1}` (section :numref:`Saturation Vapor Pressure`). The factor :math:`\alpha _{soil}` is a function of the surface soil water matric -potential :math:`\psi` as in Philip (1957) +potential :math:`\psi` as in :ref:`Philip (1957)` .. math:: - :label: 5.73) + :label: 5.73 \alpha _{soil} =\exp \left(\frac{\psi _{1} g}{1\times 10^{3} R_{wv} T_{1} } \right) @@ -664,7 +684,7 @@ gravitational acceleration (m s\ :sup:`-2`) (:numref:`Table Physical constants`) layer (mm). The soil water matric potential :math:`\psi _{1}` is .. math:: - :label: 5.74) + :label: 5.74 \psi _{1} =\psi _{sat,\, 1} s_{1}^{-B_{1} } \ge -1\times 10^{8} @@ -676,7 +696,7 @@ and :math:`s_{1}` is the wetness of the top soil layer with respect to saturati The surface wetness :math:`s_{1}` is a function of the liquid water and ice content .. math:: - :label: 5.75) + :label: 5.75 s_{1} =\frac{1}{\Delta z_{1} \theta _{sat,\, 1} } \left[\frac{w_{liq,\, 1} }{\rho _{liq} } +\frac{w_{ice,\, 1} }{\rho _{ice} } \right]\qquad 0.01\le s_{1} \le 1.0 @@ -693,22 +713,22 @@ prevents large increases (decreases) in :math:`q_{soil}` for small increases (decreases) in soil moisture in very dry soils. The resistance to water vapor transfer occurring within the soil matrix -:math:`r_{soil}` is +:math:`r_{soil}` (s m\ :sup:`-1`) is .. math:: - :label: 5.76) + :label: 5.76 r_{soil} = \frac{DSL}{D_{v} \tau} -where :math:`DSL` is the thickness of the dry surface layer, :math:`D_{v}` -is the molecular diffusivity of water vapor in air and :math:`\tau` -describes the tortuosity of the vapor flow paths through +where :math:`DSL` is the thickness of the dry surface layer (m), :math:`D_{v}` +is the molecular diffusivity of water vapor in air (m\ :sup:`2` s\ :sup:`-2`) +and :math:`\tau` (*unitless*) describes the tortuosity of the vapor flow paths through the soil matrix (:ref:`Swenson and Lawrence 2014 `). The thickness of the dry surface layer is given by .. math:: - :label: 5.77) + :label: 5.77 DSL = \begin{array}{lr} @@ -719,44 +739,47 @@ The thickness of the dry surface layer is given by where :math:`D_{max}` is a parameter specifying the length scale of the maximum DSL thickness (default value = 15 mm), -:math:`\theta_{init}` is the moisture value at which the DSL initiates, -:math:`\theta_{1}` is the moisture value of the top model soil layer, -and :math:`\theta_{air}` is the 'air dry' soil moisture value -(:ref:`Dingman 2002 `): +:math:`\theta_{init}` (mm\ :sup:`3` mm\ :sup:`-3`) is the moisture value +at which the DSL initiates, :math:`\theta_{1}` (mm\ :sup:`3` mm\ :sup:`-3`) +is the moisture value of the top model soil layer, and +:math:`\theta_{air}` (mm\ :sup:`3` mm\ :sup:`-3`) is the 'air dry' soil +moisture value (:ref:`Dingman 2002 `): .. math:: - :label: 5.78) + :label: 5.78 \theta_{air} = \Phi \left( \frac{\Psi_{sat}}{\Psi_{air}} \right)^{\frac{1}{B_{1}}} \ . -where :math:`\Phi` is the porosity, :math:`\Psi_{sat}` is the saturated -soil matric potential, :math:`\Psi_{air} = 10^{7}` mm is the air dry -matric potential, and :math:`B_{1}` is a function of soil texture (section +where :math:`\Phi` is the porosity (mm\ :sup:`3` mm\ :sup:`-3`), +:math:`\Psi_{sat}` is the saturated soil matric potential (mm), +:math:`\Psi_{air} = 10^{7}` mm is the air dry matric potential, and +:math:`B_{1}` is a function of soil texture (section :numref:`Hydraulic Properties`). The soil tortuosity is .. math:: - :label: 5.79) + :label: 5.79 \tau = \Phi^{2}_{air}\left(\frac{\Phi_{air}}{\Phi}\right)^{\frac{3}{B_{1}}} -where :math:`\Phi_{air}` is the air filled pore space +where :math:`\Phi_{air}` (mm\ :sup:`3` mm\ :sup:`-3`) is the air filled pore space .. math:: - :label: 5.80) + :label: 5.80 \Phi_{air} = \Phi - \theta_{air} \ . :math:`D_{v}` depends on temperature .. math:: - :label: 5.81) + :label: 5.81 D_{v} = 2.12 \times 10^{-5} \left(\frac{T_{1}}{T_{f}}\right)^{1.75} \ . -where :math:`T_{1}` is the temperature of the top soil layer and -:math:`T_{f}` is the freezing temperature of water (:numref:`Table Physical Constants`). +where :math:`T_{1}` (K) is the temperature of the top soil layer and +:math:`T_{f}` (K) is the freezing temperature of water +(:numref:`Table Physical Constants`). The roughness lengths used to calculate :math:`r_{am}` , :math:`r_{ah}` , and :math:`r_{aw}` are :math:`z_{0m} =z_{0m,\, g}` , @@ -774,7 +797,7 @@ across the interfacial sublayer. The following relation from :ref:`Zeng and Dickinson 1998 ` .. math:: - :label: ZEqnNum844212 + :label: 5.82 z_{0h,\, g} =z_{0w,\, g} =z_{0m,\, g} e^{-a\left({u_{*} z_{0m,\, g} \mathord{\left/ {\vphantom {u_{*} z_{0m,\, g} \upsilon }} \right. \kern-\nulldelimiterspace} \upsilon } \right)^{0.45} } @@ -787,43 +810,43 @@ The numerical solution for the fluxes of momentum, sensible heat, and water vapor flux from non-vegetated surfaces proceeds as follows: #. An initial guess for the wind speed :math:`V_{a}` is obtained from - eq. assuming an initial convective velocity :math:`U_{c} =0` m + :eq:`5.24` assuming an initial convective velocity :math:`U_{c} =0` m s\ :sup:`-1` for stable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` as evaluated from - eq. ) and :math:`U_{c} =0.5` for unstable conditions + :eq:`5.50` ) and :math:`U_{c} =0.5` for unstable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). #. An initial guess for the Monin-Obukhov length :math:`L` is obtained - from the bulk Richardson number using eqs. and . + from the bulk Richardson number using :eq:`5.46` and :eq:`5.48`. #. The following system of equations is iterated three times: -#. Friction velocity :math:`u_{*}` (eqs. , , , ) +#. Friction velocity :math:`u_{*}` (:eq:`5.32`, :eq:`5.33`, :eq:`5.34`, :eq:`5.35`) -#. Potential temperature scale :math:`\theta _{*}` (eqs. , , , ) +#. Potential temperature scale :math:`\theta _{*}` (:eq:`5.37` , :eq:`5.38`, :eq:`5.39`, :eq:`5.40`) -#. Humidity scale :math:`q_{*}` (eqs. , , , ) +#. Humidity scale :math:`q_{*}` (:eq:`5.41`, :eq:`5.42`, :eq:`5.43`, :eq:`5.44`) #. Roughness lengths for sensible :math:`z_{0h,\, g}` and latent heat - :math:`z_{0w,\, g}` (eq. ) + :math:`z_{0w,\, g}` (:eq:`5.82` ) -#. Virtual potential temperature scale :math:`\theta _{v*}` (eq. ) +#. Virtual potential temperature scale :math:`\theta _{v*}` ( :eq:`5.17`) -#. Wind speed including the convective velocity, :math:`V_{a}` (eq. ) +#. Wind speed including the convective velocity, :math:`V_{a}` ( :eq:`5.24`) -#. Monin-Obukhov length :math:`L` (eq. ) +#. Monin-Obukhov length :math:`L` (:eq:`5.49`) #. Aerodynamic resistances :math:`r_{am}` , :math:`r_{ah}` , and - :math:`r_{aw}` (eqs. , , ) + :math:`r_{aw}` (:eq:`5.55`, :eq:`5.56`, :eq:`5.57`) -#. Momentum fluxes :math:`\tau _{x}` , :math:`\tau _{y}` (eqs. , ) +#. Momentum fluxes :math:`\tau _{x}` , :math:`\tau _{y}` (:eq:`5.5`, :eq:`5.6`) -#. Sensible heat flux :math:`H_{g}` (eq. ) +#. Sensible heat flux :math:`H_{g}` (:eq:`5.62`) -#. Water vapor flux :math:`E_{g}` (eq. ) +#. Water vapor flux :math:`E_{g}` (:eq:`5.66`) #. 2-m height air temperature :math:`T_{2m}` and specific humidity - :math:`q_{2m}` (eqs. , ) + :math:`q_{2m}` (:eq:`5.58` , :eq:`5.59`) The partial derivatives of the soil surface fluxes with respect to ground temperature, which are needed for the soil temperature calculations (section @@ -831,19 +854,19 @@ ground temperature, which are needed for the soil temperature calculations (sect (section :numref:`Update of Ground Sensible and Latent Heat Fluxes`), are .. math:: - :label: ZEqnNum806472 + :label: 5.83 \frac{\partial H_{g} }{\partial T_{g} } =\frac{\rho _{atm} C_{p} }{r_{ah} } .. math:: - :label: ZEqnNum497230 + :label: 5.84 \frac{\partial E_{g} }{\partial T_{g} } =\frac{\beta _{soi} \rho _{atm} }{r_{aw} } \frac{dq_{g} }{dT_{g} } where .. math:: - :label: 5.82) + :label: 5.85 \frac{dq_{g} }{dT_{g} } =\left(1-f_{sno} -f_{h2osfc} \right)\alpha _{soil} \frac{dq_{sat}^{T_{soil} } }{dT_{soil} } +f_{sno} \frac{dq_{sat}^{T_{sno} } }{dT_{sno} } +f_{h2osfc} \frac{dq_{sat}^{T_{h2osfc} } }{dT_{h2osfc} } . @@ -883,39 +906,41 @@ at height :math:`z_{0h} +d` and the atmosphere at height from the vegetation :math:`H_{v}` and the ground :math:`H_{g}` .. math:: - :label: ZEqnNum550014 + :label: 5.86 H=H_{v} +H_{g} where, with reference to :numref:`Figure Schematic diagram of sensible heat fluxes`, .. math:: - :label: 5.84) + :label: 5.87 H=-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{s} \right)}{r_{ah} } .. math:: - :label: ZEqnNum675188 + :label: 5.88 H_{v} =-\rho _{atm} C_{p} \left(T_{s} -T_{v} \right)\frac{\left(L+S\right)}{r_{b} } .. math:: - :label: ZEqnNum293573 + :label: 5.89 - H_{g} =\left(1-f_{sno} -f_{h2osfc} \right)H_{soil} +f_{sno} H_{snow} +f_{h2osfc} H_{h2osfc} + H_{g} =\left(1-f_{sno} -f_{h2osfc} \right)H_{soil} +f_{sno} H_{snow} +f_{h2osfc} H_{h2osfc} \ , + +where .. math:: - :label: 5.87) + :label: 5.90 H_{soil} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{1} \right)}{r_{ah} ^{{'} } } .. math:: - :label: 5.88) + :label: 5.91 H_{sno} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{snl+1} \right)}{r_{ah} ^{{'} } } .. math:: - :label: 5.89) + :label: 5.92 H_{h2osfc} =-\rho _{atm} C_{p} \frac{\left(T_{s} -T_{h2osfc} \right)}{r_{ah} ^{{'} } } @@ -948,27 +973,28 @@ height :math:`z_{0h} ^{{'} }` and the canopy air at height Figure Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. -Equations - can be solved for the canopy air temperature :math:`T_{s}` +Equations :eq:`5.86` - :eq:`5.89` can be solved for the canopy air +temperature :math:`T_{s}` .. math:: - :label: ZEqnNum103571 + :label: 5.93 T_{s} =\frac{c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} +c_{v}^{h} T_{v} }{c_{a}^{h} +c_{g}^{h} +c_{v}^{h} } where .. math:: - :label: ZEqnNum298904 + :label: 5.94 c_{a}^{h} =\frac{1}{r_{ah} } .. math:: - :label: ZEqnNum991533 + :label: 5.95 c_{g}^{h} =\frac{1}{r_{ah} ^{{'} } } .. math:: - :label: ZEqnNum284616 + :label: 5.96 c_{v}^{h} =\frac{\left(L+S\right)}{r_{b} } @@ -976,22 +1002,22 @@ are the sensible heat conductances from the canopy air to the atmosphere, the ground to canopy air, and leaf surface to canopy air, respectively (m s\ :sup:`-1`). -When the expression for :math:`T_{s}` is substituted into equation :eq:`ZEqnNum675188`, +When the expression for :math:`T_{s}` is substituted into equation :eq:`5.88`, the sensible heat flux from vegetation :math:`H_{v}` is a function of :math:`\theta _{atm}` , :math:`T_{g}` , and :math:`T_{v}` .. math:: - :label: ZEqnNum362496 + :label: 5.97 - H_{v} =-\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} -\left(c_{a}^{h} +c_{g}^{h} \right)T_{v} \right]\frac{c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } . + H_{v} = -\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} -\left(c_{a}^{h} +c_{g}^{h} \right)T_{v} \right]\frac{c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } . Similarly, the expression for :math:`T_{s}` can be substituted into equation to obtain the sensible heat flux from ground :math:`H_{g}` .. math:: - :label: ZEqnNum527667 + :label: 5.98 - H_{g} =-\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{v}^{h} T_{v} -\left(c_{a}^{h} +c_{v}^{h} \right)T_{g} \right]\frac{c_{g}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } . + H_{g} = -\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{v}^{h} T_{v} -\left(c_{a}^{h} +c_{v}^{h} \right)T_{g} \right]\frac{c_{g}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } . The air within the canopy is assumed to have negligible capacity to store water vapor so that the water vapor flux :math:`E` between the @@ -1000,41 +1026,43 @@ surface at height :math:`z_{0w} +d` and the atmosphere at height flux from the vegetation :math:`E_{v}` and the ground :math:`E_{g}` .. math:: - :label: ZEqnNum365017 + :label: 5.99 - E=E_{v} +E_{g} + E = E_{v} +E_{g} where, with reference to :numref:`Figure Schematic diagram of latent heat fluxes`, .. math:: - :label: 5.97) + :label: 5.100 - E=-\rho _{atm} \frac{\left(q_{atm} -q_{s} \right)}{r_{aw} } + E = -\rho _{atm} \frac{\left(q_{atm} -q_{s} \right)}{r_{aw} } .. math:: - :label: ZEqnNum351492 + :label: 5.101 - E_{v} =-\rho _{atm} \frac{\left(q_{s} -q_{sat}^{T_{v} } \right)}{r_{total} } + E_{v} = -\rho _{atm} \frac{\left(q_{s} -q_{sat}^{T_{v} } \right)}{r_{total} } .. math:: - :label: ZEqnNum145330 + :label: 5.102 - E_{g} =\left(1-f_{sno} -f_{h2osfc} \right)E_{soil} +f_{sno} E_{snow} +f_{h2osfc} E_{h2osfc} + E_{g} = \left(1-f_{sno} -f_{h2osfc} \right)E_{soil} +f_{sno} E_{snow} +f_{h2osfc} E_{h2osfc} \ , + +where .. math:: - :label: 5.100) + :label: 5.103 - E_{soil} =-\rho _{atm} \frac{\beta _{soi} \left(q_{s} -q_{soil} \right)}{r_{aw} ^{{'} } +r_{litter} } + E_{soil} = -\rho _{atm} \frac{\beta _{soi} \left(q_{s} -q_{soil} \right)}{r_{aw} ^{{'} } +r_{soil} } .. math:: - :label: 5.101) + :label: 5.104 - E_{sno} =-\rho _{atm} \frac{\left(q_{s} -q_{sno} \right)}{r_{aw} ^{{'} } +r_{litter} } + E_{sno} = -\rho _{atm} \frac{\left(q_{s} -q_{sno} \right)}{r_{aw} ^{{'} } +r_{soil} } .. math:: - :label: 5.102) + :label: 5.105 - E_{h2osfc} =-\rho _{atm} \frac{\left(q_{s} -q_{h2osfc} \right)}{r_{aw} ^{{'} } +r_{litter} } + E_{h2osfc} = -\rho _{atm} \frac{\left(q_{s} -q_{h2osfc} \right)}{r_{aw} ^{{'} } +r_{soil} } where :math:`q_{atm}` is the atmospheric specific humidity (kg kg\ :sup:`-1`), :math:`r_{aw}` is the aerodynamic resistance to water vapor transfer (s m\ :sup:`-1`), :math:`q_{sat}^{T_{v} }` @@ -1047,7 +1075,7 @@ m\ :sup:`-1`) to water vapor transfer between the ground at height :math:`z_{0w} ^{{'} }` and the canopy air at height :math:`z_{0w} +d`, :math:`\beta _{soi}` is an empirical function of soil water (section :numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`), -and :math:`r_{litter}` is a resistance for the plant litter layer +and :math:`r_{soil}` (:eq:`5.76`) is a resistance to diffusion through the soil (s m\ :sup:`-1`). :math:`r_{total}` is the total resistance to water vapor transfer from the canopy to the canopy air and includes contributions from leaf boundary layer and sunlit and shaded stomatal @@ -1059,34 +1087,34 @@ is the sum of water vapor flux from wetted leaf and stem area transpiration from dry leaf surfaces :math:`E_{v}^{t}` .. math:: - :label: 5.103) + :label: 5.106 E_{v} =E_{v}^{w} +E_{v}^{t} . -Equations - can be solved for the canopy specific humidity +Equations :eq:`5.99` - :eq:`5.102` can be solved for the canopy specific humidity :math:`q_{s}` .. math:: - :label: ZEqnNum362168 + :label: 5.107 q_{s} =\frac{c_{a}^{w} q_{atm} +c_{g}^{w} q_{g} +c_{v}^{w} q_{sat}^{T_{v} } }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } where .. math:: - :label: ZEqnNum533553 + :label: 5.108 c_{a}^{w} =\frac{1}{r_{aw} } .. math:: - :label: ZEqnNum544982 + :label: 5.109 c_{v}^{w} =\frac{\left(L+S\right)}{r_{b} } r'' .. math:: - :label: ZEqnNum888691 + :label: 5.110 - c_{g}^{w} =\frac{\beta _{soi} }{r_{aw} ^{{'} } +r_{litter} } + c_{g}^{w} =\frac{1}{r_{aw} ^{{'} } +r_{soil} } are the water vapor conductances from the canopy air to the atmosphere, the leaf to canopy air, and ground to canopy air, respectively. The term @@ -1095,9 +1123,14 @@ transpiration and limited by available water and potential evaporation as .. math:: - :label: ZEqnNum166006 + :label: 5.111 - r''=\left\{\begin{array}{l} {\min \left(f_{wet} +r_{dry} ^{{'} {'} } ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right)\qquad E_{v}^{w,\, pot} >0,\, \beta _{t} >0} \\ {\min \left(f_{wet} ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right)\qquad E_{v}^{w,\, pot} >0,\, \beta _{t} \le 0} \\ {1\qquad E_{v}^{w,\, pot} \le 0} \end{array}\right\} + r'' = \left\{ + \begin{array}{lr} + \min \left(f_{wet} +r_{dry} ^{{'} {'} } ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right) & \qquad E_{v}^{w,\, pot} >0,\, \beta _{t} >0 \\ + \min \left(f_{wet} ,\, \frac{E_{v}^{w,\, pot} r_{dry} ^{{'} {'} } +\frac{W_{can} }{\Delta t} }{E_{v}^{w,\, pot} } \right) & \qquad E_{v}^{w,\, pot} >0,\, \beta _{t} \le 0 \\ + 1 & \qquad E_{v}^{w,\, pot} \le 0 + \end{array}\right\} where :math:`f_{wet}` is the fraction of leaves and stems that are wet (section :numref:`Canopy Water`), :math:`W_{can}` is canopy water (kg m\ :sup:`-2`) @@ -1107,14 +1140,14 @@ where :math:`f_{wet}` is the fraction of leaves and stems that are wet evaporation from wet foliage per unit wetted area is .. math:: - :label: 5.109) + :label: 5.112 E_{v}^{w,\, pot} =-\frac{\rho _{atm} \left(q_{s} -q_{sat}^{T_{v} } \right)}{r_{b} } . The term :math:`r_{dry} ^{{'} {'} }` is .. math:: - :label: 5.110) + :label: 5.113 r_{dry} ^{{'} {'} } =\frac{f_{dry} r_{b} }{L} \left(\frac{L^{sun} }{r_{b} +r_{s}^{sun} } +\frac{L^{sha} }{r_{b} +r_{s}^{sha} } \right) @@ -1124,21 +1157,21 @@ leaf area indices (section :numref:`Solar Fluxes`), and :math:`r_{s}^{sun}` and :math:`r_{s}^{sha}` are the sunlit and shaded stomatal resistances (s m\ :sup:`-1`) (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). -When the expression for :math:`q_{s}` is substituted into equation , +When the expression for :math:`q_{s}` is substituted into equation :eq:`5.101`, the water vapor flux from vegetation :math:`E_{v}` is a function of :math:`q_{atm}` , :math:`q_{g}` , and :math:`q_{sat}^{T_{v} }` .. math:: - :label: ZEqnNum256012 + :label: 5.114 E_{v} =-\rho _{atm} \left[c_{a}^{w} q_{atm} +c_{g}^{w} q_{g} -\left(c_{a}^{w} +c_{g}^{w} \right)q_{sat}^{T_{v} } \right]\frac{c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } . Similarly, the expression for :math:`q_{s}` can be substituted into -equation to obtain the water vapor flux from the ground beneath the +:eq:`5.84` to obtain the water vapor flux from the ground beneath the canopy :math:`E_{g}` .. math:: - :label: ZEqnNum243941 + :label: 5.115 E_{g} =-\rho _{atm} \left[c_{a}^{w} q_{atm} +c_{v}^{w} q_{sat}^{T_{v} } -\left(c_{a}^{w} +c_{v}^{w} \right)q_{g} \right]\frac{c_{g}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } . @@ -1147,14 +1180,14 @@ ground at height :math:`z_{0h} ^{{'} }` (:math:`z_{0w} ^{{'} }` ) and the canopy air at height :math:`z_{0h} +d` (:math:`z_{0w} +d`) are .. math:: - :label: ZEqnNum496775 + :label: 5.116 r_{ah} ^{{'} } =r_{aw} ^{{'} } =\frac{1}{C_{s} U_{av} } where .. math:: - :label: ZEqnNum781547 + :label: 5.117 U_{av} =V_{a} \sqrt{\frac{1}{r_{am} V_{a} } } =u_{*} @@ -1162,80 +1195,43 @@ is the magnitude of the wind velocity incident on the leaves (equivalent here to friction velocity) (m s\ :sup:`-1`) and :math:`C_{s}` is the turbulent transfer coefficient between the underlying soil and the canopy air. :math:`C_{s}` is obtained by -interpolation between values for dense canopy and bare soil (:ref:`Zeng et al. 2005 `) +interpolation between values for dense canopy and bare soil +(:ref:`Zeng et al. 2005 `) .. math:: - :label: 5.115) + :label: 5.118 C_{s} =C_{s,\, bare} W+C_{s,\, dense} (1-W) where the weight :math:`W` is .. math:: - :label: 5.116) + :label: 5.119 W=e^{-\left(L+S\right)} . -The dense canopy turbulent transfer coefficient in :ref:`Zeng et al. (2005) ` -is modified from its original value of 0.004 (:ref:`Dickinson et al. 1993 `) by -Sakaguchi and Zeng (2009) to account for stability as +The dense canopy turbulent transfer coefficient +(:ref:`Dickinson et al. 1993 `) is .. math:: - :label: 5.117) - - C_{s,\, dense} =\left\{\begin{array}{l} {0.004\qquad T_{s} -T_{g} \le 0} \\ {\frac{0.004}{1+\gamma \min \left(S,10\right)} \qquad T_{s} -T_{g} >0} \end{array}\right\} - -where :math:`\gamma =0.5` and :math:`S` is a stability parameter -determined from - -.. math:: - :label: 5.118) + :label: 5.120) - S=\frac{gz_{top} \left(T_{s} -T_{g} \right)}{T_{s} u_{*}^{2} } + C_{s,\, dense} =0.004 \ . -where :math:`g` is the gravitational acceleration (m -s\ :sup:`-2`) (:numref:`Table Physical constants`), and :math:`z_{top}` is canopy top -height (m) (:numref:`Table Prescribed plant functional type heights`). The bare soil turbulent transfer coefficient is +The bare soil turbulent transfer coefficient is .. math:: - :label: 5.119) + :label: 5.121 C_{s,\, bare} =\frac{k}{a} \left(\frac{z_{0m,\, g} U_{av} }{\upsilon } \right)^{-0.45} where the kinematic viscosity of air -:math:`\upsilon =1.5\times 10^{-5}` m\ :sup:`2` -s\ :sup:`-1` and :math:`a=0.13`. - -The litter resistance :math:`r_{litter}` (Sakaguchi and Zeng 2009) (s -m\ :sup:`-1`) is - -.. math:: - :label: 5.120) - - r_{litter} =\frac{1}{0.004u_{*} } \left(1-e^{-L_{litter}^{eff} } \right) - -where the effective litter area index :math:`L_{litter}^{eff}` (m\ :sup:`2` m\ :sup:`-2`) is the fraction of plant litter -area index :math:`L_{litter}` (currently set to 0.5 m\ :sup:`2` m\ :sup:`-2`) that is not covered by snow - -.. math:: - :label: 5.121) - - L_{litter}^{eff} =L_{litter} \left[1-\min \left(f_{litter}^{snow} ,\, 1\right)\right]. - -The effective snow cover of the litter layer is - -.. math:: - :label: 5.122) - - f_{litter}^{snow} =\frac{z_{sno} }{\Delta z_{litter} } - -where :math:`\Delta z_{litter} =0.05`\ m is assumed as a typical depth -for the litter layer, and :math:`z_{sno}` is the depth of snow (Chapter :numref:`rst_Snow Hydrology`) (m). +:math:`\upsilon =1.5\times 10^{-5}` m\ :sup:`2` s\ :sup:`-1` and :math:`a=0.13`. The leaf boundary layer resistance :math:`r_{b}` is .. math:: - :label: ZEqnNum181758 + :label: 5.122 r_{b} =\frac{1}{C_{v} } \left({U_{av} \mathord{\left/ {\vphantom {U_{av} d_{leaf} }} \right. \kern-\nulldelimiterspace} d_{leaf} } \right)^{{-1\mathord{\left/ {\vphantom {-1 2}} \right. \kern-\nulldelimiterspace} 2} } @@ -1246,16 +1242,17 @@ direction of wind flow (:numref:`Table Coefficients for saturation vapor pressur The partial derivatives of the fluxes from the soil beneath the canopy with respect to ground temperature, which are needed for the soil -temperature calculations (section :numref:`Numerical Solution Temperature`) and to update the soil surface -fluxes (section :numref:`Update of Ground Sensible and Latent Heat Fluxes`), are +temperature calculations (section :numref:`Numerical Solution Temperature`) +and to update the soil surface fluxes (section +:numref:`Update of Ground Sensible and Latent Heat Fluxes`), are .. math:: - :label: ZEqnNum774729 + :label: 5.123 \frac{\partial H_{g} }{\partial T_{g} } =\frac{\rho _{atm} C_{p} }{r'_{ah} } \frac{c_{a}^{h} +c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } .. math:: - :label: ZEqnNum562232 + :label: 5.124 \frac{\partial E_{g} }{\partial T_{g} } =\frac{\beta _{soi} \rho _{atm} }{r'_{aw} +r_{litter} } \frac{c_{a}^{w} +c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } \frac{dq_{g} }{dT_{g} } . @@ -1267,35 +1264,38 @@ determined analytically, are ignored for :math:`\frac{\partial E_{g} }{\partial T_{g} }` . The roughness lengths used to calculate :math:`r_{am}` , -:math:`r_{ah}` , and :math:`r_{aw}` from equations , , and are +:math:`r_{ah}` , and :math:`r_{aw}` from :eq:`5.55`, :eq:`5.56`, and :eq:`5.57` are :math:`z_{0m} =z_{0m,\, v}` , :math:`z_{0h} =z_{0h,\, v}` , and :math:`z_{0w} =z_{0w,\, v}` . The vegetation displacement height :math:`d` and the roughness lengths are a function of plant height and adjusted for canopy density following :ref:`Zeng and Wang (2007) ` .. math:: - :label: 5.126) + :label: 5.125 - z_{0m,\, v} =z_{0h,\, v} =z_{0w,\, v} =\exp \left[V\ln \left(z_{top} R_{z0m} \right)+\left(1-V\right)\ln \left(z_{0m,\, g} \right)\right] + z_{0m,\, v} = z_{0h,\, v} =z_{0w,\, v} =\exp \left[V\ln \left(z_{top} R_{z0m} \right)+\left(1-V\right)\ln \left(z_{0m,\, g} \right)\right] .. math:: - :label: 5.127) + :label: 5.126 - d=z_{top} R_{d} V + d = z_{top} R_{d} V -where :math:`z_{top}` is canopy top height (m) (:numref:`Table Prescribed plant functional type heights`), +where :math:`z_{top}` is canopy top height (m) +(:numref:`Table Prescribed plant functional type heights`), :math:`R_{z0m}` and :math:`R_{d}` are the ratio of momentum roughness length and displacement height to canopy top height, respectively -(:numref:`Table Plant functional type aerodynamic parameters`), and -:math:`z_{0m,\, g}` is the ground momentum roughness length -(m) (section :numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`). The fractional weight :math:`V` is determined from +(:numref:`Table Plant functional type aerodynamic parameters`), and :math:`z_{0m,\, g}` +is the ground momentum roughness length (m) (section +:numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`). The +fractional weight :math:`V` is determined from .. math:: - :label: 5.128) + :label: 5.127 - V=\frac{1-\exp \left\{-\beta \min \left[L+S,\, \left(L+S\right)_{cr} \right]\right\}}{1-\exp \left[-\beta \left(L+S\right)_{cr} \right]} + V = \frac{1-\exp \left\{-\beta \min \left[L+S,\, \left(L+S\right)_{cr} \right]\right\}}{1-\exp \left[-\beta \left(L+S\right)_{cr} \right]} -where :math:`\beta =1` and :math:`\left(L+S\right)_{cr} =2` (m\ :sup:`2` m\ :sup:`-2`) is a critical value of exposed leaf +where :math:`\beta =1` and :math:`\left(L+S\right)_{cr} = 2` +(m\ :sup:`2` m\ :sup:`-2`) is a critical value of exposed leaf plus stem area for which :math:`z_{0m}` reaches its maximum. .. _Table Plant functional type aerodynamic parameters: @@ -1362,7 +1362,7 @@ Numerical Implementation Canopy energy conservation gives .. math:: - :label: 5.129) + :label: 5.128 -\overrightarrow{S}_{v} +\overrightarrow{L}_{v} \left(T_{v} \right)+H_{v} \left(T_{v} \right)+\lambda E_{v} \left(T_{v} \right)=0 @@ -1381,7 +1381,7 @@ non-linear systems of equations can be applied to iteratively solve for :math:`T_{v}` as .. math:: - :label: ZEqnNum247755 + :label: 5.129 \Delta T_{v} =\frac{\overrightarrow{S}_{v} -\overrightarrow{L}_{v} -H_{v} -\lambda E_{v} }{\frac{\partial \overrightarrow{L}_{v} }{\partial T_{v} } +\frac{\partial H_{v} }{\partial T_{v} } +\frac{\partial \lambda E_{v} }{\partial T_{v} } } @@ -1391,17 +1391,17 @@ where :math:`\Delta T_{v} =T_{v}^{n+1} -T_{v}^{n}` and the subscript The partial derivatives are .. math:: - :label: 5.131) + :label: 5.130 \frac{\partial \overrightarrow{L}_{v} }{\partial T_{v} } =4\varepsilon _{v} \sigma \left[2-\varepsilon _{v} \left(1-\varepsilon _{g} \right)\right]T_{v}^{3} .. math:: - :label: 5.132) + :label: 5.131 \frac{\partial H_{v} }{\partial T_{v} } =\rho _{atm} C_{p} \left(c_{a}^{h} +c_{g}^{h} \right)\frac{c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } .. math:: - :label: 5.133) + :label: 5.132 \frac{\partial \lambda E_{v} }{\partial T_{v} } =\lambda \rho _{atm} \left(c_{a}^{w} +c_{g}^{w} \right)\frac{c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } \frac{dq_{sat}^{T_{v} } }{dT_{v} } . @@ -1418,17 +1418,17 @@ between stable and unstable conditions. The total water vapor flux flux :math:`H_{v}` are updated for changes in leaf temperature as .. math:: - :label: ZEqnNum420059 + :label: 5.133 E_{v} =-\rho _{atm} \left[c_{a}^{w} q_{atm} +c_{g}^{w} q_{g} -\left(c_{a}^{w} +c_{g}^{w} \right)\left(q_{sat}^{T_{v} } +\frac{dq_{sat}^{T_{v} } }{dT_{v} } \Delta T_{v} \right)\right]\frac{c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } .. math:: - :label: ZEqnNum554100 + :label: 5.134 E_{v}^{t} =-r_{dry} ^{{'} {'} } \rho _{atm} \left[c_{a}^{w} q_{atm} +c_{g}^{w} q_{g} -\left(c_{a}^{w} +c_{g}^{w} \right)\left(q_{sat}^{T_{v} } +\frac{dq_{sat}^{T_{v} } }{dT_{v} } \Delta T_{v} \right)\right]\frac{c_{v}^{h} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } .. math:: - :label: ZEqnNum839021 + :label: 5.135 H_{v} =-\rho _{atm} C_{p} \left[c_{a}^{h} \theta _{atm} +c_{g}^{h} T_{g} -\left(c_{a}^{h} +c_{g}^{h} \right)\left(T_{v} +\Delta T_{v} \right)\right]\frac{c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } . @@ -1440,57 +1440,57 @@ proceeds as follows: obtained from .. math:: - :label: 5.137) + :label: 5.136 T_{s} =\frac{T_{g} +\theta _{atm} }{2} .. math:: - :label: 5.138) + :label: 5.137 q_{s} =\frac{q_{g} +q_{atm} }{2} . #. An initial guess for the wind speed :math:`V_{a}` is obtained from - eq. assuming an initial convective velocity :math:`U_{c} =0` m + :eq:`5.24` assuming an initial convective velocity :math:`U_{c} =0` m s\ :sup:`-1` for stable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` as evaluated from - eq. ) and :math:`U_{c} =0.5` for unstable conditions + :eq:`5.50` ) and :math:`U_{c} =0.5` for unstable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). #. An initial guess for the Monin-Obukhov length :math:`L` is obtained - from the bulk Richardson number using equation and . + from the bulk Richardson number using equation and :eq:`5.46` and :eq:`5.48`. #. Iteration proceeds on the following system of equations: -#. Friction velocity :math:`u_{*}` (eqs. , , , ) +#. Friction velocity :math:`u_{*}` (:eq:`5.32`, :eq:`5.33`, :eq:`5.34`, :eq:`5.35`) -#. Ratio :math:`\frac{\theta _{*} }{\theta _{atm} -\theta _{s} }` (eqs. - , , , ) +#. Ratio :math:`\frac{\theta _{*} }{\theta _{atm} -\theta _{s} }` + (:eq:`5.37` , :eq:`5.38`, :eq:`5.39`, :eq:`5.40`) -#. Ratio :math:`\frac{q_{*} }{q_{atm} -q_{s} }` (eqs. , , , ) +#. Ratio :math:`\frac{q_{*} }{q_{atm} -q_{s} }` (:eq:`5.41`, :eq:`5.42`, :eq:`5.43`, :eq:`5.44`) #. Aerodynamic resistances :math:`r_{am}` , :math:`r_{ah}` , and - :math:`r_{aw}` (eqs. , , ) + :math:`r_{aw}` (:eq:`5.55`, :eq:`5.56`, :eq:`5.57`) #. Magnitude of the wind velocity incident on the leaves :math:`U_{av}` - (eq. ) + (:eq:`5.117` ) -#. Leaf boundary layer resistance :math:`r_{b}` (eq. ) +#. Leaf boundary layer resistance :math:`r_{b}` (:eq:`5.136` ) #. Aerodynamic resistances :math:`r_{ah} ^{{'} }` and - :math:`r_{aw} ^{{'} }` (eq. ) + :math:`r_{aw} ^{{'} }` (:eq:`5.116` ) #. Sunlit and shaded stomatal resistances :math:`r_{s}^{sun}` and :math:`r_{s}^{sha}` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`) #. Sensible heat conductances :math:`c_{a}^{h}` , :math:`c_{g}^{h}` , - and :math:`c_{v}^{h}` (eqs. , , ) + and :math:`c_{v}^{h}` (:eq:`5.94`, :eq:`5.95`, :eq:`5.96`) #. Latent heat conductances :math:`c_{a}^{w}` , :math:`c_{v}^{w}` , and - :math:`c_{g}^{w}` (eqs. , , ) + :math:`c_{g}^{w}` (:eq:`5.108`, :eq:`5.109`, :eq:`5.110`) -#. Sensible heat flux from vegetation :math:`H_{v}` (eq. ) +#. Sensible heat flux from vegetation :math:`H_{v}` (:eq:`5.97` ) -#. Latent heat flux from vegetation :math:`\lambda E_{v}` (eq. ) +#. Latent heat flux from vegetation :math:`\lambda E_{v}` (:eq:`5.101` ) #. If the latent heat flux has changed sign from the latent heat flux computed at the previous iteration @@ -1500,23 +1500,23 @@ proceeds as follows: (:math:`\Delta _{1} =0.1\lambda E_{v} ^{n+1} -\lambda E_{v} ^{n+1}` ) is added to the sensible heat flux later. -#. Change in vegetation temperature :math:`\Delta T_{v}` (eq. ) and +#. Change in vegetation temperature :math:`\Delta T_{v}` (:eq:`5.129` ) and update the vegetation temperature as :math:`T_{v}^{n+1} =T_{v}^{n} +\Delta T_{v}` . :math:`T_{v}` is constrained to change by no more than 1ºK in one iteration. If this limit is exceeded, the energy error is .. math:: - :label: 5.139) + :label: 5.138 \Delta _{2} =\overrightarrow{S}_{v} -\overrightarrow{L}_{v} -\frac{\partial \overrightarrow{L}_{v} }{\partial T_{v} } \Delta T_{v} -H_{v} -\frac{\partial H_{v} }{\partial T_{v} } \Delta T_{v} -\lambda E_{v} -\frac{\partial \lambda E_{v} }{\partial T_{v} } \Delta T_{v} where :math:`\Delta T_{v} =1{\rm \; or\; }-1`. The error :math:`\Delta _{2}` is added to the sensible heat flux later. -#. Water vapor flux :math:`E_{v}` (eq. ) +#. Water vapor flux :math:`E_{v}` (:eq:`5.133` ) -#. Transpiration :math:`E_{v}^{t}` (eq. if :math:`\beta _{t} >0`, +#. Transpiration :math:`E_{v}^{t}` (:eq:`5.134` if :math:`\beta_{t} >0`, otherwise :math:`E_{v}^{t} =0`) #. The water vapor flux :math:`E_{v}` is constrained to be less than or @@ -1526,26 +1526,28 @@ where :math:`\Delta T_{v} =1{\rm \; or\; }-1`. The error The energy error due to this constraint is .. math:: - :label: 5.140) + :label: 5.139 \Delta _{3} =\max \left(0,\, E_{v} -E_{v}^{t} -\frac{W_{can} }{\Delta t} \right). The error :math:`\lambda \Delta _{3}` is added to the sensible heat flux later. -#. Sensible heat flux :math:`H_{v}` (eq. ). The three energy error +#. Sensible heat flux :math:`H_{v}` (:eq:`` ). The three energy error terms, :math:`\Delta _{1}` , :math:`\Delta _{2}` , and :math:`\lambda \Delta _{3}` are also added to the sensible heat flux. -#. The saturated vapor pressure :math:`e_{i}` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), saturated +#. The saturated vapor pressure :math:`e_{i}` (Chapter + :numref:`rst_Stomatal Resistance and Photosynthesis`), saturated specific humidity :math:`q_{sat}^{T_{v} }` and its derivative :math:`\frac{dq_{sat}^{T_{v} } }{dT_{v} }` at the leaf surface - (section :numref:`Saturation Vapor Pressure`), are re-evaluated based on the new :math:`T_{v}` . + (section :numref:`Saturation Vapor Pressure`), are re-evaluated based on + the new :math:`T_{v}` . -#. Canopy air temperature :math:`T_{s}` (eq. ) +#. Canopy air temperature :math:`T_{s}` (:eq:`5.93` ) -#. Canopy air specific humidity :math:`q_{s}` (eq. ) +#. Canopy air specific humidity :math:`q_{s}` (:eq:`5.107` ) #. Temperature difference :math:`\theta _{atm} -\theta _{s}` @@ -1561,11 +1563,11 @@ flux later. where :math:`\frac{q_{*} }{q_{atm} -q_{s} }` was calculated earlier in the iteration -#. Virtual potential temperature scale :math:`\theta _{v*}` (eq. ) +#. Virtual potential temperature scale :math:`\theta _{v*}` (:eq:`5.17` ) -#. Wind speed including the convective velocity, :math:`V_{a}` (eq. ) +#. Wind speed including the convective velocity, :math:`V_{a}` (:eq:`5.24` ) -#. Monin-Obukhov length :math:`L` (eq. ) +#. Monin-Obukhov length :math:`L` (:eq:`5.49` ) #. The iteration is stopped after two or more steps if :math:`\tilde{\Delta }T_{v} <0.01` and @@ -1574,14 +1576,14 @@ flux later. :math:`\tilde{\Delta }T_{v} =\max \left(\left|T_{v}^{n+1} -T_{v}^{n} \right|,\, \left|T_{v}^{n} -T_{v}^{n-1} \right|\right)`, or after forty iterations have been carried out. -#. Momentum fluxes :math:`\tau _{x}` , :math:`\tau _{y}` (eqs. , ) +#. Momentum fluxes :math:`\tau _{x}` , :math:`\tau _{y}` (:eq:`5.5`, :eq:`5.6`) -#. Sensible heat flux from ground :math:`H_{g}` (eq. ) +#. Sensible heat flux from ground :math:`H_{g}` (:eq:`5.89` ) -#. Water vapor flux from ground :math:`E_{g}` (eq. ) +#. Water vapor flux from ground :math:`E_{g}` (:eq:`5.102` ) #. 2-m height air temperature :math:`T_{2m}` , specific humidity - :math:`q_{2m}` , relative humidity :math:`RH_{2m}` \ (eqs. , , ) + :math:`q_{2m}` , relative humidity :math:`RH_{2m}` \ (:eq:`5.58` , :eq:`5.59`, :eq:`5.60`) .. _Update of Ground Sensible and Latent Heat Fluxes: @@ -1592,17 +1594,17 @@ The sensible and water vapor heat fluxes derived above for bare soil and soil beneath canopy are based on the ground surface temperature from the previous time step :math:`T_{g}^{n}` and are used as the surface forcing for the solution of the soil temperature equations (section -:numref:`Numerical Solution Temperature`). This solution yields a new ground surface temperature -:math:`T_{g}^{n+1}` . The ground sensible and water vapor fluxes are -then updated for :math:`T_{g}^{n+1}` as +:numref:`Numerical Solution Temperature`). This solution yields a new ground +surface temperature :math:`T_{g}^{n+1}` . The ground sensible and water +vapor fluxes are then updated for :math:`T_{g}^{n+1}` as .. math:: - :label: 5.141) + :label: 5.140 H'_{g} =H_{g} +\left(T_{g}^{n+1} -T_{g}^{n} \right)\frac{\partial H_{g} }{\partial T_{g} } .. math:: - :label: 5.142) + :label: 5.141 E'_{g} =E_{g} +\left(T_{g}^{n+1} -T_{g}^{n} \right)\frac{\partial E_{g} }{\partial T_{g} } @@ -1611,18 +1613,18 @@ vapor fluxes derived from equations and for non-vegetated surfaces and equations and for vegetated surfaces using :math:`T_{g}^{n}` . One further adjustment is made to :math:`H'_{g}` and :math:`E'_{g}` . If the soil moisture in the top snow/soil layer is not sufficient to -support the updated ground evaporation, i.e., if :math:`E'_{g} >0` and -:math:`f_{evap} <1` where +support the updated ground evaporation, i.e., if :math:`E'_{g} > 0` and +:math:`f_{evap} < 1` where .. math:: - :label: 5.143) + :label: 5.142 f_{evap} =\frac{{\left(w_{ice,\; snl+1} +w_{liq,\, snl+1} \right)\mathord{\left/ {\vphantom {\left(w_{ice,\; snl+1} +w_{liq,\, snl+1} \right) \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} }{\sum _{j=1}^{npft}\left(E'_{g} \right)_{j} \left(wt\right)_{j} } \le 1, an adjustment is made to reduce the ground evaporation accordingly as .. math:: - :label: 5.144) + :label: 5.143 E''_{g} =f_{evap} E'_{g} . @@ -1635,35 +1637,38 @@ relative area of the :math:`j^{th}` PFT with respect to the column, and :math:`npft` is the number of PFTs on the column. :math:`w_{ice,\, snl+1}` and :math:`w_{liq,\, snl+1}` are the ice and liquid water contents (kg m\ :sup:`-2`) of the top snow/soil layer -(Chapter :numref:`rst_Hydrology`). Any resulting energy deficit is assigned to sensible heat +(Chapter :numref:`rst_Hydrology`). Any resulting energy deficit is assigned +to sensible heat as .. math:: - :label: 5.145) + :label: 5.144 H''_{g} =H_{g} +\lambda \left(E'_{g} -E''_{g} \right). -The ground water vapor flux :math:`E''_{g}` is partitioned into evaporation of liquid water from snow/soil :math:`q_{seva}` -(kg\ m\ :sup:`-2` s\ :sup:`-1`), sublimation from snow/soil ice :math:`q_{subl}` (kg m\ :sup:`-2` s\ :sup:`-1`), liquid dew -on snow/soil :math:`q_{sdew}` (kg m\ :sup:`-2` s\ :sup:`-1`), or frost on snow/soil :math:`q_{frost}` (kg m\ :sup:`-2` s\ :sup:`-1`) as +The ground water vapor flux :math:`E''_{g}` is partitioned into evaporation +of liquid water from snow/soil :math:`q_{seva}` (kg\ m\ :sup:`-2` s\ :sup:`-1`), +sublimation from snow/soil ice :math:`q_{subl}` (kg m\ :sup:`-2` s\ :sup:`-1`), +liquid dew on snow/soil :math:`q_{sdew}` (kg m\ :sup:`-2` s\ :sup:`-1`), or +frost on snow/soil :math:`q_{frost}` (kg m\ :sup:`-2` s\ :sup:`-1`) as .. math:: - :label: 5.146) + :label: 5.145 q_{seva} =\max \left(E''_{sno} \frac{w_{liq,\, snl+1} }{w_{ice,\; snl+1} +w_{liq,\, snl+1} } ,0\right)\qquad E''_{sno} \ge 0,\, w_{ice,\; snl+1} +w_{liq,\, snl+1} >0 .. math:: - :label: 5.147) + :label: 5.146 q_{subl} =E''_{sno} -q_{seva} \qquad E''_{sno} \ge 0 .. math:: - :label: 5.148) + :label: 5.147 q_{sdew} =\left|E''_{sno} \right|\qquad E''_{sno} <0{\rm \; and\; }T_{g} \ge T_{f} .. math:: - :label: 5.149) + :label: 5.148 q_{frost} =\left|E''_{sno} \right|\qquad E''_{sno} <0{\rm \; and\; }T_{g} 0} \\ {\lambda _{vap} \qquad {\rm otherwise}} \end{array}\right\} @@ -1719,7 +1724,7 @@ flux to an energy flux, :math:`\lambda _{vap}` is used. The system balances energy as .. math:: - :label: 5.154) + :label: 5.153 \overrightarrow{S}_{g} +\overrightarrow{S}_{v} +L_{atm} \, \downarrow -L\, \uparrow -H_{v} -H_{g} -\lambda _{vap} E_{v} -\lambda E_{g} -G=0. @@ -1734,12 +1739,12 @@ Saturation vapor pressure :math:`e_{sat}^{T}` (Pa) and its derivative :ref:`Flatau et al. (1992) ` .. math:: - :label: 5.155) + :label: 5.154 e_{sat}^{T} =100\left[a_{0} +a_{1} T+\cdots +a_{n} T^{n} \right] .. math:: - :label: 5.156) + :label: 5.155 \frac{de_{sat}^{T} }{dT} =100\left[b_{0} +b_{1} T+\cdots +b_{n} T^{n} \right] @@ -1753,12 +1758,12 @@ The saturated water vapor specific humidity :math:`q_{sat}^{T}` and its derivati :math:`\frac{dq_{sat}^{T} }{dT}` are .. math:: - :label: 5.157) + :label: 5.156 q_{sat}^{T} =\frac{0.622e_{sat}^{T} }{P_{atm} -0.378e_{sat}^{T} } .. math:: - :label: 5.158) + :label: 5.157 \frac{dq_{sat}^{T} }{dT} =\frac{0.622P_{atm} }{\left(P_{atm} -0.378e_{sat}^{T} \right)^{2} } \frac{de_{sat}^{T} }{dT} . diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index f1f78574df..69a8907f89 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -392,7 +392,7 @@ mass is stated as \frac{\partial \theta }{\partial t} =-\frac{\partial q}{\partial z} -Q where :math:`\theta` is the volumetric soil water content -(mm:sup:`3` of water mm\ :sup:`-3` of soil), :math:`t` is +(mm\ :sup:`3` of water mm\ :sup:`-3` of soil), :math:`t` is time (s), :math:`z` is height above some datum in the soil column (mm) (positive upwards), :math:`q` is soil water flux (kg m\ :sup:`-2` s\ :sup:`-1` or mm s\ :sup:`-1`) (positive upwards), and diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index 35a77b901f..136272973d 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -106,7 +106,7 @@ resolution. .. Figure 12.1. Schematic representation of the urban land unit -.. _Figure schematic representation of urban: +.. _Figure schematic representation of the urban land unit: .. figure:: image1.png From 80662a29eea077ab7cb7511ee0c037ee77ab49fa Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 31 May 2017 11:38:37 -0600 Subject: [PATCH 0032/1973] Update html --- .../CLM50_Tech_Note_External_Nitrogen_Cycle.rst | 2 +- .../CLM50_Tech_Note_Plant_Hydraulic_Stress.rst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst index b8f6536a46..69959b0a8c 100644 --- a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst +++ b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst @@ -93,7 +93,7 @@ annual NPP in Figure 16.1. .. figure:: image1.png Biological nitrogen fixation as a function of annual net -primary production. + primary production. Because of the empirical nature of this NPP-BNF relationship, the timescale for calculating NPP and thus BNF is unconstrained. Using diff --git a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst b/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst index e5541bf2b4..02132af76d 100644 --- a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst +++ b/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst @@ -230,7 +230,7 @@ PHS explicitly models root, stem, shaded leaf, and sunlit leaf water potential a \psi=\left[\psi_{sunleaf},\psi_{shadeleaf},\psi_{stem},\psi_{root}\right] .. math:: - :label: 11.21) + :label: 11.21 \begin{aligned} E_{sun}&=q_{1a}\\ @@ -240,10 +240,10 @@ PHS explicitly models root, stem, shaded leaf, and sunlit leaf water potential a &=\sum_{i=1}^{nlevsoi}{q_{3,i}} \end{aligned} -The demand terms (left-hand side) are decreasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, water stress increases, causing a decrease in transpiration demand. The supply terms (right-hand side) are increasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, the gradients in water potential increase, causing an increase in vegetation water supply. PHS takes a Newton's method approach to iteratively solve for the vegetation water potentials that satisfy equations in (11.21). +The demand terms (left-hand side) are decreasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, water stress increases, causing a decrease in transpiration demand. The supply terms (right-hand side) are increasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, the gradients in water potential increase, causing an increase in vegetation water supply. PHS takes a Newton's method approach to iteratively solve for the vegetation water potentials that satisfy :eq:`11.21`. .. math:: - :label: 11.21) + :label: 11.22) ff From 4f2077ed2cd2c4f1f5a09c37f353c8e7e6b0e6bd Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 31 May 2017 13:34:20 -0600 Subject: [PATCH 0033/1973] update methane and lake chapters --- .../CLM50_Tech_Note_CN_Allocation.rst | 100 ++-- .../tech_note/Lake/CLM50_Tech_Note_Lake.rst | 479 +++++++++--------- .../Methane/CLM50_Tech_Note_Methane.rst | 211 +++++--- .../References/CLM50_Tech_Note_References.rst | 2 +- 4 files changed, 418 insertions(+), 374 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 3206f3ab28..a63ec9ae3d 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -80,17 +80,17 @@ photosynthesis ( :math:`CF_{xs,mr}`, gC m\ :sup:`-2` s\ :sup:`-1`): .. math:: - :label: 19.1) + :label: 19.1 CF_{mr} =CF_{GPP,mr} +CF_{xs,mr} .. math:: - :label: 19.2) + :label: 19.2 CF_{GPP,mr} =\_ \left\{\begin{array}{l} {CF_{mr} \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. .. math:: - :label: 19.3) + :label: 19.3 CF_{xs,mr} =\_ \left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{mr} -CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. @@ -114,12 +114,12 @@ flux to :math:`CS_{xs}` (:math:`CF_{GPP,xs}`, gC m\ :sup:`-2` s\ :sup:`-1`) is given as .. math:: - :label: 19.4) + :label: 19.4 CF_{GPP,xs,pot} =\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CS_{xs} \ge 0} \\ {-CS_{xs} /(86400\tau _{xs} )\qquad {\rm for\; }CS_{xs} <0} \end{array}\right. .. math:: - :label: 19.5) + :label: 19.5 CF_{GPP,xs} =\left\{\begin{array}{l} {CF_{GPP,xs,pot} \qquad \qquad \qquad {\rm for\; }CF_{GPP,xs,pot} \le CF_{GPPpot} -CF_{GPP,mr} } \\ {\max (CF_{GPPpot} -CF_{GPP,mr} ,0)\qquad {\rm for\; }CF_{GPP,xs,pot} >CF_{GPPpot} -CF_{GPP,mr} } \end{array}\right. @@ -140,7 +140,7 @@ remaining carbon flux from photosynthesis which can be allocated to new growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 19.6) + :label: 19.6 CF_{avail\_ alloc} =CF_{GPPpot} -CF_{GPP,mr} -CF_{GPP,xs} . @@ -151,7 +151,7 @@ between various tissue types. The allometric parameters are defined as follows: .. math:: - :label: ZEqnNum650137 + :label: 19.7 \begin{array}{l} {a_{1} ={\rm \; ratio\; of\; new\; fine\; root\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{2} ={\rm \; ratio\; of\; new\; coarse\; root\; :\; new\; stem\; carbon\; allocation}} \\ {a_{3} ={\rm \; ratio\; of\; new\; stem\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{4} ={\rm \; ratio\; new\; live\; wood\; :\; new\; total\; wood\; allocation}} \\ {g_{1} ={\rm ratio\; of\; growth\; respiration\; carbon\; :\; new\; growth\; carbon.\; }} \end{array} @@ -166,7 +166,7 @@ ratio for carbon allocation between new stem and new leaf increases with increasing net primary production (NPP), as .. math:: - :label: 19.8) + :label: 19.8 a_{3} =\frac{2.7}{1+e^{-0.004NPP_{ann} -300} } -0.4 @@ -236,7 +236,7 @@ Carbon to nitrogen ratios are defined for different tissue types as follows: .. math:: - :label: ZEqnNum413927 + :label: 19.9 \begin{array}{l} {CN_{leaf} =\_ {\rm \; C:N\; for\; leaf}} \\ {CN_{fr} =\_ {\rm \; C:N\; for\; fine\; root}} \\ {CN_{lw} =\_ {\rm \; C:N\; for\; live\; wood\; (in\; stem\; and\; coarse\; root)}} \\ {CN_{dw} =\_ {\rm \; C:N\; for\; dead\; wood\; (in\; stem\; and\; coarse\; root)}} \end{array} @@ -251,19 +251,19 @@ functions of new leaf carbon allocation (:math:`CF_{GPP,leaf}`, gC m\ :sup:`-2` s\ :sup:`-1`): .. math:: - :label: ZEqnNum555154 + :label: 19.10 \begin{array}{l} {CF_{alloc} =CF_{GPP,leaf} {\kern 1pt} C_{allom} } \\ {NF_{alloc} =CF_{GPP,leaf} {\kern 1pt} N_{allom} } \end{array} where .. math:: - :label: 19.11) + :label: 19.11 \begin{array}{l} {C_{allom} =\left\{\begin{array}{l} {\left(1+g_{1} \right)\left(1+a_{1} +a_{3} \left(1+a_{2} \right)\right)\qquad {\rm for\; woody\; PFT}} \\ {1+g_{1} +a_{1} \left(1+g_{1} \right)\qquad \qquad {\rm for\; non-woody\; PFT}} \end{array}\right. } \\ {} \end{array} .. math:: - :label: 19.12) + :label: 19.12 N_{allom} =\left\{\begin{array}{l} {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } +\frac{a_{3} a_{4} \left(1+a_{2} \right)}{CN_{lw} } +} \\ {\qquad \frac{a_{3} \left(1-a_{4} \right)\left(1+a_{2} \right)}{CN_{dw} } \qquad {\rm for\; woody\; PFT}} \\ {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } \qquad \qquad \qquad {\rm for\; non-woody\; PFT.}} \end{array}\right. @@ -274,7 +274,7 @@ plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, gN m\ :sup:`-2` s\ :sup:`-1`) as: .. math:: - :label: 19.13) + :label: 19.13 NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . @@ -293,7 +293,7 @@ availability of nitrogen from this pool to support new growth s\ :sup:`-1`) is proportional to the plant nitrogen demand, as: .. math:: - :label: 19.14) + :label: 19.14 NF_{avail\_ retrans} =\min \left(\frac{NF_{retrans\_ ann} \frac{NF_{plant\_ demand} }{NF_{plant\_ demand\_ ann} } }{\Delta t} ,\; \frac{NS_{retrans} }{\Delta t} \right) @@ -319,7 +319,7 @@ m\ :sup:`-2` s\ :sup:`-1`) is never greater than the plant demand for new nitrogen: .. math:: - :label: 19.15) + :label: 19.15 NF_{retrans,alloc} =\min \left(NF_{plant\_ demand} ,NF_{avail\_ retrans} \right) @@ -332,7 +332,7 @@ from the soil (:math:`NF_{plant\_demand\_soil}`, gN m\ :sup:`-2` s\ :sup:`-1`): .. math:: - :label: ZEqnNum491412 + :label: 19.16 NF_{plant\_ demand\_ soil} =NF_{plant\_ demand} -NF_{retrans,alloc} . @@ -346,7 +346,7 @@ mineral nitrogen supply and competition with heterotrophs. Plant uptake from the soil mineral nitrogen pool is then given as: .. math:: - :label: 19.17) + :label: 19.17 NF_{sminn,alloc} =NF_{plant\_ demand\_ soil} f_{plant\_ demand} @@ -356,7 +356,7 @@ Final carbon and nitrogen allocation The total flux of allocated nitrogen is given as: .. math:: - :label: 19.18) + :label: 19.18 NF_{alloc} =NF_{retrans,alloc} +NF_{sminn,alloc} @@ -364,14 +364,14 @@ From the stoichiometric relationship in Eq. , the associated carbon allocation flux is: .. math:: - :label: 19.19) + :label: 19.19 CF_{alloc} =NF_{alloc} \frac{C_{allom} }{N_{allom} } . The downregulation of photosynthesis can then be calculated as: .. math:: - :label: 19.20) + :label: 19.20 f_{dreg} =\frac{CF_{alloc} -CF_{avail\_ alloc} }{CF_{GPPpot} } . @@ -379,7 +379,7 @@ Total allocation to new leaf carbon (:math:`CF_{alloc,leaf\_tot}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as: .. math:: - :label: 19.21) + :label: 19.21 CF_{alloc,leaf\_ tot} =\frac{CF_{alloc} }{C_{allom} } . @@ -395,124 +395,124 @@ storage pools (where storage is indicated with *\_stor*) for the various tissue types are given as: .. math:: - :label: 19.22) + :label: 19.22 CF_{alloc,leaf} \_ =CF_{alloc,leaf\_ tot} f_{cur} .. math:: - :label: 19.23) + :label: 19.23 CF_{alloc,leaf\_ stor} \_ =CF_{alloc,leaf\_ tot} \left(1-f_{cur} \right) .. math:: - :label: 19.24) + :label: 19.24 CF_{alloc,froot} \_ =CF_{alloc,leaf\_ tot} a_{1} f_{cur} .. math:: - :label: 19.25) + :label: 19.25 CF_{alloc,froot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{1} \left(1-f_{cur} \right) .. math:: - :label: 19.26) + :label: 19.26 CF_{alloc,livestem} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} f_{cur} .. math:: - :label: 19.27) + :label: 19.27 CF_{alloc,livestem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} \left(1-f_{cur} \right) .. math:: - :label: 19.28) + :label: 19.28 CF_{alloc,deadstem} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)f_{cur} .. math:: - :label: 19.29) + :label: 19.29 CF_{alloc,deadstem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right) .. math:: - :label: 19.30) + :label: 19.30 CF_{alloc,livecroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} f_{cur} .. math:: - :label: 19.31) + :label: 19.31 CF_{alloc,livecroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} \left(1-f_{cur} \right) .. math:: - :label: 19.32) + :label: 19.32 CF_{alloc,deadcroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)f_{cur} .. math:: - :label: 19.33) + :label: 19.33 CF_{alloc,deadcroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). The corresponding nitrogen allocation fluxes are given as: .. math:: - :label: 19.34) + :label: 19.34 NF_{alloc,leaf} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } f_{cur} .. math:: - :label: 19.35) + :label: 19.35 NF_{alloc,leaf\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } \left(1-f_{cur} \right) .. math:: - :label: 19.36) + :label: 19.36 NF_{alloc,froot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } f_{cur} .. math:: - :label: 19.37) + :label: 19.37 NF_{alloc,froot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } \left(1-f_{cur} \right) .. math:: - :label: 19.38) + :label: 19.38 NF_{alloc,livestem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } f_{cur} .. math:: - :label: 19.39) + :label: 19.39 NF_{alloc,livestem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) .. math:: - :label: 19.40) + :label: 19.40 NF_{alloc,deadstem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} .. math:: - :label: 19.41) + :label: 19.41 NF_{alloc,deadstem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right) .. math:: - :label: 19.42) + :label: 19.42 NF_{alloc,livecroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } f_{cur} .. math:: - :label: 19.43) + :label: 19.43 NF_{alloc,livecroot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) .. math:: - :label: 19.44) + :label: 19.44 NF_{alloc,deadcroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} .. math:: - :label: 19.45) + :label: 19.45 NF_{alloc,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). @@ -536,22 +536,22 @@ functions tissue nitrogen content and the relevant temperature, following the empirical relationship reported by Ryan (1991): .. math:: - :label: 19.46) + :label: 19.46 CF_{mr\_ leaf} \_ =NS_{leaf} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} .. math:: - :label: 19.47) + :label: 19.47 CF_{mr\_ livestem} \_ =NS_{livestem} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} .. math:: - :label: 19.48) + :label: 19.48 CF_{mr\_ livecroot} \_ =NS_{livecroot} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} .. math:: - :label: 19.49) + :label: 19.49 CF_{mr\_ froot} \_ =\sum _{j=1}^{nlevsoi}NS_{froot} rootfr_{j} MR_{base} MR_{Q10} ^{(Ts_{j} -20)/10} @@ -574,7 +574,7 @@ common base maintenance respiration rate for all live tissue types. The total maintenance respiration cost is then given as: .. math:: - :label: 19.50) + :label: 19.50 CF_{mr} =CF_{mr\_ leaf} +CF_{mr\_ froot} +CF_{mr\_ livestem} +CF_{mr\_ livecroot} . diff --git a/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst b/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst index 860bc2ae7c..28cf52f8a1 100644 --- a/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst +++ b/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst @@ -21,10 +21,13 @@ body, resolved snow layers, and “soil” and bedrock layers below the lake body. Temperatures and ice fractions are simulated for :math:`N_{levlak} =10` layers (for global simulations) or :math:`N_{levlak} =25` (for site simulations) with discretization -described in section 9.1. Lake albedo is described in section 9.3. Lake -surface fluxes (section 9.4) generally follow the formulations for -non-vegetated surfaces, including the calculations of aerodynamic -resistances (section 5.2); however, the lake surface temperature +described in section :numref:`Vertical Discretization Lake`. Lake albedo is +described in section :numref:`Surface Albedo Lake`. Lake surface fluxes +(section :numref:`Surface Fluxes and Surface Temperature Lake`) generally +follow the formulations for non-vegetated surfaces, including the calculations +of aerodynamic resistances (section +:numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`); +however, the lake surface temperature :math:`T_{g}` (representing an infinitesimal interface layer between the top resolved lake layer and the atmosphere) is solved for simultaneously with the surface fluxes. After surface fluxes are @@ -32,7 +35,8 @@ evaluated, temperatures are solved simultaneously in the resolved snow layers (if present), the lake body, and the soil and bedrock, using the ground heat flux *G* as a top boundary condition. Snow, soil, and bedrock models generally follow the formulations for non-vegetated -surfaces (Chapter 6), with modifications described below. +surfaces (Chapter :numref:`rst_Soil and Snow Temperatures`), with +modifications described below. .. _Vertical Discretization Lake: @@ -51,7 +55,7 @@ liquid density), with frozen mass-fraction *I* a state variable. Resolved snow layers are present if the snow thickness :math:`z_{sno} \ge s_{\min }` , where *s*\ :sub:`min` = 4 cm by default, and is adjusted for model timesteps other than 1800 s in order -to maintain numerical stability (section 9.6.5). For global simulations +to maintain numerical stability (section :numref:`Modifications to Snow Layer Logic Lake`). For global simulations with 10 body layers, the default (50 m lake) body layer thicknesses are given by: :math:`\Delta z_{i}` of 0.1, 1, 2, 3, 4, 5, 7, 7, 10.45, and 10.45 m, with node depths :math:`z_{i}` located at the center of each @@ -64,22 +68,23 @@ layers 10-13; 2 for layers 14-15; 2.5 for layers 16-17; 3.5 for layers layer is kept at 10 cm and the other 9 layer thicknesses are adjusted to maintain fixed proportions. For lakes with *d* :math:`<` 1 m, all layers have equal thickness. Thicknesses of snow, soil, and bedrock layers -follow the scheme used over non-vegetated surfaces (Chapter 6), with +follow the scheme used over non-vegetated surfaces (Chapter :numref:`rst_Soil and Snow Temperatures`), with modifications to the snow layer thickness rules to keep snow layers at -least as thick as *s*\ :sub:`min` (section 9.6.5). +least as thick as *s*\ :sub:`min` (section :numref:`Modifications to Snow Layer Logic Lake`). .. _External Data Lake: External Data ----------------- -As discussed in Subin et al (2012a, b), the Global Lake and Wetland -Database (Lehner and Doll 2004) is currently used to prescribe lake -fraction in each land model grid cell, for a total of 2.3 million -km\ :sup:`-2`. As in Subin et al. (2012a, b), the Kourzeneva -(2012) global gridded dataset is currently used to estimate a mean lake -depth in each grid cell, based on interpolated compilations of -geographic information. +As discussed in :ref:`Subin et al. (2012a, b) `, the +Global Lake and Wetland Database (:ref:`Lehner and Doll 2004`) +is currently used to prescribe lake fraction in each land model grid cell, +for a total of 2.3 million km\ :sup:`-2`. As in +:ref:`Subin et al. (2012a, b) `, the +:ref:`Kourzeneva et al. (2012)` global gridded dataset is currently +used to estimate a mean lake depth in each grid cell, based on interpolated +compilations of geographic information. .. _Surface Albedo Lake: @@ -87,10 +92,10 @@ Surface Albedo ------------------ For direct radiation, the albedo *a* for lakes with ground temperature -:math:`{T}_{g}` (K) above freezing is given by (Pivovarov, 1972) +:math:`{T}_{g}` (K) above freezing is given by (:ref:`Pivovarov, 1972`) .. math:: - :label: ZEqnNum194122 + :label: 12.1 a=\frac{0.5}{\cos z+0.15} @@ -100,57 +105,27 @@ eq. is integrated over the full sky to yield *a* = 0.10. For frozen lakes without resolved snow layers, the albedo at cold temperatures *a*\ :sub:`0` is 0.60 for visible and 0.40 for near infrared radiation. As the temperature at the ice surface, -:math:`{T}_{g}`, approaches freezing [ :math:`{T}_{f}` (K) (Table -2.6)], the albedo is relaxed towards 0.10 based on Mironov et al. (2010): +:math:`{T}_{g}`, approaches freezing [ :math:`{T}_{f}` (K) (:numref:`Table Physical Constants`)], the albedo is relaxed towards 0.10 based on +:ref:`Mironov et al. (2010)`: .. math:: - :label: 12.2) + :label: 12.2 a=a_{0} \left(1-x\right)+0.10x,x=\exp \left(-95\frac{T_{f} -T_{g} }{T_{f} } \right) -where *a* is restricted to be no less than that given in eq. . +where *a* is restricted to be no less than that given in :eq:`12.1`. For frozen lakes with resolved snow layers, the reflectance of the ice surface is fixed at *a*\ :sub:`0`, and the snow reflectance is -calculated as over non-vegetated surfaces (Chapter 3). These two -reflectances are combined to obtain the snow-fraction-weighted albedo as -in over non-vegetated surfaces (Chapter 3). +calculated as over non-vegetated surfaces (Chapter :numref:`rst_Surface Albedos`). +These two reflectances are combined to obtain the snow-fraction-weighted albedo as +in over non-vegetated surfaces (Chapter :numref:`rst_Surface Albedos`). .. _Surface Fluxes and Surface Temperature Lake: Surface Fluxes and Surface Temperature ------------------------------------------ -.. _Overview of Changes from CLM4: - -Overview of Changes from CLM4 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -#. The surface roughnesses, and surface absorption fraction - :math:`\beta`, are diagnostic rather than constants. As the surface - roughnesses depend (weakly) on the friction velocity :math:`u_{\*}` - (which itself depends weakly on the surface roughnesses), their - calculation has been incorporated into the iteration solution for - :math:`{T}_{g}`, and the maximum number of iterations has been - increased to 4. Convergence of the modified solution was tested - during development. - -#. A coefficient of :math:`\beta` has been added to - :math:`{S}_{g}` in eq. , correcting a previous error. - .. todo:: fill this equation number in - -#. The top layer thickness :math:`\Delta z_{T}` used in eq. has been - appended with a coefficient of ½, correcting a previous error. - -#. The thermal conductivity :math:`\lambda _{T}` used in eq. depends on - the properties of the top model layer (e.g., snow, ice, or water). - When this layer is unfrozen, :math:`\lambda _{T}` includes the eddy - conductivity calculated in the previous timestep. - -#. Several conditions are imposed on the ground temperature - :math:`{T}_{g}` to maintain a stable density profile at the lake - surface eq. . - .. _Surface Properties Lake: Surface Properties @@ -159,24 +134,25 @@ Surface Properties The fraction of shortwave radiation absorbed at the surface, :math:`\beta`, depends on the lake state. If resolved snow layers are present, then :math:`\beta` is set equal to the absorption fraction -predicted by the snow-optics submodel (Chapter 3) for the top snow +predicted by the snow-optics submodel (Chapter :numref:`rst_Surface Albedos`) +for the top snow layer. Otherwise, :math:`\beta` is set equal to the near infrared fraction of the shortwave radiation reaching the surface simulated by the atmospheric model or atmospheric data model used for offline -simulations (Chapter 26). The remainder of the shortwave radiation +simulations (Chapter :numref:`rst_Offline Mode`). The remainder of the shortwave radiation fraction (1 :math:`{-}` :math:`\beta`) is absorbed in the lake -body or soil as described in section 9.5.5. +body or soil as described in section :numref:`Radiation Penetration`. The surface roughnesses are functions of the lake state and atmospheric forcing. For frozen lakes ( :math:`T_{g} \le T_{f}` ) with resolved snow layers, the momentum roughness length -:math:`z_{0m} =2.4\times 10^{-3} {\rm m}` (as over non-vegetated -surfaces; Chapter 5), and the scalar roughness lengths +:math:`z_{0m} =2.4 \times 10^{-3} {\rm m}` (as over non-vegetated +surfaces; Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), and the scalar roughness lengths (*z*\ :sub:`0q` for latent heat; and *z*\ :sub:`0h`, for sensible heat) are given by -(Zilitinkevich 1970) +(:ref:`Zilitinkevich 1970`) .. math:: - :label: ZEqnNum631483 + :label: 12.3 \begin{array}{l} {R_{0} =\frac{z_{0m} u_{*} }{\nu } ,} \\ {z_{0h} =z_{0q} =z_{0m} \exp \left\{-0.13R_{0} ^{0.45} \right\}} \end{array} @@ -186,23 +162,23 @@ length for sensible heat, :math:`z_{0q}` is the roughness length for latent heat, :math:`\nu` (m\ :sup:`2` s\ :sup:`-1`) is the kinematic viscosity of air, and :math:`u_{\*}` (m s\ :sup:`-1`) is the friction velocity in the atmospheric surface layer. For frozen lakes without resolved snow -layers, :math:`z_{0m} =1\times 10^{-3} {\rm m}` (Subin et al. 2012a), +layers, :math:`z_{0m} =1\times 10^{-3} {\rm m}` (:ref:`Subin et al. (2012a) `), and the scalar roughness lengths are given by . -For unfrozen lakes, *z*\ :sub:`0m` is given by (Subin et al. 2012a) +For unfrozen lakes, *z*\ :sub:`0m` is given by (:ref:`Subin et al. (2012a) `) .. math:: - :label: ZEqnNum864823 + :label: 12.4 z_{0m} =\max \left(\frac{\alpha \nu }{u_{*} } ,C\frac{u_{*} ^{2} }{g} \right) where :math:`\alpha` = 0.1, :math:`\nu` is the kinematic viscosity of air given below, *C* is the effective Charnock coefficient given -below, and *g* is the acceleration of gravity (Table 2.6). The kinematic +below, and *g* is the acceleration of gravity (:numref:`Table Physical Constants`). The kinematic viscosity is given by .. math:: - :label: 12.5) + :label: 12.5 \nu =\nu _{0} \left(\frac{T_{g} }{T_{0} } \right)^{1.5} \frac{P_{0} }{P_{ref} } @@ -216,7 +192,7 @@ height. The Charnock coefficient *C* is a function of the lake fetch *F* default: .. math:: - :label: 12.6) + :label: 12.6 \begin{array}{l} {C=C_{\min } +(C_{\max } -C_{\min } )\exp \left\{-\min \left(A,B\right)\right\}} \\ {A={\left(\frac{Fg}{u_{\*} ^{2} } \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } \mathord{\left/ {\vphantom {\left(\frac{Fg}{u_{\*} ^{2} } \right)^{{1\mathord{\left/ {\vphantom {1 3}} \right. \kern-\nulldelimiterspace} 3} } f_{c} }} \right. \kern-\nulldelimiterspace} f_{c} } } \\ {B=\varepsilon \frac{\sqrt{dg} }{u} } \end{array} @@ -233,7 +209,7 @@ Surface Flux Solution Conservation of energy at the lake surface requires .. math:: - :label: ZEqnNum309023 + :label: 12.7 \beta \vec{S}_{g} -\vec{L}_{g} -H_{g} -\lambda E_{g} -G=0 @@ -247,61 +223,63 @@ the temperature at the lake surface :math:`{T}_{g}`. :math:`\lambda` converts :math:`E_{g}` to an energy flux based on .. math:: - :label: ZEqnNum257687 + :label: 12.8 \lambda =\left\{\begin{array}{l} {\lambda _{sub} \qquad T_{g} \le T_{f} } \\ {\lambda _{vap} \qquad T_{g} >T_{f} } \end{array}\right\}. The sensible heat flux (W m\ :sup:`-2`) is .. math:: - :label: ZEqnNum720553 + :label: 12.9 H_{g} =-\rho _{atm} C_{p} \frac{\left(\theta _{atm} -T_{g} \right)}{r_{ah} } where :math:`\rho _{atm}` is the density of moist air (kg -m\ :sup:`-3`) (Chapter 5), :math:`C_{p}` is the specific heat -capacity of air (J kg\ :sup:`-1` K\ :sup:`-1`) (Table 2.6), +m\ :sup:`-3`) (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), :math:`C_{p}` is the specific heat +capacity of air (J kg\ :sup:`-1` K\ :sup:`-1`) (:numref:`Table Physical Constants`), :math:`\theta _{atm}` is the atmospheric potential temperature (K) -(Chapter 5), :math:`T_{g}` is the lake surface temperature (K) (at an +(Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), :math:`T_{g}` is the lake surface temperature (K) (at an infinitesimal interface just above the top resolved model layer: snow, ice, or water), and :math:`r_{ah}` is the aerodynamic resistance to -sensible heat transfer (s m\ :sup:`-1`) (section 5.1). +sensible heat transfer (s m\ :sup:`-1`) (section :numref:`Monin-Obukhov Similarity Theory`). The water vapor flux (kg m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 12.10) + :label: 12.10 E_{g} =-\frac{\rho _{atm} \left(q_{atm} -q_{sat}^{T_{g} } \right)}{r_{aw} } where :math:`q_{atm}` is the atmospheric specific humidity (kg -kg\ :sup:`-1`) (section 2.2.1), :math:`q_{sat}^{T_{g} }` \ is the -saturated specific humidity (kg kg\ :sup:`-1`) (section 5.5) at +kg\ :sup:`-1`) (section :numref:`Atmospheric Coupling`), +:math:`q_{sat}^{T_{g} }` \ is the saturated specific humidity +(kg kg\ :sup:`-1`) (section :numref:`Saturation Vapor Pressure`) at the lake surface temperature :math:`T_{g}` , and :math:`r_{aw}` is the aerodynamic resistance to water vapor transfer (s m\ :sup:`-1`) -(section 5.1). +(section :numref:`Monin-Obukhov Similarity Theory`). The zonal and meridional momentum fluxes are .. math:: - :label: 12.11) + :label: 12.11 \tau _{x} =-\rho _{atm} \frac{u_{atm} }{r_{atm} } .. math:: - :label: 12.12) + :label: 12.12 \tau _{y} =-\rho _{atm} \frac{v_{atm} }{r_{atm} } where :math:`u_{atm}` and :math:`v_{atm}` are the zonal and -meridional atmospheric winds (m s\ :sup:`-1`) (section 2.2.1), and +meridional atmospheric winds (m s\ :sup:`-1`) (section +:numref:`Atmospheric Coupling`), and :math:`r_{am}` is the aerodynamic resistance for momentum (s -m\ :sup:`-1`) (section 5.1). +m\ :sup:`-1`) (section :numref:`Monin-Obukhov Similarity Theory`). The heat flux into the lake surface :math:`G` (W m\ :sup:`-2`) is .. math:: - :label: ZEqnNum122376 + :label: 12.13 G=\frac{2\lambda _{T} }{\Delta z_{T} } \left(T_{g} -T_{T} \right) @@ -311,10 +289,9 @@ thickness (m), and :math:`T_{T}` is the temperature (K) of the top resolved lake layer (snow, ice, or water). The top thermal conductivity :math:`\lambda _{T}` of unfrozen lakes ( :math:`T_{g} >T_{f}` ) includes conductivities due to molecular ( :math:`\lambda _{liq}` ) and -eddy (:math:`\lambda _{K}` ) diffusivities (section 9.5.4), as evaluated +eddy (:math:`\lambda _{K}` ) diffusivities (section :numref:`Eddy Diffusivity and Thermal Conductivities`), as evaluated in the top lake layer at the previous timestep, where -:math:`\lambda _{liq}` is the thermal conductivity of water (Table -2.6). For frozen lakes without resolved snow layers, +:math:`\lambda _{liq}` is the thermal conductivity of water (:numref:`Table Physical Constants`). For frozen lakes without resolved snow layers, :math:`\lambda _{T} =\lambda _{ice}` . When resolved snow layers are present, :math:`\lambda _{T}` \ is calculated based on the water content, ice content, and thickness of the top snow layer, as for @@ -323,7 +300,7 @@ non-vegetated surfaces. The absorbed solar radiation :math:`\vec{S}_{g}` is .. math:: - :label: 12.14) + :label: 12.14 \vec{S}_{g} =\sum _{\Lambda }S_{atm} \, \downarrow _{\Lambda }^{\mu } \left(1-\alpha _{g,\, \Lambda }^{\mu } \right) +S_{atm} \, \downarrow _{\Lambda } \left(1-\alpha _{g,\, \Lambda } \right) @@ -332,30 +309,32 @@ where :math:`S_{atm} \, \downarrow _{\Lambda }^{\mu }` and and diffuse solar fluxes (W m\ :sup:`-2`) and :math:`\Lambda` denotes the visible (:math:`<` 0.7\ :math:`\mu {\rm m}`) and near-infrared (:math:`\ge` 0.7\ :math:`\mu {\rm m}`) wavebands (section -2.2.1), and :math:`\alpha _{g,\, \Lambda }^{\mu }` and +:numref:`Atmospheric Coupling`), and :math:`\alpha _{g,\, \Lambda }^{\mu }` and :math:`\alpha _{g,\, \mu }` are the direct beam and diffuse lake -albedos (section 9.3). +albedos (section :numref:`Surface Albedo Lake`). The net emitted longwave radiation is .. math:: - :label: 12.15) + :label: 12.15 \vec{L}_{g} =L_{g} \, \uparrow -L_{atm} \, \downarrow where :math:`L_{g} \, \uparrow` is the upward longwave radiation from the surface, :math:`L_{atm} \, \downarrow` is the downward atmospheric -longwave radiation (section 2.2.1). The upward longwave radiation from -the surface is +longwave radiation (section :numref:`Atmospheric Coupling`). The upward +longwave radiation from the surface is .. math:: - :label: 12.16) + :label: 12.16 L\, \uparrow =\left(1-\varepsilon _{g} \right)L_{atm} \, \downarrow +\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{4} +4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} \left(T_{g}^{n+1} -T_{g}^{n} \right) where :math:`\varepsilon _{g} =0.97` is the lake surface emissivity, -:math:`\sigma` is the Stefan-Boltzmann constant (W m\ :sup:`-2` K\ :sup:`-4`) (Table 2.6), and :math:`T_{g}^{n+1} -T_{g}^{n}` is -the difference in lake surface temperature between Newton-Raphson iterations (see below). +:math:`\sigma` is the Stefan-Boltzmann constant (W m\ :sup:`-2` K\ +:sup:`-4`) (:numref:`Table Physical Constants`), and +:math:`T_{g}^{n+1} -T_{g}^{n}` is the difference in lake surface +temperature between Newton-Raphson iterations (see below). The sensible heat :math:`H_{g}` , the water vapor flux :math:`E_{g}` through its dependence on the saturated specific humidity, the net @@ -365,7 +344,7 @@ Newton-Raphson iteration is applied to solve for :math:`T_{g}` and the surface fluxes as .. math:: - :label: ZEqnNum858039 + :label: 12.17 \Delta T_{g} =\frac{\beta \overrightarrow{S}_{g} -\overrightarrow{L}_{g} -H_{g} -\lambda E_{g} -G}{\frac{\partial \overrightarrow{L}_{g} }{\partial T_{g} } +\frac{\partial H_{g} }{\partial T_{g} } +\frac{\partial \lambda E_{g} }{\partial T_{g} } +\frac{\partial G}{\partial T_{g} } } @@ -374,79 +353,80 @@ where :math:`\Delta T_{g} =T_{g}^{n+1} -T_{g}^{n}` and the subscript :math:`T_{g}^{n+1}` can be written as .. math:: - :label: ZEqnNum878786 + :label: 12.18 T_{g}^{n+1} =\frac{\beta \overrightarrow{S}_{g} -\overrightarrow{L}_{g} -H_{g} -\lambda E_{g} -G+T_{g}^{n} \left(\frac{\partial \overrightarrow{L}_{g} }{\partial T_{g} } +\frac{\partial H_{g} }{\partial T_{g} } +\frac{\partial \lambda E_{g} }{\partial T_{g} } +\frac{\partial G}{\partial T_{g} } \right)}{\frac{\partial \overrightarrow{L}_{g} }{\partial T_{g} } +\frac{\partial H_{g} }{\partial T_{g} } +\frac{\partial \lambda E_{g} }{\partial T_{g} } +\frac{\partial G}{\partial T_{g} } } where the partial derivatives are .. math:: - :label: 12.19) + :label: 12.19 \frac{\partial \overrightarrow{L}_{g} }{\partial T_{g} } =4\varepsilon _{g} \sigma \left(T_{g}^{n} \right)^{3} , .. math:: - :label: 12.20) + :label: 12.20 \frac{\partial H_{g} }{\partial T_{g} } =\frac{\rho _{atm} C_{p} }{r_{ah} } , .. math:: - :label: 12.21) + :label: 12.21 \frac{\partial \lambda E_{g} }{\partial T_{g} } =\frac{\lambda \rho _{atm} }{r_{aw} } \frac{dq_{sat}^{T_{g} } }{dT_{g} } , .. math:: - :label: 12.22) + :label: 12.22 \frac{\partial G}{\partial T_{g} } =\frac{2\lambda _{T} }{\Delta z_{T} } . The fluxes of momentum, sensible heat, and water vapor are solved for simultaneously with lake surface temperature as follows. The stability-related equations are the same as for non-vegetated surfaces -(section 5.2), except that the surface roughnesses are here (weakly -varying) functions of the friction velocity :math:`u_{\*}` . To begin, -*z*\ :sub:`0m` is set based on the value -calculated for the last timestep (for :math:`T_{g} >T_{f}` ) or based on -the values in section 9.4.2 (otherwise), and the scalar roughness -lengths are set based on the relationships in section 9.4.2. +(section :numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`), +except that the surface roughnesses are here (weakly varying) functions +of the friction velocity :math:`u_{\*}` . To begin, *z*\ :sub:`0m` is set +based on the value calculated for the last timestep (for +:math:`T_{g} >T_{f}` ) or based on the values in section +:numref:`Surface Properties Lake` (otherwise), and the scalar roughness +lengths are set based on the relationships in section :numref:`Surface Properties Lake`. #. An initial guess for the wind speed :math:`V_{a}` including the - convective velocity :math:`U_{c}` is obtained from eq. assuming an + convective velocity :math:`U_{c}` is obtained from :eq:`5.24` assuming an initial convective velocity :math:`U_{c} =0` m s\ :sup:`-1` for stable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} \ge 0` - as evaluated from eq. ) and :math:`U_{c} =0.5` for unstable + as evaluated from :eq:`5.50`) and :math:`U_{c} =0.5` for unstable conditions (:math:`\theta _{v,\, atm} -\theta _{v,\, s} <0`). #. An initial guess for the Monin-Obukhov length :math:`L` is obtained - from the bulk Richardson number using equations and . + from the bulk Richardson number using :eq:`5.46` and :eq:`5.48`. #. The following system of equations is iterated four times: -#. Heat of vaporization / sublimation :math:`\lambda` \ (eq. ) +#. Heat of vaporization / sublimation :math:`\lambda` \ (:eq:`12.8`) #. Thermal conductivity :math:`\lambda _{T}` \ (above) -#. Friction velocity :math:`u_{\*}` (eqs. , , , ) +#. Friction velocity :math:`u_{\*}` (:eq:`5.32`, :eq:`5.33`, :eq:`5.34`, :eq:`5.35`) -#. Potential temperature scale :math:`\theta _{\*}` (eqs. , , , ) +#. Potential temperature scale :math:`\theta _{\*}` (:eq:`5.37` , :eq:`5.38`, :eq:`5.39`, :eq:`5.40`) -#. Humidity scale :math:`q_{\*}` (eqs. , , , ) +#. Humidity scale :math:`q_{\*}` (:eq:`5.41`, :eq:`5.42`, :eq:`5.43`, :eq:`5.44`) #. Aerodynamic resistances :math:`r_{am}` , :math:`r_{ah}` , and - :math:`r_{aw}` (eqs. , , ) + :math:`r_{aw}` (:eq:`5.55`, :eq:`5.56`, :eq:`5.57`) -#. Lake surface temperature :math:`T_{g}^{n+1}` (eq.) +#. Lake surface temperature :math:`T_{g}^{n+1}` (:eq:`12.18`) -#. Heat of vaporization / sublimation :math:`\lambda` (eq. ) +#. Heat of vaporization / sublimation :math:`\lambda` (:eq:`12.8`) #. Sensible heat flux :math:`H_{g}` is updated for :math:`T_{g}^{n+1}` - (eq.) + (:eq:`12.9`) #. Water vapor flux :math:`E_{g}` is updated for :math:`T_{g}^{n+1}` as .. math:: - :label: ZEqnNum331835 + :label: 12.23 E_{g} =-\frac{\rho _{atm} }{r_{aw} } \left[q_{atm} -q_{sat}^{T_{g} } -\frac{\partial q_{sat}^{T_{g} } }{\partial T_{g} } \left(T_{g}^{n+1} -T_{g}^{n} \right)\right] @@ -456,28 +436,28 @@ iterations. #. Saturated specific humidity :math:`q_{sat}^{T_{g} }` and its derivative :math:`\frac{dq_{sat}^{T_{g} } }{dT_{g} }` are updated - for :math:`T_{g}^{n+1}` (section 5.1). + for :math:`T_{g}^{n+1}` (section :numref:`Monin-Obukhov Similarity Theory`). -#. Virtual potential temperature scale :math:`\theta _{v\*}` (eq. ) +#. Virtual potential temperature scale :math:`\theta _{v\*}` (:eq:`5.17`) -#. Wind speed including the convective velocity, :math:`V_{a}` (eq. ) +#. Wind speed including the convective velocity, :math:`V_{a}` (:eq:`5.24`) -#. Monin-Obukhov length :math:`L` (eq. ). +#. Monin-Obukhov length :math:`L` (:eq:`5.49`) -#. Roughness lengths (eq. , ). +#. Roughness lengths (:eq:`12.3`, :eq:`12.4`). Once the four iterations for lake surface temperature have been yielded a tentative solution :math:`T_{g} ^{{'} }` , several restrictions are imposed in order to maintain consistency with the top lake model -layer temperature :math:`T_{T}` \ (Subin et al. 2012a). +layer temperature :math:`T_{T}` \ (:ref:`Subin et al. (2012a) `). .. math:: - :label: ZEqnNum180534 + :label: 12.24 \begin{array}{l} {{\rm 1)\; }T_{T} \le T_{f} T_{g} ^{{'} } >T_{m} \Rightarrow T_{g} =T_{T} ,} \\ {{\rm 3)\; }T_{m} >T_{g} ^{{'} } >T_{T} >T_{f} \Rightarrow T_{g} =T_{T} } \end{array} where :math:`T_{m}` \ is the temperature of maximum liquid water -density, 3.85\ :sup:`o` C (Hostetler and Bartlein 1990). The +density, 3.85\ :sup:`o` C (:ref:`Hostetler and Bartlein (1990) `). The first condition requires that, if there is any snow or ice present, the surface temperature is restricted to be less than or equal to freezing. The second and third conditions maintain convective stability in the top @@ -489,7 +469,8 @@ the momentum fluxes are re-evaluated in any case. The final ground heat flux :math:`G` is calculated from the residual of the energy balance eq. XXX in order to precisely conserve energy. XXX This ground heat flux is taken as a prescribed flux boundary condition for the lake -temperature solution (section 9.5.3). An energy balance check is +temperature solution (section :numref:`Boundary Conditions Lake`). +An energy balance check is included at each timestep to insure that eq. XXX is obeyed to within 0.1 W m\ :sup:`-2`. @@ -506,10 +487,10 @@ Introduction The (optional-) snow, lake body (water and/or ice), soil, and bedrock system is unified for the lake temperature solution. The governing equation, similar to that for the snow-soil-bedrock system for vegetated -land units (Chapter 6), is +land units (Chapter :numref:`rst_Soil and Snow Temperatures`), is .. math:: - :label: ZEqnNum239244 + :label: 12.25 \tilde{c}_{v} \frac{\partial T}{\partial t} =\frac{\partial }{\partial z} \left(\tau \frac{\partial T}{\partial z} \right)-\frac{d\phi }{dz} @@ -521,21 +502,23 @@ radiation (W m\ :sup:`-2`) penetrating to depth *z* (m). The system is discretized into *N* layers, where .. math:: - :label: 12.26) + :label: 12.26 N=n_{sno} +N_{levlak} +N_{levgrnd} , :math:`n_{sno}` is the number of actively modeled snow layers at the -current timestep (section 7.2), and :math:`N_{levgrnd}` \ is as for -vegetated land units (Chapter 6). Energy is conserved as +current timestep (Chapter :numref:`rst_Snow Hydrology`), and +:math:`N_{levgrnd}` \ is as for vegetated land units (Chapter +:numref:`rst_Soil and Snow Temperatures`). Energy is conserved as .. math:: - :label: ZEqnNum317718 + :label: 12.27 \frac{d}{dt} \sum _{j=1}^{N}\left[\tilde{c}_{v,j} (t)\left(T_{j} -T_{f} \right)+L_{j} (t)\right] \Delta z_{j} =G+\left(1-\beta \right)\vec{S}_{g} where :math:`\tilde{c}_{v,j} (t)`\ is the volumetric heat capacity of -the *j*\ th layer (section 9.5.5), :math:`L_{j} (t)`\ is the latent heat +the *j*\ th layer (section :numref:`Radiation Penetration`), +:math:`L_{j} (t)`\ is the latent heat of fusion per unit volume of the *j*\ th layer (proportional to the mass of liquid water present), and the right-hand side represents the net influx of energy to the lake system. Note that @@ -553,20 +536,21 @@ Overview of Changes from CLM4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thermal conductivities include additional eddy diffusivity, beyond the -Hostetler and Bartlein (1990) formulation, due to unresolved processes -(Fang and Stefan 1996; Subin et al. 2012a). Lake water is now allowed to +:ref:`Hostetler and Bartlein (1990)` formulation, +due to unresolved processes (:ref:`Fang and Stefan 1996`; +:ref:`Subin et al. (2012a) `). Lake water is now allowed to freeze by an arbitrary fraction for each layer, which releases latent heat and changes thermal properties. Convective mixing occurs for all lakes, even if frozen. Soil and bedrock are included beneath the lake. The full snow model is used if the snow thickness exceeds a threshold; if there are resolved snow layers, radiation transfer is predicted by -the snow-optics submodel (Chapter 3), and the remaining radiation +the snow-optics submodel (Chapter :numref:`rst_Surface Albedos`), and the remaining radiation penetrating the bottom snow layer is absorbed in the top layer of lake ice; conversely, if there are no snow layers, the solar radiation penetrating the bottom lake layer is absorbed in the top soil layer. The lakes have variable depth, and all physics is assumed valid for arbitrary depth, except for a depth-dependent enhanced mixing (section -9.5.4). Finally, a previous sign error in the calculation of eddy +:numref:`Eddy Diffusivity and Thermal Conductivities`). Finally, a previous sign error in the calculation of eddy diffusivity (specifically, the Brunt-Väisälä frequency term; eq. ) was corrected. @@ -576,48 +560,50 @@ Boundary Conditions ^^^^^^^^^^^^^^^^^^^^^^^^^ The top boundary condition, imposed at the top modeled layer -:math:`i=j_{top}` , where :math:`j_{top} =-n_{sno} +1`, is the -downwards surface flux *G* defined by the energy flux residual during -the surface temperature solution (section 9.4.3). The bottom boundary -condition, imposed at :math:`i=N_{levlak} +N_{levgrnd}` , is zero flux. +:math:`i=j_{top}` , where :math:`j_{top} =-n_{sno} +1`, is the downwards +surface flux *G* defined by the energy flux residual during the surface +temperature solution (section :numref:`Boundary Conditions Lake`). The bottom +boundary condition, imposed at :math:`i=N_{levlak} +N_{levgrnd}` , is zero flux. The 2-m windspeed :math:`u_{2}` \ (m s\ :sup:`-1`) is used in the calculation of eddy diffusivity: .. math:: - :label: ZEqnNum997977 + :label: 12.28 u_{2} =\frac{u_{*} }{k} \ln \left(\frac{2}{z_{0m} } \right)\ge 0.1. where :math:`u_{*}` \ is the friction velocity calculated in section -9.4.3 and *k* is the von Karman constant (Table 2.6). +:numref:`Boundary Conditions Lake` and *k* is the von Karman constant +(:numref:`Table Physical Constants`). .. _Eddy Diffusivity and Thermal Conductivities: Eddy Diffusivity and Thermal Conductivities ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The total eddy diffusivity :math:`K_{W}` (m\ :sup:`2` s\ :sup:`-1`) for liquid water in the lake body is given by (Subin et al. 2012a) +The total eddy diffusivity :math:`K_{W}` (m\ :sup:`2` s\ :sup:`-1`) for liquid water in the lake body is given by (:ref:`Subin et al. (2012a) `) .. math:: - :label: 12.29) + :label: 12.29 K_{W} = m_{d} \left(\kappa _{e} +K_{ed} +\kappa _{m} \right) -where :math:`\kappa _{e}` is due to wind-driven eddies (Hostetler and -Bartlein 1990), :math:`K_{ed}` is a modest enhanced diffusivity -intended to represent unresolved mixing processes (Fang and Stefan -1996), +where :math:`\kappa _{e}` is due to wind-driven eddies +(:ref:`Hostetler and Bartlein (1990)`), +:math:`K_{ed}` is a modest enhanced diffusivity +intended to represent unresolved mixing processes +(:ref:`Fang and Stefan 1996`), :math:`\kappa _{m} =\frac{\lambda _{liq} }{c_{liq} \rho _{liq} }` \ is the molecular diffusivity of water (given by the ratio of its thermal conductivity (W m\ :sup:`-1` K\ :sup:`-1`) to the product of its heat capacity (J kg\ :sup:`-1` K\ :sup:`-1`) and density -(kg m\ :sup:`-3`), values given in Table 2.6), and :math:`m_{d}` +(kg m\ :sup:`-3`), values given in :numref:`Table Physical Constants`), and :math:`m_{d}` (unitless) is a factor which increases the overall diffusivity for large lakes, intended to represent 3-dimensional mixing processes such as caused by horizontal temperature gradients. As currently implemented, .. math:: - :label: 12.30) + :label: 12.30 m_{d} =\left\{\begin{array}{l} {1,\qquad d<25{\rm m}} \\ {10,\qquad d\ge 25{\rm m}} \end{array}\right\} @@ -626,7 +612,7 @@ where *d* is the lake depth. The wind-driven eddy diffusion coefficient :math:`\kappa _{e,\, i}` (m\ :sup:`2` s\ :sup:`-1`) for layers :math:`1\le i\le N_{levlak}` is .. math:: - :label: 12.31) + :label: 12.31 \kappa _{e,\, i} =\left\{\begin{array}{l} {\frac{kw^{*} z_{i} }{P_{0} \left(1+37Ri^{2} \right)} \exp \left(-k^{*} z_{i} \right)\qquad T_{g} >T_{f} } \\ {0\qquad T_{g} \le T_{f} } \end{array}\right\} @@ -637,44 +623,45 @@ velocity (m s\ :sup:`-1`) is :math:`w^{*} =0.0012u_{2}` , and :math:`k^{*} =6.6u_{2}^{-1.84} \sqrt{\left|\sin \phi \right|}` . For the bottom layer, :math:`\kappa _{e,\, N_{levlak} } =\kappa _{e,N_{levlak} -1\, }` . As in -Hostetler and Bartlein (1990), the 2-m wind speed :math:`u_{2}` (m -s\ :sup:`-1`) (eq. ) is used to evaluate :math:`w^{*}` and -:math:`k^{*}` rather than the 10-m wind used by Henderson-Sellers -(1985). +:ref:`Hostetler and Bartlein (1990)`, +the 2-m wind speed :math:`u_{2}` (m s\ :sup:`-1`) (eq. ) is used to evaluate +:math:`w^{*}` and :math:`k^{*}` rather than the 10-m wind used by +:ref:`Henderson-Sellers (1985) `. + The Richardson number is .. math:: - :label: 12.32) + :label: 12.32 R_{i} =\frac{-1+\sqrt{1+\frac{40N^{2} k^{2} z_{i}^{2} }{w^{*^{2} } \exp \left(-2k^{*} z_{i} \right)} } }{20} where .. math:: - :label: ZEqnNum230908 + :label: 12.33 N^{2} =\frac{g}{\rho _{i} } \frac{\partial \rho }{\partial z} and :math:`g` is the acceleration due to gravity (m s\ :sup:`-2`) -(Table 2.6), :math:`\rho _{i}` is the density of water (kg +(:numref:`Table Physical Constants`), :math:`\rho _{i}` is the density of water (kg m\ :sup:`-3`), and :math:`\frac{\partial \rho }{\partial z}` is approximated as :math:`\frac{\rho _{i+1} -\rho _{i} }{z_{i+1} -z_{i} }` . Note that -because here, *z* is increasing downwards (unlike in Hostetler and -Bartlein (1990)), eq. contains no negative sign; this is a correction -from CLM4. The density of water is (Hostetler and Bartlein 1990) +because here, *z* is increasing downwards (unlike in :ref:`Hostetler and Bartlein (1990)`), eq. contains no negative sign; this is a correction +from CLM4. The density of water is +(:ref:`Hostetler and Bartlein (1990)`) .. math:: - :label: 12.34) + :label: 12.34 \rho _{i} =1000\left(1-1.9549\times 10^{-5} \left|T_{i} -277\right|^{1.68} \right). -The enhanced diffusivity :math:`K_{ed}` is given by (Fang and Stefan -1996) +The enhanced diffusivity :math:`K_{ed}` is given by +(:ref:`Fang and Stefan 1996`) .. math:: - :label: ZEqnNum809542 + :label: 12.35 K_{ed} =1.04\times 10^{-8} \left(N^{2} \right)^{-0.43} ,N^{2} \ge 7.5\times 10^{-5} {\rm s}^{2} @@ -686,7 +673,7 @@ The thermal conductivity for the liquid water portion of lake body layer given by .. math:: - :label: 12.36) + :label: 12.36 \tau _{liq,i} =K_{W} c_{liq} \rho _{liq} . @@ -695,11 +682,11 @@ The thermal conductivity of the ice portion of lake body layer *i*, constant among layers, and is given by .. math:: - :label: 12.37) + :label: 12.37 \tau _{ice,eff} =\tau _{ice} \frac{\rho _{ice} }{\rho _{liq} } -where :math:`\tau _{ice}` \ (Table 2.6) is the nominal thermal +where :math:`\tau _{ice}` \ (:numref:`Table Physical Constants`) is the nominal thermal conductivity of ice: :math:`\tau _{ice,eff}` \ is adjusted for the fact that the nominal model layer thicknesses remain constant even while the physical ice thickness exceeds the water thickness. @@ -710,15 +697,15 @@ and water fractions, assuming that they will be physically vertically stacked, and is given by .. math:: - :label: 12.38) + :label: 12.38 \tau _{i} =\frac{\tau _{ice,eff} \tau _{liq,i} }{\tau _{liq,i} I_{i} +\tau _{ice} \left(1-I_{i} \right)} . The thermal conductivity of snow, soil, and bedrock layers above and below the lake, respectively, are computed identically to those for -vegetated land units (Chapter 6), except for the adjustment of thermal -conductivity for frost heave or excess ice (Subin et al., 2012a, -Supporting Information). +vegetated land units (Chapter :numref:`rst_Soil and Snow Temperatures`), except for the adjustment of thermal +conductivity for frost heave or excess ice (:ref:`Subin et al., 2012a, +Supporting Information`). .. _Radiation Penetration: @@ -727,7 +714,7 @@ Radiation Penetration If there are no resolved snow layers, the surface absorption fraction :math:`\beta` is set according to the near-infrared fraction simulated by the atmospheric model. This is apportioned to the surface energy -budget (section 9.4.2), and thus no additional radiation is absorbed in +budget (section :numref:`Surface Properties Lake`), and thus no additional radiation is absorbed in the top :math:`z_{a}` (currently 0.6 m) of unfrozen lakes, for which the light extinction coefficient :math:`\eta` (m\ :sup:`-1`) varies between lake columns (eq. ). For frozen lakes @@ -735,7 +722,7 @@ varies between lake columns (eq. ). For frozen lakes radiation that is not apportioned to the surface energy budget is absorbed in the top lake body layer. This is a simplification, as lake ice is partially transparent. If there are resolved snow layers, then -the snow optics submodel (Chapter 3) is used to calculate the snow layer +the snow optics submodel (Chapter :numref:`rst_Surface Albedos`) is used to calculate the snow layer absorption (except for the absorption predicted for the top layer by the snow optics submodel, which is assigned to the surface energy budget), with the remainder penetrating snow layers absorbed in the top lake body @@ -745,7 +732,7 @@ For unfrozen lakes, the solar radiation remaining at depth :math:`z>z_{a}` in the lake body is given by .. math:: - :label: 12.39) + :label: 12.39 \phi =\left(1-\beta \vec{S}_{g} \right)\exp \left\{-\eta \left(z-z_{a} \right)\right\} . @@ -753,7 +740,7 @@ For all lake body layers, the flux absorbed by the layer *i*, :math:`\phi _{i}` , is .. math:: - :label: 12.40) + :label: 12.40 \phi _{i} =\left(1-\beta \vec{S}_{g} \right)\left[\exp \left\{-\eta \left(z_{i} -\frac{\Delta z_{i} }{2} -z_{a} \right)\right\}-\exp \left\{-\eta \left(z_{i} +\frac{\Delta z_{i} }{2} -z_{a} \right)\right\}\right] . @@ -763,11 +750,11 @@ The remaining flux exiting the bottom of layer :math:`i=N_{levlak}` is absorbed in the top soil layer. The light extinction coefficient :math:`\eta` (m\ :sup:`-1`), if -not provided as external data, is a function of depth *d* (m) (Subin et -al. 2012a): +not provided as external data, is a function of depth *d* (m) +(:ref:`Subin et al. (2012a) `): .. math:: - :label: ZEqnNum284649 + :label: 12.41 \eta =1.1925d^{-0.424} . @@ -781,7 +768,7 @@ The vertically-integrated heat capacity for each lake layer, water and ice fractions: .. math:: - :label: 12.42) + :label: 12.42 c_{v,i} =\Delta z_{i} \rho _{liq} \left[c_{liq} \left(1-I_{i} \right)+c_{ice} I_{i} \right] . @@ -790,7 +777,7 @@ as the thickness of the layer is fixed. The total heat capacity :math:`c_{v,i}` for each soil, snow, and bedrock layer (J m\ :sup:`-2`) is determined as for vegetated land -units (Chapter 6), as the sum of the heat capacities for the water, ice, +units (Chapter :numref:`rst_Soil and Snow Temperatures`), as the sum of the heat capacities for the water, ice, and mineral constituents. .. _Crank-Nicholson Solution Lake: @@ -799,8 +786,9 @@ Crank-Nicholson Solution ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The solution method for thermal diffusion is similar to that used for -soil (Chapter 6), except that the lake body layers are sandwiched -between the snow and soil layers (section 9.5.1), and radiation flux is +soil (Chapter :numref:`rst_Soil and Snow Temperatures`), except that the +lake body layers are sandwiched between the snow and soil layers +(section :numref:`Introduction Lake`), and radiation flux is absorbed throughout the lake layers. Before solution, layer temperatures :math:`T_{i}` (K), thermal conductivities :math:`\tau _{i}` (W m\ :sup:`-1` K\ :sup:`-1`), heat capacities :math:`c_{v,i}` @@ -812,7 +800,7 @@ calculated as the harmonic mean of the conductivities of the neighboring layers: .. math:: - :label: 12.43) + :label: 12.43 \lambda _{i} =\frac{\tau _{i} \tau _{i+1} \left(z_{i+1} -z_{i} \right)}{\tau _{i} \left(z_{i+1} -\hat{z}_{i} \right)+\tau _{i+1} \left(\hat{z}_{i} -z_{i} \right)} , @@ -824,7 +812,7 @@ between lake and soil. The governing equation is discretized for each layer as .. math:: - :label: ZEqnNum991615 + :label: 12.44 \frac{c_{v,i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=F_{i-1} -F_{i} +\phi _{i} @@ -838,18 +826,19 @@ Eq. is solved using the semi-implicit Crank-Nicholson Method, resulting in a tridiagonal system of equations: .. math:: - :label: 12.45) + :label: 12.45 \begin{array}{l} {r_{i} =a_{i} T_{i-1}^{n+1} +b_{i} T_{i}^{n+1} +cT_{i+1}^{n+1} ,} \\ {a_{i} =-0.5\frac{\Delta t}{c_{v,i} } \frac{\partial F_{i-1} }{\partial T_{i-1}^{n} } ,} \\ {b_{i} =1+0.5\frac{\Delta t}{c_{v,i} } \left(\frac{\partial F_{i-1} }{\partial T_{i-1}^{n} } +\frac{\partial F_{i} }{\partial T_{i}^{n} } \right),} \\ {c_{i} =-0.5\frac{\Delta t}{c_{v,i} } \frac{\partial F_{i} }{\partial T_{i}^{n} } ,} \\ {r_{i} =T_{i}^{n} +0.5\frac{\Delta t}{c_{v,i} } \left(F_{i-1} -F_{i} \right)+\frac{\Delta t}{c_{v,i} } \phi _{i} .} \end{array} The fluxes :math:`F_{i}` are defined as follows: for the top layer, :math:`F_{j_{top} -1} =2G;a_{j_{top} } =0`, where *G* is defined as in -section 9.4.3 (the factor of 2 merely cancels out the Crank-Nicholson -0.5 in the equation for :math:`r_{j_{top} }` ). For the bottom layer, -:math:`F_{N_{levlak} +N_{levgrnd} } =0`. For all other layers: +section :numref:`Boundary Conditions Lake` (the factor of 2 merely cancels +out the Crank-Nicholson 0.5 in the equation for :math:`r_{j_{top} }` ). +For the bottom layer, :math:`F_{N_{levlak} +N_{levgrnd} } =0`. +For all other layers: .. math:: - :label: 12.46) + :label: 12.46 F_{i} =\lambda _{i} \frac{T_{i} ^{n} -T_{i+1}^{n} }{z_{n+1} -z_{n} } . @@ -859,7 +848,7 @@ Phase Change ^^^^^^^^^^^^^^^^^^ Phase change in the lake, snow, and soil is done similarly to that done -for the soil and snow for vegetated land units (Chapter 6), except +for the soil and snow for vegetated land units (Chapter :numref:`rst_Soil and Snow Temperatures`), except without the allowance for freezing point depression in soil underlying lakes. After the heat diffusion is calculated, phase change occurs in a given layer if the temperature is below freezing and liquid water @@ -869,29 +858,30 @@ If melting occurs, the available energy for melting, :math:`Q_{avail}` (J m\ :sup:`-2`), is computed as .. math:: - :label: ZEqnNum598199 + :label: 12.47 Q_{avail} =\left(T_{i} -T_{f} \right)c_{v,i} where :math:`T_{i}` is the temperature of the layer after thermal -diffusion (section 9.5.7), and :math:`c_{v,i}` \ is as calculated in -section 9.5.6. The mass of melt in the layer *M* (kg m\ :sup:`-2`) -is given by +diffusion (section :numref:`Crank-Nicholson Solution Lake`), and +:math:`c_{v,i}` \ is as calculated in section +:numref:`Heat Capacities Lake`. The mass of melt in the layer *M* +(kg m\ :sup:`-2`) is given by .. math:: - :label: 12.48) + :label: 12.48 M=\min \left\{M_{ice} ,\frac{Q_{avail} }{H_{fus} } \right\} where :math:`H_{fus}` (J kg\ :sup:`-1`) is the latent heat of -fusion of water (Table 2.6), and :math:`M_{ice}` is the mass of ice in +fusion of water (:numref:`Table Physical Constants`), and :math:`M_{ice}` is the mass of ice in the layer: :math:`I_{i} \rho _{liq} \Delta z_{i}` for a lake body layer, or simply the soil / snow ice content state variable (:math:`w_{ice}` ) for a soil / snow layer. The heat remainder, :math:`Q_{rem}` \ is given by .. math:: - :label: ZEqnNum889387 + :label: 12.49 Q_{rem} =Q_{avail} -MH_{fus} . @@ -900,7 +890,7 @@ downwards by :math:`M`, and the temperature :math:`T_{i}` of the layer is adjusted to .. math:: - :label: ZEqnNum926437 + :label: 12.50 T_{i} =T_{f} +\frac{Q_{rem} }{c'_{v,i} } @@ -910,7 +900,7 @@ If freezing occurs, :math:`Q_{avail}` is again given by but will be negative. The melt :math:`M`, also negative, is given by .. math:: - :label: 12.51) + :label: 12.51 M=\max \left\{-M_{liq} ,\frac{Q_{avail} }{H_{fus} } \right\} @@ -937,7 +927,8 @@ maintaining constant density. Convection ^^^^^^^^^^^^^^^^ -Convective mixing is based on Hostetler et al.’s (1993, 1994) coupled +Convective mixing is based on +:ref:`Hostetler et al.’s (1993, 1994)` coupled lake-atmosphere model, adjusting the lake temperature after diffusion and phase change to maintain a stable density profile. Unfrozen lakes overturn when :math:`\rho _{i} >\rho _{i+1}` , in which case the layer @@ -946,9 +937,11 @@ applied to layers 1 to :math:`i+1` and the densities are updated. This scheme is applied iteratively to layers :math:`1\le i`), as occasionally +these can be induced by +heat expelled from the sediments (not present in the original +:ref:`Hostetler et al. (1994)` model). Mixing proceeds +from the bottom upward in this case (i.e., first mixing layers :math:`i=N_{levlak} -1` and :math:`i=N_{levlak}` , then checking :math:`i=N_{levlak} -2` and :math:`i=N_{levlak} -1` and mixing down to :math:`i=N_{levlak}` if @@ -963,14 +956,14 @@ When this occurs, these two lake layers and all those above mix. Total enthalpy *Q* is conserved as .. math:: - :label: 12.52) + :label: 12.52 Q=\sum _{j=1}^{i+1}\Delta z_{j} \rho _{liq} \left(T_{j} -T_{f} \right)\left[\left(1-I_{j} \right)c_{liq} +I_{j} c_{ice} \right] . Once the average ice fraction :math:`I_{av}` is calculated from .. math:: - :label: 12.53) + :label: 12.53 \begin{array}{l} {I_{av} =\frac{\sum _{j=1}^{i+1}I_{j} \Delta z_{j} }{Z_{i+1} } ,} \\ {Z_{i+1} =\sum _{j=1}^{i+1}\Delta z_{j} ,} \end{array} @@ -988,7 +981,7 @@ If :math:`Q > 0`, then :math:`T_{froz} =T_{f}` , and :math:`T_{unfr}` is given by .. math:: - :label: 12.54) + :label: 12.54 T_{unfr} =\frac{Q}{\rho _{liq} Z_{i+1} \left[\left(1-I_{av} \right)c_{liq} \right]} +T_{f} . @@ -996,7 +989,7 @@ If :math:`Q < 0`, then :math:`T_{unfr} =T_{f}` , and :math:`T_{froz}` is given by .. math:: - :label: 12.55) + :label: 12.55 T_{froz} =\frac{Q}{\rho _{liq} Z_{i+1} \left[I_{av} c_{ice} \right]} +T_{f} . @@ -1015,7 +1008,7 @@ to *i* + 1, the ice fraction and temperature are set as follows, where by the heat capacity of the layer to yield .. math:: - :label: 12.56) + :label: 12.56 T_{j} =\frac{T_{froz} I_{j} c_{ice} +T_{unfr} \left(1-I_{j} \right)c_{liq} }{I_{j} c_{ice} +\left(1-I_{j} \right)c_{liq} } . @@ -1031,12 +1024,12 @@ re-written to yield the total enthalpy of the lake system (J m\ :sup:`-2`) :math:`H_{tot}` : .. math:: - :label: 12.57) + :label: 12.57 H_{tot} =\sum _{i=j_{top} }^{N_{levlak} +N_{levgrnd} }\left[c_{v,i} \left(T_{i} -T_{f} \right)+M_{liq,i} H_{fus} \right] -W_{sno,bulk} H_{fus} where :math:`M_{liq,i}` is the water mass of the *i*\ th layer (similar -to section 9.5.8), and :math:`W_{sno,bulk}` is the mass of snow-ice not +to section :numref:`Phase Change Lake`), and :math:`W_{sno,bulk}` is the mass of snow-ice not present in resolved snow layers. This expression is evaluated once at the beginning and once at the end of the timestep (re-evaluating each :math:`c_{v,i}` ), and the change is compared with the net surface @@ -1044,7 +1037,7 @@ energy flux to yield the error flux :math:`E_{soi}` (W m\ :sup:`-2`): .. math:: - :label: 12.58) + :label: 12.58 E_{soi} =\frac{\Delta H_{tot} }{\Delta t} -G-\sum _{i=j_{top} }^{N_{levlak} +N_{levgrnd} }\phi _{i} @@ -1074,7 +1067,8 @@ There are some modifications to the soil and snow parameterizations as compared with the soil in vegetated land units, or the snow overlying other impervious columns. The soil can freeze or thaw, with the allowance for frost heave (or the initialization of excess ice) -(sections 9.5.4 and 9.5.8), but no air-filled pore space is allowed in +(sections :numref:`Eddy Diffusivity and Thermal Conductivities` and +:numref:`Phase Change Lake`), but no air-filled pore space is allowed in the soil. To preserve numerical stability in the lake model (which uses a slightly different surface flux algorithm than over other non-vegetated land units), two changes are made to the snow model. @@ -1094,7 +1088,7 @@ Water Balance The total water balance of the system is given by .. math:: - :label: ZEqnNum932128 + :label: 12.59 \Delta W_{sno} +\sum _{i=1}^{n_{levsoi} }\left(\Delta w_{liq,i} +\Delta w_{ice,i} \right) =\left(q_{rain} +q_{sno} -E_{g} -q_{rgwl} -q_{snwcp,\, ice} \right)\Delta t @@ -1103,10 +1097,10 @@ where :math:`W_{sno}` (kg m\ :sup:`-2`) is the total mass of snow :math:`w_{liq,i}` and :math:`w_{ice,i}` are the masses of water phases (kg m\ :sup:`-2`) in soil layer *i*, :math:`q_{rain}` and :math:`q_{sno}` are the precipitation forcing from the atmosphere (kg -m\ :sup:`-2` s\ :sup:`-1`), :math:`q_{snwcp,\, ice}` is the -ice runoff associated with snow-capping (below), :math:`E_{g}` is the -ground evaporation (section 9.4.3), and :math:`n_{levsoi}` is the -number of hydrologically active soil layers (as opposed to dry bedrock +m\ :sup:`-2` s\ :sup:`-1`), :math:`q_{snwcp,\, ice}` is the ice runoff +associated with snow-capping (below), :math:`E_{g}` is the ground +evaporation (section :numref:`Surface Flux Solution Lake`), and :math:`n_{levsoi}` +is the number of hydrologically active soil layers (as opposed to dry bedrock layers). .. _Precipitation, Evaporation, and Runoff Lake: @@ -1120,8 +1114,9 @@ As for other land types, incident snowfall accumulates (with ice mass exceeds a minimum thickness :math:`s_{\min }` , at which point a resolved snow layer is initiated, with water, ice, dissolved aerosol, snow-grain radius, etc., state variables tracked by the Snow Hydrology -submodel (section 7.2). The density of fresh snow is assigned as for -other land types (section 7.2). Solid precipitation is added immediately +submodel (Chapter :numref:`rst_Snow Hydrology`). The density of fresh snow is +assigned as for other land types (Chapter :numref:`rst_Snow Hydrology`). +Solid precipitation is added immediately to the snow, while liquid precipitation is added to snow layers, if they exist, after accounting for dew, frost, and sublimation (below). If :math:`z_{sno}` exceeds :math:`s_{\min }` after solid precipitation is @@ -1141,29 +1136,30 @@ water mass than it contains). If there are no resolved snow layers but given by .. math:: - :label: 12.60) + :label: 12.60 q_{sub,sno} =\min \left\{E_{g} ,\frac{W_{sno} }{\Delta t} \right\} . If :math:`E_{g} <0,T_{g} \le T_{f}` , and there are no resolved snow layers or the top snow layer is not unfrozen, then the rate of frost production :math:`q_{frost} =\left|E_{g} \right|`. If :math:`E_{g} <0` -but the top snow layer has completely thawed during the Phase Change -step of the Lake Temperature solution (section 9.5.8), then frost (or -dew) is not allowed to accumulate (:math:`q_{frost} =0`), to insure that -the layer is eliminated by the Snow Hydrology (section 7.2) code. (If -:math:`T_{g} >T_{f}` , then no snow is present (section 9.4.3), and +but the top snow layer has completely thawed during the Phase Change step +of the Lake Temperature solution (section :numref:`Phase Change Lake`), then +frost (or dew) is not allowed to accumulate (:math:`q_{frost} =0`), to +insure that the layer is eliminated by the Snow Hydrology +(Chapter :numref:`rst_Snow Hydrology`) code. (If :math:`T_{g} >T_{f}`, +then no snow is present (section :numref:`Surface Flux Solution Lake`), and evaporation or dew deposition is balanced by :math:`q_{rgwl}` .) The snowpack is updated for frost and sublimation: .. math:: - :label: 12.61) + :label: 12.61 W_{sno} =W_{sno} +\Delta t\left(q_{frost} -q_{sub,sno} \right) . -If there are resolved snow layers, then this update occurs using the -Snow Hydrology submodel (section 7.2). Otherwise, the snow ice mass is -updated directly, and :math:`z_{sno}` is adjusted by the same +If there are resolved snow layers, then this update occurs using the Snow +Hydrology submodel (Chapter :numref:`rst_Snow Hydrology`). Otherwise, the +snow ice mass is updated directly, and :math:`z_{sno}` is adjusted by the same proportion as the snow ice (i.e., maintaining the same density), unless there was no snow before adding the frost, in which case the density is assumed to be 250 kg m\ :sup:`-3`. @@ -1177,7 +1173,7 @@ The combined water and ice soil volume fraction in a soil layer :math:`\theta _{i}` is given by .. math:: - :label: 12.62) + :label: 12.62 \theta _{i} =\frac{1}{\Delta z_{i} } \left(\frac{w_{ice,i} }{\rho _{ice} } +\frac{w_{liq,i} }{\rho _{liq} } \right) . @@ -1186,7 +1182,7 @@ saturation (as may occur when ice melts), then the liquid water mass is adjusted to .. math:: - :label: 12.63) + :label: 12.63 w_{liq,i} =\left(\theta _{sat,i} \Delta z_{i} -\frac{w_{ice,i} }{\rho _{ice} } \right)\rho _{liq} . @@ -1195,7 +1191,7 @@ Otherwise, if excess ice is melting and water in the layer is reset to .. math:: - :label: 12.64) + :label: 12.64 w_{liq,i} = \theta _{sat,i} \rho _{liq} \Delta z_{i} @@ -1213,10 +1209,11 @@ adjusts the minimum resolved snow layer thickness for lake columns as compared to non-lake columns. The value of :math:`z_{lsa}` is chosen to satisfy the CFL condition for the model timestep. By default, :math:`\tilde{s}_{\min }` \ = 1 cm and :math:`s_{\min }` \ = 4 cm. See -Subin et al. (2012a; including Supporting Information) for further -discussion. +:ref:`Subin et al. (2012a; including Supporting Information)` +for further discussion. -The rules for combining and sub-dividing snow layers (section 7.2.7) are +The rules for combining and sub-dividing snow layers (section +:numref:`Snow Layer Combination and Subdivision`) are adjusted for lakes to maintain minimum thicknesses of :math:`s_{\min }` and to increase all target layer thicknesses by :math:`z_{lsa}` . The rules for combining layers are modified by simply increasing layer @@ -1234,5 +1231,5 @@ are performed. In rare instances, resolved snow layers may be present over an unfrozen top lake body layer. In this case, the snow layers may be eliminated if -enough heat is present in the top layer to melt the snow: see Subin et -al. (2012a, Supporting Information). +enough heat is present in the top layer to melt the snow: see +:ref:`Subin et al. (2012a, Supporting Information) `. diff --git a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst index c881a2c7c2..f78f464779 100644 --- a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst +++ b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst @@ -4,16 +4,19 @@ Methane Model ================= The representation of processes in the methane biogeochemical model -integrated in CLM [CLM4Me; (Riley et al. 2011a)] is based on several -previously published models (Cao et al. 1996; Petrescu et al. 2010; Tian -et al. 2010; Walter et al. 2001; Wania et al. 2010; Zhang et al. 2002; -Zhuang et al. 2004). Although the model has similarities with these -precursor models, a number of new process representations and +integrated in CLM [CLM4Me; (:ref:`Riley et al. 2011a`)] +is based on several previously published models +(:ref:`Cao et al. 1996`; :ref:`Petrescu et al. 2010`; +:ref:`Tianet al. 2010`; :ref:`Walter et al. 2001`; +:ref:`Wania et al. 2010`; :ref:`Zhang et al. 2002`; +:ref:`Zhuang et al. 2004`). Although the model has similarities +with these precursor models, a number of new process representations and parameterization have been integrated into CLM. -Mechanistically modeling net surface CH\ :sub:`4` emissions -requires representing a complex and interacting series of processes. We -first (section 19.1) describe the overall model structure and flow of +Mechanistically modeling net surface CH\ :sub:`4` emissions requires +representing a complex and interacting series of processes. We first +(section :numref:`Methane Model Structure and Flow`) describe the overall +model structure and flow of information in the CH\ :sub:`4` model, then describe the methods used to represent: CH\ :sub:`4` mass balance; CH\ :sub:`4` production; ebullition; aerenchyma transport; CH\ :sub:`4` @@ -22,6 +25,8 @@ numerical solution, water table interface, etc.; seasonal inundation effects; and impact of seasonal inundation on CH\ :sub:`4` production. +.. _Methane Model Structure and Flow: + Methane Model Structure and Flow ------------------------------------- @@ -36,17 +41,21 @@ fraction; performs a mass balance check; and calculates the average gridcell CH\ :sub:`4` production, oxidation, and exchanges with the atmosphere. +.. _Governing Mass-Balance Relationship: + Governing Mass-Balance Relationship ---------------------------------------- -The model (:numref:`Figure Methane Schematic`) accounts for CH\ :sub:`4` production in -the anaerobic fraction of soil (*P*, mol m\ :sup:`-3` s\ :sup:`-1`), ebullition (*E*, mol m\ :sup:`-3` s\ :sup:`-1`), -aerenchyma transport (*A*, mol m\ :sup:`-3` s\ :sup:`-1`), aqueous and gaseous diffusion (:math:`{F}_{D}`, -mol m\ :sup:`-2` s\ :sup:`-1`), and oxidation (*O*, mol m\ :sup:`-3` s\ :sup:`-1`) via a transient reaction +The model (:numref:`Figure Methane Schematic`) accounts for CH\ :sub:`4` +production in the anaerobic fraction of soil (*P*, mol m\ :sup:`-3` +s\ :sup:`-1`), ebullition (*E*, mol m\ :sup:`-3` s\ :sup:`-1`), +aerenchyma transport (*A*, mol m\ :sup:`-3` s\ :sup:`-1`), aqueous and +gaseous diffusion (:math:`{F}_{D}`, mol m\ :sup:`-2` s\ :sup:`-1`), and +oxidation (*O*, mol m\ :sup:`-3` s\ :sup:`-1`) via a transient reaction diffusion equation: .. math:: - :label: ZEqnNum628535 + :label: 24.1 \frac{\partial \left(RC\right)}{\partial t} =\frac{\partial F_{D} }{\partial z} +P\left(z,t\right)-E\left(z,t\right)-A\left(z,t\right)-O\left(z,t\right) @@ -84,9 +93,12 @@ into the inundated concentration when the inundated fraction increases. Schematic representation of biological and physical processes integrated in CLM that affect the net CH\ :sub:`4` - surface flux (:ref:`Riley et al. 2011a`). (left) Fully inundated portion of a + surface flux (:ref:`Riley et al. 2011a`). (left) + Fully inundated portion of a CLM gridcell and (right) variably saturated portion of a gridcell. +.. _CH4 Production: + CH\ :sub:`4` Production ---------------------------------- @@ -108,25 +120,25 @@ redox potential (:math:`f_{pE}`), and a factor accounting for the seasonal inundation fraction (*S*, described below): .. math:: - :label: ZEqnNum109798 + :label: 24.2 P=R_{H} f_{CH_{4} } f_{T} f_{pH} f_{pE} S. -Here, :math:`f_{CH_{4} }` is the baseline ratio between -CO\ :sub:`2` and CH\ :sub:`4` production (all parameters -values are given in :numref:`Table Methane Parameter descriptions`). Currently, :math:`f_{CH_{4} }` is -modified to account for our assumptions that methanogens may have a +Here, :math:`f_{CH_{4} }` is the baseline ratio between CO\ :sub:`2` +and CH\ :sub:`4` production (all parameters values are given in +:numref:`Table Methane Parameter descriptions`). Currently, :math:`f_{CH_{4} }` +is modified to account for our assumptions that methanogens may have a higher Q\ :math:`{}_{10}` than aerobic decomposers; are not N limited; and do not have a low-moisture limitation. -When the single BGC soil level is used in CLM (Chapter 15), the +When the single BGC soil level is used in CLM (Chapter :numref:`rst_Decomposition`), the temperature factor, :math:`f_{T}` , is set to 0 for temperatures equal to or below freezing, even though CLM allows heterotrophic respiration below freezing. However, if the vertically resolved BGC soil column is used, CH\ :sub:`4` production continues below freezing because liquid water stress limits decomposition. The base temperature for the -:math:`{Q}_{10}` factor, :math:`{T}_{B}`, is 22\ :sup:`o` C and effectively modified the base -:math:`f_{CH_{4}}` value. +:math:`{Q}_{10}` factor, :math:`{T}_{B}`, is 22\ :sup:`o` C and effectively +modified the base :math:`f_{CH_{4}}` value. For the single-layer BGC version, :math:`{R}_{H}` is distributed among soil levels by assuming that 50% is associated with the roots @@ -136,10 +148,11 @@ decomposition algorithm). For the vertically resolved BGC version, the prognosed distribution of :math:`{R}_{H}` is used to estimate CH\ :sub:`4` production. The factor :math:`f_{pH}` is nominally set to 1, although a static -spatial map of *pH* can be used to determine this factor (Dunfield et al. 1993) by applying: +spatial map of *pH* can be used to determine this factor +(:ref:`Dunfield et al. 1993`) by applying: .. math:: - :label: 24.3) + :label: 24.3 f_{pH} =10^{-0.2235pH^{2} +2.7727pH-8.6} . @@ -156,7 +169,7 @@ anoxic microsites above the water table, we apply the Arah and Stephen (1998) estimate of anaerobic fraction: .. math:: - :label: 24.4) + :label: 24.4 \varphi =\frac{1}{1+\eta C_{O_{2} } } . @@ -195,7 +208,7 @@ O\ :sub:`2` mass balance solution. +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ | | :math:`{C}_{e,min}` | 0.15 | NA | - | CH\ :sub:`4` concentration to end ebullition | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ - | Diffusion | :math:`f_{D_{0} }` | 1 | 1, 10 | m\ :sup:`2` s\ :sup:`-1` | Diffusion coefficient multiplier (Table 19.2) | + | Diffusion | :math:`f_{D_{0} }` | 1 | 1, 10 | m\ :sup:`2` s\ :sup:`-1` | Diffusion coefficient multiplier (Table 24.2) | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ | Aerenchyma | *p* | 0.3 | NA | - | Grass aerenchyma porosity | +--------------+----------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------+---------------------------------------------+--------------------------------------------------------------------------------------------+ @@ -220,20 +233,21 @@ Briefly, the simulated aqueous CH\ :sub:`4` concentration in each soil level is used to estimate the expected equilibrium gaseous partial pressure (:math:`C_{e}` ), as a function of temperature and depth below the water table, by first estimating the Henry’s law partitioning -coefficient (:math:`k_{h}^{C}` ) by the method described in Wania et al. (2010): +coefficient (:math:`k_{h}^{C}` ) by the method described in +:ref:`Wania et al. (2010)`: .. math:: - :label: 24.5) + :label: 24.5 \log \left(\frac{1}{k_{H} } \right)=\log k_{H}^{s} -\frac{1}{C_{H} } \left(\frac{1}{T} -\frac{1}{T^{s} } \right) .. math:: - :label: ZEqnNum493232 + :label: 24.6 k_{h}^{C} =Tk_{H} R_{g} .. math:: - :label: 24.7) + :label: 24.7 C_{e} =\frac{C_{w} R_{g} T}{\theta _{s} k_{H}^{C} p} @@ -248,11 +262,14 @@ ponding (if applicable). When the CH\ :sub:`4` partial pressure exceeds 15% of the local pressure (Baird et al. 2004; Strack et al. 2006; Wania et al. 2010), bubbling occurs to remove CH\ :sub:`4` to below this value, modified by the fraction of CH\ :sub:`4` in -the bubbles [taken as 57%; (Kellner et al. 2006; Wania et al. 2010)]. +the bubbles [taken as 57%; (:ref:`Kellner et al. 2006`; +:ref:`Wania et al. 2010`)]. Bubbles are immediately added to the surface flux for saturated columns and are placed immediately above the water table interface in unsaturated columns. +.. _Aerenchyma Transport: + Aerenchyma Transport ------------------------- @@ -265,7 +282,7 @@ also occur, but we did not include that mechanism in the current model. The diffusive transport through aerenchyma (*A*, mol m\ :sup:`-2` s\ :sup:`-1`) from each soil layer is represented in the model as: .. math:: - :label: ZEqnNum158128 + :label: 24.8 A=\frac{C\left(z\right)-C_{a} }{{\raise0.7ex\hbox{$ r_{L} z $}\!\mathord{\left/ {\vphantom {r_{L} z D}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ D $}} +r_{a} } pT\rho _{r} , @@ -278,21 +295,20 @@ height (s m:sup:`-1`); and :math:`\rho _{r}` is the rooting density as a function of depth (-). The gaseous concentration is calculated with Henry’s law as described in equation . -Based on the ranges reported in Colmer (2003), we have chosen baseline -aerenchyma porosity values of 0.3 for grass and crop PFTs and 0.1 for +Based on the ranges reported in :ref:`Colmer (2003)`, we have chosen +baseline aerenchyma porosity values of 0.3 for grass and crop PFTs and 0.1 for tree and shrub PFTs. The aerenchyma area varies over the course of the growing season; we parameterize this dependency using the simulated leaf -area index *L* (m:sup:`2` m\ :sup:`-2`), as in Wania et al. -(2010): +area index *L* (m:sup:`2` m\ :sup:`-2`), as in :ref:`Wania et al. 2010`: .. math:: - :label: 24.9) + :label: 24.9 T=\frac{f_{N} N_{a} L}{0.22} \pi R^{2} . Here :math:`N_{a}` is annual net primary production (NPP, mol m\ :sup:`-2` s\ :sup:`-1`); *R* is the aerenchyma radius -(2.9:math:`\times`\ 10\ :sup:`-3` m); :math:`{f}_{N}` is the +(2.9 :math:`\times`\ 10\ :sup:`-3` m); :math:`{f}_{N}` is the belowground fraction of annual NPP; and the 0.22 factor represents the amount of C per tiller. O\ :sub:`2` can also diffuse in from the atmosphere to the soil layer via the reverse of the same pathway, with @@ -308,19 +324,21 @@ and the CLM predicted transpiration (:math:`F_{T}` ) for each PFT, assuming that no methane was oxidized inside the plant tissue: .. math:: - :label: 24.10) + :label: 24.10 F_{CH_{4} -T} =\sum _{j}\rho _{r,j} F_{T} C_{CH_{4} ,j} . +.. _CH4 Oxidation: + CH\ :sub:`4` Oxidation --------------------------------- CLM represents CH\ :sub:`4` oxidation with double Michaelis-Menten -kinetics (Arah and Stephen 1998; Segers 1998), dependent on both the -gaseous CH\ :sub:`4` and O\ :sub:`2` concentrations: +kinetics (:ref:`Arah and Stephen 1998`; :ref:`Segers 1998`), +dependent on both the gaseous CH\ :sub:`4` and O\ :sub:`2` concentrations: .. math:: - :label: 24.11) + :label: 24.11 R_{oxic} =R_{o,\max } \left[\frac{C_{CH_{4} } }{K_{CH_{4} } +C_{CH_{4} } } \right]\left[\frac{C_{O_{2} } }{K_{O_{2} } +C_{O_{2} } } \right]Q_{10} F_{\vartheta } @@ -332,23 +350,31 @@ m\ :sup:`-3` s\ :sup:`-1`); and :math:`{Q}_{10}` specifies the temperature dependence of the reaction with a base temperature set to 12 :sup:`o` C. The soil moisture limitation factor :math:`F_{\theta }` is applied above the water table to -represent water stress for methanotrophs. Based on the data in Schnell -and King (1996), we take :math:`F_{\theta } = {e}^{-P/{P}_{c}}`, where *P* is the soil moisture potential and -:math:`{P}_{c} = -2.4 \times {10}^{5}` mm. +represent water stress for methanotrophs. Based on the data in +:ref:`Schnell and King (1996)`, we take +:math:`F_{\theta } = {e}^{-P/{P}_{c}}`, where *P* is the soil moisture +potential and :math:`{P}_{c} = -2.4 \times {10}^{5}` mm. + +.. _Reactive Transport Solution: Reactive Transport Solution -------------------------------- The solution to equation is solved in several sequential steps: resolve competition for CH\ :sub:`4` and O\ :sub:`2` (section -19.7.1); add the ebullition flux into the layer directly above the water +:numref:`Competition for CH4and O2`); add the ebullition flux into the +layer directly above the water table or into the atmosphere; calculate the overall CH\ :sub:`4` or O\ :sub:`2` source term based on production, aerenchyma transport, ebullition, and oxidation; establish boundary conditions, including surface conductance to account for snow, ponding, and -turbulent conductances and bottom flux condition (section 19.7.2); -calculate diffusivity (section 19.7.3); and solve the resulting mass -balance using a tridiagonal solver (section 19.7.5). +turbulent conductances and bottom flux condition +(section :numref:`CH4 and O2 Source Terms`); calculate diffusivity +(section :numref:`Aqueous and Gaseous Diffusion`); and solve the resulting +mass balance using a tridiagonal solver (section +:numref:`Crank-Nicholson Solution Methane`). + +.. _Competition for CH4and O2: Competition for CH\ :sub:`4` and O\ :sub:`2` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -371,7 +397,9 @@ the concentrations are reset to zero; if it occurs for CH\ :sub:`4`, the surface flux is adjusted and the concentration is set to zero if the adjustment is not too large. -19.7.2 CH\ :sub:`4` and O\ :sub:`2` Source Terms +.. _CH4 and O2 Source Terms: + +CH\ :sub:`4` and O\ :sub:`2` Source Terms ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The overall CH\ :sub:`4` net source term consists of production, @@ -383,12 +411,17 @@ source term consists of O\ :sub:`2` losses from methanotrophy, SOM decomposition, and autotrophic respiration, and an O\ :sub:`2` source through aerenchyma. -19.7.3 Aqueous and Gaseous Diffusion +.. _Aqueous and Gaseous Diffusion: + +Aqueous and Gaseous Diffusion ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ For gaseous diffusion, we adopted the temperature dependence of molecular free-air diffusion coefficients (:math:`{D}_{0}` -(m:sup:`2` s\ :sup:`-1`)) as described by Lerman et al. (1979) and applied by Wania et al. (2010) (:numref:`Table Temperature dependence of aqueous and gaseous diffusion`). +(m:sup:`2` s\ :sup:`-1`)) as described by +:ref:`Lerman (1979) ` and applied by +:ref:`Wania et al. (2010)` +(:numref:`Table Temperature dependence of aqueous and gaseous diffusion`). .. _Table Temperature dependence of aqueous and gaseous diffusion: @@ -403,26 +436,26 @@ molecular free-air diffusion coefficients (:math:`{D}_{0}` +----------------------------------------------------------+----------------------------------------------------------+--------------------------------------------------------+ Gaseous diffusivity in soils also depends on the molecular diffusivity, -soil structure, porosity, and organic matter content. Moldrup et al. -(2003), using observations across a range of unsaturated mineral soils, -showed that the relationship between effective diffusivity -(:math:`D_{e}` (m:sup:`2` s\ :sup:`-1`)) and soil +soil structure, porosity, and organic matter content. +:ref:`Moldrup et al. (2003)`, using observations across a +range of unsaturated mineral soils, showed that the relationship between +effective diffusivity (:math:`D_{e}` (m:sup:`2` s\ :sup:`-1`)) and soil properties can be represented as: .. math:: - :label: ZEqnNum730978 + :label: 24.12 D_{e} =D_{0} \theta _{a}^{2} \left(\frac{\theta _{a} }{\theta _{s} } \right)^{{\raise0.7ex\hbox{$ 3 $}\!\mathord{\left/ {\vphantom {3 b}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ b $}} } , where :math:`\theta _{a}` and :math:`\theta _{s}` are the air-filled and total (saturated water-filled) porosities (-), respectively, and *b* -is the slope of the water retention curve (-). However, Iiyama and -Hasegawa (2005) have shown that the original Millington-Quirk -(Millington and Quirk 1961) relationship matched measurements more -closely in unsaturated peat soils: +is the slope of the water retention curve (-). However, :ref:`Iiyama and +Hasegawa (2005)` have shown that the original Millington-Quirk +(:ref:`Millington and Quirk 1961`) relationship matched +measurements more closely in unsaturated peat soils: .. math:: - :label: ZEqnNum437147 + :label: 24.13 D_{e} =D_{0} \frac{\theta _{a} ^{{\raise0.7ex\hbox{$ 10 $}\!\mathord{\left/ {\vphantom {10 3}} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ 3 $}} } }{\theta _{s} ^{2} } @@ -431,24 +464,27 @@ and equation for soils with more than 130 kg m\ :sup:`-3` organic matter content. A linear interpolation between these two limits is applied for soils with SOM content below 130 kg m\ :sup:`-3`. For aqueous diffusion in the saturated part of the soil column, we applied -(Moldrup et al. 2003): +(:ref:`Moldrup et al. (2003)`): .. math:: - :label: 24.14) + :label: 24.14 D_{e} =D_{0} \theta _{s} ^{2} . To simplify the solution, we assumed that gaseous diffusion dominates above the water table interface and aqueous diffusion below the water table interface. Descriptions, baseline values, and dimensions for -parameters specific to the CH\ :sub:`4` model are given in Table -19.1. For freezing or frozen soils below the water table, diffusion is -limited to the remaining liquid (CLM allows for some freezing point -depression), and the diffusion coefficients are scaled by the +parameters specific to the CH\ :sub:`4` model are given in +:numref:`Table Methane Parameter descriptions`. For freezing or frozen +soils below the water table, diffusion is limited to the remaining +liquid (CLM allows for some freezing point depression), and the diffusion +coefficients are scaled by the volume-fraction of liquid. For unsaturated soils, Henry’s law equilibrium is assumed at the interface with the water table. -19.7.4 Boundary Conditions +.. _Boundary Conditions: + +Boundary Conditions ^^^^^^^^^^^^^^^^^^^^^^^^^^ We assume the CH\ :sub:`4` and O\ :sub:`2` surface fluxes @@ -458,7 +494,8 @@ the gaseous concentration in the first soil layer (unsaturated soils) or in equilibrium with the water (saturated soil\ :math:`w\left(C_{1}^{n} -C_{a} \right)` and :math:`w\left(C_{1}^{n+1} -C_{a} \right)` for the fully explicit and -fully implicit cases, respectively (however, see Tang and Riley (2013) +fully implicit cases, respectively (however, see +:ref:`Tang and Riley (2013)` for a more complete representation of this process). Here, *w* is the surface boundary layer conductance as calculated in the existing CLM surface latent heat calculations. If the top layer is not fully @@ -470,7 +507,7 @@ and if the top layer is saturated, this term is replaced with where :math:`{K}_{H}` is the Henry’s law equilibrium constant. When snow is present, a resistance is added to account for diffusion -through the snow based on the Millington-Quirk expression (equation ) +through the snow based on the Millington-Quirk expression :eq:`24.13` and CLM’s prediction of the liquid water, ice, and air fractions of each snow layer. When the soil is ponded, the diffusivity is assumed to be that of methane in pure water, and the resistance as the ratio of the @@ -478,15 +515,18 @@ ponding depth to diffusivity. The overall conductance is taken as the series combination of surface, snow, and ponding resistances. We assume a zero flux gradient at the bottom of the soil column. +.. _Crank-Nicholson Solution Methane: + Crank-Nicholson Solution ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Equation is solved using a Crank-Nicholson solution (Press et al. 1992), +Equation is solved using a Crank-Nicholson solution +(:ref:`Press et al. 1992`), which combines fully explicit and implicit representations of the mass balance. The fully explicit decomposition of equation can be written as .. math:: - :label: ZEqnNum395184 + :label: 24.15 \frac{R_{j}^{n+1} C_{j}^{n+1} -R_{j}^{n} C_{j}^{n} }{\Delta t} =\frac{1}{\Delta x_{j} } \left[\frac{D_{p1}^{n} }{\Delta x_{p1}^{} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{n} }{\Delta x_{m1}^{} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+S_{j}^{n} , @@ -506,14 +546,14 @@ Using an average of the fully implicit and fully explicit relationships gives: .. math:: - :label: ZEqnNum463314 + :label: 24.16 \begin{array}{l} {-\frac{1}{2\Delta x_{j} } \frac{D_{m1}^{} }{\Delta x_{m1}^{} } C_{j-1}^{n+1} +\left[\frac{R_{j}^{n+1} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left(\frac{D_{p1}^{} }{\Delta x_{p1}^{} } +\frac{D_{m1}^{} }{\Delta x_{m1}^{} } \right)\right]C_{j}^{n+1} -\frac{1}{2\Delta x_{j} } \frac{D_{p1}^{} }{\Delta x_{p1}^{} } C_{j+1}^{n+1} =} \\ {\frac{R_{j}^{n} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1}^{} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1}^{} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right]} \end{array}, Equation is solved with a standard tridiagonal solver, i.e.: .. math:: - :label: 24.17) + :label: 24.17 aC_{j-1}^{n+1} +bC_{j}^{n+1} +cC_{j+1}^{n+1} =r, @@ -524,6 +564,8 @@ the diffusion solution and the time-varying aggregation over inundated and non-inundated areas strictly conserves methane molecules (except for production minus consumption) and carbon atoms. +.. _Interface between water table and unsaturated zone: + Interface between water table and unsaturated zone ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -538,7 +580,7 @@ soil element above the interface: .. math:: b=\left[\frac{R_{j}^{n+1} }{\Delta t} +\frac{1}{2\Delta x_{j} } \left(K_{H} \frac{D_{p1}^{} }{\Delta x_{p1} } +\frac{D_{m1}^{} }{\Delta x_{m1} } \right)\right] .. math:: - :label: 24.18) + :label: 24.18 r=\frac{R_{j}^{n} }{\Delta t} C_{j}^{n} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1} } \left(C_{j+1}^{n} -K_{H} C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1} } \left(C_{j}^{n} -C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right] @@ -549,18 +591,20 @@ and the soil element below the interface: .. math:: a=-K_{H} \frac{1}{2\Delta x_{j} } \frac{D_{m1}^{} }{\Delta x_{m1} } .. math:: - :label: 24.19) + :label: 24.19 r=\frac{R_{j}^{n} }{\Delta t} +C_{j}^{n} +\frac{1}{2\Delta x_{j} } \left[\frac{D_{p1}^{} }{\Delta x_{p1} } \left(C_{j+1}^{n} -C_{j}^{n} \right)-\frac{D_{m1}^{} }{\Delta x_{m1} } \left(C_{j}^{n} -K_{H} C_{j-1}^{n} \right)\right]+\frac{1}{2} \left[S_{j}^{n} +S_{j}^{n+1} \right] +.. _Inundated Fraction Prediction: + Inundated Fraction Prediction ---------------------------------- We developed a simplified dynamic representation of spatial inundation -based on recent work by Prigent et al. (2007), who described a +based on recent work by :ref:`Prigent et al. (2007)`, who described a multi-satellite approach to estimate the global monthly inundated fraction (:math:`{F}_{i}`) over an equal area grid -(0.25:math:`\circ`\ :math:`\times`\ 0.25\ :math:`\circ` at the equator) +(0.25 :math:`\circ` \ :math:`\times`\ 0.25\ :math:`\circ` at the equator) from 1993 - 2000. They suggested that the IGBP estimate for inundation could be used as a measure of sensitivity of their detection approach at low inundation. We therefore used the sum of their satellite-derived @@ -572,7 +616,7 @@ grid cell in a simple model based on simulated water table depth (:math:`{z}_{w}`) and surface runoff (:math:`{Q}_{r}` (mm s\ :sup:`-1`)): .. math:: - :label: 24.20) + :label: 24.20 f_{s} =P_{1} e^{{\raise0.7ex\hbox{$ -z_{w} $}\!\mathord{\left/ {\vphantom {-z_{w} p_{2} }} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ p_{2} $}} } +p_{3} Q_{r} . @@ -582,15 +626,18 @@ coarser simulations. We expect that ongoing work in the hydrology submodel of CLM will alleviate the need for this crude simplification of inundated fraction in future model versions. +.. _Seasonal Inundation: + Seasonal Inundation ------------------------ We have developed a simplified scaling factor to mimic the impact of seasonal inundation on CH\ :sub:`4` production (see appendix B in -Riley et al. (2011a) for a discussion of this simplified expression): +:ref:`Riley et al. (2011a)` for a discussion of this +simplified expression): .. math:: - :label: 24.21) + :label: 24.21 S=\frac{\beta \left(f-\bar{f}\right)+\bar{f}}{f} ,S\le 1. diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 5c278d1e0f..dfe1f67abb 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1555,7 +1555,7 @@ Schnell, S. and King, G.M., 1996. Responses of methanotrophic activity in soils and cultures to water stress. Applied and Environmental Microbiology 62:3203-3209. -.. _Segers, R., 1998. Methane production and methane consumption: a review +.. _Segers1998: Segers, R., 1998. Methane production and methane consumption: a review of processes underlying wetland methane fluxes. Biogeochemistry From 89a87adda6bdd1ac608ae1ad9b594ee9752d85f4 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 31 May 2017 14:01:49 -0600 Subject: [PATCH 0034/1973] update Dust chapter --- .../tech_note/Dust/CLM50_Tech_Note_Dust.rst | 106 ++++++++++-------- .../tech_note/Urban/CLM50_Tech_Note_Urban.rst | 6 +- 2 files changed, 62 insertions(+), 50 deletions(-) diff --git a/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst b/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst index 2b3bfa6dd7..c40ac583f7 100644 --- a/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst +++ b/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst @@ -6,45 +6,48 @@ Dust Model Atmospheric dust is mobilized from the land by wind in the CLM. The most important factors determining soil erodibility and dust emission include the wind friction speed, the vegetation cover, and the soil moisture. -The CLM dust mobilization scheme (Mahowald et al. ** 2006) accounts for -these factors based on the DEAD (Dust Entrainment and Deposition) model -of Zender et al. (2003). Please refer to the Zender et al. ** (2003) -article for additional information regarding the equations presented in -this section. +The CLM dust mobilization scheme (:ref:`Mahowald et al. 2006`) +accounts for these factors based on the DEAD (Dust Entrainment and Deposition) +model of :ref:`Zender et al. (2003)`. Please refer to the +:ref:`Zender et al. (2003)` article for additional +information regarding the equations presented in this section. -The total vertical mass flux of dust, :math:`F_{j}` (kg m\ :sup:`-2` s\ :sup:`-1`), from the ground into transport -bin :math:`j` is given by +The total vertical mass flux of dust, :math:`F_{j}` +(kg m\ :sup:`-2` s\ :sup:`-1`), from the ground into transport bin +:math:`j` is given by .. math:: - :label: ZEqnNum146272 + :label: 29.1 F_{j} =TSf_{m} \alpha Q_{s} \sum _{i=1}^{I}M_{i,j} where :math:`T` is a global factor that compensates for the DEAD model’s sensitivity to horizontal and temporal resolution and equals 5 x 10\ :sup:`-4` in the CLM instead of 7 x 10\ :sup:`-4` in -Zender et al. (2003). :math:`S` is the source erodibility factor set to -1 in the CLM and serves as a place holder at this time. +:ref:`Zender et al. (2003)`. :math:`S` is the source +erodibility factor set to 1 in the CLM and serves as a place holder +at this time. The grid cell fraction of exposed bare soil suitable for dust mobilization :math:`f_{m}` is given by .. math:: - :label: 29.2) + :label: 29.2 f_{m} =\left(1-f_{lake} -f_{wetl} \right)\left(1-f_{sno} \right)\left(1-f_{v} \right)\frac{w_{liq,1} }{w_{liq,1} +w_{ice,1} } -where ** :math:`f_{lake}` and ** :math:`f_{wetl}` and :math:`f_{sno}` -are the CLM grid cell fractions of lake and wetland (section 2.2.3) and -snow cover (section 7.2.1), all ranging from zero to one. Not mentioned -by Zender et al. (2003), :math:`w_{liq,\, 1}` and +where :math:`f_{lake}` and :math:`f_{wetl}` and :math:`f_{sno}` +are the CLM grid cell fractions of lake and wetland (section +:numref:`Surface Data`) and snow cover (section +:numref:`Snow Covered Area Fraction`), all ranging from zero to one. Not mentioned +by :ref:`Zender et al. (2003)`, :math:`w_{liq,\, 1}` and :math:`{}_{w_{ice,\, 1} }` are the CLM top soil layer liquid water and ice contents (mm) entered as a ratio expressing the decreasing ability of dust to mobilize from increasingly frozen soil. The grid cell fraction of vegetation cover,\ :math:`{}_{f_{v} }`, is defined as .. math:: - :label: ZEqnNum242183 + :label: 29.3 0\le f_{v} =\frac{L+S}{\left(L+S\right)_{t} } \le 1{\rm \; \; \; \; where\; }\left(L+S\right)_{t} =0.3{\rm \; m}^{2} {\rm m}^{-2} @@ -52,34 +55,38 @@ where equation applies only for dust mobilization and is not related to the plant functional type fractions prescribed from the CLM input data or simulated by the CLM dynamic vegetation model (Chapter 22). :math:`L` and :math:`S` are the CLM leaf and stem area index values -(m:sup:`2` m\ :sup:`-2`) averaged at the land unit level so +(m :sup:`2` m\ :sup:`-2`) averaged at the land unit level so as to include all the pfts and the bare ground present in a vegetated land unit. :math:`L` and :math:`S` may be prescribed from the CLM -input data (section 2.1.4) or simulated by the CLM biogeochemistry model -(Chapter 13). +input data (section :numref:`Phenology and vegetation burial by snow`) +or simulated by the CLM biogeochemistry model (Chapter +:numref:`rst_Vegetation Phenology and Turnover`). -The sandblasting mass efficiency :math:`\alpha` (m:sup:`-1`) is +The sandblasting mass efficiency :math:`\alpha` (m :sup:`-1`) is calculated as .. math:: - :label: 29.4) + :label: 29.4 \alpha =100e^{\left(13.4M_{clay} -6.0\right)\ln 10} {\rm \; \; }\left\{\begin{array}{l} {M_{clay} =\% clay\times 0.01{\rm \; \; \; 0}\le \% clay\le 20} \\ {M_{clay} =20\times 0.01{\rm \; \; \; \; \; \; \; \; 20<\% }clay\le 100} \end{array}\right. where :math:`M_{clay}` is the mass fraction of clay particles in the soil and %clay is determined from the surface dataset -(section 2.2.3). :math:`M_{clay} =0` corresponds to sand and +(section :numref:`Surface Data`). :math:`M_{clay} =0` corresponds to sand and :math:`M_{clay} =0.2` to sandy loam. :math:`Q_{s}` is the total horizontally saltating mass flux (kg -m\ :sup:`-1` s\ :sup:`-1`) of “large” particles (Table -24.1), also referred to as the vertically integrated streamwise mass -flux +m\ :sup:`-1` s\ :sup:`-1`) of “large” particles (:numref:`Table Dust Mass fraction`), +also referred to as the vertically integrated streamwise mass flux .. math:: - :label: ZEqnNum832592 + :label: 29.5 - Q_{s} =\left\{\begin{array}{l} {\frac{c_{s} \rho _{atm} u_{*s}^{3} }{g} \left(1-\frac{u_{*t} }{u_{*s} } \right)\left(1+\frac{u_{*t} }{u_{*s} } \right)^{2} {\rm \; }\qquad {\rm for\; }u_{*t} w_{t} } \end{array}\right. where .. math:: - :label: 29.8) + :label: 29.8 w_{t} =a\left(0.17M_{clay} +0.14M_{clay}^{2} \right){\rm \; \; \; \; \; \; 0}\le M_{clay} =\% clay\times 0.01\le 1 and .. math:: - :label: 29.9) + :label: 29.9 w=\frac{\theta _{1} \rho _{liq} }{\rho _{d,1} } where :math:`a=M_{clay}^{-1}` for tuning purposes, :math:`\theta _{1}` is the volumetric soil moisture in the top soil -layer (m:math:`{}^{3 }`\ m\ :sup:`-3`) (section 7.4), +layer (m :math:`{}^{3 }`\ m\ :sup:`-3`) (section :numref:`Soil Water`), :math:`\rho _{liq}` is the density of liquid water (kg -m\ :sup:`-3`) (:numref:`Table Physical constants`), and :math:`\rho _{d,\, 1}` is the bulk -density of soil in the top soil layer (kg m\ :sup:`-3`) defined as -in section 6.3 rather than as in Zender et al. (2003). +m\ :sup:`-3`) (:numref:`Table Physical constants`), and :math:`\rho _{d,\, 1}` +is the bulk density of soil in the top soil layer (kg m\ :sup:`-3`) +defined as in section :numref:`Soil and Snow Thermal Properties` +rather than as in :ref:`Zender et al. (2003)`. :math:`Re_{*t}^{f}` from equation is the threshold friction Reynolds factor .. math:: - :label: 29.10) + :label: 29.10 Re_{*t}^{f} =\left\{\begin{array}{l} {\frac{0.1291^{2} }{-1+1.928Re_{*t} } {\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; 0.03}\le Re_{*t} \le 10} \\ {0.12^{2} \left(1-0.0858e^{-0.0617(Re_{*t} -10)} \right)^{2} {\rm \; for\; }Re_{*t} >10} \end{array}\right. @@ -135,28 +143,32 @@ and :math:`Re_{*t}` is the threshold friction Reynolds number approximation for optimally sized particles .. math:: - :label: 29.11) + :label: 29.11 Re_{*t} =0.38+1331\left(100D_{osp} \right)^{1.56} -In equation , :math:`u_{*s}` ** is defined as the wind friction speed -(m s\ :sup:`-1`) accounting for the Owen effect (Owen 1964) +In :eq:`29.5` , :math:`u_{*s}` is defined as the wind friction speed +(m s\ :sup:`-1`) accounting for the Owen effect (:ref:`Owen 1964`) .. math:: - :label: 29.12) + :label: 29.12 - u_{\*s} =\left\{\begin{array}{l} {u_{\*} {\rm \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; \; for\; }U_{10} ` but here for 10 m above the ground, and :math:`U_{10,\, t}` is the threshold wind speed at 10 m (m s\ :sup:`-1`) .. math:: - :label: 29.13) + :label: 29.13 U_{10,t} =u_{*t} \frac{U_{10} }{u_{*} } @@ -165,7 +177,7 @@ In equation we sum :math:`M_{i,\, j}` over :math:`I=3` source modes mode :math:`i` carried in each of *:math:`J=4`* transport bins :math:`j` .. math:: - :label: 29.14) + :label: 29.14 M_{i,j} =\frac{m_{i} }{2} \left[{\rm erf}\left(\frac{\ln {\textstyle\frac{D_{j,\max } }{\tilde{D}_{v,i} }} }{\sqrt{2} \ln \sigma _{g,i} } \right)-{\rm erf}\left(\frac{\ln {\textstyle\frac{D_{j,\min } }{\tilde{D}_{v,i} }} }{\sqrt{2} \ln \sigma _{g,i} } \right)\right] @@ -174,7 +186,7 @@ where :math:`m_{i}` , :math:`\tilde{D}_{v,\, i}` , and and geometric standard deviation assigned to each particle source mode :math:`i` (:numref:`Table Dust Mass fraction`), while :math:`D_{j,\, \min }` and :math:`D_{j,\, \max }` are the minimum and maximum diameters (m) in -each transport bin :math:`j` ** (:numref:`Table Dust Minimum and maximum particle diameters`). +each transport bin :math:`j` (:numref:`Table Dust Minimum and maximum particle diameters`). .. _Table Dust Mass fraction: diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index 136272973d..4a6192aacb 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -18,7 +18,7 @@ gridcell according to density class. The urban landunit is based on the “urban canyon” concept of :ref:`Oke (1987) ` in which the canyon geometry is described by building height (:math:`H`) and street width (:math:`W`) -(:numref:`Figure schematic representation of urban`). The canyon system +(:numref:`Figure schematic representation of the urban landunit`). The canyon system consists of roofs, walls, and canyon floor. Walls are further divided into shaded and sunlit components. The canyon floor is divided into pervious (e.g., to represent residential @@ -28,7 +28,7 @@ pervious fraction; instead evaporation is parameterized by a simplified bulk scheme. Each of the five urban surfaces is treated as a column within the -landunit (:numref:`Figure schematic representation of urban`). +landunit (:numref:`Figure schematic representation of the urban landunit`). Radiation parameterizations account for trapping of solar and longwave radiation inside the canyon. Momentum fluxes are determined for the urban landunit using a roughness length and @@ -106,7 +106,7 @@ resolution. .. Figure 12.1. Schematic representation of the urban land unit -.. _Figure schematic representation of the urban land unit: +.. _Figure schematic representation of the urban landunit: .. figure:: image1.png From bcf269c2f8755f38a334dd00e4dad2c54b8846d7 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 1 Jun 2017 09:27:10 -0600 Subject: [PATCH 0035/1973] Update Chapter 6 --- .../CLM50_Tech_Note_Introduction.rst | 4 +- .../References/CLM50_Tech_Note_References.rst | 2 + ...CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 371 +++++++++++------- 3 files changed, 230 insertions(+), 147 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 9e6c3f2fd0..29892825d8 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -1,4 +1,4 @@ -**NCAR/TN-503+STR** +g**NCAR/TN-503+STR** **NCAR Technical Note** @@ -138,7 +138,7 @@ Jinyun Tang, Zong-Liang Yang** - :numref:`three layer snow pack` Example of three layer snow pack (snl=-3). -- :numref:`Figure Schematic representation of the urban land unit` Schematic representation of the urban land unit. +- :numref:`Figure Schematic representation of the urban landunit` Schematic representation of the urban land unit. - :numref:`Figure Schematic of urban and atmospheric model coupling` Schematic of urban and atmospheric model coupling. diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index dfe1f67abb..dfb4b81d9c 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1225,6 +1225,8 @@ Niu, G.-Y., Yang, Z.-L., Dickinson, R.E., and Gulden, L.E. 2005. A simple TOPMODEL-based runoff parameterization (SIMTOP) for use in global climate models. J. Geophys. Res. 110:D21106. DOI:10.1029/2005JD006111. +.. _NiuYang2006: + Niu, G.-Y., and Yang, Z.-L. 2006. Effects of frozen soil on snowmelt runoff and soil water storage at a continental scale. J. Hydrometeor. 7:937-952. diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst index 0a7b941359..780ccb4752 100644 --- a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst @@ -6,7 +6,7 @@ Soil and Snow Temperatures The first law of heat conduction is .. math:: - :label: 6.1) + :label: 6.1 F=-\lambda \nabla T @@ -17,7 +17,7 @@ K\ :sup:`-1`), and :math:`\nabla T` is the spatial gradient of temperature (K m\ :sup:`-1`). In one-dimensional form .. math:: - :label: ZEqnNum105915 + :label: 6.2 F_{z} =-\lambda \frac{\partial T}{\partial z} @@ -27,7 +27,7 @@ non-steady or transient conditions, the principle of energy conservation in the form of the continuity equation is invoked as .. math:: - :label: ZEqnNum376834 + :label: 6.3 c\frac{\partial T}{\partial t} =-\frac{\partial F_{z} }{\partial z} @@ -37,7 +37,7 @@ Combining equations and yields the second law of heat conduction in one-dimensional form .. math:: - :label: 6.4) + :label: 6.4 c\frac{\partial T}{\partial t} =\frac{\partial }{\partial z} \left[\lambda \frac{\partial T}{\partial z} \right]. @@ -55,8 +55,9 @@ phase change and then readjusted for phase change (section :numref:`Phase Change Numerical Solution ---------------------- -The soil column is discretized into 25 layers (section :numref:`Vertical Discretization`) -where :math:`N_{levgrnd} = 25` is the number of soil layers (:numref:`Table Soil layer structure`). +The soil column is discretized into 25 layers (section +:numref:`Vertical Discretization`) where :math:`N_{levgrnd} = 25` is the +number of soil layers (:numref:`Table Soil layer structure`). The overlying snow pack is modeled with up to five layers depending on the total snow depth. The layers from top to bottom are indexed in the @@ -68,35 +69,88 @@ is the negative of the number of snow layers. The number of snow layers and the thickness of each layer is a function of snow depth :math:`z_{sno}` (m) as follows. -.. math:: \left\{\begin{array}{l} {snl=-1} \\ {\Delta z_{0} =z_{sno} \qquad {\rm for\; 0.01}\le {\rm z}_{{\rm sno}} \le 0.03} \end{array}\right\}, +.. math:: -.. math:: \left\{\begin{array}{l} {snl=-2} \\ {\Delta z_{-1} ={z_{sno} \mathord{\left/ {\vphantom {z_{sno} 2}} \right. \kern-\nulldelimiterspace} 2} \qquad {\rm for\; 0.03}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.04} \\ {\Delta z_{0} =\Delta z_{-1} } \end{array}\right\}, - -.. math:: \left\{\begin{array}{l} {snl=-2} \\ {\Delta z_{-1} =0.02\qquad {\rm for\; 0.04}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.07} \\ {\Delta z_{0} =z_{sno} -\Delta z_{-1} } \end{array}\right\}, - -.. math:: \left\{\begin{array}{l} {snl=-3} \\ {\Delta z_{-2} =0.02} \\ {\Delta z_{-1} ={\left(z_{sno} -0.02\right)\mathord{\left/ {\vphantom {\left(z_{sno} -0.02\right) 2}} \right. \kern-\nulldelimiterspace} 2} \qquad {\rm for\; 0.07}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.12} \\ {\Delta z_{0} =\Delta z_{-1} } \end{array}\right\}, - -.. math:: \left\{\begin{array}{l} {snl=-3} \\ {\Delta z_{-2} =0.02} \\ {\Delta z_{-1} =0.05\qquad {\rm for\; 0.12}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.18} \\ {\Delta z_{0} =z_{sno} -\Delta z_{-2} -\Delta z_{-1} } \end{array}\right\}, - -.. math:: \left\{\begin{array}{l} {snl=-4} \\ {\Delta z_{-3} =0.02} \\ {\Delta z_{-2} =0.05\qquad {\rm for\; 0.18}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.29} \\ {\Delta z_{-1} ={\left(z_{sno} -\Delta z_{-3} -\Delta z_{-2} \right)\mathord{\left/ {\vphantom {\left(z_{sno} -\Delta z_{-3} -\Delta z_{-2} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \\ {\Delta z_{0} =\Delta z_{-1} } \end{array}\right\}, - -.. math:: \left\{\begin{array}{l} {snl=-4} \\ {\Delta z_{-3} =0.02} \\ {\Delta z_{-2} =0.05\qquad {\rm for\; 0.29}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.41} \\ {\Delta z_{-1} =0.11} \\ {\Delta z_{0} =z_{sno} -\Delta z_{-3} -\Delta z_{-2} -\Delta z_{-1} } \end{array}\right\}, + \begin{array}{lr} -.. math:: \left\{\begin{array}{l} {snl=-5} \\ {\Delta z_{-4} =0.02} \\ {\Delta z_{-3} =0.05\qquad {\rm for\; 0.41}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.64} \\ {\Delta z_{-2} =0.11} \\ {\Delta z_{-1} ={\left(z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} \right)\mathord{\left/ {\vphantom {\left(z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \\ {\Delta z_{0} =\Delta z_{-1} } \end{array}\right\}, + \left\{ \begin{array}{l} + snl=-1 \\ + \Delta z_{0} = z_{sno} + \end{array} \right\} & \qquad {\rm for\; 0.01}\le {\rm z}_{{\rm sno}} \le 0.03 \\ + + \left\{ \begin{array}{l} + snl=-2 \\ + \Delta z_{-1} ={z_{sno} \mathord{\left/ {\vphantom {z_{sno} 2}} \right. \kern-\nulldelimiterspace} 2} \\ + \Delta z_{0} = \Delta z_{-1} + \end{array} \right\} & \qquad {\rm for\; 0.03}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.04 \\ + + \left\{ \begin{array}{l} + snl=-2 \\ + \Delta z_{-1} = 0.02 \\ + \Delta z_{0} = z_{sno} -\Delta z_{-1} + \end{array} \right\} & \qquad {\rm for\; 0.04}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.07 \\ + \left\{ \begin{array}{l} + snl=-3 \\ + \Delta z_{-2} = 0.02 \\ + \Delta z_{-1} = {\left(z_{sno} -0.02\right)\mathord{\left/ {\vphantom {\left(z_{sno} -0.02\right) 2}} \right. \kern-\nulldelimiterspace} 2} \\ + \Delta z_{0} = \Delta z_{-1} + \end{array} \right\} & \qquad {\rm for\; 0.07}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.12 \\ + + \left\{ \begin{array}{l} + snl=-3 \\ + \Delta z_{-2} = 0.02 \\ + \Delta z_{-1} = 0.05 \\ + \Delta z_{0} = z_{sno} -\Delta z_{-2} -\Delta z_{-1} + \end{array} \right\} & \qquad {\rm for\; 0.12}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.18 \\ + + \left\{ \begin{array}{l} + snl=-4 \\ + \Delta z_{-3} = 0.02 \\ + \Delta z_{-2} = 0.05 \\ + \Delta z_{-1} = {\left(z_{sno} -\Delta z_{-3} -\Delta z_{-2} \right)\mathord{\left/ {\vphantom {\left(z_{sno} -\Delta z_{-3} -\Delta z_{-2} \right) 2}} \right. \kern-\nulldelimiterspace} 2} \\ + \Delta z_{0} =\Delta z_{-1} + \end{array} \right\} & \qquad {\rm for\; 0.18}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.29 \\ + + \left\{ \begin{array}{l} + snl=-4 \\ + \Delta z_{-3} = 0.02 \\ + \Delta z_{-2} = 0.05 \\ + \Delta z_{-1} = 0.11 \\ + \Delta z_{0} = z_{sno} -\Delta z_{-3} -\Delta z_{-2} -\Delta z_{-1} + \end{array} \right\} & \qquad {\rm for\; 0.29}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.41 \\ + + \left\{ \begin{array}{l} + snl=-5 \\ + \Delta z_{-4} = 0.02 \\ + \Delta z_{-3} = 0.05 \\ + \Delta z_{-2} = 0.11 \\ + \Delta z_{-1} = {\left(z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} \right)\mathord{\left/ {\vphantom {\left(z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} \right) 2}} \right. \kern-\nulldelimiterspace} 2} \\ + \Delta z_{0} = \Delta z_{-1} + + \end{array} \right\} & \qquad {\rm for\; 0.41}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.64 \\ + + \left\{ \begin{array}{l} + snl=-5 \\ + \Delta z_{-4} = 0.02 \\ + \Delta z_{-3} = 0.05 \\ + \Delta z_{-2} = 0.11 \\ + \Delta z_{-1} = 0.23 \\ + \Delta z_{0} = z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} -\Delta z_{-1} + \end{array} \right\} & \qquad {\rm for\; 0.64}\, {\rm <}\, {\rm z}_{{\rm sno}} -.. math:: \left\{\begin{array}{l} {snl=-5} \\ {\Delta z_{-4} =0.02} \\ {\Delta z_{-3} =0.05\qquad {\rm for\; 0.64}\, {\rm <}\, {\rm z}_{{\rm sno}} } \\ {\Delta z_{-2} =0.11} \\ {\Delta z_{-1} =0.23} \\ {\Delta z_{0} =z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} -\Delta z_{-1} } \end{array}\right\}. + \end{array} The node depths, which are located at the midpoint of the snow layers, and the layer interfaces are both referenced from the soil surface and are defined as negative values .. math:: - :label: 6.8) + :label: 6.8 z_{i} =z_{h,\, i} -0.5\Delta z_{i} \qquad i=snl+1,\ldots ,0 .. math:: - :label: 6.9) + :label: 6.9 z_{h,\, i} =z_{h,\, i+1} -\Delta z_{i+1} \qquad i=snl,\ldots ,-1. @@ -118,7 +172,7 @@ The heat flux :math:`F_{i}` (W m\ :sup:`-2`) from layer :math:`i` to layer :math:`i+1` is .. math:: - :label: ZEqnNum443713 + :label: 6.10 F_{i} =-\lambda \left[z_{h,\, i} \right]\left(\frac{T_{i} -T_{i+1} }{z_{i+1} -z_{i} } \right) @@ -126,7 +180,7 @@ where the thermal conductivity at the interface :math:`\lambda \left[z_{h,\, i} \right]` is .. math:: - :label: ZEqnNum604125 + :label: 6.11 \lambda \left[z_{h,\, i} \right]=\left\{\begin{array}{l} {\frac{\lambda _{i} \lambda _{i+1} \left(z_{i+1} -z_{i} \right)}{\lambda _{i} \left(z_{i+1} -z_{h,\, i} \right)+\lambda _{i+1} \left(z_{h,\, i} -z_{i} \right)} \qquad i=snl+1,\ldots ,N_{levgrnd} -1} \\ {0\qquad i=N_{levgrnd} } \end{array}\right\}. @@ -138,7 +192,7 @@ equals the heat flux from the interface to :math:`i+1` (depth :math:`z_{i+1}` ), i.e., .. math:: - :label: ZEqnNum726244 + :label: 6.12 -\lambda _{i} \frac{T_{i} -T_{m} }{z_{h,\, i} -z_{i} } =-\lambda _{i+1} \frac{T_{m} -T_{i+1} }{z_{i+1} -z_{h,\, i} } @@ -164,7 +218,7 @@ interface of two layers The energy balance for the :math:`i^{th}` layer is .. math:: - :label: 6.13) + :label: 6.13 \frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=-F_{i-1} +F_{i} @@ -176,7 +230,7 @@ method, which combines the explicit method with fluxes evaluated at fluxes evaluated at :math:`n+1` (:math:`F_{i-1}^{n+1} ,F_{i}^{n+1}` ) .. math:: - :label: 6.14) + :label: 6.14 \frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=\alpha \left(-F_{i-1}^{n} +F_{i}^{n} \right)+\left(1-\alpha \right)\left(-F_{i-1}^{n+1} +F_{i}^{n+1} \right) @@ -184,7 +238,7 @@ where :math:`\alpha =0.5`, resulting in a tridiagonal system of equations .. math:: - :label: 6.15) + :label: 6.15 r_{i} =a_{i} T_{i-1}^{n+1} +b_{i} T_{i}^{n+1} +c_{i} T_{i+1}^{n+1} @@ -201,57 +255,57 @@ surface water layer, the heat flux from the overlying atmosphere is .. math:: - :label: 6.16) + :label: 6.16 h^{n+1} =-\alpha F_{i-1}^{n} -\left(1-\alpha \right)F_{i-1}^{n+1} . The energy balance for these layers is then .. math:: - :label: 6.17) + :label: 6.17 \frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=h^{n+1} +\alpha F_{i}^{n} +\left(1-\alpha \right)F_{i}^{n+1} . The heat flux :math:`h` at :math:`n+1` may be approximated as follows .. math:: - :label: 6.18) + :label: 6.18 h^{n+1} =h^{n} +\frac{\partial h}{\partial T_{i} } \left(T_{i}^{n+1} -T_{i}^{n} \right). The resulting equations are then .. math:: - :label: ZEqnNum219926 + :label: 6.19 \begin{array}{rcl} {\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)} & {=} & {h^{n} +\frac{\partial h}{\partial T_{i} } \left(T_{i}^{n+1} -T_{i} \right)} \\ {} & {} & {-\alpha \frac{\lambda \left[z_{h,\, i} \right]\left(T_{i}^{n} -T_{i+1}^{n} \right)}{z_{i+1} -z_{i} } -\left(1-\alpha \right)\frac{\lambda \left[z_{h,\, i} \right]\left(T_{i}^{n+1} -T_{i+1}^{n+1} \right)}{z_{i+1} -z_{i} } } \end{array} For the top snow layer, :math:`i=snl+1`, the coefficients are .. math:: - :label: 6.20) + :label: 6.20 a_{i} =0 .. math:: - :label: 6.21) + :label: 6.21 b_{i} =1+\frac{\Delta t}{c_{i} \Delta z_{i} } \left[\left(1-\alpha \right)\frac{\lambda \left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } -\frac{\partial h}{\partial T_{i} } \right] .. math:: - :label: 6.22) + :label: 6.22 c_{i} =-\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } .. math:: - :label: 6.23) + :label: 6.23 r_{i} =T_{i}^{n} +\frac{\Delta t}{c_{i} \Delta z_{i} } \left[h_{sno} ^{n} -\frac{\partial h}{\partial T_{i} } T_{i}^{n} +\alpha F_{i} \right] where .. math:: - :label: ZEqnNum455578 + :label: 6.24 F_{i} =-\lambda \left[z_{h,\, i} \right]\left(\frac{T_{i}^{n} -T_{i+1}^{n} }{z_{i+1} -z_{i} } \right). @@ -259,67 +313,72 @@ The heat flux into the snow surface from the overlying atmosphere :math:`h` is .. math:: - :label: 6.25) + :label: 6.25 h=\overrightarrow{S}_{sno} -\overrightarrow{L}_{sno} -H_{sno} -\lambda E_{sno} where :math:`\overrightarrow{S}_{sno}` is the solar radiation absorbed -by the top snow layer (section 3.2.1), :math:`\overrightarrow{L}_{sno}` +by the top snow layer (section :numref:`Snow Albedo`), :math:`\overrightarrow{L}_{sno}` is the longwave radiation absorbed by the snow (positive toward the -atmosphere) (section 4.2), :math:`H_{sno}` is the sensible heat flux -from the snow (Chapter 5), and :math:`\lambda E_{sno}` is the latent -heat flux from the snow (Chapter 5). The partial derivative of the heat -flux :math:`h` with respect to temperature is +atmosphere) (section :numref:`Longwave Fluxes`), :math:`H_{sno}` is the +sensible heat flux from the snow (Chapter +:numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), and +:math:`\lambda E_{sno}` is the latent heat flux from the snow (Chapter +:numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`). The partial +derivative of the heat flux :math:`h` with respect to temperature is .. math:: - :label: 6.26) + :label: 6.26 \frac{\partial h}{\partial T_{} } =-\frac{\partial \overrightarrow{L}_{} }{\partial T_{} } -\frac{\partial H_{} }{\partial T_{} } -\frac{\partial \lambda E_{} }{\partial T_{} } where the partial derivative of the net longwave radiation is .. math:: - :label: 6.27) + :label: 6.27 \frac{\partial \overrightarrow{L}_{} }{\partial T_{} } =4\varepsilon _{g} \sigma \left(T_{}^{n} \right)^{3} and the partial derivatives of the sensible and latent heat fluxes are given by equations and for non-vegetated surfaces, and by equations and for vegetated surfaces. :math:`\sigma` is the Stefan-Boltzmann constant -(W m\ :sup:`-2` K\ :sup:`-4`) (Table 2.6) and :math:`\varepsilon _{g}` is the ground emissivity (section 4.2). For -purposes of computing :math:`h` and :math:`\frac{\partial h}{\partial T_{g} }` , the term :math:`\lambda` +(W m\ :sup:`-2` K\ :sup:`-4`) (:numref:`Table Physical Constants`) and +:math:`\varepsilon _{g}` is the ground emissivity (section +:numref:`Longwave Fluxes`). For purposes of computing :math:`h` and +:math:`\frac{\partial h}{\partial T_{g} }` , the term :math:`\lambda` is arbitrarily assumed to be .. math:: - :label: 6.28) + :label: 6.28 \lambda =\left\{\begin{array}{l} {\lambda _{sub} \qquad {\rm if\; }w_{liq,\, snl+1} =0{\rm \; and\; }w_{ice,\, snl+1} >0} \\ {\lambda _{vap} \qquad {\rm otherwise}} \end{array}\right\} where :math:`\lambda _{sub}` and :math:`\lambda _{vap}` are the latent heat of sublimation and vaporization, respectively (J -kg\ :sup:`-1`) (Table 2.6), and :math:`w_{liq,\, snl+1}` and -:math:`w_{ice,\, snl+1}` are the liquid water and ice contents of the -top snow/soil layer, respectively (kg m\ :sup:`-2`) (Chapter 7). +kg\ :sup:`-1`) (:numref:`Table Physical Constants`), and :math:`w_{liq,\, snl+1}` +and :math:`w_{ice,\, snl+1}` are the liquid water and ice contents of the +top snow/soil layer, respectively (kg m\ :sup:`-2`) +(Chapter :numref:`rst_Hydrology`). For the top soil layer, :math:`i=1`, the coefficients are .. math:: - :label: 6.29) + :label: 6.29 a_{i} =-f_{sno} \left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } .. math:: - :label: 6.30) + :label: 6.30 b_{i} =1+\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \left[f_{sno} \frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } +\frac{\lambda \left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \right]-\left(1-f_{sno} \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} .. math:: - :label: 6.31) + :label: 6.31 c_{i} =-\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } .. math:: - :label: 6.32) + :label: 6.32 r_{i} =T_{i}^{n} +\frac{\Delta t}{c_{i} \Delta z_{i} } \left[\left(1-f_{sno} \right)\left(h_{soil} ^{n} -\frac{\partial h}{\partial T_{} } T_{i}^{n} \right)+\alpha \left(F_{i} -f_{sno} F_{i-1} \right)\right] @@ -327,7 +386,7 @@ The heat flux into the soil surface from the overlying atmosphere :math:`h` is .. math:: - :label: 6.33) + :label: 6.33 h=\overrightarrow{S}_{soil} -\overrightarrow{L}_{soil} -H_{soil} -\lambda E_{soil} @@ -345,13 +404,13 @@ for diurnal heating. The top layer thickness for :math:`i=snl+1` is given by .. math:: - :label: 6.34) + :label: 6.34 \Delta z_{i*} =0.5\left[z_{i} -z_{h,\, i-1} +c_{a} \left(z_{i+1} -z_{h,\, i-1} \right)\right] where :math:`c_{a}` is a tunable parameter, varying from 0 to 1, and is taken as 0.34 by comparing the numerical solution with the analytic -solution (Z.-L. Yang 1998, unpublished manuscript). +solution (:ref:`Z.-L. Yang 1998, unpublished manuscript`). :math:`\Delta z_{i*}` is used in place of :math:`\Delta z_{i}` for :math:`i=snl+1` in equations -. The top snow/soil layer temperature computed in this way is the ground surface temperature @@ -361,34 +420,34 @@ The boundary condition at the bottom of the snow/soil column is zero heat flux, :math:`F_{i} =0`, resulting in, for :math:`i=N_{levgrnd}` , .. math:: - :label: 6.35) + :label: 6.35 \frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=\alpha \frac{\lambda \left[z_{h,\, i-1} \right]\left(T_{i-1}^{n} -T_{i}^{n} \right)}{z_{i} -z_{i-1} } +\left(1-\alpha \right)\frac{\lambda \left[z_{h,\, i-1} \right]\left(T_{i-1}^{n+1} -T_{i}^{n+1} \right)}{z_{i} -z_{i-1} } .. math:: - :label: 6.36) + :label: 6.36 a_{i} =-\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } .. math:: - :label: 6.37) + :label: 6.37 b_{i} =1+\left(1-\alpha \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } .. math:: - :label: 6.38) + :label: 6.38 c_{i} =0 .. math:: - :label: 6.39) + :label: 6.39 r_{i} =T_{i}^{n} -\alpha \frac{\Delta t}{c_{i} \Delta z_{i} } F_{i-1} where .. math:: - :label: ZEqnNum768674 + :label: 6.40 F_{i-1} =-\frac{\lambda \left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \left(T_{i-1}^{n} -T_{i}^{n} \right). @@ -396,48 +455,48 @@ For the interior snow/soil layers, :math:`snl+1T_{f} {\rm \; and\; }w_{ice,\, i} >0 & \qquad i=snl+1,\ldots ,N_{levgrnd} \qquad {\rm melting} \end{array} + +.. math:: + :label: 6.53b - \begin{array}{l} {T_{i}^{n+1} >T_{f} {\rm \; and\; }w_{ice,\, i} >0\qquad i=snl+1,\ldots ,N_{levgrnd} \qquad {\rm melting}} \\ {T_{i}^{n+1} 0\qquad i=snl+1,\ldots ,0\qquad {\rm freezing}} \\ {T_{i}^{n+1} w_{liq,\, \max ,\, i} \qquad i=1,\ldots ,N_{levgrnd} \qquad {\rm freezing}} \end{array} + \begin{array}{lr} + \begin{array}{lr} + T_{i}^{n+1} 0 & \qquad i=snl+1,\ldots ,0 \\ + T_{i}^{n+1} w_{liq,\, \max ,\, i} & \quad i=1,\ldots ,N_{levgrnd} + \end{array} & \quad {\rm freezing} + \end{array} where :math:`T_{i}^{n+1}` is the soil layer temperature after solution of the tridiagonal equation set, :math:`w_{ice,\, i}` and :math:`w_{liq,\, i}` are the mass of ice and liquid water (kg -m\ :sup:`-2`) in each snow/soil layer, respectively, and -:math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). For -the freezing process in soil layers, the concept of supercooled soil -water from Niu and Yang (2006) is adopted. The supercooled soil water is -the liquid water that coexists with ice over a wide range of +m\ :sup:`-2`) in each snow/soil layer, respectively, and :math:`T_{f}` +is the freezing temperature of water (K) (:numref:`Table Physical Constants`). +For the freezing process in soil layers, the concept of supercooled soil +water from :ref:`Niu and Yang (2006)` is adopted. The supercooled +soil water is the liquid water that coexists with ice over a wide range of temperatures below freezing and is implemented through a freezing point depression equation .. math:: - :label: ZEqnNum547401 + :label: 6.54 w_{liq,\, \max ,\, i} =\Delta z_{i} \theta _{sat,\, i} \left[\frac{10^{3} L_{f} \left(T_{f} -T_{i} \right)}{gT_{i} \psi _{sat,\, i} } \right]^{{-1\mathord{\left/ {\vphantom {-1 B_{i} }} \right. \kern-\nulldelimiterspace} B_{i} } } \qquad T_{i} ` exponent +(section :numref:`Soil Water`). For the special case when snow is present (snow mass :math:`W_{sno} >0`) but there are no explicit snow layers (:math:`snl=0`) (i.e., there is @@ -521,38 +592,46 @@ The excess or deficit of energy :math:`H_{i}` (W m\ :sup:`-2`) is determined as follows .. math:: - :label: 6.55) + :label: 6.55 - H_{i} =\left\{\begin{array}{l} {\frac{\partial h}{\partial T} \left(T_{f} -T_{i}^{n} \right)-\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right)\qquad \quad \quad \quad i=snl+1} \\ {\left(1-f_{sno} -f_{h2osfc} \right)\frac{\partial h}{\partial T} \left(T_{f} -T_{i}^{n} \right)-\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right)\quad {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} i=1} \\ {-\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right)\qquad \quad \quad \quad i\ne \left\{1,snl+1\right\}} \end{array}\right\}. + H_{i} =\left\{\begin{array}{lr} + \frac{\partial h}{\partial T} \left(T_{f} -T_{i}^{n} \right)-\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right) & \quad \quad i=snl+1 \\ + \left(1-f_{sno} -f_{h2osfc} \right)\frac{\partial h}{\partial T} \left(T_{f} -T_{i}^{n} \right)-\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right)\quad {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} & i=1 \\ + -\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{f} -T_{i}^{n} \right) & \quad \quad i\ne \left\{1,snl+1\right\} + \end{array}\right\}. -If the melting criteria is met (equation ) and +If the melting criteria is met :eq:`6.53a` and :math:`H_{m} =\frac{H_{i} \Delta t}{L_{f} } >0`, then the ice mass is readjusted as .. math:: - :label: ZEqnNum547839 + :label: 6.56 w_{ice,\, i}^{n+1} =w_{ice,\, i}^{n} -H_{m} \ge 0\qquad i=snl+1,\ldots ,N_{levgrnd} . -If the freezing criteria is met (equation ) and :math:`H_{m} <0`, then +If the freezing criteria is met :eq:`6.53b` and :math:`H_{m} <0`, then the ice mass is readjusted for :math:`i=snl+1,\ldots ,0` as .. math:: - :label: 6.57) + :label: 6.57 w_{ice,\, i}^{n+1} =\min \left(w_{liq,\, i}^{n} +w_{ice,\, i}^{n} ,w_{ice,\, i}^{n} -H_{m} \right) and for :math:`i=1,\ldots ,N_{levgrnd}` as .. math:: - :label: 6.58) + :label: 6.58 - w_{ice,\, i}^{n+1} =\left\{\begin{array}{l} {\min \left(w_{liq,\, i}^{n} +w_{ice,\, i}^{n} -w_{liq,\, \max ,\, i}^{n} ,\, w_{ice,\, i}^{n} -H_{m} \right)\qquad w_{liq,\, i}^{n} +w_{ice,\, i}^{n} \ge w_{liq,\, \max ,\, i}^{n} {\rm \; }} \\ {{\rm 0}\qquad w_{liq,\, i}^{n} +w_{ice,\, i}^{n} 0`) as .. math:: - :label: ZEqnNum190862 + :label: 6.61 - T_{i}^{n+1} =\left\{\begin{array}{l} {T_{f} +{\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \mathord{\left/ {\vphantom {\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \left(1-\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)}} \right. \kern-\nulldelimiterspace} \left(1-\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)} \qquad \quad \quad \quad \quad \quad \, i=snl+1} \\ {T_{f} +{\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \mathord{\left/ {\vphantom {\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \left(1-\left(1-f_{sno} -f_{h2osfc} \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)}} \right. \kern-\nulldelimiterspace} \left(1-\left(1-f_{sno} -f_{h2osfc} \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)} \qquad i=1} \\ {T_{f} +\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \qquad \quad \quad \quad \quad \quad \, i\ne \left\{1,snl+1\right\}} \end{array}\right\}. + T_{i}^{n+1} = + \left\{\begin{array}{lr} + T_{f} +{\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \mathord{\left/ {\vphantom {\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \left(1-\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)}} \right. \kern-\nulldelimiterspace} \left(1-\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)} & \quad \quad \quad \quad \, i=snl+1 \\ + T_{f} +{\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \mathord{\left/ {\vphantom {\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} \left(1-\left(1-f_{sno} -f_{h2osfc} \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)}} \right. \kern-\nulldelimiterspace} \left(1-\left(1-f_{sno} -f_{h2osfc} \right)\frac{\Delta t}{c_{i} \Delta z_{i} } \frac{\partial h}{\partial T} \right)} & \qquad i=1 \\ + T_{f} +\frac{\Delta t}{c_{i} \Delta z_{i} } H_{i*} & \quad \quad \quad \quad \, i\ne \left\{1,snl+1\right\} + \end{array}\right\}. For the special case when snow is present (:math:`W_{sno} >0`), there are no explicit snow layers (:math:`snl=0`), and @@ -578,14 +662,14 @@ are no explicit snow layers (:math:`snl=0`), and :math:`W_{sno}` (kg m\ :sup:`-2`) is reduced according to .. math:: - :label: 6.62) + :label: 6.62 W_{sno}^{n+1} =W_{sno}^{n} -\frac{H_{1} \Delta t}{L_{f} } \ge 0. The snow depth is reduced proportionally .. math:: - :label: 6.63) + :label: 6.63 z_{sno}^{n+1} =\frac{W_{sno}^{n+1} }{W_{sno}^{n} } z_{sno}^{n} . @@ -593,7 +677,7 @@ Again, because part of the energy may not be consumed in melting, the energy for the surface soil layer :math:`i=1` is recalculated as .. math:: - :label: 6.64) + :label: 6.64 H_{1*} =H_{1} -\frac{L_{f} \left(W_{sno}^{n} -W_{sno}^{n+1} \right)}{\Delta t} . @@ -601,23 +685,23 @@ If there is excess energy (:math:`H_{1*} >0`), this energy becomes available to the top soil layer as .. math:: - :label: ZEqnNum985120 + :label: 6.65 H_{1} =H_{1*} . The ice mass, liquid water content, and temperature of the top soil -layer are then determined from equations , , and using the recalculated -energy from equation . Snow melt :math:`M_{1S}` (kg m\ :sup:`-2` -s\ :sup:`-1`) and phase change energy :math:`E_{p,\, 1S}` (W -m\ :sup:`-2`) for this special case are +layer are then determined from :eq:`6.56`, :eq:`6.59`, and :eq:`6.61` +using the recalculated energy from :eq:`6.65`. Snow melt :math:`M_{1S}` +(kg m\ :sup:`-2` s\ :sup:`-1`) and phase change energy :math:`E_{p,\, 1S}` +(W m\ :sup:`-2`) for this special case are .. math:: - :label: 6.66) + :label: 6.66 M_{1S} =\frac{W_{sno}^{n} -W_{sno}^{n+1} }{\Delta t} \ge 0 .. math:: - :label: 6.67) + :label: 6.67 E_{p,\, 1S} =L_{f} M_{1S} . @@ -625,14 +709,14 @@ The total energy of phase change :math:`E_{p}` (W m\ :sup:`-2`) for the snow/soil column is .. math:: - :label: 6.68) + :label: 6.68 E_{p} =E_{p,\, 1S} +\sum _{i=snl+1}^{N_{levgrnd} }E_{p,i} where .. math:: - :label: 6.69) + :label: 6.69 E_{p,\, i} =L_{f} \frac{\left(w_{ice,\, i}^{n} -w_{ice,\, i}^{n+1} \right)}{\Delta t} . @@ -640,25 +724,26 @@ The total snow melt :math:`M` (kg m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 6.70) + :label: 6.70 M=M_{1S} +\sum _{i=snl+1}^{i=0}M_{i} where .. math:: - :label: 6.71) + :label: 6.71 M_{i} =\frac{\left(w_{ice,\, i}^{n} -w_{ice,\, i}^{n+1} \right)}{\Delta t} \ge 0. The solution for snow/soil temperatures conserves energy as .. math:: - :label: 6.72) + :label: 6.72 G-E_{p} -\sum _{i=snl+1}^{i=N_{levgrnd} }\frac{c_{i} \Delta z_{i} }{\Delta t} \left(T_{i}^{n+1} -T_{i}^{n} \right)=0 -where :math:`G` is the ground heat flux (section 5.4). +where :math:`G` is the ground heat flux (section +:numref:`Update of Ground Sensible and Latent Heat Fluxes`). .. _Surface Water: @@ -670,7 +755,7 @@ temperature, :math:`T_{h2osfc}` , becomes less than :math:`T_{f}` . The energy available for freezing is .. math:: - :label: 6.73) + :label: 6.73 H_{h2osfc} =\frac{\partial h}{\partial T} \left(T_{f} -T_{h2osfc}^{n} \right)-\frac{c_{h2osfc} \Delta z_{h2osfc} }{\Delta t} \left(T_{f} -T_{h2osfc}^{n} \right) @@ -680,19 +765,19 @@ where :math:`c_{h2osfc}` is the volumetric heat capacity of water, and is removed from surface water and added to the snow column as ice .. math:: - :label: 6.74) + :label: 6.74 H^{n+1} _{h2osfc} =H^{n} _{h2osfc} -H_{m} .. math:: - :label: 6.75) + :label: 6.75 w_{ice,\, 0}^{n+1} =w_{ice,\, 0}^{n} +H_{m} The snow depth is adjusted to account for the additional ice mass .. math:: - :label: 6.76) + :label: 6.76 \Delta z_{sno} =\frac{H_{m} }{\rho _{ice} } @@ -711,7 +796,7 @@ the mineral and organic properties of the soil The soil layer organic matter fraction :math:`f_{om,i}` is .. math:: - :label: 6.77) + :label: 6.77 f_{om,i} =\rho _{om,i} /\rho _{om,\max } . @@ -719,7 +804,7 @@ Soil thermal conductivity :math:`\lambda _{i}` (W m\ :sup:`-1` K\ :sup:`-1`) is from :ref:`Farouki (1981) ` .. math:: - :label: 6.78) + :label: 6.78 \begin{array}{lr} \lambda _{i} = \left\{ @@ -741,18 +826,17 @@ ground layers (typical of saturated granitic rock; :ref:`Clauser and Huenges 1995 `). For glaciers and wetlands, .. math:: - :label: 6.79) + :label: 6.79 \lambda _{i} =\left\{\begin{array}{l} {\lambda _{liq,\, i} \qquad T_{i} \ge T_{f} } \\ {\lambda _{ice,\, i} \qquad T_{i} ` .. math:: - :label: 6.87) + :label: 6.87 \lambda _{i} =\lambda _{air} +\left(7.75\times 10^{-5} \rho _{sno,\, i} +1.105\times 10^{-6} \rho _{sno,\, i}^{2} \right)\left(\lambda _{ice} -\lambda _{air} \right) @@ -828,7 +912,7 @@ where :math:`\lambda _{air}` is the thermal conductivity of air (:numref:`Table and :math:`\rho _{sno,\, i}` is the bulk density of snow (kg m\ :sup:`-3`) .. math:: - :label: 6.88) + :label: 6.88 \rho _{sno,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{\Delta z_{i} } . @@ -837,7 +921,7 @@ soil is from :ref:`de Vries (1963) ` and depends on the heat capacities of the soil solid, liquid water, and ice constituents .. math:: - :label: ZEqnNum222806 + :label: 6.89 c_{i} =c_{s,\, i} \left(1-\theta _{sat,\, i} \right)+\frac{w_{ice,\, i} }{\Delta z_{i} } C_{ice} +\frac{w_{liq,\, i} }{\Delta z_{i} } C_{liq} @@ -847,7 +931,7 @@ and ice, respectively (:numref:`Table Physical Constants`). The heat capacity of :math:`c_{s,i}` \ (J m\ :sup:`-3` K\ :sup:`-1`) is .. math:: - :label: 6.90) + :label: 6.90 c_{s,i} =(1-f_{om,i} )c_{s,\min ,i} +f_{om,i} c_{s,om} @@ -855,7 +939,7 @@ where the heat capacity of mineral soil solids :math:`c_{s,\min ,\, i}` (J m\ :sup:`-3` K\ :sup:`-1`) is .. math:: - :label: 6.91) + :label: 6.91 \begin{array}{lr} c_{s,\min ,\, i} =\left(\frac{2.128{\rm \; }\left(\% sand\right)_{i} +{\rm 2.385\; }\left(\% clay\right)_{i} }{\left(\% sand\right)_{i} +\left(\% clay\right)_{i} } \right)\times 10^{6} &\qquad i=1,\ldots ,N_{levsoi} \\ @@ -865,11 +949,11 @@ where the heat capacity of mineral soil solids where :math:`c_{s,bedrock} =2\times 10^{6}` J m\ :sup:`-3` K\ :sup:`-1` is the heat capacity of bedrock and :math:`c_{s,om} =2.5\times 10^{6}` \ J m\ :sup:`-3` -K\ :sup:`-1` (ref:`Farouki 1981 `) is the heat capacity of organic +K\ :sup:`-1` (:ref:`Farouki 1981 `) is the heat capacity of organic matter. For glaciers, wetlands, and snow .. math:: - :label: ZEqnNum107679 + :label: 6.92 c_{i} =\frac{w_{ice,\, i} }{\Delta z_{i} } C_{ice} +\frac{w_{liq,\, i} }{\Delta z_{i} } C_{liq} . @@ -878,11 +962,8 @@ there are no explicit snow layers (:math:`snl=0`), the heat capacity of the top layer is a blend of ice and soil heat capacity .. math:: - :label: 6.93) - - c_{1} =c_{1}^{\*} +\frac{C_{ice} W_{sno} }{\Delta z_{1} } - -where :math:`c_{1}^{\*}` is calculated from equation or . + :label: 6.93 -.. todo:: fill in the above - should be calculated form equation (6.89) or (6.92) + c_{1} =c_{1}^{*} +\frac{C_{ice} W_{sno} }{\Delta z_{1} } +where :math:`c_{1}^{*}` is calculated from :eq:`6.89` or :eq:`6.92`. From 0073bde0ccbed500f5052cdbc09484685cb37cdd Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 1 Jun 2017 12:37:44 -0600 Subject: [PATCH 0036/1973] Update Chaptes 7,8 --- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 256 +++++++++--------- .../CLM50_Tech_Note_Snow_Hydrology.rst | 157 ++++++----- 2 files changed, 219 insertions(+), 194 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 69a8907f89..0db3456163 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -16,7 +16,7 @@ m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (:numref:`Figure Hydrologic processes`). The total water balance of the system is .. math:: - :label: 7.1) + :label: 7.1 \begin{array}{l} {\Delta W_{can} +\Delta W_{sfc} +\Delta W_{sno} +} \\ {\sum _{i=1}^{N_{levsoi} }\left(\Delta w_{liq,\, i} +\Delta w_{ice,\, i} \right)+\Delta W_{a} =\left(\begin{array}{l} {q_{rain} +q_{sno} -E_{v} -E_{g} -q_{over} } \\ {-q_{h2osfc} -q_{drai} -q_{rgwl} -q_{snwcp,\, ice} } \end{array}\right) \Delta t} \end{array} @@ -53,42 +53,43 @@ m\ :sup:`-2` s\ :sup:`-1`) does not distinguish between liquid and solid phases .. math:: - :label: 7.2) + :label: 7.2 q_{intr} =\alpha \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} where :math:`L` and :math:`S` are the exposed leaf and stem area index, -respectively (section 2.1.4), and :math:`\alpha =0.25` scales -interception from point to grid cell (:ref:`Lawrence et al. 2007 `). Throughfall +respectively (section :numref:`Phenology and vegetation burial by snow`), +and :math:`\alpha =0.25` scales interception from point to grid cell +(:ref:`Lawrence et al. 2007 `). Throughfall (kg m\ :sup:`-2` s\ :sup:`-1`), however, is divided into liquid and solid phases reaching the ground (soil or snow surface) as .. math:: - :label: 7.3) + :label: 7.3 q_{thru,\, liq} =q_{rain} \left[1-\alpha \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right] .. math:: - :label: 7.4) + :label: 7.4 q_{thru,\, ice} =q_{sno} \left[1-\alpha \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right]. Similarly, the canopy drip is .. math:: - :label: 7.5) + :label: 7.5 q_{drip,\, liq} =\frac{W_{can}^{intr} -W_{can,\, \max } }{\Delta t} \frac{q_{rain} }{q_{rain} +q_{sno} } \ge 0 .. math:: - :label: 7.6) + :label: 7.6 q_{drip,\, ice} =\frac{W_{can}^{intr} -W_{can,\, \max } }{\Delta t} \frac{q_{sno} }{q_{rain} +q_{sno} } \ge 0 where .. math:: - :label: 7.7) + :label: 7.7 W_{can}^{intr} =W_{can}^{n} +q_{intr} \Delta t\ge 0 @@ -98,7 +99,7 @@ and :math:`W_{can,\, \max }` (kg m\ :sup:`-2`) is the maximum amount of water the canopy can hold .. math:: - :label: 7.8) + :label: 7.8 W_{can,\, \max } =p\left(L+S\right). @@ -107,7 +108,7 @@ liquid water, :math:`p=0.1` kg m\ :sup:`-2` (:ref:`Dickinson et al. 1993 `). The canopy water is updated as .. math:: - :label: 7.9) + :label: 7.9 W_{can}^{n+1} =W_{can}^{n} +q_{intr} \Delta t-\left(q_{drip,\, liq} +q_{drip,\, ice} \right)\Delta t-E_{v}^{w} \Delta t\ge 0. @@ -116,12 +117,12 @@ surfaces (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) reaching the ground is then .. math:: - :label: ZEqnNum946822 + :label: 7.10 q_{grnd,liq} =q_{thru,\, liq} +q_{drip,\, liq} .. math:: - :label: ZEqnNum339590 + :label: 7.11 q_{grnd,ice} =q_{thru,\, ice} +q_{drip,\, ice} . @@ -138,7 +139,7 @@ for the surface albedo (section :numref:`Canopy Radiative Transfer`) and surface calculations is (:ref:`Dickinson et al.1993 `) .. math:: - :label: 7.12) + :label: 7.12 f_{wet} = \left\{\begin{array}{lr} @@ -149,7 +150,7 @@ calculations is (:ref:`Dickinson et al.1993 `) while the fraction of the canopy that is dry and transpiring is .. math:: - :label: 7.13) + :label: 7.13 f_{dry} = \left\{\begin{array}{lr} @@ -183,21 +184,21 @@ portion of a grid cell contributes to surface runoff, :math:`q_{over}` , by the saturation excess mechanism (Dunne runoff) .. math:: - :label: ZEqnNum549608 + :label: 7.64 q_{over} =f_{sat} q_{liq,\, 0} The fractional saturated area is a function of soil moisture .. math:: - :label: 7.65) + :label: 7.65 - f_{sat} =f_{\max } \exp \left(-0.5f_{over} z_{\nabla } \right) + f_{sat} = f_{\max } \exp \left(-0.5 f_{over} z_{\nabla } \right) -where :math:`f_{\max }` is the potential or maximum value of -:math:`f_{sat}` , :math:`f_{over}` is a decay factor -(m\ :sup:`-1`), and :math:`z_{\nabla}` is the water table depth -(m) (section 7.6). The maximum saturated fraction, :math:`f_{\max }` , +where :math:`f_{\max }` is the potential or maximum value of +:math:`f_{sat}`, :math:`f_{over}` is a decay factor (m\ :sup:`-1`), and +:math:`z_{\nabla}` is the water table depth (m) (section +:numref:`Lateral Sub-surface Runoff`). The maximum saturated fraction, :math:`f_{\max }` , is defined as the value of the discrete cumulative distribution function (CDF) of the topographic index when the grid cell mean water table depth is zero. Thus, :math:`f_{\max }` is the percent of pixels in a grid @@ -242,7 +243,7 @@ height (relative to the grid cell mean elevation) of the surface water, :math:`d`, by .. math:: - :label: ZEqnNum277892 + :label: 7.66 W_{sfc} =\frac{d}{2} \left(1+erf\left(\frac{d}{\sigma _{micro} \sqrt{2} } \right)\right)+\frac{\sigma _{micro} }{\sqrt{2\pi } } e^{\frac{-d^{2} }{2\sigma _{micro} ^{2} } } @@ -252,7 +253,7 @@ Newton-Raphson method. Once :math:`d` is known, one can determine the fraction of the area that is inundated as .. math:: - :label: 7.67) + :label: 7.67 f_{h2osfc} =\frac{1}{2} \left(1+erf\left(\frac{d}{\sigma _{micro} \sqrt{2} } \right)\right) @@ -260,7 +261,7 @@ No global datasets exist for microtopography, so the default parameterization is a simple function of slope .. math:: - :label: 7.68) + :label: 7.68 \sigma _{micro} =\left(\beta +\beta _{0} \right)^{\eta } @@ -277,7 +278,7 @@ percolation theory can be used to quantify the fraction of the inundated portion of the grid cell that is interconnected .. math:: - :label: 7.69) + :label: 7.69 \begin{array}{lr} f_{connected} =\left(f_{h2osfc} -f_{c} \right)^{\mu } & \qquad f_{h2osfc} >f_{c} \\ f_{connected} =0 &\qquad f_{h2osfc} \le f_{c} \end{array} @@ -289,7 +290,7 @@ surpasses :math:`f_{c}` , the surface water store acts as a linear reservoir .. math:: - :label: 7.70) + :label: 7.70 qout,h2osfc=kh2osfcf_{connected} (Wsfc-Wc)\frac{1}{\Delta t} @@ -309,7 +310,7 @@ The surface moisture flux remaining after surface runoff has been removed, .. math:: - :label: 7.71) + :label: 7.71 qin,surface=(1-f_{sat} )q_{liq,\, 0} @@ -319,7 +320,7 @@ maximum soil infiltration capacity (kg m\ :sup:`-2` s\ :sup:`-1`), .. math:: - :label: ZEqnNum569150 + :label: 7.72 q_{infl,\, \max } =(1-fsat){\rm \Theta }iceksat @@ -327,7 +328,7 @@ where :math:`{\rm \Theta }ice` is an ice impedance factor (section :numref:`Hydraulic Properties`), infiltration excess (Hortonian) runoff is generated .. math:: - :label: 7.73) + :label: 7.73 q_{infl,\, excess} =\max \left(q_{in,soil} -\left(1-f_{h2osfc} \right)q_{\inf l,\max } ,0\right) @@ -335,28 +336,28 @@ and transferred from :math:`q_{in,soil}` to :math:`q_{in,h2osfc}` . After evaporative losses have been removed, these moisture fluxes are .. math:: - :label: 7.74) + :label: 7.74 q_{in,\, h2osfc} =f_{h2osfc} q_{in,surface} +q_{infl,excess} -q_{evap,h2osfc} and .. math:: - :label: 7.75) + :label: 7.75 qin,soil=(1-f_{h2osfc} )q_{in,surface} -q_{\inf l,excess} -(1-f_{sno} -f_{h2osfc} )qevap,soil. The balance of surface water is then calculated as .. math:: - :label: 7.76) + :label: 7.76 \Delta W_{sfc} =\left(qin,h2osfc-qout,h2osfc-qdrain,h2osfc\right)\Delta t. Bottom drainage from the surface water store .. math:: - :label: 7.77) + :label: 7.77 qdrain,h2osfc=\min \left(f_{h2osfc} q_{\inf l,\max } ,\frac{W_{sfc} }{\Delta t} \right) @@ -364,7 +365,7 @@ is then added to :math:`q_{in,soil}` giving the total infiltration into the surface soil layer .. math:: - :label: 7.78) + :label: 7.78 q_{infl} =q_{in,soil} +q_{drain,h2osfc} @@ -387,7 +388,7 @@ For one-dimensional vertical water flow in soils, the conservation of mass is stated as .. math:: - :label: ZEqnNum790844 + :label: 7.79 \frac{\partial \theta }{\partial t} =-\frac{\partial q}{\partial z} -Q @@ -409,7 +410,7 @@ The soil water flux :math:`q` in equation can be described by Darcy’s law :ref:`(Dingman 2002) ` .. math:: - :label: 7.80) + :label: 7.80 q=-k\frac{\partial \psi _{h} }{\partial z} @@ -418,7 +419,7 @@ and :math:`\psi _{h}` is the hydraulic potential (mm). The hydraulic potential is .. math:: - :label: 7.81) + :label: 7.81 \psi _{h} =\psi _{m} +\psi _{z} @@ -431,22 +432,22 @@ If the reference elevation is the soil surface, then becomes .. math:: - :label: ZEqnNum186573 + :label: 7.82 q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]. -Equation :eq:`ZEqnNum186573` can be further manipulated to yield +Equation :eq:`7.82` can be further manipulated to yield .. math:: - :label: 7.83) + :label: 7.83 q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]=-k\left(\frac{\partial \psi }{\partial z} +1\right)=-k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right). -Substitution of this equation into equation :eq:`ZEqnNum790844`, with :math:`Q=0`, yields +Substitution of this equation into equation :eq:`7.79`, with :math:`Q=0`, yields the Richards equation .. math:: - :label: ZEqnNum670361 + :label: 7.84 \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right)\right]. @@ -458,7 +459,8 @@ Hydraulic Properties The hydraulic conductivity :math:`k_{i}` (mm s\ :sup:`-1`) and the soil matric potential :math:`\psi _{i}` (mm) for layer :math:`i` vary with volumetric soil water :math:`\theta _{i}` and soil texture. -As with the soil thermal properties (section :numref:`Soil And Snow Thermal Properties`) the hydraulic +As with the soil thermal properties (section +:numref:`Soil And Snow Thermal Properties`) the hydraulic properties of the soil are assumed to be a weighted combination of the mineral properties, which are determined according to sand and clay contents based on work by :ref:`Clapp and Hornberger (1978) @@ -475,7 +477,7 @@ moisture of the two layers :math:`\theta _{i}` and :math:`\Theta _{ice}` .. math:: - :label: ZEqnNum398074 + :label: 7.85 k\left[z_{h,\, i} \right] = \left\{\begin{array}{lr} @@ -497,7 +499,7 @@ computed as weighted averages of the properties of the mineral and organic components. The water content at saturation (i.e. porosity) is .. math:: - :label: 7.90) + :label: 7.90 \theta _{sat,i} =(1-f_{om,i} )\theta _{sat,\min ,i} +f_{om,i} \theta _{sat,om} @@ -508,21 +510,21 @@ porosity of organic matter and the porosity of the mineral soil :math:`\theta _{sat,\min ,i}` is .. math:: - :label: 7.91) + :label: 7.91 \theta _{sai,\min ,i} = 0.489 - 0.00126(\% sand)_{i} . The exponent :math:`B_{i}` is .. math:: - :label: 7.92) + :label: 7.92 B_{i} =(1-f_{om,i} )B_{\min ,i} +f_{om,i} B_{om} where :math:`B_{om} = 2.7` \ (:ref:`Letts et al. 2000 `) and .. math:: - :label: 7.93) + :label: 7.93 B_{\min ,i} =2.91+0.159(\% clay)_{i} . @@ -530,14 +532,14 @@ The soil matric potential (mm) is defined at the node depth :math:`z_{i}` of each layer :math:`i` (:numref:`Figure Water flux schematic`) .. math:: - :label: ZEqnNum316201 + :label: 7.94 \psi _{i} =\psi _{sat,\, i} \left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{-B_{i} } \ge -1\times 10^{8} \qquad 0.01\le \frac{\theta _{i} }{\theta _{sat,\, i} } \le 1 where the saturated soil matric potential (mm) is .. math:: - :label: 7.95) + :label: 7.95 \psi _{sat,i} =(1-f_{om,i} )\psi _{sat,\min ,i} +f_{om,i} \psi _{sat,om} @@ -546,7 +548,7 @@ saturated organic matter matric potential and the saturated mineral soil matric potential :math:`\psi _{sat,\min ,i}` \ is .. math:: - :label: 7.96) + :label: 7.96 \psi _{sat,\, \min ,\, i} =-10.0\times 10^{1.88-0.0131(\% sand)_{i} } . @@ -570,7 +572,7 @@ pathways interacts only with organic material, and thus can be described by :math:`k_{sat,\, om}` . This fraction of the grid cell is given by .. math:: - :label: 7.97) + :label: 7.97 \begin{array}{lr} f_{perc} =\; N_{perc} \left(f_{om} {\rm \; }-f_{threshold} \right)^{\beta _{perc} } f_{om} {\rm \; } & \qquad f_{om} \ge f_{threshold} \\ @@ -585,7 +587,7 @@ hydraulic conductivity is assumed to correspond to flow pathways that pass through the mineral and organic components in series .. math:: - :label: 7.98) + :label: 7.98 k_{sat,\, uncon} =f_{uncon} \left(\frac{\left(1-f_{om} \right)}{k_{sat,\, \min } } +\frac{\left(f_{om} -f_{perc} \right)}{k_{sat,\, om} } \right)^{-1} . @@ -593,7 +595,7 @@ where saturated hydraulic conductivity for mineral soil depends on soil texture (:ref:`Cosby et al. 1984 `) as .. math:: - :label: 7.99) + :label: 7.99 k_{sat,\, \min } \left[z_{h,\, i} \right]=0.0070556\times 10^{-0.884+0.0153\left(\% sand\right)_{i} } . @@ -601,7 +603,7 @@ The bulk soil layer saturated hydraulic conductivity is then computed as .. math:: - :label: 7.100) + :label: 7.100 k_{sat} \left[z_{h,\, i} \right]=f_{uncon,\, i} k_{sat,\, uncon} \left[z_{h,\, i} \right]+(1-f_{uncon,\, i} )k_{sat,\, om} \left[z_{h,\, i} \right]. @@ -610,11 +612,11 @@ as Numerical Solution ^^^^^^^^^^^^^^^^^^^^^^^^ -With reference to :numref:`Figure Water flux schematic`, the equation for conservation of mass -(equation :eq:`ZEqnNum790844`) can be integrated over each layer as +With reference to :numref:`Figure Water flux schematic`, the equation for +conservation of mass :eq:`7.79` can be integrated over each layer as .. math:: - :label: 7.101) + :label: 7.101 \int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial \theta }{\partial t} \, dz=-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial q}{\partial z} \, dz-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }Q\, dz . @@ -623,7 +625,7 @@ as positive upward from the soil surface. This equation can be written as .. math:: - :label: ZEqnNum225309 + :label: 7.102 \Delta z_{i} \frac{\partial \theta _{liq,\, i} }{\partial t} =-q_{i-1} +q_{i} -e_{i} @@ -635,7 +637,7 @@ the layer (mm s\ :sup:`-1`). Taking the finite difference with time and evaluating the fluxes implicitly at time :math:`n+1` yields .. math:: - :label: ZEqnNum181361 + :label: 7.103 \frac{\Delta z_{i} \Delta \theta _{liq,\, i} }{\Delta t} =-q_{i-1}^{n+1} +q_{i}^{n+1} -e_{i} @@ -650,7 +652,7 @@ function of the total transpiration :math:`E_{v}^{t}` (Chapter :numref:`rst_Mom the effective root fraction :math:`r_{e,\, i}` .. math:: - :label: ZEqnNum357392 + :label: 7.104 e_{i} =r_{e,\, i} E_{v}^{t} . @@ -676,7 +678,7 @@ soil column, the transpiration :math:`E_{v}^{t}` is a weighted sum of transpiration from all PFTs whose weighting depends on PFT area as .. math:: - :label: 7.105) + :label: 7.105 E_{v}^{t} =\sum _{j=1}^{npft}\left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} @@ -689,7 +691,7 @@ quantity that is a weighted sum over all PFTs. The weighting depends on the per unit area transpiration of each PFT and its relative area as .. math:: - :label: 7.106) + :label: 7.106 r_{e,\, i} =\frac{\sum _{j=1}^{npft}\left(r_{e,\, i} \right)_{j} \left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} }{\sum _{j=1}^{npft}\left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} } @@ -697,15 +699,20 @@ where :math:`\left(r_{e,\, i} \right)_{j}` is the effective root fraction for the :math:`j^{th}` PFT .. math:: - :label: 7.107) + :label: 7.107 - \begin{array}{l} {\left(r_{e,\, i} \right)_{j} =\frac{\left(r_{i} \right)_{j} \left(w_{i} \right)_{j} }{\left(\beta _{t} \right)_{j} } \qquad \left(\beta _{t} \right)_{j} >0} \\ {\left(r_{e,\, i} \right)_{j} =0\qquad \left(\beta _{t} \right)_{j} =0} \end{array} + \begin{array}{lr} + \left(r_{e,\, i} \right)_{j} =\frac{\left(r_{i} \right)_{j} \left(w_{i} \right)_{j} }{\left(\beta _{t} \right)_{j} } & \qquad \left(\beta _{t} \right)_{j} >0 \\ + \left(r_{e,\, i} \right)_{j} =0 & \qquad \left(\beta _{t} \right)_{j} =0 + \end{array} and :math:`\left(r_{i} \right)_{j}` is the fraction of roots in layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), -:math:`\left(w_{i} \right)_{j}` is a soil dryness or plant wilting factor -for layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), and :math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total -soil column for the :math:`j^{th}` PFT (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). +:math:`\left(w_{i} \right)_{j}` is a soil dryness or plant wilting factor for +layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), +and :math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total +soil column for the :math:`j^{th}` PFT (Chapter +:numref:`rst_Stomatal Resistance and Photosynthesis`). The soil water fluxes in equation , which are a function of :math:`\theta _{liq,\, i}` and :math:`\theta _{liq,\, i+1}` because of @@ -714,12 +721,12 @@ can be linearized about :math:`\theta` using a Taylor series expansion as .. math:: - :label: 7.108) + :label: 7.108 q_{i}^{n+1} =q_{i}^{n} +\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} +\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } \Delta \theta _{liq,\, i+1} .. math:: - :label: 7.109) + :label: 7.109 q_{i-1}^{n+1} =q_{i-1}^{n} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } \Delta \theta _{liq,\, i-1} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} . @@ -728,29 +735,29 @@ Substitution of these expressions for :math:`q_{i}^{n+1}` and equation set of the form .. math:: - :label: 7.110) + :label: 7.110 r_{i} =a_{i} \Delta \theta _{liq,\, i-1} +b_{i} \Delta \theta _{liq,\, i} +c_{i} \Delta \theta _{liq,\, i+1} where .. math:: - :label: ZEqnNum557934 + :label: 7.111 a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } .. math:: - :label: 7.112) + :label: 7.112 b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.113) + :label: 7.113 c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } .. math:: - :label: ZEqnNum981892 + :label: 7.114 r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . @@ -761,32 +768,32 @@ The finite-difference forms of the fluxes and partial derivatives in equations - can be obtained from equation as .. math:: - :label: 7.115) + :label: 7.115 q_{i-1}^{n} =-k\left[z_{h,\, i-1} \right]\left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: - :label: 7.116) + :label: 7.116 q_{i}^{n} =-k\left[z_{h,\, i} \right]\left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] .. math:: - :label: 7.117) + :label: 7.117 \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } =-\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, i-1} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: - :label: 7.118) + :label: 7.118 \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } =\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: - :label: 7.119) + :label: 7.119 \frac{\partial q_{i} }{\partial \theta _{liq,\, i} } =-\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] .. math:: - :label: 7.120) + :label: 7.120 \frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } =\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right]. @@ -794,17 +801,17 @@ The derivatives of the soil matric potential at the node depth are derived from equation .. math:: - :label: 7.121) + :label: 7.121 \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, \, i-1} } =-B_{i-1} \frac{\psi _{i-1} }{\theta _{\, \, i-1} } .. math:: - :label: 7.122) + :label: 7.122 \frac{\partial \psi _{i} }{\partial \theta _{\, liq,\, i} } =-B_{i} \frac{\psi _{i} }{\theta _{i} } .. math:: - :label: 7.123) + :label: 7.123 \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } =-B_{i+1} \frac{\psi _{i+1} }{\theta _{\, i+1} } @@ -815,12 +822,12 @@ The derivatives of the hydraulic conductivity at the layer interface are derived from equation .. math:: - :label: 7.124) + :label: 7.124 \begin{array}{l} {\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } =\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } =\left(1-\frac{f_{frz,\, i-1} +f_{frz,\, i} }{2} \right)\left(2B_{i-1} +3\right)k_{sat} \left[z_{h,\, i-1} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i-1} +\theta _{\, i} \right)}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right]^{2B_{i-1} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right)} \end{array} .. math:: - :label: 7.125) + :label: 7.125 \begin{array}{l} {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } =\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } =\left(1-\frac{f_{frz,\, i} +f_{frz,\, i+1} }{2} \right)\left(2B_{i} +3\right)k_{sat} \left[z_{h,\, i} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right)} \end{array}. @@ -833,7 +840,7 @@ infiltration rate (section :numref:`Surface Runoff`), is .. math:: - :label: 7.135) + :label: 7.135 \frac{\Delta z_{i} \Delta \theta _{liq,\, i} }{\Delta t} =q_{infl}^{n+1} +q_{i}^{n+1} -e_{i} . @@ -841,22 +848,22 @@ After grouping like terms, the coefficients of the tridiagonal set of equations for :math:`i=1` are .. math:: - :label: 7.136) + :label: 7.136 a_{i} =0 .. math:: - :label: 7.137) + :label: 7.137 b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.138) + :label: 7.138 c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } .. math:: - :label: 7.139) + :label: 7.139 r_{i} =q_{infl}^{n+1} -q_{i}^{n} +e_{i} . @@ -867,22 +874,22 @@ The coefficients of the tridiagonal set of equations for :math:`i=2,\ldots ,N_{levsoi} -1` are .. math:: - :label: 7.140) + :label: 7.140 a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } .. math:: - :label: 7.141) + :label: 7.141 b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.142) + :label: 7.142 c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } .. math:: - :label: 7.143) + :label: 7.143 r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . @@ -895,22 +902,22 @@ and the coefficients of the tridiagonal set of equations for :math:`i=N_{levsoi}` are .. math:: - :label: 7.148) + :label: 7.148 a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } .. math:: - :label: 7.149) + :label: 7.149 b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.150) + :label: 7.150 c_{i} =0 .. math:: - :label: 7.151) + :label: 7.151 r_{i} =q_{i-1}^{n} +e_{i} . @@ -921,7 +928,7 @@ An initial solution is found by setting :math:`\Delta t` equal to the model time step. An estimate of the error is calculated from .. math:: - :label: 7.152) + :label: 7.152 \epsilon = max \left[ \frac{\Delta \theta_{liq,\, i} \Delta z_{i}}{\Delta t} - \left( q_{i-1}^{n} - q_{i}^{n} + e_{i}\right) \right] @@ -937,14 +944,14 @@ Upon solution of the tridiagonal equation set, the liquid water contents are updated as follows .. math:: - :label: 7.164) + :label: 7.164 w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\Delta \theta _{liq,\, i} \Delta z_{i} \qquad i=1,\ldots ,N_{levsoi} . The volumetric water content is .. math:: - :label: 7.165) + :label: 7.165 \theta _{i} =\frac{w_{liq,\, i} }{\Delta z_{i} \rho _{liq} } +\frac{w_{ice,\, i} }{\Delta z_{i} \rho _{ice} } . @@ -954,7 +961,8 @@ Frozen Soils and Perched Water Table ---------------------------------------- When soils freeze, the power-law form of the ice impedance factor -(section :numref:`Hydraulic Properties`) can greatly decrease the hydraulic conductivity of the +(section :numref:`Hydraulic Properties`) can greatly decrease the hydraulic +conductivity of the soil, leading to nearly impermeable soil layers. When unfrozen soil layers are present above relatively ice-rich frozen layers, the possibility exists for perched saturated zones. Lateral drainage from @@ -962,7 +970,7 @@ perched saturated regions is parameterized as a function of the thickness of the saturated zone .. math:: - :label: 7.166) + :label: 7.166 q_{drai,perch} =k_{drai,\, perch} \left(z_{frost} -z_{\nabla ,perch} \right) @@ -970,7 +978,7 @@ where :math:`k_{drai,\, perch}` depends on topographic slope and soil hydraulic conductivity, .. math:: - :label: 7.167) + :label: 7.167 k_{drai,\, perch} =10^{-5} \sin (\beta )\left(\frac{\sum _{i=N_{perch} }^{i=N_{frost} }\Theta _{ice,i} k_{sat} \left[z_{i} \right]\Delta z_{i} }{\sum _{i=N_{perch} }^{i=N_{frost} }\Delta z_{i} } \right) @@ -995,7 +1003,7 @@ Lateral sub-surface runoff occurs when saturated soil moisture conditions exist within the soil column. Sub-surface runoff is .. math:: - :label: 7.168) + :label: 7.168 q_{subsurface} = \Theta_{ice} K_{baseflow} tan \left( \beta \right) \Delta z_{sat}^{N_{baseflow}} \ , @@ -1007,13 +1015,14 @@ is the thickness of the saturated portion of the soil column. The saturated thickness is .. math:: - :label: 7.1681) + :label: 7.1681 \Delta z_{sat} = z_{bedrock} - z_{\nabla}, where the water table :math:`z_{\nabla}` is determined by finding the -first soil layer above the bedrock depth (section ) in which the volumetric water -content drops below a specified threshold. The default threshold is set to 0.9. +first soil layer above the bedrock depth (section :numref:`Depth to Bedrock`) +in which the volumetric water content drops below a specified threshold. +The default threshold is set to 0.9. The specific yield, :math:`S_{y}` , which depends on the soil properties and the water table location, is derived by taking the @@ -1021,13 +1030,13 @@ difference between two equilibrium soil moisture profiles whose water tables differ by an infinitesimal amount .. math:: - :label: 7.174) + :label: 7.174 S_{y} =\theta _{sat} \left(1-\left(1+\frac{z_{\nabla } }{\Psi _{sat} } \right)^{\frac{-1}{B} } \right) where B is the Clapp-Hornberger exponent. Because :math:`S_{y}` is a function of the soil properties, it results in water table dynamics that -are consistent with the soil water fluxes described in section 7.4. +are consistent with the soil water fluxes described in section :numref:`Soil Water`. After the above calculations, two numerical adjustments are implemented to keep the liquid water content of each soil layer @@ -1052,22 +1061,22 @@ those layers subject to the constraint found, then the water is removed from :math:`W_{t}` and :math:`q_{drai}` . -The soil surface layer liquid water and ice contents are then updated -for dew :math:`q_{sdew}` , frost :math:`q_{frost}` , or sublimation -:math:`q_{subl}` (section 5.4) as +The soil surface layer liquid water and ice contents are then updated for +dew :math:`q_{sdew}`, frost :math:`q_{frost}`, or sublimation :math:`q_{subl}` +(section :numref:`Update of Ground Sensible and Latent Heat Fluxes`) as .. math:: - :label: 7.175) + :label: 7.175 w_{liq,\, 1}^{n+1} =w_{liq,\, 1}^{n} +q_{sdew} \Delta t .. math:: - :label: 7.176) + :label: 7.176 w_{ice,\, 1}^{n+1} =w_{ice,\, 1}^{n} +q_{frost} \Delta t .. math:: - :label: 7.177) + :label: 7.177 w_{ice,\, 1}^{n+1} =w_{ice,\, 1}^{n} -q_{subl} \Delta t. @@ -1085,12 +1094,12 @@ and dew in solid or liquid form, is separated into solid :math:`q_{snwcp,ice}` \ and liquid :math:`q_{snwcp,liq}` runoff terms .. math:: - :label: 7.178) + :label: 7.178 q_{snwcp,ice} =q_{grnd,ice} +q_{frost} .. math:: - :label: 7.179) + :label: 7.179 q_{snwcp,liq} =q_{grnd,liq} +q_{dew} @@ -1106,7 +1115,7 @@ For glacier surfaces the runoff term :math:`q_{rgwl}` is calculated from the residual of the water balance .. math:: - :label: 7.180) + :label: 7.180 q_{rgwl} =q_{grnd,ice} +q_{grnd,liq} -E_{g} -E_{v} -\frac{\left(W_{b}^{n+1} -W_{b}^{n} \right)}{\Delta t} -q_{snwcp,ice} @@ -1114,7 +1123,7 @@ where :math:`W_{b}^{n}` and :math:`W_{b}^{n+1}` are the water balances at the beginning and ending of the time step defined as .. math:: - :label: 7.181) + :label: 7.181 W_{b} =W_{can} +W_{sno} +\sum _{i=1}^{N}\left(w_{ice,i} +w_{liq,i} \right) . @@ -1122,5 +1131,6 @@ Currently, glaciers are non-vegetated and :math:`E_{v} =W_{can} =0`. The contribution of lake runoff to :math:`q_{rgwl}` is described in section :numref:`Precipitation, Evaporation, and Runoff Lake`. The runoff term :math:`q_{rgwl}` may be negative for glaciers and lakes, which reduces -the total amount of runoff available to the river routing model (Chapter :numref:`rst_River Transport Model (RTM)`). +the total amount of runoff available to the river routing model +(Chapter :numref:`rst_River Transport Model (RTM)`). diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index dbe949bd34..5f87ec2f1a 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -3,21 +3,20 @@ Snow Hydrology =============== -The parameterizations for snow are based primarily on :ref:`Anderson (1976) `, -:ref:`Jordan (1991) `, and :ref:`Dai and Zeng (1997) `. The snowpack +The parameterizations for snow are based primarily on +:ref:`Anderson (1976) `, :ref:`Jordan (1991) `, +and :ref:`Dai and Zeng (1997) `. The snowpack can have up to five layers. These layers are indexed in the Fortran code as :math:`i=-4,-3,-2,-1,0` where layer :math:`i=0` is the snow layer next to the top soil layer and layer :math:`i=-4` is the top layer of a five-layer snow pack. Since the number of snow layers varies according to the snow depth, we use the notation :math:`snl+1` to describe the top layer of snow for the variable layer snow pack, where :math:`snl` is the -negative of the number of snow layers. Refer to Figure :numref:`three layer +negative of the number of snow layers. Refer to :numref:`Figure three layer snow pack` for an example of the snow layer structure for a three layer snow pack. -.. Figure 8.2. Example of three layer snow pack (:math:`snl=-3`). - -.. _three layer snow pack: +.. _Figure three layer snow pack: .. Figure:: image1.png @@ -61,7 +60,7 @@ calculated separately for accumulation and depletion. When snowfall occurs, :math:`f_{sno}` is updated as .. math:: - :label: 8.14) + :label: 8.14 f^{n+1} _{sno} =1-\left(\left(1-\tanh (k_{accum} q_{sno} \Delta t)\right)\left(1-f^{n} _{sno} \right)\right) @@ -74,7 +73,7 @@ When snow melt occurs, :math:`f_{sno}` is calculated from the depletion curve .. math:: - :label: 8.15) + :label: 8.15 f_{sno} =1-\left(\frac{\cos ^{-1} \left(2R_{sno} -1\right)}{\pi } \right)^{N_{melt} } @@ -85,7 +84,7 @@ cell. Whenever :math:`W_{sno}` reaches zero, :math:`W_{\max }` is reset to zero. The depletion curve shape parameter is defined as .. math:: - :label: 8.16) + :label: 8.16 N_{melt} =\frac{200}{\min \left(10,\sigma _{topo} \right)} @@ -101,7 +100,7 @@ Ice Content The conservation equation for mass of ice in snow layers is .. math:: - :label: 8.17) + :label: 8.17 \frac{\partial w_{ice,\, i} }{\partial t} = \left\{\begin{array}{lr} @@ -117,7 +116,7 @@ is the change in ice due to phase change (melting rate) (section :numref:`Phase The term :math:`q_{ice,\, i-1}` is computed in two steps as .. math:: - :label: 8.18) + :label: 8.18 q_{ice,\, i-1} =q_{grnd,\, ice} +\left(q_{frost} -q_{subl} \right) @@ -130,14 +129,14 @@ interception (section :numref:`Canopy Water`), a new snow depth :math:`z_{sno}` calculated from .. math:: - :label: 8.19) + :label: 8.19 z_{sno}^{n+1} =z_{sno}^{n} +\Delta z_{sno} where .. math:: - :label: 8.20) + :label: 8.20 \Delta z_{sno} =\frac{q_{grnd,\, ice} \Delta t}{f_{sno} \rho _{sno} } @@ -145,7 +144,7 @@ and :math:`\rho _{sno}` is the bulk density of newly fallen snow (kg m\ :sup:`-3`) (:ref:`Anderson (1976) `) .. math:: - :label: 8.21) + :label: 8.21 \rho _{sno} = \left\{\begin{array}{lr} @@ -159,26 +158,27 @@ where :math:`T_{atm}` is the atmospheric temperature (K), and mass of snow :math:`W_{sno}` is .. math:: - :label: 8.22) + :label: 8.22 W_{sno}^{n+1} =W_{sno}^{n} +q_{grnd,\, ice} \Delta t. The ice content of the top layer and the layer thickness are updated as .. math:: - :label: 8.23) + :label: 8.23 w_{ice,\, snl+1}^{n+1} =w_{ice,\, snl+1}^{n} +q_{grnd,\, ice} \Delta t .. math:: - :label: 8.24) + :label: 8.24 \Delta z_{snl+1}^{n+1} =\Delta z_{snl+1}^{n} +\Delta z_{sno} . Since wetlands are modeled as columns of water (no soil), snow is not allowed to accumulate if the surface temperature is above freezing (:math:`T_{g} >T_{f}` ). In this case, the incoming solid precipitation -is assigned to the runoff term :math:`q_{rgwl}` (section :numref:`Runoff from glaciers and snow-capped surfaces`). +is assigned to the runoff term :math:`q_{rgwl}` (section +:numref:`Runoff from glaciers and snow-capped surfaces`). In the second step, after surface fluxes and snow/soil temperatures have been determined (Chapters :numref:`rst_Momentum, Sensible Heat, and Latent Heat @@ -186,7 +186,7 @@ Fluxes` and :numref:`rst_Soil and Snow Temperatures`), :math:`w_{ice,\, snl+1}` is updated for frost or sublimation as .. math:: - :label: ZEqnNum863244 + :label: 8.25 w_{ice,\, snl+1}^{n+1} =w_{ice,\, snl+1}^{n} +f_{sno} \left(q_{frost} -q_{subl} \right)\Delta t. @@ -209,7 +209,7 @@ Water Content The conservation equation for mass of water in snow layers is .. math:: - :label: 8.26) + :label: 8.26 \frac{\partial w_{liq,\, i} }{\partial t} =\left(q_{liq,\, i-1} -q_{liq,\, i} \right)+\frac{\left(\Delta w_{liq,\, i} \right)_{p} }{\Delta t} @@ -221,21 +221,22 @@ is the change in liquid water due to phase change (melting rate) (section :numref:`Phase Change`). For the top snow layer only, .. math:: - :label: 8.27) + :label: 8.27 q_{liq,\, i-1} =f_{sno} \left(q_{grnd,\, liq} +\left(q_{sdew} -q_{seva} \right)\right) where :math:`q_{grnd,\, liq}` is the rate of liquid precipitation reaching the snow (section :numref:`Canopy Water`), :math:`q_{seva}` is the evaporation of liquid water and :math:`q_{sdew}` is the liquid dew (section -5.4). After surface fluxes and snow/soil temperatures have been determined +:numref:`Update of Ground Sensible and Latent Heat Fluxes`). After surface +fluxes and snow/soil temperatures have been determined (Chapters :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes` and :numref:`rst_Soil and Snow Temperatures`), :math:`w_{liq,\, snl+1}` is updated for the liquid precipitation reaching the ground and dew or evaporation as .. math:: - :label: 8.28) + :label: 8.28 w_{liq,\, snl+1}^{n+1} =w_{liq,\, snl+1}^{n} +f_{sno} \left(q_{grnd,\, liq} +q_{sdew} -q_{seva} \right)\Delta t. @@ -250,7 +251,7 @@ water content. Thus, water flow between layers, :math:`q_{liq,\, i}` , for layers :math:`i=snl+1,\ldots ,0`, is initially calculated as .. math:: - :label: ZEqnNum767577 + :label: 8.29 q_{liq,\, i} =\frac{\rho _{liq} \left[\theta _{liq,\, i} -S_{r} \left(1-\theta _{ice,\, i} \right)\right]f_{sno} \Delta z_{i} }{\Delta t} \ge 0 @@ -258,12 +259,12 @@ where the volumetric liquid water :math:`\theta _{liq,\, i}` and ice :math:`\theta _{ice,\, i}` contents are .. math:: - :label: 8.30) + :label: 8.30 \theta _{ice,\, i} =\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} \rho _{ice} } \le 1 .. math:: - :label: 8.31) + :label: 8.31 \theta _{liq,\, i} =\frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} \rho _{liq} } \le 1-\theta _{ice,\, i} , @@ -275,14 +276,14 @@ calculated in equation , unless the underlying layer is the surface soil layer, as .. math:: - :label: 8.32) + :label: 8.32 q_{liq,\, i} \le \frac{\rho _{liq} \left[1-\theta _{ice,\, i+1} -\theta _{liq,\, i+1} \right]\Delta z_{i+1} }{\Delta t} \qquad i=snl+1,\ldots ,-1. The liquid water content :math:`w_{liq,\, i}` is updated as .. math:: - :label: ZEqnNum265203 + :label: 8.33 w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\left(q_{i-1} -q_{i} \right)\Delta t. @@ -307,29 +308,30 @@ eight particle species within each snow layer: hydrophilic black carbon, hydrophobic black carbon, hydrophilic organic carbon, hydrophobic organic carbon, and four species of mineral dust with the following particle sizes: 0.1-1.0, 1.0-2.5, 2.5-5.0, and 5.0-10.0 :math:`\mu m`. -Each of these species has unique optical properties (Table 3.5) and -meltwater removal efficiencies (:numref:`Table Meltwater scavenging`). +Each of these species has unique optical properties +(:numref:`Table Single-scatter albedo values used for snowpack impurities and ice`) +and meltwater removal efficiencies (:numref:`Table Meltwater scavenging`). The black carbon and organic carbon deposition rates described in Table 2.3 are combined into four categories as follows .. math:: - :label: 8.34) + :label: 8.34 D_{bc,\, hphil} =D_{bc,\, dryhphil} +D_{bc,\, wethphil} .. math:: - :label: 8.35) + :label: 8.35 D_{bc,\, hphob} =D_{bc,\, dryhphob} .. math:: - :label: 8.36) + :label: 8.36 D_{oc,\, hphil} =D_{oc,\, dryhphil} +D_{oc,\, wethphil} .. math:: - :label: 8.37) + :label: 8.37 D_{oc,\, hphob} =D_{oc,\, dryhphob} @@ -345,7 +347,7 @@ mass of each of the particle species :math:`\Delta m_{sp,\, i}` (kg m\ :sup:`-2`) is .. math:: - :label: 8.38) + :label: 8.38 \Delta m_{sp,\, i} =\left[k_{sp} \left(q_{liq,\, i-1} c_{sp,\, i-1} -q_{liq,\, i} c_{i} \right)+D_{sp} \right]\Delta t @@ -361,7 +363,7 @@ kg\ :sup:`-1`), :math:`D_{sp}` is the atmospheric deposition rate is the model time step (s). The particle mass mixing ratio is .. math:: - :label: 8.39) + :label: 8.39 c_{i} =\frac{m_{sp,\, i} }{w_{liq,\, i} +w_{ice,\, i} } . @@ -408,9 +410,16 @@ If there are no existing snow layers (:math:`snl+1=1`) but follows .. math:: - :label: 8.40) + :label: 8.40 - \begin{array}{l} {\Delta z_{0} =z_{sno} } \\ {z_{o} =-0.5\Delta z_{0} } \\ {z_{h,\, -1} =-\Delta z_{0} } \\ {T_{0} =\min \left(T_{f} ,T_{atm} \right)} \\ {w_{ice,\, 0} =W_{sno} } \\ {w_{liq,\, 0} =0} \end{array}. + \begin{array}{lcr} + \Delta z_{0} & = & z_{sno} \\ + z_{o} & = & -0.5\Delta z_{0} \\ + z_{h,\, -1} & = & -\Delta z_{0} \\ + T_{0} & = & \min \left(T_{f} ,T_{atm} \right) \\ + w_{ice,\, 0} & = & W_{sno} \\ + w_{liq,\, 0} & = & 0 + \end{array}. .. _Snow Compaction: @@ -429,14 +438,14 @@ each snow layer :math:`C_{R,\, i}` (s\ :sup:`-1`) is the sum of the three compaction processes .. math:: - :label: 8.41) + :label: 8.41 C_{R,\, i} =\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} =C_{R1,\, i} +C_{R2,\, i} +C_{R3,\, i} . Compaction is not allowed if the layer is saturated .. math:: - :label: 8.42) + :label: 8.42 1-\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} \rho _{ice} } +\frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} \rho _{liq} } \right)\le 0.001 @@ -446,19 +455,21 @@ or if the ice content is below a minimum value Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` (s\ :sub:`-1`) is temperature dependent (:ref:`Anderson (1976) `) .. math:: - :label: 8.43) + :label: 8.43 C_{R1,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{metamorphism} =-c_{3} c_{1} c_{2} \exp \left[-c_{4} \left(T_{f} -T_{i} \right)\right] where :math:`c_{3} =2.777\times 10^{-6}` (s\ :sup:`-1`) is the fractional compaction rate for :math:`T_{i} =T_{f}`, :math:`c_{4} =0.04` K\ :sup:`-1`, and .. math:: - :label: 8.44) + :label: 8.44 - c_{1} & = 1\qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \le 100{\rm \; kg\; m}^{{\rm -3}} \\ - c_{1} & = \exp \left[-0.046\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } -100\right)\right]\qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } >100{\rm \; kg\; m}^{{\rm -3}} \\ - c_{2} & = 2\qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } >0.01 \\ - c_{2} & = 1\qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } \le 0.01 + \begin{array}{lr} + c_{1} = 1 & \qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \le 100{\rm \; kg\; m}^{{\rm -3}} \\ + c_{1} = \exp \left[-0.046\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } -100\right)\right] & \qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } >100{\rm \; kg\; m}^{{\rm -3}} \\ + c_{2} = 2 & \qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } >0.01 \\ + c_{2} = 1 & \qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } \le 0.01 + \end{array} where :math:`{w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` @@ -469,14 +480,14 @@ are the bulk densities of liquid water and ice (kg m\ :sup:`-3`). The compaction rate as a result of overburden :math:`C_{R2,\; i}` (s\ :sup:`-1`) is a linear function of the snow load pressure :math:`P_{s,\, i}` (kg m\ :sup:`-2`) (:ref:`Anderson (1976) `) .. math:: - :label: 8.45) + :label: 8.45 C_{R2,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{overburden} =-\frac{P_{s,\, i} }{\eta } where :math:`\eta` is a viscosity coefficient (kg s m\ :sup:`-2`) that varies with density and temperature as .. math:: - :label: 8.46) + :label: 8.46 \eta =\eta _{0} \exp \left[c_{5} \left(T_{f} -T_{i} \right)+c_{6} \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \right] @@ -489,7 +500,7 @@ the ice :math:`w_{ice,\, i}` and liquid water contents water contents of the layer being compacted .. math:: - :label: 8.47) + :label: 8.47 P_{s,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{2} +\sum _{j=snl+1}^{j=i-1}\left(w_{ice,\, j} +w_{liq,\, j} \right) . @@ -497,7 +508,7 @@ The compaction rate due to melting :math:`C_{R3,\; i}` (s\ :sup:`-1`) is taken t mass after the melting to the mass before melting .. math:: - :label: 8.48) + :label: 8.48 C_{R3,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{melt} =-\frac{1}{\Delta t} \max \left(0,\frac{W_{sno,\, i}^{n} -W_{sno,\, i}^{n+1} }{W_{sno,\, i}^{n} } \right) @@ -507,14 +518,14 @@ covered area, the snow depth must also be updated for changes in :math:`f_{sno}` . .. math:: - :label: 8.49) + :label: 8.49 C_{R4,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{fsno} =-\frac{1}{\Delta t} \max \left(0,\frac{f_{sno,\, i}^{n} -f_{sno,\, i}^{n+1} }{f_{sno,\, i}^{n} } \right) The snow layer thickness after compaction is then .. math:: - :label: 8.50) + :label: 8.50 \Delta z_{i}^{n+1} =\Delta z_{i}^{n} \left(1+C_{R,\, i} \Delta t\right). @@ -559,12 +570,12 @@ liquid water and ice content of layer :math:`i` is combined with the underlying neighbor :math:`i+1` as .. math:: - :label: 8.51) + :label: 8.51 w_{liq,\, i+1} =w_{liq,\, i+1} +w_{liq,\, i} .. math:: - :label: 8.52) + :label: 8.52 w_{ice,\, i+1} =w_{ice,\, i+1} +w_{ice,\, i} . @@ -582,12 +593,12 @@ depth :math:`z_{sno}` are set to zero, otherwise, :math:`W_{sno}` and :math:`z_{sno}` are re-calculated as .. math:: - :label: 8.53) + :label: 8.53 W_{sno} =\sum _{i=snl+1}^{i=0}\left(w_{ice,\, i} +w_{liq,\, i} \right) .. math:: - :label: 8.54) + :label: 8.54 z_{sno} =\sum _{i=snl+1}^{i=0}\Delta z_{i} . @@ -603,26 +614,26 @@ When two snow layers are combined (denoted here as 1 and 2), their thickness combination (:math:`c`) is .. math:: - :label: ZEqnNum956014 + :label: 8.55 \Delta z_{c} =\Delta z_{1} +\Delta z_{2} , their mass combination is .. math:: - :label: 8.56) + :label: 8.56 w_{liq,\, c} =w_{liq,\, 1} +w_{liq,\, 2} .. math:: - :label: 8.57) + :label: 8.57 w_{ice,\, c} =w_{ice,\, 1} +w_{ice,\, 2} , and their temperatures are combined as .. math:: - :label: ZEqnNum325173 + :label: 8.58 T_{c} =T_{f} +\frac{h_{c} -L_{f} w_{liq,\, c} }{C_{ice} w_{ice,\, c} +C_{liq} w_{liq,\, c} } @@ -630,23 +641,24 @@ where :math:`h_{c} =h_{1} +h_{2}` is the combined enthalpy :math:`h_{i}` of the two layers where .. math:: - :label: 8.59) + :label: 8.59 h_{i} =\left(C_{ice} w_{ice,\, i} +C_{liq} w_{liq,\, i} \right)\left(T_{i} -T_{f} \right)+L_{f} w_{liq,\, i} . -In these equations, :math:`L_{f}` is the latent heat of fusion (J -kg\ :sup:`-1`) and :math:`C_{liq}` and :math:`C_{ice}` are the -specific heat capacities (J kg\ :sup:`-1` K\ :sup:`-1`) of -liquid water and ice, respectively (Table 2.6). After layer combination, -the node depths and layer interfaces (Figure 8.2) are recalculated from +In these equations, :math:`L_{f}` is the latent heat of fusion (J kg\ +:sup:`-1`) and :math:`C_{liq}` and :math:`C_{ice}` are the specific +heat capacities (J kg\ :sup:`-1` K\ :sup:`-1`) of liquid water and ice, +respectively (:numref:`Table Physical Constants`). After layer combination, +the node depths and layer interfaces (:numref:`Figure three layer snow pack`) +are recalculated from .. math:: - :label: ZEqnNum639853 + :label: 8.60 z_{i} =z_{h,\, i} -0.5\Delta z_{i} \qquad i=0,\ldots ,snl+1 .. math:: - :label: ZEqnNum295008 + :label: 8.61 z_{h,\, i-1} =z_{h,\, i} -\Delta z_{i} \qquad i=0,\ldots ,snl+1 @@ -703,16 +715,19 @@ constraining the new temperatures (:math:`T_{2}^{n+1}` , lower layer is first evaluated from .. math:: - :label: 8.62) + :label: 8.62 T'_{3} =T_{2}^{n} -\left(\frac{T_{1}^{n} -T_{2}^{n} }{{\left(\Delta z_{1}^{n} +\Delta z_{2}^{n} \right)\mathord{\left/ {\vphantom {\left(\Delta z_{1}^{n} +\Delta z_{2}^{n} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \right)\left(\frac{\Delta z_{2}^{n+1} }{2} \right), then adjusted as, .. math:: - :label: 8.63) + :label: 8.63 - \begin{array}{l} {T_{3}^{n+1} =T_{2}^{n} \qquad T'_{3} \ge T_{f} } \\ {T_{2}^{n+1} =T_{2}^{n} +\left(\frac{T_{1}^{n} -T_{2}^{n} }{{\left(\Delta z_{1} +\Delta z_{2}^{n} \right)\mathord{\left/ {\vphantom {\left(\Delta z_{1} +\Delta z_{2}^{n} \right) 2}} \right. \kern-\nulldelimiterspace} 2} } \right)\left(\frac{\Delta z_{2}^{n+1} }{2} \right)\qquad T'_{3} Date: Thu, 1 Jun 2017 14:07:59 -0600 Subject: [PATCH 0037/1973] Add anomaly forcing subsection --- .../Glacier/CLM50_Tech_Note_Glacier.rst | 23 ++++-- .../Offline/CLM50_Tech_Note_Offline.rst | 73 ++++++++++++++----- 2 files changed, 73 insertions(+), 23 deletions(-) diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index 6ba68086db..fa25eeb5c8 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -5,9 +5,13 @@ Glaciers This chapter describes features of CLM that are specific to coupling to an ice sheet model (in the CESM context, this is the Glimmer-CISM model; -Lipscomb and Sacks (2012) provide documentation and user’s guide for -Glimmer-CISM). General information about glacier land units can be found -elsewhere in this document (see Chapter 2 for an overview). +:ref:`Lipscomb and Sacks (2012)` provide documentation +and user’s guide for Glimmer-CISM). General information about glacier +land units can be found elsewhere in this document (see Chapter +:numref:`rst_Surface Characterization, Vertical Discretization, and +Model Input Requirements` for an overview). + +.. _Overview: Overview ------------- @@ -16,7 +20,8 @@ CLM is responsible for computing three quantities that are passed to the ice sheet model: #. Surface mass balance (SMB) – the net annual accumulation/ablation of - mass at the upper surface (section 10.3) + mass at the upper surface (section + :numref:`Computation of the surface mass balance`) #. Ground surface temperature, which serves as an upper boundary condition for Glimmer-CISM’s temperature calculation @@ -47,7 +52,8 @@ Glimmer-CISM: improvements to the CLM are applied to ice sheets automatically. #. The atmosphere model can respond during runtime to ice-sheet surface - changes. As shown by Pritchard et al. (2008), runtime albedo feedback + changes. As shown by :ref:`Pritchard et al. (2008)`, + runtime albedo feedback from the ice sheet is critical for simulating ice-sheet retreat on paleoclimate time scales. Without this feedback the atmosphere warms much less, and the retreat is delayed. @@ -71,11 +77,14 @@ which ice-sheet elevation changes are modest. For longer runs with larger elevation changes, two-way coupling is highly desirable. A two-way coupling scheme is under development. +.. _Multiple elevation class scheme: + Multiple elevation class scheme ------------------------------------ In the typical operation of CLM, the glacier land unit contains a single -column (section 2.1.1). However, when running CESM with an active ice +column (section :numref:`Surface Heterogeneity and Data Structure`). +However, when running CESM with an active ice sheet model, the glacier land unit is replaced by a glacier\_mec land unit, where “mec” denotes “multiple elevation classes”. In most ways, glacier\_mec land units behave the same as standard glacier land units. @@ -119,6 +128,8 @@ elevation classes. Some columns may have zero area and are called the land and the atmosphere, but are included for potential forcing of Glimmer-CISM. +.. _Computation of the surface mass balance: + Computation of the surface mass balance -------------------------------------------- diff --git a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst index e4e2db66fa..da2788a5f9 100644 --- a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst +++ b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst @@ -51,9 +51,12 @@ solar radiation supplied by the six-hourly forcing data is actually used. The solar radiation at model time step :math:`t_{M}` is .. math:: - :label: ZEqnNum160435 + :label: 31.1 - \begin{array}{l} {S_{atm} \left(t_{M} \right)=\frac{\frac{\Delta t_{FD} }{\Delta t_{M} } S_{atm} \left(t_{FD} \right)\mu \left(t_{M} \right)}{\sum _{i=1}^{\frac{\Delta t_{FD} }{\Delta t_{M} } }\mu \left(t_{M_{i} } \right) } \qquad {\rm for\; }\mu \left(t_{M} \right)>0.001} \\ {S_{atm} \left(t_{M} \right)=0\qquad {\rm for\; }\mu \left(t_{M} \right)\le 0.001} \end{array} + \begin{array}{lr} + S_{atm} \left(t_{M} \right)=\frac{\frac{\Delta t_{FD} }{\Delta t_{M} } S_{atm} \left(t_{FD} \right)\mu \left(t_{M} \right)}{\sum _{i=1}^{\frac{\Delta t_{FD} }{\Delta t_{M} } }\mu \left(t_{M_{i} } \right) } & \qquad {\rm for\; }\mu \left(t_{M} \right)>0.001 \\ + S_{atm} \left(t_{M} \right)=0 & \qquad {\rm for\; }\mu \left(t_{M} \right)\le 0.001 + \end{array} where :math:`\Delta t_{FD}` is the time step of the forcing data (6 hours :math:`\times` 3600 seconds hour\ :sup:`-1` = 21600 @@ -73,22 +76,22 @@ derived from one year’s worth of hourly CAM output from CAM version cam3\_5\_55 as .. math:: - :label: 31.2) + :label: 31.2 S_{atm} \, \downarrow _{vis}^{\mu } =R_{vis} \left(\alpha S_{atm} \right) .. math:: - :label: 31.3) + :label: 31.3 S_{atm} \, \downarrow _{nir}^{\mu } =R_{nir} \left[\left(1-\alpha \right)S_{atm} \right] .. math:: - :label: 31.4) + :label: 31.4 S_{atm} \, \downarrow _{vis} =\left(1-R_{vis} \right)\left(\alpha S_{atm} \right) .. math:: - :label: 31.5) + :label: 31.5 S_{atm} \, \downarrow _{nir} =\left(1-R_{nir} \right)\left[\left(1-\alpha \right)S_{atm} \right]. @@ -96,7 +99,7 @@ where :math:`\alpha` , the ratio of visible to total incident solar radiation, is assumed to be .. math:: - :label: 31.6) + :label: 31.6 \alpha =\frac{S_{atm} \, \downarrow _{vis}^{\mu } +S_{atm} \, \downarrow _{vis}^{} }{S_{atm} } =0.5. @@ -104,14 +107,14 @@ The ratio of direct to total incident radiation in the visible :math:`R_{vis}` is .. math:: - :label: 31.7) + :label: 31.7 R_{vis} =a_{0} +a_{1} \times \alpha S_{atm} +a_{2} \times \left(\alpha S_{atm} \right)^{2} +a_{3} \times \left(\alpha S_{atm} \right)^{3} \qquad 0.01\le R_{vis} \le 0.99 and in the near-infrared :math:`R_{nir}` is .. math:: - :label: 31.8) + :label: 31.8 R_{nir} =b_{0} +b_{1} \times \left(1-\alpha \right)S_{atm} +b_{2} \times \left[\left(1-\alpha \right)S_{atm} \right]^{2} +b_{3} \times \left[\left(1-\alpha \right)S_{atm} \right]^{3} \qquad 0.01\le R_{nir} \le 0.99 @@ -129,17 +132,17 @@ The potential temperature :math:`\overline{\theta _{atm} }` (K) is set to the atmospheric temperature :math:`T_{atm}` . The atmospheric longwave radiation :math:`L_{atm} \, \downarrow` (W m\ :sup:`-2`) is derived from the atmospheric vapor pressure :math:`e_{atm}` and -temperature :math:`T_{atm}` (Idso 1981) as +temperature :math:`T_{atm}` (:ref:`Idso 1981`) as .. math:: - :label: 31.9) + :label: 31.9 L_{atm} \, \downarrow =\left[0.70+5.95\times 10^{-5} \times 0.01e_{atm} \exp \left(\frac{1500}{T_{atm} } \right)\right]\sigma T_{atm}^{4} where .. math:: - :label: 31.10) + :label: 31.10 e_{atm} =\frac{P_{atm} q_{atm} }{0.622+0.378q_{atm} } @@ -149,19 +152,19 @@ precipitation :math:`P` (mm s\ :sup:`-1`) falling as rain and/or snow is .. math:: - :label: ZEqnNum336485 + :label: 31.11 q_{rain} =P\left(f_{P} \right), .. math:: - :label: 31.12) + :label: 31.12 q_{snow} =P\left(1-f_{P} \right) where .. math:: - :label: 31.13) + :label: 31.13 f_{P} =0<0.5\left(T_{atm} -T_{f} \right)<1. @@ -177,7 +180,7 @@ user-supplied relative humidity :math:`RH` (%) and derive specific humidity :math:`q_{atm}` (kg kg\ :sup:`-1`) from .. math:: - :label: 31.14) + :label: 31.14 q_{atm} =\frac{0.622e_{atm} }{P_{atm} -0.378e_{atm} } @@ -193,7 +196,7 @@ temperature :math:`T_{dew}` (K) and derive specific humidity :math:`q_{atm}` from .. math:: - :label: 31.15) + :label: 31.15 q_{atm} = \frac{0.622e_{sat}^{T_{dew} } }{P_{atm} -0.378e_{sat}^{T_{dew} } } . @@ -211,3 +214,39 @@ the procedure described above and then each term equally apportioned into the visible and near-infrared wavebands (e.g., :math:`S_{atm} \, \downarrow _{vis}^{\mu } =0.5S_{atm} \, \downarrow ^{\mu }` , :math:`S_{atm} \, \downarrow _{nir}^{\mu } =0.5S_{atm} \, \downarrow ^{\mu }` ). + +.. _Anomaly Forcing: + +Anomaly Forcing +----------------------------- + +The 'Anomaly Forcing' atmospheric forcing mode provides a means to drive +CLM with projections of future climate conditions without the need for +large, high-frequency datasets. From an existing climate simulation +spanning both the historical and future time periods, a set of anomalies +are created by removing a climatological seasonal cycle based on the end +of the historical period from each year of the future time period of the +simulation. These anomalies can then be applied to a repeating +high-frequency forcing dataset of finite duration (e.g. 10 years). State +and flux forcing variables are adjusted using additive and multiplicative +anomalies, respectively: + +.. math:: + :label: 31.16 + + \begin{array}{lr} + S^{'} = S + k_{anomaly} & \quad {\rm state \ variable} \\ + F^{'} = f * k_{anomaly} & \quad {\rm flux \ variable} + \end{array} + +where :math:`S^{'}` is the adjusted atmospheric state variable, :math:`S` +is the state variable from the high-frequency reference atmospheric +forcing dataset, and :math:`k_{anomaly}` is an additive anomaly. +Similarly, math:`F^{'}` is the adjusted atmospheric flux variable, +:math:`F` is the flux variable from the high-frequency reference +atmospheric forcing dataset, and :math:`k_{anomaly}` is a +multiplicative anomaly. State variables are temperature :math:`T_{atm}`, +pressure :math:`P_{atm}`, humidity :math:`q_{atm}`, and wind +:math:`W_{atm}`. Flux variables are precipitation :math:`P`, atmospheric +shortwave radiation :math:`S_{atm} \, \downarrow`, and atmospheric +longwave radiation :math:`L_{atm} \, \downarrow`. From e92ef848265e40a16d1eccac7505286192a78e92 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 2 Jun 2017 09:30:57 -0600 Subject: [PATCH 0038/1973] Update Hydrology Chapter --- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 108 +++++++++++------- 1 file changed, 65 insertions(+), 43 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 0db3456163..4e203f8586 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -186,14 +186,14 @@ by the saturation excess mechanism (Dunne runoff) .. math:: :label: 7.64 - q_{over} =f_{sat} q_{liq,\, 0} + q_{over} =f_{sat} \ q_{liq,\, 0} The fractional saturated area is a function of soil moisture .. math:: :label: 7.65 - f_{sat} = f_{\max } \exp \left(-0.5 f_{over} z_{\nabla } \right) + f_{sat} = f_{\max } \ \exp \left(-0.5 f_{over} z_{\nabla } \right) where :math:`f_{\max }` is the potential or maximum value of :math:`f_{sat}`, :math:`f_{over}` is a decay factor (m\ :sup:`-1`), and @@ -248,7 +248,7 @@ height (relative to the grid cell mean elevation) of the surface water, W_{sfc} =\frac{d}{2} \left(1+erf\left(\frac{d}{\sigma _{micro} \sqrt{2} } \right)\right)+\frac{\sigma _{micro} }{\sqrt{2\pi } } e^{\frac{-d^{2} }{2\sigma _{micro} ^{2} } } where :math:`erf` is the error function. For a given value of -:math:`W_{sfc}` , equation can be solved for :math:`d` using the +:math:`W_{sfc}`, :eq:`7.66` can be solved for :math:`d` using the Newton-Raphson method. Once :math:`d` is known, one can determine the fraction of the area that is inundated as @@ -267,7 +267,7 @@ parameterization is a simple function of slope where :math:`\beta` is the topographic slope, :math:`\beta _{0} =\left(\sigma _{\max } \right)^{\frac{1}{\eta } }` \ determines -the maximum value of :math:`\sigma _{}` , and :math:`\eta` is an +the maximum value of :math:`\sigma _{micro}` , and :math:`\eta` is an adjustable parameter. Default values in the model are :math:`\sigma _{\max } =0.4` and :math:`\eta =-3`. @@ -292,12 +292,12 @@ reservoir .. math:: :label: 7.70 - qout,h2osfc=kh2osfcf_{connected} (Wsfc-Wc)\frac{1}{\Delta t} + q_{out,h2osfc}=k_{h2osfc} \ f_{connected} \ (Wsfc-Wc)\frac{1}{\Delta t} -where :math:`qout,h2osfc` is the surface water runoff, :math:`kh2osfc` +where :math:`q_{out,h2osfc}` is the surface water runoff, :math:`k_{h2osfc}` is a constant, :math:`Wc` is the amount of surface water present when -:math:`f_{h2osfc} =f_{c}` , and :math:`\Delta t` is the model time step. -The linear storage coefficent :math:`kh2osfc=\sin \left(\beta \right)` +:math:`f_{h2osfc} = f_{c}` , and :math:`\Delta t` is the model time step. +The linear storage coefficent :math:`k_{h2osfc} = \sin \left(\beta \right)` is a function of grid cell mean topographic slope where :math:`\beta` is the slope in radians. @@ -312,7 +312,7 @@ removed, .. math:: :label: 7.71 - qin,surface=(1-f_{sat} )q_{liq,\, 0} + q_{in,surface} = (1-f_{sat}) \ q_{liq,\, 0} is divided into inputs to surface water (:math:`q_{in,\, h2osfc}` ) and the soil :math:`q_{in,soil}` . If :math:`q_{in,soil}` exceeds the @@ -322,10 +322,11 @@ s\ :sup:`-1`), .. math:: :label: 7.72 - q_{infl,\, \max } =(1-fsat){\rm \Theta }iceksat + q_{infl,\, \max } =(1-f_{sat}) \ \Theta_{ice} k_{sat} -where :math:`{\rm \Theta }ice` is an ice impedance factor (section -:numref:`Hydraulic Properties`), infiltration excess (Hortonian) runoff is generated +where :math:`\Theta_{ice}` is an ice impedance factor (section +:numref:`Hydraulic Properties`), infiltration excess (Hortonian) runoff +is generated .. math:: :label: 7.73 @@ -338,28 +339,28 @@ After evaporative losses have been removed, these moisture fluxes are .. math:: :label: 7.74 - q_{in,\, h2osfc} =f_{h2osfc} q_{in,surface} +q_{infl,excess} -q_{evap,h2osfc} + q_{in,\, h2osfc} =f_{h2osfc} q_{in,surface} + q_{infl,excess} - q_{evap,h2osfc} and .. math:: :label: 7.75 - qin,soil=(1-f_{h2osfc} )q_{in,surface} -q_{\inf l,excess} -(1-f_{sno} -f_{h2osfc} )qevap,soil. + q_{in,soil} = (1-f_{h2osfc}) q_{in,surface} - q_{\inf l,excess} - (1 - f_{sno} - f_{h2osfc} ) q_{evap,soil}. The balance of surface water is then calculated as .. math:: :label: 7.76 - \Delta W_{sfc} =\left(qin,h2osfc-qout,h2osfc-qdrain,h2osfc\right)\Delta t. + \Delta W_{sfc} =\left(q_{in,h2osfc} - q_{out,h2osfc} - q_{drain,h2osfc} \right) \ \Delta t. Bottom drainage from the surface water store .. math:: :label: 7.77 - qdrain,h2osfc=\min \left(f_{h2osfc} q_{\inf l,\max } ,\frac{W_{sfc} }{\Delta t} \right) + q_{drain,h2osfc} = \min \left(f_{h2osfc} q_{\inf l,\max } ,\frac{W_{sfc} }{\Delta t} \right) is then added to :math:`q_{in,soil}` giving the total infiltration into the surface soil layer @@ -367,7 +368,7 @@ into the surface soil layer .. math:: :label: 7.78 - q_{infl} =q_{in,soil} +q_{drain,h2osfc} + q_{infl} = q_{in,soil} + q_{drain,h2osfc} Infiltration :math:`q_{infl}` and explicit surface runoff :math:`q_{over}` are not allowed for glaciers. @@ -469,27 +470,34 @@ and organic properties of the soil (:ref:`Lawrence and Slater 2008 `). The hydraulic conductivity is defined at the depth of the interface of -two adjacent layers :math:`z_{h,\, i}` (:numref:`Figure Water flux schematic`) and is a function -of the saturated hydraulic conductivity +two adjacent layers :math:`z_{h,\, i}` (:numref:`Figure Water flux schematic`) +and is a function of the saturated hydraulic conductivity :math:`k_{sat} \left[z_{h,\, i} \right]`, the liquid volumetric soil -moisture of the two layers :math:`\theta _{i}` and -:math:`\theta _{i+1}` and an ice impedance factor -:math:`\Theta _{ice}` +moisture of the two layers :math:`\theta_{i}` and +:math:`\theta_{i+1}` and an ice impedance factor +:math:`\Theta_{ice}` .. math:: :label: 7.85 k\left[z_{h,\, i} \right] = \left\{\begin{array}{lr} - \Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +3} & \qquad 1 \le i \le N_{levsoi} - 1 \\ - \Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{2B_{i} +3} & \qquad i = N_{levsoi} + \Theta_{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta_{\, i} +\theta_{\, i+1} \right)}{0.5\left(\theta_{sat,\, i} +\theta_{sat,\, i+1} \right)} \right]^{2B_{i} +3} & \qquad 1 \le i \le N_{levsoi} - 1 \\ + \Theta_{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta_{\, i} }{\theta_{sat,\, i} } \right)^{2B_{i} +3} & \qquad i = N_{levsoi} \end{array}\right\}. The ice impedance factor is a function of ice content, and is meant to quantify the increased tortuosity of the water flow when part of the pore space is filled with ice. :ref:`Swenson et al. (2012) ` -used a power law form :math:`\Theta _{ice} = 10^{-\Omega F_{ice} }` where -:math:`\Omega = 6`\ and +used a power law form + +.. math:: + :label: 7.86 + + \Theta _{ice} = 10^{-\Omega F_{ice}} + +where +:math:`\Omega = 6` and :math:`F_{ice} = \frac{\theta_{ice} }{\theta_{sat} }` is the ice-filled fraction of the pore space. @@ -512,7 +520,7 @@ porosity of organic matter and the porosity of the mineral soil .. math:: :label: 7.91 - \theta _{sai,\min ,i} = 0.489 - 0.00126(\% sand)_{i} . + \theta _{sat,\min ,i} = 0.489 - 0.00126(\% sand)_{i} . The exponent :math:`B_{i}` is @@ -566,10 +574,10 @@ fractions using a result from percolation theory (:ref:`Stauffer and Aharony 1994 `, :ref:`Berkowitz and Balberg 1992 `). Assuming that the organic and mineral fractions are randomly distributed throughout a soil layer, percolation theory predicts that above a threshold value -:math:`f_{om} =f_{threshold}` , connected flow pathways consisting of +:math:`f_{om} =f_{threshold}`, connected flow pathways consisting of organic material only exist and span the soil space. Flow through these pathways interacts only with organic material, and thus can be described -by :math:`k_{sat,\, om}` . This fraction of the grid cell is given by +by :math:`k_{sat,\, om}`. This fraction of the grid cell is given by .. math:: :label: 7.97 @@ -714,7 +722,7 @@ and :math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total soil column for the :math:`j^{th}` PFT (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). -The soil water fluxes in equation , which are a function of +The soil water fluxes in :eq:`7.103`, which are a function of :math:`\theta _{liq,\, i}` and :math:`\theta _{liq,\, i+1}` because of their dependence on hydraulic conductivity and soil matric potential, can be linearized about :math:`\theta` using a Taylor series expansion @@ -730,8 +738,8 @@ as q_{i-1}^{n+1} =q_{i-1}^{n} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } \Delta \theta _{liq,\, i-1} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} . -Substitution of these expressions for :math:`q_{i}^{n+1}` and -:math:`q_{i-1}^{n+1}` into equation results in a general tridiagonal +Substitution of these expressions for :math:`q_{i}^{n+1}` and +:math:`q_{i-1}^{n+1}` into equation :eq:`7.103` results in a general tridiagonal equation set of the form .. math:: @@ -765,40 +773,40 @@ The tridiagonal equation set is solved over :math:`i=1,\ldots ,N_{levsoi}`. The finite-difference forms of the fluxes and partial derivatives in -equations - can be obtained from equation as +equations :eq:`7.111` - :eq:`7.114` can be obtained from :eq:`7.80` as .. math:: :label: 7.115 - q_{i-1}^{n} =-k\left[z_{h,\, i-1} \right]\left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] + q_{i-1}^{n} =-k\left[z_{h,\, i-1} \right]\left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: :label: 7.116 - q_{i}^{n} =-k\left[z_{h,\, i} \right]\left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] + q_{i}^{n} =-k\left[z_{h,\, i} \right]\left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} -z_{i} } \right] .. math:: :label: 7.117 - \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } =-\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, i-1} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] + \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } =-\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, i-1} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} - z_{i-1} } \right] .. math:: :label: 7.118 - \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } =\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] + \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } =\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} - z_{i-1} } \right] .. math:: :label: 7.119 - \frac{\partial q_{i} }{\partial \theta _{liq,\, i} } =-\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] + \frac{\partial q_{i} }{\partial \theta _{liq,\, i} } =-\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} - z_{i} } \right] .. math:: :label: 7.120 - \frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } =\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right]. + \frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } =\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} - z_{i} } \right]. The derivatives of the soil matric potential at the node depth are -derived from equation +derived from :eq:`7.94` .. math:: :label: 7.121 @@ -819,17 +827,31 @@ with the constraint :math:`0.01\, \theta _{sat,\, i} \le \theta _{\, i} \le \theta _{sat,\, i}` . The derivatives of the hydraulic conductivity at the layer interface are -derived from equation +derived from :eq:`7.85` + +.. check eqn .. math:: :label: 7.124 - \begin{array}{l} {\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } =\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } =\left(1-\frac{f_{frz,\, i-1} +f_{frz,\, i} }{2} \right)\left(2B_{i-1} +3\right)k_{sat} \left[z_{h,\, i-1} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i-1} +\theta _{\, i} \right)}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right]^{2B_{i-1} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right)} \end{array} + \begin{array}{l} + {\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } + = \frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } + = \left(2B_{i-1} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i-1} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i-1} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array} + +where :math:`\overline{\theta}_{liq} = 0.5\left(\theta _{\, i-1} +\theta _{\, i} \right)`, +:math:`\overline{\theta}_{sat} = 0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)`, +and :math:`\overline{\Theta}_{ice} = \Theta_{ice}(\overline{\theta}_{ice})` :eq:`7.86` + +and .. math:: :label: 7.125 - \begin{array}{l} {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } =\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } =\left(1-\frac{f_{frz,\, i} +f_{frz,\, i+1} }{2} \right)\left(2B_{i} +3\right)k_{sat} \left[z_{h,\, i} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right)} \end{array}. + \begin{array}{l} + {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } + = \frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } + = \left(2B_{i} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array}. Equation set for layer :math:`i=1` '''''''''''''''''''''''''''''''''''''''''' From 4a9c173c03674dce7078118106d573d979df5961 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 2 Jun 2017 09:42:44 -0600 Subject: [PATCH 0039/1973] correct reference in crop --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 55 ++++++++++--------- .../CLM50_Tech_Note_Introduction.rst | 2 +- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 2961569d3a..f5acbeca61 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -103,8 +103,8 @@ described by Levis et al. (:ref:`2016 `). A parameterization for winter cereals is developed but is not included in CLM5.0 due to the inability to distinguish between winter and summer cereals in the LUMIP dataset (insert citation). -CLM’s default list of plant functional types (pfts) includes an -unmanaged crop (Table 2.1) treated as a second C3 grass, as well as several +CLM’s default list of plant functional types (pfts) includes an unmanaged crop +(:numref:`Table Plant functional types`) treated as a second C3 grass, as well as several additional crop types that do not have associated parameters. The unmanaged crop has grid cell coverage assigned from satellite data, as do all natural pfts when CLM’s crop model is not active. [include remapping text here]. @@ -135,7 +135,7 @@ Corn and temperate cereals must meet the following requirements between April 1\ :sup:`st` and June 14\ :sup:`th` for planting in the northern hemisphere (NH): .. math:: - :label: ZEqnNum568682 + :label: 25.1 \begin{array}{l} {T_{10d} >T_{p} } \\ @@ -174,7 +174,7 @@ for the crop to reach vegetative and physiological maturity, :math:`{GDD}_{mat}`, according to the following AgroIBIS rules: .. math:: - :label: 25.2) + :label: 25.2 \begin{array}{l} {GDD_{{\rm mat}}^{{\rm corn}} =0.85GDD_{{\rm 8}} {\rm \; \; \; and\; \; \; 950}30} \end{array}\right\} .. math:: - :label: 25.13) + :label: 25.13 fxg=\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad \qquad {\rm for\; }GDD_{T_{2m} } \le 0.15} \\ {6.67\times GDD_{T_{2m} } -1\qquad \qquad \qquad {\rm for\; }0.150.75} \end{array}\right\} @@ -736,17 +737,17 @@ mobilized depends on the C:N ratio of the plant tissue, and is calculated as .. math:: - :label: 25.14) + :label: 25.14 leaf\_ to\_ retransn=\frac{c_{leaf} }{CN_{leaf} } -\frac{c_{leaf} }{CN_{leaf}^{f} } .. math:: - :label: 25.15) + :label: 25.15 stemn\_ to\_ retransn=\frac{c_{stem} }{CN_{stem} } -\frac{c_{stem} }{CN_{stem}^{f} } .. math:: - :label: 25.16) + :label: 25.16 frootn\_ to\_ retransn=\frac{c_{froot} }{CN_{froot} } -\frac{c_{froot} }{CN_{froot}^{f} } diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 29892825d8..027d92e9e2 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -136,7 +136,7 @@ Jinyun Tang, Zong-Liang Yang** - :numref:`Figure Water flux schematic` Schematic diagram of numerical scheme used to solve for soil water fluxes. -- :numref:`three layer snow pack` Example of three layer snow pack (snl=-3). +- :numref:`Figure three layer snow pack` Example of three layer snow pack (snl=-3). - :numref:`Figure Schematic representation of the urban landunit` Schematic representation of the urban land unit. From 779cab3a879ac6ef875b18649d6dbd6b60543c50 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 2 Jun 2017 11:11:03 -0600 Subject: [PATCH 0040/1973] add new snow density equations --- .../References/CLM50_Tech_Note_References.rst | 7 +++++ .../CLM50_Tech_Note_Snow_Hydrology.rst | 30 +++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index dfb4b81d9c..73691897a2 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1885,6 +1885,13 @@ van Veen, J.A., Ladd, J.N. and Frissel, M.J., 1984. Modelling C and N turnover through the microbial biomass in soil. Plant and Soil, 76: 257-274. +.. _vanKampenhoutetal2017: + +van Kampenhout, L., J.T.M. Lenaerts, W.H. Lipscomb, W.J. Sacks, D.M. +Lawrence, A.G. Slater, and M.R. van den Broeke, 2017. +Improving the representation of polar snow and firn in the +Community Earth System Model, submitted. + .. _VanVuurenetal2006: Van Vuuren, D.P., Lucas, P.S., and Hilderink, H.B.M., 2006. Downscaling diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index 5f87ec2f1a..a97e161526 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -141,21 +141,39 @@ where \Delta z_{sno} =\frac{q_{grnd,\, ice} \Delta t}{f_{sno} \rho _{sno} } and :math:`\rho _{sno}` is the bulk density of newly fallen snow (kg -m\ :sup:`-3`) (:ref:`Anderson (1976) `) +m\ :sup:`-3`) (:ref:`van Kampenhout et al. (2017) `, +:ref:`Anderson (1976) `) .. math:: :label: 8.21 - \rho _{sno} = + \rho_{sno} = \left\{\begin{array}{lr} 50 + 1.7 \left(17\right)^{1.5} & \qquad T_{atm} >T_{f} +2 \ \\ 50+1.7 \left(T_{atm} -T_{f} + 15\right)^{1.5} & \qquad T_{f} - 15 < T_{atm} \le T_{f} + 2 \ \\ - 50 &\qquad T_{atm} \le T_{f} - 15 + -3.833 \ \left( T_{atm} -T_{f} \right) - 0.0333 \ \left( T_{atm} -T_{f} \right)^{2} + &\qquad T_{atm} \le T_{f} - 15 \end{array}\right\} -where :math:`T_{atm}` is the atmospheric temperature (K), and -:math:`T_{f}` is the freezing temperature of water (K) (Table 2.6). The -mass of snow :math:`W_{sno}` is +.. bifall(c) = -(50._r8/15._r8 + 0.0333_r8*15_r8)*(forc_t(c)-tfrz) - 0.0333_r8*(forc_t(c)-tfrz)**2 + +where :math:`T_{atm}` is the atmospheric temperature (K), and :math:`T_{f}` is +the freezing temperature of water (K) (:numref:`Table Physical Constants`). When +wind speed :math:`W_{atm}` is greater than 0.1 m :sub:`-1`, snow density +increases due to wind-driven compaction according to +:ref:`(van Kampenhout et al. 2017) ` + +.. math:: + :label: 8.21b + + \Delta \rho_{sno} = 266.861 \left(\frac{1 + tanh(\frac{W_{atm}}{5})}{2}\right)^{8.8} + +where :math:`\Delta \rho_{sno}` (kg m\ :sup:`-3`) is the increase in snow +density relative to :eq:`8.21`. + +.. bifall(c) = bifall(c) + (266.861_r8 * ((1._r8 + TANH(forc_wind(g)/5.0_r8))/2._r8)**8.8_r8) + +The mass of snow :math:`W_{sno}` is .. math:: :label: 8.22 From 84cedaf9968119bd9b4c0a9e47b4729a8a67fa35 Mon Sep 17 00:00:00 2001 From: Justin Perket Date: Fri, 2 Jun 2017 16:01:29 -0600 Subject: [PATCH 0041/1973] Added descriptions of canopy snow hydrology and albedo. And fixed a couple typos --- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 2 +- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 520 ++++++++++-------- .../References/CLM50_Tech_Note_References.rst | 15 +- .../CLM50_Tech_Note_Surface_Albedos.rst | 23 +- 4 files changed, 315 insertions(+), 245 deletions(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index df44ae6fe1..e8b78225dc 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -906,7 +906,7 @@ of the components in the coupled modeling system, are presented in "Molecular weight of water vapor", :math:`MW_{wv}`, 18.016, kg kmol :sup:`-1` "Water vapor gas constant", :math:`R_{wv}`, :math:`{R_{gas} \mathord{\left/ {\vphantom {R_{gas} MW_{wv} }} \right. \kern-\nulldelimiterspace} MW_{wv} }`, J K :sup:`-1` kg :sup:`-1` "Von Karman constant", :math:`k`, 0.4, "\-" - "Freezing temperature of fresh water", :math:`T_{f}`, 273.5, K + "Freezing temperature of fresh water", :math:`T_{f}`, 273.15, K "Density of liquid water", :math:`\rho _{liq}`, 1000, kg m :sup:`-3` "Density of ice", :math:`\rho _{ice}`, 917, kg m :sup:`-3` "Specific heat capacity of dry air", :math:`C_{p}`, 1.00464 :math:`\times 10^{3}`, J kg :sup:`-1` K :sup:`-1` diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 4e203f8586..e86d47e701 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -7,8 +7,9 @@ The model parameterizes interception, throughfall, canopy drip, snow accumulation and melt, water transfer between snow layers, infiltration, evaporation, surface runoff, sub-surface drainage, redistribution within the soil column, and groundwater discharge and recharge to simulate -changes in canopy water :math:`\Delta W_{can}` , surface water -:math:`\Delta W_{sfc}` , snow water :math:`\Delta W_{sno}` , soil water +changes in canopy water :math:`\Delta W_{can,\,liq}` , canopy snow water +:math:`\Delta W_{can,\,sno}` surface water :math:`\Delta W_{sfc}` , +snow water :math:`\Delta W_{sno}` , soil water :math:`\Delta w_{liq,\, i}` , and soil ice :math:`\Delta w_{ice,\, i}` , and water in the unconfined aquifer :math:`\Delta W_{a}` (all in kg m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (:numref:`Figure Hydrologic processes`). @@ -16,9 +17,9 @@ m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (:numref:`Figure Hydrologic processes`). The total water balance of the system is .. math:: - :label: 7.1 + :label: 7.1) - \begin{array}{l} {\Delta W_{can} +\Delta W_{sfc} +\Delta W_{sno} +} \\ {\sum _{i=1}^{N_{levsoi} }\left(\Delta w_{liq,\, i} +\Delta w_{ice,\, i} \right)+\Delta W_{a} =\left(\begin{array}{l} {q_{rain} +q_{sno} -E_{v} -E_{g} -q_{over} } \\ {-q_{h2osfc} -q_{drai} -q_{rgwl} -q_{snwcp,\, ice} } \end{array}\right) \Delta t} \end{array} + \begin{array}{l} {\Delta W_{can,\,liq} +\Delta W_{can,\,sno} +\Delta W_{sfc} +\Delta W_{sno} +} \\ {\sum _{i=1}^{N_{levsoi} }\left(\Delta w_{liq,\, i} +\Delta w_{ice,\, i} \right)+\Delta W_{a} =\left(\begin{array}{l} {q_{rain} +q_{sno} -E_{v} -E_{g} -q_{over} } \\ {-q_{h2osfc} -q_{drai} -q_{rgwl} -q_{snwcp,\, ice} } \end{array}\right) \Delta t} \end{array} where :math:`q_{rain}` is the liquid part of precipitation, :math:`q_{sno}` is the solid part of precipitation, :math:`E_{v}` is @@ -31,8 +32,8 @@ from glaciers, wetlands, and lakes, and runoff from other surface types due to snow capping (section :numref:`Runoff from glaciers and snow-capped surfaces`) (all in kg m\ :sup:`-2` s\ :sup:`-1`), :math:`N_{levsoi}` is the number of soil layers (note that hydrology calculations are only done over soil layers 1 to -:math:`N_{levsoi}` ; ground levels :math:`N_{levsoi} +1`\ to -:math:`N_{levgrnd}` are currently hydrologically inactive; :ref:`(Lawrence et +:math:`N_{levsoi}` ; ground levels :math:`N_{levsoi} +1` \ to +:math:`N_{levgrnd}` are currently hydrologically inactive; :ref:`(Lawrence et al. 2008) ` and :math:`\Delta t` is the time step (s). .. _Figure Hydrologic processes: @@ -46,85 +47,158 @@ al. 2008) ` and :math:`\Delta t` is the time step (s). Canopy Water ---------------- -Precipitation is either intercepted by the canopy, falls directly to the +Liquid precipitation is either intercepted by the canopy, falls directly to the snow/soil surface (throughfall), or drips off the vegetation (canopy -drip). Interception by vegetation :math:`q_{intr}` (kg -m\ :sup:`-2` s\ :sup:`-1`) does not distinguish between -liquid and solid phases +drip). Solid precipitation is treated similiar, with the addition of unloading of previously intercepted snow. +Interception by vegetation is divided between liquid and solid phases +:math:`q_{intr,\,liq}` and :math:`q_{intr,\,ice}` (kg m\ :sup:`-2` s\ :sup:`-1`) .. math:: - :label: 7.2 + :label: 7.2) - q_{intr} =\alpha \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} + q_{intr,\,liq} =\alpha_{liq} \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} +.. math:: + :label: 7.3) + + q_{intr,\,ice} =\alpha_{sno} \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} + + where :math:`L` and :math:`S` are the exposed leaf and stem area index, -respectively (section :numref:`Phenology and vegetation burial by snow`), -and :math:`\alpha =0.25` scales interception from point to grid cell -(:ref:`Lawrence et al. 2007 `). Throughfall -(kg m\ :sup:`-2` s\ :sup:`-1`), however, is divided into -liquid and solid phases reaching the ground (soil or snow surface) as +respectively (section 2.1.4), and the :math:`\alpha`\'s scale +the fractional area of a leaf that collects water (:ref:`Lawrence et al. 2007 `). +Values of :math:`\alpha_{liq} = 0.25` and :math:`\alpha_{sno} = 1` reflect the increased capacity one side of a leaf has for snow than liquid water. +Throughfall (kg m\ :sup:`-2` s\ :sup:`-1`) is also divided into +liquid and solid phases, reaching the ground (soil or snow surface) as .. math:: - :label: 7.3 + :label: 7.4) - q_{thru,\, liq} =q_{rain} \left[1-\alpha \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right] + q_{thru,\, liq} =q_{rain} \left[1-\alpha_{liq} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right] .. math:: - :label: 7.4 + :label: 7.5) - q_{thru,\, ice} =q_{sno} \left[1-\alpha \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right]. + q_{thru,\, ice} =q_{sno} \left[1-\alpha_{sno} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right]. -Similarly, the canopy drip is +Similarly, the liquid and solid canopy drip fluxes are .. math:: - :label: 7.5 + :label: 7.6) - q_{drip,\, liq} =\frac{W_{can}^{intr} -W_{can,\, \max } }{\Delta t} \frac{q_{rain} }{q_{rain} +q_{sno} } \ge 0 + q_{drip,\, liq} =\frac{W_{can,\,liq}^{intr} -W_{can,\,liq}^{max } }{\Delta t} \ge 0 .. math:: - :label: 7.6 + :label: 7.7) - q_{drip,\, ice} =\frac{W_{can}^{intr} -W_{can,\, \max } }{\Delta t} \frac{q_{sno} }{q_{rain} +q_{sno} } \ge 0 + q_{drip,\, ice} =\frac{W_{can,\,sno}^{intr} -W_{can,\,sno}^{max } }{\Delta t} \ge 0 where .. math:: - :label: 7.7 + :label: 7.8) + + W_{can,liq}^{intr} =W_{can,liq}^{n} +q_{intr} \Delta t\ge 0 + +and + +.. math:: + :label: 7.9) + + W_{can,sno}^{intr} =W_{can,sno}^{n} +q_{intr} \Delta t\ge 0 + + +are the the canopy liquid water and snow water equivalent after accounting for interception, +:math:`W_{can,\,liq}^{n}` and :math:`W_{can,\,sno}^{n}` are the canopy liquid and snow water +from the previous time step, and :math:`W_{can,\,liq}^{max }` and :math:`W_{can,\,snow}^{max }` +(kg m\ :sup:`-2` or mm of H\ :sub:`2`\ O) are the maximum amounts of liquid water and snow the canopy can hold. +They are defined by + +.. math:: + :label: 7.10) + + W_{can,\,liq}^{max } =p_{liq}\left(L+S\right) + +.. math:: + :label: 7.11) + + W_{can,\,sno}^{max } =p_{ice}\left(L+S\right). + +The maximum storage of liquid water is :math:`p_{liq}=0.1` kg m\ :sup:`-2` (:ref:`Dickinson et al. +1993 `), and that of snow is :math:`p_{sno}=6`, consistent with reported +field measurements (:ref:`Pomeroy et al. 1998 `). + +Canopy snow unloading from wind speed :math:`u` and above-freezing temperatures are modeled from linear +fluxes and e-folding times similar to :ref:`Roesch et al. (2001) ` + +.. math:: + :label: 7.12) + + q_{unl,\, wind} =\frac{u W_{can,sno}}{1.56\times 10^5 \text{ m}} + +.. math:: + :label: 7.13) + + q_{unl,\, temp} =\frac{W_{can,sno}(T-270 \textrm{ K})}{1.87\times 10^5 \text{ K s}} > 0 + +.. math:: + :label: 7.14) + + q_{unl,\, tot} =\min \left( q_{unl,\, wind} +q_{unl,\, temp} ,W_{can,\, sno} \right) + + +The canopy liquid water and snow water equivalent are updated as + +.. math:: + :label: 7.15) - W_{can}^{intr} =W_{can}^{n} +q_{intr} \Delta t\ge 0 + W_{can,\, liq}^{n+1} =W_{can,liq}^{n} + q_{intr,\, liq} - q_{drip,\, liq} \Delta t - E_{v}^{liq} \Delta t \ge 0 -is the canopy water after accounting for interception, -:math:`W_{can}^{n}` is the canopy water from the previous time step, -and :math:`W_{can,\, \max }` (kg m\ :sup:`-2`) is the maximum -amount of water the canopy can hold +and .. math:: - :label: 7.8 + :label: 7.16) + + W_{can,\, sno}^{n+1} =W_{can,sno}^{n} + q_{intr,\, ice} - \left(q_{drip,\, ice}+q_{unl,\, tot} \right)\Delta t + - E_{v}^{ice} \Delta t \ge 0 + +.. W_{can}^{n+1} =W_{can}^{n} +q_{intr} \Delta t-\left(q_{drip,\, liq} +q_{drip,\, ice} \right)\Delta t-E_{v}^{w} \Delta t\ge 0. + +where :math:`E_{v}^{liq}` and :math:`E_{v}^{ice}` are partitioned from the stem and leaf +surface evaporation :math:`E_{v}^{w}` (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) based on the vegetation temperature :math:`T_{v}` (K) (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) and its relation to the freezing temperature of water :math:`T_{f}` (K) (:numref:`Table Physical Constants`) - W_{can,\, \max } =p\left(L+S\right). +.. math:: + :label: 7.17) -The maximum storage of solid water is assumed to be the same as that of -liquid water, :math:`p=0.1` kg m\ :sup:`-2` (:ref:`Dickinson et al. -1993 `). The canopy water is updated as + E_{v}^{liq} &= \begin{cases} + E_{v}^{w} & T_v > T_{f} \\ + 0 & T_v \le T_f + \end{cases} .. math:: - :label: 7.9 + :label: 7.18) + + E_{v}^{ice} &= \begin{cases} + 0 & T_v > T_f \\ + E_{v}^{w} & T_v \le T_f + \end{cases} . - W_{can}^{n+1} =W_{can}^{n} +q_{intr} \Delta t-\left(q_{drip,\, liq} +q_{drip,\, ice} \right)\Delta t-E_{v}^{w} \Delta t\ge 0. +.. \begin{array}{lr} +.. E_{v}^{liq} = E_{v}^{w} \qquad T > 273 \text{K} \\ +.. E_{v}^{ice} = E_{v}^{w} \qquad T \le 273 \text{K} +.. \end{array} -where :math:`E_{v}^{w}` is the flux of water vapor from stem and leaf -surfaces (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`). The total rate of liquid and solid precipitation -reaching the ground is then +The total rate of liquid and solid precipitation reaching the ground is then .. math:: - :label: 7.10 + :label: ZEqnNum946822 q_{grnd,liq} =q_{thru,\, liq} +q_{drip,\, liq} .. math:: - :label: 7.11 + :label: ZEqnNum339590 - q_{grnd,ice} =q_{thru,\, ice} +q_{drip,\, ice} . + q_{grnd,ice} =q_{thru,\, ice} +q_{drip,\, ice} +q_{unl,\, tot} . Solid precipitation reaching the soil or snow surface, :math:`q_{grnd,\, ice} \Delta t`, is added immediately to the snow pack @@ -135,22 +209,22 @@ and snow/soil temperatures (Chapter :numref:`rst_Soil and Snow Temperatures`) have been determined. The wetted fraction of the canopy (stems plus leaves), which is required -for the surface albedo (section :numref:`Canopy Radiative Transfer`) and surface flux (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) -calculations is (:ref:`Dickinson et al.1993 `) +for surface flux (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) +calculations, is (:ref:`Dickinson et al.1993 `) .. math:: - :label: 7.12 + :label: 7.21) f_{wet} = \left\{\begin{array}{lr} - \left[\frac{W_{can} }{p\left(L+S\right)} \right]^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \le 1 & \qquad L+S > 0 \\ + \left[\frac{W_{can} }{p_{liq}\left(L+S\right)} \right]^{{2\mathord{\left/ {\vphantom {2 3}} \right. \kern-\nulldelimiterspace} 3} } \le 1 & \qquad L+S > 0 \\ 0 &\qquad L+S = 0 \end{array}\right\} while the fraction of the canopy that is dry and transpiring is .. math:: - :label: 7.13 + :label: 7.22) f_{dry} = \left\{\begin{array}{lr} @@ -158,6 +232,19 @@ while the fraction of the canopy that is dry and transpiring is 0 &\qquad L+S = 0 \end{array}\right\}. +Similarly, the snow-covered fraction of the canopy is used for surface alebdo when intercepted snow is present (Chapter :numref:`rst_Surface Albedos`) + + +.. math:: + :label: 7.23) + + f_{can,\, sno} = + \left\{\begin{array}{lr} + \left[\frac{W_{can,\, sno} }{p_{sno}\left(L+S\right)} \right]^{{3\mathord{\left/ {\vphantom {3 20}} \right. \kern-\nulldelimiterspace} 20} } \le 1 & \qquad L+S > 0 \\ + 0 &\qquad L+S = 0 + \end{array}\right\}. + + .. _Surface Runoff, Surface Water Storage, and Infiltration: Surface Runoff, Surface Water Storage, and Infiltration @@ -184,21 +271,21 @@ portion of a grid cell contributes to surface runoff, :math:`q_{over}` , by the saturation excess mechanism (Dunne runoff) .. math:: - :label: 7.64 + :label: ZEqnNum549608 - q_{over} =f_{sat} \ q_{liq,\, 0} + q_{over} =f_{sat} q_{liq,\, 0} The fractional saturated area is a function of soil moisture .. math:: - :label: 7.65 + :label: 7.65) - f_{sat} = f_{\max } \ \exp \left(-0.5 f_{over} z_{\nabla } \right) + f_{sat} =f_{\max } \exp \left(-0.5f_{over} z_{\nabla } \right) -where :math:`f_{\max }` is the potential or maximum value of -:math:`f_{sat}`, :math:`f_{over}` is a decay factor (m\ :sup:`-1`), and -:math:`z_{\nabla}` is the water table depth (m) (section -:numref:`Lateral Sub-surface Runoff`). The maximum saturated fraction, :math:`f_{\max }` , +where :math:`f_{\max }` is the potential or maximum value of +:math:`f_{sat}` , :math:`f_{over}` is a decay factor +(m\ :sup:`-1`), and :math:`z_{\nabla}` is the water table depth +(m) (section 7.6). The maximum saturated fraction, :math:`f_{\max }` , is defined as the value of the discrete cumulative distribution function (CDF) of the topographic index when the grid cell mean water table depth is zero. Thus, :math:`f_{\max }` is the percent of pixels in a grid @@ -243,17 +330,17 @@ height (relative to the grid cell mean elevation) of the surface water, :math:`d`, by .. math:: - :label: 7.66 + :label: ZEqnNum277892 W_{sfc} =\frac{d}{2} \left(1+erf\left(\frac{d}{\sigma _{micro} \sqrt{2} } \right)\right)+\frac{\sigma _{micro} }{\sqrt{2\pi } } e^{\frac{-d^{2} }{2\sigma _{micro} ^{2} } } where :math:`erf` is the error function. For a given value of -:math:`W_{sfc}`, :eq:`7.66` can be solved for :math:`d` using the +:math:`W_{sfc}` , equation can be solved for :math:`d` using the Newton-Raphson method. Once :math:`d` is known, one can determine the fraction of the area that is inundated as .. math:: - :label: 7.67 + :label: 7.67) f_{h2osfc} =\frac{1}{2} \left(1+erf\left(\frac{d}{\sigma _{micro} \sqrt{2} } \right)\right) @@ -261,13 +348,13 @@ No global datasets exist for microtopography, so the default parameterization is a simple function of slope .. math:: - :label: 7.68 + :label: 7.68) \sigma _{micro} =\left(\beta +\beta _{0} \right)^{\eta } where :math:`\beta` is the topographic slope, :math:`\beta _{0} =\left(\sigma _{\max } \right)^{\frac{1}{\eta } }` \ determines -the maximum value of :math:`\sigma _{micro}` , and :math:`\eta` is an +the maximum value of :math:`\sigma _{}` , and :math:`\eta` is an adjustable parameter. Default values in the model are :math:`\sigma _{\max } =0.4` and :math:`\eta =-3`. @@ -278,7 +365,7 @@ percolation theory can be used to quantify the fraction of the inundated portion of the grid cell that is interconnected .. math:: - :label: 7.69 + :label: 7.69) \begin{array}{lr} f_{connected} =\left(f_{h2osfc} -f_{c} \right)^{\mu } & \qquad f_{h2osfc} >f_{c} \\ f_{connected} =0 &\qquad f_{h2osfc} \le f_{c} \end{array} @@ -290,14 +377,14 @@ surpasses :math:`f_{c}` , the surface water store acts as a linear reservoir .. math:: - :label: 7.70 + :label: 7.70) - q_{out,h2osfc}=k_{h2osfc} \ f_{connected} \ (Wsfc-Wc)\frac{1}{\Delta t} + qout,h2osfc=kh2osfcf_{connected} (Wsfc-Wc)\frac{1}{\Delta t} -where :math:`q_{out,h2osfc}` is the surface water runoff, :math:`k_{h2osfc}` +where :math:`qout,h2osfc` is the surface water runoff, :math:`kh2osfc` is a constant, :math:`Wc` is the amount of surface water present when -:math:`f_{h2osfc} = f_{c}` , and :math:`\Delta t` is the model time step. -The linear storage coefficent :math:`k_{h2osfc} = \sin \left(\beta \right)` +:math:`f_{h2osfc} =f_{c}` , and :math:`\Delta t` is the model time step. +The linear storage coefficent :math:`kh2osfc=\sin \left(\beta \right)` is a function of grid cell mean topographic slope where :math:`\beta` is the slope in radians. @@ -310,9 +397,9 @@ The surface moisture flux remaining after surface runoff has been removed, .. math:: - :label: 7.71 + :label: 7.71) - q_{in,surface} = (1-f_{sat}) \ q_{liq,\, 0} + qin,surface=(1-f_{sat} )q_{liq,\, 0} is divided into inputs to surface water (:math:`q_{in,\, h2osfc}` ) and the soil :math:`q_{in,soil}` . If :math:`q_{in,soil}` exceeds the @@ -320,16 +407,15 @@ maximum soil infiltration capacity (kg m\ :sup:`-2` s\ :sup:`-1`), .. math:: - :label: 7.72 + :label: ZEqnNum569150 - q_{infl,\, \max } =(1-f_{sat}) \ \Theta_{ice} k_{sat} + q_{infl,\, \max } =(1-fsat){\rm \Theta }iceksat -where :math:`\Theta_{ice}` is an ice impedance factor (section -:numref:`Hydraulic Properties`), infiltration excess (Hortonian) runoff -is generated +where :math:`{\rm \Theta }ice` is an ice impedance factor (section +:numref:`Hydraulic Properties`), infiltration excess (Hortonian) runoff is generated .. math:: - :label: 7.73 + :label: 7.73) q_{infl,\, excess} =\max \left(q_{in,soil} -\left(1-f_{h2osfc} \right)q_{\inf l,\max } ,0\right) @@ -337,38 +423,38 @@ and transferred from :math:`q_{in,soil}` to :math:`q_{in,h2osfc}` . After evaporative losses have been removed, these moisture fluxes are .. math:: - :label: 7.74 + :label: 7.74) - q_{in,\, h2osfc} =f_{h2osfc} q_{in,surface} + q_{infl,excess} - q_{evap,h2osfc} + q_{in,\, h2osfc} =f_{h2osfc} q_{in,surface} +q_{infl,excess} -q_{evap,h2osfc} and .. math:: - :label: 7.75 + :label: 7.75) - q_{in,soil} = (1-f_{h2osfc}) q_{in,surface} - q_{\inf l,excess} - (1 - f_{sno} - f_{h2osfc} ) q_{evap,soil}. + qin,soil=(1-f_{h2osfc} )q_{in,surface} -q_{\inf l,excess} -(1-f_{sno} -f_{h2osfc} )qevap,soil. The balance of surface water is then calculated as .. math:: - :label: 7.76 + :label: 7.76) - \Delta W_{sfc} =\left(q_{in,h2osfc} - q_{out,h2osfc} - q_{drain,h2osfc} \right) \ \Delta t. + \Delta W_{sfc} =\left(qin,h2osfc-qout,h2osfc-qdrain,h2osfc\right)\Delta t. Bottom drainage from the surface water store .. math:: - :label: 7.77 + :label: 7.77) - q_{drain,h2osfc} = \min \left(f_{h2osfc} q_{\inf l,\max } ,\frac{W_{sfc} }{\Delta t} \right) + qdrain,h2osfc=\min \left(f_{h2osfc} q_{\inf l,\max } ,\frac{W_{sfc} }{\Delta t} \right) is then added to :math:`q_{in,soil}` giving the total infiltration into the surface soil layer .. math:: - :label: 7.78 + :label: 7.78) - q_{infl} = q_{in,soil} + q_{drain,h2osfc} + q_{infl} =q_{in,soil} +q_{drain,h2osfc} Infiltration :math:`q_{infl}` and explicit surface runoff :math:`q_{over}` are not allowed for glaciers. @@ -389,12 +475,12 @@ For one-dimensional vertical water flow in soils, the conservation of mass is stated as .. math:: - :label: 7.79 + :label: ZEqnNum790844 \frac{\partial \theta }{\partial t} =-\frac{\partial q}{\partial z} -Q where :math:`\theta` is the volumetric soil water content -(mm\ :sup:`3` of water mm\ :sup:`-3` of soil), :math:`t` is +(mm\ :sup:`3` of water / mm\ :sup:`-3` of soil), :math:`t` is time (s), :math:`z` is height above some datum in the soil column (mm) (positive upwards), :math:`q` is soil water flux (kg m\ :sup:`-2` s\ :sup:`-1` or mm s\ :sup:`-1`) (positive upwards), and @@ -411,7 +497,7 @@ The soil water flux :math:`q` in equation can be described by Darcy’s law :ref:`(Dingman 2002) ` .. math:: - :label: 7.80 + :label: 7.80) q=-k\frac{\partial \psi _{h} }{\partial z} @@ -420,7 +506,7 @@ and :math:`\psi _{h}` is the hydraulic potential (mm). The hydraulic potential is .. math:: - :label: 7.81 + :label: 7.81) \psi _{h} =\psi _{m} +\psi _{z} @@ -433,22 +519,22 @@ If the reference elevation is the soil surface, then becomes .. math:: - :label: 7.82 + :label: ZEqnNum186573 q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]. -Equation :eq:`7.82` can be further manipulated to yield +Equation :eq:`ZEqnNum186573` can be further manipulated to yield .. math:: - :label: 7.83 + :label: 7.83) q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]=-k\left(\frac{\partial \psi }{\partial z} +1\right)=-k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right). -Substitution of this equation into equation :eq:`7.79`, with :math:`Q=0`, yields +Substitution of this equation into equation :eq:`ZEqnNum790844`, with :math:`Q=0`, yields the Richards equation .. math:: - :label: 7.84 + :label: ZEqnNum670361 \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right)\right]. @@ -460,8 +546,7 @@ Hydraulic Properties The hydraulic conductivity :math:`k_{i}` (mm s\ :sup:`-1`) and the soil matric potential :math:`\psi _{i}` (mm) for layer :math:`i` vary with volumetric soil water :math:`\theta _{i}` and soil texture. -As with the soil thermal properties (section -:numref:`Soil And Snow Thermal Properties`) the hydraulic +As with the soil thermal properties (section :numref:`Soil And Snow Thermal Properties`) the hydraulic properties of the soil are assumed to be a weighted combination of the mineral properties, which are determined according to sand and clay contents based on work by :ref:`Clapp and Hornberger (1978) @@ -470,34 +555,27 @@ and organic properties of the soil (:ref:`Lawrence and Slater 2008 `). The hydraulic conductivity is defined at the depth of the interface of -two adjacent layers :math:`z_{h,\, i}` (:numref:`Figure Water flux schematic`) -and is a function of the saturated hydraulic conductivity +two adjacent layers :math:`z_{h,\, i}` (:numref:`Figure Water flux schematic`) and is a function +of the saturated hydraulic conductivity :math:`k_{sat} \left[z_{h,\, i} \right]`, the liquid volumetric soil -moisture of the two layers :math:`\theta_{i}` and -:math:`\theta_{i+1}` and an ice impedance factor -:math:`\Theta_{ice}` +moisture of the two layers :math:`\theta _{i}` and +:math:`\theta _{i+1}` and an ice impedance factor +:math:`\Theta _{ice}` .. math:: - :label: 7.85 + :label: ZEqnNum398074 k\left[z_{h,\, i} \right] = \left\{\begin{array}{lr} - \Theta_{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta_{\, i} +\theta_{\, i+1} \right)}{0.5\left(\theta_{sat,\, i} +\theta_{sat,\, i+1} \right)} \right]^{2B_{i} +3} & \qquad 1 \le i \le N_{levsoi} - 1 \\ - \Theta_{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta_{\, i} }{\theta_{sat,\, i} } \right)^{2B_{i} +3} & \qquad i = N_{levsoi} + \Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +3} & \qquad 1 \le i \le N_{levsoi} - 1 \\ + \Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{2B_{i} +3} & \qquad i = N_{levsoi} \end{array}\right\}. The ice impedance factor is a function of ice content, and is meant to quantify the increased tortuosity of the water flow when part of the pore space is filled with ice. :ref:`Swenson et al. (2012) ` -used a power law form - -.. math:: - :label: 7.86 - - \Theta _{ice} = 10^{-\Omega F_{ice}} - -where -:math:`\Omega = 6` and +used a power law form :math:`\Theta _{ice} = 10^{-\Omega F_{ice} }` where +:math:`\Omega = 6`\ and :math:`F_{ice} = \frac{\theta_{ice} }{\theta_{sat} }` is the ice-filled fraction of the pore space. @@ -507,7 +585,7 @@ computed as weighted averages of the properties of the mineral and organic components. The water content at saturation (i.e. porosity) is .. math:: - :label: 7.90 + :label: 7.90) \theta _{sat,i} =(1-f_{om,i} )\theta _{sat,\min ,i} +f_{om,i} \theta _{sat,om} @@ -518,21 +596,21 @@ porosity of organic matter and the porosity of the mineral soil :math:`\theta _{sat,\min ,i}` is .. math:: - :label: 7.91 + :label: 7.91) - \theta _{sat,\min ,i} = 0.489 - 0.00126(\% sand)_{i} . + \theta _{sai,\min ,i} = 0.489 - 0.00126(\% sand)_{i} . The exponent :math:`B_{i}` is .. math:: - :label: 7.92 + :label: 7.92) B_{i} =(1-f_{om,i} )B_{\min ,i} +f_{om,i} B_{om} where :math:`B_{om} = 2.7` \ (:ref:`Letts et al. 2000 `) and .. math:: - :label: 7.93 + :label: 7.93) B_{\min ,i} =2.91+0.159(\% clay)_{i} . @@ -540,14 +618,14 @@ The soil matric potential (mm) is defined at the node depth :math:`z_{i}` of each layer :math:`i` (:numref:`Figure Water flux schematic`) .. math:: - :label: 7.94 + :label: ZEqnNum316201 \psi _{i} =\psi _{sat,\, i} \left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{-B_{i} } \ge -1\times 10^{8} \qquad 0.01\le \frac{\theta _{i} }{\theta _{sat,\, i} } \le 1 where the saturated soil matric potential (mm) is .. math:: - :label: 7.95 + :label: 7.95) \psi _{sat,i} =(1-f_{om,i} )\psi _{sat,\min ,i} +f_{om,i} \psi _{sat,om} @@ -556,7 +634,7 @@ saturated organic matter matric potential and the saturated mineral soil matric potential :math:`\psi _{sat,\min ,i}` \ is .. math:: - :label: 7.96 + :label: 7.96) \psi _{sat,\, \min ,\, i} =-10.0\times 10^{1.88-0.0131(\% sand)_{i} } . @@ -574,13 +652,13 @@ fractions using a result from percolation theory (:ref:`Stauffer and Aharony 1994 `, :ref:`Berkowitz and Balberg 1992 `). Assuming that the organic and mineral fractions are randomly distributed throughout a soil layer, percolation theory predicts that above a threshold value -:math:`f_{om} =f_{threshold}`, connected flow pathways consisting of +:math:`f_{om} =f_{threshold}` , connected flow pathways consisting of organic material only exist and span the soil space. Flow through these pathways interacts only with organic material, and thus can be described -by :math:`k_{sat,\, om}`. This fraction of the grid cell is given by +by :math:`k_{sat,\, om}` . This fraction of the grid cell is given by .. math:: - :label: 7.97 + :label: 7.97) \begin{array}{lr} f_{perc} =\; N_{perc} \left(f_{om} {\rm \; }-f_{threshold} \right)^{\beta _{perc} } f_{om} {\rm \; } & \qquad f_{om} \ge f_{threshold} \\ @@ -595,7 +673,7 @@ hydraulic conductivity is assumed to correspond to flow pathways that pass through the mineral and organic components in series .. math:: - :label: 7.98 + :label: 7.98) k_{sat,\, uncon} =f_{uncon} \left(\frac{\left(1-f_{om} \right)}{k_{sat,\, \min } } +\frac{\left(f_{om} -f_{perc} \right)}{k_{sat,\, om} } \right)^{-1} . @@ -603,7 +681,7 @@ where saturated hydraulic conductivity for mineral soil depends on soil texture (:ref:`Cosby et al. 1984 `) as .. math:: - :label: 7.99 + :label: 7.99) k_{sat,\, \min } \left[z_{h,\, i} \right]=0.0070556\times 10^{-0.884+0.0153\left(\% sand\right)_{i} } . @@ -611,7 +689,7 @@ The bulk soil layer saturated hydraulic conductivity is then computed as .. math:: - :label: 7.100 + :label: 7.100) k_{sat} \left[z_{h,\, i} \right]=f_{uncon,\, i} k_{sat,\, uncon} \left[z_{h,\, i} \right]+(1-f_{uncon,\, i} )k_{sat,\, om} \left[z_{h,\, i} \right]. @@ -620,11 +698,11 @@ as Numerical Solution ^^^^^^^^^^^^^^^^^^^^^^^^ -With reference to :numref:`Figure Water flux schematic`, the equation for -conservation of mass :eq:`7.79` can be integrated over each layer as +With reference to :numref:`Figure Water flux schematic`, the equation for conservation of mass +(equation :eq:`ZEqnNum790844`) can be integrated over each layer as .. math:: - :label: 7.101 + :label: 7.101) \int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial \theta }{\partial t} \, dz=-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial q}{\partial z} \, dz-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }Q\, dz . @@ -633,7 +711,7 @@ as positive upward from the soil surface. This equation can be written as .. math:: - :label: 7.102 + :label: ZEqnNum225309 \Delta z_{i} \frac{\partial \theta _{liq,\, i} }{\partial t} =-q_{i-1} +q_{i} -e_{i} @@ -645,7 +723,7 @@ the layer (mm s\ :sup:`-1`). Taking the finite difference with time and evaluating the fluxes implicitly at time :math:`n+1` yields .. math:: - :label: 7.103 + :label: ZEqnNum181361 \frac{\Delta z_{i} \Delta \theta _{liq,\, i} }{\Delta t} =-q_{i-1}^{n+1} +q_{i}^{n+1} -e_{i} @@ -660,7 +738,7 @@ function of the total transpiration :math:`E_{v}^{t}` (Chapter :numref:`rst_Mom the effective root fraction :math:`r_{e,\, i}` .. math:: - :label: 7.104 + :label: ZEqnNum357392 e_{i} =r_{e,\, i} E_{v}^{t} . @@ -686,7 +764,7 @@ soil column, the transpiration :math:`E_{v}^{t}` is a weighted sum of transpiration from all PFTs whose weighting depends on PFT area as .. math:: - :label: 7.105 + :label: 7.105) E_{v}^{t} =\sum _{j=1}^{npft}\left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} @@ -699,7 +777,7 @@ quantity that is a weighted sum over all PFTs. The weighting depends on the per unit area transpiration of each PFT and its relative area as .. math:: - :label: 7.106 + :label: 7.106) r_{e,\, i} =\frac{\sum _{j=1}^{npft}\left(r_{e,\, i} \right)_{j} \left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} }{\sum _{j=1}^{npft}\left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} } @@ -707,65 +785,60 @@ where :math:`\left(r_{e,\, i} \right)_{j}` is the effective root fraction for the :math:`j^{th}` PFT .. math:: - :label: 7.107 + :label: 7.107) - \begin{array}{lr} - \left(r_{e,\, i} \right)_{j} =\frac{\left(r_{i} \right)_{j} \left(w_{i} \right)_{j} }{\left(\beta _{t} \right)_{j} } & \qquad \left(\beta _{t} \right)_{j} >0 \\ - \left(r_{e,\, i} \right)_{j} =0 & \qquad \left(\beta _{t} \right)_{j} =0 - \end{array} + \begin{array}{l} {\left(r_{e,\, i} \right)_{j} =\frac{\left(r_{i} \right)_{j} \left(w_{i} \right)_{j} }{\left(\beta _{t} \right)_{j} } \qquad \left(\beta _{t} \right)_{j} >0} \\ {\left(r_{e,\, i} \right)_{j} =0\qquad \left(\beta _{t} \right)_{j} =0} \end{array} and :math:`\left(r_{i} \right)_{j}` is the fraction of roots in layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), -:math:`\left(w_{i} \right)_{j}` is a soil dryness or plant wilting factor for -layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), -and :math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total -soil column for the :math:`j^{th}` PFT (Chapter -:numref:`rst_Stomatal Resistance and Photosynthesis`). +:math:`\left(w_{i} \right)_{j}` is a soil dryness or plant wilting factor +for layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), and :math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total +soil column for the :math:`j^{th}` PFT (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). -The soil water fluxes in :eq:`7.103`, which are a function of +The soil water fluxes in equation , which are a function of :math:`\theta _{liq,\, i}` and :math:`\theta _{liq,\, i+1}` because of their dependence on hydraulic conductivity and soil matric potential, can be linearized about :math:`\theta` using a Taylor series expansion as .. math:: - :label: 7.108 + :label: 7.108) q_{i}^{n+1} =q_{i}^{n} +\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} +\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } \Delta \theta _{liq,\, i+1} .. math:: - :label: 7.109 + :label: 7.109) q_{i-1}^{n+1} =q_{i-1}^{n} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } \Delta \theta _{liq,\, i-1} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} . -Substitution of these expressions for :math:`q_{i}^{n+1}` and -:math:`q_{i-1}^{n+1}` into equation :eq:`7.103` results in a general tridiagonal +Substitution of these expressions for :math:`q_{i}^{n+1}` and +:math:`q_{i-1}^{n+1}` into equation results in a general tridiagonal equation set of the form .. math:: - :label: 7.110 + :label: 7.110) r_{i} =a_{i} \Delta \theta _{liq,\, i-1} +b_{i} \Delta \theta _{liq,\, i} +c_{i} \Delta \theta _{liq,\, i+1} where .. math:: - :label: 7.111 + :label: ZEqnNum557934 a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } .. math:: - :label: 7.112 + :label: 7.112) b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.113 + :label: 7.113) c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } .. math:: - :label: 7.114 + :label: ZEqnNum981892 r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . @@ -773,53 +846,53 @@ The tridiagonal equation set is solved over :math:`i=1,\ldots ,N_{levsoi}`. The finite-difference forms of the fluxes and partial derivatives in -equations :eq:`7.111` - :eq:`7.114` can be obtained from :eq:`7.80` as +equations - can be obtained from equation as .. math:: - :label: 7.115 + :label: 7.115) - q_{i-1}^{n} =-k\left[z_{h,\, i-1} \right]\left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} -z_{i-1} } \right] + q_{i-1}^{n} =-k\left[z_{h,\, i-1} \right]\left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: - :label: 7.116 + :label: 7.116) - q_{i}^{n} =-k\left[z_{h,\, i} \right]\left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} -z_{i} } \right] + q_{i}^{n} =-k\left[z_{h,\, i} \right]\left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] .. math:: - :label: 7.117 + :label: 7.117) - \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } =-\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, i-1} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} - z_{i-1} } \right] + \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } =-\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, i-1} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: - :label: 7.118 + :label: 7.118) - \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } =\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} - z_{i-1} } \right] + \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } =\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: - :label: 7.119 + :label: 7.119) - \frac{\partial q_{i} }{\partial \theta _{liq,\, i} } =-\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} - z_{i} } \right] + \frac{\partial q_{i} }{\partial \theta _{liq,\, i} } =-\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] .. math:: - :label: 7.120 + :label: 7.120) - \frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } =\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} - z_{i} } \right]. + \frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } =\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right]. The derivatives of the soil matric potential at the node depth are -derived from :eq:`7.94` +derived from equation .. math:: - :label: 7.121 + :label: 7.121) \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, \, i-1} } =-B_{i-1} \frac{\psi _{i-1} }{\theta _{\, \, i-1} } .. math:: - :label: 7.122 + :label: 7.122) \frac{\partial \psi _{i} }{\partial \theta _{\, liq,\, i} } =-B_{i} \frac{\psi _{i} }{\theta _{i} } .. math:: - :label: 7.123 + :label: 7.123) \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } =-B_{i+1} \frac{\psi _{i+1} }{\theta _{\, i+1} } @@ -827,31 +900,17 @@ with the constraint :math:`0.01\, \theta _{sat,\, i} \le \theta _{\, i} \le \theta _{sat,\, i}` . The derivatives of the hydraulic conductivity at the layer interface are -derived from :eq:`7.85` - -.. check eqn +derived from equation .. math:: - :label: 7.124 - - \begin{array}{l} - {\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } - = \frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } - = \left(2B_{i-1} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i-1} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i-1} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array} - -where :math:`\overline{\theta}_{liq} = 0.5\left(\theta _{\, i-1} +\theta _{\, i} \right)`, -:math:`\overline{\theta}_{sat} = 0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)`, -and :math:`\overline{\Theta}_{ice} = \Theta_{ice}(\overline{\theta}_{ice})` :eq:`7.86` + :label: 7.124) -and + \begin{array}{l} {\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } =\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } =\left(1-\frac{f_{frz,\, i-1} +f_{frz,\, i} }{2} \right)\left(2B_{i-1} +3\right)k_{sat} \left[z_{h,\, i-1} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i-1} +\theta _{\, i} \right)}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right]^{2B_{i-1} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right)} \end{array} .. math:: - :label: 7.125 + :label: 7.125) - \begin{array}{l} - {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } - = \frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } - = \left(2B_{i} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array}. + \begin{array}{l} {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } =\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } =\left(1-\frac{f_{frz,\, i} +f_{frz,\, i+1} }{2} \right)\left(2B_{i} +3\right)k_{sat} \left[z_{h,\, i} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right)} \end{array}. Equation set for layer :math:`i=1` '''''''''''''''''''''''''''''''''''''''''' @@ -862,7 +921,7 @@ infiltration rate (section :numref:`Surface Runoff`), is .. math:: - :label: 7.135 + :label: 7.135) \frac{\Delta z_{i} \Delta \theta _{liq,\, i} }{\Delta t} =q_{infl}^{n+1} +q_{i}^{n+1} -e_{i} . @@ -870,22 +929,22 @@ After grouping like terms, the coefficients of the tridiagonal set of equations for :math:`i=1` are .. math:: - :label: 7.136 + :label: 7.136) a_{i} =0 .. math:: - :label: 7.137 + :label: 7.137) b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.138 + :label: 7.138) c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } .. math:: - :label: 7.139 + :label: 7.139) r_{i} =q_{infl}^{n+1} -q_{i}^{n} +e_{i} . @@ -896,22 +955,22 @@ The coefficients of the tridiagonal set of equations for :math:`i=2,\ldots ,N_{levsoi} -1` are .. math:: - :label: 7.140 + :label: 7.140) a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } .. math:: - :label: 7.141 + :label: 7.141) b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.142 + :label: 7.142) c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } .. math:: - :label: 7.143 + :label: 7.143) r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . @@ -924,22 +983,22 @@ and the coefficients of the tridiagonal set of equations for :math:`i=N_{levsoi}` are .. math:: - :label: 7.148 + :label: 7.148) a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } .. math:: - :label: 7.149 + :label: 7.149) b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.150 + :label: 7.150) c_{i} =0 .. math:: - :label: 7.151 + :label: 7.151) r_{i} =q_{i-1}^{n} +e_{i} . @@ -950,7 +1009,7 @@ An initial solution is found by setting :math:`\Delta t` equal to the model time step. An estimate of the error is calculated from .. math:: - :label: 7.152 + :label: 7.152) \epsilon = max \left[ \frac{\Delta \theta_{liq,\, i} \Delta z_{i}}{\Delta t} - \left( q_{i-1}^{n} - q_{i}^{n} + e_{i}\right) \right] @@ -966,14 +1025,14 @@ Upon solution of the tridiagonal equation set, the liquid water contents are updated as follows .. math:: - :label: 7.164 + :label: 7.164) w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\Delta \theta _{liq,\, i} \Delta z_{i} \qquad i=1,\ldots ,N_{levsoi} . The volumetric water content is .. math:: - :label: 7.165 + :label: 7.165) \theta _{i} =\frac{w_{liq,\, i} }{\Delta z_{i} \rho _{liq} } +\frac{w_{ice,\, i} }{\Delta z_{i} \rho _{ice} } . @@ -983,8 +1042,7 @@ Frozen Soils and Perched Water Table ---------------------------------------- When soils freeze, the power-law form of the ice impedance factor -(section :numref:`Hydraulic Properties`) can greatly decrease the hydraulic -conductivity of the +(section :numref:`Hydraulic Properties`) can greatly decrease the hydraulic conductivity of the soil, leading to nearly impermeable soil layers. When unfrozen soil layers are present above relatively ice-rich frozen layers, the possibility exists for perched saturated zones. Lateral drainage from @@ -992,7 +1050,7 @@ perched saturated regions is parameterized as a function of the thickness of the saturated zone .. math:: - :label: 7.166 + :label: 7.166) q_{drai,perch} =k_{drai,\, perch} \left(z_{frost} -z_{\nabla ,perch} \right) @@ -1000,7 +1058,7 @@ where :math:`k_{drai,\, perch}` depends on topographic slope and soil hydraulic conductivity, .. math:: - :label: 7.167 + :label: 7.167) k_{drai,\, perch} =10^{-5} \sin (\beta )\left(\frac{\sum _{i=N_{perch} }^{i=N_{frost} }\Theta _{ice,i} k_{sat} \left[z_{i} \right]\Delta z_{i} }{\sum _{i=N_{perch} }^{i=N_{frost} }\Delta z_{i} } \right) @@ -1025,7 +1083,7 @@ Lateral sub-surface runoff occurs when saturated soil moisture conditions exist within the soil column. Sub-surface runoff is .. math:: - :label: 7.168 + :label: 7.168) q_{subsurface} = \Theta_{ice} K_{baseflow} tan \left( \beta \right) \Delta z_{sat}^{N_{baseflow}} \ , @@ -1037,14 +1095,13 @@ is the thickness of the saturated portion of the soil column. The saturated thickness is .. math:: - :label: 7.1681 + :label: 7.1681) \Delta z_{sat} = z_{bedrock} - z_{\nabla}, where the water table :math:`z_{\nabla}` is determined by finding the -first soil layer above the bedrock depth (section :numref:`Depth to Bedrock`) -in which the volumetric water content drops below a specified threshold. -The default threshold is set to 0.9. +first soil layer above the bedrock depth (section ) in which the volumetric water +content drops below a specified threshold. The default threshold is set to 0.9. The specific yield, :math:`S_{y}` , which depends on the soil properties and the water table location, is derived by taking the @@ -1052,13 +1109,13 @@ difference between two equilibrium soil moisture profiles whose water tables differ by an infinitesimal amount .. math:: - :label: 7.174 + :label: 7.174) S_{y} =\theta _{sat} \left(1-\left(1+\frac{z_{\nabla } }{\Psi _{sat} } \right)^{\frac{-1}{B} } \right) where B is the Clapp-Hornberger exponent. Because :math:`S_{y}` is a function of the soil properties, it results in water table dynamics that -are consistent with the soil water fluxes described in section :numref:`Soil Water`. +are consistent with the soil water fluxes described in section 7.4. After the above calculations, two numerical adjustments are implemented to keep the liquid water content of each soil layer @@ -1083,22 +1140,22 @@ those layers subject to the constraint found, then the water is removed from :math:`W_{t}` and :math:`q_{drai}` . -The soil surface layer liquid water and ice contents are then updated for -dew :math:`q_{sdew}`, frost :math:`q_{frost}`, or sublimation :math:`q_{subl}` -(section :numref:`Update of Ground Sensible and Latent Heat Fluxes`) as +The soil surface layer liquid water and ice contents are then updated +for dew :math:`q_{sdew}` , frost :math:`q_{frost}` , or sublimation +:math:`q_{subl}` (section 5.4) as .. math:: - :label: 7.175 + :label: 7.175) w_{liq,\, 1}^{n+1} =w_{liq,\, 1}^{n} +q_{sdew} \Delta t .. math:: - :label: 7.176 + :label: 7.176) w_{ice,\, 1}^{n+1} =w_{ice,\, 1}^{n} +q_{frost} \Delta t .. math:: - :label: 7.177 + :label: 7.177) w_{ice,\, 1}^{n+1} =w_{ice,\, 1}^{n} -q_{subl} \Delta t. @@ -1116,12 +1173,12 @@ and dew in solid or liquid form, is separated into solid :math:`q_{snwcp,ice}` \ and liquid :math:`q_{snwcp,liq}` runoff terms .. math:: - :label: 7.178 + :label: 7.178) q_{snwcp,ice} =q_{grnd,ice} +q_{frost} .. math:: - :label: 7.179 + :label: 7.179) q_{snwcp,liq} =q_{grnd,liq} +q_{dew} @@ -1137,7 +1194,7 @@ For glacier surfaces the runoff term :math:`q_{rgwl}` is calculated from the residual of the water balance .. math:: - :label: 7.180 + :label: 7.180) q_{rgwl} =q_{grnd,ice} +q_{grnd,liq} -E_{g} -E_{v} -\frac{\left(W_{b}^{n+1} -W_{b}^{n} \right)}{\Delta t} -q_{snwcp,ice} @@ -1145,7 +1202,7 @@ where :math:`W_{b}^{n}` and :math:`W_{b}^{n+1}` are the water balances at the beginning and ending of the time step defined as .. math:: - :label: 7.181 + :label: 7.181) W_{b} =W_{can} +W_{sno} +\sum _{i=1}^{N}\left(w_{ice,i} +w_{liq,i} \right) . @@ -1153,6 +1210,5 @@ Currently, glaciers are non-vegetated and :math:`E_{v} =W_{can} =0`. The contribution of lake runoff to :math:`q_{rgwl}` is described in section :numref:`Precipitation, Evaporation, and Runoff Lake`. The runoff term :math:`q_{rgwl}` may be negative for glaciers and lakes, which reduces -the total amount of runoff available to the river routing model -(Chapter :numref:`rst_River Transport Model (RTM)`). +the total amount of runoff available to the river routing model (Chapter :numref:`rst_River Transport Model (RTM)`). diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index dfb4b81d9c..6d989d2b1c 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1225,8 +1225,6 @@ Niu, G.-Y., Yang, Z.-L., Dickinson, R.E., and Gulden, L.E. 2005. A simple TOPMODEL-based runoff parameterization (SIMTOP) for use in global climate models. J. Geophys. Res. 110:D21106. DOI:10.1029/2005JD006111. -.. _NiuYang2006: - Niu, G.-Y., and Yang, Z.-L. 2006. Effects of frozen soil on snowmelt runoff and soil water storage at a continental scale. J. Hydrometeor. 7:937-952. @@ -1410,6 +1408,12 @@ Pollmer, W.G., Eberhard, D., Klein, D., and Dhillon, B.S. 1979. Genetic control of nitrogen uptake and translocation in maize. Crop Sci. 19:82-86. +.. _Pomeroyetal1998: + +Pomeroy, J. W., D. M. Gray, K. R. Shook, B. Toth, R. L. H. Essery, +A. Pietroniro, and N. Hedstrom. 1998. An evaluation of snow accumulation +and ablation processes for land surface modelling. Hydrol. Process. 12:2339–2367. + .. _Portmannetal2010: Portmann, F.T., Siebert, S., and Döll, P. 2010. MIRCA2000 - Global @@ -1489,6 +1493,11 @@ Riley, W.J. et al. 2011b. CLM4Me, a Methane Biogeochemistry Model Integrated in CESM, Land and Biogeochemistry Model Working Group Meeting, Boulder, CO. +.. _Roeschetal2001: + +Roesch, A., M. Wild, H. Gilgen, and A. Ohmura. 2001. A new snow cover +fraction parametrization for the ECHAM4 GCM, Clim. Dyn., 17:933–946. + .. _Ryan1991: Ryan, M. G. 1991. A simple method for estimating gross carbon budgets @@ -1557,7 +1566,7 @@ Schnell, S. and King, G.M., 1996. Responses of methanotrophic activity in soils and cultures to water stress. Applied and Environmental Microbiology 62:3203-3209. -.. _Segers1998: +.. _Segers, R., 1998. Methane production and methane consumption: a review Segers, R., 1998. Methane production and methane consumption: a review of processes underlying wetland methane fluxes. Biogeochemistry diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index d20ac17a27..256648359f 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -72,29 +72,34 @@ where :math:`\mu '` is the direction of the scattered flux. The optical parameters :math:`\omega`, :math:`\beta`, and :math:`\beta _{0}`, which vary with wavelength (:math:`\Lambda` ), are weighted combinations of values -for vegetation and snow. The model determines that snow is on the canopy if -:math:`T_{v} \le T_{f}` , where :math:`T_{v}` is the vegetation temperature (K) (Chapter -:numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) and :math:`T_{f}` is the -freezing temperature of water (K) (:numref:`Table Physical Constants`). In this case, the optical parameters are +for vegetation and snow, using the canopy snow-covered fraction :math:`f_{can,\, sno}` +(Chapter :numref:`rst_Hydrology`). The optical parameters are + + +.. + The model determines that snow is on the canopy if + :math:`T_{v} \le T_{f}` , where :math:`T_{v}` is the vegetation temperature (K) (Chapter + :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`) and :math:`T_{f}` is the + freezing temperature of water (K) (:numref:`Table Physical Constants`). In this case, the optical parameters are .. math:: :label: 3.5 - \omega _{\Lambda } =\omega _{\Lambda }^{veg} \left(1-f_{wet} \right)+\omega _{\Lambda }^{sno} f_{wet} + \omega _{\Lambda } =\omega _{\Lambda }^{veg} \left(1-f_{can,\, sno} \right)+\omega _{\Lambda }^{sno} f_{can,\, sno} .. math:: :label: 3.6 - \omega _{\Lambda } \beta _{\Lambda } =\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} \left(1-f_{wet} \right)+\omega _{\Lambda }^{sno} \beta _{\Lambda }^{sno} f_{wet} + \omega _{\Lambda } \beta _{\Lambda } =\omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} \left(1-f_{can,\, sno} \right)+\omega _{\Lambda }^{sno} \beta _{\Lambda }^{sno} f_{can,\, sno} .. math:: :label: 3.7 - \omega _{\Lambda } \beta _{0,\, \Lambda } =\omega _{\Lambda }^{veg} \beta _{0,\, \Lambda }^{veg} \left(1-f_{wet} \right)+\omega _{\Lambda }^{sno} \beta _{0,\, \Lambda }^{sno} f_{wet} + \omega _{\Lambda } \beta _{0,\, \Lambda } =\omega _{\Lambda }^{veg} \beta _{0,\, \Lambda }^{veg} \left(1-f_{can,\, sno} \right)+\omega _{\Lambda }^{sno} \beta _{0,\, \Lambda }^{sno} f_{can,\, sno} -where :math:`f_{wet}` is the wetted fraction of the canopy (section :numref:`Canopy Water`). The snow and vegetation weights are applied to the products +The snow and vegetation weights are applied to the products :math:`\omega _{\Lambda } \beta _{\Lambda }` and :math:`\omega _{\Lambda } \beta _{0,\, \Lambda }` because these -products are used in the two-stream equations. If there is no snow on the canopy, +products are used in the two-stream equations. If there is no snow on the canopy, this reduces to .. math:: :label: 3.8 From aa7cc7a6ec1053ca8058fe10e686e5340d409936 Mon Sep 17 00:00:00 2001 From: Yaqiong Lu Date: Fri, 2 Jun 2017 16:39:37 -0600 Subject: [PATCH 0042/1973] updated crop tables --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 110 ++++++++---------- 1 file changed, 51 insertions(+), 59 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 2961569d3a..79e089380b 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -375,72 +375,64 @@ crop and from each other: .. _Table Crop plant functional types: -.. table:: Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. - - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | | Phenological | :math:`T_{p}` | :math:`T_{p}^{\min }` | :math:`{GDD}_{min}` | :math:`{GDD}_{mat}` | Phase 2 | Phase 3 | Harvest: days | :math:`z_{top}^{\max }` | *SLA* | :math:`\chi _{L}` | | - | | Type | K | K | ºdays | ºdays | %\ :math:`{GDD}_{mat}` | %\ :math:`{GDD}_{mat}` | past planting | m | m\ :sup:`2`\ leaf g\ :sup:`-1`\ C | index | | - +=======+==============================================+======================+==============================+===========================+===========================+==============================+==============================+=================+==============================+=================================================+========================+====+ - | 15. | C\ :sub:`3` unmanaged rainfed crop | | | | | | | 0.03 | -0.30 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 16. | C\ :sub:`3` unmanaged irrigated crop | | | | | | | 0.03 | -0.30 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 17. | Rainfed Corn (also known as Maize) | | 950-1850 | 3 | 55-65 | :math:`\mathrm{\le}`\ 165 | 2.50 | 0.05 | -0.50 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 18. | Irrigated Corn (also known as Maize) | | 950-1850 | 3 | 55-65 | :math:`\mathrm{\le}`\ 165 | 2.50 | 0.05 | -0.50 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 19. | Rainfed Temperate Cereals | | :math:`\mathrm{\le}`\ 1700 | 5 | 60 | :math:`\mathrm{\le}`\ 150 | 1.20 | 0.07 | 0.65 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 20. | Irrigated Temperate Cereals | | :math:`\mathrm{\le}`\ 1700 | 5 | 60 | :math:`\mathrm{\le}`\ 150 | 1.20 | 0.07 | 0.65 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 21. | Rainfed Winter cereals (place holder) | | 1900 | 5 | 40 | :math:`\mathrm{\le}`\ 265 | 1.20 | 0.07 | 0.65 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 22. | Irrigated Winter cereals (place holder) | | 1900 | 5 | 40 | :math:`\mathrm{\le}`\ 265 | 1.20 | 0.07 | 0.65 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 23. | Rainfed Soybean | | :math:`\mathrm{\le}`\ 1700 | 3 | 70 | :math:`\mathrm{\le}`\ 150 | 0.75 | 0.07 | -0.50 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - | 24. | Irrigated Soybean | | :math:`\mathrm{\le}`\ 1700 | 3 | 70 | :math:`\mathrm{\le}`\ 150 | 0.75 | 0.07 | -0.50 | | | | - +-------+----------------------------------------------+----------------------+------------------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------+------------------------------+-------------------------------------------------+------------------------+----+ - -Notes: :math:`T_{p}` and :math:`T_{p}^{\min }` are coldest -planting temperatures but for winter cereals :math:`T_{p}^{\min }` -is a warmest planting temperature. :math:`{GDD}_{min}` is the lowest -(for planting) 20-year running mean growing degree-days base 0ºC (winter -cereals) or 8 (other crops) tracked from April to September (NH). +.. table:: Crop plant functional types (pfts) in CLM5BGCCROP and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. + + === =========================== ================= =========================== ============================= =========================== ============================= ============================= =========================== =========================== =================================== ======================= + IVT Phenological Type :math:`T_{p}` (K) :math:`{GDD}_{min}` (ºdays) base temperature for GDD (ºC) :math:`{GDD}_{mat}` (ºdays) Phase 2 % :math:`{GDD}_{mat}` Phase 3 % :math:`{GDD}_{mat}` Harvest: days past planting :math:`z_{top}^{\max }` (m) SLA (m :sup:`2` leaf g :sup:`-1` C) :math:`\chi _{L}` index + === =========================== ================= =========================== ============================= =========================== ============================= ============================= =========================== =========================== =================================== ======================= + 17 rainfed temperate corn 279.15 50 8 950-1850 0.03 0.65 :math:`\mathrm{\le}`\ 165 2.50 0.05 -0.50 + 18 irrigated temperate corn 279.15 50 8 950-1850 0.03 0.65 :math:`\mathrm{\le}`\ 165 2.50 0.05 -0.50 + 19 rainfed spring wheat 272.15 50 0 :math:`\mathrm{\le}`\ 1700 0.05 0.60 :math:`\mathrm{\le}`\ 150 1.20 0.04 0.65 + 20 irrigated spring wheat 272.15 50 0 :math:`\mathrm{\le}`\ 1700 0.05 0.60 :math:`\mathrm{\le}`\ 150 1.20 0.04 0.65 + 23 rainfed temperate soybean 279.15 50 10 :math:`\mathrm{\le}`\ 1900 0.03 0.50 :math:`\mathrm{\le}`\ 150 0.75 0.04 -0.50 + 24 irrigated temperate soybean 279.15 50 10 :math:`\mathrm{\le}`\ 1900 0.03 0.50 :math:`\mathrm{\le}`\ 150 0.75 0.04 -0.50 + 41 rainfed cotton 283.15 50 10 :math:`\mathrm{\le}`\ 1700 0.03 0.50 :math:`\mathrm{\le}`\ 160 1.50 0.04 -0.50 + 42 irrigated cotton 283.15 50 10 :math:`\mathrm{\le}`\ 1700 0.03 0.50 :math:`\mathrm{\le}`\ 160 1.50 0.04 -0.50 + 61 rainfed rice 283.15 50 10 :math:`\mathrm{\le}`\ 2100 0.01 0.40 :math:`\mathrm{\le}`\ 150 1.80 0.04 0.65 + 62 irrigated rice 283.15 50 10 :math:`\mathrm{\le}`\ 2100 0.01 0.40 :math:`\mathrm{\le}`\ 150 1.80 0.04 0.65 + 67 rainfed sugarcane 283.15 50 10 950-1850 0.03 0.65 :math:`\mathrm{\le}`\ 300 4.00 0.05 -0.50 + 68 irrigated sugarcane 283.15 50 10 950-1850 0.03 0.65 :math:`\mathrm{\le}`\ 300 4.00 0.05 -0.50 + 75 rainfed tropical corn 283.15 50 10 :math:`\mathrm{\le}`\ 1800 0.03 0.50 :math:`\mathrm{\le}`\ 160 2.50 0.05 -0.50 + 76 irrigated tropical corn 283.15 50 10 :math:`\mathrm{\le}`\ 1800 0.03 0.50 :math:`\mathrm{\le}`\ 160 2.50 0.05 -0.50 + 77 rainfed tropical soybean 283.15 50 10 :math:`\mathrm{\le}`\ 2100 0.03 0.50 :math:`\mathrm{\le}`\ 150 1.00 0.04 -0.50 + 78 irrigated tropical soybean 283.15 50 10 :math:`\mathrm{\le}`\ 2100 0.03 0.50 :math:`\mathrm{\le}`\ 150 1.00 0.04 -0.50 + === =========================== ================= =========================== ============================= =========================== ============================= ============================= =========================== =========================== =================================== ======================= + +Notes: :math:`T_{p}` is the minimum planting temperatures. :math:`{GDD}_{min}` is the lowest +(for planting) 20-year running mean growing degree-days base on the base temperature in the 5\ :sup:`th` column, tracked from April to September (NH). :math:`{GDD}_{mat}` is a crop’s 20-year running mean growing degree-days needed for vegetative and physiological maturity. Harvest occurs at 100%\ :math:`{GDD}_{mat}` or when the days past planting -reach the number in the 10\ :sup:`th` column. Crop growth phases +reach the number in the 9\ :sup:`th` column. Crop growth phases are described in the text. :math:`z_{top}^{\max }` is the maximum -top-of-canopy height of a crop, *SLA* is specific leaf area, and leaf -orientation index, :math:`\chi _{L}` , equals -1 for vertical, 0 for +top-of-canopy height of a crop, *SLA* is specific leaf area. :math:`\chi _{L}` is the leaf +orientation index, equals -1 for vertical, 0 for random, and 1 for horizontal leaf orientation. .. _Table Crop pfts in CLM4.5CNcrop and their parameters: -.. table:: Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. - - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | | :math:`a_{leaf}^{i}` | :math:`{L}_{max}` | :math:`a_{froot}^{i}` | :math:`a_{froot}^{f}` | :math:`a_{leaf}^{f}` | :math:`a_{livestem}^{f}` | :math:`d_{L}` | :math:`d_{alloc}^{stem}` | :math:`d_{alloc}^{leaf}` | | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | | fraction | m\ :sup:`2` m\ :sup:`-2` | | | | | | | | | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | 17. | Rainfed Corn (also referred to as Maize) | 0.800 | 5 | 0.400 | 0.050 | 0.000 | 0.000 | 1.05 | 2 | 5 | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | 18. | Irrigated Corn (also referred to as Maize) | 0.800 | 5 | 0.400 | 0.050 | 0.000 | 0.000 | 1.05 | 2 | 5 | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | 19. | Rainfed Temperate Cereals | 0.750 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | 20. | Irrigated Temperate Cereals | 0.750 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | 21. | Rainfed Winter cereals (place holder) | 0.425 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | 22. | Irrigated Winter cereals (place holder) | 0.425 | 7 | 0.300 | 0.000 | 0.000 | 0.050 | 1.05 | 1 | 3 | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | 23. | Rainfed Soybean | 0.850 | 6 | 0.500 | 0.200 | 0.000 | 0.300 | 1.05 | 5 | 2 | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ - | 24. | Irrigated Soybean | 0.850 | 6 | 0.500 | 0.200 | 0.000 | 0.300 | 1.05 | 5 | 2 | - +-------+----------------------------------------------+------------------------------------------+--------------------------+--------------------------+-------------------------+-----------------------------+----------------------+---------------------------------+-----------------------------+-----+ +.. table:: Crop pfts in CLM5BGCCROP and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. + + === =========================== ==================== =========================================== ===================== ===================== ==================== ======================== ============= ======================== ======================== + IVT Phenological Type :math:`a_{leaf}^{i}` :math:`{L}_{max}` (m :sup:`2` m :sup:`-2`) :math:`a_{froot}^{i}` :math:`a_{froot}^{f}` :math:`a_{leaf}^{f}` :math:`a_{livestem}^{f}` :math:`d_{L}` :math:`d_{alloc}^{stem}` :math:`d_{alloc}^{leaf}` + === =========================== ==================== =========================================== ===================== ===================== ==================== ======================== ============= ======================== ======================== + 17 rainfed temperate corn 0.80 5 0.4 0.05 0 0.00 1.05 2 5 + 18 irrigated temperate corn 0.80 5 0.4 0.05 0 0.00 1.05 2 5 + 19 rainfed spring wheat 0.90 7 0.1 0.00 0 0.05 1.05 1 3 + 20 irrigated spring wheat 0.90 7 0.1 0.00 0 0.05 1.05 1 3 + 23 rainfed temperate soybean 0.85 6 0.2 0.20 0 0.30 1.05 5 2 + 24 irrigated temperate soybean 0.85 6 0.2 0.20 0 0.30 1.05 5 2 + 41 rainfed cotton 0.85 6 0.2 0.20 0 0.30 1.05 5 2 + 42 irrigated cotton 0.85 6 0.2 0.20 0 0.30 1.05 5 2 + 61 rainfed rice 0.75 7 0.1 0.00 0 0.05 1.05 1 3 + 62 irrigated rice 0.75 7 0.1 0.00 0 0.05 1.05 1 3 + 67 rainfed sugarcane 0.80 5 0.4 0.05 0 0.00 1.05 2 5 + 68 irrigated sugarcane 0.80 5 0.4 0.05 0 0.00 1.05 2 5 + 75 rainfed tropical corn 0.80 5 0.4 0.05 0 0.00 1.05 2 5 + 76 irrigated tropical corn 0.80 5 0.4 0.05 0 0.00 1.05 2 5 + 77 rainfed tropical soybean 0.85 6 0.2 0.20 0 0.30 1.05 5 2 + 78 irrigated tropical soybean 0.85 6 0.2 0.20 0 0.30 1.05 5 2 + === =========================== ==================== =========================================== ===================== ===================== ==================== ======================== ============= ======================== ======================== Notes: Crop growth phases and corresponding variables are described in the text @@ -738,7 +730,7 @@ calculated as .. math:: :label: 25.14) - leaf\_ to\_ retransn=\frac{c_{leaf} }{CN_{leaf} } -\frac{c_{leaf} }{CN_{leaf}^{f} } + leaf\_ to\_ retransn=\frac{c_{leaf} }{CN_{leaf} } -\frac{c_{leaf} }{CN_{leaf}^{f} } .. math:: :label: 25.15) From 8229a0839a9161f773ffda4979586311cdae92b1 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 5 Jun 2017 08:00:34 -0600 Subject: [PATCH 0043/1973] math cleanup --- .../tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst | 5 ++++- .../tech_note/Introduction/CLM50_Tech_Note_Introduction.rst | 2 +- .../Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 4e203f8586..253ea92109 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -851,7 +851,10 @@ and \begin{array}{l} {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } = \frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } - = \left(2B_{i} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array}. + = \left(2B_{i} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array} + +where :math:`\overline{\theta}_{liq} = 0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)`, +:math:`\overline{\theta}_{sat} = 0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)`. Equation set for layer :math:`i=1` '''''''''''''''''''''''''''''''''''''''''' diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 027d92e9e2..157b564d7e 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -232,7 +232,7 @@ Jinyun Tang, Zong-Liang Yang** - :numref:`Table Crop plant functional types` Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. -- :numref:`Table Crop pfts in CLM4.5CNcrop and their parameters` Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. +- :numref:`Table Crop pfts` Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. - :numref:`Table Pre- and post-grain fill CN ratios` Pre- and post-grain fill C:N ratios for crop leaf, stem, fine root, and reproductive pools. diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index d20ac17a27..ec565fe1d3 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -136,17 +136,17 @@ and The upscatter for diffuse radiation is .. math:: - :label: ZEqnNum472968 + :label: 3.13 \omega _{\Lambda }^{veg} \beta _{\Lambda }^{veg} =\frac{1}{2} \left[\alpha _{\Lambda } +\tau _{\Lambda } +\left(\alpha _{\Lambda } -\tau _{\Lambda } \right)\cos ^{2} \bar{\theta }\right] where :math:`\bar{\theta }` is the mean leaf inclination angle relative to the horizontal plane (i.e., the angle between leaf normal and local -vertical) (Sellers 1985). Here, :math:`\cos \bar{\theta }` is +vertical) (:ref:`Sellers (1985) `). Here, :math:`\cos \bar{\theta }` is approximated by .. math:: - :label: ZEqnNum720349 + :label: 3.14 \cos \bar{\theta }=\frac{1+\chi _{L} }{2} From 692bd7f8b2ddd43e542ed40c6a892ae497e8101a Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 5 Jun 2017 09:00:59 -0600 Subject: [PATCH 0044/1973] fix overwritten hydrology changes --- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 485 +++++++++--------- .../References/CLM50_Tech_Note_References.rst | 2 +- 2 files changed, 257 insertions(+), 230 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 126fd05cda..9dec375356 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -17,7 +17,7 @@ m\ :sup:`-2` or mm of H\ :sub:`2`\ O) (:numref:`Figure Hydrologic processes`). The total water balance of the system is .. math:: - :label: 7.1) + :label: 7.1 \begin{array}{l} {\Delta W_{can,\,liq} +\Delta W_{can,\,sno} +\Delta W_{sfc} +\Delta W_{sno} +} \\ {\sum _{i=1}^{N_{levsoi} }\left(\Delta w_{liq,\, i} +\Delta w_{ice,\, i} \right)+\Delta W_{a} =\left(\begin{array}{l} {q_{rain} +q_{sno} -E_{v} -E_{g} -q_{over} } \\ {-q_{h2osfc} -q_{drai} -q_{rgwl} -q_{snwcp,\, ice} } \end{array}\right) \Delta t} \end{array} @@ -54,56 +54,58 @@ Interception by vegetation is divided between liquid and solid phases :math:`q_{intr,\,liq}` and :math:`q_{intr,\,ice}` (kg m\ :sup:`-2` s\ :sup:`-1`) .. math:: - :label: 7.2) + :label: 7.2 q_{intr,\,liq} =\alpha_{liq} \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} .. math:: - :label: 7.3) + :label: 7.3 q_{intr,\,ice} =\alpha_{sno} \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} where :math:`L` and :math:`S` are the exposed leaf and stem area index, -respectively (section 2.1.4), and the :math:`\alpha`\'s scale -the fractional area of a leaf that collects water (:ref:`Lawrence et al. 2007 `). -Values of :math:`\alpha_{liq} = 0.25` and :math:`\alpha_{sno} = 1` reflect the increased capacity one side of a leaf has for snow than liquid water. +respectively (section :numref:`Phenology and vegetation burial by snow`), and +the :math:`\alpha`\'s scale the fractional area of a leaf that collects water +(:ref:`Lawrence et al. 2007 `). Values of +:math:`\alpha_{liq} = 0.25` and :math:`\alpha_{sno} = 1` reflect the increased +capacity one side of a leaf has for snow than liquid water. Throughfall (kg m\ :sup:`-2` s\ :sup:`-1`) is also divided into liquid and solid phases, reaching the ground (soil or snow surface) as .. math:: - :label: 7.4) + :label: 7.4 q_{thru,\, liq} =q_{rain} \left[1-\alpha_{liq} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right] .. math:: - :label: 7.5) + :label: 7.5 q_{thru,\, ice} =q_{sno} \left[1-\alpha_{sno} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right]. Similarly, the liquid and solid canopy drip fluxes are .. math:: - :label: 7.6) + :label: 7.6 q_{drip,\, liq} =\frac{W_{can,\,liq}^{intr} -W_{can,\,liq}^{max } }{\Delta t} \ge 0 .. math:: - :label: 7.7) + :label: 7.7 q_{drip,\, ice} =\frac{W_{can,\,sno}^{intr} -W_{can,\,sno}^{max } }{\Delta t} \ge 0 where .. math:: - :label: 7.8) + :label: 7.8 W_{can,liq}^{intr} =W_{can,liq}^{n} +q_{intr} \Delta t\ge 0 and .. math:: - :label: 7.9) + :label: 7.9 W_{can,sno}^{intr} =W_{can,sno}^{n} +q_{intr} \Delta t\ge 0 @@ -115,12 +117,12 @@ from the previous time step, and :math:`W_{can,\,liq}^{max }` and :math:`W_{can, They are defined by .. math:: - :label: 7.10) + :label: 7.10 W_{can,\,liq}^{max } =p_{liq}\left(L+S\right) .. math:: - :label: 7.11) + :label: 7.11 W_{can,\,sno}^{max } =p_{ice}\left(L+S\right). @@ -132,17 +134,17 @@ Canopy snow unloading from wind speed :math:`u` and above-freezing temperatures fluxes and e-folding times similar to :ref:`Roesch et al. (2001) ` .. math:: - :label: 7.12) + :label: 7.12 q_{unl,\, wind} =\frac{u W_{can,sno}}{1.56\times 10^5 \text{ m}} .. math:: - :label: 7.13) + :label: 7.13 q_{unl,\, temp} =\frac{W_{can,sno}(T-270 \textrm{ K})}{1.87\times 10^5 \text{ K s}} > 0 .. math:: - :label: 7.14) + :label: 7.14 q_{unl,\, tot} =\min \left( q_{unl,\, wind} +q_{unl,\, temp} ,W_{can,\, sno} \right) @@ -150,14 +152,14 @@ fluxes and e-folding times similar to :ref:`Roesch et al. (2001) T_{f} \\ - 0 & T_v \le T_f - \end{cases} + E_{v}^{liq} = + \left\{\begin{array}{lr} + E_{v}^{w} & T_v > T_{f} \\ + 0 & T_v \le T_f + \end{array}\right\} .. math:: - :label: 7.18) + :label: 7.18 - E_{v}^{ice} &= \begin{cases} - 0 & T_v > T_f \\ - E_{v}^{w} & T_v \le T_f - \end{cases} . + E_{v}^{ice} = + \left\{\begin{array}{lr} + 0 & T_v > T_f \\ + E_{v}^{w} & T_v \le T_f + \end{array}\right\}. .. \begin{array}{lr} .. E_{v}^{liq} = E_{v}^{w} \qquad T > 273 \text{K} \\ @@ -191,12 +195,12 @@ surface evaporation :math:`E_{v}^{w}` (Chapter :numref:`rst_Momentum, Sensible H The total rate of liquid and solid precipitation reaching the ground is then .. math:: - :label: ZEqnNum946822 + :label: 7.19 q_{grnd,liq} =q_{thru,\, liq} +q_{drip,\, liq} .. math:: - :label: ZEqnNum339590 + :label: 7.20 q_{grnd,ice} =q_{thru,\, ice} +q_{drip,\, ice} +q_{unl,\, tot} . @@ -213,7 +217,7 @@ for surface flux (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat calculations, is (:ref:`Dickinson et al.1993 `) .. math:: - :label: 7.21) + :label: 7.21 f_{wet} = \left\{\begin{array}{lr} @@ -224,7 +228,7 @@ calculations, is (:ref:`Dickinson et al.1993 `) while the fraction of the canopy that is dry and transpiring is .. math:: - :label: 7.22) + :label: 7.22 f_{dry} = \left\{\begin{array}{lr} @@ -236,7 +240,7 @@ Similarly, the snow-covered fraction of the canopy is used for surface alebdo wh .. math:: - :label: 7.23) + :label: 7.23 f_{can,\, sno} = \left\{\begin{array}{lr} @@ -271,28 +275,28 @@ portion of a grid cell contributes to surface runoff, :math:`q_{over}` , by the saturation excess mechanism (Dunne runoff) .. math:: - :label: ZEqnNum549608 + :label: 7.64 - q_{over} =f_{sat} q_{liq,\, 0} + q_{over} =f_{sat} \ q_{liq,\, 0} The fractional saturated area is a function of soil moisture .. math:: - :label: 7.65) + :label: 7.65 - f_{sat} =f_{\max } \exp \left(-0.5f_{over} z_{\nabla } \right) + f_{sat} =f_{\max } \ \exp \left(-0.5f_{over} z_{\nabla } \right) where :math:`f_{\max }` is the potential or maximum value of -:math:`f_{sat}` , :math:`f_{over}` is a decay factor -(m\ :sup:`-1`), and :math:`z_{\nabla}` is the water table depth -(m) (section 7.6). The maximum saturated fraction, :math:`f_{\max }` , -is defined as the value of the discrete cumulative distribution function -(CDF) of the topographic index when the grid cell mean water table depth -is zero. Thus, :math:`f_{\max }` is the percent of pixels in a grid -cell whose topographic index is larger than or equal to the grid cell -mean topographic index. It should be calculated explicitly from the CDF -at each grid cell at the resolution that the model is run. However, -because this is a computationally intensive task for global +:math:`f_{sat}` , :math:`f_{over}` is a decay factor (m\ :sup:`-1`), and +:math:`z_{\nabla}` is the water table depth (m) (section +:numref:`Lateral Sub-surface Runoff`). The maximum saturated fraction, +:math:`f_{\max }`, is defined as the value of the discrete cumulative +distribution function (CDF) of the topographic index when the grid cell +mean water table depth is zero. Thus, :math:`f_{\max }` is the percent of +pixels in a grid cell whose topographic index is larger than or equal to +the grid cell mean topographic index. It should be calculated explicitly +from the CDF at each grid cell at the resolution that the model is run. +However, because this is a computationally intensive task for global applications, :math:`f_{\max }` is calculated once at 0.125\ :sup:`o` resolution using the 1-km compound topographic indices (CTIs) based on the HYDRO1K dataset (:ref:`Verdin and Greenlee 1996 `) @@ -330,17 +334,17 @@ height (relative to the grid cell mean elevation) of the surface water, :math:`d`, by .. math:: - :label: ZEqnNum277892 + :label: 7.66 W_{sfc} =\frac{d}{2} \left(1+erf\left(\frac{d}{\sigma _{micro} \sqrt{2} } \right)\right)+\frac{\sigma _{micro} }{\sqrt{2\pi } } e^{\frac{-d^{2} }{2\sigma _{micro} ^{2} } } where :math:`erf` is the error function. For a given value of -:math:`W_{sfc}` , equation can be solved for :math:`d` using the +:math:`W_{sfc}` , :eq:`7.66` can be solved for :math:`d` using the Newton-Raphson method. Once :math:`d` is known, one can determine the fraction of the area that is inundated as .. math:: - :label: 7.67) + :label: 7.67 f_{h2osfc} =\frac{1}{2} \left(1+erf\left(\frac{d}{\sigma _{micro} \sqrt{2} } \right)\right) @@ -348,15 +352,15 @@ No global datasets exist for microtopography, so the default parameterization is a simple function of slope .. math:: - :label: 7.68) + :label: 7.68 \sigma _{micro} =\left(\beta +\beta _{0} \right)^{\eta } where :math:`\beta` is the topographic slope, -:math:`\beta _{0} =\left(\sigma _{\max } \right)^{\frac{1}{\eta } }` \ determines -the maximum value of :math:`\sigma _{}` , and :math:`\eta` is an +:math:`\beta_{0} =\left(\sigma_{\max } \right)^{\frac{1}{\eta } }` \ determines +the maximum value of :math:`\sigma_{micro}` , and :math:`\eta` is an adjustable parameter. Default values in the model are -:math:`\sigma _{\max } =0.4` and :math:`\eta =-3`. +:math:`\sigma_{\max } =0.4` and :math:`\eta =-3`. If the spatial scale of the microtopography is small relative to that of the grid cell, one can assume that the inundated areas are distributed @@ -365,7 +369,7 @@ percolation theory can be used to quantify the fraction of the inundated portion of the grid cell that is interconnected .. math:: - :label: 7.69) + :label: 7.69 \begin{array}{lr} f_{connected} =\left(f_{h2osfc} -f_{c} \right)^{\mu } & \qquad f_{h2osfc} >f_{c} \\ f_{connected} =0 &\qquad f_{h2osfc} \le f_{c} \end{array} @@ -377,14 +381,14 @@ surpasses :math:`f_{c}` , the surface water store acts as a linear reservoir .. math:: - :label: 7.70) + :label: 7.70 - qout,h2osfc=kh2osfcf_{connected} (Wsfc-Wc)\frac{1}{\Delta t} + q_{out,h2osfc}=k_{h2osfc} \ f_{connected} \ (Wsfc-Wc)\frac{1}{\Delta t} -where :math:`qout,h2osfc` is the surface water runoff, :math:`kh2osfc` +where :math:`q_{out,h2osfc}` is the surface water runoff, :math:`k_{h2osfc}` is a constant, :math:`Wc` is the amount of surface water present when :math:`f_{h2osfc} =f_{c}` , and :math:`\Delta t` is the model time step. -The linear storage coefficent :math:`kh2osfc=\sin \left(\beta \right)` +The linear storage coefficent :math:`k_{h2osfc} = \sin \left(\beta \right)` is a function of grid cell mean topographic slope where :math:`\beta` is the slope in radians. @@ -397,9 +401,9 @@ The surface moisture flux remaining after surface runoff has been removed, .. math:: - :label: 7.71) + :label: 7.71 - qin,surface=(1-f_{sat} )q_{liq,\, 0} + q_{in,surface} = (1-f_{sat}) \ q_{liq,\, 0} is divided into inputs to surface water (:math:`q_{in,\, h2osfc}` ) and the soil :math:`q_{in,soil}` . If :math:`q_{in,soil}` exceeds the @@ -407,15 +411,15 @@ maximum soil infiltration capacity (kg m\ :sup:`-2` s\ :sup:`-1`), .. math:: - :label: ZEqnNum569150 + :label: 7.72 - q_{infl,\, \max } =(1-fsat){\rm \Theta }iceksat + q_{infl,\, \max } =(1-f_{sat}) \ \Theta_{ice} k_{sat} -where :math:`{\rm \Theta }ice` is an ice impedance factor (section +where :math:`\Theta_{ice}` is an ice impedance factor (section :numref:`Hydraulic Properties`), infiltration excess (Hortonian) runoff is generated .. math:: - :label: 7.73) + :label: 7.73 q_{infl,\, excess} =\max \left(q_{in,soil} -\left(1-f_{h2osfc} \right)q_{\inf l,\max } ,0\right) @@ -423,38 +427,39 @@ and transferred from :math:`q_{in,soil}` to :math:`q_{in,h2osfc}` . After evaporative losses have been removed, these moisture fluxes are .. math:: - :label: 7.74) + :label: 7.74 - q_{in,\, h2osfc} =f_{h2osfc} q_{in,surface} +q_{infl,excess} -q_{evap,h2osfc} + q_{in,\, h2osfc} = f_{h2osfc} q_{in,surface} + q_{infl,excess} - q_{evap,h2osfc} and .. math:: - :label: 7.75) + :label: 7.75 - qin,soil=(1-f_{h2osfc} )q_{in,surface} -q_{\inf l,excess} -(1-f_{sno} -f_{h2osfc} )qevap,soil. + qin,soil=(1-f_{h2osfc} )q_{in,surface} - q_{\inf l,excess} - (1-f_{sno} -f_{h2osfc} ) \ qevap,soil. The balance of surface water is then calculated as .. math:: - :label: 7.76) + :label: 7.76 + + \Delta W_{sfc} =\left(q_{in,h2osfc} - q_{out,h2osfc} - q_{drain,h2osfc} \right) \ \Delta t. - \Delta W_{sfc} =\left(qin,h2osfc-qout,h2osfc-qdrain,h2osfc\right)\Delta t. Bottom drainage from the surface water store .. math:: - :label: 7.77) + :label: 7.77 - qdrain,h2osfc=\min \left(f_{h2osfc} q_{\inf l,\max } ,\frac{W_{sfc} }{\Delta t} \right) + q_{drain,h2osfc} = \min \left(f_{h2osfc} q_{\inf l,\max } ,\frac{W_{sfc} }{\Delta t} \right) is then added to :math:`q_{in,soil}` giving the total infiltration into the surface soil layer .. math:: - :label: 7.78) + :label: 7.78 - q_{infl} =q_{in,soil} +q_{drain,h2osfc} + q_{infl} = q_{in,soil} + q_{drain,h2osfc} Infiltration :math:`q_{infl}` and explicit surface runoff :math:`q_{over}` are not allowed for glaciers. @@ -475,7 +480,7 @@ For one-dimensional vertical water flow in soils, the conservation of mass is stated as .. math:: - :label: ZEqnNum790844 + :label: 7.79 \frac{\partial \theta }{\partial t} =-\frac{\partial q}{\partial z} -Q @@ -497,16 +502,16 @@ The soil water flux :math:`q` in equation can be described by Darcy’s law :ref:`(Dingman 2002) ` .. math:: - :label: 7.80) + :label: 7.80 - q=-k\frac{\partial \psi _{h} }{\partial z} + q = -k \frac{\partial \psi _{h} }{\partial z} where :math:`k` is the hydraulic conductivity (mm s\ :sup:`-1`), and :math:`\psi _{h}` is the hydraulic potential (mm). The hydraulic potential is .. math:: - :label: 7.81) + :label: 7.81 \psi _{h} =\psi _{m} +\psi _{z} @@ -519,22 +524,22 @@ If the reference elevation is the soil surface, then becomes .. math:: - :label: ZEqnNum186573 + :label: 7.82 - q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]. + q = -k \left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]. -Equation :eq:`ZEqnNum186573` can be further manipulated to yield +Equation :eq:`7.82` can be further manipulated to yield .. math:: - :label: 7.83) + :label: 7.83 q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]=-k\left(\frac{\partial \psi }{\partial z} +1\right)=-k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right). -Substitution of this equation into equation :eq:`ZEqnNum790844`, with :math:`Q=0`, yields +Substitution of this equation into equation :eq:`7.79`, with :math:`Q=0`, yields the Richards equation .. math:: - :label: ZEqnNum670361 + :label: 7.84 \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right)\right]. @@ -546,7 +551,8 @@ Hydraulic Properties The hydraulic conductivity :math:`k_{i}` (mm s\ :sup:`-1`) and the soil matric potential :math:`\psi _{i}` (mm) for layer :math:`i` vary with volumetric soil water :math:`\theta _{i}` and soil texture. -As with the soil thermal properties (section :numref:`Soil And Snow Thermal Properties`) the hydraulic +As with the soil thermal properties (section +:numref:`Soil And Snow Thermal Properties`) the hydraulic properties of the soil are assumed to be a weighted combination of the mineral properties, which are determined according to sand and clay contents based on work by :ref:`Clapp and Hornberger (1978) @@ -555,29 +561,33 @@ and organic properties of the soil (:ref:`Lawrence and Slater 2008 `). The hydraulic conductivity is defined at the depth of the interface of -two adjacent layers :math:`z_{h,\, i}` (:numref:`Figure Water flux schematic`) and is a function -of the saturated hydraulic conductivity +two adjacent layers :math:`z_{h,\, i}` (:numref:`Figure Water flux schematic`) +and is a function of the saturated hydraulic conductivity :math:`k_{sat} \left[z_{h,\, i} \right]`, the liquid volumetric soil -moisture of the two layers :math:`\theta _{i}` and -:math:`\theta _{i+1}` and an ice impedance factor -:math:`\Theta _{ice}` +moisture of the two layers :math:`\theta _{i}` and :math:`\theta_{i+1}` +and an ice impedance factor :math:`\Theta_{ice}` .. math:: - :label: ZEqnNum398074 + :label: 7.85 k\left[z_{h,\, i} \right] = \left\{\begin{array}{lr} - \Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)}{0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)} \right]^{2B_{i} +3} & \qquad 1 \le i \le N_{levsoi} - 1 \\ - \Theta _{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{2B_{i} +3} & \qquad i = N_{levsoi} + \Theta_{ice} k_{sat} \left[z_{h,\, i} \right]\left[\frac{0.5\left(\theta_{\, i} +\theta_{\, i+1} \right)}{0.5\left(\theta_{sat,\, i} +\theta_{sat,\, i+1} \right)} \right]^{2B_{i} +3} & \qquad 1 \le i \le N_{levsoi} - 1 \\ + \Theta_{ice} k_{sat} \left[z_{h,\, i} \right]\left(\frac{\theta_{\, i} }{\theta_{sat,\, i} } \right)^{2B_{i} +3} & \qquad i = N_{levsoi} \end{array}\right\}. The ice impedance factor is a function of ice content, and is meant to quantify the increased tortuosity of the water flow when part of the pore space is filled with ice. :ref:`Swenson et al. (2012) ` -used a power law form :math:`\Theta _{ice} = 10^{-\Omega F_{ice} }` where -:math:`\Omega = 6`\ and -:math:`F_{ice} = \frac{\theta_{ice} }{\theta_{sat} }` is the -ice-filled fraction of the pore space. +used a power law form + +.. math:: + :label: 7.86 + + \Theta_{ice} = 10^{-\Omega F_{ice} } + +where :math:`\Omega = 6`\ and :math:`F_{ice} = \frac{\theta_{ice} }{\theta_{sat} }` +is the ice-filled fraction of the pore space. Because the hydraulic properties of mineral and organic soil may differ significantly, the bulk hydraulic properties of each soil layer are @@ -585,32 +595,32 @@ computed as weighted averages of the properties of the mineral and organic components. The water content at saturation (i.e. porosity) is .. math:: - :label: 7.90) + :label: 7.90 - \theta _{sat,i} =(1-f_{om,i} )\theta _{sat,\min ,i} +f_{om,i} \theta _{sat,om} + \theta_{sat,i} =(1-f_{om,i} )\theta_{sat,\min ,i} +f_{om,i} \theta_{sat,om} where :math:`f_{om,i}` is the soil organic matter fraction, -:math:`\theta _{sat,om} =0.9` (:ref:`Farouki 1981 `; +:math:`\theta_{sat,om} =0.9` (:ref:`Farouki 1981 `; :ref:`Letts et al. 2000 `) is the porosity of organic matter and the porosity of the mineral soil -:math:`\theta _{sat,\min ,i}` is +:math:`\theta_{sat,\min ,i}` is .. math:: - :label: 7.91) + :label: 7.91 - \theta _{sai,\min ,i} = 0.489 - 0.00126(\% sand)_{i} . + \theta_{sat,\min ,i} = 0.489 - 0.00126(\% sand)_{i} . The exponent :math:`B_{i}` is .. math:: - :label: 7.92) + :label: 7.92 B_{i} =(1-f_{om,i} )B_{\min ,i} +f_{om,i} B_{om} where :math:`B_{om} = 2.7` \ (:ref:`Letts et al. 2000 `) and .. math:: - :label: 7.93) + :label: 7.93 B_{\min ,i} =2.91+0.159(\% clay)_{i} . @@ -618,14 +628,14 @@ The soil matric potential (mm) is defined at the node depth :math:`z_{i}` of each layer :math:`i` (:numref:`Figure Water flux schematic`) .. math:: - :label: ZEqnNum316201 + :label: 7.94 - \psi _{i} =\psi _{sat,\, i} \left(\frac{\theta _{\, i} }{\theta _{sat,\, i} } \right)^{-B_{i} } \ge -1\times 10^{8} \qquad 0.01\le \frac{\theta _{i} }{\theta _{sat,\, i} } \le 1 + \psi _{i} =\psi _{sat,\, i} \left(\frac{\theta_{\, i} }{\theta_{sat,\, i} } \right)^{-B_{i} } \ge -1\times 10^{8} \qquad 0.01\le \frac{\theta_{i} }{\theta_{sat,\, i} } \le 1 where the saturated soil matric potential (mm) is .. math:: - :label: 7.95) + :label: 7.95 \psi _{sat,i} =(1-f_{om,i} )\psi _{sat,\min ,i} +f_{om,i} \psi _{sat,om} @@ -634,7 +644,7 @@ saturated organic matter matric potential and the saturated mineral soil matric potential :math:`\psi _{sat,\min ,i}` \ is .. math:: - :label: 7.96) + :label: 7.96 \psi _{sat,\, \min ,\, i} =-10.0\times 10^{1.88-0.0131(\% sand)_{i} } . @@ -652,28 +662,28 @@ fractions using a result from percolation theory (:ref:`Stauffer and Aharony 1994 `, :ref:`Berkowitz and Balberg 1992 `). Assuming that the organic and mineral fractions are randomly distributed throughout a soil layer, percolation theory predicts that above a threshold value -:math:`f_{om} =f_{threshold}` , connected flow pathways consisting of +:math:`f_{om} = f_{threshold}`, connected flow pathways consisting of organic material only exist and span the soil space. Flow through these pathways interacts only with organic material, and thus can be described -by :math:`k_{sat,\, om}` . This fraction of the grid cell is given by +by :math:`k_{sat,\, om}`. This fraction of the grid cell is given by .. math:: - :label: 7.97) + :label: 7.97 \begin{array}{lr} - f_{perc} =\; N_{perc} \left(f_{om} {\rm \; }-f_{threshold} \right)^{\beta _{perc} } f_{om} {\rm \; } & \qquad f_{om} \ge f_{threshold} \\ + f_{perc} =\; N_{perc} \left(f_{om} {\rm \; }-f_{threshold} \right)^{\beta_{perc} } f_{om} {\rm \; } & \qquad f_{om} \ge f_{threshold} \\ f_{perc} = 0 & \qquad f_{om} `) as .. math:: - :label: 7.99) + :label: 7.99 k_{sat,\, \min } \left[z_{h,\, i} \right]=0.0070556\times 10^{-0.884+0.0153\left(\% sand\right)_{i} } . @@ -689,7 +699,7 @@ The bulk soil layer saturated hydraulic conductivity is then computed as .. math:: - :label: 7.100) + :label: 7.100 k_{sat} \left[z_{h,\, i} \right]=f_{uncon,\, i} k_{sat,\, uncon} \left[z_{h,\, i} \right]+(1-f_{uncon,\, i} )k_{sat,\, om} \left[z_{h,\, i} \right]. @@ -698,11 +708,11 @@ as Numerical Solution ^^^^^^^^^^^^^^^^^^^^^^^^ -With reference to :numref:`Figure Water flux schematic`, the equation for conservation of mass -(equation :eq:`ZEqnNum790844`) can be integrated over each layer as +With reference to :numref:`Figure Water flux schematic`, the equation for +conservation of mass (equation :eq:`7.79`) can be integrated over each layer as .. math:: - :label: 7.101) + :label: 7.101 \int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial \theta }{\partial t} \, dz=-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial q}{\partial z} \, dz-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }Q\, dz . @@ -711,9 +721,9 @@ as positive upward from the soil surface. This equation can be written as .. math:: - :label: ZEqnNum225309 + :label: 7.102 - \Delta z_{i} \frac{\partial \theta _{liq,\, i} }{\partial t} =-q_{i-1} +q_{i} -e_{i} + \Delta z_{i} \frac{\partial \theta_{liq,\, i} }{\partial t} =-q_{i-1} +q_{i} -e_{i} where :math:`q_{i}` is the flux of water across interface :math:`z_{h,\, i}` , :math:`q_{i-1}` is the flux of water across @@ -723,12 +733,12 @@ the layer (mm s\ :sup:`-1`). Taking the finite difference with time and evaluating the fluxes implicitly at time :math:`n+1` yields .. math:: - :label: ZEqnNum181361 + :label: 7.103 - \frac{\Delta z_{i} \Delta \theta _{liq,\, i} }{\Delta t} =-q_{i-1}^{n+1} +q_{i}^{n+1} -e_{i} + \frac{\Delta z_{i} \Delta \theta_{liq,\, i} }{\Delta t} =-q_{i-1}^{n+1} +q_{i}^{n+1} -e_{i} where -:math:`\Delta \theta _{liq,\, i} =\theta _{liq,\, i}^{n+1} -\theta _{liq,\, i}^{n}` +:math:`\Delta \theta_{liq,\, i} =\theta_{liq,\, i}^{n+1} -\theta_{liq,\, i}^{n}` is the change in volumetric soil liquid water of layer :math:`i` in time :math:`\Delta t`\ and :math:`\Delta z_{i}` is the thickness of layer :math:`i` (mm). @@ -738,7 +748,7 @@ function of the total transpiration :math:`E_{v}^{t}` (Chapter :numref:`rst_Mom the effective root fraction :math:`r_{e,\, i}` .. math:: - :label: ZEqnNum357392 + :label: 7.104 e_{i} =r_{e,\, i} E_{v}^{t} . @@ -750,7 +760,7 @@ the effective root fraction :math:`r_{e,\, i}` Shown are three soil layers, :math:`i-1`, :math:`i`, and :math:`i+1`. The soil matric potential :math:`\psi` and volumetric soil water -:math:`\theta _{liq}` are defined at the layer node depth :math:`z`. +:math:`\theta_{liq}` are defined at the layer node depth :math:`z`. The hydraulic conductivity :math:`k\left[z_{h} \right]` is defined at the interface of two layers :math:`z_{h}` . The layer thickness is :math:`\Delta z`. The soil water fluxes :math:`q_{i-1}` and @@ -764,7 +774,7 @@ soil column, the transpiration :math:`E_{v}^{t}` is a weighted sum of transpiration from all PFTs whose weighting depends on PFT area as .. math:: - :label: 7.105) + :label: 7.105 E_{v}^{t} =\sum _{j=1}^{npft}\left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} @@ -777,7 +787,7 @@ quantity that is a weighted sum over all PFTs. The weighting depends on the per unit area transpiration of each PFT and its relative area as .. math:: - :label: 7.106) + :label: 7.106 r_{e,\, i} =\frac{\sum _{j=1}^{npft}\left(r_{e,\, i} \right)_{j} \left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} }{\sum _{j=1}^{npft}\left(E_{v}^{t} \right)_{j} \left(wt\right)_{j} } @@ -785,60 +795,63 @@ where :math:`\left(r_{e,\, i} \right)_{j}` is the effective root fraction for the :math:`j^{th}` PFT .. math:: - :label: 7.107) - - \begin{array}{l} {\left(r_{e,\, i} \right)_{j} =\frac{\left(r_{i} \right)_{j} \left(w_{i} \right)_{j} }{\left(\beta _{t} \right)_{j} } \qquad \left(\beta _{t} \right)_{j} >0} \\ {\left(r_{e,\, i} \right)_{j} =0\qquad \left(\beta _{t} \right)_{j} =0} \end{array} + :label: 7.107 + \begin{array}{lr} + \left(r_{e,\, i} \right)_{j} =\frac{\left(r_{i} \right)_{j} \left(w_{i} \right)_{j} }{\left(\beta _{t} \right)_{j} } & \qquad \left(\beta _{t} \right)_{j} >0 \\ + \left(r_{e,\, i} \right)_{j} =0 & \qquad \left(\beta _{t} \right)_{j} =0 + \end{array} + and :math:`\left(r_{i} \right)_{j}` is the fraction of roots in layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), :math:`\left(w_{i} \right)_{j}` is a soil dryness or plant wilting factor -for layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), and :math:`\left(\beta _{t} \right)_{j}` is a wetness factor for the total +for layer :math:`i` (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`), and :math:`\left(\beta_{t} \right)_{j}` is a wetness factor for the total soil column for the :math:`j^{th}` PFT (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). -The soil water fluxes in equation , which are a function of -:math:`\theta _{liq,\, i}` and :math:`\theta _{liq,\, i+1}` because of +The soil water fluxes in :eq:`7.103`,, which are a function of +:math:`\theta_{liq,\, i}` and :math:`\theta_{liq,\, i+1}` because of their dependence on hydraulic conductivity and soil matric potential, can be linearized about :math:`\theta` using a Taylor series expansion as .. math:: - :label: 7.108) + :label: 7.108 - q_{i}^{n+1} =q_{i}^{n} +\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} +\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } \Delta \theta _{liq,\, i+1} + q_{i}^{n+1} =q_{i}^{n} +\frac{\partial q_{i} }{\partial \theta_{liq,\, i} } \Delta \theta_{liq,\, i} +\frac{\partial q_{i} }{\partial \theta_{liq,\, i+1} } \Delta \theta_{liq,\, i+1} .. math:: - :label: 7.109) + :label: 7.109 - q_{i-1}^{n+1} =q_{i-1}^{n} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } \Delta \theta _{liq,\, i-1} +\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } \Delta \theta _{liq,\, i} . + q_{i-1}^{n+1} =q_{i-1}^{n} +\frac{\partial q_{i-1} }{\partial \theta_{liq,\, i-1} } \Delta \theta_{liq,\, i-1} +\frac{\partial q_{i-1} }{\partial \theta_{liq,\, i} } \Delta \theta_{liq,\, i} . Substitution of these expressions for :math:`q_{i}^{n+1}` and -:math:`q_{i-1}^{n+1}` into equation results in a general tridiagonal +:math:`q_{i-1}^{n+1}` into :eq:`7.103` results in a general tridiagonal equation set of the form .. math:: - :label: 7.110) + :label: 7.110 - r_{i} =a_{i} \Delta \theta _{liq,\, i-1} +b_{i} \Delta \theta _{liq,\, i} +c_{i} \Delta \theta _{liq,\, i+1} + r_{i} =a_{i} \Delta \theta_{liq,\, i-1} +b_{i} \Delta \theta_{liq,\, i} +c_{i} \Delta \theta_{liq,\, i+1} where .. math:: - :label: ZEqnNum557934 + :label: 7.111 - a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta_{liq,\, i-1} } .. math:: - :label: 7.112) + :label: 7.112 - b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + b_{i} =\frac{\partial q_{i} }{\partial \theta_{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta_{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.113) + :label: 7.113 - c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } + c_{i} =\frac{\partial q_{i} }{\partial \theta_{liq,\, i+1} } .. math:: - :label: ZEqnNum981892 + :label: 7.114 r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . @@ -846,77 +859,89 @@ The tridiagonal equation set is solved over :math:`i=1,\ldots ,N_{levsoi}`. The finite-difference forms of the fluxes and partial derivatives in -equations - can be obtained from equation as +equations :eq:`7.111` - :eq:`7.114` can be obtained from equation as .. math:: - :label: 7.115) + :label: 7.115 - q_{i-1}^{n} =-k\left[z_{h,\, i-1} \right]\left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] + q_{i-1}^{n} =-k\left[z_{h,\, i-1} \right]\left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: - :label: 7.116) + :label: 7.116 - q_{i}^{n} =-k\left[z_{h,\, i} \right]\left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] + q_{i}^{n} =-k\left[z_{h,\, i} \right]\left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} -z_{i} } \right] .. math:: - :label: 7.117) + :label: 7.117 - \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } =-\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, i-1} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] + \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } =-\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, i-1} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} - z_{i-1} } \right] .. math:: - :label: 7.118) + :label: 7.118 + + \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } =\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(z_{i} - z_{i-1} \right)}{z_{i} - z_{i-1} } \right] - \frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } =\left[\frac{k\left[z_{h,\, i-1} \right]}{z_{i} -z_{i-1} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i-1} -\psi _{i} \right)+\left(\psi _{E,\, i} -\psi _{E,\, i-1} \right)}{z_{i} -z_{i-1} } \right] .. math:: - :label: 7.119) + :label: 7.119 - \frac{\partial q_{i} }{\partial \theta _{liq,\, i} } =-\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right] + \frac{\partial q_{i} }{\partial \theta _{liq,\, i} } =-\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i} }{\partial \theta _{liq,\, i} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} - z_{i} } \right] .. math:: - :label: 7.120) + :label: 7.120 - \frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } =\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(\psi _{E,\, i+1} -\psi _{E,\, i} \right)}{z_{i+1} -z_{i} } \right]. + \frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } =\left[\frac{k\left[z_{h,\, i} \right]}{z_{i+1} -z_{i} } \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } \right]-\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } \left[\frac{\left(\psi _{i} -\psi _{i+1} \right)+\left(z_{i+1} - z_{i} \right)}{z_{i+1} - z_{i} } \right]. The derivatives of the soil matric potential at the node depth are -derived from equation +derived from :eq:`7.94` .. math:: - :label: 7.121) + :label: 7.121 - \frac{\partial \psi _{i-1} }{\partial \theta _{liq,\, \, i-1} } =-B_{i-1} \frac{\psi _{i-1} }{\theta _{\, \, i-1} } + \frac{\partial \psi _{i-1} }{\partial \theta_{liq,\, \, i-1} } =-B_{i-1} \frac{\psi _{i-1} }{\theta_{\, \, i-1} } .. math:: - :label: 7.122) + :label: 7.122 - \frac{\partial \psi _{i} }{\partial \theta _{\, liq,\, i} } =-B_{i} \frac{\psi _{i} }{\theta _{i} } + \frac{\partial \psi _{i} }{\partial \theta_{\, liq,\, i} } =-B_{i} \frac{\psi _{i} }{\theta_{i} } .. math:: - :label: 7.123) + :label: 7.123 - \frac{\partial \psi _{i+1} }{\partial \theta _{liq,\, i+1} } =-B_{i+1} \frac{\psi _{i+1} }{\theta _{\, i+1} } + \frac{\partial \psi _{i+1} }{\partial \theta_{liq,\, i+1} } =-B_{i+1} \frac{\psi _{i+1} }{\theta_{\, i+1} } with the constraint -:math:`0.01\, \theta _{sat,\, i} \le \theta _{\, i} \le \theta _{sat,\, i}` . +:math:`0.01\, \theta_{sat,\, i} \le \theta_{\, i} \le \theta_{sat,\, i}` . The derivatives of the hydraulic conductivity at the layer interface are -derived from equation +derived from :eq:`7.85` .. math:: - :label: 7.124) + :label: 7.124 - \begin{array}{l} {\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } =\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } =\left(1-\frac{f_{frz,\, i-1} +f_{frz,\, i} }{2} \right)\left(2B_{i-1} +3\right)k_{sat} \left[z_{h,\, i-1} \right]\times } \\ {\qquad \left[\frac{0.5\left(\theta _{\, i-1} +\theta _{\, i} \right)}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right]^{2B_{i-1} +2} \left(\frac{0.5}{0.5\left(\theta _{sat,\, i-1} +\theta _{sat,\, i} \right)} \right)} \end{array} + \begin{array}{l} + {\frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i-1} } + = \frac{\partial k\left[z_{h,\, i-1} \right]}{\partial \theta _{liq,\, i} } + = \left(2B_{i-1} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i-1} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i-1} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array} + +where :math:`\overline{\Theta}_{ice} = \Theta(\overline{\theta}_{ice})` :eq:`7.86`, +:math:`\overline{\theta}_{ice} = 0.5\left(\theta_{ice\, i-1} +\theta_{ice\, i} \right)`, +:math:`\overline{\theta}_{liq} = 0.5\left(\theta_{liq\, i-1} +\theta_{liq\, i} \right)`, +and +:math:`\overline{\theta}_{sat} = 0.5\left(\theta_{sat,\, i-1} +\theta_{sat,\, i} \right)` + +and .. math:: - :label: 7.125) + :label: 7.125 \begin{array}{l} {\frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i} } = \frac{\partial k\left[z_{h,\, i} \right]}{\partial \theta _{liq,\, i+1} } - = \left(2B_{i} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array} + = \left(2B_{i} +3\right) \ \overline{\Theta}_{ice} \ k_{sat} \left[z_{h,\, i} \right] \ \left[\frac{\overline{\theta}_{liq}}{\overline{\theta}_{sat}} \right]^{2B_{i} +2} \left(\frac{0.5}{\overline{\theta}_{sat}} \right)} \end{array}. -where :math:`\overline{\theta}_{liq} = 0.5\left(\theta _{\, i} +\theta _{\, i+1} \right)`, -:math:`\overline{\theta}_{sat} = 0.5\left(\theta _{sat,\, i} +\theta _{sat,\, i+1} \right)`. +where :math:`\overline{\theta}_{liq} = 0.5\left(\theta_{\, i} +\theta_{\, i+1} \right)`, +:math:`\overline{\theta}_{sat} = 0.5\left(\theta_{sat,\, i} +\theta_{sat,\, i+1} \right)`. Equation set for layer :math:`i=1` '''''''''''''''''''''''''''''''''''''''''' @@ -927,30 +952,30 @@ infiltration rate (section :numref:`Surface Runoff`), is .. math:: - :label: 7.135) + :label: 7.135 - \frac{\Delta z_{i} \Delta \theta _{liq,\, i} }{\Delta t} =q_{infl}^{n+1} +q_{i}^{n+1} -e_{i} . + \frac{\Delta z_{i} \Delta \theta_{liq,\, i} }{\Delta t} =q_{infl}^{n+1} +q_{i}^{n+1} -e_{i} . After grouping like terms, the coefficients of the tridiagonal set of equations for :math:`i=1` are .. math:: - :label: 7.136) + :label: 7.136 a_{i} =0 .. math:: - :label: 7.137) + :label: 7.137 - b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + b_{i} =\frac{\partial q_{i} }{\partial \theta_{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.138) + :label: 7.138 - c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } + c_{i} =\frac{\partial q_{i} }{\partial \theta_{liq,\, i+1} } .. math:: - :label: 7.139) + :label: 7.139 r_{i} =q_{infl}^{n+1} -q_{i}^{n} +e_{i} . @@ -961,22 +986,22 @@ The coefficients of the tridiagonal set of equations for :math:`i=2,\ldots ,N_{levsoi} -1` are .. math:: - :label: 7.140) + :label: 7.140 - a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta_{liq,\, i-1} } .. math:: - :label: 7.141) + :label: 7.141 - b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + b_{i} =\frac{\partial q_{i} }{\partial \theta_{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta_{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.142) + :label: 7.142 - c_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i+1} } + c_{i} =\frac{\partial q_{i} }{\partial \theta_{liq,\, i+1} } .. math:: - :label: 7.143) + :label: 7.143 r_{i} =q_{i-1}^{n} -q_{i}^{n} +e_{i} . @@ -989,22 +1014,22 @@ and the coefficients of the tridiagonal set of equations for :math:`i=N_{levsoi}` are .. math:: - :label: 7.148) + :label: 7.148 - a_{i} =-\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i-1} } + a_{i} =-\frac{\partial q_{i-1} }{\partial \theta_{liq,\, i-1} } .. math:: - :label: 7.149) + :label: 7.149 - b_{i} =\frac{\partial q_{i} }{\partial \theta _{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta _{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} + b_{i} =\frac{\partial q_{i} }{\partial \theta_{liq,\, i} } -\frac{\partial q_{i-1} }{\partial \theta_{liq,\, i} } -\frac{\Delta z_{i} }{\Delta t} .. math:: - :label: 7.150) + :label: 7.150 c_{i} =0 .. math:: - :label: 7.151) + :label: 7.151 r_{i} =q_{i-1}^{n} +e_{i} . @@ -1015,7 +1040,7 @@ An initial solution is found by setting :math:`\Delta t` equal to the model time step. An estimate of the error is calculated from .. math:: - :label: 7.152) + :label: 7.152 \epsilon = max \left[ \frac{\Delta \theta_{liq,\, i} \Delta z_{i}}{\Delta t} - \left( q_{i-1}^{n} - q_{i}^{n} + e_{i}\right) \right] @@ -1031,16 +1056,16 @@ Upon solution of the tridiagonal equation set, the liquid water contents are updated as follows .. math:: - :label: 7.164) + :label: 7.164 - w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\Delta \theta _{liq,\, i} \Delta z_{i} \qquad i=1,\ldots ,N_{levsoi} . + w_{liq,\, i}^{n+1} =w_{liq,\, i}^{n} +\Delta \theta_{liq,\, i} \Delta z_{i} \qquad i=1,\ldots ,N_{levsoi} . The volumetric water content is .. math:: - :label: 7.165) + :label: 7.165 - \theta _{i} =\frac{w_{liq,\, i} }{\Delta z_{i} \rho _{liq} } +\frac{w_{ice,\, i} }{\Delta z_{i} \rho _{ice} } . + \theta_{i} =\frac{w_{liq,\, i} }{\Delta z_{i} \rho _{liq} } +\frac{w_{ice,\, i} }{\Delta z_{i} \rho _{ice} } . .. _Frozen Soils and Perched Water Table: @@ -1048,15 +1073,15 @@ Frozen Soils and Perched Water Table ---------------------------------------- When soils freeze, the power-law form of the ice impedance factor -(section :numref:`Hydraulic Properties`) can greatly decrease the hydraulic conductivity of the -soil, leading to nearly impermeable soil layers. When unfrozen soil -layers are present above relatively ice-rich frozen layers, the +(section :numref:`Hydraulic Properties`) can greatly decrease the hydraulic +conductivity of the soil, leading to nearly impermeable soil layers. When unfrozen +soil layers are present above relatively ice-rich frozen layers, the possibility exists for perched saturated zones. Lateral drainage from perched saturated regions is parameterized as a function of the thickness of the saturated zone .. math:: - :label: 7.166) + :label: 7.166 q_{drai,perch} =k_{drai,\, perch} \left(z_{frost} -z_{\nabla ,perch} \right) @@ -1064,9 +1089,9 @@ where :math:`k_{drai,\, perch}` depends on topographic slope and soil hydraulic conductivity, .. math:: - :label: 7.167) + :label: 7.167 - k_{drai,\, perch} =10^{-5} \sin (\beta )\left(\frac{\sum _{i=N_{perch} }^{i=N_{frost} }\Theta _{ice,i} k_{sat} \left[z_{i} \right]\Delta z_{i} }{\sum _{i=N_{perch} }^{i=N_{frost} }\Delta z_{i} } \right) + k_{drai,\, perch} =10^{-5} \sin (\beta )\left(\frac{\sum _{i=N_{perch} }^{i=N_{frost} }\Theta_{ice,i} k_{sat} \left[z_{i} \right]\Delta z_{i} }{\sum _{i=N_{perch} }^{i=N_{frost} }\Delta z_{i} } \right) where :math:`\Theta_{ice}` is an ice impedance factor, :math:`\beta` is the mean grid cell topographic slope in @@ -1089,7 +1114,7 @@ Lateral sub-surface runoff occurs when saturated soil moisture conditions exist within the soil column. Sub-surface runoff is .. math:: - :label: 7.168) + :label: 7.168 q_{subsurface} = \Theta_{ice} K_{baseflow} tan \left( \beta \right) \Delta z_{sat}^{N_{baseflow}} \ , @@ -1101,13 +1126,14 @@ is the thickness of the saturated portion of the soil column. The saturated thickness is .. math:: - :label: 7.1681) + :label: 7.1681 \Delta z_{sat} = z_{bedrock} - z_{\nabla}, where the water table :math:`z_{\nabla}` is determined by finding the -first soil layer above the bedrock depth (section ) in which the volumetric water -content drops below a specified threshold. The default threshold is set to 0.9. +irst soil layer above the bedrock depth (section :numref:`Depth to Bedrock`) +in which the volumetric water content drops below a specified threshold. +The default threshold is set to 0.9. The specific yield, :math:`S_{y}` , which depends on the soil properties and the water table location, is derived by taking the @@ -1115,22 +1141,22 @@ difference between two equilibrium soil moisture profiles whose water tables differ by an infinitesimal amount .. math:: - :label: 7.174) + :label: 7.174 - S_{y} =\theta _{sat} \left(1-\left(1+\frac{z_{\nabla } }{\Psi _{sat} } \right)^{\frac{-1}{B} } \right) + S_{y} =\theta_{sat} \left(1-\left(1+\frac{z_{\nabla } }{\Psi _{sat} } \right)^{\frac{-1}{B} } \right) where B is the Clapp-Hornberger exponent. Because :math:`S_{y}` is a function of the soil properties, it results in water table dynamics that -are consistent with the soil water fluxes described in section 7.4. +are consistent with the soil water fluxes described in section :numref:`Soil Water`. After the above calculations, two numerical adjustments are implemented to keep the liquid water content of each soil layer (:math:`w_{liq,\, i}` ) within physical constraints of -:math:`w_{liq}^{\min } \le w_{liq,\, i} \le \left(\theta _{sat,\, i} -\theta _{ice,\, i} \right)\Delta z_{i}` +:math:`w_{liq}^{\min } \le w_{liq,\, i} \le \left(\theta_{sat,\, i} -\theta_{ice,\, i} \right)\Delta z_{i}` where :math:`w_{liq}^{\min } =0.01` (mm). First, beginning with the bottom soil layer :math:`i=N_{levsoi}` , any excess liquid water in each soil layer -(:math:`w_{liq,\, i}^{excess} =w_{liq,\, i} -\left(\theta _{sat,\, i} -\theta _{ice,\, i} \right)\Delta z_{i} \ge 0`) +(:math:`w_{liq,\, i}^{excess} =w_{liq,\, i} -\left(\theta_{sat,\, i} -\theta_{ice,\, i} \right)\Delta z_{i} \ge 0`) is successively added to the layer above. Any excess liquid water that remains after saturating the entire soil column (plus a maximum surface ponding depth :math:`w_{liq}^{pond} =10` kg m\ :sup:`-2`), is @@ -1147,21 +1173,21 @@ found, then the water is removed from :math:`W_{t}` and :math:`q_{drai}` . The soil surface layer liquid water and ice contents are then updated -for dew :math:`q_{sdew}` , frost :math:`q_{frost}` , or sublimation -:math:`q_{subl}` (section 5.4) as +for dew :math:`q_{sdew}` , frost :math:`q_{frost}` , or sublimation :math:`q_{subl}` +(section :numref:`Update of Ground Sensible and Latent Heat Fluxes`) as .. math:: - :label: 7.175) + :label: 7.175 w_{liq,\, 1}^{n+1} =w_{liq,\, 1}^{n} +q_{sdew} \Delta t .. math:: - :label: 7.176) + :label: 7.176 w_{ice,\, 1}^{n+1} =w_{ice,\, 1}^{n} +q_{frost} \Delta t .. math:: - :label: 7.177) + :label: 7.177 w_{ice,\, 1}^{n+1} =w_{ice,\, 1}^{n} -q_{subl} \Delta t. @@ -1179,12 +1205,12 @@ and dew in solid or liquid form, is separated into solid :math:`q_{snwcp,ice}` \ and liquid :math:`q_{snwcp,liq}` runoff terms .. math:: - :label: 7.178) + :label: 7.178 q_{snwcp,ice} =q_{grnd,ice} +q_{frost} .. math:: - :label: 7.179) + :label: 7.179 q_{snwcp,liq} =q_{grnd,liq} +q_{dew} @@ -1200,7 +1226,7 @@ For glacier surfaces the runoff term :math:`q_{rgwl}` is calculated from the residual of the water balance .. math:: - :label: 7.180) + :label: 7.180 q_{rgwl} =q_{grnd,ice} +q_{grnd,liq} -E_{g} -E_{v} -\frac{\left(W_{b}^{n+1} -W_{b}^{n} \right)}{\Delta t} -q_{snwcp,ice} @@ -1208,7 +1234,7 @@ where :math:`W_{b}^{n}` and :math:`W_{b}^{n+1}` are the water balances at the beginning and ending of the time step defined as .. math:: - :label: 7.181) + :label: 7.181 W_{b} =W_{can} +W_{sno} +\sum _{i=1}^{N}\left(w_{ice,i} +w_{liq,i} \right) . @@ -1218,3 +1244,4 @@ section :numref:`Precipitation, Evaporation, and Runoff Lake`. The runoff term :math:`q_{rgwl}` may be negative for glaciers and lakes, which reduces the total amount of runoff available to the river routing model (Chapter :numref:`rst_River Transport Model (RTM)`). +> diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 987ac62c8e..3781c4b7a2 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1566,7 +1566,7 @@ Schnell, S. and King, G.M., 1996. Responses of methanotrophic activity in soils and cultures to water stress. Applied and Environmental Microbiology 62:3203-3209. -.. _Segers, R., 1998. Methane production and methane consumption: a review +.. _Segers1998: Segers, R., 1998. Methane production and methane consumption: a review of processes underlying wetland methane fluxes. Biogeochemistry From 4f1c013b4fb53b6bc26a5488314b54456db29e85 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 5 Jun 2017 09:42:32 -0600 Subject: [PATCH 0045/1973] one more hydrology fix --- doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst | 2 +- doc/source/tech_note/References/CLM50_Tech_Note_References.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 9dec375356..db82c6ac68 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -436,7 +436,7 @@ and .. math:: :label: 7.75 - qin,soil=(1-f_{h2osfc} )q_{in,surface} - q_{\inf l,excess} - (1-f_{sno} -f_{h2osfc} ) \ qevap,soil. + q_{in,soil} = (1-f_{h2osfc} ) \ q_{in,surface} - q_{\inf l,excess} - (1 - f_{sno} - f_{h2osfc} ) \ q_{evap,soil}. The balance of surface water is then calculated as diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 3781c4b7a2..1847c205df 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1225,6 +1225,8 @@ Niu, G.-Y., Yang, Z.-L., Dickinson, R.E., and Gulden, L.E. 2005. A simple TOPMODEL-based runoff parameterization (SIMTOP) for use in global climate models. J. Geophys. Res. 110:D21106. DOI:10.1029/2005JD006111. +.. _NiuYang2006: + Niu, G.-Y., and Yang, Z.-L. 2006. Effects of frozen soil on snowmelt runoff and soil water storage at a continental scale. J. Hydrometeor. 7:937-952. From d75f87650aac53df6e10f018475003705516332d Mon Sep 17 00:00:00 2001 From: djk2120 Date: Mon, 5 Jun 2017 15:20:54 -0400 Subject: [PATCH 0046/1973] PHS update, including circuit diagram and more explantory text, part 2 --- ...CLM50_Tech_Note_Plant_Hydraulic_Stress.rst | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst b/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst index 02132af76d..d8bad01423 100644 --- a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst +++ b/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst @@ -3,7 +3,13 @@ Plant Hydraulic Stress ====================== -Hello +Introductory text... + +.. _Figure Soil Temperature Schematic: + +.. figure:: circuit.jpg + + Circuit diagram of plant hydraulics scheme .. _Plant Water Supply: @@ -19,27 +25,32 @@ In general the water fluxes (e.g. soil-to-root, root-to-stem, etc) are calculate .. math:: :label: 11.1) - q = kA\Delta\psi + q = kA\left( \psi_1 - \psi_2 \right) -:math:`q` is the flux of water (mmH\ :sub:`2`\ O) +:math:`q` is the flux of water (mmH\ :sub:`2`\ O) spanning the segment between :math:`\psi_1` and :math:`\psi_2` :math:`k` is the hydraulic conductance (s\ :sup:`-1`\ ) -:math:`A` is the area basis (m\ :sup:`2`\ /m\ :sup:`2`\ ) +:math:`A` is the area basis (m\ :sup:`2`\ /m\ :sup:`2`\ ) relating the conducting area basis to ground area -:math:`\Delta\psi` is the gradient in water potential (mmH\ :sub:`2`\ O) +:math:`\psi_1 - \psi_2` is the gradient in water potential (mmH\ :sub:`2`\ O) across the segment .. math:: :label: 11.2) - k=k_{max}\cdot 2^{-\left(\dfrac{\psi}{p50}\right)^{c_k}} + k=k_{max}\cdot 2^{-\left(\dfrac{\psi_1}{p50}\right)^{c_k}} :math:`k_{max}` is the maximum segment conductance (s-1) :math:`p50` is the water potential at 50% loss of conductivity (mmH2O) -:math:`\psi` is the water potential of the lower segment terminus (mmH2O) +:math:`\psi_1` is the water potential of the lower segment terminus (mmH2O) + +The area basis and conductance parameterization varies by segment. There are two stem-to-leaf fluxes in parallel, from stem to sunlit leaf and from stem to shaded leaf (:math:`q_{1a}` and :math:`q_{1a}`). +The water flux from stem-to-leaf is the product of the segment conductance, the conducting area basis, and the water potential gradient from stem to leaf. Stem-to-leaf conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve. +The maximum conductance is a PFT parameter representing the maximum conductance of water from stem to leaf per unit leaf area. +This parameter can be defined separately for sunlit and shaded segments and should already include the appropriate length scaling (in other words this is a conductance, not conductivity). The water potential gradient is the difference between leaf water potential and stem water potential. There is no gravity term, assuming a negligible difference in height across the segment. The area basis is the leaf area index (either sunlit or shaded). .. math:: :label: 11.3) @@ -63,15 +74,19 @@ In general the water fluxes (e.g. soil-to-root, root-to-stem, etc) are calculate Variables: +:math:`q_{1a}` = flux of water (mmH2O/s) from stem to sunlit leaf + +:math:`q_{1b}` = flux of water (mmH2O/s) from stem to shaded leaf + :math:`LAI_{sun}` = sunlit leaf area index (m2/m2) :math:`LAI_{shade}` = shaded leaf area index (m2/m2) -:math:`\psi_{stem}` = stem water potential (mmH20) +:math:`\psi_{stem}` = stem water potential (mmH2O) -:math:`\psi_{sunleaf}` = sunlit leaf water potential (mmH20) +:math:`\psi_{sunleaf}` = sunlit leaf water potential (mmH2O) -:math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH20) +:math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH2O) Parameters: @@ -83,6 +98,8 @@ Parameters: :math:`c_{k}` = vulnerability curve shape-fitting parameter (-) +There is one root-to-stem flux. This represents a flux from the root collar to the upper branch reaches. The water flux from root-to-stem is the product of the segment conductance, the conducting area basis, and the water potential gradient from root to stem. Root-to-stem conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve (two parameters). The maximum conductance is defined as the maximum root-to-stem conductivity per unit stem area (PFT parameter) divided by the length of the conducting path, which is taken to be the vegetation height. The area basis is the stem area index. The gradient in water potential is the difference between the root water potential and the stem water potential less the difference in gravitational potential. + .. math:: :label: 11.7) @@ -95,6 +112,8 @@ Parameters: Variables: +:math:`q_2` = flux of water (mmH2O/s) from root to stem + :math:`SAI` = stem area index (m2/m2) :math:`\Delta\psi_z` = gravitational potential (mmH2O) @@ -111,6 +130,14 @@ Parameters: :math:`z_2` = vegetation height (m) +There are several soil-to-root fluxes operating in parallel (one for each root-containing soil layer). Each represents a flux from the given soil layer to the root collar. The water flux from soil-to-root is the product of the segment conductance, the conducting area basis, and the water potential gradient from soil to root. The area basis is a proxy for root area index, defined as the summed leaf and stem area index multiplied by the root-to-shoot ratio (PFT parameter) multiplied by the layer root fraction. The root fraction comes from an empirical root profile (see section zqz). + +The gradient in water potential is the difference between the soil water potential and the root water potential less the difference in gravitational potential. There is only one root water potential to which all soil layers are connected in parallel. A soil-to-root flux can be either positive (vegetation water uptake) or negative (water deposition), depending on the relative values of the root and soil water potentials. This allows for the occurrence of hydraulic redistribution where water moves through vegetation tissue from one soil layer to another. + +Soil-to-root conductance is the result of two resistances in series, first across the soil-root interface and then through the root tissue. The root tissue conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve. The maximum conductance is defined as the maximum root-tissue conductivity (PFT parameter) divided by the length of the conducting path, which is taken to be the soil layer depth plus lateral root length. + +The soil-root interface conductance is defined as the soil conductivity divided by the conducting length from soil to root. The soil conductivity varies by soil layer and is calculated based on soil potential and soil properties, via the Brooks-Corey theory. The conducting length is computed by calculating the characteristic root spacing following Bonan-2014. The root spacing depends on total root biomass and PFT parameters defining root structure (see section zqz). + .. math:: :label: 11.9) @@ -124,17 +151,17 @@ Parameters: .. math:: :label: 11.11) - k_{3,i}=\dfrac{k_{root}*k_{soil-to-root}}{k_{root}+k_{soil-to-root}} + k_{3,i}=\dfrac{k_{r,i}*k_{s,i}}{k_{r,i}+k_{s,i}} .. math:: :label: 11.12) - k_{root,i}=\dfrac{k_{3,max}}{z_{3,i}}*2^{-\left(\dfrac{\psi_{soil,i}}{p50_3}\right)^{c_k}} + k_{r,i}=\dfrac{k_{3,max}}{z_{3,i}}*2^{-\left(\dfrac{\psi_{soil,i}}{p50_3}\right)^{c_k}} .. math:: :label: 11.13) - k_{soil-to-root} = \dfrac{k_{soil,i}}{dx_{root,i}} + k_{s,i} = \dfrac{k_{soil,i}}{dx_{root,i}} .. math:: :label: 11.14) @@ -148,6 +175,8 @@ Parameters: Variables: +:math:`q_{3,i}` = flux of water (mmH2O/s) from soil layer :math:`i` to root + :math:`\Delta\psi_{z,i}` = change in gravitational potential from soil layer :math:`i` to surface (mmH2O) :math:`LAI` = total leaf area index (m2/m2) @@ -249,9 +278,6 @@ The demand terms (left-hand side) are decreasing functions of absolute leaf wate -Yo - - From 481ad0a657c8ba200b1d807b42f7b1cff16334a7 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Mon, 5 Jun 2017 16:32:32 -0600 Subject: [PATCH 0047/1973] Updated crop chapter, crop functional type section, and added associated references --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 35 ++++++++++++------- .../References/CLM50_Tech_Note_References.rst | 6 ++++ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 98c5ddcea3..1de6809021 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -90,25 +90,34 @@ vegetated land unit is separated into a naturally vegetated land unit and a managed crop land unit. Unlike the plant functional types (pfts) in the naturally vegetated land unit, the managed crop pfts in the managed crop land unit do not share soil columns and thus permit for differences in the -land management between crops. Crop grid cell coverage is assigned from +land management between crops. Each crop type has a rainfed and an irrigated +pft that are on independent soil columns. Crop grid cell coverage is assigned from satellite data (similar to all natural pfts), and the managed crop type proportions within the crop area is based on the dataset created by (:ref:`Portmann et al. 2010 `) for present day and -extrapolated through time using the LUMIP data (insert citation). Each -actively managed crop type has a rainfed and an irrigated pft that are on -independent soil columns. Actively managed crop types (Table XX) are chosen +extrapolated through time using the dataset provided by Land Use Model +Intercomparison Project (LUMIP), which is part of CMIP6 Land use timeseries +(:ref:`Lawrence et al. 2016 `). For more details about how +crop distributions are determined, see chapter 26 on :ref:`rst_Transient Landcover Change`. + +CLM5 includes eight actively managed crop types +(temperate soybean, tropical soybean, temperate corn, tropical +corn, spring wheat, cotton, rice, and sugarcane) that are chosen based on the availability of corresponding algorithms in AgroIBIS and as developed by Badger and Dirmeyer (:ref:`2015 `) and -described by Levis et al. (:ref:`2016 `). A parameterization -for winter cereals is developed but is not included in CLM5.0 due to the -inability to distinguish between winter and summer cereals in the LUMIP dataset (insert citation). - +described by Levis et al. (:ref:`2016 `). In addition, CLM’s default list of plant functional types (pfts) includes an -unmanaged crop (Table 2.1) treated as a second C3 grass, as well as several -additional crop types that do not have associated parameters. The unmanaged -crop has grid cell coverage assigned from satellite data, as do all -natural pfts when CLM’s crop model is not active. [include remapping text here]. - +irrigated and unirrigated unmanaged C3 crop (Table 2.1)[update table reference] treated as a second C3 grass. +The unmanaged C3 crop is only used when the crop model is not active and +has grid cell coverage assigned from satellite data. [info here about irrigation for unmanaged C3 crop] +The default list of pfts also includes twenty-three inactive crop pfts +that do not yet have associated parameters required for active management. So that all crop area is actively managed, +each of the inactive crop types is simulated using the parameters of the +spatially closest associated crop type that is most similar to the functional type (e.g., C3 or C4), +which is required to maintain similar phenological parameters. +The information detailing which parameters are used for each crop type is +included in Table XX. It should be noted that analysis with pft-level history output will +need to remap the crop types, as pft-level data will only include actively managed crop types. .. _Phenology: diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 7fb1521105..2c168c5fd4 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -894,6 +894,12 @@ Law, B.E., Sun, O.J., Campbell, J., Van Tuyl, S. and Thornton, P.E. 2003. Changes in carbon storage and fluxes in a chronosequence of ponderosa pine. Global Change Biology, 9: 510-514. +.. _Lawrenceetal2016: + +Lawrence, D.M., et al. 2016. The Land Use Model Intercomparison Project +(LUMIP) contribution to CMIP6: rationale and experimental design. Geo. Sci. +Dev. 9:2973-2998. + .. _Lawrenceetal2007: Lawrence, D.M., Thornton, P.E., Oleson, K.W., and Bonan, G.B. 2007. The From 0e3abef7bb61aa4b3610495893871bf36cfa1cc7 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 6 Jun 2017 07:51:43 -0600 Subject: [PATCH 0048/1973] reformat Surfacealbedo --- .../Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 45977ead34..f16a46ec97 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -1159,7 +1159,14 @@ series expansions for the eccentricity :math:`e`\ as follows: .. math:: :label: 3.87 - \Pi =\left\{\begin{array}{l} {0\qquad {\rm for\; -1}\times {\rm 10}^{{\rm -8}} \le e^{\cos } \le 1\times 10^{-8} {\rm \; and\; }e^{\sin } =0} \\ {1.5\pi \qquad {\rm for\; -1}\times {\rm 10}^{{\rm -8}} \le e^{\cos } \le 1\times 10^{-8} {\rm \; and\; }e^{\sin } <0} \\ {0.5\pi \qquad {\rm for\; -1}\times {\rm 10}^{{\rm -8}} \le e^{\cos } \le 1\times 10^{-8} {\rm \; and\; }e^{\sin } >0} \\ {\tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right]+\pi \qquad {\rm for\; }e^{\cos } <{\rm -1}\times {\rm 10}^{{\rm -8}} } \\ {\tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right]+2\pi \qquad {\rm for\; }e^{\cos } >{\rm 1}\times {\rm 10}^{{\rm -8}} {\rm \; and\; }e^{\sin } <0} \\ {\tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right]\qquad {\rm for\; }e^{\cos } >{\rm 1}\times {\rm 10}^{{\rm -8}} {\rm \; and\; }e^{\sin } \ge 0} \end{array}\right\}. + \Pi =\left\{\begin{array}{lr} + 0 & \qquad {\rm for\; -1}\times {\rm 10}^{{\rm -8}} \le e^{\cos } \le 1\times 10^{-8} {\rm \; and\; }e^{\sin } = 0 \\ + 1.5\pi & \qquad {\rm for\; -1}\times {\rm 10}^{{\rm -8}} \le e^{\cos } \le 1\times 10^{-8} {\rm \; and\; }e^{\sin } < 0 \\ + 0.5\pi & \qquad {\rm for\; -1}\times {\rm 10}^{{\rm -8}} \le e^{\cos } \le 1\times 10^{-8} {\rm \; and\; }e^{\sin } > 0 \\ + \tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right]+\pi & \qquad {\rm for\; }e^{\cos } <{\rm -1}\times {\rm 10}^{{\rm -8}} \\ + \tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right]+2\pi & \qquad {\rm for\; }e^{\cos } >{\rm 1}\times {\rm 10}^{{\rm -8}} {\rm \; and\; }e^{\sin } <0 \\ + \tan ^{-1} \left[\frac{e^{\sin } }{e^{\cos } } \right] & \qquad {\rm for\; }e^{\cos } >{\rm 1}\times {\rm 10}^{{\rm -8}} {\rm \; and\; }e^{\sin } \ge 0 + \end{array}\right\}. The numerical solution for the longitude of the perihelion :math:`\tilde{\omega }` is constrained to be between 0 and 360 degrees From 3e1dbc96f21bf6659a052becd1bf8aaa5243aa66 Mon Sep 17 00:00:00 2001 From: Yaqiong Lu Date: Tue, 6 Jun 2017 10:57:16 -0600 Subject: [PATCH 0049/1973] updated fertilization and latvery GDD --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 54 ++++++++++++++----- .../References/CLM50_Tech_Note_References.rst | 9 ++++ 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 1b2548d64f..4f85e4309b 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -610,13 +610,18 @@ Interactive fertilization CLM adds nitrogen directly to the soil mineral nitrogen pool to meet crop nitrogen demands. CLM’s separate crop land unit ensures that natural vegetation will not access the fertilizer applied to crops. -Fertilizer amounts are obtained from the Agro-IBIS model (Kucharik and -Brye 2003), but can be modified in CLM’s pft-physiology input dataset. -Fertilizer is reported in g N/m\ :sup:`2` by plant functional -type. Total nitrogen fertilizer amounts are 150 g N/m\ :sup:`2` -for maize, 80 g N/m\ :sup:`2` for temperate cereals, and 25 g -N/m\ :sup:`2` for soybean, representative of central U.S. annual -fertilizer application amounts. Since CLM’s denitrification rate is high +Fertilizer in CLM5BGCCROP is prescribed by crop function types spatially +for each year based on the LUMIP land use and land cover change +time series (LUH2 for historical and SSPs for future) (:ref:`Lawrence et al. 2016 `). +There are two fields that are used to prescribe industrial fertilizer. +On the surface data set the field CONST_FERTNITRO_CFT specifies the +annual fertilizer application for a non-transient simulations in g N/m\ :sup:`2`/yr. +In the case of a transient simulation this is replaced by the landuse.timeseries +file with the field FERTNITRO_CFT which is also in g N/m\ :sup:`2`/yr. +The values for both of these fields come from the LUMIP time series for each year. +In addition to the industrial fertilizer there is a background manure fertilizer +on the clm parameters file with the field manunitro. For the current CLM5BGCCROP, +this is set to 0.002 kg N/m\ :sup:`2`/yr. Since CLM’s denitrification rate is high and results in a 50% loss of the unused available nitrogen each day, fertilizer is applied slowly to minimize the loss and maximize plant uptake. Fertilizer application begins during the emergence phase of crop @@ -627,18 +632,18 @@ limit fertilizer application to the emergence stage. A fertilizer counter in seconds, *f*, is set as soon as the onset growth for crops initiates: -*f* = *n* \* 86400 [20.9)] +.. math:: + :label: 25.18 + + f = n \times 86400 where *n* is set to 20 fertilizer application days. When the crop enters phase 2 (leaf emergence to the beginning of grain fill) of its growth cycle, fertilizer application begins by initializing fertilizer amount -to the total fertilizer divided by the initialized *f*. Fertilizer is -applied and *f* is decremented each time step until a zero balance on +to the total fertilizer at each grid cell divided by the initialized *f*. +Fertilizer is applied and *f* is decremented each time step until a zero balance on the counter is reached. -The crop fertilization scheme was developed in versions of the CLM prior -to CLM4.5. In CLM4.5, crops with fertilization may be simulated over -productive. .. _Biological nitrogen fixation for soybeans: @@ -800,3 +805,26 @@ the CLM4.0, allocation of carbon to the reproductive pool was calculated but merged with the stem pool. In the model, as allocation declines during the grain fill stage of growth, increasing amounts of carbon and nitrogen are available for grain development. + +.. _Latitude vary base tempereature for growing degree days: + +Latitude vary base tempereature for growing degree days +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For both rainfed and irrigated spring wheat and sugarcane, +a latitude vary base temperature in calculating :math:`GDD_{T_{{\rm 2m}} }` +(growing degree days since planting) was introduced. + +.. math:: + :label: 25.17 + + latitude\ vary\ baset = \left\{ + \begin{array}{lr} + baset +12 - 0.4 \times latitude &\qquad 0 \le latitude \le 30 \\ + baset +12 + 0.4 \times latitude &\qquad -30 \le latitude \le 0 + \end{array} \right\} + +where :math:`baset` is the 5\ :sup:`th` column in :numref:`Table Crop plant functional types`. +Such latitude vary baset could increase the base temperature, slow down :math:`GDD_{T_{{\rm 2m}} }` +accumulation, and extend the growing season for -30º to 30º regions for spring wheat +and sugarcane. diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 1847c205df..4a88ae39e2 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -927,6 +927,15 @@ and A.G. Slater, 2011. Parameterization improvements and functional and structural advances in version 4 of the Community Land Model. J. Adv. Model. Earth Sys. 3. DOI:10.1029/2011MS000045. +.. _Lawrenceetal2016: + +Lawrence, D. M., Hurtt, G. C., Arneth, A., Brovkin, V., Calvin, K. V., +Jones, A. D., Jones, C. D., Lawrence, P. J., de Noblet-Ducoudré, N., Pongratz, +J., Seneviratne, S. I., and Shevliakova, E, 2016. The Land Use Model +Intercomparison Project (LUMIP) contribution to CMIP6: rationale +and experimental design, Geosci. Model Dev., 9, 2973-2998, +doi:10.5194/gmd-9-2973-2016. + .. _LawrenceChase2007: Lawrence, P.J., and Chase, T.N. 2007. Representing a MODIS consistent From b8cc331040e3eb7fc8bdd075d931d91f7d17d30c Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 6 Jun 2017 12:08:06 -0600 Subject: [PATCH 0050/1973] Updates to Offline chapter --- .../Offline/CLM50_Tech_Note_Offline.rst | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst index da2788a5f9..0419ec668e 100644 --- a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst +++ b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst @@ -5,26 +5,29 @@ Offline Mode In offline mode (uncoupled to an atmospheric model), the atmospheric forcing required by CLM (:numref:`Table Atmospheric input to land model`) -is supplied by observed datasets. The standard forcing provided with the -model is a 110-year (1901-2010) dataset (CRUNCEP; :ref:`Viovy 2011 `) -that is a combination of two existing datasets; the CRU TS3.2 0.5\ -:math:`{}^\circ` X 0.5\ :math:`{}^\circ` monthly data covering the period +is supplied by observed datasets. The standard forcing provided with the +model is a 110-year (1901-2010) dataset provided by the Global Soil Wetness +Project (GSWP3; NEED A REFERENCE). The GSWP3 dataset has a spatial resolution of +0.5\ :math:`{}^o` X 0.5\ :math:`{}^o` and a temporal resolution of three +hours. + +An alternative forcing dataset is also available, CRUNCEP, a 110-year (1901-2010) dataset +(CRUNCEP; :ref:`Viovy 2011 `) that is a combination of two existing datasets; +the CRU TS3.2 0.5\ :math:`{}^o` X 0.5\ :math:`{}^o` monthly data covering the period 1901 to 2002 (:ref:`Mitchell and Jones 2005 `) -and the NCEP reanalysis 2.5\ :math:`{}^\circ` X 2.5\ :math:`{}^\circ` +and the NCEP reanalysis 2.5\ :math:`{}^o` X 2.5\ :math:`{}^o` 6-hourly data covering the period 1948 to 2010. The CRUNCEP dataset has been used to force CLM for studies of vegetation growth, evapotranspiration, and gross primary production (:ref:`Mao et al. 2012 `, :ref:`Mao et al. 2013 `, :ref:`Shi et al. 2013 `) and for the TRENDY (trends in net land-atmosphere carbon exchange over the period -1980-2010) project (:ref:`Piao et al. 2012 `). Version 4 is used -here (:ref:`Viovy 2011 `). Alternative forcing datasets can also be used -(e.g., the :ref:`Qian et al. (2006) ` dataset used for -previous versions of CLM is still available). +1980-2010) project (:ref:`Piao et al. 2012 `). Version 7 is available +here (:ref:`Viovy 2011 `). -Here, the CRUNCEP dataset, which does not include data over oceans, +Here, the GSWP3 dataset, which does not include data for particular fields over oceans, lakes, and Antarctica is modified. This missing data is filled with :ref:`Qian et al. (2006) ` data from 1948 that is interpolated by the data atmosphere -model to the 0.5\ :math:`{}^\circ` CRUNCEP grid. This allows the model +model to the 0.5\ :math:`{}^o` GSWP3 grid. This allows the model to be run over Antarctica and ensures data is available along coastlines regardless of model resolution. @@ -35,19 +38,19 @@ fields [atmospheric pressure :math:`P_{atm}` (Pa), atmospheric specific humidity :math:`q_{atm}` (kg kg\ :sup:`-1`), atmospheric temperature :math:`T_{atm}` (K), and atmospheric wind :math:`W_{atm}` (m s\ :sup:`-1`)]. These are separate streams because they are -handled differently according to the type of field. In the CRUNCEP -dataset, the precipitation stream is provided at six hour intervals and +handled differently according to the type of field. In the GSWP3 +dataset, the precipitation stream is provided at three hour intervals and the data atmosphere model prescribes the same precipitation rate for -each model time step within the six hour period. The four fields that +each model time step within the three hour period. The four fields that are grouped together in another stream (pressure, humidity, temperature, -and wind) are provided at six hour intervals and the data atmosphere +and wind) are provided at three hour intervals and the data atmosphere model linearly interpolates these fields to the time step of the model. -The total solar radiation is also provided at six hour intervals. The +The total solar radiation is also provided at three hour intervals. The data is fit to the model time step using a diurnal function that depends on the cosine of the solar zenith angle :math:`\mu` to provide a smoother diurnal cycle of solar radiation and to ensure that all of the -solar radiation supplied by the six-hourly forcing data is actually +solar radiation supplied by the three-hourly forcing data is actually used. The solar radiation at model time step :math:`t_{M}` is .. math:: @@ -58,15 +61,15 @@ used. The solar radiation at model time step :math:`t_{M}` is S_{atm} \left(t_{M} \right)=0 & \qquad {\rm for\; }\mu \left(t_{M} \right)\le 0.001 \end{array} -where :math:`\Delta t_{FD}` is the time step of the forcing data (6 -hours :math:`\times` 3600 seconds hour\ :sup:`-1` = 21600 +where :math:`\Delta t_{FD}` is the time step of the forcing data (3 +hours :math:`\times` 3600 seconds hour\ :sup:`-1` = 10800 seconds), :math:`\Delta t_{M}` is the model time step (seconds), -:math:`S_{atm} \left(t_{FD} \right)` is the six-hourly solar radiation +:math:`S_{atm} \left(t_{FD} \right)` is the three-hourly solar radiation from the forcing data (W m\ :sup:`-2`), and :math:`\mu \left(t_{M} \right)` is the cosine of the solar zenith angle -at model time step :math:`t_{M}` (section 3.3). The term in the -denominator of equation is the sum of the cosine of the solar zenith -angle for each model time step falling within the six hour period. For +at model time step :math:`t_{M}` (section :numref:`Solar Zenith Angle`). The term in the +denominator of equation (1) is the sum of the cosine of the solar zenith +angle for each model time step falling within the three hour period. For numerical purposes, :math:`\mu \left(t_{M_{i} } \right)\ge 0.001`. The total incident solar radiation :math:`S_{atm}` at the model time @@ -122,7 +125,7 @@ where :math:`a_{0} =0.17639,\, a_{1} =0.00380,\, a_{2} =-9.0039\times 10^{-6} ,\, a_{3} =8.1351\times 10^{-9}` and :math:`b_{0} =0.29548,b_{1} =0.00504,b_{2} =-1.4957\times 10^{-5} ,b_{3} =1.4881\times 10^{-8}` -are coefficients from polynomial fits to the placeCAM data. +are coefficients from polynomial fits to the CAM data. The additional atmospheric forcing variables required by :numref:`Table Atmospheric input to land model` are derived as follows. The atmospheric reference height :math:`z'_{atm}` @@ -146,8 +149,8 @@ where e_{atm} =\frac{P_{atm} q_{atm} }{0.622+0.378q_{atm} } -and :math:`\sigma` is the Stefan-Boltzmann constant (W m\ :sup:`-2` K\ -:math:`{}^{-4}`) (:numref:`Table Physical constants`). The fraction of +and :math:`\sigma` is the Stefan-Boltzmann constant (W m\ :sup:`-2` K\ :sup:`-4`) +(:numref:`Table Physical constants`). The fraction of precipitation :math:`P` (mm s\ :sup:`-1`) falling as rain and/or snow is From a890f67bcc1f1274cf24a83c75a741a6fd9dd999 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 6 Jun 2017 14:53:03 -0600 Subject: [PATCH 0051/1973] fix references in Introduction --- .../CLM50_Tech_Note_Introduction.rst | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 157b564d7e..48452d358f 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -418,10 +418,12 @@ added stability corrections to the diagnostic 2-m air temperature calculation which reduced biases in this temperature. Competition between PFTs for water, in which PFTs share a single soil column, is the default mode of operation in this model version. CLM3 was released to -the community in June 2004.:ref:`Dickinson et al. (2006)` describe the climate -statistics of CLM3 when coupled to CCSM3.0. :ref:`Hack et al. (2006)` provide -an analysis of selected features of the land hydrological cycle. -:ref:`Lawrence et al. (2007)` examine the impact of changes in CLM3 +the community in June 2004. :ref:`Dickinson et al. (2006)` +describe the climate statistics of CLM3 when coupled to CCSM3.0. +:ref:`Hack et al. (2006)` provide an analysis of selected +features of the land hydrological cycle. +:ref:`Lawrence et al. (2007)` examine the impact of +changes in CLM3 hydrological parameterizations on partitioning of evapotranspiration (ET) and its effect on the timescales of ET response to precipitation events, interseasonal soil moisture storage, soil moisture memory, and @@ -596,11 +598,12 @@ remains long. Finally, the predominantly low resolution input data for provided with CLM4 to create CLM4 surface datasets is replaced with newer and higher -resolution input datasets where possible (see section 2.2.3 for -details). The default meteorological forcing dataset provided with CLM4 -(:ref:`Qian et al. 2006)` is replaced with the 1901-2010 CRUNCEP forcing -dataset (see Chapter 26) for CLM4.5, though users can also still use the -:ref:`Qian et al. (2006)` dataset or other alternative forcing datasets. +resolution input datasets where possible (see section :numref:`Surface Data` +for details). The default meteorological forcing dataset provided with CLM4 +(:ref:`Qian et al. 2006)` is replaced with the 1901-2010 +CRUNCEP forcing dataset (see Chapter :numref:`rst_Offline Mode`) for CLM4.5, +though users can also still use the :ref:`Qian et al. (2006)` +dataset or other alternative forcing datasets. CLM4.5 was released to the community in June 2013 along with the Community Earth System Model version 1.2 (CESM1.2). From 1d543aea4af058faed4ddde07ffe5182ccf212ab Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Tue, 6 Jun 2017 16:49:44 -0600 Subject: [PATCH 0052/1973] Updated portions of the crop chapter, including harvest and grain fill phenology --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 35 +++++++++++-------- .../References/CLM50_Tech_Note_References.rst | 16 +++------ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index b44a1874b6..3ff2afc0b5 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -107,17 +107,21 @@ based on the availability of corresponding algorithms in AgroIBIS and as developed by Badger and Dirmeyer (:ref:`2015 `) and described by Levis et al. (:ref:`2016 `). In addition, CLM’s default list of plant functional types (pfts) includes an -irrigated and unirrigated unmanaged C3 crop (Table 2.1)[update table reference] treated as a second C3 grass. +irrigated and unirrigated unmanaged C3 crop (Table 25.1) treated as a second C3 grass, The unmanaged C3 crop is only used when the crop model is not active and -has grid cell coverage assigned from satellite data. [info here about irrigation for unmanaged C3 crop] +has grid cell coverage assigned from satellite data, and +the unmanaged C3 irrigated crop type is currently not used +since irrigation requires the crop model to be active. The default list of pfts also includes twenty-three inactive crop pfts -that do not yet have associated parameters required for active management. So that all crop area is actively managed, -each of the inactive crop types is simulated using the parameters of the +that do not yet have associated parameters required for active management. +Each of the inactive crop types is simulated using the parameters of the spatially closest associated crop type that is most similar to the functional type (e.g., C3 or C4), -which is required to maintain similar phenological parameters. -The information detailing which parameters are used for each crop type is -included in Table XX. It should be noted that analysis with pft-level history output will -need to remap the crop types, as pft-level data will only include actively managed crop types. +which is required to maintain similar phenological parameters based on temperature thresholds. +Information detailing which parameters are used for each crop type is +included in Table 25.1. It should be noted that analysis with pft-level history output merges +all crop types into the actively managed crop type, so analysis +of crop-specific output will require use of the land surface dataset to +remap the yields of each actively and inactively managed crop type. .. _Phenology: @@ -210,7 +214,7 @@ Leaf emergence According to AgroIBIS, leaves may emerge when the growing degree-days of soil temperature to 0.05 m depth tracked since planting -(:math:`GDD_{T_{soi} }` ) reaches 3 to 5% of :math:`{GDD}_{mat}` +(:math:`GDD_{T_{soi} }` ) reaches 1 to 5% of :math:`{GDD}_{mat}` (:numref:`Table Crop plant functional types`). :math:`GDD_{T_{soi} }` is base 8, 0, and 10\ :math:`{}^\circ`\ C for corn, soybean, and temperate cereals. Leaf onset, as defined in the CN part of the model, occurs in the first @@ -223,12 +227,13 @@ a maximum value during phase 2. Grain fill ''''''''''''''''''' -Phase 3 begins in a similar way to phase 2. A variable tracked since +Phase 3 begins in one of two ways. The first potential trigger is based on temperature, similar to phase 2. A variable tracked since planting like :math:`GDD_{T_{soi} }` but for 2-m air temperature, :math:`GDD_{T_{{\rm 2m}} }`, must reach a heat unit threshold, *h*, -of 40 to 70% of :math:`{GDD}_{mat}` (:numref:`Table Crop plant functional types`). For corn the -percentage itself is an empirical function of :math:`{GDD}_{mat}` -(not shown). In phase 3, the leaf area index begins to decline in +of 40 to 65% of :math:`{GDD}_{mat}` (:numref:`Table Crop plant functional types`). +The second potential trigger for phase 3 is based on leaf area index. +When the maximum value of leaf area index is reached in phase 2, phase 3 begins. +In phase 3, the leaf area index begins to decline in response to a background litterfall rate calculated as the inverse of leaf longevity for the pft as done in the CN part of the model. @@ -240,12 +245,12 @@ Harvest Harvest is assumed to occur as soon as the crop reaches maturity. When :math:`GDD_{T_{{\rm 2m}} }` reaches 100% of :math:`{GDD}_{mat}` or the number of days past planting reaches a crop-specific maximum -(:numref:`Table Crop plant functional types`), then the crop is harvested. +(:numref:`Table Crop plant functional types`)[update table reference], then the crop is harvested. Harvest occurs in one time step using CN’s leaf offset algorithm. New variables track the flow of grain C and N to food and of live stem C and N to litter. Currently, food C and N are routed directly to litter using the labile, cellulose, and lignin -fractions for leaves. The same fractions for leaves are used for the +fractions for leaves. [update to product pool] The same fractions for leaves are used for the flow of live stem C and N to litter for corn, soybean, and temperate cereals. This is in contrast to the approach for unmanaged PFTs which puts live stem C and N to dead stems first, rather than to litter. diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index b6df8ed437..7c89fc063b 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -900,12 +900,6 @@ Law, B.E., Sun, O.J., Campbell, J., Van Tuyl, S. and Thornton, P.E. 2003. Changes in carbon storage and fluxes in a chronosequence of ponderosa pine. Global Change Biology, 9: 510-514. -.. _Lawrenceetal2016: - -Lawrence, D.M., et al. 2016. The Land Use Model Intercomparison Project -(LUMIP) contribution to CMIP6: rationale and experimental design. Geo. Sci. -Dev. 9:2973-2998. - .. _Lawrenceetal2007: Lawrence, D.M., Thornton, P.E., Oleson, K.W., and Bonan, G.B. 2007. The @@ -935,12 +929,12 @@ Model. Earth Sys. 3. DOI:10.1029/2011MS000045. .. _Lawrenceetal2016: -Lawrence, D. M., Hurtt, G. C., Arneth, A., Brovkin, V., Calvin, K. V., -Jones, A. D., Jones, C. D., Lawrence, P. J., de Noblet-Ducoudré, N., Pongratz, -J., Seneviratne, S. I., and Shevliakova, E, 2016. The Land Use Model +Lawrence, D.M., Hurtt, G.C., Arneth, A., Brovkin, V., Calvin, K.V., +Jones, A.D., Jones, C.D., Lawrence, P.J., de Noblet-Ducoudré, N., Pongratz, +J., Seneviratne, S.I., and Shevliakova, E. 2016. The Land Use Model Intercomparison Project (LUMIP) contribution to CMIP6: rationale -and experimental design, Geosci. Model Dev., 9, 2973-2998, -doi:10.5194/gmd-9-2973-2016. +and experimental design. Geosci. Model Dev. 9:2973-2998. +DOI:10.5194/gmd-9-2973-2016. .. _LawrenceChase2007: From 3e3655cc0e47e2deb7c3630284c5796a60d0a128 Mon Sep 17 00:00:00 2001 From: Justin Perket Date: Wed, 7 Jun 2017 13:09:33 -0600 Subject: [PATCH 0053/1973] fixed couple typos in 7.1 --- .../tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index db82c6ac68..bce8c53b23 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -56,12 +56,12 @@ Interception by vegetation is divided between liquid and solid phases .. math:: :label: 7.2 - q_{intr,\,liq} =\alpha_{liq} \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} + q_{intr,\,liq} =\alpha_{liq} q_{rain} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} .. math:: :label: 7.3 - q_{intr,\,ice} =\alpha_{sno} \left(q_{rain} +q_{sno} \right)\left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} + q_{intr,\,ice} =\alpha_{sno} q_{sno} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} where :math:`L` and :math:`S` are the exposed leaf and stem area index, @@ -100,14 +100,14 @@ where .. math:: :label: 7.8 - W_{can,liq}^{intr} =W_{can,liq}^{n} +q_{intr} \Delta t\ge 0 + W_{can,liq}^{intr} =W_{can,liq}^{n} +q_{intr,\, liq} \Delta t\ge 0 and .. math:: :label: 7.9 - W_{can,sno}^{intr} =W_{can,sno}^{n} +q_{intr} \Delta t\ge 0 + W_{can,sno}^{intr} =W_{can,sno}^{n} +q_{intr,\, ice} \Delta t\ge 0 are the the canopy liquid water and snow water equivalent after accounting for interception, From 5c6e5b0861a7a976e25b2299bf42d55ee0173623 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 8 Jun 2017 08:21:51 -0600 Subject: [PATCH 0054/1973] Hydrology update --- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 71 +++++++++++++------ .../References/CLM50_Tech_Note_References.rst | 6 ++ 2 files changed, 55 insertions(+), 22 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index db82c6ac68..ad50ea0f5e 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -473,8 +473,6 @@ Soil water is predicted from a multi-layer model, in which the vertical soil moisture transport is governed by infiltration, surface and sub-surface runoff, gradient diffusion, gravity, and canopy transpiration through root extraction (:numref:`Figure Hydrologic processes`). -The following derivation generally follows that of :ref:`Z.-L. Yang (1998, -unpublished manuscript) `. For one-dimensional vertical water flow in soils, the conservation of mass is stated as @@ -482,14 +480,14 @@ mass is stated as .. math:: :label: 7.79 - \frac{\partial \theta }{\partial t} =-\frac{\partial q}{\partial z} -Q + \frac{\partial \theta }{\partial t} =-\frac{\partial q}{\partial z} - e where :math:`\theta` is the volumetric soil water content (mm\ :sup:`3` of water / mm\ :sup:`-3` of soil), :math:`t` is time (s), :math:`z` is height above some datum in the soil column (mm) (positive upwards), :math:`q` is soil water flux (kg m\ :sup:`-2` s\ :sup:`-1` or mm s\ :sup:`-1`) (positive upwards), and -:math:`Q` is a soil moisture sink term (mm of water mm\ :sup:`-1` +:math:`e` is a soil moisture sink term (mm of water mm\ :sup:`-1` of soil s\ :sup:`-1`) (ET loss). This equation is solved numerically by dividing the soil column into multiple layers in the vertical and integrating downward over each layer with an upper boundary @@ -533,15 +531,22 @@ Equation :eq:`7.82` can be further manipulated to yield .. math:: :label: 7.83 - q=-k\left[\frac{\partial \left(\psi +z\right)}{\partial z} \right]=-k\left(\frac{\partial \psi }{\partial z} +1\right)=-k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right). + q = -k \left[\frac{\partial \left(\psi +z\right)}{\partial z} \right] + = -k \left(\frac{\partial \psi }{\partial z} + 1 \right) \ . -Substitution of this equation into equation :eq:`7.79`, with :math:`Q=0`, yields -the Richards equation +Substitution of this equation into equation :eq:`7.79`, with :math:`e = 0`, yields +the Richards equation :ref:`(Dingman 2002) ` .. math:: :label: 7.84 - \frac{\partial \theta }{\partial t} =\frac{\partial }{\partial z} \left[k\left(\frac{\partial \theta }{\partial z} \frac{\partial \psi }{\partial \theta } +1\right)\right]. + \frac{\partial \theta }{\partial t} = + \frac{\partial }{\partial z} \left[k\left(\frac{\partial \psi }{\partial z} + 1 + \right)\right]. + +In practice (Section :numref:`Numerical Solution Hydrology`), changes in soil +water content are predicted from :eq:`7.79` using finite-difference approximations +for :eq:`7.83`. .. _Hydraulic Properties: @@ -714,7 +719,7 @@ conservation of mass (equation :eq:`7.79`) can be integrated over each layer as .. math:: :label: 7.101 - \int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial \theta }{\partial t} \, dz=-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial q}{\partial z} \, dz-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }Q\, dz . + \int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial \theta }{\partial t} \, dz=-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} }\frac{\partial q}{\partial z} \, dz-\int _{-z_{h,\, i} }^{-z_{h,\, i-1} } e\, dz . Note that the integration limits are negative since :math:`z` is defined as positive upward from the soil surface. This equation can be written @@ -1035,25 +1040,47 @@ and the coefficients of the tridiagonal set of equations for Adaptive Time Stepping ''''''''''''''''''''''''''''' -The tridiagonal equation set is solved using an adaptive time-stepping procedure. -An initial solution is found by setting :math:`\Delta t` equal to the model time -step. An estimate of the error is calculated from + +To improve the accuracy and stability of the numerical solutions, the +length of the time step is adjusted. The difference between two numerical +approximations is used to estimate the temporal truncation error, and then +the step size is adjusted to meet a user-prescribed error tolerance +:ref:`[Kavetski et al., 2002]`. The temporal truncation +error is estimated by comparing the flux obtained from the first-order +Taylor series expansion (:math:`q_{i-1}^{n+1}` and :math:`q_{i}^{n+1}`, +equations :eq:`7.108` and :eq:`7.109`) against the flux at the start of the +time step (:math:`q_{i-1}^{n}` and :math:`q_{i}^{n}`). Since the tridiagonal +solution already provides an estimate of :math:`\Delta \theta_{liq,i}`, it is +convenient to compute the error for each of the :math:`i` layers from equation +:eq:`7.103` as .. math:: :label: 7.152 - \epsilon = max \left[ \frac{\Delta \theta_{liq,\, i} \Delta z_{i}}{\Delta t} - - \left( q_{i-1}^{n} - q_{i}^{n} + e_{i}\right) \right] + \epsilon_{i} = \left[ \frac{\Delta \theta_{liq,\, i} \Delta z_{i}}{\Delta t} - + \left( q_{i-1}^{n} - q_{i}^{n} + e_{i}\right) \right] \ \frac{\Delta t_{sub}}{2} + +and the maximum absolute error across all layers as + +.. math:: + :label: 7.153 + + \begin{array}{lr} + \epsilon_{crit} = {\rm max} \left( \left| \epsilon_{i} \right| \right) & \qquad 1 \le i \le nlevsoi + \end{array} \ . -If :math:`\epsilon` is greater than a specified error tolerance, the solution is -rejected, :math:`\Delta t` is halved and a new solution is determined. If the solution -is accepted, the procedure repeats until the adaptive sub-stepping spans the full -model time step. During the solution, the sub-steps may be halved until a -specified minimum time step length is reached, and the sub-steps may be doubled -when :math:`\epsilon` is less than a specified error tolerance. +The adaptive step size selection is based on specified upper and lower error +tolerances, :math:`\tau_{U}` and :math:`\tau_{L}`. The solution is accepted if +:math:`\epsilon_{crit} \le \tau_{U}` and the procedure repeats until the adaptive +sub-stepping spans the full model time step (the sub-steps are doubled if +:math:`\epsilon_{crit} \le \tau_{L}`, i.e., if the solution is very accurate). +Conversely, the solution is rejected if :math:`\epsilon_{crit} > \tau_{U}`. In +this case the length of the sub-steps is halved and a new solution is obtained. +The halving of substeps continues until either :math:`\epsilon_{crit} \le \tau_{U}` +or the specified minimum time step length is reached. -Upon solution of the tridiagonal equation set, the -liquid water contents are updated as follows +Upon solution of the tridiagonal equation set, the liquid water contents are updated +as follows .. math:: :label: 7.164 diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index b6df8ed437..a1dbf281ea 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -792,6 +792,12 @@ photosynthetic capacity and its relationship to leaf nitrogen content for global–scale terrestrial biosphere models. Global Change Biol. 15:976–991. +.. _Kavetskietal2002: + +Kavetski, D., Binning, P. and Sloan, S.W., 2002. Noniterative time +stepping schemes with adaptive truncation error control for the +solution of Richards equation. Water Resources Research, 38(10). + .. _Kelleretal2004: Keller, M., Palace, M., Asner, G.P., Pereira, R., Jr. and Silva, J.N.M., From 645daaed9e0f0ccfa5eb86f8d53b7e398423c45a Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 8 Jun 2017 08:50:33 -0600 Subject: [PATCH 0055/1973] Hydrology typo fix --- .../tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 8afb068892..404943dd97 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -546,7 +546,7 @@ the Richards equation :ref:`(Dingman 2002) ` In practice (Section :numref:`Numerical Solution Hydrology`), changes in soil water content are predicted from :eq:`7.79` using finite-difference approximations -for :eq:`7.83`. +for :eq:`7.84`. .. _Hydraulic Properties: @@ -1041,10 +1041,10 @@ and the coefficients of the tridiagonal set of equations for Adaptive Time Stepping ''''''''''''''''''''''''''''' -To improve the accuracy and stability of the numerical solutions, the -length of the time step is adjusted. The difference between two numerical +The length of the time step is adjusted in order to improve the accuracy +and stability of the numerical solutions. The difference between two numerical approximations is used to estimate the temporal truncation error, and then -the step size is adjusted to meet a user-prescribed error tolerance +the step size :math:`\Delta t_{sub}` is adjusted to meet a user-prescribed error tolerance :ref:`[Kavetski et al., 2002]`. The temporal truncation error is estimated by comparing the flux obtained from the first-order Taylor series expansion (:math:`q_{i-1}^{n+1}` and :math:`q_{i}^{n+1}`, @@ -1057,7 +1057,7 @@ convenient to compute the error for each of the :math:`i` layers from equation .. math:: :label: 7.152 - \epsilon_{i} = \left[ \frac{\Delta \theta_{liq,\, i} \Delta z_{i}}{\Delta t} - + \epsilon_{i} = \left[ \frac{\Delta \theta_{liq,\, i} \Delta z_{i}}{\Delta t_{sub}} - \left( q_{i-1}^{n} - q_{i}^{n} + e_{i}\right) \right] \ \frac{\Delta t_{sub}}{2} and the maximum absolute error across all layers as From e23f4731c1e175614d99f776ca7f16537bd396fa Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 8 Jun 2017 10:47:39 -0600 Subject: [PATCH 0056/1973] Fire Chapter Update from F.Li --- .../tech_note/Fire/CLM50_Tech_Note_Fire.rst | 613 ++++++++++-------- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 2 +- .../References/CLM50_Tech_Note_References.rst | 6 + 3 files changed, 332 insertions(+), 289 deletions(-) diff --git a/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst b/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst index d6b6495827..caef87c2b3 100644 --- a/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst +++ b/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst @@ -4,162 +4,166 @@ Fire ======== The fire parameterization in CLM contains four components: non-peat -fires outside cropland and tropical closed forests, agricultural fires, -deforestation fires in the tropical closed forests, and peat fires (Li -et al. 2012a, b, 2013). In this fire parameterization, burned area is -affected by climate and weather conditions, vegetation composition and -structure, and human activities. After burned area is calculated, we -estimate the fire impact, including biomass and peat burning, -fire-induced vegetation mortality, and the adjustment of the carbon and -nitrogen (C/N) pools. Justification for all equations and parameter -values is given by Li et al. (2012a, b; 2013) in detail. +fires outside cropland and tropical closed forests, agricultural fires +in cropland, deforestation fires in the tropical closed forests, and +peat fires (see :ref:`Li et al. 2012a `, +:ref:`Li et al. 2012b `, :ref:`Li et al. 2013 `, +:ref:`Li and Lawrence 2017 ` for details). +In this fire parameterization, burned area is affected by climate and +weather conditions, vegetation composition and structure, and human +activities. After burned area is calculated, we estimate the fire impact, +including biomass and peat burning, fire-induced vegetation mortality, +adjustment of the carbon and nitrogen (C/N) pools, and fire emissions. + +.. _Non-peat fires outside cropland and tropical closed forest: Non-peat fires outside cropland and tropical closed forest --------------------------------------------------------------- -Burned area in a grid cell per time step,\ :math:`A_{b}` -(km :sup:`2` (time step) :sup:`-1`), is determined by +Burned area in a grid cell, \ :math:`A_{b}` (km\ :sup:`2` s :sup:`-1`), +is determined by .. math:: - :label: 23.1) + :label: 23.1 A_{b} =N_{f} a -where :math:`N_{f}` (count (time step)\ :sup:`-1`) is fire -counts in the grid cell; :math:`a` (km:sup:`2`) is average fire +where :math:`N_{f}` (count s\ :sup:`-1`) is fire +counts in the grid cell; :math:`a` (km\ :sup:`2`) is average fire spread area of a fire. +.. _Fire counts: + Fire counts ^^^^^^^^^^^^^^^^^^ Fire counts :math:`N_{f}` is taken as .. math:: - :label: 23.2) + :label: 23.2 - N_{f} =N_{i} f_{b} f_{m} f_{se,o} + N_{f} = N_{i} f_{b} f_{m} f_{se,o} -where :math:`N_{i}` \ ( count (time step)\ :sup:`-1`) is the +where :math:`N_{i}` ( count s\ :sup:`-1`) is the number of ignition sources due to natural causes and human activities; :math:`f_{b}` and :math:`f_{m}` (fractions) represent the availability and combustibility of fuel, respectively; :math:`f_{se,o}` is the fraction of anthropogenic and natural fires unsuppressed by humans and related to the socioeconomic conditions. -:math:`N_{i}` (count (time step)\ :sup:`-1`) is given as +:math:`N_{i}` (count s\ :sup:`-1`) is given as .. math:: - :label: 23.3) + :label: 23.3 - N_{i} =(I_{n} +I_{a} )A_{g} + N_{i} = \left(I_{n} +I_{a} \right) A_{g} -where :math:`I_{n}` \ (count km\ :sup:`-2` (time step)\ :sub:`-1`) and :math:`I_{a}` \ (count km\ :sup:`-2` (time step)\ :sup:`-1`) are the number of natural and -anthropogenic ignitions per km\ :sup:`2`, respectively; -*A*\ :sub:`g` is the area of the grid cell (km\ :sup:`2`). -:math:`I_{n}` is estimated by +where :math:`I_{n}` (count km\ :sup:`-2` s\ :sup:`-1`) and :math:`I_{a}` +(count km\ :sup:`-2` s\ :sup:`-1`) are the number of natural and anthropogenic +ignitions per km\ :sup:`2`, respectively; :math:`A_{g}` is the area of the +grid cell (km\ :sup:`2`). :math:`I_{n}` is estimated by .. math:: - :label: 23.4) + :label: 23.4 - I_{n} =\gamma \psi I_{l} + I_{n} = \gamma \psi I_{l} -where :math:`\gamma` \ =0.25 is ignition efficiency of cloud-to-ground -lightning; :math:`\psi =\frac{1}{5.16+2.16\cos (3\lambda )}` is the -cloud-to-ground lightning fraction and depends on the latitude -:math:`\lambda` ; :math:`I_{l}` (flash km\ :sup:`-2` (time step)\ :sup:`-1`) is the total lightning flashes. :math:`I_{a}` , -is modeled as a monotonic increasing function of population density:\ +where :math:`\gamma` \ =0.22 is ignition efficiency of cloud-to-ground +lightning; :math:`\psi =\frac{1}{5.16+2.16\cos [3min(60,\lambda )]}` is the +cloud-to-ground lightning fraction and depends on the latitude +:math:`\lambda` (degrees) ; :math:`I_{l}` (flash km\ :sup:`-2` s\ :sup:`-1`) is +the total lightning flashes. :math:`I_{a}` is modeled as a monotonic +increasing function of population density: .. math:: - :label: 23.5) + :label: 23.5 I_{a} =\frac{\alpha D_{P} k(D_{P} )}{n} -where :math:`\alpha =0.0035` (count person\ :sup:`-1` mon\ :sup:`-1`) is the number of potential ignition sources by a -person per month; :math:`D_{P}` (person km\ :sup:`-2`) is the population density; -:math:`k(D_{P} )=6.8D_{P} ^{-0.6}` represents anthropogenic ignition -potential as a function of human population density\ :math:`D_{P}` ; *n* -is the number of time steps in a month. +where :math:`\alpha =0.01` (count person\ :sup:`-1` mon\ :sup:`-1`) is the number of potential ignition sources by a +person per month; :math:`D_{P}` (person km\ :sup:`-2`) is the population density; :math:`k(D_{P} )=6.8D_{P} ^{-0.6}` represents anthropogenic ignition +potential as a function of human population density :math:`D_{P}` ; *n* +is the seconds in a month. -Fuel availability\ :math:`f_{b}` is given as +Fuel availability :math:`f_{b}` is given as .. math:: - :label: ZEqnNum730456 + :label: 23.6 - f_{b} =\left\{\begin{array}{c} {0} \\ {\frac{B_{ag} -B_{low} }{B_{up} -B_{low} } } \\ {1} \end{array}\right. ,\begin{array}{cc} {} & {} \end{array}\begin{array}{c} {B_{ag} B_{up} } \end{array} + f_{b} =\left\{\begin{array}{c} + {0} \\ {\frac{B_{ag} -B_{low} }{B_{up} -B_{low} } } \\ {1} \end{array} + \begin{array}{cc} {} & {} \end{array}\begin{array}{c} {B_{ag} B_{up} } + \end{array}\right\} \ , -where :math:`B_{ag}` (g C m\ :sup:`-2`) is the aboveground -biomass of combined leaf, stem and aboveground litter (leaf litter and -woody debris) pools; :math:`B_{low}` \ =155 g C m\ :sup:`-2` is -the lower fuel threshold below which fire does not occur; -:math:`B_{up}` \ = 1050 g C m\ :sup:`-2` is the upper fuel -threshold above which fire occurrence is not limited by fuel -availability. +where :math:`B_{ag}` (g C m\ :sup:`-2`) is the biomass of combined leaf, +stem, litter, and woody debris pools; :math:`B_{low}` = 105 g C m :sup:`-2` +is the lower fuel threshold below which fire does not occur; :math:`B_{up}` += 1050 g C m\ :sup:`-2` is the upper fuel threshold above which fire +occurrence is not limited by fuel availability. Fuel combustibility :math:`f_{m}` is estimated by .. math:: - :label: 23.7) - - f_{m} =f_{RH} f_{\theta } f_{T} + :label: 23.7 -where :math:`f_{RH}`, :math:`f_{\theta }`, :math:`f_{T}` -represent the dependence of fuel combustibility on relative humidity -*RH* (%), surface soil wetness :math:`\theta` , and surface air -temperature *T* (ºC), respectively. :math:`f_{RH}` is calculated by + f_{m} = {f_{RH} f_{\beta}}, &\qquad T_{17cm} > T_{f} + +where :math:`f_{RH}` and :math:`f_{\beta }` represent the dependence of +fuel combustibility on relative humidity :math:`RH` (%) and root-zone +soil moisture limitation :math:`\beta` (fraction); :math:`T_{17cm}` is +the temperature of the top 17 cm of soil (K) and :math:`T_{f}` is the +freezing temperature. :math:`f_{RH}` is a weighted average of real time +:math:`RH` (:math:`RH_{0}`) and 30-day running mean :math:`RH` +(:math:`RH_{30d}`): .. math:: - :label: 23.8) - - f_{RH} =\left\{\begin{array}{cccc} {1} & {} & {} & {RH\le RH_{low} } \\ {\frac{RH_{up} -RH}{RH_{up} -RH_{low} } ,} & {} & {} & {RH_{low} 0.1` person km\ :sup:`-2`, we parameterize the fraction of anthropogenic and natural fires unsuppressed by human activities as .. math:: - :label: 23.10) + :label: 23.10 f_{se,o} =f_{d} f_{e} -where :math:`{f}_{d}` and :math:`{f}_{e}` are -the effects of the demographic and economic conditions on fire -occurrence. The demographic influence on fire occurrence is +where :math:`{f}_{d}` and :math:`{f}_{e}` are the effects of the +demographic and economic conditions on fire occurrence. The demographic +influence on fire occurrence is .. math:: - :label: 23.11) + :label: 23.11 - f_{d} =0.01+0.98\exp (-0.025D_{P} ). + f_{d} =0.01 + 0.98 \exp (-0.025D_{P} ). For shrub and grass PFTs, the economic influence on fire occurrence is parameterized as a function of Gross Domestic Product GDP (k 1995US$ capita\ :sup:`-1`): .. math:: - :label: 23.12) + :label: 23.12 f_{e} =0.1+0.9\times \exp [-\pi (\frac{GDP}{8} )^{0.5} ] @@ -167,19 +171,20 @@ which captures 73% of the observed MODIS fire counts with variable GDP in regions where shrub and grass PFTs are dominant (fractional coverage of shrub and grass PFTs :math:`>` 50%). In regions outside tropical closed forests and dominated by trees (fractional coverage of tree PFTs -:math:`>` 50%), we divide the MODIS fire counts into only two bins -(:math:`GDP\ge 20` k 1995US$ capita\ :sup:`-1`, and :math:`GDP<20` -k 1995US$ capita\ :sup:`-1`) and parameterize the economic -influence on fire occurrence for tree PFTs as +:math:`>` 50%), we use .. math:: - :label: 23.13) + :label: 23.13 + + f_{e} =\left\{\begin{array}{c} + {0.39} \\ {0.79} \\ {1} \end{array} + \begin{array}{cc} {} & {} \end{array}\begin{array}{c} {GDP > 20 } \\ + { 8 < GDP \le 20 } \\ { GDP \le 8 } + \end{array}\right\} \ , - f_{e} =\left\{\begin{array}{cc} {0.39,} & {GDP\ge 20} \\ {1} & {GDP<20} \end{array}\right. +to reproduce the relationship between MODIS fire counts and GDP. -to reproduce that the MODIS fire counts in tree-dominated regions of -GDP (:math:`\ge 20` k 1995US$ capita\ :sup:`-1` is 39% of that in -other tree-dominated regions. +.. _Average spread area of a fire: Average spread area of a fire ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -190,7 +195,7 @@ socioeconomic impact on the average burned area rather than separately on fire spread rate and fire duration: .. math:: - :label: 23.14) + :label: 23.14 a=a^{*} F_{se} @@ -205,19 +210,19 @@ formula for an ellipse, average burned area of a fire can be represented as: .. math:: - :label: 23.15) + :label: 23.15 a^{*} =\pi \frac{l}{2} \frac{w}{2} \times 10^{-6} =\frac{\pi u_{p}^{2} \tau ^{2} }{4L_{B} } (1+\frac{1}{H_{B} } )^{2} \times 10^{-6} -where :math:`u_{p}` \ (m s\ :sup:`-1`) is the fire spread rate in -the downwind direction; :math:`\tau` \ (s) is average fire -duration;\ :math:`L_{B}` and :math:`H_{B}` are length-to-breadth ratio -and head-to-back ratio of the ellipse; 10\ :sup:`-6` converts m\ :sup:`2` to km\ :sup:`2`. +where :math:`u_{p}` (m s\ :sup:`-1`) is the fire spread rate in the +downwind direction; :math:`\tau` (s) is average fire duration; :math:`L_{B}` +and :math:`H_{B}` are length-to-breadth ratio and head-to-back ratio of +the ellipse; 10 :sup:`-6` converts m :sup:`2` to km :sup:`2`. -According to Arora and Boer (2005), +According to :ref:`Arora and Boer (2005)`, .. math:: - :label: ZEqnNum696342 + :label: 23.16 L_{B} =1.0+10.0[1-\exp (-0.06W)] @@ -226,61 +231,55 @@ the mathematical properties of the ellipse, the head-to-back ratio :math:`H_{B}` is .. math:: - :label: ZEqnNum179757 + :label: 23.17 H_{B} =\frac{u_{p} }{u_{b} } =\frac{L_{B} +(L_{B} ^{2} -1)^{0.5} }{L_{B} -(L_{B} ^{2} -1)^{0.5} } . The fire spread rate in the downwind direction is represented as .. math:: - :label: 23.18) + :label: 23.18 u_{p} =u_{\max } C_{m} g(W) -(Arora and Boer, 2005), where :math:`u_{\max }`\ (m s\ :sup:`-1`) is the PFT-dependent average maximum fire spread -rate in natural vegetation regions; :math:`C_{m}` and :math:`g(W)` +(:ref:`Arora and Boer, 2005`), where :math:`u_{\max }` +(m s\ :sup:`-1`) is the PFT-dependent average maximum fire spread +rate in natural vegetation regions; :math:`C_{m} =\sqrt{f_{m}}` and :math:`g(W)` represent the dependence of :math:`u_{p}` on fuel wetness and wind -speed :math:`W`, respectively. :math:`u_{\max }` is set to 0.55 m -s\ :sup:`-1`\ for grass PFTs, 0.46 m s\ :sup:`-1` for -shrub PFTs, 0.43 m s\ :sup:`-1` for needleleaf tree PFTs, and 0.40 m s\ :sup:`-1` for other tree PFTs. -:math:`C_{m} =C_{\beta } C_{RH}` is estimated by the dependence of -:math:`u_{p}` \ on root zone soil wetness (:math:`C_{\beta }` ) and -relative humidity (:math:`C_{RH}` ). Here,\ :math:`\beta` is a root -zone soil moisture limitation function. Due to a lack of observations to -calibrate :math:`C_{\beta }` , we adopt a simple linear function, where -:math:`\beta _{low}` \ =0.3 and :math:`\beta _{up}` \ =0.7 are the lower -and upper thresholds of root zone soil wetness, respectively. -**:math:`C_{RH}` ** is set equal to :math:`f_{RH}` . :math:`g(W)` is -derived from the mathematical properties of the ellipse and Eqs and - -.. math:: - :label: 23.19) +speed :math:`W`, respectively. :math:`u_{\max }` is set to 0.33 +m s :sup:`-1`\ for grass PFTs, 0.28 m s :sup:`-1` for shrub PFTs, 0.26 +m s\ :sup:`-1` for needleleaf tree PFTs, and 0.25 m s\ :sup:`-1` for +other tree PFTs. :math:`g(W)` is derived from the mathematical properties +of the ellipse and equation :eq:`23.16` and :eq:`23.17`. + +.. math:: + :label: 23.19 g(W)=\frac{2L_{B} }{1+\frac{1}{H_{B} } } g(0). -Since g(\ *W*)=1.0, and\ :math:`L_{B}` and :math:`H_{B}` are at their -maxima\ :math:`L_{B} ^{\max } =11.0`\ and :math:`H_{B} ^{\max } =482.0` +Since g(\ *W*)=1.0, and \ :math:`L_{B}` and :math:`H_{B}` are at their +maxima \ :math:`L_{B} ^{\max } =11.0` and \ :math:`H_{B} ^{\max } =482.0` when :math:`W\to \infty` , g(0) can be derived as .. math:: - :label: 23.20) + :label: 23.20 g(0)=\frac{1+\frac{1}{H_{B} ^{\max } } }{2L_{B} ^{\max } } =0.05. In the absence of globally gridded data on barriers to fire (e.g. rivers, lakes, roads, firebreaks) and human fire-fighting efforts, average fire duration is simply assumed equal to 1 which is the observed -2001–2004 mean persistence of most fires in the world (Giglio et al. -2006). +2001–2004 mean persistence of most fires in the world +(:ref:`Giglio et al. 2006 `). As with the socioeconomic influence on fire occurrence, we assume that the socioeconomic influence on fire spreading is negligible in regions -of\ :math:`D_{p} \le 0.1` person km\ :sup:`-2`, i.e., -:math:`F_{se} =1.0`. In regions of :math:`D_{p} >0.1` person +of :math:`D_{p} \le 0.1` person km\ :sup:`-2`, i.e., +:math:`F_{se} = 1.0`. In regions of :math:`D_{p} >0.1` person km\ :sup:`-2`, we parameterize such socioeconomic influence as: .. math:: - :label: 23.21) + :label: 23.21 F_{se} =F_{d} F_{e} @@ -292,14 +291,14 @@ indices in grid cells with various dominant vegetation types. For shrub and grass PFTs, the demographic impact factor is .. math:: - :label: ZEqnNum900584 + :label: 23.22 F_{d} =0.2+0.8\times \exp [-\pi (\frac{D_{p} }{450} )^{0.5} ] and the economic impact factor is .. math:: - :label: ZEqnNum213480 + :label: 23.23 F_{e} =0.2+0.8\times \exp (-\pi \frac{GDP}{7} ). @@ -307,144 +306,154 @@ For tree PFTs outside tropical closed forests, the demographic and economic impact factors are given as .. math:: - :label: 23.24) + :label: 23.24 F_{d} =0.4+0.6\times \exp (-\pi \frac{D_{p} }{125} ) and .. math:: - :label: ZEqnNum543524 + :label: 23.25 + + F_{e} =\left\{\begin{array}{cc} + {0.62,} & {GDP>20} \\ {0.83,} & {820} \\ {0.83,} & {8` that shows the +2001-2009 average contribution of cropland fires is 4.7% of the total +global burned area. -We assume the same fuel-load requirement for all fires, so -:math:`f_{b}` is set by Eq. . The socioeconomic factor :math:`f_{se}` -is given as follows: +The socioeconomic factor :math:`f_{se}` is given as follows: .. math:: - :label: 23.31) + :label: 23.31 f_{se} =f_{d} f_{e} . Here .. math:: - :label: 23.32) + :label: 23.32 f_{d} =0.04+0.96\times \exp [-\pi (\frac{D_{p} }{350} )^{0.5} ] and .. math:: - :label: 23.33) + :label: 23.33 f_{e} =0.01+0.99\times \exp (-\pi \frac{GDP}{10} ) are the effects of population density and GDP on burned area, derived -in a similar way to Eqs. and . :math:`f_{t}` is set to 1 during the -climatological peak month for agricultural fires (van der Werf et al. -2010) in time steps with no precipitation and -*T*\ :math:`>`\ :math:`{T}_{f}` if no agricultural fires occurred -earlier in the year; :math:`{f}_{t}` is set to 0 otherwise. Peak +in a similar way to equation :eq:`23.32` and :eq:`23.33`. :math:`f_{t}` +is set to 1 at the first time step during the climatological peak month +for agricultural fires (:ref:`van der Werf et al. 2010 `); +:math:`{f}_{t}` is set to 0 otherwise. Peak month in this dataset correlates with the month after harvesting or the month before planting. In CLM we use this dataset the same way whether the CROP option is active or not, without regard to the CROP option’s simulated planting and harvesting dates. -In the post-fire region, fire impact is parameterized similar to section -18.1.3 but with combustion completeness factors and tissue mortality -factors for crop PFTs (:numref:`Table PFT-specific combustion completeness and fire mortality`). +In the post-fire region, fire impact is parameterized similar to section +:numref:`Fire impact` but with combustion completeness factors and tissue +mortality factors for crop PFTs +(:numref:`Table PFT-specific combustion completeness and fire mortality factors`). +.. _Deforestation fires: + Deforestation fires ------------------------ CLM focuses on deforestation fires in tropical closed forests. Tropical -closed forests are defined as grid cells with tropical tree coverage -:math:`>`\ 60% according to the FAO classification. Deforestation fires +closed forests are defined as grid cells with tropical tree (BET and BDT tropical) +coverage :math:`>` 60% according to the FAO classification. Deforestation fires are defined as fires caused by deforestation, including escaped deforestation fires, termed degradation fires. Deforestation and degradation fires are assumed to occur outside of cropland areas in @@ -452,71 +461,74 @@ these grid cells. Burned area is controlled by the deforestation rate and climate: .. math:: - :label: 23.34) + :label: 23.34 - A_{b} =bf_{lu} f_{cli,d} A_{g} + A_{b} = b \ f_{lu} f_{cli,d} f_{b} A_{g} -where *b* (time step)\ :sup:`-1` is a global constant; +where :math:`b` (s\ :sup:`-1`) is a global constant; :math:`f_{lu}` (fraction) represents the effect of decreasing -fractional coverage of tree PFTs derived from land use data; and +fractional coverage of tree PFTs derived from land use data; :math:`f_{cli,d}` (fraction) represents the effect of climate conditions on the burned area. -Constants *b* and :math:`{f}_{lu}` are calibrated +Constants :math:`b` and :math:`{f}_{lu}` are calibrated based on observations and reanalysis datasets in the Amazon rainforest -(tropical closed forests within 15.5ºS\ :math:`\text{-}`\ 10.5ºN, -30.5ºW\ :math:`\text{-}`\ 91ºW). *b=*\ 0.035 d\ :sup:`-1` and -:math:`f_{lu}` is defined as +(tropical closed forests within 15.5 :sup:`o` S :math:`\text{-}` 10.5 +:sup:`o` N, 30.5 :sup:`o` W :math:`\text{-}` 91 :sup:`o` W). +:math:`b` = 0.033 d\ :sup:`-1` and :math:`f_{lu}` is defined as .. math:: - :label: 23.35) + :label: 23.35 - f_{lu} =\max (0.0005,0.19D-0.0011) + f_{lu} = \max (0.0005,0.19D-0.001) -where :math:`D`\ (yr:sup:`-1`) is the annual loss of tree cover -based on CLM4’s land use and land cover change data. +where :math:`D` (yr\ :sup:`-1`) is the annual loss of tree cover +based on CLM land use and land cover change data. The effect of climate on deforestation fires is parameterized as: .. math:: - :label: ZEqnNum336915 - - \begin{array}{l} {f_{cli,d} =\max [0,\min (1,\frac{b_{2} -P_{60d} }{b_{2} } )]^{0.5} \max [0,\min (1,\frac{b_{3} -P_{10d} }{b_{3} } )]^{0.5} } \\ {\qquad \max [0,\min (1,\frac{0.25-P}{0.25} )]} \end{array} - -where\ :math:`P`\ (mm d\ :sup:`-1`) is instantaneous -precipitation, while :math:`P_{60d}` (mm d\ :sup:`-1`) and -:math:`P_{10d}` (mm d\ :sup:`-1`) are 60-day and 10-day running -means of precipitation, respectively; :math:`b_{2}` (mm -d\ :sup:`-1`) and :math:`b_{3}` (mm d\ :sup:`-1`) are the -grid-cell dependent thresholds of :math:`P_{60d}` and :math:`P_{10d}` ; -0.25 mm d\ :sup:`-1` is the maximum precipitation rate for -drizzle. Le Page et al. (2010) analyzed the relationship between -large-scale deforestation fire counts and precipitation during -2003\ :math:`\text{-}`\ 2006 in southern Amazonia where tropical -evergreen trees (BET Tropical) are dominant. Figure 2 in Le Page et al. -(2010) showed that fires generally occurred if both :math:`P_{60d}` and -:math:`P_{10d}` were less than about 4.0 mm d\ :sup:`-1`, and -fires occurred more frequently in a drier environment. Based on the -30-yr (1985:math:`\text{-}`\ 2004) precipitation data in Qian et al. -(2006), the climatological precipitation of dry months (P:math:`<`\ 4.0 -mm d\ :sup:`-1`) in a year over tropical deciduous tree (BDT -Tropical) dominated regions is 46% of that over BET Tropical dominated -regions, so we set the PFT-dependent thresholds of :math:`P_{60d}` and -:math:`P_{10d}` as 4.0 mm d\ :sup:`-1` for BET Tropical and 1.8 -mm d\ :sup:`-1` (= 4.0 mm d\ :sup:`-1` :math:`\times` 46%) -for BDT Tropical, and *b*\ :sub:`2` and *b*\ :sub:`3` are -the average of thresholds of BET Tropical and BDT Tropical weighted by -their coverage. + :label: 23.36 + + \begin{array}{ll} + f_{cli,d} \quad = & \quad \max \left[0,\min (1,\frac{b_{2} -P_{60d} }{b_{2} } )\right]^{0.5} \times \\ + & \quad \max \left[0,\min (1,\frac{b_{3} -P_{10d} }{b_{3} } )\right]^{0.5} \times \\ + & \quad \max \left[0,\min (1,\frac{0.25-P}{0.25} )\right] + \end{array} + +where :math:`P` (mm d :sup:`-1`) is instantaneous precipitation, while +:math:`P_{60d}` (mm d\ :sup:`-1`) and :math:`P_{10d}` (mm d :sup:`-1`) +are 60-day and 10-day running means of precipitation, respectively; +:math:`b_{2}` (mm d :sup:`-1`) and :math:`b_{3}` (mm d :sup:`-1`) are +the grid-cell dependent thresholds of :math:`P_{60d}` and :math:`P_{10d}` ; +0.25 mm d :sup:`-1` is the maximum precipitation rate for drizzle. +:ref:`Le Page et al. (2010) ` analyzed the relationship +between large-scale deforestation fire counts and precipitation during 2003 +:math:`\text{-}`\ 2006 in southern Amazonia where tropical evergreen trees +(BET Tropical) are dominant. Figure 2 in +:ref:`Le Page et al. (2010) ` showed that fires generally +occurred if both :math:`P_{60d}` and :math:`P_{10d}` were less than about +4.0 mm d :sup:`-1`, and fires occurred more frequently in a drier environment. +Based on the 30-yr (1985 to 2004) precipitation data in +:ref:`Qian et al. (2006) `. The climatological precipitation +of dry months (P < 4.0 mm d :sup:`-1`) in a year over tropical deciduous +tree (BDT Tropical) dominated regions is 46% of that over BET Tropical +dominated regions, so we set the PFT-dependent thresholds of :math:`P_{60d}` +and :math:`P_{10d}` as 4.0 mm d :sup:`-1` for BET Tropical and 1.8 mm d +:sup:`-1` (= 4.0 mm d :sup:`-1` :math:`\times` 46%) for BDT Tropical, and +:math:`b`\ :sub:`2` and :math:`b`\ :sub:`3` are the average of thresholds +of BET Tropical and BDT Tropical weighted bytheir coverage. The post-fire area due to deforestation is not limited to land-type conversion regions. In the tree-reduced region, the maximum fire carbon emissions are assumed to be 80% of the total conversion flux. According to the fraction of conversion flux for tropical trees in the -tree-reduced region (60%) assigned by CLM, to reach the maximum fire +tree-reduced region (60%) assigned by CLM4-CN, to reach the maximum fire carbon emissions in a conversion region requires burning this region about twice when we set PFT-dependent combustion completeness factors to -about 0.3 for stem [the mean of 0.2\ :math:`{-}`\ 0.4 used in van -der Werf (2010)]. Therefore, when the burned area calculated from Eq. is +about 0.3 for stem [the mean of 0.2\ :math:`{-}`\ 0.4 used in +:ref:`van der Werf et al. (2010) `. Therefore, when +the burned area calculated from equation :eq:`23.36` is no more than twice the tree-reduced area, we assume no escaped fires outside the land-type conversion region, and the fire-related fraction of the total conversion flux is estimated as @@ -524,7 +536,9 @@ of the total conversion flux is estimated as conversion flux is assumed to be fire carbon emissions, and the biomass combustion and vegetation mortality outside the tree-reduced regions with an area fraction of :math:`\frac{A_{b} }{A_{g} } -2D` are set as in -section 18.1.3. +section :numref:`Fire impact`. + +.. _Peat fires: Peat fires --------------- @@ -532,102 +546,125 @@ Peat fires The burned area due to peat fires is given as :math:`{A}_{b}`: .. math:: - :label: 23.37) + :label: 23.37 - A_{b} =cf_{cli,p} f_{peat} (1-f_{sat} )A_{g} + A_{b} = c \ f_{cli,p} f_{peat} (1 - f_{sat} ) A_{g} -where *c* (time step)\ :sup:`-1` is a constant; :math:`f_{cli,p}` -represents the effect of climate on the burned area;\ :math:`f_{peat}` -is the fractional coverage of peatland in the grid cell; and -:math:`f_{sat}` is the fraction of the grid cell with a water table at -the surface or higher. *c*\ =1.0\ :math:`\times`\ 10\ :sup:`-3` hr\ :sup:`-1` for tropical peat fires and -*c*\ =4.2\ :math:`\times`\ 10\ :sup:`-5` hr\ :sup:`-1` for boreal peat fires are derived using an inverse -method, by matching simulations from an unreleased -CLM4.5 version driven by Qian et al. (2006) atmospheric forcing and -climatological lightning data to earlier studies: about 2.4 Mha peatland -was burned over Indonesia in 1997 (Page et al. 2002) and the average -burned area of peat fires in Western Canada was 0.2 Mha -yr\ :sup:`-1` for 1980-1999 (Turestky et al. 2004). +where :math:`c` (s\ :sup:`-1`) is a constant; :math:`f_{cli,p}` represents +the effect of climate on the burned area; :math:`f_{peat}` is the fractional +coverage of peatland in the grid cell; and :math:`f_{sat}` is the fraction +of the grid cell with a water table at the surface or higher. :math:`c` = 0.17 +:math:`\times` 10 :sup:`-3` hr\ :sup:`-1` for tropical peat fires and +:math:`c` = 0.9 :math:`\times` 10 :sup:`-5` hr :sup:`-1` for boreal peat fires +are derived using an inverse method, by matching simulations to earlier +studies: about 2.4 Mha peatland was burned over Indonesia in 1997 +(:ref:`Page et al. 2002 `) and the average burned area of peat +fires in Western Canada was 0.2 Mha yr :sup:`-1` for 1980-1999 +(:ref:`Turetsky et al. 2004 `). For tropical peat fires, :math:`f_{cli,p}` is set as a function of long-term precipitation :math:`P_{60d}` : .. math:: - :label: 23.38) + :label: 23.38 - f_{cli,p} =\max [0,\min (1,\frac{4-P_{60d} }{4} )]^{2} . + f_{cli,p} = \ max \left[0,\min \left(1,\frac{4-P_{60d} }{4} \right)\right]^{2} . For boreal peat fires, :math:`f_{cli,p}` is set to .. math:: - :label: 23.39) + :label: 23.39 f_{cli,p} = \exp (-\pi \frac{\theta _{17cm} }{0.3} )\cdot \max [0,\min (1,\frac{T_{17cm} -T_{f} }{10} )] -where :math:`\theta _{17cm}` and :math:`T_{17cm}` are the wetness and -temperature of the top 17 cm of soil; :math:`T_{f}` \ =273.15 K is the -freezing temperature. +where :math:`\theta _{17cm}` is the wetness of the top 17 cm of soil. + +Peat fires lead to peat burning and the combustion and mortality of +vegetation over peatlands. For tropical peat fires, based on +:ref:`Page et al. (2002) `, about 6% of the peat carbon loss +from stored carbon is caused by 33.9% of the peatland burned. Carbon emissions +due to peat burning (g C m\ :sup:`-2` s\ :sup:`-1`) are therefore set as the +product of 6%/33.9%, burned area fraction of peat fire (s\ :sup:`-1`), and +soil organic carbon (g C m\ :sup:`-2`). For boreal peat fires, the carbon +emissions due to peat burning are set as 2.2 kg C m\ :sup:`-2` \ peat fire +area (:ref:`Turetsky et al. 2002 `). Biomass combustion +and vegetation mortality in post-fire peatlands are set the same as section +:numref:`Fire impact` for non-crop PFTs and as section +:numref:`Agricultural fires` for crops PFTs. -Peat fires lead to peat combustion and the combustion and mortality of -vegetation in peatlands. For tropical peat fires, based on Page et al. -(2002), about 6% of the peat carbon loss from stored carbon is caused by -33.9% of the peatland burned. Carbon emissions due to peat combustion (g C m\ :sup:`-2` (time step)\ :sup:`-1`) are therefore set as -the product of 6%/33.9%, by burned area fraction of peat fire ((time -step)\ :sup:`-1`), by soil organic carbon (g C m\ :sup:`-2`). For boreal peat fires, the carbon emissions due to -peat combustion are set as 2.2 kg C m\ :sup:`-2`\ peat fire area (Turetsky et al. -2002). Biomass combustion and vegetation mortality in post-fire -peatlands are set the same as section 18.1.3 for non-crop PFTs and as -section 18.2 for crops PFTs. +.. _Fire trace gas and aerosol emissions: -.. _Table PFT-specific combustion completeness and fire mortality: +Fire trace gas and aerosol emissions +------------------------------------- +CESM2 is the first Earth system model that can model the full coupling +among fire, fire emissions, land, and atmosphere. CLM5, as the land +component of CESM2, calculates the surface trace gas and aerosol emissions +due to fire and fire emission heights, as the inputs of atmospheric +chemistry model and aerosol model. + +Emissions for trace gas and aerosol species x and the j-th PFT, :math:`E_{x,j}` +(g species s\ :sup:`-1`), are given by + +.. math:: + :label: 23.40 + + E_{x,j} = EF_{x,j}\frac{\phi _{j} }{[C]}. + +Here, :math:`EF_{x,j}` (g species (g dm)\ :sup:`-1`) is PFT-dependent emission +factor scaled from biome-level values (Li et al., in prep, also used for FireMIP +fire emissions data) by Dr. Val Martin and Dr. Li. :math:`[C]` = 0.5 +(g C (g dm)\ :sup:`-1`) is a conversion factor from dry matter to carbon. + +Emission height is PFT-dependent: 4.3 km for needleleaf tree PFTs, 3 km for other +boreal and temperate tree PFTs, 2.5 km for tropical tree PFTs, 2 km for shrub +PFTs, and 1 km for grass and crop PFTs. These values are compiled from earlier +studies by Dr. Val Martin. + +.. _Table PFT-specific combustion completeness and fire mortality factors: .. table:: PFT-specific combustion completeness and fire mortality factors. +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | PFT | *CC*\ :sub:`leaf` | *CC*\ :sub:`stem` | *CC*\ :sub:`root` | *CC*\ :sub:`ts` | *M*\ :sub:`leaf` | *M*\ :sub:`livestem` | *M*\ :sub:`deadstem` | *M*\ :sub:`root` | *M*\ :sub:`ts` | *M*\ :sub:`livestem` | :math:`\xi`\ :sub:`j` | + | PFT | *CC*\ :sub:`leaf` | *CC*\ :sub:`stem` | *CC*\ :sub:`root` | *CC*\ :sub:`ts` | *M*\ :sub:`leaf` | *M*\ :sub:`livestem,1` | *M*\ :sub:`deadstem` | *M*\ :sub:`root` | *M*\ :sub:`ts` | *M*\ :sub:`livestem,2` | :math:`\xi`\ :sub:`j` | +==================================+===========================+===========================+===========================+=========================+==========================+==============================+==============================+==========================+========================+==============================+=================================+ - | NET Temperate | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | - +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | NET Boreal | 0.80 | 0.25 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | + | NET Temperate | 0.80 | 0.30 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | NDT Boreal | - | - | - | - | - | - | - | - | - | - | - | + | NET Boreal | 0.80 | 0.30 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | BET Tropical | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | + | NDT Boreal | 0.80 | 0.30 | 0.00 | 0.50 | 0.80 | 0.15 | 0.15 | 0.15 | 0.50 | 0.35 | 0.15 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | BET Temperate | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | + | BET Tropical | 0.80 | 0.27 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | BDT Tropical | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | + | BET Temperate | 0.80 | 0.27 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | BDT Temperate | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | + | BDT Tropical | 0.80 | 0.27 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | BDT Boreal | 0.80 | 0.22 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | + | BDT Temperate | 0.80 | 0.27 | 0.00 | 0.45 | 0.80 | 0.10 | 0.10 | 0.10 | 0.35 | 0.25 | 0.10 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | BES Temperate | - | - | - | - | - | - | - | - | - | - | - | + | BDT Boreal | 0.80 | 0.27 | 0.00 | 0.45 | 0.80 | 0.13 | 0.13 | 0.13 | 0.45 | 0.32 | 0.13 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | BDS Temperate | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | + | BES Temperate | 0.80 | 0.35 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | BDS Boreal | 0.80 | 0.30 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | + | BDS Temperate | 0.80 | 0.35 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | C\ :sub:`3` Grass Arctic | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | + | BDS Boreal | 0.80 | 0.35 | 0.00 | 0.55 | 0.80 | 0.17 | 0.17 | 0.17 | 0.55 | 0.38 | 0.17 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | C\ :sub:`3` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | + | C\ :sub:`3` Grass Arctic | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | 0.20 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | C\ :sub:`4` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | + | C\ :sub:`3` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | 0.20 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | Crop 1 | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | - | + | C\ :sub:`4` Grass | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | 0.20 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ - | Crop 2 | - | - | - | - | - | - | - | - | - | - | - | + | Crop | 0.80 | 0.80 | 0.00 | 0.80 | 0.80 | 0.20 | 0.20 | 0.20 | 0.80 | 0.60 | 0.20 | +----------------------------------+---------------------------+---------------------------+---------------------------+-------------------------+--------------------------+------------------------------+------------------------------+--------------------------+------------------------+------------------------------+---------------------------------+ -Leaves (:math:`CC_{{\rm leaf}}` ), stems (:math:`CC_{{\rm stem}}` ), -roots (:math:`CC_{{\rm root}}` ) , and transfer and storage carbon -(:math:`CC_{{\rm ts}}` ); mortality factors for leaves -(:math:`M_{{\rm leaf}}` ), live stems (:math:`M_{{\rm livestem,1}}` ), -dead stems (:math:`M_{{\rm deadstem}}` ), roots -(:math:`M_{{\rm root}}` ), and transfer and storage carbon -(:math:`M_{{\rm ts}}` ) related to the carbon transfers from these pools +Leaves (:math:`CC_{leaf}` ), stems (:math:`CC_{stem}` ), +roots (:math:`CC_{root}` ) , and transfer and storage carbon +(:math:`CC_{ts}` ); mortality factors for leaves +(:math:`M_{leaf}` ), live stems (:math:`M_{livestem,1}` ), +dead stems (:math:`M_{deadstem}` ), roots +(:math:`M_{root}` ), and transfer and storage carbon +(:math:`M_{ts}` ) related to the carbon transfers from these pools to litter pool; mortality factors for live stems -(:math:`M_{{\rm livestem,2}}` ) related to the carbon transfer from live +(:math:`M_{livestem,2}` ) related to the carbon transfer from live stems to dead stems; whole-plant mortality factor (:math:`\xi _{j}` ). -Parameters are calibrated in an unreleased CLM4.5 version driven by Qian -et al. (2006) atmospheric forcing and climatological lightning data. diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 404943dd97..8b9a9df144 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -38,7 +38,7 @@ al. 2008) ` and :math:`\Delta t` is the time step (s). .. _Figure Hydrologic processes: -.. Figure:: image1.png +.. Figure:: hydrologic.processes.png Hydrologic processes represented in CLM. diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index be084381b3..724fd493f8 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1048,6 +1048,12 @@ Li, F., Levis, S., and Ward, D. S. 2013a. Quantifying the role of fire in the Earth system – Part 1: Improved global fire modeling in the Community Earth System Model (CESM1). Biogeosciences 10:2293-2314. +.. _LiLawrence2017: + +Li, F., and Lawrence, D. 2017. Role of fire in the global land water +budget during the 20th century through changing ecosystems. +J. Clim. 30: 1894-1908. + .. _Lietal2013b: Li, H.-Y., Huang, M., Tesfa, T., Ke, Y., Sun, Y., Liu, Y., and Leung, L. From db54a61e329f96e2724d328e4a13ec74bc0cab0f Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 8 Jun 2017 11:22:27 -0600 Subject: [PATCH 0057/1973] update Offline Chapter --- .../tech_note/Offline/CLM50_Tech_Note_Offline.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst index 0419ec668e..f41a24a1d6 100644 --- a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst +++ b/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst @@ -8,14 +8,14 @@ forcing required by CLM (:numref:`Table Atmospheric input to land model`) is supplied by observed datasets. The standard forcing provided with the model is a 110-year (1901-2010) dataset provided by the Global Soil Wetness Project (GSWP3; NEED A REFERENCE). The GSWP3 dataset has a spatial resolution of -0.5\ :math:`{}^o` X 0.5\ :math:`{}^o` and a temporal resolution of three +0.5\ :sup:`o` X 0.5\ :sup:`o` and a temporal resolution of three hours. An alternative forcing dataset is also available, CRUNCEP, a 110-year (1901-2010) dataset (CRUNCEP; :ref:`Viovy 2011 `) that is a combination of two existing datasets; -the CRU TS3.2 0.5\ :math:`{}^o` X 0.5\ :math:`{}^o` monthly data covering the period +the CRU TS3.2 0.5\ :sup:`o` X 0.5\ :sup:`o` monthly data covering the period 1901 to 2002 (:ref:`Mitchell and Jones 2005 `) -and the NCEP reanalysis 2.5\ :math:`{}^o` X 2.5\ :math:`{}^o` +and the NCEP reanalysis 2.5\ :sup:`o` X 2.5\ :sup:`o` 6-hourly data covering the period 1948 to 2010. The CRUNCEP dataset has been used to force CLM for studies of vegetation growth, evapotranspiration, and gross primary production (:ref:`Mao et al. 2012 `, @@ -27,7 +27,7 @@ here (:ref:`Viovy 2011 `). Here, the GSWP3 dataset, which does not include data for particular fields over oceans, lakes, and Antarctica is modified. This missing data is filled with :ref:`Qian et al. (2006) ` data from 1948 that is interpolated by the data atmosphere -model to the 0.5\ :math:`{}^o` GSWP3 grid. This allows the model +model to the 0.5\ :sup:`o` GSWP3 grid. This allows the model to be run over Antarctica and ensures data is available along coastlines regardless of model resolution. @@ -239,13 +239,13 @@ anomalies, respectively: \begin{array}{lr} S^{'} = S + k_{anomaly} & \quad {\rm state \ variable} \\ - F^{'} = f * k_{anomaly} & \quad {\rm flux \ variable} + F^{'} = f \times k_{anomaly} & \quad {\rm flux \ variable} \end{array} where :math:`S^{'}` is the adjusted atmospheric state variable, :math:`S` is the state variable from the high-frequency reference atmospheric forcing dataset, and :math:`k_{anomaly}` is an additive anomaly. -Similarly, math:`F^{'}` is the adjusted atmospheric flux variable, +Similarly, :math:`F^{'}` is the adjusted atmospheric flux variable, :math:`F` is the flux variable from the high-frequency reference atmospheric forcing dataset, and :math:`k_{anomaly}` is a multiplicative anomaly. State variables are temperature :math:`T_{atm}`, From f237ae31a4af2a23c38ff9b00e3d1f995e8c0631 Mon Sep 17 00:00:00 2001 From: djk2120 Date: Thu, 8 Jun 2017 15:09:24 -0400 Subject: [PATCH 0058/1973] PHS update: including flow diagram, numerical implementation, and other edits --- ...CLM50_Tech_Note_Plant_Hydraulic_Stress.rst | 352 ++++++++++++++++-- 1 file changed, 313 insertions(+), 39 deletions(-) diff --git a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst b/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst index d8bad01423..d49d3a04b3 100644 --- a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst +++ b/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst @@ -3,7 +3,14 @@ Plant Hydraulic Stress ====================== -Introductory text... +The Plant Hydraulic Stress (PHS) routine explicitly models water transport through the vegetation according to a simple hydraulic framework following Darcy's Law for porous media flow equations influenced by +:ref:`Bonan et al. (2014) `, +:ref:`Chuang et al. (2006) `, +:ref:`Sperry et al. (1998) `, +:ref:`Sperry and Love (2015) `, +:ref:`Williams et al (1996) `. + +PHS solves for the vegetation water potential that matches water supply with transpiration demand. Water supply is modeled according to the circuit analog in :numref:`Figure Soil Temperature Schematic`. Transpiration demand is modeled relative to maximum transpiration by a transpiration loss function dependent on leaf water potential. .. _Figure Soil Temperature Schematic: @@ -16,18 +23,16 @@ Introductory text... Plant Water Supply ----------------------- -PHS explicitly models water transport through the vegetation according to a simple hydraulic framework following Darcy's Law for porous media flow equations. The supply equations are used to solve for vegetation water potential forced by a given transpiration and the set of layer-by-layer soil water potentials. - +The supply equations are used to solve for vegetation water potential forced by transpiration demand and the set of layer-by-layer soil water potentials. The water supply is discretized into segments: soil-to-root, root-to-stem, and stem-to-leaf. There are typically several (1-49) soil-to-root flows operating in parallel, one per soil layer. There are two stem-to-leaf flows operating in parallel, corresponding to the sunlit and shaded "leaves". -In general the water fluxes (e.g. soil-to-root, root-to-stem, etc) are calculated as: +In general the water fluxes (e.g. soil-to-root, root-to-stem, etc.) are modeled according to Darcy's Law for porous media flow as: .. math:: - :label: 11.1) + :label: 11.101) q = kA\left( \psi_1 - \psi_2 \right) - :math:`q` is the flux of water (mmH\ :sub:`2`\ O) spanning the segment between :math:`\psi_1` and :math:`\psi_2` :math:`k` is the hydraulic conductance (s\ :sup:`-1`\ ) @@ -36,8 +41,11 @@ In general the water fluxes (e.g. soil-to-root, root-to-stem, etc) are calculate :math:`\psi_1 - \psi_2` is the gradient in water potential (mmH\ :sub:`2`\ O) across the segment +The segments in :numref:`Figure Soil Temperature Schematic` have variable resistance, as the water potentials become lower, hydraulic conductance decreases. +This is captured by multiplying the maximum segment conductance by a sigmoidal function capturing the percent loss of conductivity. The function uses two parameters to fit experimental vulnerability curves: the water potential at 50% loss of conductivity (:math:`p50`) and a shape fitting parameter (:math:`c_k`). + .. math:: - :label: 11.2) + :label: 11.102) k=k_{max}\cdot 2^{-\left(\dfrac{\psi_1}{p50}\right)^{c_k}} @@ -47,35 +55,40 @@ In general the water fluxes (e.g. soil-to-root, root-to-stem, etc) are calculate :math:`\psi_1` is the water potential of the lower segment terminus (mmH2O) +.. _Stem-to-leaf: + +Stem-to-leaf +'''''''''''''''''''''''' + The area basis and conductance parameterization varies by segment. There are two stem-to-leaf fluxes in parallel, from stem to sunlit leaf and from stem to shaded leaf (:math:`q_{1a}` and :math:`q_{1a}`). The water flux from stem-to-leaf is the product of the segment conductance, the conducting area basis, and the water potential gradient from stem to leaf. Stem-to-leaf conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve. The maximum conductance is a PFT parameter representing the maximum conductance of water from stem to leaf per unit leaf area. This parameter can be defined separately for sunlit and shaded segments and should already include the appropriate length scaling (in other words this is a conductance, not conductivity). The water potential gradient is the difference between leaf water potential and stem water potential. There is no gravity term, assuming a negligible difference in height across the segment. The area basis is the leaf area index (either sunlit or shaded). .. math:: - :label: 11.3) + :label: 11.103) - q_{1a}=k_{1a}*\mbox{LAI}_{sun}*\left(\psi_{stem}-\psi_{sunleaf} \right) + q_{1a}=k_{1a}\cdot\mbox{LAI}_{sun}\cdot\left(\psi_{stem}-\psi_{sunleaf} \right) .. math:: - :label: 11.4) + :label: 11.104) - q_{1b}=k_{1b}*\mbox{LAI}_{shade}*\left(\psi_{stem}-\psi_{shadeleaf} \right) + q_{1b}=k_{1b}\cdot\mbox{LAI}_{shade}\cdot\left(\psi_{stem}-\psi_{shadeleaf} \right) .. math:: - :label: 11.5) + :label: 11.105) - k_{1a}=k_{1a,max}*2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} + k_{1a}=k_{1a,max}\cdot 2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} .. math:: - :label: 11.6) + :label: 11.106) - k_{1b}=k_{1b,max}*2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} + k_{1b}=k_{1b,max}\cdot 2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} Variables: :math:`q_{1a}` = flux of water (mmH2O/s) from stem to sunlit leaf - +12 :math:`q_{1b}` = flux of water (mmH2O/s) from stem to shaded leaf :math:`LAI_{sun}` = sunlit leaf area index (m2/m2) @@ -98,15 +111,20 @@ Parameters: :math:`c_{k}` = vulnerability curve shape-fitting parameter (-) +.. _Root-to-stem: + +Root-to-stem +'''''''''''''''''''''''' + There is one root-to-stem flux. This represents a flux from the root collar to the upper branch reaches. The water flux from root-to-stem is the product of the segment conductance, the conducting area basis, and the water potential gradient from root to stem. Root-to-stem conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve (two parameters). The maximum conductance is defined as the maximum root-to-stem conductivity per unit stem area (PFT parameter) divided by the length of the conducting path, which is taken to be the vegetation height. The area basis is the stem area index. The gradient in water potential is the difference between the root water potential and the stem water potential less the difference in gravitational potential. .. math:: - :label: 11.7) + :label: 11.107) q_2=k_2 \cdot SAI \cdot \left( \psi_{root} - \psi_{stem} - \Delta \psi_z \right) .. math:: - :label: 11.8) + :label: 11.108) k_2=\dfrac{k_{2,max}}{z_2} \cdot 2^{-\left(\dfrac{\psi_{root}}{p50_2}\right)^{c_k}} @@ -130,6 +148,11 @@ Parameters: :math:`z_2` = vegetation height (m) +.. _Soil-to-root: + +Soil-to-root +'''''''''''''''''''''''' + There are several soil-to-root fluxes operating in parallel (one for each root-containing soil layer). Each represents a flux from the given soil layer to the root collar. The water flux from soil-to-root is the product of the segment conductance, the conducting area basis, and the water potential gradient from soil to root. The area basis is a proxy for root area index, defined as the summed leaf and stem area index multiplied by the root-to-shoot ratio (PFT parameter) multiplied by the layer root fraction. The root fraction comes from an empirical root profile (see section zqz). The gradient in water potential is the difference between the soil water potential and the root water potential less the difference in gravitational potential. There is only one root water potential to which all soil layers are connected in parallel. A soil-to-root flux can be either positive (vegetation water uptake) or negative (water deposition), depending on the relative values of the root and soil water potentials. This allows for the occurrence of hydraulic redistribution where water moves through vegetation tissue from one soil layer to another. @@ -139,37 +162,37 @@ Soil-to-root conductance is the result of two resistances in series, first acros The soil-root interface conductance is defined as the soil conductivity divided by the conducting length from soil to root. The soil conductivity varies by soil layer and is calculated based on soil potential and soil properties, via the Brooks-Corey theory. The conducting length is computed by calculating the characteristic root spacing following Bonan-2014. The root spacing depends on total root biomass and PFT parameters defining root structure (see section zqz). .. math:: - :label: 11.9) + :label: 11.109) q_{3,i}=k_{3,i}*RAI*\left(\psi_{soil,i}-\psi_{root} + \Delta\psi_{z,i} \right) .. math:: - :label: 11.10) + :label: 11.110) RAI=\left(LAI+SAI \right)\cdot r_i \cdot f_{root-leaf} .. math:: - :label: 11.11) + :label: 11.111) k_{3,i}=\dfrac{k_{r,i}*k_{s,i}}{k_{r,i}+k_{s,i}} .. math:: - :label: 11.12) + :label: 11.112) k_{r,i}=\dfrac{k_{3,max}}{z_{3,i}}*2^{-\left(\dfrac{\psi_{soil,i}}{p50_3}\right)^{c_k}} .. math:: - :label: 11.13) + :label: 11.113) k_{s,i} = \dfrac{k_{soil,i}}{dx_{root,i}} .. math:: - :label: 11.14) + :label: 11.114) dx_{root,i} = \left(\pi*\mbox{root-length-density}_i\right)^{-0.5} .. math:: - :label: 11.15) + :label: 11.115) \mbox{root-length-density} = \dfrac{\mbox{total root length}}{\mbox{soil volume}} @@ -206,25 +229,35 @@ Parameters: Plant Water Demand ----------------------- +Plant water demand depends on stomatal conductance, which is described in section :numref:`Stomatal resistance`. +Here we describe the influence of PHS and the coupling of vegetation water demand and supply. +PHS models vegetation water demand as transpiration attenuated by a transpiration loss function based on leaf water potential. +Sunlit leaf transpiration is modeled as the maximum sunlit leaf transpiration multiplied by the percent of maximum transpiration as modeled by the sigmoidal loss function. +The same follows for shaded leaf transpiration. +Maximum stomatal conductance is calculated from the Medlyn model :ref:`(Medlyn et al. 2011) ` absent water stress and used to calculate the maximum transpiration (see section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). +Water stress is calculated as the ratio of attenuated stomatal conductance to maximum stomatal conductance. +Water stress is calculated with distinct values for sunlit and shaded leaves. +Vegetation water stress is calculated based on leaf water potential and is used to attenuate photosynthesis (see section :numref:`Photosynthesis`) + .. math:: - :label: 11.16) + :label: 11.201) - E_{sun} = E_{sun,max}*2^{-\left(\dfrac{\psi_{sunleaf}}{p50_e}\right)^{c_k}} + E_{sun} = E_{sun,max} \cdot 2^{-\left(\dfrac{\psi_{sunleaf}}{p50_e}\right)^{c_k}} .. math:: - :label: 11.17) + :label: 11.202) - E_{shade} = E_{shade,max}*2^{-\left(\dfrac{\psi_{shadeleaf}}{p50_e}\right)^{c_k}} + E_{shade} = E_{shade,max} \cdot 2^{-\left(\dfrac{\psi_{shadeleaf}}{p50_e}\right)^{c_k}} .. math:: - :label: 11.18) + :label: 11.203) - B_{t,sun} = \dfrac{g_{s,sun}}{g_{s,sun,B_t=1}} + \beta_{t,sun} = \dfrac{g_{s,sun}}{g_{s,sun,\beta_t=1}} .. math:: - :label: 11.19) + :label: 11.204) - B_{t,shade} = \dfrac{g_{s,shade}}{g_{s,shade,B_t=1}} + \beta_{t,shade} = \dfrac{g_{s,shade}}{g_{s,shade,\beta_t=1}} :math:`E_{sun}` = sunlit leaf transpiration (mm/s) @@ -238,6 +271,10 @@ Plant Water Demand :math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH2O) +:math:`\beta_{t,sun}` = sunlit transpiration water stress (-) + +:math:`\beta_{t,shade}` = shaded transpiration water stress (-) + :math:`g_{s,sun}` = stomatal conductance of water corresponding to :math:`E_{sun}` :math:`g_{s,shade}` = stomatal conductance of water corresponding to :math:`E_{shade}` @@ -251,15 +288,15 @@ Plant Water Demand Vegetation Water Potential ----------------------------- -PHS explicitly models root, stem, shaded leaf, and sunlit leaf water potential at each timestep. PHS iterates to find the vegetation water potential vector :math:`\psi` that satisfies continuity in the non-linear vegetation water supply and demand equations. +Both plant water supply and demand are functions of vegetation water potential. PHS explicitly models root, stem, shaded leaf, and sunlit leaf water potential at each timestep. PHS iterates to find the vegetation water potential :math:`\psi` (vector) that satisfies continuity between the non-linear vegetation water supply and demand (equations :eq:`11.103)`, :eq:`11.104)`, :eq:`11.107)`, :eq:`11.109)`, :eq:`11.201)`, :eq:`11.202)`). .. math:: - :label: 11.20) + :label: 11.301) \psi=\left[\psi_{sunleaf},\psi_{shadeleaf},\psi_{stem},\psi_{root}\right] .. math:: - :label: 11.21 + :label: 11.302) \begin{aligned} E_{sun}&=q_{1a}\\ @@ -269,15 +306,252 @@ PHS explicitly models root, stem, shaded leaf, and sunlit leaf water potential a &=\sum_{i=1}^{nlevsoi}{q_{3,i}} \end{aligned} -The demand terms (left-hand side) are decreasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, water stress increases, causing a decrease in transpiration demand. The supply terms (right-hand side) are increasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, the gradients in water potential increase, causing an increase in vegetation water supply. PHS takes a Newton's method approach to iteratively solve for the vegetation water potentials that satisfy :eq:`11.21`. +PHS finds the water potentials that match supply and demand. In the plant water transport equations :eq:`11.302)`, the demand terms (left-hand side) are decreasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, water stress increases, causing a decrease in transpiration demand. The supply terms (right-hand side) are increasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, the gradients in water potential increase, causing an increase in vegetation water supply. PHS takes a Newton's method approach to iteratively solve for the vegetation water potentials that satisfy continuity :eq:`11.302)`. + + + +.. _PHS Numerical Implementation: + +Numerical Implementation +-------------------------------- + +The four plant water potential nodes are ( :math:`\psi_{root}`, :math:`\psi_{xylem}`, :math:`\psi_{shadeleaf}`, :math:`\psi_{sunleaf}`). +The fluxes between each pair of nodes are labeled in Figure 1. +:math:`E_{sun}` and :math:`E_{sha}` are the transpiration from sunlit and shaded leaves, respectively. +We use the circuit-analog model to calculate the vegetation water potential ( :math:`\psi`) for the four plant nodes, forced by soil matric potential and unstressed transpiration. +The unstressed transpiration is acquired by running the photosynthesis model with :math:`\beta_t=1`. +The unstressed transpiration flux is attenuated based on the leaf-level vegetation water potential. +Using the attenuated transpiration, we solve for :math:`g_{s,stressed}` and output :math:`\beta_t=\dfrac{g_{s,stressed}}{g_{s,unstressed}}`. + +The continuity of water flow through the system yields four equations + +.. math:: + :label: 11.401) + + \begin{aligned} + E_{sun}&=q_{1a}\\ + E_{shade}&=q_{1b}\\ + q_{1a}+q_{1b}&=q_2\\ + q_2&=\sum_{i=1}^{nlevsoi}{q_{3,i}} + \end{aligned} + + +We seek the set of vegetation water potential values, + +.. math:: + :label: 11.402) + + \psi=\left[ \begin {array}{c} + \psi_{sunleaf}\cr\psi_{shadeleaf}\cr\psi_{stem}\cr\psi_{root} + \end {array} \right] + +that satisfies these equations, as forced by the soil moisture and atmospheric state. +Each flux on the schematic can be represented in terms of the relevant water potentials. Defining the transpiration fluxes: + +.. math:: + :label: 11.403) + + \begin{aligned} + E_{sun} &= E_{sun,max} \cdot 2^{-\left(\dfrac{\psi_{sunleaf}}{p50_e}\right)^{c_k}} \\ + E_{shade} &= E_{shade,max} \cdot 2^{-\left(\dfrac{\psi_{shadeleaf}}{p50_e}\right)^{c_k}} + \end{aligned} + +Defining the water supply fluxes: + +.. math:: + :label: 11.404) + + \begin{aligned} + q_{1a}&=k_{1a,max}\cdot 2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} \cdot\mbox{LAI}_{sun}\cdot\left(\psi_{stem}-\psi_{sunleaf} \right) \\ + q_{1b}&=k_{1b,max}\cdot 2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}}\cdot\mbox{LAI}_{shade}\cdot\left(\psi_{stem}-\psi_{shadeleaf} \right) \\ + q_2&=\dfrac{k_{2,max}}{z_2} \cdot 2^{-\left(\dfrac{\psi_{root}}{p50_2}\right)^{c_k}} \cdot SAI \cdot \left( \psi_{root} - \psi_{stem} - \Delta \psi_z \right) \\ + q_{soil}&=\sum_{i=1}^{nlevsoi}{q_{3,i}}=\sum_{i=1}^{nlevsoi}{k_{3,i}\cdot RAI\cdot\left(\psi_{soil,i}-\psi_{root} + \Delta\psi_{z,i} \right)} + \end{aligned} + +We're looking to find the vector :math:`\psi` +that fits with soil and atmospheric forcings while satisfying water flow continuity. +Due to the model non-linearity, we use a linearized explicit approach, iterating with Newton's method. +The initial guess is the solution for :math:`\psi` (vector) from the previous time step. +The general framework, from iteration `m` to `m+1` is: + +.. math:: + :label: 11.405) + + q^{m+1}=q^m+\dfrac{\delta q}{\delta\psi}\Delta\psi \\ + \psi^{m+1}=\psi^{m}+\Delta\psi + +So for our first flux balance equation, at iteration `m+1`, we have: + +.. math:: + :label: 11.406) + + E_{sun}^{m+1}=q_{1a}^{m+1} + +Which can be linearized to: + +.. math:: + :label: 11.407) + + E_{sun}^{m}+\dfrac{\delta E_{sun}}{\delta\psi}\Delta\psi=q_{1a}^{m}+\dfrac{\delta q_{1a}}{\delta\psi}\Delta\psi + +And rearranged to be: + +.. math:: + :label: 11.408) + + \dfrac{\delta q_{1a}}{\delta\psi}\Delta\psi-\dfrac{\delta E_{sun}}{\delta\psi}\Delta\psi=E_{sun}^{m}-q_{1a}^{m} + +And for the other 3 flux balance equations: + +.. math:: + :label: 11.409) + + \begin{aligned} + \dfrac{\delta q_{1b}}{\delta\psi}\Delta\psi-\dfrac{\delta E_{sha}}{\delta\psi}\Delta\psi&=E_{sha}^{m}-q_{1b}^{m} \\ + \dfrac{\delta q_2}{\delta\psi}\Delta\psi-\dfrac{\delta q_{1a}}{\delta\psi}\Delta\psi-\dfrac{\delta q_{1b}}{\delta\psi}\Delta\psi&=q_{1a}^{m}+q_{1b}^{m}-q_2^{m} \\ + \dfrac{\delta q_{soil}}{\delta\psi}\Delta\psi-\dfrac{\delta q_2}{\delta\psi}\Delta\psi&=q_2^{m}-q_{soil}^{m} + \end{aligned} + +Putting all four together in matrix form: + +.. math:: + :label: 11.410) + + \left[ \begin {array}{c} + \dfrac{\delta q_{1a}}{\delta\psi}-\dfrac{\delta E_{sun}}{\delta\psi} \cr + \dfrac{\delta q_{1b}}{\delta\psi}-\dfrac{\delta E_{sha}}{\delta\psi} \cr + \dfrac{\delta q_2}{\delta\psi}-\dfrac{\delta q_{1a}}{\delta\psi}-\dfrac{\delta q_{1b}}{\delta\psi} \cr + \dfrac{\delta q_{soil}}{\delta\psi}-\dfrac{\delta q_2}{\delta\psi} + \end {array} \right] + \Delta\psi= + \left[ \begin {array}{c} + E_{sun}^{m}-q_{1a}^{m} \cr + E_{sha}^{m}-q_{1b}^{m} \cr + q_{1a}^{m}+q_{1b}^{m}-q_2^{m} \cr + q_2^{m}-q_{soil}^{m} + \end {array} \right] + +Now to expand the left-hand side, from generic :math:`\psi` to all four plant water potential nodes, noting that many derivatives are zero (e.g. :math:`\dfrac{\delta E_{sun}}{\delta\psi_{sha}}=0`) + +Introducing the notation: +:math:`A\Delta\psi=b` + +.. math:: + :label: 11.411) + + \Delta\psi=\left[ \begin {array}{c} + \Delta\psi_{sunleaf} \cr + \Delta\psi_{shadeleaf} \cr + \Delta\psi_{stem} \cr + \Delta\psi_{root} + \end {array} \right] + +.. math:: + :label: 11.412) + + A= + \left[ \begin {array}{cccc} + \dfrac{\delta q_{1a}}{\delta \psi_{sun}}-\dfrac{\delta E_{sun}}{\delta \psi_{sun}}&0&\dfrac{\delta q_{1a}}{\delta \psi_{stem}}&0\cr + 0&\dfrac{\delta q_{1b}}{\delta \psi_{sha}}-\dfrac{\delta E_{sha}}{\delta \psi_{sha}}&\dfrac{\delta q_{1b}}{\delta \psi_{stem}}&0\cr + -\dfrac{\delta q_{1a}}{\delta \psi_{sun}}& + -\dfrac{\delta q_{1b}}{\delta \psi_{sha}}& + \dfrac{\delta q_2}{\delta \psi_{stem}}-\dfrac{\delta q_{1a}}{\delta \psi_{stem}}-\dfrac{\delta q_{1b}}{\delta \psi_{stem}}& + \dfrac{\delta q_2}{\delta \psi_{root}}\cr + 0&0&-\dfrac{\delta q_2}{\delta \psi_{stem}}&\dfrac{\delta q_{soil}}{\delta \psi_{root}}-\dfrac{\delta q_2}{\delta \psi_{root}} + \end {array} \right] + +.. math:: + :label: 11.413) + + b= + \left[ \begin {array}{c} + E_{sun}^{m}-q_{b1}^{m} \cr + E_{sha}^{m}-q_{b2}^{m} \cr + q_{b1}^{m}+q_{b2}^{m}-q_{stem}^{m} \cr + q_{stem}^{m}-q_{soil}^{m} + \end {array} \right] + +Now we compute all the entries for :math:`A` and :math:`b` based on the soil moisture and maximum transpiration forcings and can solve to find: + +.. math:: + :label: 11.414) + + \Delta\psi=A^{-1}b .. math:: - :label: 11.22) + :label: 11.415) + + \psi_{m+1}=\psi_m+\Delta\psi + +We iterate until :math:`b\to 0`, signifying water flux balance through the system. The result is a final set of water potentials ( :math:`\psi_{root}`, :math:`\psi_{xylem}`, :math:`\psi_{shadeleaf}`, :math:`\psi_{sunleaf}`) satisfying non-divergent water flux through the system. +The magnitude of the water flux is driven by soil matric potential and unstressed ( :math:`\beta_t=1`) transpiration. + +We use the transpiration solution (corresponding to the final solution for :math:`\psi`) to compute stomatal conductance. The stomatal conductance is then used to compute :math:`\beta_t`. + +.. math:: + :label: 11.416) + + \beta_{t,sun} = \dfrac{g_{s,sun}}{g_{s,sun,\beta_t=1}} + +.. math:: + :label: 11.417) + + \beta_{t,shade} = \dfrac{g_{s,shade}}{g_{s,shade,\beta_t=1}} + +The :math:`\beta_t` values are used in the Photosynthesis module (see section :numref:`Photosynthesis`) to apply water stress. +The solution for :math:`\psi` is saved as a new variable (vegetation water potential) and is indicative of plant water status. +The soil-to-root fluxes :math:`\left( q_{3,1},q_{3,2},\mbox{...},q_{3,n}\right)` are used as the soil transpiration sink in the Richards' equation subsurface flow equations (see section :numref:`Soil Water`). + +.. _Flow Diagram of Leaf Flux Calculations: + +Flow Diagram of Leaf Flux Calculations: +------------------------------------------- + +PHS runs nested in the loop that solves for sensible and latent heat fluxes and temperature for vegetated surfaces (see section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). +The scheme iterates for convergence of leaf temperature (:math:`T_l`), transpiration water stress (:math:`\beta_t`), and intercellular CO2 concentration (:math:`c_i`). +PHS is forced by maximum transpiration (absent water stress, :math:`\beta_t=1`), whereby we first solve for assimilation, stomatal conductance, and intercellular CO2 with :math:`\beta_{t,sun}` and :math:`\beta_{t,shade}` both set to 1. +This involves iterating to convergence of :math:`c_i` (see section :numref:`Photosynthesis`). + +Next, using the solutions for :math:`E_{sun,max}` and :math:`E_{shade,max}`, PHS solves for :math:`\psi`, :math:`\beta_{t,sun}`, and :math:`\beta_{t,shade}`. +The values for :math:`\beta_{t,sun}`, and :math:`\beta_{t,shade}` are inputs to the photosynthesis routine, which now solves for attenuated photosynthesis and stomatal conductance (reflecting water stress). +Again this involves iterating to convergence of :math:`c_i`. +Non-linearities between :math:`\beta_t` and transpiration require also iterating to convergence of :math:`\beta_t`. +The outermost level of iteration works towards convergence of leaf temperature, reflecting leaf surface energy balance. + +.. _Figure PHS Flow Diagram: + +.. figure:: flow.png + + Flow diagram of leaf flux calculations + + +.. _PHS Refs: + +References +----------------------------- + +Local references. Will copy over + +.. _Bonanetal2014: + +Bonan, G.B., Williams, M., Fisher, R.A., and Oleson, K.W. 2014. Modeling stomatal conductance in the earth system: linking leaf water-use efficiency and water transport along the soil–plant–atmosphere continuum, Geosci. Model Dev., 7, 2193-2222, doi:10.5194/gmd-7-2193-2014. + +.. _Chuangetal2006: + +Chuang Y.L., Oren R., Bertozzi A.L, Phillips N., Katul G.G. 2006. The porous media model for the hydraulic system of a conifer tree: Linking sap flux data to transpiration rate, Ecological Modelling, 191, 447-468, doi:10.1016/j.ecolmodel.2005.03.027. + +.. _Medlynetal2011: - ff +Medlyn, B.E., Duursma, R.A., Eamus, D., Ellsworth, D.S., Prentice, I.C., Barton, C.V.M., Crous, K.Y., De Angelis, P., Freeman, M., and Wingate, L. (2011), Reconciling the optimal and empirical approaches to modelling stomatal conductance. Global Change Biology, 17: 2134–2144. doi:10.1111/j.1365-2486.2010.02375.x +.. _Sperryetal1998: +Sperry, J.S., Adler, F.R., Campbell, G.S. and Comstock, J.P. (1998), Limitation of plant water use by rhizosphere and xylem conductance: results from a model. Plant, Cell & Environment, 21: 347–359. doi:10.1046/j.1365-3040.1998.00287.x +.. _SperryandLove2015: +Sperry, J.S. and Love, D.M. 2015. What plant hydraulics can tell us about responses to climate-change droughts. New Phytol, 207: 14–27. doi:10.1111/nph.13354 +.. _Williamsetal1996: +Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., Wofsy, S.C., Shaver, G.R., Melillo, J.M., Munger, J.W., Fan, S.M. and Nadelhoffer, K.J. 1996. Modelling the soil-plant-atmosphere continuum in a Quercus–Acer stand at Harvard Forest: the regulation of stomatal conductance by light, nitrogen and soil/plant hydraulic properties. Plant, Cell & Environment, 19: 911–927. doi:10.1111/j.1365-3040.1996.tb00456.x \ No newline at end of file From ad6b0e0289c6c06293422d19086f1c222ea2361c Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 9 Jun 2017 08:58:00 -0600 Subject: [PATCH 0059/1973] change chapter names --- .../CLM50_Tech_Note_Land-Only_Mode.rst} | 6 +- .../CLM50_Tech_Note_Plant_Hydraulics.rst} | 146 +++++++++++------- doc/source/tech_note/index.rst | 4 +- 3 files changed, 92 insertions(+), 64 deletions(-) rename doc/source/tech_note/{Offline/CLM50_Tech_Note_Offline.rst => Land-Only_Mode/CLM50_Tech_Note_Land-Only_Mode.rst} (99%) rename doc/source/tech_note/{Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst => Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst} (86%) diff --git a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst b/doc/source/tech_note/Land-Only_Mode/CLM50_Tech_Note_Land-Only_Mode.rst similarity index 99% rename from doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst rename to doc/source/tech_note/Land-Only_Mode/CLM50_Tech_Note_Land-Only_Mode.rst index f41a24a1d6..9fba6f187c 100644 --- a/doc/source/tech_note/Offline/CLM50_Tech_Note_Offline.rst +++ b/doc/source/tech_note/Land-Only_Mode/CLM50_Tech_Note_Land-Only_Mode.rst @@ -1,9 +1,9 @@ -.. _rst_Offline Mode: +.. _rst_Land-only Mode: -Offline Mode +Land-Only Mode ================ -In offline mode (uncoupled to an atmospheric model), the atmospheric +In land-only mode (uncoupled to an atmospheric model), the atmospheric forcing required by CLM (:numref:`Table Atmospheric input to land model`) is supplied by observed datasets. The standard forcing provided with the model is a 110-year (1901-2010) dataset provided by the Global Soil Wetness diff --git a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst similarity index 86% rename from doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst rename to doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index d49d3a04b3..60bfc568ef 100644 --- a/doc/source/tech_note/Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -1,18 +1,34 @@ -.. _rst_Plant Hydraulic Stress: +.. _rst_Plant Hydraulics: -Plant Hydraulic Stress +Plant Hydraulics ====================== -The Plant Hydraulic Stress (PHS) routine explicitly models water transport through the vegetation according to a simple hydraulic framework following Darcy's Law for porous media flow equations influenced by +.. _Rooting Profiles: + +Rooting Profiles +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. _Plant Hydraulic Stress: + +Plant Hydraulic Stress +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The Plant Hydraulic Stress (PHS) routine explicitly models water transport +through the vegetation according to a simple hydraulic framework following +Darcy's Law for porous media flow equations influenced by :ref:`Bonan et al. (2014) `, :ref:`Chuang et al. (2006) `, :ref:`Sperry et al. (1998) `, :ref:`Sperry and Love (2015) `, :ref:`Williams et al (1996) `. -PHS solves for the vegetation water potential that matches water supply with transpiration demand. Water supply is modeled according to the circuit analog in :numref:`Figure Soil Temperature Schematic`. Transpiration demand is modeled relative to maximum transpiration by a transpiration loss function dependent on leaf water potential. +PHS solves for the vegetation water potential that matches water supply with +transpiration demand. Water supply is modeled according to the circuit analog +in :numref:`Figure Plant hydraulic circuit`. Transpiration demand is modeled +relative to maximum transpiration by a transpiration loss function dependent +on leaf water potential. -.. _Figure Soil Temperature Schematic: +.. _Figure Plant hydraulic circuit: .. figure:: circuit.jpg @@ -23,29 +39,41 @@ PHS solves for the vegetation water potential that matches water supply with tra Plant Water Supply ----------------------- -The supply equations are used to solve for vegetation water potential forced by transpiration demand and the set of layer-by-layer soil water potentials. -The water supply is discretized into segments: soil-to-root, root-to-stem, and stem-to-leaf. There are typically several (1-49) soil-to-root flows operating in parallel, one per soil layer. There are two stem-to-leaf flows operating in parallel, corresponding to the sunlit and shaded "leaves". +The supply equations are used to solve for vegetation water potential forced +by transpiration demand and the set of layer-by-layer soil water potentials. +The water supply is discretized into segments: soil-to-root, root-to-stem, and +stem-to-leaf. There are typically several (1-49) soil-to-root flows operating +in parallel, one per soil layer. There are two stem-to-leaf flows operating in +parallel, corresponding to the sunlit and shaded "leaves". -In general the water fluxes (e.g. soil-to-root, root-to-stem, etc.) are modeled according to Darcy's Law for porous media flow as: +In general the water fluxes (e.g. soil-to-root, root-to-stem, etc.) are +modeled according to Darcy's Law for porous media flow as: .. math:: - :label: 11.101) + :label: 11.101 q = kA\left( \psi_1 - \psi_2 \right) -:math:`q` is the flux of water (mmH\ :sub:`2`\ O) spanning the segment between :math:`\psi_1` and :math:`\psi_2` +:math:`q` is the flux of water (mmH\ :sub:`2`\ O) spanning the segment +between :math:`\psi_1` and :math:`\psi_2` :math:`k` is the hydraulic conductance (s\ :sup:`-1`\ ) -:math:`A` is the area basis (m\ :sup:`2`\ /m\ :sup:`2`\ ) relating the conducting area basis to ground area +:math:`A` is the area basis (m\ :sup:`2`\ /m\ :sup:`2`\ ) relating the +conducting area basis to ground area -:math:`\psi_1 - \psi_2` is the gradient in water potential (mmH\ :sub:`2`\ O) across the segment +:math:`\psi_1 - \psi_2` is the gradient in water potential (mmH\ :sub:`2`\ O) +across the segment -The segments in :numref:`Figure Soil Temperature Schematic` have variable resistance, as the water potentials become lower, hydraulic conductance decreases. -This is captured by multiplying the maximum segment conductance by a sigmoidal function capturing the percent loss of conductivity. The function uses two parameters to fit experimental vulnerability curves: the water potential at 50% loss of conductivity (:math:`p50`) and a shape fitting parameter (:math:`c_k`). +The segments in :numref:`Figure Plant hydraulic circuit` have variable resistance, +as the water potentials become lower, hydraulic conductance decreases. This is +captured by multiplying the maximum segment conductance by a sigmoidal function +capturing the percent loss of conductivity. The function uses two parameters to +fit experimental vulnerability curves: the water potential at 50% loss of +conductivity (:math:`p50`) and a shape fitting parameter (:math:`c_k`). .. math:: - :label: 11.102) + :label: 11.102 k=k_{max}\cdot 2^{-\left(\dfrac{\psi_1}{p50}\right)^{c_k}} @@ -66,29 +94,29 @@ The maximum conductance is a PFT parameter representing the maximum conductance This parameter can be defined separately for sunlit and shaded segments and should already include the appropriate length scaling (in other words this is a conductance, not conductivity). The water potential gradient is the difference between leaf water potential and stem water potential. There is no gravity term, assuming a negligible difference in height across the segment. The area basis is the leaf area index (either sunlit or shaded). .. math:: - :label: 11.103) + :label: 11.103 q_{1a}=k_{1a}\cdot\mbox{LAI}_{sun}\cdot\left(\psi_{stem}-\psi_{sunleaf} \right) .. math:: - :label: 11.104) + :label: 11.104 q_{1b}=k_{1b}\cdot\mbox{LAI}_{shade}\cdot\left(\psi_{stem}-\psi_{shadeleaf} \right) .. math:: - :label: 11.105) + :label: 11.105 k_{1a}=k_{1a,max}\cdot 2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} .. math:: - :label: 11.106) + :label: 11.106 k_{1b}=k_{1b,max}\cdot 2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} Variables: :math:`q_{1a}` = flux of water (mmH2O/s) from stem to sunlit leaf -12 + :math:`q_{1b}` = flux of water (mmH2O/s) from stem to shaded leaf :math:`LAI_{sun}` = sunlit leaf area index (m2/m2) @@ -119,12 +147,12 @@ Root-to-stem There is one root-to-stem flux. This represents a flux from the root collar to the upper branch reaches. The water flux from root-to-stem is the product of the segment conductance, the conducting area basis, and the water potential gradient from root to stem. Root-to-stem conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve (two parameters). The maximum conductance is defined as the maximum root-to-stem conductivity per unit stem area (PFT parameter) divided by the length of the conducting path, which is taken to be the vegetation height. The area basis is the stem area index. The gradient in water potential is the difference between the root water potential and the stem water potential less the difference in gravitational potential. .. math:: - :label: 11.107) + :label: 11.107 q_2=k_2 \cdot SAI \cdot \left( \psi_{root} - \psi_{stem} - \Delta \psi_z \right) .. math:: - :label: 11.108) + :label: 11.108 k_2=\dfrac{k_{2,max}}{z_2} \cdot 2^{-\left(\dfrac{\psi_{root}}{p50_2}\right)^{c_k}} @@ -162,37 +190,37 @@ Soil-to-root conductance is the result of two resistances in series, first acros The soil-root interface conductance is defined as the soil conductivity divided by the conducting length from soil to root. The soil conductivity varies by soil layer and is calculated based on soil potential and soil properties, via the Brooks-Corey theory. The conducting length is computed by calculating the characteristic root spacing following Bonan-2014. The root spacing depends on total root biomass and PFT parameters defining root structure (see section zqz). .. math:: - :label: 11.109) + :label: 11.109 - q_{3,i}=k_{3,i}*RAI*\left(\psi_{soil,i}-\psi_{root} + \Delta\psi_{z,i} \right) + q_{3,i}=k_{3,i} \cdot RAI \cdot \left(\psi_{soil,i}-\psi_{root} + \Delta\psi_{z,i} \right) .. math:: - :label: 11.110) + :label: 11.110 - RAI=\left(LAI+SAI \right)\cdot r_i \cdot f_{root-leaf} + RAI=\left(LAI+SAI \right) \cdot r_i \cdot f_{root-leaf} .. math:: - :label: 11.111) + :label: 11.111 - k_{3,i}=\dfrac{k_{r,i}*k_{s,i}}{k_{r,i}+k_{s,i}} + k_{3,i}=\dfrac{k_{r,i} \cdot k_{s,i}}{k_{r,i}+k_{s,i}} .. math:: - :label: 11.112) + :label: 11.112 - k_{r,i}=\dfrac{k_{3,max}}{z_{3,i}}*2^{-\left(\dfrac{\psi_{soil,i}}{p50_3}\right)^{c_k}} + k_{r,i}=\dfrac{k_{3,max}}{z_{3,i}} \cdot 2^{-\left(\dfrac{\psi_{soil,i}}{p50_3}\right)^{c_k}} .. math:: - :label: 11.113) + :label: 11.113 k_{s,i} = \dfrac{k_{soil,i}}{dx_{root,i}} .. math:: - :label: 11.114) + :label: 11.114 dx_{root,i} = \left(\pi*\mbox{root-length-density}_i\right)^{-0.5} .. math:: - :label: 11.115) + :label: 11.115 \mbox{root-length-density} = \dfrac{\mbox{total root length}}{\mbox{soil volume}} @@ -240,22 +268,22 @@ Water stress is calculated with distinct values for sunlit and shaded leaves. Vegetation water stress is calculated based on leaf water potential and is used to attenuate photosynthesis (see section :numref:`Photosynthesis`) .. math:: - :label: 11.201) + :label: 11.201 E_{sun} = E_{sun,max} \cdot 2^{-\left(\dfrac{\psi_{sunleaf}}{p50_e}\right)^{c_k}} .. math:: - :label: 11.202) + :label: 11.202 E_{shade} = E_{shade,max} \cdot 2^{-\left(\dfrac{\psi_{shadeleaf}}{p50_e}\right)^{c_k}} .. math:: - :label: 11.203) + :label: 11.203 \beta_{t,sun} = \dfrac{g_{s,sun}}{g_{s,sun,\beta_t=1}} .. math:: - :label: 11.204) + :label: 11.204 \beta_{t,shade} = \dfrac{g_{s,shade}}{g_{s,shade,\beta_t=1}} @@ -288,15 +316,15 @@ Vegetation water stress is calculated based on leaf water potential and is used Vegetation Water Potential ----------------------------- -Both plant water supply and demand are functions of vegetation water potential. PHS explicitly models root, stem, shaded leaf, and sunlit leaf water potential at each timestep. PHS iterates to find the vegetation water potential :math:`\psi` (vector) that satisfies continuity between the non-linear vegetation water supply and demand (equations :eq:`11.103)`, :eq:`11.104)`, :eq:`11.107)`, :eq:`11.109)`, :eq:`11.201)`, :eq:`11.202)`). +Both plant water supply and demand are functions of vegetation water potential. PHS explicitly models root, stem, shaded leaf, and sunlit leaf water potential at each timestep. PHS iterates to find the vegetation water potential :math:`\psi` (vector) that satisfies continuity between the non-linear vegetation water supply and demand (equations :eq:`11.103`, :eq:`11.104`, :eq:`11.107`, :eq:`11.109`, :eq:`11.201`, :eq:`11.202`). .. math:: - :label: 11.301) + :label: 11.301 \psi=\left[\psi_{sunleaf},\psi_{shadeleaf},\psi_{stem},\psi_{root}\right] .. math:: - :label: 11.302) + :label: 11.302 \begin{aligned} E_{sun}&=q_{1a}\\ @@ -306,7 +334,7 @@ Both plant water supply and demand are functions of vegetation water potential. &=\sum_{i=1}^{nlevsoi}{q_{3,i}} \end{aligned} -PHS finds the water potentials that match supply and demand. In the plant water transport equations :eq:`11.302)`, the demand terms (left-hand side) are decreasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, water stress increases, causing a decrease in transpiration demand. The supply terms (right-hand side) are increasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, the gradients in water potential increase, causing an increase in vegetation water supply. PHS takes a Newton's method approach to iteratively solve for the vegetation water potentials that satisfy continuity :eq:`11.302)`. +PHS finds the water potentials that match supply and demand. In the plant water transport equations :eq:`11.302`, the demand terms (left-hand side) are decreasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, water stress increases, causing a decrease in transpiration demand. The supply terms (right-hand side) are increasing functions of absolute leaf water potential. As absolute leaf water potential becomes larger, the gradients in water potential increase, causing an increase in vegetation water supply. PHS takes a Newton's method approach to iteratively solve for the vegetation water potentials that satisfy continuity :eq:`11.302`. @@ -326,7 +354,7 @@ Using the attenuated transpiration, we solve for :math:`g_{s,stressed}` and outp The continuity of water flow through the system yields four equations .. math:: - :label: 11.401) + :label: 11.401 \begin{aligned} E_{sun}&=q_{1a}\\ @@ -339,7 +367,7 @@ The continuity of water flow through the system yields four equations We seek the set of vegetation water potential values, .. math:: - :label: 11.402) + :label: 11.402 \psi=\left[ \begin {array}{c} \psi_{sunleaf}\cr\psi_{shadeleaf}\cr\psi_{stem}\cr\psi_{root} @@ -349,7 +377,7 @@ that satisfies these equations, as forced by the soil moisture and atmospheric s Each flux on the schematic can be represented in terms of the relevant water potentials. Defining the transpiration fluxes: .. math:: - :label: 11.403) + :label: 11.403 \begin{aligned} E_{sun} &= E_{sun,max} \cdot 2^{-\left(\dfrac{\psi_{sunleaf}}{p50_e}\right)^{c_k}} \\ @@ -359,7 +387,7 @@ Each flux on the schematic can be represented in terms of the relevant water pot Defining the water supply fluxes: .. math:: - :label: 11.404) + :label: 11.404 \begin{aligned} q_{1a}&=k_{1a,max}\cdot 2^{-\left(\dfrac{\psi_{stem}}{p50_1}\right)^{c_k}} \cdot\mbox{LAI}_{sun}\cdot\left(\psi_{stem}-\psi_{sunleaf} \right) \\ @@ -375,7 +403,7 @@ The initial guess is the solution for :math:`\psi` (vector) from the previous ti The general framework, from iteration `m` to `m+1` is: .. math:: - :label: 11.405) + :label: 11.405 q^{m+1}=q^m+\dfrac{\delta q}{\delta\psi}\Delta\psi \\ \psi^{m+1}=\psi^{m}+\Delta\psi @@ -383,28 +411,28 @@ The general framework, from iteration `m` to `m+1` is: So for our first flux balance equation, at iteration `m+1`, we have: .. math:: - :label: 11.406) + :label: 11.406 E_{sun}^{m+1}=q_{1a}^{m+1} Which can be linearized to: .. math:: - :label: 11.407) + :label: 11.407 E_{sun}^{m}+\dfrac{\delta E_{sun}}{\delta\psi}\Delta\psi=q_{1a}^{m}+\dfrac{\delta q_{1a}}{\delta\psi}\Delta\psi And rearranged to be: .. math:: - :label: 11.408) + :label: 11.408 \dfrac{\delta q_{1a}}{\delta\psi}\Delta\psi-\dfrac{\delta E_{sun}}{\delta\psi}\Delta\psi=E_{sun}^{m}-q_{1a}^{m} And for the other 3 flux balance equations: .. math:: - :label: 11.409) + :label: 11.409 \begin{aligned} \dfrac{\delta q_{1b}}{\delta\psi}\Delta\psi-\dfrac{\delta E_{sha}}{\delta\psi}\Delta\psi&=E_{sha}^{m}-q_{1b}^{m} \\ @@ -415,7 +443,7 @@ And for the other 3 flux balance equations: Putting all four together in matrix form: .. math:: - :label: 11.410) + :label: 11.410 \left[ \begin {array}{c} \dfrac{\delta q_{1a}}{\delta\psi}-\dfrac{\delta E_{sun}}{\delta\psi} \cr @@ -437,7 +465,7 @@ Introducing the notation: :math:`A\Delta\psi=b` .. math:: - :label: 11.411) + :label: 11.411 \Delta\psi=\left[ \begin {array}{c} \Delta\psi_{sunleaf} \cr @@ -447,7 +475,7 @@ Introducing the notation: \end {array} \right] .. math:: - :label: 11.412) + :label: 11.412 A= \left[ \begin {array}{cccc} @@ -461,7 +489,7 @@ Introducing the notation: \end {array} \right] .. math:: - :label: 11.413) + :label: 11.413 b= \left[ \begin {array}{c} @@ -474,12 +502,12 @@ Introducing the notation: Now we compute all the entries for :math:`A` and :math:`b` based on the soil moisture and maximum transpiration forcings and can solve to find: .. math:: - :label: 11.414) + :label: 11.414 \Delta\psi=A^{-1}b .. math:: - :label: 11.415) + :label: 11.415 \psi_{m+1}=\psi_m+\Delta\psi @@ -489,12 +517,12 @@ The magnitude of the water flux is driven by soil matric potential and unstresse We use the transpiration solution (corresponding to the final solution for :math:`\psi`) to compute stomatal conductance. The stomatal conductance is then used to compute :math:`\beta_t`. .. math:: - :label: 11.416) + :label: 11.416 \beta_{t,sun} = \dfrac{g_{s,sun}}{g_{s,sun,\beta_t=1}} .. math:: - :label: 11.417) + :label: 11.417 \beta_{t,shade} = \dfrac{g_{s,shade}}{g_{s,shade,\beta_t=1}} @@ -554,4 +582,4 @@ Sperry, J.S. and Love, D.M. 2015. What plant hydraulics can tell us about respon .. _Williamsetal1996: -Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., Wofsy, S.C., Shaver, G.R., Melillo, J.M., Munger, J.W., Fan, S.M. and Nadelhoffer, K.J. 1996. Modelling the soil-plant-atmosphere continuum in a Quercus–Acer stand at Harvard Forest: the regulation of stomatal conductance by light, nitrogen and soil/plant hydraulic properties. Plant, Cell & Environment, 19: 911–927. doi:10.1111/j.1365-3040.1996.tb00456.x \ No newline at end of file +Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., Wofsy, S.C., Shaver, G.R., Melillo, J.M., Munger, J.W., Fan, S.M. and Nadelhoffer, K.J. 1996. Modelling the soil-plant-atmosphere continuum in a Quercus–Acer stand at Harvard Forest: the regulation of stomatal conductance by light, nitrogen and soil/plant hydraulic properties. Plant, Cell & Environment, 19: 911–927. doi:10.1111/j.1365-3040.1996.tb00456.x diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index 74a39e908b..a05aa6210b 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -23,7 +23,7 @@ CLM Technical Note Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst - Plant_Hydraulic_Stress/CLM50_Tech_Note_Plant_Hydraulic_Stress.rst + Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst Lake/CLM50_Tech_Note_Lake.rst Glacier/CLM50_Tech_Note_Glacier.rst RTM/CLM50_Tech_Note_RTM.rst @@ -43,6 +43,6 @@ CLM Technical Note BVOCs/CLM50_Tech_Note_BVOCs.rst Dust/CLM50_Tech_Note_Dust.rst Isotopes/CLM50_Tech_Note_Isotopes.rst - Offline/CLM50_Tech_Note_Offline.rst + Land-Only_Mode/CLM50_Tech_Note_Land-Only_Mode.rst References/CLM50_Tech_Note_References.rst From 92a6e84f18a271ad58fcbb5f44d1212cccf18df5 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 9 Jun 2017 09:37:02 -0600 Subject: [PATCH 0060/1973] Update Photosynthetic Capacity --- ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 380 ++++++++++++------ 1 file changed, 256 insertions(+), 124 deletions(-) mode change 100644 => 100755 doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst diff --git a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst old mode 100644 new mode 100755 index 803964c6df..0f24520566 --- a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst +++ b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst @@ -1,124 +1,256 @@ -.. _rst_Photosynthetic Capacity: - -Photosynthetic Capacity -======================= - -.. _V\ :sub:`cmax25` and Canopy scaling: - -V\ :sub:`cmax25` and Canopy scaling --------------------------------------------- - -The maximum rate of carboxylation at 25 :sup:`o`\ C varies with -foliage nitrogen concentration and specific leaf area and is calculated -as in Thornton and Zimmermann (2007). At 25ºC, - -.. math:: - :label: ZEqnNum217783 - - V_{c\max 25} =N_{a} F_{LNR} F_{NR} a_{R25} - -where :math:`N_{a}` is the area-based leaf nitrogen concentration (g N -m\ :sup:`-2` leaf area), :math:`F_{LNR}` is the fraction of leaf -nitrogen in Rubisco (g N in Rubisco g\ :sup:`-1` N), -:math:`F_{NR} =7.16` is the mass ratio of total Rubisco molecular mass -to nitrogen in Rubisco (g Rubisco g\ :sup:`-1` N in Rubisco), and -:math:`a_{R25} =60` is the specific activity of Rubisco (µmol -CO\ :sub:`2` g\ :sup:`-1` Rubisco s\ :sup:`-1`). -:math:`N_{a}` is calculated from mass-based leaf N concentration and -specific leaf area - -.. math:: - :label: ZEqnNum561340 - - N_{a} =\frac{1}{CN_{L} \; SLA_{0} } - -where :math:`CN_{L}` is the leaf carbon-to-nitrogen ratio (g C -g\ :sup:`-1` N) and :math:`SLA_{0}` is specific leaf area at the -canopy top ( m\ :sup:`2` leaf area g\ :sup:`-1` C ). Table 8.1 -lists values of :math:`F_{LNR}` , :math:`CN_{L}` , and :math:`SLA_{0}` -for each plant functional type. :math:`F_{LNR}` was chosen to give -:math:`V_{c\max 25}` consistent with Kattge et al. (2009), as discussed -by Bonan et al. (2011, 2012). Table 8.1 lists derived values for -:math:`V_{c\max 25}` at the top of the canopy using :math:`SLA_{0}` . -Tropical broadleaf evergreen trees are an exception, and a higher -:math:`V_{c\max 25}` is used to alleviate model biases (Bonan et al. -2012). - -:math:`V_{c\max 25}` is calculated separately for sunlit and shaded -leaves using an exponential profile to area-based leaf nitrogen -(:math:`N_{a}` ), as in Bonan et al. (2011). :math:`V_{c\max 25}` at -cumulative leaf area index :math:`x` from the canopy top scales directly -with :math:`N_{a}` , which decreases exponentially with greater -cumulative leaf area, so that - -.. math:: - :label: ZEqnNum745439 - - V_{c\; \max 25}^{} \left(x\right)=V_{c\; \max 25}^{} \left(0\right)e^{-K_{n} x} - -where :math:`V_{c\; \max 25}^{} \left(0\right)` is defined at the top of -the canopy using :math:`SLA_{0}` , and :math:`K_{n}` is the decay -coefficient for nitrogen. The canopy integrated value for sunlit and -shaded leaves is - -.. math:: - :label: 9.20) - - \begin{array}{rcl} {V_{c\; \max 25}^{sun} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)f_{sun} \left(x\right)\, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} } \end{array} - -.. math:: - :label: 9.21) - - \begin{array}{rcl} {V_{c\; \max 25}^{sha} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)\left[1-f_{sun} \left(x\right)\right] \, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left\{\left[1-e^{-K_{n} L} \right]\frac{1}{K_{n} } -\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} \right\}} \end{array} - -and the average value for the sunlit and shaded leaves is - -.. math:: - :label: 9.22) - - \bar{V}_{c\; \max 25}^{sun} ={V_{c\; \max 25}^{sun} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sun} L^{sun} }} \right. \kern-\nulldelimiterspace} L^{sun} } - -.. math:: - :label: 9.23) - - \bar{V}_{c\; \max 25}^{sha} ={V_{c\; \max 25}^{sha} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sha} L^{sha} }} \right. \kern-\nulldelimiterspace} L^{sha} } . - -This integration is over all leaf area (:math:`L`) with -:math:`f_{sun} (x)=\exp \left(-Kx\right)` and :math:`K` the direct beam -extinction coefficient (equation 4.9). Photosynthetic parameters -:math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}` , and -:math:`R_{d25}` scale similarly. - -The value :math:`K_{n} = 0.11` chosen by Bonan et al. (2011) is -consistent with observationally-derived estimates for forests, mostly -tropical, and provides a gradient in V\ :sub:`cmax` similar to -the original CLM4 specific leaf area scaling. However, Bonan et al. -(2012) showed that the sunlit/shaded canopy parameterization does not -match an explicit multi-layer canopy parameterization. The discrepancy -arises from absorption of scattered radiation by shaded leaves and can -be tuned out with higher :math:`K_{n}` . The model uses -:math:`K_{n} =0.30` to match an explicit multi-layer canopy. - -:math:`V_{c\max 25}` additionally varies with daylength (:math:`DYL`) -using the function :math:`f(DYL)`, which introduces seasonal variation -to :math:`V_{c\max }` - -.. math:: - :label: 9.24) - - f\left(DYL\right)=\frac{\left(DYL\right)^{2} }{\left(DYL_{\max } \right)^{2} } - -with :math:`0.01\le f\left(DYL\right)\le 1`. Daylength (seconds) is -given by - -.. math:: - :label: 9.25) - - DYL=2\times 13750.9871\cos ^{-1} \left[\frac{-\sin \left(lat\right)\sin \left(decl\right)}{\cos \left(lat\right)\cos \left(decl\right)} \right] - -where :math:`lat` (latitude) and :math:`decl` (declination angle) are -from section 3.3. Maximum daylength (:math:`DYL_{\max }` ) is calculated -similarly but using the maximum declination angle for present-day -orbital geometry (:math:`\pm`\ 23.4667º [:math:`\pm`\ 0.409571 radians], -positive for Northern Hemisphere latitudes and negative for Southern -Hemisphere). +.. _rst_Photosynthetic Capacity: + +Photosynthetic Capacity +======================= + +The photosynthetic capacity is represented by two key parameters: 1) the maximum rate of carboxylation at +25 :sup:`o`\ C, :math:`V_{\text{c,max25}}`; and 2) the maximum rate of electron transport at +25 :sup:`o`\ C, :math:`J_{\text{max25}}` . They are predicted by a mechanistic model of leaf +utilization of nitrogen for assimilation (LUNA V1.0) (Ali et al. 2016) based on an optimality hypothesis to nitrogen allocation +among light capture, electron transport, carboxylation, respiration and storage. +Specifically, the model allocates the nitrogen by maximizing the daily +net photosynthetic carbon gain under following two key assumptions: + +- nitrogen allocated for light capture, electron transport and carboxylation are co-limiting; +- respiratory nitrogen is allocated to maintain dark respiration determined by :math:`V_{\text{c,max}}`. + +Compared to traditional photosynthetic capacity models, a key advantage of LUNA is that the model is able to predict the potential +acclimation of photosynthetic capacities at different environmental conditions as determined by temperature, radiation, +CO :sub:`2` concentrations, day length, and humidity. + +.. _Model inputs and parameter estimations: + +Model inputs and parameter estimations +------------------------------------------------------- +The LUNA model includes the following four unitless parameters: + +- :math:`J_{maxb0}` , which specifies the baseline proportion of nitrogen allocated for electron transport; +- :math:`J_{maxb1}` , which determines response of electron transport rate to light availability; +- :math:`t_{c,j0}` , which defines the baseline ratio of Rubisco-limited rate to light-limited rate; +- :math:`H` , which determines the response of electron transport rate to relative humidity. + +The above four parameters are estimated by fitting the LUNA model to a global compilation of >800 obervations +located at different biomes, canopy locations, and time of the year from 1993-2013 (Ali et al 2015). The model inputs +are area-based leaf nitrogen content, leaf mass per unit leaf area and the driving environmental conditions (average of past 10 days) +including temperature, CO :sub:`2` concentrations, daily mean and maximum radiation, relative humidity and day length. +The estimated values in CLM5 for the listed parameters are 0.0311, 0.1745, 0.8054, and 6.0999, repectively. In LUNA V1.0, the estimated +parameter values are for C3 natural vegetations. In view that potentially large differences in photosythetic capacity could exist +between crops and natural vegetations due to human selection and genetic modifications, in CLM5, +the LUNA model are used only for C3 natural vegetations. The photosynthetic capacity for crops and C4 plants are thus +still kept the same as CLM4.5. Namely, it is estimated based on the leaf nitrogen content, fixed RUBISCO allocations for +:math:`V_{c\max 25}` and an adjusting factor to account for the impact of day length. In CLM5, the model simulates both sun-lit and shaded leaves; +however, because the sun-lit and shaded leaves can changes through the day based on the sun angles, +we do not differentiate the photosynthetic capacity difference for sun-lit or shaded leaves. + + +.. _Model structure: + +Model structure +---------------------------------------------------------- + +The structure of the LUNA model is adapted from Xu et al.(2012), where the plant nitrogen at the leaf level ( :math:`\text{LNC}_{a}`; gN/ m :sup:`2` leaf) is divided into +four pools: structural nitrogen( :math:`N_{\text{str}}`; gN/m :sup:`2` leaf), +photosynthetic nitrogen ( :math:`N_{\text{psn}}`; gN/ m:sup:`2` leaf), +storage nitrogen( :math:`N_{\text{store}}`; gN/m :sup:`2` leaf), +and respiratory nitrogen ( :math:`N_{\text{resp}}`; gN/m :sup:`2` leaf). +Namely, + +.. math:: + :label: 10.1) + + \text{LNC}_{a} = N_{\text{psn}} + N_{\text{str}}+ N_{\text{store}} + N_{\text{resp}}. + +The photosynthetic nitrogen, :math:`N_{\text{psn}}`, is further divided into +nitrogen for light capture ( :math:`N_{\text{lc}}`; gN/m :sup:`2` leaf), +nitrogen for electron transport ( :math:`N_{\text{et}}`; gN/m :sup:`2` leaf), +and nitrogen for carboxylation ( :math:`N_{\text{cb}}`; gN/m :sup:`2` leaf). +Namely, + +.. math:: + :label: 10.2) + + N_{\text{psn}} =N_{\text{et}} + N_{\text{cb}} + N_{\text{lc}}. + +The structural nitrogen, :math:`N_{\text{str}}`, is calculated as the +multiplication of leaf mass per unit area (LMA: g biomass/m :sup:`2` leaf), and the structural nitrogen content (SNC; gN/g biomass). Namely, + +.. math:: + :label: 10.3) + + N_{\text{str}} = \text{SNC} \cdot \text{LMA} + +where SNC is set to be fixed at 0.002 (gN/g biomass), based on data on C:N ratio from dead wood (White etal.,2000). + +We assume that plants optimize their nitrogen allocations (i.e., :math:`N_{\text{store}}`, :math:`N_{\text{resp}}`, :math:`N_{\text{lc}}`, :math:`N_{\text{et}}`, :math:`N_{\text{cb}}`) to maximize the photosynthetic carbon gain, defined as +the gross photosynthesis ( :math:`A` ) minus the maintenance respiration for +photosynthetic enzymes ( :math:`R_{\text{psn}}` ), under specific +environmental conditions and given plant's strategy of leaf nitrogen +use. Namely, the solutions of nitrogen allocations \{ :math:`N_{\text{store}}`, :math:`N_{\text{resp}}`, :math:`N_{\text{lc}}`, :math:`N_{\text{et}}`, :math:`N_{\text{cb}}` \} can be estimated as follows, + +.. math:: + :label: 10.4) + + \left\{\hat{N}_{\text{{store}}}, \hat{N}_{\text{{resp}}}, + \hat{\mathrm{N}}_{\text{lc}}, \hat{N}_{\text{et}}, \hat{\mathrm{N}}_{\text{cb}} + \right\} = \underset{\mathrm{N}_{\text{store}}\,+\,\mathrm{N}_{\text{resp}}\,+\,\mathrm{N}_{\text{lc}}\,+\,\mathrm{N}_{\text{et}}\,+\,\mathrm{N}_{\text{cb}}\,<\text{FNC}_{\mathrm{a}}}{\text{argmax}} (A-R_{\text{psn}}), + +where :math:`\text{FNC}_{a}` is the functional nitrogen content defined as the total leaf nitrogen content ( :math:`\text{LNC}_{a}`) minus the structural nitrogen content ( :math:`N_{\text{str}}` ). + +The gross photosynthesis, :math:`A`, was calculated with a coupled leaf gas exchange model based on the Farquhar et al. (1980) model of +photosynthesis and Ball--Berry-type stomatal conductance model (Ball et al., 1987). The maintenance respiration for photosynthetic enzymes, :math:`R_{\text{psn}}`, is +calculated by the multiplication of total photosynthetic nitrogen ( :math:`N_{\text{psn}}` ) and the maintenance respiration cost for photosynthetic enzymes. + +In the LUNA model, the maximum electron transport rate +( :math:`J_{\text{max}}`; :math:`{\mu} mol` electron / m :sup:`-2`/s) +is simulated to have a baseline allocation of nitrogen and additional +nitrogen allocation to change depending on the average daytime +photosynthetic active radiation (PAR; :math:`{\mu} mol` electron / m :sup:`-2`/s), day length (hours) and air humidity. +Specifically, the LUNA model has + +.. math:: + :label: 10.5) + + J_{\text{{max}}} = J_{\text{max}0} + J_{\text{max}b1} + f\left(\text{day length} \right)f\left(\text{humidity} + \right)\alpha \text{PAR} + +The baseline electron transport rate, :math:`J_{\text{max}0}`, is calculated as follows, + +.. math:: + :label: 10.6) + + J_{\text{max}0} = J_{\text{max}b0}{\text{FNC}}_{\mathrm{a}}{\text{NUE}}_{J_{\text{{max}}}} + + +where :math:`J_{\text{max}b0}` (unitless) is the baseline proportion of nitrogen +allocated for electron transport rate. :math:`{\text{NUE}}_{J_{\text{{max}}}}` ( :math:`{\mu} mol` electron /s/g N) +is the nitrogen use efficiency of :math:`J_{\text{{max}}}`. :math:`J_{\text{max}b1}` (unitless) is a coefficient determining the response of the electron +transport rate to amount of absorbed light (i.e., :math:`\alpha \text{PAR}`). +:math:`f\left(\text{day length} \right)` is a function specifies the impact of day +length (hours) on :math:`J_{\text{max}}` in view that longer day length has been demonstrated by previous studies to alter :math:`V_{\mathrm{c}\text{max}25}` and +:math:`J_{\text{max}25}` (Bauerle et al., 2012; Comstock and Ehleringer, 1986) through photoperiod sensing and regulation (e.g. Song et al., 2013). +Following Bauerle et al. (2012), :math:`f\left(\text{day length} \right)` is simulated as follows, + +.. math:: + :label: 10.7) + + f\left(\text{day length} \right) = \left(\frac{\text{day length}}{12} \right)^{2}. + +:math:`f\left(\text{humidity} \right)` represents the impact of air humitidy on +:math:`J_{\text{{max}}}`. We assume that higher humidity leads to higher +:math:`J_{\text{{max}}}` with less water limiation on stomta opening and that low +relative humidity has a stronger impact on nitrogen allocation due to greater +water limitation. When relative humidity (RH; unitless) is too low, we assume +that plants are physiologically unable to reallocate nitrogen. We therefore +assume that there exists a critical value of relative humidity ( :math:`RH_{0} = +0.25`; unitless), below which there is no optimal nitrogen allocation. Based +on the above assumptions, we have + +.. math:: + :label: 10.8) + + f\left(\text{humidity} + \right) = \left(1-\mathrm{e}^{\left(-H + \frac{\text{max}\left(\text{RH}-{\text{RH}}_{0}, 0 \right)}{1-\text{RH}_{0}} \right)} \right), + + +where :math:`H` (unitless) specifies the impact of relative humidity on electron transport rate. + +The efficiency of light energy absorption (unitless), :math:`\alpha`, is calculated +depending on the amount of nitrogen allocated for light capture, +:math:`\mathrm{N}_{\text{lc}}`. Following Niinemets and Tenhunen (1997), the LUNA model has, + +.. math:: + :label: 10.9) + + \alpha =\frac{0.292}{1+\frac{0.076}{\mathrm{N}_{\text{lc}}C_{b}}} + + +where 0.292 is the conversion factor from photon to electron. :math:`C_{b}` +is the conversion factor (1.78) from nitrogen to chlorophyll. After we +estimate :math:`J_{\text{{max}}}`, the actual electron transport rate with +the daily maximum radiation ( :math:`J_{x}`) can be calculated using the +empirical expression of leaf (1937), + +.. math:: + :label: 10.10) + + J_{x} = \frac{\alpha \text{PAR}_{\text{max}}} {\left(1 + \frac{\alpha^{2}{\text{PAR}}_{\text{{max}}}^{2}}{J_{\text{{max}}}^{2}} + \right)^{0.5}} + + +where :math:`\text{PAR}_{\text{{max}}}` ( :math:`\mu mol`/m :sup:`2`/s) is the +maximum photosynthetically active radiation during the day. + + +Based on Farquhar et al. (1980) and Wullschleger (1993), we can calculate the +electron-limited photosynthetic rate under daily maximum radiation ( :math:`W_{jx}`) +and the Rubisco-limited photosynthetic rate ( :math:`W_{\mathrm{c}}`) as follows, + + +.. math:: + :label: 10.11) + + W_{J_{x}} = K_{j}J_{x} , + +.. math:: + :label: 10.12) + + W_{\mathrm{c}} = K_{\mathrm{c}} V_{{\mathrm{c}, \text{max}}}, + + +where :math:`K_{j}` and :math:`K_{\mathrm{c}}` as the conversion factors for +:math:`J_{x}` and :math:`V_{{\mathrm{c}, \text{max}}}` ( :math:`V_{{\mathrm{c}, \text{max}}}` to +:math:`W_{\mathrm{c}}` and :math:`J_{x}` to :math:`W_{J_{x}}`), respectively. Based on +Xu et al. (2012), Maire et al. (2012) and Walker et al. (2014), we +assume that :math:`W_{\mathrm{c}}` is proportional to +:math:`W_{J_{x}}`. Specifically, we have + +.. math:: + :label: 10.13) + + W_{\mathrm{c}}=t_{\alpha}t_{\mathrm{c}, j0}W_{J_{x}} + + +where :math:`t_{\mathrm{c}, j0}` is the baseline ratio of :math:`W_{\mathrm{c}}` to +:math:`W_{J_{x}}`. We recognize that this ratio may change depending on the +nitrogen use efficiency of carboxylation and electron transport (Ainsworth and Rogers, 2007), +therefore the LUNA model has the modification factor, :math:`t_{\alpha}`, to adjust baseline +the ratio depending on the nitrogen use efficiency for electron vs carboxylation (Ali et al 2016). + +Following Collatz et al.(1991a), the total respiration ( :math:`R_{\mathrm{t}}`) is +calculated in proportion to :math:`V_{\text{c,max}}`, + +.. math:: + :label: 10.14) + + R_{\mathrm{t}} = 0.015 V_{\text{c,max}}. + + +Accounting for the daytime and nighttime temperature, the daily respirations is calculated as follows, + + +.. math:: + :label: 10.15) + + + R_{\text{td}}={R}_{\mathrm{t}} [D_{\text{day}} + D_{\text{night}} f_{\mathrm{r}}{(T_{\text{night}})/f_{\mathrm{r}}{(T_{\text{day}})}}], + + +where :math:`D_{\text{day}}` and :math:`D_{\text{night}}` are daytime and +nighttime durations in seconds. :math:`f_{\mathrm{r}}(T_{\text{night}})` and +:math:`f_{\mathrm{r}}(T_{\text{day}})` are the temperature response functions for +respiration [see Appendix B in Ali et al (2016) for details ]. + + +.. _Numerical scheme: + +Numerical scheme +--------------------------------------------------------- + +The LUNA model searches for the "optimal" nitrogen allocations for maximum net photosynthetic carbon gain +by incrementally increase the nitrogen allocated for light capture (i.e., :math:`N_{\text{lc}}`) (see Ali et al 2016 for details) . +We assume that plants only optimize the nitrogen allocation when they can grow (i.e., GPP>0.0). +If GPP become zero under stress, then the LUNA model assume a certain amount of enzyme will decay at daily rates of 0.1, +in view that the half-life time for photosynthetic enzymes are short (~7 days) (Suzuki et al. 2001). +To avoid unrealistic low values of photosynthetic capacity, the decay is only limited to 50 percent of the original enzyme levels. \ No newline at end of file From 11fd281ef02e33f454588105da8812db342b92c5 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 9 Jun 2017 11:00:43 -0600 Subject: [PATCH 0061/1973] Move root profile --- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 4 +- .../CLM50_Tech_Note_Introduction.rst | 6 +- .../CLM50_Tech_Note_Photosynthesis.rst | 71 ------ .../CLM50_Tech_Note_Plant_Hydraulics.rst | 214 ++++++++++++++++-- .../References/CLM50_Tech_Note_References.rst | 5 + 5 files changed, 200 insertions(+), 100 deletions(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index e8b78225dc..d5f9b85560 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -404,8 +404,8 @@ Atmospheric Coupling The current state of the atmosphere (:numref:`Table Atmospheric input to land model`) at a given time step is used to force the land model. This atmospheric state is provided by an -atmospheric model in coupled mode or from an observed dataset in offline -mode (Chapter :numref:`rst_Offline Mode`). The land model then initiates a full set of +atmospheric model in coupled mode or from an observed dataset in land-only +mode (Chapter :numref:`rst_Land-Only Mode`). The land model then initiates a full set of calculations for surface energy, constituent, momentum, and radiative fluxes. The land model calculations are implemented in two steps. The land model proceeds with the calculation of surface energy, constituent, diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 48452d358f..ed7a66f332 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -485,11 +485,11 @@ canyon model to contrast rural and urban energy balance and climate Other modifications of note include refinement of the global PFT, wetland, and lake distributions, more realistic optical properties for grasslands and croplands, and an improved diurnal cycle and spectral -distribution of incoming solar radiation to force the model in offline +distribution of incoming solar radiation to force the model in land-only mode. Many of the ideas incorporated into the carbon and nitrogen cycle -component of CLM4 derive from the earlier development of the offline +component of CLM4 derive from the earlier development of the land-only ecosystem process model Biome-BGC (Biome BioGeochemical Cycles), originating at the Numerical Terradynamic Simulation Group (NTSG) at the University of Montana, under the guidance of Prof. Steven Running. @@ -601,7 +601,7 @@ CLM4 to create CLM4 surface datasets is replaced with newer and higher resolution input datasets where possible (see section :numref:`Surface Data` for details). The default meteorological forcing dataset provided with CLM4 (:ref:`Qian et al. 2006)` is replaced with the 1901-2010 -CRUNCEP forcing dataset (see Chapter :numref:`rst_Offline Mode`) for CLM4.5, +CRUNCEP forcing dataset (see Chapter :numref:`rst_Land-Only Mode`) for CLM4.5, though users can also still use the :ref:`Qian et al. (2006)` dataset or other alternative forcing datasets. diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index 70fa76baf7..d50b90a814 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -552,77 +552,6 @@ water contents (kg m\ :sup:`-2`) (Chapter 7), densities of ice and liquid water (kg m\ :sup:`-3`) (Table 2.6), and :math:`\Delta z_{i}` is the soil layer thickness (m) (section 6.1). -The root fraction :math:`r_{i}` in each soil layer depends on the plant -functional type - -.. math:: - :label: 9.30) - - r_{i} =\left\{\begin{array}{l} {0.5\left[\begin{array}{l} {\exp \left(-r_{a} z_{h,\, i-1} \right)+\exp \left(-r_{b} z_{h,\, i-1} \right)-} \\ {\exp \left(-r_{a} z_{h,\, i} \right)-\exp \left(-r_{b} z_{h,\, i} \right)} \end{array}\right]\qquad {\rm for\; }1\le i` -(:numref:`Table Plant functional type root distribution parameters`). - -.. _Table Plant functional type root distribution parameters: - -.. table:: Plant functional type root distribution parameters - - +----------------------------------+------------------+------------------+ - | Plant Functional Type | :math:`r_{a}` | :math:`r_{b}` | - +==================================+==================+==================+ - | NET Temperate | 7.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | NET Boreal | 7.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | NDT Boreal | 7.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | BET Tropical | 7.0 | 1.0 | - +----------------------------------+------------------+------------------+ - | BET temperate | 7.0 | 1.0 | - +----------------------------------+------------------+------------------+ - | BDT tropical | 6.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | BDT temperate | 6.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | BDT boreal | 6.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | BES temperate | 7.0 | 1.5 | - +----------------------------------+------------------+------------------+ - | BDS temperate | 7.0 | 1.5 | - +----------------------------------+------------------+------------------+ - | BDS boreal | 7.0 | 1.5 | - +----------------------------------+------------------+------------------+ - | C\ :sub:`3` grass arctic | 11.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | C\ :sub:`3` grass | 11.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | C\ :sub:`4` grass | 11.0 | 2.0 | - +----------------------------------+------------------+------------------+ - | Crop R | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Crop I | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Corn R | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Corn I | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Temp Cereal R | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Temp Cereal I | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Winter Cereal R | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Winter Cereal I | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Soybean R | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - | Soybean I | 6.0 | 3.0 | - +----------------------------------+------------------+------------------+ - .. _Numerical implementation photosynthesis: Numerical implementation diff --git a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index 60bfc568ef..703f9b8ed9 100644 --- a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -3,11 +3,140 @@ Plant Hydraulics ====================== -.. _Rooting Profiles: +.. _Roots: -Rooting Profiles +Roots ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. _Vertical Root Distribution: + +Vertical Root Distribution +--------------------------- + +The root fraction :math:`r_{i}` in each soil layer depends on the plant +functional type + +.. math:: + :label: 11.1 + + r_{i} = + \begin{array}{lr} + \left(\beta^{z_{h,\, i-1} \cdot 100} - \beta^{z_{h,\, i} \cdot 100} \right) & \qquad {\rm for\; }1 \le i \le N_{levsoi} + \end{array} + +where :math:`z_{h,\, i}` (m) is the depth from the soil surface to the +interface between layers :math:`i` and :math:`i+1` (:math:`z_{h,\, 0}` , +the soil surface) (section :numref:`Vertical Discretization`), the factor of 100 +converts from m to cm, and :math:`\beta` is a plant-dependent root +distribution parameter adopted from :ref:`Jackson et al. (1996)` +(:numref:`Table Plant functional type root distribution parameters`). + +.. rootfr(p,lev) = ( & + beta ** (col%zi(c,lev-1)*m_to_cm) - & + beta ** (col%zi(c,lev)*m_to_cm) ) + +.. 0, 0.976, 0.943, 0.943, 0.993, 0.966, 0.993, 0.966, 0.943, 0.964, 0.964, + 0.914, 0.914, 0.943, 0.943, 0.943, 0.943, 0.943, 0.943, 0.943, 0.943, + +.. _Table Plant functional type root distribution parameters: + +.. table:: Plant functional type root distribution parameters + + +----------------------------------+------------------+ + | Plant Functional Type | :math:`\beta` | + +==================================+==================+ + | NET Temperate | 0.976 | + +----------------------------------+------------------+ + | NET Boreal | 0.943 | + +----------------------------------+------------------+ + | NDT Boreal | 0.943 | + +----------------------------------+------------------+ + | BET Tropical | 0.993 | + +----------------------------------+------------------+ + | BET temperate | 0.966 | + +----------------------------------+------------------+ + | BDT tropical | 0.993 | + +----------------------------------+------------------+ + | BDT temperate | 0.966 | + +----------------------------------+------------------+ + | BDT boreal | 0.943 | + +----------------------------------+------------------+ + | BES temperate | 0.964 | + +----------------------------------+------------------+ + | BDS temperate | 0.964 | + +----------------------------------+------------------+ + | BDS boreal | 0.914 | + +----------------------------------+------------------+ + | C\ :sub:`3` grass arctic | 0.914 | + +----------------------------------+------------------+ + | C\ :sub:`3` grass | 0.943 | + +----------------------------------+------------------+ + | C\ :sub:`4` grass | 0.943 | + +----------------------------------+------------------+ + | Crop R | 0.943 | + +----------------------------------+------------------+ + | Crop I | 0.943 | + +----------------------------------+------------------+ + | Corn R | 0.943 | + +----------------------------------+------------------+ + | Corn I | 0.943 | + +----------------------------------+------------------+ + | Temp Cereal R | 0.943 | + +----------------------------------+------------------+ + | Temp Cereal I | 0.943 | + +----------------------------------+------------------+ + | Winter Cereal R | 0.943 | + +----------------------------------+------------------+ + | Winter Cereal I | 0.943 | + +----------------------------------+------------------+ + | Soybean R | 0.943 | + +----------------------------------+------------------+ + | Soybean I | 0.943 | + +----------------------------------+------------------+ + +.. _Root Spacing: + +Root Spacing +----------------------------- + +To determine the conductance along the soil to root pathway (section +:numref:`Soil-to-root`) an estimate of the spacing between the roots within +a soil layer is required. The distance between roots :math:`dx_{root,i}` (m) +is calculated by assuming that roots are distributed uniformly throughout +the soil (:ref:`Gardner 1960`) + +.. math:: + :label: 11.12 + + dx_{root,i} = \left(\pi \cdot L_i\right)^{\frac{1}{2}} + +where :math:`L_{i}` is the root length density (m m :sup:`-3`) + +.. math:: + :label: 11.13 + + L_{i} = \frac{B_{root,i}}{\rho_{root} {CA}_{root}} \ , + +:math:`B_{root,i}` is the root biomass density (kg m :sup:`-3`) + +.. math:: + :label: 11.14 + + B_{root,i} = \frac{c\_to\_b \cdot C_{fineroot} \cdot r_{i}}{dz_{i}} + +where :math:`c\_to\_b = 2` (kg biomass kg carbon :sup:`-1`) and +:math:`C_{fineroot}` is the amount of fine root carbon (kg m :sup:`-2`). + +:math:`\rho_{root}` is the root density (kg m :sup:`-3`), and +:math:`{CA}_{root}` is the fine root cross sectional area (m :sup:`2`) + +.. math:: + :label: 11.15 + + CA_{root} = \pi r_{root}^{2} + +where :math:`r_{root}` is the root radius (m). + .. _Plant Hydraulic Stress: Plant Hydraulic Stress @@ -88,10 +217,21 @@ conductivity (:math:`p50`) and a shape fitting parameter (:math:`c_k`). Stem-to-leaf '''''''''''''''''''''''' -The area basis and conductance parameterization varies by segment. There are two stem-to-leaf fluxes in parallel, from stem to sunlit leaf and from stem to shaded leaf (:math:`q_{1a}` and :math:`q_{1a}`). -The water flux from stem-to-leaf is the product of the segment conductance, the conducting area basis, and the water potential gradient from stem to leaf. Stem-to-leaf conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve. -The maximum conductance is a PFT parameter representing the maximum conductance of water from stem to leaf per unit leaf area. -This parameter can be defined separately for sunlit and shaded segments and should already include the appropriate length scaling (in other words this is a conductance, not conductivity). The water potential gradient is the difference between leaf water potential and stem water potential. There is no gravity term, assuming a negligible difference in height across the segment. The area basis is the leaf area index (either sunlit or shaded). +The area basis and conductance parameterization varies by segment. There +are two stem-to-leaf fluxes in parallel, from stem to sunlit leaf and from +stem to shaded leaf (:math:`q_{1a}` and :math:`q_{1a}`). The water flux from +stem-to-leaf is the product of the segment conductance, the conducting area +basis, and the water potential gradient from stem to leaf. Stem-to-leaf +conductance is defined as the maximum conductance multiplied by the percent +of maximum conductance, as calculated by the sigmoidal vulnerability curve. +The maximum conductance is a PFT parameter representing the maximum +conductance of water from stem to leaf per unit leaf area. This parameter +can be defined separately for sunlit and shaded segments and should already +include the appropriate length scaling (in other words this is a conductance, +not conductivity). The water potential gradient is the difference between +leaf water potential and stem water potential. There is no gravity term, +assuming a negligible difference in height across the segment. The area +basis is the leaf area index (either sunlit or shaded). .. math:: :label: 11.103 @@ -144,7 +284,18 @@ Parameters: Root-to-stem '''''''''''''''''''''''' -There is one root-to-stem flux. This represents a flux from the root collar to the upper branch reaches. The water flux from root-to-stem is the product of the segment conductance, the conducting area basis, and the water potential gradient from root to stem. Root-to-stem conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve (two parameters). The maximum conductance is defined as the maximum root-to-stem conductivity per unit stem area (PFT parameter) divided by the length of the conducting path, which is taken to be the vegetation height. The area basis is the stem area index. The gradient in water potential is the difference between the root water potential and the stem water potential less the difference in gravitational potential. +There is one root-to-stem flux. This represents a flux from the root collar +to the upper branch reaches. The water flux from root-to-stem is the product +of the segment conductance, the conducting area basis, and the water +potential gradient from root to stem. Root-to-stem conductance is defined +as the maximum conductance multiplied by the percent of maximum conductance, +as calculated by the sigmoidal vulnerability curve (two parameters). The +maximum conductance is defined as the maximum root-to-stem conductivity per +unit stem area (PFT parameter) divided by the length of the conducting path, +which is taken to be the vegetation height. The area basis is the stem area +index. The gradient in water potential is the difference between the root +water potential and the stem water potential less the difference in +gravitational potential. .. math:: :label: 11.107 @@ -181,13 +332,38 @@ Parameters: Soil-to-root '''''''''''''''''''''''' -There are several soil-to-root fluxes operating in parallel (one for each root-containing soil layer). Each represents a flux from the given soil layer to the root collar. The water flux from soil-to-root is the product of the segment conductance, the conducting area basis, and the water potential gradient from soil to root. The area basis is a proxy for root area index, defined as the summed leaf and stem area index multiplied by the root-to-shoot ratio (PFT parameter) multiplied by the layer root fraction. The root fraction comes from an empirical root profile (see section zqz). - -The gradient in water potential is the difference between the soil water potential and the root water potential less the difference in gravitational potential. There is only one root water potential to which all soil layers are connected in parallel. A soil-to-root flux can be either positive (vegetation water uptake) or negative (water deposition), depending on the relative values of the root and soil water potentials. This allows for the occurrence of hydraulic redistribution where water moves through vegetation tissue from one soil layer to another. - -Soil-to-root conductance is the result of two resistances in series, first across the soil-root interface and then through the root tissue. The root tissue conductance is defined as the maximum conductance multiplied by the percent of maximum conductance, as calculated by the sigmoidal vulnerability curve. The maximum conductance is defined as the maximum root-tissue conductivity (PFT parameter) divided by the length of the conducting path, which is taken to be the soil layer depth plus lateral root length. - -The soil-root interface conductance is defined as the soil conductivity divided by the conducting length from soil to root. The soil conductivity varies by soil layer and is calculated based on soil potential and soil properties, via the Brooks-Corey theory. The conducting length is computed by calculating the characteristic root spacing following Bonan-2014. The root spacing depends on total root biomass and PFT parameters defining root structure (see section zqz). +There are several soil-to-root fluxes operating in parallel (one for each +root-containing soil layer). Each represents a flux from the given soil +layer to the root collar. The water flux from soil-to-root is the product +of the segment conductance, the conducting area basis, and the water +potential gradient from soil to root. The area basis is a proxy for root +area index, defined as the summed leaf and stem area index multiplied by +the root-to-shoot ratio (PFT parameter) multiplied by the layer root +fraction. The root fraction comes from an empirical root profile (section +:numref:`Vertical Root Distribution`). + +The gradient in water potential is the difference between the soil water +potential and the root water potential less the difference in gravitational +potential. There is only one root water potential to which all soil layers +are connected in parallel. A soil-to-root flux can be either positive +(vegetation water uptake) or negative (water deposition), depending on the +relative values of the root and soil water potentials. This allows for the +occurrence of hydraulic redistribution where water moves through vegetation +tissue from one soil layer to another. + +Soil-to-root conductance is the result of two resistances in series, first +across the soil-root interface and then through the root tissue. The root +tissue conductance is defined as the maximum conductance multiplied by the +percent of maximum conductance, as calculated by the sigmoidal vulnerability +curve. The maximum conductance is defined as the maximum root-tissue +conductivity (PFT parameter) divided by the length of the conducting path, +which is taken to be the soil layer depth plus lateral root length. + +The soil-root interface conductance is defined as the soil conductivity +divided by the conducting length from soil to root. The soil conductivity +varies by soil layer and is calculated based on soil potential and soil +properties, via the Brooks-Corey theory. The conducting length is determined +from the characteristic root spacing (section :numref:`Root Spacing`). .. math:: :label: 11.109 @@ -214,16 +390,6 @@ The soil-root interface conductance is defined as the soil conductivity divided k_{s,i} = \dfrac{k_{soil,i}}{dx_{root,i}} -.. math:: - :label: 11.114 - - dx_{root,i} = \left(\pi*\mbox{root-length-density}_i\right)^{-0.5} - -.. math:: - :label: 11.115 - - \mbox{root-length-density} = \dfrac{\mbox{total root length}}{\mbox{soil volume}} - Variables: :math:`q_{3,i}` = flux of water (mmH2O/s) from soil layer :math:`i` to root diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 724fd493f8..699bef7769 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -526,6 +526,11 @@ Major, D.A., Reginato, R.J., and Hubbard, K.G. 1988. Interception and use efficiency of light in winter wheat under different nitrogen regimes. Agric. For. Meteor. 44:175-186. +.. _Gardner1960: + +Gardner, W. R. 1960. Dynamic aspects of water availability to plants, +Soil Sci., 89, 63–73. + .. _Gashetal1996: Gash, J.H.C., Nobre, C.A., Roberts, J.M., and Victoria, R.L. 1996. An From 8b846e92b9c2519e53539d59e958cc5713c60d93 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 9 Jun 2017 11:09:46 -0600 Subject: [PATCH 0062/1973] add references --- .../CLM50_Tech_Note_Introduction.rst | 2 +- .../CLM50_Tech_Note_Plant_Hydraulics.rst | 32 ------------ .../References/CLM50_Tech_Note_References.rst | 50 ++++++++++++++++--- 3 files changed, 44 insertions(+), 40 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index ed7a66f332..7f409914b2 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -224,7 +224,7 @@ Jinyun Tang, Zong-Liang Yang** - :numref:`Table Respiration fractions for Century-based structure` Respiration fractions for litter and SOM pools for Century-based structure -- :numref:`Table PFT-specific combustion completeness and fire mortality` PFT-specific combustion completeness and fire mortality factors. +- :numref:`Table PFT-specific combustion completeness and fire mortality factors` PFT-specific combustion completeness and fire mortality factors. - :numref:`Table Methane Parameter descriptions` Parameter descriptions and sensitivity analysis ranges applied in the methane model. diff --git a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index 703f9b8ed9..5e0063817b 100644 --- a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -717,35 +717,3 @@ The outermost level of iteration works towards convergence of leaf temperature, .. figure:: flow.png Flow diagram of leaf flux calculations - - -.. _PHS Refs: - -References ------------------------------ - -Local references. Will copy over - -.. _Bonanetal2014: - -Bonan, G.B., Williams, M., Fisher, R.A., and Oleson, K.W. 2014. Modeling stomatal conductance in the earth system: linking leaf water-use efficiency and water transport along the soil–plant–atmosphere continuum, Geosci. Model Dev., 7, 2193-2222, doi:10.5194/gmd-7-2193-2014. - -.. _Chuangetal2006: - -Chuang Y.L., Oren R., Bertozzi A.L, Phillips N., Katul G.G. 2006. The porous media model for the hydraulic system of a conifer tree: Linking sap flux data to transpiration rate, Ecological Modelling, 191, 447-468, doi:10.1016/j.ecolmodel.2005.03.027. - -.. _Medlynetal2011: - -Medlyn, B.E., Duursma, R.A., Eamus, D., Ellsworth, D.S., Prentice, I.C., Barton, C.V.M., Crous, K.Y., De Angelis, P., Freeman, M., and Wingate, L. (2011), Reconciling the optimal and empirical approaches to modelling stomatal conductance. Global Change Biology, 17: 2134–2144. doi:10.1111/j.1365-2486.2010.02375.x - -.. _Sperryetal1998: - -Sperry, J.S., Adler, F.R., Campbell, G.S. and Comstock, J.P. (1998), Limitation of plant water use by rhizosphere and xylem conductance: results from a model. Plant, Cell & Environment, 21: 347–359. doi:10.1046/j.1365-3040.1998.00287.x - -.. _SperryandLove2015: - -Sperry, J.S. and Love, D.M. 2015. What plant hydraulics can tell us about responses to climate-change droughts. New Phytol, 207: 14–27. doi:10.1111/nph.13354 - -.. _Williamsetal1996: - -Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., Wofsy, S.C., Shaver, G.R., Melillo, J.M., Munger, J.W., Fan, S.M. and Nadelhoffer, K.J. 1996. Modelling the soil-plant-atmosphere continuum in a Quercus–Acer stand at Harvard Forest: the regulation of stomatal conductance by light, nitrogen and soil/plant hydraulic properties. Plant, Cell & Environment, 19: 911–927. doi:10.1111/j.1365-3040.1996.tb00456.x diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 699bef7769..076af343be 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -197,14 +197,12 @@ M. 2012. Reconciling leaf physiological traits and canopy flux data: Use of the TRY and FLUXNET databases in the Community Land Model version 4, J. Geophys. Res., 117, G02026. DOI:10.1029/2011JG001913. -Branstetter, M.L., and Famiglietti, J.S. 1999. Testing the sensitivity -of GCM-simulated runoff to climate model resolution using a parallel -river transport algorithm. Preprints, 14\ :math:`{}^{th}` Conference on -Hydrology, Dallas, TX, Amer. Meteor. Soc., 391-392. +.. _Bonanetal2014: -Branstetter, M.L. 2001. Development of a parallel river transport -algorithm and applications to climate studies. Ph.D. dissertation, -University of Texas at Austin. +Bonan, G.B., Williams, M., Fisher, R.A., and Oleson, K.W. 2014. Modeling +stomatal conductance in the earth system: linking leaf water-use +efficiency and water transport along the soil–plant–atmosphere continuum, +Geosci. Model Dev., 7, 2193-2222, doi:10.5194/gmd-7-2193-2014. .. _Brun1989: @@ -245,6 +243,13 @@ Cao, M., Marshall, S. and Gregson, K., 1996. Global carbon exchange and methane emissions from natural wetlands: Application of a process-based model. J. Geophys. Res. 101(D9):14,399-14,414. +.. _Chuangetal2006: + +Chuang Y.L., Oren R., Bertozzi A.L, Phillips N., Katul G.G. 2006. The +porous media model for the hydraulic system of a conifer tree: Linking +sap flux data to transpiration rate, Ecological Modelling, 191, 447-468, +doi:10.1016/j.ecolmodel.2005.03.027. + .. _Churkinaetal2003: Churkina, G. et al., 2003. Analyzing the ecosystem carbon dynamics of @@ -1179,6 +1184,14 @@ carbon and nitrogen dynamics in estimating net primary productivity for potential vegetation in North America. Global Biogeochem. Cycles 6:101-124. +.. _Medlynetal2011: + +Medlyn, B.E., Duursma, R.A., Eamus, D., Ellsworth, D.S., Prentice, I.C., +Barton, C.V.M., Crous, K.Y., De Angelis, P., Freeman, M., and +Wingate, L. (2011), Reconciling the optimal and empirical approaches to +modelling stomatal conductance. Global Change Biology, 17: 2134–2144. +doi:10.1111/j.1365-2486.2010.02375.x + .. _MelzerOLeary1987: Melzer, E., and O’Leary, M.H. 1987. Anapleurotic CO2 Fixation by @@ -1692,6 +1705,19 @@ Sørensen, L.H., 1981. Carbon-nitrogen relationships during the humification of cellulose in soils containing different amounts of clay. Soil Biology and Biochemistry, 13: 313-321. +.. _Sperryetal1998: + +Sperry, J.S., Adler, F.R., Campbell, G.S. and Comstock, J.P. 1998. +Limitation of plant water use by rhizosphere and xylem conductance: +results from a model. Plant, Cell & Environment, 21: 347–359. +doi:10.1046/j.1365-3040.1998.00287.x + +.. _SperryandLove2015: + +Sperry, J.S. and Love, D.M. 2015. What plant hydraulics can tell us +about responses to climate-change droughts. New Phytol, 207: 14–27. +doi:10.1111/nph.13354 + .. _Sprugeletal1995: Sprugel, D.G., Ryan, M.G., Brooks, J.R., Vogt, K.A., and Martin, T.A. @@ -2001,6 +2027,16 @@ Parameterization and sensitivity analysis of the Biome-BGC terrestrial ecosystem model: net primary production controls. Earth Interactions 4:1-85. +.. _Williamsetal1996: + +Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., +Wofsy, S.C., Shaver, G.R., Melillo, J.M., Munger, J.W., Fan, S.M. +and Nadelhoffer, K.J. 1996. Modelling the soil-plant-atmosphere +continuum in a Quercus–Acer stand at Harvard Forest: the regulation +of stomatal conductance by light, nitrogen and soil/plant hydraulic +properties. Plant, Cell & Environment, 19: 911–927. +doi:10.1111/j.1365-3040.1996.tb00456.x + .. _WiscombeWarren1980: Wiscombe, W.J., and Warren, S.G. 1980. A model for the spectral albedo From 3b59bde5078b275f7bddff9b0c76c8f1c7b495e7 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Fri, 9 Jun 2017 17:34:13 -0600 Subject: [PATCH 0063/1973] Updated the N retranslocation section of the Crop chapter --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 110 ++++++++---------- 1 file changed, 49 insertions(+), 61 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 3ff2afc0b5..d130d29bb8 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -79,6 +79,9 @@ fully coupled simulations with the Community Earth System Model (CESM), while helping human societies answer questions about changing food, energy, and water resources in response to climate, environmental, land use, and land management change (e.g., :ref:`Kucharik and Brye 2003 `; :ref:`Lobell et al. 2006 `). +As implemented here, the crop model uses the same physiology as the +natural vegetation, though uses different crop-specific parameter values, +phenology, and allocation, as well as fertilizer and irrigation management. .. _Crop plant functional types: @@ -94,7 +97,7 @@ land management between crops. Each crop type has a rainfed and an irrigated pft that are on independent soil columns. Crop grid cell coverage is assigned from satellite data (similar to all natural pfts), and the managed crop type proportions within the crop area is based on the dataset created by -(:ref:`Portmann et al. 2010 `) for present day and +(:ref:`Portmann et al. 2010 `) for present day. New in CLM5, crop area is extrapolated through time using the dataset provided by Land Use Model Intercomparison Project (LUMIP), which is part of CMIP6 Land use timeseries (:ref:`Lawrence et al. 2016 `). For more details about how @@ -105,8 +108,15 @@ CLM5 includes eight actively managed crop types corn, spring wheat, cotton, rice, and sugarcane) that are chosen based on the availability of corresponding algorithms in AgroIBIS and as developed by Badger and Dirmeyer (:ref:`2015 `) and -described by Levis et al. (:ref:`2016 `). In addition, -CLM’s default list of plant functional types (pfts) includes an +described by Levis et al. (:ref:`2016 `). The representations of +sugarcane, rice, cotton, tropical corn, and tropical soy are new in CLM5. +Sugarcane and tropical corn are both C4 plants and are therefore represented +using the temperate corn functional form. Tropical soybean uses the temperate +soybean functional form, while rice and cotton use the wheat functional form. +In tropical regions, parameter values were developed for the Amazon Basin, and planting +date window is shifted by six months relative to the Northern Hemisphere. + +In addition, CLM’s default list of plant functional types (pfts) includes an irrigated and unirrigated unmanaged C3 crop (Table 25.1) treated as a second C3 grass, The unmanaged C3 crop is only used when the crop model is not active and has grid cell coverage assigned from satellite data, and @@ -231,6 +241,8 @@ Phase 3 begins in one of two ways. The first potential trigger is based on tempe planting like :math:`GDD_{T_{soi} }` but for 2-m air temperature, :math:`GDD_{T_{{\rm 2m}} }`, must reach a heat unit threshold, *h*, of 40 to 65% of :math:`{GDD}_{mat}` (:numref:`Table Crop plant functional types`). +For crops with the C4 photosynthetic pathway (temperate and tropical corn, sugarcane), +the :math:`{GDD}_{mat}` is based on an empirical function and ranges between 950 and 1850. The second potential trigger for phase 3 is based on leaf area index. When the maximum value of leaf area index is reached in phase 2, phase 3 begins. In phase 3, the leaf area index begins to decline in @@ -243,17 +255,17 @@ Harvest '''''''''''''''' Harvest is assumed to occur as soon as the crop reaches maturity. When -:math:`GDD_{T_{{\rm 2m}} }` reaches 100% of :math:`{GDD}_{mat}` or +:math:`GDD_{T_{{\rm 2m}} }` reaches 100% of :math:`{GDD}_{mat}` or the number of days past planting reaches a crop-specific maximum (:numref:`Table Crop plant functional types`)[update table reference], then the crop is harvested. Harvest occurs in one time step using -CN’s leaf offset algorithm. New variables track the flow of grain C and -N to food and of live stem C and N to litter. Currently, food C and N -are routed directly to litter using the labile, cellulose, and lignin -fractions for leaves. [update to product pool] The same fractions for leaves are used for the -flow of live stem C and N to litter for corn, soybean, and temperate -cereals. This is in contrast to the approach for unmanaged PFTs which -puts live stem C and N to dead stems first, rather than to litter. +CN’s leaf offset algorithm. Variables track the flow of grain C and +N to food and of live stem C and N to litter. Putting live +stem C and N into the litter pool is in contrast to the approach for unmanaged PFTs which +puts live stem C and N into dead stem pools first. Leaf and root C and N pools +are routed to the litter pools in the same manner as natural vegetation. In CLM5, food C and N +are routed to a grain product pool where the C and N decay to the atmosphere over one year, +similar in structure to the wood product pools. .. _Allocation: @@ -315,6 +327,12 @@ allocation decline factors, and :math:`a_{leaf}^{f}` and :math:`a_{livestem}^{f}` are final values of these allocation coefficients (:numref:`Table Crop pfts`). +Harvest to seed +'''''''''''''''''''''''''''''' + +In CLM5, the C and N required for crop seeding is removed from the grain +product pool during harvest and used to seed crops in the subsequent year. + .. _General comments: General comments @@ -664,54 +682,24 @@ the counter is reached. Biological nitrogen fixation for soybeans ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Nitrogen fixation by soybeans is similar to that in the SWAT model -(Neitsch et al. 2005) and depends on soil moisture, nitrogen -availability, and growth stage. Soybean fixation is calculated only for -unmet nitrogen demand; if soil nitrogen meets soybean demand, there will -be no fixation during the time step. Soybean fixation is determined by - -.. math:: - :label: 25.10 - - N_{fix} \; =\; N_{plant\_ ndemand} \; *\; min\; \left(\; 1,\; fxw,\; fxn\; \right)*\; fxg - -where :math:`{N}_{plant\_demand}` is the balance of nitrogen needed -to reach potential growth that cannot be supplied from the soil mineral -nitrogen pool, *fxw* is the soil water factor, *fxn* is the soil -nitrogen factor, and *fxg* is the growth stage factor calculated by - -.. math:: - :label: 25.11 - - fxw=\frac{wf}{0.85} - -.. math:: - :label: 25.12 - - fxn=\; \left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }sminn\le 10} \\ {1.5-0.005\left(sminn\times 10\right)\qquad {\rm for\; 10\; <\; }sminn{\rm \; }\ge 30} \\ {1\qquad \qquad \qquad \qquad {\rm for\; }sminn>30} \end{array}\right\} - -.. math:: - :label: 25.13 - - fxg=\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad \qquad {\rm for\; }GDD_{T_{2m} } \le 0.15} \\ {6.67\times GDD_{T_{2m} } -1\qquad \qquad \qquad {\rm for\; }0.150.75} \end{array}\right\} - -where *wf* is the soil water content as a fraction of the water holding -capacity for the top 0.05 m, *sminn* is the total nitrogen in the soil -pool (g/m:sup:`2`), and :math:`{GDD}_{T_{2m}}` is the fraction of -growing degree-days accumulated during the growing season. -:math:`N\mathrm{fix}` is added directly to the soil mineral nitrogen -pool for use that time step. Nitrogen fixation occurs after the plant -has accumulated 15%\ :math:`{GDD}_{mat}` and before -75%\ :math:`{GDD}_{mat}`, so before grain fill begins. +Biological N fixation for soybeans is calculated by the fixation and +uptake of nitrogen module [add reference to chapter 18]. Unlike natural +vegetation, where a fraction of the vegetation are N fixers, all soybeans +are treated as N fixers. .. _Modified C\:N ratios for crops: Modified C:N ratios for crops ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Typically, C:N ratios in plant tissue vary throughout the growing season -and tend to be lower during early growth stages and higher in later -growth stages. In order to account for this change, two sets of C:N +Carbon to nitrogen ratios (C:N) for crops are calculated by the flexible C:N +module that is new to CLM5. + +In CLM5, the flexible C:N module allows leaf C:N to vary based +on residual N allocated to the leaf pool after the demands of other plant organs +are met. Grain C/N is similarly xxx... + +In order to account for this change, two sets of C:N ratios are established in CLM for the leaf, stem, and fine root of crops. This modified C:N ratio approach accounts for the nitrogen retranslocation that occurs during phase 3 of crop growth. Leaf and stem @@ -740,9 +728,9 @@ soil mineral nitrogen pool, and depends on C:N ratios for leaves, stems, roots, and organs. Nitrogen demand during organ development is fulfilled through retranslocation from leaves, stems, and roots. Nitrogen retranslocation is initiated at the beginning of the grain fill stage -for corn and temperate cereals, but not until after LAI decline in -soybean. Nitrogen stored in the leaf and stem is moved into a storage -retranslocation pool. For temperate cereals, nitrogen in roots is also +for all crops except soybean, for which retranslocation is after LAI decline. +Nitrogen stored in the leaf and stem is moved into a storage +retranslocation pool. For wheat and rice, nitrogen in roots is also released into the retranslocation storage pool. The quantity of nitrogen mobilized depends on the C:N ratio of the plant tissue, and is calculated as @@ -750,21 +738,21 @@ calculated as .. math:: :label: 25.14 - leaf\_ to\_ retransn=\frac{c_{leaf} }{CN_{leaf} } -\frac{c_{leaf} }{CN_{leaf}^{f} } + leaf\_ to\_ retransn=n_{leaf} -\frac{c_{leaf} }{CN_{leaf}^{f} } .. math:: :label: 25.15 - stemn\_ to\_ retransn=\frac{c_{stem} }{CN_{stem} } -\frac{c_{stem} }{CN_{stem}^{f} } + stemn\_ to\_ retransn=n_{stem} -\frac{c_{stem} }{CN_{stem}^{f} } .. math:: :label: 25.16 - frootn\_ to\_ retransn=\frac{c_{froot} }{CN_{froot} } -\frac{c_{froot} }{CN_{froot}^{f} } + frootn\_ to\_ retransn=n_{froot} -\frac{c_{froot} }{CN_{froot}^{f} } where :math:`{C}_{leaf}`, :math:`{C}_{stem}`, and :math:`{C}_{froot}` is the carbon in the plant leaf, stem, and fine -root, respectively, :math:`{CN}_{leaf}`, :math:`{CN}_{stem}`, and :math:`{CN}_{froot}` is the pre-grain fill C:N ratio of the -leaf, stem, and fine root respectively, and :math:`CN^f_{leaf}`, +root, respectively, :math:`{N}_{leaf}`, :math:`{N}_{stem}`, and :math:`{N}_{froot}` +is the nitrogen in the plant leaf, stem, and fine root, respectively, and :math:`CN^f_{leaf}`, :math:`CN^f_{stem}`, and :math:`CN^f_{froot}` is the post-grain fill C:N ratio of the leaf, stem, and fine root respectively (:numref:`Table Pre- and post-grain fill CN ratios`). Since C:N measurements are taken from mature crops, pre-grain development C:N From 9a4e0fe38d0bec27012d01c52e55f3ae9764034b Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Tue, 13 Jun 2017 12:14:07 -0600 Subject: [PATCH 0064/1973] Updated CN and N retranslocation sections of crop chapter --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 97 +++++-------------- 1 file changed, 24 insertions(+), 73 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index d130d29bb8..e54cb0d30f 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -101,7 +101,7 @@ proportions within the crop area is based on the dataset created by extrapolated through time using the dataset provided by Land Use Model Intercomparison Project (LUMIP), which is part of CMIP6 Land use timeseries (:ref:`Lawrence et al. 2016 `). For more details about how -crop distributions are determined, see chapter 26 on :ref:`rst_Transient Landcover Change`. +crop distributions are determined, see Chapter :numref: `rst_Transient Landcover Change`. CLM5 includes eight actively managed crop types (temperate soybean, tropical soybean, temperate corn, tropical @@ -117,7 +117,7 @@ In tropical regions, parameter values were developed for the Amazon Basin, and p date window is shifted by six months relative to the Northern Hemisphere. In addition, CLM’s default list of plant functional types (pfts) includes an -irrigated and unirrigated unmanaged C3 crop (Table 25.1) treated as a second C3 grass, +irrigated and unirrigated unmanaged C3 crop (Table 25.1) treated as a second C3 grass. The unmanaged C3 crop is only used when the crop model is not active and has grid cell coverage assigned from satellite data, and the unmanaged C3 irrigated crop type is currently not used @@ -128,7 +128,7 @@ Each of the inactive crop types is simulated using the parameters of the spatially closest associated crop type that is most similar to the functional type (e.g., C3 or C4), which is required to maintain similar phenological parameters based on temperature thresholds. Information detailing which parameters are used for each crop type is -included in Table 25.1. It should be noted that analysis with pft-level history output merges +included in Table 25.1. It should be noted that pft-level history output merges all crop types into the actively managed crop type, so analysis of crop-specific output will require use of the land surface dataset to remap the yields of each actively and inactively managed crop type. @@ -588,52 +588,6 @@ river water storage is maintained above a specified threshold. The details about what is new in CLM4.5 -------------------------------------------- -.. _Interactive irrigation for corn, temperate cereals, and soybean: - -Interactive irrigation for corn, temperate cereals, and soybean -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -CLM4.0 included interactive irrigation only for the generic C3 crops, -i.e. plant functional types (pfts) 15 (rainfed) and 16 (irrigated) in -the CLM list of pfts and not for the additional crops of the interactive -crop management model (CROP). Irrigation and CROP were mutually -exclusive in CLM4.0. - -In CLM4.5 we have reversed this situation. Now the irrigation model can -be used only while running with CROP. To accomplish this we downloaded -data of percent irrigated and percent rainfed corn, soybean, and -temperate cereals (wheat, barley, and rye) (:ref:`Portmann et al. 2010 `), -available online from - -*ftp://ftp.rz.uni-frankfurt.de/pub/uni-frankfurt/physische\_geographie/hydrologie/public/data/MIRCA2000/harvested\_area\_grids.* - -We embedded this data in CLM’s high-resolution pft data for use with the -tool mksurfdat to generate surface datasets at any desired resolution. -Now this data includes percent cover for 24 pfts: - -1-16 as in the standard list of pfts, plus six more: - -17 corn - -18 irrigated\_corn - -19 spring\_temperate\_cereal - -20 irrigated\_spring\_temperate\_cereal - -21 winter\_temperate\_cereal - -22 irrigated\_winter\_temperate\_cereal - -23 soybean - -24 irrigated\_soybean - -We intend surface datasets with 24 pfts only for CROP simulations with -or without irrigation. In simulations without irrigation, the rainfed -and irrigated crops merge into just rainfed crops at run time. Surface -datasets with 16 pfts can be used for all other CLM simulations. - .. _Interactive fertilization: Interactive fertilization @@ -682,30 +636,27 @@ the counter is reached. Biological nitrogen fixation for soybeans ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Biological N fixation for soybeans is calculated by the fixation and -uptake of nitrogen module [add reference to chapter 18]. Unlike natural +Biological N fixation for soybeans is calculated by the fixation and uptake of +nitrogen module (Chapter :numref:`rst_FUN`). Unlike natural vegetation, where a fraction of the vegetation are N fixers, all soybeans are treated as N fixers. .. _Modified C\:N ratios for crops: -Modified C:N ratios for crops +C:N ratios for crops ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Carbon to nitrogen ratios (C:N) for crops are calculated by the flexible C:N -module that is new to CLM5. - -In CLM5, the flexible C:N module allows leaf C:N to vary based -on residual N allocated to the leaf pool after the demands of other plant organs -are met. Grain C/N is similarly xxx... - -In order to account for this change, two sets of C:N +Typically, C:N ratios in plant tissue vary throughout the growing season and +tend to be lower during early growth stages and higher in later growth stages. +In order to account for this seasonal change, two sets of C:N ratios are established in CLM for the leaf, stem, and fine root of crops. This modified C:N ratio approach accounts for the nitrogen -retranslocation that occurs during phase 3 of crop growth. Leaf and stem -(and root for temperate cereals) C:N ratios for phases 1 and 2 are lower -than measurements (Table 20.3) to allow excess nitrogen storage in plant -tissue. During grain fill (phase 3) of the crop growth cycle, the +retranslocation that occurs during phase 3 of crop growth. Leaf, stem, and root +C:N ratios for phases 1 and 2 are calculated +using the new CLM5 carbon and nitrogen allocation scheme +(Chapter :numref:`rst_CN Allocation`), which provides a target C:N value +and allows C:N to vary through time. +During grain fill (phase 3) of the crop growth cycle, a portion of the nitrogen in the plant tissues is moved to a storage pool to fulfill nitrogen demands of organ (reproductive pool) development, such that the resulting C:N ratio of the plant tissue is reflective of measurements at @@ -720,9 +671,10 @@ Nitrogen retranslocation for crops Nitrogen retranslocation in crops occurs when nitrogen that was used for tissue growth of leaves, stems, and fine roots during the early growth -season is remobilized and used for grain development (Pollmer et al. -1979; Crawford et al. 1982; Simpson et al. 1983; Ta and Weiland 1992; -Barbottin et al. 2005; Gallais et al. 2006, 2007). Nitrogen allocation +season is remobilized and used for grain development (:ref:`Pollmer et al. 1979 +`, :ref:`Crawford et al. 1982 `, :ref:`Simpson et al. 1983 +`, :ref:`Ta and Weiland 1992 `, :ref:`Barbottin et al. 2005 `, +:ref:`Gallais et al. 2006 `, :ref:`Gallais et al. 2007 `). Nitrogen allocation for crops follows that of natural vegetation, is supplied in CLM by the soil mineral nitrogen pool, and depends on C:N ratios for leaves, stems, roots, and organs. Nitrogen demand during organ development is fulfilled @@ -798,13 +750,12 @@ Separate reproductive pool One notable difference between natural vegetation and crops is the presence of a reproductive carbon pool (and nitrogen pool). Accounting for the reproductive pool helps determine whether crops are performing -reasonably, through yield calculations, seasonal GPP and NEE changes, -etc. The reproductive pool is maintained similarly to the leaf, stem, +reasonably through yield calculations. +The reproductive pool is maintained similarly to the leaf, stem, and fine root pools, but allocation of carbon and nitrogen does not -begin until the grain fill stage of crop development. Eq. shows the -carbon and nitrogen allocation coefficients to the reproductive pool. In -the CLM4.0, allocation of carbon to the reproductive pool was calculated -but merged with the stem pool. In the model, as allocation declines +begin until the grain fill stage of crop development. Eq. :eq:`(5)` shows the +carbon and nitrogen allocation coefficients to the reproductive pool. +In CLM, as allocation declines during the grain fill stage of growth, increasing amounts of carbon and nitrogen are available for grain development. From 88ca8dab03e41c3f0286e7294b06699ffa69f31f Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Tue, 13 Jun 2017 15:14:54 -0600 Subject: [PATCH 0065/1973] Restructured text in crop chapter --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 432 +++++++----------- 1 file changed, 176 insertions(+), 256 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index e54cb0d30f..7d959d3f39 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -69,8 +69,9 @@ management parameterizations from AgroIBIS (March 2003 version) were coupled as a proof-of-concept to the Community Land Model version 3 [CLM3.0, :ref:`Oleson et al. (2004) `] (not published), then coupled to the CLM3.5 (:ref:`Levis et al. 2009 `) and later released to the community with -CLM4CN (:ref:`Levis et al. 2012 `), with additional updates -available by request after the release of CLM4.5 (:ref:`Levis et al. 2016 `). +CLM4CN (:ref:`Levis et al. 2012 `), and CLM4.5. Additional updates after the +release of CLM4.5 were available by request (:ref:`Levis et al. 2016 `), +and those are now incorporated into CLM5. With interactive crop management and, therefore, a more accurate representation of agricultural landscapes, we hope to improve the CLM’s @@ -101,7 +102,7 @@ proportions within the crop area is based on the dataset created by extrapolated through time using the dataset provided by Land Use Model Intercomparison Project (LUMIP), which is part of CMIP6 Land use timeseries (:ref:`Lawrence et al. 2016 `). For more details about how -crop distributions are determined, see Chapter :numref: `rst_Transient Landcover Change`. +crop distributions are determined, see Chapter :numref:`rst_Transient Landcover Change`. CLM5 includes eight actively managed crop types (temperate soybean, tropical soybean, temperate corn, tropical @@ -138,10 +139,10 @@ remap the yields of each actively and inactively managed crop type. Phenology ^^^^^^^^^^^^^^^^ -CLM4.5CN includes evergreen, seasonally deciduous (responding to changes +CLM5-BGC includes evergreen, seasonally deciduous (responding to changes in day length), and stress deciduous (responding to changes in -temperature and/or soil moisture) phenology algorithms (Chapter 14). In -CLM4.5CNcrop we have added the AgroIBIS crop phenology algorithm, +temperature and/or soil moisture) phenology algorithms (Chapter :numref:`rst_Vegetation Phenology and Turnover`). +CLM5-BGC-crop uses the AgroIBIS crop phenology algorithm, consisting of three distinct phases. Phase 1 starts at planting and ends with leaf emergence, phase 2 @@ -247,7 +248,7 @@ The second potential trigger for phase 3 is based on leaf area index. When the maximum value of leaf area index is reached in phase 2, phase 3 begins. In phase 3, the leaf area index begins to decline in response to a background litterfall rate calculated as the inverse of -leaf longevity for the pft as done in the CN part of the model. +leaf longevity for the pft as done in the BGC part of the model. .. _Harvest: @@ -257,14 +258,15 @@ Harvest Harvest is assumed to occur as soon as the crop reaches maturity. When :math:`GDD_{T_{{\rm 2m}} }` reaches 100% of :math:`{GDD}_{mat}` or the number of days past planting reaches a crop-specific maximum -(:numref:`Table Crop plant functional types`)[update table reference], then the crop is harvested. +(:numref:`Table Crop plant functional types`), then the crop is harvested. Harvest occurs in one time step using -CN’s leaf offset algorithm. Variables track the flow of grain C and +the BGC leaf offset algorithm. Variables track the flow of grain C and N to food and of live stem C and N to litter. Putting live stem C and N into the litter pool is in contrast to the approach for unmanaged PFTs which puts live stem C and N into dead stem pools first. Leaf and root C and N pools -are routed to the litter pools in the same manner as natural vegetation. In CLM5, food C and N -are routed to a grain product pool where the C and N decay to the atmosphere over one year, +are routed to the litter pools in the same manner as natural vegetation. Whereas food C and N +formerly was transferred to the litter pool, CLM5 routes food C and N +to a grain product pool where the C and N decay to the atmosphere over one year, similar in structure to the wood product pools. .. _Allocation: @@ -272,12 +274,40 @@ similar in structure to the wood product pools. Allocation ^^^^^^^^^^^^^^^^^ -Allocation responds to the same phases as phenology (section 20.2.3). +Allocation responds to the same phases as phenology (section :numref: `_Phenology`). Simulated C assimilation begins every year upon leaf emergence in phase 2 and ends with harvest at the end of phase 3; therefore, so does the allocation of such C to the crop’s leaf, live stem, fine root, and reproductive pools. +Typically, C:N ratios in plant tissue vary throughout the growing season and +tend to be lower during early growth stages and higher in later growth stages. +In order to account for this seasonal change, two sets of C:N +ratios are established in CLM for the leaf, stem, and fine root of +crops. This modified C:N ratio approach accounts for the nitrogen +retranslocation that occurs during phase 3 of crop growth. Leaf, stem, and root +C:N ratios for phases 1 and 2 are calculated +using the new CLM5 carbon and nitrogen allocation scheme +(Chapter :numref:`rst_CN Allocation`), which provides a target C:N value +and allows C:N to vary through time. +During grain fill (phase 3) of the crop growth cycle, a portion of the +nitrogen in the plant tissues is moved to a storage pool to fulfill +nitrogen demands of organ (reproductive pool) development, such that the +resulting C:N ratio of the plant tissue is reflective of measurements at +harvest. All C:N ratios were determined by calibration process, through +comparisons of model output versus observations of plant carbon +throughout the growth season. + +The BGC part of the model keeps track of a term representing excess +maintenance respiration that for perennial pfts or pfts with C storage +may be extracted from later gross primary production. Later extraction +cannot continue to happen after harvest for annual crops, so at harvest +we turn the excess respiration pool into a flux that extracts +CO\ :sub:`2` directly from the atmosphere. This way we eliminate +any excess maintenance respiration remaining at harvest as if such +respiration had not taken place. + + .. _Leaf emergence to grain fill: Leaf emergence to grain fill @@ -327,27 +357,72 @@ allocation decline factors, and :math:`a_{leaf}^{f}` and :math:`a_{livestem}^{f}` are final values of these allocation coefficients (:numref:`Table Crop pfts`). -Harvest to seed +Nitrogen retranslocation for crops +,,,,,,,,,,,,,,,,,,,,,,,,,,,, + +Nitrogen retranslocation in crops occurs when nitrogen that was used for +tissue growth of leaves, stems, and fine roots during the early growth +season is remobilized and used for grain development (:ref:`Pollmer et al. 1979 +`, :ref:`Crawford et al. 1982 `, :ref:`Simpson et al. 1983 +`, :ref:`Ta and Weiland 1992 `, :ref:`Barbottin et al. 2005 `, +:ref:`Gallais et al. 2006 `, :ref:`Gallais et al. 2007 `). Nitrogen allocation +for crops follows that of natural vegetation, is supplied in CLM by the +soil mineral nitrogen pool, and depends on C:N ratios for leaves, stems, +roots, and organs. Nitrogen demand during organ development is fulfilled +through retranslocation from leaves, stems, and roots. Nitrogen +retranslocation is initiated at the beginning of the grain fill stage +for all crops except soybean, for which retranslocation is after LAI decline. +Nitrogen stored in the leaf and stem is moved into a storage +retranslocation pool. For wheat and rice, nitrogen in roots is also +released into the retranslocation storage pool. The quantity of nitrogen +mobilized depends on the C:N ratio of the plant tissue, and is +calculated as + +.. math:: + :label: 25.14 + + leaf\_ to\_ retransn=n_{leaf} -\frac{c_{leaf} }{CN_{leaf}^{f} } + +.. math:: + :label: 25.15 + + stemn\_ to\_ retransn=n_{stem} -\frac{c_{stem} }{CN_{stem}^{f} } + +.. math:: + :label: 25.16 + + frootn\_ to\_ retransn=n_{froot} -\frac{c_{froot} }{CN_{froot}^{f} } + +where :math:`{C}_{leaf}`, :math:`{C}_{stem}`, and :math:`{C}_{froot}` is the carbon in the plant leaf, stem, and fine +root, respectively, :math:`{N}_{leaf}`, :math:`{N}_{stem}`, and :math:`{N}_{froot}` +is the nitrogen in the plant leaf, stem, and fine root, respectively, and :math:`CN^f_{leaf}`, +:math:`CN^f_{stem}`, and :math:`CN^f_{froot}` is the post-grain fill C:N +ratio of the leaf, stem, and fine root respectively (:numref:`Table Pre- and post-grain fill CN ratios`). Since +C:N measurements are taken from mature crops, pre-grain development C:N +ratios for leaves, stems, and roots are optimized to allow maximum +nitrogen accumulation for later use during organ development. Post-grain +fill C:N ratios are assigned the same as crop residue. Once excess +nitrogen is moved into the retranslocated pool, during the remainder of +the growing season the retranslocated pool is used first to meet plant +nitrogen demand by assigning the available nitrogen from the +retranslocated pool equal to the plant nitrogen demand. Once the +retranslocation pool is depleted, soil mineral nitrogen pool is used to +fulfill plant nitrogen demands. + +Harvest to food and seed '''''''''''''''''''''''''''''' In CLM5, the C and N required for crop seeding is removed from the grain -product pool during harvest and used to seed crops in the subsequent year. +product pool during harvest and used to seed crops in the subsequent year. +Caluating the crop yields requires... .. _General comments: -General comments +Other Features ^^^^^^^^^^^^^^^^^^^^^^^ -C and N accounting now includes new pools and fluxes pertaining to live -stems and reproductive tissues. For example, the calculations of growth -respiration, above ground net primary production, litter fall, and -displayed vegetation all now account for reproductive C. - -We track allocation to reproductive C separately from CN’s allocation to -other C pools but within the CN framework. CN uses -:math:`{\textstyle\frac{a_{root} }{a_{leaf} }}` and :math:`{\textstyle\frac{a_{livestem} }{a_{leaf} }}` to calculate C and -N allometry and plant N demand. - +Physical Crop Characteristics +'''''''''''''''''''''''''''''' Stem area index (*S*) is equal to 0.1\ *L* for corn and 0.2\ *L* for other crops, as in AgroIBIS, where *L* is the leaf area index. All live C and N pools go to 0 after crop harvest, but the *S* is kept at 0.25 to @@ -364,47 +439,92 @@ and :math:`{z}_{bot}` (m), come from the AgroIBIS formulation: {z_{bot} =0.02{\rm m}} \end{array} -The CN part of the model keeps track of a term representing excess -maintenance respiration that for perennial pfts or pfts with C storage -may be extracted from later gross primary production. Later extraction -cannot continue to happen after harvest for annual crops, so at harvest -we turn the excess respiration pool into a flux that extracts -CO\ :sub:`2` directly from the atmosphere. This way we eliminate -any excess maintenance respiration remaining at harvest as if such -respiration had not taken place. +.. _Interactive fertilization: + +Interactive Fertilization +'''''''''''''''''''''''''''''' +CLM adds nitrogen directly to the soil mineral nitrogen pool to meet +crop nitrogen demands. CLM’s separate crop land unit ensures that +natural vegetation will not access the fertilizer applied to crops. +Fertilizer in CLM5BGCCROP is prescribed by crop function types spatially +for each year based on the LUMIP land use and land cover change +time series (LUH2 for historical and SSPs for future) (:ref:`Lawrence et al. 2016 `). +There are two fields that are used to prescribe industrial fertilizer. +On the surface data set the field CONST_FERTNITRO_CFT specifies the +annual fertilizer application for a non-transient simulations in g N/m\ :sup:`2`/yr. +In the case of a transient simulation this is replaced by the landuse.timeseries +file with the field FERTNITRO_CFT which is also in g N/m\ :sup:`2`/yr. +The values for both of these fields come from the LUMIP time series for each year. +In addition to the industrial fertilizer there is a background manure fertilizer +on the clm parameters file with the field manunitro. For the current CLM5BGCCROP, +this is set to 0.002 kg N/m\ :sup:`2`/yr. Since CLM’s denitrification rate is high +and results in a 50% loss of the unused available nitrogen each day, +fertilizer is applied slowly to minimize the loss and maximize plant +uptake. Fertilizer application begins during the emergence phase of crop +development and continues for 20 days, which helps reduce large losses +of nitrogen from leaching and denitrification during the early stage of +crop development. The 20-day period is chosen as an optimization to +limit fertilizer application to the emergence stage. A fertilizer +counter in seconds, *f*, is set as soon as the onset growth for crops +initiates: -In the list of plant physiological and other parameters used by the CLM, -we started the managed crops with the existing values assigned to the -unmanaged C3 crop. Then we changed the following parameters to -distinguish corn, soybean, and temperate cereals from the unmanaged C3 -crop and from each other: +.. math:: + :label: 25.18 -#. Growth respiration coefficient from 0.30 to the AgroIBIS value of - 0.25. + f = n \times 86400 -#. Fraction of leaf N in the Rubisco enzyme from 0.1 to 0.2 g N Rubisco - g\ :sup:`-1` N leaf for temperate cereals to increase - productivity (not chosen based on AgroIBIS). +where *n* is set to 20 fertilizer application days. When the crop enters +phase 2 (leaf emergence to the beginning of grain fill) of its growth +cycle, fertilizer application begins by initializing fertilizer amount +to the total fertilizer at each grid cell divided by the initialized *f*. +Fertilizer is applied and *f* is decremented each time step until a zero balance on +the counter is reached. -#. Fraction of current photosynthesis displayed as growth changed from - 0.5 to 1 (not chosen based on AgroIBIS). -#. CLM4.5CN curve for the effect of temperature on photosynthesis - instead of crop-specific curves from AgroIBIS. +.. _Biological nitrogen fixation for soybeans: -#. Quantum efficiency at 25\ :sup:`o`\ C, - :math:`\alpha` , from 0.06 to 0.04 *µ*\ mol CO\ :sub:`2` *µ*\ mol\ :sup:`-1` photon for C4 crops (corn and unmanaged C4 - crop), using CLM4.5CN’s C4 grass value. +Biological nitrogen fixation for soybeans +'''''''''''''''''''''''''''''' +Biological N fixation for soybeans is calculated by the fixation and uptake of +nitrogen module (Chapter :numref:`rst_FUN`). Unlike natural +vegetation, where a fraction of the vegetation are N fixers, all soybeans +are treated as N fixers. -#. Slope, *m*, of conductance-to-photosynthesis relationship from 9 to 4 for C4 crops as in AgroIBIS. +.. _Latitude vary base tempereature for growing degree days: -#. Specific leaf areas, *SLA*, to the AgroIBIS values (:numref:`Table Crop plant functional types`). +Latitude vary base tempereature for growing degree days +'''''''''''''''''''''''''''''' +For both rainfed and irrigated spring wheat and sugarcane, +a latitude vary base temperature in calculating :math:`GDD_{T_{{\rm 2m}} }` +(growing degree days since planting) was introduced. -#. Leaf orientation, :math:`\chi _{L}`, to the AgroIBIS values (:numref:`Table Crop plant functional types`). +.. math:: + :label: 25.17 -#. Soil moisture photosynthesis limitation factor, - :math:`\beta _{t}`, for soybeans multiplied as in AgroIBIS by 1.25 - for increased drought tolerance. + latitude\ vary\ baset = \left\{ + \begin{array}{lr} + baset +12 - 0.4 \times latitude &\qquad 0 \le latitude \le 30 \\ + baset +12 + 0.4 \times latitude &\qquad -30 \le latitude \le 0 + \end{array} \right\} + +where :math:`baset` is the 5\ :sup:`th` column in :numref:`Table Crop plant functional types`. +Such latitude vary baset could increase the base temperature, slow down :math:`GDD_{T_{{\rm 2m}} }` +accumulation, and extend the growing season for -30º to 30º regions for spring wheat +and sugarcane. + +Separate reproductive pool +'''''''''''''''''''''''''''''' +One notable difference between natural vegetation and crops is the +presence of a reproductive carbon pool (and nitrogen pool). Accounting +for the reproductive pool helps determine whether crops are performing +reasonably through yield calculations. +The reproductive pool is maintained similarly to the leaf, stem, +and fine root pools, but allocation of carbon and nitrogen does not +begin until the grain fill stage of crop development. Eq. :eq:`(5)` shows the +carbon and nitrogen allocation coefficients to the reproductive pool. +In CLM, as allocation declines +during the grain fill stage of growth, increasing amounts of carbon and +nitrogen are available for grain development. .. _Table Crop plant functional types: @@ -581,203 +701,3 @@ river water storage is maintained above a specified threshold. available online from *ftp://ftp.rz.uni-frankfurt.de/pub/uni-frankfurt/physische\_geographie/hydrologie/public/data/MIRCA2000/harvested\_area\_grids.* - - -.. _The details about what is new in CLM4.5: - -The details about what is new in CLM4.5 --------------------------------------------- - -.. _Interactive fertilization: - -Interactive fertilization -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -CLM adds nitrogen directly to the soil mineral nitrogen pool to meet -crop nitrogen demands. CLM’s separate crop land unit ensures that -natural vegetation will not access the fertilizer applied to crops. -Fertilizer in CLM5BGCCROP is prescribed by crop function types spatially -for each year based on the LUMIP land use and land cover change -time series (LUH2 for historical and SSPs for future) (:ref:`Lawrence et al. 2016 `). -There are two fields that are used to prescribe industrial fertilizer. -On the surface data set the field CONST_FERTNITRO_CFT specifies the -annual fertilizer application for a non-transient simulations in g N/m\ :sup:`2`/yr. -In the case of a transient simulation this is replaced by the landuse.timeseries -file with the field FERTNITRO_CFT which is also in g N/m\ :sup:`2`/yr. -The values for both of these fields come from the LUMIP time series for each year. -In addition to the industrial fertilizer there is a background manure fertilizer -on the clm parameters file with the field manunitro. For the current CLM5BGCCROP, -this is set to 0.002 kg N/m\ :sup:`2`/yr. Since CLM’s denitrification rate is high -and results in a 50% loss of the unused available nitrogen each day, -fertilizer is applied slowly to minimize the loss and maximize plant -uptake. Fertilizer application begins during the emergence phase of crop -development and continues for 20 days, which helps reduce large losses -of nitrogen from leaching and denitrification during the early stage of -crop development. The 20-day period is chosen as an optimization to -limit fertilizer application to the emergence stage. A fertilizer -counter in seconds, *f*, is set as soon as the onset growth for crops -initiates: - -.. math:: - :label: 25.18 - - f = n \times 86400 - -where *n* is set to 20 fertilizer application days. When the crop enters -phase 2 (leaf emergence to the beginning of grain fill) of its growth -cycle, fertilizer application begins by initializing fertilizer amount -to the total fertilizer at each grid cell divided by the initialized *f*. -Fertilizer is applied and *f* is decremented each time step until a zero balance on -the counter is reached. - - -.. _Biological nitrogen fixation for soybeans: - -Biological nitrogen fixation for soybeans -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Biological N fixation for soybeans is calculated by the fixation and uptake of -nitrogen module (Chapter :numref:`rst_FUN`). Unlike natural -vegetation, where a fraction of the vegetation are N fixers, all soybeans -are treated as N fixers. - -.. _Modified C\:N ratios for crops: - -C:N ratios for crops -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Typically, C:N ratios in plant tissue vary throughout the growing season and -tend to be lower during early growth stages and higher in later growth stages. -In order to account for this seasonal change, two sets of C:N -ratios are established in CLM for the leaf, stem, and fine root of -crops. This modified C:N ratio approach accounts for the nitrogen -retranslocation that occurs during phase 3 of crop growth. Leaf, stem, and root -C:N ratios for phases 1 and 2 are calculated -using the new CLM5 carbon and nitrogen allocation scheme -(Chapter :numref:`rst_CN Allocation`), which provides a target C:N value -and allows C:N to vary through time. -During grain fill (phase 3) of the crop growth cycle, a portion of the -nitrogen in the plant tissues is moved to a storage pool to fulfill -nitrogen demands of organ (reproductive pool) development, such that the -resulting C:N ratio of the plant tissue is reflective of measurements at -harvest. All C:N ratios were determined by calibration process, through -comparisons of model output versus observations of plant carbon -throughout the growth season. - -.. _Nitrogen retranslocation for crops: - -Nitrogen retranslocation for crops -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Nitrogen retranslocation in crops occurs when nitrogen that was used for -tissue growth of leaves, stems, and fine roots during the early growth -season is remobilized and used for grain development (:ref:`Pollmer et al. 1979 -`, :ref:`Crawford et al. 1982 `, :ref:`Simpson et al. 1983 -`, :ref:`Ta and Weiland 1992 `, :ref:`Barbottin et al. 2005 `, -:ref:`Gallais et al. 2006 `, :ref:`Gallais et al. 2007 `). Nitrogen allocation -for crops follows that of natural vegetation, is supplied in CLM by the -soil mineral nitrogen pool, and depends on C:N ratios for leaves, stems, -roots, and organs. Nitrogen demand during organ development is fulfilled -through retranslocation from leaves, stems, and roots. Nitrogen -retranslocation is initiated at the beginning of the grain fill stage -for all crops except soybean, for which retranslocation is after LAI decline. -Nitrogen stored in the leaf and stem is moved into a storage -retranslocation pool. For wheat and rice, nitrogen in roots is also -released into the retranslocation storage pool. The quantity of nitrogen -mobilized depends on the C:N ratio of the plant tissue, and is -calculated as - -.. math:: - :label: 25.14 - - leaf\_ to\_ retransn=n_{leaf} -\frac{c_{leaf} }{CN_{leaf}^{f} } - -.. math:: - :label: 25.15 - - stemn\_ to\_ retransn=n_{stem} -\frac{c_{stem} }{CN_{stem}^{f} } - -.. math:: - :label: 25.16 - - frootn\_ to\_ retransn=n_{froot} -\frac{c_{froot} }{CN_{froot}^{f} } - -where :math:`{C}_{leaf}`, :math:`{C}_{stem}`, and :math:`{C}_{froot}` is the carbon in the plant leaf, stem, and fine -root, respectively, :math:`{N}_{leaf}`, :math:`{N}_{stem}`, and :math:`{N}_{froot}` -is the nitrogen in the plant leaf, stem, and fine root, respectively, and :math:`CN^f_{leaf}`, -:math:`CN^f_{stem}`, and :math:`CN^f_{froot}` is the post-grain fill C:N -ratio of the leaf, stem, and fine root respectively (:numref:`Table Pre- and post-grain fill CN ratios`). Since -C:N measurements are taken from mature crops, pre-grain development C:N -ratios for leaves, stems, and roots are optimized to allow maximum -nitrogen accumulation for later use during organ development. Post-grain -fill C:N ratios are assigned the same as crop residue. Once excess -nitrogen is moved into the retranslocated pool, during the remainder of -the growing season the retranslocated pool is used first to meet plant -nitrogen demand by assigning the available nitrogen from the -retranslocated pool equal to the plant nitrogen demand. Once the -retranslocation pool is depleted, soil mineral nitrogen pool is used to -fulfill plant nitrogen demands. - -.. _Table Pre- and post-grain fill CN ratios: - -.. table:: Pre- and post-grain fill C:N ratios for crop leaf, stem, fine root, and reproductive pools. - - +----------------------------+--------+---------------------+-----------+ - | Pre-grain fill stage | Corn | Temperate Cereals | Soybean | - +============================+========+=====================+===========+ - | :math:`{CN}_{leaf}` | 10 | 15 | 25 | - +----------------------------+--------+---------------------+-----------+ - | :math:`{CN}_{stem}` | 50 | 50 | 50 | - +----------------------------+--------+---------------------+-----------+ - | :math:`{CN}_{froot}` | 42 | 30 | 42 | - +----------------------------+--------+---------------------+-----------+ - | Post-grain fill stage | | | | - +----------------------------+--------+---------------------+-----------+ - | :math:`CN_{leaf}^{f}` | 65 | 65 | 65 | - +----------------------------+--------+---------------------+-----------+ - | :math:`CN_{stem}^{f}` | 120 | 100 | 130 | - +----------------------------+--------+---------------------+-----------+ - | :math:`CN_{froot}^{f}` | 42 | 40 | 42 | - +----------------------------+--------+---------------------+-----------+ - | :math:`CN_{repr}^{f}` | 50 | 40 | 60 | - +----------------------------+--------+---------------------+-----------+ - -.. _Separate reproductive pool: - -Separate reproductive pool -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -One notable difference between natural vegetation and crops is the -presence of a reproductive carbon pool (and nitrogen pool). Accounting -for the reproductive pool helps determine whether crops are performing -reasonably through yield calculations. -The reproductive pool is maintained similarly to the leaf, stem, -and fine root pools, but allocation of carbon and nitrogen does not -begin until the grain fill stage of crop development. Eq. :eq:`(5)` shows the -carbon and nitrogen allocation coefficients to the reproductive pool. -In CLM, as allocation declines -during the grain fill stage of growth, increasing amounts of carbon and -nitrogen are available for grain development. - -.. _Latitude vary base tempereature for growing degree days: - -Latitude vary base tempereature for growing degree days -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -For both rainfed and irrigated spring wheat and sugarcane, -a latitude vary base temperature in calculating :math:`GDD_{T_{{\rm 2m}} }` -(growing degree days since planting) was introduced. - -.. math:: - :label: 25.17 - - latitude\ vary\ baset = \left\{ - \begin{array}{lr} - baset +12 - 0.4 \times latitude &\qquad 0 \le latitude \le 30 \\ - baset +12 + 0.4 \times latitude &\qquad -30 \le latitude \le 0 - \end{array} \right\} - -where :math:`baset` is the 5\ :sup:`th` column in :numref:`Table Crop plant functional types`. -Such latitude vary baset could increase the base temperature, slow down :math:`GDD_{T_{{\rm 2m}} }` -accumulation, and extend the growing season for -30º to 30º regions for spring wheat -and sugarcane. From 4cf8315e1c6cbed837761b7ec6ef8e923ca9a216 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 13 Jun 2017 16:45:17 -0600 Subject: [PATCH 0066/1973] Update html --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 7d959d3f39..f7219c640e 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -358,7 +358,7 @@ allocation decline factors, and :math:`a_{leaf}^{f}` and coefficients (:numref:`Table Crop pfts`). Nitrogen retranslocation for crops -,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Nitrogen retranslocation in crops occurs when nitrogen that was used for tissue growth of leaves, stems, and fine roots during the early growth @@ -484,7 +484,7 @@ the counter is reached. .. _Biological nitrogen fixation for soybeans: Biological nitrogen fixation for soybeans -'''''''''''''''''''''''''''''' +'''''''''''''''''''''''''''''''''''''''''' Biological N fixation for soybeans is calculated by the fixation and uptake of nitrogen module (Chapter :numref:`rst_FUN`). Unlike natural vegetation, where a fraction of the vegetation are N fixers, all soybeans @@ -493,7 +493,7 @@ are treated as N fixers. .. _Latitude vary base tempereature for growing degree days: Latitude vary base tempereature for growing degree days -'''''''''''''''''''''''''''''' +'''''''''''''''''''''''''''''''''''''''''''''''''''''''' For both rainfed and irrigated spring wheat and sugarcane, a latitude vary base temperature in calculating :math:`GDD_{T_{{\rm 2m}} }` (growing degree days since planting) was introduced. From 9d9e6e71b0eb5ff1be5e9a5cda747028e86b26c3 Mon Sep 17 00:00:00 2001 From: Yaqiong Lu Date: Wed, 14 Jun 2017 12:55:06 -0600 Subject: [PATCH 0067/1973] updated crop chapter tables and text --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 307 ++++++++++++------ 1 file changed, 201 insertions(+), 106 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index f7219c640e..a9eafc3320 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -118,7 +118,7 @@ In tropical regions, parameter values were developed for the Amazon Basin, and p date window is shifted by six months relative to the Northern Hemisphere. In addition, CLM’s default list of plant functional types (pfts) includes an -irrigated and unirrigated unmanaged C3 crop (Table 25.1) treated as a second C3 grass. +irrigated and unirrigated unmanaged C3 crop (:numref:`Table Crop plant functional types`) treated as a second C3 grass. The unmanaged C3 crop is only used when the crop model is not active and has grid cell coverage assigned from satellite data, and the unmanaged C3 irrigated crop type is currently not used @@ -129,11 +129,86 @@ Each of the inactive crop types is simulated using the parameters of the spatially closest associated crop type that is most similar to the functional type (e.g., C3 or C4), which is required to maintain similar phenological parameters based on temperature thresholds. Information detailing which parameters are used for each crop type is -included in Table 25.1. It should be noted that pft-level history output merges +included in :numref:`Table Crop plant functional types`. It should be noted that pft-level history output merges all crop types into the actively managed crop type, so analysis of crop-specific output will require use of the land surface dataset to remap the yields of each actively and inactively managed crop type. +.. _Table Crop plant functional types: + +.. table:: Crop plant functional types (pfts) in CLM5BGCCROP. + + === =========================== ================ =========================== + ITV Plant function types (PFTs) Management Class Crop Parameters Used + === =========================== ================ =========================== + 15 c3 unmanaged rainfed crop none not applicable + 16 c3 unmanaged irrigated crop none not applicable + 17 rainfed temperate corn active rainfed temperate corn + 18 irrigated temperate corn active irrigated temperate corn + 19 rainfed spring wheat active rainfed spring wheat + 20 irrigated spring wheat active irrigated spring wheat + 21 rainfed winter wheat inactive rainfed spring wheat + 22 irrigated winter wheat inactive irrigated spring wheat + 23 rainfed temperate soybean active rainfed temperate soybean + 24 irrigated temperate soybean active irrigated temperate soybean + 25 rainfed barley inactive rainfed spring wheat + 26 irrigated barley inactive irrigated spring wheat + 27 rainfed winter barley inactive rainfed spring wheat + 28 irrigated winter barley inactive irrigated spring wheat + 29 rainfed rye inactive rainfed spring wheat + 30 irrigated rye inactive irrigated spring wheat + 31 rainfed winter rye inactive rainfed spring wheat + 32 irrigated winter rye inactive irrigated spring wheat + 33 rainfed cassava inactive rainfed rice + 34 irrigated cassava inactive irrigated rice + 35 rainfed citrus inactive rainfed spring wheat + 36 irrigated citrus inactive irrigated spring wheat + 37 rainfed cocoa inactive rainfed rice + 38 irrigated cocoa inactive irrigated rice + 39 rainfed coffee inactive rainfed rice + 40 irrigated coffee inactive irrigated rice + 41 rainfed cotton active rainfed cotton + 42 irrigated cotton active irrigated cotton + 43 rainfed datepalm inactive rainfed cotton + 44 irrigated datepalm inactive irrigated cotton + 45 rainfed foddergrass inactive rainfed spring wheat + 46 irrigated foddergrass inactive irrigated spring wheat + 47 rainfed grapes inactive rainfed spring wheat + 48 irrigated grapes inactive irrigated spring wheat + 49 rainfed groundnuts inactive rainfed rice + 50 irrigated groundnuts inactive irrigated rice + 51 rainfed millet inactive rainfed tropical corn + 52 irrigated millet inactive irrigated tropical corn + 53 rainfed oilpalm inactive rainfed rice + 54 irrigated oilpalm inactive irrigated rice + 55 rainfed potatoes inactive rainfed spring wheat + 56 irrigated potatoes inactive irrigated spring wheat + 57 rainfed pulses inactive rainfed spring wheat + 58 irrigated pulses inactive irrigated spring wheat + 59 rainfed rapeseed inactive rainfed spring wheat + 60 irrigated rapeseed inactive irrigated spring wheat + 61 rainfed rice active rainfed rice + 62 irrigated rice active irrigated rice + 63 rainfed sorghum inactive rainfed tropical corn + 64 irrigated sorghum inactive irrigated tropical corn + 65 rainfed sugarbeet inactive rainfed spring wheat + 66 irrigated sugarbeet inactive irrigated spring wheat + 67 rainfed sugarcane active rainfed sugarcane + 68 irrigated sugarcane active irrigated sugarcane + 69 rainfed sunflower inactive rainfed spring wheat + 70 irrigated sunflower inactive irrigated spring wheat + 71 rainfed miscanthus inactive rainfed tropical corn + 72 irrigated miscanthus inactive irrigated tropical corn + 73 rainfed switchgrass inactive rainfed tropical corn + 74 irrigated switchgrass inactive irrigated tropical corn + 75 rainfed tropical corn active rainfed tropical corn + 76 irrigated tropical corn active irrigated tropical corn + 77 rainfed tropical soybean active rainfed tropical soybean + 78 irrigated tropical soybean active irrigated tropical soybean + === =========================== ================ =========================== + + + .. _Phenology: Phenology @@ -155,8 +230,8 @@ maturity and harvest. Planting ''''''''''''''''' -Corn and temperate cereals must meet the following requirements between -April 1\ :sup:`st` and June 14\ :sup:`th` for planting in the northern hemisphere (NH): +All crops must meet the following requirements between the minimum planting date and the maximum +planting date (for northern hemisphere) in :numref:`Table Crop phenology parameters`: .. math:: :label: 25.1 @@ -171,41 +246,36 @@ where :math:`{T}_{10d}` is the 10-day running mean of :math:`{T}_{2m}`, (the sim temperature at every model time step) and :math:`T_{10d}^{\min}` is the 10-day running mean of :math:`T_{2m}^{\min }` (the daily minimum of :math:`{T}_{2m}`. :math:`{T}_{p}` and :math:`T_{p}^{\min }` are crop-specific coldest planting temperatures -(:numref:`Table Crop plant functional types`), :math:`{GDD}_{8}` is the 20-year running mean growing +(:numref:`Table Crop phenology parameters`), :math:`{GDD}_{8}` is the 20-year running mean growing degree-days (units are degree-days or :sup:`o` days) tracked from April through September (NH) base 8\ :sup:`o` C with -maximum daily increments of 30\ :sup:`o` days (see Eq.XXX ), and +maximum daily increments of 30\ :sup:`o` days (see equation :eq:`25.3`), and :math:`{GDD}_{min }`\ is the minimum growing degree day requirement -(:numref:`Table Crop plant functional types`). Soy must meet the same requirements but between May -1\ :sup:`st` and June 14\ :sup:`th` for planting. If the -requirements in Eq. are not met by June 14\ :sup:`th`, then corn, -soybean, and temperate cereals are still planted on June -15\ :sup:`th` as long as :math:`{GDD}_{8} > 0`. In -the southern hemisphere (SH) the NH requirements apply 6 months later. - -:math:`{GDD}_{8}` does not change as quickly as :math:`{T}_{10d}` and :math:`T_{10d}^{\min }`, so +(:numref:`Table Crop phenology parameters`). :math:`{GDD}_{8}` does not change as quickly as :math:`{T}_{10d}` and :math:`T_{10d}^{\min }`, so it determines whether the crop can be planted in a grid cell, while the two faster-changing variables determine when the crop may be planted. -At planting, each crop is assigned 1 g leaf C m\ :sup:`-2` pft +If the requirements in equation :eq:`25.1` are not met by the maximum planting date, +crops are still planted on the maximum planting date as long as :math:`{GDD}_{8} > 0`. In +the southern hemisphere (SH) the NH requirements apply 6 months later. + +At planting, each crop is assigned 3 g leaf C m\ :sup:`-2` pft column area to be transferred to the leaves upon leaf emergence. An equivalent amount of seed leaf N is assigned given the pft’s C to N -ratio for leaves (:math:`{CN}_{leaf}`). (This differs from AgroIBIS, -which uses a seed leaf area index instead of seed C.) - -At planting, the model updates the average growing degree-days necessary +ratio for leaves (:math:`{CN}_{leaf}` in :numref:`Table Crop allocation parameters`,this differs from AgroIBIS, +which uses a seed leaf area index instead of seed C). The model updates the average growing degree-days necessary for the crop to reach vegetative and physiological maturity, :math:`{GDD}_{mat}`, according to the following AgroIBIS rules: .. math:: :label: 25.2 - \begin{array}{l} {GDD_{{\rm mat}}^{{\rm corn}} =0.85GDD_{{\rm 8}} {\rm \; \; \; and\; \; \; 950} Date: Wed, 14 Jun 2017 17:22:32 -0600 Subject: [PATCH 0068/1973] Text revisions to introduction and other features section of crop chapter --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index a9eafc3320..863e03ecfe 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -9,12 +9,11 @@ Summary of CLM5.0 updates relative to the CLM4.5 ----------------------------------------------------- We describe here the complete crop and irrigation parameterizations that -appear in CLM5.0. Corresponding information for CLM4.5 appeared on the -CLM4.5 web site in a pdf document independent of the CLM4.5 Technical -Note (:ref:`Oleson et al. 2013 `). +appear in CLM5.0. Corresponding information for CLM4.5 appeared in the +CLM4.5 Technical Note (:ref:`Oleson et al. 2013 `). -CLM5.0 includes the following updates to the CROP option, where CROP -refers to the interactive crop management model and is included by default with the BGC configuration: +CLM5.0 includes the following new updates to the CROP option, where CROP +refers to the interactive crop management model and is included as an option with the BGC configuration: - New crop functional types @@ -38,7 +37,6 @@ refers to the interactive crop management model and is included by default with - Initial seed C for planting is increased from 1 to 3 g C/m^2 - These updates appear in detail in the sections below. Many also appear in Levis et al. (:ref:`2016 `). @@ -69,7 +67,7 @@ management parameterizations from AgroIBIS (March 2003 version) were coupled as a proof-of-concept to the Community Land Model version 3 [CLM3.0, :ref:`Oleson et al. (2004) `] (not published), then coupled to the CLM3.5 (:ref:`Levis et al. 2009 `) and later released to the community with -CLM4CN (:ref:`Levis et al. 2012 `), and CLM4.5. Additional updates after the +CLM4CN (:ref:`Levis et al. 2012 `), and CLM4.5BGC. Additional updates after the release of CLM4.5 were available by request (:ref:`Levis et al. 2016 `), and those are now incorporated into CLM5. @@ -578,8 +576,9 @@ Other Features Physical Crop Characteristics '''''''''''''''''''''''''''''' +Leaf area index (*L*) is calculated as a function of XXX [update]. Stem area index (*S*) is equal to 0.1\ *L* for corn and 0.2\ *L* for -other crops, as in AgroIBIS, where *L* is the leaf area index. All live +other crops, as in AgroIBIS. All live C and N pools go to 0 after crop harvest, but the *S* is kept at 0.25 to simulate a post-harvest “stubble” on the ground. @@ -599,24 +598,26 @@ and :math:`{z}_{bot}` (m), come from the AgroIBIS formulation: Interactive Fertilization '''''''''''''''''''''''''''''' -CLM adds nitrogen directly to the soil mineral nitrogen pool to meet -crop nitrogen demands. CLM’s separate crop land unit ensures that +CLM simulates fertilization by adding nitrogen directly to the soil mineral nitrogen pool to meet +crop nitrogen demands using both industrial fertilizer and manure application. CLM’s separate crop land unit ensures that natural vegetation will not access the fertilizer applied to crops. -Fertilizer in CLM5BGCCROP is prescribed by crop function types spatially +Fertilizer in CLM5BGCCROP is prescribed by crop functional types and varies spatially for each year based on the LUMIP land use and land cover change time series (LUH2 for historical and SSPs for future) (:ref:`Lawrence et al. 2016 `). -There are two fields that are used to prescribe industrial fertilizer. -On the surface data set the field CONST_FERTNITRO_CFT specifies the -annual fertilizer application for a non-transient simulations in g N/m\ :sup:`2`/yr. -In the case of a transient simulation this is replaced by the landuse.timeseries -file with the field FERTNITRO_CFT which is also in g N/m\ :sup:`2`/yr. +One of two fields is used to prescribe industrial fertilizer based on the type of simulation. +For non-transient simulations, annual fertilizer application in g N/m\ :sup:`2`/yr +is specified on the land surface data set by the field CONST_FERTNITRO_CFT. +In transient simulations, annual fertilizer application is specified on the land use time series +file by the field FERTNITRO_CFT, which is also in g N/m\ :sup:`2`/yr. The values for both of these fields come from the LUMIP time series for each year. -In addition to the industrial fertilizer there is a background manure fertilizer -on the clm parameters file with the field manunitro. For the current CLM5BGCCROP, -this is set to 0.002 kg N/m\ :sup:`2`/yr. Since CLM’s denitrification rate is high -and results in a 50% loss of the unused available nitrogen each day, -fertilizer is applied slowly to minimize the loss and maximize plant -uptake. Fertilizer application begins during the emergence phase of crop +In addition to the industrial fertilizer, background manure fertilizer is specified +on the parameter file by the field 'manunitro'. For the current CLM5BGCCROP, +manure N is applied at a rate of 0.002 kg N/m\ :sup:`2`/yr. Because previous versions +of CLM (e.g., CLM4) had rapid denitrification rates, fertilizer is applied slowly +to minimize N loss (primarily through denitrification) and maximize plant uptake. +The current implementation of CLM5 inherits this legacy, although denitrification rates +are slower in the current version of the model (:ref:`Koven et al. 2013 `). As such, +fertilizer application begins during the emergence phase of crop development and continues for 20 days, which helps reduce large losses of nitrogen from leaching and denitrification during the early stage of crop development. The 20-day period is chosen as an optimization to @@ -648,24 +649,25 @@ are treated as N fixers. .. _Latitude vary base tempereature for growing degree days: -Latitude vary base tempereature for growing degree days +Latitudinal variation in base growth tempereature '''''''''''''''''''''''''''''''''''''''''''''''''''''''' -For both rainfed and irrigated spring wheat and sugarcane, -a latitude vary base temperature in calculating :math:`GDD_{T_{{\rm 2m}} }` -(growing degree days since planting) was introduced. +For most crops, :math:`GDD_{T_{{\rm 2m}} }` (growing degree days since planting) +is the same in all locations. However, +the for both rainfed and irrigated spring wheat and sugarcane, the calculation of +:math:`GDD_{T_{{\rm 2m}} }` allows for latitudinal variation: .. math:: :label: 25.11 - latitude\ vary\ baset = \left\{ + latitudinal\ variation\ in\ base\ T = \left\{ \begin{array}{lr} baset +12 - 0.4 \times latitude &\qquad 0 \le latitude \le 30 \\ baset +12 + 0.4 \times latitude &\qquad -30 \le latitude \le 0 \end{array} \right\} -where :math:`baset` is the 5\ :sup:`th` row in :numref:`Table Crop phenology parameters`. -Such latitude vary baset could increase the base temperature, slow down :math:`GDD_{T_{{\rm 2m}} }` -accumulation, and extend the growing season for -30º to 30º regions for spring wheat +where :math:`baset` is the *base temperature for GDD* (7\ :sup:`th` row) in :numref:`Table Crop phenology parameters`. +Such latitudinal variation in base growth temperature could increase the base temperature, slow down :math:`GDD_{T_{{\rm 2m}} }` +accumulation, and extend the growing season for regions within 30ºS to 30ºN for spring wheat and sugarcane. .. _Separate reproductive pool: @@ -678,9 +680,9 @@ for the reproductive pool helps determine whether crops are performing reasonably through yield calculations. The reproductive pool is maintained similarly to the leaf, stem, and fine root pools, but allocation of carbon and nitrogen does not -begin until the grain fill stage of crop development. Eq. :eq:`(5)` shows the +begin until the grain fill stage of crop development. Equation :eq:`25.5` describes the carbon and nitrogen allocation coefficients to the reproductive pool. -In CLM, as allocation declines +In CLM5BGCCROP, as allocation declines during the grain fill stage of growth, increasing amounts of carbon and nitrogen are available for grain development. From 944cbcec2ee5b26b0f05a1dd2c01c93b4227c79b Mon Sep 17 00:00:00 2001 From: Yaqiong Lu Date: Thu, 15 Jun 2017 10:36:11 -0600 Subject: [PATCH 0069/1973] changed crop text --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 863e03ecfe..4ceedd3c28 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -229,7 +229,7 @@ Planting ''''''''''''''''' All crops must meet the following requirements between the minimum planting date and the maximum -planting date (for northern hemisphere) in :numref:`Table Crop phenology parameters`: +planting date (for the northern hemisphere) in :numref:`Table Crop phenology parameters`: .. math:: :label: 25.1 @@ -252,15 +252,14 @@ maximum daily increments of 30\ :sup:`o` days (see equation :eq:`25.3`), and (:numref:`Table Crop phenology parameters`). :math:`{GDD}_{8}` does not change as quickly as :math:`{T}_{10d}` and :math:`T_{10d}^{\min }`, so it determines whether the crop can be planted in a grid cell, while the two faster-changing variables determine when the crop may be planted. - If the requirements in equation :eq:`25.1` are not met by the maximum planting date, crops are still planted on the maximum planting date as long as :math:`{GDD}_{8} > 0`. In the southern hemisphere (SH) the NH requirements apply 6 months later. -At planting, each crop is assigned 3 g leaf C m\ :sup:`-2` pft -column area to be transferred to the leaves upon leaf emergence. An +At planting, each crop seed pool is assigned 3 gC m\ :sup:`-2` from its +grain product pool. The seed carbon transferred to the leaves upon leaf emergence. An equivalent amount of seed leaf N is assigned given the pft’s C to N -ratio for leaves (:math:`{CN}_{leaf}` in :numref:`Table Crop allocation parameters`,this differs from AgroIBIS, +ratio for leaves (:math:`{CN}_{leaf}` in :numref:`Table Crop allocation parameters`, this differs from AgroIBIS, which uses a seed leaf area index instead of seed C). The model updates the average growing degree-days necessary for the crop to reach vegetative and physiological maturity, :math:`{GDD}_{mat}`, according to the following AgroIBIS rules: @@ -272,8 +271,8 @@ for the crop to reach vegetative and physiological maturity, where :math:`{GDD}_{10}` is the 20-year running mean growing degree-days tracked from April through September (NH) base -10\ :math:`{}^\circ`\ C with maximum daily increments of -30\ :math:`{}^\circ`\ days. Equation :eq:`25.3` shows how we calculate +10\ :sup:`o`\C with maximum daily increments of +30\ :sup:`o`\days. Equation :eq:`25.3` shows how we calculate :math:`{GDD}_{0}`, :math:`{GDD}_{8}`, and :math:`{GDD}_{10}`: .. math:: @@ -294,12 +293,13 @@ Leaf emergence According to AgroIBIS, leaves may emerge when the growing degree-days of soil temperature to 0.05 m depth tracked since planting (:math:`GDD_{T_{soi} }` ) reaches 1 to 5% of :math:`{GDD}_{mat}` -(:numref:`Table Crop phenology parameters`). :math:`GDD_{T_{soi} }` is base 8, 0, and -10\ :math:`{}^\circ`\ C for corn, soybean, and temperate cereals. -Leaf onset, as defined in the CN part of the model, occurs in the first +(:numref:`Table Crop phenology parameters`). The base temperature for :math:`GDD_{T_{soi} }` +are listed in :numref:`Table Crop phenology parameters`. +Leaf onset occurs in the first time step of phase 2, at which moment all seed C is transferred to leaf C. Subsequently, the leaf area index generally increases and reaches -a maximum value during phase 2. +a maximum value during phase 2. Stem and root C are also increasing, based on +the carbon allocation algorithem in section :numref:`Leaf emergence to grain fill`. .. _Grain fill: @@ -368,13 +368,13 @@ similar in structure to the wood product pools. Notes: :math:`Date_{planting}^{min}` and :math:`Date_{planting}^{max}` are the minimum and maximum planting date in the Northern Hemisphere, the corresponding dates in the Southern Hemisphere apply 6 months later. -:math:`T_{p}` and :math:`T_{p}^{ min }` are crop-specific temperatures threshold for planting. +:math:`T_{p}` and :math:`T_{p}^{ min }` are crop-specific coldest planting temperatures. :math:`{GDD}_{min}` is the lowest (for planting) 20-year running mean growing degree-days base -on the base temperature in the 5\ :sup:`th` row, tracked from April to September (NH). +on the base temperature in the 7\ :sup:`th` row, tracked from April to September (NH). :math:`{GDD}_{mat}` is a crop’s 20-year running mean growing degree-days needed for vegetative and physiological maturity. Harvest occurs at 100%\ :math:`{GDD}_{mat}` or when the days past planting -reach the number in the 9\ :sup:`th` row. Crop growth phases +reach the number in the 11\ :sup:`th` row. Crop growth phases are described in the text. :math:`z_{top}^{\max }` is the maximum top-of-canopy height of a crop, *SLA* is specific leaf area. :math:`\chi _{L}` is the leaf orientation index, equals -1 for vertical, 0 for From a304d84830edd00b994acd1157b7e1d62d7f4c98 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 15 Jun 2017 12:11:31 -0600 Subject: [PATCH 0070/1973] Updates to the Introduction chapter --- .../CLM50_Tech_Note_Introduction.rst | 170 +++++------------- 1 file changed, 49 insertions(+), 121 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 7f409914b2..ded640dda9 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -1,74 +1,24 @@ -g**NCAR/TN-503+STR** -**NCAR Technical Note** -**July 2013** +**July 2017** **Technical Description of version 5.0 of the Community Land Model (CLM)** ***Coordinating Lead Authors*** -**Keith W. Oleson, David M. Lawrence** +**David M. Lawrence, Rosie Fisher, Charles D. Koven, Keith W. Oleson, Sean Swenson** ***Lead Authors*** -**Gordon B. Bonan, Beth Drewniak, Maoyi Huang, Charles D. Koven, Samuel -Levis, Fang Li, William J. Riley, Zachary M. Subin, Sean C. Swenson, -Peter E. Thornton** +**Bardan Ghimire, Leo van Kampenhout, Daniel Kennedy, Erik Kluzek, Peter J. Lawrence, Fang Li, Hongyi Li, Danica Lombardozzi, Yaqiong Lu, Justin Perket, William J. Riley, William Sacks, Mingjie Shi, Will Wieder, Chonggang Xu +** ***Contributing Authors*** -**Anil Bozbiyik, Rosie Fisher, Colette L. Heald, Erik Kluzek, -Jean-Francois Lamarque, Peter J. Lawrence, L. Ruby Leung, William -Lipscomb, Stefan Muszala, Daniel M. Ricciuto, William Sacks, Ying Sun, -Jinyun Tang, Zong-Liang Yang** +**Ben Andre, Ali Ashehad, Gautam Bisht, Gordon Bonan, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, +L. Ruby Leung, William Lipscomb, Daniel M. Ricciuto, Ben Sanderson, Andrew Slater, Zachary M. Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Mariana Vertenstein, Francis Vitt, Xubin Zeng** -**NCAR Earth System Laboratory** - -**Climate and Global Dynamics Division** - -**NATIONAL CENTER FOR ATMOSPHERIC RESEARCH** - -**P. O. Box 3000** - -**BOULDER, COLORADO 80307-3000** - -**ISSN Print Edition 2153-2397** - -**ISSN Electronic Edition 2153-2400** - -**NCAR TECHNICAL NOTES** - -http://library.ucar.edu/research/publish-technote - -The Technical Notes series provides an outlet for a variety of NCAR -Manuscripts that contribute in specialized ways to the body of -scientific knowledge but that are not yet at a point of a formal -journal, monograph or book publication. Reports in this series are -issued by the NCAR scientific divisions, serviced by OpenSky and -operated through the NCAR Library. Designation symbols for the series -include: - -**EDD – Engineering, Design, or Development Reports** - -Equipment descriptions, test results, instrumentation, and operating and maintenance manuals. - -**IA – Instructional Aids** - -Instruction manuals, bibliographies, film supplements, and other research or instructional aids. - -**PPR – Program Progress Reports** - -Field program reports, interim and working reports, survey reports, and plans for experiments. - -**PROC – Proceedings** - -Documentation or symposia, colloquia, conferences, workshops, and lectures. (Distribution maybe limited to attendees). - -**STR – Scientific and Technical Reports** - -Data compilations, theoretical and numerical investigations, and experimental results. The National Center for Atmospheric Research (NCAR) is operated by the nonprofit University Corporation for Atmospheric Research (UCAR) under @@ -80,43 +30,7 @@ the National Science Foundation. National Center for Atmospheric Research P. O. Box 3000, Boulder, Colorado 80307-300 -**NCAR/TN-503+STR** - -**NCAR Technical Note** - -**July 2013** - -**Technical Description of version 4.5 of the Community Land Model (CLM)** - -**Coordinating Lead Authors** - -**Keith W. Oleson, David M. Lawrence** -**Lead Authors** - -**Gordon B. Bonan, Beth Drewniak, Maoyi Huang, Charles D. Koven, Samuel -Levis, Fang Li, William J. Riley, Zachary M. Subin, Sean C. Swenson, Peter E. Thornton** - -**Contributing Authors** - -**Anil Bozbiyik, Rosie Fisher, Colette L. Heald, Erik Kluzek, -Jean-Francois Lamarque, Peter J. Lawrence, L. Ruby Leung, William -Lipscomb, Stefan Muszala, Daniel M. Ricciuto, William Sacks, Ying Sun, -Jinyun Tang, Zong-Liang Yang** - -**NCAR Earth System Laboratory** - -**Climate and Global Dynamics Division** - -**NATIONAL CENTER FOR ATMOSPHERIC RESEARCH** - -**P. O. Box 3000** - -**BOULDER, COLORADO 80307-3000** - -**ISSN Print Edition 2153-2397** - -**ISSN Electronic Edition 2153-2400** **LIST OF FIGURES** @@ -255,19 +169,16 @@ Fung, David Gochis, Alex Guenther, Tim Hoar, Forrest Hoffman, Paul Houser, Trish Jackson, Brian Kauffman, Silvia Kloster, Natalie Mahowald, Jiafu Mao, Lei Meng, Sheri Michelson, Guo-Yue Niu, Adam Phillips, Taotao Qian, Jon Radakovich, James Randerson, Nan Rosenbloom, Steve Running, -Koichi Sakaguchi, Adam Schlosser, Andrew Slater, Reto Stöckli, Quinn -Thomas, Mariana Vertenstein, Nicholas Viovy, Aihui Wang, Guiling Wang, +Koichi Sakaguchi, Adam Schlosser, Andrew Slater, Reto Stöckli, Ying Sun, Quinn +Thomas, Peter Thornton, Mariana Vertenstein, Nicholas Viovy, Aihui Wang, Guiling Wang, Charlie Zender, Xiaodong Zeng, and Xubin Zeng. -The authors also thank the following people for their review of this -document: Jonathan Buzan, Kyla Dahlin, Sanjiv Kumar, Hanna Lee, Danica -Lombardozzi, Quinn Thomas, and Will Wieder. + Current affiliations for the authors are as follows: -K.W. Oleson, D.M. Lawrence, G.B. Bonan, S. Levis, S.C. Swenson, R. -Fisher, E. Kluzek, J.-F. Lamarque, P.J. Lawrence, S. Muszala, and W. -Sacks (National Center for Atmospheric Research); B. Drewniak (Argonne +K.W. Oleson, D.M. Lawrence, G.B. Bonan, S.C. Swenson, R. +Fisher, E. Kluzek, P.J. Lawrence, W. Sacks and M. Vertenstein (National Center for Atmospheric Research); B. Drewniak (Argonne National Laboratory); M. Huang, L.R. Leung (Pacific Northwest National Laboratory); C.D. Koven, W.J. Riley, and J. Tang (Lawrence Berkeley National Laboratory); F. Li (Chinese Academy of Sciences); Z.M. Subin @@ -282,11 +193,11 @@ Austin) Introduction ================= -The purpose of this technical note is to describe the biogeophysical and +The purpose of this document is to fully describe the biogeophysical and biogeochemical parameterizations and numerical implementation of version -4.5 of the Community Land Model (CLM4.5). Scientific justification and +5.0 of the Community Land Model (CLM5.0). Scientific justification and evaluation of these parameterizations can be found in the referenced -scientific papers (:ref:`rst_References`). This technical note and the CLM4.5 +scientific papers (:ref:`rst_References`). This document and the CLM5.0 User’s Guide together provide the user with the scientific description and operating instructions for CLM. @@ -523,8 +434,7 @@ model option for coupled simulations in CESM1.2. CLM4.5 ^^^^^^^^^^^^ -The motivations for the development of CLM4.5 (the model version -described in this Technical Description) were similar to those for CLM4: +The motivations for the development of CLM4.5 were similar to those for CLM4: incorporate several recent scientific advances in the understanding and representation of land surface processes, expand model capabilities, and improve surface and atmospheric forcing datasets. @@ -541,13 +451,9 @@ problems or biases. The main modifications include updates to canopy processes including a revised canopy radiation scheme and canopy scaling of leaf processes, co-limitations on photosynthesis, revisions to photosynthetic parameters -(:ref:`Bonan et al. 2011`), - -.. todo:: had three stars here - need to resolve this - -temperature acclimation of photosynthesis, and +(:ref:`Bonan et al. 2011`), temperature acclimation of photosynthesis, and improved stability of the iterative solution in the photosynthesis and -stomatal conductance model (:ref:`Sun et al. 2012`). Hydrology updates include +stomatal conductance model (:ref:`Sun et al. 2012`). Hydrology updates included modifications such that hydraulic properties of frozen soils are determined by liquid water content only rather than total water content and the introduction of an ice impedance function, and other corrections @@ -556,10 +462,10 @@ position and allow for a perched water table above icy permafrost ground (:ref:`Swenson et al. 2012`). A new snow cover fraction parameterization is incorporated that reflects the hysteresis in fractional snow cover for a given snow depth between accumulation and melt phases (:ref:`Swenson and -Lawrence, 2012`). The lake model in CLM4 is replaced with a completely +Lawrence, 2012`). The lake model in CLM4 was replaced with a completely revised and more realistic lake model (:ref:`Subin et al. 2012a`). A surface -water store is introduced, replacing the wetland land unit and -permitting prognostic wetland distribution modeling, and the surface +water store was introduced, replacing the wetland land unit and +permitting prognostic wetland distribution modeling. The surface energy fluxes are calculated separately (:ref:`Swenson and Lawrence, 2012`) for snow-covered, water-covered, and snow/water-free portions of vegetated and crop land units, and snow-covered and snow-free portions of glacier @@ -570,9 +476,9 @@ decomposition rates modified by soil temperature, water, and oxygen limitations and also including vertical mixing of soil carbon and nitrogen due to bioturbation, cryoturbation, and diffusion (:ref:`Koven et al. 2013`). The litter and soil carbon and nitrogen pool structure as well as -nitrification and denitrification are modified based on the Century -model and biological fixation is revised to distribute fixation more -realistically over the year (:ref:`Koven et al. 2013`). The fire model is +nitrification and denitrification that were modified based on the Century +model. Biological fixation was revised to distribute fixation more +realistically over the year (:ref:`Koven et al. 2013`). The fire model was replaced with a model that includes representations of natural and anthropogenic triggers and suppression as well as agricultural, deforestation, and peat fires (:ref:`Li et al. 2012a,b`; :ref:`Li et al. 2013a`). The @@ -608,6 +514,21 @@ dataset or other alternative forcing datasets. CLM4.5 was released to the community in June 2013 along with the Community Earth System Model version 1.2 (CESM1.2). +CLM5.0 +^^^^^^^^^^^^ + +Developments for CLM5.0 build on the progress made in CLM4.5. Much of the focus of development centered on a +push towards more mechanistic treatment of several key processes, in addition to more comprehensive and explicit representation +of land use and land-cover change. In particular, + +To represent … Stomatal conductance is a function of prognostic (predicted) leaf water potential. LWP is the result of atmospheric demand and supply from soil via resistance network. + +Dynamic land units. + +Included within the codebase of the release of CLM5.0 is a functionally supported version of the Functionally-Assembled Terrestrial Ecosystem Simulator (FATES, +reference Fisher???). This version of CLM5-FATES that is supported in this release is described here??? Short blurb on what FATES can do??? + + Biogeophysical and Biogeochemical Processes ----------------------------------------------- @@ -644,6 +565,10 @@ processes simulated include (:numref:`Figure Land processes`): #. Stomatal physiology and photosynthesis (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`) +#. Prognostic photosynthetic capacity (Chapter :number:`rst_Photosynthetic Capacity`) + +#. Plant hydraulics (Chapter :number: `rst_Plant Hydraulics`) + #. Lake temperatures and fluxes (Chapter :numref:`rst_Lake Model`) #. Glacier processes (Chapter :numref:`rst_Glaciers`) @@ -652,19 +577,22 @@ processes simulated include (:numref:`Figure Land processes`): #. Urban energy balance and climate (Chapter :numref:`rst_Urban Model (CLMU)`) -#. Vegetation carbon and nitrogen allocation and respiration (Chapter - :numref:`rst_CN Allocation`) +#. Vegetation carbon and nitrogen allocation (Chapter :numref:`rst_CN Allocation`) #. Vegetation phenology (Chapter :numref:`rst_Vegetation Phenology and Turnover`) +#. Plant respiration (Chapter :number:`rst_Plant Respiration`) + #. Soil and litter carbon decomposition (Chapter :numref:`rst_Decomposition`) -#. Nitrogen cycling including deposition, biological fixation, +#. Fixation and uptake of nitrogen (Chapter :number:`rst_FUN`) + +#. External nitrogen cycling including deposition, denitrification, leaching, and losses due to fire (Chapter :numref:`rst_External Nitrogen Cycle`) #. Plant mortality (Chapter :numref:`rst_Plant Mortality`) -#. Fire ignition and suppression, including natural, deforestation, and +#. Fire ignition, suppression, spread, and emissions, including natural, deforestation, and agricultural fire (Chapter :numref:`rst_Fire`) #. Methane production, oxidation, and emissions (Chapter :numref:`rst_Methane Model`) From cee897951a2db6502bc83202ca8e3ed8a17062af Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Thu, 15 Jun 2017 14:14:12 -0600 Subject: [PATCH 0071/1973] A few small changes to the crop chapter in collaboration with Yaqiong --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 4ceedd3c28..a40cba747e 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -532,7 +532,12 @@ Harvest to food and seed In CLM5, the C and N required for crop seeding is removed from the grain product pool during harvest and used to seed crops in the subsequent year. -Caluating the crop yields requires... +Caluating the crop yields requires that you sum the GRAINC_TO_FOOD variable +for each year. Additionally, harvest is not typically 100% efficient, so +analysis needs to assume that harvest efficiency is less. We assume a harvest +efficiency of 85%, and a grain C of 45% of the grain dry weight. + +equation (g/m^2) = (sum(GRAINC_TO_FOOD)/0.45)*.85 @@ -576,8 +581,9 @@ Other Features Physical Crop Characteristics '''''''''''''''''''''''''''''' -Leaf area index (*L*) is calculated as a function of XXX [update]. -Stem area index (*S*) is equal to 0.1\ *L* for corn and 0.2\ *L* for +Leaf area index (*L*) is calculated as a function of specific leaf area +(SLA) and leaf C (:ref:`Crop phenology parameters`). +Stem area index (*S*) is equal to 0.1\ *L* for temperate and tropical corn and sugarcane and 0.2\ *L* for other crops, as in AgroIBIS. All live C and N pools go to 0 after crop harvest, but the *S* is kept at 0.25 to simulate a post-harvest “stubble” on the ground. From d0b6860393ac2cc0a4ca98ac9c7569c13e26a8dc Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 15 Jun 2017 14:27:02 -0600 Subject: [PATCH 0072/1973] Update MOSART Chapter --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 26 +++- .../CLM50_Tech_Note_Plant_Hydraulics.rst | 2 +- .../tech_note/RTM/CLM50_Tech_Note_RTM.rst | 141 ------------------ .../References/CLM50_Tech_Note_References.rst | 37 +++++ doc/source/tech_note/index.rst | 2 +- 5 files changed, 57 insertions(+), 151 deletions(-) delete mode 100644 doc/source/tech_note/RTM/CLM50_Tech_Note_RTM.rst diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 4ceedd3c28..11d8f6c109 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -38,7 +38,7 @@ refers to the interactive crop management model and is included as an option wit - Initial seed C for planting is increased from 1 to 3 g C/m^2 These updates appear in detail in the sections below. Many also appear in -Levis et al. (:ref:`2016 `). +:ref:`Levis et al. (2016) `. .. _The crop model: @@ -65,7 +65,7 @@ simulate dynamic vegetation (:ref:`Kucharik et al. 2000 `) and crop management (:ref:`Kucharik and Brye 2003 `). The interactive crop management parameterizations from AgroIBIS (March 2003 version) were coupled as a proof-of-concept to the Community Land Model version 3 -[CLM3.0, :ref:`Oleson et al. (2004) `] (not published), then coupled to the +[CLM3.0, :ref:`Oleson et al. (2004) ` ] (not published), then coupled to the CLM3.5 (:ref:`Levis et al. 2009 `) and later released to the community with CLM4CN (:ref:`Levis et al. 2012 `), and CLM4.5BGC. Additional updates after the release of CLM4.5 were available by request (:ref:`Levis et al. 2016 `), @@ -106,8 +106,8 @@ CLM5 includes eight actively managed crop types (temperate soybean, tropical soybean, temperate corn, tropical corn, spring wheat, cotton, rice, and sugarcane) that are chosen based on the availability of corresponding algorithms in AgroIBIS and as -developed by Badger and Dirmeyer (:ref:`2015 `) and -described by Levis et al. (:ref:`2016 `). The representations of +developed by :ref:`Badger and Dirmeyer (2015)` and +described by :ref:`Levis et al. (2016)`. The representations of sugarcane, rice, cotton, tropical corn, and tropical soy are new in CLM5. Sugarcane and tropical corn are both C4 plants and are therefore represented using the temperate corn functional form. Tropical soybean uses the temperate @@ -234,7 +234,7 @@ planting date (for the northern hemisphere) in :numref:`Table Crop phenology par .. math:: :label: 25.1 - \begin{array}{l} + \begin{array}{c} {T_{10d} >T_{p} } \\ {T_{10d}^{\min } >T_{p}^{\min } } \\ {GDD_{8} \ge GDD_{\min } } @@ -267,7 +267,13 @@ for the crop to reach vegetative and physiological maturity, .. math:: :label: 25.2 - \begin{array}{l} {GDD_{{\rm mat}}^{{\rm corn,sugarcane}} =0.85GDD_{{\rm 8}} {\rm \; \; \; and\; \; \; 950}`) .. math:: :label: 11.12 - dx_{root,i} = \left(\pi \cdot L_i\right)^{\frac{1}{2}} + dx_{root,i} = \left(\pi \cdot L_i\right)^{- \frac{1}{2}} where :math:`L_{i}` is the root length density (m m :sup:`-3`) diff --git a/doc/source/tech_note/RTM/CLM50_Tech_Note_RTM.rst b/doc/source/tech_note/RTM/CLM50_Tech_Note_RTM.rst deleted file mode 100644 index 773b3f2fe6..0000000000 --- a/doc/source/tech_note/RTM/CLM50_Tech_Note_RTM.rst +++ /dev/null @@ -1,141 +0,0 @@ -.. _rst_River Transport Model (RTM): - -River Transport Model (RTM) -=============================== - -The RTM was developed to route total runoff from the land surface model -to either the active ocean or marginal seas which enables the hydrologic -cycle to be closed (Branstetter 2001, Branstetter and Famiglietti 1999). -This is needed to model ocean convection and circulation, which is -affected by freshwater input. It also provides another method of -diagnosing the performance of the land model because the river flow can -be directly compared to gauging station data (e.g., Dai and Trenberth -2002). - -To improve global energy conservation when CLM is being run as part of -the Community Climate System Model, runoff is split into two streams, a -liquid water stream and an ice water stream (derived from excess -snowfall in snow-capped grid cells, section 7.7). The liquid and ice -streams are routed through the RTM, passed to, and dealt with by the -ocean separately. - -The RTM uses a linear transport scheme to route water from each grid -cell to its downstream neighboring grid cell. The change in storage -:math:`S` of river water, whether it be liquid or ice, within a RTM grid -cell (m\ :sup:`3` s\ :sup:`-1`) is - -.. math:: - :label: 14.1) - - \frac{dS}{dt} =\sum F_{in} -F_{out} +R - -where :math:`\sum F_{in}` is the sum of inflows of water from -neighboring upstream grid cells (m\ :sup:`3` s\ :sup:`-1`), -:math:`F_{out}` is the flux of water leaving the grid cell in the -downstream direction (m :sup:`3` s\ :sup:`-1`), and :math:`R` -is the total runoff generated by the land model grid cell -(m\ :sup:`3` s\ :sup:`-1`). Downstream water flow direction in -each grid cell is determined as one of eight compass points (north, -northeast, east, southeast, south, southwest, west, and northwest) based -on the steepest downhill slope as determined from a digital elevation -model (Graham et al. 1999). The flux of water leaving the grid cell -:math:`F_{out}` is - -.. math:: - :label: 14.2) - - F_{out} =\frac{v}{d} S - -where :math:`v` is the effective water flow velocity (m -s\ :sup:`-1`), :math:`d` is the distance between centers of -neighboring grid cells (m), and :math:`S` is the volume of river water -stored within the grid cell (m\ :sup:`3`). The effective water flow -velocity can be estimated from Manning’s equation, which is a function -of surface water slope, the hydraulic radius of the river channel, and a -channel roughness coefficient (Dingman, 2002). However, hydraulic radius -and channel roughness data are not available globally, so a simplified -effective flow velocity expression is used in RTM - -.. math:: - :label: 14.3) - - v=\max \left(0.05,k\beta ^{1/2} \right) - -where :math:`\beta` is the grid cell mean topographic slope, and -:math:`k=1`. - -The distance :math:`d` between two grid cell centers depends on river -direction, latitude, and longitude as - -.. math:: - :label: 14.4) - - d=\sqrt{\Delta x^{2} +\Delta y^{2} } . - -The distance in the zonal direction :math:`\Delta x` (m) is - -.. math:: - :label: 14.5) - - \Delta x=\left(1\times 10^{3} \left|\theta _{i,\, j} -\theta _{i*,\, j*} \right|R_{e} \right)\left[0.5\left(\cos \phi _{i,\, j} +\cos \phi _{i*,\, j*} \right)\right] - -where :math:`\theta _{i,\, j}` and :math:`\theta _{i*,\, j*}` are the -latitudes (radians) of the upstream and downstream grid cells, -:math:`\phi _{i,\, j}` and :math:`\phi _{i*,\, j*}` are the longitudes -(radians) of the upstream and downstream grid cells, :math:`R_{e}` is -the radius of the earth (km) (Table 2.6), and :math:`i` and :math:`j` -are grid cell indices. The distance in the meridional direction -:math:`\Delta y` (m) is - -.. math:: - :label: 14.6) - - \Delta y=\left(1\times 10^{3} \left|\theta _{i,\, j} -\theta _{i*,\, j*} \right|R_{e} \right). - -The RTM is generally run at a time step greater than that of the CLM -because of computational constraints. The total runoff from the land -model at each time step is accumulated until the RTM is invoked. The -total liquid water runoff at the land model resolution (kg -m\ :sup:`-2` s\ :sup:`-1`) is - -.. math:: - :label: 14.7) - - R_{liq} =q_{over} +q_{drai} +q_{rgwl} - -where :math:`q_{over}` is surface runoff (section 7.3), -:math:`q_{drai}` is sub-surface drainage (section 7.6), and -:math:`q_{rgwl}` is liquid runoff from glaciers, wetlands, and lakes -(all in kg m\ :sup:`-2` s\ :sup:`-1`) (sections 7.7 and -9.6.3). The total ice water runoff, also at the land model resolution is - -.. math:: - :label: 14.8) - - R_{ice} =q_{snwcp,ice} - -where :math:`q_{snwcp,ice}` is the ice runoff from snow-capped -surfaces (section 7.7). The runoff at the land model resolution is -interpolated to the resolution of RTM and converted to units of -m\ :sup:`3` s\ :sup:`-1` for use in equation (11.1) by multiplying -by :math:`1\times 10^{-3} A` where :math:`A` is the area -(m\ :sup:`2`) of the RTM grid cell. - -The RTM grid cells that are at river mouths, hence providing freshwater -flux to the ocean, are identified by examining each RTM ocean grid cell -and determining if a RTM land grid cell flows to that ocean grid cell. -River mouth grid cells are also assigned if any overlapping grid cells -at the land model resolution contain land. When used as part of the -Community Climate System Model, the ocean freshwater liquid and ice -fluxes at the RTM resolution are passed to the flux coupler which -distributes the fluxes to the appropriate ocean grid cells. When used -with the Community Atmosphere Model or when run offline, RTM serves only -as a diagnostic tool. The river-routing scheme conserves water globally -as - -.. math:: - :label: 14.9) - - \sum _{i,\, j}\left(\frac{dS}{dt} \right) _{i,\, j} =\sum _{i,\, j}R_{i,\, j} . - - diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 076af343be..97e221f702 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -543,6 +543,12 @@ overview of ABRACOS. pp. 1-14. In: J.H.C. Gash, C.A. Nobre, J.M. Roberts, and R.L. Victoria (editors) Amazonian Deforestation and Climate. John Wiley and Sons, Chichester, England. +.. _Getiranaetal2012: + +Getirana, A. C. V., A. Boone, D. Yamazaki, B. Decharme, F. Papa, and +N. Mognard. 2012. The hydrological modeling and analysis platform +(HyMAP): Evaluation in the Amazon basin, J. Hydrometeorol., 13, 1641–1665. + .. _Gholzetal1985: Gholz, H.L., Perry, C.S., Cropper, W.P., Jr. and Hendry, L.C., 1985. @@ -976,6 +982,11 @@ Climate 25:3071-3095. DOI:10.1175/JCLI-D-11-00256.1. Lehner, B. and Döll, P., 2004. Development and validation of a global database of lakes, reservoirs and wetlands, J. Hydrol., 296, 1–22. +.. _Lehneretal2008: + +Lehner, B., Verdin, K. and Jarvis, A., 2008. New global hydrograhy +derived from spaceborne elevation data. Eos Trans., AGU, 89, 93 – 94. + .. _LePageetal2010: Le Page, Y., van der Werf, G.R., Morton, D.C., and Pereira, J.M.C. 2010. @@ -1079,6 +1090,20 @@ the Community Land Model 4.0 using observations from flux towers and a mountainous watershed. J. Geophys. Res. 116:D24120. DOI:10.1029/2011JD016276. +.. _Lietal2015a: + +Li, H., L. Leung, A. Getirana, M. Huang, H. Wu, Y. Xu, J. Guo and +N. Voisin. 2015a. Evaluating global streamflow simulations by a +physically-based routing model coupled with the Community Land Model, +J. of Hydromet., 16(2):948-971, doi: 10.1175/JHM-D-14-0079.1 + +.. _Lietal2015b: + +Li, H., L. Leung, T. Tesfa, N. Voisin, M. Hejazi, L. Liu, Y. Liu, +J. Rice, H. Wu, and X. Yang. 2015. Modeling stream temperature in the +Anthropocene: An earth system modeling approach, J. Adv. Model. +Earth Syst., 7, doi:10.1002/2015MS000471. + .. _Liangetal1994: Liang, X., Lettenmaier, D.P., Wood, E.F., and Burges, S.J. 1994. A @@ -2054,6 +2079,18 @@ DOI:10.1029/91JD01786. World Bank, 2004. World development indicators 2004, Oxford University Press, New York, 416 pp. +.. _Wuetal2011: + +Wu, H., J. S. Kimball, N. Mantua, and J. Stanford, 2011: Automated +upscaling of river networks for macroscale hydrological modeling. +Water Resour. Res., 47, W03517, doi:10.1029/2009WR008871. + +.. _Wuetal2012: + +Wu, H., J. S. Kimball, H. Li, M. Huang, L. R. Leung, and R. F. Adler +(2012), A New Global River Network Database for Macroscale Hydrologic +modeling, Water Resour. Res., 48, W09701, doi:10.1029/2012WR012313. + .. _Yang1998: Yang, Z.-L. 1998. Technical note of a 10-layer soil moisture and diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index a05aa6210b..3f60029854 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -26,7 +26,7 @@ CLM Technical Note Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst Lake/CLM50_Tech_Note_Lake.rst Glacier/CLM50_Tech_Note_Glacier.rst - RTM/CLM50_Tech_Note_RTM.rst + MOSART/CLM50_Tech_Note_MOSART.rst Urban/CLM50_Tech_Note_Urban.rst CN_Pools/CLM50_Tech_Note_CN_Pools.rst Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst From 1179e59af9ccf43e14d4dc7e5f149d5b16e4b21d Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 15 Jun 2017 15:01:16 -0600 Subject: [PATCH 0073/1973] Add table to MOSART --- .../CLM50_Tech_Note_Introduction.rst | 13 +- .../MOSART/CLM50_Tech_Note_MOSART.rst | 243 ++++++++++++++++++ 2 files changed, 250 insertions(+), 6 deletions(-) create mode 100644 doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index ded640dda9..bbad06b077 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -11,8 +11,7 @@ ***Lead Authors*** -**Bardan Ghimire, Leo van Kampenhout, Daniel Kennedy, Erik Kluzek, Peter J. Lawrence, Fang Li, Hongyi Li, Danica Lombardozzi, Yaqiong Lu, Justin Perket, William J. Riley, William Sacks, Mingjie Shi, Will Wieder, Chonggang Xu -** +**Bardan Ghimire, Leo van Kampenhout, Daniel Kennedy, Erik Kluzek, Peter J. Lawrence, Fang Li, Hongyi Li, Danica Lombardozzi, Yaqiong Lu, Justin Perket, William J. Riley, William Sacks, Mingjie Shi, Will Wieder, Chonggang Xu** ***Contributing Authors*** @@ -128,6 +127,8 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Plant functional type root distribution parameters` Plant functional type root distribution parameters. +- :numref:`Table MOSART Parameters` List of parameters in the global hydrography dataset. + - :numref:`Table Allocation and CN ratio parameters` Allocation and carbon:nitrogen ratio parameters - :numref:`Table Decomposition rate constants` Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. @@ -565,9 +566,9 @@ processes simulated include (:numref:`Figure Land processes`): #. Stomatal physiology and photosynthesis (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`) -#. Prognostic photosynthetic capacity (Chapter :number:`rst_Photosynthetic Capacity`) +#. Prognostic photosynthetic capacity (Chapter :numref:`rst_Photosynthetic Capacity`) -#. Plant hydraulics (Chapter :number: `rst_Plant Hydraulics`) +#. Plant hydraulics (Chapter :numref: `rst_Plant Hydraulics`) #. Lake temperatures and fluxes (Chapter :numref:`rst_Lake Model`) @@ -581,11 +582,11 @@ processes simulated include (:numref:`Figure Land processes`): #. Vegetation phenology (Chapter :numref:`rst_Vegetation Phenology and Turnover`) -#. Plant respiration (Chapter :number:`rst_Plant Respiration`) +#. Plant respiration (Chapter :numref:`rst_Plant Respiration`) #. Soil and litter carbon decomposition (Chapter :numref:`rst_Decomposition`) -#. Fixation and uptake of nitrogen (Chapter :number:`rst_FUN`) +#. Fixation and uptake of nitrogen (Chapter :numref:`rst_FUN`) #. External nitrogen cycling including deposition, denitrification, leaching, and losses due to fire (Chapter :numref:`rst_External Nitrogen Cycle`) diff --git a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst new file mode 100644 index 0000000000..cae3bd0493 --- /dev/null +++ b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst @@ -0,0 +1,243 @@ +.. _rst_River Transport Model (RTM): + +Model for Scale Adaptive River Transport (MOSART) +================================================= + +.. _Overview: + +Overview +--------- + +MOSART is a river transport model designed for applications across local, +regional and global scales :ref:`(Li et al., 2013b) `. A +major purpose of MOSART is to provide freshwater input for the ocean +model in coupled Earth system model. MOSART also provides an effective +way of evaluating and diagnosing the soil hydrology simulated by land +surface models through direction comparison of the simulated river flow +with observations of natural streamflow at gauging stations +:ref:`(Li et al., 2015a)`. Moreover, MOSART provides a +modeling framework for representing riverine transport and transformation +of energy and biogeochemical fluxes under both natural and human-influenced +conditions ( :ref:`(Li et al., 2015b) `. + +.. _Routing Processes: + +Routing Processes +------------------ + +MOSART divides each spatial unit such as a lat/lon grid or watershed into +three categories of hydrologic units (as shown in +:numref:`Figure MOSART conceptual diagram`): hillslopes +that contribute both surface and subsurface runoff into tributaries, +tributaries that discharge into a single main channel, and the main channel +connects the local spatial unit with upstream/downstream units through the +river network. MOSART assumes that all the tributaries within a spatial unit +can be treated as a single hypothetical sub-network channel with a transport +capacity equivalent to all the tributaries combined. Correspondingly, three +routing processes are represented in MOSART: 1) hillslope routing: in each +spatial unit, surface runoff is routed as overland flow into the sub-network +channel, while subsurface runoff generated in the spatial unit directly enters +the sub-network channel; 2) sub-network channel routing: the sub-network channel +receives water from the hillslopes, routes water through the channel and discharges +it into the main channel; 3) main channel routing: the main channel receives water +from the sub-network channel and/or inflow, if any, from the upstream spatial units, +and discharges the water to its downstream spatial unit or the ocean. + +.. _Figure MOSART conceptual diagram: + +.. figure:: mosart_diagram.png + :width: 800px + :height: 400px + + +MOSART only route positive runoff, although negative runoff could be generated +occasionally by the land model (e.g., :math:`q_{gwl}`). Negative runoff in any +runoff component including :math:`q_{sur}`, :math:`q_{sub}`, :math:`q_{gwl}` +is mapped directly from the spatial unit where it is generated at any time step to +the basin outlet of the corresponding spatial unit. + +In MOSART, the travel velocities of water across hillslopes, sub-network and main +channel are all estimated using the Manning’s equation with different levels of +simplifications. Generally the Manning’s equation is in the form of + +.. math:: + :label: 14.1 + + V = \frac{R^{\frac{2}{3}} S_{f}}{n} + +where :math: `V` is the travel velocity (m s :sup:`-1` ), :math:`R` is the hydraulic +radius (m). :math:`S_{f}` is the friction slope, and accounting for the effects +of gravity, friction, inertia and other forces onthe water. If the channel slope +is steep enough, the gravity force dominates over the others so one can approximate +:math:`S_{f}` by the channel bed slope :math:`S` , which is the key assumption +underpinning the kinematic wave method. :math:`n` is the Manning’s roughness +coefficient, which is mainly controlled by surface roughness and sinuosity of the +flow path. + +If the water surface is sufficiently large or the water depth :math:`h` is +sufficiently shallow, the hydraulic radius can be approximated by the water depth. +This is the case for both hillslope and sub-network channel routing. + +.. math:: + :label: 14.2 + + R_{h} = h_{h} + R_{t} = h_{t} + +Here :math:`R_{h}` (m) and :math:`R_{t}` (m) are hydraulic radius for hillslope and +sub-network channel routing respectively, and :math:`h_{h}` (m) and :math:`h_{t}` +(m) are water depth during hillslope and sub-network channel routing respectively. + +For the main channel, the hydraulic radius is given by + +.. math:: + :label: 14.3 + + R_{r} = \frac{A_{r}}{P_{r}} + +where :math:`A_{r}` (m :sup:`2` ) is the wetted area defined as the part of the +channel cross-section area below the water surface, :math:`P_{r}` (m) is the +wetted perimeter (m), the perimeter confines in the wetted area. + +For hillslopes, sub-network and main channels, a common continuity equation can +be written as + +.. math:: + :label: 14.4 + + \frac{dS}{dt} = Q_{in} - Q_{out} + R + + +where :math:`Q_{in}` (m :sup:`3` s :sup:`-1` ) is the main channel flow from +the upstream grid(s) into the main channel of the current grid, which is zero for +hillslope and sub-network routing. :math:`Q_{out}` (m :sup:`3` s :sup:`-1` ) is +the outflow rate from hillslope into the sub-network, from the sub-network into +the main channel, or from the current main channel to the main channel of its +downstream grid (if not the outlet grid) or ocean (if the current grid is the +basin outlet). :math:`R` (m :sup:`3` s :sup:`-1` ) is a source term, which +could be the surface +runoff generation rate for hillslopes, or lateral inflow (from hillslopes) into +sub-network channel or water-atmosphere exchange fluxes such as precipitation +and evaporation. It is assumed that surface runoff is generated uniformly +across all the hillslopes. Currently, MOSART does not exchange water with +the atmosphere or return water to the land model so its function is strictly +to transport water from runoff generation through the hillslope, tributaries, +and main channels to the basin outlets. + +.. _Numerical Solution MOSART: + +Numerical Solution +---------------------------- + +The numerical implementation of MOSART is mainly based on a subcycling +scheme and a local time-stepping algorithm. There are two levels of +subcycling. For convenience, we denote :math:`T_{inputs}` (s), +:math:`T_{mosart}` (s), :math:`T_{hillslope}` (s) and +:math:`T_{channel}` (s) as the time steps of runoff inputs (from CLM +to MOSART via the flux coupler), MOSART routing, hillslope routing and +channel routing respectively. The first level of subcycling is between +the runoff inputs and MOSART routing. If :math:`T_{inputs}` is 10800s +and :math:`T_{mosart}` is 3600s, three MOSART time steps will be +invoked each time the runoff inputs are updated. The second level of +subcycling is between the hillslope routing and channel routing. This +is to account for the fact that the travel velocity of water across +hillslope is usually much slower than that in the channels. +:math:`T_{hillslope}` is usually set as the same as :math:`T_{mosart}`, +but within each time step of hillslope routing there are a few time +steps for channel routing, i.e., +:math:`T_{hillslope} = D_{levelH2R} \cdot T_{channel}`. The local +time-stepping algorithm is to account for the fact that the travel +velocity of water is much faster in some river channels (e.g., with +steeper bed slope, narrower channel width) than others. That is, for +each channel (either a sub-network or main channel), the final time +step of local channel routing is given as +:math:`T_{local}=T_{channel}/D_{local}`. :math:`D_{local}` is +currently estimated empirically as a function of local channel slope, +width, length and upstream drainage area. If MOSART crashes due to a +numerical issue, we recommend to increase :math:`D_{levelH2R}` and, if +the issue remains, reducing :math:`T_{mosart}`. + +.. _Parameters and Input Data: + +Parameters and Input Data +--------------------------------- + +MOSART is supported by a comprehensive, global hydrography dataset at 0.5 +:sup:`o` resolution. As such, the fundamental spatial unit of MOSART is a 0.5 +:sup:`o` lat/lon grid. The topographic parameters (such as flow direction, +channel length, topographic and channel slopes etc.) were derived using the +Dominant River Tracing (DRT) algorithm (:ref:`Wu et al., 2011` ; +:ref:`Wu et al. 2012 `). The DRT algorithm produces the topographic +parameters in a scale-consistent way to preserve/upscale the key features of +a baseline high-resolution hydrography dataset at multiple coarser spatial +resolutions. Here the baseline high-resolution hydrography dataset is the +1km resolution Hydrological data and maps based on SHuttle Elevation +Derivatives at multiple Scales (HydroSHEDS) +(:ref:`Lehner and Döll, 2004 ` ; +:ref:`Lehner et al., 2008 `). The channel geometry +parameters, e.g., bankfull width and depth, were estimated from empirical +hydraulic geometry relationships as functions of the mean annual discharge. +The Manning roughness coefficients for overland and channel flow were +calculated as functions of landcover and water depth. For more details +on the methodology to derive channel geometry and the Manning’s roughness +coefficients, please refer to +:ref:`Getirana et al. (2012) ` . The full list of +parameters included in this global hydrography dataset is provided in +the :numref:`Table MOSART Parameters`. Evaluation of global simulations +by MOSART using the aforementioned parameters is described in +:ref:`Li et al. (2015b) ` . + +.. _Table MOSART Parameters: + +.. table:: List of parameters in the global hydrography dataset + + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | Name | Unit | Description | + +=========================+===============+====================================================================================================================================+ + | :math:`F_{dir}` | \- | The D8 single flow direction for each coarse grid cell coded using 1 (E), 2 (SE), 4 (S), 8 (SW), 16 (W), 32 (NW), 64 (N), 128 (NE) | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`A_{total}` | km :sup:`2` | The upstream drainage area of each coarse grid cell | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`F_{dis}` | m | The dominant river length for each coarse grid cell | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`S_{channel}` | \- | The average channel slope for each coarse grid cell | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`S_{topographic}` | \- | The average topographic slope (for overland flow routing) for each coarse grid cell | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`A_{local}` | km :sup:`2` | The surface area for each coarse grid cell | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`D_{p}` | m :sup:`-1` | Drainage density, calculated as the total channel length within each coarse grid cell divided by the local cell area | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`D_{r}` | m | The bankfull depth of main channel | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`W_{r}` | m | The bankfull width of main channel | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`D_{t}` | m | The average bankfull depth of tributary channels | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`W_{t}` | m | The average bankfull width of tributary channels | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`n_{r}` | \- | Manning’s roughness coefficient for channel flow routing | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + | :math:`n_{h}` | \- | Manning’s roughness coefficient for overland flow routing | + +-------------------------+---------------+------------------------------------------------------------------------------------------------------------------------------------+ + + + +Difference between CLM5.0 and CLM4.5 +------------------------------------- + +1. Routing methods: RTM, a linear reservoir method, is used in CLM4.5 for +river routing, whilst in CLM5.0, MOSART is an added option for river routing +based on the more physically-based kinematic wave method. +2. Runoff treatment: In RTM runoff is routed regardless of its sign so +negative streamflow can be simulated at times. MOSART routes only nonnegative +runoff and always produces positive streamflow, which is important for +future extension for modeling riverine heat and biogeochemical fluxes. +3. Input parameters: RTM in CLM4.5 only requires one layer of spatial variable +of channel velocity, whilst MOSART in CLM5.0 requires 13 parameters that +are all available globally at 0.5 :sup:`o` resolution. +4. Outputs: RTM only produces streamflow simulation, whilst MOSART +additionally simulates the time-varying channel velocities and channel +water depth and channel surface water variation. + + From 3754e4d33471263fb24dbff22e9ea8e8ae3e21a6 Mon Sep 17 00:00:00 2001 From: Yaqiong Lu Date: Thu, 15 Jun 2017 15:20:36 -0600 Subject: [PATCH 0074/1973] updated crop --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 66f9d2b59f..a91ec4b6f9 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -371,7 +371,6 @@ similar in structure to the wood product pools. :math:`\chi _{L}` index -0.5 0.65 -0.5 -0.5 0.65 -0.5 -0.5 -0.5 grperc 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 flnr 0.293 0.41 0.41 0.41 0.41 0.293 0.293 0.41 - mbbopt 4 9 9 9 9 4 4 9 fcur 1 1 1 1 1 1 1 1 =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== @@ -390,8 +389,7 @@ top-of-canopy height of a crop, *SLA* is specific leaf area. :math:`\chi _{L}` i orientation index, equals -1 for vertical, 0 for random, and 1 for horizontal leaf orientation. grperc is the growth respiration factor. flnr is the fraction of leaf N in Rubisco enzyme. -mbbopt is the Ball-Berry slope of conductance-photosynthesis relationship. -fcur is the fraction of allocation that goes to currently displayed growth +fcur is the fraction of allocation that goes to currently displayed growth. .. _Allocation: @@ -547,9 +545,10 @@ for each year. Additionally, harvest is not typically 100% efficient, so analysis needs to assume that harvest efficiency is less. We assume a harvest efficiency of 85%, and a grain C of 45% of the grain dry weight. -equation (g/m^2) = (sum(GRAINC_TO_FOOD)/0.45)*.85 - +.. math:: + :label: 25.9 + Grain\ yield(g.m^{-2})=\frac{\sum(GRAINC\_ TO\_ FOOD)*0.85}{0.45} .. _Table Crop allocation parameters: @@ -592,7 +591,7 @@ Other Features Physical Crop Characteristics '''''''''''''''''''''''''''''' Leaf area index (*L*) is calculated as a function of specific leaf area -(SLA) and leaf C (:ref:`Crop phenology parameters`). +(SLA, :numref:`Table Crop phenology parameters`) and leaf C. Stem area index (*S*) is equal to 0.1\ *L* for temperate and tropical corn and sugarcane and 0.2\ *L* for other crops, as in AgroIBIS. All live C and N pools go to 0 after crop harvest, but the *S* is kept at 0.25 to @@ -603,7 +602,7 @@ and :math:`{z}_{bot}` (m), come from the AgroIBIS formulation: .. math:: - :label: 25.9 + :label: 25.10 \begin{array}{l} {z_{top} =z_{top}^{\max } \left(\frac{L}{L_{\max } -1} \right)^{2} \ge 0.05{\rm \; where\; }\frac{L}{L_{\max } -1} \le 1} \\ @@ -642,7 +641,7 @@ counter in seconds, *f*, is set as soon as the onset growth for crops initiates: .. math:: - :label: 25.10 + :label: 25.11 f = n \times 86400 @@ -673,7 +672,7 @@ the for both rainfed and irrigated spring wheat and sugarcane, the calculation o :math:`GDD_{T_{{\rm 2m}} }` allows for latitudinal variation: .. math:: - :label: 25.11 + :label: 25.12 latitudinal\ variation\ in\ base\ T = \left\{ \begin{array}{lr} From caf97209b788bdf57df0da20fdfa837ae1513966 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Thu, 15 Jun 2017 17:09:03 -0600 Subject: [PATCH 0075/1973] Updated introduction of photosynthesis chapter --- .../CLM50_Tech_Note_Photosynthesis.rst | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index d50b90a814..f54c7da3c1 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -3,21 +3,43 @@ Stomatal Resistance and Photosynthesis ========================================= +Summary of CLM5.0 updates relative to the CLM4.5 +----------------------------------------------------- + +We describe here the complete photosynthesis and stomatal conductance parameterizations that +appear in CLM5.0. Corresponding information for CLM4.5 appeared in the +CLM4.5 Technical Note (:ref:`Oleson et al. 2013 `). + +CLM5 includes the following new changes to photosynthesis and stomatal conductance: + +- Default stomatal conductance calculation uses the Medlyn conductance model + +- :math:`V_{cmax}` is predicted by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) + +- Water stress is applied by the hydraulic conductance model (Chapter :numref:`rst_Plant Hydraulics`) + + +Introduction +----------------------- + Leaf stomatal resistance, which is needed for the water vapor flux -(Chapter 5), is coupled to leaf photosynthesis similar to Collatz et al. -(1991, 1992). These equations are solved separately for sunlit and +(Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`), +is coupled to leaf photosynthesis similar to Collatz et al. +(:ref:`1991 `, :ref:`1992 `). These equations are solved separately for sunlit and shaded leaves using average absorbed photosynthetically active radiation for sunlit and shaded leaves [:math:`\phi ^{sun}` ,\ :math:`\phi ^{sha}` W m\ :sup:`-2` -(section 4.1)] to give sunlit and shaded stomatal resistance +(section :numref:`Solar Fluxes`)] to give sunlit and shaded stomatal resistance (:math:`r_{s}^{sun}` ,\ :math:`r_{s}^{sha}` s m\ :sup:`-1`) and photosynthesis (:math:`A^{sun}` ,\ :math:`A^{sha}` µmol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`). Canopy photosynthesis is :math:`A^{sun} L^{sun} +A^{sha} L^{sha}` , where :math:`L^{sun}` and :math:`L^{sha}` are the sunlit and shaded leaf -area indices (section 4.1). Canopy conductance is +area indices (section :numref:`Solar Fluxes`). Canopy conductance is :math:`\frac{1}{r_{b} +r_{s}^{sun} } L^{sun} +\frac{1}{r_{b} +r_{s}^{sha} } L^{sha}` , where :math:`r_{b}` is the leaf boundary layer resistance (section -5.3). The equation set is described by Bonan et al. (2011). +:numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). +The implementation is described by Bonan et al. (:ref:`2011 `), though different +methods of calculating stomatal conductance and :math:`V_{cmax}` are used in CLM5. .. _Stomatal resistance: From e2fb2b8d51bdbc181e8200049d3ccb03ceab3d7d Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 16 Jun 2017 08:35:39 -0600 Subject: [PATCH 0076/1973] add mosart figure --- .../tech_note/Introduction/CLM50_Tech_Note_Introduction.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index bbad06b077..31ab7685d8 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -53,6 +53,8 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Figure Schematic representation of the urban landunit` Schematic representation of the urban land unit. +- :numref:`Figure MOSART conceptual diagram` MOSART conceptual diagram. + - :numref:`Figure Schematic of urban and atmospheric model coupling` Schematic of urban and atmospheric model coupling. - :numref:`Figure Vegetation fluxes and pools` Vegetation fluxes and pools. From c1de9a28f715cf6db65c7538ea3cfad8e18ebbe6 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 16 Jun 2017 08:39:14 -0600 Subject: [PATCH 0077/1973] mosart label change --- doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst | 2 +- doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index fa25eeb5c8..84752b5429 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -11,7 +11,7 @@ land units can be found elsewhere in this document (see Chapter :numref:`rst_Surface Characterization, Vertical Discretization, and Model Input Requirements` for an overview). -.. _Overview: +.. _Overview Glaciers: Overview ------------- diff --git a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst index cae3bd0493..24df209f08 100644 --- a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst +++ b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst @@ -3,7 +3,7 @@ Model for Scale Adaptive River Transport (MOSART) ================================================= -.. _Overview: +.. _Overview MOSART: Overview --------- From f2daf15ca8f6887d74023d245fb73e016d944bc7 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Wed, 28 Jun 2017 17:16:04 -0600 Subject: [PATCH 0078/1973] Detailed editing of crop chapter through the end of the phenology section --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 72 ++++++++++--------- .../CLM50_Tech_Note_Photosynthesis.rst | 66 ----------------- 2 files changed, 37 insertions(+), 101 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index a91ec4b6f9..37eca59b4e 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -96,7 +96,7 @@ land management between crops. Each crop type has a rainfed and an irrigated pft that are on independent soil columns. Crop grid cell coverage is assigned from satellite data (similar to all natural pfts), and the managed crop type proportions within the crop area is based on the dataset created by -(:ref:`Portmann et al. 2010 `) for present day. New in CLM5, crop area is +:ref:`Portmann et al. (2010)` for present day. New in CLM5, crop area is extrapolated through time using the dataset provided by Land Use Model Intercomparison Project (LUMIP), which is part of CMIP6 Land use timeseries (:ref:`Lawrence et al. 2016 `). For more details about how @@ -130,11 +130,13 @@ Information detailing which parameters are used for each crop type is included in :numref:`Table Crop plant functional types`. It should be noted that pft-level history output merges all crop types into the actively managed crop type, so analysis of crop-specific output will require use of the land surface dataset to -remap the yields of each actively and inactively managed crop type. +remap the yields of each actively and inactively managed crop type. Otherwise, the +actively managed crop type will include yields for that crop type and all inactively +managed crop types that are using the same parameter set. .. _Table Crop plant functional types: -.. table:: Crop plant functional types (pfts) in CLM5BGCCROP. +.. table:: Crop plant functional types (pfts) included in CLM5BGCCROP. === =========================== ================ =========================== ITV Plant function types (PFTs) Management Class Crop Parameters Used @@ -241,25 +243,25 @@ planting date (for the northern hemisphere) in :numref:`Table Crop phenology par \end{array} where :math:`{T}_{10d}` is the 10-day running mean of :math:`{T}_{2m}`, (the simulated 2-m air -temperature at every model time step) and :math:`T_{10d}^{\min}` is +temperature during each model time step) and :math:`T_{10d}^{\min}` is the 10-day running mean of :math:`T_{2m}^{\min }` (the daily minimum of -:math:`{T}_{2m}`. :math:`{T}_{p}` and :math:`T_{p}^{\min }` are crop-specific coldest planting temperatures +:math:`{T}_{2m}`). :math:`{T}_{p}` and :math:`T_{p}^{\min }` are crop-specific coldest planting temperatures (:numref:`Table Crop phenology parameters`), :math:`{GDD}_{8}` is the 20-year running mean growing degree-days (units are degree-days or :sup:`o` days) tracked -from April through September (NH) base 8\ :sup:`o` C with +from April through September (NH) above 8\ :sup:`o` C with maximum daily increments of 30\ :sup:`o` days (see equation :eq:`25.3`), and :math:`{GDD}_{min }`\ is the minimum growing degree day requirement (:numref:`Table Crop phenology parameters`). :math:`{GDD}_{8}` does not change as quickly as :math:`{T}_{10d}` and :math:`T_{10d}^{\min }`, so -it determines whether the crop can be planted in a grid cell, while the -two faster-changing variables determine when the crop may be planted. +it determines whether it is warm enough for the crop to be planted in a grid cell, while the +2-m air temperature variables determine the day when the crop may be planted if the :math:`{GDD}_{8}` threshold is met. If the requirements in equation :eq:`25.1` are not met by the maximum planting date, crops are still planted on the maximum planting date as long as :math:`{GDD}_{8} > 0`. In the southern hemisphere (SH) the NH requirements apply 6 months later. At planting, each crop seed pool is assigned 3 gC m\ :sup:`-2` from its -grain product pool. The seed carbon transferred to the leaves upon leaf emergence. An +grain product pool. The seed carbon is transferred to the leaves upon leaf emergence. An equivalent amount of seed leaf N is assigned given the pft’s C to N -ratio for leaves (:math:`{CN}_{leaf}` in :numref:`Table Crop allocation parameters`, this differs from AgroIBIS, +ratio for leaves (:math:`{CN}_{leaf}` in :numref:`Table Crop allocation parameters`; this differs from AgroIBIS, which uses a seed leaf area index instead of seed C). The model updates the average growing degree-days necessary for the crop to reach vegetative and physiological maturity, :math:`{GDD}_{mat}`, according to the following AgroIBIS rules: @@ -275,11 +277,11 @@ for the crop to reach vegetative and physiological maturity, GDD_{{\rm mat}}^{{\rm trop.soy}} =GDD_{{\rm 10}} & {\rm \; \; \; and\; \; \; } & GDD_{{\rm mat}}^{{\rm trop.soy}} <2100{}^\circ {\rm days} \end{array} -where :math:`{GDD}_{10}` is the 20-year running mean growing -degree-days tracked from April through September (NH) base -10\ :sup:`o`\C with maximum daily increments of -30\ :sup:`o`\days. Equation :eq:`25.3` shows how we calculate -:math:`{GDD}_{0}`, :math:`{GDD}_{8}`, and :math:`{GDD}_{10}`: +where :math:`{GDD}_{0}`, :math:`{GDD}_{8}`, and :math:`{GDD}_{10}` are the 20-year running mean growing +degree-days tracked from April through September (NH) over 0\ :sup:`o`\C, 8\ :sup:`o`\C, and +10\ :sup:`o`\C, respectively, with maximum daily increments of +26\ :sup:`o`\days (for :math:`{GDD}_{0}`) or 30\ :sup:`o`\days (for :math:`{GDD}_{8}` and :math:`{GDD}_{10}`). Equation :eq:`25.3` shows how we calculate +:math:`{GDD}_{0}`, :math:`{GDD}_{8}`, and :math:`{GDD}_{10}` for each model timestep: .. math:: :label: 25.3 @@ -291,9 +293,9 @@ degree-days tracked from April through September (NH) base \end{array} where, if :math:`{T}_{2m}` - :math:`{T}_{f}` takes on values -outside the above ranges, then it equals the minimum or maximum value in -the range. Also :math:`{T}_{f}` equals 273.15 K, -:math:`{T}_{2m}` has units of K, and *GDD* has units of ºdays. +outside the above ranges within a day, then it equals the minimum or maximum value in +the range for that day. :math:`{T}_{f}` is the freezing temperature of water and equals 273.15 K, +:math:`{T}_{2m}` is the 2-m air temperature in units of K, and *GDD* is in units of ºdays. .. _Leaf emergence: @@ -301,25 +303,25 @@ Leaf emergence ''''''''''''''''''''''' According to AgroIBIS, leaves may emerge when the growing degree-days of -soil temperature to 0.05 m depth tracked since planting -(:math:`GDD_{T_{soi} }` ) reaches 1 to 5% of :math:`{GDD}_{mat}` -(:numref:`Table Crop phenology parameters`). The base temperature for :math:`GDD_{T_{soi} }` -are listed in :numref:`Table Crop phenology parameters`. -Leaf onset occurs in the first +soil temperature to 0.05 m depth (:math:`GDD_{T_{soi} }` ), which is tracked since planting, +reaches 1 to 5% of :math:`{GDD}_{mat}` +(see Phase 2 % :math:`{GDD}_{mat}` in :numref:`Table Crop phenology parameters`). The base temperature threshold for :math:`GDD_{T_{soi} }` +are listed in :numref:`Table Crop phenology parameters`, and leaf emergence (crop phenology phase 2) +starts when this threshold is met. Leaf onset occurs in the first time step of phase 2, at which moment all seed C is transferred to leaf -C. Subsequently, the leaf area index generally increases and reaches -a maximum value during phase 2. Stem and root C are also increasing, based on -the carbon allocation algorithem in section :numref:`Leaf emergence to grain fill`. +C. Subsequently, the leaf area index generally increases throughout phase 2 until it reaches +a predetermined maximum value. Stem and root C also increase throughout phase 2 based on +the carbon allocation algorithm in section :numref:`Leaf emergence to grain fill`. .. _Grain fill: Grain fill ''''''''''''''''''' -Phase 3 begins in one of two ways. The first potential trigger is based on temperature, similar to phase 2. A variable tracked since -planting like :math:`GDD_{T_{soi} }` but for 2-m air temperature, -:math:`GDD_{T_{{\rm 2m}} }`, must reach a heat unit threshold, *h*, -of 40 to 65% of :math:`{GDD}_{mat}` (:numref:`Table Crop phenology parameters`). +The grain fill phase (phase 3) begins in one of two ways. The first potential trigger is based on temperature, similar to phase 2. A variable tracked since +planting, similar to :math:`GDD_{T_{soi} }` but for 2-m air temperature, +:math:`GDD_{T_{{\rm 2m}} }`, must reach a threshold +of 40 to 65% of :math:`{GDD}_{mat}` (see Phase 3 % :math:`{GDD}_{mat}` in :numref:`Table Crop phenology parameters`). For crops with the C4 photosynthetic pathway (temperate and tropical corn, sugarcane), the :math:`{GDD}_{mat}` is based on an empirical function and ranges between 950 and 1850. The second potential trigger for phase 3 is based on leaf area index. @@ -339,11 +341,11 @@ the number of days past planting reaches a crop-specific maximum (:numref:`Table Crop phenology parameters`), then the crop is harvested. Harvest occurs in one time step using the BGC leaf offset algorithm. Variables track the flow of grain C and -N to food and of live stem C and N to litter. Putting live +N to food and of all other plant pools, including live stem C and N, to litter. Putting live stem C and N into the litter pool is in contrast to the approach for unmanaged PFTs which puts live stem C and N into dead stem pools first. Leaf and root C and N pools are routed to the litter pools in the same manner as natural vegetation. Whereas food C and N -formerly was transferred to the litter pool, CLM5 routes food C and N +was formerly transferred to the litter pool, CLM5 routes food C and N to a grain product pool where the C and N decay to the atmosphere over one year, similar in structure to the wood product pools. @@ -378,8 +380,8 @@ Notes: :math:`Date_{planting}^{min}` and :math:`Date_{planting}^{max}` are the minimum and maximum planting date in the Northern Hemisphere, the corresponding dates in the Southern Hemisphere apply 6 months later. :math:`T_{p}` and :math:`T_{p}^{ min }` are crop-specific coldest planting temperatures. -:math:`{GDD}_{min}` is the lowest (for planting) 20-year running mean growing degree-days base -on the base temperature in the 7\ :sup:`th` row, tracked from April to September (NH). +:math:`{GDD}_{min}` is the lowest (for planting) 20-year running mean growing degree-days based +on the base temperature threshold in the 7\ :sup:`th` row, tracked from April to September (NH). :math:`{GDD}_{mat}` is a crop’s 20-year running mean growing degree-days needed for vegetative and physiological maturity. Harvest occurs at 100%\ :math:`{GDD}_{mat}` or when the days past planting @@ -388,7 +390,7 @@ are described in the text. :math:`z_{top}^{\max }` is the maximum top-of-canopy height of a crop, *SLA* is specific leaf area. :math:`\chi _{L}` is the leaf orientation index, equals -1 for vertical, 0 for random, and 1 for horizontal leaf orientation. -grperc is the growth respiration factor. flnr is the fraction of leaf N in Rubisco enzyme. +grperc is the growth respiration factor. flnr is the fraction of leaf N in the Rubisco enzyme. fcur is the fraction of allocation that goes to currently displayed growth. .. _Allocation: diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index f54c7da3c1..de6693e76b 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -508,72 +508,6 @@ orbital geometry (:math:`\pm`\ 23.4667º [:math:`\pm`\ 0.409571 radians], positive for Northern Hemisphere latitudes and negative for Southern Hemisphere). -.. _Soil water stress: - -Soil water stress ---------------------- - -Soil water influences stomatal conductance directly by multiplying the -minimum conductance by a soil water stress function :math:`\beta _{t}` -and also indirectly through :math:`A_{n}` in the C\ :sub:`3` and -C\ :sub:`4` photosynthesis models, as in Sellers et al. (1996). -The latter effect is achieved by multiplying :math:`V_{c\; \max }` and -:math:`R_{d}` by :math:`\beta _{t}` . - -The function :math:`\beta _{t}` ranges from one when the soil is wet to -near zero when the soil is dry and depends on the soil water potential -of each soil layer, the root distribution of the plant functional type, -and a plant-dependent response to soil water stress - -.. math:: - :label: 9.26) - - \beta _{t} =\sum _{i}w_{i} r_{i} - -where :math:`w_{i}` is a plant wilting factor for layer :math:`i` and -:math:`r_{i}` is the fraction of roots in layer :math:`i`. The plant -wilting factor :math:`w_{i}` is - -.. math:: - :label: 9.27) - - w_{i} =\left\{\begin{array}{l} {\frac{\psi _{c} -\psi _{i} }{\psi _{c} -\psi _{o} } \left[\frac{\theta _{sat,i} -\theta _{ice,i} }{\theta _{sat,i} } \right]\le 1\qquad {\rm for\; }T_{i} >T_{f} -2{\rm \; and\; }\theta _{liq,\, i} >0} \\ {0\qquad \qquad \qquad \qquad {\rm for\; }T_{i} \le T_{f} -2{\rm \; or\; }\theta _{liq,\, i} \le 0} \end{array}\right\} - -where :math:`\psi _{i}` is the soil water matric potential (mm) and -:math:`\psi _{c}` and :math:`\psi _{o}` are the soil water potential -(mm) when stomata are fully closed or fully open (respectively) (Table -8.1). The term in brackets scales :math:`w_{i}` by the ratio of the -effective porosity (accounting for the ice fraction; -:math:`\theta _{sat} -\theta _{ice}` ) relative to the total porosity. - -Here, the soil water matric potential :math:`\psi _{i}` \ is defined as - -.. math:: - :label: 9.28) - - \psi _{i} =\psi _{sat,i} \, s_{i}^{-B_{i} } \ge \psi _{c} - -where :math:`s_{i}` is the soil wetness for layer :math:`i` with -respect to the effective porosity and :math:`\psi _{sat,i}` and -:math:`B_{i}` are the saturated soil matric potential (mm) and the -Clapp and Hornberger (1978) parameter (section 7.4.1). The soil wetness -:math:`s_{i}` is - -.. math:: - :label: 9.29) - - s_{i} =\frac{\theta _{liq,\, i} }{\theta _{sat,\, i} -\theta _{ice,\, i} } \ge 0.01 - -where -:math:`\theta _{ice,\, i} ={w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(\rho _{ice} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{ice} \Delta z_{i} \right)} \le \theta _{sat,\, i}` \ and -:math:`\theta _{liq,\, i} ={w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(\rho _{liq} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{liq} \Delta z_{i} \right)} \le \theta _{sat,\, i} -\theta _{ice,\, i}` . -:math:`w_{ice,\, i}` and :math:`w_{liq,\, i}` are the ice and liquid -water contents (kg m\ :sup:`-2`) (Chapter 7), -:math:`\theta _{sat,\, i}` is the saturated volumetric water content -(section 7.4.1), :math:`\rho _{ice}` and :math:`\rho _{liq}` are the -densities of ice and liquid water (kg m\ :sup:`-3`) (Table 2.6), -and :math:`\Delta z_{i}` is the soil layer thickness (m) (section 6.1). - .. _Numerical implementation photosynthesis: Numerical implementation From c87be809421b5ce7e38f371a315d1fe16b27fc2f Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Fri, 30 Jun 2017 13:48:02 -0600 Subject: [PATCH 0079/1973] Detailed edits on full crop chapter --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 115 ++++++++++-------- 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 37eca59b4e..1694764136 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -320,12 +320,12 @@ Grain fill The grain fill phase (phase 3) begins in one of two ways. The first potential trigger is based on temperature, similar to phase 2. A variable tracked since planting, similar to :math:`GDD_{T_{soi} }` but for 2-m air temperature, -:math:`GDD_{T_{{\rm 2m}} }`, must reach a threshold +:math:`GDD_{T_{{\rm 2m}} }`, must reach a heat unit threshold, *h*, of of 40 to 65% of :math:`{GDD}_{mat}` (see Phase 3 % :math:`{GDD}_{mat}` in :numref:`Table Crop phenology parameters`). For crops with the C4 photosynthetic pathway (temperate and tropical corn, sugarcane), the :math:`{GDD}_{mat}` is based on an empirical function and ranges between 950 and 1850. The second potential trigger for phase 3 is based on leaf area index. -When the maximum value of leaf area index is reached in phase 2, phase 3 begins. +When the maximum value of leaf area index is reached in phase 2 (:numref:`Table Crop allocation parameters`), phase 3 begins. In phase 3, the leaf area index begins to decline in response to a background litterfall rate calculated as the inverse of leaf longevity for the pft as done in the BGC part of the model. @@ -339,15 +339,7 @@ Harvest is assumed to occur as soon as the crop reaches maturity. When :math:`GDD_{T_{{\rm 2m}} }` reaches 100% of :math:`{GDD}_{mat}` or the number of days past planting reaches a crop-specific maximum (:numref:`Table Crop phenology parameters`), then the crop is harvested. -Harvest occurs in one time step using -the BGC leaf offset algorithm. Variables track the flow of grain C and -N to food and of all other plant pools, including live stem C and N, to litter. Putting live -stem C and N into the litter pool is in contrast to the approach for unmanaged PFTs which -puts live stem C and N into dead stem pools first. Leaf and root C and N pools -are routed to the litter pools in the same manner as natural vegetation. Whereas food C and N -was formerly transferred to the litter pool, CLM5 routes food C and N -to a grain product pool where the C and N decay to the atmosphere over one year, -similar in structure to the wood product pools. +Harvest occurs in one time step using the BGC leaf offset algorithm. .. _Table Crop phenology parameters: @@ -398,7 +390,7 @@ fcur is the fraction of allocation that goes to currently displayed growth. Allocation ^^^^^^^^^^^^^^^^^ -Allocation responds to the same phases as phenology (section :numref:`Phenology`). +Allocation changes based on the crop phenology phases phenology (section :numref:`Phenology`). Simulated C assimilation begins every year upon leaf emergence in phase 2 and ends with harvest at the end of phase 3; therefore, so does the allocation of such C to the crop’s leaf, live stem, fine root, and @@ -408,33 +400,35 @@ Typically, C:N ratios in plant tissue vary throughout the growing season and tend to be lower during early growth stages and higher in later growth stages. In order to account for this seasonal change, two sets of C:N ratios are established in CLM for the leaf, stem, and fine root of -crops. This modified C:N ratio approach accounts for the nitrogen -retranslocation that occurs during phase 3 of crop growth. Leaf, stem, and root -C:N ratios for phases 1 and 2 are calculated +crops: one during the leaf emergence phase (phenology phase 2), and a second during +grain fill phase (phenology phase 3). This modified C:N ratio approach accounts for the nitrogen +retranslocation that occurs during the grain fill phase (phase 3) of crop growth. Leaf, stem, and root +C:N ratios for phase 2 are calculated using the new CLM5 carbon and nitrogen allocation scheme (Chapter :numref:`rst_CN Allocation`), which provides a target C:N value -and allows C:N to vary through time. +(:numref:`Table Crop allocation parameters`) and allows C:N to vary through time. During grain fill (phase 3) of the crop growth cycle, a portion of the nitrogen in the plant tissues is moved to a storage pool to fulfill nitrogen demands of organ (reproductive pool) development, such that the resulting C:N ratio of the plant tissue is reflective of measurements at harvest. All C:N ratios were determined by calibration process, through comparisons of model output versus observations of plant carbon -throughout the growth season. +throughout the growing season. The BGC part of the model keeps track of a term representing excess -maintenance respiration that for perennial pfts or pfts with C storage -may be extracted from later gross primary production. Later extraction +maintenance respiration, which supplies the carbon required for maintenance respiration during periods of +low photosynthesis (Chapter :numref:`rst_Plant Respiration`). +Carbon supply for excess maintenance respiration cannot continue to happen after harvest for annual crops, so at harvest -we turn the excess respiration pool into a flux that extracts -CO\ :sub:`2` directly from the atmosphere. This way we eliminate -any excess maintenance respiration remaining at harvest as if such +the excess respiration pool is turned into a flux that extracts +CO\ :sub:`2` directly from the atmosphere. This way +any excess maintenance respiration remaining at harvest is eliminated as if such respiration had not taken place. .. _Leaf emergence to grain fill: -Leaf emergence to grain fill +Leaf emergence ''''''''''''''''''''''''''''''''''''' During phase 2, the allocation coefficients (fraction of available C) to @@ -454,11 +448,11 @@ exclusively to the fine roots. .. _Grain fill to harvest: -Grain fill to harvest +Grain fill '''''''''''''''''''''''''''''' The calculation of :math:`a_{froot}` remains the same from phase 2 to -phase 3. Other allocation coefficients change to: +phase 3. During grain fill (phase 3), other allocation coefficients change to: .. math:: :label: 25.5 @@ -499,7 +493,7 @@ through retranslocation from leaves, stems, and roots. Nitrogen retranslocation is initiated at the beginning of the grain fill stage for all crops except soybean, for which retranslocation is after LAI decline. Nitrogen stored in the leaf and stem is moved into a storage -retranslocation pool. For wheat and rice, nitrogen in roots is also +retranslocation pool for all crops, and for wheat and rice, nitrogen in roots is also released into the retranslocation storage pool. The quantity of nitrogen mobilized depends on the C:N ratio of the plant tissue, and is calculated as @@ -524,28 +518,37 @@ root, respectively, :math:`{N}_{leaf}`, :math:`{N}_{stem}`, and :math:`{N}_{froo is the nitrogen in the plant leaf, stem, and fine root, respectively, and :math:`CN^f_{leaf}`, :math:`CN^f_{stem}`, and :math:`CN^f_{froot}` is the post-grain fill C:N ratio of the leaf, stem, and fine root respectively (:numref:`Table Crop allocation parameters`). Since -C:N measurements are taken from mature crops, pre-grain development C:N -ratios for leaves, stems, and roots are optimized to allow maximum -nitrogen accumulation for later use during organ development. Post-grain -fill C:N ratios are assigned the same as crop residue. Once excess -nitrogen is moved into the retranslocated pool, during the remainder of -the growing season the retranslocated pool is used first to meet plant +C:N measurements are often taken from mature crops, pre-grain development C:N +ratios for leaves, stems, and roots in the model are optimized to allow maximum +nitrogen accumulation for later use during organ development, and post-grain +fill C:N ratios are assigned the same as crop residue. After +nitrogen is moved into the retranslocated pool, +the nitrogen in this pool is used to meet plant nitrogen demand by assigning the available nitrogen from the -retranslocated pool equal to the plant nitrogen demand. Once the +retranslocated pool equal to the plant nitrogen demand for each organ (:math:`{CN_{[organ]}^{f} }` in :numref:`Table Crop allocation parameters`). Once the retranslocation pool is depleted, soil mineral nitrogen pool is used to fulfill plant nitrogen demands. .. _Harvest to food and seed: -Harvest to food and seed +Harvest '''''''''''''''''''''''''''''' -In CLM5, the C and N required for crop seeding is removed from the grain -product pool during harvest and used to seed crops in the subsequent year. -Caluating the crop yields requires that you sum the GRAINC_TO_FOOD variable -for each year. Additionally, harvest is not typically 100% efficient, so +Variables track the flow of grain C and +N to food and of all other plant pools, including live stem C and N, to litter. Putting live +stem C and N into the litter pool is in contrast to the approach for unmanaged PFTs which +puts live stem C and N into dead stem pools first. Leaf and root C and N pools +are routed to the litter pools in the same manner as natural vegetation. Whereas food C and N +was formerly transferred to the litter pool, CLM5 routes food C and N +to a grain product pool where the C and N decay to the atmosphere over one year, +similar in structure to the wood product pools. +Additionally, CLM5 accounts for the C and N required for crop seeding by removing the seed C and N from the grain +product pool during harvest. The crop seed pool is then used to seed crops in the subsequent year. +Calcuating the crop yields (Equation :eq:`25.9`) requires that you sum the GRAINC_TO_FOOD variable +for each year, and must account for the proportion of C in the dry crop weight. +Here, we assume that grain C is 45% of the total dry weight. Additionally, harvest is not typically 100% efficient, so analysis needs to assume that harvest efficiency is less. We assume a harvest -efficiency of 85%, and a grain C of 45% of the grain dry weight. +efficiency of 85%. .. math:: :label: 25.9 @@ -579,8 +582,9 @@ efficiency of 85%, and a grain C of 45% of the grain dry weight. :math:`{CN}_{grain}` 50 50 50 50 50 50 50 50 =========================================== ============== ============ ================== ====== ====== ========= ============= ================ -Notes: Crop growth phases and corresponding variables are described in -the text +Notes: Crop growth phases and corresponding variables are described throughout +the text. :math:`{CN}_{leaf}`, :math:`{CN}_{stem}`, and :math:`{CN}_{froot}` are +the target C:N ratios used during the leaf emergence phase (phase 2). .. _Other Features: @@ -611,6 +615,9 @@ and :math:`{z}_{bot}` (m), come from the AgroIBIS formulation: {z_{bot} =0.02{\rm m}} \end{array} +where :math:`z_{top}^{\max }` is the maximum top-of-canopy height of the crop (:numref:`Table Crop phenology parameters`) +and :math:`L_{\max }` is the maximum leaf area index (:numref:`Table Crop allocation parameters`). + .. _Interactive fertilization: Interactive Fertilization @@ -634,12 +641,12 @@ of CLM (e.g., CLM4) had rapid denitrification rates, fertilizer is applied slowl to minimize N loss (primarily through denitrification) and maximize plant uptake. The current implementation of CLM5 inherits this legacy, although denitrification rates are slower in the current version of the model (:ref:`Koven et al. 2013 `). As such, -fertilizer application begins during the emergence phase of crop -development and continues for 20 days, which helps reduce large losses +fertilizer application begins during the leaf emergence phase of crop +development (phase 2) and continues for 20 days, which helps reduce large losses of nitrogen from leaching and denitrification during the early stage of crop development. The 20-day period is chosen as an optimization to limit fertilizer application to the emergence stage. A fertilizer -counter in seconds, *f*, is set as soon as the onset growth for crops +counter in seconds, *f*, is set as soon as the leaf emergence phase for crops initiates: .. math:: @@ -647,10 +654,10 @@ initiates: f = n \times 86400 -where *n* is set to 20 fertilizer application days. When the crop enters -phase 2 (leaf emergence to the beginning of grain fill) of its growth +where *n* is set to 20 fertilizer application days and 86400 is the number of seconds per day. When the crop enters +phase 2 (leaf emergence) of its growth cycle, fertilizer application begins by initializing fertilizer amount -to the total fertilizer at each grid cell divided by the initialized *f*. +to the total fertilizer at each column within the grid cell divided by the initialized *f*. Fertilizer is applied and *f* is decremented each time step until a zero balance on the counter is reached. @@ -660,8 +667,8 @@ the counter is reached. Biological nitrogen fixation for soybeans '''''''''''''''''''''''''''''''''''''''''' Biological N fixation for soybeans is calculated by the fixation and uptake of -nitrogen module (Chapter :numref:`rst_FUN`). Unlike natural -vegetation, where a fraction of the vegetation are N fixers, all soybeans +nitrogen module (Chapter :numref:`rst_FUN`) and is the same as N fixation in natural vegetation. Unlike natural +vegetation, where a fraction of each pft are N fixers, all soybeans are treated as N fixers. .. _Latitude vary base tempereature for growing degree days: @@ -692,14 +699,14 @@ and sugarcane. Separate reproductive pool '''''''''''''''''''''''''''''' One notable difference between natural vegetation and crops is the -presence of a reproductive carbon pool (and nitrogen pool). Accounting -for the reproductive pool helps determine whether crops are performing +presence of reproductive carbon and nitrogen pools. Accounting +for the reproductive pools helps determine whether crops are performing reasonably through yield calculations. The reproductive pool is maintained similarly to the leaf, stem, and fine root pools, but allocation of carbon and nitrogen does not begin until the grain fill stage of crop development. Equation :eq:`25.5` describes the carbon and nitrogen allocation coefficients to the reproductive pool. -In CLM5BGCCROP, as allocation declines +In CLM5BGCCROP, as allocation declines in stem, leaf, and root pools (see section :numref:`Grain fill to harvest`) during the grain fill stage of growth, increasing amounts of carbon and nitrogen are available for grain development. @@ -771,7 +778,7 @@ the soil is :math:`N_{irr}` is the index of the soil layer corresponding to a specified depth :math:`z_{irrig}` (:numref:`Table Irrigation parameters`) and -:math:`\Delta z` is the thickness of the soil layer (section +:math:`\Delta z_{j}` is the thickness of the soil layer in layer :math:`j` (section :numref:`Vertical Discretization`). :math:`\theta_{j}` is the volumetric soil moisture in layer :math:`j` (section :numref:`Soil Water`). :math:`\theta_{target}` and @@ -786,7 +793,7 @@ the irrigation period :math:`T_{irrig}` (s). Irrigation water is applied directly to the ground surface, bypassing canopy interception (i.e., added to :math:`{q}_{grnd,liq}`: section :numref:`Canopy Water`). -To conserve mass, irrigation is removed from river water storage (Chapter 11). +To conserve mass, irrigation is removed from river water storage (Chapter :numref:`rst_River Transport Model (RTM)`). When river water storage is inadequate to meet irrigation demand, there are two options: 1) the additional water can be removed from the ocean model, or 2) the irrigation demand can be reduced such that From 6cf7a5d1b0b7fe6672e5e1aaf219a7503f181195 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Fri, 30 Jun 2017 14:22:54 -0600 Subject: [PATCH 0080/1973] One more small update to crop chapter text --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 1694764136..85c284cd89 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -305,8 +305,9 @@ Leaf emergence According to AgroIBIS, leaves may emerge when the growing degree-days of soil temperature to 0.05 m depth (:math:`GDD_{T_{soi} }` ), which is tracked since planting, reaches 1 to 5% of :math:`{GDD}_{mat}` -(see Phase 2 % :math:`{GDD}_{mat}` in :numref:`Table Crop phenology parameters`). The base temperature threshold for :math:`GDD_{T_{soi} }` -are listed in :numref:`Table Crop phenology parameters`, and leaf emergence (crop phenology phase 2) +(see Phase 2 % :math:`{GDD}_{mat}` in :numref:`Table Crop phenology parameters`). The base temperature threshold values for :math:`GDD_{T_{soi} }` +are listed in :numref:`Table Crop phenology parameters` (the same base temperature threshold values are also used for +:math:`GDD_{T_{{\rm 2m}} }` in section :numref:`Grain Fill`), and leaf emergence (crop phenology phase 2) starts when this threshold is met. Leaf onset occurs in the first time step of phase 2, at which moment all seed C is transferred to leaf C. Subsequently, the leaf area index generally increases throughout phase 2 until it reaches From 03a437d3a6ec85018d85e137d8f927b0486b6bf3 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Fri, 30 Jun 2017 17:16:50 -0600 Subject: [PATCH 0081/1973] Updates to photosynthesis chapter (canopy scaling & numerical implementation) and photosynthetic capacity chapter (included section headings and moved Vcmax calculations here, though calculation still needs to be verified) --- .../CLM50_Tech_Note_Photosynthesis.rst | 165 ++++++------------ ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 67 ++++++- 2 files changed, 117 insertions(+), 115 deletions(-) diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index de6693e76b..cfe155d42a 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -14,7 +14,10 @@ CLM5 includes the following new changes to photosynthesis and stomatal conductan - Default stomatal conductance calculation uses the Medlyn conductance model -- :math:`V_{cmax}` is predicted by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) +- :math:`J_{max}` is predicted by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) + +- Leaf N concentration and the fraction of leaf N in Rubisco used to calculate +:math:`V_{cmax}` are determined by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) - Water stress is applied by the hydraulic conductance model (Chapter :numref:`rst_Plant Hydraulics`) @@ -39,7 +42,8 @@ area indices (section :numref:`Solar Fluxes`). Canopy conductance is where :math:`r_{b}` is the leaf boundary layer resistance (section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). The implementation is described by Bonan et al. (:ref:`2011 `), though different -methods of calculating stomatal conductance and :math:`V_{cmax}` are used in CLM5. +methods of calculating stomatal conductance, :math:`J_{max}`, and the nitrogen variables +used to calculate :math:`V_{cmax}` are used in CLM5. .. _Stomatal resistance: @@ -55,7 +59,7 @@ the CO\ :sub:`1` concentration at the leaf surface. Leaf stomatal resistance is .. math:: - :label: ZEqnNum230514 + :label: 9.1 \frac{1}{r_{s} } =g_{s} =m\frac{A_{n} }{{c_{s} \mathord{\left/ {\vphantom {c_{s} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } } h_{s} +b\, \beta _{t} @@ -162,7 +166,7 @@ describe the implementation, modified here. In its simplest form, leaf net photosynthesis after accounting for respiration (:math:`R_{d}` ) is .. math:: - :label: 9.2) + :label: 9.2 A_{n} =\min \left(A_{c} ,A_{j} ,A_{p} \right)-R_{d} . @@ -171,9 +175,8 @@ The RuBP carboxylase (Rubisco) limited rate of carboxylation s\ :sup:`-1`) is .. math:: - :label: ZEqnNum141081 + :label: 9.3 - \label{ZEqnNum141081} A_{c} =\left\{\begin{array}{l} {\frac{V_{c\max } \left(c_{i} -\Gamma _{\*} \right)}{c_{i} +K_{c} \left(1+{o_{i} \mathord{\left/ {\vphantom {o_{i} K_{o} }} \right. \kern-\nulldelimiterspace} K_{o} } \right)} \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {V_{c\max } \qquad \qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}\qquad \qquad c_{i} -\Gamma _{\*} \ge 0. The maximum rate of carboxylation allowed by the capacity to regenerate @@ -181,7 +184,7 @@ RuBP (i.e., the light-limited rate) :math:`A_{j}` (:math:`\mu` \ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 9.4) + :label: 9.4 A_{j} =\left\{\begin{array}{l} {\frac{J\left(c_{i} -\Gamma _{\*} \right)}{4c_{i} +8\Gamma _{\*} } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {\alpha (4.6\phi )\qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}\qquad \qquad c_{i} -\Gamma _{\*} \ge 0. @@ -191,7 +194,7 @@ C\ :sub:`4` plants :math:`A_{p}` (:math:`\mu` \ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: ZEqnNum104028 + :label: 9.5 A_{p} =\left\{\begin{array}{l} {3T_{p\qquad } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {k_{p} \frac{c_{i} }{P_{atm} } \qquad \qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}. @@ -221,7 +224,7 @@ photosynthetically active radiation absorbed by the leaf. A common expression is the smaller of the two roots of the equation .. math:: - :label: 9.6) + :label: 9.6 \Theta _{PSII} J^{2} -\left(I_{PSII} +J_{\max } \right)J+I_{PSII} J_{\max } =0 @@ -236,7 +239,7 @@ with 4.6 :math:`\mu`\ mol J\ :sup:`-1`, the light utilized in electron transport is .. math:: - :label: 9.7) + :label: 9.7 I_{PSII} =0.5\Phi _{PSII} (4.6\phi ) @@ -253,7 +256,7 @@ The model uses co-limitation as described by Collatz et al. (1991, smaller root of the equations .. math:: - :label: 9.8) + :label: 9.8 \begin{array}{rcl} {\Theta _{cj} A_{i}^{2} -\left(A_{c} +A_{j} \right)A_{i} +A_{c} A_{j} } & {=} & {0} \\ {\Theta _{ip} A^{2} -\left(A_{i} +A_{p} \right)A+A_{i} A_{p} } & {=} & {0} \end{array} . @@ -287,21 +290,21 @@ respiration rate. The parameters :math:`V_{c\max 25}` , :math:`T_{v}` (K) as: .. math:: - :label: 9.9) + :label: 9.9 \begin{array}{rcl} {V_{c\max } } & {=} & {V_{c\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {J_{\max } } & {=} & {J_{\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {T_{p} } & {=} & {T_{p25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {R_{d} } & {=} & {R_{d25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {K_{c} } & {=} & {K_{c25} \; f\left(T_{v} \right)} \\ {K_{o} } & {=} & {K_{o25} \; f\left(T_{v} \right)} \\ {\Gamma _{*} } & {=} & {\Gamma _{*25} \; f\left(T_{v} \right)} \end{array} with .. math:: - :label: 9.10) + :label: 9.10 f\left(T_{v} \right)=\; \exp \left[\frac{\Delta H_{a} }{298.15\times 0.001R_{gas} } \left(1-\frac{298.15}{T_{v} } \right)\right] and .. math:: - :label: 9.11) + :label: 9.11 f_{H} \left(T_{v} \right)=\frac{1+\exp \left(\frac{298.15\Delta S-\Delta H_{d} }{298.15\times 0.001R_{gas} } \right)}{1+\exp \left(\frac{\Delta ST_{v} -\Delta H_{d} }{0.001R_{gas} T_{v} } \right)} . @@ -312,7 +315,7 @@ Because :math:`T_{p}` as implemented here varies with :math:`T_{p}` . For C\ :sub:`4` plants, .. math:: - :label: 9.12) + :label: 9.12 \begin{array}{l} {V_{c\max } =V_{c\max 25} \left[\frac{Q_{10} ^{(T_{v} -298.15)/10} }{f_{H} \left(T_{v} \right)f_{L} \left(T_{v} \right)} \right]} \\ {f_{H} \left(T_{v} \right)=1+\exp \left[s_{1} \left(T_{v} -s_{2} \right)\right]} \\ {f_{L} \left(T_{v} \right)=1+\exp \left[s_{3} \left(s_{4} -T_{v} \right)\right]} \end{array} @@ -323,7 +326,7 @@ with :math:`Q_{10} =2`, Additionally, .. math:: - :label: 9.13) + :label: 9.13 R_{d} =R_{d25} \left\{\frac{Q_{10} ^{(T_{v} -298.15)/10} }{1+\exp \left[s_{5} \left(T_{v} -s_{6} \right)\right]} \right\} @@ -331,7 +334,7 @@ with :math:`Q_{10} =2`, :math:`s_{5} =1.3` K\ :sup:`-1` and :math:`s_{6} =328.15`\ K, and .. math:: - :label: 9.14) + :label: 9.14 k_{p} =k_{p25} \, Q_{10} ^{(T_{v} -298.15)/10} @@ -367,7 +370,7 @@ achieved by allowing :math:`\Delta S`\ to vary with growth temperature according to .. math:: - :label: 9.15) + :label: 9.15 \begin{array}{l} {\Delta S=668.39-1.07(T_{10} -T_{f} )\qquad \qquad {\rm for\; }V_{c\max } } \\ {\Delta S=659.70-0.75(T_{10} -T_{f} )\qquad \qquad {\rm for\; }J_{\max } } \end{array} @@ -379,7 +382,7 @@ parameterization, :math:`\Delta H_{d}` \ = 200000, ratio :math:`J_{\max 25} /V_{c\max 25}` at 25 :sup:`o`\ C decreases with growth temperature as .. math:: - :label: 9.16) + :label: 9.16 J_{\max 25} /V_{c\max 25} =2.59-0.035(T_{10} -T_{f} ). @@ -388,83 +391,49 @@ temperature (K) and :math:`T_{f}` is the freezing point of water (K). For lack of data, :math:`T_{p}` acclimates similar to V :sub:`cmax` . Acclimation is restricted over the temperature range :math:`T_{10} -T_{f} \ge 11`\ :sup:`o`\ C and :math:`T_{10} -T_{f} \le 35`\ :sup:`o`\ C. -.. _V\ :sub:`cmax25` and Canopy scaling: +.. Canopy scaling: -V\ :sub:`cmax25` and Canopy scaling +Canopy scaling -------------------------------------------- -The maximum rate of carboxylation at 25 :sup:`o`\ C varies with -foliage nitrogen concentration and specific leaf area and is calculated -as in Thornton and Zimmermann (2007). At 25ºC, - -.. math:: - :label: ZEqnNum217783 - - V_{c\max 25} =N_{a} F_{LNR} F_{NR} a_{R25} - -where :math:`N_{a}` is the area-based leaf nitrogen concentration (g N -m\ :sup:`-2` leaf area), :math:`F_{LNR}` is the fraction of leaf -nitrogen in Rubisco (g N in Rubisco g\ :sup:`-1` N), -:math:`F_{NR} =7.16` is the mass ratio of total Rubisco molecular mass -to nitrogen in Rubisco (g Rubisco g\ :sup:`-1` N in Rubisco), and -:math:`a_{R25} =60` is the specific activity of Rubisco (µmol -CO\ :sub:`2` g\ :sup:`-1` Rubisco s\ :sup:`-1`). -:math:`N_{a}` is calculated from mass-based leaf N concentration and -specific leaf area - -.. math:: - :label: ZEqnNum561340 - - N_{a} =\frac{1}{CN_{L} \; SLA_{0} } - -where :math:`CN_{L}` is the leaf carbon-to-nitrogen ratio (g C -g\ :sup:`-1` N) and :math:`SLA_{0}` is specific leaf area at the -canopy top ( m\ :sup:`2` leaf area g\ :sup:`-1` C ). Table 8.1 -lists values of :math:`F_{LNR}` , :math:`CN_{L}` , and :math:`SLA_{0}` -for each plant functional type. :math:`F_{LNR}` was chosen to give -:math:`V_{c\max 25}` consistent with Kattge et al. (2009), as discussed -by Bonan et al. (2011, 2012). Table 8.1 lists derived values for -:math:`V_{c\max 25}` at the top of the canopy using :math:`SLA_{0}` . -Tropical broadleaf evergreen trees are an exception, and a higher -:math:`V_{c\max 25}` is used to alleviate model biases (Bonan et al. -2012). - :math:`V_{c\max 25}` is calculated separately for sunlit and shaded leaves using an exponential profile to area-based leaf nitrogen -(:math:`N_{a}` ), as in Bonan et al. (2011). :math:`V_{c\max 25}` at +(:math:`LNC_{a}`, see Chapter :numref:`rst_Photosynthetic Capacity` ), +as in :ref:`Bonan et al. (2011)`. :math:`V_{c\max 25}` at cumulative leaf area index :math:`x` from the canopy top scales directly -with :math:`N_{a}` , which decreases exponentially with greater +with :math:`LNC_{a}` , which decreases exponentially with greater cumulative leaf area, so that .. math:: - :label: ZEqnNum745439 + :label: 9.17 V_{c\; \max 25}^{} \left(x\right)=V_{c\; \max 25}^{} \left(0\right)e^{-K_{n} x} where :math:`V_{c\; \max 25}^{} \left(0\right)` is defined at the top of -the canopy using :math:`SLA_{0}` , and :math:`K_{n}` is the decay +the canopy using :math:`SLA_{0}`, whic is the specific leaf area at +the canopy top and :math:`K_{n}` is the decay coefficient for nitrogen. The canopy integrated value for sunlit and shaded leaves is .. math:: - :label: 9.20) + :label: 9.20 \begin{array}{rcl} {V_{c\; \max 25}^{sun} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)f_{sun} \left(x\right)\, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} } \end{array} .. math:: - :label: 9.21) + :label: 9.21 \begin{array}{rcl} {V_{c\; \max 25}^{sha} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)\left[1-f_{sun} \left(x\right)\right] \, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left\{\left[1-e^{-K_{n} L} \right]\frac{1}{K_{n} } -\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} \right\}} \end{array} and the average value for the sunlit and shaded leaves is .. math:: - :label: 9.22) + :label: 9.22 \bar{V}_{c\; \max 25}^{sun} ={V_{c\; \max 25}^{sun} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sun} L^{sun} }} \right. \kern-\nulldelimiterspace} L^{sun} } .. math:: - :label: 9.23) + :label: 9.23 \bar{V}_{c\; \max 25}^{sha} ={V_{c\; \max 25}^{sha} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sha} L^{sha} }} \right. \kern-\nulldelimiterspace} L^{sha} } . @@ -474,39 +443,16 @@ extinction coefficient (equation 4.9). Photosynthetic parameters :math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}` , and :math:`R_{d25}` scale similarly. -The value :math:`K_{n} = 0.11` chosen by Bonan et al. (2011) is +The value :math:`K_{n} = 0.11` chosen by :ref:`Bonan et al. (2011)` is consistent with observationally-derived estimates for forests, mostly tropical, and provides a gradient in V\ :sub:`cmax` similar to -the original CLM4 specific leaf area scaling. However, Bonan et al. -(2012) showed that the sunlit/shaded canopy parameterization does not +the original CLM4 specific leaf area scaling. However, +:ref:`Bonan et al. (2012)` showed that the sunlit/shaded canopy parameterization does not match an explicit multi-layer canopy parameterization. The discrepancy arises from absorption of scattered radiation by shaded leaves and can be tuned out with higher :math:`K_{n}` . The model uses :math:`K_{n} =0.30` to match an explicit multi-layer canopy. -:math:`V_{c\max 25}` additionally varies with daylength (:math:`DYL`) -using the function :math:`f(DYL)`, which introduces seasonal variation -to :math:`V_{c\max }` - -.. math:: - :label: 9.24) - - f\left(DYL\right)=\frac{\left(DYL\right)^{2} }{\left(DYL_{\max } \right)^{2} } - -with :math:`0.01\le f\left(DYL\right)\le 1`. Daylength (seconds) is -given by - -.. math:: - :label: 9.25) - - DYL=2\times 13750.9871\cos ^{-1} \left[\frac{-\sin \left(lat\right)\sin \left(decl\right)}{\cos \left(lat\right)\cos \left(decl\right)} \right] - -where :math:`lat` (latitude) and :math:`decl` (declination angle) are -from section 3.3. Maximum daylength (:math:`DYL_{\max }` ) is calculated -similarly but using the maximum declination angle for present-day -orbital geometry (:math:`\pm`\ 23.4667º [:math:`\pm`\ 0.409571 radians], -positive for Northern Hemisphere latitudes and negative for Southern -Hemisphere). .. _Numerical implementation photosynthesis: @@ -516,29 +462,29 @@ Numerical implementation The CO\ :sub:`2` partial pressure at the leaf surface :math:`c_{s}` (Pa) and the vapor pressure at the leaf surface :math:`e_{s}` (Pa), needed for the stomatal resistance model in -equation , and the internal leaf CO\ :sub:`2` partial pressure -:math:`c_{i}` (Pa), needed for the photosynthesis model in equations -, +equation :eq:`9.1`, and the internal leaf CO\ :sub:`2` partial pressure +:math:`c_{i}` (Pa), needed for the photosynthesis model in equations :eq:`9.3`-:eq:`9.5`, are calculated assuming there is negligible capacity to store CO\ :sub:`2` and water vapor at the leaf surface so that .. math:: - :label: ZEqnNum581596 + :label: 9.31 A_{n} =\frac{c_{a} -c_{i} }{\left(1.4r_{b} +1.6r_{s} \right)P_{atm} } =\frac{c_{a} -c_{s} }{1.4r_{b} P_{atm} } =\frac{c_{s} -c_{i} }{1.6r_{s} P_{atm} } and the transpiration fluxes are related as .. math:: - :label: ZEqnNum323660 + :label: 9.32 \frac{e_{a} -e_{i} }{r_{b} +r_{s} } =\frac{e_{a} -e_{s} }{r_{b} } =\frac{e_{s} -e_{i} }{r_{s} } where :math:`r_{b}` is leaf boundary layer resistance (s -m\ :sup:`2` :math:`\mu` \ mol\ :sup:`-1`) (section 5.3), the +m\ :sup:`2` :math:`\mu` \ mol\ :sup:`-1`) (section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`), the terms 1.4 and 1.6 are the ratios of diffusivity of CO\ :sub:`2` to H\ :sub:`2`\ O for the leaf boundary layer resistance and stomatal resistance, -:math:`c_{a} ={\rm CO}_{{\rm 2}} \left({\rm mol\; mol}^{{\rm -1}} \right)P_{atm}` +:math:`c_{a} ={\rm CO}_{{\rm 2}} \left({\rm mol\; mol}^{{\rm -1}} \right)`, :math:`P_{atm}` is the atmospheric CO\ :sub:`2` partial pressure (Pa) calculated from CO\ :sub:`2` concentration (ppmv), :math:`e_{i}` is the saturation vapor pressure (Pa) evaluated at the leaf temperature @@ -547,31 +493,32 @@ The vapor pressure of air in the plant canopy :math:`e_{a}` (Pa) is determined from .. math:: - :label: 9.33) + :label: 9.33 e_{a} =\frac{P_{atm} q_{s} }{0.622} where :math:`q_{s}` is the specific humidity of canopy air (kg -kg\ :sup:`-1`) (section 5.3). Equations and are solved for +kg\ :sup:`-1`) (section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). +Equations and are solved for :math:`c_{s}` and :math:`e_{s}` .. math:: - :label: 9.34) + :label: 9.34 c_{s} =c_{a} -1.4r_{b} P_{atm} A_{n} .. math:: - :label: ZEqnNum123611 + :label: 9.35 e_{s} =\frac{e_{a} r_{s} +e_{i} r_{b} }{r_{b} +r_{s} } -Substitution of equation into equation gives an expression for stomatal +Substitution of equation :eq:`9.35` into equation :eq:`9.1` gives an expression for stomatal resistance (:math:`r_{s}` ) as a function of photosynthesis (:math:`A_{n}` ), given here in terms of conductance with :math:`g_{s} =1/r_{s}` and :math:`g_{b} =1/r_{b}` .. math:: - :label: 9.36) + :label: 9.36 c_{s} g_{s}^{2} +\left[c_{s} \left(g_{b} -b\right)-m{\it A}_{n} P_{atm} \right]g_{s} -g_{b} \left[c_{s} b+mA_{n} P_{atm} {e_{a} \mathord{\left/ {\vphantom {e_{a} e_{\*} \left(T_{v} \right)}} \right. \kern-\nulldelimiterspace} e_{\*} \left(T_{v} \right)} \right]=0. @@ -579,13 +526,13 @@ Stomatal conductance is the larger of the two roots that satisfy the quadratic equation. Values for :math:`c_{i}` are given by .. math:: - :label: 9.37) + :label: 9.37 c_{i} =c_{a} -\left(1.4r_{b} +1.6r_{s} \right)P_{atm} A{}_{n} The equations for :math:`c_{i}` , :math:`c_{s}` , :math:`r_{s}` , and :math:`A_{n}` are solved iteratively until :math:`c_{i}` converges. -Sun et al. (2012) pointed out that the CLM4 numerical approach does not +:ref:`Sun et al. (2012)` pointed out that the CLM4 numerical approach does not always converge. Therefore, the model uses a hybrid algorithm that combines the secant method and Brent’s method to solve for :math:`c_{i}` . The equation set is solved separately for sunlit @@ -593,19 +540,19 @@ combines the secant method and Brent’s method to solve for (:math:`A_{n}^{sha}` , :math:`r_{s}^{sha}` ) leaves. The model has an optional (though not supported) multi-layer canopy, as -described by Bonan et al. (2012). The multi-layer model is only intended +described by :ref:`Bonan et al. (2012)`. The multi-layer model is only intended to address the non-linearity of light profiles, photosynthesis, and stomatal conductance in the plant canopy. In the multi-layer canopy, sunlit (:math:`A_{n}^{sun}` , :math:`r_{s}^{sun}` ) and shaded (:math:`A_{n}^{sha}` , :math:`r_{s}^{sha}` ) leaves are explicitly -resolved at depths in the canopy using a light profile (Chapter 4). In +resolved at depths in the canopy using a light profile (Chapter :numref:`rst_Radiative Fluxes`). In this case, :math:`V_{c\max 25}` is not integrated over the canopy, but is instead given explicitly for each canopy layer using equation . This -also uses the Lloyd et al. (2010) relationship whereby +also uses the :ref:`Lloyd et al. (2010)` relationship whereby K\ :sub:`n` scales with V\ :sub:`cmax` as .. math:: - :label: 9.38) + :label: 9.38 K_{n} =\exp \left(0.00963V_{c\max } -2.43\right) diff --git a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst index 0f24520566..704f0d4be5 100755 --- a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst +++ b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst @@ -48,6 +48,9 @@ we do not differentiate the photosynthetic capacity difference for sun-lit or sh Model structure ---------------------------------------------------------- +Plant Nitrogen +'''''''''''''''''''''''''' + The structure of the LUNA model is adapted from Xu et al.(2012), where the plant nitrogen at the leaf level ( :math:`\text{LNC}_{a}`; gN/ m :sup:`2` leaf) is divided into four pools: structural nitrogen( :math:`N_{\text{str}}`; gN/m :sup:`2` leaf), photosynthetic nitrogen ( :math:`N_{\text{psn}}`; gN/ m:sup:`2` leaf), @@ -100,6 +103,9 @@ The gross photosynthesis, :math:`A`, was calculated with a coupled leaf gas exc photosynthesis and Ball--Berry-type stomatal conductance model (Ball et al., 1987). The maintenance respiration for photosynthetic enzymes, :math:`R_{\text{psn}}`, is calculated by the multiplication of total photosynthetic nitrogen ( :math:`N_{\text{psn}}` ) and the maintenance respiration cost for photosynthetic enzymes. +Maximum electron transport rate +'''''''''''''''''''''' + In the LUNA model, the maximum electron transport rate ( :math:`J_{\text{max}}`; :math:`{\mu} mol` electron / m :sup:`-2`/s) is simulated to have a baseline allocation of nitrogen and additional @@ -182,6 +188,52 @@ empirical expression of leaf (1937), where :math:`\text{PAR}_{\text{{max}}}` ( :math:`\mu mol`/m :sup:`2`/s) is the maximum photosynthetically active radiation during the day. +Maximum rate of carboxylation +''''''''''''''''' + +The maximum rate of carboxylation at 25 :sup:`o`\ C varies with +foliage nitrogen concentration and specific leaf area and is calculated +as in Thornton and Zimmermann (2007). At 25ºC, + +.. math:: + :label: 10.11) + + V_{c\max 25} =N_{str} N_{cb} F_{NR} a_{R25} + +where :math:`N_{str}` is the area-based leaf nitrogen concentration (g N +m\ :sup:`-2` leaf area), :math:`N_{cb}` is the fraction of leaf +nitrogen in Rubisco (g N in Rubisco g\ :sup:`-1` N), +:math:`F_{NR} =7.16` is the mass ratio of total Rubisco molecular mass +to nitrogen in Rubisco (g Rubisco g\ :sup:`-1` N in Rubisco), and +:math:`a_{R25} =60` is the specific activity of Rubisco (µmol +CO\ :sub:`2` g\ :sup:`-1` Rubisco s\ :sup:`-1`). + +:math:`V_{c\max 25}` additionally varies with daylength (:math:`DYL`) +using the function :math:`f(DYL)`, which introduces seasonal variation +to :math:`V_{c\max }` + +.. math:: + :label: 10.12) + + f\left(DYL\right)=\frac{\left(DYL\right)^{2} }{\left(DYL_{\max } \right)^{2} } + +with :math:`0.01\le f\left(DYL\right)\le 1`. Daylength (seconds) is +given by + +.. math:: + :label: 10.13) + + DYL=2\times 13750.9871\cos ^{-1} \left[\frac{-\sin \left(lat\right)\sin \left(decl\right)}{\cos \left(lat\right)\cos \left(decl\right)} \right] + +where :math:`lat` (latitude) and :math:`decl` (declination angle) are +from section :numref:`Solar Zenith Angle`. Maximum daylength (:math:`DYL_{\max }` ) is calculated +similarly but using the maximum declination angle for present-day +orbital geometry (:math:`\pm`\ 23.4667º [:math:`\pm`\ 0.409571 radians], +positive for Northern Hemisphere latitudes and negative for Southern +Hemisphere). + +Implementation of Photosynthetic Capacity +''''''''''''''''' Based on Farquhar et al. (1980) and Wullschleger (1993), we can calculate the electron-limited photosynthetic rate under daily maximum radiation ( :math:`W_{jx}`) @@ -189,12 +241,12 @@ and the Rubisco-limited photosynthetic rate ( :math:`W_{\mathrm{c}}`) as follows .. math:: - :label: 10.11) + :label: 10.14) W_{J_{x}} = K_{j}J_{x} , .. math:: - :label: 10.12) + :label: 10.15) W_{\mathrm{c}} = K_{\mathrm{c}} V_{{\mathrm{c}, \text{max}}}, @@ -207,7 +259,7 @@ assume that :math:`W_{\mathrm{c}}` is proportional to :math:`W_{J_{x}}`. Specifically, we have .. math:: - :label: 10.13) + :label: 10.16) W_{\mathrm{c}}=t_{\alpha}t_{\mathrm{c}, j0}W_{J_{x}} @@ -218,11 +270,14 @@ nitrogen use efficiency of carboxylation and electron transport (Ainsworth and R therefore the LUNA model has the modification factor, :math:`t_{\alpha}`, to adjust baseline the ratio depending on the nitrogen use efficiency for electron vs carboxylation (Ali et al 2016). +Total Respiration +''''''''''''''' + Following Collatz et al.(1991a), the total respiration ( :math:`R_{\mathrm{t}}`) is calculated in proportion to :math:`V_{\text{c,max}}`, .. math:: - :label: 10.14) + :label: 10.17) R_{\mathrm{t}} = 0.015 V_{\text{c,max}}. @@ -231,7 +286,7 @@ Accounting for the daytime and nighttime temperature, the daily respirations is .. math:: - :label: 10.15) + :label: 10.18) R_{\text{td}}={R}_{\mathrm{t}} [D_{\text{day}} + D_{\text{night}} f_{\mathrm{r}}{(T_{\text{night}})/f_{\mathrm{r}}{(T_{\text{day}})}}], @@ -253,4 +308,4 @@ by incrementally increase the nitrogen allocated for light capture (i.e., :math We assume that plants only optimize the nitrogen allocation when they can grow (i.e., GPP>0.0). If GPP become zero under stress, then the LUNA model assume a certain amount of enzyme will decay at daily rates of 0.1, in view that the half-life time for photosynthetic enzymes are short (~7 days) (Suzuki et al. 2001). -To avoid unrealistic low values of photosynthetic capacity, the decay is only limited to 50 percent of the original enzyme levels. \ No newline at end of file +To avoid unrealistic low values of photosynthetic capacity, the decay is only limited to 50 percent of the original enzyme levels. From b005a83568b118ea26a34e28c7f9d70a0e43eb29 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Thu, 27 Jul 2017 16:16:47 -0600 Subject: [PATCH 0082/1973] Updates to the stomatal conductance section of the photosynthesis chapter --- .../CLM50_Tech_Note_Photosynthesis.rst | 165 +++++++++--------- ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 8 +- 2 files changed, 88 insertions(+), 85 deletions(-) diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index cfe155d42a..163c476d08 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -16,8 +16,7 @@ CLM5 includes the following new changes to photosynthesis and stomatal conductan - :math:`J_{max}` is predicted by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) -- Leaf N concentration and the fraction of leaf N in Rubisco used to calculate -:math:`V_{cmax}` are determined by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) +- Leaf N concentration and the fraction of leaf N in Rubisco used to calculate :math:`V_{cmax25}` are determined by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) - Water stress is applied by the hydraulic conductance model (Chapter :numref:`rst_Plant Hydraulics`) @@ -43,54 +42,54 @@ where :math:`r_{b}` is the leaf boundary layer resistance (section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). The implementation is described by Bonan et al. (:ref:`2011 `), though different methods of calculating stomatal conductance, :math:`J_{max}`, and the nitrogen variables -used to calculate :math:`V_{cmax}` are used in CLM5. +used to calculate :math:`V_{cmax25}` are used in CLM5. .. _Stomatal resistance: Stomatal resistance ----------------------- -Leaf stomatal resistance is calculated from the Ball-Berry conductance -model as described by Collatz et al. (1991) and implemented in global -climate models (Sellers et al. 1996). The model relates stomatal -conductance (i.e., the inverse of resistance) to net leaf -photosynthesis, scaled by the relative humidity at the leaf surface and -the CO\ :sub:`1` concentration at the leaf surface. Leaf stomatal -resistance is +CLM5 calculates stomatal conductance using the Medlyn stomatal conductance model (:ref:`Medlyn et al. 2011`). +Previous versions of CLM calculated leaf stomatal resistance is using the Ball-Berry conductance +model as described by :ref:`Collatz et al. (1991)` and implemented in global +climate models (:ref:`Sellers et al. 1996`). The Medlyn model +calculates stomatal conductance (i.e., the inverse of resistance) based on net leaf +photosynthesis, the vapor pressure deficit, and the CO\ :sub:`2` concentration at the leaf surface. +Leaf stomatal resistance is: .. math:: :label: 9.1 - \frac{1}{r_{s} } =g_{s} =m\frac{A_{n} }{{c_{s} \mathord{\left/ {\vphantom {c_{s} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } } h_{s} +b\, \beta _{t} + \frac{1}{r_{s} } =g_{s} = g_{o} + (1 + \frac{g_{1} }{\sqrt{D}}) \frac{A_{n} }{{c_{s} \mathord{\left/ {\vphantom {c_{s} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } } where :math:`r_{s}` is leaf stomatal resistance (s m\ :sup:`2` -:math:`\mu`\ mol\ :sup:`-1`), :math:`m` is a plant functional -type dependent parameter (Table 8.1), :math:`A_{n}` is leaf net +:math:`\mu`\ mol\ :sup:`-1`), :math:`g_{o}` is the minimum stomatal conductance +(:math:`\mu` mol m :sup:`-2` s\ :sup:`-1`), :math:`A_{n}` is leaf net photosynthesis (:math:`\mu`\ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`), :math:`c_{s}` is the CO\ :sub:`2` partial pressure at the leaf surface (Pa), :math:`P_{atm}` is the atmospheric -pressure (Pa), :math:`h_{s} =e_{s} /e_{i}` is the leaf surface humidity -with :math:`e_{s}` the vapor pressure at the leaf surface (Pa) and -:math:`e_{i}` the saturation vapor pressure (Pa) inside the leaf at the -vegetation temperature\ :math:`T_{v}`, and :math:`b` is the minimum -stomatal conductance (:math:`\mu` mol m :sup:`-2` -s\ :sup:`-1`). Parameter values are :math:`m=9` for -C\ :sub:`3` plants and :math:`m=4` for C\ :sub:`4` plants -(Collatz et al. 1991, 1992, Sellers et al. 1996). Sellers et al. (1996) -used :math:`b=10000` for C\ :sub:`3` plants and -:math:`b=40000` for C\ :sub:`4` plants, also used here. +pressure (Pa), and :math:`D` is the vapor pressure deficit at the leaf surface (Pa). +:math:`g_{1}` is a plant functional type dependent parameter (:numref:`Table Plant functional type (PFT) photosynthetic parameters`) +and can be calculated as + +.. math:: + :label: 9.2 + + g_{1} = {\sqrt{\frac{3\Gamma*\lambda}{1.6}}} + +Parameter values are :math:`g_{o}=X` for +C\ :sub:`3` plants and :math:`g_{o}=4` for C\ :sub:`4` plants Photosynthesis is calculated for sunlit (:math:`A^{sun}`) and shaded (:math:`A^{sha}`) leaves to give :math:`r_{s}^{sun}` and :math:`r_{s}^{sha}`. Additionally, soil water influences stomatal -resistance directly by multiplying the minimum conductance by a soil -water stress function :math:`\beta _{t}` (which ranges from 0 to 1) and -also indirectly through :math:`A_{n}`, as in (Sellers et al. 1996). +resistance through plant hydraulic stress, detailed in +the :ref:`rst_Plant Hydraulics` chapter. Resistance is converted from units of s m\ :sup:`2` :math:`\mu` mol\ :sub:`-1` to s m\ :sup:`-1` as: -1 s m\ sup:`-1` = :math:`1\times 10^{-9} R_{gas} \frac{\theta _{atm} }{P_{atm} }` +1 s m\ :sup:`-1` = :math:`1\times 10^{-9} R_{gas} \frac{\theta _{atm} }{P_{atm} }` :math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, where :math:`R_{gas}` is the universal gas constant (J K\ :sup:`-1` -kmol\ :sup:`-1`) (Table 2.6) and :math:`\theta _{atm}` is the +kmol\ :sup:`-1`) (:numref:`Table Physical constants`) and :math:`\theta _{atm}` is the atmospheric potential temperature (K). .. _Table Plant functional type (PFT) photosynthetic parameters: @@ -160,13 +159,13 @@ Photosynthesis ------------------ Photosynthesis in C\ :sub:`3` plants is based on the model of -Farquhar et al. (1980). Photosynthesis in C\ :sub:`4` plants is -based on the model of Collatz et al. (1992). Bonan et al. (2011) +:ref:`Farquhar et al. (1980)`. Photosynthesis in C\ :sub:`4` plants is +based on the model of :ref:`Collatz et al. (1992)`. :ref:`Bonan et al. (2011)` describe the implementation, modified here. In its simplest form, leaf net photosynthesis after accounting for respiration (:math:`R_{d}` ) is .. math:: - :label: 9.2 + :label: 9.3 A_{n} =\min \left(A_{c} ,A_{j} ,A_{p} \right)-R_{d} . @@ -175,7 +174,7 @@ The RuBP carboxylase (Rubisco) limited rate of carboxylation s\ :sup:`-1`) is .. math:: - :label: 9.3 + :label: 9.4 A_{c} =\left\{\begin{array}{l} {\frac{V_{c\max } \left(c_{i} -\Gamma _{\*} \right)}{c_{i} +K_{c} \left(1+{o_{i} \mathord{\left/ {\vphantom {o_{i} K_{o} }} \right. \kern-\nulldelimiterspace} K_{o} } \right)} \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {V_{c\max } \qquad \qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}\qquad \qquad c_{i} -\Gamma _{\*} \ge 0. @@ -184,7 +183,7 @@ RuBP (i.e., the light-limited rate) :math:`A_{j}` (:math:`\mu` \ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 9.4 + :label: 9.5 A_{j} =\left\{\begin{array}{l} {\frac{J\left(c_{i} -\Gamma _{\*} \right)}{4c_{i} +8\Gamma _{\*} } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {\alpha (4.6\phi )\qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}\qquad \qquad c_{i} -\Gamma _{\*} \ge 0. @@ -194,7 +193,7 @@ C\ :sub:`4` plants :math:`A_{p}` (:math:`\mu` \ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 9.5 + :label: 9.6 A_{p} =\left\{\begin{array}{l} {3T_{p\qquad } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {k_{p} \frac{c_{i} }{P_{atm} } \qquad \qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}. @@ -210,12 +209,12 @@ m\ :sup:`-2` s\ :sup:`-1`). :math:`T_{p}` is the triose phosphate utilization rate (µmol m\ :sup:`-2` s\ :sup:`-1`), taken as :math:`T_{p} =0.167V_{c\max }` so that :math:`A_{p} =0.5V_{c\max }` for C\ :sub:`3` plants (as in -Collatz et al. 1991). For C\ :sub:`4` plants, the light-limited +:ref:`Collatz et al. 1992 `). For C\ :sub:`4` plants, the light-limited rate :math:`A_{j}` varies with :math:`\phi` in relation to the quantum efficiency (:math:`\alpha =0.05` mol CO\ :sub:`2` mol\ :sup:`-1` photon). :math:`\phi` is the absorbed -photosynthetically active radiation (W m\ :sup:`-2`) (section -4.1), which is converted to photosynthetic photon flux assuming 4.6 +photosynthetically active radiation (W m\ :sup:`-2`) (section :numref:`Solar Fluxes`) +, which is converted to photosynthetic photon flux assuming 4.6 :math:`\mu` \ mol photons per joule. :math:`k_{p}` is the initial slope of C\ :sub:`4` CO\ :sub:`2` response curve. @@ -224,7 +223,7 @@ photosynthetically active radiation absorbed by the leaf. A common expression is the smaller of the two roots of the equation .. math:: - :label: 9.6 + :label: 9.7 \Theta _{PSII} J^{2} -\left(I_{PSII} +J_{\max } \right)J+I_{PSII} J_{\max } =0 @@ -239,7 +238,7 @@ with 4.6 :math:`\mu`\ mol J\ :sup:`-1`, the light utilized in electron transport is .. math:: - :label: 9.7 + :label: 9.8 I_{PSII} =0.5\Phi _{PSII} (4.6\phi ) @@ -251,12 +250,12 @@ calculating :math:`A_{j}` (for both C\ :sub:`3` and C\ :sub:`4` plants), :math:`\phi =\phi ^{sun}` for sunlit leaves and :math:`\phi =\phi ^{sha}` for shaded leaves. -The model uses co-limitation as described by Collatz et al. (1991, -1992). The actual gross photosynthesis rate, :math:`A`, is given by the +The model uses co-limitation as described by :ref:`Collatz et al. (1991, 1992) +`. The actual gross photosynthesis rate, :math:`A`, is given by the smaller root of the equations .. math:: - :label: 9.8 + :label: 9.9 \begin{array}{rcl} {\Theta _{cj} A_{i}^{2} -\left(A_{c} +A_{j} \right)A_{i} +A_{c} A_{j} } & {=} & {0} \\ {\Theta _{ip} A^{2} -\left(A_{i} +A_{p} \right)A+A_{i} A_{p} } & {=} & {0} \end{array} . @@ -265,57 +264,61 @@ C\ :sub:`3` plants; and :math:`\Theta _{cj} =0.80`\ and :math:`\Theta _{ip} =0.95` for C\ :sub:`4` plants. :math:`A_{n} =A-R_{d}` . -The parameters :math:`K_{c}`, :math:`K_{o}` , and :math:`\Gamma _{*}` +The parameters :math:`K_{c}`, :math:`K_{o}`, and :math:`\Gamma _{*}` depend on temperature. Values at 25 :sup:`o` \ C are -:math:`K_{c25} ={\rm 4}0{\rm 4}.{\rm 9}\times 10^{-6} P_{atm}` , -:math:`K_{o25} =278.4\times 10^{-3} P_{atm}` , and -:math:`\Gamma _{*25} {\rm =42}.75\times 10^{-6} P_{atm}` . -:math:`V_{c\max }` , :math:`J_{\max }` , :math:`T_{p}` , :math:`k_{p}` , -and :math:`R_{d}` also vary with temperature. Parameter values at 25 +:math:`K_{c25} ={\rm 4}0{\rm 4}.{\rm 9}\times 10^{-6} P_{atm}`, +:math:`K_{o25} =278.4\times 10^{-3} P_{atm}`, and +:math:`\Gamma _{*25} {\rm =42}.75\times 10^{-6} P_{atm}`. +:math:`V_{c\max }`, :math:`J_{\max }`, :math:`T_{p}`, :math:`k_{p}`, +and :math:`R_{d}` also vary with temperature. Parameter values at 25 :math:`\circ`\ C are calculated from :math:`V_{c\max }` \ at 25 -:math:`\circ`\ C: :math:`J_{\max 25} =1.97V_{c\max 25}` , -:math:`T_{p25} =0.167V_{c\max 25}` , and -:math:`R_{d25} =0.015V_{c\max 25}` (C\ :sub:`3`) and -:math:`R_{d25} =0.025V_{c\max 25}` (C\ :sub:`4`). For -C\ :sub:`4` plants, :math:`k_{p25} =20000\; V_{c\max 25}` . +:math:`\circ`\ C: :math:`J_{\max 25} =1.97V_{c\max 25}`, +:math:`T_{p25} =0.167V_{c\max 25}`, and +:math:`R_{d25} =0.015V_{c\max 25}` (C\ :sub:`3`) and +:math:`R_{d25} =0.025V_{c\max 25}` (C\ :sub:`4`). For +C\ :sub:`4` plants, :math:`k_{p25} =20000\; V_{c\max 25}`. However, when the biogeochemistry is active, :math:`R_{d25}` is -calculated from leaf nitrogen as :math:`R_{d25} =0.2577N_{a}` , where -:math:`N_{a}` is the area-based leaf nitrogen concentration (g N -m\ :sup:`-2` leaf area, equation ) and 0.2577 :math:`\mu`\ mol -CO\ :sub:`2` g\ :sup:`-1` N s\ :sup:`-1` the base -respiration rate. The parameters :math:`V_{c\max 25}` , -:math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}` , and -:math:`R_{d25}` are scaled over the canopy for sunlit and shaded leaves -(section 8.3). In C3 plants, these are adjusted for leaf temperature -:math:`T_{v}` (K) as: +calculated from leaf nitrogen as :math:`R_{d25} = 0.2577LNC_{a}`, +where :math:`LNC_{a}` is the area-based leaf nitrogen concentration +(g N m\ :sup:`-2` leaf area, Chapter :numref:`rst_Photosynthetic Capacity`), +and 0.2577 :math:`\mu`\ mol CO\ :sub:`2` g\ :sup:`-1` N s\ :sup:`-1` is the base respiration rate. +The parameters :math:`V_{c\max 25}`, +:math:`J_{\max 25}`, :math:`T_{p25}`, :math:`k_{p25}`, and +:math:`R_{d25}` are scaled over the canopy for sunlit and shaded leaves +(section :numref:`Canopy scaling`). In C\ :sub:`3` plants, these are adjusted for leaf temperature, +:math:`T_{v}` (K), as: .. math:: - :label: 9.9 + :label: 9.10 \begin{array}{rcl} {V_{c\max } } & {=} & {V_{c\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {J_{\max } } & {=} & {J_{\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {T_{p} } & {=} & {T_{p25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {R_{d} } & {=} & {R_{d25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {K_{c} } & {=} & {K_{c25} \; f\left(T_{v} \right)} \\ {K_{o} } & {=} & {K_{o25} \; f\left(T_{v} \right)} \\ {\Gamma _{*} } & {=} & {\Gamma _{*25} \; f\left(T_{v} \right)} \end{array} with .. math:: - :label: 9.10 + :label: 9.11 f\left(T_{v} \right)=\; \exp \left[\frac{\Delta H_{a} }{298.15\times 0.001R_{gas} } \left(1-\frac{298.15}{T_{v} } \right)\right] and .. math:: - :label: 9.11 + :label: 9.12 f_{H} \left(T_{v} \right)=\frac{1+\exp \left(\frac{298.15\Delta S-\Delta H_{d} }{298.15\times 0.001R_{gas} } \right)}{1+\exp \left(\frac{\Delta ST_{v} -\Delta H_{d} }{0.001R_{gas} T_{v} } \right)} . -Table 8.2 list parameter values for :math:`\Delta H_{a}` , -:math:`\Delta H_{d}` , and :math:`\Delta S`, from Bonan et al. (2011). +:numref:`Table Temperature dependence parameters for C3 photosynthesis` +lists parameter values for :math:`\Delta H_{a}` , +:math:`\Delta H_{d}` , and :math:`\Delta S`, from :ref:`Bonan et al. (2011)`. +[Note: should we remove :math:`\Delta S` from the table below since we no longer use these? +Also, we should consider updating :math:`\Delta H_{a}` , +:math:`\Delta H_{d}` in this table] Because :math:`T_{p}` as implemented here varies with -:math:`V_{c\max }` , the same temperature parameters are used for -:math:`T_{p}` . For C\ :sub:`4` plants, +:math:`V_{c\max }` , :math:`T_{p}` uses the same temperature parameters as +:math:`V_{c\max}` . For C\ :sub:`4` plants, .. math:: - :label: 9.12 + :label: 9.13 \begin{array}{l} {V_{c\max } =V_{c\max 25} \left[\frac{Q_{10} ^{(T_{v} -298.15)/10} }{f_{H} \left(T_{v} \right)f_{L} \left(T_{v} \right)} \right]} \\ {f_{H} \left(T_{v} \right)=1+\exp \left[s_{1} \left(T_{v} -s_{2} \right)\right]} \\ {f_{L} \left(T_{v} \right)=1+\exp \left[s_{3} \left(s_{4} -T_{v} \right)\right]} \end{array} @@ -326,7 +329,7 @@ with :math:`Q_{10} =2`, Additionally, .. math:: - :label: 9.13 + :label: 9.14 R_{d} =R_{d25} \left\{\frac{Q_{10} ^{(T_{v} -298.15)/10} }{1+\exp \left[s_{5} \left(T_{v} -s_{6} \right)\right]} \right\} @@ -334,7 +337,7 @@ with :math:`Q_{10} =2`, :math:`s_{5} =1.3` K\ :sup:`-1` and :math:`s_{6} =328.15`\ K, and .. math:: - :label: 9.14 + :label: 9.15 k_{p} =k_{p25} \, Q_{10} ^{(T_{v} -298.15)/10} @@ -362,36 +365,36 @@ with :math:`Q_{10} =2`. | :math:`\Gamma _{\*}` | 37830 | – | – | +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ -The parameters in numref:`Table Temperature dependence parameters for C3 photosynthesis` +The parameters in :numref:`Table Temperature dependence parameters for C3 photosynthesis` do not allow for temperature acclimation of photosynthesis. In the model, acclimation is implemented as in :ref:`Kattge and Knorr (2007) `. In this parameterization, :math:`V_{c\max }` and :math:`J_{\max }` vary with the plant growth temperature. This is -achieved by allowing :math:`\Delta S`\ to vary with growth temperature +achieved by allowing :math:`\Delta S`\ to vary with growth temperature according to .. math:: - :label: 9.15 + :label: 9.16 \begin{array}{l} {\Delta S=668.39-1.07(T_{10} -T_{f} )\qquad \qquad {\rm for\; }V_{c\max } } \\ {\Delta S=659.70-0.75(T_{10} -T_{f} )\qquad \qquad {\rm for\; }J_{\max } } \end{array} The effect is to cause the temperature optimum of :math:`V_{c\max }` -and :math:`J_{\max }` to increase with warmer temperature. In this +and :math:`J_{\max }` to increase with warmer temperatures. In this parameterization, :math:`\Delta H_{d}` \ = 200000, :math:`\Delta H_{a}` \ = 72000 for :math:`V_{c\max }` , and :math:`\Delta H_{a}` \ = 50000 for :math:`J_{\max }` . Additionally, the ratio :math:`J_{\max 25} /V_{c\max 25}` at 25 :sup:`o`\ C decreases with growth temperature as .. math:: - :label: 9.16 + :label: 9.17 J_{\max 25} /V_{c\max 25} =2.59-0.035(T_{10} -T_{f} ). In these acclimation functions, :math:`T_{10}` is the 10-day mean air temperature (K) and :math:`T_{f}` is the freezing point of water (K). -For lack of data, :math:`T_{p}` acclimates similar to V :sub:`cmax` . Acclimation is restricted over the temperature +For lack of data, :math:`T_{p}` acclimates similar to :math:`V_{c\max }`. Acclimation is restricted over the temperature range :math:`T_{10} -T_{f} \ge 11`\ :sup:`o`\ C and :math:`T_{10} -T_{f} \le 35`\ :sup:`o`\ C. -.. Canopy scaling: +.. _Canopy scaling: Canopy scaling -------------------------------------------- @@ -405,7 +408,7 @@ with :math:`LNC_{a}` , which decreases exponentially with greater cumulative leaf area, so that .. math:: - :label: 9.17 + :label: 9.18 V_{c\; \max 25}^{} \left(x\right)=V_{c\; \max 25}^{} \left(0\right)e^{-K_{n} x} @@ -547,7 +550,7 @@ sunlit (:math:`A_{n}^{sun}` , :math:`r_{s}^{sun}` ) and shaded (:math:`A_{n}^{sha}` , :math:`r_{s}^{sha}` ) leaves are explicitly resolved at depths in the canopy using a light profile (Chapter :numref:`rst_Radiative Fluxes`). In this case, :math:`V_{c\max 25}` is not integrated over the canopy, but -is instead given explicitly for each canopy layer using equation . This +is instead given explicitly for each canopy layer using equation :eq:`9.18`. This also uses the :ref:`Lloyd et al. (2010)` relationship whereby K\ :sub:`n` scales with V\ :sub:`cmax` as diff --git a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst index 704f0d4be5..0c99101fa0 100755 --- a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst +++ b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst @@ -104,7 +104,7 @@ photosynthesis and Ball--Berry-type stomatal conductance model (Ball et al., 198 calculated by the multiplication of total photosynthetic nitrogen ( :math:`N_{\text{psn}}` ) and the maintenance respiration cost for photosynthetic enzymes. Maximum electron transport rate -'''''''''''''''''''''' +''''''''''''''''''''''''''''''''' In the LUNA model, the maximum electron transport rate ( :math:`J_{\text{max}}`; :math:`{\mu} mol` electron / m :sup:`-2`/s) @@ -189,7 +189,7 @@ where :math:`\text{PAR}_{\text{{max}}}` ( :math:`\mu mol`/m :sup:`2`/s) is the maximum photosynthetically active radiation during the day. Maximum rate of carboxylation -''''''''''''''''' +'''''''''''''''''''''''''''''' The maximum rate of carboxylation at 25 :sup:`o`\ C varies with foliage nitrogen concentration and specific leaf area and is calculated @@ -233,7 +233,7 @@ positive for Northern Hemisphere latitudes and negative for Southern Hemisphere). Implementation of Photosynthetic Capacity -''''''''''''''''' +'''''''''''''''''''''''''''''''''''''''''' Based on Farquhar et al. (1980) and Wullschleger (1993), we can calculate the electron-limited photosynthetic rate under daily maximum radiation ( :math:`W_{jx}`) @@ -271,7 +271,7 @@ therefore the LUNA model has the modification factor, :math:`t_{\alpha}`, to adj the ratio depending on the nitrogen use efficiency for electron vs carboxylation (Ali et al 2016). Total Respiration -''''''''''''''' +''''''''''''''''''' Following Collatz et al.(1991a), the total respiration ( :math:`R_{\mathrm{t}}`) is calculated in proportion to :math:`V_{\text{c,max}}`, From 073dddd8d41a0d07b0ae0ebcbfcfe97559268493 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Mon, 31 Jul 2017 17:40:28 -0600 Subject: [PATCH 0083/1973] Edited stomatal conductance section & updated the parameter table --- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 2 +- .../CLM50_Tech_Note_Introduction.rst | 2 +- .../CLM50_Tech_Note_Photosynthesis.rst | 128 +++++++++--------- 3 files changed, 64 insertions(+), 68 deletions(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index d5f9b85560..10315b7d98 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -114,7 +114,7 @@ distribution parameters that control the uptake of water from the soil (:numref:`Table Plant functional type root distribution parameters`), aerodynamic parameters that determine resistance to heat, moisture, and momentum transfer (:numref:`Table Plant functional type aerodynamic parameters`), and photosynthetic parameters that determine stomatal resistance, photosynthesis, and -transpiration (:numref:`Table Plant functional type (PFT) photosynthetic parameters`, +transpiration (:numref:`Table Plant functional type (PFT) stomatal conductance parameters`, :numref:`Table Temperature dependence parameters for C3 photosynthesis`). The composition and abundance of PFTs within a grid cell can either be prescribed as time-invariant fields (e.g., using the present day dataset described in section 21.3.3) or can diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 31ab7685d8..7c006efab7 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -123,7 +123,7 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table snow layer thickness` Minimum and maximum thickness of snow layers (m) -- :numref:`Table Plant functional type (PFT) photosynthetic parameters` Plant functional type (PFT) photosynthetic parameters. +- :numref:`Table Plant functional type (PFT) stomatal conductance parameters` Plant functional type (PFT) stomatal conductance parameters. - :numref:`Table Temperature dependence parameters for C3 photosynthesis` Temperature dependence parameters for C3 photosynthesis. diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index 163c476d08..a6cb6e987a 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -69,16 +69,20 @@ photosynthesis (:math:`\mu`\ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`), :math:`c_{s}` is the CO\ :sub:`2` partial pressure at the leaf surface (Pa), :math:`P_{atm}` is the atmospheric pressure (Pa), and :math:`D` is the vapor pressure deficit at the leaf surface (Pa). -:math:`g_{1}` is a plant functional type dependent parameter (:numref:`Table Plant functional type (PFT) photosynthetic parameters`) +:math:`g_{1}` is a plant functional type dependent parameter (:numref:`Table Plant functional type (PFT) stomatal conductance parameters`) and can be calculated as .. math:: :label: 9.2 - g_{1} = {\sqrt{\frac{3\Gamma*\lambda}{1.6}}} + g_{1} = {\sqrt{\frac{3\Gamma\lambda}{1.6}}} -Parameter values are :math:`g_{o}=X` for -C\ :sub:`3` plants and :math:`g_{o}=4` for C\ :sub:`4` plants +where :math:`\Gamma` (mol mol\ :sup:`-1`) is the CO\ :sub:`2` compensation point +for photosynthesis without dark respiration and :math:`\lambda` +(mol H\ :sub:`2` O mol\ :sup:`-1`) is a parameter +describing the marginal water cost of carbon gain. +The value for :math:`g_{o}=100` :math:`\mu` mol m :sup:`-2` s\ :sup:`-1` for +C\ :sub:`3` and C\ :sub:`4` plants. Photosynthesis is calculated for sunlit (:math:`A^{sun}`) and shaded (:math:`A^{sha}`) leaves to give :math:`r_{s}^{sun}` and :math:`r_{s}^{sha}`. Additionally, soil water influences stomatal @@ -86,72 +90,64 @@ resistance through plant hydraulic stress, detailed in the :ref:`rst_Plant Hydraulics` chapter. Resistance is converted from units of -s m\ :sup:`2` :math:`\mu` mol\ :sub:`-1` to s m\ :sup:`-1` as: +s m\ :sup:`2` :math:`\mu` mol\ :sup:`-1` to s m\ :sup:`-1` as: 1 s m\ :sup:`-1` = :math:`1\times 10^{-9} R_{gas} \frac{\theta _{atm} }{P_{atm} }` -:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, where :math:`R_{gas}` is the universal gas constant (J K\ :sup:`-1` +:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, [check units are correct here] +where :math:`R_{gas}` is the universal gas constant (J K\ :sup:`-1` kmol\ :sup:`-1`) (:numref:`Table Physical constants`) and :math:`\theta _{atm}` is the atmospheric potential temperature (K). -.. _Table Plant functional type (PFT) photosynthetic parameters: - -.. table:: Plant functional type (PFT) photosynthetic parameters. - - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | PFT | m | :math:`\alpha` | :math:`CN_{L}` | :math:`F_{LNR}` | :math:`SLA_{0}` | :math:`\psi _{o}` | :math:`\psi _{c}` | :math:`{V}_{cmax25}` | - +==================================+=====+====================+===================+====================+====================+======================+======================+===========================+ - | NET Temperate | 9 | – | 35 | 0.0509 | 0.010 | -66000 | -255000 | 62.5 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | NET Boreal | 9 | – | 40 | 0.0466 | 0.008 | -66000 | -255000 | 62.6 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | NDT Boreal | 9 | – | 25 | 0.0546 | 0.024 | -66000 | -255000 | 39.1 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | BET Tropical | 9 | – | 30 | 0.0461 | 0.012 | -66000 | -255000 | 55.0 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | BET temperate | 9 | – | 30 | 0.0515 | 0.012 | -66000 | -255000 | 61.5 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | BDT tropical | 9 | – | 25 | 0.0716 | 0.030 | -35000 | -224000 | 41.0 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | BDT temperate | 9 | – | 25 | 0.1007 | 0.030 | -35000 | -224000 | 57.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | BDT boreal | 9 | – | 25 | 0.1007 | 0.030 | -35000 | -224000 | 57.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | BES temperate | 9 | – | 30 | 0.0517 | 0.012 | -83000 | -428000 | 61.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | BDS temperate | 9 | – | 25 | 0.0943 | 0.030 | -83000 | -428000 | 54.0 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | BDS boreal | 9 | – | 25 | 0.0943 | 0.030 | -83000 | -428000 | 54.0 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | C\ :sub:`3` arctic grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | C\ :sub:`3` grass | 9 | – | 25 | 0.1365 | 0.030 | -74000 | -275000 | 78.2 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | C\ :sub:`4` grass | 4 | 0.05 | 25 | 0.0900 | 0.030 | -74000 | -275000 | 51.6 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Crop R | 9 | – | 25 | 0.1758 | 0.030 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Crop I | 9 | – | 25 | 0.1758 | 0.030 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Corn R | 4 | 0.05 | 25 | 0.2930 | 0.050 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Corn I | 4 | 0.05 | 25 | 0.2930 | 0.050 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Temp Cereal R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Temp Cereal I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Winter Cereal R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Winter Cereal I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Soybean R | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - | Soybean I | 9 | – | 25 | 0.4102 | 0.070 | -74000 | -275000 | 100.7 | - +----------------------------------+-----+--------------------+-------------------+--------------------+--------------------+----------------------+----------------------+---------------------------+ - -:math:`\alpha` (mol CO\ :sub:`2` mol\ :sup:`-1` photon); -:math:`CN_{L}` (g C g\ :sup:`-1` N); :math:`F_{LNR}` (g N Rubisco g\ :sup:`-1` N); :math:`SLA_{0}` (m\ :sup:`2` g\ :sup:`-1` C); -:math:`\psi _{o}` and :math:`\psi _{c}` (mm); -V\ :sub:`cmax25` (:math:`\mu`\ mol m\ :sup:`-2` s\ :sup:`-1`, calculated from equation for canopy top). +.. _Table Plant functional type (PFT) stomatal conductance parameters: + +.. table:: Plant functional type (PFT) stomatal conductance parameters. + + +----------------------------------+-------------------+ + | PFT | g\ :sub:`1` (Pa) | + +==================================+===================+ + | NET Temperate | 2.35 | + +----------------------------------+-------------------+ + | NET Boreal | 2.35 | + +----------------------------------+-------------------+ + | NDT Boreal | 2.35 | + +----------------------------------+-------------------+ + | BET Tropical | 4.12 | + +----------------------------------+-------------------+ + | BET temperate | 4.12 | + +----------------------------------+-------------------+ + | BDT tropical | 4.45 | + +----------------------------------+-------------------+ + | BDT temperate | 4.45 | + +----------------------------------+-------------------+ + | BDT boreal | 4.45 | + +----------------------------------+-------------------+ + | BES temperate | 4.70 | + +----------------------------------+-------------------+ + | BDS temperate | 4.70 | + +----------------------------------+-------------------+ + | BDS boreal | 4.70 | + +----------------------------------+-------------------+ + | C\ :sub:`3` arctic grass | 2.22 | + +----------------------------------+-------------------+ + | C\ :sub:`3` grass | 5.25 | + +----------------------------------+-------------------+ + | C\ :sub:`4` grass | 1.62 | + +----------------------------------+-------------------+ + | Temperate Corn | 1.79 | + +----------------------------------+-------------------+ + | Spring Wheat | 5.79 | + +----------------------------------+-------------------+ + | Temperate Soybean | 5.79 | + +----------------------------------+-------------------+ + | Cotton | 5.79 | + +----------------------------------+-------------------+ + | Rice | 5.79 | + +----------------------------------+-------------------+ + | Sugarcane | 1.79 | + +----------------------------------+-------------------+ + | Tropical Corn | 1.79 | + +----------------------------------+-------------------+ + | Tropical Soybean | 5.79 | + +----------------------------------+-------------------+ .. _Photosynthesis: From 8bcfd46472b961a68f52ccbcb4822160469c595b Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Tue, 1 Aug 2017 17:38:32 -0600 Subject: [PATCH 0084/1973] Minor edits in the photosynthesis section --- .../CLM50_Tech_Note_Photosynthesis.rst | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index a6cb6e987a..b3d512121d 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -92,7 +92,7 @@ the :ref:`rst_Plant Hydraulics` chapter. Resistance is converted from units of s m\ :sup:`2` :math:`\mu` mol\ :sup:`-1` to s m\ :sup:`-1` as: 1 s m\ :sup:`-1` = :math:`1\times 10^{-9} R_{gas} \frac{\theta _{atm} }{P_{atm} }` -:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, [check units are correct here] +:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, [same as 4.5, but seems off. check that units are correct] where :math:`R_{gas}` is the universal gas constant (J K\ :sup:`-1` kmol\ :sup:`-1`) (:numref:`Table Physical constants`) and :math:`\theta _{atm}` is the atmospheric potential temperature (K). @@ -181,7 +181,7 @@ CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 9.5 - A_{j} =\left\{\begin{array}{l} {\frac{J\left(c_{i} -\Gamma _{\*} \right)}{4c_{i} +8\Gamma _{\*} } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {\alpha (4.6\phi )\qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}\qquad \qquad c_{i} -\Gamma _{\*} \ge 0. + A_{j} =\left\{\begin{array}{l} {\frac{J_{x}\left(c_{i} -\Gamma _{\*} \right)}{4c_{i} +8\Gamma _{\*} } \qquad \qquad {\rm for\; C}_{{\rm 3}} {\rm \; plants}} \\ {\alpha (4.6\phi )\qquad \qquad {\rm for\; C}_{{\rm 4}} {\rm \; plants}} \end{array}\right\}\qquad \qquad c_{i} -\Gamma _{\*} \ge 0. The product-limited rate of carboxylation for C\ :sub:`3` plants and the PEP carboxylase-limited rate of carboxylation for @@ -200,7 +200,8 @@ is the O\ :sub:`2` partial pressure (Pa). :math:`K_{c}` and CO\ :sub:`2` and O\ :sub:`2`. :math:`\Gamma _{\*}` (Pa) is the CO\ :sub:`2` compensation point. :math:`V_{c\max }` is the maximum rate of carboxylation (µmol m\ :sup:`-2` -s\ :sup:`-1`) and :math:`J` is the electron transport rate (µmol +s\ :sup:`-1`, Chapter :numref:`rst_Photosynthetic Capacity`) +and :math:`J_{x}` is the electron transport rate (µmol m\ :sup:`-2` s\ :sup:`-1`). :math:`T_{p}` is the triose phosphate utilization rate (µmol m\ :sup:`-2` s\ :sup:`-1`), taken as :math:`T_{p} =0.167V_{c\max }` so that @@ -221,14 +222,14 @@ expression is the smaller of the two roots of the equation .. math:: :label: 9.7 - \Theta _{PSII} J^{2} -\left(I_{PSII} +J_{\max } \right)J+I_{PSII} J_{\max } =0 + \Theta _{PSII} J_{x}^{2} -\left(I_{PSII} +J_{\max } \right)J_{x}+I_{PSII} J_{\max } =0 where :math:`J_{\max }` is the maximum potential rate of electron -transport (:math:`\mu`\ mol m\ :sup:`-2` s\ :sup:`-1`), +transport (:math:`\mu`\ mol m\ :sup:`-2` s\ :sup:`-1`, Chapter :numref:`rst_Photosynthetic Capacity`), :math:`I_{PSII}` is the light utilized in electron transport by photosystem II (µmol m\ :sup:`-2` s\ :sup:`-1`), and :math:`\Theta _{PSII}` is a curvature parameter. For a given amount of -photosynthetically active radiation absorbed by a leaf :math:`\phi` (W +photosynthetically active radiation absorbed by a leaf (:math:`\phi`, W m\ :sup:`-2`), converted to photosynthetic photon flux density with 4.6 :math:`\mu`\ mol J\ :sup:`-1`, the light utilized in electron transport is @@ -258,17 +259,18 @@ smaller root of the equations Values are :math:`\Theta _{cj} =0.98` and :math:`\Theta _{ip} =0.95` for C\ :sub:`3` plants; and :math:`\Theta _{cj} =0.80`\ and :math:`\Theta _{ip} =0.95` for C\ :sub:`4` plants. +:math:`A_{i}` is the intermediate co-limited photosynthesis. :math:`A_{n} =A-R_{d}` . -The parameters :math:`K_{c}`, :math:`K_{o}`, and :math:`\Gamma _{*}` +The parameters :math:`K_{c}`, :math:`K_{o}`, and :math:`\Gamma` depend on temperature. Values at 25 :sup:`o` \ C are :math:`K_{c25} ={\rm 4}0{\rm 4}.{\rm 9}\times 10^{-6} P_{atm}`, :math:`K_{o25} =278.4\times 10^{-3} P_{atm}`, and -:math:`\Gamma _{*25} {\rm =42}.75\times 10^{-6} P_{atm}`. +:math:`\Gamma _{25} {\rm =42}.75\times 10^{-6} P_{atm}`. :math:`V_{c\max }`, :math:`J_{\max }`, :math:`T_{p}`, :math:`k_{p}`, and :math:`R_{d}` also vary with temperature. Parameter values at 25 -:math:`\circ`\ C are calculated from :math:`V_{c\max }` \ at 25 -:math:`\circ`\ C: :math:`J_{\max 25} =1.97V_{c\max 25}`, +:sup:`o`\ C are calculated from :math:`V_{c\max }` \ at 25 +:sup:`\o`\ C: :math:`J_{\max 25} =1.97V_{c\max 25}`, :math:`T_{p25} =0.167V_{c\max 25}`, and :math:`R_{d25} =0.015V_{c\max 25}` (C\ :sub:`3`) and :math:`R_{d25} =0.025V_{c\max 25}` (C\ :sub:`4`). For @@ -278,6 +280,7 @@ calculated from leaf nitrogen as :math:`R_{d25} = 0.2577LNC_{a}`, where :math:`LNC_{a}` is the area-based leaf nitrogen concentration (g N m\ :sup:`-2` leaf area, Chapter :numref:`rst_Photosynthetic Capacity`), and 0.2577 :math:`\mu`\ mol CO\ :sub:`2` g\ :sup:`-1` N s\ :sup:`-1` is the base respiration rate. +[this doesn't look correct based on the code, which lists two options; verify with Rosie] The parameters :math:`V_{c\max 25}`, :math:`J_{\max 25}`, :math:`T_{p25}`, :math:`k_{p25}`, and :math:`R_{d25}` are scaled over the canopy for sunlit and shaded leaves @@ -287,7 +290,7 @@ The parameters :math:`V_{c\max 25}`, .. math:: :label: 9.10 - \begin{array}{rcl} {V_{c\max } } & {=} & {V_{c\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {J_{\max } } & {=} & {J_{\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {T_{p} } & {=} & {T_{p25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {R_{d} } & {=} & {R_{d25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {K_{c} } & {=} & {K_{c25} \; f\left(T_{v} \right)} \\ {K_{o} } & {=} & {K_{o25} \; f\left(T_{v} \right)} \\ {\Gamma _{*} } & {=} & {\Gamma _{*25} \; f\left(T_{v} \right)} \end{array} + \begin{array}{rcl} {V_{c\max } } & {=} & {V_{c\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {J_{\max } } & {=} & {J_{\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {T_{p} } & {=} & {T_{p25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {R_{d} } & {=} & {R_{d25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {K_{c} } & {=} & {K_{c25} \; f\left(T_{v} \right)} \\ {K_{o} } & {=} & {K_{o25} \; f\left(T_{v} \right)} \\ {\Gamma } & {=} & {\Gamma _{25} \; f\left(T_{v} \right)} \end{array} with @@ -306,9 +309,6 @@ and :numref:`Table Temperature dependence parameters for C3 photosynthesis` lists parameter values for :math:`\Delta H_{a}` , :math:`\Delta H_{d}` , and :math:`\Delta S`, from :ref:`Bonan et al. (2011)`. -[Note: should we remove :math:`\Delta S` from the table below since we no longer use these? -Also, we should consider updating :math:`\Delta H_{a}` , -:math:`\Delta H_{d}` in this table] Because :math:`T_{p}` as implemented here varies with :math:`V_{c\max }` , :math:`T_{p}` uses the same temperature parameters as :math:`V_{c\max}` . For C\ :sub:`4` plants, @@ -346,11 +346,11 @@ with :math:`Q_{10} =2`. +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ | Parameter | :math:`\Delta H_{a}` (J mol\ :sup:`-1`) | :math:`\Delta H_{d}` (J mol\ :sup:`-1`) | :math:`\Delta S` (J mol\ :sup:`-1` K\ :sup:`-1`) | +========================+=================================================================+=================================================================+==============================================================================================+ - | :math:`V_{c\max }` | 65330 | 149250 | 485 | + | :math:`V_{c\max }` | 72000 | 200000 | 485 | +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | :math:`J_{\max }` | 43540 | 152040 | 495 | + | :math:`J_{\max }` | 50000 | 152040 | 495 | +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | :math:`T_{p}` | 65330 | 149250 | 485 | + | :math:`T_{p}` | 72000 | 149250 | 485 | +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ | :math:`R_{d}` | 46390 | 150650 | 490 | +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ @@ -361,6 +361,8 @@ with :math:`Q_{10} =2`. | :math:`\Gamma _{\*}` | 37830 | – | – | +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ +[Note: updated the Vcmax :math:`\Delta H_{a}` and :math:`\Delta H_{d}` +and the Jmax :math:`\Delta H_{a}` based on acclimation values. All other values are the same as previous] The parameters in :numref:`Table Temperature dependence parameters for C3 photosynthesis` do not allow for temperature acclimation of photosynthesis. In the model, acclimation is implemented as in :ref:`Kattge and Knorr (2007) `. In this parameterization, @@ -374,10 +376,8 @@ according to \begin{array}{l} {\Delta S=668.39-1.07(T_{10} -T_{f} )\qquad \qquad {\rm for\; }V_{c\max } } \\ {\Delta S=659.70-0.75(T_{10} -T_{f} )\qquad \qquad {\rm for\; }J_{\max } } \end{array} The effect is to cause the temperature optimum of :math:`V_{c\max }` -and :math:`J_{\max }` to increase with warmer temperatures. In this -parameterization, :math:`\Delta H_{d}` \ = 200000, -:math:`\Delta H_{a}` \ = 72000 for :math:`V_{c\max }` , and -:math:`\Delta H_{a}` \ = 50000 for :math:`J_{\max }` . Additionally, the +and :math:`J_{\max }` to increase with warmer temperatures. +Additionally, the ratio :math:`J_{\max 25} /V_{c\max 25}` at 25 :sup:`o`\ C decreases with growth temperature as .. math:: From e3bb7122a6bf1b91e491675f3f11e7afb3fc4045 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Wed, 2 Aug 2017 13:32:49 -0600 Subject: [PATCH 0085/1973] More edits on photosynthesis, canopy scaling, and numerical implementation sections of photosynthesis chapter --- .../CLM50_Tech_Note_Photosynthesis.rst | 73 ++++++++++--------- .../References/CLM50_Tech_Note_References.rst | 6 ++ 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index b3d512121d..b8e443f10a 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -78,7 +78,8 @@ and can be calculated as g_{1} = {\sqrt{\frac{3\Gamma\lambda}{1.6}}} where :math:`\Gamma` (mol mol\ :sup:`-1`) is the CO\ :sub:`2` compensation point -for photosynthesis without dark respiration and :math:`\lambda` +for photosynthesis without dark respiration, +1.6 is the ratio of diffusivity of CO\ :sub:`2` to H\ :sub:`2` O and :math:`\lambda` (mol H\ :sub:`2` O mol\ :sup:`-1`) is a parameter describing the marginal water cost of carbon gain. The value for :math:`g_{o}=100` :math:`\mu` mol m :sup:`-2` s\ :sup:`-1` for @@ -92,7 +93,7 @@ the :ref:`rst_Plant Hydraulics` chapter. Resistance is converted from units of s m\ :sup:`2` :math:`\mu` mol\ :sup:`-1` to s m\ :sup:`-1` as: 1 s m\ :sup:`-1` = :math:`1\times 10^{-9} R_{gas} \frac{\theta _{atm} }{P_{atm} }` -:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, [same as 4.5, but seems off. check that units are correct] +:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, [same as 4.5, but units seem off. check that units are correct] where :math:`R_{gas}` is the universal gas constant (J K\ :sup:`-1` kmol\ :sup:`-1`) (:numref:`Table Physical constants`) and :math:`\theta _{atm}` is the atmospheric potential temperature (K). @@ -307,8 +308,12 @@ and f_{H} \left(T_{v} \right)=\frac{1+\exp \left(\frac{298.15\Delta S-\Delta H_{d} }{298.15\times 0.001R_{gas} } \right)}{1+\exp \left(\frac{\Delta ST_{v} -\Delta H_{d} }{0.001R_{gas} T_{v} } \right)} . :numref:`Table Temperature dependence parameters for C3 photosynthesis` -lists parameter values for :math:`\Delta H_{a}` , -:math:`\Delta H_{d}` , and :math:`\Delta S`, from :ref:`Bonan et al. (2011)`. +lists parameter values for :math:`\Delta H_{a}` and +:math:`\Delta H_{d}` . :math:`\Delta S` is calculated +separately for :math:`V_{c\max }` and :math:`J_{max }` +to allow for temperature acclimation of photosynthesis (see equation :eq:`9.16`), +and :math:`\Delta S` is 490 J mol :sup:`-1` K :sup:`-1` for :math:`R_d` +(:ref:`Bonan et al. 2011`, :ref:`Lombardozzi et al. 2015`). Because :math:`T_{p}` as implemented here varies with :math:`V_{c\max }` , :math:`T_{p}` uses the same temperature parameters as :math:`V_{c\max}` . For C\ :sub:`4` plants, @@ -343,28 +348,25 @@ with :math:`Q_{10} =2`. .. table:: Temperature dependence parameters for C3 photosynthesis. - +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | Parameter | :math:`\Delta H_{a}` (J mol\ :sup:`-1`) | :math:`\Delta H_{d}` (J mol\ :sup:`-1`) | :math:`\Delta S` (J mol\ :sup:`-1` K\ :sup:`-1`) | - +========================+=================================================================+=================================================================+==============================================================================================+ - | :math:`V_{c\max }` | 72000 | 200000 | 485 | - +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | :math:`J_{\max }` | 50000 | 152040 | 495 | - +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | :math:`T_{p}` | 72000 | 149250 | 485 | - +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | :math:`R_{d}` | 46390 | 150650 | 490 | - +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | :math:`K_{c}` | 79430 | – | – | - +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | :math:`K_{o}` | 36380 | – | – | - +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - | :math:`\Gamma _{\*}` | 37830 | – | – | - +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+----------------------------------------------------------------------------------------------+ - -[Note: updated the Vcmax :math:`\Delta H_{a}` and :math:`\Delta H_{d}` -and the Jmax :math:`\Delta H_{a}` based on acclimation values. All other values are the same as previous] -The parameters in :numref:`Table Temperature dependence parameters for C3 photosynthesis` -do not allow for temperature acclimation of photosynthesis. In the model, acclimation is + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ + | Parameter | :math:`\Delta H_{a}` (J mol\ :sup:`-1`) | :math:`\Delta H_{d}` (J mol\ :sup:`-1`) | + +========================+=================================================================+=================================================================+ + | :math:`V_{c\max }` | 72000 | 200000 | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ + | :math:`J_{\max }` | 50000 | 200000 | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ + | :math:`T_{p}` | 72000 | 200000 | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ + | :math:`R_{d}` | 46390 | 150650 | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ + | :math:`K_{c}` | 79430 | – | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ + | :math:`K_{o}` | 36380 | – | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ + | :math:`\Gamma _{\*}` | 37830 | – | + +------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ + +In the model, acclimation is implemented as in :ref:`Kattge and Knorr (2007) `. In this parameterization, :math:`V_{c\max }` and :math:`J_{\max }` vary with the plant growth temperature. This is achieved by allowing :math:`\Delta S`\ to vary with growth temperature @@ -401,7 +403,7 @@ leaves using an exponential profile to area-based leaf nitrogen as in :ref:`Bonan et al. (2011)`. :math:`V_{c\max 25}` at cumulative leaf area index :math:`x` from the canopy top scales directly with :math:`LNC_{a}` , which decreases exponentially with greater -cumulative leaf area, so that +cumulative leaf area, so that [Verify with Rosie- different based on Vcmax option 0, 3, & 4] .. math:: :label: 9.18 @@ -409,7 +411,7 @@ cumulative leaf area, so that V_{c\; \max 25}^{} \left(x\right)=V_{c\; \max 25}^{} \left(0\right)e^{-K_{n} x} where :math:`V_{c\; \max 25}^{} \left(0\right)` is defined at the top of -the canopy using :math:`SLA_{0}`, whic is the specific leaf area at +the canopy using :math:`SLA_{0}`, which is the specific leaf area at the canopy top and :math:`K_{n}` is the decay coefficient for nitrogen. The canopy integrated value for sunlit and shaded leaves is @@ -438,10 +440,12 @@ and the average value for the sunlit and shaded leaves is This integration is over all leaf area (:math:`L`) with :math:`f_{sun} (x)=\exp \left(-Kx\right)` and :math:`K` the direct beam -extinction coefficient (equation 4.9). Photosynthetic parameters -:math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}` , and +extinction coefficient (equation :eq:`4.8` in chapter :numref:`rst_Radiative Fluxes`). Photosynthetic parameters +:math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}`, and :math:`R_{d25}` scale similarly. +The model uses :math:`K_{n} =0.30` to match an explicit multi-layer canopy, as in +:ref:`Bonan et al. (2012)`. The value :math:`K_{n} = 0.11` chosen by :ref:`Bonan et al. (2011)` is consistent with observationally-derived estimates for forests, mostly tropical, and provides a gradient in V\ :sub:`cmax` similar to @@ -449,8 +453,7 @@ the original CLM4 specific leaf area scaling. However, :ref:`Bonan et al. (2012)` showed that the sunlit/shaded canopy parameterization does not match an explicit multi-layer canopy parameterization. The discrepancy arises from absorption of scattered radiation by shaded leaves and can -be tuned out with higher :math:`K_{n}` . The model uses -:math:`K_{n} =0.30` to match an explicit multi-layer canopy. +be tuned out with higher :math:`K_{n}`. .. _Numerical implementation photosynthesis: @@ -458,8 +461,8 @@ be tuned out with higher :math:`K_{n}` . The model uses Numerical implementation ---------------------------- -The CO\ :sub:`2` partial pressure at the leaf surface -:math:`c_{s}` (Pa) and the vapor pressure at the leaf surface +The CO\ :sub:`2` partial pressure at the leaf surface, +:math:`c_{s}` (Pa), and the vapor pressure at the leaf surface, :math:`e_{s}` (Pa), needed for the stomatal resistance model in equation :eq:`9.1`, and the internal leaf CO\ :sub:`2` partial pressure :math:`c_{i}` (Pa), needed for the photosynthesis model in equations :eq:`9.3`-:eq:`9.5`, @@ -497,7 +500,7 @@ determined from e_{a} =\frac{P_{atm} q_{s} }{0.622} where :math:`q_{s}` is the specific humidity of canopy air (kg -kg\ :sup:`-1`) (section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). +kg\ :sup:`-1`, section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). Equations and are solved for :math:`c_{s}` and :math:`e_{s}` diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 97e221f702..eb5a00c9c8 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1133,6 +1133,12 @@ Lobell, D.B., Bala, G., and Duffy, P.B. 2006. Biogeophysical impacts of cropland management changes on climate. Geophys. Res. Lett. 33:L06708. DOI:10.1029/2005GL025492. +.. _Lombardozzietal2015: + +Lombardozzi, D.L., Bonan, G.B., Smith, N.G., Dukes, J.S. 2015. Temperature +acclimation of photosynthesis and respiration: A key uncertainty in the +carbon cycle-climate feedback. Geophys. Res. Lett. 42:8624-8631. + .. _Lovelandetal2000: Loveland, T.R., Reed, B.C., Brown, J.F., Ohlen, D.O., Zhu, Z., Yang, L., From 1f01fcbd8936d392589748cf4d93e1e694bd14b6 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Wed, 2 Aug 2017 13:54:12 -0600 Subject: [PATCH 0086/1973] Updated the crop chapter to reflect the new changes in leaf angle distribution --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 85c284cd89..fb6a180edd 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -363,7 +363,7 @@ Harvest occurs in one time step using the BGC leaf offset algorithm. Harvest: days past planting :math:`\mathrm{\le}`\ 165 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 160 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 300 :math:`\mathrm{\le}`\ 160 :math:`\mathrm{\le}`\ 150 :math:`z_{top}^{\max }` (m) 2.5 1.2 0.75 1.5 1.8 4 2.5 1 SLA (m :sup:`2` leaf g :sup:`-1` C) 0.05 0.035 0.035 0.035 0.035 0.05 0.05 0.035 - :math:`\chi _{L}` index -0.5 0.65 -0.5 -0.5 0.65 -0.5 -0.5 -0.5 + :math:`\chi _{L}` index -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 grperc 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 flnr 0.293 0.41 0.41 0.41 0.41 0.293 0.293 0.41 fcur 1 1 1 1 1 1 1 1 From 172db34303856a407a5996159385e0ca26ef8970 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 16 Aug 2017 13:22:53 -0600 Subject: [PATCH 0087/1973] removed bsoil from fluxes chapter --- doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst | 6 ++---- doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 0ffe6e43f3..04d0a6a83c 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -1052,7 +1052,7 @@ where .. math:: :label: 5.103 - E_{soil} = -\rho _{atm} \frac{\beta _{soi} \left(q_{s} -q_{soil} \right)}{r_{aw} ^{{'} } +r_{soil} } + E_{soil} = -\rho _{atm} \frac{\left(q_{s} -q_{soil} \right)}{r_{aw} ^{{'} } +r_{soil} } .. math:: :label: 5.104 @@ -1072,9 +1072,7 @@ at the vegetation temperature (section :numref:`Saturation Vapor Pressure`), :ma of the soil, snow, and surface water (section :numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`), :math:`r_{aw} ^{{'} }` is the aerodynamic resistance (s m\ :sup:`-1`) to water vapor transfer between the ground at height -:math:`z_{0w} ^{{'} }` and the canopy air at height :math:`z_{0w} +d`, -:math:`\beta _{soi}` is an empirical function of soil water (section -:numref:`Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces`), +:math:`z_{0w} ^{{'} }` and the canopy air at height :math:`z_{0w} +d`, and :math:`r_{soil}` (:eq:`5.76`) is a resistance to diffusion through the soil (s m\ :sup:`-1`). :math:`r_{total}` is the total resistance to water vapor transfer from the canopy to the canopy air and includes diff --git a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst index 24df209f08..b844b4a433 100644 --- a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst +++ b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst @@ -53,8 +53,8 @@ and discharges the water to its downstream spatial unit or the ocean. MOSART only route positive runoff, although negative runoff could be generated occasionally by the land model (e.g., :math:`q_{gwl}`). Negative runoff in any runoff component including :math:`q_{sur}`, :math:`q_{sub}`, :math:`q_{gwl}` -is mapped directly from the spatial unit where it is generated at any time step to -the basin outlet of the corresponding spatial unit. +is not routed through MOSART, but instead is mapped directly from the spatial unit +where it is generated at any time step to the coupler. In MOSART, the travel velocities of water across hillslopes, sub-network and main channel are all estimated using the Manning’s equation with different levels of From 24bf0b52d6daa04745dbc235a327c76e39468744 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 18 Aug 2017 10:50:24 -0600 Subject: [PATCH 0088/1973] Updates to Introduction, very minor updates to BVOCs, and some references added --- .../tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst | 4 +- .../CLM50_Tech_Note_Introduction.rst | 94 +++++++++++-------- .../References/CLM50_Tech_Note_References.rst | 38 +++++++- 3 files changed, 96 insertions(+), 40 deletions(-) diff --git a/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst b/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst index 8c5737f171..433f26d97d 100644 --- a/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst +++ b/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst @@ -7,7 +7,7 @@ This chapter briefly describes the biogenic volatile organic compound (BVOC) emissions model implemented in CLM. The CLM3 version (Levis et al. 2003; Oleson et al. 2004) was based on Guenther et al. (1995). Heald et al. (2008) updated this scheme in CLM4 based on Guenther et al. -(2006). The current version in CLM4.5 is based on MEGAN2.1 discussed in +(2006). The current version was implemented in CLM4.5 and is based on MEGAN2.1 discussed in detail in Guenther et al. (2012). This update of MEGAN incorporates four main features: expansion to 147 chemical compounds the treatment of the light-dependent fraction (LDF) for each compound inclusion of the @@ -58,6 +58,6 @@ where the LDF activity factor (:math:`\gamma _{P\_ LDF}` ) is specified as a function of PAR as in previous versions of MEGAN. The values for each emission factor :math:`\epsilon _{i,\, j}` are -now available for each of the 15 plant functional types in the CLM and +now available for each of the plant functional types in the CLM and each chemical compound. This information is distributed through an external file, allowing for more frequent and easier updates. diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 31ab7685d8..2c9abf86cc 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -11,12 +11,12 @@ ***Lead Authors*** -**Bardan Ghimire, Leo van Kampenhout, Daniel Kennedy, Erik Kluzek, Peter J. Lawrence, Fang Li, Hongyi Li, Danica Lombardozzi, Yaqiong Lu, Justin Perket, William J. Riley, William Sacks, Mingjie Shi, Will Wieder, Chonggang Xu** +**Gordon Bonan, Bardan Ghimire, Leo van Kampenhout, Daniel Kennedy, Erik Kluzek, Peter J. Lawrence, Fang Li, Hongyi Li, Danica Lombardozzi, Yaqiong Lu, Justin Perket, William J. Riley, William Sacks, Mingjie Shi, Will Wieder, Chonggang Xu** ***Contributing Authors*** -**Ben Andre, Ali Ashehad, Gautam Bisht, Gordon Bonan, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, -L. Ruby Leung, William Lipscomb, Daniel M. Ricciuto, Ben Sanderson, Andrew Slater, Zachary M. Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Mariana Vertenstein, Francis Vitt, Xubin Zeng** +**Ben Andre, Ali Ashehad, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, +L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Andrew Slater, Zachary M. Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Mariana Vertenstein, Francis Vitt, Xubin Zeng** The National Center for Atmospheric Research (NCAR) is operated by the @@ -176,21 +176,6 @@ Koichi Sakaguchi, Adam Schlosser, Andrew Slater, Reto Stöckli, Ying Sun, Quinn Thomas, Peter Thornton, Mariana Vertenstein, Nicholas Viovy, Aihui Wang, Guiling Wang, Charlie Zender, Xiaodong Zeng, and Xubin Zeng. - - -Current affiliations for the authors are as follows: - -K.W. Oleson, D.M. Lawrence, G.B. Bonan, S.C. Swenson, R. -Fisher, E. Kluzek, P.J. Lawrence, W. Sacks and M. Vertenstein (National Center for Atmospheric Research); B. Drewniak (Argonne -National Laboratory); M. Huang, L.R. Leung (Pacific Northwest National -Laboratory); C.D. Koven, W.J. Riley, and J. Tang (Lawrence Berkeley -National Laboratory); F. Li (Chinese Academy of Sciences); Z.M. Subin -(Princeton University); P.E. Thornton and D.M. Ricciuto (Oak Ridge -National Laboratory); A. Bozbiyik (Bern University); C. Heald -(Massachusetts Institute of Technology), W. Lipscomb (Los Alamos -National Laboratory); Ying Sun and Z.-L. Yang (University of Texas at -Austin) - .. _rst_Introduction: Introduction @@ -520,17 +505,55 @@ Community Earth System Model version 1.2 (CESM1.2). CLM5.0 ^^^^^^^^^^^^ -Developments for CLM5.0 build on the progress made in CLM4.5. Much of the focus of development centered on a -push towards more mechanistic treatment of several key processes, in addition to more comprehensive and explicit representation -of land use and land-cover change. In particular, - -To represent … Stomatal conductance is a function of prognostic (predicted) leaf water potential. LWP is the result of atmospheric demand and supply from soil via resistance network. - -Dynamic land units. - -Included within the codebase of the release of CLM5.0 is a functionally supported version of the Functionally-Assembled Terrestrial Ecosystem Simulator (FATES, -reference Fisher???). This version of CLM5-FATES that is supported in this release is described here??? Short blurb on what FATES can do??? - +Developments for CLM5.0 build on the progress made in CLM4.5. Most major components of the model have been udpated with particularly +notable changes made to soil and plant hydrology, snow density, river modeling, carbon and nitrogen cycling and coupling, +and crop modeling. +Much of the focus of development centered on a +push towards more mechanistic treatment of key processes, in addition to more comprehensive and explicit representation +of land use and land-cover change. Prior versions of CLM included relatively few options for physics parameterizations or structure. +In CLM5, where new parameterizations or model decisions were made, in most cases, the CLM4.5 parameterization was maintained so that users could switch back and forth between different parameterizations via namelist control where appropriate or desirable. Throughout the CLM5 Technical Descpription, in general only the default parameterization for any given process is described. Readers are referred to the CLM4.5 or CLM4 Technical Descriptions for detailed descriptions of non-default parameterizations. + +The hydrology updates include the introduction of a dry surface layer-based soil evaporation resistance parameterization :ref:`(Swenson and Lawrence, 2014)` and a revised canopy interception parameterization. Canopy interception is now divided into liquid and solid phases, with the intercepted snow subject to unloading events due to wind or above-freezing temperatures. The snow-covered fraction of the canopy is used within the canopy radiation and surface albedo calculation. Instead of applying a spatially uniform soil thickness, soil thickness can vary in space :ref:`(Brunke et al. 2016` and :ref:`Swenson and Lawrence, 2015)` and is set to values within a range of 0.4m to 8.5m depth, derived from a spatially explicit soil thickness data product :ref:`(Pelletier et al., 2016)`. The explicit treatment of soil thickness allows for the deprecation of the unconfined aquifer parameterization used in CLM4.5, which is replaced with a zero flux boundary condition and explicit modeling of both the saturated and unsaturated zones. The default model soil layer resolution is increased, especially within the top 3m, to more explicitly represent active layer thickness within the permafrost zone. Roots are deepened for the broadleaf evergreen tropical tree and broadleaf deciduous tropical tree types. Finally, an adaptive time-stepping solution to the Richard's equation is introduced, which improves the accuracy and stability of the numerical soil water solution. The River Transport Model (RTM) is replaced with the Model for Scale Adaptive River Transport (MOSART, :ref:`Li et al., 2013b)` in which surface runoff is routed across hillslopes and then discharged along with subsurface runoff into a tributary subnetwork before entering the main channel. + +Several changes are included that are mainly targeted at improving the simulation of surface mass balance over ice +sheets. The fresh snow density parameterization is updated to more realistically capture the temperature effects and to additionally account for wind effects on new snow density :ref:`(van Kampenhout et al., 2017)`. The maximum number of snow layers and snow amount is increased from 5 layers and 1m snow water equivalent to 12 layers and 10m snow water equivalent to allow for the formation of firn in regions of persistent snow-cover (e.g., glaciers and ice sheets) :ref:`(van Kampenhout et al., 2017)`. The CISM2 ice sheet model is active for Greenland by default with one-way coupling (surface mass balance impacts ice sheet dynamics, but ice sheet dynamics do not feedback onto surface elevation). Two-way coupling can be activated through a namelist switch. The introduction in CLM5 of the capability to +dynamically adjust landunit weights means that a glacier can initiate, grow, shrink, or disappear during +a simulation when two-way coupling is active. Multiple elevation classes (10 elevation classes by default) and associated temperature, rain/snow partitioning, and downwelling longwave downscaling are used for glacier landunits to account for the strong topographic elevation heterogeneity over glaciers and ice sheets. + +A plant hydraulic stress routine is introduced which explicitly models water transport through the vegetation according to a simple hydraulic framework (Kennedy et al., to be submitted). The water supply equations are used to solve for vegetation water potential forced by transpiration demand and a set of layer-by-layer soil water potentials. Stomatal conductance, therefore, is a function of prognostic leaf water potential. Water stress is calculated as the ratio of attenuated stomatal conductance to maximum stomatal conductance. An emergent feature of the plant hydraulics is soil hydraulic redistribution. In CLM5, maximum stomatal conductance is obtained from the Medlyn conductance model :ref:(Medlyn et al., 2011)`, rather than the Ball-Berry stomatal conductance model that was utilized in CLM4.5 and prior versions of the model. The Medlyn stomatal conductance model is preferred mainly for it's more realistic behavior at low humidity levels :ref:`(Rogers et al., 2017)`. The stress deciduous vegetation phenology trigger is augmented with a antecedent precipitation requirement :ref:`(Dahlin et al. 2015)`. + +Plant nutrient dynamics are substantially updated to resolve several deficiencies with the CLM4 and CLM4.5 nutrient cycling representation. The Fixation and Update of Nitrogen (FUN) model (refs???) is adapted for CLM :ref:`(Shi et al., 2016)` to resolve the +unrealistic feature that plants get nitrogen for free in CLM4 and CLM4.5. With FUN, the fact that plants typically spend a +significant fraction of their available carbon on nutrient aquisition is acounted for. The static plant carbon:nitrogen (C:N) ratios utilized in CLM4 and CLM4.5 are replaced with variable plant C:N ratios which +allows plants to adjust their C:N ratio, and therefore their leaf nitrogen content, with the cost of N uptake :ref:`(Ghimire et al. 2016)`. +The implementation of a flexible C:N ratio means that the model no longer relies on instantaneous downregulation +of potential photosynthesis rates based on soil mineral nitrogen availability to represent nutrient limitation. Furthermore, stomatal conductance +is now based on the N-limited photosynthesis rather than on potential photosynthesis. Finally, the Leaf Use of +Nitrogen for Assimilation (LUNA, :ref:`(Xu et al., 2012` and :ref:`Ali et al., 2016)` model is incorporated. The LUNA model calculates +photosynthetic capacity based on optimization of the use of leaf nitrogen under different environmental conditions such that +light capture, carboxylation, and respiration are co-limiting. Allocation changes ... Fixation ??? + +Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. +Fertilization rates and irrigation equipped area updated based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that +vary by latitude for selected crop types, grain C and N is now removed at harvest to a 1-year product pool with +the carbon for the next season's crop seed removed from the grain carbon at harvest. Through the introduction of +the capability to dynamically adjust landunit weights during a simulation, the crop model can now be run coincidentally +with prescribed land use, which significantly expands the capabilities of the model. Mass-based rather than area-based wood harvest is applied. Several heat stress indices for both urban and rural areas are calculated and output by default :ref:`(Buzan et al., 2015)`. A more sophisticated and realistic building space heating and air conditioning submodel that prognoses interior building air temperature and includes more realistic space heating and air conditioning wasteheat factors +is incorporated. + +The fire model is the same as utilized in CLM4.5 except that a modified scheme is used to estimate the dependence of fire occurrence and spread on fuel wetness for non-peat fires outside cropland and tropical closed forests :ref:`Li and Lawrence, 2017)` and the dependence of agricultural fires on fuel load is removed. + +Included with the release of CLM5.0 is a functionally supported version of the Functionally-Assembled Terrestrial Ecosystem Simulator (FATES, :ref:`Fisher et al., 2015)`. A major motivation of this development is to allow the prediction of biome boundaries directly from plant physiological traits via their competitive interactions. The version of CLM5-FATES that is supported in this release is described here??? Short blurb on what FATES can do??? Note that the classical dynamic global vegetation model (DGVM) that has been available within CLM4 and CLM4.5 remains available, though it is largely untested. The technical description of the CLM-DGVM can be found within the CLM4.5 Technical Description (:ref:`Oleson et al. 2013)`. + +During the course of the development of CLM5.0, it became clear that the increasing complexity of the model combined with the increasing number and range +of model development projects required updates to the underlying CLM infrastructure. Many such software improvements +are included in CLM5.0 including a partial transition to an object-oriented modular software structure, extraction of many hard coded model +parameters into either the parameter file or the CLM namelist, which allows users to more readily calibrate the model for use at +specific locations or to conduct parameter sensitivity studies. As part of the effort to increase +the scientific utility of the code, in most instances older generation parameterizations (i.e., the parameterizations +available in CLM4 or CLM4.5) are retained under namelist switches, allowing the user to revert to CLM4.5 +from the same code base or to revert individual parameterizations where the old parameterizations are compatible with the new code. Finally, multiple vertical soil layer structures +are defined and it is relatively easy to add additional structures. Biogeophysical and Biogeochemical Processes ----------------------------------------------- @@ -566,9 +589,8 @@ processes simulated include (:numref:`Figure Land processes`): #. Snow hydrology (snow accumulation and melt, compaction, water transfer between snow layers) (Chapter :numref:`rst_Snow Hydrology`) -#. Stomatal physiology and photosynthesis (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`) - -#. Prognostic photosynthetic capacity (Chapter :numref:`rst_Photosynthetic Capacity`) +#. Stomatal physiology, photosythetic capacity, and photosynthesis (Chapters :numref:`rst_Stomatal Resistance and Photosynthesis` and + :numref:`rst_Photosynthetic Capacity`) #. Plant hydraulics (Chapter :numref: `rst_Plant Hydraulics`) @@ -576,7 +598,7 @@ processes simulated include (:numref:`Figure Land processes`): #. Glacier processes (Chapter :numref:`rst_Glaciers`) -#. Routing of runoff from rivers to ocean (Chapter :numref:`rst_River Transport Model (RTM)`) +#. River routing and river flow (Chapter :numref:`rst_River Transport Model (RTM)`) #. Urban energy balance and climate (Chapter :numref:`rst_Urban Model (CLMU)`) @@ -593,19 +615,17 @@ processes simulated include (:numref:`Figure Land processes`): #. External nitrogen cycling including deposition, denitrification, leaching, and losses due to fire (Chapter :numref:`rst_External Nitrogen Cycle`) -#. Plant mortality (Chapter :numref:`rst_Plant Mortality`) +#. Plant mortality (Chapter :numref:`rst_Plant_Mortality`) #. Fire ignition, suppression, spread, and emissions, including natural, deforestation, and agricultural fire (Chapter :numref:`rst_Fire`) #. Methane production, oxidation, and emissions (Chapter :numref:`rst_Methane Model`) -#. Crop dynamics and irrigation (Chapter :numref:`rst_Crops and Irrigation`) +#. Crop dynamics, irrigation, and fertilization (Chapter :numref:`rst_Crops and Irrigation`) #. Land cover and land use change including wood harvest (Chapter :numref:`rst_Transient Landcover Change`) -#. Dynamic global vegetation distribution (Chapter :numref:`rst_Dynamic Global Vegetation Model`) - #. Biogenic volatile organic compound emissions (Chapter :numref:`rst_Biogenic Volatile Organic Compounds (BVOCs)`) #. Dust mobilization and deposition (Chapter :numref:`rst_Dust Model`) diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 97e221f702..f71c59d22d 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -17,6 +17,10 @@ Martin, M.E., Hallett, R.A., and Stoddard, J.L. 2003. Is nitrogen deposition altering the nitrogen status of northeastern forests? BioScience 53:375-389. +.. _Alietal2016: + +Ali, A. A., C. Xu, A. Rogers, R. A. Fisher, S. D. Wullschleger, E. Massoud, J. A. Vrugt, J. D. Muss, N. McDowell, and J. Fisher, 2016: A global scale mechanistic model of photosynthetic capacity (LUNA V1. 0). Geosci. Mod. Dev., 9:587-606. + .. _Allenetal2005: Allen, C.B., Will, R.E., and Jacobson, M.A. 2005. Production efficiency @@ -209,6 +213,10 @@ Geosci. Model Dev., 7, 2193-2222, doi:10.5194/gmd-7-2193-2014. Brun, E. 1989. Investigation of wet-snow metamorphism in respect of liquid water content. Ann. Glaciol. 13:22-26. +.. _Brunkeetal2016: + +Brunke, M. A., P. Broxton, J. Pelletier, D. Gochis, P. Hazenberg, D. M. Lawrence, L. R. Leung, G.-Y. Niu, P. A. Troch, and X. Zeng, 2016: Implementing and Evaluating Variable Soil Thickness in the Community Land Model, Version 4.5 (CLM4.5). J. Clim. 29:3441-3461. + .. _BugmannSolomon2000: Bugmann, H., and Solomon, A.M. 2000. Explaining forest composition and @@ -319,6 +327,10 @@ Crawford, T. W., Rendig, V. V., and Broadent, F. E. 1982. Sources, fluxes, and sinks of nitrogen during early reproductive growth of maize (Zea mays L.). Plant Physiol. 70:1645-1660. +.. _Dahlinetal2015: + +Dahlin, K., R. Fisher, and P. Lawrence, 2015: Environmental drivers of drought deciduous phenology in the Community Land Model. Biogeosciences, 12:5061-5074. + .. _DaiZeng1997: Dai, Y., and Zeng, Q. 1997. A land surface model (IAP94) for climate @@ -471,6 +483,10 @@ Firestone, M.K. and Davidson, E.A. 1989. Exchange of Trace Gases between Terrestrial Ecosystems and the Atmosphere. In: M.O. Andreae and D.S. Schimel (Editors). John Wiley and Sons, pp. 7-21. +.. _Fisheretal2015: + +Fisher, R. A., S. Muszala, M. Verteinstein, P. Lawrence, C. Xu, N. G. McDowell, R. G. Knox, C. Koven, J. Holm, B. M. Rogers, A. Spessa, D. Lawrence, and G. Bonan, 2015: Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes, CLM4.5(ED). Geosci. Model Dev., 8: 3593-3619, doi:10.5194/gmd-8-3593-2015. + .. _FlannerZender2005: Flanner, M.G., and Zender. C.S. 2005. Snowpack radiative heating: @@ -547,7 +563,11 @@ Climate. John Wiley and Sons, Chichester, England. Getirana, A. C. V., A. Boone, D. Yamazaki, B. Decharme, F. Papa, and N. Mognard. 2012. The hydrological modeling and analysis platform -(HyMAP): Evaluation in the Amazon basin, J. Hydrometeorol., 13, 1641–1665. +(HyMAP): Evaluation in the Amazon basin, J. Hydrometeorol., 13, 1641-1665. + +.. _Ghimireetal2016: + +Ghimire, B., W. J. Riley, C. D. Koven, M. Mu, and J. T. Randerson, 2016: Representing leaf and root physiological traits in CLM improves global carbon and nitrogen cycling predictions. J. Adv. Mod. Earth Sys. 8: 598-613. .. _Gholzetal1985: @@ -1448,6 +1468,10 @@ from soils. J. Geophys. Res. 106(D15):17403-17419. Paterson, W.S.B., 1994. The Physics of Glaciers. Elsevier Science Inc., New York, 480 pp. +.. _Pelletieretal2016: + +Pelletier, J. D., P. D. Broxton, P. Hazenberg, X. Zeng, P. A. Troch, G. Y. Niu, Z. Williams, M. A. Brunke, and D. Gochis, 2016: A gridded global data set of soil, intact regolith, and sedimentary deposit thicknesses for regional and global land surface modeling. J. Adv. Mod. Earth Sys. 8:41-65. + .. _Petrescuetal2010: Petrescu, A.M.R. et al. 2010. Modeling regional to global CH4 emissions @@ -1564,6 +1588,10 @@ Meeting, Boulder, CO. Roesch, A., M. Wild, H. Gilgen, and A. Ohmura. 2001. A new snow cover fraction parametrization for the ECHAM4 GCM, Clim. Dyn., 17:933–946. +.. _Rogersetal2017: + +Rogers, A., B. E. Medlyn, J. S. Dukes, G. Bonan, S. Caemmerer, M. C. Dietze, J. Kattge, A. D. Leakey, L. M. Mercado, and U. Niinemets, 2017: A roadmap for improving the representation of photosynthesis in Earth system models. New Phytologist, 213:22-42. + .. _Ryan1991: Ryan, M. G. 1991. A simple method for estimating gross carbon budgets @@ -1682,6 +1710,10 @@ patterns of evapotranspiration in response to multiple environmental factors simulated by the Community Land Model. Environ. Res. Lett. 8:024012. +.. _Shietal2016: + +Shi, M., J. B. Fisher, E. R. Brzostek, and R. P. Phillips, 2016: Carbon cost of plant nitrogen acquisition: global carbon cycle impact from an improved plant nitrogen cycle in the Community Land Model. Glob. Change Biol., 22:1299-1314. + .. _Shiklomanov2000: Shiklomanov, I.A. 2000. Appraisal and assessment of world water @@ -2091,6 +2123,10 @@ Wu, H., J. S. Kimball, H. Li, M. Huang, L. R. Leung, and R. F. Adler (2012), A New Global River Network Database for Macroscale Hydrologic modeling, Water Resour. Res., 48, W09701, doi:10.1029/2012WR012313. +.. _Xuetal2012: + +Xu, C., R. Fisher, S. D. Wullschleger, C. J. Wilson, M. Cai, and N. G. McDowell, 2012: Toward a mechanistic modeling of nitrogen limitation on vegetation dynamics. PloS one, 7:e37914. + .. _Yang1998: Yang, Z.-L. 1998. Technical note of a 10-layer soil moisture and From 4a563c250a28559a3f39b29fffe53985c6408cff Mon Sep 17 00:00:00 2001 From: Peter Lawrence Date: Wed, 23 Aug 2017 15:51:19 -0600 Subject: [PATCH 0089/1973] PJL Updated the Transient Landcover Chapter --- .../CLM50_Tech_Note_Transient_Landcover.rst | 441 +++++++----------- 1 file changed, 180 insertions(+), 261 deletions(-) diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index e6f40c34ef..16aaa120a8 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -1,71 +1,76 @@ .. _rst_Transient Landcover Change: -Transient Landcover Change -============================== +Transient Land Use and Land Cover Change +=========================================== CLM includes a treatment of mass and energy fluxes associated with -prescribed temporal change in land cover. Using an annual time series of -the spatial distribution of PFTs and wood harvest, CLM diagnoses the -change in area for PFTs at each model time step and then performs mass -and energy balance accounting necessary to represent the expansion and -contraction of PFT area. This implementation currently only pertains to -the case where all PFTs for a particular grid cell coexist on a single -soil/snow column. In this case, the only biogeophysical state variable -affected is canopy water (:math:`W_{can}` ). The biogeochemical impacts -of land use and land cover change are simulated through changes in CLM -carbon pools and fluxes as shown in Figure 21.1 and described further in -Chapter 13. Other implementations are possible, such as changing the -area of soil/snow columns or land unit area, however these require -additional consideration of conservation of mass and energy among the -soil/snow columns and land units which will be implemented in future -versions of CLM. - -Annual Transient Land Cover Data and Time Interpolation ------------------------------------------------------------- - -The changes in area over time associated with individual PFTs are -prescribed through a forcing dataset, referred to here as the *dynpft* -dataset. The *dynpft* dataset consists of an annual time series of -global grids, where each annual time slice describes the fractional area -occupied by all PFTs and the annual wood harvest within each grid cell. -Changes in area and wood harvest for each PFT within a grid cell at each -model time step are inferred from a time-interpolation of the area -information for the PFT from the two bracketing annual time slices in -the *dynpft* dataset. - -As a special case, when the time dimension of the *dynpft* dataset +prescribed temporal land use and land cover change (LULCC). The model uses an annual +time series of the spatial distribution of the natural and crop land units +of each grid cell, in combination with the distribution of PFTs and CFTs +that exist in those land units. Additional land use is prescribed through annual +crop specific management of nitrogen fertilizer and irrigation described further +in Chapter 25, and through wood harvest on tree PFTs. For changes in the distributions +of natural and crop vegetation CLM diagnoses the change in area of the PFTs and CFTs +on January 1st of each model year and then performs mass and energy balance accounting +necessary to represent the expansion and contraction of the PFT and CFT areas. The +biogeophysical impacts of LULCC are simulated through changes +in surface properties which in turn impact the surface albedo, hydrology, and roughness +which then impact fluxes of energy, moisture and momentum to the atmosphere under the +altered properties. Additionally changes in energy and moisture associated with changes +in the natural and crop vegetation distribution are accounted for through small +fluxes to the atmosphere. The biogeochemical impacts of LULCC +are simulated through changes in CLM carbon pools and fluxes as shown in Figure xx.x and +described further in Chapter 16. + +Annual Transient Land Use and Land Cover Data and Time Interpolation +----------------------------------------------------------------------- + +The changes in area over time associated with changes in natural and crop +vegetation and the land use on that vegetation are prescribed through a forcing dataset, +referred to here as the *landuse.timeseries* dataset. The *landuse.timeseries* dataset +consists of an annual time series of global grids, where each annual time slice describes +the fractional area occupied by all PFTs and CFTs along with the nitrogen fertilizer and +irrigation fraction of each crop CFT, and the annual wood harvest applied to tree PFTs. +Changes in area of PFTs and CFTs are performed annually on the first time step of January +1st of the year. Fertilizer application, irrigation and wood harvest for each PFT and CFT +are performed at each model time step depending on rules from the crop and natural vegetation +phenology models. The irrigation fraction is set annually however fertlizer application and +wood harvest are set from a time-interpolation of the application rates from the two bracketing +annual time slices in the *landuse.timeseries* dataset. + +As a special case, when the time dimension of the *landuse.timeseries* dataset starts at a later year than the current model time step, the first time -slice from the *dynpft* dataset is used to represent the current time -step PFT fractional area distributions. Similarly, when the time -dimension of the *dynpft* dataset stops at an earlier year than the -current model time step, the last time slice of the *dynpft* dataset is -used. Thus, the simulation will have invariant representations of PFT +slice from the *landuse.timeseries* dataset is used to represent the current time +step PFT and CFT fractional area distributions. Similarly, when the time +dimension of the *landuse.timeseries* dataset stops at an earlier year than the +current model time step, the last time slice of the *landuse.timeseries* dataset is +used. Thus, the simulation will have invariant representations of PFT and CFT distributions through time for the periods prior to and following the -time duration of the *dynpft* dataset, with transient PFT distributions -during the period covered by the *dynpft* dataset. +time duration of the *landuse.timeseries* dataset, with transient PFT and CFT distributions +during the period covered by the *landuse.timeseries* dataset. The following equations capture this logic, where :math:`year_{cur}` is the calendar year for the current timestep, -:math:`dynpft\_ year\eqref{GrindEQ__1_}` and -:math:`dynpft\_ year(nyears)`\ are the first and last calendar years in -the *dynpft* dataset, respectively, :math:`nyears` is the number of -years in the *dynpft* dataset, :math:`nt_{1}` and :math:`nt_{2}` +:math:`landuse.timeseries\_ year(1)` and +:math:`landuse.timeseries\_ year(nyears)` are the first and last calendar years in +the *landuse.timeseries* dataset, respectively, :math:`nyears` is the number of +years in the *landuse.timeseries* dataset, :math:`nt_{1}` and :math:`nt_{2}` :math:`{}_{ }`\ are the two bracketing years used in the interpolation algorithm, and :math:`n` is the index value for the -:math:`dynpft\_ year` array corresponding to -:math:`dynpft\_ year(n)=year_{cur}` : +:math:`landuse.timeseries\_ year` array corresponding to +:math:`landuse.timeseries\_ year(n)=year_{cur}` : .. math:: :label: 26.1) - nt_{1} =\left\{\begin{array}{l} {1\qquad {\rm for}\qquad year_{cur} 0` and decreases for :math:`\Delta w_{p} <0`. Mass and Energy Conservation --------------------------------- -Mass conservation is maintained across a PFT weight transition by -summing up all the water state variables to get the total vegetated land -unit water content before (:math:`W_{tot,1}` ) and after -(:math:`W_{tot,2}` ) new PFT weights are calculated. For example, +Mass conservation is maintained across PFT and CFT weight transitions by +summing up all the carbon, nitrogen, water and energy state variables to get the total vegetated land +units value before (:math:`W_{tot,1}` ) and after +(:math:`W_{tot,2}` ) the new PFT and CFT weights are calculated. Transitions are performed on above ground +variables first and then at the land unit level for below ground variables second. For example the hydrological +balance is calculated, :math:`W_{tot,1}` is .. math:: @@ -125,12 +132,11 @@ unit water content before (:math:`W_{tot,1}` ) and after where :math:`W_{a}` is the aquifer water, :math:`W_{sno}` is the snow water, :math:`w_{liq,i}` and :math:`w_{ice,i}` \ are the liquid and ice soil water contents, :math:`W_{can,j}` \ is the canopy water content for -PFT :math:`j`, and :math:`wt_{j,1}` is the PFT weight for PFT -:math:`j`. For the situation where only PFT weights are changing and all -other land unit fractions are constant, any difference between -:math:`W_{tot,1}` and :math:`W_{tot,2}` \ can only be due to -differences in the total canopy water before and after the PFT weight -change. To ensure water conservation, the typically very small +PFT and CFT :math:`j`, and :math:`wt_{j,1}` is the PFT or CFT weight for +:math:`j`. For the situation where PFT and CFT weights are changing, any difference +between :math:`W_{tot,1}` and :math:`W_{tot,2}` \ are due to +differences in the total canopy water before and after the PFT and CFT weight +change. To ensure conservation, the typically very small difference between :math:`W_{tot,2}` \ and :math:`W_{tot,1}` is subtracted from the grid cell runoff @@ -140,210 +146,117 @@ subtracted from the grid cell runoff R_{liq} =R_{liq} +W_{tot,2} -W_{tot,1} . Total energy is unperturbed in this case and therefore an energy -conservation treatment is not required. As noted above, other -implementations are possible and will be desirable in the future, such -as changing the area of soil/snow columns or land unit area, for example -in a situation in which crops are implemented on a separate soil column. -These would require additional consideration of conservation of mass and -energy among the soil/snow columns and land units. +conservation treatment is not required. Changing the area of natural and crop land units +in association with the change in PFTs and CFTs results in changes in the soil/snow columns +and land unit area. To address these additional changes, conservation of mass and +energy among the soil/snow columns and land units is performed as a secondary calculation once +all above ground PFT and CFT changes have been done. Annual Transient Land Cover Dataset Development ---------------------------------------------------- -This section describes the development of the d\ *ynpft* dataset. -Development of this dataset requires adapting for use with the CLM a -harmonized dataset of land cover change for the historical period and -for different representations of the scenario period. +This section describes the development of the *landuse.timeseries* dataset. +Development of this dataset involves the translation of +harmonized datasets of LULCC for the historical period and +for the different Shared Socioeconomic Pathway (SSP) - Representative +Concentration Pathway (RCP) scenarios. Additionally, LULCC time +series are to be generated for the Last Millennium and the extension beyond 2100 experiments +of CMIP6. -21.3.1 UNH Transient Land Use and Land Cover Change Dataset +LUH2 Transient Land Use and Land Cover Change Dataset ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -To coordinate the processing and consistency of land use and land cover -change data between the historical period (1850-2005) and the four IPCC -representative concentration pathways (RCPs) derived from integrated -assessment models (IAM), the University of New Hampshire -(stocktickerUNH) research group (Louise Chini, George Hurtt, Steve -Frolking; luh.unh.edu) produced a harmonized transient dataset for use -in climate change simulations. The historical component of the transient -land use and land cover change dataset is Version 1 of the Land-Use -History A product (LUHa.v1) covering the period 1850-2005. The RCP -transient land use and land cover change components (2005-2100) are -referred to as the Future Land-Use Harmonization A products. Version 1 -(LUHa.v1\_future.v1) is used for the AIM, MESSAGE, and MiniCAM IAMs; -Version 1.1 (LUHa.v1\_future.v1.1) is used for the IMAGE IAM. The land -cover information is provided at 0.5 degree grid resolution and includes -fractional grid cell coverage by crops, pasture, and primary and -secondary natural vegetation. - -The crop fraction of the grid cell represents the area of the grid cell -used to grow any type of crop. Similarly, pasture represents the -fraction of a grid cell used for grazing livestock. The remaining area -in a half degree grid cell is partitioned into primary and secondary -vegetation. Primary vegetation represents the fractional area of a grid -cell with vegetation undisturbed by human activities. Secondary -vegetation represents vegetated areas that have recovered from some -human disturbance; this could include re-vegetation of pasture and crop -areas as well as primary vegetation areas that have been logged. - -The stocktickerUNH dataset provides a transition matrix that describes -the annual fraction of land that is transformed from one category to -another (e.g. primary land to crop, pasture to crop, etc.; Hurtt et al. -2006). Included in these transitions is the conversion of secondary land -to secondary land, representing the logging on land recovering from an -earlier disturbance. These transitions provide information on all -changes in land cover through the sum of all transitions in a given -year. Harmonized prescriptions of CMIP5 wood harvest statistics also are -provided by (Hurtt et al. 2011) for the historical and RCP time series. -The wood harvest is prescribed spatially on the same 0.5 degree grid as -the land use class transitions for each year. - -To ensure consistency with the various land use classes wood harvest is -prescribed as both the area of land harvested and the amount of carbon -extracted in the grid cell for a particular year. To account for the -differences in standing amount of wood carbon as well as the differences -in harvest intensity associated with the different land units, the -harvest area and carbon amounts are prescribed for the five classes of: -PlaceNamePrimary PlaceTypeForest, PlaceNamePrimary PlaceTypeNon-Forest, -PlaceNameSecondary PlaceNameMature PlaceTypeForest, PlaceNameSecondary -PlaceNameYoung PlaceTypeForest, and PlaceNameplaceSecondary -PlaceTypeNon-Forest. - -21.3.2 Representing Land Use and Land Cover Change in CLM -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -CLM represents the land surface as a hierarchy of sub-grid types: -glacier; lake; wetland; urban; and vegetated land. The vegetated land is -further divided into a mosaic of PFTs. To represent the UNH transient -land use and land cover change dataset in CLM, the annual fractional -composition of crop, pasture, primary vegetation, and secondary -vegetation land units specified in the UNH dataset needs to be -faithfully represented with a corresponding PFT mosaic in CLM using the -methods described in Lawrence et al (2012). This method translated each -of the UNH land units into fractional PFT values based on current day -and potential vegetation CLM land surface parameters for that grid cell -and for that year, as shown in Figure 21.2. - -The methodology for creating the transient PFT dataset is based on four -steps which are applied across the time series. First, crop PFT -composition is directly specified from the crop land unit fractional -area. Second, pasture PFTs are assigned based on grass PFTs found in the -potential vegetation and current day CLM land surface parameters scaled -by the area of pasture. Third, potential vegetation PFTs are assigned to -the grid cell scaled by the fractional area of the primary land unit. -Last, current day non-crop and non-pasture PFTs are assigned to the grid -cell scaled by the fractional area of the secondary land unit. The -annual tree harvest values also are calculated from the harvest -information of the UNH dataset used in conjunction with transient tree -PFT values. Separate datasets representing the extent of water, wetland, -ice and urban land cover are used to compile the final land cover -present in each CLM grid cell. These additional non-vegetated land cover -fractions are held constant throughout the time series. All datasets are -resolved at the half degree grid resolution. - -21.3.3 Present Day PFT Dataset -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The present day dataset is based on the methodology of Lawrence and -Chase (2007) and uses a variety of satellite products to develop present -day PFT distributions with matching leaf area index values. The dataset -initially derives fractions of bare ground and tree cover from the -Moderate Resolution Imaging Spectroradiometer (MODIS) vegetation -continuous fields product (Hansen et al. 2003). To further distinguish -tree types, the tree fraction is divided into broadleaf/needleleaf and -evergreen/deciduous types based on the Advanced Very High Resolution -Radiometer (AVHRR) continuous fields tree cover (DeFries et al. 2000). -The remaining grid cell area is assumed to be herbaceous grasses and -shrubs, including crops. The area of crop is initially determined from -Ramankutty et al. (2008) circa 2000 global crop land areas, and the -remaining grass and shrub fractions are derived from the MODIS land -cover (Friedl et al. 2002). Further subdivisions of grass, shrub and -tree PFTs into tropical, temperate and boreal types were based on the -physiology and climate rules from Nemani and Running (1996), and for -C3/C4 photosynthetic pathways based on MODIS derived leaf area index -values and the mapping methods of Still et al. (2003). In contrast to -Lawrence and Chase (2007), the understory grasses of forested areas have -been replaced with trees for the dataset. Some advantages of this -dataset are that it reproduces the physical properties as observed by -the MODIS land surface data (e.g. grid cell albedo and leaf area index -values) while maintaining the multiple PFT representation. - -21.3.4 Potential PFT Distribution -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Essential to any reconstruction of past vegetation distributions is the -need to know the potential vegetation that would be there prior to human -activities. Many researchers have worked to estimate potential -vegetation types at regional and global scales from remnant vegetation -and other field data or from bioclimatic models. The CLM potential PFT -distribution is derived from Ramankutty et al. (2008) at 5 arc-minute -resolution. However, this product is based on a biome type -classification system that is not directly compatible with the CLM PFT -distributions. - -The CLM potential vegetation is described by Lawrence and Chase (2010). -This reconstruction describes potential PFT distributions extrapolated -from the current day PFT composition of remnant natural biomes as mapped -by Ramankutty et al. (2008). The current day remnant natural PFT -parameters were taken from the Lawrence and Chase (2007) dataset with -the same forest understory changes as described above to ensure -consistency between the two datasets. The current day remnant natural -PFT biome compositions were spatially extrapolated to the potential -vegetation biome distributions provided by Ramankutty et al. (2008) -using inverse distance weighted methods. The resulting product is a CLM -PFT distribution that may have existed prior to human disturbance under -current day climate conditions. - -21.3.5 Transient Land Cover Change Dataset -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -For each year from 1850 to 2005 and to 2100 for each of the four RCPs, -PFT distributions and wood harvest are adjusted based on the -stocktickerUNH dataset. Initially the grid cell is checked to adjust the -crop area based on the stocktickerUNH crop area. If the crop area -exceeds the available land area (i.e. the grid cell area minus the area -assigned to glacier, wetlands, lake and urban areas) then all the -available area is allocated to crops and no other PFTs are added. After -the crop area is assigned, any remaining area is considered available -for pasture. - -As the pasture data from the stocktickerUNH dataset represents grazing, -pasture areas are assigned in the present day based on the availability -of grasses (C3, C4 and boreal C3 PFTs) and shrubs relative to the bare -soil fraction. If the grazing area exceeds the total vegetated area from -both the potential and current day PFT data, then the grazed area is -limited to the larger of the potential or current day vegetated area. -This is done to prevent representing sparsely vegetated grazing areas as -100% vegetated pastures. Once the grazing area is less than or equal to -the total vegetated area, then grazing areas are assigned to the C3 and -C4 grass areas based on their potential vegetation and current day -fractions. In areas where the grazing area cannot be met through the -current day or potential vegetation grass fraction alone, the current -day tree PFTs are converted to grass PFTs, with the remaining shrub PFTs -included as being grazed. - -Once crop and pasture areas are assigned to a grid cell, the remaining -area is assigned to primary and secondary natural vegetation. Primary -vegetation is assumed to be undisturbed and reflects the potential -vegetation PFT distributions. In the secondary region, the PFT -distributions are based on the current day non-crop and non-pasture PFTs -in the grid cell. This process ensures that the PFT distributions are -kept consistent with the original current day and potential vegetation -CLM parameters, while remaining faithful to the stocktickerUNH assigned -areas. - -Forest Harvest Dataset Changes -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Discussions following the initial analysis of CCSM4 land cover change -experiments found there were very high wood harvest areas compared to -wood harvest carbon in the RCP 6.0 and RCP 8.5 time series. The high -wood harvest areas were traced to using gridded spatially explicit wood -harvest targets from the MESSAGE and AIM groups for these two time -series, rather than using regional targets with spatial downscaling in -GLM as done with the other three time periods. As a result of these -discussions new amended wood harvest targets were generated with -regional targets through GLM for the RCP 6.0 and RCP 8.5 time series as -described in Lawrence et al. (2012). +To coordinate the processing and consistency of LULCC data between +the historical period (1850-2015) and the six +SSP-RCP (2016-2100) scenarios derived from Integrated +Assessment Models (IAM), the University of Maryland and the University of New Hampshire +research groups (Louise Chini, George Hurtt, Steve +Frolking and Ritvik Sahajpal; luh.umd.edu) produced a new version of the Land Use Harmonized version 2 +(LUH2) transient datasets for use with Earth System Model simulations. The new data sets +are the product of the Land Use Model Intercomparison Project (LUMIP; https://cmip.ucar.edu/lumip) +as part of the Coupled Model Intercomparison Project 6 (CMIP6). The historical component of the +transient LULCC dataset has agriculture and urban +land use based on HYDE 3.2 with wood harvest based on FAO, Landsat and other sources, for the period 850-2015. +The SSP-RCP transient LULCC components (2015-2100) are +referred to as the LUH2 Future Scenario datasets. The LULCC information is provided at 0.25 degree grid resolution and includes +fractional grid cell coverage by the 12 land units of: + +Primary Forest, Secondary Forest, Primary Non-Forest, Secondary Non-Forest, + +Pasture, Rangeland, Urban, + +C3 Annual Crop, C4 Annual Crop, C3 Perennial Crop, C4 Perennial Crop, and C3 Nitrogen Fixing Crop. + +The new land unit format is an improvement on the CMIP5 LULCC +datasets as they: provide Forest and Non Forest information in combination with Primary and Secondary +land; differentiate between Pasture and Rangelands for grazing livestock; and specify annual details +on the types of Crops grown and management practices applied in each grid cell. Like the CMIP5 LULCC datasets Primary vegetation +represents the fractional area of a grid cell with vegetation undisturbed by human activities. Secondary +vegetation represents vegetated areas that have recovered from some human disturbance; this could include +re-vegetation of pasture and crop areas as well as primary vegetation areas that have been logged. +In this manner the land units can change through deforestation from Forested to Non Forested land and in the +opposite direction from Non Forested to Forested land through reforestation or afforestation without going +through the Crop, Pasture or Rangeland states. + +The LUH2 dataset provides a time series of land cover states as well as a transition matrices that describes +the annual fraction of land that is transformed from one land unit category to +another (e.g. Primary Forest to C3 Annual Crop, Pasture to C3 Perrenial Crop, etc.; Lawrence et al. +2016). Included in these transition matrices is the total conversion of one land cover type to another referred to +as Gross LULCC. This value can be larger than the sum of the changes in the state of a land unit from one time period +to the next known as the Net LULCC. This difference is possible as land unit changes can occur both from the land unit +and to the land unit at the same time. An example of this difference occurs with shifting cultivation where Secondary Forest +can be converted to C3 Annual Crop at the same time as C3 Annual Crop is abandoned to Secondary Forest. + +The transition matrices also provide harmonized prescriptions of wood harvest both in area of the grid cell harvested +and in the amount of biomass carbon harvested. The wood harvest biomass amount includes a 30% slash component inline with +the CMIP5 LULCC data described in (Hurtt et al. 2011). The harvest area and carbon amounts are prescribed for the five classes of: +Primary Forest, Primary Non-Forest, +Secondary Mature Forest, Secondary +Young Forest, and Secondary +Non-Forest. + +Additional land use management is prescribed on the Crop land units for +nitrogen fertilization and irrigation equipped land. The fertilizer application and the the irrigation fraction is +prescribed for each Crop land unit in a grid cell individually for each year of the time series. The wood harvest +and crop management are both prescribed spatially on the same 0.25 degree grid as the land use class transitions. + +Representing LUH2 Land Use and Land Cover Change in CLM5 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To represent the LUH2 transient LULCC dataset in CLM5, the annual fractional +composition of the twelve land units specified in the dataset needs to be +faithfully represented with a corresponding PFT and CFT mosaics of CLM. +CLM5 represents the land surface as a hierarchy of sub-grid types: +glacier; lake; wetland; urban; vegetated land; and crop land. The vegetated land is +further divided into a mosaic of Plant Functional Types (PFTs), while the crop land +is divided into a mosaic of Crop Functional Types (CFTs). + +To support this translation task the CLM5 Land Use Data tool has been built that extends the +methods described in Lawrence et al (2012) to include all the new functionality of CMIP6 and CLM5 LULCC. +The tool translates each of the LUH2 land units for a given year into fractional PFT and CFT values based on +the current day CLM5 data for the land unit in that grid cell. The current day land unit descriptions are generated from +from 1km resolution MODIS, MIRCA2000, ICESAT, AVHRR, SRTM, and CRU climate data products combined with reference year +LUH2 land unit data, usually set to 2005. Where the land unit does not exist in a grid cell for the current +day, the land unit description is generated from nearest neighbors with an inverse distance weighted search +algorithm. + +The Land Use Data tool produces raw vegetation, crop, and management data files which are combined with +other raw land surface data to produce the CLM5 initial surface dataset and the dynamic +*landuse.timeseries* dataset with the CLM5 mksurfdata_map tool. The schematic of this entire process from +LUH2 time series and high resolution current day data to the output of CLM5 surface datasets from the +mksurfdata_map tool is shown in Figure 21.2. + +The methodology for creating the CLM5 transient PFT and CFT dataset is based on four +steps which are applied across all of the historical and future time series. +The first step involves generating the current day descriptions of natural and managed vegetation PFTs at +1km resolution from the global source datasets, and the current day description of crop CFTs at the 10km resolution +from the MIRCA 2000 datasets. The second step combines the current day (2005) LUH2 land units with the current +day CLM5 PFT and CFT distributions to get CLM5 land unit descriptions in either PFTs or CFTs at the LUH2 resolution of +0.25 degrees. The third step involves combining the LUH2 land unit time series with the CLM5 PFT and CFT descriptions +for that land unit to generate the CLM5 raw PFT and CFT time series in the *landuse.timeseries* file. At this point in the process +management information in terms of fertilizer, irrigation and wood harvest are added to the CLM5 PFT and CFT data +to complete the CLM5 raw PFT and CFT files. The final step is to combine these files with the other raw CLM5 surface +data files in the mksurfdata_map tool. .. _Figure Schematic of land cover change: @@ -351,8 +264,14 @@ described in Lawrence et al. (2012). Schematic of land cover change impacts on CLM carbon pools and fluxes. -.. _Figure Schematic of translation of annual UNH land units: +.. _Figure Schematic of translation of annual LUH2 land units: .. figure:: image2.png - Schematic of translation of annual UNH land units to CLM4 plant functional types. + Schematic of translation of annual LUH2 land units to CLM5 plant and crop functional types. + + .. _Figure Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool + +.. figure :: image3.png + + Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool From b8ca1aa0a5a26f6f570c2afeada0a8c169e3c0e4 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 23 Aug 2017 16:23:57 -0600 Subject: [PATCH 0090/1973] Updates to BVOC and methane (finundated) chapters --- .../tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst | 10 +++---- .../Methane/CLM50_Tech_Note_Methane.rst | 26 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst b/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst index 433f26d97d..e7e8637649 100644 --- a/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst +++ b/doc/source/tech_note/BVOCs/CLM50_Tech_Note_BVOCs.rst @@ -9,17 +9,17 @@ al. 2003; Oleson et al. 2004) was based on Guenther et al. (1995). Heald et al. (2008) updated this scheme in CLM4 based on Guenther et al. (2006). The current version was implemented in CLM4.5 and is based on MEGAN2.1 discussed in detail in Guenther et al. (2012). This update of MEGAN incorporates four -main features: expansion to 147 chemical compounds the treatment of the -light-dependent fraction (LDF) for each compound inclusion of the +main features: 1) expansion to 147 chemical compounds, 2) the treatment of the +light-dependent fraction (LDF) for each compound, 3) inclusion of the inhibition of isoprene emission by atmospheric CO\ :sub:`2` and -emission factors mapped to the specific PFTs of the CLM. +4) emission factors mapped to the specific PFTs of the CLM. MEGAN2.1 now describes the emissions of speciated monoterpenes, -sesquiterpenes, oxygenated VOC as well as isoprene. A flexible scheme +sesquiterpenes, oxygenated VOCs as well as isoprene. A flexible scheme has been implemented in the CLM to specify a subset of emissions. This allows for additional flexibility in grouping chemical compounds to form the lumped species frequently used in atmospheric chemistry. The mapping -or grouping are therefore defined through a namelist parameter in +or grouping is therefore defined through a namelist parameter in drv\_flds\_in, e.g. megan\_specifier = ’ISOP = isoprene’, ’BIGALK = pentane + hexane + heptane + tricyclene’. diff --git a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst index f78f464779..7c89f857e3 100644 --- a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst +++ b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst @@ -297,14 +297,12 @@ calculated with Henry’s law as described in equation . Based on the ranges reported in :ref:`Colmer (2003)`, we have chosen baseline aerenchyma porosity values of 0.3 for grass and crop PFTs and 0.1 for -tree and shrub PFTs. The aerenchyma area varies over the course of the -growing season; we parameterize this dependency using the simulated leaf -area index *L* (m:sup:`2` m\ :sup:`-2`), as in :ref:`Wania et al. 2010`: +tree and shrub PFTs: .. math:: :label: 24.9 - T=\frac{f_{N} N_{a} L}{0.22} \pi R^{2} . + T=\frac{4 f_{N} N_{a}}{0.22} \pi R^{2} . Here :math:`N_{a}` is annual net primary production (NPP, mol m\ :sup:`-2` s\ :sup:`-1`); *R* is the aerenchyma radius @@ -600,8 +598,8 @@ and the soil element below the interface: Inundated Fraction Prediction ---------------------------------- -We developed a simplified dynamic representation of spatial inundation -based on recent work by :ref:`Prigent et al. (2007)`, who described a +A simplified dynamic representation of spatial inundation +based on recent work by :ref:`Prigent et al. (2007)` is used. Prigent et al. (2007) described a multi-satellite approach to estimate the global monthly inundated fraction (:math:`{F}_{i}`) over an equal area grid (0.25 :math:`\circ` \ :math:`\times`\ 0.25\ :math:`\circ` at the equator) @@ -610,20 +608,20 @@ could be used as a measure of sensitivity of their detection approach at low inundation. We therefore used the sum of their satellite-derived :math:`{F}_{i}` and the constant IGBP estimate when it was less than 10% to perform a simple inversion for the inundated fraction for methane -production (:math:`{f}_{s}`). The method optimized three parameters -(:math:`{p}_{1}`, *p*\ :sub:`2`, :math:`{p}_{3}`) for each -grid cell in a simple model based on simulated water table depth -(:math:`{z}_{w}`) and surface runoff (:math:`{Q}_{r}` (mm s\ :sup:`-1`)): +production (:math:`{f}_{s}`). The method optimized two parameters +(:math:`{fws}_{slope}` and :math:`{fws}_{intercept}`) for each +grid cell in a simple model based on simulated total water storage +(:math:`{TWS}`): .. math:: :label: 24.20 - f_{s} =P_{1} e^{{\raise0.7ex\hbox{$ -z_{w} $}\!\mathord{\left/ {\vphantom {-z_{w} p_{2} }} \right. \kern-\nulldelimiterspace}\!\lower0.7ex\hbox{$ p_{2} $}} } +p_{3} Q_{r} . + f_{s} =fws_{slope} TWS + fws_{intercept} . These parameters were evaluated at the 0.5\ :sup:`o` resolution, and aggregated for -coarser simulations. We expect that ongoing work in the hydrology -submodel of CLM will alleviate the need for this crude simplification of +coarser simulations. Ongoing work in the hydrology +submodel of CLM may alleviate the need for this crude simplification of inundated fraction in future model versions. .. _Seasonal Inundation: @@ -631,7 +629,7 @@ inundated fraction in future model versions. Seasonal Inundation ------------------------ -We have developed a simplified scaling factor to mimic the impact of +A simple scaling factor is used to mimic the impact of seasonal inundation on CH\ :sub:`4` production (see appendix B in :ref:`Riley et al. (2011a)` for a discussion of this simplified expression): From 34c574ca24b53b29197c78c4656b5a5fb007192c Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Thu, 24 Aug 2017 10:45:15 -0600 Subject: [PATCH 0091/1973] Update pft optical properties --- .../CLM50_Tech_Note_Surface_Albedos.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index f16a46ec97..2548b228fa 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -471,19 +471,19 @@ intercepted snow (:numref:`Table Intercepted snow optical properties`) are from +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ | Temp Corn | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Spring Wheat | 0.65 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + | Spring Wheat | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ | Temp Soybean | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Cotton | -0.50 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | + | Cotton | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Rice | 0.65 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | + | Rice | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Sugarcane | -0.50 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | + | Sugarcane | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Tropical Corn | -0.50 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | + | Tropical Corn | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ - | Tropical Soybean | -0.50 | 0.11 | 0.58 | 0.31 | 0.53 | 0.07 | 0.25 | 0.120 | 0.250 | + | Tropical Soybean | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ .. _Table Intercepted snow optical properties: From bedbaf7a3ae9d6cf9eb5bc8f283695d13e0ed340 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Fri, 25 Aug 2017 15:39:31 -0600 Subject: [PATCH 0092/1973] First part of FUN documentation --- .../tech_note/FUN/CLM50_Tech_Note_FUN.rst | 284 ++++++++++++++++++ 1 file changed, 284 insertions(+) diff --git a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst index 3deceec659..7c11f2bd7d 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -2,3 +2,287 @@ Fixation and uptake of nitrogen =============================== + +Introduction +----------------- + + +The Fixation and Uptake of Nitrogen model is based on work by Fisher (J.) et al., (2008), Brzostek et al. (2015) and Shi et al. (2016). The concept of FUN is that in most cases, Nitrogen uptake requires the expenditure of energy in the form of carbon, and further, that there are numerous potential sources of Nitrogen in the environment which a plant may exchange for carbon. The ratio of carbon expended to Nitrogen acquired is referred to here as the cost, or exchange rate, of N acquisition (:math:`E_{nacq}`, gC/gN)). There are four pathways for N uptake: + +1. Fixation by symbiotic bacteria in root nodules (for N fixing plants) (:math:`fix`) +2. Retranslocation of N from senescing tissues (:math:`ret`) +3. Active uptake of Nitrogen by plant roots as nitrate (:math:`NO`:sub:`3`) (:math:`act_{no3}`) +4. Active uptake of Nitrogen by plant roots as ammonia (:math:`NH`:sub:`4`) (:math:`act_{nh4}`) + +The notation suffix for each pathway is given in parentheses here. At each timestep, each of these pathways is associated with a cost term (:math:`cost_x`), a payment in carbon (:math:`C_{nuptake,x}`), and an influx of Nitrogen (:math:`N_{uptake,x}`), any of which may be zero, and where :math:`x` is one of the four uptake streams listed above (:math:`fix`, :math:`ret`, :math:`act_{no3}` or :math:`act_{nh4}`). + + +Boundary conditions of FUN +-------------------------------------------------------- + +Available Carbon +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The carbon available for FUN, :math:`C_{avail}` (gC m\ :sup:`-2`) is the total canopy photosynthetic uptake (GPP), minus the maintenance respiration fluxes (:math:`m_r`) and multiplied by the time step in seconds (:math:`\delta t`). Thus, the remainder of this chapter considers fluxes per timestep, and integrates these fluxes as they are calculated. + + .. math:: + + C_{avail} = (GPP - m_r) \delta t + +Growth respiration is thus only calculated on the part of the carbon uptake that remains after expenditure of C by the FUN module. + +Available Soil Nitrogen +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Cost of Nitrogen Fixation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Cost of Active Uptake +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + + +Resolving N cost across simultaneous uptake streams +-------------------------------------------------------- +The total cost of N uptake is calculated based on the assumption that carbon is partitioned to each stream in proportion to the inverse of the cost of uptake. So, more expensive pathways receive less carbon. Earlier versions of FUN (Fisher et al. 2008) utilized a scheme whereby plants only took up N from the cheapest pathway. Brzostek et al. introduced a scheme for the simultaneous uptake from different pathways. Here we calcualate a 'conductance' to N uptake (analagous to the inverse of the cost function conceptualized as a resistance term) :math:`N_{conductance}` ( gN/gC) as: + + .. math:: + + N_{conductance}= \sum{(1/cost_{x})} + +From this, we then calculate the fraction of the carbon allocated to each pathway as + + .. math:: + + C_{frac,x} = \frac{1/cost_{x}}{N_{conductance}} + + +These fractions are used later, to calculate the carbon expended on different uptake pathways. Next, the N acquired from each uptake stream per unit C spent (:math:`N_{exch,x}`, gN/gC) is determined as + + .. math:: + + N_{exch,x} = \frac{C_{frac,x}}{cost_{x}} + +We then determine the total amount of N uptake per unit C spent (:math:`N_{exch,tot}`, gN/gC) as the sum of all the uptake streams. + + .. math:: + N_{exch,tot} = \sum{N_{exch,x}} + +and thus the subsequent overall N cost is + + .. math:: + N_{cost,tot} = 1/{N_{exch,tot}} + +Throughout these calculations, :math:`x` is the sum of the fixation and active uptake pathways. Retranslocation is determined via a different set of mechanisms, once the :math:`N_{cost,tot}` is known. + +Nitrogen Retranslocation +-------------------------------------------------------- +The retranslocation uses an iterative algorithm to remove Nitrogen from each piece of falling litter. There are two pathways for this, 'free' uptake which removes the labile N pool, and 'paid-for' uptake which uses C to extract N from increasingly more recalcitrant pools. + +At each timestep, the pool of carbon in falling leaves (:math:`C_{fallingleaf}`, g m\ :sup:`-2`) is generated from the quantity of litterfall on that day (see Phenology chapter for details). The amount of N in the litter pool (:math:`N_{fallingleaf}`, g m\ :sup:`-2`) is calculated as the total leaf N multiplied by the fraction of the leaf pool passed to litter that timestep. + + .. math:: + + N_{fallingleaf} = N_{leaf}.C_{fallingleaf}/C_{leaf} + +The carbon available at the beginning of the iterative retranslocation calculation is equal to the :math:`C_{avail}` input into FUN. + + .. math:: + + C_{avail_retrans,0} = C_{avail} + + +Free Retranslocation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Some part of the leaf Nitrogen pool is removed without the need for an C expenditure. This 'free' N uptake amount, (:math:`N_{retrans,free}`, gN m\ :sup:`-2`) is calculated as + + .. math:: + + N_{retrans,free} = max(N_{fallingleaf} - (C_{fallingleaf}/CN_{litter,min} ),0.0) + +where :math:`CN_{litter,min}` is the minimum C:N ratio of the falling litter (currently set to 1.5 x the target C:N ratio). + +The new :math:`N_{fallingleaf}` (gN m\ :sup:`-2`) is then determined as + + .. math:: + + N_{fallingleaf} = N_{fallingleaf} - N_{retrans,free} + +and the new litter C:N ratio as + + .. math:: + + CN_{fallingleaf}=C_{fallingleaf}/N_{fallingleaf} + + +Paid-for Retranslocation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The remaining calculations conduct an iterative calculation to determine the degree to which N retranslocation from leaves is paid for as C:N ratios and thus cost increase as N is extracted. The iteration continues until either + +1. The cost of retranslocation (:math:`cost_{retrans}` increases beyond the cost of acquiring N from alternative pathways (:math:`N_{cost,tot}`). +2. :math:`CN_{fallingleaf}` rises to a maximum level, after which no more extraction is possible (representing unavoidable N loss) or +3. There is no more carbon left to pay for extraction. + +First we calculate the cost of extraction (:math:`cost_{retrans}`, gC/gN) for the current leaf C:N ratio as + + .. math:: + + cost_{retrans}= k_{retrans} / (1/CN_{fallingleaf})^{1.3} + +where :math:`k_{retrans}` is a parameter controlling the overall cost of resorption, which also increases exponentially as the C:N ratio increases **Say something about 1.3 exponent**). + +Next, we calculate the amount of C needed to be spent to increase the falling leaf C:N ratio by 1.0 in this iteration :math:`i` (:math:`C_{retrans_spent,i}`, gC m\ :sup:`-2`) as: + .. math:: + + C_{retrans,spent,i} = cost_{retrans}.(N_{fallingleaf} - C_{fallingleaf}/ + (CN_{fallingleaf} + 1.0)) + +(wherein the retranslocation cost is assumed to not change over the increment of 1.0 in C:N ratio). Next, we calculate whether this is larger than the remaining C available to spend. + + .. math:: + + C_{retrans,spent,i} = min(C_{retrans,spent,i}, C_{avail,retrans,i}) + +The amount of N retranslocated from the leaf in this iteration (:math:`N_{retrans_paid,i}`, gN m\ :sup:`-2`) is calculated, checking that it does not fall below zero: + + .. math:: + + N_{retrans,paid,i} = min(N_{fallingleaf},C_{retrans,spent,i} / cost_{retrans}) + +The next step calculates the growth C which is accounted for by this amount of N extraction in this iteration (:math:`C_{retrans,accounted,i}`). This is calculated using the current plant C:N ratio, and also for the additional C which will need to be spent on growth respiration to build this amount of new tissue. + + .. math:: + + C_{retrans,accounted,i} = N_{retrans,paid,i} . CN_{plant} . (1.0 + gr_{frac}) + +Then the falling leaf N is updated: + + .. math:: + + N_{fallingleaf} = N_{fallingleaf} - N_{ret,i} + +and the :math:`CN_{fallingleaf}` and cost_{retrans} are updated. The amount of available carbon that is either unspent on N acquisition nor accounted for by N uptake is updated: + + .. math:: + + C_{avail,retrans,i+1} = C_{avail,retrans,i} - C_{retrans,spent,i} - C_{retrans,accounted,i} + + +Outputs of Retranslocation algorithm. +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The final output of the retranslocation calculation are the retranslocated N (:math:`N_{retrans}`, gN m\ :sup:`-2`), C spent on retranslocation (:math:`C_{retrans_paid}`, gC m\ :sup:`-2`), and C accounted for by retranslocation (:math:`C_{retrans_accounted}`, gC m\ :sup:`-2`). + +For paid-for uptake, we accumulate the total carbon spent on retranslocation (:math:`C_{spent_retrans}`), + + .. math:: + + C_{retrans,spent} = \sum{C_{retrans,i}} + +The total N acquired from retranslocation is + + .. math:: + + N_{retrans} = N_{retrans,paid}+N_{retrans,free} + +where N acquired by paid-for retranslocation is + + .. math:: + + N_{retrans,paid} = \sum{N_{retrans,paid,i}} + +The total carbon accounted for by retranslocation is the sum of the C accounted for by paid-for N uptake (:math:`N_{retrans_paid}`) and by free N uptake (:math:`N_{retrans_free}`). + + .. math:: + + C_{retrans,accounted} = \sum{C_{retrans,accounted,i}}+N_{retrans,free}.CN_{plant} . (1.0 + gr_{frac}) + + +The total available carbon in FUN to spend on fixation and active uptake (:math:`C_{tospend}`, gC m\ :sup:`-2`) is calculated as the carbon available minus that account for by retranslocation: + + .. math:: + + C_{tospend} = C_{avail} - C_{retrans,accounted} + + +Carbon expenditure on fixation and active uptake. +-------------------------------------------------------- + +At each model timestep, the overall cost of N uptake is calculated (see below) in terms of C:N ratios. The available carbon (:math:`C_{avail}`, g m\ :sup:`-2` s\ :sup:`-1`) is then allocated to two alternative outcomes, payment for N uptake, or conservation for growth. For each carbon conserved for growth, a corresponding quantity of N must be made available. In the case where the plant target C:N ratio is fixed, the partitioning between carbon for growth (:math:`C_{growth}`) and carbon for N uptake (:math:`C_{nuptake}`) is calculated by solving a system of simultaneous equations. First, the carbon available must equal the carbon spent on N uptake plus that saved for growth. + + .. math:: + + C_{growth}+C_{nuptake}=C_{avail} + +Second, the nitrogen acquired from expenditure of N (left hand side of term below) must equal the N that is required to match the growth carbon (right hand side of term below). + + .. math:: + + C_{nuptake}/N_{cost} =C_{growth}/CN_{target} + +The solution to these two equated terms can be used to estimate the ideal :math:`C_{nuptake}` as follows, + + .. math:: + C_{nuptake} =C_{tospend}/ ( (1.0+f_{gr}*(CN_{target} / N_{cost}) + 1) . + +and the other C and N fluxes can be determined following the logic above. + +Modifications to allow variation in C:N ratios +-------------------------------------------------------- +The original FUN model as developed by Fisher et al. (2008) and Brzostek et al. (2015) assumes a fixed plant tissue C:N ratio. This means that in the case where N is especially limiting, all excess carbon will be utilized in an attempt to take up more Nitrogen. It has been repeatedly observed, however, that in these circumstances in real life, plants have some flexibility in the C:N stoichiometry of their tissues, and therefore, this assumption may not be realistic. **lit review on CN ratios** + +Thus, in CLM5, we introduce the capacity for tissue C:N ratios to be prognostic, rather than static. Overall N and C availability (:math:`N_uptake` and :math:`C_{growth}`) and hence tissue C:N ratios, are both determined by FUN. Allocation to individual tissues is discussed in the allocation chapter + +Here we introduce an algorithm which adjusts the C expenditure on uptake to allow varying tissue C:N ratios. Increasing C spent on uptake will directly reduce the C:N ratio, and reducing C spent on uptake (retaining more for tissue growth) will increase it. C spent on uptake is impacted by both the N cost in the environment, and the existing tissue C:N ratio of the plant. The output of this algorithm is :math:`\gamma_{FUN}`, the fraction of the ideal :math:`C_{nuptake}` calculated from +the FUN equation above (**link equation**). + + .. math:: + C_{nuptake} = C_{nuptake}.\gamma_{FUN} + + +Response of C expenditure to Nitrogen uptake cost +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The environmental cost of Nitrogen (:math:`N_{cost,tot}`) is used to determine :math:`\gamma_{FUN}`. + + .. math:: + \gamma_{FUN} = max(0.0,1.0 - (N_{cost,tot}-a_{cnflex})/b_{cnflex}) + +where :math:`a_{cnflex}` and :math:`b_{cnflex}` are parameters fitted to give flexible C:N ranges over the operating range of N costs of the model. Calibration of these parameters should be subject to future testing in idealized experimental settings; they are here intended as a placeholder to allow some flexible stoichiometry, in the absence of adequate understanding of this process. Here :math:`a_{cnflex}` operates as the :math:`N_{cost,tot}` above which there is a modification in the C expenditure (to allow higher C:N ratios), and :math:`b_{cnflex}` is the scalar which determines how much the C expenditure is modified for a given discrepancy between :math:`a_{cnflex}` and the actual cost of uptake. + + +Response of C expenditure to plant C:N ratios +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +We first calculate a :math:`\delta_{CN}`, which is the difference between the target C:N (:math:`target_{CN}`) a model parameter, and the existing C:N ratio (:math:`CN_{plant}`) **This isn't strictly how it is worked out. Need to remember why we use c_allometry instead**. + + .. math:: + + CN_{plant} = \frac{C_{leaf} + C_{leaf,storage}}{N_{leaf} + N_{leaf,storage})} + +and + .. math:: + \delta_{CN} = CN_{plant} - target_{CN} + + +We then modify :math:`\gamma_{FUN}` to account for situations where (even if N is expensive) plant C:N ratios have increased too far from the target. For situations where :math:`\delta_{CN}` is positive and :math:`\gamma_{FUN}` is <1: + + .. math:: + \gamma_{FUN} = \gamma_{FUN}+(1-\gamma_{FUN}).min(1,\delta_{CN}/c_{flexcn}) + +For situations where :math:`\delta_{CN}` is negative, we reduce C spent on N uptake and retain more C for growth: + + .. math:: + \gamma_{FUN} = \gamma_{FUN}+ 0.5.(delta_CN/c_{flexcn}) + + +We then restrict the degree to which C expenditure can be reduced ( to prevent unrea;istically high C:N ratios) as + + .. math:: + \gamma_{FUN} = max(min(1.0,\gamma_{FUN}),0.5) + + + + + + + + + + From 609d3b9573635185d5d2f6539d3e4d40e74c4f82 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Tue, 29 Aug 2017 16:32:31 -0600 Subject: [PATCH 0093/1973] Phase 2 of FUN tech note --- .../tech_note/FUN/CLM50_Tech_Note_FUN.rst | 174 +++++++++++++++--- 1 file changed, 151 insertions(+), 23 deletions(-) diff --git a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst index 7c11f2bd7d..94c9027a23 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -1,20 +1,32 @@ .. _rst_FUN: -Fixation and uptake of nitrogen +Fixation and Uptake of Nitrogen (FUN) =============================== Introduction ----------------- -The Fixation and Uptake of Nitrogen model is based on work by Fisher (J.) et al., (2008), Brzostek et al. (2015) and Shi et al. (2016). The concept of FUN is that in most cases, Nitrogen uptake requires the expenditure of energy in the form of carbon, and further, that there are numerous potential sources of Nitrogen in the environment which a plant may exchange for carbon. The ratio of carbon expended to Nitrogen acquired is referred to here as the cost, or exchange rate, of N acquisition (:math:`E_{nacq}`, gC/gN)). There are four pathways for N uptake: +The Fixation and Uptake of Nitrogen model is based on work by Fisher (J.) et al., (2008), Brzostek et al. (2015) and Shi et al. (2016). The concept of FUN is that in most cases, Nitrogen uptake requires the expenditure of energy in the form of carbon, and further, that there are numerous potential sources of Nitrogen in the environment which a plant may exchange for carbon. The ratio of carbon expended to Nitrogen acquired is referred to here as the cost, or exchange rate, of N acquisition (:math:`E_{nacq}`, gC/gN)). There are eight pathways for N uptake: -1. Fixation by symbiotic bacteria in root nodules (for N fixing plants) (:math:`fix`) -2. Retranslocation of N from senescing tissues (:math:`ret`) -3. Active uptake of Nitrogen by plant roots as nitrate (:math:`NO`:sub:`3`) (:math:`act_{no3}`) -4. Active uptake of Nitrogen by plant roots as ammonia (:math:`NH`:sub:`4`) (:math:`act_{nh4}`) +1. Fixation by symbiotic bacteria in root nodules (for N fixing plants) (:math:`_{fix}`) +2. Retranslocation of N from senescing tissues (:math:`_{ret}`) +3. Active uptake of NH4 by arbuscular mycorrhizal plants (:math:`_{active,nh4}`) +4. Active uptake of NH4 by ectomycorrhizal plants (:math:`_{active,nh4}`) +5. Active uptake of NO3 by arbuscular mycorrhizal plants (:math:`_{active,no3}`) +6. Active uptake of NO3 by ectomycorrhizal plants (:math:`_{active,no3}`) +7. Nonmycorrhizal uptake of NH4 (:math:`_{nonmyc,no3}`) +8. Nonmycorrhizal uptake of NO3 (:math:`_{nonmyc,nh4}`) + + +The notation suffix for each pathway is given in parentheses here. At each timestep, each of these pathways is associated with a cost term (:math:`N_{cost,x}`), a payment in carbon (:math:`C_{nuptake,x}`), and an influx of Nitrogen (:math:`N_{uptake,x}`) where :math:`x` is one of the eight uptake streams listed above. + + +For each PFT, we define a fraction of the total C acquisition that can be used for N fixation (:math:`f_{fixers}`), which is broadly equivalent to the fraction of a given PFT that is capable of fixing Nitrogen, and thus represents an upper limit on the amount to which fixation can be increased in low n conditions. For each PFT, the cost calculation is conducted twice. Once where fixation is possible and once where it is not. (:math:`f_{fixers}`) + + +For all of the active uptake pathways, whose cost depends on varying concentrations of N through the soil profile, the costs and fluxes are also determined by soil layer :math:`j`. -The notation suffix for each pathway is given in parentheses here. At each timestep, each of these pathways is associated with a cost term (:math:`cost_x`), a payment in carbon (:math:`C_{nuptake,x}`), and an influx of Nitrogen (:math:`N_{uptake,x}`), any of which may be zero, and where :math:`x` is one of the four uptake streams listed above (:math:`fix`, :math:`ret`, :math:`act_{no3}` or :math:`act_{nh4}`). Boundary conditions of FUN @@ -35,32 +47,67 @@ Available Soil Nitrogen Cost of Nitrogen Fixation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The cost of fixation is derived from Houlton et al. (2008). + .. math:: + + N_{cost,fix} = -s_{fix}/(1.25 e^{a_{fix} + b_{fix} . t_{soil} (1 - 0.5 t_{soil}/ c_{fix}) }) + +Herein, :math:`a_{fix}`, :math:`b_{fix}` and :math:`c_{fix}` are all parameters of the temperature response function of fixation reported by Houlton et al. (2008) (:math:`exp[a+bT_s(1-0.5T_s/c)`). t_{soil} is the soil temperature in C. The values of these parameters are fitted to empirical data as a=-3.62 :math:`\pm` 0.52, b=0.27:math:`\pm` 0.04 and c=25.15 :math:`\pm` 0.66. 1.25 converts from the temperature response function to a 0-1 limitation factor (as specifically employed by Houlton et al.). This function is a 'rate' of uptake for a given temperature. Here we assimilated the rate of fixation into the cost term by assuming that the rate is analagous to a conductance for N, and inverting the term to produce a cost/resistance analagoue. We then multiply this temperature term by the minimum cost at optimal temperature (:math:`s_{fix}`) to give a temperature limited cost in terms of C to N ratios. + + Cost of Active Uptake ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The cost of N uptake from soil, for each layer :math:`j`, is controlled by two uptake parameters that pertain respectively to the relationship between soil N content and N uptake, and root C density and N uptake. + +For non-mycorrhizal uptake: + + .. math:: + + N_{cost,nonmyc,j} = \frac{k_{n,nonmyc}}{N_{smin,j}} + \frac{k_{c,nonmyc}}{c_{root,j}} + +and for active uptake: + + .. math:: + + N_{cost,active,j} = \frac{k_{n,active}}{N_{smin,j}} + \frac{k_{c,active}}{c_{root,j}} + +where :math:`k_{n,active}` varies according to whether we are considering ecto or arbuscular mycorrhizal uptake. + .. math:: + :label: 18.2 + + k_{n,active} = + \left\{\begin{array}{lr} + k_{n,Eactive}& e = 1\\ + k_{n,Aactive}& e = 0 + \end{array}\right\} + +where m=1 pertains to the fraction of the PFT that is ecotmycorrhizal, as opposed to arbuscular mycorrhizal. + Resolving N cost across simultaneous uptake streams -------------------------------------------------------- The total cost of N uptake is calculated based on the assumption that carbon is partitioned to each stream in proportion to the inverse of the cost of uptake. So, more expensive pathways receive less carbon. Earlier versions of FUN (Fisher et al. 2008) utilized a scheme whereby plants only took up N from the cheapest pathway. Brzostek et al. introduced a scheme for the simultaneous uptake from different pathways. Here we calcualate a 'conductance' to N uptake (analagous to the inverse of the cost function conceptualized as a resistance term) :math:`N_{conductance}` ( gN/gC) as: .. math:: - N_{conductance}= \sum{(1/cost_{x})} + N_{conductance,f}= \sum{(1/N_{cost,x})} + From this, we then calculate the fraction of the carbon allocated to each pathway as .. math:: - C_{frac,x} = \frac{1/cost_{x}}{N_{conductance}} + C_{frac,x} = \frac{1/N_{cost,x}}{N_{conductance}} These fractions are used later, to calculate the carbon expended on different uptake pathways. Next, the N acquired from each uptake stream per unit C spent (:math:`N_{exch,x}`, gN/gC) is determined as .. math:: - N_{exch,x} = \frac{C_{frac,x}}{cost_{x}} + N_{exch,x} = \frac{C_{frac,x}}{N_{cost,x}} We then determine the total amount of N uptake per unit C spent (:math:`N_{exch,tot}`, gN/gC) as the sum of all the uptake streams. @@ -72,7 +119,7 @@ and thus the subsequent overall N cost is .. math:: N_{cost,tot} = 1/{N_{exch,tot}} -Throughout these calculations, :math:`x` is the sum of the fixation and active uptake pathways. Retranslocation is determined via a different set of mechanisms, once the :math:`N_{cost,tot}` is known. + Retranslocation is determined via a different set of mechanisms, once the :math:`N_{cost,tot}` is known. Nitrogen Retranslocation -------------------------------------------------------- @@ -88,7 +135,7 @@ The carbon available at the beginning of the iterative retranslocation calculati .. math:: - C_{avail_retrans,0} = C_{avail} + C_{avail,retrans,0} = C_{avail} Free Retranslocation @@ -261,28 +308,109 @@ and \delta_{CN} = CN_{plant} - target_{CN} -We then modify :math:`\gamma_{FUN}` to account for situations where (even if N is expensive) plant C:N ratios have increased too far from the target. For situations where :math:`\delta_{CN}` is positive and :math:`\gamma_{FUN}` is <1: - - .. math:: - \gamma_{FUN} = \gamma_{FUN}+(1-\gamma_{FUN}).min(1,\delta_{CN}/c_{flexcn}) +We then increase :math:`\gamma_{FUN}` to account for situations where (even if N is expensive) plant C:N ratios have increased too far from the target. Where :math:`\delta_{CN}` is negative, we reduce C spent on N uptake and retain more C for growth + + .. math:: + :label: 7.23 -For situations where :math:`\delta_{CN}` is negative, we reduce C spent on N uptake and retain more C for growth: + \gamma_{FUN} = + \left\{\begin{array}{lr} + \gamma_{FUN}+ 0.5.(delta_{CN}/c_{flexcn})& delta_{CN} > 0\\ + \gamma_{FUN}+(1-\gamma_{FUN}).min(1,\delta_{CN}/c_{flexcn}) & delta_{CN} < 0 + \end{array}\right\} - .. math:: - \gamma_{FUN} = \gamma_{FUN}+ 0.5.(delta_CN/c_{flexcn}) - - -We then restrict the degree to which C expenditure can be reduced ( to prevent unrea;istically high C:N ratios) as +We then restrict the degree to which C expenditure can be reduced (to prevent unrealistically high C:N ratios) as .. math:: \gamma_{FUN} = max(min(1.0,\gamma_{FUN}),0.5) + + +Calculation of N uptake streams from active uptake and fixation +-------------------------------------------------------- + +Once the final :math:`C_{nuptake}` is known, the fluxes of C to the individual pools can be derived as + + .. math:: + C_{nuptake,x} = C_{frac,x}.C_{nuptake} + - + .. math:: + + N_{uptake,x} = \frac{C_{nuptake}}{N_{cost}} + + +Following this, we determine whether the extraction estimates exceed the pool size for each source of N. Where :math:`N_{active,no3} + N_{nonmyc,no3} > N_{avail,no3}`, we calculate the unmet uptake, :math:`N_{unmet,no3}` + + .. math:: + + N_{unmet,no3} = N_{active,no3} + N_{nonmyc,no3} - N_{avail,no3} + +then modify both fluxes to account + + .. math:: + + N_{active,no3} = N_{active,no3} + N_{unmet,no3}.\frac{N_{active,no3}}{N_{active,no3}+N_{nonmyc,no3}} + + .. math:: + + N_{nonmyc,no3} = N_{nonmyc,no3} + N_{unmet,no3}.\frac{N_{nonmyc,no3}}{N_{active,no3}+N_{nonmyc,no3}} + +and similarly, for NH4, where :math:`N_{active,nh4} + N_{nonmyc,nh4} > N_{avail,nh4}`, we calculate the unmet uptake, :math:`N_{unmet,no3}` + + .. math:: + + N_{unmet,nh4} = N_{active,nh4} + N_{nonmyc,nh4} - N_{avail,nh4} + +then modify both fluxes to account + + .. math:: + + N_{active,nh4} = N_{active,nh4} + N_{unmet,nh4}.\frac{N_{active,nh4}}{N_{active,nh4}+N_{nonmyc,nh4}} + .. math:: + + N_{nonmyc,nh4} = N_{nonmyc,nh4} + N_{unmet,nh4}.\frac{N_{nonmyc,nh4}}{N_{active,nh4}+N_{nonmyc,nh4}} + + +and then update the C spent to account for hte new lower N acquisition in that layer/pool. + + .. math:: + + C_{active,nh4} = N_{active,nh4}.N_{cost,active,nh4}\\ + C_{active,no3} = N_{active,no3}.N_{cost,active,no3}\\ + C_{nonmyc,no3} = N_{nonmyc,no3}.N_{cost,nonmyc,no3}\\ + C_{nonmyc,no3} = N_{nonmyc,no3}.N_{cost,nonmyc,no3}\\ + + +Following this, we determine how much carbon is accounted for for each soil layer. + + .. math:: + + C_{accounted,x,j} = C_{spent,j,x} - (N_{acquired,j,x}.CN_{plant}.(1.0+ gr_{frac})) + + + +Types of N uptake streams +-------------------------------------------------------- +Arbuscular mycorrhizal fungi: +Ectomycorrhizal fungi: +Nonmycorrhizal plants. + + +ECK_active (step 1) sets active components for Ectomycorrhizal fungi +ACK_active (step 2) sets active components for Arbuscular fungi +kc_nonmyc (step 1) sets nonmyc components for Ectomycorrhizal fungi +kc_nonmyc (step 2) sets active components for Arbuscular fungi +ACTIVE vs NONMYC +ECTO vs ARBU for ACTIVE. + +References +-------------------------------------------------------- +Houlton, B.Z., Wang, Y.P., Vitousek, P.M. and Field, C.B., 2008. A unifying framework for dinitrogen fixation in the terrestrial biosphere. Nature, 454(7202), p.327. From 8ace44030f052ed0a757b0584da9bce94326ad51 Mon Sep 17 00:00:00 2001 From: Charlie Koven Date: Thu, 31 Aug 2017 17:07:44 -0700 Subject: [PATCH 0094/1973] a few changes: replaced some graphics, moved some text from allocation to CN pools, updated text in a few places --- .../CLM50_Tech_Note_CN_Allocation.rst | 38 ------------ .../CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 47 +++++++++++++++ .../CLM50_Tech_Note_Decomposition.rst | 59 ++++++++++++++----- .../References/CLM50_Tech_Note_References.rst | 7 +++ 4 files changed, 97 insertions(+), 54 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index a63ec9ae3d..71eca6193a 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -6,44 +6,6 @@ Carbon and Nitrogen Allocation Introduction ----------------- -CLM includes a fully-prognostic treatment of the terrestrial carbon and -nitrogen cycles including interactions between these cycles as mediated -by biological mechanisms of plants and soil heterotrophs. The model is -fully prognostic with respect to all carbon and nitrogen state variables -in the vegetation, litter, and soil organic matter. The seasonal timing -of new vegetation growth and litterfall is also prognostic, responding -to soil and air temperature, soil water availability, and daylength, in -varying degrees depending on a specified phenology type for each PFT -(see Chapter 14). The prognostic LAI, SAI, and vegetation heights are -utilized by the biophysical model. - -Separate state variables for C and N are tracked for leaf, live stem, -dead stem, live coarse root, dead coarse root, and fine root pools -(Figure 13.1 and 13.2). Each of these pools has two corresponding -storage pools representing, respectively, short-term and long-term -storage of non-structural carbohydrates and labile nitrogen. There are -two additional carbon pools, one for the storage of growth respiration -reserves, and another used to meet excess demand for maintenance -respiration during periods with low photosynthesis. One additional -nitrogen pool tracks retranslocated nitrogen, mobilized from leaf tissue -prior to abscission and litterfall. Altogether there are 20 state -variables for vegetation carbon, and 19 for vegetation nitrogen. - -.. _Figure Vegetation fluxes and pools: - -.. figure:: image1.png - :width: 800px - :height: 800px - - Vegetation fluxes and pools. - -.. _Figure Carbon and nitrogen pools: - -.. figure:: image2.png - :width: 400px - :height: 400px - - Carbon and nitrogen pools. Carbon Allocation for Maintenance Respiration Costs -------------------------------------------------------- diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst index 92903f02e0..a98069deaf 100644 --- a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -2,3 +2,50 @@ CN Pools =================== + +Introduction +----------------- + +CLM includes a prognostic treatment of the terrestrial carbon and +nitrogen cycles including natural vegetation, crops, and soil biogeochemistry. The model is +fully prognostic with respect to all carbon and nitrogen state variables +in the vegetation, litter, and soil organic matter. The seasonal timing +of new vegetation growth and litterfall is also prognostic, responding +to soil and air temperature, soil water availability, daylength, and +crop management practices in +varying degrees depending on a specified phenology type or management for each PFT +(Chapter +:numref:`rst_Vegetation Phenology and Turnover`). The +prognostic LAI, SAI, +tissue stoichiometry, and vegetation heights are +utilized by the biophysical model that couples carbon, water, and +energy cycles. + +Separate state variables for C and N are tracked for leaf, live stem, +dead stem, live coarse root, dead coarse root, fine root, and grain pools +(:numref:`Figure Vegetation fluxes and pools`). Each of these pools has two corresponding +storage pools representing, respectively, short-term and long-term +storage of non-structural carbohydrates and labile nitrogen. There are +two additional carbon pools, one for the storage of growth respiration +reserves, and another used to meet excess demand for maintenance +respiration during periods with low photosynthesis. One additional +nitrogen pool tracks retranslocated nitrogen, mobilized from leaf tissue +prior to abscission and litterfall. Altogether there are 23 state +variables for vegetation carbon, and 22 for vegetation nitrogen. + +.. _Figure Vegetation fluxes and pools: + +.. figure:: CLMCN_pool_structure_v2_lores.png + :width: 753px + :height: 513px + + Vegetation fluxes and pools for carbon cycle in CLM5. + +In addition to the vegetation pools, CLM includes a series of +decomposing carbon and nitrogen pools as vegetation successively +breaks down to CWD, and/or litter, and subsequently to soil organic +matter. Discussion of the decomposition model, alternate +specifications of decomposition rates, and methods to rapidly +equilibrate the decomposition model, is in Chapter +:numref:`rst_Decomposition`. + diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index d35feab5be..87f7f170bd 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -15,11 +15,12 @@ structure used in CLM4.0, or a second pool structure, characterized by slower decomposition rates, based on the Century model (Parton et al. 1988). In addition, the user can choose, at compile time, whether to allow :math:`{n}_{lev}` to equal 1, as in CLM4.0, or to equal the -number of soil levels used for the soil hydrology (default 10). +number of soil levels used for the soil hydrological and thermal +calculations (see Section :numref:`Soil Layers` for soil layering). .. _Figure Schematic of decomposition model in CLM: -.. figure:: image1.png +.. figure:: CLM4_vertsoil_soilstruct_drawing.png Schematic of decomposition model in CLM. @@ -60,11 +61,11 @@ pools. Further discussion of the vertical distribution of carbon inputs :math:`{R}_{i}`\ (z), vertical turnover times :math:`{k}_{j}`\ (z), and vertical transport *D(z)* is below. Discussion of the vertical model and analysis of both decomposition -structures is in Koven et al (2013). +structures is in :ref:`Koven et al. (2013) `. .. _Figure Pool structure: -.. figure:: image2.png +.. figure:: soil_C_pools_CN_century.png Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 @@ -271,7 +272,9 @@ unitless) is calculated using a relationship from Andrén and Paustian where :math:`{\Psi}_{j}` is the soil water potential in layer *j*, :math:`{\Psi}_{min}` is a lower limit for soil -water potential control on decomposition rate (set to -10 MPa). +water potential control on decomposition rate (in CLM5, this was +changed from a default value of -10 MPa in CLM4.5 and earlier to a +default value of -2.5 MPa). :math:`{\Psi}_{sat,j}` (MPa) is the saturated soil water potential, calculated using the multivariate regression model from Cosby et al. (1984): @@ -294,7 +297,7 @@ of Niu and Yang (2006), \psi \left(T\right)=-\frac{L_{f} \left(T-T_{f} \right)}{10^{3} T} An additional frozen decomposition limitation can be specified using a -‘frozen Q\ :sub:`10` following Koven et al. (2011), however the +‘frozen Q\ :sub:`10`' following :ref:`Koven et al. (2011) `, however the default value of this is the same as the unfrozen Q\ :sub:`10` value, and therefore the basic hypothesis is that frozen respiration is limited by liquid water availability, and can be modeled following the @@ -322,7 +325,7 @@ of decomposition was shown by Jenkinson and Coleman (2008) to be an important term in fitting total C and 14C profiles, and implies that unresolved processes, such as priming effects, microscale anoxia, soil mineral surface and/or aggregate stabilization may be important in -controlling the fate of carbon at depth (Koven et al. 2013). CLM +controlling the fate of carbon at depth :ref:`Koven et al. (2013) `. CLM includes these unresolved depth controls via an exponential decrease in the soil turnover time with depth: @@ -331,7 +334,10 @@ the soil turnover time with depth: r_{depth} =\exp \left(-\frac{z}{z_{\tau } } \right) -where :math:`{z}_{\tau}` is the e-folding depth for decomposition, set by default to 0.5m. +where :math:`{z}_{\tau}` is the e-folding depth for decomposition. For +CLM4.5, the default value of this was 0.5m. For CLM5, this has been +changed to a default value of 10m, which effectively means that +intrinsic decomposition rates may proceed as quickly at depth as at the surface. The combined decomposition rate scalar (:math:`{r}_{total}`,unitless) is: @@ -746,15 +752,22 @@ value of the advection term is 0 cm/yr, such that transport is purely diffusive. Diffusive transport differs in rate between permafrost soils (where cryoturbation is the dominant transport term) and non-permafrost soils (where bioturbation dominates). For permafrost soils, a -parameterization based on that of Koven et al. (2009) is used: the +parameterization based on that of :ref:`Koven et al. (2009) ` is used: the diffusivity parameter is constant through the active layer, and decreases linearly from the base of the active layer to zero at a set depth (default 3m); the default permafrost diffusivity is 5 cm\ :sup:`2`/yr. For non-permafrost soils, the default diffusivity is 1 cm\ :sup:`2`/yr. -Model Equilibration ------------------------- +Model Equilibration and its Acceleration +--------------------------------------- +For transient experiments, it is usually assumed that the carbon cycle +is starting from a point of relatively close equilibrium, i.e. that +productivity is balanced by ecosystem carbon losses through +respiratory and disturbance pathways. In order to satisfy this +assumption, the model is generally run until the productivity and loss +terms find a stable long-term equilibrium; at this point the model is +considered 'spun up'. Because of the coupling between the slowest SOM pools and productivity through N downregulation of photosynthesis, equilibration of the model @@ -762,14 +775,13 @@ for initialization purposes will take an extremely long time in the standard mode. This is particularly true for the CENTURY-based decomposition cascade, which includes a passive pool. In order to rapidly equilibrate the model, a modified version of the “accelerated -decomposition” (Thornton and Rosenbloom, 2005) is used. The fundamental +decomposition” :ref:`(Thornton and Rosenbloon, 2005) ` is used. The fundamental idea of this approach is to allow fluxes between the various pools (both turnover-defined and vertically-defined fluxes) adjust rapidly, while keeping the pool sizes themselves small so that they can fill quickly. To do this, the base decomposition rate :math:`{k}_{i}` for each pool *i* is accelerated by a term :math:`{a}_{i}` such that the slow -pools are collapsed onto an approximately annual timescale (Koven et al. -2013). Accelerating the pools beyond this timescale distorts the +pools are collapsed onto an approximately annual timescale :ref:`Koven et al. (2013) `. Accelerating the pools beyond this timescale distorts the seasonal and/or diurnal cycles of decomposition and N mineralization, thus leading to a substantially different ecosystem productivity than the full model. For the vertical model, the vertical transport terms are @@ -787,6 +799,21 @@ accelerated decomposition mode are handled automatically by CLM upon loading from restart files (which preserve information about the mode of the model when restart files were written). -The acceleration terms for the two decomposition cascades are shown in -Tables 15.1 and 15.3. +The base acceleration terms for the two decomposition cascades are shown in +Tables 15.1 and 15.3. In addition to the base terms, CLM5 also +includes a geographic term to the acceleration in order to apply +larger values to high-latitude systems, where decomposition rates are +particularly slow and thus equilibration can take significantly longer +than in temperate or tropical climates. This geographic term takes +the form of a logistic equation, where :math:`{a}_{i}` is equal to the +product of the base acceleration term and :math:`{a}_{l}` below: + +.. math:: + :label: 21.62) + + a_l = 1 + 50 / \left ( 1 + exp \left (-0.1 * (abs(latitude) - + 60 ) \right ) \right ) + + + diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index a419e14e80..d7a5887778 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -896,6 +896,13 @@ Koven, C.D. et al. 2013. The effect of vertically-resolved soil biogeochemistry and alternate soil C and N models on C dynamics of CLM4. Biogeosciences Discussions 10:7201-7256. +.. _Kovenetal2015: + +Koven, C.D. et al. 2015. Permafrost carbon-climate feedback is +sensitive to deep soil carbon decomposability but not deep soil +nitrogen dynamics. Proceedings of the National Academies of Science, +112, 12, 3752-3757, doi:10.1073/pnas.1415123112 + .. _Kuchariketal2000: Kucharik, C.J., Foley, J.A., Delire, C., Fisher, V.A., Coe, M.T., From bda8c43308dedf6e4a947ffce438a0332d713022 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 1 Sep 2017 09:03:35 -0600 Subject: [PATCH 0095/1973] Update html and fix build errors --- doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst | 9 ++++----- .../CLM50_Tech_Note_Transient_Landcover.rst | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst index 94c9027a23..32d42b564c 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -1,7 +1,7 @@ .. _rst_FUN: Fixation and Uptake of Nitrogen (FUN) -=============================== +======================================= Introduction ----------------- @@ -286,7 +286,7 @@ the FUN equation above (**link equation**). Response of C expenditure to Nitrogen uptake cost -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The environmental cost of Nitrogen (:math:`N_{cost,tot}`) is used to determine :math:`\gamma_{FUN}`. .. math:: @@ -296,7 +296,7 @@ where :math:`a_{cnflex}` and :math:`b_{cnflex}` are parameters fitted to give fl Response of C expenditure to plant C:N ratios -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We first calculate a :math:`\delta_{CN}`, which is the difference between the target C:N (:math:`target_{CN}`) a model parameter, and the existing C:N ratio (:math:`CN_{plant}`) **This isn't strictly how it is worked out. Need to remember why we use c_allometry instead**. .. math:: @@ -311,7 +311,6 @@ and We then increase :math:`\gamma_{FUN}` to account for situations where (even if N is expensive) plant C:N ratios have increased too far from the target. Where :math:`\delta_{CN}` is negative, we reduce C spent on N uptake and retain more C for growth .. math:: - :label: 7.23 \gamma_{FUN} = \left\{\begin{array}{lr} @@ -326,7 +325,7 @@ We then restrict the degree to which C expenditure can be reduced (to prevent un Calculation of N uptake streams from active uptake and fixation --------------------------------------------------------- +---------------------------------------------------------------- Once the final :math:`C_{nuptake}` is known, the fluxes of C to the individual pools can be derived as diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index 16aaa120a8..e8edb60222 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -270,8 +270,8 @@ data files in the mksurfdata_map tool. Schematic of translation of annual LUH2 land units to CLM5 plant and crop functional types. - .. _Figure Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool +.. _Figure Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool: -.. figure :: image3.png +.. figure:: image3.png Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool From f75874ee3c22850be25c38f21406980a7e9cc499 Mon Sep 17 00:00:00 2001 From: Charlie Koven Date: Fri, 1 Sep 2017 11:10:41 -0700 Subject: [PATCH 0096/1973] more changes, mainly on allocation text --- .../CLM50_Tech_Note_CN_Allocation.rst | 173 ++++-------------- .../CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 14 ++ .../CLM50_Tech_Note_Decomposition.rst | 20 +- 3 files changed, 59 insertions(+), 148 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 71eca6193a..728ae142c1 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -7,18 +7,14 @@ Introduction ----------------- -Carbon Allocation for Maintenance Respiration Costs --------------------------------------------------------- - The carbon and nitrogen allocation routines in CLM determine the fate of newly assimilated carbon, coming from the calculation of photosynthesis, and available mineral nitrogen, coming from plant uptake of mineral -nitrogen in the soil or being drawn out of plant reserves. Allocation -fluxes are determined in three steps: first :math:`CF_{GPPpot}` is -used to evaluate the potential allocation of carbon and nitrogen -assuming an unlimited nitrogen supply, then the actual nitrogen supply -is compared against the demand, and finally allocation of carbon and -nitrogen are reduced, if necessary, to match nitrogen supply and demand. +nitrogen in the soil or being drawn out of plant reserves. A significant change to CLM5 relative to prior versions is that allocation of carbon and nitrogen proceed independently rather than in a sequential manner. + + +Carbon Allocation for Maintenance Respiration Costs +-------------------------------------------------------- Allocation of available carbon on each time step is prioritized, with first priority given to the demand for carbon to support maintenance @@ -49,15 +45,15 @@ s\ :sup:`-1`): .. math:: :label: 19.2 - CF_{GPP,mr} =\_ \left\{\begin{array}{l} {CF_{mr} \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. + CF_{GPP,mr} =\_ \left\{\begin{array}{l} {CF_{mr} \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPP} } \\ {CF_{GPP} \qquad {\rm for\; }CF_{mr} >CF_{GPP} } \end{array}\right. .. math:: :label: 19.3 - CF_{xs,mr} =\_ \left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{mr} -CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. + CF_{xs,mr} =\_ \left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPP} } \\ {CF_{mr} -CF_{GPP} \qquad {\rm for\; }CF_{mr} >CF_{GPP} } \end{array}\right. The storage pool that supplies carbon for maintenance respiration in -excess of current :math:`CF_{GPPpot}` ( :math:`CS_{xs}`, gC +excess of current :math:`CF_{GPP}` ( :math:`CS_{xs}`, gC m\ :sup:`-2`) is permitted to run a deficit (negative state), and the magnitude of this deficit determines an allocation demand which gradually replenishes :math:`CS_{xs}`. The logic for allowing a @@ -83,16 +79,14 @@ m\ :sup:`-2` s\ :sup:`-1`) is given as .. math:: :label: 19.5 - CF_{GPP,xs} =\left\{\begin{array}{l} {CF_{GPP,xs,pot} \qquad \qquad \qquad {\rm for\; }CF_{GPP,xs,pot} \le CF_{GPPpot} -CF_{GPP,mr} } \\ {\max (CF_{GPPpot} -CF_{GPP,mr} ,0)\qquad {\rm for\; }CF_{GPP,xs,pot} >CF_{GPPpot} -CF_{GPP,mr} } \end{array}\right. + CF_{GPP,xs} =\left\{\begin{array}{l} {CF_{GPP,xs,pot} \qquad \qquad \qquad {\rm for\; }CF_{GPP,xs,pot} \le CF_{GPP} -CF_{GPP,mr} } \\ {\max (CF_{GPP} -CF_{GPP,mr} ,0)\qquad {\rm for\; }CF_{GPP,xs,pot} >CF_{GPP} -CF_{GPP,mr} } \end{array}\right. where :math:`\tau_{xs}` is the time constant (currently set to 30 days) controlling the rate of replenishment of :math:`CS_{xs}`. Note that these two top-priority carbon allocation fluxes (:math:`CF_{GPP,mr}` and :math:`CF_{GPP,xs}`) are not -stoichiometrically associated with any nitrogen fluxes, and so this -initial allocation step can proceed without reference to (or limitation -from) the available mineral nitrogen supply. +stoichiometrically associated with any nitrogen fluxes. Carbon and Nitrogen Stoichiometry of New Growth ---------------------------------------------------- @@ -104,7 +98,7 @@ growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 19.6 - CF_{avail\_ alloc} =CF_{GPPpot} -CF_{GPP,mr} -CF_{GPP,xs} . + CF_{avail\_ alloc} =CF_{GPP} -CF_{GPP,mr} -CF_{GPP,xs} . Potential allocation to new growth is calculated for all of the plant carbon and nitrogen state variables based on specified C:N ratios for @@ -140,10 +134,10 @@ favorable growth environments (Allen et al., 2005; Vanninen and Makela, .. _Table Allocation and CN ratio parameters: -.. table:: Allocation and carbon\:nitrogen ratio parameters +.. table:: Allocation and target carbon\:nitrogen ratio parameters +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`CN_{leaf}` | :math:`CN_{fr}` | :math:`CN_{lw}` | :math:`CN_{dw}` | + | Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`Target CN_{leaf}` | :math:`Target CN_{fr}` | :math:`Target CN_{lw}` | :math:`Target CN_{dw}` | +==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ | NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ @@ -240,111 +234,9 @@ gN m\ :sup:`-2` s\ :sup:`-1`) as: NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . -Deployment of retranslocated nitrogen ------------------------------------------- - -In many plants, some portion of the nitrogen used to construct new -tissues is mobilized from senescing tissues, especially leaves, and -retained within the plant when the tissues are lost as litter. This -store of retranslocated nitrogen is used to supply part of the nitrogen -demand for subsequent growth (Magill et al., 1997; Oikawa et al., 2005; -Son and Gower, 1991). CLM includes one pool of retranslocated nitrogen -(:math:`NS_{retrans}`, gN m\ :sup:`-2`), and the -availability of nitrogen from this pool to support new growth -(:math:`NF_{avail\_retrans}`, gN m\ :sup:`-2` -s\ :sup:`-1`) is proportional to the plant nitrogen demand, as: - -.. math:: - :label: 19.14 - - NF_{avail\_ retrans} =\min \left(\frac{NF_{retrans\_ ann} \frac{NF_{plant\_ demand} }{NF_{plant\_ demand\_ ann} } }{\Delta t} ,\; \frac{NS_{retrans} }{\Delta t} \right) - -where :math:`NF_{retrans\_ann}` (gN m\ :sup:`-2` y\ :sup:`-1`) is the previous year’s annual sum of retranslocated -nitrogen extracted from senescing tissues, -:math:`NF_{plant\_demand\_ann}` (gN m\ :sup:`-2` y\ :sup:`-1`) is the previous year’s annual sum of -:math:`NF_{plant\_demand}`, and :math:`\Delta`\ *t* (s) is the -model’s biogeochemistry time step. This formulation produces an annual -cycle in the extraction of nitrogen from :math:`NS_{retrans}` -which corresponds to the annual cycle of plant nitrogen demand, and -which is scaled to give :math:`NS_{retrans}` approximately a -one-year turnover time. The minimum function prevents extraction of more -than the remaining pool of retranslocated nitrogen, which can be an -important constraint under conditions where high rates of mortality are -modifying the size of the pool. During the first year of an initial -simulation, before :math:`NF_{plant\_demand\_ann}` and -:math:`NF_{retrans\_ann}` have valid values, -:math:`NF_{avail\_retrans}` is set to 0.0. - -The actual flux of nitrogen from the retranslocated N pool into -allocation of new growth (:math:`NF_{retrans,alloc}`, gN -m\ :sup:`-2` s\ :sup:`-1`) is never greater than the plant -demand for new nitrogen: - -.. math:: - :label: 19.15 - - NF_{retrans,alloc} =\min \left(NF_{plant\_ demand} ,NF_{avail\_ retrans} \right) - -Plant nitrogen uptake from soil mineral nitrogen pool ----------------------------------------------------------- - -The total plant nitrogen demand is reduced by the nitrogen flux from -:math:`NS_{retrans}` to give the plant demand for mineral nitrogen -from the soil (:math:`NF_{plant\_demand\_soil}`, gN -m\ :sup:`-2` s\ :sup:`-1`): - -.. math:: - :label: 19.16 - - NF_{plant\_ demand\_ soil} =NF_{plant\_ demand} -NF_{retrans,alloc} . - -The combined demand from all PFTs sharing space on a soil column and the -demand from the heterotrophic community in the soil (nitrogen -immobilization demand) compete for the available soil mineral nitrogen -pool. The result of this competition is passed back to the allocation -algorithm as :math:`f_{plant\_demand}`, the fraction (from 0 to 1) -of the plant nitrogen demand which can be met given the current soil -mineral nitrogen supply and competition with heterotrophs. Plant uptake -from the soil mineral nitrogen pool is then given as: - -.. math:: - :label: 19.17 - - NF_{sminn,alloc} =NF_{plant\_ demand\_ soil} f_{plant\_ demand} - -Final carbon and nitrogen allocation +Carbon Allocation to New Growth ----------------------------------------- -The total flux of allocated nitrogen is given as: - -.. math:: - :label: 19.18 - - NF_{alloc} =NF_{retrans,alloc} +NF_{sminn,alloc} - -From the stoichiometric relationship in Eq. , the associated carbon -allocation flux is: - -.. math:: - :label: 19.19 - - CF_{alloc} =NF_{alloc} \frac{C_{allom} }{N_{allom} } . - -The downregulation of photosynthesis can then be calculated as: - -.. math:: - :label: 19.20 - - f_{dreg} =\frac{CF_{alloc} -CF_{avail\_ alloc} }{CF_{GPPpot} } . - -Total allocation to new leaf carbon -(:math:`CF_{alloc,leaf\_tot}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as: - -.. math:: - :label: 19.21 - - CF_{alloc,leaf\_ tot} =\frac{CF_{alloc} }{C_{allom} } . - There are two carbon pools associated with each plant tissue – one which represents the currently displayed tissue, and another which represents carbon stored for display in a subsequent growth period. The nitrogen @@ -416,67 +308,78 @@ tissue types are given as: CF_{alloc,deadcroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). -The corresponding nitrogen allocation fluxes are given as: + +Nitrogen allocation +----------------------------------------- + +The total flux of nitrogen to be allocated is given by the FUN model (Chapter :numref:`rst_FUN`). This gives a total N to be allocated within a given timestep, :math:`N_{supply}`. The total N allocated for a given organ :math:`o` is the minimum between the supply and the demand: + +.. math:: + + NF_{alloc,o} = min \left( NF_{demand, o}, NF_{supply, o} \right) + +The demand for each tissue, calculated for the tissue to remain on stoichiometry during growth, is: + .. math:: :label: 19.34 - NF_{alloc,leaf} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } f_{cur} + NF_{demand,leaf} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } f_{cur} .. math:: :label: 19.35 - NF_{alloc,leaf\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } \left(1-f_{cur} \right) + NF_{demand,leaf\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } \left(1-f_{cur} \right) .. math:: :label: 19.36 - NF_{alloc,froot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } f_{cur} + NF_{demand,froot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } f_{cur} .. math:: :label: 19.37 - NF_{alloc,froot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } \left(1-f_{cur} \right) + NF_{demand,froot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } \left(1-f_{cur} \right) .. math:: :label: 19.38 - NF_{alloc,livestem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } f_{cur} + NF_{demand,livestem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } f_{cur} .. math:: :label: 19.39 - NF_{alloc,livestem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) + NF_{demand,livestem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) .. math:: :label: 19.40 - NF_{alloc,deadstem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} + NF_{demand,deadstem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} .. math:: :label: 19.41 - NF_{alloc,deadstem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right) + NF_{demand,deadstem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right) .. math:: :label: 19.42 - NF_{alloc,livecroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } f_{cur} + NF_{demand,livecroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } f_{cur} .. math:: :label: 19.43 - NF_{alloc,livecroot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) + NF_{demand,livecroot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) .. math:: :label: 19.44 - NF_{alloc,deadcroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} + NF_{demand,deadcroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} .. math:: :label: 19.45 - NF_{alloc,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). + NF_{demand,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). Autotrophic Respiration ---------------------------- diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst index a98069deaf..9304f87634 100644 --- a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -49,3 +49,17 @@ specifications of decomposition rates, and methods to rapidly equilibrate the decomposition model, is in Chapter :numref:`rst_Decomposition`. +Tissue Stoichiometry +----------------------- + +As of CLM5, vegetation tissues have a flexible stoichiometry, as +described in :ref:`Ghimire et al. (2015) `. Each +tissue has a target C\:N ratio, and nitrogen is allocated at each +timestep in order to allow the plant to best match the target +stoichiometry. Nitrogen downregulation of productivity acts by +increasing the C\:N ratio of leaves when insufficient nitrogen is +available to meet stoichiometric demands of leaf growth, thereby +reducing the N available for photosynthesis and reducing the :math:`V_{\text{c,max25}}` and +:math:`J_{\text{max25}}` terms, as described in Chapter +:numref:`rst_Photosynthetic Capacity`. Details of the flexible tissue +stoichiometry are described in Chapter :numref:`rst_CN Allocation`. diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index 87f7f170bd..6863012fda 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -273,19 +273,13 @@ unitless) is calculated using a relationship from Andrén and Paustian where :math:`{\Psi}_{j}` is the soil water potential in layer *j*, :math:`{\Psi}_{min}` is a lower limit for soil water potential control on decomposition rate (in CLM5, this was -changed from a default value of -10 MPa in CLM4.5 and earlier to a -default value of -2.5 MPa). -:math:`{\Psi}_{sat,j}` (MPa) is the saturated soil water -potential, calculated using the multivariate regression model from Cosby et al. (1984): - -.. math:: - :label: 21.7) - - \Psi _{sat,\, j} =-\left(9.8e-5\right)\exp \left(\left(1.54-0.0095P_{sand,\, j} +0.0063\left(100-P_{sand,\, j} -P_{clay,\, j} \right)\right)\log \left(10\right)\right) - -where :math:`{P}_{sand,j}` and :math:`{P}_{clay,j}` are the -volume percentages of sand and clay in soil layer *j*. - +changed from a default value of -10 MPa used in CLM4.5 and earlier to a +default value of -2.5 MPa). :math:`{\Psi}_{max,j}` (MPa) is the soil +moisture at which decomposition proceeds at a moisture-unlimited +rate. The default value of :math:`{\Psi}_{max,j}` for CLM5 is updated +from a saturated value used in CLM4.5 and earlier, to a value +nominally at field capacity, with a value of -0.002 MPa + For frozen soils, the bulk of the rapid dropoff in decomposition with decreasing temperature is due to the moisture limitation, since matric potential is limited by temperature in the supercooled water formulation From 683a3185eb150276d56f9911c4acd032c3e82184 Mon Sep 17 00:00:00 2001 From: Charlie Koven Date: Wed, 6 Sep 2017 13:28:37 -0700 Subject: [PATCH 0097/1973] updated text in CN allocation: added N supply term equations, deleted the code on plant respiration (which has its own chapter), a couple other things. --- .../CLM50_Tech_Note_CN_Allocation.rst | 138 +++++------------- .../tech_note/FUN/CLM50_Tech_Note_FUN.rst | 2 +- 2 files changed, 34 insertions(+), 106 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 728ae142c1..4db8909b42 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -249,62 +249,62 @@ storage pools (where storage is indicated with *\_stor*) for the various tissue types are given as: .. math:: - :label: 19.22 + :label: 19.14 CF_{alloc,leaf} \_ =CF_{alloc,leaf\_ tot} f_{cur} .. math:: - :label: 19.23 + :label: 19.15 CF_{alloc,leaf\_ stor} \_ =CF_{alloc,leaf\_ tot} \left(1-f_{cur} \right) .. math:: - :label: 19.24 + :label: 19.16 CF_{alloc,froot} \_ =CF_{alloc,leaf\_ tot} a_{1} f_{cur} .. math:: - :label: 19.25 + :label: 19.17 CF_{alloc,froot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{1} \left(1-f_{cur} \right) .. math:: - :label: 19.26 + :label: 19.18 CF_{alloc,livestem} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} f_{cur} .. math:: - :label: 19.27 + :label: 19.19 CF_{alloc,livestem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} \left(1-f_{cur} \right) .. math:: - :label: 19.28 + :label: 19.20 CF_{alloc,deadstem} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)f_{cur} .. math:: - :label: 19.29 + :label: 19.21 CF_{alloc,deadstem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right) .. math:: - :label: 19.30 + :label: 19.22 CF_{alloc,livecroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} f_{cur} .. math:: - :label: 19.31 + :label: 19.23 CF_{alloc,livecroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} \left(1-f_{cur} \right) .. math:: - :label: 19.32 + :label: 19.24 CF_{alloc,deadcroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)f_{cur} .. math:: - :label: 19.33 + :label: 19.25 CF_{alloc,deadcroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). @@ -313,160 +313,88 @@ tissue types are given as: Nitrogen allocation ----------------------------------------- -The total flux of nitrogen to be allocated is given by the FUN model (Chapter :numref:`rst_FUN`). This gives a total N to be allocated within a given timestep, :math:`N_{supply}`. The total N allocated for a given organ :math:`o` is the minimum between the supply and the demand: +The total flux of nitrogen to be allocated is given by the FUN model (Chapter :numref:`rst_FUN`). This gives a total N to be allocated within a given timestep, :math:`N_{supply}`. The total N allocated for a given tissue :math:`i` is the minimum between the supply and the demand: .. math:: + :label: 19.26 - NF_{alloc,o} = min \left( NF_{demand, o}, NF_{supply, o} \right) + NF_{alloc,i} = min \left( NF_{demand, i}, NF_{supply, i} \right) The demand for each tissue, calculated for the tissue to remain on stoichiometry during growth, is: .. math:: - :label: 19.34 + :label: 19.27 NF_{demand,leaf} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } f_{cur} .. math:: - :label: 19.35 + :label: 19.28 NF_{demand,leaf\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } \left(1-f_{cur} \right) .. math:: - :label: 19.36 + :label: 19.29 NF_{demand,froot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } f_{cur} .. math:: - :label: 19.37 + :label: 19.30 NF_{demand,froot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } \left(1-f_{cur} \right) .. math:: - :label: 19.38 + :label: 19.31 NF_{demand,livestem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } f_{cur} .. math:: - :label: 19.39 + :label: 19.32 NF_{demand,livestem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) .. math:: - :label: 19.40 + :label: 19.33 NF_{demand,deadstem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} .. math:: - :label: 19.41 + :label: 19.34 NF_{demand,deadstem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right) .. math:: - :label: 19.42 + :label: 19.35 NF_{demand,livecroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } f_{cur} .. math:: - :label: 19.43 + :label: 19.36 NF_{demand,livecroot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) .. math:: - :label: 19.44 + :label: 19.37 NF_{demand,deadcroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} .. math:: - :label: 19.45 + :label: 19.38 NF_{demand,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). -Autotrophic Respiration ----------------------------- - -The model treats maintenance and growth respiration fluxes separately, -even though it is difficult to measure them as separate fluxes (Lavigne -and Ryan, 1997; Sprugel et al., 1995). Maintenance respiration is -defined as the carbon cost to support the metabolic activity of existing -live tissue, while growth respiration is defined as the additional -carbon cost for the synthesis of new growth. - -13.7.1 Maintenance Respiration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Under the assumption that tissue nitrogen content is a suitable index of -cellular metabolic rate, maintenance respiration costs for live tissues -(leaf, live stem, live coarse root, and fine root) are calculated as -functions tissue nitrogen content and the relevant temperature, -following the empirical relationship reported by Ryan (1991): - -.. math:: - :label: 19.46 - - CF_{mr\_ leaf} \_ =NS_{leaf} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} +After each pool's demand is calculated, the total plant N demand is then the sum of each individual pool :math: `i` corresponding to each tissue: .. math:: - :label: 19.47 - - CF_{mr\_ livestem} \_ =NS_{livestem} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} - -.. math:: - :label: 19.48 - - CF_{mr\_ livecroot} \_ =NS_{livecroot} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} - -.. math:: - :label: 19.49 - - CF_{mr\_ froot} \_ =\sum _{j=1}^{nlevsoi}NS_{froot} rootfr_{j} MR_{base} MR_{Q10} ^{(Ts_{j} -20)/10} - -where :math:`MR_{base}` (= 2.525e\ :sup:`-6` gC gN\ :sup:`-1` s\ :sup:`-1`) is the base rate of maintenance -respiration per unit nitrogen content, :math:`MR_{q10}` (= 2.0) is -the temperature sensitivity for maintenance respiration, -:math:`T_{2m}` (:sup:`o`\ C) is the air temperature at 2m -height, :math:`Ts_{j}`* (:sup:`o`\ C) is the soil -temperature at level *j*, and :math:`rootfr_{j}` is the fraction -of fine roots distributed in soil level *j*. + :label: 19.39 -Note that, for woody vegetation, maintenance respiration costs are not -calculated for the dead stem and dead coarse root components. These -components are assumed to consist of dead xylem cells, with no metabolic -function. By separating the small live component of the woody tissue -(ray parenchyma, phloem, and sheathing lateral meristem cells) from the -larger fraction of dead woody tissue, it is reasonable to assume a -common base maintenance respiration rate for all live tissue types. + NF_{demand,tot} = \sum _{i=tissues} NF_{demand,i} -The total maintenance respiration cost is then given as: +and the total supply for each tissue :math: `i` is the product of the fractional demand and the total available N, calculated as the term :math: `N_{uptake}` equal to the sum of the eight N uptake streams described in the FUN model (Chapter :numref:`rst_FUN`). .. math:: - :label: 19.50 - - CF_{mr} =CF_{mr\_ leaf} +CF_{mr\_ froot} +CF_{mr\_ livestem} +CF_{mr\_ livecroot} . + :label: 19.40 -13.7.2 Growth Respiration -^^^^^^^^^^^^^^^^^^^^^^^^^ + NF_{alloc,i} = N_{uptake} NF_{demand,i} / NF_{demand,tot} -Growth respiration is calculated as a factor of 0.3 times the total -carbon in new growth on a given timestep, based on construction costs -for a range of woody and non-woody tissues (Larcher, 1995). For new -carbon and nitrogen allocation that enters storage pools for subsequent -display, it is not clear what fraction of the associated growth -respiration should occur at the time of initial allocation, and what -fraction should occur later, at the time of display of new growth from -storage. Eddy covariance estimates of carbon fluxes in forest ecosystems -suggest that the growth respiration associated with transfer of -allocated carbon and nitrogen from storage into displayed tissue is not -significant (Churkina et al., 2003), and so it is assumed in CLM that -all of the growth respiration cost is incurred at the time of initial -allocation, regardless of the fraction of allocation that is displayed -immediately (i.e. regardless of the value of :math:`f_{cur}`, -section 13.5). This behavior is parameterized in such a way that if -future research suggests that some fraction of the growth respiration -cost should be incurred at the time of display from storage, a simple -parameter modification will effect the change. [1]_ -.. [1] - Parameter :math:`\text{grpnow}` in routines CNGResp and CNAllocation, currently set to 1.0, could be changed to a smaller - value to transfer some portion (1 - :math:`\text{grpnow}` ) of the growth respiration forward in time to occur at the time of growth - display from storage. diff --git a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst index 32d42b564c..c94c3556ef 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -276,7 +276,7 @@ Modifications to allow variation in C:N ratios -------------------------------------------------------- The original FUN model as developed by Fisher et al. (2008) and Brzostek et al. (2015) assumes a fixed plant tissue C:N ratio. This means that in the case where N is especially limiting, all excess carbon will be utilized in an attempt to take up more Nitrogen. It has been repeatedly observed, however, that in these circumstances in real life, plants have some flexibility in the C:N stoichiometry of their tissues, and therefore, this assumption may not be realistic. **lit review on CN ratios** -Thus, in CLM5, we introduce the capacity for tissue C:N ratios to be prognostic, rather than static. Overall N and C availability (:math:`N_uptake` and :math:`C_{growth}`) and hence tissue C:N ratios, are both determined by FUN. Allocation to individual tissues is discussed in the allocation chapter +Thus, in CLM5, we introduce the capacity for tissue C:N ratios to be prognostic, rather than static. Overall N and C availability (:math:`N_{uptake}` and :math:`C_{growth}`) and hence tissue C:N ratios, are both determined by FUN. Allocation to individual tissues is discussed in the allocation chapter Here we introduce an algorithm which adjusts the C expenditure on uptake to allow varying tissue C:N ratios. Increasing C spent on uptake will directly reduce the C:N ratio, and reducing C spent on uptake (retaining more for tissue growth) will increase it. C spent on uptake is impacted by both the N cost in the environment, and the existing tissue C:N ratio of the plant. The output of this algorithm is :math:`\gamma_{FUN}`, the fraction of the ideal :math:`C_{nuptake}` calculated from the FUN equation above (**link equation**). From 476bb4ebdbff08f31ab9e2004a33b98dac1c929c Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 11 Sep 2017 11:41:50 -0600 Subject: [PATCH 0098/1973] Update html and fix build errors --- .../CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst | 2 +- .../tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 2 +- .../Decomposition/CLM50_Tech_Note_Decomposition.rst | 2 +- .../Introduction/CLM50_Tech_Note_Introduction.rst | 8 ++++---- doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst | 2 +- .../CLM50_Tech_Note_Plant_Respiration.rst | 8 +------- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 4db8909b42..50f47d92e0 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -137,7 +137,7 @@ favorable growth environments (Allen et al., 2005; Vanninen and Makela, .. table:: Allocation and target carbon\:nitrogen ratio parameters +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`Target CN_{leaf}` | :math:`Target CN_{fr}` | :math:`Target CN_{lw}` | :math:`Target CN_{dw}` | + | Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`Target CN_{leaf}` | :math:`Target CN_{fr}` | :math:`Target CN_{lw}` | :math:`Target CN_{dw}` | +==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ | NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst index 9304f87634..469bc96f33 100644 --- a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -53,7 +53,7 @@ Tissue Stoichiometry ----------------------- As of CLM5, vegetation tissues have a flexible stoichiometry, as -described in :ref:`Ghimire et al. (2015) `. Each +described in :ref:`Ghimire et al. (2016) `. Each tissue has a target C\:N ratio, and nitrogen is allocated at each timestep in order to allow the plant to best match the target stoichiometry. Nitrogen downregulation of productivity acts by diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index 6863012fda..4d72bd357e 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -754,7 +754,7 @@ cm\ :sup:`2`/yr. For non-permafrost soils, the default diffusivity is 1 cm\ :sup:`2`/yr. Model Equilibration and its Acceleration ---------------------------------------- +----------------------------------------- For transient experiments, it is usually assumed that the carbon cycle is starting from a point of relatively close equilibrium, i.e. that productivity is balanced by ecosystem carbon losses through diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index f71aed9712..69139a35fe 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -77,7 +77,7 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Figure Schematic of land cover change` Schematic of land cover change impacts on CLM carbon pools and fluxes. -- :numref:`Figure Schematic of translation of annual UNH land units` Schematic of translation of annual UNH land units to CLM4 plant functional types. +- :numref:`Figure Schematic of translation of annual LUH2 land units` Schematic of translation of annual UNH land units to CLM4 plant functional types. - :numref:`Figure Atmospheric Delta C14` Atmospheric :math:`\mathrm{\Delta}` 14C used to drive 14C model over the historical period. @@ -149,9 +149,9 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Crop plant functional types` Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. -- :numref:`Table Crop pfts` Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. +- :numref:`Table Crop plant functional types` Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. -- :numref:`Table Pre- and post-grain fill CN ratios` Pre- and post-grain fill C:N ratios for crop leaf, stem, fine root, and reproductive pools. +- :numref:`Table Crop allocation parameters` Crop allocation parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. - :numref:`Table Plant functional type (PFT) biogeography rules` Plant functional type (PFT) biogeography rules with respect to climate. @@ -533,7 +533,7 @@ Nitrogen for Assimilation (LUNA, :ref:`(Xu et al., 2012` and :ref:`A photosynthetic capacity based on optimization of the use of leaf nitrogen under different environmental conditions such that light capture, carboxylation, and respiration are co-limiting. Allocation changes ... Fixation ??? -Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. +Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. Fertilization rates and irrigation equipped area updated based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that vary by latitude for selected crop types, grain C and N is now removed at harvest to a 1-year product pool with the carbon for the next season's crop seed removed from the grain carbon at harvest. Through the introduction of diff --git a/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst b/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst index 28cf52f8a1..40b1918f46 100644 --- a/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst +++ b/doc/source/tech_note/Lake/CLM50_Tech_Note_Lake.rst @@ -139,7 +139,7 @@ for the top snow layer. Otherwise, :math:`\beta` is set equal to the near infrared fraction of the shortwave radiation reaching the surface simulated by the atmospheric model or atmospheric data model used for offline -simulations (Chapter :numref:`rst_Offline Mode`). The remainder of the shortwave radiation +simulations (Chapter :numref:`rst_Land-only Mode`). The remainder of the shortwave radiation fraction (1 :math:`{-}` :math:`\beta`) is absorbed in the lake body or soil as described in section :numref:`Radiation Penetration`. diff --git a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst index 7fe7be9689..c2a665d8ac 100644 --- a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst +++ b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst @@ -29,13 +29,7 @@ nitrogen pool tracks retranslocated nitrogen, mobilized from leaf tissue prior to abscission and litterfall. Altogether there are 20 state variables for vegetation carbon, and 19 for vegetation nitrogen. -Figure 13.1. Vegetation fluxes and pools. - -.. image:: image1.png - :width: 800px - :height: 800px - -Figure 13.2: Carbon and nitrogen pools. +.. _Figure Carbon and nitrogen pools: .. image:: image2.png :width: 400px From e923b35211ef4f67c835608f358c7f63f03cd62b Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 5 Oct 2017 17:15:50 -0600 Subject: [PATCH 0099/1973] fixed a few typos in the Introduction --- .../CLM50_Tech_Note_Introduction.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index f71aed9712..b8a4d2c30f 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -505,7 +505,7 @@ Community Earth System Model version 1.2 (CESM1.2). CLM5.0 ^^^^^^^^^^^^ -Developments for CLM5.0 build on the progress made in CLM4.5. Most major components of the model have been udpated with particularly +Developments for CLM5.0 build on the progress made in CLM4.5. Most major components of the model have been updated with particularly notable changes made to soil and plant hydrology, snow density, river modeling, carbon and nitrogen cycling and coupling, and crop modeling. Much of the focus of development centered on a @@ -520,7 +520,7 @@ sheets. The fresh snow density parameterization is updated to more realisticall dynamically adjust landunit weights means that a glacier can initiate, grow, shrink, or disappear during a simulation when two-way coupling is active. Multiple elevation classes (10 elevation classes by default) and associated temperature, rain/snow partitioning, and downwelling longwave downscaling are used for glacier landunits to account for the strong topographic elevation heterogeneity over glaciers and ice sheets. -A plant hydraulic stress routine is introduced which explicitly models water transport through the vegetation according to a simple hydraulic framework (Kennedy et al., to be submitted). The water supply equations are used to solve for vegetation water potential forced by transpiration demand and a set of layer-by-layer soil water potentials. Stomatal conductance, therefore, is a function of prognostic leaf water potential. Water stress is calculated as the ratio of attenuated stomatal conductance to maximum stomatal conductance. An emergent feature of the plant hydraulics is soil hydraulic redistribution. In CLM5, maximum stomatal conductance is obtained from the Medlyn conductance model :ref:(Medlyn et al., 2011)`, rather than the Ball-Berry stomatal conductance model that was utilized in CLM4.5 and prior versions of the model. The Medlyn stomatal conductance model is preferred mainly for it's more realistic behavior at low humidity levels :ref:`(Rogers et al., 2017)`. The stress deciduous vegetation phenology trigger is augmented with a antecedent precipitation requirement :ref:`(Dahlin et al. 2015)`. +A plant hydraulic stress routine is introduced which explicitly models water transport through the vegetation according to a simple hydraulic framework (Kennedy et al., to be submitted). The water supply equations are used to solve for vegetation water potential forced by transpiration demand and a set of layer-by-layer soil water potentials. Stomatal conductance, therefore, is a function of prognostic leaf water potential. Water stress is calculated as the ratio of attenuated stomatal conductance to maximum stomatal conductance. An emergent feature of the plant hydraulics is soil hydraulic redistribution. In CLM5, maximum stomatal conductance is obtained from the Medlyn conductance model :ref:`(Medlyn et al., 2011)`, rather than the Ball-Berry stomatal conductance model that was utilized in CLM4.5 and prior versions of the model. The Medlyn stomatal conductance model is preferred mainly for it's more realistic behavior at low humidity levels :ref:`(Rogers et al., 2017)`. The stress deciduous vegetation phenology trigger is augmented with a antecedent precipitation requirement :ref:`(Dahlin et al. 2015)`. Plant nutrient dynamics are substantially updated to resolve several deficiencies with the CLM4 and CLM4.5 nutrient cycling representation. The Fixation and Update of Nitrogen (FUN) model (refs???) is adapted for CLM :ref:`(Shi et al., 2016)` to resolve the unrealistic feature that plants get nitrogen for free in CLM4 and CLM4.5. With FUN, the fact that plants typically spend a @@ -533,25 +533,25 @@ Nitrogen for Assimilation (LUNA, :ref:`(Xu et al., 2012` and :ref:`A photosynthetic capacity based on optimization of the use of leaf nitrogen under different environmental conditions such that light capture, carboxylation, and respiration are co-limiting. Allocation changes ... Fixation ??? -Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. -Fertilization rates and irrigation equipped area updated based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that +Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016`). These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. +Fertilization rates and irrigation equipped area are updated annually based on crop type and geographic region through an input dataset. The irrigation trigger is revised. Additional minor changes include crop phenological triggers that vary by latitude for selected crop types, grain C and N is now removed at harvest to a 1-year product pool with the carbon for the next season's crop seed removed from the grain carbon at harvest. Through the introduction of the capability to dynamically adjust landunit weights during a simulation, the crop model can now be run coincidentally with prescribed land use, which significantly expands the capabilities of the model. Mass-based rather than area-based wood harvest is applied. Several heat stress indices for both urban and rural areas are calculated and output by default :ref:`(Buzan et al., 2015)`. A more sophisticated and realistic building space heating and air conditioning submodel that prognoses interior building air temperature and includes more realistic space heating and air conditioning wasteheat factors is incorporated. -The fire model is the same as utilized in CLM4.5 except that a modified scheme is used to estimate the dependence of fire occurrence and spread on fuel wetness for non-peat fires outside cropland and tropical closed forests :ref:`Li and Lawrence, 2017)` and the dependence of agricultural fires on fuel load is removed. +The fire model is the same as utilized in CLM4.5 except that a modified scheme is used to estimate the dependence of fire occurrence and spread on fuel wetness for non-peat fires outside cropland and tropical closed forests :ref:`(Li and Lawrence, 2017)` and the dependence of agricultural fires on fuel load is removed. Included with the release of CLM5.0 is a functionally supported version of the Functionally-Assembled Terrestrial Ecosystem Simulator (FATES, :ref:`Fisher et al., 2015)`. A major motivation of this development is to allow the prediction of biome boundaries directly from plant physiological traits via their competitive interactions. The version of CLM5-FATES that is supported in this release is described here??? Short blurb on what FATES can do??? Note that the classical dynamic global vegetation model (DGVM) that has been available within CLM4 and CLM4.5 remains available, though it is largely untested. The technical description of the CLM-DGVM can be found within the CLM4.5 Technical Description (:ref:`Oleson et al. 2013)`. During the course of the development of CLM5.0, it became clear that the increasing complexity of the model combined with the increasing number and range of model development projects required updates to the underlying CLM infrastructure. Many such software improvements -are included in CLM5.0 including a partial transition to an object-oriented modular software structure, extraction of many hard coded model -parameters into either the parameter file or the CLM namelist, which allows users to more readily calibrate the model for use at +are included in CLM5.0 including a partial transition to an object-oriented modular software structure. Many hard coded model +parameters have been extracted into either the parameter file or the CLM namelist, which allows users to more readily calibrate the model for use at specific locations or to conduct parameter sensitivity studies. As part of the effort to increase the scientific utility of the code, in most instances older generation parameterizations (i.e., the parameterizations -available in CLM4 or CLM4.5) are retained under namelist switches, allowing the user to revert to CLM4.5 +available in CLM4 or CLM4.5) are retained under namelist switches, allowing the user to revert to CLM4.5 from the same code base or to revert individual parameterizations where the old parameterizations are compatible with the new code. Finally, multiple vertical soil layer structures are defined and it is relatively easy to add additional structures. From a6f35a5da50e3de8f986da3fb0142b31460a7295 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 12 Oct 2017 09:49:48 -0600 Subject: [PATCH 0100/1973] Edits to Vegetation Phenology chapter, minor edits to Intro --- .../CLM50_Tech_Note_Introduction.rst | 2 +- ...ech_Note_Vegetation_Phenology_Turnover.rst | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index daca44e404..3f5473c9bf 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -174,7 +174,7 @@ Jiafu Mao, Lei Meng, Sheri Michelson, Guo-Yue Niu, Adam Phillips, Taotao Qian, Jon Radakovich, James Randerson, Nan Rosenbloom, Steve Running, Koichi Sakaguchi, Adam Schlosser, Andrew Slater, Reto Stöckli, Ying Sun, Quinn Thomas, Peter Thornton, Mariana Vertenstein, Nicholas Viovy, Aihui Wang, Guiling Wang, -Charlie Zender, Xiaodong Zeng, and Xubin Zeng. +Zong-Liang Yang, Charlie Zender, Xiaodong Zeng, and Xubin Zeng. .. _rst_Introduction: diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index 251e1acfcd..7ede3405e0 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -116,7 +116,7 @@ out of the transfer pool: r_{xfer\_ on} =\left\{\begin{array}{l} {{2\mathord{\left/ {\vphantom {2 t_{onset} }} \right. \kern-\nulldelimiterspace} t_{onset} } \qquad {\rm for\; }t_{onset} \ne \Delta t} \\ {{1\mathord{\left/ {\vphantom {1 \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \qquad {\rm for\; }t_{onset} =\Delta t} \end{array}\right. and *t*\ :sub:`onset` (s) is the number of seconds remaining in -the current phenology onset growth period (Figure 14.1). The form of Eq. +the current phenology onset growth period (Figure 14.1). The form of Eq. :eq:`ZEqnNum852972` produces a flux from the transfer pool which declines linearly over the onset growth period, approaching zero flux in the final timestep. @@ -580,13 +580,16 @@ previous offset period), an accumulated soil water index SWI_{sum}^{n} =\left\{\begin{array}{l} {SWI_{sum}^{n-1} +f_{day} \qquad {\rm for\; }\Psi _{s,3} \ge \Psi _{onset} } \\ {SWI_{sum}^{n-1} \qquad \qquad {\rm for\; }\Psi _{s,3} <\Psi _{onset} } \end{array}\right. where :math:`\Psi`\ :sub:`s,3` is the soil water potential (MPa) -in the third soil layer and :math:`{\Psi}_{onset} = -2 MPa` +in the third soil layer and :math:`{\Psi}_{onset} = -0.6 MPa` is the onset soil water potential threshold. Onset triggering is -possible once :math:`{SWI}_{sum} > 15`. If the cold climate -growing degree-day accumulator is not active at the time when this -threshold is reached (see below), and if the daylength is greater than 6 +possible once :math:`{SWI}_{sum} > 15`. To avoid spurious onset triggering due to +soil moisture in the third soil layer exceeding the threshold due only to +soil water suction of water from deeper in the soil column, an additional precipitation trigger is included which requires +at least 20 mm of rain over the previous 10 days :ref:`(Dahlin et al., 2015) `. If the cold climate +growing degree-day accumulator is not active at the time when the soil moisture and precipitation +thresholds are reached (see below), and if the daylength is greater than 6 hours, then onset is triggered. Except as noted below, -:math:`{SWI}_{sum}` continues to accumulate according to Eq. during +:math:`{SWI}_{sum}` continues to accumulate according to Eq. :eq:`ZEqnNum503826` during the dormant period if the daylength criterion prevents onset triggering, and onset is then triggered at the timestep when daylength exceeds 6 hours. @@ -604,8 +607,8 @@ with subsequent accumulation calculated as: If :math:`{FD}_{sum} > 15` during the dormant period, then a cold-climate onset triggering criterion is introduced, following exactly -the growing degree-day summation (:math:`{GDD}_{sum}`) logic of Eqs. -and . At that time :math:`{SWI}_{sum}` is reset +the growing degree-day summation (:math:`{GDD}_{sum}`) logic of Eqs. :eq:`ZEqnNum510730` +and :eq:`ZEqnNum598907`. At that time :math:`{SWI}_{sum}` is reset (:math:`{SWI}_{sum} = 0`). Onset triggering under these conditions depends on meeting all three of the following criteria: :math:`{SWI}_{sum} > 15`, :math:`{GDD}_{sum} > {GDD}_{sum\_crit}`, and daylength greater than 6 hrs. @@ -613,8 +616,8 @@ depends on meeting all three of the following criteria: The following control variables are set when a new onset growth period is initiated: :math:`{SWI}_{sum} = 0`, :math:`{FD}_{sum} = 0`, :math:`{GDD}_{sum} = 0`, :math:`{n}_{days\_active} = 0`, and :math:`t_{onset} = 86400\cdot n_{days\_ on}` , where :math:`{n}_{days\_on}` is set to a constant value of 30 days. Fluxes -from storage into transfer pools occur in the timestep when a new onset growth period is initiated, and are handled identically to Eqs. - for -carbon fluxes, and to Eqs. - for nitrogen fluxes. The onset counter is decremented on each time step after initiation of the onset period, +from storage into transfer pools occur in the timestep when a new onset growth period is initiated, and are handled identically to Eqs. :eq:`ZEqnNum904388` -:eq:`ZEqnNum195642` for +carbon fluxes, and to Eqs. :eq:`ZEqnNum812152` - :eq:`ZEqnNum605338` for nitrogen fluxes. The onset counter is decremented on each time step after initiation of the onset period, until it reaches zero, signaling the end of the onset period: .. math:: From c663ab8c96f10f64604154ba3b34b4e76db74783 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 12 Oct 2017 16:38:36 -0600 Subject: [PATCH 0101/1973] Fixes for lnd <-> atm coupling fields Added atmosphere model's surface height as a required input, and 10-m wind speed as an output. Also fixed some typos. --- .../tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 10315b7d98..e21c8e05d0 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -425,6 +425,8 @@ conditions from the current time step. +======================================================+================================================+=================================================+ | :sup:`1`\ Reference height | :math:`z'_{atm}` | m | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ + | Atmosphere model's surface height | :math:`z_{surf,atm}` | m | + +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ | Zonal wind at :math:`z_{atm}` | :math:`u_{atm}` | m s\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ | Meridional wind at :math:`z_{atm}` | :math:`v_{atm}` | m s\ :sup:`-1` | @@ -451,7 +453,7 @@ conditions from the current time step. +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ | Incident diffuse near-infrared solar radiation | :math:`S_{atm} \, \downarrow _{nir}` | W m\ :sup:`-2` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ - | Carbon dioxide (CO:sub:`2`) concentration | :math:`c_{a}` | ppmv | + | Carbon dioxide (CO\ :sub:`2`) concentration | :math:`c_{a}` | ppmv | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ | :sup:`3`\ Aerosol deposition rate | :math:`D_{sp}` | kg m\ :sup:`-2` s\ :sup:`-1` | +------------------------------------------------------+------------------------------------------------+-------------------------------------------------+ @@ -471,7 +473,7 @@ reference heights for temperature, wind, and specific humidity :math:`z_{atm,\, w}` ) are required. These are set equal to\ :math:`z_{atm}` . -:sup:`2`\ The placeCAM provides convective and large-scale liquid +:sup:`2`\ CAM provides convective and large-scale liquid and solid precipitation, which are added to yield total liquid precipitation :math:`q_{rain}` and solid precipitation :math:`q_{sno}` . @@ -566,6 +568,8 @@ calculated from molar ratio and the atmospheric pressure +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Specific humidity at 2 meter height | :math:`q_{2m}` | kg kg\ :sup:`-1` | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ + | Wind speed at 10 meter height | :math:`u_{10m}` | m s\ :sup:`-1` | + +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Snow water equivalent | :math:`W_{sno}` | m | +---------------------------------------+------------------------------------------------+--------------------------------------------------------------+ | Aerodynamic resistance | :math:`r_{am}` | s m\ :sup:`-1` | From 429985bf7716e1ecd287b0c206da98f38d3d5743 Mon Sep 17 00:00:00 2001 From: Charlie Koven Date: Fri, 10 Nov 2017 15:46:37 -0800 Subject: [PATCH 0102/1973] made some changes to the Allocation Chapter --- .../CLM50_Tech_Note_CN_Allocation.rst | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 50f47d92e0..37d3f0a10f 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -3,6 +3,13 @@ Carbon and Nitrogen Allocation ============================== +Summary of CLM5.0 updates relative to the CLM4.5 +----------------------------------------------------- +- CLM5 now defaults to a static allocation to woody biomass rather than the dynamic allocation term used in CLM4.5. The dynamic allocation is stil lkept as an option, for details, see the CLM4.5 Tech Note. + + - CLM5 now includes flexible C:N ratios of all plant tissues, which allows allocation of carbon to occur separately from allocation of nitrogen, thus removing the requirement to downregulate photosynthesis based on the instantaneous stoichiometric needs of allocation. + + Introduction ----------------- @@ -13,19 +20,19 @@ and available mineral nitrogen, coming from plant uptake of mineral nitrogen in the soil or being drawn out of plant reserves. A significant change to CLM5 relative to prior versions is that allocation of carbon and nitrogen proceed independently rather than in a sequential manner. -Carbon Allocation for Maintenance Respiration Costs --------------------------------------------------------- +Carbon Allocation to Cover Prior-Timestep Maintenance Respiration Costs +---------------------------------------------------------------------------- Allocation of available carbon on each time step is prioritized, with first priority given to the demand for carbon to support maintenance -respiration of live tissues (section 13.7). Second priority is to -replenish the internal plant carbon pool that supports maintenance -respiration during times when maintenance respiration exceeds +respiration of live tissues (Chapter :numref:`rst_Plant Respiration`) and Nitrogen acquisition costs (Chapter :numref:`rst_FUN`). Second priority is to +replenish the plant carbon deficit pool that balances maintenance +respiration that occurs during times when maintenance respiration exceeds photosynthesis (e.g. at night, during winter for perennial vegetation, or during periods of drought stress) (Sprugel et al., 1995). Third priority is to support growth of new tissues, including allocation to storage pools from which new growth will be displayed in subsequent time -steps. +steps, as well as growth respiration costs. The total maintenance respiration demand (:math:`CF_{mr}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as a function of @@ -116,21 +123,6 @@ Parameters :math:`a_{1}`, :math:`a_{2}`, and :math:`a_{4}` are defined as consta constant for all PFTs, based on construction costs for a range of woody and non-woody tissues (Larcher, 1995). -The model includes a dynamic allocation scheme for woody vegetation -(parameter :math:`a_{3}` = -1, :numref:`Table Allocation and CN ratio parameters`), in which case the -ratio for carbon allocation between new stem and new leaf increases with -increasing net primary production (NPP), as - -.. math:: - :label: 19.8 - - a_{3} =\frac{2.7}{1+e^{-0.004NPP_{ann} -300} } -0.4 - -where :math:`NPP_{ann}` is the annual sum of NPP from the previous -year. This mechanism has the effect of increasing woody allocation in -favorable growth environments (Allen et al., 2005; Vanninen and Makela, -2005) and during the phase of stand growth prior to canopy closure -(Axelsson and Axelsson, 1986). .. _Table Allocation and CN ratio parameters: @@ -382,14 +374,14 @@ The demand for each tissue, calculated for the tissue to remain on stoichiometry NF_{demand,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). -After each pool's demand is calculated, the total plant N demand is then the sum of each individual pool :math: `i` corresponding to each tissue: +After each pool's demand is calculated, the total plant N demand is then the sum of each individual pool :math:`i` corresponding to each tissue: .. math:: :label: 19.39 NF_{demand,tot} = \sum _{i=tissues} NF_{demand,i} -and the total supply for each tissue :math: `i` is the product of the fractional demand and the total available N, calculated as the term :math: `N_{uptake}` equal to the sum of the eight N uptake streams described in the FUN model (Chapter :numref:`rst_FUN`). +and the total supply for each tissue :math:`i` is the product of the fractional demand and the total available N, calculated as the term :math:`N_{uptake}` equal to the sum of the eight N uptake streams described in the FUN model (Chapter :numref:`rst_FUN`). .. math:: :label: 19.40 From 8226193dd1dbba312165b4097d020379455a90c3 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 14 Nov 2017 09:41:39 -0700 Subject: [PATCH 0103/1973] Updates to Carbon isotopes chapter --- .../CLM50_Tech_Note_Introduction.rst | 2 - .../Isotopes/CLM50_Tech_Note_Isotopes.rst | 60 +++++-------------- .../References/CLM50_Tech_Note_References.rst | 26 +------- 3 files changed, 18 insertions(+), 70 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 3f5473c9bf..69ad12b91f 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -79,8 +79,6 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Figure Schematic of translation of annual LUH2 land units` Schematic of translation of annual UNH land units to CLM4 plant functional types. -- :numref:`Figure Atmospheric Delta C14` Atmospheric :math:`\mathrm{\Delta}` 14C used to drive 14C model over the historical period. - **LIST OF TABLES** - :numref:`Table Plant functional types` Plant functional types diff --git a/doc/source/tech_note/Isotopes/CLM50_Tech_Note_Isotopes.rst b/doc/source/tech_note/Isotopes/CLM50_Tech_Note_Isotopes.rst index 093b7d7a37..43692205b8 100644 --- a/doc/source/tech_note/Isotopes/CLM50_Tech_Note_Isotopes.rst +++ b/doc/source/tech_note/Isotopes/CLM50_Tech_Note_Isotopes.rst @@ -22,13 +22,13 @@ General Form for Calculating :sup:`13`\ C and :sup:`14`\ C Flux -------------------------------------------------------------------------------- In general, the flux of :sup:`13`\ C and corresponding to a given -flux of total C (*CF\ :math:`{}_{13C}`* and *CF\ :math:`{}_{totC}`*, -respectively) is determined by *CF\ :math:`{}_{totC}`*, the masses of +flux of total C (:math:`{CF}_{13C}` and :math:`{CF}_{totC}`, +respectively) is determined by :math:`{CF}_{totC}`, the masses of :sup:`13`\ C and total C in the upstream pools -(*CS\ :math:`{}_{13C\_up}`* and *CS\ :math:`{}_{totC\_up}`*, +(:math:`{CS}_{13C\_up}` and :math:`{CS}_{totC\_up}`, respectively, i.e. the pools *from which* the fluxes of :sup:`13`\ C and total C originate), and a fractionation factor, -*f\ :math:`{}_{frac}`*: +:math:`{f}_{frac}`: .. math:: :label: ZEqnNum629812 @@ -36,7 +36,7 @@ respectively, i.e. the pools *from which* the fluxes of CF_{13C} =\left\{\begin{array}{l} {CF_{totC} \frac{CS_{13C\_ up} }{CS_{totC\_ up} } f_{frac} \qquad {\rm for\; }CS_{totC} \ne 0} \\ {0\qquad {\rm for\; }CS_{totC} =0} \end{array}\right\} If the :math:`{f}_{frac}` = 1.0 (no fractionation), then the fluxes -:math:`{CF}_{13C}` and :math:`{CF}_{totC}`* will be in simple +:math:`{CF}_{13C}` and :math:`{CF}_{totC}` will be in simple proportion to the masses :math:`{CS}_{13C\_up}` and :math:`{CS}_{totC\_up}`. Values of :math:`{f}_{frac} < 1.0` indicate a discrimination against the heavier isotope (:sup:`13`\ C) in the flux-generating process, while @@ -55,8 +55,8 @@ described in units that implicitly correct out the fractionation of Isotope Symbols, Units, and Reference Standards ---------------------------------------------------- -Carbon has two primary stable isotopes, :math:`{}^{12}`\ C and -:sup:`13`\ C. :math:`{}^{12}`\ C is the most abundant, comprising +Carbon has two primary stable isotopes, :sup:`12`\ C and +:sup:`13`\ C. :sup:`12`\ C is the most abundant, comprising about 99% of all carbon. The isotope ratio of a compound, :math:`{R}_{A}`, is the mass ratio of the rare isotope to the abundant isotope @@ -133,7 +133,7 @@ Carbon Isotope Discrimination During Photosynthesis Photosynthesis is modeled in CLM as a two-step process: diffusion of CO\ :sub:`2` into the stomatal cavity, followed by enzymatic -fixation (Chapter 8). Each step is associated with a kinetic isotope +fixation (Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`). Each step is associated with a kinetic isotope effect. The kinetic isotope effect during diffusion of CO\ :sub:`2` through the stomatal opening is 4.4‰. The kinetic isotope effect during fixation of CO\ :sub:`2` with Rubisco is @@ -173,39 +173,17 @@ calculation as follows: c_{i} =pCO_{2} -a_{n} p\frac{\left(1.4g_{s} \right)+\left(1.6g_{b} \right)}{g_{b} g_{s} } -and - -.. math:: - :label: 30.11) - - c_{i}^{*} =pCO_{2} -a_{n} \left(1-d\right)p\frac{\left(1.4g_{s} \right)+\left(1.6g_{b} \right)}{g_{b} g_{s} } - -where :math:`a_n` is net carbon assimilation during photosynthesis, -:math:`d` is downscaling factor due to nitrogen limitation, :math:`p` is +where :math:`a_n` is net carbon assimilation during photosynthesis, :math:`p` is atmospheric pressure, :math:`g_b` is leaf boundary layer conductance, and :math:`g_s` is leaf stomatal conductance. -The fractionation factor :math:`{\alpha }_{psn}` and net assimilation -:math:`a_n` are calculated during the radiation time-step in -CanopyFluxesMod.F90, whereas the downscaling factor :math:`d` is not -calculated until after the nitrogen limitation is computed in -CNAllocationMod.F90. That results in a difference between the actual -photosynthesis, which is downscaled by :math:`d`, and the potential -photosynthesis. In order to overcome this mismatch, downscaling due to -nitrogen limitation is factored in the calculation of the kinetic -isotope effect during fixation by defining a downscaled version of -intracellular CO\ :sub:`2` (:math:`c^*_i`), as a first order -approximation. However, since nitrogen down-regulation is calculated -after the photosynthesis calculation, down-regulation coefficient -calculated in the previous time step needs to be used. - Isotopic fractionation code is compatible with multi-layered canopy parameterization; i.e., it is possible to calculate varying discrimination rates for each layer of a multi-layered canopy. However, as with the rest of the photosynthesis model, the number of canopy layers is currently set to one by default. -:sup:`14`\ C radioactive decay and historical atmospheric :sup:`14`\ C concentrations +:sup:`14`\ C radioactive decay and historical atmospheric :sup:`14`\ C and :sup:`13`\ C concentrations ------------------------------------------------------------------------------------------------------ In the preindustrial biosphere, radioactive decay of :sup:`14`\ C @@ -226,18 +204,10 @@ accelerated by the same degree as the decomposition, such that the :sup:`14`\ C value of these pools is in equilibrium when taken out of the spinup mode. -For variation of atmospheric :sup:`14`\ C over the historical -period, :math:`\mathrm{\Delta}`\ :sup:`14`\ C values can be set to -either fixed concentration (:math:`\mathrm{\Delta}`\ :sup:`14`\ C = 0‰) -or time-varying concentrations read in from a file. A default file -is provided that is based on a spline fit through several observational -datasets spanning the 20\ :math:`{}^{th}` century: (Levin and Kromer, -2004; Manning and Melhuish, 1994; Nydal and Lövseth, 1996; Turnbull et -al. 2007). This is shown in Figure 25.1. - -.. _Figure Atmospheric Delta C14: +For variation of atmospheric :sup:`14`\ C and :sup:`13`\ C over the historical +period, :math:`\mathrm{\Delta}`\ :sup:`14`\ C and :math:`\mathrm{\Delta}`\:sup:`13`\ C values can be set to +either fixed concentrations +or time-varying concentrations read in from a file. A default file is provided that spans the historical period (:ref:`Graven et al., 2017 `). For +:math:`\mathrm{\Delta}`\ :sup:`14`\ C, values are provided and read in for three latitude bands (30 :sup:`o`\ N-90 :sup:`o`\ N, 30 :sup:`o`\ S-30 :sup:`o`\ N, and 30 :sup:`o`\ S-90 :sup:`o`\ S). -.. figure:: image1.png - Atmospheric :math:`\mathrm{\Delta}`\ :sup:`14`\ C - used to drive :sup:`14`\ C model over the historical period. diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index d7a5887778..048fa076c0 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -615,6 +615,9 @@ Graham, S.T., Famiglietti, J.S., and Maidment, D.R. 1999. Five-minute, use in regional and global hydrologic and climate system modeling studies. Water Resour. Res. 35:583-587. +.. _Gravenetal2017: + +Graven, H., C. E. Allison, D. M. Etheridge, S. Hammer, R. F. Keeling, I. Levin, H. A. J. Meijer, M. Rubino, P. P. Tans, C. M. Trudinger, B. H. Vaughn and J. W. C. White (2017) Compiled records of carbon isotopes in atmospheric CO2 for historical simulations in CMIP6, Geoscientific Model Development, in review. doi: 10.5194/gmd-2017-166. .. _GrenfellWarren1999: Grenfell, T.C., and Warren, S.G. 1999. Representation of a nonspherical @@ -1032,11 +1035,6 @@ Letts, M.G., Roulet, N.T., Comer, N.T., Skarupa, M.R., and Verseghy, D.L. 2000. Parametrization of peatland hydraulic properties for the Canadian Land Surface Scheme. Atmos.-Ocean 38:141-160. -.. _LevinKromer2004: - -Levin, I. and Kromer, B. 2004. The tropospheric 14CO2 level in -mid-latitudes of the Northern Hemisphere (1959-2003) Radiocarbon 46:1. - .. _Levisetal2003: Levis, S., Wiedinmyer, C., Bonan, G.B., and Guenther, A. 2003. @@ -1203,12 +1201,6 @@ DOI:10.1029/2005JD006653. Makela, A. 2002. Derivation of stem taper from the pipe model theory in a carbon balance framework. Tree Phys. 22:891-905. -.. _Manning, M.R. and Melhuish, W.H. 1994. Trends: A Compendium of Data on - -Manning, M.R. and Melhuish, W.H. 1994. Trends: A Compendium of Data on -Global Change. Carbon Dioxide Information Analysis Center,. Oak Ridge -National Laboratory, U.S. Department of Energy, Oak Ridge, Tenn., U.S.A. - .. _Maoetal2012: Mao, J., Thornton, P.E., Shi, X., Zhao, M., and Post, W.M. 2012. Remote @@ -1337,12 +1329,6 @@ Niu, G.-Y., and Yang, Z.-L. 2007. An observation-based formulation of snow cover fraction and its evaluation over large North American river basins. J. Geophys. Res. 112:D21101. DOI:10.1029/2007JD008674. -.. _NydalLovseth1996: - -Nydal, R. and Lövseth, K. 1996. Carbon-14 Measurements In Atmospheric -CO2 From Northern And Southern Hemisphere Sites, 1962-1993, Carbon -Dioxide Information Analysis Center. - .. _Oikawaetal2005: Oikawa, S., Hikosaka, K. and Hirose, T., 2005. Dynamics of leaf area and @@ -1974,12 +1960,6 @@ burn area in western Canadian peatlands and its relationship to fire weather indices. Global Biogeochem. Cycles 18:GB4014. DOI:10.1029/2004GB002222. -.. _Turnbulletal2007: - -Turnbull, J.C. et al. 2007. A new high precision (CO2)-C-14 time series -for North American continental air. Journal of Geophysical -Research-Atmospheres 112(D11). - .. _Tyeetal2005: Tye, A.M., et al. 2005. The fate of N-15 added to high Arctic tundra to From 0c52f7524498e6031b6bfe1e86b66a40371c3628 Mon Sep 17 00:00:00 2001 From: William Wieder Date: Fri, 17 Nov 2017 11:07:58 -0700 Subject: [PATCH 0104/1973] updated External N cycle, Plant Respiration, refs --- ...LM50_Tech_Note_External_Nitrogen_Cycle.rst | 325 +++++++----------- .../CLM50_Tech_Note_Plant_Respiration.rst | 112 +++--- .../References/CLM50_Tech_Note_References.rst | 20 +- 3 files changed, 182 insertions(+), 275 deletions(-) diff --git a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst index 69959b0a8c..6a4ff5479d 100644 --- a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst +++ b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst @@ -3,8 +3,26 @@ External Nitrogen Cycle =========================== +.. _Summary of CLM5.0 updates relative to the CLM4.5: + +Summary of CLM5.0 updates relative to the CLM4.5 +----------------------------------------------------- + +We describe external inputs to the nitrogen cycle in CLM5.0.  Much of the following information appeared in the CLM4.5 Technical Note (:ref:`Oleson et al. 2013 `) as well as :ref:`Koven et al. (2013) `. + +CLM5.0 includes the following changes to terrestrial nitrogen inputs: + +- Time varrying deposition of reactive nitrogen. In off-line runs this changes monthly. In coupled simulations N deposition is passed at the coupling timestep (e.g., half-hourly). + +- Asymbiotic (or free living) N fixation is a function of evapotranspiration and is added to the inorganic nitrogen (NH\ :sub:`4`\ :sup:`+`) pool (described below). + +- Symbiotic N fixation is handled by the FUN model (chapter :numref:`rst_FUN`) and is passed straight to the plant, not the mineral nitrogen pool. + +Overview +----------------------------------------------------- + In addition to the relatively rapid cycling of nitrogen within the plant -– litter – soil organic matter system, CLM also represents several slow +– litter – soil organic matter system, CLM also represents several processes which couple the internal nitrogen cycle to external sources and sinks. Inputs of new mineral nitrogen are from atmospheric deposition and biological nitrogen fixation. Losses of mineral nitrogen @@ -12,19 +30,12 @@ are due to nitrification, denitrification, leaching, and losses in fire. While the short-term dynamics of nitrogen limitation depend on the behavior of the internal nitrogen cycle, establishment of total ecosystem nitrogen stocks depends on the balance between sources and -sinks in the external nitrogen cycle. - -CLM includes two separate treatments of the slow nitrogen cycle. The -first is the original CLM-CN formulations, which includes a single soil -mineral nitrogen pool to represent both -NO\ :sub:`3`\ :sup:`-` and NH\ :sub:`4`\ :sup:`+`, and with nitrogen losses via -denitrification calculated as a constant fraction of mineralization plus -a fixed first-order loss of unutilized mineral nitrogen at the end of -every timestep. The second is based on the Century N-gas model; this +sinks in the external nitrogen cycle (:ref:`Thomas et al. 2015 `). + +As with CLM4.5, CLM5.0 represents inorganic N transformations based on the Century N-gas model; this includes separate NH\ :sub:`4`\ :sup:`+` and NO\ :sub:`3`\ :sup:`-` pools, as well as -environmentally controlled nitrification and denitrification rates. Both -are described below. +environmentally controlled nitrification and denitrification rates that is described below. Atmospheric Nitrogen Deposition ------------------------------------ @@ -32,7 +43,8 @@ Atmospheric Nitrogen Deposition CLM uses a single variable to represent the total deposition of mineral nitrogen onto the land surface, combining wet and dry deposition of NO\ :sub:`y` and NH\ :sub:`x` as a single flux -(:math:`{NF}_{ndep\_sminn}`, gN m\ :sup:`-2` s\ :sup:`-1`). This flux is intended to represent total reactive +(:math:`{NF}_{ndep\_sminn}`, gN m\ :sup:`-2` s\ :sup:`-1`). This flux +is intended to represent total reactive nitrogen deposited to the land surface which originates from the following natural and anthropogenic sources (Galloway et al. 2004): formation of NO\ :sub:`x` during lightning, @@ -49,18 +61,25 @@ agricultural soils, NH\ :sub:`3` emission from agricultural crops, NH\ :sub:`3` emission from agricultural animal waste, and NH\ :sub:`3` emission from human waste and waste water. The deposition flux is provided as a spatially and (potentially) temporally -varying dataset (see section 2.2.3 for a description of the default +varying dataset (see section :numref:`Atmospheric Coupling` for a description of the default input dataset). -In the CLM-CN mineral N pool model, the nitrogen deposition flux is -assumed to enter the soil mineral nitrogen pool -(:math:`{NS}_{sminn}`) directly; while in the Century-based model, -all of the nitrogen is assumed to enter the -NH\ :sub:`4`\ :sup:`+` pool. Real pathways for wet and dry +The nitrogen deposition flux is assumed to enter the NH\ :sub:`4`\ :sup:`+` pool, +and is vertically distributed throughout the soil profile. Although N deposition +inputs include both oxidized and reduced forms, CLM5 only reads in total +N deposition. This approach is held over from CLM4.0, which only represented a +single mineral nitrogen pool, however, real pathways for wet and dry nitrogen deposition can be more complex than currently represented in -the CLM-CN, including release from melting snowpack and direct foliar -uptake of deposited NO\ :sub:`y` (e.g. Tye et al. 2005; Vallano -and Sparks, 2007). +the CLM5.0, including release from melting snowpack and direct foliar +uptake of deposited NO\ :sub:`y` (:ref:`Tye et al. 2005 `; +:ref:`Vallano and Sparks, 2007 `). + +In offline (uncoupled) CLM5.0 simulations monthly +estimates of N deposition are provided, as opposed to decadal files +supplied with previous versions of the model. In coupled simulations, +N depositions fluxes are passed to the land model at the frequency of +the time step (every half hour) through the coupler. + Biological Nitrogen Fixation --------------------------------- @@ -69,56 +88,53 @@ The fixation of new reactive nitrogen from atmospheric N\ :sub:`2` by soil microorganisms is an important component of both preindustrial and modern-day nitrogen budgets, but a mechanistic understanding of global-scale controls on biological nitrogen fixation (BNF) is still -only poorly developed (Cleveland et al. 1999; Galloway et al. 2004). -Cleveland et al. (1999) suggested empirical relationships that predict -BNF as a function of either evapotranspiration rate or net primary -productivity for natural vegetation. CLM assumes that BNF is a function -of net primary production (:math:`{CF}_{ann\_NPP}`, gC m\ :sup:`-2` y\ :sup:`-1`). The rationale for choosing net -primary production over evapotranspiration as the predictor is that the -two are well-correlated (Parton et al. 1993; Running et al. 1989), and -the use of primary production also introduces a known dependence of BNF -on the carbon supply to nitrogen fixing microorganisms (Cleveland et al. -1999). The expression used is: +only poorly developed (:ref:`Cleveland et al. 1999 `; +:ref:`Galloway et al. 2004 `). CLM5.0 uses the FUN +model (chapter :numref:`rst_FUN`) to +calculate the carbon cost and nitrogen acquired through symbotic +nitrogen fixation. This nitrogen is immediately available to plants. + +:ref:`Cleveland et al. (1999) ` suggested +an empirical relationships that predicts BNF as a function of +either evapotranspiration rate or net primary productivity for +natural vegetation. CLM5.0 adopts the evapotranspiration approach +to calculate asymbiotic, or free-living, N fixation. This function +has been modified from the :ref:`Cleveland et al. (1999) +` estimates to provide lower estimate of +free-living nitrogen fixation in CLM5.0 +(:math:`{CF}_{ann\_ET}`, mm yr\ :sup:`-1`). +This moves away from the NPP approach used in CLM4.0 and 4.5 and +avoids unrealistically increasing freeliving rates of N fixation +under global change scenarios (:ref:`Wieder et al. 2015 +` The expression used is: .. math:: - :label: ZEqnNum802819: + :label: 22.1) - NF_{nfix,sminn} ={1.8\left(1-\exp \left(-0.003{\kern 1pt} CF_{ann\_ NPP} \right)\right)\mathord{\left/ {\vphantom {1.8\left(1-\exp \left(-0.003{\kern 1pt} CF_{ann\_ NPP} \right)\right) \left(86400\cdot 365\right)}} \right. \kern-\nulldelimiterspace} \left(86400\cdot 365\right)} + NF_{nfix,sminn} ={0.0006\left(0.0117+CF_{ann\_ ET}\right)\mathord{\left/ {\vphantom {0.0006\left(0.0117+ CF_{ann\_ ET}\right) \left(86400\cdot 365\right)}} \right. \kern-\nulldelimiterspace} \left(86400\cdot 365\right)} + +Where :math:`{NF}_{nfix,sminn}` (gN m\ :sup:`-2` s\ :sup:`-1`) is the rate of free-living nitrogen fixation in :numref:`Figure Biological nitrogen fixation`. -where :math:`{NF}_{nfix,sminn}` (gN m\ :sup:`-2` s\ :sup:`-1`) is the rate of BNF. Eq. is plotted over a range of -annual NPP in Figure 16.1. .. _Figure Biological nitrogen fixation: .. figure:: image1.png - Biological nitrogen fixation as a function of annual net - primary production. - -Because of the empirical nature of this NPP-BNF relationship, the -timescale for calculating NPP and thus BNF is unconstrained. Using -annual NPP, as in CLM4.0, introduces an error at high latitudes because -the aseasonal BNF inputs mean that much of the nitrogen is added when -the vegetation is dormant and may be lost before it is ever taken up by -vegetation. Thus an option was added to CLM to allow for an exponential -relaxation (with default e-folding time of 10 days) calculation of NPP, -and BNF calculated from that using equation 16.1. - -As with Atmospheric N deposition, BNF N inputs are added directly to the -mineral N pools. In the CLM-CN N model, this is the single mineral N -pool; in the Century-based model, this is the + Free-living nitrogen fixation as a function of annual evapotranspiration. Results here show annual N inputs from free-living N fixations, but the model actually calculates inputs on a per second basis. + +As with Atmospheric N deposition, free-living N inputs are added directly to the NH\ :sub:`4`\ :sup:`+` pool. Nitrification and Denitrification Losses of Nitrogen --------------------------------------------------------- -In order to better understand the structural uncertainty in -biogeochemical responses to climate change, CLM includes two alternate -representations of the mineral N transformations and losses that define -the slow N cycle. Each of these is described below. - -16.3.1 CLM-CN formulation -^^^^^^^^^^^^^^^^^^^^^^^^^ +Nitrification is an autotrophic process that converts less mobile ammonium +ions into nitrate, that can more easily be lost from soil systems by leaching +or denitrification. The process catalyzed by ammonia oxidizing archaea and +bacteria that convert ammonium (NH\ :sub:`4`\ :sup:`+`) into nitrite, which +is subsequently oxidized into nitrate (NO\ :sub:`3`\ :sup:`-`). Conditions +favoring nitrification include high NH\ :sub:`4`\ :sup:`+` concentrations, +well aerated soils, a neutral pH and warmer temperatures. Under aerobic conditions in the soil oxygen is the preferred electron acceptor supporting the metabolism of heterotrophs, but anaerobic @@ -127,153 +143,59 @@ an electron acceptor (e.g. *Pseudomonas* and *Clostridium*) supporting respiration. This process, known as denitrification, results in the transformation of nitrate to gaseous N\ :sub:`2`, with smaller associated production of NO\ :sub:`x` and N\ :sub:`2`\ O. It -is typically assumed that nitrogen fixation and denitrification were -approximately balanced in the preindustrial biosphere (Galloway et al. -2004). It is likely that denitrification can occur within anaerobic +is typically assumed that nitrogen fixation and denitrification +were approximately balanced in the preindustrial biosphere ( +:ref:`Galloway et al. 2004 `). It is likely +that denitrification can occur within anaerobic microsites within an otherwise aerobic soil environment, leading to large global denitrification fluxes even when fluxes per unit area are -rather low (Galloway et al. 2004). - -Because the vertical distribution of soil organic matter is not resolved -explicitly in CLM-CN, a simple denitrification parameterization is used -that treats denitrification as a constant fraction of gross nitrogen -mineralization. At each step in the decomposition cascade, if the -transformation from an upstream to a downstream pool is predicted to -mineralize (as opposed to immobilize) nitrogen, then a constant fraction -of the nitrogen mineralization flux is assumed to be lost via -denitrification. Due to large uncertainties in the mechanistic -understanding of the environmental controls on denitrification, no -modifications to the denitrification fraction are made for different -soil moisture conditions. This is identified as a high-priority area for -future model development. - -Denitrification fluxes associated with gross mineralization in the -decomposition cascade are calculated as follows: - -.. math:: - :label: 22.2) - - NF_{denit,Lit1\to SOM1} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit1\to SOM1} >0} \\ {-NF_{pot\_ min,Lit1\to SOM1} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit1\to SOM1} \le 0} \end{array}\right. - -.. math:: - :label: 22.3) - - NF_{denit,Lit2\to SOM2} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit2\to SOM2} >0} \\ {-NF_{pot\_ min,Lit2\to SOM2} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit2\to SOM2} \le 0} \end{array}\right. - -.. math:: - :label: 22.4) - - NF_{denit,Lit3\to SOM3} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit3\to SOM3} >0} \\ {-NF_{pot\_ min,Lit3\to SOM3} {\kern 1pt} f_{denit} \qquad \qquad {\rm for\; }NF_{pot\_ min,Lit3\to SOM3} \le 0} \end{array}\right. - -.. math:: - :label: 22.5) - - NF_{denit,SOM1\to SOM2} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM1\to SOM2} >0} \\ {-NF_{pot\_ min,SOM1\to SOM2} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM1\to SOM2} \le 0} \end{array}\right. - -.. math:: - :label: 22.6) - - NF_{denit,SOM2\to SOM3} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM2\to SOM3} >0} \\ {-NF_{pot\_ min,SOM2\to SOM3} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM2\to SOM3} \le 0} \end{array}\right. - -.. math:: - :label: 22.7) - - NF_{denit,SOM3\to SOM4} =\left\{\begin{array}{l} {0\qquad \qquad \qquad \qquad {\rm for\; }NF_{pot\_ min,SOM3\to SOM4} >0} \\ {-NF_{pot\_ min,SOM3\to SOM4} {\kern 1pt} f_{denit} \qquad {\rm for\; }NF_{pot\_ min,SOM3\to SOM4} \le 0} \end{array}\right. - -.. math:: - :label: 22.8) - - NF_{denit,SOM4} =-NF_{pot\_ min,SOM4} - -where :math:`{f}_{denit} = 0.01` is the constant denitrification -fraction of gross mineralization, and the denitrification fluxes are -assumed to be leaving the soil mineral nitrogen pool -(:math:`{NS}_{sminn}`) and entering the atmosphere. The speciation -of gaseous nitrogen fluxes entering the atmosphere (e.g. -N\ :sub:`2` vs. NO\ :sub:`x` or N\ :sub:`2`\ O) is not -specified. Providing an explicit speciation of these nitrogen losses is -another high-priority area for future model development. - -The model includes one other denitrification pathway, intended to -represent the observed losses of mineral nitrogen in systems -experiencing nitrogen saturation. One reason this mechanism has been -included is in anticipation of an agricultural fertilization flux, -provided either through a prescribed dataset or through a prognostic -agricultural management routine. The model does not currently include an -explicit representation of the fertilization flux, but when it is -introduced, it will be necessary to account for the substantial -denitrification losses associated with high nitrate concentrations in -some heavily fertilized agricultural soils. Nitrogen saturation can also -occur in natural vegetation systems, especially under conditions of high -atmospheric nitrogen deposition, and so this mechanism plays a useful -role even prior to the introduction within the model of agricultural -fertilization. - -For the purpose of this calculation, nitrogen saturation is evaluated on -each timestep, by comparing the total demand for new mineral nitrogen -from plants and immobilization with the available soil mineral nitrogen -pool. The denitrification of excess soil mineral nitrogen is non-zero -whenever the supply of mineral nitrogen exceeds the demand: - -.. math:: - :label: 22.9) - - NF_{sminn,denit} =\left\{\begin{array}{l} {\left(\frac{NS_{sminn} }{\Delta t} \right)-NF_{total\_ demand} f_{dnx} \qquad {\rm for\; }NF_{total\_ demand} \Delta t`). CLM includes a detailed representation of nitrification and -denitrification based on the Century N model (Parton et al. 1996, 2001; -del Grosso et al. 2000). In this approach, nitrification of -NH\ :sub:`4`\ :sup:`+` to NO\ :sub:`3`\ :sup:`-`` +denitrification based on the Century N model (:ref:`Parton +et al. 1996 `, :ref:`2001 `; +:ref:`del Grosso et al. 2000 `). In this +approach, nitrification of NH\ :sub:`4`\ :sup:`+` to NO\ :sub:`3`\ :sup:`-` is a function of temperature, moisture, and pH: .. math:: - :label: 22.11) + :label: 22.2) f_{nitr,p} =\left[NH_{4} \right]k_{nitr} f\left(T\right)f\left(H_{2} O\right)f\left(pH\right) where :math:`{f}_{nitr,p}` is the potential nitrification rate (prior to competition for NH\ :sub:`4`\ :sup:`+` by plant uptake and N immobilization), :math:`{k}_{nitr}` is the maximum -nitrification rate (10 % day\ :math:`\mathrm{-}`\ 1, (Parton et al. -2001)), and *f(T)* and *f(H\)*\ :sub:`2`\ O) are rate modifiers for -temperature and moisture content. CLM uses the same rate modifiers as -are used in the decomposition routine. *f(pH)* is a rate modifier for -pH; however, because CLM does not calculate pH, instead a fixed pH value -of 6.5 is used in the pH function of Parton et al. (1996). +nitrification rate (10 % day\ :math:`\mathrm{-}`\ 1, +(:ref:`Parton et al. 2001 `), and *f(T)* and +*f(H\)*\ :sub:`2`\ O) are rate modifiers for temperature and +moisture content. CLM uses the same rate modifiers as +are used in the decomposition routine. *f(pH)* is a rate +modifier for pH; however, because CLM does not calculate pH, +instead a fixed pH value of 6.5 is used in the pH function of +:ref:`Parton et al. (1996) `. The potential denitrification rate is co-limited by NO\ :sup:`-3` concentration and C consumption rates, and occurs only in the anoxic fraction of soils: .. math:: - :label: 22.12) + :label: 22.3) f_{denitr,p} =\min \left(f(decomp),f\left(\left[NO_{3} ^{-} \right]\right)\right)frac_{anox} where :math:`{f}_{denitr,p}` is the potential denitrification rate and *f(decomp)* and *f([NO*\ :sub:`3`\ :sup:`-` *])* are the carbon- and nitrate- limited denitrification rate functions, -respectively, (del Grosso et al. 2000). Because the modified CLM -includes explicit treatment of soil biogeochemical vertical profiles, -including diffusion of the trace gases O\ :sub:`2` and -CH\ :sub:`4` (Riley et al. 2011a), the calculation of anoxic -fraction :math:`{frac}_{anox}` uses this information following the -anoxic microsite formulation of Arah and Vinten (1995): +respectively, (:ref:`del Grosso et al. 2000 `). +Because the modified CLM includes explicit treatment of soil +biogeochemical vertical profiles, including diffusion of the trace +gases O\ :sub:`2` and CH\ :sub:`4` (:ref:`Riley et al. 2011a +`), the calculation of anoxic fraction :math:`{frac}_{anox}` +uses this information following the anoxic microsite formulation +of :ref:`Arah and Vinten (1995) `. .. math:: - :label: 22.13) + :label: 22.4) frac_{anox} =\exp \left(-aR_{\psi }^{-\alpha } V^{-\beta } C^{\gamma } \left[\theta +\chi \varepsilon \right]^{\delta } \right) @@ -283,20 +205,21 @@ radius of a typical pore space at moisture content :math:`\psi`, *V* is the O\ :sub:`2` consumption rate, *C* is the O\ :sub:`2` concentration, :math:`\theta` is the water-filled pore space, :math:`\chi` is the ratio of diffusivity of oxygen in water to that in -air, and :math:`\epsilon` is the air-filled pore space (Arah and -Vinten, 1995). These parameters are all calculated separately at each +air, and :math:`\epsilon` is the air-filled pore space (:ref:`Arah and +Vinten (1995) `). These parameters are all calculated +separately at each layer to define a profile of anoxic porespace fraction in the soil. The nitrification/denitrification models used here also predict fluxes -of N\ :sub:`2`\ O via a “hole-in-the-pipe” approach (Firestone and -Davidson, 1989). A constant fraction (6 \* 10\ :math:`{}^{-4}`, Li et -al. 2000) of the nitrification flux is assumed to be -N\ :sub:`2`\ O, while the fraction of denitrification going to -N\ :sub:`2`\ O, P\ :math:`{P}_{N2:N2O}`, is variable, following -the Century (del Grosso et al. 2000) approach: +of N\ :sub:`2`\ O via a “hole-in-the-pipe” approach (:ref:`Firestone and +Davidson, 1989 `). A constant fraction +(6 \* 10\ :math:`{}^{-4}`, :ref:`Li et al. 2000 `) of the +nitrification flux is assumed to be N\ :sub:`2`\ O, while the fraction +of denitrification going to N\ :sub:`2`\ O, \ :math:`{P}_{N2:N2O}`, is variable, following +the Century (:ref:`del Grosso et al. 2000 `) approach: .. math:: - :label: 22.14) + :label: 22.5) P_{N_{2} :N_{2} O} =\max \left(0.16k_{1} ,k_{1} \exp \left(-0.8P_{NO_{3} :CO_{2} } \right)\right)f_{WFPS} @@ -307,7 +230,7 @@ a function of :math:`{d}_{g}`, the gas diffusivity through the soil matrix: .. math:: - :label: 22.15) + :label: 22.6) k_{1} =\max \left(1.7,38.4-350*d_{g} \right) @@ -329,7 +252,7 @@ depends on the concentration of dissolved mineral (inorganic) nitrogen in soil water solution (*DIN*, gN kgH\ :sub:`2`\ O), and the rate of hydrologic discharge from the soil column to streamflow (:math:`{Q}_{dis}`, kgH\ :sub:`2`\ O m\ :sup:`-2` -s\ :sup:`-1`, section 7.6), as +s\ :sup:`-1`, section :numref:`Lateral Sub-surface Runoff`), as .. math:: :label: 22.17) @@ -338,11 +261,8 @@ s\ :sup:`-1`, section 7.6), as *DIN* is calculated assuming that a constant fraction (*sf*, proportion) of the remaining soil mineral N pool is in soluble form, and that this -entire fraction is dissolved in the total soil water. For the CLM-CN -soil model, it is further assumed that *sf* = 0.1, representing an -estimated 10% of the total :math:`{NS}_{sminn}` pool as soluble -nitrate, with the remaining 90% as less soluble ammonia; for the -Century-based formulation, the leaching acts only on the +entire fraction is dissolved in the total soil water. For the Century- +based formulation in CLM5.0, the leaching acts only on the NO\ :sub:`3`\ :sup:`-`` pool (which is assumed to be 100% soluble), while the NH\ :sub:`4`\ :sup:`+` pool is assumed to be 100% adsorbed onto mineral surfaces and unaffected by leaching. @@ -362,25 +282,18 @@ each time step to not exceed the soluble fraction of :math:`{NS}_{sminn}` NF_{leached} =\min \left(NF_{leached} ,\frac{NS_{sminn} sf}{\Delta t} \right). -The CLM-CN parameterization of the soluble fraction is poorly -constrained by observations. Fraction of total soil mineral N pool -present as nitrate will vary spatially and temporally, depending on -oxygen status of soils and rates of nitrification. A calibration of this -parameterization against observations of dissolved nitrate in headwater -streams might be an effective method for imposing better observational -constraints at broad spatial scales. - Losses of Nitrogen Due to Fire ----------------------------------- The final pathway for nitrogen loss is through combustion, also known as pyrodenitrification. Detailed equations are provided, together with the -effects of fire on the carbon budget, in Chapter 18. It is assumed in +effects of fire on the carbon budget, in Chapter :numref:`rst_Fire`). It is assumed in CLM-CN that losses of N due to fire are restricted to vegetation and litter pools (including coarse woody debris). Loss rates of N are determined by the fraction of biomass lost to combustion, assuming that most of the nitrogen in the burned biomass is lost to the atmosphere -(Schlesinger, 1997; Smith et al. 2005). It is assumed that soil organic +(:ref:`Schlesinger, 1997 `; :ref:`Smith et al. 2005 +`). It is assumed that soil organic matter pools of carbon and nitrogen are not directly affected by fire -(Neff et al. 2005). +(:ref:`Neff et al. 2005 `). diff --git a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst index c2a665d8ac..920bc2c1ba 100644 --- a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst +++ b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst @@ -145,15 +145,23 @@ follows: \begin{array}{l} {a_{1} ={\rm \; ratio\; of\; new\; fine\; root\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{2} ={\rm \; ratio\; of\; new\; coarse\; root\; :\; new\; stem\; carbon\; allocation}} \\ {a_{3} ={\rm \; ratio\; of\; new\; stem\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{4} ={\rm \; ratio\; new\; live\; wood\; :\; new\; total\; wood\; allocation}} \\ {g_{1} ={\rm ratio\; of\; growth\; respiration\; carbon\; :\; new\; growth\; carbon.\; }} \end{array} -Parameters :math:`a_{1}`, :math:`a_{2}`, and :math:`a_{4}` are defined as constants for a given PFT (Table -13.1), while :math:`g_{l }` = 0.3 (unitless) is prescribed as a +Parameters :math:`a_{1}`, :math:`a_{2}`, and :math:`a_{4}` are defined +as constants for a given PFT (:numref:`Table Allocation and carbon:nitrogen +ratio parameters`), while :math:`g_{l }` = 0.3 (unitless) is prescribed as a constant for all PFTs, based on construction costs for a range of woody -and non-woody tissues (Larcher, 1995). +and non-woody tissues (:ref:`Larcher, 1995 `). -The model includes a dynamic allocation scheme for woody vegetation -(parameter :math:`a_{3}` = -1, Table 13.1), in which case the -ratio for carbon allocation between new stem and new leaf increases with -increasing net primary production (NPP), as +CLM5.0 applies a fixed allocation scheme for woody vegetation. +The decision to use the fixed allocation scheme in CLM5.0 came +from biases in above-ground biomass illustrated by Negrón-Juárez +et al. (:ref:`2015 `). + +The model maintains the capacity to represent a dynamic allocation scheme +for woody vegetation (parameter :math:`a_{3}` = -1, :numref:`Table Allocation +and carbon:nitrogen ratio parameters`), but this is not the default +configuration. With dynamic allocation the ratio for carbon allocation +between new stem and new leaf increases with increasing net primary +production (NPP), as .. math:: :label: 17.8) @@ -162,63 +170,33 @@ increasing net primary production (NPP), as where :math:`NPP_{ann}` is the annual sum of NPP from the previous year. This mechanism has the effect of increasing woody allocation in -favorable growth environments (Allen et al., 2005; Vanninen and Makela, -2005) and during the phase of stand growth prior to canopy closure -(Axelsson and Axelsson, 1986). - -Table 13.1. Allocation and carbon:nitrogen ratio parameters - -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`CN_{leaf}` | :math:`CN_{fr}` | :math:`CN_{lw}` | :math:`CN_{dw}` | -+==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ -| NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| NET Boreal | 1 | 0.3 | -1 | 0.1 | 40 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| NDT Boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BET Tropical | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BET temperate | 1 | 0.3 | -1 | 0.1 | 30 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDT tropical | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDT temperate | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDT boreal | 1 | 0.3 | -1 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BES temperate | 1 | 0.3 | 0.2 | 0.5 | 30 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDS temperate | 1 | 0.3 | 0.2 | 0.5 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| BDS boreal | 1 | 0.3 | 0.2 | 0.1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :sub:`3` arctic grass | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :sub:`3` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| C\ :sub:`4` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Crop R | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Crop I | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Corn R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Corn I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Temp Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Temp Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Winter Cereal R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Winter Cereal I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Soybean R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ -| Soybean I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | -+----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ +favorable growth environments (:ref:`Allen et al., 2005 `; +:ref:`Vanninen and Makela, 2005 `) and during +the phase of stand growth prior to canopy closure (:ref:`Axelsson and +Axelsson, 1986 `). + +.. _Table Allocation and carbon:nitrogen ratio parameters: + +.. table:: Allocation and carbon:nitrogen ratio parameters. + + ======================== ============= ============= ============= ============= ================= =============== =============== =============== + Plant functional type :math:`a_{1}` :math:`a_{2}` :math:`a_{3}` :math:`a_{4}` :math:`CN_{leaf}` :math:`CN_{fr}` :math:`CN_{lw}` :math:`CN_{dw}` + ======================== ============= ============= ============= ============= ================= =============== =============== =============== + NET Temperate 1.5 0.3 2.30 0.1 58.00 42 50 500 + NET Boreal 1.5 0.3 2.30 0.1 58.00 42 50 500 + NDT Boreal 1.5 0.3 1.00 0.1 25.81 42 50 500 + BET Tropical 1.5 0.3 2.30 0.1 29.60 42 50 500 + BET temperate 1.5 0.3 1.50 0.1 29.60 42 50 500 + BDT tropical 1.5 0.3 1.00 0.1 23.45 42 50 500 + BDT temperate 1.5 0.3 2.30 0.1 23.45 42 50 500 + BDT boreal 1.5 0.3 2.30 0.1 23.45 42 50 500 + BES temperate 1.5 0.3 1.40 0.5 36.42 42 50 500 + BDS temperate 1.5 0.3 0.24 0.5 23.26 42 50 500 + BDS boreal 1.5 0.3 0.24 0.1 23.26 42 50 500 + C\ :sub:`3` arctic grass 1.5 0.0 0.00 0.0 28.03 42 0 0 + C\ :sub:`3` grass 1.5 0.0 0.00 0.0 28.03 42 0 0 + C\ :sub:`4` grass 1.5 0.0 0.00 0.0 35.36 42 0 0 + ======================== ============= ============= ============= ============= ================= =============== =============== =============== Carbon to nitrogen ratios are defined for different tissue types as follows: @@ -226,10 +204,10 @@ follows: .. math:: :label: ZEqnNum413927 - \begin{array}{l} {CN_{leaf} =\_ {\rm \; C:N\; for\; leaf}} \\ {CN_{fr} =\_ {\rm \; C:N\; for\; fine\; root}} \\ {CN_{lw} =\_ {\rm \; C:N\; for\; live\; wood\; (in\; stem\; and\; coarse\; root)}} \\ {CN_{dw} =\_ {\rm \; C:N\; for\; dead\; wood\; (in\; stem\; and\; coarse\; root)}} \end{array} + \begin{array}{l} {CN_{leaf} =\ {\rm \;C:N\; for\; leaf}} \\ {CN_{fr} =\ {\rm \;C:N\; for\; fine\; root}} \\ {CN_{lw} =\_ {\rm \;C:N\; for\; live\; wood\; (in\; stem\; and\; coarse\; root)}} \\ {CN_{dw} =\ {\rm \;C:N\; for\; dead\; wood\; (in\; stem\; and\; coarse\; root)}} \end{array} -where all C:N parameters are defined as constants for a given PFT (Table -13.1). +where all C:N parameters are defined as constants for a given PFT +(:numref:`Table Allocation and carbon:nitrogen ratio parameters`). Given values for the parameters in and , total carbon and nitrogen allocation to new growth ( :math:`CF_{alloc}`, gC diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 048fa076c0..59fed6d91b 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1295,6 +1295,11 @@ and Water Assessment Tool, Theoretical Documentation: Version 2005. Temple, TX. USDA Agricultural Research Service and Texas A&M Blackland Research Center. +.. _Negrón-Juárezetal2015: + +Negrón-Juárez, R. Koven, C.D., Riley, W.J., Knox, R.G., Chambers, J.Q. +2015. Environmental Research Letters 10:064017. DOI:10.1088/1748-9326/10/6/064017. + .. _NemaniRunning1996: Nemani, R.R., and Running, S.W. 1996. Implementation of a hierarchical @@ -1648,7 +1653,7 @@ Strugnell, N.C., Zhang, X., Jin, Y., and Muller, J.-P. 2002. First operational BRDF, albedo nadir reflectance products from MODIS. Remote Sens. Environ. 83:135-148. -.. _Schlesinger, W.H., 1997. Biogeochemistry: an analysis of global change. +.. _Schlesinger1997: Schlesinger, W.H., 1997. Biogeochemistry: an analysis of global change. Academic Press, London, 588 pp. @@ -1884,6 +1889,10 @@ Taylor, B.R., Parkinson, D. and Parsons, W.F.J., 1989. Nitrogen and lignin content as predictors of litter decay rates: A microcosm test. Ecology, 70: 97-104. +.. _Thomasetal2015: + +Thomas R.Q., Brookshire E.N., Gerber S. 2015. Nitrogen limitation on land: how can it occur in Earth system models? Global Change Biology, 21, 1777-1793, doi:10.1111/gcb.12813. + .. _Thonickeetal2001: Thonicke, K., Venevsky, S., Sitch, S., and Cramer, W. 2001. The role of @@ -2012,7 +2021,7 @@ drivers of global environmental change: enabling use of global SRES scenarios at the national and grid levels, Report 550025001, Netherlands Environmental Assessment Agency, 45 pp. -.. _Vanninen, P., and Makela, A. 2005. Carbon budget for Scots pine trees: +.. _VanninenMakela2005: Vanninen, P., and Makela, A. 2005. Carbon budget for Scots pine trees: effects of size, competition and site fertility on growth allocation and @@ -2077,6 +2086,13 @@ Parameterization and sensitivity analysis of the Biome-BGC terrestrial ecosystem model: net primary production controls. Earth Interactions 4:1-85. +.. _Wiederetal2015: + +Wieder, W. R., Cleveland, C. C., Lawrence, D. M., and Bonan, G. B. 2015. +Effects of model structural uncertainty on carbon cycle projections: +biological nitrogen fixation as a case study. Environmental Research +Letters, 10(4), 044016. + .. _Williamsetal1996: Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., From e8b89e1f6cffb3d233ba2ba56f1d89b4c1d220ff Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 17 Nov 2017 16:58:45 -0700 Subject: [PATCH 0105/1973] Update html --- .../Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst index 920bc2c1ba..1dc02dd07c 100644 --- a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst +++ b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst @@ -31,10 +31,12 @@ variables for vegetation carbon, and 19 for vegetation nitrogen. .. _Figure Carbon and nitrogen pools: -.. image:: image2.png +.. figure:: image2.png :width: 400px :height: 400px + Carbon and nitrogen pools. + Carbon Allocation for Maintenance Respiration Costs -------------------------------------------------------- From 7e52cbd33fdc937a7c4b907d7664aee43c90c6ef Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 17 Nov 2017 17:32:53 -0700 Subject: [PATCH 0106/1973] Updates to Introduction, added some refs, fixed refs in FUN chapter --- .../tech_note/FUN/CLM50_Tech_Note_FUN.rst | 14 ++++--------- .../CLM50_Tech_Note_Introduction.rst | 15 +++++++------- .../CLM50_Tech_Note_Plant_Respiration.rst | 2 +- .../References/CLM50_Tech_Note_References.rst | 20 +++++++++++++++++-- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst index c94c3556ef..e10698858b 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -7,7 +7,7 @@ Introduction ----------------- -The Fixation and Uptake of Nitrogen model is based on work by Fisher (J.) et al., (2008), Brzostek et al. (2015) and Shi et al. (2016). The concept of FUN is that in most cases, Nitrogen uptake requires the expenditure of energy in the form of carbon, and further, that there are numerous potential sources of Nitrogen in the environment which a plant may exchange for carbon. The ratio of carbon expended to Nitrogen acquired is referred to here as the cost, or exchange rate, of N acquisition (:math:`E_{nacq}`, gC/gN)). There are eight pathways for N uptake: +The Fixation and Uptake of Nitrogen model is based on work by :ref:`Fisher et al. (2010)`, :ref:`Brzostek et al. (2014)`, and :ref:`Shi et al. (2016)`. The concept of FUN is that in most cases, Nitrogen uptake requires the expenditure of energy in the form of carbon, and further, that there are numerous potential sources of Nitrogen in the environment which a plant may exchange for carbon. The ratio of carbon expended to Nitrogen acquired is referred to here as the cost, or exchange rate, of N acquisition (:math:`E_{nacq}`, gC/gN)). There are eight pathways for N uptake: 1. Fixation by symbiotic bacteria in root nodules (for N fixing plants) (:math:`_{fix}`) 2. Retranslocation of N from senescing tissues (:math:`_{ret}`) @@ -47,7 +47,7 @@ Available Soil Nitrogen Cost of Nitrogen Fixation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The cost of fixation is derived from Houlton et al. (2008). +The cost of fixation is derived from :ref:`Houlton et al. (2008)`. .. math:: N_{cost,fix} = -s_{fix}/(1.25 e^{a_{fix} + b_{fix} . t_{soil} (1 - 0.5 t_{soil}/ c_{fix}) }) @@ -89,7 +89,7 @@ where m=1 pertains to the fraction of the PFT that is ecotmycorrhizal, as oppose Resolving N cost across simultaneous uptake streams -------------------------------------------------------- -The total cost of N uptake is calculated based on the assumption that carbon is partitioned to each stream in proportion to the inverse of the cost of uptake. So, more expensive pathways receive less carbon. Earlier versions of FUN (Fisher et al. 2008) utilized a scheme whereby plants only took up N from the cheapest pathway. Brzostek et al. introduced a scheme for the simultaneous uptake from different pathways. Here we calcualate a 'conductance' to N uptake (analagous to the inverse of the cost function conceptualized as a resistance term) :math:`N_{conductance}` ( gN/gC) as: +The total cost of N uptake is calculated based on the assumption that carbon is partitioned to each stream in proportion to the inverse of the cost of uptake. So, more expensive pathways receive less carbon. Earlier versions of FUN :ref:`(Fisher et al., 2010))` utilized a scheme whereby plants only took up N from the cheapest pathway. :ref:`Brzostek et al. (2014)` introduced a scheme for the simultaneous uptake from different pathways. Here we calcualate a 'conductance' to N uptake (analagous to the inverse of the cost function conceptualized as a resistance term) :math:`N_{conductance}` ( gN/gC) as: .. math:: @@ -274,7 +274,7 @@ and the other C and N fluxes can be determined following the logic above. Modifications to allow variation in C:N ratios -------------------------------------------------------- -The original FUN model as developed by Fisher et al. (2008) and Brzostek et al. (2015) assumes a fixed plant tissue C:N ratio. This means that in the case where N is especially limiting, all excess carbon will be utilized in an attempt to take up more Nitrogen. It has been repeatedly observed, however, that in these circumstances in real life, plants have some flexibility in the C:N stoichiometry of their tissues, and therefore, this assumption may not be realistic. **lit review on CN ratios** +The original FUN model as developed by :ref:`Fisher et al. (2010)` and :ref:`Brzostek et al. (2014)` assumes a fixed plant tissue C:N ratio. This means that in the case where N is especially limiting, all excess carbon will be utilized in an attempt to take up more Nitrogen. It has been repeatedly observed, however, that in these circumstances in real life, plants have some flexibility in the C:N stoichiometry of their tissues, and therefore, this assumption may not be realistic. **lit review on CN ratios** Thus, in CLM5, we introduce the capacity for tissue C:N ratios to be prognostic, rather than static. Overall N and C availability (:math:`N_{uptake}` and :math:`C_{growth}`) and hence tissue C:N ratios, are both determined by FUN. Allocation to individual tissues is discussed in the allocation chapter @@ -407,9 +407,3 @@ kc_nonmyc (step 2) sets active components for Arbuscular fungi ACTIVE vs NONMYC ECTO vs ARBU for ACTIVE. -References --------------------------------------------------------- - -Houlton, B.Z., Wang, Y.P., Vitousek, P.M. and Field, C.B., 2008. A unifying framework for dinitrogen fixation in the terrestrial biosphere. Nature, 454(7202), p.327. - - diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 69ad12b91f..ee53f94082 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -511,7 +511,7 @@ push towards more mechanistic treatment of key processes, in addition to more co of land use and land-cover change. Prior versions of CLM included relatively few options for physics parameterizations or structure. In CLM5, where new parameterizations or model decisions were made, in most cases, the CLM4.5 parameterization was maintained so that users could switch back and forth between different parameterizations via namelist control where appropriate or desirable. Throughout the CLM5 Technical Descpription, in general only the default parameterization for any given process is described. Readers are referred to the CLM4.5 or CLM4 Technical Descriptions for detailed descriptions of non-default parameterizations. -The hydrology updates include the introduction of a dry surface layer-based soil evaporation resistance parameterization :ref:`(Swenson and Lawrence, 2014)` and a revised canopy interception parameterization. Canopy interception is now divided into liquid and solid phases, with the intercepted snow subject to unloading events due to wind or above-freezing temperatures. The snow-covered fraction of the canopy is used within the canopy radiation and surface albedo calculation. Instead of applying a spatially uniform soil thickness, soil thickness can vary in space :ref:`(Brunke et al. 2016` and :ref:`Swenson and Lawrence, 2015)` and is set to values within a range of 0.4m to 8.5m depth, derived from a spatially explicit soil thickness data product :ref:`(Pelletier et al., 2016)`. The explicit treatment of soil thickness allows for the deprecation of the unconfined aquifer parameterization used in CLM4.5, which is replaced with a zero flux boundary condition and explicit modeling of both the saturated and unsaturated zones. The default model soil layer resolution is increased, especially within the top 3m, to more explicitly represent active layer thickness within the permafrost zone. Roots are deepened for the broadleaf evergreen tropical tree and broadleaf deciduous tropical tree types. Finally, an adaptive time-stepping solution to the Richard's equation is introduced, which improves the accuracy and stability of the numerical soil water solution. The River Transport Model (RTM) is replaced with the Model for Scale Adaptive River Transport (MOSART, :ref:`Li et al., 2013b)` in which surface runoff is routed across hillslopes and then discharged along with subsurface runoff into a tributary subnetwork before entering the main channel. +The hydrology updates include the introduction of a dry surface layer-based soil evaporation resistance parameterization :ref:`(Swenson and Lawrence, 2014)` and a revised canopy interception parameterization. Canopy interception is now divided into liquid and solid phases, with the intercepted snow subject to unloading events due to wind or above-freezing temperatures. The snow-covered fraction of the canopy is used within the canopy radiation and surface albedo calculation. Instead of applying a spatially uniform soil thickness, soil thickness can vary in space :ref:`(Brunke et al. 2016` and :ref:`Swenson and Lawrence, 2015)` and is set to values within a range of 0.4m to 8.5m depth, derived from a spatially explicit soil thickness data product :ref:`(Pelletier et al., 2016)`. The explicit treatment of soil thickness allows for the deprecation of the unconfined aquifer parameterization used in CLM4.5, which is replaced with a zero flux boundary condition and explicit modeling of both the saturated and unsaturated zones. The default model soil layer resolution is increased, especially within the top 3m, to more explicitly represent active layer thickness within the permafrost zone. Rooting profiles were used inconsistently in CLM4.5 with :ref:`Zeng (2001)` profiles used for water and :ref: `Jackson et al. (1996)` profiles used for carbon inputs. For CLM5, the Jackson et al. (1996) rooting profiles are used for both water and carbon. Roots are deepened for the broadleaf evergreen tropical tree and broadleaf deciduous tropical tree types. Finally, an adaptive time-stepping solution to the Richard's equation is introduced, which improves the accuracy and stability of the numerical soil water solution. The River Transport Model (RTM) is replaced with the Model for Scale Adaptive River Transport (MOSART, :ref:`Li et al., 2013b)` in which surface runoff is routed across hillslopes and then discharged along with subsurface runoff into a tributary subnetwork before entering the main channel. Several changes are included that are mainly targeted at improving the simulation of surface mass balance over ice sheets. The fresh snow density parameterization is updated to more realistically capture the temperature effects and to additionally account for wind effects on new snow density :ref:`(van Kampenhout et al., 2017)`. The maximum number of snow layers and snow amount is increased from 5 layers and 1m snow water equivalent to 12 layers and 10m snow water equivalent to allow for the formation of firn in regions of persistent snow-cover (e.g., glaciers and ice sheets) :ref:`(van Kampenhout et al., 2017)`. The CISM2 ice sheet model is active for Greenland by default with one-way coupling (surface mass balance impacts ice sheet dynamics, but ice sheet dynamics do not feedback onto surface elevation). Two-way coupling can be activated through a namelist switch. The introduction in CLM5 of the capability to @@ -520,16 +520,17 @@ a simulation when two-way coupling is active. Multiple elevation classes (10 el A plant hydraulic stress routine is introduced which explicitly models water transport through the vegetation according to a simple hydraulic framework (Kennedy et al., to be submitted). The water supply equations are used to solve for vegetation water potential forced by transpiration demand and a set of layer-by-layer soil water potentials. Stomatal conductance, therefore, is a function of prognostic leaf water potential. Water stress is calculated as the ratio of attenuated stomatal conductance to maximum stomatal conductance. An emergent feature of the plant hydraulics is soil hydraulic redistribution. In CLM5, maximum stomatal conductance is obtained from the Medlyn conductance model :ref:`(Medlyn et al., 2011)`, rather than the Ball-Berry stomatal conductance model that was utilized in CLM4.5 and prior versions of the model. The Medlyn stomatal conductance model is preferred mainly for it's more realistic behavior at low humidity levels :ref:`(Rogers et al., 2017)`. The stress deciduous vegetation phenology trigger is augmented with a antecedent precipitation requirement :ref:`(Dahlin et al. 2015)`. -Plant nutrient dynamics are substantially updated to resolve several deficiencies with the CLM4 and CLM4.5 nutrient cycling representation. The Fixation and Update of Nitrogen (FUN) model (refs???) is adapted for CLM :ref:`(Shi et al., 2016)` to resolve the -unrealistic feature that plants get nitrogen for free in CLM4 and CLM4.5. With FUN, the fact that plants typically spend a -significant fraction of their available carbon on nutrient aquisition is acounted for. The static plant carbon:nitrogen (C:N) ratios utilized in CLM4 and CLM4.5 are replaced with variable plant C:N ratios which +Plant nutrient dynamics are substantially updated to resolve several deficiencies with the CLM4 and CLM4.5 nutrient cycling representation. The Fixation and Update of Nitrogen (FUN) model based on the work of :ref:`Fisher et al. (2010)`, :ref:`Brzostek et al. (2014)`, and :ref:`Shi et al. (2016)` is incorporated. The concept of FUN is that in most cases, N uptake requires the expenditure of energy in the form of carbon, and further, that there are numerous potential sources of N in the environment which a plant may exchange for carbon. The ratio of carbon expended to N acquired is therefore the cost, or exchange rate, of N acquisition. FUN calculates the rate of symbiotic N fixation, with this N passed straight to the plant, not the mineral N pool. Separately, CLM5 also calculates rates of symbiotic (or free living) N fixation as a function of evapotranspiration (:ref:`Cleveland et al. 1999 `), which +is added to the soil inorganic ammonium (NH\ :sub:`4`\ :sup:`+`) pool. The static plant carbon:nitrogen (C:N) ratios utilized in CLM4 and CLM4.5 are replaced with variable plant C:N ratios which allows plants to adjust their C:N ratio, and therefore their leaf nitrogen content, with the cost of N uptake :ref:`(Ghimire et al. 2016)`. The implementation of a flexible C:N ratio means that the model no longer relies on instantaneous downregulation of potential photosynthesis rates based on soil mineral nitrogen availability to represent nutrient limitation. Furthermore, stomatal conductance is now based on the N-limited photosynthesis rather than on potential photosynthesis. Finally, the Leaf Use of -Nitrogen for Assimilation (LUNA, :ref:`(Xu et al., 2012` and :ref:`Ali et al., 2016)` model is incorporated. The LUNA model calculates +Nitrogen for Assimilation (LUNA, :ref:`Xu et al., 2012` and :ref:`Ali et al., 2016)` model is incorporated. The LUNA model calculates photosynthetic capacity based on optimization of the use of leaf nitrogen under different environmental conditions such that -light capture, carboxylation, and respiration are co-limiting. Allocation changes ... Fixation ??? +light capture, carboxylation, and respiration are co-limiting. + +CLM5 applies a fixed allocation scheme for woody vegetation. The decision to use a fixed allocation scheme in CLM5, rather than a dynamic allocation scheme based on NPP as was used in CLM4 and CLM4.5, was driven by the fact that observations indicate that biomass saturates with increasing productivity, in contrast to the behavior in CLM4 and CLM4.5 where biomass continuously increases with increasing productivity (:ref:`Negron-Juarez et al., 2015`). Soil carbon decomposition processes are unchanged in CLM5, but a new metric for apparent soil carbon turnover times (:ref:`Koven et al., 2017 `) suggested parameter changes that produce a weak intrinsic depth limitation on soil carbon turnover rates (rather than the strong depth limitaiton in CLM4.5) and that the thresholds for soil moisture limitation on soil carbon turnover rates in dry soils should be set at a wetter soil moisture level than that used in CLM4.5. Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016)`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. Fertilization rates and irrigation equipped area updated annually based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that @@ -545,7 +546,7 @@ Included with the release of CLM5.0 is a functionally supported version of the F During the course of the development of CLM5.0, it became clear that the increasing complexity of the model combined with the increasing number and range of model development projects required updates to the underlying CLM infrastructure. Many such software improvements -are included in CLM5.0 including a partial transition to an object-oriented modular software structure. Many hard coded model +are included in CLM5 including a partial transition to an object-oriented modular software structure. Many hard coded model parameters have been extracted into either the parameter file or the CLM namelist, which allows users to more readily calibrate the model for use at specific locations or to conduct parameter sensitivity studies. As part of the effort to increase the scientific utility of the code, in most instances older generation parameterizations (i.e., the parameterizations diff --git a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst index 1dc02dd07c..c4fae1d7d9 100644 --- a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst +++ b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst @@ -156,7 +156,7 @@ and non-woody tissues (:ref:`Larcher, 1995 `). CLM5.0 applies a fixed allocation scheme for woody vegetation. The decision to use the fixed allocation scheme in CLM5.0 came from biases in above-ground biomass illustrated by Negrón-Juárez -et al. (:ref:`2015 `). +et al. (:ref:`2015 `). The model maintains the capacity to represent a dynamic allocation scheme for woody vegetation (parameter :math:`a_{3}` = -1, :numref:`Table Allocation diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 59fed6d91b..e613dce3b4 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -217,6 +217,10 @@ liquid water content. Ann. Glaciol. 13:22-26. Brunke, M. A., P. Broxton, J. Pelletier, D. Gochis, P. Hazenberg, D. M. Lawrence, L. R. Leung, G.-Y. Niu, P. A. Troch, and X. Zeng, 2016: Implementing and Evaluating Variable Soil Thickness in the Community Land Model, Version 4.5 (CLM4.5). J. Clim. 29:3441-3461. +.. _Brzosteketal2014: + +Brzostek, E. R., J. B. Fisher, and R. P. Phillips, 2014. Modeling the carbon cost of plant nitrogen acquisition: Mycorrhizal trade-offs and multipath resistance uptake improve predictions of retranslocation. J. Geophys. Res. Biogeosci., 119, 1684–1697, doi:10.1002/2014JG002660. + .. _BugmannSolomon2000: Bugmann, H., and Solomon, A.M. 2000. Explaining forest composition and @@ -487,6 +491,10 @@ Schimel (Editors). John Wiley and Sons, pp. 7-21. Fisher, R. A., S. Muszala, M. Verteinstein, P. Lawrence, C. Xu, N. G. McDowell, R. G. Knox, C. Koven, J. Holm, B. M. Rogers, A. Spessa, D. Lawrence, and G. Bonan, 2015: Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes, CLM4.5(ED). Geosci. Model Dev., 8: 3593-3619, doi:10.5194/gmd-8-3593-2015. +.. _Fisheretal2010: + +Fisher, J. B., S. Sitch, Y. Malhi, R. A. Fisher, C. Huntingford, and S.-Y. Tan, 2010. Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation. Global Biogeochem. Cycles, 24, GB1014, doi:10.1029/2009GB003621. + .. _FlannerZender2005: Flanner, M.G., and Zender. C.S. 2005. Snowpack radiative heating: @@ -733,6 +741,10 @@ Sensitivity of surface flux simulations to hydrologic parameters based on an uncertainty quantification framework applied to the Community Land Model. J. Geophys. Res. 117:D15108. +.. _Houltonetal2008: + +Houlton, B.Z., Wang, Y.P., Vitousek, P.M. and Field, C.B., 2008. A unifying framework for dinitrogen fixation in the terrestrial biosphere. Nature, 454(7202), p.327. + .. _HuangLiang2006: Huang, M., and Liang, X. 2006. On the assessment of the impact of @@ -906,6 +918,10 @@ sensitive to deep soil carbon decomposability but not deep soil nitrogen dynamics. Proceedings of the National Academies of Science, 112, 12, 3752-3757, doi:10.1073/pnas.1415123112 +.. _Kovenetal2017: + +Koven, C.D., G. Hugelius, D.M. Lawrence, and W.R. Wieder, 2017: Higher climatological temperature sensitivity of soil carbon in cold than warm climates. Nature Clim. Change, 7, doi:10.1038/nclimate3421. + .. _Kuchariketal2000: Kucharik, C.J., Foley, J.A., Delire, C., Fisher, V.A., Coe, M.T., @@ -1295,9 +1311,9 @@ and Water Assessment Tool, Theoretical Documentation: Version 2005. Temple, TX. USDA Agricultural Research Service and Texas A&M Blackland Research Center. -.. _Negrón-Juárezetal2015: +.. _NegronJuarezetal2015: -Negrón-Juárez, R. Koven, C.D., Riley, W.J., Knox, R.G., Chambers, J.Q. +Negron-Juarez, R. Koven, C.D., Riley, W.J., Knox, R.G., Chambers, J.Q. 2015. Environmental Research Letters 10:064017. DOI:10.1088/1748-9326/10/6/064017. .. _NemaniRunning1996: From 88a17841ea4bce158a4060e1f8c9178f4478c295 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Mon, 20 Nov 2017 05:07:49 -0700 Subject: [PATCH 0107/1973] Removed allocation from respiration chapter. Moved image to CNPools --- .../CLM50_Tech_Note_Plant_Respiration.rst | 58 +------------------ 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst index c4fae1d7d9..7fac43551c 100644 --- a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst +++ b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst @@ -3,63 +3,11 @@ Plant Respiration ================= -Introduction ------------------ - -CLM includes a fully-prognostic treatment of the terrestrial carbon and -nitrogen cycles including interactions between these cycles as mediated -by biological mechanisms of plants and soil heterotrophs. The model is -fully prognostic with respect to all carbon and nitrogen state variables -in the vegetation, litter, and soil organic matter. The seasonal timing -of new vegetation growth and litterfall is also prognostic, responding -to soil and air temperature, soil water availability, and daylength, in -varying degrees depending on a specified phenology type for each PFT -(see Chapter 14). The prognostic LAI, SAI, and vegetation heights are -utilized by the biophysical model. - -Separate state variables for C and N are tracked for leaf, live stem, -dead stem, live coarse root, dead coarse root, and fine root pools -(Figure 13.1 and 13.2). Each of these pools has two corresponding -storage pools representing, respectively, short-term and long-term -storage of non-structural carbohydrates and labile nitrogen. There are -two additional carbon pools, one for the storage of growth respiration -reserves, and another used to meet excess demand for maintenance -respiration during periods with low photosynthesis. One additional -nitrogen pool tracks retranslocated nitrogen, mobilized from leaf tissue -prior to abscission and litterfall. Altogether there are 20 state -variables for vegetation carbon, and 19 for vegetation nitrogen. - -.. _Figure Carbon and nitrogen pools: - -.. figure:: image2.png - :width: 400px - :height: 400px - - Carbon and nitrogen pools. - -Carbon Allocation for Maintenance Respiration Costs + +Carbon Expenditure on Plant Maintenance Respiration -------------------------------------------------------- -The carbon and nitrogen allocation routines in CLM determine the fate of -newly assimilated carbon, coming from the calculation of photosynthesis, -and available mineral nitrogen, coming from plant uptake of mineral -nitrogen in the soil or being drawn out of plant reserves. Allocation -fluxes are determined in three steps: first :math:`CF_{GPPpot}` is -used to evaluate the potential allocation of carbon and nitrogen -assuming an unlimited nitrogen supply, then the actual nitrogen supply -is compared against the demand, and finally allocation of carbon and -nitrogen are reduced, if necessary, to match nitrogen supply and demand. - -Allocation of available carbon on each time step is prioritized, with -first priority given to the demand for carbon to support maintenance -respiration of live tissues (section 13.7). Second priority is to -replenish the internal plant carbon pool that supports maintenance -respiration during times when maintenance respiration exceeds -photosynthesis (e.g. at night, during winter for perennial vegetation, -or during periods of drought stress) (Sprugel et al., 1995). Third -priority is to support growth of new tissues, including allocation to -storage pools from which new growth will be displayed in subsequent time -steps. +After the assimilation of photsynthetic carbon, the first expenditure is on plant maintenance respiration (Chapter :numref:`rst_CN Allocation`) The total maintenance respiration demand (:math:`CF_{mr}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as a function of From f6b0c59a61d319c1237d4ec3bd9968c6ede99808 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Mon, 20 Nov 2017 15:42:02 -0700 Subject: [PATCH 0108/1973] Modified CN_Allocation to explain FUN interactions --- .../CLM50_Tech_Note_CN_Allocation.rst | 63 ++++++------------- 1 file changed, 19 insertions(+), 44 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 37d3f0a10f..3edb8fb857 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -7,32 +7,22 @@ Summary of CLM5.0 updates relative to the CLM4.5 ----------------------------------------------------- - CLM5 now defaults to a static allocation to woody biomass rather than the dynamic allocation term used in CLM4.5. The dynamic allocation is stil lkept as an option, for details, see the CLM4.5 Tech Note. - - CLM5 now includes flexible C:N ratios of all plant tissues, which allows allocation of carbon to occur separately from allocation of nitrogen, thus removing the requirement to downregulate photosynthesis based on the instantaneous stoichiometric needs of allocation. +- CLM5 now includes flexible C:N ratios of all plant tissues, which allows allocation of carbon to occur separately from allocation of nitrogen, thus removing the requirement to downregulate photosynthesis based on the instantaneous stoichiometric needs of allocation. + +- CLM5 accounts for the carbon expenditure on nitrogen aquisition, as determined by the FUN model, and the N uptake it determined by the environmental cost of Nitrogen from fixation, active uptake and retranslocation. Introduction ----------------- +The carbon and nitrogen allocation routines in CLM determine the fate of newly assimilated carbon, and absorbed nitrogen. The environmental cost of nitrogen estimated by the FUN model modulates the C:N ratios of the plant tissue pools around a target ratio, and absorbed nitrogen is allocated in proportion to the demand, as estimated by the ideal requirements of these target C:N ratios. -The carbon and nitrogen allocation routines in CLM determine the fate of -newly assimilated carbon, coming from the calculation of photosynthesis, -and available mineral nitrogen, coming from plant uptake of mineral -nitrogen in the soil or being drawn out of plant reserves. A significant change to CLM5 relative to prior versions is that allocation of carbon and nitrogen proceed independently rather than in a sequential manner. -Carbon Allocation to Cover Prior-Timestep Maintenance Respiration Costs +Carbon Allocation to Cover Prior-Timestep Maintenance Respiration Costs ("Excess" Respiration) ---------------------------------------------------------------------------- -Allocation of available carbon on each time step is prioritized, with -first priority given to the demand for carbon to support maintenance -respiration of live tissues (Chapter :numref:`rst_Plant Respiration`) and Nitrogen acquisition costs (Chapter :numref:`rst_FUN`). Second priority is to -replenish the plant carbon deficit pool that balances maintenance -respiration that occurs during times when maintenance respiration exceeds -photosynthesis (e.g. at night, during winter for perennial vegetation, -or during periods of drought stress) (Sprugel et al., 1995). Third -priority is to support growth of new tissues, including allocation to -storage pools from which new growth will be displayed in subsequent time -steps, as well as growth respiration costs. +After respiration of live tissues (Chapter :numref:`rst_Plant Respiration`), the next priority of the carbon allocation cascade is to replenish the plant carbon deficit pool that balances maintenance respiration that occurs during times when maintenance respiration exceeds photosynthesis (e.g. at night, during winter for perennial vegetation, or during periods of drought stress) (Sprugel et al., 1995). The total maintenance respiration demand (:math:`CF_{mr}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as a function of @@ -99,16 +89,19 @@ Carbon and Nitrogen Stoichiometry of New Growth ---------------------------------------------------- After accounting for the carbon cost of maintenance respiration, the -remaining carbon flux from photosynthesis which can be allocated to new -growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is +remaining carbon flux from photosynthesis which is allocated either to new +growth or to nitrogen acquisition processes (Chapter :numref:`rst_FUN`), (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 19.6 CF_{avail\_ alloc} =CF_{GPP} -CF_{GPP,mr} -CF_{GPP,xs} . -Potential allocation to new growth is calculated for all of the plant -carbon and nitrogen state variables based on specified C:N ratios for + +The FUN model requires an estimate of the C:N requirements of the existing plant structure, given that different relative quantities of wood, root and leaf biomass will result in different necessary C:N ratios for expansion. + +These C and N allocation ratios are calculated for all of the plant +carbon and nitrogen state variables based on target C:N ratios for each tissue type and allometric parameters that relate allocation between various tissue types. The allometric parameters are defined as follows: @@ -191,17 +184,14 @@ follows: where all C:N parameters are defined as constants for a given PFT (:numref:`Table Allocation and CN ratio parameters`). -Given values for the parameters in and , total carbon and nitrogen -allocation to new growth ( :math:`CF_{alloc}`, gC -m\ :sup:`-2` s\ :sup:`-1`, and :math:`NF_{alloc}`, gN -m\ :sup:`-2` s\ :sup:`-1`, respectively) can be expressed as -functions of new leaf carbon allocation (:math:`CF_{GPP,leaf}`, gC -m\ :sup:`-2` s\ :sup:`-1`): + +The target C:N stoichiometry for new growth allocation can be calculated as .. math:: - :label: 19.10 + :label: 19.13 + + CN_{plant\_ target} =\frac{N_{allom} }{C_{allom} } . - \begin{array}{l} {CF_{alloc} =CF_{GPP,leaf} {\kern 1pt} C_{allom} } \\ {NF_{alloc} =CF_{GPP,leaf} {\kern 1pt} N_{allom} } \end{array} where @@ -215,16 +205,7 @@ where N_{allom} =\left\{\begin{array}{l} {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } +\frac{a_{3} a_{4} \left(1+a_{2} \right)}{CN_{lw} } +} \\ {\qquad \frac{a_{3} \left(1-a_{4} \right)\left(1+a_{2} \right)}{CN_{dw} } \qquad {\rm for\; woody\; PFT}} \\ {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } \qquad \qquad \qquad {\rm for\; non-woody\; PFT.}} \end{array}\right. -Since the C:N stoichiometry for new growth allocation is defined, from -Eq. , as :math:`C_{allom}`/ :math:`N_{allom}`, the total carbon available for new growth allocation -(:math:`CF_{avail\_alloc}`) can be used to calculate the total -plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, -gN m\ :sup:`-2` s\ :sup:`-1`) as: -.. math:: - :label: 19.13 - - NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . Carbon Allocation to New Growth ----------------------------------------- @@ -305,14 +286,8 @@ tissue types are given as: Nitrogen allocation ----------------------------------------- -The total flux of nitrogen to be allocated is given by the FUN model (Chapter :numref:`rst_FUN`). This gives a total N to be allocated within a given timestep, :math:`N_{supply}`. The total N allocated for a given tissue :math:`i` is the minimum between the supply and the demand: - -.. math:: - :label: 19.26 - - NF_{alloc,i} = min \left( NF_{demand, i}, NF_{supply, i} \right) +The total flux of nitrogen to be allocated is given by the FUN model (Chapter :numref:`rst_FUN`). This gives a total N to be allocated within a given timestep, :math:`N_{uptake}`. This is distribution in proportion to the demand for N from different tissues, calculated as: -The demand for each tissue, calculated for the tissue to remain on stoichiometry during growth, is: .. math:: :label: 19.27 From 407df8d4188a4b9bd2fda40d04a5a62c58a4efe0 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 30 Nov 2017 17:37:18 -0700 Subject: [PATCH 0109/1973] Updated parameter values in Decomposition chapter --- .../CLM50_Tech_Note_Decomposition.rst | 16 ++++++++-------- .../CLM50_Tech_Note_Introduction.rst | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index 4d72bd357e..4f662988f6 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -200,19 +200,19 @@ those described in Parton et al. (1988) (:numref:`Table Turnover times`). +------------+------------------------+-------------+-------------------------------------------+ | | Turnover time (year) | C:N ratio | Acceleration term (:math:`{a}_{i}`) | +============+========================+=============+===========================================+ - | CWD | 4.1 | - | 1 | + | CWD | 3.3 | - | 1.65 | +------------+------------------------+-------------+-------------------------------------------+ - | Litter 1 | 0.066 | - | 1 | + | Litter 1 | 0.054 | - | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | Litter 2 | 0.25 | - | 1 | + | Litter 2 | 0.20 | - | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | Litter 3 | 0.25 | - | 1 | + | Litter 3 | 0.20 | - | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | SOM 1 | 0.17 | 8 | 1 | + | SOM 1 | 0.14 | 12 | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | SOM 2 | 6.1 | 11 | 15 | + | SOM 2 | 5 | 12 | 5 | +------------+------------------------+-------------+-------------------------------------------+ - | SOM 3 | 270 | 11 | 675 | + | SOM 3 | 222 | 10 | 222 | +------------+------------------------+-------------+-------------------------------------------+ Likewise, values for the respiration fraction of Century-based structure are in :numref:`Table Respiration fractions for Century-based structure`. @@ -794,7 +794,7 @@ loading from restart files (which preserve information about the mode of the model when restart files were written). The base acceleration terms for the two decomposition cascades are shown in -Tables 15.1 and 15.3. In addition to the base terms, CLM5 also +Tables :numref:`Table Decomposition rate constants` and :numref:`Table Turnover times`. In addition to the base terms, CLM5 also includes a geographic term to the acceleration in order to apply larger values to high-latitude systems, where decomposition rates are particularly slow and thus equilibration can take significantly longer diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index ee53f94082..999e6cd30e 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -511,7 +511,7 @@ push towards more mechanistic treatment of key processes, in addition to more co of land use and land-cover change. Prior versions of CLM included relatively few options for physics parameterizations or structure. In CLM5, where new parameterizations or model decisions were made, in most cases, the CLM4.5 parameterization was maintained so that users could switch back and forth between different parameterizations via namelist control where appropriate or desirable. Throughout the CLM5 Technical Descpription, in general only the default parameterization for any given process is described. Readers are referred to the CLM4.5 or CLM4 Technical Descriptions for detailed descriptions of non-default parameterizations. -The hydrology updates include the introduction of a dry surface layer-based soil evaporation resistance parameterization :ref:`(Swenson and Lawrence, 2014)` and a revised canopy interception parameterization. Canopy interception is now divided into liquid and solid phases, with the intercepted snow subject to unloading events due to wind or above-freezing temperatures. The snow-covered fraction of the canopy is used within the canopy radiation and surface albedo calculation. Instead of applying a spatially uniform soil thickness, soil thickness can vary in space :ref:`(Brunke et al. 2016` and :ref:`Swenson and Lawrence, 2015)` and is set to values within a range of 0.4m to 8.5m depth, derived from a spatially explicit soil thickness data product :ref:`(Pelletier et al., 2016)`. The explicit treatment of soil thickness allows for the deprecation of the unconfined aquifer parameterization used in CLM4.5, which is replaced with a zero flux boundary condition and explicit modeling of both the saturated and unsaturated zones. The default model soil layer resolution is increased, especially within the top 3m, to more explicitly represent active layer thickness within the permafrost zone. Rooting profiles were used inconsistently in CLM4.5 with :ref:`Zeng (2001)` profiles used for water and :ref: `Jackson et al. (1996)` profiles used for carbon inputs. For CLM5, the Jackson et al. (1996) rooting profiles are used for both water and carbon. Roots are deepened for the broadleaf evergreen tropical tree and broadleaf deciduous tropical tree types. Finally, an adaptive time-stepping solution to the Richard's equation is introduced, which improves the accuracy and stability of the numerical soil water solution. The River Transport Model (RTM) is replaced with the Model for Scale Adaptive River Transport (MOSART, :ref:`Li et al., 2013b)` in which surface runoff is routed across hillslopes and then discharged along with subsurface runoff into a tributary subnetwork before entering the main channel. +The hydrology updates include the introduction of a dry surface layer-based soil evaporation resistance parameterization :ref:`(Swenson and Lawrence, 2014)` and a revised canopy interception parameterization. Canopy interception is now divided into liquid and solid phases, with the intercepted snow subject to unloading events due to wind or above-freezing temperatures. The snow-covered fraction of the canopy is used within the canopy radiation and surface albedo calculation. Instead of applying a spatially uniform soil thickness, soil thickness can vary in space :ref:`(Brunke et al. 2016` and :ref:`Swenson and Lawrence, 2015)` and is set to values within a range of 0.4m to 8.5m depth, derived from a spatially explicit soil thickness data product :ref:`(Pelletier et al., 2016)`. The explicit treatment of soil thickness allows for the deprecation of the unconfined aquifer parameterization used in CLM4.5, which is replaced with a zero flux boundary condition and explicit modeling of both the saturated and unsaturated zones. The default model soil layer resolution is increased, especially within the top 3m, to more explicitly represent active layer thickness within the permafrost zone. Rooting profiles were used inconsistently in CLM4.5 with :ref:`Zeng (2001)` profiles used for water and :ref:`Jackson et al. (1996)` profiles used for carbon inputs. For CLM5, the Jackson et al. (1996) rooting profiles are used for both water and carbon. Roots are deepened for the broadleaf evergreen tropical tree and broadleaf deciduous tropical tree types. Finally, an adaptive time-stepping solution to the Richard's equation is introduced, which improves the accuracy and stability of the numerical soil water solution. The River Transport Model (RTM) is replaced with the Model for Scale Adaptive River Transport (MOSART, :ref:`Li et al., 2013b)` in which surface runoff is routed across hillslopes and then discharged along with subsurface runoff into a tributary subnetwork before entering the main channel. Several changes are included that are mainly targeted at improving the simulation of surface mass balance over ice sheets. The fresh snow density parameterization is updated to more realistically capture the temperature effects and to additionally account for wind effects on new snow density :ref:`(van Kampenhout et al., 2017)`. The maximum number of snow layers and snow amount is increased from 5 layers and 1m snow water equivalent to 12 layers and 10m snow water equivalent to allow for the formation of firn in regions of persistent snow-cover (e.g., glaciers and ice sheets) :ref:`(van Kampenhout et al., 2017)`. The CISM2 ice sheet model is active for Greenland by default with one-way coupling (surface mass balance impacts ice sheet dynamics, but ice sheet dynamics do not feedback onto surface elevation). Two-way coupling can be activated through a namelist switch. The introduction in CLM5 of the capability to From c019c6ebaac5fc8e221ce115707562118894f29a Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Fri, 1 Dec 2017 06:33:31 -0700 Subject: [PATCH 0110/1973] Modified Decomposition chapter discussion of N competition --- .../CLM50_Tech_Note_Decomposition.rst | 153 ++++++++++-------- 1 file changed, 85 insertions(+), 68 deletions(-) diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index 4f662988f6..30c9b3988d 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -12,7 +12,7 @@ and soil organic matter (SOM) pools, each defined at compile time, between 2 contrasting hypotheses of decomposition as embodied by two separate decomposition submodels: the CLM-CN pool structure used in CLM4.0, or a second pool structure, characterized by -slower decomposition rates, based on the Century model (Parton et al. +slower decomposition rates, based on the fCentury model (Parton et al. 1988). In addition, the user can choose, at compile time, whether to allow :math:`{n}_{lev}` to equal 1, as in CLM4.0, or to equal the number of soil levels used for the soil hydrological and thermal @@ -200,19 +200,19 @@ those described in Parton et al. (1988) (:numref:`Table Turnover times`). +------------+------------------------+-------------+-------------------------------------------+ | | Turnover time (year) | C:N ratio | Acceleration term (:math:`{a}_{i}`) | +============+========================+=============+===========================================+ - | CWD | 3.3 | - | 1.65 | + | CWD | 4.1 | - | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | Litter 1 | 0.054 | - | 1 | + | Litter 1 | 0.066 | - | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | Litter 2 | 0.20 | - | 1 | + | Litter 2 | 0.25 | - | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | Litter 3 | 0.20 | - | 1 | + | Litter 3 | 0.25 | - | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | SOM 1 | 0.14 | 12 | 1 | + | SOM 1 | 0.17 | 8 | 1 | +------------+------------------------+-------------+-------------------------------------------+ - | SOM 2 | 5 | 12 | 5 | + | SOM 2 | 6.1 | 11 | 15 | +------------+------------------------+-------------+-------------------------------------------+ - | SOM 3 | 222 | 10 | 222 | + | SOM 3 | 270 | 11 | 675 | +------------+------------------------+-------------+-------------------------------------------+ Likewise, values for the respiration fraction of Century-based structure are in :numref:`Table Respiration fractions for Century-based structure`. @@ -488,47 +488,64 @@ as opposed to a potential flux. N Competition between plant uptake and soil immobilization fluxes ---------------------------------------------------------------------- -Once :math:`{NF}_{immob\_demand }` is known, the competition between -plant and microbial nitrogen demand can be resolved. Mineral nitrogen in +Once :math:`{NF}_{immob\_demand }` and :math:`{NF}_{nit\_demand }` for each layer *j* are known, the competition between plant and microbial nitrogen demand can be resolved. Mineral nitrogen in the soil pool (:math:`{NS}_{sminn}`, gN m\ :sup:`-2`) at the -beginning of the timestep is considered the available supply. Total -demand for mineral nitrogen from this pool (:math:`{NF}_{total\_demand}`, gN m\ :sup:`-2` s\ :sup:`-1`) is: +beginning of the timestep is considered the available supply. + +Here, the :math:`{NF}_{plant\_demand}` is the theoretical maximum demand for nitrogen by plants to meet the entire carbon uptake given an N cost of zero (and therefore represents the upper bound on N requirements). N uptake costs that are +:math:`>` 0 imply that the plant will take up less N that it demands, ultimately. However, given the heuristic nature of the N competition algorithm, this discrepancy is not explicitly resolved here. + +The hypothetical plant nitrogen demand from the soil mineral pool is distributed between layers in proportion to the profile of available mineral N: + +.. math:: + :label: 21.291 + + NF_{plant\_ demand,j} = NF_{plant\_ demand} NS_{sminn\_ j} / \sum _{j=1}^{nj}NS_{sminn,j} + +Plants first compete for ammonia (NH4). For each soil layer (*j*), we calculate the total NH4 demand as: .. math:: - :label: 21.27) + :label: 21.292 - NF_{total\_ demand} =NF_{immob\_ demand} +NF_{plant\_ demand\_ soil} + NF_{total\_ demand_nh4,j} = NF_{immob\_ demand,j} + NF_{immob\_ demand,j} + NF_{nit\_ demand,j} -If :math:`{NF}_{total\_demand}`\ :math:`\Delta`\ *t* :math:`<` -:math:`{NS}_{sminn}`, then the available pool is large enough to -meet both plant and microbial demand, and neither plant growth nor -immobilization steps in the decomposition cascade are limited by -nitrogen availability in the timestep. In that case, the signaling -variables :math:`{f}_{plant\_demand}` and -:math:`{f}_{immob\_demand}` are both set to 1.0, where -:math:`{f}_{plant\_demand}` is defined and used in section 15.4, and -:math:`{f}_{immob\_demand}` is the fraction of potential -immobilization demand that can be met given current supply of mineral nitrogen. +where +If :math:`{NF}_{total\_demand,j}`\ :math:`\Delta`\ *t* :math:`<` +:math:`{NS}_{sminn,j}`, then the available pool is large enough to +meet both the maximum plant and microbial demand, then immobilization proceeds at the maximum rate. -If :math:`{NF}_{total\_demand}`\ :math:`\Delta`\ *t* -:math:`\mathrm{\ge}` :math:`{NS}_{sminn}`, then there is not enough +.. math:: + :label: 21.29) + + f_{immob\_demand,j} = 1.0 + +where :math:`{f}_{immob\_demand,j}` is the fraction of potential immobilization demand that can be met given current supply of mineral nitrogen in this layer. We also set the actual nitrification flux to be the same as the potential flux (:math:`NF_{nit}` = :math:`NF_{nit\_ demand}`). + +If :math:`{NF}_{total\_demand,j}`\ :math:`\Delta`\ *t* +:math:`\mathrm{\ge}` :math:`{NS}_{sminn,j}`, then there is not enough mineral nitrogen to meet the combined demands for plant growth and -heterotrophic immobilization, and both of these processes proceed at -lower-than-potential rates, defined by the fractions -:math:`{f}_{plant\_demand}` and :math:`{f}_{immob\_demand}`, -where: +heterotrophic immobilization, immobilization is reduced proportional to the discrepancy, by :math:`f_{immob\_ demand,j}`, where .. math:: - :label: 21.28) + :label: 21.30) + + f_{immob\_ demand,j} = \frac{NS_{sminn,j} }{\Delta t\, NF_{total\_ demand,j} } + +The N available to the FUN model for plant uptake (:math:`{NF}_ {plant\_ avail\_ sminn}` (gN m\ :sup:`-2`), which determines both the cost of N uptake, and the absolute limit on the N which is available for acquisition, is calculated as the total mineralized pool minus the actual immobilized flux: + +.. math:: + :label: 21.311) + + NF_{plant\_ avail\_ sminn,j} = NS_{sminn,j} - f_{immob\_demand} NF_{immob\_ demand,j} - f_{plant\_ demand} =f_{immob\_ demand} =\frac{NS_{sminn} }{\Delta t\, NF_{total\_ demand} } This treatment of competition for nitrogen as a limiting resource is referred to a demand-based competition, where the fraction of the available resource that eventually flows to a particular process depends on the demand from that process in comparison to the total demand from all processes. Processes expressing a greater demand acquire a larger -fraction of the available resource. +vfraction of the available resource. + Final Decomposition Fluxes ------------------------------- @@ -540,37 +557,37 @@ CENTURY structure will be similar but, again without the different terminal step), are calculated as: .. math:: - :label: 21.29) + :label: 21.32) CF_{Lit1} =\left\{\begin{array}{l} {CF_{pot,\, Lit1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} >0} \\ {CF_{pot,\, Lit1} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} \le 0} \end{array}\right\} .. math:: - :label: 21.30) + :label: 21.33) CF_{Lit2} =\left\{\begin{array}{l} {CF_{pot,\, Lit2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} >0} \\ {CF_{pot,\, Lit2} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} \le 0} \end{array}\right\} .. math:: - :label: 21.31) + :label: 21.34) CF_{Lit3} =\left\{\begin{array}{l} {CF_{pot,\, Lit3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} >0} \\ {CF_{pot,\, Lit3} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} \le 0} \end{array}\right\} .. math:: - :label: 21.32) + :label: 21.35) CF_{SOM1} =\left\{\begin{array}{l} {CF_{pot,\, SOM1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} >0} \\ {CF_{pot,\, SOM1} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} \le 0} \end{array}\right\} .. math:: - :label: 21.33) + :label: 21.36) CF_{SOM2} =\left\{\begin{array}{l} {CF_{pot,\, SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} >0} \\ {CF_{pot,\, SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} \le 0} \end{array}\right\} .. math:: - :label: 21.34) + :label: 21.37) CF_{SOM3} =\left\{\begin{array}{l} {CF_{pot,\, SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} >0} \\ {CF_{pot,\, SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} \le 0} \end{array}\right\} .. math:: - :label: 21.35) + :label: 21.38) CF_{SOM4} =CF_{pot,\, SOM4} @@ -578,37 +595,37 @@ Heterotrophic respiration fluxes (losses of carbon as CO\ :sub:`2` to the atmosphere) are: .. math:: - :label: 21.36) + :label: 21.39) CF_{Lit1,\, HR} =CF_{Lit1} rf_{Lit1} .. math:: - :label: 21.37) + :label: 21.40) CF_{Lit2,\, HR} =CF_{Lit2} rf_{Lit2} .. math:: - :label: 21.38) + :label: 21.41) CF_{Lit3,\, HR} =CF_{Lit3} rf_{Lit3} .. math:: - :label: 21.39) + :label: 21.42) CF_{SOM1,\, HR} =CF_{SOM1} rf_{SOM1} .. math:: - :label: 21.40) + :label: 21.43) CF_{SOM2,\, HR} =CF_{SOM2} rf_{SOM2} .. math:: - :label: 21.41) + :label: 21.44) CF_{SOM3,\, HR} =CF_{SOM3} rf_{SOM3} .. math:: - :label: 21.42) + :label: 21.45) CF_{SOM4,\, HR} =CF_{SOM4} rf_{SOM4} @@ -616,32 +633,32 @@ Transfers of carbon from upstream to downstream pools in the decomposition cascade are given as: .. math:: - :label: 21.43) + :label: 21.46) CF_{Lit1,\, SOM1} =CF_{Lit1} \left(1-rf_{Lit1} \right) .. math:: - :label: 21.44) + :label: 21.47) CF_{Lit2,\, SOM2} =CF_{Lit2} \left(1-rf_{Lit2} \right) .. math:: - :label: 21.45) + :label: 21.48) CF_{Lit3,\, SOM3} =CF_{Lit3} \left(1-rf_{Lit3} \right) .. math:: - :label: 21.46) + :label: 21.49) CF_{SOM1,\, SOM2} =CF_{SOM1} \left(1-rf_{SOM1} \right) .. math:: - :label: 21.47) + :label: 21.50) CF_{SOM2,\, SOM3} =CF_{SOM2} \left(1-rf_{SOM2} \right) .. math:: - :label: 21.48) + :label: 21.51) CF_{SOM3,\, SOM4} =CF_{SOM3} \left(1-rf_{SOM3} \right) @@ -655,32 +672,32 @@ or from the downstream pool to the soil mineral nitrogen pool pools in the decomposition cascade are given as: .. math:: - :label: 21.49) + :label: 21.52) NF_{Lit1,\, SOM1} ={CF_{Lit1} \mathord{\left/ {\vphantom {CF_{Lit1} CN_{Lit1} }} \right. \kern-\nulldelimiterspace} CN_{Lit1} } .. math:: - :label: 21.50) + :label: 21.53) NF_{Lit2,\, SOM2} ={CF_{Lit2} \mathord{\left/ {\vphantom {CF_{Lit2} CN_{Lit2} }} \right. \kern-\nulldelimiterspace} CN_{Lit2} } .. math:: - :label: 21.51) + :label: 21.54) NF_{Lit3,\, SOM3} ={CF_{Lit3} \mathord{\left/ {\vphantom {CF_{Lit3} CN_{Lit3} }} \right. \kern-\nulldelimiterspace} CN_{Lit3} } .. math:: - :label: 21.52) + :label: 21.55) NF_{SOM1,\, SOM2} ={CF_{SOM1} \mathord{\left/ {\vphantom {CF_{SOM1} CN_{SOM1} }} \right. \kern-\nulldelimiterspace} CN_{SOM1} } .. math:: - :label: 21.53) + :label: 21.56) NF_{SOM2,\, SOM3} ={CF_{SOM2} \mathord{\left/ {\vphantom {CF_{SOM2} CN_{SOM2} }} \right. \kern-\nulldelimiterspace} CN_{SOM2} } .. math:: - :label: 21.54) + :label: 21.57) NF_{SOM3,\, SOM4} ={CF_{SOM3} \mathord{\left/ {\vphantom {CF_{SOM3} CN_{SOM3} }} \right. \kern-\nulldelimiterspace} CN_{SOM3} } @@ -689,37 +706,37 @@ whether the decomposition step is an immobilization flux or a mineralization flux: .. math:: - :label: 21.55) + :label: 21.58) NF_{sminn,\, Lit1\to SOM1} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit1\to SOM1} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} >0} \\ {NF_{pot\_ min,\, Lit1\to SOM1} \qquad {\rm for\; }NF_{pot\_ min,\, Lit1\to SOM1} \le 0} \end{array}\right\} .. math:: - :label: 21.56) + :label: 21.59) NF_{sminn,\, Lit2\to SOM2} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit2\to SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} >0} \\ {NF_{pot\_ min,\, Lit2\to SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, Lit2\to SOM2} \le 0} \end{array}\right\} .. math:: - :label: 21.57) + :label: 21.60) NF_{sminn,\, Lit3\to SOM3} =\left\{\begin{array}{l} {NF_{pot\_ min,\, Lit3\to SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} >0} \\ {NF_{pot\_ min,\, Lit3\to SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, Lit3\to SOM3} \le 0} \end{array}\right\} .. math:: - :label: 21.58) + :label: 21.61) NF_{sminn,SOM1\to SOM2} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM1\to SOM2} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} >0} \\ {NF_{pot\_ min,\, SOM1\to SOM2} \qquad {\rm for\; }NF_{pot\_ min,\, SOM1\to SOM2} \le 0} \end{array}\right\} .. math:: - :label: 21.59) + :label: 21.62) NF_{sminn,SOM2\to SOM3} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM2\to SOM3} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} >0} \\ {NF_{pot\_ min,\, SOM2\to SOM3} \qquad {\rm for\; }NF_{pot\_ min,\, SOM2\to SOM3} \le 0} \end{array}\right\} .. math:: - :label: 21.60) + :label: 21.63) NF_{sminn,SOM3\to SOM4} =\left\{\begin{array}{l} {NF_{pot\_ min,\, SOM3\to SOM4} f_{immob\_ demand} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} >0} \\ {NF_{pot\_ min,\, SOM3\to SOM4} \qquad {\rm for\; }NF_{pot\_ min,\, SOM3\to SOM4} \le 0} \end{array}\right\} .. math:: - :label: 21.61) + :label: 21.64) NF_{sminn,\, SOM4} =NF_{pot\_ min,\, SOM4} @@ -794,7 +811,7 @@ loading from restart files (which preserve information about the mode of the model when restart files were written). The base acceleration terms for the two decomposition cascades are shown in -Tables :numref:`Table Decomposition rate constants` and :numref:`Table Turnover times`. In addition to the base terms, CLM5 also +Tables 15.1 and 15.3. In addition to the base terms, CLM5 also includes a geographic term to the acceleration in order to apply larger values to high-latitude systems, where decomposition rates are particularly slow and thus equilibration can take significantly longer @@ -803,7 +820,7 @@ the form of a logistic equation, where :math:`{a}_{i}` is equal to the product of the base acceleration term and :math:`{a}_{l}` below: .. math:: - :label: 21.62) + :label: 21.65) a_l = 1 + 50 / \left ( 1 + exp \left (-0.1 * (abs(latitude) - 60 ) \right ) \right ) From 59b6fa4f5a5f11f69c3f0ef431876735e516b586 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 1 Dec 2017 09:33:19 -0700 Subject: [PATCH 0111/1973] Update html --- .../tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 3edb8fb857..751c393535 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -20,7 +20,7 @@ The carbon and nitrogen allocation routines in CLM determine the fate of newly a Carbon Allocation to Cover Prior-Timestep Maintenance Respiration Costs ("Excess" Respiration) ----------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------- After respiration of live tissues (Chapter :numref:`rst_Plant Respiration`), the next priority of the carbon allocation cascade is to replenish the plant carbon deficit pool that balances maintenance respiration that occurs during times when maintenance respiration exceeds photosynthesis (e.g. at night, during winter for perennial vegetation, or during periods of drought stress) (Sprugel et al., 1995). From 55c81baca6568810b2f78cd03d88dd2243458dc0 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Fri, 1 Dec 2017 12:15:09 -0700 Subject: [PATCH 0112/1973] modifications to respiration. Added Atkin model, removed allocation text --- .../CLM50_Tech_Note_Plant_Respiration.rst | 472 ++---------------- 1 file changed, 31 insertions(+), 441 deletions(-) diff --git a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst index 7fac43551c..0ec9d5e1d6 100644 --- a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst +++ b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst @@ -4,434 +4,6 @@ Plant Respiration ================= -Carbon Expenditure on Plant Maintenance Respiration --------------------------------------------------------- - -After the assimilation of photsynthetic carbon, the first expenditure is on plant maintenance respiration (Chapter :numref:`rst_CN Allocation`) - -The total maintenance respiration demand (:math:`CF_{mr}`, gC -m\ :sup:`-2` s\ :sup:`-1`) is calculated as a function of -tissue mass and nitrogen concentration, and temperature (section 13.7). -The carbon supply to support this demand is composed of fluxes allocated -from carbon assimilated in the current timestep -(:math:`CF_{GPP,mr}`, gC m\ :sup:`-2` s\ :sup:`-1`) -and from a storage pool that is drawn down when total demand exceeds -photosynthesis ( :math:`CF_{xs,mr}`, gC m\ :sup:`-2` -s\ :sup:`-1`): - -.. math:: - :label: 17.1) - - CF_{mr} =CF_{GPP,mr} +CF_{xs,mr} - -.. math:: - :label: 17.2) - - CF_{GPP,mr} =\_ \left\{\begin{array}{l} {CF_{mr} \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. - -.. math:: - :label: 17.3) - - CF_{xs,mr} =\_ \left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPPpot} } \\ {CF_{mr} -CF_{GPPpot} \qquad {\rm for\; }CF_{mr} >CF_{GPPpot} } \end{array}\right. - -The storage pool that supplies carbon for maintenance respiration in -excess of current :math:`CF_{GPPpot}` ( :math:`CS_{xs}`, gC -m\ :sup:`-2`) is permitted to run a deficit (negative state), and -the magnitude of this deficit determines an allocation demand which -gradually replenishes :math:`CS_{xs}`. The logic for allowing a -negative state for this pool is to eliminate the need to know in advance -what the total maintenance respiration demand will be for a particular -combination of climate and plant type. Using the deficit approach, the -allocation to alleviate the deficit increases as the deficit increases, -until the supply of carbon into the pool balances the demand for carbon -leaving the pool in a quasi-steady state, with variability driven by the -seasonal cycle, climate variation, disturbance, and internal dynamics of -the plant-litter-soil system. In cases where the combination of climate -and plant type are not suitable to sustained growth, the deficit in this -pool increases until the available carbon is being allocated mostly to -alleviate the deficit, and new growth approaches zero. The allocation -flux to :math:`CS_{xs}` (:math:`CF_{GPP,xs}`, gC -m\ :sup:`-2` s\ :sup:`-1`) is given as - -.. math:: - :label: 17.4) - - CF_{GPP,xs,pot} =\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CS_{xs} \ge 0} \\ {-CS_{xs} /(86400\tau _{xs} )\qquad {\rm for\; }CS_{xs} <0} \end{array}\right. - -.. math:: - :label: 17.5) - - CF_{GPP,xs} =\left\{\begin{array}{l} {CF_{GPP,xs,pot} \qquad \qquad \qquad {\rm for\; }CF_{GPP,xs,pot} \le CF_{GPPpot} -CF_{GPP,mr} } \\ {\max (CF_{GPPpot} -CF_{GPP,mr} ,0)\qquad {\rm for\; }CF_{GPP,xs,pot} >CF_{GPPpot} -CF_{GPP,mr} } \end{array}\right. - -where :math:`\tau_{xs}` is the time constant (currently -set to 30 days) controlling the rate of replenishment of :math:`CS_{xs}`. - -Note that these two top-priority carbon allocation fluxes -(:math:`CF_{GPP,mr}` and :math:`CF_{GPP,xs}`) are not -stoichiometrically associated with any nitrogen fluxes, and so this -initial allocation step can proceed without reference to (or limitation -from) the available mineral nitrogen supply. - -Carbon and Nitrogen Stoichiometry of New Growth ----------------------------------------------------- - -After accounting for the carbon cost of maintenance respiration, the -remaining carbon flux from photosynthesis which can be allocated to new -growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is - -.. math:: - :label: 17.6) - - CF_{avail\_ alloc} =CF_{GPPpot} -CF_{GPP,mr} -CF_{GPP,xs} . - -Potential allocation to new growth is calculated for all of the plant -carbon and nitrogen state variables based on specified C:N ratios for -each tissue type and allometric parameters that relate allocation -between various tissue types. The allometric parameters are defined as -follows: - -.. math:: - :label: ZEqnNum650137 - - \begin{array}{l} {a_{1} ={\rm \; ratio\; of\; new\; fine\; root\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{2} ={\rm \; ratio\; of\; new\; coarse\; root\; :\; new\; stem\; carbon\; allocation}} \\ {a_{3} ={\rm \; ratio\; of\; new\; stem\; :\; new\; leaf\; carbon\; allocation}} \\ {a_{4} ={\rm \; ratio\; new\; live\; wood\; :\; new\; total\; wood\; allocation}} \\ {g_{1} ={\rm ratio\; of\; growth\; respiration\; carbon\; :\; new\; growth\; carbon.\; }} \end{array} - -Parameters :math:`a_{1}`, :math:`a_{2}`, and :math:`a_{4}` are defined -as constants for a given PFT (:numref:`Table Allocation and carbon:nitrogen -ratio parameters`), while :math:`g_{l }` = 0.3 (unitless) is prescribed as a -constant for all PFTs, based on construction costs for a range of woody -and non-woody tissues (:ref:`Larcher, 1995 `). - -CLM5.0 applies a fixed allocation scheme for woody vegetation. -The decision to use the fixed allocation scheme in CLM5.0 came -from biases in above-ground biomass illustrated by Negrón-Juárez -et al. (:ref:`2015 `). - -The model maintains the capacity to represent a dynamic allocation scheme -for woody vegetation (parameter :math:`a_{3}` = -1, :numref:`Table Allocation -and carbon:nitrogen ratio parameters`), but this is not the default -configuration. With dynamic allocation the ratio for carbon allocation -between new stem and new leaf increases with increasing net primary -production (NPP), as - -.. math:: - :label: 17.8) - - a_{3} =\frac{2.7}{1+e^{-0.004NPP_{ann} -300} } -0.4 - -where :math:`NPP_{ann}` is the annual sum of NPP from the previous -year. This mechanism has the effect of increasing woody allocation in -favorable growth environments (:ref:`Allen et al., 2005 `; -:ref:`Vanninen and Makela, 2005 `) and during -the phase of stand growth prior to canopy closure (:ref:`Axelsson and -Axelsson, 1986 `). - -.. _Table Allocation and carbon:nitrogen ratio parameters: - -.. table:: Allocation and carbon:nitrogen ratio parameters. - - ======================== ============= ============= ============= ============= ================= =============== =============== =============== - Plant functional type :math:`a_{1}` :math:`a_{2}` :math:`a_{3}` :math:`a_{4}` :math:`CN_{leaf}` :math:`CN_{fr}` :math:`CN_{lw}` :math:`CN_{dw}` - ======================== ============= ============= ============= ============= ================= =============== =============== =============== - NET Temperate 1.5 0.3 2.30 0.1 58.00 42 50 500 - NET Boreal 1.5 0.3 2.30 0.1 58.00 42 50 500 - NDT Boreal 1.5 0.3 1.00 0.1 25.81 42 50 500 - BET Tropical 1.5 0.3 2.30 0.1 29.60 42 50 500 - BET temperate 1.5 0.3 1.50 0.1 29.60 42 50 500 - BDT tropical 1.5 0.3 1.00 0.1 23.45 42 50 500 - BDT temperate 1.5 0.3 2.30 0.1 23.45 42 50 500 - BDT boreal 1.5 0.3 2.30 0.1 23.45 42 50 500 - BES temperate 1.5 0.3 1.40 0.5 36.42 42 50 500 - BDS temperate 1.5 0.3 0.24 0.5 23.26 42 50 500 - BDS boreal 1.5 0.3 0.24 0.1 23.26 42 50 500 - C\ :sub:`3` arctic grass 1.5 0.0 0.00 0.0 28.03 42 0 0 - C\ :sub:`3` grass 1.5 0.0 0.00 0.0 28.03 42 0 0 - C\ :sub:`4` grass 1.5 0.0 0.00 0.0 35.36 42 0 0 - ======================== ============= ============= ============= ============= ================= =============== =============== =============== - -Carbon to nitrogen ratios are defined for different tissue types as -follows: - -.. math:: - :label: ZEqnNum413927 - - \begin{array}{l} {CN_{leaf} =\ {\rm \;C:N\; for\; leaf}} \\ {CN_{fr} =\ {\rm \;C:N\; for\; fine\; root}} \\ {CN_{lw} =\_ {\rm \;C:N\; for\; live\; wood\; (in\; stem\; and\; coarse\; root)}} \\ {CN_{dw} =\ {\rm \;C:N\; for\; dead\; wood\; (in\; stem\; and\; coarse\; root)}} \end{array} - -where all C:N parameters are defined as constants for a given PFT -(:numref:`Table Allocation and carbon:nitrogen ratio parameters`). - -Given values for the parameters in and , total carbon and nitrogen -allocation to new growth ( :math:`CF_{alloc}`, gC -m\ :sup:`-2` s\ :sup:`-1`, and :math:`NF_{alloc}`, gN -m\ :sup:`-2` s\ :sup:`-1`, respectively) can be expressed as -functions of new leaf carbon allocation (:math:`CF_{GPP,leaf}`, gC -m\ :sup:`-2` s\ :sup:`-1`): - -.. math:: - :label: ZEqnNum555154 - - \begin{array}{l} {CF_{alloc} =CF_{GPP,leaf} {\kern 1pt} C_{allom} } \\ {NF_{alloc} =CF_{GPP,leaf} {\kern 1pt} N_{allom} } \end{array} - -where - -.. math:: - :label: 17.11) - - \begin{array}{l} {C_{allom} =\left\{\begin{array}{l} {\left(1+g_{1} \right)\left(1+a_{1} +a_{3} \left(1+a_{2} \right)\right)\qquad {\rm for\; woody\; PFT}} \\ {1+g_{1} +a_{1} \left(1+g_{1} \right)\qquad \qquad {\rm for\; non-woody\; PFT}} \end{array}\right. } \\ {} \end{array} - -.. math:: - :label: 17.12) - - N_{allom} =\left\{\begin{array}{l} {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } +\frac{a_{3} a_{4} \left(1+a_{2} \right)}{CN_{lw} } +} \\ {\qquad \frac{a_{3} \left(1-a_{4} \right)\left(1+a_{2} \right)}{CN_{dw} } \qquad {\rm for\; woody\; PFT}} \\ {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } \qquad \qquad \qquad {\rm for\; non-woody\; PFT.}} \end{array}\right. - -Since the C:N stoichiometry for new growth allocation is defined, from -Eq. , as :math:`C_{allom}`/ :math:`N_{allom}`, the total carbon available for new growth allocation -(:math:`CF_{avail\_alloc}`) can be used to calculate the total -plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, -gN m\ :sup:`-2` s\ :sup:`-1`) as: - -.. math:: - :label: 17.13) - - NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . - -Deployment of retranslocated nitrogen ------------------------------------------- - -In many plants, some portion of the nitrogen used to construct new -tissues is mobilized from senescing tissues, especially leaves, and -retained within the plant when the tissues are lost as litter. This -store of retranslocated nitrogen is used to supply part of the nitrogen -demand for subsequent growth (Magill et al., 1997; Oikawa et al., 2005; -Son and Gower, 1991). CLM includes one pool of retranslocated nitrogen -(:math:`NS_{retrans}`, gN m\ :sup:`-2`), and the -availability of nitrogen from this pool to support new growth -(:math:`NF_{avail\_retrans}`, gN m\ :sup:`-2` -s\ :sup:`-1`) is proportional to the plant nitrogen demand, as: - -.. math:: - :label: 17.14) - - NF_{avail\_ retrans} =\min \left(\frac{NF_{retrans\_ ann} \frac{NF_{plant\_ demand} }{NF_{plant\_ demand\_ ann} } }{\Delta t} ,\; \frac{NS_{retrans} }{\Delta t} \right) - -where :math:`NF_{retrans\_ann}` (gN m\ :sup:`-2` y\ :sup:`-1`) is the previous year’s annual sum of retranslocated -nitrogen extracted from senescing tissues, -:math:`NF_{plant\_demand\_ann}` (gN m\ :sup:`-2` y\ :sup:`-1`) is the previous year’s annual sum of -:math:`NF_{plant\_demand}`, and :math:`\Delta`\ *t* (s) is the -model’s biogeochemistry time step. This formulation produces an annual -cycle in the extraction of nitrogen from :math:`NS_{retrans}` -which corresponds to the annual cycle of plant nitrogen demand, and -which is scaled to give :math:`NS_{retrans}` approximately a -one-year turnover time. The minimum function prevents extraction of more -than the remaining pool of retranslocated nitrogen, which can be an -important constraint under conditions where high rates of mortality are -modifying the size of the pool. During the first year of an initial -simulation, before :math:`NF_{plant\_demand\_ann}` and -:math:`NF_{retrans\_ann}` have valid values, -:math:`NF_{avail\_retrans}` is set to 0.0. - -The actual flux of nitrogen from the retranslocated N pool into -allocation of new growth (:math:`NF_{retrans,alloc}`, gN -m\ :sup:`-2` s\ :sup:`-1`) is never greater than the plant -demand for new nitrogen: - -.. math:: - :label: 17.15) - - NF_{retrans,alloc} =\min \left(NF_{plant\_ demand} ,NF_{avail\_ retrans} \right) - -Plant nitrogen uptake from soil mineral nitrogen pool ----------------------------------------------------------- - -The total plant nitrogen demand is reduced by the nitrogen flux from -:math:`NS_{retrans}` to give the plant demand for mineral nitrogen -from the soil (:math:`NF_{plant\_demand\_soil}`, gN -m\ :sup:`-2` s\ :sup:`-1`): - -.. math:: - :label: ZEqnNum491412 - - NF_{plant\_ demand\_ soil} =NF_{plant\_ demand} -NF_{retrans,alloc} . - -The combined demand from all PFTs sharing space on a soil column and the -demand from the heterotrophic community in the soil (nitrogen -immobilization demand) compete for the available soil mineral nitrogen -pool. The result of this competition is passed back to the allocation -algorithm as :math:`f_{plant\_demand}`, the fraction (from 0 to 1) -of the plant nitrogen demand which can be met given the current soil -mineral nitrogen supply and competition with heterotrophs. Plant uptake -from the soil mineral nitrogen pool is then given as: - -.. math:: - :label: 17.17) - - NF_{sminn,alloc} =NF_{plant\_ demand\_ soil} f_{plant\_ demand} - -Final carbon and nitrogen allocation ------------------------------------------ - -The total flux of allocated nitrogen is given as: - -.. math:: - :label: 17.18) - - NF_{alloc} =NF_{retrans,alloc} +NF_{sminn,alloc} - -From the stoichiometric relationship in Eq. , the associated carbon -allocation flux is: - -.. math:: - :label: 17.19) - - CF_{alloc} =NF_{alloc} \frac{C_{allom} }{N_{allom} } . - -The downregulation of photosynthesis can then be calculated as: - -.. math:: - :label: 17.20) - - f_{dreg} =\frac{CF_{alloc} -CF_{avail\_ alloc} }{CF_{GPPpot} } . - -Total allocation to new leaf carbon -(:math:`CF_{alloc,leaf\_tot}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as: - -.. math:: - :label: 17.21) - - CF_{alloc,leaf\_ tot} =\frac{CF_{alloc} }{C_{allom} } . - -There are two carbon pools associated with each plant tissue – one which -represents the currently displayed tissue, and another which represents -carbon stored for display in a subsequent growth period. The nitrogen -pools follow this same organization. The model keeps track of stored -carbon according to which tissue type it will eventually be displayed -as, and the separation between display in the current timestep and -storage for later display depends on the parameter :math:`f_{cur}` -(values 0 to 1). Given :math:`CF_{alloc,leaf}` and :math:`f_{cur}`, the allocation fluxes of carbon to display and -storage pools (where storage is indicated with *\_stor*) for the various -tissue types are given as: - -.. math:: - :label: 17.22) - - CF_{alloc,leaf} \_ =CF_{alloc,leaf\_ tot} f_{cur} - -.. math:: - :label: 17.23) - - CF_{alloc,leaf\_ stor} \_ =CF_{alloc,leaf\_ tot} \left(1-f_{cur} \right) - -.. math:: - :label: 17.24) - - CF_{alloc,froot} \_ =CF_{alloc,leaf\_ tot} a_{1} f_{cur} - -.. math:: - :label: 17.25) - - CF_{alloc,froot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{1} \left(1-f_{cur} \right) - -.. math:: - :label: 17.26) - - CF_{alloc,livestem} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} f_{cur} - -.. math:: - :label: 17.27) - - CF_{alloc,livestem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} a_{4} \left(1-f_{cur} \right) - -.. math:: - :label: 17.28) - - CF_{alloc,deadstem} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)f_{cur} - -.. math:: - :label: 17.29) - - CF_{alloc,deadstem\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right) - -.. math:: - :label: 17.30) - - CF_{alloc,livecroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} f_{cur} - -.. math:: - :label: 17.31) - - CF_{alloc,livecroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} \left(1-f_{cur} \right) - -.. math:: - :label: 17.32) - - CF_{alloc,deadcroot} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)f_{cur} - -.. math:: - :label: 17.33) - - CF_{alloc,deadcroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). - -The corresponding nitrogen allocation fluxes are given as: - -.. math:: - :label: 17.34) - - NF_{alloc,leaf} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } f_{cur} - -.. math:: - :label: 17.35) - - NF_{alloc,leaf\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} }{CN_{leaf} } \left(1-f_{cur} \right) - -.. math:: - :label: 17.36) - - NF_{alloc,froot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } f_{cur} - -.. math:: - :label: 17.37) - - NF_{alloc,froot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{1} }{CN_{fr} } \left(1-f_{cur} \right) - -.. math:: - :label: 17.38) - - NF_{alloc,livestem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } f_{cur} - -.. math:: - :label: 17.39) - - NF_{alloc,livestem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) - -.. math:: - :label: 17.40) - - NF_{alloc,deadstem} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} - -.. math:: - :label: 17.41) - - NF_{alloc,deadstem\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right) - -.. math:: - :label: 17.42) - - NF_{alloc,livecroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } f_{cur} - -.. math:: - :label: 17.43) - - NF_{alloc,livecroot\_ stor} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} a_{4} }{CN_{lw} } \left(1-f_{cur} \right) - -.. math:: - :label: 17.44) - - NF_{alloc,deadcroot} \_ =\frac{CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } f_{cur} - -.. math:: - :label: 17.45) - - NF_{alloc,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). - Autotrophic Respiration ---------------------------- @@ -442,19 +14,17 @@ defined as the carbon cost to support the metabolic activity of existing live tissue, while growth respiration is defined as the additional carbon cost for the synthesis of new growth. -13.7.1 Maintenance Respiration +Maintenance Respiration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Under the assumption that tissue nitrogen content is a suitable index of -cellular metabolic rate, maintenance respiration costs for live tissues -(leaf, live stem, live coarse root, and fine root) are calculated as -functions tissue nitrogen content and the relevant temperature, -following the empirical relationship reported by Ryan (1991): +Atkin et al. (2016) propose a model for respiration that is based on the leaf nitrogen content per unit area (:math:`NS_{narea}` (gN m :sup:`2` leaf), with an intercept parameter that is PFT dependant, and an acclimation term that depends upon the average temperature of the previous 10 day period :math:`t_{2m,10days}`, in Celsius. .. math:: - :label: 17.46) + :label: 17.46) - CF_{mr\_ leaf} \_ =NS_{leaf} MR_{base} MR_{Q10} ^{(T_{2m} -20)/10} + CF_{mr\_ leaf} = i_{atkin,pft} + (NS_{narea} 0.2061) - (0.0402 (t_{2m,10days})) + +The temperature dependance of leaf maintenance (dark) respiration is described in Chapter :numref:`rst_Stomatal Resistance and Photosynthesis`. .. math:: :label: 17.47) @@ -471,14 +41,34 @@ following the empirical relationship reported by Ryan (1991): CF_{mr\_ froot} \_ =\sum _{j=1}^{nlevsoi}NS_{froot} rootfr_{j} MR_{base} MR_{Q10} ^{(Ts_{j} -20)/10} -where :math:`MR_{base}` (= 2.525e\ :sup:`-6` gC gN\ :sup:`-1` s\ :sup:`-1`) is the base rate of maintenance -respiration per unit nitrogen content, :math:`MR_{q10}` (= 2.0) is +where :math:`MR_{q10}` (= 2.0) is the temperature sensitivity for maintenance respiration, :math:`T_{2m}` (:sup:`o`\ C) is the air temperature at 2m height, :math:`Ts_{j}`* (:sup:`o`\ C) is the soil temperature at level *j*, and :math:`rootfr_{j}` is the fraction of fine roots distributed in soil level *j*. +.. table:: Atkin leaf respiration model intercept values. + + ======================== ============= + Plant functional type :math:`i_{atkin}` + ======================== ============= + NET Temperate 1.499 + NET Boreal 1.499 + NDT Boreal 1.499 + BET Tropical 1.756 + BET temperate 1.756 + BDT tropical 1.756 + BDT temperate 1.756 + BDT boreal 1.756 + BES temperate 2.075 + BDS temperate 2.075 + BDS boreal 2.075 + C\ :sub:`3` arctic grass 2.196 + C\ :sub:`3` grass 2.196 + C\ :sub:`4` grass 2.196 + ======================== ============= + Note that, for woody vegetation, maintenance respiration costs are not calculated for the dead stem and dead coarse root components. These components are assumed to consist of dead xylem cells, with no metabolic @@ -494,12 +84,12 @@ The total maintenance respiration cost is then given as: CF_{mr} =CF_{mr\_ leaf} +CF_{mr\_ froot} +CF_{mr\_ livestem} +CF_{mr\_ livecroot} . -13.7.2 Growth Respiration +Growth Respiration ^^^^^^^^^^^^^^^^^^^^^^^^^ -Growth respiration is calculated as a factor of 0.3 times the total +Growth respiration is calculated as a factor of 0.11 times the total carbon in new growth on a given timestep, based on construction costs -for a range of woody and non-woody tissues (Larcher, 1995). For new +for a range of woody and non-woody tissues (Atkin et al. in prep). For new carbon and nitrogen allocation that enters storage pools for subsequent display, it is not clear what fraction of the associated growth respiration should occur at the time of initial allocation, and what From 21daba770bede96ee552a88ecb5a8b7a4fe41849 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Fri, 1 Dec 2017 12:28:30 -0700 Subject: [PATCH 0113/1973] modifications to respiration. altered growth respiration description --- .../Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst index 0ec9d5e1d6..33b9477ed1 100644 --- a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst +++ b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst @@ -88,7 +88,8 @@ Growth Respiration ^^^^^^^^^^^^^^^^^^^^^^^^^ Growth respiration is calculated as a factor of 0.11 times the total -carbon in new growth on a given timestep, based on construction costs +carbon allocation to new growth (:math:`CF_{growth}`, after allocating carbon for N acquisition, +Chapter :numref:`rst_FUN`.)on a given timestep, based on construction costs for a range of woody and non-woody tissues (Atkin et al. in prep). For new carbon and nitrogen allocation that enters storage pools for subsequent display, it is not clear what fraction of the associated growth From 8a922b4caad36e64acd2df7b16770f6c3530bbd9 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Thu, 7 Dec 2017 11:20:00 -0700 Subject: [PATCH 0114/1973] added CLM(FATES) tech note to DGVM chapter. Refs still need formatting --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 3825 ++++++++++++++++- 1 file changed, 3676 insertions(+), 149 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 8608521802..72001f2827 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -1,157 +1,3684 @@ +====================================== +CLM(ED) model: Technical Documentation +====================================== + .. _rst_Dynamic Global Vegetation Model: -Dynamic Global Vegetation Model +Dynamic Global Vegetation =================================== -In CLM the user may choose to run the CN model as a dgvm (dynamic global -vegetation model) (CNDV). Note that CN must be active to run the dgvm in -CLM. In this section, a general description of the dgvm processes and -how they integrate with CN are provided. Further details are available -in the CLM3DGVM Technical Note (Levis et al. 2004). The focus here is on -the differences relative to the corresponding processes in the CLM3DGVM. - -As with the CLM3DGVM, CNDV can simulate biogeographical changes only for -natural vegetation. Although the vegetated land unit may be separated -into naturally vegetated and human managed land units to permit a -coexistence of natural and human managed vegetation, CNDV only works if -the human managed land units are fixed. CLM’s transient land cover and -land use change capability (see Chapter 21), which permits transitions -between natural and human managed plant functional types (PFTs), is -incompatible with the CNDV option at this time. - -CNDV was implemented by introducing CLM3DGVM code to the hourly CN -framework only to the extent necessary to simulate annual biogeography -updates. This includes the annual processes of light competition, -establishment, and survival [see sections 2.7 and 2.10, Levis et al. -(2004)] as they pertain to the calculations of PFT cover (FPC) and -population (P) but not processes related to carbon pools, leaf area -index (LAI), or canopy height. In CNDV we added complexity to the gap -mortality calculation with annual heat stress and growth efficiency -considerations from the corresponding CLM3DGVM algorithm [section 2.8, -Levis et al. (2004)]. All other ecosystem processes (allocation, -phenology, fire, etc.) are handled by CN modules. Unlike in the -CLM3DGVM, in CNDV, annual biogeography updates are interpolated to -hourly intervals. - -Establishment and survival -------------------------------- +What has changed +---------------- + +- Deprecation of the dynamic global vegetation model (DGVM): The CLM5.0 model contains the legancy 'CNDV' code, which runs the CLM4(CN) model in combination with the LPJ-derived dynamics vegetation model introduced in CLM3. While this capacity has not technically been removed from the model, the DGVM has not been tested in the development of CLM5 and is no longer scientifically supported. + +- Introduction of FATES: The Functionally Assembled Terrestrial Ecosystem Simulator (FATES) is the actively developed DGVM for the CLM5. + + +Technical Documentation for FATES +================================== + + +Preamble +======== + +| This document is a technical appendix to +| Fisher RA, Muszala S, Verteinstein M, Lawrence P, Xu C, McDowell NG, + Knox RG, Koven C, Holm J, Rogers BM, Lawrence D. Taking off the + training wheels: the properties of a dynamic vegetation model without + climate envelopes. Geoscientific Model Development Discussions. 2015 + Apr 1;8(4). +| https://pdfs.semanticscholar.org/396c/b9f172cb681421ed78325a2237bfb428eece.pdf + +Authors +======= + +Rosie Fisher, Stefan Muszala, Mariana Verteinstein, Peter Lawrence, Chonggang Xu,Nate McDowell, Ryan Knox, Charles Koven, Jennifer Holm, Brendan Rogers, David Lawrence, and Gordon Bonan. + +Acknowledgements +================ + +The development of the ideas in this document has benefitted from +conversation with many people, including William Bond, Peter Cox, Matthew Forest, Andrew Fox, William Hoffman, Peter Lawrence, Jeremy Lichstein, Heike Lischke, Mark Lomas, Nathan McDowell, Paul Moorcroft, Colin Prentice, Drew Purves, Naomi Tague, Benjamin Sanderson, Stephen Sitch, Abigail Swann, Anthony Walker, Mathew Williams, F.Ian Woodward \& S\"onke Zaehle. + + +Introduction +============ + +The CLM(ED) model is presented here as an option within the structure of +the Community Land Model (CLM). Ecosystem Demography (‘ED’), is a +concept derived from the work of :raw-latex:`\cite{mc_2001}` and is a +cohort model of vegetation competition and co-existence, allowing a +representation of the biosphere which accounts for the division of the +land surface into successional stages, and the competition for light +between height structured cohorts of representative trees of various +plant functional types. This implementation of the Ecosystem Demography +concept links the surface flux and canopy physiology concepts in the CLM +with numerous additional developments necessary to accommodate the new +model also documented here. These include a version of the SPITFIRE +(Spread and InTensity of Fire) model of +:raw-latex:`\parencite{thonicke2010}`, and an adoption of the concept of +‘perfect plasticity’ approach of +:raw-latex:`\parencite{purves2008,lichstein2011,weng2014}` in accounting +for the spatial arrangement of crowns. Novel algorithms accounting for +the fragmentation of coarse woody debris into chemical litter streams, +for the physiological optimisation of canopy thickness, for the +accumulation of seeds in the seed bank, for multi-layer multi-PFT +radiation transfer, for drought-deciduous and cold-deciduous phenology, +for carbon storage allocation, and for tree mortality under carbon +stress, are also included and presented here. + +This Document +------------- + +This document describes the implementation of the Ecosystem Demography +concept within the Community Land Model. It is intended as a +supplementary document to the main CLM technical note, which is at the +time of writing, the CLM4.5 technical note +:raw-latex:`\parencite{oleson2013}`. The material covered describes how +the Ecosystem Demography code is organized, how it interacts with the +pre-existing CLM routines, and the new aspects of plant physiology and +vegetation dynamics that are introduced further to those already +existing within the model. Numerous other implementations of the +Ecosystem Demography concept are in existence, in particular the ED2 +model, which is a fully operational land surface scheme +:raw-latex:`\parencite{medvigy2009}` which contains both the basic ED +concept and an array of physiological and ecological innovations +surrounding the basic concept. Therefore, to avoid confusion between the +concept of ‘Ecosystem Demography’ and the implementation of this concept +in different models, we refer our model as the ‘CLM(ED)’ throughout. + +The representation of ecosystem heterogeneity in the CLM(ED) +============================================================ + +The land surface of the Earth is heterogeneous for many reasons, driven +by variations in climate, edaphic history, ecological variability, +geological forcing and human interventions. Land surface models +represent this variability first by introducing a grid structure to the +land surface, allowing different atmospheric forcings to operate in each +grid cell, and subsequently by representing ‘sub-grid’ variability in +the surface properties. In the CLM, the land surface is divided into +numerous ‘landunits’ corresponding to the underlying condition of the +surface (e.g. soils, ice, lakes, bare ground) and then ‘columns’ +referring to elements of the surface that share below ground resources +(water & nutrients). Within the ‘soil’ landunit, for example, there are +separate columns for crops, and for natural vegetation, as these are +assumed to use separate resource pools. The CLM(ED) model at present +only operates on the naturally vegetated column. The ‘soil’ column is +sub-divided into numerous tiles, that correspond to statistical +fractions of the potentially vegetated land area. In the CLM 4.5 (and +all previous versions of the model), sub-grid tiling operates on the +basis of plant functional types (PFTs). That is, each piece of land is +assumed to be occupied by only one plant functional type, with multiple +PFT-specific tiles sharing a common soil water and nutrient pool. This +PFT-based tiling structure is the standard method used by most land +surface models deployed in climate prediction. + +The introduction of the Ecosystem Demography concept introduces +significant alterations to the representation of the land surface in the +CLM. In the CLM(ED), the tiling structure represents the disturbance +history of the ecosystem. Thus, some fraction of the land surface is +characterized as ‘recently disturbed’, some fraction has escaped +disturbance for a long time, and other areas will have intermediate +disturbances. Thus the ED concept essentially discretizes the trajectory +of succession from disturbed ground to ‘mature’ ecosystems. Within the +ED code, each ‘disturbance history class’ is referred to as a ‘patch’. +The word ‘patch’ has many possible interpretations, so it is important +to note that: **there is no spatial location associated with the concept +of a ‘patch’. It refers to a fraction of the potential vegetated area +consisting of all parts of the ecosystem with similar disturbance +history.** + +The ‘patch’ organizational structure in CLM thus replaces the previous +‘PFT’ structure in the organization heirarchy. The original hierarchical +land surface organizational structure of CLM as described in +:raw-latex:`\cite{oleson2013}` may be depicted as: + +.. math:: + + \mathbf{gridcell} \left\{ + \begin{array}{cc} + \mathbf{landunit} & \\ + \mathbf{landunit} &\left\{ + \begin{array}{ll} + \mathbf{column}&\\ + \mathbf{column}&\left\{ + \begin{array}{ll} + \mathbf{pft}&\\ + \mathbf{pft}&\\ + \mathbf{pft}&\\ + \end{array}\right.\\ + \mathbf{column}&\\ + \end{array}\right.\\ + \mathbf{landunit} & \\ + \end{array}\right. + +and the new structure is altered to the following: + +.. math:: + + \mathbf{gridcell} \left\{ + \begin{array}{cc} + \mathbf{landunit} & \\ + \mathbf{landunit} &\left\{ + \begin{array}{ll} + \mathbf{column}&\\ + \mathbf{column}&\left\{ + \begin{array}{ll} + \mathbf{patch}&\\ + \mathbf{patch}&\\ + \mathbf{patch}&\\ + \end{array}\right.\\ + \mathbf{column}&\\ + \end{array}\right.\\ + \mathbf{landunit} & \\ + \end{array}\right. + +Thus, each gridcell becomes a matrix of ‘patches’ that are +conceptualized by their ‘age since disturbance’ in years. This is the +equivalent of grouping together all those areas of a gridcell that are +‘canopy gaps’, into a single entity, and all those areas that are +‘mature forest’ into a single entity. + +Cohortized representation of tree populations +--------------------------------------------- + +Each common-disturbance-history patch is a notional ecosystem that might +in reality contain numerous individual plants which vary in their +physiological attributes, in height and in spatial position. One way of +addressing this heterogeneity is to simulate a forest of specific +individuals, and to monitor their behavior through time. This is the +approach taken by ‘gap’ and individual-based +:raw-latex:`\parencite{smith2001,sato2007,uriarte2009,fyllas2014}`. The +depiction of individuals typically implies that the outcome of the model +is stochastic. This is because we lack the necessary detailed knowledge +to simulate the individual plant’s fates. Thus gap models imply both +stochastic locations and mortality of plants. Thus, (with a genuinely +random seed) each model outcome is different, and an ensemble of model +runs is required to generate an average representative solution. Because +the random death of large individual trees can cause significant +deviations from the mean trajectory for a small plot (a typical +simulated plot size is 30m x 30 m) the number of runs required to +minimize these deviations is large and computationally expensive. For +this reason, models that resolve individual trees typically use a +physiological timestep of one day or longer (e.g. +:raw-latex:`\cite{smith2001,xiaodong2005,sato2007}` + +The approach introduced by the Ecosystem Demography model +:raw-latex:`\parencite{mc_2001}` is to group the hypothetical population +of plants into ‘cohorts’. In the notional ecosystem, after the +land-surface is divided into common-disturbance-history patches, the +population in each patch is divided first into plant functional types +(the standard approach to representing plant diversity in large scale +vegetation models), and then each plant type is represented as numerous +height classes. Importantly, **for each PFT/height class bin, we model +*one* representative individual plant, which tracks the average +properties of this ‘cohort’ of individual plants.** Thus, each +common-disturbance-history patch is typically occupied by a set of +cohorts of different plant functional types, and different height +classes within those plant functional types. Each cohort is associated +with a number of identical trees, :math:`n_{coh}` (where :math:`{coh}` +denotes the identification or index number for a given cohort).. + +The complete hierarchy of elements in the CLM(ED) is therefore now +described as follows: + +.. math:: + + \mathbf{gridcell}\left\{ + \begin{array}{cc} + \mathbf{landunit} & \\ + \mathbf{landunit} &\left\{ + \begin{array}{ll} + \mathbf{column}&\\ + \mathbf{column}&\left\{ + \begin{array}{ll} + \mathbf{patch}&\\ + \mathbf{patch}&\left\{ + \begin{array}{ll} + \mathbf{cohort}&\\ + \mathbf{cohort}&\\ + \mathbf{cohort}&\\ + \end{array}\right.\\ + \mathbf{patch}&\\ + \end{array}\right.\\ + \mathbf{column}&\\ + \end{array}\right.\\ + \mathbf{landunit} & \\ + \end{array}\right. + +Discretization of cohorts and patches +------------------------------------- + +Newly disturbed land and newly recruited seedlings can in theory be +generated at each new model timestep as the result of germination and +disturbance processes. If the new patches and cohorts established at +*every* timestep were tracked by the model structure, the computational +load would of course be extremely high (and thus equivalent to an +individual-based approach). A signature feature of the ED model is the +system by which ‘functionally equivalent’ patches and cohorts are fused +into single model entities to save memory and computational time. + +[1]_ This functionality requires that criteria are established for the +meaning of `functional equivalence’, which are by necessity slightly +subjective, as they represent ways of abstracting reality into a more +tractable mathematical representation. As an example of this, for +height-structured cohorts, we calculate the relativized differences in +height (:math:`h_{coh}`, m) between two cohorts of the same pft, +:math:`p` and :math:`q` as + +.. math:: d_{hite,p,q} = \frac{\mathrm{abs}.(h_{p-}h_{q})}{\frac{1}{2}(h_{p}+h_{q})} + +If :math:`d_{hite,p,q}` is smaller than some threshold :math:`t_{ch}`, +and they are of the same plant functional type, the two cohorts are +considered equivalent and merged to form a third cohort :math:`r`, with +the properties of cohort :math:`p` and :math:`q` averaged such that they +conserve mass. The model parameter :math:`t_{ch}` can be adjusted to +adjust the trade-off between simulation accuracy and computational load. +There is no theoretical optimal value for this threshold but it may be +altered to have finer or coarser model resolutions as needed. + +[2]_ Similarly, for common-disturbance-history patches, we again assign +a threshold criteria, which is then compared to the difference between +patches :math:`m` and :math:`n`, and if the difference is less than some +threshold value (:math:`t_{p}`) then patches are merged together, +otherwise they are kept separate. However, in contrast with +height-structured cohorts, where the meaning of the difference criteria +is relatively clear, how the landscape should be divided into +common-disturbance-history units is less clear. Several alternative +criteria are possible, including Leaf Area Index, total biomass and +total stem basal area. + +In this implementation of the CLM(ED) we assess the amount of +above-ground biomass in each PFT/plant diameter bin. Biomass is first +grouped into fixed diameter bins for each PFT (:math:`ft`) and a +significant difference in any bin will cause patches to remain +separated. This means that if two patches have similar total biomass, +but differ in the distribution of that biomass between diameter classes +or plant types, they remain as separate entities. Thus + +.. math:: B_{profile,m,dc,ft} = \sum_{d_{c,min}}^{d_{c,max}} (B_{ag,coh}n_{coh}) + +:math:`B_{profile,m,dc,ft}` is the binned above-ground biomass profile +for patch :math:`m`,\ :math:`d_{c}` is the diameter class. +:math:`d_{c,min}` and :math:`d_{c,max}` are the lower and upper +boundaries for the :math:`d_{c}` diameter class. :math:`B_{ag,coh}` and +:math:`n_{coh}` depict the biomass (KgC m\ :math:`^{-2}`) and the number +of individuals of each cohort respectively. A difference matrix between +patches :math:`m` and :math:`n` is thus calculated as + +.. math:: d_{biomass,mn,dc,ft} = \frac{\rm{abs}\it(B_{profile,m,hc,ft}-B_{profile,n,hc,ft})}{\frac{1}{2}(B_{profile,m,hc,ft}+B_{profile,n,hc,ft})} + +If all the values of :math:`d_{biomass,mn,hc,ft}` are smaller than the +threshold, :math:`t_{p}`, then the patches :math:`m` and :math:`n` are +fused together to form a new patch :math:`o`. + +To increase computational efficiency and to simplify the coding +structure of the model, the maximum number of patches is capped at +:math:`P_{no,max}`. To force the fusion of patches down to this number, +the simulation begins with a relatively sensitive discretization of +patches (:math:`t_{p}` = 0.2) but if the patch number exceeds the +maximum, the fusion routine is repeated iteratively until the two most +similar patches reach their fusion threshold. This approach maintains an +even discretization along the biomass gradient, in contrast to, for +example, simply fusing the oldest or youngest patches together. + +[3]_ The area of the new patch (:math:`A_{patch,o}`, m\ :math:`^{2}`) +is the sum of the area of the two existing patches, + +.. math:: A_{patch,o} = A_{patch,n} + A_{patch,m} + +and the cohorts ‘belonging’ to patches :math:`m` and :math:`n` now +co-occupy patch :math:`o`. The state properties of :math:`m` and +:math:`n` (litter, seed pools, etc. ) are also averaged in accordance +with mass conservation . + +Linked Lists: the general code structure of CLM(ED) +--------------------------------------------------- + +[4]_ The number of patches in each natural vegetation column and the +number of cohorts in any given patch are variable through time because +they are re-calculated for each daily timestep of the model. The more +complex an ecosystem, the larger the number of patches and cohorts. For +a slowly growing ecosystem, where maximum cohort size achieved between +disturbance intervals is low, the number of cohorts is also low. For +fast-growing ecosystems where many plant types are viable and maximum +heights are large, more cohorts are required to represent the ecosystem +with adequate complexity. + +In terms of variable structure, the creation of an array whose size +could accommodate every possible cohort would mean defining the maximum +potential number of cohorts for every potential patch, which would +result in very large amounts of wasted allocated memory, on account of +the heterogeneity in the number of cohorts between complex and simple +ecosystems (n.b. this does still happen for some variables at restart +timesteps). To resolve this, the cohort structure in the CLM(ED) model +does not use an array system for internal calculations. Instead it uses +a system of *linked lists* where each cohort structure is linked to the +cohorts larger than and smaller than itself using a system of pointers. +The shortest cohort in each patch has a ‘shorter’ pointer that points to +the *null* value, and the tallest cohort has a ‘taller’ pointer that +points to the null value. + +Instead of iterating along a vector indexed by :math:`coh`, the code +structures typically begin at the tallest cohort in a given patch, and +iterate until a null pointer is encountered. + +Using this structure, it is therefore possible to have an unbounded + upper limit on cohort number, and also to easily alter the ordering of + cohorts if, for example, a cohort of one functional type begins to + grow faster than a competitor of another functional type, and the + cohort list can easily be re-ordered by altering the pointer + structure. Each cohort has `pointers` indicating to which patch and + gridcell it belongs. The patch system is analogous to the cohort + system, except that patches are ordered in terms of their relative age, with + pointers to older and younger patches where cp\ :math:`_1` is the + oldest: + + +Indices used in CLM(ED) +----------------------- + +Some of the indices used in the CLM(ED) are similar to those used in the +standard CLM4.5 model; column (:math:`c`), land unit(\ :math:`l`), grid +cell(\ :math:`g`) and soil layer (:math:`j`). On account of the +additional complexity of the new representation of plant function, +several additional indices are introduced that describe the +discritization of plant type, fuel type, litter type, plant height, +canopy identity, leaf vertical structure and fuel moisture +characteristics. To provide a reference with which to interpret the +equations that follow, they are listed here. + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{Table of subscripts used in this document } + ++------------------+-----------------------+ +| Parameter Symbol | Parameter Name | ++==================+=======================+ +| *ft* | Plant Functional Type | ++------------------+-----------------------+ +| *fc* | Fuel Class | ++------------------+-----------------------+ +| *lsc* | Litter Size Class | ++------------------+-----------------------+ +| *coh* | Cohort Index | ++------------------+-----------------------+ +| *patch* | Patch Index | ++------------------+-----------------------+ +| *Cl* | Canopy Layer | ++------------------+-----------------------+ +| *z* | Leaf Layer | ++------------------+-----------------------+ +| *mc* | Moisture Class | ++------------------+-----------------------+ + +.. raw:: latex + + \bigskip -The PFT distribution in the vegetated land unit is typically prescribed -in CLM (see section 2.1.2) except for the case when CNDV is active. In -CNDV the model begins with no PFT information per grid cell and -evaluates whether or not a PFT may establish or survive according to the -PFT’s bioclimatic limits (:numref:`Table Plant functional type (PFT) biogeography rules`). Shrub PFTs are treated as trees -at establishment. - -CNDV omits the CLM3DGVM’s annual introduction of saplings when a PFT can -establish. The CLM3DGVM merged sapling carbon pools with a PFT’s -existing carbon. The resultant leaf carbon (annual maximum value) would -update the FPC, i.e. the foliar projective cover or fraction of the -vegetated land unit occupied by the PFT [section 2.10, Levis et al. -(2004)]. Instead, CNDV updates the FPC using the PFT’s annual maximum -leaf carbon without an addition from saplings. For newly established -PFTs, CNDV assigns seed leaf carbon equal to 1 g C m\ :sup:`-2` of -land unit area and seed FPC equal to 0.05 for grasses and 0.000844 for -trees (values determined from CLM3DGVM simulations). The addition of -establishing individuals to *P*, a PFT’s population, is handled as in -the CLM3DGVM. - -*FPC* changes annually as in the CLM3DGVM but now is interpolated to an -hourly increment using the algorithms designed to conserve energy and -mass in the CLM’s dynamic land use option. - -Light competition +Cohort State Variables ---------------------- -In CNDV’s order of annual processes, light competition is invoked before -establishment and survival. However, light competition does not affect a -simulation starting from bare ground until the vegetation fills the land -unit (a few years at least). - -Light competition starts with a calculation updating *FPC*. For -reference, this update was included at the end of allocation in the -CLM3DGVM [section 2.6, Levis et al. (2004)]. - -Due to their height advantage, trees will cover up to 95% of the land -unit when their productivity permits, as in the CLM3DGVM, regardless of -grass and shrub productivity. Grasses get second priority, as in the -CLM3DGVM, even with shrubs included now. Shrubs, then, have access to -the remaining space and follow the tree algorithm for self thinning -[section 2.7, Levis et al. (2004)]. As a result, trees typically -dominate in the most productive regions, grasses in less productive -regions, and shrubs in the least productive non-desert regions (Zeng et -al. 2008). - -CN processes modified for the CNDV coupling ------------------------------------------------- - -Gap mortality and mortality from fire: Constant annual mortality rate of -0.02 is changed for trees and shrubs to an annual rate calculated as in -the CLM3DGVM accounting for background and stress mortality [section -2.8, Levis et al. (2004)]. The CN module converts the annual rate to -hourly. - -The CLM3DGVM used the concepts of average plant individual and PFT -population, *P*. CNDV retains these concepts in the light competition, -establishment, and survival calculations. In CNDV we account for the -individuals removed hourly from *P* in response to CN’s fire and gap -mortality, while the carbon pools per individual and FPC remain -constant. Ultimately, *P* updates should only affect the annual -processes of light competition, establishment, and survival, so the *P* -update may be moved to the end of the year in a future version of CNDV. - -Vegetation Structure Update: CN stocking is a constant, while in CNDV -stocking changes as P and FPC change. This affects the top-of-canopy -height calculation. CN specific leaf area and stem diameter calculations -are kept, while the height calculation is replaced with the CLM3DGVM’s -[section 2.6, Levis et al. (2004)]. CN stem area index (SAI) is kept. - -Allocation: CN calculates a PFT’s fraction of currently allocated carbon -relative to the total allocation instead of obtaining a constant value -from CLM’s PFT-physiology file. In CNDV, we returned to the constant -values in the old PFT-physiology file to get a reasonable simulation of -PFTs. For CNDV to use the calculated fraction, we will need to change -the algorithm for PFTs in early stages of growth. - -.. _Table Plant functional type (PFT) biogeography rules: - -.. table:: Plant functional type (PFT) biogeography rules with respect to climate. - - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | | Survival | | | | - +=============================================+==============================================+==============================================+=========================+========+ - | | :math:`{T}_{c,min}` (:math:`\circ`\ C) | :math:`{T}_{c,max}` (:math:`\circ`\ C) | :math:`{GDD}_{min}` | | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Tropical broadleaf evergreen tree (BET) | | 15.5 | No limit | 0 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Tropical broadleaf deciduous tree (BDT) | | 15.5 | No limit | 0 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Temperate needleleaf evergreen tree (NET) | | -2.0 | 22.0 | 900 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Temperate broadleaf evergreen tree (BET) | | 3.0 | 18.8 | 1200 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Temperate broadleaf deciduous tree (BDT) | | -17.0 | 15.5 | 1200 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Boreal needleleaf evergreen tree (NET) | | -32.5 | -2.0 | 600 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Boreal deciduous tree | | No limit | -2.0 | 350 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Temperate broadleaf deciduous shrub (BDS) | | -17.0 | No limit | 1200 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | Boreal broadleaf deciduous shrub (BDS) | | No limit | -2.0 | 350 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | C\ :sub:`4` | | 15.5 | No limit | 0 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | C\ :sub:`3` | | -17.0 | 15.5 | 0 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - | C\ :sub:`3` arctic | | No limit | -17.0 | 0 | - +---------------------------------------------+----------------------------------------------+----------------------------------------------+-------------------------+--------+ - -Adapted from Table 1 of Levis et al. (2004) to include shrub PFTs. -:math:`T_{c,\min }` , coldest minimum monthly air temperature for -survival of previously established PFTs; :math:`T_{c,\max }` , warmest -minimum monthly air temperature for establishment of new PFTs; -:math:`GDD_{\min }` , minimum annual growing degree-days above -5\ :math:`{}^\circ`\ C for establishment of new PFTs. Levis et al. -(2004) include an explanation of these variables and their use. +The unit of allometry in the ED model is the cohort. Each cohort +represents a group of plants with similar functional types and heights +that occupy portions of column with similar disturbance histories. The +state variables of each cohort therefore consist of several pieces of +information that fully describe the growth status of the plant and its +position in the ecosystem structure, and from which the model can be +restarted. The state variables of a cohort are as follows: + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{State Variables of `cohort' sructure} + ++-----------------+-----------------+-----------------+-----------------+ +| Quantity | Variable name | Units | Notes | ++=================+=================+=================+=================+ +| Plant | :math:`{\it{ft} | integer | | +| Functional Type | _{coh}}` | | | ++-----------------+-----------------+-----------------+-----------------+ +| Number of | :math:`n_{coh}` | n per | | +| Individuals | | 10000m\ :math:` | | +| | | ^{-2}` | | ++-----------------+-----------------+-----------------+-----------------+ +| Height | :math:`h_{coh}` | m | | ++-----------------+-----------------+-----------------+-----------------+ +| Diameter | :math:`\it{dbh_ | cm | | +| | {coh}}` | | | ++-----------------+-----------------+-----------------+-----------------+ +| Structural | :math:`{b_{stru | KgC | Stem wood | +| Biomass | c,coh}}` | plant\ :math:`^ | (above and | +| | | {-1}` | below ground) | ++-----------------+-----------------+-----------------+-----------------+ +| Alive Biomass | :math:`{b_{aliv | KgC | Leaf, fine root | +| | e,coh}}` | plant\ :math:`^ | and sapwood | +| | | {-1}` | | ++-----------------+-----------------+-----------------+-----------------+ +| Stored Biomass | :math:`{b_{stor | KgC | Labile carbon | +| | e,coh}}` | plant\ :math:`^ | reserve | +| | | {-1}` | | ++-----------------+-----------------+-----------------+-----------------+ +| Leaf memory | :math:`{l_{memo | KgC | Leaf mass when | +| | ry,coh}}` | plant\ :math:`^ | leaves are | +| | | {-1}` | dropped | ++-----------------+-----------------+-----------------+-----------------+ +| Canopy Layer | :math:`{C_{l,co | integer | 1 = top layer | +| | h}}` | | | ++-----------------+-----------------+-----------------+-----------------+ +| Phenological | :math:`{S_{phen | integer | 1=leaves off. | +| Status | ,coh}}` | | 2=leaves on | ++-----------------+-----------------+-----------------+-----------------+ +| Canopy trimming | :math:`C_{trim, | fraction | 1.0=max leaf | +| | coh}` | | area | ++-----------------+-----------------+-----------------+-----------------+ +| Patch Index | :math:`{p_{coh} | integer | To which patch | +| | }` | | does this | +| | | | cohort belong? | ++-----------------+-----------------+-----------------+-----------------+ + +Patch State Variables +--------------------- + +A patch, as discuss earlier, is a fraction of the landscape which +contains ecosystems with similar structure and disturbance history. A +patch has no spatial location. The state variables, which are +‘ecosystem’ rather than ‘tree’ scale properties, from which the model +can be restarted, are as follows + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{State variables of `patch' structure} + ++-------------+-------------+-------------+-------------+-------------+ +| Quantity | Variable | Units | Indexed By | | +| | name | | | | ++=============+=============+=============+=============+=============+ +| Area | :math:`\it{ | m\ :math:`^ | - | | +| | A_{patch}}` | {2}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| Age | :math:`age_ | years | - | | +| | {patch}` | | | | ++-------------+-------------+-------------+-------------+-------------+ +| Seed | :math:`seed_| KgC | :math:`ft` | | +| | {patch}` | m\ :math:`^ | | | +| | | {-2}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| Leaf Litter | :math:`l_{l | KgC | :math:`ft` | | +| | itter,patch | m\ :math:`^ | | | +| | }` | {-2}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| Root Litter | :math:`r_{l | KgC | :math:`ft` | | +| | itter,patch | m\ :math:`^ | | | +| | }` | {-2}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| AG Coarse | :math:` | KgC | Size Class | | +| Woody | {CWD}_{A | m\ :math:`^ | (lsc) | | +| Debris | G,patch}` | {-2}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| BG Coarse | :math:` | KgC | Size Class | | +| Woody | {CWD}_{B | m\ :math:`^ | (lsc) | | +| Debris | G,patch}` | {-2}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| Canopy | :math:`S_{c | - | Canopy | | +| Spread | ,patch}` | | Layer | | ++-------------+-------------+-------------+-------------+-------------+ +| Column | :math:`{l_{ | integer | - | | +| Index | patch}}` | | | | ++-------------+-------------+-------------+-------------+-------------+ + +.. raw:: latex + + \bigskip + +Model Structure +--------------- + +Code concerned with the Ecosystem Demography model interfaces with the +CLM model in four ways: i) During initialization, ii) During the +calculation of surface processes (albedo, radiation absorption, canopy +fluxes) each model time step (typically half-hourly), iii) During the +main invokation of the ED model code at the end of each day. Daily +cohort-level NPP is used to grow plants and alter the cohort structures, +disturbance processes (fire and mortality) operate to alter the patch +structures, and all fragmenting carbon pool dynamics are calculated. iv) +during restart reading and writing. The net assimilation (NPP) fluxes +attributed to each cohort are accumulated throughout each daily cycle +and passed into the ED code as the major driver of vegetation dynamics. + +Initialization of vegetation from bare ground +============================================= + +[5]_If the model is restarted from a bare ground state (as opposed to a +pre-existing vegetation state), the state variables above are +initialized as follows. First, the number of plants per PFT is allocated +according to the initial seeding density (:math:`S_{init}`, individuals +per m\ :math:`^{2}`) and the area of the patch :math:`A_{patch}`, which +in the first timestep is the same as the area of the notional ecosystem +:math:`A_{tot}`. The model has no meaningful spatial dimension, but we +assign a notional area such that the values of ‘:math:`n_{coh}`’ can be +attributed. The default value of :math:`A_{tot}` is one hectare (10,000 +m\ :math:`^{2}`), but the model will behave identically irrepective of +the value of this parameter. + +.. math:: n_{coh,0} = S_{init}A_{patch} + +Each cohort is initialized at the minimum canopy height +:math:`h_{min,ft}`, which is specified as a parameter for each plant +functional type and denotes the smallest size of plant which is tracked +by the model. Smaller plants are not considered, and their emergence +from the recruitment processes is unresolved and therefore implicitly +parameterized in the seedling establishment model.. The diameter of each +cohort is then specified using the log-linear allometry between stem +diameter and canopy height + +.. math:: \mathit{dbh}_{coh} = 10^{\frac{\log_{10}(h_{coh}) - c_{allom}}{m_{allom}} } + +where the slope of the log-log relationship, :math:`m_{allom}` is 0.64 +and the intercept :math:`c_{allom}` is 0.37. The structural biomass +associated with a plant of this diameter and height is given (as a +function of wood density, :math:`\rho`, g cm\ :math:`^{-3}`) + +.. math:: b_{struc,coh} =c_{str}h_{coh}^{e_{str,hite}} dbh_{coh}^{e_{str,dbh}} \rho_{ft}^{e_{str,dens}} + +taken from the original ED1.0 allometry +:raw-latex:`\parencite{mc_2001}` (values of the allometric constants in +Table `[table:allom] <#table:allom>`__. The maximum amount of leaf +biomass associated with this diameter of tree is calculated according to +the following allometry + +.. math:: b_{max,leaf,coh} =c_{leaf}\it{dbh}_{coh}^{e_{leaf,dbh}} \rho_{ft}^{e_{leaf,dens}} + +from this quantity, we calculate the active/fine root biomass +:math:`b_{root,coh}` as + +.. math:: b_{root,coh} = b_{max,leaf,coh}\cdot f_{frla} + +where :math:`f_{frla}` is the fraction of fine root biomass to leaf +biomass, assigned per PFT + +.. raw:: latex + + \captionof{table}{Parameters needed for model initialization.} + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | Default Value | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`h_{min}` | Minimum plant | m | 1.5 | +| | height | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`S_{init}`| Initial | Individuals | | +| | Planting | m\ :math:`^{-2}`| | +| | density | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`A_{tot}` | Model area | m\ :math:`^{2}` | 10,000 | ++-----------------+-----------------+-----------------+-----------------+ + +[table:init] + +Allocation of live biomass to leaves roots and sapwood +------------------------------------------------------ + +[6]_Total live biomass :math:`b_{alive}` is the state variable of the model +that describes the sum of the three live biomass pools leaf +:math:`b_{leaf}`, root :math:`b_{root}` and sapwood :math:`b_{sw}` (all +in kGC individual\ :math:`^{-1}`). The quantities are constrained by the +following + +.. math:: b_{alive} = b_{leaf} + b_{root} + b_{sw} + +Sapwood volume is a function of tree height and leaf biomass + +.. math:: b_{sw} = b_{leaf}\cdot h_{coh}\cdot f_{swh} + +where :math:`f_{swh}` is the ratio of sapwood mass (kgC) to leaf mass +per unit tree height (m). Also, root mass is a function of leaf mass + +.. math:: b_{root} = b_{leaf}\cdot f_{swh} + +Thus + +.. math:: b_{alive} = b_{leaf} + b_{leaf}\cdot f_{frla} + b_{leaf}\cdot h_{coh}\cdot f_{swh} + +Rearranging gives the fraction of biomass in the leaf pool +:math:`f_{leaf}` as + +.. math:: f_{leaf} = \frac{1}{1+h_{coh}\cdot f_{swh}+f_{frla} } + +Thus, we can determine the leaf fraction from the height at the tissue +ratios, and the phenological status of the cohort :math:`S_{phen,coh}`. + +.. math:: b_{leaf} = b_{alive} \cdot l _{frac} + +To divide the live biomass pool at restart, or whenever it is +recalculated, into its consituent parts, we first + +.. math:: + + b_{leaf} = \left\{ \begin{array}{ll} + b_{alive} \cdot l _{frac}&\textrm{for } S_{phen,coh} = 1\\ + &\\ + 0&\textrm{for } S_{phen,coh} = 0\\ + \end{array} \right. + +Because sometimes the leaves are dropped, using leaf biomass as a +predictor of root and sapwood would produce zero live biomass in the +winter. To account for this, we add the LAI memory variable +:math:`l_{memory}` to the live biomass pool to account for the need to +maintain root biomass when leaf biomass is zero. Thus, to calculated the +root biomass, we use + +.. math:: b_{root} = (b_{alive}+l_{memory})\cdot l_{frac} \cdot f_{frla} + +To calculated the sapwood biomass, we use + +.. math:: b_{sw} = (b_{alive}+l_{memory})\cdot l_{frac} \cdot f_{swh} \cdot h_{coh} + +.. raw:: latex + + \captionof{table}{Allometric Constants} + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | Default Value | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`c_{allom | Allometry | | 0.37 | +| }` | intercept | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`m_{allom | Allometry slope | | 0.64 | +| }` | | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`c_{str}` | Structural | | 0.06896 | +| | biomass | | | +| | multiplier | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`e_{str,d | Structural | | 1.94 | +| bh}` | Biomass dbh | | | +| | exponent | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`e_{str,h | Structural | | 0.572 | +| ite}` | Biomass height | | | +| | exponent | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`e_{str,d | Structural | | 0.931 | +| ens}` | Biomass density | | | +| | exponent | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`c_{leaf}`| Leaf biomass | | 0.0419 | +| | multiplier | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`e_{leaf, | Leaf biomass | | 1.56 | +| dbh}` | dbh exponent | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`e_{leaf, | Leaf biomass | | 0.55 | +| dens}` | density | | | +| | exponent | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{swh}` | Ratio of | m\ :math:`^{-1}`| | +| | sapwood mass to | | | +| | height | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{frla}`| Ratio of fine | - | 1.0 | +| | root mass to | | | +| | leaf mass | | | ++-----------------+-----------------+-----------------+-----------------+ + +[table:allom] + +Canopy Structure and the Perfect Plasticity Approximation +========================================================= + + [7]_ + +During initialization and every subsequent daily ED timestep, the canopy +structure model is called to determine how the leaf area of the +different cohorts is arranged relative to the incoming radiation, which +will then be used to drive the radiation and photosynthesis +calculations. This task requires that some assumptions are made about 1) +the shape and depth of the canopy within which the plant leaves are +arranged and 2) how the leaves of different cohorts are arranged +relative to each other. This set of assumptions are critical to model +performance in ED-like cohort based models, since they determine how +light resources are partitioned between competing plants of varying +heights, which has a very significant impact on how vegetation +distribution emerges from competition +:raw-latex:`\parencite{fisher2010}`. + +The standard ED1.0 model makes a simple ’flat disk’ assumption, that the +leaf area of each cohort is spread in an homogenous layer at one exact +height across entire the ground area represented by each patch. The +CLM(ED) model has diverged from this representation due to (at least) +two problematic emergent properties that we identified as generating +unrealistic behaviours espetially for large-area patches. + +1. Over-estimation of light competition . The vertical stacking of +cohorts which have all their leaf area at the same nominal height means +that when one cohort is only very slightly taller than it’s competitor, +it is completely shaded by it. This means that any small advantage in +terms of height growth translates into a large advantage in terms of +light competition, even at the seedling stage. This property of the +model artificially exaggerates the process of light competition. In +reality, trees do not compete for light until their canopies begin to +overlap and canopy closure is approached. + +2. Unrealistic over-crowding. The ‘flat-disk’ assumption has no +consideration of the spatial extent of tree crowns. Therefore it has no +control on the packing density of plants in the model. Given a mismatch +between production and mortality, entirely unrealistic tree densities +are thus possible for some combinations of recruitment, growth and +mortality rates. + +To account for the filling of space in three dimensions using the +one-dimensional representation of the canopy employed by CLM, we +implement a new scheme derived from that of +:raw-latex:`\cite{purves2008}`. Their argument follows the development +of an individual-based variant of the SORTIE model, called SHELL, which +allows the location of individual plant crowns to be highly flexible in +space. Ultimately, the solutions of this model possess an emergent +property whereby the crowns of the plants simply fill all of the +available space in the canopy before forming a distinct understorey. + +Purves et al. developed a model that uses this feature, called the +‘perfect plasticity approximation’, which assumes the plants are able to +perfectly fill all of the available canopy space. That is, at canopy +closure, all of the available horizontal space is filled, with +negligible gaps, owing to lateral tree growth and the ability of tree +canopies to grow into the available gaps (this is of course, an +over-simplified but potential useful ecosystem property). The ‘perfect +plasticity approximation’ (PPA) implies that the community of trees is +subdivided into discrete canopy layers, and by extension, each cohort +represented by the CLM(ED) model is assigned a canopy layer status flag, +:math:`C_L`. In this version, we set the maximum number of canopy layers +at 2 for simplicity, although is possible to have a larger number of +layers in theory. :math:`C_{L,coh}` = 1 means that all the trees of +cohort :math:`coh` are in the upper canopy (overstory), and +:math:`C_{L,coh}` = 2 means that all the trees of cohort :math:`coh` are +in the understorey. + +In this model, all the trees in the canopy experience full light on +their uppermost leaf layer, and all trees in the understorey experience +the same light (full sunlight attenuated by the average LAI of the upper +canopy) on their uppermost leaves, as described in the radiation +transfer section (more nuanced versions of this approach may be +investigated in future model versions). The canopy is assumed to be +cylindrical, the lower layers of which experience self-shading by the +upper layers. + +To determine whether a second canopy layer is required, the model needs +to know the spatial extent of tree crowns. Crown area, +:math:`A_{crown}`, m\ :math:`^{2}`, is defined as + +.. math:: A_{crown,coh} = \pi (dbh_{coh} S_{c,patch,Cl})^{1.56} + +where :math:`A_{crown}` is the crown area of a single tree canopy +(m:math:`^{-2}`) and :math:`S_{c,patch,Cl}` is the ‘canopy spread’ +parameter (m cm^-1) of this canopy layer, which is assigned as a +function of canopy space filling, discussed below. In contrast to +:raw-latex:`\cite{purves2008}` , we use an exponent, identical to that +for leaf biomass, of 1.56, not 2.0, such that tree leaf area index does +not change as a function of diameter. + +To determine whether the canopy is closed, we calculate the total canopy +area as: + +.. math:: A_{canopy} = \sum_{coh=1}^{nc,patch}{A_{crown,coh}.n_{coh}} + +where :math:`nc_{patch}` is the number of cohorts in a given patch. If +the area of all crowns :math:`A_{canopy}` (m:math:`^{-2}`) is larger +than the total ground area of a patch (:math:`A_{patch}`), then some +fraction of each cohort is demoted to the understorey. + +Under these circumstances, the ‘extra’ crown area :math:`A_{loss}` +(i.e., :math:`A_{canopy}` - :math:`A_p`) is moved into the understorey. +For each cohort already in the canopy, we determine a fraction of trees +that are moved from the canopy (:math:`L_c`) to the understorey. +:math:`L_c` is calculated as :raw-latex:`\cite{fisher2010}` + +.. math:: L_{c}= \frac{A_{loss,patch} w_{coh}}{\sum_{coh=1}^{nc,patch}{w_{coh}}} , + +where :math:`w_{coh}` is a weighting of each cohort determined by basal +diameter :math:`dbh` (cm) and the competitive exclusion coefficient +:math:`C_{e}` + +.. math:: w_{coh}=dbh_{coh}C_{e}. + +The higher the value of :math:`C_e` the greater the impact of tree +diameter on the probability of a given tree obtaining a position in the +canopy layer. That is, for high :math:`C_e` values, competition is +highly deterministic. The smaller the value of :math:`C_e`, the greater +the influence of random factors on the competitive exclusion process, +and the higher the probability that slower growing trees will get into +the canopy. Appropriate values of :math:`C_e` are poorly constrained but +alter the outcome of competitive processes. + +The process by which trees are moved between canopy layers is complex +because 1) the crown area predicted for a cohort to lose may be larger +than the total crown area of the cohort, which requires iterative +solutions, and 2) on some occasions (e.g. after fire), the canopy may +open up and require ‘promotion’ of cohorts from the understorey, and 3) +canopy area may change due to the variations of canopy spread values ( +:math:`S_{c,patch,Cl}`, see the section below for details) when +fractions of cohorts are demoted or promoted. Further details can be +found in the code references in the footnote. + +Horizontal Canopy Spread +------------------------ + + [8]_ + +:raw-latex:`\cite{purves2008}` estimated the ratio between canopy and +stem diameter :math:`c_{p}` as  0.1 m cm\ :math:`^{-1}` for canopy trees +in North American forests, but this estimate was made on trees in closed +canopies, whose shape is subject to space competition from other +individuals. Sapling trees have no constraints in their horizontal +spatial structure, and as such, are more likely to display their leaves +to full sunlight. Also, prior to canopy closure, light interception by +leaves on the sides of the canopy is also higher than it would be in a +closed canopy forest. If the ‘canopy spread’ parameter is constant for +all trees, then we simulate high levels of self-shading for plants in +unclosed canopies, which is arguably unrealistic and can lower the +productivity of trees in areas of unclosed canopy (e.g. low productivity +areas of boreal or semi-arid regions where LAI and canopy cover might +naturally be low). We here interpret the degree of canopy spread, +:math:`S_{c}` as a function of how much tree crowns interfere with each +other in space, or the total canopy area :math:`A_{canopy}`. However +:math:`A_{canopy}` itself is a function of :math:`S_{c}`, leading to a +circularity. :math:`S_{c}` is thus solved iteratively through time. + +Each daily model step, :math:`A_{canopy}` and the fraction of the +gridcell occupied by tree canopies in each canopy layer +(:math:`A_{f,Cl}` = :math:`A_{canopy,Cl}`/:math:`A_{patch}`) is +calculated based on :math:`S_{c}` from the previous timestep. If +:math:`A_{f}` is greater than a threshold value :math:`A_{t}`, +:math:`S_{c}` is increased by a small increment :math:`i`. The threshold +:math:`A_{t}` is, hypothetically, the canopy fraction at which light +competition begins to impact on tree growth. This is less than 1.0 owing +to the non-perfect spatial spacing of tree canopies. If :math:`A_{f,Cl}` +is greater than :math:`A_{t}`, then :math:`S_{c}` is reduced by an +increment :math:`i`, to reduce the spatial extent of the canopy, thus. + +.. math:: + + S_{c,patch,Cl,t+1} = \left\{ \begin{array}{ll} + S_{c,patch,Cl,t} + i& \textrm{for $A_{f,Cl} < A_{t}$}\\ + &\\ + S_{c,patch,Cl,t} - i& \textrm{for $A_{f,Cl} > A_{t}$}\\ + \end{array} \right. + +The values of :math:`S_{c}` are bounded to upper and lower limits. The +lower limit corresponds to the observed canopy spread parameter for +canopy trees :math:`S_{c,min}` and the upper limit corresponds to the +largest canopy extent :math:`S_{c,max}` + +.. math:: + + S_{c,patch,Cl} = \left\{ \begin{array}{ll} + S_{c,min}& \textrm{for } S_{c,patch,Cl}< S_{c,\rm{min}}\\ + &\\ + S_{c,max}& \textrm{for } S_{c,patch,Cl} > S_{c,\rm{max}}\\ + \end{array} \right. + +This iterative scheme requires two additional parameters (:math:`i` and +:math:`A_{t}`). :math:`i` affects the speed with which canopy spread +(and hence leaf are index) increase as canopy closure is neared. +However, the model is relatively insensitive to the choice of either +:math:`i` or :math:`A_{t}`. + +Definition of Leaf Area Profile +------------------------------- + + [9]_ + +Within each patch, the model defines and tracks cohorts of multiple +plant functional types that exist either in the canopy or understorey. +Light on the top leaf surface of each cohort in the canopy is the same, +and the rate of decay through the canopy is also the same for each PFT. +Therefore, we accumulate all the cohorts of a given PFT together for the +sake of the radiation and photosynthesis calculations (to avoid separate +calculations for every cohort). + +Therefore, the leaf area index for each patch is defined as a +three-dimensional array :math:`\mathit{lai}_{Cl,ft,z}` where :math:`C_l` +is the canopy layer, :math:`ft` is the functional type and :math:`z` is +the leaf layer within each canopy. This three-dimensional structure is +the basis of the radiation and photosynthetic models. In addition to a +leaf area profile matrix, we also define, for each patch, the area which +is covered by leaves at each layer as :math:`\mathit{carea}_{Cl,ft,z}`. + +Each plant cohort is already defined as a member of a single canopy +layer and functional type. This means that to generate the +:math:`x_{Cl,ft,z}` matrix, it only remains to divide the leaf area of +each cohort into leaf layers. First, we determine how many leaf layers +are occupied by a single cohort, by calculating the ‘tree LAI’ as the +total leaf area of each cohort divided by its crown area (both in +m\ :math:`^{2}`) + +.. math:: \mathit{tree}_{lai,coh} = \frac{b_{leaf,coh}\cdot\mathrm{sla}_{ft}}{A_{crown,coh}} + +where :math:`\mathrm{sla}_{ft}` is the specific leaf area in +m\ :math:`^{2}` KgC\ :math:`^{-1}` and :math:`b_{leaf}` is in kGC per +plant. + +Stem Area Index +~~~~~~~~~~~~~~~ + +Stem area index (SAI) is ratio of the total area of all woody stems on a +plant to the area of ground covered by the plant. During winter in +deciduous areas, the extra absorption by woody stems can have a +significant impact on the surface energy budget. However, in previous +‘big leaf’ versions of the CLM, computing the circumstances under which +stem area was visible in the absence of leaves was difficult and the +algorithm was largely heuristic as a result. Given the multi-layer +canopy introduced for CLM(ED), we can determine the leaves in the higher +canopy layers will likely shade stem area in the lower layers when +leaves are on, and therefore stem area index can be calculated as a +function of woody biomass directly. + +Literature on stem area index is particularly poor, as it’s estimation +is complex and not particularly amenable to the use of, for example, +assumptions of random distribution in space that are typically used to +calculate leaf area from light interception. +:raw-latex:`\cite{kucharik1998}` estimated that SAI visible from an +LAI2000 sensor was around 0.5 m^2 m^-2. :raw-latex:`\cite{low2001}` +estimate that the wood area index for Ponderosa Pine forest is +0.27-0.33. The existing CLM(CN) algorithm sets the minimum SAI at 0.25 +to match MODIS observations, but then allows SAI to rise as a function +of the LAI lost, meaning than in some places, predicted SAI can reach +value of 8 or more. Clearly, greater scientific input on this quantity +is badly needed. Here we determine that SAI is a linear function of +woody biomass, to at very least provide a mechanistic link between the +existence of wood and radiation absorbed by it. The non-linearity +between how much woody area exists and how much radiation is absorbed is +provided by the radiation absorption algorithm. Specifically, the SAI of +an individual cohort (:math:`\mathrm{tree}_{sai,coh}`, m\ :math:`^{2}` +m\ :math:`^{-2}`) is calculated as follows, + +.. math:: \mathrm{tree}_{sai,coh} = k_{sai}\cdot b_{struc,coh} , + +where :math:`k_{sai}` is the coefficient linking structural biomass to +SAI. The number of occupied leaf layers for cohort :math:`coh` +(:math:`n_{z,coh}`) is then equal to the rounded up integer value of the +tree SAI (:math:`{tree}_{sai,coh}`) and LAI (:math:`{tree}_{lai,coh}`) +divided by the layer thickness (i.e., the resolution of the canopy layer +model, in units of vegetation index (:math:`lai`\ +\ :math:`sai`) with a +default value of 1.0, :math:`\delta _{vai}` ), + +.. math:: n_{z,coh} = {\frac{\mathrm{tree}_{lai,coh}+\mathrm{tree}_{sai,coh}}{\delta_{vai}}}. + +The fraction of each layer that is leaf (as opposed to stem) can then be +calculated as + +.. math:: f_{leaf,coh} = \frac{\mathrm{tree}_{lai,coh}}{\mathrm{tree}_{sai,coh}+\mathrm{tree}_{lai,coh}}. + +Finally, the leaf area in each leaf layer pertaining to this cohort is +thus + +.. math:: + + \mathit{lai}_{z,coh} = \left\{ \begin{array}{ll} + \delta_{vai} \cdot f_{leaf,coh} \frac{A_{canopy,coh}}{A_{canopy,patch}}& \textrm{for $i=1,..., i=n_{z,coh}-1$}\\ + &\\ + \delta_{vai} \cdot f_{leaf,coh} \frac{A_{canopy,coh}}{A_{canopy,patch}}\cdot r_{vai}& \textrm{for $i=n_{z,coh}$}\\ + \end{array} \right. + + and the stem area index is + +.. math:: + + \mathit{sai}_{z,coh} = \left\{ \begin{array}{ll} + \delta_{vai} \cdot (1-f_{leaf,coh})\frac{A_{canopy,coh}}{A_{canopy,patch}}& \textrm{for $i=1,..., i=n_{z,coh}-1$}\\ + &\\ + \delta_{vai} \cdot (1-f_{leaf,coh}) \frac{A_{canopy,coh}}{A_{canopy,patch}}\cdot r_{vai}& \textrm{for $i=n_{z,coh}$}\\ + \end{array} \right. + +where :math:`r_{vai}` is the remainder of the canopy that is below the +last full leaf layer + +.. math:: r_{vai} =(\mathrm{tree}_{lai,coh} + \mathrm{tree}_{sai,coh}) - (\delta _{vai} \cdot (n_{z,coh} -1)). + +:math:`A_{canopy,patch}` is the total canopy area occupied by plants in +a given patch (m:math:`^{2}`) and is calculated as follows, + +.. math:: A_{canopy,patch} = \textrm{min}\left( \sum_{coh=1}^{coh = ncoh}A_{canopy,coh}, A_{patch} \right). + +The canopy is conceived as a cylinder, although this assumption could be +altered given sufficient evidence that canopy shape was an important +determinant of competitive outcomes, and the area of ground covered by +each leaf layer is the same through the cohort canopy. With the +calculated SAI and LAI, we are able to calculate the complete canopy +profile. Specifically, the relative canopy area for the cohort +:math:`{coh}` is calculated as + +.. math:: \mathit{area}_{1:nz,coh} = \frac{A_{crown,coh}}{A_{canopy,patch}}. + +The total occupied canopy area for each canopy layer (:math:`Cl`), plant +functional type (:math:`ft`) and leaf layer (:math:`z`) bin is thus + +.. math:: + + \mathit{c}_{area,Cl,ft,z} = \sum_{coh=1}^{coh=ncoh} area_{1:nz,coh} + +where :math:`ft_{coh}=ft` and :math:`Cl_{coh} = Cl.` + +All of these quantities are summed across cohorts to give the complete +leaf and stem area profiles, + +.. math:: + + \mathit{lai} _{Cl,ft,z} = \sum_{coh=1}^{coh=ncoh} \mathit{lai}_{z,coh} + +.. math:: + + \mathit{sai}_{Cl,ft,z} = \sum_{coh=1}^{coh=ncoh} \mathit{sai}_{z,coh} + + +Burial of leaf area by snow +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The calculations above all pertain to the total leaf and stem area +indices which charecterize the vegetation structure. In addition, the +model must know when the vegetation is covered by snow, and by how much, +so that the albedo and energy balance calculations can be adjusted +accordingly. Therefore, we calculated a ‘total’ and ‘exposed’ +:math:`lai` and :math:`sai` profile using a representation of the bottom +and top canopy heights, and the depth of the average snow pack. For each +leaf layer :math:`z` of each cohort, we calculate an ‘exposed fraction +:math:`f_{exp,z}` via consideration of the top and bottom heights of +that layer :math:`h_{top,z}` and :math:`h_{bot,z}` (m), + +.. math:: + + \begin{array}{ll} + h_{top,z} = h_{coh} - h_{coh}\cdot f_{crown,ft}\cdot\frac{z}{n_{z,coh}}& \\ + &\\ + h_{bot,z} = h_{coh} - h_{coh}\cdot f_{crown,ft}\cdot\frac{z+1}{n_{z,coh}}&\\ + \end{array} + +where :math:`f_{crown,ft}` is the plant functional type (:math:`ft`) +specific fraction of the cohort height that is occupied by the crown. +Specifically, the ‘exposed fraction :math:`f_{exp,z}` is calculated as +follows, + +.. math:: + + f_{exp,z}\left\{ \begin{array}{ll} + = 1.0 & h_{bot,z}> d_{snow}\\ + &\\ + = \frac{d_{snow} -h_{bot,z}}{h_{top,z}-h_{bot,z}} & h_{top,z}> d_{snow}, h_{bot,z}< d_{snow}\\ + &\\ + = 0.0 & h_{top,z}< d_{snow}\\ + \end{array} \right. + +The resulting exposed (:math:`elai, esai`) and total +(:math:`tlai, tsai`) leaf and stem area indicies are calculated as + +.. math:: + + \begin{array}{ll} + \mathit{elai} _{Cl,ft,z} &= \mathit{lai} _{Cl,ft,z} \cdot f_{exp,z}\\ + \mathit{esai} _{Cl,ft,z} &= \mathit{sai} _{Cl,ft,z} \cdot f_{exp,z}\\ + \mathit{tlai} _{Cl,ft,z} &= \mathit{lai} _{Cl,ft,z}\\ + \mathit{tsai} _{Cl,ft,z} &= \mathit{sai} _{Cl,ft,z} \ + \end{array} , + +and are used in the radiation interception and photosynthesis algorithms +described later. + ++-------------+-------------+-------------+-------------+-------------+ +| Parameter | Parameter | Units | Notes | Indexed by | +| Symbol | Name | | | | ++=============+=============+=============+=============+=============+ +| :math:` | Thickness | m\ :math:`^ | | | +| \delta_ | of single | {-2}`\ m\ : | | | +| {vai}` | canopy | math:`^{-2}`| | | +| | layer | | | | ++-------------+-------------+-------------+-------------+-------------+ +| :math:`C_e` | Competitive | none | | | +| | Exclusion | | | | +| | Parameter | | | | ++-------------+-------------+-------------+-------------+-------------+ +| :math:`c_{p | Minimum | m\ :math:`^ | | | +| ,min}` | canopy | {2}` | | | +| | spread | cm\ :math:` | | | +| | | ^{-1}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| :math:`c_{p | Competitive | m\ :math:`^ | | | +| ,max}` | Exclusion | {2}` | | | +| | Parameter | cm\ :math:` | | | +| | | ^{-1}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| :math:`i` | Incremental | m\ :math:`^ | | | +| | change in | {2}` | | | +| | :math:`c_p` | cm\ :math:` | | | +| | | ^{-1}` | | | +| | | y\ :math:`^ | | | +| | | {-1}` | | | ++-------------+-------------+-------------+-------------+-------------+ +| :math:`A_t` | Threshold | none | | | +| | canopy | | | | +| | closure | | | | ++-------------+-------------+-------------+-------------+-------------+ +| :math:`f_{c | Crown | none | | :math:`ft` | +| rown,ft}` | fraction | | | | ++-------------+-------------+-------------+-------------+-------------+ +| :math:`k_{s | Stem area | m^2 KgC^-1 | | | +| ai}` | per unit | | | | +| | woody | | | | +| | biomass | | | | ++-------------+-------------+-------------+-------------+-------------+ + +.. raw:: latex + + \bigskip + +Radiation Transfer +================== + +Fundamental Radiation Transfer Theory +------------------------------------- + +[10]_The first interaction of the land surface with the properties of +vegetation concerns the partitioning of energy into that which is +absorbed by vegetation, reflected back into the atmosphere, and absorbed +by the ground surface. Older versions of the CLM have utilized a +‘two-stream’ approximation +:raw-latex:`\parencite{sellers1985,sellers1996}` that provided an +empirical solution for the radiation partitioning of a multi-layer +canopy for two streams, of diffuse and direct light. However, +implementation of the Ecosystem Demography model requires a) the +adoption of an explicit multiple layer canopy b) the implementation of a +multiple plant type canopy and c) the distinction of canopy and +under-storey layers, in-between which the radiation streams are fully +mixed. The radiation mixing between canopy layers is necessary as the +position of different plants in the under-storey is not defined +spatially or relative to the canopy trees above. In this new scheme, we +thus implemented a one-dimensional scheme that traces the absorption, +transmittance and reflectance of each canopy layer and the soil, +iterating the upwards and downwards passes of radiation through the +canopy until a pre-defined accuracy tolerance is reached. This approach +is based on the work of :raw-latex:`\cite{norman1979}`. + +Here we describe the basic theory of the radiation transfer model for +the case of a single homogenous canopy, and in the next section we +discuss how this is applied to the multi layer multi PFT canopy in the +CLM(ED) implementation. The code considers the fractions of a single +unit of incoming direct and a single unit of incoming diffuse light, +that are absorbed at each layer of the canopy for a given solar angle +(:math:`\alpha_{s}`, radians). Direct radiation is extinguished through +the canopy according to the coefficient :math:`k_{dir}` that is +calculated from the incoming solar angle and the dimensionless leaf +angle distribution parameter (:math:`\chi`) as + +.. math:: k_{dir} = g_{dir} / \sin(\alpha_s)\\ + +where + +.. math:: g_{dir} = \phi_1 + \phi_2 \cdot \sin(\alpha_s)\\ + +and + +.. math:: + + \begin{array} {l} + \phi_1 = 0.5 - 0.633\chi_{l} - 0.33\chi_l ^2\\ + \phi_2 =0.877 (1 - 2\phi_1)\\ + + \end{array} + +The leaf angle distribution is a descriptor of how leaf surfaces are +arranged in space. Values approaching 1.0 indicate that (on average) the +majority of leaves are horizontally arranged with respect to the ground. +Values approaching -1.0 indicate that leaves are mostly vertically +arranged, and a value of 0.0 denotes a canopy where leaf angle is random +(a ‘spherical’ distribution). + +According to Beer’s Law, the fraction of light that is transferred +through a single layer of vegetation (leaves or stems) of thickness +:math:`\delta_{vai}`, without being intercepted by any surface, is + +.. math:: \mathit{tr}_{dir} = e^{-k_{dir} \delta_{vai}} + +and the incident direct radiation transmitted to each layer of the +canopy (:math:`dir_{tr,z}`) is thus calculated from the cumulative leaf +area ( :math:`L_{above}` ) shading each layer (:math:`z`): + +.. math:: \mathit{dir}_{tr,z} = e^{-k_{dir} L_{above,z}} + +The fraction of the leaves :math:`f_{sun}` that are exposed to direct +light is also calculated from the decay coefficient :math:`k_{dir}`. + +.. math:: + + \begin{array}{l} + f_{sun,z} = e^{-k_{dir} L_{above,z}}\\ + \rm{and} + \\ f_{shade,z} = 1-f_{sun,z} + \end{array} + +where :math:`f_{shade,z}` is the fraction of leaves that are shaded +from direct radiation and only receive diffuse light. + +Diffuse radiation, by definition, enters the canopy from a spectrum of +potential incident directions, therefore the un-intercepted transfer +(:math:`tr_{dif}`) through a leaf layer of thickness :math:`\delta_l` is +calculated as the mean of the transfer rate from each of 9 different +incident light directions (:math:`\alpha_{s}`) between 0 and 180 degrees +to the horizontal. + +.. math:: \mathit{tr}_{dif} = \frac{1}{9} \sum\limits_{\alpha_s=5\pi/180}^{\alpha_s=85\pi/180} e^{-k_{dir,l} \delta_{vai}} \\ \\ + +.. math:: tr_{dif}= \frac{1}{9} \pi \sum_{\alpha s=0}^{ \pi / 2} \frac{e^{-gdir} \alpha_s}{\delta_{vai} \cdot \rm{sin}(\alpha_s) \rm{sin}(\alpha_s) \rm{cos}(\alpha_s)} + +The fraction (1-:math:`tr_{dif}`) of the diffuse radiation is +intercepted by leaves as it passes through each leaf layer. Of this, +some fraction is reflected by the leaf surfaces and some is transmitted +through. The fractions of diffuse radiation reflected from +(:math:`\mathit{refl}_{dif}`) and transmitted though +(:math:`\mathit{tran}_{dif}`) each layer of leaves are thus, +respectively + +.. math:: + + \begin{array}{l} + \mathit{refl_{dif}} = (1 - tr_{dif}) \rho_{l,ft}\\ + \mathit{tran}_{dif} = (1 - tr_{dif}) \tau_{l,ft} + tr_{dif} + \end{array} + +where :math:`\rho_{l,ft}` and :math:`\tau_{l,ft}` are the fractions of +incident light reflected and transmitted by individual leaf surfaces. + +Once we know the fractions of light that are transmitted and reflected +by each leaf layer, we begin the process of distributing light through +the canopy. Starting with the first leaf layer (:math:`z`\ =1), where +the incident downwards diffuse radiation (:math:`\mathit{dif}_{down}`) +is 1.0, we work downwards for :math:`n_z` layers, calculating the +radiation in the next layer down (:math:`z+1`) as: + +.. math:: \mathit{dif}_{down,z+1} = \frac{\mathit{dif}_{down,z} \mathit{tran}_{dif} } {1 - \mathit{r}_{z+1} \mathit{refl}_{dif}} + +Here, :math:`\mathit{dif}_{down,z} \mathit{tran}_{dif}` calculates the +fraction of incoming energy transmitted downwards onto layer +:math:`z+1`. This flux is then increased by the additional radiation +:math:`r_z` that is reflected upwards from further down in the canopy to +layer :math:`z`, and then is reflected back downwards according to the +reflected fraction :math:`\mathit{refl_{dif}}`. The more radiation in +:math:`\mathit{r}_{z+1} \mathit{refl}_{dif}`, the smaller the +denominator and the larger the downwards flux. :math:`r` is also +calculated sequentially, starting this time at the soil surface layer +(where :math:`z = n_z+1`) + +.. math:: r_{nz+1} = alb_s + +where :math:`alb_s` is the soil albedo characteristic. The upwards +reflected fraction :math:`r_z` for each leaf layer, moving upwards, is +then :raw-latex:`\cite{norman1979}` + +.. math:: r_z = \frac{r_{z+1} \times \mathit{tran}_{dif} ^{2} }{ (1 - r_{z+1} \mathit{refl_{dif}}) + \mathit{refl_{dif}}}. + +The corresponding upwards diffuse radiation flux is therefore the +fraction of downwards radiation that is incident on a particular layer, +multiplied by the fraction that is reflected from all the lower layers: + +.. math:: \mathit{dif}_{up,z} = r_z \mathit{dif}_{down,z+1} + +Now we have initial conditions for the upwards and downwards diffuse +fluxes, these must be modified to account for the fact that, on +interception with leaves, direct radiation is transformed into diffuse +radiation. In addition, the initial solutions to the upwards and +downwards radiation only allow a single ‘bounce’ of radiation through +the canopy, so some radiation which might be intercepted by leaves +higher up is potentially lost. Therefore, the solution to this model is +iterative. The iterative solution has upwards and a downwards components +that calculate the upwards and downwards fluxes of total radiation at +each leaf layer (:math:`rad_{dn, z}` and :math:`rad_{up, z}`) . The +downwards component begins at the top canopy layer (:math:`z=1`). Here +we define the incoming solar diffuse and direct radiation +(:math:`\it{solar}_{dir}` and :math:`\it{solar}_{dir}` respectively). + +.. math:: + + \begin{array}{l} + \mathit{dif}_{dn,1} = \it{solar}_{dif} \\ + \mathit{rad}_{dn, z+1} = \mathit{dif}_{dn,z} \cdot \mathit{tran}_{dif} +\mathit{dif}_{up,z+1} \cdot \mathit{refl}_{dif} + \mathit{solar}_{dir} \cdot dir_{tr,z} (1- tr_{dir}) \tau_l. + \end{array} + +The first term of the right-hand side deals with the diffuse radiation +transmitted downwards, the second with the diffuse radiation travelling +upwards, and the third with the direct radiation incoming at each layer +(:math:`dir_{tr,z}`) that is intercepted by leaves +(:math:`1- tr_{dir}`) and then transmitted through through the leaf +matrix as diffuse radiation (:math:`\tau_l`). At the bottom of the +canopy, the light reflected off the soil surface is calculated as + +.. math:: rad _{up, nz} = \rm{\it{dif}}_{down,z} \cdot salb_{dif} +\it{solar}_{dir} \cdot dir_{tr,z} salb_{dir}. + +The upwards propagation of the reflected radiation is then + +.. math:: rad_{up, z} = \mathit{dif}_{up,z+1} \cdot \mathit{tran}_{dif} +\mathit{dif}_{dn,z} \cdot \mathit{refl}_{dif} + \it{solar}_{dir} \cdot dir_{tr,z} (1- tr_{dir}) \rho_l. + +Here the first two terms deal with the diffuse downwards and upwards +fluxes, as before, and the third deals direct beam light that is +intercepted by leaves and reflected upwards. These upwards and downwards +fluxes are computed for multiple iterations, and at each iteration, +:math:`rad_{up, z}` and :math:`rad_{down, z}` are compared to their +values in the previous iteration. The iteration scheme stops once the +differences between iterations for all layers is below a predefined +tolerance factor, (set here at :math:`10^{-4}`). Subsequently, the +fractions of absorbed direct (:math:`abs_{dir,z}`) and diffuse +(:math:`abs_{dif,z}`) radiation for each leaf layer then + +.. math:: abs_{dir,z} = \it{solar}_{dir} \cdot dir_{tr,z} \cdot (1- tr_{dir}) \cdot (1 - \rho_l-\tau_l) + +.. math:: abs_{dif,z} = (\mathit{dif}_{dn,z} + \mathit{dif}_{up,z+1} ) \cdot (1 - tr_{dif}) \cdot (1 - \rho_l-\tau_l). + +and, the radiation energy absorbed by the soil for the diffuse and +direct streams is is calculated as + +.. math:: \it{abs}_{soil} = \mathit{dif}_{down,nz+1} \cdot (1 - salb_{dif}) +\it{solar}_{dir} \cdot dir_{tr,nz+1} \cdot (1- salb_{dir}). + +Canopy level albedo is denoted as the upwards flux from the top leaf +layer + +.. math:: \it{alb}_{canopy}= \frac{\mathit{dif}_{up,z+1} }{ \it{solar}_{dir} + \it{solar}_{dif}} + +and the division of absorbed energy into sunlit and shaded leaf +fractions, (required by the photosynthesis calculations), is + +.. math:: abs_{sha,z} = abs_{dif,z} \cdot f_{sha} + +.. math:: abs_{sun,z} = abs_{dif,z} \cdot f_{sun}+ abs_{dir,z} + +Resolution of radiation transfer theory within the CLM(ED) canopy structure +--------------------------------------------------------------------------- + +The radiation transfer theory above, was described with reference to a +single canopy of one plant functional type, for the sake of clarity of +explanation. The CLM(ED) model, however, calculates radiative and +photosynthetic fluxes for a more complex hierarchical structure within +each patch/time-since-disturbance class, as described in the leaf area +profile section. Firstly, we denote two or more canopy layers (denoted +:math:`C_l`). The concept of a ‘canopy layer’ refers to the idea that +plants are organized into discrete over and under-stories, as predicted +by the Perfect Plasticity Approximation +:raw-latex:`\parencite{purves2008,fisher2010}`. Within each canopy layer +there potentially exist multiple cohorts of different plant functional +types and heights. Within each canopy layer, :math:`C_l`, and functional +type, :math:`ft`, the model resolves numerous leaf layers ‘:math:`z`’, +and, for some processes, notably photosynthesis, each leaf layer is +split into a fraction of sun and shade leaves, :math:`f_{sun}` and +:math:`f_{sha}`, respectively. + +The radiation scheme described in Section is solved explicitly for this +structure, for both the visible and near-infrared wavebands, according +to the following assumptions. + +- A ‘canopy layer’ (:math:`C_{L}`) refers to either the over or understorey + +- A ‘leaf layer’ (:math:`z`) refers to the discretization of the LAI + within the canopy of a given plant functional type. + +- All PFT’s in the same canopy layer have the same solar radiation + incident on the top layer of the canopy + +- Light is transmitted through the canopy of each plant functional type independently + +- Between canopy layers, the light streams from different plant + functional types are mixed, such that the (undefined) spatial + location of plants in lower canopy layers does not impact the amount + of light received. + +- Where understorey layers fill less area than the overstorey layers, + radiation is directly transferred to the soil surface. + +- All these calculations pertain to a single patch, so we omit the + ‘patch’ subscript for simplicity in the following discussion. + +Within this framework, the majority of the terms in the radiative +transfer scheme are calculated with indices of :math:`C_L`, +:math:`\it{ft}` and :math:`z`. In the following text, we revisit the +simplified version of the radiation model described above, and explain +how it is modified to account for the more complex canopy structure used +by the CLM(ED). + +Firstly, the light penetration functions, :math:`k_{dir}` and +:math:`g_{dir}` are described as functions of :math:`\it{ft}`, because +the leaf angle distribution, :math:`\chi_l`, is a pft-specific +parameter. Thus, the diffuse irradiance transfer rate, :math:`tr_{dif}` +is also :math:`\it{ft}` specific because :math:`g_{dir}`, on which it +depends, is a function of :math:`\chi_l`. + +The amount of direct light reaching each leaf layer is a function of the +leaves existing above the layer in question. If a leaf layer ‘:math:`z`’ +is in the top canopy layer (the over-storey), it is only shaded by +leaves of the same PFT so :math:`k_{dir}` is unchanged from equation. If +there is more than one canopy layer (:math:`C_{l,max}>1`), then the +amount of direct light reaching the top leaf surfaces of the +second/lower layer is the weighted average of the light attenuated by +all the parallel tree canopies in the canopy layer above, thus. + +.. math:: dir_{tr,Cl,:,1} =\sum_{ft=1}^{npft}{(dir_{tr,Cl,ft,z_{max}} \cdot c_{area,Cl-1,ft,z_{max}})} + +where :math:`\it{pft}_{wt}` is the areal fraction of each canopy layer +occupied by each functional type and :math:`z_{max}` is the index of the +bottom canopy layer of each pft in each canopy layer (the subscripts +:math:`C_l` and :math:`ft` are implied but omitted from all +:math:`z_{max}` references to avoid additional complications) + +Similarly, the sunlit fraction for a leaf layer ‘:math:`z`’ in the +second canopy layer (where :math:`C_l > 1`) is + +.. math:: f_{sun,Cl,ft,z} = W_{sun,Cl} \cdot e^{k_{dir,ft,laic,z}} + +where :math:`W_{sun,Cl}` is the weighted average sunlit fraction in the +bottom layer of a given canopy layer. + +.. math:: W_{sun,Cl} = \sum_{ft=1}^{npft}{(f_{sun,Cl-1,ft,zmax} \cdot c_{area,Cl-1,ft,zmax})} + +Following through the sequence of equations for the simple single pft +and canopy layer approach above, the :math:`\mathit{refl}_{dif}` and +:math:`\mathit{tran}_{dif}` fluxes are also indexed by :math:`C_l`, +:math:`\it{ft}`, and :math:`z`. The diffuse radiation reflectance ratio +:math:`r_z` is also calculated in a manner that homogenizes fluxes +between canopy layers. For the canopy layer nearest the soil +(:math:`C_l` = :math:`C_{l,max}`). For the top canopy layer +(:math:`C_l`\ =1), a weighted average reflectance from the lower layers +is used as the baseline, in lieu of the soil albedo. Thus: + +.. math:: r_{z,Cl,:,1} = \sum_{ft=1}^{npft}{(r_{z,Cl-1,ft,1} \it{pft}_{wt,Cl-1,ft,1})} + +For the iterative flux resolution, the upwards and downwards fluxes are +also averaged between canopy layers, thus where :math:`C_l>1` + +.. math:: rad_{dn, Cl,ft,1} = \sum_{ft=1}^{npft}{(rad_{dn, Cl-1,ft,zmax} \cdot \it{pft}_{wt,Cl-1,ft,zmax})} + +and where :math:`C_l` =1, and :math:`C_{l,max}>1` + +.. math:: rad_{up,Cl,ft,zmax} = \sum_{ft=1}^{npft}{(rad_{up, Cl+1,ft,1} \cdot \it{pft}_{wt,Cl+1,ft,1})} + +The remaining terms in the radiation calculations are all also indexed +by :math:`C_l`, :math:`ft` and :math:`z` so that the fraction of +absorbed radiation outputs are termed :math:`abs_{dir,Cl,ft,z}` and +:math:`abs_{dif,Cl,ft,z}`. The sunlit and shaded absorption rates are +therefore + +.. math:: abs_{sha,Cl,ft,z} = abs_{dif,Cl,ft,z}\cdot f_{sha,Cl,ft,z} + +and + +.. math:: abs_{sun,Cl,ft,z} = abs_{dif,Cl,ft,z} \cdot f_{sun,Cl,ft,z}+ abs_{dir,Cl,ft,z} + +The albedo of the mixed pft canopy is calculated as the weighted average +of the upwards radiation from the top leaf layer of each pft where +:math:`C_l`\ =1: + +.. math:: \it{alb}_{canopy}= \sum_{ft=1}^{npft}{\frac{\mathit{dif}_{up,1,ft,1} \it{pft}_{wt,1,ft,1}} {\it{solar}_{dir} + \it{solar}_{dif}}} + +The radiation absorbed by the soil after passing through through +under-storey vegetation is: + +.. math:: \it{abs}_{soil}= \sum_{ft=1}^{npft}{ \it{pft}_{wt,1,ft,1}( \mathit{dif}_{down,nz+1} (1 - salb_{dif}) +\it{solar}_{dir} dir_{tr,nz+1} (1- salb_{dir}))} + +to which is added the diffuse flux coming directly from the upper +canopy and hitting no understorey vegetation. + +.. math:: \it{abs}_{soil}= \it{abs}_{soil}+dif_{dn,2,1} (1- \sum_{ft=1}^{npft}{\it{pft}_{wt,1,ft,1}}) (1 - salb_{dif}) + +and the direct flux coming directly from the upper canopy and hitting +no understorey vegetation. + +.. math:: \it{abs}_{soil}= \it{abs}_{soil}+\it{solar}_{dir} dir_{tr,2,1}(1- \sum_{ft=1}^{npft}{\it{pft}_{wt,1,ft,1}}) (1 - salb_{dir}) + +These changes to the radiation code are designed to be structurally +flexible, and the scheme may be collapsed down to only include on canopy +layer, functional type and pft for testing if necessary. + +.. raw:: latex + + \captionof{table}{Parameters needed for radiation transfer model. } + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`\chi` | Leaf angle | none | *ft* | +| | distribution | | | +| | parameter | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\rho_l` | Fraction of | none | *ft* | +| | light reflected | | | +| | by leaf surface | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\tau_l` | Fraction of | none | *ft* | +| | light | | | +| | transmitted by | | | +| | leaf surface | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`alb_s` | Fraction of | none | direct vs | +| | light reflected | | diffuse | +| | by soil | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +Photosynthesis +============== + +Fundamental photosynthetic physiology theory +-------------------------------------------- + + [11]_ + +In this section we describe the physiological basis of the +photosynthesis model before describing its application to the CLM(ED) +canopy structure. This description in this section is largely repeated +from the Oleson et al. CLM4.5 technical note but included here for +comparison with its implementation in CLM(ED). Photosynthesis in C3 +plants is based on the model of :raw-latex:`\cite{farquhar1980}` as +modified by :raw-latex:`\cite{collatz1991}`. Photosynthetic assimilation +in C4 plants is based on the model of :raw-latex:`\cite{collatz1992}`. +In both models, leaf photosynthesis, :math:`\textrm{gpp}` +(:math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`) is +calculated as the minimum of three potentially limiting fluxes, +described below: + +.. math:: \textrm{gpp} = \rm{min}(w_{j}, w_{c},w_{p}). + +The RuBP carboxylase (Rubisco) limited rate of carboxylation +:math:`w_{c}` (:math:`\mu`\ mol CO\ :math:`_{2}` m\ :math:`^{-2}` +s\ :math:`^{-1}`) is determined as + +.. math:: + + w_{c}= \left\{ \begin{array}{ll} + \frac{V_{c,max}(c_{i} - \Gamma_*)}{ci+K_{c}(1+o_{i}/K_{o})} & \textrm{for $C_{3}$ plants}\\ + &\\ + V_{c,max}& \textrm{for $C_{4}$ plants}\\ + \end{array} \right. + c_{i}-\Gamma_*\ge 0 + +where :math:`c_{i}` is the internal leaf CO\ :math:`_{2}` partial +pressure (Pa) and :math:`o_i (0.209P_{atm}`) is the O\ :math:`_{2}` +partial pressure (Pa). :math:`K_{c}` and :math:`K_{o}` are the +Michaelis-Menten constants (Pa) for CO\ :math:`_{2}` and +O\ :math:`_{2}`. These vary with vegetation temperature :math:`T_v` +(:math:`^{o}`\ C) according to an Arrhenious function described in +:raw-latex:`\cite{oleson2013}`. :math:`V_{c,max}` is the leaf layer +photosynthetic capacity (:math:`\mu` mol CO\ :math:`_2` m\ :math:`^{-2}` +s\ :math:`^{-1}`). + +The maximum rate of carboxylation allowed by the capacity to regenerate +RuBP (i.e., the light-limited rate) :math:`w_{j}` (:math:`\mu`\ mol +CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`) is + +.. math:: + + w_j= \left\{ \begin{array}{ll} + \frac{J(c_i - \Gamma_*)}{4ci+8\Gamma_*} & \textrm{for C$_3$ plants}\\ + &\\ + 4.6\phi\alpha & \textrm{for C$_4$ plants}\\ + \end{array} \right. + c_i-\Gamma_*\ge 0 + +To find :math:`J`, the electron transport rate (:math:`\mu` mol +CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`), we solve the +following quadratic term and take its smaller root, + +.. math:: \Theta_{psII}J^{2}-(I_{psII} +J_{max})J+I_{psII}J_{max} =0 + +where :math:`J_{max}` is the maximum potential rate of electron +transport (:math:`\mu`\ mol m\ :math:`_{-2}` s\ :math:`^{-1}`), +:math:`I_{PSII}` is the is the light utilized in electron transport by +photosystem II (:math:`\mu`\ mol m\ :math:`_{-2}` s\ :math:`^{-1}`) and +:math:`\Theta_{PSII}` is is curvature parameter. :math:`I_{PSII}` is +determined as + +.. math:: I_{PSII} =0.5 \Phi_{PSII}(4.6\phi) + +where :math:`\phi` is the absorbed photosynthetically active radiation +(Wm:math:`^{-2}`) for either sunlit or shaded leaves (:math:`abs_{sun}` +and :math:`abs_{sha}`). :math:`\phi` is converted to photosynthetic +photon flux assuming 4.6 :math:`\mu`\ mol photons per joule. Parameter +values are :math:`\Phi_{PSII}` = 0.7 for C3 and :math:`\Phi_{PSII}` = +0.85 for C4 plants. + +The export limited rate of carboxylation for C3 plants and the PEP +carboxylase limited rate of carboxylation for C4 plants :math:`w_e` +(also in :math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` +s\ :math:`^{-1}`) is + +.. math:: + + w_e= \left\{ \begin{array}{ll} + 3 T_{p,0} & \textrm{for $C_3$ plants}\\ + &\\ + k_{p} \frac{c_i}{P_{atm}}& \textrm{for $C_4$ plants}.\\ + \end{array} \right. + +:math:`T_{p}` is the triose-phosphate limited rate of photosynthesis, +which is equal to :math:`0.167 V_{c,max0}`. :math:`k_{p}` is the initial +slope of C4 CO\ :math:`_{2}` response curve. The Michaelis-Menten +constants :math:`K_{c}` and :math:`K_{o}` are modeled as follows, + +.. math:: K_{c} = K_{c,25}(a_{kc})^{\frac{T_v-25}{10}}, + +.. math:: K_{o} = K_{o,25}(a_{ko})^{\frac{T_v-25}{10}}, + +where :math:`K_{c,25}` = 30.0 and :math:`K_{o,25}` = 30000.0 are values +(Pa) at 25 :math:`^{o}`\ C, and :math:`a_{kc}` = 2.1 and :math:`a_{ko}` +=1.2 are the relative changes in :math:`K_{c,25}` and :math:`K_{o,25}` +respectively, for a 10\ :math:`^{o}`\ C change in temperature. The +CO\ :math:`_{2}` compensation point :math:`\Gamma_{*}` (Pa) is + +.. math:: \Gamma_* = \frac{1}{2} \frac{K_c}{K_o}0.21o_i + +where the term 0.21 represents the ratio of maximum rates of oxygenation +to carboxylation, which is virtually constant with temperature +:raw-latex:`\cite{farquhar1980}`. + +Resolution of the photosynthesis theory within the CLM(ED) canopy structure. +---------------------------------------------------------------------------- + +The photosynthesis scheme is modified from the CLM4.5 model to give +estimates of photosynthesis, respiration and stomatal conductance for a +three dimenstional matrix indexed by canopy level (:math:`C_l`), plant +functional type (:math:`ft`) and leaf layer (:math:`z`). We conduct the +photosynthesis calculations at each layer for both sunlit and shaded +leaves. Thus, the model also generates estimates of :math:`w_{c},w_{j}` +and :math:`w_{e}` indexed in the same three dimensional matrix. In this +implementation, some properties (stomatal conductance parameters, +top-of-canopy photosynthetic capacity) vary with plant functional type, +and some vary with both functional type and canopy depth (absorbed +photosynthetically active radiation, nitrogen-based variation in +photosynthetic properties). The remaining drivers of photosynthesis +(:math:`P_{atm}`, :math:`K_c`, :math:`o_i`, :math:`K_o`, temperature, +atmospheric CO\ :math:`_2`) remain the same throughout the canopy. The +rate of gross photosynthesis (:math:`gpp_{Cl,ft,z}`)is the smoothed +minimum of the three potentially limiting processes (carboxylation, +electron transport, export limitation), but calculated independently for +each leaf layer: + +.. math:: \textrm{gpp}_{Cl,ft,z} = \rm{min}(w_{c,Cl,ft,z},w_{j,Cl,ft,z},w_{e,Cl,ft,z}). + +For :math:`w_{c,Cl,ft,z},`, we use + +.. math:: + + w_{c,Cl,ft,z}= \left\{ \begin{array}{ll} + \frac{V_{c,max,Cl,ft,z}(c_{i,Cl,ft,z}- \Gamma_*)}{c_{i,Cl,ft,z}+K_c(1+o_i/K_o)} & \textrm{for $C_3$ plants}\\ + &\\ + V_{c,max,Cl,ft,z}& \textrm{for $C_4$ plants}\\ + \end{array} \right. + c_{i,Cl,ft,z}-\Gamma_*\ge 0 + +where :math:`V_{c,max}` now varies with PFT, canopy depth and layer +(see below). Internal leaf :math:`CO_{2}` (:math:`c_{i,Cl,ft,z})` is +tracked seperately for each leaf layer. For the light limited rate +:math:`w_j`, we use + +.. math:: + + w_j= \left\{ \begin{array}{ll} + \frac{J(c_i - \Gamma_*)4.6\phi\alpha}{4ci+8\Gamma_*} & \textrm{for C$_3$ plants}\\ + &\\ + 4.6\phi\alpha & \textrm{for C$_4$ plants}\\ + \end{array} \right. + +where :math:`J` is calculated as above but based on the absorbed +photosynthetically active radiation( :math:`\phi_{Cl,ft,z}`) for either +sunlit or shaded leaves in Wm\ :math:`^{-2}`. Specifically, + +.. math:: + + \phi_{Cl,ft,z}= \left\{ \begin{array}{ll} + abs_{sun,Cl,ft,z}& \textrm{for sunlit leaves}\\ + &\\ + abs_{sha,Cl,ft,z}& \textrm{for shaded leaves}\\ + \end{array} \right. + +The export limited rate of carboxylation for C3 plants and the PEP +carboxylase limited rate of carboxylation for C4 plants :math:`w_c` +(also in :math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` +s\ :math:`^{-1}`) is calculated in a similar fashion, + +.. math:: + + w_{e,Cl,ft,z}= \left\{ \begin{array}{ll} + 0.5V_{c,max,Cl,ft,z} & \textrm{for $C_3$ plants}\\ + &\\ + 4000 V_{c,max,Cl,ft,z} \frac{c_{i,Cl,ft,z}}{P_{atm}}& \textrm{for $C_4$ plants}.\\ + \end{array} \right. + +Variation in plant physiology with canopy depth +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Both :math:`V_{c,max}` and :math:`J_{max}` vary with vertical depth in +the canopy on account of the well-documented reduction in canopy +nitrogen through the leaf profile, see :raw-latex:`\cite{bonan2012}` for +details). Thus, both :math:`V_{c,max}` and :math:`J_{max}` are indexed +by by :math:`C_l`, :math:`ft` and :math:`z` according to the nitrogen +decay coefficient :math:`K_n` and the amount of vegetation area shading +each leaf layer :math:`V_{above}`, + +.. math:: + + \begin{array}{ll} + V_{c,max,Cl,ft,z} & = V_{c,max0,ft} e^{-K_{n,ft}V_{above,Cl,ft,z}},\\ + J_{max,Cl,ft,z} & = J_{max0,ft} e^{-K_{n,ft}V_{above,Cl,ft,z}},\\ + \end{array} + +where :math:`V_{c,max,0}` and :math:`J_{max,0}` are the top-of-canopy +photosynthetic rates. :math:`V_{above}` is the sum of exposed leaf area +index (:math:`\textrm{elai}_{Cl,ft,z}`) and the exposed stem area index +(:math:`\textrm{esai}_{Cl,ft,z}`)( m\ :math:`^{2}` m\ :math:`^{-2}` ). +Namely, + +.. math:: V_{Cl,ft,z} = \textrm{elai}_{Cl,ft,z} + \textrm{esai}_{Cl,ft,z}. + +The vegetation index shading a particular leaf layer in the top canopy +layer is equal to + +.. math:: + + \begin{array}{ll} + V_{above,Cl,ft,z}= \sum_{1}^{z} V_{Cl,ft,z} & \textrm{for $Cl= 1$. } + \end{array} + +For lower canopy layers, the weighted average vegetation index of the +canopy layer above (:math:`V_{canopy}`) is added to this within-canopy +shading. Thus, + +.. math:: + + \begin{array}{ll} + V_{above,Cl,ft,z}= \sum_{1}^{z} V_{Cl,ft,z} + V_{canopy,Cl-1} & \textrm{for $Cl >1$, }\\ + \end{array} + +where :math:`V_{canopy}` is calculated as + +.. math:: V_{canopy,Cl} = \sum_{ft=1}^{\emph{npft}} {\sum_{z=1}^{nz(ft)} (V_{Cl,ft,z} \cdot \it{pft}_{wt,Cl,ft,1}).} + +:math:`K_{n}` is the coefficient of nitrogen decay with canopy depth. +The value of this parameter is taken from the work of +:raw-latex:`\cite{lloyd2010}` who determined, from 204 vertical profiles +of leaf traits, that the decay rate of N through canopies of tropical +rainforests was a function of the :math:`V_{cmax}` at the top of the +canopy. They obtain the following term to predict :math:`K_{n}`, + +.. math:: K_{n,ft} = e^{0.00963 V_{c,max0,ft} - 2.43}, + +where :math:`V_{cmax}` is again in :math:`\mu`\ mol CO\ :math:`_2` +m\ :math:`^{-2}` s\ :math:`^{-1}`. + +Water Stress Function +~~~~~~~~~~~~~~~~~~~~~ + +[12]_ The top of canopy leaf photosynthetic capacity, :math:`V_{c,max0}`, is +also adjusted for the availability of water to plants as + +.. math:: V_{c,max0,25} = V_{c,max0,25} \beta_{sw}, + +where the adjusting factor :math:`\beta_{sw}` ranges from one when the +soil is wet to zero when the soil is dry. It depends on the soil water +potential of each soil layer, the root distribution of the plant +functional type, and a plant-dependent response to soil water stress, + +.. math:: \beta_{sw} = \sum_{j=1}^{nj}w_{j}r_{j}, + +where :math:`w_{j}` is a plant wilting factor for layer :math:`j` and +:math:`r_{j}` is the fraction of roots in layer :math:`j`.The plant +wilting factor :math:`w_{j}` is + +.. math:: + + w_{j}= \left\{ \begin{array}{ll} + \frac{\psi_c-\psi_{j}}{\psi_c - \psi_o} (\frac{\theta_{sat,j} - \theta_{ice,j}}{\theta_{sat,j}})& \textrm{for $T_i >$-2C}\\ + &\\ + 0 & \textrm{for $T_{j} \ge$-2C}\\ + \end{array} \right. + +where :math:`\psi_{i}` is the soil water matric potential (mm) and +:math:`\psi_{c}` and :math:`\psi_{o}` are the soil water potential (mm) +when stomata are fully closed or fully open, respectively. The term in +brackets scales :math:`w_{i}` the ratio of the effective porosity (after +accounting for the ice fraction) relative to the total porosity. +:math:`w_{i}` = 0 when the temperature of the soil layer (:math:`T_{i}` +) is below some threshold (-2:math:`^{o}`\ C) or when there is no liquid +water in the soil layer (:math:`\theta_{liq,i} \le 0`). For more details +on the calculation of soil matric potential, see the CLM4.5 technical +note. + +Variation of water stress and water uptake within tiles +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The remaining drivers of the photosynthesis model remain constant +(atmospheric CO\ :math:`_2` and O\ :math:`^2` and canopy temperature) +throughout the canopy, except for the water stress index +:math:`\beta_{sw}`. :math:`\beta_{sw}` must be indexed by :math:`ft`, +because plants of differing functional types have the capacity to have +varying root depth, and thus access different soil moisture profile and +experience differing stress functions. Thus, the water stress function +applied to gas exchange calculation is now calculated as + +.. math:: \beta_{sw,ft} = \sum_{j=1}^{nj}w_{j,ft} r_{j,ft}, + +where :math:`w_{j}` is the water stress at each soil layer :math:`j` +and :math:`r_{j,ft}` is the root fraction of each PFT’s root mass in +layer :math:`j`. Note that this alteration of the :math:`\beta_{sw}` +parameter also necessitates recalculation of the vertical water +extraction profiles. In the original model, the fraction of extraction +from each layer (:math:`r_{e,j,patch}`) is the product of a single root +distribution, because each patch only has one plant functional type. In +the CLM(ED), we need to calculate a new weighted patch effective rooting +depth profile :math:`r_{e,j,patch}` as the weighted average of the +functional-type level stress functions and their relative contributions +to canopy conductance. Thus for each layer :math:`j`, the extraction +fraction is summed over all PFTs as + +.. math:: r_{e,j,patch} = \sum_{ft=1}^{ft=npft} \frac{w_{j,ft}}{\sum_{j=1}^{=nj} w_{j,ft} }\frac{G_{s,ft}}{G_{s,canopy}}, + +where :math:`nj` is the number of soil layers, :math:`G_{s,canopy}`\ is +the total canopy (see section 9 for details) and :math:`G_{s,ft}` is the +canopy conductance for plant functional type :math:`ft`, + +.. math:: G_{s,ft}= \sum_{1}w_{ncoh,ft} {gs_{can,coh} n_{coh} }. + +Aggregation of assimilated carbon into cohorts +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The derivation of photosynthetic rates per leaf layer, as above, give us +the estimated rate of assimilation for a unit area of leaf at a given +point in the canopy in :math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` +s\ :math:`_{-1}`. To allow the integration of these rates into fluxes +per individual tree, or cohort of trees (gCO:math:`_2` +tree\ :math:`^{-1}` s\ :math:`^{-1}`), they must be multiplied by the +amount of leaf area placed in each layer by each cohort. Each cohort is +described by a single functional type, :math:`ft` and canopy layer +:math:`C_l` flag, so the problem is constrained to integrating these +fluxes through the vertical profile (:math:`z`). + +We fist make a weighted average of photosynthesis rates from sun +(:math:`\textrm{gpp}_{sun}`, :math:`\mu`\ mol CO\ :math:`_2` +m\ :math:`^{-2}` s\ :math:`^{-1}`) and shade leaves ( +:math:`\textrm{gpp}_{shade}`, :math:`\mu`\ mol CO\ :math:`_2` +m\ :math:`^{-2}` s\ :math:`^{-1}`) as + +.. math:: \textrm{gpp}_{Cl,ft,z} =\textrm{gpp}_{sun,Cl,ft,z} f_{sun,Cl,ft,z}+ \textrm{gpp}_{sha,Cl,ft,z}(1-f_{sun,Cl,ft,z}). + +The assimilation per leaf layer is then accumulated across all the leaf +layers in a given cohort (*coh*) to give the cohort-specific gross +primary productivity (:math:`\mathit{GPP}_{coh}`), + +.. math:: \textit{GPP}_{coh} = 12\times 10^{-9}\sum_{z=1}^{nz(coh)}gpp_{Cl,ft,z} A_{crown,coh} \textrm{elai}_{Cl,ft,z} + +The :math:`\textrm{elai}_{l,Cl,ft,z}` is the exposed leaf area which is +present in each leaf layer in m\ :math:`^{2}` m\ :math:`^{-2}`. (For all +the leaf layers that are completely occupied by a cohort, this is the +same as the leaf fraction of :math:`\delta_{vai}`). The fluxes are +converted from :math:`\mu`\ mol into mol and then multiplied by 12 (the +molecular weight of carbon) to give units for GPP\ :math:`_{coh}` of KgC +cohort\ :math:`^{-1}` s\ :math:`^{-1}`. These are integrated for each +timestep to give KgC cohort\ :math:`^{-1}` day\ :math:`^{-1}` + +.. raw:: latex + + \captionof{table}{Parameters needed for photosynthesis model.} + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`V_{c,max | Maximum | :math:`\mu` mol | *ft* | +| 0}` | carboxylation | CO :math:`_2` | | +| | capacity | m :math:`^{-2}` | | +| | | s :math:`^{-1}` | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`r_b` | Base Rate of | gC | | +| | Respiration | gN\ :math:`^{-1 | | +| | | } s^{-1}`) | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`q_{10}` | Temp. Response | | | +| | of stem and | | | +| | root | | | +| | respiration | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`R_{cn,le | CN ratio of | gC/gN | *ft* | +| af,ft}` | leaf matter | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`R_{cn,ro | CN ratio of | gC/gN | *ft* | +| ot,ft}` | root matter | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{gr}` | Growth | none | | +| | Respiration | | | +| | Fraction | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\psi_c` | Water content | Pa | *ft* | +| | when stomata | | | +| | close | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\psi_o` | Water content | Pa | *ft* | +| | above which | | | +| | stomata are | | | +| | open | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +Plant respiration +================= + + [13]_ + +Plant respiration per individual :math:`R_{plant,coh}` (KgC individual +:math:`^{-1}` s\ :math:`^{-1}`) is the sum of two terms, growth and +maintenance respiration :math:`R_{g,coh}` and :math:`R_{m,coh}` + +.. math:: R_{plant} = R_{g,coh}+ R_{m,coh} + +Maintenance respiration is the sum of the respiration terms from four +different plant tissues, leaf, :math:`R_{m,leaf,coh}`, fine root +:math:`R_{m,froot,coh}`, coarse root :math:`R_{m,croot,coh}`\ and stem +:math:`R_{m,stem,coh}`, all also in (KgC individual :math:`^{-1}` +s\ :math:`^{-1}`) . + +.. math:: R_{m,coh} = R_{m,leaf,coh}+ R_{m,froot,coh}+R_{m,croot,coh}+R_{m,stem,coh} + +To calculate canopy leaf respiration, which varies through we canopy, we +first determine the top-of-canopy leaf respiration rate +(:math:`r_{m,leaf,ft,0}`, gC s\ :math:`^{-1}` m\ :math:`^{-2}`) is +calculated from a base rate of respiration per unit leaf nitrogen +derived from :raw-latex:`\cite{ryan1991}`. The base rate for leaf +respiration (:math:`r_{b}`) is 2.525 gC/gN s\ :math:`^{-1}`, + +.. math:: r_{m,leaf,ft,0} = r_{b} N_{a,ft}(1.5^{(25-20)/10}) + +where :math:`r_b` is the base rate of metabolism (2.525 x +10\ :math:`^6` gC/gN s\ :math:`^{-1}`. This base rate is adjusted +assuming a Q\ :math:`_{10}` of 1.5 to scale from the baseline of 20C to +the CLM default base rate temperature of 25C. For use in the +calculations of net photosynthesis and stomatal conductance, leaf +respiration is converted from gC s\ :math:`^{-1}` m\ :math:`^{-2}`, into +:math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}` +(:math:`/12\cdot 10^{-6}`). + +This top-of-canopy flux is scaled to account for variation in +:math:`N_a` through the vertical canopy, in the same manner as the +:math:`V_{c,max}` values are scaled using :math:`V_{above}`. + +.. math:: r_{leaf,Cl,ft,z} = r_{m,leaf,ft,0} e^{-K_{n,ft}V_{above,Cl,ft,z}}\beta_{ft}f(t) + +Leaf respiration is also adjusted such that it is reduced by drought +stress, :math:`\beta_{ft}`, and canopy temperature, :math:`f(t_{veg})`. +For details of the temperature functions affecting leaf respiration see +the CLM4 technical note, Section 8, Equations 8.13 and 8.14. The +adjusted leaf level fluxes are scaled to individual-level (gC individual +:math:`^{-1}` s\ :math:`^{-1}`) in the same fashion as the +:math:`\rm{GPP}_{coh}` calculations + +.. math:: \rm{R}_{m,leaf,coh} = 12\times 10^{-9}\sum_{z=1}^{nz(coh)}r_{leaf,Cl,ft,z} A_{crown} \textrm{elai}_{Cl,ft,z} + +The stem and the coarse-root respiration terms are derived using the +same base rate of respiration per unit of tissue Nitrogen. + +.. math:: R_{m,croot,coh} = 10^{-3}r_b t_c \beta_{ft} N_{\rm{livecroot,coh}} + +.. math:: R_{m,stem,coh} = 10^{-3}r_b t_c \beta_{ft} N_{\rm{stem,coh}} + +Here, :math:`t_c` is a temperature relationship based on a +:math:`q_{10}` value of 1.5, where :math:`t_v` is the vegetation +temperature. We use a base rate of 20 here as, again, this is the +baseline temperature used by :raw-latex:`\cite{ryan1991}`. The +10\ :math:`^{-3}` converts from gC invididual\ :math:`^{-1}` +s\ :math:`^{-1}` to KgC invididual\ :math:`^{-1}` s\ :math:`^{-1}` + +.. math:: t_c=q_{10}^{(t_{v} - 20)/10} + +The tissue N contents for live sapwood are derived from the leaf CN +ratios, and for fine roots from the root CN ratio as: + +.. math:: N_{\rm{stem,coh}} = \frac{B_{\rm{sapwood,coh}}}{ R_{cn,leaf,ft}} + +and + +.. math:: N_{\rm{livecroot,coh}} = \frac{ B_{\rm{root,coh}}w_{frac,ft}}{R_{cn,root,ft}} + +where :math:`B_{\rm{sapwood,coh}}` and :math:`B_{\rm{root,coh}}` are +the biomass pools of sapwood and live root biomass respectively (KgC +individual) and :math:`w_{frac,ft}` is the fraction of coarse root +tissue in the root pool (0.5 for woody plants, 0.0 for grasses and +crops). We assume here that stem CN ratio is the same as the leaf C:N +ratio, for simplicity. The final maintenance respiration term is derived +from the fine root respiration, which accounts for gradients of +temperature in the soil profile and thus calculated for each soil layer +:math:`j` as follows: + +.. math:: R_{m,froot,j } = \frac{(1 - w_{frac,ft})B_{\rm{root,coh}}b_r\beta_{ft}}{10^3R_{cn,leaf,ft}} \sum_{j=1}^{nj}t_{c,soi,j} r_{i,ft,j} + +:math:`t_{c,soi}` is a function of soil temperature in layer :math:`j` +that has the same form as that for stem respiration, but uses vertically +resolved soil temperature instead of canopy temperature. In the CLM4.5, +only coarse and not fine root respriation varies as a function of soil +depth, and we maintain this assumption here, although it may be altered +in later versions. The growth respiration, :math:`R_{g,coh}` is a fixed +fraction :math:`f_{gr}` of the carbon remaining after maintenance +respiration has occurred. + +.. math:: R_{g,coh}=\textrm{max}(0,GPP_{g,coh} - \it R\rm_{m,coh})f_{gr} + +.. raw:: latex + + \captionof{table}{Parameters needed for plant respiration model. } + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`-K_{n,ft | Rate of | none | - | +| }` | reduction of N | | | +| | through the | | | +| | canopy | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`r_b` | Base Rate of | gC | | +| | Respiration | gN\ :math:`^{-1 | | +| | | } s^{-1}`) | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`q_{10}` | Temp. Response | | | +| | of stem and | | | +| | root | | | +| | respiration | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`R_{cn,le | CN ratio of | gC/gN | *ft* | +| af,ft}` | leaf matter | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`R_{cn,ro | CN ratio of | gC/gN | *ft* | +| ot,ft}` | root matter | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{gr}` | Growth | none | | +| | Respiration | | | +| | Fraction | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +Stomatal Conductance +==================== + +Fundamental stomatal conductance theory +--------------------------------------- + + [14]_ + +Stomatal conductance is unchanged in concept from the CLM4.5 approach. +Leaf stomatal resistance is calculated from the Ball-Berry conductance +model as described by :raw-latex:`\cite{collatz1991}` and implemented in +a global climate model by :raw-latex:`\cite{sellers1996}`. The model +relates stomatal conductance (i.e., the inverse of resistance) to net +leaf photosynthesis, scaled by the relative humidity at the leaf surface +and the CO\ :math:`_2` concentration at the leaf surface. The primary +difference between the CLM implementation and that used by +:raw-latex:`\cite{collatz1991}` and :raw-latex:`\cite{sellers1996}` is +that they used net photosynthesis (i.e., leaf photosynthesis minus leaf +respiration) instead of gross photosynthesis. As implemented here, +stomatal conductance equals the minimum conductance (:math:`b`) when +gross photosynthesis (:math:`A`) is zero. Leaf stomatal resistance is + +.. math:: \frac{1}{r_{s}} = m_{ft} \frac{A}{c_s}\frac{e_s}{e_i}P_{atm}+b_{ft} \beta_{sw} + +where :math:`r_{s}` is leaf stomatal resistance (s m\ :math:`^2` +:math:`\mu`\ mol\ :math:`^{-1}`), :math:`b_{ft}` is a plant functional +type dependent parameter equivalent to :math:`g_{0}` in the Ball-Berry +model literature. This parameter is also scaled by the water stress +index :math:`\beta_{sw}`. Similarly, :math:`m_{ft}` is the slope of the +relationship between the assimilation, :math:`c_s` and humidty dependant +term and the stomatal conductance, and so is equivalent to the +:math:`g_{1}` term in the stomatal literature. :math:`A` is leaf +photosynthesis (:math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` +s\ :math:`^{-1}`), :math:`c_s` is the CO\ :math:`_2` partial pressure at +the leaf surface (Pa), :math:`e_s` is the vapor pressure at the leaf +surface (Pa), :math:`e_i` is the saturation vapor pressure (Pa) inside +the leaf at the vegetation temperature conductance (:math:`\mu`\ mol +m\ :math:`^{-2}` s\ :math:`^{-1}`) when :math:`A` = 0 . Typical values +are :math:`m_{ft}` = 9 for C\ :math:`_3` plants and :math:`m_{ft}` = 4 +for C\ :math:`_4` plants +:raw-latex:`\parencite{collatz1991,collatz1992,sellers1996}`. +:raw-latex:`\cite{sellers1996}` used :math:`b` = 10000 for C\ :math:`_3` +plants and :math:`b` = 40000 for C\ :math:`_4` plants. Here, :math:`b` +was chosen to give a maximum stomatal resistance of 20000 s +m\ :math:`^{-1}`. These terms are nevertheless plant strategy dependent, +and have been found to vary widely with plant type +:raw-latex:`\parencite{medlyn2011}`. + +Resistance is converted from units of s m\ :math:`^2 \mu` +mol\ :math:`^{-1}` to s m\ :math:`^{-1}` as: 1 s m\ :math:`^{-1}` = +:math:`1\times 10^{-9}`\ R\ :math:`_{\rm{gas}} \theta_{\rm{atm}}P_{\rm{atm}}` +(:math:`\mu`\ mol\ :math:`^{-1}` m\ :math:`^{2}` s), where +R\ :math:`_{gas}` is the universal gas constant (J K\ :math:`^{-1}` +kmol\ :math:`^{-1}`) and :math:`\theta_{atm}` is the atmospheric +potential temperature (K). + +Resolution of the stomatal conductance theory in the CLM(ED) canopy structure +----------------------------------------------------------------------------- + +The stomatal conductance is calculated, as with photosynthesis, for each +canopy, PFT and leaf layer. The CLM code requires a single canopy +conductance estimate to be generated from the multi-layer multi-PFT +array. In previous iterations of the CLM, sun and shade-leaf specific +values have been reported and then averaged by their respective leaf +areas. In this version, the total canopy condutance +:math:`G_{s,canopy}`, is calculated as the sum of the cohort-level +conductance values. + +.. math:: G_{s,canopy} = \sum{ \frac{gs_{can,coh} n_{coh} }{A_{patch}}} + +Cohort conductance is the sum of the inverse of the leaf resistances at +each canopy layer (:math:`r_{s,z}` ) multipled by the area of each +cohort. + +.. math:: gs_{can,coh} =\sum_{z=1}^{z=nv,coh}{\frac{ A_{crown,coh}}{r_{s,cl,ft,z}+r_{b}}} + + +.. raw:: latex + + \captionof{table}{Parameters needed for stomatal conductance model. } + ++------------------+--------------------------+-------+------------+ +| Parameter Symbol | Parameter Name | Units | indexed by | ++==================+==========================+=======+============+ +| :math:`b_{ft}` | Slope of Ball-Berry term | none | *ft* | ++------------------+--------------------------+-------+------------+ +| :math:`m_{ft}` | Slope of Ball-Berry term | none | *ft* | ++------------------+--------------------------+-------+------------+ + + +Allocation +========== + + [15]_ + +Total assimilation carbon enters the ED model each day as a +cohort-specific Net Primary Productivity :math:`\mathit{NPP}_{coh}`, +which is calculated as + +.. math:: \mathit{NPP}_{coh} = \mathit{GPP}_{coh} - R_{plant,coh} + +This flux of carbon is allocated between the demands of tissue turnover, +of carbohydrate storage and of growth (increase in size of one or many +plant organs). Priority is explicitly given to maintenance respiration, +followed by tissue maintenance and storage, then allocation to live +biomass and then to the expansion of structural and live biomass pools. +All fluxes here are first converted into in KgC +individual\ :math:`^{-1}` year\ :math:`^{-1}` and ultimately integrated +using a timesteps of 1/365 years for each day. + +Tissue maintenance demand +------------------------- + +We calculate a ‘tissue maintenance’ flux. The magnitude of this flux is +such that the quantity of biomass in each pool will remain constant, +given background turnover rates. For roots, this maintenenace demand is +simply + +.. math:: r_{md,coh} = b_{root}\cdot\alpha_{root,ft} + +Where :math:`\alpha_{root,ft}` is the root turnover rate in y^-1. Given +that, for deciduous trees, loss of leaves is assumed to happen only one +per growing season, the algorithm is dependent on phenological habit +(whether or not this PFT is evergreen), thus + +.. math:: + + l_{md,coh} = \left\{ \begin{array}{ll} + b_{leaf}\cdot\alpha_{leaf,ft}&\textrm{for } P_{evergreen}= 1\\ + &\\ + 0&\textrm{for } P_{evergreen}= 0\\ + \end{array} \right. + +Leaf litter resulting from deciduous senescence is handled in the +phenology section. The total quantity of maintenance demand +(:math:`t_{md,coh}`. KgC individual y\ :math:`^{-1}`) is therefore + +.. math:: t_{md,coh} = l_{md,coh} + r_{md,coh} + +Allocation to storage and turnover +---------------------------------- + +The model must now determine whether the NPP input is sufficient to meet +the maintenance demand and keep tissue levels constant. To determine +this, we introduce the idea of ‘carbon balance’ :math:`C_{bal,coh}` (KgC +individual\ :math:`^{-1}`) where + +.. math:: C_{bal,coh}= \mathit{NPP}_{coh} - t_{md,coh}\cdot f_{md,min,ft} + +where :math:`f_{md,min,ft}` is the minimum fraction of the maintenance +demand that the plant must meet each timestep, which is indexed by *ft* +and represents a life-history-strategy decision concerning whether +leaves should remain on in the case of low carbon uptake (a risky +strategy) or not be replaced (a conservative strategy). Subsequently, we +determine a flux to the storage pool, where the flux into the pool, as a +fraction of :math:`C_{bal,coh}`, is proportional to the discrepancy +between the target pool size and the actual pool size :math:`f_{tstore}` +where + +.. math:: f_{tstore} = \mathrm{max}\left(0,\frac{b_{store}}{b_{leaf}\cdot S_{cushion}}\right) + +The allocation to storage is a fourth power function of +:math:`f_{tstore}` to mimic the qualitative behaviour found for carbon +allocation in arabidopsis by :raw-latex:`\cite{smith2007}`. + +.. math:: + + \frac{\delta b_{store}}{\delta t} = \left\{ \begin{array}{ll} + C_{bal,coh} \cdot e^{-f_{tstore}^{4}} &\textrm{for }C_{bal,coh}>0\\ + &\\ + C_{bal,coh} &\textrm{for }C_{bal,coh}\leq0\\ + \end{array} \right. + +If the carbon remaining after the storage and minimum turnover fluxes +have been met, the next priority is the remaining flux to leaves +:math:`t_{md}\cdot(1-f_{md,min})`. If the quantity of carbon left +:math:`(C_{bal,coh}-\frac{\delta b_{store}}{\delta t})` is insufficient +to supply this amount of carbon, then the store of alive carbon is +depleted (to represent those leaves that have fallen off and not been +replaced) + +.. math:: + + \frac{\delta b_{alive}}{\delta t} = \left\{ \begin{array}{ll} + 0 &\textrm{ for } (C_{bal,coh}-\frac{\delta b_{store}}{\delta t}) > t_{md}\cdot(1-f_{md,min})\\ + &\\ + t_{md}\cdot(1-f_{md,min}) - \left(C_{bal,coh}-\frac{\delta b_{store}}{\delta t}\right)&\textrm{ for } (C_{bal,coh}-\frac{\delta b_{store}}{\delta t}) \leq t_{md}\cdot(1-f_{md,min})\\ + \end{array} \right. + +correspondingly, the carbon left over for growth (:math:`C_{growth}`: +(KgC individual\ :math:`^{-1}` year\ :math:`^{-1}`) is therefore + +.. math:: + + C_{growth} = \left\{ \begin{array}{ll} + C_{bal,coh}-\frac{\delta b_{store}}{\delta t} &\textrm{ for } (C_{bal,coh}-\frac{\delta b_{store}}{\delta t}) > 0\\ + &\\ + 0&\textrm{ for } (C_{bal,coh}-\frac{\delta b_{store}}{\delta t}) \leq 0\\ + \end{array} \right. + +to allocate the remaining carbon (if there is any), we first ascertain +whether the live biomass pool is at its target, or whether is has been +depleted by previous low carbon timesteps. Thus + +.. math:: + + \begin{array}{lll} + b_{alive,target}&= b_{leaf,target} (1+ f_{frla}+f_{swh}h_{coh}) &\textrm{for } S_{phen,coh} = 2\\ + b_{alive,target}&= b_{leaf,target} ( f_{frla}+f_{swh}h_{coh})&\textrm{for } S_{phen,coh} = 1\\ + \end{array} + +where the target leaf biomass :math:`b_{leaf.target}` ((Kg C +individual\ :math:`^{-1}`)) is the allometric relationship between dbh +and leaf biomass, ameliorated by the leaf trimming fraction (see +‘control of leaf area’ below) + +.. math:: b_{leaf.target} = c_{leaf}\cdot dbh_{coh}^{e_{leaf,dbh}} \rho_{ft} ^{e_{leaf,dens}}\cdot C_{trim,coh} + +:math:`\rho_{ft}` is the wood density, in g cm\ :math:`^{3}`. + +Allocation to Seeds +~~~~~~~~~~~~~~~~~~~ + +The fraction remaining for growth (expansion of live and structural +tissues) :math:`f_{growth}` is 1 minus that allocated to seeds. + +.. math:: f_{growth,coh} = 1 - f_{seed,coh} + +Allocation to seeds only occurs if the alive biomass is not below its +target, and then is a predefined fixed fraction of the carbon remaining +for growth. Allocation to clonal reproduction (primarily for grasses) +occurs when :math:`\textrm{max}_{dbh}` is achieved. + +.. math:: + + f_{seed,coh} = \left\{ \begin{array}{ll} + R_{frac,ft}&\textrm{ for } \textrm{max}_{dbh} < dbh_{coh} \\ + &\\ + \left( R_{frac,ft}+C_{frac,ft} \right) &\textrm{ for } \textrm{max}_{dbh} \geq dbh_{coh} \\ + \end{array} \right. + +the total amount allocated to seed production (:math:`p_{seed,coh}` in +KgC individual :math:`^{-1}` y\ :math:`^{-1}`) is thus + +.. math:: p_{seed,coh} = C_{growth}\cdot f_{seed,coh} + +Allocation to growing pools +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +[16]_ The carbon is then partitioned into carbon available to grow the +:math:`b_{alive}` and :math:`b_{struc}` pools. A fraction :math:`v_{a}` +is available to live biomass pools, and a fraction :math:`v_{s}` is +available to structural pools. + +.. math:: \frac{\delta b_{alive}}{\delta t} = C_{growth}\cdot f_{growth} v_{a} + +.. math:: \frac{\delta b_{struc}}{\delta t} = C_{growth}\cdot f_{growth} v_{s} + +If the alive biomass is lower than its ideal target, all of the +available carbon is directed into that pool. Thus: + +.. math:: + + v_{a}= \left\{ \begin{array}{ll} + \frac{1}{1+u}&\textrm{ for } b_{alive} \geq b_{alive,target} \\ + &\\ + 1.0&\textrm{ for } b_{alive} < b_{alive,target} \\ + \end{array} \right. + +.. math:: + + v_{s}= \left\{ \begin{array}{ll} + \frac{u}{1+u}&\textrm{ for } b_{alive} \geq b_{alive,target} \\ + &\\ + 0.0&\textrm{ for } b_{alive} < b_{alive,target} \\ + \end{array} \right. + +In this case, the division of carbon between the live and structural +pools :math:`u` is derived as the inverse of the sum of the rates of +change in live biomass with respect to structural: + +.. math:: u = \frac{1}{\frac{\delta b_{leaf}}{ \delta b_{struc} } + \frac{\delta b_{root}}{ \delta b_{struc} } +\frac{\delta b_{sw}}{ \delta b_{struc} } } + +To calculate all these differentials, we first start with +:math:`\delta b_{leaf}/\delta b_{struc}`, where + +.. math:: \frac{\delta b_{leaf}}{ \delta b_{struc}}= \frac{\frac{\delta \mathrm{dbh}}{\delta b_{struc}}} {\frac{\delta \mathrm{dbh} }{\delta b_{leaf}} } + +The rates of change of dbh with respect to leaf and structural biomass +are the differentials of the allometric equations linking these terms to +each other. Hence, + +.. math:: \frac{\delta \mathrm{dbh} }{\delta b_{leaf}}=\frac{1}{b_{trim,coh}}\cdot (e_{leaf,dbh}-1)\exp {\big(c_{leaf} \mathrm{dbh}^{(e_{leaf,dbh})-1} \rho_{ft}^{e_{leaf,dens}} \big)} + +and where :math:`\mathrm{dbh}_{coh} > \mathrm{dbh}_{max}` + +.. math:: \frac{\delta b_{struc}}{\delta \mathrm{dbh}} = e_{str,dbh} \cdot c_{str}\cdot e_{str,hite} h_{coh}^{e_{str,dbh}-1} \mathrm{dbh}_{coh}^{e_{str,dbh}} \rho_{ft}^{e_{str,dens}} + +If :math:`\mathrm{dbh}_{coh} \leq \mathrm{dbh}_{max}` then we must +also account for allocation for growing taller as: + +.. math:: \frac{\delta b_{struc}}{\delta \mathrm{dbh}} = \frac{\delta b_{struc}}{\delta \mathrm{dbh}} + \frac{\delta h}{\delta \mathrm{dbh}} \cdot \frac{\delta b_{struc}}{\delta \mathrm{dbh} } + +where + +.. math:: \frac{\delta h}{\delta \mathrm{dbh}}= 1.4976 \mathrm{dbh}_{coh}^{m_{allom}-1} + +.. math:: \frac{\delta \mathrm{dbh} }{\delta b_{struc}} =\frac{1}{ \frac{\delta b_{struc}}{\delta \mathrm{dbh}} } + +Once we have the :math:`\delta b_{leaf}/\delta b_{struc}`, we calculate +:math:`\delta b_{root}/\delta b_{struc}` as + +.. math:: \frac{\delta b_{root}}{\delta b_{struc}} =\frac{\delta b_{leaf}}{\delta b_{struc}}\cdot f_{frla} + +and the sapwood differential as + +.. math:: \frac{\delta b_{sw}}{\delta b_{struc}} = f_{swh}\left( h_{coh} \frac{\delta b_{leaf}}{ \delta b_{struc}} + b_{leaf,coh}\frac{\delta h}{\delta b_{struc}} \right) + +where + +.. math:: \frac{\delta h}{\delta b_{struc}} = \frac{1}{c_{str}\times e_{str,hite} h_{coh}^{e_{str,dbh}-1} \mathrm{dbh}_{coh}^{e_{str,dbh}} \rho_{ft}^{e_{str,dens}}} + +In all of the above terms, height in in m, :math:`\mathrm{dbh}` is in +cm, and all biomass pools are in KgCm\ :math:`^{-2}`. The allometric +terms for the growth trajectory are all taken from the ED1.0 model, but +could in theory be altered to accomodate alternative allometric +relationships. Critically, the non-linear relationships between live and +structural biomass pools are maintained in this algorithm, which +diverges from the methodology currently deployed in the CLM4.5. + +Integration of allocated fluxes +------------------------------- + +All of the flux calculations generate differential of the biomass state +variables against time (in years). To integrate these differential rates +into changes in the state variables, we use a simple simple forward +Euler integration. Other methods exist (e.g. ODEINT solvers, Runge Kutta +methods etc.), but they are more prone to errors that become difficult +to diagnose, and the typically slow rates of change of carbon pools mean +that these are less important than they might be in strongly non-linear +systems (soil drainage, energy balance, etc.) + +.. math:: b_{alive,t+1} = \textrm{min}\left( 0,b_{alive,t} + \frac{\delta b_{alive}}{\delta t} \delta t \right) + +.. math:: b_{struc,t+1} = \textrm{min}\left(0, b_{struc,t} + \frac{\delta b_{struc}}{\delta t} \delta t \right) + +.. math:: b_{store,t+1} = \textrm{min}\left(0, b_{store,t} + \frac{\delta b_{store}}{\delta t} \delta t \right) + +In this case, :math:`\delta t` is set to be one day +(:math:`\frac{1}{365}` years). + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{Parameters needed for allocation model. } + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| S | Target stored | none | *ft* | +| | biomass as | | | +| | fraction of | | | +| | :math:`b_{leaf}`| | | +| | | | | ++-----------------+-----------------+-----------------+-----------------+ +| f | Minimum | none | *ft* | +| | fraction of | | | +| | turnover that | | | +| | must be met | | | ++-----------------+-----------------+-----------------+-----------------+ +| R | Fraction | none | *ft* | +| | allocated to | | | +| | seeds | | | ++-----------------+-----------------+-----------------+-----------------+ +| C | Fraction | none | *ft* | +| | allocated to | | | +| | clonal | | | +| | reproduction | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\textrm{ | Diameter at | m | *ft* | +| max}_{dbh}` | which maximum | | | +| | height is | | | +| | achieved | | | ++-----------------+-----------------+-----------------+-----------------+ +| P | Does this | 1=yes, 0=no | *ft* | +| | cohort have an | | | +| | evergreen | | | +| | phenological | | | +| | habit? | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +Control of Leaf Area Index +========================== + + [17]_ + +The leaf area :math:`A_{leaf}` (m:math:`^{-2}`) of each cohort is +calculated from leaf biomass :math:`b_{leaf,coh}` (kgC +individual\ :math:`^{-1}`) and specific leaf area (SLA, m\ :math:`^2` kg +C\ :math:`^{-1}`) + +.. math:: A_{leaf,coh} = b_{leaf,coh} \cdot SLA_{ft} + +For a given tree allometry, leaf biomass is determined from basal area +using the function used by :raw-latex:`\cite{mc_2001}` where :math:`d_w` +is wood density in g cm\ :math:`^{-3}`. + +.. math:: b_{leaf,coh} = c_{leaf} \cdot dbh_{coh}^{e_{leaf,dbh}} \rho_{ft}^{e_{leaf,dens}} + +However, using this model, where leaf area and crown area are both +functions of diameter, the leaf area index of each tree in a closed +canopy forest is always the same (where :math:`S_{c,patch}` = +:math:`S_{c,min}` , irrespective of the growth conditions. To allow +greater plasticity in tree canopy structure, and for tree leaf area +index to adapt to prevailing conditions, we implemented a methodology +for removing those leaves in the canopy that exist in negative carbon +balance. That is, their total annual assimilation rate is insufficient +to pay for the turnover and maintenance costs associated with their +supportive root and stem tissue, plus the costs of growing the leaf. The +tissue turnover maintenance cost (KgC m\ :math:`^{-2} y^{-1}` of leaf is +the total maintenance demand divided by the leaf area: + +.. math:: L_{cost,coh} = \frac{t_{md,coh}} {b_{leaf,coh} \cdot \textrm{SLA}} + +The net uptake for each leaf layer :math:`U_{net,z}` in (KgC +m\ :math:`^{-2}` year\ :math:`^{-1}`) is + +.. math:: U_{net,coh,z} = g_{coh,z}-r_{m,leaf,coh,z} + +where :math:`g_{z}` is the GPP of each layer of leaves in each tree (KgC +m\ :math:`^{-2}` year\ :math:`^{-1}`), :math:`r_{m,leaf,z}` is the rate +of leaf dark respiration (also KgC m\ :math:`^{-2}` +year\ :math:`^{-1}`). We use an iterative scheme to define the cohort +specific canopy trimming fraction :math:`C_{trim,coh}`, on an annual +time-step, where + +.. math:: b_{leaf,coh} = C_{trim} \times 0.0419 dbh_{coh}^{1.56} d_w^{0.55} + +If the annual maintenance cost of the bottom layer of leaves (KgC m-2 +year-1) is less than then the canopy is trimmed by an increment :math:`\iota_l`\ (0.01), which is applied until the end of next calander year. Because this is an optimality model, there is an +issue of the timescale over which net assimilation is evaluated, the +timescale of response, and the plasticity of plants to respond to these +pressures. These properties should be investigated further in future +efforts. + +.. math:: + + C_{trim,y+1} = \left\{ \begin{array}{ll} + \rm{max}(C_{trim,y}-\iota_l,1.0)&\rm{for} (L_{cost,coh} > U_{net,coh,nz})\\ + &\\ + \rm{min}(C_{trim,y}+\iota_l,L_{trim,min})&\rm{for} (L_{cost,coh} < U_{net,coh,nz})\\ + \end{array} \right. + +We impose an arbitrary minimum value on the scope of canopy trimming of +:math:`L_{trim,min}` (0.5). If plants are able simply to drop all of +their canopy in times of stress, with no consequences, then tree +mortality from carbon starvation is much less likely to occur because of +the greatly reduced maintenance and turnover requirements. + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{Parameters needed for leaf area control model. } + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`\iota_l` | Fraction by | none | - | +| | which leaf mass | | | +| | is reduced next | | | +| | year | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`L_{trim, | Minimum | - | | +| min}` | fraction to | | | +| | which leaf mass | | | +| | can be reduced | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +Phenology +========= + +Cold Deciduous Phenology +------------------------ + +Cold Leaf-out timing +~~~~~~~~~~~~~~~~~~~~ + +[18]_. The phenology model of :raw-latex:`\cite{botta2000}` is used in +CLM(ED) to determine the leaf-on timing. The Botta et al. model was +verified against satellite data and is one of the only globally verified +and published models of leaf-out phenology. This model differs from the +phenology model in the CLM4.5. The model simulates leaf-on date as a +function of the number of growing degree days (GDD), defined by the sum +of mean daily temperatures (:math:`T_{day}` :math:`^{o}`\ C) above a +given threshold :math:`T_{g}` (0 :math:`^{o}`\ C). + +.. math:: GDD=\sum \textrm{max}(T_{day}-T_{g},0) + +Budburst occurs when :math:`GDD` exceeds a threshold +(:math:`GDD_{crit}`). The threshold is modulated by the number of +chilling days experienced (NCD) where the mean daily temperature falls +below a threshold determined by :raw-latex:`\cite{botta2000}` as +5\ :math:`^{o}`\ C. A greater number of chilling days means that fewer +growing degree days are required before budburst: + +.. math:: GDD_{crit}=a+be^{c.NCD} + +where a = -68, b= 638 and c=-0.01 :raw-latex:`\cite{botta2000}`. In the +Northern Hemisphere, counting of degree days begins on 1st January, and +of chilling days on 1st November. The calendar opposite of these dates +is used for points in the Southern Hemisphere. + +If the growing degree days exceed the critical threshold, leaf-on is +triggered by a change in the gridcell phenology status flag +:math:`S_{phen,grid}` where ‘2’ indicates that leaves should come on and +‘1’ indicates that they should fall. + +.. math:: + + \begin{array}{ll} + S_{phen,grid} = 2 + &\textrm{ if } S_{phen,grid} = 1\textrm{ and } GDD_{grid} \ge GDD_{crit} \\ + \end{array} + +Cold Leaf-off timing +~~~~~~~~~~~~~~~~~~~~ + +The leaf-off model is taken from the Sheffield Dynamic Vegetation Model +(SDGVM) and is similar to that for LPJ +:raw-latex:`\parencite{sitch2003}` and IBIS +:raw-latex:`\parencite{foley1996}` models. The average daily +temperatures of the previous 10 day period are stored. Senescence is +triggered when the number of days with an average temperature below +7.5\ :math:`^{o}` (:math:`n_{colddays}`) rises above a threshold values +:math:`n_{crit,cold}`, set at 5 days. + +.. math:: + + \begin{array}{ll} + S_{phen,grid} = 1 + &\textrm{ if } S_{phen,grid} = 2\textrm{ and } n_{colddays} \ge n_{crit,cold} \\ + \end{array} + +Global implementation modifications +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Because of the global implementation of the cold-deciduous phenology +scheme, adjustments must be made to account for the possibility of +cold-deciduous plants experiencing situations where no chilling period +triggering leaf-off ever happens. If left unaccounted for, these leaves +will last indefinitely, resulting in highly unrealistic behaviour. +Therefore, we implement two additional rules. Firstly, if the number of +days since the last senescence event was triggered is larger than 364, +then leaf-off is triggered on that day. Secondly, if no chilling days +have occured during the winter accumulation period, then leaf-on is not +triggered. This means that in effect, where there are no cold periods, +leaves will fall off and not come back on, meaning that cold-deciduous +plants can only grow in places where there is a cold season. + +Further to this rule, we introduce a ‘buffer’ time periods after leaf-on +of 30 days, so that cold-snap periods in the spring cannot trigger a +leaf senescence. The 30 day limit is an arbitrary limit. In addition, we +constrain growing degree day accumulation to the second half of the year +(Jult onwards in the Northern hemisphere, or Jan-June in the Southern) +and only allow GDD accumulation while the leaves are off. + +Drought-deciduous Phenology +--------------------------- + +In the current version of the model, a drought deciduous algorithm +exists, but is not yet operational, due to issue detected in the exsting +CN and soil moisture modules, which also affect the behaviour of the +native ED drought deciduous model. This is a priority to address before +the science tag is released. + +Carbon Dynamics of deciduous plants +----------------------------------- + + [19]_ + +In the present version, leaf expansion and senescence happen over the +course of a single day. This is clearly not an empirically robust +representation of leaf behaviour, whereby leaf expansion occurs over a +period of 10-14 days, and senescence over a similar period. This will be +incorporated in later versions. When the cold or drought phenological +status of the gridcell status changes (:math:`S_{phen,grid}`) from ‘2’ +to ‘1’, and the leaves are still on (:math:`S_{phen,coh}` =2 ), the leaf +biomass at this timestep is ’remembered’ by the model state variable +:math:`l_{memory,coh}`. This provides a ‘target’ biomass for leaf onset +at the beginning of the next growing season (it is a target, since +depletion of stored carbon in the off season may render achieving the +target impossible). + +.. math:: l_{memory,coh} = b_{leaf,coh} + +Leaf carbon is then added to the leaf litter flux :math:`l_{leaf,coh}` +(KgC individual\ :math:`^{-1}`) + +.. math:: l_{leaf,coh} = b_{leaf,coh} + +The alive biomass is depleted by the quantity of leaf mass lost, and the +leaf biomass is set to zero + +.. math:: b_{alive,coh} = b_{alive,coh} - b_{leaf,coh} + +.. math:: b_{leaf,coh} = 0 + +Finally, the status :math:`S_{phen,coh}` is set to 1, indicating that +the leaves have fallen off. + +For bud burst, or leaf-on, the same occurs in reverse. If the leaves are +off (:math:`S_{phen,coh}`\ =1) and the phenological status triggers +budburst (:math:`S_{phen,grid}`\ =2) then the leaf mass is set the +maximum of the leaf memory and the available store + +.. math:: b_{leaf,coh} = \textrm{max}\left(l_{memory,coh}, b_{store,coh}\right.) + +this amount of carbon is removed from the store + +.. math:: b_{store,coh} = b_{store,coh} - b_{leaf,coh} + +and the new leaf biomass is added to the alive pool + +.. math:: b_{alive,coh} = b_{alive,coh} + b_{leaf,coh} + +Lastly, the leaf memory variable is set to zero and the phenological +status of the cohort back to ‘2’. No parameters are currently required +for this carbon accounting scheme. + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{Parameters needed for phenology model. } + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`n_{crit, | Threshold of | none | - | +| cold}` | cold days for | | | +| | senescence | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`T_{g}` | Threshold for | :math:`^{o}`\ C | | +| | counting | | | +| | growing degree | | | +| | days | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +Seed Dynamics and Recruitment +============================= + + [20]_ + +The production of seeds and their subsequent germination is a process +that must be captured explicitly or implicitly in vegetation models. The +CLM(ED) contains a seed bank model designed to allow the dynamics of +seed production and germination to be simulated independently. In the +ED1.0 model, seed recruitment occurs in the same timestep as allocation +to seeds, which prohibits the survival of a viable seed bank through a +period of disturbance or low productivity (winter, drought). In the +CLM(ED) model, a plant functional type specific seed bank is tracked in +each patch (:math:`Seeds_{patch}` KgC m\ :math:`^{-2}`), whose rate of +change (KgC m\ :math:`^{-2}` y\ :math:`^{-1}`) is the balance of inputs, +germination and decay: + +.. math:: \frac{\delta Seeds_{FT}}{\delta t } = Seed_{in,ft} - Seed_{germ,ft} - Seed_{decay,ft} + +where :math:`Seed_{in}`, :math:`Seed_{germ}` and :math:`Seed_{decay}` +are the production, germination and decay (or onset of inviability) of +seeds, all in KgC m\ :math:`^{-2}` year\ :math:`^{-1}`. + +Seeds are assumed to be distributed evenly across the site (in this +version of the model), so the total input to the seed pool is therefore +the sum of all of the reproductive output of all the cohorts in each +patch of the correct PFT type. + +.. math:: Seed_{in,ft} = \frac{\sum_{p=1}^{n_{patch}}\sum_{i=1}^{n_{coh}}p_{seed,i}.n_{coh}}{area_{site}} + +Seed decay is the sum of all the processes that reduce the number of +seeds, taken from :raw-latex:`\cite{lischke2006}`. Firstly, the rate at +which seeds become inviable is described as a constant rate :math:`\phi` +(y:math:`^{-1}`) which is set to 0.51, the mean of the parameters used +by :raw-latex:`\cite{lischke2006}`. + +.. math:: Seed_{decay,ft} = Seeds_{FT}.\phi + +The seed germination flux is also prescribed as a fraction of the +existing pool (:math:`\alpha_{sgerm}`), but with a cap on maximum +germination rate :math:`\beta_{sgerm}`, to prevent excessive dominance +of one plant functional type over the seed pool. + +.. math:: Seed_{germ,ft} = \textrm{max}(Seeds_{FT}\cdot \alpha_{sgerm},\beta_{sgerm}) + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{Parameters needed for seed model. } + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`K_s` | Maximum seed | kgC m\ | | +| | mass | :math:`^{-2}` | | +| | | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\alpha_{ | Proportional | - | | +| sgerm}` | germination | | | +| | rate | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\beta_{s | Maximum | KgC | | +| germ}` | germination | m\ :math:`^{-2}`| | +| | rate | | | +| | | y\ :math:`^{-1}`| | +| | | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\phi` | Decay rate of | none | FT | +| | viable seeds | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`R_{frac, | Fraction of | none | FT | +| ft}` | :math:`C_{bal}` | | | +| | devoted to | | | +| | reproduction | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +Fragmenting Litter Pool Production and Turnover +=============================================== + +| The original CLM4.5 model contains streams of carbon pertaining to + different chemical properties of litter (lignin, cellulose and labile + streams, specifically). In the CLM(ED) model, the fire simulation + scheme in the SPITFIRE model requires that the model tracks the pools + of litter pools that differ with respect to their propensity to burn + (surface area-volume ratio, bulk density etc.). Therefore, this model + contains more complexity in the representation of coarse woody debris. + We also introduce the concept of ’fragmenting’ pools, which are pools + that can be burned, but are not available for decomposition or + respiration. In this way, we can both maintain above-ground pools that + affect the rate of burning, and the lag between tree mortality and + availability of woody material for decomposition. +| The CLM(ED) recognizes four classes of litter. Above- and below-ground + coarse woody debris (:math:`CWD_{AG}`, :math:`CWD_{BG}`) and leaf + litter (:math:`l_{leaf}` and fine root litter :math:`l_{root}`). All + pools are represented per patch, and with units of kGC + m\ :math:`{^-2}`. Further to this, :math:`CWD_{AG}`, :math:`CWD_{BG}` + are split into four litter size classes (:math:`lsc`) for the purposes + of proscribing this to the SPITFIRE fire model (seed ’Fuel Load’ + section for more detail. 1-hour (twigs), 10-hour (small branches), + 100-hour (large branches) and 1000-hour(boles or trunks). 4.5 %, 7.5%, + 21 % and 67% of the woody biomass (:math:`b_{store,coh} + b_{sw,coh}`) + is partitioned into each class, respectively. + +:math:`l_{leaf}` and :math:`l_{root}` are indexed by plant functional +type (:math:`ft`). The rational for indexing leaf and fine root by PFT +is that leaf and fine root matter typically vary in their +carbon:nitrogen ratio, whereas woody pools typically do not. + +Rates of change of litter, all in kGC m\ :math:`{^-2}` +year\ :math:`^{-1}`, are calculated as + +.. math:: \frac{\delta CWD_{AG,out,lsc}}{ \delta t }= CWD_{AG,in,lsc} - CWD_{AG,out,lsc} + +.. math:: \frac{\delta CWD_{BG,out,lsc}}{ \delta t } = CWD_{BG,in,lsc} - CWD_{BG,in,lsc} + +.. math:: \frac{\delta l_{leaf,out,ft} }{ \delta t } = l_{leaf,in,ft} - l_{leaf,out,ft} + +.. math:: \frac{\delta l_{root,out,ft} }{ \delta t } = l_{root,in,ft} - l_{root,out,ft} + +Litter Inputs +------------- + +[21]_Inputs into the litter pools come from tissue turnover, mortality of +canopy trees, mortality of understorey trees, mortality of seeds, and +leaf senescence of deciduous plants. + +.. math:: l_{leaf,in,ft} =\Big(\sum_{i=1}^{n_{coh,ft}} n_{coh}(l_{md,coh} + l_{leaf,coh}) + M_{t,coh}.b_{leaf,coh}\Big)/\sum_{p=1}^{n_{pat}}A_{patch} + +where :math:`l_{md,coh}` is the leaf turnover rate for evergreen trees +and :math:`l_{leaf,coh}` is the leaf loss from phenology in that +timestep (KgC :math:`m^{-2}`. :math:`M_{t,coh}` is the total mortality +flux in that timestep (in individuals). For fine root input. +:math:`n_{coh,ft}` is the number of cohorts of functional type +‘:math:`FT`’ in the current patch. + +.. math:: l_{root,in,ft} =\Big(\sum_{i=1}^{n_{coh,ft}} n_{coh}(r_{md,coh} ) + M_{t,coh}.b_{root,coh}\Big)/\sum_{p=1}^{n_{pat}}A_p + +where :math:`r_{md,coh}` is the root turnover rate. For coarse woody +debris input (:math:`\mathit{CWD}_{AG,in,lsc}` , we first calculate the +sum of the mortality :math:`M_{t,coh}.(b_{struc,coh}+b_{sw,coh})` and +turnover :math:`n_{coh}(w_{md,coh}`) fluxes, then separate these into +size classes and above/below ground fractions using the fixed fractions +assigned to each (:math:`f_{lsc}` and :math:`f_{ag}`) + +.. math:: \mathit{CWD}_{AG,in,lsc} =\Big(f_{lsc}.f_{ag}\sum_{i=1}^{n_{coh,ft}}n_{coh}w_{md,coh} + M_{t,coh}.(b_{struc,coh}+b_{sw,coh})\Big)/\sum_{p=1}^{n_{pat}}A_p + +.. math:: \mathit{CWD}_{BG,in,lsc} =\Big(f_{lsc}.(1-f_{ag})\sum_{i=1}^{n_{coh,ft}}n_{coh}w_{md,coh} + M_{t,coh}.(b_{struc,coh}+b_{sw,coh})\Big)/\sum_{p=1}^{n_{pat}}A_p + +Litter Outputs +-------------- + + [22]_ + +The fragmenting litter pool is available for burning but not for +respiration or decomposition. Fragmentation rates are calculated +according to a maximum fragmentation rate (:math:`\alpha_{cwd,lsc}` or +:math:`\alpha_{litter}`) which is ameliorated by a temperature and water +dependent scalar :math:`S_{tw}`. The form of the temperature scalar is +taken from the existing CLM4.5BGC decomposition cascade calculations). +The water scaler is equal to the water limitation on photosynthesis +(since the CLM4.5BGC water scaler pertains to the water potential of +individual soil layers, which it is difficult to meaningfully average, +given the non-linearities in the impact of soil moisture). The scaler +code is modular, and new functions may be implemented trivially. Rate +constants for the decay of the litter pools are extremely uncertain in +literature, as few studies either separate litter into size classes, nor +examine its decomposition under non-limiting moisture and temperature +conditions. Thus, these parameters should be considered as part of +sensitivity analyses of the model outputs. + +.. math:: \mathit{CWD}_{AG,out,lsc} = CWD_{AG,lsc}. \alpha_{cwd,lsc}.S_{tw} + +.. math:: \mathit{CWD}_{BG,out,lsc} = CWD_{BG,lsc} .\alpha_{cwd,lsc}.S_{tw} + +.. math:: l_{leaf,out,ft} = l_{leaf,ft}.\alpha_{litter}.S_{tw} + +.. math:: l_{root,out,ft} = l_{root,ft}.\alpha_{root,ft}.S_{tw} + +Flux into decompsition cascade +------------------------------ + + [23]_ + +Upon fragmentation and release from the litter pool, carbon is +transferred into the labile, lignin and cellulose decomposition pools. +These pools are vertically resolved in the biogeochemistry model. The +movement of carbon into each vertical layer is obviously different for +above- and below-ground fragmenting pools. For each layer :math:`z` and +chemical litter type :math:`i`, we derive a flux from ED into the +decomposition cascade as :math:`ED_{lit,i,z}` (kGC m\ :math:`^{-2}` +s\ :math:`^{-1}`) + +where :math:`t_c` is the time conversion factor from years to seconds, +:math:`f_{lab,l}`, :math:`f_{cel,l}` and :math:`f_{lig,l}` are the +fractions of labile, cellulose and lignin in leaf litter, and +:math:`f_{lab,r}`, :math:`f_{cel,r}` and :math:`f_{lig,r}` are their +counterparts for root matter. Similarly, :math:`l_{prof}`, +:math:`r_{f,prof}`\ and :math:`r_{c,prof}` are the fractions of leaf, +coarse root and fine root matter that are passed into each vertical soil +layer :math:`z`, derived from the CLM(BGC) model. + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{Parameters needed for litter model. } + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`\alpha_{ | Maximum | y\ :math:`^{-1}`| | +| cwd,lsc}` | fragmentation | | | +| | rate of CWD | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\alpha_{ | Maximum | y\ :math:`^{-1}`| | +| litter}` | fragmentation | | | +| | rate of leaf | | | +| | litter | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\alpha_{ | Maximum | y\ :math:`^{-1}`| | +| root}` | fragmentation | | | +| | rate of fine | | | +| | root litter | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{lab,l | Fraction of | none | | +| }` | leaf mass in | | | +| | labile carbon | | | +| | pool | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{cel,l | Fraction of | none | | +| }` | leaf mass in | | | +| | cellulose | | | +| | carbon pool | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{lig,l | Fraction of | none | | +| }` | leaf mass in | | | +| | lignin carbon | | | +| | pool | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{lab,r | Fraction of | none | | +| }` | root mass in | | | +| | labile carbon | | | +| | pool | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{cel,r | Fraction of | none | | +| }` | root mass in | | | +| | cellulose | | | +| | carbon pool | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{lig,r | Fraction of | none | | +| }` | root mass in | | | +| | lignin carbon | | | +| | pool | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`l_{prof, | Fraction of | none | soil layer | +| z}` | leaf matter | | | +| | directed to | | | +| | soil layer z | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`r_{c,pro | Fraction of | none | soil layer | +| f,z}` | coarse root | | | +| | matter directed | | | +| | to soil layer z | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`r_{f,pro | Fraction of | none | soil layer | +| f,z}` | fine root | | | +| | matter directed | | | +| | to soil layer z | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +Plant Mortality +=============== + +Total plant mortality per cohort :math:`M_{t,coh}`, (fraction +year\ :math:`^{-1}`) is simulated as the sum of four additive terms, + +.. math:: M_{t,coh}= M_{b,coh} + M_{cs,coh} + M_{hf,coh} + M_{f,coh}, + +where :math:`M_b` is the background mortality that is unaccounted by +any of the other mortality rates and is fixed at 0.014. :math:`M_{cs}` +is the carbon starvation derived mortality, which is a function of the +non-structural carbon storage term :math:`b_{store,coh}` and the +PFT-specific ‘target’ carbon storage, :math:`l_{targ,ft}`, as follows: + +.. math:: M_{cs,coh}= \rm{max} \left(0.0, S_{m,ft} \left(0.5 - \frac{b_{store,coh}}{l_{targ,ft}b_{leaf}}\right)\right) + +where :math:`S_{m,ft}` is the ‘stress mortality’ parameter, or the +fraction of trees in a landscape that die when the mean condition of a +given cohort triggers mortality. This parameter is needed to scale from +individual-level mortality simulation to grid-cell average conditions. + +Mechanistic simulation of hydraulic failure is not undertaken on account +of it’s mechanistic complexity (see :raw-latex:`\cite{mcdowell2013}`for +details). Instead, we use a proxy for hydraulic failure induced +mortality (:math:`M_{hf,coh}`) that uses a water potential threshold +beyond mortality is triggered, such that the tolerance of low water +potentials is a function of plant functional type (as expressed via the +:math:`\psi_c` parameter). For each day that the aggregate water +potential falls below a threshold value, a set fraction of the trees are +killed. The aggregation of soil moisture potential across the root zone +is expressed using the :math:`\beta` function. We thus determine plant +mortality caused by extremely low water potentials as + +.. math:: + + M_{hf,coh} = \left\{ \begin{array}{ll} + S_{m,ft}& \textrm{for } \beta_{ft} < 10^{-6}\\ + &\\ + 0.0& \textrm{for } \beta_{ft}>= 10^{-6}.\\ + \end{array} \right. + +The threshold value of 10\ :math:`^{-6}` represents a state where the +average soil moisture potential is within 10\ :math:`^{-6}` of the +wilting point (a PFT specific parameter :math:`\theta_{w,ft}`). + +:math:`M_{hf,coh}` is the fire-induced mortality, as described in the +fire modelling section. + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{Parameters needed for mortality model. } + ++---------------------+--------------------------------+-------+------------+ +| Parameter Symbol | Parameter Name | Units | indexed by | ++=====================+================================+=======+============+ +| :math:`S_{m,ft}` | Stress Mortality Scaler | none | | ++---------------------+--------------------------------+-------+------------+ +| :math:`l_{targ,ft}` | Target carbon storage fraction | none | ft | ++---------------------+--------------------------------+-------+------------+ + +.. raw:: latex + + \bigskip + +Fire +==== + + [24]_ + +The influence of fire on vegetation is estimated using the SPITFIRE +model, which has been modified for use in ED following it’s original +implementation in the LPJ-SPITFIRE model +(:raw-latex:`\parencite{thonicke2010,pfeiffer2013}`. This model as +described is substantially different from the existing CLM4.5 fire model +:raw-latex:`\parencite{li2012}`, however, further developments are +intended to increase the merging of SPITFIRE’s natural vegetation fire +scheme with the fire suppression, forest-clearing and peat fire +estimations in the existing model. The coupling to the ED model allows +fires to interact with vegetation in a ‘size-structured’ manner, so +small fires can burn only understorey vegetation. Also, the patch +structure and representation of succession in the ED model allows the +model to track the impacts of fire on different forest stands, therefore +removing the problem of area-averaging implicit in area-based DGVMs. The +SPITFIRE approach has also been coupled to the LPJ-GUESS +individual-based model (Forrest et al. in prep) and so this is not the +only implementation of this type of scheme in existence. + +The SPITFIRE model operates at a daily timestep and at the patch level, +meaning that different litter pools and vegetation charecteristics of +open and closed forests can be represented effectively (we omit the +‘patch’ subscript throughout for simplicity). + +Properties of fuel load +----------------------- + +Many fire processes are impacted by the properties of the litter pool in +the SPITFIRE model. There are one live (live grasses) and five dead fuel +categories (dead leaf litter and four pools of coarse woody debris). +Coarse woody debris is classified into 1h, 10h, 100h, and 1000h fuels, +defined by “\ *the order of magnitude of time required for fuel to lose +(or gain) 63% of the difference between its current moisture content and +the equilibrium moisture content under defined atmospheric conditions.*" +:raw-latex:`\parencite{thonicke2010}`. For the purposes of describing +the behaviour of fire, we introduce a new index ‘fuel class’ *fc*, the +values of which correspond to each of the six possible fuel categories +as follows. + ++------------+------------------+-------------+ +| *fc* index | Fuel type | Drying Time | ++============+==================+=============+ +| 1 | dead grass | n/a | ++------------+------------------+-------------+ +| 2 | twigs | 1h fuels | ++------------+------------------+-------------+ +| 3 | small branches | 10h fuel | ++------------+------------------+-------------+ +| 4 | large branches | 100h fuel | ++------------+------------------+-------------+ +| 5 | stems and trunks | 1000h fuel | ++------------+------------------+-------------+ +| 6 | live grasses | n/a | ++------------+------------------+-------------+ + +.. raw:: latex + + \bigskip + +Fuel load +~~~~~~~~~ + +Total fuel load :math:`F_{tot,patch}` for a given patch is the sum of +the above ground coarse woody debris and the leaf litter, plus the alive +grass leaf biomass :math:`b_{l,grass}` multiplied by the non-mineral +fraction (1-:math:`M_{f}`). + +.. math:: F_{tot,patch}=\left(\sum_{fc=1}^{fc=5} CWD_{AG,fc}+l_{litter}+b_{l,grass}\right)(1-M_{f}) + +Many of the model behaviours are affected by the patch-level weighted +average properties of the fuel load. Typically, these are calculated in +the absence of 1000-h fuels because these do not contribute greatly to +fire spread properties. + +Nesterov Index +~~~~~~~~~~~~~~ + +Dead fuel moisture (:math:`\emph{moist}_{df,fc}`), and several other +properties of fire behaviour, are a function of the ‘Nesterov Index’ +(:math:`N_{I}`) which is an accumulation over time of a function of +temperature and humidity (Eqn 5, :raw-latex:`\cite{thonicke2010}`). + +.. math:: N_{I}=\sum{\textrm{max}(T_{d}(T_{d}-D),0)} + +where :math:`T_{d}` is the daily mean temperature in :math:`^{o}`\ C and +:math:`D` is the dew point calculated as . + +.. math:: + + \begin{aligned} + \upsilon&=&\frac{17.27T_{d}}{237.70+T_{d}}+\log(RH/100)\\ + D&=&\frac{237.70\upsilon}{17.27-\upsilon}\end{aligned} + +where :math:`RH` is the relative humidity (%). + +Dead Fuel Moisture Content +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Dead fuel moisture is calculated as + +.. math:: \emph{moist}_{df,fc}=e^{-\alpha_{fmc,fc}N_{I}} + +where :math:`\alpha_{fmc,fc}` is a parameter defining how fuel moisture +content varies between the first four dead fuel classes. + +Live grass moisture Content +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The live grass fractional moisture content(\ :math:`\emph{moist}_{lg}`) +is a function of the soil moisture content. (Equation B2 in +:raw-latex:`\cite{thonicke2010}`) + +.. math:: \emph{moist}_{lg}=\textrm{max}(0.0,\frac{10}{9}\theta_{30}-\frac{1}{9}) + +where :math:`\theta_{30}` is the fractional moisture content of the top +30cm of soil. + +Patch Fuel Moisture +~~~~~~~~~~~~~~~~~~~ + +The total patch fuel moisture is based on the weighted average of the +different moisture contents associated with each of the different live +grass and dead fuel types available (except 1000-h fuels). + +.. math:: F_{m,patch}=\sum_{fc=1}^{fc=4} \frac{F_{fc}}{F_{tot}}\emph{moist}_{df,fc}+\frac{b_{l,grass}}{F_{tot}}\emph{moist}_{lg} + +Effective Fuel Moisture Content +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Effective Fuel Moisture Content is used for calculations of fuel +consumed, and is a function of the ratio of dead fuel moisture content +:math:`M_{df,fc}` and the moisture of extinction factor, +:math:`m_{ef,fc}` + +.. math:: E_{moist,fc}=\frac{\emph{moist}_{fc}}{m_{ef,fc}} + +where the :math:`m_{ef}` is a function of surface-area to volume ratio. + +.. math:: m_{ef,fc}=0.524-0.066\log_{10}{\sigma_{fc}} + +Patch Fuel Moisture of Extinction +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The patch ‘moisture of extinction’ factor (:math:`F_{mef}`) is the +weighted average of the :math:`m_{ef}` of the different fuel classes + +.. math:: F_{mef,patch}=\sum_{fc=1}^{fc=5} \frac{F_{fc}}{F_{tot}}m_{ef,fc}+\frac{b_{l,grass}}{F_{tot}}m_{ef,grass} + +Patch Fuel Bulk Density +~~~~~~~~~~~~~~~~~~~~~~~ + +The patch fuel bulk density is the weighted average of the bulk density +of the different fuel classes (except 1000-h fuels). + +.. math:: F_{bd,patch}=\sum_{fc=1}^{fc=4} \frac{F_{fc}}{F_{tot}}\beta_{fuel,fc}+\frac{b_{l,grass}}{F_{tot}}\beta_{fuel,lgrass} + +where :math:`\beta_{fuel,fc}` is the bulk density of each fuel size +class (kG m\ :math:`^{-3}`) + +Patch Fuel Surface Area to Volume +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The patch surface area to volume ratio (:math:`F_{\sigma}`) is the +weighted average of the surface area to volume ratios +(:math:`\sigma_{fuel}`) of the different fuel classes (except 1000-h +fuels). + +.. math:: F_{\sigma}=\sum_{fc=1}^{fc=4} \frac{F_{fc}}{F_{tot}}\sigma_{fuel,fc}+\frac{b_{l,grass}}{F_{tot}}\sigma_{fuel,grass} + +Forward rate of spread +---------------------- + +For each patch and each day, we calculate the rate of forward spread of +the fire *ros*\ :math:`_{f}` (nominally in the direction of the wind). + +.. math:: \emph{ros}_{f}=\frac{i_{r}x_{i}(1-\phi_{w})}{F_{bd,patch}e_{ps}q_{ig}} + +:math:`e_{ps}` is the effective heating number +(:math:`e^{\frac{-4.528}{F_{\sigma,patch}}}`). :math:`q_{ig}` is the +heat of pre-ignition (:math:`581+2594F_{m}`). :math:`x_{i}` is the +propagating flux calculated as (see :raw-latex:`\cite{thonicke2010}` +Appendix A). + +.. math:: + + x_{i}= \left\{ \begin{array}{ll} + 0.0& \textrm{for $F_{\sigma,patch}<0.00001$}\\ + \frac{e^{0.792+3.7597F_{\sigma,patch}^{0.5}(\frac{F_{bd,patch}}{p_{d}}+0.1)}}{192+7.9095F_{\sigma,patch}} & \textrm{for $F_{\sigma,patch}\geq 0.00001$}\\ + \end{array} \right. + +:math:`\phi_{w}` is the influence of windspeed on rate of spread. + +.. math:: \phi_{w}=cb_{w}^{b}.\beta^{-e} + +Where :math:`b`, :math:`c` and :math:`e` are all functions of +surface-area-volume ratio :math:`F_{\sigma,patch}`: +:math:`b=0.15988F_{\sigma,patch}^{0.54}`, +:math:`c=7.47e^{-0.8711F_{\sigma,patch}^{0.55}}`, +:math:`e=0.715e^{-0.01094F_{\sigma,patch}}`. :math:`b_{w}=196.86W` where +:math:`W` is the the windspeed in ms\ :math:`^{-1}`, and +:math:`\beta=\frac{F_{bd}/p_{d}}{0.200395F_{\sigma,patch}^{-0.8189}}` +where :math:`p_{d}` is the particle density (513). + +:math:`i_{r}` is the reaction intensity, calculated using the following +set of expressions (from :raw-latex:`\cite{thonicke2010}` Appendix A).: + +.. math:: + + \begin{aligned} + i_{r}&=&\Gamma_{opt}F_{tot}Hd_{moist}d_{miner}\\ + d_{moist}&=&\textrm{max}\Big(0.0,(1-2.59m_{w}+5.11m_{w}^{2}-3.52m_{w}^{3})\Big)\\ + m_{w}&=&\frac{F_{m,patch}}{F_{mef,patch}}\\ + \Gamma _{opt}&=&\Gamma_{max}\beta^{a}\lambda\\ + \Gamma _{max}&=&\frac{1}{0.0591+2.926F_{\sigma,patch}^{-1.5}}\\ + \lambda&=&e^{a(1-\beta)}\\ + a&=&8.9033F_{\sigma,patch}^{-0.7913}\end{aligned} + +:math:`\Gamma_{opt}` is the residence time of the fire, and +:math:`d_{miner}` is the mineral damping coefficient +(=0.174:math:`S_e^{-0.19}` , where :math:`S_e` is 0.01 and so = +:math:`d_{miner}` 0.41739). + +Fuel Consumption +---------------- + +The fuel consumption (fraction of biomass pools) of each dead biomass +pool in the area affected by fire on a given day (:math:`f_{c,dead,fc}`) +is a function of effective fuel moisture :math:`E_{moist,fc}` and size +class *fc* (Eqn B1, B4 and B5, :raw-latex:`\cite{thonicke2010}`). The +fraction of each fuel class that is consumed decreases as its moisture +content relative to its moisture of extinction (:math:`E_{moist,fc}`) +increases. + +.. math:: f_{cdead,fc}=\textrm{max}\left(0,\textrm{min}(1,m_{int,mc,fc}-m_{slope,mc,fc}E_{moist,fc})\Big)\right. + +:math:`m_{int}` and :math:`m_{slope}` are parameters, the value of which +is modulated by both size class :math:`fc` and by the effective fuel +moisture class :math:`mc`, defined by :math:`E_{moist,fc}`. +:math:`m_{int}` and :math:`m_{slope}` are defined for low-, mid-, and +high-moisture conditions, the boundaries of which are also functions of +the litter size class following :raw-latex:`\cite{peterson1986}` (page +802). The fuel burned, :math:`f_{cground,fc}` (Kg m\ :math:`^{-2}` +day\ :math:`^{-1}`) iscalculated from :math:`f_{cdead,fc}` for each fuel +class: + +.. math:: f_{cground,fc}=f_{c,dead,fc}(1-M_{f})\frac{F_{fc}}{0.45} + +Where 0.45 converts from carbon to biomass. The total fuel consumption, +:math:`f_{ctot,patch}`\ (Kg m\ :math:`^{-2}`), used to calculate fire +intensity, is then given by + +.. math:: f_{ctot,patch}=\sum_{fc=1}^{fc=4} f_{c,ground,fc} + f_{c,ground,lgrass} + +There is no contribution from the 1000 hour fuels to the patch-level +:math:`f_{ctot,patch}` used in the fire intensity calculation. + +Fire Intensity +-------------- + +Fire intensity at the front of the burning area (:math:`I_{surface}`, kW +m\ :math:`^{-2}`) is a function of the total fuel consumed +(:math:`f_{ctot,patch}`) and the rate of spread at the front of the +fire, :math:`\mathit{ros}_{f}` (m min\ :math:`^{-1}`) (Eqn 15 +:raw-latex:`\cite{thonicke2010}`) + +.. math:: I_{surface}=\frac{0.001}{60}f_{energy} f_{ctot,patch}\mathit{ros}_{f} + +where :math:`f_{energy}` is the energy content of fuel (kJ/kG - the +same for alll fuel classes). Fire intensity is used to define whether an +ignition is successful. If the fire intensity is greater than 50kw/m +then the ignition is successful. + +Fire Duration +------------- + +Fire duration is a function of the fire danger index with a maximum +length of :math:`F_{dur,max}` (240 minutes in +:raw-latex:`\cite{thonicke2010}` Eqn 14, derived from Canadian Forest +Fire Behaviour Predictions Systems) + +.. math:: D_{f}=\textrm{min}\Big(F_{dur,max},\frac{F_{dur,max}}{1+F_{dur,max}e^{-11.06fdi}}\Big) + +Fire Danger Index +----------------- + +Fire danger index (*fdi*) is a representation of the effect of +meteorological conditions on the likelihood of a fire. It is calculated +for each gridcell as a function of the Nesterov Index . +:math:`\emph{fdi}` is calculated from :math:`NI` as + +.. math:: \emph{fdi}=1-e^{\alpha N_{I}} + +where :math:`\alpha` = 0.00037 following +:raw-latex:`\cite{venevsky2002}`. + +Area Burned +----------- + +Total area burnt is assumed to be in the shape of an ellipse, whose +major axis :math:`f_{length}` (m) is determined by the forward and +backward rates of spread (:math:`ros_{f}` and :math:`ros_{b}` +respectively). + +.. math:: f_{length}=F_{d}(ros_{b}+ros_{f}) + +:math:`ros_{b}` is a function of :math:`ros_{f}` and windspeed (Eqn 10 +:raw-latex:`\cite{thonicke2010}`) + +.. math:: ros_{b}=ros_{f}e^{-0.72W} + +The minor axis to major axis ratio :math:`l_{b}` of the ellipse is +determined by the windspeed. If the windspeed (:math:`W`) is less than +16.67 ms\ :math:`^{-1}` then :math:`l_{b}=1`. Otherwise (Eqn 12 and 13, +:raw-latex:`\cite{thonicke2010}`) + +.. math:: l_{b}=\textrm{min}\Big(8,f_{tree}(1.0+8.729(1.0-e^{-0.108W})^{2.155})+(f_{grass}(1.1+3.6W^{0.0464}))\Big) + +:math:`f_{grass}` and :math:`f_{tree}` are the fractions of the patch +surface covered by grass and trees respectively. + +The total area burned (:math:`A_{burn}` in m\ :math:`^{2}`) is therefore +(Eqn 11, :raw-latex:`\cite{thonicke2010}`) + +.. math:: A_{burn}=\frac{n_{f}\frac{3.1416}{4l_{b}}(f_{length}^{2}))}{10000} + +where :math:`n_{f}` is the number of fires. + +Crown Damage +------------ + +:math:`c_{k}` is the fraction of the crown which is consumed by the +fire. This is calculated from scorch height :math:`H_{s}`, tree height +:math:`h` and the crown fraction parameter :math:`F_{crown}` (Eqn 17 +:raw-latex:`\cite{thonicke2010}`): + +.. math:: + + c_{k} = \left\{ \begin{array}{ll} + 0 & \textrm{for $H_{s}<(h-hF_{crown})$}\\ + 1-\frac{h-H_{s}}{h-F_{crown}}& \textrm{for $h>H_{s}>(h-hF_{crown})$}\\ + 1 & \textrm{for $H_{s}>h$ } + \end{array} \right. + +The scorch height :math:`H_{s}` (m) is a function of the fire intensity, +following :raw-latex:`\cite{byram1959}`, and is proportional to a plant +functional type specific parameter :math:`\alpha_{s,ft}` (Eqn 16 +:raw-latex:`\cite{thonicke2010}`): + +.. math:: H_{s}=\sum_{FT=1}^{NPFT}{\alpha_{s,p}\cdot f_{biomass,ft}} I_{surface}^{0.667} + +where :math:`f_{biomass,ft}` is the fraction of the above-ground +biomass in each plant functional type. + +Cambial Damage and Kill +----------------------- + +The cambial kill is a function of the fuel consumed :math:`f_{c,tot}`, +the bark thickness :math:`t_{b}`, and :math:`\tau_{l}`, the duration of +cambial heating (minutes) (Eqn 8, :raw-latex:`\cite{peterson1986}`): + +.. math:: \tau_{l}=\sum_{fc=1}^{fc=5}39.4F_{p,c}\frac{10000}{0.45}(1-(1-f_{c,dead,fc})^{0.5}) + +Bark thickness is a linear function of tree diameter :math:`dbh_{coh}`, +defined by PFT-specific parameters :math:`\beta_{1,bt}` and +:math:`\beta_{2,bt}` (Eqn 21 :raw-latex:`\cite{thonicke2010}`): + +.. math:: t_{b,coh}=\beta_{1,bt,ft}+\beta_{2,bt,ft}dbh_{coh} + +The critical time for cambial kill, :math:`\tau_{c}` (minutes) is given +as (Eqn 20 :raw-latex:`\cite{thonicke2010}`): + +.. math:: \tau_{c}=2.9t_{b}^{2} + +The mortality rate caused by cambial heating :math:`\tau_{pm}` of trees +within the area affected by fire is a function of the ratio between +:math:`\tau_{l}` and :math:`\tau_{c}` (Eqn 19, +:raw-latex:`\cite{thonicke2010}`): + +.. math:: + + \tau_{pm} = \left\{ \begin{array}{ll} + 1.0 & \textrm{for } \tau_{1}/\tau_{c}\geq \textrm{2.0}\\ + 0.563(\tau_{l}/\tau_{c}))-0.125 & \textrm{for } \textrm{2.0} > \tau_{1}/\tau_{c}\ge \textrm{0.22}\\ + 0.0 & \textrm{for } \tau_{1}/\tau_{c}< \textrm{0.22}\\ + \end{array} \right. + +.. raw:: latex + + \bigskip + +.. raw:: latex + + \captionof{table}{Parameters needed for fire model. } + ++-----------------+-----------------+-----------------+-----------------+ +| Parameter | Parameter Name | Units | indexed by | +| Symbol | | | | ++=================+=================+=================+=================+ +| :math:`\beta_{1 | Intercept of | mm | *FT* | +| ,bt}` | bark thickness | | | +| | function | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\beta_{2 | Slope of bark | mm | *FT* | +| ,bt}` | thickness | cm\ :math:`^{-1 | | +| | function | }` | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`F_{crown | Ratio of crown | none | *FT* | +| }` | height to total | | | +| | height | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\alpha_{ | Fuel moisture | :math:`{^o}`\ C | *fc* | +| fmc}` | parameter | \ :math:`^{-2}` | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\beta_{f | Fuel Bulk | kG | *fc* | +| uel}` | Density | m\ :math:`^{-3}`| | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\sigma_{ | Surface area to | cm | *fc* | +| fuel,fc}` | volume ratio | :math:`^{-1}` | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`m_{int}` | Intercept of | none | :math:`fc`, | +| | fuel burned | | moisture class | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`m_{slope | Slope of fuel | none | :math:`fc`, | +| }` | burned | | moisture class | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`M_f` | Fuel Mineral | | | +| | Fraction | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`F_{dur,m | Maximum | Minutes | | +| ax}` | Duration of | | | +| | Fire | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`f_{energ | Energy content | kJ/kG | | +| y}` | of fuel | | | ++-----------------+-----------------+-----------------+-----------------+ +| :math:`\alpha_{ | Flame height | | *FT* | +| s}` | parameter | | | ++-----------------+-----------------+-----------------+-----------------+ + +.. raw:: latex + + \bigskip + +| + +.. raw:: latex + + \printbibliography + +.. [1] + This description covers algorithms in the ‘fuse_cohorts’ subroutine. + +.. [2] + This description covers algorithms in the ‘fuse_patches’ subroutine. + +.. [3] + This description covers algorithms in the ‘fuse_2_patches’ + subroutine. + +.. [4] + This description covers the structure of code in all modules in + clm4_5 that are located in ‘ED’ subdirectories + +.. [5] + This description covers algorithms in the ‘init_cohorts’ subroutine + +.. [6] + This description relates to algorithms in the allocate_live_biomass + subroutine + +.. [7] + This description relates to algorithms in the EDCanopyStructure + subroutine + +.. [8] + This description relates to algorithms in the canopy_spread + subroutine + +.. [9] + This description relates to algorithms in the + canopy_leaf_area_profile subroutine + +.. [10] + This description relates to algorithms in the ED_norman_radiation + subroutine + +.. [11] + This description relates to algorithms in the ED_photosynthesis + subroutine + +.. [12] + This description relates to algorithms in the ED_btran subroutine + +.. [13] + This description relates to algorithms in the ED_photosynthesis + subroutine + +.. [14] + This description relates to algorithms in the ED_photosynthesis + subroutine + +.. [15] + This description relates to algorithms in the Growth_Derivatives + subroutine + +.. [16] + This description relates to algorithms in the ED_GrowthFunctions + subroutine + +.. [17] + This description relates to algorithms in the trim_canopy subroutine + +.. [18] + This description relates to algorithms in the phenology subroutine + +.. [19] + This description relates to algorithms in the phenology_leafoff + subroutine + +.. [20] + This description relates to algorithms in the seed_in, seed_decay and + seed_germination subroutines + +.. [21] + This description relates to algorithms in the CWD_input, + mortality_litter_fluxes and fire_litter_fluxes subroutines + +.. [22] + This description relates to algorithms in the CWD_out subroutine + +.. [23] + This description relates to algorithms in the flux_into_litter_pools + subroutine +.. [24] + This description relates to algorithms in the ’SFMainMod’ subroutines From 3f5bfd8a5aef75763075d85af2ca02f29d2ca691 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Thu, 7 Dec 2017 11:21:40 -0700 Subject: [PATCH 0115/1973] modified author section of FATES tech note --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 72001f2827..beb93f3ac0 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -1,7 +1,3 @@ -====================================== -CLM(ED) model: Technical Documentation -====================================== - .. _rst_Dynamic Global Vegetation Model: Dynamic Global Vegetation @@ -30,17 +26,6 @@ Preamble Apr 1;8(4). | https://pdfs.semanticscholar.org/396c/b9f172cb681421ed78325a2237bfb428eece.pdf -Authors -======= - -Rosie Fisher, Stefan Muszala, Mariana Verteinstein, Peter Lawrence, Chonggang Xu,Nate McDowell, Ryan Knox, Charles Koven, Jennifer Holm, Brendan Rogers, David Lawrence, and Gordon Bonan. - -Acknowledgements -================ - -The development of the ideas in this document has benefitted from -conversation with many people, including William Bond, Peter Cox, Matthew Forest, Andrew Fox, William Hoffman, Peter Lawrence, Jeremy Lichstein, Heike Lischke, Mark Lomas, Nathan McDowell, Paul Moorcroft, Colin Prentice, Drew Purves, Naomi Tague, Benjamin Sanderson, Stephen Sitch, Abigail Swann, Anthony Walker, Mathew Williams, F.Ian Woodward \& S\"onke Zaehle. - Introduction ============ From 23a4006ea26fd41c155cf14ff663df443deeff9e Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Thu, 7 Dec 2017 14:14:49 -0700 Subject: [PATCH 0116/1973] altered headings on FATES chapter --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 277 ++++++++---------- 1 file changed, 120 insertions(+), 157 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index beb93f3ac0..c6f0558b6b 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -4,7 +4,7 @@ Dynamic Global Vegetation =================================== What has changed ----------------- +^^^^^^^^^^^^^^^^^^^^ - Deprecation of the dynamic global vegetation model (DGVM): The CLM5.0 model contains the legancy 'CNDV' code, which runs the CLM4(CN) model in combination with the LPJ-derived dynamics vegetation model introduced in CLM3. While this capacity has not technically been removed from the model, the DGVM has not been tested in the development of CLM5 and is no longer scientifically supported. @@ -12,25 +12,22 @@ What has changed Technical Documentation for FATES -================================== +=================================== -Preamble -======== +Introduction +^^^^^^^^^^^^^^^^^^^^ -| This document is a technical appendix to -| Fisher RA, Muszala S, Verteinstein M, Lawrence P, Xu C, McDowell NG, + This document is a technical appendix to + Fisher RA, Muszala S, Verteinstein M, Lawrence P, Xu C, McDowell NG, Knox RG, Koven C, Holm J, Rogers BM, Lawrence D. Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes. Geoscientific Model Development Discussions. 2015 Apr 1;8(4). -| https://pdfs.semanticscholar.org/396c/b9f172cb681421ed78325a2237bfb428eece.pdf + https://pdfs.semanticscholar.org/396c/b9f172cb681421ed78325a2237bfb428eece.pdf -Introduction -============ - -The CLM(ED) model is presented here as an option within the structure of +FATES is presented here as an option within the structure of the Community Land Model (CLM). Ecosystem Demography (‘ED’), is a concept derived from the work of :raw-latex:`\cite{mc_2001}` and is a cohort model of vegetation competition and co-existence, allowing a @@ -53,14 +50,11 @@ radiation transfer, for drought-deciduous and cold-deciduous phenology, for carbon storage allocation, and for tree mortality under carbon stress, are also included and presented here. -This Document -------------- +This Document UPDATE +---------------- This document describes the implementation of the Ecosystem Demography -concept within the Community Land Model. It is intended as a -supplementary document to the main CLM technical note, which is at the -time of writing, the CLM4.5 technical note -:raw-latex:`\parencite{oleson2013}`. The material covered describes how +concept within the Community Land Model. The material covered describes how the Ecosystem Demography code is organized, how it interacts with the pre-existing CLM routines, and the new aspects of plant physiology and vegetation dynamics that are introduced further to those already @@ -71,10 +65,10 @@ model, which is a fully operational land surface scheme concept and an array of physiological and ecological innovations surrounding the basic concept. Therefore, to avoid confusion between the concept of ‘Ecosystem Demography’ and the implementation of this concept -in different models, we refer our model as the ‘CLM(ED)’ throughout. +in different models, we refer our model as the ‘FATES’ (the functionally Assembled Terrestrial Ecosystem Simulator) throughout. -The representation of ecosystem heterogeneity in the CLM(ED) -============================================================ +The representation of ecosystem heterogeneity in FATES +^^^^^^^^^^^^^^^ The land surface of the Earth is heterogeneous for many reasons, driven by variations in climate, edaphic history, ecological variability, @@ -88,7 +82,7 @@ surface (e.g. soils, ice, lakes, bare ground) and then ‘columns’ referring to elements of the surface that share below ground resources (water & nutrients). Within the ‘soil’ landunit, for example, there are separate columns for crops, and for natural vegetation, as these are -assumed to use separate resource pools. The CLM(ED) model at present +assumed to use separate resource pools. The FATES model at present only operates on the naturally vegetated column. The ‘soil’ column is sub-divided into numerous tiles, that correspond to statistical fractions of the potentially vegetated land area. In the CLM 4.5 (and @@ -101,7 +95,7 @@ surface models deployed in climate prediction. The introduction of the Ecosystem Demography concept introduces significant alterations to the representation of the land surface in the -CLM. In the CLM(ED), the tiling structure represents the disturbance +CLM. In FATES, the tiling structure represents the disturbance history of the ecosystem. Thus, some fraction of the land surface is characterized as ‘recently disturbed’, some fraction has escaped disturbance for a long time, and other areas will have intermediate @@ -205,7 +199,7 @@ classes within those plant functional types. Each cohort is associated with a number of identical trees, :math:`n_{coh}` (where :math:`{coh}` denotes the identification or index number for a given cohort).. -The complete hierarchy of elements in the CLM(ED) is therefore now +The complete hierarchy of elements in FATES is therefore now described as follows: .. math:: @@ -274,7 +268,7 @@ common-disturbance-history units is less clear. Several alternative criteria are possible, including Leaf Area Index, total biomass and total stem basal area. -In this implementation of the CLM(ED) we assess the amount of +In this implementation of FATES we assess the amount of above-ground biomass in each PFT/plant diameter bin. Biomass is first grouped into fixed diameter bins for each PFT (:math:`ft`) and a significant difference in any bin will cause patches to remain @@ -318,7 +312,7 @@ co-occupy patch :math:`o`. The state properties of :math:`m` and :math:`n` (litter, seed pools, etc. ) are also averaged in accordance with mass conservation . -Linked Lists: the general code structure of CLM(ED) +Linked Lists: the general code structure of FATES --------------------------------------------------- [4]_ The number of patches in each natural vegetation column and the @@ -337,7 +331,7 @@ potential number of cohorts for every potential patch, which would result in very large amounts of wasted allocated memory, on account of the heterogeneity in the number of cohorts between complex and simple ecosystems (n.b. this does still happen for some variables at restart -timesteps). To resolve this, the cohort structure in the CLM(ED) model +timesteps). To resolve this, the cohort structure in FATES model does not use an array system for internal calculations. Instead it uses a system of *linked lists* where each cohort structure is linked to the cohorts larger than and smaller than itself using a system of pointers. @@ -361,10 +355,10 @@ Using this structure, it is therefore possible to have an unbounded oldest: -Indices used in CLM(ED) +Indices used in FATES ----------------------- -Some of the indices used in the CLM(ED) are similar to those used in the +Some of the indices used in FATES are similar to those used in the standard CLM4.5 model; column (:math:`c`), land unit(\ :math:`l`), grid cell(\ :math:`g`) and soil layer (:math:`j`). On account of the additional complexity of the new representation of plant function, @@ -471,7 +465,7 @@ restarted. The state variables of a cohort are as follows: +-----------------+-----------------+-----------------+-----------------+ Patch State Variables ---------------------- +------------------ A patch, as discuss earlier, is a fraction of the landscape which contains ecosystems with similar structure and disturbance history. A @@ -544,7 +538,7 @@ attributed to each cohort are accumulated throughout each daily cycle and passed into the ED code as the major driver of vegetation dynamics. Initialization of vegetation from bare ground -============================================= +^^^^^^^^^^^^^^^^ [5]_If the model is restarted from a bare ground state (as opposed to a pre-existing vegetation state), the state variables above are @@ -614,8 +608,8 @@ biomass, assigned per PFT [table:init] -Allocation of live biomass to leaves roots and sapwood ------------------------------------------------------- +Allocation of biomass +^^^^^^^^^^^^^^^^^^^^ [6]_Total live biomass :math:`b_{alive}` is the state variable of the model that describes the sum of the three live biomass pools leaf @@ -724,11 +718,9 @@ To calculated the sapwood biomass, we use [table:allom] Canopy Structure and the Perfect Plasticity Approximation -========================================================= +^^^^^^^^^^^^^^^^ - [7]_ - -During initialization and every subsequent daily ED timestep, the canopy +[7]_During initialization and every subsequent daily ED timestep, the canopy structure model is called to determine how the leaf area of the different cohorts is arranged relative to the incoming radiation, which will then be used to drive the radiation and photosynthesis @@ -744,10 +736,7 @@ distribution emerges from competition The standard ED1.0 model makes a simple ’flat disk’ assumption, that the leaf area of each cohort is spread in an homogenous layer at one exact -height across entire the ground area represented by each patch. The -CLM(ED) model has diverged from this representation due to (at least) -two problematic emergent properties that we identified as generating -unrealistic behaviours espetially for large-area patches. +height across entire the ground area represented by each patch. FATES has diverged from this representation due to (at least) two problematic emergent properties that we identified as generating unrealistic behaviours espetially for large-area patches. 1. Over-estimation of light competition . The vertical stacking of cohorts which have all their leaf area at the same nominal height means @@ -785,7 +774,7 @@ canopies to grow into the available gaps (this is of course, an over-simplified but potential useful ecosystem property). The ‘perfect plasticity approximation’ (PPA) implies that the community of trees is subdivided into discrete canopy layers, and by extension, each cohort -represented by the CLM(ED) model is assigned a canopy layer status flag, +represented by FATES model is assigned a canopy layer status flag, :math:`C_L`. In this version, we set the maximum number of canopy layers at 2 for simplicity, although is possible to have a larger number of layers in theory. :math:`C_{L,coh}` = 1 means that all the trees of @@ -860,11 +849,9 @@ fractions of cohorts are demoted or promoted. Further details can be found in the code references in the footnote. Horizontal Canopy Spread ------------------------- - - [8]_ +----------------- -:raw-latex:`\cite{purves2008}` estimated the ratio between canopy and +[8]_:raw-latex:`\cite{purves2008}` estimated the ratio between canopy and stem diameter :math:`c_{p}` as  0.1 m cm\ :math:`^{-1}` for canopy trees in North American forests, but this estimate was made on trees in closed canopies, whose shape is subject to space competition from other @@ -922,12 +909,10 @@ This iterative scheme requires two additional parameters (:math:`i` and However, the model is relatively insensitive to the choice of either :math:`i` or :math:`A_{t}`. -Definition of Leaf Area Profile -------------------------------- - - [9]_ +Definition of Leaf and Stem Area Profile +------------------- -Within each patch, the model defines and tracks cohorts of multiple +[9]_Within each patch, the model defines and tracks cohorts of multiple plant functional types that exist either in the canopy or understorey. Light on the top leaf surface of each cohort in the canopy is the same, and the rate of decay through the canopy is also the same for each PFT. @@ -957,9 +942,6 @@ where :math:`\mathrm{sla}_{ft}` is the specific leaf area in m\ :math:`^{2}` KgC\ :math:`^{-1}` and :math:`b_{leaf}` is in kGC per plant. -Stem Area Index -~~~~~~~~~~~~~~~ - Stem area index (SAI) is ratio of the total area of all woody stems on a plant to the area of ground covered by the plant. During winter in deciduous areas, the extra absorption by woody stems can have a @@ -967,7 +949,7 @@ significant impact on the surface energy budget. However, in previous ‘big leaf’ versions of the CLM, computing the circumstances under which stem area was visible in the absence of leaves was difficult and the algorithm was largely heuristic as a result. Given the multi-layer -canopy introduced for CLM(ED), we can determine the leaves in the higher +canopy introduced for FATES, we can determine the leaves in the higher canopy layers will likely shade stem area in the lower layers when leaves are on, and therefore stem area index can be calculated as a function of woody biomass directly. @@ -1071,7 +1053,7 @@ leaf and stem area profiles, Burial of leaf area by snow -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-------------------- The calculations above all pertain to the total leaf and stem area indices which charecterize the vegetation structure. In addition, the @@ -1170,10 +1152,10 @@ described later. \bigskip Radiation Transfer -================== +^^^^^^^^^^^^^^^^^^^ Fundamental Radiation Transfer Theory -------------------------------------- +------------------ [10]_The first interaction of the land surface with the properties of vegetation concerns the partitioning of energy into that which is @@ -1199,7 +1181,7 @@ is based on the work of :raw-latex:`\cite{norman1979}`. Here we describe the basic theory of the radiation transfer model for the case of a single homogenous canopy, and in the next section we discuss how this is applied to the multi layer multi PFT canopy in the -CLM(ED) implementation. The code considers the fractions of a single +FATES implementation. The code considers the fractions of a single unit of incoming direct and a single unit of incoming diffuse light, that are absorbed at each layer of the canopy for a given solar angle (:math:`\alpha_{s}`, radians). Direct radiation is extinguished through @@ -1386,12 +1368,12 @@ fractions, (required by the photosynthesis calculations), is .. math:: abs_{sun,z} = abs_{dif,z} \cdot f_{sun}+ abs_{dir,z} -Resolution of radiation transfer theory within the CLM(ED) canopy structure ---------------------------------------------------------------------------- +Resolution of radiation transfer theory within the FATES canopy structure +------------------ The radiation transfer theory above, was described with reference to a single canopy of one plant functional type, for the sake of clarity of -explanation. The CLM(ED) model, however, calculates radiative and +explanation. The FATES model, however, calculates radiative and photosynthetic fluxes for a more complex hierarchical structure within each patch/time-since-disturbance class, as described in the leaf area profile section. Firstly, we denote two or more canopy layers (denoted @@ -1436,7 +1418,7 @@ transfer scheme are calculated with indices of :math:`C_L`, :math:`\it{ft}` and :math:`z`. In the following text, we revisit the simplified version of the radiation model described above, and explain how it is modified to account for the more complex canopy structure used -by the CLM(ED). +by FATES. Firstly, the light penetration functions, :math:`k_{dir}` and :math:`g_{dir}` are described as functions of :math:`\it{ft}`, because @@ -1561,18 +1543,16 @@ layer, functional type and pft for testing if necessary. \bigskip Photosynthesis -============== +^^^^^^^^^^^^^^^^^^^^ Fundamental photosynthetic physiology theory --------------------------------------------- +------------------ - [11]_ - -In this section we describe the physiological basis of the -photosynthesis model before describing its application to the CLM(ED) +[11]_In this section we describe the physiological basis of the +photosynthesis model before describing its application to the FATES canopy structure. This description in this section is largely repeated from the Oleson et al. CLM4.5 technical note but included here for -comparison with its implementation in CLM(ED). Photosynthesis in C3 +comparison with its implementation in FATES. Photosynthesis in C3 plants is based on the model of :raw-latex:`\cite{farquhar1980}` as modified by :raw-latex:`\cite{collatz1991}`. Photosynthetic assimilation in C4 plants is based on the model of :raw-latex:`\cite{collatz1992}`. @@ -1675,8 +1655,8 @@ where the term 0.21 represents the ratio of maximum rates of oxygenation to carboxylation, which is virtually constant with temperature :raw-latex:`\cite{farquhar1980}`. -Resolution of the photosynthesis theory within the CLM(ED) canopy structure. ----------------------------------------------------------------------------- +Resolution of the photosynthesis theory within the FATES canopy structure. +------------------ The photosynthesis scheme is modified from the CLM4.5 model to give estimates of photosynthesis, respiration and stomatal conductance for a @@ -1749,7 +1729,7 @@ s\ :math:`^{-1}`) is calculated in a similar fashion, \end{array} \right. Variation in plant physiology with canopy depth -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------ Both :math:`V_{c,max}` and :math:`J_{max}` vary with vertical depth in the canopy on account of the well-documented reduction in canopy @@ -1809,8 +1789,8 @@ canopy. They obtain the following term to predict :math:`K_{n}`, where :math:`V_{cmax}` is again in :math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`. -Water Stress Function -~~~~~~~~~~~~~~~~~~~~~ +Water Stress on gas exchange +------------------ [12]_ The top of canopy leaf photosynthetic capacity, :math:`V_{c,max0}`, is also adjusted for the availability of water to plants as @@ -1848,7 +1828,7 @@ on the calculation of soil matric potential, see the CLM4.5 technical note. Variation of water stress and water uptake within tiles -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~ The remaining drivers of the photosynthesis model remain constant (atmospheric CO\ :math:`_2` and O\ :math:`^2` and canopy temperature) @@ -1868,7 +1848,7 @@ parameter also necessitates recalculation of the vertical water extraction profiles. In the original model, the fraction of extraction from each layer (:math:`r_{e,j,patch}`) is the product of a single root distribution, because each patch only has one plant functional type. In -the CLM(ED), we need to calculate a new weighted patch effective rooting +FATES, we need to calculate a new weighted patch effective rooting depth profile :math:`r_{e,j,patch}` as the weighted average of the functional-type level stress functions and their relative contributions to canopy conductance. Thus for each layer :math:`j`, the extraction @@ -1883,7 +1863,7 @@ canopy conductance for plant functional type :math:`ft`, .. math:: G_{s,ft}= \sum_{1}w_{ncoh,ft} {gs_{can,coh} n_{coh} }. Aggregation of assimilated carbon into cohorts -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------ The derivation of photosynthetic rates per leaf layer, as above, give us the estimated rate of assimilation for a unit area of leaf at a given @@ -1966,11 +1946,9 @@ timestep to give KgC cohort\ :math:`^{-1}` day\ :math:`^{-1}` \bigskip Plant respiration -================= +^^^^^^^^^^^^^^^^^^ - [13]_ - -Plant respiration per individual :math:`R_{plant,coh}` (KgC individual +[13]_Plant respiration per individual :math:`R_{plant,coh}` (KgC individual :math:`^{-1}` s\ :math:`^{-1}`) is the sum of two terms, growth and maintenance respiration :math:`R_{g,coh}` and :math:`R_{m,coh}` @@ -2104,14 +2082,12 @@ respiration has occurred. \bigskip Stomatal Conductance -==================== +^^^^^^^^^^^^^^^^^^ Fundamental stomatal conductance theory ---------------------------------------- - - [14]_ +------------------ -Stomatal conductance is unchanged in concept from the CLM4.5 approach. +[14]_Stomatal conductance is unchanged in concept from the CLM4.5 approach. Leaf stomatal resistance is calculated from the Ball-Berry conductance model as described by :raw-latex:`\cite{collatz1991}` and implemented in a global climate model by :raw-latex:`\cite{sellers1996}`. The model @@ -2159,8 +2135,8 @@ R\ :math:`_{gas}` is the universal gas constant (J K\ :math:`^{-1}` kmol\ :math:`^{-1}`) and :math:`\theta_{atm}` is the atmospheric potential temperature (K). -Resolution of the stomatal conductance theory in the CLM(ED) canopy structure ------------------------------------------------------------------------------ +Resolution of stomatal conductance theory in the FATES canopy structure +-------------- The stomatal conductance is calculated, as with photosynthesis, for each canopy, PFT and leaf layer. The CLM code requires a single canopy @@ -2193,12 +2169,10 @@ cohort. +------------------+--------------------------+-------+------------+ -Allocation -========== - - [15]_ +Allocation and Growth +^^^^^^^^^^^^^^^^ -Total assimilation carbon enters the ED model each day as a +[15]_Total assimilation carbon enters the ED model each day as a cohort-specific Net Primary Productivity :math:`\mathit{NPP}_{coh}`, which is calculated as @@ -2214,7 +2188,7 @@ individual\ :math:`^{-1}` year\ :math:`^{-1}` and ultimately integrated using a timesteps of 1/365 years for each day. Tissue maintenance demand -------------------------- +--------------- We calculate a ‘tissue maintenance’ flux. The magnitude of this flux is such that the quantity of biomass in each pool will remain constant, @@ -2243,7 +2217,7 @@ phenology section. The total quantity of maintenance demand .. math:: t_{md,coh} = l_{md,coh} + r_{md,coh} Allocation to storage and turnover ----------------------------------- +----------------- The model must now determine whether the NPP input is sufficient to meet the maintenance demand and keep tissue levels constant. To determine @@ -2324,7 +2298,7 @@ and leaf biomass, ameliorated by the leaf trimming fraction (see :math:`\rho_{ft}` is the wood density, in g cm\ :math:`^{3}`. Allocation to Seeds -~~~~~~~~~~~~~~~~~~~ +--------------- The fraction remaining for growth (expansion of live and structural tissues) :math:`f_{growth}` is 1 minus that allocated to seeds. @@ -2350,7 +2324,7 @@ KgC individual :math:`^{-1}` y\ :math:`^{-1}`) is thus .. math:: p_{seed,coh} = C_{growth}\cdot f_{seed,coh} Allocation to growing pools -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +---------------- [16]_ The carbon is then partitioned into carbon available to grow the :math:`b_{alive}` and :math:`b_{struc}` pools. A fraction :math:`v_{a}` @@ -2434,7 +2408,7 @@ structural biomass pools are maintained in this algorithm, which diverges from the methodology currently deployed in the CLM4.5. Integration of allocated fluxes -------------------------------- +---------------- All of the flux calculations generate differential of the biomass state variables against time (in years). To integrate these differential rates @@ -2503,11 +2477,9 @@ In this case, :math:`\delta t` is set to be one day \bigskip Control of Leaf Area Index -========================== +^^^^^^^^^^^^^^ - [17]_ - -The leaf area :math:`A_{leaf}` (m:math:`^{-2}`) of each cohort is +[17]_The leaf area :math:`A_{leaf}` (m:math:`^{-2}`) of each cohort is calculated from leaf biomass :math:`b_{leaf,coh}` (kgC individual\ :math:`^{-1}`) and specific leaf area (SLA, m\ :math:`^2` kg C\ :math:`^{-1}`) @@ -2598,16 +2570,16 @@ the greatly reduced maintenance and turnover requirements. \bigskip Phenology -========= +^^^^^^^^^^^^^^^^^^^^ Cold Deciduous Phenology ------------------------- +------------------ Cold Leaf-out timing ~~~~~~~~~~~~~~~~~~~~ [18]_. The phenology model of :raw-latex:`\cite{botta2000}` is used in -CLM(ED) to determine the leaf-on timing. The Botta et al. model was +FATES to determine the leaf-on timing. The Botta et al. model was verified against satellite data and is one of the only globally verified and published models of leaf-out phenology. This model differs from the phenology model in the CLM4.5. The model simulates leaf-on date as a @@ -2685,21 +2657,19 @@ constrain growing degree day accumulation to the second half of the year (Jult onwards in the Northern hemisphere, or Jan-June in the Southern) and only allow GDD accumulation while the leaves are off. -Drought-deciduous Phenology ---------------------------- +Drought-deciduous Phenology: TBD +------------------ In the current version of the model, a drought deciduous algorithm -exists, but is not yet operational, due to issue detected in the exsting +exists, but is not yet operational, due to issue detected in the existing CN and soil moisture modules, which also affect the behaviour of the native ED drought deciduous model. This is a priority to address before the science tag is released. Carbon Dynamics of deciduous plants ------------------------------------ - - [19]_ +------------------ -In the present version, leaf expansion and senescence happen over the +[19]_In the present version, leaf expansion and senescence happen over the course of a single day. This is clearly not an empirically robust representation of leaf behaviour, whereby leaf expansion occurs over a period of 10-14 days, and senescence over a similar period. This will be @@ -2775,18 +2745,15 @@ for this carbon accounting scheme. \bigskip Seed Dynamics and Recruitment -============================= +^^^^^^^^^^^^^^^^^^ - [20]_ -The production of seeds and their subsequent germination is a process -that must be captured explicitly or implicitly in vegetation models. The -CLM(ED) contains a seed bank model designed to allow the dynamics of +[20]_The production of seeds and their subsequent germination is a process +that must be captured explicitly or implicitly in vegetation models. FATES contains a seed bank model designed to allow the dynamics of seed production and germination to be simulated independently. In the ED1.0 model, seed recruitment occurs in the same timestep as allocation to seeds, which prohibits the survival of a viable seed bank through a -period of disturbance or low productivity (winter, drought). In the -CLM(ED) model, a plant functional type specific seed bank is tracked in +period of disturbance or low productivity (winter, drought). In FATES, a plant functional type specific seed bank is tracked in each patch (:math:`Seeds_{patch}` KgC m\ :math:`^{-2}`), whose rate of change (KgC m\ :math:`^{-2}` y\ :math:`^{-1}`) is the balance of inputs, germination and decay: @@ -2858,12 +2825,12 @@ of one plant functional type over the seed pool. \bigskip -Fragmenting Litter Pool Production and Turnover -=============================================== +Litter Production and Fragmentation +^^^^^^^^^^^^^^ | The original CLM4.5 model contains streams of carbon pertaining to different chemical properties of litter (lignin, cellulose and labile - streams, specifically). In the CLM(ED) model, the fire simulation + streams, specifically). In FATES model, the fire simulation scheme in the SPITFIRE model requires that the model tracks the pools of litter pools that differ with respect to their propensity to burn (surface area-volume ratio, bulk density etc.). Therefore, this model @@ -2873,7 +2840,7 @@ Fragmenting Litter Pool Production and Turnover respiration. In this way, we can both maintain above-ground pools that affect the rate of burning, and the lag between tree mortality and availability of woody material for decomposition. -| The CLM(ED) recognizes four classes of litter. Above- and below-ground +| FATES recognizes four classes of litter. Above- and below-ground coarse woody debris (:math:`CWD_{AG}`, :math:`CWD_{BG}`) and leaf litter (:math:`l_{leaf}` and fine root litter :math:`l_{root}`). All pools are represented per patch, and with units of kGC @@ -2933,9 +2900,7 @@ assigned to each (:math:`f_{lsc}` and :math:`f_{ag}`) Litter Outputs -------------- - [22]_ - -The fragmenting litter pool is available for burning but not for +[22]_The fragmenting litter pool is available for burning but not for respiration or decomposition. Fragmentation rates are calculated according to a maximum fragmentation rate (:math:`\alpha_{cwd,lsc}` or :math:`\alpha_{litter}`) which is ameliorated by a temperature and water @@ -2961,11 +2926,9 @@ sensitivity analyses of the model outputs. .. math:: l_{root,out,ft} = l_{root,ft}.\alpha_{root,ft}.S_{tw} Flux into decompsition cascade ------------------------------- - - [23]_ +-------------- -Upon fragmentation and release from the litter pool, carbon is +[23]_Upon fragmentation and release from the litter pool, carbon is transferred into the labile, lignin and cellulose decomposition pools. These pools are vertically resolved in the biogeochemistry model. The movement of carbon into each vertical layer is obviously different for @@ -3060,7 +3023,7 @@ layer :math:`z`, derived from the CLM(BGC) model. \bigskip Plant Mortality -=============== +^^^^^^^^^^^^^^^^ Total plant mortality per cohort :math:`M_{t,coh}`, (fraction year\ :math:`^{-1}`) is simulated as the sum of four additive terms, @@ -3127,12 +3090,10 @@ fire modelling section. \bigskip -Fire -==== +Fire (SPITFIRE) +^^^^^^^^^^^^^^^^^ - [24]_ - -The influence of fire on vegetation is estimated using the SPITFIRE +[24]_The influence of fire on vegetation is estimated using the SPITFIRE model, which has been modified for use in ED following it’s original implementation in the LPJ-SPITFIRE model (:raw-latex:`\parencite{thonicke2010,pfeiffer2013}`. This model as @@ -3156,7 +3117,7 @@ open and closed forests can be represented effectively (we omit the ‘patch’ subscript throughout for simplicity). Properties of fuel load ------------------------ +--------------- Many fire processes are impacted by the properties of the litter pool in the SPITFIRE model. There are one live (live grasses) and five dead fuel @@ -3190,23 +3151,8 @@ as follows. \bigskip -Fuel load -~~~~~~~~~ - -Total fuel load :math:`F_{tot,patch}` for a given patch is the sum of -the above ground coarse woody debris and the leaf litter, plus the alive -grass leaf biomass :math:`b_{l,grass}` multiplied by the non-mineral -fraction (1-:math:`M_{f}`). - -.. math:: F_{tot,patch}=\left(\sum_{fc=1}^{fc=5} CWD_{AG,fc}+l_{litter}+b_{l,grass}\right)(1-M_{f}) - -Many of the model behaviours are affected by the patch-level weighted -average properties of the fuel load. Typically, these are calculated in -the absence of 1000-h fuels because these do not contribute greatly to -fire spread properties. - Nesterov Index -~~~~~~~~~~~~~~ +--------------- Dead fuel moisture (:math:`\emph{moist}_{df,fc}`), and several other properties of fire behaviour, are a function of the ‘Nesterov Index’ @@ -3226,6 +3172,23 @@ where :math:`T_{d}` is the daily mean temperature in :math:`^{o}`\ C and where :math:`RH` is the relative humidity (%). + +Fuel properties +--------------- + +Total fuel load :math:`F_{tot,patch}` for a given patch is the sum of +the above ground coarse woody debris and the leaf litter, plus the alive +grass leaf biomass :math:`b_{l,grass}` multiplied by the non-mineral +fraction (1-:math:`M_{f}`). + +.. math:: F_{tot,patch}=\left(\sum_{fc=1}^{fc=5} CWD_{AG,fc}+l_{litter}+b_{l,grass}\right)(1-M_{f}) + +Many of the model behaviours are affected by the patch-level weighted +average properties of the fuel load. Typically, these are calculated in +the absence of 1000-h fuels because these do not contribute greatly to +fire spread properties. + + Dead Fuel Moisture Content ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -3301,7 +3264,7 @@ fuels). .. math:: F_{\sigma}=\sum_{fc=1}^{fc=4} \frac{F_{fc}}{F_{tot}}\sigma_{fuel,fc}+\frac{b_{l,grass}}{F_{tot}}\sigma_{fuel,grass} Forward rate of spread ----------------------- +----------------- For each patch and each day, we calculate the rate of forward spread of the fire *ros*\ :math:`_{f}` (nominally in the direction of the wind). @@ -3414,7 +3377,7 @@ Fire Behaviour Predictions Systems) .. math:: D_{f}=\textrm{min}\Big(F_{dur,max},\frac{F_{dur,max}}{1+F_{dur,max}e^{-11.06fdi}}\Big) Fire Danger Index ------------------ +-------------- Fire danger index (*fdi*) is a representation of the effect of meteorological conditions on the likelihood of a fire. It is calculated @@ -3459,7 +3422,7 @@ The total area burned (:math:`A_{burn}` in m\ :math:`^{2}`) is therefore where :math:`n_{f}` is the number of fires. Crown Damage ------------- +------------- :math:`c_{k}` is the fraction of the crown which is consumed by the fire. This is calculated from scorch height :math:`H_{s}`, tree height @@ -3485,7 +3448,7 @@ where :math:`f_{biomass,ft}` is the fraction of the above-ground biomass in each plant functional type. Cambial Damage and Kill ------------------------ +------------- The cambial kill is a function of the fuel consumed :math:`f_{c,tot}`, the bark thickness :math:`t_{b}`, and :math:`\tau_{l}`, the duration of From 1b44cdbee18adcc88bb40d3050bdf4443eaa2da5 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Tue, 12 Dec 2017 14:47:06 -0700 Subject: [PATCH 0117/1973] fixed the references for the FATES tech note --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 290 ++++++++---------- .../References/CLM50_Tech_Note_References.rst | 131 ++++++++ 2 files changed, 263 insertions(+), 158 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index c6f0558b6b..3a0bfcdbb2 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -8,40 +8,42 @@ What has changed - Deprecation of the dynamic global vegetation model (DGVM): The CLM5.0 model contains the legancy 'CNDV' code, which runs the CLM4(CN) model in combination with the LPJ-derived dynamics vegetation model introduced in CLM3. While this capacity has not technically been removed from the model, the DGVM has not been tested in the development of CLM5 and is no longer scientifically supported. -- Introduction of FATES: The Functionally Assembled Terrestrial Ecosystem Simulator (FATES) is the actively developed DGVM for the CLM5. +- Introduction of FATES: The Functionally Assembled Terrestrial Ecosystem Simulator (FATES) is the actively developed DGVM for the CLM5. See +.. _rst_FATES: + Technical Documentation for FATES =================================== +FATES is the "Functionally Assembled Terrestrial Ecosystem Simulator". It is an external module which can run within a given "Host Land Model" (HLM). Currently (November 2017) implementations are supported in both the Community Land Model(CLM) and in the land model of the E3SM Dept. of Energy Earth System Model. -Introduction -^^^^^^^^^^^^^^^^^^^^ +FATES was derived from the CLM Ecosystem Demography model (CLM(ED)), which was documented in: - This document is a technical appendix to - Fisher RA, Muszala S, Verteinstein M, Lawrence P, Xu C, McDowell NG, +Fisher RA, Muszala S, Verteinstein M, Lawrence P, Xu C, McDowell NG, Knox RG, Koven C, Holm J, Rogers BM, Lawrence D. Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes. Geoscientific Model Development Discussions. 2015 Apr 1;8(4). - https://pdfs.semanticscholar.org/396c/b9f172cb681421ed78325a2237bfb428eece.pdf - - -FATES is presented here as an option within the structure of -the Community Land Model (CLM). Ecosystem Demography (‘ED’), is a -concept derived from the work of :raw-latex:`\cite{mc_2001}` and is a -cohort model of vegetation competition and co-existence, allowing a -representation of the biosphere which accounts for the division of the -land surface into successional stages, and the competition for light -between height structured cohorts of representative trees of various -plant functional types. This implementation of the Ecosystem Demography -concept links the surface flux and canopy physiology concepts in the CLM + +and this technical note was first published as an appendix to that paper. + +https://pdfs.semanticscholar.org/396c/b9f172cb681421ed78325a2237bfb428eece.pdf + +Introduction +^^^^^^^^^^^^^^^^^^^ + +The Ecosystem Demography ('ED'), concept within FATES is derived from the work of :ref:`Moorcroft et al. (2001)` + +and is a cohort model of vegetation competition and co-existence, allowing a representation of the biosphere which accounts for the division of the land surface into successional stages, and for competition for light between height structured cohorts of representative trees of various plant functional types. + +The implementation of the Ecosystem Demography +concept within FATES links the surface flux and canopy physiology concepts in the CLM/E3SM with numerous additional developments necessary to accommodate the new model also documented here. These include a version of the SPITFIRE -(Spread and InTensity of Fire) model of -:raw-latex:`\parencite{thonicke2010}`, and an adoption of the concept of -‘perfect plasticity’ approach of -:raw-latex:`\parencite{purves2008,lichstein2011,weng2014}` in accounting +(Spread and InTensity of Fire) model of :ref:`Thonicke et al. (2010)`, and an adoption of the concept of +`Perfect Plasticity Approximation` approach of +:ref:`Purves et al. 2008`, :ref:`Lichstein et al. 2011` and :ref:`Weng et al. 2014`, in accounting for the spatial arrangement of crowns. Novel algorithms accounting for the fragmentation of coarse woody debris into chemical litter streams, for the physiological optimisation of canopy thickness, for the @@ -50,40 +52,28 @@ radiation transfer, for drought-deciduous and cold-deciduous phenology, for carbon storage allocation, and for tree mortality under carbon stress, are also included and presented here. -This Document UPDATE ----------------- - -This document describes the implementation of the Ecosystem Demography -concept within the Community Land Model. The material covered describes how -the Ecosystem Demography code is organized, how it interacts with the -pre-existing CLM routines, and the new aspects of plant physiology and -vegetation dynamics that are introduced further to those already -existing within the model. Numerous other implementations of the -Ecosystem Demography concept are in existence, in particular the ED2 -model, which is a fully operational land surface scheme -:raw-latex:`\parencite{medvigy2009}` which contains both the basic ED -concept and an array of physiological and ecological innovations -surrounding the basic concept. Therefore, to avoid confusion between the -concept of ‘Ecosystem Demography’ and the implementation of this concept -in different models, we refer our model as the ‘FATES’ (the functionally Assembled Terrestrial Ecosystem Simulator) throughout. +Numerous other implementations of the +Ecosystem Demography concept exist (See Fisher et al. 2017 for a review of these) Therefore, to avoid confusion between the +concept of 'Ecosystem Demography' and the implementation of this concept +in different models, the CLM(ED) implementation described by Fisher et al. (2015) will hereafter be called 'FATES' (the Functionally Assembled Terrestrial Ecosystem Simulator). The representation of ecosystem heterogeneity in FATES ^^^^^^^^^^^^^^^ -The land surface of the Earth is heterogeneous for many reasons, driven +The terrestrial surface of the Earth is heterogeneous for many reasons, driven by variations in climate, edaphic history, ecological variability, geological forcing and human interventions. Land surface models represent this variability first by introducing a grid structure to the land surface, allowing different atmospheric forcings to operate in each -grid cell, and subsequently by representing ‘sub-grid’ variability in +grid cell, and subsequently by representing 'sub-grid' variability in the surface properties. In the CLM, the land surface is divided into -numerous ‘landunits’ corresponding to the underlying condition of the -surface (e.g. soils, ice, lakes, bare ground) and then ‘columns’ +numerous 'landunits' corresponding to the underlying condition of the +surface (e.g. soils, ice, lakes, bare ground) and then 'columns' referring to elements of the surface that share below ground resources -(water & nutrients). Within the ‘soil’ landunit, for example, there are +(water & nutrients). Within the soil landunit, for example, there are separate columns for crops, and for natural vegetation, as these are assumed to use separate resource pools. The FATES model at present -only operates on the naturally vegetated column. The ‘soil’ column is +only operates on the naturally vegetated column. The soil column is sub-divided into numerous tiles, that correspond to statistical fractions of the potentially vegetated land area. In the CLM 4.5 (and all previous versions of the model), sub-grid tiling operates on the @@ -97,21 +87,21 @@ The introduction of the Ecosystem Demography concept introduces significant alterations to the representation of the land surface in the CLM. In FATES, the tiling structure represents the disturbance history of the ecosystem. Thus, some fraction of the land surface is -characterized as ‘recently disturbed’, some fraction has escaped +characterized as 'recently disturbed', some fraction has escaped disturbance for a long time, and other areas will have intermediate disturbances. Thus the ED concept essentially discretizes the trajectory -of succession from disturbed ground to ‘mature’ ecosystems. Within the -ED code, each ‘disturbance history class’ is referred to as a ‘patch’. -The word ‘patch’ has many possible interpretations, so it is important +of succession from disturbed ground to 'mature' ecosystems. Within +FATES, each "disturbance history class" is referred to as a ‘patch’. +The word "patch" has many possible interpretations, so it is important to note that: **there is no spatial location associated with the concept -of a ‘patch’. It refers to a fraction of the potential vegetated area +of a 'patch' . It refers to a fraction of the potential vegetated area consisting of all parts of the ecosystem with similar disturbance history.** -The ‘patch’ organizational structure in CLM thus replaces the previous -‘PFT’ structure in the organization heirarchy. The original hierarchical +The 'patch' organizational structure in CLM thus replaces the previous +'PFT' structure in the organization heirarchy. The original hierarchical land surface organizational structure of CLM as described in -:raw-latex:`\cite{oleson2013}` may be depicted as: +:ref:`Oleson et al. 2013` may be depicted as: .. math:: @@ -153,11 +143,11 @@ and the new structure is altered to the following: \mathbf{landunit} & \\ \end{array}\right. -Thus, each gridcell becomes a matrix of ‘patches’ that are -conceptualized by their ‘age since disturbance’ in years. This is the +Thus, each gridcell becomes a matrix of 'patches' that are +conceptualized by their 'age since disturbance' in years. This is the equivalent of grouping together all those areas of a gridcell that are -‘canopy gaps’, into a single entity, and all those areas that are -‘mature forest’ into a single entity. +'canopy gaps', into a single entity, and all those areas that are +'mature forest' into a single entity. Cohortized representation of tree populations --------------------------------------------- @@ -167,11 +157,11 @@ in reality contain numerous individual plants which vary in their physiological attributes, in height and in spatial position. One way of addressing this heterogeneity is to simulate a forest of specific individuals, and to monitor their behavior through time. This is the -approach taken by ‘gap’ and individual-based -:raw-latex:`\parencite{smith2001,sato2007,uriarte2009,fyllas2014}`. The +approach taken by "gap" and individual-based models +(:ref:`Smith et al. 2001`, :ref:`Sato et al. 2007`, :ref:`Uriarte et al. 2009`, :ref:`Fyllas et al. 2014 `). The depiction of individuals typically implies that the outcome of the model is stochastic. This is because we lack the necessary detailed knowledge -to simulate the individual plant’s fates. Thus gap models imply both +to simulate the individual plant's fates. Thus gap models imply both stochastic locations and mortality of plants. Thus, (with a genuinely random seed) each model outcome is different, and an ensemble of model runs is required to generate an average representative solution. Because @@ -180,19 +170,18 @@ deviations from the mean trajectory for a small plot (a typical simulated plot size is 30m x 30 m) the number of runs required to minimize these deviations is large and computationally expensive. For this reason, models that resolve individual trees typically use a -physiological timestep of one day or longer (e.g. -:raw-latex:`\cite{smith2001,xiaodong2005,sato2007}` +physiological timestep of one day or longer (e.g. :ref:`Smith et al. 2001`, :ref:`Xiaidong et al. 2005 `, :ref:`Sato et al. 2007` The approach introduced by the Ecosystem Demography model -:raw-latex:`\parencite{mc_2001}` is to group the hypothetical population -of plants into ‘cohorts’. In the notional ecosystem, after the +:ref:`Moorcroft et al. 2001` is to group the hypothetical population +of plants into "cohorts". In the notional ecosystem, after the land-surface is divided into common-disturbance-history patches, the population in each patch is divided first into plant functional types (the standard approach to representing plant diversity in large scale vegetation models), and then each plant type is represented as numerous height classes. Importantly, **for each PFT/height class bin, we model *one* representative individual plant, which tracks the average -properties of this ‘cohort’ of individual plants.** Thus, each +properties of this `cohort` of individual plants.** Thus, each common-disturbance-history patch is typically occupied by a set of cohorts of different plant functional types, and different height classes within those plant functional types. Each cohort is associated @@ -235,11 +224,11 @@ disturbance processes. If the new patches and cohorts established at *every* timestep were tracked by the model structure, the computational load would of course be extremely high (and thus equivalent to an individual-based approach). A signature feature of the ED model is the -system by which ‘functionally equivalent’ patches and cohorts are fused +system by which `functionally equivalent` patches and cohorts are fused into single model entities to save memory and computational time. [1]_ This functionality requires that criteria are established for the -meaning of `functional equivalence’, which are by necessity slightly +meaning of `functional equivalence`, which are by necessity slightly subjective, as they represent ways of abstracting reality into a more tractable mathematical representation. As an example of this, for height-structured cohorts, we calculate the relativized differences in @@ -343,16 +332,7 @@ Instead of iterating along a vector indexed by :math:`coh`, the code structures typically begin at the tallest cohort in a given patch, and iterate until a null pointer is encountered. -Using this structure, it is therefore possible to have an unbounded - upper limit on cohort number, and also to easily alter the ordering of - cohorts if, for example, a cohort of one functional type begins to - grow faster than a competitor of another functional type, and the - cohort list can easily be re-ordered by altering the pointer - structure. Each cohort has `pointers` indicating to which patch and - gridcell it belongs. The patch system is analogous to the cohort - system, except that patches are ordered in terms of their relative age, with - pointers to older and younger patches where cp\ :math:`_1` is the - oldest: +Using this structure, it is therefore possible to have an unbounded upper limit on cohort number, and also to easily alter the ordering of cohorts if, for example, a cohort of one functional type begins to grow faster than a competitor of another functional type, and the cohort list can easily be re-ordered by altering the pointer structure. Each cohort has `pointers` indicating to which patch and gridcell it belongs. The patch system is analogous to the cohort system, except that patches are ordered in terms of their relative age, with pointers to older and younger patches where cp\ :math:`_1` is the oldest: Indices used in FATES @@ -518,9 +498,6 @@ can be restarted, are as follows | Index | patch}}` | | | | +-------------+-------------+-------------+-------------+-------------+ -.. raw:: latex - - \bigskip Model Structure --------------- @@ -573,7 +550,7 @@ function of wood density, :math:`\rho`, g cm\ :math:`^{-3}`) .. math:: b_{struc,coh} =c_{str}h_{coh}^{e_{str,hite}} dbh_{coh}^{e_{str,dbh}} \rho_{ft}^{e_{str,dens}} taken from the original ED1.0 allometry -:raw-latex:`\parencite{mc_2001}` (values of the allometric constants in +:ref:`Moorcroft et al. 2001` (values of the allometric constants in Table `[table:allom] <#table:allom>`__. The maximum amount of leaf biomass associated with this diameter of tree is calculated according to the following allometry @@ -732,9 +709,9 @@ performance in ED-like cohort based models, since they determine how light resources are partitioned between competing plants of varying heights, which has a very significant impact on how vegetation distribution emerges from competition -:raw-latex:`\parencite{fisher2010}`. +:ref:`Fisher et al. 2010`. -The standard ED1.0 model makes a simple ’flat disk’ assumption, that the +The standard ED1.0 model makes a simple `flat disk' assumption, that the leaf area of each cohort is spread in an homogenous layer at one exact height across entire the ground area represented by each patch. FATES has diverged from this representation due to (at least) two problematic emergent properties that we identified as generating unrealistic behaviours espetially for large-area patches. @@ -748,7 +725,7 @@ model artificially exaggerates the process of light competition. In reality, trees do not compete for light until their canopies begin to overlap and canopy closure is approached. -2. Unrealistic over-crowding. The ‘flat-disk’ assumption has no +2. Unrealistic over-crowding. The 'flat-disk' assumption has no consideration of the spatial extent of tree crowns. Therefore it has no control on the packing density of plants in the model. Given a mismatch between production and mortality, entirely unrealistic tree densities @@ -758,7 +735,7 @@ mortality rates. To account for the filling of space in three dimensions using the one-dimensional representation of the canopy employed by CLM, we implement a new scheme derived from that of -:raw-latex:`\cite{purves2008}`. Their argument follows the development +:ref:`Purves et al. 2008`. Their argument follows the development of an individual-based variant of the SORTIE model, called SHELL, which allows the location of individual plant crowns to be highly flexible in space. Ultimately, the solutions of this model possess an emergent @@ -801,7 +778,7 @@ where :math:`A_{crown}` is the crown area of a single tree canopy (m:math:`^{-2}`) and :math:`S_{c,patch,Cl}` is the ‘canopy spread’ parameter (m cm^-1) of this canopy layer, which is assigned as a function of canopy space filling, discussed below. In contrast to -:raw-latex:`\cite{purves2008}` , we use an exponent, identical to that +:ref:`Purves et al. 2008` , we use an exponent, identical to that for leaf biomass, of 1.56, not 2.0, such that tree leaf area index does not change as a function of diameter. @@ -815,11 +792,11 @@ the area of all crowns :math:`A_{canopy}` (m:math:`^{-2}`) is larger than the total ground area of a patch (:math:`A_{patch}`), then some fraction of each cohort is demoted to the understorey. -Under these circumstances, the ‘extra’ crown area :math:`A_{loss}` +Under these circumstances, the `extra` crown area :math:`A_{loss}` (i.e., :math:`A_{canopy}` - :math:`A_p`) is moved into the understorey. For each cohort already in the canopy, we determine a fraction of trees that are moved from the canopy (:math:`L_c`) to the understorey. -:math:`L_c` is calculated as :raw-latex:`\cite{fisher2010}` +:math:`L_c` is calculated as :ref:`Fisher et al. 2010` .. math:: L_{c}= \frac{A_{loss,patch} w_{coh}}{\sum_{coh=1}^{nc,patch}{w_{coh}}} , @@ -851,8 +828,8 @@ found in the code references in the footnote. Horizontal Canopy Spread ----------------- -[8]_:raw-latex:`\cite{purves2008}` estimated the ratio between canopy and -stem diameter :math:`c_{p}` as  0.1 m cm\ :math:`^{-1}` for canopy trees +[8]_:ref:`Purves et al. 2008` estimated the ratio between canopy and +stem diameter :math:`c_{p}` as0.1 m cm\ :math:`^{-1}` for canopy trees in North American forests, but this estimate was made on trees in closed canopies, whose shape is subject to space competition from other individuals. Sapling trees have no constraints in their horizontal @@ -946,7 +923,7 @@ Stem area index (SAI) is ratio of the total area of all woody stems on a plant to the area of ground covered by the plant. During winter in deciduous areas, the extra absorption by woody stems can have a significant impact on the surface energy budget. However, in previous -‘big leaf’ versions of the CLM, computing the circumstances under which +`big leaf` versions of the CLM, computing the circumstances under which stem area was visible in the absence of leaves was difficult and the algorithm was largely heuristic as a result. Given the multi-layer canopy introduced for FATES, we can determine the leaves in the higher @@ -958,8 +935,8 @@ Literature on stem area index is particularly poor, as it’s estimation is complex and not particularly amenable to the use of, for example, assumptions of random distribution in space that are typically used to calculate leaf area from light interception. -:raw-latex:`\cite{kucharik1998}` estimated that SAI visible from an -LAI2000 sensor was around 0.5 m^2 m^-2. :raw-latex:`\cite{low2001}` +:ref:`Kucharik et al. 1998` estimated that SAI visible from an +LAI2000 sensor was around 0.5 m^2 m^-2. :ref:`Low et al. 2001` estimate that the wood area index for Ponderosa Pine forest is 0.27-0.33. The existing CLM(CN) algorithm sets the minimum SAI at 0.25 to match MODIS observations, but then allows SAI to rise as a function @@ -1147,9 +1124,6 @@ described later. | | biomass | | | | +-------------+-------------+-------------+-------------+-------------+ -.. raw:: latex - - \bigskip Radiation Transfer ^^^^^^^^^^^^^^^^^^^ @@ -1161,8 +1135,8 @@ Fundamental Radiation Transfer Theory vegetation concerns the partitioning of energy into that which is absorbed by vegetation, reflected back into the atmosphere, and absorbed by the ground surface. Older versions of the CLM have utilized a -‘two-stream’ approximation -:raw-latex:`\parencite{sellers1985,sellers1996}` that provided an +"two-stream" approximation +:ref:`Sellers 1985`, :ref:`Sellers et al. 1986` that provided an empirical solution for the radiation partitioning of a multi-layer canopy for two streams, of diffuse and direct light. However, implementation of the Ecosystem Demography model requires a) the @@ -1176,7 +1150,7 @@ thus implemented a one-dimensional scheme that traces the absorption, transmittance and reflectance of each canopy layer and the soil, iterating the upwards and downwards passes of radiation through the canopy until a pre-defined accuracy tolerance is reached. This approach -is based on the work of :raw-latex:`\cite{norman1979}`. +is based on the work of :ref:`Norman 1979`. Here we describe the basic theory of the radiation transfer model for the case of a single homogenous canopy, and in the next section we @@ -1291,7 +1265,7 @@ calculated sequentially, starting this time at the soil surface layer where :math:`alb_s` is the soil albedo characteristic. The upwards reflected fraction :math:`r_z` for each leaf layer, moving upwards, is -then :raw-latex:`\cite{norman1979}` +then :ref:`Norman 1979` .. math:: r_z = \frac{r_{z+1} \times \mathit{tran}_{dif} ^{2} }{ (1 - r_{z+1} \mathit{refl_{dif}}) + \mathit{refl_{dif}}}. @@ -1380,10 +1354,10 @@ profile section. Firstly, we denote two or more canopy layers (denoted :math:`C_l`). The concept of a ‘canopy layer’ refers to the idea that plants are organized into discrete over and under-stories, as predicted by the Perfect Plasticity Approximation -:raw-latex:`\parencite{purves2008,fisher2010}`. Within each canopy layer +(:ref:`Purves et al. 2008`, :ref:`Fisher et al. 2010`). Within each canopy layer there potentially exist multiple cohorts of different plant functional types and heights. Within each canopy layer, :math:`C_l`, and functional -type, :math:`ft`, the model resolves numerous leaf layers ‘:math:`z`’, +type, :math:`ft`, the model resolves numerous leaf layers :math:`z`, and, for some processes, notably photosynthesis, each leaf layer is split into a fraction of sun and shade leaves, :math:`f_{sun}` and :math:`f_{sha}`, respectively. @@ -1392,12 +1366,12 @@ The radiation scheme described in Section is solved explicitly for this structure, for both the visible and near-infrared wavebands, according to the following assumptions. -- A ‘canopy layer’ (:math:`C_{L}`) refers to either the over or understorey +- A *canopy layer* (:math:`C_{L}`) refers to either the over or understorey -- A ‘leaf layer’ (:math:`z`) refers to the discretization of the LAI +- A *leaf layer* (:math:`z`) refers to the discretization of the LAI within the canopy of a given plant functional type. -- All PFT’s in the same canopy layer have the same solar radiation +- All PFTs in the same canopy layer have the same solar radiation incident on the top layer of the canopy - Light is transmitted through the canopy of each plant functional type independently @@ -1411,7 +1385,7 @@ to the following assumptions. radiation is directly transferred to the soil surface. - All these calculations pertain to a single patch, so we omit the - ‘patch’ subscript for simplicity in the following discussion. + `patch` subscript for simplicity in the following discussion. Within this framework, the majority of the terms in the radiative transfer scheme are calculated with indices of :math:`C_L`, @@ -1553,9 +1527,9 @@ photosynthesis model before describing its application to the FATES canopy structure. This description in this section is largely repeated from the Oleson et al. CLM4.5 technical note but included here for comparison with its implementation in FATES. Photosynthesis in C3 -plants is based on the model of :raw-latex:`\cite{farquhar1980}` as -modified by :raw-latex:`\cite{collatz1991}`. Photosynthetic assimilation -in C4 plants is based on the model of :raw-latex:`\cite{collatz1992}`. +plants is based on the model of :ref:`Farquhar 1980` as +modified by :ref:`Collatz et al. 1991`. Photosynthetic assimilation +in C4 plants is based on the model of :ref:`Collatz et al. 1991`. In both models, leaf photosynthesis, :math:`\textrm{gpp}` (:math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`) is calculated as the minimum of three potentially limiting fluxes, @@ -1582,7 +1556,7 @@ partial pressure (Pa). :math:`K_{c}` and :math:`K_{o}` are the Michaelis-Menten constants (Pa) for CO\ :math:`_{2}` and O\ :math:`_{2}`. These vary with vegetation temperature :math:`T_v` (:math:`^{o}`\ C) according to an Arrhenious function described in -:raw-latex:`\cite{oleson2013}`. :math:`V_{c,max}` is the leaf layer +:ref:`Oleson et al. 2013`. :math:`V_{c,max}` is the leaf layer photosynthetic capacity (:math:`\mu` mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`). @@ -1653,7 +1627,7 @@ CO\ :math:`_{2}` compensation point :math:`\Gamma_{*}` (Pa) is where the term 0.21 represents the ratio of maximum rates of oxygenation to carboxylation, which is virtually constant with temperature -:raw-latex:`\cite{farquhar1980}`. +:ref:`Farquhar, 1980`. Resolution of the photosynthesis theory within the FATES canopy structure. ------------------ @@ -1733,7 +1707,7 @@ Variation in plant physiology with canopy depth Both :math:`V_{c,max}` and :math:`J_{max}` vary with vertical depth in the canopy on account of the well-documented reduction in canopy -nitrogen through the leaf profile, see :raw-latex:`\cite{bonan2012}` for +nitrogen through the leaf profile, see :ref:`Bonan et al. 2012` for details). Thus, both :math:`V_{c,max}` and :math:`J_{max}` are indexed by by :math:`C_l`, :math:`ft` and :math:`z` according to the nitrogen decay coefficient :math:`K_n` and the amount of vegetation area shading @@ -1779,7 +1753,7 @@ where :math:`V_{canopy}` is calculated as :math:`K_{n}` is the coefficient of nitrogen decay with canopy depth. The value of this parameter is taken from the work of -:raw-latex:`\cite{lloyd2010}` who determined, from 204 vertical profiles +:ref:`Lloyd et al. 2010` who determined, from 204 vertical profiles of leaf traits, that the decay rate of N through canopies of tropical rainforests was a function of the :math:`V_{cmax}` at the top of the canopy. They obtain the following term to predict :math:`K_{n}`, @@ -1966,7 +1940,7 @@ To calculate canopy leaf respiration, which varies through we canopy, we first determine the top-of-canopy leaf respiration rate (:math:`r_{m,leaf,ft,0}`, gC s\ :math:`^{-1}` m\ :math:`^{-2}`) is calculated from a base rate of respiration per unit leaf nitrogen -derived from :raw-latex:`\cite{ryan1991}`. The base rate for leaf +derived from :ref:`Ryan et al. 1991`. The base rate for leaf respiration (:math:`r_{b}`) is 2.525 gC/gN s\ :math:`^{-1}`, .. math:: r_{m,leaf,ft,0} = r_{b} N_{a,ft}(1.5^{(25-20)/10}) @@ -2006,7 +1980,7 @@ same base rate of respiration per unit of tissue Nitrogen. Here, :math:`t_c` is a temperature relationship based on a :math:`q_{10}` value of 1.5, where :math:`t_v` is the vegetation temperature. We use a base rate of 20 here as, again, this is the -baseline temperature used by :raw-latex:`\cite{ryan1991}`. The +baseline temperature used by :ref:`Ryan et al. 1991`. The 10\ :math:`^{-3}` converts from gC invididual\ :math:`^{-1}` s\ :math:`^{-1}` to KgC invididual\ :math:`^{-1}` s\ :math:`^{-1}` @@ -2089,13 +2063,13 @@ Fundamental stomatal conductance theory [14]_Stomatal conductance is unchanged in concept from the CLM4.5 approach. Leaf stomatal resistance is calculated from the Ball-Berry conductance -model as described by :raw-latex:`\cite{collatz1991}` and implemented in -a global climate model by :raw-latex:`\cite{sellers1996}`. The model +model as described by :ref:`Collatz et al. 1991` and implemented in +a global climate model by :ref:`Sellers et al. 1996`. The model relates stomatal conductance (i.e., the inverse of resistance) to net leaf photosynthesis, scaled by the relative humidity at the leaf surface and the CO\ :math:`_2` concentration at the leaf surface. The primary difference between the CLM implementation and that used by -:raw-latex:`\cite{collatz1991}` and :raw-latex:`\cite{sellers1996}` is +:ref:`Collatz et al. 1991` and :ref:`Sellers et al. 1996` is that they used net photosynthesis (i.e., leaf photosynthesis minus leaf respiration) instead of gross photosynthesis. As implemented here, stomatal conductance equals the minimum conductance (:math:`b`) when @@ -2118,14 +2092,14 @@ surface (Pa), :math:`e_i` is the saturation vapor pressure (Pa) inside the leaf at the vegetation temperature conductance (:math:`\mu`\ mol m\ :math:`^{-2}` s\ :math:`^{-1}`) when :math:`A` = 0 . Typical values are :math:`m_{ft}` = 9 for C\ :math:`_3` plants and :math:`m_{ft}` = 4 -for C\ :math:`_4` plants -:raw-latex:`\parencite{collatz1991,collatz1992,sellers1996}`. -:raw-latex:`\cite{sellers1996}` used :math:`b` = 10000 for C\ :math:`_3` +for C\ :math:`_4` plants ( +:ref:`Collatz et al. 1991`, :ref:`Collatz, 1992`, :ref:`Sellers et al 1996)`. +:ref:`Sellers et al. 1996` used :math:`b` = 10000 for C\ :math:`_3` plants and :math:`b` = 40000 for C\ :math:`_4` plants. Here, :math:`b` was chosen to give a maximum stomatal resistance of 20000 s m\ :math:`^{-1}`. These terms are nevertheless plant strategy dependent, and have been found to vary widely with plant type -:raw-latex:`\parencite{medlyn2011}`. +:ref:`Medlyn et al. 2001`. Resistance is converted from units of s m\ :math:`^2 \mu` mol\ :math:`^{-1}` to s m\ :math:`^{-1}` as: 1 s m\ :math:`^{-1}` = @@ -2240,7 +2214,7 @@ where The allocation to storage is a fourth power function of :math:`f_{tstore}` to mimic the qualitative behaviour found for carbon -allocation in arabidopsis by :raw-latex:`\cite{smith2007}`. +allocation in arabidopsis by :ref:`Smith et al. 2007`. .. math:: @@ -2487,7 +2461,7 @@ C\ :math:`^{-1}`) .. math:: A_{leaf,coh} = b_{leaf,coh} \cdot SLA_{ft} For a given tree allometry, leaf biomass is determined from basal area -using the function used by :raw-latex:`\cite{mc_2001}` where :math:`d_w` +using the function used by :ref:`Moorcroft et al. 2001` where :math:`d_w` is wood density in g cm\ :math:`^{-3}`. .. math:: b_{leaf,coh} = c_{leaf} \cdot dbh_{coh}^{e_{leaf,dbh}} \rho_{ft}^{e_{leaf,dens}} @@ -2578,7 +2552,7 @@ Cold Deciduous Phenology Cold Leaf-out timing ~~~~~~~~~~~~~~~~~~~~ -[18]_. The phenology model of :raw-latex:`\cite{botta2000}` is used in +[18]_. The phenology model of :ref:`Botta et al. 2000` is used in FATES to determine the leaf-on timing. The Botta et al. model was verified against satellite data and is one of the only globally verified and published models of leaf-out phenology. This model differs from the @@ -2592,13 +2566,13 @@ given threshold :math:`T_{g}` (0 :math:`^{o}`\ C). Budburst occurs when :math:`GDD` exceeds a threshold (:math:`GDD_{crit}`). The threshold is modulated by the number of chilling days experienced (NCD) where the mean daily temperature falls -below a threshold determined by :raw-latex:`\cite{botta2000}` as +below a threshold determined by `Botta et al. 2000` as 5\ :math:`^{o}`\ C. A greater number of chilling days means that fewer growing degree days are required before budburst: .. math:: GDD_{crit}=a+be^{c.NCD} -where a = -68, b= 638 and c=-0.01 :raw-latex:`\cite{botta2000}`. In the +where a = -68, b= 638 and c=-0.01 `Botta et al. 2000`. In the Northern Hemisphere, counting of degree days begins on 1st January, and of chilling days on 1st November. The calendar opposite of these dates is used for points in the Southern Hemisphere. @@ -2620,8 +2594,8 @@ Cold Leaf-off timing The leaf-off model is taken from the Sheffield Dynamic Vegetation Model (SDGVM) and is similar to that for LPJ -:raw-latex:`\parencite{sitch2003}` and IBIS -:raw-latex:`\parencite{foley1996}` models. The average daily +:ref:`Sitch et al. 2003` and IBIS +:ref:`Foley et al. 1996` models. The average daily temperatures of the previous 10 day period are stored. Senescence is triggered when the number of days with an average temperature below 7.5\ :math:`^{o}` (:math:`n_{colddays}`) rises above a threshold values @@ -2772,10 +2746,10 @@ patch of the correct PFT type. .. math:: Seed_{in,ft} = \frac{\sum_{p=1}^{n_{patch}}\sum_{i=1}^{n_{coh}}p_{seed,i}.n_{coh}}{area_{site}} Seed decay is the sum of all the processes that reduce the number of -seeds, taken from :raw-latex:`\cite{lischke2006}`. Firstly, the rate at +seeds, taken from :ref:`Lischke et al. 2006`. Firstly, the rate at which seeds become inviable is described as a constant rate :math:`\phi` (y:math:`^{-1}`) which is set to 0.51, the mean of the parameters used -by :raw-latex:`\cite{lischke2006}`. +by :ref:`Lischke et al. 2006`. .. math:: Seed_{decay,ft} = Seeds_{FT}.\phi @@ -3038,13 +3012,13 @@ PFT-specific ‘target’ carbon storage, :math:`l_{targ,ft}`, as follows: .. math:: M_{cs,coh}= \rm{max} \left(0.0, S_{m,ft} \left(0.5 - \frac{b_{store,coh}}{l_{targ,ft}b_{leaf}}\right)\right) -where :math:`S_{m,ft}` is the ‘stress mortality’ parameter, or the +where :math:`S_{m,ft}` is the `stress mortality` parameter, or the fraction of trees in a landscape that die when the mean condition of a given cohort triggers mortality. This parameter is needed to scale from individual-level mortality simulation to grid-cell average conditions. Mechanistic simulation of hydraulic failure is not undertaken on account -of it’s mechanistic complexity (see :raw-latex:`\cite{mcdowell2013}`for +of it’s mechanistic complexity (see :ref:`McDowell et al. 2013`for details). Instead, we use a proxy for hydraulic failure induced mortality (:math:`M_{hf,coh}`) that uses a water potential threshold beyond mortality is triggered, such that the tolerance of low water @@ -3096,13 +3070,13 @@ Fire (SPITFIRE) [24]_The influence of fire on vegetation is estimated using the SPITFIRE model, which has been modified for use in ED following it’s original implementation in the LPJ-SPITFIRE model -(:raw-latex:`\parencite{thonicke2010,pfeiffer2013}`. This model as +(:ref:`Thonicke et al. 2010, :ref:`Pfeiffer et al. 2013`). This model as described is substantially different from the existing CLM4.5 fire model -:raw-latex:`\parencite{li2012}`, however, further developments are +:ref:`Li et al. 2012`, however, further developments are intended to increase the merging of SPITFIRE’s natural vegetation fire scheme with the fire suppression, forest-clearing and peat fire estimations in the existing model. The coupling to the ED model allows -fires to interact with vegetation in a ‘size-structured’ manner, so +fires to interact with vegetation in a size-structured manner, so small fires can burn only understorey vegetation. Also, the patch structure and representation of succession in the ED model allows the model to track the impacts of fire on different forest stands, therefore @@ -3114,7 +3088,7 @@ only implementation of this type of scheme in existence. The SPITFIRE model operates at a daily timestep and at the patch level, meaning that different litter pools and vegetation charecteristics of open and closed forests can be represented effectively (we omit the -‘patch’ subscript throughout for simplicity). +`patch` subscript throughout for simplicity). Properties of fuel load --------------- @@ -3123,11 +3097,11 @@ Many fire processes are impacted by the properties of the litter pool in the SPITFIRE model. There are one live (live grasses) and five dead fuel categories (dead leaf litter and four pools of coarse woody debris). Coarse woody debris is classified into 1h, 10h, 100h, and 1000h fuels, -defined by “\ *the order of magnitude of time required for fuel to lose +defined by the order of magnitude of time required for fuel to lose (or gain) 63% of the difference between its current moisture content and -the equilibrium moisture content under defined atmospheric conditions.*" -:raw-latex:`\parencite{thonicke2010}`. For the purposes of describing -the behaviour of fire, we introduce a new index ‘fuel class’ *fc*, the +the equilibrium moisture content under defined atmospheric conditions. +:ref:`Thonicke et al. 2010`. For the purposes of describing +the behaviour of fire, we introduce a new index 'fuel class' *fc*, the values of which correspond to each of the six possible fuel categories as follows. @@ -3157,7 +3131,7 @@ Nesterov Index Dead fuel moisture (:math:`\emph{moist}_{df,fc}`), and several other properties of fire behaviour, are a function of the ‘Nesterov Index’ (:math:`N_{I}`) which is an accumulation over time of a function of -temperature and humidity (Eqn 5, :raw-latex:`\cite{thonicke2010}`). +temperature and humidity (Eqn 5, :ref:`Thonicke et al. 2010`). .. math:: N_{I}=\sum{\textrm{max}(T_{d}(T_{d}-D),0)} @@ -3204,7 +3178,7 @@ Live grass moisture Content The live grass fractional moisture content(\ :math:`\emph{moist}_{lg}`) is a function of the soil moisture content. (Equation B2 in -:raw-latex:`\cite{thonicke2010}`) +:ref:`Thonicke et al. 2010`) .. math:: \emph{moist}_{lg}=\textrm{max}(0.0,\frac{10}{9}\theta_{30}-\frac{1}{9}) @@ -3274,7 +3248,7 @@ the fire *ros*\ :math:`_{f}` (nominally in the direction of the wind). :math:`e_{ps}` is the effective heating number (:math:`e^{\frac{-4.528}{F_{\sigma,patch}}}`). :math:`q_{ig}` is the heat of pre-ignition (:math:`581+2594F_{m}`). :math:`x_{i}` is the -propagating flux calculated as (see :raw-latex:`\cite{thonicke2010}` +propagating flux calculated as (see :ref:`Thonicke et al. 2010` Appendix A). .. math:: @@ -3298,7 +3272,7 @@ surface-area-volume ratio :math:`F_{\sigma,patch}`: where :math:`p_{d}` is the particle density (513). :math:`i_{r}` is the reaction intensity, calculated using the following -set of expressions (from :raw-latex:`\cite{thonicke2010}` Appendix A).: +set of expressions (from :ref:`Thonicke et al. 2010` Appendix A).: .. math:: @@ -3322,7 +3296,7 @@ Fuel Consumption The fuel consumption (fraction of biomass pools) of each dead biomass pool in the area affected by fire on a given day (:math:`f_{c,dead,fc}`) is a function of effective fuel moisture :math:`E_{moist,fc}` and size -class *fc* (Eqn B1, B4 and B5, :raw-latex:`\cite{thonicke2010}`). The +class *fc* (Eqn B1, B4 and B5, :ref:`Thonicke et al. 2010`). The fraction of each fuel class that is consumed decreases as its moisture content relative to its moisture of extinction (:math:`E_{moist,fc}`) increases. @@ -3334,7 +3308,7 @@ is modulated by both size class :math:`fc` and by the effective fuel moisture class :math:`mc`, defined by :math:`E_{moist,fc}`. :math:`m_{int}` and :math:`m_{slope}` are defined for low-, mid-, and high-moisture conditions, the boundaries of which are also functions of -the litter size class following :raw-latex:`\cite{peterson1986}` (page +the litter size class following :ref:`Peterson and Ryan 1986 ` (page 802). The fuel burned, :math:`f_{cground,fc}` (Kg m\ :math:`^{-2}` day\ :math:`^{-1}`) iscalculated from :math:`f_{cdead,fc}` for each fuel class: @@ -3357,7 +3331,7 @@ Fire intensity at the front of the burning area (:math:`I_{surface}`, kW m\ :math:`^{-2}`) is a function of the total fuel consumed (:math:`f_{ctot,patch}`) and the rate of spread at the front of the fire, :math:`\mathit{ros}_{f}` (m min\ :math:`^{-1}`) (Eqn 15 -:raw-latex:`\cite{thonicke2010}`) +:ref:`Thonicke et al. 2010`) .. math:: I_{surface}=\frac{0.001}{60}f_{energy} f_{ctot,patch}\mathit{ros}_{f} @@ -3371,7 +3345,7 @@ Fire Duration Fire duration is a function of the fire danger index with a maximum length of :math:`F_{dur,max}` (240 minutes in -:raw-latex:`\cite{thonicke2010}` Eqn 14, derived from Canadian Forest +:ref:`Thonicke et al. 2010` Eqn 14, derived from Canadian Forest Fire Behaviour Predictions Systems) .. math:: D_{f}=\textrm{min}\Big(F_{dur,max},\frac{F_{dur,max}}{1+F_{dur,max}e^{-11.06fdi}}\Big) @@ -3387,7 +3361,7 @@ for each gridcell as a function of the Nesterov Index . .. math:: \emph{fdi}=1-e^{\alpha N_{I}} where :math:`\alpha` = 0.00037 following -:raw-latex:`\cite{venevsky2002}`. +:ref:`Venevsky et al. 2002`. Area Burned ----------- @@ -3400,14 +3374,14 @@ respectively). .. math:: f_{length}=F_{d}(ros_{b}+ros_{f}) :math:`ros_{b}` is a function of :math:`ros_{f}` and windspeed (Eqn 10 -:raw-latex:`\cite{thonicke2010}`) +:ref:`Thonicke et al. 2010`) .. math:: ros_{b}=ros_{f}e^{-0.72W} The minor axis to major axis ratio :math:`l_{b}` of the ellipse is determined by the windspeed. If the windspeed (:math:`W`) is less than 16.67 ms\ :math:`^{-1}` then :math:`l_{b}=1`. Otherwise (Eqn 12 and 13, -:raw-latex:`\cite{thonicke2010}`) +:ref:`Thonicke et al. 2010`) .. math:: l_{b}=\textrm{min}\Big(8,f_{tree}(1.0+8.729(1.0-e^{-0.108W})^{2.155})+(f_{grass}(1.1+3.6W^{0.0464}))\Big) @@ -3415,7 +3389,7 @@ determined by the windspeed. If the windspeed (:math:`W`) is less than surface covered by grass and trees respectively. The total area burned (:math:`A_{burn}` in m\ :math:`^{2}`) is therefore -(Eqn 11, :raw-latex:`\cite{thonicke2010}`) +(Eqn 11, :ref:`Thonicke et al. 2010`) .. math:: A_{burn}=\frac{n_{f}\frac{3.1416}{4l_{b}}(f_{length}^{2}))}{10000} @@ -3427,7 +3401,7 @@ Crown Damage :math:`c_{k}` is the fraction of the crown which is consumed by the fire. This is calculated from scorch height :math:`H_{s}`, tree height :math:`h` and the crown fraction parameter :math:`F_{crown}` (Eqn 17 -:raw-latex:`\cite{thonicke2010}`): +:ref:`Thonicke et al. 2010`): .. math:: @@ -3438,9 +3412,9 @@ fire. This is calculated from scorch height :math:`H_{s}`, tree height \end{array} \right. The scorch height :math:`H_{s}` (m) is a function of the fire intensity, -following :raw-latex:`\cite{byram1959}`, and is proportional to a plant +following :ref:`Byram, 1959`, and is proportional to a plant functional type specific parameter :math:`\alpha_{s,ft}` (Eqn 16 -:raw-latex:`\cite{thonicke2010}`): +:ref:`Thonicke et al. 2010`): .. math:: H_{s}=\sum_{FT=1}^{NPFT}{\alpha_{s,p}\cdot f_{biomass,ft}} I_{surface}^{0.667} @@ -3452,25 +3426,25 @@ Cambial Damage and Kill The cambial kill is a function of the fuel consumed :math:`f_{c,tot}`, the bark thickness :math:`t_{b}`, and :math:`\tau_{l}`, the duration of -cambial heating (minutes) (Eqn 8, :raw-latex:`\cite{peterson1986}`): +cambial heating (minutes) (Eqn 8, :ref:`Peterson and Ryan 1986`): .. math:: \tau_{l}=\sum_{fc=1}^{fc=5}39.4F_{p,c}\frac{10000}{0.45}(1-(1-f_{c,dead,fc})^{0.5}) Bark thickness is a linear function of tree diameter :math:`dbh_{coh}`, defined by PFT-specific parameters :math:`\beta_{1,bt}` and -:math:`\beta_{2,bt}` (Eqn 21 :raw-latex:`\cite{thonicke2010}`): +:math:`\beta_{2,bt}` (Eqn 21 :ref:`Thonicke et al. 2010`): .. math:: t_{b,coh}=\beta_{1,bt,ft}+\beta_{2,bt,ft}dbh_{coh} The critical time for cambial kill, :math:`\tau_{c}` (minutes) is given -as (Eqn 20 :raw-latex:`\cite{thonicke2010}`): +as (Eqn 20 :ref:`Thonicke et al. 2010`): .. math:: \tau_{c}=2.9t_{b}^{2} The mortality rate caused by cambial heating :math:`\tau_{pm}` of trees within the area affected by fire is a function of the ratio between :math:`\tau_{l}` and :math:`\tau_{c}` (Eqn 19, -:raw-latex:`\cite{thonicke2010}`): +:ref:`Thonicke et al. 2010`): .. math:: diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index e613dce3b4..4d0883ac14 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -2226,3 +2226,134 @@ Global Biogeochemical Cycles 18. DOI:10.1029/2004GB002239. Zilitinkevich, S.S. 1970. Dynamics of the Atmospheric Boundary Layer. Leningrad Gidrometeor. + +.. _bonan2012: + +Bonan, Gordon B et al. (2012). `Reconciling leaf physiological traits and canopy flux data: Use of the TRY and FLUXNET databases in the Community Land Model version 4`. Journal of Geophysical Research: Biogeosciences (2005-2012) 117.G2. + +.. _botta2000: + +Botta, A et al. (2000). `A global prognostic scheme of leaf onset using satellite data`. Global Change Biology 6.7, pp. 709-725. + +.. _byram1959: + +Byram, GM (1959). Combustion of forest fuels. In Forest fire: control and use.(Ed. KP Davis) pp. 61-89. + +.. _collatz1991: + +Collatz, G James et al. (1991). `Physiological and environmental regulation of stomatal conductance, photosynthesis and transpiration: a model that includes a laminar boundary layer` Agricultural and Forest Meteorology 54.2, pp. 107-136. + +.. _collatz1992: + +Collatz, Go J, M Ribas-Carbo, and JA Berry (1992). `Coupled photosynthesis-stomatal conductance model for leaves of C4 plants`. Functional Plant Biology 19.5, pp. 519-538.
 + +.. _farquhar1980: + +Farquhar, GD, S von von Caemmerer, and JA Berry (1980). `A biochemical model of photosynthetic CO2 assimilation in leaves of C3 species`. Planta 149.1, pp. 780-90. + +.. _fisher2010: + +Fisher, JB et al. (2010). `Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation`. Global Biogeochemical Cycles 24.1. + +.. _foley1996: + +Foley, Jonathan A et al. (1996). `An integrated biosphere model of land surface processes, terrestrial carbon balance, and vegetation dynamics`. Global Biogeochemical Cycles 10.4, pp. 603-628. + +.. _fyllas2014: + +Fyllas, NM et al. (2014). `Analysing Amazonian forest productivity using a new individual and trait- based model (TFS v. 1)`. Geoscientific Model Development 7.4, pp. 1251-1269. + +.. _kucharik1998: + +Kucharik, Christopher J, John M Norman, and Stith T Gower (1998). `Measurements of branch area and adjusting leaf area index indirect measurements`. Agricultural and Forest Meteorology 91.1, pp. 69-88. + +.. _li2012: + +Li, F, XD Zeng, and S Levis (2012). `A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model`. Biogeosciences 9.7, pp. 2761-2780. + +.. _lichstein2011: + +Lichstein, Jeremy W and Stephen W Pacala (2011). `Local diversity in heterogeneous landscapes: quantitative assessment with a height-structured forest metacommunity model`. Theoretical Ecology 4.2, pp. 269-281. + +.. _lischke2006: + +Lischke, Heike et al. (2006). `TreeMig: a forest-landscape model for simulating spatio-temporal patterns from stand to landscape scale`. Ecological Modelling 199.4, pp. 409-420. 41 + +.. _lloyd2010: + +Lloyd, J et al. (2010). `Optimisation of photosynthetic carbon gain and within-canopy gradients of associated foliar traits for Amazon forest trees`. Biogeosciences 7.6, pp. 1833-1859. + +.. _mcdowell2013: + +McDowell, Nate G et al. (2013). `Evaluating theories of drought-induced vegetation mortality using a multimodel experiment framework`. New Phytologist 200.2, pp. 304-321. + +.. _medlyn2011: + +Medlyn, Belinda E et al. (2011). `Reconciling the optimal and empirical approaches to modelling stom- atal conductance`. Global Change Biology 17.6, pp. 2134-2144. + + +.. _mc_2001: + +Moorcroft, PR, GC Hurtt, and Stephen W Pacala (2001). `A method for scaling vegetation dynamics: the ecosystem demography model ED`. Ecological monographs 71.4, pp. 557-586. + +.. _norman1979: + +Norman, JM (1979). `Modeling the complete crop canopy`. Modification of the Aerial Environment of Crops, pp. 249-280. + +.. _oleson2013: + +Oleson, KW et al. (2013). `Technical description of version 4.5 of the Community Land Model (CLM)`. + +.. _peterson1986: + +Peterson, David L and Kevin C Ryan (1986). `Modeling postfire conifer mortality for long-range planning`. Environmental Management 10.6, pp. 797-808. + +.. _pfeiffer2013: + +Pfeiffer, M, A Spessa, and JO Kaplan (2013). `A model for global biomass burning in preindustrial time: LPJ-LMfire (v1. 0)`. Geoscientific Model Development 6.3, pp. 643-685. + +.. _purves2008: + +Purves, Drew W et al. (2008). `Predicting and understanding forest dynamics using a simple tractable model`. Proceedings of the National Academy of Sciences 105.44, pp. 17018-17022. + +.. _sato2007: + +Sato, Hisashi, Akihiko Itoh, and Takashi Kohyama (2007). `SEIB–DGVM: A new Dynamic Global Vegetation Model using a spatially explicit individual-based approach`. Ecological Modelling 200.3, pp. 2793307. + +.. _sellers1996: + +Sellers, Piers J et al. (1996). `A revised land surface parameterization (SiB2) for atmospheric GCMs. Part II: The generation of global fields of terrestrial biophysical parameters from satellite data`. Journal of climate 9.4, pp. 706-737. + +.. _sitch2003: + +Sitch, S et al. (2003). `Evaluation of ecosystem dynamics, plant geography and terrestrial carbon cycling in the LPJ dynamic global vegetation model`. Global Change Biology 9.2, pp. 161-185. + +.. _smith2007: + +Smith, Alison M and Mark Stitt (2007). `Coordination of carbon supply and plant growth`. Plant, cell & environment 30.9, pp. 1126-1149. + +.. _smith2001: + +Smith, Benjamin, I Colin Prentice, and Martin T Sykes (2001). `Representation of vegetation dynamics in the modelling of terrestrial ecosystems: comparing two contrasting approaches within European climate space`. Global Ecology and Biogeography 10.6, pp. 621-637. + +.. _thonicke2010: + +Thonicke, K et al. (2010). `The influence of vegetation, fire spread and fire behaviour on biomass burning and trace gas emissions: results from a process-based model`. Biogeosciences 7.6, pp. 1991-2011. + +.. _uriarte2009: + +Uriarte, Maria et al. (2009). `Natural disturbance and human land use as determinants of tropical forest dynamics: results from a forest simulator`. Ecological Monographs 79.3, pp. 423-443. + +.. _venevsky2002: + +Venevsky, Sergey et al. (2002). `Simulating fire regimes in human-dominated ecosystems: Iberian Peninsula case study`. Global Change Biology 8.10, pp. 984-998. + +.. _weng2014: + +Weng, ES et al. (2014). `Scaling from individuals to ecosystems in an Earth System Model using a mathematically tractable model of height-structured competition for light`. Biogeosciences Discussions 11.12, pp. 17757-17860. + +.. _xiaodong2005: + +Xiaodong, Yan and HH Shugart (2005). `FAREAST: a forest gap model to simulate dynamics and patterns of eastern Eurasian forests`. Journal of Biogeography 32.9, pp. 1641-1658. +42 + From 97e56aa0500ddcee5ef9d4231a32136f88e4debf Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 13 Dec 2017 09:28:24 -0700 Subject: [PATCH 0118/1973] Update html and fix build errors --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 76 +++++++++---------- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 67 +--------------- ...LM50_Tech_Note_External_Nitrogen_Cycle.rst | 4 +- .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 3 +- .../References/CLM50_Tech_Note_References.rst | 7 ++ .../CLM50_Tech_Note_Surface_Albedos.rst | 5 +- 6 files changed, 55 insertions(+), 107 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 3a0bfcdbb2..45953fdca8 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -58,7 +58,7 @@ concept of 'Ecosystem Demography' and the implementation of this concept in different models, the CLM(ED) implementation described by Fisher et al. (2015) will hereafter be called 'FATES' (the Functionally Assembled Terrestrial Ecosystem Simulator). The representation of ecosystem heterogeneity in FATES -^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The terrestrial surface of the Earth is heterogeneous for many reasons, driven by variations in climate, edaphic history, ecological variability, @@ -445,7 +445,7 @@ restarted. The state variables of a cohort are as follows: +-----------------+-----------------+-----------------+-----------------+ Patch State Variables ------------------- +--------------------- A patch, as discuss earlier, is a fraction of the landscape which contains ecosystems with similar structure and disturbance history. A @@ -515,7 +515,7 @@ attributed to each cohort are accumulated throughout each daily cycle and passed into the ED code as the major driver of vegetation dynamics. Initialization of vegetation from bare ground -^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [5]_If the model is restarted from a bare ground state (as opposed to a pre-existing vegetation state), the state variables above are @@ -586,7 +586,7 @@ biomass, assigned per PFT [table:init] Allocation of biomass -^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^ [6]_Total live biomass :math:`b_{alive}` is the state variable of the model that describes the sum of the three live biomass pools leaf @@ -695,7 +695,7 @@ To calculated the sapwood biomass, we use [table:allom] Canopy Structure and the Perfect Plasticity Approximation -^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [7]_During initialization and every subsequent daily ED timestep, the canopy structure model is called to determine how the leaf area of the @@ -711,7 +711,7 @@ heights, which has a very significant impact on how vegetation distribution emerges from competition :ref:`Fisher et al. 2010`. -The standard ED1.0 model makes a simple `flat disk' assumption, that the +The standard ED1.0 model makes a simple 'flat disk' assumption, that the leaf area of each cohort is spread in an homogenous layer at one exact height across entire the ground area represented by each patch. FATES has diverged from this representation due to (at least) two problematic emergent properties that we identified as generating unrealistic behaviours espetially for large-area patches. @@ -826,10 +826,10 @@ fractions of cohorts are demoted or promoted. Further details can be found in the code references in the footnote. Horizontal Canopy Spread ------------------ +------------------------- [8]_:ref:`Purves et al. 2008` estimated the ratio between canopy and -stem diameter :math:`c_{p}` as0.1 m cm\ :math:`^{-1}` for canopy trees +stem diameter :math:`c_{p}` as 0.1 m cm\ :math:`^{-1}` for canopy trees in North American forests, but this estimate was made on trees in closed canopies, whose shape is subject to space competition from other individuals. Sapling trees have no constraints in their horizontal @@ -887,7 +887,7 @@ However, the model is relatively insensitive to the choice of either :math:`i` or :math:`A_{t}`. Definition of Leaf and Stem Area Profile -------------------- +---------------------------------------- [9]_Within each patch, the model defines and tracks cohorts of multiple plant functional types that exist either in the canopy or understorey. @@ -1030,7 +1030,7 @@ leaf and stem area profiles, Burial of leaf area by snow --------------------- +--------------------------- The calculations above all pertain to the total leaf and stem area indices which charecterize the vegetation structure. In addition, the @@ -1129,7 +1129,7 @@ Radiation Transfer ^^^^^^^^^^^^^^^^^^^ Fundamental Radiation Transfer Theory ------------------- +------------------------------------- [10]_The first interaction of the land surface with the properties of vegetation concerns the partitioning of energy into that which is @@ -1343,7 +1343,7 @@ fractions, (required by the photosynthesis calculations), is .. math:: abs_{sun,z} = abs_{dif,z} \cdot f_{sun}+ abs_{dir,z} Resolution of radiation transfer theory within the FATES canopy structure ------------------- +------------------------------------------------------------------------- The radiation transfer theory above, was described with reference to a single canopy of one plant functional type, for the sake of clarity of @@ -1520,7 +1520,7 @@ Photosynthesis ^^^^^^^^^^^^^^^^^^^^ Fundamental photosynthetic physiology theory ------------------- +-------------------------------------------- [11]_In this section we describe the physiological basis of the photosynthesis model before describing its application to the FATES @@ -1630,7 +1630,7 @@ to carboxylation, which is virtually constant with temperature :ref:`Farquhar, 1980`. Resolution of the photosynthesis theory within the FATES canopy structure. ------------------- +-------------------------------------------------------------------------- The photosynthesis scheme is modified from the CLM4.5 model to give estimates of photosynthesis, respiration and stomatal conductance for a @@ -1703,7 +1703,7 @@ s\ :math:`^{-1}`) is calculated in a similar fashion, \end{array} \right. Variation in plant physiology with canopy depth ------------------- +----------------------------------------------- Both :math:`V_{c,max}` and :math:`J_{max}` vary with vertical depth in the canopy on account of the well-documented reduction in canopy @@ -1764,7 +1764,7 @@ where :math:`V_{cmax}` is again in :math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`. Water Stress on gas exchange ------------------- +---------------------------- [12]_ The top of canopy leaf photosynthetic capacity, :math:`V_{c,max0}`, is also adjusted for the availability of water to plants as @@ -1802,7 +1802,7 @@ on the calculation of soil matric potential, see the CLM4.5 technical note. Variation of water stress and water uptake within tiles -~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The remaining drivers of the photosynthesis model remain constant (atmospheric CO\ :math:`_2` and O\ :math:`^2` and canopy temperature) @@ -1837,7 +1837,7 @@ canopy conductance for plant functional type :math:`ft`, .. math:: G_{s,ft}= \sum_{1}w_{ncoh,ft} {gs_{can,coh} n_{coh} }. Aggregation of assimilated carbon into cohorts ------------------- +---------------------------------------------- The derivation of photosynthetic rates per leaf layer, as above, give us the estimated rate of assimilation for a unit area of leaf at a given @@ -2056,10 +2056,10 @@ respiration has occurred. \bigskip Stomatal Conductance -^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^ Fundamental stomatal conductance theory ------------------- +--------------------------------------- [14]_Stomatal conductance is unchanged in concept from the CLM4.5 approach. Leaf stomatal resistance is calculated from the Ball-Berry conductance @@ -2110,7 +2110,7 @@ kmol\ :math:`^{-1}`) and :math:`\theta_{atm}` is the atmospheric potential temperature (K). Resolution of stomatal conductance theory in the FATES canopy structure --------------- +----------------------------------------------------------------------- The stomatal conductance is calculated, as with photosynthesis, for each canopy, PFT and leaf layer. The CLM code requires a single canopy @@ -2144,7 +2144,7 @@ cohort. Allocation and Growth -^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^ [15]_Total assimilation carbon enters the ED model each day as a cohort-specific Net Primary Productivity :math:`\mathit{NPP}_{coh}`, @@ -2162,7 +2162,7 @@ individual\ :math:`^{-1}` year\ :math:`^{-1}` and ultimately integrated using a timesteps of 1/365 years for each day. Tissue maintenance demand ---------------- +------------------------- We calculate a ‘tissue maintenance’ flux. The magnitude of this flux is such that the quantity of biomass in each pool will remain constant, @@ -2191,7 +2191,7 @@ phenology section. The total quantity of maintenance demand .. math:: t_{md,coh} = l_{md,coh} + r_{md,coh} Allocation to storage and turnover ------------------ +---------------------------------- The model must now determine whether the NPP input is sufficient to meet the maintenance demand and keep tissue levels constant. To determine @@ -2272,7 +2272,7 @@ and leaf biomass, ameliorated by the leaf trimming fraction (see :math:`\rho_{ft}` is the wood density, in g cm\ :math:`^{3}`. Allocation to Seeds ---------------- +------------------- The fraction remaining for growth (expansion of live and structural tissues) :math:`f_{growth}` is 1 minus that allocated to seeds. @@ -2298,7 +2298,7 @@ KgC individual :math:`^{-1}` y\ :math:`^{-1}`) is thus .. math:: p_{seed,coh} = C_{growth}\cdot f_{seed,coh} Allocation to growing pools ----------------- +--------------------------- [16]_ The carbon is then partitioned into carbon available to grow the :math:`b_{alive}` and :math:`b_{struc}` pools. A fraction :math:`v_{a}` @@ -2382,7 +2382,7 @@ structural biomass pools are maintained in this algorithm, which diverges from the methodology currently deployed in the CLM4.5. Integration of allocated fluxes ----------------- +------------------------------- All of the flux calculations generate differential of the biomass state variables against time (in years). To integrate these differential rates @@ -2451,7 +2451,7 @@ In this case, :math:`\delta t` is set to be one day \bigskip Control of Leaf Area Index -^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^ [17]_The leaf area :math:`A_{leaf}` (m:math:`^{-2}`) of each cohort is calculated from leaf biomass :math:`b_{leaf,coh}` (kgC @@ -2547,7 +2547,7 @@ Phenology ^^^^^^^^^^^^^^^^^^^^ Cold Deciduous Phenology ------------------- +------------------------ Cold Leaf-out timing ~~~~~~~~~~~~~~~~~~~~ @@ -2632,7 +2632,7 @@ constrain growing degree day accumulation to the second half of the year and only allow GDD accumulation while the leaves are off. Drought-deciduous Phenology: TBD ------------------- +-------------------------------- In the current version of the model, a drought deciduous algorithm exists, but is not yet operational, due to issue detected in the existing @@ -2641,7 +2641,7 @@ native ED drought deciduous model. This is a priority to address before the science tag is released. Carbon Dynamics of deciduous plants ------------------- +----------------------------------- [19]_In the present version, leaf expansion and senescence happen over the course of a single day. This is clearly not an empirically robust @@ -2719,7 +2719,7 @@ for this carbon accounting scheme. \bigskip Seed Dynamics and Recruitment -^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [20]_The production of seeds and their subsequent germination is a process @@ -2800,7 +2800,7 @@ of one plant functional type over the seed pool. \bigskip Litter Production and Fragmentation -^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | The original CLM4.5 model contains streams of carbon pertaining to different chemical properties of litter (lignin, cellulose and labile @@ -2900,7 +2900,7 @@ sensitivity analyses of the model outputs. .. math:: l_{root,out,ft} = l_{root,ft}.\alpha_{root,ft}.S_{tw} Flux into decompsition cascade --------------- +------------------------------ [23]_Upon fragmentation and release from the litter pool, carbon is transferred into the labile, lignin and cellulose decomposition pools. @@ -3091,7 +3091,7 @@ open and closed forests can be represented effectively (we omit the `patch` subscript throughout for simplicity). Properties of fuel load ---------------- +----------------------- Many fire processes are impacted by the properties of the litter pool in the SPITFIRE model. There are one live (live grasses) and five dead fuel @@ -3238,7 +3238,7 @@ fuels). .. math:: F_{\sigma}=\sum_{fc=1}^{fc=4} \frac{F_{fc}}{F_{tot}}\sigma_{fuel,fc}+\frac{b_{l,grass}}{F_{tot}}\sigma_{fuel,grass} Forward rate of spread ------------------ +---------------------- For each patch and each day, we calculate the rate of forward spread of the fire *ros*\ :math:`_{f}` (nominally in the direction of the wind). @@ -3351,7 +3351,7 @@ Fire Behaviour Predictions Systems) .. math:: D_{f}=\textrm{min}\Big(F_{dur,max},\frac{F_{dur,max}}{1+F_{dur,max}e^{-11.06fdi}}\Big) Fire Danger Index --------------- +----------------- Fire danger index (*fdi*) is a representation of the effect of meteorological conditions on the likelihood of a fire. It is calculated @@ -3422,7 +3422,7 @@ where :math:`f_{biomass,ft}` is the fraction of the above-ground biomass in each plant functional type. Cambial Damage and Kill -------------- +----------------------- The cambial kill is a function of the fuel consumed :math:`f_{c,tot}`, the bark thickness :math:`t_{b}`, and :math:`\tau_{l}`, the duration of diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index e21c8e05d0..6d36046e41 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -187,74 +187,15 @@ Vegetation Structure ^^^^^^^^^^^^^^^^^^^^^^^^^^ Vegetation structure is defined by leaf and stem area indices -(:math:`L,\, S`) and canopy top and bottom heights (:math:`z_{top}`,\ :math:`z_{bot}` ) -(:numref:`Table Prescribed plant functional type heights`). Separate leaf and +(:math:`L,\, S`) and canopy top and bottom heights (:math:`z_{top}`,\ :math:`z_{bot}` ). +Separate leaf and stem area indices and canopy heights are prescribed or calculated for each PFT. Daily leaf and stem area indices are obtained from griddeddatasets of monthly values (section -:numref:`Surface Data`). Canopy top and bottom heights are also obtained from gridded datasets. -However, these are currently invariant in space and time and were obtained from PFT-specific -values (:ref:`Bonan et al. 2002a `). When the biogeochemistry model is active, +:numref:`Surface Data`). Canopy top and bottom heights are from ICESat (:ref:`Simard et al. (2011) `. +When the biogeochemistry model is active, vegetation state (LAI, SAI, canopy top and bottom heights) are calculated prognostically (see Chapter :numref:`rst_Vegetation Phenology and Turnover`). -.. _Table Prescribed plant functional type heights: - -.. table:: Prescribed plant functional type heights - - +-----------------------------------+------------------------+------------------------+ - | Plant functional type | :math:`z_{top}` (m) | :math:`z_{bot}` (m) | - +===================================+========================+========================+ - | NET Temperate | 17 | 8.5 | - +-----------------------------------+------------------------+------------------------+ - | NET Boreal | 17 | 8.5 | - +-----------------------------------+------------------------+------------------------+ - | NDT Boreal | 14 | 7 | - +-----------------------------------+------------------------+------------------------+ - | BET Tropical | 35 | 1 | - +-----------------------------------+------------------------+------------------------+ - | BET temperate | 35 | 1 | - +-----------------------------------+------------------------+------------------------+ - | BDT tropical | 18 | 10 | - +-----------------------------------+------------------------+------------------------+ - | BDT temperate | 20 | 11.5 | - +-----------------------------------+------------------------+------------------------+ - | BDT boreal | 20 | 11.5 | - +-----------------------------------+------------------------+------------------------+ - | BES temperate | 0.5 | 0.1 | - +-----------------------------------+------------------------+------------------------+ - | BDS temperate | 0.5 | 0.1 | - +-----------------------------------+------------------------+------------------------+ - | BDS boreal | 0.5 | 0.1 | - +-----------------------------------+------------------------+------------------------+ - | C\ :math:`{}_{3}` arctic grass | 0.5 | 0.01 | - +-----------------------------------+------------------------+------------------------+ - | C\ :math:`{}_{3}` grass | 0.5 | 0.01 | - +-----------------------------------+------------------------+------------------------+ - | C\ :math:`{}_{4}` grass | 0.5 | 0.01 | - +-----------------------------------+------------------------+------------------------+ - | Crop R | 0.5 | 0.01 | - +-----------------------------------+------------------------+------------------------+ - | Crop I | 0.5 | 0.01 | - +-----------------------------------+------------------------+------------------------+ - | :sup:`1`\ Corn R | - | - | - +-----------------------------------+------------------------+------------------------+ - | :sup:`1`\ Corn I | - | - | - +-----------------------------------+------------------------+------------------------+ - | :sup:`1`\ Temp Cereal R | - | - | - +-----------------------------------+------------------------+------------------------+ - | :sup:`1`\ Temp Cereal I | - | - | - +-----------------------------------+------------------------+------------------------+ - | :sup:`1`\ Winter Cereal R | - | - | - +-----------------------------------+------------------------+------------------------+ - | :sup:`1`\ Winter Cereal I | - | - | - +-----------------------------------+------------------------+------------------------+ - | :sup:`1`\ Soybean R | - | - | - +-----------------------------------+------------------------+------------------------+ - | :sup:`1`\ Soybean I | - | - | - +-----------------------------------+------------------------+------------------------+ - -:sup:`1`\ Determined by the crop model (Chapter :numref:`rst_Crops and Irrigation`) - .. _Phenology and vegetation burial by snow: Phenology and vegetation burial by snow diff --git a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst index 6a4ff5479d..ca7a4a9d2c 100644 --- a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst +++ b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst @@ -3,9 +3,9 @@ External Nitrogen Cycle =========================== -.. _Summary of CLM5.0 updates relative to the CLM4.5: +.. _Summary of CLM5.0 updates relative to CLM4.5: -Summary of CLM5.0 updates relative to the CLM4.5 +Summary of CLM5.0 updates relative to CLM4.5 ----------------------------------------------------- We describe external inputs to the nitrogen cycle in CLM5.0.  Much of the following information appeared in the CLM4.5 Technical Note (:ref:`Oleson et al. 2013 `) as well as :ref:`Koven et al. (2013) `. diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 04d0a6a83c..626ac7ea56 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -1278,8 +1278,7 @@ adjusted for canopy density following :ref:`Zeng and Wang (2007) ` d = z_{top} R_{d} V -where :math:`z_{top}` is canopy top height (m) -(:numref:`Table Prescribed plant functional type heights`), +where :math:`z_{top}` is canopy top height (m), :math:`R_{z0m}` and :math:`R_{d}` are the ratio of momentum roughness length and displacement height to canopy top height, respectively (:numref:`Table Plant functional type aerodynamic parameters`), and :math:`z_{0m,\, g}` diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 4d0883ac14..db3498f4e5 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -626,6 +626,7 @@ studies. Water Resour. Res. 35:583-587. .. _Gravenetal2017: Graven, H., C. E. Allison, D. M. Etheridge, S. Hammer, R. F. Keeling, I. Levin, H. A. J. Meijer, M. Rubino, P. P. Tans, C. M. Trudinger, B. H. Vaughn and J. W. C. White (2017) Compiled records of carbon isotopes in atmospheric CO2 for historical simulations in CMIP6, Geoscientific Model Development, in review. doi: 10.5194/gmd-2017-166. + .. _GrenfellWarren1999: Grenfell, T.C., and Warren, S.G. 1999. Representation of a nonspherical @@ -1745,6 +1746,12 @@ Siebert, S., Döll, P., Hoogeveen, J., Faures, J.M., Frenken, K., Feick, S., 2005. Development and validation of the global map of irrigation areas. Hydrol Earth Syst Sc 9:535–547 +.. _Simardetal2011: + +Simard, M., Pinto, N., Fisher, J.B., and Baccini, A. (2011), Mapping +forest canopy height globally with spaceborne lidar. +J. Geophys. Res., 116, G04021, doi:10.1029/2011JG001708. + .. _Simpsonetal1983: Simpson, R.J., Lambers, H., and Dalling, M.J. 1983. Nitrogen diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 2548b228fa..386cf77bd2 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -919,8 +919,9 @@ Snow aging is represented as evolution of the ice effective grain size (:math:`r_{e}`). Previous studies have shown that use of spheres which conserve the surface area-to-volume ratio (or specific surface area) of ice media composed of more complex shapes produces relatively -small errors in simulated hemispheric fluxes (e.g., :ref:`Grenfell and Warren -1999 `). Effective radius is the surface area-weighted mean +small errors in simulated hemispheric fluxes +(e.g., :ref:`Grenfell and Warren 1999 `). +Effective radius is the surface area-weighted mean radius of an ensemble of spherical particles and is directly related to specific surface area (*SSA*) as :math:`r_{e} ={3\mathord{\left/ {\vphantom {3 \left(\rho _{ice} SSA\right)}} \right. \kern-\nulldelimiterspace} \left(\rho _{ice} SSA\right)}` , From d3f1812297569444adb72ba1fb743f7c75ba18ba Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 20 Dec 2017 10:54:39 -0700 Subject: [PATCH 0119/1973] fix rsoil / canmx --- .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 2 +- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 46 ++++++++++++------- .../CLM50_Tech_Note_Introduction.rst | 2 +- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 04d0a6a83c..b7ee11cdc9 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -1252,7 +1252,7 @@ and to update the soil surface fluxes (section .. math:: :label: 5.124 - \frac{\partial E_{g} }{\partial T_{g} } =\frac{\beta _{soi} \rho _{atm} }{r'_{aw} +r_{litter} } \frac{c_{a}^{w} +c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } \frac{dq_{g} }{dT_{g} } . + \frac{\partial E_{g} }{\partial T_{g} } = \rho _{atm} }{r'_{aw} +r_{soil} } \frac{c_{a}^{w} +c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } \frac{dq_{g} }{dT_{g} } . The partial derivatives :math:`\frac{\partial r'_{ah} }{\partial T_{g} }` and diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 8b9a9df144..a6c9936245 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -47,41 +47,54 @@ al. 2008) ` and :math:`\Delta t` is the time step (s). Canopy Water ---------------- -Liquid precipitation is either intercepted by the canopy, falls directly to the -snow/soil surface (throughfall), or drips off the vegetation (canopy -drip). Solid precipitation is treated similiar, with the addition of unloading of previously intercepted snow. +Liquid precipitation is either intercepted by the canopy, falls +directly to the snow/soil surface (throughfall), or drips off the +vegetation (canopy drip). Solid precipitation is treated similarly, +with the addition of unloading of previously intercepted snow. Interception by vegetation is divided between liquid and solid phases -:math:`q_{intr,\,liq}` and :math:`q_{intr,\,ice}` (kg m\ :sup:`-2` s\ :sup:`-1`) +:math:`q_{intr,\,liq}` and :math:`q_{intr,\,ice}` +(kg m\ :sup:`-2` s\ :sup:`-1`) .. math:: :label: 7.2 - q_{intr,\,liq} =\alpha_{liq} q_{rain} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} + q_{intr,\,liq} = f_{pi,\,liq} q_{rain} .. math:: :label: 7.3 - q_{intr,\,ice} =\alpha_{sno} q_{sno} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} + q_{intr,\,ice} = f_{pi,\,ice} q_{sno} - -where :math:`L` and :math:`S` are the exposed leaf and stem area index, +where :math:`f_{pi,\,liq}` and :math:`f_{pi,\,ice}` are the +fractions of intercepted precipitation of rain and snow, +respectively + +.. math:: + :label: 7.2b + + f_{pi,\,liq} = \alpha_{liq} \ tanh \left(L+S\right) + +.. math:: + :label: 7.3b + + f_{pi,\,ice} =\alpha_{sno} \ \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} \ , +and :math:`L` and :math:`S` are the exposed leaf and stem area index, respectively (section :numref:`Phenology and vegetation burial by snow`), and the :math:`\alpha`\'s scale the fractional area of a leaf that collects water -(:ref:`Lawrence et al. 2007 `). Values of -:math:`\alpha_{liq} = 0.25` and :math:`\alpha_{sno} = 1` reflect the increased -capacity one side of a leaf has for snow than liquid water. +(:ref:`Lawrence et al. 2007 `). Default values of +:math:`\alpha_{liq}` and :math:`\alpha_{sno}` are set to 1. Throughfall (kg m\ :sup:`-2` s\ :sup:`-1`) is also divided into liquid and solid phases, reaching the ground (soil or snow surface) as .. math:: :label: 7.4 - q_{thru,\, liq} =q_{rain} \left[1-\alpha_{liq} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right] + q_{thru,\, liq} = q_{rain} \left(1 - f_{pi,\,liq}\right) .. math:: :label: 7.5 - q_{thru,\, ice} =q_{sno} \left[1-\alpha_{sno} \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\}\right]. + q_{thru,\, ice} = q_{sno} \left(1 - f_{pi,\,ice}\right) Similarly, the liquid and solid canopy drip fluxes are @@ -126,8 +139,9 @@ They are defined by W_{can,\,sno}^{max } =p_{ice}\left(L+S\right). -The maximum storage of liquid water is :math:`p_{liq}=0.1` kg m\ :sup:`-2` (:ref:`Dickinson et al. -1993 `), and that of snow is :math:`p_{sno}=6`, consistent with reported +The maximum storage of liquid water is :math:`p_{liq}=0.1` kg m\ :sup:`-2` +(:ref:`Dickinson et al. 1993 `), and that of snow +is :math:`p_{sno}=6` kg m\ :sup:`-2`, consistent with reported field measurements (:ref:`Pomeroy et al. 1998 `). Canopy snow unloading from wind speed :math:`u` and above-freezing temperatures are modeled from linear @@ -1143,7 +1157,7 @@ exist within the soil column. Sub-surface runoff is .. math:: :label: 7.168 - q_{subsurface} = \Theta_{ice} K_{baseflow} tan \left( \beta \right) + q_{drai} = \Theta_{ice} K_{baseflow} tan \left( \beta \right) \Delta z_{sat}^{N_{baseflow}} \ , where :math:`K_{baseflow}` is a calibration parameter, :math:`\beta` is the diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index f71aed9712..794a829005 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -592,7 +592,7 @@ processes simulated include (:numref:`Figure Land processes`): #. Stomatal physiology, photosythetic capacity, and photosynthesis (Chapters :numref:`rst_Stomatal Resistance and Photosynthesis` and :numref:`rst_Photosynthetic Capacity`) -#. Plant hydraulics (Chapter :numref: `rst_Plant Hydraulics`) +#. Plant hydraulics (Chapter :numref:`rst_Plant Hydraulics`) #. Lake temperatures and fluxes (Chapter :numref:`rst_Lake Model`) From 6204b1aa0f9ef96c6e3add59e97f05256cc6008a Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 20 Dec 2017 10:57:30 -0700 Subject: [PATCH 0120/1973] fix rsoil / canmx --- .../tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst | 3 +-- doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst | 4 ++-- doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 4db8909b42..f3613a78a6 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -137,7 +137,7 @@ favorable growth environments (Allen et al., 2005; Vanninen and Makela, .. table:: Allocation and target carbon\:nitrogen ratio parameters +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - | Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`Target CN_{leaf}` | :math:`Target CN_{fr}` | :math:`Target CN_{lw}` | :math:`Target CN_{dw}` | + | Plant functional type | :math:`a_{1}` | :math:`a_{2}` | :math:`a_{3}` | :math:`a_{4}` | :math:`Target CN_{leaf}` | :math:`Target CN_{fr}` | :math:`Target CN_{lw}` | :math:`Target CN_{dw}` | +==================================+=======================+=======================+=======================+=======================+===========================+=========================+=========================+=========================+ | NET Temperate | 1 | 0.3 | -1 | 0.1 | 35 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ @@ -160,7 +160,6 @@ favorable growth environments (Allen et al., 2005; Vanninen and Makela, | BDS temperate | 1 | 0.3 | 0.2 | 0.5 | 25 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ | BDS boreal | 1 | 0.3 | 0.2 | 0.1 | 25 | 42 | 50 | 500 | - +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ | C\ :sub:`3` arctic grass | 1 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ | C\ :sub:`3` grass | 2 | 0 | 0 | 0 | 25 | 42 | 0 | 0 | diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index b7ee11cdc9..95214580b4 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -1247,12 +1247,12 @@ and to update the soil surface fluxes (section .. math:: :label: 5.123 - \frac{\partial H_{g} }{\partial T_{g} } =\frac{\rho _{atm} C_{p} }{r'_{ah} } \frac{c_{a}^{h} +c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } + \frac{\partial H_{g} }{\partial T_{g} } = \frac{\rho _{atm} C_{p} }{r'_{ah} } \frac{c_{a}^{h} +c_{v}^{h} }{c_{a}^{h} +c_{v}^{h} +c_{g}^{h} } .. math:: :label: 5.124 - \frac{\partial E_{g} }{\partial T_{g} } = \rho _{atm} }{r'_{aw} +r_{soil} } \frac{c_{a}^{w} +c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } \frac{dq_{g} }{dT_{g} } . + \frac{\partial E_{g} }{\partial T_{g} } = \frac{\rho _{atm} }{r'_{aw} +r_{soil} } \frac{c_{a}^{w} +c_{v}^{w} }{c_{a}^{w} +c_{v}^{w} +c_{g}^{w} } \frac{dq_{g} }{dT_{g} } . The partial derivatives :math:`\frac{\partial r'_{ah} }{\partial T_{g} }` and diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index a6c9936245..2ca572ee9e 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -58,12 +58,12 @@ Interception by vegetation is divided between liquid and solid phases .. math:: :label: 7.2 - q_{intr,\,liq} = f_{pi,\,liq} q_{rain} + q_{intr,\,liq} = f_{pi,\,liq} \ q_{rain} .. math:: :label: 7.3 - q_{intr,\,ice} = f_{pi,\,ice} q_{sno} + q_{intr,\,ice} = f_{pi,\,ice} \ q_{sno} where :math:`f_{pi,\,liq}` and :math:`f_{pi,\,ice}` are the fractions of intercepted precipitation of rain and snow, From e7cc6e3c7030df7989cc9f6e74b199893e5cd760 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 20 Dec 2017 11:02:59 -0700 Subject: [PATCH 0121/1973] fix rsoil / canmx --- .../CLM50_Tech_Note_CN_Allocation.rst | 89 +++++++++++++------ .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 3 +- 2 files changed, 63 insertions(+), 29 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 8bc3991dea..f3613a78a6 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -3,26 +3,29 @@ Carbon and Nitrogen Allocation ============================== -Summary of CLM5.0 updates relative to the CLM4.5 ------------------------------------------------------ -- CLM5 now defaults to a static allocation to woody biomass rather than the dynamic allocation term used in CLM4.5. The dynamic allocation is stil lkept as an option, for details, see the CLM4.5 Tech Note. - -- CLM5 now includes flexible C:N ratios of all plant tissues, which allows allocation of carbon to occur separately from allocation of nitrogen, thus removing the requirement to downregulate photosynthesis based on the instantaneous stoichiometric needs of allocation. - -- CLM5 accounts for the carbon expenditure on nitrogen aquisition, as determined by the FUN model, and the N uptake it determined by the environmental cost of Nitrogen from fixation, active uptake and retranslocation. - - Introduction ----------------- -The carbon and nitrogen allocation routines in CLM determine the fate of newly assimilated carbon, and absorbed nitrogen. The environmental cost of nitrogen estimated by the FUN model modulates the C:N ratios of the plant tissue pools around a target ratio, and absorbed nitrogen is allocated in proportion to the demand, as estimated by the ideal requirements of these target C:N ratios. +The carbon and nitrogen allocation routines in CLM determine the fate of +newly assimilated carbon, coming from the calculation of photosynthesis, +and available mineral nitrogen, coming from plant uptake of mineral +nitrogen in the soil or being drawn out of plant reserves. A significant change to CLM5 relative to prior versions is that allocation of carbon and nitrogen proceed independently rather than in a sequential manner. -Carbon Allocation to Cover Prior-Timestep Maintenance Respiration Costs ("Excess" Respiration) ----------------------------------------------------------------------------------------------- +Carbon Allocation for Maintenance Respiration Costs +-------------------------------------------------------- -After respiration of live tissues (Chapter :numref:`rst_Plant Respiration`), the next priority of the carbon allocation cascade is to replenish the plant carbon deficit pool that balances maintenance respiration that occurs during times when maintenance respiration exceeds photosynthesis (e.g. at night, during winter for perennial vegetation, or during periods of drought stress) (Sprugel et al., 1995). +Allocation of available carbon on each time step is prioritized, with +first priority given to the demand for carbon to support maintenance +respiration of live tissues (section 13.7). Second priority is to +replenish the internal plant carbon pool that supports maintenance +respiration during times when maintenance respiration exceeds +photosynthesis (e.g. at night, during winter for perennial vegetation, +or during periods of drought stress) (Sprugel et al., 1995). Third +priority is to support growth of new tissues, including allocation to +storage pools from which new growth will be displayed in subsequent time +steps. The total maintenance respiration demand (:math:`CF_{mr}`, gC m\ :sup:`-2` s\ :sup:`-1`) is calculated as a function of @@ -89,19 +92,16 @@ Carbon and Nitrogen Stoichiometry of New Growth ---------------------------------------------------- After accounting for the carbon cost of maintenance respiration, the -remaining carbon flux from photosynthesis which is allocated either to new -growth or to nitrogen acquisition processes (Chapter :numref:`rst_FUN`), (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is +remaining carbon flux from photosynthesis which can be allocated to new +growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is .. math:: :label: 19.6 CF_{avail\_ alloc} =CF_{GPP} -CF_{GPP,mr} -CF_{GPP,xs} . - -The FUN model requires an estimate of the C:N requirements of the existing plant structure, given that different relative quantities of wood, root and leaf biomass will result in different necessary C:N ratios for expansion. - -These C and N allocation ratios are calculated for all of the plant -carbon and nitrogen state variables based on target C:N ratios for +Potential allocation to new growth is calculated for all of the plant +carbon and nitrogen state variables based on specified C:N ratios for each tissue type and allometric parameters that relate allocation between various tissue types. The allometric parameters are defined as follows: @@ -116,6 +116,21 @@ Parameters :math:`a_{1}`, :math:`a_{2}`, and :math:`a_{4}` are defined as consta constant for all PFTs, based on construction costs for a range of woody and non-woody tissues (Larcher, 1995). +The model includes a dynamic allocation scheme for woody vegetation +(parameter :math:`a_{3}` = -1, :numref:`Table Allocation and CN ratio parameters`), in which case the +ratio for carbon allocation between new stem and new leaf increases with +increasing net primary production (NPP), as + +.. math:: + :label: 19.8 + + a_{3} =\frac{2.7}{1+e^{-0.004NPP_{ann} -300} } -0.4 + +where :math:`NPP_{ann}` is the annual sum of NPP from the previous +year. This mechanism has the effect of increasing woody allocation in +favorable growth environments (Allen et al., 2005; Vanninen and Makela, +2005) and during the phase of stand growth prior to canopy closure +(Axelsson and Axelsson, 1986). .. _Table Allocation and CN ratio parameters: @@ -183,14 +198,17 @@ follows: where all C:N parameters are defined as constants for a given PFT (:numref:`Table Allocation and CN ratio parameters`). - -The target C:N stoichiometry for new growth allocation can be calculated as +Given values for the parameters in and , total carbon and nitrogen +allocation to new growth ( :math:`CF_{alloc}`, gC +m\ :sup:`-2` s\ :sup:`-1`, and :math:`NF_{alloc}`, gN +m\ :sup:`-2` s\ :sup:`-1`, respectively) can be expressed as +functions of new leaf carbon allocation (:math:`CF_{GPP,leaf}`, gC +m\ :sup:`-2` s\ :sup:`-1`): .. math:: - :label: 19.13 - - CN_{plant\_ target} =\frac{N_{allom} }{C_{allom} } . + :label: 19.10 + \begin{array}{l} {CF_{alloc} =CF_{GPP,leaf} {\kern 1pt} C_{allom} } \\ {NF_{alloc} =CF_{GPP,leaf} {\kern 1pt} N_{allom} } \end{array} where @@ -204,7 +222,16 @@ where N_{allom} =\left\{\begin{array}{l} {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } +\frac{a_{3} a_{4} \left(1+a_{2} \right)}{CN_{lw} } +} \\ {\qquad \frac{a_{3} \left(1-a_{4} \right)\left(1+a_{2} \right)}{CN_{dw} } \qquad {\rm for\; woody\; PFT}} \\ {\frac{1}{CN_{leaf} } +\frac{a_{1} }{CN_{fr} } \qquad \qquad \qquad {\rm for\; non-woody\; PFT.}} \end{array}\right. +Since the C:N stoichiometry for new growth allocation is defined, from +Eq. , as :math:`C_{allom}`/ :math:`N_{allom}`, the total carbon available for new growth allocation +(:math:`CF_{avail\_alloc}`) can be used to calculate the total +plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, +gN m\ :sup:`-2` s\ :sup:`-1`) as: + +.. math:: + :label: 19.13 + NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . Carbon Allocation to New Growth ----------------------------------------- @@ -285,8 +312,14 @@ tissue types are given as: Nitrogen allocation ----------------------------------------- -The total flux of nitrogen to be allocated is given by the FUN model (Chapter :numref:`rst_FUN`). This gives a total N to be allocated within a given timestep, :math:`N_{uptake}`. This is distribution in proportion to the demand for N from different tissues, calculated as: +The total flux of nitrogen to be allocated is given by the FUN model (Chapter :numref:`rst_FUN`). This gives a total N to be allocated within a given timestep, :math:`N_{supply}`. The total N allocated for a given tissue :math:`i` is the minimum between the supply and the demand: + +.. math:: + :label: 19.26 + + NF_{alloc,i} = min \left( NF_{demand, i}, NF_{supply, i} \right) +The demand for each tissue, calculated for the tissue to remain on stoichiometry during growth, is: .. math:: :label: 19.27 @@ -348,14 +381,14 @@ The total flux of nitrogen to be allocated is given by the FUN model (Chapter :n NF_{demand,deadcroot\_ stor} \_ =\frac{CF_{alloc,leaf} a_{2} a_{3} \left(1-a_{4} \right)}{CN_{dw} } \left(1-f_{cur} \right). -After each pool's demand is calculated, the total plant N demand is then the sum of each individual pool :math:`i` corresponding to each tissue: +After each pool's demand is calculated, the total plant N demand is then the sum of each individual pool :math: `i` corresponding to each tissue: .. math:: :label: 19.39 NF_{demand,tot} = \sum _{i=tissues} NF_{demand,i} -and the total supply for each tissue :math:`i` is the product of the fractional demand and the total available N, calculated as the term :math:`N_{uptake}` equal to the sum of the eight N uptake streams described in the FUN model (Chapter :numref:`rst_FUN`). +and the total supply for each tissue :math: `i` is the product of the fractional demand and the total available N, calculated as the term :math: `N_{uptake}` equal to the sum of the eight N uptake streams described in the FUN model (Chapter :numref:`rst_FUN`). .. math:: :label: 19.40 diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 9eb2b19ba2..95214580b4 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -1278,7 +1278,8 @@ adjusted for canopy density following :ref:`Zeng and Wang (2007) ` d = z_{top} R_{d} V -where :math:`z_{top}` is canopy top height (m), +where :math:`z_{top}` is canopy top height (m) +(:numref:`Table Prescribed plant functional type heights`), :math:`R_{z0m}` and :math:`R_{d}` are the ratio of momentum roughness length and displacement height to canopy top height, respectively (:numref:`Table Plant functional type aerodynamic parameters`), and :math:`z_{0m,\, g}` From e4abfbc48fd3cf30c055fbc536d0221811406a61 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 20 Dec 2017 11:37:10 -0700 Subject: [PATCH 0122/1973] Update html --- .../tech_note/Introduction/CLM50_Tech_Note_Introduction.rst | 2 -- doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 2c11d56ba5..723e8bf032 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -83,8 +83,6 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Plant functional types` Plant functional types -- :numref:`Table Prescribed plant functional type heights` Prescribed plant functional type heights - - :numref:`Table Soil layer structure` Soil layer structure - :numref:`Table Atmospheric input to land model` Atmospheric input to land model diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index 4a6192aacb..e24ac723ea 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -120,7 +120,7 @@ resolution. Schematic of urban and atmospheric model coupling. The urban model is forced by the atmospheric model wind (:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar (:math:`S_{atm} \, \downarrow` ) and longwave (:math:`L_{atm} \, \downarrow` ) radiation at reference height :math:`z'_{atm}` (section :numref:`Atmospheric Coupling`). Fluxes from the urban landunit to the atmosphere are turbulent sensible (:math:`H`) and latent heat (:math:`\lambda E`), momentum (:math:`\tau` ), albedo (:math:`I\uparrow` ), emitted longwave (:math:`L\uparrow` ), and absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature (:math:`T_{ac}` ), specific humidity (:math:`q_{ac}` ), and wind speed (:math:`u_{c}` ) within the urban canopy layer are diagnosed by the urban model. :math:`H` is the average building height. -The urban model that was first lreleased as a component of CLM4.0 is separately +The urban model that was first released as a component of CLM4.0 is separately described in the urban technical note (:ref:`Oleson et al. (2010b) `). The main changes in the urban model from CLM4.0 to CLM4.5 were 1) an expansion of the single urban landunit to up to three landunits per From 841b2d947983bb1d3b89e62477c8a71a93ebc7b2 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 3 Jan 2018 17:18:51 -0700 Subject: [PATCH 0123/1973] Updates to Introduction and Chapter 2 --- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 45 ++++++------------- .../CLM50_Tech_Note_Introduction.rst | 6 ++- 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 6d36046e41..8a6d9890b0 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -31,9 +31,9 @@ The second subgrid level, the column, is intended to capture potential variability in the soil and snow state variables within a single land unit. For example, the vegetated land unit could contain several columns with independently evolving vertical profiles of soil water and -temperature. Similarly, the managed vegetation land unit could be -divided into two columns, irrigated and non-irrigated. The snow/soil -column is represented by fifteen layers for soil and up to five layers +temperature. Similarly, the managed vegetation land unit can be +divided into two columns, irrigated and non-irrigated. The default snow/soil +column is represented by 25 layers for ground (with up to 20 of these layers classified as soil layers and the remaining layers classified as bedrock layers) and up to 10 layers for snow, depending on snow depth. The central characteristic of the column subgrid level is that this is where the state variables for water and energy in the soil and snow are defined, as well as the fluxes of @@ -52,23 +52,19 @@ impervious canyon floor) (Oleson et al. 2010b). .. Figure:: image1.png - Configuration of the CLM subgrid hierarchy. + Configuration of the CLM subgrid hierarchy. Box in upper right shows hypothetical subgrid distribution for a single grid cell. Note that the Crop land unit is only used when the model is run with the crop model active. Abbreviations: TBD – Tall Building District; HD – High Density; MD – Medium Density, G – Glacier, L – Lake, U – Urban, C – Crop, V – Vegetated, PFT – Plant Functional Type, Irr – Irrigated, UIrr – Unirrigated. Red arrows indicate allowed land unit transitions. Purple arrows indicate allowed patch-level transitions. -Note that the Crop land unit is only used when the model is run with the -crop model active. Abbreviations: TBD – Tall Building District; HD – -High Density; MD – Medium Density, G – Glacier, L – Lake, U – Urban, C – -Crop, V – Vegetated, PFT – Plant Functional Type, I – Irrigated, U – -Unirrigated . - -The third subgrid level is referred to as the PFT level, but it also -includes the treatment for bare ground. It is intended to capture the +The third subgrid level is referred to as the patch level. Patches can be PFTs or bare ground on the vegetated land unit +and crop functional types (CFTs) on the crop land unit. +The patch level is intended to capture the biogeophysical and biogeochemical differences between broad categories of plants in terms of their functional characteristics. On the vegetated land unit, up to 16 possible PFTs that differ in physiology and structure may coexist on a single column. All fluxes to and from the surface are defined at the PFT level, as are the vegetation state variables (e.g. vegetation temperature and canopy water storage). On the -crop land unit, several different crop types can be represented on each +crop land unit, typically, different crop types can be represented on each + crop land unit column (see Chapter :numref:`rst_Crops and Irrigation` for details). In addition to state and flux variable data structures for conserved @@ -156,30 +152,17 @@ evolve with time if the model is run in transient landcover mode +--------------------------------------------------------------+-------------------+ | C\ :sub:`4` grass | - | +--------------------------------------------------------------+-------------------+ - | C\ :sub:`3` Unmanaged Rainfed Crop | Crop R | - +--------------------------------------------------------------+-------------------+ - | :sup:`1`\ C\ :sub:`3` Unmanaged Irrigated Crop | Crop I | - +--------------------------------------------------------------+-------------------+ - | :sup:`2`\ Rainfed Corn | Corn R | - +--------------------------------------------------------------+-------------------+ - | :sup:`2`\ Irrigated Corn | Corn I | - +--------------------------------------------------------------+-------------------+ - | :sup:`2`\ Rainfed Temperate Cereals | Temp Cereal R | - +--------------------------------------------------------------+-------------------+ - | :sup:`2`\ Irrigated Temperate Cereals | Temp Cereal I | - +--------------------------------------------------------------+-------------------+ - | :sup:`3`\ Rainfed Winter Cereals | Winter Cereal R | + | C\ :sub:`3` Unmanaged Rainfed Crop | UCrop UIrr | +--------------------------------------------------------------+-------------------+ - | :sup:`3`\ Irrigated Winter Cereals | Winter Cereal I | + | :sup:`1`\ C\ :sub:`3` Unmanaged Irrigated Crop | UCrop Irr | +--------------------------------------------------------------+-------------------+ - | :sup:`2`\ Rainfed Soybean | Soybean R | + | :sup:`2`\ Managed Rainfed Unirrigated Crops | Crop UIrr | +--------------------------------------------------------------+-------------------+ - | :sup:`2`\ Irrigated Soybean | Soybean I | + | :sup:`2`\ Managed Irrigated Crops | Crop Irr | +--------------------------------------------------------------+-------------------+ :sup:`1`\ Only used if irrigation is active (Chapter :numref:`rst_Crops and Irrigation`). -:sup:`2`\ Only used if crop model is active (Chapter :numref:`rst_Crops and Irrigation`). -:sup:`3`\ Reserved for future implementations of crop model (Chapter :numref:`rst_Crops and Irrigation`). +:sup:`2`\ Only used if crop model is active (see Chapter :numref:`rst_Crops and Irrigation` for list of represented crops). .. _Vegetation Structure: diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 723e8bf032..3892e7729a 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -528,7 +528,7 @@ Nitrogen for Assimilation (LUNA, :ref:`Xu et al., 2012` and :ref:`Al photosynthetic capacity based on optimization of the use of leaf nitrogen under different environmental conditions such that light capture, carboxylation, and respiration are co-limiting. -CLM5 applies a fixed allocation scheme for woody vegetation. The decision to use a fixed allocation scheme in CLM5, rather than a dynamic allocation scheme based on NPP as was used in CLM4 and CLM4.5, was driven by the fact that observations indicate that biomass saturates with increasing productivity, in contrast to the behavior in CLM4 and CLM4.5 where biomass continuously increases with increasing productivity (:ref:`Negron-Juarez et al., 2015`). Soil carbon decomposition processes are unchanged in CLM5, but a new metric for apparent soil carbon turnover times (:ref:`Koven et al., 2017 `) suggested parameter changes that produce a weak intrinsic depth limitation on soil carbon turnover rates (rather than the strong depth limitaiton in CLM4.5) and that the thresholds for soil moisture limitation on soil carbon turnover rates in dry soils should be set at a wetter soil moisture level than that used in CLM4.5. +CLM5 applies a fixed allocation scheme for woody vegetation. The decision to use a fixed allocation scheme in CLM5, rather than a dynamic NPP-based allocation scheme, as was used in CLM4 and CLM4.5, was driven by the fact that observations indicate that biomass saturates with increasing productivity, in contrast to the behavior in CLM4 and CLM4.5 where biomass continuously increases with increasing productivity (:ref:`Negron-Juarez et al., 2015`). Soil carbon decomposition processes are unchanged in CLM5, but a new metric for apparent soil carbon turnover times (:ref:`Koven et al., 2017 `) suggested parameter changes that produce a weak intrinsic depth limitation on soil carbon turnover rates (rather than the strong depth limitaiton in CLM4.5) and that the thresholds for soil moisture limitation on soil carbon turnover rates in dry soils should be set at a wetter soil moisture level than that used in CLM4.5. Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016)`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. Fertilization rates and irrigation equipped area updated annually based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that @@ -540,7 +540,9 @@ is incorporated. The fire model is the same as utilized in CLM4.5 except that a modified scheme is used to estimate the dependence of fire occurrence and spread on fuel wetness for non-peat fires outside cropland and tropical closed forests :ref:`(Li and Lawrence, 2017)` and the dependence of agricultural fires on fuel load is removed. -Included with the release of CLM5.0 is a functionally supported version of the Functionally-Assembled Terrestrial Ecosystem Simulator (FATES, :ref:`Fisher et al., 2015)`. A major motivation of this development is to allow the prediction of biome boundaries directly from plant physiological traits via their competitive interactions. The version of CLM5-FATES that is supported in this release is described here??? Short blurb on what FATES can do??? Note that the classical dynamic global vegetation model (DGVM) that has been available within CLM4 and CLM4.5 remains available, though it is largely untested. The technical description of the CLM-DGVM can be found within the CLM4.5 Technical Description (:ref:`Oleson et al. 2013)`. +Included with the release of CLM5.0 is a functionally supported version of the Functionally-Assembled Terrestrial Ecosystem Simulator (FATES, :ref:`Fisher et al., 2015)`. A major motivation of FATES is to allow the prediction of biome boundaries directly from plant physiological traits via their competitive interactions. FATES is a cohort model of vegetation competition and co-existence, allowing a representation of the biosphere which accounts for the division of the land surface into successional stages, and for competition for light between height structured cohorts of representative trees of various plant functional types. FATES is not active by default in CLM5.0. + +Note that the classical dynamic global vegetation model (CLM-DGVM) that has been available within CLM4 and CLM4.5 remains available, though it is largely untested. The technical description of the CLM-DGVM can be found within the CLM4.5 Technical Description (:ref:`Oleson et al. 2013)`. During the course of the development of CLM5.0, it became clear that the increasing complexity of the model combined with the increasing number and range of model development projects required updates to the underlying CLM infrastructure. Many such software improvements From 67b529bda1d4eba92769b3f0700cf4b3bfe28559 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Thu, 11 Jan 2018 16:37:12 -0700 Subject: [PATCH 0124/1973] Canopy top and bottom heights --- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 32 ++++++++++++++++++- .../CLM50_Tech_Note_Introduction.rst | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 8a6d9890b0..6463e9d255 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -174,11 +174,41 @@ Vegetation structure is defined by leaf and stem area indices Separate leaf and stem area indices and canopy heights are prescribed or calculated for each PFT. Daily leaf and stem area indices are obtained from griddeddatasets of monthly values (section -:numref:`Surface Data`). Canopy top and bottom heights are from ICESat (:ref:`Simard et al. (2011) `. +:numref:`Surface Data`). Canopy top and bottom heights for trees are from ICESat (:ref:`Simard et al. (2011) `). +Canopy top and bottom heights for short vegetation are obtained from gridded datasets but are invariant in space +and time and were obtained from PFT-specific values (:ref:`Bonan et al. (2002a) `) (:numref:`Table Plant functional type canopy top and bottom heights`). When the biogeochemistry model is active, vegetation state (LAI, SAI, canopy top and bottom heights) are calculated prognostically (see Chapter :numref:`rst_Vegetation Phenology and Turnover`). +.. _Table Plant functional type canopy top and bottom heights: + +.. table:: Plant functional type canopy top and bottom heights + + +--------------------------------------------------------------+-------------------+-------------------+ + | Plant functional type | :math:`z_{top}` | :math:`z_{bot}` | + +==============================================================+===================+===================+ + | BES Temperate | 0.5 | 0.1 | + +--------------------------------------------------------------+-------------------+-------------------+ + | BDS Temperate | 0.5 | 0.1 | + +--------------------------------------------------------------+-------------------+-------------------+ + | BDS Boreal | 0.5 | 0.1 | + +--------------------------------------------------------------+-------------------+-------------------+ + | C\ :sub:`3` arctic grass | 0.5 | 0.01 | + +--------------------------------------------------------------+-------------------+-------------------+ + | C\ :sub:`3` grass | 0.5 | 0.01 | + +--------------------------------------------------------------+-------------------+-------------------+ + | C\ :sub:`4` grass | 0.5 | 0.01 | + +--------------------------------------------------------------+-------------------+-------------------+ + | UCrop UIrr | 0.5 | 0.01 | + +--------------------------------------------------------------+-------------------+-------------------+ + | UCrop Irr | 0.5 | 0.01 | + +--------------------------------------------------------------+-------------------+-------------------+ + | Crop UIrr | 0.5 | 0.01 | + +--------------------------------------------------------------+-------------------+-------------------+ + | Crop Irr | 0.5 | 0.01 | + +--------------------------------------------------------------+-------------------+-------------------+ + .. _Phenology and vegetation burial by snow: Phenology and vegetation burial by snow diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 3892e7729a..3024441363 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -83,6 +83,8 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Plant functional types` Plant functional types +- :numref:`Table Plant functional type canopy top and bottom heights` Plant functional type canopy top and bottom heights + - :numref:`Table Soil layer structure` Soil layer structure - :numref:`Table Atmospheric input to land model` Atmospheric input to land model From a5ae98e2f9cd0254db5241a30e8617817cbdf5ff Mon Sep 17 00:00:00 2001 From: mvertens Date: Tue, 16 Jan 2018 11:27:54 -0700 Subject: [PATCH 0125/1973] changes for getting a pdf file to work correctly --- doc/source/conf.py | 9 +- doc/source/index.rst | 12 +- .../CLM50_Tech_Note_CN_Allocation.rst | 35 +- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 1 - .../tech_note/Fire/CLM50_Tech_Note_Fire.rst | 2 +- .../CLM50_Tech_Note_Introduction.rst | 164 ++- .../References/CLM50_Tech_Note_References.rst | 941 ++++++++++++++++-- doc/source/tech_note/index.rst | 1 - doc/source/users_guide/index.rst | 1 - .../users_guide/overview/introduction.rst | 129 +-- 10 files changed, 1041 insertions(+), 254 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 2d69cb46bd..a866c7f3fb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -120,7 +120,9 @@ # Additional stuff for the LaTeX preamble. # - # 'preamble': '', + 'preamble': '\\usepackage{hyperref}', + + 'fncychap': '\\usepackage[Conny]{fncychap}', # Latex figure (float) alignment # @@ -130,10 +132,7 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'clmdoc.tex', u'clmdoc Documentation', - u'Erik Kluzek, Bill Sacks, Ben Andre', 'manual'), -] +latex_documents = [(master_doc, 'clmdoc.tex', u'CLM5 Documentation', '', 'manual'),] # -- Options for manual page output --------------------------------------- diff --git a/doc/source/index.rst b/doc/source/index.rst index cc7ec3c27c..f7f35abeda 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -6,16 +6,12 @@ Welcome to the CLM documentation ================================== -This document has one major sections. - -The :ref:`CLM user's guide ` is a basic guide in utilizing CLM. - -Table of contents ------------------ +This document has two major sections. .. toctree:: - :maxdepth: 1 - + :maxdepth: 2 + :numbered: + users_guide/index.rst tech_note/index.rst diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index f3613a78a6..25b2215e81 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -38,17 +38,17 @@ photosynthesis ( :math:`CF_{xs,mr}`, gC m\ :sup:`-2` s\ :sup:`-1`): .. math:: - :label: 19.1 + :label: 19.1 CF_{mr} =CF_{GPP,mr} +CF_{xs,mr} .. math:: - :label: 19.2 + :label: 19.2 CF_{GPP,mr} =\_ \left\{\begin{array}{l} {CF_{mr} \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPP} } \\ {CF_{GPP} \qquad {\rm for\; }CF_{mr} >CF_{GPP} } \end{array}\right. .. math:: - :label: 19.3 + :label: 19.3 CF_{xs,mr} =\_ \left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CF_{mr} \le CF_{GPP} } \\ {CF_{mr} -CF_{GPP} \qquad {\rm for\; }CF_{mr} >CF_{GPP} } \end{array}\right. @@ -72,12 +72,12 @@ flux to :math:`CS_{xs}` (:math:`CF_{GPP,xs}`, gC m\ :sup:`-2` s\ :sup:`-1`) is given as .. math:: - :label: 19.4 + :label: 19.4 CF_{GPP,xs,pot} =\left\{\begin{array}{l} {0\qquad \qquad \qquad {\rm for\; }CS_{xs} \ge 0} \\ {-CS_{xs} /(86400\tau _{xs} )\qquad {\rm for\; }CS_{xs} <0} \end{array}\right. .. math:: - :label: 19.5 + :label: 19.5 CF_{GPP,xs} =\left\{\begin{array}{l} {CF_{GPP,xs,pot} \qquad \qquad \qquad {\rm for\; }CF_{GPP,xs,pot} \le CF_{GPP} -CF_{GPP,mr} } \\ {\max (CF_{GPP} -CF_{GPP,mr} ,0)\qquad {\rm for\; }CF_{GPP,xs,pot} >CF_{GPP} -CF_{GPP,mr} } \end{array}\right. @@ -96,7 +96,7 @@ remaining carbon flux from photosynthesis which can be allocated to new growth (:math:`CF_{avail}`, gC m\ :sup:`-2` s\ :sup:`-1`) is .. math:: - :label: 19.6 + :label: 19.6 CF_{avail\_ alloc} =CF_{GPP} -CF_{GPP,mr} -CF_{GPP,xs} . @@ -122,7 +122,7 @@ ratio for carbon allocation between new stem and new leaf increases with increasing net primary production (NPP), as .. math:: - :label: 19.8 + :label: 19.8 a_{3} =\frac{2.7}{1+e^{-0.004NPP_{ann} -300} } -0.4 @@ -195,7 +195,7 @@ follows: \begin{array}{l} {CN_{leaf} =\_ {\rm \; C:N\; for\; leaf}} \\ {CN_{fr} =\_ {\rm \; C:N\; for\; fine\; root}} \\ {CN_{lw} =\_ {\rm \; C:N\; for\; live\; wood\; (in\; stem\; and\; coarse\; root)}} \\ {CN_{dw} =\_ {\rm \; C:N\; for\; dead\; wood\; (in\; stem\; and\; coarse\; root)}} \end{array} -where all C:N parameters are defined as constants for a given PFT +where all C:N parameters are defined as constants for a given PFT (:numref:`Table Allocation and CN ratio parameters`). Given values for the parameters in and , total carbon and nitrogen @@ -213,7 +213,7 @@ m\ :sup:`-2` s\ :sup:`-1`): where .. math:: - :label: 19.11 + :label: 19.11 \begin{array}{l} {C_{allom} =\left\{\begin{array}{l} {\left(1+g_{1} \right)\left(1+a_{1} +a_{3} \left(1+a_{2} \right)\right)\qquad {\rm for\; woody\; PFT}} \\ {1+g_{1} +a_{1} \left(1+g_{1} \right)\qquad \qquad {\rm for\; non-woody\; PFT}} \end{array}\right. } \\ {} \end{array} @@ -229,7 +229,7 @@ plant nitrogen demand for new growth ( :math:`NF_{plant\_demand}`, gN m\ :sup:`-2` s\ :sup:`-1`) as: .. math:: - :label: 19.13 + :label: 19.13 NF_{plant\_ demand} =CF_{avail\_ alloc} \frac{N_{allom} }{C_{allom} } . @@ -248,22 +248,22 @@ storage pools (where storage is indicated with *\_stor*) for the various tissue types are given as: .. math:: - :label: 19.14 + :label: 19.14 CF_{alloc,leaf} \_ =CF_{alloc,leaf\_ tot} f_{cur} .. math:: - :label: 19.15 + :label: 19.15 CF_{alloc,leaf\_ stor} \_ =CF_{alloc,leaf\_ tot} \left(1-f_{cur} \right) .. math:: - :label: 19.16 + :label: 19.16 CF_{alloc,froot} \_ =CF_{alloc,leaf\_ tot} a_{1} f_{cur} .. math:: - :label: 19.17 + :label: 19.17 CF_{alloc,froot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{1} \left(1-f_{cur} \right) @@ -308,7 +308,7 @@ tissue types are given as: CF_{alloc,deadcroot\_ stor} \_ =CF_{alloc,leaf\_ tot} a_{2} a_{3} \left(1-a_{4} \right)\left(1-f_{cur} \right). - + Nitrogen allocation ----------------------------------------- @@ -320,7 +320,7 @@ The total flux of nitrogen to be allocated is given by the FUN model (Chapter :n NF_{alloc,i} = min \left( NF_{demand, i}, NF_{supply, i} \right) The demand for each tissue, calculated for the tissue to remain on stoichiometry during growth, is: - + .. math:: :label: 19.27 @@ -394,6 +394,3 @@ and the total supply for each tissue :math: `i` is the product of the fractional :label: 19.40 NF_{alloc,i} = N_{uptake} NF_{demand,i} / NF_{demand,tot} - - - diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 45953fdca8..170d44eb7a 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -3515,7 +3515,6 @@ within the area affected by fire is a function of the ratio between .. raw:: latex - \printbibliography .. [1] This description covers algorithms in the ‘fuse_cohorts’ subroutine. diff --git a/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst b/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst index caef87c2b3..912bc7e378 100644 --- a/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst +++ b/doc/source/tech_note/Fire/CLM50_Tech_Note_Fire.rst @@ -192,7 +192,7 @@ Average spread area of a fire Fire fighting capacity depends on socioeconomic conditions and affects fire spread area. Due to a lack of observations, we consider the socioeconomic impact on the average burned area rather than separately -on fire spread rate and fire duration: +on fire spread rate and fire duration: .. math:: :label: 23.14 diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 3024441363..339ec3d05f 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -1,5 +1,3 @@ - - **July 2017** **Technical Description of version 5.0 of the Community Land Model @@ -15,7 +13,7 @@ ***Contributing Authors*** -**Ben Andre, Ali Ashehad, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, +**Ben Andre, Ali Ashehad, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Andrew Slater, Zachary M. Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Mariana Vertenstein, Francis Vitt, Xubin Zeng** @@ -35,21 +33,21 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Figure Land processes` Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). -- :numref:`Figure CLM subgrid hierarchy` Configuration of the CLM subgrid hierarchy. +- :numref:`Figure CLM subgrid hierarchy` Configuration of the CLM subgrid hierarchy. -- :numref:`Figure Radiation Schematic` Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and reflected by vegetation and ground. +- :numref:`Figure Radiation Schematic` Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and reflected by vegetation and ground. -- :numref:`Figure Schematic diagram of sensible heat fluxes` Schematic diagram of sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. +- :numref:`Figure Schematic diagram of sensible heat fluxes` Schematic diagram of sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. -- :numref:`Figure Schematic diagram of latent heat fluxes` Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. +- :numref:`Figure Schematic diagram of latent heat fluxes` Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. -- :numref:`Figure Soil Temperature Schematic`. Schematic diagram of numerical scheme used to solve for soil temperature. +- :numref:`Figure Soil Temperature Schematic`. Schematic diagram of numerical scheme used to solve for soil temperature. - :numref:`Figure Hydrologic processes` Hydrologic processes represented in CLM. -- :numref:`Figure Water flux schematic` Schematic diagram of numerical scheme used to solve for soil water fluxes. +- :numref:`Figure Water flux schematic` Schematic diagram of numerical scheme used to solve for soil water fluxes. -- :numref:`Figure three layer snow pack` Example of three layer snow pack (snl=-3). +- :numref:`Figure three layer snow pack` Example of three layer snow pack (snl=-3). - :numref:`Figure Schematic representation of the urban landunit` Schematic representation of the urban land unit. @@ -57,31 +55,31 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Figure Schematic of urban and atmospheric model coupling` Schematic of urban and atmospheric model coupling. -- :numref:`Figure Vegetation fluxes and pools` Vegetation fluxes and pools. +- :numref:`Figure Vegetation fluxes and pools` Vegetation fluxes and pools. -- :numref:`Figure Carbon and nitrogen pools` Carbon and nitrogen pools. +- :numref:`Figure Carbon and nitrogen pools` Carbon and nitrogen pools. -- :numref:`Figure annual phenology cycle` Example of annual phenology cycle for seasonal deciduous. +- :numref:`Figure annual phenology cycle` Example of annual phenology cycle for seasonal deciduous. - 14.2. Example fluxes and pools sizes for an onset growth period of 15 days, with initial transfer pool size of 100 gC m-2 and a timestep of one hour. a) Flux leaving transfer pool (e.g. CFleaf\_xfer,leaf). b) Carbon content of transfer pool and its associated display pool (e.g. CSleaf\_xfer and CSleaf, respectively). -- 14.3. Example fluxes and pool sizes for an offset (litterfall) period of 15 days, with initial display pool size of 100 gC m-2 and a timestep of one hour. a) Litterfall flux (e.g CFleaf,litter). b) Carbon content of display pool and litter pool through the litterfall period, ignoring the losses from litter pool due to decomposition during this period. +- 14.3. Example fluxes and pool sizes for an offset (litterfall) period of 15 days, with initial display pool size of 100 gC m-2 and a timestep of one hour. a) Litterfall flux (e.g CFleaf,litter). b) Carbon content of display pool and litter pool through the litterfall period, ignoring the losses from litter pool due to decomposition during this period. - :numref:`Figure Schematic of decomposition model in CLM` Schematic of decomposition model in CLM. -- :numref:`Figure Pool structure` Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 alternate soil decomposition models included in CLM. +- :numref:`Figure Pool structure` Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 alternate soil decomposition models included in CLM. -- :numref:`Figure Biological nitrogen fixation` Biological nitrogen fixation as a function of annual net primary production. +- :numref:`Figure Biological nitrogen fixation` Biological nitrogen fixation as a function of annual net primary production. -- :numref:`Figure Methane Schematic` Schematic representation of biological and physical processes integrated in CLM that affect the net CH4 surface flux. (left) Fully inundated portion of a CLM gridcell and (right) variably saturated portion of a gridcell. +- :numref:`Figure Methane Schematic` Schematic representation of biological and physical processes integrated in CLM that affect the net CH4 surface flux. (left) Fully inundated portion of a CLM gridcell and (right) variably saturated portion of a gridcell. -- :numref:`Figure Schematic of land cover change` Schematic of land cover change impacts on CLM carbon pools and fluxes. +- :numref:`Figure Schematic of land cover change` Schematic of land cover change impacts on CLM carbon pools and fluxes. -- :numref:`Figure Schematic of translation of annual LUH2 land units` Schematic of translation of annual UNH land units to CLM4 plant functional types. +- :numref:`Figure Schematic of translation of annual LUH2 land units` Schematic of translation of annual UNH land units to CLM4 plant functional types. **LIST OF TABLES** -- :numref:`Table Plant functional types` Plant functional types +- :numref:`Table Plant functional types` Plant functional types - :numref:`Table Plant functional type canopy top and bottom heights` Plant functional type canopy top and bottom heights @@ -89,73 +87,73 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Atmospheric input to land model` Atmospheric input to land model -- :numref:`Table Land model output to atmospheric model` Land model output to atmospheric model +- :numref:`Table Land model output to atmospheric model` Land model output to atmospheric model -- :numref:`Table Surface data required for CLM and their base spatial resolution` Surface data required for CLM4.5 and their base spatial resolution +- :numref:`Table Surface data required for CLM and their base spatial resolution` Surface data required for CLM4.5 and their base spatial resolution -- :numref:`Table Physical constants` Physical constants +- :numref:`Table Physical constants` Physical constants - :numref:`Table Plant functional type optical properties` Plant functional type optical properties -- :numref:`Table Intercepted snow optical properties` Intercepted snow optical properties +- :numref:`Table Intercepted snow optical properties` Intercepted snow optical properties -- :numref:`Table Dry and saturated soil albedos` Dry and saturated soil albedos +- :numref:`Table Dry and saturated soil albedos` Dry and saturated soil albedos -- :numref:`Table Spectral bands and weights used for snow radiative transfer` Spectral bands and weights used for snow radiative transfer +- :numref:`Table Spectral bands and weights used for snow radiative transfer` Spectral bands and weights used for snow radiative transfer -- :numref:`Table Single-scatter albedo values used for snowpack impurities and ice` Single-scatter albedo values used for snowpack impurities and ice +- :numref:`Table Single-scatter albedo values used for snowpack impurities and ice` Single-scatter albedo values used for snowpack impurities and ice -- :numref:`Table Mass extinction values` Mass extinction values (m2 kg-1) used for snowpack impurities and ice. +- :numref:`Table Mass extinction values` Mass extinction values (m2 kg-1) used for snowpack impurities and ice. -- :numref:`Table Asymmetry scattering parameters used for snowpack impurities and ice` Asymmetry scattering parameters used for snowpack impurities and ice. +- :numref:`Table Asymmetry scattering parameters used for snowpack impurities and ice` Asymmetry scattering parameters used for snowpack impurities and ice. -- :numref:`Table Orbital parameters` Orbital parameters +- :numref:`Table Orbital parameters` Orbital parameters -- :numref:`Table Plant functional type aerodynamic parameters` Plant functional type aerodynamic parameters +- :numref:`Table Plant functional type aerodynamic parameters` Plant functional type aerodynamic parameters -- :numref:`Table Coefficients for saturation vapor pressure` Coefficients for e\ :sub:`sat`\ :sup:`T` +- :numref:`Table Coefficients for saturation vapor pressure` Coefficients for e\ :sub:`sat`\ :sup:`T` - :numref:`Table Coefficients for derivative of esat` Coefficients for 112:numref:`` 6.1. Soil layer structure. - :numref:`Table Meltwater scavenging` Meltwater scavenging efficiency for particles within snow -- :numref:`Table snow layer thickness` Minimum and maximum thickness of snow layers (m) +- :numref:`Table snow layer thickness` Minimum and maximum thickness of snow layers (m) -- :numref:`Table Plant functional type (PFT) stomatal conductance parameters` Plant functional type (PFT) stomatal conductance parameters. +- :numref:`Table Plant functional type (PFT) stomatal conductance parameters` Plant functional type (PFT) stomatal conductance parameters. -- :numref:`Table Temperature dependence parameters for C3 photosynthesis` Temperature dependence parameters for C3 photosynthesis. +- :numref:`Table Temperature dependence parameters for C3 photosynthesis` Temperature dependence parameters for C3 photosynthesis. -- :numref:`Table Plant functional type root distribution parameters` Plant functional type root distribution parameters. +- :numref:`Table Plant functional type root distribution parameters` Plant functional type root distribution parameters. - :numref:`Table MOSART Parameters` List of parameters in the global hydrography dataset. -- :numref:`Table Allocation and CN ratio parameters` Allocation and carbon:nitrogen ratio parameters +- :numref:`Table Allocation and CN ratio parameters` Allocation and carbon:nitrogen ratio parameters -- :numref:`Table Decomposition rate constants` Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. +- :numref:`Table Decomposition rate constants` Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. -- :numref:`Table Respiration fractions for litter and SOM pools` Respiration fractions for litter and SOM pools +- :numref:`Table Respiration fractions for litter and SOM pools` Respiration fractions for litter and SOM pools -- :numref:`Table Turnover times` Turnover times, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the Century-based decomposition cascade. +- :numref:`Table Turnover times` Turnover times, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the Century-based decomposition cascade. -- :numref:`Table Respiration fractions for Century-based structure` Respiration fractions for litter and SOM pools for Century-based structure +- :numref:`Table Respiration fractions for Century-based structure` Respiration fractions for litter and SOM pools for Century-based structure -- :numref:`Table PFT-specific combustion completeness and fire mortality factors` PFT-specific combustion completeness and fire mortality factors. +- :numref:`Table PFT-specific combustion completeness and fire mortality factors` PFT-specific combustion completeness and fire mortality factors. -- :numref:`Table Methane Parameter descriptions` Parameter descriptions and sensitivity analysis ranges applied in the methane model. +- :numref:`Table Methane Parameter descriptions` Parameter descriptions and sensitivity analysis ranges applied in the methane model. - :numref:`Table Temperature dependence of aqueous and gaseous diffusion` Temperature dependence of aqueous and gaseous diffusion coefficients for CH4 and O2. -- :numref:`Table Crop plant functional types` Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. +- :numref:`Table Crop plant functional types` Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. - :numref:`Table Crop plant functional types` Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. - :numref:`Table Crop allocation parameters` Crop allocation parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. -- :numref:`Table Plant functional type (PFT) biogeography rules` Plant functional type (PFT) biogeography rules with respect to climate. +- :numref:`Table Plant functional type (PFT) biogeography rules` Plant functional type (PFT) biogeography rules with respect to climate. -- :numref:`Table Dust Mass fraction` Mass fraction m\ :sub:`i` , mass median diameter :sub:`v, i` , and geometric standard deviation :sub:`g, i` , per dust source mode i +- :numref:`Table Dust Mass fraction` Mass fraction m\ :sub:`i` , mass median diameter :sub:`v, i` , and geometric standard deviation :sub:`g, i` , per dust source mode i -- :numref:`Table Dust Minimum and maximum particle diameters` Minimum and maximum particle diameters in each dust transport bin j +- :numref:`Table Dust Minimum and maximum particle diameters` Minimum and maximum particle diameters in each dust transport bin j **ACKNOWLEDGEMENTS** @@ -187,7 +185,7 @@ scientific papers (:ref:`rst_References`). This document and the CLM5.0 User’s Guide together provide the user with the scientific description and operating instructions for CLM. -Model History +Model History --------------- Inception of CLM @@ -315,11 +313,11 @@ added stability corrections to the diagnostic 2-m air temperature calculation which reduced biases in this temperature. Competition between PFTs for water, in which PFTs share a single soil column, is the default mode of operation in this model version. CLM3 was released to -the community in June 2004. :ref:`Dickinson et al. (2006)` -describe the climate statistics of CLM3 when coupled to CCSM3.0. -:ref:`Hack et al. (2006)` provide an analysis of selected +the community in June 2004. :ref:`Dickinson et al. (2006)` +describe the climate statistics of CLM3 when coupled to CCSM3.0. +:ref:`Hack et al. (2006)` provide an analysis of selected features of the land hydrological cycle. -:ref:`Lawrence et al. (2007)` examine the impact of +:ref:`Lawrence et al. (2007)` examine the impact of changes in CLM3 hydrological parameterizations on partitioning of evapotranspiration (ET) and its effect on the timescales of ET response to precipitation @@ -490,11 +488,11 @@ remains long. Finally, the predominantly low resolution input data for provided with CLM4 to create CLM4 surface datasets is replaced with newer and higher -resolution input datasets where possible (see section :numref:`Surface Data` +resolution input datasets where possible (see section :numref:`Surface Data` for details). The default meteorological forcing dataset provided with CLM4 -(:ref:`Qian et al. 2006)` is replaced with the 1901-2010 -CRUNCEP forcing dataset (see Chapter :numref:`rst_Land-Only Mode`) for CLM4.5, -though users can also still use the :ref:`Qian et al. (2006)` +(:ref:`Qian et al. 2006)` is replaced with the 1901-2010 +CRUNCEP forcing dataset (see Chapter :numref:`rst_Land-Only Mode`) for CLM4.5, +though users can also still use the :ref:`Qian et al. (2006)` dataset or other alternative forcing datasets. CLM4.5 was released to the community in June 2013 along with the @@ -504,55 +502,55 @@ CLM5.0 ^^^^^^^^^^^^ Developments for CLM5.0 build on the progress made in CLM4.5. Most major components of the model have been updated with particularly -notable changes made to soil and plant hydrology, snow density, river modeling, carbon and nitrogen cycling and coupling, -and crop modeling. -Much of the focus of development centered on a +notable changes made to soil and plant hydrology, snow density, river modeling, carbon and nitrogen cycling and coupling, +and crop modeling. +Much of the focus of development centered on a push towards more mechanistic treatment of key processes, in addition to more comprehensive and explicit representation -of land use and land-cover change. Prior versions of CLM included relatively few options for physics parameterizations or structure. +of land use and land-cover change. Prior versions of CLM included relatively few options for physics parameterizations or structure. In CLM5, where new parameterizations or model decisions were made, in most cases, the CLM4.5 parameterization was maintained so that users could switch back and forth between different parameterizations via namelist control where appropriate or desirable. Throughout the CLM5 Technical Descpription, in general only the default parameterization for any given process is described. Readers are referred to the CLM4.5 or CLM4 Technical Descriptions for detailed descriptions of non-default parameterizations. The hydrology updates include the introduction of a dry surface layer-based soil evaporation resistance parameterization :ref:`(Swenson and Lawrence, 2014)` and a revised canopy interception parameterization. Canopy interception is now divided into liquid and solid phases, with the intercepted snow subject to unloading events due to wind or above-freezing temperatures. The snow-covered fraction of the canopy is used within the canopy radiation and surface albedo calculation. Instead of applying a spatially uniform soil thickness, soil thickness can vary in space :ref:`(Brunke et al. 2016` and :ref:`Swenson and Lawrence, 2015)` and is set to values within a range of 0.4m to 8.5m depth, derived from a spatially explicit soil thickness data product :ref:`(Pelletier et al., 2016)`. The explicit treatment of soil thickness allows for the deprecation of the unconfined aquifer parameterization used in CLM4.5, which is replaced with a zero flux boundary condition and explicit modeling of both the saturated and unsaturated zones. The default model soil layer resolution is increased, especially within the top 3m, to more explicitly represent active layer thickness within the permafrost zone. Rooting profiles were used inconsistently in CLM4.5 with :ref:`Zeng (2001)` profiles used for water and :ref:`Jackson et al. (1996)` profiles used for carbon inputs. For CLM5, the Jackson et al. (1996) rooting profiles are used for both water and carbon. Roots are deepened for the broadleaf evergreen tropical tree and broadleaf deciduous tropical tree types. Finally, an adaptive time-stepping solution to the Richard's equation is introduced, which improves the accuracy and stability of the numerical soil water solution. The River Transport Model (RTM) is replaced with the Model for Scale Adaptive River Transport (MOSART, :ref:`Li et al., 2013b)` in which surface runoff is routed across hillslopes and then discharged along with subsurface runoff into a tributary subnetwork before entering the main channel. Several changes are included that are mainly targeted at improving the simulation of surface mass balance over ice -sheets. The fresh snow density parameterization is updated to more realistically capture the temperature effects and to additionally account for wind effects on new snow density :ref:`(van Kampenhout et al., 2017)`. The maximum number of snow layers and snow amount is increased from 5 layers and 1m snow water equivalent to 12 layers and 10m snow water equivalent to allow for the formation of firn in regions of persistent snow-cover (e.g., glaciers and ice sheets) :ref:`(van Kampenhout et al., 2017)`. The CISM2 ice sheet model is active for Greenland by default with one-way coupling (surface mass balance impacts ice sheet dynamics, but ice sheet dynamics do not feedback onto surface elevation). Two-way coupling can be activated through a namelist switch. The introduction in CLM5 of the capability to +sheets. The fresh snow density parameterization is updated to more realistically capture the temperature effects and to additionally account for wind effects on new snow density :ref:`(van Kampenhout et al., 2017)`. The maximum number of snow layers and snow amount is increased from 5 layers and 1m snow water equivalent to 12 layers and 10m snow water equivalent to allow for the formation of firn in regions of persistent snow-cover (e.g., glaciers and ice sheets) :ref:`(van Kampenhout et al., 2017)`. The CISM2 ice sheet model is active for Greenland by default with one-way coupling (surface mass balance impacts ice sheet dynamics, but ice sheet dynamics do not feedback onto surface elevation). Two-way coupling can be activated through a namelist switch. The introduction in CLM5 of the capability to dynamically adjust landunit weights means that a glacier can initiate, grow, shrink, or disappear during -a simulation when two-way coupling is active. Multiple elevation classes (10 elevation classes by default) and associated temperature, rain/snow partitioning, and downwelling longwave downscaling are used for glacier landunits to account for the strong topographic elevation heterogeneity over glaciers and ice sheets. +a simulation when two-way coupling is active. Multiple elevation classes (10 elevation classes by default) and associated temperature, rain/snow partitioning, and downwelling longwave downscaling are used for glacier landunits to account for the strong topographic elevation heterogeneity over glaciers and ice sheets. A plant hydraulic stress routine is introduced which explicitly models water transport through the vegetation according to a simple hydraulic framework (Kennedy et al., to be submitted). The water supply equations are used to solve for vegetation water potential forced by transpiration demand and a set of layer-by-layer soil water potentials. Stomatal conductance, therefore, is a function of prognostic leaf water potential. Water stress is calculated as the ratio of attenuated stomatal conductance to maximum stomatal conductance. An emergent feature of the plant hydraulics is soil hydraulic redistribution. In CLM5, maximum stomatal conductance is obtained from the Medlyn conductance model :ref:`(Medlyn et al., 2011)`, rather than the Ball-Berry stomatal conductance model that was utilized in CLM4.5 and prior versions of the model. The Medlyn stomatal conductance model is preferred mainly for it's more realistic behavior at low humidity levels :ref:`(Rogers et al., 2017)`. The stress deciduous vegetation phenology trigger is augmented with a antecedent precipitation requirement :ref:`(Dahlin et al. 2015)`. -Plant nutrient dynamics are substantially updated to resolve several deficiencies with the CLM4 and CLM4.5 nutrient cycling representation. The Fixation and Update of Nitrogen (FUN) model based on the work of :ref:`Fisher et al. (2010)`, :ref:`Brzostek et al. (2014)`, and :ref:`Shi et al. (2016)` is incorporated. The concept of FUN is that in most cases, N uptake requires the expenditure of energy in the form of carbon, and further, that there are numerous potential sources of N in the environment which a plant may exchange for carbon. The ratio of carbon expended to N acquired is therefore the cost, or exchange rate, of N acquisition. FUN calculates the rate of symbiotic N fixation, with this N passed straight to the plant, not the mineral N pool. Separately, CLM5 also calculates rates of symbiotic (or free living) N fixation as a function of evapotranspiration (:ref:`Cleveland et al. 1999 `), which -is added to the soil inorganic ammonium (NH\ :sub:`4`\ :sup:`+`) pool. The static plant carbon:nitrogen (C:N) ratios utilized in CLM4 and CLM4.5 are replaced with variable plant C:N ratios which -allows plants to adjust their C:N ratio, and therefore their leaf nitrogen content, with the cost of N uptake :ref:`(Ghimire et al. 2016)`. -The implementation of a flexible C:N ratio means that the model no longer relies on instantaneous downregulation -of potential photosynthesis rates based on soil mineral nitrogen availability to represent nutrient limitation. Furthermore, stomatal conductance -is now based on the N-limited photosynthesis rather than on potential photosynthesis. Finally, the Leaf Use of +Plant nutrient dynamics are substantially updated to resolve several deficiencies with the CLM4 and CLM4.5 nutrient cycling representation. The Fixation and Update of Nitrogen (FUN) model based on the work of :ref:`Fisher et al. (2010)`, :ref:`Brzostek et al. (2014)`, and :ref:`Shi et al. (2016)` is incorporated. The concept of FUN is that in most cases, N uptake requires the expenditure of energy in the form of carbon, and further, that there are numerous potential sources of N in the environment which a plant may exchange for carbon. The ratio of carbon expended to N acquired is therefore the cost, or exchange rate, of N acquisition. FUN calculates the rate of symbiotic N fixation, with this N passed straight to the plant, not the mineral N pool. Separately, CLM5 also calculates rates of symbiotic (or free living) N fixation as a function of evapotranspiration (:ref:`Cleveland et al. 1999 `), which +is added to the soil inorganic ammonium (NH\ :sub:`4`\ :sup:`+`) pool. The static plant carbon:nitrogen (C:N) ratios utilized in CLM4 and CLM4.5 are replaced with variable plant C:N ratios which +allows plants to adjust their C:N ratio, and therefore their leaf nitrogen content, with the cost of N uptake :ref:`(Ghimire et al. 2016)`. +The implementation of a flexible C:N ratio means that the model no longer relies on instantaneous downregulation +of potential photosynthesis rates based on soil mineral nitrogen availability to represent nutrient limitation. Furthermore, stomatal conductance +is now based on the N-limited photosynthesis rather than on potential photosynthesis. Finally, the Leaf Use of Nitrogen for Assimilation (LUNA, :ref:`Xu et al., 2012` and :ref:`Ali et al., 2016)` model is incorporated. The LUNA model calculates -photosynthetic capacity based on optimization of the use of leaf nitrogen under different environmental conditions such that -light capture, carboxylation, and respiration are co-limiting. +photosynthetic capacity based on optimization of the use of leaf nitrogen under different environmental conditions such that +light capture, carboxylation, and respiration are co-limiting. -CLM5 applies a fixed allocation scheme for woody vegetation. The decision to use a fixed allocation scheme in CLM5, rather than a dynamic NPP-based allocation scheme, as was used in CLM4 and CLM4.5, was driven by the fact that observations indicate that biomass saturates with increasing productivity, in contrast to the behavior in CLM4 and CLM4.5 where biomass continuously increases with increasing productivity (:ref:`Negron-Juarez et al., 2015`). Soil carbon decomposition processes are unchanged in CLM5, but a new metric for apparent soil carbon turnover times (:ref:`Koven et al., 2017 `) suggested parameter changes that produce a weak intrinsic depth limitation on soil carbon turnover rates (rather than the strong depth limitaiton in CLM4.5) and that the thresholds for soil moisture limitation on soil carbon turnover rates in dry soils should be set at a wetter soil moisture level than that used in CLM4.5. +CLM5 applies a fixed allocation scheme for woody vegetation. The decision to use a fixed allocation scheme in CLM5, rather than a dynamic NPP-based allocation scheme, as was used in CLM4 and CLM4.5, was driven by the fact that observations indicate that biomass saturates with increasing productivity, in contrast to the behavior in CLM4 and CLM4.5 where biomass continuously increases with increasing productivity (:ref:`Negron-Juarez et al., 2015`). Soil carbon decomposition processes are unchanged in CLM5, but a new metric for apparent soil carbon turnover times (:ref:`Koven et al., 2017 `) suggested parameter changes that produce a weak intrinsic depth limitation on soil carbon turnover rates (rather than the strong depth limitaiton in CLM4.5) and that the thresholds for soil moisture limitation on soil carbon turnover rates in dry soils should be set at a wetter soil moisture level than that used in CLM4.5. -Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016)`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. -Fertilization rates and irrigation equipped area updated annually based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that +Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016)`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. +Fertilization rates and irrigation equipped area updated annually based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that vary by latitude for selected crop types, grain C and N is now removed at harvest to a 1-year product pool with -the carbon for the next season's crop seed removed from the grain carbon at harvest. Through the introduction of +the carbon for the next season's crop seed removed from the grain carbon at harvest. Through the introduction of the capability to dynamically adjust landunit weights during a simulation, the crop model can now be run coincidentally with prescribed land use, which significantly expands the capabilities of the model. Mass-based rather than area-based wood harvest is applied. Several heat stress indices for both urban and rural areas are calculated and output by default :ref:`(Buzan et al., 2015)`. A more sophisticated and realistic building space heating and air conditioning submodel that prognoses interior building air temperature and includes more realistic space heating and air conditioning wasteheat factors -is incorporated. +is incorporated. The fire model is the same as utilized in CLM4.5 except that a modified scheme is used to estimate the dependence of fire occurrence and spread on fuel wetness for non-peat fires outside cropland and tropical closed forests :ref:`(Li and Lawrence, 2017)` and the dependence of agricultural fires on fuel load is removed. Included with the release of CLM5.0 is a functionally supported version of the Functionally-Assembled Terrestrial Ecosystem Simulator (FATES, :ref:`Fisher et al., 2015)`. A major motivation of FATES is to allow the prediction of biome boundaries directly from plant physiological traits via their competitive interactions. FATES is a cohort model of vegetation competition and co-existence, allowing a representation of the biosphere which accounts for the division of the land surface into successional stages, and for competition for light between height structured cohorts of representative trees of various plant functional types. FATES is not active by default in CLM5.0. -Note that the classical dynamic global vegetation model (CLM-DGVM) that has been available within CLM4 and CLM4.5 remains available, though it is largely untested. The technical description of the CLM-DGVM can be found within the CLM4.5 Technical Description (:ref:`Oleson et al. 2013)`. +Note that the classical dynamic global vegetation model (CLM-DGVM) that has been available within CLM4 and CLM4.5 remains available, though it is largely untested. The technical description of the CLM-DGVM can be found within the CLM4.5 Technical Description (:ref:`Oleson et al. 2013)`. During the course of the development of CLM5.0, it became clear that the increasing complexity of the model combined with the increasing number and range of model development projects required updates to the underlying CLM infrastructure. Many such software improvements -are included in CLM5 including a partial transition to an object-oriented modular software structure. Many hard coded model -parameters have been extracted into either the parameter file or the CLM namelist, which allows users to more readily calibrate the model for use at -specific locations or to conduct parameter sensitivity studies. As part of the effort to increase -the scientific utility of the code, in most instances older generation parameterizations (i.e., the parameterizations -available in CLM4 or CLM4.5) are retained under namelist switches, allowing the user to revert to CLM4.5 +are included in CLM5 including a partial transition to an object-oriented modular software structure. Many hard coded model +parameters have been extracted into either the parameter file or the CLM namelist, which allows users to more readily calibrate the model for use at +specific locations or to conduct parameter sensitivity studies. As part of the effort to increase +the scientific utility of the code, in most instances older generation parameterizations (i.e., the parameterizations +available in CLM4 or CLM4.5) are retained under namelist switches, allowing the user to revert to CLM4.5 from the same code base or to revert individual parameterizations where the old parameterizations are compatible with the new code. Finally, multiple vertical soil layer structures are defined and it is relatively easy to add additional structures. @@ -562,7 +560,7 @@ Biogeophysical and Biogeochemical Processes Biogeophysical and biogeochemical processes are simulated for each subgrid land unit, column, and plant functional type (PFT) independently and each subgrid unit maintains its own prognostic variables (see -section :numref:`Surface Heterogeneity and Data Structure` for definitions +section :numref:`Surface Heterogeneity and Data Structure` for definitions of subgrid units). The same atmospheric forcing is used to force all subgrid units within a grid cell. The surface variables and fluxes required by the atmosphere are obtained by @@ -590,7 +588,7 @@ processes simulated include (:numref:`Figure Land processes`): #. Snow hydrology (snow accumulation and melt, compaction, water transfer between snow layers) (Chapter :numref:`rst_Snow Hydrology`) -#. Stomatal physiology, photosythetic capacity, and photosynthesis (Chapters :numref:`rst_Stomatal Resistance and Photosynthesis` and +#. Stomatal physiology, photosythetic capacity, and photosynthesis (Chapters :numref:`rst_Stomatal Resistance and Photosynthesis` and :numref:`rst_Photosynthetic Capacity`) #. Plant hydraulics (Chapter :numref:`rst_Plant Hydraulics`) diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index db3498f4e5..5168284551 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1,10 +1,17 @@ .. _rst_References: + +.. |br| raw:: latex + + \\ + References ============== .. _Aberetal1990: +|br| + Aber, J.D., Melillo, J.M. and McClaugherty, C.A., 1990. Predicting long-term patterns of mass loss, nitrogen dynamics, and soil organic matter formation from initial fime litter chemistry in temperate forest @@ -12,6 +19,8 @@ ecosystems. Canadian Journal of Botany, 68: 2201-2208. .. _Aberetal2003: +|br| + Aber, J.D., Goodale, C.L., Ollinger, S.V., Smith, M.-L., Magill, A.H., Martin, M.E., Hallett, R.A., and Stoddard, J.L. 2003. Is nitrogen deposition altering the nitrogen status of northeastern forests? @@ -19,22 +28,32 @@ BioScience 53:375-389. .. _Alietal2016: -Ali, A. A., C. Xu, A. Rogers, R. A. Fisher, S. D. Wullschleger, E. Massoud, J. A. Vrugt, J. D. Muss, N. McDowell, and J. Fisher, 2016: A global scale mechanistic model of photosynthetic capacity (LUNA V1. 0). Geosci. Mod. Dev., 9:587-606. +|br| + +Ali, A. A., C. Xu, A. Rogers, R. A. Fisher, S. D. Wullschleger, E. Massoud, J. A. Vrugt, J. D. Muss, N. McDowell, +and J. Fisher, 2016: A global scale mechanistic model of +photosynthetic capacity (LUNA V1. 0). Geosci. Mod. Dev., 9:587-606. .. _Allenetal2005: +|br| + Allen, C.B., Will, R.E., and Jacobson, M.A. 2005. Production efficiency and radiation use efficiency of four tree species receiving irrigation and fertilization. Forest Science 51:556-569. .. _Anderson1976: +|br| + Anderson, E.A. 1976. A point energy and mass balance model of a snow cover. NOAA Technical Report NWS 19, Office of Hydrology, National Weather Service, Silver Spring, MD. .. _Andréetal1986: +|br| + André, J.-C., Goutorbe, J.-P., and Perrier, A. 1986. HAPEX-MOBILHY: A hydrologic atmosphere experiment for the study of water budget and evaporation flux at the climatic scale. Bull. Amer. Meteor. Soc. @@ -42,39 +61,53 @@ evaporation flux at the climatic scale. Bull. Amer. Meteor. Soc. .. _AndrénPaustian1987: +|br| + Andrén, O. and Paustian, K., 1987. Barley straw decomposition in the field: a comparison of models. Ecology 68:1190-1200. .. _ArahStephen1998: +|br| + Arah, J.R.M. and Stephen, K.D., 1998. A model of the processes leading to methane emission from peatland. Atmos. Environ. 32:3257-3264. .. _ArahVinten1995: +|br| + Arah, J. and Vinten, A., 1995. Simplified models of anoxia and denitrification in aggregated and simple-structured soils. European Journal of Soil Science 46:507-517. .. _Arendtetal2012: +|br| + Arendt, A., et al. 2012. Randolph Glacier Inventory: A Dataset of Global Glacier Outlines Version: 1.0, Global Land Ice Measurements from Space, Boulder Colorado, USA. Digital Media. .. _AroraBoer2005: +|br| + Arora, V.K. and Boer, G.J. 2005. Fire as an interactive component of dynamic vegetation models. J. Geophys. Res. 110:G02008. DOI:10.1029/2005JG000042. .. _Arya2001: +|br| + Arya, S.P. 2001. Introduction to Meteorology. Academic Press, San Diego, CA. .. _Asneretal1998: +|br| + Asner, G.P., Wessman, C.A., Schimel, D.S., and Archer, S. 1998. Variability in leaf and litter optical properties: implications for BRDF model inversions using AVHRR, MODIS, and MISR. Remote Sens. Environ. @@ -82,47 +115,63 @@ model inversions using AVHRR, MODIS, and MISR. Remote Sens. Environ. .. _AxelssonAxelsson1986: +|br| + Axelsson, E., and Axelsson, B. 1986. Changes in carbon allocation patterns in spruce and pine trees following irrigation and fertilization. Tree Phys. 2:189-204. .. _BadgerandDirmeyer2015: +|br| + Badger, A.M., and Dirmeyer, P.A., 2015. Climate response to Amazon forest replacement by heterogeneous crop cover. Hydrol. Earth. Syst. Sci. 19:4547- -4557. +4557. .. _Bairdetal2004: +|br| + Baird, A.J., Beckwith, C.W., Waldron, S. and Waddington, J.M., 2004. Ebullition of methane-containing gas bubbles from near-surface Sphagnum peat. Geophys. Res. Lett. 31. DOI:10.1029/2004GL021157. .. _Baldocchietal2001: +|br| + Baldocchi, D., et al. 2001. FLUXNET: A new tool to study the temporal and spatial variability of ecosystem-scale carbon dioxide, water vapor, and energy flux densities. Bull. Amer. Meteor. Soc. 82:2415-2433. .. _Barbottinetal2005: +|br| + Barbottin, A., Lecomte, C., Bouchard, C., and Jeuffroy, M.-H. 2005. Nitrogen remobilization during grain filling in wheat: Genotypic and environmental effects. Crop Sci. 45:1141-1150. .. _Batjes2006: +|br| + Batjes, N.H., 2006. ISRIC-WISE derived soil properties on a 5 by 5 arc-minutes global grid. Report 2006/02 (available through : http://www.isric.org) .. _Berger1978a: +|br| + Berger, A.L. 1978a. Long-term variations of daily insolation and quaternary climatic changes. J. Atmos. Sci. 35:2362-2367. .. _Berger1978b: +|br| + Berger, A.L. 1978b. A simple algorithm to compute long-term variations of daily or monthly insolation. Contribution de l’Institut d’Astronomie et de Géophysique, Université Catholique de Louvain, Louvain-la-Neuve, @@ -130,27 +179,37 @@ No. 18. .. _Bergeretal1993: +|br| + Berger, A., Loutre, M.-F., and Tricot, C. 1993. Insolation and Earth’s orbital periods. J. Geophys. Res. 98:10341-10362. .. _BerkowitzBalberg1992: +|br| + Berkowitz, B., and Balberg, I. 1992. Percolation approach to the problem of hydraulic conductivity in porous media. Transport in Porous Media 9:275–286. .. _BevenKirkby1979: +|br| + Beven, K.J., and Kirkby, M.J. 1979. A physically based variable contributing area model of basin hydrology. Hydrol. Sci. Bull. 24:43-69. .. _BohrenHuffman1983: +|br| + Bohren, C. F., and Huffman, D. R. 1983. Absorption and scattering of light by small particles. John Wiley & Sons, New York, NY. .. _Bonan1996: +|br| + Bonan, G.B. 1996. A land surface model (LSM version 1.0) for ecological, hydrological, and atmospheric studies: Technical description and user’s guide. NCAR Technical Note NCAR/TN-417+STR, National Center for @@ -158,17 +217,23 @@ Atmospheric Research, Boulder, CO, 150 pp. .. _Bonan1998: +|br| + Bonan, G.B. 1998. The land surface climatology of the NCAR Land Surface Model coupled to the NCAR Community Climate Model. J. Climate 11:1307-1326. .. _Bonan2002: +|br| + Bonan, G.B. 2002. Ecological Climatology: Concepts and Applications. Cambridge University Press. .. _Bonanetal2002a: +|br| + Bonan, G.B., Oleson, K.W., Vertenstein, M., Levis, S., Zeng, X., Dai, Y., Dickinson, R.E., and Yang, Z.-L. 2002a. The land surface climatology of the Community Land Model coupled to the NCAR Community Climate Model. @@ -176,18 +241,24 @@ J. Climate 15: 3123-3149. .. _Bonanetal2002b: +|br| + Bonan, G.B., Levis, S., Kergoat, L., and Oleson, K.W. 2002b. Landscapes as patches of plant functional types: An integrating concept for climate and ecosystem models. Global Biogeochem. Cycles 16: 5.1-5.23. .. _BonanLevis2006: +|br| + Bonan, G.B., and Levis, S. 2006. Evaluating aspects of the Community Land and Atmosphere Models (CLM3 and CAM3) using a dynamic global vegetation model. J. Climate 19:2290-2301. .. _Bonanetal2011: +|br| + Bonan, G.B., Lawrence P.J., Oleson K.W., Levis S., Jung M., Reichstein M., Lawrence, D.M., and Swenson, S.C. 2011. Improving canopy processes in the Community Land Model (CLM4) using global flux fields empirically @@ -196,6 +267,8 @@ DOI:10.1029/2010JG001593. .. _Bonanetal2012: +|br| + Bonan, G. B., Oleson, K.W., Fisher, R.A., Lasslop, G., and Reichstein, M. 2012. Reconciling leaf physiological traits and canopy flux data: Use of the TRY and FLUXNET databases in the Community Land Model version 4, @@ -203,47 +276,65 @@ J. Geophys. Res., 117, G02026. DOI:10.1029/2011JG001913. .. _Bonanetal2014: -Bonan, G.B., Williams, M., Fisher, R.A., and Oleson, K.W. 2014. Modeling -stomatal conductance in the earth system: linking leaf water-use -efficiency and water transport along the soil–plant–atmosphere continuum, +|br| + +Bonan, G.B., Williams, M., Fisher, R.A., and Oleson, K.W. 2014. Modeling +stomatal conductance in the earth system: linking leaf water-use +efficiency and water transport along the soil–plant–atmosphere continuum, Geosci. Model Dev., 7, 2193-2222, doi:10.5194/gmd-7-2193-2014. .. _Brun1989: +|br| + Brun, E. 1989. Investigation of wet-snow metamorphism in respect of liquid water content. Ann. Glaciol. 13:22-26. .. _Brunkeetal2016: +|br| + Brunke, M. A., P. Broxton, J. Pelletier, D. Gochis, P. Hazenberg, D. M. Lawrence, L. R. Leung, G.-Y. Niu, P. A. Troch, and X. Zeng, 2016: Implementing and Evaluating Variable Soil Thickness in the Community Land Model, Version 4.5 (CLM4.5). J. Clim. 29:3441-3461. .. _Brzosteketal2014: +|br| + Brzostek, E. R., J. B. Fisher, and R. P. Phillips, 2014. Modeling the carbon cost of plant nitrogen acquisition: Mycorrhizal trade-offs and multipath resistance uptake improve predictions of retranslocation. J. Geophys. Res. Biogeosci., 119, 1684–1697, doi:10.1002/2014JG002660. .. _BugmannSolomon2000: +|br| + Bugmann, H., and Solomon, A.M. 2000. Explaining forest composition and biomass across multiple biogeographical regions. Ecol. Appl. 10:95-114. .. _Busing2005: +|br| + Busing, R.T. 2005. Tree mortality, canopy turnover, and woody detritus in old cove forests of the southern Appalachians. Ecology 86:73-84. .. _Buzanetal2015: -Buzan, J.R., Oleson, K., and Huber, M. 2015: Implementation and -comparison of a suite of heat stress metrics within the Community Land +|br| + +Buzan, J.R., Oleson, K., and Huber, M. 2015: Implementation and +comparison of a suite of heat stress metrics within the Community Land Model version 4.5, Geosci. Model Dev., 8, 151-170, doi:10.5194/gmd-8-151-2015. .. _CampbellNorman1998: +|br| + Campbell, G.S., and Norman, J.M. 1998. An Introduction to Environmental Biophysics (2:math:`{}^{nd}` edition). Springer-Verlag, New York. .. _Castilloetal2012: +|br| + Castillo, G., Kendra, C., Levis, S., and Thornton, P. 2012. Evaluation of the new CNDV option of the Community Land Model: effects of dynamic vegetation and interactive nitrogen on CLM4 means and variability. J. @@ -251,25 +342,33 @@ Climate 25:3702–3714. .. _Caoetal1996: +|br| + Cao, M., Marshall, S. and Gregson, K., 1996. Global carbon exchange and methane emissions from natural wetlands: Application of a process-based model. J. Geophys. Res. 101(D9):14,399-14,414. .. _Chuangetal2006: -Chuang Y.L., Oren R., Bertozzi A.L, Phillips N., Katul G.G. 2006. The -porous media model for the hydraulic system of a conifer tree: Linking -sap flux data to transpiration rate, Ecological Modelling, 191, 447-468, +|br| + +Chuang Y.L., Oren R., Bertozzi A.L, Phillips N., Katul G.G. 2006. The +porous media model for the hydraulic system of a conifer tree: Linking +sap flux data to transpiration rate, Ecological Modelling, 191, 447-468, doi:10.1016/j.ecolmodel.2005.03.027. .. _Churkinaetal2003: +|br| + Churkina, G. et al., 2003. Analyzing the ecosystem carbon dynamics of four European coniferous forests using a biogeochemistry model. Ecosystems, 6: 168-184. .. _CIESIN2005: +|br| + CIESIN: Gridded population of the world version 3 (GPWv3), 2005. Population density grids, Technical report, Socioeconomic Data and Applications Center (SEDAC), Columbia University, Palisades, New York, @@ -277,17 +376,23 @@ USA. .. _ClappHornberger1978: +|br| + Clapp, R.B., and Hornberger, G.M. 1978. Empirical equations for some soil hydraulic properties. Water Resour. Res. 14:601-604. .. _ClauserHuenges1995: +|br| + Clauser, C., and Huenges, E. 1995. Thermal conductivity of rocks and minerals. pp. 105-126. In: T. J. Ahrens (editor) Rock Physics and Phase Relations: A Handbook of Physical Constants. Washington, D.C. .. _Clevelandetal1999: +|br| + Cleveland, C.C., Townsend, A.R., Schimel, D.S., Fisher, H., Howarth, R.W., Hedin, L.O., Perakis, S.S., Latty, E.F., Von Fischer, J.C., Elseroad, A., and Wasson, M.F. 1999. Global patterns of terrestrial @@ -296,6 +401,8 @@ Biogeochem. Cycles 13:623-645. .. _Collatzetal1991: +|br| + Collatz, G.J., Ball, J.T., Grivet, C., and Berry, J.A. 1991. Physiological and environmental regulation of stomatal conductance, photosynthesis, and transpiration: A model that includes a laminar @@ -303,23 +410,31 @@ boundary layer. Agric. For. Meteor. 54:107-136. .. _Collatzetal1992: +|br| + Collatz, G.J., Ribas-Carbo, M., and Berry, J.A. 1992. Coupled photosynthesis-stomatal conductance model for leaves of C\ :math:`{}_{4}` plants. Aust. J. Plant Physiol. 19:519-538. .. _Colmer2003: +|br| + Colmer, T.D., 2003. Long-distance transport of gases in plants: a perspective on internal aeration and radial oxygen loss from roots. Plant Cell and Environment 26:17-36. .. _Conwayetal1996: +|br| + Conway, H., Gades, A., and Raymond, C.F. 1996. Albedo of dirty snow during conditions of melt. Water Resour. Res. 32:1713-1718. .. _Cosbyetal1984: +|br| + Cosby, B.J., Hornberger, G.M., Clapp, R.B., and Ginn, T.R. 1984. A statistical exploration of the relationships of soil moisture characteristics to the physical properties of soils. Water Resour. Res. @@ -327,28 +442,38 @@ characteristics to the physical properties of soils. Water Resour. Res. .. _Crawfordetal1982: +|br| + Crawford, T. W., Rendig, V. V., and Broadent, F. E. 1982. Sources, fluxes, and sinks of nitrogen during early reproductive growth of maize (Zea mays L.). Plant Physiol. 70:1645-1660. .. _Dahlinetal2015: +|br| + Dahlin, K., R. Fisher, and P. Lawrence, 2015: Environmental drivers of drought deciduous phenology in the Community Land Model. Biogeosciences, 12:5061-5074. .. _DaiZeng1997: +|br| + Dai, Y., and Zeng, Q. 1997. A land surface model (IAP94) for climate studies. Part I: formulation and validation in off-line experiments. Adv. Atmos. Sci. 14:433-460. .. _Daietal2001: +|br| + Dai, Y., et al. 2001. Common Land Model: Technical documentation and user’s guide [Available online at http://climate.eas.gatech.edu/dai/clmdoc.pdf]. .. _Daietal2003: +|br| + Dai, Y., Zeng, X., Dickinson, R.E., Baker, I., Bonan, G.B., Bosilovich, M.G., Denning, A.S., Dirmeyer, P.A., Houser, P.R., Niu, G., Oleson, K.W., Schlosser, C.A., and Yang, Z.-L. 2003. The Common Land Model. @@ -356,24 +481,32 @@ Bull. Amer. Meteor. Soc. 84:1013-1023. .. _Daietal2004: +|br| + Dai, Y., Dickinson, R.E., and Wang, Y.-P. 2004. A two-big-leaf model for canopy temperature, photosynthesis, and stomatal conductance. J. Climate 17:2281-2299. .. _DaiTrenberth2002: +|br| + Dai, A., and Trenberth, K.E. 2002. Estimates of freshwater discharge from continents: Latitudinal and seasonal variations. J. Hydrometeor. 3:660-687. .. _DeFriesetal2000: +|br| + DeFries, R.S., Hansen, M.C., Townshend, J.R.G., Janetos, A.C., and Loveland, T.R. 2000. A new global 1-km dataset of percentage tree cover derived from remote sensing. Global Change Biol. 6:247-254. .. _DegensSparling1996: +|br| + Degens, B. and Sparling, G., 1996. Changes in aggregation do not correspond with changes in labile organic C fractions in soil amended with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): @@ -381,16 +514,22 @@ with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): .. _deVries1963: +|br| + de Vries, D.A. 1963. Thermal Properties of Soils. In: W.R. van Wijk (editor) Physics of the Plant Environment. North-Holland, Amsterdam. .. _Dickinson1983: +|br| + Dickinson, R.E. 1983. Land surface processes and climate-surface albedos and energy balance. Adv. Geophys. 25:305-353. .. _Dickinsonetal1993: +|br| + Dickinson, R.E., Henderson-Sellers, A., and Kennedy, P.J. 1993. Biosphere-Atmosphere Transfer Scheme (BATS) version 1e as coupled to the NCAR Community Climate Model. NCAR Technical Note NCAR/TN-387+STR. @@ -398,6 +537,8 @@ National Center for Atmospheric Research, Boulder, CO. .. _Dickinsonetal2006: +|br| + Dickinson, R.E., Oleson, K.W., Bonan, G., Hoffman, F., Thornton, P., Vertenstein, M., Yang, Z.-L., and Zeng, X. 2006. The Community Land Model and its climate statistics as a component of the Community Climate @@ -405,22 +546,30 @@ System Model. J. Climate 19:2302-2324. .. _Dingman2002: +|br| + Dingman, S.L. 2002. Physical Hydrology. Second Edition. Prentice Hall, NJ. .. _Dirmeyeretal1999: +|br| + Dirmeyer, P.A., Dolman, A.J., and Sato, N. 1999. The pilot phase of the Global Soil Wetness Project. Bull. Amer. Meteor. Soc. 80:851-878. .. _Dobsonetal2000: +|br| + Dobson, J.E., Bright, E.A., Coleman, P.R., Durfee, R.C., and Worley, B.A. 2000. LandScan: A global population database for estimating populations at risk. Photogramm. Eng. Rem. Sens. 66:849-857. .. _DormanSellers1989: +|br| + Dorman, J.L., and Sellers, P.J. 1989. A global climatology of albedo, roughness length and stomatal resistance for atmospheric general circulation models as represented by the simple biosphere model (SiB). @@ -428,47 +577,63 @@ J. Appl. Meteor. 28:833-855. .. _Doughertyetal1994: +|br| + Dougherty, R.L., Bradford, J.A., Coyne, P.I., and Sims, P.L. 1994. Applying an empirical model of stomatal conductance to three C4 grasses. Agric. For. Meteor. 67:269-290. .. _Drewniaketal2013: +|br| + Drewniak, B., Song, J., Prell, J., Kotamarthi, V.R., and Jacob, R. 2013. Modeling agriculture in the Community Land Model. Geosci. Model Dev. 6:495-515. DOI:10.5194/gmd-6-495-2013. .. _Dunfieldetal1993: +|br| + Dunfield, P., Knowles, R., Dumont, R. and Moore, T.R., 1993. Methane Production and Consumption in Temperate and Sub-Arctic Peat Soils - Response to Temperature and Ph. Soil Biology & Biochemistry 25:321-326. .. _EntekhabiEagleson1989: +|br| + Entekhabi, D., and Eagleson, P.S. 1989. Land surface hydrology parameterization for atmospheric general circulation models including subgrid scale spatial variability. J. Climate 2:816-831. .. _FangStefan1996: +|br| + Fang, X. and Stefan, H.G., 1996. Long-term lake water temperature and ice cover simulations/measurements. Cold Regions Science and Technology 24:289-304. .. _Farouki1981: +|br| + Farouki, O.T. 1981. The thermal properties of soils in cold regions. Cold Regions Sci. and Tech. 5:67-75. .. _Farquharetal1980: +|br| + Farquhar, G.D., von Caemmerer, S., and Berry, J.A. 1980. A biochemical model of photosynthetic CO\ :sub:`2` assimilation in leaves of C\ :math:`{}_{3}` species. Planta 149:78-90. .. _FarquharvonCaemmerer1982: +|br| + Farquhar, G.D., and von Caemmerer, S. 1982. Modeling of photosynthetic response to environmental conditions. pp. 549-587. In: O.L. Lange, P.S. Nobel, C.B. Osmond, and H. Zeigler (editors) Encyclopedia of Plant @@ -477,48 +642,66 @@ and Carbon Assimilation. Springer-Verlag, New York. .. _Ferrari1999: +|br| + Ferrari, J.B., 1999. Fine-scale patterns of leaf litterfall and nitrogen cycling in an old-growth forest. Canadian Journal of Forest Research, 29: 291-302. .. _FirestoneDavidson1989: +|br| + Firestone, M.K. and Davidson, E.A. 1989. Exchange of Trace Gases between Terrestrial Ecosystems and the Atmosphere. In: M.O. Andreae and D.S. Schimel (Editors). John Wiley and Sons, pp. 7-21. .. _Fisheretal2015: +|br| + Fisher, R. A., S. Muszala, M. Verteinstein, P. Lawrence, C. Xu, N. G. McDowell, R. G. Knox, C. Koven, J. Holm, B. M. Rogers, A. Spessa, D. Lawrence, and G. Bonan, 2015: Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes, CLM4.5(ED). Geosci. Model Dev., 8: 3593-3619, doi:10.5194/gmd-8-3593-2015. .. _Fisheretal2010: +|br| + Fisher, J. B., S. Sitch, Y. Malhi, R. A. Fisher, C. Huntingford, and S.-Y. Tan, 2010. Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation. Global Biogeochem. Cycles, 24, GB1014, doi:10.1029/2009GB003621. .. _FlannerZender2005: +|br| + Flanner, M.G., and Zender. C.S. 2005. Snowpack radiative heating: Influence on Tibetan Plateau climate. Geophys. Res. Lett. 32:L06501. DOI:10.1029/2004GL022076. .. _FlannerZender2006: +|br| + Flanner, M.G., and Zender, C.S. 2006. Linking snowpack microphysics and albedo evolution. J. Geophys. Res. 111:D12208. DOI:10.1029/2005JD006834. .. _Flanneretal2007: +|br| + Flanner, M.G., Zender, C.S., Randerson, J.T., and Rasch, P.J. 2007. Present day climate forcing and response from black carbon in snow. J. Geophys. Res. 112:D11202. DOI:10.1029/2006JD008003. .. _Flatauetal1992: +|br| + Flatau, P.J., Walko, R.L., and Cotton, W.R. 1992. Polynomial fits to saturation vapor pressure. J. Appl. Meteor. 31:1507-1513. .. _Friedl,etal2002: +|br| + Friedl, M.A., McIver, D.K., Hodges, J.C.F., Zhang, X.Y., Muchoney, D., Strahler, A.H., Woodcock, C.E., Gopal, S., Schneider, A., Cooper, A., Baccini, A., Gao, F., and Schaaf, C. 2002. Global land cover mapping @@ -527,17 +710,23 @@ from MODIS: algorithms and early results. Remote Sens. Environ. .. _Frolkingetal2001: +|br| + Frolking, S., et al. 2001. Modeling Northern Peatland Decomposition and Peat Accumulation. Ecosystems. 4:479-498. .. _Gallaisetal2006: +|br| + Gallais, A., Coque, M. Quillere, I., Prioul, J., and Hirel, B. 2006. Modeling postsilking nitrogen fluxes in maize (Zea mays) using 15N-labeling field experiments. New Phytologist 172:696-707. .. _Gallaisetal2007: +|br| + Gallais, A., Coque, M., Gouis, J. L., Prioul, J. L., Hirel, B., and Quillere, I. 2007. Estimating the proportion of nitrogen remobilization and of postsilking nitrogen uptake allocated to maize kernels by @@ -545,11 +734,15 @@ Nitrogen-15 labeling. Crop Sci. 47:685-693. .. _Gallowayetal2004: +|br| + Galloway, J.N., et al. 2004. Nitrogen cycles: past, present, and future. Biogeochem. 70:153-226. .. _Garciaetal1988: +|br| + Garcia, R.L., Kanemasu, E.T., Blad, B.L., Bauer, A., Hatfield, J.L., Major, D.A., Reginato, R.J., and Hubbard, K.G. 1988. Interception and use efficiency of light in winter wheat under different nitrogen @@ -557,11 +750,15 @@ regimes. Agric. For. Meteor. 44:175-186. .. _Gardner1960: -Gardner, W. R. 1960. Dynamic aspects of water availability to plants, +|br| + +Gardner, W. R. 1960. Dynamic aspects of water availability to plants, Soil Sci., 89, 63–73. .. _Gashetal1996: +|br| + Gash, J.H.C., Nobre, C.A., Roberts, J.M., and Victoria, R.L. 1996. An overview of ABRACOS. pp. 1-14. In: J.H.C. Gash, C.A. Nobre, J.M. Roberts, and R.L. Victoria (editors) Amazonian Deforestation and @@ -569,16 +766,22 @@ Climate. John Wiley and Sons, Chichester, England. .. _Getiranaetal2012: +|br| + Getirana, A. C. V., A. Boone, D. Yamazaki, B. Decharme, F. Papa, and N. Mognard. 2012. The hydrological modeling and analysis platform (HyMAP): Evaluation in the Amazon basin, J. Hydrometeorol., 13, 1641-1665. .. _Ghimireetal2016: +|br| + Ghimire, B., W. J. Riley, C. D. Koven, M. Mu, and J. T. Randerson, 2016: Representing leaf and root physiological traits in CLM improves global carbon and nitrogen cycling predictions. J. Adv. Mod. Earth Sys. 8: 598-613. .. _Gholzetal1985: +|br| + Gholz, H.L., Perry, C.S., Cropper, W.P., Jr. and Hendry, L.C., 1985. Litterfall, decomposition, and nitrogen and phosphorous dynamics in a chronosequence of slash pine (*Pinus elliottii*) plantations. Forest @@ -586,6 +789,8 @@ Science, 31: 463-478. .. _Giglioetal2006: +|br| + Giglio, L., Csiszar, I., and Justice, C.O. 2006. Global distribution and seasonality of active fires as observed with the Terra and Aqua Moderate Resolution Imaging Spectroradiometer (MODIS) sensors. J. Geophys. Res. @@ -593,24 +798,32 @@ Resolution Imaging Spectroradiometer (MODIS) sensors. J. Geophys. Res. .. _GlobalSoilDataTask2000: +|br| + Global Soil Data Task 2000. Global soil data products CD-ROM (IGBP-DIS). International Geosphere-Biosphere Programme-Data and Information Available Services [Available online at http://www.daac.ornl.gov]. .. _Gomesetal2003: +|br| + Gomes, E.P.C., Mantovani, W., and Kageyama, P.Y. 2003. Mortality and recruitment of trees in a secondary montane rain forest in southeastern Brazil. Brazilian Journal of Biology 63:47-60. .. _Goszetal1973: +|br| + Gosz, J.R., Likens, G.E., and Bormann, F.H. 1973. Nutrient release from decomposing leaf and branch litter in the Hubbard Brook Forest, New Hampshire. Ecological Monographs 43:173-191. .. _GotangcoCastilloetal2012: +|br| + Gotangco Castillo C., Levis S., and Thornton P. 2012. Evaluation of the new CNDV option of the Community Land Model: Effects of dynamic vegetation and interactive nitrogen on CLM4 means and variability. J. @@ -618,29 +831,39 @@ Climate 25:3702-3714. DOI:10.1175/JCLID-11-00372.1. .. _Grahametal1999: +|br| + Graham, S.T., Famiglietti, J.S., and Maidment, D.R. 1999. Five-minute, 1/2º, and 1º data sets of continental watersheds and river networks for use in regional and global hydrologic and climate system modeling studies. Water Resour. Res. 35:583-587. -.. _Gravenetal2017: +.. _Gravenetal2017: + +|br| Graven, H., C. E. Allison, D. M. Etheridge, S. Hammer, R. F. Keeling, I. Levin, H. A. J. Meijer, M. Rubino, P. P. Tans, C. M. Trudinger, B. H. Vaughn and J. W. C. White (2017) Compiled records of carbon isotopes in atmospheric CO2 for historical simulations in CMIP6, Geoscientific Model Development, in review. doi: 10.5194/gmd-2017-166. .. _GrenfellWarren1999: +|br| + Grenfell, T.C., and Warren, S.G. 1999. Representation of a nonspherical ice particle by a collection of independent spheres for scattering and absorption of radiation. J. Geophys. Res. 104(D24):37697-37709. .. _delGrossoetal2000: +|br| + del Grosso, S.J., et al. 2000. General model for N2O and N2 gas emissions from soils due to dentrification. Global Biogeochem. Cycles 14:1045-1060. .. _Guentheretal1995: +|br| + Guenther, A., Hewitt, C.N., Erickson, D., Fall, R., Geron, C., Graedel, T., Harley, P., Klinger, L., Lerdau, M., McKay, W.A., Pierce, T., Scholes, B., Steinbrecher, R., Tallamraju, R., Taylor, J., and @@ -649,6 +872,8 @@ emissions. J. Geophys. Res. 100:8873-8892. .. _Guentheretal2006: +|br| + Guenther, A., Karl, T., Harley, P., Wiedinmyer, C., Palmer. P.I., and Geron, C. 2006. Estimates of global terrestrial isoprene emissions using MEGAN (Model of Emissions of Gases and Aerosols from Nature). Atmos. @@ -656,6 +881,8 @@ Chem. Phys. 6:3181–3210. .. _Guentheretal2012: +|br| + Guenther, A. B., Jiang, X., Heald, C. L., Sakulyanontvittaya, T., Duhl, T., Emmons, L. K., & Wang, X., 2012. The Model of Emissions of Gases and Aerosols from Nature version 2.1 (MEGAN2.1): an extended and updated @@ -664,6 +891,8 @@ framework for modeling biogenic emissions, Geosci. Model Dev., 5, .. _Hacketal2006: +|br| + Hack, J.J., Caron, J.M., Yeager, S.G., Oleson, K.W., Holland, M.M., Truesdale, J.E., and Rasch, P.J. 2006. Simulation of the global hydrological cycle in the CCSM Community Atmosphere Model version 3 @@ -671,6 +900,8 @@ hydrological cycle in the CCSM Community Atmosphere Model version 3 .. _Hansenetal2003: +|br| + Hansen, M., DeFries, R.S., Townshend, J.R.G., Carroll, M., Dimiceli, C., and Sohlberg, R.A. 2003. Global percent tree cover at a spatial resolution of 500 meters: first results of the MODIS vegetation @@ -678,6 +909,8 @@ continuous fields algorithm. Earth Interactions 7:1-15. .. _Hastingsetal1999: +|br| + Hastings, D.A., Dunbar, P.K., Elphingstone, G.M., Bootz, M., Murakami, H., Maruyama, H., Masaharu, H., Holland, P., Payne, J., Bryant, N.A., Logan, T.L., Muller, J.-P., Schreier, G., and MacDonald, J.S., eds., @@ -688,6 +921,8 @@ Colorado 80305-3328, U.S.A. .. _Healdetal2008: +|br| + Heald, C.L., Henze, D.K., Horowitz, L.W., Feddema, J., Lamarque, J.-F., Guenther, A., Hess, P.G., Vitt, F., Seinfeld, J.H., Goldstein, A.H., and Fung, I. 2008. Predicted change in global secondary organic aerosol @@ -696,6 +931,8 @@ change. J. Geophys. Res. 113:D05211. DOI:10.1029/2007JD009092. .. _Healdetal2009: +|br| + Heald, C.L., Wilkinson, M.J., Monson, R.K., Alo, C.A., Wang, G.L., and Guenther, A. 2009. Response of isoprene emission to ambient CO\ :sub:`2` changes and implications for global budgets. Global @@ -703,40 +940,54 @@ Change Biol. 15:1127-1140. DOI:10.1111/j.1365-2486.2008.01802.x .. _Henderson-Sellers1985: +|br| + Henderson-Sellers, B. 1985. New formulation of eddy diffusion thermocline models. Appl. Math. Modelling 9:441-446. .. _Henderson-Sellers1986: +|br| + Henderson-Sellers, B. 1986. Calculating the surface energy balance for lake and reservoir modeling: A review. Rev. Geophys. 24:625-649. .. _Henderson-Sellersetal1993: +|br| + Henderson-Sellers, A., Yang, Z.-L., and Dickinson, R.E. 1993. The project for intercomparison of land-surface parameterization schemes. Bull. Amer. Meteor. Soc. 74: 1335-1349. .. _HostetlerBartlein1990: +|br| + Hostetler, S.W., and Bartlein, P.J. 1990. Simulation of lake evaporation with application to modeling lake level variations of Harney-Malheur Lake, Oregon. Water Resour. Res. 26:2603-2612. .. _Hostetleretal1993: +|br| + Hostetler, S.W., Bates, G.T., and Giorgi, F. 1993. Interactive coupling of a lake thermal model with a regional climate model. J. Geophys. Res. 98:5045-5057. .. _Hostetleretal1994: +|br| + Hostetler, S.W., Giorgi, F., Bates, G.T., and Bartlein, P.J. 1994. Lake-atmosphere feedbacks associated with paleolakes Bonneville and Lahontan. Science 263:665-668. .. _Houetal2012: +|br| + Hou, Z., Huang, M., Leung, L.R., Lin, G., and Ricciuto, D.M. 2012. Sensitivity of surface flux simulations to hydrologic parameters based on an uncertainty quantification framework applied to the Community Land @@ -744,10 +995,14 @@ Model. J. Geophys. Res. 117:D15108. .. _Houltonetal2008: +|br| + Houlton, B.Z., Wang, Y.P., Vitousek, P.M. and Field, C.B., 2008. A unifying framework for dinitrogen fixation in the terrestrial biosphere. Nature, 454(7202), p.327. .. _HuangLiang2006: +|br| + Huang, M., and Liang, X. 2006. On the assessment of the impact of reducing parameters and identification of parameter uncertainties for a hydrologic model with applications to ungauged basins. J. Hydrol. @@ -755,6 +1010,8 @@ hydrologic model with applications to ungauged basins. J. Hydrol. .. _Hugeliusetal2012: +|br| + Hugelius, G., C. Tarnocai, G. Broll, J.G. Canadell, P. Kuhry, adn D.K. Swanson, 2012. The Northern Circumpolar Soil Carbon Database: spatially distributed datasets of soil coverage and soil carbon storage in the @@ -763,18 +1020,24 @@ northern permafrost regions. Earth Syst. Sci. Data Discuss., 5, 707-733 .. _Huntetal1988: +|br| + Hunt, H.W., Ingham, E.R., Coleman, D.C., Elliott, E.T., and Reid, C.P.P. 1988. Nitrogen limitation of production and decomposition in prairie, mountain meadow, and pine forest. Ecology 69:1009-1016. .. _HuntRunning1992: +|br| + Hunt, E.R., Jr. and Running, S.W., 1992. Simulated dry matter yields for aspen and spruce stands in the north american boreal forest. Canadian Journal of Remote Sensing, 18: 126-133. .. _Huntetal1996: +|br| + Hunt, E.R., Jr. et al., 1996. Global net carbon exchange and intra-annual atmospheric CO\ :sub:`2` concentrations predicted by an ecosystem process model and three-dimensional atmospheric transport @@ -782,6 +1045,8 @@ model. Global Biogeochemical Cycles, 10: 431-456. .. _Hurttetal2006: +|br| + Hurtt, G.C., Frolking, S., Fearon, M.G., Moore, B., Shevliakova, E., Malyshev, S., Pacala, S.W., and Houghton, R.A. 2006. The underpinnings of land-use history: three centuries of global gridded land-use @@ -790,6 +1055,8 @@ Global Change Biol. 12:1208-1229. .. _Hurttetal2011: +|br| + Hurtt, G.C., et al. 2011. Harmonization of land-use scenarios for the period 1500-2100: 600 years of global gridded annual land-use transitions, wood harvest, and resulting secondary lands. Climatic @@ -797,23 +1064,31 @@ Change 109:117-161. DOI:10.1007/s10584-011-0153-2. .. _Idso1981: +|br| + Idso, S.B. 1981. A set of equations for full spectrum and 8- to 14-\ :math:`\mu` \ m and 10.5- to 12.5-\ :math:`\mu` \ m thermal radiation from cloudless skies. Water Resour. Res. 17:295-304. .. _IiyamaHasegawa2005: +|br| + Iiyama, I. and Hasegawa, S., 2005. Gas diffusion coefficient of undisturbed peat soils. Soil Science and Plant Nutrition 51:431-435. .. _Jacksonetal1996: +|br| + Jacksonetal1996: E., and Schulze, E. D. 1996. A global analysis of root distributions for terrestrial biomes Oecologia 108:389–411. DOI:10.1007/BF00333714. .. _Jacksonetal2010: +|br| + Jackson, T.L., Feddema, J.J., Oleson, K.W., Bonan, G.B., and Bauer, J.T. 2010. Parameterization of urban characteristics for global climate modeling. Annals of the Association of American Geographers. @@ -821,24 +1096,32 @@ modeling. Annals of the Association of American Geographers. .. _JenkinsonColeman2008: +|br| + Jenkinson, D. and Coleman, K. 2008. The turnover of organic carbon in subsoils. Part 2. Modelling carbon turnover. European Journal of Soil Science 59:400-413. .. _Jordan1991: +|br| + Jordan, R. 1991. A One-dimensional Temperature Model for a Snow Cover: Technical Documentation for SNTHERM.89. U.S. Army Cold Regions Research and Engineering Laboratory, Special Report 91-16. .. _KattgeKnorr2007: +|br| + Kattge, J., and Knorr, W. 2007. Temperature acclimation in a biochemical model of photosynthesis: a reanalysis of data from 36 species. Plant Cell Environ. 30:1176-1190. DOI:10.1111/j.1365-3040.2007.01690.x. .. _Kattgeetal2009: +|br| + Kattge, J., Knorr, W., Raddatz, T., and Wirth C. 2009: Quantifying photosynthetic capacity and its relationship to leaf nitrogen content for global–scale terrestrial biosphere models. Global Change Biol. @@ -846,18 +1129,24 @@ for global–scale terrestrial biosphere models. Global Change Biol. .. _Kavetskietal2002: -Kavetski, D., Binning, P. and Sloan, S.W., 2002. Noniterative time -stepping schemes with adaptive truncation error control for the +|br| + +Kavetski, D., Binning, P. and Sloan, S.W., 2002. Noniterative time +stepping schemes with adaptive truncation error control for the solution of Richards equation. Water Resources Research, 38(10). .. _Kelleretal2004: +|br| + Keller, M., Palace, M., Asner, G.P., Pereira, R., Jr. and Silva, J.N.M., 2004. Coarse woody debris in undisturbed and logged forests in the eastern Brazilian Amazon. Global Change Biology, 10: 784-795. .. _Kellneretal2006: +|br| + Kellner, E., Baird, A.J., Oosterwoud, M., Harrison, K. and Waddington, J.M., 2006. Effect of temperature and atmospheric pressure on methane (CH4) ebullition from near-surface peats. Geophys. Res. Lett. 33. @@ -865,24 +1154,32 @@ DOI:10.1029/2006GL027509. .. _Kimballetal1997: +|br| + Kimball, J.S., Thornton, P.E., White, M.A. and Running, S.W. 1997. Simulating forest productivity and surface-atmosphere exchange in the BOREAS study region. Tree Physiology 17:589-599. .. _Kohyamaetal2001: +|br| + Kohyama, T., Suzuki, E., Partomihardjo, T., and Yamada, T. 2001. Dynamic steady state of patch-mosaic tree size structure of a mixed diptocarp forest regulated by local crowding. Ecological Research 16:85-98. .. _Kourzeneva2009: +|br| + Kourzeneva, E., 2009. Global dataset for the parameterization of lakes in Numerical Weather Prediction and Climate modeling. ALADIN Newsletter, No 37, July-December, 2009, F. Bouttier and C. Fischer, Eds., Meteo-France, Toulouse, France, 46-53. -.. _Kourzeneva2010: +.. _Kourzeneva2010: + +|br| Kourzeneva, E., 2010: External data for lake parameterization in Numerical Weather Prediction and climate modeling. Boreal Environment @@ -890,30 +1187,40 @@ Research, 15, 165-177. .. _Kourzenevaetal2012: +|br| + Kourzeneva, E., Asensio, H., Martin, E. and Faroux, S., 2012. Global gridded dataset of lake coverage and lake depth for use in numerical weather prediction and climate modelling. Tellus A 64. .. _Kovenetal2009: +|br| + Koven, C., et al. 2009. On the formation of high-latitude soil carbon stocks: The effects of cryoturbation and insulation by organic matter in a land surface model. Geophys. Res. Lett. 36: L21501. .. _Kovenetal2011: +|br| + Koven, C.D., et al. 2011. Permafrost carbon-climate feedbacks accelerate global warming. Proceedings of the National Academy of Sciences 108:14769-14774. .. _Kovenetal2013: +|br| + Koven, C.D. et al. 2013. The effect of vertically-resolved soil biogeochemistry and alternate soil C and N models on C dynamics of CLM4. Biogeosciences Discussions 10:7201-7256. .. _Kovenetal2015: +|br| + Koven, C.D. et al. 2015. Permafrost carbon-climate feedback is sensitive to deep soil carbon decomposability but not deep soil nitrogen dynamics. Proceedings of the National Academies of Science, @@ -921,10 +1228,14 @@ nitrogen dynamics. Proceedings of the National Academies of Science, .. _Kovenetal2017: +|br| + Koven, C.D., G. Hugelius, D.M. Lawrence, and W.R. Wieder, 2017: Higher climatological temperature sensitivity of soil carbon in cold than warm climates. Nature Clim. Change, 7, doi:10.1038/nclimate3421. .. _Kuchariketal2000: +|br| + Kucharik, C.J., Foley, J.A., Delire, C., Fisher, V.A., Coe, M.T., Lenters, J.D., Young-Molling, C., and Ramankutty, N. 2000. Testing the performance of a dynamic global ecosystem model: water balance, carbon @@ -933,6 +1244,8 @@ balance, and vegetation structure. Global Biogeochem. Cycles 14: .. _KucharikBrye2003: +|br| + Kucharik, C.J., and Brye, K.R. 2003. Integrated BIosphere Simulator (IBIS) yield and nitrate loss predictions for Wisconsin maize receiving varied amounts of nitrogen fertilizer. Journal of Environmental Quality @@ -940,6 +1253,8 @@ varied amounts of nitrogen fertilizer. Journal of Environmental Quality .. _Laddetal2992: +|br| + Ladd, J.N., Jocteur-Monrozier, L. and Amato, M., 1992. Carbon turnover and nitrogen transformations in an alfisol and vertisol amended with [U-:math:`{}^{14}`\ C] glucose and [:math:`{}^{15}`\ N] ammonium @@ -947,6 +1262,8 @@ sulfate. Soil Biology and Biochemistry, 24: 359-371. .. _Lamarqueetal2010: +|br| + Lamarque, J.-F., et al. 2010. Historical (1850-2000) gridded anthropogenic and biomass burning emissions of reactive gases and aerosols: methodology and application. Atmos. Chem. Phys. Discuss. @@ -954,23 +1271,31 @@ aerosols: methodology and application. Atmos. Chem. Phys. Discuss. .. _Larcher1995: +|br| + Larcher, W. 1995. Physiological Plant Ecology, Springer-Verlag, Berlin Heidelberg. .. _LavigneRyan1997: +|br| + Lavigne, M.B., and Ryan, M.G. 1997. Growth and maintenance respiration rates of aspen, black spruce, and jack pine stems at northern and southern BOREAS sites. Tree Phys. 17:543-551. .. _Lawetal2003: +|br| + Law, B.E., Sun, O.J., Campbell, J., Van Tuyl, S. and Thornton, P.E. 2003. Changes in carbon storage and fluxes in a chronosequence of ponderosa pine. Global Change Biology, 9: 510-514. .. _Lawrenceetal2007: +|br| + Lawrence, D.M., Thornton, P.E., Oleson, K.W., and Bonan, G.B. 2007. The partitioning of evapotranspiration into transpiration, soil evaporation, and canopy evaporation in a GCM: Impacts on land-atmosphere interaction. @@ -978,11 +1303,15 @@ J. Hydrometeor. 8:862-880. .. _LawrenceSlater2008: +|br| + Lawrence, D.M., and Slater, A.G. 2008. Incorporating organic soil into a global climate model. Clim. Dyn. 30. DOI:10.1007/s00382-007-0278-1. .. _Lawrenceetal2008: +|br| + Lawrence, D.M., Slater, A.G., Romanovsky, V.E., and Nicolsky, D.J. 2008. The sensitivity of a model projection of near-surface permafrost degradation to soil column depth and inclusion of soil organic matter. @@ -990,6 +1319,8 @@ J. Geophys. Res. 113:F02011. DOI:10.1029/2007JF000883. .. _Lawrenceetal2011: +|br| + Lawrence, D.M., K.W. Oleson, M.G. Flanner, P.E. Thornton, S.C. Swenson, P.J. Lawrence, X. Zeng, Z.-L. Yang, S. Levis, K. Sakaguchi, G.B. Bonan, and A.G. Slater, 2011. Parameterization improvements and functional and @@ -998,27 +1329,35 @@ Model. Earth Sys. 3. DOI:10.1029/2011MS000045. .. _Lawrenceetal2016: -Lawrence, D.M., Hurtt, G.C., Arneth, A., Brovkin, V., Calvin, K.V., +|br| + +Lawrence, D.M., Hurtt, G.C., Arneth, A., Brovkin, V., Calvin, K.V., Jones, A.D., Jones, C.D., Lawrence, P.J., de Noblet-Ducoudré, N., Pongratz, -J., Seneviratne, S.I., and Shevliakova, E. 2016. The Land Use Model +J., Seneviratne, S.I., and Shevliakova, E. 2016. The Land Use Model Intercomparison Project (LUMIP) contribution to CMIP6: rationale and experimental design. Geosci. Model Dev. 9:2973-2998. -DOI:10.5194/gmd-9-2973-2016. +DOI:10.5194/gmd-9-2973-2016. .. _LawrenceChase2007: +|br| + Lawrence, P.J., and Chase, T.N. 2007. Representing a MODIS consistent land surface in the Community Land Model (CLM 3.0). J. Geophys. Res. 112:G01023. DOI:10.1029/2006JG000168. .. _LawrenceChase2010: +|br| + Lawrence, P.J., and Chase, T.N. 2010. Investigating the climate impacts of global land cover change in the Community Climate System Model. Int. J. Climatol. 30:2066-2087. DOI:10.1002/joc.2061. .. _Lawrenceetal2012: +|br| + Lawrence, P.J., et al. 2012. Simulating the biogeochemical and biogeophysical impacts of transient land cover change and wood harvest in the Community Climate System Model (CCSM4) from 1850 to 2100. J. @@ -1026,16 +1365,22 @@ Climate 25:3071-3095. DOI:10.1175/JCLI-D-11-00256.1. .. _LehnerDoll2004: +|br| + Lehner, B. and Döll, P., 2004. Development and validation of a global database of lakes, reservoirs and wetlands, J. Hydrol., 296, 1–22. .. _Lehneretal2008: +|br| + Lehner, B., Verdin, K. and Jarvis, A., 2008. New global hydrograhy derived from spaceborne elevation data. Eos Trans., AGU, 89, 93 – 94. .. _LePageetal2010: +|br| + Le Page, Y., van der Werf, G.R., Morton, D.C., and Pereira, J.M.C. 2010. Modeling fire-driven deforestation potential in Amazonia under current and projected climate conditions. J. Geophys. Res. 115:G03012. @@ -1043,17 +1388,23 @@ DOI:10.1029/2009JG001190. .. _Lerman1979: +|br| + Lerman, A., 1979. Geochemical processes: Water and sediment environments. John Wiley and Sons, New York, N.Y. .. _Lettsetal2000: +|br| + Letts, M.G., Roulet, N.T., Comer, N.T., Skarupa, M.R., and Verseghy, D.L. 2000. Parametrization of peatland hydraulic properties for the Canadian Land Surface Scheme. Atmos.-Ocean 38:141-160. .. _Levisetal2003: +|br| + Levis, S., Wiedinmyer, C., Bonan, G.B., and Guenther, A. 2003. Simulating biogenic volatile organic compound emissions in the Community Climate System Model. J. Geophys. Res. 108:4659. @@ -1061,6 +1412,8 @@ DOI:10.1029/2002JD003203. .. _Levisetal2004: +|br| + Levis, S., Bonan, G.B., Vertenstein, M., and Oleson, K.W. 2004. The community land model’s dynamic global vegetation model (CLM-DGVM): technical description and user’s guide. NCAR Technical Note @@ -1069,12 +1422,16 @@ Colorado. 50 pp. .. _Levisetal2009: +|br| + Levis, S., Thornton, P., Bonan, G., and Kucharik, C. 2009. Modeling land use and land management with the Community Land Model. iLeaps newsletter, No. 7. .. _Levisetal2012: +|br| + Levis, S., Bonan, G., Kluzek, E., Thornton, P., Jones, A., Sacks, W., and Kucharik, C 2012. Interactive crop management in the Community Earth System Model (CESM1): Seasonal influences on land-atmosphere fluxes. J. @@ -1082,24 +1439,32 @@ Climate 25: 4839-4859. DOI:10.1175/JCLI-D-11-00446.1. .. _Levisetal2016: +|br| + Levis, S., Badger, A., Drewniak, B., Nevison, C., Ren, X. 2016. CLMcrop yields and water requirements: avoided impacts by choosing RCP 4.5 over 8.5. -Climatic Change. DOI:10.1007/s10584-016-1654-9. +Climatic Change. DOI:10.1007/s10584-016-1654-9. .. _Lietal2000: +|br| + Li, C., Aber, J., Stange, F., Butterbach-Bahl, K. and Papen, H. 2000. A process-oriented model of N2O and NO emissions from forest soils: 1. Model development. J. Geophys. Res. 105(D4):4369-4384. .. _Lietal2012a: +|br| + Li, F., Zeng, X.-D., and Levis, S. 2012a. A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model. Biogeosciences 9:2761-2780. .. _Lietal2012b: +|br| + Li, F., Zeng, X. D., and Levis, S. 2012b. Corrigendum to “A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model” published in Biogeosciences, 9, @@ -1107,18 +1472,24 @@ Dynamic Global Vegetation Model” published in Biogeosciences, 9, .. _Lietal2013a: +|br| + Li, F., Levis, S., and Ward, D. S. 2013a. Quantifying the role of fire in the Earth system – Part 1: Improved global fire modeling in the Community Earth System Model (CESM1). Biogeosciences 10:2293-2314. .. _LiLawrence2017: -Li, F., and Lawrence, D. 2017. Role of fire in the global land water -budget during the 20th century through changing ecosystems. +|br| + +Li, F., and Lawrence, D. 2017. Role of fire in the global land water +budget during the 20th century through changing ecosystems. J. Clim. 30: 1894-1908. .. _Lietal2013b: +|br| + Li, H.-Y., Huang, M., Tesfa, T., Ke, Y., Sun, Y., Liu, Y., and Leung, L. R. 2013b. A subbasin-based framework to represent land surface processes in an Earth System Model, Geosci. Model Dev. Discuss. 6:2699-2730. @@ -1126,6 +1497,8 @@ DOI:10.5194/gmdd-6-2699-2013. .. _Lietal2011: +|br| + Li, H., Huang, M., Wigmosta, M.S., Ke, Y., Coleman, A.M., Leung, L.R., Wang, A., and Ricciuto, D.M. 2011. Evaluating runoff simulations from the Community Land Model 4.0 using observations from flux towers and a @@ -1134,13 +1507,17 @@ DOI:10.1029/2011JD016276. .. _Lietal2015a: -Li, H., L. Leung, A. Getirana, M. Huang, H. Wu, Y. Xu, J. Guo and -N. Voisin. 2015a. Evaluating global streamflow simulations by a -physically-based routing model coupled with the Community Land Model, +|br| + +Li, H., L. Leung, A. Getirana, M. Huang, H. Wu, Y. Xu, J. Guo and +N. Voisin. 2015a. Evaluating global streamflow simulations by a +physically-based routing model coupled with the Community Land Model, J. of Hydromet., 16(2):948-971, doi: 10.1175/JHM-D-14-0079.1 .. _Lietal2015b: +|br| + Li, H., L. Leung, T. Tesfa, N. Voisin, M. Hejazi, L. Liu, Y. Liu, J. Rice, H. Wu, and X. Yang. 2015. Modeling stream temperature in the Anthropocene: An earth system modeling approach, J. Adv. Model. @@ -1148,41 +1525,55 @@ Earth Syst., 7, doi:10.1002/2015MS000471. .. _Liangetal1994: +|br| + Liang, X., Lettenmaier, D.P., Wood, E.F., and Burges, S.J. 1994. A simple hydrologically based model of land surface water and energy fluxes for GSMs. J. Geophys. Res. 99(D7):14,415–14,428. .. _LipscombSacks2012: +|br| + Lipscomb, W., and Sacks, W. 2012. The CESM land ice model documentation and user’s guide. 46 pp. [Available online at http://www.cesm.ucar.edu/models/cesm1.1/cism/]. .. _LloydTaylor1994: +|br| + Lloyd, J. and Taylor, J.A., 1994. On the temperature dependence of soil respiration. Functional Ecology, 8: 315-323. .. _Lloydetal2010: +|br| + Lloyd, J., et al. 2010. Optimisation of photosynthetic carbon gain and within-canopy gradients of associated foliar traits for Amazon forest trees. Biogeosci. 7:1833-1859. DOI:10.5194/bg-7-1833-2010. .. _Lobelletal2006: +|br| + Lobell, D.B., Bala, G., and Duffy, P.B. 2006. Biogeophysical impacts of cropland management changes on climate. Geophys. Res. Lett. 33:L06708. DOI:10.1029/2005GL025492. .. _Lombardozzietal2015: +|br| + Lombardozzi, D.L., Bonan, G.B., Smith, N.G., Dukes, J.S. 2015. Temperature -acclimation of photosynthesis and respiration: A key uncertainty in the +acclimation of photosynthesis and respiration: A key uncertainty in the carbon cycle-climate feedback. Geophys. Res. Lett. 42:8624-8631. .. _Lovelandetal2000: +|br| + Loveland, T.R., Reed, B.C., Brown, J.F., Ohlen, D.O., Zhu, Z., Yang, L., and Merchant, J.W. 2000. Development of a global land cover characteristics database and IGBP DISCover from 1 km AVHRR data. Int. J. @@ -1190,23 +1581,31 @@ Remote Sens. 21:1303-1330. .. _Lowe1977: +|br| + Lowe, P.R. 1977. An approximating polynomial for the computation of saturation vapor pressure. J. Appl. Meteor. 16:100-103. .. _Luoetal2006: +|br| + Luo, Y., Hui, D., and Zhang, D. 2006. Elevated CO2 stimulates net accumulations of carbon and nitrogen in land ecosystems: a meta-analysis. Ecology 87:53-63. .. _Magilletal1997: +|br| + Magill, A.H. et al., 1997. Biogeochemical response of forest ecosystems to simulated chronic nitrogen deposition. Ecological Applications, 7: 402-415. .. _Mahowaldetal2006: +|br| + Mahowald, N.M., Muhs, D.R., Levis, S., Rasch, P.J., Yoshioka, M., Zender, C.S., and Luo, C. 2006. Change in atmospheric mineral aerosols in response to climate: last glacial period, pre-industrial, modern and @@ -1215,17 +1614,23 @@ DOI:10.1029/2005JD006653. .. _Makela2002: +|br| + Makela, A. 2002. Derivation of stem taper from the pipe model theory in a carbon balance framework. Tree Phys. 22:891-905. .. _Maoetal2012: +|br| + Mao, J., Thornton, P.E., Shi, X., Zhao, M., and Post, W.M. 2012. Remote sensing evaluation of CLM4 GPP for the period 2000 to 2009. J. Climate 25:5327-5342. .. _Maoetal2013: +|br| + Mao, J., Shi, X., Thornton, P.E., Hoffman, F.M., Zhu, Z., and Ranga B. Myneni, R.B. 2013. Global latitudinal-asymmetric vegetation growth trends and their driving mechanisms: 1982-2009. Remote Sensing @@ -1233,18 +1638,24 @@ trends and their driving mechanisms: 1982-2009. Remote Sensing .. _Martinetal1980: +|br| + Martin, J.P., Haider, K. and Kassim, G., 1980. Biodegradation and stabilization after 2 years of specific crop, lignin, and polysaccharide carbons in soils. Soil Science Society of America Journal 44:1250-1255. .. _Maryetal1993: +|br| + Mary, B., Fresneau, C., Morel, J.L. and Mariotti, A., 1993. C and N cycling during decomposition of root mucilage, roots and glucose in soil. Soil Biology and Biochemistry 25:1005-1014. .. _McGuireetal1992: +|br| + McGuire, A.D., Melillo, J.M., Joyce, L.A., Kicklighter, D.W., Grace, A.L., Moore III, B., and Vorosmarty, C.J. 1992. Interactions between carbon and nitrogen dynamics in estimating net primary productivity for @@ -1253,53 +1664,71 @@ potential vegetation in North America. Global Biogeochem. Cycles .. _Medlynetal2011: -Medlyn, B.E., Duursma, R.A., Eamus, D., Ellsworth, D.S., Prentice, I.C., -Barton, C.V.M., Crous, K.Y., De Angelis, P., Freeman, M., and -Wingate, L. (2011), Reconciling the optimal and empirical approaches to -modelling stomatal conductance. Global Change Biology, 17: 2134–2144. +|br| + +Medlyn, B.E., Duursma, R.A., Eamus, D., Ellsworth, D.S., Prentice, I.C., +Barton, C.V.M., Crous, K.Y., De Angelis, P., Freeman, M., and +Wingate, L. (2011), Reconciling the optimal and empirical approaches to +modelling stomatal conductance. Global Change Biology, 17: 2134–2144. doi:10.1111/j.1365-2486.2010.02375.x .. _MelzerOLeary1987: +|br| + Melzer, E., and O’Leary, M.H. 1987. Anapleurotic CO2 Fixation by Phosphoenolpyruvate Carboxylase in C3 Plants. Plant. Physiol. 84:58. .. _Milleretal1994: +|br| + Miller, J.R., Russell, G.L., and Caliri, G. 1994. Continental-scale river flow in climate models. J. Climate 7:914-928. .. _MillingtonQuirk1961: +|br| + Millington, R. and Quirk, J.P., 1961. Permeability of Porous Solids. Transactions of the Faraday Society 57:1200-1207. .. _Mironovetal2010: +|br| + Mironov, D. et al., 2010. Implementation of the lake parameterisation scheme FLake into the numerical weather prediction model COSMO. Boreal Environment Research 15:218-230. .. _MitchellJones2005: +|br| + Mitchell, T.D., and Jones, P.D. 2005. An improved method of constructing a database of monthly climate observations and associated high-resolution grids. Int. J. Climatol. 25:693-712. .. _Moldrupetal2003: +|br| + Moldrup, P. et al. 2003. Modeling diffusion and reaction in soils: X. A unifying model for solute and gas diffusivity in unsaturated soil. Soil Science 168:321-337. .. _Mynenietal2002: +|br| + Myneni, R.B., et al. 2002. Global products of vegetation leaf area and fraction absorbed PAR from year one of MODIS data. Remote Sens. Environ. 83:214-231. .. _Neffetal2005: +|br| + Neff, J.C., Harden, J.W. and Gleixner, G. 2005. Fire effects on soil organic matter content, composition, and nutrients in boreal interior Alaska. Canadian Journal of Forest Research-Revue Canadienne De @@ -1307,6 +1736,8 @@ Recherche Forestiere 35:2178-2187. .. _Neitschetal2005: +|br| + Neitsch, S.L., Arnold, J.G., Kiniry, J.R., and Williams J.R. 2005. Soil and Water Assessment Tool, Theoretical Documentation: Version 2005. Temple, TX. USDA Agricultural Research Service and Texas A&M Blackland @@ -1314,17 +1745,23 @@ Research Center. .. _NegronJuarezetal2015: +|br| + Negron-Juarez, R. Koven, C.D., Riley, W.J., Knox, R.G., Chambers, J.Q. 2015. Environmental Research Letters 10:064017. DOI:10.1088/1748-9326/10/6/064017. .. _NemaniRunning1996: +|br| + Nemani, R.R., and Running, S.W. 1996. Implementation of a hierarchical global vegetation classification in ecosystem function models. J. Veg. Sci. 7:337-346. .. _Niinemetstal1998: +|br| + Niinemets, U., Kull, O., and Tenhunen, J.D. 1998. An analysis of light effects on foliar morphology, physiology, and light interception in temperate deciduous woody species of contrasting shade tolerance. Tree @@ -1332,12 +1769,16 @@ Phys. 18:681-696. .. _Niuetal2005: +|br| + Niu, G.-Y., Yang, Z.-L., Dickinson, R.E., and Gulden, L.E. 2005. A simple TOPMODEL-based runoff parameterization (SIMTOP) for use in global climate models. J. Geophys. Res. 110:D21106. DOI:10.1029/2005JD006111. .. _NiuYang2006: +|br| + Niu, G.-Y., and Yang, Z.-L. 2006. Effects of frozen soil on snowmelt runoff and soil water storage at a continental scale. J. Hydrometeor. 7:937-952. @@ -1353,17 +1794,23 @@ basins. J. Geophys. Res. 112:D21101. DOI:10.1029/2007JD008674. .. _Oikawaetal2005: +|br| + Oikawa, S., Hikosaka, K. and Hirose, T., 2005. Dynamics of leaf area and nitrogen in the canopy of an annual herb, Xanthium canadense. Oecologia, 143: 517-526. .. _Oke1987: +|br| + Oke, T. 1987. Boundary Layer Climates (2:math:`{}^{nd}` edition). Routledge, London and New York. .. _OlesonBonan2000: +|br| + Oleson, K.W., and Bonan, G.B. 2000. The effects of remotely-sensed plant functional type and leaf area index on simulations of boreal forest surface fluxes by the NCAR land surface model. J. Hydrometeor. @@ -1371,6 +1818,8 @@ surface fluxes by the NCAR land surface model. J. Hydrometeor. .. _Olesonetal2004: +|br| + Oleson, K.W., Dai, Y., Bonan, G., Bosilovich, M., Dickinson, R., Dirmeyer, P., Hoffman, F., Houser, P., Levis, S., Niu, G.-Y., Thornton, P., Vertenstein, M., Yang, Z.-L., and Zeng. X. 2004. Technical @@ -1380,6 +1829,8 @@ Colorado. 173 pp. .. _Olesonetal2008a: +|br| + Oleson, K.W., Niu, G.-Y., Yang, Z.-L., Lawrence, D.M., Thornton, P.E., Lawrence, P.J., Stöckli, R., Dickinson, R.E., Bonan, G.B., Levis, S., Dai, A., and Qian, T. 2008a. Improvements to the Community Land Model @@ -1388,6 +1839,8 @@ DOI:10.1029/2007JG000563. .. _Olesonetal2008b: +|br| + Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Grimmond, C.S.B. 2008b. An urban parameterization for a global climate model. 1. Formulation and evaluation for two cities. J. Appl. Meteor. Clim. @@ -1395,6 +1848,8 @@ Formulation and evaluation for two cities. J. Appl. Meteor. Clim. .. _Olesonetal2008c: +|br| + Oleson, K.W., Bonan, G.B., Feddema, J., and Vertenstein, M. 2008c. An urban parameterization for a global climate model. 2. Sensitivity to input parameters and the simulated urban heat island in offline @@ -1402,12 +1857,16 @@ simulations. J. Appl. Meteor. Clim. 47:1061-1076. .. _Olesonetal2010a: +|br| + Oleson, K.W., et al. 2010a. Technical description of version 4.0 of the Community Land model (CLM). NCAR Technical Note NCAR/TN-478+STR, National Center for Atmospheric Research, Boulder, CO, 257 pp. .. _Olesonetal2010b: +|br| + Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Kluzek, E. 2010b. Technical description of an urban parameterization for the Community Land Model (CLMU). NCAR Technical Note NCAR/TN-480+STR, @@ -1415,17 +1874,23 @@ National Center for Atmospheric Research, Boulder, CO, 169 pp. .. _Olesonetal2013: -Oleson, K.W., et al. 2013. Technical description of version 4.5 of the +|br| + +Oleson, K.W., et al. 2013. Technical description of version 4.5 of the Community Land Model (CLM). NCAR Technical Note NCAR/TN-503+STR, National Center for Atmospheric Research, Boulder, CO, 420 pp. .. _Olson1963: +|br| + Olson, J.S., 1963. Energy storage and the balance of producers and decomposers in ecological systems. Ecology 44:322-331. .. _Olsonetal2001: +|br| + Olson, D.M., Dinerstein, E., Wikramanayake, E.D., Burgess, N.D., Powell, G.V.N., Underwood, E.C., D’Amico, J.A., Itoua, I., Strand, H. E., Morrison, J. C., Loucks, C. J., Allnutt, T. F., Ricketts, T. H., Kura, @@ -1435,17 +1900,23 @@ Bioscience, 51, 933–938. .. _OrchardCook1983: +|br| + Orchard, V.A. and Cook, F.J., 1983. Relationship between soil respiration and soil moisture. Soil Biology and Biochemistry, 15: 447-453. .. _Owen1964: +|br| + Owen, P.R. 1964. Saltation of uniform grains in air. J. Fluid Mech\ *.* 20:225-242. .. _Ozdoganetal2010: +|br| + Ozdogan, M., Rodell, M., Beaudoing, H.K., and Toll, D.L. 2010. Simulating the effects of irrigation over the United States in a land surface model based on satellite-derived agricultural data. Journal of @@ -1453,80 +1924,110 @@ Hydrometeorology 11:171-184. .. _Pageetal2002: +|br| + Page, S.E., Siegert, F., Rieley, J.O., Boehm, H-D.V., Jaya, A., and Limin, S. 2002. The amount of carbon released from peat and forest fires in Indonesia in 1997. Nature 420:61-65. .. _PanofskyDutton1984: +|br| + Panofsky, H.A., and Dutton, J.A. 1984. Atmospheric Turbulence: Models and Methods for Engineering Applications. John Wiley and Sons, New York. .. _Partonetal1988: +|br| + Parton, W., Stewart, J. and Cole, C., 1988. Dynamics of C, N, P And S in Grassland Soils - A Model. Biogeochemistry 5:109-131. .. _Partonetal1993: +|br| + Parton, W.J., et al. 1993. Observations and modeling of biomass and soil organic matter dynamics for the grassland biome worlwide. Global Biogeochemical Cycles 7:785-809. .. _Partonetal1996: +|br| + Parton, W. et al. 1996. Generalized model for N2 and N2O production from nitrification and denitrification. Global Biogeochemical Cycles 10:401-412. .. _Partonetal2001: +|br| + Parton, W.J. et al. 2001. Generalized model for NOx and N2O emissions from soils. J. Geophys. Res. 106(D15):17403-17419. .. _Paterson1994: +|br| + Paterson, W.S.B., 1994. The Physics of Glaciers. Elsevier Science Inc., New York, 480 pp. .. _Pelletieretal2016: +|br| + Pelletier, J. D., P. D. Broxton, P. Hazenberg, X. Zeng, P. A. Troch, G. Y. Niu, Z. Williams, M. A. Brunke, and D. Gochis, 2016: A gridded global data set of soil, intact regolith, and sedimentary deposit thicknesses for regional and global land surface modeling. J. Adv. Mod. Earth Sys. 8:41-65. .. _Petrescuetal2010: +|br| + Petrescu, A.M.R. et al. 2010. Modeling regional to global CH4 emissions of boreal and arctic wetlands. Global Biogeochemical Cycles, 24(GB4009). .. _Philip1957: +|br| + Philip, J.R. 1957. Evaporation, and moisture and heat fields in the soil. J. Meteor. 14:354-366. .. _Piaoetal2012: +|br| + Piao, S.L., et al. 2012. The carbon budget of terrestrial ecosystems in East Asia over the last two decades. Biogeosciences 9:3571-3586. .. _Pivovarov1972: +|br| + Pivovarov, A.A., 1972. Thermal Conditions in Freezing Lakes and Reservoirs. John Wiley, New York. .. _Pollmeretal1979: +|br| + Pollmer, W.G., Eberhard, D., Klein, D., and Dhillon, B.S. 1979. Genetic control of nitrogen uptake and translocation in maize. Crop Sci. 19:82-86. .. _Pomeroyetal1998: +|br| + Pomeroy, J. W., D. M. Gray, K. R. Shook, B. Toth, R. L. H. Essery, A. Pietroniro, and N. Hedstrom. 1998. An evaluation of snow accumulation and ablation processes for land surface modelling. Hydrol. Process. 12:2339–2367. .. _Portmannetal2010: +|br| + Portmann, F.T., Siebert, S., and Döll, P. 2010. MIRCA2000 - Global monthly irrigated and rainfed crop areas around the year 2000: A new high-resolution data set for agricultural and hydrological modeling. @@ -1534,18 +2035,24 @@ Global Biogeochem. Cycles. 24, GB1011. DOI:10.1029/2008GB003435. .. _Pressetal1992: +|br| + Press, W.H., Teukolsky, S.A., Vetterling, W.T., and Flannery, B.P. 1992. Numerical Recipes in FORTRAN: The Art of Scientific Computing. Cambridge University Press, New York. .. _Prigentetal2007: +|br| + Prigent, C., Papa, F., Aires, F., Rossow, W.B. and Matthews, E. 2007. Global inundation dynamics inferred from multiple satellite observations, 1993-2000. J. Geophys. Res. 112(D12). .. _Pritchardetal2008: +|br| + Pritchard, M.S., Bush, A.B.G., and Marshall, S.J. 2008. Neglecting ice-atmosphere interactions underestimates ice sheet melt in millennial-scale deglaciation simulations. Geophys. Res. Lett. ** @@ -1553,18 +2060,24 @@ millennial-scale deglaciation simulations. Geophys. Res. Lett. ** .. _Qianetal2006: +|br| + Qian, T., Dai, A., Trenberth, K.E., and Oleson, K.W. 2006. Simulation of global land surface conditions from 1948 to 2004: Part I: Forcing data and evaluations. J. Hydrometeor. 7:953-975. .. _RamankuttyFoley1998: +|br| + Ramankutty, N., and Foley, J. A., 1998. Characterizing patterns of global land use: An analysis of global croplands data. Global Biogeochemical Cycles, 12, 667-685. .. _Ramankuttyetal2008: +|br| + Ramankutty, N., Evan, A., Monfreda, C., and Foley, J.A. 2008. Farming the Planet. Part 1: The Geographic Distribution of Global Agricultural Lands in the Year 2000. Global Biogeochem. Cycles. 22:GB1003. @@ -1572,6 +2085,8 @@ DOI:10.1029/2007GB002952. .. _Randlettetal1996: +|br| + Randlett, D.L., Zak, D.R., Pregitzer, K.S., and Curtis, P.S. 1996. Elevated atmospheric carbon dioxide and leaf litter chemistry: Influences on microbial respiration and net nitrogen mineralization. @@ -1579,6 +2094,8 @@ Soil Sci. Soc. Am. J. 60:1571-1577. .. _Rastetteretal1991: +|br| + Rastetter, E.B., Ryan, M.G., Shaver, G.R., Melillo, J.M., Nadelhoffer, K.J., Hobbie, J.E., and Aber, J.D. 1991. A general biogeochemical model describing the responses of the C and N cycles in terrestrial ecosystems @@ -1586,12 +2103,16 @@ to changes in CO2, climate and N deposition. Tree Phys. 9:101-126. .. _Rastneretal2012: +|br| + Rastner, P., Bolch, T., Mölg, N., Machguth, H., and Paul, F., 2012. The first complete glacier inventory for the whole of Greenland, The Cryosphere Discuss., 6, 2399-2436, 10.5194/tcd-6-2399-2012. .. _Rileyetal2011a: +|br| + Riley, W. J., Z. M. Subin, D. M. Lawrence, S. C. Swenson, M. S. Torn, L. Meng, N. Mahowald, and P. Hess, 2011a. Barriers to predicting global terrestrial methane fluxes: Analyses using a methane biogeochemistry @@ -1600,26 +2121,36 @@ DOI:10.5194/bg-8-1925-2011. .. _Rileyetal2011b: +|br| + Riley, W.J. et al. 2011b. CLM4Me, a Methane Biogeochemistry Model Integrated in CESM, Land and Biogeochemistry Model Working Group Meeting, Boulder, CO. .. _Roeschetal2001: +|br| + Roesch, A., M. Wild, H. Gilgen, and A. Ohmura. 2001. A new snow cover fraction parametrization for the ECHAM4 GCM, Clim. Dyn., 17:933–946. .. _Rogersetal2017: +|br| + Rogers, A., B. E. Medlyn, J. S. Dukes, G. Bonan, S. Caemmerer, M. C. Dietze, J. Kattge, A. D. Leakey, L. M. Mercado, and U. Niinemets, 2017: A roadmap for improving the representation of photosynthesis in Earth system models. New Phytologist, 213:22-42. .. _Ryan1991: +|br| + Ryan, M. G. 1991. A simple method for estimating gross carbon budgets for vegetation in forest ecosystems. Tree Phys. 9:255-266. .. _RunningCoughlan1988: +|br| + Running, S.W. and Coughlan, J.C., 1988. A general model of forest ecosystem processes for regional applications. I. Hydrological balance, canopy gas exchange and primary production processes. Ecological @@ -1627,18 +2158,24 @@ Modelling, 42: 125-154. .. _Runningetal1989: +|br| + Running, S.W. et al., 1989. Mapping regional forest evapotranspiration and photosynthesis by coupling satellite data with ecosystem simlation. Ecology, 70: 1090-1101. .. _RunningGower1991: +|br| + Running, S.W. and Gower, S.T., 1991. FOREST BGC, A general model of forest ecosystem processes for regional applications. II. Dynamic carbon allocation and nitrogen budgets. Tree Physiology, 9: 147-160. .. _RunningHunt1993: +|br| + Running, S.W. and Hunt, E.R., Jr., 1993. Generalization of a forest ecosystem process model for other biomes, BIOME-BGC, and an applicationfor global-scale models. In: J.R. Ehleringer and C. Field @@ -1647,12 +2184,16 @@ Press, San Diego, CA, pp. 141-158. .. _Sacksetal2009: -Sacks, W. J., Cook, B. I., Buenning, N., Levis, S., and Helkowski, J. H. +|br| + +Sacks, W. J., Cook, B. I., Buenning, N., Levis, S., and Helkowski, J. H. 2009. Effects of global irrigation on the near-surface climate. Climate Dyn., 33, 159–175. DOI:10.1007/s00382-008-0445-z. .. _Saggaretal1994: +|br| + Saggar, S., Tate, K.R., Feltham, C.W., Childs, C.W. and Parshotam, A., 1994. Carbon turnover in a range of allophanic soils amended with :math:`{}^{14}`\ C-labelled glucose. Soil Biology and Biochemistry, 26: @@ -1665,6 +2206,8 @@ DOI:10.1029/2008JD010834. .. _Schaafetal2002: +|br| + Schaaf, C.B., Gao, F., Strahler, A.H., Lucht, W., Li, X., Tsang, T., Strugnell, N.C., Zhang, X., Jin, Y., and Muller, J.-P. 2002. First operational BRDF, albedo nadir reflectance products from MODIS. Remote @@ -1672,40 +2215,54 @@ Sens. Environ. 83:135-148. .. _Schlesinger1997: +|br| + Schlesinger, W.H., 1997. Biogeochemistry: an analysis of global change. Academic Press, London, 588 pp. .. _SchnellKing1996: +|br| + Schnell, S. and King, G.M., 1996. Responses of methanotrophic activity in soils and cultures to water stress. Applied and Environmental Microbiology 62:3203-3209. .. _Segers1998: +|br| + Segers, R., 1998. Methane production and methane consumption: a review of processes underlying wetland methane fluxes. Biogeochemistry 41:23-51. .. _Sellers1985: +|br| + Sellers, P.J. 1985. Canopy reflectance, photosynthesis and transpiration. Int. J. Remote Sens. 6:1335-1372. .. _Sellersetal1986: +|br| + Sellers, P.J., Mintz, Y., Sud, Y.C., and Dalcher, A. 1986. A simple biosphere model (SiB) for use within general circulation models. J. Atmos. Sci. 43:505-531. .. _Sellersetal1988: +|br| + Sellers, P.J., Hall, F.G., Asrar, G., Strebel, D.E., and Murphy, R.E. 1988. The First ISLSCP Field Experiment (FIFE). Bull. Amer. Meteor. Soc. 69:22-27. .. _Sellersetal1992: +|br| + Sellers, P.J., Berry, J.A., Collatz, G.J., Field, C.B., and Hall, F.G. 1992. Canopy reflectance, photosynthesis, and transpiration. III. A reanalysis using improved leaf models and a new canopy integration @@ -1713,12 +2270,16 @@ scheme. Remote Sens. Environ. 42:187-216. .. _Sellersetal1995: +|br| + Sellers, P.J., et al. 1995. The Boreal Ecosystem-Atmosphere Study (BOREAS): An overview and early results from the 1994 field year. Bull. Amer. Meteor. Soc. 76:1549-1577. .. _Sellersetal1996: +|br| + Sellers, P.J., Randall, D.A., Collatz, G.J., Berry, J.A., Field, C.B., Dazlich, D.A., Zhang, C., Collelo, G.D., and Bounoua, L. 1996. A revised land surface parameterization (SiB2) for atmospheric GCMs. Part I: Model @@ -1726,6 +2287,8 @@ formulation. J. Climate 9:676-705. .. _Shietal2013: +|br| + Shi, X., Mao, J., Thornton, P.E., and Huang, M. 2013. Spatiotemporal patterns of evapotranspiration in response to multiple environmental factors simulated by the Community Land Model. Environ. Res. Lett. @@ -1733,39 +2296,53 @@ factors simulated by the Community Land Model. Environ. Res. Lett. .. _Shietal2016: +|br| + Shi, M., J. B. Fisher, E. R. Brzostek, and R. P. Phillips, 2016: Carbon cost of plant nitrogen acquisition: global carbon cycle impact from an improved plant nitrogen cycle in the Community Land Model. Glob. Change Biol., 22:1299-1314. .. _Shiklomanov2000: +|br| + Shiklomanov, I.A. 2000. Appraisal and assessment of world water resources. Water International 25:11-32. .. _Siebertetal2005: +|br| + Siebert, S., Döll, P., Hoogeveen, J., Faures, J.M., Frenken, K., Feick, S., 2005. Development and validation of the global map of irrigation areas. Hydrol Earth Syst Sc 9:535–547 .. _Simardetal2011: -Simard, M., Pinto, N., Fisher, J.B., and Baccini, A. (2011), Mapping +|br| + +Simard, M., Pinto, N., Fisher, J.B., and Baccini, A. (2011), Mapping forest canopy height globally with spaceborne lidar. J. Geophys. Res., 116, G04021, doi:10.1029/2011JG001708. .. _Simpsonetal1983: +|br| + Simpson, R.J., Lambers, H., and Dalling, M.J. 1983. Nitrogen redistribution during grain growth in wheat (Triticum avestivum L.). Plant Physiol. 71:7-14. .. _Sivak2013: +|br| + Sivak, M. 2013. Air conditioning versus heating: climate control is more -energy demanding in Minneapolis than in Miami. Environ. Res. Lett., 8, +energy demanding in Minneapolis than in Miami. Environ. Res. Lett., 8, doi:10.1088/1748-9326/8/1/014050. .. _Smithetal2005: +|br| + Smith, A.M.S., Wooster, M.J., Drake, N.A., Dipotso, F.M. and Perry, G.L.W., 2005. Fire in African savanna: Testing the impact of incomplete combustion on pyrogenic emissions estimates. Ecological Applications, @@ -1773,37 +2350,49 @@ combustion on pyrogenic emissions estimates. Ecological Applications, .. _Sollins1982: +|br| + Sollins, P., 1982. Input and decay of coarse woody debris in coniferous stands in western Oregon and Washington. Canadian Journal of Forest Research, 12: 18-28. .. _SonGower1991: +|br| + Son, Y. and Gower, S.T., 1991. Aboveground nitrogen and phosphorus use by five plantation-grown trees with different leaf longevities. Biogeochemistry, 14: 167-191. .. _Sorensen1981: +|br| + Sørensen, L.H., 1981. Carbon-nitrogen relationships during the humification of cellulose in soils containing different amounts of clay. Soil Biology and Biochemistry, 13: 313-321. .. _Sperryetal1998: -Sperry, J.S., Adler, F.R., Campbell, G.S. and Comstock, J.P. 1998. -Limitation of plant water use by rhizosphere and xylem conductance: -results from a model. Plant, Cell & Environment, 21: 347–359. +|br| + +Sperry, J.S., Adler, F.R., Campbell, G.S. and Comstock, J.P. 1998. +Limitation of plant water use by rhizosphere and xylem conductance: +results from a model. Plant, Cell & Environment, 21: 347–359. doi:10.1046/j.1365-3040.1998.00287.x .. _SperryandLove2015: -Sperry, J.S. and Love, D.M. 2015. What plant hydraulics can tell us -about responses to climate-change droughts. New Phytol, 207: 14–27. +|br| + +Sperry, J.S. and Love, D.M. 2015. What plant hydraulics can tell us +about responses to climate-change droughts. New Phytol, 207: 14–27. doi:10.1111/nph.13354 .. _Sprugeletal1995: +|br| + Sprugel, D.G., Ryan, M.G., Brooks, J.R., Vogt, K.A., and Martin, T.A. 1995. Respiration from the organ level to stand level. pp. 255-299. In: W. K. Smith and T. M. Hinkley (editors) Resource Physiology of Conifers. @@ -1811,17 +2400,23 @@ Academic Press, San Diego,CA. .. _StaufferAharony1994: +|br| + Stauffer, D., and Aharony, A. 1994. Introduction to Percolation Theory. Taylor and Francis, London. .. _Stilletal2003: +|br| + Still, C.J., Berry, J.A., Collatz, G.J., and DeFries, R.S. 2003. Global distribution of C3 and C4 vegetation: carbon cycle implications. Global Biogeochem. Cycles 17:1006. DOI:10.1029/2001GB001807. .. _Stocklietal2008: +|br| + Stöckli, R., Lawrence, D.M., Niu, G.-Y., Oleson, K.W., Thornton, P.E., Yang, Z.-L., Bonan, G.B., Denning, A.S., and Running, S.W. 2008. Use of FLUXNET in the Community Land Model development. J. Geophys. Res. @@ -1829,29 +2424,39 @@ FLUXNET in the Community Land Model development. J. Geophys. Res. .. _Stracketal2006: +|br| + Strack, M., Kellner, E. and Waddington, J.M., 2006. Effect of entrapped gas on peatland surface level fluctuations. Hydrological Processes 20:3611-3622. .. _Strahleretal1999: +|br| + Strahler, A.H., Muchoney, D., Borak, J., Friedl, M., Gopal, S., Lambin, E., and Moody. A. 1999. MODIS Land Cover Product: Algorithm Theoretical Basis Document (Version 5.0). Boston University, Boston. .. _Stull1988: +|br| + Stull, R.B. 1988. An Introduction to Boundary Layer Meteorology. Kluwer Academic Publishers, Dordrecht. .. _Subinetal2012a: +|br| + Subin, Z.M., Riley, W.J. and Mironov, D. 2012a. Improved lake model for climate simulations, J. Adv. Model. Earth Syst., 4, M02001. DOI:10.1029/2011MS000072. .. _Subinetal2012b: +|br| + Subin, Z.M., Murphy, L.N., Li, F., Bonfils, C. and Riley, W.J., 2012b. Boreal lakes moderate seasonal and diurnal temperature variation and perturb atmospheric circulation: analyses in the Community Earth System @@ -1859,42 +2464,56 @@ Model 1 (CESM1). Tellus A, North America, 64. .. _Sunetal2012: +|br| + Sun, Y., Gu, L., and Dickinson, R. E. 2012. A numerical issue in calculating the coupled carbon and water fluxes in a climate model, J. Geophys. Res., 117, D22103. DOI:10.1029/2012JD018059. .. _Swensonetal2012: +|br| + Swenson, S.C., Lawrence, D.M., and Lee, H. 2012. Improved Simulation of the Terrestrial Hydrological Cycle in Permafrost Regions by the Community Land Model. JAMES, 4, M08002. DOI:10.1029/2012MS000165. .. _SwensonLawrence2012: +|br| + Swenson, S.C. and Lawrence, D.M. 2012. A New Fractional Snow Covered Area Parameterization for the Community Land Model and its Effect on the Surface Energy Balance. JGR, 117, D21107. DOI:10.1029/2012JD018178. .. _SwensonLawrence2014: -Swenson, S.C., and D. M. Lawrence. 2014. Assessing a dry surface -layer-based soil resistance parameterization for the Community Land Model -using GRACE and FLUXNET-MTE data. JGR, 119, 10, 299–10,312, +|br| + +Swenson, S.C., and D. M. Lawrence. 2014. Assessing a dry surface +layer-based soil resistance parameterization for the Community Land Model +using GRACE and FLUXNET-MTE data. JGR, 119, 10, 299–10,312, DOI:10.1002/2014JD022314. .. _SwensonLawrence2015: -Swenson, S.C., and D. M. Lawrence. 2015. A GRACE-based assessment of -interannual groundwater dynamics in the Community Land Model. WRR, 51, +|br| + +Swenson, S.C., and D. M. Lawrence. 2015. A GRACE-based assessment of +interannual groundwater dynamics in the Community Land Model. WRR, 51, doi:10.1002/2015WR017582. .. _TaWeiland1992: +|br| + Ta, C.T. and Weiland, R.T. 1992. Nitrogen partitioning in maize during ear development. Crop Sci. 32:443-451. .. _TangRiley2013: +|br| + Tang, J.Y. and Riley, W.J. 2013. A new top boundary condition for modeling surface diffusive exchange of a generic volatile tracer: Theoretical analysis and application to soil evaporation. Hydrol. Earth @@ -1902,22 +2521,30 @@ Syst. Sci. 17:873-893. .. _Tarnocaietal2011: +|br| + Tarnocai, C., Kettles, I. M., and Lacelle, B., 2011. Peatlands of Canada, Geological Survey of Canada, Open File 6561, CD-ROM. DOI:10.495/288786. .. _Tayloretal1989: +|br| + Taylor, B.R., Parkinson, D. and Parsons, W.F.J., 1989. Nitrogen and lignin content as predictors of litter decay rates: A microcosm test. Ecology, 70: 97-104. .. _Thomasetal2015: +|br| + Thomas R.Q., Brookshire E.N., Gerber S. 2015. Nitrogen limitation on land: how can it occur in Earth system models? Global Change Biology, 21, 1777-1793, doi:10.1111/gcb.12813. .. _Thonickeetal2001: +|br| + Thonicke, K., Venevsky, S., Sitch, S., and Cramer, W. 2001. The role of fire disturbance for global vegetation dynamics: coupling fire into a Dynamic Global Vegetation Model. Global Ecology and Biogeography @@ -1925,6 +2552,8 @@ Dynamic Global Vegetation Model. Global Ecology and Biogeography .. _Thornton1998: +|br| + Thornton, P.E., 1998. Regional ecosystem simulation: combining surface- and satellite-based observations to study linkages between terrestrial energy and mass budgets. Ph.D. Thesis, The University of Montana, @@ -1932,6 +2561,8 @@ Missoula, 280 pp. .. _Thorntonetal2002: +|br| + Thornton, P.E., Law, B.E., Gholz, H.L., Clark, K.L., Falge, E., Ellsworth, D.S., Goldstein, A.H., Monson, R.K., Hollinger, D., Falk, M., Chen, J., and Sparks, J.P. 2002. Modeling and measuring the effects of @@ -1940,18 +2571,24 @@ needleleaf forests. Agric. For. Meteor. 113:185-222. .. _ThorntonRosenbloom2005: +|br| + Thornton, P.E., and Rosenbloom, N.A. 2005. Ecosystem model spin-up: estimating steady state conditions in a coupled terrestrial carbon and nitrogen cycle model. Ecological Modelling 189:25-48. .. _ThorntonZimmermann2007: +|br| + Thornton, P.E., and Zimmermann, N.E. 2007. An improved canopy integration scheme for a land surface model with prognostic canopy structure. J. Climate 20:3902-3923. .. _Thorntonetal2007: +|br| + Thornton, P.E., Lamarque, J.-F., Rosenbloom, N.A., and Mahowald, N.M. 2007. Influence of carbon-nitrogen cycle coupling on land model response to CO\ :sub:`2` fertilization and climate variability. Global @@ -1959,6 +2596,8 @@ Biogeochem. Cycles 21:GB4018. .. _Thorntonetal2009: +|br| + Thornton, P.E., Doney, S.C., Lindsay, K., Moore, J.K., Mahowald, N., Randerson, J.T., Fung, I., Lamarque, J.F., Feddema, J.J., and Lee, Y.H. 2009. Carbon-nitrogen interactions regulate climate-carbon cycle @@ -1967,6 +2606,8 @@ Biogeosci. 6:2099-2120. .. _Tianetal2010: +|br| + Tian, H. et al. 2010. Spatial and temporal patterns of CH4 and N2O fluxes in terrestrial ecosystems of North America during 1979-2008: application of a global biogeochemistry model. Biogeosciences @@ -1974,6 +2615,8 @@ application of a global biogeochemistry model. Biogeosciences .. _Toonetal1989: +|br| + Toon, O.B., McKay, C.P., Ackerman, T.P., and Santhanam, K. 1989. Rapid calculation of radiative heating rates and photodissociation rates in inhomogeneous multiple scattering atmospheres. J. Geophys. Res. @@ -1981,12 +2624,16 @@ inhomogeneous multiple scattering atmospheres. J. Geophys. Res. .. _Turetskyetal2002: +|br| + Turetsky, M.R., Wieder, R.K., Halsey, L.A., and Vitt, D.H. 2002. Current disturbance and the diminishing peatland carbon sink. Geophys. Res. Lett. 29:1526. DOI:10.1029/2001GL014000. .. _Turetskyetal2004: +|br| + Turetsky, M.R., Amiro, B.D., Bosch, E., and Bhatti, J.S. 2004. Historical burn area in western Canadian peatlands and its relationship to fire weather indices. Global Biogeochem. Cycles 18:GB4014. @@ -1994,23 +2641,31 @@ DOI:10.1029/2004GB002222. .. _Tyeetal2005: +|br| + Tye, A.M., et al. 2005. The fate of N-15 added to high Arctic tundra to mimic increased inputs of atmospheric nitrogen released from a melting snowpack. Global Change Biology 11:1640-1654. .. _Unlandetal1996: +|br| + Unland, H.E., Houser, P.R., Shuttleworth, W.J., and Yang, Z.-L. 1996. Surface flux measurement and modeling at a semi-arid Sonoran Desert site. Agric. For. Meteor. 82:119-153. .. _UNSTAT2005: +|br| + UNSTAT, 2005. National Accounts Main Aggregates Database, United Nations Statistics Division. .. _VallanoSparks2007: +|br| + Vallano, D.M. and Sparks, J.P. 2007. Quantifying foliar uptake of gaseous itrogen dioxide using enriched foliar :math:`\delta^{15}`\ N values. New Phytologist @@ -2018,6 +2673,8 @@ gaseous itrogen dioxide using enriched foliar .. _vanderWerfetal2010: +|br| + van der Werf, G.R., Randerson, J.T., Giglio, L., Collatz, G.J., Mu, M., Kasibhatla, S.P., Morton, D.C., DeFries, R.S., Jin, Y., van Leeuwen, T.T. 2010. Global fire emissions and the contribution of deforestation, @@ -2026,19 +2683,25 @@ Phys. 10:11707-11735. .. _van Veenetal1984: +|br| + van Veen, J.A., Ladd, J.N. and Frissel, M.J., 1984. Modelling C and N turnover through the microbial biomass in soil. Plant and Soil, 76: 257-274. .. _vanKampenhoutetal2017: -van Kampenhout, L., J.T.M. Lenaerts, W.H. Lipscomb, W.J. Sacks, D.M. -Lawrence, A.G. Slater, and M.R. van den Broeke, 2017. -Improving the representation of polar snow and firn in the +|br| + +van Kampenhout, L., J.T.M. Lenaerts, W.H. Lipscomb, W.J. Sacks, D.M. +Lawrence, A.G. Slater, and M.R. van den Broeke, 2017. +Improving the representation of polar snow and firn in the Community Earth System Model, submitted. .. _VanVuurenetal2006: +|br| + Van Vuuren, D.P., Lucas, P.S., and Hilderink, H.B.M., 2006. Downscaling drivers of global environmental change: enabling use of global SRES scenarios at the national and grid levels, Report 550025001, Netherlands @@ -2046,12 +2709,16 @@ Environmental Assessment Agency, 45 pp. .. _VanninenMakela2005: +|br| + Vanninen, P., and Makela, A. 2005. Carbon budget for Scots pine trees: effects of size, competition and site fertility on growth allocation and production. Tree Phys. 25:17-30. .. _VerdinGreenlee1996: +|br| + Verdin, K. L., and S. K. Greenlee, 1996. Development of continental scale digital elevation models and extraction of hydrographic features, paper presented at the Third International Conference/Workshop on @@ -2060,6 +2727,8 @@ January, Natl. Cent. for Geogr. Inf. and Anal., Santa Barbara, Calif. .. _Viovy2011: +|br| + Viovy, N. 2011. CRUNCEP dataset. [Description available at http://dods.extra.cea.fr/data/p529viov/cruncep/readme.htm. Data available at @@ -2067,17 +2736,23 @@ http://dods.extra.cea.fr/store/p529viov/cruncep/V4\_1901\_2011/]. .. _VitousekHowarth1991: +|br| + Vitousek, P.M., and Howarth, R.W. 1991. Nitrogen limitation on land and in the sea: How can it occur? Biogeochem. 13:87-115. .. _Walteretal2001: +|br| + Walter, B.P., Heimann, M. and Matthews, E., 2001. Modeling modern methane emissions from natural wetlands 1. Model description and results. J. Geophys. Res. 106(D24):34189-34206. .. _Waniaetal2009: +|br| + Wania, R., Ross, I. and Prentice, I.C. 2009. Integrating peatlands and permafrost into a dynamic global vegetation model: 2. Evaluation and sensitivity of vegetation and carbon cycle processes. Global Biogeochem. @@ -2085,6 +2760,8 @@ Cycles 23. .. _Waniaetal2010: +|br| + Wania, R., Ross, I. and Prentice, I.C. 2010. Implementation and evaluation of a new methane model within a dynamic global vegetation model LPJ-WHyMe v1.3. Geoscientific Model Development Discussions @@ -2092,18 +2769,24 @@ model LPJ-WHyMe v1.3. Geoscientific Model Development Discussions .. _WangZeng2009: +|br| + Wang, A., and Zeng, X. 2009. Improving the treatment of vertical snow burial fraction over short vegetation in the NCAR CLM3. Adv. Atmos. Sci. 26:877-886. DOI:10.1007/s00376-009-8098-3. .. _Whiteetal1997: +|br| + White, M.A., Thornton, P.E., and Running, S.W. 1997. A continental phenology model for monitoring vegetation responses to interannual climatic variability. Global Biogeochem. Cycles 11:217-234. .. _Whiteetal2000: +|br| + White, M.A., Thornton, P.E., Running, S.W., and Nemani, R.R. 2000. Parameterization and sensitivity analysis of the Biome-BGC terrestrial ecosystem model: net primary production controls. Earth Interactions @@ -2111,28 +2794,36 @@ ecosystem model: net primary production controls. Earth Interactions .. _Wiederetal2015: -Wieder, W. R., Cleveland, C. C., Lawrence, D. M., and Bonan, G. B. 2015. -Effects of model structural uncertainty on carbon cycle projections: -biological nitrogen fixation as a case study. Environmental Research +|br| + +Wieder, W. R., Cleveland, C. C., Lawrence, D. M., and Bonan, G. B. 2015. +Effects of model structural uncertainty on carbon cycle projections: +biological nitrogen fixation as a case study. Environmental Research Letters, 10(4), 044016. .. _Williamsetal1996: -Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., -Wofsy, S.C., Shaver, G.R., Melillo, J.M., Munger, J.W., Fan, S.M. -and Nadelhoffer, K.J. 1996. Modelling the soil-plant-atmosphere -continuum in a Quercus–Acer stand at Harvard Forest: the regulation -of stomatal conductance by light, nitrogen and soil/plant hydraulic -properties. Plant, Cell & Environment, 19: 911–927. +|br| + +Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., +Wofsy, S.C., Shaver, G.R., Melillo, J.M., Munger, J.W., Fan, S.M. +and Nadelhoffer, K.J. 1996. Modelling the soil-plant-atmosphere +continuum in a Quercus–Acer stand at Harvard Forest: the regulation +of stomatal conductance by light, nitrogen and soil/plant hydraulic +properties. Plant, Cell & Environment, 19: 911–927. doi:10.1111/j.1365-3040.1996.tb00456.x .. _WiscombeWarren1980: +|br| + Wiscombe, W.J., and Warren, S.G. 1980. A model for the spectral albedo of snow. I. Pure snow. J. Atmos. Sci. 37:2712-2733. .. _Woodetal1992: +|br| + Wood, E.F., Lettenmaier, D.P., and Zartarian, V.G. 1992. A land-surface hydrology parameterization with subgrid variability for general circulation models. J. Geophys. Res. 97(D3):2717–2728. @@ -2140,66 +2831,90 @@ DOI:10.1029/91JD01786. .. _WorldBank2004: +|br| + World Bank, 2004. World development indicators 2004, Oxford University Press, New York, 416 pp. .. _Wuetal2011: +|br| + Wu, H., J. S. Kimball, N. Mantua, and J. Stanford, 2011: Automated upscaling of river networks for macroscale hydrological modeling. Water Resour. Res., 47, W03517, doi:10.1029/2009WR008871. .. _Wuetal2012: +|br| + Wu, H., J. S. Kimball, H. Li, M. Huang, L. R. Leung, and R. F. Adler (2012), A New Global River Network Database for Macroscale Hydrologic modeling, Water Resour. Res., 48, W09701, doi:10.1029/2012WR012313. .. _Xuetal2012: +|br| + Xu, C., R. Fisher, S. D. Wullschleger, C. J. Wilson, M. Cai, and N. G. McDowell, 2012: Toward a mechanistic modeling of nitrogen limitation on vegetation dynamics. PloS one, 7:e37914. .. _Yang1998: +|br| + Yang, Z.-L. 1998. Technical note of a 10-layer soil moisture and temperature model. Unpublished manuscript. .. _Zenderetal2003: +|br| + Zender, C.S., Bian, H., and Newman, D. 2003. Mineral dust entrainment and deposition (DEAD) model: Description and 1990s dust climatology. ** J. Geophys. Res\ *.* 108(D14):4416. DOI:10.1029/2002JD002775. .. _ZengDickinson1998: +|br| + Zeng, X., and Dickinson, R.E. 1998. Effect of surface sublayer on surface skin temperature and fluxes. J.Climate 11:537-550. .. _Zengetal1998: +|br| + Zeng, X., Zhao, M., and Dickinson, R.E. 1998. Intercomparison of bulk aerodynamic algorithms for the computation of sea surface fluxes using the TOGA COARE and TAO data. J. Climate 11:2628-2644. .. _Zeng2001: +|br| + Zeng, X. 2001. Global vegetation root distribution for land modeling. J. Hydrometeor. 2:525-530. .. _Zengetal2002: +|br| + Zeng, X., Shaikh, M., Dai, Y., Dickinson, R.E., and Myneni, R. 2002. Coupling of the Common Land Model to the NCAR Community Climate Model. J. Climate 15:1832-1854. .. _Zengetal2005: +|br| + Zeng, X., Dickinson, R.E., Barlage, M., Dai, Y., Wang, G., and Oleson, K. 2005. Treatment of under-canopy turbulence in land models. J. Climate 18:5086-5094. .. _ZengWang2007: +|br| + Zeng, X., and Wang, A. 2007. Consistent parameterization of roughness length and displacement height for sparse and dense canopies in land models. J. Hydrometeor. 8:730-737. @@ -2210,6 +2925,8 @@ water table. J. Hydrometeor. 10:308-319. .. _Zengetal2008: +|br| + Zeng, X., Zeng, X., and Barlage, M. 2008. Growing temperate shrubs over arid and semiarid regions in the Community Land Model - Dynamic Global Vegetation Model. Global Biogeochem. Cycles 22:GB3003. @@ -2217,6 +2934,8 @@ DOI:10.1029/2007GB003014. .. _Zhangetal2002: +|br| + Zhang, Y., Li, C.S., Trettin, C.C., Li, H. and Sun, G., 2002. An integrated model of soil, hydrology, and vegetation for carbon dynamics in wetland ecosystems. Global Biogeochemical Cycles 16. @@ -2224,6 +2943,8 @@ DOI:10.1029/2001GB001838. .. _Zhuangetal2004: +|br| + Zhuang, Q., et al. 2004. Methane fluxes between terrestrial ecosystems and the atmosphere at northern high latitudes during the past century: A retrospective analysis with a process-based biogeochemistry model. @@ -2231,136 +2952,200 @@ Global Biogeochemical Cycles 18. DOI:10.1029/2004GB002239. .. _Zilitinkevich1970: +|br| + Zilitinkevich, S.S. 1970. Dynamics of the Atmospheric Boundary Layer. Leningrad Gidrometeor. .. _bonan2012: -Bonan, Gordon B et al. (2012). `Reconciling leaf physiological traits and canopy flux data: Use of the TRY and FLUXNET databases in the Community Land Model version 4`. Journal of Geophysical Research: Biogeosciences (2005-2012) 117.G2. +|br| + +Bonan, Gordon B et al. (2012). `Reconciling leaf physiological traits and canopy flux data: Use of the TRY and FLUXNET databases in the Community Land Model version 4`. Journal of Geophysical Research: Biogeosciences (2005-2012) 117.G2. .. _botta2000: -Botta, A et al. (2000). `A global prognostic scheme of leaf onset using satellite data`. Global Change Biology 6.7, pp. 709-725. +|br| + +Botta, A et al. (2000). `A global prognostic scheme of leaf onset using satellite data`. Global Change Biology 6.7, pp. 709-725. .. _byram1959: -Byram, GM (1959). Combustion of forest fuels. In Forest fire: control and use.(Ed. KP Davis) pp. 61-89. +|br| + +Byram, GM (1959). Combustion of forest fuels. In Forest fire: control and use.(Ed. KP Davis) pp. 61-89. .. _collatz1991: +|br| + Collatz, G James et al. (1991). `Physiological and environmental regulation of stomatal conductance, photosynthesis and transpiration: a model that includes a laminar boundary layer` Agricultural and Forest Meteorology 54.2, pp. 107-136. .. _collatz1992: +|br| + Collatz, Go J, M Ribas-Carbo, and JA Berry (1992). `Coupled photosynthesis-stomatal conductance model for leaves of C4 plants`. Functional Plant Biology 19.5, pp. 519-538.
 .. _farquhar1980: +|br| + Farquhar, GD, S von von Caemmerer, and JA Berry (1980). `A biochemical model of photosynthetic CO2 assimilation in leaves of C3 species`. Planta 149.1, pp. 780-90. .. _fisher2010: -Fisher, JB et al. (2010). `Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation`. Global Biogeochemical Cycles 24.1. +|br| + +Fisher, JB et al. (2010). `Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation`. Global Biogeochemical Cycles 24.1. .. _foley1996: -Foley, Jonathan A et al. (1996). `An integrated biosphere model of land surface processes, terrestrial carbon balance, and vegetation dynamics`. Global Biogeochemical Cycles 10.4, pp. 603-628. +|br| + +Foley, Jonathan A et al. (1996). `An integrated biosphere model of land surface processes, terrestrial carbon balance, and vegetation dynamics`. Global Biogeochemical Cycles 10.4, pp. 603-628. .. _fyllas2014: +|br| + Fyllas, NM et al. (2014). `Analysing Amazonian forest productivity using a new individual and trait- based model (TFS v. 1)`. Geoscientific Model Development 7.4, pp. 1251-1269. .. _kucharik1998: +|br| + Kucharik, Christopher J, John M Norman, and Stith T Gower (1998). `Measurements of branch area and adjusting leaf area index indirect measurements`. Agricultural and Forest Meteorology 91.1, pp. 69-88. .. _li2012: +|br| + Li, F, XD Zeng, and S Levis (2012). `A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model`. Biogeosciences 9.7, pp. 2761-2780. .. _lichstein2011: +|br| + Lichstein, Jeremy W and Stephen W Pacala (2011). `Local diversity in heterogeneous landscapes: quantitative assessment with a height-structured forest metacommunity model`. Theoretical Ecology 4.2, pp. 269-281. .. _lischke2006: +|br| + Lischke, Heike et al. (2006). `TreeMig: a forest-landscape model for simulating spatio-temporal patterns from stand to landscape scale`. Ecological Modelling 199.4, pp. 409-420. 41 .. _lloyd2010: - -Lloyd, J et al. (2010). `Optimisation of photosynthetic carbon gain and within-canopy gradients of associated foliar traits for Amazon forest trees`. Biogeosciences 7.6, pp. 1833-1859. + +|br| + +Lloyd, J et al. (2010). `Optimisation of photosynthetic carbon gain and within-canopy gradients of associated foliar traits for Amazon forest trees`. Biogeosciences 7.6, pp. 1833-1859. .. _mcdowell2013: -McDowell, Nate G et al. (2013). `Evaluating theories of drought-induced vegetation mortality using a multimodel experiment framework`. New Phytologist 200.2, pp. 304-321. +|br| + +McDowell, Nate G et al. (2013). `Evaluating theories of drought-induced vegetation mortality using a multimodel experiment framework`. New Phytologist 200.2, pp. 304-321. .. _medlyn2011: -Medlyn, Belinda E et al. (2011). `Reconciling the optimal and empirical approaches to modelling stom- atal conductance`. Global Change Biology 17.6, pp. 2134-2144. +|br| + +Medlyn, Belinda E et al. (2011). `Reconciling the optimal and empirical approaches to modelling stom- atal conductance`. Global Change Biology 17.6, pp. 2134-2144. .. _mc_2001: +|br| + Moorcroft, PR, GC Hurtt, and Stephen W Pacala (2001). `A method for scaling vegetation dynamics: the ecosystem demography model ED`. Ecological monographs 71.4, pp. 557-586. .. _norman1979: - -Norman, JM (1979). `Modeling the complete crop canopy`. Modification of the Aerial Environment of Crops, pp. 249-280. + +|br| + +Norman, JM (1979). `Modeling the complete crop canopy`. Modification of the Aerial Environment of Crops, pp. 249-280. .. _oleson2013: -Oleson, KW et al. (2013). `Technical description of version 4.5 of the Community Land Model (CLM)`. +|br| + +Oleson, KW et al. (2013). `Technical description of version 4.5 of the Community Land Model (CLM)`. .. _peterson1986: -Peterson, David L and Kevin C Ryan (1986). `Modeling postfire conifer mortality for long-range planning`. Environmental Management 10.6, pp. 797-808. +|br| + +Peterson, David L and Kevin C Ryan (1986). `Modeling postfire conifer mortality for long-range planning`. Environmental Management 10.6, pp. 797-808. .. _pfeiffer2013: -Pfeiffer, M, A Spessa, and JO Kaplan (2013). `A model for global biomass burning in preindustrial time: LPJ-LMfire (v1. 0)`. Geoscientific Model Development 6.3, pp. 643-685. +|br| + +Pfeiffer, M, A Spessa, and JO Kaplan (2013). `A model for global biomass burning in preindustrial time: LPJ-LMfire (v1. 0)`. Geoscientific Model Development 6.3, pp. 643-685. .. _purves2008: -Purves, Drew W et al. (2008). `Predicting and understanding forest dynamics using a simple tractable model`. Proceedings of the National Academy of Sciences 105.44, pp. 17018-17022. +|br| + +Purves, Drew W et al. (2008). `Predicting and understanding forest dynamics using a simple tractable model`. Proceedings of the National Academy of Sciences 105.44, pp. 17018-17022. .. _sato2007: -Sato, Hisashi, Akihiko Itoh, and Takashi Kohyama (2007). `SEIB–DGVM: A new Dynamic Global Vegetation Model using a spatially explicit individual-based approach`. Ecological Modelling 200.3, pp. 2793307. +|br| + +Sato, Hisashi, Akihiko Itoh, and Takashi Kohyama (2007). `SEIB–DGVM: A new Dynamic Global Vegetation Model using a spatially explicit individual-based approach`. Ecological Modelling 200.3, pp. 2793307. .. _sellers1996: -Sellers, Piers J et al. (1996). `A revised land surface parameterization (SiB2) for atmospheric GCMs. Part II: The generation of global fields of terrestrial biophysical parameters from satellite data`. Journal of climate 9.4, pp. 706-737. +|br| + +Sellers, Piers J et al. (1996). `A revised land surface parameterization (SiB2) for atmospheric GCMs. Part II: The generation of global fields of terrestrial biophysical parameters from satellite data`. Journal of climate 9.4, pp. 706-737. .. _sitch2003: -Sitch, S et al. (2003). `Evaluation of ecosystem dynamics, plant geography and terrestrial carbon cycling in the LPJ dynamic global vegetation model`. Global Change Biology 9.2, pp. 161-185. +|br| + +Sitch, S et al. (2003). `Evaluation of ecosystem dynamics, plant geography and terrestrial carbon cycling in the LPJ dynamic global vegetation model`. Global Change Biology 9.2, pp. 161-185. .. _smith2007: -Smith, Alison M and Mark Stitt (2007). `Coordination of carbon supply and plant growth`. Plant, cell & environment 30.9, pp. 1126-1149. +|br| + +Smith, Alison M and Mark Stitt (2007). `Coordination of carbon supply and plant growth`. Plant, cell & environment 30.9, pp. 1126-1149. .. _smith2001: -Smith, Benjamin, I Colin Prentice, and Martin T Sykes (2001). `Representation of vegetation dynamics in the modelling of terrestrial ecosystems: comparing two contrasting approaches within European climate space`. Global Ecology and Biogeography 10.6, pp. 621-637. +|br| + +Smith, Benjamin, I Colin Prentice, and Martin T Sykes (2001). `Representation of vegetation dynamics in the modelling of terrestrial ecosystems: comparing two contrasting approaches within European climate space`. Global Ecology and Biogeography 10.6, pp. 621-637. .. _thonicke2010: -Thonicke, K et al. (2010). `The influence of vegetation, fire spread and fire behaviour on biomass burning and trace gas emissions: results from a process-based model`. Biogeosciences 7.6, pp. 1991-2011. +|br| + +Thonicke, K et al. (2010). `The influence of vegetation, fire spread and fire behaviour on biomass burning and trace gas emissions: results from a process-based model`. Biogeosciences 7.6, pp. 1991-2011. .. _uriarte2009: +|br| + Uriarte, Maria et al. (2009). `Natural disturbance and human land use as determinants of tropical forest dynamics: results from a forest simulator`. Ecological Monographs 79.3, pp. 423-443. .. _venevsky2002: +|br| + Venevsky, Sergey et al. (2002). `Simulating fire regimes in human-dominated ecosystems: Iberian Peninsula case study`. Global Change Biology 8.10, pp. 984-998. .. _weng2014: +|br| + Weng, ES et al. (2014). `Scaling from individuals to ecosystems in an Earth System Model using a mathematically tractable model of height-structured competition for light`. Biogeosciences Discussions 11.12, pp. 17757-17860. .. _xiaodong2005: -Xiaodong, Yan and HH Shugart (2005). `FAREAST: a forest gap model to simulate dynamics and patterns of eastern Eurasian forests`. Journal of Biogeography 32.9, pp. 1641-1658. -42 +|br| +Xiaodong, Yan and HH Shugart (2005). `FAREAST: a forest gap model to simulate dynamics and patterns of eastern Eurasian forests`. Journal of Biogeography 32.9, pp. 1641-1658. diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index 3f60029854..d54e70f1e9 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -11,7 +11,6 @@ CLM Technical Note .. toctree:: :maxdepth: 2 - :numbered: Introduction/CLM50_Tech_Note_Introduction.rst Ecosystem/CLM50_Tech_Note_Ecosystem.rst diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst index 510d4b22a2..bdb52253a1 100644 --- a/doc/source/users_guide/index.rst +++ b/doc/source/users_guide/index.rst @@ -11,7 +11,6 @@ CLM User's Guide .. toctree:: :maxdepth: 2 - :numbered: overview/index.rst setting-up-and-running-a-case/index.rst diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index de8dcc25fa..d6c5781a17 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -1,5 +1,21 @@ .. _introduction: +**User's Guide to version 5.0 of the Community Land Model (CLM)** + +**Authors: Benjamin Andre, Erik Kluzek, William Sacks** + +The National Center for Atmospheric Research (NCAR) is operated by the +nonprofit University Corporation for Atmospheric Research (UCAR) under +the sponsorship of the National Science Foundation. Any opinions, +findings, conclusions, or recommendations expressed in this publication +are those of the author(s) and do not necessarily reflect the views of +the National Science Foundation. + +National Center for Atmospheric Research +P. O. Box 3000, Boulder, Colorado 80307-300 + +.. _rst_Users_Guide_Introduction: + ============== Introduction ============== @@ -69,10 +85,10 @@ machine is working correctly. What is New with CLM4.5 ========================= -The CESM1.2.0 `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. +The CESM1.2.0 `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. More details are given in the `CLM ChangeLog file `_. -Previous release pages give similar list of changes for previous versions of the model. +Previous release pages give similar list of changes for previous versions of the model. The `CLM4 in CESM1.0.5 User's Guide `_ gives information on the updates for versions up to CLM4 in CESM1.0.5. .. _users-guide-overview: @@ -81,51 +97,51 @@ The `CLM4 in CESM1.0.5 User's Guide `_ gives information on the updates Overview of User's Guide ========================== -In this introduction we first give a simple guide to understand the document conventions in `How to Use This Document `_. -The next section `What is new with CLM4.5 in CESM1.2.0 since previous public releases? `_ gives references to describe the differences between CLM4.5 in CESM1.2.0 and previous CESM releases both from a scientific as well as a software engineering point of view. -For information on previous releases of CLM4.5 before CLM4.5 in CESM1.2.0 see the CESM1.1.1 documentation. -The next section `Quickstart to using CLM4.5 `_ is for users that are already experts in using CLM and gives a quickstart guide to the bare details on how to use CLM4.5. -The next `What is scientifically validated and functional in CLM4.5 in CESM1.2.0? `_ tells you about what has been extensively tested and scientifically validated (and maybe more importantly) what has NOT. -`What are the UNIX utilities required to use CLM4.5? `_ lists the UNIX utilities required to use CLM4.5 and is important if you are running on non-NCAR machines, generic local machines, or machines NOT as well tested by us at NCAR. -Next we have `Important Notes and Best Practices for Usage of CLM4.5 `_ to detail some of the best practices for using CLM4.5 for science. +In this introduction we first give a simple guide to understand the document conventions in `How to Use This Document `_. +The next section `What is new with CLM4.5 in CESM1.2.0 since previous public releases? `_ gives references to describe the differences between CLM4.5 in CESM1.2.0 and previous CESM releases both from a scientific as well as a software engineering point of view. +For information on previous releases of CLM4.5 before CLM4.5 in CESM1.2.0 see the CESM1.1.1 documentation. +The next section `Quickstart to using CLM4.5 `_ is for users that are already experts in using CLM and gives a quickstart guide to the bare details on how to use CLM4.5. +The next `What is scientifically validated and functional in CLM4.5 in CESM1.2.0? `_ tells you about what has been extensively tested and scientifically validated (and maybe more importantly) what has NOT. +`What are the UNIX utilities required to use CLM4.5? `_ lists the UNIX utilities required to use CLM4.5 and is important if you are running on non-NCAR machines, generic local machines, or machines NOT as well tested by us at NCAR. +Next we have `Important Notes and Best Practices for Usage of CLM4.5 `_ to detail some of the best practices for using CLM4.5 for science. The last introductory section is `Other resources `_ to get help from which lists different resources for getting help with CESM1.0 and CLM4.5. -`Chapter 1 `_ goes into detail on how to setup and run simulations with CLM4.5 and especially how to customize cases. +`Chapter 1 `_ goes into detail on how to setup and run simulations with CLM4.5 and especially how to customize cases. Details of cesm_setup modes and build-namelist options as well as namelist options are given in this chapter. -`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.0 or CLM4.5 physics for creating input datasets for use by CLM, for the expert user. -There's an overview of what each tool does, and some general notes on how to build the FORTRAN tools. -Then each tool is described in detail along with different ways in which the tool might be used. +`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.0 or CLM4.5 physics for creating input datasets for use by CLM, for the expert user. +There's an overview of what each tool does, and some general notes on how to build the FORTRAN tools. +Then each tool is described in detail along with different ways in which the tool might be used. A final section on how to customize datasets for observational sites for very savvy expert users is given as the last section of this chapter. -As a followup to the tools chapter, `Chapter 3 `_ tells how to add files to the XML database for build-namelist to use. +As a followup to the tools chapter, `Chapter 3 `_ tells how to add files to the XML database for build-namelist to use. This is important if you want to use the XML database to automatically select user-created input files that you have created when you setup new cases with CLM (both CLM4.0 and CLM4.5 physics). -In `Chapter 4 `_, again for the expert user, we give details on how to do some particularly difficult special cases. -For example, we give the protocol for spinning up the CLM4.5-BGC and CLMCN models as well as CLM with dynamic vegetation active (CNDV). -We give instructions to do a spinup case from a previous case with Coupler history output for atmospheric forcing. -We also give instructions on running both the prognostic crop and irrigation models. +In `Chapter 4 `_, again for the expert user, we give details on how to do some particularly difficult special cases. +For example, we give the protocol for spinning up the CLM4.5-BGC and CLMCN models as well as CLM with dynamic vegetation active (CNDV). +We give instructions to do a spinup case from a previous case with Coupler history output for atmospheric forcing. +We also give instructions on running both the prognostic crop and irrigation models. Lastly we tell the user how to use the DATM model to send historical CO2 data to CLM. -`Chapter 5 `_ outlines how to do single-point or regional simulations using CLM4.5. -This is useful to either compare CLM4.5 simulations with point observational stations, such as tower sites (which might include your own atmospheric forcing), or to do quick simulations with CLM for example to test a new parameterization. -There are several different ways given on how to perform single-point simulations which range from simple PTS_MODE to more complex where you create all your own datasets, tying into `Chapter 2 `_ and also `Chapter 3 `_ to add the files into the build-namelist XML database. -The PTCLM python script to run single-point simulations was added back in for this release (but it has bugs that don't allow it to work out of the box). +`Chapter 5 `_ outlines how to do single-point or regional simulations using CLM4.5. +This is useful to either compare CLM4.5 simulations with point observational stations, such as tower sites (which might include your own atmospheric forcing), or to do quick simulations with CLM for example to test a new parameterization. +There are several different ways given on how to perform single-point simulations which range from simple PTS_MODE to more complex where you create all your own datasets, tying into `Chapter 2 `_ and also `Chapter 3 `_ to add the files into the build-namelist XML database. +The PTCLM python script to run single-point simulations was added back in for this release (but it has bugs that don't allow it to work out of the box). CLM4 in CESM1.0.5 has a fully working versions of PTCLM. Need `Chapter 6 `_ blurb... -`Chapter 7 `_ gives some guidance on trouble-shooting problems when using CLM4.5. +`Chapter 7 `_ gives some guidance on trouble-shooting problems when using CLM4.5. It doesn't cover all possible problems with CLM, but gives you some guidelines for things that can be done for some common problems. -`Chapter 8 `_ goes over the automated testing scripts for validating that the CLM is working correctly. -The test scripts run many different configurations and options with CLM4.0 physics as well and CLM4.5 physics making sure that they work, as well as doing automated testing to verify restarts are working correctly, and testing at many different resolutions. +`Chapter 8 `_ goes over the automated testing scripts for validating that the CLM is working correctly. +The test scripts run many different configurations and options with CLM4.0 physics as well and CLM4.5 physics making sure that they work, as well as doing automated testing to verify restarts are working correctly, and testing at many different resolutions. In general this is an activity important only for a developer of CLM4.5, but could also be used by users who are doing extensive code modifications and want to ensure that the model continues to work correctly. In the appendices we talk about some issues that are useful for advanced users and developers of CLM4.5. -Finally in `Appendix A `_ we give instructions on how to build the documentation associated with CLM4.5 (i.e. how to build this document). -This document is included in every CLM distribution and can be built so that you can view a local copy rather than having to go to the CESM website. +Finally in `Appendix A `_ we give instructions on how to build the documentation associated with CLM4.5 (i.e. how to build this document). +This document is included in every CLM distribution and can be built so that you can view a local copy rather than having to go to the CESM website. This also could be useful for developers who need to update the documentation due to changes they have made. .. _best-practices-for-usage: @@ -134,40 +150,40 @@ This also could be useful for developers who need to update the documentation du Best Practices ================ -- CLM4.5 includes BOTH the old CLM4.0 physics AND the new CLM4.5 physics and you can toggle between two. - The "standard" practice for CLM4.0 is to run with CN on, and with Qian atmospheric forcing. - While the "standard" practice for CLM4.5 is to run with BGC on, and CRUNCEP atmospheric forcing. +- CLM4.5 includes BOTH the old CLM4.0 physics AND the new CLM4.5 physics and you can toggle between two. + The "standard" practice for CLM4.0 is to run with CN on, and with Qian atmospheric forcing. + While the "standard" practice for CLM4.5 is to run with BGC on, and CRUNCEP atmospheric forcing. "BGC" is the new CLM4.5 biogeochemistry and include CENTURY-like pools, vertical resolved carbon, as well as Nitrification and de-Nitrification (see `the Section called Some Acronym's and Terms We'll be Using in Other resources to get help from `_ ). -- When running with CLMCN (either CLM4.0 or CLM4.5 physics) or CLM4.5-BGC, it is critical to begin with initial conditions that are provided with the release or to spin the model up following the CN spinup procedure before conducting scientific runs (see `the Section called Spinning up the CLM4.5 biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for CLM4.5 or `the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4 `_ for CLM4.0). - Simulations without a proper spinup will effectively be starting from an unvegetated world. +- When running with CLMCN (either CLM4.0 or CLM4.5 physics) or CLM4.5-BGC, it is critical to begin with initial conditions that are provided with the release or to spin the model up following the CN spinup procedure before conducting scientific runs (see `the Section called Spinning up the CLM4.5 biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for CLM4.5 or `the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4 `_ for CLM4.0). + Simulations without a proper spinup will effectively be starting from an unvegetated world. See `the Section called Setting Your Initial Conditions File in Chapter 1 `_ for information on how to provide initial conditions for your simulation. -- Initial condition files are provided for CLM4.0-CN as before, for fully coupled BCN and offline ICN cases for 1850 and 2000 at finite volume grids: 1deg (0.9x1.25), 2deg (1.9x2.5), and T31 resolutions. - We also have interpolated initial conditions for BCN for 1850 and 2000 for two finite volume grids: 10x15, 4x5 and two HOMME grids (ne30np4 and ne120np4). - There's also an initial condition file for ICN with the prognostic crop model for 2000 at 2deg resolution, and one with CLMSP for 2000 at 2deg resolution. - We also have initial conditions for offline CNDV for 1850. - The 1850 initial condition files are in 'reasonable' equilibrium. - The 2000 initial condition files represent the model state for the year 2000, and have been taken from transient simulations. - Therefore, by design the year 2000 initial condition files do not represent an equilibrium state. +- Initial condition files are provided for CLM4.0-CN as before, for fully coupled BCN and offline ICN cases for 1850 and 2000 at finite volume grids: 1deg (0.9x1.25), 2deg (1.9x2.5), and T31 resolutions. + We also have interpolated initial conditions for BCN for 1850 and 2000 for two finite volume grids: 10x15, 4x5 and two HOMME grids (ne30np4 and ne120np4). + There's also an initial condition file for ICN with the prognostic crop model for 2000 at 2deg resolution, and one with CLMSP for 2000 at 2deg resolution. + We also have initial conditions for offline CNDV for 1850. + The 1850 initial condition files are in 'reasonable' equilibrium. + The 2000 initial condition files represent the model state for the year 2000, and have been taken from transient simulations. + Therefore, by design the year 2000 initial condition files do not represent an equilibrium state. Note also that spinning the 2000 initial conditions out to equilibrium will not reflect the best estimate of the real carbon/nitrogen state for the year 2000. - -- Initial condition files are also provided for CLM4.5 for several configurations and resolutions. - For CLM4.5-SP and CLM4.5-BGC with CRUNCEP forcing we have initial conditions at 1deg resolution for both 1850 and 2000. - The CLM4.5-BGC initial conditions for 1850 (again with CRUNCEP forcing) were also interpolated to 2deg, CRUNCEP half degree (360x720cru), and ne30np4 resolutions. + +- Initial condition files are also provided for CLM4.5 for several configurations and resolutions. + For CLM4.5-SP and CLM4.5-BGC with CRUNCEP forcing we have initial conditions at 1deg resolution for both 1850 and 2000. + The CLM4.5-BGC initial conditions for 1850 (again with CRUNCEP forcing) were also interpolated to 2deg, CRUNCEP half degree (360x720cru), and ne30np4 resolutions. Also the CLM4.5-BGC initial conditions for 1850 (with CRUNCEP forcing) were interpolated to 1deg CLM4.5-BGC-DV and 2deg CLM4.5-BGC-Crop. - -- Users can generate initial condition files at different resolutions by using the CLM tool interpinic to interpolate from one of the provided resolutions to the resolution of interest. + +- Users can generate initial condition files at different resolutions by using the CLM tool interpinic to interpolate from one of the provided resolutions to the resolution of interest. Interpolated initial condition files may no longer be in 'reasonable' equilibrium. -- In CLM4.5 for both CLM4.5-CN and CLM4.5-BGC the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). - By default we have provided a climatology dataset for lightning frequency and a dataset with coverage from 1850 to 2010 for population density. - Both of these datasets are interpolated from the native resolution of the datasets to the resolution you are running the model on. +- In CLM4.5 for both CLM4.5-CN and CLM4.5-BGC the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). + By default we have provided a climatology dataset for lightning frequency and a dataset with coverage from 1850 to 2010 for population density. + Both of these datasets are interpolated from the native resolution of the datasets to the resolution you are running the model on. If you are running with an atmosphere model or forcing that is significantly different than present day -- the lightning frequency may NOT appropriately correspond to your atmosphere forcing and fire initiation would be inappropriate. - -- Aerosol deposition is a required field to both CLM4.0 and CLM4.5 physics, sent from the atmosphere model. - Simulations without aerosol deposition will exhibit unreasonably high snow albedos. - The model sends aerosol deposition from the atmospheric model (either CAM or DATM). + +- Aerosol deposition is a required field to both CLM4.0 and CLM4.5 physics, sent from the atmosphere model. + Simulations without aerosol deposition will exhibit unreasonably high snow albedos. + The model sends aerosol deposition from the atmospheric model (either CAM or DATM). When running with prescribed aerosol the atmosphere model will interpolate the aerosols from 2-degree resolution to the resolution the atmosphere model is running at. .. _how-to-use-this-document: @@ -185,15 +201,14 @@ Links to descriptions and definitions have been provided in the code below. We u Where examples from an interactive shell session are presented, lines starting with > indicate the shell prompt. A backslash "\" at the end of a line means the line continues onto the next one (as it does in - standard UNIX shell). Note that $EDITOR" is used to refer to the - text editor of your choice. $EDITOR is a standard UNIX environment - variable and should be set on most UNIX systems. Comment lines are + standard UNIX shell). Note that $EDITOR" is used to refer to the + text editor of your choice. $EDITOR is a standard UNIX environment + variable and should be set on most UNIX systems. Comment lines are signaled with a "#" sign, which is the standard UNIX comment sign as well. $CSMDATA is used to denote the path to the inputdata directory for - your CESM data. + your CESM data. > This is a shell prompt with commands \ that continues to the following line. > $EDITOR filename # means you are using a text editor to edit "filename" # This is a comment line - From 4a4604b93962339cc7c9ed06aa8bf76f2925b299 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Mon, 29 Jan 2018 14:50:22 -0700 Subject: [PATCH 0126/1973] Updated Stomatal Resistance chapter based on comments from Gordon --- .../CLM50_Tech_Note_Photosynthesis.rst | 69 ++++++++----------- 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index b8e443f10a..8dad4faf3e 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -40,9 +40,6 @@ area indices (section :numref:`Solar Fluxes`). Canopy conductance is :math:`\frac{1}{r_{b} +r_{s}^{sun} } L^{sun} +\frac{1}{r_{b} +r_{s}^{sha} } L^{sha}` , where :math:`r_{b}` is the leaf boundary layer resistance (section :numref:`Sensible and Latent Heat Fluxes and Temperature for Vegetated Surfaces`). -The implementation is described by Bonan et al. (:ref:`2011 `), though different -methods of calculating stomatal conductance, :math:`J_{max}`, and the nitrogen variables -used to calculate :math:`V_{cmax25}` are used in CLM5. .. _Stomatal resistance: @@ -60,7 +57,7 @@ Leaf stomatal resistance is: .. math:: :label: 9.1 - \frac{1}{r_{s} } =g_{s} = g_{o} + (1 + \frac{g_{1} }{\sqrt{D}}) \frac{A_{n} }{{c_{s} \mathord{\left/ {\vphantom {c_{s} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } } + \frac{1}{r_{s} } =g_{s} = g_{o} + 1.6(1 + \frac{g_{1} }{\sqrt{D}}) \frac{A_{n} }{{c_{s} \mathord{\left/ {\vphantom {c_{s} P_{atm} }} \right. \kern-\nulldelimiterspace} P_{atm} } } where :math:`r_{s}` is leaf stomatal resistance (s m\ :sup:`2` :math:`\mu`\ mol\ :sup:`-1`), :math:`g_{o}` is the minimum stomatal conductance @@ -68,20 +65,9 @@ where :math:`r_{s}` is leaf stomatal resistance (s m\ :sup:`2` photosynthesis (:math:`\mu`\ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`), :math:`c_{s}` is the CO\ :sub:`2` partial pressure at the leaf surface (Pa), :math:`P_{atm}` is the atmospheric -pressure (Pa), and :math:`D` is the vapor pressure deficit at the leaf surface (Pa). -:math:`g_{1}` is a plant functional type dependent parameter (:numref:`Table Plant functional type (PFT) stomatal conductance parameters`) -and can be calculated as +pressure (Pa), and :math:`D` is the vapor pressure deficit at the leaf surface (kPa). +:math:`g_{1}` is a plant functional type dependent parameter (:numref:`Table Plant functional type (PFT) stomatal conductance parameters`). -.. math:: - :label: 9.2 - - g_{1} = {\sqrt{\frac{3\Gamma\lambda}{1.6}}} - -where :math:`\Gamma` (mol mol\ :sup:`-1`) is the CO\ :sub:`2` compensation point -for photosynthesis without dark respiration, -1.6 is the ratio of diffusivity of CO\ :sub:`2` to H\ :sub:`2` O and :math:`\lambda` -(mol H\ :sub:`2` O mol\ :sup:`-1`) is a parameter -describing the marginal water cost of carbon gain. The value for :math:`g_{o}=100` :math:`\mu` mol m :sup:`-2` s\ :sup:`-1` for C\ :sub:`3` and C\ :sub:`4` plants. Photosynthesis is calculated for sunlit (:math:`A^{sun}`) and shaded @@ -93,7 +79,7 @@ the :ref:`rst_Plant Hydraulics` chapter. Resistance is converted from units of s m\ :sup:`2` :math:`\mu` mol\ :sup:`-1` to s m\ :sup:`-1` as: 1 s m\ :sup:`-1` = :math:`1\times 10^{-9} R_{gas} \frac{\theta _{atm} }{P_{atm} }` -:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, [same as 4.5, but units seem off. check that units are correct] +:math:`\mu` mol\ :sup:`-1` m\ :sup:`2` s, where :math:`R_{gas}` is the universal gas constant (J K\ :sup:`-1` kmol\ :sup:`-1`) (:numref:`Table Physical constants`) and :math:`\theta _{atm}` is the atmospheric potential temperature (K). @@ -270,6 +256,7 @@ depend on temperature. Values at 25 :sup:`o` \ C are :math:`\Gamma _{25} {\rm =42}.75\times 10^{-6} P_{atm}`. :math:`V_{c\max }`, :math:`J_{\max }`, :math:`T_{p}`, :math:`k_{p}`, and :math:`R_{d}` also vary with temperature. Parameter values at 25 +[verify with Rosie that LUNA doesn't do this otherwise] :sup:`o`\ C are calculated from :math:`V_{c\max }` \ at 25 :sup:`\o`\ C: :math:`J_{\max 25} =1.97V_{c\max 25}`, :math:`T_{p25} =0.167V_{c\max 25}`, and @@ -293,7 +280,7 @@ The parameters :math:`V_{c\max 25}`, \begin{array}{rcl} {V_{c\max } } & {=} & {V_{c\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {J_{\max } } & {=} & {J_{\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {T_{p} } & {=} & {T_{p25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {R_{d} } & {=} & {R_{d25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {K_{c} } & {=} & {K_{c25} \; f\left(T_{v} \right)} \\ {K_{o} } & {=} & {K_{o25} \; f\left(T_{v} \right)} \\ {\Gamma } & {=} & {\Gamma _{25} \; f\left(T_{v} \right)} \end{array} -with +[check with Rosie about Rd equation above and below (eq. 14)] with .. math:: :label: 9.11 @@ -522,14 +509,33 @@ resistance (:math:`r_{s}` ) as a function of photosynthesis .. math:: :label: 9.36 - c_{s} g_{s}^{2} +\left[c_{s} \left(g_{b} -b\right)-m{\it A}_{n} P_{atm} \right]g_{s} -g_{b} \left[c_{s} b+mA_{n} P_{atm} {e_{a} \mathord{\left/ {\vphantom {e_{a} e_{\*} \left(T_{v} \right)}} \right. \kern-\nulldelimiterspace} e_{\*} \left(T_{v} \right)} \right]=0. + g_{s}^{2} + bg_{s} + c = 0 -Stomatal conductance is the larger of the two roots that satisfy the -quadratic equation. Values for :math:`c_{i}` are given by +where .. math:: :label: 9.37 + b = 2(g_{o} * 10^{-6} + d) + \frac{(g_{1}d)^{2}}{g_{b}*10^{-6}D} + + c = (g_{o}*10^{-6})^{2} + [2g_{o}*10^{-6} + d \frac{1-g_{1}^{2}} {D}]d + +and + +.. math:: + :label: 9.38 + + d = \frac {1.6 A_{n}} {c_{s} / P_{atm} * 10^{6}} + + D = \frac {e_{i} - e_{a}} {1000} + + +Stomatal conductance, as solved by equation :eq:`9.36` (mol m :sup:`-2` s :sup:`-1`), is the larger of the two roots that satisfy the +quadratic equation. Values for :math:`c_{i}` are given by + +.. math:: + :label: 9.39 + c_{i} =c_{a} -\left(1.4r_{b} +1.6r_{s} \right)P_{atm} A{}_{n} The equations for :math:`c_{i}` , :math:`c_{s}` , :math:`r_{s}` , and @@ -541,23 +547,4 @@ combines the secant method and Brent’s method to solve for (:math:`A_{n}^{sun}` , :math:`r_{s}^{sun}` ) and shaded (:math:`A_{n}^{sha}` , :math:`r_{s}^{sha}` ) leaves. -The model has an optional (though not supported) multi-layer canopy, as -described by :ref:`Bonan et al. (2012)`. The multi-layer model is only intended -to address the non-linearity of light profiles, photosynthesis, and -stomatal conductance in the plant canopy. In the multi-layer canopy, -sunlit (:math:`A_{n}^{sun}` , :math:`r_{s}^{sun}` ) and shaded -(:math:`A_{n}^{sha}` , :math:`r_{s}^{sha}` ) leaves are explicitly -resolved at depths in the canopy using a light profile (Chapter :numref:`rst_Radiative Fluxes`). In -this case, :math:`V_{c\max 25}` is not integrated over the canopy, but -is instead given explicitly for each canopy layer using equation :eq:`9.18`. This -also uses the :ref:`Lloyd et al. (2010)` relationship whereby -K\ :sub:`n` scales with V\ :sub:`cmax` as - -.. math:: - :label: 9.38 - - K_{n} =\exp \left(0.00963V_{c\max } -2.43\right) -such that higher values of V\ :sub:`cmax` imply steeper declines -in photosynthetic capacity through the canopy with respect to cumulative -leaf area. From f52ce6c93555d6bec7f0436893dc78fe759556ea Mon Sep 17 00:00:00 2001 From: mvertens Date: Mon, 29 Jan 2018 20:03:36 -0700 Subject: [PATCH 0127/1973] new Makefiles introduced: to build pdf issue "make -f Makefile.tech_note latexpdf" TWICE and then open the file build/tech_note/latex/clmdoc.pdf --- doc/Makefile.tech_note | 20 ++++ doc/Makefile.users_guide | 20 ++++ doc/source/tech_note/conf.py | 170 +++++++++++++++++++++++++++++++++ doc/source/users_guide/conf.py | 170 +++++++++++++++++++++++++++++++++ 4 files changed, 380 insertions(+) create mode 100644 doc/Makefile.tech_note create mode 100644 doc/Makefile.users_guide create mode 100644 doc/source/tech_note/conf.py create mode 100644 doc/source/users_guide/conf.py diff --git a/doc/Makefile.tech_note b/doc/Makefile.tech_note new file mode 100644 index 0000000000..07ebab36e6 --- /dev/null +++ b/doc/Makefile.tech_note @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = clmdoc +SOURCEDIR = source/tech_note +BUILDDIR = build/tech_note + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile.tech_note + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/doc/Makefile.users_guide b/doc/Makefile.users_guide new file mode 100644 index 0000000000..08562d18ca --- /dev/null +++ b/doc/Makefile.users_guide @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = clmdoc +SOURCEDIR = source/users_guide +BUILDDIR = build/users_guide + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile.users_guide + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/doc/source/tech_note/conf.py b/doc/source/tech_note/conf.py new file mode 100644 index 0000000000..a866c7f3fb --- /dev/null +++ b/doc/source/tech_note/conf.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- +# +# clmdoc documentation build configuration file, created by +# sphinx-quickstart on Thu Feb 23 17:14:30 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.intersphinx', + 'sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.imgmath', + 'sphinx.ext.githubpages'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'clmdoc' +copyright = u'2017, Erik Kluzek, Bill Sacks, Ben Andre' +author = u'Erik Kluzek, Bill Sacks, Ben Andre' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'' +# The full version, including alpha/beta/rc tags. +release = u'' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'bizstyle' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'clmdocdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + 'preamble': '\\usepackage{hyperref}', + + 'fncychap': '\\usepackage[Conny]{fncychap}', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [(master_doc, 'clmdoc.tex', u'CLM5 Documentation', '', 'manual'),] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'clmdoc', u'clmdoc Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'clmdoc', u'clmdoc Documentation', + author, 'clmdoc', 'One line description of project.', + 'Miscellaneous'), +] + + + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None} + +numfig = True +numfig_format = {'figure': 'Figure %s', + 'table': 'Table %s', + 'code-block': 'Code %s', + 'section': '%s', + } diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py new file mode 100644 index 0000000000..a866c7f3fb --- /dev/null +++ b/doc/source/users_guide/conf.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- +# +# clmdoc documentation build configuration file, created by +# sphinx-quickstart on Thu Feb 23 17:14:30 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.intersphinx', + 'sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.imgmath', + 'sphinx.ext.githubpages'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'clmdoc' +copyright = u'2017, Erik Kluzek, Bill Sacks, Ben Andre' +author = u'Erik Kluzek, Bill Sacks, Ben Andre' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'' +# The full version, including alpha/beta/rc tags. +release = u'' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'bizstyle' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'clmdocdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + 'preamble': '\\usepackage{hyperref}', + + 'fncychap': '\\usepackage[Conny]{fncychap}', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [(master_doc, 'clmdoc.tex', u'CLM5 Documentation', '', 'manual'),] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'clmdoc', u'clmdoc Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'clmdoc', u'clmdoc Documentation', + author, 'clmdoc', 'One line description of project.', + 'Miscellaneous'), +] + + + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None} + +numfig = True +numfig_format = {'figure': 'Figure %s', + 'table': 'Table %s', + 'code-block': 'Code %s', + 'section': '%s', + } From 9564f466a4f1de4079f3add4d8ba1fa00383f629 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 31 Jan 2018 11:46:32 -0700 Subject: [PATCH 0128/1973] Updated figure 1, fixed Figure and Table descriptions and links --- .../CLM50_Tech_Note_Decomposition.rst | 4 +-- .../CLM50_Tech_Note_Introduction.rst | 36 ++++++++----------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index 30c9b3988d..0d2ad98687 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -101,7 +101,7 @@ for the coarse woody debris pool (CWD). .. _Table Decomposition rate constants: -.. table:: Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. +.. table:: Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters for the CLM-CN decomposition pool structure. +--------------------------+------------------------------------------------+-----------------------------------------------+---------------+-----------------------------------------+ | | Biome-BGC | CLM-CN | | | @@ -195,7 +195,7 @@ those described in Parton et al. (1988) (:numref:`Table Turnover times`). .. _Table Turnover times: -.. table:: Turnover times, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the Century-based decomposition cascade. +.. table:: Turnover times, C:N ratios, and acceleration parameters for the Century-based decomposition cascade. +------------+------------------------+-------------+-------------------------------------------+ | | Turnover time (year) | C:N ratio | Acceleration term (:math:`{a}_{i}`) | diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 339ec3d05f..a887e5d9fc 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -1,4 +1,4 @@ -**July 2017** +**February 2018** **Technical Description of version 5.0 of the Community Land Model (CLM)** @@ -31,7 +31,7 @@ P. O. Box 3000, Boulder, Colorado 80307-300 **LIST OF FIGURES** -- :numref:`Figure Land processes` Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from Lawrence et al. (2011) for CLM4.5). +- :numref:`Figure Land processes` Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from Lawrence et al. (2011) for CLM5.0). - :numref:`Figure CLM subgrid hierarchy` Configuration of the CLM subgrid hierarchy. @@ -57,25 +57,19 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Figure Vegetation fluxes and pools` Vegetation fluxes and pools. -- :numref:`Figure Carbon and nitrogen pools` Carbon and nitrogen pools. - - :numref:`Figure annual phenology cycle` Example of annual phenology cycle for seasonal deciduous. -- 14.2. Example fluxes and pools sizes for an onset growth period of 15 days, with initial transfer pool size of 100 gC m-2 and a timestep of one hour. a) Flux leaving transfer pool (e.g. CFleaf\_xfer,leaf). b) Carbon content of transfer pool and its associated display pool (e.g. CSleaf\_xfer and CSleaf, respectively). - -- 14.3. Example fluxes and pool sizes for an offset (litterfall) period of 15 days, with initial display pool size of 100 gC m-2 and a timestep of one hour. a) Litterfall flux (e.g CFleaf,litter). b) Carbon content of display pool and litter pool through the litterfall period, ignoring the losses from litter pool due to decomposition during this period. - - :numref:`Figure Schematic of decomposition model in CLM` Schematic of decomposition model in CLM. -- :numref:`Figure Pool structure` Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 alternate soil decomposition models included in CLM. +- :numref:`Figure Pool structure` Pool structure, transitions, respired fractions, and turnover times for the 2 alternate soil decomposition models included in CLM. - :numref:`Figure Biological nitrogen fixation` Biological nitrogen fixation as a function of annual net primary production. -- :numref:`Figure Methane Schematic` Schematic representation of biological and physical processes integrated in CLM that affect the net CH4 surface flux. (left) Fully inundated portion of a CLM gridcell and (right) variably saturated portion of a gridcell. +- :numref:`Figure Methane Schematic` Schematic representation of biological and physical processes integrated in CLM that affect the net CH4 surface flux. - :numref:`Figure Schematic of land cover change` Schematic of land cover change impacts on CLM carbon pools and fluxes. -- :numref:`Figure Schematic of translation of annual LUH2 land units` Schematic of translation of annual UNH land units to CLM4 plant functional types. +- :numref:`Figure Schematic of translation of annual LUH2 land units` Schematic of translation of annual UNH land units to CLM plant functional types. **LIST OF TABLES** @@ -89,7 +83,7 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Land model output to atmospheric model` Land model output to atmospheric model -- :numref:`Table Surface data required for CLM and their base spatial resolution` Surface data required for CLM4.5 and their base spatial resolution +- :numref:`Table Surface data required for CLM and their base spatial resolution` Surface data required for CLM and their base spatial resolution - :numref:`Table Physical constants` Physical constants @@ -113,7 +107,7 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Coefficients for saturation vapor pressure` Coefficients for e\ :sub:`sat`\ :sup:`T` -- :numref:`Table Coefficients for derivative of esat` Coefficients for 112:numref:`` 6.1. Soil layer structure. +- :numref:`Table Coefficients for derivative of esat` Coefficients for the derivative of e\ :sub:`sat`\ :sup:`T` - :numref:`Table Meltwater scavenging` Meltwater scavenging efficiency for particles within snow @@ -129,11 +123,11 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Allocation and CN ratio parameters` Allocation and carbon:nitrogen ratio parameters -- :numref:`Table Decomposition rate constants` Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the CLM-CN decomposition pool structure. +- :numref:`Table Decomposition rate constants` Decomposition rate constants for litter and SOM pools, C:N ratios, and acceleration parameters for the CLM-CN decomposition pool structure. - :numref:`Table Respiration fractions for litter and SOM pools` Respiration fractions for litter and SOM pools -- :numref:`Table Turnover times` Turnover times, C:N ratios, and acceleration parameters (see section 15.8 for explanation) for the Century-based decomposition cascade. +- :numref:`Table Turnover times` Turnover times, C:N ratios, and acceleration parameters for the Century-based decomposition cascade. - :numref:`Table Respiration fractions for Century-based structure` Respiration fractions for litter and SOM pools for Century-based structure @@ -143,13 +137,11 @@ P. O. Box 3000, Boulder, Colorado 80307-300 - :numref:`Table Temperature dependence of aqueous and gaseous diffusion` Temperature dependence of aqueous and gaseous diffusion coefficients for CH4 and O2. -- :numref:`Table Crop plant functional types` Crop plant functional types (pfts) in CLM4.5CNcrop and their parameters relating to phenology and morphology. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. - -- :numref:`Table Crop plant functional types` Crop pfts in CLM4.5CNcrop and their parameters relating to allocation. Numbers in the first column correspond to the list of pfts in :numref:`Table Plant functional types`. +- :numref:`Table Crop plant functional types` Crop plant functional types (PFTs). -- :numref:`Table Crop allocation parameters` Crop allocation parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. +- :numref:`Table Crop phenology parameters` Crop phenology and morphology parameters. -- :numref:`Table Plant functional type (PFT) biogeography rules` Plant functional type (PFT) biogeography rules with respect to climate. +- :numref:`Table Crop allocation parameters` Crop allocation parameters. - :numref:`Table Dust Mass fraction` Mass fraction m\ :sub:`i` , mass median diameter :sub:`v, i` , and geometric standard deviation :sub:`g, i` , per dust source mode i @@ -614,7 +606,7 @@ processes simulated include (:numref:`Figure Land processes`): #. External nitrogen cycling including deposition, denitrification, leaching, and losses due to fire (Chapter :numref:`rst_External Nitrogen Cycle`) -#. Plant mortality (Chapter :numref:`rst_Plant_Mortality`) +#. Plant mortality (Chapter :numref:`rst_Plant Mortality`) #. Fire ignition, suppression, spread, and emissions, including natural, deforestation, and agricultural fire (Chapter :numref:`rst_Fire`) @@ -635,4 +627,4 @@ processes simulated include (:numref:`Figure Land processes`): .. figure:: image1.png - Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from :ref:`Lawrence et al. (2011)` for CLM4.5). + Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from :ref:`Lawrence et al. (2011)` for CLM5.0). From 617a481ac2350376a9dd5a5c1405e83d54efd562 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 31 Jan 2018 13:32:17 -0700 Subject: [PATCH 0129/1973] Use svn rather than the default png for math images This makes the images appear much more crisp - less blurry. I did a quick visual inspection of the resulting html, and found a few problems with the svg images that I needed to fix: - CLM50_Tech_Note_Soil_Snow_Temperatures.rst There was a long array equation that didn't get rendered properly. I fixed this by breaking it into a bunch of separate equations. (Breaking it into two arrays worked, too, but it seemed cleaner just to break it into all of its pieces.) - CLM50_Tech_Note_Transient_Landcover.rst There were a few buggy math equations. I also cleaned this up a bit by removing some unnecessary '\' characters. --- doc/source/conf.py | 1 + ...CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 22 ++++++++++++++----- .../CLM50_Tech_Note_Transient_Landcover.rst | 18 +++++++-------- doc/source/tech_note/conf.py | 1 + doc/source/users_guide/conf.py | 1 + 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index a866c7f3fb..5c5b1d86ad 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -81,6 +81,7 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True +imgmath_image_format = 'svg' # -- Options for HTML output ---------------------------------------------- diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst index 780ccb4752..10c00ae1e5 100644 --- a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst @@ -71,24 +71,29 @@ and the thickness of each layer is a function of snow depth .. math:: - \begin{array}{lr} - \left\{ \begin{array}{l} snl=-1 \\ \Delta z_{0} = z_{sno} \end{array} \right\} & \qquad {\rm for\; 0.01}\le {\rm z}_{{\rm sno}} \le 0.03 \\ +.. math:: + \left\{ \begin{array}{l} snl=-2 \\ \Delta z_{-1} ={z_{sno} \mathord{\left/ {\vphantom {z_{sno} 2}} \right. \kern-\nulldelimiterspace} 2} \\ \Delta z_{0} = \Delta z_{-1} \end{array} \right\} & \qquad {\rm for\; 0.03}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.04 \\ +.. math:: + \left\{ \begin{array}{l} snl=-2 \\ \Delta z_{-1} = 0.02 \\ \Delta z_{0} = z_{sno} -\Delta z_{-1} \end{array} \right\} & \qquad {\rm for\; 0.04}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.07 \\ + +.. math:: + \left\{ \begin{array}{l} snl=-3 \\ \Delta z_{-2} = 0.02 \\ @@ -96,6 +101,8 @@ and the thickness of each layer is a function of snow depth \Delta z_{0} = \Delta z_{-1} \end{array} \right\} & \qquad {\rm for\; 0.07}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.12 \\ +.. math:: + \left\{ \begin{array}{l} snl=-3 \\ \Delta z_{-2} = 0.02 \\ @@ -103,6 +110,8 @@ and the thickness of each layer is a function of snow depth \Delta z_{0} = z_{sno} -\Delta z_{-2} -\Delta z_{-1} \end{array} \right\} & \qquad {\rm for\; 0.12}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.18 \\ +.. math:: + \left\{ \begin{array}{l} snl=-4 \\ \Delta z_{-3} = 0.02 \\ @@ -111,6 +120,8 @@ and the thickness of each layer is a function of snow depth \Delta z_{0} =\Delta z_{-1} \end{array} \right\} & \qquad {\rm for\; 0.18}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.29 \\ +.. math:: + \left\{ \begin{array}{l} snl=-4 \\ \Delta z_{-3} = 0.02 \\ @@ -119,6 +130,8 @@ and the thickness of each layer is a function of snow depth \Delta z_{0} = z_{sno} -\Delta z_{-3} -\Delta z_{-2} -\Delta z_{-1} \end{array} \right\} & \qquad {\rm for\; 0.29}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.41 \\ +.. math:: + \left\{ \begin{array}{l} snl=-5 \\ \Delta z_{-4} = 0.02 \\ @@ -126,9 +139,10 @@ and the thickness of each layer is a function of snow depth \Delta z_{-2} = 0.11 \\ \Delta z_{-1} = {\left(z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} \right)\mathord{\left/ {\vphantom {\left(z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} \right) 2}} \right. \kern-\nulldelimiterspace} 2} \\ \Delta z_{0} = \Delta z_{-1} - \end{array} \right\} & \qquad {\rm for\; 0.41}\, {\rm <}\, {\rm z}_{{\rm sno}} \le 0.64 \\ +.. math:: + \left\{ \begin{array}{l} snl=-5 \\ \Delta z_{-4} = 0.02 \\ @@ -138,8 +152,6 @@ and the thickness of each layer is a function of snow depth \Delta z_{0} = z_{sno} -\Delta z_{-4} -\Delta z_{-3} -\Delta z_{-2} -\Delta z_{-1} \end{array} \right\} & \qquad {\rm for\; 0.64}\, {\rm <}\, {\rm z}_{{\rm sno}} - \end{array} - The node depths, which are located at the midpoint of the snow layers, and the layer interfaces are both referenced from the soil surface and are defined as negative values diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index e8edb60222..493cfb2829 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -55,7 +55,7 @@ the calendar year for the current timestep, :math:`landuse.timeseries\_ year(nyears)` are the first and last calendar years in the *landuse.timeseries* dataset, respectively, :math:`nyears` is the number of years in the *landuse.timeseries* dataset, :math:`nt_{1}` and :math:`nt_{2}` -:math:`{}_{ }`\ are the two bracketing years used in the interpolation +are the two bracketing years used in the interpolation algorithm, and :math:`n` is the index value for the :math:`landuse.timeseries\_ year` array corresponding to :math:`landuse.timeseries\_ year(n)=year_{cur}` : @@ -75,7 +75,7 @@ dataset uses a simple linear algorithm, based on the conversion of the current time step information into a floating-point value for the number of calendar days since January 1 of the current model year (:math:`cday`). The interpolation weight for the current time step -:math:`tw_{cday}` \ :math:`{}_{ }`\ is +:math:`tw_{cday}` is .. math:: :label: 26.3) @@ -85,9 +85,9 @@ of calendar days since January 1 of the current model year where the numerator is 366 instead of 365 because the time manager function for CLM returns a value of :math:`cday=1.0` for midnight Greenwich mean time on January 1. With weights :math:`w_{p} (nt_{1} )` -and :math:`w_{p} (nt_{2} )`\ obtained from the *landuse.timeseries* dataset for fertilizer and wood harvest +and :math:`w_{p} (nt_{2} )` obtained from the *landuse.timeseries* dataset for fertilizer and wood harvest *p* at the bracketing annual time slices -:math:`nt_{1}` \ :math:`{}_{ }`\ and :math:`nt_{2}` , the interpolated +:math:`nt_{1}` and :math:`nt_{2}` , the interpolated application rate for the current time step (:math:`w_{p,t}` ) is .. math:: @@ -98,7 +98,7 @@ application rate for the current time step (:math:`w_{p,t}` ) is The form of this equation is designed to improve roundoff accuracy performance, and guarantees :math:`w_{p,t}` stays in the range [0,1]. Note that values for :math:`w_{p} (nt_{1} )`, :math:`w_{p} (nt_{2} )`, -and :math:`w_{p,t}` \ :math:`{}_{ }`\ are fractional weights at the +and :math:`w_{p,t}` are fractional weights at the column level of the subgrid hierarchy. The change in weight for a fertilizer or wood harvest rate between the current and previous time @@ -130,14 +130,14 @@ balance is calculated, W_{tot,1} =W_{a} +W_{sno} +\sum _{i=1}^{N_{levgrnd} }\left(w_{liq,i} +w_{ice,i} \right) +\sum _{j=1}^{npft}\left(W_{can,j} wt_{j,1} \right) where :math:`W_{a}` is the aquifer water, :math:`W_{sno}` is the snow -water, :math:`w_{liq,i}` and :math:`w_{ice,i}` \ are the liquid and ice -soil water contents, :math:`W_{can,j}` \ is the canopy water content for +water, :math:`w_{liq,i}` and :math:`w_{ice,i}` are the liquid and ice +soil water contents, :math:`W_{can,j}` is the canopy water content for PFT and CFT :math:`j`, and :math:`wt_{j,1}` is the PFT or CFT weight for :math:`j`. For the situation where PFT and CFT weights are changing, any difference -between :math:`W_{tot,1}` and :math:`W_{tot,2}` \ are due to +between :math:`W_{tot,1}` and :math:`W_{tot,2}` are due to differences in the total canopy water before and after the PFT and CFT weight change. To ensure conservation, the typically very small -difference between :math:`W_{tot,2}` \ and :math:`W_{tot,1}` is +difference between :math:`W_{tot,2}` and :math:`W_{tot,1}` is subtracted from the grid cell runoff .. math:: diff --git a/doc/source/tech_note/conf.py b/doc/source/tech_note/conf.py index a866c7f3fb..5c5b1d86ad 100644 --- a/doc/source/tech_note/conf.py +++ b/doc/source/tech_note/conf.py @@ -81,6 +81,7 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True +imgmath_image_format = 'svg' # -- Options for HTML output ---------------------------------------------- diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py index a866c7f3fb..5c5b1d86ad 100644 --- a/doc/source/users_guide/conf.py +++ b/doc/source/users_guide/conf.py @@ -81,6 +81,7 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True +imgmath_image_format = 'svg' # -- Options for HTML output ---------------------------------------------- From 7b61cfddaf0e8b1304665b76e7400e21c4e2e199 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 31 Jan 2018 22:10:30 -0700 Subject: [PATCH 0130/1973] Work on glacier and ice sheet section and related documentation elsewhere --- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 69 ++-- .../Glacier/CLM50_Tech_Note_Glacier.rst | 306 ++++++++++++------ .../CLM50_Tech_Note_Introduction.rst | 4 +- .../References/CLM50_Tech_Note_References.rst | 9 + 4 files changed, 262 insertions(+), 126 deletions(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 6463e9d255..139aea37df 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -31,22 +31,25 @@ The second subgrid level, the column, is intended to capture potential variability in the soil and snow state variables within a single land unit. For example, the vegetated land unit could contain several columns with independently evolving vertical profiles of soil water and -temperature. Similarly, the managed vegetation land unit can be -divided into two columns, irrigated and non-irrigated. The default snow/soil -column is represented by 25 layers for ground (with up to 20 of these layers classified as soil layers and the remaining layers classified as bedrock layers) and up to 10 layers -for snow, depending on snow depth. The central characteristic of the -column subgrid level is that this is where the state variables for water -and energy in the soil and snow are defined, as well as the fluxes of -these components within the soil and snow. Regardless of the number and -type of PFTs occupying space on the column, the column physics operates -with a single set of upper boundary fluxes, as well as a single set of -transpiration fluxes from multiple soil levels. These boundary fluxes -are weighted averages over all PFTs. Currently, for glacier, lake, and -vegetated land units, a single column is assigned to each land unit. The -crop land unit is split into irrigated and unirrigated columns with a -single crop occupying each column. The urban land units have five -columns (roof, sunlit walls and shaded walls, and pervious and -impervious canyon floor) (Oleson et al. 2010b). +temperature. Similarly, the managed vegetation land unit can be divided +into two columns, irrigated and non-irrigated. The default snow/soil +column is represented by 25 layers for ground (with up to 20 of these +layers classified as soil layers and the remaining layers classified as +bedrock layers) and up to 10 layers for snow, depending on snow +depth. The central characteristic of the column subgrid level is that +this is where the state variables for water and energy in the soil and +snow are defined, as well as the fluxes of these components within the +soil and snow. Regardless of the number and type of PFTs occupying space +on the column, the column physics operates with a single set of upper +boundary fluxes, as well as a single set of transpiration fluxes from +multiple soil levels. These boundary fluxes are weighted averages over +all PFTs. Currently, for lake and vegetated land units, a single column +is assigned to each land unit. The crop land unit is split into +irrigated and unirrigated columns with a single crop occupying each +column. The urban land units have five columns (roof, sunlit walls and +shaded walls, and pervious and impervious canyon floor) (Oleson et +al. 2010b). The glacier land unit is separated into up to 10 elevation +classes. .. _Figure CLM subgrid hierarchy: @@ -431,6 +434,15 @@ to\ :math:`z_{atm}` . and solid precipitation, which are added to yield total liquid precipitation :math:`q_{rain}` and solid precipitation :math:`q_{sno}` . +However, in CLM5, the atmosphere's partitioning into liquid and solid +precipitation is ignored. Instead, CLM repartitions total precipitation +using a linear ramp. For most landunits, this ramp generates all snow +below :math:`0 \textdegree C`, all rain above :math:`2 \textdegree C`, +and a mix of rain and snow for intermediate temperatures. For glaciers, +the end points of the ramp are :math:`-2 \textdegree C` and :math:`0 +\textdegree C`, respectively. Changes to the phase of precipitation are +accompanied by a sensible heat flux (positive or negative) to conserve +energy. :sup:`3`\ There are 14 aerosol deposition rates required depending on species and affinity for bonding with water; 8 of these are dust @@ -680,14 +692,14 @@ The percentage glacier mask was derived from vector data of global glacier and ice sheet spatial coverage. Vector data for glaciers (ice caps, icefields and mountain glaciers) were taken from the first globally complete glacier inventory, the Randolph Glacier Inventory -version 1.0 (RGIv1.0: :ref:`Arendt et al. 2012 `). -Vector data for the Greenland Ice Sheet were provided by Frank Paul and -Tobias Bolch (University of Zurich: :ref:`Rastner et al. 2012 `). -Antarctic Ice Sheet data were provided by -Andrew Bliss (University of Alaska) and were extracted from the -Scientific Committee on Antarctic Research (SCAR) Antarctic Digital -Database version 5.0. Floating ice is only provided for the Antarctic -and does not include the small area of Arctic ice shelves. High spatial +version 1.0 (RGIv1.0: :ref:`Arendt et al. 2012 `). +Vector data for the Greenland Ice Sheet were provided by Frank Paul and +Tobias Bolch (University of Zurich: :ref:`Rastner et al. 2012 +`). Antarctic Ice Sheet data were provided by Andrew +Bliss (University of Alaska) and were extracted from the Scientific +Committee on Antarctic Research (SCAR) Antarctic Digital Database +version 5.0. Floating ice is only provided for the Antarctic and does +not include the small area of Arctic ice shelves. High spatial resolution vector data were then processed to determine the area of glacier, ice sheet and floating ice within 30-second grid cells globally. The 30-second glacier, ice sheet and Antarctic ice shelf masks @@ -704,8 +716,13 @@ by elevation and areal ice sheet fractional coverage by elevation. Ice fractions were binned at 100 meter intervals, with bin edges defined from 0 to 6000 meters (plus one top bin encompassing all remaining high-elevation ice, primarily in the Himalaya). These distributions by -elevation are needed when running CLM4 with multiple glacier elevation -classes. +elevation are used to divide each glacier land unit into columns based +on elevation class. + +When running with the CISM ice sheet model, CISM dictates glacier areas +and elevations in its domain, overriding the values specified by CLM's +datasets. In typical CLM5 configurations, this means that CISM dictates +glacier areas and elevations over Greenland. Percent lake and lake depth are area-averaged from the 90-second resolution data of :ref:`Kourzeneva (2009, 2010) ` to the 0.05\ :sup:`o` diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index 84752b5429..28d4f9cc15 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -4,134 +4,241 @@ Glaciers ============ This chapter describes features of CLM that are specific to coupling to -an ice sheet model (in the CESM context, this is the Glimmer-CISM model; -:ref:`Lipscomb and Sacks (2012)` provide documentation -and user’s guide for Glimmer-CISM). General information about glacier -land units can be found elsewhere in this document (see Chapter -:numref:`rst_Surface Characterization, Vertical Discretization, and -Model Input Requirements` for an overview). +an ice sheet model (in the CESM context, this is the CISM model; +:ref:`Lipscomb and Sacks (2012)` provide +documentation and user’s guide for CISM). General information +about glacier land units can be found elsewhere in this document (see +Chapter :numref:`rst_Surface Characterization, Vertical Discretization, +and Model Input Requirements` for an overview). .. _Overview Glaciers: Overview -------------- +-------- -CLM is responsible for computing three quantities that are passed to the +CLM is responsible for computing two quantities that are passed to the ice sheet model: -#. Surface mass balance (SMB) – the net annual accumulation/ablation of +#. Surface mass balance (SMB) - the net annual accumulation/ablation of mass at the upper surface (section :numref:`Computation of the surface mass balance`) #. Ground surface temperature, which serves as an upper boundary - condition for Glimmer-CISM’s temperature calculation - -#. Surface topography, which currently is fixed in time, and is provided - on CLM’s surface dataset + condition for CISM's temperature calculation The ice sheet model is typically run at much higher resolution than CLM (e.g., :math:`\sim`\ 5 km rather than :math:`\sim`\ 100 km). To improve the downscaling from CLM’s grid to the ice sheet grid, the glaciated portion of each grid cell is divided into multiple elevation classes -(section 10.2). The above quantities are computed separately in each -elevation class. Glimmer-CISM then computes high-resolution quantities -via horizontal and vertical interpolation. +(section :numref:`Multiple elevation class scheme`). The above +quantities are computed separately in each elevation class. The CESM +coupler then computes high-resolution quantities via horizontal and +vertical interpolation, and passes these high-resolution quantities to +CISM. There are several reasons for computing the SMB in CLM rather than in -Glimmer-CISM: +CISM: #. It is much cheaper to compute the SMB in CLM for :math:`\sim`\ 10 - elevation classes than in Glimmer-CISM. For example, suppose we are - running CLM at a resolution of :math:`\sim`\ 50 km and Glimmer at + elevation classes than in CISM. For example, suppose we are + running CLM at a resolution of :math:`\sim`\ 50 km and CISM at :math:`\sim`\ 5 km. Greenland has dimensions of about 1000 x 2000 km. For CLM we would have 20 x 40 x 10 = 8,000 columns, whereas for - Glimmer we would have 200 x 400 = 80,000 columns. + CISM we would have 200 x 400 = 80,000 columns. #. We can use the sophisticated snow physics parameterization already in - CLM instead of implementing a separate scheme for Glimmer-CISM. Any + CLM instead of implementing a separate scheme for CISM. Any improvements to the CLM are applied to ice sheets automatically. #. The atmosphere model can respond during runtime to ice-sheet surface - changes. As shown by :ref:`Pritchard et al. (2008)`, - runtime albedo feedback - from the ice sheet is critical for simulating ice-sheet retreat on - paleoclimate time scales. Without this feedback the atmosphere warms - much less, and the retreat is delayed. - -#. Mass is more nearly conserved, given that the rate of surface ice - growth or melting computed in CLM is equal to the rate seen by the - dynamic ice sheet model. (Mass conservation is not exact, however, - because of approximations made in interpolating from the CLM grid to - the ice-sheet grid.) + changes (even in the absence of two-way feedbacks with CISM). As + shown by :ref:`Pritchard et al. (2008)`, runtime + albedo feedback from the ice sheet is critical for simulating + ice-sheet retreat on paleoclimate time scales. Without this feedback + the atmosphere warms much less, and the retreat is delayed. #. The improved SMB is available in CLM for all glaciated grid cells (e.g., in the Alps, Rockies, Andes, and Himalayas), not just those which are part of ice sheets. -The current coupling between CLM and Glimmer-CISM is one-way only. That -is, CLM sends the SMB and surface temperature to Glimmer-CISM but does -not do anything with the fields that are returned. The CLM glacier -fraction and surface topography are therefore fixed in time. One-way -coupling is reasonable for runs of :math:`\sim`\ 100 years or less, in -which ice-sheet elevation changes are modest. For longer runs with -larger elevation changes, two-way coupling is highly desirable. A -two-way coupling scheme is under development. +In typical runs, CLM computes the SMB and sends it to CISM, but CISM's +ice sheet geometry remains fixed over the course of the run. In these +runs, CISM serves two roles in the system: + +#. Over the CISM domain (typically Greenland in CESM2), CISM dictates + glacier areas and topographic elevations, overriding the values on + CLM's surface dataset. CISM also dictates the elevation of + non-glacier land units in its domain, and atmospheric fields are + downscaled to non-glacier land units only in this domain. (So if you + run with a stub glacier model - SGLC - then glacier areas and + elevations will be taken entirely from CLM's surface dataset, and no + downscaling will be done over non-glacier land units.) + +#. CISM provides the grid onto which SMB is downscaled. (If you run with + SGLC then SMB will still be computed in CLM, but it won't be + downscaled to a high-resolution ice sheet grid.) + +However, it is also possible to run CESM with an evolving ice sheet. In +this case, CLM responds to CISM's evolution by adjusting the areas of +the glacier landunit and each elevation class within this landunit, as +well as the mean topographic heights of each elevation class. Thus, +CLM's glacier areas and elevations remain in sync with +CISM's. Conservation of mass and energy is done as for other landcover +change (see Chapter :numref:`rst_Transient Landcover Change`). + +.. _Glacier regions: + +Glacier regions and their behaviors +----------------------------------- + +The world's glaciers and ice sheets are broken down into a number of +different regions (four by default) that differ in three respects: + +#. Whether the gridcell's glacier landunit contains: + + a. Multiple elevation classes (section :numref:`Multiple elevation + class scheme`) + + b. Multiple elevation classes plus virtual elevation classes + + c. Just a single elevation class whose elevation matches the + atmosphere's topographic height (so there is no adjustment in + atmospheric forcings due to downscaling). + +#. Treatment of glacial melt water: + + a. Glacial melt water runs off and is replaced by ice, thus keeping + the column always frozen. This behavior is discussed in more + detail in section :numref:`Computation of the surface mass + balance`. + + b. Glacial melt water remains in place until it refreezes - possibly + remaining in place indefinitely if the glacier column is in a warm + climate. With this behavior, ice melt does not result in any + runoff. Regions with this behavior cannot compute SMB, because + negative SMB would be meaningless (due to the liquid water on top + of the ice column). This behavior produces less realistic glacier + physics. However, it avoids the negative ice runoff that is needed + for the "replaced by ice" behavior to conserve mass and energy (as + described in section :numref:`Computation of the surface mass + balance`). Thus, in regions where CLM has glaciers but the + atmospheric forcings are too warm to sustain those glaciers, this + behavior avoids persistent negative ice runoff. This situation can + often occur for mountain glaciers, where topographic smoothing in + the atmosphere results in a too-warm climate. There, avoiding + persistent negative ice runoff can be more important than getting + the right glacier ice physics. + +#. Treatment of ice runoff from snow capping (as described in section + :numref:`Runoff from glaciers and snow-capped surfaces`). Note that this + is irrelevant in regions with an evolving, two-way-coupled ice sheet + (where the snow capping term is sent to CISM rather than running off): + + a. Ice runoff from snow capping remains ice. This is a crude + parameterization of iceberg calving, and so is appropriate in + regions where there is substantial iceberg calving in reality. + + b. Ice runoff from snow capping is melted (generating a negative + sensible heat flux) and runs off as liquid. This matches the + behavior for non-glacier columns. This is appropriate in regions + that have little iceberg calving in reality. This can be important + to avoid unrealistic cooling of the ocean and consequent runaway + sea ice growth. + +The default behaviors for the world's glacier and ice sheet regions are +described in :numref:`Table Glacier region behaviors`. Note that the +standard CISM grid covers Greenland plus enough surrounding area to +allow for ice sheet growth and to have a regular rectangular grid. We +need to have the "replaced by ice" melt behavior within the CISM domain +in order to compute SMB there, and we need virtual elevation classes in +that domain in order to compute SMB for all elevation classes and to +facilitate glacial advance and retreat in the two-way-coupled +case. However, this domain is split into Greenland itself and areas +outside Greenland so that ice runoff in the Canadian archipelago (which +is inside the CISM domain) is melted before reaching the ocean, to avoid +runaway sea ice growth in that region. + +.. _Table Glacier region behaviors: + +.. table:: Glacier region behaviors + + +---------------+---------------+---------------+---------------+ + | Region | Elevation | Glacial melt | Ice runoff | + | | classes | | | + +===============+===============+===============+===============+ + | Greenland | Virtual | Replaced by | Remains ice | + | | | ice | | + +---------------+---------------+---------------+---------------+ + | Inside | Virtual | Replaced by | Melted | + | standard CISM | | ice | | + | grid but | | | | + | outside | | | | + | Greenland | | | | + | itself | | | | + +---------------+---------------+---------------+---------------+ + | Antarctica | Multiple | Replaced by | Remains ice | + | | | ice | | + +---------------+---------------+---------------+---------------+ + | All others | Single | Remains in | Melted | + | | | place | | + +---------------+---------------+---------------+---------------+ + .. _Multiple elevation class scheme: Multiple elevation class scheme ------------------------------------- - -In the typical operation of CLM, the glacier land unit contains a single -column (section :numref:`Surface Heterogeneity and Data Structure`). -However, when running CESM with an active ice -sheet model, the glacier land unit is replaced by a glacier\_mec land -unit, where “mec” denotes “multiple elevation classes”. In most ways, -glacier\_mec land units behave the same as standard glacier land units. -However, each glacier\_mec land unit is divided into a user-defined set -of columns based on surface elevation. The default is 10 elevation -classes whose lower limits are 0, 200, 400, 700, 1000, 1300, 1600, 2000, -2500, and 3000 m. Each column is characterized by a fractional area and -surface elevation that are read in during model initialization. Each -glacier\_mec column within a grid cell has distinct ice and snow -temperatures, snow water content, surface fluxes, and SMB. - -Glacier\_mec columns, like glacier columns, are initialized with a -temperature of 250 K. While glacier columns are initialized with a snow -liquid water equivalent (LWE) equal to the maximum allowed value of 1 m, -glacier\_mec columns begin with a snow LWE of 0.5 m so that they will -reach their equilibrium mean snow depth sooner. Glacier\_mec columns -typically require several decades of spin-up to equilibrate with a given -climate. +------------------------------- + +The glacier landunit contains multiple columns based on surface +elevation. These are known as elevation classes, and the land unit is +referred to as glacier\_mec. (As described in section :numref:`Glacier +regions`, some regions have only a single elevation class, but they are +still referred to as glacier\_mec landunits.) The default is to have 10 +elevation classes whose lower limits are 0, 200, 400, 700, 1000, 1300, +1600, 2000, 2500, and 3000 m. Each column is characterized by a +fractional area and surface elevation that are read in during model +initialization, and then possibly overridden by CISM as the run +progresses. Each glacier\_mec column within a grid cell has distinct ice +and snow temperatures, snow water content, surface fluxes, and SMB. The atmospheric surface temperature, potential temperature, specific -humidity, density, and pressure are downscaled from the mean grid cell -elevation to the glacier\_mec column elevation using a specified lapse -rate (typically 6.0 deg/km) and an assumption of uniform relative -humidity. At a given time, lower-elevation columns can undergo surface +humidity, density, and pressure are downscaled from the atmosphere's +mean grid cell elevation to the glacier\_mec column elevation using a +specified lapse rate (typically 6.0 deg/km) and an assumption of uniform +relative humidity. Longwave radiation is downscaled by assuming a linear +decrease in downwelling longwave radiation with increasing elevation +(0.032 W m :sup:`-2` m :sup:`-1`, limited to 0.5 - 1.5 times the +gridcell mean value, then normalized to conserve gridcell total energy) +:ref:`(Van Tricht et al., 2016)`. Total precipitation +is partitioned into rain vs. snow as described in Chapter +:numref:`rst_Surface Characterization, Vertical Discretization, and +Model Input Requirements`. The partitioning of precipitation is based on +the downscaled temperature, allowing rain to fall at lower elevations +while snow falls at higher elevations. + +This downscaling allows lower-elevation columns to undergo surface melting while columns at higher elevations remain frozen. This gives a more accurate simulation of summer melting, which is a highly nonlinear -function of air temperature. The precipitation rate and radiative fluxes -are not currently downscaled, but could be in the future if care were -taken to preserve the cell-integrated values. +function of air temperature. + +Within the CISM domain, this same downscaling procedure is also applied +to all non-urban land units. The elevation of non-glacier land units is +taken from the mean elevation of ice-free grid cells in CISM. This is +done in order to keep the glaciated and non-glaciated portions of the +CISM domain as consistent as possible. In contrast to most CLM subgrid units, glacier\_mec columns can be active (i.e., have model calculations run there) even if their area is -zero. This is done because the ice sheet model may require a SMB even -for some grid cells where CLM does not have glacier land units. To allow -for this, grid overlap files have been pre-computed. For given -resolutions of CLM and Glimmer-CISM, these files identify all -land-covered grid cells that overlap any part of the ice sheet grid. In -these overlapping cells, glacier\_mec columns are defined in all -elevation classes. Some columns may have zero area and are called -“virtual” columns. These columns do not affect energy exchange between -the land and the atmosphere, but are included for potential forcing of -Glimmer-CISM. +zero. These are known as "virtual" columns. This is done because the ice +sheet model may require a SMB even for some grid cells where CLM does +not have glacier land units. Virtual columns do not affect energy +exchange between the land and the atmosphere, but are included for +potential forcing of CISM. .. _Computation of the surface mass balance: Computation of the surface mass balance --------------------------------------------- +--------------------------------------- The SMB of a glacier or ice sheet is the net annual accumulation/ablation of mass at the upper surface. Ablation is defined @@ -144,17 +251,6 @@ the melting depends on the sum of the radiative, turbulent, and conductive fluxes reaching the surface, as described elsewhere in this document. -CLM has a somewhat unrealistic treatment of accumulation and melting for -standard glacier land units. The snow depth is limited to a prescribed -depth of 1 m liquid water equivalent, with any additional snow assumed -to run off to the ocean. (This amounts to a crude parameterization of -iceberg calving.) Snow melting is treated in a realistic fashion, with -meltwater percolating downward through snow layers as long as the snow -is unsaturated. Once the underlying snow is saturated, any additional -meltwater runs off. When glacier ice melts, however, the meltwater is -assumed to remain in place until it refreezes. In warm parts of the ice -sheet, the meltwater does not refreeze, but stays in place indefinitely. - In the modified glacier\_mec columns, the treatment of melting and freezing depends on the logical variable *glc\_dyntopo*. This variable controls whether CLM surface topography changes dynamically as the ice @@ -171,12 +267,26 @@ for glacier\_mec land units is computed as for glacier land units: Any snow in excess of 1 m LWE runs off to the ocean, and Melted ice remains in place until it refreezes. Excess snow and melted ice still contribute to positive and negative values, respectively, of *qice*, but only for -the purpose of forcing Glimmer-CISM. Currently, *glc\_dyntopo* = false +the purpose of forcing CISM. Currently, *glc\_dyntopo* = false is the default, and the only supported option. Note that the SMB typically is defined as the total accumulation of ice -and snow, minus the total ablation. The *qice* flux passed to -Glimmer-CISM is the mass balance for ice alone, not snow. We can think -of CLM as owning the snow, whereas Glimmer-CISM owns the underlying ice. -Fluctuations in snow depth between 0 and 1 m LWE are not reflected in -the SMB passed to Glimmer-CISM. +and snow, minus the total ablation. The *qice* flux passed to CISM is +the mass balance for ice alone, not snow. We can think of CLM as owning +the snow, whereas CISM owns the underlying ice. Fluctuations in snow +depth between 0 and 10 m water equivalent are not reflected in the SMB +passed to CISM. In transient runs, this can lead to delays of a few +decades in the onset of accumulation or ablation in a given glacier +column. + +In regions where SMB is computed for glaciers, SMB is also computed for +the natural vegetated land unit. Because there is no ice to melt in this +land unit, it can only generate a zero or positive SMB. A positive SMB +is generated once the snow pack reaches its maximum depth. When running +with an evolving ice sheet, this condition triggers glacial inception. + +FIXME: Make sure I talk about the positive liquid runoff and negative +ice runoff that result from melted ice. + +FIXME: With interactive CISM, snow capping is applied to the surface +mass balance, not ice runoff. diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index a887e5d9fc..853385f36b 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -504,9 +504,9 @@ In CLM5, where new parameterizations or model decisions were made, in most cases The hydrology updates include the introduction of a dry surface layer-based soil evaporation resistance parameterization :ref:`(Swenson and Lawrence, 2014)` and a revised canopy interception parameterization. Canopy interception is now divided into liquid and solid phases, with the intercepted snow subject to unloading events due to wind or above-freezing temperatures. The snow-covered fraction of the canopy is used within the canopy radiation and surface albedo calculation. Instead of applying a spatially uniform soil thickness, soil thickness can vary in space :ref:`(Brunke et al. 2016` and :ref:`Swenson and Lawrence, 2015)` and is set to values within a range of 0.4m to 8.5m depth, derived from a spatially explicit soil thickness data product :ref:`(Pelletier et al., 2016)`. The explicit treatment of soil thickness allows for the deprecation of the unconfined aquifer parameterization used in CLM4.5, which is replaced with a zero flux boundary condition and explicit modeling of both the saturated and unsaturated zones. The default model soil layer resolution is increased, especially within the top 3m, to more explicitly represent active layer thickness within the permafrost zone. Rooting profiles were used inconsistently in CLM4.5 with :ref:`Zeng (2001)` profiles used for water and :ref:`Jackson et al. (1996)` profiles used for carbon inputs. For CLM5, the Jackson et al. (1996) rooting profiles are used for both water and carbon. Roots are deepened for the broadleaf evergreen tropical tree and broadleaf deciduous tropical tree types. Finally, an adaptive time-stepping solution to the Richard's equation is introduced, which improves the accuracy and stability of the numerical soil water solution. The River Transport Model (RTM) is replaced with the Model for Scale Adaptive River Transport (MOSART, :ref:`Li et al., 2013b)` in which surface runoff is routed across hillslopes and then discharged along with subsurface runoff into a tributary subnetwork before entering the main channel. Several changes are included that are mainly targeted at improving the simulation of surface mass balance over ice -sheets. The fresh snow density parameterization is updated to more realistically capture the temperature effects and to additionally account for wind effects on new snow density :ref:`(van Kampenhout et al., 2017)`. The maximum number of snow layers and snow amount is increased from 5 layers and 1m snow water equivalent to 12 layers and 10m snow water equivalent to allow for the formation of firn in regions of persistent snow-cover (e.g., glaciers and ice sheets) :ref:`(van Kampenhout et al., 2017)`. The CISM2 ice sheet model is active for Greenland by default with one-way coupling (surface mass balance impacts ice sheet dynamics, but ice sheet dynamics do not feedback onto surface elevation). Two-way coupling can be activated through a namelist switch. The introduction in CLM5 of the capability to +sheets. The fresh snow density parameterization is updated to more realistically capture temperature effects and to additionally account for wind effects on new snow density :ref:`(van Kampenhout et al., 2017)`. The maximum number of snow layers and snow amount is increased from 5 layers and 1m snow water equivalent to 12 layers and 10m snow water equivalent to allow for the formation of firn in regions of persistent snow-cover (e.g., glaciers and ice sheets) :ref:`(van Kampenhout et al., 2017)`. The CISM2 ice sheet model is included for Greenland by default. The ice sheet does not evolve for typical configurations, but ice sheet evolution can be turned on by choosing an appropriate compset. The introduction in CLM5 of the capability to dynamically adjust landunit weights means that a glacier can initiate, grow, shrink, or disappear during -a simulation when two-way coupling is active. Multiple elevation classes (10 elevation classes by default) and associated temperature, rain/snow partitioning, and downwelling longwave downscaling are used for glacier landunits to account for the strong topographic elevation heterogeneity over glaciers and ice sheets. +a simulation when ice evolution is active. That is, there are two-way feedbacks between CLM and CISM. Multiple elevation classes (10 elevation classes by default) and associated temperature, rain/snow partitioning, and downwelling longwave downscaling are used for glacier landunits to account for the strong topographic elevation heterogeneity over glaciers and ice sheets. A plant hydraulic stress routine is introduced which explicitly models water transport through the vegetation according to a simple hydraulic framework (Kennedy et al., to be submitted). The water supply equations are used to solve for vegetation water potential forced by transpiration demand and a set of layer-by-layer soil water potentials. Stomatal conductance, therefore, is a function of prognostic leaf water potential. Water stress is calculated as the ratio of attenuated stomatal conductance to maximum stomatal conductance. An emergent feature of the plant hydraulics is soil hydraulic redistribution. In CLM5, maximum stomatal conductance is obtained from the Medlyn conductance model :ref:`(Medlyn et al., 2011)`, rather than the Ball-Berry stomatal conductance model that was utilized in CLM4.5 and prior versions of the model. The Medlyn stomatal conductance model is preferred mainly for it's more realistic behavior at low humidity levels :ref:`(Rogers et al., 2017)`. The stress deciduous vegetation phenology trigger is augmented with a antecedent precipitation requirement :ref:`(Dahlin et al. 2015)`. diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 5168284551..ba331704d0 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -2698,6 +2698,15 @@ Lawrence, A.G. Slater, and M.R. van den Broeke, 2017. Improving the representation of polar snow and firn in the Community Earth System Model, submitted. +.. _VanTrichtetal2016: + +|br| + +Van Tricht, K., Lhermitte, S., Gorodetskaya, I.V. and van Lipzig, +N.P.M., 2016. Improving satellite-retrieved surface radiative fluxes in +polar regions using a smart sampling approach. The Cryosphere +10:2379-2397. doi:10.5194/tc-10-2379-2016 + .. _VanVuurenetal2006: |br| From 74b2220c084a1d888639fe894e2581c0ca885fef Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Feb 2018 06:27:09 -0700 Subject: [PATCH 0131/1973] add information on glc_dyn_runoff_routing --- .../Glacier/CLM50_Tech_Note_Glacier.rst | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index 28d4f9cc15..e125a1141e 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -240,6 +240,13 @@ potential forcing of CISM. Computation of the surface mass balance --------------------------------------- +This section describes the computation of surface mass balance and +associated runoff terms. The description here only applies to regions +where glacial melt runs off and is replaced by ice, not to regions where +glacial melt remains in place. Thus, by default, this only applies to +Greenland and Antarctica, not to mountain glaciers elsewhere in the +world. (See also :numref:`Glacier regions`.) + The SMB of a glacier or ice sheet is the net annual accumulation/ablation of mass at the upper surface. Ablation is defined as the mass of water that runs off to the ocean. Not all the surface @@ -251,6 +258,26 @@ the melting depends on the sum of the radiative, turbulent, and conductive fluxes reaching the surface, as described elsewhere in this document. +SMB is computed and sent to the CESM coupler regardless of whether and +where CISM is operating. However, the effect of SMB terms on runoff +fluxes differs depending on whether and where CISM is evolving in +two-way-coupled mode. This is described by the variable +*glc\_dyn\_runoff\_routing*. (This is real-valued in the code to handle +the edge case where a CLM grid cell partially overlaps with the CISM +grid, but we describe it as a logical variable here for simplicity.) In +typical cases where CISM is not evolving, *glc\_dyn\_runoff\_routing* +will be false everywhere. In cases where CISM is evolving and sending +its own calving flux to the coupler, *glc\_dyn\_runoff\_routing* will be +true over the CISM domain and false elsewhere. + +FIXME: Rewrite the following paragraph + +FIXME: Make sure I talk about the positive liquid runoff and negative +ice runoff that result from melted ice. + +FIXME: With interactive CISM, snow capping is applied to the surface +mass balance, not ice runoff. + In the modified glacier\_mec columns, the treatment of melting and freezing depends on the logical variable *glc\_dyntopo*. This variable controls whether CLM surface topography changes dynamically as the ice @@ -285,8 +312,3 @@ land unit, it can only generate a zero or positive SMB. A positive SMB is generated once the snow pack reaches its maximum depth. When running with an evolving ice sheet, this condition triggers glacial inception. -FIXME: Make sure I talk about the positive liquid runoff and negative -ice runoff that result from melted ice. - -FIXME: With interactive CISM, snow capping is applied to the surface -mass balance, not ice runoff. From 3311d37fa59e748db552f074fca1ce942c9cff78 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 1 Feb 2018 07:55:18 -0700 Subject: [PATCH 0132/1973] changed snow layers --- .../CLM50_Tech_Note_Snow_Hydrology.rst | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index a97e161526..14ceeaa968 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -6,10 +6,10 @@ Snow Hydrology The parameterizations for snow are based primarily on :ref:`Anderson (1976) `, :ref:`Jordan (1991) `, and :ref:`Dai and Zeng (1997) `. The snowpack -can have up to five layers. These layers are indexed in the Fortran code -as :math:`i=-4,-3,-2,-1,0` where layer :math:`i=0` is the snow layer -next to the top soil layer and layer :math:`i=-4` is the top layer of a -five-layer snow pack. Since the number of snow layers varies according +can have up to twelve layers. These layers are indexed in the Fortran code +as :math:`i=-11,-10,...,-1,0` where layer :math:`i=0` is the snow layer +next to the top soil layer and layer :math:`i=-11` is the top layer of a +twelve-layer snow pack. Since the number of snow layers varies according to the snow depth, we use the notation :math:`snl+1` to describe the top layer of snow for the variable layer snow pack, where :math:`snl` is the negative of the number of snow layers. Refer to :numref:`Figure three layer @@ -697,7 +697,21 @@ where :math:`\Delta z_{i}` is the layer thickness. +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ | 4 | 0.055 | 4 | :math:`>`\ 4 | 0.41 | 0.23 | +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ - | 5 (bottom) | 0.115 | 5 | - | - | - | + | 5 | 0.115 | 5 | :math:`>`\ 5 | 0.88 | 0.47 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 6 | 0.235 | 6 | :math:`>`\ 6 | 1.83 | 0.95 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 7 | 0.475 | 7 | :math:`>`\ 7 | 3.74 | 1.91 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 8 | 0.955 | 8 | :math:`>`\ 8 | 7.57 | 3.83 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 9 | 1.915 | 9 | :math:`>`\ 9 | 15.24 | 7.67 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 10 | 3.835 | 10 | :math:`>`\ 10 | 30.59 | 15.35 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 11 | 7.675 | 11 | :math:`>`\ 11 | 61.30 | 30.71 | + +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ + | 12 (bottom) | 15.355 | 12 | - | - | - | +--------------+-----------------------------+------------------+------------------+-----------------------------------------------+---------------------------------------------------------+ The maximum snow layer thickness, :math:`\Delta z_{\max }` , depends on From c894f733684bc21083f6b5abe91b0357a62e3cff Mon Sep 17 00:00:00 2001 From: Leo van Kampenhout Date: Thu, 1 Feb 2018 15:37:41 +0100 Subject: [PATCH 0133/1973] Update CLM50_Tech_Note_References.rst --- .../tech_note/References/CLM50_Tech_Note_References.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index ba331704d0..06dfb22835 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -2695,8 +2695,8 @@ turnover through the microbial biomass in soil. Plant and Soil, 76: van Kampenhout, L., J.T.M. Lenaerts, W.H. Lipscomb, W.J. Sacks, D.M. Lawrence, A.G. Slater, and M.R. van den Broeke, 2017. -Improving the representation of polar snow and firn in the -Community Earth System Model, submitted. +Improving the Representation of Polar Snow and Firn in the +Community Earth System Model. Journal of Advances in Modeling Earth Systems 9, no. 7: 2583–2600. https://doi.org/10.1002/2017MS000988. .. _VanTrichtetal2016: From 4d7440c8eab951b07150f2c6e87de6f64884085a Mon Sep 17 00:00:00 2001 From: Leo van Kampenhout Date: Thu, 1 Feb 2018 16:05:20 +0100 Subject: [PATCH 0134/1973] Update CLM50_Tech_Note_Hydrology.rst Update the most obvious things that have changed in 2.7.6. Runoff from glaciers and snow-capped surface --- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 2ca572ee9e..fb0dff13ab 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -1240,22 +1240,15 @@ Runoff from glaciers and snow-capped surfaces ------------------------------------------------- All surfaces are constrained to have a snow water equivalent -:math:`W_{sno} \le 1000` kg m\ :sup:`-2`. For snow-capped -surfaces, the solid and liquid precipitation reaching the snow surface -and dew in solid or liquid form, is separated into solid -:math:`q_{snwcp,ice}` \ and liquid :math:`q_{snwcp,liq}` runoff terms - -.. math:: - :label: 7.178 - - q_{snwcp,ice} =q_{grnd,ice} +q_{frost} - -.. math:: - :label: 7.179 - - q_{snwcp,liq} =q_{grnd,liq} +q_{dew} - -and snow pack properties are unchanged. The :math:`q_{snwcp,ice}` +:math:`W_{sno} \le W_{cap} = 10,000` kg m\ :sup:`-2`. For snow-capped +columns, any addition of mass at the top (precipitation, dew/riping) is +balanced by an equally large mass flux at the bottom of the snow column. +This so-called capping flux is separated into solid +:math:`q_{snwcp,ice}` \ and liquid :math:`q_{snwcp,liq}` runoff terms. +The partitioning of these phases is based on the phase ratio in the bottom snow +layer at the time of the capping, such that phase ratio in this layer is unaltered. + +The :math:`q_{snwcp,ice}` runoff is sent to the River Transport Model (RTM) (Chapter 11) where it is routed to the ocean as an ice stream and, if applicable, the ice is melted there. @@ -1284,5 +1277,3 @@ The contribution of lake runoff to :math:`q_{rgwl}` is described in section :numref:`Precipitation, Evaporation, and Runoff Lake`. The runoff term :math:`q_{rgwl}` may be negative for glaciers and lakes, which reduces the total amount of runoff available to the river routing model (Chapter :numref:`rst_River Transport Model (RTM)`). - -> From 0b7b34d5af4735805996018f91889cdb0375342a Mon Sep 17 00:00:00 2001 From: Leo van Kampenhout Date: Thu, 1 Feb 2018 17:01:20 +0100 Subject: [PATCH 0135/1973] fresh snow grain size is temperature dependent in CLM5 --- .../Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 386cf77bd2..3ecf53e0f2 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -956,8 +956,13 @@ each time step *t* as r_{e} \left(t\right)=\left[r_{e} \left(t-1\right)+dr_{e,\, dry} +dr_{e,\, wet} \right]f_{old} +r_{e,\, 0} f_{new} +r_{e,\, rfz} f_{rfrz} Here, the effective radius of freshly-fallen snow -(:math:`r_{e,0}`) is fixed globally at 54.5 :math:`\mu` m (corresponding to a specific surface area of 60 m\ :sup:`2` kg\ :sup:`-1`), and the effective -radius of refrozen liquid water (:math:`r_{e,rfz}`) is set to 1000\ :math:`\mu` m. +(:math:`r_{e,0}`) is based on a simple linear temperature-relationship. +Below -30 degrees Celcius, a minimum value is enforced of 54.5 :math:`\mu` m +(corresponding to a specific surface area of 60 m\ :sup:`2` kg\ :sup:`-1`). +Above 0 degrees Celcius, a maximum value is enforced of 204.5 :math:`\mu` m. +Between -30 and 0 a linear ramp is used. + +The effective radius of refrozen liquid water (:math:`r_{e,rfz}`) is set to 1000\ :math:`\mu` m. Dry snow aging is based on a microphysical model described by :ref:`Flanner and Zender (2006) `. This model simulates diffusive vapor flux From c23747d2b0d6a01ec43c2f0e83c11808d3365582 Mon Sep 17 00:00:00 2001 From: Leo van Kampenhout Date: Thu, 1 Feb 2018 17:01:20 +0100 Subject: [PATCH 0136/1973] fresh snow grain size is temperature dependent in CLM5 --- .../Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 386cf77bd2..3ecf53e0f2 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -956,8 +956,13 @@ each time step *t* as r_{e} \left(t\right)=\left[r_{e} \left(t-1\right)+dr_{e,\, dry} +dr_{e,\, wet} \right]f_{old} +r_{e,\, 0} f_{new} +r_{e,\, rfz} f_{rfrz} Here, the effective radius of freshly-fallen snow -(:math:`r_{e,0}`) is fixed globally at 54.5 :math:`\mu` m (corresponding to a specific surface area of 60 m\ :sup:`2` kg\ :sup:`-1`), and the effective -radius of refrozen liquid water (:math:`r_{e,rfz}`) is set to 1000\ :math:`\mu` m. +(:math:`r_{e,0}`) is based on a simple linear temperature-relationship. +Below -30 degrees Celcius, a minimum value is enforced of 54.5 :math:`\mu` m +(corresponding to a specific surface area of 60 m\ :sup:`2` kg\ :sup:`-1`). +Above 0 degrees Celcius, a maximum value is enforced of 204.5 :math:`\mu` m. +Between -30 and 0 a linear ramp is used. + +The effective radius of refrozen liquid water (:math:`r_{e,rfz}`) is set to 1000\ :math:`\mu` m. Dry snow aging is based on a microphysical model described by :ref:`Flanner and Zender (2006) `. This model simulates diffusive vapor flux From e030158745504eeeb3a6773be2bcfc0e46cb5d77 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 1 Feb 2018 09:36:05 -0700 Subject: [PATCH 0137/1973] Reordered and edited references and minor fixes in FATES/DGVM chapters --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 44 +-- .../CLM50_Tech_Note_Introduction.rst | 2 +- .../References/CLM50_Tech_Note_References.rst | 354 ++++++++---------- 3 files changed, 173 insertions(+), 227 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 170d44eb7a..4c3ae84448 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -6,9 +6,9 @@ Dynamic Global Vegetation What has changed ^^^^^^^^^^^^^^^^^^^^ -- Deprecation of the dynamic global vegetation model (DGVM): The CLM5.0 model contains the legancy 'CNDV' code, which runs the CLM4(CN) model in combination with the LPJ-derived dynamics vegetation model introduced in CLM3. While this capacity has not technically been removed from the model, the DGVM has not been tested in the development of CLM5 and is no longer scientifically supported. +- Deprecation of the dynamic global vegetation model (DGVM): The CLM5.0 model contains the legacy 'CNDV' code, which runs the CLM biogeochemistry model in combination with the LPJ-derived dynamics vegetation model introduced in CLM3. While this capacity has not technically been removed from the model, the DGVM has not been tested in the development of CLM5 and is no longer scientifically supported. -- Introduction of FATES: The Functionally Assembled Terrestrial Ecosystem Simulator (FATES) is the actively developed DGVM for the CLM5. See +- Introduction of FATES: The Functionally Assembled Terrestrial Ecosystem Simulator (FATES) is the actively developed DGVM for the CLM5. .. _rst_FATES: @@ -20,11 +20,7 @@ FATES is the "Functionally Assembled Terrestrial Ecosystem Simulator". It is an FATES was derived from the CLM Ecosystem Demography model (CLM(ED)), which was documented in: -Fisher RA, Muszala S, Verteinstein M, Lawrence P, Xu C, McDowell NG, - Knox RG, Koven C, Holm J, Rogers BM, Lawrence D. Taking off the - training wheels: the properties of a dynamic vegetation model without - climate envelopes. Geoscientific Model Development Discussions. 2015 - Apr 1;8(4). +Fisher, R. A., Muszala, S., Verteinstein, M., Lawrence, P., Xu, C., McDowell, N. G., Knox, R. G., Koven, C., Holm, J., Rogers, B. M., Spessa, A., Lawrence, D., and Bonan, G.: Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes, CLM4.5(ED), Geosci. Model Dev., 8, 3593-3619, https://doi.org/10.5194/gmd-8-3593-2015, 2015. and this technical note was first published as an appendix to that paper. @@ -53,9 +49,9 @@ for carbon storage allocation, and for tree mortality under carbon stress, are also included and presented here. Numerous other implementations of the -Ecosystem Demography concept exist (See Fisher et al. 2017 for a review of these) Therefore, to avoid confusion between the +Ecosystem Demography concept exist (See :ref:`Fisher et al. (2018)` for a review of these) Therefore, to avoid confusion between the concept of 'Ecosystem Demography' and the implementation of this concept -in different models, the CLM(ED) implementation described by Fisher et al. (2015) will hereafter be called 'FATES' (the Functionally Assembled Terrestrial Ecosystem Simulator). +in different models, the CLM(ED) implementation described by :ref:`Fisher et al. (2015)` will hereafter be called 'FATES' (the Functionally Assembled Terrestrial Ecosystem Simulator). The representation of ecosystem heterogeneity in FATES ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -101,7 +97,7 @@ history.** The 'patch' organizational structure in CLM thus replaces the previous 'PFT' structure in the organization heirarchy. The original hierarchical land surface organizational structure of CLM as described in -:ref:`Oleson et al. 2013` may be depicted as: +:ref:`Oleson et al. 2013` may be depicted as: .. math:: @@ -709,7 +705,7 @@ performance in ED-like cohort based models, since they determine how light resources are partitioned between competing plants of varying heights, which has a very significant impact on how vegetation distribution emerges from competition -:ref:`Fisher et al. 2010`. +:ref:`Fisher et al. 2010`. The standard ED1.0 model makes a simple 'flat disk' assumption, that the leaf area of each cohort is spread in an homogenous layer at one exact @@ -796,7 +792,7 @@ Under these circumstances, the `extra` crown area :math:`A_{loss}` (i.e., :math:`A_{canopy}` - :math:`A_p`) is moved into the understorey. For each cohort already in the canopy, we determine a fraction of trees that are moved from the canopy (:math:`L_c`) to the understorey. -:math:`L_c` is calculated as :ref:`Fisher et al. 2010` +:math:`L_c` is calculated as :ref:`Fisher et al. 2010` .. math:: L_{c}= \frac{A_{loss,patch} w_{coh}}{\sum_{coh=1}^{nc,patch}{w_{coh}}} , @@ -1354,7 +1350,7 @@ profile section. Firstly, we denote two or more canopy layers (denoted :math:`C_l`). The concept of a ‘canopy layer’ refers to the idea that plants are organized into discrete over and under-stories, as predicted by the Perfect Plasticity Approximation -(:ref:`Purves et al. 2008`, :ref:`Fisher et al. 2010`). Within each canopy layer +(:ref:`Purves et al. 2008`, :ref:`Fisher et al. 2010`). Within each canopy layer there potentially exist multiple cohorts of different plant functional types and heights. Within each canopy layer, :math:`C_l`, and functional type, :math:`ft`, the model resolves numerous leaf layers :math:`z`, @@ -1527,9 +1523,9 @@ photosynthesis model before describing its application to the FATES canopy structure. This description in this section is largely repeated from the Oleson et al. CLM4.5 technical note but included here for comparison with its implementation in FATES. Photosynthesis in C3 -plants is based on the model of :ref:`Farquhar 1980` as -modified by :ref:`Collatz et al. 1991`. Photosynthetic assimilation -in C4 plants is based on the model of :ref:`Collatz et al. 1991`. +plants is based on the model of :ref:`Farquhar 1980` as +modified by :ref:`Collatz et al. (1991)`. Photosynthetic assimilation +in C4 plants is based on the model of :ref:`Collatz et al. (1991)`. In both models, leaf photosynthesis, :math:`\textrm{gpp}` (:math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`) is calculated as the minimum of three potentially limiting fluxes, @@ -1556,7 +1552,7 @@ partial pressure (Pa). :math:`K_{c}` and :math:`K_{o}` are the Michaelis-Menten constants (Pa) for CO\ :math:`_{2}` and O\ :math:`_{2}`. These vary with vegetation temperature :math:`T_v` (:math:`^{o}`\ C) according to an Arrhenious function described in -:ref:`Oleson et al. 2013`. :math:`V_{c,max}` is the leaf layer +:ref:`Oleson et al. 2013`. :math:`V_{c,max}` is the leaf layer photosynthetic capacity (:math:`\mu` mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`). @@ -1627,7 +1623,7 @@ CO\ :math:`_{2}` compensation point :math:`\Gamma_{*}` (Pa) is where the term 0.21 represents the ratio of maximum rates of oxygenation to carboxylation, which is virtually constant with temperature -:ref:`Farquhar, 1980`. +:ref:`Farquhar, 1980`. Resolution of the photosynthesis theory within the FATES canopy structure. -------------------------------------------------------------------------- @@ -1753,7 +1749,7 @@ where :math:`V_{canopy}` is calculated as :math:`K_{n}` is the coefficient of nitrogen decay with canopy depth. The value of this parameter is taken from the work of -:ref:`Lloyd et al. 2010` who determined, from 204 vertical profiles +:ref:`Lloyd et al. 2010` who determined, from 204 vertical profiles of leaf traits, that the decay rate of N through canopies of tropical rainforests was a function of the :math:`V_{cmax}` at the top of the canopy. They obtain the following term to predict :math:`K_{n}`, @@ -2063,13 +2059,13 @@ Fundamental stomatal conductance theory [14]_Stomatal conductance is unchanged in concept from the CLM4.5 approach. Leaf stomatal resistance is calculated from the Ball-Berry conductance -model as described by :ref:`Collatz et al. 1991` and implemented in +model as described by :ref:`Collatz et al. (1991)` and implemented in a global climate model by :ref:`Sellers et al. 1996`. The model relates stomatal conductance (i.e., the inverse of resistance) to net leaf photosynthesis, scaled by the relative humidity at the leaf surface and the CO\ :math:`_2` concentration at the leaf surface. The primary difference between the CLM implementation and that used by -:ref:`Collatz et al. 1991` and :ref:`Sellers et al. 1996` is +:ref:`Collatz et al. (1991)` and :ref:`Sellers et al. (1996)` is that they used net photosynthesis (i.e., leaf photosynthesis minus leaf respiration) instead of gross photosynthesis. As implemented here, stomatal conductance equals the minimum conductance (:math:`b`) when @@ -2093,13 +2089,13 @@ the leaf at the vegetation temperature conductance (:math:`\mu`\ mol m\ :math:`^{-2}` s\ :math:`^{-1}`) when :math:`A` = 0 . Typical values are :math:`m_{ft}` = 9 for C\ :math:`_3` plants and :math:`m_{ft}` = 4 for C\ :math:`_4` plants ( -:ref:`Collatz et al. 1991`, :ref:`Collatz, 1992`, :ref:`Sellers et al 1996)`. +:ref:`Collatz et al. 1991`, :ref:`Collatz, 1992`, :ref:`Sellers et al 1996)`. :ref:`Sellers et al. 1996` used :math:`b` = 10000 for C\ :math:`_3` plants and :math:`b` = 40000 for C\ :math:`_4` plants. Here, :math:`b` was chosen to give a maximum stomatal resistance of 20000 s m\ :math:`^{-1}`. These terms are nevertheless plant strategy dependent, and have been found to vary widely with plant type -:ref:`Medlyn et al. 2001`. +:ref:`Medlyn et al. 2011`. Resistance is converted from units of s m\ :math:`^2 \mu` mol\ :math:`^{-1}` to s m\ :math:`^{-1}` as: 1 s m\ :math:`^{-1}` = @@ -3072,7 +3068,7 @@ model, which has been modified for use in ED following it’s original implementation in the LPJ-SPITFIRE model (:ref:`Thonicke et al. 2010, :ref:`Pfeiffer et al. 2013`). This model as described is substantially different from the existing CLM4.5 fire model -:ref:`Li et al. 2012`, however, further developments are +:ref:`Li et al. 2012`, however, further developments are intended to increase the merging of SPITFIRE’s natural vegetation fire scheme with the fire suppression, forest-clearing and peat fire estimations in the existing model. The coupling to the ED model allows diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 853385f36b..562b772c51 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -13,7 +13,7 @@ ***Contributing Authors*** -**Ben Andre, Ali Ashehad, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, +**Ashehad Ali, Ben Andre, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Ryan Knox, Jan Lenaerts, Sam Levis, L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Andrew Slater, Zachary M. Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Mariana Vertenstein, Francis Vitt, Xubin Zeng** diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index ba331704d0..74223d2887 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -283,6 +283,12 @@ stomatal conductance in the earth system: linking leaf water-use efficiency and water transport along the soil–plant–atmosphere continuum, Geosci. Model Dev., 7, 2193-2222, doi:10.5194/gmd-7-2193-2014. +.. _botta2000: + +|br| + +Botta, A et al., 2000. A global prognostic scheme of leaf onset using satellite data. Global Change Biology 6.7, pp. 709-725. + .. _Brun1989: |br| @@ -324,6 +330,12 @@ Buzan, J.R., Oleson, K., and Huber, M. 2015: Implementation and comparison of a suite of heat stress metrics within the Community Land Model version 4.5, Geosci. Model Dev., 8, 151-170, doi:10.5194/gmd-8-151-2015. +.. _byram1959: + +|br| + +Byram, G.M., 1959. Combustion of forest fuels. In Forest fire: control and use.(Ed. KP Davis) pp. 61-89. + .. _CampbellNorman1998: |br| @@ -656,17 +668,23 @@ Firestone, M.K. and Davidson, E.A. 1989. Exchange of Trace Gases between Terrestrial Ecosystems and the Atmosphere. In: M.O. Andreae and D.S. Schimel (Editors). John Wiley and Sons, pp. 7-21. +.. _Fisheretal2010: + +|br| + +Fisher, J. B., S. Sitch, Y. Malhi, R. A. Fisher, C. Huntingford, and S.-Y. Tan, 2010. Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation. Global Biogeochem. Cycles, 24, GB1014, doi:10.1029/2009GB003621. + .. _Fisheretal2015: |br| Fisher, R. A., S. Muszala, M. Verteinstein, P. Lawrence, C. Xu, N. G. McDowell, R. G. Knox, C. Koven, J. Holm, B. M. Rogers, A. Spessa, D. Lawrence, and G. Bonan, 2015: Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes, CLM4.5(ED). Geosci. Model Dev., 8: 3593-3619, doi:10.5194/gmd-8-3593-2015. -.. _Fisheretal2010: +.. _Fisheretal2017: |br| -Fisher, J. B., S. Sitch, Y. Malhi, R. A. Fisher, C. Huntingford, and S.-Y. Tan, 2010. Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation. Global Biogeochem. Cycles, 24, GB1014, doi:10.1029/2009GB003621. +Fisher, R.A., C.D. Koven, W.R.L. Anderegg, et al., 2018: Vegetation demographics in Earth System Models: A review of progress and priorities. Glob Change Biol. 2018;24:35–54. https://doi.org/10.1111/gcb.13910 .. _FlannerZender2005: @@ -698,6 +716,12 @@ Geophys. Res. 112:D11202. DOI:10.1029/2006JD008003. Flatau, P.J., Walko, R.L., and Cotton, W.R. 1992. Polynomial fits to saturation vapor pressure. J. Appl. Meteor. 31:1507-1513. +.. _foley1996: + +|br| + +Foley, J.A. et al., 1996. An integrated biosphere model of land surface processes, terrestrial carbon balance, and vegetation dynamics. Global Biogeochemical Cycles 10.4, pp. 603-628. + .. _Friedl,etal2002: |br| @@ -715,6 +739,12 @@ from MODIS: algorithms and early results. Remote Sens. Environ. Frolking, S., et al. 2001. Modeling Northern Peatland Decomposition and Peat Accumulation. Ecosystems. 4:479-498. +.. _fyllas2014: + +|br| + +Fyllas, N.M. et al., 2014. Analysing Amazonian forest productivity using a new individual and trait- based model (TFS v. 1). Geoscientific Model Development 7.4, pp. 1251-1269. + .. _Gallaisetal2006: |br| @@ -842,7 +872,7 @@ studies. Water Resour. Res. 35:583-587. |br| -Graven, H., C. E. Allison, D. M. Etheridge, S. Hammer, R. F. Keeling, I. Levin, H. A. J. Meijer, M. Rubino, P. P. Tans, C. M. Trudinger, B. H. Vaughn and J. W. C. White (2017) Compiled records of carbon isotopes in atmospheric CO2 for historical simulations in CMIP6, Geoscientific Model Development, in review. doi: 10.5194/gmd-2017-166. +Graven, H., C. E. Allison, D. M. Etheridge, S. Hammer, R. F. Keeling, I. Levin, H. A. J. Meijer, M. Rubino, P. P. Tans, C. M. Trudinger, B. H. Vaughn and J. W. C. White, 2017. Compiled records of carbon isotopes in atmospheric CO2 for historical simulations in CMIP6, Geoscientific Model Development, in review. doi: 10.5194/gmd-2017-166. .. _GrenfellWarren1999: @@ -1232,6 +1262,12 @@ nitrogen dynamics. Proceedings of the National Academies of Science, Koven, C.D., G. Hugelius, D.M. Lawrence, and W.R. Wieder, 2017: Higher climatological temperature sensitivity of soil carbon in cold than warm climates. Nature Clim. Change, 7, doi:10.1038/nclimate3421. +.. _kucharik1998: + +|br| + +Kucharik, C.J., J.M. Norman, and S.T. Gower, 1998. Measurements of branch area and adjusting leaf area index indirect measurements. Agricultural and Forest Meteorology 91.1, pp. 69-88. + .. _Kuchariketal2000: |br| @@ -1531,6 +1567,12 @@ Liang, X., Lettenmaier, D.P., Wood, E.F., and Burges, S.J. 1994. A simple hydrologically based model of land surface water and energy fluxes for GSMs. J. Geophys. Res. 99(D7):14,415–14,428. +.. _lichstein2011: + +|br| + +Lichstein, J.W. and S.W. Pacala, 2011. Local diversity in heterogeneous landscapes: quantitative assessment with a height-structured forest metacommunity model`. Theoretical Ecology 4.2, pp. 269-281. + .. _LipscombSacks2012: |br| @@ -1539,6 +1581,13 @@ Lipscomb, W., and Sacks, W. 2012. The CESM land ice model documentation and user’s guide. 46 pp. [Available online at http://www.cesm.ucar.edu/models/cesm1.1/cism/]. +.. _lischke2006: + +|br| + +Lischke, H. et al., 2006. TreeMig: a forest-landscape model for simulating spatio-temporal patterns from stand to landscape scale. Ecological Modelling 199.4, pp. 409-420. 41 + + .. _LloydTaylor1994: |br| @@ -1652,6 +1701,12 @@ Mary, B., Fresneau, C., Morel, J.L. and Mariotti, A., 1993. C and N cycling during decomposition of root mucilage, roots and glucose in soil. Soil Biology and Biochemistry 25:1005-1014. +.. _mcdowell2013: + +|br| + +McDowell, N.G. et al., 2013. Evaluating theories of drought-induced vegetation mortality using a multimodel experiment framework. New Phytologist 200.2, pp. 304-321. + .. _McGuireetal1992: |br| @@ -1668,7 +1723,7 @@ potential vegetation in North America. Global Biogeochem. Cycles Medlyn, B.E., Duursma, R.A., Eamus, D., Ellsworth, D.S., Prentice, I.C., Barton, C.V.M., Crous, K.Y., De Angelis, P., Freeman, M., and -Wingate, L. (2011), Reconciling the optimal and empirical approaches to +Wingate, L., 2011. Reconciling the optimal and empirical approaches to modelling stomatal conductance. Global Change Biology, 17: 2134–2144. doi:10.1111/j.1365-2486.2010.02375.x @@ -1717,6 +1772,12 @@ Moldrup, P. et al. 2003. Modeling diffusion and reaction in soils: X. A unifying model for solute and gas diffusivity in unsaturated soil. Soil Science 168:321-337. +.. _mc_2001: + +|br| + +Moorcroft, P.R., G.C. Hurtt, and S.W. Pacala, 2001. A method for scaling vegetation dynamics: the ecosystem demography model ED. Ecological monographs 71.4, pp. 557-586. + .. _Mynenietal2002: |br| @@ -1792,6 +1853,12 @@ Niu, G.-Y., and Yang, Z.-L. 2007. An observation-based formulation of snow cover fraction and its evaluation over large North American river basins. J. Geophys. Res. 112:D21101. DOI:10.1029/2007JD008674. +.. _norman1979: + +|br| + +Norman, J.M., 1979. Modeling the complete crop canopy. Modification of the Aerial Environment of Crops, pp. 249-280. + .. _Oikawaetal2005: |br| @@ -1980,6 +2047,12 @@ New York, 480 pp. Pelletier, J. D., P. D. Broxton, P. Hazenberg, X. Zeng, P. A. Troch, G. Y. Niu, Z. Williams, M. A. Brunke, and D. Gochis, 2016: A gridded global data set of soil, intact regolith, and sedimentary deposit thicknesses for regional and global land surface modeling. J. Adv. Mod. Earth Sys. 8:41-65. +.. _peterson1986: + +|br| + +Peterson, D.L. and K.C. Ryan, 1986. Modeling postfire conifer mortality for long-range planning. Environmental Management 10.6, pp. 797-808. + .. _Petrescuetal2010: |br| @@ -1987,6 +2060,12 @@ Pelletier, J. D., P. D. Broxton, P. Hazenberg, X. Zeng, P. A. Troch, G. Y. Niu, Petrescu, A.M.R. et al. 2010. Modeling regional to global CH4 emissions of boreal and arctic wetlands. Global Biogeochemical Cycles, 24(GB4009). +.. _pfeiffer2013: + +|br| + +Pfeiffer, M., A. Spessa, and J.O. Kaplan, 2013. A model for global biomass burning in preindustrial time: LPJ-LMfire (v1. 0). Geoscientific Model Development 6.3, pp. 643-685. + .. _Philip1957: |br| @@ -2058,13 +2137,11 @@ ice-atmosphere interactions underestimates ice sheet melt in millennial-scale deglaciation simulations. Geophys. Res. Lett. ** 35:L01503. DOI:10.1029/2007GL031738. -.. _Qianetal2006: +.. _purves2008: |br| -Qian, T., Dai, A., Trenberth, K.E., and Oleson, K.W. 2006. Simulation of -global land surface conditions from 1948 to 2004: Part I: Forcing data -and evaluations. J. Hydrometeor. 7:953-975. +Purves, D.W. et al., 2008. Predicting and understanding forest dynamics using a simple tractable model. Proceedings of the National Academy of Sciences 105.44, pp. 17018-17022. .. _RamankuttyFoley1998: @@ -2199,11 +2276,21 @@ Saggar, S., Tate, K.R., Feltham, C.W., Childs, C.W. and Parshotam, A., :math:`{}^{14}`\ C-labelled glucose. Soil Biology and Biochemistry, 26: 1263-1271. +.. _Sakaguchietal2009: + +|br| + Sakaguchi, K., and Zeng, X. 2009. Effects of soil wetness, plant litter, and under-canopy atmospheric stability on ground evaporation in the Community Land Model (CLM3.5). J. Geophys. Res. 114:D01107. DOI:10.1029/2008JD010834. +.. _sato2007: + +|br| + +Sato, H., A. Itoh, and T. Kohyama, 2007. SEIB-DGVM: A new Dynamic Global Vegetation Model using a spatially explicit individual-based approach. Ecological Modelling 200.3, pp. 2793307. + .. _Schaafetal2002: |br| @@ -2285,6 +2372,12 @@ Dazlich, D.A., Zhang, C., Collelo, G.D., and Bounoua, L. 1996. A revised land surface parameterization (SiB2) for atmospheric GCMs. Part I: Model formulation. J. Climate 9:676-705. +.. _sellers1996: + +|br| + +Sellers, Piers J et al. (1996). A revised land surface parameterization (SiB2) for atmospheric GCMs. Part II: The generation of global fields of terrestrial biophysical parameters from satellite data. Journal of climate 9.4, pp. 706-737. + .. _Shietal2013: |br| @@ -2331,6 +2424,12 @@ Simpson, R.J., Lambers, H., and Dalling, M.J. 1983. Nitrogen redistribution during grain growth in wheat (Triticum avestivum L.). Plant Physiol. 71:7-14. +.. _sitch2003: + +|br| + +Sitch, S et al. (2003). Evaluation of ecosystem dynamics, plant geography and terrestrial carbon cycling in the LPJ dynamic global vegetation model. Global Change Biology 9.2, pp. 161-185. + .. _Sivak2013: |br| @@ -2339,6 +2438,12 @@ Sivak, M. 2013. Air conditioning versus heating: climate control is more energy demanding in Minneapolis than in Miami. Environ. Res. Lett., 8, doi:10.1088/1748-9326/8/1/014050. +.. _smith2001: + +|br| + +Smith, B., I.C. Prentice, and M.T. Sykes, 2001. Representation of vegetation dynamics in the modelling of terrestrial ecosystems: comparing two contrasting approaches within European climate space. Global Ecology and Biogeography 10.6, pp. 621-637. + .. _Smithetal2005: |br| @@ -2348,6 +2453,12 @@ G.L.W., 2005. Fire in African savanna: Testing the impact of incomplete combustion on pyrogenic emissions estimates. Ecological Applications, 15: 1074-1082. +.. _smith2007: + +|br| + +Smith, A.M. and M. Stitt, 2007. Coordination of carbon supply and plant growth. Plant, cell & environment 30.9, pp. 1126-1149. + .. _Sollins1982: |br| @@ -2550,6 +2661,13 @@ fire disturbance for global vegetation dynamics: coupling fire into a Dynamic Global Vegetation Model. Global Ecology and Biogeography 10:661-667. +.. _thonicke2010: + +|br| + +Thonicke, K. et al., 2010. The influence of vegetation, fire spread and fire behaviour on biomass burning and trace gas emissions: results from a process-based model. Biogeosciences 7.6, pp. 1991-2011. + + .. _Thornton1998: |br| @@ -2662,6 +2780,12 @@ site. Agric. For. Meteor. 82:119-153. UNSTAT, 2005. National Accounts Main Aggregates Database, United Nations Statistics Division. +.. _uriarte2009: + +|br| + +Uriarte, M. et al., 2009. Natural disturbance and human land use as determinants of tropical forest dynamics: results from a forest simulator. Ecological Monographs 79.3, pp. 423-443. + .. _VallanoSparks2007: |br| @@ -2724,6 +2848,12 @@ Vanninen, P., and Makela, A. 2005. Carbon budget for Scots pine trees: effects of size, competition and site fertility on growth allocation and production. Tree Phys. 25:17-30. +.. _venevsky2002: + +|br| + +Venevsky, S. et al., 2002. Simulating fire regimes in human-dominated ecosystems: Iberian Peninsula case study. Global Change Biology 8.10, pp. 984-998. + .. _VerdinGreenlee1996: |br| @@ -2784,6 +2914,12 @@ Wang, A., and Zeng, X. 2009. Improving the treatment of vertical snow burial fraction over short vegetation in the NCAR CLM3. Adv. Atmos. Sci. 26:877-886. DOI:10.1007/s00376-009-8098-3. +.. _weng2014: + +|br| + +Weng, E.S. et al., 2014. Scaling from individuals to ecosystems in an Earth System Model using a mathematically tractable model of height-structured competition for light. Biogeosciences Discussions 11.12, pp. 17757-17860. + .. _Whiteetal1997: |br| @@ -2857,10 +2993,16 @@ Water Resour. Res., 47, W03517, doi:10.1029/2009WR008871. |br| -Wu, H., J. S. Kimball, H. Li, M. Huang, L. R. Leung, and R. F. Adler -(2012), A New Global River Network Database for Macroscale Hydrologic +Wu, H., J. S. Kimball, H. Li, M. Huang, L. R. Leung, and R. F. Adler, +2012. A New Global River Network Database for Macroscale Hydrologic modeling, Water Resour. Res., 48, W09701, doi:10.1029/2012WR012313. +.. _xiaodong2005: + +|br| + +Xiaodong, Y. and H.H. Shugart, 2005. FAREAST: a forest gap model to simulate dynamics and patterns of eastern Eurasian forests. Journal of Biogeography 32.9, pp. 1641-1658. + .. _Xuetal2012: |br| @@ -2966,195 +3108,3 @@ Global Biogeochemical Cycles 18. DOI:10.1029/2004GB002239. Zilitinkevich, S.S. 1970. Dynamics of the Atmospheric Boundary Layer. Leningrad Gidrometeor. -.. _bonan2012: - -|br| - -Bonan, Gordon B et al. (2012). `Reconciling leaf physiological traits and canopy flux data: Use of the TRY and FLUXNET databases in the Community Land Model version 4`. Journal of Geophysical Research: Biogeosciences (2005-2012) 117.G2. - -.. _botta2000: - -|br| - -Botta, A et al. (2000). `A global prognostic scheme of leaf onset using satellite data`. Global Change Biology 6.7, pp. 709-725. - -.. _byram1959: - -|br| - -Byram, GM (1959). Combustion of forest fuels. In Forest fire: control and use.(Ed. KP Davis) pp. 61-89. - -.. _collatz1991: - -|br| - -Collatz, G James et al. (1991). `Physiological and environmental regulation of stomatal conductance, photosynthesis and transpiration: a model that includes a laminar boundary layer` Agricultural and Forest Meteorology 54.2, pp. 107-136. - -.. _collatz1992: - -|br| - -Collatz, Go J, M Ribas-Carbo, and JA Berry (1992). `Coupled photosynthesis-stomatal conductance model for leaves of C4 plants`. Functional Plant Biology 19.5, pp. 519-538.
 - -.. _farquhar1980: - -|br| - -Farquhar, GD, S von von Caemmerer, and JA Berry (1980). `A biochemical model of photosynthetic CO2 assimilation in leaves of C3 species`. Planta 149.1, pp. 780-90. - -.. _fisher2010: - -|br| - -Fisher, JB et al. (2010). `Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation`. Global Biogeochemical Cycles 24.1. - -.. _foley1996: - -|br| - -Foley, Jonathan A et al. (1996). `An integrated biosphere model of land surface processes, terrestrial carbon balance, and vegetation dynamics`. Global Biogeochemical Cycles 10.4, pp. 603-628. - -.. _fyllas2014: - -|br| - -Fyllas, NM et al. (2014). `Analysing Amazonian forest productivity using a new individual and trait- based model (TFS v. 1)`. Geoscientific Model Development 7.4, pp. 1251-1269. - -.. _kucharik1998: - -|br| - -Kucharik, Christopher J, John M Norman, and Stith T Gower (1998). `Measurements of branch area and adjusting leaf area index indirect measurements`. Agricultural and Forest Meteorology 91.1, pp. 69-88. - -.. _li2012: - -|br| - -Li, F, XD Zeng, and S Levis (2012). `A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model`. Biogeosciences 9.7, pp. 2761-2780. - -.. _lichstein2011: - -|br| - -Lichstein, Jeremy W and Stephen W Pacala (2011). `Local diversity in heterogeneous landscapes: quantitative assessment with a height-structured forest metacommunity model`. Theoretical Ecology 4.2, pp. 269-281. - -.. _lischke2006: - -|br| - -Lischke, Heike et al. (2006). `TreeMig: a forest-landscape model for simulating spatio-temporal patterns from stand to landscape scale`. Ecological Modelling 199.4, pp. 409-420. 41 - -.. _lloyd2010: - -|br| - -Lloyd, J et al. (2010). `Optimisation of photosynthetic carbon gain and within-canopy gradients of associated foliar traits for Amazon forest trees`. Biogeosciences 7.6, pp. 1833-1859. - -.. _mcdowell2013: - -|br| - -McDowell, Nate G et al. (2013). `Evaluating theories of drought-induced vegetation mortality using a multimodel experiment framework`. New Phytologist 200.2, pp. 304-321. - -.. _medlyn2011: - -|br| - -Medlyn, Belinda E et al. (2011). `Reconciling the optimal and empirical approaches to modelling stom- atal conductance`. Global Change Biology 17.6, pp. 2134-2144. - - -.. _mc_2001: - -|br| - -Moorcroft, PR, GC Hurtt, and Stephen W Pacala (2001). `A method for scaling vegetation dynamics: the ecosystem demography model ED`. Ecological monographs 71.4, pp. 557-586. - -.. _norman1979: - -|br| - -Norman, JM (1979). `Modeling the complete crop canopy`. Modification of the Aerial Environment of Crops, pp. 249-280. - -.. _oleson2013: - -|br| - -Oleson, KW et al. (2013). `Technical description of version 4.5 of the Community Land Model (CLM)`. - -.. _peterson1986: - -|br| - -Peterson, David L and Kevin C Ryan (1986). `Modeling postfire conifer mortality for long-range planning`. Environmental Management 10.6, pp. 797-808. - -.. _pfeiffer2013: - -|br| - -Pfeiffer, M, A Spessa, and JO Kaplan (2013). `A model for global biomass burning in preindustrial time: LPJ-LMfire (v1. 0)`. Geoscientific Model Development 6.3, pp. 643-685. - -.. _purves2008: - -|br| - -Purves, Drew W et al. (2008). `Predicting and understanding forest dynamics using a simple tractable model`. Proceedings of the National Academy of Sciences 105.44, pp. 17018-17022. - -.. _sato2007: - -|br| - -Sato, Hisashi, Akihiko Itoh, and Takashi Kohyama (2007). `SEIB–DGVM: A new Dynamic Global Vegetation Model using a spatially explicit individual-based approach`. Ecological Modelling 200.3, pp. 2793307. - -.. _sellers1996: - -|br| - -Sellers, Piers J et al. (1996). `A revised land surface parameterization (SiB2) for atmospheric GCMs. Part II: The generation of global fields of terrestrial biophysical parameters from satellite data`. Journal of climate 9.4, pp. 706-737. - -.. _sitch2003: - -|br| - -Sitch, S et al. (2003). `Evaluation of ecosystem dynamics, plant geography and terrestrial carbon cycling in the LPJ dynamic global vegetation model`. Global Change Biology 9.2, pp. 161-185. - -.. _smith2007: - -|br| - -Smith, Alison M and Mark Stitt (2007). `Coordination of carbon supply and plant growth`. Plant, cell & environment 30.9, pp. 1126-1149. - -.. _smith2001: - -|br| - -Smith, Benjamin, I Colin Prentice, and Martin T Sykes (2001). `Representation of vegetation dynamics in the modelling of terrestrial ecosystems: comparing two contrasting approaches within European climate space`. Global Ecology and Biogeography 10.6, pp. 621-637. - -.. _thonicke2010: - -|br| - -Thonicke, K et al. (2010). `The influence of vegetation, fire spread and fire behaviour on biomass burning and trace gas emissions: results from a process-based model`. Biogeosciences 7.6, pp. 1991-2011. - -.. _uriarte2009: - -|br| - -Uriarte, Maria et al. (2009). `Natural disturbance and human land use as determinants of tropical forest dynamics: results from a forest simulator`. Ecological Monographs 79.3, pp. 423-443. - -.. _venevsky2002: - -|br| - -Venevsky, Sergey et al. (2002). `Simulating fire regimes in human-dominated ecosystems: Iberian Peninsula case study`. Global Change Biology 8.10, pp. 984-998. - -.. _weng2014: - -|br| - -Weng, ES et al. (2014). `Scaling from individuals to ecosystems in an Earth System Model using a mathematically tractable model of height-structured competition for light`. Biogeosciences Discussions 11.12, pp. 17757-17860. - -.. _xiaodong2005: - -|br| - -Xiaodong, Yan and HH Shugart (2005). `FAREAST: a forest gap model to simulate dynamics and patterns of eastern Eurasian forests`. Journal of Biogeography 32.9, pp. 1641-1658. From 180ed91cf10893e222a4858e0a0e0f340651a288 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Feb 2018 13:59:54 -0700 Subject: [PATCH 0138/1973] Rewrite portions of the SMB section --- .../Glacier/CLM50_Tech_Note_Glacier.rst | 115 +++++++++++------- 1 file changed, 73 insertions(+), 42 deletions(-) diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index e125a1141e..a7f2100478 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -61,9 +61,9 @@ CISM: (e.g., in the Alps, Rockies, Andes, and Himalayas), not just those which are part of ice sheets. -In typical runs, CLM computes the SMB and sends it to CISM, but CISM's -ice sheet geometry remains fixed over the course of the run. In these -runs, CISM serves two roles in the system: +In typical runs, CISM is not evolving; CLM computes the SMB and sends it +to CISM, but CISM's ice sheet geometry remains fixed over the course of +the run. In these runs, CISM serves two roles in the system: #. Over the CISM domain (typically Greenland in CESM2), CISM dictates glacier areas and topographic elevations, overriding the values on @@ -258,6 +258,14 @@ the melting depends on the sum of the radiative, turbulent, and conductive fluxes reaching the surface, as described elsewhere in this document. +Note that the SMB typically is defined as the total accumulation of ice +and snow, minus the total ablation. The SMB flux passed to CISM is the +mass balance for ice alone, not snow. We can think of CLM as owning the +snow, whereas CISM owns the underlying ice. Fluctuations in snow depth +between 0 and 10 m water equivalent are not reflected in the SMB passed +to CISM. In transient runs, this can lead to delays of a few decades in +the onset of accumulation or ablation in a given glacier column. + SMB is computed and sent to the CESM coupler regardless of whether and where CISM is operating. However, the effect of SMB terms on runoff fluxes differs depending on whether and where CISM is evolving in @@ -266,45 +274,68 @@ two-way-coupled mode. This is described by the variable the edge case where a CLM grid cell partially overlaps with the CISM grid, but we describe it as a logical variable here for simplicity.) In typical cases where CISM is not evolving, *glc\_dyn\_runoff\_routing* -will be false everywhere. In cases where CISM is evolving and sending -its own calving flux to the coupler, *glc\_dyn\_runoff\_routing* will be -true over the CISM domain and false elsewhere. - -FIXME: Rewrite the following paragraph - -FIXME: Make sure I talk about the positive liquid runoff and negative -ice runoff that result from melted ice. - -FIXME: With interactive CISM, snow capping is applied to the surface -mass balance, not ice runoff. - -In the modified glacier\_mec columns, the treatment of melting and -freezing depends on the logical variable *glc\_dyntopo*. This variable -controls whether CLM surface topography changes dynamically as the ice -sheet evolves (i.e., whether the coupling is one-way or two-way). If -*glc\_dyntopo* is true, then CLM receives updated topographic -information from the ice sheet model. In this case, snow in excess of -the prescribed maximum depth is assumed to turn into ice, contributing a -positive SMB to the ice sheet model. Melting ice is assumed to run off -to the ocean, giving a negative SMB. The net SMB associated with ice -formation (by conversion from snow) and melting/runoff is computed for -each column, averaged over the coupling interval, and sent to the -coupler (*qice, mm/s*). If *glc\_dyntopo* is false, then surface runoff -for glacier\_mec land units is computed as for glacier land units: Any -snow in excess of 1 m LWE runs off to the ocean, and Melted ice remains -in place until it refreezes. Excess snow and melted ice still contribute -to positive and negative values, respectively, of *qice*, but only for -the purpose of forcing CISM. Currently, *glc\_dyntopo* = false -is the default, and the only supported option. - -Note that the SMB typically is defined as the total accumulation of ice -and snow, minus the total ablation. The *qice* flux passed to CISM is -the mass balance for ice alone, not snow. We can think of CLM as owning -the snow, whereas CISM owns the underlying ice. Fluctuations in snow -depth between 0 and 10 m water equivalent are not reflected in the SMB -passed to CISM. In transient runs, this can lead to delays of a few -decades in the onset of accumulation or ablation in a given glacier -column. +will be false everywhere; in these cases, CISM's mass is not considered +to be part of the coupled system. In cases where CISM is evolving and +sending its own calving flux to the coupler, *glc\_dyn\_runoff\_routing* +will be true over the CISM domain and false elsewhere. + +Any snow capping (section :numref:`Runoff from glaciers and snow-capped +surfaces`) is added to :math:`q_{ice,frz}`. Any liquid water (i.e., +melted ice) below the snow pack in the glacier column is added to +:math:`q_{ice,melt}`, then is converted back to ice to maintain a +pure-ice column. Then the total SMB is given by :math:`q_{ice,tot}`: + +.. math:: + :label: 13.1 + + q_{ice,tot} = q_{ice,frz} - q_{ice,melt} + +CLM is responsible for generating glacial surface melt, even when +running with an evolving ice sheet. Thus, :math:`q_{ice,melt}` is always +added to liquid runoff (:math:`q_{rgwl}`), regardless of +*glc\_dyn\_runoff\_routing*. However, the ice runoff flux depends on +*glc\_dyn\_runoff\_routing*. If *glc\_dyn\_runoff\_routing* is true, +then CISM controls the fate of the snow capping mass in +:math:`q_{ice,frz}` (e.g., eventually transporting it to lower +elevations where it can be melted or calved). Since CISM will now own +this mass, the snow capping flux does *not* contribute to any runoff +fluxes generated by CLM. + +If *glc\_dyn\_runoff\_routing* is false, then CLM sends the snow capping +flux as runoff, as a crude representation of ice calving (see also +sections :numref:`Runoff from glaciers and snow-capped surfaces` and +:numref:`Glacier regions`). However, this ice runoff flux is reduced by +:math:`q_{ice,melt}`. This reduction is needed for conservation; its +need is subtle, but can be understood with either of these explanations: + +- When ice melts, we let the liquid run off and replace it with new + ice. That new ice needs to come from somewhere to keep the coupled + system in water balance. We "request" the new ice from the ocean by + generating a negative ice runoff equivalent to the amount we have + melted. + +- Ice melt removes mass from the system, as it should. But the snow + capping flux also removes mass from the system. The latter is a crude + parameterization of calving, assuming steady state - i.e., all ice + gain is balanced by ice loss. This removal of mass due to both + accumulation and melt represents a double-counting. Each unit of melt + indicates that one unit of accumulation should not have made it to the + ocean as ice, but instead melted before it got there. So we need to + correct for this double-counting by removing one unit of ice runoff + for each unit of melt. + +For a given point in space or time, this reduction can result in +negative ice runoff. However, when integrated over time and space, for +an ice sheet that is near equilibrium, this just serves to decrease the +too-high positive ice runoff from snow capping. (This near-equilibrium +assumption is a key point in the treatment of snow capping with +*glc\_dyn\_runoff\_routing* false. For glaciers and ice sheets that +violate this assumption, either because they are far out of equilibrium +with the climate or because the model is being run for hundreds of +years, there are two ways to avoid the unrealistic ice runoff from snow +capping: by running with an evolving, two-way-coupled ice sheet or by +changing a glacier region's ice runoff behavior as described in section +:numref:`Glacier regions`.) In regions where SMB is computed for glaciers, SMB is also computed for the natural vegetated land unit. Because there is no ice to melt in this From 1d062cbc0616a9c13776d01d9c572a9baec17972 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Feb 2018 15:40:50 -0700 Subject: [PATCH 0139/1973] fix formatting of mosart page --- doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst index b844b4a433..eabdb50763 100644 --- a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst +++ b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst @@ -228,14 +228,17 @@ Difference between CLM5.0 and CLM4.5 1. Routing methods: RTM, a linear reservoir method, is used in CLM4.5 for river routing, whilst in CLM5.0, MOSART is an added option for river routing -based on the more physically-based kinematic wave method. +based on the more physically-based kinematic wave method. + 2. Runoff treatment: In RTM runoff is routed regardless of its sign so negative streamflow can be simulated at times. MOSART routes only nonnegative runoff and always produces positive streamflow, which is important for future extension for modeling riverine heat and biogeochemical fluxes. + 3. Input parameters: RTM in CLM4.5 only requires one layer of spatial variable of channel velocity, whilst MOSART in CLM5.0 requires 13 parameters that -are all available globally at 0.5 :sup:`o` resolution. +are all available globally at 0.5 :sup:`o` resolution. + 4. Outputs: RTM only produces streamflow simulation, whilst MOSART additionally simulates the time-varying channel velocities and channel water depth and channel surface water variation. From e2edd92eddb2b8a74729479c5d0b01d674a5baae Mon Sep 17 00:00:00 2001 From: Katie Dagon Date: Thu, 1 Feb 2018 16:30:49 -0700 Subject: [PATCH 0140/1973] Fixed some typos and errors --- .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 4 +- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 2 +- .../CLM50_Tech_Note_Introduction.rst | 2 +- .../CLM50_Tech_Note_Photosynthesis.rst | 2 +- ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 38 +++++++-------- .../CLM50_Tech_Note_Plant_Hydraulics.rst | 48 +++++++++---------- .../CLM50_Tech_Note_Plant_Mortality.rst | 8 ++-- doc/source/tech_note/index.rst | 1 + 8 files changed, 53 insertions(+), 52 deletions(-) diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index 95214580b4..fdd6873346 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -1236,7 +1236,7 @@ The leaf boundary layer resistance :math:`r_{b}` is where :math:`C_{v} =0.01` m\ s\ :sup:`-1/2` is the turbulent transfer coefficient between the canopy surface and canopy air, and :math:`d_{leaf}` is the characteristic dimension of the leaves in the -direction of wind flow (:numref:`Table Coefficients for saturation vapor pressure`). +direction of wind flow (:numref:`Table Plant functional type aerodynamic parameters`). The partial derivatives of the fluxes from the soil beneath the canopy with respect to ground temperature, which are needed for the soil @@ -1279,7 +1279,7 @@ adjusted for canopy density following :ref:`Zeng and Wang (2007) ` d = z_{top} R_{d} V where :math:`z_{top}` is canopy top height (m) -(:numref:`Table Prescribed plant functional type heights`), +(:numref:`Table Plant functional type canopy top and bottom heights`), :math:`R_{z0m}` and :math:`R_{d}` are the ratio of momentum roughness length and displacement height to canopy top height, respectively (:numref:`Table Plant functional type aerodynamic parameters`), and :math:`z_{0m,\, g}` diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index fb0dff13ab..b1153c3a5d 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -137,7 +137,7 @@ They are defined by .. math:: :label: 7.11 - W_{can,\,sno}^{max } =p_{ice}\left(L+S\right). + W_{can,\,sno}^{max } =p_{sno}\left(L+S\right). The maximum storage of liquid water is :math:`p_{liq}=0.1` kg m\ :sup:`-2` (:ref:`Dickinson et al. 1993 `), and that of snow diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 562b772c51..0993904323 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -31,7 +31,7 @@ P. O. Box 3000, Boulder, Colorado 80307-300 **LIST OF FIGURES** -- :numref:`Figure Land processes` Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from Lawrence et al. (2011) for CLM5.0). +- :numref:`Figure Land processes` Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from :ref:`Lawrence et al. (2011)` for CLM5.0). - :numref:`Figure CLM subgrid hierarchy` Configuration of the CLM subgrid hierarchy. diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index 8dad4faf3e..258fa3f182 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -89,7 +89,7 @@ atmospheric potential temperature (K). .. table:: Plant functional type (PFT) stomatal conductance parameters. +----------------------------------+-------------------+ - | PFT | g\ :sub:`1` (Pa) | + | PFT | g\ :sub:`1` | +==================================+===================+ | NET Temperate | 2.35 | +----------------------------------+-------------------+ diff --git a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst index 0c99101fa0..c47ce0e624 100755 --- a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst +++ b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst @@ -6,7 +6,7 @@ Photosynthetic Capacity The photosynthetic capacity is represented by two key parameters: 1) the maximum rate of carboxylation at 25 :sup:`o`\ C, :math:`V_{\text{c,max25}}`; and 2) the maximum rate of electron transport at 25 :sup:`o`\ C, :math:`J_{\text{max25}}` . They are predicted by a mechanistic model of leaf -utilization of nitrogen for assimilation (LUNA V1.0) (Ali et al. 2016) based on an optimality hypothesis to nitrogen allocation +utilization of nitrogen for assimilation (LUNA V1.0) (:ref:`Ali et al. 2016`) based on an optimality hypothesis to nitrogen allocation among light capture, electron transport, carboxylation, respiration and storage. Specifically, the model allocates the nitrogen by maximizing the daily net photosynthetic carbon gain under following two key assumptions: @@ -30,7 +30,7 @@ The LUNA model includes the following four unitless parameters: - :math:`H` , which determines the response of electron transport rate to relative humidity. The above four parameters are estimated by fitting the LUNA model to a global compilation of >800 obervations -located at different biomes, canopy locations, and time of the year from 1993-2013 (Ali et al 2015). The model inputs +located at different biomes, canopy locations, and time of the year from 1993-2013 (Ali et al. 2015). The model inputs are area-based leaf nitrogen content, leaf mass per unit leaf area and the driving environmental conditions (average of past 10 days) including temperature, CO :sub:`2` concentrations, daily mean and maximum radiation, relative humidity and day length. The estimated values in CLM5 for the listed parameters are 0.0311, 0.1745, 0.8054, and 6.0999, repectively. In LUNA V1.0, the estimated @@ -51,9 +51,9 @@ Model structure Plant Nitrogen '''''''''''''''''''''''''' -The structure of the LUNA model is adapted from Xu et al.(2012), where the plant nitrogen at the leaf level ( :math:`\text{LNC}_{a}`; gN/ m :sup:`2` leaf) is divided into +The structure of the LUNA model is adapted from :ref:`Xu et al. (2012)`, where the plant nitrogen at the leaf level ( :math:`\text{LNC}_{a}`; gN/ m :sup:`2` leaf) is divided into four pools: structural nitrogen( :math:`N_{\text{str}}`; gN/m :sup:`2` leaf), -photosynthetic nitrogen ( :math:`N_{\text{psn}}`; gN/ m:sup:`2` leaf), +photosynthetic nitrogen ( :math:`N_{\text{psn}}`; gN/m :sup:`2` leaf), storage nitrogen( :math:`N_{\text{store}}`; gN/m :sup:`2` leaf), and respiratory nitrogen ( :math:`N_{\text{resp}}`; gN/m :sup:`2` leaf). Namely, @@ -75,14 +75,14 @@ Namely, N_{\text{psn}} =N_{\text{et}} + N_{\text{cb}} + N_{\text{lc}}. The structural nitrogen, :math:`N_{\text{str}}`, is calculated as the -multiplication of leaf mass per unit area (LMA: g biomass/m :sup:`2` leaf), and the structural nitrogen content (SNC; gN/g biomass). Namely, +multiplication of leaf mass per unit area (:math:`\text{LMA}`; g biomass/m :sup:`2` leaf), and the structural nitrogen content (:math:`\text{SNC}`; gN/g biomass). Namely, .. math:: :label: 10.3) N_{\text{str}} = \text{SNC} \cdot \text{LMA} -where SNC is set to be fixed at 0.002 (gN/g biomass), based on data on C:N ratio from dead wood (White etal.,2000). +where :math:`\text{SNC}` is set to be fixed at 0.002 (gN/g biomass), based on data on C:N ratio from dead wood (White etal.,2000). We assume that plants optimize their nitrogen allocations (i.e., :math:`N_{\text{store}}`, :math:`N_{\text{resp}}`, :math:`N_{\text{lc}}`, :math:`N_{\text{et}}`, :math:`N_{\text{cb}}`) to maximize the photosynthetic carbon gain, defined as the gross photosynthesis ( :math:`A` ) minus the maintenance respiration for @@ -99,18 +99,18 @@ use. Namely, the solutions of nitrogen allocations \{ :math:`N_{\text{store}}`, where :math:`\text{FNC}_{a}` is the functional nitrogen content defined as the total leaf nitrogen content ( :math:`\text{LNC}_{a}`) minus the structural nitrogen content ( :math:`N_{\text{str}}` ). -The gross photosynthesis, :math:`A`, was calculated with a coupled leaf gas exchange model based on the Farquhar et al. (1980) model of -photosynthesis and Ball--Berry-type stomatal conductance model (Ball et al., 1987). The maintenance respiration for photosynthetic enzymes, :math:`R_{\text{psn}}`, is +The gross photosynthesis, :math:`A`, was calculated with a coupled leaf gas exchange model based on the :ref:`Farquhar et al. (1980)` model of +photosynthesis and Ball--Berry-type stomatal conductance model (Ball et al. 1987). The maintenance respiration for photosynthetic enzymes, :math:`R_{\text{psn}}`, is calculated by the multiplication of total photosynthetic nitrogen ( :math:`N_{\text{psn}}` ) and the maintenance respiration cost for photosynthetic enzymes. Maximum electron transport rate ''''''''''''''''''''''''''''''''' In the LUNA model, the maximum electron transport rate -( :math:`J_{\text{max}}`; :math:`{\mu} mol` electron / m :sup:`-2`/s) +( :math:`J_{\text{max}}`; :math:`{\mu} mol` electron / m :sup:`2`/s) is simulated to have a baseline allocation of nitrogen and additional nitrogen allocation to change depending on the average daytime -photosynthetic active radiation (PAR; :math:`{\mu} mol` electron / m :sup:`-2`/s), day length (hours) and air humidity. +photosynthetic active radiation (PAR; :math:`{\mu} mol` electron / m :sup:`2`/s), day length (hours) and air humidity. Specifically, the LUNA model has .. math:: @@ -134,7 +134,7 @@ is the nitrogen use efficiency of :math:`J_{\text{{max}}}`. :math:`J_{\text{max} transport rate to amount of absorbed light (i.e., :math:`\alpha \text{PAR}`). :math:`f\left(\text{day length} \right)` is a function specifies the impact of day length (hours) on :math:`J_{\text{max}}` in view that longer day length has been demonstrated by previous studies to alter :math:`V_{\mathrm{c}\text{max}25}` and -:math:`J_{\text{max}25}` (Bauerle et al., 2012; Comstock and Ehleringer, 1986) through photoperiod sensing and regulation (e.g. Song et al., 2013). +:math:`J_{\text{max}25}` (Bauerle et al. 2012; Comstock and Ehleringer 1986) through photoperiod sensing and regulation (e.g., Song et al. 2013). Following Bauerle et al. (2012), :math:`f\left(\text{day length} \right)` is simulated as follows, .. math:: @@ -193,7 +193,7 @@ Maximum rate of carboxylation The maximum rate of carboxylation at 25 :sup:`o`\ C varies with foliage nitrogen concentration and specific leaf area and is calculated -as in Thornton and Zimmermann (2007). At 25ºC, +as in :ref:`Thornton and Zimmermann (2007)`. At 25ºC, .. math:: :label: 10.11) @@ -235,7 +235,7 @@ Hemisphere). Implementation of Photosynthetic Capacity '''''''''''''''''''''''''''''''''''''''''' -Based on Farquhar et al. (1980) and Wullschleger (1993), we can calculate the +Based on :ref:`Farquhar et al. (1980)` and Wullschleger (1993), we can calculate the electron-limited photosynthetic rate under daily maximum radiation ( :math:`W_{jx}`) and the Rubisco-limited photosynthetic rate ( :math:`W_{\mathrm{c}}`) as follows, @@ -254,7 +254,7 @@ and the Rubisco-limited photosynthetic rate ( :math:`W_{\mathrm{c}}`) as follows where :math:`K_{j}` and :math:`K_{\mathrm{c}}` as the conversion factors for :math:`J_{x}` and :math:`V_{{\mathrm{c}, \text{max}}}` ( :math:`V_{{\mathrm{c}, \text{max}}}` to :math:`W_{\mathrm{c}}` and :math:`J_{x}` to :math:`W_{J_{x}}`), respectively. Based on -Xu et al. (2012), Maire et al. (2012) and Walker et al. (2014), we +:ref:`Xu et al. (2012)`, Maire et al. (2012) and Walker et al. (2014), we assume that :math:`W_{\mathrm{c}}` is proportional to :math:`W_{J_{x}}`. Specifically, we have @@ -266,14 +266,14 @@ assume that :math:`W_{\mathrm{c}}` is proportional to where :math:`t_{\mathrm{c}, j0}` is the baseline ratio of :math:`W_{\mathrm{c}}` to :math:`W_{J_{x}}`. We recognize that this ratio may change depending on the -nitrogen use efficiency of carboxylation and electron transport (Ainsworth and Rogers, 2007), +nitrogen use efficiency of carboxylation and electron transport (Ainsworth and Rogers 2007), therefore the LUNA model has the modification factor, :math:`t_{\alpha}`, to adjust baseline -the ratio depending on the nitrogen use efficiency for electron vs carboxylation (Ali et al 2016). +the ratio depending on the nitrogen use efficiency for electron vs carboxylation (:ref:`Ali et al. 2016`). Total Respiration ''''''''''''''''''' -Following Collatz et al.(1991a), the total respiration ( :math:`R_{\mathrm{t}}`) is +Following :ref:`Collatz et al. (1991)`, the total respiration ( :math:`R_{\mathrm{t}}`) is calculated in proportion to :math:`V_{\text{c,max}}`, .. math:: @@ -295,7 +295,7 @@ Accounting for the daytime and nighttime temperature, the daily respirations is where :math:`D_{\text{day}}` and :math:`D_{\text{night}}` are daytime and nighttime durations in seconds. :math:`f_{\mathrm{r}}(T_{\text{night}})` and :math:`f_{\mathrm{r}}(T_{\text{day}})` are the temperature response functions for -respiration [see Appendix B in Ali et al (2016) for details ]. +respiration (see Appendix B in :ref:`Ali et al. (2016)` for details). .. _Numerical scheme: @@ -304,7 +304,7 @@ Numerical scheme --------------------------------------------------------- The LUNA model searches for the "optimal" nitrogen allocations for maximum net photosynthetic carbon gain -by incrementally increase the nitrogen allocated for light capture (i.e., :math:`N_{\text{lc}}`) (see Ali et al 2016 for details) . +by incrementally increase the nitrogen allocated for light capture (i.e., :math:`N_{\text{lc}}`) (see :ref:`Ali et al. (2016)` for details). We assume that plants only optimize the nitrogen allocation when they can grow (i.e., GPP>0.0). If GPP become zero under stress, then the LUNA model assume a certain amount of enzyme will decay at daily rates of 0.1, in view that the half-life time for photosynthetic enzymes are short (~7 days) (Suzuki et al. 2001). diff --git a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index 0a0e2ff370..b2afa06646 100644 --- a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -183,7 +183,7 @@ modeled according to Darcy's Law for porous media flow as: q = kA\left( \psi_1 - \psi_2 \right) -:math:`q` is the flux of water (mmH\ :sub:`2`\ O) spanning the segment +:math:`q` is the flux of water (mmH\ :sub:`2`\ O/s) spanning the segment between :math:`\psi_1` and :math:`\psi_2` :math:`k` is the hydraulic conductance (s\ :sup:`-1`\ ) @@ -206,11 +206,11 @@ conductivity (:math:`p50`) and a shape fitting parameter (:math:`c_k`). k=k_{max}\cdot 2^{-\left(\dfrac{\psi_1}{p50}\right)^{c_k}} -:math:`k_{max}` is the maximum segment conductance (s-1) +:math:`k_{max}` is the maximum segment conductance (s\ :sup:`-1`\ ) -:math:`p50` is the water potential at 50% loss of conductivity (mmH2O) +:math:`p50` is the water potential at 50% loss of conductivity (mmH\ :sub:`2`\ O) -:math:`\psi_1` is the water potential of the lower segment terminus (mmH2O) +:math:`\psi_1` is the water potential of the lower segment terminus (mmH\ :sub:`2`\ O) .. _Stem-to-leaf: @@ -255,27 +255,27 @@ basis is the leaf area index (either sunlit or shaded). Variables: -:math:`q_{1a}` = flux of water (mmH2O/s) from stem to sunlit leaf +:math:`q_{1a}` = flux of water (mmH\ :sub:`2`\ O/s) from stem to sunlit leaf -:math:`q_{1b}` = flux of water (mmH2O/s) from stem to shaded leaf +:math:`q_{1b}` = flux of water (mmH\ :sub:`2`\ O/s) from stem to shaded leaf :math:`LAI_{sun}` = sunlit leaf area index (m2/m2) :math:`LAI_{shade}` = shaded leaf area index (m2/m2) -:math:`\psi_{stem}` = stem water potential (mmH2O) +:math:`\psi_{stem}` = stem water potential (mmH\ :sub:`2`\ O) -:math:`\psi_{sunleaf}` = sunlit leaf water potential (mmH2O) +:math:`\psi_{sunleaf}` = sunlit leaf water potential (mmH\ :sub:`2`\ O) -:math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH2O) +:math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH\ :sub:`2`\ O) Parameters: -:math:`k_{1a,max}` = maximum leaf conductance (s-1) +:math:`k_{1a,max}` = maximum leaf conductance (s\ :sup:`-1`\ ) -:math:`k_{1b,max}` = maximum leaf conductance (s-1) +:math:`k_{1b,max}` = maximum leaf conductance (s\ :sup:`-1`\ ) -:math:`p50_{1}` = water potential at 50% loss of conductance (mmH2O) +:math:`p50_{1}` = water potential at 50% loss of conductance (mmH\ :sub:`2`\ O) :math:`c_{k}` = vulnerability curve shape-fitting parameter (-) @@ -309,21 +309,21 @@ gravitational potential. Variables: -:math:`q_2` = flux of water (mmH2O/s) from root to stem +:math:`q_2` = flux of water (mmH\ :sub:`2`\ O/s) from root to stem :math:`SAI` = stem area index (m2/m2) -:math:`\Delta\psi_z` = gravitational potential (mmH2O) +:math:`\Delta\psi_z` = gravitational potential (mmH\ :sub:`2`\ O) -:math:`\psi_{root}` = root water potential (mmH2O) +:math:`\psi_{root}` = root water potential (mmH\ :sub:`2`\ O) -:math:`\psi_{stem}` = stem water potential (mmH2O) +:math:`\psi_{stem}` = stem water potential (mmH\ :sub:`2`\ O) Parameters: :math:`k_{2,max}` = maximum stem conductivity (m/s) -:math:`p50_2` = water potential at 50% loss of conductivity (mmH2O) +:math:`p50_2` = water potential at 50% loss of conductivity (mmH\ :sub:`2`\ O) :math:`z_2` = vegetation height (m) @@ -392,17 +392,17 @@ from the characteristic root spacing (section :numref:`Root Spacing`). Variables: -:math:`q_{3,i}` = flux of water (mmH2O/s) from soil layer :math:`i` to root +:math:`q_{3,i}` = flux of water (mmH\ :sub:`2`\ O/s) from soil layer :math:`i` to root -:math:`\Delta\psi_{z,i}` = change in gravitational potential from soil layer :math:`i` to surface (mmH2O) +:math:`\Delta\psi_{z,i}` = change in gravitational potential from soil layer :math:`i` to surface (mmH\ :sub:`2`\ O) :math:`LAI` = total leaf area index (m2/m2) :math:`SAI` = stem area index (m2/m2) -:math:`\psi_{soil,i}` = water potential in soil layer :math:`i` (mmH2O) +:math:`\psi_{soil,i}` = water potential in soil layer :math:`i` (mmH\ :sub:`2`\ O) -:math:`\psi_{root}` = root water potential (mmH2O) +:math:`\psi_{root}` = root water potential (mmH\ :sub:`2`\ O) :math:`z_{3,i}` = length of root tissue conducting path = soil layer depth + root lateral length (m) @@ -414,7 +414,7 @@ Parameters: :math:`f_{root-leaf}` = root-to-shoot ratio (-) -:math:`p50_3` = water potential at 50% loss of root tissue conductance (mmH2O) +:math:`p50_3` = water potential at 50% loss of root tissue conductance (mmH\ :sub:`2`\ O) :math:`ck` = shape-fitting parameter for vulnerability curve (-) @@ -461,9 +461,9 @@ Vegetation water stress is calculated based on leaf water potential and is used :math:`E_{shade,max}` = shaded leaf transpiration absent water stress (mm/s) -:math:`\psi_{sunleaf}` = sunlit leaf water potential (mmH2O) +:math:`\psi_{sunleaf}` = sunlit leaf water potential (mmH\ :sub:`2`\ O) -:math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH2O) +:math:`\psi_{shadeleaf}` = shaded leaf water potential (mmH\ :sub:`2`\ O) :math:`\beta_{t,sun}` = sunlit transpiration water stress (-) diff --git a/doc/source/tech_note/Plant_Mortality/CLM50_Tech_Note_Plant_Mortality.rst b/doc/source/tech_note/Plant_Mortality/CLM50_Tech_Note_Plant_Mortality.rst index d087e1d06a..4c2cb71a26 100644 --- a/doc/source/tech_note/Plant_Mortality/CLM50_Tech_Note_Plant_Mortality.rst +++ b/doc/source/tech_note/Plant_Mortality/CLM50_Tech_Note_Plant_Mortality.rst @@ -9,7 +9,7 @@ plants due to the aggregate of processes such as wind throw, insect attack, disease, extreme temperatures or drought, and age-related decline in vigor. These processes are referred to in aggregate as “gap-phase” mortality. Mortality due to fire and anthropogenic land -cover change are treated separately (see Chapters 18 and 21, +cover change are treated separately (see Chapters :numref:`rst_Fire` and :numref:`rst_Transient Landcover Change`, respectively). Mortality Fluxes Leaving Vegetation Pools @@ -19,9 +19,9 @@ Whole-plant mortality is parameterized very simply, assuming a mortality rate of 2% yr\ :sup:`-1` for all vegetation types. This is clearly a gross oversimplification of an important process, and additional work is required to better constrain this process in different climate zones -(Keller et al. 2004; Sollins 1982), for different species mixtures -(Gomes et al. 2003), and for different size and age classes (Busing -2005; Law et al. 2003). Literature values for forest mortality rates +(:ref:`Keller et al. 2004`; :ref:`Sollins 1982`), for different species mixtures +(:ref:`Gomes et al. 2003`), and for different size and age classes (:ref:`Busing +2005`; :ref:`Law et al. 2003`). Literature values for forest mortality rates range from at least 0.7% to 3.0% yr\ :sup:`-1`. Taking the annual rate of mortality (*am*, proportion yr\ :sup:`-1`) as 0.02, a mortality rate per second (*m*) is calculated as diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index d54e70f1e9..5f72de7d9b 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -34,6 +34,7 @@ CLM Technical Note Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst Decomposition/CLM50_Tech_Note_Decomposition.rst External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst + Plant_Mortality/CLM50_Tech_Note_Plant_Mortality.rst Fire/CLM50_Tech_Note_Fire.rst Methane/CLM50_Tech_Note_Methane.rst Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst From b5c0ae92aeb43ca4cd2159723227707c39dae0ff Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Feb 2018 16:58:47 -0700 Subject: [PATCH 0141/1973] Add what's new with glaciers, and some minor edits --- .../Glacier/CLM50_Tech_Note_Glacier.rst | 97 +++++++++++++------ 1 file changed, 67 insertions(+), 30 deletions(-) diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index a7f2100478..7c9d98bcd6 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -1,7 +1,7 @@ .. _rst_Glaciers: Glaciers -============ +======== This chapter describes features of CLM that are specific to coupling to an ice sheet model (in the CESM context, this is the CISM model; @@ -11,6 +11,42 @@ about glacier land units can be found elsewhere in this document (see Chapter :numref:`rst_Surface Characterization, Vertical Discretization, and Model Input Requirements` for an overview). +.. _Glaciers summary of CLM5.0 updates relative to CLM4.5: + +Summary of CLM5.0 updates relative to CLM4.5 +-------------------------------------------- + +Compared with CLM4.5 (:ref:`Oleson et al. 2013 `), +CLM5.0 contains substantial improvements in its capabilities for +land-ice science. This section summarizes these improvements, and the +following sections provide more details. + +- All runs include multiple glacier elevation classes over Greenland and + Antarctica and compute ice sheet surface mass balance in those + regions. + +- A number of namelist parameters offer fine-grained control over + glacier behavior in different regions of the world (section + :numref:`Glacier regions`). (The options used outside of Greenland and + Antarctica reproduce the standard CLM4.5 glacier behavior.) + +- CLM can now keep its glacier areas and elevations in sync with CISM + when running with an evolving ice sheet. (However, in typical + configurations, the ice sheet geometry still remains fixed throughout + the run.) + +- The downscaling to elevation classes now includes downwelling longwave + radiation and partitioning of precipitation into rain vs. snow + (section :numref:`Multiple elevation class scheme`). + +- Other land units within the CISM domain undergo the same downscaling + as the glacier land unit, and surface mass balance is computed for the + natural vegetated land unit. This allows CLM to produce glacial + inception when running with an evolving ice sheet model. + +- There have also been substantial improvements to CLM's snow physics, + as described in other chapters of this document. + .. _Overview Glaciers: Overview @@ -48,7 +84,7 @@ CISM: #. We can use the sophisticated snow physics parameterization already in CLM instead of implementing a separate scheme for CISM. Any - improvements to the CLM are applied to ice sheets automatically. + improvements to CLM are applied to ice sheets automatically. #. The atmosphere model can respond during runtime to ice-sheet surface changes (even in the absence of two-way feedbacks with CISM). As @@ -78,13 +114,13 @@ the run. In these runs, CISM serves two roles in the system: SGLC then SMB will still be computed in CLM, but it won't be downscaled to a high-resolution ice sheet grid.) -However, it is also possible to run CESM with an evolving ice sheet. In -this case, CLM responds to CISM's evolution by adjusting the areas of -the glacier landunit and each elevation class within this landunit, as -well as the mean topographic heights of each elevation class. Thus, -CLM's glacier areas and elevations remain in sync with -CISM's. Conservation of mass and energy is done as for other landcover -change (see Chapter :numref:`rst_Transient Landcover Change`). +It is also possible to run CESM with an evolving ice sheet. In this +case, CLM responds to CISM's evolution by adjusting the areas of the +glacier land unit and each elevation class within this land unit, as well +as the mean topographic heights of each elevation class. Thus, CLM's +glacier areas and elevations remain in sync with CISM's. Conservation of +mass and energy is done as for other landcover change (see Chapter +:numref:`rst_Transient Landcover Change`). .. _Glacier regions: @@ -94,7 +130,7 @@ Glacier regions and their behaviors The world's glaciers and ice sheets are broken down into a number of different regions (four by default) that differ in three respects: -#. Whether the gridcell's glacier landunit contains: +#. Whether the gridcell's glacier land unit contains: a. Multiple elevation classes (section :numref:`Multiple elevation class scheme`) @@ -189,21 +225,21 @@ runaway sea ice growth in that region. Multiple elevation class scheme ------------------------------- -The glacier landunit contains multiple columns based on surface +The glacier land unit contains multiple columns based on surface elevation. These are known as elevation classes, and the land unit is -referred to as glacier\_mec. (As described in section :numref:`Glacier +referred to as *glacier\_mec*. (As described in section :numref:`Glacier regions`, some regions have only a single elevation class, but they are -still referred to as glacier\_mec landunits.) The default is to have 10 +still referred to as *glacier\_mec* land units.) The default is to have 10 elevation classes whose lower limits are 0, 200, 400, 700, 1000, 1300, 1600, 2000, 2500, and 3000 m. Each column is characterized by a fractional area and surface elevation that are read in during model initialization, and then possibly overridden by CISM as the run -progresses. Each glacier\_mec column within a grid cell has distinct ice +progresses. Each *glacier\_mec* column within a grid cell has distinct ice and snow temperatures, snow water content, surface fluxes, and SMB. The atmospheric surface temperature, potential temperature, specific humidity, density, and pressure are downscaled from the atmosphere's -mean grid cell elevation to the glacier\_mec column elevation using a +mean grid cell elevation to the *glacier\_mec* column elevation using a specified lapse rate (typically 6.0 deg/km) and an assumption of uniform relative humidity. Longwave radiation is downscaled by assuming a linear decrease in downwelling longwave radiation with increasing elevation @@ -231,9 +267,9 @@ In contrast to most CLM subgrid units, glacier\_mec columns can be active (i.e., have model calculations run there) even if their area is zero. These are known as "virtual" columns. This is done because the ice sheet model may require a SMB even for some grid cells where CLM does -not have glacier land units. Virtual columns do not affect energy -exchange between the land and the atmosphere, but are included for -potential forcing of CISM. +not have glacier land units. Virtual columns also facilitate glacial +advance and retreat in the two-way coupled case. Virtual columns do not +affect energy exchange between the land and the atmosphere. .. _Computation of the surface mass balance: @@ -245,7 +281,7 @@ associated runoff terms. The description here only applies to regions where glacial melt runs off and is replaced by ice, not to regions where glacial melt remains in place. Thus, by default, this only applies to Greenland and Antarctica, not to mountain glaciers elsewhere in the -world. (See also :numref:`Glacier regions`.) +world. (See also section :numref:`Glacier regions`.) The SMB of a glacier or ice sheet is the net annual accumulation/ablation of mass at the upper surface. Ablation is defined @@ -299,7 +335,7 @@ then CISM controls the fate of the snow capping mass in :math:`q_{ice,frz}` (e.g., eventually transporting it to lower elevations where it can be melted or calved). Since CISM will now own this mass, the snow capping flux does *not* contribute to any runoff -fluxes generated by CLM. +fluxes generated by CLM in this case. If *glc\_dyn\_runoff\_routing* is false, then CLM sends the snow capping flux as runoff, as a crude representation of ice calving (see also @@ -325,17 +361,18 @@ need is subtle, but can be understood with either of these explanations: for each unit of melt. For a given point in space or time, this reduction can result in -negative ice runoff. However, when integrated over time and space, for +negative ice runoff. However, when integrated over space and time, for an ice sheet that is near equilibrium, this just serves to decrease the -too-high positive ice runoff from snow capping. (This near-equilibrium -assumption is a key point in the treatment of snow capping with -*glc\_dyn\_runoff\_routing* false. For glaciers and ice sheets that -violate this assumption, either because they are far out of equilibrium -with the climate or because the model is being run for hundreds of -years, there are two ways to avoid the unrealistic ice runoff from snow -capping: by running with an evolving, two-way-coupled ice sheet or by -changing a glacier region's ice runoff behavior as described in section -:numref:`Glacier regions`.) +too-high positive ice runoff from snow capping. (The treatment of snow +capping with *glc\_dyn\_runoff\_routing* false is based on this +near-equilibrium assumption - i.e., that ice accumulation is roughly +balanced by :math:`calving + melt`, integrated across space and time. +For glaciers and ice sheets that violate this assumption, either because +they are far out of equilibrium with the climate or because the model is +being run for hundreds of years, there are two ways to avoid the +unrealistic ice runoff from snow capping: by running with an evolving, +two-way-coupled ice sheet or by changing a glacier region's ice runoff +behavior as described in section :numref:`Glacier regions`.) In regions where SMB is computed for glaciers, SMB is also computed for the natural vegetated land unit. Because there is no ice to melt in this From d572279fc56d35cbe9861fbdc65ebbd7c2713704 Mon Sep 17 00:00:00 2001 From: Katie Dagon Date: Thu, 1 Feb 2018 22:04:34 -0700 Subject: [PATCH 0142/1973] A few more typos --- doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 5 ++--- .../tech_note/Introduction/CLM50_Tech_Note_Introduction.rst | 2 +- .../Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 139aea37df..ddca9ed4ca 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -67,7 +67,6 @@ structure may coexist on a single column. All fluxes to and from the surface are defined at the PFT level, as are the vegetation state variables (e.g. vegetation temperature and canopy water storage). On the crop land unit, typically, different crop types can be represented on each - crop land unit column (see Chapter :numref:`rst_Crops and Irrigation` for details). In addition to state and flux variable data structures for conserved @@ -462,11 +461,11 @@ file defined in the namelist (see the CLM4.5 User’s Guide). Aerosol deposition rates were calculated in a transient 1850-2009 CAM simulation (at a resolution of 1.9x2.5x26L) with interactive chemistry (troposphere and stratosphere) driven by CCSM3 20\ :sup:`th` century -sea-surface temperatures and emissions (Lamarque et al. 2010) for +sea-surface temperatures and emissions (:ref:`Lamarque et al. 2010`) for short-lived gases and aerosols; observed concentrations were specified for methane, N\ :sub:`2`\ O, the ozone-depleting substances (CFCs) ,and CO\ :sub:`2`. The fluxes are used by the snow-related -parameterizations (Chapters :numref:`rst_Surface Albedos` and numref:`rst_Snow Hydrology`). +parameterizations (Chapters :numref:`rst_Surface Albedos` and :numref:`rst_Snow Hydrology`). :sup:`4`\ The nitrogen deposition rate is required by the biogeochemistry model when active and represents the total deposition of diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 0993904323..d08f3e87db 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -173,7 +173,7 @@ The purpose of this document is to fully describe the biogeophysical and biogeochemical parameterizations and numerical implementation of version 5.0 of the Community Land Model (CLM5.0). Scientific justification and evaluation of these parameterizations can be found in the referenced -scientific papers (:ref:`rst_References`). This document and the CLM5.0 +scientific papers (Chapter :numref:`rst_References`). This document and the CLM5.0 User’s Guide together provide the user with the scientific description and operating instructions for CLM. diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index 14ceeaa968..d9dee6581a 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -725,7 +725,7 @@ Subdivision The snow layers are subdivided when the layer thickness exceeds the prescribed maximum thickness :math:`\Delta z_{\max }` with lower and -upper bounds that depend on the number of snow layers (numref:`Table snow layer thickness`). For +upper bounds that depend on the number of snow layers (:numref:`Table snow layer thickness`). For example, if there is only one layer, then the maximum thickness of that layer is 0.03 m, however, if there is more than one layer, then the maximum thickness of the top layer is 0.02 m. Layers are checked From 8b21b15e923d953cfc7c5fe70c5febbdcbdf3fe0 Mon Sep 17 00:00:00 2001 From: Katie Dagon Date: Thu, 1 Feb 2018 22:29:09 -0700 Subject: [PATCH 0143/1973] Still trying to fix References link --- .../tech_note/Introduction/CLM50_Tech_Note_Introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index d08f3e87db..0993904323 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -173,7 +173,7 @@ The purpose of this document is to fully describe the biogeophysical and biogeochemical parameterizations and numerical implementation of version 5.0 of the Community Land Model (CLM5.0). Scientific justification and evaluation of these parameterizations can be found in the referenced -scientific papers (Chapter :numref:`rst_References`). This document and the CLM5.0 +scientific papers (:ref:`rst_References`). This document and the CLM5.0 User’s Guide together provide the user with the scientific description and operating instructions for CLM. From 9c1dc25e7fc189f2c353e47b900b1941adcecd19 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 2 Feb 2018 06:00:25 -0700 Subject: [PATCH 0144/1973] Minor edits from Bill Lipscomb --- .../Glacier/CLM50_Tech_Note_Glacier.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index 7c9d98bcd6..cb11d05c76 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -93,9 +93,9 @@ CISM: ice-sheet retreat on paleoclimate time scales. Without this feedback the atmosphere warms much less, and the retreat is delayed. -#. The improved SMB is available in CLM for all glaciated grid cells - (e.g., in the Alps, Rockies, Andes, and Himalayas), not just those - which are part of ice sheets. +#. The improved SMB is potentially available in CLM for all glaciated + grid cells (e.g., in the Alps, Rockies, Andes, and Himalayas), not + just those which are part of ice sheets. In typical runs, CISM is not evolving; CLM computes the SMB and sends it to CISM, but CISM's ice sheet geometry remains fixed over the course of @@ -104,8 +104,8 @@ the run. In these runs, CISM serves two roles in the system: #. Over the CISM domain (typically Greenland in CESM2), CISM dictates glacier areas and topographic elevations, overriding the values on CLM's surface dataset. CISM also dictates the elevation of - non-glacier land units in its domain, and atmospheric fields are - downscaled to non-glacier land units only in this domain. (So if you + non-glacier land units in its domain, and only in this domain are + atmospheric fields downscaled to non-glacier land units. (So if you run with a stub glacier model - SGLC - then glacier areas and elevations will be taken entirely from CLM's surface dataset, and no downscaling will be done over non-glacier land units.) @@ -266,10 +266,10 @@ CISM domain as consistent as possible. In contrast to most CLM subgrid units, glacier\_mec columns can be active (i.e., have model calculations run there) even if their area is zero. These are known as "virtual" columns. This is done because the ice -sheet model may require a SMB even for some grid cells where CLM does -not have glacier land units. Virtual columns also facilitate glacial -advance and retreat in the two-way coupled case. Virtual columns do not -affect energy exchange between the land and the atmosphere. +sheet model may require a SMB for some grid cells where CLM has zero +glacier area in that elevation range. Virtual columns also facilitate +glacial advance and retreat in the two-way coupled case. Virtual columns +do not affect energy exchange between the land and the atmosphere. .. _Computation of the surface mass balance: From 05a5eb7f2646bef8ab920bd1d47ae327ff4b737f Mon Sep 17 00:00:00 2001 From: Leo van Kampenhout Date: Fri, 2 Feb 2018 15:52:55 +0100 Subject: [PATCH 0145/1973] update portions of the Snow Hydrology chapter --- .../CLM50_Tech_Note_Snow_Hydrology.rst | 182 +++++++++++++----- 1 file changed, 137 insertions(+), 45 deletions(-) diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index d9dee6581a..44bf0ac9c7 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -37,7 +37,7 @@ the state variable is the mass of snow :math:`W_{sno}` (kg m\ :sup:`-2`). Section :numref:`Snow Covered Area Fraction` describes the calculation of fractional snow covered area, which is used in the surface albedo -calculation (Chapter :numref:`rst_Surface Albedos`) and thesurface flux +calculation (Chapter :numref:`rst_Surface Albedos`) and the surface flux calculations (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes`). The following two sections (:numref:`Ice Content` and :numref:`Water Content`) describe the ice and water content of the snow @@ -90,7 +90,12 @@ reset to zero. The depletion curve shape parameter is defined as The standard deviation of the elevation within a grid cell, :math:`\sigma _{topo}` , is calculated from a high resolution DEM (a -1km DEM is used for CLM). +1km DEM is used for CLM). +Note that *glacier\_mec* columns (section :numref:`Multiple elevation class scheme`) +are treated differently in this respect, as they already account for the +subgrid topography in a grid cell in their own way. +Therefore, in each *glacier\_mec* column very flat terrain is assumed, +implemented as :math:`N_{melt}=10`. .. _Ice Content: @@ -141,13 +146,20 @@ where \Delta z_{sno} =\frac{q_{grnd,\, ice} \Delta t}{f_{sno} \rho _{sno} } and :math:`\rho _{sno}` is the bulk density of newly fallen snow (kg -m\ :sup:`-3`) (:ref:`van Kampenhout et al. (2017) `, -:ref:`Anderson (1976) `) +m\ :sup:`-3`), which parameterized by a temperature-dependent and a +wind-dependent term: .. math:: - :label: 8.21 + :label: 8.21a - \rho_{sno} = + \rho_{sno} = \rho_{T} + \rho_{w}. + +The temperature dependent term is given by (:ref:`van Kampenhout et al. (2017) `) + +.. math:: + :label: 8.21b + + \rho_{T} = \left\{\begin{array}{lr} 50 + 1.7 \left(17\right)^{1.5} & \qquad T_{atm} >T_{f} +2 \ \\ 50+1.7 \left(T_{atm} -T_{f} + 15\right)^{1.5} & \qquad T_{f} - 15 < T_{atm} \le T_{f} + 2 \ \\ @@ -158,21 +170,21 @@ m\ :sup:`-3`) (:ref:`van Kampenhout et al. (2017) `, .. bifall(c) = -(50._r8/15._r8 + 0.0333_r8*15_r8)*(forc_t(c)-tfrz) - 0.0333_r8*(forc_t(c)-tfrz)**2 where :math:`T_{atm}` is the atmospheric temperature (K), and :math:`T_{f}` is -the freezing temperature of water (K) (:numref:`Table Physical Constants`). When -wind speed :math:`W_{atm}` is greater than 0.1 m :sub:`-1`, snow density +the freezing temperature of water (K) (:numref:`Table Physical Constants`). +When 10 m wind speed :math:`W_{atm}` is greater than 0.1 m\ :sup:`-1`, snow density increases due to wind-driven compaction according to -:ref:`(van Kampenhout et al. 2017) ` +:ref:`van Kampenhout et al. 2017 ` .. math:: - :label: 8.21b - - \Delta \rho_{sno} = 266.861 \left(\frac{1 + tanh(\frac{W_{atm}}{5})}{2}\right)^{8.8} + :label: 8.21c -where :math:`\Delta \rho_{sno}` (kg m\ :sup:`-3`) is the increase in snow -density relative to :eq:`8.21`. + \rho_{w} = 266.861 \left(\frac{1 + \tanh(\frac{W_{atm}}{5})}{2}\right)^{8.8} .. bifall(c) = bifall(c) + (266.861_r8 * ((1._r8 + TANH(forc_wind(g)/5.0_r8))/2._r8)**8.8_r8) +which is added to the temperature-dependent term (cf. equation :eq:`8.21a`). + + The mass of snow :math:`W_{sno}` is .. math:: @@ -213,9 +225,9 @@ content is reset to zero and the liquid water content :math:`w_{liq,\, snl+1}` is reduced by the amount required to bring :math:`w_{ice,\, snl+1}^{n+1}` up to zero. -The snow water equivalent :math:`W_{sno}` is capped to not exceed 1000 +The snow water equivalent :math:`W_{sno}` is capped to not exceed 10,000 kg m\ :sup:`-2`. If the addition of :math:`q_{frost}` were to -result in :math:`W_{sno} >1000` kg m\ :sup:`-2`, the frost term +result in :math:`W_{sno} > 10,000` kg m\ :sup:`-2`, the frost term :math:`q_{frost}` is instead added to the ice runoff term :math:`q_{snwcp,\, ice}` (section :numref:`Runoff from glaciers and snow-capped surfaces`). @@ -447,18 +459,22 @@ Snow Compaction Snow compaction is initiated after the soil hydrology calculations [surface runoff (section :numref:`Surface Runoff`), infiltration (section :numref:`Infiltration`), soil water (section :numref:`Soil Water`)] are -complete. Compaction of snow includes three types of processes: -destructive metamorphism of new snow (crystal breakdown due to wind or -thermodynamic stress); snow load or overburden (pressure); and melting -(changes in snow structure due to melt-freeze cycles plus changes in -crystals due to liquid water). The total fractional compaction rate for +complete. Currently, there are four processes included that lead to snow +compaction: + + #. destructive metamorphism of new snow (crystal breakdown due to wind or thermodynamic stress) + #. snow load or compaction by overburden pressure + #. melting (changes in snow structure due to melt-freeze cycles plus changes in crystals due to liquid water) + #. drifting snow compaction. + +The total fractional compaction rate for each snow layer :math:`C_{R,\, i}` (s\ :sup:`-1`) is the sum of the three compaction processes .. math:: :label: 8.41 - C_{R,\, i} =\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} =C_{R1,\, i} +C_{R2,\, i} +C_{R3,\, i} . + C_{R,\, i} =\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} =C_{R1,\, i} +C_{R2,\, i} +C_{R3,\, i} +C_{R4,\, i} . Compaction is not allowed if the layer is saturated @@ -469,8 +485,21 @@ Compaction is not allowed if the layer is saturated or if the ice content is below a minimum value (:math:`w_{ice,\, i} \le 0.1`). +The snow layer thickness after compaction is -Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` (s\ :sub:`-1`) is temperature dependent (:ref:`Anderson (1976) `) +.. math:: + :label: 8.50 + + \Delta z_{i}^{n+1} =\Delta z_{i}^{n} \left(1+C_{R,\, i} \Delta t\right). + + + +.. _Destructive metamorphism: + +Destructive metamorphism +'''''''''''''''''''''''' + +Compaction as a result of destructive metamorphism :math:`C_{R1,\; i}` (s\ :sup:`-1`) is temperature dependent (:ref:`Anderson (1976) `) .. math:: :label: 8.43 @@ -483,36 +512,34 @@ where :math:`c_{3} =2.777\times 10^{-6}` (s\ :sup:`-1`) is the fractional compa :label: 8.44 \begin{array}{lr} - c_{1} = 1 & \qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \le 100{\rm \; kg\; m}^{{\rm -3}} \\ - c_{1} = \exp \left[-0.046\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } -100\right)\right] & \qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } >100{\rm \; kg\; m}^{{\rm -3}} \\ + c_{1} = 1 & \qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \le 175{\rm \; kg\; m}^{{\rm -3}} \\ + c_{1} = \exp \left[-0.046\left(\frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } -175\right)\right] & \qquad \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } >175{\rm \; kg\; m}^{{\rm -3}} \\ c_{2} = 2 & \qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } >0.01 \\ c_{2} = 1 & \qquad \frac{w_{liq,\, i} }{f_{sno} \Delta z_{i} } \le 0.01 \end{array} +.. upper limit (upplim_destruct_metamorph) used to be 100 but was changed to 175 for CLM5 (Van Kampenhout et al., 2017) + where :math:`{w_{ice,\, i} \mathord{\left/ {\vphantom {w_{ice,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` and :math:`{w_{liq,\, i} \mathord{\left/ {\vphantom {w_{liq,\, i} \left(f_{sno} \Delta z_{i} \right)}} \right. \kern-\nulldelimiterspace} \left(f_{sno} \Delta z_{i} \right)}` are the bulk densities of liquid water and ice (kg m\ :sup:`-3`). -The compaction rate as a result of overburden :math:`C_{R2,\; i}` (s\ :sup:`-1`) is a linear function of the snow load pressure :math:`P_{s,\, i}` (kg m\ :sup:`-2`) (:ref:`Anderson (1976) `) -.. math:: - :label: 8.45 +.. _Overburden pressure compaction: - C_{R2,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{overburden} =-\frac{P_{s,\, i} }{\eta } +Overburden pressure compaction +'''''''''''''''''''''''''''''' -where :math:`\eta` is a viscosity coefficient (kg s m\ :sup:`-2`) that varies with density and temperature as +The compaction rate as a result of overburden :math:`C_{R2,\; i}` (s\ :sup:`-1`) is a linear function of the snow load pressure :math:`P_{s,\, i}` (kg m\ :sup:`-2`) (:ref:`Anderson (1976) `): .. math:: - :label: 8.46 + :label: 8.45 - \eta =\eta _{0} \exp \left[c_{5} \left(T_{f} -T_{i} \right)+c_{6} \frac{w_{ice,\, i} }{f_{sno} \Delta z_{i} } \right] + C_{R2,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{overburden} =-\frac{P_{s,\, i} }{\eta } -where :math:`\eta _{0} =9\times 10^{5}` kg s m\ :sup:`-2`, and -:math:`c_{5} =0.08` K\ :sup:`-1`, :math:`c_{6} =0.023` -m\ :sup:`3` kg\ :sup:`-1` are constants. The snow load -pressure :math:`P_{s,\, i}` is calculated for each layer as the sum of +The snow load pressure :math:`P_{s,\, i}` is calculated for each layer as the sum of the ice :math:`w_{ice,\, i}` and liquid water contents :math:`w_{liq,\, i}` of the layers above plus half the ice and liquid water contents of the layer being compacted @@ -522,6 +549,32 @@ water contents of the layer being compacted P_{s,\, i} =\frac{w_{ice,\, i} +w_{liq,\, i} }{2} +\sum _{j=snl+1}^{j=i-1}\left(w_{ice,\, j} +w_{liq,\, j} \right) . + +Variable :math:`\eta` in :eq:`8.45` is a viscosity coefficient (kg s m\ :sup:`-2`) that varies with density and +temperature as + +.. math:: + :label: 8.46 + + \eta = f_{1} f_{2} \eta_{0} \frac{\rho_{i}}{c_{\eta}} \exp \left[ a_{\eta} \left(T_{f} -T_{i} \right) + b_{\eta} \rho_{i} \right] + +with constant factors :math:`\eta _{0} = 7.62237 \times 10^{6}` kg s\ :sup:`-1` m\ :sup:`-2`, +:math:`a_{\eta} = 0.1` K\ :sup:`-1`, :math:`b_{\eta} = 0.023` m\ :sup:`-3` kg\ :sup:`-1`, +and :math:`c_{\eta} = 358` kg m\ :sup:`-3` (:ref:`van Kampenhout et al. (2017) `). +Further, factor :math:`f_1` accounts for the presence of liquid water (:ref:`Vionnet et al. (2012) `): + +.. math:: + :label: 8.46b + + f_{1} = \frac{1}{1+ 60 \frac{w_{\mathrm{liq},\, i}}{\rho_{\mathrm{liq}} \Delta z_{i} }}. + +Factor :math:`f_2` originally accounts for the presence of angular grains, but since grain shape is not modelled +:math:`f_2` is fixed to the value 4. + +.. _Compaction by melt: + +Compaction by melt +'''''''''''''''''' The compaction rate due to melting :math:`C_{R3,\; i}` (s\ :sup:`-1`) is taken to be the ratio of the change in snow ice mass after the melting to the mass before melting @@ -531,21 +584,60 @@ mass after the melting to the mass before melting C_{R3,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{melt} =-\frac{1}{\Delta t} \max \left(0,\frac{W_{sno,\, i}^{n} -W_{sno,\, i}^{n+1} }{W_{sno,\, i}^{n} } \right) and melting is identified during the phase change calculations (section -:numref:`Phase Change`). Because snow depth is defined as the average depth of the snow -covered area, the snow depth must also be updated for changes in -:math:`f_{sno}` . +:numref:`Phase Change`). + + +.. _Compaction by drifting snow: + +Compaction by drifting snow +''''''''''''''''''''''''''' +Crystal breaking by drifting snow leads to higher snow densities at the surface. +This process is particularly important on ice sheets, where destructive metamorphism is slow due to low temperatures +but high wind speeds (katabatic winds) are prevailing. +Therefore a drifting snow compaction parametrization was introduced, based on (:ref:`Vionnet et al. (2012) `). .. math:: :label: 8.49 - C_{R4,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{fsno} =-\frac{1}{\Delta t} \max \left(0,\frac{f_{sno,\, i}^{n} -f_{sno,\, i}^{n+1} }{f_{sno,\, i}^{n} } \right) + C_{R4,\, i} = \left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{drift} = - \frac{\rho_{\max} - \rho_i}{\tau_{i}}. -The snow layer thickness after compaction is then +Here, :math:`\rho_{\max} = 350` kg m\ :sup:`-3` is the upper limit to which this process is active, and +:math:`\tau_{i}` is a timescale which is depth dependent: .. math:: - :label: 8.50 + :label: 8.49b + + \tau_i = \frac{\tau}{\Gamma_{\mathrm{drift}}^i} \quad \mathrm{,} \:\; \Gamma^i_\mathrm{drift} = \max\left[ 0, S_\mathrm{I}^i \exp(-z_i / 0.1) \right]. + +Here, :math:`\tau` is a characteristic time scale for drifting snow compaction and is empirically set to 48 h, and +:math:`z_i` is a pseudo-depth which takes into account previous hardening of snow layers above the current layer: +:math:`z_i = \sum_j \Delta z_j \cdot (3.25 - S_\mathrm{I}^j)`. +The driftability index :math:`S_\mathrm{I}` reflects how well snow can be drifted and depends on the mobility of the snow +as well as the 10 m wind speed: + +.. math:: + :label: 8.49c + + \begin{array}{rcl} + S_\mathrm{I} & = & -2.868 \exp(-0.085 U) + 1 + M_{\mathrm{O}} \\ + M_\mathrm{O} & = & -0.069 + 0.66 F(\rho) + \end{array} + +The latter equation (for the mobility index :math:`M_\mathrm{O}`) is a simplification from the original paper +by removing the dependency on grain size and assuming spherical grains +(see :ref:`van Kampenhout et al. (2017) `). + +.. Because snow depth is defined as the average depth of the snow +.. covered area, the snow depth must also be updated for changes in +.. :math:`f_{sno}` . +.. +.. .. math:: +.. :label: 8.49 +.. +.. C_{R4,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{fsno} =-\frac{1}{\Delta t} \max \left(0,\frac{f_{sno,\, i}^{n} -f_{sno,\, i}^{n+1} }{f_{sno,\, i}^{n} } \right) + + - \Delta z_{i}^{n+1} =\Delta z_{i}^{n} \left(1+C_{R,\, i} \Delta t\right). .. _Snow Layer Combination and Subdivision: @@ -725,8 +817,8 @@ Subdivision The snow layers are subdivided when the layer thickness exceeds the prescribed maximum thickness :math:`\Delta z_{\max }` with lower and -upper bounds that depend on the number of snow layers (:numref:`Table snow layer thickness`). For -example, if there is only one layer, then the maximum thickness of that +upper bounds that depend on the number of snow layers (:numref:`Table snow layer thickness`). +For example, if there is only one layer, then the maximum thickness of that layer is 0.03 m, however, if there is more than one layer, then the maximum thickness of the top layer is 0.02 m. Layers are checked sequentially from top to bottom for this limit. If there is only one From bcf7f9e9a5a39ac71da73611ee7644be2b09c391 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 2 Feb 2018 08:50:37 -0700 Subject: [PATCH 0146/1973] Removed old references to wetland land unit --- doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst | 6 +++--- .../tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 2 +- doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst | 4 ++-- .../tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst | 4 ++-- .../Introduction/CLM50_Tech_Note_Introduction.rst | 8 ++++---- .../Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst | 4 ++-- .../Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst | 6 ------ .../CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 4 ++-- .../Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst | 6 +++--- .../CLM50_Tech_Note_Transient_Landcover.rst | 2 +- 10 files changed, 20 insertions(+), 26 deletions(-) diff --git a/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst b/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst index c40ac583f7..2b3064c921 100644 --- a/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst +++ b/doc/source/tech_note/Dust/CLM50_Tech_Note_Dust.rst @@ -34,10 +34,10 @@ mobilization :math:`f_{m}` is given by .. math:: :label: 29.2 - f_{m} =\left(1-f_{lake} -f_{wetl} \right)\left(1-f_{sno} \right)\left(1-f_{v} \right)\frac{w_{liq,1} }{w_{liq,1} +w_{ice,1} } + f_{m} =\left(1-f_{lake} \right)\left(1-f_{sno} \right)\left(1-f_{v} \right)\frac{w_{liq,1} }{w_{liq,1} +w_{ice,1} } -where :math:`f_{lake}` and :math:`f_{wetl}` and :math:`f_{sno}` -are the CLM grid cell fractions of lake and wetland (section +where :math:`f_{lake}` and :math:`f_{sno}` +are the CLM grid cell fractions of lake (section :numref:`Surface Data`) and snow cover (section :numref:`Snow Covered Area Fraction`), all ranging from zero to one. Not mentioned by :ref:`Zender et al. (2003)`, :math:`w_{liq,\, 1}` and diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index ddca9ed4ca..86b3bbb5a9 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -680,7 +680,7 @@ are obtained from a variety of sources described below. At the base spatial resolution of 0.05\ :sup:`o`, the percentage of each PFT is defined with respect to the vegetated portion of the grid -cell and the sum of the PFTs is 100%. The percent lake, wetland, +cell and the sum of the PFTs is 100%. The percent lake, glacier, and urban at their base resolution are specified with respect to the entire grid cell. The surface dataset creation routines re-adjust the PFT percentages to ensure that the sum of all land cover types in diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index fdd6873346..7abed081fd 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -583,7 +583,7 @@ Sensible and Latent Heat Fluxes for Non-Vegetated Surfaces Surfaces are considered non-vegetated for the surface flux calculations if leaf plus stem area index :math:`L+S<0.05` (section :numref:`Phenology and vegetation burial by snow`). By -definition, this includes bare soil, wetlands, and glaciers. The +definition, this includes bare soil and glaciers. The solution for lakes is described in Chapter :numref:`rst_Lake Model`. For these surfaces, the surface may be exposed to the atmosphere, snow covered, and/or surface water covered, so that the sensible heat flux :math:`H_{g}` (W @@ -785,7 +785,7 @@ The roughness lengths used to calculate :math:`r_{am}` , :math:`r_{ah}` , and :math:`r_{aw}` are :math:`z_{0m} =z_{0m,\, g}` , :math:`z_{0h} =z_{0h,\, g}` , and :math:`z_{0w} =z_{0w,\, g}` . The displacement height :math:`d=0`. The momentum roughness length is -:math:`z_{0m,\, g} =0.01` for soil, glaciers, and wetland, and +:math:`z_{0m,\, g} =0.01` for soil, glaciers, and :math:`z_{0m,\, g} =0.0024` for snow-covered surfaces (:math:`f_{sno} >0`). In general, :math:`z_{0m}` is different from :math:`z_{0h}` because the transfer of momentum is affected by pressure diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index b1153c3a5d..2bcd8f24b0 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -28,7 +28,7 @@ ET from vegetation (Chapter :numref:`rst_Momentum, Sensible Heat, and Latent Hea :math:`q_{h2osfc}` is runoff from surface water storage (section :numref:`Surface Runoff`), :math:`q_{drai}` is sub-surface drainage (section :numref:`Lateral Sub-surface Runoff`), :math:`q_{rgwl}` and :math:`q_{snwcp,ice}` are liquid and solid runoff -from glaciers, wetlands, and lakes, and runoff from other surface types +from glaciers and lakes, and runoff from other surface types due to snow capping (section :numref:`Runoff from glaciers and snow-capped surfaces`) (all in kg m\ :sup:`-2` s\ :sup:`-1`), :math:`N_{levsoi}` is the number of soil layers (note that hydrology calculations are only done over soil layers 1 to @@ -334,7 +334,7 @@ Surface Water Storage A surface water store has been added to the model to represent wetlands and small, sub-grid scale water bodies. As a result, the wetland land -unit has been removed. The state variables for surface water are the +unit has been removed as of CLM4.5. The state variables for surface water are the mass of water :math:`W_{sfc}` (kg m\ :sup:`-2`) and temperature :math:`T_{h2osfc}` (Chapter :numref:`rst_Soil and Snow Temperatures`). Surface water storage and outflow are diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 0993904323..3fc79b5e09 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -5,16 +5,16 @@ ***Coordinating Lead Authors*** -**David M. Lawrence, Rosie Fisher, Charles D. Koven, Keith W. Oleson, Sean Swenson** +**David Lawrence, Rosie Fisher, Charles Koven, Keith Oleson, Sean Swenson** ***Lead Authors*** -**Gordon Bonan, Bardan Ghimire, Leo van Kampenhout, Daniel Kennedy, Erik Kluzek, Peter J. Lawrence, Fang Li, Hongyi Li, Danica Lombardozzi, Yaqiong Lu, Justin Perket, William J. Riley, William Sacks, Mingjie Shi, Will Wieder, Chonggang Xu** +**Ben Andre, Gordon Bonan, Bardan Ghimire, Leo van Kampenhout, Daniel Kennedy, Erik Kluzek, Ryan Knox, Peter Lawrence, Fang Li, Hongyi Li, Danica Lombardozzi, Yaqiong Lu, Justin Perket, William Riley, William Sacks, Mingjie Shi, Will Wieder, Chonggang Xu** ***Contributing Authors*** -**Ashehad Ali, Ben Andre, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Ryan Knox, Jan Lenaerts, Sam Levis, -L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Andrew Slater, Zachary M. Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Mariana Vertenstein, Francis Vitt, Xubin Zeng** +**Ashehad Ali, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, +L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Jacqueline Shuman, Andrew Slater, Zachary Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Mariana Vertenstein, Francis Vitt, Xubin Zeng** The National Center for Atmospheric Research (NCAR) is operated by the diff --git a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst index cc32f0c1f3..5e09da13c5 100644 --- a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst +++ b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst @@ -288,8 +288,8 @@ emissivity of the ground is \varepsilon _{g} =\varepsilon _{soi} \left(1-f_{sno} \right)+\varepsilon _{sno} f_{sno} -where :math:`\varepsilon _{soi} =0.96` for soil, 0.97 for glacier, and -0.96 for wetland, :math:`\varepsilon _{sno} =0.97`, and :math:`f_{sno}` +where :math:`\varepsilon _{soi} =0.96` for soil, 0.97 for glacier, + :math:`\varepsilon _{sno} =0.97`, and :math:`f_{sno}` is the fraction of ground covered by snow (section :numref:`Snow Covered Area Fraction`). The vegetation emissivity is diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index 44bf0ac9c7..5cef68f618 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -204,12 +204,6 @@ The ice content of the top layer and the layer thickness are updated as \Delta z_{snl+1}^{n+1} =\Delta z_{snl+1}^{n} +\Delta z_{sno} . -Since wetlands are modeled as columns of water (no soil), snow is not -allowed to accumulate if the surface temperature is above freezing -(:math:`T_{g} >T_{f}` ). In this case, the incoming solid precipitation -is assigned to the runoff term :math:`q_{rgwl}` (section -:numref:`Runoff from glaciers and snow-capped surfaces`). - In the second step, after surface fluxes and snow/soil temperatures have been determined (Chapters :numref:`rst_Momentum, Sensible Heat, and Latent Heat Fluxes` and :numref:`rst_Soil and Snow Temperatures`), diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst index 10c00ae1e5..56b6adff3f 100644 --- a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst @@ -835,7 +835,7 @@ conductivity, :math:`K_{e,\, i}` is the Kersten number, saturation, and :math:`\lambda _{bedrock} =3` W m\ :sup:`-1` K\ :sup:`-1` is the thermal conductivity assumed for the deep ground layers (typical of saturated granitic rock; -:ref:`Clauser and Huenges 1995 `). For glaciers and wetlands, +:ref:`Clauser and Huenges 1995 `). For glaciers, .. math:: :label: 6.79 @@ -962,7 +962,7 @@ where :math:`c_{s,bedrock} =2\times 10^{6}` J m\ :sup:`-3` K\ :sup:`-1` is the heat capacity of bedrock and :math:`c_{s,om} =2.5\times 10^{6}` \ J m\ :sup:`-3` K\ :sup:`-1` (:ref:`Farouki 1981 `) is the heat capacity of organic -matter. For glaciers, wetlands, and snow +matter. For glaciers and snow .. math:: :label: 6.92 diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 55323eabf5..2770917358 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -523,14 +523,14 @@ where :math:`f_{sno}` is the fraction of the ground covered with snow (section :numref:`Snow Covered Area Fraction`). :math:`\alpha _{soi,\, \Lambda }^{\mu }` and -:math:`\alpha _{soi,\, \Lambda }` vary with glacier, lake, wetland, and +:math:`\alpha _{soi,\, \Lambda }` vary with glacier, lake, and soil surfaces. Glacier albedos are from :ref:`Paterson (1994) ` .. math:: \alpha _{soi,\, vis}^{\mu } =\alpha _{soi,\, vis} =0.6 .. math:: \alpha _{soi,\, nir}^{\mu } =\alpha _{soi,\, nir} =0.4. -Unfrozen lake and wetland albedos depend on the cosine of the solar +Unfrozen lake albedos depend on the cosine of the solar zenith angle :math:`\mu` .. math:: @@ -538,7 +538,7 @@ zenith angle :math:`\mu` \alpha _{soi,\, \Lambda }^{\mu } =\alpha _{soi,\, \Lambda } =0.05\left(\mu +0.15\right)^{-1} . -Frozen lake and wetland albedos are from NCAR LSM (:ref:`Bonan 1996 `) +Frozen lake albedos are from NCAR LSM (:ref:`Bonan 1996 `) .. math:: \alpha _{soi,\, vis}^{\mu } =\alpha _{soi,\, vis} =0.60 diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index 493cfb2829..ebb6d3762b 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -227,7 +227,7 @@ To represent the LUH2 transient LULCC dataset in CLM5, the annual fractional composition of the twelve land units specified in the dataset needs to be faithfully represented with a corresponding PFT and CFT mosaics of CLM. CLM5 represents the land surface as a hierarchy of sub-grid types: -glacier; lake; wetland; urban; vegetated land; and crop land. The vegetated land is +glacier; lake; urban; vegetated land; and crop land. The vegetated land is further divided into a mosaic of Plant Functional Types (PFTs), while the crop land is divided into a mosaic of Crop Functional Types (CFTs). From 8fb004c2bbfc5ddc3078f47ba6bf9cb47c916157 Mon Sep 17 00:00:00 2001 From: Leo van Kampenhout Date: Fri, 2 Feb 2018 17:06:21 +0100 Subject: [PATCH 0147/1973] add reference Vionnetetal 2012 --- .../tech_note/References/CLM50_Tech_Note_References.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 9e2277cdff..924e265b0a 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -2864,6 +2864,14 @@ paper presented at the Third International Conference/Workshop on Integrating GIS and Environmental Modeling, Santa Fe, New Mexico, 21–26 January, Natl. Cent. for Geogr. Inf. and Anal., Santa Barbara, Calif. +.. _Vionnetetal2012: + +|br| + +Vionnet, V., E. Brun, S. Morin, A. Boone, S. Faroux, P. Le Moigne, E. Martin, and J.-M. Willemet. +The Detailed Snowpack Scheme Crocus and Its Implementation in SURFEX v7.2. +GMD 5, no. 3 (May 24, 2012): 773-91. https://doi.org/10.5194/gmd-5-773-2012. + .. _Viovy2011: |br| From 9c0e0c5ce1976bf44c3a928fad5226d3519edf0b Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 2 Feb 2018 10:29:30 -0700 Subject: [PATCH 0148/1973] minor edits --- doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst | 1 + .../Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 2bcd8f24b0..fb387d25c2 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -78,6 +78,7 @@ respectively :label: 7.3b f_{pi,\,ice} =\alpha_{sno} \ \left\{1-\exp \left[-0.5\left(L+S\right)\right]\right\} \ , + and :math:`L` and :math:`S` are the exposed leaf and stem area index, respectively (section :numref:`Phenology and vegetation burial by snow`), and the :math:`\alpha`\'s scale the fractional area of a leaf that collects water diff --git a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst index 5e09da13c5..5e368456ba 100644 --- a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst +++ b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst @@ -288,8 +288,8 @@ emissivity of the ground is \varepsilon _{g} =\varepsilon _{soi} \left(1-f_{sno} \right)+\varepsilon _{sno} f_{sno} -where :math:`\varepsilon _{soi} =0.96` for soil, 0.97 for glacier, - :math:`\varepsilon _{sno} =0.97`, and :math:`f_{sno}` +where :math:`\varepsilon _{soi} =0.96` for soil, 0.97 for glacier, +:math:`\varepsilon _{sno} =0.97`, and :math:`f_{sno}` is the fraction of ground covered by snow (section :numref:`Snow Covered Area Fraction`). The vegetation emissivity is From 3c4d72891340a08bad4442343ddc0a8db6491fad Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 2 Feb 2018 11:24:45 -0700 Subject: [PATCH 0149/1973] fix snow hydrology compaction --- .../CLM50_Tech_Note_Snow_Hydrology.rst | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index 5cef68f618..d0022225b0 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -461,14 +461,13 @@ compaction: #. melting (changes in snow structure due to melt-freeze cycles plus changes in crystals due to liquid water) #. drifting snow compaction. -The total fractional compaction rate for -each snow layer :math:`C_{R,\, i}` (s\ :sup:`-1`) is the sum of the -three compaction processes +The total fractional compaction rate for each snow layer :math:`C_{R,\, i}` +(s\ :sup:`-1`) is the sum of multiple compaction processes .. math:: :label: 8.41 - C_{R,\, i} =\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} =C_{R1,\, i} +C_{R2,\, i} +C_{R3,\, i} +C_{R4,\, i} . + C_{R,\, i} =\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} =C_{R1,\, i} +C_{R2,\, i} +C_{R3,\, i} +C_{R4,\, i} +C_{R5,\, i} . Compaction is not allowed if the layer is saturated @@ -479,10 +478,11 @@ Compaction is not allowed if the layer is saturated or if the ice content is below a minimum value (:math:`w_{ice,\, i} \le 0.1`). + The snow layer thickness after compaction is .. math:: - :label: 8.50 + :label: 8.42b \Delta z_{i}^{n+1} =\Delta z_{i}^{n} \left(1+C_{R,\, i} \Delta t\right). @@ -575,11 +575,18 @@ mass after the melting to the mass before melting .. math:: :label: 8.48 - C_{R3,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{melt} =-\frac{1}{\Delta t} \max \left(0,\frac{W_{sno,\, i}^{n} -W_{sno,\, i}^{n+1} }{W_{sno,\, i}^{n} } \right) + C_{R3,\, i} = \left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{melt} + = -\frac{1}{\Delta t} \max \left(0,\frac{W_{sno,\, i}^{n} -W_{sno,\, i}^{n+1} }{W_{sno,\, i}^{n} } \right) and melting is identified during the phase change calculations (section -:numref:`Phase Change`). - +:numref:`Phase Change`). Because snow depth is defined as the average +depth of the snow covered area, the snow depth must also be updated for +changes in :math:`f_{sno}` when :math:`W_{sno}` has changed. + + .. math:: + :label: 8.49 + + C_{R4,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{fsno} =-\frac{1}{\Delta t} \max \left(0,\frac{f_{sno,\, i}^{n} -f_{sno,\, i}^{n+1} }{f_{sno,\, i}^{n} } \right) .. _Compaction by drifting snow: @@ -591,15 +598,15 @@ but high wind speeds (katabatic winds) are prevailing. Therefore a drifting snow compaction parametrization was introduced, based on (:ref:`Vionnet et al. (2012) `). .. math:: - :label: 8.49 + :label: 8.50 - C_{R4,\, i} = \left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{drift} = - \frac{\rho_{\max} - \rho_i}{\tau_{i}}. + C_{R5,\, i} = \left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{drift} = - \frac{\rho_{\max} - \rho_i}{\tau_{i}}. Here, :math:`\rho_{\max} = 350` kg m\ :sup:`-3` is the upper limit to which this process is active, and :math:`\tau_{i}` is a timescale which is depth dependent: .. math:: - :label: 8.49b + :label: 8.50b \tau_i = \frac{\tau}{\Gamma_{\mathrm{drift}}^i} \quad \mathrm{,} \:\; \Gamma^i_\mathrm{drift} = \max\left[ 0, S_\mathrm{I}^i \exp(-z_i / 0.1) \right]. @@ -610,7 +617,7 @@ The driftability index :math:`S_\mathrm{I}` reflects how well snow can be drifte as well as the 10 m wind speed: .. math:: - :label: 8.49c + :label: 8.50c \begin{array}{rcl} S_\mathrm{I} & = & -2.868 \exp(-0.085 U) + 1 + M_{\mathrm{O}} \\ @@ -621,18 +628,6 @@ The latter equation (for the mobility index :math:`M_\mathrm{O}`) is a simplific by removing the dependency on grain size and assuming spherical grains (see :ref:`van Kampenhout et al. (2017) `). -.. Because snow depth is defined as the average depth of the snow -.. covered area, the snow depth must also be updated for changes in -.. :math:`f_{sno}` . -.. -.. .. math:: -.. :label: 8.49 -.. -.. C_{R4,\, i} =\left[\frac{1}{\Delta z_{i} } \frac{\partial \Delta z_{i} }{\partial t} \right]_{fsno} =-\frac{1}{\Delta t} \max \left(0,\frac{f_{sno,\, i}^{n} -f_{sno,\, i}^{n+1} }{f_{sno,\, i}^{n} } \right) - - - - .. _Snow Layer Combination and Subdivision: Snow Layer Combination and Subdivision From 10d9daf47b4e0a53dd0df1436bcac0610750d888 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 2 Feb 2018 13:56:36 -0700 Subject: [PATCH 0150/1973] Fix errors and update html --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 44 +++++++++---------- .../tech_note/FUN/CLM50_Tech_Note_FUN.rst | 2 +- .../References/CLM50_Tech_Note_References.rst | 17 ++++--- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 4c3ae84448..8d44f55216 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -37,7 +37,7 @@ The implementation of the Ecosystem Demography concept within FATES links the surface flux and canopy physiology concepts in the CLM/E3SM with numerous additional developments necessary to accommodate the new model also documented here. These include a version of the SPITFIRE -(Spread and InTensity of Fire) model of :ref:`Thonicke et al. (2010)`, and an adoption of the concept of +(Spread and InTensity of Fire) model of :ref:`Thonicke et al. (2010)`, and an adoption of the concept of `Perfect Plasticity Approximation` approach of :ref:`Purves et al. 2008`, :ref:`Lichstein et al. 2011` and :ref:`Weng et al. 2014`, in accounting for the spatial arrangement of crowns. Novel algorithms accounting for @@ -1524,7 +1524,7 @@ canopy structure. This description in this section is largely repeated from the Oleson et al. CLM4.5 technical note but included here for comparison with its implementation in FATES. Photosynthesis in C3 plants is based on the model of :ref:`Farquhar 1980` as -modified by :ref:`Collatz et al. (1991)`. Photosynthetic assimilation +modified by :ref:`Collatz et al. (1991)`. Photosynthetic assimilation in C4 plants is based on the model of :ref:`Collatz et al. (1991)`. In both models, leaf photosynthesis, :math:`\textrm{gpp}` (:math:`\mu`\ mol CO\ :math:`_2` m\ :math:`^{-2}` s\ :math:`^{-1}`) is @@ -1703,7 +1703,7 @@ Variation in plant physiology with canopy depth Both :math:`V_{c,max}` and :math:`J_{max}` vary with vertical depth in the canopy on account of the well-documented reduction in canopy -nitrogen through the leaf profile, see :ref:`Bonan et al. 2012` for +nitrogen through the leaf profile, see :ref:`Bonan et al. 2012` for details). Thus, both :math:`V_{c,max}` and :math:`J_{max}` are indexed by by :math:`C_l`, :math:`ft` and :math:`z` according to the nitrogen decay coefficient :math:`K_n` and the amount of vegetation area shading @@ -2089,7 +2089,7 @@ the leaf at the vegetation temperature conductance (:math:`\mu`\ mol m\ :math:`^{-2}` s\ :math:`^{-1}`) when :math:`A` = 0 . Typical values are :math:`m_{ft}` = 9 for C\ :math:`_3` plants and :math:`m_{ft}` = 4 for C\ :math:`_4` plants ( -:ref:`Collatz et al. 1991`, :ref:`Collatz, 1992`, :ref:`Sellers et al 1996)`. +:ref:`Collatz et al. 1991`, :ref:`Collatz, 1992`, :ref:`Sellers et al 1996`). :ref:`Sellers et al. 1996` used :math:`b` = 10000 for C\ :math:`_3` plants and :math:`b` = 40000 for C\ :math:`_4` plants. Here, :math:`b` was chosen to give a maximum stomatal resistance of 20000 s @@ -3014,7 +3014,7 @@ given cohort triggers mortality. This parameter is needed to scale from individual-level mortality simulation to grid-cell average conditions. Mechanistic simulation of hydraulic failure is not undertaken on account -of it’s mechanistic complexity (see :ref:`McDowell et al. 2013`for +of it’s mechanistic complexity (see :ref:`McDowell et al. 2013` for details). Instead, we use a proxy for hydraulic failure induced mortality (:math:`M_{hf,coh}`) that uses a water potential threshold beyond mortality is triggered, such that the tolerance of low water @@ -3066,7 +3066,7 @@ Fire (SPITFIRE) [24]_The influence of fire on vegetation is estimated using the SPITFIRE model, which has been modified for use in ED following it’s original implementation in the LPJ-SPITFIRE model -(:ref:`Thonicke et al. 2010, :ref:`Pfeiffer et al. 2013`). This model as +(:ref:`Thonicke et al. 2010`, :ref:`Pfeiffer et al. 2013`). This model as described is substantially different from the existing CLM4.5 fire model :ref:`Li et al. 2012`, however, further developments are intended to increase the merging of SPITFIRE’s natural vegetation fire @@ -3096,7 +3096,7 @@ Coarse woody debris is classified into 1h, 10h, 100h, and 1000h fuels, defined by the order of magnitude of time required for fuel to lose (or gain) 63% of the difference between its current moisture content and the equilibrium moisture content under defined atmospheric conditions. -:ref:`Thonicke et al. 2010`. For the purposes of describing +:ref:`Thonicke et al. 2010`. For the purposes of describing the behaviour of fire, we introduce a new index 'fuel class' *fc*, the values of which correspond to each of the six possible fuel categories as follows. @@ -3127,7 +3127,7 @@ Nesterov Index Dead fuel moisture (:math:`\emph{moist}_{df,fc}`), and several other properties of fire behaviour, are a function of the ‘Nesterov Index’ (:math:`N_{I}`) which is an accumulation over time of a function of -temperature and humidity (Eqn 5, :ref:`Thonicke et al. 2010`). +temperature and humidity (Eqn 5, :ref:`Thonicke et al. 2010`). .. math:: N_{I}=\sum{\textrm{max}(T_{d}(T_{d}-D),0)} @@ -3174,7 +3174,7 @@ Live grass moisture Content The live grass fractional moisture content(\ :math:`\emph{moist}_{lg}`) is a function of the soil moisture content. (Equation B2 in -:ref:`Thonicke et al. 2010`) +:ref:`Thonicke et al. 2010`) .. math:: \emph{moist}_{lg}=\textrm{max}(0.0,\frac{10}{9}\theta_{30}-\frac{1}{9}) @@ -3244,7 +3244,7 @@ the fire *ros*\ :math:`_{f}` (nominally in the direction of the wind). :math:`e_{ps}` is the effective heating number (:math:`e^{\frac{-4.528}{F_{\sigma,patch}}}`). :math:`q_{ig}` is the heat of pre-ignition (:math:`581+2594F_{m}`). :math:`x_{i}` is the -propagating flux calculated as (see :ref:`Thonicke et al. 2010` +propagating flux calculated as (see :ref:`Thonicke et al. 2010` Appendix A). .. math:: @@ -3268,7 +3268,7 @@ surface-area-volume ratio :math:`F_{\sigma,patch}`: where :math:`p_{d}` is the particle density (513). :math:`i_{r}` is the reaction intensity, calculated using the following -set of expressions (from :ref:`Thonicke et al. 2010` Appendix A).: +set of expressions (from :ref:`Thonicke et al. 2010` Appendix A).: .. math:: @@ -3292,7 +3292,7 @@ Fuel Consumption The fuel consumption (fraction of biomass pools) of each dead biomass pool in the area affected by fire on a given day (:math:`f_{c,dead,fc}`) is a function of effective fuel moisture :math:`E_{moist,fc}` and size -class *fc* (Eqn B1, B4 and B5, :ref:`Thonicke et al. 2010`). The +class *fc* (Eqn B1, B4 and B5, :ref:`Thonicke et al. 2010`). The fraction of each fuel class that is consumed decreases as its moisture content relative to its moisture of extinction (:math:`E_{moist,fc}`) increases. @@ -3327,7 +3327,7 @@ Fire intensity at the front of the burning area (:math:`I_{surface}`, kW m\ :math:`^{-2}`) is a function of the total fuel consumed (:math:`f_{ctot,patch}`) and the rate of spread at the front of the fire, :math:`\mathit{ros}_{f}` (m min\ :math:`^{-1}`) (Eqn 15 -:ref:`Thonicke et al. 2010`) +:ref:`Thonicke et al. 2010`) .. math:: I_{surface}=\frac{0.001}{60}f_{energy} f_{ctot,patch}\mathit{ros}_{f} @@ -3341,7 +3341,7 @@ Fire Duration Fire duration is a function of the fire danger index with a maximum length of :math:`F_{dur,max}` (240 minutes in -:ref:`Thonicke et al. 2010` Eqn 14, derived from Canadian Forest +:ref:`Thonicke et al. 2010` Eqn 14, derived from Canadian Forest Fire Behaviour Predictions Systems) .. math:: D_{f}=\textrm{min}\Big(F_{dur,max},\frac{F_{dur,max}}{1+F_{dur,max}e^{-11.06fdi}}\Big) @@ -3370,14 +3370,14 @@ respectively). .. math:: f_{length}=F_{d}(ros_{b}+ros_{f}) :math:`ros_{b}` is a function of :math:`ros_{f}` and windspeed (Eqn 10 -:ref:`Thonicke et al. 2010`) +:ref:`Thonicke et al. 2010`) .. math:: ros_{b}=ros_{f}e^{-0.72W} The minor axis to major axis ratio :math:`l_{b}` of the ellipse is determined by the windspeed. If the windspeed (:math:`W`) is less than 16.67 ms\ :math:`^{-1}` then :math:`l_{b}=1`. Otherwise (Eqn 12 and 13, -:ref:`Thonicke et al. 2010`) +:ref:`Thonicke et al. 2010`) .. math:: l_{b}=\textrm{min}\Big(8,f_{tree}(1.0+8.729(1.0-e^{-0.108W})^{2.155})+(f_{grass}(1.1+3.6W^{0.0464}))\Big) @@ -3385,7 +3385,7 @@ determined by the windspeed. If the windspeed (:math:`W`) is less than surface covered by grass and trees respectively. The total area burned (:math:`A_{burn}` in m\ :math:`^{2}`) is therefore -(Eqn 11, :ref:`Thonicke et al. 2010`) +(Eqn 11, :ref:`Thonicke et al. 2010`) .. math:: A_{burn}=\frac{n_{f}\frac{3.1416}{4l_{b}}(f_{length}^{2}))}{10000} @@ -3397,7 +3397,7 @@ Crown Damage :math:`c_{k}` is the fraction of the crown which is consumed by the fire. This is calculated from scorch height :math:`H_{s}`, tree height :math:`h` and the crown fraction parameter :math:`F_{crown}` (Eqn 17 -:ref:`Thonicke et al. 2010`): +:ref:`Thonicke et al. 2010`): .. math:: @@ -3410,7 +3410,7 @@ fire. This is calculated from scorch height :math:`H_{s}`, tree height The scorch height :math:`H_{s}` (m) is a function of the fire intensity, following :ref:`Byram, 1959`, and is proportional to a plant functional type specific parameter :math:`\alpha_{s,ft}` (Eqn 16 -:ref:`Thonicke et al. 2010`): +:ref:`Thonicke et al. 2010`): .. math:: H_{s}=\sum_{FT=1}^{NPFT}{\alpha_{s,p}\cdot f_{biomass,ft}} I_{surface}^{0.667} @@ -3428,19 +3428,19 @@ cambial heating (minutes) (Eqn 8, :ref:`Peterson and Ryan 1986`): Bark thickness is a linear function of tree diameter :math:`dbh_{coh}`, defined by PFT-specific parameters :math:`\beta_{1,bt}` and -:math:`\beta_{2,bt}` (Eqn 21 :ref:`Thonicke et al. 2010`): +:math:`\beta_{2,bt}` (Eqn 21 :ref:`Thonicke et al. 2010`): .. math:: t_{b,coh}=\beta_{1,bt,ft}+\beta_{2,bt,ft}dbh_{coh} The critical time for cambial kill, :math:`\tau_{c}` (minutes) is given -as (Eqn 20 :ref:`Thonicke et al. 2010`): +as (Eqn 20 :ref:`Thonicke et al. 2010`): .. math:: \tau_{c}=2.9t_{b}^{2} The mortality rate caused by cambial heating :math:`\tau_{pm}` of trees within the area affected by fire is a function of the ratio between :math:`\tau_{l}` and :math:`\tau_{c}` (Eqn 19, -:ref:`Thonicke et al. 2010`): +:ref:`Thonicke et al. 2010`): .. math:: diff --git a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst index e10698858b..74dc2cf6dd 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -89,7 +89,7 @@ where m=1 pertains to the fraction of the PFT that is ecotmycorrhizal, as oppose Resolving N cost across simultaneous uptake streams -------------------------------------------------------- -The total cost of N uptake is calculated based on the assumption that carbon is partitioned to each stream in proportion to the inverse of the cost of uptake. So, more expensive pathways receive less carbon. Earlier versions of FUN :ref:`(Fisher et al., 2010))` utilized a scheme whereby plants only took up N from the cheapest pathway. :ref:`Brzostek et al. (2014)` introduced a scheme for the simultaneous uptake from different pathways. Here we calcualate a 'conductance' to N uptake (analagous to the inverse of the cost function conceptualized as a resistance term) :math:`N_{conductance}` ( gN/gC) as: +The total cost of N uptake is calculated based on the assumption that carbon is partitioned to each stream in proportion to the inverse of the cost of uptake. So, more expensive pathways receive less carbon. Earlier versions of FUN :ref:`(Fisher et al., 2010)`) utilized a scheme whereby plants only took up N from the cheapest pathway. :ref:`Brzostek et al. (2014)` introduced a scheme for the simultaneous uptake from different pathways. Here we calcualate a 'conductance' to N uptake (analagous to the inverse of the cost function conceptualized as a resistance term) :math:`N_{conductance}` ( gN/gC) as: .. math:: diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 924e265b0a..35c50dc038 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -1,13 +1,12 @@ .. _rst_References: +References +============== .. |br| raw:: latex \\ -References -============== - .. _Aberetal1990: |br| @@ -680,7 +679,7 @@ Fisher, J. B., S. Sitch, Y. Malhi, R. A. Fisher, C. Huntingford, and S.-Y. Tan, Fisher, R. A., S. Muszala, M. Verteinstein, P. Lawrence, C. Xu, N. G. McDowell, R. G. Knox, C. Koven, J. Holm, B. M. Rogers, A. Spessa, D. Lawrence, and G. Bonan, 2015: Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes, CLM4.5(ED). Geosci. Model Dev., 8: 3593-3619, doi:10.5194/gmd-8-3593-2015. -.. _Fisheretal2017: +.. _Fisheretal2018: |br| @@ -1701,7 +1700,7 @@ Mary, B., Fresneau, C., Morel, J.L. and Mariotti, A., 1993. C and N cycling during decomposition of root mucilage, roots and glucose in soil. Soil Biology and Biochemistry 25:1005-1014. -.. _mcdowell2013: +.. _Mcdowelletal2013: |br| @@ -2143,6 +2142,12 @@ millennial-scale deglaciation simulations. Geophys. Res. Lett. ** Purves, D.W. et al., 2008. Predicting and understanding forest dynamics using a simple tractable model. Proceedings of the National Academy of Sciences 105.44, pp. 17018-17022. +.. _Qianetal2006: + +|br| + +Qian, T et al., 2006. Simulation of global land surface conditions from 1948 to 2004: Part I: Forcing data and evaluations. J. Hydrometeorology 7, pp. 953-975. + .. _RamankuttyFoley1998: |br| @@ -2661,7 +2666,7 @@ fire disturbance for global vegetation dynamics: coupling fire into a Dynamic Global Vegetation Model. Global Ecology and Biogeography 10:661-667. -.. _thonicke2010: +.. _thonickeetal2010: |br| From 15c1d946d2b2e291606fcba917cf729a73c69924 Mon Sep 17 00:00:00 2001 From: Leo van Kampenhout Date: Mon, 5 Feb 2018 10:33:02 +0100 Subject: [PATCH 0151/1973] make snow doc consistent with code overburden compaction parameter c_eta = 450 kg/m3 in the code. This should have been 358 kg/m3 but it's too late to make that change now, this is post-CESM2. This commit updates the doc to make the doc consistent with the code. also see: https://github.com/ESCOMP/ctsm/pull/250 --- .../tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index d0022225b0..8d22a19bc9 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -554,7 +554,7 @@ temperature as with constant factors :math:`\eta _{0} = 7.62237 \times 10^{6}` kg s\ :sup:`-1` m\ :sup:`-2`, :math:`a_{\eta} = 0.1` K\ :sup:`-1`, :math:`b_{\eta} = 0.023` m\ :sup:`-3` kg\ :sup:`-1`, -and :math:`c_{\eta} = 358` kg m\ :sup:`-3` (:ref:`van Kampenhout et al. (2017) `). +and :math:`c_{\eta} = 450` kg m\ :sup:`-3` (:ref:`van Kampenhout et al. (2017) `). Further, factor :math:`f_1` accounts for the presence of liquid water (:ref:`Vionnet et al. (2012) `): .. math:: From f56195fa5cb5661b186fb69d36cbdf5b15b95cd1 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 6 Feb 2018 08:14:28 -0700 Subject: [PATCH 0152/1973] Edit authors and update html --- .../tech_note/Introduction/CLM50_Tech_Note_Introduction.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 3fc79b5e09..08bdf4ec29 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -5,7 +5,7 @@ ***Coordinating Lead Authors*** -**David Lawrence, Rosie Fisher, Charles Koven, Keith Oleson, Sean Swenson** +**David Lawrence, Rosie Fisher, Charles Koven, Keith Oleson, Sean Swenson, Mariana Vertenstein** ***Lead Authors*** @@ -14,7 +14,7 @@ ***Contributing Authors*** **Ashehad Ali, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, -L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Jacqueline Shuman, Andrew Slater, Zachary Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Mariana Vertenstein, Francis Vitt, Xubin Zeng** +L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Jacqueline Shuman, Andrew Slater, Zachary Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Francis Vitt, Xubin Zeng** The National Center for Atmospheric Research (NCAR) is operated by the From 4b60d25e5782c2392ef591b4cec7e27d74ad464d Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Thu, 8 Feb 2018 14:23:47 -0700 Subject: [PATCH 0153/1973] Add disclaimer for Users Guide --- doc/source/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index f7f35abeda..517f62e8eb 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -6,7 +6,7 @@ Welcome to the CLM documentation ================================== -This document has two major sections. +This document has two major sections. NOTE THAT THE USER'S GUIDE CURRENTLY PROVIDES INSTRUCTIONS FOR CLM4.5 AND IS A WORK IN PROGRESS. .. toctree:: :maxdepth: 2 From 9691ce7d15e40b938227f1763d952b4a0decee37 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 26 Feb 2018 09:11:44 -0700 Subject: [PATCH 0154/1973] Update Transient Landcover chapter for CLM5 Much of the information there was no longer correct for CLM5, so I have rewritten much of this chapter. Also, small tweaks to the Glacier chapter. --- .../Glacier/CLM50_Tech_Note_Glacier.rst | 11 +- .../CLM50_Tech_Note_Transient_Landcover.rst | 379 +++++++++++------- 2 files changed, 240 insertions(+), 150 deletions(-) diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index cb11d05c76..9f6c79ff98 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -144,9 +144,12 @@ different regions (four by default) that differ in three respects: #. Treatment of glacial melt water: a. Glacial melt water runs off and is replaced by ice, thus keeping - the column always frozen. This behavior is discussed in more - detail in section :numref:`Computation of the surface mass - balance`. + the column always frozen. In the absence of a dynamic ice sheet + model, this behavior implicitly assumes an infinite store of + glacial ice that can be melted (with appropriate adjustments made + to ensure mass and energy conservation). This behavior is + discussed in more detail in section :numref:`Computation of the + surface mass balance`. b. Glacial melt water remains in place until it refreezes - possibly remaining in place indefinitely if the glacier column is in a warm @@ -243,7 +246,7 @@ mean grid cell elevation to the *glacier\_mec* column elevation using a specified lapse rate (typically 6.0 deg/km) and an assumption of uniform relative humidity. Longwave radiation is downscaled by assuming a linear decrease in downwelling longwave radiation with increasing elevation -(0.032 W m :sup:`-2` m :sup:`-1`, limited to 0.5 - 1.5 times the +(0.032 W m\ :sup:`-2` m\ :sup:`-1`, limited to 0.5 - 1.5 times the gridcell mean value, then normalized to conserve gridcell total energy) :ref:`(Van Tricht et al., 2016)`. Total precipitation is partitioned into rain vs. snow as described in Chapter diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index ebb6d3762b..de7ef86173 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -1,156 +1,243 @@ .. _rst_Transient Landcover Change: Transient Land Use and Land Cover Change -=========================================== +======================================== CLM includes a treatment of mass and energy fluxes associated with -prescribed temporal land use and land cover change (LULCC). The model uses an annual -time series of the spatial distribution of the natural and crop land units -of each grid cell, in combination with the distribution of PFTs and CFTs -that exist in those land units. Additional land use is prescribed through annual -crop specific management of nitrogen fertilizer and irrigation described further -in Chapter 25, and through wood harvest on tree PFTs. For changes in the distributions -of natural and crop vegetation CLM diagnoses the change in area of the PFTs and CFTs -on January 1st of each model year and then performs mass and energy balance accounting -necessary to represent the expansion and contraction of the PFT and CFT areas. The -biogeophysical impacts of LULCC are simulated through changes -in surface properties which in turn impact the surface albedo, hydrology, and roughness -which then impact fluxes of energy, moisture and momentum to the atmosphere under the -altered properties. Additionally changes in energy and moisture associated with changes -in the natural and crop vegetation distribution are accounted for through small -fluxes to the atmosphere. The biogeochemical impacts of LULCC -are simulated through changes in CLM carbon pools and fluxes as shown in Figure xx.x and -described further in Chapter 16. - -Annual Transient Land Use and Land Cover Data and Time Interpolation ------------------------------------------------------------------------ - -The changes in area over time associated with changes in natural and crop -vegetation and the land use on that vegetation are prescribed through a forcing dataset, -referred to here as the *landuse.timeseries* dataset. The *landuse.timeseries* dataset -consists of an annual time series of global grids, where each annual time slice describes -the fractional area occupied by all PFTs and CFTs along with the nitrogen fertilizer and -irrigation fraction of each crop CFT, and the annual wood harvest applied to tree PFTs. -Changes in area of PFTs and CFTs are performed annually on the first time step of January -1st of the year. Fertilizer application, irrigation and wood harvest for each PFT and CFT -are performed at each model time step depending on rules from the crop and natural vegetation -phenology models. The irrigation fraction is set annually however fertlizer application and -wood harvest are set from a time-interpolation of the application rates from the two bracketing -annual time slices in the *landuse.timeseries* dataset. - -As a special case, when the time dimension of the *landuse.timeseries* dataset -starts at a later year than the current model time step, the first time -slice from the *landuse.timeseries* dataset is used to represent the current time -step PFT and CFT fractional area distributions. Similarly, when the time -dimension of the *landuse.timeseries* dataset stops at an earlier year than the -current model time step, the last time slice of the *landuse.timeseries* dataset is -used. Thus, the simulation will have invariant representations of PFT and CFT -distributions through time for the periods prior to and following the -time duration of the *landuse.timeseries* dataset, with transient PFT and CFT distributions -during the period covered by the *landuse.timeseries* dataset. - -The following equations capture this logic, where :math:`year_{cur}` is -the calendar year for the current timestep, -:math:`landuse.timeseries\_ year(1)` and -:math:`landuse.timeseries\_ year(nyears)` are the first and last calendar years in -the *landuse.timeseries* dataset, respectively, :math:`nyears` is the number of -years in the *landuse.timeseries* dataset, :math:`nt_{1}` and :math:`nt_{2}` -are the two bracketing years used in the interpolation -algorithm, and :math:`n` is the index value for the -:math:`landuse.timeseries\_ year` array corresponding to -:math:`landuse.timeseries\_ year(n)=year_{cur}` : - -.. math:: - :label: 26.1) - - nt_{1} =\left\{\begin{array}{l} {1\qquad {\rm for}\qquad year_{cur} 0` and decreases for -:math:`\Delta w_{p} <0`. +prescribed temporal land use and land cover change (LULCC). The model +uses an annual time series of the spatial distribution of the natural +and crop land units of each grid cell, in combination with the +distribution of PFTs and CFTs that exist in those land units. Additional +land use is prescribed through annual crop-specific management of +nitrogen fertilizer and irrigation (described further in +:numref:`rst_Crops and Irrigation`), and through wood harvest on tree +PFTs. For changes in the distributions of natural and crop vegetation, +CLM diagnoses the change in area of the PFTs and CFTs on January 1 of +each model year and then performs mass and energy balance accounting +necessary to represent the expansion and contraction of the PFT and CFT +areas. The biogeophysical impacts of LULCC are simulated through changes +in surface properties which in turn impact the surface albedo, +hydrology, and roughness which then impact fluxes of energy, moisture +and momentum to the atmosphere under the altered +properties. Additionally, changes in energy and moisture associated with +changes in the natural and crop vegetation distribution are accounted +for through small fluxes to the river and atmosphere. The biogeochemical +impacts of LULCC are simulated through changes in CLM carbon pools and +fluxes (see also Chapter :numref:`rst_CN Pools`). + +CLM can also respond to changes in ice sheet areas and elevations when +it is coupled to an evolving ice sheet model (in the CESM context, this +is the Community Ice Sheet Model, CISM; see also Chapter +:numref:`rst_Glaciers`). Conservation of water, energy, carbon and +nitrogen is handled similarly for glacier-vegetation transitions as for +natural vegetation-crop transitions. + +.. _Transient land use and land cover data: + +Annual Transient Land Use and Land Cover Data +--------------------------------------------- + +The changes in area over time associated with changes in natural and crop vegetation and +the land use on that vegetation are prescribed through a forcing dataset, referred to here +as the *landuse.timeseries* dataset. The *landuse.timeseries* dataset consists of an +annual time series of global grids, where each annual time slice describes the fractional +area occupied by all PFTs and CFTs along with the nitrogen fertilizer and irrigation +fraction of each crop CFT, and the annual wood harvest applied to tree PFTs. Changes in +area of PFTs and CFTs are performed annually on the first time step of January 1 of the +year. Wood harvest for each PFT is also performed on the first time step of the +year. Fertilizer application and irrigation for each CFT are performed at each model time +step depending on rules from the crop model. Fertilizer application rates are set +annually. The irrigation fraction is also set annually; irrigated crops are placed on +separate columns from their unirrigated counterparts, so changes in irrigated fraction +triggers the changes in subgrid areas discussed below (sections :numref:`Transient +landcover reconciling changes in area` and :numref:`Transient landcover mass and energy +conservation`). + +As a special case, when the time dimension of the *landuse.timeseries* dataset starts at a +later year than the current model time step, the first time slice from the +*landuse.timeseries* dataset is used to represent the current time step PFT and CFT +fractional area distributions. Similarly, when the time dimension of the +*landuse.timeseries* dataset stops at an earlier year than the current model time step, +the last time slice of the *landuse.timeseries* dataset is used. Thus, the simulation will +have invariant representations of PFT and CFT distributions through time for the periods +prior to and following the time duration of the *landuse.timeseries* dataset, with +transient PFT and CFT distributions during the period covered by the *landuse.timeseries* +dataset. + +.. _Transient landcover reconciling changes in area: + +Reconciling Changes in Area +--------------------------- + +In the first time step of January 1, changes in land unit weights can +potentially come from two sources: Changes in the area of the crop land +unit come from the *landuse.timeseries* dataset (section +:numref:`Transient land use and land cover data`), and changes in the +area of the glacier land unit come from the ice sheet model. The areas +of other land units are then adjusted so that the total land unit area +remains 100%. + +If the total land unit area of glaciers and crops has decreased, then +the natural vegetated landunit is increased to fill in the abandoned +land. If the total land unit area of glaciers and crops has increased, +then other land unit areas are decreased in a specified order until the +total is once again 100%. The order of decrease is: natural vegetation, +crop, urban medium density, urban high density, urban tall building +district, wetland, lake. + +These rules have two important implications: + +1. We always match CISM's glacier areas exactly, even if that means a + disagreement with prescribed crop areas. This is needed for + conservation when CISM is evolving in two-way-coupled mode. + +2. For land units other than crop, glacier and natural vegetation, their + areas can decrease (due to encroaching crops or glaciers), but can + never increase. So, for example, if a grid cell starts as 5% lake, + crops expand to fill the entire grid cell, then later crop area + decreases, the lake area will not return: instead, the abandoned + cropland will become entirely natural vegetation. + +For all levels of the subgrid hierarchy (land unit, column and patch), +we only track net changes in area, not gross transitions. So, for +example, if part of a gridcell experiences an increase in glacier area +while another part of that gridcell experiences an equal decrease in +glacier area (in the same glacier elevation class), CLM acts as if there +were no changes. As another example, consider a gridcell containing +natural vegetation, crop and glacier. If there is a decrease in glacier +area and an equal increase in crop area, CLM will assume that the crop +expands into the old glacier area, and nothing happened to the natural +vegetation area. A more realistic alternative would be that the crop +expanded into natural vegetation, and natural vegetation expanded into +glacier. The final areas will be correct in these cases, but the +adjustments of carbon and nitrogen states (section :numref:`Transient +landcover carbon and nitrogen conservation`) will be less accurate than what +would be obtained with a full tracking of gross transitions. + +.. _Transient landcover mass and energy conservation: Mass and Energy Conservation ---------------------------------- - -Mass conservation is maintained across PFT and CFT weight transitions by -summing up all the carbon, nitrogen, water and energy state variables to get the total vegetated land -units value before (:math:`W_{tot,1}` ) and after -(:math:`W_{tot,2}` ) the new PFT and CFT weights are calculated. Transitions are performed on above ground -variables first and then at the land unit level for below ground variables second. For example the hydrological -balance is calculated, -:math:`W_{tot,1}` is - -.. math:: - :label: 26.6) - - W_{tot,1} =W_{a} +W_{sno} +\sum _{i=1}^{N_{levgrnd} }\left(w_{liq,i} +w_{ice,i} \right) +\sum _{j=1}^{npft}\left(W_{can,j} wt_{j,1} \right) - -where :math:`W_{a}` is the aquifer water, :math:`W_{sno}` is the snow -water, :math:`w_{liq,i}` and :math:`w_{ice,i}` are the liquid and ice -soil water contents, :math:`W_{can,j}` is the canopy water content for -PFT and CFT :math:`j`, and :math:`wt_{j,1}` is the PFT or CFT weight for -:math:`j`. For the situation where PFT and CFT weights are changing, any difference -between :math:`W_{tot,1}` and :math:`W_{tot,2}` are due to -differences in the total canopy water before and after the PFT and CFT weight -change. To ensure conservation, the typically very small -difference between :math:`W_{tot,2}` and :math:`W_{tot,1}` is -subtracted from the grid cell runoff - -.. math:: - :label: 26.7) - - R_{liq} =R_{liq} +W_{tot,2} -W_{tot,1} . - -Total energy is unperturbed in this case and therefore an energy -conservation treatment is not required. Changing the area of natural and crop land units -in association with the change in PFTs and CFTs results in changes in the soil/snow columns -and land unit area. To address these additional changes, conservation of mass and -energy among the soil/snow columns and land units is performed as a secondary calculation once -all above ground PFT and CFT changes have been done. +---------------------------- + +.. _Transient landcover water and energy conservation: + +Water and Energy Conservation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When subgrid areas change, the water and energy states remain unchanged +on a per-area basis. This can lead to changes in the total gridcell +water and energy content. + +For example, consider a gridcell with two columns: column 1 has a water +mass of 1 kg m\ :sup:`-2` and column 2 has a water mass of 2 kg m\ +:sup:`-2` for a given water state variable, where these are expressed +per unit column area. If column 1 increases in area at the expense of +column 2, then column 1 will still have a water mass of 1 kg m\ +:sup:`-2`, but now expressed over the new column area. This results in a +decrease in the total gridcell water content. + +Water and energy are conserved by summing up the total water and energy +content of each gridcell before and after a change in area. Differences +in liquid and ice water content are balanced by liquid and ice runoff +terms, which can be either positive or negative. (Negative runoff is +effectively a withdrawal of water from the ocean.) Differences in energy +content are balanced by a sensible heat flux term, which again can be +either positive or negative. These balancing fluxes are spread evenly +throughout the following year. + +There is a special case when a given crop column type newly comes into +existence - for example, when temperate corn first comes into existence +in a gridcell. In this case, the column's below-ground temperature and +water states are copied from the natural vegetated column in its +gridcell, so that these state variables begin in a close-to-spun-up +state. Other state variables (most of which spin up relatively quickly) +begin at their cold start initialization values. This initialization is +not necessary for the two other land unit types that currently can +grow - natural vegetation and glacier: Those land unit types are always +active, even when they have zero area on the gridcell, so their state +variables will be spun up immediately when they come into +existence. After this initialization, the conservation code described +above takes effect. + +.. _Transient landcover carbon and nitrogen conservation: + +Carbon and Nitrogen Conservation +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Because of the long timescales involved with below-ground carbon and +nitrogen dynamics, it is more important that these state variables be +adjusted properly when subgrid areas change. Carbon and nitrogen +variables are adjusted with the following three-step process: + +(1) Patch-level (i.e., vegetation) state variables are adjusted for any + changes in patch areas; this may lead to fluxes into column-level + (i.e., soil) state variables + +(2) Column-level (i.e., soil) state variables are updated based on the + fluxes generated in (1) + +(3) Column-level (i.e., soil) state variables are adjusted for any + changes in column areas + +First, patch-level (i.e., vegetation) state variables are adjusted for +any changes in patch areas. This includes changes in column or land unit +areas, even if the relative proportions of each patch remain constant: +the relevant quantities are the patch weights relative to the +gridcell. + +For a patch that decreases in area, the carbon and nitrogen density on +the remaining patch area remains the same as before (i.e., expressed as +g per m\ :sup:`2` patch area). Because the area has decreased, this +represents a decrease in total carbon or nitrogen mass (i.e., expressed +as g per m\ :sup:`2` gridcell area). The lost mass meets a variety of +fates: some is immediately lost to the atmosphere, some is sent to +product pools (which are lost to the atmosphere over longer time +scales), and some is sent to litter pools. + +For a patch that increases in area, the carbon and nitrogen density on +the new patch area is decreased in order to conserve mass. This decrease +is basically proportional to the relative increase in patch +area. However, a small amount of seed carbon and nitrogen is added to +the leaf and dead stem pools in the new patch area. + +Next, column-level (i.e., soil) state variables are updated based on any +fluxes to soil pools due to decreases in patch areas. This step is +needed so that any lost vegetation carbon and nitrogen is conserved when +column areas are changing. + +Finally, column-level state variables are adjusted for any changes in +column areas. Similarly to patches, for a column that decreases in area, +the carbon and nitrogen density on the remaining column area remains the +same as before (i.e., expressed as g per m\ :sup:`2` column area). This +represents a decrease in total carbon or nitrogen mass on the gridcell, +and this lost mass is tracked for each gridcell. After these mass losses +are summed for all shrinking columns, they are distributed amongst the +growing columns in order to conserve mass. Thus, a growing column's new +carbon density will be a weighted sum of its original carbon density and +the carbon densities of all shrinking columns in its gridcell. + +This operation makes some simplifying assumptions. First, as described +in section :numref:`Transient landcover reconciling changes in area`, we +only track net area changes, not gross changes. Second, we assume that +growing columns all grow proportionally into each of the shrinking +columns. + +Non-vegetated land units (e.g., glacier) do not typically track soil +carbon and nitrogen. When columns from these land units initially +shrink, they are assumed to contribute zero carbon and +nitrogen. However, when they grow into previously-vegetated areas, they +store any pre-existing soil carbon and nitrogen from the shrinking +columns. This stored carbon and nitrogen will remain unchanged until the +column later shrinks, at which point it will contribute to the carbon +and nitrogen in the growing columns (exactly as would happen for a +vegetated column). + +In contrast to water and energy (section :numref:`Transient landcover +water and energy conservation`), no special treatment is needed for +carbon and nitrogen states in columns that newly come into +existence. The state of a new column is derived from a weighted average +of the states of shrinking columns. This behavior falls out from the +above general rules. Annual Transient Land Cover Dataset Development ---------------------------------------------------- From f61249dda1c63c0ef27c0b77f0a71d1bcfc3ed11 Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Tue, 27 Feb 2018 14:46:56 -0700 Subject: [PATCH 0155/1973] Initialize repository --- lilac/.gitignore | 14 ++++++++++++++ lilac/LICENSE | 34 ++++++++++++++++++++++++++++++++++ lilac/README.md | 4 ++++ 3 files changed, 52 insertions(+) create mode 100644 lilac/.gitignore create mode 100644 lilac/LICENSE create mode 100644 lilac/README.md diff --git a/lilac/.gitignore b/lilac/.gitignore new file mode 100644 index 0000000000..411de5d96e --- /dev/null +++ b/lilac/.gitignore @@ -0,0 +1,14 @@ +# directories that are checked out by the tool +cime/ +cime_config/ +components/ + +# generated local files +*.log + +# editor files +*~ +*.bak + +# generated python files +*.pyc diff --git a/lilac/LICENSE b/lilac/LICENSE new file mode 100644 index 0000000000..0ba25429ac --- /dev/null +++ b/lilac/LICENSE @@ -0,0 +1,34 @@ +Copyright (c) 2018, University Corporation for Atmospheric Research (UCAR) +All rights reserved. + +Developed by: + University Corporation for Atmospheric Research - National Center for Atmospheric Research + https://www2.cesm.ucar.edu/working-groups/sewg + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal with the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + - Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the documentation + and/or other materials provided with the distribution. + - Neither the names of [Name of Development Group, UCAR], + nor the names of its contributors may be used to endorse or promote + products derived from this Software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/lilac/README.md b/lilac/README.md new file mode 100644 index 0000000000..a7a62fb359 --- /dev/null +++ b/lilac/README.md @@ -0,0 +1,4 @@ +# LILAC + +LILAC, Lightweight Infrastructure for Land Atmosphere Coupling. + From 19af6730ef38e17ac804e5dbadc33d4e25e2bf2b Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Tue, 27 Feb 2018 14:48:13 -0700 Subject: [PATCH 0156/1973] Add clm-driver prototype source from Tony Craig. Add the clm-driver prototype source from Tony Craig based on svn https://svn-ccsm-models.cgd.ucar.edu/cesm1/exp_tags/cesm_clmdrv_150802 revision 88478 --- lilac/src/clmdrv.F90 | 394 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 394 insertions(+) create mode 100644 lilac/src/clmdrv.F90 diff --git a/lilac/src/clmdrv.F90 b/lilac/src/clmdrv.F90 new file mode 100644 index 0000000000..2fa6002069 --- /dev/null +++ b/lilac/src/clmdrv.F90 @@ -0,0 +1,394 @@ + +PROGRAM clmdrv + + use lnd_comp_mct , only: lnd_init_mct, lnd_run_mct, lnd_final_mct + use seq_flds_mod , only: & + seq_flds_x2l_states, seq_flds_x2l_fluxes, seq_flds_x2l_fields, & + seq_flds_l2x_states, seq_flds_l2x_fluxes, seq_flds_l2x_fields, & + seq_flds_dom_coord, seq_flds_dom_other, seq_flds_dom_fields + use seq_cdata_mod, only: seq_cdata + use seq_infodata_mod, only: seq_infodata_type, seq_infodata_putdata, seq_infodata_getdata + use shr_sys_mod , only: shr_sys_flush, shr_sys_abort + use shr_orb_mod , only: shr_orb_params + use shr_file_mod , only: shr_file_setlogunit, shr_file_setloglevel + use shr_pio_mod , only: shr_pio_init1, shr_pio_init2 + use mct_mod + use ESMF + + implicit none + +#include ! mpi library include file + + !----- Clocks ----- + type(ESMF_Clock) :: EClock ! Input synchronization clock + type(ESMF_Time) :: CurrTime, StartTime, StopTime + type(ESMF_TimeInterval) :: TimeStep + type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest + type(ESMF_Calendar),target :: Calendar + integer :: yy,mm,dd,sec + + !----- MPI/MCT ----- + integer :: mpicom_clmdrv ! local mpicom + integer :: ID_clmdrv ! mct ID + integer :: ncomps ! number of separate components for MCT + integer :: ntasks,mytask ! mpicom size and rank + integer :: global_comm ! copy of mpi_comm_world for pio + integer,allocatable :: comp_id(:) ! for pio init2 + logical,allocatable :: comp_iamin(:) ! for pio init2 + character(len=64),allocatable :: comp_name(:) ! for pio init2 + integer,allocatable :: comp_comm(:), comp_comm_iam(:) ! for pio_init2 + + !----- Land Coupling Data ----- + type(seq_cdata) :: cdata ! Input land-model driver data + type(seq_infodata_type),target :: infodata ! infodata type + type(mct_aVect) :: x2l, l2x ! land model import and export states + type(mct_gGrid),target :: dom_lnd ! domain data for clm + type(mct_gsMap),target :: gsmap_lnd ! gsmap data for clm + integer :: orb_iyear ! Orbital + real*8 :: orb_eccen, orb_obliq, orb_mvelp, orb_obliqr, orb_lambm0, orb_mvelpp + character(len=128) :: case_name, case_desc, model_version, hostname, username + character(len=128) :: start_type + logical :: brnch_retain_casename, single_column, atm_aero + real*8 :: scmlat, scmlon + integer :: idx_Sa_z, idx_Sa_u, idx_Sa_v, idx_Sa_tbot, idx_Sa_ptem, & + idx_Sa_shum, idx_Sa_pbot, idx_Faxa_rainc, idx_Faxa_rainl, & + idx_Faxa_snowc, idx_Faxa_snowl, idx_Faxa_lwdn, idx_Faxa_swndr, & + idx_Faxa_swvdr, idx_Faxa_swndf, idx_Faxa_swvdf + + !----- Atm Model ----- + integer :: atm_nx, atm_ny + integer :: gsize, lsize, gstart, gend ! domain decomp info + integer, allocatable :: gindex(:) ! domain decomp info + type(mct_aVect) :: x2l_a ! data for land on atm decomp + type(mct_aVect) :: l2x_a ! data from land on atm decomp + type(mct_gsMap) :: gsmap_atm ! gsmap data for atm + type(mct_rearr) :: rearr_atm2lnd ! rearranger for atm to land + type(mct_rearr) :: rearr_lnd2atm ! rearranger for land to atm + + !----- Other ----- + integer :: n,m ! counter + character(len=128) :: string ! temporary string + integer :: ierr, rc ! local error status + integer :: iunit = 250 ! clmdrv log unit number + integer :: sunit = 249 ! share log unit number + character(len=*),parameter :: subname = 'clmdrv' + + !---------------------------------------------- + + !---------------------------------------------- + !--- MPI/MCT --- + !---------------------------------------------- + + call MPI_Init(ierr) + call MPI_Comm_Dup(MPI_COMM_WORLD, mpicom_clmdrv, ierr) + call MPI_COMM_RANK(mpicom_clmdrv, mytask, ierr) + call MPI_COMM_SIZE(mpicom_clmdrv, ntasks, ierr) + + ncomps = 1 + ID_clmdrv = 1 + call mct_world_init(ncomps,MPI_COMM_WORLD,mpicom_clmdrv,ID_clmdrv) + + !---------------------------------------------- + !--- Log File and PIO --- + !---------------------------------------------- + + global_comm = MPI_COMM_WORLD + call shr_pio_init1(ncomps, 'pio_in', global_comm) + allocate(comp_id(ncomps),comp_name(ncomps),comp_iamin(ncomps),comp_comm(ncomps),comp_comm_iam(ncomps)) + do n = 1,ncomps + comp_id(n) = ID_clmdrv + comp_name(n) = 'LND' + comp_iamin(n) = .true. + comp_comm(n) = mpicom_clmdrv + comp_comm_iam(n) = mytask + enddo + call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) + deallocate(comp_id,comp_name,comp_iamin,comp_comm,comp_comm_iam) + + write(string,'(a,i4.4)') 'clmdrv.log.',mytask + open(iunit, file=trim(string)) + write(iunit,*) subname,' STARTING' + call shr_sys_flush(iunit) + + write(iunit,*) subname,' ntasks = ',ntasks + write(iunit,*) subname,' mytask = ',mytask + write(iunit,*) subname,' mct ID = ',ID_clmdrv + call shr_sys_flush(iunit) + call shr_file_setLogUnit(sunit) + call shr_file_setLogLevel(1) + + !---------------------------------------------- + !--- Clocks --- + !---------------------------------------------- + + call ESMF_Initialize(rc=rc) + Calendar = ESMF_CalendarCreate( name='clmdrv_NOLEAP', & + calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) + call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) + call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) + call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) + EClock = ESMF_ClockCreate(name='clmdrv_EClock', & + TimeStep=TimeStep, startTime=StartTime, & + RefTime=StartTime, stopTime=stopTime, rc=rc) + + EAlarm_stop = ESMF_AlarmCreate(name='seq_timemgr_alarm_stop' , & + clock=EClock, ringTime=StopTime, rc=rc) + EAlarm_rest = ESMF_AlarmCreate(name='seq_timemgr_alarm_restart', & + clock=EClock, ringTime=StopTime, rc=rc) + + call ESMF_TimeGet( StartTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=',yy,mm,dd,sec + call ESMF_TimeGet( StopTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=',yy,mm,dd,sec + call shr_sys_flush(iunit) + + !---------------------------------------------- + !--- Coupling --- + !---------------------------------------------- + + !--- set mpicom and cdata memory + cdata%name = 'cdata_clmdrv' + cdata%ID = ID_clmdrv + cdata%mpicom = mpicom_clmdrv + cdata%dom => dom_lnd + cdata%gsmap => gsmap_lnd + cdata%infodata => infodata + + !--- coupling fields + seq_flds_dom_coord='lat:lon' + seq_flds_dom_other='area:aream:mask:frac' + seq_flds_dom_fields=trim(seq_flds_dom_coord)//':'//trim(seq_flds_dom_other) + + seq_flds_x2l_states= 'Sa_z:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_pbot:Sg_icemask:Sg_icemask_coupled_fluxes' + seq_flds_x2l_fluxes= 'Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_lwdn:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Faxa_bcphidry:Faxa_bcphodry:Faxa_bcphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_ocphiwet:Faxa_dstwet1:Faxa_dstwet2:Faxa_dstwet3:Faxa_dstwet4:Faxa_dstdry1:Faxa_dstdry2:Faxa_dstdry3:Faxa_dstdry4:Flrr_flood:Flrr_volr' + seq_flds_x2l_fields= trim(seq_flds_x2l_states)//':'//trim(seq_flds_x2l_fluxes) + + seq_flds_l2x_states= 'Sl_avsdr:Sl_anidr:Sl_avsdf:Sl_anidf:Sl_tref:Sl_qref:Sl_t:Sl_fv:Sl_ram1:Sl_snowh:Sl_u10' + seq_flds_l2x_fluxes= 'Fall_swnet:Fall_taux:Fall_tauy:Fall_lat:Fall_sen:Fall_lwup:Fall_evap:Fall_flxdst1:Fall_flxdst2:Fall_flxdst3:Fall_flxdst4:Flrl_rofl:Flrl_rofi:Fall_voc001:Fall_voc002:Fall_voc003:Fall_voc004:Fall_voc005:Fall_voc006:Fall_voc007:Fall_voc008' + seq_flds_l2x_fields= trim(seq_flds_l2x_states)//':'//trim(seq_flds_l2x_fluxes) + + !--- set orbital params + orb_iyear = 1990 + call shr_orb_params(orb_iyear, orb_eccen, orb_obliq, orb_mvelp, & + orb_obliqr, orb_lambm0, orb_mvelpp, .true.) + call seq_infodata_putData(infodata, orb_eccen=orb_eccen, orb_mvelpp=orb_mvelpp, & + orb_lambm0=orb_lambm0, orb_obliqr=orb_obliqr ) + + !--- set case information + case_name = 'clmdrv' + case_desc = 'clmdrv with clm' + model_version = 'clmdrv0.1' + hostname = 'undefined' + username = 'undefined' + start_type = 'startup' + brnch_retain_casename = .true. + single_column = .false. + scmlat = 0.0 + scmlon = 0.0 + atm_aero = .true. + call seq_infodata_putData(infodata, case_name=case_name, & + case_desc=case_desc, single_column=single_column, & + scmlat=scmlat, scmlon=scmlon, & + brnch_retain_casename=brnch_retain_casename, & + start_type=start_type, model_version=model_version, & + hostname=hostname, username=username, & + atm_aero=atm_aero ) + + !---------------------------------------------- + !--- lnd_init --- + !---------------------------------------------- + + write(iunit,*) subname,' calling lnd_init_mct' + call shr_sys_flush(iunit) + call lnd_init_mct(Eclock, cdata, x2l, l2x) + + call diag_avect(l2x,mpicom_clmdrv,'l2x_init') + + idx_Sa_z = mct_avect_indexra(x2l,'Sa_z') + idx_Sa_u = mct_avect_indexra(x2l,'Sa_u') + idx_Sa_v = mct_avect_indexra(x2l,'Sa_v') + idx_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') + idx_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') + idx_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') + idx_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') + idx_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') + idx_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') + idx_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') + idx_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') + idx_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') + idx_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') + idx_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') + idx_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') + idx_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') + + !---------------------------------------------- + !--- atm and atm/lnd coupling init --- + !---------------------------------------------- + + ! set atm grid size to land grid size in this example. for a real + ! atmosphere model, the atm and land grids should agree at the outset. + call seq_infodata_getData(infodata,lnd_nx=atm_nx,lnd_ny=atm_ny) + + ! atm decomp + gstart = ((mytask * atm_nx * atm_ny) / ntasks) + 1 + gend = (((mytask+1) * atm_nx * atm_ny) / ntasks) + lsize = gend - gstart + 1 + gsize = atm_nx * atm_ny + allocate(gindex(lsize)) + do n = gstart, gend + m = n-gstart+1 + gindex(m) = n + end do + write(iunit,'(1x,2a,5i8)') subname,' atm decomp = ',mytask,gsize,lsize,gstart,gend + + ! initialize land grid on atm decomp + call mct_gsMap_init(gsmap_atm, gindex, mpicom_clmdrv, ID_clmdrv, lsize, gsize) + deallocate(gindex) + + ! initialize rearrangers between atm and land decomps + call mct_rearr_init(gsmap_atm, gsmap_lnd, mpicom_clmdrv, rearr_atm2lnd) + call mct_rearr_init(gsmap_lnd, gsmap_atm, mpicom_clmdrv, rearr_lnd2atm) + + ! initialize atm avects from land avects with atm lsize + call mct_avect_init(x2l_a, x2l, lsize) + call mct_avect_zero(x2l_a) + call mct_avect_init(l2x_a, l2x, lsize) + call mct_avect_zero(l2x_a) + + !---------------------------------------------- + !--- Time Loop --- + !---------------------------------------------- + + call ESMF_ClockGet(Eclock, currTime=CurrTime, rc=rc) + do while (CurrTime < StopTime) + call ESMF_ClockAdvance(EClock, rc=rc) + call ESMF_ClockGet(EClock, currTime=CurrTime, rc=rc) + call ESMF_TimeGet( CurrTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,' clmdrv ymds=',yy,mm,dd,sec + call shr_sys_flush(iunit) + + ! can manually override the alarms as needed + call ESMF_AlarmRingerOff(EAlarm_rest, rc=rc) + if (mod(dd,5)==0 .and. sec==0) call ESMF_AlarmRingerOn(EAlarm_rest,rc) + + ! set the coupling data that is sent to the land model, this is on atm decomp + ! this is just sample test data + x2l_a%rAttr(:,:) = 0.0 + x2l_a%rAttr(idx_Sa_z ,:) = 30.0 ! m + x2l_a%rAttr(idx_Sa_u ,:) = 0.0 ! m/s + x2l_a%rAttr(idx_Sa_v ,:) = 0.0 ! m/s + x2l_a%rAttr(idx_Sa_tbot ,:) = 280.0 ! degK + x2l_a%rAttr(idx_Sa_ptem ,:) = 280.0 ! degK + x2l_a%rAttr(idx_Sa_shum ,:) = 0.0004 ! kg/kg + x2l_a%rAttr(idx_Sa_pbot ,:) = 100100.0 ! Pa + x2l_a%rAttr(idx_Faxa_rainc,:) = 4.0e-8 ! kg/m2s + x2l_a%rAttr(idx_Faxa_rainl,:) = 3.0e-8 ! kg/m2s + x2l_a%rAttr(idx_Faxa_snowc,:) = 1.0e-8 ! kg/m2s + x2l_a%rAttr(idx_Faxa_snowl,:) = 2.0e-8 ! kg/m2s + x2l_a%rAttr(idx_Faxa_lwdn ,:) = 200.0 ! W/m2 + x2l_a%rAttr(idx_Faxa_swndr,:) = 100.0 ! W/m2 + x2l_a%rAttr(idx_Faxa_swvdr,:) = 90.0 ! W/m2 + x2l_a%rAttr(idx_Faxa_swndf,:) = 20.0 ! W/m2 + x2l_a%rAttr(idx_Faxa_swvdf,:) = 40.0 ! W/m2 + + ! rearrange data to land decomposition + call mct_rearr_rearrange(x2l_a, x2l, rearr_atm2lnd) + + ! diagnose + write(iunit,*) subname,' x2l fields: ',yy,mm,dd,sec +! call diag_avect(x2l_a,mpicom_clmdrv,'x2l_a') + call diag_avect(x2l,mpicom_clmdrv,'x2l') + + ! run clm + write(iunit,*) subname,' call lnd_run_mct',yy,mm,dd,sec + call lnd_run_mct(Eclock, cdata, x2l, l2x) + + ! rearrange data from land decomposition + call mct_rearr_rearrange(l2x, l2x_a, rearr_lnd2atm) + + ! diagnose + write(iunit,*) subname,' l2x fields: ',yy,mm,dd,sec + call diag_avect(l2x,mpicom_clmdrv,'l2x') +! call diag_avect(l2x_a,mpicom_clmdrv,'l2x_a') + enddo + + !---------------------------------------------- + !--- lnd_final --- + !---------------------------------------------- + + write(iunit,*) subname,' calling lnd_final_mct' + call shr_sys_flush(iunit) + call lnd_final_mct(Eclock, cdata, x2l, l2x) + + !---------------------------------------------- + !--- Done --- + !---------------------------------------------- + + write(iunit,*) subname,' DONE' + call shr_sys_flush(iunit) + call MPI_Finalize(ierr) + +contains +!====================================================================== + + SUBROUTINE diag_avect(av, mpicom, comment) + + use seq_infodata_mod + + implicit none + +! !INPUT/OUTPUT PARAMETERS: + + type(mct_aVect) , intent(in) :: av + integer , intent(in) :: mpicom + character(len=*), intent(in) :: comment + + !--- local --- + integer :: n,k ! counters + integer :: npts,nptsg ! number of local/global pts in AV + integer :: kflds ! number of fields in AV + real*8, pointer :: sumbuf (:) ! sum buffer + real*8, pointer :: sumbufg(:) ! sum buffer reduced + integer :: iam ! pe number + type(mct_string) :: mstring ! mct char type + character(len=128):: itemc ! string converted to char + + !----- formats ----- + character(*),parameter :: subName = '(diag_avect) ' + + !---------------------------------------------------------------- + + npts = mct_aVect_lsize(AV) + kflds = mct_aVect_nRattr(AV) + allocate(sumbuf(kflds),sumbufg(kflds)) + + sumbuf = 0.0 + + do k = 1,kflds + do n = 1,npts + sumbuf(k) = sumbuf(k) + (AV%rAttr(k,n)) + enddo + enddo + + call MPI_REDUCE(sumbuf,sumbufg,kflds,MPI_REAL8,MPI_SUM,0,mpicom,ierr) + call MPI_COMM_RANK(mpicom,iam,ierr) + + if (iam == 0) then + do k = 1,kflds + call mct_aVect_getRList(mstring,k,AV) + itemc = mct_string_toChar(mstring) + call mct_string_clean(mstring) + write(iunit,101) trim(comment),k,sumbufg(k),trim(itemc) + enddo + call shr_sys_flush(iunit) + endif + + deallocate(sumbuf,sumbufg) + +101 format('comm_diag ',a,1x,i3,es26.19,1x,a) + + end subroutine diag_avect + +!====================================================================== +end PROGRAM clmdrv + From 65886d1c40183e3e10f9c8e5b7b4c1c376b2307e Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Tue, 27 Feb 2018 19:06:36 -0700 Subject: [PATCH 0157/1973] Add dir-locals file for emacs f90 settings. --- lilac/src/.dir-locals.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lilac/src/.dir-locals.el diff --git a/lilac/src/.dir-locals.el b/lilac/src/.dir-locals.el new file mode 100644 index 0000000000..4edf085c03 --- /dev/null +++ b/lilac/src/.dir-locals.el @@ -0,0 +1,14 @@ +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") + +((f90-mode + (f90-program-indent . 3) + (f90-associate-indent . 3) + (f90-do-indent . 3) + (f90-if-indent . 3) + (f90-type-indent . 3) + (f90-program-indent . 3) + (f90-continuation-indent . 5) + (fill-column . 80) + (indent-tabs-mode))) + From 91f10b038a28ef2bbe1af5265c0064b076e06d28 Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Tue, 27 Feb 2018 19:07:00 -0700 Subject: [PATCH 0158/1973] Cleanup whitespace in clmdriver --- lilac/src/clmdrv.F90 | 727 +++++++++++++++++++++---------------------- 1 file changed, 363 insertions(+), 364 deletions(-) diff --git a/lilac/src/clmdrv.F90 b/lilac/src/clmdrv.F90 index 2fa6002069..9d798b59ff 100644 --- a/lilac/src/clmdrv.F90 +++ b/lilac/src/clmdrv.F90 @@ -1,394 +1,393 @@ - PROGRAM clmdrv - use lnd_comp_mct , only: lnd_init_mct, lnd_run_mct, lnd_final_mct - use seq_flds_mod , only: & + use lnd_comp_mct , only: lnd_init_mct, lnd_run_mct, lnd_final_mct + use seq_flds_mod , only: & seq_flds_x2l_states, seq_flds_x2l_fluxes, seq_flds_x2l_fields, & seq_flds_l2x_states, seq_flds_l2x_fluxes, seq_flds_l2x_fields, & seq_flds_dom_coord, seq_flds_dom_other, seq_flds_dom_fields - use seq_cdata_mod, only: seq_cdata - use seq_infodata_mod, only: seq_infodata_type, seq_infodata_putdata, seq_infodata_getdata - use shr_sys_mod , only: shr_sys_flush, shr_sys_abort - use shr_orb_mod , only: shr_orb_params - use shr_file_mod , only: shr_file_setlogunit, shr_file_setloglevel - use shr_pio_mod , only: shr_pio_init1, shr_pio_init2 - use mct_mod - use ESMF + use seq_cdata_mod, only: seq_cdata + use seq_infodata_mod, only: seq_infodata_type, seq_infodata_putdata, seq_infodata_getdata + use shr_sys_mod , only: shr_sys_flush, shr_sys_abort + use shr_orb_mod , only: shr_orb_params + use shr_file_mod , only: shr_file_setlogunit, shr_file_setloglevel + use shr_pio_mod , only: shr_pio_init1, shr_pio_init2 + use mct_mod + use ESMF - implicit none + implicit none #include ! mpi library include file - !----- Clocks ----- - type(ESMF_Clock) :: EClock ! Input synchronization clock - type(ESMF_Time) :: CurrTime, StartTime, StopTime - type(ESMF_TimeInterval) :: TimeStep - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar),target :: Calendar - integer :: yy,mm,dd,sec - - !----- MPI/MCT ----- - integer :: mpicom_clmdrv ! local mpicom - integer :: ID_clmdrv ! mct ID - integer :: ncomps ! number of separate components for MCT - integer :: ntasks,mytask ! mpicom size and rank - integer :: global_comm ! copy of mpi_comm_world for pio - integer,allocatable :: comp_id(:) ! for pio init2 - logical,allocatable :: comp_iamin(:) ! for pio init2 - character(len=64),allocatable :: comp_name(:) ! for pio init2 - integer,allocatable :: comp_comm(:), comp_comm_iam(:) ! for pio_init2 - - !----- Land Coupling Data ----- - type(seq_cdata) :: cdata ! Input land-model driver data - type(seq_infodata_type),target :: infodata ! infodata type - type(mct_aVect) :: x2l, l2x ! land model import and export states - type(mct_gGrid),target :: dom_lnd ! domain data for clm - type(mct_gsMap),target :: gsmap_lnd ! gsmap data for clm - integer :: orb_iyear ! Orbital - real*8 :: orb_eccen, orb_obliq, orb_mvelp, orb_obliqr, orb_lambm0, orb_mvelpp - character(len=128) :: case_name, case_desc, model_version, hostname, username - character(len=128) :: start_type - logical :: brnch_retain_casename, single_column, atm_aero - real*8 :: scmlat, scmlon - integer :: idx_Sa_z, idx_Sa_u, idx_Sa_v, idx_Sa_tbot, idx_Sa_ptem, & - idx_Sa_shum, idx_Sa_pbot, idx_Faxa_rainc, idx_Faxa_rainl, & - idx_Faxa_snowc, idx_Faxa_snowl, idx_Faxa_lwdn, idx_Faxa_swndr, & - idx_Faxa_swvdr, idx_Faxa_swndf, idx_Faxa_swvdf - - !----- Atm Model ----- - integer :: atm_nx, atm_ny - integer :: gsize, lsize, gstart, gend ! domain decomp info - integer, allocatable :: gindex(:) ! domain decomp info - type(mct_aVect) :: x2l_a ! data for land on atm decomp - type(mct_aVect) :: l2x_a ! data from land on atm decomp - type(mct_gsMap) :: gsmap_atm ! gsmap data for atm - type(mct_rearr) :: rearr_atm2lnd ! rearranger for atm to land - type(mct_rearr) :: rearr_lnd2atm ! rearranger for land to atm - - !----- Other ----- - integer :: n,m ! counter - character(len=128) :: string ! temporary string - integer :: ierr, rc ! local error status - integer :: iunit = 250 ! clmdrv log unit number - integer :: sunit = 249 ! share log unit number - character(len=*),parameter :: subname = 'clmdrv' - - !---------------------------------------------- - - !---------------------------------------------- - !--- MPI/MCT --- - !---------------------------------------------- - - call MPI_Init(ierr) - call MPI_Comm_Dup(MPI_COMM_WORLD, mpicom_clmdrv, ierr) - call MPI_COMM_RANK(mpicom_clmdrv, mytask, ierr) - call MPI_COMM_SIZE(mpicom_clmdrv, ntasks, ierr) - - ncomps = 1 - ID_clmdrv = 1 - call mct_world_init(ncomps,MPI_COMM_WORLD,mpicom_clmdrv,ID_clmdrv) - - !---------------------------------------------- - !--- Log File and PIO --- - !---------------------------------------------- - - global_comm = MPI_COMM_WORLD - call shr_pio_init1(ncomps, 'pio_in', global_comm) - allocate(comp_id(ncomps),comp_name(ncomps),comp_iamin(ncomps),comp_comm(ncomps),comp_comm_iam(ncomps)) - do n = 1,ncomps - comp_id(n) = ID_clmdrv - comp_name(n) = 'LND' - comp_iamin(n) = .true. - comp_comm(n) = mpicom_clmdrv - comp_comm_iam(n) = mytask - enddo - call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) - deallocate(comp_id,comp_name,comp_iamin,comp_comm,comp_comm_iam) - - write(string,'(a,i4.4)') 'clmdrv.log.',mytask - open(iunit, file=trim(string)) - write(iunit,*) subname,' STARTING' - call shr_sys_flush(iunit) - - write(iunit,*) subname,' ntasks = ',ntasks - write(iunit,*) subname,' mytask = ',mytask - write(iunit,*) subname,' mct ID = ',ID_clmdrv - call shr_sys_flush(iunit) - call shr_file_setLogUnit(sunit) - call shr_file_setLogLevel(1) - - !---------------------------------------------- - !--- Clocks --- - !---------------------------------------------- - - call ESMF_Initialize(rc=rc) - Calendar = ESMF_CalendarCreate( name='clmdrv_NOLEAP', & - calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) - call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) - EClock = ESMF_ClockCreate(name='clmdrv_EClock', & - TimeStep=TimeStep, startTime=StartTime, & - RefTime=StartTime, stopTime=stopTime, rc=rc) - - EAlarm_stop = ESMF_AlarmCreate(name='seq_timemgr_alarm_stop' , & - clock=EClock, ringTime=StopTime, rc=rc) - EAlarm_rest = ESMF_AlarmCreate(name='seq_timemgr_alarm_restart', & - clock=EClock, ringTime=StopTime, rc=rc) - - call ESMF_TimeGet( StartTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=',yy,mm,dd,sec - call ESMF_TimeGet( StopTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=',yy,mm,dd,sec - call shr_sys_flush(iunit) - - !---------------------------------------------- - !--- Coupling --- - !---------------------------------------------- - - !--- set mpicom and cdata memory - cdata%name = 'cdata_clmdrv' - cdata%ID = ID_clmdrv - cdata%mpicom = mpicom_clmdrv - cdata%dom => dom_lnd - cdata%gsmap => gsmap_lnd - cdata%infodata => infodata - - !--- coupling fields - seq_flds_dom_coord='lat:lon' - seq_flds_dom_other='area:aream:mask:frac' - seq_flds_dom_fields=trim(seq_flds_dom_coord)//':'//trim(seq_flds_dom_other) - - seq_flds_x2l_states= 'Sa_z:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_pbot:Sg_icemask:Sg_icemask_coupled_fluxes' - seq_flds_x2l_fluxes= 'Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_lwdn:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Faxa_bcphidry:Faxa_bcphodry:Faxa_bcphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_ocphiwet:Faxa_dstwet1:Faxa_dstwet2:Faxa_dstwet3:Faxa_dstwet4:Faxa_dstdry1:Faxa_dstdry2:Faxa_dstdry3:Faxa_dstdry4:Flrr_flood:Flrr_volr' - seq_flds_x2l_fields= trim(seq_flds_x2l_states)//':'//trim(seq_flds_x2l_fluxes) - - seq_flds_l2x_states= 'Sl_avsdr:Sl_anidr:Sl_avsdf:Sl_anidf:Sl_tref:Sl_qref:Sl_t:Sl_fv:Sl_ram1:Sl_snowh:Sl_u10' - seq_flds_l2x_fluxes= 'Fall_swnet:Fall_taux:Fall_tauy:Fall_lat:Fall_sen:Fall_lwup:Fall_evap:Fall_flxdst1:Fall_flxdst2:Fall_flxdst3:Fall_flxdst4:Flrl_rofl:Flrl_rofi:Fall_voc001:Fall_voc002:Fall_voc003:Fall_voc004:Fall_voc005:Fall_voc006:Fall_voc007:Fall_voc008' - seq_flds_l2x_fields= trim(seq_flds_l2x_states)//':'//trim(seq_flds_l2x_fluxes) - - !--- set orbital params - orb_iyear = 1990 - call shr_orb_params(orb_iyear, orb_eccen, orb_obliq, orb_mvelp, & - orb_obliqr, orb_lambm0, orb_mvelpp, .true.) - call seq_infodata_putData(infodata, orb_eccen=orb_eccen, orb_mvelpp=orb_mvelpp, & - orb_lambm0=orb_lambm0, orb_obliqr=orb_obliqr ) - - !--- set case information - case_name = 'clmdrv' - case_desc = 'clmdrv with clm' - model_version = 'clmdrv0.1' - hostname = 'undefined' - username = 'undefined' - start_type = 'startup' - brnch_retain_casename = .true. - single_column = .false. - scmlat = 0.0 - scmlon = 0.0 - atm_aero = .true. - call seq_infodata_putData(infodata, case_name=case_name, & - case_desc=case_desc, single_column=single_column, & - scmlat=scmlat, scmlon=scmlon, & - brnch_retain_casename=brnch_retain_casename, & - start_type=start_type, model_version=model_version, & - hostname=hostname, username=username, & - atm_aero=atm_aero ) - - !---------------------------------------------- - !--- lnd_init --- - !---------------------------------------------- - - write(iunit,*) subname,' calling lnd_init_mct' - call shr_sys_flush(iunit) - call lnd_init_mct(Eclock, cdata, x2l, l2x) - - call diag_avect(l2x,mpicom_clmdrv,'l2x_init') - - idx_Sa_z = mct_avect_indexra(x2l,'Sa_z') - idx_Sa_u = mct_avect_indexra(x2l,'Sa_u') - idx_Sa_v = mct_avect_indexra(x2l,'Sa_v') - idx_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') - idx_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') - idx_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') - idx_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') - idx_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') - idx_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') - idx_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') - idx_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') - idx_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') - idx_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') - idx_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') - idx_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') - idx_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') - - !---------------------------------------------- - !--- atm and atm/lnd coupling init --- - !---------------------------------------------- - - ! set atm grid size to land grid size in this example. for a real - ! atmosphere model, the atm and land grids should agree at the outset. - call seq_infodata_getData(infodata,lnd_nx=atm_nx,lnd_ny=atm_ny) - - ! atm decomp - gstart = ((mytask * atm_nx * atm_ny) / ntasks) + 1 - gend = (((mytask+1) * atm_nx * atm_ny) / ntasks) - lsize = gend - gstart + 1 - gsize = atm_nx * atm_ny - allocate(gindex(lsize)) - do n = gstart, gend - m = n-gstart+1 - gindex(m) = n - end do - write(iunit,'(1x,2a,5i8)') subname,' atm decomp = ',mytask,gsize,lsize,gstart,gend - - ! initialize land grid on atm decomp - call mct_gsMap_init(gsmap_atm, gindex, mpicom_clmdrv, ID_clmdrv, lsize, gsize) - deallocate(gindex) - - ! initialize rearrangers between atm and land decomps - call mct_rearr_init(gsmap_atm, gsmap_lnd, mpicom_clmdrv, rearr_atm2lnd) - call mct_rearr_init(gsmap_lnd, gsmap_atm, mpicom_clmdrv, rearr_lnd2atm) - - ! initialize atm avects from land avects with atm lsize - call mct_avect_init(x2l_a, x2l, lsize) - call mct_avect_zero(x2l_a) - call mct_avect_init(l2x_a, l2x, lsize) - call mct_avect_zero(l2x_a) - - !---------------------------------------------- - !--- Time Loop --- - !---------------------------------------------- - - call ESMF_ClockGet(Eclock, currTime=CurrTime, rc=rc) - do while (CurrTime < StopTime) - call ESMF_ClockAdvance(EClock, rc=rc) - call ESMF_ClockGet(EClock, currTime=CurrTime, rc=rc) - call ESMF_TimeGet( CurrTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' clmdrv ymds=',yy,mm,dd,sec - call shr_sys_flush(iunit) - - ! can manually override the alarms as needed - call ESMF_AlarmRingerOff(EAlarm_rest, rc=rc) - if (mod(dd,5)==0 .and. sec==0) call ESMF_AlarmRingerOn(EAlarm_rest,rc) - - ! set the coupling data that is sent to the land model, this is on atm decomp - ! this is just sample test data - x2l_a%rAttr(:,:) = 0.0 - x2l_a%rAttr(idx_Sa_z ,:) = 30.0 ! m - x2l_a%rAttr(idx_Sa_u ,:) = 0.0 ! m/s - x2l_a%rAttr(idx_Sa_v ,:) = 0.0 ! m/s - x2l_a%rAttr(idx_Sa_tbot ,:) = 280.0 ! degK - x2l_a%rAttr(idx_Sa_ptem ,:) = 280.0 ! degK - x2l_a%rAttr(idx_Sa_shum ,:) = 0.0004 ! kg/kg - x2l_a%rAttr(idx_Sa_pbot ,:) = 100100.0 ! Pa - x2l_a%rAttr(idx_Faxa_rainc,:) = 4.0e-8 ! kg/m2s - x2l_a%rAttr(idx_Faxa_rainl,:) = 3.0e-8 ! kg/m2s - x2l_a%rAttr(idx_Faxa_snowc,:) = 1.0e-8 ! kg/m2s - x2l_a%rAttr(idx_Faxa_snowl,:) = 2.0e-8 ! kg/m2s - x2l_a%rAttr(idx_Faxa_lwdn ,:) = 200.0 ! W/m2 - x2l_a%rAttr(idx_Faxa_swndr,:) = 100.0 ! W/m2 - x2l_a%rAttr(idx_Faxa_swvdr,:) = 90.0 ! W/m2 - x2l_a%rAttr(idx_Faxa_swndf,:) = 20.0 ! W/m2 - x2l_a%rAttr(idx_Faxa_swvdf,:) = 40.0 ! W/m2 - - ! rearrange data to land decomposition - call mct_rearr_rearrange(x2l_a, x2l, rearr_atm2lnd) - - ! diagnose - write(iunit,*) subname,' x2l fields: ',yy,mm,dd,sec -! call diag_avect(x2l_a,mpicom_clmdrv,'x2l_a') - call diag_avect(x2l,mpicom_clmdrv,'x2l') - - ! run clm - write(iunit,*) subname,' call lnd_run_mct',yy,mm,dd,sec - call lnd_run_mct(Eclock, cdata, x2l, l2x) - - ! rearrange data from land decomposition - call mct_rearr_rearrange(l2x, l2x_a, rearr_lnd2atm) - - ! diagnose - write(iunit,*) subname,' l2x fields: ',yy,mm,dd,sec - call diag_avect(l2x,mpicom_clmdrv,'l2x') -! call diag_avect(l2x_a,mpicom_clmdrv,'l2x_a') - enddo - - !---------------------------------------------- - !--- lnd_final --- - !---------------------------------------------- - - write(iunit,*) subname,' calling lnd_final_mct' - call shr_sys_flush(iunit) - call lnd_final_mct(Eclock, cdata, x2l, l2x) - - !---------------------------------------------- - !--- Done --- - !---------------------------------------------- - - write(iunit,*) subname,' DONE' - call shr_sys_flush(iunit) - call MPI_Finalize(ierr) + !----- Clocks ----- + type(ESMF_Clock) :: EClock ! Input synchronization clock + type(ESMF_Time) :: CurrTime, StartTime, StopTime + type(ESMF_TimeInterval) :: TimeStep + type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest + type(ESMF_Calendar),target :: Calendar + integer :: yy,mm,dd,sec + + !----- MPI/MCT ----- + integer :: mpicom_clmdrv ! local mpicom + integer :: ID_clmdrv ! mct ID + integer :: ncomps ! number of separate components for MCT + integer :: ntasks,mytask ! mpicom size and rank + integer :: global_comm ! copy of mpi_comm_world for pio + integer,allocatable :: comp_id(:) ! for pio init2 + logical,allocatable :: comp_iamin(:) ! for pio init2 + character(len=64),allocatable :: comp_name(:) ! for pio init2 + integer,allocatable :: comp_comm(:), comp_comm_iam(:) ! for pio_init2 + + !----- Land Coupling Data ----- + type(seq_cdata) :: cdata ! Input land-model driver data + type(seq_infodata_type),target :: infodata ! infodata type + type(mct_aVect) :: x2l, l2x ! land model import and export states + type(mct_gGrid),target :: dom_lnd ! domain data for clm + type(mct_gsMap),target :: gsmap_lnd ! gsmap data for clm + integer :: orb_iyear ! Orbital + real*8 :: orb_eccen, orb_obliq, orb_mvelp, orb_obliqr, orb_lambm0, orb_mvelpp + character(len=128) :: case_name, case_desc, model_version, hostname, username + character(len=128) :: start_type + logical :: brnch_retain_casename, single_column, atm_aero + real*8 :: scmlat, scmlon + integer :: idx_Sa_z, idx_Sa_u, idx_Sa_v, idx_Sa_tbot, idx_Sa_ptem, & + idx_Sa_shum, idx_Sa_pbot, idx_Faxa_rainc, idx_Faxa_rainl, & + idx_Faxa_snowc, idx_Faxa_snowl, idx_Faxa_lwdn, idx_Faxa_swndr, & + idx_Faxa_swvdr, idx_Faxa_swndf, idx_Faxa_swvdf + + !----- Atm Model ----- + integer :: atm_nx, atm_ny + integer :: gsize, lsize, gstart, gend ! domain decomp info + integer, allocatable :: gindex(:) ! domain decomp info + type(mct_aVect) :: x2l_a ! data for land on atm decomp + type(mct_aVect) :: l2x_a ! data from land on atm decomp + type(mct_gsMap) :: gsmap_atm ! gsmap data for atm + type(mct_rearr) :: rearr_atm2lnd ! rearranger for atm to land + type(mct_rearr) :: rearr_lnd2atm ! rearranger for land to atm + + !----- Other ----- + integer :: n,m ! counter + character(len=128) :: string ! temporary string + integer :: ierr, rc ! local error status + integer :: iunit = 250 ! clmdrv log unit number + integer :: sunit = 249 ! share log unit number + character(len=*),parameter :: subname = 'clmdrv' + + !---------------------------------------------- + + !---------------------------------------------- + !--- MPI/MCT --- + !---------------------------------------------- + + call MPI_Init(ierr) + call MPI_Comm_Dup(MPI_COMM_WORLD, mpicom_clmdrv, ierr) + call MPI_COMM_RANK(mpicom_clmdrv, mytask, ierr) + call MPI_COMM_SIZE(mpicom_clmdrv, ntasks, ierr) + + ncomps = 1 + ID_clmdrv = 1 + call mct_world_init(ncomps,MPI_COMM_WORLD,mpicom_clmdrv,ID_clmdrv) + + !---------------------------------------------- + !--- Log File and PIO --- + !---------------------------------------------- + + global_comm = MPI_COMM_WORLD + call shr_pio_init1(ncomps, 'pio_in', global_comm) + allocate(comp_id(ncomps),comp_name(ncomps),comp_iamin(ncomps),comp_comm(ncomps),comp_comm_iam(ncomps)) + do n = 1,ncomps + comp_id(n) = ID_clmdrv + comp_name(n) = 'LND' + comp_iamin(n) = .true. + comp_comm(n) = mpicom_clmdrv + comp_comm_iam(n) = mytask + enddo + call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) + deallocate(comp_id,comp_name,comp_iamin,comp_comm,comp_comm_iam) + + write(string,'(a,i4.4)') 'clmdrv.log.',mytask + open(iunit, file=trim(string)) + write(iunit,*) subname,' STARTING' + call shr_sys_flush(iunit) + + write(iunit,*) subname,' ntasks = ',ntasks + write(iunit,*) subname,' mytask = ',mytask + write(iunit,*) subname,' mct ID = ',ID_clmdrv + call shr_sys_flush(iunit) + call shr_file_setLogUnit(sunit) + call shr_file_setLogLevel(1) + + !---------------------------------------------- + !--- Clocks --- + !---------------------------------------------- + + call ESMF_Initialize(rc=rc) + Calendar = ESMF_CalendarCreate( name='clmdrv_NOLEAP', & + calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) + call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) + call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) + call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) + EClock = ESMF_ClockCreate(name='clmdrv_EClock', & + TimeStep=TimeStep, startTime=StartTime, & + RefTime=StartTime, stopTime=stopTime, rc=rc) + + EAlarm_stop = ESMF_AlarmCreate(name='seq_timemgr_alarm_stop' , & + clock=EClock, ringTime=StopTime, rc=rc) + EAlarm_rest = ESMF_AlarmCreate(name='seq_timemgr_alarm_restart', & + clock=EClock, ringTime=StopTime, rc=rc) + + call ESMF_TimeGet( StartTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=',yy,mm,dd,sec + call ESMF_TimeGet( StopTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=',yy,mm,dd,sec + call shr_sys_flush(iunit) + + !---------------------------------------------- + !--- Coupling --- + !---------------------------------------------- + + !--- set mpicom and cdata memory + cdata%name = 'cdata_clmdrv' + cdata%ID = ID_clmdrv + cdata%mpicom = mpicom_clmdrv + cdata%dom => dom_lnd + cdata%gsmap => gsmap_lnd + cdata%infodata => infodata + + !--- coupling fields + seq_flds_dom_coord='lat:lon' + seq_flds_dom_other='area:aream:mask:frac' + seq_flds_dom_fields=trim(seq_flds_dom_coord)//':'//trim(seq_flds_dom_other) + + seq_flds_x2l_states= 'Sa_z:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_pbot:Sg_icemask:Sg_icemask_coupled_fluxes' + seq_flds_x2l_fluxes= 'Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_lwdn:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Faxa_bcphidry:Faxa_bcphodry:Faxa_bcphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_ocphiwet:Faxa_dstwet1:Faxa_dstwet2:Faxa_dstwet3:Faxa_dstwet4:Faxa_dstdry1:Faxa_dstdry2:Faxa_dstdry3:Faxa_dstdry4:Flrr_flood:Flrr_volr' + seq_flds_x2l_fields= trim(seq_flds_x2l_states)//':'//trim(seq_flds_x2l_fluxes) + + seq_flds_l2x_states= 'Sl_avsdr:Sl_anidr:Sl_avsdf:Sl_anidf:Sl_tref:Sl_qref:Sl_t:Sl_fv:Sl_ram1:Sl_snowh:Sl_u10' + seq_flds_l2x_fluxes= 'Fall_swnet:Fall_taux:Fall_tauy:Fall_lat:Fall_sen:Fall_lwup:Fall_evap:Fall_flxdst1:Fall_flxdst2:Fall_flxdst3:Fall_flxdst4:Flrl_rofl:Flrl_rofi:Fall_voc001:Fall_voc002:Fall_voc003:Fall_voc004:Fall_voc005:Fall_voc006:Fall_voc007:Fall_voc008' + seq_flds_l2x_fields= trim(seq_flds_l2x_states)//':'//trim(seq_flds_l2x_fluxes) + + !--- set orbital params + orb_iyear = 1990 + call shr_orb_params(orb_iyear, orb_eccen, orb_obliq, orb_mvelp, & + orb_obliqr, orb_lambm0, orb_mvelpp, .true.) + call seq_infodata_putData(infodata, orb_eccen=orb_eccen, orb_mvelpp=orb_mvelpp, & + orb_lambm0=orb_lambm0, orb_obliqr=orb_obliqr ) + + !--- set case information + case_name = 'clmdrv' + case_desc = 'clmdrv with clm' + model_version = 'clmdrv0.1' + hostname = 'undefined' + username = 'undefined' + start_type = 'startup' + brnch_retain_casename = .true. + single_column = .false. + scmlat = 0.0 + scmlon = 0.0 + atm_aero = .true. + call seq_infodata_putData(infodata, case_name=case_name, & + case_desc=case_desc, single_column=single_column, & + scmlat=scmlat, scmlon=scmlon, & + brnch_retain_casename=brnch_retain_casename, & + start_type=start_type, model_version=model_version, & + hostname=hostname, username=username, & + atm_aero=atm_aero ) + + !---------------------------------------------- + !--- lnd_init --- + !---------------------------------------------- + + write(iunit,*) subname,' calling lnd_init_mct' + call shr_sys_flush(iunit) + call lnd_init_mct(Eclock, cdata, x2l, l2x) + + call diag_avect(l2x,mpicom_clmdrv,'l2x_init') + + idx_Sa_z = mct_avect_indexra(x2l,'Sa_z') + idx_Sa_u = mct_avect_indexra(x2l,'Sa_u') + idx_Sa_v = mct_avect_indexra(x2l,'Sa_v') + idx_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') + idx_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') + idx_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') + idx_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') + idx_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') + idx_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') + idx_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') + idx_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') + idx_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') + idx_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') + idx_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') + idx_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') + idx_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') + + !---------------------------------------------- + !--- atm and atm/lnd coupling init --- + !---------------------------------------------- + + ! set atm grid size to land grid size in this example. for a real + ! atmosphere model, the atm and land grids should agree at the outset. + call seq_infodata_getData(infodata,lnd_nx=atm_nx,lnd_ny=atm_ny) + + ! atm decomp + gstart = ((mytask * atm_nx * atm_ny) / ntasks) + 1 + gend = (((mytask+1) * atm_nx * atm_ny) / ntasks) + lsize = gend - gstart + 1 + gsize = atm_nx * atm_ny + allocate(gindex(lsize)) + do n = gstart, gend + m = n-gstart+1 + gindex(m) = n + end do + write(iunit,'(1x,2a,5i8)') subname,' atm decomp = ',mytask,gsize,lsize,gstart,gend + + ! initialize land grid on atm decomp + call mct_gsMap_init(gsmap_atm, gindex, mpicom_clmdrv, ID_clmdrv, lsize, gsize) + deallocate(gindex) + + ! initialize rearrangers between atm and land decomps + call mct_rearr_init(gsmap_atm, gsmap_lnd, mpicom_clmdrv, rearr_atm2lnd) + call mct_rearr_init(gsmap_lnd, gsmap_atm, mpicom_clmdrv, rearr_lnd2atm) + + ! initialize atm avects from land avects with atm lsize + call mct_avect_init(x2l_a, x2l, lsize) + call mct_avect_zero(x2l_a) + call mct_avect_init(l2x_a, l2x, lsize) + call mct_avect_zero(l2x_a) + + !---------------------------------------------- + !--- Time Loop --- + !---------------------------------------------- + + call ESMF_ClockGet(Eclock, currTime=CurrTime, rc=rc) + do while (CurrTime < StopTime) + call ESMF_ClockAdvance(EClock, rc=rc) + call ESMF_ClockGet(EClock, currTime=CurrTime, rc=rc) + call ESMF_TimeGet( CurrTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,' clmdrv ymds=',yy,mm,dd,sec + call shr_sys_flush(iunit) + + ! can manually override the alarms as needed + call ESMF_AlarmRingerOff(EAlarm_rest, rc=rc) + if (mod(dd,5)==0 .and. sec==0) call ESMF_AlarmRingerOn(EAlarm_rest,rc) + + ! set the coupling data that is sent to the land model, this is on atm decomp + ! this is just sample test data + x2l_a%rAttr(:,:) = 0.0 + x2l_a%rAttr(idx_Sa_z ,:) = 30.0 ! m + x2l_a%rAttr(idx_Sa_u ,:) = 0.0 ! m/s + x2l_a%rAttr(idx_Sa_v ,:) = 0.0 ! m/s + x2l_a%rAttr(idx_Sa_tbot ,:) = 280.0 ! degK + x2l_a%rAttr(idx_Sa_ptem ,:) = 280.0 ! degK + x2l_a%rAttr(idx_Sa_shum ,:) = 0.0004 ! kg/kg + x2l_a%rAttr(idx_Sa_pbot ,:) = 100100.0 ! Pa + x2l_a%rAttr(idx_Faxa_rainc,:) = 4.0e-8 ! kg/m2s + x2l_a%rAttr(idx_Faxa_rainl,:) = 3.0e-8 ! kg/m2s + x2l_a%rAttr(idx_Faxa_snowc,:) = 1.0e-8 ! kg/m2s + x2l_a%rAttr(idx_Faxa_snowl,:) = 2.0e-8 ! kg/m2s + x2l_a%rAttr(idx_Faxa_lwdn ,:) = 200.0 ! W/m2 + x2l_a%rAttr(idx_Faxa_swndr,:) = 100.0 ! W/m2 + x2l_a%rAttr(idx_Faxa_swvdr,:) = 90.0 ! W/m2 + x2l_a%rAttr(idx_Faxa_swndf,:) = 20.0 ! W/m2 + x2l_a%rAttr(idx_Faxa_swvdf,:) = 40.0 ! W/m2 + + ! rearrange data to land decomposition + call mct_rearr_rearrange(x2l_a, x2l, rearr_atm2lnd) + + ! diagnose + write(iunit,*) subname,' x2l fields: ',yy,mm,dd,sec + ! call diag_avect(x2l_a,mpicom_clmdrv,'x2l_a') + call diag_avect(x2l,mpicom_clmdrv,'x2l') + + ! run clm + write(iunit,*) subname,' call lnd_run_mct',yy,mm,dd,sec + call lnd_run_mct(Eclock, cdata, x2l, l2x) + + ! rearrange data from land decomposition + call mct_rearr_rearrange(l2x, l2x_a, rearr_lnd2atm) + + ! diagnose + write(iunit,*) subname,' l2x fields: ',yy,mm,dd,sec + call diag_avect(l2x,mpicom_clmdrv,'l2x') + ! call diag_avect(l2x_a,mpicom_clmdrv,'l2x_a') + enddo + + !---------------------------------------------- + !--- lnd_final --- + !---------------------------------------------- + + write(iunit,*) subname,' calling lnd_final_mct' + call shr_sys_flush(iunit) + call lnd_final_mct(Eclock, cdata, x2l, l2x) + + !---------------------------------------------- + !--- Done --- + !---------------------------------------------- + + write(iunit,*) subname,' DONE' + call shr_sys_flush(iunit) + call MPI_Finalize(ierr) contains -!====================================================================== + !====================================================================== - SUBROUTINE diag_avect(av, mpicom, comment) + SUBROUTINE diag_avect(av, mpicom, comment) - use seq_infodata_mod + use seq_infodata_mod - implicit none + implicit none -! !INPUT/OUTPUT PARAMETERS: + ! !INPUT/OUTPUT PARAMETERS: - type(mct_aVect) , intent(in) :: av - integer , intent(in) :: mpicom - character(len=*), intent(in) :: comment + type(mct_aVect) , intent(in) :: av + integer , intent(in) :: mpicom + character(len=*), intent(in) :: comment - !--- local --- - integer :: n,k ! counters - integer :: npts,nptsg ! number of local/global pts in AV - integer :: kflds ! number of fields in AV - real*8, pointer :: sumbuf (:) ! sum buffer - real*8, pointer :: sumbufg(:) ! sum buffer reduced - integer :: iam ! pe number - type(mct_string) :: mstring ! mct char type - character(len=128):: itemc ! string converted to char + !--- local --- + integer :: n,k ! counters + integer :: npts,nptsg ! number of local/global pts in AV + integer :: kflds ! number of fields in AV + real*8, pointer :: sumbuf (:) ! sum buffer + real*8, pointer :: sumbufg(:) ! sum buffer reduced + integer :: iam ! pe number + type(mct_string) :: mstring ! mct char type + character(len=128):: itemc ! string converted to char - !----- formats ----- - character(*),parameter :: subName = '(diag_avect) ' + !----- formats ----- + character(*),parameter :: subName = '(diag_avect) ' - !---------------------------------------------------------------- + !---------------------------------------------------------------- - npts = mct_aVect_lsize(AV) - kflds = mct_aVect_nRattr(AV) - allocate(sumbuf(kflds),sumbufg(kflds)) + npts = mct_aVect_lsize(AV) + kflds = mct_aVect_nRattr(AV) + allocate(sumbuf(kflds),sumbufg(kflds)) - sumbuf = 0.0 + sumbuf = 0.0 - do k = 1,kflds - do n = 1,npts - sumbuf(k) = sumbuf(k) + (AV%rAttr(k,n)) - enddo - enddo + do k = 1,kflds + do n = 1,npts + sumbuf(k) = sumbuf(k) + (AV%rAttr(k,n)) + enddo + enddo - call MPI_REDUCE(sumbuf,sumbufg,kflds,MPI_REAL8,MPI_SUM,0,mpicom,ierr) - call MPI_COMM_RANK(mpicom,iam,ierr) + call MPI_REDUCE(sumbuf,sumbufg,kflds,MPI_REAL8,MPI_SUM,0,mpicom,ierr) + call MPI_COMM_RANK(mpicom,iam,ierr) - if (iam == 0) then - do k = 1,kflds - call mct_aVect_getRList(mstring,k,AV) - itemc = mct_string_toChar(mstring) - call mct_string_clean(mstring) - write(iunit,101) trim(comment),k,sumbufg(k),trim(itemc) - enddo - call shr_sys_flush(iunit) - endif + if (iam == 0) then + do k = 1,kflds + call mct_aVect_getRList(mstring,k,AV) + itemc = mct_string_toChar(mstring) + call mct_string_clean(mstring) + write(iunit,101) trim(comment),k,sumbufg(k),trim(itemc) + enddo + call shr_sys_flush(iunit) + endif - deallocate(sumbuf,sumbufg) + deallocate(sumbuf,sumbufg) -101 format('comm_diag ',a,1x,i3,es26.19,1x,a) +101 format('comm_diag ',a,1x,i3,es26.19,1x,a) - end subroutine diag_avect + end subroutine diag_avect -!====================================================================== + !====================================================================== end PROGRAM clmdrv From 69f431ed071a84ed7715143747671d2938749afc Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Tue, 27 Feb 2018 19:07:20 -0700 Subject: [PATCH 0159/1973] add stub component interface file. --- lilac/src/stub_comp_mct.F90 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lilac/src/stub_comp_mct.F90 diff --git a/lilac/src/stub_comp_mct.F90 b/lilac/src/stub_comp_mct.F90 new file mode 100644 index 0000000000..de792d6c58 --- /dev/null +++ b/lilac/src/stub_comp_mct.F90 @@ -0,0 +1,8 @@ +module stub_comp_mct + + implicit none + +contains + + +end module stub_comp_mct From 48c80453b445172de984e5b0eeffa7f08be935dc Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 28 Feb 2018 12:14:34 -0700 Subject: [PATCH 0160/1973] add bedrock reference --- doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 86b3bbb5a9..d90c8cab40 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -345,7 +345,9 @@ The hydrologically and biogeochemically active portion of the soil column can be restricted to a thickness less than that of the maximum soil depth. By providing a depth-to-bedrock dataset, which may vary spatially, the number of layers used in the hydrologic and biogeochemical calculations, :math:`N_{bedrock}`, may be -specified, subject to the constraint :math:`N_{bedrock} \le N_{levsoi}` +specified, subject to the constraint :math:`N_{bedrock} \le N_{levsoi}`. +The default depth-to-bedrock values are from +:ref:`Pelletier et al. [2016]`. .. _Model Input Requirements: From 0a1b920bb676747be73bc20e263430efadc3a084 Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Wed, 28 Feb 2018 13:56:12 -0700 Subject: [PATCH 0161/1973] rename clmdriver to lilac-demo-driver --- lilac/src/{clmdrv.F90 => lilac-demo-driver.F90} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lilac/src/{clmdrv.F90 => lilac-demo-driver.F90} (100%) diff --git a/lilac/src/clmdrv.F90 b/lilac/src/lilac-demo-driver.F90 similarity index 100% rename from lilac/src/clmdrv.F90 rename to lilac/src/lilac-demo-driver.F90 From 21361da3d5c99e2c1f70b16da0415c8a6e3b9db0 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Wed, 28 Feb 2018 14:46:10 -0700 Subject: [PATCH 0162/1973] Modifications to photosynthesis tech note to remove 'ask rosie' references --- .../CLM50_Tech_Note_Photosynthesis.rst | 91 ++++++------------- ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 2 +- 2 files changed, 29 insertions(+), 64 deletions(-) diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index 258fa3f182..84136f7868 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -14,7 +14,7 @@ CLM5 includes the following new changes to photosynthesis and stomatal conductan - Default stomatal conductance calculation uses the Medlyn conductance model -- :math:`J_{max}` is predicted by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) +- :math:`V_{c,max}` and :math:`J_{max}` at 25 :sup:`\o`\ C: are now prognostic, and predicted via optimality by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) - Leaf N concentration and the fraction of leaf N in Rubisco used to calculate :math:`V_{cmax25}` are determined by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) @@ -255,20 +255,21 @@ depend on temperature. Values at 25 :sup:`o` \ C are :math:`K_{o25} =278.4\times 10^{-3} P_{atm}`, and :math:`\Gamma _{25} {\rm =42}.75\times 10^{-6} P_{atm}`. :math:`V_{c\max }`, :math:`J_{\max }`, :math:`T_{p}`, :math:`k_{p}`, -and :math:`R_{d}` also vary with temperature. Parameter values at 25 -[verify with Rosie that LUNA doesn't do this otherwise] -:sup:`o`\ C are calculated from :math:`V_{c\max }` \ at 25 -:sup:`\o`\ C: :math:`J_{\max 25} =1.97V_{c\max 25}`, +and :math:`R_{d}` also vary with temperature. + +:math:`J_{\max 25}` at 25 :sup:`\o`\ C: is calculated by the LUNA model (Chapter :numref:`rst_Photosynthetic Capacity`) + +Parameter values at 25 :sup:`\o`\ C are calculated from :math:`V_{c\max }` \ at 25 +:sup:`\o`\ C:, including: :math:`T_{p25} =0.167V_{c\max 25}`, and :math:`R_{d25} =0.015V_{c\max 25}` (C\ :sub:`3`) and -:math:`R_{d25} =0.025V_{c\max 25}` (C\ :sub:`4`). For -C\ :sub:`4` plants, :math:`k_{p25} =20000\; V_{c\max 25}`. -However, when the biogeochemistry is active, :math:`R_{d25}` is -calculated from leaf nitrogen as :math:`R_{d25} = 0.2577LNC_{a}`, -where :math:`LNC_{a}` is the area-based leaf nitrogen concentration -(g N m\ :sup:`-2` leaf area, Chapter :numref:`rst_Photosynthetic Capacity`), -and 0.2577 :math:`\mu`\ mol CO\ :sub:`2` g\ :sup:`-1` N s\ :sup:`-1` is the base respiration rate. -[this doesn't look correct based on the code, which lists two options; verify with Rosie] +:math:`R_{d25} =0.025V_{c\max 25}` (C\ :sub:`4`). + +For C\ :sub:`4` plants, :math:`k_{p25} =20000\; V_{c\max 25}`. + +However, when the biogeochemistry is active (the default mode), :math:`R_{d25}` is +calculated from leaf nitrogen as described in (Chapter :numref:`rst_Plant Respiration`) + The parameters :math:`V_{c\max 25}`, :math:`J_{\max 25}`, :math:`T_{p25}`, :math:`k_{p25}`, and :math:`R_{d25}` are scaled over the canopy for sunlit and shaded leaves @@ -280,8 +281,6 @@ The parameters :math:`V_{c\max 25}`, \begin{array}{rcl} {V_{c\max } } & {=} & {V_{c\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {J_{\max } } & {=} & {J_{\max 25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {T_{p} } & {=} & {T_{p25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {R_{d} } & {=} & {R_{d25} \; f\left(T_{v} \right)f_{H} \left(T_{v} \right)} \\ {K_{c} } & {=} & {K_{c25} \; f\left(T_{v} \right)} \\ {K_{o} } & {=} & {K_{o25} \; f\left(T_{v} \right)} \\ {\Gamma } & {=} & {\Gamma _{25} \; f\left(T_{v} \right)} \end{array} -[check with Rosie about Rd equation above and below (eq. 14)] with - .. math:: :label: 9.11 @@ -384,64 +383,30 @@ range :math:`T_{10} -T_{f} \ge 11`\ :sup:`o`\ C and :math:`T_{10} -T_{f} \le 35` Canopy scaling -------------------------------------------- -:math:`V_{c\max 25}` is calculated separately for sunlit and shaded -leaves using an exponential profile to area-based leaf nitrogen -(:math:`LNC_{a}`, see Chapter :numref:`rst_Photosynthetic Capacity` ), -as in :ref:`Bonan et al. (2011)`. :math:`V_{c\max 25}` at -cumulative leaf area index :math:`x` from the canopy top scales directly -with :math:`LNC_{a}` , which decreases exponentially with greater -cumulative leaf area, so that [Verify with Rosie- different based on Vcmax option 0, 3, & 4] - -.. math:: - :label: 9.18 - - V_{c\; \max 25}^{} \left(x\right)=V_{c\; \max 25}^{} \left(0\right)e^{-K_{n} x} - -where :math:`V_{c\; \max 25}^{} \left(0\right)` is defined at the top of -the canopy using :math:`SLA_{0}`, which is the specific leaf area at -the canopy top and :math:`K_{n}` is the decay -coefficient for nitrogen. The canopy integrated value for sunlit and -shaded leaves is - -.. math:: - :label: 9.20 +When LUNA is on, the :math:`V_{c\max 25}` for sun leaves is scaled to the shaded leaves +:math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}`, and +:math:`R_{d25}` scale similarly. - \begin{array}{rcl} {V_{c\; \max 25}^{sun} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)f_{sun} \left(x\right)\, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} } \end{array} .. math:: - :label: 9.21 - - \begin{array}{rcl} {V_{c\; \max 25}^{sha} } & {=} & {\int _{0}^{L}V_{c\; \max 25}^{} \left(x\right)\left[1-f_{sun} \left(x\right)\right] \, dx} \\ {} & {=} & {V_{c\; \max 25}^{} \left(0\right)\left\{\left[1-e^{-K_{n} L} \right]\frac{1}{K_{n} } -\left[1-e^{-\left(K_{n} +K\right)L} \right]\frac{1}{K_{n} +K} \right\}} \end{array} + :label: 9.18 -and the average value for the sunlit and shaded leaves is + \begin{array}{rcl} + {V_{c\max 25 sha}} & {=} & {V_{c\max 25 sha} \frac{i_{v,sha}}{i_{v,sun}}} \\ + {J_{\max 25 sha}} & {=} & {J_{\max 25 sun} \frac{i_{v,sha}}{i_{v,sun}}} \\ + {T_{p sha}} & {=} & {T_{p sun} \frac{i_{v,sha}}{i_{v,sun}}} \end{array} -.. math:: - :label: 9.22 - - \bar{V}_{c\; \max 25}^{sun} ={V_{c\; \max 25}^{sun} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sun} L^{sun} }} \right. \kern-\nulldelimiterspace} L^{sun} } +Where :math:`i_{v,sun}` and :math:`i_{v,sha}` are the leaf-to-canopy scaling coefficients of the twostream radiation model, calculated as .. math:: - :label: 9.23 - - \bar{V}_{c\; \max 25}^{sha} ={V_{c\; \max 25}^{sha} \mathord{\left/ {\vphantom {V_{c\; \max 25}^{sha} L^{sha} }} \right. \kern-\nulldelimiterspace} L^{sha} } . + :label: 9.19 -This integration is over all leaf area (:math:`L`) with -:math:`f_{sun} (x)=\exp \left(-Kx\right)` and :math:`K` the direct beam -extinction coefficient (equation :eq:`4.8` in chapter :numref:`rst_Radiative Fluxes`). Photosynthetic parameters -:math:`J_{\max 25}` , :math:`T_{p25}` , :math:`k_{p25}`, and -:math:`R_{d25}` scale similarly. + i_{v,sun} = \frac{(1 - e^{-(k_{n,ext}+k_{b,ext})*lai_e)} / (k_{n,ext}+k_{b,ext})}{f_{sun}*lai_e}\\ + i_{v,sha} = \frac{(1 - e^{-(k_{n,ext}+k_{b,ext})*lai_e)} / (k_{n,ext}+k_{b,ext})}{(1 - f_{sun})*lai_e} -The model uses :math:`K_{n} =0.30` to match an explicit multi-layer canopy, as in -:ref:`Bonan et al. (2012)`. -The value :math:`K_{n} = 0.11` chosen by :ref:`Bonan et al. (2011)` is -consistent with observationally-derived estimates for forests, mostly -tropical, and provides a gradient in V\ :sub:`cmax` similar to -the original CLM4 specific leaf area scaling. However, -:ref:`Bonan et al. (2012)` showed that the sunlit/shaded canopy parameterization does not -match an explicit multi-layer canopy parameterization. The discrepancy -arises from absorption of scattered radiation by shaded leaves and can -be tuned out with higher :math:`K_{n}`. +k_{n,ext} is the extinction coefficient for N through the canopy (0.3). k_{b,ext} is the direct beam extinction coefficient calculated in the surface albedo routine, and :math:`f_{sun}` is the fraction of sunlit leaves, both derived from Chapter :numref:`rst_Surface Albedos`. +When LUNA is off, scaling defaults to the mechanism used in CLM4.5. .. _Numerical implementation photosynthesis: diff --git a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst index c47ce0e624..4c3e857ade 100755 --- a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst +++ b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst @@ -142,7 +142,7 @@ Following Bauerle et al. (2012), :math:`f\left(\text{day length} \right)` is sim f\left(\text{day length} \right) = \left(\frac{\text{day length}}{12} \right)^{2}. -:math:`f\left(\text{humidity} \right)` represents the impact of air humitidy on +:math:`f\left(\text{humidity} \right)` represents the impact of air humidity on :math:`J_{\text{{max}}}`. We assume that higher humidity leads to higher :math:`J_{\text{{max}}}` with less water limiation on stomta opening and that low relative humidity has a stronger impact on nitrogen allocation due to greater From 09d60de00a5a72136d3d615b13a4225ea634d3e1 Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Wed, 28 Feb 2018 15:00:11 -0700 Subject: [PATCH 0163/1973] Start moving mct/component initialization code out of the driver and into a new lilac interface module. --- lilac/src/lilac-demo-driver.F90 | 161 +---------------- lilac/src/lilac.F90 | 299 ++++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+), 155 deletions(-) create mode 100644 lilac/src/lilac.F90 diff --git a/lilac/src/lilac-demo-driver.F90 b/lilac/src/lilac-demo-driver.F90 index 9d798b59ff..b06b6599f7 100644 --- a/lilac/src/lilac-demo-driver.F90 +++ b/lilac/src/lilac-demo-driver.F90 @@ -78,73 +78,11 @@ PROGRAM clmdrv !--- MPI/MCT --- !---------------------------------------------- - call MPI_Init(ierr) - call MPI_Comm_Dup(MPI_COMM_WORLD, mpicom_clmdrv, ierr) - call MPI_COMM_RANK(mpicom_clmdrv, mytask, ierr) - call MPI_COMM_SIZE(mpicom_clmdrv, ntasks, ierr) - - ncomps = 1 - ID_clmdrv = 1 - call mct_world_init(ncomps,MPI_COMM_WORLD,mpicom_clmdrv,ID_clmdrv) - - !---------------------------------------------- - !--- Log File and PIO --- - !---------------------------------------------- - - global_comm = MPI_COMM_WORLD - call shr_pio_init1(ncomps, 'pio_in', global_comm) - allocate(comp_id(ncomps),comp_name(ncomps),comp_iamin(ncomps),comp_comm(ncomps),comp_comm_iam(ncomps)) - do n = 1,ncomps - comp_id(n) = ID_clmdrv - comp_name(n) = 'LND' - comp_iamin(n) = .true. - comp_comm(n) = mpicom_clmdrv - comp_comm_iam(n) = mytask - enddo - call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) - deallocate(comp_id,comp_name,comp_iamin,comp_comm,comp_comm_iam) - - write(string,'(a,i4.4)') 'clmdrv.log.',mytask - open(iunit, file=trim(string)) - write(iunit,*) subname,' STARTING' - call shr_sys_flush(iunit) - - write(iunit,*) subname,' ntasks = ',ntasks - write(iunit,*) subname,' mytask = ',mytask - write(iunit,*) subname,' mct ID = ',ID_clmdrv - call shr_sys_flush(iunit) - call shr_file_setLogUnit(sunit) - call shr_file_setLogLevel(1) - - !---------------------------------------------- - !--- Clocks --- - !---------------------------------------------- - - call ESMF_Initialize(rc=rc) - Calendar = ESMF_CalendarCreate( name='clmdrv_NOLEAP', & - calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) - call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) - EClock = ESMF_ClockCreate(name='clmdrv_EClock', & - TimeStep=TimeStep, startTime=StartTime, & - RefTime=StartTime, stopTime=stopTime, rc=rc) - - EAlarm_stop = ESMF_AlarmCreate(name='seq_timemgr_alarm_stop' , & - clock=EClock, ringTime=StopTime, rc=rc) - EAlarm_rest = ESMF_AlarmCreate(name='seq_timemgr_alarm_restart', & - clock=EClock, ringTime=StopTime, rc=rc) - - call ESMF_TimeGet( StartTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=',yy,mm,dd,sec - call ESMF_TimeGet( StopTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=',yy,mm,dd,sec - call shr_sys_flush(iunit) - - !---------------------------------------------- - !--- Coupling --- - !---------------------------------------------- + lilac%Init() + ! FIXME(bja, 2018-02) don't want to use the cdata structure, but we still + ! need to provide this information to the component?! + !--- set mpicom and cdata memory cdata%name = 'cdata_clmdrv' cdata%ID = ID_clmdrv @@ -153,26 +91,6 @@ PROGRAM clmdrv cdata%gsmap => gsmap_lnd cdata%infodata => infodata - !--- coupling fields - seq_flds_dom_coord='lat:lon' - seq_flds_dom_other='area:aream:mask:frac' - seq_flds_dom_fields=trim(seq_flds_dom_coord)//':'//trim(seq_flds_dom_other) - - seq_flds_x2l_states= 'Sa_z:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_pbot:Sg_icemask:Sg_icemask_coupled_fluxes' - seq_flds_x2l_fluxes= 'Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_lwdn:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Faxa_bcphidry:Faxa_bcphodry:Faxa_bcphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_ocphiwet:Faxa_dstwet1:Faxa_dstwet2:Faxa_dstwet3:Faxa_dstwet4:Faxa_dstdry1:Faxa_dstdry2:Faxa_dstdry3:Faxa_dstdry4:Flrr_flood:Flrr_volr' - seq_flds_x2l_fields= trim(seq_flds_x2l_states)//':'//trim(seq_flds_x2l_fluxes) - - seq_flds_l2x_states= 'Sl_avsdr:Sl_anidr:Sl_avsdf:Sl_anidf:Sl_tref:Sl_qref:Sl_t:Sl_fv:Sl_ram1:Sl_snowh:Sl_u10' - seq_flds_l2x_fluxes= 'Fall_swnet:Fall_taux:Fall_tauy:Fall_lat:Fall_sen:Fall_lwup:Fall_evap:Fall_flxdst1:Fall_flxdst2:Fall_flxdst3:Fall_flxdst4:Flrl_rofl:Flrl_rofi:Fall_voc001:Fall_voc002:Fall_voc003:Fall_voc004:Fall_voc005:Fall_voc006:Fall_voc007:Fall_voc008' - seq_flds_l2x_fields= trim(seq_flds_l2x_states)//':'//trim(seq_flds_l2x_fluxes) - - !--- set orbital params - orb_iyear = 1990 - call shr_orb_params(orb_iyear, orb_eccen, orb_obliq, orb_mvelp, & - orb_obliqr, orb_lambm0, orb_mvelpp, .true.) - call seq_infodata_putData(infodata, orb_eccen=orb_eccen, orb_mvelpp=orb_mvelpp, & - orb_lambm0=orb_lambm0, orb_obliqr=orb_obliqr ) - !--- set case information case_name = 'clmdrv' case_desc = 'clmdrv with clm' @@ -197,63 +115,10 @@ PROGRAM clmdrv !--- lnd_init --- !---------------------------------------------- - write(iunit,*) subname,' calling lnd_init_mct' - call shr_sys_flush(iunit) - call lnd_init_mct(Eclock, cdata, x2l, l2x) - - call diag_avect(l2x,mpicom_clmdrv,'l2x_init') - - idx_Sa_z = mct_avect_indexra(x2l,'Sa_z') - idx_Sa_u = mct_avect_indexra(x2l,'Sa_u') - idx_Sa_v = mct_avect_indexra(x2l,'Sa_v') - idx_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') - idx_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') - idx_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') - idx_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') - idx_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') - idx_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') - idx_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') - idx_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') - idx_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') - idx_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') - idx_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') - idx_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') - idx_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') - !---------------------------------------------- !--- atm and atm/lnd coupling init --- !---------------------------------------------- - ! set atm grid size to land grid size in this example. for a real - ! atmosphere model, the atm and land grids should agree at the outset. - call seq_infodata_getData(infodata,lnd_nx=atm_nx,lnd_ny=atm_ny) - - ! atm decomp - gstart = ((mytask * atm_nx * atm_ny) / ntasks) + 1 - gend = (((mytask+1) * atm_nx * atm_ny) / ntasks) - lsize = gend - gstart + 1 - gsize = atm_nx * atm_ny - allocate(gindex(lsize)) - do n = gstart, gend - m = n-gstart+1 - gindex(m) = n - end do - write(iunit,'(1x,2a,5i8)') subname,' atm decomp = ',mytask,gsize,lsize,gstart,gend - - ! initialize land grid on atm decomp - call mct_gsMap_init(gsmap_atm, gindex, mpicom_clmdrv, ID_clmdrv, lsize, gsize) - deallocate(gindex) - - ! initialize rearrangers between atm and land decomps - call mct_rearr_init(gsmap_atm, gsmap_lnd, mpicom_clmdrv, rearr_atm2lnd) - call mct_rearr_init(gsmap_lnd, gsmap_atm, mpicom_clmdrv, rearr_lnd2atm) - - ! initialize atm avects from land avects with atm lsize - call mct_avect_init(x2l_a, x2l, lsize) - call mct_avect_zero(x2l_a) - call mct_avect_init(l2x_a, l2x, lsize) - call mct_avect_zero(l2x_a) - !---------------------------------------------- !--- Time Loop --- !---------------------------------------------- @@ -311,22 +176,8 @@ PROGRAM clmdrv ! call diag_avect(l2x_a,mpicom_clmdrv,'l2x_a') enddo - !---------------------------------------------- - !--- lnd_final --- - !---------------------------------------------- - - write(iunit,*) subname,' calling lnd_final_mct' - call shr_sys_flush(iunit) - call lnd_final_mct(Eclock, cdata, x2l, l2x) - - !---------------------------------------------- - !--- Done --- - !---------------------------------------------- - - write(iunit,*) subname,' DONE' - call shr_sys_flush(iunit) - call MPI_Finalize(ierr) - + lilac%Shutdown() + contains !====================================================================== diff --git a/lilac/src/lilac.F90 b/lilac/src/lilac.F90 new file mode 100644 index 0000000000..a3590c0ce0 --- /dev/null +++ b/lilac/src/lilac.F90 @@ -0,0 +1,299 @@ +module lilac + ! + ! Public interface to lilac + ! + + implicit none + private + + type, abstract :: lilac_t + private + contains + ! Public API + procedure :: Init => lilac_init + procedure :: Shutdown => lilac_shutdown + procudure :: AdvanceTime => lilac_advance_time + + ! private initialization routines + procedure, private :: lilac_init_parallel + procedure, private :: lilac_init_logging + procedure, private :: lilac_init_io + procedure, private :: lilac_init_clocks + procedure, private :: lilac_init_fields + procedure, private :: lilac_init_orbit + procedure, private :: lilac_init_land + procedure, private :: lilac_init_coupling + + ! private shudown routines + procedure, private :: lilac_shutdown_land + procedure, private :: lilac_shutdown_parallel + + end type lilac_t + + + +contains + + ! + ! Public API + ! + subroutine lilac_init(this) + + use mct_mod, only : mct_world_init + + implicit none + + class(lilac_t), intent(inout) :: this + + call lilac_init_parallel() + + end subroutine lilac_init + + subroutine lilac_advance_time(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + end subroutine lilac_advance_time + + subroutine lilac_shutdown(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + ! FIXME(bja, 2018-02) master proc only! + write(this%iunit, *) 'lilac shutting down...' + call shr_sys_flush(this%iunit) + + call lilac_shutdown_land() + call lilac_shutdown_parallel() + + ! FIXME(bja, 2018-02) master proc only! + write(this%iunit, *) 'lilac shut down complete.' + + end subroutine lilac_shutdown + + ! + ! Private work functions + ! + subroutine lilac_init_parallel(this) + ! Initialize parallel components, e.g. MPI, MCT + + implicit none + + class(lilac_t), intent(inout) :: this + + call MPI_Init(ierr) + call MPI_Comm_Dup(MPI_COMM_WORLD, mpicom_comp, ierr) + call MPI_COMM_RANK(mpicom_comp, mytask, ierr) + call MPI_COMM_SIZE(mpicom_comp, ntasks, ierr) + + num_comps = 1 + ID_comp = 1 + call mct_world_init(num_comps, MPI_COMM_WORLD, mpicom_clmdrv, ID_comp) + + end subroutine lilac_init_parallel + + subroutine lilac_init_logging(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + write(string,'(a,i4.4)') 'lilac.log.',mytask + open(iunit, file=trim(string)) + write(iunit,*) subname,' STARTING' + call shr_sys_flush(iunit) + + write(iunit,*) subname, ' ntasks = ', ntasks + write(iunit,*) subname, ' mytask = ', mytask + write(iunit,*) subname, ' mct ID = ', ID_comp + call shr_sys_flush(iunit) + call shr_file_setLogUnit(sunit) + call shr_file_setLogLevel(1) + + end subroutine lilac_init_logging + + subroutine lilac_init_io(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + global_comm = MPI_COMM_WORLD + call shr_pio_init1(ncomps, 'pio_in', global_comm) + allocate(comp_id(ncomps),comp_name(ncomps),comp_iamin(ncomps),comp_comm(ncomps),comp_comm_iam(ncomps)) + do n = 1,ncomps + comp_id(n) = ID_clmdrv + comp_name(n) = 'LND' + comp_iamin(n) = .true. + comp_comm(n) = mpicom_clmdrv + comp_comm_iam(n) = mytask + enddo + call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) + deallocate(comp_id,comp_name,comp_iamin,comp_comm,comp_comm_iam) + + end subroutine lilac_init_io + + subroutine lilac_init_clocks(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + call ESMF_Initialize(rc=rc) + Calendar = ESMF_CalendarCreate( name='clmdrv_NOLEAP', & + calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) + call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) + call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) + call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) + EClock = ESMF_ClockCreate(name='clmdrv_EClock', & + TimeStep=TimeStep, startTime=StartTime, & + RefTime=StartTime, stopTime=stopTime, rc=rc) + + EAlarm_stop = ESMF_AlarmCreate(name='seq_timemgr_alarm_stop' , & + clock=EClock, ringTime=StopTime, rc=rc) + EAlarm_rest = ESMF_AlarmCreate(name='seq_timemgr_alarm_restart', & + clock=EClock, ringTime=StopTime, rc=rc) + + call ESMF_TimeGet( StartTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=',yy,mm,dd,sec + call ESMF_TimeGet( StopTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=',yy,mm,dd,sec + call shr_sys_flush(iunit) + + end subroutine lilac_init_clocks + + subroutine lilac_init_fields(this) + ! Set coupling fields. + + implicit none + + class(lilac_t), intent(inout) :: this + + ! FIXME(bja, 2018-02) this should be dynamically created at runtime + ! instead of hard coded! + + seq_flds_dom_coord='lat:lon' + seq_flds_dom_other='area:aream:mask:frac' + seq_flds_dom_fields=trim(seq_flds_dom_coord)//':'//trim(seq_flds_dom_other) + + seq_flds_x2l_states= 'Sa_z:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_pbot:Sg_icemask:Sg_icemask_coupled_fluxes' + seq_flds_x2l_fluxes= 'Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_lwdn:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Faxa_bcphidry:Faxa_bcphodry:Faxa_bcphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_ocphiwet:Faxa_dstwet1:Faxa_dstwet2:Faxa_dstwet3:Faxa_dstwet4:Faxa_dstdry1:Faxa_dstdry2:Faxa_dstdry3:Faxa_dstdry4:Flrr_flood:Flrr_volr' + seq_flds_x2l_fields= trim(seq_flds_x2l_states)//':'//trim(seq_flds_x2l_fluxes) + + seq_flds_l2x_states= 'Sl_avsdr:Sl_anidr:Sl_avsdf:Sl_anidf:Sl_tref:Sl_qref:Sl_t:Sl_fv:Sl_ram1:Sl_snowh:Sl_u10' + seq_flds_l2x_fluxes= 'Fall_swnet:Fall_taux:Fall_tauy:Fall_lat:Fall_sen:Fall_lwup:Fall_evap:Fall_flxdst1:Fall_flxdst2:Fall_flxdst3:Fall_flxdst4:Flrl_rofl:Flrl_rofi:Fall_voc001:Fall_voc002:Fall_voc003:Fall_voc004:Fall_voc005:Fall_voc006:Fall_voc007:Fall_voc008' + seq_flds_l2x_fields= trim(seq_flds_l2x_states)//':'//trim(seq_flds_l2x_fluxes) + + + end subroutine lilac_init_fields + + subroutine lilac_init_orbit(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + !--- set orbital params + orb_iyear = 1990 + call shr_orb_params(orb_iyear, orb_eccen, orb_obliq, orb_mvelp, & + orb_obliqr, orb_lambm0, orb_mvelpp, .true.) + call seq_infodata_putData(infodata, orb_eccen=orb_eccen, orb_mvelpp=orb_mvelpp, & + orb_lambm0=orb_lambm0, orb_obliqr=orb_obliqr ) + + + end subroutine lilac_init_orbit + + subroutine lilac_init_land(this) + + implicit none + + write(iunit,*) subname,' calling lnd_init_mct' + call shr_sys_flush(iunit) + call lnd_init_mct(Eclock, cdata, x2l, l2x) + + call diag_avect(l2x,mpicom_clmdrv,'l2x_init') + + idx_Sa_z = mct_avect_indexra(x2l,'Sa_z') + idx_Sa_u = mct_avect_indexra(x2l,'Sa_u') + idx_Sa_v = mct_avect_indexra(x2l,'Sa_v') + idx_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') + idx_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') + idx_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') + idx_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') + idx_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') + idx_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') + idx_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') + idx_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') + idx_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') + idx_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') + idx_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') + idx_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') + idx_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') + + end subroutine lilac_init_land + + subroutine lilac_init_coupling(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + ! set atm grid size to land grid size in this example. for a real + ! atmosphere model, the atm and land grids should agree at the outset. + call seq_infodata_getData(infodata,lnd_nx=atm_nx,lnd_ny=atm_ny) + + ! atm decomp + gstart = ((mytask * atm_nx * atm_ny) / ntasks) + 1 + gend = (((mytask+1) * atm_nx * atm_ny) / ntasks) + lsize = gend - gstart + 1 + gsize = atm_nx * atm_ny + allocate(gindex(lsize)) + do n = gstart, gend + m = n-gstart+1 + gindex(m) = n + end do + write(iunit,'(1x,2a,5i8)') subname,' atm decomp = ',mytask,gsize,lsize,gstart,gend + + ! initialize land grid on atm decomp + call mct_gsMap_init(gsmap_atm, gindex, mpicom_clmdrv, ID_clmdrv, lsize, gsize) + deallocate(gindex) + + ! initialize rearrangers between atm and land decomps + call mct_rearr_init(gsmap_atm, gsmap_lnd, mpicom_clmdrv, rearr_atm2lnd) + call mct_rearr_init(gsmap_lnd, gsmap_atm, mpicom_clmdrv, rearr_lnd2atm) + + ! initialize atm avects from land avects with atm lsize + call mct_avect_init(x2l_a, x2l, lsize) + call mct_avect_zero(x2l_a) + call mct_avect_init(l2x_a, l2x, lsize) + call mct_avect_zero(l2x_a) + + end subroutine lilac_init_coupling + + subroutine lilac_shutdown_land(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + write(iunit, *) 'lilac shutting down component ', this%comp_name + call lnd_final_mct(Eclock, cdata, x2l, l2x) + + end subroutine lilac_shutdown_land + + subroutine lilac_shutdown_parallel(this) + + implicit none + + class(lilac_t), intent(inout) :: this + + ! FIXME(bja, 2018-02) need to determine if it is our responsibility to shutdown mpi or the caller!? + ! call MPI_Finalize(ierr) + + end subroutine lilac_shutdown_parallel + +end module lilac From b7cc3082250b578ac12784554790fb64427757c4 Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Wed, 28 Feb 2018 15:15:35 -0700 Subject: [PATCH 0164/1973] Modifications to FATES fire documentation --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 8d44f55216..01442e5eb9 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -974,7 +974,7 @@ thus \delta_{vai} \cdot f_{leaf,coh} \frac{A_{canopy,coh}}{A_{canopy,patch}}\cdot r_{vai}& \textrm{for $i=n_{z,coh}$}\\ \end{array} \right. - and the stem area index is +and the stem area index is .. math:: @@ -3127,7 +3127,7 @@ Nesterov Index Dead fuel moisture (:math:`\emph{moist}_{df,fc}`), and several other properties of fire behaviour, are a function of the ‘Nesterov Index’ (:math:`N_{I}`) which is an accumulation over time of a function of -temperature and humidity (Eqn 5, :ref:`Thonicke et al. 2010`). +temperature and humidity (Eqn 5, :ref:`Thonicke et al. 2010`), .. math:: N_{I}=\sum{\textrm{max}(T_{d}(T_{d}-D),0)} @@ -3142,6 +3142,7 @@ where :math:`T_{d}` is the daily mean temperature in :math:`^{o}`\ C and where :math:`RH` is the relative humidity (%). +On days when the total precipitation exceeds 3.0mm, the Nesterov index accumulator is reset back to zero. Fuel properties --------------- @@ -3239,7 +3240,7 @@ Forward rate of spread For each patch and each day, we calculate the rate of forward spread of the fire *ros*\ :math:`_{f}` (nominally in the direction of the wind). -.. math:: \emph{ros}_{f}=\frac{i_{r}x_{i}(1-\phi_{w})}{F_{bd,patch}e_{ps}q_{ig}} +.. math:: \emph{ros}_{f}=\frac{i_{r}x_{i}(1+\phi_{w})}{F_{bd,patch}e_{ps}q_{ig}} :math:`e_{ps}` is the effective heating number (:math:`e^{\frac{-4.528}{F_{\sigma,patch}}}`). :math:`q_{ig}` is the @@ -3249,10 +3250,7 @@ Appendix A). .. math:: - x_{i}= \left\{ \begin{array}{ll} - 0.0& \textrm{for $F_{\sigma,patch}<0.00001$}\\ - \frac{e^{0.792+3.7597F_{\sigma,patch}^{0.5}(\frac{F_{bd,patch}}{p_{d}}+0.1)}}{192+7.9095F_{\sigma,patch}} & \textrm{for $F_{\sigma,patch}\geq 0.00001$}\\ - \end{array} \right. + x_{i}= \frac{e^{0.792+3.7597F_{\sigma,patch}^{0.5}(\frac{F_{bd,patch}}{p_{d}}+0.1)}}{192+7.9095F_{\sigma,patch}} :math:`\phi_{w}` is the influence of windspeed on rate of spread. @@ -3331,9 +3329,9 @@ fire, :math:`\mathit{ros}_{f}` (m min\ :math:`^{-1}`) (Eqn 15 .. math:: I_{surface}=\frac{0.001}{60}f_{energy} f_{ctot,patch}\mathit{ros}_{f} -where :math:`f_{energy}` is the energy content of fuel (kJ/kG - the -same for alll fuel classes). Fire intensity is used to define whether an -ignition is successful. If the fire intensity is greater than 50kw/m +where :math:`f_{energy}` is the energy content of fuel (Kj/Kg - the +same, 18000 Kj/Kg for all fuel classes). Fire intensity is used to define whether an +ignition is successful. If the fire intensity is greater than 50Kw/m then the ignition is successful. Fire Duration @@ -3372,7 +3370,7 @@ respectively). :math:`ros_{b}` is a function of :math:`ros_{f}` and windspeed (Eqn 10 :ref:`Thonicke et al. 2010`) -.. math:: ros_{b}=ros_{f}e^{-0.72W} +.. math:: ros_{b}=ros_{f}e^{-0.012W} The minor axis to major axis ratio :math:`l_{b}` of the ellipse is determined by the windspeed. If the windspeed (:math:`W`) is less than From 0282ec49736334f4061ee996d7a9ca8acd8310c5 Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Thu, 1 Mar 2018 14:30:39 -0700 Subject: [PATCH 0165/1973] Add spaces between items in comman separated lists. Rename clmdrv to lilac. --- lilac/src/lilac-demo-driver.F90 | 5 ++-- lilac/src/lilac.F90 | 48 +++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/lilac/src/lilac-demo-driver.F90 b/lilac/src/lilac-demo-driver.F90 index b06b6599f7..3857271be7 100644 --- a/lilac/src/lilac-demo-driver.F90 +++ b/lilac/src/lilac-demo-driver.F90 @@ -73,6 +73,7 @@ PROGRAM clmdrv character(len=*),parameter :: subname = 'clmdrv' !---------------------------------------------- + class(lilac_t) :: lilac !---------------------------------------------- !--- MPI/MCT --- @@ -82,7 +83,7 @@ PROGRAM clmdrv ! FIXME(bja, 2018-02) don't want to use the cdata structure, but we still ! need to provide this information to the component?! - + !--- set mpicom and cdata memory cdata%name = 'cdata_clmdrv' cdata%ID = ID_clmdrv @@ -177,7 +178,7 @@ PROGRAM clmdrv enddo lilac%Shutdown() - + contains !====================================================================== diff --git a/lilac/src/lilac.F90 b/lilac/src/lilac.F90 index a3590c0ce0..c4671e8570 100644 --- a/lilac/src/lilac.F90 +++ b/lilac/src/lilac.F90 @@ -45,7 +45,7 @@ subroutine lilac_init(this) class(lilac_t), intent(inout) :: this - call lilac_init_parallel() + call this%lilac_init_parallel() end subroutine lilac_init @@ -67,8 +67,8 @@ subroutine lilac_shutdown(this) write(this%iunit, *) 'lilac shutting down...' call shr_sys_flush(this%iunit) - call lilac_shutdown_land() - call lilac_shutdown_parallel() + call this%lilac_shutdown_land() + call this%lilac_shutdown_parallel() ! FIXME(bja, 2018-02) master proc only! write(this%iunit, *) 'lilac shut down complete.' @@ -92,7 +92,7 @@ subroutine lilac_init_parallel(this) num_comps = 1 ID_comp = 1 - call mct_world_init(num_comps, MPI_COMM_WORLD, mpicom_clmdrv, ID_comp) + call mct_world_init(num_comps, MPI_COMM_WORLD, mpicom_lilac, ID_comp) end subroutine lilac_init_parallel @@ -102,7 +102,7 @@ subroutine lilac_init_logging(this) class(lilac_t), intent(inout) :: this - write(string,'(a,i4.4)') 'lilac.log.',mytask + write(string,'(a,i4.4)') 'lilac.log.', mytask open(iunit, file=trim(string)) write(iunit,*) subname,' STARTING' call shr_sys_flush(iunit) @@ -124,32 +124,40 @@ subroutine lilac_init_io(this) global_comm = MPI_COMM_WORLD call shr_pio_init1(ncomps, 'pio_in', global_comm) - allocate(comp_id(ncomps),comp_name(ncomps),comp_iamin(ncomps),comp_comm(ncomps),comp_comm_iam(ncomps)) - do n = 1,ncomps - comp_id(n) = ID_clmdrv + allocate(comp_id(ncomps), comp_name(ncomps), comp_iamin(ncomps), comp_comm(ncomps), comp_comm_iam(ncomps)) + do n = 1, ncomps + comp_id(n) = ID_lilac comp_name(n) = 'LND' comp_iamin(n) = .true. - comp_comm(n) = mpicom_clmdrv + comp_comm(n) = mpicom_lilac comp_comm_iam(n) = mytask enddo call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) - deallocate(comp_id,comp_name,comp_iamin,comp_comm,comp_comm_iam) + deallocate(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) end subroutine lilac_init_io subroutine lilac_init_clocks(this) + use ESMF + implicit none class(lilac_t), intent(inout) :: this + type(ESMF_Clock) :: EClock ! Input synchronization clock + type(ESMF_Time) :: CurrTime, StartTime, StopTime + type(ESMF_TimeInterval) :: TimeStep + type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest + type(ESMF_Calendar), target :: Calendar + call ESMF_Initialize(rc=rc) - Calendar = ESMF_CalendarCreate( name='clmdrv_NOLEAP', & + Calendar = ESMF_CalendarCreate( name='lilac_NOLEAP', & calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) - EClock = ESMF_ClockCreate(name='clmdrv_EClock', & + EClock = ESMF_ClockCreate(name='lilac_EClock', & TimeStep=TimeStep, startTime=StartTime, & RefTime=StartTime, stopTime=stopTime, rc=rc) @@ -159,9 +167,9 @@ subroutine lilac_init_clocks(this) clock=EClock, ringTime=StopTime, rc=rc) call ESMF_TimeGet( StartTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=',yy,mm,dd,sec + write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=', yy, mm, dd, sec call ESMF_TimeGet( StopTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=',yy,mm,dd,sec + write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=', yy, mm, dd, sec call shr_sys_flush(iunit) end subroutine lilac_init_clocks @@ -215,7 +223,7 @@ subroutine lilac_init_land(this) call shr_sys_flush(iunit) call lnd_init_mct(Eclock, cdata, x2l, l2x) - call diag_avect(l2x,mpicom_clmdrv,'l2x_init') + call diag_avect(l2x, mpicom_lilac,'l2x_init') idx_Sa_z = mct_avect_indexra(x2l,'Sa_z') idx_Sa_u = mct_avect_indexra(x2l,'Sa_u') @@ -244,7 +252,7 @@ subroutine lilac_init_coupling(this) ! set atm grid size to land grid size in this example. for a real ! atmosphere model, the atm and land grids should agree at the outset. - call seq_infodata_getData(infodata,lnd_nx=atm_nx,lnd_ny=atm_ny) + call seq_infodata_getData(infodata, lnd_nx=atm_nx, lnd_ny=atm_ny) ! atm decomp gstart = ((mytask * atm_nx * atm_ny) / ntasks) + 1 @@ -256,15 +264,15 @@ subroutine lilac_init_coupling(this) m = n-gstart+1 gindex(m) = n end do - write(iunit,'(1x,2a,5i8)') subname,' atm decomp = ',mytask,gsize,lsize,gstart,gend + write(iunit,'(1x,2a,5i8)') subname,' atm decomp = ', mytask, gsize, lsize, gstart, gend ! initialize land grid on atm decomp - call mct_gsMap_init(gsmap_atm, gindex, mpicom_clmdrv, ID_clmdrv, lsize, gsize) + call mct_gsMap_init(gsmap_atm, gindex, mpicom_lilac, ID_lilac, lsize, gsize) deallocate(gindex) ! initialize rearrangers between atm and land decomps - call mct_rearr_init(gsmap_atm, gsmap_lnd, mpicom_clmdrv, rearr_atm2lnd) - call mct_rearr_init(gsmap_lnd, gsmap_atm, mpicom_clmdrv, rearr_lnd2atm) + call mct_rearr_init(gsmap_atm, gsmap_lnd, mpicom_lilac, rearr_atm2lnd) + call mct_rearr_init(gsmap_lnd, gsmap_atm, mpicom_lilac, rearr_lnd2atm) ! initialize atm avects from land avects with atm lsize call mct_avect_init(x2l_a, x2l, lsize) From a0e9edf6bbc51cfe2d306af4a9496afa83ed741e Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Thu, 1 Mar 2018 14:48:06 -0700 Subject: [PATCH 0166/1973] Rename clmdrv and whitespace in driver. --- lilac/src/lilac-demo-driver.F90 | 93 ++++++++++++++++----------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/lilac/src/lilac-demo-driver.F90 b/lilac/src/lilac-demo-driver.F90 index 3857271be7..0694e387a1 100644 --- a/lilac/src/lilac-demo-driver.F90 +++ b/lilac/src/lilac-demo-driver.F90 @@ -1,4 +1,4 @@ -PROGRAM clmdrv +program lilac_demo_driver use lnd_comp_mct , only: lnd_init_mct, lnd_run_mct, lnd_final_mct use seq_flds_mod , only: & @@ -9,7 +9,6 @@ PROGRAM clmdrv use seq_infodata_mod, only: seq_infodata_type, seq_infodata_putdata, seq_infodata_getdata use shr_sys_mod , only: shr_sys_flush, shr_sys_abort use shr_orb_mod , only: shr_orb_params - use shr_file_mod , only: shr_file_setlogunit, shr_file_setloglevel use shr_pio_mod , only: shr_pio_init1, shr_pio_init2 use mct_mod use ESMF @@ -23,26 +22,26 @@ PROGRAM clmdrv type(ESMF_Time) :: CurrTime, StartTime, StopTime type(ESMF_TimeInterval) :: TimeStep type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar),target :: Calendar - integer :: yy,mm,dd,sec + type(ESMF_Calendar), target :: Calendar + integer :: yy, mm, dd, sec !----- MPI/MCT ----- - integer :: mpicom_clmdrv ! local mpicom - integer :: ID_clmdrv ! mct ID + integer :: mpicom_lilac ! local mpicom + integer :: ID_lilac ! mct ID integer :: ncomps ! number of separate components for MCT - integer :: ntasks,mytask ! mpicom size and rank + integer :: ntasks, mytask ! mpicom size and rank integer :: global_comm ! copy of mpi_comm_world for pio - integer,allocatable :: comp_id(:) ! for pio init2 - logical,allocatable :: comp_iamin(:) ! for pio init2 - character(len=64),allocatable :: comp_name(:) ! for pio init2 - integer,allocatable :: comp_comm(:), comp_comm_iam(:) ! for pio_init2 + integer, allocatable :: comp_id(:) ! for pio init2 + logical, allocatable :: comp_iamin(:) ! for pio init2 + character(len=64), allocatable :: comp_name(:) ! for pio init2 + integer, allocatable :: comp_comm(:), comp_comm_iam(:) ! for pio_init2 !----- Land Coupling Data ----- type(seq_cdata) :: cdata ! Input land-model driver data - type(seq_infodata_type),target :: infodata ! infodata type + type(seq_infodata_type), target :: infodata ! infodata type type(mct_aVect) :: x2l, l2x ! land model import and export states - type(mct_gGrid),target :: dom_lnd ! domain data for clm - type(mct_gsMap),target :: gsmap_lnd ! gsmap data for clm + type(mct_gGrid), target :: dom_lnd ! domain data for clm + type(mct_gsMap), target :: gsmap_lnd ! gsmap data for clm integer :: orb_iyear ! Orbital real*8 :: orb_eccen, orb_obliq, orb_mvelp, orb_obliqr, orb_lambm0, orb_mvelpp character(len=128) :: case_name, case_desc, model_version, hostname, username @@ -65,12 +64,12 @@ PROGRAM clmdrv type(mct_rearr) :: rearr_lnd2atm ! rearranger for land to atm !----- Other ----- - integer :: n,m ! counter + integer :: n, m ! counter character(len=128) :: string ! temporary string integer :: ierr, rc ! local error status - integer :: iunit = 250 ! clmdrv log unit number + integer :: iunit = 250 ! lilac log unit number integer :: sunit = 249 ! share log unit number - character(len=*),parameter :: subname = 'clmdrv' + character(len=*), parameter :: subname = 'lilac_demo_driver' !---------------------------------------------- class(lilac_t) :: lilac @@ -85,17 +84,17 @@ PROGRAM clmdrv ! need to provide this information to the component?! !--- set mpicom and cdata memory - cdata%name = 'cdata_clmdrv' - cdata%ID = ID_clmdrv - cdata%mpicom = mpicom_clmdrv + cdata%name = 'cdata_lilac' + cdata%ID = ID_lilac + cdata%mpicom = mpicom_lilac cdata%dom => dom_lnd cdata%gsmap => gsmap_lnd cdata%infodata => infodata !--- set case information - case_name = 'clmdrv' - case_desc = 'clmdrv with clm' - model_version = 'clmdrv0.1' + case_name = 'lilac' + case_desc = 'lilac with clm' + model_version = 'lilac0.1' hostname = 'undefined' username = 'undefined' start_type = 'startup' @@ -129,12 +128,12 @@ PROGRAM clmdrv call ESMF_ClockAdvance(EClock, rc=rc) call ESMF_ClockGet(EClock, currTime=CurrTime, rc=rc) call ESMF_TimeGet( CurrTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' clmdrv ymds=',yy,mm,dd,sec + write(iunit,'(1x,2a,4i6)') subname,' lilac ymds=', yy, mm, dd, sec call shr_sys_flush(iunit) ! can manually override the alarms as needed call ESMF_AlarmRingerOff(EAlarm_rest, rc=rc) - if (mod(dd,5)==0 .and. sec==0) call ESMF_AlarmRingerOn(EAlarm_rest,rc) + if (mod(dd, 5)==0 .and. sec==0) call ESMF_AlarmRingerOn(EAlarm_rest, rc) ! set the coupling data that is sent to the land model, this is on atm decomp ! this is just sample test data @@ -160,21 +159,21 @@ PROGRAM clmdrv call mct_rearr_rearrange(x2l_a, x2l, rearr_atm2lnd) ! diagnose - write(iunit,*) subname,' x2l fields: ',yy,mm,dd,sec - ! call diag_avect(x2l_a,mpicom_clmdrv,'x2l_a') - call diag_avect(x2l,mpicom_clmdrv,'x2l') + write(iunit,*) subname,' x2l fields: ', yy, mm, dd, sec + ! call diag_avect(x2l_a, mpicom_lilac,'x2l_a') + call diag_avect(x2l, mpicom_lilac,'x2l') ! run clm - write(iunit,*) subname,' call lnd_run_mct',yy,mm,dd,sec + write(iunit,*) subname,' call lnd_run_mct', yy, mm, dd, sec call lnd_run_mct(Eclock, cdata, x2l, l2x) ! rearrange data from land decomposition call mct_rearr_rearrange(l2x, l2x_a, rearr_lnd2atm) ! diagnose - write(iunit,*) subname,' l2x fields: ',yy,mm,dd,sec - call diag_avect(l2x,mpicom_clmdrv,'l2x') - ! call diag_avect(l2x_a,mpicom_clmdrv,'l2x_a') + write(iunit,*) subname,' l2x fields: ', yy, mm, dd, sec + call diag_avect(l2x, mpicom_lilac,'l2x') + ! call diag_avect(l2x_a, mpicom_lilac,'l2x_a') enddo lilac%Shutdown() @@ -195,8 +194,8 @@ SUBROUTINE diag_avect(av, mpicom, comment) character(len=*), intent(in) :: comment !--- local --- - integer :: n,k ! counters - integer :: npts,nptsg ! number of local/global pts in AV + integer :: n, k ! counters + integer :: npts, nptsg ! number of local/global pts in AV integer :: kflds ! number of fields in AV real*8, pointer :: sumbuf (:) ! sum buffer real*8, pointer :: sumbufg(:) ! sum buffer reduced @@ -205,41 +204,41 @@ SUBROUTINE diag_avect(av, mpicom, comment) character(len=128):: itemc ! string converted to char !----- formats ----- - character(*),parameter :: subName = '(diag_avect) ' + character(*), parameter :: subName = '(diag_avect) ' !---------------------------------------------------------------- npts = mct_aVect_lsize(AV) kflds = mct_aVect_nRattr(AV) - allocate(sumbuf(kflds),sumbufg(kflds)) + allocate(sumbuf(kflds), sumbufg(kflds)) sumbuf = 0.0 - do k = 1,kflds - do n = 1,npts - sumbuf(k) = sumbuf(k) + (AV%rAttr(k,n)) + do k = 1, kflds + do n = 1, npts + sumbuf(k) = sumbuf(k) + (AV%rAttr(k, n)) enddo enddo - call MPI_REDUCE(sumbuf,sumbufg,kflds,MPI_REAL8,MPI_SUM,0,mpicom,ierr) - call MPI_COMM_RANK(mpicom,iam,ierr) + call MPI_REDUCE(sumbuf, sumbufg, kflds, MPI_REAL8, MPI_SUM, 0, mpicom, ierr) + call MPI_COMM_RANK(mpicom, iam, ierr) if (iam == 0) then - do k = 1,kflds - call mct_aVect_getRList(mstring,k,AV) + do k = 1, kflds + call mct_aVect_getRList(mstring, k, AV) itemc = mct_string_toChar(mstring) call mct_string_clean(mstring) - write(iunit,101) trim(comment),k,sumbufg(k),trim(itemc) + write(iunit, 101) trim(comment), k, sumbufg(k), trim(itemc) enddo call shr_sys_flush(iunit) endif - deallocate(sumbuf,sumbufg) + deallocate(sumbuf, sumbufg) -101 format('comm_diag ',a,1x,i3,es26.19,1x,a) +101 format('comm_diag ', a, 1x, i3, es26.19, 1x, a) end subroutine diag_avect !====================================================================== -end PROGRAM clmdrv +end program lilac_demo_driver From f42c1566e5092b2b3fb0adefa655c88d65aef21a Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Thu, 1 Mar 2018 15:12:21 -0700 Subject: [PATCH 0167/1973] start on lilac init data. --- lilac/src/lilac-demo-driver.F90 | 18 +++++++++++++----- lilac/src/lilac.F90 | 22 ++++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lilac/src/lilac-demo-driver.F90 b/lilac/src/lilac-demo-driver.F90 index 0694e387a1..1d82475511 100644 --- a/lilac/src/lilac-demo-driver.F90 +++ b/lilac/src/lilac-demo-driver.F90 @@ -72,13 +72,21 @@ program lilac_demo_driver character(len=*), parameter :: subname = 'lilac_demo_driver' !---------------------------------------------- + type(lilac_init_data_t) :: lilac_init_data class(lilac_t) :: lilac - !---------------------------------------------- - !--- MPI/MCT --- - !---------------------------------------------- + ! + ! Initialize lilac + ! + + ! Where should these come from in general? namelist? + call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_lilac, ierr) + call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_component, ierr) + lilac_init_data%output_unit_lilac = 250 + lilac_init_data%output_unit_component = 249 + - lilac%Init() + lilac%Init(lilac_init_data) ! FIXME(bja, 2018-02) don't want to use the cdata structure, but we still ! need to provide this information to the component?! @@ -94,7 +102,7 @@ program lilac_demo_driver !--- set case information case_name = 'lilac' case_desc = 'lilac with clm' - model_version = 'lilac0.1' + model_version = 'lilac-v0.1' hostname = 'undefined' username = 'undefined' start_type = 'startup' diff --git a/lilac/src/lilac.F90 b/lilac/src/lilac.F90 index c4671e8570..f1fc35e951 100644 --- a/lilac/src/lilac.F90 +++ b/lilac/src/lilac.F90 @@ -6,7 +6,15 @@ module lilac implicit none private - type, abstract :: lilac_t + type :: lilac_init_data_t + integer :: mpicom_lilac + integer :: mpicom_component + integer :: output_unit_lilac ! for lilac and 'shr' output + integer :: output_unit_component + + end type lilac_init_data_t + + type :: lilac_t private contains ! Public API @@ -85,7 +93,9 @@ subroutine lilac_init_parallel(this) class(lilac_t), intent(inout) :: this + ! should be safe if previously initialized call MPI_Init(ierr) + ! Don't really want to dup comp_world, should be call MPI_Comm_Dup(MPI_COMM_WORLD, mpicom_comp, ierr) call MPI_COMM_RANK(mpicom_comp, mytask, ierr) call MPI_COMM_SIZE(mpicom_comp, ntasks, ierr) @@ -145,11 +155,11 @@ subroutine lilac_init_clocks(this) class(lilac_t), intent(inout) :: this - type(ESMF_Clock) :: EClock ! Input synchronization clock - type(ESMF_Time) :: CurrTime, StartTime, StopTime - type(ESMF_TimeInterval) :: TimeStep - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar), target :: Calendar + type(ESMF_Clock) :: EClock ! Input synchronization clock + type(ESMF_Time) :: CurrTime, StartTime, StopTime + type(ESMF_TimeInterval) :: TimeStep + type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest + type(ESMF_Calendar), target :: Calendar call ESMF_Initialize(rc=rc) Calendar = ESMF_CalendarCreate( name='lilac_NOLEAP', & From 092b1a8c2fff8354ede815819edd8931685ada2f Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Thu, 1 Mar 2018 17:30:42 -0700 Subject: [PATCH 0168/1973] More refactoring of clocks, input units, mpi vars in lilac and driver initialization. --- lilac/src/lilac-demo-driver.F90 | 55 +++++++++--- lilac/src/lilac.F90 | 146 +++++++++++++++++++++----------- 2 files changed, 140 insertions(+), 61 deletions(-) diff --git a/lilac/src/lilac-demo-driver.F90 b/lilac/src/lilac-demo-driver.F90 index 1d82475511..39f28dac73 100644 --- a/lilac/src/lilac-demo-driver.F90 +++ b/lilac/src/lilac-demo-driver.F90 @@ -18,7 +18,7 @@ program lilac_demo_driver #include ! mpi library include file !----- Clocks ----- - type(ESMF_Clock) :: EClock ! Input synchronization clock + type(ESMF_Clock) :: driver_clock type(ESMF_Time) :: CurrTime, StartTime, StopTime type(ESMF_TimeInterval) :: TimeStep type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest @@ -71,22 +71,42 @@ program lilac_demo_driver integer :: sunit = 249 ! share log unit number character(len=*), parameter :: subname = 'lilac_demo_driver' + logical :: debug = true !---------------------------------------------- type(lilac_init_data_t) :: lilac_init_data + type(lilac_clock_data_t) :: lilac_clock_data class(lilac_t) :: lilac + ! + ! Initialize the driver + ! + + call setup_demo_driver_clock(driver_clock) + ! ! Initialize lilac ! - ! Where should these come from in general? namelist? + ! Hard code values normally supplied by the driver call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_lilac, ierr) call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_component, ierr) - lilac_init_data%output_unit_lilac = 250 - lilac_init_data%output_unit_component = 249 - - - lilac%Init(lilac_init_data) + lilac_init_data%output_unit_global_shared = 250 + lilac_init_data%output_unit_lilac = 251 + lilac_init_data%output_unit_component = 252 + + ! FIXME(bja, 2018-02) use namelist so the demo driver can serve as a test driver + lilac_clock_data%calendar_is_leap = .false. + lilac_clock_data%start_year = 2000 + lilac_clock_data%start_month = 1 + lilac_clock_data%start_day = 1 + lilac_clock_data%start_seconds = 0 + lilac_clock_data%stop_year = 2000 + lilac_clock_data%stop_month = 1 + lilac_clock_data%stop_day = 5 + lilac_clock_data%stop_seconds = 0 + lilac_clock_data%timestep_seconds = 3600 + + call lilac%Init(lilac_init_data, lilac_clock_data, debug) ! FIXME(bja, 2018-02) don't want to use the cdata structure, but we still ! need to provide this information to the component?! @@ -131,12 +151,12 @@ program lilac_demo_driver !--- Time Loop --- !---------------------------------------------- - call ESMF_ClockGet(Eclock, currTime=CurrTime, rc=rc) - do while (CurrTime < StopTime) - call ESMF_ClockAdvance(EClock, rc=rc) - call ESMF_ClockGet(EClock, currTime=CurrTime, rc=rc) - call ESMF_TimeGet( CurrTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' lilac ymds=', yy, mm, dd, sec + call ESMF_ClockGet(driver_clock, currTime=driver_current_time, rc=rc) + do while (driver_current_time < driver_stop_time) + call ESMF_ClockAdvance(driver_clock, rc=rc) + call ESMF_ClockGet(driver_clock, currTime=driver_current_time, rc=rc) + call ESMF_TimeGet(driver_current_time, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(iunit,'(1x,2a,4i6)') subname,'lilac demo driver ymds=', yy, mm, dd, sec call shr_sys_flush(iunit) ! can manually override the alarms as needed @@ -248,5 +268,14 @@ SUBROUTINE diag_avect(av, mpicom, comment) end subroutine diag_avect !====================================================================== + + subroutine setup_demo_driver_clocks() + + implicit none + + + + end subroutine setup_demo_driver_clocks + end program lilac_demo_driver diff --git a/lilac/src/lilac.F90 b/lilac/src/lilac.F90 index f1fc35e951..f3fd3e22a7 100644 --- a/lilac/src/lilac.F90 +++ b/lilac/src/lilac.F90 @@ -6,16 +6,38 @@ module lilac implicit none private + integer, parameter :: lilac_master_proc = 0 + + type :: lilac_clock_data_t + logical :: calendar_is_leap + integer :: start_year + integer :: start_month + integer :: start_day + integer :: start_second ! seconds since midnight + + integer :: stop_year + integer :: stop_month + integer :: stop_day + integer :: stop_second ! seconds since midnight + + integer :: time_step_seconds + end type lilac_clock_data_t + type :: lilac_init_data_t integer :: mpicom_lilac integer :: mpicom_component - integer :: output_unit_lilac ! for lilac and 'shr' output + integer :: output_unit_lilac + integer :: output_unit_global_shared ! this should be the same for all instances of lilac! integer :: output_unit_component end type lilac_init_data_t type :: lilac_t private + type(ESMF_Clock) :: driver_clock + integer :: my_mpi_rank + integer :: num_mpi_tasks + integer :: mct_comp_id contains ! Public API procedure :: Init => lilac_init @@ -45,15 +67,20 @@ module lilac ! ! Public API ! - subroutine lilac_init(this) + subroutine lilac_init(this, init_data, clock_data, debug) use mct_mod, only : mct_world_init implicit none class(lilac_t), intent(inout) :: this + type(lilac_init_data_t), intent(in) :: init_data + type(lilac_clock_data_t), intent(in) :: clock_data - call this%lilac_init_parallel() + logical, intent(in) :: debug + + call this%lilac_init_parallel(init_data%mpicom_lilac, init_data%mpicom_component) + call this%lilac_init_logging(init_data%output_unit_lilac, init_data%output_unit_component) end subroutine lilac_init @@ -72,21 +99,21 @@ subroutine lilac_shutdown(this) class(lilac_t), intent(inout) :: this ! FIXME(bja, 2018-02) master proc only! - write(this%iunit, *) 'lilac shutting down...' - call shr_sys_flush(this%iunit) + write(this%output_unit, *) 'lilac shutting down...' + call shr_sys_flush(this%output_unit) call this%lilac_shutdown_land() call this%lilac_shutdown_parallel() ! FIXME(bja, 2018-02) master proc only! - write(this%iunit, *) 'lilac shut down complete.' + write(this%output_unit, *) 'lilac shut down complete.' end subroutine lilac_shutdown ! ! Private work functions ! - subroutine lilac_init_parallel(this) + subroutine lilac_init_parallel(this, mpicom_lilac, mpicom_component, mpicom_global_shared) ! Initialize parallel components, e.g. MPI, MCT implicit none @@ -95,33 +122,40 @@ subroutine lilac_init_parallel(this) ! should be safe if previously initialized call MPI_Init(ierr) - ! Don't really want to dup comp_world, should be - call MPI_Comm_Dup(MPI_COMM_WORLD, mpicom_comp, ierr) - call MPI_COMM_RANK(mpicom_comp, mytask, ierr) - call MPI_COMM_SIZE(mpicom_comp, ntasks, ierr) - num_comps = 1 - ID_comp = 1 + call MPI_COMM_RANK(mpicom_lilac, this%my_mpi_rank, ierr) + call MPI_COMM_SIZE(mpicom_lilac, this%num_mpi_tasks, ierr) + + this%mct_num_comps = 1 + this%mct_comp_id = 1 + ! NOTE(bja, 2018-02) this should eventually be initialized on the union of + ! the lilac and component communicators! call mct_world_init(num_comps, MPI_COMM_WORLD, mpicom_lilac, ID_comp) end subroutine lilac_init_parallel - subroutine lilac_init_logging(this) + subroutine lilac_init_logging(this, output_unit_lilac, output_unit_global_shared) implicit none class(lilac_t), intent(inout) :: this - write(string,'(a,i4.4)') 'lilac.log.', mytask - open(iunit, file=trim(string)) - write(iunit,*) subname,' STARTING' - call shr_sys_flush(iunit) + ! open logfile for lilac + + this%output_unit = output_unit_lilac - write(iunit,*) subname, ' ntasks = ', ntasks - write(iunit,*) subname, ' mytask = ', mytask - write(iunit,*) subname, ' mct ID = ', ID_comp - call shr_sys_flush(iunit) - call shr_file_setLogUnit(sunit) + write(log_file_name,'(a,i4.4)') 'lilac.log.', this%my_mpi_rank + open(this%output_unit, file=trim(log_file_name)) + if (this%my_mpi_rank == lilac_master_proc) then + write(this%output_unit, *) subname,' starting lilac' + write(this%output_unit, *) subname, ' num lilac tasks = ', this%num_mpi_tasks + write(this%output_unit, *) subname, ' my_mpi_rank = ', this%my_mpi_rank + write(this%output_unit, *) subname, ' mct component ID = ', this%mct_comp_id + call shr_sys_flush(this%output_unit) + end if + + ! NOTE(bja, 2018-02) these are setting global variables! + call shr_file_setLogUnit(mpicom_global_shared) call shr_file_setLogLevel(1) end subroutine lilac_init_logging @@ -147,40 +181,56 @@ subroutine lilac_init_io(this) end subroutine lilac_init_io - subroutine lilac_init_clocks(this) + subroutine lilac_init_clocks(this, clock_data) use ESMF implicit none class(lilac_t), intent(inout) :: this + type(lilac_clock_data_t), intent(in) :: clock_data - type(ESMF_Clock) :: EClock ! Input synchronization clock - type(ESMF_Time) :: CurrTime, StartTime, StopTime - type(ESMF_TimeInterval) :: TimeStep + type(ESMF_Time) :: current_time, start_time, stop_time + type(ESMF_TimeInterval) :: time_step type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar), target :: Calendar + type(ESMF_Calendar), target :: calendar ! FIXME(bja, 2018-02) does this need to be freed? + integer :: cal_kind_flag + + if (clock_data%calendar_is_leap) then + cal_kind_flag = ? + else + cal_kind_flag = ESMF_CALKIND_NOLEAP + end if + ! FIXME(bja, 2018-02) verify it is to call multiple times if driver uses + ! esmf or there are multiple lilac instances...? call ESMF_Initialize(rc=rc) - Calendar = ESMF_CalendarCreate( name='lilac_NOLEAP', & - calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) - call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) - EClock = ESMF_ClockCreate(name='lilac_EClock', & - TimeStep=TimeStep, startTime=StartTime, & - RefTime=StartTime, stopTime=stopTime, rc=rc) - - EAlarm_stop = ESMF_AlarmCreate(name='seq_timemgr_alarm_stop' , & + + calendar = ESMF_CalendarCreate( name='lilac', calkindflag=cal_kind_flag, rc=rc ) + call ESMF_TimeSet(start_time, yy=clock_data%start_year, mm=clock_data%start_month, & + dd=clock_data%start_day, s=clock_data%start_seconds, calendar=calendar, rc=rc) + + call ESMF_TimeSet(stop_time , yy=clock_data%stop_year, mm=clock_data%stop_month, & + dd=clock_data%stop_day, s=clock_data%stop_seconds, calendar=Calendar, rc=rc) + + call ESMF_TimeIntervalSet(time_step, s=clock_data%time_step_seconds, rc=rc) + + this%lilac_clock = ESMF_ClockCreate(name='lilac_clock', & + TimeStep=time_step, startTime=start_time, & + RefTime=start_time, stopTime=stop_time, rc=rc) + + EAlarm_stop = ESMF_AlarmCreate(name='alarm_stop' , & clock=EClock, ringTime=StopTime, rc=rc) - EAlarm_rest = ESMF_AlarmCreate(name='seq_timemgr_alarm_restart', & + EAlarm_rest = ESMF_AlarmCreate(name='alarm_restart', & clock=EClock, ringTime=StopTime, rc=rc) - call ESMF_TimeGet( StartTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=', yy, mm, dd, sec - call ESMF_TimeGet( StopTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=', yy, mm, dd, sec - call shr_sys_flush(iunit) + if (this%debug) then + call ESMF_TimeGet( start_time, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(this%output_unit,'(1x,2a,4i6)') subname,' start time ymds=', yy, mm, dd, sec + call ESMF_TimeGet( stop_time, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + write(this%output_unit,'(1x,2a,4i6)') subname,' stop time ymds=', yy, mm, dd, sec + call shr_sys_flush(this%output_unit) + end if end subroutine lilac_init_clocks @@ -229,8 +279,8 @@ subroutine lilac_init_land(this) implicit none - write(iunit,*) subname,' calling lnd_init_mct' - call shr_sys_flush(iunit) + write(this%output_unit,*) subname,' calling lnd_init_mct' + call shr_sys_flush(this%output_unit) call lnd_init_mct(Eclock, cdata, x2l, l2x) call diag_avect(l2x, mpicom_lilac,'l2x_init') @@ -274,7 +324,7 @@ subroutine lilac_init_coupling(this) m = n-gstart+1 gindex(m) = n end do - write(iunit,'(1x,2a,5i8)') subname,' atm decomp = ', mytask, gsize, lsize, gstart, gend + write(this%output_unit,'(1x,2a,5i8)') subname,' atm decomp = ', mytask, gsize, lsize, gstart, gend ! initialize land grid on atm decomp call mct_gsMap_init(gsmap_atm, gindex, mpicom_lilac, ID_lilac, lsize, gsize) @@ -298,7 +348,7 @@ subroutine lilac_shutdown_land(this) class(lilac_t), intent(inout) :: this - write(iunit, *) 'lilac shutting down component ', this%comp_name + write(this%output_unit, *) 'lilac shutting down component ', this%comp_name call lnd_final_mct(Eclock, cdata, x2l, l2x) end subroutine lilac_shutdown_land From 025d7de236febfbb47d2fcbe5b6477ab68dd969d Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Mon, 5 Mar 2018 16:23:39 -0700 Subject: [PATCH 0169/1973] modified error notices in FUN tech note --- .../tech_note/DGVM/CLM50_Tech_Note_DGVM.rst | 144 +++--------------- .../tech_note/FUN/CLM50_Tech_Note_FUN.rst | 8 +- .../CLM50_Tech_Note_Plant_Respiration.rst | 11 +- .../References/CLM50_Tech_Note_References.rst | 13 ++ 4 files changed, 49 insertions(+), 127 deletions(-) diff --git a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst index 01442e5eb9..eb6d3370d9 100644 --- a/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst +++ b/doc/source/tech_note/DGVM/CLM50_Tech_Note_DGVM.rst @@ -223,7 +223,7 @@ individual-based approach). A signature feature of the ED model is the system by which `functionally equivalent` patches and cohorts are fused into single model entities to save memory and computational time. -[1]_ This functionality requires that criteria are established for the +This functionality requires that criteria are established for the meaning of `functional equivalence`, which are by necessity slightly subjective, as they represent ways of abstracting reality into a more tractable mathematical representation. As an example of this, for @@ -242,7 +242,7 @@ adjust the trade-off between simulation accuracy and computational load. There is no theoretical optimal value for this threshold but it may be altered to have finer or coarser model resolutions as needed. -[2]_ Similarly, for common-disturbance-history patches, we again assign +Similarly, for common-disturbance-history patches, we again assign a threshold criteria, which is then compared to the difference between patches :math:`m` and :math:`n`, and if the difference is less than some threshold value (:math:`t_{p}`) then patches are merged together, @@ -287,7 +287,7 @@ similar patches reach their fusion threshold. This approach maintains an even discretization along the biomass gradient, in contrast to, for example, simply fusing the oldest or youngest patches together. -[3]_ The area of the new patch (:math:`A_{patch,o}`, m\ :math:`^{2}`) +The area of the new patch (:math:`A_{patch,o}`, m\ :math:`^{2}`) is the sum of the area of the two existing patches, .. math:: A_{patch,o} = A_{patch,n} + A_{patch,m} @@ -300,7 +300,7 @@ with mass conservation . Linked Lists: the general code structure of FATES --------------------------------------------------- -[4]_ The number of patches in each natural vegetation column and the +The number of patches in each natural vegetation column and the number of cohorts in any given patch are variable through time because they are re-calculated for each daily timestep of the model. The more complex an ecosystem, the larger the number of patches and cohorts. For @@ -513,7 +513,7 @@ and passed into the ED code as the major driver of vegetation dynamics. Initialization of vegetation from bare ground ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -[5]_If the model is restarted from a bare ground state (as opposed to a +If the model is restarted from a bare ground state (as opposed to a pre-existing vegetation state), the state variables above are initialized as follows. First, the number of plants per PFT is allocated according to the initial seeding density (:math:`S_{init}`, individuals @@ -584,7 +584,7 @@ biomass, assigned per PFT Allocation of biomass ^^^^^^^^^^^^^^^^^^^^^ -[6]_Total live biomass :math:`b_{alive}` is the state variable of the model +Total live biomass :math:`b_{alive}` is the state variable of the model that describes the sum of the three live biomass pools leaf :math:`b_{leaf}`, root :math:`b_{root}` and sapwood :math:`b_{sw}` (all in kGC individual\ :math:`^{-1}`). The quantities are constrained by the @@ -693,7 +693,7 @@ To calculated the sapwood biomass, we use Canopy Structure and the Perfect Plasticity Approximation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -[7]_During initialization and every subsequent daily ED timestep, the canopy +During initialization and every subsequent daily ED timestep, the canopy structure model is called to determine how the leaf area of the different cohorts is arranged relative to the incoming radiation, which will then be used to drive the radiation and photosynthesis @@ -824,7 +824,7 @@ found in the code references in the footnote. Horizontal Canopy Spread ------------------------- -[8]_:ref:`Purves et al. 2008` estimated the ratio between canopy and +:ref:`Purves et al. 2008` estimated the ratio between canopy and stem diameter :math:`c_{p}` as 0.1 m cm\ :math:`^{-1}` for canopy trees in North American forests, but this estimate was made on trees in closed canopies, whose shape is subject to space competition from other @@ -885,7 +885,7 @@ However, the model is relatively insensitive to the choice of either Definition of Leaf and Stem Area Profile ---------------------------------------- -[9]_Within each patch, the model defines and tracks cohorts of multiple +Within each patch, the model defines and tracks cohorts of multiple plant functional types that exist either in the canopy or understorey. Light on the top leaf surface of each cohort in the canopy is the same, and the rate of decay through the canopy is also the same for each PFT. @@ -932,7 +932,7 @@ is complex and not particularly amenable to the use of, for example, assumptions of random distribution in space that are typically used to calculate leaf area from light interception. :ref:`Kucharik et al. 1998` estimated that SAI visible from an -LAI2000 sensor was around 0.5 m^2 m^-2. :ref:`Low et al. 2001` +LAI2000 sensor was around 0.5 m^2 m^-2. Low et al. 2001 estimate that the wood area index for Ponderosa Pine forest is 0.27-0.33. The existing CLM(CN) algorithm sets the minimum SAI at 0.25 to match MODIS observations, but then allows SAI to rise as a function @@ -1127,7 +1127,7 @@ Radiation Transfer Fundamental Radiation Transfer Theory ------------------------------------- -[10]_The first interaction of the land surface with the properties of +The first interaction of the land surface with the properties of vegetation concerns the partitioning of energy into that which is absorbed by vegetation, reflected back into the atmosphere, and absorbed by the ground surface. Older versions of the CLM have utilized a @@ -1518,7 +1518,7 @@ Photosynthesis Fundamental photosynthetic physiology theory -------------------------------------------- -[11]_In this section we describe the physiological basis of the +In this section we describe the physiological basis of the photosynthesis model before describing its application to the FATES canopy structure. This description in this section is largely repeated from the Oleson et al. CLM4.5 technical note but included here for @@ -1762,7 +1762,7 @@ m\ :math:`^{-2}` s\ :math:`^{-1}`. Water Stress on gas exchange ---------------------------- -[12]_ The top of canopy leaf photosynthetic capacity, :math:`V_{c,max0}`, is +The top of canopy leaf photosynthetic capacity, :math:`V_{c,max0}`, is also adjusted for the availability of water to plants as .. math:: V_{c,max0,25} = V_{c,max0,25} \beta_{sw}, @@ -1918,7 +1918,7 @@ timestep to give KgC cohort\ :math:`^{-1}` day\ :math:`^{-1}` Plant respiration ^^^^^^^^^^^^^^^^^^ -[13]_Plant respiration per individual :math:`R_{plant,coh}` (KgC individual +Plant respiration per individual :math:`R_{plant,coh}` (KgC individual :math:`^{-1}` s\ :math:`^{-1}`) is the sum of two terms, growth and maintenance respiration :math:`R_{g,coh}` and :math:`R_{m,coh}` @@ -2057,7 +2057,7 @@ Stomatal Conductance Fundamental stomatal conductance theory --------------------------------------- -[14]_Stomatal conductance is unchanged in concept from the CLM4.5 approach. +Stomatal conductance is unchanged in concept from the CLM4.5 approach. Leaf stomatal resistance is calculated from the Ball-Berry conductance model as described by :ref:`Collatz et al. (1991)` and implemented in a global climate model by :ref:`Sellers et al. 1996`. The model @@ -2142,7 +2142,7 @@ cohort. Allocation and Growth ^^^^^^^^^^^^^^^^^^^^^ -[15]_Total assimilation carbon enters the ED model each day as a +Total assimilation carbon enters the ED model each day as a cohort-specific Net Primary Productivity :math:`\mathit{NPP}_{coh}`, which is calculated as @@ -2296,7 +2296,7 @@ KgC individual :math:`^{-1}` y\ :math:`^{-1}`) is thus Allocation to growing pools --------------------------- -[16]_ The carbon is then partitioned into carbon available to grow the +The carbon is then partitioned into carbon available to grow the :math:`b_{alive}` and :math:`b_{struc}` pools. A fraction :math:`v_{a}` is available to live biomass pools, and a fraction :math:`v_{s}` is available to structural pools. @@ -2449,7 +2449,7 @@ In this case, :math:`\delta t` is set to be one day Control of Leaf Area Index ^^^^^^^^^^^^^^^^^^^^^^^^^^ -[17]_The leaf area :math:`A_{leaf}` (m:math:`^{-2}`) of each cohort is +The leaf area :math:`A_{leaf}` (m:math:`^{-2}`) of each cohort is calculated from leaf biomass :math:`b_{leaf,coh}` (kgC individual\ :math:`^{-1}`) and specific leaf area (SLA, m\ :math:`^2` kg C\ :math:`^{-1}`) @@ -2548,7 +2548,7 @@ Cold Deciduous Phenology Cold Leaf-out timing ~~~~~~~~~~~~~~~~~~~~ -[18]_. The phenology model of :ref:`Botta et al. 2000` is used in +The phenology model of :ref:`Botta et al. 2000` is used in FATES to determine the leaf-on timing. The Botta et al. model was verified against satellite data and is one of the only globally verified and published models of leaf-out phenology. This model differs from the @@ -2639,7 +2639,7 @@ the science tag is released. Carbon Dynamics of deciduous plants ----------------------------------- -[19]_In the present version, leaf expansion and senescence happen over the +In the present version, leaf expansion and senescence happen over the course of a single day. This is clearly not an empirically robust representation of leaf behaviour, whereby leaf expansion occurs over a period of 10-14 days, and senescence over a similar period. This will be @@ -2718,7 +2718,7 @@ Seed Dynamics and Recruitment ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -[20]_The production of seeds and their subsequent germination is a process +The production of seeds and their subsequent germination is a process that must be captured explicitly or implicitly in vegetation models. FATES contains a seed bank model designed to allow the dynamics of seed production and germination to be simulated independently. In the ED1.0 model, seed recruitment occurs in the same timestep as allocation @@ -2841,7 +2841,7 @@ year\ :math:`^{-1}`, are calculated as Litter Inputs ------------- -[21]_Inputs into the litter pools come from tissue turnover, mortality of +Inputs into the litter pools come from tissue turnover, mortality of canopy trees, mortality of understorey trees, mortality of seeds, and leaf senescence of deciduous plants. @@ -2870,7 +2870,7 @@ assigned to each (:math:`f_{lsc}` and :math:`f_{ag}`) Litter Outputs -------------- -[22]_The fragmenting litter pool is available for burning but not for +The fragmenting litter pool is available for burning but not for respiration or decomposition. Fragmentation rates are calculated according to a maximum fragmentation rate (:math:`\alpha_{cwd,lsc}` or :math:`\alpha_{litter}`) which is ameliorated by a temperature and water @@ -2898,7 +2898,7 @@ sensitivity analyses of the model outputs. Flux into decompsition cascade ------------------------------ -[23]_Upon fragmentation and release from the litter pool, carbon is +Upon fragmentation and release from the litter pool, carbon is transferred into the labile, lignin and cellulose decomposition pools. These pools are vertically resolved in the biogeochemistry model. The movement of carbon into each vertical layer is obviously different for @@ -3063,7 +3063,7 @@ fire modelling section. Fire (SPITFIRE) ^^^^^^^^^^^^^^^^^ -[24]_The influence of fire on vegetation is estimated using the SPITFIRE +The influence of fire on vegetation is estimated using the SPITFIRE model, which has been modified for use in ED following it’s original implementation in the LPJ-SPITFIRE model (:ref:`Thonicke et al. 2010`, :ref:`Pfeiffer et al. 2013`). This model as @@ -3501,99 +3501,5 @@ within the area affected by fire is a function of the ratio between | s}` | parameter | | | +-----------------+-----------------+-----------------+-----------------+ -.. raw:: latex - - \bigskip - -| - -.. raw:: latex - - -.. [1] - This description covers algorithms in the ‘fuse_cohorts’ subroutine. - -.. [2] - This description covers algorithms in the ‘fuse_patches’ subroutine. - -.. [3] - This description covers algorithms in the ‘fuse_2_patches’ - subroutine. - -.. [4] - This description covers the structure of code in all modules in - clm4_5 that are located in ‘ED’ subdirectories - -.. [5] - This description covers algorithms in the ‘init_cohorts’ subroutine - -.. [6] - This description relates to algorithms in the allocate_live_biomass - subroutine - -.. [7] - This description relates to algorithms in the EDCanopyStructure - subroutine - -.. [8] - This description relates to algorithms in the canopy_spread - subroutine - -.. [9] - This description relates to algorithms in the - canopy_leaf_area_profile subroutine - -.. [10] - This description relates to algorithms in the ED_norman_radiation - subroutine - -.. [11] - This description relates to algorithms in the ED_photosynthesis - subroutine - -.. [12] - This description relates to algorithms in the ED_btran subroutine - -.. [13] - This description relates to algorithms in the ED_photosynthesis - subroutine - -.. [14] - This description relates to algorithms in the ED_photosynthesis - subroutine - -.. [15] - This description relates to algorithms in the Growth_Derivatives - subroutine - -.. [16] - This description relates to algorithms in the ED_GrowthFunctions - subroutine - -.. [17] - This description relates to algorithms in the trim_canopy subroutine - -.. [18] - This description relates to algorithms in the phenology subroutine - -.. [19] - This description relates to algorithms in the phenology_leafoff - subroutine - -.. [20] - This description relates to algorithms in the seed_in, seed_decay and - seed_germination subroutines - -.. [21] - This description relates to algorithms in the CWD_input, - mortality_litter_fluxes and fire_litter_fluxes subroutines - -.. [22] - This description relates to algorithms in the CWD_out subroutine -.. [23] - This description relates to algorithms in the flux_into_litter_pools - subroutine -.. [24] - This description relates to algorithms in the ’SFMainMod’ subroutines diff --git a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst index 74dc2cf6dd..1b769042f7 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -175,7 +175,7 @@ First we calculate the cost of extraction (:math:`cost_{retrans}`, gC/gN) for th cost_{retrans}= k_{retrans} / (1/CN_{fallingleaf})^{1.3} -where :math:`k_{retrans}` is a parameter controlling the overall cost of resorption, which also increases exponentially as the C:N ratio increases **Say something about 1.3 exponent**). +where :math:`k_{retrans}` is a parameter controlling the overall cost of resorption, which also increases exponentially as the C:N ratio increases Next, we calculate the amount of C needed to be spent to increase the falling leaf C:N ratio by 1.0 in this iteration :math:`i` (:math:`C_{retrans_spent,i}`, gC m\ :sup:`-2`) as: .. math:: @@ -274,12 +274,12 @@ and the other C and N fluxes can be determined following the logic above. Modifications to allow variation in C:N ratios -------------------------------------------------------- -The original FUN model as developed by :ref:`Fisher et al. (2010)` and :ref:`Brzostek et al. (2014)` assumes a fixed plant tissue C:N ratio. This means that in the case where N is especially limiting, all excess carbon will be utilized in an attempt to take up more Nitrogen. It has been repeatedly observed, however, that in these circumstances in real life, plants have some flexibility in the C:N stoichiometry of their tissues, and therefore, this assumption may not be realistic. **lit review on CN ratios** +The original FUN model as developed by :ref:`Fisher et al. (2010)` and :ref:`Brzostek et al. (2014)` assumes a fixed plant tissue C:N ratio. This means that in the case where N is especially limiting, all excess carbon will be utilized in an attempt to take up more Nitrogen. It has been repeatedly observed, however, that in these circumstances in real life, plants have some flexibility in the C:N stoichiometry of their tissues, and therefore, this assumption may not be realistic. However, the degree to which the C:N ratio varies with N availability is poorly documented, and existing global nitrogen models use a variety of heuristic methods by which to incorporate changing C:N ratios (Zaehle and Friend 2010; Ghimire et al. 2016). This algorithm exists as a placeholder to allow variable C:N ratios to occur, and to allow exploration of how much the parameters controlling their flexibility has on model outcomes. Incorporation of emerging understanding of the controls on tissue stoichiometry should ultimately replace this scheme. Thus, in CLM5, we introduce the capacity for tissue C:N ratios to be prognostic, rather than static. Overall N and C availability (:math:`N_{uptake}` and :math:`C_{growth}`) and hence tissue C:N ratios, are both determined by FUN. Allocation to individual tissues is discussed in the allocation chapter Here we introduce an algorithm which adjusts the C expenditure on uptake to allow varying tissue C:N ratios. Increasing C spent on uptake will directly reduce the C:N ratio, and reducing C spent on uptake (retaining more for tissue growth) will increase it. C spent on uptake is impacted by both the N cost in the environment, and the existing tissue C:N ratio of the plant. The output of this algorithm is :math:`\gamma_{FUN}`, the fraction of the ideal :math:`C_{nuptake}` calculated from -the FUN equation above (**link equation**). +the FUN equation above .. math:: C_{nuptake} = C_{nuptake}.\gamma_{FUN} @@ -297,7 +297,7 @@ where :math:`a_{cnflex}` and :math:`b_{cnflex}` are parameters fitted to give fl Response of C expenditure to plant C:N ratios ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -We first calculate a :math:`\delta_{CN}`, which is the difference between the target C:N (:math:`target_{CN}`) a model parameter, and the existing C:N ratio (:math:`CN_{plant}`) **This isn't strictly how it is worked out. Need to remember why we use c_allometry instead**. +We first calculate a :math:`\delta_{CN}`, which is the difference between the target C:N (:math:`target_{CN}`) a model parameter, and the existing C:N ratio (:math:`CN_{plant}`) .. math:: diff --git a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst index 33b9477ed1..8ec6f1d1fb 100644 --- a/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst +++ b/doc/source/tech_note/Plant_Respiration/CLM50_Tech_Note_Plant_Respiration.rst @@ -2,7 +2,9 @@ Plant Respiration ================= - +CLM5 includes changes to plant respiration including + - A new leaf respiration algorithm based on Atkin et al. (2016) + - A lower growth respiration coefficient, based on Atkin et al. (2017) Autotrophic Respiration ---------------------------- @@ -17,7 +19,7 @@ carbon cost for the synthesis of new growth. Maintenance Respiration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Atkin et al. (2016) propose a model for respiration that is based on the leaf nitrogen content per unit area (:math:`NS_{narea}` (gN m :sup:`2` leaf), with an intercept parameter that is PFT dependant, and an acclimation term that depends upon the average temperature of the previous 10 day period :math:`t_{2m,10days}`, in Celsius. +Atkin et al. (2016) propose a model for leaf respiration that is based on the leaf nitrogen content per unit area (:math:`NS_{narea}` (gN m :sup:`2` leaf), with an intercept parameter that is PFT dependant, and an acclimation term that depends upon the average temperature of the previous 10 day period :math:`t_{2m,10days}`, in Celsius. .. math:: :label: 17.46) @@ -89,8 +91,9 @@ Growth Respiration Growth respiration is calculated as a factor of 0.11 times the total carbon allocation to new growth (:math:`CF_{growth}`, after allocating carbon for N acquisition, -Chapter :numref:`rst_FUN`.)on a given timestep, based on construction costs -for a range of woody and non-woody tissues (Atkin et al. in prep). For new +Chapter :numref:`rst_FUN`.) on a given timestep, based on construction costs +for a range of woody and non-woody tissues, with estimates of the growth +respiration flux revised downswards following (Atkin et al. 2017). For new carbon and nitrogen allocation that enters storage pools for subsequent display, it is not clear what fraction of the associated growth respiration should occur at the time of initial allocation, and what diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 35c50dc038..cafba90dc3 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -120,6 +120,19 @@ Axelsson, E., and Axelsson, B. 1986. Changes in carbon allocation patterns in spruce and pine trees following irrigation and fertilization. Tree Phys. 2:189-204. +.. _Atkin2016: + +|br| + +Atkin OK, Bloomfield KJ, Reich PB, Tjoelker MG, Asner GP, Bonal D et al (2015) Global variability in leaf respiration in relation to climate, plant functional types and leaf traits. New Phytologist 206:614–636 + +.. _Atkin2017: + +|br| + +Leaf Respiration in Terrestrial Biosphere Models. In Plant Respiration: Metabolic Fluxes and Carbon Balance, Advances +in Photosynthesis and Respiration 43, G. Tcherkez, J. Ghashghaie (eds.) Springer International Publishing AG 2017 + .. _BadgerandDirmeyer2015: |br| From 565e828d4dcc052a537858d9f33ea57ab67d9ea1 Mon Sep 17 00:00:00 2001 From: Ben Andre Date: Wed, 7 Mar 2018 15:24:54 -0700 Subject: [PATCH 0170/1973] Converting latest batch of refactors. Not expected to compile or do anything. --- lilac/src/lilac-demo-driver.F90 | 10 +- lilac/src/lilac.F90 | 204 ++++++++++++++++++-------------- lilac/src/lilac_api_types.F90 | 43 +++++++ lilac/src/lilac_constants.F90 | 18 +++ 4 files changed, 185 insertions(+), 90 deletions(-) create mode 100644 lilac/src/lilac_api_types.F90 create mode 100644 lilac/src/lilac_constants.F90 diff --git a/lilac/src/lilac-demo-driver.F90 b/lilac/src/lilac-demo-driver.F90 index 39f28dac73..328b869cf8 100644 --- a/lilac/src/lilac-demo-driver.F90 +++ b/lilac/src/lilac-demo-driver.F90 @@ -80,7 +80,6 @@ program lilac_demo_driver ! ! Initialize the driver ! - call setup_demo_driver_clock(driver_clock) ! @@ -90,9 +89,12 @@ program lilac_demo_driver ! Hard code values normally supplied by the driver call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_lilac, ierr) call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_component, ierr) - lilac_init_data%output_unit_global_shared = 250 - lilac_init_data%output_unit_lilac = 251 - lilac_init_data%output_unit_component = 252 + call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_global_shared, ierr) + lilac_init_data%output_unit_lilac = 250 + lilac_init_data%output_unit_component = 251 + lilac_init_data%output_unit_global_shared = 252 + + lilac_init_data%component_name = MODEL_NAME_CTSM ! FIXME(bja, 2018-02) use namelist so the demo driver can serve as a test driver lilac_clock_data%calendar_is_leap = .false. diff --git a/lilac/src/lilac.F90 b/lilac/src/lilac.F90 index f3fd3e22a7..9f89e97d9f 100644 --- a/lilac/src/lilac.F90 +++ b/lilac/src/lilac.F90 @@ -4,45 +4,34 @@ module lilac ! implicit none - private - - integer, parameter :: lilac_master_proc = 0 - type :: lilac_clock_data_t - logical :: calendar_is_leap - integer :: start_year - integer :: start_month - integer :: start_day - integer :: start_second ! seconds since midnight + private - integer :: stop_year - integer :: stop_month - integer :: stop_day - integer :: stop_second ! seconds since midnight + integer, parameter :: LILAC_MASTER_PROC = 0 + integer, parameter :: LILAC_NUM_COMPONENTS = 1 - integer :: time_step_seconds - end type lilac_clock_data_t + type, public :: lilac_t + private + character(len=STRING_32) :: component_name + logical :: debug - type :: lilac_init_data_t integer :: mpicom_lilac - integer :: mpicom_component - integer :: output_unit_lilac - integer :: output_unit_global_shared ! this should be the same for all instances of lilac! - integer :: output_unit_component - - end type lilac_init_data_t - - type :: lilac_t - private - type(ESMF_Clock) :: driver_clock - integer :: my_mpi_rank - integer :: num_mpi_tasks + integer :: my_mpi_rank_lilac + integer :: num_mpi_tasks_lilac integer :: mct_comp_id + + type(ESMF_Clock) :: lilac_clock + type(ESMF_Time) :: start_time + type(ESMF_Time) :: stop_time + type(ESMF_TimeInterval) :: time_step + type(ESMF_Alarm) :: alarm_stop + type(ESMF_Alarm) :: alarm_restart + contains ! Public API - procedure :: Init => lilac_init - procedure :: Shutdown => lilac_shutdown - procudure :: AdvanceTime => lilac_advance_time + procedure, public :: Init => lilac_init + procedure, public :: Shutdown => lilac_shutdown + procudure, public :: AdvanceTime => lilac_advance_time ! private initialization routines procedure, private :: lilac_init_parallel @@ -69,6 +58,7 @@ module lilac ! subroutine lilac_init(this, init_data, clock_data, debug) + use lilac_api_types, only : lilac_clock_data_t use mct_mod, only : mct_world_init implicit none @@ -76,11 +66,24 @@ subroutine lilac_init(this, init_data, clock_data, debug) class(lilac_t), intent(inout) :: this type(lilac_init_data_t), intent(in) :: init_data type(lilac_clock_data_t), intent(in) :: clock_data - logical, intent(in) :: debug - call this%lilac_init_parallel(init_data%mpicom_lilac, init_data%mpicom_component) + this%debug = debug + this%component_name = init_data%component_name + + call this%lilac_init_parallel(init_data%mpicom_lilac, & + init_data%mpicom_component, init_data%mpicom_global_shared) + call this%lilac_init_logging(init_data%output_unit_lilac, init_data%output_unit_component) + call this%lilac_init_io() + call this%lilac_init_clocks(clock_data) + ! TODO(bja, 2018-03) use init_data%component_name to do some model + ! specific setup, including getting a list of hard coded input and output + ! exchange fields. + call this%lilac_init_fields() + call this%lilac_init_orbit() + call this%lilac_init_land() + call this%lilac_init_coupling() end subroutine lilac_init @@ -98,15 +101,18 @@ subroutine lilac_shutdown(this) class(lilac_t), intent(inout) :: this - ! FIXME(bja, 2018-02) master proc only! - write(this%output_unit, *) 'lilac shutting down...' + if (this%my_mpi_rank_lilac == LILAC_MASTER_PROC) then + write(this%output_unit, *) 'Shutting down lilac interface for component ', this%component_name, ' ...' + end if + call shr_sys_flush(this%output_unit) call this%lilac_shutdown_land() call this%lilac_shutdown_parallel() - ! FIXME(bja, 2018-02) master proc only! - write(this%output_unit, *) 'lilac shut down complete.' + if (this%my_mpi_rank_lilac == LILAC_MASTER_PROC) then + write(this%output_unit, *) 'lilac shut down for component ', this%component_name, ' complete.' + end if end subroutine lilac_shutdown @@ -123,14 +129,18 @@ subroutine lilac_init_parallel(this, mpicom_lilac, mpicom_component, mpicom_glob ! should be safe if previously initialized call MPI_Init(ierr) - call MPI_COMM_RANK(mpicom_lilac, this%my_mpi_rank, ierr) - call MPI_COMM_SIZE(mpicom_lilac, this%num_mpi_tasks, ierr) + this%mpicom_lilac = mpicom_lilac + this%mpicom_component = mpicom_component + + call MPI_COMM_RANK(this%mpicom_lilac, this%my_lilac_mpi_rank, ierr) + call MPI_COMM_SIZE(this%mpicom_lilac, this%num_lilac_mpi_tasks, ierr) + ! FIXME(bja, 2018-03) 1 (component | lilac) or two (component & lilac)? this%mct_num_comps = 1 this%mct_comp_id = 1 - ! NOTE(bja, 2018-02) this should eventually be initialized on the union of - ! the lilac and component communicators! - call mct_world_init(num_comps, MPI_COMM_WORLD, mpicom_lilac, ID_comp) + ! NOTE(bja, 2018-02) MPI_COMM_WORLD should eventually be initialized on + ! the union of the lilac and component communicators! If 2, then need arrays?! + call mct_world_init(this%mct_num_comps, MPI_COMM_WORLD, this%mpicom_lilac, this%mct_comp_id) end subroutine lilac_init_parallel @@ -140,43 +150,66 @@ subroutine lilac_init_logging(this, output_unit_lilac, output_unit_global_shared class(lilac_t), intent(inout) :: this + character(len=*), parameter :: subname = 'lilac_init_logging' ! open logfile for lilac this%output_unit = output_unit_lilac - write(log_file_name,'(a,i4.4)') 'lilac.log.', this%my_mpi_rank + ! FIXME(bja, 2018-03) do we want a single shared log file, or one per rank? + write(log_file_name,'(a,i4.4)') 'lilac.log.', this%my_mpi_rank_lilac open(this%output_unit, file=trim(log_file_name)) - if (this%my_mpi_rank == lilac_master_proc) then - write(this%output_unit, *) subname,' starting lilac' - write(this%output_unit, *) subname, ' num lilac tasks = ', this%num_mpi_tasks - write(this%output_unit, *) subname, ' my_mpi_rank = ', this%my_mpi_rank - write(this%output_unit, *) subname, ' mct component ID = ', this%mct_comp_id + if (this%my_mpi_rank_lilac == LILAC_MASTER_PROC) then + write(this%output_unit, *) subname, ': Starting lilac interface for component: ', this%component_name + write(this%output_unit, *) subname, ': num lilac tasks = ', this%num_mpi_tasks_lilac + write(this%output_unit, *) subname, ': my mpi rank = ', this%my_mpi_rank_lilac + write(this%output_unit, *) subname, ': mct component ID = ', this%mct_comp_id_lilac call shr_sys_flush(this%output_unit) end if - ! NOTE(bja, 2018-02) these are setting global variables! - call shr_file_setLogUnit(mpicom_global_shared) + ! NOTE(bja, 2018-02) these are setting global variables within the shr code! + call shr_file_setLogUnit(output_unit_global_shared) call shr_file_setLogLevel(1) end subroutine lilac_init_logging subroutine lilac_init_io(this) + ! NOTE(bja, 2018-02) There is only a *single science component* in each + ! lilac instance. For now assuming just the science component interacts + ! with pio, but lilac may have some parallel data I/O needs. If so it + ! needs to be added to these data structures! implicit none class(lilac_t), intent(inout) :: this - global_comm = MPI_COMM_WORLD - call shr_pio_init1(ncomps, 'pio_in', global_comm) - allocate(comp_id(ncomps), comp_name(ncomps), comp_iamin(ncomps), comp_comm(ncomps), comp_comm_iam(ncomps)) - do n = 1, ncomps - comp_id(n) = ID_lilac - comp_name(n) = 'LND' - comp_iamin(n) = .true. - comp_comm(n) = mpicom_lilac - comp_comm_iam(n) = mytask + ! + call shr_pio_init1(LILAC_NUM_COMPONENTS, 'pio_in', this%mpicom_lilac) + allocate( & + comp_id(LILAC_NUM_COMPONENTS), & + comp_name(LILAC_NUM_COMPONENTS), & + comp_iamin(LILAC_NUM_COMPONENTS), & + comp_comm(LILAC_NUM_COMPONENTS), & + comp_comm_iam(LILAC_NUM_COMPONENTS)) + + index = 1 + comp_id(index) = 1 + comp_name(index) = MODEL_NAME_LILAC // '_' // trim(this%component_name) + comp_iamin(index) = .true. + comp_comm(index) = this%mpicom_lilac + comp_comm_iam(index) = this%my_mpi_rank_lilac + + ! TODO(bja, 2018-03) Never have more than one science component, remove loop? + do n = 1, LILAC_NUM_COMPONENTS + index = index + n + comp_id(index) = ID_component + comp_name(index) = this%component_name + comp_iamin(index) = .true. + comp_comm(index) = this%mpicom_component + comp_comm_iam(index) = mytask ! FIXME(bja, 2018-02) when land and lilac are on different comms?? enddo + call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) + deallocate(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) end subroutine lilac_init_io @@ -190,45 +223,44 @@ subroutine lilac_init_clocks(this, clock_data) class(lilac_t), intent(inout) :: this type(lilac_clock_data_t), intent(in) :: clock_data - type(ESMF_Time) :: current_time, start_time, stop_time - type(ESMF_TimeInterval) :: time_step - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar), target :: calendar ! FIXME(bja, 2018-02) does this need to be freed? + type(ESMF_Calendar), target :: calendar ! FIXME(bja, 2018-02) does not need to be freed?! integer :: cal_kind_flag + integer :: year, month, day, sec - if (clock_data%calendar_is_leap) then - cal_kind_flag = ? - else + if (clock_data%calendar_is_leap == .false.) then cal_kind_flag = ESMF_CALKIND_NOLEAP + else + ! FIXME(bja, 2018-03) not implemented error! ESMF_CALKIND_GREGORIAN? end if - ! FIXME(bja, 2018-02) verify it is to call multiple times if driver uses - ! esmf or there are multiple lilac instances...? - call ESMF_Initialize(rc=rc) + if (ESMF_IsInitialized() /= .true.) then + ! NOTE(bja, 2018-03) allocates and operates on global data! + call ESMF_Initialize(rc=rc) + end if calendar = ESMF_CalendarCreate( name='lilac', calkindflag=cal_kind_flag, rc=rc ) - call ESMF_TimeSet(start_time, yy=clock_data%start_year, mm=clock_data%start_month, & + call ESMF_TimeSet(this%start_time, yy=clock_data%start_year, mm=clock_data%start_month, & dd=clock_data%start_day, s=clock_data%start_seconds, calendar=calendar, rc=rc) - call ESMF_TimeSet(stop_time , yy=clock_data%stop_year, mm=clock_data%stop_month, & - dd=clock_data%stop_day, s=clock_data%stop_seconds, calendar=Calendar, rc=rc) + call ESMF_TimeSet(this%stop_time , yy=clock_data%stop_year, mm=clock_data%stop_month, & + dd=clock_data%stop_day, s=clock_data%stop_seconds, calendar=calendar, rc=rc) - call ESMF_TimeIntervalSet(time_step, s=clock_data%time_step_seconds, rc=rc) + call ESMF_TimeIntervalSet(this%time_step, s=clock_data%time_step_seconds, rc=rc) this%lilac_clock = ESMF_ClockCreate(name='lilac_clock', & - TimeStep=time_step, startTime=start_time, & - RefTime=start_time, stopTime=stop_time, rc=rc) - - EAlarm_stop = ESMF_AlarmCreate(name='alarm_stop' , & - clock=EClock, ringTime=StopTime, rc=rc) - EAlarm_rest = ESMF_AlarmCreate(name='alarm_restart', & - clock=EClock, ringTime=StopTime, rc=rc) - - if (this%debug) then - call ESMF_TimeGet( start_time, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(this%output_unit,'(1x,2a,4i6)') subname,' start time ymds=', yy, mm, dd, sec - call ESMF_TimeGet( stop_time, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(this%output_unit,'(1x,2a,4i6)') subname,' stop time ymds=', yy, mm, dd, sec + TimeStep=this%time_step, startTime=this%start_time, & + RefTime=this%start_time, stopTime=this%stop_time, rc=rc) + + this%alarm_stop = ESMF_AlarmCreate(name='alarm_stop' , & + clock=this%lilac_clock, ringTime=this%stop_time, rc=rc) + this%alarm_rest = ESMF_AlarmCreate(name='alarm_restart', & + clock=this%lilac_clock, ringTime=this%stop_time, rc=rc) + + if (this%debug .and. this%my_mpi_rank_lilac == LILAC_MASTER_PROC) then + call ESMF_TimeGet( start_time, yy=year, mm=month, dd=day, s=sec, rc=rc ) + write(this%output_unit, '(1x,2a,4i6)') subname,': start time ymds=', year, month, day, sec + call ESMF_TimeGet( stop_time, yy=year, mm=month, dd=day, s=sec, rc=rc ) + write(this%output_unit, '(1x,2a,4i6)') subname,': stop time ymds=', year, month, day, sec call shr_sys_flush(this%output_unit) end if diff --git a/lilac/src/lilac_api_types.F90 b/lilac/src/lilac_api_types.F90 new file mode 100644 index 0000000000..da66aefe04 --- /dev/null +++ b/lilac/src/lilac_api_types.F90 @@ -0,0 +1,43 @@ +module lilac_api_types + + implicit none + + use lilac_constants, only : STRING_128 + +contains + + type :: lilac_init_data_t + character(len=STRING_32) :: component_name + integer :: mpicom_lilac + integer :: mpicom_component + integer :: output_unit_lilac + integer :: output_unit_global_shared ! this should be the same for all instances of lilac! + integer :: output_unit_component + + end type lilac_init_data_t + + type :: lilac_clock_data_t + logical :: calendar_is_leap + integer :: start_year + integer :: start_month + integer :: start_day + integer :: start_second ! seconds since midnight + + integer :: stop_year + integer :: stop_month + integer :: stop_day + integer :: stop_second ! seconds since midnight + + integer :: time_step_seconds + end type lilac_clock_data_t + + + type :: lilac_exchange_fields_t + character(len=STRING_128) :: long_name + character(len=STRING_128) :: short_name + character(len=STRING_128) :: field_name + character(len=STRING_128) :: units + integer :: field_type + end type lilac_exchange_fields_t + +end module lilac_api_types diff --git a/lilac/src/lilac_constants.F90 b/lilac/src/lilac_constants.F90 new file mode 100644 index 0000000000..d9e6442206 --- /dev/null +++ b/lilac/src/lilac_constants.F90 @@ -0,0 +1,18 @@ +module lilac_constants + + implicit none + +contains + + integer, parameter :: STRING_128 = 128 + integer, parameter :: STRING_32 = 32 + + integer, parameter :: FIELD_TYPE_INTEGER = 0 + integer, parameter :: FIELD_TYPE_REAL_8BYTE = 1 + + ! known models names + character(len=*), parameter :: MODEL_NAME_LILAC = 'lilac' + character(len=*), parameter :: MODEL_NAME_CTSM = 'ctsm' + character(len=*), parameter :: MODEL_NAME_TEST = 'test' + +end module lilac_constants From 3b5434e4f5014f3d40dc655af6673664669f8c0a Mon Sep 17 00:00:00 2001 From: Rosemary Fisher Date: Thu, 8 Mar 2018 11:16:15 -0700 Subject: [PATCH 0171/1973] removed nonsense text from end of FUN chapter --- doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst index 1b769042f7..658653da48 100644 --- a/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst +++ b/doc/source/tech_note/FUN/CLM50_Tech_Note_FUN.rst @@ -391,19 +391,3 @@ Following this, we determine how much carbon is accounted for for each soil laye -Types of N uptake streams --------------------------------------------------------- -Arbuscular mycorrhizal fungi: -Ectomycorrhizal fungi: -Nonmycorrhizal plants. - - -ECK_active (step 1) sets active components for Ectomycorrhizal fungi -ACK_active (step 2) sets active components for Arbuscular fungi - -kc_nonmyc (step 1) sets nonmyc components for Ectomycorrhizal fungi -kc_nonmyc (step 2) sets active components for Arbuscular fungi - -ACTIVE vs NONMYC -ECTO vs ARBU for ACTIVE. - From 1feb5bf46f586c6f4cf5e99ec048cc5ea4aac91c Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Thu, 12 Apr 2018 07:27:16 -0600 Subject: [PATCH 0172/1973] Fix co-author name --- .../tech_note/Introduction/CLM50_Tech_Note_Introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 08bdf4ec29..e5a075cca5 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -13,7 +13,7 @@ ***Contributing Authors*** -**Ashehad Ali, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathon Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, +**Ashehad Ali, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathan Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Jacqueline Shuman, Andrew Slater, Zachary Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Francis Vitt, Xubin Zeng** From b0c2dc4c466f22c8467051d1ed8ac5213c523713 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 7 May 2018 14:04:52 -0600 Subject: [PATCH 0173/1973] add vegetation/stem heat capacity --- src/biogeophys/BalanceCheckMod.F90 | 3 +- src/biogeophys/CanopyFluxesMod.F90 | 241 +++++++++++++++++++------ src/biogeophys/EnergyFluxType.F90 | 27 ++- src/biogeophys/FrictionVelocityMod.F90 | 80 +++++++- src/biogeophys/SoilFluxesMod.F90 | 3 +- src/biogeophys/TemperatureType.F90 | 9 + 6 files changed, 302 insertions(+), 61 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 91de50944f..cadc8274b6 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -197,6 +197,7 @@ subroutine BalanceCheck( bounds, & qflx_glcice_dyn_water_flux => glacier_smb_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) + hs_canopy => energyflux_inst%hs_canopy_patch , & ! Input: [real(r8) (:) ] change in heat content of stem (W/m**2) [+ to atm] eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Input: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Input: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] @@ -501,7 +502,7 @@ subroutine BalanceCheck( bounds, & if (.not. lun%urbpoi(l)) then errseb(p) = sabv(p) + sabg_chk(p) + forc_lwrad(c) - eflx_lwrad_out(p) & - - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) + - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) - hs_canopy(p) else errseb(p) = sabv(p) + sabg(p) & - eflx_lwrad_net(p) & diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 7c9feb8a25..872e077c3c 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -15,7 +15,7 @@ module CanopyFluxesMod use abortutils , only : endrun use clm_varctl , only : iulog, use_cn, use_lch4, use_c13, use_c14, use_cndv, use_fates, & use_luna, use_hydrstress - use clm_varpar , only : nlevgrnd, nlevsno + use clm_varpar , only : nlevgrnd, nlevsno, mxpft use clm_varcon , only : namep use pftconMod , only : pftcon use decompMod , only : bounds_type @@ -167,7 +167,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! less than 0.1 W/m2; or the iterative steps over 40. ! ! !USES: - use shr_const_mod , only : SHR_CONST_RGAS + use shr_const_mod , only : SHR_CONST_RGAS, shr_const_pi use clm_time_manager , only : get_step_size, get_prev_date,is_end_curr_day use clm_varcon , only : sb, cpair, hvap, vkc, grav, denice use clm_varcon , only : denh2o, tfrz, csoilc, tlsai_crit, alpha_aero @@ -228,25 +228,18 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: dtime ! land model time step (sec) real(r8) :: zldis(bounds%begp:bounds%endp) ! reference height "minus" zero displacement height [m] - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory real(r8) :: wc ! convective velocity [m/s] real(r8) :: dth(bounds%begp:bounds%endp) ! diff of virtual temp. between ref. height and surface real(r8) :: dthv(bounds%begp:bounds%endp) ! diff of vir. poten. temp. between ref. height and surface real(r8) :: dqh(bounds%begp:bounds%endp) ! diff of humidity between ref. height and surface - real(r8) :: obu(bounds%begp:bounds%endp) ! Monin-Obukhov length (m) - real(r8) :: um(bounds%begp:bounds%endp) ! wind speed including the stablity effect [m/s] real(r8) :: ur(bounds%begp:bounds%endp) ! wind speed at reference height [m/s] - real(r8) :: uaf(bounds%begp:bounds%endp) ! velocity of air within foliage [m/s] real(r8) :: temp1(bounds%begp:bounds%endp) ! relation for potential temperature profile real(r8) :: temp12m(bounds%begp:bounds%endp) ! relation for potential temperature profile applied at 2-m real(r8) :: temp2(bounds%begp:bounds%endp) ! relation for specific humidity profile real(r8) :: temp22m(bounds%begp:bounds%endp) ! relation for specific humidity profile applied at 2-m - real(r8) :: ustar(bounds%begp:bounds%endp) ! friction velocity [m/s] real(r8) :: tstar ! temperature scaling parameter real(r8) :: qstar ! moisture scaling parameter real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: taf(bounds%begp:bounds%endp) ! air temperature within canopy space [K] - real(r8) :: qaf(bounds%begp:bounds%endp) ! humidity of canopy air [kg/kg] real(r8) :: rpp ! fraction of potential evaporation from leaf [-] real(r8) :: rppdry ! fraction of potential evaporation through transp [-] real(r8) :: cf ! heat transfer coefficient from leaves [-] @@ -256,11 +249,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: wta ! heat conductance for air [m/s] real(r8) :: wtg(bounds%begp:bounds%endp) ! heat conductance for ground [m/s] real(r8) :: wtl ! heat conductance for leaf [m/s] + real(r8) :: wtstem ! heat conductance for stem [m/s] real(r8) :: wta0(bounds%begp:bounds%endp) ! normalized heat conductance for air [-] real(r8) :: wtl0(bounds%begp:bounds%endp) ! normalized heat conductance for leaf [-] real(r8) :: wtg0 ! normalized heat conductance for ground [-] + real(r8) :: wtstem0(bounds%begp:bounds%endp) ! normalized heat conductance for stem [-] real(r8) :: wtal(bounds%begp:bounds%endp) ! normalized heat conductance for air and leaf [-] - real(r8) :: wtga ! normalized heat cond. for air and ground [-] + real(r8) :: wtga(bounds%begp:bounds%endp) ! normalized heat cond. for air and ground [-] real(r8) :: wtaq ! latent heat conductance for air [m/s] real(r8) :: wtlq ! latent heat conductance for leaf [m/s] real(r8) :: wtgq(bounds%begp:bounds%endp) ! latent heat conductance for ground [m/s] @@ -295,6 +290,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: efsh ! sensible heat from leaf [mm/s] real(r8) :: obuold(bounds%begp:bounds%endp) ! monin-obukhov length from previous iteration real(r8) :: tlbef(bounds%begp:bounds%endp) ! leaf temperature from previous iteration [K] + real(r8) :: tsbef(bounds%begp:bounds%endp) ! stem temperature from previous iteration [K] real(r8) :: ecidif ! excess energies [W/m2] real(r8) :: err(bounds%begp:bounds%endp) ! balance error real(r8) :: erre ! balance error @@ -355,6 +351,30 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, integer :: iv logical :: is_end_day ! is end of current day + real(r8) :: cp_veg(bounds%begp:bounds%endp) !heat capacity of veg + real(r8) :: cp_stem(bounds%begp:bounds%endp) !heat capacity of stems + real(r8) :: dt_stem(bounds%begp:bounds%endp) + real(r8) :: fstem(bounds%begp:bounds%endp) !fraction of stem + real(r8) :: bhd(0:mxpft) !stem breast-height-diameter + real(r8) :: wood_density, carea_stem + real(r8) :: lw_stem(bounds%begp:bounds%endp) !internal longwave stem + real(r8) :: lw_leaf(bounds%begp:bounds%endp) !internal longwave leaf + real(r8) :: sa_stem(bounds%begp:bounds%endp) !surface area stem m2/m2_ground + real(r8) :: sa_leaf(bounds%begp:bounds%endp) !surface area leaf m2/m2_ground + real(r8) :: sa_internal(bounds%begp:bounds%endp) !min(sa_stem,sa_leaf) + real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed + ! biomass parameters + real(r8), parameter :: c_to_b = 2.0_r8 !(g biomass /g C) + real(r8), parameter :: ntree = 0.4_r8 !(number of trees / m2) + real(r8), parameter :: rstem = 100._r8 !stem resistance (s/m) + + real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem + real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume + real(r8), parameter :: k_cyl_area = 1.0 !departure from cylindrical area + real(r8), parameter :: k_internal = 0.0 !self-absorbtion of leaf/stem longwave + + + integer :: dummy_to_make_pgi_happy !------------------------------------------------------------------------------ @@ -362,6 +382,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, SHR_ASSERT_ALL((ubound(leafn_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) associate( & + t_stem => temperature_inst%t_stem_patch , & ! Output: [real(r8) (:) ] stem temperature (Kelvin) + hs_canopy => energyflux_inst%hs_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:) ] soil evaporative resistance snl => col%snl , & ! Input: [integer (:) ] number of snow layers dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) @@ -504,8 +526,22 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Output: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] + eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] eflx_sh_veg => energyflux_inst%eflx_sh_veg_patch , & ! Output: [real(r8) (:) ] sensible heat flux from leaves (W/m**2) [+ to atm] eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] + rah1 => frictionvel_inst%rah1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance [s/m] + rah2 => frictionvel_inst%rah2_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance [s/m] + raw1 => frictionvel_inst%raw1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance [s/m] + raw2 => frictionvel_inst%raw2_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance [s/m] + ustar => frictionvel_inst%ustar_patch , & ! Output: [real(r8) (:) ] friction velocity [m/s] + um => frictionvel_inst%um_patch , & ! Output: [real(r8) (:) ] wind speed including the stablity effect [m/s] + uaf => frictionvel_inst%uaf_patch , & ! Output: [real(r8) (:) ] canopy air speed [m/s] + taf => frictionvel_inst%taf_patch , & ! Output: [real(r8) (:) ] canopy air temperature [K] + qaf => frictionvel_inst%qaf_patch , & ! Output: [real(r8) (:) ] canopy air humidity [kg/kg] + obu => frictionvel_inst%obu_patch , & ! Output: [real(r8) (:) ] Monin-Obukhov length [m] + zeta => frictionvel_inst%zeta_patch , & ! Output: [real(r8) (:) ] dimensionless stability parameter + vpd => frictionvel_inst%vpd_patch , & ! Output: [real(r8) (:) ] vapor pressure deficit [Pa] + begp => bounds%begp , & endp => bounds%endp , & begg => bounds%begg , & @@ -584,8 +620,51 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, obuold(p) = 0._r8 btran(p) = btran0 btran2(p) = btran0 + hs_canopy(p) = 0._r8 end do +! set bhd (should be done on parameter file) + bhd(1:16) = (/0.15,0.15,0.15,0.2,0.2,0.2,0.2,0.1,0.02,0.02,0.02,0.004,0.004,0.004,0.004,0.004/) + + ! calculate biomass heat capacities + do f = 1, fn + p = filterp(f) + + ! fraction of stem receiving incoming radiation + fstem(p) = (esai(p))/(elai(p)+esai(p)) + fstem(p) = k_vert * fstem(p) + ! leaf and stem surface area + sa_leaf(p) = elai(p) +! double in spirit of full surface area for sensible heat + sa_leaf(p) = 2.*sa_leaf(p) + sa_stem(p) = ntree*(htop(p)*shr_const_pi*bhd(patch%itype(p))) +! adjust for departure of cylindrical stem model + sa_stem(p) = k_cyl_area * sa_stem(p) +! internal longwave fluxes between leaf and stem +! surface area term must be equal, remainder cancels +! (use same area of interaction i.e. ignore leaf <-> leaf) + sa_internal(p) = min(sa_leaf(p),sa_stem(p)) + sa_internal(p) = k_internal * sa_internal(p) + +!scs: specify heat capacity of vegetation +!(lma * c2b = lma_dry, lma * c2b * (fw/(1-fw)) = lma_wet, sum these) +! lma_dry has units of kg dry mass /m2 here (table 2 of bonan 2017) +! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K +! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) + cp_veg(p) = (0.25_r8 * elai(p)) * (1400._r8 + (0.7/(1.-0.7))*4188._r8) + +! wood density could vary by pft... + wood_density = 5.e2_r8 ! kg/m3 lindroth2010 uses ~4.e2 + carea_stem = shr_const_pi * (bhd(patch%itype(p))*0.5)**2 + +! cp-stem will have units J/k/ground_area (here assuming 1 stem/m2) + cp_stem(p) = (1400._r8 + (0.7/(1.-0.7))*4188._r8) +! use weight of dry wood + cp_stem(p) = cp_stem(p) * ntree * wood_density * htop(p) * carea_stem +! adjust for departure from cylindrical stem model + cp_stem(p) = k_cyl_vol * cp_stem(p) + enddo + ! calculate daylength control for Vcmax do f = 1, fn p=filterp(f) @@ -772,6 +851,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, g = patch%gridcell(p) tlbef(p) = t_veg(p) + tsbef(p) = t_stem(p) del2(p) = del(p) ! Determine aerodynamic resistances @@ -784,6 +864,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, uaf(p) = um(p)*sqrt( 1._r8/(ram1(p)*um(p)) ) + ! empirical undercanopy wind speed + uuc(p) = min(0.4_r8,(0.03_r8*um(p)/ustar(p))) + ! Use pft parameter for leaf characteristic width ! dleaf_patch if this is not an fates patch. ! Otherwise, the value has already been loaded @@ -812,18 +895,26 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, !! modify csoilc value (0.004) if the under-canopy is in stable condition - if (use_undercanopy_stability .and. (taf(p) - t_grnd(c) ) > 0._r8) then - ! decrease the value of csoilc by dividing it with (1+gamma*min(S, 10.0)) - ! ria ("gmanna" in Sakaguchi&Zeng, 2008) is a constant (=0.5) - ricsoilc = csoilc / (1.00_r8 + ria*min( ri, 10.0_r8) ) - csoilcn = csoilb*w + ricsoilc*(1._r8-w) - else - csoilcn = csoilb*w + csoilc*(1._r8-w) - end if +!!$ if (use_undercanopy_stability .and. (taf(p) - t_grnd(c) ) > 0._r8) then +!!$ ! decrease the value of csoilc by dividing it with (1+gamma*min(S, 10.0)) +!!$ ! ria ("gmanna" in Sakaguchi&Zeng, 2008) is a constant (=0.5) +!!$ ricsoilc = csoilc / (1.00_r8 + ria*min( ri, 10.0_r8) ) +!!$ csoilcn = csoilb*w + ricsoilc*(1._r8-w) +!!$ else +!!$ csoilcn = csoilb*w + csoilc*(1._r8-w) +!!$ end if +! Commenting-out ria correction + csoilcn = csoilb*w + csoilc*(1._r8-w) !! Sakaguchi changes for stability formulation ends here - rah(p,2) = 1._r8/(csoilcn*uaf(p)) + if (use_undercanopy_stability) then + ! use uuc for ground fluxes (keep uaf for canopy terms) + rah(p,2) = 1._r8/(csoilcn*uuc(p)) + else + rah(p,2) = 1._r8/(csoilcn*uaf(p)) + endif + raw(p,2) = rah(p,2) if (use_lch4) then grnd_ch4_cond(p) = 1._r8/(raw(p,1)+raw(p,2)) @@ -835,6 +926,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, svpts(p) = el(p) ! pa eah(p) = forc_pbot(c) * qaf(p) / 0.622_r8 ! pa rhaf(p) = eah(p)/svpts(p) +! add history fields + rah1(p) = rah(p,1) + raw1(p) = raw(p,1) + rah2(p) = rah(p,2) + raw2(p) = raw(p,2) + vpd(p) = max((svpts(p) - eah(p)), 50._r8) * 0.001_r8 + end do if ( use_fates ) then @@ -892,16 +990,26 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Moved the original subroutine in-line... wta = 1._r8/rah(p,1) ! air - wtl = (elai(p)+esai(p))/rb(p) ! leaf + wtl = sa_leaf(p)/rb(p) ! leaf wtg(p) = 1._r8/rah(p,2) ! ground - wtshi = 1._r8/(wta+wtl+wtg(p)) + ! wtstem = sa_stem(p)/rb(p) ! stem + ! add resistance between internal stem temperature and canopy air + wtstem = sa_stem(p)/(rstem + rb(p)) ! stem + + wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) + wtl0(p) = wtl*wtshi ! leaf wtg0 = wtg(p)*wtshi ! ground wta0(p) = wta*wtshi ! air - wtga = wta0(p)+wtg0 ! ground + air - wtal(p) = wta0(p)+wtl0(p) ! air + leaf + wtstem0(p) = wtstem*wtshi ! stem + wtga(p) = wta0(p)+wtg0+wtstem0(p) ! ground + air + stem + wtal(p) = wta0(p)+wtl0(p)+wtstem0(p) ! air + leaf + stem + + ! internal longwave fluxes between leaf and stem + lw_stem(p) = sa_internal(p) * emv(p) * sb*t_stem(p)**4 + lw_leaf(p) = sa_internal(p) * emv(p) * sb*t_veg(p)**4 ! Fraction of potential evaporation from leaf @@ -916,7 +1024,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, canopy_cond(p) = (laisun(p)/(rb(p)+rssun(p)) + laisha(p)/(rb(p)+rssha(p)))/max(elai(p), 0.01_r8) end if - efpot = forc_rho(c)*wtl*(qsatl(p)-qaf(p)) +! should be the same expression used in Photosynthesis/getqflx + efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p)*(qsatl(p)-qaf(p)) ! When the hydraulic stress parameterization is active calculate rpp ! but not transpiration @@ -989,7 +1098,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, dc1 = forc_rho(c)*cpair*wtl dc2 = hvap*forc_rho(c)*wtlq - efsh = dc1*(wtga*t_veg(p)-wtg0*t_grnd(c)-wta0(p)*thm(p)) + efsh = dc1*(wtga(p)*t_veg(p)-wtg0*t_grnd(c)-wta0(p)*thm(p)-wtstem0(p)*t_stem(p)) + eflx_sh_stem(p) = forc_rho(c)*cpair*wtstem*((wta0(p)+wtg0+wtl0(p))*t_stem(p)-wtg0*t_grnd(c)-wta0(p)*thm(p)-wtl0(p)*t_veg(p)) efe(p) = dc2*(wtgaq*qsatl(p)-wtgq0*qg(c)-wtaq0(p)*forc_q(c)) ! Evaporation flux from foliage @@ -1005,9 +1115,14 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - dt_veg(p) = (sabv(p) + air(p) + bir(p)*t_veg(p)**4 + & - cir(p)*lw_grnd - efsh - efe(p)) / & - (- 4._r8*bir(p)*t_veg(p)**3 +dc1*wtga +dc2*wtgaq*qsatldT(p)) + dt_veg(p) = ((1.-fstem(p))*(sabv(p) + air(p) & + + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & + - efsh - efe(p) - lw_leaf(p) + lw_stem(p) & + - (cp_veg(p)/dtime)*(t_veg(p) - tlbef(p))) & + / ((1.-fstem(p))*(- 4._r8*bir(p)*t_veg(p)**3) & + + 4._r8*sa_internal(p)*emv(p)*sb*t_veg(p)**3 & + +dc1*wtga(p) +dc2*wtgaq*qsatldT(p) + cp_veg(p)/dtime) + t_veg(p) = tlbef(p) + dt_veg(p) dels = dt_veg(p) del(p) = abs(dels) @@ -1015,10 +1130,14 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, if (del(p) > delmax) then dt_veg(p) = delmax*dels/del(p) t_veg(p) = tlbef(p) + dt_veg(p) - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + cir(p)*lw_grnd - & - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & - dc2*wtgaq*qsatldT(p)*dt_veg(p)) + err(p) = (1.-fstem(p))*(sabv(p) + air(p) & + + bir(p)*tlbef(p)**3*(tlbef(p) + & + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & + -sa_internal(p)*emv(p)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & + + lw_stem(p) & + - (efsh + dc1*wtga(p)*dt_veg(p)) - (efe(p) + & + dc2*wtgaq*qsatldT(p)*dt_veg(p)) & + - (cp_veg(p)/dtime)*(t_veg(p) - tlbef(p)) end if ! Fluxes from leaves to canopy space @@ -1026,7 +1145,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! result in an imbalance in "hvap*qflx_evap_veg" and ! "efe + dc2*wtgaq*qsatdt_veg" - efpot = forc_rho(c)*wtl*(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & + efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p) & + *(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) qflx_evap_veg(p) = rpp*efpot @@ -1059,7 +1179,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! The energy loss due to above two limits is added to ! the sensible heat flux. - eflx_sh_veg(p) = efsh + dc1*wtga*dt_veg(p) + err(p) + erre + hvap*ecidif + eflx_sh_veg(p) = efsh + dc1*wtga(p)*dt_veg(p) + err(p) + erre + hvap*ecidif + + ! Update SH and lw_leaf for changes in t_veg + eflx_sh_stem(p) = eflx_sh_stem(p) + forc_rho(c)*cpair*wtstem*(-wtl0(p)*dt_veg(p)) + lw_leaf(p) = sa_internal(p)*emv(p)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) ! Re-calculate saturated vapor pressure, specific humidity, and their ! derivatives at the leaf surface @@ -1070,7 +1194,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! temperature, canopy vapor pressure, aerodynamic temperature, and ! Monin-Obukhov stability parameter for next iteration. - taf(p) = wtg0*t_grnd(c) + wta0(p)*thm(p) + wtl0(p)*t_veg(p) + taf(p) = wtg0*t_grnd(c) + wta0(p)*thm(p) + wtl0(p)*t_veg(p) + wtstem0(p)*t_stem(p) qaf(p) = wtlq0(p)*qsatl(p) + wtgq0*qg(c) + forc_q(c)*wtaq0(p) ! Update Monin-Obukhov length and wind speed including the @@ -1084,17 +1208,17 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, qstar = temp2(p)*dqh(p) thvstar = tstar*(1._r8+0.61_r8*forc_q(c)) + 0.61_r8*forc_th(c)*qstar - zeta = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) + zeta(p) = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) - if (zeta >= 0._r8) then !stable - zeta = min(zetamax,max(zeta,0.01_r8)) + if (zeta(p) >= 0._r8) then !stable + zeta(p) = min(zetamax,max(zeta(p),0.01_r8)) um(p) = max(ur(p),0.1_r8) else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) + zeta(p) = max(-100._r8,min(zeta(p),-0.01_r8)) wc = beta*(-grav*ustar(p)*thvstar*zii/thv(c))**0.333_r8 um(p) = sqrt(ur(p)*ur(p)+wc*wc) end if - obu(p) = zldis(p)/zeta + obu(p) = zldis(p)/zeta(p) if (obuold(p)*obu(p) < 0._r8) nmozsgn(p) = nmozsgn(p)+1 if (nmozsgn(p) >= 4) obu(p) = zldis(p)/(-0.01_r8) @@ -1144,25 +1268,39 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & - !+ cir(p)*t_grnd(c)**4 - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) - + cir(p)*lw_grnd - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) + err(p) = (1.-fstem(p))*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & + *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & + - lw_leaf(p) + lw_stem(p) - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) & + - ((t_veg(p)-tlbef(p))*cp_veg(p)/dtime) + + ! Update stem temperature; adjust outgoing longwave + ! does not account for changes in SH or internal LW, + ! as that would change result for t_veg above + dt_stem(p) = (fstem(p)*(sabv(p) + air(p) + bir(p)*tsbef(p)**4 & + + cir(p)*lw_grnd) - eflx_sh_stem(p) & + + lw_leaf(p)- lw_stem(p))/(cp_stem(p)/dtime & + - fstem(p)*bir(p)*4.*tsbef(p)**3) + + hs_canopy(p) = dt_stem(p)*cp_stem(p)/dtime & + +(t_veg(p)-tlbef(p))*cp_veg(p)/dtime + + t_stem(p) = t_stem(p) + dt_stem(p) + + delt = wtal(p)*t_grnd(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p)-wtstem0(p)*t_stem(p) ! Fluxes from ground to canopy space - delt = wtal(p)*t_grnd(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) taux(p) = -forc_rho(c)*forc_u(g)/ram1(p) tauy(p) = -forc_rho(c)*forc_v(g)/ram1(p) eflx_sh_grnd(p) = cpair*forc_rho(c)*wtg(p)*delt ! compute individual sensible heat fluxes - delt_snow = wtal(p)*t_soisno(c,snl(c)+1)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) - eflx_sh_snow(p) = cpair*forc_rho(c)*wtg(p)*delt_snow + delt_snow = wtal(p)*t_soisno(c,snl(c)+1)-wtl0(p)*t_veg(p)-wta0(p)*thm(p)-wtstem0(p)*t_stem(p) + delt_soil = wtal(p)*t_soisno(c,1)-wtl0(p)*t_veg(p)-wta0(p)*thm(p)-wtstem0(p)*t_stem(p) + delt_h2osfc = wtal(p)*t_h2osfc(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p)-wtstem0(p)*t_stem(p) - delt_soil = wtal(p)*t_soisno(c,1)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) + eflx_sh_snow(p) = cpair*forc_rho(c)*wtg(p)*delt_snow eflx_sh_soil(p) = cpair*forc_rho(c)*wtg(p)*delt_soil - - delt_h2osfc = wtal(p)*t_h2osfc(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) eflx_sh_h2osfc(p) = cpair*forc_rho(c)*wtg(p)*delt_h2osfc qflx_evap_soi(p) = forc_rho(c)*wtgq(p)*delq(p) @@ -1227,13 +1365,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & - emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) + emv(p)*emg(c)*sb*(tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1.-fstem(p))+tsbef(p)**3*(tsbef(p) + 4._r8*dt_stem(p))*fstem(p)) ! Upward longwave radiation above the canopy ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-fstem(p))*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+fstem(p)*tsbef(p)**3*(tsbef(p) + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) ! Derivative of soil energy flux with respect to soil temperature diff --git a/src/biogeophys/EnergyFluxType.F90 b/src/biogeophys/EnergyFluxType.F90 index 0869e4136e..6b1bc02d1a 100644 --- a/src/biogeophys/EnergyFluxType.F90 +++ b/src/biogeophys/EnergyFluxType.F90 @@ -21,6 +21,7 @@ module EnergyFluxType type, public :: energyflux_type ! Fluxes + real(r8), pointer :: eflx_sh_stem_patch (:) ! patch sensible heat flux from stem (W/m**2) [+ to atm] real(r8), pointer :: eflx_h2osfc_to_snow_col (:) ! col snow melt to h2osfc heat flux (W/m**2) real(r8), pointer :: eflx_sh_grnd_patch (:) ! patch sensible heat flux from ground (W/m**2) [+ to atm] real(r8), pointer :: eflx_sh_veg_patch (:) ! patch sensible heat flux from leaves (W/m**2) [+ to atm] @@ -101,6 +102,9 @@ module EnergyFluxType ! Latent heat real(r8), pointer :: htvp_col (:) ! latent heat of vapor of water (or sublimation) [j/kg] + ! Canopy heat + real(r8), pointer :: hs_canopy_patch (:) ! patch change in heat content of canopy (leaf+stem) (W/m**2) [+ to atm] + ! Balance Checks real(r8), pointer :: errsoi_patch (:) ! soil/lake energy conservation error (W/m**2) real(r8), pointer :: errsoi_col (:) ! soil/lake energy conservation error (W/m**2) @@ -191,6 +195,7 @@ subroutine InitAllocate(this, bounds) allocate( this%eflx_sh_tot_u_patch (begp:endp)) ; this%eflx_sh_tot_u_patch (:) = nan allocate( this%eflx_sh_tot_r_patch (begp:endp)) ; this%eflx_sh_tot_r_patch (:) = nan allocate( this%eflx_sh_grnd_patch (begp:endp)) ; this%eflx_sh_grnd_patch (:) = nan + allocate( this%eflx_sh_stem_patch (begp:endp)) ; this%eflx_sh_stem_patch (:) = nan allocate( this%eflx_sh_veg_patch (begp:endp)) ; this%eflx_sh_veg_patch (:) = nan allocate( this%eflx_sh_precip_conversion_col(begc:endc)) ; this%eflx_sh_precip_conversion_col(:) = nan allocate( this%eflx_lh_tot_u_patch (begp:endp)) ; this%eflx_lh_tot_u_patch (:) = nan @@ -246,6 +251,8 @@ subroutine InitAllocate(this, bounds) allocate( this%htvp_col (begc:endc)) ; this%htvp_col (:) = nan + allocate( this%hs_canopy_patch (begp:endp)) ; this%hs_canopy_patch (:) = nan + allocate(this%rresis_patch (begp:endp,1:nlevgrnd)) ; this%rresis_patch (:,:) = nan allocate(this%btran_patch (begp:endp)) ; this%btran_patch (:) = nan allocate(this%btran_min_patch (begp:endp)) ; this%btran_min_patch (:) = nan @@ -433,6 +440,16 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp) avgflag='A', long_name='sensible heat from veg', & ptr_patch=this%eflx_sh_veg_patch, set_lake=0._r8, c2l_scale_type='urbanf') + this%eflx_sh_stem_patch(begp:endp) = spval + call hist_addfld1d (fname='FSH_STEM', units='W/m^2', & + avgflag='A', long_name='sensible heat from stem', & + ptr_patch=this%eflx_sh_stem_patch, c2l_scale_type='urbanf',default = 'inactive') + + this%hs_canopy_patch(begp:endp) = spval + call hist_addfld1d (fname='HS_CANOPY', units='W/m^2', & + avgflag='A', long_name='heat change of stem', & + ptr_patch=this%hs_canopy_patch, set_lake=0._r8, c2l_scale_type='urbanf',default='inactive') + this%eflx_sh_grnd_patch(begp:endp) = spval call hist_addfld1d (fname='FSH_G', units='W/m^2', & avgflag='A', long_name='sensible heat from ground', & @@ -530,12 +547,10 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp) ptr_patch=this%cgrnds_patch, default='inactive', c2l_scale_type='urbanf') end if - if (use_cn) then - this%eflx_gnet_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_GNET', units='W/m^2', & - avgflag='A', long_name='net heat flux into ground', & - ptr_patch=this%eflx_gnet_patch, default='inactive', c2l_scale_type='urbanf') - end if + this%eflx_gnet_patch(begp:endp) = spval + call hist_addfld1d (fname='EFLX_GNET', units='W/m^2', & + avgflag='A', long_name='net heat flux into ground', & + ptr_patch=this%eflx_gnet_patch, default='inactive', c2l_scale_type='urbanf') this%eflx_grnd_lake_patch(begp:endp) = spval call hist_addfld1d (fname='EFLX_GRND_LAKE', units='W/m^2', & diff --git a/src/biogeophys/FrictionVelocityMod.F90 b/src/biogeophys/FrictionVelocityMod.F90 index ce793aa9bc..0b32c39c0a 100644 --- a/src/biogeophys/FrictionVelocityMod.F90 +++ b/src/biogeophys/FrictionVelocityMod.F90 @@ -52,6 +52,20 @@ module FrictionVelocityMod real(r8), pointer, public :: z0mg_col (:) ! col roughness length over ground, momentum [m] real(r8), pointer, public :: z0hg_col (:) ! col roughness length over ground, sensible heat [m] real(r8), pointer, public :: z0qg_col (:) ! col roughness length over ground, latent heat [m] + ! variables to add history output from CanopyFluxesMod + real(r8), pointer, public :: rah1_patch (:) ! patch sensible heat flux resistance [s/m] + real(r8), pointer, public :: rah2_patch (:) ! patch below-canopy sensible heat flux resistance [s/m] + real(r8), pointer, public :: raw1_patch (:) ! patch moisture flux resistance [s/m] + real(r8), pointer, public :: raw2_patch (:) ! patch below-canopy moisture flux resistance [s/m] + real(r8), pointer, public :: ustar_patch (:) ! patch friction velocity [m/s] + real(r8), pointer, public :: um_patch (:) ! patch wind speed including the stablity effect [m/s] + real(r8), pointer, public :: uaf_patch (:) ! patch canopy air speed [m/s] + real(r8), pointer, public :: taf_patch (:) ! patch canopy air temperature [K] + real(r8), pointer, public :: qaf_patch (:) ! patch canopy humidity [kg/kg] + real(r8), pointer, public :: obu_patch (:) ! patch Monin-Obukhov length [m] + real(r8), pointer, public :: zeta_patch (:) ! patch dimensionless stability parameter + real(r8), pointer, public :: vpd_patch (:) ! patch vapor pressure deficit [Pa] + contains @@ -129,6 +143,18 @@ subroutine InitAllocate(this, bounds) allocate(this%z0mg_col (begc:endc)) ; this%z0mg_col (:) = nan allocate(this%z0qg_col (begc:endc)) ; this%z0qg_col (:) = nan allocate(this%z0hg_col (begc:endc)) ; this%z0hg_col (:) = nan + allocate(this%rah1_patch (begp:endp)) ; this%rah1_patch (:) = nan + allocate(this%rah2_patch (begp:endp)) ; this%rah2_patch (:) = nan + allocate(this%raw1_patch (begp:endp)) ; this%raw1_patch (:) = nan + allocate(this%raw2_patch (begp:endp)) ; this%raw2_patch (:) = nan + allocate(this%um_patch (begp:endp)) ; this%um_patch (:) = nan + allocate(this%uaf_patch (begp:endp)) ; this%uaf_patch (:) = nan + allocate(this%taf_patch (begp:endp)) ; this%taf_patch (:) = nan + allocate(this%qaf_patch (begp:endp)) ; this%qaf_patch (:) = nan + allocate(this%ustar_patch (begp:endp)) ; this%ustar_patch (:) = nan + allocate(this%obu_patch (begp:endp)) ; this%obu_patch (:) = nan + allocate(this%zeta_patch (begp:endp)) ; this%zeta_patch (:) = nan + allocate(this%vpd_patch (begp:endp)) ; this%vpd_patch (:) = nan end subroutine InitAllocate @@ -201,7 +227,59 @@ subroutine InitHistory(this, bounds) ptr_patch=this%fv_patch, default='inactive') end if - if (use_cn) then + call hist_addfld1d (fname='RAH1', units='s/m', & + avgflag='A', long_name='aerodynamical resistance ', & + ptr_patch=this%rah1_patch, default='inactive') + this%rah2_patch(begp:endp) = spval + call hist_addfld1d (fname='RAH2', units='s/m', & + avgflag='A', long_name='aerodynamical resistance ', & + ptr_patch=this%rah2_patch, default='inactive') + this%raw1_patch(begp:endp) = spval + call hist_addfld1d (fname='RAW1', units='s/m', & + avgflag='A', long_name='aerodynamical resistance ', & + ptr_patch=this%raw1_patch, default='inactive') + this%raw2_patch(begp:endp) = spval + call hist_addfld1d (fname='RAW2', units='s/m', & + avgflag='A', long_name='aerodynamical resistance ', & + ptr_patch=this%raw2_patch, default='inactive') + this%ustar_patch(begp:endp) = spval + call hist_addfld1d (fname='USTAR', units='s/m', & + avgflag='A', long_name='aerodynamical resistance ', & + ptr_patch=this%ustar_patch, default='inactive') + this%um_patch(begp:endp) = spval + call hist_addfld1d (fname='UM', units='m/s', & + avgflag='A', long_name='wind speed plus stability effect', & + ptr_patch=this%um_patch, default='inactive') + this%uaf_patch(begp:endp) = spval + call hist_addfld1d (fname='UAF', units='m/s', & + avgflag='A', long_name='canopy air speed ', & + ptr_patch=this%uaf_patch, default='inactive') + this%taf_patch(begp:endp) = spval + call hist_addfld1d (fname='TAF', units='K', & + avgflag='A', long_name='canopy air temperature', & + ptr_patch=this%taf_patch, default='inactive') + this%qaf_patch(begp:endp) = spval + call hist_addfld1d (fname='QAF', units='kg/kg', & + avgflag='A', long_name='canopy air humidity', & + ptr_patch=this%qaf_patch, default='inactive') + this%obu_patch(begp:endp) = spval + call hist_addfld1d (fname='OBU', units='m', & + avgflag='A', long_name='Monin-Obukhov length', & + ptr_patch=this%obu_patch, default='inactive') + this%zeta_patch(begp:endp) = spval + call hist_addfld1d (fname='ZETA', units='unitless', & + avgflag='A', long_name='dimensionless stability parameter', & + ptr_patch=this%zeta_patch, default='inactive') + this%vpd_patch(begp:endp) = spval + call hist_addfld1d (fname='VPD', units='Pa', & + avgflag='A', long_name='vpd', & + ptr_patch=this%vpd_patch, default='inactive') + this%rb1_patch(begp:endp) = spval + call hist_addfld1d (fname='RB', units='s/m', & + avgflag='A', long_name='leaf boundary resistance', & + ptr_patch=this%rb1_patch, default='inactive') + + if (use_cn) then this%z0hv_patch(begp:endp) = spval call hist_addfld1d (fname='Z0HV', units='m', & avgflag='A', long_name='roughness length over vegetation, sensible heat', & diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index 1dabba664d..7ce0d57e9b 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -83,6 +83,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & !----------------------------------------------------------------------- associate( & + eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] eflx_h2osfc_to_snow_col => energyflux_inst%eflx_h2osfc_to_snow_col , & ! Input: [real(r8) (:) ] col snow melt to h2osfc heat flux (W/m**2) forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) @@ -302,7 +303,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! Total fluxes (vegetation + ground) - eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_grnd(p) + eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_stem(p) + eflx_sh_grnd(p) qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) eflx_lh_tot(p)= hvap*qflx_evap_veg(p) + htvp(c)*qflx_evap_soi(p) if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index e2516505e7..ed0185f261 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -22,6 +22,7 @@ module TemperatureType type, public :: temperature_type ! Temperatures + real(r8), pointer :: t_stem_patch (:) ! patch stem temperatu\re (Kelvin) real(r8), pointer :: t_veg_patch (:) ! patch vegetation temperature (Kelvin) real(r8), pointer :: t_veg_day_patch (:) ! patch daytime accumulative vegetation temperature (Kelvinx*nsteps), LUNA specific, from midnight to current step real(r8), pointer :: t_veg_night_patch (:) ! patch night-time accumulative vegetation temperature (Kelvin*nsteps), LUNA specific, from midnight to current step @@ -186,6 +187,7 @@ subroutine InitAllocate(this, bounds) begg = bounds%begg; endg= bounds%endg ! Temperatures + allocate(this%t_stem_patch (begp:endp)) ; this%t_stem_patch (:) = nan allocate(this%t_veg_patch (begp:endp)) ; this%t_veg_patch (:) = nan if(use_luna) then allocate(this%t_veg_day_patch (begp:endp)) ; this%t_veg_day_patch (:) = spval @@ -378,6 +380,11 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) avgflag='A', long_name='Urban daily maximum of average 2-m temperature', & ptr_patch=this%t_ref2m_max_u_patch, set_nourb=spval, default='inactive') + this%t_stem_patch(begp:endp) = spval + call hist_addfld1d (fname='TSTEM', units='K', & + avgflag='A', long_name='stem temperature', & + ptr_patch=this%t_stem_patch, default='inactive') + this%t_veg_patch(begp:endp) = spval call hist_addfld1d (fname='TV', units='K', & avgflag='A', long_name='vegetation temperature', & @@ -770,6 +777,8 @@ subroutine InitCold(this, bounds, & this%t_veg_patch(p) = 283._r8 end if + this%t_stem_patch(p) = this%t_veg_patch(p) + if (use_vancouver) then this%t_ref2m_patch(p) = 297.56 else if (use_mexicocity) then From caca8dd07668e65ef672e2d82bdf230686bae51f Mon Sep 17 00:00:00 2001 From: Ronny Meier Date: Fri, 1 Jun 2018 12:02:45 +0200 Subject: [PATCH 0174/1973] Attribution of a soil column to each natural vegetation patch Author: Ronny Meier modified: initGridCellsMod.F90 and subgridMod.F90 Modification is not fully completed yet. Switch will be added later on in namelist. --- src/main/initGridCellsMod.F90 | 78 +++++++++++++++++++++++++++++++++-- src/main/subgridMod.F90 | 18 ++++++-- 2 files changed, 89 insertions(+), 7 deletions(-) diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 index e7053130db..0bb499ddba 100644 --- a/src/main/initGridCellsMod.F90 +++ b/src/main/initGridCellsMod.F90 @@ -38,6 +38,7 @@ module initGridCellsMod ! ! !PRIVATE MEMBER FUNCTIONS: private set_landunit_veg_compete + private set_landunit_veg_noncompete private set_landunit_wet_lake private set_landunit_ice_mec private set_landunit_crop_noncompete @@ -73,6 +74,7 @@ subroutine initGridcells(glc_behavior) integer :: nclumps ! number of clumps on this processor type(bounds_type) :: bounds_proc type(bounds_type) :: bounds_clump + logical :: sesc = .TRUE. ! switch for separated soil columns of natural vegetation !------------------------------------------------------------------------ ! Notes about how this routine is arranged, and its implications for the arrangement @@ -132,11 +134,17 @@ subroutine initGridcells(glc_behavior) li = bounds_clump%begl-1 ci = bounds_clump%begc-1 pi = bounds_clump%begp-1 + ! Determine naturally vegetated landunit do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_veg_compete( & - ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) + if(sesc) then + call set_landunit_veg_noncompete( & + ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) + else + call set_landunit_veg_compete( & + ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) + end if end do ! Determine crop landunit @@ -246,7 +254,7 @@ subroutine set_landunit_veg_compete (ltype, gi, li, ci, pi) ! Set decomposition properties call subgrid_get_info_natveg(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits) + npatches=npatches, ncols=ncols, nlunits=nlunits, sesc=.FALSE.) wtlunit2gcell = wt_lunit(gi, ltype) nlunits_added = 0 @@ -274,6 +282,70 @@ subroutine set_landunit_veg_compete (ltype, gi, li, ci, pi) SHR_ASSERT(npatches_added == npatches, errMsg(sourcefile, __LINE__)) end subroutine set_landunit_veg_compete + + !------------------------------------------------------------------------ + subroutine set_landunit_veg_noncompete (ltype, gi, li, ci, pi) + ! + ! !DESCRIPTION: + ! Initialize vegetated landunit without competition (called if sesc switch + ! is true) + ! + ! !USES + use clm_instur, only : wt_lunit, wt_nat_patch + use subgridMod, only : subgrid_get_info_natveg, natveg_patch_exists + use clm_varpar, only : numpft, maxpatch_pft, natpft_lb, natpft_ub + ! + ! !ARGUMENTS: + integer , intent(in) :: ltype ! landunit type + integer , intent(in) :: gi ! gridcell index + integer , intent(inout) :: li ! landunit index + integer , intent(inout) :: ci ! column index + integer , intent(inout) :: pi ! patch index + ! + ! !LOCAL VARIABLES: + integer :: m ! index + integer :: npatches ! number of patches in landunit + integer :: ncols + integer :: nlunits + integer :: npatches_added ! number of patches actually added + integer :: ncols_added ! number of columns actually added + integer :: nlunits_added ! number of landunits actually added + real(r8) :: wtlunit2gcell ! landunit weight in gridcell + !------------------------------------------------------------------------ + + ! Set decomposition properties + + call subgrid_get_info_natveg(gi, & + npatches=npatches, ncols=ncols, nlunits=nlunits, sesc=.TRUE.) + wtlunit2gcell = wt_lunit(gi, ltype) + + nlunits_added = 0 + ncols_added = 0 + npatches_added = 0 + + if (nlunits > 0) then + call add_landunit(li=li, gi=gi, ltype=ltype, wtgcell=wtlunit2gcell) + nlunits_added = nlunits_added + 1 + + + do m = natpft_lb,natpft_ub + if (natveg_patch_exists(gi, m)) then + ! Assume one column for each vegetation patch + call add_column(ci=ci, li=li, ctype=1, wtlunit=wt_nat_patch(gi,m)) + ncols_added = ncols_added + 1 + + call add_patch(pi=pi, ci=ci, ptype=m, wtcol=1.0_r8) + npatches_added = npatches_added + 1 + end if + end do + end if + + SHR_ASSERT(nlunits_added == nlunits, errMsg(sourcefile, __LINE__)) + SHR_ASSERT(ncols_added == ncols, errMsg(sourcefile, __LINE__)) + SHR_ASSERT(npatches_added == npatches, errMsg(sourcefile, __LINE__)) + + end subroutine set_landunit_veg_compete + !------------------------------------------------------------------------ subroutine set_landunit_wet_lake (ltype, gi, li, ci, pi) diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index 6358e90b5e..f152466ea4 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -74,6 +74,8 @@ subroutine subgrid_get_gcellinfo (gi, glc_behavior, & ! atm_topo is arbitrary for the sake of getting these counts. We don't have a true ! atm_topo value at the point of this call, so use 0. real(r8), parameter :: atm_topo = 0._r8 + logical :: sesc = .TRUE. ! switch for separated soil columns of natural vegetation + !------------------------------------------------------------------------------ npatches = 0 @@ -81,7 +83,7 @@ subroutine subgrid_get_gcellinfo (gi, glc_behavior, & nlunits = 0 ncohorts = 0 - call subgrid_get_info_natveg(gi, npatches_temp, ncols_temp, nlunits_temp) + call subgrid_get_info_natveg(gi, npatches_temp, ncols_temp, nlunits_temp, sesc) call accumulate_counters() call subgrid_get_info_urban_tbd(gi, npatches_temp, ncols_temp, nlunits_temp) @@ -123,7 +125,7 @@ end subroutine accumulate_counters end subroutine subgrid_get_gcellinfo !----------------------------------------------------------------------- - subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits) + subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits, sesc) ! ! !DESCRIPTION: ! Obtain properties for natural vegetated landunit in this grid cell @@ -133,6 +135,8 @@ subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits) ! ! !ARGUMENTS: integer, intent(in) :: gi ! grid cell index + logical, intent(in) :: sesc ! switch for separated soil columns of natural vegetation + integer, intent(out) :: npatches ! number of nat veg patches in this grid cell integer, intent(out) :: ncols ! number of nat veg columns in this grid cell integer, intent(out) :: nlunits ! number of nat veg landunits in this grid cell @@ -152,8 +156,14 @@ subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits) end do if (npatches > 0) then - ! Assume that the vegetated landunit has one column - ncols = 1 + if(sesc) then + ! Assume one soil column for each patch + ncols = npatches + else + ! Assume that the vegetated landunit has one column + ncols = 1 + end if + nlunits = 1 else ! As noted in natveg_patch_exists, we expect a naturally vegetated landunit in From f1cbb8a0c46f93a1dbfe2407d3f760dc1d05f69d Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 5 Jun 2018 14:45:52 -0600 Subject: [PATCH 0175/1973] Fixed some MOSART chapter typos --- .../MOSART/CLM50_Tech_Note_MOSART.rst | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst index eabdb50763..e9f07d7752 100644 --- a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst +++ b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst @@ -11,9 +11,9 @@ Overview MOSART is a river transport model designed for applications across local, regional and global scales :ref:`(Li et al., 2013b) `. A major purpose of MOSART is to provide freshwater input for the ocean -model in coupled Earth system model. MOSART also provides an effective +model in coupled Earth System Models. MOSART also provides an effective way of evaluating and diagnosing the soil hydrology simulated by land -surface models through direction comparison of the simulated river flow +surface models through direct comparison of the simulated river flow with observations of natural streamflow at gauging stations :ref:`(Li et al., 2015a)`. Moreover, MOSART provides a modeling framework for representing riverine transport and transformation @@ -28,9 +28,9 @@ Routing Processes MOSART divides each spatial unit such as a lat/lon grid or watershed into three categories of hydrologic units (as shown in :numref:`Figure MOSART conceptual diagram`): hillslopes -that contribute both surface and subsurface runoff into tributaries, +that convert both surface and subsurface runoff into tributaries, tributaries that discharge into a single main channel, and the main channel -connects the local spatial unit with upstream/downstream units through the +that connects the local spatial unit with upstream/downstream units through the river network. MOSART assumes that all the tributaries within a spatial unit can be treated as a single hypothetical sub-network channel with a transport capacity equivalent to all the tributaries combined. Correspondingly, three @@ -50,14 +50,14 @@ and discharges the water to its downstream spatial unit or the ocean. :height: 400px -MOSART only route positive runoff, although negative runoff could be generated +MOSART only routes positive runoff, although negative runoff can be generated occasionally by the land model (e.g., :math:`q_{gwl}`). Negative runoff in any runoff component including :math:`q_{sur}`, :math:`q_{sub}`, :math:`q_{gwl}` is not routed through MOSART, but instead is mapped directly from the spatial unit where it is generated at any time step to the coupler. In MOSART, the travel velocities of water across hillslopes, sub-network and main -channel are all estimated using the Manning’s equation with different levels of +channel are all estimated using Manning’s equation with different levels of simplifications. Generally the Manning’s equation is in the form of .. math:: @@ -65,9 +65,9 @@ simplifications. Generally the Manning’s equation is in the form of V = \frac{R^{\frac{2}{3}} S_{f}}{n} -where :math: `V` is the travel velocity (m s :sup:`-1` ), :math:`R` is the hydraulic -radius (m). :math:`S_{f}` is the friction slope, and accounting for the effects -of gravity, friction, inertia and other forces onthe water. If the channel slope +where :math:`V` is the travel velocity (m s :sup:`-1` ), :math:`R` is the hydraulic +radius (m). :math:`S_{f}` is the friction slope that accounts for the effects +of gravity, friction, inertia and other forces on the water. If the channel slope is steep enough, the gravity force dominates over the others so one can approximate :math:`S_{f}` by the channel bed slope :math:`S` , which is the key assumption underpinning the kinematic wave method. :math:`n` is the Manning’s roughness @@ -97,7 +97,7 @@ For the main channel, the hydraulic radius is given by where :math:`A_{r}` (m :sup:`2` ) is the wetted area defined as the part of the channel cross-section area below the water surface, :math:`P_{r}` (m) is the -wetted perimeter (m), the perimeter confines in the wetted area. +wetted perimeter, the perimeter confined in the wetted area. For hillslopes, sub-network and main channels, a common continuity equation can be written as @@ -134,14 +134,14 @@ scheme and a local time-stepping algorithm. There are two levels of subcycling. For convenience, we denote :math:`T_{inputs}` (s), :math:`T_{mosart}` (s), :math:`T_{hillslope}` (s) and :math:`T_{channel}` (s) as the time steps of runoff inputs (from CLM -to MOSART via the flux coupler), MOSART routing, hillslope routing and -channel routing respectively. The first level of subcycling is between +to MOSART via the flux coupler), MOSART routing, hillslope routing, and +channel routing, respectively. The first level of subcycling is between the runoff inputs and MOSART routing. If :math:`T_{inputs}` is 10800s and :math:`T_{mosart}` is 3600s, three MOSART time steps will be invoked each time the runoff inputs are updated. The second level of subcycling is between the hillslope routing and channel routing. This is to account for the fact that the travel velocity of water across -hillslope is usually much slower than that in the channels. +hillslopes is usually much slower than that in the channels. :math:`T_{hillslope}` is usually set as the same as :math:`T_{mosart}`, but within each time step of hillslope routing there are a few time steps for channel routing, i.e., @@ -154,7 +154,7 @@ step of local channel routing is given as :math:`T_{local}=T_{channel}/D_{local}`. :math:`D_{local}` is currently estimated empirically as a function of local channel slope, width, length and upstream drainage area. If MOSART crashes due to a -numerical issue, we recommend to increase :math:`D_{levelH2R}` and, if +numerical issue, we recommend increasing :math:`D_{levelH2R}` and, if the issue remains, reducing :math:`T_{mosart}`. .. _Parameters and Input Data: @@ -165,7 +165,7 @@ Parameters and Input Data MOSART is supported by a comprehensive, global hydrography dataset at 0.5 :sup:`o` resolution. As such, the fundamental spatial unit of MOSART is a 0.5 :sup:`o` lat/lon grid. The topographic parameters (such as flow direction, -channel length, topographic and channel slopes etc.) were derived using the +channel length, topographic and channel slopes, etc.) were derived using the Dominant River Tracing (DRT) algorithm (:ref:`Wu et al., 2011` ; :ref:`Wu et al. 2012 `). The DRT algorithm produces the topographic parameters in a scale-consistent way to preserve/upscale the key features of @@ -183,7 +183,7 @@ on the methodology to derive channel geometry and the Manning’s roughness coefficients, please refer to :ref:`Getirana et al. (2012) ` . The full list of parameters included in this global hydrography dataset is provided in -the :numref:`Table MOSART Parameters`. Evaluation of global simulations +:numref:`Table MOSART Parameters`. Evaluation of global simulations by MOSART using the aforementioned parameters is described in :ref:`Li et al. (2015b) ` . @@ -231,16 +231,16 @@ river routing, whilst in CLM5.0, MOSART is an added option for river routing based on the more physically-based kinematic wave method. 2. Runoff treatment: In RTM runoff is routed regardless of its sign so -negative streamflow can be simulated at times. MOSART routes only nonnegative +negative streamflow can be simulated at times. MOSART routes only non-negative runoff and always produces positive streamflow, which is important for -future extension for modeling riverine heat and biogeochemical fluxes. +future extensions to model riverine heat and biogeochemical fluxes. -3. Input parameters: RTM in CLM4.5 only requires one layer of spatial variable -of channel velocity, whilst MOSART in CLM5.0 requires 13 parameters that +3. Input parameters: RTM in CLM4.5 only requires one layer of a spatially varying +variable of channel velocity, whilst MOSART in CLM5.0 requires 13 parameters that are all available globally at 0.5 :sup:`o` resolution. 4. Outputs: RTM only produces streamflow simulation, whilst MOSART -additionally simulates the time-varying channel velocities and channel -water depth and channel surface water variation. +additionally simulates the time-varying channel velocities, channel water depth, and +channel surface water variations. From ee25cdf7fc14766a4cf34d024c4ebb61bf76fabf Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 11 Jun 2018 14:11:15 -0600 Subject: [PATCH 0176/1973] merge ekluzek's radtemp branch with ronnymeier's sesc branch --- bld/CLMBuildNamelist.pm | 12 ++++- .../namelist_defaults_clm4_5.xml | 5 ++ .../namelist_definition_clm4_5.xml | 10 ++++ src/biogeophys/CanopyFluxesMod.F90 | 53 +++++++++++++------ src/main/clm_varctl.F90 | 12 +++++ src/main/controlMod.F90 | 8 +++ src/main/initGridCellsMod.F90 | 8 +-- src/main/subgridMod.F90 | 5 +- 8 files changed, 89 insertions(+), 24 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 00807d049c..b81a8663aa 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1572,7 +1572,7 @@ sub process_namelist_inline_logic { setup_logic_subgrid($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_fertilizer($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_grainproduct($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_soilstate($opts, $nl_flags, $definition, $defaults, $nl, $physv); + setup_logic_pftsoilcolumn($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_demand($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_surface_dataset($opts, $nl_flags, $definition, $defaults, $nl, $physv); if ( remove_leading_and_trailing_quotes($nl_flags->{'clm_start_type'}) ne "branch" ) { @@ -2192,6 +2192,15 @@ sub error_if_set { } +#------------------------------------------------------------------------------- +sub setup_logic_pftsoilcolumn { + my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; + + if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_individual_pft_soil_column'); + } +} + #------------------------------------------------------------------------------- sub setup_logic_soilstate { @@ -3616,6 +3625,7 @@ sub setup_logic_canopyfluxes { if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_undercanopy_stability' ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_biomass_heat_storage'); } } diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 1a3629725d..0d6f428f88 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -131,6 +131,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. +.false. + 1 0 @@ -229,6 +231,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .true. +.false. + + .true. diff --git a/bld/namelist_files/namelist_definition_clm4_5.xml b/bld/namelist_files/namelist_definition_clm4_5.xml index 44b98a18b4..e19d1a9a46 100644 --- a/bld/namelist_files/namelist_definition_clm4_5.xml +++ b/bld/namelist_files/namelist_definition_clm4_5.xml @@ -131,6 +131,11 @@ specify spatially variable soil thickness. If not present, use bottom of soil column (nlevsoi). + +If TRUE, each pft exists on a separate soil column. + + Index of rooting profile for water @@ -303,6 +308,11 @@ Intercept of free living Nitrogen fixation with zero annual ET If TRUE use the undercanopy stability term used with CLM4.5 (Sakaguchi&Zeng, 2008) + +If TRUE, include biomass heat storage in canopy energy balance. + + Fraction of intercepted precipitation diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index cb43a9cb5d..34bc959f85 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -68,7 +68,7 @@ module CanopyFluxesMod logical, private :: snowveg_on = .false. ! snowveg_flag = 'ON' logical, private :: snowveg_onrad = .true. ! snowveg_flag = 'ON_RAD' logical, private :: use_undercanopy_stability = .true. ! use undercanopy stability term or not - + logical, private :: use_biomass_heat_storage = .false. ! include biomass heat storage character(len=*), parameter, private :: sourcefile = & __FILE__ !------------------------------------------------------------------------------ @@ -99,7 +99,7 @@ subroutine CanopyFluxesReadNML(NLFilename) character(len=*), parameter :: nmlname = 'canopyfluxes_inparm' !----------------------------------------------------------------------- - namelist /canopyfluxes_inparm/ use_undercanopy_stability + namelist /canopyfluxes_inparm/ use_undercanopy_stability,use_biomass_heat_storage ! Initialize options to default values, in case they are not specified in ! the namelist @@ -121,6 +121,7 @@ subroutine CanopyFluxesReadNML(NLFilename) end if call shr_mpi_bcast (use_undercanopy_stability, mpicom) + call shr_mpi_bcast (use_biomass_heat_storage, mpicom) if (masterproc) then write(iulog,*) ' ' @@ -353,20 +354,24 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: cp_veg(bounds%begp:bounds%endp) !heat capacity of veg real(r8) :: cp_stem(bounds%begp:bounds%endp) !heat capacity of stems - real(r8) :: dt_stem(bounds%begp:bounds%endp) + real(r8) :: dt_stem(bounds%begp:bounds%endp) !change in stem temperature real(r8) :: fstem(bounds%begp:bounds%endp) !fraction of stem - real(r8) :: bhd(0:mxpft) !stem breast-height-diameter - real(r8) :: wood_density, carea_stem real(r8) :: lw_stem(bounds%begp:bounds%endp) !internal longwave stem real(r8) :: lw_leaf(bounds%begp:bounds%endp) !internal longwave leaf real(r8) :: sa_stem(bounds%begp:bounds%endp) !surface area stem m2/m2_ground real(r8) :: sa_leaf(bounds%begp:bounds%endp) !surface area leaf m2/m2_ground real(r8) :: sa_internal(bounds%begp:bounds%endp) !min(sa_stem,sa_leaf) real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed + real(r8) :: bhd(0:mxpft) !stem breast-height-diameter + real(r8) :: fbw(0:mxpft) !stem diameter at breast-height + real(r8) :: nstem(0:mxpft) !number of stems per m2 + real(r8) :: rstem(0:mxpft) !stem resistance to heat transfer, per stem diameter + real(r8) :: wood_density(0:mxpft) !wood density (kg/m3) + real(r8) :: cp_wood + real(r8) :: carea_stem + real(r8) :: rstema ! biomass parameters real(r8), parameter :: c_to_b = 2.0_r8 !(g biomass /g C) - real(r8), parameter :: ntree = 0.4_r8 !(number of trees / m2) - real(r8), parameter :: rstem = 100._r8 !stem resistance (s/m) real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume @@ -626,8 +631,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, hs_canopy(p) = 0._r8 end do -! set bhd (should be done on parameter file) +! set pft specific stem properties (should be done on parameter file) bhd(1:16) = (/0.15,0.15,0.15,0.2,0.2,0.2,0.2,0.1,0.02,0.02,0.02,0.004,0.004,0.004,0.004,0.004/) + fbw(1:16) = (/0.45,0.45,0.45,0.6,0.6,0.6,0.6,0.45,0.5,0.5,0.5,0.7,0.7,0.7,0.7,0.7/) + nstem(1:16) = (/0.4,0.4,0.4,0.2,0.2,0.2,0.2,0.4,1.,1.,1.,100.,100.,100.,100.,100./) + rstem(1:16) = (/100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100./) + wood_density(1:16) = (/500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500./) ! calculate biomass heat capacities do f = 1, fn @@ -636,34 +645,45 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! fraction of stem receiving incoming radiation fstem(p) = (esai(p))/(elai(p)+esai(p)) fstem(p) = k_vert * fstem(p) + if(.not.use_biomass_heat_storage) then + fstem(p) = 0._r8 + endif +! do not calculate separate leaf/stem heat capacity for grasses + if(patch%itype(p) > 11) fstem(p) = 0.0 + ! leaf and stem surface area sa_leaf(p) = elai(p) ! double in spirit of full surface area for sensible heat sa_leaf(p) = 2.*sa_leaf(p) - sa_stem(p) = ntree*(htop(p)*shr_const_pi*bhd(patch%itype(p))) + + sa_stem(p) = nstem(patch%itype(p))*(htop(p)*shr_const_pi*bhd(patch%itype(p))) ! adjust for departure of cylindrical stem model sa_stem(p) = k_cyl_area * sa_stem(p) + if(.not.use_biomass_heat_storage) then + sa_stem(p) = 0._r8 + endif +! do not calculate separate leaf/stem heat capacity for grasses + if(patch%itype(p) > 11) sa_stem(p) = 0.0 + ! internal longwave fluxes between leaf and stem ! surface area term must be equal, remainder cancels ! (use same area of interaction i.e. ignore leaf <-> leaf) sa_internal(p) = min(sa_leaf(p),sa_stem(p)) sa_internal(p) = k_internal * sa_internal(p) -!scs: specify heat capacity of vegetation +! calculate specify heat capacity of vegetation !(lma * c2b = lma_dry, lma * c2b * (fw/(1-fw)) = lma_wet, sum these) ! lma_dry has units of kg dry mass /m2 here (table 2 of bonan 2017) ! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) - cp_veg(p) = (0.25_r8 * elai(p)) * (1400._r8 + (0.7/(1.-0.7))*4188._r8) + cp_veg(p) = (0.25_r8 * max(0.01_r8,elai(p))) * (1400._r8 + (fbw(patch%itype(p))/(1.-fbw(patch%itype(p))))*4188._r8) -! wood density could vary by pft... - wood_density = 5.e2_r8 ! kg/m3 lindroth2010 uses ~4.e2 carea_stem = shr_const_pi * (bhd(patch%itype(p))*0.5)**2 ! cp-stem will have units J/k/ground_area (here assuming 1 stem/m2) - cp_stem(p) = (1400._r8 + (0.7/(1.-0.7))*4188._r8) + cp_stem(p) = (1400._r8 + (fbw(patch%itype(p))/(1.-fbw(patch%itype(p))))*4188._r8) ! use weight of dry wood - cp_stem(p) = cp_stem(p) * ntree * wood_density * htop(p) * carea_stem + cp_stem(p) = nstem(patch%itype(p))* cp_stem(p) * wood_density(patch%itype(p)) * htop(p) * carea_stem ! adjust for departure from cylindrical stem model cp_stem(p) = k_cyl_vol * cp_stem(p) enddo @@ -997,7 +1017,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, wtg(p) = 1._r8/rah(p,2) ! ground ! wtstem = sa_stem(p)/rb(p) ! stem ! add resistance between internal stem temperature and canopy air - wtstem = sa_stem(p)/(rstem + rb(p)) ! stem + rstema = rstem(patch%itype(p))*bhd(patch%itype(p)) + wtstem = sa_stem(p)/(rstema + rb(p)) ! stem wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 938155c5dd..2c4ad5c371 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -237,6 +237,18 @@ module clm_varctl logical, public :: use_lai_streams = .false. ! true => use lai streams in SatellitePhenologyMod.F90 + !---------------------------------------------------------- + ! biomass heat storage switch + !---------------------------------------------------------- + + logical, public :: use_biomass_heat_storage = .false. ! true => include biomass heat storage in canopy energy budget + + !---------------------------------------------------------- + ! each pft has individual soil column switch + !---------------------------------------------------------- + + logical, public :: use_individual_pft_soil_column = .false. ! true => each pft exists on its own soil column + !---------------------------------------------------------- ! bedrock / soil depth switch !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 9cc442d026..4f94ead66c 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -231,6 +231,10 @@ subroutine control_init( ) namelist /clm_inparm/ use_bedrock + namelist /clm_inparm/ use_biomass_heat_storage + + namelist /clm_inparm/ use_individual_pft_soil_column + namelist /clm_inparm/ use_hydrstress namelist /clm_inparm/ use_dynroot @@ -655,6 +659,10 @@ subroutine control_spmd() call mpi_bcast (use_bedrock, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_biomass_heat_storage, 1, MPI_LOGICAL, 0, mpicom, ier) + + call mpi_bcast (use_individual_pft_soil_column, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_hydrstress, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_dynroot, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 index 0bb499ddba..be4c2d154b 100644 --- a/src/main/initGridCellsMod.F90 +++ b/src/main/initGridCellsMod.F90 @@ -63,7 +63,7 @@ subroutine initGridcells(glc_behavior) use subgridWeightsMod , only : compute_higher_order_weights use landunit_varcon , only : istsoil, istwet, istdlak, istice_mec use landunit_varcon , only : isturb_tbd, isturb_hd, isturb_md, istcrop - use clm_varctl , only : use_fates + use clm_varctl , only : use_fates,use_individual_pft_soil_column use shr_const_mod , only : SHR_CONST_PI ! ! !ARGUMENTS: @@ -74,7 +74,7 @@ subroutine initGridcells(glc_behavior) integer :: nclumps ! number of clumps on this processor type(bounds_type) :: bounds_proc type(bounds_type) :: bounds_clump - logical :: sesc = .TRUE. ! switch for separated soil columns of natural vegetation + !------------------------------------------------------------------------ ! Notes about how this routine is arranged, and its implications for the arrangement @@ -138,7 +138,7 @@ subroutine initGridcells(glc_behavior) ! Determine naturally vegetated landunit do gdc = bounds_clump%begg,bounds_clump%endg - if(sesc) then + if(use_individual_pft_soil_column) then call set_landunit_veg_noncompete( & ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) else @@ -344,7 +344,7 @@ subroutine set_landunit_veg_noncompete (ltype, gi, li, ci, pi) SHR_ASSERT(ncols_added == ncols, errMsg(sourcefile, __LINE__)) SHR_ASSERT(npatches_added == npatches, errMsg(sourcefile, __LINE__)) - end subroutine set_landunit_veg_compete + end subroutine set_landunit_veg_noncompete !------------------------------------------------------------------------ diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index f152466ea4..c118220cb2 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -14,7 +14,7 @@ module subgridMod use shr_log_mod , only : errMsg => shr_log_errMsg use spmdMod , only : masterproc use abortutils , only : endrun - use clm_varctl , only : iulog + use clm_varctl , only : iulog,use_individual_pft_soil_column use clm_instur , only : wt_lunit, wt_nat_patch, urban_valid, wt_cft use landunit_varcon, only : istcrop, istdlak, istwet, isturb_tbd, isturb_hd, isturb_md use glcBehaviorMod , only : glc_behavior_type @@ -74,7 +74,6 @@ subroutine subgrid_get_gcellinfo (gi, glc_behavior, & ! atm_topo is arbitrary for the sake of getting these counts. We don't have a true ! atm_topo value at the point of this call, so use 0. real(r8), parameter :: atm_topo = 0._r8 - logical :: sesc = .TRUE. ! switch for separated soil columns of natural vegetation !------------------------------------------------------------------------------ @@ -83,7 +82,7 @@ subroutine subgrid_get_gcellinfo (gi, glc_behavior, & nlunits = 0 ncohorts = 0 - call subgrid_get_info_natveg(gi, npatches_temp, ncols_temp, nlunits_temp, sesc) + call subgrid_get_info_natveg(gi, npatches_temp, ncols_temp, nlunits_temp, use_individual_pft_soil_column) call accumulate_counters() call subgrid_get_info_urban_tbd(gi, npatches_temp, ncols_temp, nlunits_temp) From 2b9419ffef900b44d05973b74a65089897b08a48 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 11 Jun 2018 14:21:59 -0600 Subject: [PATCH 0177/1973] add setup_logic_soilstate to bld/CLMBuildNamelist.pm --- bld/CLMBuildNamelist.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 5f4d6d4c04..3f3d6bafb8 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1573,6 +1573,7 @@ sub process_namelist_inline_logic { setup_logic_fertilizer($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_grainproduct($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_pftsoilcolumn($opts, $nl_flags, $definition, $defaults, $nl, $physv); + setup_logic_soilstate($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_demand($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_surface_dataset($opts, $nl_flags, $definition, $defaults, $nl, $physv); if ( remove_leading_and_trailing_quotes($nl_flags->{'clm_start_type'}) ne "branch" ) { From c0f744b934f34ff01398d573023cf90c352cbdba Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 12 Jun 2018 09:11:46 -0600 Subject: [PATCH 0178/1973] initialize hs_canopy and eflx_hs_stem --- src/biogeophys/BareGroundFluxesMod.F90 | 4 ++++ src/biogeophys/CanopyFluxesMod.F90 | 1 + src/biogeophys/SoilFluxesMod.F90 | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index cfbc99b740..2500453902 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -112,6 +112,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & !------------------------------------------------------------------------------ associate( & + hs_canopy => energyflux_inst%hs_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] + eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:,:) ] evaporative soil resistance (s/m) snl => col%snl , & ! Input: [integer (:) ] number of snow layers dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) @@ -251,6 +253,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & displa(p) = 0._r8 dlrad(p) = 0._r8 ulrad(p) = 0._r8 + hs_canopy(p) = 0._r8 + eflx_sh_stem(p) = 0._r8 ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) dth(p) = thm(p)-t_grnd(c) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 34bc959f85..a9b45270d3 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -629,6 +629,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, btran(p) = btran0 btran2(p) = btran0 hs_canopy(p) = 0._r8 + eflx_sh_stem(p) = 0._r8 end do ! set pft specific stem properties (should be done on parameter file) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index c4b5852372..fbafcb8f6e 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -311,7 +311,9 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! Total fluxes (vegetation + ground) - eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_stem(p) + eflx_sh_grnd(p) +! eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_stem(p) + eflx_sh_grnd(p) + eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_grnd(p) + if (.not. lun%urbpoi(l)) eflx_sh_tot(p) = eflx_sh_tot(p) + eflx_sh_stem(p) qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) eflx_lh_tot(p)= hvap*qflx_evap_veg(p) + htvp(c)*qflx_evap_soi(p) if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then From 508a8faa40ee531d345680a8ca179e36fa4a4ec8 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 12 Jun 2018 12:36:49 -0600 Subject: [PATCH 0179/1973] add t_stem restart, change bhd/nstem, comment out lnd2glc endrun --- src/biogeophys/CanopyFluxesMod.F90 | 10 ++++++++-- src/biogeophys/TemperatureType.F90 | 5 +++++ src/main/lnd2glcMod.F90 | 4 +++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index a9b45270d3..c3d009b31b 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -633,9 +633,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, end do ! set pft specific stem properties (should be done on parameter file) - bhd(1:16) = (/0.15,0.15,0.15,0.2,0.2,0.2,0.2,0.1,0.02,0.02,0.02,0.004,0.004,0.004,0.004,0.004/) + bhd(1:16) = (/0.2,0.3,0.3,0.35,0.35,0.25,0.25,0.2,0.05,0.05,0.05,0.008,0.008,0.008,0.008,0.008/) fbw(1:16) = (/0.45,0.45,0.45,0.6,0.6,0.6,0.6,0.45,0.5,0.5,0.5,0.7,0.7,0.7,0.7,0.7/) - nstem(1:16) = (/0.4,0.4,0.4,0.2,0.2,0.2,0.2,0.4,1.,1.,1.,100.,100.,100.,100.,100./) + nstem(1:16) = (/0.4,0.4,0.4,0.2,0.2,0.2,0.2,0.4,0.5,0.5,0.5,100.,100.,100.,100.,100./) rstem(1:16) = (/100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100./) wood_density(1:16) = (/500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500./) @@ -1397,6 +1397,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-fstem(p))*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+fstem(p)*tsbef(p)**3*(tsbef(p) + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) +!scs +if(ulrad(p) > 0. .and. ulrad(p) < 5.e3) then +else +write(iulog,*) 'badulrad: ', p, patch%itype(p),ulrad(p),tlbef(p),tsbef(p),dt_stem(p) +endif + !ABT ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction ! The weight is the so-called vegetation emissivity, but not that emv is actually an attentuation diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 00e714e20b..43bd8f682e 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -886,6 +886,11 @@ subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildt long_name='vegetation temperature', units='K', & interpinic_flag='interp', readvar=readvar, data=this%t_veg_patch) + call restartvar(ncid=ncid, flag=flag, varname='T_STEM', xtype=ncd_double, & + dim1name='pft', & + long_name='stem temperature', units='K', & + interpinic_flag='interp', readvar=readvar, data=this%t_stem_patch) + call restartvar(ncid=ncid, flag=flag, varname='TH2OSFC', xtype=ncd_double, & dim1name='column', & long_name='surface water temperature', units='K', & diff --git a/src/main/lnd2glcMod.F90 b/src/main/lnd2glcMod.F90 index 9de7eba3f3..a704245d0b 100644 --- a/src/main/lnd2glcMod.F90 +++ b/src/main/lnd2glcMod.F90 @@ -204,7 +204,9 @@ subroutine update_lnd2glc(this, bounds, num_do_smb_c, filter_do_smb_c, & ! Make sure we haven't already assigned the coupling fields for this point ! (this could happen, for example, if there were multiple columns in the ! istsoil landunit, which we aren't prepared to handle) - if (fields_assigned(g,n)) then +!FIXTHIS!!! if (fields_assigned(g,n)) then +! This is commented out so that multiple soil columns can be enabled + if (1==2) then write(iulog,*) subname//' ERROR: attempt to assign coupling fields twice for the same index.' write(iulog,*) 'One possible cause is having multiple columns in the istsoil landunit,' write(iulog,*) 'which this routine cannot handle.' From cf94e258ff1321ae78a0331479beecc1aa14afd5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 12 Jun 2018 23:02:13 -0600 Subject: [PATCH 0180/1973] Include README file directly, rather than repeat it --- .../users_guide/overview/quickstart.rst | 80 +------------------ 1 file changed, 1 insertion(+), 79 deletions(-) diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst index f6784da2ef..93c9b5b7cd 100644 --- a/doc/source/users_guide/overview/quickstart.rst +++ b/doc/source/users_guide/overview/quickstart.rst @@ -32,83 +32,5 @@ The ChangeLog/ChangeSum talk about advances in different versions of CLM. The co Note other directories have README files that explain different components and tools used when running CLM and are useful in understanding how those parts of the model work and should be consulted when using tools in those directories. For more details on configuring and customizing a case with CLM see `Chapter 1 `_. The Quickstart.GUIDE (which can be found in ``models/lnd/clm/doc``) is repeated here. -:: - - Quick-Start to Using cpl7 Scripts for clm4_5 - - Assumptions: You want to use yellowstone with clm4_5 BGC - to do a clm simulation with data atmosphere and the - latest CRUNCEP atm forcing files and settings. You also want to cycle - the CRUNCEP atm data between 1901 to 1920 and you want to run at - 0.9x1.25 degree resolution. - - Process: - - # Create the case - - cd scripts - - ./create_newcase -case -mach yellowstone_intel -res f09_g16 -compset I1850CRUCLM45BGC - (./create_newcase -help -- to get help on the script) - - # Setup the case - - cd - ./xmlchange id1=val1,id2=val2 # to make changes to any settings in the env_*.xml files - ./cesm_setup - (./cesm_setup -help -- to get help on the script, this creates the ./.run \ - script) - - # Add any namelist changes to the user_nl_* files - - $EDITOR user_nl_* - - # Compile the code - - ./.build - - # Submit the run - - ./.submit - -Information on Compsets: - - "I" compsets are the ones with clm and datm7 without ice and ocean. They - specify either CLM4.0 physics or CLM4.5 physics. - Most of the "I" compsets for CLM4.0 use the CLM_QIAN data with solar following - the cosine of solar zenith angle, precipitation constant, and other - variables linear interpolated in time (and with appropriate time-stamps on - the date). Useful "I" compsets for CLM4.5 use the CRUNCEP data in place - of the CLM_QIAN data. - - To list all the compsets use: - ./create_newcase -list compsets - - Some of the CLM4.5 I compsets are: - - Alias Description - 1850CRUCLM45 CLM4.5 to simulate year=1850 with CLMN45SP (Satellite Phenology) - I1850CRUCLM45BGC CLM4.5 to simulate year=1850 with CLM45BGC biogeophysics model (BGC) - I20TRCRUCLM45BGC CLM4.5 with BGC on with transient PFT over 1850-2000 - - While some of the CLM4 I compsets are: - - Alias Description - ICN CLM4.0 to simulate year=2000 with Carbon-Nitrogen BGC model (CN) - I1850CN CLM4.0 to simulate year=1850 with Carbon-Nitrogen BGC model (CN) - I20TRCN CLM4.0 with CN on with transient PFT over 1850-2000 - IRCP26CN CLM4.0 with CN on with transient PFT over 1850-2100 for RCP=2.6 scenario - IRCP45CN CLM4.0 with CN on with transient PFT over 1850-2100 for RCP=4.5 scenario - IRCP60CN CLM4.0 with CN on with transient PFT over 1850-2100 for RCP=6.0 scenario - IRCP85CN CLM4.0 with CN on with transient PFT over 1850-2100 for RCP=8.5 scenario - -Automatically resubmitting jobs: - - After doing a short simulation that you believe is correct - - ./xmlchange CONTINUE_RUN=TRUE - - # Change RESUBMIT to number greater than 0, and CONTINUE_RUN to TRUE... - - ./.submit +.. include:: ../../clm5.0/doc/Quickstart.GUIDE From 94a19acc63557a8eb395e35372bc20cf5ba04697 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 14 Jun 2018 10:17:33 -0600 Subject: [PATCH 0181/1973] Add a top level README file. Setup version and release in configure files. Start using versiona and release. Rather than repeat README text files, actually include them from a clm5.0 checkout, so the updated version from the code can be used. --- doc/source/conf.py | 10 +- doc/source/tech_note/conf.py | 6 +- doc/source/users_guide/conf.py | 14 +- doc/source/users_guide/index.rst | 3 +- .../users_guide/overview/introduction.rst | 10 +- .../users_guide/overview/quickstart.rst | 1 + doc/source/users_guide/testing/index.rst | 3 +- .../building-the-clm-tools.rst | 54 +-- .../creating-surface-datasets.rst | 313 +----------------- .../users_guide/using-clm-tools/index.rst | 1 + 10 files changed, 35 insertions(+), 380 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 5c5b1d86ad..a573b2a1d0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -59,9 +59,9 @@ # built documents. # # The short X.Y version. -version = u'' +version = u'clm5.0' # The full version, including alpha/beta/rc tags. -release = u'' +release = u'release-clm5.0.01' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -73,7 +73,11 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] +exclude_patterns = [ + "clm5.0/manage_externals", + "**/README_EXTERNALS.rst", + "clm5.0/README.rst" +] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' diff --git a/doc/source/tech_note/conf.py b/doc/source/tech_note/conf.py index 5c5b1d86ad..a1827c71c5 100644 --- a/doc/source/tech_note/conf.py +++ b/doc/source/tech_note/conf.py @@ -73,7 +73,11 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] +exclude_patterns = [ + "manage_externals/*", + "README_EXTERNALS.rst", + "clm5.0//README.rs" +] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py index 5c5b1d86ad..c717685979 100644 --- a/doc/source/users_guide/conf.py +++ b/doc/source/users_guide/conf.py @@ -51,17 +51,17 @@ # General information about the project. project = u'clmdoc' -copyright = u'2017, Erik Kluzek, Bill Sacks, Ben Andre' -author = u'Erik Kluzek, Bill Sacks, Ben Andre' +copyright = u'2018, Erik Kluzek, Bill Sacks, Ben Andre, Alice Bertini' +author = u'Erik Kluzek, Bill Sacks, Ben Andre, Alice Bertini' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'' +version = u'clm5.0' # The full version, including alpha/beta/rc tags. -release = u'' +release = u'release-clm5.0.01' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -73,7 +73,11 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] +exclude_patterns = [ + "clm5.0/manage_externals", + "**/README_EXTERNALS.rst", + "clm5.0/README.rst" +] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst index bdb52253a1..f3160a30ed 100644 --- a/doc/source/users_guide/index.rst +++ b/doc/source/users_guide/index.rst @@ -6,7 +6,7 @@ .. _users-guide: ##################################### -CLM User's Guide +|version| User's Guide ##################################### .. toctree:: @@ -20,3 +20,4 @@ CLM User's Guide running-single-points/index.rst running-PTCLM/index.rst trouble-shooting/index.rst + testing/index.rst diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index d6c5781a17..80b2b1e0c3 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -1,6 +1,6 @@ .. _introduction: -**User's Guide to version 5.0 of the Community Land Model (CLM)** +**User's Guide to version +|version| of the Community Land Model (CLM)** **Authors: Benjamin Andre, Erik Kluzek, William Sacks** @@ -20,18 +20,18 @@ P. O. Box 3000, Boulder, Colorado 80307-300 Introduction ============== -The Community Land Model (CLM5.0 in CESM2.0) is the latest in a -series of global land models developed by t he CESM Land Model Working +The Community Land Model (+|release| in CESM2.0) is the latest in a +series of global land models developed by the CESM Land Model Working Group (LMWG) and maintained at the National Center for Atmospheric Research (NCAR). This guide is intended to instruct both the novice and experienced user on running CLM. This guide pertains to the latest -version CLM5.0 in CESM2.0 available for download from the public +version +|version| in CESM2.0 available for download from the public release subversion repository as a part of CESM1.2.0. Documentation may be different if you are using an older version, you should either use the documentation for that release version, update to the latest version, or use the documentation inside your own source tree. There is information in the ChangeLog file and in the `What is new with -CLM5.0 in CESM2.0 since previous public releases? `_ ++|version| in CESM2.0 since previous public releases? `_ regarding the changes from previous versions of CESM. .. note:: This release of CLM5.0 in CESM1.2.0 includes BOTH CLM4.0 diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst index 93c9b5b7cd..edcd0bc2fe 100644 --- a/doc/source/users_guide/overview/quickstart.rst +++ b/doc/source/users_guide/overview/quickstart.rst @@ -34,3 +34,4 @@ Note other directories have README files that explain different components and t The Quickstart.GUIDE (which can be found in ``models/lnd/clm/doc``) is repeated here. .. include:: ../../clm5.0/doc/Quickstart.GUIDE + :literal: diff --git a/doc/source/users_guide/testing/index.rst b/doc/source/users_guide/testing/index.rst index 18c418fca4..09575a1442 100644 --- a/doc/source/users_guide/testing/index.rst +++ b/doc/source/users_guide/testing/index.rst @@ -3,7 +3,7 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -.. _testing: +.. _testing_section: ##################################### Testing @@ -11,7 +11,6 @@ Testing .. toctree:: :maxdepth: 2 - :numbered: testing.rst diff --git a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst index c2633e6522..ec626641e5 100644 --- a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst @@ -107,56 +107,6 @@ More details on each environment variable. .. note:: There are several files that are copies of the original files from either models``/lnd/clm/src/util_share``, ``models/csm_share/shr``, or copies from other tool directories. By having copies the tools can all be made stand-alone, but any changes to the originals will have to be put into the tool directories as well. The *README.filecopies* (which can be found in ``models/lnd/clm/tools``) is repeated here. -:: - - models/lnd/clm/tools/README.filecopies Jun/04/2013 - - There are several files that are copies of the original files from - either models/lnd/clm/src/main, models/csm_share/shr, - models/csm_share/unit_testers, or copies from other tool - directories. By having copies the tools can all be made stand-alone, - but any changes to the originals will have to be put into the tool - directories as well. - - I. Files that are IDENTICAL: - - 1. csm_share files copied that should be identical to models/csm_share/shr: - - shr_const_mod.F90 - shr_log_mod.F90 - shr_timer_mod.F90 - - 2. csm_share files copied that should be identical to models/csm_share/unit_testers: - - test_mod.F90 - - 3. clm/src files copied that should be identical to models/lnd/clm/src/util_share: - - nanMod.F90 - - II. Files with differences - - 1. csm_share files copied with differences: - - shr_kind_mod.F90 --- SHR_KIND_CXX is new - shr_sys_mod.F90 ---- Remove mpi abort and reference to shr_mpi_mod.F90. - shr_infnan_mod.F90 - Earlier version - shr_string_mod.F90 - Earlier version - shr_file_mod.F90 --- mkprocdata_map version is stripped down - clm_varctl.F90 ----- Earlier version - - 2. clm/src files with differences: - - fileutils.F90 --- Remove use of masterproc and spmdMod and endrun in abortutils. - - 4. Files in mkmapgrids - - domainMod.F90 ---- Highly customized based off an earlier version of clm code. - Remove use of abortutils, spmdMod. clm version uses latlon - this version uses domain in names. Distributed memory - parallelism is removed. - - 5. Files in mksurfdata_map - - mkvarpar.F90 --- clm4_0 and clm4_5 versions are different and different from main clm versions. +.. include:: ../../clm5.0/tools/README.filecopies + :literal: diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index e42a46f81f..d1ab21e2b7 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -61,316 +61,7 @@ Creating a Complete Set of Files for Input to CLM The last optional thing to do is to enter the new datasets into the build-namelist XML database. See Chapter 3 for more information on doing this. This is optional because the user may enter these files into their namelists manually. The advantage of entering them into the database is so that they automatically come up when you create new cases. The ``models/lnd/clm/tools/README`` goes through the complete process for creating input files needed to run CLM. We repeat that file here: -:: - models/lnd/clm/tools/README Jun/04/2013 - - CLM tools for analysis of CLM history files -- or for creation or - modification of CLM input files. - - I. General directory structure: - - clm4_0 - mksurfdata_map --- Create surface datasets. - interpinic ------- Interpolate initial datasets to a different resolution. - (has optimized and OMP options) - clm4_5 - mksurfdata_map --- Create surface datasets. - interpinic ------- Interpolate initial datasets to a different resolution. - (has optimized and OMP options) - - shared - mkmapgrids ------- Create SCRIP grid files needed by mkmapdata - [input is CLM grid files] - (deprecated) - mkmapdata -------- Create SCRIP mapping data from SCRIP grid files (uses ESMF) - gen_domain ------- Create data model domain datasets from SCRIP mapping datasets. - (also in the top level mapping directory [../../../../tools/mapping]) - mkprocdata_map --- Convert output unstructured grids into a 2D format that - can be plotted easily - ncl_scripts ------ NCL post or pre processing scripts. - - - Note that there are different versions of mksurfdata_map and interpinic for - CLM4.0 vs. CLM4.5. Other tools are shared between the two model - versions. - - However, note that mkmapdata makes mapping files for CLM4.5 by default; to - make mapping files for CLM4.0, run the tool with the option: - -p clm4_0 - - II. Notes on building/running for each of the above tools: - - Each tool that has FORTRAN source code has the following files: - - README -------------- Specific help for using the specific tool and help on specific - files in that directory. - src/Filepath -------- List of directories needed to build the tool - (some files in ../src directories are required). - src/Makefile -------- Customization of the make for the particular tool in question - src/Makefile.common - General GNU Makefile for creating FORTRAN tools - (these are identical between tools). - src/Srcfiles -------- List of source files that are needed. - src/Mkdepends ------- Dependency generator program - - mkmapdata and ncl_scripts only contain scripts so don't have the above build files. - - Most tools have copies of files from other directories -- see the README.filecopies - file for more information on this. - - Tools may also have files with the directory name followed by: namelist, or runoptions. - - .namelist ------ Namelist to create a global file. - .runoptions ---- Command line options to use the given tool. - - These files are also used by the test scripts to test the tools (see the - README.testing) file. - - NOTE: Be sure to change the path of the datasets references by these namelists to - point to where you have exported your CESM inputdata datasets. - - To build: - - cd - setenv INC_NETCDF - setenv LIB_NETCDF - gmake - - The process will create a file called "Depends" which has the dependencies - for the build of each file on other files. - - By default some codes may be compiled non-optimized - so that you can use the debugger, and with bounds-checking, and float trapping on. - To speed up do the following... - - gmake OPT=TRUE (by default already on for interpinic and mksurfdata_map) - - Also some of the tools allow for OpenMP shared memory parallelism - (such as interpinic) with - - gmake SMP=TRUE - - To run a program with a namelist: - - ./program < namelist - - To get help on running a program with command line options (e.g., interpinic): - - ./program - - To run a program built with SMP=TRUE: - - setenv OMP_NUM_THREADS= - - run normally as above - - III. Process sequence to create input datasets needed to run CLM - - NOTE: The following assumes you want to create files for CLM4.5. If you want to - use CLM4.0, you will need to do the following: - - In the following commands, change references to the clm4_5 directory to clm4_0 - - Add the option '-p clm4_0' to the mkmapdata.sh command. - - 1.) Create SCRIP grid files (if needed) - - a.) For standard resolutions these files will already be created. (done) - - b.) To create regular lat-lon regional/single-point grids run mknoocnmap.pl - - This will create both SCRIP grid files and a mapping file that will - be valid if the region includes NO ocean whatsoever (so you can skip step 2). - You can also use this script to create SCRIP grid files for a region - (or even a global grid) that DOES include ocean if you use step 2 to - create mapping files for it (simply discard the non-ocean map created by - this script). - - Example, for single-point over Boulder Colorado. - - cd shared/mkmapdata - ./mknoocnmap.pl -p 40,255 -n 1x1_boulderCO - - c.) General case - - You'll need to convert or create SCRIP grid files on your own (using scripts - or other tools) for the general case where you have an unstructured grid, or - a grid that is not regular in latitude and longitude. - - example format - ================== - netcdf fv1.9x2.5_090205 { - dimensions: - grid_size = 13824 ; - grid_corners = 4 ; - grid_rank = 2 ; - variables: - double grid_center_lat(grid_size) ; - grid_center_lat:units = "degrees" ; - double grid_center_lon(grid_size) ; - grid_center_lon:units = "degrees" ; - double grid_corner_lat(grid_size, grid_corners) ; - grid_corner_lat:units = "degrees" ; - double grid_corner_lon(grid_size, grid_corners) ; - grid_corner_lon:units = "degrees" ; - int grid_dims(grid_rank) ; - int grid_imask(grid_size) ; - grid_imask:units = "unitless" ; - - 2.) Create ocean to atmosphere mapping file (if needed) - - a.) Standard resolutions (done) - - If this is a standard resolution with a standard ocean resolution -- this - step is already done, the files already exist. - - b.) Region without Ocean (done in step 1.b) - - IF YOU RAN mknoocnmap.pl FOR A REGION WITHOUT OCEAN THIS STEP IS ALREADY DONE. - - c.) New atmosphere or ocean resolution - - If the region DOES include ocean, use gen_domain to create a - mapping file for it. - - Example: - - cd ../../../../tools/mapping/gen_domain_files/src - ./gen_domain -m $MAPFILE -o $OCNGRIDNAME -l $ATMGRIDNAME - - - 3.) Add SCRIP grid file(s) created in (1) into XML database in CLM (optional) - - See the "Adding New Resolutions or New Files to the build-namelist Database" - Chapter in the CLM User's Guide - - http://www.cesm.ucar.edu/models/cesm1.0/clm/models/lnd/clm/doc/UsersGuide/book1.html - - If you don't do this step, you'll need to specify the file to mkmapdata - in step (3) using the "-f" option. - - 4.) Create mapping files for use by mksurfdata_map with mkmapdata - (See mkmapdata/README for more help on doing this) - - - this step uses the results of (1) that were entered into the XML database - by step (3). If you don't enter datasets in, you need to specify the - SCRIP grid file using the "-f" option to mkmapdata.sh. - - - note that mkmapdata generates maps for CLM4.5 by default; to generate - mapping files for CLM4.0, add the option '-p clm4_0' - - Example: to generate all necessary mapping files for the ne30np4 grid - - cd shared/mkmapdata - ./mkmapdata.sh -r ne30np4 - - 5.) Add mapping file(s) created in step (4) into XML database in CLM (optional) - - See notes on doing this in step (3) above. - Edit ../bld/namelist_files/namelist_defaults_clm.xml to incorporate new - mapping files. - - If you don't do this step, you'll need to specify the grid resolution name - and file creation dates to mksurfdata_map in step (5) below. - - 6.) Convert map of ocean to atm for use by DATM and CLM with gen_domain - (See tools/mapping/README for more help on doing this) - - - gen_domain uses the map from step (2) (or previously created CESM maps) - - Example: - - cd ../../../../tools/mapping/gen_domain_files/src - gmake - cd .. - setenv CDATE 090206 - setenv OCNGRIDNAME gx1v6 - setenv ATMGRIDNAME fv1.9x2.5 - setenv MAPFILE $CSMDATA/cpl/cpl6/map_${OCNGRIDNAME}_to_${ATMGRIDNAME}_aave_da_${CDATE}.nc - ./gen_domain -m $MAPFILE -o $OCNGRIDNAME -l $ATMGRIDNAME - - Normally for I compsets running CLM only you will discard the ocean domain - file, and only use the atmosphere domain file for datm and as the fatmlndfrc - file for CLM. Output domain files will be named according to the input OCN/LND - gridnames. - - 7.) Create surface datasets with mksurfdata_map - (See mksurfdata_map/README for more help on doing this) - - - Run clm4_5/mksurfdata_map/mksurfdata.pl - - This step uses the results of step (4) entered into the XML database - in step (5). - - If datasets were NOT entered into the XML database, set the resolution - to "usrspec" and use the "-usr_gname", and "-usr_gdate" options. - - Example: for 0.9x1.25 resolution - - cd clm4_5/mksurfdata_map/src - gmake - cd .. - ./mksurfdata.pl -r 0.9x1.25 - - NOTE that surface dataset will be used by default for fatmgrid - and it will - contain the lat,lon,edges and area values for the atm grid - ASSUMING that - the atm and land grid are the same - - 8.) Interpolate initial conditions using interpinic (optional) - (See interpinic/README for more help on doing this) - IMPORTANT NOTE on interpinic!!!:: BE SURE TO USE NetCDF4.3 WHEN BUILDING! - If your template file was written using pnetcdf -- interpinic will corrupt - the resulting file and make it unusable! - - 9.) Add new files to XML data or using user_nl_clm (optional) - - See notes on doing this in step (3) above. - - IV. Example of creating single-point datasets without entering into XML database. - - Here we apply the process described in III. for a single-point dataset - where we don't enter the datasets into the XML database (thus skipping - steps 3, 5 and 9), but use the needed command line options to specify where the - files are. This also skips step (2) since step 1 creates the needed mapping file. - We also skip step (8) and do NOT create a finidat file. - - 0.) Set name of grid to use and the creation date to be used later... - setenv GRIDNAME 1x1_boulderCO - setenv CDATE `date +%y%m%d` - 1.) SCRIP grid and atm to ocn mapping file - cd shared/mkmapdata - ./mknoocnmap.pl -p 40,255 -n $GRIDNAME - # Set pointer to MAPFILE that will be used in step (6) - setenv MAPFILE `pwd`/map_${GRIDNAME}_noocean_to_${GRIDNAME}_nomask_aave_da_${CDATE}.nc - cd ../.. - 2.) skip - 3.) skip - 4.) Mapping files needed for mksurfdata_map - cd shared/mkmapdata - setenv GRIDFILE ../mkmapgrids/SCRIPgrid_${GRIDNAME}_nomask_${CDATE}.nc - ./mkmapdata.sh -r $GRIDNAME -f $GRIDFILE -t regional - cd .. - 5.) skip - 6.) Generate domain file for datm and CLM - cd ../../../../tools/mapping/gen_domain_files/src - gmake - cd .. - setenv OCNDOM domain.ocn_noocean.nc - setenv ATMDOM domain.lnd.{$GRIDNAME}_noocean.nc - ./gen_domain -m $MAPFILE -o $OCNDOM -l $ATMDOM - cd ../../../../lnd/clm/tools - 7.) Create surface dataset for CLM - cd clm4_5/mksurfdata_map/src - gmake - cd .. - ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE - 8.) skip - 9.) skip - - V. Notes on which input datasets are needed for CLM - - global or regional/single-point grids - - need fsurdata and fatmlndfrc - - fsurdata ---- from mksurfdata_map in step (III.7) - fatmlndfrc -- use the domain.lnd file from gen_domain in step (III.6) - (NOTE: THIS FILE IS POINTED TO USING ATM_DOMAIN_PATH/ATM_DOMAIN_FILE/LND_DOMAIN_PATH/ \ - LND_DOMAIN_FILE - env_run.xml variables -- do NOT simply add this to your user_nl_clm as it will fail) +.. include:: ../../clm5.0/tools/README + :literal: diff --git a/doc/source/users_guide/using-clm-tools/index.rst b/doc/source/users_guide/using-clm-tools/index.rst index 583122cdcd..030cda7495 100644 --- a/doc/source/users_guide/using-clm-tools/index.rst +++ b/doc/source/users_guide/using-clm-tools/index.rst @@ -18,4 +18,5 @@ Using CLM tools creating-surface-datasets.rst datasts-for-observational-sites.rst creating-domain-files.rst + observational-sites-datasets.rst cprnc.rst From 173d208bc79f5962bee2a39011540037c20d22c1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 14 Jun 2018 13:00:26 -0600 Subject: [PATCH 0182/1973] Change some of the hardcoded versions into using the variable --- doc/source/users_guide/conf.py | 2 ++ doc/source/users_guide/overview/getting-help.rst | 6 +++--- doc/source/users_guide/overview/introduction.rst | 11 ++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py index c717685979..0294e7cef8 100644 --- a/doc/source/users_guide/conf.py +++ b/doc/source/users_guide/conf.py @@ -63,6 +63,8 @@ # The full version, including alpha/beta/rc tags. release = u'release-clm5.0.01' +cesmrelease = u'release-cesm2.0.00' + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst index 8d45c71bcb..5f9c63ab26 100644 --- a/doc/source/users_guide/overview/getting-help.rst +++ b/doc/source/users_guide/overview/getting-help.rst @@ -8,10 +8,10 @@ In addition to this users-guide there are several other resources that are avail --------------------------- The CESM User's-Guide --------------------------- ++|release| ++|release| in +|cesmrelease| is always run from within the standard +|cesmrelease| build and run scripts. Therefore, the user of CLM4.5 should familiarize themselves with the +|cesmrelease| scripts and understand how to work with them. User's-Guide documentation on the +|cesmrelease| scripts are available from the following web-page. The purpose of this +|version| in +|cesmrelease| User's Guide is to give the +|version| user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the +|cesmrelease| Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. -CLM5.0 in CESM2.0 is always run from within the standard CESM2.0 build and run scripts. Therefore, the user of CLM4.5 should familiarize themselves with the CESM1.2.0 scripts and understand how to work with them. User's-Guide documentation on the CESM1.2.0 scripts are available from the following web-page. The purpose of this CLM4.5 in CESM1.2.0 User's Guide is to give the CLM4.5 user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the CESM1.2.0 Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. - -`cesmrel; Scripts User's-Guide (http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/book1.html) `_ +`+|cesmrelease| Quickstart Guide `_ ----------------------- The CESM Bulletin Board diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index 80b2b1e0c3..02e6237e2b 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -20,18 +20,18 @@ P. O. Box 3000, Boulder, Colorado 80307-300 Introduction ============== -The Community Land Model (+|release| in CESM2.0) is the latest in a +The Community Land Model (+|release| in +|cesmrelease|) is the latest in a series of global land models developed by the CESM Land Model Working Group (LMWG) and maintained at the National Center for Atmospheric Research (NCAR). This guide is intended to instruct both the novice and experienced user on running CLM. This guide pertains to the latest -version +|version| in CESM2.0 available for download from the public +version +|version| in +|cesmrelease| available for download from the public release subversion repository as a part of CESM1.2.0. Documentation may be different if you are using an older version, you should either use the documentation for that release version, update to the latest version, or use the documentation inside your own source tree. There is information in the ChangeLog file and in the `What is new with -+|version| in CESM2.0 since previous public releases? `_ ++|version| in +|cesmrelease| since previous public releases? `_ regarding the changes from previous versions of CESM. .. note:: This release of CLM5.0 in CESM1.2.0 includes BOTH CLM4.0 @@ -79,12 +79,13 @@ and then finally do it by hand. If you are using non supported machines you may also want to use the test scripts to make sure your machine is working correctly. -.. _what-is-new-with-clm4.5: +.. _what-is-new-with-+|version|: ========================= - What is New with CLM4.5 + What is New with +|version| ========================= +`What's new with +|version| science `_ The CESM1.2.0 `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. More details are given in the `CLM ChangeLog file `_. From bc6fa69978dcbdfa173ee8a1469c2d4359080f41 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 14 Jun 2018 14:26:05 -0600 Subject: [PATCH 0183/1973] Run the sed script to make a bunch of global changes --- ...w-Files-to-the-build-namelist-Database.rst | 4 +- .../CLM-3.1-Managing-Your-Own-Data-files.rst | 4 +- .../CLM-3.2-Adding-Resolution-Names.rst | 4 +- ...3-Adding-or-Changing-Default-Filenames.rst | 8 +- .../users_guide/overview/getting-help.rst | 40 ++++----- .../users_guide/overview/introduction.rst | 84 +++++++++---------- .../users_guide/overview/quickstart.rst | 18 ++-- .../overview/scientific_validation.rst | 18 ++-- .../running-PTCLM/adding-ptclm-site-data.rst | 2 +- .../running-PTCLM/introduction-to-ptclm.rst | 10 +-- .../running-PTCLM/ptclm-examples.rst | 6 +- .../users_guide/running-PTCLM/using-ptclm.rst | 10 +-- .../running-pts_mode-configurations.rst | 6 +- .../running-single-point-configurations.rst | 18 ++-- ...CLM4.5-biogeochemistry-(CLMBGC-spinup).rst | 18 ++-- ...tmospheric-forcing-to-spinup-the-model.rst | 10 +-- ...tmospheric-forcing-to-spinup-the-model.rst | 12 +-- ...transient-historical-CO2-concentration.rst | 12 +-- .../running-special-cases/index.rst | 2 +- .../running-the-prognostic-crop-model.rst | 4 +- .../running-with-irrigation.rst | 6 +- doc/source/users_guide/runsed.csh | 6 ++ doc/source/users_guide/sedscript.txt | 17 ++++ .../choosing-a-compset.rst | 18 ++-- .../customizing-the-clm-configuration.rst | 48 +++++------ .../customizing-the-clm-namelist.rst | 10 +-- doc/source/users_guide/testing/testing.rst | 20 ++--- .../trouble-shooting/trouble-shooting.rst | 16 ++-- .../building-the-clm-tools.rst | 4 +- .../users_guide/using-clm-tools/cprnc.rst | 2 +- ...g-input-for-surface-dataset-generation.rst | 16 ++-- .../creating-surface-datasets.rst | 14 ++-- .../what-are-the-clm-tools.rst | 26 +++--- 33 files changed, 258 insertions(+), 235 deletions(-) create mode 100755 doc/source/users_guide/runsed.csh create mode 100644 doc/source/users_guide/sedscript.txt diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst index de13570b3d..8854d9e4d9 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst @@ -14,11 +14,11 @@ If you have a LOT of files to keep track of it also might be easier than keeping If you just have a few quick experiments to try, for a short time period you might be best off using the other methods mentioned above. There are two parts to adding files to the build-namelist database. -The first part is adding new resolution names which is done in the ``models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml`` file (and in the ``models/lnd/clm/bld/config_files/config_definition.xml`` file when adding supported single-point datasets). +The first part is adding new resolution names which is done in the ``$CTSMROOT/bld/namelist_files/namelist_definition_+|version|.xml`` file (and in the ``$CTSMROOT/bld/config_files/config_definition.xml`` file when adding supported single-point datasets). You can then use the new resolution by using ``CLM_USRDAT_NAME``. If you also want to be able to give the resolution into **create_newcase** -- you'll need to add the grid to the ``scripts/ccsm_utils/Case.template/config_grid.xml`` file. -The second part is actually adding the new filenames which is done in the ``models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml`` file (``models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml`` file for CLM tools). +The second part is actually adding the new filenames which is done in the ``$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|.xml`` file (``$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|_tools.xml`` file for CLM tools). If you aren't adding any new resolutions, and you are just changing the files for existing resolutions, you don't need to edit the namelist_definition file. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst index a8ebc81ac8..558c877157 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst @@ -4,7 +4,7 @@ Managing Your Data Own Files ============================== -If you are running on a supported machine (such as yellowstone or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `CESM1.2.0 Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. +If you are running on a supported machine (such as cheyenne or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `+|cesmrelease| Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. Using **link_dirtree** is quite simple, you give the directory where data exists and then the directory that you want to create where datasets will point to the original source files. In the example below we use "$HOME/inputdata", but MYCSMDATA could be any directory you have access to where you want to put your data. @@ -39,7 +39,7 @@ You can also use **find** to list files that have a particular pattern in the na -If you are running on a supported machine (such as yellowstone or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `CESM1.2.0 Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. +If you are running on a supported machine (such as cheyenne or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `+|cesmrelease| Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. Using **link_dirtree** is quite simple, you give the directory where data exists and then the directory that you want to create where datasets will point to the original source files. In the example below we use "$HOME/inputdata", but MYCSMDATA could be any directory you have access to where you want to put your data. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst index 6d44f73b5b..e7896e1206 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst @@ -5,7 +5,7 @@ ========================= If you are adding files for new resolutions which aren't covered in the namelist_definition file -- you'll need to add them in. -The list of valid resolutions is in the id="res" entry in the ``models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml`` file. +The list of valid resolutions is in the id="res" entry in the ``$CTSMROOT/bld/namelist_files/namelist_definition_+|version|.xml`` file. You need to choose a name for your new resolution and simply add it to the comma delimited list of valid_values for the id="res" entry. The convention for global Gaussian grids is number_of_latitudes x number_of_longitudes. The convention for global finite volume grids is latitude_grid_size x longitude_grid_size where latitude and longitude is measured in degrees. @@ -29,7 +29,7 @@ The only hard requirement is that names be unique for different grid files. Here As you can see you just add your new resolution names to the end of the valid_values list. -When using PTCLM and adding supported single-point resolutions, you'll also want to add these resolutions to the ``models/lnd/clm/bld/config_files/config_definition.xml`` under the ``sitespf_pt`` name. +When using PTCLM and adding supported single-point resolutions, you'll also want to add these resolutions to the ``$CTSMROOT/bld/config_files/config_definition.xml`` under the ``sitespf_pt`` name. The entry in that file looks like: :: diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst index c539d0fd8c..6393a74ce3 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst @@ -4,7 +4,7 @@ Changing Default Filenames ============================ -To add or change the default filenames you edit the ``models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml`` and either change an existing filename or add a new one. +To add or change the default filenames you edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|.xml`` and either change an existing filename or add a new one. Most entries in the default namelist files, include different attributes that describe the different properties that describe the differences in the datasets. Attributes include the: resolution, year to simulation, range of years to simulate for transient datafiles, the land-mask, the representative concentration pathway (rcp) for future scenarios, and the type of biogeochemistry (bgc) model used. For example the fatmgrid for the 1.9x2.5 resolution is as follows: @@ -18,8 +18,8 @@ lnd/clm2/surfdata_map/surfdata_0.9x1.25_simyr1850_c130415.nc Other ``fsurdat`` files are distinguished from this one by their resolution (hgrid), simulation year (sim_year) and prognostic crop (crop) attributes. -To add or change the default filenames for CLM tools edit the ``models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml`` and either change an existing filename or add a new one. -Editing this file is similar to the ``namelist_defaults_clm4_5.xml`` talked about above. +To add or change the default filenames for CLM tools edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|_tools.xml`` and either change an existing filename or add a new one. +Editing this file is similar to the ``namelist_defaults_+|version|.xml`` talked about above. ---------------------------- @@ -27,7 +27,7 @@ What are the required files? ---------------------------- Different types of simulations and different types of configurations for CLM require different lists of files. -The CLM4.5-BGC or Carbon Nitrogen (cn) Biogeochemistry model for example requires ``stream_fldfilename_ndep`` files, which are NOT required by CLMSP. +The +|version|-BGC or Carbon Nitrogen (cn) Biogeochemistry model for example requires ``stream_fldfilename_ndep`` files, which are NOT required by CLMSP. Transient simulations also require transient datasets, and the names of these datasets are sometimes different from the static versions (sometimes both are required as in the dynamic PFT cases). diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst index 5f9c63ab26..42df1b989a 100644 --- a/doc/source/users_guide/overview/getting-help.rst +++ b/doc/source/users_guide/overview/getting-help.rst @@ -3,13 +3,13 @@ ============== Getting Help ============== -In addition to this users-guide there are several other resources that are available to help you use CLM5.0. The first one is the CESM1.2.0 User's-Guide, which documents the entire process of creating cases with CESM1.2.0. The next is the CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in CESM1.2.0. +In addition to this users-guide there are several other resources that are available to help you use +|version|. The first one is the +|cesmrelease| User's-Guide, which documents the entire process of creating cases with +|cesmrelease|. The next is the CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in +|cesmrelease|. --------------------------- The CESM User's-Guide --------------------------- +|release| -+|release| in +|cesmrelease| is always run from within the standard +|cesmrelease| build and run scripts. Therefore, the user of CLM4.5 should familiarize themselves with the +|cesmrelease| scripts and understand how to work with them. User's-Guide documentation on the +|cesmrelease| scripts are available from the following web-page. The purpose of this +|version| in +|cesmrelease| User's Guide is to give the +|version| user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the +|cesmrelease| Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. ++|release| in +|cesmrelease| is always run from within the standard +|cesmrelease| build and run scripts. Therefore, the user of +|version| should familiarize themselves with the +|cesmrelease| scripts and understand how to work with them. User's-Guide documentation on the +|cesmrelease| scripts are available from the following web-page. The purpose of this +|version| in +|cesmrelease| User's Guide is to give the +|version| user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the +|cesmrelease| Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. `+|cesmrelease| Quickstart Guide `_ @@ -25,28 +25,28 @@ There is a rich and diverse set of people that use the CESM, and often it is use The CLM web pages ----------------- -The main CLM web page contains information on the CLM, it's history, developers, as well as downloads for previous model versions. There are also documentation text files in the models/lnd/clm/doc directory that give some quick information on using CLM. +The main CLM web page contains information on the CLM, it's history, developers, as well as downloads for previous model versions. There are also documentation text files in the $CTSMROOT/doc directory that give some quick information on using CLM. `CLM web page `_ `CLM Documentation Text Files `_ Also note that several of the XML database files can be viewed in a web browser to get a nice table of namelist options, namelist defaults, or compsets. Simply view them as a local file and bring up one of the following files: -- `models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml `_ -- definition of CLM4.0 namelist items. -- `models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml `_ -- definition of CLM4.0 namelist items. -- `models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml `_ -- default values for CLM4.0 namelist items. -- `models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml `_ -- default values for CLM4.5 namelist items. +- `$CTSMROOT/bld/namelist_files/namelist_definition_clm4_0.xml `_ -- definition of CLM4.0 namelist items. +- `$CTSMROOT/bld/namelist_files/namelist_definition_+|version|.xml `_ -- definition of CLM4.0 namelist items. +- `$CTSMROOT/bld/namelist_files/namelist_defaults_clm4_0.xml `_ -- default values for CLM4.0 namelist items. +- `$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|.xml `_ -- default values for +|version| namelist items. - `scripts/ccsm_utils/Case.template/config_definition.xml `_ -- definition of all env_*.xml items. - `scripts/ccsm_utils/Case.template/config_compsets.xml `_ -- definition of all the compsets. -- `models/lnd/clm/bld/namelist_files/history_fields_clm4_0.xml `_ -- definition of CLM4.0 history fields. -- `models/lnd/clm/bld/namelist_files/history_fields_clm4_5.xml `_ -- definition of CLM4.5 history fields. +- `$CTSMROOT/bld/namelist_files/history_fields_clm4_0.xml `_ -- definition of CLM4.0 history fields. +- `$CTSMROOT/bld/namelist_files/history_fields_+|version|.xml `_ -- definition of +|version| history fields. ------------------------ -Reporting bugs in CLM4.5 +Reporting bugs in +|version| ------------------------ -If you have any problems, additional questions, bug reports, or any other feedback, please send an email to <`cesmhelp@cgd.ucar.edu `_>. If you find bad, wrong, or misleading information in this users guide send an email to <`erik@ucar.edu `_>. The current list of known issues for CLM4.5 in CESM1.2.0 is in the models/lnd/clm/doc/KnownBugs file, and the list of issues for CESM1.2.0 is at... -`http://www.cesm.ucar.edu/models/cesm1.2//tags/cesm1_2_0/#PROBLEMS `_. +If you have any problems, additional questions, bug reports, or any other feedback, please send an email to <`cesmhelp@cgd.ucar.edu `_>. If you find bad, wrong, or misleading information in this users guide send an email to <`erik@ucar.edu `_>. The current list of known issues for +|version| in +|cesmrelease| is in the $CTSMROOT/doc/KnownBugs file, and the list of issues for +|cesmrelease| is at... +`http://www.cesm.ucar.edu/models/cesm1.2//tags/+|cesmrelease|/#PROBLEMS `_. --------------------------------------- Some Acronym's and Terms We'll be Using @@ -62,22 +62,22 @@ CLM Community Land Model (CLM). The prognostically active land model component of CESM. CLMBGC - Community Land Model (CLM4.5) with BGC Biogeochemistry. Uses CN Biogeochemistry with vertically resolved soil Carbon, CENTURY model like pools, and Nitrification/De-Nitrification. The CLM_CONFIG_OPTS option for this is + Community Land Model (+|version|) with BGC Biogeochemistry. Uses CN Biogeochemistry with vertically resolved soil Carbon, CENTURY model like pools, and Nitrification/De-Nitrification. The CLM_CONFIG_OPTS option for this is - ``./xmlchange CLM_CONFIG_OPTS="phys clm4_5 -bgc cn -vsoilc_centbgc on -clm4me on"`` + ``./xmlchange CLM_CONFIG_OPTS="phys +|version| -bgc cn -vsoilc_centbgc on -clm4me on"`` CLMCN - Community Land Model (CLM) with Carbon Nitrogen (CN) Biogeochemistry (either CLM4.0 or CLM4.5) The CLM_CONFIG_OPTS option for this is + Community Land Model (CLM) with Carbon Nitrogen (CN) Biogeochemistry (either CLM4.0 or +|version|) The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-bgc cn" -append`` CLMSP - Community Land Model (CLM) with Satellite Phenology (SP) (either CLM4.0 or CLM4.5) The CLM_CONFIG_OPTS option for this is + Community Land Model (CLM) with Satellite Phenology (SP) (either CLM4.0 or +|version|) The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-bgc none" -append`` CLMU - Community Land Model (CLM) Urban Model (either CLM4.0 or CLM4.5). The urban model component of CLM is ALWAYS active (unless you create special surface datasets that have zero urban percent, or for regional/single-point simulations for a non-urban area). + Community Land Model (CLM) Urban Model (either CLM4.0 or +|version|). The urban model component of CLM is ALWAYS active (unless you create special surface datasets that have zero urban percent, or for regional/single-point simulations for a non-urban area). CRUNCEP The Climate Research Unit (CRU) analysis of the NCEP atmosphere reanalysis atmosphere forcing data. This can be used to drive CLM with atmosphere forcing from 1901 to 2010. We also DO expect to be able to update this dataset beyond 2010 as newer data becomes available. @@ -86,7 +86,7 @@ DATM Data Atmosphere Model (DATM) the prescribed data atmosphere component for CESM. Forcing data that we provide are either the Qian or CRUNCEP forcing datasets (see below). DV - Dynamic global vegetation, where fractional PFT (see PFT below) changes in time prognostically. Can NOT be used with prescribed transient PFT (requires either CLM4.5-BGC or CLMCN for either CLM4.0 or CLM4.5). The CLM_CONFIG_OPTS option for this is + Dynamic global vegetation, where fractional PFT (see PFT below) changes in time prognostically. Can NOT be used with prescribed transient PFT (requires either +|version|-BGC or CLMCN for either CLM4.0 or +|version|). The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-bgc cndv" -append`` @@ -103,7 +103,7 @@ PFT Plant Function Type (PFT). A type of vegetation that CLM parameterizes. PTCLM - PoinT CLM (PTCLM) a python script that operates on top of CLM for CLM4.5 to run single point simulations for CLM. + PoinT CLM (PTCLM) a python script that operates on top of CLM for +|version| to run single point simulations for CLM. Qian The Qian et. al. analysis of the NCEP forcing data. This can be used to drive CLM with atmosphere forcing from 1948 to 2004. We do NOT expect to be able to update this dataset beyond 2004. @@ -112,6 +112,6 @@ SCRIP Spherical Coordinate Remapping and Interpolation Package (SCRIP). We use it's file format for specifying both grid coordinates as well as mapping between different grids. VIC - Variable Infiltration Capacity (VIC) model for hydrology. This is an option to CLM4.5 in place of the standard CLM4.5 hydrology. The CLM_CONFIG_OPTS option for this is + Variable Infiltration Capacity (VIC) model for hydrology. This is an option to +|version| in place of the standard +|version| hydrology. The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-vichydro on" -append`` diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index 02e6237e2b..b65e622b45 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -26,7 +26,7 @@ Group (LMWG) and maintained at the National Center for Atmospheric Research (NCAR). This guide is intended to instruct both the novice and experienced user on running CLM. This guide pertains to the latest version +|version| in +|cesmrelease| available for download from the public -release subversion repository as a part of CESM1.2.0. Documentation +release subversion repository as a part of +|cesmrelease|. Documentation may be different if you are using an older version, you should either use the documentation for that release version, update to the latest version, or use the documentation inside your own source tree. There @@ -34,19 +34,19 @@ is information in the ChangeLog file and in the `What is new with +|version| in +|cesmrelease| since previous public releases? `_ regarding the changes from previous versions of CESM. -.. note:: This release of CLM5.0 in CESM1.2.0 includes BOTH CLM4.0 - physics used in previous releases as well as the updated CLM4.5 +.. note:: This release of +|version| in +|cesmrelease| includes BOTH CLM4.0 + physics used in previous releases as well as the updated +|version| physics. Both CLM as well as CLM support tools allow you to trigger between the two physics modes. Most often when we refer to CLM4.0 we - are referring to the CLM4.0 physics in CLM4.5 in CESM1.2.0 rather + are referring to the CLM4.0 physics in +|version| in +|cesmrelease| rather than to a specific version of CLM4.0 (where we would give the exact - version). Likewise, when referring to CLM4.5 we are referring to the - CLM4.5 physics in CLM4.5 in CESM1.2.0. + version). Likewise, when referring to +|version| we are referring to the + +|version| physics in +|version| in +|cesmrelease|. The novice user should read `Chapter 1 `_ in detail before beginning work, while the expert user should read `What is new with -CLM4.5 in CESM1.2.0 since previous public releases? `_ and -`Quickstart to using CLM4.5 `_ chapters, and then use the ++|version| in +|cesmrelease| since previous public releases? `_ and +`Quickstart to using +|version| `_ chapters, and then use the more detailed chapters as reference. Before novice users go onto more technical problems covered in `Chapter 2 `_, `Chapter 3 `_, `Chapter 4 `_, or `Chapter 5 `_ they @@ -56,12 +56,12 @@ to replicate some of the examples given there. All users should read the `How to Use This Document `_ and `Other resources to get help from `_ sections to understand the document conventions and the various ways of getting help on using -CLM4.5. Users should also read the `What is scientifically validated -and functional in CLM4.5 in CESM1.2.0? `_ section to see if ++|version|. Users should also read the `What is scientifically validated +and functional in +|version| in +|cesmrelease|? `_ section to see if their planned use of the model is something that has been scientifically validated and well tested. Users that are NOT using NCAR machines or our list of well tested machines should also read the -What are the UNIX utilities required to use CLM4.5? section to make +What are the UNIX utilities required to use +|version|? section to make sure they have all the required UNIX utilities on the system they want to do their work. @@ -85,8 +85,8 @@ machine is working correctly. What is New with +|version| ========================= -`What's new with +|version| science `_ -The CESM1.2.0 `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. +`What's new with +|version| science `_ +The +|cesmrelease| `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. More details are given in the `CLM ChangeLog file `_. Previous release pages give similar list of changes for previous versions of the model. @@ -99,49 +99,49 @@ The `CLM4 in CESM1.0.5 User's Guide `_ gives information on the updates ========================== In this introduction we first give a simple guide to understand the document conventions in `How to Use This Document `_. -The next section `What is new with CLM4.5 in CESM1.2.0 since previous public releases? `_ gives references to describe the differences between CLM4.5 in CESM1.2.0 and previous CESM releases both from a scientific as well as a software engineering point of view. -For information on previous releases of CLM4.5 before CLM4.5 in CESM1.2.0 see the CESM1.1.1 documentation. -The next section `Quickstart to using CLM4.5 `_ is for users that are already experts in using CLM and gives a quickstart guide to the bare details on how to use CLM4.5. -The next `What is scientifically validated and functional in CLM4.5 in CESM1.2.0? `_ tells you about what has been extensively tested and scientifically validated (and maybe more importantly) what has NOT. -`What are the UNIX utilities required to use CLM4.5? `_ lists the UNIX utilities required to use CLM4.5 and is important if you are running on non-NCAR machines, generic local machines, or machines NOT as well tested by us at NCAR. -Next we have `Important Notes and Best Practices for Usage of CLM4.5 `_ to detail some of the best practices for using CLM4.5 for science. -The last introductory section is `Other resources `_ to get help from which lists different resources for getting help with CESM1.0 and CLM4.5. - -`Chapter 1 `_ goes into detail on how to setup and run simulations with CLM4.5 and especially how to customize cases. +The next section `What is new with +|version| in +|cesmrelease| since previous public releases? `_ gives references to describe the differences between +|version| in +|cesmrelease| and previous CESM releases both from a scientific as well as a software engineering point of view. +For information on previous releases of +|version| before +|version| in +|cesmrelease| see the CESM1.1.1 documentation. +The next section `Quickstart to using +|version| `_ is for users that are already experts in using CLM and gives a quickstart guide to the bare details on how to use +|version|. +The next `What is scientifically validated and functional in +|version| in +|cesmrelease|? `_ tells you about what has been extensively tested and scientifically validated (and maybe more importantly) what has NOT. +`What are the UNIX utilities required to use +|version|? `_ lists the UNIX utilities required to use +|version| and is important if you are running on non-NCAR machines, generic local machines, or machines NOT as well tested by us at NCAR. +Next we have `Important Notes and Best Practices for Usage of +|version| `_ to detail some of the best practices for using +|version| for science. +The last introductory section is `Other resources `_ to get help from which lists different resources for getting help with CESM1.0 and +|version|. + +`Chapter 1 `_ goes into detail on how to setup and run simulations with +|version| and especially how to customize cases. Details of cesm_setup modes and build-namelist options as well as namelist options are given in this chapter. -`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.0 or CLM4.5 physics for creating input datasets for use by CLM, for the expert user. +`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.0 or +|version| physics for creating input datasets for use by CLM, for the expert user. There's an overview of what each tool does, and some general notes on how to build the FORTRAN tools. Then each tool is described in detail along with different ways in which the tool might be used. A final section on how to customize datasets for observational sites for very savvy expert users is given as the last section of this chapter. As a followup to the tools chapter, `Chapter 3 `_ tells how to add files to the XML database for build-namelist to use. -This is important if you want to use the XML database to automatically select user-created input files that you have created when you setup new cases with CLM (both CLM4.0 and CLM4.5 physics). +This is important if you want to use the XML database to automatically select user-created input files that you have created when you setup new cases with CLM (both CLM4.0 and +|version| physics). In `Chapter 4 `_, again for the expert user, we give details on how to do some particularly difficult special cases. -For example, we give the protocol for spinning up the CLM4.5-BGC and CLMCN models as well as CLM with dynamic vegetation active (CNDV). +For example, we give the protocol for spinning up the +|version|-BGC and CLMCN models as well as CLM with dynamic vegetation active (CNDV). We give instructions to do a spinup case from a previous case with Coupler history output for atmospheric forcing. We also give instructions on running both the prognostic crop and irrigation models. Lastly we tell the user how to use the DATM model to send historical CO2 data to CLM. -`Chapter 5 `_ outlines how to do single-point or regional simulations using CLM4.5. -This is useful to either compare CLM4.5 simulations with point observational stations, such as tower sites (which might include your own atmospheric forcing), or to do quick simulations with CLM for example to test a new parameterization. +`Chapter 5 `_ outlines how to do single-point or regional simulations using +|version|. +This is useful to either compare +|version| simulations with point observational stations, such as tower sites (which might include your own atmospheric forcing), or to do quick simulations with CLM for example to test a new parameterization. There are several different ways given on how to perform single-point simulations which range from simple PTS_MODE to more complex where you create all your own datasets, tying into `Chapter 2 `_ and also `Chapter 3 `_ to add the files into the build-namelist XML database. The PTCLM python script to run single-point simulations was added back in for this release (but it has bugs that don't allow it to work out of the box). CLM4 in CESM1.0.5 has a fully working versions of PTCLM. Need `Chapter 6 `_ blurb... -`Chapter 7 `_ gives some guidance on trouble-shooting problems when using CLM4.5. +`Chapter 7 `_ gives some guidance on trouble-shooting problems when using +|version|. It doesn't cover all possible problems with CLM, but gives you some guidelines for things that can be done for some common problems. `Chapter 8 `_ goes over the automated testing scripts for validating that the CLM is working correctly. -The test scripts run many different configurations and options with CLM4.0 physics as well and CLM4.5 physics making sure that they work, as well as doing automated testing to verify restarts are working correctly, and testing at many different resolutions. -In general this is an activity important only for a developer of CLM4.5, but could also be used by users who are doing extensive code modifications and want to ensure that the model continues to work correctly. +The test scripts run many different configurations and options with CLM4.0 physics as well and +|version| physics making sure that they work, as well as doing automated testing to verify restarts are working correctly, and testing at many different resolutions. +In general this is an activity important only for a developer of +|version|, but could also be used by users who are doing extensive code modifications and want to ensure that the model continues to work correctly. -In the appendices we talk about some issues that are useful for advanced users and developers of CLM4.5. +In the appendices we talk about some issues that are useful for advanced users and developers of +|version|. -Finally in `Appendix A `_ we give instructions on how to build the documentation associated with CLM4.5 (i.e. how to build this document). +Finally in `Appendix A `_ we give instructions on how to build the documentation associated with +|version| (i.e. how to build this document). This document is included in every CLM distribution and can be built so that you can view a local copy rather than having to go to the CESM website. This also could be useful for developers who need to update the documentation due to changes they have made. @@ -151,12 +151,12 @@ This also could be useful for developers who need to update the documentation du Best Practices ================ -- CLM4.5 includes BOTH the old CLM4.0 physics AND the new CLM4.5 physics and you can toggle between two. +- +|version| includes BOTH the old CLM4.0 physics AND the new +|version| physics and you can toggle between two. The "standard" practice for CLM4.0 is to run with CN on, and with Qian atmospheric forcing. - While the "standard" practice for CLM4.5 is to run with BGC on, and CRUNCEP atmospheric forcing. - "BGC" is the new CLM4.5 biogeochemistry and include CENTURY-like pools, vertical resolved carbon, as well as Nitrification and de-Nitrification (see `the Section called Some Acronym's and Terms We'll be Using in Other resources to get help from `_ ). + While the "standard" practice for +|version| is to run with BGC on, and CRUNCEP atmospheric forcing. + "BGC" is the new +|version| biogeochemistry and include CENTURY-like pools, vertical resolved carbon, as well as Nitrification and de-Nitrification (see `the Section called Some Acronym's and Terms We'll be Using in Other resources to get help from `_ ). -- When running with CLMCN (either CLM4.0 or CLM4.5 physics) or CLM4.5-BGC, it is critical to begin with initial conditions that are provided with the release or to spin the model up following the CN spinup procedure before conducting scientific runs (see `the Section called Spinning up the CLM4.5 biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for CLM4.5 or `the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4 `_ for CLM4.0). +- When running with CLMCN (either CLM4.0 or +|version| physics) or +|version|-BGC, it is critical to begin with initial conditions that are provided with the release or to spin the model up following the CN spinup procedure before conducting scientific runs (see `the Section called Spinning up the +|version| biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for +|version| or `the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4 `_ for CLM4.0). Simulations without a proper spinup will effectively be starting from an unvegetated world. See `the Section called Setting Your Initial Conditions File in Chapter 1 `_ for information on how to provide initial conditions for your simulation. @@ -169,20 +169,20 @@ This also could be useful for developers who need to update the documentation du Therefore, by design the year 2000 initial condition files do not represent an equilibrium state. Note also that spinning the 2000 initial conditions out to equilibrium will not reflect the best estimate of the real carbon/nitrogen state for the year 2000. -- Initial condition files are also provided for CLM4.5 for several configurations and resolutions. - For CLM4.5-SP and CLM4.5-BGC with CRUNCEP forcing we have initial conditions at 1deg resolution for both 1850 and 2000. - The CLM4.5-BGC initial conditions for 1850 (again with CRUNCEP forcing) were also interpolated to 2deg, CRUNCEP half degree (360x720cru), and ne30np4 resolutions. - Also the CLM4.5-BGC initial conditions for 1850 (with CRUNCEP forcing) were interpolated to 1deg CLM4.5-BGC-DV and 2deg CLM4.5-BGC-Crop. +- Initial condition files are also provided for +|version| for several configurations and resolutions. + For +|version|-SP and +|version|-BGC with CRUNCEP forcing we have initial conditions at 1deg resolution for both 1850 and 2000. + The +|version|-BGC initial conditions for 1850 (again with CRUNCEP forcing) were also interpolated to 2deg, CRUNCEP half degree (360x720cru), and ne30np4 resolutions. + Also the +|version|-BGC initial conditions for 1850 (with CRUNCEP forcing) were interpolated to 1deg +|version|-BGC-DV and 2deg +|version|-BGC-Crop. - Users can generate initial condition files at different resolutions by using the CLM tool interpinic to interpolate from one of the provided resolutions to the resolution of interest. Interpolated initial condition files may no longer be in 'reasonable' equilibrium. -- In CLM4.5 for both CLM4.5-CN and CLM4.5-BGC the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). +- In +|version| for both +|version|-CN and +|version|-BGC the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). By default we have provided a climatology dataset for lightning frequency and a dataset with coverage from 1850 to 2010 for population density. Both of these datasets are interpolated from the native resolution of the datasets to the resolution you are running the model on. If you are running with an atmosphere model or forcing that is significantly different than present day -- the lightning frequency may NOT appropriately correspond to your atmosphere forcing and fire initiation would be inappropriate. -- Aerosol deposition is a required field to both CLM4.0 and CLM4.5 physics, sent from the atmosphere model. +- Aerosol deposition is a required field to both CLM4.0 and +|version| physics, sent from the atmosphere model. Simulations without aerosol deposition will exhibit unreasonably high snow albedos. The model sends aerosol deposition from the atmospheric model (either CAM or DATM). When running with prescribed aerosol the atmosphere model will interpolate the aerosols from 2-degree resolution to the resolution the atmosphere model is running at. diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst index edcd0bc2fe..3091595c68 100644 --- a/doc/source/users_guide/overview/quickstart.rst +++ b/doc/source/users_guide/overview/quickstart.rst @@ -7,31 +7,31 @@ Running the CLM requires a suite of UNIX utilities and programs and you should make sure you have all of these available before trying to go forward with using it. If you are missing one of these you should contact the systems administrator for the machine you wish to run on and make sure they are installed. -List of utilities required for CESM in the "CESM1.2.0 Software/Operating System Prerequisites" section in `http://www.cesm.ucar.edu/models/cesm1.2//cesm/doc/usersguide/book1.html `_ +List of utilities required for CESM in the "+|cesmrelease| Software/Operating System Prerequisites" section in `http://www.cesm.ucar.edu/models/cesm1.2//cesm/doc/usersguide/book1.html `_ - UNIX bash shell (for some of the CLM tools scripts) - NCL (for some of the offline tools for creating/modifying CLM input datasets see `Chapter 2 `_ for more information on NCL) - Python (optional, needed for PTCLM) - xsltproc, docbook and docbook utilities (optional, needed to build the Users-Guide) -Before working with CLM4.5 read the QuickStart Guide in the `CESM1.2.0 Scripts User's Guide `_. Once you are familiar with how to setup cases for any type of simulation with CESM you will want to direct your attention to the specifics of using CLM. +Before working with +|version| read the QuickStart Guide in the `+|cesmrelease| Scripts User's Guide `_. Once you are familiar with how to setup cases for any type of simulation with CESM you will want to direct your attention to the specifics of using CLM. -For some of the details of setting up cases for CLM4.5 read the README and text files available from the "models/lnd/clm/doc" directory (see the "CLM Web pages" section for a link to the list of these files). Here are the important ones that you should be familiar with. +For some of the details of setting up cases for +|version| read the README and text files available from the "$CTSMROOT/doc" directory (see the "CLM Web pages" section for a link to the list of these files). Here are the important ones that you should be familiar with. 1. `README file `_ describing the directory structure. 2. `Quickstart.userdatasets `_ file describing how to use your own datasets in the model (also see `the Section called Creating your own single-point/regional surface datasets in Chapter 5 `_). -3. `models/lnd/clm/doc/KnownBugs `_ file describing known problems in CLM4.5 (that we expect to eventually fix). +3. `$CTSMROOT/doc/KnownBugs `_ file describing known problems in +|version| (that we expect to eventually fix). -4. `models/lnd/clm/doc/KnownLimitationss `_ file describing known limitations in CLM4.5 and workarounds that we do NOT expect to fix. +4. `$CTSMROOT/doc/KnownLimitationss `_ file describing known limitations in +|version| and workarounds that we do NOT expect to fix. -The IMPORTANT_NOTES file talks about important things for users to know about using the model scientifically. It content is given in the next chapter on `"What is scientifically validated and functional in CLM4.5 in CESM1.2.0?" `_. +The IMPORTANT_NOTES file talks about important things for users to know about using the model scientifically. It content is given in the next chapter on `"What is scientifically validated and functional in +|version| in +|cesmrelease|?" `_. -The ChangeLog/ChangeSum talk about advances in different versions of CLM. The content of these files is largely explained in the previous chapter on `"What is new with CLM4.5 in CESM1.2.0 since previous public releases?" `_. +The ChangeLog/ChangeSum talk about advances in different versions of CLM. The content of these files is largely explained in the previous chapter on `"What is new with +|version| in +|cesmrelease| since previous public releases?" `_. Note other directories have README files that explain different components and tools used when running CLM and are useful in understanding how those parts of the model work and should be consulted when using tools in those directories. For more details on configuring and customizing a case with CLM see `Chapter 1 `_. -The Quickstart.GUIDE (which can be found in ``models/lnd/clm/doc``) is repeated here. +The Quickstart.GUIDE (which can be found in ``$CTSMROOT/doc``) is repeated here. -.. include:: ../../clm5.0/doc/Quickstart.GUIDE +.. include:: ../../+|version|/doc/Quickstart.GUIDE :literal: diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst index 7d4408bcc8..a238bee4a6 100644 --- a/doc/source/users_guide/overview/scientific_validation.rst +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -4,16 +4,16 @@ Scientific Validation ======================== -In this section we go over what has been extensively tested and scientifically validated with CLM4.5, and maybe more importantly what has NOT been tested and may NOT be scientifically validated. You can use all features of CLM, but need to realize that some things haven't been tested extensively or validated scientifically. When you use these features you may run into trouble doing so, and will need to do your own work to make sure the science is reasonable. +In this section we go over what has been extensively tested and scientifically validated with +|version|, and maybe more importantly what has NOT been tested and may NOT be scientifically validated. You can use all features of CLM, but need to realize that some things haven't been tested extensively or validated scientifically. When you use these features you may run into trouble doing so, and will need to do your own work to make sure the science is reasonable. -------------------------------------------------------------- Standard Configuration and Namelist Options that are Validated -------------------------------------------------------------- See -`http://www.cesm.ucar.edu/models/cesm1.2/clm/CLM_configurations_CESM1.2.pdf `_ for an explanation of what configurations are scientifically validated for CLM4.5. For CLM4.0 changes to the science of the model are minimal since CESM1.1.1 so we expect answers to be very similar to using it. +`http://www.cesm.ucar.edu/models/cesm1.2/clm/CLM_configurations_CESM1.2.pdf `_ for an explanation of what configurations are scientifically validated for +|version|. For CLM4.0 changes to the science of the model are minimal since CESM1.1.1 so we expect answers to be very similar to using it. -In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case you will need to go through more extensive work to validate these options from a scientific standpoint. Some of these options are only for CLM4.5 while others are for both CLM4.0 AND CLM4.5 we explicitly say which they apply to. +In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case you will need to go through more extensive work to validate these options from a scientific standpoint. Some of these options are only for +|version| while others are for both CLM4.0 AND +|version| we explicitly say which they apply to. --------------------------------------------------------------------------------------------------------------- Configure Modes NOT scientifically validated, documented, supported or, in some cases, even advised to be used: @@ -21,13 +21,13 @@ Configure Modes NOT scientifically validated, documented, supported or, in some These are options that you would add to ``CLM_CONFIG_OPTS``. -1. exlaklayers on[CLM4.5 only] This mode is NOT tested and may NOT be even functional. +1. exlaklayers on[+|version| only] This mode is NOT tested and may NOT be even functional. -2. snicar_frc on[CLM4.0 AND CLM4.5] This mode is tested and functional, but is NOT constantly scientifically validated, and should be considered experimental. +2. snicar_frc on[CLM4.0 AND +|version|] This mode is tested and functional, but is NOT constantly scientifically validated, and should be considered experimental. -3. vichydro on[CLM4.5 only] This mode is tested and functional, but does NOT have long scientific validation simulations run with it so, should be considered experimental. +3. vichydro on[+|version| only] This mode is tested and functional, but does NOT have long scientific validation simulations run with it so, should be considered experimental. -4. vsoilc_centbgc[CLM4.5 only] This option is extensively tested for both "on" and "off". The "no-vert" option has limited testing performed on it, but isn't scientifically validated (and it currently has a bug -- see 1746 and 1672 in `models/lnd/clm/doc/KnownBugs `_). The "no-cent" and "no-nitrif" options are NOT tested and as such may NOT ben even functional. +4. vsoilc_centbgc[+|version| only] This option is extensively tested for both "on" and "off". The "no-vert" option has limited testing performed on it, but isn't scientifically validated (and it currently has a bug -- see 1746 and 1672 in `$CTSMROOT/doc/KnownBugs `_). The "no-cent" and "no-nitrif" options are NOT tested and as such may NOT ben even functional. ---------------------------------------------- Namelist options that should NOT be exercised: @@ -36,10 +36,10 @@ Namelist options that should NOT be exercised: ---------------------------------------------------- Build-Namelist options that should NOT be exercised: ---------------------------------------------------- -1. -irrig with -bgc cn and -phys clm4_0 We have only run the irrigation model with CLMSP (i.e. without the CN model). We recommend that if you want to run the irrigation model with CN, that you do a spinup. But, more than that you may need to make adjustments to irrig_factor in models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90. See the notes on this in the description of the irrigation model in the +1. -irrig with -bgc cn and -phys clm4_0 We have only run the irrigation model with CLMSP (i.e. without the CN model). We recommend that if you want to run the irrigation model with CN, that you do a spinup. But, more than that you may need to make adjustments to irrig_factor in $CTSMROOT/src/biogeophys/CanopyFluxesMod.F90. See the notes on this in the description of the irrigation model in the `Technical Descriptions of the Interactive Crop Management and Interactive Irrigation Models `_. -2. -irrig with -crop on and -phys clm4_0 Irrigation doesn't work with the prognostic crop model. Irrigation is only applied to generic crop currently, which negates it's practical usage. We also have a known problem when both are on (see bug 1326 in the `models/lnd/clm/doc/KnownBugs `_ file). If you try to run in this mode, the CLM build-namelist will return with an error. +2. -irrig with -crop on and -phys clm4_0 Irrigation doesn't work with the prognostic crop model. Irrigation is only applied to generic crop currently, which negates it's practical usage. We also have a known problem when both are on (see bug 1326 in the `$CTSMROOT/doc/KnownBugs `_ file). If you try to run in this mode, the CLM build-namelist will return with an error. -------------------------------------------- Namelist items that should NOT be exercised: diff --git a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst index 81f45a038f..1e7a5437eb 100644 --- a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst +++ b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst @@ -89,7 +89,7 @@ Also note that this site has a site-specific dynamic land-use change file for it # Note: When creating the fpftdyn dataset for this site it will use the # PTCLM_sitedata/US-Ha1_dynpftdata.txt # file for land-use change and harvesting - > ./PTCLM.py -m yellowstone_intel -s US-Ha1 -d $MYCSMDATA --sitegroupname AmeriFlux -c I20TRCRUCLM45BGC + > ./PTCLM.py -m cheyenne_intel -s US-Ha1 -d $MYCSMDATA --sitegroupname AmeriFlux -c I20TRCRUCLM45BGC > mkdir $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 > cd $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 # Copy data in NetCDF format to this directory, filenames should be YYYY-MM.nc diff --git a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst index f710ed0bb4..30068b600c 100644 --- a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst @@ -104,10 +104,10 @@ The output to the above command is as follows: Main Script Version Id: $Id: PTCLM.py 47576 2013-05-29 19:11:16Z erik $ Scripts URL: $HeadURL: https://svn-ccsm-models.cgd.ucar.edu/PTCLM/trunk_tags/PTCLM1_130529/PTCLM.py $: -Here we give a simple example of using PTCLM1 for a straightforward case of running at the US-UMB Fluxnet site on yellowstone where we already have the meteorology data on the machine. +Here we give a simple example of using PTCLM1 for a straightforward case of running at the US-UMB Fluxnet site on cheyenne where we already have the meteorology data on the machine. Note, see `the Section called Converting AmeriFlux Data for use by PTCLM `_ for permission information to use this data. -Example 6-1. Example of running PTCLM1 for US-UMB on yellowstone +Example 6-1. Example of running PTCLM1 for US-UMB on cheyenne ---------------------------------------------------------------- :: @@ -115,18 +115,18 @@ Example 6-1. Example of running PTCLM1 for US-UMB on yellowstone > setenv CSMDATA $CESMDATAROOT/inputdata > setenv MYCSMDATA $HOME/inputdata > setenv SITE US-UMB - > setenv MYMACH yellowstone_intel + > setenv MYMACH cheyenne_intel > setenv MYCASE testPTCLM # First link the standard input files to a location you have write access > cd scripts > ./link_dirtree $CSMDATA $MYCSMDATA # Next build all of the clm tools you will need - > cd ../models/lnd/clm/tools/clm4_5/mksurfdata_map + > cd ../$CTSMROOT/tools/+|version|/mksurfdata_map > gmake > gmake clean > cd ../../../../../../tools/mapping/gen_domain_files/src - > ../../../../scripts/ccsm_utils/Machines/configure -mach yellowstone -compiler intel + > ../../../../scripts/ccsm_utils/Machines/configure -mach cheyenne -compiler intel > gmake > gmake clean # next run PTCLM (NOTE -- MAKE SURE python IS IN YOUR PATH) diff --git a/doc/source/users_guide/running-PTCLM/ptclm-examples.rst b/doc/source/users_guide/running-PTCLM/ptclm-examples.rst index e9a887e89c..172f041420 100644 --- a/doc/source/users_guide/running-PTCLM/ptclm-examples.rst +++ b/doc/source/users_guide/running-PTCLM/ptclm-examples.rst @@ -13,7 +13,7 @@ Example: Running PTCLM for the Mexicocity supported single point dataset :: > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM - > ./PTCLM.py -m yellowstone_intel -s 1x1_mexicocityMEX -d $CSMDATA --nopointdata \ + > ./PTCLM.py -m cheyenne_intel -s 1x1_mexicocityMEX -d $CSMDATA --nopointdata \ --stdurbpt -c ICRUCLM45 --caseidprefix `pwd`/myPTCLMcases/site > cd myPTCLMcases/site_1x1_mexicocityMEX_I > ./cesm_setup @@ -29,7 +29,7 @@ Example: Running PTCLM for a spinup simulation with Qian data for tower years. :: > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM - > ./PTCLM.py -m yellowstone_intel -s US-Ha1 -d $CSMDATA --sitegroupname AmeriFlux --useQIAN --QIAN_tower_yrs + > ./PTCLM.py -m cheyenne_intel -s US-Ha1 -d $CSMDATA --sitegroupname AmeriFlux --useQIAN --QIAN_tower_yrs > cd ../../../../../US-Ha1_ICRUCLM45BGC_QIAN > ./cesm_setup # Now build and run normally @@ -67,4 +67,4 @@ Example: Running PTCLM on a user-defined machine with global PFT and soil types # Here we show running interactively > ./US-UMB_ICRUCLM45BGC.userdefined_intel.run -.. warning: Because of Bug 1364, when running this case as above we get a floating point error after reaching time-step 124 for the example exactly as above. Other machines or compilers probably won't have this problem. See the `models/lnd/clm/doc/KnownBugs `_ file for more information on this problem. +.. warning: Because of Bug 1364, when running this case as above we get a floating point error after reaching time-step 124 for the example exactly as above. Other machines or compilers probably won't have this problem. See the `$CTSMROOT/doc/KnownBugs `_ file for more information on this problem. diff --git a/doc/source/users_guide/running-PTCLM/using-ptclm.rst b/doc/source/users_guide/running-PTCLM/using-ptclm.rst index b644337239..73cf45ff88 100644 --- a/doc/source/users_guide/running-PTCLM/using-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/using-ptclm.rst @@ -8,7 +8,7 @@ There are three types of options to PTCLM1: required, setup/run-time, and datase The three required options are the three settings that MUST be specified for PTCLM to work at all. The other settings have default values that will default to something useful. The setup/run-time options control how the simulation will be setup and run. The dataset generation options control the generation of datasets needed when PTCLM is run. Most options use a double dash "--" "longname" such as "--list", but the most common options also have a short-name with a single dash (such as -m instead of --machine). The required options to PTCLM are: inputdata directory (-d), machine (-m) and site-name (-s). -Inputdata directory is the directory where you have the CESM inputdata files, you need to have write access to this directory, so if you are running on a machine that you do NOT have write access to the standard inputdata location (such as NCAR yellowstone or LBNL hopper) you need to link the standard files to a location you do have control over. We recommend using the ``scripts/link_dirtree`` tool to do that. "machine" is the scripts name for the machine/compiler you will be using for your case. And finally site-name is the name of the site that you want to run for. Site-name can either be a valid supported dataset name or a Fluxnet site name from the list of sites you are running on (see the --sitegroupname for more information about the site lists). +Inputdata directory is the directory where you have the CESM inputdata files, you need to have write access to this directory, so if you are running on a machine that you do NOT have write access to the standard inputdata location (such as NCAR cheyenne or LBNL hopper) you need to link the standard files to a location you do have control over. We recommend using the ``scripts/link_dirtree`` tool to do that. "machine" is the scripts name for the machine/compiler you will be using for your case. And finally site-name is the name of the site that you want to run for. Site-name can either be a valid supported dataset name or a Fluxnet site name from the list of sites you are running on (see the --sitegroupname for more information about the site lists). After PTCLM is run a case directory where you can then setup, build and run your CESM case as normal. It also creates a ``README.PTCLM`` in that directory that documents the commandline options to PTCLM that were used to create it. @@ -33,7 +33,7 @@ Steps in running PTCLM You need to setup an inputdata directory where you have write access to it. Normally, for NCAR machines the data is on an inputdata where the user does NOT have write access to it. A way that you can get around this is to use the **link_dirtree** script to create softlinks from the normal location to a location you have write access to. - So for example on yellowstone: + So for example on cheyenne: :: > setenv CSMDATA $CESMDATAROOT/inputdata @@ -48,11 +48,11 @@ Steps in running PTCLM Next you need to make sure all the CLM FORTRAN tools are built. :: - > cd models/lnd/clm/tools/clm4_5/mksurfdata_map + > cd $CTSMROOT/tools/+|version|/mksurfdata_map > gmake > gmake clean > cd ../../../../../../tools/mapping/gen_domain_files/src - > ../../../../scripts/ccsm_utils/Machines/configure -mach yellowstone -compiler intel + > ../../../../scripts/ccsm_utils/Machines/configure -mach cheyenne -compiler intel > gmake > gmake clean @@ -77,7 +77,7 @@ Steps in running PTCLM :: > cd scripts - > ./PTCLM.py -m yellowstone_intel -s US-UMB -d $MYCSMDATA -c ICRUCLM45BGC --use QIAN "US-UMB_I_2000_CN_QIAN" + > ./PTCLM.py -m cheyenne_intel -s US-UMB -d $MYCSMDATA -c ICRUCLM45BGC --use QIAN "US-UMB_I_2000_CN_QIAN" b. PTCLM creates datasets for you It will populate $MYCSMDATA with new datasets it creates using the CLM tools. diff --git a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst index 56d70b1d7d..ca794ac326 100644 --- a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst @@ -11,7 +11,7 @@ To setup a ``PTS_MODE`` simulation you use the "-pts_lat" and "-pts_lon" argumen :: > cd scripts - > ./create_newcase -case testPTS_MODE -res f19_g16 -compset I1850CRUCLM45BGC -pts_lat 40.0 -pts_lon -105 + > ./create_newcase -case testPTS_MODE -res f19_g17_gl4 -compset I1850Clm50BgcCropCru -pts_lat 40.0 -pts_lon -105 > cd testPTS_MODE # We make sure the model will start up cold rather than using initial conditions @@ -21,7 +21,7 @@ Then setup, build and run as normal. We make sure initial conditions are NOT use .. note:: By default it sets up to run with MPILIB=mpi-serial (in the env_build.xml file) turned on, which allows you to run the model interactively. On some machines this mode is NOT supported and you may need to change it to FALSE before you are able to build. -.. warning:: ``PTS_MODE`` currently does NOT restart nor is it able to startup from global initial condition files. See bugs "1017 and 1025" in the `models/lnd/clm/doc/KnownLimitationss `_ file. +.. warning:: ``PTS_MODE`` currently does NOT restart nor is it able to startup from global initial condition files. See bugs "1017 and 1025" in the `$CTSMROOT/doc/KnownLimitationss `_ file. .. note:: You can change the point you are simulating for at run-time by changing the values of ``PTS_LAT`` and ``PTS_LON`` in the ``env_run.xml`` file. @@ -35,6 +35,6 @@ You might also want to set the ``env_build.xml`` variable: ``MPILIB=mpi-serial`` On many machines, batch queues have a minimum number of nodes or processors that can be used. On these machines you may have to change the queue and possibly the time-limits of the job, to get it to run in the batch queue. -On the NCAR machine, yellowstone, this is done for you automatically, and the "caldera" queue is used for such single-processor simulations. +On the NCAR machine, cheyenne, this is done for you automatically, and the "caldera" queue is used for such single-processor simulations. Another way to get around this problem is to run the job interactively using ``MPILIB=mpi-serial`` so that you don't submit the job to the batch queue. For single point mode you also may want to consider using a smaller workstation or cluster, rather than a super-computer, because you can't take advantage of the multi-processing power of the super-computer anyway. diff --git a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst index 3445b0cab7..accc5381a7 100644 --- a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst @@ -11,7 +11,7 @@ However, users can create their own dataset. To get the list of supported dataset resolutions do this: :: - > cd models/lnd/clm/doc + > cd $CTSMROOT/doc > ../bld/build-namelist -res list @@ -120,7 +120,7 @@ Example: Running CLM over the single-point of Vancouver Canada with supplied atm > ./case.setup -.. warning:: If you don't set the start-year and run-length carefully as shown above the model will abort with a "dtlimit error" in the atmosphere model (see bug 1110 in the `models/lnd/clm/doc/KnownLimitationss `_ file for documentation on this). Since, the forcing data for this site (and the MexicoCity site) is less than a year, the model won't be able to run for a full year. The ``1x1_urbanc_alpha`` site has data for more than a full year, but neither year is complete hence, it has the same problem (see the problem for this site above). +.. warning:: If you don't set the start-year and run-length carefully as shown above the model will abort with a "dtlimit error" in the atmosphere model (see bug 1110 in the `$CTSMROOT/doc/KnownLimitationss `_ file for documentation on this). Since, the forcing data for this site (and the MexicoCity site) is less than a year, the model won't be able to run for a full year. The ``1x1_urbanc_alpha`` site has data for more than a full year, but neither year is complete hence, it has the same problem (see the problem for this site above). .. note:: Just like ``PTS_MODE`` above, By default it sets up to run with ``MPILIB=mpi-serial`` (in the env_build.xml file) turned on, which allows you to run the model interactively. @@ -164,17 +164,17 @@ Example: Creating a surface dataset for a single point > setenv GRIDNAME 1x1_boulderCO > setenv CDATE `date +%y%m%d` # Create the SCRIP grid file for the location and create a unity mapping file for it. - > cd models/lnd/clm/tools/shared/mkmapdata + > cd $CTSMROOT/tools/mkmapdata > ./mknoocnmap.pl -p 40,255 -n $GRIDNAME # Set pointer to MAPFILE just created that will be used later > setenv MAPFILE `pwd`/map_${GRIDNAME}_noocean_to_${GRIDNAME}_nomask_aave_da_${CDATE}.nc # create the mapping files needed by mksurfdata_map. - > cd ../../shared/mkmapdata + > cd ../.././mkmapdata > setenv GRIDFILE ../mkmapgrids/SCRIPgrid_${GRIDNAME}_nomask_${CDATE}.nc > ./mkmapdata.sh -r $GRIDNAME -f $GRIDFILE -t regional # create the domain file > cd ../../../../tools/mapping/gen_domain_files/src - > ../../../scripts/ccsm_utils/Machines/configure -mach yellowstone -compiler intel + > ../../../scripts/ccsm_utils/Machines/configure -mach cheyenne -compiler intel > gmake > cd .. > setenv OCNDOM domain.ocn_noocean.nc @@ -183,7 +183,7 @@ Example: Creating a surface dataset for a single point # Save the location where the domain file was created > setenv GENDOM_PATH `pwd` # Finally create the surface dataset - > cd ../../../../lnd/clm/tools/clm4_5/mksurfdata_map/src + > cd ../../../../lnd/clm/tools/+|version|/mksurfdata_map/src > gmake > cd .. > ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE @@ -202,11 +202,11 @@ Example: Setting up a case from the single-point surface dataset just created > ./link_dirtree $CSMDATA $MYCSMDATA # Copy the file you created above to your new $MYCSMDATA location following the CLMUSRDAT # naming convention (leave off the creation date) - > cp $CESMROOT/models/lnd/clm/tools/clm4_5/mksurfdata_map/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ + > cp $CESMROOT/$CTSMROOT/tools/+|version|/mksurfdata_map/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ $MYCSMDATA/lnd/clm2/surfdata_map/surfdata_${GRIDNAME}_simyr1850.nc > cd $CESMROOT/scripts - > ./create_newcase -case my_usernldatasets_test -res CLM_USRDAT -compset I1850CRUCLM45BGC \ - -mach yellowstone_intel + > ./create_newcase -case my_usernldatasets_test -res CLM_USRDAT -compset I1850Clm50BgcCropCru \ + -mach cheyenne_intel > cd my_usernldatasets_test > ./xmlchange DIN_LOC_ROOT=$MYCSMDATA # Set the path to the location of gen_domain set in the creation step above diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst index efb2f6b4aa..c92892ba8d 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst @@ -1,21 +1,21 @@ .. _spinning-up-clm45-bgc: ====================== - Spinup of CLM4.5-BGC + Spinup of +|version|-BGC ====================== -To get the CLM4.5-BGC model to a steady state, you first run it from arbitrary initial conditions using the "accelerated decomposition spinup" (-bgc_spinup on in CLM **configure**) mode for 1000 simulation years. +To get the +|version|-BGC model to a steady state, you first run it from arbitrary initial conditions using the "accelerated decomposition spinup" (-bgc_spinup on in CLM **configure**) mode for 1000 simulation years. After this you branch from this mode in the "final spinup" (-bgc_spinup off in CLM **configure**), and run for (at least 200+ simulation years). **1. 45_AD_SPINUP** For the first step of running 1000+ years in "-bgc_spinup on" mode, you will setup a case, and then edit the values in env_build.xml and env_run.xml so that the right configuration is turned on and the simulation is setup to run for the required length of simulation time. So do the following: -Example:: AD_SPINUP Simulation for CLM4.5-BGC +Example:: AD_SPINUP Simulation for +|version|-BGC -------------------------------------------------------- :: > cd scripts - > ./create_newcase -case BGC_spinup -res f19_g16 -compset I1850CRUCLM45BGC -mach yellowstone_intel + > ./create_newcase -case BGC_spinup -res f19_g17_gl4 -compset I1850Clm50BgcCropCru -mach cheyenne_intel > cd BGC_spinup # Append "-spinup on" to CLM_BLDNML_OPTS > ./xmlchange CLM_BLDNML_OPTS="-bgc_spinup on" -append @@ -33,19 +33,19 @@ Example:: AD_SPINUP Simulation for CLM4.5-BGC # Now run normally > ./BGC_spinup.submit -.. note:: This same procedure works for CLM4.5-CN as well, you can typically shorten the spinup time from 1000 years to 600 though. +.. note:: This same procedure works for +|version|-CN as well, you can typically shorten the spinup time from 1000 years to 600 though. Afterwards save the last restart file from this simulation to use in the next step. -**2. Final spinup for CLM4.5-BGC** +**2. Final spinup for +|version|-BGC** Next save the last restart file from this step and use it as the "finidat" file to use for one more spinup for at least 200+ years in normal mode. So do the following: -Example: Final CLMBGC Spinup Simulation for CLM4.5-BGC +Example: Final CLMBGC Spinup Simulation for +|version|-BGC ------------------------------------------------------------------ :: > cd scripts - > ./create_newcase -case BGC_finalspinup -res f19_g16 -compset I1850CRUCLM45BGC -mach yellowstone_intel + > ./create_newcase -case BGC_finalspinup -res f19_g17_gl4 -compset I1850Clm50BgcCropCru -mach cheyenne_intel > cd BGC_finalspinup # Now, Copy the last CLM restart file from the earlier case into your run directory > cp /ptmp/$LOGIN/archive/BGC_spinup/rest/BGC_spinup.clm*.r*.1002-01-01-00000.nc \ @@ -69,7 +69,7 @@ Example: Final CLMBGC Spinup Simulation for CLM4.5-BGC To assess if the model is spunup plot trends of CLMBGC variables of interest. If you see a trend, you may need to run the simulation longer. Finally save the restart file from the end of this simulation to use as an "finidat" file for future simulations. -.. note:: This same final spinup procedure works for CLM4.5-CN as well, you can typically shorten the spinup time from 200 years to 50 though. +.. note:: This same final spinup procedure works for +|version|-CN as well, you can typically shorten the spinup time from 200 years to 50 though. diff --git a/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst index 709a1b26a6..36f2266493 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst @@ -7,15 +7,15 @@ Because it takes so long to spinup the CN model (as we just saw previously), if you are doing fully coupled simulations with active atmosphere and ocean, you will want to do the spinup portion of this "offline". So instead of doing expensive fully coupled simulations for the spinup duration, you run CLM in a very cheap "I" compset using atmospheric forcing from a shorter fully coupled simulation (or a simulation run previously by someone else). -In this example we will use the ``I1850SPINUPCN compset`` to setup CLM to run with atmospheric forcing from a previous fully coupled simulation with data that is already stored on disk on yellowstone. -There are several simulations that have high frequency data for which we can do this. You can also do this on a machine other than yellowstone, but would need to download the data from the Earth System Grid and change the datapath similar to `Example 4-11 `_. +In this example we will use the ``I1850Clm50BgcSpinup compset`` to setup CLM to run with atmospheric forcing from a previous fully coupled simulation with data that is already stored on disk on cheyenne. +There are several simulations that have high frequency data for which we can do this. You can also do this on a machine other than cheyenne, but would need to download the data from the Earth System Grid and change the datapath similar to `Example 4-11 `_. -Example: Simulation with MOAR Data on yellowstone +Example: Simulation with MOAR Data on cheyenne ------------------------------------------------------------- :: > cd scripts - > ./create_newcase -case MOARforce1850 -res f19_g16 -compset I1850SPINUPCN -mach yellowstone_intel + > ./create_newcase -case MOARforce1850 -res f19_g17_gl4 -compset I1850Clm50BgcSpinup -mach cheyenne_intel > cd MOARforce1850 # The following sets the casename to point to for atm forcing (you could also use an editor) > ./xmlchange DATM_CPL_CASE=b40.1850.track1.1deg.006a @@ -28,4 +28,4 @@ Example: Simulation with MOAR Data on yellowstone > ./MOARforce1850.submit -.. warning: Because of bug 1339 (see the `models/lnd/clm/doc/KnownBugs `_ file on this) you can't run with 83 or more years of forcing. If you do need to run with more years of forcing, you'll need to address the issue as outlined in the `models/lnd/clm/doc/KnownBugs `_ file. +.. warning: Because of bug 1339 (see the `$CTSMROOT/doc/KnownBugs `_ file on this) you can't run with 83 or more years of forcing. If you do need to run with more years of forcing, you'll need to address the issue as outlined in the `$CTSMROOT/doc/KnownBugs `_ file. diff --git a/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst index 7d523f7324..5cad7c1c5e 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst @@ -7,14 +7,14 @@ Another way that you might want to spinup the model is to run your own simulation for a relatively short period (either a B, E, or F compset) and then use it as forcing for your "I" case later. By only running 20 to 50 years for the fully coupled case, you'll save a substantial amount of computer time rather than running the entire spinup period with a fully coupled model. -The first thing we need to do is to run a fully coupled case and save the atmospheric coupling fields on a three hourly basis. In this example, we will run on yellowstone and archive the data to a local disk that we can then use in the next simulation. +The first thing we need to do is to run a fully coupled case and save the atmospheric coupling fields on a three hourly basis. In this example, we will run on cheyenne and archive the data to a local disk that we can then use in the next simulation. Example: Fully Coupled Simulation to Create Data to Force Next Example Simulation ---------------------------------------------------------------------------------------------- :: > cd scripts - > ./create_newcase -case myBCN1850 -res f09_g16 -compset B1850CN -mach yellowstone_intel + > ./create_newcase -case myBCN1850 -res f09_g17_gl4 -compset B1850CN -mach cheyenne_intel > cd myBCN1850 > ./cesm_setup # Set histaux_a2x3hr to .true. in your user_nl_cpl output from the atmosphere model @@ -35,7 +35,7 @@ Example: Fully Coupled Simulation to Create Data to Force Next Example Simulatio # Now run as normal > ./myBCN1850.submit -.. warning:: Because of bug 1733 (see the `models/lnd/clm/doc/KnownBugs `_ file on this) you'll need to edit the driver code in order for it to produce the correct list of fields needed to run the model later. +.. warning:: Because of bug 1733 (see the `$CTSMROOT/doc/KnownBugs `_ file on this) you'll need to edit the driver code in order for it to produce the correct list of fields needed to run the model later. Now we run an I compset forced with the data from the previous simulation using the ``CPLHIST3HrWx`` option to DATM_MODE. See `the Section called CPLHIST3HrWx mode and it's DATM settings in Chapter 1 `_ for more information on the DATM settings for ``CPLHIST3HrWx`` mode. @@ -44,7 +44,7 @@ Example: Simulation Forced with Data from the Previous Simulation :: > cd scripts - > ./create_newcase -case frcwmyBCN1850 -res f09_g16 -compset I1850SPINUPCN -mach yellowstone_intel + > ./create_newcase -case frcwmyBCN1850 -res f09_g17_gl4 -compset I1850Clm50BgcSpinup -mach cheyenne_intel > cd frcWmyBCN1850 # The following sets the casename to point to for atm forcing (you could also use an editor) > ./xmlchange DATM_CPLHIST_CASE="myBCN1850" @@ -53,7 +53,7 @@ Example: Simulation Forced with Data from the Previous Simulation > ./xmlchange DATM_CPLHIST_YR_ALIGN="1",DATM_CPLHIST_YR_START=1,DATM_CPLHIST_YR_END=20 # Set the strm_datdir in the namelist_defaults_datm.xml # file to the archival path of the case above in the form of: /glade/home/achive/$USER/$DATM_CPLHIST_CASE/cpl/hist - # NOTE: THIS WILL CHANGE THE PATH FOR ALL I1850SPINUPCN COMPSET CASES MADE AFTER THIS! + # NOTE: THIS WILL CHANGE THE PATH FOR ALL I1850Clm50BgcSpinup COMPSET CASES MADE AFTER THIS! > $EDITOR ../../models/atm/datm/bld/namelist_files/namelist_defaults_datm.xml > ./cesm_setup # Now build and run as normal @@ -61,7 +61,7 @@ Example: Simulation Forced with Data from the Previous Simulation > ./frcwmyBCN1850.submit -.. note:: We did this by editing the "namelist_defaults_datm.xml" which will change the settings for ALL future ``I1850SPINUPCN`` cases you run. You could also do this by editing the path in the resulting streams text files in the CaseDocs directory, and then create a "user\_" streams file with the correct path. This would change the streams file JUST for this case. The steps do it this way are: +.. note:: We did this by editing the "namelist_defaults_datm.xml" which will change the settings for ALL future ``I1850Clm50BgcSpinup`` cases you run. You could also do this by editing the path in the resulting streams text files in the CaseDocs directory, and then create a "user\_" streams file with the correct path. This would change the streams file JUST for this case. The steps do it this way are: :: diff --git a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst index 854450ff12..f81634d456 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst @@ -27,7 +27,7 @@ The datafile is a CF-compliant NetCDF file with the data that will be mapped. The streams text file is the XML-like file that tells datm how to find the files and how to map the variables datm knows about to the variable names on the NetCDF files. Note, that in our case the domain file and the data file are the same file. In other cases, the domain file may be separate from the data file. First we are going to create a case, and we will edit the ``user_nl_datm`` so that we add a CO2 data stream in. -There is a streams text file available in ``models/lnd/clm/doc/UsersGuide/co2_streams.txt``, that includes file with a CO2 time-series from 1765 to 2007. +There is a streams text file available in ``$CTSMROOT/doc/UsersGuide/co2_streams.txt``, that includes file with a CO2 time-series from 1765 to 2007. Example: Transient Simulation with Historical CO2 @@ -35,7 +35,7 @@ Example: Transient Simulation with Historical CO2 :: > cd scripts - > ./create_newcase -case DATM_CO2_TSERIES -res f19_g16 -compset I20TRCRUCLM45BGC + > ./create_newcase -case DATM_CO2_TSERIES -res f19_g17_gl4 -compset I20TRCRUCLM45BGC > cd DATM_CO2_TSERIES # Set CCSM_BGC to CO2A so that CO2 will be passed from atmosphere to land @@ -50,7 +50,7 @@ Example: Transient Simulation with Historical CO2 This is a streams file to pass historical CO2 from datm8 to the other surface models. It reads in a historical dataset derived from data used - by CAM. The getco2_historical.ncl script in models/lnd/clm2/tools/ncl_scripts + by CAM. The getco2_historical.ncl script in $CTSMROOT2/tools/ncl_scripts was used to convert the CAM file to a streams compatible format (adding domain information and making CO2 have latitude/longitude even if only for a single point. @@ -106,7 +106,7 @@ Example: Transient Simulation with Historical CO2 > ./preview_namelists The first thing we will do is to edit the ``user_nl_datm`` file to add a CO2 file stream in. -To do this we will copy a ``user_nl_datm`` in with the changes needed. The file ``addco2_user_nl_datm.user_nl`` is in ``models/lnd/clm/doc/UsersGuide`` and looks like this... +To do this we will copy a ``user_nl_datm`` in with the changes needed. The file ``addco2_user_nl_datm.user_nl`` is in ``$CTSMROOT/doc/UsersGuide`` and looks like this... :: dtlimit = 1.5,1.5,1.5,1.5,1.5 @@ -123,12 +123,12 @@ To do this we will copy a ``user_nl_datm`` in with the changes needed. The file You just copy this into your case directory. But, also compare it to the version in ``CaseDocs`` to make sure the changes are just to add in the new CO2 stream. Check to see that filenames, and start, end and align years are correct. :: - > cp ../../models/lnd/clm/doc/UsersGuide/addco2_user_nl_datm.user_nl user_nl_datm + > cp ../../$CTSMROOT/doc/UsersGuide/addco2_user_nl_datm.user_nl user_nl_datm > diff user_nl_datm CaseDocs/datm_atm_in Once, you've done that you can build and run your case normally. -.. warning:: This procedure assumes you are using a ``I20TRCRUCLM45BGC`` compset out of the box, with ``DATM_PRESAERO`` equal to trans_1850-2000. So it assumes standard CLM4.5 CRUNCEP atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes anything here your ``user_nl_datm`` file will need to be adjusted to work with it. +.. warning:: This procedure assumes you are using a ``I20TRCRUCLM45BGC`` compset out of the box, with ``DATM_PRESAERO`` equal to trans_1850-2000. So it assumes standard +|version| CRUNCEP atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes anything here your ``user_nl_datm`` file will need to be adjusted to work with it. .. note:: The intent of the ``user_nl_datm`` is to add an extra streams file for CO2 to the end of the streams variable, and other arrays associated with streams (adding mapalgo as a new array with bilinear for everything, but the CO2 file which should be "nn" for nearest neighbor). Other variables should be the same as the other stream values. diff --git a/doc/source/users_guide/running-special-cases/index.rst b/doc/source/users_guide/running-special-cases/index.rst index af69b010da..95231e9041 100644 --- a/doc/source/users_guide/running-special-cases/index.rst +++ b/doc/source/users_guide/running-special-cases/index.rst @@ -16,7 +16,7 @@ Running Special Cases running-the-prognostic-crop-model.rst running-with-irrigation.rst CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst - CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst + CLM-4.4-Spinning-up-the-+|version|-biogeochemistry-(CLMBGC-spinup).rst CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst diff --git a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst index 31691e721d..3ed3b3f0f1 100644 --- a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst +++ b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst @@ -4,7 +4,7 @@ Running the prognostic crop model =================================== -The prognostic crop model is setup to work with CLM4.5-BGC or CLM4.0-CN (with or without DV) for present day conditions and we have surface and initial condition datasets at f19 resolution. +The prognostic crop model is setup to work with +|version|-BGC or CLM4.0-CN (with or without DV) for present day conditions and we have surface and initial condition datasets at f19 resolution. In order to use the initial condition file, we need to set the ``RUN_TYPE`` to startup rather than ``hybrid`` since the compset for f19 sets up to use an initial condition file without crop active. To activate the crop model you can choose a compset that has "CROP" in the name such as "ICRUCLM45BGCCROP" or simply add "-crop on" to ``CLM_CONFIG_OPTS``. @@ -13,7 +13,7 @@ Example: Crop Simulation :: > cd scripts - > ./create_newcase -case CROP -res f19_g16 -compset I1850CRUCLM45BGC + > ./create_newcase -case CROP -res f19_g17_gl4 -compset I1850Clm50BgcCropCru > cd CROP # Append "-crop on" to CLM_CONFIG_OPTS in env_build.xml (you could also use an editor) diff --git a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst index 4a39f6ec5f..feef7d0bd4 100644 --- a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst +++ b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst @@ -4,8 +4,8 @@ Running with irrigation =================================== -In CLM4.5 irrigation can ONLY be used WITH crop. -To turn on irrigation in CLM4.5 we simply add "-irrig on" to ``CLM_BLDNML_OPTS``. +In +|version| irrigation can ONLY be used WITH crop. +To turn on irrigation in +|version| we simply add "-irrig on" to ``CLM_BLDNML_OPTS``. Just as in the crop example we also change ``RUN_TYPE`` to ``startup`` so that we don't use an initial condition file that is incompatible with irrigation. Example: Irrigation Simulation @@ -14,7 +14,7 @@ Example: Irrigation Simulation # Note here we do a CLMSP simulation as that is what has been validated > cd scripts - > ./create_newcase -case IRRIG -res f19_g16 -compset I + > ./create_newcase -case IRRIG -res f19_g17_gl4 -compset I > cd IRRIG # Append "-irrig" to CLM_BLDNML_OPTS in env_run.xml (you could also use an editor) diff --git a/doc/source/users_guide/runsed.csh b/doc/source/users_guide/runsed.csh new file mode 100755 index 0000000000..56e3445397 --- /dev/null +++ b/doc/source/users_guide/runsed.csh @@ -0,0 +1,6 @@ +#!/bin/csh + +foreach file ( */*.rst ) + sed -f sedscript.txt $file > $file.tmp + mv $file.tmp $file +end diff --git a/doc/source/users_guide/sedscript.txt b/doc/source/users_guide/sedscript.txt new file mode 100644 index 0000000000..ca537f84a6 --- /dev/null +++ b/doc/source/users_guide/sedscript.txt @@ -0,0 +1,17 @@ +s/CLM4.5/+|version|/g +s/clm4.5/+|version|/g +s/CLM5.0/+|version|/g +s/clm5.0/+|version|/g +s/CESM2.0/+|cesmrelease|/g +s/cesm2.0/+|cesmrelease|/g +s/CESM1.2.0/+|cesmrelease|/g +s/cesm1.2.0/+|cesmrelease|/g +s#models/lnd/clm#$CTSMROOT#g +s#tools/shared/#tools/#g +s#shared/#./#g +s/yellowstone/cheyenne/g +s/I1850SPINUPCN/I1850Clm50BgcSpinup/g +s/I1850CRUCLM45BGC/I1850Clm50BgcCropCru/g +s/I1850CRUCLM45BGC/I1850Clm50BgcCrop/g +s/f19_g16/f19_g17_gl4/g +s/f09_g16/f09_g17_gl4/g diff --git a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst index 806d76d966..e108901b27 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst @@ -25,12 +25,12 @@ Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) | Short Name | Description | Atm. | Compset Alias | Period | | | | Forcing | Name | | +============+==============+===========+=================+================+ -| CLM4.5SP | Satellite | CRUNCEP | 1850CRUCLM45 | 1850 | +| +|version|SP | Satellite | CRUNCEP | 1850CRUCLM45 | 1850 | | | phenology | | | | | | with new | | | | | | biogeophys | | | | +------------+--------------+-----------+-----------------+----------------+ -| CLM4.5SP | New | CRUNCEP | I1850CRUCLM45BGC| 1850 | +| +|version|SP | New | CRUNCEP | I1850Clm50BgcCropCru| 1850 | | | biogeophys | +-----------------+----------------+ | | + CENTURY- | | I20TRCRUCLM45BGC| 20th Century | | | like | | | | @@ -42,7 +42,7 @@ Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) | | nitrogen | | | | | | updates | | | | +------------+--------------+-----------+-----------------+----------------+ -| CLM4.5CN | New | CRUNCEP | I1850CRUCLM45CN | 1850 | +| +|version|CN | New | CRUNCEP | I1850CRUCLM45CN | 1850 | | | biogeophys | | | | | | + CN soil | | | | | | BGC, updates | | | | @@ -74,7 +74,7 @@ Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) | Short Name | Description | Atm. | Compset Alias | Period | | | | Forcing | Name | | +============+===================+===================+=================+========+ -| CLM4.5BGC- | ICRUCLM45BGCCROP | New biogeophys + | CRUNCEP | 2000 | +| +|version|BGC- | ICRUCLM45BGCCROP | New biogeophys + | CRUNCEP | 2000 | | CROP | | CENTURY-like | | | | | | vertically | | | | | | resolved soil | | | @@ -85,7 +85,7 @@ Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) | | | CROP | | | | | | | | | +------------+-------------------+-------------------+-----------------+--------+ -| CLM4.5BGC- | I1850CRUCLM45BGCDV| New biogeophys | CRUNCEP | 1850 | +| +|version|BGC- | I1850Clm50BgcCropCruDV| New biogeophys | CRUNCEP | 1850 | | DV | | + CENTURY-like | | | | | | vertically | | | | | | resolved soil | | | @@ -97,7 +97,7 @@ Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) | | | | | | | | | | | | +------------+-------------------+-------------------+-----------------+--------+ -| CLM4.5SP- | ICLM45VIC | Satellite | Qian | 2000 | +| +|version|SP- | ICLM45VIC | Satellite | Qian | 2000 | | VIC | | phenology with new| | | | | | biogeophys with | | | | | | VIC hydrology | | | @@ -132,9 +132,9 @@ Alias (Long-name with time-period and each component) #. ``I1850CRUCLM45`` (1850_DATM%CRU_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) -#. ``I1850CRUCLM45BGC`` (1850_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) +#. ``I1850Clm50BgcCropCru`` (1850_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) -#. ``I1850CRUCLM45BGCDV`` (1850_DATM%CRU_CLM45%BGCDV_SICE_SOCN_RTM_SGLC_SWAV) +#. ``I1850Clm50BgcCropCruDV`` (1850_DATM%CRU_CLM45%BGCDV_SICE_SOCN_RTM_SGLC_SWAV) #. ``I1850CRUCLM45CN`` (1850_DATM%CRU_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) @@ -142,7 +142,7 @@ Alias (Long-name with time-period and each component) #. ``I1850SPINUPCLM45BGC`` (1850_DATM%S1850_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) -#. ``I1850SPINUPCN`` (1850_DATM%S1850_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) +#. ``I1850Clm50BgcSpinup`` (1850_DATM%S1850_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) #. ``I1PT`` (2000_DATM%1PT_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst index e4cafcf046..4e211894d6 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst @@ -4,7 +4,7 @@ Customizing CLM's Configuration ******************************* -The "Creating a Case" section of the `CESM1.2.0 Scripts User's-Guide `_ gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. +The "Creating a Case" section of the `+|cesmrelease| Scripts User's-Guide `_ gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. For CLM when **preview_namelist**, **$CASE.build**, or **$CASE.run** are called there are two steps that take place: @@ -12,9 +12,9 @@ For CLM when **preview_namelist**, **$CASE.build**, or **$CASE.run** are called 2. The CLM "**build-namelist**" script is called to generate the run-time namelist for CLM (more information on **build-namelist** is given below in `the Section called Definition of Namelist items and their default values `_. -When customizing your case at the *8cesm_setup** step you are able to modify the process by effecting either one or both of these steps. The CLM "**configure**" and "**build-namelist**" scripts are both available in the "models/lnd/clm/bld" directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what types of options you can give either of them. +When customizing your case at the *8cesm_setup** step you are able to modify the process by effecting either one or both of these steps. The CLM "**configure**" and "**build-namelist**" scripts are both available in the "$CTSMROOT/bld" directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what types of options you can give either of them. -There are five different types of customization for the configuration that we will discuss: CLM4.5 in CESM1.2.0 build-time options, CLM4.5 in CESM1.2.0 run-time options, User Namelist, other noteworthy CESM1.2.0 configuration items, the CLM **configure** script options, and the CLM **build-namelist** script options. +There are five different types of customization for the configuration that we will discuss: +|version| in +|cesmrelease| build-time options, +|version| in +|cesmrelease| run-time options, User Namelist, other noteworthy +|cesmrelease| configuration items, the CLM **configure** script options, and the CLM **build-namelist** script options. Information on all of the script, configuration, build and run items is found under ``scripts/ccsm_utils/Case.template`` in the `config_definition.xml `_ file. @@ -51,7 +51,7 @@ CLM_NML_USE_CASE ``CLM_NML_USE_CASE`` is used to set a particular set of conditions that set multiple namelist items, all centering around a particular usage of the model. To list the valid options do the following: :: - > cd models/lnd/clm/doc + > cd $CTSMROOT/doc > ../bld/build-namelist -use_case list The output of the above command is: @@ -109,7 +109,7 @@ CLM_BLDNML_OPTS As with the CLM "configure" script the CLM clm.buildnml.csh may already invoke certain options and as such those options will NOT be available to be set here. The best way to see what options can be sent to the "build-namelist" script is to do :: - > cd models/lnd/clm/bld + > cd $CTSMROOT/bld > ./build-namelist -help Here is the output from the above. @@ -179,7 +179,7 @@ CLM_BLDNML_OPTS -inputdata "filepath" Writes out a list containing pathnames for required input datasets in file specified. - -irrig "value" If .true. turn irrigation on with namelist logical irrigate (for CLM4.5 physics) + -irrig "value" If .true. turn irrigation on with namelist logical irrigate (for +|version| physics) (requires crop to be on in the clm configuration) Seek surface datasets with irrigation turned on. (for CLM4.0 physics) Default: .false. @@ -284,7 +284,7 @@ Hence only the following different options can be set: #. -verbose -"-bgc_spinup" is an option only available for CLM4.5 for any configuration when CN is turned on (so either CLMCN or CLMBGC). It can be set to "on" or "off". If "on" the model will go into Accelerated Decomposition mode, while for "off" (the default) it will have standard decomposition rates. If you are starting up from initial condition files the model will check what mode the initial condition file is in and do the appropriate action on the first time-step to change the Carbon pools to the appropriate spinup setting. See `the Section called Spinning up the CLM4.5 biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for an example using this option. +"-bgc_spinup" is an option only available for +|version| for any configuration when CN is turned on (so either CLMCN or CLMBGC). It can be set to "on" or "off". If "on" the model will go into Accelerated Decomposition mode, while for "off" (the default) it will have standard decomposition rates. If you are starting up from initial condition files the model will check what mode the initial condition file is in and do the appropriate action on the first time-step to change the Carbon pools to the appropriate spinup setting. See `the Section called Spinning up the +|version| biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for an example using this option. "-chk_res" ensures that the resolution chosen is supported by CLM. If the resolution is NOT supported it will cause the CLM **build-namelist** to abort when run. So when either **preview_namelist**, **$CASE.build** or **$CASE.run** is executed it will abort early. Since, the CESM scripts only support certain resolutions anyway, in general this option is NOT needed in the context of running CESM cases. @@ -296,7 +296,7 @@ Hence only the following different options can be set: To see a list of valid variables that you could set do this: :: - > cd models/lnd/clm/doc + > cd $CTSMROOT/doc > ../bld/build-namelist -clm_demand list @@ -317,13 +317,13 @@ When "-irrig" is used **build-namelist** will try to find surface datasets that "-rcp" is used to set the representative concentration pathway for the future scenarios you want the data-sets to simulate conditions for, in the input datasets. To list the valid options do the following: :: - > cd models/lnd/clm/doc + > cd $CTSMROOT/doc > ../bld/build-namelist -rcp list "-sim_year" is used to set the simulation year you want the data-sets to simulate conditions for in the input datasets. The simulation "year" can also be a range of years in order to do simulations with changes in the dataset values as the simulation progresses. To list the valid options do the following: :: - > cd models/lnd/clm/doc + > cd $CTSMROOT/doc > ../bld/build-namelist -sim_year list ``CLM_NAMELIST_OPTS`` @@ -355,7 +355,7 @@ When "-irrig" is used **build-namelist** will try to find surface datasets that For example if your ``CLM_USRDAT_NAME`` will be "1x1_boulderCO", with a "navy" land-mask, constant simulation year range, for 1850, the following will list what your filenames should be: :: - > cd models/lnd/clm/bld + > cd $CTSMROOT/bld > queryDefaultNamelist.pl -usrname "1x1_boulderCO" -options mask=navy,sim_year=1850,sim_year_range="constant" -csmdata $CSMDATA An example of using ``CLM_USRDAT_NAME`` for a simulation is given in `Example 5-4 `_. @@ -464,11 +464,11 @@ Especially with CLMBGC and CLMCN starting from initial conditions is very import Doing a hybrid simulation to provide initial conditions ------------------------------------------------------- -The first option is to setup a hybrid simulation and give a ``RUN_REFCASE`` and ``RUN_REFDATE`` to specify the reference case simulation name to use. When you setup most cases, at the standard resolutions of "f09" or "f19" it will already do this for you. For example, if you run an "I2000CN" compset at "f09_g16" resolution the following settings will already be done for you. +The first option is to setup a hybrid simulation and give a ``RUN_REFCASE`` and ``RUN_REFDATE`` to specify the reference case simulation name to use. When you setup most cases, at the standard resolutions of "f09" or "f19" it will already do this for you. For example, if you run an "I2000CN" compset at "f09_g17_gl4" resolution the following settings will already be done for you. -``./xmlchange RUN_TYPE=hybrid,RUN_REFCASE=I2000CN_f09_g16_c100503,RUN_REFDATE=0001-01-01,GET_REFCASE=TRUE`` +``./xmlchange RUN_TYPE=hybrid,RUN_REFCASE=I2000CN_f09_g17_gl4_c100503,RUN_REFDATE=0001-01-01,GET_REFCASE=TRUE`` -Setting the ``GET_REFCASE`` option to ``TRUE means`` it will copy the files from the: ``$DIN_LOC_ROOT/ccsm4_init/I2000CN_f09_g16_c100503/0001-01-01`` directory. Note, that the ``RUN_REFCASE`` and ``RUN_REFDATE`` variables are expanded to get the directory name above. If you do NOT set ``GET_REFCASE`` to ``TRUE`` then you will need to have placed the file in your run directory yourself. In either case, the file is expected to be named: ``$RUN_REFCASE.clm2.r.$RUN_REFDATE-00000.nc`` with the variables expanded of course. +Setting the ``GET_REFCASE`` option to ``TRUE means`` it will copy the files from the: ``$DIN_LOC_ROOT/ccsm4_init/I2000CN_f09_g17_gl4_c100503/0001-01-01`` directory. Note, that the ``RUN_REFCASE`` and ``RUN_REFDATE`` variables are expanded to get the directory name above. If you do NOT set ``GET_REFCASE`` to ``TRUE`` then you will need to have placed the file in your run directory yourself. In either case, the file is expected to be named: ``$RUN_REFCASE.clm2.r.$RUN_REFDATE-00000.nc`` with the variables expanded of course. ------------------------------------------------------- Doing a branch simulation to provide initial conditions @@ -483,7 +483,7 @@ Providing a finidat file in your user_nl_clm file Setting up a branch or hybrid simulation requires the initial condition file to follow a standard naming convention, and a standard input directory if you use the ``GET_REFCASE`` option. If you want to name your file willy nilly and place it anywhere, you can set it in your ``user_nl_clm`` file as in this example. :: - finidat = '/glade/home/$USER/myinitdata/clmi_I1850CN_f09_g16_0182-01-01.c120329.nc' + finidat = '/glade/home/$USER/myinitdata/clmi_I1850CN_f09_g17_gl4_0182-01-01.c120329.nc' Note, if you provide an initial condition file -- you can NOT set ``CLM_FORCE_COLDSTART`` to ``TRUE``. @@ -530,7 +530,7 @@ If you are running an B, E, or F case that doesn't use the DATM obviously the DA CPLHIST3HrWx ``CLMCRUNCEP`` - The standard mode for CLM4.5 of using global atmospheric data that was developed by CRU using NCEP data from 1901 to 2010. + The standard mode for +|version| of using global atmospheric data that was developed by CRU using NCEP data from 1901 to 2010. See `the Section called CLMCRUNCEP mode and it's DATM settings `_ for more information on the DATM settings for ``CLMCRUNCEP`` mode. ``CLM_QIAN`` @@ -582,9 +582,9 @@ Downloading DATM Forcing Data In Chapter One of the `CESM User's Guide `_ there is a section on "Downloading input data". The normal process of setting up cases will use the "scripts/ccsm_utils/Tools/check_input_data" script to retrieve data from the CESM subversion inputdata repository. This is true for the standard `CLM_QIAN` forcing as well. -The `CLMCRUNCEP` data is uploaded into the subversion inputdata repository as well -- but as it is 1.1 Terabytes of data downloading it is problematic (*IT WILL TAKE SEVERAL DAYS TO DOWNLOAD THE ENTIRE DATASET USING SUBVERSION*). Because of it's size you may also need to download it onto a separate disk space. We have done that on yellowstone for example where it resides in ``$ENV{CESMROOT}/lmwg`` while the rest of the input data resides in ``$ENV{CESMDATAROOT}/inputdata``. The data is also already available on: janus, franklin, and hopper. If you download the data, we recommend that you break your download into several chunks, by setting up a case and setting the year range for ``DATM_CPL_YR_START`` and ``DATM_CPL_YR_END`` in say 20 year sections over 1901 to 2010, and then use **check_input_data** to export the data. +The `CLMCRUNCEP` data is uploaded into the subversion inputdata repository as well -- but as it is 1.1 Terabytes of data downloading it is problematic (*IT WILL TAKE SEVERAL DAYS TO DOWNLOAD THE ENTIRE DATASET USING SUBVERSION*). Because of it's size you may also need to download it onto a separate disk space. We have done that on cheyenne for example where it resides in ``$ENV{CESMROOT}/lmwg`` while the rest of the input data resides in ``$ENV{CESMDATAROOT}/inputdata``. The data is also already available on: janus, franklin, and hopper. If you download the data, we recommend that you break your download into several chunks, by setting up a case and setting the year range for ``DATM_CPL_YR_START`` and ``DATM_CPL_YR_END`` in say 20 year sections over 1901 to 2010, and then use **check_input_data** to export the data. -The ``CPLHIST3HrWx`` DATM forcing data is unique -- because it is large compared to the rest of the input data, and we only have a disk copy on yellowstone. The DATM assumes the path for the previous NCAR machine yellowstone of ``/glade/p/cesm/shared_outputdata/cases/ccsm4/$DATM_CPLHIST_CASE`` for the data. So you will need to change this path in order to run on any other machine. You can download the data itself from NCAR HPSS from ``/CCSM/csm/$DATM_CPLHIST_CASE``. +The ``CPLHIST3HrWx`` DATM forcing data is unique -- because it is large compared to the rest of the input data, and we only have a disk copy on cheyenne. The DATM assumes the path for the previous NCAR machine cheyenne of ``/glade/p/cesm/shared_outputdata/cases/ccsm4/$DATM_CPLHIST_CASE`` for the data. So you will need to change this path in order to run on any other machine. You can download the data itself from NCAR HPSS from ``/CCSM/csm/$DATM_CPLHIST_CASE``. -------------------------------------- Customizing via the build script files @@ -601,7 +601,7 @@ The final thing that the user may wish to do before **cesm_setup** is run is to More information on the CLM configure script -------------------------------------------- -The CLM **configure** script defines the details of a clm configuration and summarizes it into a ``config_cache.xml`` file. The ``config_cache.xml`` will be placed in your case directory under ``Buildconf/clmconf``. The `config_definition.xml `_ in ``models/lnd/clm/bld/config_files`` gives a definition of each CLM configuration item, it is viewable in a web-browser. Many of these items are things that you would NOT change, but looking through the list gives you the valid options, and a good description of each. Below we repeat the ``config_definition.xml`` files contents: +The CLM **configure** script defines the details of a clm configuration and summarizes it into a ``config_cache.xml`` file. The ``config_cache.xml`` will be placed in your case directory under ``Buildconf/clmconf``. The `config_definition.xml `_ in ``$CTSMROOT/bld/config_files`` gives a definition of each CLM configuration item, it is viewable in a web-browser. Many of these items are things that you would NOT change, but looking through the list gives you the valid options, and a good description of each. Below we repeat the ``config_definition.xml`` files contents: Help on CLM configure --------------------- @@ -609,7 +609,7 @@ Help on CLM configure Coupling this with looking at the options to CLM **configure** with "-help" as below will enable you to understand how to set the different options. :: - > cd models/lnd/clm/bld + > cd $CTSMROOT/bld > configure -help The output to the above command is as follows: @@ -632,7 +632,7 @@ The output to the above command is as follows: (default: CLM build directory). -clm4me Turn Methane model: [on | off] Requires bgc=cn/cndv (Carbon Nitrogen model) - (ONLY valid for CLM4.5!) + (ONLY valid for +|version|!) -clm_root Root directory of clm source code (default: directory above location of this script) -cppdefs A string of user specified CPP defines. Appended to @@ -647,12 +647,12 @@ The output to the above command is as follows: Parameters relating to the build which are system dependent will be ignored. -exlaklayers Turn on extra lake layers (25 layers instead of 10) [on | off] - (ONLY valid for CLM4.5!) + (ONLY valid for +|version|!) -help [or -h] Print usage to STDOUT. -nofire Turn off wildfires for BGC setting of CN (default includes fire for CN) -noio Turn history output completely off (typically for testing). - -phys Value of clm4_0 or clm4_5 (default is clm4_0) + -phys Value of clm4_0 or +|version| (default is clm4_0) -silent [or -s] Turns on silent mode - only fatal messages issued. -sitespf_pt Setup for the given site specific single-point resolution. -snicar_frc Turn on SNICAR radiative forcing calculation. [on | off] @@ -676,7 +676,7 @@ The output to the above command is as follows: eliminate inconsistent duplicate soil hydraulic parameters used in soil biogeochem. (requires either CN or CNDV) - (ONLY valid for CLM4.5!) + (ONLY valid for +|version|!) [on,off or colon delimited list of no options] (default off) no-vert Turn vertical soil Carbon profile off no-cent Turn CENTURY off diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst index 131078c648..2300c8ad60 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst @@ -16,16 +16,16 @@ Definition of Namelist items and their default values Here we point to you where you can find the definition of each namelist item and separately the default values for them. The default values may change depending on the resolution, land-mask, simulation-year and other attributes. Both of these files are viewable in your web browser, and then expand each in turn. -1. `Definition of Namelists Relevant for CLM4.5 `_ +1. `Definition of Namelists Relevant for +|version| `_ 2. `Default values of each CLM4.0 Namelist Item `_ -3. `Default values of each CLM4.5 Namelist Item `_ +3. `Default values of each +|version| Namelist Item `_ List of fields that can be added to your output history files by namelist ------------------------------------------------------------------------- -One set of the namelist items allows you to add fields to the output history files: ``hist_fincl1``, ``hist_fincl2``, ``hist_fincl3``, ``hist_fincl4``, ``hist_fincl5``, and ``hist_fincl6``. The following links for `CLM4.0 History Fields `_ and `CLM4.5 History Fields `_ documents all of the history fields available and gives the long-name and units for each. The table below lists all the CLM4.5 history fields. +One set of the namelist items allows you to add fields to the output history files: ``hist_fincl1``, ``hist_fincl2``, ``hist_fincl3``, ``hist_fincl4``, ``hist_fincl5``, and ``hist_fincl6``. The following links for `CLM4.0 History Fields `_ and `+|version| History Fields `_ documents all of the history fields available and gives the long-name and units for each. The table below lists all the +|version| history fields. Definition of CLM history variables ----------------------------------- @@ -53,7 +53,7 @@ Below we will give examples of user namelists that activate different commonly u The default namelist -------------------- -Here we give the default namelist as it would be created for an "I1850CRUCLM45BGC" compset at 0.9x1.25 resolution with a gx1v6 land-mask on yellowstone. To edit the namelist you would edit the ``user_nl_clm`` user namelist with just the items you want to change. For simplicity we will just show the CLM namelist and NOT the entire file. In the sections below, for simplicity we will just show the user namelist (``user_nl_clm``) that will add (or modify existing) namelist items to the namelist. +Here we give the default namelist as it would be created for an "I1850Clm50BgcCropCru" compset at 0.9x1.25 resolution with a gx1v6 land-mask on cheyenne. To edit the namelist you would edit the ``user_nl_clm`` user namelist with just the items you want to change. For simplicity we will just show the CLM namelist and NOT the entire file. In the sections below, for simplicity we will just show the user namelist (``user_nl_clm``) that will add (or modify existing) namelist items to the namelist. Example 1-2. Default CLM Namelist --------------------------------- @@ -66,7 +66,7 @@ Example 1-2. Default CLM Namelist create_crop_landunit = .false. dtime = 1800 fatmlndfrc = '/glade/p/cesm/cseg/inputdata/share/domains/domain.lnd.fv0.9x1.25_gx1v6.090309.nc' - finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I1850CRUCLM45BGC.0241-01-01.0.9x1.25_g1v6_simyr1850_c130531.nc' + finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru.0241-01-01.0.9x1.25_g1v6_simyr1850_c130531.nc' fpftcon = '/glade/p/cesm/cseg/inputdata/lnd/clm2/pftdata/pft-physiology.c130503.nc' fsnowaging = '/glade/p/cesm/cseg/inputdata/lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc' fsnowoptics = '/glade/p/cesm/cseg/inputdata/lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc' diff --git a/doc/source/users_guide/testing/testing.rst b/doc/source/users_guide/testing/testing.rst index 91db57fc70..d41124f8ba 100644 --- a/doc/source/users_guide/testing/testing.rst +++ b/doc/source/users_guide/testing/testing.rst @@ -20,37 +20,37 @@ CIME Testing scripts We first introduce the test scripts that work for all CESM components. The CIME script **create_test** runs a specific type of test, at a given resolution, for a given compset using a given machine. There is a list of different tests, but the "ERI" tests do several things at once, running from startup, as well as doing exact branch and restart tests. -So to run "ERI" testing at 2-degree with the I1850CRUCLM45 compset on yellowstone_intel you do the following. +So to run "ERI" testing at 2-degree with the I1850CRUCLM45 compset on cheyenne_intel you do the following. :: > cd scripts - > ./create_test -testname ERI.f19_g16.I1850CRUCLM45.yellowstone_intel - > cd ERI.f19_g16.I1850CRUCLM45.yellowstone_intel.$id - > ./ERI.f19_g16.I1850CRUCLM45.yellowstone_intel.$id.build - > ERI.f19_g16.I1850CRUCLM45.yellowstone_intel.$id.submit + > ./create_test -testname ERI.f19_g17_gl4.I1850CRUCLM45.cheyenne_intel + > cd ERI.f19_g17_gl4.I1850CRUCLM45.cheyenne_intel.$id + > ./ERI.f19_g17_gl4.I1850CRUCLM45.cheyenne_intel.$id.build + > ERI.f19_g17_gl4.I1850CRUCLM45.cheyenne_intel.$id.submit When the test is done it will update the file TestStatus with either a PASS or FAIL message. -We already have a standard list of tests for clm (the "aux_clm" list of tests). To run the CLM yellowstone intel compiler test list, for the same machine and compiler you would do the following: +We already have a standard list of tests for clm (the "aux_clm" list of tests). To run the CLM cheyenne intel compiler test list, for the same machine and compiler you would do the following: :: > cd scripts - > ./create_test -xml_mach yellowstone -xml_compiler intel -xml_category aux_clm -mach yellowstone -compiler intel + > ./create_test -xml_mach cheyenne -xml_compiler intel -xml_category aux_clm -mach cheyenne -compiler intel # Normally it will submit the jobs as they are ready, but if it's interrupted you # may need to submit by hand as follows... # Submit the suite of tests (note $id refers to the integer job number for this job) - > ./cs.submit.$id.yellowstone + > ./cs.submit.$id.cheyenne # Later check the tests with... > ./cs.status.$id # The above will give a PASS or FAIL message for each test. -For more information on doing testing with the CESM scripts see the `CESM1.2.0 User's Guide `_ on testing. +For more information on doing testing with the CESM scripts see the `+|cesmrelease| User's Guide `_ on testing. Testing PTCLM ============= There is a simple test script for PTCLM called ``testcases.csh`` in the PTCLM directory (``scripts/ccsm_utils/Tools/lnd/clm/PTCLM``). -The test script is setup to run on the machines: yellowstone, frankfurt, yong, and titan. +The test script is setup to run on the machines: cheyenne, frankfurt, yong, and titan. You simply run the script interactively. The script will write out the status of tests to a file called: ``tc.job#.status``. diff --git a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst index 5a2fb07192..625865b7c1 100644 --- a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst +++ b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst @@ -18,7 +18,7 @@ Setup Problems The first type of problem happens when you invoke the **case.setup** command. This indicates there is something wrong with your input datasets, or the details of what you are trying to setup the model to do. -There's also a trouble-shooting chapter in the `CESM1.2.0 Scripts User's Guide `_. +There's also a trouble-shooting chapter in the `+|cesmrelease| Scripts User's Guide `_. Many of the problems with configuration can be resolved with the guidelines given there. Here we will restrict ourselves to problems from the input files. @@ -27,7 +27,7 @@ Example: Missing datasets :: > ./create_newcase -case ne60rcp6 -res ne60_g16 -compset IRCP60CN \ - -mach yellowstone_intel + -mach cheyenne_intel > ./case.setup The following is what is displayed to the screen. @@ -100,7 +100,7 @@ Below we show the log file results of a job that aborted while running. Sun Jun 20 18:24:35 MDT 2010 -- CSM EXECUTION HAS FINISHED Model did not complete - see /ptmp/erik/test_run/run/cpl.log.100620-182358 -In the next section we will talk about using the different log files to track down problems, and find out where the problem is coming from. In the section after that we give some general advice on debugging problems and some suggestions on ideas that may be helpful to track the problem down. Some of the examples below are from the `models/lnd/clm/doc/KnownBugs `_ file. +In the next section we will talk about using the different log files to track down problems, and find out where the problem is coming from. In the section after that we give some general advice on debugging problems and some suggestions on ideas that may be helpful to track the problem down. Some of the examples below are from the `$CTSMROOT/doc/KnownBugs `_ file. Tracking Problems by Querying Log Files --------------------------------------- @@ -146,10 +146,10 @@ For example, here is some output from an older version of CESM (CESM1.0.2) where NODE# NAME ( 0) be1105en.ucar.edu - "/gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/lnd/clm/src/riverroute/RtmMod.F90", line + "/gpfs/proj2/fis/cgd/home/erik/clm_trunk/$CTSMROOT/src/riverroute/RtmMod.F90", line 239: 1525-155 The file name provided in the OPEN statement for unit 1 has zero length or contains all blanks. The program will recover by ignoring the OPEN statement. - "/gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/lnd/clm/src/riverroute/RtmMod.F90", line + "/gpfs/proj2/fis/cgd/home/erik/clm_trunk/$CTSMROOT/src/riverroute/RtmMod.F90", line 241: 1525-001 The READ statement on the file fort.1 cannot be completed because the end of the file was reached. The program will stop. @@ -291,12 +291,12 @@ The CLM log file Of course when you are working with and making changes to CLM, most of your focus will be on the CLM log file and the errors it shows. As already pointed out if you don't see errors in the ``lnd.log.*`` file you should look in the ``cesm.log.*`` to see if any errors showed up there. -Here's an example of the ``lnd.log.*`` file when running ``PTS_MODE`` with initial conditions (this is bug 1025 in the `models/lnd/clm/doc/KnownLimitationss `_ file). +Here's an example of the ``lnd.log.*`` file when running ``PTS_MODE`` with initial conditions (this is bug 1025 in the `$CTSMROOT/doc/KnownLimitationss `_ file). :: Successfully initialized variables for accumulation - reading restart file I2000CN_f09_g16_c100503.clm2.r.0001-01-01-00000.nc + reading restart file I2000CN_f09_g17_gl4_c100503.clm2.r.0001-01-01-00000.nc Reading restart dataset ERROR - setlatlon.F:Cant get variable dim for lat or lsmlat ENDRUN: called without a message string @@ -319,7 +319,7 @@ Here's an example of a problem that occurs when the wrong prescribed aerosol fil The batch log files ------------------- -The names of the batch log files will depend on the batch system of the machine that is being used. They will normally be in the script directory. Usually, they don't contain important information, but they are a last resort place to look for error messages. On the NCAR system "yellowstone" the batch files are called with names that start with the batch submission script and then either "stderr.o" or "stdout.o", with the job number at the end. +The names of the batch log files will depend on the batch system of the machine that is being used. They will normally be in the script directory. Usually, they don't contain important information, but they are a last resort place to look for error messages. On the NCAR system "cheyenne" the batch files are called with names that start with the batch submission script and then either "stderr.o" or "stdout.o", with the job number at the end. General Advice on Debugging Run time Problems ============================================= diff --git a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst index ec626641e5..774e4651e6 100644 --- a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst @@ -106,7 +106,7 @@ More details on each environment variable. .. note:: There are several files that are copies of the original files from either models``/lnd/clm/src/util_share``, ``models/csm_share/shr``, or copies from other tool directories. By having copies the tools can all be made stand-alone, but any changes to the originals will have to be put into the tool directories as well. -The *README.filecopies* (which can be found in ``models/lnd/clm/tools``) is repeated here. +The *README.filecopies* (which can be found in ``$CTSMROOT/tools``) is repeated here. -.. include:: ../../clm5.0/tools/README.filecopies +.. include:: ../../+|version|/tools/README.filecopies :literal: diff --git a/doc/source/users_guide/using-clm-tools/cprnc.rst b/doc/source/users_guide/using-clm-tools/cprnc.rst index e921858b4c..53169513f0 100644 --- a/doc/source/users_guide/using-clm-tools/cprnc.rst +++ b/doc/source/users_guide/using-clm-tools/cprnc.rst @@ -26,4 +26,4 @@ Options: See the **cprnc** `README `_ file for more details. -.. note:: To compare files with OUT a time axis you can use the **cprnc.ncl** NCL script in ``models/lnd/clm/tools/shared/ncl_scripts``. It won't give you the details on the differences but will report if the files are identical or different. +.. note:: To compare files with OUT a time axis you can use the **cprnc.ncl** NCL script in ``$CTSMROOT/tools/ncl_scripts``. It won't give you the details on the differences but will report if the files are identical or different. diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index 332aa5bd65..006c6b679b 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -15,7 +15,7 @@ SCRIP grid files for all the standard model resolutions and the raw surface data Using mknocnmap.pl to create grid and maps for single-point regional grids -------------------------------------------------------------------------- -If you want to create a regular latitude/longitude single-point or regional grid, we suggest you use **mknoocnmap.pl** in ``models/lnd/clm/tools/shared/mkmapdata`` which will create both the SCRIP grid file you need (using ``models/lnd/clm/tools/shared/mkmapgrids/mkscripgrid.ncl`` AND an identity mapping file assuming there is NO ocean in your grid domain. If you HAVE ocean in your domain you could modify the mask in the SCRIP grid file for ocean, and then use **ESMF_RegridWeightGen** to create the mapping file, and **gen_domain** to create the domain file. Like other tools, ``shared/mkmapdata/mknoocnmap.pl`` has a help option with the following: +If you want to create a regular latitude/longitude single-point or regional grid, we suggest you use **mknoocnmap.pl** in ``$CTSMROOT/tools/mkmapdata`` which will create both the SCRIP grid file you need (using ``$CTSMROOT/tools/mkmapgrids/mkscripgrid.ncl`` AND an identity mapping file assuming there is NO ocean in your grid domain. If you HAVE ocean in your domain you could modify the mask in the SCRIP grid file for ocean, and then use **ESMF_RegridWeightGen** to create the mapping file, and **gen_domain** to create the domain file. Like other tools, ``./mkmapdata/mknoocnmap.pl`` has a help option with the following: :: SYNOPSIS @@ -43,20 +43,20 @@ See `Figure 2-5 `_ for a visual representation of this process. ``mkmapdata.sh`` uses the above SCRIP grid input files to create SCRIP mapping data files (uses ESMF). -The bash shell script ``models/lnd/clm/tools/shared/mkmapgrids/mkmapdata.sh`` uses **ESMF_RegridWeightGen** to create a list of maps from the raw datasets that are input to **mksurfdata_map**. +The bash shell script ``$CTSMROOT/tools/mkmapgrids/mkmapdata.sh`` uses **ESMF_RegridWeightGen** to create a list of maps from the raw datasets that are input to **mksurfdata_map**. Each dataset that has a different grid, or land-mask needs a different mapping file for it, but many different raw datasets share the same grid/land-mask as other files. Hence, there doesn't need to be a different mapping file for EACH raw dataset -- just for each DIFFERENT raw dataset. See `Figure 2-3 `_ for a visual representation of how this works. The bash script figures out which mapping files it needs to create and then runs **ESMF_RegridWeightGen** for each one. You can then either enter the datasets into the XML database (see `Chapter 3 `_ or leave the files in place, and use the "-res usrspec -usr_gname -usr_gdate" options to **mksurfdata_map** (see `the Section called Running mksurfdata.pl `_ below). -Use the "-phys" option to specify if you are creating mapping files for clm4_0 or clm4_5 (the list of raw datafiles is somewhat different between the two). +Use the "-phys" option to specify if you are creating mapping files for clm4_0 or +|version| (the list of raw datafiles is somewhat different between the two). mkmapdata.sh has a help option with the following :: - ../../tools/shared/mkmapdata/mkmapdata.sh + ../../tools/mkmapdata/mkmapdata.sh ********************** - usage on yellowstone: + usage on cheyenne: ./mkmapdata.sh valid arguments: @@ -74,8 +74,8 @@ mkmapdata.sh has a help option with the following Model output grid type supported values are [regional,global], (default is global) [-p|--phys ] - Whether to generate mapping files for clm4_0 or clm4_5 - supported values are [clm4_0,clm4_5], (default is clm4_5) + Whether to generate mapping files for clm4_0 or +|version| + supported values are [clm4_0,+|version|], (default is +|version|) [-b|--batch] Toggles batch mode usage. If you want to run in batch mode @@ -107,7 +107,7 @@ mkmapdata.sh has a help option with the following ********************** -.. warning:: Make sure you specify with the "-phys" option if you are creating files for CLM4.0! The default is CLM4.5. +.. warning:: Make sure you specify with the "-phys" option if you are creating files for CLM4.0! The default is +|version|. Figure 2-3. Details of running mkmapdata.sh ------------------------------------------- diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index d1ab21e2b7..8f43d8ac0a 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -25,7 +25,7 @@ Creating a Complete Set of Files for Input to CLM 1. Create SCRIP grid datasets (if NOT already done) - First you need to create a descriptor file for your grid, that includes the locations of cell centers and cell corners. There is also a "mask" field, but in this case the mask is set to one everywhere (i.e. all of the masks for the output model grid are "nomask"). An example SCRIP grid file is: $CSMDATA/lnd/clm2/mappingdata/grids/SCRIPgrid_10x15_nomask_c110308.nc. The mkmapgrids and mkscripgrid.ncl NCL script in the models/lnd/clm/tools/shared/mkmapgrids directory can help you with this. SCRIP grid files for all the standard CLM grids are already created for you. See the Section called Creating an output SCRIP grid file at a resolution to run the model on for more information on this. + First you need to create a descriptor file for your grid, that includes the locations of cell centers and cell corners. There is also a "mask" field, but in this case the mask is set to one everywhere (i.e. all of the masks for the output model grid are "nomask"). An example SCRIP grid file is: $CSMDATA/lnd/clm2/mappingdata/grids/SCRIPgrid_10x15_nomask_c110308.nc. The mkmapgrids and mkscripgrid.ncl NCL script in the $CTSMROOT/tools/mkmapgrids directory can help you with this. SCRIP grid files for all the standard CLM grids are already created for you. See the Section called Creating an output SCRIP grid file at a resolution to run the model on for more information on this. 2. Create domain dataset (if NOT already done) @@ -33,11 +33,11 @@ Creating a Complete Set of Files for Input to CLM 3. Create mapping files for mksurfdata_map (if NOT already done) - Create mapping files for mksurfdata_map with mkmapdata.sh in models/lnd/clm/tools/shared/mkmapdata. See the Section called Creating mapping files that mksurfdata_map will use for more information on this. + Create mapping files for mksurfdata_map with mkmapdata.sh in $CTSMROOT/tools/mkmapdata. See the Section called Creating mapping files that mksurfdata_map will use for more information on this. 4. Create surface datasets - Next use mksurfdata_map to create a surface dataset, using the mapping datasets created on the previous step as input. There is a version for either clm4_0 or clm4_5 for this program. See the Section called Using mksurfdata_map to create surface datasets from grid datasets for more information on this. + Next use mksurfdata_map to create a surface dataset, using the mapping datasets created on the previous step as input. There is a version for either clm4_0 or +|version| for this program. See the Section called Using mksurfdata_map to create surface datasets from grid datasets for more information on this. 5. Create some sort of initial condition dataset @@ -49,19 +49,19 @@ Creating a Complete Set of Files for Input to CLM b. Use interpinic to interpolate existing initial condition datasets - The next option is to interpolate from spunup datasets at a different resolution, using interpinic. There is a version for either clm4_0 or clm4_5 for this program. See the Section called Using interpinic to interpolate initial conditions to different resolutions for more information on this. + The next option is to interpolate from spunup datasets at a different resolution, using interpinic. There is a version for either clm4_0 or +|version| for this program. See the Section called Using interpinic to interpolate initial conditions to different resolutions for more information on this. c. Start up from arbitrary initial conditions - The last alternative is to run from arbitrary initial conditions without using any spun-up datasets. This is inappropriate when using CLM4.5-BGC or CLMCN (bgc=cn or cndv) as it takes a long time to spinup Carbon pools. + The last alternative is to run from arbitrary initial conditions without using any spun-up datasets. This is inappropriate when using +|version|-BGC or CLMCN (bgc=cn or cndv) as it takes a long time to spinup Carbon pools. .. warning:: This is NOT recommended as many fields in CLM take a long time to equilibrate. 6. Enter the new datasets into the build-namelist XML database The last optional thing to do is to enter the new datasets into the build-namelist XML database. See Chapter 3 for more information on doing this. This is optional because the user may enter these files into their namelists manually. The advantage of entering them into the database is so that they automatically come up when you create new cases. -The ``models/lnd/clm/tools/README`` goes through the complete process for creating input files needed to run CLM. We repeat that file here: +The ``$CTSMROOT/tools/README`` goes through the complete process for creating input files needed to run CLM. We repeat that file here: -.. include:: ../../clm5.0/tools/README +.. include:: ../../+|version|/tools/README :literal: diff --git a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst index e71c97cf3d..4bb40f21c6 100644 --- a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst @@ -5,28 +5,28 @@ ======================== There are several tools provided with CLM that allow you to create your own input datasets at resolutions you choose, or to interpolate initial conditions to a different resolution, or used to compare CLM history files between different cases. -The tools are all available in the ``models/lnd/clm/tools`` directory. -Most of the tools are FORTRAN stand-alone programs in their own directory, but there is also a suite of NCL scripts in the ``shared/ncl_scripts`` directory, and some of the tools are scripts that may also call the ESMF regridding program. +The tools are all available in the ``$CTSMROOT/tools`` directory. +Most of the tools are FORTRAN stand-alone programs in their own directory, but there is also a suite of NCL scripts in the ``./ncl_scripts`` directory, and some of the tools are scripts that may also call the ESMF regridding program. Some of the NCL scripts are very specialized and not meant for general use, and we won't document them here. They still contain documentation in the script itself and the README file in the tools directory. -The tools are divided into three directories for three categories: clm4_0, clm4_5, and shared. -The first two are of course for tools that are designed to work with either the CLM4.0 or CLM4.5 versions of the model. +The tools are divided into three directories for three categories: clm4_0, +|version|, and shared. +The first two are of course for tools that are designed to work with either the CLM4.0 or +|version| versions of the model. The last one are shared utilities that can be used by either, or have a "-phys" option so you can specify which version you want to use. The list of generally important scripts and programs are as follows. 1. *tools/cprnc* (relative to top level directory) to compare NetCDF files with a time axis. -#. *shared/mkmapgrids* to create SCRIP grid data files from old CLM format grid files that can then be used to create new CLM datasets (deprecated). There is also a NCL script (``shared/mkmapgrids/mkscripgrid.ncl`` to create SCRIP grid files for regular latitude/longitude grids. +#. *./mkmapgrids* to create SCRIP grid data files from old CLM format grid files that can then be used to create new CLM datasets (deprecated). There is also a NCL script (``./mkmapgrids/mkscripgrid.ncl`` to create SCRIP grid files for regular latitude/longitude grids. -#. *shared/mkmapdata* to create SCRIP mapping data file from SCRIP grid files (uses ESMF). +#. *./mkmapdata* to create SCRIP mapping data file from SCRIP grid files (uses ESMF). -#. *shared/gen_domain* to create a domain file for datm from a mapping file. The domain file is then used by BOTH datm AND CLM to define the grid and land-mask. +#. *./gen_domain* to create a domain file for datm from a mapping file. The domain file is then used by BOTH datm AND CLM to define the grid and land-mask. -#. *mksurfdata_map* to create surface datasets from grid datasets (clm4_0 and clm4_5 versions). +#. *mksurfdata_map* to create surface datasets from grid datasets (clm4_0 and +|version| versions). -#. *shared/mkprocdata_map* to interpolate output unstructured grids (such as the CAM HOMME dy-core "ne" grids like ne30np4) into a 2D regular lat/long grid format that can be plotted easily. Can be used by either clm4_0 or clm4_5. +#. *./mkprocdata_map* to interpolate output unstructured grids (such as the CAM HOMME dy-core "ne" grids like ne30np4) into a 2D regular lat/long grid format that can be plotted easily. Can be used by either clm4_0 or +|version|. In the sections to come we will go into detailed description of how to use each of these tools in turn. First, however we will discuss the common environment variables and options that are used by all of the FORTRAN tools. @@ -56,9 +56,9 @@ Namelists that you create should be similar to the example namelist. The namelist values are also documented along with the other namelists in the: :: - models/lnd/clm/bld/namelist_files/namelist_definition.xml`` file + $CTSMROOT/bld/namelist_files/namelist_definition.xml`` file and default values in the: - models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml`` file. + $CTSMROOT/bld/namelist_files/namelist_defaults_clm_tools.xml`` file. ----------------------------------------------- Running FORTRAN tools with command line options @@ -75,14 +75,14 @@ Running FORTRAN tools built with SMP=TRUE When you enable ``SMP=TRUE`` on your build of one of the tools that make use of it, you are using OpenMP for shared memory parallelism (SMP). In SMP loops are run in parallel with different threads run on different processors all of which access the same memory (called on-node). Thus you can only usefully run up to the number of processors that are available on a single-node of the machine you are running on. -For example, on the NCAR machine yellowstone there are 16 processors per node, but the SMT hardware on the machine allows you to submit twice as many threads or 32 threads. +For example, on the NCAR machine cheyenne there are 16 processors per node, but the SMT hardware on the machine allows you to submit twice as many threads or 32 threads. --------- Using NCL --------- -In the tools directory ``models/lnd/clm/tools/shared/ncl_scripts`` and in a few other locations there are scripts that use NCAR Command Language (NCL). +In the tools directory ``$CTSMROOT/tools/ncl_scripts`` and in a few other locations there are scripts that use NCAR Command Language (NCL). Unlike the FORTRAN tools, you will need to get a copy of NCL in order to use them. You also won't have to build an executable in order to use them, hence no Makefile is provided. NCL is provided for free download as either binaries or source code from: `http://www.ncl.ucar.edu/ `_. From 518d92c09fcfc7ad85eaa37715bf2d804ea09097 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 14 Jun 2018 15:08:14 -0600 Subject: [PATCH 0184/1973] Straighten out some of the issues from the global sed script --- .../users_guide/overview/getting-help.rst | 12 +- .../users_guide/overview/quickstart.rst | 2 +- ...LM5.0-biogeochemistry-(CLMBGC-spinup).rst} | 0 .../running-special-cases/index.rst | 2 +- .../choosing-a-compset.rst | 282 ------------------ .../building-the-clm-tools.rst | 2 +- .../creating-surface-datasets.rst | 2 +- 7 files changed, 10 insertions(+), 292 deletions(-) rename doc/source/users_guide/running-special-cases/{CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst => CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst} (100%) diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst index 42df1b989a..f78349e1ff 100644 --- a/doc/source/users_guide/overview/getting-help.rst +++ b/doc/source/users_guide/overview/getting-help.rst @@ -33,17 +33,17 @@ The main CLM web page contains information on the CLM, it's history, developers, Also note that several of the XML database files can be viewed in a web browser to get a nice table of namelist options, namelist defaults, or compsets. Simply view them as a local file and bring up one of the following files: - `$CTSMROOT/bld/namelist_files/namelist_definition_clm4_0.xml `_ -- definition of CLM4.0 namelist items. -- `$CTSMROOT/bld/namelist_files/namelist_definition_+|version|.xml `_ -- definition of CLM4.0 namelist items. +- `$CTSMROOT/bld/namelist_files/namelist_definition_clm4_5.xml `_ -- definition of CLM4.5/CLM5.0 namelist items. - `$CTSMROOT/bld/namelist_files/namelist_defaults_clm4_0.xml `_ -- default values for CLM4.0 namelist items. -- `$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|.xml `_ -- default values for +|version| namelist items. +- `$CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5.xml `_ -- default values for CLM4.5/CLM5.0 namelist items. - `scripts/ccsm_utils/Case.template/config_definition.xml `_ -- definition of all env_*.xml items. - `scripts/ccsm_utils/Case.template/config_compsets.xml `_ -- definition of all the compsets. - `$CTSMROOT/bld/namelist_files/history_fields_clm4_0.xml `_ -- definition of CLM4.0 history fields. -- `$CTSMROOT/bld/namelist_files/history_fields_+|version|.xml `_ -- definition of +|version| history fields. +- `$CTSMROOT/bld/namelist_files/history_fields_clm4_5.xml `_ -- definition of CLM4.5/CLM5.0 history fields. ------------------------- +---------------------------- Reporting bugs in +|version| ------------------------- +---------------------------- If you have any problems, additional questions, bug reports, or any other feedback, please send an email to <`cesmhelp@cgd.ucar.edu `_>. If you find bad, wrong, or misleading information in this users guide send an email to <`erik@ucar.edu `_>. The current list of known issues for +|version| in +|cesmrelease| is in the $CTSMROOT/doc/KnownBugs file, and the list of issues for +|cesmrelease| is at... `http://www.cesm.ucar.edu/models/cesm1.2//tags/+|cesmrelease|/#PROBLEMS `_. @@ -64,7 +64,7 @@ CLM CLMBGC Community Land Model (+|version|) with BGC Biogeochemistry. Uses CN Biogeochemistry with vertically resolved soil Carbon, CENTURY model like pools, and Nitrification/De-Nitrification. The CLM_CONFIG_OPTS option for this is - ``./xmlchange CLM_CONFIG_OPTS="phys +|version| -bgc cn -vsoilc_centbgc on -clm4me on"`` + ``./xmlchange CLM_CONFIG_OPTS="phys clm5_0 -bgc cn -vsoilc_centbgc on -clm4me on"`` CLMCN Community Land Model (CLM) with Carbon Nitrogen (CN) Biogeochemistry (either CLM4.0 or +|version|) The CLM_CONFIG_OPTS option for this is diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst index 3091595c68..fa62be5422 100644 --- a/doc/source/users_guide/overview/quickstart.rst +++ b/doc/source/users_guide/overview/quickstart.rst @@ -33,5 +33,5 @@ Note other directories have README files that explain different components and t The Quickstart.GUIDE (which can be found in ``$CTSMROOT/doc``) is repeated here. -.. include:: ../../+|version|/doc/Quickstart.GUIDE +.. include:: ../../clm5.0/doc/Quickstart.GUIDE :literal: diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst similarity index 100% rename from doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM4.5-biogeochemistry-(CLMBGC-spinup).rst rename to doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst diff --git a/doc/source/users_guide/running-special-cases/index.rst b/doc/source/users_guide/running-special-cases/index.rst index 95231e9041..693c83d550 100644 --- a/doc/source/users_guide/running-special-cases/index.rst +++ b/doc/source/users_guide/running-special-cases/index.rst @@ -16,7 +16,7 @@ Running Special Cases running-the-prognostic-crop-model.rst running-with-irrigation.rst CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst - CLM-4.4-Spinning-up-the-+|version|-biogeochemistry-(CLMBGC-spinup).rst + CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst diff --git a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst index e108901b27..38bfcd7da1 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst @@ -19,293 +19,11 @@ Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) `Supported CLM Configurations `_ are listed in `Table 1-1 `_ for the Scientifically Supported compsets (have been scientifically validated with long simulations) and in `Table 1-2 `_ for the Functionally Supported compsets (we've only checked that they function). -**Scientifically Supported I Compsets:** - -+------------+--------------+-----------+-----------------+----------------+ -| Short Name | Description | Atm. | Compset Alias | Period | -| | | Forcing | Name | | -+============+==============+===========+=================+================+ -| +|version|SP | Satellite | CRUNCEP | 1850CRUCLM45 | 1850 | -| | phenology | | | | -| | with new | | | | -| | biogeophys | | | | -+------------+--------------+-----------+-----------------+----------------+ -| +|version|SP | New | CRUNCEP | I1850Clm50BgcCropCru| 1850 | -| | biogeophys | +-----------------+----------------+ -| | + CENTURY- | | I20TRCRUCLM45BGC| 20th Century | -| | like | | | | -| | vertically | | | | -| | resolved | | | | -| | soil | | | | -| | BGC + CH4 | | | | -| | emissions, | | | | -| | nitrogen | | | | -| | updates | | | | -+------------+--------------+-----------+-----------------+----------------+ -| +|version|CN | New | CRUNCEP | I1850CRUCLM45CN | 1850 | -| | biogeophys | | | | -| | + CN soil | | | | -| | BGC, updates | | | | -+------------+--------------+-----------+-----------------+----------------+ -| CLM4SP | As in | Qian | I1850 | 1850 | -| | CCSM4/CESM1 | +-----------------+----------------+ -| | release | | I | 2000 | -| | | +-----------------+----------------+ -| | | | I20TR | 20th Century | -+------------+--------------+-----------+-----------------+----------------+ -| CLM4CN | As in | Qian | I1850CN | 1850 | -| | CCSM4/CESM1 | +-----------------+----------------+ -| | release | | ICN | 2000 | -| | | +-----------------+----------------+ -| | | | I20TRCN | 20th Century | -| | | +-----------------+----------------+ -| | | | IRCP26CN | RCP 2.6 to 2100| -| | | +-----------------+----------------+ -| | | | IRCP45CN | RCP 4.5 to 2100| -| | | +-----------------+----------------+ -| | | | IRCP60CN | RCP 6.0 to 2100| -| | | +-----------------+----------------+ -| | | | IRCP85CN | RCP 8.5 to 2100| -+------------+--------------+-----------+-----------------+----------------+ - -**Functionally Supported I Compsets:** - -+------------+-------------------+-------------------+-----------------+--------+ -| Short Name | Description | Atm. | Compset Alias | Period | -| | | Forcing | Name | | -+============+===================+===================+=================+========+ -| +|version|BGC- | ICRUCLM45BGCCROP | New biogeophys + | CRUNCEP | 2000 | -| CROP | | CENTURY-like | | | -| | | vertically | | | -| | | resolved soil | | | -| | | BGC + CH4 | | | -| | | emissions, | | | -| | | nitrogen updates | | | -| | | with prognostic | | | -| | | CROP | | | -| | | | | | -+------------+-------------------+-------------------+-----------------+--------+ -| +|version|BGC- | I1850Clm50BgcCropCruDV| New biogeophys | CRUNCEP | 1850 | -| DV | | + CENTURY-like | | | -| | | vertically | | | -| | | resolved soil | | | -| | | BGC + CH4 | | | -| | | emissions, | | | -| | | nitrogen updates | | | -| | | with DV | | | -| | | | | | -| | | | | | -| | | | | | -+------------+-------------------+-------------------+-----------------+--------+ -| +|version|SP- | ICLM45VIC | Satellite | Qian | 2000 | -| VIC | | phenology with new| | | -| | | biogeophys with | | | -| | | VIC hydrology | | | -+------------+-------------------+-------------------+-----------------+--------+ -|CLM4CN-CROP | ICNCROP | As in CCSM4/CESM1 | Qian | 2000 | -| | | release | | | -+------------+-------------------+-------------------+-----------------+--------+ -|CLM4CN-DV | ICNDV | As in CCSM4/CESM1 | Qian | 1850 | -| | | release | | | -+------------+-------------------+-------------------+-----------------+--------+ - Here is the entire list of compsets available. Note that using the "-user_compset" option even more combinations are possible. In the list below we give the alias name and then the long name which describes each component in parenthesis. Alias (Long-name with time-period and each component) -1. ``I`` (2000_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850`` (1850_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850CLM45`` (1850_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850CLM45BGC`` (1850_DATM%QIA_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850CLM45CN`` (1850_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850CLM45CNF`` (1850_DATM%QIA_CLM45%CN_SICE_SOCN_RTM%FLOOD_SGLC_SWAV) - -#. ``I1850CN`` (1850_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850CRU`` (1850_DATM%CRU_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850CRUCLM45`` (1850_DATM%CRU_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850Clm50BgcCropCru`` (1850_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850Clm50BgcCropCruDV`` (1850_DATM%CRU_CLM45%BGCDV_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850CRUCLM45CN`` (1850_DATM%CRU_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850CRUCN`` (1850_DATM%CRU_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850SPINUPCLM45BGC`` (1850_DATM%S1850_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1850Clm50BgcSpinup`` (1850_DATM%S1850_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1PT`` (2000_DATM%1PT_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I1PTCLM45`` (2000_DATM%1PT_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TR`` (20TR_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TRCLM45`` (20TR_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TRCLM45CN`` (20TR_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TRCN`` (20TR_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TRCRU`` (20TR_DATM%CRU_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TRCRUCLM45`` (20TR_DATM%CRU_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TRCRUCLM45BGC`` (20TR_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TRCRUCLM45CN`` (20TR_DATM%CRU_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I20TRCRUCN`` (20TR_DATM%CRU_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I4804`` (4804_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I4804CLM45`` (4804_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I4804CLM45CN`` (4804_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``I4804CN`` (4804_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45`` (2000_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45BGC`` (2000_DATM%QIA_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45BGCCROP`` (2000_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45BGCDV`` (2000_DATM%QIA_CLM45%BGCDV_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45BGCDVCROP`` (2000_DATM%QIA_CLM45%BGCDV-CROP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45BGCNoVS`` (2000_DATM%QIA_CLM45%NoVS_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45CN`` (2000_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45CNCROP`` (2000_DATM%QIA_CLM45%CN-CROP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45CNDV`` (2000_DATM%QIA_CLM45%CNDV_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45CNTEST`` (2003_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV_TEST) - -#. ``ICLM45CRUBGC`` (2000_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45GLCMEC`` (2000_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV_TEST) - -#. ``ICLM45SNCRFRC`` (2000_DATM%QIA_CLM45%SP-SNCR_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45USUMB`` (2000_DATM%1PT_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV_CLMUSRDAT%1x1_US-UMB) - -#. ``ICLM45VIC`` (2000_DATM%QIA_CLM45%SP-VIC_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICLM45alaskaCN`` (2000_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV_CLMUSRDAT%13x12pt_f19_alaskaUSA) - -#. ``ICN`` (2000_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICNCROP`` (2000_DATM%QIA_CLM40%CN-CROP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICNDV`` (2000_DATM%QIA_CLM40%CNDV_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICNDVCROP`` (2000_DATM%QIA_CLM40%CNDV-CROP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICNTEST`` (2003_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV_TEST) - -#. ``ICRU`` (2000_DATM%CRU_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICRUCLM45`` (2000_DATM%CRU_CLM45_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICRUCLM45BGC`` (2000_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICRUCLM45BGCCROP`` (2000_DATM%CRU_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICRUCLM45BGCTEST`` (2003_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV_TEST) - -#. ``ICRUCLM45CN`` (2000_DATM%CRU_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ICRUCN`` (2000_DATM%CRU_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``IG`` (2000_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG1850`` (1850_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG1850CLM45`` (1850_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG1850CLM45CN`` (1850_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG1850CN`` (1850_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG20TR`` (20TR_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG20TRCLM45`` (20TR_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG20TRCLM45CN`` (20TR_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG20TRCN`` (20TR_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG4804`` (4804_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG4804CLM45`` (4804_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG4804CLM45CN`` (4804_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IG4804CN`` (4804_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGCLM45`` (2000_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGCLM45CN`` (2000_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGCN`` (2000_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGLCMEC`` (2000_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV_TEST) - -#. ``IGRCP26CLM45CN`` (RCP2_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGRCP26CN`` (RCP2_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGRCP45CLM45CN`` (RCP4_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGRCP45CN`` (RCP4_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGRCP60CLM45CN`` (RCP6_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGRCP60CN`` (RCP6_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGRCP85CLM45CN`` (RCP8_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IGRCP85CN`` (RCP8_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_CISM1_SWAV) - -#. ``IRCP26CLM45CN`` (RCP2_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``IRCP26CN`` (RCP2_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``IRCP45CLM45CN`` (RCP4_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``IRCP45CN`` (RCP4_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``IRCP60CLM45CN`` (RCP6_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``IRCP60CN`` (RCP6_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``IRCP85CLM45CN`` (RCP8_DATM%QIA_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``IRCP85CN`` (RCP8_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ISNCRFRC`` (2000_DATM%QIA_CLM40%SP-SNCR_SICE_SOCN_RTM_SGLC_SWAV) - -#. ``ITEST`` (2003_DATM%QIA_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV_TEST) - -#. ``ITESTCLM45`` (2003_DATM%QIA_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV_TEST) - -#. ``IUSUMB`` (2000_DATM%1PT_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV_CLMUSRDAT%1x1_US-UMB) - -#. ``IalaskaCN`` (2000_DATM%QIA_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV_CLMUSRDAT%13x12pt_f19_alaskaUSA) - Compsets coupled to active atmosphere with data ocean ----------------------------------------------------- CAM compsets are compsets that start with "E" or "F" in the name. They are described more fully in the scripts documentation or the CAM documentation. "E" compsets have a slab ocean model while "F" compsets have a data ocean model. diff --git a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst index 774e4651e6..4f51314d48 100644 --- a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst @@ -108,5 +108,5 @@ More details on each environment variable. The *README.filecopies* (which can be found in ``$CTSMROOT/tools``) is repeated here. -.. include:: ../../+|version|/tools/README.filecopies +.. include:: ../../clm5.0/tools/README.filecopies :literal: diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index 8f43d8ac0a..ae90a3609b 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -62,6 +62,6 @@ Creating a Complete Set of Files for Input to CLM The ``$CTSMROOT/tools/README`` goes through the complete process for creating input files needed to run CLM. We repeat that file here: -.. include:: ../../+|version|/tools/README +.. include:: ../../clm5.0/tools/README :literal: From 4372fd30e4fced8a665071085ccef50320d97a24 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 14 Jun 2018 15:11:08 -0600 Subject: [PATCH 0185/1973] Fix a warning about header --- ...Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst index c92892ba8d..50437d56b5 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst @@ -1,8 +1,8 @@ .. _spinning-up-clm45-bgc: -====================== +========================= Spinup of +|version|-BGC -====================== +========================= To get the +|version|-BGC model to a steady state, you first run it from arbitrary initial conditions using the "accelerated decomposition spinup" (-bgc_spinup on in CLM **configure**) mode for 1000 simulation years. After this you branch from this mode in the "final spinup" (-bgc_spinup off in CLM **configure**), and run for (at least 200+ simulation years). From 29fb4e4f03d7a10b8259f3d8a30f9d5bcb801a79 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 14 Jun 2018 16:14:27 -0600 Subject: [PATCH 0186/1973] Fix a couple issues --- doc/source/conf.py | 2 +- doc/source/users_guide/overview/introduction.rst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index a573b2a1d0..9a112db91b 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -51,7 +51,7 @@ # General information about the project. project = u'clmdoc' -copyright = u'2017, Erik Kluzek, Bill Sacks, Ben Andre' +copyright = u'2018, Erik Kluzek, Bill Sacks, Ben Andre' author = u'Erik Kluzek, Bill Sacks, Ben Andre' # The version info for the project you're documenting, acts as replacement for diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index b65e622b45..706c4f5628 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -79,11 +79,11 @@ and then finally do it by hand. If you are using non supported machines you may also want to use the test scripts to make sure your machine is working correctly. -.. _what-is-new-with-+|version|: +.. _what-is-new-with-clm5_0: -========================= +============================ What is New with +|version| -========================= +============================ `What's new with +|version| science `_ The +|cesmrelease| `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. From e1063a221b6f8b9e0b8d12bf07126978ff863928 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Jun 2018 10:45:35 -0600 Subject: [PATCH 0187/1973] Write out clm version in title, rather than use variable substitution --- ...inning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst index 50437d56b5..9065869bb4 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst @@ -1,8 +1,8 @@ .. _spinning-up-clm45-bgc: -========================= - Spinup of +|version|-BGC -========================= +===================== + Spinup of CLM5.0-BGC +===================== To get the +|version|-BGC model to a steady state, you first run it from arbitrary initial conditions using the "accelerated decomposition spinup" (-bgc_spinup on in CLM **configure**) mode for 1000 simulation years. After this you branch from this mode in the "final spinup" (-bgc_spinup off in CLM **configure**), and run for (at least 200+ simulation years). From 7a687480f6bcd5f91a3674c86f3d75681e758a6c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Jun 2018 12:01:37 -0600 Subject: [PATCH 0188/1973] Get version/release substitutions working correctly, and add subs for cesmrelease and cesmversion --- ...w-Files-to-the-build-namelist-Database.rst | 4 +- .../CLM-3.1-Managing-Your-Own-Data-files.rst | 4 +- .../CLM-3.2-Adding-Resolution-Names.rst | 2 +- ...3-Adding-or-Changing-Default-Filenames.rst | 8 +- doc/source/users_guide/conf.py | 2 - doc/source/users_guide/index.rst | 2 + .../users_guide/overview/getting-help.rst | 28 +++--- .../users_guide/overview/introduction.rst | 94 +++++++++---------- .../users_guide/overview/quickstart.rst | 14 +-- .../overview/scientific_validation.rst | 14 +-- .../running-PTCLM/introduction-to-ptclm.rst | 2 +- .../users_guide/running-PTCLM/using-ptclm.rst | 2 +- .../running-single-point-configurations.rst | 4 +- ...CLM5.0-biogeochemistry-(CLMBGC-spinup).rst | 12 +-- ...transient-historical-CO2-concentration.rst | 2 +- .../running-the-prognostic-crop-model.rst | 2 +- .../running-with-irrigation.rst | 4 +- .../customizing-the-clm-configuration.rst | 18 ++-- .../customizing-the-clm-namelist.rst | 6 +- doc/source/users_guide/testing/testing.rst | 2 +- .../trouble-shooting/trouble-shooting.rst | 2 +- ...g-input-for-surface-dataset-generation.rst | 8 +- .../creating-surface-datasets.rst | 6 +- .../what-are-the-clm-tools.rst | 8 +- 24 files changed, 125 insertions(+), 125 deletions(-) diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst index 8854d9e4d9..60137563db 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst @@ -14,11 +14,11 @@ If you have a LOT of files to keep track of it also might be easier than keeping If you just have a few quick experiments to try, for a short time period you might be best off using the other methods mentioned above. There are two parts to adding files to the build-namelist database. -The first part is adding new resolution names which is done in the ``$CTSMROOT/bld/namelist_files/namelist_definition_+|version|.xml`` file (and in the ``$CTSMROOT/bld/config_files/config_definition.xml`` file when adding supported single-point datasets). +The first part is adding new resolution names which is done in the ``$CTSMROOT/bld/namelist_files/namelist_definition_|version|.xml`` file (and in the ``$CTSMROOT/bld/config_files/config_definition.xml`` file when adding supported single-point datasets). You can then use the new resolution by using ``CLM_USRDAT_NAME``. If you also want to be able to give the resolution into **create_newcase** -- you'll need to add the grid to the ``scripts/ccsm_utils/Case.template/config_grid.xml`` file. -The second part is actually adding the new filenames which is done in the ``$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|.xml`` file (``$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|_tools.xml`` file for CLM tools). +The second part is actually adding the new filenames which is done in the ``$CTSMROOT/bld/namelist_files/namelist_defaults_|version|.xml`` file (``$CTSMROOT/bld/namelist_files/namelist_defaults_|version|_tools.xml`` file for CLM tools). If you aren't adding any new resolutions, and you are just changing the files for existing resolutions, you don't need to edit the namelist_definition file. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst index 558c877157..6d4a65657e 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst @@ -4,7 +4,7 @@ Managing Your Data Own Files ============================== -If you are running on a supported machine (such as cheyenne or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `+|cesmrelease| Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. +If you are running on a supported machine (such as cheyenne or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `|cesmrelease| Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. Using **link_dirtree** is quite simple, you give the directory where data exists and then the directory that you want to create where datasets will point to the original source files. In the example below we use "$HOME/inputdata", but MYCSMDATA could be any directory you have access to where you want to put your data. @@ -39,7 +39,7 @@ You can also use **find** to list files that have a particular pattern in the na -If you are running on a supported machine (such as cheyenne or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `+|cesmrelease| Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. +If you are running on a supported machine (such as cheyenne or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `|cesmrelease| Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. Using **link_dirtree** is quite simple, you give the directory where data exists and then the directory that you want to create where datasets will point to the original source files. In the example below we use "$HOME/inputdata", but MYCSMDATA could be any directory you have access to where you want to put your data. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst index e7896e1206..b9b767ca06 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst @@ -5,7 +5,7 @@ ========================= If you are adding files for new resolutions which aren't covered in the namelist_definition file -- you'll need to add them in. -The list of valid resolutions is in the id="res" entry in the ``$CTSMROOT/bld/namelist_files/namelist_definition_+|version|.xml`` file. +The list of valid resolutions is in the id="res" entry in the ``$CTSMROOT/bld/namelist_files/namelist_definition_|version|.xml`` file. You need to choose a name for your new resolution and simply add it to the comma delimited list of valid_values for the id="res" entry. The convention for global Gaussian grids is number_of_latitudes x number_of_longitudes. The convention for global finite volume grids is latitude_grid_size x longitude_grid_size where latitude and longitude is measured in degrees. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst index 6393a74ce3..4c8c9884de 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst @@ -4,7 +4,7 @@ Changing Default Filenames ============================ -To add or change the default filenames you edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|.xml`` and either change an existing filename or add a new one. +To add or change the default filenames you edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_|version|.xml`` and either change an existing filename or add a new one. Most entries in the default namelist files, include different attributes that describe the different properties that describe the differences in the datasets. Attributes include the: resolution, year to simulation, range of years to simulate for transient datafiles, the land-mask, the representative concentration pathway (rcp) for future scenarios, and the type of biogeochemistry (bgc) model used. For example the fatmgrid for the 1.9x2.5 resolution is as follows: @@ -18,8 +18,8 @@ lnd/clm2/surfdata_map/surfdata_0.9x1.25_simyr1850_c130415.nc Other ``fsurdat`` files are distinguished from this one by their resolution (hgrid), simulation year (sim_year) and prognostic crop (crop) attributes. -To add or change the default filenames for CLM tools edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_+|version|_tools.xml`` and either change an existing filename or add a new one. -Editing this file is similar to the ``namelist_defaults_+|version|.xml`` talked about above. +To add or change the default filenames for CLM tools edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_|version|_tools.xml`` and either change an existing filename or add a new one. +Editing this file is similar to the ``namelist_defaults_|version|.xml`` talked about above. ---------------------------- @@ -27,7 +27,7 @@ What are the required files? ---------------------------- Different types of simulations and different types of configurations for CLM require different lists of files. -The +|version|-BGC or Carbon Nitrogen (cn) Biogeochemistry model for example requires ``stream_fldfilename_ndep`` files, which are NOT required by CLMSP. +The |version|-BGC or Carbon Nitrogen (cn) Biogeochemistry model for example requires ``stream_fldfilename_ndep`` files, which are NOT required by CLMSP. Transient simulations also require transient datasets, and the names of these datasets are sometimes different from the static versions (sometimes both are required as in the dynamic PFT cases). diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py index 0294e7cef8..c717685979 100644 --- a/doc/source/users_guide/conf.py +++ b/doc/source/users_guide/conf.py @@ -63,8 +63,6 @@ # The full version, including alpha/beta/rc tags. release = u'release-clm5.0.01' -cesmrelease = u'release-cesm2.0.00' - # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst index f3160a30ed..625bd84107 100644 --- a/doc/source/users_guide/index.rst +++ b/doc/source/users_guide/index.rst @@ -5,6 +5,8 @@ .. _users-guide: +.. |cesmrelease| replace:: CESM2.0.0 + ##################################### |version| User's Guide ##################################### diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst index f78349e1ff..f5e5a0f059 100644 --- a/doc/source/users_guide/overview/getting-help.rst +++ b/doc/source/users_guide/overview/getting-help.rst @@ -3,15 +3,15 @@ ============== Getting Help ============== -In addition to this users-guide there are several other resources that are available to help you use +|version|. The first one is the +|cesmrelease| User's-Guide, which documents the entire process of creating cases with +|cesmrelease|. The next is the CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in +|cesmrelease|. +In addition to this users-guide there are several other resources that are available to help you use |version|. The first one is the |cesmrelease| User's-Guide, which documents the entire process of creating cases with |cesmrelease|. The next is the CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in |cesmrelease|. --------------------------- The CESM User's-Guide --------------------------- -+|release| -+|release| in +|cesmrelease| is always run from within the standard +|cesmrelease| build and run scripts. Therefore, the user of +|version| should familiarize themselves with the +|cesmrelease| scripts and understand how to work with them. User's-Guide documentation on the +|cesmrelease| scripts are available from the following web-page. The purpose of this +|version| in +|cesmrelease| User's Guide is to give the +|version| user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the +|cesmrelease| Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. +|release| +|release| in |cesmrelease| is always run from within the standard |cesmrelease| build and run scripts. Therefore, the user of |version| should familiarize themselves with the |cesmrelease| scripts and understand how to work with them. User's-Guide documentation on the |cesmrelease| scripts are available from the following web-page. The purpose of this |version| in |cesmrelease| User's Guide is to give the |version| user more complete details on how to work with CLM and the set of tools that support CLM, as well as to give examples that are unique to the use of CLM. However, the |cesmrelease| Scripts User's-Guide remains the primary source to get detailed information on how to build and run the CESM system. -`+|cesmrelease| Quickstart Guide `_ +`|cesmrelease| Quickstart Guide `_ ----------------------- The CESM Bulletin Board @@ -42,11 +42,11 @@ Also note that several of the XML database files can be viewed in a web browser - `$CTSMROOT/bld/namelist_files/history_fields_clm4_5.xml `_ -- definition of CLM4.5/CLM5.0 history fields. ---------------------------- -Reporting bugs in +|version| +Reporting bugs in |version| ---------------------------- -If you have any problems, additional questions, bug reports, or any other feedback, please send an email to <`cesmhelp@cgd.ucar.edu `_>. If you find bad, wrong, or misleading information in this users guide send an email to <`erik@ucar.edu `_>. The current list of known issues for +|version| in +|cesmrelease| is in the $CTSMROOT/doc/KnownBugs file, and the list of issues for +|cesmrelease| is at... -`http://www.cesm.ucar.edu/models/cesm1.2//tags/+|cesmrelease|/#PROBLEMS `_. +If you have any problems, additional questions, bug reports, or any other feedback, please send an email to <`cesmhelp@cgd.ucar.edu `_>. If you find bad, wrong, or misleading information in this users guide send an email to <`erik@ucar.edu `_>. The current list of known issues for |version| in |cesmrelease| is in the $CTSMROOT/doc/KnownBugs file, and the list of issues for |cesmrelease| is at... +`http://www.cesm.ucar.edu/models/cesm1.2//tags/|cesmrelease|/#PROBLEMS `_. --------------------------------------- Some Acronym's and Terms We'll be Using @@ -62,22 +62,22 @@ CLM Community Land Model (CLM). The prognostically active land model component of CESM. CLMBGC - Community Land Model (+|version|) with BGC Biogeochemistry. Uses CN Biogeochemistry with vertically resolved soil Carbon, CENTURY model like pools, and Nitrification/De-Nitrification. The CLM_CONFIG_OPTS option for this is + Community Land Model (|version|) with BGC Biogeochemistry. Uses CN Biogeochemistry with vertically resolved soil Carbon, CENTURY model like pools, and Nitrification/De-Nitrification. The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="phys clm5_0 -bgc cn -vsoilc_centbgc on -clm4me on"`` CLMCN - Community Land Model (CLM) with Carbon Nitrogen (CN) Biogeochemistry (either CLM4.0 or +|version|) The CLM_CONFIG_OPTS option for this is + Community Land Model (CLM) with Carbon Nitrogen (CN) Biogeochemistry (either CLM4.0 or |version|) The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-bgc cn" -append`` CLMSP - Community Land Model (CLM) with Satellite Phenology (SP) (either CLM4.0 or +|version|) The CLM_CONFIG_OPTS option for this is + Community Land Model (CLM) with Satellite Phenology (SP) (either CLM4.0 or |version|) The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-bgc none" -append`` CLMU - Community Land Model (CLM) Urban Model (either CLM4.0 or +|version|). The urban model component of CLM is ALWAYS active (unless you create special surface datasets that have zero urban percent, or for regional/single-point simulations for a non-urban area). + Community Land Model (CLM) Urban Model (either CLM4.0 or |version|). The urban model component of CLM is ALWAYS active (unless you create special surface datasets that have zero urban percent, or for regional/single-point simulations for a non-urban area). CRUNCEP The Climate Research Unit (CRU) analysis of the NCEP atmosphere reanalysis atmosphere forcing data. This can be used to drive CLM with atmosphere forcing from 1901 to 2010. We also DO expect to be able to update this dataset beyond 2010 as newer data becomes available. @@ -86,7 +86,7 @@ DATM Data Atmosphere Model (DATM) the prescribed data atmosphere component for CESM. Forcing data that we provide are either the Qian or CRUNCEP forcing datasets (see below). DV - Dynamic global vegetation, where fractional PFT (see PFT below) changes in time prognostically. Can NOT be used with prescribed transient PFT (requires either +|version|-BGC or CLMCN for either CLM4.0 or +|version|). The CLM_CONFIG_OPTS option for this is + Dynamic global vegetation, where fractional PFT (see PFT below) changes in time prognostically. Can NOT be used with prescribed transient PFT (requires either |version|-BGC or CLMCN for either CLM4.0 or |version|). The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-bgc cndv" -append`` @@ -103,7 +103,7 @@ PFT Plant Function Type (PFT). A type of vegetation that CLM parameterizes. PTCLM - PoinT CLM (PTCLM) a python script that operates on top of CLM for +|version| to run single point simulations for CLM. + PoinT CLM (PTCLM) a python script that operates on top of CLM for |version| to run single point simulations for CLM. Qian The Qian et. al. analysis of the NCEP forcing data. This can be used to drive CLM with atmosphere forcing from 1948 to 2004. We do NOT expect to be able to update this dataset beyond 2004. @@ -112,6 +112,6 @@ SCRIP Spherical Coordinate Remapping and Interpolation Package (SCRIP). We use it's file format for specifying both grid coordinates as well as mapping between different grids. VIC - Variable Infiltration Capacity (VIC) model for hydrology. This is an option to +|version| in place of the standard +|version| hydrology. The CLM_CONFIG_OPTS option for this is + Variable Infiltration Capacity (VIC) model for hydrology. This is an option to |version| in place of the standard |version| hydrology. The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-vichydro on" -append`` diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index 706c4f5628..a7e1f6c050 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -1,6 +1,6 @@ .. _introduction: -**User's Guide to version +|version| of the Community Land Model (CLM)** +**User's Guide to version |version| of the Community Land Model (CLM)** **Authors: Benjamin Andre, Erik Kluzek, William Sacks** @@ -20,33 +20,33 @@ P. O. Box 3000, Boulder, Colorado 80307-300 Introduction ============== -The Community Land Model (+|release| in +|cesmrelease|) is the latest in a +The Community Land Model (|release| in |cesmrelease|) is the latest in a series of global land models developed by the CESM Land Model Working Group (LMWG) and maintained at the National Center for Atmospheric Research (NCAR). This guide is intended to instruct both the novice and experienced user on running CLM. This guide pertains to the latest -version +|version| in +|cesmrelease| available for download from the public -release subversion repository as a part of +|cesmrelease|. Documentation +version |version| in |cesmrelease| available for download from the public +release subversion repository as a part of |cesmrelease|. Documentation may be different if you are using an older version, you should either use the documentation for that release version, update to the latest version, or use the documentation inside your own source tree. There is information in the ChangeLog file and in the `What is new with -+|version| in +|cesmrelease| since previous public releases? `_ +|version| in |cesmrelease| since previous public releases? `_ regarding the changes from previous versions of CESM. -.. note:: This release of +|version| in +|cesmrelease| includes BOTH CLM4.0 - physics used in previous releases as well as the updated +|version| +.. note:: This release of |version| in |cesmrelease| includes BOTH CLM4.0 + physics used in previous releases as well as the updated |version| physics. Both CLM as well as CLM support tools allow you to trigger between the two physics modes. Most often when we refer to CLM4.0 we - are referring to the CLM4.0 physics in +|version| in +|cesmrelease| rather + are referring to the CLM4.0 physics in |version| in |cesmrelease| rather than to a specific version of CLM4.0 (where we would give the exact - version). Likewise, when referring to +|version| we are referring to the - +|version| physics in +|version| in +|cesmrelease|. + version). Likewise, when referring to |version| we are referring to the + |version| physics in |version| in |cesmrelease|. The novice user should read `Chapter 1 `_ in detail before beginning work, while the expert user should read `What is new with -+|version| in +|cesmrelease| since previous public releases? `_ and -`Quickstart to using +|version| `_ chapters, and then use the +|version| in |cesmrelease| since previous public releases? `_ and +`Quickstart to using |version| `_ chapters, and then use the more detailed chapters as reference. Before novice users go onto more technical problems covered in `Chapter 2 `_, `Chapter 3 `_, `Chapter 4 `_, or `Chapter 5 `_ they @@ -56,12 +56,12 @@ to replicate some of the examples given there. All users should read the `How to Use This Document `_ and `Other resources to get help from `_ sections to understand the document conventions and the various ways of getting help on using -+|version|. Users should also read the `What is scientifically validated -and functional in +|version| in +|cesmrelease|? `_ section to see if +|version|. Users should also read the `What is scientifically validated +and functional in |version| in |cesmrelease|? `_ section to see if their planned use of the model is something that has been scientifically validated and well tested. Users that are NOT using NCAR machines or our list of well tested machines should also read the -What are the UNIX utilities required to use +|version|? section to make +What are the UNIX utilities required to use |version|? section to make sure they have all the required UNIX utilities on the system they want to do their work. @@ -82,11 +82,11 @@ machine is working correctly. .. _what-is-new-with-clm5_0: ============================ - What is New with +|version| + What is New with |version| ============================ -`What's new with +|version| science `_ -The +|cesmrelease| `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. +`What's new with |version| science `_ +The |cesmrelease| `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. More details are given in the `CLM ChangeLog file `_. Previous release pages give similar list of changes for previous versions of the model. @@ -99,49 +99,49 @@ The `CLM4 in CESM1.0.5 User's Guide `_ gives information on the updates ========================== In this introduction we first give a simple guide to understand the document conventions in `How to Use This Document `_. -The next section `What is new with +|version| in +|cesmrelease| since previous public releases? `_ gives references to describe the differences between +|version| in +|cesmrelease| and previous CESM releases both from a scientific as well as a software engineering point of view. -For information on previous releases of +|version| before +|version| in +|cesmrelease| see the CESM1.1.1 documentation. -The next section `Quickstart to using +|version| `_ is for users that are already experts in using CLM and gives a quickstart guide to the bare details on how to use +|version|. -The next `What is scientifically validated and functional in +|version| in +|cesmrelease|? `_ tells you about what has been extensively tested and scientifically validated (and maybe more importantly) what has NOT. -`What are the UNIX utilities required to use +|version|? `_ lists the UNIX utilities required to use +|version| and is important if you are running on non-NCAR machines, generic local machines, or machines NOT as well tested by us at NCAR. -Next we have `Important Notes and Best Practices for Usage of +|version| `_ to detail some of the best practices for using +|version| for science. -The last introductory section is `Other resources `_ to get help from which lists different resources for getting help with CESM1.0 and +|version|. - -`Chapter 1 `_ goes into detail on how to setup and run simulations with +|version| and especially how to customize cases. +The next section `What is new with |version| in |cesmrelease| since previous public releases? `_ gives references to describe the differences between |version| in |cesmrelease| and previous CESM releases both from a scientific as well as a software engineering point of view. +For information on previous releases of |version| before |version| in |cesmrelease| see the CESM1.1.1 documentation. +The next section `Quickstart to using |version| `_ is for users that are already experts in using CLM and gives a quickstart guide to the bare details on how to use |version|. +The next `What is scientifically validated and functional in |version| in |cesmrelease|? `_ tells you about what has been extensively tested and scientifically validated (and maybe more importantly) what has NOT. +`What are the UNIX utilities required to use |version|? `_ lists the UNIX utilities required to use |version| and is important if you are running on non-NCAR machines, generic local machines, or machines NOT as well tested by us at NCAR. +Next we have `Important Notes and Best Practices for Usage of |version| `_ to detail some of the best practices for using |version| for science. +The last introductory section is `Other resources `_ to get help from which lists different resources for getting help with CESM1.0 and |version|. + +`Chapter 1 `_ goes into detail on how to setup and run simulations with |version| and especially how to customize cases. Details of cesm_setup modes and build-namelist options as well as namelist options are given in this chapter. -`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.0 or +|version| physics for creating input datasets for use by CLM, for the expert user. +`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.0 or |version| physics for creating input datasets for use by CLM, for the expert user. There's an overview of what each tool does, and some general notes on how to build the FORTRAN tools. Then each tool is described in detail along with different ways in which the tool might be used. A final section on how to customize datasets for observational sites for very savvy expert users is given as the last section of this chapter. As a followup to the tools chapter, `Chapter 3 `_ tells how to add files to the XML database for build-namelist to use. -This is important if you want to use the XML database to automatically select user-created input files that you have created when you setup new cases with CLM (both CLM4.0 and +|version| physics). +This is important if you want to use the XML database to automatically select user-created input files that you have created when you setup new cases with CLM (both CLM4.0 and |version| physics). In `Chapter 4 `_, again for the expert user, we give details on how to do some particularly difficult special cases. -For example, we give the protocol for spinning up the +|version|-BGC and CLMCN models as well as CLM with dynamic vegetation active (CNDV). +For example, we give the protocol for spinning up the |version|-BGC and CLMCN models as well as CLM with dynamic vegetation active (CNDV). We give instructions to do a spinup case from a previous case with Coupler history output for atmospheric forcing. We also give instructions on running both the prognostic crop and irrigation models. Lastly we tell the user how to use the DATM model to send historical CO2 data to CLM. -`Chapter 5 `_ outlines how to do single-point or regional simulations using +|version|. -This is useful to either compare +|version| simulations with point observational stations, such as tower sites (which might include your own atmospheric forcing), or to do quick simulations with CLM for example to test a new parameterization. +`Chapter 5 `_ outlines how to do single-point or regional simulations using |version|. +This is useful to either compare |version| simulations with point observational stations, such as tower sites (which might include your own atmospheric forcing), or to do quick simulations with CLM for example to test a new parameterization. There are several different ways given on how to perform single-point simulations which range from simple PTS_MODE to more complex where you create all your own datasets, tying into `Chapter 2 `_ and also `Chapter 3 `_ to add the files into the build-namelist XML database. The PTCLM python script to run single-point simulations was added back in for this release (but it has bugs that don't allow it to work out of the box). CLM4 in CESM1.0.5 has a fully working versions of PTCLM. Need `Chapter 6 `_ blurb... -`Chapter 7 `_ gives some guidance on trouble-shooting problems when using +|version|. +`Chapter 7 `_ gives some guidance on trouble-shooting problems when using |version|. It doesn't cover all possible problems with CLM, but gives you some guidelines for things that can be done for some common problems. `Chapter 8 `_ goes over the automated testing scripts for validating that the CLM is working correctly. -The test scripts run many different configurations and options with CLM4.0 physics as well and +|version| physics making sure that they work, as well as doing automated testing to verify restarts are working correctly, and testing at many different resolutions. -In general this is an activity important only for a developer of +|version|, but could also be used by users who are doing extensive code modifications and want to ensure that the model continues to work correctly. +The test scripts run many different configurations and options with CLM4.0 physics as well and |version| physics making sure that they work, as well as doing automated testing to verify restarts are working correctly, and testing at many different resolutions. +In general this is an activity important only for a developer of |version|, but could also be used by users who are doing extensive code modifications and want to ensure that the model continues to work correctly. -In the appendices we talk about some issues that are useful for advanced users and developers of +|version|. +In the appendices we talk about some issues that are useful for advanced users and developers of |version|. -Finally in `Appendix A `_ we give instructions on how to build the documentation associated with +|version| (i.e. how to build this document). +Finally in `Appendix A `_ we give instructions on how to build the documentation associated with |version| (i.e. how to build this document). This document is included in every CLM distribution and can be built so that you can view a local copy rather than having to go to the CESM website. This also could be useful for developers who need to update the documentation due to changes they have made. @@ -151,12 +151,12 @@ This also could be useful for developers who need to update the documentation du Best Practices ================ -- +|version| includes BOTH the old CLM4.0 physics AND the new +|version| physics and you can toggle between two. +- |version| includes BOTH the old CLM4.0 physics AND the new |version| physics and you can toggle between two. The "standard" practice for CLM4.0 is to run with CN on, and with Qian atmospheric forcing. - While the "standard" practice for +|version| is to run with BGC on, and CRUNCEP atmospheric forcing. - "BGC" is the new +|version| biogeochemistry and include CENTURY-like pools, vertical resolved carbon, as well as Nitrification and de-Nitrification (see `the Section called Some Acronym's and Terms We'll be Using in Other resources to get help from `_ ). + While the "standard" practice for |version| is to run with BGC on, and CRUNCEP atmospheric forcing. + "BGC" is the new |version| biogeochemistry and include CENTURY-like pools, vertical resolved carbon, as well as Nitrification and de-Nitrification (see `the Section called Some Acronym's and Terms We'll be Using in Other resources to get help from `_ ). -- When running with CLMCN (either CLM4.0 or +|version| physics) or +|version|-BGC, it is critical to begin with initial conditions that are provided with the release or to spin the model up following the CN spinup procedure before conducting scientific runs (see `the Section called Spinning up the +|version| biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for +|version| or `the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4 `_ for CLM4.0). +- When running with CLMCN (either CLM4.0 or |version| physics) or |version|-BGC, it is critical to begin with initial conditions that are provided with the release or to spin the model up following the CN spinup procedure before conducting scientific runs (see `the Section called Spinning up the |version| biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for |version| or `the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4 `_ for CLM4.0). Simulations without a proper spinup will effectively be starting from an unvegetated world. See `the Section called Setting Your Initial Conditions File in Chapter 1 `_ for information on how to provide initial conditions for your simulation. @@ -169,20 +169,20 @@ This also could be useful for developers who need to update the documentation du Therefore, by design the year 2000 initial condition files do not represent an equilibrium state. Note also that spinning the 2000 initial conditions out to equilibrium will not reflect the best estimate of the real carbon/nitrogen state for the year 2000. -- Initial condition files are also provided for +|version| for several configurations and resolutions. - For +|version|-SP and +|version|-BGC with CRUNCEP forcing we have initial conditions at 1deg resolution for both 1850 and 2000. - The +|version|-BGC initial conditions for 1850 (again with CRUNCEP forcing) were also interpolated to 2deg, CRUNCEP half degree (360x720cru), and ne30np4 resolutions. - Also the +|version|-BGC initial conditions for 1850 (with CRUNCEP forcing) were interpolated to 1deg +|version|-BGC-DV and 2deg +|version|-BGC-Crop. +- Initial condition files are also provided for |version| for several configurations and resolutions. + For |version|-SP and |version|-BGC with CRUNCEP forcing we have initial conditions at 1deg resolution for both 1850 and 2000. + The |version|-BGC initial conditions for 1850 (again with CRUNCEP forcing) were also interpolated to 2deg, CRUNCEP half degree (360x720cru), and ne30np4 resolutions. + Also the |version|-BGC initial conditions for 1850 (with CRUNCEP forcing) were interpolated to 1deg |version|-BGC-DV and 2deg |version|-BGC-Crop. - Users can generate initial condition files at different resolutions by using the CLM tool interpinic to interpolate from one of the provided resolutions to the resolution of interest. Interpolated initial condition files may no longer be in 'reasonable' equilibrium. -- In +|version| for both +|version|-CN and +|version|-BGC the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). +- In |version| for both |version|-CN and |version|-BGC the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). By default we have provided a climatology dataset for lightning frequency and a dataset with coverage from 1850 to 2010 for population density. Both of these datasets are interpolated from the native resolution of the datasets to the resolution you are running the model on. If you are running with an atmosphere model or forcing that is significantly different than present day -- the lightning frequency may NOT appropriately correspond to your atmosphere forcing and fire initiation would be inappropriate. -- Aerosol deposition is a required field to both CLM4.0 and +|version| physics, sent from the atmosphere model. +- Aerosol deposition is a required field to both CLM4.0 and |version| physics, sent from the atmosphere model. Simulations without aerosol deposition will exhibit unreasonably high snow albedos. The model sends aerosol deposition from the atmospheric model (either CAM or DATM). When running with prescribed aerosol the atmosphere model will interpolate the aerosols from 2-degree resolution to the resolution the atmosphere model is running at. diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst index fa62be5422..935934f6c5 100644 --- a/doc/source/users_guide/overview/quickstart.rst +++ b/doc/source/users_guide/overview/quickstart.rst @@ -7,27 +7,27 @@ Running the CLM requires a suite of UNIX utilities and programs and you should make sure you have all of these available before trying to go forward with using it. If you are missing one of these you should contact the systems administrator for the machine you wish to run on and make sure they are installed. -List of utilities required for CESM in the "+|cesmrelease| Software/Operating System Prerequisites" section in `http://www.cesm.ucar.edu/models/cesm1.2//cesm/doc/usersguide/book1.html `_ +List of utilities required for CESM in the "|cesmrelease| Software/Operating System Prerequisites" section in `http://www.cesm.ucar.edu/models/cesm1.2//cesm/doc/usersguide/book1.html `_ - UNIX bash shell (for some of the CLM tools scripts) - NCL (for some of the offline tools for creating/modifying CLM input datasets see `Chapter 2 `_ for more information on NCL) - Python (optional, needed for PTCLM) - xsltproc, docbook and docbook utilities (optional, needed to build the Users-Guide) -Before working with +|version| read the QuickStart Guide in the `+|cesmrelease| Scripts User's Guide `_. Once you are familiar with how to setup cases for any type of simulation with CESM you will want to direct your attention to the specifics of using CLM. +Before working with |version| read the QuickStart Guide in the `|cesmrelease| Scripts User's Guide `_. Once you are familiar with how to setup cases for any type of simulation with CESM you will want to direct your attention to the specifics of using CLM. -For some of the details of setting up cases for +|version| read the README and text files available from the "$CTSMROOT/doc" directory (see the "CLM Web pages" section for a link to the list of these files). Here are the important ones that you should be familiar with. +For some of the details of setting up cases for |version| read the README and text files available from the "$CTSMROOT/doc" directory (see the "CLM Web pages" section for a link to the list of these files). Here are the important ones that you should be familiar with. 1. `README file `_ describing the directory structure. 2. `Quickstart.userdatasets `_ file describing how to use your own datasets in the model (also see `the Section called Creating your own single-point/regional surface datasets in Chapter 5 `_). -3. `$CTSMROOT/doc/KnownBugs `_ file describing known problems in +|version| (that we expect to eventually fix). +3. `$CTSMROOT/doc/KnownBugs `_ file describing known problems in |version| (that we expect to eventually fix). -4. `$CTSMROOT/doc/KnownLimitationss `_ file describing known limitations in +|version| and workarounds that we do NOT expect to fix. +4. `$CTSMROOT/doc/KnownLimitationss `_ file describing known limitations in |version| and workarounds that we do NOT expect to fix. -The IMPORTANT_NOTES file talks about important things for users to know about using the model scientifically. It content is given in the next chapter on `"What is scientifically validated and functional in +|version| in +|cesmrelease|?" `_. +The IMPORTANT_NOTES file talks about important things for users to know about using the model scientifically. It content is given in the next chapter on `"What is scientifically validated and functional in |version| in |cesmrelease|?" `_. -The ChangeLog/ChangeSum talk about advances in different versions of CLM. The content of these files is largely explained in the previous chapter on `"What is new with +|version| in +|cesmrelease| since previous public releases?" `_. +The ChangeLog/ChangeSum talk about advances in different versions of CLM. The content of these files is largely explained in the previous chapter on `"What is new with |version| in |cesmrelease| since previous public releases?" `_. Note other directories have README files that explain different components and tools used when running CLM and are useful in understanding how those parts of the model work and should be consulted when using tools in those directories. For more details on configuring and customizing a case with CLM see `Chapter 1 `_. diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst index a238bee4a6..d96eb29bf4 100644 --- a/doc/source/users_guide/overview/scientific_validation.rst +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -4,16 +4,16 @@ Scientific Validation ======================== -In this section we go over what has been extensively tested and scientifically validated with +|version|, and maybe more importantly what has NOT been tested and may NOT be scientifically validated. You can use all features of CLM, but need to realize that some things haven't been tested extensively or validated scientifically. When you use these features you may run into trouble doing so, and will need to do your own work to make sure the science is reasonable. +In this section we go over what has been extensively tested and scientifically validated with |version|, and maybe more importantly what has NOT been tested and may NOT be scientifically validated. You can use all features of CLM, but need to realize that some things haven't been tested extensively or validated scientifically. When you use these features you may run into trouble doing so, and will need to do your own work to make sure the science is reasonable. -------------------------------------------------------------- Standard Configuration and Namelist Options that are Validated -------------------------------------------------------------- See -`http://www.cesm.ucar.edu/models/cesm1.2/clm/CLM_configurations_CESM1.2.pdf `_ for an explanation of what configurations are scientifically validated for +|version|. For CLM4.0 changes to the science of the model are minimal since CESM1.1.1 so we expect answers to be very similar to using it. +`http://www.cesm.ucar.edu/models/cesm1.2/clm/CLM_configurations_CESM1.2.pdf `_ for an explanation of what configurations are scientifically validated for |version|. For CLM4.0 changes to the science of the model are minimal since CESM1.1.1 so we expect answers to be very similar to using it. -In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case you will need to go through more extensive work to validate these options from a scientific standpoint. Some of these options are only for +|version| while others are for both CLM4.0 AND +|version| we explicitly say which they apply to. +In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case you will need to go through more extensive work to validate these options from a scientific standpoint. Some of these options are only for |version| while others are for both CLM4.0 AND |version| we explicitly say which they apply to. --------------------------------------------------------------------------------------------------------------- Configure Modes NOT scientifically validated, documented, supported or, in some cases, even advised to be used: @@ -21,13 +21,13 @@ Configure Modes NOT scientifically validated, documented, supported or, in some These are options that you would add to ``CLM_CONFIG_OPTS``. -1. exlaklayers on[+|version| only] This mode is NOT tested and may NOT be even functional. +1. exlaklayers on[|version| only] This mode is NOT tested and may NOT be even functional. -2. snicar_frc on[CLM4.0 AND +|version|] This mode is tested and functional, but is NOT constantly scientifically validated, and should be considered experimental. +2. snicar_frc on[CLM4.0 AND |version|] This mode is tested and functional, but is NOT constantly scientifically validated, and should be considered experimental. -3. vichydro on[+|version| only] This mode is tested and functional, but does NOT have long scientific validation simulations run with it so, should be considered experimental. +3. vichydro on[|version| only] This mode is tested and functional, but does NOT have long scientific validation simulations run with it so, should be considered experimental. -4. vsoilc_centbgc[+|version| only] This option is extensively tested for both "on" and "off". The "no-vert" option has limited testing performed on it, but isn't scientifically validated (and it currently has a bug -- see 1746 and 1672 in `$CTSMROOT/doc/KnownBugs `_). The "no-cent" and "no-nitrif" options are NOT tested and as such may NOT ben even functional. +4. vsoilc_centbgc[|version| only] This option is extensively tested for both "on" and "off". The "no-vert" option has limited testing performed on it, but isn't scientifically validated (and it currently has a bug -- see 1746 and 1672 in `$CTSMROOT/doc/KnownBugs `_). The "no-cent" and "no-nitrif" options are NOT tested and as such may NOT ben even functional. ---------------------------------------------- Namelist options that should NOT be exercised: diff --git a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst index 30068b600c..bca036a8e9 100644 --- a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst @@ -122,7 +122,7 @@ Example 6-1. Example of running PTCLM1 for US-UMB on cheyenne > ./link_dirtree $CSMDATA $MYCSMDATA # Next build all of the clm tools you will need - > cd ../$CTSMROOT/tools/+|version|/mksurfdata_map + > cd ../$CTSMROOT/tools/|version|/mksurfdata_map > gmake > gmake clean > cd ../../../../../../tools/mapping/gen_domain_files/src diff --git a/doc/source/users_guide/running-PTCLM/using-ptclm.rst b/doc/source/users_guide/running-PTCLM/using-ptclm.rst index 73cf45ff88..fbdd258bbf 100644 --- a/doc/source/users_guide/running-PTCLM/using-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/using-ptclm.rst @@ -48,7 +48,7 @@ Steps in running PTCLM Next you need to make sure all the CLM FORTRAN tools are built. :: - > cd $CTSMROOT/tools/+|version|/mksurfdata_map + > cd $CTSMROOT/tools/|version|/mksurfdata_map > gmake > gmake clean > cd ../../../../../../tools/mapping/gen_domain_files/src diff --git a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst index accc5381a7..e5735a1453 100644 --- a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst @@ -183,7 +183,7 @@ Example: Creating a surface dataset for a single point # Save the location where the domain file was created > setenv GENDOM_PATH `pwd` # Finally create the surface dataset - > cd ../../../../lnd/clm/tools/+|version|/mksurfdata_map/src + > cd ../../../../lnd/clm/tools/|version|/mksurfdata_map/src > gmake > cd .. > ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE @@ -202,7 +202,7 @@ Example: Setting up a case from the single-point surface dataset just created > ./link_dirtree $CSMDATA $MYCSMDATA # Copy the file you created above to your new $MYCSMDATA location following the CLMUSRDAT # naming convention (leave off the creation date) - > cp $CESMROOT/$CTSMROOT/tools/+|version|/mksurfdata_map/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ + > cp $CESMROOT/$CTSMROOT/tools/|version|/mksurfdata_map/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ $MYCSMDATA/lnd/clm2/surfdata_map/surfdata_${GRIDNAME}_simyr1850.nc > cd $CESMROOT/scripts > ./create_newcase -case my_usernldatasets_test -res CLM_USRDAT -compset I1850Clm50BgcCropCru \ diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst index 9065869bb4..5876c2bca2 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst @@ -4,13 +4,13 @@ Spinup of CLM5.0-BGC ===================== -To get the +|version|-BGC model to a steady state, you first run it from arbitrary initial conditions using the "accelerated decomposition spinup" (-bgc_spinup on in CLM **configure**) mode for 1000 simulation years. +To get the |version|-BGC model to a steady state, you first run it from arbitrary initial conditions using the "accelerated decomposition spinup" (-bgc_spinup on in CLM **configure**) mode for 1000 simulation years. After this you branch from this mode in the "final spinup" (-bgc_spinup off in CLM **configure**), and run for (at least 200+ simulation years). **1. 45_AD_SPINUP** For the first step of running 1000+ years in "-bgc_spinup on" mode, you will setup a case, and then edit the values in env_build.xml and env_run.xml so that the right configuration is turned on and the simulation is setup to run for the required length of simulation time. So do the following: -Example:: AD_SPINUP Simulation for +|version|-BGC +Example:: AD_SPINUP Simulation for |version|-BGC -------------------------------------------------------- :: @@ -33,14 +33,14 @@ Example:: AD_SPINUP Simulation for +|version|-BGC # Now run normally > ./BGC_spinup.submit -.. note:: This same procedure works for +|version|-CN as well, you can typically shorten the spinup time from 1000 years to 600 though. +.. note:: This same procedure works for |version|-CN as well, you can typically shorten the spinup time from 1000 years to 600 though. Afterwards save the last restart file from this simulation to use in the next step. -**2. Final spinup for +|version|-BGC** +**2. Final spinup for |version|-BGC** Next save the last restart file from this step and use it as the "finidat" file to use for one more spinup for at least 200+ years in normal mode. So do the following: -Example: Final CLMBGC Spinup Simulation for +|version|-BGC +Example: Final CLMBGC Spinup Simulation for |version|-BGC ------------------------------------------------------------------ :: @@ -69,7 +69,7 @@ Example: Final CLMBGC Spinup Simulation for +|version|-BGC To assess if the model is spunup plot trends of CLMBGC variables of interest. If you see a trend, you may need to run the simulation longer. Finally save the restart file from the end of this simulation to use as an "finidat" file for future simulations. -.. note:: This same final spinup procedure works for +|version|-CN as well, you can typically shorten the spinup time from 200 years to 50 though. +.. note:: This same final spinup procedure works for |version|-CN as well, you can typically shorten the spinup time from 200 years to 50 though. diff --git a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst index f81634d456..d00509e301 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst @@ -128,7 +128,7 @@ You just copy this into your case directory. But, also compare it to the version Once, you've done that you can build and run your case normally. -.. warning:: This procedure assumes you are using a ``I20TRCRUCLM45BGC`` compset out of the box, with ``DATM_PRESAERO`` equal to trans_1850-2000. So it assumes standard +|version| CRUNCEP atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes anything here your ``user_nl_datm`` file will need to be adjusted to work with it. +.. warning:: This procedure assumes you are using a ``I20TRCRUCLM45BGC`` compset out of the box, with ``DATM_PRESAERO`` equal to trans_1850-2000. So it assumes standard |version| CRUNCEP atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes anything here your ``user_nl_datm`` file will need to be adjusted to work with it. .. note:: The intent of the ``user_nl_datm`` is to add an extra streams file for CO2 to the end of the streams variable, and other arrays associated with streams (adding mapalgo as a new array with bilinear for everything, but the CO2 file which should be "nn" for nearest neighbor). Other variables should be the same as the other stream values. diff --git a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst index 3ed3b3f0f1..944a4a93f0 100644 --- a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst +++ b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst @@ -4,7 +4,7 @@ Running the prognostic crop model =================================== -The prognostic crop model is setup to work with +|version|-BGC or CLM4.0-CN (with or without DV) for present day conditions and we have surface and initial condition datasets at f19 resolution. +The prognostic crop model is setup to work with |version|-BGC or CLM4.0-CN (with or without DV) for present day conditions and we have surface and initial condition datasets at f19 resolution. In order to use the initial condition file, we need to set the ``RUN_TYPE`` to startup rather than ``hybrid`` since the compset for f19 sets up to use an initial condition file without crop active. To activate the crop model you can choose a compset that has "CROP" in the name such as "ICRUCLM45BGCCROP" or simply add "-crop on" to ``CLM_CONFIG_OPTS``. diff --git a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst index feef7d0bd4..767836c180 100644 --- a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst +++ b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst @@ -4,8 +4,8 @@ Running with irrigation =================================== -In +|version| irrigation can ONLY be used WITH crop. -To turn on irrigation in +|version| we simply add "-irrig on" to ``CLM_BLDNML_OPTS``. +In |version| irrigation can ONLY be used WITH crop. +To turn on irrigation in |version| we simply add "-irrig on" to ``CLM_BLDNML_OPTS``. Just as in the crop example we also change ``RUN_TYPE`` to ``startup`` so that we don't use an initial condition file that is incompatible with irrigation. Example: Irrigation Simulation diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst index 4e211894d6..23845b1da7 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst @@ -4,7 +4,7 @@ Customizing CLM's Configuration ******************************* -The "Creating a Case" section of the `+|cesmrelease| Scripts User's-Guide `_ gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. +The "Creating a Case" section of the `|cesmrelease| Scripts User's-Guide `_ gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. For CLM when **preview_namelist**, **$CASE.build**, or **$CASE.run** are called there are two steps that take place: @@ -14,7 +14,7 @@ For CLM when **preview_namelist**, **$CASE.build**, or **$CASE.run** are called When customizing your case at the *8cesm_setup** step you are able to modify the process by effecting either one or both of these steps. The CLM "**configure**" and "**build-namelist**" scripts are both available in the "$CTSMROOT/bld" directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what types of options you can give either of them. -There are five different types of customization for the configuration that we will discuss: +|version| in +|cesmrelease| build-time options, +|version| in +|cesmrelease| run-time options, User Namelist, other noteworthy +|cesmrelease| configuration items, the CLM **configure** script options, and the CLM **build-namelist** script options. +There are five different types of customization for the configuration that we will discuss: |version| in |cesmrelease| build-time options, |version| in |cesmrelease| run-time options, User Namelist, other noteworthy |cesmrelease| configuration items, the CLM **configure** script options, and the CLM **build-namelist** script options. Information on all of the script, configuration, build and run items is found under ``scripts/ccsm_utils/Case.template`` in the `config_definition.xml `_ file. @@ -179,7 +179,7 @@ CLM_BLDNML_OPTS -inputdata "filepath" Writes out a list containing pathnames for required input datasets in file specified. - -irrig "value" If .true. turn irrigation on with namelist logical irrigate (for +|version| physics) + -irrig "value" If .true. turn irrigation on with namelist logical irrigate (for |version| physics) (requires crop to be on in the clm configuration) Seek surface datasets with irrigation turned on. (for CLM4.0 physics) Default: .false. @@ -284,7 +284,7 @@ Hence only the following different options can be set: #. -verbose -"-bgc_spinup" is an option only available for +|version| for any configuration when CN is turned on (so either CLMCN or CLMBGC). It can be set to "on" or "off". If "on" the model will go into Accelerated Decomposition mode, while for "off" (the default) it will have standard decomposition rates. If you are starting up from initial condition files the model will check what mode the initial condition file is in and do the appropriate action on the first time-step to change the Carbon pools to the appropriate spinup setting. See `the Section called Spinning up the +|version| biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for an example using this option. +"-bgc_spinup" is an option only available for |version| for any configuration when CN is turned on (so either CLMCN or CLMBGC). It can be set to "on" or "off". If "on" the model will go into Accelerated Decomposition mode, while for "off" (the default) it will have standard decomposition rates. If you are starting up from initial condition files the model will check what mode the initial condition file is in and do the appropriate action on the first time-step to change the Carbon pools to the appropriate spinup setting. See `the Section called Spinning up the |version| biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for an example using this option. "-chk_res" ensures that the resolution chosen is supported by CLM. If the resolution is NOT supported it will cause the CLM **build-namelist** to abort when run. So when either **preview_namelist**, **$CASE.build** or **$CASE.run** is executed it will abort early. Since, the CESM scripts only support certain resolutions anyway, in general this option is NOT needed in the context of running CESM cases. @@ -530,7 +530,7 @@ If you are running an B, E, or F case that doesn't use the DATM obviously the DA CPLHIST3HrWx ``CLMCRUNCEP`` - The standard mode for +|version| of using global atmospheric data that was developed by CRU using NCEP data from 1901 to 2010. + The standard mode for |version| of using global atmospheric data that was developed by CRU using NCEP data from 1901 to 2010. See `the Section called CLMCRUNCEP mode and it's DATM settings `_ for more information on the DATM settings for ``CLMCRUNCEP`` mode. ``CLM_QIAN`` @@ -632,7 +632,7 @@ The output to the above command is as follows: (default: CLM build directory). -clm4me Turn Methane model: [on | off] Requires bgc=cn/cndv (Carbon Nitrogen model) - (ONLY valid for +|version|!) + (ONLY valid for |version|!) -clm_root Root directory of clm source code (default: directory above location of this script) -cppdefs A string of user specified CPP defines. Appended to @@ -647,12 +647,12 @@ The output to the above command is as follows: Parameters relating to the build which are system dependent will be ignored. -exlaklayers Turn on extra lake layers (25 layers instead of 10) [on | off] - (ONLY valid for +|version|!) + (ONLY valid for |version|!) -help [or -h] Print usage to STDOUT. -nofire Turn off wildfires for BGC setting of CN (default includes fire for CN) -noio Turn history output completely off (typically for testing). - -phys Value of clm4_0 or +|version| (default is clm4_0) + -phys Value of clm4_0 or |version| (default is clm4_0) -silent [or -s] Turns on silent mode - only fatal messages issued. -sitespf_pt Setup for the given site specific single-point resolution. -snicar_frc Turn on SNICAR radiative forcing calculation. [on | off] @@ -676,7 +676,7 @@ The output to the above command is as follows: eliminate inconsistent duplicate soil hydraulic parameters used in soil biogeochem. (requires either CN or CNDV) - (ONLY valid for +|version|!) + (ONLY valid for |version|!) [on,off or colon delimited list of no options] (default off) no-vert Turn vertical soil Carbon profile off no-cent Turn CENTURY off diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst index 2300c8ad60..256397329e 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst @@ -16,16 +16,16 @@ Definition of Namelist items and their default values Here we point to you where you can find the definition of each namelist item and separately the default values for them. The default values may change depending on the resolution, land-mask, simulation-year and other attributes. Both of these files are viewable in your web browser, and then expand each in turn. -1. `Definition of Namelists Relevant for +|version| `_ +1. `Definition of Namelists Relevant for |version| `_ 2. `Default values of each CLM4.0 Namelist Item `_ -3. `Default values of each +|version| Namelist Item `_ +3. `Default values of each |version| Namelist Item `_ List of fields that can be added to your output history files by namelist ------------------------------------------------------------------------- -One set of the namelist items allows you to add fields to the output history files: ``hist_fincl1``, ``hist_fincl2``, ``hist_fincl3``, ``hist_fincl4``, ``hist_fincl5``, and ``hist_fincl6``. The following links for `CLM4.0 History Fields `_ and `+|version| History Fields `_ documents all of the history fields available and gives the long-name and units for each. The table below lists all the +|version| history fields. +One set of the namelist items allows you to add fields to the output history files: ``hist_fincl1``, ``hist_fincl2``, ``hist_fincl3``, ``hist_fincl4``, ``hist_fincl5``, and ``hist_fincl6``. The following links for `CLM4.0 History Fields `_ and `|version| History Fields `_ documents all of the history fields available and gives the long-name and units for each. The table below lists all the |version| history fields. Definition of CLM history variables ----------------------------------- diff --git a/doc/source/users_guide/testing/testing.rst b/doc/source/users_guide/testing/testing.rst index d41124f8ba..55f5ad2ed7 100644 --- a/doc/source/users_guide/testing/testing.rst +++ b/doc/source/users_guide/testing/testing.rst @@ -44,7 +44,7 @@ We already have a standard list of tests for clm (the "aux_clm" list of tests). > ./cs.status.$id # The above will give a PASS or FAIL message for each test. -For more information on doing testing with the CESM scripts see the `+|cesmrelease| User's Guide `_ on testing. +For more information on doing testing with the CESM scripts see the `|cesmrelease| User's Guide `_ on testing. Testing PTCLM ============= diff --git a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst index 625865b7c1..3a30659752 100644 --- a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst +++ b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst @@ -18,7 +18,7 @@ Setup Problems The first type of problem happens when you invoke the **case.setup** command. This indicates there is something wrong with your input datasets, or the details of what you are trying to setup the model to do. -There's also a trouble-shooting chapter in the `+|cesmrelease| Scripts User's Guide `_. +There's also a trouble-shooting chapter in the `|cesmrelease| Scripts User's Guide `_. Many of the problems with configuration can be resolved with the guidelines given there. Here we will restrict ourselves to problems from the input files. diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index 006c6b679b..848b96131f 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -49,7 +49,7 @@ Hence, there doesn't need to be a different mapping file for EACH raw dataset -- See `Figure 2-3 `_ for a visual representation of how this works. The bash script figures out which mapping files it needs to create and then runs **ESMF_RegridWeightGen** for each one. You can then either enter the datasets into the XML database (see `Chapter 3 `_ or leave the files in place, and use the "-res usrspec -usr_gname -usr_gdate" options to **mksurfdata_map** (see `the Section called Running mksurfdata.pl `_ below). -Use the "-phys" option to specify if you are creating mapping files for clm4_0 or +|version| (the list of raw datafiles is somewhat different between the two). +Use the "-phys" option to specify if you are creating mapping files for clm4_0 or |version| (the list of raw datafiles is somewhat different between the two). mkmapdata.sh has a help option with the following :: @@ -74,8 +74,8 @@ mkmapdata.sh has a help option with the following Model output grid type supported values are [regional,global], (default is global) [-p|--phys ] - Whether to generate mapping files for clm4_0 or +|version| - supported values are [clm4_0,+|version|], (default is +|version|) + Whether to generate mapping files for clm4_0 or |version| + supported values are [clm4_0,|version|], (default is |version|) [-b|--batch] Toggles batch mode usage. If you want to run in batch mode @@ -107,7 +107,7 @@ mkmapdata.sh has a help option with the following ********************** -.. warning:: Make sure you specify with the "-phys" option if you are creating files for CLM4.0! The default is +|version|. +.. warning:: Make sure you specify with the "-phys" option if you are creating files for CLM4.0! The default is |version|. Figure 2-3. Details of running mkmapdata.sh ------------------------------------------- diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index ae90a3609b..4675720af1 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -37,7 +37,7 @@ Creating a Complete Set of Files for Input to CLM 4. Create surface datasets - Next use mksurfdata_map to create a surface dataset, using the mapping datasets created on the previous step as input. There is a version for either clm4_0 or +|version| for this program. See the Section called Using mksurfdata_map to create surface datasets from grid datasets for more information on this. + Next use mksurfdata_map to create a surface dataset, using the mapping datasets created on the previous step as input. There is a version for either clm4_0 or |version| for this program. See the Section called Using mksurfdata_map to create surface datasets from grid datasets for more information on this. 5. Create some sort of initial condition dataset @@ -49,11 +49,11 @@ Creating a Complete Set of Files for Input to CLM b. Use interpinic to interpolate existing initial condition datasets - The next option is to interpolate from spunup datasets at a different resolution, using interpinic. There is a version for either clm4_0 or +|version| for this program. See the Section called Using interpinic to interpolate initial conditions to different resolutions for more information on this. + The next option is to interpolate from spunup datasets at a different resolution, using interpinic. There is a version for either clm4_0 or |version| for this program. See the Section called Using interpinic to interpolate initial conditions to different resolutions for more information on this. c. Start up from arbitrary initial conditions - The last alternative is to run from arbitrary initial conditions without using any spun-up datasets. This is inappropriate when using +|version|-BGC or CLMCN (bgc=cn or cndv) as it takes a long time to spinup Carbon pools. + The last alternative is to run from arbitrary initial conditions without using any spun-up datasets. This is inappropriate when using |version|-BGC or CLMCN (bgc=cn or cndv) as it takes a long time to spinup Carbon pools. .. warning:: This is NOT recommended as many fields in CLM take a long time to equilibrate. diff --git a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst index 4bb40f21c6..59d7776016 100644 --- a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst @@ -10,8 +10,8 @@ Most of the tools are FORTRAN stand-alone programs in their own directory, but t Some of the NCL scripts are very specialized and not meant for general use, and we won't document them here. They still contain documentation in the script itself and the README file in the tools directory. -The tools are divided into three directories for three categories: clm4_0, +|version|, and shared. -The first two are of course for tools that are designed to work with either the CLM4.0 or +|version| versions of the model. +The tools are divided into three directories for three categories: clm4_0, |version|, and shared. +The first two are of course for tools that are designed to work with either the CLM4.0 or |version| versions of the model. The last one are shared utilities that can be used by either, or have a "-phys" option so you can specify which version you want to use. The list of generally important scripts and programs are as follows. @@ -24,9 +24,9 @@ The list of generally important scripts and programs are as follows. #. *./gen_domain* to create a domain file for datm from a mapping file. The domain file is then used by BOTH datm AND CLM to define the grid and land-mask. -#. *mksurfdata_map* to create surface datasets from grid datasets (clm4_0 and +|version| versions). +#. *mksurfdata_map* to create surface datasets from grid datasets (clm4_0 and |version| versions). -#. *./mkprocdata_map* to interpolate output unstructured grids (such as the CAM HOMME dy-core "ne" grids like ne30np4) into a 2D regular lat/long grid format that can be plotted easily. Can be used by either clm4_0 or +|version|. +#. *./mkprocdata_map* to interpolate output unstructured grids (such as the CAM HOMME dy-core "ne" grids like ne30np4) into a 2D regular lat/long grid format that can be plotted easily. Can be used by either clm4_0 or |version|. In the sections to come we will go into detailed description of how to use each of these tools in turn. First, however we will discuss the common environment variables and options that are used by all of the FORTRAN tools. From 9dfe4bd350ca1cf3d0f957d28642ef4e001937e1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Jun 2018 12:21:59 -0600 Subject: [PATCH 0189/1973] Add substitution file to get substitutions properly working for UG, checkin of new UG html --- ...esolutions-or-New-Files-to-the-build-namelist-Database.rst | 2 ++ .../CLM-3.1-Managing-Your-Own-Data-files.rst | 2 ++ .../CLM-3.2-Adding-Resolution-Names.rst | 2 ++ .../CLM-3.3-Adding-or-Changing-Default-Filenames.rst | 2 ++ doc/source/users_guide/adding-new-resolutions/index.rst | 2 ++ doc/source/users_guide/index.rst | 2 +- doc/source/users_guide/overview/getting-help.rst | 2 ++ doc/source/users_guide/overview/index.rst | 2 ++ doc/source/users_guide/overview/introduction.rst | 2 ++ doc/source/users_guide/overview/quickstart.rst | 2 ++ doc/source/users_guide/overview/scientific_validation.rst | 2 ++ .../users_guide/running-PTCLM/adding-ptclm-site-data.rst | 2 ++ doc/source/users_guide/running-PTCLM/index.rst | 2 ++ .../users_guide/running-PTCLM/introduction-to-ptclm.rst | 2 ++ doc/source/users_guide/running-PTCLM/ptclm-examples.rst | 2 ++ doc/source/users_guide/running-PTCLM/using-ptclm.rst | 2 ++ doc/source/users_guide/running-single-points/index.rst | 2 ++ .../running-single-points/running-pts_mode-configurations.rst | 2 ++ .../running-single-point-configurations.rst | 2 ++ .../single-point-and-regional-grid-configurations.rst | 2 ++ ...inning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst | 2 ++ ...Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst | 2 ++ ...h-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst | 2 ++ ...-simulation-as-atmospheric-forcing-to-spinup-the-model.rst | 2 ++ ...-alone-CLM-with-transient-historical-CO2-concentration.rst | 2 ++ doc/source/users_guide/running-special-cases/index.rst | 2 ++ .../running-the-prognostic-crop-model.rst | 2 ++ .../running-special-cases/running-with-irrigation.rst | 2 ++ .../running-special-cases/what-is-a-special-case.rst | 2 ++ .../setting-up-and-running-a-case/choosing-a-compset.rst | 2 ++ .../customizing-the-clm-configuration.rst | 4 +++- .../customizing-the-clm-namelist.rst | 2 ++ .../customizing-the-datm-namelist.rst | 2 ++ .../users_guide/setting-up-and-running-a-case/index.rst | 2 ++ doc/source/users_guide/substitutions.rst | 2 ++ doc/source/users_guide/testing/index.rst | 2 ++ doc/source/users_guide/testing/testing.rst | 2 ++ doc/source/users_guide/trouble-shooting/index.rst | 2 ++ doc/source/users_guide/trouble-shooting/trouble-shooting.rst | 2 ++ .../users_guide/using-clm-tools/building-the-clm-tools.rst | 2 ++ doc/source/users_guide/using-clm-tools/cprnc.rst | 2 ++ .../users_guide/using-clm-tools/creating-domain-files.rst | 2 ++ .../creating-input-for-surface-dataset-generation.rst | 2 ++ .../users_guide/using-clm-tools/creating-surface-datasets.rst | 2 ++ .../using-clm-tools/datasts-for-observational-sites.rst | 2 ++ doc/source/users_guide/using-clm-tools/index.rst | 2 ++ .../using-clm-tools/observational-sites-datasets.rst | 2 ++ .../users_guide/using-clm-tools/what-are-the-clm-tools.rst | 2 ++ 48 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 doc/source/users_guide/substitutions.rst diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst index 60137563db..76d8a7aef1 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst @@ -1,5 +1,7 @@ .. _adding-resolutions: +.. include:: ../substitutions.rst + ======================== Adding New Resolutions ======================== diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst index 6d4a65657e..41ccdde35b 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst @@ -1,5 +1,7 @@ .. _managing-your-data-files: +.. include:: ../substitutions.rst + ============================== Managing Your Data Own Files ============================== diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst index b9b767ca06..aa8265e8a9 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst @@ -1,5 +1,7 @@ .. _adding-resolution-names: +.. include:: ../substitutions.rst + ========================= Adding Resolution Names ========================= diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst index 4c8c9884de..52344bd5a0 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst @@ -1,5 +1,7 @@ .. _changing-default-filenames: +.. include:: ../substitutions.rst + ============================ Changing Default Filenames ============================ diff --git a/doc/source/users_guide/adding-new-resolutions/index.rst b/doc/source/users_guide/adding-new-resolutions/index.rst index c01aa36ca0..fded236989 100644 --- a/doc/source/users_guide/adding-new-resolutions/index.rst +++ b/doc/source/users_guide/adding-new-resolutions/index.rst @@ -5,6 +5,8 @@ .. _adding-new-resolutions-section: +.. include:: ../substitutions.rst + ##################################### Adding New Resolutions ##################################### diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst index 625bd84107..31d00bcb38 100644 --- a/doc/source/users_guide/index.rst +++ b/doc/source/users_guide/index.rst @@ -5,7 +5,7 @@ .. _users-guide: -.. |cesmrelease| replace:: CESM2.0.0 +.. include:: substitutions.rst ##################################### |version| User's Guide diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst index f5e5a0f059..aafeb057f5 100644 --- a/doc/source/users_guide/overview/getting-help.rst +++ b/doc/source/users_guide/overview/getting-help.rst @@ -1,5 +1,7 @@ .. _getting-help: +.. include:: ../substitutions.rst + ============== Getting Help ============== diff --git a/doc/source/users_guide/overview/index.rst b/doc/source/users_guide/overview/index.rst index 1f31037460..b03eae4034 100644 --- a/doc/source/users_guide/overview/index.rst +++ b/doc/source/users_guide/overview/index.rst @@ -5,6 +5,8 @@ .. _overview_section: +.. include:: ../substitutions.rst + ##################################### Overview ##################################### diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index a7e1f6c050..7dd868b3f7 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -1,5 +1,7 @@ .. _introduction: +.. include:: ../substitutions.rst + **User's Guide to version |version| of the Community Land Model (CLM)** **Authors: Benjamin Andre, Erik Kluzek, William Sacks** diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst index 935934f6c5..3c9964ee38 100644 --- a/doc/source/users_guide/overview/quickstart.rst +++ b/doc/source/users_guide/overview/quickstart.rst @@ -1,5 +1,7 @@ .. _quickstart: +.. include:: ../substitutions.rst + ============ Quickstart ============ diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst index d96eb29bf4..b7e80c4b37 100644 --- a/doc/source/users_guide/overview/scientific_validation.rst +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -1,5 +1,7 @@ .. _scientific-validiation: +.. include:: ../substitutions.rst + ======================== Scientific Validation ======================== diff --git a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst index 1e7a5437eb..425e6d9c25 100644 --- a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst +++ b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst @@ -1,5 +1,7 @@ .. _adding-ptclm-site-data: +.. include:: ../substitutions.rst + ====================== Adding PTCLM Site Data ====================== diff --git a/doc/source/users_guide/running-PTCLM/index.rst b/doc/source/users_guide/running-PTCLM/index.rst index d82b7f9624..26e18d3a73 100644 --- a/doc/source/users_guide/running-PTCLM/index.rst +++ b/doc/source/users_guide/running-PTCLM/index.rst @@ -5,6 +5,8 @@ .. _running-PTCLM: +.. include:: ../substitutions.rst + ##################################### Running PTCLM ##################################### diff --git a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst index bca036a8e9..0c49f6ad78 100644 --- a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst @@ -1,5 +1,7 @@ .. _introduction-to-ptclm.rst: +.. include:: ../substitutions.rst + .. _what-is-ptclm: =============== diff --git a/doc/source/users_guide/running-PTCLM/ptclm-examples.rst b/doc/source/users_guide/running-PTCLM/ptclm-examples.rst index 172f041420..d3d85da0b1 100644 --- a/doc/source/users_guide/running-PTCLM/ptclm-examples.rst +++ b/doc/source/users_guide/running-PTCLM/ptclm-examples.rst @@ -1,5 +1,7 @@ .. _ptclm-examples: +.. include:: ../substitutions.rst + ========================= Examples of using PTCLM ========================= diff --git a/doc/source/users_guide/running-PTCLM/using-ptclm.rst b/doc/source/users_guide/running-PTCLM/using-ptclm.rst index fbdd258bbf..2055cc81a1 100644 --- a/doc/source/users_guide/running-PTCLM/using-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/using-ptclm.rst @@ -1,5 +1,7 @@ .. _using-ptclm.rst: +.. include:: ../substitutions.rst + ************************** Using PTCLM ************************** diff --git a/doc/source/users_guide/running-single-points/index.rst b/doc/source/users_guide/running-single-points/index.rst index 2c4ea71bdb..e1d955ac0a 100644 --- a/doc/source/users_guide/running-single-points/index.rst +++ b/doc/source/users_guide/running-single-points/index.rst @@ -5,6 +5,8 @@ .. _running-single-points: +.. include:: ../substitutions.rst + ##################################### Running Single Point Regional Cases ##################################### diff --git a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst index ca794ac326..c7a1ed0def 100644 --- a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst @@ -1,5 +1,7 @@ .. _pts_mode: +.. include:: ../substitutions.rst + **************************************************** Running a single point using global data - PTS_MODE **************************************************** diff --git a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst index e5735a1453..6a2dc4e44d 100644 --- a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst @@ -1,5 +1,7 @@ .. _running-single-point-datasets: +.. include:: ../substitutions.rst + ****************************************** Running Single Point Configurations ****************************************** diff --git a/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst b/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst index a1514768ee..41f55e38f1 100644 --- a/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst +++ b/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst @@ -1,5 +1,7 @@ .. _single-point-configurations: +.. include:: ../substitutions.rst + ***************************************** Single and Regional Grid Configurations ***************************************** diff --git a/doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst index 7c8bd313c5..a017c42ae0 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst @@ -1,5 +1,7 @@ .. _spinning-up-sp: +.. include:: ../substitutions.rst + =========================================== Spinning up the Satellite Phenology Model =========================================== diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst index 5876c2bca2..99fa3fdd47 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst @@ -1,5 +1,7 @@ .. _spinning-up-clm45-bgc: +.. include:: ../substitutions.rst + ===================== Spinup of CLM5.0-BGC ===================== diff --git a/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst index 36f2266493..deb5fa1238 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst @@ -1,5 +1,7 @@ .. _running-with-moar-data: +.. include:: ../substitutions.rst + ======================== Running with MOAR data ======================== diff --git a/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst index 5cad7c1c5e..0999f7b366 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst @@ -1,5 +1,7 @@ .. _running-with-previous-simulation-forcing: +.. include:: ../substitutions.rst + ============================================================= Running with atmospheric forcing from a previous simulation ============================================================= diff --git a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst index d00509e301..b7d063a2a2 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst @@ -1,5 +1,7 @@ .. _running-with-historical-co2-forcing: +.. include:: ../substitutions.rst + ===================================== Running with historical CO2 forcing ===================================== diff --git a/doc/source/users_guide/running-special-cases/index.rst b/doc/source/users_guide/running-special-cases/index.rst index 693c83d550..18ef7a96b0 100644 --- a/doc/source/users_guide/running-special-cases/index.rst +++ b/doc/source/users_guide/running-special-cases/index.rst @@ -5,6 +5,8 @@ .. _running-special-cases-section: +.. include:: ../substitutions.rst + ##################################### Running Special Cases ##################################### diff --git a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst index 944a4a93f0..308c749adc 100644 --- a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst +++ b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst @@ -1,5 +1,7 @@ .. running-prognostic-crop-model: +.. include:: ../substitutions.rst + =================================== Running the prognostic crop model =================================== diff --git a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst index 767836c180..3a7b0e3ccf 100644 --- a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst +++ b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst @@ -1,5 +1,7 @@ .. running-with-irrigation: +.. include:: ../substitutions.rst + =================================== Running with irrigation =================================== diff --git a/doc/source/users_guide/running-special-cases/what-is-a-special-case.rst b/doc/source/users_guide/running-special-cases/what-is-a-special-case.rst index 32daabafc6..5a42858818 100644 --- a/doc/source/users_guide/running-special-cases/what-is-a-special-case.rst +++ b/doc/source/users_guide/running-special-cases/what-is-a-special-case.rst @@ -1,5 +1,7 @@ .. _what is a special case: +.. include:: ../substitutions.rst + ========================= What is a special case? ========================= diff --git a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst index 38bfcd7da1..df702e0185 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst @@ -1,5 +1,7 @@ .. _choosing-a-compset: +.. include:: ../substitutions.rst + ==================== Choosing a compset ==================== diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst index 23845b1da7..38f61c2c4d 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst @@ -1,10 +1,12 @@ .. _configuring-clm: +.. include:: ../substitutions.rst + ******************************* Customizing CLM's Configuration ******************************* -The "Creating a Case" section of the `|cesmrelease| Scripts User's-Guide `_ gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. +The "Creating a Case" section of the |cesmrelease| `Scripts User's-Guide `_ gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. For CLM when **preview_namelist**, **$CASE.build**, or **$CASE.run** are called there are two steps that take place: diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst index 256397329e..41eec17598 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst @@ -1,5 +1,7 @@ .. _customizing-a-case: +.. include:: ../substitutions.rst + ============================ Customizing CLM's namelist ============================ diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst index 8cf0916717..4140dad87a 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst @@ -1,5 +1,7 @@ .. customizing-the-datm-namelist: +.. include:: ../substitutions.rst + =============================== Customizing the DATM namelist =============================== diff --git a/doc/source/users_guide/setting-up-and-running-a-case/index.rst b/doc/source/users_guide/setting-up-and-running-a-case/index.rst index a9c1cb7d13..3fb9a41391 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/index.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/index.rst @@ -5,6 +5,8 @@ .. _customizing_section: +.. include:: ../substitutions.rst + ##################################### Setting Up and Running a Case ##################################### diff --git a/doc/source/users_guide/substitutions.rst b/doc/source/users_guide/substitutions.rst new file mode 100644 index 0000000000..821ebb071e --- /dev/null +++ b/doc/source/users_guide/substitutions.rst @@ -0,0 +1,2 @@ +.. |cesmrelease| replace:: CESM2.0.0 + diff --git a/doc/source/users_guide/testing/index.rst b/doc/source/users_guide/testing/index.rst index 09575a1442..b9e99506e1 100644 --- a/doc/source/users_guide/testing/index.rst +++ b/doc/source/users_guide/testing/index.rst @@ -5,6 +5,8 @@ .. _testing_section: +.. include:: ../substitutions.rst + ##################################### Testing ##################################### diff --git a/doc/source/users_guide/testing/testing.rst b/doc/source/users_guide/testing/testing.rst index 55f5ad2ed7..0594bc9157 100644 --- a/doc/source/users_guide/testing/testing.rst +++ b/doc/source/users_guide/testing/testing.rst @@ -1,5 +1,7 @@ .. _testing: +.. include:: ../substitutions.rst + ******* Testing ******* diff --git a/doc/source/users_guide/trouble-shooting/index.rst b/doc/source/users_guide/trouble-shooting/index.rst index f4c6d813fc..64b0cecee3 100644 --- a/doc/source/users_guide/trouble-shooting/index.rst +++ b/doc/source/users_guide/trouble-shooting/index.rst @@ -5,6 +5,8 @@ .. _troubleshooting: +.. include:: ../substitutions.rst + ##################################### Troubleshooting ##################################### diff --git a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst index 3a30659752..c7e38cf645 100644 --- a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst +++ b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst @@ -1,5 +1,7 @@ .. _trouble-shooting: +.. include:: ../substitutions.rst + ********************* Trouble Shooting ********************* diff --git a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst index 4f51314d48..1dd1129b6c 100644 --- a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst @@ -2,6 +2,8 @@ Building the CLM tools ======================== +.. include:: ../substitutions.rst + The FORTRAN tools all have similar makefiles, and similar options for building. All of the Makefiles use GNU Make extensions and thus require that you use GNU make to use them. They also auto detect the type of platform you are on, using "uname -s" and set the compiler, compiler flags and such accordingly. diff --git a/doc/source/users_guide/using-clm-tools/cprnc.rst b/doc/source/users_guide/using-clm-tools/cprnc.rst index 53169513f0..de90f7a88e 100644 --- a/doc/source/users_guide/using-clm-tools/cprnc.rst +++ b/doc/source/users_guide/using-clm-tools/cprnc.rst @@ -1,5 +1,7 @@ .. comparing-history-files: +.. include:: ../substitutions.rst + ========================= Comparing History Files ========================= diff --git a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst index 6d4ec7bc12..d72427d3d5 100644 --- a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst +++ b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst @@ -1,5 +1,7 @@ .. _creating-domain-files: +.. include:: ../substitutions.rst + ***************************** Creating CLM domain files ***************************** diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index 848b96131f..dcfcbbbdff 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -1,5 +1,7 @@ .. _creating-maps-for-mksurfdata: +.. include:: ../substitutions.rst + ********************************************* Creating input for surface dataset generation ********************************************* diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index 4675720af1..f2cb8eed4d 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -1,5 +1,7 @@ .. _creating-surface-datasets: +.. include:: ../substitutions.rst + =========================== Creating Surface Datasets =========================== diff --git a/doc/source/users_guide/using-clm-tools/datasts-for-observational-sites.rst b/doc/source/users_guide/using-clm-tools/datasts-for-observational-sites.rst index d1824d432e..7fb915a6ed 100644 --- a/doc/source/users_guide/using-clm-tools/datasts-for-observational-sites.rst +++ b/doc/source/users_guide/using-clm-tools/datasts-for-observational-sites.rst @@ -1,3 +1,5 @@ +.. include:: ../substitutions.rst + ================================== Datasets for Observational Sites ================================== diff --git a/doc/source/users_guide/using-clm-tools/index.rst b/doc/source/users_guide/using-clm-tools/index.rst index 030cda7495..58435f92aa 100644 --- a/doc/source/users_guide/using-clm-tools/index.rst +++ b/doc/source/users_guide/using-clm-tools/index.rst @@ -5,6 +5,8 @@ .. _using-clm-tools-section: +.. include:: ../substitutions.rst + ##################################### Using CLM tools ##################################### diff --git a/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst b/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst index b5e47e861f..b5cc2efad9 100644 --- a/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst @@ -1,5 +1,7 @@ .. _observational-sites-datasets: +.. include:: ../substitutions.rst + ******************************* Observational Sites Datasets ******************************* diff --git a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst index 59d7776016..3c67965e73 100644 --- a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst @@ -1,5 +1,7 @@ .. _what-are-the-clm-tools: +.. include:: ../substitutions.rst + ======================== What are the CLM tools ======================== From 565a93f7f55744b41e685f40279fbb4ae9e17343 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Jun 2018 15:32:10 -0600 Subject: [PATCH 0190/1973] More updates, add today's date under UG index --- doc/source/users_guide/conf.py | 3 + doc/source/users_guide/index.rst | 2 + .../users_guide/overview/introduction.rst | 55 ++++++++++------ .../users_guide/overview/quickstart.rst | 14 ++--- .../overview/scientific_validation.rst | 62 ------------------- doc/source/users_guide/substitutions.rst | 3 + 6 files changed, 48 insertions(+), 91 deletions(-) diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py index c717685979..b8e187efd5 100644 --- a/doc/source/users_guide/conf.py +++ b/doc/source/users_guide/conf.py @@ -63,6 +63,9 @@ # The full version, including alpha/beta/rc tags. release = u'release-clm5.0.01' +# The format to print out today in +today_fmt = u'%Y-%m-%D %H:%M' + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst index 31d00bcb38..f4cf0e5123 100644 --- a/doc/source/users_guide/index.rst +++ b/doc/source/users_guide/index.rst @@ -23,3 +23,5 @@ running-PTCLM/index.rst trouble-shooting/index.rst testing/index.rst + +Documentation was built: |today| diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index 7dd868b3f7..9705057439 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -14,7 +14,7 @@ are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. National Center for Atmospheric Research -P. O. Box 3000, Boulder, Colorado 80307-300 +P. O. Box 3000, Boulder, Colorado 80307-3000 .. _rst_Users_Guide_Introduction: @@ -37,12 +37,13 @@ is information in the ChangeLog file and in the `What is new with regarding the changes from previous versions of CESM. .. note:: This release of |version| in |cesmrelease| includes BOTH CLM4.0 - physics used in previous releases as well as the updated |version| - physics. Both CLM as well as CLM support tools allow you to trigger - between the two physics modes. Most often when we refer to CLM4.0 we + physics and CLM4.5 physics used in previous releases as well as the updated |version| + physics. CLM allow you to trigger between the three physics modes. Most often when we refer to CLM4.0 we are referring to the CLM4.0 physics in |version| in |cesmrelease| rather than to a specific version of CLM4.0 (where we would give the exact - version). Likewise, when referring to |version| we are referring to the + version). And when we refer to CLM4.5 we are referring to the CLM4.5 + physics in |version| in |cesmrelease| rather + than to a specific version of CLM4.5. Likewise, when referring to |version| we are referring to the |version| physics in |version| in |cesmrelease|. The novice user should read `Chapter 1 `_ in detail before @@ -88,11 +89,10 @@ machine is working correctly. ============================ `What's new with |version| science `_ -The |cesmrelease| `What's New Science `_ and `What's New Software `_ pages gives a synopsis of the changes to all CESM components since the CESM1.1.1 release. +gives a synopsis of the changes to CLM since the CLM4.5 release. More details are given in the `CLM ChangeLog file `_. Previous release pages give similar list of changes for previous versions of the model. -The `CLM4 in CESM1.0.5 User's Guide `_ gives information on the updates for versions up to CLM4 in CESM1.0.5. .. _users-guide-overview: @@ -102,23 +102,23 @@ The `CLM4 in CESM1.0.5 User's Guide `_ gives information on the updates In this introduction we first give a simple guide to understand the document conventions in `How to Use This Document `_. The next section `What is new with |version| in |cesmrelease| since previous public releases? `_ gives references to describe the differences between |version| in |cesmrelease| and previous CESM releases both from a scientific as well as a software engineering point of view. -For information on previous releases of |version| before |version| in |cesmrelease| see the CESM1.1.1 documentation. +For information on previous releases of |version| before |version| in |cesmrelease| see the CESM1.2.2 documentation. The next section `Quickstart to using |version| `_ is for users that are already experts in using CLM and gives a quickstart guide to the bare details on how to use |version|. The next `What is scientifically validated and functional in |version| in |cesmrelease|? `_ tells you about what has been extensively tested and scientifically validated (and maybe more importantly) what has NOT. `What are the UNIX utilities required to use |version|? `_ lists the UNIX utilities required to use |version| and is important if you are running on non-NCAR machines, generic local machines, or machines NOT as well tested by us at NCAR. Next we have `Important Notes and Best Practices for Usage of |version| `_ to detail some of the best practices for using |version| for science. -The last introductory section is `Other resources `_ to get help from which lists different resources for getting help with CESM1.0 and |version|. +The last introductory section is `Other resources `_ to get help from which lists different resources for getting help with |version| and |cesmrelease|. `Chapter 1 `_ goes into detail on how to setup and run simulations with |version| and especially how to customize cases. Details of cesm_setup modes and build-namelist options as well as namelist options are given in this chapter. -`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.0 or |version| physics for creating input datasets for use by CLM, for the expert user. +`Chapter 2 `_ gives instructions on the CLM tools for either CLM4.5 or |version| physics for creating input datasets for use by CLM, for the expert user. There's an overview of what each tool does, and some general notes on how to build the FORTRAN tools. Then each tool is described in detail along with different ways in which the tool might be used. A final section on how to customize datasets for observational sites for very savvy expert users is given as the last section of this chapter. As a followup to the tools chapter, `Chapter 3 `_ tells how to add files to the XML database for build-namelist to use. -This is important if you want to use the XML database to automatically select user-created input files that you have created when you setup new cases with CLM (both CLM4.0 and |version| physics). +This is important if you want to use the XML database to automatically select user-created input files that you have created when you setup new cases with CLM (CLM4.0, CLM4.5 and |version| physics). In `Chapter 4 `_, again for the expert user, we give details on how to do some particularly difficult special cases. For example, we give the protocol for spinning up the |version|-BGC and CLMCN models as well as CLM with dynamic vegetation active (CNDV). @@ -153,9 +153,11 @@ This also could be useful for developers who need to update the documentation du Best Practices ================ -- |version| includes BOTH the old CLM4.0 physics AND the new |version| physics and you can toggle between two. +- |version| includes BOTH the old CLM4.0, CLM4.5 physics AND the new |version| physics and you can toggle between those three. The "standard" practice for CLM4.0 is to run with CN on, and with Qian atmospheric forcing. - While the "standard" practice for |version| is to run with BGC on, and CRUNCEP atmospheric forcing. + While the "standard" practice for CLM4.5 is to run with BGC on, and CRUNCEP atmospheric forcing. + And finally the "standard" practice for |version| is to run with BGC and Prognostic Crop on, with the MOSART model for river routing, as well as the CISM + ice sheet model, and using GSWP3 atmospheric forcing. "BGC" is the new |version| biogeochemistry and include CENTURY-like pools, vertical resolved carbon, as well as Nitrification and de-Nitrification (see `the Section called Some Acronym's and Terms We'll be Using in Other resources to get help from `_ ). - When running with CLMCN (either CLM4.0 or |version| physics) or |version|-BGC, it is critical to begin with initial conditions that are provided with the release or to spin the model up following the CN spinup procedure before conducting scientific runs (see `the Section called Spinning up the |version| biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for |version| or `the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4 `_ for CLM4.0). @@ -172,23 +174,34 @@ This also could be useful for developers who need to update the documentation du Note also that spinning the 2000 initial conditions out to equilibrium will not reflect the best estimate of the real carbon/nitrogen state for the year 2000. - Initial condition files are also provided for |version| for several configurations and resolutions. - For |version|-SP and |version|-BGC with CRUNCEP forcing we have initial conditions at 1deg resolution for both 1850 and 2000. - The |version|-BGC initial conditions for 1850 (again with CRUNCEP forcing) were also interpolated to 2deg, CRUNCEP half degree (360x720cru), and ne30np4 resolutions. - Also the |version|-BGC initial conditions for 1850 (with CRUNCEP forcing) were interpolated to 1deg |version|-BGC-DV and 2deg |version|-BGC-Crop. + For CLM4.5-SP and CLM4.5-BGC with both CRUNCEP and GSWP3 forcing we have initial conditions at 1deg resolution for 1850. + For |version|-SP and |version|-BGC-Crop with both CRUNCEP and GSWP3 forcing we have initial conditions at 1deg resolution for 1850. + Normally, these files are interpolated to any other resolution that you run at. -- Users can generate initial condition files at different resolutions by using the CLM tool interpinic to interpolate from one of the provided resolutions to the resolution of interest. +- Users can interpolate initial condition files at different resolutions at startup of a CLM4.5 or |version| simulation. And the file created can be stored for later use. Interpolated initial condition files may no longer be in 'reasonable' equilibrium. -- In |version| for both |version|-CN and |version|-BGC the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). - By default we have provided a climatology dataset for lightning frequency and a dataset with coverage from 1850 to 2010 for population density. +- In |version| for both |version|-CN, |version|-BGC, and |version|-BGC-Crop the new fire model requires lightning frequency data, and human population density (both are read inside of CLM). + By default we have provided a climatology dataset for lightning frequency and a dataset with coverage from 1850 to 2014 for population density. Both of these datasets are interpolated from the native resolution of the datasets to the resolution you are running the model on. If you are running with an atmosphere model or forcing that is significantly different than present day -- the lightning frequency may NOT appropriately correspond to your atmosphere forcing and fire initiation would be inappropriate. -- Aerosol deposition is a required field to both CLM4.0 and |version| physics, sent from the atmosphere model. +- Aerosol deposition is a required field to both CLM4.0, CLM4.5 and |version| physics, sent from the atmosphere model. Simulations without aerosol deposition will exhibit unreasonably high snow albedos. The model sends aerosol deposition from the atmospheric model (either CAM or DATM). When running with prescribed aerosol the atmosphere model will interpolate the aerosols from 2-degree resolution to the resolution the atmosphere model is running at. +.. _CTSM_vs_CESM_checkout: + +============================= +A CTSM versus a CESM checkout +============================= + +The directory structure for |version| is different depending on if it's checked out from |release| or |cesmrelease|. +If |version| is checked out from |ctsm_gh| the CLM source code is directly under the top level directory. If |cesmrelease| +is checkout out from |cesm_gh| then the CLM source directories are under "components/clm" from the top level directory. We +will refer to this directory for the CLM source directories in the User's Guide as "$CTSMROOT". + .. _how-to-use-this-document: ======================================================== @@ -215,3 +228,5 @@ Links to descriptions and definitions have been provided in the code below. We u that continues to the following line. > $EDITOR filename # means you are using a text editor to edit "filename" # This is a comment line + + $CTSMROOT means the path to the root of the CTSM model diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst index 3c9964ee38..9160666051 100644 --- a/doc/source/users_guide/overview/quickstart.rst +++ b/doc/source/users_guide/overview/quickstart.rst @@ -12,25 +12,21 @@ If you are missing one of these you should contact the systems administrator for List of utilities required for CESM in the "|cesmrelease| Software/Operating System Prerequisites" section in `http://www.cesm.ucar.edu/models/cesm1.2//cesm/doc/usersguide/book1.html `_ - UNIX bash shell (for some of the CLM tools scripts) - NCL (for some of the offline tools for creating/modifying CLM input datasets see `Chapter 2 `_ for more information on NCL) -- Python (optional, needed for PTCLM) -- xsltproc, docbook and docbook utilities (optional, needed to build the Users-Guide) +- Python Before working with |version| read the QuickStart Guide in the `|cesmrelease| Scripts User's Guide `_. Once you are familiar with how to setup cases for any type of simulation with CESM you will want to direct your attention to the specifics of using CLM. For some of the details of setting up cases for |version| read the README and text files available from the "$CTSMROOT/doc" directory (see the "CLM Web pages" section for a link to the list of these files). Here are the important ones that you should be familiar with. -1. `README file `_ describing the directory structure. - -2. `Quickstart.userdatasets `_ file describing how to use your own datasets in the model (also see `the Section called Creating your own single-point/regional surface datasets in Chapter 5 `_). - -3. `$CTSMROOT/doc/KnownBugs `_ file describing known problems in |version| (that we expect to eventually fix). - -4. `$CTSMROOT/doc/KnownLimitationss `_ file describing known limitations in |version| and workarounds that we do NOT expect to fix. +`README file `_ describing the directory structure. The IMPORTANT_NOTES file talks about important things for users to know about using the model scientifically. It content is given in the next chapter on `"What is scientifically validated and functional in |version| in |cesmrelease|?" `_. The ChangeLog/ChangeSum talk about advances in different versions of CLM. The content of these files is largely explained in the previous chapter on `"What is new with |version| in |cesmrelease| since previous public releases?" `_. +The release-clm5.0.ChangeLog gives the specific changes that have gone on the release-clm5.0 branch. clm3_0_ChangeLog, clm4_0_ChangeLog, clm4_5_ChangeLog gives the changes that +culimated in that given version of the CLM. + Note other directories have README files that explain different components and tools used when running CLM and are useful in understanding how those parts of the model work and should be consulted when using tools in those directories. For more details on configuring and customizing a case with CLM see `Chapter 1 `_. The Quickstart.GUIDE (which can be found in ``$CTSMROOT/doc``) is repeated here. diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst index b7e80c4b37..12afe4bbf5 100644 --- a/doc/source/users_guide/overview/scientific_validation.rst +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -16,65 +16,3 @@ See `http://www.cesm.ucar.edu/models/cesm1.2/clm/CLM_configurations_CESM1.2.pdf `_ for an explanation of what configurations are scientifically validated for |version|. For CLM4.0 changes to the science of the model are minimal since CESM1.1.1 so we expect answers to be very similar to using it. In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case you will need to go through more extensive work to validate these options from a scientific standpoint. Some of these options are only for |version| while others are for both CLM4.0 AND |version| we explicitly say which they apply to. - ---------------------------------------------------------------------------------------------------------------- -Configure Modes NOT scientifically validated, documented, supported or, in some cases, even advised to be used: ---------------------------------------------------------------------------------------------------------------- - -These are options that you would add to ``CLM_CONFIG_OPTS``. - -1. exlaklayers on[|version| only] This mode is NOT tested and may NOT be even functional. - -2. snicar_frc on[CLM4.0 AND |version|] This mode is tested and functional, but is NOT constantly scientifically validated, and should be considered experimental. - -3. vichydro on[|version| only] This mode is tested and functional, but does NOT have long scientific validation simulations run with it so, should be considered experimental. - -4. vsoilc_centbgc[|version| only] This option is extensively tested for both "on" and "off". The "no-vert" option has limited testing performed on it, but isn't scientifically validated (and it currently has a bug -- see 1746 and 1672 in `$CTSMROOT/doc/KnownBugs `_). The "no-cent" and "no-nitrif" options are NOT tested and as such may NOT ben even functional. - ----------------------------------------------- -Namelist options that should NOT be exercised: ----------------------------------------------- - ----------------------------------------------------- -Build-Namelist options that should NOT be exercised: ----------------------------------------------------- -1. -irrig with -bgc cn and -phys clm4_0 We have only run the irrigation model with CLMSP (i.e. without the CN model). We recommend that if you want to run the irrigation model with CN, that you do a spinup. But, more than that you may need to make adjustments to irrig_factor in $CTSMROOT/src/biogeophys/CanopyFluxesMod.F90. See the notes on this in the description of the irrigation model in the -`Technical Descriptions of the Interactive Crop Management and Interactive Irrigation Models `_. - -2. -irrig with -crop on and -phys clm4_0 Irrigation doesn't work with the prognostic crop model. Irrigation is only applied to generic crop currently, which negates it's practical usage. We also have a known problem when both are on (see bug 1326 in the `$CTSMROOT/doc/KnownBugs `_ file). If you try to run in this mode, the CLM build-namelist will return with an error. - --------------------------------------------- -Namelist items that should NOT be exercised: --------------------------------------------- - -suplnitro='ALL' The suplnitro namelist option to the CN Biogeochemistry model supplies unlimited nitrogen and therefore vegetation is over-productive in this mode. - -urban_traffic:Not currently functional - -allowlakeprod:Considered experimental. - -anoxia_wtsat:Considered experimental (deprecated will be removed). - -atm_c14_filename:Considered experimental (dataset not provided). - -exponential_rooting_profile:Considered experimental. - -fin_use_fsat:Considered experimental. - -glc_dyntopo:Not currently functional. - -lake_decomp_fact:Considered experimental. - -more_vertlayers:Considered experimental. - -no_frozen_nitrif_denitrif:Considered experimental. - -perchroot:Considered experimental. - -perchroot_alt:Considered experimental. - -replenishlakec:Considered experimental. - -use_c14_bombspike:Considered experimental (dataset not provided). - -usefrootc:Considered experimental. diff --git a/doc/source/users_guide/substitutions.rst b/doc/source/users_guide/substitutions.rst index 821ebb071e..c5406a4d4e 100644 --- a/doc/source/users_guide/substitutions.rst +++ b/doc/source/users_guide/substitutions.rst @@ -1,2 +1,5 @@ .. |cesmrelease| replace:: CESM2.0.0 +.. |ctsm_gh| replace:: https://github.com/ESCOMP/ctsm + +.. |cesm_gh| replace:: https://github.com/ESCOMP/cesm From 9a1167db2f54fb8256aab9e3a7655d84cf7aa3e1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 18 Jun 2018 22:35:48 -0600 Subject: [PATCH 0191/1973] More work on overview and add README to the UG --- .../users_guide/overview/getting-help.rst | 80 +++++++++++++++---- .../users_guide/overview/introduction.rst | 9 +++ .../overview/scientific_validation.rst | 13 +++ 3 files changed, 87 insertions(+), 15 deletions(-) diff --git a/doc/source/users_guide/overview/getting-help.rst b/doc/source/users_guide/overview/getting-help.rst index aafeb057f5..cf45bc79a4 100644 --- a/doc/source/users_guide/overview/getting-help.rst +++ b/doc/source/users_guide/overview/getting-help.rst @@ -5,7 +5,9 @@ ============== Getting Help ============== -In addition to this users-guide there are several other resources that are available to help you use |version|. The first one is the |cesmrelease| User's-Guide, which documents the entire process of creating cases with |cesmrelease|. The next is the CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in |cesmrelease|. +In addition to this users-guide there are several other resources that are available to help you use |version|. The first one is the |cesmrelease| User's-Guide, which documents the entire process of creating cases with |cesmrelease|. +And next is the CIME User's Guide which goes over the scripts and infrastructure used for running |version| in |cesmrelease|. +The CESM bulletin board which is a web-site for exchanging information between users of CESM. There are also CLM web-pages specific for CLM, and finally there is an email address to report bugs that you find in |cesmrelease|. --------------------------- The CESM User's-Guide @@ -15,6 +17,13 @@ The CESM User's-Guide `|cesmrelease| Quickstart Guide `_ +--------------------------- +The CIME User's-Guide +--------------------------- + +The CIME Users'-Guide goes into the how to use the scripts and infrastructure of the CESM. +`CIME Users Guide `_ + ----------------------- The CESM Bulletin Board ----------------------- @@ -30,6 +39,7 @@ The CLM web pages The main CLM web page contains information on the CLM, it's history, developers, as well as downloads for previous model versions. There are also documentation text files in the $CTSMROOT/doc directory that give some quick information on using CLM. `CLM web page `_ +`|cesmrelease| |version| web page `_ `CLM Documentation Text Files `_ Also note that several of the XML database files can be viewed in a web browser to get a nice table of namelist options, namelist defaults, or compsets. Simply view them as a local file and bring up one of the following files: @@ -38,8 +48,8 @@ Also note that several of the XML database files can be viewed in a web browser - `$CTSMROOT/bld/namelist_files/namelist_definition_clm4_5.xml `_ -- definition of CLM4.5/CLM5.0 namelist items. - `$CTSMROOT/bld/namelist_files/namelist_defaults_clm4_0.xml `_ -- default values for CLM4.0 namelist items. - `$CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5.xml `_ -- default values for CLM4.5/CLM5.0 namelist items. -- `scripts/ccsm_utils/Case.template/config_definition.xml `_ -- definition of all env_*.xml items. -- `scripts/ccsm_utils/Case.template/config_compsets.xml `_ -- definition of all the compsets. +- `$CTSMROOT/cime_config/config_component.xml `_ -- definition of all the CLM specific XML variables. +- `$CTSMROOT/cime_config/config_compsets.xml `_ -- definition of all the CLM compsets. - `$CTSMROOT/bld/namelist_files/history_fields_clm4_0.xml `_ -- definition of CLM4.0 history fields. - `$CTSMROOT/bld/namelist_files/history_fields_clm4_5.xml `_ -- definition of CLM4.5/CLM5.0 history fields. @@ -47,8 +57,11 @@ Also note that several of the XML database files can be viewed in a web browser Reporting bugs in |version| ---------------------------- -If you have any problems, additional questions, bug reports, or any other feedback, please send an email to <`cesmhelp@cgd.ucar.edu `_>. If you find bad, wrong, or misleading information in this users guide send an email to <`erik@ucar.edu `_>. The current list of known issues for |version| in |cesmrelease| is in the $CTSMROOT/doc/KnownBugs file, and the list of issues for |cesmrelease| is at... -`http://www.cesm.ucar.edu/models/cesm1.2//tags/|cesmrelease|/#PROBLEMS `_. +If you have any problems, additional questions, bug reports, or any other feedback, please report it as an issue +on GitHub https://github.com/ESCOMP/ctsm/issues or for CIME scripts and infrastructure to https://github.com/ESMCI/CIME/issues. +Or send an email to +<`cesmhelp@cgd.ucar.edu `_> or <`ctsm-software@ucar.edu `_>. +If you find bad, wrong, or misleading information in this users guide report it as an issue on CTSM. --------------------------------------- Some Acronym's and Terms We'll be Using @@ -60,55 +73,92 @@ CAM CESM Community Earth System Model (CESM). The coupled earth system model that CLM is a component of. +CIME + The Common Infrastructure for Modeling the Earth (CIME - pronounced “SEAM”) provides a Case Control System for configuring, compiling and executing Earth system models, data and stub model components, a driver and associated tools and libraries. + CLM Community Land Model (CLM). The prognostically active land model component of CESM. CLMBGC Community Land Model (|version|) with BGC Biogeochemistry. Uses CN Biogeochemistry with vertically resolved soil Carbon, CENTURY model like pools, and Nitrification/De-Nitrification. The CLM_CONFIG_OPTS option for this is - ``./xmlchange CLM_CONFIG_OPTS="phys clm5_0 -bgc cn -vsoilc_centbgc on -clm4me on"`` + ``./xmlchange CLM_CONFIG_OPTS="phys clm5_0 -bgc bgc`` + +CLMBGC-Crop + Community Land Model (|version|) with BGC Biogeochemistry and prognotic crop. The CLM_CONFIG_OPTS option for this is + + ``./xmlchange CLM_CONFIG_OPTS="phys clm5_0 -bgc bgc -crop`` CLMCN - Community Land Model (CLM) with Carbon Nitrogen (CN) Biogeochemistry (either CLM4.0 or |version|) The CLM_CONFIG_OPTS option for this is + Community Land Model (CLM) with Carbon Nitrogen (CN) Biogeochemistry (either CLM4.0, CLM4.5 or |version|) The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-bgc cn" -append`` CLMSP - Community Land Model (CLM) with Satellite Phenology (SP) (either CLM4.0 or |version|) The CLM_CONFIG_OPTS option for this is + Community Land Model (CLM) with Satellite Phenology (SP) (either CLM4.0, CLM4.5 or |version|) The CLM_CONFIG_OPTS option for this is - ``./xmlchange CLM_CONFIG_OPTS="-bgc none" -append`` + ``./xmlchange CLM_CONFIG_OPTS="-bgc sp" -append`` CLMU - Community Land Model (CLM) Urban Model (either CLM4.0 or |version|). The urban model component of CLM is ALWAYS active (unless you create special surface datasets that have zero urban percent, or for regional/single-point simulations for a non-urban area). + Community Land Model (CLM) Urban Model (either CLM4.0, CLM4.5 or |version|). The urban model component of CLM is ALWAYS active (unless you create special surface datasets that have zero urban percent, or for regional/single-point simulations for a non-urban area). CRUNCEP - The Climate Research Unit (CRU) analysis of the NCEP atmosphere reanalysis atmosphere forcing data. This can be used to drive CLM with atmosphere forcing from 1901 to 2010. We also DO expect to be able to update this dataset beyond 2010 as newer data becomes available. + The Climate Research Unit (CRU) analysis of the NCEP atmosphere reanalysis atmosphere forcing data. This can be used to drive CLM with atmosphere forcing from 1901 to 2016. This data is updated every year, the version we are currently using is Version-7. The las CESM1.2.2 release used Version-4 data. + +CTSM + The Community Terrestrial Systems Model, of which |version| and CLM4.5 are namelist option sets of. CTSM is a wider community + that includes using CTSM for Numerical Weather Prediction (NWP) as well as climate. DATM - Data Atmosphere Model (DATM) the prescribed data atmosphere component for CESM. Forcing data that we provide are either the Qian or CRUNCEP forcing datasets (see below). + Data Atmosphere Model (DATM) the prescribed data atmosphere component for CESM. Forcing data that we provide are either the CRUNCEP, Qian, or GSWP3 forcing datasets (see below). DV - Dynamic global vegetation, where fractional PFT (see PFT below) changes in time prognostically. Can NOT be used with prescribed transient PFT (requires either |version|-BGC or CLMCN for either CLM4.0 or |version|). The CLM_CONFIG_OPTS option for this is + Dynamic global vegetation, where fractional PFT (see PFT below) changes in time prognostically. Can NOT be used with prescribed transient PFT (requires either CLMBGC or CLMCN for either CLM4.0, CLM4.5 or |version|). The CLM_CONFIG_OPTS option for this is ``./xmlchange CLM_CONFIG_OPTS="-bgc cndv" -append`` + This option is being phased out for the different methodology of FATES (see below). DV is not currently scientifically validated + and as such should be considered experimental. + ESMF Earth System Modeling Framework (ESMF). They are a software project that provides a software library to support Earth System modeling. We provide interfaces for ESMF as well as use their regridding capabilities for offline CLM tools. +FATES + Functionally Assembled Terrestrial Ecosystem Simulator. This is being developed by the Next Generation Ecosystem Experiment Tropics’ (NGEE-T) + project and uses both |version| and the land model component of E3SM (Energy Exascale Earth System Model). + +FUN + Fixation and Uptake of Nitrogen model, a parameter option of |version|. + +GSWP3 + Global Soil Wetness Project (GSPW3) atmospheric forcing data. It is a 3-hourly 0.5° global forcing product (1901-2014) that is based on the NCEP 20th Century Reanalysis, with additional bias corrections added by GSWP3. + +LUNA + Leaf Utilization of Nitrogen for Assimilation parameterization option as part of |version|. + NCAR National Center for Atmospheric Research (NCAR). This is the research facility that maintains CLM with contributions from other national labs and Universities. NCEP The National Center for Environmental Prediction (NCEP). In this document this normally refers to the reanalysis atmosphere data produced by NCEP. +MOSART + Model for Scale Adaptive River Transport, ROF model component option added as part of |version|. It is the standard + ROF model used in |version| compsets. + PFT Plant Function Type (PFT). A type of vegetation that CLM parameterizes. PTCLM PoinT CLM (PTCLM) a python script that operates on top of CLM for |version| to run single point simulations for CLM. -Qian - The Qian et. al. analysis of the NCEP forcing data. This can be used to drive CLM with atmosphere forcing from 1948 to 2004. We do NOT expect to be able to update this dataset beyond 2004. +ROF + River runOff Model to route flow of surface water over land out to the ocean. |cesmrelease| has two components options for this + the new model MOSART and previous model RTM. + +RTM + River Transport Model, ROF model component option that has been a part of all versions of CESM. It is the standard ROF + model used in CLM4.5 and CLM4.0 compsets. SCRIP Spherical Coordinate Remapping and Interpolation Package (SCRIP). We use it's file format for specifying both grid coordinates as well as mapping between different grids. diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index 9705057439..075462d35f 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -147,6 +147,15 @@ Finally in `Appendix A `_ we give instructions on how to build the docu This document is included in every CLM distribution and can be built so that you can view a local copy rather than having to go to the CESM website. This also could be useful for developers who need to update the documentation due to changes they have made. +================================ +README file describing |version| +================================ + +The README (which can be found in ``$CTSMROOT/doc``) is repeated here. + +.. include:: ../../clm5.0/README + :literal: + .. _best-practices-for-usage: ================ diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst index 12afe4bbf5..9b38be4808 100644 --- a/doc/source/users_guide/overview/scientific_validation.rst +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -16,3 +16,16 @@ See `http://www.cesm.ucar.edu/models/cesm1.2/clm/CLM_configurations_CESM1.2.pdf `_ for an explanation of what configurations are scientifically validated for |version|. For CLM4.0 changes to the science of the model are minimal since CESM1.1.1 so we expect answers to be very similar to using it. In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case you will need to go through more extensive work to validate these options from a scientific standpoint. Some of these options are only for |version| while others are for both CLM4.0 AND |version| we explicitly say which they apply to. + +----------------------------------------------- +Configurations that should be used with caution +----------------------------------------------- + +There are some options in |version| that are available but either not tested extensively, or not scientifically evaluated. These +options should be used with caution. And any options that deviate from the scientifically supported configurations can have issues. +The IMPORTANT_NODES file goes into more details on this. + +The IMPORTANT_NOTES (which can be found in ``$CTSMROOT/doc``) is repeated here. + +.. include:: ../../clm5.0/doc/IMPORTANT_NOTES + :literal: From b7b3fd3ab5194fb143887afa8d2ea4d03d2c489f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 19 Jun 2018 22:16:21 -0600 Subject: [PATCH 0192/1973] Work on the setting up a case section --- .../users_guide/overview/introduction.rst | 2 +- .../choosing-a-compset.rst | 17 +++- .../customizing-the-clm-configuration.rst | 97 +++++++++++-------- .../customizing-the-clm-namelist.rst | 8 +- .../customizing-the-datm-namelist.rst | 30 ++++-- 5 files changed, 95 insertions(+), 59 deletions(-) diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index 075462d35f..c3d29ab83b 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -200,7 +200,7 @@ The README (which can be found in ``$CTSMROOT/doc``) is repeated here. The model sends aerosol deposition from the atmospheric model (either CAM or DATM). When running with prescribed aerosol the atmosphere model will interpolate the aerosols from 2-degree resolution to the resolution the atmosphere model is running at. -.. _CTSM_vs_CESM_checkout: +.. _ctsm_vs_cesm_checkout: ============================= A CTSM versus a CESM checkout diff --git a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst index df702e0185..c2bb0b606b 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/choosing-a-compset.rst @@ -3,7 +3,7 @@ .. include:: ../substitutions.rst ==================== - Choosing a compset +Choosing a compset ==================== When setting up a new case one of the first choices to make is which "component set" (or compset) to use. @@ -12,6 +12,8 @@ We label the different types of compsets with a different letter of the alphabet The compsets of interest when working with CLM are the "I" compsets (which contain CLM with a data atmosphere model and a stub ocean, and stub sea-ice models), "E" and "F" compsets (which contain CLM with the active atmosphere model (CAM), prescribed sea-ice model, and a data ocean model), and "B" compsets which have all active components. Below we go into details on the "I" compsets which emphasize CLM as the only active model, and just mention the two other categories. +To run CLM coupled to CAM ("E" or "F" compsets) or fully coupled ("B compsets) you need to be running CLM from a CESM checkout rather than a CTSM checkout (see :ref:`ctsm_vs_cesm_checkout`). + When working with CLM you usually want to start with a relevant "I" compset before moving to the more complex cases that involve other active model components. The "I" compsets can exercise CLM in a way that is similar to the coupled modes, but with much lower computational cost and faster turnaround times. @@ -22,9 +24,14 @@ Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) Here is the entire list of compsets available. -Note that using the "-user_compset" option even more combinations are possible. -In the list below we give the alias name and then the long name which describes each component in parenthesis. -Alias (Long-name with time-period and each component) + +`CESM compsets `_ + +Note that using the "-user_compset" option even more combinations are possible. To get a list of the compsets use the "query_config" +command as follows: +:: + + $CTSMROOT/cime/scripts/query_config --compsets clm Compsets coupled to active atmosphere with data ocean ----------------------------------------------------- @@ -37,5 +44,5 @@ Fully coupled compsets are compsets that start with "B" in the name. They are de Conclusion to choosing a compset -------------------------------- We've introduced the basic type of compsets that use CLM and given some further details for the "standalone CLM" (or "I" compsets). -The `config_compsets.xml `_ lists all of the compsets and gives a full description of each of them. +The `$CTSMROOT/cime_config/config_compsets.xml `_ lists all of the compsets and gives a full description of each of them. In the next section we look into customizing the setup time options for compsets using CLM. diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst index 38f61c2c4d..f752b1a766 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-configuration.rst @@ -2,23 +2,26 @@ .. include:: ../substitutions.rst -******************************* -Customizing CLM's Configuration -******************************* +******************************** + Customizing CLM's Configuration +******************************** -The "Creating a Case" section of the |cesmrelease| `Scripts User's-Guide `_ gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. +The section of the |cesmrelease| Quickstart `CESM Create a Case `_ gives instructions on creating a case. +Also see a similar section in the CIME User's-Guide `CIME Create a case `_. +What is of interest here is how to customize your use of CLM for the case that you created. -For CLM when **preview_namelist**, **$CASE.build**, or **$CASE.run** are called there are two steps that take place: +For CLM when **preview_namelist**, **case.build**, or **case.run** are called there are two steps that take place: -1. The CLM "**configure**" script is called to setup the build-time configuration for CLM (more information on **configure** is given in `the Section called More information on the CLM configure script `_). The env variables for **configure** are locked after the **$CASE.build** step. So the results of the CLM **configure** are locked after the build has taken place. +1. The CLM "**configure**" script is called to setup the build-time configuration for CLM (more information on **configure** is given in `the Section called More information on the CLM configure script `_). The env variables for **configure** are locked after the **case.build** step. So the results of the CLM **configure** are locked after the build has taken place. 2. The CLM "**build-namelist**" script is called to generate the run-time namelist for CLM (more information on **build-namelist** is given below in `the Section called Definition of Namelist items and their default values `_. -When customizing your case at the *8cesm_setup** step you are able to modify the process by effecting either one or both of these steps. The CLM "**configure**" and "**build-namelist**" scripts are both available in the "$CTSMROOT/bld" directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what types of options you can give either of them. +When customizing your case at the **case.setup** step you are able to modify the process by effecting either one or both of these steps. The CLM "**configure**" and "**build-namelist**" scripts are both available in the "$CTSMROOT/bld" directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what types of options you can give either of them. There are five different types of customization for the configuration that we will discuss: |version| in |cesmrelease| build-time options, |version| in |cesmrelease| run-time options, User Namelist, other noteworthy |cesmrelease| configuration items, the CLM **configure** script options, and the CLM **build-namelist** script options. -Information on all of the script, configuration, build and run items is found under ``scripts/ccsm_utils/Case.template`` in the `config_definition.xml `_ file. +Information on all of the CLM script, configuration, build and run items is found under ``$CTSMROOT/cime_config/config_component.xml``. +See `CLM CASEROOT Variable Definitions `_. ================================ CLM Script configuration items @@ -27,13 +30,16 @@ Information on all of the script, configuration, build and run items is found un Below we list each of the CESM configuration items that are specific to CLM. All of these are available in your: ``env_build.xml`` and ``env_run.xml`` files. :: - CLM_CONFIG_OPTS + CLM_ACCELERATED_SPINUP CLM_BLDNML_OPTS - CLM_NAMELIST_OPTS + CLM_CO2_TYPE + CLM_CONFIG_OPTS + CLM_CPPDEFS CLM_FORCE_COLDSTART + CLM_NAMELIST_OPTS CLM_NML_USE_CASE CLM_USRDAT_NAME - CLM_CO2_TYPE + COMP_LND For the precedence of the different options to **build-namelist** see the section on precedence below. @@ -45,16 +51,16 @@ CLM_CONFIG_OPTS You can still add more options to your ``CLM_CONFIG_OPTS`` but make sure you add to what is already there rather than replacing it. Hence, we recommend using the "-append" option to the xmlchange script. In `the Section called More information on the CLM configure script `_ below we will go into more details on options that can be customized in the CLM "**configure**" script. - It's also important to note that the **clm.buildnml.csh** script may already invoke certain CLM **configure** options and as such those command line options are NOT going to be available to change at this step (nor would you want to change them). + It's also important to note that the **$CTSMROOT/cime_config/buildnml** script may already invoke certain CLM **configure** options and as such those command line options are NOT going to be available to change at this step (nor would you want to change them). The options to CLM **configure** are given with the "-help" option which is given in `the Section called More information on the CLM configure script `_. - .. note:: ``CLM_CONFIG_OPTS`` is locked after the **$CASE.build** script is run. If you want to change something in ``CLM_CONFIG_OPTS`` you'll need to clean the build and rerun **$CASE.build**. The other env variables can be changed at run-time so are never locked. + .. note:: ``CLM_CONFIG_OPTS`` is locked after the **case.build** script is run. If you want to change something in ``CLM_CONFIG_OPTS`` you'll need to clean the build and rerun **case.build**. The other env variables can be changed at run-time so are never locked. CLM_NML_USE_CASE ``CLM_NML_USE_CASE`` is used to set a particular set of conditions that set multiple namelist items, all centering around a particular usage of the model. To list the valid options do the following: :: - > cd $CTSMROOT/doc - > ../bld/build-namelist -use_case list + > cd $CTSMROOT + > ./bld/build-namelist -use_case list The output of the above command is: :: @@ -108,7 +114,7 @@ CLM_NML_USE_CASE CLM_BLDNML_OPTS The option CLM_BLDNML_OPTS is for passing options to the CLM "build-namelist" script. - As with the CLM "configure" script the CLM clm.buildnml.csh may already invoke certain options and as such those options will NOT be available to be set here. The best way to see what options can be sent to the "build-namelist" script is to do + As with the CLM "configure" script the CLM $CTSMROOT/cime_config/buildnml may already invoke certain options and as such those options will NOT be available to be set here. The best way to see what options can be sent to the "build-namelist" script is to do :: > cd $CTSMROOT/bld @@ -257,7 +263,7 @@ CLM_BLDNML_OPTS 5. values from the namelist defaults file. -The **clm.buildnml.csh** script already sets the resolution and mask as well as the CLM **configure** file, and defines an input namelist and namelist input file, and the output namelist directory, and sets the start-type (from ``RUN_TYPE``), namelist options (from ``CLM_NAMELIST_OPTS``), co2_ppmv (from ``CCSM_CO2_PPMV``, co2_type (from ``CLM_CO2_TYPE``), lnd_frac (from ``LND_DOMAIN_PATH`` and ``LND_DOMAIN_FILE``), l_ncpl (from ``LND_NCPL``, glc_grid, glc_smb, glc_nec (from ``GLC_GRID``, ``GLC_SMB``, and ``GLC_NEC``), and "clm_usr_name" is set (to ``CLM_USRDAT_NAME >``when the grid is set to ``CLM_USRDAT_NAME``. +The **$CTSMROOT/cime_config/buildnml** script already sets the resolution and mask as well as the CLM **configure** file, and defines an input namelist and namelist input file, and the output namelist directory, and sets the start-type (from ``RUN_TYPE``), namelist options (from ``CLM_NAMELIST_OPTS``), co2_ppmv (from ``CCSM_CO2_PPMV``, co2_type (from ``CLM_CO2_TYPE``), lnd_frac (from ``LND_DOMAIN_PATH`` and ``LND_DOMAIN_FILE``), l_ncpl (from ``LND_NCPL``, glc_grid, glc_smb, glc_nec (from ``GLC_GRID``, ``GLC_SMB``, and ``GLC_NEC``), and "clm_usr_name" is set (to ``CLM_USRDAT_NAME >``when the grid is set to ``CLM_USRDAT_NAME``. Hence only the following different options can be set: 1. @@ -288,7 +294,7 @@ Hence only the following different options can be set: "-bgc_spinup" is an option only available for |version| for any configuration when CN is turned on (so either CLMCN or CLMBGC). It can be set to "on" or "off". If "on" the model will go into Accelerated Decomposition mode, while for "off" (the default) it will have standard decomposition rates. If you are starting up from initial condition files the model will check what mode the initial condition file is in and do the appropriate action on the first time-step to change the Carbon pools to the appropriate spinup setting. See `the Section called Spinning up the |version| biogeochemistry (CLMBGC spinup) in Chapter 4 `_ for an example using this option. -"-chk_res" ensures that the resolution chosen is supported by CLM. If the resolution is NOT supported it will cause the CLM **build-namelist** to abort when run. So when either **preview_namelist**, **$CASE.build** or **$CASE.run** is executed it will abort early. Since, the CESM scripts only support certain resolutions anyway, in general this option is NOT needed in the context of running CESM cases. +"-chk_res" ensures that the resolution chosen is supported by CLM. If the resolution is NOT supported it will cause the CLM **build-namelist** to abort when run. So when either **preview_namelist**, **case.build** or **case.run** is executed it will abort early. Since, the CESM scripts only support certain resolutions anyway, in general this option is NOT needed in the context of running CESM cases. "-clm_demand" asks the **build-namelist** step to require that the list of variables entered be set. Typically, this is used to require that optional filenames be used and ensure they are set before continuing. For example, you may want to require that fpftdyn be set to get dynamically changing vegetation types. To do this you would do the following. :: @@ -310,7 +316,9 @@ To see a list of valid variables that you could set do this: "-ignore_ic_year" ignores the Initial Conditions (IC) year for finding initial condition files to startup from. The date is used, but the year is ignored. Without this option or the "-ignore_ic_date" option below, the date and year of the file comes into play. -When "-irrig" is used **build-namelist** will try to find surface datasets that have the irrigation model enabled. +When "-irrig on" is used **build-namelist** will try to find surface datasets that have the irrigation model enabled (when running +with Sattellitte Phenology). When running with the prognostic crop model on, "-irrig on" will turn irrigate crops on, while "-irrig off" +will manage all crop areas as rain-fed without irrigation. "no-megan" means do NOT add the MEGAN model Biogenic Volatile Organic Compounds (BVOC) namelist to the driver. This namelist is created by default, so normally this WILL be done. This is a driver namelist, so unless "no-megan" is specified the CLM **build-namelist** will create the ``drv_flds_in`` file that the driver will copy over and use (if you are running with CAM and CAM produces this file as well, it's file will have precedence). @@ -374,7 +382,7 @@ When "-irrig" is used **build-namelist** will try to find surface datasets that User Namelist =============== -``CLM_NAMELIST_OPTS`` as described above allows you to set any extra namelist items you would like to appear in your namelist. However, it only allows you a single line to enter namelist items, and strings must be quoted with ' which is a bit awkward. If you have a long list of namelist items you want to set (such as a long list of history fields) a convenient way to do it is to add to the ``user_nl_clm`` that is created after the **cesm_setup** command runs. The file needs to be in valid FORTRAN namelist format (with the exception that the namelist name &namelist and the end of namelist marker "/" are excluded". The **preview_namelist** or **$CASE.run** step will abort if there are syntax errors. All the variable names must be valid and the values must be valid for the datatype and any restrictions for valid values for that variable. Here's an example ``user_nl_clm`` namelist that sets a bunch of history file related items, to create output history files monthly, daily, every six and 1 hours. +``CLM_NAMELIST_OPTS`` as described above allows you to set any extra namelist items you would like to appear in your namelist. However, it only allows you a single line to enter namelist items, and strings must be quoted with ' which is a bit awkward. If you have a long list of namelist items you want to set (such as a long list of history fields) a convenient way to do it is to add to the ``user_nl_clm`` that is created after the **case.setup** command runs. The file needs to be in valid FORTRAN namelist format (with the exception that the namelist name &namelist and the end of namelist marker "/" are excluded". The **preview_namelist** or **case.run** step will abort if there are syntax errors. All the variable names must be valid and the values must be valid for the datatype and any restrictions for valid values for that variable. Here's an example ``user_nl_clm`` namelist that sets a bunch of history file related items, to create output history files monthly, daily, every six and 1 hours. ---------------------------------- Example: user_nl_clm namelist file @@ -460,17 +468,17 @@ Especially with CLMBGC and CLMCN starting from initial conditions is very import - `the Section called Providing a finidat file in your user_nl_clm file `_ - `the Section called Adding a finidat file to the XML database `_ - **Note:** Your initial condition file MUST agree with the surface dataset you are using to run the simulation. If the two files do NOT agree you will get a run-time about a mis-match in PFT weights, or in the number of PFT's or columns. To get around this you'll need to use the `Section called Using interpinic to interpolate initial conditions to different resolutions in Chapter 2 `_ to interpolate your initial condition dataset. + **Note:** Your initial condition file MUST agree with the surface dataset you are using to run the simulation. If the two files do NOT agree you will get a run-time about a mis-match in PFT weights, or in the number of PFT's or columns. To get around this you'll need to add the "use_init_interp=T" namelist flag in your namelist so that the initial conditions will be interpolated on startup.** ------------------------------------------------------- Doing a hybrid simulation to provide initial conditions ------------------------------------------------------- -The first option is to setup a hybrid simulation and give a ``RUN_REFCASE`` and ``RUN_REFDATE`` to specify the reference case simulation name to use. When you setup most cases, at the standard resolutions of "f09" or "f19" it will already do this for you. For example, if you run an "I2000CN" compset at "f09_g17_gl4" resolution the following settings will already be done for you. +The first option is to setup a hybrid simulation and give a ``RUN_REFCASE`` and ``RUN_REFDATE`` to specify the reference case simulation name to use. When you setup coupled cases (assuming a CESM checkout), at the standard resolution of "f09" it will already do this for you. For example, if you run an "B1850" compset at "f09_g17_gl4" resolution the following settings will already be done for you. -``./xmlchange RUN_TYPE=hybrid,RUN_REFCASE=I2000CN_f09_g17_gl4_c100503,RUN_REFDATE=0001-01-01,GET_REFCASE=TRUE`` +``./xmlchange RUN_TYPE=hybrid,RUN_REFCASE=b.e20.B1850.f09_g17.pi_control.all.297,RUN_REFDATE=0130-01-01,GET_REFCASE=TRUE`` -Setting the ``GET_REFCASE`` option to ``TRUE means`` it will copy the files from the: ``$DIN_LOC_ROOT/ccsm4_init/I2000CN_f09_g17_gl4_c100503/0001-01-01`` directory. Note, that the ``RUN_REFCASE`` and ``RUN_REFDATE`` variables are expanded to get the directory name above. If you do NOT set ``GET_REFCASE`` to ``TRUE`` then you will need to have placed the file in your run directory yourself. In either case, the file is expected to be named: ``$RUN_REFCASE.clm2.r.$RUN_REFDATE-00000.nc`` with the variables expanded of course. +Setting the ``GET_REFCASE`` option to ``TRUE means`` it will copy the files from the RUN_REFDIR usually under: ``$DIN_LOC_ROOT/cesm2_init/$RUN_REFCASE/$RUN_REFDATE`` directory. Note, that the ``RUN_REFCASE`` and ``RUN_REFDATE`` variables are expanded to get the directory name above. If you do NOT set ``GET_REFCASE`` to ``TRUE`` then you will need to have placed the file in your run directory yourself. In either case, the file is expected to be named: ``$RUN_REFCASE.clm2.r.$RUN_REFDATE-00000.nc`` with the variables expanded of course. ------------------------------------------------------- Doing a branch simulation to provide initial conditions @@ -500,12 +508,13 @@ Other noteworthy configuration items ------------------------------------ For running "I" cases there are several other noteworthy configuration items that you may want to work with. -Most of these involve settings for the DATM, but one ``CCSM_CO2_PPMV`` applies to all models. +Most of these involve settings for the DATM, but one ``CCSM_CO2_PPMV`` applies to all models. The list of DATM +settings is `here `_. If you are running an B, E, or F case that doesn't use the DATM obviously the DATM_* settings will not be used. All of the settings below are in your ``env_build.xml`` and ``env_run.xml`` files :: CCSM_CO2_PPMV - CCSM_VOC + CCSM_BGC DATM_MODE DATM_PRESAERO DATM_CLMNCEP_YR_ALIGN @@ -519,24 +528,30 @@ If you are running an B, E, or F case that doesn't use the DATM obviously the DA ``CCSM_CO2_PPMV`` Sets the mixing ratio of CO2 in parts per million by volume for ALL CESM components to use. Note that most compsets already set this value to something reasonable. Also note that some compsets may tell the atmosphere model to override this value with either historic or ramped values. If the CCSM_BGC variable is set to something other than "none" the atmosphere model will determine CO2, and CLM will listen and use what the atmosphere sends it. On the CLM side the namelist item co2_type tells CLM to use the value sent from the atmosphere rather than a value set on it's own namelist. -``CCSM_VOC`` - Enables passing of the Volatile Organic Compounds (VOC) from CLM to the atmospheric model. This of course is only important if the atmosphere model is a fully active model that can use these fields in it's chemistry calculations. - ``DATM_MODE`` - Sets the mode that the DATM model should run in this determines how data is handled as well as what the source of the data will be. Many of the modes are setup specifically to be used for ocean and/or sea-ice modeling. The modes that are designed for use by CLM are: + Sets the mode that the DATM model should run in this determines how data is handled as well as what the source of the data will be. Many of the modes are setup specifically to be used for ocean and/or sea-ice modeling. The modes that are designed for use by CLM are (CLM_QIAN, CLMCRUNCEP, CLMCRUNCEPv7, CLMGSWP3v1 and CLM1PT): :: CLMCRUNCEP + CLMCRUNCEPv7 + CLMGSWP3v1 CLM_QIAN - CLM1PT> - CPLHIST3HrWx + CLM1PT + CPLHISTForcing ``CLMCRUNCEP`` - The standard mode for |version| of using global atmospheric data that was developed by CRU using NCEP data from 1901 to 2010. + The standard mode for CLM4.5 of using global atmospheric data that was developed by CRU using NCEP data from 1901 to 2010 (version 4 of this series). See `the Section called CLMCRUNCEP mode and it's DATM settings `_ for more information on the DATM settings for ``CLMCRUNCEP`` mode. +``CLMCRUNCEPv7`` + Version 7 of the CRUNCEP data from 1901 to 2016. + See `the Section called CLMCRUNCEPv7 mode and it's DATM settings `_ for more information on the DATM settings for ``CLMCRUNCEP`` mode. + +``CLMGSWP3v1`` + GSWP3 version 1 forcing data based on NCEP reanalysis with bias corrections by GSWP3 from 1901 to 2010. + ``CLM_QIAN`` - The standard mode for CLM4.0 of using global atmospheric data that was developed by Qian et. al. for CLM using NCEP data from 1948 to 2004. See the `Section called CLM_QIAN mode and it's DATM settings `_ for more information on the DATM settings for ``CLM_QIAN`` mode. ``CLM1PT`` is for the special cases where we have single-point tower data for particular sites. Right now we only have data for three urban locations: MexicoCity Mexico, Vancouver Canada, and the urban-c alpha site. And we have data for the US-UMB AmeriFlux tower site for University of Michigan Biological Station. See `the Section called CLM1PT mode and it's DATM settings `_ for more information on the DATM settings for ``CLM1PT`` mode. ``CPLHIST3HrWx`` is for running with atmospheric forcing from a previous CESM simulation. See `the Section called CPLHIST3HrWx mode and it's DATM settings `_ for more information on the DATM settings for ``CPLHIST3HrWx`` mode. + The standard mode for CLM4.0 of using global atmospheric data that was developed by Qian et. al. for CLM using NCEP data from 1948 to 2004. See the `Section called CLM_QIAN mode and it's DATM settings `_ for more information on the DATM settings for ``CLM_QIAN`` mode. ``CLM1PT`` is for the special cases where we have single-point tower data for particular sites. Right now we only have data for three urban locations: MexicoCity Mexico, Vancouver Canada, and the urban-c alpha site. And we have data for the US-UMB AmeriFlux tower site for University of Michigan Biological Station. See `the Section called CLM1PT mode and it's DATM settings `_ for more information on the DATM settings for ``CLM1PT`` mode. ``CPLHISTForcing`` is for running with atmospheric forcing from a previous CESM simulation. See `the Section called CPLHISTForcing mode and it's DATM settings `_ for more information on the DATM settings for ``CPLHISTForcing`` mode. ``DATM_PRESAERO`` sets the prescribed aerosol mode for the data atmosphere model. The list of valid options include: @@ -567,13 +582,13 @@ DATM_CLMNCEP_YR_ALIGN ``DATM_CLMNCEP_YR_START`` and ``DATM_CLMNCEP_YR_END`` determine the range of years to cycle the atmospheric data over, and ``DATM_CLMNCEP_YR_ALIGN`` determines which year in that range of years the simulation will start with. DATM_CPL_CASE - ``DATM_CPL_CASE`` sets the casename to use for the ``CPLHIST3HrWx`` mode. + ``DATM_CPL_CASE`` sets the casename to use for the ``CPLHISTForcing`` mode. DATM_CPL_YR_START - ``DATM_CPL_YR_START`` sets the beginning year to cycle the atmospheric data over for the ``CPLHIST3HrWx`` mode. + ``DATM_CPL_YR_START`` sets the beginning year to cycle the atmospheric data over for the ``CPLHISTForcing`` mode. DATM_CPL_YR_END - ``DATM_CPL_YR_END`` sets the ending year to cycle the atmospheric data over for the ``CPLHIST3HrWx`` mode. + ``DATM_CPL_YR_END`` sets the ending year to cycle the atmospheric data over for the ``CPLHISTForcing`` mode. DATM_CPL_YR_ALIGN ``DATM_CPL_YR_START`` and ``DATM_CPL_YR_END`` determine the range of years to cycle the atmospheric data over, and ``DATM_CPL_YR_ALIGN`` determines which year in that range of years the simulation will start with. @@ -586,16 +601,16 @@ In Chapter One of the `CESM User's Guide `_ there is a section The `CLMCRUNCEP` data is uploaded into the subversion inputdata repository as well -- but as it is 1.1 Terabytes of data downloading it is problematic (*IT WILL TAKE SEVERAL DAYS TO DOWNLOAD THE ENTIRE DATASET USING SUBVERSION*). Because of it's size you may also need to download it onto a separate disk space. We have done that on cheyenne for example where it resides in ``$ENV{CESMROOT}/lmwg`` while the rest of the input data resides in ``$ENV{CESMDATAROOT}/inputdata``. The data is also already available on: janus, franklin, and hopper. If you download the data, we recommend that you break your download into several chunks, by setting up a case and setting the year range for ``DATM_CPL_YR_START`` and ``DATM_CPL_YR_END`` in say 20 year sections over 1901 to 2010, and then use **check_input_data** to export the data. -The ``CPLHIST3HrWx`` DATM forcing data is unique -- because it is large compared to the rest of the input data, and we only have a disk copy on cheyenne. The DATM assumes the path for the previous NCAR machine cheyenne of ``/glade/p/cesm/shared_outputdata/cases/ccsm4/$DATM_CPLHIST_CASE`` for the data. So you will need to change this path in order to run on any other machine. You can download the data itself from NCAR HPSS from ``/CCSM/csm/$DATM_CPLHIST_CASE``. +The ``CPLHISTForcing`` DATM forcing data is unique -- because it is large compared to the rest of the input data, and we only have a disk copy on cheyenne. The DATM assumes the path for the previous NCAR machine cheyenne of ``/glade/p/cesm/shared_outputdata/cases/ccsm4/$DATM_CPLHIST_CASE`` for the data. So you will need to change this path in order to run on any other machine. You can download the data itself from NCAR HPSS from ``/CCSM/csm/$DATM_CPLHIST_CASE``. -------------------------------------- Customizing via the build script files -------------------------------------- -The final thing that the user may wish to do before **cesm_setup** is run is to edit the build script files which determine the configuration and namelist. The variables in ``env_build.xml`` or ``env_run.xml`` typically mean you will NOT have to edit build script files. But, there are rare instances where it is useful to do so. The build script files are copied to your case directory and are available under Buildconf. The list of build script files you might wish to edit are: +The final thing that the user may wish to do before **case.setup** is run is to edit the build script files which determine the configuration and namelist. The variables in ``env_build.xml`` or ``env_run.xml`` typically mean you will NOT have to edit build script files. But, there are rare instances where it is useful to do so. The build script files are copied to your case directory and are available under Buildconf. The list of build script files you might wish to edit are: **clm.buildexe.csh** -**clm.buildnml.csh** +**$CTSMROOT/cime_config/buildnml** **datm.buildexe.csh** **datm.buildnml.csh** @@ -687,4 +702,4 @@ The output to the above command is as follows: We've given details on how to use the options in env_build.xml and env_run.xml to interact with the CLM "configure" and "build-namelist" scripts, as well as giving a good understanding of how these scripts work and the options to them. -In the next section we give further details on the CLM namelist. You could customize the namelist for these options after "cesm_setup" is run. +In the next section we give further details on the CLM namelist. You could customize the namelist for these options after "case.setup" is run. diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst index 41eec17598..93f30f8a29 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst @@ -6,7 +6,7 @@ Customizing CLM's namelist ============================ -Once a case is **cesm_setup**, we can then customize the case further, by editing the run-time namelist for CLM. First let's list the definition of each namelist item and their valid values, and then we'll list the default values for them. Next for some of the most used or tricky namelist items we'll give examples of their use, and give you example namelists that highlight these features. +Once a case has run **case.setup**, we can then customize the case further, by editing the run-time namelist for CLM. First let's list the definition of each namelist item and their valid values, and then we'll list the default values for them. Next for some of the most used or tricky namelist items we'll give examples of their use, and give you example namelists that highlight these features. In the following, various examples of namelists are provided that feature the use of different namelist options to customize a case for particular uses. Most the examples revolve around how to customize the output history fields. @@ -55,7 +55,7 @@ Below we will give examples of user namelists that activate different commonly u The default namelist -------------------- -Here we give the default namelist as it would be created for an "I1850Clm50BgcCropCru" compset at 0.9x1.25 resolution with a gx1v6 land-mask on cheyenne. To edit the namelist you would edit the ``user_nl_clm`` user namelist with just the items you want to change. For simplicity we will just show the CLM namelist and NOT the entire file. In the sections below, for simplicity we will just show the user namelist (``user_nl_clm``) that will add (or modify existing) namelist items to the namelist. +Here we give the default namelist as it would be created for an "I1850Clm50BgcCropCru" compset at 0.9x1.25 resolution with a gx1v7 land-mask on cheyenne. To edit the namelist you would edit the ``user_nl_clm`` user namelist with just the items you want to change. For simplicity we will just show the CLM namelist and NOT the entire file. In the sections below, for simplicity we will just show the user namelist (``user_nl_clm``) that will add (or modify existing) namelist items to the namelist. Example 1-2. Default CLM Namelist --------------------------------- @@ -141,7 +141,7 @@ The number of samples on each history file stream is given by the namelist varia A sample user namelist ``user_nl_clm`` turning on four extra file streams for output: daily, six-hourly, hourly, and every time-step, leaving the primary history files as monthly, and changing the number of samples on the streams to: yearly (12), thirty, weekly (28), daily (24), and daily (48) is: Example: user_nl_clm namelist adding auxiliary history files and changing output frequency ------------------------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------------ :: hist_fincl2 = 'TG', 'TV' @@ -242,8 +242,6 @@ Example: user_nl_clm namelist outputting some files in 1D Vector format .. note:: Technically the default for hist_nhtfrq is for primary files output monthly and the other auxiliary tapes for daily, so we don't actually have to include hist_nhtfrq, we could use the default for it. Here we specify it for clarity. -.. caution:: LAND and COLS are also options to the pertape averaging, but currently there is a bug with them and they fail to work. - Visualizing global 1D vector files will take effort. You'll probably want to do some post-processing and possibly just extract out single points of interest to see what is going on. Since, the output is a 1D vector, of only land-points traditional plots won't be helpful. diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst index 4140dad87a..dcc7fa3cbb 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-datm-namelist.rst @@ -11,7 +11,7 @@ When running "I" compsets with CLM you use the DATM model to give atmospheric fo 1. **DATM Main Namelist and Stream Namlist gorup** (``datm_in``) 2. **DATM stream files** -The `Data Model Documentation `_ gives the details of all the options for the data models and for DATM specifically. +The `Data Model Documentation `_ gives the details of all the options for the data models and for DATM specifically. It goes into detail on all namelist items both for DATM and for DATM streams. So here we won't list ALL of the DATM namelist options, nor go into great details about stream files. But, we will talk about a few of the different options that are relevant for running with CLM. @@ -51,10 +51,20 @@ tintalgo In the sections below we go over each of the relevant ``DATM_MODE`` options and what the above DATM settings are for each. This gives you examples of actual usage for the settings. We also describe in what ways you might want to customize them for your own case. -------------------------------------- -CLMCRUNCEP mode and it's DATM settings +CLMGSWP3v1 mode and it's DATM settings -------------------------------------- -In ``CLMCRUNCEP`` mode the CRUNCEP dataset is used and all of it's data is on a 6-hourly interval. +In ``CLMGSWP3v1`` mode the GSWP3 NCEP forcing dataset is used and all of it's data is on a 3-hourly interval. +Like ``CLM_QIAN`` the dataset is divided into those three data streams: solar, precipitation, and everything else (temperature, pressure, humidity, Long-Wave down and wind). +The time-stamps of the data were also adjusted so that they are the beginning of the interval for solar, and the middle for the other two. +Because, of this the ``offset`` is set to zero, and the ``tintalgo`` is: ``coszen``, ``nearest``, and ``linear`` for the solar, precipitation and other data respectively. +``taxmode`` is set to ``cycle`` and ``mapalgo`` is set to ``bilinear`` so that the data is spatially interpolated from the input exact half degree grid to the grid the atmosphere model is being run at (to run at this same model resolution use the 360x720cru_360x720cru resolution). + +---------------------------------------- +CLMCRUNCEPv7 mode and it's DATM settings +---------------------------------------- + +In ``CLMCRUNCEPv7`` mode the CRUNCEP dataset is used and all of it's data is on a 6-hourly interval. Like ``CLM_QIAN`` the dataset is divided into those three data streams: solar, precipitation, and everything else (temperature, pressure, humidity and wind). The time-stamps of the data were also adjusted so that they are the beginning of the interval for solar, and the middle for the other two. Because, of this the ``offset`` is set to zero, and the ``tintalgo`` is: ``coszen``, ``nearest``, and ``linear`` for the solar, precipitation and other data respectively. @@ -64,6 +74,12 @@ Because, of this the ``offset`` is set to zero, and the ``tintalgo`` is: ``cosze For more information on CRUNCEP forcing see `http://dods.extra.cea.fr/data/p529viov/cruncep/ `_. +-------------------------------------- +CLMCRUNCEP mode and it's DATM settings +-------------------------------------- + +``CLMCRUNCEP`` is similar to the ``CLMCRUNCEPv7`` mode above, except it uses Version 4 of the CRUNCEP data rather than version 7. + ------------------------------------ CLM_QIAN mode and it's DATM settings ------------------------------------ @@ -92,11 +108,11 @@ Because, of this the ``offset`` is set to zero, and the ``tintalgo`` is set to ` If you are using your own data for this mode and it's not at least hourly you'll want to adjust the DATM settings for it. If the data is three or six hourly, you'll need to divide it up into separate streams like in ``CLM_QIAN`` mode which will require fairly extensive changes to the DATM namelist and streams files. For an example of doing this see `Example 5-8 `_. ----------------------------------------- -CPLHIST3HrWx mode and it's DATM settings ----------------------------------------- +------------------------------------------ +CPLHISTForcing mode and it's DATM settings +------------------------------------------ -In ``CPLHIST3HrWx`` mode the model is assumed to have 3-hourly for a global grid from a previous CESM simulation. +In ``CPLHISTForcing`` mode the model is assumed to have 3-hourly for a global grid from a previous CESM simulation. Like ``CLM_QIAN`` mode the data is divided into three streams: one for precipitation, one for solar, and one for everything else. The time-stamps for Coupler history files for CESM is at the end of the interval, so the ``offset`` needs to be set in order to adjust the time-stamps to what it needs to be for the ``tintalgo`` settings. For precipitation ``taxmode`` is set to ``nearest`` so the ``offset`` is set to ``-5400`` seconds so that the ending time-step is adjusted by an hour and half to the middle of the interval. From 6e59daa67289608b4595c59c7e5e2ccfc16e289d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 20 Jun 2018 15:23:57 -0600 Subject: [PATCH 0193/1973] Work on the tools chapter --- .../building-the-clm-tools.rst | 42 +++++++++---------- .../users_guide/using-clm-tools/cprnc.rst | 5 +-- .../using-clm-tools/creating-domain-files.rst | 6 +-- ...g-input-for-surface-dataset-generation.rst | 10 +---- .../creating-surface-datasets.rst | 20 +-------- .../what-are-the-clm-tools.rst | 31 +++++++------- 6 files changed, 43 insertions(+), 71 deletions(-) diff --git a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst index 1dd1129b6c..1b64786d99 100644 --- a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst @@ -4,24 +4,24 @@ .. include:: ../substitutions.rst -The FORTRAN tools all have similar makefiles, and similar options for building. -All of the Makefiles use GNU Make extensions and thus require that you use GNU make to use them. +The CLM FORTRAN tools all have similar makefiles, and similar options for building. The tools +**cprnc** and **gen_domain** use the CIME configure/build system which is described in the next section. + +The Makefiles (for **mksurfdata_map** and **mkprocdata_map**) use GNU Make extensions and thus require that you use GNU make to use them. They also auto detect the type of platform you are on, using "uname -s" and set the compiler, compiler flags and such accordingly. There are also environment variables that can be set to set things that must be customized. All the tools use NetCDF and hence require the path to the NetCDF libraries and include files. On some platforms (such as Linux) multiple compilers can be used, and hence there are env variables that can be set to change the FORTRAN and/or "C" compilers used. -The tools other than cprnc also allow finer control, by also allowing the user to add compiler flags they choose, for both FORTRAN and "C", as well as picking the compiler, linker and and add linker options. -Finally the tools other than **cprnc** allow you to turn optimization on (which is off by default but on for the **mksurfdata_map** and **interpinic** programs) with the OPT flag so that the tool will run faster. -To get even faster performance, the **interpinic**, program allows you to also use the SMP to turn on multiple shared memory processors. -When ``SMP=TRUE`` you set the number of threads used by the program with the ``OMP_NUM_THREADS`` environment variable. +The tools also allow finer control, by also allowing the user to add compiler flags they choose, for both FORTRAN and "C", as well as picking the compiler, linker and and add linker options. +Finally the tools allow you to turn optimization on (which is off by default but on for **mksurfdata_map**) with the OPT flag so that the tool will run faster. -Options used by all: **cprnc**, **interpinic**, and **mksurfdata_map** +Options used by all: **mksurfdata_map** - ``LIB_NETCDF`` -- sets the location of the NetCDF library. - ``INC_NETCDF`` -- sets the location of the NetCDF include files. - ``USER_FC`` -- sets the name of the FORTRAN compiler. -Options used by: **interpinic**, **mkprocdata_map**, **mkmapgrids**, and **mksurfdata_map** +Options used by: **mkprocdata_map**, and **mksurfdata_map** - ``MOD_NETCDF`` -- sets the location of the NetCDF FORTRAN module. - ``USER_LINKER`` -- sets the name of the linker to use. @@ -38,11 +38,6 @@ Options used by: **interpinic**, **mkprocdata_map**, **mkmapgrids**, and **mksur - ``mkDepends`` -- figure out dependencies between source files, so make can compile in order.. - ``Makefile.common`` -- General tool Makefile that should be the same between all tools. -Options used only by **cprnc**: - -- ``EXEDIR`` -- sets the location where the executable will be built. -- ``VPATH`` -- colon delimited path list to find the source files. - More details on each environment variable. ``LIB_NETCDF`` @@ -81,7 +76,7 @@ More details on each environment variable. .. warning:: Note, that depending on the compiler answers may be different when SMP is activated. ``OPT`` - This variable flags if compiler optimization should be used when compiling the tool. It can be set to either ``TRUE`` or ``FALSE``, by default it is set to ``FALSE`` for **mkmapgrids** and ``TRUE`` for **mksurfdata_map**, **mkprocdata_map** and **interpinic**. Turning this on should make the tool run much faster. + This variable flags if compiler optimization should be used when compiling the tool. It can be set to either ``TRUE`` or ``FALSE``, by default it is set to for both **mksurfdata_map** and **mkprocdata_map**. Turning this on should make the tool run much faster. .. warning:: Note, you should expect that answers will be different when ``OPT`` is activated. @@ -100,15 +95,20 @@ More details on each environment variable. ``mkDepends`` The ``mkDepends`` is the copy of the perl script used by the ``Makefile.common`` to figure out the dependencies between the source files so that it can compile in the necessary order. This file should be identical between the different tools. -``EXEDIR`` - The cprnc tool uses this variable to set the location of where the executable will be built. The default is the current directory. - -``VPATH`` - The **cprnc** tool uses this variable to set the colon delimited pathnames of where the source code exists. The default is the current directory. - -.. note:: There are several files that are copies of the original files from either models``/lnd/clm/src/util_share``, ``models/csm_share/shr``, or copies from other tool directories. By having copies the tools can all be made stand-alone, but any changes to the originals will have to be put into the tool directories as well. +.. note:: There are several files that are copies of the original files. By having copies the tools can all be made stand-alone, but any changes to the originals will have to be put into the tool directories as well. The *README.filecopies* (which can be found in ``$CTSMROOT/tools``) is repeated here. .. include:: ../../clm5.0/tools/README.filecopies :literal: + +================================================================ + Building the CLM tools that use the CIME configure/build system +================================================================ + +**cprnc** and *gen_domain** both use the CIME configure/build system rather than the CLM specific version described above. + +See `CIME documentation on adding grids `_ for +more information on adding grids, creating mapping files, and running **gen_domain**. Also see the CIME file: +``$CTSMROOT/tools/mapping/gen_domain_files/INSTALL`` for how to build **gen_domain**. + diff --git a/doc/source/users_guide/using-clm-tools/cprnc.rst b/doc/source/users_guide/using-clm-tools/cprnc.rst index de90f7a88e..050e059296 100644 --- a/doc/source/users_guide/using-clm-tools/cprnc.rst +++ b/doc/source/users_guide/using-clm-tools/cprnc.rst @@ -6,8 +6,8 @@ Comparing History Files ========================= -**cprnc** is a tool shared by both CAM and CLM to compare two NetCDF history files. -It differences every field that has a time-axis that is also shared on both files, and reports a summary of the difference. +**cprnc** is a tool shared by |cesmrelease| to compare two NetCDF history files. +It differences every field that is shared on both files, and reports a summary of the difference. The summary includes the three largest differences, as well as the root mean square (RMS) difference. It also gives some summary information on the field as well. You have to enter at least one file, and up to two files. @@ -28,4 +28,3 @@ Options: See the **cprnc** `README `_ file for more details. -.. note:: To compare files with OUT a time axis you can use the **cprnc.ncl** NCL script in ``$CTSMROOT/tools/ncl_scripts``. It won't give you the details on the differences but will report if the files are identical or different. diff --git a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst index d72427d3d5..c804a7bea7 100644 --- a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst +++ b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst @@ -6,8 +6,8 @@ Creating CLM domain files ***************************** -*gen_domain* to create a domain file for datm from a mapping file. The domain file is then used by BOTH DATM AND CLM to define the grid and land-mask. The general data flow is shown in two figures. `Figure 2-4 `_ shows the general flow for a general global case (or for a regional grid that DOES include ocean). `Figure 2-5 `_ shows the use of **mknoocnmap.pl** (see `the Section called Using mknocnmap.pl to create grid and maps for single-point regional grids `_) to create a regional or single-point map file that is then run through **gen_domain** to create the domain file for it. As stated before `Figure 2-2 `_ is the legend for both of these figures. See `the -tools/mapping/gen_domain_files/README `_ file for more help on **gen_domain**. +*gen_domain* to create a domain file for datm from a mapping file. **gen_domain** is a tool that is a part of CIME. The domain file is then used by BOTH DATM AND CLM to define the grid and land-mask. The general data flow is shown in two figures. `Figure 2-4 `_ shows the general flow for a general global case (or for a regional grid that DOES include ocean). `Figure 2-5 `_ shows the use of **mknoocnmap.pl** (see `the Section called Using mknocnmap.pl to create grid and maps for single-point regional grids `_) to create a regional or single-point map file that is then run through **gen_domain** to create the domain file for it. As stated before `Figure 2-2 `_ is the legend for both of these figures. See `the +$CIMEROOT/tools/mapping/gen_domain_files/README `_ file for more help on **gen_domain**. Here we create domain files for a regular global domain. @@ -16,7 +16,7 @@ Figure 2-4. Global Domain file creation Insert figure 2-4 -Starting from SCRIP grid files for both your atmosphere and ocean, you use **tools/mapping/gen_mapping_files/gen_cesm_maps.sh** to create a mapping file between the atmosphere and ocean. That mapping file is then used as input to **gen_domain** to create output domain files for both atmosphere and ocean. The atmosphere domain file is then used by both CLM and DATM for I compsets, while the ocean domain file is ignored. For this process you have to define your SCRIP grid files on your own. For a regional or single-point case that doesn't include ocean see `Figure 2-5 `_. (See `Figure 2-2 `_ for the legend for this figure.) +Starting from SCRIP grid files for both your atmosphere and ocean, you use **$CIMEROOT/tools/mapping/gen_mapping_files/gen_cesm_maps.sh** to create a mapping file between the atmosphere and ocean. That mapping file is then used as input to **gen_domain** to create output domain files for both atmosphere and ocean. The atmosphere domain file is then used by both CLM and DATM for I compsets, while the ocean domain file is ignored. For this process you have to define your SCRIP grid files on your own. For a regional or single-point case that doesn't include ocean see `Figure 2-5 `_. (See `Figure 2-2 `_ for the legend for this figure.) Note, that the SCRIP grid file used to start this process, is also used in **mkmapdata.sh** (see `the Section called Creating mapping files that mksurfdata_map will use `_). Next we create domain files for a single-point or regional domain. diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index dcfcbbbdff..c044c283af 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -12,7 +12,7 @@ Creating input for surface dataset generation The utility ``mkmapdata.sh`` requires SCRIP format input files to describe the input and output grids that maps are generated for. CLM provides a utility, ``mkmapgrids`` that generates those files. The program converts old formats of CAM or CLM grid files to SCRIP grid format. There is also a NCL script (``mkscripgrid.ncl``) to create regular latitude longitude regional or single-point grids at the resolution the user desires. -SCRIP grid files for all the standard model resolutions and the raw surface datasets have already been done and the files are in the XML database. Hence, this step doesn't need to be done -- EXCEPT WHEN YOU ARE CREATING YOUR OWN GRIDS. If you have a CLM grid or CAM file from previous versions and you want to convert it you can use **mkmapgrids**. +SCRIP grid files for all the standard model resolutions and the raw surface datasets have already been done and the files are in the XML database. Hence, this step doesn't need to be done -- EXCEPT WHEN YOU ARE CREATING YOUR OWN GRIDS. Using mknocnmap.pl to create grid and maps for single-point regional grids -------------------------------------------------------------------------- @@ -47,11 +47,10 @@ See `Figure 2-5 `_ for a visual representation of this process. The bash shell script ``$CTSMROOT/tools/mkmapgrids/mkmapdata.sh`` uses **ESMF_RegridWeightGen** to create a list of maps from the raw datasets that are input to **mksurfdata_map**. Each dataset that has a different grid, or land-mask needs a different mapping file for it, but many different raw datasets share the same grid/land-mask as other files. -Hence, there doesn't need to be a different mapping file for EACH raw dataset -- just for each DIFFERENT raw dataset. +Hence, there doesn't need to be a different mapping file for EACH raw dataset -- just for each raw dataset that has a DIFFERENT grid or land-mask.. See `Figure 2-3 `_ for a visual representation of how this works. The bash script figures out which mapping files it needs to create and then runs **ESMF_RegridWeightGen** for each one. You can then either enter the datasets into the XML database (see `Chapter 3 `_ or leave the files in place, and use the "-res usrspec -usr_gname -usr_gdate" options to **mksurfdata_map** (see `the Section called Running mksurfdata.pl `_ below). -Use the "-phys" option to specify if you are creating mapping files for clm4_0 or |version| (the list of raw datafiles is somewhat different between the two). mkmapdata.sh has a help option with the following :: @@ -75,9 +74,6 @@ mkmapdata.sh has a help option with the following [-t|--gridtype ] Model output grid type supported values are [regional,global], (default is global) - [-p|--phys ] - Whether to generate mapping files for clm4_0 or |version| - supported values are [clm4_0,|version|], (default is |version|) [-b|--batch] Toggles batch mode usage. If you want to run in batch mode @@ -109,8 +105,6 @@ mkmapdata.sh has a help option with the following ********************** -.. warning:: Make sure you specify with the "-phys" option if you are creating files for CLM4.0! The default is |version|. - Figure 2-3. Details of running mkmapdata.sh ------------------------------------------- Insert figure 2-3 diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index f2cb8eed4d..c5a5644034 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -41,25 +41,7 @@ Creating a Complete Set of Files for Input to CLM Next use mksurfdata_map to create a surface dataset, using the mapping datasets created on the previous step as input. There is a version for either clm4_0 or |version| for this program. See the Section called Using mksurfdata_map to create surface datasets from grid datasets for more information on this. -5. Create some sort of initial condition dataset - - You then need to do one of the following three options to have an initial dataset to start from. - - a. Use spinup-procedures to create initial condition datasets - - The first option is to do the spinup procedures from arbitrary initial conditions to get good initial datasets. This is the most robust method to use. See the Section called Spinning up the Satellite Phenology Model (CLMSP spinup) in Chapter 4, the Section called Spinning up the CLM4.0 biogeochemistry Carbon-Nitrogen Model (CN spinup) in Chapter 4, or the Section called Spinning up the CLM4.0 Carbon-Nitrogen Dynamic Global Vegetation Model (CNDV spinup) in Chapter 4 for more information on this. - - b. Use interpinic to interpolate existing initial condition datasets - - The next option is to interpolate from spunup datasets at a different resolution, using interpinic. There is a version for either clm4_0 or |version| for this program. See the Section called Using interpinic to interpolate initial conditions to different resolutions for more information on this. - - c. Start up from arbitrary initial conditions - - The last alternative is to run from arbitrary initial conditions without using any spun-up datasets. This is inappropriate when using |version|-BGC or CLMCN (bgc=cn or cndv) as it takes a long time to spinup Carbon pools. - -.. warning:: This is NOT recommended as many fields in CLM take a long time to equilibrate. - -6. Enter the new datasets into the build-namelist XML database +5. Enter the new datasets into the build-namelist XML database The last optional thing to do is to enter the new datasets into the build-namelist XML database. See Chapter 3 for more information on doing this. This is optional because the user may enter these files into their namelists manually. The advantage of entering them into the database is so that they automatically come up when you create new cases. The ``$CTSMROOT/tools/README`` goes through the complete process for creating input files needed to run CLM. We repeat that file here: diff --git a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst index 3c67965e73..a8663176e1 100644 --- a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst @@ -8,35 +8,33 @@ There are several tools provided with CLM that allow you to create your own input datasets at resolutions you choose, or to interpolate initial conditions to a different resolution, or used to compare CLM history files between different cases. The tools are all available in the ``$CTSMROOT/tools`` directory. -Most of the tools are FORTRAN stand-alone programs in their own directory, but there is also a suite of NCL scripts in the ``./ncl_scripts`` directory, and some of the tools are scripts that may also call the ESMF regridding program. +Most of the tools are FORTRAN stand-alone programs in their own directory, but there is also a suite of NCL scripts in the ``$CTSMROOT/tools//ncl_scripts`` directory, and some of the tools are scripts that may also call the ESMF regridding program. Some of the NCL scripts are very specialized and not meant for general use, and we won't document them here. They still contain documentation in the script itself and the README file in the tools directory. -The tools are divided into three directories for three categories: clm4_0, |version|, and shared. -The first two are of course for tools that are designed to work with either the CLM4.0 or |version| versions of the model. -The last one are shared utilities that can be used by either, or have a "-phys" option so you can specify which version you want to use. +The tools produce files that can be used for CLM4.5 and |version|. They do **NOT** produce files that can be used for CLM4.0. +If you need files for CLM4.0, you'll need to use a previous version of CLM. The list of generally important scripts and programs are as follows. -1. *tools/cprnc* (relative to top level directory) to compare NetCDF files with a time axis. - -#. *./mkmapgrids* to create SCRIP grid data files from old CLM format grid files that can then be used to create new CLM datasets (deprecated). There is also a NCL script (``./mkmapgrids/mkscripgrid.ncl`` to create SCRIP grid files for regular latitude/longitude grids. +1. *./mkmapgrids* to create SCRIP grid data files from old CLM format grid files that can then be used to create new CLM datasets (deprecated). There is also a NCL script (``./mkmapgrids/mkscripgrid.ncl`` to create SCRIP grid files for regular latitude/longitude grids. #. *./mkmapdata* to create SCRIP mapping data file from SCRIP grid files (uses ESMF). -#. *./gen_domain* to create a domain file for datm from a mapping file. The domain file is then used by BOTH datm AND CLM to define the grid and land-mask. - #. *mksurfdata_map* to create surface datasets from grid datasets (clm4_0 and |version| versions). #. *./mkprocdata_map* to interpolate output unstructured grids (such as the CAM HOMME dy-core "ne" grids like ne30np4) into a 2D regular lat/long grid format that can be plotted easily. Can be used by either clm4_0 or |version|. +#. *$CIMEROOT/tools/mapping/gen_domain_files/gen_domain* to create a domain file for datm from a mapping file. The domain file is then used by BOTH datm AND CLM to define the grid and land-mask. + +#. *$CIMEROOT/tools/cprnc* to compare two NetCDF files. + In the sections to come we will go into detailed description of how to use each of these tools in turn. First, however we will discuss the common environment variables and options that are used by all of the FORTRAN tools. Second, we go over the outline of the entire file creation process for all input files needed by CLM for a new resolution, then we turn to each tool. In the last section we will discuss how to customize files for particular observational sites. -The tools run either one of two ways, with a namelist to provide options, or with command line arguments (and NOT both). -**gen_domain** and **cprnc** run with command line arguments, and the other tools run with namelists. +The FORTRAN tools (mksurfdata_map and mkprocdata_map) run, with a namelist (mksurfdata_map) to provide options, or with command line arguments (mkprocdata_map). In the following sections, we will outline how to make these files available for build-namelist so that you can easily create simulations that include them. In the chapter on single-point and regional datasets we also give an alternative way to enter new datasets without having to edit files. @@ -45,15 +43,14 @@ In the chapter on single-point and regional datasets we also give an alternative Running FORTRAN tools with namelists ------------------------------------ -**mksurfdata_map** and **mkmapgrids** run with namelists that are read from standard input. +**mksurfdata_map** runs with a namelist that is read from standard input. Hence, you create a namelist and then run them by redirecting the namelist file into standard input as follows: :: ./program < namelist -For programs with namelists there is at least one sample namelist with the name "program".namelist (i.e. -``mksurfdata_map.namelist`` for the **mksurfdata_map** program). -There may also be other sample namelists that end in a different name besides "namelist". +There is a sample namelist called ``$CTSMROOT/tools/mksurfdata_map/mksurfdata_map.namleist`` that shows you what the +namelist should look like. **mksurfdata_map** also has a script that creates the namelist and runs the program for you. Namelists that you create should be similar to the example namelist. The namelist values are also documented along with the other namelists in the: :: @@ -66,7 +63,7 @@ The namelist values are also documented along with the other namelists in the: Running FORTRAN tools with command line options ----------------------------------------------- -**gen_domain**, and **cprnc** run with command line arguments. +**gen_domain**, mkprocdata_map, and **cprnc** run with command line arguments. The detailed sections below will give you more information on the command line arguments specific to each tool. Also running the tool without any arguments will give you a general synopsis on how to run the tool. @@ -77,7 +74,7 @@ Running FORTRAN tools built with SMP=TRUE When you enable ``SMP=TRUE`` on your build of one of the tools that make use of it, you are using OpenMP for shared memory parallelism (SMP). In SMP loops are run in parallel with different threads run on different processors all of which access the same memory (called on-node). Thus you can only usefully run up to the number of processors that are available on a single-node of the machine you are running on. -For example, on the NCAR machine cheyenne there are 16 processors per node, but the SMT hardware on the machine allows you to submit twice as many threads or 32 threads. +For example, on the NCAR machine cheyenne there are 36 processors per node, so you can use up to 36 processors. --------- From efb91653f886d26b947b3246ef293153f556a857 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 20 Jun 2018 20:06:11 -0600 Subject: [PATCH 0194/1973] Add a note about a subtle interaction This refers to https://github.com/ESCOMP/ctsm/issues/423 --- .../tech_note/Glacier/CLM50_Tech_Note_Glacier.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst index 9f6c79ff98..52313b9a5c 100644 --- a/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst +++ b/doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst @@ -222,6 +222,16 @@ runaway sea ice growth in that region. | | | place | | +---------------+---------------+---------------+---------------+ +.. note:: + + In regions that have both the ``Glacial melt = Replaced by ice`` and the ``Ice runoff = + Melted`` behaviors (by default, this is just the region inside the standard CISM grid + but outside Greenland itself): During periods of glacial melt, a negative ice runoff is + generated (due to the ``Glacial melt = Replaced by ice`` behavior); this negative ice + runoff is converted to a negative liquid runoff plus a positive sensible heat flux (due + to the ``Ice runoff = Melted`` behavior). We recommend that you limit the portion of + the globe with both of these behaviors combined, in order to avoid having too large of + an impact of this non-physical behavior. .. _Multiple elevation class scheme: From ccc98566fb9463625cfe79d17df99d3cae3c644d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 20 Jun 2018 23:11:43 -0600 Subject: [PATCH 0195/1973] Work on adding-new-resolutions chapter and exclude cime directories --- doc/source/conf.py | 5 +- doc/source/tech_note/conf.py | 4 +- ...w-Files-to-the-build-namelist-Database.rst | 6 +- .../CLM-3.1-Managing-Your-Own-Data-files.rst | 75 ------------------- .../CLM-3.2-Adding-Resolution-Names.rst | 17 +---- ...3-Adding-or-Changing-Default-Filenames.rst | 12 +-- .../adding-new-resolutions/index.rst | 1 - doc/source/users_guide/conf.py | 7 ++ 8 files changed, 20 insertions(+), 107 deletions(-) delete mode 100644 doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst diff --git a/doc/source/conf.py b/doc/source/conf.py index 9a112db91b..27c0df6e3c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -74,9 +74,8 @@ # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path exclude_patterns = [ - "clm5.0/manage_externals", - "**/README_EXTERNALS.rst", - "clm5.0/README.rst" + "clm5.0", + "**/README_EXTERNALS.rst" ] # The name of the Pygments (syntax highlighting) style to use. diff --git a/doc/source/tech_note/conf.py b/doc/source/tech_note/conf.py index a1827c71c5..69d97bf9eb 100644 --- a/doc/source/tech_note/conf.py +++ b/doc/source/tech_note/conf.py @@ -74,9 +74,7 @@ # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path exclude_patterns = [ - "manage_externals/*", - "README_EXTERNALS.rst", - "clm5.0//README.rs" + "clm5.0/*" ] # The name of the Pygments (syntax highlighting) style to use. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst index 76d8a7aef1..a828c37e98 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst @@ -16,11 +16,11 @@ If you have a LOT of files to keep track of it also might be easier than keeping If you just have a few quick experiments to try, for a short time period you might be best off using the other methods mentioned above. There are two parts to adding files to the build-namelist database. -The first part is adding new resolution names which is done in the ``$CTSMROOT/bld/namelist_files/namelist_definition_|version|.xml`` file (and in the ``$CTSMROOT/bld/config_files/config_definition.xml`` file when adding supported single-point datasets). +The first part is adding new resolution names which is done in the ``$CTSMROOT/bld/namelist_files/namelist_definition_clm4_5.xml`` file. You can then use the new resolution by using ``CLM_USRDAT_NAME``. -If you also want to be able to give the resolution into **create_newcase** -- you'll need to add the grid to the ``scripts/ccsm_utils/Case.template/config_grid.xml`` file. +If you also want to be able to give the resolution into **create_newcase** -- you'll need to add the grid to the ``$CIMEROOT/config/cesm/config_grid.xml`` file. -The second part is actually adding the new filenames which is done in the ``$CTSMROOT/bld/namelist_files/namelist_defaults_|version|.xml`` file (``$CTSMROOT/bld/namelist_files/namelist_defaults_|version|_tools.xml`` file for CLM tools). +The second part is actually adding the new filenames which is done in the ``$CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5.xml`` file (``$CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5_tools.xml`` file for CLM tools). If you aren't adding any new resolutions, and you are just changing the files for existing resolutions, you don't need to edit the namelist_definition file. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst deleted file mode 100644 index 41ccdde35b..0000000000 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.1-Managing-Your-Own-Data-files.rst +++ /dev/null @@ -1,75 +0,0 @@ -.. _managing-your-data-files: - -.. include:: ../substitutions.rst - -============================== - Managing Your Data Own Files -============================== - -If you are running on a supported machine (such as cheyenne or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `|cesmrelease| Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. - -Using **link_dirtree** is quite simple, you give the directory where data exists and then the directory that you want to create where datasets will point to the original source files. In the example below we use "$HOME/inputdata", but MYCSMDATA could be any directory you have access to where you want to put your data. - -``` -> cd scripts -# First make sure you have a inputdata location that you can write to -# You only need to do this step once, so you won't need to do this in the future -# (except to bring in any updated files in the original $CSMDATA location). -> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data -> ./link_dirtree $CSMDATA $MYCSMDATA -``` - -Then when you create a case you will change ``DIN_LOC_ROOT_CSMDATA`` to point to the location you linked to rather than the default location. - -``> ./xmlchange DIN_LOC_ROOT_CSMDATA=$MYCSMDATA`` - -In order to list the files that you have created you merely need to use the UNIX command find to find the files that are NOT softlinks. So for example executing the following command: - -``> find $MYCSMDATA -type f -print`` - -for me gives the following truncated list of CLM_USRDAT_NAME files that I have created. - -``` -/glade/p/work/erik/inputdata/lnd/clm2/pftdata/pft-physiology.c130503.nc -/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-01.nc -/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-02.nc -/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-03.nc -/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-04.nc -``` - -You can also use **find** to list files that have a particular pattern in the name as well (using the -name option with wildcards). Also you can always rerun the **link_dirtree** command if any new files are added that you need to be linked into your directory tree. Since, the files are soft-links -- it doesn't take up much space other than the files that you add there. This way all of the files are kept in one place, they are organized by usage according to CESM standards, and you can easily find your own files, and CLM can find them as well. - - - -If you are running on a supported machine (such as cheyenne or hopper) the standard input datasets will already be available and you won't have to check them out of the subversion inputdata server. However, you also will NOT be able to add your own datafiles to these standard inputdata directories -- because most likely you won't have permissions to do so. In order to add files to the XML database or to use ``CLM_USRDAT_NAME`` you need to put data in the standard locations so that they can be found. The recommended way to do this is to use the **link_dirtree** tool in the CESM scripts. Some information on **link_dirtree** is available in the `|cesmrelease| Scripts User's Guide `_. We also have some examples of it's use here and in other sections of this User's Guide. - -Using **link_dirtree** is quite simple, you give the directory where data exists and then the directory that you want to create where datasets will point to the original source files. In the example below we use "$HOME/inputdata", but MYCSMDATA could be any directory you have access to where you want to put your data. - -``` -> cd scripts -# First make sure you have a inputdata location that you can write to -# You only need to do this step once, so you won't need to do this in the future -# (except to bring in any updated files in the original $CSMDATA location). -> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data -> ./link_dirtree $CSMDATA $MYCSMDATA -``` - -Then when you create a case you will change ``DIN_LOC_ROOT_CSMDATA`` to point to the location you linked to rather than the default location. - -``> ./xmlchange DIN_LOC_ROOT_CSMDATA=$MYCSMDATA`` - -In order to list the files that you have created you merely need to use the UNIX command find to find the files that are NOT softlinks. So for example executing the following command: - -``> find $MYCSMDATA -type f -print`` - -for me gives the following truncated list of CLM_USRDAT_NAME files that I have created. - -``` -/glade/p/work/erik/inputdata/lnd/clm2/pftdata/pft-physiology.c130503.nc -/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-01.nc -/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-02.nc -/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-03.nc -/glade/p/work/erik/inputdata/atm/datm7/CLM1PT_data/1x1pt_BE-Vie/1997-04.nc -``` - -You can also use **find** to list files that have a particular pattern in the name as well (using the -name option with wildcards). Also you can always rerun the **link_dirtree** command if any new files are added that you need to be linked into your directory tree. Since, the files are soft-links -- it doesn't take up much space other than the files that you add there. This way all of the files are kept in one place, they are organized by usage according to CESM standards, and you can easily find your own files, and CLM can find them as well. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst index aa8265e8a9..1bc7810021 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst @@ -7,7 +7,7 @@ ========================= If you are adding files for new resolutions which aren't covered in the namelist_definition file -- you'll need to add them in. -The list of valid resolutions is in the id="res" entry in the ``$CTSMROOT/bld/namelist_files/namelist_definition_|version|.xml`` file. +The list of valid resolutions is in the id="res" entry in the ``$CTSMROOT/bld/namelist_files/namelist_definition_clm4_5.xml`` file. You need to choose a name for your new resolution and simply add it to the comma delimited list of valid_values for the id="res" entry. The convention for global Gaussian grids is number_of_latitudes x number_of_longitudes. The convention for global finite volume grids is latitude_grid_size x longitude_grid_size where latitude and longitude is measured in degrees. @@ -30,18 +30,3 @@ The only hard requirement is that names be unique for different grid files. Here As you can see you just add your new resolution names to the end of the valid_values list. - -When using PTCLM and adding supported single-point resolutions, you'll also want to add these resolutions to the ``$CTSMROOT/bld/config_files/config_definition.xml`` under the ``sitespf_pt`` name. -The entry in that file looks like: -:: - - - Flag to turn on site specific special configuration flags for supported single - point resolutions. See the specific config_defaults_*.xml file for the special - settings that are set for a particular site. - - -PTCLM assumes that any supported single-point resolutions are valid settings for ``sitespf_pt``. diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst index 52344bd5a0..cc360fba47 100644 --- a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst +++ b/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst @@ -6,22 +6,22 @@ Changing Default Filenames ============================ -To add or change the default filenames you edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_|version|.xml`` and either change an existing filename or add a new one. +To add or change the default filenames you edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5.xml`` and either change an existing filename or add a new one. Most entries in the default namelist files, include different attributes that describe the different properties that describe the differences in the datasets. Attributes include the: resolution, year to simulation, range of years to simulate for transient datafiles, the land-mask, the representative concentration pathway (rcp) for future scenarios, and the type of biogeochemistry (bgc) model used. -For example the fatmgrid for the 1.9x2.5 resolution is as follows: +For example the fsurdat for the 1.9x2.5 resolution is as follows: ``` - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_simyr1850_c130415.nc + +lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr1850_c170824.nc ``` -Other ``fsurdat`` files are distinguished from this one by their resolution (hgrid), simulation year (sim_year) and prognostic crop (crop) attributes. +Other ``fsurdat`` files are distinguished from this one by their resolution (hgrid), simulation year (sim_year) and prognostic crop (use_crop) attributes. To add or change the default filenames for CLM tools edit the ``$CTSMROOT/bld/namelist_files/namelist_defaults_|version|_tools.xml`` and either change an existing filename or add a new one. -Editing this file is similar to the ``namelist_defaults_|version|.xml`` talked about above. +Editing this file is similar to the ``namelist_defaults_clm4_5.xml`` talked about above. ---------------------------- diff --git a/doc/source/users_guide/adding-new-resolutions/index.rst b/doc/source/users_guide/adding-new-resolutions/index.rst index fded236989..97d97b0cc0 100644 --- a/doc/source/users_guide/adding-new-resolutions/index.rst +++ b/doc/source/users_guide/adding-new-resolutions/index.rst @@ -15,6 +15,5 @@ Adding New Resolutions :maxdepth: 2 CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst - CLM-3.1-Managing-Your-Own-Data-files.rst CLM-3.2-Adding-Resolution-Names.rst CLM-3.3-Adding-or-Changing-Default-Filenames.rst diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py index b8e187efd5..687732893a 100644 --- a/doc/source/users_guide/conf.py +++ b/doc/source/users_guide/conf.py @@ -78,6 +78,13 @@ # This patterns also effect to html_static_path and html_extra_path exclude_patterns = [ "clm5.0/manage_externals", + "clm5.0/components", + "clm5.0/cime/scripts", + "clm5.0/cime/doc", + "clm5.0/cime/config", + "clm5.0/cime/tools/statistical_ensemble_test", + "clm5.0/cime/src", + "clm5.0/cime/utils", "**/README_EXTERNALS.rst", "clm5.0/README.rst" ] From 41e2a7415ef968b2533359e3e5e486b5b9ed6161 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 21 Jun 2018 10:29:57 -0600 Subject: [PATCH 0196/1973] read biomass parameters from file --- src/biogeophys/CanopyFluxesMod.F90 | 125 +++++++++++++++++++++++------ src/main/clm_initializeMod.F90 | 2 +- src/main/clm_instMod.F90 | 2 + src/main/pftconMod.F90 | 16 ++++ src/main/readParamsMod.F90 | 5 +- 5 files changed, 125 insertions(+), 25 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index c3d009b31b..7a3f646a1d 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -51,6 +51,25 @@ module CanopyFluxesMod ! !PUBLIC TYPES: implicit none ! + ! !PUBLIC VARIABLES: + + type :: canopyflux_params_type + real(r8), allocatable, public :: dbh (:) + real(r8), allocatable, public :: fbw (:) + real(r8), allocatable, public :: nstem (:) + real(r8), allocatable, public :: rstem (:) + real(r8), allocatable, public :: wood_density (:) + contains + procedure, private :: allocParams + end type canopyflux_params_type + ! + type(canopyflux_params_type), public, protected :: params_inst ! params_inst is populated in readParamsMod + + type, public :: canopyflux_type + contains + procedure, public :: ReadParams + end type canopyflux_type + ! !PUBLIC MEMBER FUNCTIONS: public :: CanopyFluxesReadNML ! Read in namelist settings public :: CanopyFluxes ! Calculate canopy fluxes @@ -75,6 +94,76 @@ module CanopyFluxesMod contains + !----------------------------------------------------------------------- + subroutine allocParams ( this ) + ! + use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) + implicit none + + ! !ARGUMENTS: + class(canopyflux_params_type) :: this + ! + ! !LOCAL VARIABLES: + character(len=32) :: subname = 'allocParams' + !----------------------------------------------------------------------- + + ! allocate parameters + + allocate( this%dbh (0:mxpft) ) ; this%dbh(:) = nan + allocate( this%fbw (0:mxpft) ) ; this%fbw(:) = nan + allocate( this%nstem (0:mxpft) ) ; this%nstem(:) = nan + allocate( this%rstem (0:mxpft) ) ; this%rstem(:) = nan + allocate( this%wood_density(0:mxpft) ) ; this%wood_density(:) = nan + + end subroutine allocParams + + !----------------------------------------------------------------------- + subroutine readParams ( this, ncid ) + ! + ! !USES: + use ncdio_pio , only : file_desc_t,ncd_io + implicit none + + ! !ARGUMENTS: + class(canopyflux_type) :: this + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=32) :: subname = 'readParams' + character(len=100) :: errCode = '-Error reading in parameters file:' + logical :: readv ! has variable been read in or not + real(r8) :: temp1d(0:mxpft) ! temporary to read in parameter + character(len=100) :: tString ! temp. var for reading + !----------------------------------------------------------------------- + + ! read in parameters + + + call params_inst%allocParams() + + tString = "dbh" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%dbh=temp1d + tString = "fbw" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%fbw=temp1d + tString = "nstem" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%nstem=temp1d + tString = "rstem" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%rstem=temp1d + tString = "wood_density" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%wood_density=temp1d + + end subroutine readParams + !------------------------------------------------------------------------ subroutine CanopyFluxesReadNML(NLFilename) ! @@ -362,11 +451,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: sa_leaf(bounds%begp:bounds%endp) !surface area leaf m2/m2_ground real(r8) :: sa_internal(bounds%begp:bounds%endp) !min(sa_stem,sa_leaf) real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed - real(r8) :: bhd(0:mxpft) !stem breast-height-diameter - real(r8) :: fbw(0:mxpft) !stem diameter at breast-height - real(r8) :: nstem(0:mxpft) !number of stems per m2 - real(r8) :: rstem(0:mxpft) !stem resistance to heat transfer, per stem diameter - real(r8) :: wood_density(0:mxpft) !wood density (kg/m3) real(r8) :: cp_wood real(r8) :: carea_stem real(r8) :: rstema @@ -632,13 +716,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, eflx_sh_stem(p) = 0._r8 end do -! set pft specific stem properties (should be done on parameter file) - bhd(1:16) = (/0.2,0.3,0.3,0.35,0.35,0.25,0.25,0.2,0.05,0.05,0.05,0.008,0.008,0.008,0.008,0.008/) - fbw(1:16) = (/0.45,0.45,0.45,0.6,0.6,0.6,0.6,0.45,0.5,0.5,0.5,0.7,0.7,0.7,0.7,0.7/) - nstem(1:16) = (/0.4,0.4,0.4,0.2,0.2,0.2,0.2,0.4,0.5,0.5,0.5,100.,100.,100.,100.,100./) - rstem(1:16) = (/100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100.,100./) - wood_density(1:16) = (/500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500.,500./) - ! calculate biomass heat capacities do f = 1, fn p = filterp(f) @@ -649,22 +726,23 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, if(.not.use_biomass_heat_storage) then fstem(p) = 0._r8 endif -! do not calculate separate leaf/stem heat capacity for grasses - if(patch%itype(p) > 11) fstem(p) = 0.0 ! leaf and stem surface area sa_leaf(p) = elai(p) ! double in spirit of full surface area for sensible heat sa_leaf(p) = 2.*sa_leaf(p) - sa_stem(p) = nstem(patch%itype(p))*(htop(p)*shr_const_pi*bhd(patch%itype(p))) + sa_stem(p) = params_inst%nstem(patch%itype(p))*(htop(p)*shr_const_pi*params_inst%dbh(patch%itype(p))) ! adjust for departure of cylindrical stem model sa_stem(p) = k_cyl_area * sa_stem(p) if(.not.use_biomass_heat_storage) then sa_stem(p) = 0._r8 endif ! do not calculate separate leaf/stem heat capacity for grasses - if(patch%itype(p) > 11) sa_stem(p) = 0.0 + if(patch%itype(p) > 11) then + fstem(p) = 0.0 + sa_stem(p) = 0.0 + endif ! internal longwave fluxes between leaf and stem ! surface area term must be equal, remainder cancels @@ -677,14 +755,14 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! lma_dry has units of kg dry mass /m2 here (table 2 of bonan 2017) ! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) - cp_veg(p) = (0.25_r8 * max(0.01_r8,elai(p))) * (1400._r8 + (fbw(patch%itype(p))/(1.-fbw(patch%itype(p))))*4188._r8) + cp_veg(p) = (0.25_r8 * max(0.01_r8,elai(p))) * (1400._r8 + (params_inst%fbw(patch%itype(p))/(1.-params_inst%fbw(patch%itype(p))))*4188._r8) - carea_stem = shr_const_pi * (bhd(patch%itype(p))*0.5)**2 + carea_stem = shr_const_pi * (params_inst%dbh(patch%itype(p))*0.5)**2 ! cp-stem will have units J/k/ground_area (here assuming 1 stem/m2) - cp_stem(p) = (1400._r8 + (fbw(patch%itype(p))/(1.-fbw(patch%itype(p))))*4188._r8) + cp_stem(p) = (1400._r8 + (params_inst%fbw(patch%itype(p))/(1.-params_inst%fbw(patch%itype(p))))*4188._r8) ! use weight of dry wood - cp_stem(p) = nstem(patch%itype(p))* cp_stem(p) * wood_density(patch%itype(p)) * htop(p) * carea_stem + cp_stem(p) = params_inst%nstem(patch%itype(p))* cp_stem(p) * params_inst%wood_density(patch%itype(p)) * htop(p) * carea_stem ! adjust for departure from cylindrical stem model cp_stem(p) = k_cyl_vol * cp_stem(p) enddo @@ -1018,7 +1096,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, wtg(p) = 1._r8/rah(p,2) ! ground ! wtstem = sa_stem(p)/rb(p) ! stem ! add resistance between internal stem temperature and canopy air - rstema = rstem(patch%itype(p))*bhd(patch%itype(p)) + rstema = params_inst%rstem(patch%itype(p))*params_inst%dbh(patch%itype(p)) wtstem = sa_stem(p)/(rstema + rb(p)) ! stem wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) @@ -1204,7 +1282,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! The energy loss due to above two limits is added to ! the sensible heat flux. - eflx_sh_veg(p) = efsh + dc1*wtga(p)*dt_veg(p) + err(p) + erre + hvap*ecidif + eflx_sh_veg(p) = efsh + dc1*wtga(p)*dt_veg(p) + err(p) + erre + hvap*ecidif ! Update SH and lw_leaf for changes in t_veg eflx_sh_stem(p) = eflx_sh_stem(p) + forc_rho(c)*cpair*wtstem*(-wtl0(p)*dt_veg(p)) @@ -1236,7 +1314,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, zeta(p) = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) if (zeta(p) >= 0._r8) then !stable - zeta(p) = min(zetamax,max(zeta(p),0.01_r8)) +!remove cap zeta(p) = min(zetamax,max(zeta(p),0.01_r8)) + zeta(p) = min(100._r8,max(zeta(p),0.01_r8)) um(p) = max(ur(p),0.1_r8) else !unstable zeta(p) = max(-100._r8,min(zeta(p),-0.01_r8)) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 42f71ec526..12f43ad3db 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -340,7 +340,7 @@ subroutine initialize2( ) allocate(nutrient_competition_method, & source=create_nutrient_competition_method(bounds_proc)) - call readParameters(nutrient_competition_method, photosyns_inst) + call readParameters(nutrient_competition_method, photosyns_inst, canopyflux_inst) ! ------------------------------------------------------------------------ ! Initialize time manager diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 1b1b44adba..b33026326f 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -49,6 +49,7 @@ module clm_instMod use OzoneBaseMod , only : ozone_base_type use OzoneFactoryMod , only : create_and_init_ozone_type use PhotosynthesisMod , only : photosyns_type + use CanopyFluxesMod , only : canopyflux_type use SoilHydrologyType , only : soilhydrology_type use SoilStateType , only : soilstate_type use SolarAbsorbedType , only : solarabs_type @@ -99,6 +100,7 @@ module clm_instMod type(lakestate_type) :: lakestate_inst class(ozone_base_type), allocatable :: ozone_inst type(photosyns_type) :: photosyns_inst + type(canopyflux_type) :: canopyflux_inst type(soilstate_type) :: soilstate_inst type(soilhydrology_type) :: soilhydrology_inst type(solarabs_type) :: solarabs_inst diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 0efa2053eb..53fb8d0d0c 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -145,6 +145,12 @@ module pftconMod real(r8), allocatable :: root_radius (:) ! root radius (m) real(r8), allocatable :: root_density (:) ! root density (gC/m3) + real(r8), allocatable :: dbh (:) ! diameter at breast height (m) + real(r8), allocatable :: fbw (:) ! fraction of biomass that is water + real(r8), allocatable :: nstem (:) ! stem density (#/m2) + real(r8), allocatable :: rstem (:) ! stem resistance (s/m) + real(r8), allocatable :: wood_density (:) ! wood density (kg/m3) + ! crop ! These arrays give information about the merge of unused crop types to the types CLM @@ -460,6 +466,11 @@ subroutine InitAllocate (this) allocate( this%fun_cn_flex_c (0:mxpft) ) allocate( this%FUN_fracfixers(0:mxpft) ) + allocate( this%dbh (0:mxpft) ) + allocate( this%fbw (0:mxpft) ) + allocate( this%nstem (0:mxpft) ) + allocate( this%rstem (0:mxpft) ) + allocate( this%wood_density (0:mxpft) ) end subroutine InitAllocate @@ -1375,6 +1386,11 @@ subroutine Clean(this) deallocate( this%fun_cn_flex_c) deallocate( this%FUN_fracfixers) + deallocate( this%dbh) + deallocate( this%fbw) + deallocate( this%nstem) + deallocate( this%rstem) + deallocate( this%wood_density) end subroutine Clean end module pftconMod diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index 7fbea89531..f1c7a4aa43 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -23,7 +23,7 @@ module readParamsMod contains !----------------------------------------------------------------------- - subroutine readParameters (nutrient_competition_method, photosyns_inst) + subroutine readParameters (nutrient_competition_method, photosyns_inst, canopyflux_inst) ! ! ! USES: use CNSharedParamsMod , only : CNParamsReadShared @@ -43,9 +43,11 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) use NutrientCompetitionMethodMod , only : nutrient_competition_method_type use clm_varctl, only : NLFilename_in use PhotosynthesisMod , only : photosyns_type + use CanopyFluxesMod , only : canopyflux_type ! ! !ARGUMENTS: type(photosyns_type) , intent(in) :: photosyns_inst + type(canopyflux_type) , intent(in) :: canopyflux_inst class(nutrient_competition_method_type), intent(in) :: nutrient_competition_method ! ! !LOCAL VARIABLES: @@ -97,6 +99,7 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) ! Biogeophysics ! call photosyns_inst%ReadParams( ncid ) + call canopyflux_inst%ReadParams( ncid ) ! From c795d0bac5a756c42245282e6b075ad103c4300b Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 21 Jun 2018 11:12:39 -0600 Subject: [PATCH 0197/1973] remove comment --- src/biogeophys/CanopyFluxesMod.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 7a3f646a1d..293f75e742 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1476,11 +1476,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-fstem(p))*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+fstem(p)*tsbef(p)**3*(tsbef(p) + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) -!scs -if(ulrad(p) > 0. .and. ulrad(p) < 5.e3) then -else -write(iulog,*) 'badulrad: ', p, patch%itype(p),ulrad(p),tlbef(p),tsbef(p),dt_stem(p) -endif !ABT ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction From 1013e1c7451d0503102b651d9f6a7f971756934d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 21 Jun 2018 16:12:37 -0600 Subject: [PATCH 0198/1973] Update special cases chapter --- ...CLM5.0-biogeochemistry-(CLMBGC-spinup).rst | 34 +++---- ...tmospheric-forcing-to-spinup-the-model.rst | 10 +- ...tmospheric-forcing-to-spinup-the-model.rst | 26 +++-- ...transient-historical-CO2-concentration.rst | 97 +------------------ .../running-the-prognostic-crop-model.rst | 13 +-- .../running-with-irrigation.rst | 17 ++-- 6 files changed, 47 insertions(+), 150 deletions(-) diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst index 99fa3fdd47..0bbeda8e41 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst @@ -1,15 +1,15 @@ -.. _spinning-up-clm45-bgc: +.. _spinning-up-clm50-bgc: .. include:: ../substitutions.rst -===================== - Spinup of CLM5.0-BGC -===================== +========================== + Spinup of CLM5.0-BGC-Crop +========================== To get the |version|-BGC model to a steady state, you first run it from arbitrary initial conditions using the "accelerated decomposition spinup" (-bgc_spinup on in CLM **configure**) mode for 1000 simulation years. After this you branch from this mode in the "final spinup" (-bgc_spinup off in CLM **configure**), and run for (at least 200+ simulation years). -**1. 45_AD_SPINUP** +**1. 50_AD_SPINUP** For the first step of running 1000+ years in "-bgc_spinup on" mode, you will setup a case, and then edit the values in env_build.xml and env_run.xml so that the right configuration is turned on and the simulation is setup to run for the required length of simulation time. So do the following: Example:: AD_SPINUP Simulation for |version|-BGC @@ -17,23 +17,19 @@ Example:: AD_SPINUP Simulation for |version|-BGC :: > cd scripts - > ./create_newcase -case BGC_spinup -res f19_g17_gl4 -compset I1850Clm50BgcCropCru -mach cheyenne_intel + > ./create_newcase -case BGC_spinup -res f19_g17_gl4 -compset I1850Clm50BgcCropCru > cd BGC_spinup - # Append "-spinup on" to CLM_BLDNML_OPTS - > ./xmlchange CLM_BLDNML_OPTS="-bgc_spinup on" -append - # The following sets CLM_FORCE_COLDSTART to "on", and run-type to startup (you could also use an editor) - > ./xmlchange CLM_FORCE_COLDSTART=on,RUN_TYPE=startup - # Make the output history files only annual, by adding the following to the user_nl_clm namelist - > echo 'hist_nhtfrq = -8760' >> user_nl_clm + # Change accelerated spinup mode + > ./xmlchange CLM_ACCELERATED_SPINUP="on" # Now setup - > ./cesm_setup -case + > ./case.setup -case # Now build - > ./BGC_spinup.build + > ./case.build # The following sets RESUBMIT to 30 times in env_run.xml (you could also use an editor) # The following sets STOP_DATE,STOP_N and STOP_OPTION to Jan/1/1001, 20, "nyears" in env_run.xml (you could also use an editor) > ./xmlchange RESUBMIT=20,STOP_N=50,STOP_OPTION=nyears,STOP_DATE=10010101 # Now run normally - > ./BGC_spinup.submit + > ./case.submit .. note:: This same procedure works for |version|-CN as well, you can typically shorten the spinup time from 1000 years to 600 though. @@ -47,7 +43,7 @@ Example: Final CLMBGC Spinup Simulation for |version|-BGC :: > cd scripts - > ./create_newcase -case BGC_finalspinup -res f19_g17_gl4 -compset I1850Clm50BgcCropCru -mach cheyenne_intel + > ./create_newcase -case BGC_finalspinup -res f19_g17_gl4 -compset I1850Clm50BgcCropCru > cd BGC_finalspinup # Now, Copy the last CLM restart file from the earlier case into your run directory > cp /ptmp/$LOGIN/archive/BGC_spinup/rest/BGC_spinup.clm*.r*.1002-01-01-00000.nc \ @@ -60,14 +56,14 @@ Example: Final CLMBGC Spinup Simulation for |version|-BGC # Set the finidat file to the last restart file saved in previous step > echo ' finidat = "BGC_spinup.clm2.r.1002-01-01-00000.nc"' > user_nl_clm # Now setup - > ./cesm_setup + > ./case.setup > Now build - > ./BGC_finalspinup.build + > ./case.build # The following sets RESUBMIT to 4 times in env_run.xml (you could also use an editor) # The following sets STOP_N and STOP_OPTION to 50 and "nyears" in env_run.xml (you could also use an editor) > ./xmlchange RESUBMIT=4,STOP_OPTION=nyears,STOP_N=50 > Now run as normal - > ./BGC_finalspinup.submit + > ./case.submit To assess if the model is spunup plot trends of CLMBGC variables of interest. If you see a trend, you may need to run the simulation longer. Finally save the restart file from the end of this simulation to use as an "finidat" file for future simulations. diff --git a/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst index deb5fa1238..12903a18b5 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst @@ -17,17 +17,15 @@ Example: Simulation with MOAR Data on cheyenne :: > cd scripts - > ./create_newcase -case MOARforce1850 -res f19_g17_gl4 -compset I1850Clm50BgcSpinup -mach cheyenne_intel + > ./create_newcase -case MOARforce1850 -res f19_g17_gl4 -compset I1850Clm50BgcSpinup > cd MOARforce1850 # The following sets the casename to point to for atm forcing (you could also use an editor) > ./xmlchange DATM_CPL_CASE=b40.1850.track1.1deg.006a # The following sets the align year and years to run over for atm forcing # (you could also use an editor) > ./xmlchange DATM_CPL_YR_ALIGN=1,DATM_CPL_YR_START=960,DATM_CPL_YR_END=1030 - > ./cesm_setup + > ./case.setup # Now build and run as normal - > ./MOARforce1850.build - > ./MOARforce1850.submit + > ./case.build + > ./case.submit - -.. warning: Because of bug 1339 (see the `$CTSMROOT/doc/KnownBugs `_ file on this) you can't run with 83 or more years of forcing. If you do need to run with more years of forcing, you'll need to address the issue as outlined in the `$CTSMROOT/doc/KnownBugs `_ file. diff --git a/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst index 0999f7b366..34bb12ab49 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst @@ -16,9 +16,9 @@ Example: Fully Coupled Simulation to Create Data to Force Next Example Simulatio :: > cd scripts - > ./create_newcase -case myBCN1850 -res f09_g17_gl4 -compset B1850CN -mach cheyenne_intel - > cd myBCN1850 - > ./cesm_setup + > ./create_newcase -case myB1850 -res f09_g17_gl4 -compset B1850 + > cd myB1850 + > ./case.setup # Set histaux_a2x3hr to .true. in your user_nl_cpl output from the atmosphere model # will be saved 3 hourly echo "histaux_a2x3hr=.true." >> user_nl_cpl @@ -26,7 +26,7 @@ Example: Fully Coupled Simulation to Create Data to Force Next Example Simulatio > cp ../../models/drv/driver/ccsm_comp_mod.F90 SourceMods/src.cpl > $EDITOR SourceMods/src.cpl # Now build - > ./myBCN1850.build + > ./case.build # The following sets the archival disk space (you could also use an editor) > ./xmlchange DOUT_S_ROOT='/glade/home/$USER/$CASE' # Make sure files are archived to disk, but NOT to long term storage @@ -35,21 +35,19 @@ Example: Fully Coupled Simulation to Create Data to Force Next Example Simulatio # Set the run length to run a total of 20 years (you could also use an editor) > ./xmlchange RESUBMIT=9,STOP_OPTION=nyears,STOP_N=2 # Now run as normal - > ./myBCN1850.submit + > ./case.submit -.. warning:: Because of bug 1733 (see the `$CTSMROOT/doc/KnownBugs `_ file on this) you'll need to edit the driver code in order for it to produce the correct list of fields needed to run the model later. - -Now we run an I compset forced with the data from the previous simulation using the ``CPLHIST3HrWx`` option to DATM_MODE. See `the Section called CPLHIST3HrWx mode and it's DATM settings in Chapter 1 `_ for more information on the DATM settings for ``CPLHIST3HrWx`` mode. +Now we run an I compset forced with the data from the previous simulation using the CPLHISTForcing`` option to DATM_MODE. See `the Section called CPLHISTForcing mode and it's DATM settings in Chapter 1 `_ for more information on the DATM settings for ``CPLHISTForcing`` mode. Example: Simulation Forced with Data from the Previous Simulation ------------------------------------------------------------------------------ :: > cd scripts - > ./create_newcase -case frcwmyBCN1850 -res f09_g17_gl4 -compset I1850Clm50BgcSpinup -mach cheyenne_intel - > cd frcWmyBCN1850 + > ./create_newcase -case frcwmyB1850 -res f09_g17_gl4 -compset I1850Clm50BgcSpinup + > cd frcWmyB1850 # The following sets the casename to point to for atm forcing (you could also use an editor) - > ./xmlchange DATM_CPLHIST_CASE="myBCN1850" + > ./xmlchange DATM_CPLHIST_CASE="myB1850" # The following sets the align year and years to run over for atm forcing # (you could also use an editor) > ./xmlchange DATM_CPLHIST_YR_ALIGN="1",DATM_CPLHIST_YR_START=1,DATM_CPLHIST_YR_END=20 @@ -57,10 +55,10 @@ Example: Simulation Forced with Data from the Previous Simulation # file to the archival path of the case above in the form of: /glade/home/achive/$USER/$DATM_CPLHIST_CASE/cpl/hist # NOTE: THIS WILL CHANGE THE PATH FOR ALL I1850Clm50BgcSpinup COMPSET CASES MADE AFTER THIS! > $EDITOR ../../models/atm/datm/bld/namelist_files/namelist_defaults_datm.xml - > ./cesm_setup + > ./case.setup # Now build and run as normal - > ./frcwmyBCN1850.build - > ./frcwmyBCN1850.submit + > ./case.build + > ./case.submit .. note:: We did this by editing the "namelist_defaults_datm.xml" which will change the settings for ALL future ``I1850Clm50BgcSpinup`` cases you run. You could also do this by editing the path in the resulting streams text files in the CaseDocs directory, and then create a "user\_" streams file with the correct path. This would change the streams file JUST for this case. The steps do it this way are: diff --git a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst index b7d063a2a2..9883662a4b 100644 --- a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst +++ b/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst @@ -37,104 +37,17 @@ Example: Transient Simulation with Historical CO2 :: > cd scripts - > ./create_newcase -case DATM_CO2_TSERIES -res f19_g17_gl4 -compset I20TRCRUCLM45BGC + > ./create_newcase -case DATM_CO2_TSERIES -res f19_g17_gl4 -compset IHistClm50BgcCrop > cd DATM_CO2_TSERIES - # Set CCSM_BGC to CO2A so that CO2 will be passed from atmosphere to land - # Set CLM_CO2_TYPE to diagnostic so that the land will use the value sent from the atmosphere - > ./xmlchange CCSM_BGC=CO2A,CLM_CO2_TYPE=diagnostic + # Historical CO2 will already be setup correctly for this compset + # to check that look at the variables: CCSM_BGC,CLM_CO2_TYPE, and DATM_CO2_TSERIES + > ./xmlquery CCSM_BGC,CLM_CO2_TYPE,DATM_CO2_TSERIES + # Expect: CCSM_BGC=CO2A,CLM_CO2_TYPE=diagnostic,DATM_CO2_TSERIES=20tr > ./case.setup - # Create the streams file for CO2 - > cat << EOF >> datm.streams.txt.co2tseries - - - - This is a streams file to pass historical CO2 from datm8 to the other - surface models. It reads in a historical dataset derived from data used - by CAM. The getco2_historical.ncl script in $CTSMROOT2/tools/ncl_scripts - was used to convert the CAM file to a streams compatible format (adding domain - information and making CO2 have latitude/longitude even if only for a single - point. - - - - Input stream description file for historical CO2 reconstruction data - - 04 March 2010: Converted to form that can be used by datm8 by Erik Kluzek - 18 December 2009: Prepared by B. Eaton using data provided by - Jean-Francois Lamarque. All variables except f11 are directly from - PRE2005_MIDYR_CONC.DAT. Data from 1765 to 2007 with 2006/2007 just - a repeat of 2005. - - - CLMNCEP - - - - time time - lonc lon - latc lat - area area - mask mask - - - $CSMDATA/atm/datm7/CO2 - - - fco2_datm_1765-2007_c100614.nc - - - - - CO2 co2diag - - - $CSMDATA/atm/datm7/CO2 - - - fco2_datm_1765-2007_c100614.nc - - - - - - EOF - - # And copy it to the run directory - > cp datm.streams.txt.co2tseries $RUNDIR - # Run preview namelist so we have the namelist in CaseDocs > ./preview_namelists -The first thing we will do is to edit the ``user_nl_datm`` file to add a CO2 file stream in. -To do this we will copy a ``user_nl_datm`` in with the changes needed. The file ``addco2_user_nl_datm.user_nl`` is in ``$CTSMROOT/doc/UsersGuide`` and looks like this... -:: - - dtlimit = 1.5,1.5,1.5,1.5,1.5 - fillalgo = 'nn','nn','nn','nn','nn' - fillmask = 'nomask','nomask','nomask','nomask','nomask' - mapalgo = 'bilinear','bilinear','bilinear','bilinear','nn' - mapmask = 'nomask','nomask','nomask','nomask',nomask' - 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.presaero.trans_1850-2000 1849 1849 2006", - "datm.streams.txt.co2tseries 1766 1766 2005 " - taxmode = 'cycle','cycle','cycle','cycle','extend' - tintalgo = 'coszen','nearest','linear','linear','linear' - -You just copy this into your case directory. But, also compare it to the version in ``CaseDocs`` to make sure the changes are just to add in the new CO2 stream. Check to see that filenames, and start, end and align years are correct. -:: - - > cp ../../$CTSMROOT/doc/UsersGuide/addco2_user_nl_datm.user_nl user_nl_datm - > diff user_nl_datm CaseDocs/datm_atm_in - Once, you've done that you can build and run your case normally. -.. warning:: This procedure assumes you are using a ``I20TRCRUCLM45BGC`` compset out of the box, with ``DATM_PRESAERO`` equal to trans_1850-2000. So it assumes standard |version| CRUNCEP atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes anything here your ``user_nl_datm`` file will need to be adjusted to work with it. - -.. note:: The intent of the ``user_nl_datm`` is to add an extra streams file for CO2 to the end of the streams variable, and other arrays associated with streams (adding mapalgo as a new array with bilinear for everything, but the CO2 file which should be "nn" for nearest neighbor). Other variables should be the same as the other stream values. - -.. warning:: The streams file above is hard-coded for the path of the file on NCAR computers. To use it on an outside machine you'll need to edit the filepath in the streams file to point to the location where you have the file. - -After going through these steps, you will have a case where you have datm reading in an extra streams text file that points to a data file with CO2 data on it that will send that data to the CLM. - diff --git a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst index 308c749adc..20ea12e91f 100644 --- a/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst +++ b/doc/source/users_guide/running-special-cases/running-the-prognostic-crop-model.rst @@ -6,9 +6,10 @@ Running the prognostic crop model =================================== -The prognostic crop model is setup to work with |version|-BGC or CLM4.0-CN (with or without DV) for present day conditions and we have surface and initial condition datasets at f19 resolution. +The prognostic crop model is setup to work with CLM4.0, CLM4.5 or |version| with either BGC or CN (with or without DV). In order to use the initial condition file, we need to set the ``RUN_TYPE`` to startup rather than ``hybrid`` since the compset for f19 sets up to use an initial condition file without crop active. -To activate the crop model you can choose a compset that has "CROP" in the name such as "ICRUCLM45BGCCROP" or simply add "-crop on" to ``CLM_CONFIG_OPTS``. +To activate the crop model you can choose a compset that has "Crop" in the name such as "I1850Clm50BgcCropCru" or simply add +"-crop" to ``CLM_BLDNML_OPTS`` (or for CLM4.0 add "-crop on" to ``CLM_CONFIG_OPTS``). Example: Crop Simulation ------------------------------------ @@ -18,14 +19,6 @@ Example: Crop Simulation > ./create_newcase -case CROP -res f19_g17_gl4 -compset I1850Clm50BgcCropCru > cd CROP - # Append "-crop on" to CLM_CONFIG_OPTS in env_build.xml (you could also use an editor) - > ./xmlchange CLM_CONFIG_OPTS="-crop on" -append - - # Change to startup type so uses spunup initial conditions file for crop if it exists - # By default the model will do a hybrid startup with an initial condition file - # incompatible with the crop surface dataset. - - > ./xmlchange RUN_TYPE=startup > ./case.setup # Now build and run normally diff --git a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst index 3a7b0e3ccf..aa99179971 100644 --- a/doc/source/users_guide/running-special-cases/running-with-irrigation.rst +++ b/doc/source/users_guide/running-special-cases/running-with-irrigation.rst @@ -6,9 +6,12 @@ Running with irrigation =================================== -In |version| irrigation can ONLY be used WITH crop. +In CLM4.0 irrigation isn't an allowed option. +In CLM4.5 irrigation can ONLY be used WITH crop. With CLM5.0 irrigation can be used whether crop is on or not -- **BUT** +if crop is off, your surface datasets **HAVE** to have irrigation defined appropriately. Right now *ALL* surface +datasets without crop enabled have irrigation hard-wired on. In order to create datasets with irrigation off, you'd need +to make changes to ``mksurfdata_map`` in order to have all generic crops to be non-irrigated. To turn on irrigation in |version| we simply add "-irrig on" to ``CLM_BLDNML_OPTS``. -Just as in the crop example we also change ``RUN_TYPE`` to ``startup`` so that we don't use an initial condition file that is incompatible with irrigation. Example: Irrigation Simulation ------------------------------------------ @@ -16,16 +19,12 @@ Example: Irrigation Simulation # Note here we do a CLMSP simulation as that is what has been validated > cd scripts - > ./create_newcase -case IRRIG -res f19_g17_gl4 -compset I + > ./create_newcase -case IRRIG -res f19_g17_gl4 -compset I1850Clm50BgcCrop > cd IRRIG - # Append "-irrig" to CLM_BLDNML_OPTS in env_run.xml (you could also use an editor) - > ./xmlchange CLM_BLDNML_OPTS="-irrig" -append + # Append "-irrig on" to CLM_BLDNML_OPTS in env_run.xml (you could also use an editor) + > ./xmlchange CLM_BLDNML_OPTS="-irrig on" -append - # Change to startup type so uses spunup initial conditions file for irrigation if it exists - # By default the model will do a hybrid startup with an initial condition file - # incompatible with the irrigation surface dataset. - > ./xmlchange RUN_TYPE=startup > ./case.setup # Now build and run normally From 12905cdce7746c96f85d868e0151a2c20ff446e0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 27 Jun 2018 14:24:02 -0600 Subject: [PATCH 0199/1973] Pass over the running-single-points chapter --- .../running-pts_mode-configurations.rst | 5 +--- .../running-single-point-configurations.rst | 29 +++++++------------ ...point-and-regional-grid-configurations.rst | 10 +++---- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst index c7a1ed0def..a75f18b977 100644 --- a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst @@ -21,8 +21,6 @@ To setup a ``PTS_MODE`` simulation you use the "-pts_lat" and "-pts_lon" argumen Then setup, build and run as normal. We make sure initial conditions are NOT used since ``PTS_MODE`` currently CAN NOT run with initial conditions. -.. note:: By default it sets up to run with MPILIB=mpi-serial (in the env_build.xml file) turned on, which allows you to run the model interactively. On some machines this mode is NOT supported and you may need to change it to FALSE before you are able to build. - .. warning:: ``PTS_MODE`` currently does NOT restart nor is it able to startup from global initial condition files. See bugs "1017 and 1025" in the `$CTSMROOT/doc/KnownLimitationss `_ file. .. note:: You can change the point you are simulating for at run-time by changing the values of ``PTS_LAT`` and ``PTS_LON`` in the ``env_run.xml`` file. @@ -37,6 +35,5 @@ You might also want to set the ``env_build.xml`` variable: ``MPILIB=mpi-serial`` On many machines, batch queues have a minimum number of nodes or processors that can be used. On these machines you may have to change the queue and possibly the time-limits of the job, to get it to run in the batch queue. -On the NCAR machine, cheyenne, this is done for you automatically, and the "caldera" queue is used for such single-processor simulations. -Another way to get around this problem is to run the job interactively using ``MPILIB=mpi-serial`` so that you don't submit the job to the batch queue. +On the NCAR machine, cheyenne, this is done for you automatically, and the "share" or "caldera" queue is used for such single-processor simulations. For single point mode you also may want to consider using a smaller workstation or cluster, rather than a super-computer, because you can't take advantage of the multi-processing power of the super-computer anyway. diff --git a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst index 6a2dc4e44d..02a7345e79 100644 --- a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst @@ -34,13 +34,13 @@ The resolution names that have an underscore in them ("_") are all single-point To run for the Brazil test site do the following: -Example: Running CLM over a single-point test site in Brazil with the default Qian atmosphere data forcing. --------------------------------------------------------------------------------------------------------------------------- +Example: Running CLM over a single-point test site in Brazil +------------------------------------------------------------ :: > cd scripts > set SITE=1x1_brazil - > ./create_newcase -case testSPDATASET -res $SITE -compset I + > ./create_newcase -case testSPDATASET -res $SITE -compset I2000Clm50SpGs > cd testSPDATASET Then setup, build and run normally. @@ -54,11 +54,8 @@ Example: Running CLM over the single-point of Mexicocity Mexico with the default > cd scripts # Set a variable to the site you want to use (as it's used several times below) > set SITE=1x1_mexicocityMEX - > ./create_newcase -case testSPDATASET -res $SITE -compset I + > ./create_newcase -case testSPDATASET -res $SITE -compset I1PtClm50SpGs > cd testSPDATASET - # Set DATM prescribed aerosols to single-point dataset - # Will then use the dataset with just the point for this $SITE - > ./xmlchange DATM_PRESAERO=pt1_pt1 Then setup, build and run normally. @@ -72,9 +69,9 @@ Using Supported Single-point Datasets that have their own Atmospheric Forcing ================================================================================ Of the supported single-point datasets we have three that also have atmospheric forcing data that go with them: Mexico City (Mexico), Vancouver, (Canada, British Columbia), and ``urbanc_alpha`` (test data for an Urban inter-comparison project). -Mexico city and Vancouver also have "#ifdef" in the source code for them to work with modified urban data parameters that are particular to these locations. -They can be turned on by using the ``CLM_CONFIG_OPTS env_build.xml`` variable to set the "-sitespf_pt" option in the CLM **configure**. +Mexico city and Vancouver also have namelist options in the source code for them to work with modified urban data parameters that are particular to these locations. To turn on the atmospheric forcing for these datasets, you set the ``env_run.xml DATM_MODE`` variable to ``CLM1PT``, and then the atmospheric forcing datasets will be used for the point picked. +If you use one of the compsets that has "I1Pt" in the name that will be set automatically. When running with datasets that have their own atmospheric forcing you need to be careful to run over the period that data is available. If you have at least one year of forcing it will cycle over the available data over and over again no matter how long of a simulation you run. @@ -94,12 +91,9 @@ Example: Running CLM over the single-point of Vancouver Canada with supplied atm > set SITE=1x1_vancouverCAN # Create a case at the single-point resolutions with their forcing - > ./create_newcase -case testSPDATASETnAtmForcing -res $SITE -compset I1PTCLM45 + > ./create_newcase -case testSPDATASETnAtmForcing -res $SITE -compset I1PtClm50SpGs > cd testSPDATASETnAtmForcing - # Set namelist options for urban test site - > ./xmlchange CLM_NML_USE_CASE=stdurbpt_pd - # Figure out the start and end date for this dataset # You can do this by examining the datafile. > set STOP_N=330 @@ -116,13 +110,10 @@ Example: Running CLM over the single-point of Vancouver Canada with supplied atm hist_nhtfrq = -1,1,1 EOF - # Set DATM prescribed aerosols to single-point dataset - # Will then use the dataset with just the point for this site - > ./xmlchange DATM_PRESAERO=pt1_pt1 > ./case.setup -.. warning:: If you don't set the start-year and run-length carefully as shown above the model will abort with a "dtlimit error" in the atmosphere model (see bug 1110 in the `$CTSMROOT/doc/KnownLimitationss `_ file for documentation on this). Since, the forcing data for this site (and the MexicoCity site) is less than a year, the model won't be able to run for a full year. The ``1x1_urbanc_alpha`` site has data for more than a full year, but neither year is complete hence, it has the same problem (see the problem for this site above). +.. warning:: If you don't set the start-year and run-length carefully as shown above the model will abort with a "dtlimit error" in the atmosphere model. Since, the forcing data for this site (and the MexicoCity site) is less than a year, the model won't be able to run for a full year. The ``1x1_urbanc_alpha`` site has data for more than a full year, but neither year is complete hence, it has the same problem (see the problem for this site above). .. note:: Just like ``PTS_MODE`` above, By default it sets up to run with ``MPILIB=mpi-serial`` (in the env_build.xml file) turned on, which allows you to run the model interactively. @@ -140,7 +131,7 @@ Example: Using CLM_USRDAT_NAME to run a simulation using user datasets for a spe :: > cd scripts - > ./create_newcase -case my_userdataset_test -res CLM_USRDAT -compset ICRUCLM45 + > ./create_newcase -case my_userdataset_test -res CLM_USRDAT -compset I2000Clm50BgcCruGs > cd my_userdataset_test/ > set GRIDNAME=13x12pt_f19_alaskaUSA > set LMASK=gx1v6 @@ -204,7 +195,7 @@ Example: Setting up a case from the single-point surface dataset just created > ./link_dirtree $CSMDATA $MYCSMDATA # Copy the file you created above to your new $MYCSMDATA location following the CLMUSRDAT # naming convention (leave off the creation date) - > cp $CESMROOT/$CTSMROOT/tools/|version|/mksurfdata_map/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ + > cp $CESMROOT/$CTSMROOT/tools/mksurfdata_map/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ $MYCSMDATA/lnd/clm2/surfdata_map/surfdata_${GRIDNAME}_simyr1850.nc > cd $CESMROOT/scripts > ./create_newcase -case my_usernldatasets_test -res CLM_USRDAT -compset I1850Clm50BgcCropCru \ diff --git a/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst b/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst index 41f55e38f1..9564b1649c 100644 --- a/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst +++ b/doc/source/users_guide/running-single-points/single-point-and-regional-grid-configurations.rst @@ -17,10 +17,10 @@ There are three different ways to do this for normal-supported site ``CLM_USRDAT_NAME`` runs using your own datasets (single-point or regional). -``PTCLM`` +``PTCLMmkdata`` easily setup simulations to run for tower sites.. -.. note:: ``PTS_MODE`` and ``PTCLM`` only works for a single point, while the other two options can also work for regional datasets as well. +.. note:: ``PTS_MODE`` and ``PTCLMmkdata`` only works for a single point, while the other two options can also work for regional datasets as well. .. _options-for-single-points: @@ -42,12 +42,12 @@ With this method you don't have to change DATM or add files to the XML database However, once the files are named and in the proper location, you can easily setup new cases that use these datasets. This is good for treating all the required datasets as a "group" and for a particular model version. For advanced CLM developers who need to track dataset changes with different model versions you would be best off adding these datasets as supported datasets with the "normal supported datasets" method. -Lastly *PTCLM* is a great way to easily create datasets, setup simulations and run simulations for tower sites. +Lastly *PTCLMmkdata* is a great way to easily create datasets, setup simulations and run simulations for tower sites. It takes advantage of both normal supported site functionality and CLM_USRDAT_NAME internally. -A big advantage to it, is that it's one-stop shopping, it runs tools to create datasets, and runs **create_newcase** and sets the appropriate env variables for you. So you only have to learn how to run one tool, rather than work with many different ones. PTCLM is described in the next chapter `Chapter 6 `_. +A big advantage to it, is that it's one-stop shopping, it runs tools to create datasets, and runs **create_newcase** and sets the appropriate env variables for you. So you only have to learn how to run one tool, rather than work with many different ones. PTCLMmkdata is described in the next chapter `Chapter 6 `_. Finally, if you also have meteorology data that you want to force your CLM simulations with you'll need to setup cases as described in `the Section called Running with your own atmosphere forcing `_. You'll need to create CLM datasets either according to ``CLM_USRDAT_NAME``. You may also need to modify DATM to use your forcing data. -And you'll need to change your forcing data to be in a format that DATM can use. In the PTCLM chapter `the Section called Converting AmeriFlux Data for use by PTCLM in Chapter 6 `_ section tells you how to use AmeriFlux data for atmospheric forcing. +And you'll need to change your forcing data to be in a format that DATM can use. In the PTCLMmkdata chapter `the Section called Converting AmeriFlux Data for use by PTCLMmkdata in Chapter 6 `_ section tells you how to use AmeriFlux data for atmospheric forcing. From 6f4998024b845263d0910791b334bc74b596bdfe Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 27 Jun 2018 15:11:17 -0600 Subject: [PATCH 0200/1973] Remove pointing to KnownLimitations file, correct some grammar and remove mention of linkdirtree that is now gone --- .../running-pts_mode-configurations.rst | 8 ++++---- .../running-single-point-configurations.rst | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst index a75f18b977..b5ce4eadb7 100644 --- a/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-pts_mode-configurations.rst @@ -21,13 +21,13 @@ To setup a ``PTS_MODE`` simulation you use the "-pts_lat" and "-pts_lon" argumen Then setup, build and run as normal. We make sure initial conditions are NOT used since ``PTS_MODE`` currently CAN NOT run with initial conditions. -.. warning:: ``PTS_MODE`` currently does NOT restart nor is it able to startup from global initial condition files. See bugs "1017 and 1025" in the `$CTSMROOT/doc/KnownLimitationss `_ file. +.. warning:: ``PTS_MODE`` currently does NOT restart nor is it able to startup from global initial condition files. This is a known issue we are unlikely to fix. .. note:: You can change the point you are simulating for at run-time by changing the values of ``PTS_LAT`` and ``PTS_LON`` in the ``env_run.xml`` file. -================================== - Running on in a single processor -================================== +============================== + Running in a single processor +============================== Note, that when running with ``PTS_MODE`` the number of processors is automatically set to one. When running a single grid point you can only use a single processor. diff --git a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst index 02a7345e79..fd71d44de5 100644 --- a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst @@ -208,4 +208,4 @@ Example: Setting up a case from the single-point surface dataset just created > ./xmlchange CLM_USRDAT_NAME=$GRIDNAME > ./case.setup -.. note:: With this and previous versions of the model we recommended using ``CLM_USRDAT_NAME`` as a way to identify your own datasets without having to enter them into the XML database. This has two down-sides. First you can't include creation dates in your filenames, which means you can't keep track of different versions by date. It also means you HAVE to rename the files after you created them with **mksurfdata.pl**. And secondly, you have to use **linkdirtree** in order to place the files in a location outside of the usual ``DIN_LOC_ROOT`` (assuming you don't have write access to adding new files to the standard location on the machine you are using). Now, since ``user_nl`` files are supported for ALL model components, and the same domain files are read by both CLM and DATM and set using the envxml variables: ``ATM_DOMAIN_PATH``, ``ATM_DOMAIN_FILE``, ``LND_DOMAIN_PATH``, and ``LND_DOMAIN_FILE`` -- you can use this mechanism (``user_nl_clm`` and ``user_nl_datm`` and those envxml variables) to point to your datasets in any location. In the future we will deprecate ``CLM_USRDAT_NAME`` and recommend ``user_nl_clm`` and ``user_nl_datm`` and the ``DOMAIN`` envxml variables. +.. note:: With this and previous versions of the model we recommended using ``CLM_USRDAT_NAME`` as a way to identify your own datasets without having to enter them into the XML database. This has the down-side that you can't include creation dates in your filenames, which means you can't keep track of different versions by date. It also means you HAVE to rename the files after you created them with **mksurfdata.pl**. Now, since ``user_nl`` files are supported for ALL model components, and the same domain files are read by both CLM and DATM and set using the envxml variables: ``ATM_DOMAIN_PATH``, ``ATM_DOMAIN_FILE``, ``LND_DOMAIN_PATH``, and ``LND_DOMAIN_FILE`` -- you can use this mechanism (``user_nl_clm`` and ``user_nl_datm`` and those envxml variables) to point to your datasets in any location. In the future we will deprecate ``CLM_USRDAT_NAME`` and recommend ``user_nl_clm`` and ``user_nl_datm`` and the ``DOMAIN`` envxml variables. From a956812b6e4417d4cd63da739368cea62a554fc2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 28 Jun 2018 14:28:55 -0600 Subject: [PATCH 0201/1973] Work on PTCLMmkdata chapter --- .../running-PTCLM/adding-ptclm-site-data.rst | 44 +++-- .../running-PTCLM/introduction-to-ptclm.rst | 71 ++++---- .../running-PTCLM/ptclm-examples.rst | 63 ++----- .../users_guide/running-PTCLM/using-ptclm.rst | 168 +++++------------- 4 files changed, 108 insertions(+), 238 deletions(-) diff --git a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst index 425e6d9c25..b643e79a28 100644 --- a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst +++ b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst @@ -2,13 +2,13 @@ .. include:: ../substitutions.rst -====================== -Adding PTCLM Site Data -====================== +============================ +Adding PTCLMmkdata Site Data +============================ -The "sitegroupname" option to PTCLM1.110726 looks for groups of sites in the files in the ``PTCLM_sitedata`` directory under the PTCLM directory. +The "sitegroupname" option to PTCLMmkdata looks for groups of sites in the files in the ``PTCLM_sitedata`` directory under the PTCLMmkdata directory. You can add new names available for this option including your own lists of sites, by adding more files in this directory. -There are three files for each "sitegroupname": ``$SITEGROUP_sitedata.txt``, ``$SITEGROUP_soildata.txt`` and ``$SITEGROUP_pftdata.txt`` (where ``$SITEGROUP`` is the name that would be entered as "sitegroupname" to PTCLM). +There are three files for each "sitegroupname": ``$SITEGROUP_sitedata.txt``, ``$SITEGROUP_soildata.txt`` and ``$SITEGROUP_pftdata.txt`` (where ``$SITEGROUP`` is the name that would be entered as "sitegroupname" to PTCLMmkdata). Each file needs to have the same list of sites, but gives different information: site data, PFT data, and soil data respectively. Although the site codes need to be the same between the three files, the files do NOT have to be in the same order. Each file has a one-line header that lists the contents of each column which are separated by commas. @@ -36,20 +36,20 @@ PFT data file: ``$SITEGROUP_pftdata.txt```): The header for this file is: This file gives the vegetation coverage for the different vegetation types for the site. The file only supports up to five PFT's at the same time. The columns with "pft_f" are the fractions for each PFT, and the columns with "pft_c" is the integer index of the given PFT. Look at the pft-physiology file to see what the PFT index for each PFT type is. ----------------------------------------------- -Dynamic Land-Use Change Files for use by PTCLM ----------------------------------------------- +---------------------------------------------------- +Dynamic Land-Use Change Files for use by PTCLMmkdata +---------------------------------------------------- -There is a mechanism for giving site-specific land-use change in PTCLM. Adding site specific files to the ``PTCLM_sitedata`` directory under PTCLM allows you to specify the change in vegetation and change in harvesting (for the CN model) for that site. Files are named: ``$SITE_dynpftdata.txt``. There is a sample file for the US-Ha1 site called: ``US-Ha1_dynpftdata.txt``. The file has a one-line header with the information that the file has, and then one-line for each year with a transition. The header line is as follows: +There is a mechanism for giving site-specific land-use change in PTCLMmkdata. Adding site specific files to the ``PTCLM_sitedata`` directory under PTCLMmkdata allows you to specify the change in vegetation and change in harvesting (for the CN model) for that site. Files are named: ``$SITE_dynpftdata.txt``. There is a sample file for the US-Ha1 site called: ``US-Ha1_dynpftdata.txt``. The file has a one-line header with the information that the file has, and then one-line for each year with a transition. The header line is as follows: :: trans_year,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5,har_vh1,har_vh2,har_sh1,har_sh2,har_sh3,graze,hold_harv,hold_graze -This file only requires a line for each year where a transition or harvest happens. As in the "pftdata" file above "pft_f" refers to the fraction and "pft_c" refers to the PFT index, and only up to five vegetation types are allowed to co-exist. The last eight columns have to do with harvesting and grazing. The last two columns are whether to hold harvesting and/or grazing constant until the next transition year and will just be either 1 or 0. This file will be converted by the **PTCLM_sitedata/cnvrt_trnsyrs2_pftdyntxtfile.pl** script in the PTCLM directory to a format that **mksurfdata_map** can read that has an entry for each year for the range of years valid for the compset in question. +This file only requires a line for each year where a transition or harvest happens. As in the "pftdata" file above "pft_f" refers to the fraction and "pft_c" refers to the PFT index, and only up to five vegetation types are allowed to co-exist. The last eight columns have to do with harvesting and grazing. The last two columns are whether to hold harvesting and/or grazing constant until the next transition year and will just be either 1 or 0. This file will be converted by the **PTCLM_sitedata/cnvrt_trnsyrs2_pftdyntxtfile.pl** script in the PTCLMmkdata directory to a format that **mksurfdata_map** can read that has an entry for each year for the range of years valid for the compset in question. ------------------------------------------- -Converting AmeriFlux Data for use by PTCLM ------------------------------------------- +------------------------------------------------ +Converting AmeriFlux Data for use by PTCLMmkdata +------------------------------------------------ AmeriFlux data comes in comma separated format and is available from: `http://public.ornl.gov/ameriflux/dataproducts.shtml `_. Before you download the data you need to agree to the usage terms. @@ -75,23 +75,23 @@ The units of Temperature need to be converted from "Celsius" to "Kelvin" (use th The units of Pressure also need to be converted from "kPa" to "Pa". LATIXY, and LONGXY should also be set to the latitude and longitude of the site. ------------------------------------------------------------ -Example: PTCLM transient example over a shorter time period ------------------------------------------------------------ +----------------------------------------------------------------- +Example: PTCLMmkdata transient example over a shorter time period +----------------------------------------------------------------- -This is an example of using PTCLM for Harvard Forest (AmeriFlux site code US-Ha1) for transient land use 1991-2006. -In order to do this we would've needed to have converted the AmeriFlux data into NetCDF format as show in the `the Section called Converting AmeriFlux Data for use by PTCLM `_ section above. -Also note that this site has a site-specific dynamic land-use change file for it ``PTCLM_sitedata/US-Ha1_dynpftdata.txt`` in the PTCLM directory and this file will be used for land-use change and harvesting rather than the global dataset. +This is an example of using PTCLMmkdata for Harvard Forest (AmeriFlux site code US-Ha1) for transient land use 1991-2006. +In order to do this we would've needed to have converted the AmeriFlux data into NetCDF format as show in the `the Section called Converting AmeriFlux Data for use by PTCLMmkdata `_ section above. +Also note that this site has a site-specific dynamic land-use change file for it ``PTCLM_sitedata/US-Ha1_dynpftdata.txt`` in the PTCLMmkdata directory and this file will be used for land-use change and harvesting rather than the global dataset. :: - > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM + > cd $CTSMROOT/tools/PTCLM # We are going to use forcing data over 1991 to 2006, but we need to start with # a transient compset to do so, so we use the 20th Century transient: 1850-2000 # Note: When creating the fpftdyn dataset for this site it will use the # PTCLM_sitedata/US-Ha1_dynpftdata.txt # file for land-use change and harvesting - > ./PTCLM.py -m cheyenne_intel -s US-Ha1 -d $MYCSMDATA --sitegroupname AmeriFlux -c I20TRCRUCLM45BGC + > ./PTCLMmkdata -s US-Ha1 -d $MYCSMDATA --sitegroupname AmeriFlux > mkdir $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 > cd $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 # Copy data in NetCDF format to this directory, filenames should be YYYY-MM.nc @@ -107,5 +107,3 @@ Also note that this site has a site-specific dynamic land-use change file for it > cat << EOF >> user_nl_clm model_year_align_ndep=1991,stream_year_first_ndep=1991,stream_year_last_ndep=2006 EOF - # Now setup the case, and we'll edit the datm namelist for prescribed aerosols - > ./cesm_setup diff --git a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst index 0c49f6ad78..50476e0261 100644 --- a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst @@ -4,38 +4,39 @@ .. _what-is-ptclm: -=============== - What is PTCLM -=============== +===================== + What is PTCLMmkdata? +===================== -PTCLM (pronounced either as point clime or Pee-Tee clime) is a Python script to help you set up PoinT CLM simulations. +PTCLMmkdata (pronounced Pee-Tee Cee-L-M make data is a Python script to help you set up PoinT CLM simulations. -It runs the CLM tools for you to get datasets set up, and copies them to a location you can use them according to the ``CLM_USRDAT_NAME`` naming convention. +It runs the CLM tools for you to get datasets set up, and copies them to a location you can use them including the changes +needed for a case to use the dataset with namelist and XML changes. -Then it runs **create_newcase** for you and modifies the env settings and namelist appropriately. +Then you run **create_newcase** and point to the directory so that the namelist and XML changes are automatically applied. -PTCLM has a simple ASCII text file for storing basic information for your sites. +PTCLMmkdata has a simple ASCII text file for storing basic information for your sites. We also have complete lists for AmeriFlux and Fluxnet-Canada sites, although we only have the meteorology data for one site. For other sites you will need to obtain the meteorology data and translate it to a format that the CESM datm model can use. -But, even without meteorology data PTCLM is useful to setup datasets to run with standard ``CLM_QIAN`` data. +But, even without meteorology data PTCLMmkdata is useful to setup datasets to run with standard ``CLM_QIAN`` data. -The original authors of PTCLM are: Daniel M. Ricciuto, Dali Wang, Peter E. Thornton, Wilfred M. Post all at Environmental Sciences Division, Oak Ridge National Laboratory (ORNL) and R. Quinn Thomas at Cornell University. It was then modified fairly extensively by Erik Kluzek at NCAR. We want to thank all of these individuals for this contribution to the CESM effort. We also want to thank the folks at University of Michigan Biological Stations (US-UMB) who allowed us to use their Fluxnet station data and import it into our inputdata repository, especially Gil Bohrer the PI on record for this site. +The original authors of PTCLMmkdata are: Daniel M. Ricciuto, Dali Wang, Peter E. Thornton, Wilfred M. Post all at Environmental Sciences Division, Oak Ridge National Laboratory (ORNL) and R. Quinn Thomas at Cornell University. It was then modified fairly extensively by Erik Kluzek at NCAR. We want to thank all of these individuals for this contribution to the CESM effort. We also want to thank the folks at University of Michigan Biological Stations (US-UMB) who allowed us to use their Fluxnet station data and import it into our inputdata repository, especially Gil Bohrer the PI on record for this site. .. _details-of-ptclm: -================== - Details of PTCLM -================== +======================= + Details of PTCLMmkdata +======================= -To get help on PTCLM1.110726 use the "--help" option as follows. +To get help on PTCLM2_180611 use the "--help" option as follows. :: - > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM - > ./PTCLM.py --help + > cd $CTSMROOT/tools/PTCLM + > ./PTCLMmkdata --help The output to the above command is as follows: :: @@ -106,36 +107,34 @@ The output to the above command is as follows: Main Script Version Id: $Id: PTCLM.py 47576 2013-05-29 19:11:16Z erik $ Scripts URL: $HeadURL: https://svn-ccsm-models.cgd.ucar.edu/PTCLM/trunk_tags/PTCLM1_130529/PTCLM.py $: -Here we give a simple example of using PTCLM1 for a straightforward case of running at the US-UMB Fluxnet site on cheyenne where we already have the meteorology data on the machine. -Note, see `the Section called Converting AmeriFlux Data for use by PTCLM `_ for permission information to use this data. +Here we give a simple example of using PTCLMmkdata for a straightforward case of running at the US-UMB Fluxnet site on cheyenne where we already have the meteorology data on the machine. +Note, see `the Section called Converting AmeriFlux Data for use by PTCLMmkdata `_ for permission information to use this data. -Example 6-1. Example of running PTCLM1 for US-UMB on cheyenne +Example 6-1. Example of running PTCLMmkdata for US-UMB on cheyenne ---------------------------------------------------------------- :: > setenv CSMDATA $CESMDATAROOT/inputdata - > setenv MYCSMDATA $HOME/inputdata + > setenv MYDATAFILES `pwd`/mydatafiles > setenv SITE US-UMB - > setenv MYMACH cheyenne_intel > setenv MYCASE testPTCLM - # First link the standard input files to a location you have write access - > cd scripts - > ./link_dirtree $CSMDATA $MYCSMDATA # Next build all of the clm tools you will need - > cd ../$CTSMROOT/tools/|version|/mksurfdata_map - > gmake - > gmake clean - > cd ../../../../../../tools/mapping/gen_domain_files/src - > ../../../../scripts/ccsm_utils/Machines/configure -mach cheyenne -compiler intel - > gmake - > gmake clean + > cd $CTSMROOT/tools/PTCLM + > buildtools # next run PTCLM (NOTE -- MAKE SURE python IS IN YOUR PATH) - > cd ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM - > ./PTCLM.py -m $MYMACH --case=$MYCASE --site=$SITE --csmdata=$MYCSMDATA --aerdepgrid --ndepgrid - # NOTE: we use --aerdepgrid --ndepgrid so that you use the global - # aerosol and Nitrogen deposition files rather than site-specific ones. - > cd ../../../../../$MYCASE - # Finally setup, build, and run the case as normal + > cd $CTSMROOT/tools/PTCLM + # Here we run it using qcmd so that it will be run on a batch node + > qcmd -- ./PTCLMmkdata --site=$SITE --csmdata=$CSMDATA --mydatadir=$MYDATAFILES >& ptclmrun.log & + > cd $CIMEROOT/scripts + > ./create_newcase --user-mods-dir $MYDATAFILES/1x1pt_$SITE --case $MYCASE --res CLM_USRDAT --compset I1PtClm50SpGs + # Next setup, build and run as normal + > cd $MYCASE + > ./case.setup + +PTCLMmkdata includes a README file that gives some extra details and a simple example. + +.. include:: ../../clm5.0/tools/PTCLM/README + :literal: diff --git a/doc/source/users_guide/running-PTCLM/ptclm-examples.rst b/doc/source/users_guide/running-PTCLM/ptclm-examples.rst index d3d85da0b1..e36b1e686a 100644 --- a/doc/source/users_guide/running-PTCLM/ptclm-examples.rst +++ b/doc/source/users_guide/running-PTCLM/ptclm-examples.rst @@ -2,71 +2,32 @@ .. include:: ../substitutions.rst -========================= - Examples of using PTCLM -========================= +============================== + Examples of using PTCLMmkdata +============================== Now let's give a few more complex examples using some of the options we have discussed above. -In this first example, we'll demonstrate using a supported single point dataset, which then requires using the "nopointdata". We'll also demonstrate the compset option, "stdurbpt" and "caseidprefix" options. - -Example: Running PTCLM for the Mexicocity supported single point dataset ------------------------------------------------------------------------- -:: - - > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM - > ./PTCLM.py -m cheyenne_intel -s 1x1_mexicocityMEX -d $CSMDATA --nopointdata \ - --stdurbpt -c ICRUCLM45 --caseidprefix `pwd`/myPTCLMcases/site - > cd myPTCLMcases/site_1x1_mexicocityMEX_I - > ./cesm_setup - # Now build and run normally - > ./site_1x1_mexicocityMEX_I.build - # Here we show running interactively - > ./site_1x1_mexicocityMEX_I.run - Now, let's demonstrate using a different group list, doing a spinup, running with Qian global forcing data, but using tower years to set the years to run over. This uses the options: sitegroupname, useQIAN, and QIANtower_years. -Example: Running PTCLM for a spinup simulation with Qian data for tower years. ------------------------------------------------------------------------------- +Example: Running PTCLMmkdata without tower years +------------------------------------------------ :: - > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM - > ./PTCLM.py -m cheyenne_intel -s US-Ha1 -d $CSMDATA --sitegroupname AmeriFlux --useQIAN --QIAN_tower_yrs + > cd $CTSMROOT/tools/PTCLM + > ./PTCLMmkdata -s US-Ha1 -d $CSMDATA --sitegroupname AmeriFlux --donot_use_tower_yrs > cd ../../../../../US-Ha1_ICRUCLM45BGC_QIAN - > ./cesm_setup # Now build and run normally - > ./US-Ha1_ICRUCLM45BGC_QIAN.build - # Here we show running interactively - > ./US-Ha1_ICRUCLM45BGC_QIAN.run ``` Finally, let's demonstrate using a generic machine (which then requires the scratchroot option), using the global grid for PFT and soil types, and setting the run length to two months. -Example: Running PTCLM on a user-defined machine with global PFT and soil types dataset ---------------------------------------------------------------------------------------- +Example: Running PTCLMmkdata with global PFT and soil types dataset +------------------------------------------------------------------- :: - > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM - # Note, see the the Section called Converting AmeriFlux Data for use by PTCLM with permission information + > cd $CTSMROOT/tools/PTCLM + # Note, see the the Section called Converting AmeriFlux Data for use by PTCLMmkdata with permission information # to use the US-UMB data. - > ./PTCLM.py -m userdefined_intel -s US-UMB -d $CSMDATA --pftgrid --soilgrid \ - --scratchroot $HOME --run_n 2 --run_units nmonths + > ./PTCLMmkdata -s US-UMB -d $CSMDATA --pftgrid --soilgrid > cd ../../../../../US-UMB_ICRUCLM45BGC - # If userdefined is NOT set up for you Uncomment the following and set OS, NTASKS_PER_NODE, TMPDIR - # > ./xmlchange OS=$OS,MAX_TASKS_PER_NODE=$NTASKS_PER_NODE,MPILIB=mpi-serial - # > ./xmlchange RUNDIR=$TMPDIR/$USER/\$CASE/run,DIN_LOC_ROOT=$CSMDATA,COMPILER=intel - # > ./xmlchange EXEROOT=$TMPDIR/$USER/\$CASE - > ./cesm_setup - # Now build - > ./US-UMB_ICRUCLM45BGC.userdefined_intel.build - # To get the files from the svn server... - # First list the files from the streams text file - > ../ccsm_utils/Tools/listfilesin_streams \ - -t $HOME/US-UMB_ICRUCLM45BGC/run/clm1PT.1x1pt_US-UMB.stream.txt -l \ - > Buildconf/datm.input_data_list - # And now run the script to export data to your machine - > ../ccsm_utils/Tools/check_input_data -export - # Here we show running interactively - > ./US-UMB_ICRUCLM45BGC.userdefined_intel.run - -.. warning: Because of Bug 1364, when running this case as above we get a floating point error after reaching time-step 124 for the example exactly as above. Other machines or compilers probably won't have this problem. See the `$CTSMROOT/doc/KnownBugs `_ file for more information on this problem. diff --git a/doc/source/users_guide/running-PTCLM/using-ptclm.rst b/doc/source/users_guide/running-PTCLM/using-ptclm.rst index 2055cc81a1..e657608b67 100644 --- a/doc/source/users_guide/running-PTCLM/using-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/using-ptclm.rst @@ -3,144 +3,98 @@ .. include:: ../substitutions.rst ************************** -Using PTCLM +Using PTCLMmkdata ************************** -There are three types of options to PTCLM1: required, setup/run-time, and dataset generation options. -The three required options are the three settings that MUST be specified for PTCLM to work at all. The other settings have default values that will default to something useful. The setup/run-time options control how the simulation will be setup and run. The dataset generation options control the generation of datasets needed when PTCLM is run. Most options use a double dash "--" "longname" such as "--list", but the most common options also have a short-name with a single dash (such as -m instead of --machine). +There are two types of options to PTCLMmkdata: required and optional. +The three required options are the three settings that MUST be specified for PTCLMmkdata to work at all. The other settings have default values that will default to something useful. Most options use a double dash "--" "longname" such as "--list", but the most common options also have a short-name with a single dash. -The required options to PTCLM are: inputdata directory (-d), machine (-m) and site-name (-s). -Inputdata directory is the directory where you have the CESM inputdata files, you need to have write access to this directory, so if you are running on a machine that you do NOT have write access to the standard inputdata location (such as NCAR cheyenne or LBNL hopper) you need to link the standard files to a location you do have control over. We recommend using the ``scripts/link_dirtree`` tool to do that. "machine" is the scripts name for the machine/compiler you will be using for your case. And finally site-name is the name of the site that you want to run for. Site-name can either be a valid supported dataset name or a Fluxnet site name from the list of sites you are running on (see the --sitegroupname for more information about the site lists). +The required options to PTCLMmkdata are: inputdata directory (-d) and site-name (-s). +Inputdata directory is the directory where you have the CESM inputdata files. Finally site-name is the name of the site that you want to run for. Site-name is a Fluxnet site name from the list of sites you are running on (see the --sitegroupname for more information about the site lists). -After PTCLM is run a case directory where you can then setup, build and run your CESM case as normal. -It also creates a ``README.PTCLM`` in that directory that documents the commandline options to PTCLM that were used to create it. +After PTCLMmkdata is run you can run **create_newcase** to setup a case to use the datasets created. +It also creates a ``README.PTCLM`` in that directory that documents the commandline options to PTCLMmkdata that were used to create it. -After "help" the "list" option is one of the most useful options for getting help on using PTCLM. -This option gives you information about some of the other options to PTCLM. To get a list of the machine, sites, and compsets that can be used for PTCLM use the "--list" option as follows. +After "help" the "list" option is one of the most useful options for getting help on using PTCLMmkdata. +This option gives you information about some of the other options to PTCLMmkdata. To get a list of the sites that can be used for PTCLMmkdata use the "--list" option as follows. :: - > cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM - > ./PTCLM.py --list + > cd $CTSMROOT/tools/PTCLM + > ./PTCLMmkdata --list The output to the above command is as follows: :: - /bin/sh: line 1: PTCLM.py: command not found + /bin/sh: line 1: PTCLMmkdata: command not found -Steps in running PTCLM -========================= - -1. Setup Inputdata directory with write access (use link_dirtree script) - - You need to setup an inputdata directory where you have write access to it. - Normally, for NCAR machines the data is on an inputdata where the user does NOT have write access to it. - A way that you can get around this is to use the **link_dirtree** script to create softlinks from the normal location to a location you have write access to. - So for example on cheyenne: - :: +Steps in running PTCLMmkdata +============================ - > setenv CSMDATA $CESMDATAROOT/inputdata - > setenv MYCSMDATA $HOME/inputdata - > mkdir $MYCSMDATA - > cd scripts - > ./link_dirtree $CSMDATA $MYCSMDATA - - See `the Section called Managing Your Own Data-files in Chapter 3 `_ for more information on this. - -2. Build the CLM tools +1. Build the CLM tools Next you need to make sure all the CLM FORTRAN tools are built. :: - > cd $CTSMROOT/tools/|version|/mksurfdata_map - > gmake - > gmake clean - > cd ../../../../../../tools/mapping/gen_domain_files/src - > ../../../../scripts/ccsm_utils/Machines/configure -mach cheyenne -compiler intel - > gmake + > cd $CTSMROOT/tools/PTCLM + > ./buildtools > gmake clean -3. Run PTCLM - Next you actually run PTCLM1 which does the different things listed below: +2. Run PTCLMmkdata + Next you actually run PTCLMmkdata which does the different things listed below: - a. PTCLM names your case based on your input + a. PTCLMmkdata names your output file directory based on your input :: - [Prefix_]SiteCode_Compset[_QIAN] + [Prefix_]SiteCode Where: ``Prefix`` is from the caseidprefix option (or blank if not used). ``SiteCode`` is the site name you entered with the -s option. - ``Compset`` is the compset name you entered with the -c option. - - ``_QIAN`` is part of the name only if the useQIAN is used. - For example, the casename for the following will be: :: > cd scripts - > ./PTCLM.py -m cheyenne_intel -s US-UMB -d $MYCSMDATA -c ICRUCLM45BGC --use QIAN "US-UMB_I_2000_CN_QIAN" + > ./PTCLMmkdata -s US-UMB -d $MYCSMDATA - b. PTCLM creates datasets for you + b. PTCLMmkdata creates datasets for you It will populate $MYCSMDATA with new datasets it creates using the CLM tools. - c. If a transient compset and PTCLM1 finds a _dynpftdata.txt file - If you are running a transient compset (such as the "I_1850-2000_CN" compset) AND you there is a file in the PTCLM_sitedata directory under the PTCLM directory called $SITE_dynpftdata.txt it will use this file for the land-use changes. + c. If a transient compset and PTCLMmkdata finds a _dynpftdata.txt file + If you are running a transient compset (such as the "I_1850-2000_CN" compset) AND you there is a file in the PTCLM_sitedata directory under the PTCLMmkdata directory called $SITE_dynpftdata.txt it will use this file for the land-use changes. Otherwise it will leave land-use constant, unless you use the pftgrid option so it uses the global dataset for landuse changes. - See the Section called Dynamic Land-Use Change Files for use by PTCLM for more information on this. + See the Section called Dynamic Land-Use Change Files for use by PTCLMmkdata for more information on this. There is a sample transient dataset called US-Ha1_dynpftdata.txt. Transient compsets, are compsets that create transient land-use change and forcing conditions such as: 'I_1850-2000', 'I_1850-2000_CN', 'I_RCP8.5_CN', 'I_RCP6.0_CN', 'I_RCP4.5_CN', or 'I_RCP2.6_CN'. - d. PTCLM creates a pft-physiology for you - PTCLM1 will create a local copy of the pft-physiology specific for your site that you could then customize with changes specific for that site. + d. PTCLMmkdata creates a pft-physiology for you + PTCLMmkdata will create a local copy of the pft-physiology specific for your site that you could then customize with changes specific for that site. + + e. PTCLMmkdata creates a README.PTCLM for you + PTCLMmkdata will create a simple text file with the command line for it in a file called README.PTCLM in the case directory it creates for you. - e. PTCLM creates a README.PTCLM for you - PTCLM1 will create a simple text file with the command line for it in a file called README.PTCLM in the case directory it creates for you. +3. Run create_newcase pointing to the directory created 4. Customize, setup, build and run case as normal You then customize your case as you would normally. See the Chapter 1 chapter for more information on doing this. -PTCLM options +PTCLMmkdata options ========================= Next we discuss the setup and run-time options, dividing them up into setup, initial condition (IC), and run-time options. Configure options include: -- --compset=MYCOMPSET -- --caseidprefix=MYCASEID - --cesm_root=BASE_CESM -- --namelist=NAMELIST -- --rmold -- --scratchroot=SCRATCHROOT - --sitegroupname=SITEGROUP -- --QIAN_tower_yrs -- --useQIAN - -``--compset`` - The "-c" option is the most commonly used option after the required options, as it specifies the CESM scripts component set to use with PTCLM1. - The default compset is the "ICN" compset with CN on for present day conditions. - -``--caseidprefix`` - This option gives a prefix to include in the casename when the case is created, in case you want to customize your casenames a bit. - By default, casenames are figured out based on the other options. The argument to this option can either be a name to prefix casenames with and/or a pathname to include. - Hence, if you want cases to appear in a specific directory you can give the pathname to that directory with this option. +- --donot_use_tower_yrs ``--cesm_root`` - This option is for running PTCLM1 with a different root directory to CESM than the version PTCLM exists in. Normally you do NOT need to use this option. - -``--namelist`` - This option adds any items given into the CLM user_nl_clm namelist. This allows you to add customizations to the namelist before the clm.buildnml.csh file is created for the case. - -``--rmold`` - This option will remove an old case directory of the same name if one exists. Otherwise, if an old case directory already exists and you try to run PTCLM it will return with an error. - -``--scratchroot`` - This option is ONLY valid when using one of the generic machines (the -m option). This passed onto **create_newcase** and gives the location where cases will be built and run. + This option is for running PTCLMmkdata with a different root directory to CESM than the version PTCLMmkdata exists in. Normally you do NOT need to use this option. ``--sitegroupname`` - In the PTCLM directory there is a subdirectory "PTCLM_sitedata" that contains files with the site, PFT and soil data information for groups of sites. - These site groups are all separate ASCII files with the same prefix followed by a "_*data.txt" name. See `the Section called PTCLM Group Site Lists `_ for more information on these files. By default we have provided three different valid group names: + In the PTCLMmkdata directory there is a subdirectory "PTCLM_sitedata" that contains files with the site, PFT and soil data information for groups of sites. + These site groups are all separate ASCII files with the same prefix followed by a "_*data.txt" name. See `the Section called PTCLMmkdata Group Site Lists `_ for more information on these files. By default we have provided three different valid group names: EXAMPLE ------- @@ -152,52 +106,21 @@ The EXAMPLE is the group used by default and ONLY includes the US-UMB site as th The other two site groups include the site information for all of both the AmeriFlux and Fluxnet-Canada sites. You can use the "sitegroupname" option to use one of the other lists, or you can create your own lists using the EXAMPLE file as an example. Your list of sites could be real world locations or could be theoretical "virtual" sites given to exercise CLM on differing biomes for example. -Note, see `the Section called Converting AmeriFlux Data for use by PTCLM `_ with permission information to use the US-UMB data. +Note, see `the Section called Converting AmeriFlux Data for use by PTCLMmkdata `_ with permission information to use the US-UMB data. -``--useQIAN`` - This option says to use the standard CLM global Qian T62 atmospheric forcing rather than any tower site forcing data available. Otherwise, PTCLM will try to find tower forcing data for the specific site entered. - -``--QIAN_tower_yrs`` +``--donot_use_tower_yrs`` This option is used with the "useQIAN" option to set the years to cycle over for the Qian data. In this case Qian atmospheric forcing will be used, but the simulation will run over the same years that tower site is available for this site. -**IC options include:** - -- --coldstart -- --finidat=FINIDAT - -The coldstart option says to startup with OUT an initial condition file, while the finidat option explicitly gives the initial condition file to use. Obviously, the coldstart and finidat options can NOT be used together. - -``--coldstart`` - This option ensures that a cold-start will be done with arbitrary initial conditions. - -``--finidat`` - This option sets the initial condition file to startup the simulation from. - **Run-time options include:** -- --debug -- --run_n=MYRUN_N -- --run_units=MYRUN_UNITS -- --stdurbpt - --debug -This option tells PTCLM to echo what it would do if it were run, but NOT actually run anything. So it will show you the dataset creation commands it would use. It does however, run **create_newcase**, but then it only displays the **xmlchange** commands and changes that it would do. Also note that if you give the "--rmold" option it won't delete the case directory beforehand. Primarily this is intended for debugging the operation of PTCLM. - -``--run_n`` - This option along with run_units is used to set the length for the simulation. "run_n" is the number of units to use. The default run length depends on the site, compset, and configuration. - -``--run_units`` - This option is the units of time to use for the length of the simulation. It is used along with "run_n" to set the length of the simulation. The default run length depends on the site, compset, and configuration. - -``--stdurbpt`` - This option turns on the "stdurbpt_pd" use-case for CLM_NML_USE_CASE. This option can NOT be used for compsets that set the use-case to something besides present-day. +This option tells PTCLMmkdata to echo what it would do if it were run, but NOT actually run anything. So it will show you the dataset creation commands it would use. It does however, run **create_newcase**, but then it only displays the **xmlchange** commands and changes that it would do. Also note that if you give the "--rmold" option it won't delete the case directory beforehand. Primarily this is intended for debugging the operation of PTCLMmkdata. **The dataset generation options are:** - --pftgrid - --soilgrid -- --nopointdata -- --owritesrfaer The options that with a "grid" suffix all mean to create datasets using the global gridded information rather than using the site specific point data. By default the site specific point data is used. The "nopointdata" and "owritesrfaer" options have to do with file creation. @@ -211,14 +134,3 @@ Because supported single-point datasets already have the data created for them, This option says to use the soil values provided on the global dataset rather than using the specific site based values from the PTCLM_sitedata/\*_soildata.txt file when creating the surface dataset. This option must NOT be used when you you are using a site that is a supported single point dataset. -``--nopointdata`` - This option says to NOT create any input datasets -- assume this step has already been done. - If datasets weren't already created, your case will fail when you try to run it. - In general the first time you run PTCLM for a new site you want it to generate new datasets, but the next time and future times you want to use this option so that it doesn't waste a lot of time rebuilding datasets over again. - - .. note:: This option is required when you you are using a site that is a supported single point dataset. - -``--owritesrfaer`` - This option says to overwrite any surface and/or aerosol deposition datasets that were already created. - Otherwise, the creation of these files will be skipped if a file is already found (but it WILL create files if they don't exist). - This option must NOT be used when you you are using a site that is a supported single point dataset. From e2bb9b23d2128b80a753dd7849d88aba9e5ad37e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 28 Jun 2018 14:30:30 -0600 Subject: [PATCH 0202/1973] Update build --- doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst index 50476e0261..1eaf471739 100644 --- a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst @@ -111,8 +111,7 @@ Here we give a simple example of using PTCLMmkdata for a straightforward case of Note, see `the Section called Converting AmeriFlux Data for use by PTCLMmkdata `_ for permission information to use this data. Example 6-1. Example of running PTCLMmkdata for US-UMB on cheyenne ----------------------------------------------------------------- - +------------------------------------------------------------------ :: > setenv CSMDATA $CESMDATAROOT/inputdata From 29943cc54e605d4a22e5a5330f18d2c95b1ff8fc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 Jun 2018 14:58:25 -0600 Subject: [PATCH 0203/1973] Work on trouble-shooting and testing chapters --- doc/source/users_guide/testing/testing.rst | 57 ++-- .../trouble-shooting/trouble-shooting.rst | 313 +----------------- 2 files changed, 31 insertions(+), 339 deletions(-) diff --git a/doc/source/users_guide/testing/testing.rst b/doc/source/users_guide/testing/testing.rst index 0594bc9157..04f90fc3d3 100644 --- a/doc/source/users_guide/testing/testing.rst +++ b/doc/source/users_guide/testing/testing.rst @@ -21,44 +21,41 @@ CIME Testing scripts We first introduce the test scripts that work for all CESM components. The CIME script **create_test** runs a specific type of test, at a given resolution, for a given compset using a given machine. -There is a list of different tests, but the "ERI" tests do several things at once, running from startup, as well as doing exact branch and restart tests. -So to run "ERI" testing at 2-degree with the I1850CRUCLM45 compset on cheyenne_intel you do the following. -:: +See `CIME Chapter on Testing `_ for how to use it to run single +tests as well as lists of tests. The standard testname for CLM is "aux_clm" for cheyenne with intel and gnu compilers as +well as the CGD machine hobart for intel, nag, and pgi compilers. There's also a shorter test list called "clm_short". Also +see the `CTSM Wiki on Testing `_. - > cd scripts - > ./create_test -testname ERI.f19_g17_gl4.I1850CRUCLM45.cheyenne_intel - > cd ERI.f19_g17_gl4.I1850CRUCLM45.cheyenne_intel.$id - > ./ERI.f19_g17_gl4.I1850CRUCLM45.cheyenne_intel.$id.build - > ERI.f19_g17_gl4.I1850CRUCLM45.cheyenne_intel.$id.submit +CTSM Tools Testing +================== -When the test is done it will update the file TestStatus with either a PASS or FAIL message. +.. include:: ../../clm5.0/test/tools/README + :literal: -We already have a standard list of tests for clm (the "aux_clm" list of tests). To run the CLM cheyenne intel compiler test list, for the same machine and compiler you would do the following: -:: +CTSM Fortran Unit Tests +======================= - > cd scripts - > ./create_test -xml_mach cheyenne -xml_compiler intel -xml_category aux_clm -mach cheyenne -compiler intel - # Normally it will submit the jobs as they are ready, but if it's interrupted you - # may need to submit by hand as follows... - # Submit the suite of tests (note $id refers to the integer job number for this job) - > ./cs.submit.$id.cheyenne - # Later check the tests with... - > ./cs.status.$id - # The above will give a PASS or FAIL message for each test. +.. include:: ../../clm5.0/src/README.unit_testing + :literal: + +CTSM Build-namelist Tests +========================= + +Run the following perl tester that + +:: + > cd bld/unit_testers + > ./build-namelist_test.pl -For more information on doing testing with the CESM scripts see the `|cesmrelease| User's Guide `_ on testing. Testing PTCLM ============= -There is a simple test script for PTCLM called ``testcases.csh`` in the PTCLM directory (``scripts/ccsm_utils/Tools/lnd/clm/PTCLM``). -The test script is setup to run on the machines: cheyenne, frankfurt, yong, and titan. -You simply run the script interactively. -The script will write out the status of tests to a file called: ``tc.job#.status``. +.. include:: ../../clm5.0/tools/PTCLM/README + :literal: + +To run on cheyenne, you do the following: -There are a few environment variables that can be used with ``testcases.csh`` to change it's operation. -``CESM_ROOT``: To test with a separate root to CESM code set this env variable to the root directory to use. -``CLM_SOFF``: If set to ``TRUE`` - stop on first failed test rather than continuing to run. -``CLM_RETAIN_FILES``: If set to ``FALSE`` - cleanup tools build first. -``DEBUG``: If set to ``TRUE`` - setup cases, but do not build or run. +.. include:: ../../clm5.0/tools/PTCLM/test/README.run_cheyenne + :literal: diff --git a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst index c7e38cf645..9af807041f 100644 --- a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst +++ b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst @@ -10,318 +10,13 @@ In this chapter we give some guidance on what to do when you encounter some of t In general you will run into one of three type of problems: -1. *setup-time* +1. *case-creation* +#. *setup-time* #. *build-time* #. *run-time* +See the `CIME Trouble Shooting Guide `_ for some help on the first three. -Setup Problems -============== - -The first type of problem happens when you invoke the **case.setup** command. -This indicates there is something wrong with your input datasets, or the details of what you are trying to setup the model to do. -There's also a trouble-shooting chapter in the `|cesmrelease| Scripts User's Guide `_. -Many of the problems with configuration can be resolved with the guidelines given there. -Here we will restrict ourselves to problems from the input files. - -Example: Missing datasets ----------------------------------------------------------------- -:: - - > ./create_newcase -case ne60rcp6 -res ne60_g16 -compset IRCP60CN \ - -mach cheyenne_intel - > ./case.setup - -The following is what is displayed to the screen. -:: - - . - . - . - Running preview_namelist script - CLM configure done. - CLM adding use_case 1850-2100_rcp6_transient defaults for var clm_demand with val fpftdyn - CLM adding use_case 1850-2100_rcp6_transient defaults for var clm_start_type with val startup - CLM adding use_case 1850-2100_rcp6_transient defaults for var model_year_align_ndep with val 1850 - CLM adding use_case 1850-2100_rcp6_transient defaults for var rcp with val 6 - CLM adding use_case 1850-2100_rcp6_transient defaults for var sim_year with val 1850 - CLM adding use_case 1850-2100_rcp6_transient defaults for var sim_year_range with val 1850-2100 - CLM adding use_case 1850-2100_rcp6_transient defaults for var stream_year_first_ndep with val 1850 - CLM adding use_case 1850-2100_rcp6_transient defaults for var stream_year_last_ndep with val 2100 - CLM adding use_case 1850-2100_rcp6_transient defaults for var use_case_desc with val Simulate transient land-use, aerosol and Nitrogen deposition changes - with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM - - build-namelist - No default value found for fpftdyn. - Are defaults provided for this resolution and land mask? - ERROR: clm.buildnml.csh failed - ERROR: /Users/erik/clm_cesm1_1_1_rel/scripts/ne60rcp6/preview_namelists failed: 25344 - -The important thing to note here is the line: -:: - - ERROR: clm.buildnml.csh failed - -which tells us that the problem is in the land **clm.buildnml.csh**. It may also indicate problems in one of the other buildnml.csh files (atm, cesm, cpl, glc, ice, or ocn), in which case you should consult the appropriate model user's guide. - -In the example, the error is that the CLM XML database does NOT have a ``finidat`` for the given resolution, rcp scenario and ocean mask. That means you will need to create the file and then supply the file into your case. See `Chapter 2 `_ for more information on creating files, and see `Chapter 3 `_ for more information on adding files to the XML database. Alternatively, you can provide the file to your case by creating a user namelist as shown in `the Section called User Namelist in Chapter 1 `_. - -.. note:: The two most common problems from your **clm.buildnml.csh** will be errors from the CLM **configure** or **build-namelist**. For more information on these scripts see: `the Section called More information on the CLM configure script in Chapter 1 `_ and `the section on CLM_BLDNML_OPTS `_. - - -Build problems -================ - -The following is an example of running the build for a case and having it fail in the land model build. -As you can see it lists which model component is being built and the build log for that component. -:: - - CCSM BUILDEXE SCRIPT STARTING - - Build Libraries: mct pio csm_share - Sat Jun 19 21:21:19 MDT 2010 /ptmp/erik/test_build/mct/mct.bldlog.100619-212107 - Sat Jun 19 21:22:18 MDT 2010 /ptmp/erik/test_build/pio/pio.bldlog.100619-212107 - Sat Jun 19 21:23:18 MDT 2010 - /ptmp/erik/test_build/csm_share/csm_share.bldlog.100619-212107 - Sat Jun 19 21:24:00 MDT 2010 /ptmp/erik/test_build/run/cpl.bldlog.100619-212107 - Sat Jun 19 21:24:00 MDT 2010 /ptmp/erik/test_build/run/atm.bldlog.100619-212107 - Sat Jun 19 21:24:06 MDT 2010 /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 - ERROR: clm.buildexe.csh failed, see /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 - ERROR: cat /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 - -You can then examine the build log that failed and see what went wrong. Most compilers will give the full filepath and line number for the file that filed to compile. - -Run Time Problems -================= - -Tracking down problems while the model is running is much more difficult to do than setup or build problems. -In this section we will give some suggestions on how to find run time problems. -Below we show the log file results of a job that aborted while running. -:: - - CCSM PRESTAGE SCRIPT HAS FINISHED SUCCESSFULLY - Sun Jun 20 18:24:06 MDT 2010 -- CSM EXECUTION BEGINS HERE - Sun Jun 20 18:24:35 MDT 2010 -- CSM EXECUTION HAS FINISHED - Model did not complete - see /ptmp/erik/test_run/run/cpl.log.100620-182358 - -In the next section we will talk about using the different log files to track down problems, and find out where the problem is coming from. In the section after that we give some general advice on debugging problems and some suggestions on ideas that may be helpful to track the problem down. Some of the examples below are from the `$CTSMROOT/doc/KnownBugs `_ file. - -Tracking Problems by Querying Log Files ---------------------------------------- - -The first thing to do when tracking down problems is to query the different log files to see if you can discover where the problem occurs, and any error messages about it. -It's important to figure out if the problem comes in at initialization or in the run phase of the model, and in which model component the problem happens. -There are different log files for the different major components, and they all end with the date and time in YYMMDD-HHMMSS format (2-digit: year, month, day, hour minute and second). -When the model runs to completion the log files will be copied to the logs directory in the script directory, but when the model fails they will remain in the run directory. -Here's an example list of log files from an "I" case where the model dies in the land model initialization. -For "I" cases the sea-ice and ocean components are just stubs and don't create log files (and unless running with the active land-ice model "glc" log files won't be created either). -:: - - atm.log.100620-182358 - cesm.log.100620-182358 - cpl.log.100620-182358 - lnd.log.100620-182358 - -The coupler log file --------------------- - -The first log file to check is the coupler log file so that you can see where the model dies and which model component it fails in. When the model dies at initialization the last model component listed is the component that failed. - -Example of a case that fails in the CLM land model initialization. -:: - - (seq_timemgr_clockPrint) Prev Time = 00001201 00000 - (seq_timemgr_clockPrint) Next Time = 99991201 00000 - (seq_timemgr_clockPrint) Intervl yms = 9999 0 0 - - (seq_mct_drv) : Initialize each component: atm, lnd, ocn, and ice - (seq_mct_drv) : Initialize atm component - (seq_mct_drv) : Initialize lnd component - -The cesm log file ------------------ - -The cesm log files are to some extent the "garbage collection" of log output. -The CLM sends it's output from it's master processor, but sends other output and possibly errors to the cesm log file. -Because, of this, often error messages are somewhere in the cesm log file. -However, since there is so much other output it may be difficult to find. -For example, here is some output from an older version of CESM (CESM1.0.2) where the RTM river routing file (before it was converted to NetCDF) was not provided and the error on the open statement for the file was embedded near the end of the cesm log file. -:: - - NODE# NAME - ( 0) be1105en.ucar.edu - "/gpfs/proj2/fis/cgd/home/erik/clm_trunk/$CTSMROOT/src/riverroute/RtmMod.F90", line - 239: 1525-155 The file name provided in the OPEN statement for unit 1 has zero length or - contains all blanks. The program will recover by ignoring the OPEN statement. - "/gpfs/proj2/fis/cgd/home/erik/clm_trunk/$CTSMROOT/src/riverroute/RtmMod.F90", line - 241: 1525-001 The READ statement on the file fort.1 cannot be completed because the end - of the file was reached. The program will stop. - - Running: ./cesm.exe - Please wait... - - Memory usage for ./cesm.exe (task # 0) is: 51696 KB. Exit status: 1. Signal: 0 - -Although the example is from an earlier version of the model it still serves to illustrate finding problems from the cesm log file. - -When working with the cesm log file, for a run-time problem, you will need to be able to separate it's output into three categories: pre-crash, crash, and post-crash. -The pre-crash section is everything that is normal output for good operation of the model. -The crash section is the section where the model dies and reports on the actual problem. -the post-crash section is the cleanup and finalization after the model dies. -The most important part of this of course is the crash section. -The tricky part is distinguishing it from the other sections. -Also because the cesm log file most likely has duplicated output from multiple processors it is even more difficult to distinguish the different sections and to some extent the sections may be intertwined, as different processors reach the different sections at different times. -Because, of this reducing the number of processors for your simulation may help you sort out the output in the file (see `the Section called Run with a smaller set of processors `_). -Also much of the output from the cesm log file are system level information having to do with MPI multiprocessing. -Usually you can ignore this information, but it makes it more difficult to trudge through. - - -Sometimes the cesm log file is the ONLY file available, because the model terminates early in initialization. -In this case understanding the output in the cesm log file becomes even more important. -This also indicates the model did NOT advance far enough to reach the initialization of the individual model components. -This may mean that the initialization of the multiprocessing for MPI and/or OpenMP failed, or that the reading of the driver namelist file "drv_in" failed. - - -Here we show those three sections for a cesm log file where a two task job failed on reading the namelist file. -For a typical job with many tasks similar sections of this will be repeated not just twice but for each task and hence make it harder to read. - - -*Pre-crash section of the cesm log file* -:: - - ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. - - ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. - ATTENTION: 0031-378 MP_EUIDEVICE setting ignored when LoadLeveler is not being used. - ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. - 0:INFO: 0031-724 Executing program: - 1:INFO: 0031-724 Executing program: - 0:/contrib/bin/cesm_launch: process 401894 bound to logical CPU 0 on host be0310en.ucar.edu ... - 1:/contrib/bin/cesm_launch: process 439264 bound to logical CPU 1 on host be0310en.ucar.edu ... - 0:INFO: 0031-619 64bit(us, Packet striping on) ppe_rmas MPCI_MSG: MPI/MPCI library was compiled on Wed Aug 5 13:36:06 2009 - 0: - 1:LAPI version #14.26 2008/11/23 11:02:30 1.296 src/rsct/lapi/lapi.c, lapi, rsct_rpt53, rpt53s004a 09/04/29 64bit(us) library compiled on Wed Apr 29 15:30:42 2009 - 1:. - 1:LAPI is using lightweight lock. - 0:LAPI version #14.26 2008/11/23 11:02:30 1.296 src/rsct/lapi/lapi.c, lapi, rsct_rpt53, rpt53s004a 09/04/29 64bit(us) library compiled on Wed Apr 29 15:30:42 2009 - 0:. - 0:LAPI is using lightweight lock. - 0:Use health ping for failover/recovery - 1:Use health ping for failover/recovery - 0:Initial communication over instance 2. - 1:Initial communication over instance 0. - 1:IB RDMA initialization completed successfully - 1:The MPI shared memory protocol is used for the job - 0:IB RDMA initialization completed successfully - 0:LAPI job ID for this job is: 1684890719 - 0:The MPI shared memory protocol is used for the job - 0:(seq_comm_setcomm) initialize ID ( 7 GLOBAL ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 2 ATM ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 1 LND ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 4 ICE ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 5 GLC ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 3 OCN ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 6 CPL ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 8 CPLATM ) join IDs = 6 2 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 9 CPLLND ) join IDs = 6 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 10 CPLICE ) join IDs = 6 4 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 11 CPLOCN ) join IDs = 6 3 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 12 CPLGLC ) join IDs = 6 5 ( npes = 2) ( nthreads = 1) - 0: - 0: (seq_comm_printcomms) ID layout : global pes vs local pe for each ID - 0: gpe LND ATM OCN ICE GLC CPL GLOBAL CPLATM CPLLND CPLICE CPLOCN CPLGLC nthrds - 0: --- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ - 0: 0 : 0 0 0 0 0 0 0 0 0 0 0 0 1 - 1: 1 : 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1: - 0: (t_initf) Read in prof_inparm namelist from: drv_in - 1: (seq_io_init) cpl_io_stride, iotasks or root out of bounds - resetting to defaults 4 0 1 - 0: piolib_mod.f90 1353 1 2 1 2 - 1: piolib_mod.f90 1353 1 2 1 2 - 0: pio_support::pio_die:: myrank= 0 : ERROR: piolib_mod.f90: 1354 : not enough procs for the stride - 1: pio_support::pio_die:: myrank= 1 : ERROR: piolib_mod.f90: 1354 : not enough procs for the stride - -*Crash section of the cesm log file* -:: - - 0: - 0: Traceback: - 1: - 1: Traceback: - 0: Offset 0x00000c4c in procedure __pio_support_NMOD_piodie, near line 88 in file pio_support.F90.in - 1: Offset 0x00000c4c in procedure __pio_support_NMOD_piodie, near line 88 in file pio_support.F90.in - 0: Offset 0x00000fd0 in procedure __piolib_mod_NMOD_init, near line 1354 in file piolib_mod.F90 - 1: Offset 0x00000fd0 in procedure __piolib_mod_NMOD_init, near line 1354 in file piolib_mod.F90 - 1: Offset 0x00000398 in procedure __seq_io_mod_NMOD_seq_io_init, near line 247 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/shr/seq_io_mod.F90 - 0: Offset 0x00000398 in procedure __seq_io_mod_NMOD_seq_io_init, near line 247 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/shr/seq_io_mod.F90 - 0: Offset 0x0001aa88 in procedure ccsm_driver, near line 465 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/driver/ccsm_driver.F90 - 0: --- End of call chain --- - 1: Offset 0x0001aa88 in procedure ccsm_driver, near line 465 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/driver/ccsm_driver.F90 - 1: --- End of call chain --- - -*Post-crash section of the cesm log file* -:: - - 1:Communication statistics of task 1 is associated with task key: 1684890719_1 - 0:Communication statistics of task 0 is associated with task key: 1684890719_0 - 0: - 0:Running: ./cesm.exe - 0:Please wait... - 0: - 0:Memory usage for ./cesm.exe (task # 0) is: 198892 KB. Exit status: 134. Signal: 0 - 1: - 1:Running: ./cesm.exe - 1:Please wait... - 1: - 1:Memory usage for ./cesm.exe (task # 0) is: 198572 KB. Exit status: 134. Signal: 0 - INFO: 0031-656 I/O file STDOUT closed by task 0 - INFO: 0031-656 I/O file STDERR closed by task 0 - ERROR: 0031-250 task 0: IOT/Abort trap - INFO: 0031-656 I/O file STDOUT closed by task 1 - INFO: 0031-656 I/O file STDERR closed by task 1 - ERROR: 0031-250 task 1: IOT/Abort trap - INFO: 0031-639 Exit status from pm_respond = 0 - ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. - Job /usr/local/lsf/7.0/aix5-64/bin/poejob /contrib/bin/ccsm_launch /contrib/bin/job_memusage.exe ./cesm.exe - - TID HOST_NAME COMMAND_LINE STATUS TERMINATION_TIME - ===== ========== ================ ======================= =================== - 00000 be0310en /contrib/bin/ccs Exit (134) 08/31/2010 12:32:57 - 00001 be0310en /contrib/bin/ccs Exit (134) 08/31/2010 12:32:57 - -The CLM log file ----------------- - -Of course when you are working with and making changes to CLM, most of your focus will be on the CLM log file and the errors it shows. -As already pointed out if you don't see errors in the ``lnd.log.*`` file you should look in the ``cesm.log.*`` to see if any errors showed up there. - -Here's an example of the ``lnd.log.*`` file when running ``PTS_MODE`` with initial conditions (this is bug 1025 in the `$CTSMROOT/doc/KnownLimitationss `_ file). -:: - - Successfully initialized variables for accumulation - - reading restart file I2000CN_f09_g17_gl4_c100503.clm2.r.0001-01-01-00000.nc - Reading restart dataset - ERROR - setlatlon.F:Cant get variable dim for lat or lsmlat - ENDRUN: called without a message string - -The DATM log file ------------------ - -When working with "I cases" the second most common problems after CLM problems are problems with the data atmosphere model. So examining the ``atm.log.*`` is important. - -Here's an example of a problem that occurs when the wrong prescribed aerosol file is given to a ``pt1_pt1`` simulation. -:: - - (datm_comp_init) atm mode = CLMNCEP - (shr_strdata_init) calling shr_dmodel_mapSet for fill - (shr_strdata_init) calling shr_dmodel_mapSet for remap - ('shr_map_getWts') ERROR: yd outside bounds 19.5000000000000000 - (shr_sys_abort) ERROR: ('shr_map_getWts') ERROR yd outside 90 degree bounds - (shr_sys_abort) WARNING: calling shr_mpi_abort() and stopping - -The batch log files -------------------- - -The names of the batch log files will depend on the batch system of the machine that is being used. They will normally be in the script directory. Usually, they don't contain important information, but they are a last resort place to look for error messages. On the NCAR system "cheyenne" the batch files are called with names that start with the batch submission script and then either "stderr.o" or "stdout.o", with the job number at the end. General Advice on Debugging Run time Problems ============================================= @@ -389,7 +84,7 @@ Along the same lines, you might try running a simpler case, trying another comps Run with a debugger ------------------- -Another suggestion is to run the model with a debugger such as: **dbx**, **gdb**, or **totalview**. +Another suggestion is to run the model with a debugger such as: **ddt**, **dbx**, **gdb**, or **totalview**. Often to run with a debugger you will need to reduce the number of processors as outlined above. Some debuggers such as **dbx** will only work with one processor, while more advanced debuggers such as **totalview** can work with both MPI tasks and OMP threads. Even simple debuggers though can be used to query core files, to see where the code was at when it died (for example using the **where** in **dbx** for a core file can be very helpful. From 910793f522db57edb85fd3fa5866ed2d17c694e5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 30 Jun 2018 14:28:51 -0600 Subject: [PATCH 0204/1973] Do a fresh new build of everything --- doc/Makefile | 2 +- doc/Makefile.tech_note | 2 +- doc/Makefile.users_guide | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 6d3ce5f50d..6e8d96d485 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -17,4 +17,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/Makefile.tech_note b/doc/Makefile.tech_note index 07ebab36e6..3ba843c70e 100644 --- a/doc/Makefile.tech_note +++ b/doc/Makefile.tech_note @@ -17,4 +17,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile.tech_note - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/Makefile.users_guide b/doc/Makefile.users_guide index 08562d18ca..babfffa52c 100644 --- a/doc/Makefile.users_guide +++ b/doc/Makefile.users_guide @@ -17,4 +17,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile.users_guide - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) From 2aabc98bef5307b599c84242ff2ad60c0ba0d0b7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 30 Jun 2018 15:42:12 -0600 Subject: [PATCH 0205/1973] Renames to get rid of hardwired chapter names and rebuild --- ...ns-or-New-Files-to-the-build-namelist-Database.rst} | 0 ...esolution-Names.rst => Adding-Resolution-Names.rst} | 0 ...es.rst => Adding-or-Changing-Default-Filenames.rst} | 0 .../users_guide/adding-new-resolutions/index.rst | 6 +++--- ...LM-with-transient-historical-CO2-concentration.rst} | 0 ...ata-as-atmospheric-forcing-to-spinup-the-model.rst} | 0 ...ion-as-atmospheric-forcing-to-spinup-the-model.rst} | 0 ...-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst} | 0 ... => Spinning-up-the-biogeochemistry-BGC-spinup.rst} | 0 doc/source/users_guide/running-special-cases/index.rst | 10 +++++----- 10 files changed, 8 insertions(+), 8 deletions(-) rename doc/source/users_guide/adding-new-resolutions/{CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst => Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst} (100%) rename doc/source/users_guide/adding-new-resolutions/{CLM-3.2-Adding-Resolution-Names.rst => Adding-Resolution-Names.rst} (100%) rename doc/source/users_guide/adding-new-resolutions/{CLM-3.3-Adding-or-Changing-Default-Filenames.rst => Adding-or-Changing-Default-Filenames.rst} (100%) rename doc/source/users_guide/running-special-cases/{CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst => Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst} (100%) rename doc/source/users_guide/running-special-cases/{CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst => Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst} (100%) rename doc/source/users_guide/running-special-cases/{CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst => Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst} (100%) rename doc/source/users_guide/running-special-cases/{CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst => Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst} (100%) rename doc/source/users_guide/running-special-cases/{CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst => Spinning-up-the-biogeochemistry-BGC-spinup.rst} (100%) diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst b/doc/source/users_guide/adding-new-resolutions/Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst similarity index 100% rename from doc/source/users_guide/adding-new-resolutions/CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst rename to doc/source/users_guide/adding-new-resolutions/Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst b/doc/source/users_guide/adding-new-resolutions/Adding-Resolution-Names.rst similarity index 100% rename from doc/source/users_guide/adding-new-resolutions/CLM-3.2-Adding-Resolution-Names.rst rename to doc/source/users_guide/adding-new-resolutions/Adding-Resolution-Names.rst diff --git a/doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst b/doc/source/users_guide/adding-new-resolutions/Adding-or-Changing-Default-Filenames.rst similarity index 100% rename from doc/source/users_guide/adding-new-resolutions/CLM-3.3-Adding-or-Changing-Default-Filenames.rst rename to doc/source/users_guide/adding-new-resolutions/Adding-or-Changing-Default-Filenames.rst diff --git a/doc/source/users_guide/adding-new-resolutions/index.rst b/doc/source/users_guide/adding-new-resolutions/index.rst index 97d97b0cc0..88bbda3f5b 100644 --- a/doc/source/users_guide/adding-new-resolutions/index.rst +++ b/doc/source/users_guide/adding-new-resolutions/index.rst @@ -14,6 +14,6 @@ Adding New Resolutions .. toctree:: :maxdepth: 2 - CLM-3.0-Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst - CLM-3.2-Adding-Resolution-Names.rst - CLM-3.3-Adding-or-Changing-Default-Filenames.rst + Adding-New-Resolutions-or-New-Files-to-the-build-namelist-Database.rst + Adding-Resolution-Names.rst + Adding-or-Changing-Default-Filenames.rst diff --git a/doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst b/doc/source/users_guide/running-special-cases/Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst similarity index 100% rename from doc/source/users_guide/running-special-cases/CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst rename to doc/source/users_guide/running-special-cases/Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst diff --git a/doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst similarity index 100% rename from doc/source/users_guide/running-special-cases/CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst rename to doc/source/users_guide/running-special-cases/Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst diff --git a/doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst b/doc/source/users_guide/running-special-cases/Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst similarity index 100% rename from doc/source/users_guide/running-special-cases/CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst rename to doc/source/users_guide/running-special-cases/Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst diff --git a/doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst b/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst similarity index 100% rename from doc/source/users_guide/running-special-cases/CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst rename to doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst diff --git a/doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst b/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst similarity index 100% rename from doc/source/users_guide/running-special-cases/CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst rename to doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst diff --git a/doc/source/users_guide/running-special-cases/index.rst b/doc/source/users_guide/running-special-cases/index.rst index 18ef7a96b0..f063992c67 100644 --- a/doc/source/users_guide/running-special-cases/index.rst +++ b/doc/source/users_guide/running-special-cases/index.rst @@ -17,8 +17,8 @@ Running Special Cases what-is-a-special-case.rst running-the-prognostic-crop-model.rst running-with-irrigation.rst - CLM-4.3-Spinning-up-the-Satellite-Phenology-Model-(CLMSP-spinup).rst - CLM-4.4-Spinning-up-the-CLM5.0-biogeochemistry-(CLMBGC-spinup).rst - CLM-4.7-Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst - CLM-4.8-Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst - CLM-4.9-Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst + Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst + Spinning-up-the-biogeochemistry-BGC-spinup.rst + Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst + Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst + Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst From f9304f5030a3deccaeb602eb47d3a41a8d14ebf8 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 11 Jul 2018 13:55:42 -0600 Subject: [PATCH 0206/1973] remove sai from potential evaporation calculation --- src/biogeophys/CanopyFluxesMod.F90 | 14 +++++++++----- src/biogeophys/PhotosynthesisMod.F90 | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 293f75e742..200ead5653 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1128,7 +1128,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, end if ! should be the same expression used in Photosynthesis/getqflx - efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p)*(qsatl(p)-qaf(p)) + efpot = forc_rho(c)*elai(p)/rb(p)*(qsatl(p)-qaf(p)) ! When the hydraulic stress parameterization is active calculate rpp ! but not transpiration @@ -1169,7 +1169,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Moved the original subroutine in-line... wtaq = frac_veg_nosno(p)/raw(p,1) ! air - wtlq = frac_veg_nosno(p)*(elai(p)+esai(p))/rb(p) * rpp ! leaf + wtlq = frac_veg_nosno(p)*elai(p)/rb(p) * rpp ! leaf !Litter layer resistance. Added by K.Sakaguchi snow_depth_c = z_dl ! critical depth for 100% litter burial by snow (=litter thickness) @@ -1248,7 +1248,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! result in an imbalance in "hvap*qflx_evap_veg" and ! "efe + dc2*wtgaq*qsatdt_veg" - efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p) & + efpot = forc_rho(c)*elai(p)/rb(p) & *(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) qflx_evap_veg(p) = rpp*efpot @@ -1314,8 +1314,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, zeta(p) = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) if (zeta(p) >= 0._r8) then !stable -!remove cap zeta(p) = min(zetamax,max(zeta(p),0.01_r8)) - zeta(p) = min(100._r8,max(zeta(p),0.01_r8)) + ! remove stability cap when biomass heat storage is active + if(use_biomass_heat_storage) then + zeta(p) = min(100._r8,max(zeta(p),0.01_r8)) + else + zeta(p) = min(zetamax,max(zeta(p),0.01_r8)) + endif um(p) = max(ur(p),0.1_r8) else !unstable zeta(p) = max(-100._r8,min(zeta(p),-0.01_r8)) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 99920f4cca..4237cddd57 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -4879,7 +4879,7 @@ subroutine getqflx(p,c,gb_mol,gs_mol_sun,gs_mol_sha,qflx_sun,qflx_sha,qsatl,qaf, cf = forc_pbot(c)/(rgas*1.e-3_r8*tgcm(p))*1.e6_r8 ! gb->gbmol conversion factor - wtl = (elai(p)+esai(p))*gb_mol + wtl = elai(p)*gb_mol efpot = forc_rho(c)*wtl*(qsatl-qaf) if (havegs) then From 9558e7844814d10335ab13c4d4920876d60aae41 Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Thu, 12 Jul 2018 15:29:26 -0600 Subject: [PATCH 0207/1973] Added a reference for g1 values and two tables, one with target leaf CN, another with SLAtop and flnr --- .../CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 56 ++++++++++++++++- .../CLM50_Tech_Note_Crop_Irrigation.rst | 2 +- .../CLM50_Tech_Note_Photosynthesis.rst | 3 +- ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 61 ++++++++++++++++++- .../References/CLM50_Tech_Note_References.rst | 9 +++ 5 files changed, 126 insertions(+), 5 deletions(-) diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst index 469bc96f33..14704b0b5f 100644 --- a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -54,7 +54,7 @@ Tissue Stoichiometry As of CLM5, vegetation tissues have a flexible stoichiometry, as described in :ref:`Ghimire et al. (2016) `. Each -tissue has a target C\:N ratio, and nitrogen is allocated at each +tissue has a target C\:N ratio (see :numref:`Table Plant functional type (PFT) target CN parameters`), and nitrogen is allocated at each timestep in order to allow the plant to best match the target stoichiometry. Nitrogen downregulation of productivity acts by increasing the C\:N ratio of leaves when insufficient nitrogen is @@ -63,3 +63,57 @@ reducing the N available for photosynthesis and reducing the :math:`V_{\text{c,m :math:`J_{\text{max25}}` terms, as described in Chapter :numref:`rst_Photosynthetic Capacity`. Details of the flexible tissue stoichiometry are described in Chapter :numref:`rst_CN Allocation`. + +.. _Table Plant functional type (PFT) target CN parameters: + +.. table:: Plant functional type (PFT) target C:N parameters. + + +----------------------------------+-------------------+ + | PFT | target leaf C:N | + +==================================+===================+ + | NET Temperate | 58.00 | + +----------------------------------+-------------------+ + | NET Boreal | 58.00 | + +----------------------------------+-------------------+ + | NDT Boreal | 25.81 | + +----------------------------------+-------------------+ + | BET Tropical | 29.60 | + +----------------------------------+-------------------+ + | BET temperate | 29.60 | + +----------------------------------+-------------------+ + | BDT tropical | 23.45 | + +----------------------------------+-------------------+ + | BDT temperate | 23.45 | + +----------------------------------+-------------------+ + | BDT boreal | 23.45 | + +----------------------------------+-------------------+ + | BES temperate | 36.42 | + +----------------------------------+-------------------+ + | BDS temperate | 23.26 | + +----------------------------------+-------------------+ + | BDS boreal | 23.26 | + +----------------------------------+-------------------+ + | C\ :sub:`3` arctic grass | 28.03 | + +----------------------------------+-------------------+ + | C\ :sub:`3` grass | 28.03 | + +----------------------------------+-------------------+ + | C\ :sub:`4` grass | 35.36 | + +----------------------------------+-------------------+ + | Temperate Corn | 25.00 | + +----------------------------------+-------------------+ + | Spring Wheat | 20.00 | + +----------------------------------+-------------------+ + | Temperate Soybean | 20.00 | + +----------------------------------+-------------------+ + | Cotton | 20.00 | + +----------------------------------+-------------------+ + | Rice | 20.00 | + +----------------------------------+-------------------+ + | Sugarcane | 25.00 | + +----------------------------------+-------------------+ + | Tropical Corn | 25.00 | + +----------------------------------+-------------------+ + | Tropical Soybean | 20.00 | + +----------------------------------+-------------------+ + + diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index fb6a180edd..8f0b975fce 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -372,7 +372,7 @@ Harvest occurs in one time step using the BGC leaf offset algorithm. Notes: :math:`Date_{planting}^{min}` and :math:`Date_{planting}^{max}` are the minimum and maximum planting date in the Northern Hemisphere, the corresponding dates in the Southern Hemisphere apply 6 months later. -:math:`T_{p}` and :math:`T_{p}^{ min }` are crop-specific coldest planting temperatures. +:math:`T_{p}` and :math:`T_{p}^{ min }` are crop-specific average and coldest planting temperatures, respectively. :math:`{GDD}_{min}` is the lowest (for planting) 20-year running mean growing degree-days based on the base temperature threshold in the 7\ :sup:`th` row, tracked from April to September (NH). :math:`{GDD}_{mat}` is a crop’s 20-year running mean growing diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index 84136f7868..f7171f1a10 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -66,7 +66,8 @@ photosynthesis (:math:`\mu`\ mol CO\ :sub:`2` m\ :sup:`-2` s\ :sup:`-1`), :math:`c_{s}` is the CO\ :sub:`2` partial pressure at the leaf surface (Pa), :math:`P_{atm}` is the atmospheric pressure (Pa), and :math:`D` is the vapor pressure deficit at the leaf surface (kPa). -:math:`g_{1}` is a plant functional type dependent parameter (:numref:`Table Plant functional type (PFT) stomatal conductance parameters`). +:math:`g_{1}` is a plant functional type dependent parameter (:numref:`Table Plant functional type (PFT) stomatal conductance parameters`) +and are the same as those used in the CABLE model (:ref:`de Kauwe et al. 2015 `). The value for :math:`g_{o}=100` :math:`\mu` mol m :sup:`-2` s\ :sup:`-1` for C\ :sub:`3` and C\ :sub:`4` plants. diff --git a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst index 4c3e857ade..c75c9f2b39 100755 --- a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst +++ b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst @@ -82,7 +82,64 @@ multiplication of leaf mass per unit area (:math:`\text{LMA}`; g biomass/m :sup: N_{\text{str}} = \text{SNC} \cdot \text{LMA} -where :math:`\text{SNC}` is set to be fixed at 0.002 (gN/g biomass), based on data on C:N ratio from dead wood (White etal.,2000). +where :math:`\text{SNC}` is set to be fixed at 0.002 (gN/g biomass), based on data on C:N ratio from dead wood (White etal.,2000), +and :math:`\text{LMA}` is the inverse of specific leaf area at the canopy top (:math:`SLA_{\text{0}}`), a PFT-level parameter (:numref:`Table Plant functional type (PFT) leaf N parameters`). + +.. _Table Plant functional type (PFT) leaf N parameters: + +.. table:: Plant functional type (PFT) leaf N parameters. + + +----------------------------------+--------------------------+--------------------------+ + | PFT | :math:`SLA_{\text{0}}` | :math:`N_{\text{cb}}` | + +==================================+==========================+==========================+ + | NET Temperate | 0.0100 | 0.0509 | + +----------------------------------+--------------------------+--------------------------+ + | NET Boreal | 0.0100 | 0.0466 | + +----------------------------------+--------------------------+--------------------------+ + | NDT Boreal | 0.0202 | 0.0546 | + +----------------------------------+--------------------------+--------------------------+ + | BET Tropical | 0.0190 | 0.0461 | + +----------------------------------+--------------------------+--------------------------+ + | BET temperate | 0.0190 | 0.0515 | + +----------------------------------+--------------------------+--------------------------+ + | BDT tropical | 0.0308 | 0.0716 | + +----------------------------------+--------------------------+--------------------------+ + | BDT temperate | 0.0308 | 0.1007 | + +----------------------------------+--------------------------+--------------------------+ + | BDT boreal | 0.0308 | 0.1007 | + +----------------------------------+--------------------------+--------------------------+ + | BES temperate | 0.0180 | 0.0517 | + +----------------------------------+--------------------------+--------------------------+ + | BDS temperate | 0.0307 | 0.0943 | + +----------------------------------+--------------------------+--------------------------+ + | BDS boreal | 0.0307 | 0.0943 | + +----------------------------------+--------------------------+--------------------------+ + | C\ :sub:`3` arctic grass | 0.0402 | 0.1365 | + +----------------------------------+--------------------------+--------------------------+ + | C\ :sub:`3` grass | 0.0402 | 0.1365 | + +----------------------------------+--------------------------+--------------------------+ + | C\ :sub:`4` grass | 0.0385 | 0.0900 | + +----------------------------------+--------------------------+--------------------------+ + | Temperate Corn | 0.0500 | 0.2930 | + +----------------------------------+--------------------------+--------------------------+ + | Spring Wheat | 0.0350 | 0.4102 | + +----------------------------------+--------------------------+--------------------------+ + | Temperate Soybean | 0.0350 | 0.4102 | + +----------------------------------+--------------------------+--------------------------+ + | Cotton | 0.0350 | 0.4102 | + +----------------------------------+--------------------------+--------------------------+ + | Rice | 0.0350 | 0.4102 | + +----------------------------------+--------------------------+--------------------------+ + | Sugarcane | 0.0500 | 0.2930 | + +----------------------------------+--------------------------+--------------------------+ + | Tropical Corn | 0.0500 | 0.2930 | + +----------------------------------+--------------------------+--------------------------+ + | Tropical Soybean | 0.0350 | 0.4102 | + +----------------------------------+--------------------------+--------------------------+ + +Notes: :math:`SLA_{\text{0}}` is the specific leaf area at the canopy top (m :sup:`2` leaf/g biomass), +and :math:`N_{\text{cb}}` is the fraction of leaf nitrogen in Rubisco (g N in Rubisco g :sup:`-1` N) + We assume that plants optimize their nitrogen allocations (i.e., :math:`N_{\text{store}}`, :math:`N_{\text{resp}}`, :math:`N_{\text{lc}}`, :math:`N_{\text{et}}`, :math:`N_{\text{cb}}`) to maximize the photosynthetic carbon gain, defined as the gross photosynthesis ( :math:`A` ) minus the maintenance respiration for @@ -202,7 +259,7 @@ as in :ref:`Thornton and Zimmermann (2007)`. At 25ºC, where :math:`N_{str}` is the area-based leaf nitrogen concentration (g N m\ :sup:`-2` leaf area), :math:`N_{cb}` is the fraction of leaf -nitrogen in Rubisco (g N in Rubisco g\ :sup:`-1` N), +nitrogen in Rubisco (g N in Rubisco g\ :sup:`-1` N, :numref:`Table Plant functional type (PFT) leaf N parameters`), :math:`F_{NR} =7.16` is the mass ratio of total Rubisco molecular mass to nitrogen in Rubisco (g Rubisco g\ :sup:`-1` N in Rubisco), and :math:`a_{R25} =60` is the specific activity of Rubisco (µmol diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index cafba90dc3..e6b2222c75 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -536,6 +536,15 @@ correspond with changes in labile organic C fractions in soil amended with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): 453-462. +.. _deKauwe2015: + +|br| + +de Kauwe, D.A., Kala, J., Lin, Y.-S., Pitman, A.J., Medlyn, B.E., Duursma, R.A., +Abramowitz, G., Wang, Y.-P., Miralles, D.G. 2015. A test of an optimal stomatal +conductance scheme within the CABLE land surface model. Geosci. Model Dev. +8(2):431-452. + .. _deVries1963: |br| From 91bdfba827a3b701877ed17e2b1ef5312fa5389d Mon Sep 17 00:00:00 2001 From: Danica Lombardozzi Date: Mon, 16 Jul 2018 11:12:42 -0600 Subject: [PATCH 0208/1973] Updated the parameter values in Table 3 of the crop chapter, and adding clarifying text to the CN pools chapter --- doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 3 ++- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst index 14704b0b5f..9bddee21ca 100644 --- a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -54,7 +54,8 @@ Tissue Stoichiometry As of CLM5, vegetation tissues have a flexible stoichiometry, as described in :ref:`Ghimire et al. (2016) `. Each -tissue has a target C\:N ratio (see :numref:`Table Plant functional type (PFT) target CN parameters`), and nitrogen is allocated at each +tissue has a target C\:N ratio, with the target leaf C\:N varying by plant functional type +(see :numref:`Table Plant functional type (PFT) target CN parameters`), and nitrogen is allocated at each timestep in order to allow the plant to best match the target stoichiometry. Nitrogen downregulation of productivity acts by increasing the C\:N ratio of leaves when insufficient nitrogen is diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 8f0b975fce..3b8f07f44c 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -565,9 +565,9 @@ efficiency of 85%. \ temperate corn spring wheat temperatue soybean cotton rice sugarcane tropical corn tropical soybean =========================================== ============== ============ ================== ====== ====== ========= ============= ================ IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 - :math:`a_{leaf}^{i}` 0.8 0.9 0.85 0.85 0.75 0.8 0.8 0.85 + :math:`a_{leaf}^{i}` 0.6 0.9 0.85 0.85 0.75 0.6 0.6 0.85 :math:`{L}_{max}` (m :sup:`2` m :sup:`-2`) 5 7 6 6 7 5 5 6 - :math:`a_{froot}^{i}` 0.4 0.1 0.2 0.2 0.1 0.4 0.4 0.2 + :math:`a_{froot}^{i}` 0.1 0.05 0.2 0.2 0.1 0.1 0.1 0.2 :math:`a_{froot}^{f}` 0.05 0 0.2 0.2 0 0.05 0.05 0.2 :math:`a_{leaf}^{f}` 0 0 0 0 0 0 0 0 :math:`a_{livestem}^{f}` 0 0.05 0.3 0.3 0.05 0 0 0.3 From 66611596e6be0e1e4b2202a2f8f9e2e08ec01575 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 2 Aug 2018 10:36:23 -0600 Subject: [PATCH 0209/1973] add namelist variable use_biomass_heat_storage --- bld/CLMBuildNamelist.pm | 1 + .../namelist_defaults_clm4_5.xml | 1 + .../namelist_definition_clm4_5.xml | 5 + src/biogeophys/BareGroundFluxesMod.F90 | 19 ++- src/biogeophys/CanopyFluxesMod.F90 | 145 +++++++++++++++--- src/biogeophys/FrictionVelocityMod.F90 | 7 +- src/biogeophys/SoilFluxesMod.F90 | 3 +- src/main/clm_initializeMod.F90 | 2 +- src/main/clm_instMod.F90 | 2 + src/main/pftconMod.F90 | 16 ++ src/main/readParamsMod.F90 | 5 +- 11 files changed, 175 insertions(+), 31 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 00807d049c..0be2ded790 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3616,6 +3616,7 @@ sub setup_logic_canopyfluxes { if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_undercanopy_stability' ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_biomass_heat_storage'); } } diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 1a3629725d..1d5cf7bb95 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -229,6 +229,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .true. +.false. .true. diff --git a/bld/namelist_files/namelist_definition_clm4_5.xml b/bld/namelist_files/namelist_definition_clm4_5.xml index 44b98a18b4..c82ab2c607 100644 --- a/bld/namelist_files/namelist_definition_clm4_5.xml +++ b/bld/namelist_files/namelist_definition_clm4_5.xml @@ -303,6 +303,11 @@ Intercept of free living Nitrogen fixation with zero annual ET If TRUE use the undercanopy stability term used with CLM4.5 (Sakaguchi&Zeng, 2008) + +If TRUE, include biomass heat storage in canopy energy balance. + + Fraction of intercepted precipitation diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index cfbc99b740..248c7b6a2e 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -112,6 +112,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & !------------------------------------------------------------------------------ associate( & + hs_canopy => energyflux_inst%hs_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] + eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:,:) ] evaporative soil resistance (s/m) snl => col%snl , & ! Input: [integer (:) ] number of snow layers dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) @@ -202,11 +204,11 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: u10_clm => frictionvel_inst%u10_clm_patch , & ! Input: [real(r8) (:) ] 10 m height winds (m/s) zetamax => frictionvel_parms_inst%zetamaxstable , & ! Input: [real(r8) ] max zeta value under stable conditions - z0mg_col => frictionvel_inst%z0mg_col , & ! Output: [real(r8) (:) ] roughness length, momentum [m] - z0hg_col => frictionvel_inst%z0hg_col , & ! Output: [real(r8) (:) ] roughness length, sensible heat [m] - z0qg_col => frictionvel_inst%z0qg_col , & ! Output: [real(r8) (:) ] roughness length, latent heat [m] - ram1 => frictionvel_inst%ram1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) - + z0mg_col => frictionvel_inst%z0mg_col , & ! Output: [real(r8) (:) ] roughness length, momentum [m] + z0hg_col => frictionvel_inst%z0hg_col , & ! Output: [real(r8) (:) ] roughness length, sensible heat [m] + z0qg_col => frictionvel_inst%z0qg_col , & ! Output: [real(r8) (:) ] roughness length, latent heat [m] + ram1 => frictionvel_inst%ram1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) + num_iter => frictionvel_inst%num_iter_patch , & ! Output: [real(r8) (:) ] number of iterations htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of evaporation (/sublimation) [J/kg] qflx_ev_snow => waterflux_inst%qflx_ev_snow_patch , & ! Output: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] qflx_ev_soil => waterflux_inst%qflx_ev_soil_patch , & ! Output: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] @@ -251,7 +253,9 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & displa(p) = 0._r8 dlrad(p) = 0._r8 ulrad(p) = 0._r8 - + hs_canopy(p) = 0._r8 + eflx_sh_stem(p) = 0._r8 + ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) dth(p) = thm(p)-t_grnd(c) dqh(p) = forc_q(c) - qg(c) @@ -268,6 +272,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & call MoninObukIni(ur(p), thv(c), dthv, zldis(p), z0mg_patch(p), um(p), obu(p)) + num_iter(p) = 0 end do ! Perform stability iteration @@ -305,6 +310,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & obu(p) = zldis(p)/zeta end do + num_iter(p) = iter + end do ! end stability iteration do f = 1, num_noexposedvegp diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 872e077c3c..7cf2033546 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -50,6 +50,25 @@ module CanopyFluxesMod ! ! !PUBLIC TYPES: implicit none + ! + ! !PUBLIC VARIABLES: + + type :: canopyflux_params_type + real(r8), allocatable, public :: dbh (:) + real(r8), allocatable, public :: fbw (:) + real(r8), allocatable, public :: nstem (:) + real(r8), allocatable, public :: rstem (:) + real(r8), allocatable, public :: wood_density (:) + contains + procedure, private :: allocParams + end type canopyflux_params_type + ! + type(canopyflux_params_type), public, protected :: params_inst ! params_inst is populated in readParamsMod + + type, public :: canopyflux_type + contains + procedure, public :: ReadParams + end type canopyflux_type ! ! !PUBLIC MEMBER FUNCTIONS: public :: CanopyFluxesReadNML ! Read in namelist settings @@ -68,6 +87,7 @@ module CanopyFluxesMod logical, private :: snowveg_on = .false. ! snowveg_flag = 'ON' logical, private :: snowveg_onrad = .true. ! snowveg_flag = 'ON_RAD' logical, private :: use_undercanopy_stability = .true. ! use undercanopy stability term or not + logical, private :: use_biomass_heat_storage = .false. ! include biomass heat storage character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -75,6 +95,76 @@ module CanopyFluxesMod contains + !----------------------------------------------------------------------- + subroutine allocParams ( this ) + ! + use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) + implicit none + + ! !ARGUMENTS: + class(canopyflux_params_type) :: this + ! + ! !LOCAL VARIABLES: + character(len=32) :: subname = 'allocParams' + !----------------------------------------------------------------------- + + ! allocate parameters + + allocate( this%dbh (0:mxpft) ) ; this%dbh(:) = nan + allocate( this%fbw (0:mxpft) ) ; this%fbw(:) = nan + allocate( this%nstem (0:mxpft) ) ; this%nstem(:) = nan + allocate( this%rstem (0:mxpft) ) ; this%rstem(:) = nan + allocate( this%wood_density(0:mxpft) ) ; this%wood_density(:) = nan + + end subroutine allocParams + + !----------------------------------------------------------------------- + subroutine readParams ( this, ncid ) + ! + ! !USES: + use ncdio_pio , only : file_desc_t,ncd_io + implicit none + + ! !ARGUMENTS: + class(canopyflux_type) :: this + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=32) :: subname = 'readParams' + character(len=100) :: errCode = '-Error reading in parameters file:' + logical :: readv ! has variable been read in or not + real(r8) :: temp1d(0:mxpft) ! temporary to read in parameter + character(len=100) :: tString ! temp. var for reading + !----------------------------------------------------------------------- + + ! read in parameters + + + call params_inst%allocParams() + + tString = "dbh" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%dbh=temp1d + tString = "fbw" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%fbw=temp1d + tString = "nstem" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%nstem=temp1d + tString = "rstem" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%rstem=temp1d + tString = "wood_density" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%wood_density=temp1d + + end subroutine readParams + !------------------------------------------------------------------------ subroutine CanopyFluxesReadNML(NLFilename) ! @@ -99,7 +189,7 @@ subroutine CanopyFluxesReadNML(NLFilename) character(len=*), parameter :: nmlname = 'canopyfluxes_inparm' !----------------------------------------------------------------------- - namelist /canopyfluxes_inparm/ use_undercanopy_stability + namelist /canopyfluxes_inparm/ use_undercanopy_stability,use_biomass_heat_storage ! Initialize options to default values, in case they are not specified in ! the namelist @@ -121,6 +211,7 @@ subroutine CanopyFluxesReadNML(NLFilename) end if call shr_mpi_bcast (use_undercanopy_stability, mpicom) + call shr_mpi_bcast (use_biomass_heat_storage, mpicom) if (masterproc) then write(iulog,*) ' ' @@ -353,20 +444,19 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: cp_veg(bounds%begp:bounds%endp) !heat capacity of veg real(r8) :: cp_stem(bounds%begp:bounds%endp) !heat capacity of stems - real(r8) :: dt_stem(bounds%begp:bounds%endp) + real(r8) :: dt_stem(bounds%begp:bounds%endp) !change in stem temperature real(r8) :: fstem(bounds%begp:bounds%endp) !fraction of stem - real(r8) :: bhd(0:mxpft) !stem breast-height-diameter - real(r8) :: wood_density, carea_stem real(r8) :: lw_stem(bounds%begp:bounds%endp) !internal longwave stem real(r8) :: lw_leaf(bounds%begp:bounds%endp) !internal longwave leaf real(r8) :: sa_stem(bounds%begp:bounds%endp) !surface area stem m2/m2_ground real(r8) :: sa_leaf(bounds%begp:bounds%endp) !surface area leaf m2/m2_ground real(r8) :: sa_internal(bounds%begp:bounds%endp) !min(sa_stem,sa_leaf) real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed + real(r8) :: cp_wood + real(r8) :: carea_stem + real(r8) :: rstema ! biomass parameters real(r8), parameter :: c_to_b = 2.0_r8 !(g biomass /g C) - real(r8), parameter :: ntree = 0.4_r8 !(number of trees / m2) - real(r8), parameter :: rstem = 100._r8 !stem resistance (s/m) real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume @@ -541,6 +631,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, obu => frictionvel_inst%obu_patch , & ! Output: [real(r8) (:) ] Monin-Obukhov length [m] zeta => frictionvel_inst%zeta_patch , & ! Output: [real(r8) (:) ] dimensionless stability parameter vpd => frictionvel_inst%vpd_patch , & ! Output: [real(r8) (:) ] vapor pressure deficit [Pa] + num_iter => frictionvel_inst%num_iter_patch , & ! Output: [real(r8) (:) ] number of iterations begp => bounds%begp , & endp => bounds%endp , & @@ -621,11 +712,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, btran(p) = btran0 btran2(p) = btran0 hs_canopy(p) = 0._r8 + eflx_sh_stem(p) = 0._r8 end do -! set bhd (should be done on parameter file) - bhd(1:16) = (/0.15,0.15,0.15,0.2,0.2,0.2,0.2,0.1,0.02,0.02,0.02,0.004,0.004,0.004,0.004,0.004/) - ! calculate biomass heat capacities do f = 1, fn p = filterp(f) @@ -633,34 +722,46 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! fraction of stem receiving incoming radiation fstem(p) = (esai(p))/(elai(p)+esai(p)) fstem(p) = k_vert * fstem(p) + if(.not.use_biomass_heat_storage) then + fstem(p) = 0._r8 + endif + ! leaf and stem surface area sa_leaf(p) = elai(p) ! double in spirit of full surface area for sensible heat sa_leaf(p) = 2.*sa_leaf(p) - sa_stem(p) = ntree*(htop(p)*shr_const_pi*bhd(patch%itype(p))) + + sa_stem(p) = params_inst%nstem(patch%itype(p))*(htop(p)*shr_const_pi*params_inst%dbh(patch%itype(p))) ! adjust for departure of cylindrical stem model sa_stem(p) = k_cyl_area * sa_stem(p) + if(.not.use_biomass_heat_storage) then + sa_stem(p) = 0._r8 + endif +! do not calculate separate leaf/stem heat capacity for grasses + if(patch%itype(p) > 11) then + fstem(p) = 0.0 + sa_stem(p) = 0.0 + endif + ! internal longwave fluxes between leaf and stem ! surface area term must be equal, remainder cancels ! (use same area of interaction i.e. ignore leaf <-> leaf) sa_internal(p) = min(sa_leaf(p),sa_stem(p)) sa_internal(p) = k_internal * sa_internal(p) -!scs: specify heat capacity of vegetation +! calculate specify heat capacity of vegetation !(lma * c2b = lma_dry, lma * c2b * (fw/(1-fw)) = lma_wet, sum these) ! lma_dry has units of kg dry mass /m2 here (table 2 of bonan 2017) ! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) - cp_veg(p) = (0.25_r8 * elai(p)) * (1400._r8 + (0.7/(1.-0.7))*4188._r8) + cp_veg(p) = (0.25_r8 * max(0.01_r8,elai(p))) * (1400._r8 + (params_inst%fbw(patch%itype(p))/(1.-params_inst%fbw(patch%itype(p))))*4188._r8) -! wood density could vary by pft... - wood_density = 5.e2_r8 ! kg/m3 lindroth2010 uses ~4.e2 - carea_stem = shr_const_pi * (bhd(patch%itype(p))*0.5)**2 + carea_stem = shr_const_pi * (params_inst%dbh(patch%itype(p))*0.5)**2 ! cp-stem will have units J/k/ground_area (here assuming 1 stem/m2) - cp_stem(p) = (1400._r8 + (0.7/(1.-0.7))*4188._r8) + cp_stem(p) = (1400._r8 + (params_inst%fbw(patch%itype(p))/(1.-params_inst%fbw(patch%itype(p))))*4188._r8) ! use weight of dry wood - cp_stem(p) = cp_stem(p) * ntree * wood_density * htop(p) * carea_stem + cp_stem(p) = params_inst%nstem(patch%itype(p))* cp_stem(p) * params_inst%wood_density(patch%itype(p)) * htop(p) * carea_stem ! adjust for departure from cylindrical stem model cp_stem(p) = k_cyl_vol * cp_stem(p) enddo @@ -819,6 +920,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, call MoninObukIni(ur(p), thv(c), dthv(p), zldis(p), z0mv(p), um(p), obu(p)) + num_iter(p) = 0 end do ! Set counter for leaf temperature iteration (itlef) @@ -994,7 +1096,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, wtg(p) = 1._r8/rah(p,2) ! ground ! wtstem = sa_stem(p)/rb(p) ! stem ! add resistance between internal stem temperature and canopy air - wtstem = sa_stem(p)/(rstem + rb(p)) ! stem + rstema = params_inst%rstem(patch%itype(p))*params_inst%dbh(patch%itype(p)) + wtstem = sa_stem(p)/(rstema + rb(p)) ! stem wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) @@ -1179,7 +1282,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! The energy loss due to above two limits is added to ! the sensible heat flux. - eflx_sh_veg(p) = efsh + dc1*wtga(p)*dt_veg(p) + err(p) + erre + hvap*ecidif + eflx_sh_veg(p) = efsh + dc1*wtga(p)*dt_veg(p) + err(p) + erre + hvap*ecidif ! Update SH and lw_leaf for changes in t_veg eflx_sh_stem(p) = eflx_sh_stem(p) + forc_rho(c)*cpair*wtstem*(-wtl0(p)*dt_veg(p)) @@ -1211,7 +1314,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, zeta(p) = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) if (zeta(p) >= 0._r8) then !stable - zeta(p) = min(zetamax,max(zeta(p),0.01_r8)) + zeta(p) = min(100._r8,max(zeta(p),0.01_r8)) um(p) = max(ur(p),0.1_r8) else !unstable zeta(p) = max(-100._r8,min(zeta(p),-0.01_r8)) @@ -1229,6 +1332,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Test for convergence itlef = itlef+1 + num_iter(p) = itlef if (itlef > itmin) then do f = 1, fn p = filterp(f) @@ -1246,7 +1350,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, end if end do end if - end do ITERATION ! End stability iteration call t_stopf('can_iter') diff --git a/src/biogeophys/FrictionVelocityMod.F90 b/src/biogeophys/FrictionVelocityMod.F90 index 0b32c39c0a..0111962a48 100644 --- a/src/biogeophys/FrictionVelocityMod.F90 +++ b/src/biogeophys/FrictionVelocityMod.F90 @@ -65,7 +65,7 @@ module FrictionVelocityMod real(r8), pointer, public :: obu_patch (:) ! patch Monin-Obukhov length [m] real(r8), pointer, public :: zeta_patch (:) ! patch dimensionless stability parameter real(r8), pointer, public :: vpd_patch (:) ! patch vapor pressure deficit [Pa] - + real(r8), pointer, public :: num_iter_patch (:) ! patch number of iterations contains @@ -155,6 +155,7 @@ subroutine InitAllocate(this, bounds) allocate(this%obu_patch (begp:endp)) ; this%obu_patch (:) = nan allocate(this%zeta_patch (begp:endp)) ; this%zeta_patch (:) = nan allocate(this%vpd_patch (begp:endp)) ; this%vpd_patch (:) = nan + allocate(this%num_iter_patch (begp:endp)) ; this%num_iter_patch (:) = nan end subroutine InitAllocate @@ -274,6 +275,10 @@ subroutine InitHistory(this, bounds) call hist_addfld1d (fname='VPD', units='Pa', & avgflag='A', long_name='vpd', & ptr_patch=this%vpd_patch, default='inactive') + this%num_iter_patch(begp:endp) = spval + call hist_addfld1d (fname='num_iter', units='unitless', & + avgflag='A', long_name='number of iterations', & + ptr_patch=this%num_iter_patch, default='inactive') this%rb1_patch(begp:endp) = spval call hist_addfld1d (fname='RB', units='s/m', & avgflag='A', long_name='leaf boundary resistance', & diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index 7ce0d57e9b..c52958d007 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -303,7 +303,8 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! Total fluxes (vegetation + ground) - eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_stem(p) + eflx_sh_grnd(p) + eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_grnd(p) + if (.not. lun%urbpoi(l)) eflx_sh_tot(p) = eflx_sh_tot(p) + eflx_sh_stem(p) qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) eflx_lh_tot(p)= hvap*qflx_evap_veg(p) + htvp(c)*qflx_evap_soi(p) if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 393e2d0cdd..4cab3a56d3 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -341,7 +341,7 @@ subroutine initialize2( ) allocate(nutrient_competition_method, & source=create_nutrient_competition_method(bounds_proc)) - call readParameters(nutrient_competition_method, photosyns_inst) + call readParameters(nutrient_competition_method, photosyns_inst, canopyflux_inst) ! ------------------------------------------------------------------------ ! Initialize time manager diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 1b1b44adba..b33026326f 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -49,6 +49,7 @@ module clm_instMod use OzoneBaseMod , only : ozone_base_type use OzoneFactoryMod , only : create_and_init_ozone_type use PhotosynthesisMod , only : photosyns_type + use CanopyFluxesMod , only : canopyflux_type use SoilHydrologyType , only : soilhydrology_type use SoilStateType , only : soilstate_type use SolarAbsorbedType , only : solarabs_type @@ -99,6 +100,7 @@ module clm_instMod type(lakestate_type) :: lakestate_inst class(ozone_base_type), allocatable :: ozone_inst type(photosyns_type) :: photosyns_inst + type(canopyflux_type) :: canopyflux_inst type(soilstate_type) :: soilstate_inst type(soilhydrology_type) :: soilhydrology_inst type(solarabs_type) :: solarabs_inst diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 0efa2053eb..53fb8d0d0c 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -145,6 +145,12 @@ module pftconMod real(r8), allocatable :: root_radius (:) ! root radius (m) real(r8), allocatable :: root_density (:) ! root density (gC/m3) + real(r8), allocatable :: dbh (:) ! diameter at breast height (m) + real(r8), allocatable :: fbw (:) ! fraction of biomass that is water + real(r8), allocatable :: nstem (:) ! stem density (#/m2) + real(r8), allocatable :: rstem (:) ! stem resistance (s/m) + real(r8), allocatable :: wood_density (:) ! wood density (kg/m3) + ! crop ! These arrays give information about the merge of unused crop types to the types CLM @@ -460,6 +466,11 @@ subroutine InitAllocate (this) allocate( this%fun_cn_flex_c (0:mxpft) ) allocate( this%FUN_fracfixers(0:mxpft) ) + allocate( this%dbh (0:mxpft) ) + allocate( this%fbw (0:mxpft) ) + allocate( this%nstem (0:mxpft) ) + allocate( this%rstem (0:mxpft) ) + allocate( this%wood_density (0:mxpft) ) end subroutine InitAllocate @@ -1375,6 +1386,11 @@ subroutine Clean(this) deallocate( this%fun_cn_flex_c) deallocate( this%FUN_fracfixers) + deallocate( this%dbh) + deallocate( this%fbw) + deallocate( this%nstem) + deallocate( this%rstem) + deallocate( this%wood_density) end subroutine Clean end module pftconMod diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index 7fbea89531..f1c7a4aa43 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -23,7 +23,7 @@ module readParamsMod contains !----------------------------------------------------------------------- - subroutine readParameters (nutrient_competition_method, photosyns_inst) + subroutine readParameters (nutrient_competition_method, photosyns_inst, canopyflux_inst) ! ! ! USES: use CNSharedParamsMod , only : CNParamsReadShared @@ -43,9 +43,11 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) use NutrientCompetitionMethodMod , only : nutrient_competition_method_type use clm_varctl, only : NLFilename_in use PhotosynthesisMod , only : photosyns_type + use CanopyFluxesMod , only : canopyflux_type ! ! !ARGUMENTS: type(photosyns_type) , intent(in) :: photosyns_inst + type(canopyflux_type) , intent(in) :: canopyflux_inst class(nutrient_competition_method_type), intent(in) :: nutrient_competition_method ! ! !LOCAL VARIABLES: @@ -97,6 +99,7 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) ! Biogeophysics ! call photosyns_inst%ReadParams( ncid ) + call canopyflux_inst%ReadParams( ncid ) ! From b0f5aceb42991a44079ced68ebaa2ce20f3f5269 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 10:16:13 -0700 Subject: [PATCH 0210/1973] add travis ci setup and dummy program --- lilac/.travis.yml | 28 ++++++++++++++++++++++++++++ lilac/CMakeLists.txt | 26 ++++++++++++++++++++++++++ lilac/lilac/test/simple_driver.f90 | 12 ++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 lilac/.travis.yml create mode 100644 lilac/CMakeLists.txt create mode 100644 lilac/lilac/test/simple_driver.f90 diff --git a/lilac/.travis.yml b/lilac/.travis.yml new file mode 100644 index 0000000000..bc0113b32d --- /dev/null +++ b/lilac/.travis.yml @@ -0,0 +1,28 @@ +language: c +sudo: false +dist: trusty + +matrix: + include: + - os: linux + compiler: gcc + apt: + packages: + - cmake3 + - gfortran + +before_install: + - echo "before install" + +install: + - cd ${TRAVIS_BUILD_DIR} + - mkdir -p build && cd build + - cmake .. + - make + +before_script: + - echo "before script" + +script: + - cd ${TRAVIS_BUILD_DIR} + - ./build/prog diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt new file mode 100644 index 0000000000..a84296a576 --- /dev/null +++ b/lilac/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 2.8.12.1) + +project(LILAC) +enable_language(Fortran) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") + set(dialect "-ffree-form -std=f2008 -fimplicit-none") + set(bounds "-fbounds-check") +endif() +if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") + set(dialect "-stand f08 -free -implicitnone") + set(bounds "-check bounds") +endif() +if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI") + set(dialect "-Mfreeform -Mdclchk -Mstandard -Mallocatable=03") + set(bounds "-C") +endif() + +set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") + +# +# Compile. +# +file(GLOB_RECURSE sources lilac/test/*.f90 lilac/test/*.h) +add_executable(prog ${sources}) diff --git a/lilac/lilac/test/simple_driver.f90 b/lilac/lilac/test/simple_driver.f90 new file mode 100644 index 0000000000..4b2d940b58 --- /dev/null +++ b/lilac/lilac/test/simple_driver.f90 @@ -0,0 +1,12 @@ +program simple_driver + implicit none + integer :: t + + t = 1 + + if (t == 1) then + write(*,*) "on this line" + else + write(*,*) "but not here" + end if +end program From a5023fbca4afb43a2b35077c887713d37db22833 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 2 Aug 2018 11:59:02 -0600 Subject: [PATCH 0211/1973] corrections for elai = 0 conditions --- src/biogeophys/CanopyFluxesMod.F90 | 35 ++++++++++++++++++---------- src/biogeophys/PhotosynthesisMod.F90 | 2 +- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 7cf2033546..5044005279 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -721,10 +721,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! fraction of stem receiving incoming radiation fstem(p) = (esai(p))/(elai(p)+esai(p)) - fstem(p) = k_vert * fstem(p) - if(.not.use_biomass_heat_storage) then - fstem(p) = 0._r8 - endif + ! when elai = 0, do not multiply by k_vert (i.e. fstem = 1) + if(elai(p) > 0._r8) fstem(p) = k_vert * fstem(p) ! leaf and stem surface area sa_leaf(p) = elai(p) @@ -734,16 +732,20 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, sa_stem(p) = params_inst%nstem(patch%itype(p))*(htop(p)*shr_const_pi*params_inst%dbh(patch%itype(p))) ! adjust for departure of cylindrical stem model sa_stem(p) = k_cyl_area * sa_stem(p) - if(.not.use_biomass_heat_storage) then - sa_stem(p) = 0._r8 - endif + ! do not calculate separate leaf/stem heat capacity for grasses if(patch%itype(p) > 11) then fstem(p) = 0.0 sa_stem(p) = 0.0 endif -! internal longwave fluxes between leaf and stem + if(.not.use_biomass_heat_storage) then + fstem(p) = 0._r8 + sa_stem(p) = 0._r8 + sa_leaf(p) = (elai(p)+esai(p)) + endif + + ! internal longwave fluxes between leaf and stem ! surface area term must be equal, remainder cancels ! (use same area of interaction i.e. ignore leaf <-> leaf) sa_internal(p) = min(sa_leaf(p),sa_stem(p)) @@ -756,6 +758,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) cp_veg(p) = (0.25_r8 * max(0.01_r8,elai(p))) * (1400._r8 + (params_inst%fbw(patch%itype(p))/(1.-params_inst%fbw(patch%itype(p))))*4188._r8) +! use non-zero, but small, heat capacity + if(.not.use_biomass_heat_storage) then + cp_veg(p) = 1.e-3_r8 + endif + carea_stem = shr_const_pi * (params_inst%dbh(patch%itype(p))*0.5)**2 ! cp-stem will have units J/k/ground_area (here assuming 1 stem/m2) @@ -1128,7 +1135,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, end if ! should be the same expression used in Photosynthesis/getqflx - efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p)*(qsatl(p)-qaf(p)) + efpot = forc_rho(c)*(elai(p))/rb(p)*(qsatl(p)-qaf(p)) ! When the hydraulic stress parameterization is active calculate rpp ! but not transpiration @@ -1169,7 +1176,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Moved the original subroutine in-line... wtaq = frac_veg_nosno(p)/raw(p,1) ! air - wtlq = frac_veg_nosno(p)*(elai(p)+esai(p))/rb(p) * rpp ! leaf + wtlq = frac_veg_nosno(p)*(elai(p))/rb(p) * rpp ! leaf !Litter layer resistance. Added by K.Sakaguchi snow_depth_c = z_dl ! critical depth for 100% litter burial by snow (=litter thickness) @@ -1248,7 +1255,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! result in an imbalance in "hvap*qflx_evap_veg" and ! "efe + dc2*wtgaq*qsatdt_veg" - efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p) & + efpot = forc_rho(c)*(elai(p))/rb(p) & *(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) qflx_evap_veg(p) = rpp*efpot @@ -1314,7 +1321,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, zeta(p) = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) if (zeta(p) >= 0._r8) then !stable - zeta(p) = min(100._r8,max(zeta(p),0.01_r8)) + if(use_biomass_heat_storage) then + zeta(p) = min(100._r8,max(zeta(p),0.01_r8)) + else + zeta(p) = min(zetamax,max(zeta(p),0.01_r8)) + endif um(p) = max(ur(p),0.1_r8) else !unstable zeta(p) = max(-100._r8,min(zeta(p),-0.01_r8)) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 8b6e708606..f3def19dd8 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -4754,7 +4754,7 @@ subroutine getqflx(p,c,gb_mol,gs_mol_sun,gs_mol_sha,qflx_sun,qflx_sha,qsatl,qaf, cf = forc_pbot(c)/(rgas*1.e-3_r8*tgcm(p))*1.e6_r8 ! gb->gbmol conversion factor - wtl = (elai(p)+esai(p))*gb_mol + wtl = (elai(p))*gb_mol efpot = forc_rho(c)*wtl*(qsatl-qaf) if (havegs) then From 2f3a6cecefc0c8e9607f16d65df8785214176816 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 17:11:08 -0700 Subject: [PATCH 0212/1973] lots of cmake and travis stuff --- lilac/.travis.yml | 9 ++- lilac/CMakeLists.txt | 20 ++++-- lilac/README.md | 5 ++ lilac/ci/environment.yml | 10 +++ lilac/ci/install_esmf.sh | 15 +++++ lilac/ci/install_pfunit.sh | 20 ++++++ lilac/ci/install_python.sh | 20 ++++++ lilac/cmake/Modules/FindESMF.cmake | 70 ++++++++++++++++++++ lilac/lilac/CMakeLists.txt | 4 ++ lilac/lilac/lilac.f90 | 31 +++++++++ lilac/lilac/test/simple_driver.f90 | 12 ---- lilac/tests/CMakeLists.txt | 2 + lilac/tests/hello_world/CMakeLists.txt | 3 + lilac/tests/hello_world/main.f90 | 21 ++++++ lilac/tests/rand_atm_rand_lnd/CmakeLists.txt | 4 ++ lilac/tests/rand_atm_rand_lnd/main.f90 | 5 ++ 16 files changed, 230 insertions(+), 21 deletions(-) create mode 100644 lilac/ci/environment.yml create mode 100644 lilac/ci/install_esmf.sh create mode 100644 lilac/ci/install_pfunit.sh create mode 100644 lilac/ci/install_python.sh create mode 100644 lilac/cmake/Modules/FindESMF.cmake create mode 100644 lilac/lilac/CMakeLists.txt create mode 100644 lilac/lilac/lilac.f90 delete mode 100644 lilac/lilac/test/simple_driver.f90 create mode 100644 lilac/tests/CMakeLists.txt create mode 100644 lilac/tests/hello_world/CMakeLists.txt create mode 100644 lilac/tests/hello_world/main.f90 create mode 100644 lilac/tests/rand_atm_rand_lnd/CmakeLists.txt create mode 100644 lilac/tests/rand_atm_rand_lnd/main.f90 diff --git a/lilac/.travis.yml b/lilac/.travis.yml index bc0113b32d..1d52bb5ab3 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -1,4 +1,4 @@ -language: c +language: cpp sudo: false dist: trusty @@ -8,11 +8,14 @@ matrix: compiler: gcc apt: packages: - - cmake3 - gfortran + - cmake + - cmake-data before_install: - - echo "before install" + - ./install_python.sh + - ./install_esmf.sh + - ./install_pfunit.sh install: - cd ${TRAVIS_BUILD_DIR} diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index a84296a576..3b8e730424 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -1,8 +1,11 @@ cmake_minimum_required(VERSION 2.8.12.1) -project(LILAC) +project(LILAC Fortran) enable_language(Fortran) +# Local CMake modules +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(dialect "-ffree-form -std=f2008 -fimplicit-none") set(bounds "-fbounds-check") @@ -19,8 +22,13 @@ endif() set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") -# -# Compile. -# -file(GLOB_RECURSE sources lilac/test/*.f90 lilac/test/*.h) -add_executable(prog ${sources}) +# link to ESMF +find_package(ESMF) +include_directories(${esmf_INCLUDE_DIR}) +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}\ + ${ESMF_COMPILER_LINE}") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}\ + ${ESMF_LINK_LINE} -g -cpp") + +add_subdirectory(lilac) +add_subdirectory(tests) diff --git a/lilac/README.md b/lilac/README.md index a7a62fb359..721cc0f08a 100644 --- a/lilac/README.md +++ b/lilac/README.md @@ -2,3 +2,8 @@ LILAC, Lightweight Infrastructure for Land Atmosphere Coupling. + +Currently working on: + - Setting up CI and CMake + - setup/test style (borrow from geostreams) + - setup unit tests with pfunit diff --git a/lilac/ci/environment.yml b/lilac/ci/environment.yml new file mode 100644 index 0000000000..af786a9279 --- /dev/null +++ b/lilac/ci/environment.yml @@ -0,0 +1,10 @@ +name: lilac +channels: + - conda-forge +dependencies: + - python=3.6 + - xarray + - esmpy + - cmake + - pip: + - cpp-coveralls diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh new file mode 100644 index 0000000000..9356efd2c0 --- /dev/null +++ b/lilac/ci/install_esmf.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e +set -x + +cd ${HOME} + +git clone https://git.code.sf.net/p/esmf/esmf deps/esmf +cd deps/esmf +export ESMF_DIR=$PWD +export ESMF_INSTALL_PREFIX=/usr/esmf +export ESMFMKFILE=${ESMF_INSTALL_PREFIX}/esmf.mk +gmake -j8 lib +gmake install + +cd ${TRAVIS_BUILD_DIR} diff --git a/lilac/ci/install_pfunit.sh b/lilac/ci/install_pfunit.sh new file mode 100644 index 0000000000..84b5918c12 --- /dev/null +++ b/lilac/ci/install_pfunit.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -x + +cd ${HOME} + +git clone https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git ${HOME}/deps/pfunit +cd deps/pfunit + +# set environemnt variables +export F90=gfortran +export F90_VENDOR=GNU + +mkdir build +cd build +cmake .. +make install INSTALL_DIR=/usr + +cd ${TRAVIS_BUILD_DIR} diff --git a/lilac/ci/install_python.sh b/lilac/ci/install_python.sh new file mode 100644 index 0000000000..3e3739f648 --- /dev/null +++ b/lilac/ci/install_python.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -x + +cd ${HOME} + +# Install miniconda +wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ${HOME}/miniconda.sh +bash ~/miniconda.sh -b -p $HOME/miniconda +export PATH="$HOME/miniconda/bin:$PATH" +conda update conda --yes +conda clean -tipy +conda config --set always_yes yes --set changeps1 no +conda --version + +conda env create -f ci/environment.yml +source activate lilac + +cd ${TRAVIS_BUILD_DIR} diff --git a/lilac/cmake/Modules/FindESMF.cmake b/lilac/cmake/Modules/FindESMF.cmake new file mode 100644 index 0000000000..ba50c7a141 --- /dev/null +++ b/lilac/cmake/Modules/FindESMF.cmake @@ -0,0 +1,70 @@ +# +# Author: Ali Samii - The University of Texas at Austin +# +# Distributed under GPL2. For more info refer to: +# https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html +# +# +# FindESMF +# -------- +# +# This script tries to find the ESMF library. You have to define +# the path to esmf.mk file in your installation directory. +# +# There are plans to extend this script to find ESMF automatically, +# but until then, you should set the environment variable +# +# ESMFMKFILE = /path/to/esmf.mk +# +# in your installation directory. The output will be +# +# ESMF_LINK_LINE : All the libraries and link line stuff +# ESMF_COMPILER_LINE : All the compiler flags and include dirs +# +# + +# Defining the ${Esc} for syntax coloring. +string(ASCII 27 Esc) + +# Checking if ESMF exists +if (NOT DEFINED ENV{ESMFMKFILE} AND NOT DEFINED ESMFMKFILE) + message (FATAL_ERROR "\n${Esc}[1;31m!! Error: You need ESMF library to \ + run this program. please set the environment \ + variable ESMFMKFILE to point to esmf.mk in \ + your ESMF installation directory. \ + Try something like: ${Esc}[m\ + export ESMFMKFILE=/path/to/esmf.mk && cmake ${CMAKE_SOURCE_DIR}") +endif () + +if (NOT EXISTS $ENV{ESMFMKFILE} AND NOT EXISTS ${ESMFMKFILE}) + message (FATAL_ERROR "${Esc}[1;31m Error: esmf.mk file is not found at \ + ${ESMFMKFILE} ${Esc}[m") +else () + message ("+>${Esc}[1;32m The config file for ESMF library is found.${Esc}[m") +endif () + +if (DEFINED ENV{ESMFMKFILE}) + set(ESMFMKFILE $ENV{ESMFMKFILE} CACHE STRING "") +endif () +set(ESMFMKFILE ${ESMFMKFILE} CACHE STRING "") + +file(STRINGS "${ESMFMKFILE}" all_vars) +foreach(str ${all_vars}) + string(REGEX MATCH "^[^#]" def ${str}) + if (def) + string(REGEX MATCH "^[^=]+" var_name ${str}) + string(REGEX MATCH "=(.+)$" var_def ${str}) + set(var_def ${CMAKE_MATCH_1}) + set(${var_name} ${var_def}) + mark_as_advanced (${var_name}) + endif() +endforeach() + +set (ESMF_LINK_LINE "${ESMF_F90LINKOPTS} \ + ${ESMF_F90LINKRPATHS} \ + ${ESMF_F90LINKPATHS} \ + ${ESMF_F90ESMFLINKLIBS}") + +set (ESMF_COMPILER_LINE "${ESMF_F90COMPILEOPTS} \ + ${ESMF_F90COMPILEPATHS} \ + ${ESMF_F90COMPILEFREENOCPP}") diff --git a/lilac/lilac/CMakeLists.txt b/lilac/lilac/CMakeLists.txt new file mode 100644 index 0000000000..afbc52c6c3 --- /dev/null +++ b/lilac/lilac/CMakeLists.txt @@ -0,0 +1,4 @@ +# Compile LILAC library +file(GLOB_RECURSE LILAC_SOURCES *.f90 *.h) +add_library(lilac ${LILAC_SOURCES}) +target_include_directories(lilac PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lilac) diff --git a/lilac/lilac/lilac.f90 b/lilac/lilac/lilac.f90 new file mode 100644 index 0000000000..a7a862e60e --- /dev/null +++ b/lilac/lilac/lilac.f90 @@ -0,0 +1,31 @@ +module lilac + + implicit none + + !-------------------------------------------------------------------------- + ! Public interfaces + !-------------------------------------------------------------------------- + public :: lilac_init + public :: lilac_run + public :: lilac_final + +contains + + subroutine lilac_init() + implicit none + print *, "lilac_init()" + flush(6) + + end subroutine lilac_init + + subroutine lilac_run() + implicit none + print *, "lilac_run()" + end subroutine lilac_run + + subroutine lilac_final() + implicit none + print *, "lilac_final()" + end subroutine lilac_final + +end module lilac diff --git a/lilac/lilac/test/simple_driver.f90 b/lilac/lilac/test/simple_driver.f90 deleted file mode 100644 index 4b2d940b58..0000000000 --- a/lilac/lilac/test/simple_driver.f90 +++ /dev/null @@ -1,12 +0,0 @@ -program simple_driver - implicit none - integer :: t - - t = 1 - - if (t == 1) then - write(*,*) "on this line" - else - write(*,*) "but not here" - end if -end program diff --git a/lilac/tests/CMakeLists.txt b/lilac/tests/CMakeLists.txt new file mode 100644 index 0000000000..6361d9e9c2 --- /dev/null +++ b/lilac/tests/CMakeLists.txt @@ -0,0 +1,2 @@ +# Add tests here +add_subdirectory(hello_world) diff --git a/lilac/tests/hello_world/CMakeLists.txt b/lilac/tests/hello_world/CMakeLists.txt new file mode 100644 index 0000000000..0e5fbd44bc --- /dev/null +++ b/lilac/tests/hello_world/CMakeLists.txt @@ -0,0 +1,3 @@ +file(GLOB_RECURSE SOURCES *.f90 *.h) +add_executable("test_hello_world" ${SOURCES} ) +target_link_libraries(lilac) diff --git a/lilac/tests/hello_world/main.f90 b/lilac/tests/hello_world/main.f90 new file mode 100644 index 0000000000..78312075c1 --- /dev/null +++ b/lilac/tests/hello_world/main.f90 @@ -0,0 +1,21 @@ +program main + + ! modules + use ESMF + ! use lilac, ONLY : lilac_init + + implicit none + + ! local variables + integer:: rc + + ! call lilac_init() + ! TODO fix linking with lilac + call ESMF_Initialize(rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT) + + print *, "Hello LILAC World" + + call ESMF_Finalize() + +end program main diff --git a/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt b/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt new file mode 100644 index 0000000000..c7c253746b --- /dev/null +++ b/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt @@ -0,0 +1,4 @@ + +file(GLOB TEST_SOURCES *.f90 *.h) +add_executable(rand_atm_rand_land ${TEST_SOURCES} ) +target_link_libraries(rand_atm_rand_land) diff --git a/lilac/tests/rand_atm_rand_lnd/main.f90 b/lilac/tests/rand_atm_rand_lnd/main.f90 new file mode 100644 index 0000000000..f0c343cc4f --- /dev/null +++ b/lilac/tests/rand_atm_rand_lnd/main.f90 @@ -0,0 +1,5 @@ +program main + + + +end program main From 5d5a8183b77392164fa640674e7a8ca54977c40d Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 17:13:48 -0700 Subject: [PATCH 0213/1973] add travis badge to readme --- lilac/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lilac/README.md b/lilac/README.md index 721cc0f08a..a817ad0649 100644 --- a/lilac/README.md +++ b/lilac/README.md @@ -2,6 +2,7 @@ LILAC, Lightweight Infrastructure for Land Atmosphere Coupling. +[![Build Status](https://travis-ci.org/jhamman/lilac.svg?branch=master)](https://travis-ci.org/jhamman/lilac) Currently working on: - Setting up CI and CMake From e2262420348bc0c89284d61b5000f063967463ec Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 17:16:00 -0700 Subject: [PATCH 0214/1973] fix travis yaml --- lilac/.travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lilac/.travis.yml b/lilac/.travis.yml index 1d52bb5ab3..3c641bfd76 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -6,11 +6,11 @@ matrix: include: - os: linux compiler: gcc - apt: - packages: - - gfortran - - cmake - - cmake-data + apt: + packages: + - gfortran + - cmake + - cmake-data before_install: - ./install_python.sh From 503908fe21b9fdaec6adfc03c438974f1da727d0 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 17:17:42 -0700 Subject: [PATCH 0215/1973] fix install paths --- lilac/.travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lilac/.travis.yml b/lilac/.travis.yml index 3c641bfd76..3a5e7807af 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -13,9 +13,9 @@ matrix: - cmake-data before_install: - - ./install_python.sh - - ./install_esmf.sh - - ./install_pfunit.sh + - ./ci/install_python.sh + - ./ci/install_esmf.sh + - ./ci/install_pfunit.sh install: - cd ${TRAVIS_BUILD_DIR} From 6d98282b9ef1c3bb168f769c549c326df2f6bcbe Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 17:20:50 -0700 Subject: [PATCH 0216/1973] more travis fixes --- lilac/.travis.yml | 2 ++ lilac/ci/install_esmf.sh | 0 lilac/ci/install_pfunit.sh | 0 lilac/ci/install_python.sh | 0 4 files changed, 2 insertions(+) mode change 100644 => 100755 lilac/ci/install_esmf.sh mode change 100644 => 100755 lilac/ci/install_pfunit.sh mode change 100644 => 100755 lilac/ci/install_python.sh diff --git a/lilac/.travis.yml b/lilac/.travis.yml index 3a5e7807af..339b78520c 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -1,6 +1,8 @@ language: cpp sudo: false dist: trusty +notifications: + email: false matrix: include: diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh old mode 100644 new mode 100755 diff --git a/lilac/ci/install_pfunit.sh b/lilac/ci/install_pfunit.sh old mode 100644 new mode 100755 diff --git a/lilac/ci/install_python.sh b/lilac/ci/install_python.sh old mode 100644 new mode 100755 From 8fdce150686ead75a799b8f59499ba08927ba8c3 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 17:26:50 -0700 Subject: [PATCH 0217/1973] add lilac environment name --- lilac/ci/install_python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/ci/install_python.sh b/lilac/ci/install_python.sh index 3e3739f648..b4d4452565 100755 --- a/lilac/ci/install_python.sh +++ b/lilac/ci/install_python.sh @@ -14,7 +14,7 @@ conda clean -tipy conda config --set always_yes yes --set changeps1 no conda --version -conda env create -f ci/environment.yml +conda env create --file ci/environment.yml --name lilac source activate lilac cd ${TRAVIS_BUILD_DIR} From eaf6f3b5a990c4edc13a54b2cdd919c8bbe52621 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 20:10:57 -0700 Subject: [PATCH 0218/1973] no env in conda install --- lilac/ci/install_python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/ci/install_python.sh b/lilac/ci/install_python.sh index b4d4452565..650acee6a4 100755 --- a/lilac/ci/install_python.sh +++ b/lilac/ci/install_python.sh @@ -14,7 +14,7 @@ conda clean -tipy conda config --set always_yes yes --set changeps1 no conda --version -conda env create --file ci/environment.yml --name lilac +conda create --file ci/environment.yml --name lilac source activate lilac cd ${TRAVIS_BUILD_DIR} From 5540ff086a663bc072bd3d607e2cfbc78c1c58d6 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 20:14:40 -0700 Subject: [PATCH 0219/1973] fix conda install location --- lilac/ci/install_python.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/lilac/ci/install_python.sh b/lilac/ci/install_python.sh index 650acee6a4..1e2c2426c3 100755 --- a/lilac/ci/install_python.sh +++ b/lilac/ci/install_python.sh @@ -3,8 +3,6 @@ set -e set -x -cd ${HOME} - # Install miniconda wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ${HOME}/miniconda.sh bash ~/miniconda.sh -b -p $HOME/miniconda From 4425bc6d9eb6908b59b802e7b7aa4a1a7d194e64 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 20:16:32 -0700 Subject: [PATCH 0220/1973] no name --- lilac/ci/environment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/lilac/ci/environment.yml b/lilac/ci/environment.yml index af786a9279..0d0d6a023d 100644 --- a/lilac/ci/environment.yml +++ b/lilac/ci/environment.yml @@ -1,4 +1,3 @@ -name: lilac channels: - conda-forge dependencies: From 75de694b8336ab2ecede807a84d5eb6f1b5bc62b Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 20:22:21 -0700 Subject: [PATCH 0221/1973] back to env --- lilac/ci/install_python.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lilac/ci/install_python.sh b/lilac/ci/install_python.sh index 1e2c2426c3..2a2d2a551f 100755 --- a/lilac/ci/install_python.sh +++ b/lilac/ci/install_python.sh @@ -12,7 +12,8 @@ conda clean -tipy conda config --set always_yes yes --set changeps1 no conda --version -conda create --file ci/environment.yml --name lilac +conda env create -f ci/environment.yml --name lilac + source activate lilac cd ${TRAVIS_BUILD_DIR} From 9e69979b52dba14d7930989ba85aef8703a336d8 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 21:28:24 -0700 Subject: [PATCH 0222/1973] make --- lilac/ci/install_esmf.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index 9356efd2c0..021ecd5bbd 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -9,7 +9,7 @@ cd deps/esmf export ESMF_DIR=$PWD export ESMF_INSTALL_PREFIX=/usr/esmf export ESMFMKFILE=${ESMF_INSTALL_PREFIX}/esmf.mk -gmake -j8 lib -gmake install +make -j8 lib +make install cd ${TRAVIS_BUILD_DIR} From 82b38e9333e7e4a530d73b4c771ec76cfb66989a Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 21:36:18 -0700 Subject: [PATCH 0223/1973] gnu6 for esmf --- lilac/.travis.yml | 4 +++- lilac/ci/install_esmf.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lilac/.travis.yml b/lilac/.travis.yml index 339b78520c..8279b2b2f7 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -10,11 +10,13 @@ matrix: compiler: gcc apt: packages: - - gfortran + - gfortran-6 - cmake - cmake-data before_install: + - export CC=/usr/bin/gcc-6 + - export FC=/usr/bin/gfortran-6 - ./ci/install_python.sh - ./ci/install_esmf.sh - ./ci/install_pfunit.sh diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index 021ecd5bbd..6b089d925b 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -4,12 +4,14 @@ set -x cd ${HOME} +ESMF_COMPILER=$FC + git clone https://git.code.sf.net/p/esmf/esmf deps/esmf cd deps/esmf export ESMF_DIR=$PWD export ESMF_INSTALL_PREFIX=/usr/esmf export ESMFMKFILE=${ESMF_INSTALL_PREFIX}/esmf.mk -make -j8 lib +make -j4 lib make install cd ${TRAVIS_BUILD_DIR} From 47c7cf5128b8f94e54fe3c0e743ff60c619e74c2 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 21:43:13 -0700 Subject: [PATCH 0224/1973] alias gfortran --- lilac/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/lilac/.travis.yml b/lilac/.travis.yml index 8279b2b2f7..03571b7a74 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -17,6 +17,7 @@ matrix: before_install: - export CC=/usr/bin/gcc-6 - export FC=/usr/bin/gfortran-6 + - alias gfortran="/usr/bin/gfortran-6" - ./ci/install_python.sh - ./ci/install_esmf.sh - ./ci/install_pfunit.sh From 095edde28edc3e6866c6d78ce4cff4d9f698838b Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 21:50:32 -0700 Subject: [PATCH 0225/1973] two alias for gfortran --- lilac/ci/install_esmf.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index 6b089d925b..21e4a505d1 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -5,6 +5,7 @@ set -x cd ${HOME} ESMF_COMPILER=$FC +alias gfortran="/usr/bin/gfortran-6" git clone https://git.code.sf.net/p/esmf/esmf deps/esmf cd deps/esmf From 7f698cae0113f1769c9b6b78ee599cc92085daf6 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 22:43:05 -0700 Subject: [PATCH 0226/1973] export esmf compiler --- lilac/ci/install_esmf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index 21e4a505d1..1bda90b47d 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -4,7 +4,7 @@ set -x cd ${HOME} -ESMF_COMPILER=$FC +export ESMF_COMPILER="/usr/bin/gfortran-6" alias gfortran="/usr/bin/gfortran-6" git clone https://git.code.sf.net/p/esmf/esmf deps/esmf From 105f175d7da20c5574f2e77162a735d3caa272d8 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Thu, 2 Aug 2018 22:55:37 -0700 Subject: [PATCH 0227/1973] more compiler env vars --- lilac/ci/install_esmf.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index 1bda90b47d..68e622ae9e 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -4,6 +4,8 @@ set -x cd ${HOME} +export CC=""/usr/bin/gcc-6"" +export FC="/usr/bin/gfortran-6" export ESMF_COMPILER="/usr/bin/gfortran-6" alias gfortran="/usr/bin/gfortran-6" From 6a3a4e435a825195cf0d19c194590f95c20e6dfe Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Fri, 3 Aug 2018 08:33:13 -0700 Subject: [PATCH 0228/1973] default gfortran --- lilac/.travis.yml | 6 ++---- lilac/ci/install_esmf.sh | 10 ++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lilac/.travis.yml b/lilac/.travis.yml index 03571b7a74..e3a280e1b9 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -10,14 +10,12 @@ matrix: compiler: gcc apt: packages: - - gfortran-6 + - gfortran - cmake - cmake-data before_install: - - export CC=/usr/bin/gcc-6 - - export FC=/usr/bin/gfortran-6 - - alias gfortran="/usr/bin/gfortran-6" + - export FC=/usr/bin/gfortran - ./ci/install_python.sh - ./ci/install_esmf.sh - ./ci/install_pfunit.sh diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index 68e622ae9e..fef18a466f 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -4,17 +4,15 @@ set -x cd ${HOME} -export CC=""/usr/bin/gcc-6"" -export FC="/usr/bin/gfortran-6" -export ESMF_COMPILER="/usr/bin/gfortran-6" -alias gfortran="/usr/bin/gfortran-6" +export FC="/usr/bin/gfortran" +export ESMF_COMPILER="/usr/bin/gfortran" git clone https://git.code.sf.net/p/esmf/esmf deps/esmf cd deps/esmf export ESMF_DIR=$PWD -export ESMF_INSTALL_PREFIX=/usr/esmf -export ESMFMKFILE=${ESMF_INSTALL_PREFIX}/esmf.mk +export ESMF_INSTALL_PREFIX=/usr/ make -j4 lib make install +export ESMFMKFILE=${ESMF_INSTALL_PREFIX}/esmf.mk cd ${TRAVIS_BUILD_DIR} From 66efcdac2bb5a5031ddea9f5a2309e52db8b7af2 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Fri, 3 Aug 2018 08:51:37 -0700 Subject: [PATCH 0229/1973] add pfunit submodule --- external/pfunit | 1 + lilac/.gitmodules | 3 +++ 2 files changed, 4 insertions(+) create mode 160000 external/pfunit create mode 100644 lilac/.gitmodules diff --git a/external/pfunit b/external/pfunit new file mode 160000 index 0000000000..14339d668c --- /dev/null +++ b/external/pfunit @@ -0,0 +1 @@ +Subproject commit 14339d668c3f7440c408422dea68d750ee59ad9d diff --git a/lilac/.gitmodules b/lilac/.gitmodules new file mode 100644 index 0000000000..e266cf787f --- /dev/null +++ b/lilac/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/pfunit"] + path = external/pfunit + url = https://github.com/laristra/pfunit.git From ba3c09ba213633a79038028412d95b2acde52703 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Fri, 3 Aug 2018 09:11:23 -0700 Subject: [PATCH 0230/1973] add esmf as external --- external/esmf | 1 + lilac/.gitmodules | 3 +++ 2 files changed, 4 insertions(+) create mode 160000 external/esmf diff --git a/external/esmf b/external/esmf new file mode 160000 index 0000000000..d2761c276d --- /dev/null +++ b/external/esmf @@ -0,0 +1 @@ +Subproject commit d2761c276daf2ccac33193f28e925e974d180309 diff --git a/lilac/.gitmodules b/lilac/.gitmodules index e266cf787f..2f471a14d9 100644 --- a/lilac/.gitmodules +++ b/lilac/.gitmodules @@ -1,3 +1,6 @@ [submodule "external/pfunit"] path = external/pfunit url = https://github.com/laristra/pfunit.git +[submodule "external/esmf"] + path = external/esmf + url = https://git.code.sf.net/p/esmf/esmf From eb317b3a7495359f79e97cce126ee918c9b60f92 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Fri, 17 Aug 2018 17:01:00 -0700 Subject: [PATCH 0231/1973] updates after meeting with team in boulder, still has lots of holes --- lilac/CMakeLists.txt | 80 ++++++- lilac/lilac/atmos_comp.f90 | 39 ++++ lilac/lilac/coupler_mod.f90 | 326 ++++++++++++++++++++++++++ lilac/lilac/esmf_utils.f90 | 271 ++++++++++++++++++++++ lilac/lilac/land_comp.f90 | 1 + lilac/lilac/lilac.f90 | 41 +++- lilac/src/.dir-locals.el | 14 -- lilac/src/lilac-demo-driver.F90 | 283 ---------------------- lilac/src/lilac.F90 | 399 -------------------------------- lilac/src/lilac_api_types.F90 | 43 ---- lilac/src/lilac_constants.F90 | 18 -- lilac/src/stub_comp_mct.F90 | 8 - 12 files changed, 744 insertions(+), 779 deletions(-) create mode 100644 lilac/lilac/atmos_comp.f90 create mode 100644 lilac/lilac/coupler_mod.f90 create mode 100644 lilac/lilac/esmf_utils.f90 create mode 100644 lilac/lilac/land_comp.f90 delete mode 100644 lilac/src/.dir-locals.el delete mode 100644 lilac/src/lilac-demo-driver.F90 delete mode 100644 lilac/src/lilac.F90 delete mode 100644 lilac/src/lilac_api_types.F90 delete mode 100644 lilac/src/lilac_constants.F90 delete mode 100644 lilac/src/stub_comp_mct.F90 diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 3b8e730424..56d348a737 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -4,7 +4,6 @@ project(LILAC Fortran) enable_language(Fortran) # Local CMake modules -list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules) if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(dialect "-ffree-form -std=f2008 -fimplicit-none") @@ -22,13 +21,78 @@ endif() set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") -# link to ESMF -find_package(ESMF) -include_directories(${esmf_INCLUDE_DIR}) -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}\ - ${ESMF_COMPILER_LINE}") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}\ - ${ESMF_LINK_LINE} -g -cpp") +if(DEFINED PFUNIT_INSTALL) + message(STATUS "Manual setup of variable PFUNIT_INSTALL: ${PFUNIT_INSTALL}") + set(PFUNIT_DIR ${PFUNIT_INSTALL}) +else() + include(ExternalProject) + + set(ExternalProjectCMakeArgs + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/external/pfunit + -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} + ) + ExternalProject_Add(pfunit + DOWNLOAD_COMMAND git submodule update + DOWNLOAD_DIR ${PROJECT_SOURCE_DIR} + SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/pfunit + BINARY_DIR ${PROJECT_BINARY_DIR}/external/pfunit-build + STAMP_DIR ${PROJECT_BINARY_DIR}/external/pfunit-stamp + TMP_DIR ${PROJECT_BINARY_DIR}/external/pfunit-tmp + INSTALL_DIR ${PROJECT_BINARY_DIR}/external + CMAKE_ARGS ${ExternalProjectCMakeArgs} + ) + include_directories(${PROJECT_BINARY_DIR}/external/pfunit/mod) + set(PFUNIT_DIR ${PROJECT_BINARY_DIR}/external/pfunit) +endif() + + +if(DEFINED ESMF_INSTALL) + message(STATUS "Manual setup of variable ESMF_INSTALL: ${ESMF_INSTALL}") + set(ESMF_DIR ${ESMF_INSTALL}) + +else() + message(STATUS "We will build ESMF") + include(ExternalProject) + + # set(ENV{ESMFMKFILE} "${PROJECT_BINARY_DIR}/external/esmf/esmf.mk") + + set(ExternalProjectCMakeArgs + ESMF_DIR=${ESMF_DIR} + ESMF_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/external + ESMF_INSTALL_BINDIR=${PROJECT_BINARY_DIR}/bin/ + ESMF_INSTALL_DOCDIR=${PROJECT_BINARY_DIR}/doc/ + ESMF_INSTALL_HEADERDIR=${PROJECT_BINARY_DIR}/include/ + ESMF_INSTALL_LIBDIR=${PROJECT_BINARY_DIR}/lib/ + ESMF_INSTALL_MODDIR=${PROJECT_BINARY_DIR}/mod/ + ) + + ExternalProject_Add(esmf + DOWNLOAD_COMMAND git submodule update + DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/external + SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/esmf + INSTALL_DIR ${PROJECT_BINARY_DIR}/external + BUILD_IN_SOURCE TRUE + CMAKE_ARGS ${ExternalProjectCMakeArgs} + CONFIGURE_COMMAND "" + BUILD_COMMAND make + INSTALL_COMMAND pwd && make install + ) + + # link to ESMF + # find_package(ESMF) + # include_directories(${PROJECT_BINARY_DIR}/include/) + # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}\ ${ESMF_COMPILER_LINE}") + # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") + # TODO figure out how to get these out once ESMF is compiled + set(ESMF_COMPILER_LINE, "-O -m64 -mcmodel=small -ffree-line-length-none -fopenmp -I/Users/jhamman/Dropbox/src/lilac/external/esmf/mod/modO/Darwin.gfortran.64.mpiuni.default -I/Users/jhamman/Dropbox/src/lilac/external/esmf/src/include -ffree-form") + set(ESMF_LINK_LINE, "-m64 -mcmodel=small -fopenmp -L/Users/jhamman/Dropbox/src/lilac/external/esmf/lib/libO/Darwin.gfortran.64.mpiuni.default -L/opt/local/lib/gcc5/gcc/x86_64-apple-darwin17/5.5.0/../../../ -lesmf -lstdc++") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") + + + +endif() add_subdirectory(lilac) add_subdirectory(tests) diff --git a/lilac/lilac/atmos_comp.f90 b/lilac/lilac/atmos_comp.f90 new file mode 100644 index 0000000000..b8ecec4a2d --- /dev/null +++ b/lilac/lilac/atmos_comp.f90 @@ -0,0 +1,39 @@ + +module atmos_comp + + ! ESMF Framework module + use ESMF + implicit none + + public atmos_register + +contains + + + subroutine atmos_register(comp, rc) + type(ESMF_GridComp) :: comp + integer, intent(out) :: rc + + ! Initialize return code + rc = ESMF_SUCCESS + + print *, "Atmosphere Register starting" + + ! Register the callback routines. + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=atmos_init, & + rc=rc) + if (rc/=ESMF_SUCCESS) return ! bail out + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_run, & + rc=rc) + if (rc/=ESMF_SUCCESS) return ! bail out + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=atmos_final, & + rc=rc) + if (rc/=ESMF_SUCCESS) return ! bail out + + print *, "Registered Initialize, Run, and Finalize routines" + print *, "Atmosphere Register returning" + + end subroutine atmos_register + +end module atmos_comp diff --git a/lilac/lilac/coupler_mod.f90 b/lilac/lilac/coupler_mod.f90 new file mode 100644 index 0000000000..36354e7c88 --- /dev/null +++ b/lilac/lilac/coupler_mod.f90 @@ -0,0 +1,326 @@ + module CouplerMod + + use ESMF + + implicit none + + private + + ! Public entry point + public Coupler_register + + contains + + +!------------------------------------------------------------------------------ +!BOPI +! !IROUTINE: Coupler_register - public SetServices entry point + +! !INTERFACE: + subroutine Coupler_register(comp, rc) +! +! !ARGUMENTS: + type(ESMF_CplComp) :: comp + integer, intent(out) :: rc +! +! !DESCRIPTION: +! User-supplied setservices routine. +! +! The arguments are: +! \begin{description} +! \item[comp] +! Component. +! \item[rc] +! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors, +! otherwise {\tt ESMF\_FAILURE}. +! \end{description} +! +!EOPI + + ! because none of the arguments to this subroutine will ever be optional, + ! go ahead and set rc to an initial return code before using it below. + ! (this makes some eager error-checking compilers happy.) + rc = ESMF_FAILURE + + ! Register the callback routines. + + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=coupler_init, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=coupler_run, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=coupler_final, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + print *, "CouplerMod: Registered Initialize, Run, and Finalize routines" + + end subroutine + + +!------------------------------------------------------------------------------ +!BOPI +! !IROUTINE: coupler_init - coupler init routine + +! !INTERFACE: + subroutine coupler_init(comp, importState, exportState, clock, rc) + +! +! !ARGUMENTS: + type(ESMF_CplComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc +! +! !DESCRIPTION: +! User-supplied init routine. +! +! The arguments are: +! \begin{description} +! \item[comp] +! Component. +! \item[importState] +! Nested state object containing import data. +! \item[exportState] +! Nested state object containing export data. +! \item[clock] +! External clock. +! \item[rc] +! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors, +! otherwise {\tt ESMF\_FAILURE}. +! \end{description} +! +!EOPI + +! ! Local variables + type(ESMF_Field) :: src_field, dst_field + type(ESMF_VM) :: vm + character(ESMF_MAXSTR) :: statename + + print *, "Coupler Init starting" + + ! because none of the arguments to this subroutine will ever be optional, + ! go ahead and set rc to an initial return code before using it below. + ! (this makes some eager error-checking compilers happy.) + rc = ESMF_FAILURE + + ! Get VM from coupler component to use in computing redistribution + call ESMF_CplCompGet(comp, vm=vm, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + ! Use placeholder SIE + call ESMF_StateGet(importState, name=statename, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateGet(importState, "SIE", src_field, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateGet(exportState, "SIE", dst_field, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + ! Compute routehandle + ! Since state items are needed by default, mark Fields not needed during coupling + if (trim(statename) .eq. "FlowSolver Feedback") then + call setFieldNeeded(importState, "U", .false., rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call setFieldNeeded(importState, "P", .false., rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call setFieldNeeded(importState, "Q", .false., rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_FieldRedistStore(src_field, dst_field, & + routehandle=fromFlow_rh, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + endif + + if (trim(statename) .eq. "Injection Feedback") then + call setFieldNeeded(importState, "U", .false., rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call setFieldNeeded(importState, "P", .false., rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call setFieldNeeded(importState, "Q", .false., rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call setFieldNeeded(importState, "FLAG", .false., rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_FieldRedistStore(src_field, dst_field, & + routehandle=fromInject_rh, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + endif + + print *, "Coupler Init returning" + + end subroutine coupler_init + + +!------------------------------------------------------------------------------ +!BOPI +! !IROUTINE: coupler_run - coupler run routine + +! !INTERFACE: + subroutine coupler_run(comp, importState, exportState, clock, rc) + +! +! !ARGUMENTS: + type(ESMF_CplComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc +! +! !DESCRIPTION: +! User-supplied run routine. +! +! The arguments are: +! \begin{description} +! \item[comp] +! Component. +! \item[importState] +! Nested state object containing import data. +! \item[exportState] +! Nested state object containing export data. +! \item[clock] +! External clock. +! \item[rc] +! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors, +! otherwise {\tt ESMF\_FAILURE}. +! \end{description} +! +!EOPI + + ! Local variables + type(ESMF_Field) :: srcfield, dstfield + type(ESMF_RouteHandle) :: rh + + character(len=ESMF_MAXSTR) :: statename + + integer :: i, datacount + character(len=ESMF_MAXSTR), dimension(7) :: datanames + + ! none of the arguments to this subroutine will ever be optional, so + ! go ahead and set rc to an initial return code before using it below. + ! (this makes some eager error-checking compilers happy.) + rc = ESMF_FAILURE + + datacount = 7 + datanames(1) = "SIE" + datanames(2) = "U" + datanames(3) = "V" + datanames(4) = "RHO" + datanames(5) = "P" + datanames(6) = "Q" + datanames(7) = "FLAG" + + ! In this case, the coupling is symmetric - you call redist going + ! both ways - so we only care about the coupling direction in order + ! to get the right routehandle selected. + call ESMF_StateGet(importState, name=statename, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + if (trim(statename) .eq. "FlowSolver Feedback") then + rh = fromFlow_rh + else + rh = fromInject_rh + endif + + do i=1, datacount + + ! check isneeded flag here + if (.not. isFieldNeeded(importState, datanames(i), rc=rc)) then + !print *, "skipping field ", trim(datanames(i)), " not needed" + cycle + endif + + !print *, "processing field ", trim(datanames(i)), " as needed" +!BOE +! !DESCRIPTION: +! \subsubsection{Example of Redist Usage} +! +! The following piece of code provides an example of calling the data +! redistribution routine between two Fields in the Coupler Component. +! Unlike regrid, which translates between +! different Grids, redist translates between different DELayouts on +! the same Grid. The first two lines get the Fields from the +! States, each corresponding to a different subcomponent. One is +! an Export State and the other is an Import State. +! +!BOC + call ESMF_StateGet(importState, datanames(i), srcfield, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateGet(exportState, datanames(i), dstfield, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) +!EOC +! +! The redist routine uses information contained in the Fields and the +! Coupler VM object to call the communication routines to move the data. +! Because many Fields may share the same Grid association, the same +! routing information may be needed repeatedly. Route information is +! saved so the precomputed information can be retained. The following +! is an example of a Field redist call: +! +!BOC + call ESMF_FieldRedist(srcfield, dstfield, routehandle=rh, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + +!EOC +!EOE + + enddo + + ! rc has the last error code already + + end subroutine coupler_run + + +!------------------------------------------------------------------------------ +!BOPI +! !IROUTINE: coupler_final - finalization routine + +! !INTERFACE: + subroutine coupler_final(comp, importState, exportState, clock, rc) + +! +! !ARGUMENTS: + type(ESMF_CplComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc +! +! !DESCRIPTION: +! User-supplied finalize routine. +! +! The arguments are: +! \begin{description} +! \item[comp] +! Component. +! \item[importState] +! Nested state object containing import data. +! \item[exportState] +! Nested state object containing export data. +! \item[clock] +! External clock. +! \item[rc] +! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors, +! otherwise {\tt ESMF\_FAILURE}. +! \end{description} +! +!EOPI + + print *, "Coupler Final starting" + + ! none of the arguments to this subroutine will ever be optional, so + ! go ahead and set rc to an initial return code before using it below. + ! (this makes some eager error-checking compilers happy.) + rc = ESMF_FAILURE + + ! Only thing to do here is release redist and route handles + call ESMF_FieldRedistRelease(fromFlow_rh, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_FieldRedistRelease(fromInject_rh, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + rc = ESMF_SUCCESS + + print *, "Coupler Final returning" + + end subroutine coupler_final + + + end module CouplerMod diff --git a/lilac/lilac/esmf_utils.f90 b/lilac/lilac/esmf_utils.f90 new file mode 100644 index 0000000000..4d2a817b41 --- /dev/null +++ b/lilac/lilac/esmf_utils.f90 @@ -0,0 +1,271 @@ +module esmf_utils + +! Wrappers and derived types exposing ESMF components to LILAC + + +#include "ESMF.h" + use ESMF + + implicit none + private + + ! Consider renaming ESMFInfoType (add lilac to name) + type, public :: ESMFInfoType + private + character(len=MAXFILELENGTH) :: name + + type(ESMF_VM) :: vm + type(ESMF_State) :: land_import + type(ESMF_State) :: land_export + type(ESMF_State) :: atmos_import + type(E SMF_State) :: atmos_export + type(ESMF_GridComp) :: atmos_comp + type(ESMF_GridComp) :: land_comp + type(ESMF_CplComp) :: cpl_comp + + contains + procedure, public :: init => init + procedure, public :: run => run + procedure, public :: final => final + + procedure, private :: atmos_register => atmos_register + procedure, private :: land_register => land_register + procedure, private :: cpl_register => cpl_register + end type ESMFInfoType + +contains + + subroutine init(self, name) + implicit none + class(ESMFInfoType), intent(inout) :: self + character(len=MAXVARLENGTH), intent(in) :: name + + ! TODO define subroutines: https://stackoverflow.com/questions/32809769/how-to-pass-subroutine-names-as-arguments-in-fortran + + ! Local variables + integer :: localPet, petCount, localrc, rc=ESMF_SUCCESS, userrc=ESMF_SUCCESS + character(len=ESMF_MAXSTR) :: cname1, cname2 + + print *, "esmf_info%init()" + + self%name = name + + ! Create section + !------------------------------------------------------------------------- + + ! Initialize framework and get back default global VM + + ! only run if not esmf_isintialized() + call ESMF_Initialize(vm=self%vm, defaultlogfilename="lilac.log", logkindflag=ESMF_LOGKIND_MULTI, rc=localrc) + call check(localrc, rc) + + ! Get number of PETs we are running with + call ESMF_VMGet(self%vm, petCount=petCount, localPet=localPet, rc=localrc) + call check(localrc, rc) + + ! Create the 2 model components and a coupler + cname1 = "land" + ! use petList to define land on all PET + self%land_grid = ESMF_GridCompCreate(name=cname1, rc=localrc) + print *, "Created component ", trim(cname1), "rc =", localrc + call check(localrc, rc) + + cname2 = "atmosphere" + ! use petList to define atmosphere on all PET + self%atmos_comp = ESMF_GridCompCreate(name=cname2, rc=localrc) + print *, "Created component ", trim(cname2), "rc =", localrc + call check(localrc, rc) + + cplname = "lilac coupler" + ! no petList means that coupler component runs on all PETs + self%cpl_comp = ESMF_CplCompCreate(name=cplname, rc=localrc) + print *, "Created component ", trim(cplname), ", rc =", localrc + call check(localrc, rc) + + print *, "Comp Creates finished" + + ! Register section + !------------------------------------------------------------------------- + call ESMF_GridCompSetServices(self%atmos_comp, userRoutine=atmos_register, userRc=userrc, rc=localrc) + print *, "atmos SetServices finished, rc= ", localrc + call check(localrc, rc) + call check(userrc, rc) + + call ESMF_GridCompSetServices(self%land_comp, userRoutine=land_register, userRc=userrc, rc=localrc) + print *, "land SetServices finished, rc= ", localrc + call check(localrc, rc) + call check(userrc, rc) + + call ESMF_CplCompSetServices(self%cpl_comp, userRoutine=cpl_register, userRc=userrc, rc=localrc) + print *, "Cpl SetServices finished, rc= ", localrc + call check(localrc, rc) + call check(userrc, rc) + + ! Init section + !------------------------------------------------------------------------- + ! land import/export states + self%land_import = ESMF_StateCreate(name="land import", stateintent=ESMF_STATEINTENT_IMPORT, rc=localrc) + call check(localrc, rc) + self%land_export = ESMF_StateCreate(name="land export", stateintent=ESMF_STATEINTENT_EXPORT, rc=localrc) + call check(localrc, rc) + call ESMF_GridCompInitialize(land, importState=self%land_import, exportState=self%land_export, userRc=userrc, rc=localrc) + call check(localrc, rc) + call check(userrc, rc) + print *, "Land Initialize finished, rc =", localrc + + ! atmosphere import/export state + self%atmos_import = ESMF_StateCreate(name="atmos import", & + stateintent=ESMF_STATEINTENT_IMPORT, rc=localrc) + call check(localrc, rc) + + self%atmos_export = ESMF_StateCreate(name="atmos export", & + stateintent=ESMF_STATEINTENT_EXPORT, rc=localrc) + call check(localrc, rc) + call ESMF_GridCompInitialize(self%atmos_comp, exportState=self%atmos_export, userRc=userrc, rc=localrc) + print *, "Atmosphere Initialize finished, rc =", localrc + call check(localrc, rc) + call check(userrc, rc) + + ! call ESMF_CPLCompInitialize twice (once for each grid comp) + + end subroutine init + + subroutine run(self) + implicit none + integer :: localrc, rc=ESMF_SUCCESS, userrc=ESMF_SUCCESS + print *, "esmf_info%run()" + + ! TODO: need some help on order of imports/exports/runs and whether the land/atm both need import/export states + + ! atmosphere run + ! copy the atmos state and put it into atmos export + call ESMF_GridCompRun(self%atmos_comp, exportState=self%atmos_export, phase=1, userRc=userrc, rc=localrc) + print *, "Atmosphere Run returned, rc =", localrc + call check(localrc, rc) + call check(userrc, rc) + + ! coupler run + call ESMF_CplCompRun(self%cpl_comp, importState=self%atoms_export, exportState=self%land_import, & + userRc=userrc, rc=localrc) + print *, "Coupler Run returned, rc =", localrc + call check(localrc, rc) + call check(userrc, rc) + + ! land run + call ESMF_GridCompRun(self%land_comp, importState=self%land_import, exportState=self%land_export, userRc=userrc, rc=localrc) + print *, "Land Run returned, rc =", localrc + call check(localrc, rc) + call check(userrc, rc) + + ! coupler run + call ESMF_CplCompRun(self%cpl_comp, importState=self%land_export, exportState=self%atmos_import, & + userRc=userrc, rc=localrc) + print *, "Coupler Run returned, rc =", localrc + call check(localrc, rc) + call check(userrc, rc) + + call ESMF_GridCompRun(self%atmos_comp, importState%atmos_import, phase=2, userRc=userrc, rc=localrc) + print *, "Atmosphere Run returned, rc =", localrc + call check(localrc, rc) + call check(userrc, rc) + + end subroutine run + + subroutine final(self) + implicit none + class(ESMFInfoType), intent(inout) :: self + integer :: localrc, rc=ESMF_SUCCESS + + print *, "esmf_info%final()" + + ! Destroy section + call ESMF_GridCompDestroy(self%atmos_comp, rc=localrc) + check(localrc, rc) + call ESMF_GridCompDestroy(self%land_comp, rc=localrc) + check(localrc, rc) + call ESMF_CplCompDestroy(self%cpl_comp, rc=localrc) + check(localrc, rc) + + call ESMF_StateDestroy(self%land_export, rc=localrc) + call ESMF_StateDestroy(self%land_import, rc=localrc) + check(localrc, rc) + call ESMF_StateDestroy(self%atmos_export, rc=localrc) + call ESMF_StateDestroy(self%atmos_import, rc=localrc) + ! do this everywhere + if return_error(localrc, rc) return + + print *, "All Destroy routines done" + + end subroutine final + + subroutine atoms_register(comp, rc) + type(ESMF_GridComp) :: comp ! must not be optional + integer, intent(out) :: rc ! must not be optional + + ! Set the entry points for standard ESMF Component methods + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, & + userRoutine=atoms_init, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & + userRoutine=atoms_copy_atm_to_lilac, phase=1, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & + userRoutine=atoms_copy_lilac_to_atm, phase=2, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, & + userRoutine=atoms_final, rc=rc) + ! TODO: check rcs + + rc = ESMF_SUCCESS + + end subroutine + + subroutine land_register(comp, rc) + type(ESMF_GridComp) :: comp ! must not be optional + integer, intent(out) :: rc ! must not be optional + + ! land_* comes from ctsm esmf cap + + ! Set the entry points for standard ESMF Component methods + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, & + userRoutine=land_init, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & + userRoutine=land_run, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, & + userRoutine=land_final, rc=rc) + ! TODO: check rcs + + rc = ESMF_SUCCESS + + end subroutine + + subroutine cpl_register(comp, rc) + type(ESMF_GridComp) :: comp ! must not be optional + integer, intent(out) :: rc ! must not be optional + + rc = ESMF_FAILURE + + ! Register the callback routines. + + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=coupler_init, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=coupler_run, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=coupler_final, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + print *, "CouplerMod: Registered Initialize, Run, and Finalize routines" + + rc = ESMF_SUCCESS + + end subroutine + + function return_error(rc, returnrc) + ! fight with this later + integer, intent(in) :: rc, returnrc + if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=returnrc)) then + return_error = .true. + else + return_error = .false. + endif + + end function return_error + +end module esmf_utils diff --git a/lilac/lilac/land_comp.f90 b/lilac/lilac/land_comp.f90 new file mode 100644 index 0000000000..1a4baf536d --- /dev/null +++ b/lilac/lilac/land_comp.f90 @@ -0,0 +1 @@ + diff --git a/lilac/lilac/lilac.f90 b/lilac/lilac/lilac.f90 index a7a862e60e..b6393f9164 100644 --- a/lilac/lilac/lilac.f90 +++ b/lilac/lilac/lilac.f90 @@ -1,5 +1,12 @@ module lilac +#include "ESMF.h" + use ESMF + + use atmos_comp, only : atmos_setvm, atmos_register + use land_comp, only : land_setvm, land_register + use coupler_comp, only : usercpl_setvm, usercpl_register + implicit none !-------------------------------------------------------------------------- @@ -9,23 +16,45 @@ module lilac public :: lilac_run public :: lilac_final + type(LilacType), save :: lilac_obj + +contains + + type, public :: LilacType + private + + type(ESMFInfoType) :: esmf_info + + contains + procedure, public :: init => init + procedure, public :: run => run + procedure, public :: final => final + end type LilacType + contains - subroutine lilac_init() + subroutine lilac_init(self) implicit none + print *, "lilac_init()" - flush(6) + + ! Initialize ESMF structures + call self%esmf_info%init("lilac") end subroutine lilac_init - subroutine lilac_run() + subroutine lilac_run(self) implicit none - print *, "lilac_run()" + + call self%esmf_info%run() + end subroutine lilac_run - subroutine lilac_final() + subroutine lilac_final(self) implicit none - print *, "lilac_final()" + + call self%esmf_info%final() + end subroutine lilac_final end module lilac diff --git a/lilac/src/.dir-locals.el b/lilac/src/.dir-locals.el deleted file mode 100644 index 4edf085c03..0000000000 --- a/lilac/src/.dir-locals.el +++ /dev/null @@ -1,14 +0,0 @@ -;;; Directory Local Variables -;;; For more information see (info "(emacs) Directory Variables") - -((f90-mode - (f90-program-indent . 3) - (f90-associate-indent . 3) - (f90-do-indent . 3) - (f90-if-indent . 3) - (f90-type-indent . 3) - (f90-program-indent . 3) - (f90-continuation-indent . 5) - (fill-column . 80) - (indent-tabs-mode))) - diff --git a/lilac/src/lilac-demo-driver.F90 b/lilac/src/lilac-demo-driver.F90 deleted file mode 100644 index 328b869cf8..0000000000 --- a/lilac/src/lilac-demo-driver.F90 +++ /dev/null @@ -1,283 +0,0 @@ -program lilac_demo_driver - - use lnd_comp_mct , only: lnd_init_mct, lnd_run_mct, lnd_final_mct - use seq_flds_mod , only: & - seq_flds_x2l_states, seq_flds_x2l_fluxes, seq_flds_x2l_fields, & - seq_flds_l2x_states, seq_flds_l2x_fluxes, seq_flds_l2x_fields, & - seq_flds_dom_coord, seq_flds_dom_other, seq_flds_dom_fields - use seq_cdata_mod, only: seq_cdata - use seq_infodata_mod, only: seq_infodata_type, seq_infodata_putdata, seq_infodata_getdata - use shr_sys_mod , only: shr_sys_flush, shr_sys_abort - use shr_orb_mod , only: shr_orb_params - use shr_pio_mod , only: shr_pio_init1, shr_pio_init2 - use mct_mod - use ESMF - - implicit none - -#include ! mpi library include file - - !----- Clocks ----- - type(ESMF_Clock) :: driver_clock - type(ESMF_Time) :: CurrTime, StartTime, StopTime - type(ESMF_TimeInterval) :: TimeStep - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar), target :: Calendar - integer :: yy, mm, dd, sec - - !----- MPI/MCT ----- - integer :: mpicom_lilac ! local mpicom - integer :: ID_lilac ! mct ID - integer :: ncomps ! number of separate components for MCT - integer :: ntasks, mytask ! mpicom size and rank - integer :: global_comm ! copy of mpi_comm_world for pio - integer, allocatable :: comp_id(:) ! for pio init2 - logical, allocatable :: comp_iamin(:) ! for pio init2 - character(len=64), allocatable :: comp_name(:) ! for pio init2 - integer, allocatable :: comp_comm(:), comp_comm_iam(:) ! for pio_init2 - - !----- Land Coupling Data ----- - type(seq_cdata) :: cdata ! Input land-model driver data - type(seq_infodata_type), target :: infodata ! infodata type - type(mct_aVect) :: x2l, l2x ! land model import and export states - type(mct_gGrid), target :: dom_lnd ! domain data for clm - type(mct_gsMap), target :: gsmap_lnd ! gsmap data for clm - integer :: orb_iyear ! Orbital - real*8 :: orb_eccen, orb_obliq, orb_mvelp, orb_obliqr, orb_lambm0, orb_mvelpp - character(len=128) :: case_name, case_desc, model_version, hostname, username - character(len=128) :: start_type - logical :: brnch_retain_casename, single_column, atm_aero - real*8 :: scmlat, scmlon - integer :: idx_Sa_z, idx_Sa_u, idx_Sa_v, idx_Sa_tbot, idx_Sa_ptem, & - idx_Sa_shum, idx_Sa_pbot, idx_Faxa_rainc, idx_Faxa_rainl, & - idx_Faxa_snowc, idx_Faxa_snowl, idx_Faxa_lwdn, idx_Faxa_swndr, & - idx_Faxa_swvdr, idx_Faxa_swndf, idx_Faxa_swvdf - - !----- Atm Model ----- - integer :: atm_nx, atm_ny - integer :: gsize, lsize, gstart, gend ! domain decomp info - integer, allocatable :: gindex(:) ! domain decomp info - type(mct_aVect) :: x2l_a ! data for land on atm decomp - type(mct_aVect) :: l2x_a ! data from land on atm decomp - type(mct_gsMap) :: gsmap_atm ! gsmap data for atm - type(mct_rearr) :: rearr_atm2lnd ! rearranger for atm to land - type(mct_rearr) :: rearr_lnd2atm ! rearranger for land to atm - - !----- Other ----- - integer :: n, m ! counter - character(len=128) :: string ! temporary string - integer :: ierr, rc ! local error status - integer :: iunit = 250 ! lilac log unit number - integer :: sunit = 249 ! share log unit number - character(len=*), parameter :: subname = 'lilac_demo_driver' - - logical :: debug = true - !---------------------------------------------- - type(lilac_init_data_t) :: lilac_init_data - type(lilac_clock_data_t) :: lilac_clock_data - class(lilac_t) :: lilac - - ! - ! Initialize the driver - ! - call setup_demo_driver_clock(driver_clock) - - ! - ! Initialize lilac - ! - - ! Hard code values normally supplied by the driver - call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_lilac, ierr) - call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_component, ierr) - call MPI_Comm_Dup(MPI_COMM_WORLD, lilac_init_data%mpicom_global_shared, ierr) - lilac_init_data%output_unit_lilac = 250 - lilac_init_data%output_unit_component = 251 - lilac_init_data%output_unit_global_shared = 252 - - lilac_init_data%component_name = MODEL_NAME_CTSM - - ! FIXME(bja, 2018-02) use namelist so the demo driver can serve as a test driver - lilac_clock_data%calendar_is_leap = .false. - lilac_clock_data%start_year = 2000 - lilac_clock_data%start_month = 1 - lilac_clock_data%start_day = 1 - lilac_clock_data%start_seconds = 0 - lilac_clock_data%stop_year = 2000 - lilac_clock_data%stop_month = 1 - lilac_clock_data%stop_day = 5 - lilac_clock_data%stop_seconds = 0 - lilac_clock_data%timestep_seconds = 3600 - - call lilac%Init(lilac_init_data, lilac_clock_data, debug) - - ! FIXME(bja, 2018-02) don't want to use the cdata structure, but we still - ! need to provide this information to the component?! - - !--- set mpicom and cdata memory - cdata%name = 'cdata_lilac' - cdata%ID = ID_lilac - cdata%mpicom = mpicom_lilac - cdata%dom => dom_lnd - cdata%gsmap => gsmap_lnd - cdata%infodata => infodata - - !--- set case information - case_name = 'lilac' - case_desc = 'lilac with clm' - model_version = 'lilac-v0.1' - hostname = 'undefined' - username = 'undefined' - start_type = 'startup' - brnch_retain_casename = .true. - single_column = .false. - scmlat = 0.0 - scmlon = 0.0 - atm_aero = .true. - call seq_infodata_putData(infodata, case_name=case_name, & - case_desc=case_desc, single_column=single_column, & - scmlat=scmlat, scmlon=scmlon, & - brnch_retain_casename=brnch_retain_casename, & - start_type=start_type, model_version=model_version, & - hostname=hostname, username=username, & - atm_aero=atm_aero ) - - !---------------------------------------------- - !--- lnd_init --- - !---------------------------------------------- - - !---------------------------------------------- - !--- atm and atm/lnd coupling init --- - !---------------------------------------------- - - !---------------------------------------------- - !--- Time Loop --- - !---------------------------------------------- - - call ESMF_ClockGet(driver_clock, currTime=driver_current_time, rc=rc) - do while (driver_current_time < driver_stop_time) - call ESMF_ClockAdvance(driver_clock, rc=rc) - call ESMF_ClockGet(driver_clock, currTime=driver_current_time, rc=rc) - call ESMF_TimeGet(driver_current_time, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,'lilac demo driver ymds=', yy, mm, dd, sec - call shr_sys_flush(iunit) - - ! can manually override the alarms as needed - call ESMF_AlarmRingerOff(EAlarm_rest, rc=rc) - if (mod(dd, 5)==0 .and. sec==0) call ESMF_AlarmRingerOn(EAlarm_rest, rc) - - ! set the coupling data that is sent to the land model, this is on atm decomp - ! this is just sample test data - x2l_a%rAttr(:,:) = 0.0 - x2l_a%rAttr(idx_Sa_z ,:) = 30.0 ! m - x2l_a%rAttr(idx_Sa_u ,:) = 0.0 ! m/s - x2l_a%rAttr(idx_Sa_v ,:) = 0.0 ! m/s - x2l_a%rAttr(idx_Sa_tbot ,:) = 280.0 ! degK - x2l_a%rAttr(idx_Sa_ptem ,:) = 280.0 ! degK - x2l_a%rAttr(idx_Sa_shum ,:) = 0.0004 ! kg/kg - x2l_a%rAttr(idx_Sa_pbot ,:) = 100100.0 ! Pa - x2l_a%rAttr(idx_Faxa_rainc,:) = 4.0e-8 ! kg/m2s - x2l_a%rAttr(idx_Faxa_rainl,:) = 3.0e-8 ! kg/m2s - x2l_a%rAttr(idx_Faxa_snowc,:) = 1.0e-8 ! kg/m2s - x2l_a%rAttr(idx_Faxa_snowl,:) = 2.0e-8 ! kg/m2s - x2l_a%rAttr(idx_Faxa_lwdn ,:) = 200.0 ! W/m2 - x2l_a%rAttr(idx_Faxa_swndr,:) = 100.0 ! W/m2 - x2l_a%rAttr(idx_Faxa_swvdr,:) = 90.0 ! W/m2 - x2l_a%rAttr(idx_Faxa_swndf,:) = 20.0 ! W/m2 - x2l_a%rAttr(idx_Faxa_swvdf,:) = 40.0 ! W/m2 - - ! rearrange data to land decomposition - call mct_rearr_rearrange(x2l_a, x2l, rearr_atm2lnd) - - ! diagnose - write(iunit,*) subname,' x2l fields: ', yy, mm, dd, sec - ! call diag_avect(x2l_a, mpicom_lilac,'x2l_a') - call diag_avect(x2l, mpicom_lilac,'x2l') - - ! run clm - write(iunit,*) subname,' call lnd_run_mct', yy, mm, dd, sec - call lnd_run_mct(Eclock, cdata, x2l, l2x) - - ! rearrange data from land decomposition - call mct_rearr_rearrange(l2x, l2x_a, rearr_lnd2atm) - - ! diagnose - write(iunit,*) subname,' l2x fields: ', yy, mm, dd, sec - call diag_avect(l2x, mpicom_lilac,'l2x') - ! call diag_avect(l2x_a, mpicom_lilac,'l2x_a') - enddo - - lilac%Shutdown() - -contains - !====================================================================== - - SUBROUTINE diag_avect(av, mpicom, comment) - - use seq_infodata_mod - - implicit none - - ! !INPUT/OUTPUT PARAMETERS: - - type(mct_aVect) , intent(in) :: av - integer , intent(in) :: mpicom - character(len=*), intent(in) :: comment - - !--- local --- - integer :: n, k ! counters - integer :: npts, nptsg ! number of local/global pts in AV - integer :: kflds ! number of fields in AV - real*8, pointer :: sumbuf (:) ! sum buffer - real*8, pointer :: sumbufg(:) ! sum buffer reduced - integer :: iam ! pe number - type(mct_string) :: mstring ! mct char type - character(len=128):: itemc ! string converted to char - - !----- formats ----- - character(*), parameter :: subName = '(diag_avect) ' - - !---------------------------------------------------------------- - - npts = mct_aVect_lsize(AV) - kflds = mct_aVect_nRattr(AV) - allocate(sumbuf(kflds), sumbufg(kflds)) - - sumbuf = 0.0 - - do k = 1, kflds - do n = 1, npts - sumbuf(k) = sumbuf(k) + (AV%rAttr(k, n)) - enddo - enddo - - call MPI_REDUCE(sumbuf, sumbufg, kflds, MPI_REAL8, MPI_SUM, 0, mpicom, ierr) - call MPI_COMM_RANK(mpicom, iam, ierr) - - if (iam == 0) then - do k = 1, kflds - call mct_aVect_getRList(mstring, k, AV) - itemc = mct_string_toChar(mstring) - call mct_string_clean(mstring) - write(iunit, 101) trim(comment), k, sumbufg(k), trim(itemc) - enddo - call shr_sys_flush(iunit) - endif - - deallocate(sumbuf, sumbufg) - -101 format('comm_diag ', a, 1x, i3, es26.19, 1x, a) - - end subroutine diag_avect - - !====================================================================== - - subroutine setup_demo_driver_clocks() - - implicit none - - - - end subroutine setup_demo_driver_clocks - -end program lilac_demo_driver - diff --git a/lilac/src/lilac.F90 b/lilac/src/lilac.F90 deleted file mode 100644 index 9f89e97d9f..0000000000 --- a/lilac/src/lilac.F90 +++ /dev/null @@ -1,399 +0,0 @@ -module lilac - ! - ! Public interface to lilac - ! - - implicit none - - private - - integer, parameter :: LILAC_MASTER_PROC = 0 - integer, parameter :: LILAC_NUM_COMPONENTS = 1 - - type, public :: lilac_t - private - character(len=STRING_32) :: component_name - logical :: debug - - integer :: mpicom_lilac - integer :: my_mpi_rank_lilac - integer :: num_mpi_tasks_lilac - integer :: mct_comp_id - - type(ESMF_Clock) :: lilac_clock - type(ESMF_Time) :: start_time - type(ESMF_Time) :: stop_time - type(ESMF_TimeInterval) :: time_step - type(ESMF_Alarm) :: alarm_stop - type(ESMF_Alarm) :: alarm_restart - - contains - ! Public API - procedure, public :: Init => lilac_init - procedure, public :: Shutdown => lilac_shutdown - procudure, public :: AdvanceTime => lilac_advance_time - - ! private initialization routines - procedure, private :: lilac_init_parallel - procedure, private :: lilac_init_logging - procedure, private :: lilac_init_io - procedure, private :: lilac_init_clocks - procedure, private :: lilac_init_fields - procedure, private :: lilac_init_orbit - procedure, private :: lilac_init_land - procedure, private :: lilac_init_coupling - - ! private shudown routines - procedure, private :: lilac_shutdown_land - procedure, private :: lilac_shutdown_parallel - - end type lilac_t - - - -contains - - ! - ! Public API - ! - subroutine lilac_init(this, init_data, clock_data, debug) - - use lilac_api_types, only : lilac_clock_data_t - use mct_mod, only : mct_world_init - - implicit none - - class(lilac_t), intent(inout) :: this - type(lilac_init_data_t), intent(in) :: init_data - type(lilac_clock_data_t), intent(in) :: clock_data - logical, intent(in) :: debug - - this%debug = debug - this%component_name = init_data%component_name - - call this%lilac_init_parallel(init_data%mpicom_lilac, & - init_data%mpicom_component, init_data%mpicom_global_shared) - - call this%lilac_init_logging(init_data%output_unit_lilac, init_data%output_unit_component) - call this%lilac_init_io() - call this%lilac_init_clocks(clock_data) - ! TODO(bja, 2018-03) use init_data%component_name to do some model - ! specific setup, including getting a list of hard coded input and output - ! exchange fields. - call this%lilac_init_fields() - call this%lilac_init_orbit() - call this%lilac_init_land() - call this%lilac_init_coupling() - - end subroutine lilac_init - - subroutine lilac_advance_time(this) - - implicit none - - class(lilac_t), intent(inout) :: this - - end subroutine lilac_advance_time - - subroutine lilac_shutdown(this) - - implicit none - - class(lilac_t), intent(inout) :: this - - if (this%my_mpi_rank_lilac == LILAC_MASTER_PROC) then - write(this%output_unit, *) 'Shutting down lilac interface for component ', this%component_name, ' ...' - end if - - call shr_sys_flush(this%output_unit) - - call this%lilac_shutdown_land() - call this%lilac_shutdown_parallel() - - if (this%my_mpi_rank_lilac == LILAC_MASTER_PROC) then - write(this%output_unit, *) 'lilac shut down for component ', this%component_name, ' complete.' - end if - - end subroutine lilac_shutdown - - ! - ! Private work functions - ! - subroutine lilac_init_parallel(this, mpicom_lilac, mpicom_component, mpicom_global_shared) - ! Initialize parallel components, e.g. MPI, MCT - - implicit none - - class(lilac_t), intent(inout) :: this - - ! should be safe if previously initialized - call MPI_Init(ierr) - - this%mpicom_lilac = mpicom_lilac - this%mpicom_component = mpicom_component - - call MPI_COMM_RANK(this%mpicom_lilac, this%my_lilac_mpi_rank, ierr) - call MPI_COMM_SIZE(this%mpicom_lilac, this%num_lilac_mpi_tasks, ierr) - - ! FIXME(bja, 2018-03) 1 (component | lilac) or two (component & lilac)? - this%mct_num_comps = 1 - this%mct_comp_id = 1 - ! NOTE(bja, 2018-02) MPI_COMM_WORLD should eventually be initialized on - ! the union of the lilac and component communicators! If 2, then need arrays?! - call mct_world_init(this%mct_num_comps, MPI_COMM_WORLD, this%mpicom_lilac, this%mct_comp_id) - - end subroutine lilac_init_parallel - - subroutine lilac_init_logging(this, output_unit_lilac, output_unit_global_shared) - - implicit none - - class(lilac_t), intent(inout) :: this - - character(len=*), parameter :: subname = 'lilac_init_logging' - ! open logfile for lilac - - this%output_unit = output_unit_lilac - - ! FIXME(bja, 2018-03) do we want a single shared log file, or one per rank? - write(log_file_name,'(a,i4.4)') 'lilac.log.', this%my_mpi_rank_lilac - open(this%output_unit, file=trim(log_file_name)) - if (this%my_mpi_rank_lilac == LILAC_MASTER_PROC) then - write(this%output_unit, *) subname, ': Starting lilac interface for component: ', this%component_name - write(this%output_unit, *) subname, ': num lilac tasks = ', this%num_mpi_tasks_lilac - write(this%output_unit, *) subname, ': my mpi rank = ', this%my_mpi_rank_lilac - write(this%output_unit, *) subname, ': mct component ID = ', this%mct_comp_id_lilac - call shr_sys_flush(this%output_unit) - end if - - ! NOTE(bja, 2018-02) these are setting global variables within the shr code! - call shr_file_setLogUnit(output_unit_global_shared) - call shr_file_setLogLevel(1) - - end subroutine lilac_init_logging - - subroutine lilac_init_io(this) - ! NOTE(bja, 2018-02) There is only a *single science component* in each - ! lilac instance. For now assuming just the science component interacts - ! with pio, but lilac may have some parallel data I/O needs. If so it - ! needs to be added to these data structures! - - implicit none - - class(lilac_t), intent(inout) :: this - - ! - call shr_pio_init1(LILAC_NUM_COMPONENTS, 'pio_in', this%mpicom_lilac) - allocate( & - comp_id(LILAC_NUM_COMPONENTS), & - comp_name(LILAC_NUM_COMPONENTS), & - comp_iamin(LILAC_NUM_COMPONENTS), & - comp_comm(LILAC_NUM_COMPONENTS), & - comp_comm_iam(LILAC_NUM_COMPONENTS)) - - index = 1 - comp_id(index) = 1 - comp_name(index) = MODEL_NAME_LILAC // '_' // trim(this%component_name) - comp_iamin(index) = .true. - comp_comm(index) = this%mpicom_lilac - comp_comm_iam(index) = this%my_mpi_rank_lilac - - ! TODO(bja, 2018-03) Never have more than one science component, remove loop? - do n = 1, LILAC_NUM_COMPONENTS - index = index + n - comp_id(index) = ID_component - comp_name(index) = this%component_name - comp_iamin(index) = .true. - comp_comm(index) = this%mpicom_component - comp_comm_iam(index) = mytask ! FIXME(bja, 2018-02) when land and lilac are on different comms?? - enddo - - call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) - - deallocate(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) - - end subroutine lilac_init_io - - subroutine lilac_init_clocks(this, clock_data) - - use ESMF - - implicit none - - class(lilac_t), intent(inout) :: this - type(lilac_clock_data_t), intent(in) :: clock_data - - type(ESMF_Calendar), target :: calendar ! FIXME(bja, 2018-02) does not need to be freed?! - integer :: cal_kind_flag - integer :: year, month, day, sec - - if (clock_data%calendar_is_leap == .false.) then - cal_kind_flag = ESMF_CALKIND_NOLEAP - else - ! FIXME(bja, 2018-03) not implemented error! ESMF_CALKIND_GREGORIAN? - end if - - if (ESMF_IsInitialized() /= .true.) then - ! NOTE(bja, 2018-03) allocates and operates on global data! - call ESMF_Initialize(rc=rc) - end if - - calendar = ESMF_CalendarCreate( name='lilac', calkindflag=cal_kind_flag, rc=rc ) - call ESMF_TimeSet(this%start_time, yy=clock_data%start_year, mm=clock_data%start_month, & - dd=clock_data%start_day, s=clock_data%start_seconds, calendar=calendar, rc=rc) - - call ESMF_TimeSet(this%stop_time , yy=clock_data%stop_year, mm=clock_data%stop_month, & - dd=clock_data%stop_day, s=clock_data%stop_seconds, calendar=calendar, rc=rc) - - call ESMF_TimeIntervalSet(this%time_step, s=clock_data%time_step_seconds, rc=rc) - - this%lilac_clock = ESMF_ClockCreate(name='lilac_clock', & - TimeStep=this%time_step, startTime=this%start_time, & - RefTime=this%start_time, stopTime=this%stop_time, rc=rc) - - this%alarm_stop = ESMF_AlarmCreate(name='alarm_stop' , & - clock=this%lilac_clock, ringTime=this%stop_time, rc=rc) - this%alarm_rest = ESMF_AlarmCreate(name='alarm_restart', & - clock=this%lilac_clock, ringTime=this%stop_time, rc=rc) - - if (this%debug .and. this%my_mpi_rank_lilac == LILAC_MASTER_PROC) then - call ESMF_TimeGet( start_time, yy=year, mm=month, dd=day, s=sec, rc=rc ) - write(this%output_unit, '(1x,2a,4i6)') subname,': start time ymds=', year, month, day, sec - call ESMF_TimeGet( stop_time, yy=year, mm=month, dd=day, s=sec, rc=rc ) - write(this%output_unit, '(1x,2a,4i6)') subname,': stop time ymds=', year, month, day, sec - call shr_sys_flush(this%output_unit) - end if - - end subroutine lilac_init_clocks - - subroutine lilac_init_fields(this) - ! Set coupling fields. - - implicit none - - class(lilac_t), intent(inout) :: this - - ! FIXME(bja, 2018-02) this should be dynamically created at runtime - ! instead of hard coded! - - seq_flds_dom_coord='lat:lon' - seq_flds_dom_other='area:aream:mask:frac' - seq_flds_dom_fields=trim(seq_flds_dom_coord)//':'//trim(seq_flds_dom_other) - - seq_flds_x2l_states= 'Sa_z:Sa_u:Sa_v:Sa_tbot:Sa_ptem:Sa_shum:Sa_pbot:Sg_icemask:Sg_icemask_coupled_fluxes' - seq_flds_x2l_fluxes= 'Faxa_rainc:Faxa_rainl:Faxa_snowc:Faxa_snowl:Faxa_lwdn:Faxa_swndr:Faxa_swvdr:Faxa_swndf:Faxa_swvdf:Faxa_bcphidry:Faxa_bcphodry:Faxa_bcphiwet:Faxa_ocphidry:Faxa_ocphodry:Faxa_ocphiwet:Faxa_dstwet1:Faxa_dstwet2:Faxa_dstwet3:Faxa_dstwet4:Faxa_dstdry1:Faxa_dstdry2:Faxa_dstdry3:Faxa_dstdry4:Flrr_flood:Flrr_volr' - seq_flds_x2l_fields= trim(seq_flds_x2l_states)//':'//trim(seq_flds_x2l_fluxes) - - seq_flds_l2x_states= 'Sl_avsdr:Sl_anidr:Sl_avsdf:Sl_anidf:Sl_tref:Sl_qref:Sl_t:Sl_fv:Sl_ram1:Sl_snowh:Sl_u10' - seq_flds_l2x_fluxes= 'Fall_swnet:Fall_taux:Fall_tauy:Fall_lat:Fall_sen:Fall_lwup:Fall_evap:Fall_flxdst1:Fall_flxdst2:Fall_flxdst3:Fall_flxdst4:Flrl_rofl:Flrl_rofi:Fall_voc001:Fall_voc002:Fall_voc003:Fall_voc004:Fall_voc005:Fall_voc006:Fall_voc007:Fall_voc008' - seq_flds_l2x_fields= trim(seq_flds_l2x_states)//':'//trim(seq_flds_l2x_fluxes) - - - end subroutine lilac_init_fields - - subroutine lilac_init_orbit(this) - - implicit none - - class(lilac_t), intent(inout) :: this - - !--- set orbital params - orb_iyear = 1990 - call shr_orb_params(orb_iyear, orb_eccen, orb_obliq, orb_mvelp, & - orb_obliqr, orb_lambm0, orb_mvelpp, .true.) - call seq_infodata_putData(infodata, orb_eccen=orb_eccen, orb_mvelpp=orb_mvelpp, & - orb_lambm0=orb_lambm0, orb_obliqr=orb_obliqr ) - - - end subroutine lilac_init_orbit - - subroutine lilac_init_land(this) - - implicit none - - write(this%output_unit,*) subname,' calling lnd_init_mct' - call shr_sys_flush(this%output_unit) - call lnd_init_mct(Eclock, cdata, x2l, l2x) - - call diag_avect(l2x, mpicom_lilac,'l2x_init') - - idx_Sa_z = mct_avect_indexra(x2l,'Sa_z') - idx_Sa_u = mct_avect_indexra(x2l,'Sa_u') - idx_Sa_v = mct_avect_indexra(x2l,'Sa_v') - idx_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') - idx_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') - idx_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') - idx_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') - idx_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') - idx_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') - idx_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') - idx_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') - idx_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') - idx_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') - idx_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') - idx_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') - idx_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') - - end subroutine lilac_init_land - - subroutine lilac_init_coupling(this) - - implicit none - - class(lilac_t), intent(inout) :: this - - ! set atm grid size to land grid size in this example. for a real - ! atmosphere model, the atm and land grids should agree at the outset. - call seq_infodata_getData(infodata, lnd_nx=atm_nx, lnd_ny=atm_ny) - - ! atm decomp - gstart = ((mytask * atm_nx * atm_ny) / ntasks) + 1 - gend = (((mytask+1) * atm_nx * atm_ny) / ntasks) - lsize = gend - gstart + 1 - gsize = atm_nx * atm_ny - allocate(gindex(lsize)) - do n = gstart, gend - m = n-gstart+1 - gindex(m) = n - end do - write(this%output_unit,'(1x,2a,5i8)') subname,' atm decomp = ', mytask, gsize, lsize, gstart, gend - - ! initialize land grid on atm decomp - call mct_gsMap_init(gsmap_atm, gindex, mpicom_lilac, ID_lilac, lsize, gsize) - deallocate(gindex) - - ! initialize rearrangers between atm and land decomps - call mct_rearr_init(gsmap_atm, gsmap_lnd, mpicom_lilac, rearr_atm2lnd) - call mct_rearr_init(gsmap_lnd, gsmap_atm, mpicom_lilac, rearr_lnd2atm) - - ! initialize atm avects from land avects with atm lsize - call mct_avect_init(x2l_a, x2l, lsize) - call mct_avect_zero(x2l_a) - call mct_avect_init(l2x_a, l2x, lsize) - call mct_avect_zero(l2x_a) - - end subroutine lilac_init_coupling - - subroutine lilac_shutdown_land(this) - - implicit none - - class(lilac_t), intent(inout) :: this - - write(this%output_unit, *) 'lilac shutting down component ', this%comp_name - call lnd_final_mct(Eclock, cdata, x2l, l2x) - - end subroutine lilac_shutdown_land - - subroutine lilac_shutdown_parallel(this) - - implicit none - - class(lilac_t), intent(inout) :: this - - ! FIXME(bja, 2018-02) need to determine if it is our responsibility to shutdown mpi or the caller!? - ! call MPI_Finalize(ierr) - - end subroutine lilac_shutdown_parallel - -end module lilac diff --git a/lilac/src/lilac_api_types.F90 b/lilac/src/lilac_api_types.F90 deleted file mode 100644 index da66aefe04..0000000000 --- a/lilac/src/lilac_api_types.F90 +++ /dev/null @@ -1,43 +0,0 @@ -module lilac_api_types - - implicit none - - use lilac_constants, only : STRING_128 - -contains - - type :: lilac_init_data_t - character(len=STRING_32) :: component_name - integer :: mpicom_lilac - integer :: mpicom_component - integer :: output_unit_lilac - integer :: output_unit_global_shared ! this should be the same for all instances of lilac! - integer :: output_unit_component - - end type lilac_init_data_t - - type :: lilac_clock_data_t - logical :: calendar_is_leap - integer :: start_year - integer :: start_month - integer :: start_day - integer :: start_second ! seconds since midnight - - integer :: stop_year - integer :: stop_month - integer :: stop_day - integer :: stop_second ! seconds since midnight - - integer :: time_step_seconds - end type lilac_clock_data_t - - - type :: lilac_exchange_fields_t - character(len=STRING_128) :: long_name - character(len=STRING_128) :: short_name - character(len=STRING_128) :: field_name - character(len=STRING_128) :: units - integer :: field_type - end type lilac_exchange_fields_t - -end module lilac_api_types diff --git a/lilac/src/lilac_constants.F90 b/lilac/src/lilac_constants.F90 deleted file mode 100644 index d9e6442206..0000000000 --- a/lilac/src/lilac_constants.F90 +++ /dev/null @@ -1,18 +0,0 @@ -module lilac_constants - - implicit none - -contains - - integer, parameter :: STRING_128 = 128 - integer, parameter :: STRING_32 = 32 - - integer, parameter :: FIELD_TYPE_INTEGER = 0 - integer, parameter :: FIELD_TYPE_REAL_8BYTE = 1 - - ! known models names - character(len=*), parameter :: MODEL_NAME_LILAC = 'lilac' - character(len=*), parameter :: MODEL_NAME_CTSM = 'ctsm' - character(len=*), parameter :: MODEL_NAME_TEST = 'test' - -end module lilac_constants diff --git a/lilac/src/stub_comp_mct.F90 b/lilac/src/stub_comp_mct.F90 deleted file mode 100644 index de792d6c58..0000000000 --- a/lilac/src/stub_comp_mct.F90 +++ /dev/null @@ -1,8 +0,0 @@ -module stub_comp_mct - - implicit none - -contains - - -end module stub_comp_mct From 457378e4c043adaf3508892be513c3bed3c24936 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 30 Aug 2018 09:06:19 -0600 Subject: [PATCH 0232/1973] add num_iter --- src/biogeophys/BareGroundFluxesMod.F90 | 5 ++++- src/biogeophys/CanopyFluxesMod.F90 | 28 +++++++++++++++++--------- src/biogeophys/FrictionVelocityMod.F90 | 7 ++++++- src/biogeophys/SoilFluxesMod.F90 | 1 - 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index ee51f495f5..779b4df565 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -210,6 +210,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & z0hg_col => frictionvel_inst%z0hg_col , & ! Output: [real(r8) (:) ] roughness length, sensible heat [m] z0qg_col => frictionvel_inst%z0qg_col , & ! Output: [real(r8) (:) ] roughness length, latent heat [m] ram1 => frictionvel_inst%ram1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) + num_iter => frictionvel_inst%num_iter_patch , & ! Output: [real(r8) (:) ] number of iterations htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of evaporation (/sublimation) [J/kg] qflx_ev_snow => waterfluxbulk_inst%qflx_ev_snow_patch , & ! Output: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] @@ -273,7 +274,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & ! Initialize Monin-Obukhov length and wind speed call MoninObukIni(ur(p), thv(c), dthv, zldis(p), z0mg_patch(p), um(p), obu(p)) - + num_iter(p) = 0 end do ! Perform stability iteration @@ -311,6 +312,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & obu(p) = zldis(p)/zeta end do + num_iter(p) = iter + end do ! end stability iteration do f = 1, num_noexposedvegp diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index fcc87db2b7..4540b4b2ef 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -633,6 +633,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, obu => frictionvel_inst%obu_patch , & ! Output: [real(r8) (:) ] Monin-Obukhov length [m] zeta => frictionvel_inst%zeta_patch , & ! Output: [real(r8) (:) ] dimensionless stability parameter vpd => frictionvel_inst%vpd_patch , & ! Output: [real(r8) (:) ] vapor pressure deficit [Pa] + num_iter => frictionvel_inst%num_iter_patch , & ! Output: [real(r8) (:) ] number of iterations begp => bounds%begp , & endp => bounds%endp , & @@ -722,10 +723,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! fraction of stem receiving incoming radiation fstem(p) = (esai(p))/(elai(p)+esai(p)) - fstem(p) = k_vert * fstem(p) - if(.not.use_biomass_heat_storage) then - fstem(p) = 0._r8 - endif + ! when elai = 0, do not multiply by k_vert (i.e. fstem = 1) + if(elai(p) > 0._r8) fstem(p) = k_vert * fstem(p) ! leaf and stem surface area sa_leaf(p) = elai(p) @@ -735,16 +734,20 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, sa_stem(p) = params_inst%nstem(patch%itype(p))*(htop(p)*shr_const_pi*params_inst%dbh(patch%itype(p))) ! adjust for departure of cylindrical stem model sa_stem(p) = k_cyl_area * sa_stem(p) - if(.not.use_biomass_heat_storage) then - sa_stem(p) = 0._r8 - endif -! do not calculate separate leaf/stem heat capacity for grasses + + ! do not calculate separate leaf/stem heat capacity for grasses if(patch%itype(p) > 11) then fstem(p) = 0.0 sa_stem(p) = 0.0 endif -! internal longwave fluxes between leaf and stem + if(.not.use_biomass_heat_storage) then + fstem(p) = 0._r8 + sa_stem(p) = 0._r8 + sa_leaf(p) = (elai(p)+esai(p)) + endif + + ! internal longwave fluxes between leaf and stem ! surface area term must be equal, remainder cancels ! (use same area of interaction i.e. ignore leaf <-> leaf) sa_internal(p) = min(sa_leaf(p),sa_stem(p)) @@ -757,6 +760,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) cp_veg(p) = (0.25_r8 * max(0.01_r8,elai(p))) * (1400._r8 + (params_inst%fbw(patch%itype(p))/(1.-params_inst%fbw(patch%itype(p))))*4188._r8) +! use non-zero, but small, heat capacity + if(.not.use_biomass_heat_storage) then + cp_veg(p) = 1.e-3_r8 + endif + carea_stem = shr_const_pi * (params_inst%dbh(patch%itype(p))*0.5)**2 ! cp-stem will have units J/k/ground_area (here assuming 1 stem/m2) @@ -921,6 +929,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Initialize Monin-Obukhov length and wind speed call MoninObukIni(ur(p), thv(c), dthv(p), zldis(p), z0mv(p), um(p), obu(p)) + num_iter(p) = 0 end do @@ -1339,6 +1348,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Test for convergence itlef = itlef+1 + num_iter(p) = itlef if (itlef > itmin) then do f = 1, fn p = filterp(f) diff --git a/src/biogeophys/FrictionVelocityMod.F90 b/src/biogeophys/FrictionVelocityMod.F90 index 0b32c39c0a..0111962a48 100644 --- a/src/biogeophys/FrictionVelocityMod.F90 +++ b/src/biogeophys/FrictionVelocityMod.F90 @@ -65,7 +65,7 @@ module FrictionVelocityMod real(r8), pointer, public :: obu_patch (:) ! patch Monin-Obukhov length [m] real(r8), pointer, public :: zeta_patch (:) ! patch dimensionless stability parameter real(r8), pointer, public :: vpd_patch (:) ! patch vapor pressure deficit [Pa] - + real(r8), pointer, public :: num_iter_patch (:) ! patch number of iterations contains @@ -155,6 +155,7 @@ subroutine InitAllocate(this, bounds) allocate(this%obu_patch (begp:endp)) ; this%obu_patch (:) = nan allocate(this%zeta_patch (begp:endp)) ; this%zeta_patch (:) = nan allocate(this%vpd_patch (begp:endp)) ; this%vpd_patch (:) = nan + allocate(this%num_iter_patch (begp:endp)) ; this%num_iter_patch (:) = nan end subroutine InitAllocate @@ -274,6 +275,10 @@ subroutine InitHistory(this, bounds) call hist_addfld1d (fname='VPD', units='Pa', & avgflag='A', long_name='vpd', & ptr_patch=this%vpd_patch, default='inactive') + this%num_iter_patch(begp:endp) = spval + call hist_addfld1d (fname='num_iter', units='unitless', & + avgflag='A', long_name='number of iterations', & + ptr_patch=this%num_iter_patch, default='inactive') this%rb1_patch(begp:endp) = spval call hist_addfld1d (fname='RB', units='s/m', & avgflag='A', long_name='leaf boundary resistance', & diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index 71a792f5f0..2c1a328d3e 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -311,7 +311,6 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! Total fluxes (vegetation + ground) -! eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_stem(p) + eflx_sh_grnd(p) eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_grnd(p) if (.not. lun%urbpoi(l)) eflx_sh_tot(p) = eflx_sh_tot(p) + eflx_sh_stem(p) qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) From e43883be96310b580cf055b47712ac887c0dbfdb Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 30 Aug 2018 09:08:54 -0600 Subject: [PATCH 0233/1973] add namelist broadcast --- src/biogeophys/BareGroundFluxesMod.F90 | 1 - src/biogeophys/CanopyFluxesMod.F90 | 6 +++--- src/biogeophys/PhotosynthesisMod.F90 | 2 +- src/biogeophys/TemperatureType.F90 | 5 +++++ src/main/clm_varctl.F90 | 6 ++++++ src/main/controlMod.F90 | 4 ++++ 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index 6db74bea1c..f2c6f25285 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -273,7 +273,6 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & ! Initialize Monin-Obukhov length and wind speed call MoninObukIni(ur(p), thv(c), dthv, zldis(p), z0mg_patch(p), um(p), obu(p)) - num_iter(p) = 0 end do diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index ed3807e848..c35fea896d 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -930,7 +930,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Initialize Monin-Obukhov length and wind speed call MoninObukIni(ur(p), thv(c), dthv(p), zldis(p), z0mv(p), um(p), obu(p)) - num_iter(p) = 0 end do @@ -1140,7 +1139,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, end if ! should be the same expression used in Photosynthesis/getqflx - efpot = forc_rho(c)*(elai(p))/rb(p)*(qsatl(p)-qaf(p)) + efpot = forc_rho(c)*elai(p)/rb(p)*(qsatl(p)-qaf(p)) ! When the hydraulic stress parameterization is active calculate rpp ! but not transpiration @@ -1260,7 +1259,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! result in an imbalance in "hvap*qflx_evap_veg" and ! "efe + dc2*wtgaq*qsatdt_veg" - efpot = forc_rho(c)*(elai(p))/rb(p) & + efpot = forc_rho(c)*elai(p)/rb(p) & *(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) qflx_evap_veg(p) = rpp*efpot @@ -1326,6 +1325,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, zeta(p) = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) if (zeta(p) >= 0._r8) then !stable + ! remove stability cap when biomass heat storage is active if(use_biomass_heat_storage) then zeta(p) = min(100._r8,max(zeta(p),0.01_r8)) else diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 71f6961a60..1b72acfc30 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -4835,7 +4835,7 @@ subroutine getqflx(p,c,gb_mol,gs_mol_sun,gs_mol_sha,qflx_sun,qflx_sha,qsatl,qaf, cf = forc_pbot(c)/(rgas*1.e-3_r8*tgcm(p))*1.e6_r8 ! gb->gbmol conversion factor - wtl = (elai(p))*gb_mol + wtl = elai(p)*gb_mol efpot = forc_rho(c)*wtl*(qsatl-qaf) if (havegs) then diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 6e1b90a93d..dba102412f 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -887,6 +887,11 @@ subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildt long_name='vegetation temperature', units='K', & interpinic_flag='interp', readvar=readvar, data=this%t_veg_patch) + call restartvar(ncid=ncid, flag=flag, varname='T_STEM', xtype=ncd_double, & + dim1name='pft', & + long_name='stem temperature', units='K', & + interpinic_flag='interp', readvar=readvar, data=this%t_stem_patch) + call restartvar(ncid=ncid, flag=flag, varname='TH2OSFC', xtype=ncd_double, & dim1name='column', & long_name='surface water temperature', units='K', & diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 938155c5dd..20de195db7 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -237,6 +237,12 @@ module clm_varctl logical, public :: use_lai_streams = .false. ! true => use lai streams in SatellitePhenologyMod.F90 + !---------------------------------------------------------- + ! biomass heat storage switch + !---------------------------------------------------------- + + logical, public :: use_biomass_heat_storage = .false. ! true => include biomass heat storage in canopy energy budget + !---------------------------------------------------------- ! bedrock / soil depth switch !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index ae9c2fcafe..2f682b5523 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -238,6 +238,8 @@ subroutine control_init( ) namelist /clm_inparm/ use_bedrock + namelist /clm_inparm/ use_biomass_heat_storage + namelist /clm_inparm/ use_hydrstress namelist /clm_inparm/ use_dynroot @@ -660,6 +662,8 @@ subroutine control_spmd() call mpi_bcast (use_bedrock, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_biomass_heat_storage, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_hydrstress, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_dynroot, 1, MPI_LOGICAL, 0, mpicom, ier) From 702363f681b695057c92c7a1aff98c8c73ce3df5 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 10 Sep 2018 12:21:03 -0700 Subject: [PATCH 0234/1973] move to dockerfile, builds deps and should run on travis now --- external/esmf | 2 +- lilac/.dockerignore | 328 +++++++++++++++++++++++++++++++++++++ lilac/.travis.yml | 28 +--- lilac/Dockerfile | 19 +++ lilac/ci/environment.yml | 6 +- lilac/ci/install_esmf.sh | 10 +- lilac/ci/install_pfunit.sh | 9 +- lilac/ci/install_python.sh | 11 +- 8 files changed, 366 insertions(+), 47 deletions(-) create mode 100644 lilac/.dockerignore create mode 100644 lilac/Dockerfile diff --git a/external/esmf b/external/esmf index d2761c276d..3a9c142262 160000 --- a/external/esmf +++ b/external/esmf @@ -1 +1 @@ -Subproject commit d2761c276daf2ccac33193f28e925e974d180309 +Subproject commit 3a9c142262b247189abd8dbca0d63e6dbb3a8207 diff --git a/lilac/.dockerignore b/lilac/.dockerignore new file mode 100644 index 0000000000..96c67bd53f --- /dev/null +++ b/lilac/.dockerignore @@ -0,0 +1,328 @@ +# Created by .ignore support plugin (hsz.mobi) + +### Vim template +# swap +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +# session +Session.vim +# temporary +.netrwhist +*~ + +# auto-generated tag files +tags + +### Cpp template +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### CMake template +CMakeCache.txt +CMakeFiles +CMakeScripts +Makefile +cmake_install.cmake +install_manifest.txt +CTestTestfile.cmake + +### Emacs template +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile### VirtualEnv template +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +.Python +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +.venv +pip-selfcheck.json + +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +### C template +# Object files +*.o +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su + +### Windows template +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### KDevelop4 template +*.kdev4 +.kdev4/ + +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# IPython Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# dotenv +.env + +# virtualenv +venv/ +ENV/ + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject + +### Xcode template +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xccheckout +*.xcscmblueprint + +### NodeJS template +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git +node_modules + diff --git a/lilac/.travis.yml b/lilac/.travis.yml index e3a280e1b9..5f8d66aede 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -1,34 +1,20 @@ language: cpp -sudo: false +sudo: required dist: trusty notifications: email: false -matrix: - include: - - os: linux - compiler: gcc - apt: - packages: - - gfortran - - cmake - - cmake-data +services: + - docker before_install: - - export FC=/usr/bin/gfortran - - ./ci/install_python.sh - - ./ci/install_esmf.sh - - ./ci/install_pfunit.sh + - docker version install: - - cd ${TRAVIS_BUILD_DIR} - - mkdir -p build && cd build - - cmake .. - - make + - docker build -t lilac . before_script: - - echo "before script" + - docker images script: - - cd ${TRAVIS_BUILD_DIR} - - ./build/prog + - docker run -t lilac diff --git a/lilac/Dockerfile b/lilac/Dockerfile new file mode 100644 index 0000000000..ae9bd09913 --- /dev/null +++ b/lilac/Dockerfile @@ -0,0 +1,19 @@ +FROM centos:latest +LABEL description="LILAC development environment" + + +RUN yum install -y curl; yum upgrade -y; yum update -y; yum clean all +RUN yum -y install wget bzip2 gcc gcc-c++ gcc-gfortran mpich make + +ADD ./ /usr/src/lilac +RUN cd /usr/src/lilac && mkdir -p build + +WORKDIR /usr/src/lilac +ENV PATH /usr/local/miniconda/bin:$PATH +RUN /usr/src/lilac/ci/install_python.sh +RUN /usr/src/lilac/ci/install_esmf.sh +RUN /usr/src/lilac/ci/install_pfunit.sh + +# RUN mkdir -p /usr/src/lilac/build && cd /usr/src/lilac/build && cmake .. + +CMD /bin/bash -c "ctest" diff --git a/lilac/ci/environment.yml b/lilac/ci/environment.yml index 0d0d6a023d..735c333293 100644 --- a/lilac/ci/environment.yml +++ b/lilac/ci/environment.yml @@ -2,8 +2,4 @@ channels: - conda-forge dependencies: - python=3.6 - - xarray - - esmpy - - cmake - - pip: - - cpp-coveralls + - cmake>=3 diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index fef18a466f..95c89cef7e 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -2,17 +2,15 @@ set -e set -x -cd ${HOME} +cd external/esmf -export FC="/usr/bin/gfortran" -export ESMF_COMPILER="/usr/bin/gfortran" +export FC="gfortran" +export ESMF_COMPILER="gfortran" -git clone https://git.code.sf.net/p/esmf/esmf deps/esmf -cd deps/esmf export ESMF_DIR=$PWD export ESMF_INSTALL_PREFIX=/usr/ make -j4 lib make install export ESMFMKFILE=${ESMF_INSTALL_PREFIX}/esmf.mk -cd ${TRAVIS_BUILD_DIR} +cd - \ No newline at end of file diff --git a/lilac/ci/install_pfunit.sh b/lilac/ci/install_pfunit.sh index 84b5918c12..9a2aff43e3 100755 --- a/lilac/ci/install_pfunit.sh +++ b/lilac/ci/install_pfunit.sh @@ -3,18 +3,15 @@ set -e set -x -cd ${HOME} - -git clone https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git ${HOME}/deps/pfunit -cd deps/pfunit +cd external/pfunit # set environemnt variables export F90=gfortran export F90_VENDOR=GNU -mkdir build +mkdir -p build cd build cmake .. make install INSTALL_DIR=/usr -cd ${TRAVIS_BUILD_DIR} +cd - diff --git a/lilac/ci/install_python.sh b/lilac/ci/install_python.sh index 2a2d2a551f..02a15e043c 100755 --- a/lilac/ci/install_python.sh +++ b/lilac/ci/install_python.sh @@ -4,16 +4,11 @@ set -e set -x # Install miniconda -wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ${HOME}/miniconda.sh -bash ~/miniconda.sh -b -p $HOME/miniconda -export PATH="$HOME/miniconda/bin:$PATH" +wget --quiet http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /usr/src/miniconda.sh +bash /usr/src/miniconda.sh -b -p /usr/local/miniconda conda update conda --yes conda clean -tipy conda config --set always_yes yes --set changeps1 no conda --version -conda env create -f ci/environment.yml --name lilac - -source activate lilac - -cd ${TRAVIS_BUILD_DIR} +conda install -c conda-forge cmake>=3 From 69f6b3e7eda97279e85df9182d8c8ec6b738844a Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 10 Sep 2018 17:35:12 -0700 Subject: [PATCH 0235/1973] cleanup and move to docker-compose --- lilac/.dockerignore | 1 + lilac/.gitignore | 2 + lilac/.travis.yml | 5 +- lilac/CMakeLists.txt | 78 ++----------------- lilac/Dockerfile | 30 ++++--- lilac/ci/build_and_test_lilac.sh | 16 ++++ lilac/ci/install_esmf.sh | 6 +- lilac/ci/install_pfunit.sh | 4 +- .../{Modules => CMakeModules}/FindESMF.cmake | 29 +++---- lilac/docker-compose.yml | 10 +++ 10 files changed, 78 insertions(+), 103 deletions(-) create mode 100755 lilac/ci/build_and_test_lilac.sh rename lilac/cmake/{Modules => CMakeModules}/FindESMF.cmake (74%) create mode 100644 lilac/docker-compose.yml diff --git a/lilac/.dockerignore b/lilac/.dockerignore index 96c67bd53f..2fc5d54e03 100644 --- a/lilac/.dockerignore +++ b/lilac/.dockerignore @@ -326,3 +326,4 @@ build/Release # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git node_modules +build/ \ No newline at end of file diff --git a/lilac/.gitignore b/lilac/.gitignore index 411de5d96e..21537a4ee9 100644 --- a/lilac/.gitignore +++ b/lilac/.gitignore @@ -12,3 +12,5 @@ components/ # generated python files *.pyc + +build/ diff --git a/lilac/.travis.yml b/lilac/.travis.yml index 5f8d66aede..40f2c1981a 100644 --- a/lilac/.travis.yml +++ b/lilac/.travis.yml @@ -9,12 +9,13 @@ services: before_install: - docker version + - docker-compose version install: - - docker build -t lilac . + - docker-compose build lilac before_script: - - docker images + - docker-compose images script: - docker run -t lilac diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 56d348a737..9d94ba5afe 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 2.8.12.1) project(LILAC Fortran) enable_language(Fortran) +set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") + +find_package (ESMF) + # Local CMake modules if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") @@ -21,78 +25,8 @@ endif() set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") -if(DEFINED PFUNIT_INSTALL) - message(STATUS "Manual setup of variable PFUNIT_INSTALL: ${PFUNIT_INSTALL}") - set(PFUNIT_DIR ${PFUNIT_INSTALL}) -else() - include(ExternalProject) - - set(ExternalProjectCMakeArgs - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/external/pfunit - -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} - ) - ExternalProject_Add(pfunit - DOWNLOAD_COMMAND git submodule update - DOWNLOAD_DIR ${PROJECT_SOURCE_DIR} - SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/pfunit - BINARY_DIR ${PROJECT_BINARY_DIR}/external/pfunit-build - STAMP_DIR ${PROJECT_BINARY_DIR}/external/pfunit-stamp - TMP_DIR ${PROJECT_BINARY_DIR}/external/pfunit-tmp - INSTALL_DIR ${PROJECT_BINARY_DIR}/external - CMAKE_ARGS ${ExternalProjectCMakeArgs} - ) - include_directories(${PROJECT_BINARY_DIR}/external/pfunit/mod) - set(PFUNIT_DIR ${PROJECT_BINARY_DIR}/external/pfunit) -endif() - - -if(DEFINED ESMF_INSTALL) - message(STATUS "Manual setup of variable ESMF_INSTALL: ${ESMF_INSTALL}") - set(ESMF_DIR ${ESMF_INSTALL}) - -else() - message(STATUS "We will build ESMF") - include(ExternalProject) - - # set(ENV{ESMFMKFILE} "${PROJECT_BINARY_DIR}/external/esmf/esmf.mk") - - set(ExternalProjectCMakeArgs - ESMF_DIR=${ESMF_DIR} - ESMF_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/external - ESMF_INSTALL_BINDIR=${PROJECT_BINARY_DIR}/bin/ - ESMF_INSTALL_DOCDIR=${PROJECT_BINARY_DIR}/doc/ - ESMF_INSTALL_HEADERDIR=${PROJECT_BINARY_DIR}/include/ - ESMF_INSTALL_LIBDIR=${PROJECT_BINARY_DIR}/lib/ - ESMF_INSTALL_MODDIR=${PROJECT_BINARY_DIR}/mod/ - ) - - ExternalProject_Add(esmf - DOWNLOAD_COMMAND git submodule update - DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/external - SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/esmf - INSTALL_DIR ${PROJECT_BINARY_DIR}/external - BUILD_IN_SOURCE TRUE - CMAKE_ARGS ${ExternalProjectCMakeArgs} - CONFIGURE_COMMAND "" - BUILD_COMMAND make - INSTALL_COMMAND pwd && make install - ) - - # link to ESMF - # find_package(ESMF) - # include_directories(${PROJECT_BINARY_DIR}/include/) - # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}\ ${ESMF_COMPILER_LINE}") - # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") - # TODO figure out how to get these out once ESMF is compiled - set(ESMF_COMPILER_LINE, "-O -m64 -mcmodel=small -ffree-line-length-none -fopenmp -I/Users/jhamman/Dropbox/src/lilac/external/esmf/mod/modO/Darwin.gfortran.64.mpiuni.default -I/Users/jhamman/Dropbox/src/lilac/external/esmf/src/include -ffree-form") - set(ESMF_LINK_LINE, "-m64 -mcmodel=small -fopenmp -L/Users/jhamman/Dropbox/src/lilac/external/esmf/lib/libO/Darwin.gfortran.64.mpiuni.default -L/opt/local/lib/gcc5/gcc/x86_64-apple-darwin17/5.5.0/../../../ -lesmf -lstdc++") - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") - - - -endif() +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}\ ${ESMF_COMPILER_LINE}") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") add_subdirectory(lilac) add_subdirectory(tests) diff --git a/lilac/Dockerfile b/lilac/Dockerfile index ae9bd09913..ef7b9610b0 100644 --- a/lilac/Dockerfile +++ b/lilac/Dockerfile @@ -1,19 +1,29 @@ FROM centos:latest LABEL description="LILAC development environment" - RUN yum install -y curl; yum upgrade -y; yum update -y; yum clean all -RUN yum -y install wget bzip2 gcc gcc-c++ gcc-gfortran mpich make +RUN yum -y install wget bzip2 gcc gcc-c++ gcc-gfortran mpich make git + +WORKDIR /usr/src/lilac/ + +RUN mkdir -p external +RUN mkdir -p ci -ADD ./ /usr/src/lilac -RUN cd /usr/src/lilac && mkdir -p build +COPY external/esmf external/esmf +COPY external/pfunit external/pfunit +COPY ci/* ci/ -WORKDIR /usr/src/lilac +# Install some remaining dependencies ENV PATH /usr/local/miniconda/bin:$PATH -RUN /usr/src/lilac/ci/install_python.sh -RUN /usr/src/lilac/ci/install_esmf.sh -RUN /usr/src/lilac/ci/install_pfunit.sh +RUN ./ci/install_python.sh -# RUN mkdir -p /usr/src/lilac/build && cd /usr/src/lilac/build && cmake .. +# Install ESMF +# TODO: what's up with the .../lib/lib0/... maybe move this somewhere more logical? +RUN pwd +RUN ls $PWD +RUN ./ci/install_esmf.sh +ENV ESMF_CONFIG_FILE /usr/lib/libO/Linux.gfortran.64.mpiuni.default/esmf.mk -CMD /bin/bash -c "ctest" +# # Install PFUNIT +RUN ./ci/install_pfunit.sh +ENV PFUNIT_INSTALL /usr/pfunit diff --git a/lilac/ci/build_and_test_lilac.sh b/lilac/ci/build_and_test_lilac.sh new file mode 100755 index 0000000000..ce8b993ae4 --- /dev/null +++ b/lilac/ci/build_and_test_lilac.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e +set -x + +echo "building lilac" + +# build lilac +mkdir -p /lilac/build +cd /lilac/build && cmake .. +make -j 4 + +echo "done building lilac, time to run the tests..." + +# run test suite +ctest \ No newline at end of file diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index 95c89cef7e..d14f747771 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -2,15 +2,15 @@ set -e set -x -cd external/esmf +cd ./external/esmf export FC="gfortran" export ESMF_COMPILER="gfortran" export ESMF_DIR=$PWD -export ESMF_INSTALL_PREFIX=/usr/ +export ESMF_INSTALL_PREFIX=/usr make -j4 lib make install -export ESMFMKFILE=${ESMF_INSTALL_PREFIX}/esmf.mk +export ESMFMKFILE=/usr/lib/libO/Linux.gfortran.64.mpiuni.default/esmf.mk cd - \ No newline at end of file diff --git a/lilac/ci/install_pfunit.sh b/lilac/ci/install_pfunit.sh index 9a2aff43e3..9290ab7306 100755 --- a/lilac/ci/install_pfunit.sh +++ b/lilac/ci/install_pfunit.sh @@ -3,7 +3,7 @@ set -e set -x -cd external/pfunit +cd ./external/pfunit # set environemnt variables export F90=gfortran @@ -12,6 +12,6 @@ export F90_VENDOR=GNU mkdir -p build cd build cmake .. -make install INSTALL_DIR=/usr +make install INSTALL_DIR=/usr/pfunit cd - diff --git a/lilac/cmake/Modules/FindESMF.cmake b/lilac/cmake/CMakeModules/FindESMF.cmake similarity index 74% rename from lilac/cmake/Modules/FindESMF.cmake rename to lilac/cmake/CMakeModules/FindESMF.cmake index ba50c7a141..b8fb622ee8 100644 --- a/lilac/cmake/Modules/FindESMF.cmake +++ b/lilac/cmake/CMakeModules/FindESMF.cmake @@ -1,24 +1,24 @@ -# +# # Author: Ali Samii - The University of Texas at Austin # # Distributed under GPL2. For more info refer to: # https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html # -# +# # FindESMF # -------- -# +# # This script tries to find the ESMF library. You have to define # the path to esmf.mk file in your installation directory. # # There are plans to extend this script to find ESMF automatically, # but until then, you should set the environment variable # -# ESMFMKFILE = /path/to/esmf.mk +# ESMF_CONFIG_FILE = /path/to/esmf.mk # # in your installation directory. The output will be # -# ESMF_LINK_LINE : All the libraries and link line stuff +# ESMF_LINK_LINE : All the libraries and link line stuff # ESMF_COMPILER_LINE : All the compiler flags and include dirs # # @@ -27,28 +27,28 @@ string(ASCII 27 Esc) # Checking if ESMF exists -if (NOT DEFINED ENV{ESMFMKFILE} AND NOT DEFINED ESMFMKFILE) +if (NOT DEFINED ENV{ESMF_CONFIG_FILE} AND NOT DEFINED ESMF_CONFIG_FILE) message (FATAL_ERROR "\n${Esc}[1;31m!! Error: You need ESMF library to \ run this program. please set the environment \ - variable ESMFMKFILE to point to esmf.mk in \ + variable ESMF_CONFIG_FILE to point to esmf.mk in \ your ESMF installation directory. \ Try something like: ${Esc}[m\ - export ESMFMKFILE=/path/to/esmf.mk && cmake ${CMAKE_SOURCE_DIR}") + export ESMF_CONFIG_FILE=/path/to/esmf.mk && cmake ${CMAKE_SOURCE_DIR}") endif () -if (NOT EXISTS $ENV{ESMFMKFILE} AND NOT EXISTS ${ESMFMKFILE}) +if (NOT EXISTS $ENV{ESMF_CONFIG_FILE} AND NOT EXISTS ${ESMF_CONFIG_FILE}) message (FATAL_ERROR "${Esc}[1;31m Error: esmf.mk file is not found at \ - ${ESMFMKFILE} ${Esc}[m") + ${ESMF_CONFIG_FILE} ${Esc}[m") else () message ("+>${Esc}[1;32m The config file for ESMF library is found.${Esc}[m") endif () -if (DEFINED ENV{ESMFMKFILE}) - set(ESMFMKFILE $ENV{ESMFMKFILE} CACHE STRING "") +if (DEFINED ENV{ESMF_CONFIG_FILE}) + set(ESMF_CONFIG_FILE $ENV{ESMF_CONFIG_FILE} CACHE STRING "") endif () -set(ESMFMKFILE ${ESMFMKFILE} CACHE STRING "") +set(ESMF_CONFIG_FILE ${ESMF_CONFIG_FILE} CACHE STRING "") -file(STRINGS "${ESMFMKFILE}" all_vars) +file(STRINGS "${ESMF_CONFIG_FILE}" all_vars) foreach(str ${all_vars}) string(REGEX MATCH "^[^#]" def ${str}) if (def) @@ -68,3 +68,4 @@ set (ESMF_LINK_LINE "${ESMF_F90LINKOPTS} \ set (ESMF_COMPILER_LINE "${ESMF_F90COMPILEOPTS} \ ${ESMF_F90COMPILEPATHS} \ ${ESMF_F90COMPILEFREENOCPP}") + diff --git a/lilac/docker-compose.yml b/lilac/docker-compose.yml new file mode 100644 index 0000000000..422b0bc607 --- /dev/null +++ b/lilac/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' + +services: + lilac: + build: . + container_name: lilac + volumes: + - .:/lilac + command: /lilac/ci/build_and_test_lilac.sh + From bc96784d64dcf019e6ab09ecf26383dffeb80f74 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 10 Sep 2018 23:07:23 -0700 Subject: [PATCH 0236/1973] boiler plat docs --- lilac/docs/Makefile | 20 ++++++ lilac/docs/conf.py | 164 +++++++++++++++++++++++++++++++++++++++++++ lilac/docs/index.rst | 24 +++++++ 3 files changed, 208 insertions(+) create mode 100644 lilac/docs/Makefile create mode 100644 lilac/docs/conf.py create mode 100644 lilac/docs/index.rst diff --git a/lilac/docs/Makefile b/lilac/docs/Makefile new file mode 100644 index 0000000000..0e382f9883 --- /dev/null +++ b/lilac/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = lilac +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/lilac/docs/conf.py b/lilac/docs/conf.py new file mode 100644 index 0000000000..767f7287b1 --- /dev/null +++ b/lilac/docs/conf.py @@ -0,0 +1,164 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/stable/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'lilac' +copyright = '2018, Joseph Hamman' +author = 'Joseph Hamman' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '' + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.intersphinx', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path . +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'lilacdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'lilac.tex', 'lilac Documentation', + 'Joseph Hamman', 'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'lilac', 'lilac Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'lilac', 'lilac Documentation', + author, 'lilac', 'One line description of project.', + 'Miscellaneous'), +] + + +# -- Extension configuration ------------------------------------------------- + +# -- Options for intersphinx extension --------------------------------------- + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None} \ No newline at end of file diff --git a/lilac/docs/index.rst b/lilac/docs/index.rst new file mode 100644 index 0000000000..4549b0c639 --- /dev/null +++ b/lilac/docs/index.rst @@ -0,0 +1,24 @@ +.. lilac documentation master file, created by + sphinx-quickstart on Mon Sep 10 22:59:54 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to lilac's documentation! +================================= + +LILAC, Lightweight Infrastructure for Land Atmosphere Coupling. + +More coming soon. + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` From ec59330c32844c10e8458c308802d8ccfca02d17 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 10 Sep 2018 23:08:25 -0700 Subject: [PATCH 0237/1973] add docs badge --- lilac/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lilac/README.md b/lilac/README.md index a817ad0649..b3315ab04a 100644 --- a/lilac/README.md +++ b/lilac/README.md @@ -3,6 +3,7 @@ LILAC, Lightweight Infrastructure for Land Atmosphere Coupling. [![Build Status](https://travis-ci.org/jhamman/lilac.svg?branch=master)](https://travis-ci.org/jhamman/lilac) +[![Documentation Status](https://readthedocs.org/projects/ctsm-lilac/badge/?version=latest)](https://ctsm-lilac.readthedocs.io/en/latest/?badge=latest) Currently working on: - Setting up CI and CMake From eba309c7136587ab0a42441f4676d10034736579 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Wed, 26 Sep 2018 12:55:09 -0700 Subject: [PATCH 0238/1973] more build and doc updates --- lilac/CMakeLists.txt | 10 +- lilac/Dockerfile | 2 +- lilac/ci/build_and_test_lilac.sh | 5 +- lilac/ci/code_format.sh | 11 + lilac/ci/emacs-fortran-formating-script.lisp | 46 +++ lilac/ci/install_esmf.sh | 15 +- lilac/cmake/CMakeModules/FindESMF.cmake | 6 +- lilac/docs/api.rst | 14 + lilac/docs/index.rst | 41 ++- lilac/lilac/atmos_comp.f90 | 39 --- lilac/lilac/coupler_mod.f90 | 326 ------------------- lilac/lilac/esmf_utils.f90 | 28 +- lilac/lilac/land_comp.f90 | 1 - lilac/lilac/lilac.f90 | 13 +- 14 files changed, 153 insertions(+), 404 deletions(-) create mode 100755 lilac/ci/code_format.sh create mode 100644 lilac/ci/emacs-fortran-formating-script.lisp create mode 100644 lilac/docs/api.rst delete mode 100644 lilac/lilac/atmos_comp.f90 delete mode 100644 lilac/lilac/coupler_mod.f90 delete mode 100644 lilac/lilac/land_comp.f90 diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 9d94ba5afe..8e7c0cf87a 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -3,9 +3,10 @@ cmake_minimum_required(VERSION 2.8.12.1) project(LILAC Fortran) enable_language(Fortran) -set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") -find_package (ESMF) +find_package(MPI REQUIRED) +find_package(ESMF REQUIRED) # Local CMake modules @@ -25,8 +26,11 @@ endif() set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}\ ${ESMF_COMPILER_LINE}") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include") + +message("CMAKE_Fortran_FLAGS:" ${CMAKE_Fortran_FLAGS}) add_subdirectory(lilac) add_subdirectory(tests) diff --git a/lilac/Dockerfile b/lilac/Dockerfile index ef7b9610b0..c7b5923a04 100644 --- a/lilac/Dockerfile +++ b/lilac/Dockerfile @@ -2,7 +2,7 @@ FROM centos:latest LABEL description="LILAC development environment" RUN yum install -y curl; yum upgrade -y; yum update -y; yum clean all -RUN yum -y install wget bzip2 gcc gcc-c++ gcc-gfortran mpich make git +RUN yum -y install wget bzip2 gcc gcc-c++ gcc-gfortran mpich-devel make git WORKDIR /usr/src/lilac/ diff --git a/lilac/ci/build_and_test_lilac.sh b/lilac/ci/build_and_test_lilac.sh index ce8b993ae4..176478a5c6 100755 --- a/lilac/ci/build_and_test_lilac.sh +++ b/lilac/ci/build_and_test_lilac.sh @@ -7,8 +7,11 @@ echo "building lilac" # build lilac mkdir -p /lilac/build + +export CMAKE_PREFIX_PATH=/usr/lib64/mpich/bin + cd /lilac/build && cmake .. -make -j 4 +make # -j 4 echo "done building lilac, time to run the tests..." diff --git a/lilac/ci/code_format.sh b/lilac/ci/code_format.sh new file mode 100755 index 0000000000..828b0e229a --- /dev/null +++ b/lilac/ci/code_format.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Run emacs/list on all Fortran source files +format_fortran () { + echo "Parsing $1 as language Fortran" + emacs --batch -l ./emacs-fortran-formating-script.lisp \ + -f f90-batch-indent-region $1 +} +export -f format_fortran +find ../lilac/ -iregex ".*\.F[0-9]*" -exec bash -c 'format_fortran "$0"' {} \; +find ../tests/ -iregex ".*\.F[0-9]*" -exec bash -c 'format_fortran "$0"' {} \; diff --git a/lilac/ci/emacs-fortran-formating-script.lisp b/lilac/ci/emacs-fortran-formating-script.lisp new file mode 100644 index 0000000000..99ed3f3981 --- /dev/null +++ b/lilac/ci/emacs-fortran-formating-script.lisp @@ -0,0 +1,46 @@ +(defun f90-batch-indent-region () + "Run `f90-batch-beatify-region' on the specified filename. +Use this from the command line, with `-batch'; +it won't work in an interactive Emacs. +For example, invoke \"emacs -batch -l ~/.emacs-batch-f90-indent -f f90-batch-indent-region file.f\"" + (if (not noninteractive) + (error "`f90-batch-indent-region' is to be used only with -batch")) + (let ((make-backup-files nil) + (version-control nil) + (auto-save-default nil) + (find-file-run-dired nil) + (kept-old-versions 259259) + (kept-new-versions 259259)) + (let ((error 0) + file + (files ())) + (while command-line-args-left + (setq file (expand-file-name (car command-line-args-left))) + (cond ((not (file-exists-p file)) + (message ">> %s does not exist!" file) + (setq error 1 + command-line-args-left (cdr command-line-args-left))) + ((file-directory-p file) + (setq command-line-args-left + (nconc (directory-files file) + (cdr command-line-args-left)))) + (t + (setq files (cons file files) + command-line-args-left (cdr command-line-args-left))))) + (while files + (setq file (car files) + files (cdr files)) + (condition-case err + (progn + (if buffer-file-name (kill-buffer (current-buffer))) + (find-file file) + (buffer-disable-undo (current-buffer)) + (set-buffer-modified-p nil) + (f90-mode) + (message (file-name-nondirectory buffer-file-name)) + ; compute indentation of first + ; line + (f90-indent-subprogram) + (f90-downcase-keywords) + (save-buffer) +)))))) diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index d14f747771..0f39bae1e1 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -5,12 +5,21 @@ set -x cd ./external/esmf export FC="gfortran" -export ESMF_COMPILER="gfortran" + +# export PATH="/usr/lib64/mpich/bin/":${PATH} export ESMF_DIR=$PWD -export ESMF_INSTALL_PREFIX=/usr +export ESMF_COMM="mpiuni" +export ESMF_COMPILER="gfortran" +export ESMF_INSTALL_PREFIX="/usr/local" +export ESMF_INSTALL_LIBDIR="/usr/local/lib" +export ESMF_INSTALL_MODDIR="/usr/local/mod" +export ESMF_INSTALL_BINDIR="/usr/local/bin" +export ESMF_INSTALL_DOCDIR="/usr/local/doc" +export ESMFMKFILE="${ESMF_INSTALL_LIBDIR}/esmf.mk" + make -j4 lib make install -export ESMFMKFILE=/usr/lib/libO/Linux.gfortran.64.mpiuni.default/esmf.mk +make install check cd - \ No newline at end of file diff --git a/lilac/cmake/CMakeModules/FindESMF.cmake b/lilac/cmake/CMakeModules/FindESMF.cmake index b8fb622ee8..39b00447c1 100644 --- a/lilac/cmake/CMakeModules/FindESMF.cmake +++ b/lilac/cmake/CMakeModules/FindESMF.cmake @@ -36,7 +36,7 @@ if (NOT DEFINED ENV{ESMF_CONFIG_FILE} AND NOT DEFINED ESMF_CONFIG_FILE) export ESMF_CONFIG_FILE=/path/to/esmf.mk && cmake ${CMAKE_SOURCE_DIR}") endif () -if (NOT EXISTS $ENV{ESMF_CONFIG_FILE} AND NOT EXISTS ${ESMF_CONFIG_FILE}) +if (NOT EXISTS ENV{ESMF_CONFIG_FILE} AND NOT EXISTS ${ESMF_CONFIG_FILE}) message (FATAL_ERROR "${Esc}[1;31m Error: esmf.mk file is not found at \ ${ESMF_CONFIG_FILE} ${Esc}[m") else () @@ -44,10 +44,12 @@ else () endif () if (DEFINED ENV{ESMF_CONFIG_FILE}) - set(ESMF_CONFIG_FILE $ENV{ESMF_CONFIG_FILE} CACHE STRING "") + set(ESMF_CONFIG_FILE ENV{ESMF_CONFIG_FILE} CACHE STRING "") endif () set(ESMF_CONFIG_FILE ${ESMF_CONFIG_FILE} CACHE STRING "") +message ("Parsing ESMF_CONFIG_FILE: " ${ESMF_CONFIG_FILE}) + file(STRINGS "${ESMF_CONFIG_FILE}" all_vars) foreach(str ${all_vars}) string(REGEX MATCH "^[^#]" def ${str}) diff --git a/lilac/docs/api.rst b/lilac/docs/api.rst new file mode 100644 index 0000000000..6859fd3e1a --- /dev/null +++ b/lilac/docs/api.rst @@ -0,0 +1,14 @@ +LILAC API +========= + +LILAC provides a high-level API (in Fortran) for coupling to CTSM. +LILAC was built using the assumption that the Atmosphere model +component in each LILAC application would opperate as the "driver". + +The atmosphere component will need to call each of the following subroutines: + + * `lilac_init` + * `lilac_run` + * `lilac_final` + +TODO: fill in this section as the api comes together. diff --git a/lilac/docs/index.rst b/lilac/docs/index.rst index 4549b0c639..f6c4a09751 100644 --- a/lilac/docs/index.rst +++ b/lilac/docs/index.rst @@ -1,12 +1,39 @@ -.. lilac documentation master file, created by - sphinx-quickstart on Mon Sep 10 22:59:54 2018. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. +LILAC: Lightweight Infrastructure for Land Atmosphere Coupling +============================================================== + +LILAC is a new coupling interface for the Community Terrestrial Systems Model +(CTSM). It provides a high-level Fortran API for coupling CTSM to atmospheric +models such as the Weather Research and Forecast (WRF) model. LILAC makes +extensive use of the Earth System Modeling Framework (ESMF). + +Building LILAC +-------------- + +LILAC can be build using CMake. + + $ cd /lilac/build && cmake .. + $ make + +For development and testing purposes, LILAC can also be built using a +`docker-compose` script. + + $ docker-compose build + # docker-compose run + +Testing LILAC +------------- + +LILAC includes a full test suite including unit tests and a number of +simplified coupled model tests. To run these tests, simply run the `ctest` +command: + + $ ctest + +Note, if you are using the docker-compose development, the `docker-compose run` +command will build and run LILAC automatically. + -Welcome to lilac's documentation! -================================= -LILAC, Lightweight Infrastructure for Land Atmosphere Coupling. More coming soon. diff --git a/lilac/lilac/atmos_comp.f90 b/lilac/lilac/atmos_comp.f90 deleted file mode 100644 index b8ecec4a2d..0000000000 --- a/lilac/lilac/atmos_comp.f90 +++ /dev/null @@ -1,39 +0,0 @@ - -module atmos_comp - - ! ESMF Framework module - use ESMF - implicit none - - public atmos_register - -contains - - - subroutine atmos_register(comp, rc) - type(ESMF_GridComp) :: comp - integer, intent(out) :: rc - - ! Initialize return code - rc = ESMF_SUCCESS - - print *, "Atmosphere Register starting" - - ! Register the callback routines. - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=atmos_init, & - rc=rc) - if (rc/=ESMF_SUCCESS) return ! bail out - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_run, & - rc=rc) - if (rc/=ESMF_SUCCESS) return ! bail out - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=atmos_final, & - rc=rc) - if (rc/=ESMF_SUCCESS) return ! bail out - - print *, "Registered Initialize, Run, and Finalize routines" - print *, "Atmosphere Register returning" - - end subroutine atmos_register - -end module atmos_comp diff --git a/lilac/lilac/coupler_mod.f90 b/lilac/lilac/coupler_mod.f90 deleted file mode 100644 index 36354e7c88..0000000000 --- a/lilac/lilac/coupler_mod.f90 +++ /dev/null @@ -1,326 +0,0 @@ - module CouplerMod - - use ESMF - - implicit none - - private - - ! Public entry point - public Coupler_register - - contains - - -!------------------------------------------------------------------------------ -!BOPI -! !IROUTINE: Coupler_register - public SetServices entry point - -! !INTERFACE: - subroutine Coupler_register(comp, rc) -! -! !ARGUMENTS: - type(ESMF_CplComp) :: comp - integer, intent(out) :: rc -! -! !DESCRIPTION: -! User-supplied setservices routine. -! -! The arguments are: -! \begin{description} -! \item[comp] -! Component. -! \item[rc] -! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors, -! otherwise {\tt ESMF\_FAILURE}. -! \end{description} -! -!EOPI - - ! because none of the arguments to this subroutine will ever be optional, - ! go ahead and set rc to an initial return code before using it below. - ! (this makes some eager error-checking compilers happy.) - rc = ESMF_FAILURE - - ! Register the callback routines. - - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=coupler_init, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=coupler_run, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=coupler_final, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - print *, "CouplerMod: Registered Initialize, Run, and Finalize routines" - - end subroutine - - -!------------------------------------------------------------------------------ -!BOPI -! !IROUTINE: coupler_init - coupler init routine - -! !INTERFACE: - subroutine coupler_init(comp, importState, exportState, clock, rc) - -! -! !ARGUMENTS: - type(ESMF_CplComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc -! -! !DESCRIPTION: -! User-supplied init routine. -! -! The arguments are: -! \begin{description} -! \item[comp] -! Component. -! \item[importState] -! Nested state object containing import data. -! \item[exportState] -! Nested state object containing export data. -! \item[clock] -! External clock. -! \item[rc] -! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors, -! otherwise {\tt ESMF\_FAILURE}. -! \end{description} -! -!EOPI - -! ! Local variables - type(ESMF_Field) :: src_field, dst_field - type(ESMF_VM) :: vm - character(ESMF_MAXSTR) :: statename - - print *, "Coupler Init starting" - - ! because none of the arguments to this subroutine will ever be optional, - ! go ahead and set rc to an initial return code before using it below. - ! (this makes some eager error-checking compilers happy.) - rc = ESMF_FAILURE - - ! Get VM from coupler component to use in computing redistribution - call ESMF_CplCompGet(comp, vm=vm, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - ! Use placeholder SIE - call ESMF_StateGet(importState, name=statename, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateGet(importState, "SIE", src_field, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateGet(exportState, "SIE", dst_field, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - ! Compute routehandle - ! Since state items are needed by default, mark Fields not needed during coupling - if (trim(statename) .eq. "FlowSolver Feedback") then - call setFieldNeeded(importState, "U", .false., rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call setFieldNeeded(importState, "P", .false., rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call setFieldNeeded(importState, "Q", .false., rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_FieldRedistStore(src_field, dst_field, & - routehandle=fromFlow_rh, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - endif - - if (trim(statename) .eq. "Injection Feedback") then - call setFieldNeeded(importState, "U", .false., rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call setFieldNeeded(importState, "P", .false., rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call setFieldNeeded(importState, "Q", .false., rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call setFieldNeeded(importState, "FLAG", .false., rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_FieldRedistStore(src_field, dst_field, & - routehandle=fromInject_rh, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - endif - - print *, "Coupler Init returning" - - end subroutine coupler_init - - -!------------------------------------------------------------------------------ -!BOPI -! !IROUTINE: coupler_run - coupler run routine - -! !INTERFACE: - subroutine coupler_run(comp, importState, exportState, clock, rc) - -! -! !ARGUMENTS: - type(ESMF_CplComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc -! -! !DESCRIPTION: -! User-supplied run routine. -! -! The arguments are: -! \begin{description} -! \item[comp] -! Component. -! \item[importState] -! Nested state object containing import data. -! \item[exportState] -! Nested state object containing export data. -! \item[clock] -! External clock. -! \item[rc] -! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors, -! otherwise {\tt ESMF\_FAILURE}. -! \end{description} -! -!EOPI - - ! Local variables - type(ESMF_Field) :: srcfield, dstfield - type(ESMF_RouteHandle) :: rh - - character(len=ESMF_MAXSTR) :: statename - - integer :: i, datacount - character(len=ESMF_MAXSTR), dimension(7) :: datanames - - ! none of the arguments to this subroutine will ever be optional, so - ! go ahead and set rc to an initial return code before using it below. - ! (this makes some eager error-checking compilers happy.) - rc = ESMF_FAILURE - - datacount = 7 - datanames(1) = "SIE" - datanames(2) = "U" - datanames(3) = "V" - datanames(4) = "RHO" - datanames(5) = "P" - datanames(6) = "Q" - datanames(7) = "FLAG" - - ! In this case, the coupling is symmetric - you call redist going - ! both ways - so we only care about the coupling direction in order - ! to get the right routehandle selected. - call ESMF_StateGet(importState, name=statename, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - if (trim(statename) .eq. "FlowSolver Feedback") then - rh = fromFlow_rh - else - rh = fromInject_rh - endif - - do i=1, datacount - - ! check isneeded flag here - if (.not. isFieldNeeded(importState, datanames(i), rc=rc)) then - !print *, "skipping field ", trim(datanames(i)), " not needed" - cycle - endif - - !print *, "processing field ", trim(datanames(i)), " as needed" -!BOE -! !DESCRIPTION: -! \subsubsection{Example of Redist Usage} -! -! The following piece of code provides an example of calling the data -! redistribution routine between two Fields in the Coupler Component. -! Unlike regrid, which translates between -! different Grids, redist translates between different DELayouts on -! the same Grid. The first two lines get the Fields from the -! States, each corresponding to a different subcomponent. One is -! an Export State and the other is an Import State. -! -!BOC - call ESMF_StateGet(importState, datanames(i), srcfield, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateGet(exportState, datanames(i), dstfield, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) -!EOC -! -! The redist routine uses information contained in the Fields and the -! Coupler VM object to call the communication routines to move the data. -! Because many Fields may share the same Grid association, the same -! routing information may be needed repeatedly. Route information is -! saved so the precomputed information can be retained. The following -! is an example of a Field redist call: -! -!BOC - call ESMF_FieldRedist(srcfield, dstfield, routehandle=rh, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - -!EOC -!EOE - - enddo - - ! rc has the last error code already - - end subroutine coupler_run - - -!------------------------------------------------------------------------------ -!BOPI -! !IROUTINE: coupler_final - finalization routine - -! !INTERFACE: - subroutine coupler_final(comp, importState, exportState, clock, rc) - -! -! !ARGUMENTS: - type(ESMF_CplComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc -! -! !DESCRIPTION: -! User-supplied finalize routine. -! -! The arguments are: -! \begin{description} -! \item[comp] -! Component. -! \item[importState] -! Nested state object containing import data. -! \item[exportState] -! Nested state object containing export data. -! \item[clock] -! External clock. -! \item[rc] -! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors, -! otherwise {\tt ESMF\_FAILURE}. -! \end{description} -! -!EOPI - - print *, "Coupler Final starting" - - ! none of the arguments to this subroutine will ever be optional, so - ! go ahead and set rc to an initial return code before using it below. - ! (this makes some eager error-checking compilers happy.) - rc = ESMF_FAILURE - - ! Only thing to do here is release redist and route handles - call ESMF_FieldRedistRelease(fromFlow_rh, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_FieldRedistRelease(fromInject_rh, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - rc = ESMF_SUCCESS - - print *, "Coupler Final returning" - - end subroutine coupler_final - - - end module CouplerMod diff --git a/lilac/lilac/esmf_utils.f90 b/lilac/lilac/esmf_utils.f90 index 4d2a817b41..62e96759d6 100644 --- a/lilac/lilac/esmf_utils.f90 +++ b/lilac/lilac/esmf_utils.f90 @@ -1,9 +1,9 @@ module esmf_utils -! Wrappers and derived types exposing ESMF components to LILAC + ! Wrappers and derived types exposing ESMF components to LILAC -#include "ESMF.h" +#include "ESMC.h" use ESMF implicit none @@ -204,18 +204,18 @@ subroutine atoms_register(comp, rc) ! Set the entry points for standard ESMF Component methods call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, & - userRoutine=atoms_init, rc=rc) + userRoutine=atoms_init, rc=rc) call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & - userRoutine=atoms_copy_atm_to_lilac, phase=1, rc=rc) + userRoutine=atoms_copy_atm_to_lilac, phase=1, rc=rc) call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & - userRoutine=atoms_copy_lilac_to_atm, phase=2, rc=rc) + userRoutine=atoms_copy_lilac_to_atm, phase=2, rc=rc) call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, & - userRoutine=atoms_final, rc=rc) + userRoutine=atoms_final, rc=rc) ! TODO: check rcs rc = ESMF_SUCCESS - end subroutine + end subroutine atoms_register subroutine land_register(comp, rc) type(ESMF_GridComp) :: comp ! must not be optional @@ -225,16 +225,16 @@ subroutine land_register(comp, rc) ! Set the entry points for standard ESMF Component methods call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, & - userRoutine=land_init, rc=rc) + userRoutine=land_init, rc=rc) call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & - userRoutine=land_run, rc=rc) + userRoutine=land_run, rc=rc) call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, & - userRoutine=land_final, rc=rc) + userRoutine=land_final, rc=rc) ! TODO: check rcs rc = ESMF_SUCCESS - end subroutine + end subroutine land_register subroutine cpl_register(comp, rc) type(ESMF_GridComp) :: comp ! must not be optional @@ -255,15 +255,15 @@ subroutine cpl_register(comp, rc) rc = ESMF_SUCCESS - end subroutine + end subroutine cpl_register function return_error(rc, returnrc) ! fight with this later integer, intent(in) :: rc, returnrc if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=returnrc)) then - return_error = .true. + return_error = .true. else - return_error = .false. + return_error = .false. endif end function return_error diff --git a/lilac/lilac/land_comp.f90 b/lilac/lilac/land_comp.f90 deleted file mode 100644 index 1a4baf536d..0000000000 --- a/lilac/lilac/land_comp.f90 +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lilac/lilac/lilac.f90 b/lilac/lilac/lilac.f90 index b6393f9164..b80c3c8616 100644 --- a/lilac/lilac/lilac.f90 +++ b/lilac/lilac/lilac.f90 @@ -1,6 +1,5 @@ module lilac -#include "ESMF.h" use ESMF use atmos_comp, only : atmos_setvm, atmos_register @@ -21,14 +20,14 @@ module lilac contains type, public :: LilacType - private + private - type(ESMFInfoType) :: esmf_info + type(ESMFInfoType) :: esmf_info - contains - procedure, public :: init => init - procedure, public :: run => run - procedure, public :: final => final + contains + procedure, public :: init => init + procedure, public :: run => run + procedure, public :: final => final end type LilacType contains From 6050f2276ca2eed4dfac1252889c83cd93ef3054 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Tue, 2 Oct 2018 22:50:16 -0700 Subject: [PATCH 0239/1973] fixes for linking to esmf, still working on linking to mpi --- lilac/Dockerfile | 17 ++++++++------- lilac/README.md | 1 + lilac/ci/install_esmf.sh | 6 ++--- lilac/cmake/CMakeModules/FindESMF.cmake | 29 ++++--------------------- 4 files changed, 16 insertions(+), 37 deletions(-) diff --git a/lilac/Dockerfile b/lilac/Dockerfile index c7b5923a04..bebcc00428 100644 --- a/lilac/Dockerfile +++ b/lilac/Dockerfile @@ -1,8 +1,12 @@ FROM centos:latest LABEL description="LILAC development environment" -RUN yum install -y curl; yum upgrade -y; yum update -y; yum clean all +RUN yum install -y curl +RUN yum upgrade -y +RUN yum update -y +RUN yum clean all RUN yum -y install wget bzip2 gcc gcc-c++ gcc-gfortran mpich-devel make git +ENV PATH="/usr/lib64/mpich/bin:${PATH}" WORKDIR /usr/src/lilac/ @@ -18,12 +22,9 @@ ENV PATH /usr/local/miniconda/bin:$PATH RUN ./ci/install_python.sh # Install ESMF -# TODO: what's up with the .../lib/lib0/... maybe move this somewhere more logical? -RUN pwd -RUN ls $PWD RUN ./ci/install_esmf.sh -ENV ESMF_CONFIG_FILE /usr/lib/libO/Linux.gfortran.64.mpiuni.default/esmf.mk +ENV ESMF_CONFIG_FILE /usr/local/lib/esmf.mk -# # Install PFUNIT -RUN ./ci/install_pfunit.sh -ENV PFUNIT_INSTALL /usr/pfunit +# Install PFUNIT +# RUN ./ci/install_pfunit.sh +# ENV PFUNIT_INSTALL /usr/pfunit diff --git a/lilac/README.md b/lilac/README.md index b3315ab04a..4184eb80d3 100644 --- a/lilac/README.md +++ b/lilac/README.md @@ -9,3 +9,4 @@ Currently working on: - Setting up CI and CMake - setup/test style (borrow from geostreams) - setup unit tests with pfunit + diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index 0f39bae1e1..d68f33969c 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -6,10 +6,8 @@ cd ./external/esmf export FC="gfortran" -# export PATH="/usr/lib64/mpich/bin/":${PATH} - export ESMF_DIR=$PWD -export ESMF_COMM="mpiuni" +export ESMF_COMM="mpich3" export ESMF_COMPILER="gfortran" export ESMF_INSTALL_PREFIX="/usr/local" export ESMF_INSTALL_LIBDIR="/usr/local/lib" @@ -20,6 +18,6 @@ export ESMFMKFILE="${ESMF_INSTALL_LIBDIR}/esmf.mk" make -j4 lib make install -make install check +# make install check cd - \ No newline at end of file diff --git a/lilac/cmake/CMakeModules/FindESMF.cmake b/lilac/cmake/CMakeModules/FindESMF.cmake index 39b00447c1..943ffd6087 100644 --- a/lilac/cmake/CMakeModules/FindESMF.cmake +++ b/lilac/cmake/CMakeModules/FindESMF.cmake @@ -26,31 +26,9 @@ # Defining the ${Esc} for syntax coloring. string(ASCII 27 Esc) -# Checking if ESMF exists -if (NOT DEFINED ENV{ESMF_CONFIG_FILE} AND NOT DEFINED ESMF_CONFIG_FILE) - message (FATAL_ERROR "\n${Esc}[1;31m!! Error: You need ESMF library to \ - run this program. please set the environment \ - variable ESMF_CONFIG_FILE to point to esmf.mk in \ - your ESMF installation directory. \ - Try something like: ${Esc}[m\ - export ESMF_CONFIG_FILE=/path/to/esmf.mk && cmake ${CMAKE_SOURCE_DIR}") -endif () +message ("Parsing ESMF_CONFIG_FILE: " $ENV{ESMF_CONFIG_FILE}) -if (NOT EXISTS ENV{ESMF_CONFIG_FILE} AND NOT EXISTS ${ESMF_CONFIG_FILE}) - message (FATAL_ERROR "${Esc}[1;31m Error: esmf.mk file is not found at \ - ${ESMF_CONFIG_FILE} ${Esc}[m") -else () - message ("+>${Esc}[1;32m The config file for ESMF library is found.${Esc}[m") -endif () - -if (DEFINED ENV{ESMF_CONFIG_FILE}) - set(ESMF_CONFIG_FILE ENV{ESMF_CONFIG_FILE} CACHE STRING "") -endif () -set(ESMF_CONFIG_FILE ${ESMF_CONFIG_FILE} CACHE STRING "") - -message ("Parsing ESMF_CONFIG_FILE: " ${ESMF_CONFIG_FILE}) - -file(STRINGS "${ESMF_CONFIG_FILE}" all_vars) +file(STRINGS "$ENV{ESMF_CONFIG_FILE}" all_vars) foreach(str ${all_vars}) string(REGEX MATCH "^[^#]" def ${str}) if (def) @@ -69,5 +47,6 @@ set (ESMF_LINK_LINE "${ESMF_F90LINKOPTS} \ set (ESMF_COMPILER_LINE "${ESMF_F90COMPILEOPTS} \ ${ESMF_F90COMPILEPATHS} \ - ${ESMF_F90COMPILEFREENOCPP}") + ${ESMF_F90COMPILEFREENOCPP} \ + ${ESMF_CXXCOMPILEPATHS}") From 26dc01727de6ca198194fd143f6ceb0027745dd7 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Fri, 5 Oct 2018 13:23:43 -0700 Subject: [PATCH 0240/1973] lots of updates including a mostly working build, still a WIP --- lilac/CMakeLists.txt | 6 +- lilac/ci/build_and_test_lilac.sh | 4 +- lilac/ci/install_esmf.sh | 2 +- lilac/lilac/CMakeLists.txt | 2 +- lilac/lilac/esmf_utils.f90 | 163 ++++++++++++++++--------------- 5 files changed, 93 insertions(+), 84 deletions(-) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 8e7c0cf87a..4268ea956d 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -6,6 +6,8 @@ enable_language(Fortran) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") find_package(MPI REQUIRED) +# TODO: This should be found from the find_package call but its not working +set(CMAKE_Fortran_COMPILER "/usr/lib64/mpich/bin/mpif90") find_package(ESMF REQUIRED) # Local CMake modules @@ -28,8 +30,8 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include") - +# TODO: This should not be necessary but certain header files are missing from the build +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include -I/usr/src/lilac/external/esmf/build_config/Linux.gfortran.default -I /usr/src/lilac/external/esmf/src/include") message("CMAKE_Fortran_FLAGS:" ${CMAKE_Fortran_FLAGS}) add_subdirectory(lilac) diff --git a/lilac/ci/build_and_test_lilac.sh b/lilac/ci/build_and_test_lilac.sh index 176478a5c6..3b7fca20f5 100755 --- a/lilac/ci/build_and_test_lilac.sh +++ b/lilac/ci/build_and_test_lilac.sh @@ -10,8 +10,8 @@ mkdir -p /lilac/build export CMAKE_PREFIX_PATH=/usr/lib64/mpich/bin -cd /lilac/build && cmake .. -make # -j 4 +cd /lilac/build && cmake -D CMAKE_BUILD_TYPE=DEBUG .. +make VERBOSE=1 # -j 4 echo "done building lilac, time to run the tests..." diff --git a/lilac/ci/install_esmf.sh b/lilac/ci/install_esmf.sh index d68f33969c..bbd21faddb 100755 --- a/lilac/ci/install_esmf.sh +++ b/lilac/ci/install_esmf.sh @@ -4,7 +4,7 @@ set -x cd ./external/esmf -export FC="gfortran" +export FC="mpif90" export ESMF_DIR=$PWD export ESMF_COMM="mpich3" diff --git a/lilac/lilac/CMakeLists.txt b/lilac/lilac/CMakeLists.txt index afbc52c6c3..a92669e0ff 100644 --- a/lilac/lilac/CMakeLists.txt +++ b/lilac/lilac/CMakeLists.txt @@ -1,4 +1,4 @@ # Compile LILAC library file(GLOB_RECURSE LILAC_SOURCES *.f90 *.h) add_library(lilac ${LILAC_SOURCES}) -target_include_directories(lilac PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lilac) +target_include_directories(lilac PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/lilac/lilac/esmf_utils.f90 b/lilac/lilac/esmf_utils.f90 index 62e96759d6..7357a9cab0 100644 --- a/lilac/lilac/esmf_utils.f90 +++ b/lilac/lilac/esmf_utils.f90 @@ -3,22 +3,25 @@ module esmf_utils ! Wrappers and derived types exposing ESMF components to LILAC -#include "ESMC.h" +#include "ESMF.h" +#include use ESMF implicit none private + character(*), parameter :: modname = "(esmf_utils)" + ! Consider renaming ESMFInfoType (add lilac to name) type, public :: ESMFInfoType private - character(len=MAXFILELENGTH) :: name + character(len=ESMF_MAXSTR) :: name type(ESMF_VM) :: vm type(ESMF_State) :: land_import type(ESMF_State) :: land_export type(ESMF_State) :: atmos_import - type(E SMF_State) :: atmos_export + type(ESMF_State) :: atmos_export type(ESMF_GridComp) :: atmos_comp type(ESMF_GridComp) :: land_comp type(ESMF_CplComp) :: cpl_comp @@ -28,9 +31,6 @@ module esmf_utils procedure, public :: run => run procedure, public :: final => final - procedure, private :: atmos_register => atmos_register - procedure, private :: land_register => land_register - procedure, private :: cpl_register => cpl_register end type ESMFInfoType contains @@ -38,17 +38,19 @@ module esmf_utils subroutine init(self, name) implicit none class(ESMFInfoType), intent(inout) :: self - character(len=MAXVARLENGTH), intent(in) :: name + character(len=ESMF_MAXSTR), intent(in) :: name ! TODO define subroutines: https://stackoverflow.com/questions/32809769/how-to-pass-subroutine-names-as-arguments-in-fortran ! Local variables - integer :: localPet, petCount, localrc, rc=ESMF_SUCCESS, userrc=ESMF_SUCCESS - character(len=ESMF_MAXSTR) :: cname1, cname2 + character(len=ESMF_MAXSTR) :: cname1, cname2, cplname + integer :: localPet, petCount, localrc, rc=ESMF_SUCCESS, userrc=ESMF_SUCCESS + + character(len=*) :: subname=trim(modname)//':(init) ' - print *, "esmf_info%init()" + call ESMF_LogWrite(subname//"esmf_info%init()", ESMF_LOGMSG_INFO) - self%name = name + self%name = trim(name) ! Create section !------------------------------------------------------------------------- @@ -57,74 +59,74 @@ subroutine init(self, name) ! only run if not esmf_isintialized() call ESMF_Initialize(vm=self%vm, defaultlogfilename="lilac.log", logkindflag=ESMF_LOGKIND_MULTI, rc=localrc) - call check(localrc, rc) + if (return_error(localrc, rc)) return ! Get number of PETs we are running with call ESMF_VMGet(self%vm, petCount=petCount, localPet=localPet, rc=localrc) - call check(localrc, rc) + if (return_error(localrc, rc)) return ! Create the 2 model components and a coupler cname1 = "land" ! use petList to define land on all PET - self%land_grid = ESMF_GridCompCreate(name=cname1, rc=localrc) - print *, "Created component ", trim(cname1), "rc =", localrc - call check(localrc, rc) + self%land_comp = ESMF_GridCompCreate(name=cname1, rc=localrc) + call ESMF_LogWrite(subname//"Created "//trim(cname1)//" component", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return cname2 = "atmosphere" ! use petList to define atmosphere on all PET self%atmos_comp = ESMF_GridCompCreate(name=cname2, rc=localrc) - print *, "Created component ", trim(cname2), "rc =", localrc - call check(localrc, rc) + call ESMF_LogWrite(subname//"Created "//trim(cname2)//" component", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return cplname = "lilac coupler" ! no petList means that coupler component runs on all PETs self%cpl_comp = ESMF_CplCompCreate(name=cplname, rc=localrc) - print *, "Created component ", trim(cplname), ", rc =", localrc - call check(localrc, rc) + call ESMF_LogWrite(subname//"Created "//trim(cplname)//" component", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return - print *, "Comp Creates finished" + call ESMF_LogWrite(subname//"Comp Creates finished", ESMF_LOGMSG_INFO) ! Register section !------------------------------------------------------------------------- call ESMF_GridCompSetServices(self%atmos_comp, userRoutine=atmos_register, userRc=userrc, rc=localrc) - print *, "atmos SetServices finished, rc= ", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_LogWrite(subname//"atmos SetServices finished", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return call ESMF_GridCompSetServices(self%land_comp, userRoutine=land_register, userRc=userrc, rc=localrc) - print *, "land SetServices finished, rc= ", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_LogWrite(subname//"land SetServices finished", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return call ESMF_CplCompSetServices(self%cpl_comp, userRoutine=cpl_register, userRc=userrc, rc=localrc) - print *, "Cpl SetServices finished, rc= ", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_LogWrite(subname//"Cpl SetServices finished", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return ! Init section !------------------------------------------------------------------------- ! land import/export states self%land_import = ESMF_StateCreate(name="land import", stateintent=ESMF_STATEINTENT_IMPORT, rc=localrc) - call check(localrc, rc) + if (return_error(localrc, rc)) return self%land_export = ESMF_StateCreate(name="land export", stateintent=ESMF_STATEINTENT_EXPORT, rc=localrc) - call check(localrc, rc) - call ESMF_GridCompInitialize(land, importState=self%land_import, exportState=self%land_export, userRc=userrc, rc=localrc) - call check(localrc, rc) - call check(userrc, rc) - print *, "Land Initialize finished, rc =", localrc + if (return_error(localrc, rc)) return + call ESMF_GridCompInitialize(self%land_comp, importState=self%land_import, exportState=self%land_export, userRc=userrc, rc=localrc) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return + call ESMF_LogWrite(subname//"Land Initialize finished", ESMF_LOGMSG_INFO) ! atmosphere import/export state self%atmos_import = ESMF_StateCreate(name="atmos import", & stateintent=ESMF_STATEINTENT_IMPORT, rc=localrc) - call check(localrc, rc) + if (return_error(localrc, rc)) return self%atmos_export = ESMF_StateCreate(name="atmos export", & stateintent=ESMF_STATEINTENT_EXPORT, rc=localrc) - call check(localrc, rc) + if (return_error(localrc, rc)) return call ESMF_GridCompInitialize(self%atmos_comp, exportState=self%atmos_export, userRc=userrc, rc=localrc) - print *, "Atmosphere Initialize finished, rc =", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_LogWrite(subname//"Atmosphere Initialize finished", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return ! call ESMF_CPLCompInitialize twice (once for each grid comp) @@ -132,42 +134,45 @@ end subroutine init subroutine run(self) implicit none + class(ESMFInfoType), intent(inout) :: self integer :: localrc, rc=ESMF_SUCCESS, userrc=ESMF_SUCCESS - print *, "esmf_info%run()" + character(len=*), parameter :: subname=trim(modname)//':(init) ' + + call ESMF_LogWrite(subname//"esmf_info%run()", ESMF_LOGMSG_INFO) ! TODO: need some help on order of imports/exports/runs and whether the land/atm both need import/export states ! atmosphere run ! copy the atmos state and put it into atmos export call ESMF_GridCompRun(self%atmos_comp, exportState=self%atmos_export, phase=1, userRc=userrc, rc=localrc) - print *, "Atmosphere Run returned, rc =", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_LogWrite(subname//"Atmosphere Run returned", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return ! coupler run - call ESMF_CplCompRun(self%cpl_comp, importState=self%atoms_export, exportState=self%land_import, & + call ESMF_CplCompRun(self%cpl_comp, importState=self%atmos_export, exportState=self%land_import, & userRc=userrc, rc=localrc) - print *, "Coupler Run returned, rc =", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_LogWrite(subname//"Coupler Run returned", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return ! land run call ESMF_GridCompRun(self%land_comp, importState=self%land_import, exportState=self%land_export, userRc=userrc, rc=localrc) - print *, "Land Run returned, rc =", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_LogWrite(subname//"Land Run returned", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return ! coupler run call ESMF_CplCompRun(self%cpl_comp, importState=self%land_export, exportState=self%atmos_import, & userRc=userrc, rc=localrc) - print *, "Coupler Run returned, rc =", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_LogWrite(subname//"Coupler Run returned", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return - call ESMF_GridCompRun(self%atmos_comp, importState%atmos_import, phase=2, userRc=userrc, rc=localrc) - print *, "Atmosphere Run returned, rc =", localrc - call check(localrc, rc) - call check(userrc, rc) + call ESMF_GridCompRun(self%atmos_comp, importState=self%atmos_import, phase=2, userRc=userrc, rc=localrc) + call ESMF_LogWrite(subname//"Atmosphere Run returned", ESMF_LOGMSG_INFO) + if (return_error(localrc, rc)) return + if (return_error(userrc, rc)) return end subroutine run @@ -175,32 +180,34 @@ subroutine final(self) implicit none class(ESMFInfoType), intent(inout) :: self integer :: localrc, rc=ESMF_SUCCESS + character(len=*), parameter :: subname=trim(modname)//':(final) ' - print *, "esmf_info%final()" + call ESMF_LogWrite(subname//"esmf_info%final()", ESMF_LOGMSG_INFO) ! Destroy section call ESMF_GridCompDestroy(self%atmos_comp, rc=localrc) - check(localrc, rc) + if (return_error(localrc, rc)) return call ESMF_GridCompDestroy(self%land_comp, rc=localrc) - check(localrc, rc) + if (return_error(localrc, rc)) return call ESMF_CplCompDestroy(self%cpl_comp, rc=localrc) - check(localrc, rc) + if (return_error(localrc, rc)) return call ESMF_StateDestroy(self%land_export, rc=localrc) call ESMF_StateDestroy(self%land_import, rc=localrc) - check(localrc, rc) + if (return_error(localrc, rc)) return call ESMF_StateDestroy(self%atmos_export, rc=localrc) call ESMF_StateDestroy(self%atmos_import, rc=localrc) ! do this everywhere - if return_error(localrc, rc) return + if (return_error(localrc, rc)) return - print *, "All Destroy routines done" + call ESMF_LogWrite(subname//"All Destroy routines done", ESMF_LOGMSG_INFO) end subroutine final - subroutine atoms_register(comp, rc) + subroutine atmos_register(comp, rc) type(ESMF_GridComp) :: comp ! must not be optional integer, intent(out) :: rc ! must not be optional + character(len=*), parameter :: subname=trim(modname)//':(atmos_register) ' ! Set the entry points for standard ESMF Component methods call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, & @@ -215,21 +222,19 @@ subroutine atoms_register(comp, rc) rc = ESMF_SUCCESS - end subroutine atoms_register + end subroutine atmos_register subroutine land_register(comp, rc) type(ESMF_GridComp) :: comp ! must not be optional integer, intent(out) :: rc ! must not be optional + character(len=*), parameter :: subname=trim(modname)//':(lnd_register) ' ! land_* comes from ctsm esmf cap ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, & - userRoutine=land_init, rc=rc) - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & - userRoutine=land_run, rc=rc) - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, & - userRoutine=land_final, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=land_init, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=land_run, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=land_final, rc=rc) ! TODO: check rcs rc = ESMF_SUCCESS @@ -239,6 +244,7 @@ end subroutine land_register subroutine cpl_register(comp, rc) type(ESMF_GridComp) :: comp ! must not be optional integer, intent(out) :: rc ! must not be optional + character(len=*), parameter :: subname=trim(modname)//':(cpl_register) ' rc = ESMF_FAILURE @@ -251,19 +257,20 @@ subroutine cpl_register(comp, rc) call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=coupler_final, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - print *, "CouplerMod: Registered Initialize, Run, and Finalize routines" + call ESMF_LogWrite(subname//"CouplerMod: Registered Initialize, Run, and Finalize routines", ESMF_LOGMSG_INFO) rc = ESMF_SUCCESS end subroutine cpl_register - function return_error(rc, returnrc) + function return_error(rc, returnrc) result(error) ! fight with this later integer, intent(in) :: rc, returnrc + logical :: error if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=returnrc)) then - return_error = .true. + error = .true. else - return_error = .false. + error = .false. endif end function return_error From 1190c2e08756c0771d38f6cd613af602290568a2 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Fri, 5 Oct 2018 13:25:09 -0700 Subject: [PATCH 0241/1973] remove unecessary header file --- lilac/lilac/esmf_utils.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/lilac/lilac/esmf_utils.f90 b/lilac/lilac/esmf_utils.f90 index 7357a9cab0..6a40202bf7 100644 --- a/lilac/lilac/esmf_utils.f90 +++ b/lilac/lilac/esmf_utils.f90 @@ -4,7 +4,6 @@ module esmf_utils #include "ESMF.h" -#include use ESMF implicit none From 4f1b63a3723af70c3b39a71063acf28b4c4463b5 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 8 Oct 2018 10:55:40 -0700 Subject: [PATCH 0242/1973] passing build --- lilac/lilac/core.f90 | 317 +++++++++++++++++++++++++++++++++++++ lilac/lilac/esmf_utils.f90 | 230 ++++++++++----------------- lilac/lilac/lilac.f90 | 59 ------- 3 files changed, 404 insertions(+), 202 deletions(-) create mode 100644 lilac/lilac/core.f90 delete mode 100644 lilac/lilac/lilac.f90 diff --git a/lilac/lilac/core.f90 b/lilac/lilac/core.f90 new file mode 100644 index 0000000000..7feec6eac2 --- /dev/null +++ b/lilac/lilac/core.f90 @@ -0,0 +1,317 @@ +module lilac + + use ESMF + use esmf_utils + + implicit none + + character(*), parameter :: modname = "(core)" + + !-------------------------------------------------------------------------- + ! Public interfaces + !-------------------------------------------------------------------------- + public :: init + public :: run + public :: final + + private :: atmos_register + private :: land_register + private :: cpl_register + + type, public :: LilacType + private + + type(ESMFInfoType) :: esmf_info + character(len=ESMF_MAXSTR) :: name + + contains + procedure, public :: init => init + procedure, public :: run => run + procedure, public :: final => final + + ! register methods + procedure, nopass, private :: atmos_register => atmos_register + procedure, nopass, private :: land_register => land_register + procedure, nopass, private :: cpl_register => cpl_register + + ! Init methods + procedure, nopass, private :: atmos_init => atmos_init + procedure, nopass, private :: land_init => land_init + procedure, nopass, private :: coupler_init => coupler_init + + ! Run methods + procedure, nopass, private :: atmos_copy_atm_to_lilac => atmos_copy_atm_to_lilac + procedure, nopass, private :: atmos_copy_lilac_to_atm => atmos_copy_lilac_to_atm + procedure, nopass, private :: land_run => land_run + procedure, nopass, private :: coupler_run => coupler_run + + ! Final methods + procedure, nopass, private :: atmos_final => atmos_final + procedure, nopass, private :: land_final => land_final + procedure, nopass, private :: coupler_final => coupler_final + + end type LilacType + +contains + + subroutine init(self, name) + implicit none + class(LilacType), intent(inout) :: self + character(len=ESMF_MAXSTR), intent(in) :: name + + character(len=*), parameter :: subname=trim(modname)//':(init) ' + + call ESMF_LogWrite(subname//"Initializing lilac", ESMF_LOGMSG_INFO) + + self%name = trim(name) + + ! Initialize ESMF structures + call self%esmf_info%init(name, atmos_register, land_register, cpl_register) + + end subroutine init + + subroutine run(self) + implicit none + class(LilacType), intent(inout) :: self + + character(len=*), parameter :: subname=trim(modname)//':(run) ' + + call ESMF_LogWrite(subname//"Running lilac", ESMF_LOGMSG_INFO) + + call self%esmf_info%run() + + end subroutine run + + subroutine final(self) + implicit none + class(LilacType), intent(inout) :: self + + character(len=*), parameter :: subname=trim(modname)//':(final) ' + + call ESMF_LogWrite(subname//"Finalizing lilac", ESMF_LOGMSG_INFO) + + call self%esmf_info%final() + + end subroutine final + + subroutine atmos_register(comp, rc) + type(ESMF_GridComp) :: comp ! must not be optional + integer, intent(out) :: rc ! must not be optional + character(len=*), parameter :: subname=trim(modname)//':(atmos_register) ' + + ! Set the entry points for standard ESMF Component methods + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, & + userRoutine=atmos_init, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & + userRoutine=atmos_copy_atm_to_lilac, phase=1, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & + userRoutine=atmos_copy_lilac_to_atm, phase=2, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, & + userRoutine=atmos_final, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + rc = ESMF_SUCCESS + + end subroutine atmos_register + + subroutine land_register(comp, rc) + type(ESMF_GridComp) :: comp ! must not be optional + integer, intent(out) :: rc ! must not be optional + character(len=*), parameter :: subname=trim(modname)//':(lnd_register) ' + + ! land_* comes from ctsm esmf cap + + ! Set the entry points for standard ESMF Component methods + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=land_init, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=land_run, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=land_final, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + rc = ESMF_SUCCESS + + end subroutine land_register + + subroutine cpl_register(comp, rc) + type(ESMF_CplComp) :: comp ! must not be optional + integer, intent(out) :: rc ! must not be optional + character(len=*), parameter :: subname=trim(modname)//':(cpl_register) ' + + rc = ESMF_FAILURE + + ! Register the callback routines. + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=coupler_init, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=coupler_run, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=coupler_final, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_LogWrite(subname//"CouplerMod: Registered Initialize, Run, and Finalize routines", ESMF_LOGMSG_INFO) + + rc = ESMF_SUCCESS + + end subroutine cpl_register + +subroutine atmos_init(comp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(atmos_init) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"atmos_init has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine atmos_init + +subroutine land_init(comp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(land_init) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"land_init has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine land_init + +subroutine coupler_init(comp, importState, exportState, clock, rc) + type(ESMF_CplComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(coupler_init) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"coupler_init has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine coupler_init + +subroutine atmos_copy_atm_to_lilac(comp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(atmos_copy_atm_to_lilac) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"atmos_copy_atm_to_lilac has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine atmos_copy_atm_to_lilac + +subroutine atmos_copy_lilac_to_atm(comp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(atmos_copy_lilac_to_atm) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"atmos_copy_lilac_to_atm has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine atmos_copy_lilac_to_atm + +subroutine land_run(comp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(land_run) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"land_run has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine land_run + +subroutine coupler_run(comp, importState, exportState, clock, rc) + type(ESMF_CplComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(coupler_run) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"coupler_run has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine coupler_run + +subroutine atmos_final(comp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(atmos_final) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"atmos_final has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine atmos_final + +subroutine land_final(comp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(land_final) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"land_final has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine land_final + +subroutine coupler_final(comp, importState, exportState, clock, rc) + type(ESMF_CplComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//':(coupler_final) ' + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"coupler_final has not been implemented yet", ESMF_LOGMSG_INFO) + +end subroutine coupler_final + +end module lilac diff --git a/lilac/lilac/esmf_utils.f90 b/lilac/lilac/esmf_utils.f90 index 6a40202bf7..57f9cf0168 100644 --- a/lilac/lilac/esmf_utils.f90 +++ b/lilac/lilac/esmf_utils.f90 @@ -11,6 +11,24 @@ module esmf_utils character(*), parameter :: modname = "(esmf_utils)" + interface + subroutine userRoutine(gridcomp, rc) + use ESMF_CompMod + implicit none + type(ESMF_GridComp) :: gridcomp ! must not be optional + integer, intent(out) :: rc ! must not be optional + end subroutine userRoutine + end interface + + interface + subroutine userCplRoutine(cplcomp, rc) + use ESMF_CompMod + implicit none + type(ESMF_CplComp) :: cplcomp ! must not be optional + integer, intent(out) :: rc ! must not be optional + end subroutine userCplRoutine + end interface + ! Consider renaming ESMFInfoType (add lilac to name) type, public :: ESMFInfoType private @@ -34,18 +52,19 @@ module esmf_utils contains - subroutine init(self, name) + subroutine init(self, name, atmos_register, land_register, cpl_register) implicit none - class(ESMFInfoType), intent(inout) :: self - character(len=ESMF_MAXSTR), intent(in) :: name - - ! TODO define subroutines: https://stackoverflow.com/questions/32809769/how-to-pass-subroutine-names-as-arguments-in-fortran + class(ESMFInfoType), intent(inout) :: self + character(len=ESMF_MAXSTR), intent(in) :: name + procedure(userRoutine) :: atmos_register + procedure(userRoutine) :: land_register + procedure(userCplRoutine) :: cpl_register ! Local variables character(len=ESMF_MAXSTR) :: cname1, cname2, cplname - integer :: localPet, petCount, localrc, rc=ESMF_SUCCESS, userrc=ESMF_SUCCESS + integer :: localPet, petCount, rc=ESMF_SUCCESS - character(len=*) :: subname=trim(modname)//':(init) ' + character(len=*), parameter :: subname=trim(modname)//':(init) ' call ESMF_LogWrite(subname//"esmf_info%init()", ESMF_LOGMSG_INFO) @@ -57,75 +76,71 @@ subroutine init(self, name) ! Initialize framework and get back default global VM ! only run if not esmf_isintialized() - call ESMF_Initialize(vm=self%vm, defaultlogfilename="lilac.log", logkindflag=ESMF_LOGKIND_MULTI, rc=localrc) - if (return_error(localrc, rc)) return + call ESMF_Initialize(vm=self%vm, defaultlogfilename="lilac.log", logkindflag=ESMF_LOGKIND_MULTI, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out ! Get number of PETs we are running with - call ESMF_VMGet(self%vm, petCount=petCount, localPet=localPet, rc=localrc) - if (return_error(localrc, rc)) return + call ESMF_VMGet(self%vm, petCount=petCount, localPet=localPet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out ! Create the 2 model components and a coupler cname1 = "land" ! use petList to define land on all PET - self%land_comp = ESMF_GridCompCreate(name=cname1, rc=localrc) + self%land_comp = ESMF_GridCompCreate(name=cname1, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Created "//trim(cname1)//" component", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return cname2 = "atmosphere" ! use petList to define atmosphere on all PET - self%atmos_comp = ESMF_GridCompCreate(name=cname2, rc=localrc) + self%atmos_comp = ESMF_GridCompCreate(name=cname2, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Created "//trim(cname2)//" component", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return cplname = "lilac coupler" ! no petList means that coupler component runs on all PETs - self%cpl_comp = ESMF_CplCompCreate(name=cplname, rc=localrc) + self%cpl_comp = ESMF_CplCompCreate(name=cplname, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Created "//trim(cplname)//" component", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return call ESMF_LogWrite(subname//"Comp Creates finished", ESMF_LOGMSG_INFO) ! Register section !------------------------------------------------------------------------- - call ESMF_GridCompSetServices(self%atmos_comp, userRoutine=atmos_register, userRc=userrc, rc=localrc) + call ESMF_GridCompSetServices(self%atmos_comp, userRoutine=atmos_register, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"atmos SetServices finished", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return - call ESMF_GridCompSetServices(self%land_comp, userRoutine=land_register, userRc=userrc, rc=localrc) + call ESMF_GridCompSetServices(self%land_comp, userRoutine=land_register, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"land SetServices finished", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return - call ESMF_CplCompSetServices(self%cpl_comp, userRoutine=cpl_register, userRc=userrc, rc=localrc) + call ESMF_CplCompSetServices(self%cpl_comp, userRoutine=cpl_register, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Cpl SetServices finished", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return ! Init section !------------------------------------------------------------------------- ! land import/export states - self%land_import = ESMF_StateCreate(name="land import", stateintent=ESMF_STATEINTENT_IMPORT, rc=localrc) - if (return_error(localrc, rc)) return - self%land_export = ESMF_StateCreate(name="land export", stateintent=ESMF_STATEINTENT_EXPORT, rc=localrc) - if (return_error(localrc, rc)) return - call ESMF_GridCompInitialize(self%land_comp, importState=self%land_import, exportState=self%land_export, userRc=userrc, rc=localrc) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return + self%land_import = ESMF_StateCreate(name="land import", stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + self%land_export = ESMF_StateCreate(name="land export", stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompInitialize(self%land_comp, importState=self%land_import, exportState=self%land_export, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Land Initialize finished", ESMF_LOGMSG_INFO) ! atmosphere import/export state - self%atmos_import = ESMF_StateCreate(name="atmos import", & - stateintent=ESMF_STATEINTENT_IMPORT, rc=localrc) - if (return_error(localrc, rc)) return - - self%atmos_export = ESMF_StateCreate(name="atmos export", & - stateintent=ESMF_STATEINTENT_EXPORT, rc=localrc) - if (return_error(localrc, rc)) return - call ESMF_GridCompInitialize(self%atmos_comp, exportState=self%atmos_export, userRc=userrc, rc=localrc) + self%atmos_import = ESMF_StateCreate(name="atmos import", stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + self%atmos_export = ESMF_StateCreate(name="atmos export", stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompInitialize(self%atmos_comp, exportState=self%atmos_export, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Atmosphere Initialize finished", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return ! call ESMF_CPLCompInitialize twice (once for each grid comp) @@ -134,8 +149,8 @@ end subroutine init subroutine run(self) implicit none class(ESMFInfoType), intent(inout) :: self - integer :: localrc, rc=ESMF_SUCCESS, userrc=ESMF_SUCCESS - character(len=*), parameter :: subname=trim(modname)//':(init) ' + integer :: rc=ESMF_SUCCESS + character(len=*), parameter :: subname=trim(modname)//':(run) ' call ESMF_LogWrite(subname//"esmf_info%run()", ESMF_LOGMSG_INFO) @@ -143,135 +158,64 @@ subroutine run(self) ! atmosphere run ! copy the atmos state and put it into atmos export - call ESMF_GridCompRun(self%atmos_comp, exportState=self%atmos_export, phase=1, userRc=userrc, rc=localrc) + call ESMF_GridCompRun(self%atmos_comp, exportState=self%atmos_export, phase=1, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Atmosphere Run returned", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return ! coupler run call ESMF_CplCompRun(self%cpl_comp, importState=self%atmos_export, exportState=self%land_import, & - userRc=userrc, rc=localrc) + rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Coupler Run returned", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return ! land run - call ESMF_GridCompRun(self%land_comp, importState=self%land_import, exportState=self%land_export, userRc=userrc, rc=localrc) + call ESMF_GridCompRun(self%land_comp, importState=self%land_import, exportState=self%land_export, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Land Run returned", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return ! coupler run - call ESMF_CplCompRun(self%cpl_comp, importState=self%land_export, exportState=self%atmos_import, & - userRc=userrc, rc=localrc) + call ESMF_CplCompRun(self%cpl_comp, importState=self%land_export, exportState=self%atmos_import, rc=rc) call ESMF_LogWrite(subname//"Coupler Run returned", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_GridCompRun(self%atmos_comp, importState=self%atmos_import, phase=2, userRc=userrc, rc=localrc) + call ESMF_GridCompRun(self%atmos_comp, importState=self%atmos_import, phase=2, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Atmosphere Run returned", ESMF_LOGMSG_INFO) - if (return_error(localrc, rc)) return - if (return_error(userrc, rc)) return end subroutine run subroutine final(self) implicit none class(ESMFInfoType), intent(inout) :: self - integer :: localrc, rc=ESMF_SUCCESS + integer :: rc=ESMF_SUCCESS character(len=*), parameter :: subname=trim(modname)//':(final) ' call ESMF_LogWrite(subname//"esmf_info%final()", ESMF_LOGMSG_INFO) ! Destroy section - call ESMF_GridCompDestroy(self%atmos_comp, rc=localrc) - if (return_error(localrc, rc)) return - call ESMF_GridCompDestroy(self%land_comp, rc=localrc) - if (return_error(localrc, rc)) return - call ESMF_CplCompDestroy(self%cpl_comp, rc=localrc) - if (return_error(localrc, rc)) return - - call ESMF_StateDestroy(self%land_export, rc=localrc) - call ESMF_StateDestroy(self%land_import, rc=localrc) - if (return_error(localrc, rc)) return - call ESMF_StateDestroy(self%atmos_export, rc=localrc) - call ESMF_StateDestroy(self%atmos_import, rc=localrc) - ! do this everywhere - if (return_error(localrc, rc)) return - - call ESMF_LogWrite(subname//"All Destroy routines done", ESMF_LOGMSG_INFO) - - end subroutine final + call ESMF_GridCompDestroy(self%atmos_comp, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - subroutine atmos_register(comp, rc) - type(ESMF_GridComp) :: comp ! must not be optional - integer, intent(out) :: rc ! must not be optional - character(len=*), parameter :: subname=trim(modname)//':(atmos_register) ' + call ESMF_GridCompDestroy(self%land_comp, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, & - userRoutine=atoms_init, rc=rc) - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & - userRoutine=atoms_copy_atm_to_lilac, phase=1, rc=rc) - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, & - userRoutine=atoms_copy_lilac_to_atm, phase=2, rc=rc) - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, & - userRoutine=atoms_final, rc=rc) - ! TODO: check rcs + call ESMF_CplCompDestroy(self%cpl_comp, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - rc = ESMF_SUCCESS + call ESMF_StateDestroy(self%land_export, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end subroutine atmos_register + call ESMF_StateDestroy(self%land_import, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - subroutine land_register(comp, rc) - type(ESMF_GridComp) :: comp ! must not be optional - integer, intent(out) :: rc ! must not be optional - character(len=*), parameter :: subname=trim(modname)//':(lnd_register) ' + call ESMF_StateDestroy(self%atmos_export, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! land_* comes from ctsm esmf cap + call ESMF_StateDestroy(self%atmos_import, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=land_init, rc=rc) - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=land_run, rc=rc) - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=land_final, rc=rc) - ! TODO: check rcs - - rc = ESMF_SUCCESS - - end subroutine land_register - - subroutine cpl_register(comp, rc) - type(ESMF_GridComp) :: comp ! must not be optional - integer, intent(out) :: rc ! must not be optional - character(len=*), parameter :: subname=trim(modname)//':(cpl_register) ' - - rc = ESMF_FAILURE - - ! Register the callback routines. - - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=coupler_init, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=coupler_run, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=coupler_final, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_LogWrite(subname//"CouplerMod: Registered Initialize, Run, and Finalize routines", ESMF_LOGMSG_INFO) - - rc = ESMF_SUCCESS - - end subroutine cpl_register - - function return_error(rc, returnrc) result(error) - ! fight with this later - integer, intent(in) :: rc, returnrc - logical :: error - if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, ESMF_CONTEXT, rcToReturn=returnrc)) then - error = .true. - else - error = .false. - endif + call ESMF_LogWrite(subname//"All Destroy routines done", ESMF_LOGMSG_INFO) - end function return_error + end subroutine final end module esmf_utils diff --git a/lilac/lilac/lilac.f90 b/lilac/lilac/lilac.f90 deleted file mode 100644 index b80c3c8616..0000000000 --- a/lilac/lilac/lilac.f90 +++ /dev/null @@ -1,59 +0,0 @@ -module lilac - - use ESMF - - use atmos_comp, only : atmos_setvm, atmos_register - use land_comp, only : land_setvm, land_register - use coupler_comp, only : usercpl_setvm, usercpl_register - - implicit none - - !-------------------------------------------------------------------------- - ! Public interfaces - !-------------------------------------------------------------------------- - public :: lilac_init - public :: lilac_run - public :: lilac_final - - type(LilacType), save :: lilac_obj - -contains - - type, public :: LilacType - private - - type(ESMFInfoType) :: esmf_info - - contains - procedure, public :: init => init - procedure, public :: run => run - procedure, public :: final => final - end type LilacType - -contains - - subroutine lilac_init(self) - implicit none - - print *, "lilac_init()" - - ! Initialize ESMF structures - call self%esmf_info%init("lilac") - - end subroutine lilac_init - - subroutine lilac_run(self) - implicit none - - call self%esmf_info%run() - - end subroutine lilac_run - - subroutine lilac_final(self) - implicit none - - call self%esmf_info%final() - - end subroutine lilac_final - -end module lilac From 9a1b5bdc46c2022ccbe884ac154c605d11a6c4a8 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 8 Oct 2018 12:16:16 -0700 Subject: [PATCH 0243/1973] fixup formatting --- lilac/lilac/core.f90 | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lilac/lilac/core.f90 b/lilac/lilac/core.f90 index 7feec6eac2..91ff33fd6c 100644 --- a/lilac/lilac/core.f90 +++ b/lilac/lilac/core.f90 @@ -62,7 +62,7 @@ subroutine init(self, name) character(len=*), parameter :: subname=trim(modname)//':(init) ' call ESMF_LogWrite(subname//"Initializing lilac", ESMF_LOGMSG_INFO) - + self%name = trim(name) ! Initialize ESMF structures @@ -151,10 +151,10 @@ subroutine cpl_register(comp, rc) ! Register the callback routines. call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=coupler_init, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=coupler_run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - + call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=coupler_final, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -164,7 +164,7 @@ subroutine cpl_register(comp, rc) end subroutine cpl_register -subroutine atmos_init(comp, importState, exportState, clock, rc) + subroutine atmos_init(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -177,9 +177,9 @@ subroutine atmos_init(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"atmos_init has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine atmos_init + end subroutine atmos_init -subroutine land_init(comp, importState, exportState, clock, rc) + subroutine land_init(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -192,9 +192,9 @@ subroutine land_init(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"land_init has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine land_init + end subroutine land_init -subroutine coupler_init(comp, importState, exportState, clock, rc) + subroutine coupler_init(comp, importState, exportState, clock, rc) type(ESMF_CplComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -207,9 +207,9 @@ subroutine coupler_init(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"coupler_init has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine coupler_init + end subroutine coupler_init -subroutine atmos_copy_atm_to_lilac(comp, importState, exportState, clock, rc) + subroutine atmos_copy_atm_to_lilac(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -222,9 +222,9 @@ subroutine atmos_copy_atm_to_lilac(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"atmos_copy_atm_to_lilac has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine atmos_copy_atm_to_lilac + end subroutine atmos_copy_atm_to_lilac -subroutine atmos_copy_lilac_to_atm(comp, importState, exportState, clock, rc) + subroutine atmos_copy_lilac_to_atm(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -237,9 +237,9 @@ subroutine atmos_copy_lilac_to_atm(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"atmos_copy_lilac_to_atm has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine atmos_copy_lilac_to_atm + end subroutine atmos_copy_lilac_to_atm -subroutine land_run(comp, importState, exportState, clock, rc) + subroutine land_run(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -252,9 +252,9 @@ subroutine land_run(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"land_run has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine land_run + end subroutine land_run -subroutine coupler_run(comp, importState, exportState, clock, rc) + subroutine coupler_run(comp, importState, exportState, clock, rc) type(ESMF_CplComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -267,9 +267,9 @@ subroutine coupler_run(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"coupler_run has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine coupler_run + end subroutine coupler_run -subroutine atmos_final(comp, importState, exportState, clock, rc) + subroutine atmos_final(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -282,9 +282,9 @@ subroutine atmos_final(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"atmos_final has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine atmos_final + end subroutine atmos_final -subroutine land_final(comp, importState, exportState, clock, rc) + subroutine land_final(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -297,9 +297,9 @@ subroutine land_final(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"land_final has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine land_final + end subroutine land_final -subroutine coupler_final(comp, importState, exportState, clock, rc) + subroutine coupler_final(comp, importState, exportState, clock, rc) type(ESMF_CplComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock @@ -312,6 +312,6 @@ subroutine coupler_final(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"coupler_final has not been implemented yet", ESMF_LOGMSG_INFO) -end subroutine coupler_final + end subroutine coupler_final end module lilac From 5473eb753849ad8677ddbb4703a887e2f06173c1 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 8 Oct 2018 13:25:44 -0700 Subject: [PATCH 0244/1973] autodoc fortran codes --- lilac/docs/api.rst | 8 ++++++- lilac/docs/conf.py | 27 +++++++++++++++++++++-- lilac/docs/developers.rst | 28 ++++++++++++++++++++++++ lilac/docs/index.rst | 45 +++++---------------------------------- 4 files changed, 65 insertions(+), 43 deletions(-) create mode 100644 lilac/docs/developers.rst diff --git a/lilac/docs/api.rst b/lilac/docs/api.rst index 6859fd3e1a..dac6446ce8 100644 --- a/lilac/docs/api.rst +++ b/lilac/docs/api.rst @@ -11,4 +11,10 @@ The atmosphere component will need to call each of the following subroutines: * `lilac_run` * `lilac_final` -TODO: fill in this section as the api comes together. +LILAC Core +---------- +.. f:autosrcfile:: core.f90 + +ESMF Utils +---------- +.. f:autosrcfile:: esmf_utils.f90 diff --git a/lilac/docs/conf.py b/lilac/docs/conf.py index 767f7287b1..f8c67d5d2b 100644 --- a/lilac/docs/conf.py +++ b/lilac/docs/conf.py @@ -12,7 +12,7 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os +import os # import sys # sys.path.insert(0, os.path.abspath('.')) @@ -39,7 +39,14 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.imgmath', + 'sphinx.ext.ifconfig', 'sphinx.ext.intersphinx', + 'sphinxfortran.fortran_domain', + 'sphinxfortran.fortran_autodoc', ] # Add any paths that contain templates here, relative to this directory. @@ -50,6 +57,7 @@ # # source_suffix = ['.rst', '.md'] source_suffix = '.rst' +fortran_src = '*f90' # The master toctree document. master_doc = 'index' @@ -161,4 +169,19 @@ # -- Options for intersphinx extension --------------------------------------- # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} \ No newline at end of file +intersphinx_mapping = {'https://docs.python.org/': None} + + +## -- Options for Sphinx-Fortran --------------------------------------------- +# List of possible extensions in the case of a directory listing +fortran_ext = ['f90', 'F90', 'f95', 'F95'] + +# This variable must be set with file pattern, like "*.f90", or a list of them. +# It is also possible to specify a directory name; in this case, all files than +# have an extension matching those define by the config variable `fortran_ext` +# are used. +fortran_src = [os.path.abspath('../lilac/')] + +# Indentation string or length (default 4). If it is an integer, +# indicates the number of spaces. +fortran_indent = 4 diff --git a/lilac/docs/developers.rst b/lilac/docs/developers.rst new file mode 100644 index 0000000000..f4910d80d6 --- /dev/null +++ b/lilac/docs/developers.rst @@ -0,0 +1,28 @@ +Developers Guide to Using LILAC +=============================== + +Building LILAC +-------------- + +LILAC can be build using CMake:: + + $ cd /lilac/build && cmake .. + $ make + +For development and testing purposes, LILAC can also be built using a +`docker-compose` script:: + + $ docker-compose build + $ docker-compose run + +Testing LILAC +------------- + +LILAC includes a full test suite including unit tests and a number of +simplified coupled model tests. To run these tests, simply run the `ctest` +command:: + + $ ctest + +Note, if you are using the docker-compose development, the `docker-compose run` +command will build and run LILAC automatically. diff --git a/lilac/docs/index.rst b/lilac/docs/index.rst index f6c4a09751..e7c7a097f7 100644 --- a/lilac/docs/index.rst +++ b/lilac/docs/index.rst @@ -4,48 +4,13 @@ LILAC: Lightweight Infrastructure for Land Atmosphere Coupling LILAC is a new coupling interface for the Community Terrestrial Systems Model (CTSM). It provides a high-level Fortran API for coupling CTSM to atmospheric models such as the Weather Research and Forecast (WRF) model. LILAC makes -extensive use of the Earth System Modeling Framework (ESMF). - -Building LILAC --------------- - -LILAC can be build using CMake. - - $ cd /lilac/build && cmake .. - $ make - -For development and testing purposes, LILAC can also be built using a -`docker-compose` script. - - $ docker-compose build - # docker-compose run - -Testing LILAC -------------- - -LILAC includes a full test suite including unit tests and a number of -simplified coupled model tests. To run these tests, simply run the `ctest` -command: - - $ ctest - -Note, if you are using the docker-compose development, the `docker-compose run` -command will build and run LILAC automatically. - - - - -More coming soon. +extensive use of the Earth System Modeling Framework (ESMF). .. toctree:: :maxdepth: 2 :caption: Contents: - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` +Contents +--------------- +* :doc:`developers` +* :doc:`api` From 09ad7d04e7da83cee3435253eb6f711e23c6184d Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 8 Oct 2018 13:31:19 -0700 Subject: [PATCH 0245/1973] add reqs for doc build --- lilac/.gitmodules | 2 ++ lilac/docs/requirements.txt | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 lilac/docs/requirements.txt diff --git a/lilac/.gitmodules b/lilac/.gitmodules index 2f471a14d9..3836c21e6b 100644 --- a/lilac/.gitmodules +++ b/lilac/.gitmodules @@ -1,6 +1,8 @@ [submodule "external/pfunit"] path = external/pfunit url = https://github.com/laristra/pfunit.git + shallow = true [submodule "external/esmf"] path = external/esmf url = https://git.code.sf.net/p/esmf/esmf + shallow = true diff --git a/lilac/docs/requirements.txt b/lilac/docs/requirements.txt new file mode 100644 index 0000000000..5edaa385f9 --- /dev/null +++ b/lilac/docs/requirements.txt @@ -0,0 +1,2 @@ +numpy +sphinx-fortran From ef3cb0c4e60787b21d50a278e4df7cf0b25a7886 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Mon, 8 Oct 2018 13:34:22 -0700 Subject: [PATCH 0246/1973] pip sphinx --- lilac/docs/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lilac/docs/requirements.txt b/lilac/docs/requirements.txt index 5edaa385f9..f3d707325c 100644 --- a/lilac/docs/requirements.txt +++ b/lilac/docs/requirements.txt @@ -1,2 +1,3 @@ numpy sphinx-fortran +sphinx==1.6.7 \ No newline at end of file From 8afc662a45c5d4d02db8ff6fbc1a4409b0d7a7dd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 7 Nov 2018 12:54:49 -0700 Subject: [PATCH 0247/1973] Add list of checks that should be done when making new surface datasets --- tools/mksurfdata_map/README.developers | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/mksurfdata_map/README.developers b/tools/mksurfdata_map/README.developers index 7b0ac50c5d..e896b989fd 100644 --- a/tools/mksurfdata_map/README.developers +++ b/tools/mksurfdata_map/README.developers @@ -14,6 +14,8 @@ I. Adding a new raw data file II. Adding mapping files for a raw data file with a new grid / landmask +III. Checks that should be done when making new surface datasets + ============================================================================ I. Adding a new raw data file ============================================================================ @@ -175,4 +177,27 @@ laid out here. don't use that, you'll need to add the files to the inputdata directory yourself +============================================================================ +III. Checks that should be done when making new surface datasets +============================================================================ + +Remaking all surface datasets carries the risk of introducing unintended +changes, particularly when you are expecting answer changes (so you +don't notice unintended answer changes that are mixed with the expected +changes). + +Here are some things to check after making a new set of surface +datasets: + +- For at least one global dataset (probably a production resolution + rather than a low resolution that is just used for testing): Compare + the new dataset against the previous version: + + - Compare header (via ncdump -h) and/or log file: ensure that the same + source data were used, except where you expect differences + + - Compare all fields with a tool like cprnc: make sure that the only + fields that differ are those you expect to differ + - Visually compare all fields that differ: make sure differences look + reasonable and as expected From 15d0cbed1f5cf6df649c7a05617f939377dc2bd0 Mon Sep 17 00:00:00 2001 From: Peter Lawrence Date: Thu, 8 Nov 2018 15:34:46 -0700 Subject: [PATCH 0248/1973] The logic of mksurfdata_map has been updated to include the glaciers as well as lakes and wetlands outside of the landmask with new code: < ! Assume wetland, glacier and/or lake when dataset landmask implies ocean < if (pctgla(n) < 1.e-6_r8) then < pctwet(n) = 100._r8 - pctlak(n) < pctgla(n) = 0._r8 < else < pctwet(n) = 100._r8 - pctgla(n) - pctlak(n) < end if from > ! Assume wetland and/or lake when dataset landmask implies ocean > pctwet(n) = 100._r8 - pctlak(n) > pctgla(n) = 0._r8 --- tools/mksurfdata_map/src/mksurfdat.F90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index 5089fabf7d..b7ee945511 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -704,16 +704,20 @@ program mksurfdat do n = 1,ns_o - ! Assume wetland and/or lake when dataset landmask implies ocean + ! Assume wetland, glacier and/or lake when dataset landmask implies ocean ! (assume medium soil color (15) and loamy texture). ! Also set pftdata_mask here if (pctlnd_pft(n) < 1.e-6_r8) then pftdata_mask(n) = 0 soicol(n) = 15 - pctwet(n) = 100._r8 - pctlak(n) + if (pctgla(n) < 1.e-6_r8) then + pctwet(n) = 100._r8 - pctlak(n) + pctgla(n) = 0._r8 + else + pctwet(n) = 100._r8 - pctgla(n) - pctlak(n) + end if pcturb(n) = 0._r8 - pctgla(n) = 0._r8 call pctnatpft(n)%set_pct_l2g(0._r8) call pctcft(n)%set_pct_l2g(0._r8) pctsand(n,:) = 43._r8 From ef8a97d2441fa535d21a6eda7548becc5173d63d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 9 Nov 2018 14:56:32 -0700 Subject: [PATCH 0249/1973] Add a bunch of ignore patterns for vim From https://github.com/github/gitignore/blob/master/Global/Vim.gitignore Motivated by the fact that a .swp file appeared in a PR. We probably don't need all of these, but it looks like they should be safe to include (i.e., I can't imagine a real file having a name like one of these patterns, given that most of them begin with '.' or '_'). --- .gitignore | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitignore b/.gitignore index d8000a5537..e5b448c04d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,23 @@ manage_externals.log *.swp *~ +# vim files (from https://github.com/github/gitignore/blob/master/Global/Vim.gitignore) +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] +# Session +Session.vim +# Temporary +.netrwhist +# (removed *~ because it is listed above) +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + # mac files .DS_Store From 59b944b42116d8b7df686347c7d4e191c0032fa0 Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Wed, 14 Nov 2018 17:34:10 -0800 Subject: [PATCH 0250/1973] bare bones test, no moving data yet --- lilac/.gitignore | 1 + lilac/CMakeLists.txt | 2 +- lilac/Dockerfile | 12 +- lilac/docker-compose.yml | 1 - lilac/lilac/core.f90 | 1 + lilac/tests/CMakeLists.txt | 3 +- lilac/tests/hello_world/CMakeLists.txt | 3 - lilac/tests/hello_world/main.f90 | 21 ---- lilac/tests/rand_atm_rand_lnd/CmakeLists.txt | 7 +- lilac/tests/rand_atm_rand_lnd/main.f90 | 15 +++ lilac/tests/rand_atm_rand_lnd/rand_test.f90 | 112 +++++++++++++++++++ 11 files changed, 140 insertions(+), 38 deletions(-) delete mode 100644 lilac/tests/hello_world/CMakeLists.txt delete mode 100644 lilac/tests/hello_world/main.f90 create mode 100644 lilac/tests/rand_atm_rand_lnd/rand_test.f90 diff --git a/lilac/.gitignore b/lilac/.gitignore index 21537a4ee9..6e5803401e 100644 --- a/lilac/.gitignore +++ b/lilac/.gitignore @@ -14,3 +14,4 @@ components/ *.pyc build/ +_build/ diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 4268ea956d..10630051ce 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -31,7 +31,7 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") # TODO: This should not be necessary but certain header files are missing from the build -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include -I/usr/src/lilac/external/esmf/build_config/Linux.gfortran.default -I /usr/src/lilac/external/esmf/src/include") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I /usr/src/esmf/src/include") message("CMAKE_Fortran_FLAGS:" ${CMAKE_Fortran_FLAGS}) add_subdirectory(lilac) diff --git a/lilac/Dockerfile b/lilac/Dockerfile index bebcc00428..cdd4200a64 100644 --- a/lilac/Dockerfile +++ b/lilac/Dockerfile @@ -1,19 +1,17 @@ -FROM centos:latest +FROM jhamman/esmf:latest LABEL description="LILAC development environment" RUN yum install -y curl RUN yum upgrade -y RUN yum update -y RUN yum clean all -RUN yum -y install wget bzip2 gcc gcc-c++ gcc-gfortran mpich-devel make git -ENV PATH="/usr/lib64/mpich/bin:${PATH}" +RUN yum -y install wget bzip2 WORKDIR /usr/src/lilac/ RUN mkdir -p external RUN mkdir -p ci -COPY external/esmf external/esmf COPY external/pfunit external/pfunit COPY ci/* ci/ @@ -21,10 +19,8 @@ COPY ci/* ci/ ENV PATH /usr/local/miniconda/bin:$PATH RUN ./ci/install_python.sh -# Install ESMF -RUN ./ci/install_esmf.sh ENV ESMF_CONFIG_FILE /usr/local/lib/esmf.mk # Install PFUNIT -# RUN ./ci/install_pfunit.sh -# ENV PFUNIT_INSTALL /usr/pfunit +RUN ./ci/install_pfunit.sh +ENV PFUNIT_INSTALL /usr/pfunit diff --git a/lilac/docker-compose.yml b/lilac/docker-compose.yml index 422b0bc607..8bd538f458 100644 --- a/lilac/docker-compose.yml +++ b/lilac/docker-compose.yml @@ -7,4 +7,3 @@ services: volumes: - .:/lilac command: /lilac/ci/build_and_test_lilac.sh - diff --git a/lilac/lilac/core.f90 b/lilac/lilac/core.f90 index 91ff33fd6c..ced01bb32c 100644 --- a/lilac/lilac/core.f90 +++ b/lilac/lilac/core.f90 @@ -6,6 +6,7 @@ module lilac implicit none character(*), parameter :: modname = "(core)" + integer, parameter :: LILAC_SUCCESS = ESMF_SUCCESS !-------------------------------------------------------------------------- ! Public interfaces diff --git a/lilac/tests/CMakeLists.txt b/lilac/tests/CMakeLists.txt index 6361d9e9c2..7de7443322 100644 --- a/lilac/tests/CMakeLists.txt +++ b/lilac/tests/CMakeLists.txt @@ -1,2 +1,3 @@ # Add tests here -add_subdirectory(hello_world) +add_subdirectory(rand_atm_rand_lnd) +target_include_directories(lilac PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/lilac/tests/hello_world/CMakeLists.txt b/lilac/tests/hello_world/CMakeLists.txt deleted file mode 100644 index 0e5fbd44bc..0000000000 --- a/lilac/tests/hello_world/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file(GLOB_RECURSE SOURCES *.f90 *.h) -add_executable("test_hello_world" ${SOURCES} ) -target_link_libraries(lilac) diff --git a/lilac/tests/hello_world/main.f90 b/lilac/tests/hello_world/main.f90 deleted file mode 100644 index 78312075c1..0000000000 --- a/lilac/tests/hello_world/main.f90 +++ /dev/null @@ -1,21 +0,0 @@ -program main - - ! modules - use ESMF - ! use lilac, ONLY : lilac_init - - implicit none - - ! local variables - integer:: rc - - ! call lilac_init() - ! TODO fix linking with lilac - call ESMF_Initialize(rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT) - - print *, "Hello LILAC World" - - call ESMF_Finalize() - -end program main diff --git a/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt b/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt index c7c253746b..f7b14fc7d5 100644 --- a/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt +++ b/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt @@ -1,4 +1,5 @@ -file(GLOB TEST_SOURCES *.f90 *.h) -add_executable(rand_atm_rand_land ${TEST_SOURCES} ) -target_link_libraries(rand_atm_rand_land) +file(GLOB_RECURSE SOURCES *.f90 *.h) +add_executable("rand_atm_rand_land" ${SOURCES}) +target_link_libraries(rand_atm_rand_land lilac) +target_include_directories(lilac PUBLIC ${CMAKE_BINARY_DIR}/lilac) diff --git a/lilac/tests/rand_atm_rand_lnd/main.f90 b/lilac/tests/rand_atm_rand_lnd/main.f90 index f0c343cc4f..3d0284eab2 100644 --- a/lilac/tests/rand_atm_rand_lnd/main.f90 +++ b/lilac/tests/rand_atm_rand_lnd/main.f90 @@ -1,5 +1,20 @@ program main + use rand_test, only : atm_driver + use ESMF + implicit none + + ! local variables + integer:: rc + + rc = 0 + print *, "Running Atmosphere Driver" + + call atm_driver(rc) + + if (rc /= ESMF_SUCCESS) stop 1 + + print *, "Done Running Atmosphere Driver" end program main diff --git a/lilac/tests/rand_atm_rand_lnd/rand_test.f90 b/lilac/tests/rand_atm_rand_lnd/rand_test.f90 new file mode 100644 index 0000000000..70263d243c --- /dev/null +++ b/lilac/tests/rand_atm_rand_lnd/rand_test.f90 @@ -0,0 +1,112 @@ +module rand_test + + use lilac, only : LilacType + use ESMF + + implicit none + + character(*), parameter :: modname = "(rand_test)" + integer, parameter :: num_timesteps = 10 + type(LilacType), save :: lilac_obj + + !-------------------------------------------------------------------------- + ! Public interfaces + !-------------------------------------------------------------------------- + public :: atm_driver + + private :: atm_init + private :: lnd_init + private :: atm_run + private :: lnd_run + private :: atm_final + private :: lnd_final + +contains + + subroutine atm_driver(rc) + + integer, intent(out) :: rc + + + call atm_init(rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call atm_run(rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + + call atm_final(rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + end subroutine atm_driver + + subroutine atm_init(rc) + + integer, intent(out) :: rc + + ! Initialize atmosphere + ! TODO + + ! Initialize land via lilac + call lnd_init(rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + end subroutine atm_init + + + subroutine lnd_init(rc) + + integer, intent(out) :: rc + character(len=ESMF_MAXSTR), parameter :: lilac_name="lilac_rand_test" + + call lilac_obj%init(lilac_name) + + + end subroutine lnd_init + + + subroutine atm_run(rc) + + integer, intent(out) :: rc + + integer :: n + + ! Run atm for num_timesteps + do n = 1, num_timesteps, 1 + print *, "------ Running land -------" + ! Run land via lilac + call lnd_run(rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + end do + + end subroutine atm_run + + + subroutine lnd_run(rc) + + integer, intent(out) :: rc + + call lilac_obj%run() + + + end subroutine lnd_run + + + subroutine atm_final(rc) + + integer, intent(out) :: rc + + + end subroutine atm_final + + + subroutine lnd_final(rc) + + integer, intent(out) :: rc + + call lilac_obj%final() + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + end subroutine lnd_final + +end module rand_test From 763817cbe6e221b4d9dfb9146abfcafd8c2f10ed Mon Sep 17 00:00:00 2001 From: Joseph Hamman Date: Wed, 14 Nov 2018 22:22:56 -0800 Subject: [PATCH 0251/1973] adjust name of random test --- lilac/ci/build_and_test_lilac.sh | 6 +++++- lilac/tests/rand_atm_rand_lnd/CmakeLists.txt | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lilac/ci/build_and_test_lilac.sh b/lilac/ci/build_and_test_lilac.sh index 3b7fca20f5..6ed3c17e6e 100755 --- a/lilac/ci/build_and_test_lilac.sh +++ b/lilac/ci/build_and_test_lilac.sh @@ -16,4 +16,8 @@ make VERBOSE=1 # -j 4 echo "done building lilac, time to run the tests..." # run test suite -ctest \ No newline at end of file +ctest + +# run system tests +# TODO: these should probably be run via ctest +/lilac/build/tests/rand_atm_rand_lnd/rand_atm_rand_lnd \ No newline at end of file diff --git a/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt b/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt index f7b14fc7d5..5807d75fb0 100644 --- a/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt +++ b/lilac/tests/rand_atm_rand_lnd/CmakeLists.txt @@ -1,5 +1,5 @@ file(GLOB_RECURSE SOURCES *.f90 *.h) -add_executable("rand_atm_rand_land" ${SOURCES}) -target_link_libraries(rand_atm_rand_land lilac) +add_executable("rand_atm_rand_lnd" ${SOURCES}) +target_link_libraries(rand_atm_rand_lnd lilac) target_include_directories(lilac PUBLIC ${CMAKE_BINARY_DIR}/lilac) From 8c06df6ccaeaf905950156c6e64a5531e525683f Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 7 Dec 2018 16:24:11 -0700 Subject: [PATCH 0252/1973] Add new raw urban surface dataset and building temperature stream file as default. These datasets are documented in Oleson and Feddema, 2018, submitted to JAMES on 12/6/18. --- bld/namelist_files/namelist_defaults_clm4_5.xml | 2 +- bld/namelist_files/namelist_defaults_clm4_5_tools.xml | 2 +- src/main/clm_varpar.F90 | 2 +- tools/mksurfdata_map/mksurfdata_map.namelist | 2 +- tools/mksurfdata_map/src/mkvarpar.F90 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 97dc6a9171..3cbb5b9817 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -1119,7 +1119,7 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc1850 2106 -lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc +lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c181017.nc lnd/clm2/urbandata/CLM45_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc diff --git a/bld/namelist_files/namelist_defaults_clm4_5_tools.xml b/bld/namelist_files/namelist_defaults_clm4_5_tools.xml index 0683f52b88..a26ec5d06c 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5_tools.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5_tools.xml @@ -237,7 +237,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/rawdata/mksrf_urban_0.05x0.05_simyr2000.c120621.nc +>lnd/clm2/rawdata/mksrf_urban_0.05x0.05_simyr2000.c170724.nc lnd (cpl_atm2lnd) + ! 2- coupler 2 : lnd ---> atm (cpl_lnd2atm) + !----------------------------------------------------------------------- + use ESMF implicit none private - type(ESMF_RouteHandle), save :: rh_atm2lnd, rh_lnd2atm - - public cpl_atm2lnd_register public cpl_lnd2atm_register character(*), parameter :: modname = " cpl_mod" + type(ESMF_RouteHandle), save :: rh_atm2lnd, rh_lnd2atm - contains + !----------------------------------------------------------------------- + contains + !----------------------------------------------------------------------- subroutine cpl_atm2lnd_register(cplcomp, rc) - type(ESMF_CplComp) :: cplcomp - integer, intent(out) :: rc - character(len=*), parameter :: subname=trim(modname)//':[cpl_atm2lnd_register] ' + type(ESMF_CplComp ) :: cplcomp + integer, intent(out ) :: rc + character(len=* ) , parameter :: subname=trim(modname ) //':[cpl_atm2lnd_register] ' rc = ESMF_SUCCESS print *, "in cpl_atm2lnd_register routine" ! Register the callback routines. ! Set the entry points for coupler ESMF Component methods - !call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine=cpl_atm2lnd_init, rc=rc) call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine= cpl_atm2lnd_init, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_atm2lnd_run , rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_atm2lnd_final, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - end subroutine cpl_atm2lnd_register subroutine cpl_lnd2atm_register(cplcomp, rc) - type(ESMF_CplComp) :: cplcomp - integer, intent(out) :: rc - character(len=*), parameter :: subname=trim(modname)//' : [cpl_lnd2atm_register] ' + type(ESMF_CplComp ) :: cplcomp + integer, intent(out ) :: rc + character(len=* ) , parameter :: subname=trim(modname ) //' : [cpl_lnd2atm_register] ' rc = ESMF_SUCCESS @@ -47,64 +54,29 @@ subroutine cpl_lnd2atm_register(cplcomp, rc) ! Register the callback routines. ! Set the entry points for coupler ESMF Component methods - !call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine=cpl_lnd2atm_init, rc=rc) call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, cpl_lnd2atm_init, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_lnd2atm_run , rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_lnd2atm_final, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - end subroutine cpl_lnd2atm_register !-------------------------------------------------------------------------- + ! couplers init.... !-------------------------------------------------------------------------- - subroutine cpl_lnd2atm_init(cplcomp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: cplcomp - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle - - character(len=*), parameter :: subname=trim(modname)//': [cpl_lnd2atm_init] ' - - rc = ESMF_SUCCESS - print *, "Coupler for land to atmosphere initialize routine called" - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - - call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - - call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! For Redisting - !call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! For ReGridding - call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - !call ESMF_StateGet(importState, itemname="a2c_fb", item=import_fieldbundle, rc=rc) - !if (chkerr(rc,__LINE__,u_FILE_u)) return - !call ESMF_StateGet(exportState, itemname="c2a_fb", item=export_fieldbundle, rc=rc) - !if (chkerr(rc,__LINE__,u_FILE_u)) return - !call ESMF_FieldRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - !if (chkerr(rc,__LINE__,u_FILE_u)) return - end subroutine cpl_lnd2atm_init - subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: cplcomp - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle - character(len=*), parameter :: subname=trim(modname)//': [cpl_atm2lnd_init] ' + type (ESMF_CplComp ) :: cplcomp + type (ESMF_State ) :: importState + type (ESMF_State ) :: exportState + type (ESMF_Clock ) :: clock + type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle + integer, intent(out ) :: rc + character(len=* ) , parameter :: subname=trim(modname) //': [cpl_atm2lnd_init] ' rc = ESMF_SUCCESS print *, "Coupler for atmosphere to land initialize routine called" @@ -112,41 +84,28 @@ subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) call ESMF_StateGet(importState, "a2c_fb", import_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) call ESMF_StateGet(exportState, "c2l_fb", export_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"redisting !", ESMF_LOGMSG_INFO) - - ! For Redisting - !call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! For ReGridding - call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - call ESMF_LogWrite(subname//"regridding !", ESMF_LOGMSG_INFO) + call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) end subroutine cpl_atm2lnd_init - !-------------------------------------------------------------------------- - !-------------------------------------------------------------------------- - - subroutine cpl_lnd2atm_run(cplcomp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: cplcomp - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle + subroutine cpl_lnd2atm_init(cplcomp, importState, exportState, clock, rc) - character(len=*), parameter :: subname=trim(modname)//': [cpl_lnd2atm_run] ' + type (ESMF_CplComp ) :: cplcomp + type (ESMF_State ) :: importState + type (ESMF_State ) :: exportState + type (ESMF_Clock ) :: clock + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + integer, intent(out ) :: rc + character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_lnd2atm_init] ' rc = ESMF_SUCCESS - + print *, "Coupler for land to atmosphere initialize routine called" call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - print *, "Running cpl_lnd2atm_run" call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -154,32 +113,28 @@ subroutine cpl_lnd2atm_run(cplcomp, importState, exportState, clock, rc) call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !call ESMF_StateGet(importState, itemname=importStateName, item=srcFieldBundle, rc=rc) - !if (chkerr(rc,__LINE__,u_FILE_u)) return - !call ESMF_StateGet(exportState, itemname=exportStateName, item=dstFieldBundle, rc=rc) - !if (chkerr(rc,__LINE__,u_FILE_u)) return - !call ESMF_FieldBundleRegrid(srcFieldBundle, dstFieldBundle, rh_lnd2atm, rc=rc) - call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//" regridding fieldbundles from land to atmos!", ESMF_LOGMSG_INFO) - !routehandle, zeroregion, termorderflag, checkflag, rc) - end subroutine cpl_lnd2atm_run + call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) + end subroutine cpl_lnd2atm_init + + !-------------------------------------------------------------------------- + ! Couplers Run phase + !-------------------------------------------------------------------------- subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: cplcomp - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle - character(len=*), parameter :: subname=trim(modname)//': [cpl_atm2lnd_run] ' + type(ESMF_CplComp ) :: cplcomp + type(ESMF_State ) :: importState + type(ESMF_State ) :: exportState + type(ESMF_Clock ) :: clock + integer, intent(out ) :: rc + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_run] ' rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) print *, "Running cpl_atm2lnd_run" - + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) call ESMF_StateGet(importState, trim("a2c_fb"), import_fieldbundle, rc=rc) !call ESMF_StateGet(importState, itemName=trim("a2c_fb"), item=import_fieldbundle, rc=rc) ! this syntax was not working??? @@ -189,61 +144,89 @@ subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) call ESMF_StateGet(exportState, trim("c2l_fb"), export_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//" got c2l fieldbundle!", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - - !call ESMF_StateGet(importState, itemname=importStateName, item=srcFieldBundle, rc=rc) - !if (chkerr(rc,__LINE__,u_FILE_u)) return - !call ESMF_StateGet(exportState, itemname=exportStateName, item=dstFieldBundle, rc=rc) - !if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//" regridding fieldbundles from atmos to land!", ESMF_LOGMSG_INFO) + end subroutine cpl_atm2lnd_run - !routehandle, zeroregion, termorderflag, checkflag, rc) - end subroutine cpl_atm2lnd_run - subroutine cpl_lnd2atm_final(cplcomp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: cplcomp - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle + subroutine cpl_lnd2atm_run(cplcomp, importState, exportState, clock, rc) - character(len=*), parameter :: subname=trim(modname)//': [cpl_lnd2atm_final] ' + type(ESMF_CplComp ) :: cplcomp + type(ESMF_State ) :: importState + type(ESMF_State ) :: exportState + type(ESMF_Clock ) :: clock + integer, intent(out ) :: rc + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_lnd2atm_run] ' rc = ESMF_SUCCESS + print *, "Running cpl_lnd2atm_run" + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - ! Only thing to do here is release redist (or regrid) and route handles - call ESMF_FieldBundleRegridRelease (routehandle=rh_lnd2atm , rc=rc) + call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//" rh_lnd2atm route handle released!", ESMF_LOGMSG_INFO) - end subroutine cpl_lnd2atm_final + call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//" regridding fieldbundles from land to atmos!", ESMF_LOGMSG_INFO) + end subroutine cpl_lnd2atm_run + + !-------------------------------------------------------------------------- + ! couplers final phase + !-------------------------------------------------------------------------- subroutine cpl_atm2lnd_final(cplcomp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: cplcomp - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle - character(len=*), parameter :: subname=trim(modname)//': [cpl_atm2lnd_final] ' + type (ESMF_CplComp ) :: cplcomp + type (ESMF_State ) :: importState + type (ESMF_State ) :: exportState + type (ESMF_Clock ) :: clock + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + integer, intent(out ) :: rc + character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_final] ' rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) + ! Only thing to do here is release redist (or regrid) and route handles call ESMF_FieldBundleRegridRelease (routehandle=rh_atm2lnd, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) call ESMF_LogWrite(subname//" rh_atm2lnd route handle released!", ESMF_LOGMSG_INFO) + end subroutine cpl_atm2lnd_final + subroutine cpl_lnd2atm_final(cplcomp, importState, exportState, clock, rc) + + type (ESMF_CplComp ) :: cplcomp + type (ESMF_State ) :: importState + type (ESMF_State ) :: exportState + type (ESMF_Clock ) :: clock + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + integer, intent(out ) :: rc + character(len=* ) , parameter :: subname=trim(modname) //': [cpl_lnd2atm_final] ' + + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) + ! Only thing to do here is release redist (or regrid) and route handles + call ESMF_FieldBundleRegridRelease (routehandle=rh_lnd2atm , rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_LogWrite(subname//" rh_lnd2atm route handle released!", ESMF_LOGMSG_INFO) + + end subroutine cpl_lnd2atm_final + + + From 070f6cc81c76fc325f7483fb0034b5024cd61653 Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 6 May 2019 15:25:30 -0600 Subject: [PATCH 0308/1973] saving this version of the code.... --- lilac/scripts/atmos_cap.F90 | 6 ++++- lilac/scripts/demo_driver.F90 | 2 +- lilac/scripts/lilac_mod.F90 | 16 ------------- lilac/scripts/lilac_utils.F90 | 42 +++++++++++++++++++++-------------- lilac/scripts/lnd_cap.F90 | 4 ++-- 5 files changed, 33 insertions(+), 37 deletions(-) diff --git a/lilac/scripts/atmos_cap.F90 b/lilac/scripts/atmos_cap.F90 index 14879732a2..8d255aeb8f 100644 --- a/lilac/scripts/atmos_cap.F90 +++ b/lilac/scripts/atmos_cap.F90 @@ -96,7 +96,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if(mesh_switch) then ! For now this is our dummy mesh: - atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' + !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' + atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc' atmos_mesh = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -128,6 +129,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) a2c_fb = ESMF_FieldBundleCreate(name="a2c_fb", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"field bundle", ESMF_LOGMSG_INFO) ! Create individual fields and add to field bundle -- a2l @@ -145,6 +147,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) !field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(a2c_fldlist(n)%stdname), rc=rc) field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out ! add field to field bundle call ESMF_FieldBundleAdd(a2c_fb, (/field/), rc=rc) diff --git a/lilac/scripts/demo_driver.F90 b/lilac/scripts/demo_driver.F90 index b984da4016..776723cc8b 100644 --- a/lilac/scripts/demo_driver.F90 +++ b/lilac/scripts/demo_driver.F90 @@ -47,7 +47,7 @@ program demo_lilac_driver ! real atmosphere: begc = 1 - endc = 4608 + endc = 13824 start_time = 1 end_time = 10 diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/scripts/lilac_mod.F90 index 2c6d7fb20d..4dc2720c80 100644 --- a/lilac/scripts/lilac_mod.F90 +++ b/lilac/scripts/lilac_mod.F90 @@ -355,22 +355,6 @@ subroutine lilac_final( ) use atmos_cap, only : a2c_fldlist, c2a_fldlist use lnd_cap, only : l2c_fldlist, c2l_fldlist - ! type(fld_list_type) :: a2c_fldlist , c2a_fldlist - ! input/output variables - !type(atm2lnd_data1d_type), intent(in), optional :: atm2lnd1d - !type(atm2lnd_data2d_type), intent(in), optional :: atm2lnd2d - !type(lnd2atm_data1d_type), intent(in), optional :: lnd2atm1d - !type(lnd2atm_data2d_type), intent(in), optional :: lnd2atm2d - - ! local variables - ! ! Gridded Components and Coupling Components - !type(ESMF_GridComp) :: dummy_atmos_comp - !type(ESMF_GridComp) :: dummy_land_comp - - !integer, parameter :: fldsMax = 100 - !integer :: fldsToLnd_num = 0 - !integer :: fldsFrLnd_num = 0 - character(len=*), parameter :: subname=trim(modname)//': [lilac_final]' type(ESMF_State) :: importState, exportState diff --git a/lilac/scripts/lilac_utils.F90 b/lilac/scripts/lilac_utils.F90 index 266b654532..4f26bae49b 100644 --- a/lilac/scripts/lilac_utils.F90 +++ b/lilac/scripts/lilac_utils.F90 @@ -1,12 +1,19 @@ module lilac_utils -use ESMF -implicit none -!!! NS: THIS IS FROM JH WORK - integer, parameter :: fldsMax = 100 + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! + !!! NS: THIS IS FROM JH WORK + + use ESMF + + implicit none public fldlist_add , create_fldlists + integer, parameter :: fldsMax = 100 + + ! !PUBLIC TYPES: type :: fld_list_type character(len=128) :: stdname real*8 :: default_value @@ -15,7 +22,7 @@ module lilac_utils real(ESMF_KIND_R8), pointer :: farrayptr2d(:,:) ! this will be filled in by lilac when it gets its data from the host atm end type fld_list_type -!!! 1d for when we have mesh and 2d for when we have grids.... + !!! 1d for when we have mesh and 2d for when we have grids.... type :: atm2lnd_data1d_type real*8, pointer :: uwind (:) @@ -41,9 +48,9 @@ module lilac_utils real*8, pointer :: tauy (:,:) end type lnd2atm_data2d_type -!=============================================================================== + !=============================================================================== contains -!=============================================================================== + !=============================================================================== subroutine fldlist_add(num, fldlist, stdname, default_value, units) ! This adds a field to a fieldlist! @@ -55,7 +62,7 @@ subroutine fldlist_add(num, fldlist, stdname, default_value, units) ! local variables integer :: rc - character(len=*), parameter :: subname='(fldlist_add)' + character(len=*), parameter :: subname='(fldlist_add)' !------------------------------------------------------------------------------- ! Set up a list of field information @@ -79,21 +86,22 @@ subroutine fldlist_add(num, fldlist, stdname, default_value, units) end subroutine fldlist_add - subroutine create_fldlists(fldsFrCpl, fldsToCpl, fldsToCpl_num, fldsFrCpl_num) - ! add all the necessary fields one by one to the fieldlist - type(fld_list_type), intent(inout) :: fldsFrCpl(:) - type(fld_list_type), intent(inout) :: fldsToCpl(:) - !integer, intent(out) :: fldsToCpl_num = 0 - !integer, intent(out) :: fldsFrCpl_num = 0 + subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist ) + ! add all the necessary fields one by one to the fieldlist + type(fld_list_type), intent(inout) :: a2c_fldlist + type(fld_list_type), intent(inout) :: c2a_fldlist + type(fld_list_type), intent(inout) :: l2c_fldlist + type(fld_list_type), intent(inout) :: c2l_fldlist + integer :: fldsFrCpl_num, fldsToCpl_num ! from atm - call fldlist_add(fldsToCpl_num, fldsToCpl, 'atmos2lnd_var', default_value=0.0, units='m') + !call fldlist_add(fldsToCpl_num, fldsToCpl, 'atmos2lnd_var', default_value=0.0, units='m') ! from lnd - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'lnd2atmos_var', default_value=0.0, units='m') - + !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'lnd2atmos_var', default_value=0.0, units='m') + ! sets the module variable memory in atmos_cap.F9 print *, a2c_fldlist(1)%stdname !!! First from atmosphere to land fields ! import fields ! call fldlist_add(fldsFrCpl_num, fldsFrCpl, trim(flds_scalar_name)) diff --git a/lilac/scripts/lnd_cap.F90 b/lilac/scripts/lnd_cap.F90 index 7fddc79ac9..5c5a22f39c 100644 --- a/lilac/scripts/lnd_cap.F90 +++ b/lilac/scripts/lnd_cap.F90 @@ -94,8 +94,8 @@ subroutine lnd_init(comp, atm2lnd_l_state, lnd2atm_l_state, clock, rc) print *, "creating mesh for land" ! For now this is our dummy mesh: !lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T62_040121_ESMFmesh.nc' - lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' - + !lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' + lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' lnd_mesh = ESMF_MeshCreate(filename=trim(lnd_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Mesh for land is created!", ESMF_LOGMSG_INFO) From f060fde94431ffbc4ae291513f10ce684f83d8fc Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 14 May 2019 13:20:16 -0600 Subject: [PATCH 0309/1973] saving checkpoint using data types before restructuring to lilac_utils.F90 --- lilac/scripts/lilac_mod.F90 | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/scripts/lilac_mod.F90 index 4dc2720c80..1b3f4e6a48 100644 --- a/lilac/scripts/lilac_mod.F90 +++ b/lilac/scripts/lilac_mod.F90 @@ -90,8 +90,13 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) allocate (l2c_fldlist(l2a_fldnum)) allocate (c2l_fldlist(a2l_fldnum)) print *, "creating empty field lists !" - ! call create_fldlists(c2a_fldlist, a2c_fldlist, a2l_fldnum, l2a_fldnum) - !call create_fldlists(flds_a2l, fldsfldsToCpl, fldsToCpl_num, fldsFrCpl_num) + + ! ======================================================================= ! maybe move to create_fldlist? + ! call create_fldlists(c2a_fldlist, a2c_fldlist, ) + + !------------------------------------------------------------------------- + ! !---- from atm ----! a2c_fldlist & c2l_fldlist + !------------------------------------------------------------------------- a2c_fldlist(1)%stdname = 'uwind' a2c_fldlist(1)%farrayptr1d => atm2lnd1d%uwind !*** this now sets the module variable memory in atmos_cap.F90 @@ -107,21 +112,21 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) !print *, a2c_fldlist(3)%farrayptr1d + !!! Where should these point to? pointer to an empty array which will be filled in the land.... + ! Similary we need c2a_fldlist c2l_fldlist(1)%stdname = 'uwind' - !c2l_fldlist(1)%farrayptr1d => lnd2atm1d%lwup !*** this now sets the module variable memory in atmos_cap.F90 print *, c2l_fldlist(1)%stdname c2l_fldlist(2)%stdname = 'vwind' - !c2l_fldlist(2)%farrayptr1d => lnd2atm1d%taux !*** this now sets the module variable memory in atmos_cap.F90 print *, c2l_fldlist(1)%stdname c2l_fldlist(3)%stdname = 'tbot' - !c2l_fldlist(3)%farrayptr1d => lnd2atm1d%tauy print *, c2l_fldlist(1)%stdname + !------------------------------------------------------------------------- + ! !---- from land ----! l2c_fldlist & c2a_fldlist + !------------------------------------------------------------------------- - !!! Where should these point to? pointer to an empty array which will be filled in the land.... - l2c_fldlist(1)%stdname = 'lwup' l2c_fldlist(1)%farrayptr1d => lnd2atm1d%lwup print *, l2c_fldlist(1)%stdname @@ -144,6 +149,8 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) c2a_fldlist(3)%stdname = 'tauy' print *, c2a_fldlist(3)%stdname + ! ======================================================================= ! create_fldlist + !------------------------------------------------------------------------- ! Create Gridded Component! --- dummy atmosphere ( atmos_cap) !------------------------------------------------------------------------- From 22ec34d64ccf3a33d98fc5f8692982c74e77b053 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 15 May 2019 13:40:10 -0600 Subject: [PATCH 0310/1973] cleaning the code up! --- lilac/scripts/atmos_cap.F90 | 30 +++++++++++++----------------- lilac/scripts/demo_driver.F90 | 24 +++++++++++------------- lilac/scripts/lilac_mod.F90 | 20 +++++++++----------- 3 files changed, 33 insertions(+), 41 deletions(-) diff --git a/lilac/scripts/atmos_cap.F90 b/lilac/scripts/atmos_cap.F90 index 8d255aeb8f..2973cd1f17 100644 --- a/lilac/scripts/atmos_cap.F90 +++ b/lilac/scripts/atmos_cap.F90 @@ -1,9 +1,11 @@ module atmos_cap + !----------------------------------------------------------------------- + ! !DESCRIPTION: + + ! !USES use ESMF use lilac_utils - !use lilac_mod, only : a2c_fldlist - implicit none @@ -15,26 +17,21 @@ module atmos_cap type(fld_list_type), public, allocatable :: c2a_fldlist(:) type(fld_list_type), public, allocatable :: a2c_fldlist(:) - !type(fld_list_type), allocatable :: c2a_fldlist(:) - !type(fld_list_type), allocatable :: a2c_fldlist(:) - !type (fld_list_type) :: a2c_fldlist(fldsMax) !type (fld_list_type) :: c2a_fldlist(fldsMax) + integer :: a2c_fldlist_num integer :: c2a_fldlist_num !private public :: atmos_register - !public :: add_fields - !public :: import_fields - !public :: export_fields - real(kind=ESMF_KIND_R4), dimension(:), public, pointer, save :: fldptr - - !------------------------------------------------------------------------ + !real(kind=ESMF_KIND_R8), dimension(:), public, pointer, save :: fldptr + !======================================================================== contains + !======================================================================== subroutine atmos_register (comp, rc) @@ -79,9 +76,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) type(ESMF_DistGrid) :: distgridIN, distgridFS logical :: mesh_switch character(len=*), parameter :: subname=trim(modname)//': [atmos_init] ' - !---------------------- - - !integer :: regDecomp(:,:) + !integer :: regDecomp(:,:) + !------------------------------------------------------------------------- ! Initialize return code rc = ESMF_SUCCESS call ESMF_LogWrite(subname//"------------------------!", ESMF_LOGMSG_INFO) @@ -96,7 +92,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if(mesh_switch) then ! For now this is our dummy mesh: - !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' + !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' !! Negin: This did not work.... atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc' atmos_mesh = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) @@ -105,7 +101,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) print *, "!Mesh for atmosphere is created!" else - !Grid1= ESMF_GridCreateNoPeriDimUfrmR( maxIndex=(/180,360 /), & + !atmos_grid= ESMF_GridCreateNoPeriDimUfrmR( maxIndex=(/180,360 /), & ! minCornerCoord=(/0._ESMF_KIND_R8, 0._ESMF_KIND_R8/), & ! maxCornerCoord=(/180._ESMF_KIND_R8, 360._ESMF_KIND_R8/), & ! regDecomp=(/petcount,1/), rc=rc) @@ -129,7 +125,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) a2c_fb = ESMF_FieldBundleCreate(name="a2c_fb", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"field bundle", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"field bundle", ESMF_LOGMSG_INFO) ! Create individual fields and add to field bundle -- a2l diff --git a/lilac/scripts/demo_driver.F90 b/lilac/scripts/demo_driver.F90 index 776723cc8b..4681acd276 100644 --- a/lilac/scripts/demo_driver.F90 +++ b/lilac/scripts/demo_driver.F90 @@ -57,24 +57,22 @@ program demo_lilac_driver n = endc - begc + 1 - ! making 2 random arrays with a seed. - call random_seed (size = n) - allocate (seed(n)) ; seed (:) = seed_val - call random_seed (put = seed) - allocate (rand1(begc:endc)) ; call random_number (rand1) - allocate (rand2(begc:endc)) ; call random_number (rand2) + call random_seed (size = n ) + allocate ( seed (n ) ) ; seed (:) = seed_val + call random_seed (put = seed ) + allocate ( rand1 (begc:endc) ) ; call random_number (rand1) + allocate ( rand2 (begc:endc) ) ; call random_number (rand2) - allocate( atm2lnd%uwind (begc:endc) ) ; atm2lnd%uwind (:) = rand1 - allocate( atm2lnd%vwind (begc:endc) ) ; atm2lnd%vwind (:) = rand1 - allocate( atm2lnd%tbot (begc:endc) ) ; atm2lnd%tbot (:) = rand1 + allocate ( atm2lnd%uwind (begc:endc) ) ; atm2lnd%uwind (:) = rand1 + allocate ( atm2lnd%vwind (begc:endc) ) ; atm2lnd%vwind (:) = rand1 + allocate ( atm2lnd%tbot (begc:endc) ) ; atm2lnd%tbot (:) = rand1 !endc = 18048 ? should this be the size of the land or atmosphere??? - - allocate( lnd2atm%lwup (begc:endc) ) ; lnd2atm%lwup (:) = rand2 - allocate( lnd2atm%taux (begc:endc) ) ; lnd2atm%taux (:) = rand2 - allocate( lnd2atm%tauy (begc:endc) ) ; lnd2atm%tauy (:) = rand2 + allocate ( lnd2atm%lwup (begc:endc) ) ; lnd2atm%lwup (:) = rand2 + allocate ( lnd2atm%taux (begc:endc) ) ; lnd2atm%taux (:) = rand2 + allocate ( lnd2atm%tauy (begc:endc) ) ; lnd2atm%tauy (:) = rand2 print *, "=======================================" diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/scripts/lilac_mod.F90 index 1b3f4e6a48..ae1e1acc56 100644 --- a/lilac/scripts/lilac_mod.F90 +++ b/lilac/scripts/lilac_mod.F90 @@ -18,7 +18,7 @@ module lilac_mod public :: lilac_run character(*) , parameter :: modname = "lilac_mod" - !type(fld_list_type), public :: a2c_fldlist, c2a_fldlist + !type(fld_list_type), public :: a2c_fldlist, c2a_fldlist !defined in atmosphere and land caps.... !------------------------------------------------------------------------ ! !Clock, TimeInterval, and Times @@ -36,9 +36,10 @@ module lilac_mod type(ESMF_CplComp) :: cpl_lnd2atm_comp type(ESMF_State) :: atm2lnd_l_state , atm2lnd_a_state type(ESMF_State) :: lnd2atm_a_state, lnd2atm_l_state - !------------------------------------------------------------------------ + !======================================================================== contains + !======================================================================== subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) @@ -65,6 +66,8 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) integer :: a2l_fldnum , l2a_fldnum !------------------------------------------------------------------------ + ! Initialize return code + rc = ESMF_SUCCESS a2l_fldnum = 3 l2a_fldnum = 3 @@ -74,6 +77,8 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) !------------------------------------------------------------------------- call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"initializing ESMF ", ESMF_LOGMSG_INFO) print *, "---------------------------------------" print *, " Lilac Demo Application Start " @@ -237,7 +242,8 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! between components. !------------------------------------------------------------------------- - ! following 4 states are lilac module variables + ! following 4 states are lilac module variables: + ! 1- atm2lnd_a_state 2- atm2lnd_l_state 3- lnd2atm_a_state 4-lnd2atm_l_state atm2lnd_a_state = ESMF_StateCreate(name=gcname1, stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -300,20 +306,12 @@ subroutine lilac_run( ) !integer, parameter :: fldsMax = 100 integer :: a2l_fldnum, l2a_fldnum - ! type(fld_list_type) :: a2c_fldlist , c2a_fldlist ! input/output variables !type(atm2lnd_data1d_type), intent(in), optional :: atm2lnd1d !type(atm2lnd_data2d_type), intent(in), optional :: atm2lnd2d !type(lnd2atm_data1d_type), intent(in), optional :: lnd2atm1d !type(lnd2atm_data2d_type), intent(in), optional :: lnd2atm2d - ! local variables - ! ! Gridded Components and Coupling Components - !type(ESMF_GridComp) :: dummy_atmos_comp - !type(ESMF_GridComp) :: dummy_land_comp - - - !------------------------------------------------------------------------ ! Initialize return code rc = ESMF_SUCCESS From efb4eff80e53afe13a6e0e186c2fc9b2143f8749 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 15 May 2019 14:34:30 -0600 Subject: [PATCH 0311/1973] cleaning the code up! --- lilac/scripts/atmos_cap.F90 | 30 +++++------------------------- lilac/scripts/cpl_mod.F90 | 14 +++++++------- lilac/scripts/lilac_mod.F90 | 10 ++++++---- lilac/scripts/lnd_cap.F90 | 5 ++--- 4 files changed, 20 insertions(+), 39 deletions(-) diff --git a/lilac/scripts/atmos_cap.F90 b/lilac/scripts/atmos_cap.F90 index 2973cd1f17..60c9b13930 100644 --- a/lilac/scripts/atmos_cap.F90 +++ b/lilac/scripts/atmos_cap.F90 @@ -46,10 +46,7 @@ subroutine atmos_register (comp, rc) call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=atmos_init, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_copy_atm_to_lilac, phase=1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_copy_lilac_to_atm, phase=2, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=atmos_final, rc=rc) @@ -212,36 +209,19 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) end subroutine atmos_init - subroutine atmos_copy_atm_to_lilac(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(atmos_copy_atm_to_lilac) ' - - ! Initialize return code - rc = ESMF_SUCCESS - ! get a list of fields of variables we need from atmos.... - ! - call ESMF_LogWrite(subname//"atmos_copy_atm_to_lilac has not been implemented yet", ESMF_LOGMSG_INFO) - - ! loop over fields, copying pointer from import to export state - end subroutine atmos_copy_atm_to_lilac - - subroutine atmos_copy_lilac_to_atm(comp, importState, exportState, clock, rc) + subroutine atmos_run(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc - character(len=*), parameter :: subname=trim(modname)//':(atmos_copy_lilac_to_atm) ' + character(len=*), parameter :: subname=trim(modname)//': [atmos_run] ' ! Initialize return code rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//"atmos_copy_lilac_to_atm has not been implemented yet", ESMF_LOGMSG_INFO) - end subroutine atmos_copy_lilac_to_atm + call ESMF_LogWrite(subname//"atmos run has not been implemented yet", ESMF_LOGMSG_INFO) + end subroutine atmos_run subroutine atmos_final(comp, importState, exportState, clock, rc) type(ESMF_GridComp) :: comp diff --git a/lilac/scripts/cpl_mod.F90 b/lilac/scripts/cpl_mod.F90 index 3ea05d60ee..5372b007c9 100644 --- a/lilac/scripts/cpl_mod.F90 +++ b/lilac/scripts/cpl_mod.F90 @@ -6,27 +6,27 @@ module cpl_mod ! 1- coupler 1 : atm ---> lnd (cpl_atm2lnd) ! 2- coupler 2 : lnd ---> atm (cpl_lnd2atm) !----------------------------------------------------------------------- - + ! !USES use ESMF implicit none private - public cpl_atm2lnd_register - public cpl_lnd2atm_register + public :: cpl_atm2lnd_register + public :: cpl_lnd2atm_register - character(*), parameter :: modname = " cpl_mod" + character(*), parameter :: modname = " cpl_mod" type(ESMF_RouteHandle), save :: rh_atm2lnd, rh_lnd2atm - !----------------------------------------------------------------------- + !====================================================================== contains - !----------------------------------------------------------------------- + !====================================================================== subroutine cpl_atm2lnd_register(cplcomp, rc) type(ESMF_CplComp ) :: cplcomp integer, intent(out ) :: rc - character(len=* ) , parameter :: subname=trim(modname ) //':[cpl_atm2lnd_register] ' + character(len=* ) , parameter :: subname=trim(modname ) //' : [cpl_atm2lnd_register] ' rc = ESMF_SUCCESS print *, "in cpl_atm2lnd_register routine" diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/scripts/lilac_mod.F90 index ae1e1acc56..93de1d3cdf 100644 --- a/lilac/scripts/lilac_mod.F90 +++ b/lilac/scripts/lilac_mod.F90 @@ -46,7 +46,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) use atmos_cap , only : a2c_fldlist, c2a_fldlist use lnd_cap , only : l2c_fldlist, c2l_fldlist - character(len=*), parameter :: subname=trim(modname)//': [lilac_init]' + character(len=*), parameter :: subname=trim(modname)//': [lilac_init] ' ! input/output variables type(atm2lnd_data1d_type), intent(in), optional :: atm2lnd1d @@ -78,7 +78,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"initializing ESMF ", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"Initializing ESMF ", ESMF_LOGMSG_INFO) print *, "---------------------------------------" print *, " Lilac Demo Application Start " @@ -291,12 +291,14 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) end subroutine lilac_init + !======================================================================== + subroutine lilac_run( ) use atmos_cap, only : a2c_fldlist, c2a_fldlist use lnd_cap, only : l2c_fldlist, c2l_fldlist - character(len=*), parameter :: subname=trim(modname)//': [lilac_run]' + character(len=*), parameter :: subname=trim(modname)//': [lilac_run] ' type(ESMF_State) :: importState, exportState ! local variables @@ -361,7 +363,7 @@ subroutine lilac_final( ) use lnd_cap, only : l2c_fldlist, c2l_fldlist - character(len=*), parameter :: subname=trim(modname)//': [lilac_final]' + character(len=*), parameter :: subname=trim(modname)//': [lilac_final] ' type(ESMF_State) :: importState, exportState ! local variables diff --git a/lilac/scripts/lnd_cap.F90 b/lilac/scripts/lnd_cap.F90 index 5c5a22f39c..0bf6d78dd4 100644 --- a/lilac/scripts/lnd_cap.F90 +++ b/lilac/scripts/lnd_cap.F90 @@ -73,9 +73,8 @@ subroutine lnd_init(comp, atm2lnd_l_state, lnd2atm_l_state, clock, rc) integer :: c2l_fldlist_num integer :: l2c_fldlist_num + !integer :: regDecomp(:,:) - - !integer :: regDecomp(:,:) ! Initialize return code rc = ESMF_SUCCESS call ESMF_LogWrite(subname//"------------------------!", ESMF_LOGMSG_INFO) @@ -93,8 +92,8 @@ subroutine lnd_init(comp, atm2lnd_l_state, lnd2atm_l_state, clock, rc) if(mesh_switch) then print *, "creating mesh for land" ! For now this is our dummy mesh: + !lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' !! T31 and T62 did not work.... !lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T62_040121_ESMFmesh.nc' - !lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' lnd_mesh = ESMF_MeshCreate(filename=trim(lnd_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out From 0c64dc5e8cd60a9c76a1cd3e1dedf38d1e8158e3 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 15 May 2019 15:03:27 -0600 Subject: [PATCH 0312/1973] cleaning it up --- lilac/scripts/atmos_cap.F90 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lilac/scripts/atmos_cap.F90 b/lilac/scripts/atmos_cap.F90 index 60c9b13930..b97ff70d28 100644 --- a/lilac/scripts/atmos_cap.F90 +++ b/lilac/scripts/atmos_cap.F90 @@ -140,7 +140,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) !field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(a2c_fldlist(n)%stdname), rc=rc) field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) + !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) + call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out ! add field to field bundle @@ -183,6 +184,11 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr1d, rc=rc) field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) + call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8)*5.5, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + else field = ESMF_FieldCreate(atmos_grid, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr2d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out From 156e495c0a6c800ce0e2be09ea8e3072eaca772a Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 23 May 2019 17:32:10 -0600 Subject: [PATCH 0313/1973] reading in the namelist.input.... compiles successfully --- lilac/scripts/lilac_mod.F90 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/scripts/lilac_mod.F90 index 93de1d3cdf..b33b246e50 100644 --- a/lilac/scripts/lilac_mod.F90 +++ b/lilac/scripts/lilac_mod.F90 @@ -65,6 +65,20 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) character(len=ESMF_MAXSTR) :: ccname1 , ccname2 ! Coupling components names integer :: a2l_fldnum , l2a_fldnum + + ! Namelist and related variables + integer :: fileunit + integer :: i_max, j_max + real(ESMF_KIND_R8) :: x_min, x_max, y_min, y_max + integer :: s_month, s_day, s_hour, s_min + integer :: e_month, e_day, e_hour, e_min + namelist /input/ i_max, j_max, x_min, x_max, y_min, y_max, & + s_month, s_day, s_hour, s_min, & + e_month, e_day, e_hour, e_min + + + + !------------------------------------------------------------------------ ! Initialize return code rc = ESMF_SUCCESS @@ -83,6 +97,22 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) print *, "---------------------------------------" print *, " Lilac Demo Application Start " print *, "---------------------------------------" + !------------------------------------------------------------------------- + ! Read in configuration data -- namelist.input from host atmosphere(wrf) + !------------------------------------------------------------------------- + ! Read in namelist file ... + call ESMF_UtilIOUnitGet(unit=fileunit, rc=rc) ! get an available Fortran unit number + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + open(fileunit, status="old", file="./namelist", action="read", iostat=rc) + + if (rc .ne. 0) then + call ESMF_LogSetError(rcToCheck=ESMF_RC_FILE_OPEN, msg="Failed to open namelist file 'namelist'", line=__LINE__, file=__FILE__) + call ESMF_Finalize(endflag=ESMF_END_ABORT) + endif + read(fileunit, input) + continue + close(fileunit) + !------------------------------------------------------------------------- ! Create Field lists -- Basically create a list of fields and add a default From a91a886d837d9dddea28cbb1a83d20b4c2d9030c Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 30 May 2019 12:43:49 -0600 Subject: [PATCH 0314/1973] commited this branch to have it saved --- lilac/scripts/atmos_cap.F90 | 4 +- lilac/scripts/lilac_mod.F90 | 86 +++++++++++++++++++++++++------------ 2 files changed, 61 insertions(+), 29 deletions(-) diff --git a/lilac/scripts/atmos_cap.F90 b/lilac/scripts/atmos_cap.F90 index b97ff70d28..8f0e5e40c4 100644 --- a/lilac/scripts/atmos_cap.F90 +++ b/lilac/scripts/atmos_cap.F90 @@ -226,7 +226,7 @@ subroutine atmos_run(comp, importState, exportState, clock, rc) ! Initialize return code rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//"atmos run has not been implemented yet", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"SHOULD ATMOS_RUN DO ANYTHING REALLY?? ", ESMF_LOGMSG_INFO) end subroutine atmos_run subroutine atmos_final(comp, importState, exportState, clock, rc) @@ -251,7 +251,7 @@ subroutine atmos_final(comp, importState, exportState, clock, rc) call ESMF_FieldBundleDestroy(import_fieldbundle, rc=rc) call ESMF_FieldBundleDestroy(export_fieldbundle, rc=rc) - call ESMF_LogWrite(subname//"atmos_final has not been implemented yet", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"?? Are there any other thing for destroying in atmos_final??", ESMF_LOGMSG_INFO) end subroutine atmos_final diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/scripts/lilac_mod.F90 index b33b246e50..e3f23aa8b8 100644 --- a/lilac/scripts/lilac_mod.F90 +++ b/lilac/scripts/lilac_mod.F90 @@ -103,9 +103,11 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! Read in namelist file ... call ESMF_UtilIOUnitGet(unit=fileunit, rc=rc) ! get an available Fortran unit number if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + print *, "---------------------------------------" + open(fileunit, status="old", file="./namelist", action="read", iostat=rc) - if (rc .ne. 0) then + if (rc == 0) then call ESMF_LogSetError(rcToCheck=ESMF_RC_FILE_OPEN, msg="Failed to open namelist file 'namelist'", line=__LINE__, file=__FILE__) call ESMF_Finalize(endflag=ESMF_END_ABORT) endif @@ -113,7 +115,6 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) continue close(fileunit) - !------------------------------------------------------------------------- ! Create Field lists -- Basically create a list of fields and add a default ! value to them. @@ -257,15 +258,29 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) !------------------------------------------------------------------------- ! Create and initialize a clock! - ! ????? Should I create a clock here or in driver? + ! Clock is initialized here from namelist.input from WRF..... still we + ! are looping over time from host atmosphere !------------------------------------------------------------------------- calendar = ESMF_CalendarCreate(name='lilac_drv_NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) - call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) + call ESMF_TimeIntervalSet(TimeStep, s=2, rc=rc) ! time step every 2second + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + !call ESMF_TimeSet(startTime, yy=2003, mm=s_month, dd=s_day, h=s_hour, m=s_min, s=0, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !call ESMF_TimeSet(stopTime, yy=2003, mm=e_month, dd=e_day, h=e_hour, m=e_min, s=0, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !clock = ESMF_ClockCreate(timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1 , s=0, calendar=Calendar, rc=rc) call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) clock = ESMF_ClockCreate(name='lilac_drv_EClock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, stopTime=stopTime, rc=rc) - !clock = ESMF_ClockCreate(timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - !EClock = ESMF_ClockCreate(name='lilac_drv_EClock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, stopTime=stopTime, rc=rc) + + print *, "---------------------------------------" + call ESMF_ClockPrint (clock, rc=rc) + print *, "=======================================" + call ESMF_CalendarPrint ( calendar , rc=rc) + print *, "---------------------------------------" !------------------------------------------------------------------------- ! Create the necessary import and export states used to pass data @@ -344,45 +359,62 @@ subroutine lilac_run( ) !type(lnd2atm_data1d_type), intent(in), optional :: lnd2atm1d !type(lnd2atm_data2d_type), intent(in), optional :: lnd2atm2d + type (ESMF_Clock) :: local_clock + !------------------------------------------------------------------------ ! Initialize return code rc = ESMF_SUCCESS + print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + print *, " Lilac Run " + print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" !------------------------------------------------------------------------- - ! Initialize ESMF, set the default calendar and log type. + ! Create a local clock from the general clock! !------------------------------------------------------------------------- - call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN, rc=rc) + + local_clock = ESMF_ClockCreate(clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - print *, " Lilac Run " - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + print *, "Run Loop Start time" + call ESMF_ClockPrint(local_clock, options="currtime string", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out !------------------------------------------------------------------------- ! We are running components in this order: ! 1- atmos_cap 2- cpl_atm2lnd ! 3- lnd_cap 4- cpl_lnd2atm !------------------------------------------------------------------------- - call ESMF_GridCompRun(dummy_atmos_comp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atmos_cap or dummy_atmos_comp is running", ESMF_LOGMSG_INFO) - print *, "Running atmos_cap gridded component , rc =", rc + ! lilac run the RunComponent phase in a time loop + do while (.NOT. ESMF_ClockIsStopTime(local_clock, rc=rc)) - call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) - print *, "Running coupler component..... cpl_atm2lnd_comp , rc =", rc + call ESMF_GridCompRun(dummy_atmos_comp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=local_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"atmos_cap or dummy_atmos_comp is running", ESMF_LOGMSG_INFO) + print *, "Running atmos_cap gridded component , rc =", rc - call ESMF_GridCompRun(dummy_land_comp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"lnd_cap or dummy_land_comp is running", ESMF_LOGMSG_INFO) - print *, "Running lnd_cap gridded component , rc =", rc + call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=local_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) + print *, "Running coupler component..... cpl_atm2lnd_comp , rc =", rc - call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) - print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc + call ESMF_GridCompRun(dummy_land_comp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=local_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"lnd_cap or dummy_land_comp is running", ESMF_LOGMSG_INFO) + print *, "Running lnd_cap gridded component , rc =", rc + + call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=local_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) + print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc + + ! Advance the time + call ESMF_ClockAdvance(local_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"time is icremented now... (ClockAdvance)", ESMF_LOGMSG_INFO) + print *, "time is icremented now... (ClockAdvance) , rc =", rc + + end do end subroutine lilac_run From e4e16e8de059fa936f4c8c7e0ef707414d78b39c Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 3 Jun 2019 12:11:11 -0600 Subject: [PATCH 0315/1973] adding type of this_clock... but not entirely implemented yet.....! --- lilac/scripts/demo_driver.F90 | 4 +++- lilac/scripts/lilac_mod.F90 | 5 +++-- lilac/scripts/lilac_utils.F90 | 8 ++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lilac/scripts/demo_driver.F90 b/lilac/scripts/demo_driver.F90 index 4681acd276..2276664d68 100644 --- a/lilac/scripts/demo_driver.F90 +++ b/lilac/scripts/demo_driver.F90 @@ -22,7 +22,7 @@ program demo_lilac_driver ! modules use ESMF use lilac_mod - use lilac_utils, only : atm2lnd_data1d_type , lnd2atm_data1d_type, atm2lnd_data2d_type, atm2lnd_data2d_type + use lilac_utils, only : atm2lnd_data1d_type , lnd2atm_data1d_type, atm2lnd_data2d_type, atm2lnd_data2d_type , this_clock implicit none @@ -31,6 +31,8 @@ program demo_lilac_driver type (atm2lnd_data1d_type) :: atm2lnd type (lnd2atm_data1d_type) :: lnd2atm + type (this_clock) :: this_time + real , allocatable :: rand1(:) real , allocatable :: rand2(:) diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/scripts/lilac_mod.F90 index e3f23aa8b8..f958777515 100644 --- a/lilac/scripts/lilac_mod.F90 +++ b/lilac/scripts/lilac_mod.F90 @@ -386,8 +386,9 @@ subroutine lilac_run( ) ! 3- lnd_cap 4- cpl_lnd2atm !------------------------------------------------------------------------- ! lilac run the RunComponent phase in a time loop - do while (.NOT. ESMF_ClockIsStopTime(local_clock, rc=rc)) + !!! if we want to loop through clock in atmos cap. + !do while (.NOT. ESMF_ClockIsStopTime(local_clock, rc=rc)) call ESMF_GridCompRun(dummy_atmos_comp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=local_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"atmos_cap or dummy_atmos_comp is running", ESMF_LOGMSG_INFO) @@ -414,7 +415,7 @@ subroutine lilac_run( ) call ESMF_LogWrite(subname//"time is icremented now... (ClockAdvance)", ESMF_LOGMSG_INFO) print *, "time is icremented now... (ClockAdvance) , rc =", rc - end do + !end do end subroutine lilac_run diff --git a/lilac/scripts/lilac_utils.F90 b/lilac/scripts/lilac_utils.F90 index 4f26bae49b..c4a665527e 100644 --- a/lilac/scripts/lilac_utils.F90 +++ b/lilac/scripts/lilac_utils.F90 @@ -48,6 +48,14 @@ module lilac_utils real*8, pointer :: tauy (:,:) end type lnd2atm_data2d_type + type :: this_clock + integer, pointer :: yy + integer, pointer :: mm + integer, pointer :: dd + integer, pointer :: hh + integer, pointer :: mn + integer, pointer :: ss + end type this_clock !=============================================================================== contains !=============================================================================== From 6851f6c4c9351d3de590d7497858277fda789a2f Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 3 Jun 2019 12:17:34 -0600 Subject: [PATCH 0316/1973] saving... checkpoint... before working on cmake for this.... currently this is working with Makefile --- lilac/scripts/lilac_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/scripts/lilac_mod.F90 index f958777515..d97e4c0f7b 100644 --- a/lilac/scripts/lilac_mod.F90 +++ b/lilac/scripts/lilac_mod.F90 @@ -14,8 +14,8 @@ module lilac_mod implicit none - public :: lilac_init - public :: lilac_run + public :: lilac_init + public :: lilac_run character(*) , parameter :: modname = "lilac_mod" !type(fld_list_type), public :: a2c_fldlist, c2a_fldlist !defined in atmosphere and land caps.... From 980205e84ddc9de17dd269e13e11946ad3cf10bd Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 14 Jun 2019 11:32:03 -0600 Subject: [PATCH 0317/1973] CMake working and building.... --- lilac/CMakeLists.txt | 11 ++++++++++- lilac/{scripts => lilac}/.cpl_mod.F90.swp | Bin lilac/{scripts => lilac}/.gitignore | 0 lilac/{scripts => lilac}/Makefile | 0 lilac/{scripts => lilac}/atmos_cap.F90 | 0 lilac/{scripts => lilac}/cpl_mod.F90 | 0 lilac/{scripts => lilac}/demo_driver.F90 | 0 lilac/{scripts => lilac}/lilac_mod.F90 | 0 lilac/{scripts => lilac}/lilac_utils.F90 | 0 lilac/{scripts => lilac}/lnd_cap.F90 | 0 lilac/{lilac => lilac_joe}/CMakeLists.txt | 0 lilac/{lilac => lilac_joe}/core.f90 | 0 .../drivers/lilac_data_driver.f90 | 0 lilac/{lilac => lilac_joe}/esmf_utils.f90 | 0 lilac/{lilac => lilac_joe}/lilac_utils.f90 | 0 15 files changed, 10 insertions(+), 1 deletion(-) rename lilac/{scripts => lilac}/.cpl_mod.F90.swp (100%) rename lilac/{scripts => lilac}/.gitignore (100%) rename lilac/{scripts => lilac}/Makefile (100%) rename lilac/{scripts => lilac}/atmos_cap.F90 (100%) rename lilac/{scripts => lilac}/cpl_mod.F90 (100%) rename lilac/{scripts => lilac}/demo_driver.F90 (100%) rename lilac/{scripts => lilac}/lilac_mod.F90 (100%) rename lilac/{scripts => lilac}/lilac_utils.F90 (100%) rename lilac/{scripts => lilac}/lnd_cap.F90 (100%) rename lilac/{lilac => lilac_joe}/CMakeLists.txt (100%) rename lilac/{lilac => lilac_joe}/core.f90 (100%) rename lilac/{lilac => lilac_joe}/drivers/lilac_data_driver.f90 (100%) rename lilac/{lilac => lilac_joe}/esmf_utils.f90 (100%) rename lilac/{lilac => lilac_joe}/lilac_utils.f90 (100%) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 10630051ce..07747d29f1 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -7,7 +7,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") find_package(MPI REQUIRED) # TODO: This should be found from the find_package call but its not working -set(CMAKE_Fortran_COMPILER "/usr/lib64/mpich/bin/mpif90") +#set(CMAKE_Fortran_COMPILER "/usr/lib64/mpich/bin/mpif90") find_package(ESMF REQUIRED) # Local CMake modules @@ -31,8 +31,17 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") # TODO: This should not be necessary but certain header files are missing from the build +#set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include -I/usr/src/lilac/external/esmf/build_config/Linux.gfortran.default -I /usr/src/lilac/external/esmf/src/include") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I /usr/src/esmf/src/include") + message("CMAKE_Fortran_FLAGS:" ${CMAKE_Fortran_FLAGS}) +#add_executable("lilac.exe" ../lilac/*.F90) + +add_executable(${PROJECT_NAME} ../lilac/demo_driver.F90 + ../lilac/lilac_mod.F90 ../lilac/atmos_cap.F90 ../lilac/lilac_utils.F90 + ../lilac/lnd_cap.F90 ../lilac/cpl_mod.F90) + +#emo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o add_subdirectory(lilac) add_subdirectory(tests) diff --git a/lilac/scripts/.cpl_mod.F90.swp b/lilac/lilac/.cpl_mod.F90.swp similarity index 100% rename from lilac/scripts/.cpl_mod.F90.swp rename to lilac/lilac/.cpl_mod.F90.swp diff --git a/lilac/scripts/.gitignore b/lilac/lilac/.gitignore similarity index 100% rename from lilac/scripts/.gitignore rename to lilac/lilac/.gitignore diff --git a/lilac/scripts/Makefile b/lilac/lilac/Makefile similarity index 100% rename from lilac/scripts/Makefile rename to lilac/lilac/Makefile diff --git a/lilac/scripts/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 similarity index 100% rename from lilac/scripts/atmos_cap.F90 rename to lilac/lilac/atmos_cap.F90 diff --git a/lilac/scripts/cpl_mod.F90 b/lilac/lilac/cpl_mod.F90 similarity index 100% rename from lilac/scripts/cpl_mod.F90 rename to lilac/lilac/cpl_mod.F90 diff --git a/lilac/scripts/demo_driver.F90 b/lilac/lilac/demo_driver.F90 similarity index 100% rename from lilac/scripts/demo_driver.F90 rename to lilac/lilac/demo_driver.F90 diff --git a/lilac/scripts/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 similarity index 100% rename from lilac/scripts/lilac_mod.F90 rename to lilac/lilac/lilac_mod.F90 diff --git a/lilac/scripts/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 similarity index 100% rename from lilac/scripts/lilac_utils.F90 rename to lilac/lilac/lilac_utils.F90 diff --git a/lilac/scripts/lnd_cap.F90 b/lilac/lilac/lnd_cap.F90 similarity index 100% rename from lilac/scripts/lnd_cap.F90 rename to lilac/lilac/lnd_cap.F90 diff --git a/lilac/lilac/CMakeLists.txt b/lilac/lilac_joe/CMakeLists.txt similarity index 100% rename from lilac/lilac/CMakeLists.txt rename to lilac/lilac_joe/CMakeLists.txt diff --git a/lilac/lilac/core.f90 b/lilac/lilac_joe/core.f90 similarity index 100% rename from lilac/lilac/core.f90 rename to lilac/lilac_joe/core.f90 diff --git a/lilac/lilac/drivers/lilac_data_driver.f90 b/lilac/lilac_joe/drivers/lilac_data_driver.f90 similarity index 100% rename from lilac/lilac/drivers/lilac_data_driver.f90 rename to lilac/lilac_joe/drivers/lilac_data_driver.f90 diff --git a/lilac/lilac/esmf_utils.f90 b/lilac/lilac_joe/esmf_utils.f90 similarity index 100% rename from lilac/lilac/esmf_utils.f90 rename to lilac/lilac_joe/esmf_utils.f90 diff --git a/lilac/lilac/lilac_utils.f90 b/lilac/lilac_joe/lilac_utils.f90 similarity index 100% rename from lilac/lilac/lilac_utils.f90 rename to lilac/lilac_joe/lilac_utils.f90 From 00a1374a34c20faee6cb743388b236f86420dcd3 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 14 Jun 2019 11:39:24 -0600 Subject: [PATCH 0318/1973] saving this version of CMake that print out compiler and versions.... --- lilac/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 07747d29f1..4179a4b99a 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -34,7 +34,12 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include -I/usr/src/lilac/external/esmf/build_config/Linux.gfortran.default -I /usr/src/lilac/external/esmf/src/include") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I /usr/src/esmf/src/include") -message("CMAKE_Fortran_FLAGS:" ${CMAKE_Fortran_FLAGS}) + +message(STATUS "==============================================================") +message(STATUS "Fortran Compiler : ${CMAKE_Fortran_COMPILER}") +message(STATUS "cmake Fortran Flags : ${CMAKE_Fortran_FLAGS}") +message(STATUS "==============================================================") + #add_executable("lilac.exe" ../lilac/*.F90) From c41a061949a3461574c8e407925f890580467f27 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 25 Jun 2019 10:25:20 -0600 Subject: [PATCH 0319/1973] fix num_iter location in BareGroundFluxesMod --- src/biogeophys/BareGroundFluxesMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index f2c6f25285..93ad6767bb 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -309,9 +309,9 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & um(p) = sqrt(ur(p)*ur(p) + wc*wc) end if obu(p) = zldis(p)/zeta - end do - num_iter(p) = iter + num_iter(p) = iter + end do end do ! end stability iteration From e8ec54abefa856df42b2d34dfc449a05ac196a2a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 1 Jul 2019 16:16:44 -0600 Subject: [PATCH 0320/1973] Apply patch for updates on release branch from release-clm5.0.12 to release-clm5.0.14 --- cime_config/config_compsets.xml | 21 +++++++++++++++++++++ cime_config/testdefs/testlist_clm.xml | 13 +++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index e0acc4f4f3..5644197fae 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -190,6 +190,13 @@ + + IHistClm50SpCru + HIST_DATM%CRUv7_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + IHistClm50Bgc HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV @@ -352,6 +359,13 @@ + + IHistClm45SpGs + HIST_DATM%GSWP3v1_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV + + + + I2000Clm50Vic @@ -379,6 +393,13 @@ 1850_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV + + IHistClm40SpGswGs + HIST_DATM%GSWP3v1_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV + + + + IHistClm50BgcCropG HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 8966bacc3d..bd7d0385e7 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -298,7 +298,7 @@ - + @@ -575,7 +575,7 @@ - + @@ -640,12 +640,21 @@ + + + + + + + + + From 60e08244d3e47692e8f195e47be327500fdf71c8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 2 Jul 2019 14:39:03 -0600 Subject: [PATCH 0321/1973] Do the update from release-clm5.0.12 to release-clm5.0.18 using patch and resolving rejected differences by hand, make sure the build-namelist unit tester runs --- .gitignore | 17 + README | 4 + bld/CLMBuildNamelist.pm | 90 +- bld/namelist_files/createMkSrfEntry.py | 12 +- bld/namelist_files/namelist_defaults_ctsm.xml | 68 ++ .../namelist_definition_ctsm.xml | 18 +- .../use_cases/1850_noanthro_control.xml | 56 ++ bld/namelist_files/use_cases/2010_control.xml | 36 + bld/unit_testers/build-namelist_test.pl | 30 +- cime_config/config_component.xml | 24 +- cime_config/config_compsets.xml | 10 + cime_config/testdefs/testlist_clm.xml | 8 + src/biogeochem/CNBalanceCheckMod.F90 | 6 +- src/biogeochem/CNCStateUpdate1Mod.F90 | 514 ++++++------ src/biogeochem/CNDriverMod.F90 | 9 +- src/biogeochem/CNVegCarbonFluxType.F90 | 38 +- src/biogeochem/CNVegCarbonStateType.F90 | 79 +- src/biogeochem/CNVegetationFacade.F90 | 30 +- src/biogeochem/EDBGCDynMod.F90 | 2 +- test/tools/nl_files/mksrfdt_10x15_1850 | 2 +- tools/README | 299 +------ tools/contrib/README | 42 + tools/contrib/SpinupStability.ncl | 791 ++++++++++++++++++ tools/contrib/modify_singlept_site | 391 +++++++++ tools/contrib/run_clm_historical | 365 ++++++++ tools/contrib/run_clmtowers | 356 ++++++++ tools/contrib/singlept | 375 +++++++++ tools/contrib/subset_surfdata | 141 ++++ tools/mksurfdata_map/Makefile.data | 22 +- tools/mksurfdata_map/README.developers | 49 ++ tools/mksurfdata_map/mksurfdata.pl | 48 +- tools/mksurfdata_map/src/Srcfiles | 1 - tools/mksurfdata_map/src/mkfileMod.F90 | 77 +- tools/mksurfdata_map/src/mkglcmecMod.F90 | 45 +- tools/mksurfdata_map/src/mksurfdat.F90 | 99 +-- tools/mksurfdata_map/src/mkvarctl.F90 | 1 + 36 files changed, 3372 insertions(+), 783 deletions(-) create mode 100644 bld/namelist_files/use_cases/1850_noanthro_control.xml create mode 100644 bld/namelist_files/use_cases/2010_control.xml create mode 100644 tools/contrib/README create mode 100644 tools/contrib/SpinupStability.ncl create mode 100755 tools/contrib/modify_singlept_site create mode 100755 tools/contrib/run_clm_historical create mode 100755 tools/contrib/run_clmtowers create mode 100755 tools/contrib/singlept create mode 100755 tools/contrib/subset_surfdata diff --git a/.gitignore b/.gitignore index 4a5672d970..77a7aad528 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,23 @@ manage_externals.log *.swp *~ +# vim files (from https://github.com/github/gitignore/blob/master/Global/Vim.gitignore) +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] +# Session +Session.vim +# Temporary +.netrwhist +# (removed *~ because it is listed above) +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + # mac files .DS_Store diff --git a/README b/README index 76c0a04982..e8db3de87f 100644 --- a/README +++ b/README @@ -135,6 +135,10 @@ tools/ncl_scripts ------------ Directory of NCL and perl scripts to do various tasks. Most notably to plot perturbation error growth testing and to extract regional information from global datasets for single-point/regional simulations. +tools/contrib ----------------- Miscellansous useful scripts for pre and post processing + as well as case management of CTSM. These scripts are + contributed by users and may not be as well tested or + supported as other tools. ============================================================================================= diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 42e0b35b92..3b25089419 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -78,7 +78,7 @@ REQUIRED OPTIONS "-res list" to list valid resolutions. (default: 0.9x1.25) -sim_year "year" Year to simulate for input datasets - (i.e. 1850, 2000, 1850-2000, 1850-2100) + (i.e. PtVg, 1850, 2000, 2010, 1850-2000, 1850-2100) "-sim_year list" to list valid simulation years (default 2000) -structure "structure" The overall structure being used [ standard | fast ] @@ -1165,19 +1165,19 @@ sub setup_cmdl_simulation_year { } $nl_flags->{'sim_year_range'} = $defaults->get_value("sim_year_range"); - $nl_flags->{'sim_year'} = $val; + $nl_flags->{'sim_year'} = &remove_leading_and_trailing_quotes($val); if ( $val =~ /([0-9]+)-([0-9]+)/ ) { $nl_flags->{'sim_year'} = $1; $nl_flags->{'sim_year_range'} = $val; } $val = $nl_flags->{'sim_year'}; my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val ); + $nl->set_variable_value($group, $var, "'$val'" ); if ( ! $definition->is_valid_value( $var, $val, 'noquotes'=>1 ) ) { my @valid_values = $definition->get_valid_values( $var ); $log->fatal_error("$var of $val is NOT valid. Valid values are: @valid_values"); } - $nl->set_variable_value($group, $var, $val ); + $nl->set_variable_value($group, $var, "'$val'" ); $log->verbose_message("CLM sim_year is $nl_flags->{'sim_year'}"); $var = "sim_year_range"; @@ -1634,6 +1634,10 @@ sub process_namelist_inline_logic { ################################################ setup_logic_century_soilbgcdecompcascade($opts, $nl_flags, $definition, $defaults, $nl); + ############################# + # namelist group: cngeneral # + ############################# + setup_logic_cngeneral($opts, $nl_flags, $definition, $defaults, $nl); #################################### # namelist group: cnvegcarbonstate # #################################### @@ -2277,8 +2281,16 @@ sub setup_logic_initial_conditions { #} add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_sim_years" ); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_how_close" ); + my $close = $nl->get_value("init_interp_how_close"); foreach my $sim_yr ( split( /,/, $nl->get_value("init_interp_sim_years") )) { - if ( abs($st_year - $sim_yr) < $nl->get_value("init_interp_how_close") ) { + my $how_close = undef; + if ( $nl_flags->{'sim_year'} eq "PtVg" ) { + $how_close = abs(1850 - $sim_yr); + } else { + $how_close = abs($st_year - $sim_yr); + } + if ( ($how_close < $nl->get_value("init_interp_how_close")) && ($how_close < $close) ) { + $close = $how_close; $settings{'sim_year'} = $sim_yr; } } @@ -3348,29 +3360,33 @@ sub setup_logic_megan { sub setup_logic_lai_streams { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - if ( &value_is_true($nl_flags->{'use_crop'}) && &value_is_true($nl_flags->{'use_lai_streams'}) ) { - $log->fatal_error("turning use_lai_streams on is incompatable with use_crop set to true."); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_lai_streams'); + + if ( &value_is_true($nl_flags->{'use_crop'}) && &value_is_true($nl->get_value('use_lai_streams')) ) { + $log->fatal_error("turning use_lai_streams on is incompatable with use_crop set to true."); } if ( $nl_flags->{'bgc_mode'} eq "sp" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_lai_streams'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lai_mapalgo', - 'hgrid'=>$nl_flags->{'res'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lai', - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lai', - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_lai') != - $nl->get_value('stream_year_last_lai') ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'model_year_align_lai', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + if ( &value_is_true($nl->get_value('use_lai_streams')) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_lai_streams'); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lai_mapalgo', + 'hgrid'=>$nl_flags->{'res'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lai', + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lai', + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + # Set align year, if first and last years are different + if ( $nl->get_value('stream_year_first_lai') != + $nl->get_value('stream_year_last_lai') ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, + 'model_year_align_lai', 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + } + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lai', + 'hgrid'=>"360x720cru" ); } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lai', - 'hgrid'=>"360x720cru" ); } else { # If bgc is CN/CNDV then make sure none of the LAI settings are set if ( defined($nl->get_value('stream_year_first_lai')) || @@ -3439,6 +3455,32 @@ sub setup_logic_cnvegcarbonstate { #------------------------------------------------------------------------------- +sub setup_logic_cngeneral { + # Must be set after setup_logic_co2_type + my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + + if ( &value_is_true($nl->get_value('use_cn')) ) { + if ( &value_is_true($nl->get_value('use_crop')) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dribble_crophrv_xsmrpool_2atm', + 'co2_type' => remove_leading_and_trailing_quotes($nl->get_value('co2_type')), + 'use_crop' => $nl->get_value('use_crop') ); + } else { + if ( defined($nl->get_value('dribble_crophrv_xsmrpool_2atm')) ) { + $log->fatal_error("When CROP is NOT on dribble_crophrv_xsmrpool_2atm can NOT be set\n" ); + } + } + } else { + if ( defined($nl->get_value('reseed_dead_plants')) || + defined($nl->get_value('dribble_crophrv_xsmrpool_2atm')) ) { + $log->fatal_error("When CN is not on none of the following can be set: ,\n" . + "dribble_crophrv_xsmrpool_2atm nor reseed_dead_plantsr\n" . + "(eg. don't use these options with SP mode)."); + } + } +} + +#------------------------------------------------------------------------------- + sub setup_logic_rooting_profile { # my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; diff --git a/bld/namelist_files/createMkSrfEntry.py b/bld/namelist_files/createMkSrfEntry.py index ee1175c9b1..b76e83af4d 100755 --- a/bld/namelist_files/createMkSrfEntry.py +++ b/bld/namelist_files/createMkSrfEntry.py @@ -5,12 +5,12 @@ class mksrfDataEntry_prog: # Class data - year_start = 2016 - year_end = 2100 - ssp_rcp = "SSP5-8.5" - subdir = "pftcftdynharv.0.25x0.25.SSP5-8.5.simyr2016-2100.c171005" - cdate = 171005 - desc = "SSP5RCP85_clm5" + year_start = 850 + year_end = 1849 + ssp_rcp = "hist" + subdir = "pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012" + cdate = 171012 + desc = "histclm50_LUH2" def parse_cmdline_args( self ): "Parse the command line arguments for create data entry list" diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index ef7f2498ad..60bd932803 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -26,6 +26,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 379.0 379.0 284.7 +284.7 constant @@ -458,6 +459,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .true. + + +.true. +.false. + lnd/clm2/surfdata_map/surfdata_1x1_camdenNJ_16pfts_Irrig_CMIP6_simyr2000_c171214.nc @@ -704,6 +716,9 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc< lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc + +lnd/clm2/surfdata_map/surfdata_conus_30_x8_16pfts_Irrig_CMIP6_simyr1850_c181003.nc + lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc @@ -733,6 +748,13 @@ lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr1850_c170824.nc lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc + +lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nc + + +lnd/clm2/surfdata_map/surfdata_0.9x1.25_hist_16pfts_nourb_CMIP6_simyrPtVg_c181114.nc + lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_conus_30_x8_hist_78pfts_CMIP6_simyr1850-2015_c181004.nc + + + + +lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_nomask_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_GLOBE-Gardner_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_LandScan2004_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_10x10min_nomask_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_0.5x0.5_MODIS_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_ORNL-Soil_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_0.5x0.5_AVHRR_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_MODIS-wCsp_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_1km-merge-10min_HYDRO1K-merge-nomask_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_360x720cru_cruncep_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_10x10min_IGBPmergeICESatGIS_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_GLOBE-Gardner-mergeGIS_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_0.9x1.25_GRDC_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_ISRIC-WISE_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_USGS_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_0.25x0.25_MODIS_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_IGBP-GSDP_to_conus_30_x8_nomask_aave_da_c181003.nc + + + diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 33947ebe4d..48cbd3c3ad 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1843,7 +1843,7 @@ CLM run type. +"conus_30_x8,512x1024,360x720cru,128x256,64x128,48x96,32x64,8x16,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4,ne60np4,ne120np4,ne240np4,1km-merge-10min"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools @@ -1855,9 +1855,9 @@ Representative concentration pathway for future scenarios [radiative forcing at -999.9 means do NOT use a future scenario, just use historical data. - + valid_values="hist,SSP1-2.6,SSP3-7.0,SSP5-3.4,SSP2-4.5,SSP1-1.9,SSP4-3.4,SSP4-6.0,SSP5-8.5"> Shared Socioeconomic Pathway and Representative Concentration Pathway combination for future scenarios The form is SSPn-m.m Where n is the SSP number and m.m is RCP radiative forcing at peak or 2100 in W/m^2 hist means do NOT use a future scenario, just use historical data. @@ -1883,12 +1883,13 @@ to run with a different type of atmospheric forcing. If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) - +"PtVg,1000,850,1100,1350,1600,1850,1855,1865,1875,1885,1895,1905,1915,1925,1935,1945,1955,1965,1975,1980,1985,1995,2000,2005,2010,2015,2025,2035,2045,2055,2065,2075,2085,2095,2105"> Year to simulate and to provide datasets for (such as surface datasets, initial conditions, aerosol-deposition, Nitrogen deposition rates etc.) A sim_year of 1000 corresponds to data used for testing only, NOT corresponding to any real datasets. -A sim_year greater than 2005 corresponds to rcp scenario data +A sim_year greater than 2015 corresponds to rcp scenario data +A sim_year of PtVg refers to the Potential Vegetation dataset, that doesn't include human influences Most years are only used for clm_tools and there aren't CLM datasets that correspond to them. CLM datasets exist for years: 1000 (for testing), 1850, and 2000 @@ -2034,6 +2035,11 @@ Number of days over which to use exponential relaxation of NPP in N fixation cal Flag to reseed any dead plants on startup from reading the initial conditions file + +Harvest the XSMR pool at crop harvest time to the atmosphere slowly at an exponential rate + + diff --git a/bld/namelist_files/use_cases/1850_noanthro_control.xml b/bld/namelist_files/use_cases/1850_noanthro_control.xml new file mode 100644 index 0000000000..bba281aee6 --- /dev/null +++ b/bld/namelist_files/use_cases/1850_noanthro_control.xml @@ -0,0 +1,56 @@ + + + + +Simulate current conditions without ANY anthropogenic influnces + +PtVg + +constant + +.false. + +1850 +1850 + +1850 +1850 + +1850 +1850 + +1850 +1850 + +cycle +NDEP_month + +1925 +1925 + +1925 +1925 + +1925 +1925 + + +lnd/clm2/firedata/clmforc.no_anthro_zero_hdm_1x1_simyr1925_181113.nc +nn + +1850 +1850 + + +NONE + + +OFF +.false. + + +0.0 +0.0 + + diff --git a/bld/namelist_files/use_cases/2010_control.xml b/bld/namelist_files/use_cases/2010_control.xml new file mode 100644 index 0000000000..e61ac4dd4b --- /dev/null +++ b/bld/namelist_files/use_cases/2010_control.xml @@ -0,0 +1,36 @@ + + + + +Conditions to simulate 2010 land-use + +2000 + +constant + +.true. +.false. +.false. + +2010 +2010 + +2010 +2010 + +2010 +2010 + +2010 +2010 + +2010 +2010 + +2010 +2010 + +2010 +2010 + + diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 39756d8055..1996d7bcb0 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 927; +my $ntests = 940; if ( defined($opts{'compare'}) ) { - $ntests += 588; + $ntests += 594; } plan( tests=>$ntests ); @@ -338,6 +338,7 @@ sub make_config_cache { "-bgc fates -use_case 2000_control -no-megan", "-bgc cn -use_case 1850-2100_rcp8.5_transient -namelist '&a start_ymd=19201023/'", "-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop", + "-res 0.9x1.25 -bgc bgc -use_case 1850_noanthro_control -drydep -fire_emis -light_res 360x720", ) { my $file = $startfile; &make_env_run(); @@ -413,6 +414,21 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, + "reseed without CN" =>{ options=>" -envxml_dir . -bgc sp", + namelst=>"reseed_dead_plants=.true.", + GLC_TWO_WAY_COUPLING=>"FALSE", + conopts=>"-phys clm5_0", + }, + "dribble_crphrv w/o CN" =>{ options=>" -envxml_dir . -bgc sp", + namelst=>"dribble_crophrv_xsmrpool_2atm=.true.", + GLC_TWO_WAY_COUPLING=>"FALSE", + conopts=>"-phys clm5_0", + }, + "dribble_crphrv w/o crop" =>{ options=>" -envxml_dir . -bgc cn -no-crop", + namelst=>"dribble_crophrv_xsmrpool_2atm=.true.", + GLC_TWO_WAY_COUPLING=>"FALSE", + conopts=>"-phys clm5_0", + }, "CNDV with flanduse_timeseries - clm4_5"=>{ options=>"-bgc bgc -dynamic_vegetation -envxml_dir .", namelst=>"flanduse_timeseries='my_flanduse_timeseries_file.nc'", GLC_TWO_WAY_COUPLING=>"FALSE", @@ -844,6 +860,16 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, + "noanthro_w_crop" =>{ options=>"-envxml_dir . -res 0.9x1.25 -bgc bgc -crop -use_case 1850_noanthro_control", + namelst=>"", + GLC_TWO_WAY_COUPLING=>"FALSE", + conopts=>"-phys clm5_0", + }, + "noanthro_w_irrig" =>{ options=>"-envxml_dir . -res 0.9x1.25 -bgc bgc -use_case 1850_noanthro_control", + namelst=>"irrigate=T", + GLC_TWO_WAY_COUPLING=>"FALSE", + conopts=>"-phys clm5_0", + }, "spdotransconflict" =>{ options=>"-envxml_dir . -bgc sp -use_case 20thC_transient", namelst=>"do_transient_pfts=T,do_transient_crops=.false.", GLC_TWO_WAY_COUPLING=>"FALSE", diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 56971672dc..31649e4dd4 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -15,7 +15,7 @@ clm4.5: - clm5.0: + clm5.0: Satellite phenology: CN: Carbon Nitrogen model CNDV: CN with Dynamic Vegetation @@ -23,8 +23,10 @@ CNDV with prognostic crop: Satellite phenology with VIC hydrology: + Satellite phenology without anthropomorphic influences BGC (vert. resol. CN and methane): BGC (vert. resol. CN and methane) with prognostic crop: + BGC (vert. resol. CN and methane) without anthropomorphic influences: FATES (Functionally Assembled Terrestrial Ecosystem Simulator) Ecosystem Demography model: (experimental) BGC (vert. resol. CN and methane) with dynamic vegetation: BGC (vert. resol. CN and methane) with dynamic vegetation and prognostic crop: @@ -119,15 +121,17 @@ UNSET - 2000_control - 1850_control - 20thC_transient - 1850-2100_rcp6_transient - 1850-2100_rcp4.5_transient - 1850-2100_rcp2.6_transient - 1850-2100_rcp8.5_transient - 20thC_transient - 1850-2100_rcp4.5_transient + 2010_control + 2000_control + 1850_control + 1850_noanthro_control + 20thC_transient + 1850-2100_rcp6_transient + 1850-2100_rcp4.5_transient + 1850-2100_rcp2.6_transient + 1850-2100_rcp8.5_transient + 20thC_transient + 1850-2100_rcp4.5_transient run_component_clm env_run.xml diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 5644197fae..6f8cc4db80 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -176,6 +176,16 @@ 1850_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + I1850Clm50BgcNoAnthro + 1850_DATM%GSWP3v1_CLM50%BGC-NOANTHRO_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + I1850Clm50SpNoAnthro + 1850_DATM%GSWP3v1_CLM50%SP-NOANTHRO_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + IHistClm50BgcCrop HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index bd7d0385e7..629034e4b2 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -8,6 +8,14 @@ + + + + + + + + diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index f2811d290a..8f123cf442 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -146,7 +146,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & er => cnveg_carbonflux_inst%er_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic col_fire_closs => cnveg_carbonflux_inst%fire_closs_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total column-level fire C loss col_hrv_xsmrpool_to_atm => cnveg_carbonflux_inst%hrv_xsmrpool_to_atm_col , & ! Input: [real(r8) (:) ] (gC/m2/s) excess MR pool harvest mortality - + col_xsmrpool_to_atm => cnveg_carbonflux_inst%xsmrpool_to_atm_col , & ! Input: [real(r8) (:) ] (gC/m2/s) excess MR pool crop harvest loss to atm som_c_leached => soilbiogeochem_carbonflux_inst%som_c_leached_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total SOM C loss from vertical transport totcolc => cnveg_carbonstate_inst%totc_col & ! Input: [real(r8) (:) ] (gC/m2) total column carbon, incl veg and cpool @@ -167,7 +167,8 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! calculate total column-level outputs ! er = ar + hr, col_fire_closs includes patch-level fire losses - col_coutputs = er(c) + col_fire_closs(c) + col_hrv_xsmrpool_to_atm(c) + col_coutputs = er(c) + col_fire_closs(c) + col_hrv_xsmrpool_to_atm(c) + & + col_xsmrpool_to_atm(c) ! Fluxes to product pools are included in column-level outputs: the product ! pools are not included in totcolc, so are outside the system with respect to @@ -211,6 +212,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*)'er = ',er(c)*dt write(iulog,*)'col_fire_closs = ',col_fire_closs(c)*dt write(iulog,*)'col_hrv_xsmrpool_to_atm = ',col_hrv_xsmrpool_to_atm(c)*dt + write(iulog,*)'col_xsmrpool_to_atm = ',col_xsmrpool_to_atm(c)*dt write(iulog,*)'wood_harvestc = ',wood_harvestc(c)*dt write(iulog,*)'grainc_to_cropprodc = ',grainc_to_cropprodc(c)*dt write(iulog,*)'-1*som_c_leached = ',som_c_leached(c)*dt diff --git a/src/biogeochem/CNCStateUpdate1Mod.F90 b/src/biogeochem/CNCStateUpdate1Mod.F90 index ac7cb89162..e1da2f354f 100644 --- a/src/biogeochem/CNCStateUpdate1Mod.F90 +++ b/src/biogeochem/CNCStateUpdate1Mod.F90 @@ -142,7 +142,7 @@ end subroutine CStateUpdate0 !----------------------------------------------------------------------- subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & crop_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - soilbiogeochem_carbonflux_inst) + soilbiogeochem_carbonflux_inst, dribble_crophrv_xsmrpool_2atm) ! ! !DESCRIPTION: ! On the radiation time step, update all the prognostic carbon state @@ -158,6 +158,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst ! See note below for xsmrpool_to_atm_patch type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst + logical , intent(in) :: dribble_crophrv_xsmrpool_2atm ! ! !LOCAL VARIABLES: integer :: c,p,j,k,l ! indices @@ -165,6 +166,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & real(r8) :: dt ! radiation time step (seconds) real(r8) :: check_cpool real(r8) :: cpool_delta + real(r8), parameter :: kprod05 = 1.44e-7 ! decay constant for 0.5-year product pool (1/s) (lose ~90% over a half year) !----------------------------------------------------------------------- associate( & @@ -189,23 +191,23 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & ! plant to litter fluxes if (.not. use_fates) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ! phenology and dynamic land cover fluxes - cf_soil%decomp_cpools_sourcesink_col(c,j,i_met_lit) = & - cf_veg%phenology_c_to_litr_met_c_col(c,j) *dt - cf_soil%decomp_cpools_sourcesink_col(c,j,i_cel_lit) = & - cf_veg%phenology_c_to_litr_cel_c_col(c,j) *dt - cf_soil%decomp_cpools_sourcesink_col(c,j,i_lig_lit) = & - cf_veg%phenology_c_to_litr_lig_c_col(c,j) *dt - - ! NOTE(wjs, 2017-01-02) This used to be set to a non-zero value, but the - ! terms have been moved to CStateUpdateDynPatch. I think this is zeroed every - ! time step, but to be safe, I'm explicitly setting it to zero here. - cf_soil%decomp_cpools_sourcesink_col(c,j,i_cwd) = 0._r8 + do j = 1,nlevdecomp + do fc = 1,num_soilc + c = filter_soilc(fc) + ! phenology and dynamic land cover fluxes + cf_soil%decomp_cpools_sourcesink_col(c,j,i_met_lit) = & + cf_veg%phenology_c_to_litr_met_c_col(c,j) *dt + cf_soil%decomp_cpools_sourcesink_col(c,j,i_cel_lit) = & + cf_veg%phenology_c_to_litr_cel_c_col(c,j) *dt + cf_soil%decomp_cpools_sourcesink_col(c,j,i_lig_lit) = & + cf_veg%phenology_c_to_litr_lig_c_col(c,j) *dt + + ! NOTE(wjs, 2017-01-02) This used to be set to a non-zero value, but the + ! terms have been moved to CStateUpdateDynPatch. I think this is zeroed every + ! time step, but to be safe, I'm explicitly setting it to zero here. + cf_soil%decomp_cpools_sourcesink_col(c,j,i_cwd) = 0._r8 + end do end do - end do else !use_fates ! here add all fates litterfall and CWD breakdown to litter fluxes do j = 1,nlevdecomp @@ -244,251 +246,267 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & end if end do - if (.not. use_fates) then - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - ! phenology: transfer growth fluxes - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) + cf_veg%leafc_xfer_to_leafc_patch(p)*dt - cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) - cf_veg%leafc_xfer_to_leafc_patch(p)*dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) + cf_veg%frootc_xfer_to_frootc_patch(p)*dt - cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) - cf_veg%frootc_xfer_to_frootc_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%deadstemc_xfer_to_deadstemc_patch(p)*dt - cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) - cf_veg%deadstemc_xfer_to_deadstemc_patch(p)*dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) + cf_veg%livecrootc_xfer_to_livecrootc_patch(p)*dt - cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) - cf_veg%livecrootc_xfer_to_livecrootc_patch(p)*dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt - cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) - cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt - cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) + cf_veg%grainc_xfer_to_grainc_patch(p)*dt - cs_veg%grainc_xfer_patch(p) = cs_veg%grainc_xfer_patch(p) - cf_veg%grainc_xfer_to_grainc_patch(p)*dt - end if - - ! phenology: litterfall fluxes - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_litter_patch(p)*dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) - cf_veg%frootc_to_litter_patch(p)*dt - - - - - ! livewood turnover fluxes - if (woody(ivt(p)) == 1._r8) then - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_deadstemc_patch(p)*dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%livestemc_to_deadstemc_patch(p)*dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) - cf_veg%livecrootc_to_deadcrootc_patch(p)*dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%livecrootc_to_deadcrootc_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_litter_patch(p)*dt - cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) & - - (cf_veg%grainc_to_food_patch(p) + cf_veg%grainc_to_seed_patch(p))*dt - cs_veg%cropseedc_deficit_patch(p) = cs_veg%cropseedc_deficit_patch(p) & - - cf_veg%crop_seedc_to_leaf_patch(p) * dt & - + cf_veg%grainc_to_seed_patch(p) * dt - end if + if (.not. use_fates) then + do fp = 1,num_soilp + p = filter_soilp(fp) + c = patch%column(p) + + ! phenology: transfer growth fluxes + cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) + cf_veg%leafc_xfer_to_leafc_patch(p)*dt + cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) - cf_veg%leafc_xfer_to_leafc_patch(p)*dt + cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) + cf_veg%frootc_xfer_to_frootc_patch(p)*dt + cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) - cf_veg%frootc_xfer_to_frootc_patch(p)*dt + if (woody(ivt(p)) == 1._r8) then + cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt + cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt + cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%deadstemc_xfer_to_deadstemc_patch(p)*dt + cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) - cf_veg%deadstemc_xfer_to_deadstemc_patch(p)*dt + cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) + cf_veg%livecrootc_xfer_to_livecrootc_patch(p)*dt + cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) - cf_veg%livecrootc_xfer_to_livecrootc_patch(p)*dt + cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt + cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) - cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt + end if + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + ! lines here for consistency; the transfer terms are zero + cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt + cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt + cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) + cf_veg%grainc_xfer_to_grainc_patch(p)*dt + cs_veg%grainc_xfer_patch(p) = cs_veg%grainc_xfer_patch(p) - cf_veg%grainc_xfer_to_grainc_patch(p)*dt + end if + + ! phenology: litterfall fluxes + cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_litter_patch(p)*dt + cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) - cf_veg%frootc_to_litter_patch(p)*dt - check_cpool = cs_veg%cpool_patch(p)- cf_veg%psnsun_to_cpool_patch(p)*dt-cf_veg%psnshade_to_cpool_patch(p)*dt - cpool_delta = cs_veg%cpool_patch(p) + ! livewood turnover fluxes + if (woody(ivt(p)) == 1._r8) then + cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_deadstemc_patch(p)*dt + cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%livestemc_to_deadstemc_patch(p)*dt + cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) - cf_veg%livecrootc_to_deadcrootc_patch(p)*dt + cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%livecrootc_to_deadcrootc_patch(p)*dt + end if + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_litter_patch(p)*dt + cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) & + - (cf_veg%grainc_to_food_patch(p) + cf_veg%grainc_to_seed_patch(p))*dt + cs_veg%cropseedc_deficit_patch(p) = cs_veg%cropseedc_deficit_patch(p) & + - cf_veg%crop_seedc_to_leaf_patch(p) * dt & + + cf_veg%grainc_to_seed_patch(p) * dt + end if - ! maintenance respiration fluxes from cpool - - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_xsmrpool_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%leaf_curmr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%froot_curmr_patch(p)*dt - If (woody(ivt(p)) == 1._r8) then - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livestem_curmr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livecroot_curmr_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livestem_curmr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%grain_curmr_patch(p)*dt - end if + check_cpool = cs_veg%cpool_patch(p)- cf_veg%psnsun_to_cpool_patch(p)*dt-cf_veg%psnshade_to_cpool_patch(p)*dt + cpool_delta = cs_veg%cpool_patch(p) + ! maintenance respiration fluxes from cpool + + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_xsmrpool_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%leaf_curmr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%froot_curmr_patch(p)*dt + If (woody(ivt(p)) == 1._r8) then + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livestem_curmr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livecroot_curmr_patch(p)*dt + end if + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livestem_curmr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%grain_curmr_patch(p)*dt + end if - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_resp_patch(p)*dt - - !RF Add in the carbon spent on uptake respiration. - cs_veg%cpool_patch(p)= cs_veg%cpool_patch(p) - cf_veg%soilc_change_patch(p)*dt - ! maintenance respiration fluxes from xsmrpool - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) + cf_veg%cpool_to_xsmrpool_patch(p)*dt - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%leaf_xsmr_patch(p)*dt - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%froot_xsmr_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livestem_xsmr_patch(p)*dt - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livecroot_xsmr_patch(p)*dt - end if - - ! allocation fluxes - if (carbon_resp_opt == 1) then - cf_veg%cpool_to_leafc_patch(p) = cf_veg%cpool_to_leafc_patch(p) - cf_veg%cpool_to_leafc_resp_patch(p) - cf_veg%cpool_to_leafc_storage_patch(p) = cf_veg%cpool_to_leafc_storage_patch(p) - & - cf_veg%cpool_to_leafc_storage_resp_patch(p) - cf_veg%cpool_to_frootc_patch(p) = cf_veg%cpool_to_frootc_patch(p) - cf_veg%cpool_to_frootc_resp_patch(p) - cf_veg%cpool_to_frootc_storage_patch(p) = cf_veg%cpool_to_frootc_storage_patch(p) & + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_resp_patch(p)*dt + + !RF Add in the carbon spent on uptake respiration. + cs_veg%cpool_patch(p)= cs_veg%cpool_patch(p) - cf_veg%soilc_change_patch(p)*dt + + ! maintenance respiration fluxes from xsmrpool + cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) + cf_veg%cpool_to_xsmrpool_patch(p)*dt + cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%leaf_xsmr_patch(p)*dt + cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%froot_xsmr_patch(p)*dt + if (woody(ivt(p)) == 1._r8) then + cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livestem_xsmr_patch(p)*dt + cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livecroot_xsmr_patch(p)*dt + end if + + ! allocation fluxes + if (carbon_resp_opt == 1) then + cf_veg%cpool_to_leafc_patch(p) = cf_veg%cpool_to_leafc_patch(p) - cf_veg%cpool_to_leafc_resp_patch(p) + cf_veg%cpool_to_leafc_storage_patch(p) = cf_veg%cpool_to_leafc_storage_patch(p) - & + cf_veg%cpool_to_leafc_storage_resp_patch(p) + cf_veg%cpool_to_frootc_patch(p) = cf_veg%cpool_to_frootc_patch(p) - cf_veg%cpool_to_frootc_resp_patch(p) + cf_veg%cpool_to_frootc_storage_patch(p) = cf_veg%cpool_to_frootc_storage_patch(p) & - cf_veg%cpool_to_frootc_storage_resp_patch(p) - end if - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_leafc_patch(p)*dt - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) + cf_veg%cpool_to_leafc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_leafc_storage_patch(p)*dt - cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) + cf_veg%cpool_to_leafc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_frootc_patch(p)*dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) + cf_veg%cpool_to_frootc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_frootc_storage_patch(p)*dt - - cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) + cf_veg%cpool_to_frootc_storage_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - if (carbon_resp_opt == 1) then - cf_veg%cpool_to_livecrootc_patch(p) = cf_veg%cpool_to_livecrootc_patch(p) - cf_veg%cpool_to_livecrootc_resp_patch(p) - cf_veg%cpool_to_livecrootc_storage_patch(p) = cf_veg%cpool_to_livecrootc_storage_patch(p) - & - cf_veg%cpool_to_livecrootc_storage_resp_patch(p) - cf_veg%cpool_to_livestemc_patch(p) = cf_veg%cpool_to_livestemc_patch(p) - cf_veg%cpool_to_livestemc_resp_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p) = cf_veg%cpool_to_livestemc_storage_patch(p) - & + end if + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_leafc_patch(p)*dt + cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) + cf_veg%cpool_to_leafc_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_leafc_storage_patch(p)*dt + cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) + cf_veg%cpool_to_leafc_storage_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_frootc_patch(p)*dt + cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) + cf_veg%cpool_to_frootc_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_frootc_storage_patch(p)*dt + + cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) + cf_veg%cpool_to_frootc_storage_patch(p)*dt + if (woody(ivt(p)) == 1._r8) then + if (carbon_resp_opt == 1) then + cf_veg%cpool_to_livecrootc_patch(p) = cf_veg%cpool_to_livecrootc_patch(p) - cf_veg%cpool_to_livecrootc_resp_patch(p) + cf_veg%cpool_to_livecrootc_storage_patch(p) = cf_veg%cpool_to_livecrootc_storage_patch(p) - & + cf_veg%cpool_to_livecrootc_storage_resp_patch(p) + cf_veg%cpool_to_livestemc_patch(p) = cf_veg%cpool_to_livestemc_patch(p) - cf_veg%cpool_to_livestemc_resp_patch(p) + cf_veg%cpool_to_livestemc_storage_patch(p) = cf_veg%cpool_to_livestemc_storage_patch(p) - & cf_veg%cpool_to_livestemc_storage_resp_patch(p) - end if - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_patch(p)*dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%cpool_to_livestemc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p)*dt - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) + cf_veg%cpool_to_livestemc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadstemc_patch(p)*dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%cpool_to_deadstemc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadstemc_storage_patch(p)*dt - cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) + cf_veg%cpool_to_deadstemc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livecrootc_patch(p)*dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) + cf_veg%cpool_to_livecrootc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livecrootc_storage_patch(p)*dt - cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p) + cf_veg%cpool_to_livecrootc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadcrootc_patch(p)*dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%cpool_to_deadcrootc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadcrootc_storage_patch(p)*dt - cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p) + cf_veg%cpool_to_deadcrootc_storage_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - if (carbon_resp_opt == 1) then - cf_veg%cpool_to_livestemc_patch(p) = cf_veg%cpool_to_livestemc_patch(p) - cf_veg%cpool_to_livestemc_resp_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p) = cf_veg%cpool_to_livestemc_storage_patch(p) - & + end if + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_patch(p)*dt + cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%cpool_to_livestemc_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p)*dt + cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) + cf_veg%cpool_to_livestemc_storage_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadstemc_patch(p)*dt + cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%cpool_to_deadstemc_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadstemc_storage_patch(p)*dt + cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) + cf_veg%cpool_to_deadstemc_storage_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livecrootc_patch(p)*dt + cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) + cf_veg%cpool_to_livecrootc_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livecrootc_storage_patch(p)*dt + cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p) + cf_veg%cpool_to_livecrootc_storage_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadcrootc_patch(p)*dt + cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%cpool_to_deadcrootc_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadcrootc_storage_patch(p)*dt + cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p) + cf_veg%cpool_to_deadcrootc_storage_patch(p)*dt + end if + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + if (carbon_resp_opt == 1) then + cf_veg%cpool_to_livestemc_patch(p) = cf_veg%cpool_to_livestemc_patch(p) - cf_veg%cpool_to_livestemc_resp_patch(p) + cf_veg%cpool_to_livestemc_storage_patch(p) = cf_veg%cpool_to_livestemc_storage_patch(p) - & cf_veg%cpool_to_livestemc_storage_resp_patch(p) - end if - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_patch(p)*dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%cpool_to_livestemc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p)*dt - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) + cf_veg%cpool_to_livestemc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_grainc_patch(p)*dt - cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) + cf_veg%cpool_to_grainc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_grainc_storage_patch(p)*dt - cs_veg%grainc_storage_patch(p) = cs_veg%grainc_storage_patch(p) + cf_veg%cpool_to_grainc_storage_patch(p)*dt - end if - - ! growth respiration fluxes for current growth - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_leaf_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_froot_gr_patch(p)*dt - - if (woody(ivt(p)) == 1._r8) then - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadstem_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livecroot_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadcroot_gr_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_grain_gr_patch(p)*dt - end if - - ! growth respiration for transfer growth - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_leaf_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_froot_gr_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livestem_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_deadstem_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livecroot_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_deadcroot_gr_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livestem_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_grain_gr_patch(p)*dt - end if - - ! growth respiration at time of storage - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_leaf_storage_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_froot_storage_gr_patch(p)*dt - - if (woody(ivt(p)) == 1._r8) then + end if + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_patch(p)*dt + cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%cpool_to_livestemc_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p)*dt + cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) + cf_veg%cpool_to_livestemc_storage_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_grainc_patch(p)*dt + cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) + cf_veg%cpool_to_grainc_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_grainc_storage_patch(p)*dt + cs_veg%grainc_storage_patch(p) = cs_veg%grainc_storage_patch(p) + cf_veg%cpool_to_grainc_storage_patch(p)*dt + end if + + ! growth respiration fluxes for current growth + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_leaf_gr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_froot_gr_patch(p)*dt + + if (woody(ivt(p)) == 1._r8) then + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_gr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadstem_gr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livecroot_gr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadcroot_gr_patch(p)*dt + end if + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_gr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_grain_gr_patch(p)*dt + end if + + ! growth respiration for transfer growth + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_leaf_gr_patch(p)*dt + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_froot_gr_patch(p)*dt + if (woody(ivt(p)) == 1._r8) then + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livestem_gr_patch(p)*dt + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_deadstem_gr_patch(p)*dt + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livecroot_gr_patch(p)*dt + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_deadcroot_gr_patch(p)*dt + end if + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livestem_gr_patch(p)*dt + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_grain_gr_patch(p)*dt + end if + + ! growth respiration at time of storage + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_leaf_storage_gr_patch(p)*dt + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_froot_storage_gr_patch(p)*dt + + if (woody(ivt(p)) == 1._r8) then cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_storage_gr_patch(p)*dt cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadstem_storage_gr_patch(p)*dt cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livecroot_storage_gr_patch(p)*dt cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadcroot_storage_gr_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_storage_gr_patch(p)*dt - - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_grain_storage_gr_patch(p)*dt - - end if - - ! growth respiration stored for release during transfer growth - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_gresp_storage_patch(p)*dt - cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) + cf_veg%cpool_to_gresp_storage_patch(p)*dt - - ! move storage pools into transfer pools - cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) - cf_veg%leafc_storage_to_xfer_patch(p)*dt - cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) + cf_veg%leafc_storage_to_xfer_patch(p)*dt - cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) - cf_veg%frootc_storage_to_xfer_patch(p)*dt - cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) + cf_veg%frootc_storage_to_xfer_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) - cf_veg%livestemc_storage_to_xfer_patch(p)*dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) + cf_veg%livestemc_storage_to_xfer_patch(p)*dt - cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) - cf_veg%deadstemc_storage_to_xfer_patch(p)*dt - cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) + cf_veg%deadstemc_storage_to_xfer_patch(p)*dt - cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p)- cf_veg%livecrootc_storage_to_xfer_patch(p)*dt - cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) + cf_veg%livecrootc_storage_to_xfer_patch(p)*dt - cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p)- cf_veg%deadcrootc_storage_to_xfer_patch(p)*dt - cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) + cf_veg%deadcrootc_storage_to_xfer_patch(p)*dt - cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) - cf_veg%gresp_storage_to_xfer_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) + cf_veg%gresp_storage_to_xfer_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) - cf_veg%livestemc_storage_to_xfer_patch(p)*dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) + cf_veg%livestemc_storage_to_xfer_patch(p)*dt - cs_veg%grainc_storage_patch(p) = cs_veg%grainc_storage_patch(p) - cf_veg%grainc_storage_to_xfer_patch(p)*dt - cs_veg%grainc_xfer_patch(p) = cs_veg%grainc_xfer_patch(p) + cf_veg%grainc_storage_to_xfer_patch(p)*dt - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livestem_xsmr_patch(p)*dt - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%grain_xsmr_patch(p)*dt - if (harvdate(p) < 999) then ! beginning at harvest, send to atm - ! TODO (mv, 11-02-2014) the following lines are why the cf_veg is - ! an intent(inout) - ! fluxes should not be updated in this module - not sure where - ! this belongs - ! DML (06-20-2017) While debugging crop isotope code, found that cpool_patch and frootc_patch - ! could occasionally be very small but nonzero numbers after crop harvest, which persists - ! through to next planting and for reasons that could not 100% - ! isolate, caused C12/C13 ratios to occasionally go out of - ! bounds. Zeroing out these small pools and putting them into the flux to the - ! atmosphere solved many of the crop isotope problems - - cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%xsmrpool_patch(p)/dt - cs_veg%xsmrpool_patch(p) = 0._r8 - cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%cpool_patch(p)/dt - cs_veg%cpool_patch(p) = 0._r8 - cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%frootc_patch(p)/dt - cs_veg%frootc_patch(p) = 0._r8 - end if - end if + end if + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_storage_gr_patch(p)*dt + + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_grain_storage_gr_patch(p)*dt + + end if + + ! growth respiration stored for release during transfer growth + cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_gresp_storage_patch(p)*dt + cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) + cf_veg%cpool_to_gresp_storage_patch(p)*dt + + ! move storage pools into transfer pools + cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) - cf_veg%leafc_storage_to_xfer_patch(p)*dt + cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) + cf_veg%leafc_storage_to_xfer_patch(p)*dt + cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) - cf_veg%frootc_storage_to_xfer_patch(p)*dt + cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) + cf_veg%frootc_storage_to_xfer_patch(p)*dt + if (woody(ivt(p)) == 1._r8) then + cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) - cf_veg%livestemc_storage_to_xfer_patch(p)*dt + cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) + cf_veg%livestemc_storage_to_xfer_patch(p)*dt + cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) - cf_veg%deadstemc_storage_to_xfer_patch(p)*dt + cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) + cf_veg%deadstemc_storage_to_xfer_patch(p)*dt + cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p)- cf_veg%livecrootc_storage_to_xfer_patch(p)*dt + cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) + cf_veg%livecrootc_storage_to_xfer_patch(p)*dt + cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p)- cf_veg%deadcrootc_storage_to_xfer_patch(p)*dt + cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) + cf_veg%deadcrootc_storage_to_xfer_patch(p)*dt + cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) - cf_veg%gresp_storage_to_xfer_patch(p)*dt + cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) + cf_veg%gresp_storage_to_xfer_patch(p)*dt + end if + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + ! lines here for consistency; the transfer terms are zero + cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) - cf_veg%livestemc_storage_to_xfer_patch(p)*dt + cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) + cf_veg%livestemc_storage_to_xfer_patch(p)*dt + cs_veg%grainc_storage_patch(p) = cs_veg%grainc_storage_patch(p) - cf_veg%grainc_storage_to_xfer_patch(p)*dt + cs_veg%grainc_xfer_patch(p) = cs_veg%grainc_xfer_patch(p) + cf_veg%grainc_storage_to_xfer_patch(p)*dt + end if + + if (ivt(p) >= npcropmin) then ! skip 2 generic crops + cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livestem_xsmr_patch(p)*dt + cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%grain_xsmr_patch(p)*dt + if (harvdate(p) < 999) then ! beginning at harvest, send to atm + ! TODO (mv, 11-02-2014) the following lines are why the cf_veg is + ! an intent(inout) + ! fluxes should not be updated in this module - not sure where + ! this belongs + ! DML (06-20-2017) While debugging crop isotope code, found that cpool_patch and frootc_patch + ! could occasionally be very small but nonzero numbers after crop harvest, which persists + ! through to next planting and for reasons that could not 100% + ! isolate, caused C12/C13 ratios to occasionally go out of + ! bounds. Zeroing out these small pools and putting them into the flux to the + ! atmosphere solved many of the crop isotope problems + + ! Instantly release XSMRPOOL to atmosphere + if ( .not. dribble_crophrv_xsmrpool_2atm ) then + cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%xsmrpool_patch(p)/dt + cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%cpool_patch(p)/dt + cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%frootc_patch(p)/dt + ! Save xsmrpool, cpool, frootc to loss state variable for dribbling + else + cs_veg%xsmrpool_loss_patch(p) = cs_veg%xsmrpool_loss_patch(p) + & + cs_veg%xsmrpool_patch(p) + & + cs_veg%cpool_patch(p) + & + cs_veg%frootc_patch(p) + end if + cs_veg%xsmrpool_patch(p) = 0._r8 + cs_veg%cpool_patch(p) = 0._r8 + cs_veg%frootc_patch(p) = 0._r8 + end if + + ! Slowly release xsmrpool to atmosphere + if ( dribble_crophrv_xsmrpool_2atm ) then + ! calculate flux of xsmrpool loss to atm + cf_veg%xsmrpool_to_atm_patch(p) = cs_veg%xsmrpool_loss_patch(p) * kprod05 + + ! update xsmrpool loss state + cs_veg%xsmrpool_loss_patch(p) = cs_veg%xsmrpool_loss_patch(p) - cf_veg%xsmrpool_to_atm_patch(p) * dt + end if + + end if - end do ! end of patch loop - end if + end do ! end of patch loop + end if ! end of NOT fates end associate diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 index de424e4e06..44441c8c3d 100644 --- a/src/biogeochem/CNDriverMod.F90 +++ b/src/biogeochem/CNDriverMod.F90 @@ -94,7 +94,7 @@ subroutine CNDriverNoLeaching(bounds, atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & dgvs_inst, photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & - nutrient_competition_method, cnfire_method) + nutrient_competition_method, cnfire_method, dribble_crophrv_xsmrpool_2atm) ! ! !DESCRIPTION: ! The core CN code is executed here. Calculates fluxes for maintenance @@ -183,6 +183,7 @@ subroutine CNDriverNoLeaching(bounds, type(energyflux_type) , intent(in) :: energyflux_inst class(nutrient_competition_method_type) , intent(inout) :: nutrient_competition_method class(cnfire_method_type) , intent(inout) :: cnfire_method + logical , intent(in) :: dribble_crophrv_xsmrpool_2atm ! ! !LOCAL VARIABLES: real(r8):: cn_decomp_pools(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_pools) @@ -553,16 +554,16 @@ subroutine CNDriverNoLeaching(bounds, ! Update all prognostic carbon state variables (except for gap-phase mortality and fire fluxes) call CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & crop_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - soilbiogeochem_carbonflux_inst) + soilbiogeochem_carbonflux_inst, dribble_crophrv_xsmrpool_2atm) if ( use_c13 ) then call CStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & crop_inst, c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst) + c13_soilbiogeochem_carbonflux_inst, dribble_crophrv_xsmrpool_2atm) end if if ( use_c14 ) then call CStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & crop_inst, c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst) + c14_soilbiogeochem_carbonflux_inst, dribble_crophrv_xsmrpool_2atm) end if ! Update all prognostic nitrogen state variables (except for gap-phase mortality and fire fluxes) diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 079813d2a3..f88c7f5e66 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -186,6 +186,8 @@ module CNVegCarbonFluxType ! growth respiration fluxes real(r8), pointer :: xsmrpool_to_atm_patch (:) ! excess MR pool harvest mortality (gC/m2/s) + real(r8), pointer :: xsmrpool_to_atm_col (:) ! excess MR pool harvest mortality (gC/m2/s) (p2c) + real(r8), pointer :: xsmrpool_to_atm_grc (:) ! excess MR pool harvest mortality (gC/m2/s) (p2g) real(r8), pointer :: cpool_leaf_gr_patch (:) ! leaf growth respiration (gC/m2/s) real(r8), pointer :: cpool_leaf_storage_gr_patch (:) ! leaf growth respiration to storage (gC/m2/s) real(r8), pointer :: transfer_leaf_gr_patch (:) ! leaf growth respiration from storage (gC/m2/s) @@ -367,6 +369,7 @@ module CNVegCarbonFluxType ! that are dribbled throughout the year type(annual_flux_dribbler_type) :: dwt_conv_cflux_dribbler type(annual_flux_dribbler_type) :: hrv_xsmrpool_to_atm_dribbler + logical, private :: dribble_crophrv_xsmrpool_2atm contains procedure , public :: Init @@ -389,12 +392,14 @@ module CNVegCarbonFluxType contains !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type) + subroutine Init(this, bounds, carbon_type, dribble_crophrv_xsmrpool_2atm) class(cnveg_carbonflux_type) :: this type(bounds_type), intent(in) :: bounds character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] + logical , intent(in) :: dribble_crophrv_xsmrpool_2atm + this%dribble_crophrv_xsmrpool_2atm = dribble_crophrv_xsmrpool_2atm call this%InitAllocate ( bounds, carbon_type) call this%InitHistory ( bounds, carbon_type ) call this%InitCold (bounds ) @@ -460,7 +465,7 @@ subroutine InitAllocate(this, bounds, carbon_type) allocate(this%hrv_deadcrootc_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadcrootc_xfer_to_litter_patch (:) = nan allocate(this%hrv_gresp_storage_to_litter_patch (begp:endp)) ; this%hrv_gresp_storage_to_litter_patch (:) = nan allocate(this%hrv_gresp_xfer_to_litter_patch (begp:endp)) ; this%hrv_gresp_xfer_to_litter_patch (:) = nan - allocate(this%hrv_xsmrpool_to_atm_patch (begp:endp)) ; this%hrv_xsmrpool_to_atm_patch (:) = nan + allocate(this%hrv_xsmrpool_to_atm_patch (begp:endp)) ; this%hrv_xsmrpool_to_atm_patch (:) = 0.0_r8 allocate(this%m_leafc_to_fire_patch (begp:endp)) ; this%m_leafc_to_fire_patch (:) = nan allocate(this%m_leafc_storage_to_fire_patch (begp:endp)) ; this%m_leafc_storage_to_fire_patch (:) = nan allocate(this%m_leafc_xfer_to_fire_patch (begp:endp)) ; this%m_leafc_xfer_to_fire_patch (:) = nan @@ -600,7 +605,9 @@ subroutine InitAllocate(this, bounds, carbon_type) allocate(this%cpool_grain_gr_patch (begp:endp)) ; this%cpool_grain_gr_patch (:) = nan allocate(this%cpool_grain_storage_gr_patch (begp:endp)) ; this%cpool_grain_storage_gr_patch (:) = nan allocate(this%transfer_grain_gr_patch (begp:endp)) ; this%transfer_grain_gr_patch (:) = nan - allocate(this%xsmrpool_to_atm_patch (begp:endp)) ; this%xsmrpool_to_atm_patch (:) = nan + allocate(this%xsmrpool_to_atm_patch (begp:endp)) ; this%xsmrpool_to_atm_patch (:) = 0.0_r8 + allocate(this%xsmrpool_to_atm_col (begc:endc)) ; this%xsmrpool_to_atm_col (:) = 0.0_r8 + allocate(this%xsmrpool_to_atm_grc (begg:endg)) ; this%xsmrpool_to_atm_grc (:) = 0.0_r8 allocate(this%grainc_storage_to_xfer_patch (begp:endp)) ; this%grainc_storage_to_xfer_patch (:) = nan allocate(this%frootc_alloc_patch (begp:endp)) ; this%frootc_alloc_patch (:) = nan allocate(this%frootc_loss_patch (begp:endp)) ; this%frootc_loss_patch (:) = nan @@ -696,7 +703,7 @@ subroutine InitAllocate(this, bounds, carbon_type) allocate(this%fire_closs_p2c_col (begc:endc)) ; this%fire_closs_p2c_col (:) = nan allocate(this%fire_closs_col (begc:endc)) ; this%fire_closs_col (:) = nan allocate(this%wood_harvestc_col (begc:endc)) ; this%wood_harvestc_col (:) = nan - allocate(this%hrv_xsmrpool_to_atm_col (begc:endc)) ; this%hrv_xsmrpool_to_atm_col (:) = nan + allocate(this%hrv_xsmrpool_to_atm_col (begc:endc)) ; this%hrv_xsmrpool_to_atm_col (:) = 0.0_r8 allocate(this%tempsum_npp_patch (begp:endp)) ; this%tempsum_npp_patch (:) = nan allocate(this%annsum_npp_patch (begp:endp)) ; this%annsum_npp_patch (:) = nan allocate(this%tempsum_litfall_patch (begp:endp)) ; this%tempsum_litfall_patch (:) = nan @@ -3880,6 +3887,7 @@ subroutine SetValues ( this, & this%cwdc_hr_col(i) = value_column this%cwdc_loss_col(i) = value_column this%litterc_loss_col(i) = value_column + end do do fi = 1,num_patch @@ -3938,8 +3946,10 @@ subroutine SetValues ( this, & this%fire_closs_col(i) = value_column this%wood_harvestc_col(i) = value_column this%hrv_xsmrpool_to_atm_col(i) = value_column - this%nep_col(i) = value_column + if ( use_crop )then + this%xsmrpool_to_atm_col(i) = value_column + end if end do @@ -4117,8 +4127,9 @@ subroutine Summary_carbonflux(this, & if ( use_crop .and. patch%itype(p) >= npcropmin )then this%ar_patch(p) = & this%mr_patch(p) + & - this%gr_patch(p) + & - this%xsmrpool_to_atm_patch(p) ! xsmr... is -ve (slevis) + this%gr_patch(p) + if ( .not. this%dribble_crophrv_xsmrpool_2atm ) this%ar_patch(p) = this%ar_patch(p) + & + this%xsmrpool_to_atm_patch(p) ! xsmr... is -ve (slevis) else this%ar_patch(p) = & this%mr_patch(p) + & @@ -4401,6 +4412,18 @@ subroutine Summary_carbonflux(this, & this%hrv_xsmrpool_to_atm_patch(bounds%begp:bounds%endp), & this%hrv_xsmrpool_to_atm_col(bounds%begc:bounds%endc)) + if (use_crop .and. this%dribble_crophrv_xsmrpool_2atm) then + call p2c(bounds, num_soilc, filter_soilc, & + this%xsmrpool_to_atm_patch(bounds%begp:bounds%endp), & + this%xsmrpool_to_atm_col(bounds%begc:bounds%endc)) + + call c2g( bounds = bounds, & + carr = this%xsmrpool_to_atm_col(bounds%begc:bounds%endc), & + garr = this%xsmrpool_to_atm_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + end if + call p2c(bounds, num_soilc, filter_soilc, & this%fire_closs_patch(bounds%begp:bounds%endp), & this%fire_closs_p2c_col(bounds%begc:bounds%endc)) @@ -4545,6 +4568,7 @@ subroutine Summary_carbonflux(this, & this%nbp_grc(g) = & -this%nee_grc(g) - & this%landuseflux_grc(g) + if ( this%dribble_crophrv_xsmrpool_2atm ) this%nbp_grc(g) = this%nbp_grc(g) - this%xsmrpool_to_atm_grc(g) end do ! coarse woody debris C loss diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index a6dd0dfd96..3921e66c19 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -58,6 +58,7 @@ module CNVegCarbonStateType real(r8), pointer :: gresp_xfer_patch (:) ! (gC/m2) growth respiration transfer real(r8), pointer :: cpool_patch (:) ! (gC/m2) temporary photosynthate C pool real(r8), pointer :: xsmrpool_patch (:) ! (gC/m2) abstract C pool to meet excess MR demand + real(r8), pointer :: xsmrpool_loss_patch (:) ! (gC/m2) abstract C pool to meet excess MR demand loss real(r8), pointer :: ctrunc_patch (:) ! (gC/m2) patch-level sink for C truncation real(r8), pointer :: woodc_patch (:) ! (gC/m2) wood C real(r8), pointer :: leafcmax_patch (:) ! (gC/m2) ann max leaf C @@ -83,6 +84,7 @@ module CNVegCarbonStateType real(r8), pointer :: totc_col (:) ! (gC/m2) total column carbon, incl veg and cpool real(r8), pointer :: totecosysc_col (:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool + logical, private :: dribble_crophrv_xsmrpool_2atm contains procedure , public :: Init @@ -115,18 +117,21 @@ module CNVegCarbonStateType !------------------------------------------------------------------------ subroutine Init(this, bounds, carbon_type, ratio, NLFilename, & - c12_cnveg_carbonstate_inst) + dribble_crophrv_xsmrpool_2atm, c12_cnveg_carbonstate_inst) class(cnveg_carbonstate_type) :: this type(bounds_type) , intent(in) :: bounds real(r8) , intent(in) :: ratio character(len=*) , intent(in) :: carbon_type ! Carbon isotope type C12, C13 or C1 character(len=*) , intent(in) :: NLFilename ! Namelist filename + logical , intent(in) :: dribble_crophrv_xsmrpool_2atm type(cnveg_carbonstate_type) , intent(in), optional :: c12_cnveg_carbonstate_inst ! cnveg_carbonstate for C12 (if C13 or C14) !----------------------------------------------------------------------- this%species = species_from_string(carbon_type) + this%dribble_crophrv_xsmrpool_2atm = dribble_crophrv_xsmrpool_2atm + call this%InitAllocate ( bounds) call this%InitReadNML ( NLFilename ) call this%InitHistory ( bounds, carbon_type) @@ -239,6 +244,7 @@ subroutine InitAllocate(this, bounds) allocate(this%gresp_xfer_patch (begp:endp)) ; this%gresp_xfer_patch (:) = nan allocate(this%cpool_patch (begp:endp)) ; this%cpool_patch (:) = nan allocate(this%xsmrpool_patch (begp:endp)) ; this%xsmrpool_patch (:) = nan + allocate(this%xsmrpool_loss_patch (begp:endp)) ; this%xsmrpool_loss_patch (:) = nan allocate(this%ctrunc_patch (begp:endp)) ; this%ctrunc_patch (:) = nan allocate(this%dispvegc_patch (begp:endp)) ; this%dispvegc_patch (:) = nan allocate(this%storvegc_patch (begp:endp)) ; this%storvegc_patch (:) = nan @@ -312,6 +318,11 @@ subroutine InitHistory(this, bounds, carbon_type) call hist_addfld1d (fname='CROPSEEDC_DEFICIT', units='gC/m^2', & avgflag='A', long_name='C used for crop seed that needs to be repaid', & ptr_patch=this%cropseedc_deficit_patch) + + this%xsmrpool_loss_patch(begp:endp) = spval + call hist_addfld1d (fname='XSMRPOOL_LOSS', units='gC/m^2', & + avgflag='A', long_name='temporary photosynthate C pool loss', & + ptr_patch=this%xsmrpool_loss_patch, default='inactive') end if this%woodc_patch(begp:endp) = spval @@ -656,6 +667,11 @@ subroutine InitHistory(this, bounds, carbon_type) call hist_addfld1d (fname='C13_CROPSEEDC_DEFICIT', units='gC/m^2', & avgflag='A', long_name='C13 C used for crop seed that needs to be repaid', & ptr_patch=this%cropseedc_deficit_patch, default='inactive') + + this%xsmrpool_loss_patch(begp:endp) = spval + call hist_addfld1d (fname='C13_XSMRPOOL_LOSS', units='gC13/m^2', & + avgflag='A', long_name='C13 temporary photosynthate C pool loss', & + ptr_patch=this%xsmrpool_loss_patch, default='inactive') end if @@ -831,6 +847,11 @@ subroutine InitHistory(this, bounds, carbon_type) call hist_addfld1d (fname='C14_CROPSEEDC_DEFICIT', units='gC/m^2', & avgflag='A', long_name='C14 C used for crop seed that needs to be repaid', & ptr_patch=this%cropseedc_deficit_patch, default='inactive') + + this%xsmrpool_loss_patch(begp:endp) = spval + call hist_addfld1d (fname='C14_XSMRPOOL_LOSS', units='gC14/m^2', & + avgflag='A', long_name='C14 temporary photosynthate C pool loss', & + ptr_patch=this%xsmrpool_loss_patch, default='inactive') end if @@ -974,6 +995,7 @@ subroutine InitCold(this, bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst this%grainc_storage_patch(p) = 0._r8 this%grainc_xfer_patch(p) = 0._r8 this%cropseedc_deficit_patch(p) = 0._r8 + this%xsmrpool_loss_patch(p) = 0._r8 end if endif @@ -1205,6 +1227,13 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, dim1name='pft', long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_patch) + call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_loss', xtype=ncd_double, & + dim1name='pft', long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_loss_patch) + if (flag == 'read' .and. (.not. readvar) ) then + this%xsmrpool_loss_patch(bounds%begp:bounds%endp) = 0._r8 + end if + call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc', xtype=ncd_double, & dim1name='pft', long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) @@ -1421,6 +1450,7 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, this%grainc_storage_patch(i) = 0._r8 this%grainc_xfer_patch(i) = 0._r8 this%cropseedc_deficit_patch(i) = 0._r8 + this%xsmrpool_loss_patch(i) = 0._r8 end if ! calculate totvegc explicitly so that it is available for the isotope @@ -1810,6 +1840,21 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, end do end if + call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_loss_13', xtype=ncd_double, & + dim1name='pft', & + long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_loss_patch) + if (flag=='read' .and. .not. readvar) then + if ( masterproc ) write(iulog,*) 'initializing this%xsmrpool_loss with atmospheric c13 value' + do i = bounds%begp,bounds%endp + if (pftcon%c3psn(patch%itype(i)) == 1._r8) then + this%xsmrpool_loss_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_loss_patch(i) * c3_r2 + else + this%xsmrpool_loss_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_loss_patch(i) * c4_r2 + endif + end do + end if + call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc_13', xtype=ncd_double, & dim1name='pft', long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) @@ -2100,6 +2145,18 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, end do end if + call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_loss_14', xtype=ncd_double, & + dim1name='pft', long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_loss_patch) + if (flag=='read' .and. .not. readvar) then + if ( masterproc ) write(iulog,*) 'initializing this%xsmrpool_loss_patch with atmospheric c14 value' + do i = bounds%begp,bounds%endp + if (this%xsmrpool_loss_patch(i) /= spval .and. .not. isnan(this%xsmrpool_loss_patch(i)) ) then + this%xsmrpool_loss_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_loss_patch(i) * c14ratio + endif + end do + end if + call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc_14', xtype=ncd_double, & dim1name='pft', long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) @@ -2330,6 +2387,7 @@ subroutine SetValues ( this, & this%grainc_storage_patch(i) = value_patch this%grainc_xfer_patch(i) = value_patch this%cropseedc_deficit_patch(i) = value_patch + this%xsmrpool_loss_patch(i) = value_patch end if end do @@ -2463,7 +2521,8 @@ subroutine Summary_carbonstate(this, bounds, num_allc, filter_allc, & this%ctrunc_patch(p) if (use_crop) then - this%totc_patch(p) = this%totc_patch(p) + this%cropseedc_deficit_patch(p) + this%totc_patch(p) = this%totc_patch(p) + this%cropseedc_deficit_patch(p) + & + this%xsmrpool_loss_patch(p) end if ! (WOODC) - wood C @@ -2710,13 +2769,15 @@ subroutine DynamicPatchAdjustments(this, bounds, & var = this%grainc_xfer_patch(begp:endp), & flux_out_grc_area = conv_cflux(begp:endp)) - if (use_crop) then - ! This is a negative pool. So any deficit that we haven't repaid gets sucked out - ! of the atmosphere. - call update_patch_state( & - var = this%cropseedc_deficit_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - end if + ! This is a negative pool. So any deficit that we haven't repaid gets sucked out + ! of the atmosphere. + call update_patch_state( & + var = this%cropseedc_deficit_patch(begp:endp), & + flux_out_grc_area = conv_cflux(begp:endp)) + + call update_patch_state( & + var = this%xsmrpool_loss_patch(begp:endp), & + flux_out_grc_area = conv_cflux(begp:endp)) end if contains diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index b3b900d945..83c29dbdb9 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -126,7 +126,8 @@ module CNVegetationFacade type(dgvs_type) :: dgvs_inst ! Control variables - logical, private :: reseed_dead_plants ! Flag to indicate if should reseed dead plants when starting up the model + logical, private :: reseed_dead_plants ! Flag to indicate if should reseed dead plants when starting up the model + logical, private :: dribble_crophrv_xsmrpool_2atm = .False. ! Flag to indicate if should harvest xsmrpool to the atmosphere ! TODO(wjs, 2016-02-19) Evaluate whether some other variables should be moved in ! here. Whether they should be moved in depends on how tightly they are tied in with @@ -226,21 +227,24 @@ subroutine Init(this, bounds, NLFilename, nskip_steps) ! Read in the general CN namelist call this%CNReadNML( NLFilename ) ! MUST be called first as passes down control information to others - call this%cnveg_carbonstate_inst%Init(bounds, carbon_type='c12', ratio=1._r8, NLFilename=NLFilename) + call this%cnveg_carbonstate_inst%Init(bounds, carbon_type='c12', ratio=1._r8, & + NLFilename=NLFilename, dribble_crophrv_xsmrpool_2atm=this%dribble_crophrv_xsmrpool_2atm ) if (use_c13) then call this%c13_cnveg_carbonstate_inst%Init(bounds, carbon_type='c13', ratio=c13ratio, & - NLFilename=NLFilename, c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) + NLFilename=NLFilename, dribble_crophrv_xsmrpool_2atm=this%dribble_crophrv_xsmrpool_2atm, & + c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) end if if (use_c14) then call this%c14_cnveg_carbonstate_inst%Init(bounds, carbon_type='c14', ratio=c14ratio, & - NLFilename=NLFilename, c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) + NLFilename=NLFilename, dribble_crophrv_xsmrpool_2atm=this%dribble_crophrv_xsmrpool_2atm, & + c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) end if - call this%cnveg_carbonflux_inst%Init(bounds, carbon_type='c12') + call this%cnveg_carbonflux_inst%Init(bounds, carbon_type='c12', dribble_crophrv_xsmrpool_2atm=this%dribble_crophrv_xsmrpool_2atm ) if (use_c13) then - call this%c13_cnveg_carbonflux_inst%Init(bounds, carbon_type='c13') + call this%c13_cnveg_carbonflux_inst%Init(bounds, carbon_type='c13', dribble_crophrv_xsmrpool_2atm=this%dribble_crophrv_xsmrpool_2atm) end if if (use_c14) then - call this%c14_cnveg_carbonflux_inst%Init(bounds, carbon_type='c14') + call this%c14_cnveg_carbonflux_inst%Init(bounds, carbon_type='c14', dribble_crophrv_xsmrpool_2atm=this%dribble_crophrv_xsmrpool_2atm) end if call this%cnveg_nitrogenstate_inst%Init(bounds, & this%cnveg_carbonstate_inst%leafc_patch(begp:endp), & @@ -297,9 +301,11 @@ subroutine CNReadNML( this, NLFilename ) character(len=*), parameter :: nmlname = 'cn_general' ! MUST match what is in namelist below !----------------------------------------------------------------------- logical :: reseed_dead_plants - namelist /cn_general/ reseed_dead_plants + logical :: dribble_crophrv_xsmrpool_2atm + namelist /cn_general/ reseed_dead_plants, dribble_crophrv_xsmrpool_2atm - reseed_dead_plants = this%reseed_dead_plants + reseed_dead_plants = this%reseed_dead_plants + dribble_crophrv_xsmrpool_2atm = this%dribble_crophrv_xsmrpool_2atm if (masterproc) then unitn = getavu() @@ -317,9 +323,11 @@ subroutine CNReadNML( this, NLFilename ) call relavu( unitn ) end if - call shr_mpi_bcast (reseed_dead_plants , mpicom) + call shr_mpi_bcast (reseed_dead_plants , mpicom) + call shr_mpi_bcast (dribble_crophrv_xsmrpool_2atm , mpicom) this%reseed_dead_plants = reseed_dead_plants + this%dribble_crophrv_xsmrpool_2atm = dribble_crophrv_xsmrpool_2atm if (masterproc) then write(iulog,*) ' ' @@ -864,7 +872,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & this%dgvs_inst, photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & - nutrient_competition_method, this%cnfire_method) + nutrient_competition_method, this%cnfire_method, this%dribble_crophrv_xsmrpool_2atm) ! fire carbon emissions call CNFireEmisUpdate(bounds, num_soilp, filter_soilp, & diff --git a/src/biogeochem/EDBGCDynMod.F90 b/src/biogeochem/EDBGCDynMod.F90 index 6d5aa899e9..1520829f55 100644 --- a/src/biogeochem/EDBGCDynMod.F90 +++ b/src/biogeochem/EDBGCDynMod.F90 @@ -235,7 +235,7 @@ subroutine EDBGCDyn(bounds, & ! Update all prognostic carbon state variables (except for gap-phase mortality and fire fluxes) call CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & crop_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - soilbiogeochem_carbonflux_inst) + soilbiogeochem_carbonflux_inst, dribble_crophrv_xsmrpool_2atm=.False.) call t_stopf('BNGCUpdate1') diff --git a/test/tools/nl_files/mksrfdt_10x15_1850 b/test/tools/nl_files/mksrfdt_10x15_1850 index daa822804c..cdbb7c13dc 100644 --- a/test/tools/nl_files/mksrfdt_10x15_1850 +++ b/test/tools/nl_files/mksrfdt_10x15_1850 @@ -1 +1 @@ --l CSMDATA -r 10x15 -no-crop -y 1850 -exedir EXEDIR +-l CSMDATA -vic -r 10x15 -no-crop -y 1850 -exedir EXEDIR diff --git a/tools/README b/tools/README index 81024eb9d0..c8338a1a8e 100644 --- a/tools/README +++ b/tools/README @@ -1,281 +1,42 @@ -$CTSMROOT/tools/README Jun/08/2018 +$CTSMROOT/tools/contrib/README Jan/24/2019 -CLM tools for analysis of CLM history files -- or for creation or -modification of CLM input files. - -I. General directory structure: +The purpose of this directory is for users of CTSM to contribute scripts for pre or post processing or +case management of CTSM that others might find useful. The script should have some documentation made +available before adding it. These scripts may not be as well tested or supported as other CTSM +tools. They are also ONLY assumed to work on the NCAR supercomputer. So paths will be hardwired to +assume NCAR directory structures. - $CTSMROOT/tools - mksurfdata_map --- Create surface datasets. - (NOTE: interpinic now longer included as now an online capability in CLM) +The python scripts require the following settings before running on cheyenne: +(Currently that's the singlept and subset_surfdata scripts) - mkmapgrids ------- Create regular lat/lon SCRIP grid files needed by mkmapdata - mkmapdata -------- Create SCRIP mapping data from SCRIP grid files (uses ESMF) - mkprocdata_map --- Convert output unstructured grids into a 2D format that - can be plotted easily - ncl_scripts ------ NCL post or pre processing scripts. +module load python/2.7.14 +ncar_pylib - cime-tools ($CIMEROOT/tools/) (CIMEROOT is ../cime for a CTSM checkout and ../../../cime for a CESM checkout) - $CIMEROOT/mapping/gen_domain_files - gen_domain ------- Create data model domain datasets from SCRIP mapping datasets. +Brief description of scripts: -II. Notes on building/running for each of the above tools: +run_clm_historical + does all the setup and submission required to do a 1850-2010 CLM + historical simulation in three separate submissions + v1 - Andrew Slater+Dave Lawrence, 8/2015 - Each tool that has FORTRAN source code (mksurfdata_map and mkprocdata_map) has the following files: +subset_surfdata + create regional domain, surface data, and rtm directional files by + extracting data from global datasets + v1 - Sean Swenson 8/2015 - README ------- Specific help for using the specific tool and help on specific - files in that directory. - src/Filepath ----- List of directories needed to build the tool - (some files in ../src directories are required). - src/Makefile ----- GNU Makefile to build the tool - (these are identical between tools. - src/Macros.custom Customization of make macros for the particular tool in question - src/Srcfiles ----- List of source files that are needed. - src/Mkdepends ---- Dependency generator program +singlept + create single point domain, surface data, and datm forcing files by + extracting data from global datasets + v1 - Sean Swenson 8/2015 - mkmapdata, mkmapgrids and ncl_scripts only contain scripts so don't have the above build files. +SpinupStability.ncl + This script assesses the equilibrium state of a spinup run + works on either monthly or annual mean history files - Keith Oleson 7/2016 - Most tools have copies of files from other directories -- see the README.filecopies - file for more information on this. +run_clmtowers + This script will run any number of flux tower sites. + It's based on having created surface datasets with PTCLM. + v1 - Keith Oleson, 8/2015 - Tools may also have files with the directory name followed by namelist to provide sample namelists. - .namelist ------ Namelist to create a global file. - - These files are also used by the test scripts to test the tools (see the - README.testing) file. - - NOTE: Be sure to change the path of the datasets references by these namelists to - point to where you have exported your CESM inputdata datasets. - - To build: - - cd - setenv INC_NETCDF - setenv LIB_NETCDF - gmake - - The process will create a file called "Depends" which has the dependencies - for the build of each file on other files. - - By default some codes may be compiled non-optimized - so that you can use the debugger, and with bounds-checking, and float trapping on. - To speed up do the following... - - gmake OPT=TRUE (by default already on for interpinic and mksurfdata_map) - - Also some of the tools allow for OpenMP shared memory parallelism - (such as interpinic and mksurfdata) with - - gmake SMP=TRUE - - To run a program with a namelist: - - ./program < namelist - - To get help on running a program with command line options (e.g., interpinic): - - ./program - - To run a program built with SMP=TRUE: - - setenv OMP_NUM_THREADS= - - run normally as above - -III. Process sequence to create input datasets needed to run CLM - - 1.) Create SCRIP grid files (if needed) - - a.) For standard resolutions these files will already be created. (done) - - b.) To create regular lat-lon regional/single-point grids run mknoocnmap.pl - - This will create both SCRIP grid files and a mapping file that will - be valid if the region includes NO ocean whatsoever (so you can skip step 2). - You can also use this script to create SCRIP grid files for a region - (or even a global grid) that DOES include ocean if you use step 2 to - create mapping files for it (simply discard the non-ocean map created by - this script). - - Example, for single-point over Boulder Colorado. - - cd mkmapdata - ./mknoocnmap.pl -p 40,255 -n 1x1_boulderCO - - c.) General case - - You'll need to convert or create SCRIP grid files on your own (using scripts - or other tools) for the general case where you have an unstructured grid, or - a grid that is not regular in latitude and longitude. - - example format - ================== - netcdf fv1.9x2.5_090205 { - dimensions: - grid_size = 13824 ; - grid_corners = 4 ; - grid_rank = 2 ; - variables: - double grid_center_lat(grid_size) ; - grid_center_lat:units = "degrees" ; - double grid_center_lon(grid_size) ; - grid_center_lon:units = "degrees" ; - double grid_corner_lat(grid_size, grid_corners) ; - grid_corner_lat:units = "degrees" ; - double grid_corner_lon(grid_size, grid_corners) ; - grid_corner_lon:units = "degrees" ; - int grid_dims(grid_rank) ; - int grid_imask(grid_size) ; - grid_imask:units = "unitless" ; - - 2.) Create ocean to atmosphere mapping file (if needed) - - a.) Standard resolutions (done) - - If this is a standard resolution with a standard ocean resolution -- this - step is already done, the files already exist. - - b.) Region without Ocean (done in step 1.b) - - IF YOU RAN mknoocnmap.pl FOR A REGION WITHOUT OCEAN THIS STEP IS ALREADY DONE. - - c.) New atmosphere or ocean resolution - - If the region DOES include ocean, use - $CIMEROOT/tools/mapping/gen_mapping_files/gen_cesm_maps.sh to create a - mapping file for it. - - Example: - - cd $CIMEROOT/tools/mapping/gen_mapping_files - ./gen_cesm_maps.sh -focn -fatm -nocn -natm - - - 3.) Add SCRIP grid file(s) created in (1) into XML database in CLM (optional) - - See the "Adding New Resolutions or New Files to the build-namelist Database" - Chapter in the CLM User's Guide - - http://www.cesm.ucar.edu/models/cesm1.0/clm/models/lnd/clm/doc/UsersGuide/book1.html - - If you don't do this step, you'll need to specify the file to mkmapdata - in step (3) using the "-f" option. - - 4.) Create mapping files for use by mksurfdata_map with mkmapdata - (See mkmapdata/README for more help on doing this) - - - this step uses the results of (1) that were entered into the XML database - by step (3). If you don't enter datasets in, you need to specify the - SCRIP grid file using the "-f" option to mkmapdata.sh. - - Example: to generate all necessary mapping files for the ne30np4 grid - - cd mkmapdata - ./mkmapdata.sh -r ne30np4 - - 5.) Add mapping file(s) created in step (4) into XML database in CLM (optional) - - See notes on doing this in step (3) above. - Edit ../bld/namelist_files/namelist_defaults_ctsm.xml to incorporate new - mapping files. - - If you don't do this step, you'll need to specify the grid resolution name - and file creation dates to mksurfdata_map in step (5) below. - - 6.) Convert map of ocean to atm for use by DATM and CLM with gen_domain - (See $CIMEROOT/tools/mapping/README for more help on doing this) - - - gen_domain uses the map from step (2) (or previously created CESM maps) - - Example: - - cd $CIMEROOT/tools/mapping/gen_domain_files/src - gmake - cd .. - setenv CDATE 090206 - setenv OCNGRIDNAME gx1v6 - setenv ATMGRIDNAME fv1.9x2.5 - setenv MAPFILE $CSMDATA/cpl/cpl6/map_${OCNGRIDNAME}_to_${ATMGRIDNAME}_aave_da_${CDATE}.nc - ./gen_domain -m $MAPFILE -o $OCNGRIDNAME -l $ATMGRIDNAME - - Normally for I compsets running CLM only you will discard the ocean domain - file, and only use the atmosphere domain file for datm and as the fatmlndfrc - file for CLM. Output domain files will be named according to the input OCN/LND - gridnames. - - 7.) Create surface datasets with mksurfdata_map - (See mksurfdata_map/README for more help on doing this) - - - Run mksurfdata_map/mksurfdata.pl - - This step uses the results of step (4) entered into the XML database - in step (5). - - If datasets were NOT entered into the XML database, set the resolution - to "usrspec" and use the "-usr_gname", and "-usr_gdate" options. - - Example: for 0.9x1.25 resolution - - cd mksurfdata_map/src - gmake - cd .. - ./mksurfdata.pl -r 0.9x1.25 - - NOTE that surface dataset will be used by default for fatmgrid - and it will - contain the lat,lon,edges and area values for the atm grid - ASSUMING that - the atm and land grid are the same - - 8.) Interpolate initial conditions using interpinic (optional) - (See interpinic/README for more help on doing this) - - 9.) Add new files to XML data or using user_nl_clm (optional) - - See notes on doing this in step (3) above. - -IV. Example of creating single-point datasets without entering into XML database. - - Here we apply the process described in III. for a single-point dataset - where we don't enter the datasets into the XML database (thus skipping - steps 3, 5 and 9), but use the needed command line options to specify where the - files are. This also skips step (2) since step 1 creates the needed mapping file. - We also skip step (8) and do NOT create a finidat file. - - 0.) Set name of grid to use and the creation date to be used later... - setenv GRIDNAME 1x1_boulderCO - setenv CDATE `date +%y%m%d` - 1.) SCRIP grid and atm to ocn mapping file - cd mkmapdata - ./mknoocnmap.pl -p 40,255 -n $GRIDNAME - # Set pointer to MAPFILE that will be used in step (6) - setenv MAPFILE `pwd`/map_${GRIDNAME}_noocean_to_${GRIDNAME}_nomask_aave_da_${CDATE}.nc - cd ../.. - 2.) skip - 3.) skip - 4.) Mapping files needed for mksurfdata_map - cd mkmapdata - setenv GRIDFILE ../mkmapgrids/SCRIPgrid_${GRIDNAME}_nomask_${CDATE}.nc - ./mkmapdata.sh -r $GRIDNAME -f $GRIDFILE -t regional - cd ../.. - 5.) skip - 6.) Generate domain file for datm and CLM - cd $CIMEROOT/tools/mapping/gen_domain_files/src - gmake - cd .. - setenv OCNDOM domain.ocn_noocean.nc - setenv ATMDOM domain.lnd.{$GRIDNAME}_noocean.nc - ./gen_domain -m $MAPFILE -o $OCNDOM -l $ATMDOM - 7.) Create surface dataset for CLM - cd mksurfdata_map/src - gmake - cd .. - ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE - 8.) skip - 9.) skip - -V. Notes on which input datasets are needed for CLM - - global or regional/single-point grids - - need fsurdata and fatmlndfrc - - fsurdata ---- from mksurfdata_map in step (III.7) - fatmlndfrc -- use the domain.lnd file from gen_domain in step (III.6) diff --git a/tools/contrib/README b/tools/contrib/README new file mode 100644 index 0000000000..c8338a1a8e --- /dev/null +++ b/tools/contrib/README @@ -0,0 +1,42 @@ +$CTSMROOT/tools/contrib/README Jan/24/2019 + +The purpose of this directory is for users of CTSM to contribute scripts for pre or post processing or +case management of CTSM that others might find useful. The script should have some documentation made +available before adding it. These scripts may not be as well tested or supported as other CTSM +tools. They are also ONLY assumed to work on the NCAR supercomputer. So paths will be hardwired to +assume NCAR directory structures. + +The python scripts require the following settings before running on cheyenne: +(Currently that's the singlept and subset_surfdata scripts) + +module load python/2.7.14 +ncar_pylib + +Brief description of scripts: + +run_clm_historical + does all the setup and submission required to do a 1850-2010 CLM + historical simulation in three separate submissions + v1 - Andrew Slater+Dave Lawrence, 8/2015 + +subset_surfdata + create regional domain, surface data, and rtm directional files by + extracting data from global datasets + v1 - Sean Swenson 8/2015 + +singlept + create single point domain, surface data, and datm forcing files by + extracting data from global datasets + v1 - Sean Swenson 8/2015 + +SpinupStability.ncl + This script assesses the equilibrium state of a spinup run + works on either monthly or annual mean history files - Keith Oleson 7/2016 + +run_clmtowers + This script will run any number of flux tower sites. + It's based on having created surface datasets with PTCLM. + v1 - Keith Oleson, 8/2015 + + + diff --git a/tools/contrib/SpinupStability.ncl b/tools/contrib/SpinupStability.ncl new file mode 100644 index 0000000000..9f0eb30302 --- /dev/null +++ b/tools/contrib/SpinupStability.ncl @@ -0,0 +1,791 @@ +; NCL script +; SpinupStability_v8.ncl +; Script to examine stability of spinup simulation. +; This version operates on either monthly mean or multi-annual mean multi-variable history files +; Keith Oleson, Jan 2019 + +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" + +begin + + print ("=========================================") + print ("Start Time: "+systemfunc("date") ) + print ("=========================================") + +;=======================================================================; +; This script produces a page of plots of various variables that are evaluated +; as to whether they are spunup or not. A summary of variables in equilibrium +; and/or in disequilibrium is also produced to standard out. The postscript output +; is $caseid_spinup.ps in the pwd. +; The variables examined are TOTECOSYSC,TOTSOMC,TOTVEGC,TLAI,GPP,TWS,H2OSNO. +; The percentage of land area in TOTECOSYSC disequilibrium is also examined (not for single point). +; Thresholds are defined below (i.e., global_thresh_*) and can be changed for individual +; variables. +; To run this script, just enter in your case name and username below. +; AND set the annual_hist flag to True if your case has annual mean history files or set +; annual_hist flag to False if your case has monthly mean history files. +; AND set the region (supported options: Global, Arctic, SPT). +; AND set the subper (subsampling period in years, number of years that atm forcing repeats). +; The script assumes that your history files are in /glade/scratch/$username/archive/$caseid/lnd/hist +;=======================================================================; + +; GLOBAL EXAMPLE + caseid = "clm50_release-clm5.0.15_2deg_GSWP3V1_1850AD" + username = "oleson" + annual_hist = True + region = "Global" ; Global, Arctic, or SPT (single point) + subper = 20 ; Subsampling period in years + +; SPT (single point) EXAMPLE +; caseid = "clm50_release-clm5.0.15_SPT_GSWP3V1_1850spin" +; username = "oleson" +; annual_hist = True +; region = "SPT" ; Global, Arctic, or SPT (single point) +; subper = 20 ; Subsampling period in years + + do_plot = True +; do_plot = False +;=======================================================================; + + data_dir = "/glade/scratch/"+username+"/archive/"+caseid+"/lnd/hist/" + if ( systemfunc("test -d "+data_dir+"; echo $?" ) .ne. 0 )then + print( "Input directory does not exist or not found: "+data_dir ); + print( "Make sure username and caseid and base directory is set correctly" ) + status_exit( -1 ) + end if + +; Thresholds + if (region .eq. "SPT") then + glob_thresh_totecosysc = 0.02 ; global threshold for TOTECOSYSC equilibrium (delta MgC / yr) + glob_thresh_totsomc = 0.02 ; global threshold for TOTSOMC equilibrium (delta MgC / yr) + glob_thresh_totvegc = 0.02 ; global threshold for TOTVEGC equilibrium (delta MgC / yr) + glob_thresh_tlai = 0.02 ; global threshold for TLAI equilibrium (delta m2/m2 / yr) + glob_thresh_gpp = 0.02 ; global threshold for GPP equilibrium (delta MgC / yr) + glob_thresh_tws = 0.001 ; global threshold for TWS equilibrium (delta m / yr) + glob_thresh_h2osno = 1.0 ; global threshold for H2OSNO equilibrium (delta mm / yr) + glob_thresh_area = 3.0 ; global threshold percent area with TOTECOSYSC disequilibrium gt 1 g C/m2/yr (not used) + totecosysc_thresh = 1. ; disequilibrium threshold for individual gridcells (gC/m2/yr) (not used) + else + glob_thresh_totecosysc = 0.02 ; global threshold for TOTECOSYSC equilibrium (delta PgC / yr) + glob_thresh_totsomc = 0.02 ; global threshold for TOTSOMC equilibrium (delta PgC / yr) + glob_thresh_totvegc = 0.02 ; global threshold for TOTVEGC equilibrium (delta PgC / yr) + glob_thresh_tlai = 0.02 ; global threshold for TLAI equilibrium (delta m2/m2 / yr) + glob_thresh_gpp = 0.02 ; global threshold for GPP equilibrium (delta PgC / yr) + glob_thresh_tws = 0.001 ; global threshold for TWS equilibrium (delta m / yr) + glob_thresh_h2osno = 1.0 ; global threshold for H2OSNO equilibrium (delta mm / yr) + glob_thresh_area = 3.0 ; global threshold percent area with TOTECOSYSC disequilibrium gt 1 g C/m2/yr + totecosysc_thresh = 1. ; disequilibrium threshold for individual gridcells (gC/m2/yr) + end if + + if (annual_hist) then + fls = systemfunc("ls " + data_dir + caseid+".clm2.h0.*-*-*-*"+".nc") + else + fls = systemfunc("ls " + data_dir + caseid+".clm2.h0.*-*"+".nc") + end if + flsdims = dimsizes(fls) + + if (annual_hist) then + lstfile = addfile(fls(flsdims-1),"r") + else + lstfile = addfile(fls(flsdims-12),"r") ;last month (DEC) of any year has mdate for next year + ;so grab JAN of last year + end if + + if (annual_hist) then + lstyrdim = dimsizes(lstfile->mcdate) + mcdate_lst = lstfile->mcdate(lstyrdim-1) + else + mcdate_lst = lstfile->mcdate + end if + lstyr = toint(mcdate_lst)/10000 + + fstfile = addfile(fls(0),"r") + if (annual_hist) then + mcdate_fst = fstfile->mcdate(0) + else + mcdate_fst = fstfile->mcdate + end if + fstyr = toint(mcdate_fst)/10000 + + yearplt = ispan(fstyr,lstyr,subper) + yearpltrev = yearplt(::-1) + year = ispan(fstyr,lstyr,subper) - fstyr + nyrs = dimsizes(year) + if (subper .eq. 1) then + yearpltmid = ispan(fstyr+subper/2,yearplt(nyrs-2),subper) + else + yearpltmid = ispan(fstyr+subper/2,yearplt(nyrs-1),subper) + end if + +; Build an array of monthly indices + monstr = new(nyrs*12,"integer") + do i = 0,nyrs-1 + monstr(i*12:i*12+11) = ispan(year(i)*12,year(i)*12+11,1) + end do + +; Add the data files together + if (annual_hist) then + data = addfiles(fls, "r") + ListSetType (data, "cat") + else + data = addfiles(fls(monstr), "r") + end if + +; Convert to annual means if required + if (annual_hist) then + if (region .eq. "SPT") then + totecosysc = data[:]->TOTECOSYSC(year,:) + totsomc = data[:]->TOTSOMC(year,:) + totvegc = data[:]->TOTVEGC(year,:) + tlai = data[:]->TLAI(year,:) + gpp = data[:]->GPP(year,:) + tws = data[:]->TWS(year,:) + if (isfilevar(data[0],"H2OSNO")) then + h2osno = data[:]->H2OSNO(year,:) + else + h2osno = tws + h2osno = h2osno@_FillValue + end if + else + totecosysc = data[:]->TOTECOSYSC(year,:,:) + totsomc = data[:]->TOTSOMC(year,:,:) + totvegc = data[:]->TOTVEGC(year,:,:) + tlai = data[:]->TLAI(year,:,:) + gpp = data[:]->GPP(year,:,:) + tws = data[:]->TWS(year,:,:) + if (isfilevar(data[0],"H2OSNO")) then + h2osno = data[:]->H2OSNO(year,:,:) + else + h2osno = tws + h2osno = h2osno@_FillValue + end if + end if + else + totecosysc = month_to_annual(data[:]->TOTECOSYSC,1) + totsomc = month_to_annual(data[:]->TOTSOMC,1) + totvegc = month_to_annual(data[:]->TOTVEGC,1) + tlai = month_to_annual(data[:]->TLAI,1) + gpp = month_to_annual(data[:]->GPP,1) + if (isfilevar(data[0],"TWS")) then + tws = month_to_annual(data[:]->TWS,1) + else + tws = gpp + tws = tws@_FillValue + end if + if (isfilevar(data[0],"H2OSNO")) then + h2osno = month_to_annual(data[:]->H2OSNO,1) + else + h2osno = tws + h2osno = h2osno@_FillValue + end if + end if + lat = data[0]->lat + nlat = dimsizes(lat) + lon = data[0]->lon + nlon = dimsizes(lon) + landfrac = data[0]->landfrac + area = data[0]->area + aream = area*1.e6 + landarea = landfrac*aream + if (region .eq. "SPT") then + gtoXg = 1e-12 ;Tg + units = "Tg C" + else + gtoXg = 1e-15 ;Pg + units = "Pg C" + end if + secinyr = 60.*60.*24.*365. + +; TOTECOSYSC + if (region .eq. "SPT") then + landareaC = conform_dims(dimsizes(totecosysc),landarea,(/1/)) ; conforming dimensions of landarea to totecosysc + else + landareaC = conform_dims(dimsizes(totecosysc),landarea,(/1,2/)) ; conforming dimensions of landarea to totecosysc + end if + totecosysc_area = totecosysc*landareaC ; correcting totecosysc for total land area + totecosysc_Xg = totecosysc_area*gtoXg ; g to Xg + if (region .eq. "SPT") then + totecosysc_glob = dim_sum_n(totecosysc_Xg, (/1/)) ; sums over single point + else + totecosysc_glob = dim_sum_n(totecosysc_Xg, (/1,2/)) ; sums over all latitudes + end if + totecosysc_glob!0 = "year" + totecosysc_glob&year = yearplt + totecosysc_glob_del = new(nyrs-1,"float") + do i = 0,nyrs-2 + totecosysc_glob_del(i) = (totecosysc_glob(i+1) - totecosysc_glob(i))/subper + end do + totecosysc_glob_del!0 = "year" + totecosysc_glob_del&year = yearpltmid + indx = where(abs(totecosysc_glob_del) .lt. glob_thresh_totecosysc,1,0) + if (all(indx .eq. 1)) then + totecosysc_glob_equil = yearplt(0) + else + if (.not.(all(indx .eq. 0)) .and. indx(dimsizes(indx)-1) .ne. 0) then + indxrev = indx(::-1) + do i = 0,dimsizes(indxrev)-1 + if (indxrev(i) .eq. 0) then + totecosysc_glob_equil = yearpltrev(i-1) + break + end if + end do + delete(indxrev) + else + totecosysc_glob_equil = -999 + end if + end if + totecosysc_glob_equil@_FillValue = -999 + delete(indx) + +; Land area not in TOTECOSYSC equilibrium + if (region .ne. "SPT") then + landarea_noequil = new((/nyrs-1,nlat,nlon/),"float") + do i = 0,nyrs-2 + landarea_noequil(i,:,:) = where((totecosysc(i+1,:,:) - totecosysc(i,:,:))/subper .gt. totecosysc_thresh, landarea, 0.) + end do + perc_landarea_noequil = 100.*(dim_sum_n(landarea_noequil,(/1,2/))/sum(landarea)) + indx = where(abs(perc_landarea_noequil) .lt. glob_thresh_area,1,0) + if (all(indx .eq. 1)) then + perc_landarea_glob_noequil = yearplt(0) + else + if (.not.(all(indx .eq. 0)) .and. indx(dimsizes(indx)-1) .ne. 0) then + indxrev = indx(::-1) + do i = 0,dimsizes(indxrev)-1 + if (indxrev(i) .eq. 0) then + perc_landarea_glob_noequil = yearpltrev(i-1) + break + end if + end do + delete(indxrev) + else + perc_landarea_glob_noequil = -999 + end if + end if + perc_landarea_glob_noequil@_FillValue = -999 + delete(indx) + totecosysc_1_map = where(landarea_noequil(nyrs-2,:,:) .ne. 0.,(totecosysc(nyrs-1,:,:)-totecosysc(nyrs-2,:,:))/subper,totecosysc@_FillValue) + totecosysc_1_map!0 = "lat" + totecosysc_1_map&lat = lat + totecosysc_1_map!1 = "lon" + totecosysc_1_map&lon = lon + totecosysc_2_map = where(landarea_noequil(nyrs-3,:,:) .ne. 0.,(totecosysc(nyrs-2,:,:)-totecosysc(nyrs-3,:,:))/subper,totecosysc@_FillValue) + copy_VarCoords(totecosysc_1_map,totecosysc_2_map) + end if + +; TOTSOMC + totsomc_area = totsomc*landareaC ; correcting totsomc for total land area + totsomc_Xg = totsomc_area*gtoXg ; g to Xg + if (region .eq. "SPT") then + totsomc_glob = dim_sum_n(totsomc_Xg, (/1/)) ; sums over single point + else + totsomc_glob = dim_sum_n(totsomc_Xg, (/1,2/)) ; sums over all latitudes + end if + totsomc_glob!0 = "year" + totsomc_glob&year = yearplt + totsomc_glob_del = new(nyrs-1,"float") + do i = 0,nyrs-2 + totsomc_glob_del(i) = (totsomc_glob(i+1) - totsomc_glob(i))/subper + end do + totsomc_glob_del!0 = "year" + totsomc_glob_del&year = yearpltmid + indx = where(abs(totsomc_glob_del) .lt. glob_thresh_totsomc,1,0) + if (all(indx .eq. 1)) then + totsomc_glob_equil = yearplt(0) + else + if (.not.(all(indx .eq. 0)) .and. indx(dimsizes(indx)-1) .ne. 0) then + indxrev = indx(::-1) + do i = 0,dimsizes(indxrev)-1 + if (indxrev(i) .eq. 0) then + totsomc_glob_equil = yearpltrev(i-1) + break + end if + end do + delete(indxrev) + else + totsomc_glob_equil = -999 + end if + end if + totsomc_glob_equil@_FillValue = -999 + delete(indx) + +; TOTVEGC + totvegc_area = totvegc*landareaC ; correcting totvegc for total land area + totvegc_Xg = totvegc_area*gtoXg ; g to Xg + if (region .eq. "SPT") then + totvegc_glob = dim_sum_n(totvegc_Xg, (/1/)) ; sums over single point + else + totvegc_glob = dim_sum_n(totvegc_Xg, (/1,2/)) ; sums over all latitudes + end if + totvegc_glob!0 = "year" + totvegc_glob&year = yearplt + totvegc_glob_del = new(nyrs-1,"float") + do i = 0,nyrs-2 + totvegc_glob_del(i) = (totvegc_glob(i+1) - totvegc_glob(i))/subper + end do + totvegc_glob_del!0 = "year" + totvegc_glob_del&year = yearpltmid + indx = where(abs(totvegc_glob_del) .lt. glob_thresh_totvegc,1,0) + if (all(indx .eq. 1)) then + totvegc_glob_equil = yearplt(0) + else + if (.not.(all(indx .eq. 0)) .and. indx(dimsizes(indx)-1) .ne. 0) then + indxrev = indx(::-1) + do i = 0,dimsizes(indxrev)-1 + if (indxrev(i) .eq. 0) then + totvegc_glob_equil = yearpltrev(i-1) + break + end if + end do + delete(indxrev) + else + totvegc_glob_equil = -999 + end if + end if + totvegc_glob_equil@_FillValue = -999 + delete(indx) + +; TLAI + areasum = sum(area*landfrac) + areaL = area*landfrac + if (region .eq. "SPT") then + landareaL = conform_dims(dimsizes(tlai),areaL,(/1/)) ; conforming dimensions of areaL to tlai + tlai_glob = dim_sum_n(tlai*landareaL/areasum,(/1/)) ; weighted tlai + else + landareaL = conform_dims(dimsizes(tlai),areaL,(/1,2/)) ; conforming dimensions of areaL to tlai + tlai_glob = dim_sum_n(tlai*landareaL/areasum,(/1,2/)) ; weighted global tlai + end if + tlai_glob!0 = "year" + tlai_glob&year = yearplt + tlai_glob_del = new(nyrs-1,"float") + do i = 0,nyrs-2 + tlai_glob_del(i) = (tlai_glob(i+1) - tlai_glob(i))/subper + end do + tlai_glob_del!0 = "year" + tlai_glob_del&year = yearpltmid + indx = where(abs(tlai_glob_del) .lt. glob_thresh_tlai,1,0) + if (all(indx .eq. 1)) then + tlai_glob_equil = yearplt(0) + else + if (.not.(all(indx .eq. 0)) .and. indx(dimsizes(indx)-1) .ne. 0) then + indxrev = indx(::-1) + do i = 0,dimsizes(indxrev)-1 + if (indxrev(i) .eq. 0) then + tlai_glob_equil = yearpltrev(i-1) + break + end if + end do + delete(indxrev) + else + tlai_glob_equil = -999 + end if + end if + tlai_glob_equil@_FillValue = -999 + delete(indx) + +; GPP + gpp_area = gpp*landareaC ; correcting gpp for total land area + gpp_Xg = gpp_area*gtoXg*secinyr ; g to Xg and sec to yrs + if (region .eq. "SPT") then + gpp_glob = dim_sum_n(gpp_Xg, (/1/)) ; sums over single point + else + gpp_glob = dim_sum_n(gpp_Xg, (/1,2/)) ; sums over all latitudes + end if + gpp_glob!0 = "year" + gpp_glob&year = yearplt + gpp_glob_del = new(nyrs-1,"float") + do i = 0,nyrs-2 + gpp_glob_del(i) = (gpp_glob(i+1) - gpp_glob(i))/subper + end do + gpp_glob_del!0 = "year" + gpp_glob_del&year = yearpltmid + indx = where(abs(gpp_glob_del) .lt. glob_thresh_gpp,1,0) + if (all(indx .eq. 1)) then + gpp_glob_equil = yearplt(0) + else + if (.not.(all(indx .eq. 0)) .and. indx(dimsizes(indx)-1) .ne. 0) then + indxrev = indx(::-1) + do i = 0,dimsizes(indxrev)-1 + if (indxrev(i) .eq. 0) then + gpp_glob_equil = yearpltrev(i-1) + break + end if + end do + delete(indxrev) + else + gpp_glob_equil = -999 + end if + end if + gpp_glob_equil@_FillValue = -999 + delete(indx) + +; TWS + if (isfilevar(data[0],"TWS")) then + + if (region .eq. "SPT") then + tws_glob = (dim_sum_n(tws*landareaL/areasum,(/1/)))/1.e3 ; weighted tws (meters) + else + tws_glob = (dim_sum_n(tws*landareaL/areasum,(/1,2/)))/1.e3 ; weighted global tws (meters) + end if + tws_glob!0 = "year" + tws_glob&year = yearplt + tws_glob_del = new(nyrs-1,"float") + do i = 0,nyrs-2 + tws_glob_del(i) = (tws_glob(i+1) - tws_glob(i))/subper + end do + tws_glob_del!0 = "year" + tws_glob_del&year = yearpltmid + indx = where(abs(tws_glob_del) .lt. glob_thresh_tws,1,0) + if (all(indx .eq. 1)) then + tws_glob_equil = yearplt(0) + else + if (.not.(all(indx .eq. 0)) .and. indx(dimsizes(indx)-1) .ne. 0) then + indxrev = indx(::-1) + do i = 0,dimsizes(indxrev)-1 + if (indxrev(i) .eq. 0) then + tws_glob_equil = yearpltrev(i-1) + break + end if + end do + delete(indxrev) + else + tws_glob_equil = -999 + end if + end if + tws_glob_equil@_FillValue = -999 + delete(indx) + + else + tws_glob_equil = new(1,typeof(yearplt),-999) + tws_glob_equil = -999 + if (region .eq. "SPT") then + tws_glob = new(dimsizes(dim_sum_n(tws,(/1/))),typeof(tws),-999) + else + tws_glob = new(dimsizes(dim_sum_n(tws,(/1,2/))),typeof(tws),-999) + end if + tws_glob = -999 + tws_glob_del = new(nyrs-1,"float",-999.) + tws_glob_del = -999. + end if + +; H2OSNO + if (isfilevar(data[0],"H2OSNO")) then + + if (region .eq. "SPT") then + h2osno_glob = dim_sum_n(h2osno*landareaL/areasum,(/1/)) ; weighted h2osno (mm) + else + h2osno_glob = dim_sum_n(h2osno*landareaL/areasum,(/1,2/)) ; weighted global h2osno (mm) + end if + h2osno_glob!0 = "year" + h2osno_glob&year = yearplt + h2osno_glob_del = new(nyrs-1,"float") + do i = 0,nyrs-2 + h2osno_glob_del(i) = (h2osno_glob(i+1) - h2osno_glob(i))/subper + end do + h2osno_glob_del!0 = "year" + h2osno_glob_del&year = yearpltmid + indx = where(abs(h2osno_glob_del) .lt. glob_thresh_h2osno,1,0) + if (all(indx .eq. 1)) then + h2osno_glob_equil = yearplt(0) + else + if (.not.(all(indx .eq. 0)) .and. indx(dimsizes(indx)-1) .ne. 0) then + indxrev = indx(::-1) + do i = 0,dimsizes(indxrev)-1 + if (indxrev(i) .eq. 0) then + h2osno_glob_equil = yearpltrev(i-1) + break + end if + end do + delete(indxrev) + else + h2osno_glob_equil = -999 + end if + end if + h2osno_glob_equil@_FillValue = -999 + delete(indx) + + else + h2osno_glob_equil = -999 + h2osno_glob_equil = new(1,typeof(yearplt),-999) + h2osno_glob_equil = -999 + if (region .eq. "SPT") then + h2osno_glob = new(dimsizes(dim_sum_n(h2osno,(/1/))),typeof(h2osno),-999) + else + h2osno_glob = new(dimsizes(dim_sum_n(h2osno,(/1,2/))),typeof(h2osno),-999) + end if + h2osno_glob = -999 + h2osno_glob_del = new(nyrs-1,"float",-999.) + h2osno_glob_del = -999. + end if + +;===============================Plotting====================================; + if (do_plot) then + +; wks_type = "png" +; wks_type@wkWidth = 2500 +; wks_type@wkHeight = 2500 +; wks_type = "x11" + wks_type = "ps" +; wks_type = "pdf" + wks = gsn_open_wks (wks_type, caseid+"_Spinup") + gsn_define_colormap(wks, "ViBlGrWhYeOrRe") + + plot = new(13,"graphic") + + resP = True +; resP@gsnMaximize = True + resP@gsnPaperOrientation = "portrait" + resP@gsnFrame = False + resP@gsnDraw = True + resP@txString = caseid + " Annual Mean " + resP@gsnPanelXWhiteSpacePercent = 2. + resP@gsnPanelCenter = False +; resP@gsnPanelDebug = True + + res = True + res@gsnFrame = False + res@gsnDraw = False + res@xyLineThicknessF = 2 + + polyres1 = True + polyres1@gsLineDashPattern = 16 + polyres2 = True + polyres2@gsLineDashPattern = 2 + + res@tiXAxisString = " " + res@tiYAxisString = units + res@tiMainString = "TOTECOSYSC" + plot(0) = gsn_csm_xy(wks,yearplt,totecosysc_glob,res) + + res@tiYAxisString = units + res@tiMainString = "Delta TOTECOSYSC " + "EqYr: "+totecosysc_glob_equil + res@trYMaxF = 0.2 + res@trYMinF = -0.2 + plot(1) = gsn_csm_xy(wks,yearpltmid,totecosysc_glob_del,res) + prim1 = gsn_add_polyline(wks,plot(1),(/0.,yearpltmid(nyrs-2)/),(/0.,0./),polyres1) + prim2 = gsn_add_polyline(wks,plot(1),(/0.,yearpltmid(nyrs-2)/),(/-glob_thresh_totecosysc,-glob_thresh_totecosysc/),polyres2) + prim3 = gsn_add_polyline(wks,plot(1),(/0.,yearpltmid(nyrs-2)/),(/glob_thresh_totecosysc,glob_thresh_totecosysc/),polyres2) + + delete(res@trYMaxF) + delete(res@trYMinF) + res@tiYAxisString = units + res@tiMainString = "TOTSOMC" + plot(2) = gsn_csm_xy(wks,yearplt,totsomc_glob,res) + + res@tiYAxisString = units + res@tiMainString = "Delta TOTSOMC " + "EqYr: "+totsomc_glob_equil + res@trYMaxF = 0.2 + res@trYMinF = -0.2 + plot(3) = gsn_csm_xy(wks,yearpltmid,totsomc_glob_del,res) + prim4 = gsn_add_polyline(wks,plot(3),(/0.,yearpltmid(nyrs-2)/),(/0.,0./),polyres1) + prim5 = gsn_add_polyline(wks,plot(3),(/0.,yearpltmid(nyrs-2)/),(/-glob_thresh_totsomc,-glob_thresh_totsomc/),polyres2) + prim6 = gsn_add_polyline(wks,plot(3),(/0.,yearpltmid(nyrs-2)/),(/glob_thresh_totsomc,glob_thresh_totsomc/),polyres2) + + delete(res@trYMaxF) + delete(res@trYMinF) + res@tiYAxisString = units + res@tiMainString = "TOTVEGC" + plot(4) = gsn_csm_xy(wks,yearplt,totvegc_glob,res) + + res@tiYAxisString = units + res@tiMainString = "Delta TOTVEGC " + "EqYr: "+totvegc_glob_equil + res@trYMaxF = 0.2 + res@trYMinF = -0.2 + plot(5) = gsn_csm_xy(wks,yearpltmid,totvegc_glob_del,res) + prim7 = gsn_add_polyline(wks,plot(5),(/0.,yearpltmid(nyrs-2)/),(/0.,0./),polyres1) + prim8 = gsn_add_polyline(wks,plot(5),(/0.,yearpltmid(nyrs-2)/),(/-glob_thresh_totvegc,-glob_thresh_totvegc/),polyres2) + prim9 = gsn_add_polyline(wks,plot(5),(/0.,yearpltmid(nyrs-2)/),(/glob_thresh_totvegc,glob_thresh_totvegc/),polyres2) + + delete(res@trYMaxF) + delete(res@trYMinF) + res@tiYAxisString = "m ~S~2~N~ m~S~-2~N~" + res@tiMainString = "TLAI" + plot(6) = gsn_csm_xy(wks,yearplt,tlai_glob,res) + + res@tiYAxisString = "m ~S~2~N~ m~S~-2~N~" + res@tiMainString = "Delta TLAI " + "EqYr: "+tlai_glob_equil + res@trYMaxF = 0.2 + res@trYMinF = -0.2 + plot(7) = gsn_csm_xy(wks,yearpltmid,tlai_glob_del,res) + prim10 = gsn_add_polyline(wks,plot(7),(/0.,yearpltmid(nyrs-2)/),(/0.,0./),polyres1) + prim11 = gsn_add_polyline(wks,plot(7),(/0.,yearpltmid(nyrs-2)/),(/-glob_thresh_tlai,-glob_thresh_tlai/),polyres2) + prim12 = gsn_add_polyline(wks,plot(7),(/0.,yearpltmid(nyrs-2)/),(/glob_thresh_tlai,glob_thresh_tlai/),polyres2) + + delete(res@trYMaxF) + delete(res@trYMinF) + res@tiYAxisString = units+" yr~S~-1~N~" + res@tiMainString = "GPP" + plot(8) = gsn_csm_xy(wks,yearplt,gpp_glob,res) + + res@tiYAxisString = units+" yr~S~-1~N~" + res@tiXAxisString = "Spinup Year" + res@tiMainString = "Delta GPP " + "EqYr: "+gpp_glob_equil + res@trYMaxF = 0.2 + res@trYMinF = -0.2 + plot(9) = gsn_csm_xy(wks,yearpltmid,gpp_glob_del,res) + prim13 = gsn_add_polyline(wks,plot(9),(/0.,yearpltmid(nyrs-2)/),(/0.,0./),polyres1) + prim14 = gsn_add_polyline(wks,plot(9),(/0.,yearpltmid(nyrs-2)/),(/-glob_thresh_gpp,-glob_thresh_gpp/),polyres2) + prim15 = gsn_add_polyline(wks,plot(9),(/0.,yearpltmid(nyrs-2)/),(/glob_thresh_gpp,glob_thresh_gpp/),polyres2) + + delete(res@trYMaxF) + delete(res@trYMinF) + res@tiYAxisString = "m" + res@tiMainString = "TWS" + plot(10) = gsn_csm_xy(wks,yearplt,tws_glob,res) + + res@tiYAxisString = "m" + res@tiMainString = "Delta TWS " + "EqYr: "+tws_glob_equil + res@trYMaxF = 0.05 + res@trYMinF = -0.05 + plot(11) = gsn_csm_xy(wks,yearpltmid,tws_glob_del,res) + prim16 = gsn_add_polyline(wks,plot(11),(/0.,yearpltmid(nyrs-2)/),(/0.,0./),polyres1) + prim17 = gsn_add_polyline(wks,plot(11),(/0.,yearpltmid(nyrs-2)/),(/-glob_thresh_tws,-glob_thresh_tws/),polyres2) + prim18 = gsn_add_polyline(wks,plot(11),(/0.,yearpltmid(nyrs-2)/),(/glob_thresh_tws,glob_thresh_tws/),polyres2) + + if (region .ne. "SPT") then + res@tiYAxisString = "%" + res@tiMainString = "% Land Area in TOTECOSYSC Disequil " + "EqYr: "+perc_landarea_glob_noequil + res@trYMaxF = 80.0 + res@trYMinF = 0.0 + plot(12) = gsn_csm_xy(wks,yearpltmid,perc_landarea_noequil,res) + prim19 = gsn_add_polyline(wks,plot(12),(/0.,yearpltmid(nyrs-2)/),(/glob_thresh_area,glob_thresh_area/),polyres2) + end if + + gsn_panel(wks,plot,(/4,4/),resP) + + if (region .ne. "SPT") then + delete(plot) + resc = True ; turn on plotting options + resc@gsnSpreadColors = True ; spans all colors in colormap + resc@cnFillMode = "RasterFill" ; raster mode + resc@cnFillOn = True ; turn on color fill + resc@cnLinesOn = False ; turn off contour lines + resc@cnLineLabelsOn = False ; turn off contour line labels + resc@cnLevelSelectionMode = "ExplicitLevels" + resc@mpProjection = "robinson" ; Robinson grid projection + if (region .eq. "Arctic") then + resc@mpLimitMode = "LatLon" + resc@mpMinLatF = 50. + resc@mpMaxLatF = 85. + resc@mpMinLonF = -180. + resc@mpMaxLonF = -95. + resc@gsnAddCyclic = False + resc@mpProjection = "CylindricalEquidistant" + end if + resc@gsnDraw = True + resc@gsnFrame = False + resc@lbAutoManage = False + resc@lbLabelFontHeightF = 0.010 + resc@txFontHeightF = 0.008 + resc@cnLevels = (/-5.0,-4.0,-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0,4.0,5.0/) + resc@gsnLeftString = "gC m~S~-2~N~" + resc@gsnRightString = "" + + resc@vpXF = 0.30 ; position and sizes + resc@vpYF = 0.28 ; for XY plot + resc@vpWidthF = 0.30 + resc@vpHeightF = 0.30 + resc@gsnCenterString = "TOTECOSYSC Disequil Yr " + yearplt(nyrs-1) + " - " + yearplt(nyrs-2) + plot = gsn_csm_contour_map(wks,totecosysc_1_map,resc) + + resc@vpXF = 0.65 ; position and sizes + resc@vpYF = 0.28 ; for XY plot + resc@vpWidthF = 0.30 + resc@vpHeightF = 0.30 + resc@gsnCenterString = "TOTECOSYSC Disequil Yr " + yearplt(nyrs-2) + " - " + yearplt(nyrs-3) + plot = gsn_csm_contour_map(wks,totecosysc_2_map,resc) + + end if + + frame(wks) + delete(plot) + plot = new(2,"graphic") + + delete(res@trYMaxF) + delete(res@trYMinF) + res@tiYAxisString = "mm" + res@tiMainString = "H2OSNO" + plot(0) = gsn_csm_xy(wks,yearplt,h2osno_glob,res) + + res@tiYAxisString = "mm" + res@tiMainString = "Delta H2OSNO " + "EqYr: "+h2osno_glob_equil + res@trYMaxF = 5.0 + res@trYMinF = -5.0 + plot(1) = gsn_csm_xy(wks,yearpltmid,h2osno_glob_del,res) + prim20 = gsn_add_polyline(wks,plot(1),(/0.,yearpltmid(nyrs-2)/),(/0.,0./),polyres1) + prim21 = gsn_add_polyline(wks,plot(1),(/0.,yearpltmid(nyrs-2)/),(/-glob_thresh_h2osno,-glob_thresh_h2osno/),polyres2) + prim22 = gsn_add_polyline(wks,plot(1),(/0.,yearpltmid(nyrs-2)/),(/glob_thresh_h2osno,glob_thresh_h2osno/),polyres2) + + gsn_panel(wks,plot,(/4,4/),resP) + frame(wks) + + end if ; end do_plot + +; Equilibrium summary + print((/"======================================================================="/)) + print((/"======================================================================="/)) + print((/"EQUILIBRIUM SUMMARY"/)) + print((/"======================================================================="/)) + if (.not.(ismissing(totecosysc_glob_equil))) then + print((/"TOTECOSYSC is in equilibrium. Eq. Yr. = "+totecosysc_glob_equil/)) + else + print((/"FATAL: TOTECOSYSC is NOT in equilibrium"/)) + end if + if (.not.(ismissing(totsomc_glob_equil))) then + print((/"TOTSOMC is in equilibrium. Eq. Yr. = "+totsomc_glob_equil/)) + else + print((/"FATAL: TOTSOMC is NOT in equilibrium"/)) + end if + if (.not.(ismissing(totvegc_glob_equil))) then + print((/"TOTVEGC is in equilibrium. Eq. Yr. = "+totvegc_glob_equil/)) + else + print((/"FATAL: TOTVEGC is NOT in equilibrium"/)) + end if + if (.not.(ismissing(tlai_glob_equil))) then + print((/"TLAI is in equilibrium. Eq. Yr. = "+tlai_glob_equil/)) + else + print((/"FATAL: TLAI is NOT in equilibrium"/)) + end if + if (.not.(ismissing(gpp_glob_equil))) then + print((/"GPP is in equilibrium. Eq. Yr. = "+gpp_glob_equil/)) + else + print((/"FATAL: GPP is NOT in equilibrium"/)) + end if + if (.not.(ismissing(tws_glob_equil))) then + print((/"TWS is in equilibrium. Eq. Yr. = "+tws_glob_equil/)) + else + print((/"WARNING: TWS is NOT in equilibrium or is missing"/)) + end if + if (.not.(ismissing(h2osno_glob_equil))) then + print((/"H2OSNO is in equilibrium. Eq. Yr. = "+h2osno_glob_equil/)) + else + print((/"WARNING: H2OSNO is NOT in equilibrium or is missing"/)) + end if + if (region .ne. "SPT") then + if (.not.(ismissing(perc_landarea_glob_noequil))) then + print((/"At least "+(100.-glob_thresh_area)+" percent of the land surface is in TOTECOSYSC equilibrium. Eq. Yr. = "+perc_landarea_glob_noequil/)) + print((/"Percent of the land surface not in equilibrium ("+sprintf("%6.2f",perc_landarea_noequil(nyrs-2))+"% )"/)) + else + print((/"FATAL: Not enough of the land surface is in equilibrium ("+sprintf("%6.2f",perc_landarea_noequil(nyrs-2))+"% > "+sprintf("%6.2f",glob_thresh_area)+"%)"/)) + end if + if (.not.(ismissing(totecosysc_glob_equil)) .and. \ + .not.(ismissing(totsomc_glob_equil)) .and. \ + .not.(ismissing(totvegc_glob_equil)) .and. \ + .not.(ismissing(tlai_glob_equil)) .and. \ + .not.(ismissing(gpp_glob_equil)) .and. \ + .not.(ismissing(perc_landarea_glob_noequil))) then + print((/"Congratulations! Your simulation is in equilibrium"/)) + else + print((/"FATAL: Your simulation is not in equilibrium, 8 hours have been deducted from your PTO bank, try again"/)) + end if + print((/"======================================================================="/)) + end if + + print ("=========================================") + print ("Finish Time: "+systemfunc("date") ) + print ("=========================================") + print ("Successfully ran the script") + +end diff --git a/tools/contrib/modify_singlept_site b/tools/contrib/modify_singlept_site new file mode 100755 index 0000000000..4345109ca4 --- /dev/null +++ b/tools/contrib/modify_singlept_site @@ -0,0 +1,391 @@ +#! /usr/bin/env python +import sys +import string +import subprocess +from getpass import getuser +import numpy as np +import netCDF4 as netcdf4 +import xarray as xr + +def mprint(mstr): + vnum=sys.version_info[0] + if vnum == 3: + print(mstr) + if vnum == 2: + print mstr + +''' +#------------------------------------------------------------------# +#--------------------- Instructions -----------------------------# +#------------------------------------------------------------------# +After creating a single point surface data file from a global +surface data file, use this script to overwrite some fields with +site-specific data. +''' + +myname = getuser() +#-- Create single point CLM surface data file +create_surfdata = True + +#-- specify site from which to extract data ---------- +sitename='US-Ha1' + +#-- Site level data directory ------------------------ +site_dir='../PTCLM/PTCLM_sitedata/' + +#-- Specify original file +fsurf = '/glade/scratch/'+myname+'/single_point/surfdata_0.9x1.25_16pfts_CMIP6_simyr1850_287.8_42.5_c170706.nc' + +#-- Output directory --------------------------------- +dir_output='/glade/scratch/'+myname+'/single_point/' + +#-- Specify new file name ----------------------------- +command='date "+%y%m%d"' +x2=subprocess.Popen(command,stdout=subprocess.PIPE,shell='True') +x=x2.communicate() +timetag = x[0].strip() +fsurf2 = dir_output + 'surfdata_0.9x1.25_16pfts_CMIP6_simyr2000_'+sitename+'_site.c'+timetag+'.nc' + +#== End User Mods ===================================== + +#site_code,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5 +pftfile =site_dir+'PTCLMDATA_pftdata.txt' +#site_code,name,state,lon,lat,elev,startyear,endyear,alignyear,timestep,campaign +sitefile=site_dir+'PTCLMDATA_sitedata.txt' +#site_code,soil_depth,n_layers,layer_depth,layer_sand%,layer_clay% +soilfile=site_dir+'PTCLMDATA_soildata.txt' + +#-- Raw datafiles ------------------------ +rawdatafile = '../mksurfdata_map/mksurfdata_map.namelist' + +mstr='Checking for data for site: '+sitename +mprint(mstr) + +#-- Read raw datafiles ------------------------ +with open(rawdatafile, 'r') as t1: + for tmp in t1: + x=tmp.split('=') + if x[0].strip() == 'mksrf_fsoitex': + fsoitex = x[1].strip() + fsoitex = fsoitex.strip("'") + if x[0].strip() == 'mksrf_forganic': + forganic = x[1].strip() + forganic = forganic.strip("'") + if x[0].strip() == 'mksrf_flakwat': + flakwat= x[1].strip() + flakwat= flakwat.strip("'") + if x[0].strip() == 'mksrf_fwetlnd': + fwetlnd = x[1].strip() + fwetlnd = fwetlnd.strip("'") + if x[0].strip() == 'mksrf_fmax': + fmax = x[1].strip() + fmax = fmax.strip("'") + if x[0].strip() == 'mksrf_fglacier': + fglacier= x[1].strip() + fglacier= fglacier.strip("'") + if x[0].strip() == 'mksrf_fglacierregion': + fglacierregion= x[1].strip() + fglacierregion= fglacierregion.strip("'") + if x[0].strip() == 'mksrf_fvocef': + fvocef= x[1].strip() + fvocef= fvocef.strip("'") + if x[0].strip() == 'mksrf_furbtopo': + furbtopo = x[1].strip() + furbtopo = furbtopo.strip("'") + if x[0].strip() == 'mksrf_fgdp': + fgdp = x[1].strip() + fgdp = fgdp.strip("'") + if x[0].strip() == 'mksrf_fpeat': + fpeat = x[1].strip() + fpeat = fpeat.strip("'") + if x[0].strip() == 'mksrf_fsoildepth': + fsoildepth= x[1].strip() + fsoildepth= fsoildepth.strip("'") + if x[0].strip() == 'mksrf_fabm': + fabm = x[1].strip() + fabm = fabm.strip("'") + if x[0].strip() == 'mksrf_ftopostats': + ftopostats = x[1].strip() + ftopostats = ftopostats.strip("'") + if x[0].strip() == 'mksrf_fvic': + fvic = x[1].strip() + fvic = fvic.strip("'") + if x[0].strip() == 'mksrf_fch4': + fch4 = x[1].strip() + fch4 = fch4.strip("'") + if x[0].strip() == 'mksrf_furban': + furban = x[1].strip() + furban = furban.strip("'") + if x[0].strip() == 'mksrf_fvegtyp': + fvegtyp= x[1].strip() + fvegtyp= fvegtyp.strip("'") + if x[0].strip() == 'mksrf_fhrvtyp': + fhrvtyp= x[1].strip() + fhrvtyp= fhrvtyp.strip("'") + if x[0].strip() == 'mksrf_fsoicol': + fsoicol = x[1].strip() + fsoicol = fsoicol.strip("'") + if x[0].strip() == 'mksrf_flai': + flai = x[1].strip() + flai = flai.strip("'") + +#Open site file and extract data +site_found = False +with open(sitefile, 'r') as t1: + for tmp in t1: + x=tmp.split(',') + if x[0] == sitename: + site_found = True + site_header = tmp + name = x[1] + state = x[2] + plon = np.float32(x[3]) + plat = np.float32(x[4]) + elev = np.float32(x[5]) + startyear= np.int32(x[6]) + endyear = np.int32(x[7]) + alignyear= np.int32(x[8]) + timestep = np.float32(x[9]) + campaign = x[10] + exit + +if not site_found: + mprint('No site matching '+sitename+' was found') + stop +else: + mprint(site_header) + +# convert longitude to east if needed +if plon < 0: + plon+=360.0 + +#-- Open pft file and extract data --------------------------------- +site_found = False +with open(pftfile, 'r') as t1: + for tmp in t1: + x=tmp.split(',') + if x[0] == sitename: + site_found = True + pft_f1= np.int32(x[1]) + pft_c1= np.int32(x[2]) + pft_f2= np.int32(x[3]) + pft_c2= np.int32(x[4]) + pft_f3= np.int32(x[5]) + pft_c3= np.int32(x[6]) + pft_f4= np.int32(x[7]) + pft_c4= np.int32(x[8]) + pft_f5= np.int32(x[9]) + pft_c5= np.int32(x[10]) + exit + + +#-- Open soil file and extract data --------------------------------- +site_found = False +with open(soilfile, 'r') as t1: + for tmp in t1: + x=tmp.split(',') + if x[0] == sitename: + site_found = True + soil_depth = np.float32(x[1]) + n_layers = np.int32(x[2]) + layer_depth = np.float32(x[3]) + layer_sand_pct = np.float32(x[4]) + layer_clay_pct = np.float32(x[5]) + exit + +#-- create surface data file -------------------------------------- +##2 +if create_surfdata: + f1 = xr.open_dataset(fsurf) + # expand dimensions + #f1 = f1.expand_dims(['lsmlat','lsmlon']) + + # create 1d variables + lon0=np.asarray(f1['LONGXY'][0,:]) + lon=xr.DataArray(lon0,name='lon',dims='lsmlon',coords={'lsmlon':lon0}) + lat0=np.asarray(f1['LATIXY'][:,0]) + lat=xr.DataArray(lat0,name='lat',dims='lsmlat',coords={'lsmlat':lat0}) + #f2=f1.assign({'lon':lon,'lat':lat}) + # the above doesn't work now + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + + # make gridcell entirely natural vegetation *or* entirely crop + new_pct_natveg = 0. + new_pct_crop = 0. + if np.logical_and( + np.any([pft_f1,pft_f2,pft_f3,pft_f4,pft_f5]), + np.any([(pft_c1 < 15),(pft_c2 < 15),(pft_c3 < 15),(pft_c4 < 15),(pft_c5 < 15)])): + new_pct_natveg = 100. + if np.logical_and( + np.any([pft_f1,pft_f2,pft_f3,pft_f4,pft_f5]), + np.any([(pft_c1 >= 15),(pft_c2 >= 15),(pft_c3 >= 15),(pft_c4 >= 15),(pft_c5 >= 15)])): + new_pct_crop = 100. + + if new_pct_natveg == new_pct_crop: + print 'both natveg and crop set to 100, exiting' + stop + + #-- Remove non-vegetated landunits --------------------------------- + f2['PCT_NATVEG'] = new_pct_natveg + f2['PCT_CROP'] = new_pct_crop + f2['PCT_LAKE'] = 0. + f2['PCT_WETLAND'] = 0. + f2['PCT_URBAN'] = 0. + f2['PCT_GLACIER'] = 0. + + #-- Overwrite global data with raw data ---------------------------- + f2['LONGXY'] = plon + f2['LATIXY'] = plat + + #-- Soil texture + r1 = xr.open_dataset(fsoitex) + plonc = plon + if plonc > 180.0: + plonc -= 360.0 + + # set coordinates (seems to require 'lon' and 'lat' to recognize... + r1=r1.rename({'LON':'lon','LAT':'lat'}) + r1.set_coords(['lon','lat'],inplace=True) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + # extract sand/clay profiles for given mapunit + mapunit = np.int32(r2['MAPUNITS']) + + f2['PCT_SAND'][:,0,0] = np.asarray(r2['PCT_SAND'][:,mapunit]) + f2['PCT_CLAY'][:,0,0] = np.asarray(r2['PCT_CLAY'][:,mapunit]) + + r1.close() ; r2.close() + + #-- Organic + r1 = xr.open_dataset(forganic) + r1=r1.rename({'LON':'lon','LAT':'lat'}) + r1.set_coords(['lon','lat'],inplace=True) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['ORGANIC'][:,0,0] = np.asarray(r2['ORGANIC']) + r1.close() ; r2.close() + + #-- Fmax + r1 = xr.open_dataset(fmax) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['FMAX'] = np.asarray(r2['FMAX']) + r1.close() ; r2.close() + + #-- VOC + r1 = xr.open_dataset(fvocef) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['EF1_BTR'] = np.asarray(r2['ef_btr']) + f2['EF1_CRP'] = np.asarray(r2['ef_crp']) + f2['EF1_FDT'] = np.asarray(r2['ef_fdt']) + f2['EF1_FET'] = np.asarray(r2['ef_fet']) + f2['EF1_GRS'] = np.asarray(r2['ef_grs']) + f2['EF1_SHR'] = np.asarray(r2['ef_shr']) + r1.close() ; r2.close() + + #-- GDP + r1 = xr.open_dataset(fgdp) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['gdp'] = np.asarray(r2['gdp']) + r1.close() ; r2.close() + + #-- Peat + r1 = xr.open_dataset(fpeat) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['peatf'] = np.asarray(r2['peatf']) + r1.close() ; r2.close() + + #-- Soil Depth + r1 = xr.open_dataset(fsoildepth) + # create 1d variables + lon0=np.asarray(r1['LONGXY'][0,:]) + lon=xr.DataArray(lon0,name='lon',dims='lon',coords={'lon':lon0}) + lat0=np.asarray(r1['LATIXY'][:,0]) + lat=xr.DataArray(lat0,name='lat',dims='lat',coords={'lat':lat0}) + r1['lon'] = lon + r1['lat'] = lat + r1=r1.rename({'lsmlon':'lon','lsmlat':'lat'}) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['zbedrock'] = np.asarray(r2['Avg_Depth_Median']) + #f2['zbedrock'] = np.asarray(r2['Avg_Depth_Mean']) + r1.close() ; r2.close() + + #-- ABM + r1 = xr.open_dataset(fabm) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['abm'] = np.asarray(r2['abm']) + r1.close() ; r2.close() + + #-- SLOPE + r1 = xr.open_dataset(ftopostats) + rlon=np.asarray(r1['LONGITUDE']) + rlat=np.asarray(r1['LATITUDE']) + # extract gridcell closest to plon/plat (data are 1-d) (lon [0,360]) + k1 = np.argmin(np.power(rlon - plon,2)+np.power(rlat - plat,2)) + f2['SLOPE'] = np.asarray(r1['SLOPE'][k1]) + r1.close() ; r2.close() + + #-- VIC + r1 = xr.open_dataset(fvic) + r1=r1.rename({'lsmlon':'lon','lsmlat':'lat'}) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['Ws'] = np.asarray(r2['Ws']) + f2['Dsmax'] = np.asarray(r2['Dsmax']) + f2['Ds'] = np.asarray(r2['Ds']) + r1.close() ; r2.close() + + #-- Methane + r1 = xr.open_dataset(fch4) + # create 1d variables + lon0=np.asarray(r1['LONGXY'][0,:]) + lon=xr.DataArray(lon0,name='lon',dims='lon',coords={'lon':lon0}) + lat0=np.asarray(r1['LATIXY'][:,0]) + lat=xr.DataArray(lat0,name='lat',dims='lat',coords={'lat':lat0}) + r1['lon'] = lon + r1['lat'] = lat + r1=r1.rename({'lsmlon':'lon','lsmlat':'lat'}) + # extract gridcell closest to plon/plat (this file is [0,360] + r2 = r1.sel(lon=plon,lat=plat,method='nearest') + f2['P3'] = np.asarray(r2['P3']) + f2['ZWT0'] = np.asarray(r2['ZWT0']) + f2['F0'] = np.asarray(r2['F0']) + r1.close() ; r2.close() + + #-- Soil Color + r1 = xr.open_dataset(fsoicol) + r1=r1.rename({'LON':'lon','LAT':'lat'}) + r1.set_coords(['lon','lat'],inplace=True) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + f2['SOIL_COLOR'] = np.asarray(r2['SOIL_COLOR']) + r1.close() ; r2.close() + + #-- LAI / Height + r1 = xr.open_dataset(flai) + r1=r1.rename({'LON':'lon','LAT':'lat'}) + r1.set_coords(['lon','lat'],inplace=True) + # extract gridcell closest to plonc/plat + r2 = r1.sel(lon=plonc,lat=plat,method='nearest') + + # ignoring crop, i.e. excluding index 15 + f2['MONTHLY_HEIGHT_BOT'][:,0:15,0,0] = np.asarray(r2['MONTHLY_HEIGHT_BOT'][:,0:15]) + f2['MONTHLY_HEIGHT_TOP'][:,0:15,0,0] = np.asarray(r2['MONTHLY_HEIGHT_TOP'][:,0:15]) + f2['MONTHLY_LAI'][:,0:15,0,0] = np.asarray(r2['MONTHLY_LAI'][:,0:15]) + f2['MONTHLY_SAI'][:,0:15,0,0] = np.asarray(r2['MONTHLY_SAI'][:,0:15]) + r1.close() ; r2.close() + + #-- Close output file + # mode 'w' overwrites file + f2.to_netcdf(path=fsurf2, mode='w') + mprint('created file '+fsurf2) + f1.close(); f2.close(); f2.close() + mprint('successfully created surface data file: '+fsurf2) + diff --git a/tools/contrib/run_clm_historical b/tools/contrib/run_clm_historical new file mode 100755 index 0000000000..d161f1c43b --- /dev/null +++ b/tools/contrib/run_clm_historical @@ -0,0 +1,365 @@ +#!/bin/csh + +######################################################################################### +# +# - Execute this script to do a CLM historical simulation from 1850 - 2014. This +# script will complete all the changes required at year 1901 to deal with the +# fact that met forcing data does not go back to 1850. +# +# - Unmodified script will do the following. +# Part 1: Simulation 1: 1850 - 1870 (21 years) using repeated 1901-1920 forcing +# Part 2: Simulation 2: 1871 - 1900 (30 years) using repeated 1901-1920 forcing +# Part 3: Simulation 3+4+5+6: 1901-1988 (four 22 year) simulations using 1901-1988 forcing +# Part 4: Simulation 7: 1989-2004 (one 16 year) branch simulation w/daily output using 1989-2004 forcing +# Part 5: Simulation 8: 2005-2014 (one 10 year) branch simulation w/daily & subdaily output using 2005-2014 forcing +# +# - Script assumes that simulation can run at least 30 years within a 12 hour block on +# Cheyenne. To find the timing in an equivalent sample run, look in the timing +# directory and grep as follows > grep 'simulated_years/day' cesm_timing* +# +# - In the env_batch.xml file for the case.run group ensure the following: +# that way you can use up to 12:00 hours of wall-clock computer time per run block +# +# - This script assumes that env_mach_pes.xml has been setup and case.setup has already been run +# +# - This script makes use of user_nl_datm1901-1920 and user_nl_datm1901-2014 +# +# - Before submitting script, make a copy of your modified or unmodified user_nl_clm file +# into "original_user_nl_clm". This should only contain namelist items that will not change throughout +# the run. +# Create a file called user_nl_clm_histdaily that contains the desired history output namelist items +# for the 1989-2004 simulation +# Create a file called user_nl_clm_histsubdaily that contains the desired history output namelist items +# for the 2005-2014 simulation +# +# - The atm data files start in 1901, so with : +# ALIGN year of 1901, (this is in units of RUN or simulation years) +# START year of 1901, (this is in units of FORCE'ing data years) +# +# RUN Year : 1850 ... 1860 1861 ... 1870 ... 1880 1881 ... 1890 ... 1900 1901 ... 2014 +# FORCE Year : 1910 ... 1920 1901 ... 1910 ... 1920 1901 ... 1910 ... 1920 1901 ... 2014 +# +# - The script could be broken up into several parts if you want to check the initial set of +# simulations. +# +# - Written by Andrew Slater - Late July, 2015; aslater@kryos.colorado.edu +# - Modified by Dave Lawrence, August, 2015 +# - Updated with better check that run has also been archived to short term - Dave Lawrence +# October, 2015 +# - Updated to adjust for the fact that the model is now slower - Keith Oleson December, 2016 +# ./run_clm_historical.v5.csh ! > & run_historical.out & +# - Extend to 2014 and obtain daily & sub-daily output for end of run - Keith Oleson January, 2018 +# ./run_clm_historical.v6.csh ! > & run_historical.out & +# - Modify history output for CMIP6 - Keith Oleson January, 2019 +# ./run_clm_historical.v7.csh ! > & run_historical.out & +######################################################################################### + +######################################################################################### +# PART 1 +######################################################################################### +# +# This portion does the initial setup and the initial 21 year run (1850-1870) +# +######################################################################################### + +# --- CASENAME is your case name +set CASENAME = 'clm50_release-clm5.0.15_2deg_GSWP3V1_hist' + +# --- Set the user namelist file. +cp original_user_nl_clm user_nl_clm + +# --- Ensure that the env_run.xml file has the correct content +# Since this particular run won't go for 51 years in 12 hours (as in v4 script), set it up for 21 years first +./xmlchange RUN_TYPE=startup +./xmlchange RUN_STARTDATE=1850-01-01 +./xmlchange STOP_OPTION=nyears +./xmlchange STOP_N=21 +./xmlchange CONTINUE_RUN=FALSE +./xmlchange RESUBMIT=0 +./xmlchange DATM_CLMNCEP_YR_ALIGN=1901 +./xmlchange DATM_CLMNCEP_YR_START=1901 +./xmlchange DATM_CLMNCEP_YR_END=1920 + +# need to use user_nl_datm files to get years right +cp user_nl_datm1901-1920 user_nl_datm + +# --- Check that you end up using the correct env_run.xml file +set nenvr = `ls -1 env_run*.xml | wc -l` +if ($nenvr > 1) then + echo 'There is more than one file of the type env_run*.xml' + echo 'There should only be one such file' + exit +endif + +# --- If you have not already built the code, then do so now +#./case.clean_build +qcmd -- ./case.build + +# --- Now submit the job and let it run +./case.submit + +######################################################################################### +# PART 2 +######################################################################################### +# +# This portion checks to see if the 1850-1870 portion of the run is done (or it waits +# 10 minutes before checking again). +# +# This will then start the run from 1871 (hence the CONTINUE_RUN=TRUE) and do one 30 year +# simulation +# +# The new values for env_run.xml are put in place +# Then submit the job +# +######################################################################################### + + +set WDIR = '/glade/scratch/'$USER'/'$CASENAME'/run/' +set DONE_RUNA = 0 +set DONE_ARCHIVE = 0 +set RESTART_FILE = $WDIR$CASENAME'.clm2.r.1871-01-01-00000.nc' + +# --- Check if the first set of simulations have completed and the data archived (every ten minutes) +while ($DONE_RUNA == 0) + if (-e $RESTART_FILE) then + set DONE_RUNA = 1 + echo '1850-1870 run is complete' + while ($DONE_ARCHIVE == 0) + set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + echo $nh0 + if ($nh0 == 1) then + set DONE_ARCHIVE = 1 + echo 'Files have been archived' + else + sleep 600 + date + endif + else + sleep 600 + date + endif +end + +# These are the proper settings to let this script continue the run through 1900 +./xmlchange STOP_N=30 +./xmlchange CONTINUE_RUN=TRUE + +# --- Now submit the job and let it run +./case.submit + +######################################################################################### +# PART 3 +######################################################################################### +# +# This portion checks to see if the 1871-1900 portion of the run is done (or it waits +# 10 minutes before checking again). It then removes (or rather moves and renames) the +# datm files so that the model will use the full array of data from 1901-2014. +# This part runs with forcing data files that actually exist for 1901-2014 +# +# This will start the run from 1901 (hence the CONTINUE_RUN=TRUE) and do four 22 year +# simulations: 1901 + 4*22 - 1 = 1988 (minus 1 because we do 1901) +# +# The new values for env_run.xml are put in place +# Then submit the job +# +######################################################################################### + + +set WDIR = '/glade/scratch/'$USER'/'$CASENAME'/run/' +set DDIR = $WDIR'restart_dump/' +set DONE_RUNA = 0 +set DONE_ARCHIVE = 0 +set RESTART_FILE = $WDIR$CASENAME'.clm2.r.1901-01-01-00000.nc' + +# --- Check if the first set of simulations have completed and the data archived (every ten minutes) +while ($DONE_RUNA == 0) + if (-e $RESTART_FILE) then + set DONE_RUNA = 1 + echo '1850-1900 run is complete' + while ($DONE_ARCHIVE == 0) + set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + echo $nh0 + if ($nh0 == 1) then + set DONE_ARCHIVE = 1 + echo 'Files have been archived' + else + sleep 600 + date + endif + else + sleep 600 + date + endif +end + +# --- If the first two sets of simulations are done, move the datm files and compress them +if (! -d $DDIR) then + mkdir $DDIR +endif +mv -i $WDIR$CASENAME.datm.rs1*.bin $DDIR +gzip $DDIR$CASENAME*.bin + +# Since this particular run won't go for 55 years in 12 hours, do this in four 22 year chunks, thus +# we have to resubmit the job 3 times. +./xmlchange STOP_OPTION=nyears +./xmlchange STOP_N=22 +./xmlchange DATM_CLMNCEP_YR_ALIGN=1901 +./xmlchange DATM_CLMNCEP_YR_START=1901 +./xmlchange DATM_CLMNCEP_YR_END=2014 +./xmlchange CONTINUE_RUN=TRUE +./xmlchange RESUBMIT=3 + +# need to use user_nl_datm files to get years right +cp user_nl_datm1901-2014 user_nl_datm + +# --- Check that you end up using the correct env_run.xml file +set nenvr = `ls -1 env_run*.xml | wc -l` +if ($nenvr > 1) then + echo 'There is more than one file of the type env_run*.xml' + echo 'There should only be one such file' + exit +endif + +# --- Now submit the job and let it run +./case.submit + +######################################################################################### +# PART 4 +######################################################################################### +# +# This portion checks to see if the 1901-1988 part of the run is complete +# and then runs the model for 1989-2004 as a branch run to get daily output +# +######################################################################################### + +set DONE_RUNA = 0 +set DONE_ARCHIVE = 0 +set RESTART_FILE = $WDIR$CASENAME'.clm2.r.1989-01-01-00000.nc' + +# --- Check if the second set of simulations have completed and the data archived (every ten minutes) +while ($DONE_RUNA == 0) + if (-e $RESTART_FILE) then + set DONE_RUNA = 1 + echo '1901-1989 run is complete' + while ($DONE_ARCHIVE == 0) + set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + echo $nh0 + if ($nh0 == 1) then + set DONE_ARCHIVE = 1 + echo 'Files have been archived' + else + sleep 600 + date + endif + else + sleep 600 + date + endif +end + +# --- Ensure that the env_run.xml file has the correct content +./xmlchange RUN_TYPE=branch +./xmlchange RUN_REFCASE={$CASENAME} +./xmlchange RUN_REFDATE=1989-01-01 +./xmlchange STOP_OPTION=nyears +./xmlchange STOP_N=16 +./xmlchange CONTINUE_RUN=FALSE +./xmlchange RESUBMIT=0 + +# --- Add in the daily output streams +# --- Reset the user namelist file. +cp original_user_nl_clm user_nl_clm + +# --- Add in the daily history output items +cat user_nl_clm_histdaily >> user_nl_clm + +# --- Now submit the job and let it run +./case.submit + +######################################################################################### +# PART 5 +######################################################################################### +# +# This portion checks to see if the 1989-2004 part of the run is complete +# and then runs the model for 2005-2014 as a branch run to get daily and subdaily output +# +######################################################################################### + +set DONE_RUNA = 0 +set DONE_ARCHIVE = 0 +set RESTART_FILE = $WDIR$CASENAME'.clm2.r.2005-01-01-00000.nc' + +# --- Check if the second set of simulations have completed and the data archived (every ten minutes) +while ($DONE_RUNA == 0) + if (-e $RESTART_FILE) then + set DONE_RUNA = 1 + echo '1989-2004 run is complete' + while ($DONE_ARCHIVE == 0) + set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + echo $nh0 + if ($nh0 == 1) then + set DONE_ARCHIVE = 1 + echo 'Files have been archived' + else + sleep 600 + date + endif + else + sleep 600 + date + endif +end + +# --- Ensure that the env_run.xml file has the correct content +./xmlchange RUN_TYPE=branch +./xmlchange RUN_REFCASE={$CASENAME} +./xmlchange RUN_REFDATE=2005-01-01 +./xmlchange STOP_OPTION=nyears +./xmlchange STOP_N=10 +./xmlchange CONTINUE_RUN=FALSE +./xmlchange RESUBMIT=0 + +# --- Add in the subdaily output streams +# --- Reset the user namelist file. +cp original_user_nl_clm user_nl_clm + +# --- Add in the daily history output items +cat user_nl_clm_histdaily >> user_nl_clm + +# --- Add in the subdaily history output items +cat user_nl_clm_histsubdaily >> user_nl_clm + +# --- Now submit the job and let it run +./case.submit + +######################################################################################### +# +# This portion checks to see if the 2005-2014 part of the run is complete +# and ends the script +# +######################################################################################### + +set DONE_RUNA = 0 +set DONE_ARCHIVE = 0 +set RESTART_FILE = $WDIR$CASENAME'.clm2.r.2015-01-01-00000.nc' + +# --- Check if the second set of simulations have completed and the data archived (every ten minutes) +while ($DONE_RUNA == 0) + if (-e $RESTART_FILE) then + set DONE_RUNA = 1 + echo '2005-2014 run is complete' + while ($DONE_ARCHIVE == 0) + set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + echo $nh0 + if ($nh0 == 1) then + set DONE_ARCHIVE = 1 + echo 'Files have been archived' + else + sleep 600 + date + endif + else + sleep 600 + date + endif +end diff --git a/tools/contrib/run_clmtowers b/tools/contrib/run_clmtowers new file mode 100755 index 0000000000..59b276260f --- /dev/null +++ b/tools/contrib/run_clmtowers @@ -0,0 +1,356 @@ +#!/bin/csh -f +# +# run_clmtowers.csh +# Purpose: This script will run any number of flux tower sites. You will need to +# run the script for each spinup and post spinup set of simulations (i.e., +# for BGC on, run it separately for AD, PostAD, and post spinup simulations; +# for BGC off, run it separately for spinup and post spinup simulations) +# You will need to do two things: +# 1. Copy this script into $Clm_Tag_Dir/tools/shared/PTCLM +# where $Clm_Tag_Dir is the location of your clm tag +# 2. Set up a directory structure where you can put any sourcemods you might want. +# These sourcemods will be copied into the appropriate case directory. +# The structure is up to you but here is an example: +# cd $Clm_Tag_Dir/tools/shared/PTCLM +# mkdir SourceMods +# mkdir SourceMods/clm4_5 +# mkdir SourceMods/clm5_0 +# mkdir SourceMods/clm4_5/BASE ; This might contain any sourcemods that you want +# ; to use in your clm4_5 control experiment +# mkdir SourceMods/clm5_0/BASE ; This might contain any sourcemods that you want +# ; to use in your clm5_0 control experiment +# mkdir SourceMods/clm4_5/EXP1 ; This might contain any sourcemods that you want +# ; to use in your first clm4_5 experiment +# mkdir SourceMods/clm5_0/EXP1 ; This might contain any sourcemods that you want +# ; to use in your first clm5_0 experiment +# Author: Keith Oleson +# Last Revised: Jan 24 2019 +# Last CLM Tag that this worked on: release-clm5.0.12 +# Warning: This script is complicated and does not have good (any) error checking currently. +# You might want to ask me for a quick tutorial before using this. +# +# ASSUMES that PTCLMmkdata has already been run for the tower sites chosen below +# (Surface datasets and shell commands have already been created) +# To run this script on cheyenne: qcmd -- ./run_clmtowers.csh >&! run_clmtowers.out & +# + +set pwd=`pwd` + +# =================================Start User Mods================================ +# Pick a compset (these are the only two compsets supported, they are both SP compsets +# but BGC will be added if requested below) +#set compset = I1PtClm45SpGs +set compset = I1PtClm50SpGs +if ($compset == I1PtClm45SpGs) then + set model = clm4_5 +else + set model = clm5_0 +endif + +# Set location of your run directories +set rundata = /glade/scratch/oleson +# Set the location of your CLM tag +set Clm_Tag_Dir = /glade/work/oleson/release-clm5.0.12 +# Set the location of your surface datasets and shell commands that were generated by PTCLM. +# This will not necessarily be in the same location as the CLM tag that you are running above +#set User_Mods_Dir = /glade/scratch/oleson/release-clm5.0.12 # This is my version for SP simulations +set User_Mods_Dir = /glade/scratch/oleson/release-clm5.0.12.BGC # This is my version for BGC simulations + +# What sites to run? +# These are the sites that can be evaluated with some combination of level 2 data and synthesis (gap-filled) data +#set sites = ( US-Var US-Bo1 US-UMB US-Brw US-ARM US-Ho1 US-Me4 US-Me2 US-Dk3 US-NR1 DE-Tha ES-ES1 FL-Hyy CA-Man BR-Sa3 BR-Sa1 IT-Cpz US-Dk2 US-MOz US-WCr US-MMS US-Ha1 BE-Vie IT-Col CA-Let US-FPe FL-Kaa US-IB1 US-Ne3 CA-Qfo BR-Sa1LBA BR-Sa3LBA BR-Ma1LBA BR-RJA BR-Ji1 CA-Obs CA-Ojp CA-Ca1 CA-Oas US-Dk1) +#set startyear = ( 2000 1996 1999 1998 2000 1996 1996 2002 1998 1998 1998 1999 1997 1994 2001 2002 2001 2003 2004 1998 1999 1991 1997 1996 1998 2000 2000 2005 2001 2004 2002 2001 2000 2000 1999 2000 2000 1998 1997 2001) +#set endyear = ( 2007 2008 2006 2006 2007 2004 2000 2010 2005 2007 2003 2005 2005 2003 2003 2004 2005 2005 2007 2006 2007 2006 2005 2001 2007 2007 2005 2007 2006 2006 2004 2003 2005 2002 2001 2006 2006 2006 2006 2005) +# Or you could just do one site +set sites = ( US-Var ) +set startyear = ( 2000 ) +set endyear = ( 2007 ) + +set BGC = "ON" # ON or OFF + +# USER MODS FOR BGC ON +# For BGC on, the sequence of simulations is AD spinup (300 years), +# PostAD spinup (100 years), +# post spinup (the number of tower years with atmospheric forcing) +# For BGC on, AD spinup is SPINUP_P1=TRUE, SPINUP_P2=FALSE +# PostAD spinup is SPINUP_P1=TRUE, SPINUP_P2=TRUE +# post spinup is SPINUP_P1=FALSE, SPINUP_P2=FALSE + +if ($BGC == ON) then + setenv SPINUP_P1 "TRUE" + setenv SPINUP_P2 "TRUE" +endif + +# For BGC on, you could use these for either type of spinup (AD or PostAD) +if ($BGC == ON) then + if ($SPINUP_P1 == TRUE) then + if ($model == clm5_0) then + set newcase = spinclm50conr12AD + set clonecase = spinclm50conr12pAD + else + if ($model == clm4_5) then + set newcase = spinclm45conr12AD + set clonecase = spinclm45conr12pAD + endif + endif + endif +endif + +# For BGC on, you could use these for post spinup (the number of tower years with atmospheric forcing) +# You should change the "r12" for the clonecase to whatever tag you are using (e.g., r12 is used here to +# denote release-clm5.0.12) and/or add some designation for your particular experiment with that tag (e.g., +# conclm50r12wspinbgc) +if ($BGC == ON) then + if ($SPINUP_P1 == FALSE) then + if ($model == clm5_0) then + set newcase = spinclm50conr12pAD + set clonecase = conclm50r12wspinbgc + else + if ($model == clm4_5) then + set newcase = spinclm45conr12pAD + set clonecase = conclm45r12wspinbgc + endif + endif + endif +endif + +# USER MODS FOR BGC OFF +# For BGC off, the sequence of simulations is normal spinup (32 years) +# post spinup (the number of tower years with atmospheric forcing) +# For BGC off, normal spinup is SPINUP_P1=TRUE, SPINUP_P2=FALSE +# post spinup is SPINUP_P1=FALSE, SPINUP_P2=FALSE +if ($BGC == OFF) then + setenv SPINUP_P1 "FALSE" + setenv SPINUP_P2 "FALSE" +endif + +# For BGC off, use these for either normal spinup or post spinup +# You should change the "r12" for the clonecase to whatever tag you are using (e.g., r12 is used here to +# denote release-clm5.0.12) and/or add some designation for your particular experiment with that tag (e.g., +# conclm50r12wspinsp) +if ($BGC == OFF) then + if ($model == clm5_0) then + set newcase = spinclm50conr12sp + set clonecase = conclm50r12wspinsp + else + if ($model == clm4_5) then + set newcase = spinclm45conr12sp + set clonecase = conclm45r12wspinsp + endif + endif +endif + +# These sourcemods will be copied into every case directory (you will need to setup a +# directory structure for your sourcemods, see instructions at top of script) +set sourcemods_dir = {$Clm_Tag_Dir}/tools/PTCLM/SourceMods/ +echo $sourcemods_dir +set sourcemods = {$sourcemods_dir}{$model}/BASE/*.F90 +echo $sourcemods + +# Set some namelist options if required +# If you set any of these you will need to also set them below (search on namelist_opts) +#set namelist_opts1 = "paramfile='/glade/p/cgd/tss/people/oleson/modify_param/CLM5_SP_ens_dec_5D_mcalib_psi50BET3_BETKr9_Cropkrmax5e-10_calmbboptleafcn.nc'" +#set namelist_opts2 = "baseflow_scalar= 0.001d00" +# BGC +#set namelist_opts3 = "pot_hmn_ign_counts_alpha= 0.012d00" +#set namelist_opts4 = "cli_scale= 0.022d00" +#set namelist_opts5 = "boreal_peatfire_c= 0.2d-4" + +# =================================End User Mods================================ + +@ cnt = 1 +foreach mysite ( $sites ) + @ numyears = $endyear[$cnt] - $startyear[$cnt] + 1 + if ($SPINUP_P1 == TRUE) then + @ numfour = $numyears / 4 + # If have three years or less (numfour = 0) just repeat first year + # unless first year is leap year then use next year. + # Since just using one year that is not a leap year we can use + # an alignyear of 1 and endyear is the startyear + if ( $numfour == 0 ) then + if ( $startyear[$cnt] % 4 == 0 ) then + @ startyears = $startyear[$cnt] + 1 + @ endyears = $startyears + else + @ endyears = $startyear[$cnt] + @ startyears = $endyears + endif + @ alignyear = 1 + endif + if ( $numfour != 0 ) then + @ startyears = $startyear[$cnt] + @ endyears = $startyear[$cnt] + $numfour * 4 - 1 + @ alignyear = $startyear[$cnt] + endif + echo $endyear[$cnt] + echo $endyears + echo $startyears + echo $alignyear + endif + cd {$Clm_Tag_Dir}/cime/scripts + if ($SPINUP_P1 == FALSE) then + set casename = ${clonecase}_${mysite}_$compset + ./create_clone --case $casename --clone ${newcase}_${mysite}_${compset} + else + if ($BGC == ON && $SPINUP_P2 == TRUE) then + set casename = ${clonecase}_${mysite}_$compset + echo $casename + ./create_clone --case $casename --clone ${newcase}_${mysite}_${compset} + else + set casename = ${newcase}_${mysite}_$compset + ./create_newcase --user-mods-dir {$User_Mods_Dir}/tools/PTCLM/mydatafiles/1x1pt_${mysite} --case $casename --mach cheyenne --compset $compset --res CLM_USRDAT --project P93300041 --run-unsupported + endif + endif + cd {$Clm_Tag_Dir}/cime/scripts/${casename} + ./xmlchange --id PIO_TYPENAME --val netcdf + ./xmlchange --id PIO_REARRANGER --val 1 + if ($SPINUP_P1 == FALSE) then + rm -f cesm.stderr* + rm -f cesm.stdout* + rm -f STATUS.out + ./xmlchange --id STOP_OPTION --val nyears + ./xmlchange --id STOP_N --val $numyears + ./xmlchange --id RUN_STARTDATE --val $startyear[$cnt]-01-01 + ./xmlchange --id DATM_CLMNCEP_YR_ALIGN --val $startyear[$cnt] + ./xmlchange --id DATM_CLMNCEP_YR_START --val $startyear[$cnt] + ./xmlchange --id DATM_CLMNCEP_YR_END --val $endyear[$cnt] + ./xmlchange --id CALENDAR --val GREGORIAN + if ($BGC == ON) then + ./xmlchange --id CLM_BLDNML_OPTS --val "-mask navy -bgc bgc -crop" + ./xmlchange --id CLM_ACCELERATED_SPINUP --val "off" + endif + else + if ($BGC == ON && $SPINUP_P2 == TRUE) then + rm -f cesm.stderr* + rm -f cesm.stdout* + rm -f STATUS.out + ./xmlchange --id STOP_OPTION --val nyears + ./xmlchange --id STOP_N --val 100 + ./xmlchange --id CLM_BLDNML_OPTS --val "-mask navy -bgc bgc -crop" + ./xmlchange --id CLM_ACCELERATED_SPINUP --val "off" + else + ./xmlchange --id STOP_OPTION --val nyears + if ($BGC == ON) then + ./xmlchange --id STOP_N --val 300 + else + ./xmlchange --id STOP_N --val 32 + endif + if ($alignyear == 1) then + ./xmlchange --id RUN_STARTDATE --val 000{$alignyear}-01-01 + else + ./xmlchange --id RUN_STARTDATE --val $startyear[$cnt]-01-01 + endif + ./xmlchange --id DATM_CLMNCEP_YR_ALIGN --val $alignyear + ./xmlchange --id DATM_CLMNCEP_YR_START --val $startyears + ./xmlchange --id DATM_CLMNCEP_YR_END --val $endyears + if ($alignyear == 1) then + ./xmlchange --id CALENDAR --val NO_LEAP + endif + if ($BGC == ON) then + ./xmlchange --id CLM_BLDNML_OPTS --val "-mask navy -bgc bgc -crop" + ./xmlchange --id CLM_ACCELERATED_SPINUP --val "on" + endif + endif + endif + if ($mysite == BR-Sa1LBA || $mysite == BR-Sa3LBA || $mysite == BR-Ma1LBA || $mysite == BR-RJA || $mysite == BR-Ji1) then + if ($SPINUP_P1 == FALSE) then + rm -f user_datm.streams.txt.CLM1PT.CLM_USRDAT + endif + endif + ./xmlchange --id MAX_TASKS_PER_NODE --val 1 + ./xmlchange --id MAX_MPITASKS_PER_NODE --val 1 + ./case.setup + ./preview_namelists + # Have to force this for some reason + if ($SPINUP_P1 == FALSE) then + ./xmlchange --id DATM_CLMNCEP_YR_END --val $endyear[$cnt] + ./preview_namelists + endif + if ( $status != 0 )then + echo "CESM_SETUP FAIL $status" >> ./STATUS.out + exit -1 + else + echo "CESM_SETUP PASS" >> ./STATUS.out + endif + if ($SPINUP_P1 == TRUE && $BGC == ON) then + sed "/BSUB -R/d" ./.case.run > tmp.run + ./xmlchange --subgroup case.run --id JOB_WALLCLOCK_TIME --val 5:59 +# ./xmlchange --subgroup case.run --id JOB_QUEUE --val regular + ./xmlchange --subgroup case.run --id JOB_QUEUE --val share + ./xmlchange --subgroup case.run --id PROJECT --val P93300041 + else + sed "/BSUB -R/d" ./.case.run > tmp.run +# ./xmlchange --subgroup case.run --id JOB_QUEUE --val regular + ./xmlchange --subgroup case.run --id JOB_WALLCLOCK_TIME --val 5:59 + ./xmlchange --subgroup case.run --id JOB_QUEUE --val share + ./xmlchange --subgroup case.run --id PROJECT --val P93300041 + endif + mv tmp.run ./.case.run + chmod u+x ./.case.run + cp $sourcemods SourceMods/src.clm + echo $mysite + if ($mysite == BR-Sa1LBA || $mysite == BR-Sa3LBA || $mysite == BR-Ma1LBA || $mysite == BR-RJA || $mysite == BR-Ji1) then + cp CaseDocs/datm.streams.txt.CLM1PT.CLM_USRDAT ./user_datm.streams.txt.CLM1PT.CLM_USRDAT + chmod u+wx ./user_datm.streams.txt.CLM1PT.CLM_USRDAT + sed "s/RH /QBOT /g" user_datm.streams.txt.CLM1PT.CLM_USRDAT > tmp.user_datm.streams.txt.CLM1PT.CLM_USRDAT + sed "s/ rh/ shum/g" tmp.user_datm.streams.txt.CLM1PT.CLM_USRDAT > tmp2.user_datm.streams.txt.CLM1PT.CLM_USRDAT + rm -f tmp.user_datm.streams.txt.CLM1PT.CLM_USRDAT + mv tmp2.user_datm.streams.txt.CLM1PT.CLM_USRDAT ./user_datm.streams.txt.CLM1PT.CLM_USRDAT + endif + if ($SPINUP_P1 == FALSE) then + sed "/taxmode = 'cycle','cycle'/d" user_nl_datm > tmp.user_nl_datm + mv tmp.user_nl_datm ./user_nl_datm + sed "s/hist_nhtfrq = 0/hist_nhtfrq = 0,1/g" ./user_nl_clm > tmp.user_nl_clm + sed "s/hist_mfilt = 1200/hist_mfilt = 1,350400/g" ./tmp.user_nl_clm > tmp2.user_nl_clm + rm -f tmp.user_nl_clm + sed "/finidat/d" ./tmp2.user_nl_clm > tmp3.user_nl_clm + rm -f tmp2.user_nl_clm + if ($BGC == ON) then + echo " hist_fincl2 = 'FSDS','FLDS','FSR','FSA','FIRE','FIRA','FSH','FCTR','FCEV','FGEV','FGR','FGR12','FSM','TSOI','COSZEN','RAIN','SNOW','H2OSOI','WA','ZWT','GPP','NEE','ELAI','BTRAN','TV','RSSUN','RSSHA','FSH_G','RHAF','RH_LEAF','RH','T10','TG','SABG','SABV'" >> tmp3.user_nl_clm + else + if ($model == clm5_0) then + echo " hist_fincl2 = 'FSDS','FLDS','FSR','FSA','FIRE','FIRA','FSH','FCTR','FCEV','FGEV','FGR','FGR12','FSM','TSOI','COSZEN','RAIN','SNOW','H2OSOI','WA','ZWT','ELAI','BTRAN','FPSN','TV','RSSUN','RSSHA','FSH_G','RHAF','RH_LEAF','RH','T10','TG','SABG','SABV','VEGWP'" >> tmp3.user_nl_clm + else + echo " hist_fincl2 = 'FSDS','FLDS','FSR','FSA','FIRE','FIRA','FSH','FCTR','FCEV','FGEV','FGR','FGR12','FSM','TSOI','COSZEN','RAIN','SNOW','H2OSOI','WA','ZWT','ELAI','BTRAN','FPSN','TV','RSSUN','RSSHA','FSH_G','RHAF','RH_LEAF','RH','T10','TG','SABG','SABV'" >> tmp3.user_nl_clm + endif + endif + set finidat=`ls -1 $rundata/${newcase}_${mysite}_${compset}/run/${newcase}_${mysite}_${compset}.clm?.r.*.nc | tail -1` + echo $finidat + echo " finidat = '$finidat'" >> tmp3.user_nl_clm + mv tmp3.user_nl_clm ./user_nl_clm + else + if ($BGC == ON && $SPINUP_P2 == TRUE) then + set finidat=`ls -1 $rundata/${newcase}_${mysite}_${compset}/run/${newcase}_${mysite}_${compset}.clm?.r.*.nc | tail -1` + echo $finidat + echo " finidat = '$finidat'" >> user_nl_clm + else + echo "taxmode = 'cycle','cycle'" >> user_nl_datm +# echo $namelist_opts1 >> user_nl_clm +# echo $namelist_opts2 >> user_nl_clm +# echo $namelist_opts3 >> user_nl_clm +# echo $namelist_opts4 >> user_nl_clm +# echo $namelist_opts5 >> user_nl_clm + if ($BGC == ON) then + sed "s/hist_mfilt = 1200/hist_mfilt = 12000/g" ./user_nl_clm > tmp.user_nl_clm + echo " hist_fincl1 = 'TOTECOSYSC', 'TOTECOSYSN', 'TOTSOMC', 'TOTSOMN', 'TOTVEGC', 'TOTVEGN', 'TLAI', 'GPP', 'CPOOL', 'NPP', 'TWS', 'FSH', 'FCTR', 'FCEV', 'FGEV', 'QRUNOFF', 'ZWT', 'NEE', 'NEP'" >> tmp.user_nl_clm + mv tmp.user_nl_clm ./user_nl_clm + endif + endif + endif + ./case.build + if ( $status != 0 )then + echo "BUILD FAIL $status" >> ./STATUS.out + exit -1 + else + echo "BUILD PASS" >> ./STATUS.out + endif + ./case.submit + if ( $status != 0 )then + echo "SUBMIT FAIL $status" >> ./STATUS.out + exit -1 + else + echo "SUBMIT PASS" >> ./STATUS.out + endif + cd $pwd + @ cnt++ +end diff --git a/tools/contrib/singlept b/tools/contrib/singlept new file mode 100755 index 0000000000..d8c344f53e --- /dev/null +++ b/tools/contrib/singlept @@ -0,0 +1,375 @@ +#! /usr/bin/env python +# +# singlept +# +# Script to extract a single grid point from global datasets +# + +# Import libraries +import sys +import os +from getpass import getuser +import string +import subprocess +import numpy as np +import xarray as xr + +def error( desc ): + "error function" + mprint( "ERROR:: "+desc ) + os.abort() + +def mprint(mstr): + "Print function whether python-2 or python-3" + # six.py or import __future__ print_function could be used instead... + vnum=sys.version_info[0] + if vnum == 3: + print(mstr) + if vnum == 2: + print mstr + +def AddTagToFilename(filename, tag): + "Add a tag to a filename" + # Expects file to end with [._]cYYMMDD.nc or [._]YYMMDD.nc + # Add the tag to just before that ending part + basename = os.path.basename(filename) + cend = -10 + if ( basename[cend] == "c" ): + cend = cend - 1 + if ( (basename[cend] != ".") and (basename[cend] != "_") ): + error( "Trouble figuring out where to add tag to filename:"+filename ) + return( basename[:cend]+"_"+tag+basename[cend:] ) + +mprint( "singlept script to extract out a single point from the global CTSM inputdata datasets\n" ) +myname=getuser() +pwd=os.getcwd() +mprint("User = "+myname) +mprint("Current directory = "+pwd+"\n") + +''' +#------------------------------------------------------------------# +#--------------------- Instructions -----------------------------# +#------------------------------------------------------------------# +load the following into your local environment +module load python/2.7.14 +ncar_pylib + +After creating a case using a global compset, run preview_namelist. +From the resulting lnd_in file in the run directory, find the name +of the domain file, and the surface data file. +From the datm streams files (e.g. datm.streams.txt.CLMGSWP3v1.Precip) +find the name of the datm forcing data domain file and forcing files. +Use these file names as the sources for the single point files to +be created (see below). + +After running this script, point to the new CLM domain and surface +dataset using the user_nl_clm file in the case directory. In addition, +copy the datm.streams files to the case directory, with the prefix +'user_', e.g. user_datm.streams.txt.CLMGSWP3v1.Precip. Change the +information in the user_datm.streams* files to point to the single +point datm data (domain and forcing files) created using this script. + +The domain file is not set via user_nl_clm, but requires changing +LND_DOMAIN and ATM_DOMAIN (and their paths) in env_run.xml. + +Using single point forcing data requires specifying the nearest +neighbor mapping algorithm for the datm streams (usually they are +the first three in the list) in user_nl_datm: mapalgo = 'nn','nn','nn', +..., where the '...' can still be 'bilinear', etc, depending on the +other streams that are being used, e.g. aerosols, anomaly forcing, +bias correction. + +The file env_mach_pes.xml should be modified to specify a single +processor. The mpi-serial libraries should also be used, and can be +set in env_build.xml by changing "MPILIB" to "mpi-serial" prior to +setting up the case. + +The case for the single point simulation should have river routing +and land ice models turned off (i.e. the compset should use stub +models SROF and SGLC) + +to run the script +./singlept +deactivate # to remove NPL from environment + +''' + +# Set control flags + +#-- Setup by default to run for Harvard Forest + +#-- Specify point to extract +plon = 287.8 +plat = 42.5 + +#-- Create regional CLM domain file +create_domain = True +#-- Create CLM surface data file +create_surfdata = True +#-- Create CLM surface data file +create_landuse = True +#-- Create single point DATM atmospheric forcing data +create_datm = False +datm_syr=1901 +datm_eyr=2014 + +#-- Modify landunit structure +overwrite_single_pft = True +dominant_pft = 7 #BETr +zero_nonveg_pfts = True +uniform_snowpack = True +no_saturation_excess = True + +#-- Specify input and output directories +dir_output='/glade/scratch/'+myname+'/single_point/' +if ( not os.path.isdir( dir_output ) ): + os.mkdir( dir_output ) +dir_inputdata='/glade/p/cesmdata/cseg/inputdata/' +dir_clm_forcedata='/glade/p/cgd/tss/CTSM_datm_forcing_data/' +dir_input_datm=dir_clm_forcedata+'/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/' +dir_output_datm=dir_output + 'datmdata/' +if ( not os.path.isdir( dir_output_datm ) ): + os.mkdir( dir_output_datm ) + +#-- Set input and output filenames +tag=str(plon)+'_'+str(plat) + +#-- Set time stamp +command='date "+%y%m%d"' +x2=subprocess.Popen(command,stdout=subprocess.PIPE,shell='True') +x=x2.communicate() +timetag = x[0].strip() + +#-- Specify land domain file --------------------------------- +fdomain = dir_inputdata+'share/domains/domain.lnd.fv0.9x1.25_gx1v7.151020.nc' +fdomain2 = dir_output + AddTagToFilename( fdomain, tag ) + +#-- Specify surface data file -------------------------------- +fsurf = dir_inputdata+'lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_CMIP6_simyr1850_c170706.nc' +fsurf2 = dir_output + AddTagToFilename( fsurf, tag ) + +#-- Specify landuse file ------------------------------------- +fluse = dir_inputdata+'lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc' +fluse2 = dir_output + AddTagToFilename( fluse, tag ) + +#-- Specify datm domain file --------------------------------- +fdatmdomain = dir_clm_forcedata+'atm_forcing.datm7.GSWP3.0.5d.v1.c170516/domain.lnd.360x720_gswp3.0v1.c170606.nc' +fdatmdomain2 = dir_output_datm+AddTagToFilename( fdatmdomain, tag ) + +#-- Create CTSM domain file +if create_domain: + mprint( "Open: "+fdomain ) + f1 = xr.open_dataset(fdomain) + # create 1d coordinate variables to enable sel() method + lon0=np.asarray(f1['xc'][0,:]) + lat0=np.asarray(f1['yc'][:,0]) + lon=xr.DataArray(lon0,name='lon',dims='ni',coords={'ni':lon0}) + lat=xr.DataArray(lat0,name='lat',dims='nj',coords={'nj':lat0}) + # assign() not working on cheyenne + #f2=f1.assign({'lon':lon,'lat':lat}) + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + f2.reset_coords(['xc','yc'],inplace=True) + # extract gridcell closest to plon/plat + f3 = f2.sel(ni=plon,nj=plat,method='nearest') + # expand dimensions + f3 = f3.expand_dims(['nj','ni']) + + wfile=fdomain2 + # mode 'w' overwrites file + f3.to_netcdf(path=wfile, mode='w') + mprint('created file '+fdomain2) + f1.close(); f2.close(); f3.close() + +#-- Create CTSM surface data file +if create_surfdata: + mprint( "Open: "+fsurf ) + f1 = xr.open_dataset(fsurf) + # create 1d variables + lon0=np.asarray(f1['LONGXY'][0,:]) + lon=xr.DataArray(lon0,name='lon',dims='lsmlon',coords={'lsmlon':lon0}) + lat0=np.asarray(f1['LATIXY'][:,0]) + lat=xr.DataArray(lat0,name='lat',dims='lsmlat',coords={'lsmlat':lat0}) + #f2=f1.assign({'lon':lon,'lat':lat}) + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + # extract gridcell closest to plon/plat + f3 = f2.sel(lsmlon=plon,lsmlat=plat,method='nearest') + # expand dimensions + f3 = f3.expand_dims(['lsmlat','lsmlon']) + + # modify surface data properties + if overwrite_single_pft: + f3['PCT_NAT_PFT'][:,:,:] = 0 + f3['PCT_NAT_PFT'][:,:,dominant_pft] = 100 + if zero_nonveg_pfts: + f3['PCT_NATVEG'][:,:] = 100 + f3['PCT_CROP'][:,:] = 0 + f3['PCT_LAKE'][:,:] = 0. + f3['PCT_WETLAND'][:,:] = 0. + f3['PCT_URBAN'][:,:,] = 0. + f3['PCT_GLACIER'][:,:] = 0. + if uniform_snowpack: + f3['STD_ELEV'][:,:] = 20. + if no_saturation_excess: + f3['FMAX'][:,:] = 0. + + # specify dimension order + #f3 = f3.transpose(u'time', u'cft', u'natpft', u'lsmlat', u'lsmlon') + f3 = f3.transpose(u'time', u'cft', u'lsmpft', u'natpft', u'nglcec', u'nglcecp1', u'nlevsoi', u'nlevurb', u'numrad', u'numurbl', 'lsmlat', 'lsmlon') + # mode 'w' overwrites file + f3.to_netcdf(path=fsurf2, mode='w') + mprint('created file '+fsurf2) + f1.close(); f2.close(); f3.close() + + ''' this is buggy; can't re-write a file within the same session + # modify new surface data file + if overwrite_single_pft: + f1 = xr.open_dataset(fsurf2) + f1['PCT_NAT_PFT'][:,:,:] = 0 + f1['PCT_NAT_PFT'][:,:,dominant_pft] = 100 + f1.to_netcdf(path='~/junk.nc', mode='w') + #f1.to_netcdf(path=fsurf2, mode='w') + f1.close() + if zero_nonveg_pfts: + #f1 = xr.open_dataset(fsurf2) + f1 = xr.open_dataset('~/junk.nc') + f1['PCT_NATVEG'] = 100 + f1['PCT_CROP'] = 0 + f1['PCT_LAKE'] = 0. + f1['PCT_WETLAND'] = 0. + f1['PCT_URBAN'] = 0. + f1['PCT_GLACIER'] = 0. + #f1.to_netcdf(path=fsurf2, mode='w') + f1.to_netcdf(path='~/junk2.nc', mode='w') + f1.close() + ''' +#-- Create CTSM transient landuse data file +if create_landuse: + mprint( "Open: "+fluse ) + f1 = xr.open_dataset(fluse) + # create 1d variables + lon0=np.asarray(f1['LONGXY'][0,:]) + lon=xr.DataArray(lon0,name='lon',dims='lsmlon',coords={'lsmlon':lon0}) + lat0=np.asarray(f1['LATIXY'][:,0]) + lat=xr.DataArray(lat0,name='lat',dims='lsmlat',coords={'lsmlat':lat0}) + #f2=f1.assign({'lon':lon,'lat':lat}) + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + # extract gridcell closest to plon/plat + f3 = f2.sel(lsmlon=plon,lsmlat=plat,method='nearest') + + # expand dimensions + f3 = f3.expand_dims(['lsmlat','lsmlon']) + # specify dimension order + #f3 = f3.transpose('time','lat','lon') + f3 = f3.transpose(u'time', u'cft', u'natpft', u'lsmlat', u'lsmlon') + #f3['YEAR'] = f3['YEAR'].squeeze() + + # revert expand dimensions of YEAR + year = np.squeeze(np.asarray(f3['YEAR'])) + x = xr.DataArray(year, coords={'time':f3['time']}, dims='time', name='YEAR') + x.attrs['units']='unitless' + x.attrs['long_name']='Year of PFT data' + f3['YEAR'] = x + #print(x) + #mprint(f3) + #stop + # mode 'w' overwrites file + f3.to_netcdf(path=fluse2, mode='w') + mprint('created file '+fluse2) + f1.close(); f2.close(); f3.close() + +#-- Create single point atmospheric forcing data +if create_datm: + #-- create datm domain file + mprint( "Open: "+fdatmdomain ) + f1 = xr.open_dataset(fdatmdomain) + # create 1d coordinate variables to enable sel() method + lon0=np.asarray(f1['xc'][0,:]) + lat0=np.asarray(f1['yc'][:,0]) + lon=xr.DataArray(lon0,name='lon',dims='ni',coords={'ni':lon0}) + lat=xr.DataArray(lat0,name='lat',dims='nj',coords={'nj':lat0}) + + #f2=f1.assign({'lon':lon,'lat':lat}) + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + f2.reset_coords(['xc','yc'],inplace=True) + # extract gridcell closest to plon/plat + f3 = f2.sel(ni=plon,nj=plat,method='nearest') + # expand dimensions + f3 = f3.expand_dims(['nj','ni']) + + wfile=fdatmdomain2 + # mode 'w' overwrites file + f3.to_netcdf(path=wfile, mode='w') + mprint('created file '+fdatmdomain2) + f1.close(); f2.close(); f3.close() + + #-- specify subdirectory names and filename prefixes + solrdir = 'Solar/' + precdir = 'Precip/' + tpqwldir = 'TPHWL/' + prectag = 'clmforc.GSWP3.c2011.0.5x0.5.Prec.' + solrtag = 'clmforc.GSWP3.c2011.0.5x0.5.Solr.' + tpqwtag = 'clmforc.GSWP3.c2011.0.5x0.5.TPQWL.' + + #-- create data files + infile=[] + outfile=[] + for y in range(datm_syr,datm_eyr+1): + ystr=str(y) + for m in range(1,13): + mstr=str(m) + if m < 10: + mstr='0'+mstr + + dtag=ystr+'-'+mstr + + fsolar=dir_input_datm+solrdir+solrtag+dtag+'.nc' + fsolar2=dir_output_datm+solrtag+tag+'.'+dtag+'.nc' + fprecip=dir_input_datm+precdir+prectag+dtag+'.nc' + fprecip2=dir_output_datm+prectag+tag+'.'+dtag+'.nc' + ftpqw=dir_input_datm+tpqwldir+tpqwtag+dtag+'.nc' + ftpqw2=dir_output_datm+tpqwtag+tag+'.'+dtag+'.nc' + + infile+=[fsolar,fprecip,ftpqw] + outfile+=[fsolar2,fprecip2,ftpqw2] + + nm=len(infile) + for n in range(nm): + mprint(outfile[n]+'\n') + file_in = infile[n] + file_out = outfile[n] + + + f1 = xr.open_dataset(file_in) + # create 1d coordinate variables to enable sel() method + lon0=np.asarray(f1['LONGXY'][0,:]) + lat0=np.asarray(f1['LATIXY'][:,0]) + lon=xr.DataArray(lon0,name='lon',dims='lon',coords={'lon':lon0}) + lat=xr.DataArray(lat0,name='lat',dims='lat',coords={'lat':lat0}) + #f2=f1.assign({'lon':lon,'lat':lat}) + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + f2.reset_coords(['LONGXY','LATIXY'],inplace=True) + # extract gridcell closest to plon/plat + f3 = f2.sel(lon=plon,lat=plat,method='nearest') + # expand dimensions + f3 = f3.expand_dims(['lat','lon']) + # specify dimension order + f3 = f3.transpose(u'scalar','time','lat','lon') + + # mode 'w' overwrites file + f3.to_netcdf(path=file_out, mode='w') + f1.close(); f2.close(); f3.close() + + + mprint('datm files written to: '+dir_output_datm) + +mprint( "\nSuccessfully ran script\n\n" ) diff --git a/tools/contrib/subset_surfdata b/tools/contrib/subset_surfdata new file mode 100755 index 0000000000..4dbcbf3468 --- /dev/null +++ b/tools/contrib/subset_surfdata @@ -0,0 +1,141 @@ +#! /usr/bin/env python +import sys +import os +from getpass import getuser +import string +import subprocess +import numpy as np +import xarray as xr + +def mprint(mstr): + vnum=sys.version_info[0] + if vnum == 3: + print(mstr) + if vnum == 2: + print mstr + +myname=getuser() +pwd=os.getcwd() +mprint(myname) +mprint(pwd) + +#creates regional surface dataset and domain file + +#-- Specify input and output directories +dir_output='/glade/scratch/'+myname+'/regional/' + +#-- Create regional CLM domain file +create_domain = True +#-- Create CLM surface data file +create_surfdata = True +#-- Create CLM surface data file +create_landuse = False + +tagnum=1 +if tagnum == 1: + tag='S.America' + + ln1=275. + ln2=330. + lt1=-40. + lt2=15. + +if tagnum == 2: + tag='Western.US' + + ln1=284. + ln2=296. + lt1=44. + lt2=53. + +#-- Set time stamp +command='date "+%y%m%d"' +x2=subprocess.Popen(command,stdout=subprocess.PIPE,shell='True') +x=x2.communicate() +timetag = x[0].strip() + +#-- Specify land domain file --------------------------------- +fdomain = '/glade/p/cesmdata/cseg/inputdata/share/domains/domain.lnd.fv1.9x2.5_gx1v7.170518.nc' +#fdomain2 = dir_output + 'domain.lnd.fv0.9x1.25_gx1v6.'+tag+'.090309.nc' +fdomain2 = dir_output + 'domain.lnd.fv1.9x2.5_gx1v7.'+tag+'_170518.nc' + +#-- Specify surface data file -------------------------------- +fsurf = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr1850_c170824.nc' +#fsurf2 = dir_output + 'surfdata_0.9x1.25_16pfts_CMIP6_simyr2000_'+tag+'.c170706.nc' +fsurf2 = dir_output + 'surfdata_1.9x2.5_78pfts_CMIP6_simyr1850_'+tag+'_c170824.nc' + +#-- Specify landuse file ------------------------------------- +fluse = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc' +fluse2 = dir_output + 'landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_'+tag+'.c170824.nc' + +#-- Create CTSM domain file +if create_domain: + f1 = xr.open_dataset(fdomain) + # create 1d coordinate variables to enable sel() method + lon0=np.asarray(f1['xc'][0,:]) + lat0=np.asarray(f1['yc'][:,0]) + lon=xr.DataArray(lon0,name='lon',dims='ni',coords={'ni':lon0}) + lat=xr.DataArray(lat0,name='lat',dims='nj',coords={'nj':lat0}) + # assign() not working on cheyenne + #f2=f1.assign({'lon':lon,'lat':lat}) + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + f2.reset_coords(['xc','yc'],inplace=True) + + # subset longitude and latitude arrays + xind=np.where((lon >= ln1) & (lon <= ln2))[0] + yind=np.where((lat >= lt1) & (lat <= lt2))[0] + f3=f2.isel(nj=yind,ni=xind) + + wfile=fdomain2 + # mode 'w' overwrites file + f3.to_netcdf(path=wfile, mode='w') + mprint('created file '+fdomain2) + f1.close(); f2.close(); f3.close() + +#-- Create CTSM surface data file +if create_surfdata: + f1 = xr.open_dataset(fsurf) + # create 1d variables + lon0=np.asarray(f1['LONGXY'][0,:]) + lon=xr.DataArray(lon0,name='lon',dims='lsmlon',coords={'lsmlon':lon0}) + lat0=np.asarray(f1['LATIXY'][:,0]) + lat=xr.DataArray(lat0,name='lat',dims='lsmlat',coords={'lsmlat':lat0}) + #f2=f1.assign({'lon':lon,'lat':lat}) + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + # subset longitude and latitude arrays + xind=np.where((lon >= ln1) & (lon <= ln2))[0] + yind=np.where((lat >= lt1) & (lat <= lt2))[0] + f3=f2.isel(lsmlat=yind,lsmlon=xind) + + # mode 'w' overwrites file + f3.to_netcdf(path=fsurf2, mode='w') + mprint('created file '+fsurf2) + f1.close(); f2.close(); f3.close() + +#-- Create CTSM transient landuse data file +if create_landuse: + f1 = xr.open_dataset(fluse) + # create 1d variables + lon0=np.asarray(f1['LONGXY'][0,:]) + lon=xr.DataArray(lon0,name='lon',dims='lsmlon',coords={'lsmlon':lon0}) + lat0=np.asarray(f1['LATIXY'][:,0]) + lat=xr.DataArray(lat0,name='lat',dims='lsmlat',coords={'lsmlat':lat0}) + #f2=f1.assign({'lon':lon,'lat':lat}) + f2=f1.assign() + f2['lon'] = lon + f2['lat'] = lat + # subset longitude and latitude arrays + xind=np.where((lon >= ln1) & (lon <= ln2))[0] + yind=np.where((lat >= lt1) & (lat <= lt2))[0] + f3=f2.isel(lsmlat=yind,lsmlon=xind) + # mode 'w' overwrites file + f3.to_netcdf(path=fluse2, mode='w') + mprint('created file '+fluse2) + f1.close(); f2.close(); f3.close() + + + diff --git a/tools/mksurfdata_map/Makefile.data b/tools/mksurfdata_map/Makefile.data index ddd915735d..974be9bd9e 100644 --- a/tools/mksurfdata_map/Makefile.data +++ b/tools/mksurfdata_map/Makefile.data @@ -58,6 +58,8 @@ MKSURFDATA = $(BATCHJOBS) $(PWD)/mksurfdata.pl # ne30np4 is standard resolution for SE dycore in CAM, T31 is for paleo, 360x720cru is for same resolution as forcing data STANDARD_RES = 360x720cru,48x96,0.9x1.25,1.9x2.5,10x15,4x5,ne30np4 +FUTURE_RES = 0.9x1.25,1.9x2.5,10x15 + # ne120np4 is for high resolution SE dycore, ne16 is for testing SE dycore # T42 is for SCAM # f05 is needed for running full chemistry model @@ -72,6 +74,7 @@ STANDARD = \ global-historical-ne120np4 \ global-transient-f05 \ global-transient \ + global-future \ global-transient-ne120np4 TROPICS = \ @@ -96,6 +99,7 @@ CROP = \ crop-global-historical-ne120np4 \ crop-global-transient-f05 \ crop-global-transient \ + crop-global-future \ crop-global-transient-ne120np4 all : standard tropics crop urban landuse-timeseries @@ -111,7 +115,7 @@ DEBUG: standard : $(STANDARD) global-present : FORCE - $(MKSURFDATA) -no-crop -glc_nec 10 -y 2000 -res $(STANDARD_RES) $(BACKGROUND) + $(MKSURFDATA) -no-crop -vic -glc_nec 10 -y 2000 -res $(STANDARD_RES) $(BACKGROUND) global-present-f05 : FORCE $(MKSURFDATA) -no-crop -glc_nec 10 -y 1850,2000 -res 0.47x0.63 $(BACKGROUND) @@ -150,6 +154,13 @@ global-transient-ne120np4 : FORCE global-transient-f05 : FORCE $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2000 -res 0.47x0.63 $(BACKGROUND) +# +# global with future scenarios +# +global-future : FORCE + $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ + -ssp_rcp SSP1-2.6,SSP3-7.0,SSP5-3.4,SSP2-4.5,SSP1-1.9,SSP4-3.4,SSP4-6.0,SSP5-8.5 -res $(FUTURE_RES) $(BACKGROUND) + # # tropics # @@ -229,6 +240,15 @@ crop-global-transient-ne120np4 : FORCE crop-global-transient-f05 : FORCE $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2000 -res 0.47x0.63 $(BACKGROUND) + +# +# Crop with future scenarios +# +crop-global-future : FORCE + $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2100 \ + -ssp_rcp SSP1-2.6,SSP3-7.0,SSP5-3.4,SSP2-4.5,SSP1-1.9,SSP4-3.4,SSP4-6.0,SSP5-8.5 -res $(FUTURE_RES) $(BACKGROUND) + + # # urban # diff --git a/tools/mksurfdata_map/README.developers b/tools/mksurfdata_map/README.developers index ca3ec89456..9e3744b25f 100644 --- a/tools/mksurfdata_map/README.developers +++ b/tools/mksurfdata_map/README.developers @@ -14,6 +14,8 @@ I. Adding a new raw data file II. Adding mapping files for a raw data file with a new grid / landmask +III. Checks that should be done when making new surface datasets + ============================================================================ I. Adding a new raw data file ============================================================================ @@ -176,3 +178,50 @@ laid out here. directory yourself +============================================================================ +III. Checks that should be done when making new surface datasets +============================================================================ + +Remaking all surface datasets carries the risk of introducing unintended +changes, particularly when you are expecting answer changes (so you +don't notice unintended answer changes that are mixed with the expected +changes). + +Here are some things to check after making a new set of surface +datasets: + +- For at least one global dataset (probably a production resolution + rather than a low resolution that is just used for testing): Compare + the new dataset against the previous version: + + - Compare header (via ncdump -h) and/or log file: ensure that the same + source data were used, except where you expect differences + + - Compare all fields with a tool like cprnc: make sure that the only + fields that differ are those you expect to differ + + - Visually compare all fields that differ: make sure differences look + reasonable and as expected + +And here are some things to check for when making new landuse.timeseries +datasets (which often happens at the same time, and most of the above applies +as well): + +- Compare one of the productive resolution datasets to a previous version. + + - If part of it should be identical (for example the historical period) make + sure it is identical as expected (using cprnc make sure the historical period + is identical and only the future scenario changes). + + - If the historical period should be identical, make sure the 1850 surface dataset + created is identical to the previous one. + + - Visually compare all fields/times that differ: make sure differences look + reasonable and as expected. Go through at least the first and last time to see + that the change in time is as expected. + + - Quickly going through the time differences for at least one field that changes + can also be useful to see that there isn't a sudden jump for a particular time. + + - Go through the list of raw PFT files that were used to create the dataset and make + sure it appears to be correct (ncdump -v input_pftdata_filename) diff --git a/tools/mksurfdata_map/mksurfdata.pl b/tools/mksurfdata_map/mksurfdata.pl index 76b4034b8c..fc5f1bd8ea 100755 --- a/tools/mksurfdata_map/mksurfdata.pl +++ b/tools/mksurfdata_map/mksurfdata.pl @@ -51,6 +51,7 @@ my %opts = ( hgrid=>"all", + vic=>0, ssp_rcp=>"hist", debug=>0, exedir=>undef, @@ -144,6 +145,8 @@ sub usage { -usrname "clm_usrdat_name" CLM user data name to find grid file with. + -vic Add the fields required for the VIC model + NOTE: years, res, and ssp_rcp can be comma delimited lists. @@ -267,10 +270,10 @@ sub write_transient_timeseries_file { $fh_landuse_timeseries->open( ">$landuse_timeseries_text_file" ) or die "** can't open file: $landuse_timeseries_text_file\n"; print "Writing out landuse_timeseries text file: $landuse_timeseries_text_file\n"; for( my $yr = $sim_yr0; $yr <= $sim_yrn; $yr++ ) { - my $vegtypyr = `$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resol -options sim_year=$yr,ssp-rcp=${ssp_rcp}${mkcrop} -var mksrf_fvegtyp -namelist clmexp`; + my $vegtypyr = `$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resol -options sim_year='$yr',ssp_rcp=${ssp_rcp}${mkcrop} -var mksrf_fvegtyp -namelist clmexp`; chomp( $vegtypyr ); printf $fh_landuse_timeseries $dynpft_format, $vegtypyr, $yr; - my $hrvtypyr = `$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resolhrv -options sim_year=$yr,ssp-rcp=${ssp_rcp}${mkcrop} -var mksrf_fvegtyp -namelist clmexp`; + my $hrvtypyr = `$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resolhrv -options sim_year='$yr',ssp_rcp=${ssp_rcp}${mkcrop} -var mksrf_fvegtyp -namelist clmexp`; chomp( $hrvtypyr ); printf $fh_landuse_timeseries $dynpft_format, $hrvtypyr, $yr; if ( $yr % 100 == 0 ) { @@ -336,8 +339,6 @@ sub write_namelist_file { map_fpeat = '$map->{'peat'}' map_fsoildepth = '$map->{'soildepth'}' map_fabm = '$map->{'abm'}' - map_fvic = '$map->{'vic'}' - map_fch4 = '$map->{'ch4'}' mksrf_fsoitex = '$datfil->{'tex'}' mksrf_forganic = '$datfil->{'org'}' mksrf_flakwat = '$datfil->{'lak'}' @@ -351,14 +352,19 @@ sub write_namelist_file { mksrf_fpeat = '$datfil->{'peat'}' mksrf_fsoildepth = '$datfil->{'soildepth'}' mksrf_fabm = '$datfil->{'abm'}' - mksrf_fvic = '$datfil->{'vic'}' - mksrf_fch4 = '$datfil->{'ch4'}' outnc_double = $double all_urban = $all_urb no_inlandwet = $no_inlandwet mksrf_furban = '$datfil->{'urb'}' gitdescribe = '$gitdescribe' EOF + if ( $opts{'vic'} ) { + print $fh <<"EOF"; + map_fvic = '$map->{'vic'}' + mksrf_fvic = '$datfil->{'vic'}' + outnc_vic = .true. +EOF + } if ( ! $opts{'fast_maps'} ) { print $fh <<"EOF"; map_ftopostats = '$map->{'topostats'}' @@ -450,6 +456,7 @@ sub write_namelist_file { "pft_frc=s" => \$opts{'pft_frc'}, "pft_idx=s" => \$opts{'pft_idx'}, "ssp_rcp=s" => \$opts{'ssp_rcp'}, + "vic!" => \$opts{'vic'}, "rundir=s" => \$opts{'rundir'}, "soil_col=i" => \$opts{'soil_col'}, "soil_fmx=f" => \$opts{'soil_fmx'}, @@ -511,7 +518,7 @@ sub write_namelist_file { my @years = split( ",", $opts{'years'} ); # Check that resolutions are valid foreach my $sim_year ( @years ) { - if ("-" eq substr($sim_year, 4, 1)) { + if ( ("-" eq substr($sim_year, 4, 1)) || ("-" eq substr($sim_year, 3, 1)) ) { # range of years for transient run if ( ! $definition->is_valid_value( "sim_year_range", "'$sim_year'" ) ) { print "** Invalid simulation simulation year range: $sim_year\n"; @@ -519,19 +526,19 @@ sub write_namelist_file { } } else { # single year. - if ( ! $definition->is_valid_value( "sim_year", $sim_year ) ) { + if ( ! $definition->is_valid_value( "sim_year", "'$sim_year'" ) ) { print "** Invalid simulation year: $sim_year\n"; usage(); } } } # - # Set ssp-rcp to use + # Set ssp_rcp to use # my @rcpaths = split( ",", $opts{'ssp_rcp'} ); - # Check that ssp-rcp is valid + # Check that ssp_rcp is valid foreach my $ssp_rcp ( @rcpaths ) { - if ( ! $definition->is_valid_value( "ssp-rcp", $ssp_rcp ) ) { + if ( ! $definition->is_valid_value( "ssp_rcp", $ssp_rcp ) ) { print "** Invalid ssp_rcp: $ssp_rcp\n"; usage(); } @@ -619,7 +626,10 @@ sub write_namelist_file { my $mkopts = "-csmdata $CSMDATA -silent -justvalue -namelist clmexp $usrnam"; my @typlist = ( "lak", "veg", "voc", "tex", "col", "hrv", "fmx", "lai", "urb", "org", "glc", "glcregion", "utp", "wet", - "gdp", "peat","soildepth","abm", "vic", "ch4"); + "gdp", "peat","soildepth","abm"); + if ( $opts{'vic'} ) { + push( @typlist, "vic" ); + } if ( ! $opts{'fast_maps'} ) { push( @typlist, "topostats" ); } @@ -697,7 +707,7 @@ sub write_namelist_file { # # Skip if urban unless sim_year=2000 # - if ( $urb_pt && $sim_year != 2000 ) { + if ( $urb_pt && $sim_year ne '2000' ) { print "For urban -- skip this simulation year = $sim_year\n"; next SIM_YEAR; } @@ -721,15 +731,15 @@ sub write_namelist_file { $transient = 1; } # determine simulation year to use for the surface dataset: - my $sim_yr_surfdat = $sim_yr0; + my $sim_yr_surfdat = "$sim_yr0"; - my $cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resol -options sim_year=${sim_yr_surfdat}$mkcrop -var mksrf_fvegtyp -namelist clmexp"; + my $cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resol -options sim_year='${sim_yr_surfdat}'$mkcrop -var mksrf_fvegtyp -namelist clmexp"; my $vegtyp = `$cmd`; chomp( $vegtyp ); if ( $vegtyp eq "" ) { die "** trouble getting vegtyp file with: $cmd\n"; } - my $cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resolhrv -options sim_year=${sim_yr_surfdat}$mkcrop -var mksrf_fvegtyp -namelist clmexp"; + my $cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resolhrv -options sim_year='${sim_yr_surfdat}'$mkcrop -var mksrf_fvegtyp -namelist clmexp"; my $hrvtyp = `$cmd`; chomp( $hrvtyp ); if ( $hrvtyp eq "" ) { @@ -743,8 +753,8 @@ sub write_namelist_file { if ( $mkcrop ne "" ) { $options = "-options $mkcrop"; } - $desc = sprintf( "%s_%s_%s_simyr%4.4d-%4.4d", $ssp_rcp, $crpdes, $cmip_series, $sim_yr0, $sim_yrn ); - $desc_surfdat = sprintf( "%s_%s_%s_simyr%4.4d", $ssp_rcp, $crpdes, $cmip_series, $sim_yr_surfdat ); + $desc = sprintf( "%s_%s_%s_simyr%s-%4.4d", $ssp_rcp, $crpdes, $cmip_series, $sim_yr0, $sim_yrn ); + $desc_surfdat = sprintf( "%s_%s_%s_simyr%s", $ssp_rcp, $crpdes, $cmip_series, $sim_yr_surfdat ); my $fsurdat_fname_base = ""; my $fsurdat_fname = ""; @@ -781,7 +791,7 @@ sub write_namelist_file { $sim_yr_surfdat); print "CSMDATA is $CSMDATA \n"; - print "resolution: $res ssp-rcp=$ssp_rcp sim_year = $sim_year\n"; + print "resolution: $res ssp_rcp=$ssp_rcp sim_year = $sim_year\n"; print "namelist: $namelist_fname\n"; write_namelist_file( diff --git a/tools/mksurfdata_map/src/Srcfiles b/tools/mksurfdata_map/src/Srcfiles index 25e50d3f95..94985557dc 100644 --- a/tools/mksurfdata_map/src/Srcfiles +++ b/tools/mksurfdata_map/src/Srcfiles @@ -29,7 +29,6 @@ mkpeatMod.F90 mksoildepthMod.F90 mktopostatsMod.F90 mkVICparamsMod.F90 -mkCH4inversionMod.F90 nanMod.F90 shr_file_mod.F90 shr_sys_mod.F90 diff --git a/tools/mksurfdata_map/src/mkfileMod.F90 b/tools/mksurfdata_map/src/mkfileMod.F90 index 80001b008a..3c5852796a 100644 --- a/tools/mksurfdata_map/src/mkfileMod.F90 +++ b/tools/mksurfdata_map/src/mkfileMod.F90 @@ -8,7 +8,7 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) use shr_kind_mod , only : r8 => shr_kind_r8 use shr_sys_mod , only : shr_sys_getenv use fileutils , only : get_filename - use mkvarpar , only : nlevsoi, nlevurb, numrad + use mkvarpar , only : nlevsoi, nlevurb, numrad, numstdpft use mkvarctl use mkurbanparMod, only : numurbl use mkglcmecMod , only : nglcec @@ -160,7 +160,7 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & 'Urban_raw_data_file_name', len_trim(str), trim(str)), subname) - if (.not. dynlanduse) then + if (.not. dynlanduse .and. (numpft == numstdpft) ) then str = get_filename(mksrf_flai) call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & 'Lai_raw_data_file_name', len_trim(str), trim(str)), subname) @@ -186,13 +186,11 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & 'topography_stats_raw_data_file_name', len_trim(str), trim(str)), subname) - str = get_filename(mksrf_fvic) - call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & - 'vic_raw_data_file_name', len_trim(str), trim(str)), subname) - - str = get_filename(mksrf_fch4) - call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & - 'ch4_params_raw_data_file_name', len_trim(str), trim(str)), subname) + if ( outnc_vic )then + str = get_filename(mksrf_fvic) + call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & + 'vic_raw_data_file_name', len_trim(str), trim(str)), subname) + end if ! Mapping file names @@ -244,9 +242,11 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & 'map_harvest_file', len_trim(str), trim(str)), subname) - str = get_filename(map_flai) - call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & - 'map_lai_sai_file', len_trim(str), trim(str)), subname) + if ( numpft == numstdpft )then + str = get_filename(map_flai) + call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & + 'map_lai_sai_file', len_trim(str), trim(str)), subname) + end if str = get_filename(map_furbtopo) call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & @@ -272,13 +272,11 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & 'map_topography_stats_file', len_trim(str), trim(str)), subname) - str = get_filename(map_fvic) - call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & - 'map_vic_file', len_trim(str), trim(str)), subname) - - str = get_filename(map_fch4) - call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & - 'map_ch4_params_file', len_trim(str), trim(str)), subname) + if ( outnc_vic )then + str = get_filename(map_fvic) + call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & + 'map_vic_file', len_trim(str), trim(str)), subname) + end if ! ---------------------------------------------------------------------- ! Define variables @@ -448,30 +446,23 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) call ncd_def_spatial_var(ncid=ncid, varname='STD_ELEV', xtype=xtype, & long_name='standard deviation of elevation', units='m') - call ncd_def_spatial_var(ncid=ncid, varname='binfl', xtype=xtype, & - long_name='VIC b parameter for the Variable Infiltration Capacity Curve', units='unitless') + if ( outnc_vic )then + call ncd_def_spatial_var(ncid=ncid, varname='binfl', xtype=xtype, & + long_name='VIC b parameter for the Variable Infiltration Capacity Curve', units='unitless') - call ncd_def_spatial_var(ncid=ncid, varname='Ws', xtype=xtype, & - long_name='VIC Ws parameter for the ARNO curve', units='unitless') + call ncd_def_spatial_var(ncid=ncid, varname='Ws', xtype=xtype, & + long_name='VIC Ws parameter for the ARNO curve', units='unitless') - call ncd_def_spatial_var(ncid=ncid, varname='Dsmax', xtype=xtype, & - long_name='VIC Dsmax parameter for the ARNO curve', units='mm/day') + call ncd_def_spatial_var(ncid=ncid, varname='Dsmax', xtype=xtype, & + long_name='VIC Dsmax parameter for the ARNO curve', units='mm/day') - call ncd_def_spatial_var(ncid=ncid, varname='Ds', xtype=xtype, & - long_name='VIC Ds parameter for the ARNO curve', units='unitless') + call ncd_def_spatial_var(ncid=ncid, varname='Ds', xtype=xtype, & + long_name='VIC Ds parameter for the ARNO curve', units='unitless') + end if call ncd_def_spatial_var(ncid=ncid, varname='LAKEDEPTH', xtype=xtype, & long_name='lake depth', units='m') - call ncd_def_spatial_var(ncid=ncid, varname='F0', xtype=xtype, & - long_name='maximum gridcell fractional inundated area', units='unitless') - - call ncd_def_spatial_var(ncid=ncid, varname='P3', xtype=xtype, & - long_name='coefficient for qflx_surf_lag for finundated', units='s/mm') - - call ncd_def_spatial_var(ncid=ncid, varname='ZWT0', xtype=xtype, & - long_name='decay factor for finundated', units='m') - call ncd_def_spatial_var(ncid=ncid, varname='PCT_WETLAND', xtype=xtype, & long_name='percent wetland', units='unitless') @@ -491,20 +482,6 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) lev1name='nglcec', & long_name='percent glacier for each glacier elevation class (% of landunit)', units='unitless') - call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_MEC_GIC', xtype=xtype, & - lev1name='nglcec', & - long_name='percent smaller glaciers and ice caps for each glacier elevation class (% of landunit)', units='unitless') - - call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_MEC_ICESHEET', xtype=xtype, & - lev1name='nglcec', & - long_name='percent ice sheet for each glacier elevation class (% of landunit)', units='unitless') - - call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_GIC', xtype=xtype, & - long_name='percent ice caps/glaciers (% of landunit)', units='unitless') - - call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_ICESHEET', xtype=xtype, & - long_name='percent ice sheet (% of landunit)', units='unitless') - call ncd_def_spatial_var(ncid=ncid, varname='TOPO_GLC_MEC', xtype=xtype, & lev1name='nglcec', & long_name='mean elevation on glacier elevation classes', units='m') diff --git a/tools/mksurfdata_map/src/mkglcmecMod.F90 b/tools/mksurfdata_map/src/mkglcmecMod.F90 index 9e5a1cc2a0..8ee41dd5ba 100644 --- a/tools/mksurfdata_map/src/mkglcmecMod.F90 +++ b/tools/mksurfdata_map/src/mkglcmecMod.F90 @@ -125,9 +125,7 @@ end subroutine mkglcmecInit ! !INTERFACE: subroutine mkglcmec(ldomain, mapfname, & datfname_fglacier, ndiag, & - pctglcmec_o, topoglcmec_o, & - pctglcmec_gic_o, pctglcmec_icesheet_o, & - pctglc_gic_o, pctglc_icesheet_o) + pctglcmec_o, topoglcmec_o ) ! ! !DESCRIPTION: ! make percent glacier on multiple elevation classes, mean elevation for each @@ -160,10 +158,6 @@ subroutine mkglcmec(ldomain, mapfname, & integer , intent(in) :: ndiag ! unit number for diag out real(r8) , intent(out):: pctglcmec_o (:,:) ! % for each elevation class on output glacier grid (% of landunit) real(r8) , intent(out):: topoglcmec_o(:,:) ! mean elevation for each elevation classs on output glacier grid - real(r8) , intent(out):: pctglcmec_gic_o(:,:) ! % glc gic on output grid, by elevation class (% of landunit) - real(r8) , intent(out):: pctglcmec_icesheet_o(:,:) ! % glc ice sheet on output grid, by elevation class (% of landunit) - real(r8) , intent(out):: pctglc_gic_o(:) ! % glc gic on output grid, summed across elevation classes (% of landunit) - real(r8) , intent(out):: pctglc_icesheet_o(:) ! % glc ice sheet on output grid, summed across elevation classes (% of landunit) ! ! !CALLED FROM: ! subroutine mksrfdat in module mksrfdatMod @@ -209,10 +203,6 @@ subroutine mkglcmec(ldomain, mapfname, & pctglcmec_o(:,:) = 0. topoglcmec_o(:,:) = 0. - pctglcmec_gic_o(:,:) = 0. - pctglcmec_icesheet_o(:,:) = 0. - pctglc_gic_o(:) = 0. - pctglc_icesheet_o(:) = 0. ! Set number of output points @@ -314,8 +304,6 @@ subroutine mkglcmec(ldomain, mapfname, & if (frac > 0) then pctglc_i = pctglc_gic_i(ni) + pctglc_icesheet_i(ni) pctglcmec_o(no,m) = pctglcmec_o(no,m) + wt*pctglc_i / frac - pctglcmec_gic_o(no,m) = pctglcmec_gic_o(no,m) + wt*pctglc_gic_i(ni) / frac - pctglcmec_icesheet_o(no,m) = pctglcmec_icesheet_o(no,m) + wt*pctglc_icesheet_i(ni) / frac ! note that, by weighting the following by pctglc_i, we are getting something ! like the average topographic height over glaciated areas - NOT the average @@ -371,21 +359,14 @@ subroutine mkglcmec(ldomain, mapfname, & if (pctglc_tot_o(no) > 0._r8) then pctglcmec_o(no,:) = pctglcmec_o(no,:) / pctglc_tot_o(no) * 100._r8 - pctglcmec_gic_o(no,:) = pctglcmec_gic_o(no,:) / pctglc_tot_o(no) * 100._r8 - pctglcmec_icesheet_o(no,:) = pctglcmec_icesheet_o(no,:) / pctglc_tot_o(no) * 100._r8 else ! Division of landunit is ambiguous. Apply the rule that all area is assigned to ! the lowest elevation class, and all GIC. pctglcmec_o(no,1) = 100._r8 - pctglcmec_gic_o(no,1) = 100._r8 end if end do - ! Set pctglc_gic_o to sum of pctglcmec_gic_o across elevation classes, and similarly for pctglc_icesheet_o - pctglc_gic_o = sum(pctglcmec_gic_o, dim=2) - pctglc_icesheet_o = sum(pctglcmec_icesheet_o, dim=2) - ! -------------------------------------------------------------------- ! Perform various sanity checks ! -------------------------------------------------------------------- @@ -401,30 +382,6 @@ subroutine mkglcmec(ldomain, mapfname, & end if end do - ! Confirm that GIC + ICESHEET = 100% - do no = 1,ns_o - if (abs((pctglc_gic_o(no) + pctglc_icesheet_o(no)) - 100._r8) > eps) then - write(6,*)'GIC + ICESHEET differs from 100% at no,pctglc_gic,pctglc_icesheet,lon,lat=', & - no,pctglc_gic_o(no),pctglc_icesheet_o(no),& - tgridmap%xc_dst(no),tgridmap%yc_dst(no) - errors = .true. - end if - end do - - ! Check that GIC + ICESHEET = total glacier at each elevation class - do m = 1, nglcec - do no = 1,ns_o - if (abs((pctglcmec_gic_o(no,m) + pctglcmec_icesheet_o(no,m)) - & - pctglcmec_o(no,m)) > eps) then - write(6,*)'GIC + ICESHEET differs from total GLC ' - write(6,*)'at no,m,pctglcmec,pctglcmec_gic,pctglcmec_icesheet = ' - write(6,*) no,m,pctglcmec_o(no,m),pctglcmec_gic_o(no,m),pctglcmec_icesheet_o(no,m) - errors = .true. - end if - end do - end do - - ! Error check: are all elevations within elevation class range do no = 1,ns_o do m = 1,nglcec diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index 5089fabf7d..173807dd9c 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -32,7 +32,7 @@ program mksurfdat use mkurbanparMod , only : mkurbanInit, mkurban, mkurbanpar, numurbl use mkutilsMod , only : normalize_classes_by_gcell use mkfileMod , only : mkfile - use mkvarpar , only : nlevsoi, elev_thresh + use mkvarpar , only : nlevsoi, elev_thresh, numstdpft use mkvarctl use nanMod , only : nan, bigint use mkncdio , only : check_ret, ncd_put_time_slice @@ -44,7 +44,6 @@ program mksurfdat use mkagfirepkmonthMod , only : mkagfirepkmon use mktopostatsMod , only : mktopostats use mkVICparamsMod , only : mkVICparams - use mkCH4inversionMod , only : mkCH4inversion ! ! !ARGUMENTS: implicit none @@ -98,12 +97,8 @@ program mksurfdat real(r8), pointer :: harvest1D(:) ! harvest 1D data: normalized harvesting real(r8), pointer :: harvest2D(:,:) ! harvest 1D data: normalized harvesting real(r8), allocatable :: pctgla(:) ! percent of grid cell that is glacier - real(r8), allocatable :: pctglc_gic(:) ! percent of grid cell that is gic (% of glc landunit) - real(r8), allocatable :: pctglc_icesheet(:) ! percent of grid cell that is ice sheet (% of glc landunit) real(r8), allocatable :: pctglcmec(:,:) ! glacier_mec pct coverage in each class (% of landunit) real(r8), allocatable :: topoglcmec(:,:) ! glacier_mec sfc elevation in each gridcell and class - real(r8), allocatable :: pctglcmec_gic(:,:) ! GIC pct coverage in each class (% of landunit) - real(r8), allocatable :: pctglcmec_icesheet(:,:) ! icesheet pct coverage in each class (% of landunit) real(r8), allocatable :: elevclass(:) ! glacier_mec elevation classes integer, allocatable :: glacier_region(:) ! glacier region ID real(r8), allocatable :: pctlak(:) ! percent of grid cell that is lake @@ -135,9 +130,6 @@ program mksurfdat real(r8), allocatable :: vic_dsmax(:) ! VIC Dsmax parameter (mm/day) real(r8), allocatable :: vic_ds(:) ! VIC Ds parameter (unitless) real(r8), allocatable :: lakedepth(:) ! lake depth (m) - real(r8), allocatable :: f0(:) ! max fractional inundated area (unitless) - real(r8), allocatable :: p3(:) ! coefficient for qflx_surf_lag for finundated (s/mm) - real(r8), allocatable :: zwt0(:) ! decay factor for finundated (m) real(r8) :: std_elev = -999.99_r8 ! Standard deviation of elevation (m) to use for entire grid @@ -213,6 +205,7 @@ program mksurfdat outnc_large_files, & outnc_double, & outnc_dims, & + outnc_vic, & fsurdat, & fdyndat, & fsurlog, & @@ -282,6 +275,7 @@ program mksurfdat ! mksrf_gridtype ---- Type of grid (default is 'global') ! outnc_double ------ If output should be in double precision ! outnc_large_files - If output should be in NetCDF large file format + ! outnc_vic --------- Output fields needed for VIC ! nglcec ------------ If you want to change the number of Glacier elevation classes ! gitdescribe ------- Description of this version from git ! ====================================== @@ -308,6 +302,7 @@ program mksurfdat mksrf_gridtype = 'global' outnc_large_files = .false. outnc_double = .true. + outnc_vic = .false. all_urban = .false. no_inlandwet = .true. @@ -354,6 +349,9 @@ program mksurfdat if ( outnc_double )then write(6,*)'Output ALL data in file as 64-bit' end if + if ( outnc_vic )then + write(6,*)'Output VIC fields' + end if if ( all_urban )then write(6,*) 'Output ALL data in file as 100% urban' end if @@ -446,9 +444,6 @@ program mksurfdat vic_dsmax(ns_o) , & vic_ds(ns_o) , & lakedepth(ns_o) , & - f0(ns_o) , & - p3(ns_o) , & - zwt0(ns_o) , & glacier_region(ns_o) ) landfrac_pft(:) = spval pctlnd_pft(:) = spval @@ -474,9 +469,6 @@ program mksurfdat vic_dsmax(:) = spval vic_ds(:) = spval lakedepth(:) = spval - f0(:) = spval - p3(:) = spval - zwt0(:) = spval glacier_region(:) = -999 ! ---------------------------------------------------------------------- @@ -661,17 +653,15 @@ program mksurfdat ndiag=ndiag, topo_stddev_o=topo_stddev, slope_o=slope, std_elev=std_elev) ! Make VIC parameters [binfl, ws, dsmax, ds] from [fvic] - call mkVICparams (ldomain, mapfname=map_fvic, datfname=mksrf_fvic, ndiag=ndiag, & - binfl_o=vic_binfl, ws_o=vic_ws, dsmax_o=vic_dsmax, ds_o=vic_ds) + if ( outnc_vic )then + call mkVICparams (ldomain, mapfname=map_fvic, datfname=mksrf_fvic, ndiag=ndiag, & + binfl_o=vic_binfl, ws_o=vic_ws, dsmax_o=vic_dsmax, ds_o=vic_ds) + end if ! Make lake depth [lakedepth] from [flakwat] call mklakparams (ldomain, mapfname=map_flakwat, datfname=mksrf_flakwat, ndiag=ndiag, & lakedepth_o=lakedepth) - ! Make inversion-derived CH4 parameters [f0, p3, zwt0] from [fch4] - call mkCH4inversion (ldomain, mapfname=map_fch4, datfname=mksrf_fch4, ndiag=ndiag, & - f0_o=f0, p3_o=p3, zwt0_o=zwt0) - ! Make organic matter density [organic] [forganic] allocate (organic(ns_o,nlevsoi)) organic(:,:) = spval @@ -704,16 +694,20 @@ program mksurfdat do n = 1,ns_o - ! Assume wetland and/or lake when dataset landmask implies ocean + ! Assume wetland, glacier and/or lake when dataset landmask implies ocean ! (assume medium soil color (15) and loamy texture). ! Also set pftdata_mask here if (pctlnd_pft(n) < 1.e-6_r8) then pftdata_mask(n) = 0 soicol(n) = 15 - pctwet(n) = 100._r8 - pctlak(n) + if (pctgla(n) < 1.e-6_r8) then + pctwet(n) = 100._r8 - pctlak(n) + pctgla(n) = 0._r8 + else + pctwet(n) = 100._r8 - pctgla(n) - pctlak(n) + end if pcturb(n) = 0._r8 - pctgla(n) = 0._r8 call pctnatpft(n)%set_pct_l2g(0._r8) call pctcft(n)%set_pct_l2g(0._r8) pctsand(n,:) = 43._r8 @@ -786,24 +780,14 @@ program mksurfdat ! This call needs to occur after pctgla has been adjusted for the final time allocate (pctglcmec(ns_o,nglcec), & - topoglcmec(ns_o,nglcec), & - pctglcmec_gic(ns_o,nglcec), & - pctglcmec_icesheet(ns_o,nglcec)) - allocate (pctglc_gic(ns_o)) - allocate (pctglc_icesheet(ns_o)) + topoglcmec(ns_o,nglcec) ) pctglcmec(:,:) = spval topoglcmec(:,:) = spval - pctglcmec_gic(:,:) = spval - pctglcmec_icesheet(:,:) = spval - pctglc_gic(:) = spval - pctglc_icesheet(:) = spval call mkglcmec (ldomain, mapfname=map_fglacier, & datfname_fglacier=mksrf_fglacier, ndiag=ndiag, & - pctglcmec_o=pctglcmec, topoglcmec_o=topoglcmec, & - pctglcmec_gic_o=pctglcmec_gic, pctglcmec_icesheet_o=pctglcmec_icesheet, & - pctglc_gic_o=pctglc_gic, pctglc_icesheet_o=pctglc_icesheet) + pctglcmec_o=pctglcmec, topoglcmec_o=topoglcmec ) ! Determine fractional land from pft dataset @@ -885,18 +869,6 @@ program mksurfdat call check_ret(nf_inq_varid(ncid, 'TOPO_GLC_MEC', varid), subname) call check_ret(nf_put_var_double(ncid, varid, topoglcmec), subname) - call check_ret(nf_inq_varid(ncid, 'PCT_GLC_MEC_GIC', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, pctglcmec_gic), subname) - - call check_ret(nf_inq_varid(ncid, 'PCT_GLC_MEC_ICESHEET', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, pctglcmec_icesheet), subname) - - call check_ret(nf_inq_varid(ncid, 'PCT_GLC_GIC', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, pctglc_gic), subname) - - call check_ret(nf_inq_varid(ncid, 'PCT_GLC_ICESHEET', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, pctglc_icesheet), subname) - call check_ret(nf_inq_varid(ncid, 'PCT_URBAN', varid), subname) call check_ret(nf_put_var_double(ncid, varid, urbn_classes_g), subname) @@ -950,30 +922,23 @@ program mksurfdat call check_ret(nf_inq_varid(ncid, 'STD_ELEV', varid), subname) call check_ret(nf_put_var_double(ncid, varid, topo_stddev), subname) - call check_ret(nf_inq_varid(ncid, 'binfl', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, vic_binfl), subname) + if ( outnc_vic )then + call check_ret(nf_inq_varid(ncid, 'binfl', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, vic_binfl), subname) - call check_ret(nf_inq_varid(ncid, 'Ws', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, vic_ws), subname) + call check_ret(nf_inq_varid(ncid, 'Ws', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, vic_ws), subname) - call check_ret(nf_inq_varid(ncid, 'Dsmax', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, vic_dsmax), subname) + call check_ret(nf_inq_varid(ncid, 'Dsmax', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, vic_dsmax), subname) - call check_ret(nf_inq_varid(ncid, 'Ds', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, vic_ds), subname) + call check_ret(nf_inq_varid(ncid, 'Ds', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, vic_ds), subname) + end if call check_ret(nf_inq_varid(ncid, 'LAKEDEPTH', varid), subname) call check_ret(nf_put_var_double(ncid, varid, lakedepth), subname) - call check_ret(nf_inq_varid(ncid, 'F0', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, f0), subname) - - call check_ret(nf_inq_varid(ncid, 'P3', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, p3), subname) - - call check_ret(nf_inq_varid(ncid, 'ZWT0', varid), subname) - call check_ret(nf_put_var_double(ncid, varid, zwt0), subname) - call check_ret(nf_inq_varid(ncid, 'EF1_BTR', varid), subname) call check_ret(nf_put_var_double(ncid, varid, ef1_btr), subname) @@ -1019,7 +984,7 @@ program mksurfdat write(6,*)'calling mklai' call mklai(ldomain, mapfname=map_flai, datfname=mksrf_flai, & - ndiag=ndiag, ncido=ncid ) + ndiag=ndiag, ncido=ncid ) ! Close surface dataset @@ -1040,7 +1005,6 @@ program mksurfdat deallocate ( organic ) deallocate ( ef1_btr, ef1_fet, ef1_fdt, ef1_shr, ef1_grs, ef1_crp ) deallocate ( pctglcmec, topoglcmec) - deallocate ( pctglc_gic, pctglc_icesheet) deallocate ( elevclass ) deallocate ( fmax ) deallocate ( pctsand, pctclay ) @@ -1050,7 +1014,6 @@ program mksurfdat deallocate ( topo_stddev, slope ) deallocate ( vic_binfl, vic_ws, vic_dsmax, vic_ds ) deallocate ( lakedepth ) - deallocate ( f0, p3, zwt0 ) deallocate ( glacier_region ) call harvdata%clean() diff --git a/tools/mksurfdata_map/src/mkvarctl.F90 b/tools/mksurfdata_map/src/mkvarctl.F90 index 26ee85f6fa..44585b7fc0 100644 --- a/tools/mksurfdata_map/src/mkvarctl.F90 +++ b/tools/mksurfdata_map/src/mkvarctl.F90 @@ -22,6 +22,7 @@ module mkvarctl logical, public :: outnc_double ! output ALL data in files as 64-bit integer, public :: outnc_dims = 2 ! only applicable to lat/lon grids logical, public :: outnc_1d ! true => output file is 1d + logical, public :: outnc_vic ! true => output file is 1d character(len= 32), public :: mksrf_gridnm = ' ' ! name of grid to use on output file character(len=256), public :: mksrf_fgrid = ' ' ! land grid file name to use From 93559f38b9435372d9faf4314631e693e58b940b Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 3 Jul 2019 11:40:43 -0600 Subject: [PATCH 0322/1973] saving CMake before incorporating CTSM --- lilac/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 4179a4b99a..07e67320e6 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -43,7 +43,7 @@ message(STATUS "==============================================================") #add_executable("lilac.exe" ../lilac/*.F90) -add_executable(${PROJECT_NAME} ../lilac/demo_driver.F90 +add_executable(${PROJECT_NAME}.exe ../lilac/demo_driver.F90 ../lilac/lilac_mod.F90 ../lilac/atmos_cap.F90 ../lilac/lilac_utils.F90 ../lilac/lnd_cap.F90 ../lilac/cpl_mod.F90) From 73c1bae5b7c2c335347526afad4663ef954c0c43 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Jul 2019 14:28:13 -0600 Subject: [PATCH 0323/1973] Updates from release-clm5.0.20-release-clm5.0.21 --- Externals_CLM.cfg | 2 +- bld/CLMBuildNamelist.pm | 133 ++-- bld/listDefaultNamelist.pl | 41 +- bld/namelist_files/namelist_defaults_ctsm.xml | 668 +++++++++++------- .../namelist_defaults_ctsm_tools.xml | 42 +- .../namelist_defaults_overall.xml | 4 +- .../namelist_definition_ctsm.xml | 2 +- .../1850-2100_SSP1-1.9_transient.xml | 17 + .../1850-2100_SSP1-2.6_transient.xml | 17 + .../1850-2100_SSP2-4.5_transient.xml | 17 + .../1850-2100_SSP3-7.0_transient.xml | 17 + .../1850-2100_SSP4-3.4_transient.xml | 17 + .../1850-2100_SSP4-6.0_transient.xml | 17 + .../1850-2100_SSP5-3.4_transient.xml | 17 + .../1850-2100_SSP5-8.5_transient.xml | 17 + .../use_cases/1850-2100_rcp2.6_transient.xml | 48 -- .../use_cases/1850-2100_rcp4.5_transient.xml | 47 -- .../use_cases/1850-2100_rcp6_transient.xml | 48 -- .../use_cases/1850-2100_rcp8.5_transient.xml | 47 -- .../use_cases/2000-2100_rcp8.5_transient.xml | 46 -- bld/unit_testers/build-namelist_test.pl | 62 +- cime_config/buildlib | 1 + 22 files changed, 713 insertions(+), 614 deletions(-) create mode 100644 bld/namelist_files/use_cases/1850-2100_SSP1-1.9_transient.xml create mode 100644 bld/namelist_files/use_cases/1850-2100_SSP1-2.6_transient.xml create mode 100644 bld/namelist_files/use_cases/1850-2100_SSP2-4.5_transient.xml create mode 100644 bld/namelist_files/use_cases/1850-2100_SSP3-7.0_transient.xml create mode 100644 bld/namelist_files/use_cases/1850-2100_SSP4-3.4_transient.xml create mode 100644 bld/namelist_files/use_cases/1850-2100_SSP4-6.0_transient.xml create mode 100644 bld/namelist_files/use_cases/1850-2100_SSP5-3.4_transient.xml create mode 100644 bld/namelist_files/use_cases/1850-2100_SSP5-8.5_transient.xml delete mode 100644 bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml delete mode 100644 bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml delete mode 100644 bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml delete mode 100644 bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml delete mode 100644 bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 84b7d5ec33..c51a18864e 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NCAR/fates-release -tag = fates_s1.8.1_a3.0.0_rev2 +tag = fates_s1.21.0_a7.0.0_br_rev2 required = True [PTCLM] diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 3b25089419..4c53dc3ad3 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -202,9 +202,10 @@ OPTIONS -[no-]note Add note to output namelist [do NOT add note] about the arguments to build-namelist. -output_reals Output real parameters to the given output file. - -rcp "value" Representative concentration pathway (rcp) to use for + -ssp_rcp "value" Shared Socioeconomic Pathway (SSP) and + Representative Concentration Pathway (RCP) combination to use for future scenarios. - "-rcp list" to list valid rcp settings. + "-ssp_rcp list" to list valid ssp_rcp settings. -s Turns on silent mode - only fatal messages issued. -test Enable checking that input datasets exist on local filesystem. -use_case "case" Specify a use case which will provide default values. @@ -257,7 +258,7 @@ sub process_commandline { lnd_tuning_mode => "default", lnd_frac => undef, dir => "$cwd", - rcp => "default", + ssp_rcp => "default", sim_year => "default", structure => undef, clm_accelerated_spinup=> "default", @@ -310,7 +311,7 @@ sub process_commandline { "mask=s" => \$opts{'mask'}, "namelist=s" => \$opts{'namelist'}, "res=s" => \$opts{'res'}, - "rcp=s" => \$opts{'rcp'}, + "ssp_rcp=s" => \$opts{'ssp_rcp'}, "s|silent" => \$opts{'silent'}, "sim_year=s" => \$opts{'sim_year'}, "structure=s" => \$opts{'structure'}, @@ -622,7 +623,7 @@ sub process_namelist_commandline_options { # # First get the command-line specified overall values or their defaults # Obtain default values for the following build-namelist input arguments - # : res, mask, rcp, sim_year, sim_year_range, and clm_accelerated_spinup. + # : res, mask, ssp_rcp, sim_year, sim_year_range, and clm_accelerated_spinup. my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; @@ -636,7 +637,7 @@ sub process_namelist_commandline_options { setup_cmdl_crop($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_maxpft($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_glc_nec($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_rcp($opts, $nl_flags, $definition, $defaults, $nl); + setup_cmdl_ssp_rcp($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_simulation_year($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_dynamic_vegetation($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_fates_mode($opts, $nl_flags, $definition, $defaults, $nl); @@ -767,7 +768,7 @@ sub setup_cmdl_fates_mode { } else { # dis-allow fates specific namelist items with non-fates runs my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", - "use_fates_inventory_init", "fates_inventory_ctrl_filename","use_fates_logging" ); + "use_fates_inventory_init", "fates_inventory_ctrl_filename","use_fates_logging","fates_parteh_mode" ); foreach my $var ( @list ) { if ( defined($nl->get_value($var)) ) { $log->fatal_error("$var is being set, but can ONLY be set when -bgc fates option is used.\n"); @@ -1069,26 +1070,26 @@ sub setup_cmdl_glc_nec { #------------------------------------------------------------------------------- -sub setup_cmdl_rcp { - # representative concentration pathway +sub setup_cmdl_ssp_rcp { + # shared socioeconmic pathway and representative concentration pathway combination my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; my $val; - my $var = "rcp"; + my $var = "ssp_rcp"; if ( $opts->{$var} ne "default" ) { $val = $opts->{$var}; } else { - $val = $defaults->get_value($var); + $val = remove_leading_and_trailing_quotes( $defaults->get_value($var) ); } - $nl_flags->{'rcp'} = $val; - $opts->{'rcp'} = $nl_flags->{'rcp'}; + $nl_flags->{'ssp_rcp'} = $val; + $opts->{'ssp_rcp'} = $nl_flags->{'ssp_rcp'}; my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { + $nl->set_variable_value($group, $var, quote_string($val) ); + if ( ! $definition->is_valid_value( $var, $val, 'noquotes'=>1 ) ) { my @valid_values = $definition->get_valid_values( $var ); $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); } - $log->verbose_message("CLM future scenario representative concentration is $nl_flags->{'rcp'}"); + $log->verbose_message("CLM future scenario SSP-RCP combination is $nl_flags->{'ssp_rcp'}"); } #------------------------------------------------------------------------------- @@ -1114,21 +1115,23 @@ sub setup_cmdl_spinup { $log->fatal_error("$var has an invalid value ($val). Valid values are: @valid_values"); } $log->verbose_message("CLM accelerated spinup mode is $val"); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, - $defaults, $nl, "spinup_state", clm_accelerated_spinup=>$nl_flags->{$var}, - use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'} ); - if ( $nl->get_value("spinup_state") ne 0 ) { - $nl_flags->{'bgc_spinup'} = "on"; - if ( $nl_flags->{'bgc_mode'} eq "sp" ) { - $log->fatal_error("spinup_state is accelerated (=1 or 2) which is for a BGC mode of CN or BGC," . - " but the BGC mode is Satellite Phenology, change one or the other"); - } - if ( $nl_flags->{'clm_accelerated_spinup'} eq "off" ) { - $log->fatal_error("spinup_state is accelerated, but clm_accelerated_spinup is off, change one or the other"); - } - } else { - $nl_flags->{'bgc_spinup'} = "off"; - $val = $defaults->get_value($var); + if ( &value_is_true($nl_flags->{'use_cn'}) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, + $defaults, $nl, "spinup_state", clm_accelerated_spinup=>$nl_flags->{$var}, + use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'} ); + if ( $nl->get_value("spinup_state") ne 0 ) { + $nl_flags->{'bgc_spinup'} = "on"; + if ( $nl_flags->{'bgc_mode'} eq "sp" ) { + $log->fatal_error("spinup_state is accelerated (=1 or 2) which is for a BGC mode of CN or BGC," . + " but the BGC mode is Satellite Phenology, change one or the other"); + } + if ( $nl_flags->{'clm_accelerated_spinup'} eq "off" ) { + $log->fatal_error("spinup_state is accelerated, but clm_accelerated_spinup is off, change one or the other"); + } + } else { + $nl_flags->{'bgc_spinup'} = "off"; + $val = $defaults->get_value($var); + } } $nl_flags->{$var} = $val; my $group = $definition->get_group_name($var); @@ -1203,17 +1206,21 @@ sub setup_cmdl_run_type { my $val; my $var = "clm_start_type"; + my $ic_date = $nl->get_value('start_ymd'); + my $st_year = int( $ic_date / 10000); if (defined $opts->{$var}) { if ($opts->{$var} eq "default" ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'} ); + 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'}, + 'sim_year'=>$st_year ); } else { my $group = $definition->get_group_name($var); $nl->set_variable_value($group, $var, quote_string( $opts->{$var} ) ); } } else { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'} ); + 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'}, + 'sim_year'=>$st_year ); } $nl_flags->{'clm_start_type'} = $nl->get_value($var); } @@ -1374,7 +1381,7 @@ sub process_namelist_commandline_clm_usr_name { my %settings; $settings{'mask'} = $nl_flags->{'mask'}; $settings{'sim_year'} = $nl_flags->{'sim_year'}; - $settings{'rcp'} = $nl_flags->{'rcp'}; + $settings{'ssp_rcp'} = $nl_flags->{'ssp_rcp'}; $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; $settings{'clm_accelerated_spinup'} = $nl_flags->{'clm_accelerated_spinup'}; $settings{'clm_usr_name'} = $opts->{'clm_usr_name'}; @@ -1421,7 +1428,7 @@ sub process_namelist_commandline_use_case { my %settings; $settings{'res'} = $nl_flags->{'res'}; - $settings{'rcp'} = $nl_flags->{'rcp'}; + $settings{'ssp_rcp'} = $nl_flags->{'ssp_rcp'}; $settings{'mask'} = $nl_flags->{'mask'}; $settings{'sim_year'} = $nl_flags->{'sim_year'}; $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; @@ -1817,7 +1824,8 @@ sub setup_logic_irrigate { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'irrigate', - 'use_crop'=>$nl_flags->{'use_crop'}, 'use_cndv'=>$nl_flags->{'use_cndv'} ); + 'use_crop'=>$nl_flags->{'use_crop'}, 'use_cndv'=>$nl_flags->{'use_cndv'}, + 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, ); if ( &value_is_true($nl->get_value('irrigate') ) ) { $nl_flags->{'irrigate'} = ".true." } else { @@ -2113,7 +2121,7 @@ sub setup_logic_demand { $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; $settings{'mask'} = $nl_flags->{'mask'}; $settings{'crop'} = $nl_flags->{'crop'}; - $settings{'rcp'} = $nl_flags->{'rcp'}; + $settings{'ssp_rcp'} = $nl_flags->{'ssp_rcp'}; $settings{'glc_nec'} = $nl_flags->{'glc_nec'}; # necessary for demand to be set correctly (flanduse_timeseries requires # use_crop, maybe other options require other flags?)! @@ -2625,7 +2633,7 @@ sub setup_logic_supplemental_nitrogen { } if ( $suplnitro =~ /ALL/i ) { - if ( $nl_flags->{'bgc_spinup'} ne "off" ) { + if ( $nl_flags->{'bgc_spinup'} ne "on" ) { $log->warning("There is no need to use a bgc_spinup mode when supplemental Nitrogen is on for all PFT's, as these modes spinup Nitrogen" ); } } @@ -2783,13 +2791,11 @@ sub setup_logic_methane { # Get resolution to read streams file for # my $finundation_method = remove_leading_and_trailing_quotes($nl->get_value('finundation_method' )); - if ( $finundation_method eq "TWS_inversion" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'finundation_res', - 'finundation_method'=>$finundation_method ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_ch4finundated', - 'finundation_method'=>$finundation_method, - 'finundation_res'=>$nl->get_value('finundation_res') ); - } + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'finundation_res', + 'finundation_method'=>$finundation_method ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_ch4finundated', + 'finundation_method'=>$finundation_method, + 'finundation_res'=>$nl->get_value('finundation_res') ); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_aereoxid_prog', 'use_cn'=>$nl_flags->{'use_cn'}, 'use_fates'=>$nl_flags->{'use_fates'} ); # @@ -3024,7 +3030,8 @@ sub setup_logic_c_isotope { my $use_c14_bombspike = $nl->get_value('use_c14_bombspike'); if ( defined($use_c14_bombspike) && &value_is_true($use_c14_bombspike) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'atm_c14_filename', - 'use_c14'=>$use_c14, 'use_cn'=>$nl_flags->{'use_cn'}, 'use_c14_bombspike'=>$nl->get_value('use_c14_bombspike') ); + 'use_c14'=>$use_c14, 'use_cn'=>$nl_flags->{'use_cn'}, 'use_c14_bombspike'=>$nl->get_value('use_c14_bombspike'), + 'ssp_rcp'=>$nl_flags->{'ssp_rcp'} ); } } else { if ( defined($nl->get_value('use_c14_bombspike')) || @@ -3043,7 +3050,8 @@ sub setup_logic_c_isotope { my $use_c13_timeseries = $nl->get_value('use_c13_timeseries'); if ( defined($use_c13_timeseries) && &value_is_true($use_c13_timeseries) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'atm_c13_filename', - 'use_c13'=>$use_c13, 'use_cn'=>$nl_flags->{'use_cn'}, 'use_c13_timeseries'=>$nl->get_value('use_c13_timeseries') ); + 'use_c13'=>$use_c13, 'use_cn'=>$nl_flags->{'use_cn'}, 'use_c13_timeseries'=>$nl->get_value('use_c13_timeseries'), + 'ssp_rcp'=>$nl_flags->{'ssp_rcp'} ); } } else { if ( defined($nl->get_value('use_c13_timeseries')) || @@ -3104,9 +3112,13 @@ sub setup_logic_nitrogen_deposition { 'sim_year_range'=>$nl_flags->{'sim_year_range'}); } add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_ndep', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, 'rcp'=>$nl_flags->{'rcp'}, - 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, - 'hgrid'=>"1.9x2.5" ); + 'use_cn'=>$nl_flags->{'use_cn'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, + 'hgrid'=>"0.9x1.25", 'ssp_rcp'=>$nl_flags->{'ssp_rcp'}, 'nofail'=>1 ); + if ( ! defined($nl->get_value('stream_fldfilename_ndep') ) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_ndep', 'phys'=>$nl_flags->{'phys'}, + 'use_cn'=>$nl_flags->{'use_cn'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, + 'hgrid'=>"1.9x2.5", 'ssp_rcp'=>$nl_flags->{'ssp_rcp'} ); + } } else { # If bgc is NOT CN/CNDV then make sure none of the ndep settings are set! if ( defined($nl->get_value('stream_year_first_ndep')) || @@ -3215,7 +3227,7 @@ sub setup_logic_popd_streams { 'sim_year_range'=>$nl_flags->{'sim_year_range'}, 'cnfireson'=>$nl_flags->{'cnfireson'}); } add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_popdens', 'phys'=>$nl_flags->{'phys'}, - 'cnfireson'=>$nl_flags->{'cnfireson'}, 'hgrid'=>"0.5x0.5" ); + 'cnfireson'=>$nl_flags->{'cnfireson'}, 'hgrid'=>"0.5x0.5", 'ssp_rcp'=>$nl_flags->{'ssp_rcp'} ); } else { # If bgc is NOT CN/CNDV or fire_method==nofire then make sure none of the popdens settings are set if ( defined($nl->get_value('stream_year_first_popdens')) || @@ -3642,7 +3654,7 @@ sub setup_logic_fates { if (&value_is_true( $nl_flags->{'use_fates'}) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'}); my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", - "use_fates_inventory_init", "use_fates_logging" ); + "use_fates_inventory_init", "use_fates_logging","fates_parteh_mode" ); foreach my $var ( @list ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'} ); } @@ -3650,10 +3662,11 @@ sub setup_logic_fates { if ( defined($nl->get_value($var)) ) { if ( &value_is_true($nl->get_value($var)) ) { $var = "fates_inventory_ctrl_filename"; + my $fname = substr $nl->get_value($var), 1, -1; # ignore first and last positions of string because those are quote characters if ( ! defined($nl->get_value($var)) ) { $log->fatal_error("$var is required when use_fates_inventory_init is set" ); - } elsif ( ! -f "$nl->get_value($var)" ) { - $log->fatal_error("$var does NOT point to a valid filename" ); + } elsif ( ! -f "$fname" ) { + $log->fatal_error("$fname does NOT point to a valid filename" ); } } } @@ -4018,10 +4031,10 @@ sub check_use_case_name { my $diestring = "bad use_case name $use_case, follow the conventions " . "in namelist_files/use_cases/README\n"; my $desc = "[a-zA-Z0-9]*"; - my $rcp = "rcp[0-9\.]+"; - if ( $use_case =~ /^[0-9]+-[0-9]+([a-zA-Z0-9_\.]*)_transient$/ ) { + my $ssp_rcp = "SSP[0-9]-[0-9\.]+"; + if ( $use_case =~ /^[0-9]+-[0-9]+([a-zA-Z0-9_\.-]*)_transient$/ ) { my $string = $1; - if ( $string =~ /^_($rcp)_*($desc)$/ ) { + if ( $string =~ /^_($ssp_rcp)_*($desc)$/ ) { # valid name } elsif ( $string =~ /^_*($desc)$/ ) { # valid name @@ -4030,7 +4043,7 @@ sub check_use_case_name { } } elsif ( $use_case =~ /^20thC([a-zA-Z0-9_\.]*)_transient$/ ) { my $string = $1; - if ( $string =~ /^_($rcp)_*($desc)$/ ) { + if ( $string =~ /^_($ssp_rcp)_*($desc)$/ ) { # valid name } elsif ( $string =~ /^_*($desc)$/ ) { # valid name @@ -4106,9 +4119,9 @@ sub list_options { my ($opts_cmdl, $definition, $defaults) = @_; # options to list values that are in the defaults files - my @opts_list = ( "res", "mask", "sim_year", "rcp" ); + my @opts_list = ( "res", "mask", "sim_year", "ssp_rcp" ); my %opts_local; - foreach my $var ( "res", "mask", "sim_year", "rcp" ) { + foreach my $var ( "res", "mask", "sim_year", "ssp_rcp" ) { my $val; if ( $opts_cmdl->{$var} eq "list" ) { $val = "default"; diff --git a/bld/listDefaultNamelist.pl b/bld/listDefaultNamelist.pl index a698a5ded8..dd41f00082 100755 --- a/bld/listDefaultNamelist.pl +++ b/bld/listDefaultNamelist.pl @@ -17,7 +17,7 @@ # # To then get the files from the CESM SVN repository: # -# ../../cime/scripts/Tools/check_input_data -datalistdir . -export +# ../cime/scripts/Tools/check_input_data --data-list-dir . --download # #======================================================================= @@ -44,13 +44,13 @@ #----------------------------------------------------------------------------------------------- # Add $cfgdir to the list of paths that Perl searches for modules -my @dirs = ( "$cfgdir", "../../../cime/utils/perl5lib" ); +my @dirs = ( "$cfgdir", "../cime/utils/perl5lib" ); unshift @INC, @dirs; require queryDefaultXML; # Defaults -my $cesmroot = abs_path( "$cfgdir/../../../"); +my $cesmroot = abs_path( "$cfgdir/../"); # The namelist defaults file contains default values for all required namelist variables. my @nl_defaults_files = ( "$cfgdir/namelist_files/namelist_defaults_overall.xml", @@ -84,11 +84,25 @@ sub usage { to then read the resulting clm.input_data_list file and retreive the files - ../../cime/scripts/Tools/check_input_data -datalistdir . -export + ../cime/scripts/Tools/check_input_data --data-list-dir . --download EOF } +sub make_config_cache { + # Write a config_cache.xml file to read in + my ($phys, $config_cachefile) = @_; + my $fh = IO::File->new($config_cachefile, '>') or die "can't open file: $config_cachefile"; + print $fh < + + +Specifies clm physics + +EOF + $fh->close(); +} + #----------------------------------------------------------------------------------------------- sub GetListofNeededFiles { @@ -191,14 +205,12 @@ sub GetListofNeededFiles { "$cfgdir/namelist_files/namelist_definition_ctsm.xml" ); $inputopts{'nldef_files'} = \@nl_definition_files; - $inputopts{'empty_cfg_file'} = "$cfgdir/config_files/config_definition_ctsm.xml"; + $inputopts{'empty_cfg_file'} = "config_cache.xml"; my $definition = Build::NamelistDefinition->new( $nl_definition_files[0] ); foreach my $nl_defin_file ( @nl_definition_files ) { $definition->add( "$nl_defin_file" ); } - my $cfg = Build::Config->new( $inputopts{'empty_cfg_file'} ); - # Resolutions... my @resolutions; if ( $opts{'res'} eq "all" ) { @@ -208,6 +220,7 @@ sub GetListofNeededFiles { } # Input options + &make_config_cache( "clm5_0", $inputopts{'empty_cfg_file'} ); push @nl_defaults_files, "$cfgdir/namelist_files/namelist_defaults_ctsm.xml"; if ( defined($opts{'usrdat'}) ) { push @nl_defaults_files, "$cfgdir/namelist_files/namelist_defaults_usr_files.xml"; @@ -248,14 +261,14 @@ sub GetListofNeededFiles { # Loop over all possible simulation year: 1890, 2000, 2100 etc. # $settings{'sim_year_range'} = "constant"; - my @rcps = $definition->get_valid_values( "rcp", 'noquotes'=>1 ); - $settings{'rcp'} = $rcps[0]; + my @ssp_rcps = $definition->get_valid_values( "ssp_rcp", 'noquotes'=>1 ); + $settings{'ssp_rcp'} = $ssp_rcps[0]; YEAR: foreach my $sim_year ( $definition->get_valid_values( "sim_year", 'noquotes'=>1 ) ) { print "sim_year = $sim_year\n" if $printing; $settings{'sim_year'} = $sim_year; if ( $sim_year ne 1850 && $sim_year ne 2000 && $sim_year > 1800 ) { next YEAR; } - my @bgcsettings = $cfg->get_valid_values( "bgc" ); + my @bgcsettings = $definition->get_valid_values( "bgc_mode", 'noquotes'=>1 ); print "bgc=@bgcsettings\n" if $printing; # # Loop over all possible BGC settings @@ -298,11 +311,11 @@ sub GetListofNeededFiles { $settings{'sim_year'} = $1; } # - # Loop over all possible rcp's + # Loop over all possible ssp_rcp's # - print "sim_year_range=$sim_year_range rcp=@rcps\n" if $printing; - foreach my $rcp ( @rcps ) { - $settings{'rcp'} = $rcp; + print "sim_year_range=$sim_year_range ssp_rcp=@ssp_rcps\n" if $printing; + foreach my $ssp_rcp ( @ssp_rcps ) { + $settings{'ssp_rcp'} = $ssp_rcp; &GetListofNeededFiles( \%inputopts, \%settings, \%files ); if ( $printTimes >= 1 ) { $inputopts{'printing'} = 0; diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 60bd932803..00cee17cd0 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -25,6 +25,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 379.0 379.0 +388.8 +397.5 284.7 284.7 @@ -86,13 +88,31 @@ attributes from the config_cache.xml file (with keys converted to upper-case). Ball-Berry1987 -lnd/clm2/isotopes/atm_delta_C13_CMIP6_1850-2015_yearly_v2.0_c171012.nc -lnd/clm2/isotopes/atm_delta_C14_CMIP6_3x1_global_1850-2015_yearly_v2.0_c171012.nc +lnd/clm2/isotopes/atm_delta_C13_CMIP6_1850-2015_yearly_v2.0_c171012.nc +lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP119_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP126_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP245_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP3B_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP534os_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP5B_1850-2100_yearly_c181209.nc + +lnd/clm2/isotopes/atm_delta_C14_CMIP6_3x1_global_1850-2015_yearly_v2.0_c171012.nc +lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP119_3x1_global_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP126_3x1_global_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP245_3x1_global_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP3B_3x1_global_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP534os_3x1_global_1850-2100_yearly_c181209.nc +lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP5B_3x1_global_1850-2100_yearly_c181209.nc +.true. +.false. +.false. + .false. .true. + .false. @@ -371,7 +391,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_2troppftclones.c171018.nc +lnd/clm2/paramdata/fates_params_default_2trop.c190114.nc @@ -479,6 +499,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .true. .true. +.true. +.true. .false. +hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + + + +lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc + + + +lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc + + + +lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc + + + +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc + + + +lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc + + + +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc + + + +lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc + + + + + lnd/clm2/initdata_map/clmi.I2000Clm45Fates.0021-01-01.4x5_mgx3v7_simyr2000_c180306.nc + ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true."> - - -lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr2000_c170824.nc -lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_48x96_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr2000_c170919.nc -lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr2000_c190304.nc -lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_4x5_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_10x15_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne120np4_hist_16pfts_Irrig_CMIP6_simyr2000_c190304.nc -lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_16pfts_Irrig_CMIP6_simyr2000_c190303.nc -lnd/clm2/surfdata_map/surfdata_ne16np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne16np4_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc lnd/clm2/surfdata_map/surfdata_0.125nldas2_hist_16pfts_Irrig_CMIP6_simyr2005_c190412.nc -lnd/clm2/surfdata_map/surfdata_conus_30_x8_16pfts_Irrig_CMIP6_simyr2000_c181003.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_conus_30_x8_hist_16pfts_Irrig_CMIP6_simyr2000_c190128.nc -lnd/clm2/surfdata_map/surfdata_5x5_amazon_16pfts_Irrig_CMIP6_simyr2000_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_5x5_amazon_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr2000_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc lnd/clm2/surfdata_map/surfdata_64x128_16pfts_Irrig_CMIP6_simyr2000_c170824.nc +>lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_64x128_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc -lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_0.9x1.25_hist_78pfts_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1.9x2.5_hist_78pfts_CMIP6_simyr2000_c190304.nc -lnd/clm2/surfdata_map/surfdata_0.125x0.125_mp24_simyr2000_c150114.nc +lnd/clm2/surfdata_map/release-clm5.0.24/surfdata_0.125x0.125_hist_78pfts_CMIP6_simyr2005_c190624.nc -lnd/clm2/surfdata_map/surfdata_10x15_78pfts_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_10x15_hist_78pfts_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_4x5_78pfts_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_4x5_hist_78pfts_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr2000_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr2000_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_smallvilleIA_hist_78pfts_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne120np4_hist_78pfts_CMIP6_simyr2000_c190304.nc -lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c190303.nc -lnd/clm2/surfdata_map/surfdata_ne16np4_78pfts_CMIP6_simyr2000_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne16np4_hist_78pfts_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr2000_c181003.nc +lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_78pfts_CMIP6_simyr2000_c190128.nc -lnd/clm2/surfdata_map/surfdata_1x1_camdenNJ_16pfts_Irrig_CMIP6_simyr2000_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_camdenNJ_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_vancouverCAN_16pfts_Irrig_CMIP6_simyr2000_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_vancouverCAN_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_mexicocityMEX_16pfts_Irrig_CMIP6_simyr2000_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_mexicocityMEX_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_urbanc_alpha_16pfts_Irrig_CMIP6_simyr2000_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_urbanc_alpha_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr1850_c180508.nc - -lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr1850_c170824.nc -lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr1850_c170824.nc + lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_48x96_hist_16pfts_Irrig_CMIP6_simyr1850_c190214.nc - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr1850_c170919.nc -lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850_c190304.nc -lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_10x15_hist_16pfts_Irrig_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_4x5_hist_16pfts_Irrig_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr1850_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850_c190304.nc -lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850_c190303.nc -lnd/clm2/surfdata_map/surfdata_conus_30_x8_16pfts_Irrig_CMIP6_simyr1850_c181003.nc +lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_16pfts_Irrig_CMIP6_simyr1850_c190128.nc - -lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc -lnd/clm2/surfdata_map/surfdata_48x96_78pfts_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_48x96_hist_78pfts_CMIP6_simyr1850_c190214.nc - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc -lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_0.9x1.25_hist_78pfts_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1.9x2.5_hist_78pfts_CMIP6_simyr1850_c190304.nc -lnd/clm2/surfdata_map/surfdata_10x15_78pfts_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_10x15_hist_78pfts_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_4x5_78pfts_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_4x5_hist_78pfts_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr1850_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_smallvilleIA_hist_78pfts_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr1850_c170917.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/surfdata_1x1_brazil_78pfts_CMIP6_simyr1850_c171214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_78pfts_CMIP6_simyr1850_c190214.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr1850_c170824.nc -lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne120np4_hist_78pfts_CMIP6_simyr1850_c190304.nc + +lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nc +lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_78pfts_CMIP6_simyr1850_c190128.nc - - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + use_crop=".false." >lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c1908304.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc @@ -789,10 +879,6 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + use_crop=".true." >lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c190304.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + use_crop=".true." >lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c179824.nc lnd/clm2/surfdata_map/landuse.timeseries_conus_30_x8_hist_78pfts_CMIP6_simyr1850-2015_c181004.nc @@ -822,151 +908,136 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nclnd/clm2/surfdata_map/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc - - - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c190228.nc + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP1-2.6_78pfts_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP1-2.6_78pfts_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP1-2.6_78pfts_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP2-4.5_78pfts_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP2-4.5_78pfts_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP2-4.5_78pfts_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP3-7.0_78pfts_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP3-7.0_78pfts_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP3-7.0_78pfts_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP4-3.4_78pfts_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP4-3.4_78pfts_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP4-3.4_78pfts_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP1-1.9_78pfts_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP1-1.9_78pfts_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP1-1.9_78pfts_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP4-6.0_78pfts_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP4-6.0_78pfts_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP4-6.0_78pfts_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP5-3.4_78pfts_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP5-3.4_78pfts_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP5-3.4_78pfts_CMIP6_simyr1850-2100_c190228.nc + + + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP5-8.5_16pfts_Irrig_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP5-8.5_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP5-8.5_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP1-2.6_16pfts_Irrig_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP1-2.6_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP1-2.6_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP2-4.5_16pfts_Irrig_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP2-4.5_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP2-4.5_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP3-7.0_16pfts_Irrig_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP3-7.0_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP3-7.0_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP4-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP4-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP4-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP1-1.9_16pfts_Irrig_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP1-1.9_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP1-1.9_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP4-6.0_16pfts_Irrig_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP4-6.0_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP4-6.0_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc + + +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP5-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190214.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_1.9x2.5_SSP5-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc +lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP5-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc .true. @@ -1000,6 +1071,17 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nclnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc +2015 +2101 +2015 + +2015 +2101 +2015 + +2010 +2010 + 2000 2000 @@ -1018,23 +1100,58 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nc1850 2015 -1850 -2100 - -2000 -2100 - -lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp8.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100810.nc -lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc - -extend - -NDEP_year - -bilinear +lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc + +lnd/clm2/ndepdata/fndep_clm_SSP585_b.e21.BWSSP585cmip6.f09_g17.CMIP6-SSP5-8.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190211.nc + +lnd/clm2/ndepdata/fndep_clm_SSP126_b.e21.BWSSP126cmip6.f09_g17.CMIP6-SSP1-2.6-WACCM.001_2014-2101_monthly_0.9x1.25_c190221.nc +lnd/clm2/ndepdata/fndep_clm_SSP245_b.e21.BWSSP245cmip6.f09_g17.CMIP6-SSP2-4.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc +lnd/clm2/ndepdata/fndep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc + +lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc + + +lnd/clm2/ndepdata/fndep_clm_SSP585_b.e21.BWSSP585cmip6.f09_g17.CMIP6-SSP5-8.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190211.nc +lnd/clm2/ndepdata/fndep_clm_SSP126_b.e21.BWSSP126cmip6.f09_g17.CMIP6-SSP1-2.6-WACCM.001_2014-2101_monthly_0.9x1.25_c190221.nc +lnd/clm2/ndepdata/fndep_clm_SSP245_b.e21.BWSSP245cmip6.f09_g17.CMIP6-SSP2-4.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc +lnd/clm2/ndepdata/fndep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc + +cycle +NDEP_month +limit + + +extend +NDEP_year +lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc + + +lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc +lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc +lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100428.nc +lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc +lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc +lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100810.nc +lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc +lnd/clm2/ndepdata/fndep_clm_rcp8.5_simyr1849-2106_1.9x2.5_c100428.nc + +bilinear nn nn @@ -1093,6 +1210,17 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.ncnn +2015 +2100 +2015 + +2015 +2100 +2015 + +2010 +2010 + 2000 2000 @@ -1108,16 +1236,23 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nc2000 2000 -1850 -2016 - -1850 -2016 - -1850 -2016 - lnd/clm2/firedata/clmforc.Li_2017_HYDEv3.2_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2016_c180202.nc +lnd/clm2/firedata/clmforc.Li_2018_SSP1_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP1_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP2_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP3_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP4_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP4_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP5_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP5_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + bilinear @@ -1130,6 +1265,10 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.ncnn +2015 +2106 +2015 + 2000 2000 @@ -1148,15 +1287,6 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nc2000 2000 -1850 -2106 - -1850 -2106 - -1850 -2106 - lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc lnd/clm2/urbandata/CLM45_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc @@ -2542,9 +2672,12 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nc.true. 1.9x2.5 +1.9x2.5 lnd/clm2/paramdata/finundated_inversiondata_0.9x1.25_c170706.nc +lnd/clm2/paramdata/finundated_inversiondata_0.9x1.25_c170706.nc @@ -2577,6 +2710,7 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_78pfts_CMIP6_simyr1850_c181003.nc.false. .false. .false. +1 diff --git a/bld/namelist_files/namelist_defaults_ctsm_tools.xml b/bld/namelist_files/namelist_defaults_ctsm_tools.xml index 9fa7b11d33..0c1b365782 100644 --- a/bld/namelist_files/namelist_defaults_ctsm_tools.xml +++ b/bld/namelist_files/namelist_defaults_ctsm_tools.xml @@ -75,9 +75,12 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >lnd/clm2/mappingdata/grids/SCRIPgrid_10x10min_IGBPmergeICESatGIS_c110818.nc lnd/clm2/mappingdata/grids/SCRIPgrid_3minx3min_MODIS_c110915.nc +lnd/clm2/mappingdata/grids/SCRIPgrid_3minx3min_MODISv2_c190503.nc lnd/clm2/mappingdata/grids/SCRIPgrid_3minx3min_MODISwcspsea_c151020.nc 64bit_offset +64bit_offset 64bit_offset lnd/clm2/mappingdata/grids/SCRIPgrid_3x3_USGS_c120912.nc @@ -131,11 +134,13 @@ attributes from the config_cache.xml file (with keys converted to upper-case). AVHRR AVHRR MODIS +MODISv2 MODIS -MODIS +MODISv2 MODIS LandScan2004 MODIS +MODISv2 ISRIC-WISE GLOBE-Gardner GLOBE-Gardner-mergeGIS @@ -204,7 +209,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/rawdata/mksrf_navyoro_20min.c010129.nc - +lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190119/mksrf_lai_histclm52deg005_earthstatmirca_2005.c190119.nc + + lnd/clm2/rawdata/pftcftlandusedynharv.0.25x0.25.MODIS.simyr1850-2015.c170412/mksrf_lai_78pfts_simyr2005.c170413.nc @@ -216,6 +224,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/rawdata/mksrf_soitex.10level.c010119.nc +lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190119/mksrf_soilcolor_histclm52deg005_earthstatmirca_2005.c190116.nc + + lnd/clm2/rawdata/pftcftlandusedynharv.0.25x0.25.MODIS.simyr1850-2015.c170412/mksrf_soilcolor_CMIP6_simyr2005.c170623.nc @@ -290,6 +302,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). + +lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190119/mksrf_landuse_clm52deg005_histLUH2_1850.c190119.nc + +lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190119/mksrf_landuse_clm52deg005_histLUH2_2005.c190119.nc + + lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1850.c170629.nc @@ -966,7 +986,21 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -atm/waccm/lb/LBC_17500116-20150116_CMIP6_0p5degLat_c180905.nc -/gpfs/fs1/p/acom/acom-climate/cesm2/inputdata/atm/waccm/lb/LBC_1750-2015_CMIP6_GlobAnnAvg_c180905.nc +atm/waccm/lb/LBC_17500116-20150116_CMIP6_0p5degLat_c180905.nc +atm/waccm/lb/LBC_1750-2015_CMIP6_GlobAnnAvg_c180926.nc + +atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP126_0p5degLat_c180905.nc +atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP245_0p5degLat_c180905.nc +atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP370_0p5degLat_c180905.nc +atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP460_0p5degLat_c180905.nc +atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP534os_0p5degLat_c180905.nc +atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP585_0p5degLat_c180905.nc + +atm/waccm/lb/LBC_2014-2500_CMIP6_SSP126_0p5degLat_GlobAnnAvg_c190301.nc +atm/waccm/lb/LBC_2014-2500_CMIP6_SSP245_0p5degLat_GlobAnnAvg_c190301.nc +atm/waccm/lb/LBC_2014-2500_CMIP6_SSP370_0p5degLat_GlobAnnAvg_c190301.nc +atm/waccm/lb/LBC_2014-2500_CMIP6_SSP460_0p5degLat_GlobAnnAvg_c190301.nc +atm/waccm/lb/LBC_2014-2500_CMIP6_SSP534os_0p5degLat_GlobAnnAvg_c190301.nc +atm/waccm/lb/LBC_2014-2500_CMIP6_SSP585_0p5degLat_GlobAnnAvg_c190301.nc diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index f7f2d041c2..1e6b0f08e2 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -50,8 +50,8 @@ determine default values for namelists. 1 0 - --999.9 + +hist gx1v6 diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 48cbd3c3ad..df6f95e937 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1855,7 +1855,7 @@ Representative concentration pathway for future scenarios [radiative forcing at -999.9 means do NOT use a future scenario, just use historical data. - Shared Socioeconomic Pathway and Representative Concentration Pathway combination for future scenarios diff --git a/bld/namelist_files/use_cases/1850-2100_SSP1-1.9_transient.xml b/bld/namelist_files/use_cases/1850-2100_SSP1-1.9_transient.xml new file mode 100644 index 0000000000..93e5e24372 --- /dev/null +++ b/bld/namelist_files/use_cases/1850-2100_SSP1-1.9_transient.xml @@ -0,0 +1,17 @@ + + + + +Simulate transient land-use, and aerosol deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP1-1.9 scenario +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP1-1.9 scenario + + + +1850 + +1850-2100 + +SSP1-1.9 + + diff --git a/bld/namelist_files/use_cases/1850-2100_SSP1-2.6_transient.xml b/bld/namelist_files/use_cases/1850-2100_SSP1-2.6_transient.xml new file mode 100644 index 0000000000..d10ef6d45f --- /dev/null +++ b/bld/namelist_files/use_cases/1850-2100_SSP1-2.6_transient.xml @@ -0,0 +1,17 @@ + + + + +Simulate transient land-use, and aerosol deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP1-2.6 scenario +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP1-2.6 scenario + + + +1850 + +1850-2100 + +SSP1-2.6 + + diff --git a/bld/namelist_files/use_cases/1850-2100_SSP2-4.5_transient.xml b/bld/namelist_files/use_cases/1850-2100_SSP2-4.5_transient.xml new file mode 100644 index 0000000000..85859517f1 --- /dev/null +++ b/bld/namelist_files/use_cases/1850-2100_SSP2-4.5_transient.xml @@ -0,0 +1,17 @@ + + + + +Simulate transient land-use, and aerosol deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP2-4.5 scenario +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP2-4.5 scenario + + + +1850 + +1850-2100 + +SSP2-4.5 + + diff --git a/bld/namelist_files/use_cases/1850-2100_SSP3-7.0_transient.xml b/bld/namelist_files/use_cases/1850-2100_SSP3-7.0_transient.xml new file mode 100644 index 0000000000..317ca3fbcd --- /dev/null +++ b/bld/namelist_files/use_cases/1850-2100_SSP3-7.0_transient.xml @@ -0,0 +1,17 @@ + + + + +Simulate transient land-use, and aerosol deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP3-7.0 scenario +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP3-7.0 scenario + + + +1850 + +1850-2100 + +SSP3-7.0 + + diff --git a/bld/namelist_files/use_cases/1850-2100_SSP4-3.4_transient.xml b/bld/namelist_files/use_cases/1850-2100_SSP4-3.4_transient.xml new file mode 100644 index 0000000000..0e42bbd724 --- /dev/null +++ b/bld/namelist_files/use_cases/1850-2100_SSP4-3.4_transient.xml @@ -0,0 +1,17 @@ + + + + +Simulate transient land-use, and aerosol deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP4-3.4 scenario +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP4-3.4 scenario + + + +1850 + +1850-2100 + +SSP4-3.4 + + diff --git a/bld/namelist_files/use_cases/1850-2100_SSP4-6.0_transient.xml b/bld/namelist_files/use_cases/1850-2100_SSP4-6.0_transient.xml new file mode 100644 index 0000000000..b2b67a4d5b --- /dev/null +++ b/bld/namelist_files/use_cases/1850-2100_SSP4-6.0_transient.xml @@ -0,0 +1,17 @@ + + + + +Simulate transient land-use, and aerosol deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP4-6.0 scenario +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP4-6.0 scenario + + + +1850 + +1850-2100 + +SSP4-6.0 + + diff --git a/bld/namelist_files/use_cases/1850-2100_SSP5-3.4_transient.xml b/bld/namelist_files/use_cases/1850-2100_SSP5-3.4_transient.xml new file mode 100644 index 0000000000..e4ae71ca94 --- /dev/null +++ b/bld/namelist_files/use_cases/1850-2100_SSP5-3.4_transient.xml @@ -0,0 +1,17 @@ + + + + +Simulate transient land-use, and aerosol deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP5-3.4 scenario +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP5-3.4 scenario + + + +1850 + +1850-2100 + +SSP5-3.4 + + diff --git a/bld/namelist_files/use_cases/1850-2100_SSP5-8.5_transient.xml b/bld/namelist_files/use_cases/1850-2100_SSP5-8.5_transient.xml new file mode 100644 index 0000000000..fbb8af4d10 --- /dev/null +++ b/bld/namelist_files/use_cases/1850-2100_SSP5-8.5_transient.xml @@ -0,0 +1,17 @@ + + + + +Simulate transient land-use, and aerosol deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP5-8.5 scenario +Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to current day with historical data, and then to 2100 with the CMIP6 SSP5-8.5 scenario + + + +1850 + +1850-2100 + +SSP5-8.5 + + diff --git a/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml b/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml deleted file mode 100644 index 6ed679db84..0000000000 --- a/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE - - -1850 - -1850-2100 - -2.6 - -flanduse_timeseries - -.true. -.false. -.false. - -arb_ic - -1850 -2100 -1850 - -1850 -2100 -1850 - -1850 -2010 -1850 - -1850 -2010 -1850 - -1850 -2100 -1850 - - - diff --git a/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml b/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml deleted file mode 100644 index d185e09085..0000000000 --- a/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM - - -1850 - -1850-2100 - -4.5 - -flanduse_timeseries - -arb_ic - -.true. -.false. -.false. - -1850 -2100 -1850 - -1850 -2100 -1850 - -1850 -2010 -1850 - -1850 -2010 -1850 - -1850 -2100 -1850 - - diff --git a/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml b/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml deleted file mode 100644 index 68a085b6f4..0000000000 --- a/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM - - -1850 - -1850-2100 - -6 - -.true. -.false. -.false. - -flanduse_timeseries - -arb_ic - -1850 -2100 -1850 - -1850 -2100 -1850 - -1850 -2010 -1850 - -1850 -2010 -1850 - -1850 -2100 -1850 - - diff --git a/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml b/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml deleted file mode 100644 index 682e3c6034..0000000000 --- a/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE - - -1850 - -1850-2100 - -8.5 - -.true. -.false. -.false. - -flanduse_timeseries - -arb_ic - -1850 -2100 -1850 - -1850 -2100 -1850 - -1850 -2010 -1850 - -1850 -2010 -1850 - -1850 -2100 -1850 - - diff --git a/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml b/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml deleted file mode 100644 index ad0e9f910e..0000000000 --- a/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 2000 to 2005 and then with the RCP8.5 scenario from MESSAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 2000 to 2005 and then with the RCP8.5 scenario from MESSAGE - - -20050101 - -1850 - -2000-2100 - -8.5 - -.true. -.false. -.false. - -flanduse_timeseries - -arb_ic - -2000 -2100 -2000 - -2000 -2100 -2000 - -2000 -2010 -2000 - -2000 -2010 -2000 - -2000 -2100 -2000 - - diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 1996d7bcb0..2a07566d51 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 940; +my $ntests = 872; if ( defined($opts{'compare'}) ) { - $ntests += 594; + $ntests += 543; } plan( tests=>$ntests ); @@ -211,7 +211,7 @@ sub make_config_cache { $cfiles->copyfiles( "default", $mode ); &cleanup(); # Simple test -- run all the list options -foreach my $options ( "clm_demand", "rcp", "res", +foreach my $options ( "clm_demand", "ssp_rcp", "res", "sim_year", "use_case" ) { &make_env_run(); eval{ system( "$bldnml -${options} list > $tempfile 2>&1 " ); }; @@ -234,7 +234,7 @@ sub make_config_cache { # Exercise a bunch of options my $options = "-co2_ppmv 250 "; - $options .= " -res 0.9x1.25 -rcp 2.6 -envxml_dir ."; + $options .= " -res 0.9x1.25 -ssp_rcp SSP1-2.6 -envxml_dir ."; &make_env_run(); eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; @@ -287,14 +287,14 @@ sub make_config_cache { &make_config_cache($phys); print "\n===============================================================================\n"; -print "Test configuration, structure, irrigate, verbose, clm_demand, rcp, test, sim_year, use_case, l_ncpl\n"; +print "Test configuration, structure, irrigate, verbose, clm_demand, ssp_rcp, test, sim_year, use_case, l_ncpl\n"; print "=================================================================================\n"; -# configuration, structure, irrigate, verbose, clm_demand, rcp, test, sim_year, use_case, l_ncpl +# configuration, structure, irrigate, verbose, clm_demand, ssp_rcp, test, sim_year, use_case, l_ncpl my $startfile = "clmrun.clm2.r.1964-05-27-00000.nc"; foreach my $options ( "-configuration nwp", "-structure fast", - "-namelist '&a irrigate=.true./'", "-verbose", "-rcp 2.6", "-test", "-sim_year 1850", + "-namelist '&a irrigate=.true./'", "-verbose", "-ssp_rcp SSP1-2.6", "-test", "-sim_year 1850", "-use_case 1850_control", "-l_ncpl 1", "-clm_start_type startup", "-namelist '&a irrigate=.false./' -crop -bgc bgc", "-envxml_dir . -infile myuser_nl_clm", @@ -332,11 +332,11 @@ sub make_config_cache { $mode = "-phys $phys"; &make_config_cache($phys); foreach my $options ( - "-bgc bgc -use_case 1850-2100_rcp2.6_transient -namelist '&a start_ymd=20100101/'", - "-bgc sp -use_case 1850-2100_rcp4.5_transient -namelist '&a start_ymd=18501223/'", - "-bgc bgc -use_case 1850-2100_rcp6_transient -namelist '&a start_ymd=20701029/'", + "-bgc bgc -use_case 1850-2100_SSP1-2.6_transient -namelist '&a start_ymd=20100101/'", + "-bgc sp -use_case 1850-2100_SSP2-4.5_transient -namelist '&a start_ymd=18501223/'", + "-bgc bgc -use_case 1850-2100_SSP4-6.0_transient -namelist '&a start_ymd=20701029/'", "-bgc fates -use_case 2000_control -no-megan", - "-bgc cn -use_case 1850-2100_rcp8.5_transient -namelist '&a start_ymd=19201023/'", + "-bgc cn -use_case 1850-2100_SSP5-8.5_transient -namelist '&a start_ymd=19201023/'", "-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop", "-res 0.9x1.25 -bgc bgc -use_case 1850_noanthro_control -drydep -fire_emis -light_res 360x720", ) { @@ -417,17 +417,17 @@ sub make_config_cache { "reseed without CN" =>{ options=>" -envxml_dir . -bgc sp", namelst=>"reseed_dead_plants=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", + phys=>"clm5_0", }, "dribble_crphrv w/o CN" =>{ options=>" -envxml_dir . -bgc sp", namelst=>"dribble_crophrv_xsmrpool_2atm=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", + phys=>"clm5_0", }, "dribble_crphrv w/o crop" =>{ options=>" -envxml_dir . -bgc cn -no-crop", namelst=>"dribble_crophrv_xsmrpool_2atm=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", + phys=>"clm5_0", }, "CNDV with flanduse_timeseries - clm4_5"=>{ options=>"-bgc bgc -dynamic_vegetation -envxml_dir .", namelst=>"flanduse_timeseries='my_flanduse_timeseries_file.nc'", @@ -863,12 +863,12 @@ sub make_config_cache { "noanthro_w_crop" =>{ options=>"-envxml_dir . -res 0.9x1.25 -bgc bgc -crop -use_case 1850_noanthro_control", namelst=>"", GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", + phys=>"clm5_0", }, "noanthro_w_irrig" =>{ options=>"-envxml_dir . -res 0.9x1.25 -bgc bgc -use_case 1850_noanthro_control", namelst=>"irrigate=T", GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", + phys=>"clm5_0", }, "spdotransconflict" =>{ options=>"-envxml_dir . -bgc sp -use_case 20thC_transient", namelst=>"do_transient_pfts=T,do_transient_crops=.false.", @@ -1076,10 +1076,12 @@ sub make_config_cache { $res eq "ne4np4" || $res eq "2.5x3.33" || $res eq "0.23x0.31" || + $res eq "0.47x0.63" || $res eq "94x192" || $res eq "8x16" || $res eq "32x64" || $res eq "128x256" || + $res eq "360x720cru" || $res eq "512x1024" ) { next; } @@ -1110,7 +1112,7 @@ sub make_config_cache { $phys = "clm4_5"; $mode = "-phys $phys"; &make_config_cache($phys); -my @resolutions = ( "4x5", "10x15", "ne30np4", "ne120np4", "ne16np4", "1.9x2.5", "0.9x1.25" ); +my @resolutions = ( "4x5", "10x15", "ne30np4", "ne16np4", "1.9x2.5", "0.9x1.25" ); my @regional; my $nlbgcmode = "bgc"; my $mode = "clm45-$nlbgcmode"; @@ -1174,7 +1176,7 @@ sub make_config_cache { $phys = "clm5_0"; $mode = "-phys $phys"; &make_config_cache($phys); -my @crop_res = ( "1x1_numaIA", "1x1_smallvilleIA", "4x5", "10x15", "0.9x1.25", "1.9x2.5", "ne30np4", "ne120np4" ); +my @crop_res = ( "1x1_numaIA", "1x1_smallvilleIA", "4x5", "10x15", "0.9x1.25", "1.9x2.5", "ne30np4" ); foreach my $res ( @crop_res ) { $options = "-bgc bgc -crop -res $res -envxml_dir ."; &make_env_run(); @@ -1211,12 +1213,13 @@ sub make_config_cache { $mode = "-phys $phys"; &make_config_cache($phys); my @glc_res = ( "48x96", "0.9x1.25", "1.9x2.5" ); -my @use_cases = ( "1850-2100_rcp2.6_transient", - "1850-2100_rcp4.5_transient", - "1850-2100_rcp6_transient", - "1850-2100_rcp8.5_transient", +my @use_cases = ( "1850-2100_SSP1-2.6_transient", + "1850-2100_SSP3-4.5_transient", + "1850-2100_SSP4-6.0_transient", + "1850-2100_SSP5-8.5_transient", "1850_control", "2000_control", + "2010_control", "20thC_transient", ); foreach my $res ( @glc_res ) { @@ -1241,7 +1244,7 @@ sub make_config_cache { $phys = "clm5_0"; $mode = "-phys $phys"; &make_config_cache($phys); -my @tran_res = ( "48x96", "0.9x1.25", "1.9x2.5", "ne30np4", "ne120np4", "10x15" ); +my @tran_res = ( "48x96", "0.9x1.25", "1.9x2.5", "ne30np4", "10x15" ); my $usecase = "20thC_transient"; my $GLC_NEC = 10; foreach my $res ( @tran_res ) { @@ -1261,12 +1264,13 @@ sub make_config_cache { } &cleanup(); } -# Transient rcp scenarios +# Transient ssp_rcp scenarios that work $phys = "clm5_0"; $mode = "-phys $phys"; -&make_config_cache($phys); -my @tran_res = ( "48x96", "0.9x1.25", "1.9x2.5", "ne30np4", "10x15" ); -foreach my $usecase ( "1850_control", "1850-2100_rcp2.6_transient", "1850-2100_rcp4.5_transient", "1850-2100_rcp6_transient", "1850-2100_rcp8.5_transient" ) { +my @tran_res = ( "0.9x1.25", "1.9x2.5", "10x15" ); +foreach my $usecase ( "1850_control", "1850-2100_SSP5-8.5_transient", "1850-2100_SSP1-2.6_transient", "1850-2100_SSP3-7.0_transient", + "1850-2100_SSP4-3.4_transient", "1850-2100_SSP5-3.4_transient", "1850-2100_SSP2-4.5_transient", "1850-2100_SSP1-1.9_transient", + "1850-2100_SSP4-6.0_transient" ) { foreach my $res ( @tran_res ) { $options = "-res $res -bgc bgc -crop -use_case $usecase -envxml_dir . "; &make_env_run(); @@ -1297,7 +1301,7 @@ sub make_config_cache { "-bgc sp -envxml_dir . -vichydro", "-bgc bgc -dynamic_vegetation", "-bgc bgc -clm_demand flanduse_timeseries -sim_year 1850-2000", "-bgc bgc -envxml_dir . -namelist '&a use_c13=.true.,use_c14=.true.,use_c14_bombspike=.true./'" ); foreach my $clmopts ( @clmoptions ) { - my @clmres = ( "ne120np4", "10x15", "0.9x1.25", "1.9x2.5" ); + my @clmres = ( "10x15", "0.9x1.25", "1.9x2.5" ); foreach my $res ( @clmres ) { $options = "-res $res -envxml_dir . "; &make_env_run( ); @@ -1429,7 +1433,7 @@ sub cleanup { system( "/bin/rm env_run.xml $real_par_file" ); if ( defined($type) ) { if ( $type eq "config" ) { - system( "/bin/rm Filepath config_cache.xml CESM_cppdefs" ); + system( "/bin/rm config_cache.xml" ); } } else { system( "/bin/rm $tempfile *_in" ); diff --git a/cime_config/buildlib b/cime_config/buildlib index 86f1e479fa..47bca90203 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -51,6 +51,7 @@ def _main_func(): os.path.join(lnd_root,"src","fates","biogeophys"), os.path.join(lnd_root,"src","fates","biogeochem"), os.path.join(lnd_root,"src","fates","fire"), + os.path.join(lnd_root,"src","fates","parteh"), os.path.join(lnd_root,"src","utils"), os.path.join(lnd_root,"src","cpl")] with open(filepath_file, "w") as filepath: From 1bb81cf1271f35ed196c58c16aae5a7f0c9f1bff Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 10 Jul 2019 15:14:27 -0600 Subject: [PATCH 0324/1973] first soil moisture streams implementation --- bld/CLMBuildNamelist.pm | 33 +- bld/namelist_files/namelist_defaults_ctsm.xml | 10 + .../namelist_definition_ctsm.xml | 32 +- src/biogeophys/SoilMoistureStreamMod.F90 | 293 ++++++++++++++++++ src/main/clm_driver.F90 | 9 + src/main/clm_initializeMod.F90 | 7 +- src/main/clm_varctl.F90 | 6 + src/main/controlMod.F90 | 2 + 8 files changed, 389 insertions(+), 3 deletions(-) create mode 100644 src/biogeophys/SoilMoistureStreamMod.F90 diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 42e0b35b92..6be5aea79f 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1609,6 +1609,11 @@ sub process_namelist_inline_logic { ################################## setup_logic_lai_streams($opts, $nl_flags, $definition, $defaults, $nl); + ########################################## + # namelist group: soil_moisture_streams # + ########################################## + setup_logic_soilm_streams($opts, $nl_flags, $definition, $defaults, $nl); + ################################## # namelist group: bgc_shared ################################## @@ -3345,6 +3350,32 @@ sub setup_logic_megan { #------------------------------------------------------------------------------- +sub setup_logic_soilm_streams { + # prescribed soil moisture streams require clm4_5/clm5_0 + my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_; + + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_mapalgo', + 'hgrid'=>$nl_flags->{'res'} ); + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_soilm', 'phys'=>$nl_flags->{'phys'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + # Set align year, if first and last years are different + if ( $nl->get_value('stream_year_first_soilm') != + $nl->get_value('stream_year_last_soilm') ) { + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, + 'model_year_align_soilm', 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + } + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_soilm', 'phys'=>$nl_flags->{'phys'}, + 'hgrid'=>"0.9x1.25" ); +} + +#------------------------------------------------------------------------------- + sub setup_logic_lai_streams { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; @@ -3638,7 +3669,7 @@ sub write_output_files { # CLM component my @groups; @groups = qw(clm_inparm ndepdyn_nml popd_streams urbantv_streams light_streams - lai_streams atm2lnd_inparm lnd2atm_inparm clm_canopyhydrology_inparm cnphenology + soil_moisture_streams lai_streams atm2lnd_inparm lnd2atm_inparm clm_canopyhydrology_inparm cnphenology clm_soilhydrology_inparm dynamic_subgrid cnvegcarbonstate finidat_consistency_checks dynpft_consistency_checks clm_initinterp_inparm century_soilbgcdecompcascade diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index ef7f2498ad..9373092bd9 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1016,6 +1016,16 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.ncnn nn + +.false. +1980 +1980 +1980 + +/project/tss/swensosc/MIPs/LS3MIP/LFMIP-pdLC-SST.H2OSOI.natveg.1980-2014.MONS_climo.nc + +bilinear + .false. 2001 diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 33947ebe4d..f7510efd6d 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1606,7 +1606,7 @@ Mapping method from Nitrogen deposition input file to the model resolution - + + + +Toggle to turn on use of soil moisture streams (EXPERIMENTAL and NOT tested) + + + +First year to loop over for USTAR data + + + +Last year to loop over for USTAR data + + + +Simulation year that aligns with stream_year_first_soilm value + + + +Filename of input stream data for USTAR + + + + + diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 new file mode 100644 index 0000000000..bf695d985c --- /dev/null +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -0,0 +1,293 @@ +module SoilMoistureStreamMod + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Read in soil moisture from data stream + ! + ! !USES: + use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create + use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance + use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_kind_mod , only : CL => shr_kind_CL + use shr_log_mod , only : errMsg => shr_log_errMsg + use decompMod , only : bounds_type + use abortutils , only : endrun + use clm_varctl , only : scmlat,scmlon,single_column + use clm_varctl , only : iulog, use_soil_moisture_streams + use clm_varcon , only : grlnd + use controlMod , only : NLFilename + use decompMod , only : gsmap_lnd_gdc2glo + use domainMod , only : ldomain + use fileutils , only : getavu, relavu + use ColumnType , only : col + use SoilStateType , only : soilstate_type + use WaterStateBulkType, only : waterstatebulk_type + use perf_mod , only : t_startf, t_stopf + use spmdMod , only : masterproc + use spmdMod , only : mpicom, comp_id + use mct_mod + use ncdio_pio + ! + ! !PUBLIC TYPES: + implicit none + private + ! + ! !PUBLIC MEMBER FUNCTIONS: + public :: PrescribedSoilMoistureInit ! position datasets for soil moisture + public :: PrescribedSoilMoistureInterp ! interpolates between two periods of soil moisture data + + ! !PRIVATE MEMBER DATA: + type(shr_strdata_type) :: sdat_soilm ! soil moisture input data stream + ! + ! !PRIVATE TYPES: + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + !----------------------------------------------------------------------- + +contains + + !----------------------------------------------------------------------- + ! + ! soil_moisture_init + ! + !----------------------------------------------------------------------- + subroutine PrescribedSoilMoistureInit(bounds) + ! + ! Initialize data stream information for soil moisture. + ! + ! + ! !USES: + use clm_varctl , only : inst_name + use clm_time_manager , only : get_calendar + use ncdio_pio , only : pio_subsystem + use shr_pio_mod , only : shr_pio_getiotype + use clm_nlUtilsMod , only : find_nlgroup_name + use ndepStreamMod , only : clm_domain_mct + use histFileMod , only : hist_addfld1d + use shr_stream_mod , only : shr_stream_file_null + use shr_string_mod , only : shr_string_listCreateField + use clm_varpar , only : nlevsoi + ! + ! !ARGUMENTS: + implicit none + type(bounds_type), intent(in) :: bounds ! bounds + ! + ! !LOCAL VARIABLES: + integer :: i ! index + integer :: stream_year_first_soilm ! first year in Ustar stream to use + integer :: stream_year_last_soilm ! last year in Ustar stream to use + integer :: model_year_align_soilm ! align stream_year_first_soilm with + integer :: nu_nml ! unit for namelist file + integer :: nml_error ! namelist i/o error flag + type(mct_ggrid) :: dom_clm ! domain information + character(len=CL) :: stream_fldfilename_soilm ! ustar stream filename to read + character(len=CL) :: soilm_mapalgo = 'bilinear' ! Mapping alogrithm + + character(*), parameter :: subName = "('soil_moisture_init')" + character(*), parameter :: F00 = "('(soil_moisture_init) ',4a)" + character(*), parameter :: soilmString = "H2OSOI" ! base string for field string + character(SHR_KIND_CXX) :: fldList ! field string + !----------------------------------------------------------------------- + ! + ! deal with namelist variables here in init + ! + namelist /soil_moisture_streams/ & + stream_year_first_soilm, & + stream_year_last_soilm, & + model_year_align_soilm, & + soilm_mapalgo, & + stream_fldfilename_soilm + + ! Default values for namelist + stream_year_first_soilm = 1 ! first year in stream to use + stream_year_last_soilm = 1 ! last year in stream to use + model_year_align_soilm = 1 ! align stream_year_first_soilm with this model year + stream_fldfilename_soilm = shr_stream_file_null + + ! Read soilm_streams namelist + if (masterproc) then + nu_nml = getavu() + open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) + call find_nlgroup_name(nu_nml, 'soil_moisture_streams', status=nml_error) + if (nml_error == 0) then + read(nu_nml, nml=soil_moisture_streams,iostat=nml_error) + if (nml_error /= 0) then + call endrun(subname // ':: ERROR reading soil_moisture_streams namelist') + end if + else + call endrun(subname // ':: ERROR finding soilm_streams namelist') + end if + close(nu_nml) + call relavu( nu_nml ) + endif + + call shr_mpi_bcast(stream_year_first_soilm, mpicom) + call shr_mpi_bcast(stream_year_last_soilm, mpicom) + call shr_mpi_bcast(model_year_align_soilm, mpicom) + call shr_mpi_bcast(stream_fldfilename_soilm, mpicom) + + if (masterproc) then + + write(iulog,*) ' ' + write(iulog,*) 'soil_moisture_stream settings:' + write(iulog,*) ' stream_year_first_soilm = ',stream_year_first_soilm + write(iulog,*) ' stream_year_last_soilm = ',stream_year_last_soilm + write(iulog,*) ' model_year_align_soilm = ',model_year_align_soilm + write(iulog,*) ' stream_fldfilename_soilm = ',trim(stream_fldfilename_soilm) + + endif + + call clm_domain_mct (bounds, dom_clm) + + ! + ! create the field list for these fields...use in shr_strdata_create + ! + fldList = trim(soilmString) + + write(iulog,*) 'fieldlist: ', trim(fldList), nlevsoi + + call shr_strdata_create(sdat_soilm,name="soil_moisture", & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype(inst_name), & + mpicom=mpicom, compid=comp_id, & + gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & + nxg=ldomain%ni, nyg=ldomain%nj, & + nzg=nlevsoi, & + yearFirst=stream_year_first_soilm, & + yearLast=stream_year_last_soilm, & + yearAlign=model_year_align_soilm, & + offset=0, & + domFilePath='', & + domFileName=trim(stream_fldFileName_soilm), & + domTvarName='time', & + domXvarName='lon' , & + domYvarName='lat' , & + domZvarName='levsoi' , & + domAreaName='area', & + domMaskName='mask', & + filePath='', & + filename=(/stream_fldFileName_soilm/), & + fldListFile=fldList, & + fldListModel=fldList, & + fillalgo='none', & + mapalgo=soilm_mapalgo, & + calendar=get_calendar(), & + dtlimit = 15._r8, & + taxmode='cycle' ) + + write(*,*) 'initializedstream' + if (masterproc) then + call shr_strdata_print(sdat_soilm,'soil moisture data') + endif + + end subroutine PrescribedSoilMoistureInit + + !----------------------------------------------------------------------- + ! + ! PrescribedSoilMoistureInterp + ! + !----------------------------------------------------------------------- + subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & + waterstatebulk_inst) + ! + ! Assign data stream information for prescribed soil moisture. + ! + ! !USES: + use clm_time_manager, only : get_curr_date + use clm_varpar , only : nlevsoi + use clm_varcon , only : denh2o, denice + ! + ! !ARGUMENTS: + implicit none + type(bounds_type) , intent(in) :: bounds + type(soilstate_type) , intent(in) :: soilstate_inst + type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst + ! + ! !LOCAL VARIABLES: + integer :: c, g, j, ism, ig + integer :: year ! year (0, ...) for nstep+1 + integer :: mon ! month (1, ..., 12) for nstep+1 + integer :: day ! day of month (1, ..., 31) for nstep+1 + integer :: sec ! seconds into current date for nstep+1 + integer :: mcdate ! Current model date (yyyymmdd) + integer :: ier ! error code + integer, allocatable :: g_to_ig(:) + real(r8) :: soilm_liq_frac ! liquid fraction of soil moisture + real(r8) :: soilm_ice_frac ! ice fraction of soil moisture + real(r8) :: moisture_increment ! soil moisture adjustment increment + character(len=CL) :: stream_var_name + !----------------------------------------------------------------------- + + associate( & + dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) + watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) + h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input/Output: [real(r8) (:,:) ] liquid water (kg/m2) + h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input/Output: [real(r8) (:,:) ] ice water (kg/m2) + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Output: volumetric soil water (m3/m3) + ) + + call get_curr_date(year, mon, day, sec) + mcdate = year*10000 + mon*100 + day + + stream_var_name = 'H2OSOI' + + ! Determine variable index + ism = mct_aVect_indexRA(sdat_soilm%avs(1),trim(stream_var_name)) + + call shr_strdata_advance(sdat_soilm, mcdate, sec, mpicom, trim(stream_var_name)) + + ! Map gridcell to AV index + ier = 0 + allocate (g_to_ig(bounds%begg:bounds%endg), stat=ier) + if (ier /= 0) then + write(iulog,*) 'Prescribed soil moisture allocation error' + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + + ig = 0 + do g = bounds%begg,bounds%endg + ig = ig+1 + g_to_ig(g) = ig + end do + +! write(iulog,*) 'sdatavs: ',sdat_soilm%avs + write(iulog,*) ' ' +! write(iulog,*) 'sdatsize: ',sdat_soilm%avs(1) + call mct_aVect_info(2, sdat_soilm%avs(1)) + + ! Read data from stream into column level variable + + do c = bounds%begc, bounds%endc + ! + ! Set variable for each gridcell/column combination + ! + ig = g_to_ig(col%gridcell(c)) + + ! this is a 2d field (gridcell/nlevsoi) ! + do j = 1, nlevsoi + ! initialize increment to original soil moisture value + moisture_increment = h2osoi_vol(c,j) + + ! update volumetric soil moisture + !fix h2osoi_vol(c,j) = sdat_soilm%avs(1)%rAttr(ism,ig,:) !wrong!!!!! + h2osoi_vol(c,j) = min(h2osoi_vol(c,j), watsat(c, j)) + + ! calculate liq/ice mass fractions + soilm_liq_frac = h2osoi_liq(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) + soilm_ice_frac = h2osoi_ice(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) + ! update moisture increment (relative to original value) + moisture_increment = h2osoi_vol(c,j) - moisture_increment + + ! update liq/ice water mass due to (volumetric) moisture increment + h2osoi_liq(c,j) = h2osoi_liq(c,j) + (soilm_liq_frac * moisture_increment * dz(c, j) * denh2o) + h2osoi_ice(c,j) = h2osoi_ice(c,j) + (soilm_ice_frac * moisture_increment * dz(c, j) * denice) + enddo + + end do + + end associate + + end subroutine PrescribedSoilMoistureInterp + +end module SoilMoistureStreamMod diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 912d6b6105..715a3f1edc 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -12,6 +12,7 @@ module clm_driver use clm_varctl , only : wrtdia, iulog, use_fates use clm_varctl , only : use_cn, use_lch4, use_noio, use_c13, use_c14 use clm_varctl , only : use_crop, irrigate, ndep_from_cpl + use clm_varctl , only : use_soil_moisture_streams use clm_time_manager , only : get_nstep, is_beg_curr_day use clm_time_manager , only : get_prev_date, is_first_step use clm_varpar , only : nlevsno, nlevgrnd @@ -82,6 +83,7 @@ module clm_driver use clm_instMod use clm_instMod , only : soil_water_retention_curve use EDBGCDynMod , only : EDBGCDyn, EDBGCDynSummary + use SoilMoistureStreamMod , only : PrescribedSoilMoistureInterp ! ! !PUBLIC TYPES: implicit none @@ -335,6 +337,13 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro do nc = 1,nclumps call get_clump_bounds(nc, bounds_clump) + if (use_soil_moisture_streams) then + call t_startf('prescribed_sm') + call PrescribedSoilMoistureInterp(bounds_clump, soilstate_inst, & + water_inst%waterstatebulk_inst) + call t_stopf('prescribed_sm') + endif + call t_startf('begwbal') call BeginWaterBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 793b36ac65..f61e647044 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -13,6 +13,7 @@ module clm_initializeMod use clm_varctl , only : is_cold_start, is_interpolated_start use clm_varctl , only : iulog use clm_varctl , only : use_lch4, use_cn, use_cndv, use_c13, use_c14, use_fates + use clm_varctl , only : use_soil_moisture_streams use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft, irrig_method, wt_glc_mec, topo_glc_mec use perf_mod , only : t_startf, t_stopf use readParamsMod , only : readParameters @@ -26,7 +27,8 @@ module clm_initializeMod use FatesInterfaceMod, only : set_fates_global_elements use dynSubgridControlMod, only: dynSubgridControl_init, get_reset_dynbal_baselines - use clm_instMod + use clm_instMod + use SoilMoistureStreamMod, only : PrescribedSoilMoistureInit ! implicit none private ! By default everything is private @@ -501,6 +503,9 @@ subroutine initialize2( ) call SatellitePhenologyInit(bounds_proc) end if + if(use_soil_moisture_streams) then + call PrescribedSoilMoistureInit(bounds_proc) + endif diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index a6668a8148..a4c2057112 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -253,6 +253,12 @@ module clm_varctl integer, public :: CN_evergreen_phenology_opt = 0 integer, public :: carbon_resp_opt = 0 + !---------------------------------------------------------- + ! prescribed soil moisture streams switch + !---------------------------------------------------------- + + logical, public :: use_soil_moisture_streams = .false. ! true => use prescribed soil moisture stream + !---------------------------------------------------------- ! lai streams switch for Sat. Phenology !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 59c4273277..668dd25cfa 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -237,6 +237,8 @@ subroutine control_init( ) CNratio_floating, lnc_opt, reduce_dayl_factor, vcmax_opt, CN_residual_opt, & CN_partition_opt, CN_evergreen_phenology_opt, carbon_resp_opt + namelist /clm_inparm/ use_soil_moisture_streams + namelist /clm_inparm/ use_lai_streams namelist /clm_inparm/ use_bedrock From 16cfc5eec99ac91b4dcf19426f5cf9404ced98fb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Jul 2019 16:00:41 -0600 Subject: [PATCH 0325/1973] Get working, adding fates_parteh_mode, remove rcp, add doc about ssp_rcp, fix bgc_spinup tests for sp and suplnitro --- bld/CLMBuildNamelist.pm | 11 ++++++----- .../namelist_definition_ctsm.xml | 18 +++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 4c53dc3ad3..9b50fb911f 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1121,10 +1121,6 @@ sub setup_cmdl_spinup { use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'} ); if ( $nl->get_value("spinup_state") ne 0 ) { $nl_flags->{'bgc_spinup'} = "on"; - if ( $nl_flags->{'bgc_mode'} eq "sp" ) { - $log->fatal_error("spinup_state is accelerated (=1 or 2) which is for a BGC mode of CN or BGC," . - " but the BGC mode is Satellite Phenology, change one or the other"); - } if ( $nl_flags->{'clm_accelerated_spinup'} eq "off" ) { $log->fatal_error("spinup_state is accelerated, but clm_accelerated_spinup is off, change one or the other"); } @@ -1132,6 +1128,11 @@ sub setup_cmdl_spinup { $nl_flags->{'bgc_spinup'} = "off"; $val = $defaults->get_value($var); } + } else { + if ( defined($nl->get_value("spinup_state")) ) { + $log->fatal_error("spinup_state is accelerated (=1 or 2) which is for a BGC mode of CN or BGC," . + " but the BGC mode is Satellite Phenology, change one or the other"); + } } $nl_flags->{$var} = $val; my $group = $definition->get_group_name($var); @@ -2633,7 +2634,7 @@ sub setup_logic_supplemental_nitrogen { } if ( $suplnitro =~ /ALL/i ) { - if ( $nl_flags->{'bgc_spinup'} ne "on" ) { + if ( $nl_flags->{'bgc_spinup'} eq "on" ) { $log->warning("There is no need to use a bgc_spinup mode when supplemental Nitrogen is on for all PFT's, as these modes spinup Nitrogen" ); } } diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index df6f95e937..8d9b632c18 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -624,6 +624,11 @@ Toggle to turn on the FATES model (use_fates= '.true.' is EXPERIMENTAL NOT SUPPORTED!) + +Switch deciding which nutrient model to use in FATES. + + Toggle to turn on spitfire module for modeling fire (only relevant if FATES is being used). @@ -1848,18 +1853,13 @@ Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools - -Representative concentration pathway for future scenarios [radiative forcing at peak or 2100 in W/m^2] --999.9 means do NOT use a future scenario, just use historical data. - - -Shared Socioeconomic Pathway and Representative Concentration Pathway combination for future scenarios +Shared Socioeconomic Pathway (SSP) and Representative Concentration Pathway (RCP) combination for future scenarios The form is SSPn-m.m Where n is the SSP number and m.m is RCP radiative forcing at peak or 2100 in W/m^2 +n is just the whole number of the specific SSP scenario. The lower numbers have higher mitigation +- the higher numbers less mitigation, more than one SSP can result in the same RCP forcing hist means do NOT use a future scenario, just use historical data. @@ -1888,7 +1888,7 @@ If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) "PtVg,1000,850,1100,1350,1600,1850,1855,1865,1875,1885,1895,1905,1915,1925,1935,1945,1955,1965,1975,1980,1985,1995,2000,2005,2010,2015,2025,2035,2045,2055,2065,2075,2085,2095,2105"> Year to simulate and to provide datasets for (such as surface datasets, initial conditions, aerosol-deposition, Nitrogen deposition rates etc.) A sim_year of 1000 corresponds to data used for testing only, NOT corresponding to any real datasets. -A sim_year greater than 2015 corresponds to rcp scenario data +A sim_year greater than 2015 corresponds to ssp_rcp scenario data A sim_year of PtVg refers to the Potential Vegetation dataset, that doesn't include human influences Most years are only used for clm_tools and there aren't CLM datasets that correspond to them. CLM datasets exist for years: 1000 (for testing), 1850, and 2000 From f537355a60f82053239aef33039503f802bf7b8b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Jul 2019 16:49:57 -0600 Subject: [PATCH 0326/1973] Apply the patch for release-clm5.0.21...release-clm5.0.22 --- bld/namelist_files/namelist_defaults_ctsm.xml | 52 +++ tools/README | 303 ++++++++++++++++-- tools/mkmapdata/README | 2 +- tools/mkmapdata/mkmapdata.sh | 40 +-- 4 files changed, 348 insertions(+), 49 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 00cee17cd0..f497bbd07e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1391,6 +1391,8 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_78pfts_CMIP6_simyr1850_c190128.n >lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_10x10min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc +lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODISv2_to_1x1_asphaltjungleNJ_nomask_aave_da_c190507.nc lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS-wCsp_to_1x1_asphaltjungleNJ_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/1x1_brazil/map_10x10min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc +lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODISv2_to_1x1_brazil_nomask_aave_da_c190507.nc lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS-wCsp_to_1x1_brazil_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_10x10min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc +lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODISv2_to_1x1_camdenNJ_nomask_aave_da_c190506.nc lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS-wCsp_to_1x1_camdenNJ_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_10x10min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc +lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODISv2_to_1x1_mexicocityMEX_nomask_aave_da_c190507.nc lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS-wCsp_to_1x1_mexicocityMEX_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/1x1_numaIA/map_10x10min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc +lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODISv2_to_1x1_numaIA_nomask_aave_da_c190507.nc lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS-wCsp_to_1x1_numaIA_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_10x10min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc +lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODISv2_to_1x1_smallvilleIA_nomask_aave_da_c190507.nc lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS-wCsp_to_1x1_smallvilleIA_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_10x10min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc +lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODISv2_to_1x1_urbanc_alpha_nomask_aave_da_c190507.nc lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS-wCsp_to_1x1_urbanc_alpha_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_10x10min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc +lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODISv2_to_1x1_vancouverCAN_nomask_aave_da_c190506.nc lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS-wCsp_to_1x1_vancouverCAN_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner_to_0.47x0.63_nomask_aave_da_c170914.nc lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_LandScan2004_to_0.47x0.63_nomask_aave_da_c170914.nc +lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_MODISv2_to_0.47x0.63_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_MODIS-wCsp_to_0.47x0.63_nomask_aave_da_c170914.nc lnd/clm2/mappingdata/maps/0.9x1.25/map_5x5min_ORNL-Soil_to_0.9x1.25_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS_to_0.9x1.25_nomask_aave_da_c120523.nc +lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODISv2_to_0.9x1.25_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS-wCsp_to_0.9x1.25_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_ORNL-Soil_to_1.9x2.5_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS_to_1.9x2.5_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODISv2_to_1.9x2.5_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS-wCsp_to_1.9x2.5_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/10x15/map_5x5min_ORNL-Soil_to_10x15_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS_to_10x15_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODISv2_to_10x15_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS-wCsp_to_10x15_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/360x720/map_5x5min_ORNL-Soil_to_360x720cru_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS_to_360x720_nomask_aave_da_c120830.nc +lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODISv2_to_360x720cru_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS-wCsp_to_360x720cru_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/512x1024/map_5x5min_ORNL-Soil_to_512x1024_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS_to_512x1024_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODISv2_to_512x1024_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS-wCsp_to_512x1024_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/128x256/map_5x5min_ORNL-Soil_to_128x256_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS_to_128x256_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODISv2_to_128x256_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS-wCsp_to_128x256_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/64x128/map_5x5min_ORNL-Soil_to_64x128_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS_to_64x128_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODISv2_to_64x128_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS-wCsp_to_64x128_nomask_aave_da_c160428.nc lnd/clm2/mappingdata/maps/48x96/map_5x5min_ORNL-Soil_to_48x96_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS_to_48x96_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODISv2_to_48x96_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS-wCsp_to_48x96_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/32x64/map_5x5min_ORNL-Soil_to_32x64_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS_to_32x64_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODISv2_to_32x64_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS-wCsp_to_32x64_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/8x16/map_5x5min_ORNL-Soil_to_8x16_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS_to_8x16_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODISv2_to_8x16_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS-wCsp_to_8x16_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/4x5/map_5x5min_ORNL-Soil_to_4x5_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS_to_4x5_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODISv2_to_4x5_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS-wCsp_to_4x5_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_ORNL-Soil_to_0.23x0.31_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS_to_0.23x0.31_nomask_aave_da_c110930.nc +lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODISv2_to_0.23x0.31_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS-wCsp_to_0.23x0.31_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_ORNL-Soil_to_2.5x3.33_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS_to_2.5x3.33_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODISv2_to_2.5x3.33_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS-wCsp_to_2.5x3.33_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/ne30np4/map_5x5min_ORNL-Soil_to_ne30np4_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS_to_ne30np4_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODISv2_to_ne30np4_nomask_aave_da_c190507.nc lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS-wCsp_to_ne30np4_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_ORNL-Soil_to_ne60np4_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS_to_ne60np4_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODISv2_to_ne60np4_nomask_aave_da_c190507.nc lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS-wCsp_to_ne60np4_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_ORNL-Soil_to_5x5_amazon_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS_to_5x5_amazon_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODISv2_to_5x5_amazon_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS-wCsp_to_5x5_amazon_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_USGS_to_conus_30_x8_nomask_aave_da_c181003.nc lnd/clm2/mappingdata/maps/conus_30_x8/map_0.25x0.25_MODIS_to_conus_30_x8_nomask_aave_da_c181003.nc +lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_MODISv2_to_conus_30_x8_nomask_aave_da_c190505.nc lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_IGBP-GSDP_to_conus_30_x8_nomask_aave_da_c181003.nc diff --git a/tools/README b/tools/README index c8338a1a8e..780e9f6e91 100644 --- a/tools/README +++ b/tools/README @@ -1,42 +1,285 @@ -$CTSMROOT/tools/contrib/README Jan/24/2019 +$CTSMROOT/tools/README Jun/08/2018 -The purpose of this directory is for users of CTSM to contribute scripts for pre or post processing or -case management of CTSM that others might find useful. The script should have some documentation made -available before adding it. These scripts may not be as well tested or supported as other CTSM -tools. They are also ONLY assumed to work on the NCAR supercomputer. So paths will be hardwired to -assume NCAR directory structures. +CLM tools for analysis of CLM history files -- or for creation or +modification of CLM input files. + +I. General directory structure: -The python scripts require the following settings before running on cheyenne: -(Currently that's the singlept and subset_surfdata scripts) + $CTSMROOT/tools + mksurfdata_map --- Create surface datasets. + (NOTE: interpinic now longer included as now an online capability in CLM) -module load python/2.7.14 -ncar_pylib + mkmapgrids ------- Create regular lat/lon SCRIP grid files needed by mkmapdata + mkmapdata -------- Create SCRIP mapping data from SCRIP grid files (uses ESMF) + mkprocdata_map --- Convert output unstructured grids into a 2D format that + can be plotted easily + ncl_scripts ------ NCL post or pre processing scripts. -Brief description of scripts: + contrib ---------- Miscellaneous tools for pre or post processing of CTSM. + Typically these are contributed by anyone who has something + they think might be helpful to the community. They may not + be as well tested or supported as other tools. -run_clm_historical - does all the setup and submission required to do a 1850-2010 CLM - historical simulation in three separate submissions - v1 - Andrew Slater+Dave Lawrence, 8/2015 + cime-tools ($CIMEROOT/tools/) (CIMEROOT is ../cime for a CTSM checkout and ../../../cime for a CESM checkout) + $CIMEROOT/mapping/gen_domain_files + gen_domain ------- Create data model domain datasets from SCRIP mapping datasets. -subset_surfdata - create regional domain, surface data, and rtm directional files by - extracting data from global datasets - v1 - Sean Swenson 8/2015 +II. Notes on building/running for each of the above tools: -singlept - create single point domain, surface data, and datm forcing files by - extracting data from global datasets - v1 - Sean Swenson 8/2015 + Each tool that has FORTRAN source code (mksurfdata_map and mkprocdata_map) has the following files: -SpinupStability.ncl - This script assesses the equilibrium state of a spinup run - works on either monthly or annual mean history files - Keith Oleson 7/2016 + README ------- Specific help for using the specific tool and help on specific + files in that directory. + src/Filepath ----- List of directories needed to build the tool + (some files in ../src directories are required). + src/Makefile ----- GNU Makefile to build the tool + (these are identical between tools. + src/Macros.custom Customization of make macros for the particular tool in question + src/Srcfiles ----- List of source files that are needed. + src/Mkdepends ---- Dependency generator program -run_clmtowers - This script will run any number of flux tower sites. - It's based on having created surface datasets with PTCLM. - v1 - Keith Oleson, 8/2015 + mkmapdata, mkmapgrids and ncl_scripts only contain scripts so don't have the above build files. + Most tools have copies of files from other directories -- see the README.filecopies + file for more information on this. + Tools may also have files with the directory name followed by namelist to provide sample namelists. + + .namelist ------ Namelist to create a global file. + + These files are also used by the test scripts to test the tools (see the + README.testing) file. + + NOTE: Be sure to change the path of the datasets references by these namelists to + point to where you have exported your CESM inputdata datasets. + + To build: + + cd + setenv INC_NETCDF + setenv LIB_NETCDF + gmake + + The process will create a file called "Depends" which has the dependencies + for the build of each file on other files. + + By default some codes may be compiled non-optimized + so that you can use the debugger, and with bounds-checking, and float trapping on. + To speed up do the following... + + gmake OPT=TRUE (by default already on for interpinic and mksurfdata_map) + + Also some of the tools allow for OpenMP shared memory parallelism + (such as interpinic and mksurfdata) with + + gmake SMP=TRUE + + To run a program with a namelist: + + ./program < namelist + + To get help on running a program with command line options (e.g., interpinic): + + ./program + + To run a program built with SMP=TRUE: + + setenv OMP_NUM_THREADS= + + run normally as above + +III. Process sequence to create input datasets needed to run CLM + + 1.) Create SCRIP grid files (if needed) + + a.) For standard resolutions these files will already be created. (done) + + b.) To create regular lat-lon regional/single-point grids run mknoocnmap.pl + + This will create both SCRIP grid files and a mapping file that will + be valid if the region includes NO ocean whatsoever (so you can skip step 2). + You can also use this script to create SCRIP grid files for a region + (or even a global grid) that DOES include ocean if you use step 2 to + create mapping files for it (simply discard the non-ocean map created by + this script). + + Example, for single-point over Boulder Colorado. + + cd mkmapdata + ./mknoocnmap.pl -p 40,255 -n 1x1_boulderCO + + c.) General case + + You'll need to convert or create SCRIP grid files on your own (using scripts + or other tools) for the general case where you have an unstructured grid, or + a grid that is not regular in latitude and longitude. + + example format + ================== + netcdf fv1.9x2.5_090205 { + dimensions: + grid_size = 13824 ; + grid_corners = 4 ; + grid_rank = 2 ; + variables: + double grid_center_lat(grid_size) ; + grid_center_lat:units = "degrees" ; + double grid_center_lon(grid_size) ; + grid_center_lon:units = "degrees" ; + double grid_corner_lat(grid_size, grid_corners) ; + grid_corner_lat:units = "degrees" ; + double grid_corner_lon(grid_size, grid_corners) ; + grid_corner_lon:units = "degrees" ; + int grid_dims(grid_rank) ; + int grid_imask(grid_size) ; + grid_imask:units = "unitless" ; + + 2.) Create ocean to atmosphere mapping file (if needed) + + a.) Standard resolutions (done) + + If this is a standard resolution with a standard ocean resolution -- this + step is already done, the files already exist. + + b.) Region without Ocean (done in step 1.b) + + IF YOU RAN mknoocnmap.pl FOR A REGION WITHOUT OCEAN THIS STEP IS ALREADY DONE. + + c.) New atmosphere or ocean resolution + + If the region DOES include ocean, use $CIMEROOT/tools/mapping/gen_domain_files/gen_maps.sh to create a + mapping file for it. + + Example: + + cd $CIMEROOT/tools/mapping/gen_domain_files + ./gen_maps.sh -focn -fatm -nocn -natm + + + 3.) Add SCRIP grid file(s) created in (1) into XML database in CLM (optional) + + See the "Adding New Resolutions or New Files to the build-namelist Database" + Chapter in the CLM User's Guide + + http://www.cesm.ucar.edu/models/cesm1.0/clm/models/lnd/clm/doc/UsersGuide/book1.html + + If you don't do this step, you'll need to specify the file to mkmapdata + in step (3) using the "-f" option. + + 4.) Create mapping files for use by mksurfdata_map with mkmapdata + (See mkmapdata/README for more help on doing this) + + - this step uses the results of (1) that were entered into the XML database + by step (3). If you don't enter datasets in, you need to specify the + SCRIP grid file using the "-f" option to mkmapdata.sh. + + Example: to generate all necessary mapping files for the ne30np4 grid + + cd mkmapdata + ./mkmapdata.sh -r ne30np4 + + 5.) Add mapping file(s) created in step (4) into XML database in CLM (optional) + + See notes on doing this in step (3) above. + Edit ../bld/namelist_files/namelist_defaults_clm.xml to incorporate new + mapping files. + + If you don't do this step, you'll need to specify the grid resolution name + and file creation dates to mksurfdata_map in step (5) below. + + 6.) Convert map of ocean to atm for use by DATM and CLM with gen_domain + (See $CIMEROOT/tools/mapping/README for more help on doing this) + + - gen_domain uses the map from step (2) (or previously created CESM maps) + + Example: + + cd $CIMEROOT/tools/mapping/gen_domain_files/src + gmake + cd .. + setenv CDATE 090206 + setenv OCNGRIDNAME gx1v6 + setenv ATMGRIDNAME fv1.9x2.5 + setenv MAPFILE $CSMDATA/cpl/cpl6/map_${OCNGRIDNAME}_to_${ATMGRIDNAME}_aave_da_${CDATE}.nc + ./gen_domain -m $MAPFILE -o $OCNGRIDNAME -l $ATMGRIDNAME + + Normally for I compsets running CLM only you will discard the ocean domain + file, and only use the atmosphere domain file for datm and as the fatmlndfrc + file for CLM. Output domain files will be named according to the input OCN/LND + gridnames. + + 7.) Create surface datasets with mksurfdata_map + (See mksurfdata_map/README for more help on doing this) + + - Run mksurfdata_map/mksurfdata.pl + - This step uses the results of step (4) entered into the XML database + in step (5). + - If datasets were NOT entered into the XML database, set the resolution + to "usrspec" and use the "-usr_gname", and "-usr_gdate" options. + + Example: for 0.9x1.25 resolution + + cd mksurfdata_map/src + gmake + cd .. + ./mksurfdata.pl -r 0.9x1.25 + + NOTE that surface dataset will be used by default for fatmgrid - and it will + contain the lat,lon,edges and area values for the atm grid - ASSUMING that + the atm and land grid are the same + + 8.) Interpolate initial conditions using interpinic (optional) + (See interpinic/README for more help on doing this) + + 9.) Add new files to XML data or using user_nl_clm (optional) + + See notes on doing this in step (3) above. + +IV. Example of creating single-point datasets without entering into XML database. + + Here we apply the process described in III. for a single-point dataset + where we don't enter the datasets into the XML database (thus skipping + steps 3, 5 and 9), but use the needed command line options to specify where the + files are. This also skips step (2) since step 1 creates the needed mapping file. + We also skip step (8) and do NOT create a finidat file. + + 0.) Set name of grid to use and the creation date to be used later... + setenv GRIDNAME 1x1_boulderCO + setenv CDATE `date +%y%m%d` + 1.) SCRIP grid and atm to ocn mapping file + cd mkmapdata + ./mknoocnmap.pl -p 40,255 -n $GRIDNAME + # Set pointer to MAPFILE that will be used in step (6) + setenv MAPFILE `pwd`/map_${GRIDNAME}_noocean_to_${GRIDNAME}_nomask_aave_da_${CDATE}.nc + cd ../.. + 2.) skip + 3.) skip + 4.) Mapping files needed for mksurfdata_map + cd mkmapdata + setenv GRIDFILE ../mkmapgrids/SCRIPgrid_${GRIDNAME}_nomask_${CDATE}.nc + ./mkmapdata.sh -r $GRIDNAME -f $GRIDFILE -t regional + cd ../.. + 5.) skip + 6.) Generate domain file for datm and CLM + cd $CIMEROOT/tools/mapping/gen_domain_files/src + gmake + cd .. + setenv OCNDOM domain.ocn_noocean.nc + setenv ATMDOM domain.lnd.{$GRIDNAME}_noocean.nc + ./gen_domain -m $MAPFILE -o $OCNDOM -l $ATMDOM + 7.) Create surface dataset for CLM + cd mksurfdata_map/src + gmake + cd .. + ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE + 8.) skip + 9.) skip + +V. Notes on which input datasets are needed for CLM + + global or regional/single-point grids + - need fsurdata and fatmlndfrc + + fsurdata ---- from mksurfdata_map in step (III.7) + fatmlndfrc -- use the domain.lnd file from gen_domain in step (III.6) diff --git a/tools/mkmapdata/README b/tools/mkmapdata/README index 3f5e9e92c2..f2a0b793db 100644 --- a/tools/mkmapdata/README +++ b/tools/mkmapdata/README @@ -76,7 +76,7 @@ That will enable the --netcdf4 and --64bit_offset options to be used. Important files: regridbatch.sh ------- Script to run mkmapdata.sh for many resolutions on cheyenne - regridgeyser.sh ------ Script to run mkmapdata.sh for many resolutions on geyser + regriddav.sh --------- Script to run mkmapdata.sh for many resolutions on the DAV cluster (Casper) mvNimport.sh --------- Script to copy and import mapping files in for many resolutions mkmapdata.sh --------- Script to create mapping datasets for a given resolution diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index 436b504e07..02d52fe6d7 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -90,7 +90,7 @@ usage() { echo " REGRID_PROC -- Number of MPI processors to use" echo " (default is $REGRID_PROC)" echo "" - echo "**defaults can be determined on the machines: cheyenne or geyser" + echo "**defaults can be determined on the machines: cheyenne or casper" echo "" echo "**pass environment variables by preceding above commands " echo " with 'env var1=setting var2=setting '" @@ -349,12 +349,10 @@ case $hostname in module load ncl module load nco - if [ "$interactive" = "NO" ]; then + if [[ $REGRID_PROC > 1 ]]; then mpi=mpi - mpitype="mpich2" else mpi=uni - mpitype="mpiuni" fi module load esmf-${esmfvers}-ncdfio-${mpi}-O if [ -z "$ESMFBIN_PATH" ]; then @@ -366,35 +364,43 @@ case $hostname in ;; ## DAV - pronghorn* | caldera* | geyser* ) + pronghorn* | casper* ) . /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/bash if [ -z "$REGRID_PROC" ]; then REGRID_PROC=8 fi + echo "REGRID_PROC=$REGRID_PROC" esmfvers=7.1.0r - intelvers=15.0.0 - #intelvers=12.1.5 + intelvers=17.0.1 module purge module load intel/$intelvers + if [ $? != 0 ]; then + echo "Error doing module load: intel/$intelvers" + exit 1 + fi module load ncl module load nco - #module load impi - module load mpich-slurm - module load netcdf/4.3.3.1 - #module load netcdf/4.3.0 + module load netcdf module load ncarcompilers - module load esmf + module load esmflibs/$esmfvers + if [ $? != 0 ]; then + echo "Error doing module load: esmflibs/$esmfvers" + exit 1 + fi - if [ "$interactive" = "NO" ]; then + if [[ $REGRID_PROC > 1 ]]; then mpi=mpi - mpitype="mpich2" + echo "MPI option is NOT currently available" + exit 1 else mpi=uni - mpitype="mpiuni" fi - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/gcc/x86_64-redhat-linux/4.4.7:/usr/lib64:/glade/apps/opt/usr/lib:/usr/lib:/glade/u/ssg/ys/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64:/lib:/lib64" module load esmf-${esmfvers}-ncdfio-${mpi}-O + if [ $? != 0 ]; then + echo "Error doing module load: esmf-${esmfvers}-ncdfio-${mpi}-O" + exit 1 + fi if [ -z "$ESMFBIN_PATH" ]; then ESMFBIN_PATH=`grep ESMF_APPSDIR $ESMFMKFILE | awk -F= '{print $2}'` fi @@ -404,8 +410,6 @@ case $hostname in if [ -z "$MPIEXEC" ]; then MPIEXEC="mpiexec -n $REGRID_PROC" fi - echo "ERROR: Currently can NOT run on the DAV cluster, because ESMF is not configured correctly" - exit 1 ;; ##no other machine currently supported From 8a023162460b51e34eebecef416a33625faf5414 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 11 Jul 2019 15:56:49 -0600 Subject: [PATCH 0327/1973] Get the indexing correct for the use of the prescribed moisture stream array that is a 1D array, so you have to account for the number of levels in the index for it. Still need to get a 3D GSMAP to get this to work --- src/biogeophys/SoilMoistureStreamMod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index bf695d985c..ff29e90e2f 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -205,7 +205,7 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst ! ! !LOCAL VARIABLES: - integer :: c, g, j, ism, ig + integer :: c, g, j, ism, ig, n integer :: year ! year (0, ...) for nstep+1 integer :: mon ! month (1, ..., 12) for nstep+1 integer :: day ! day of month (1, ..., 31) for nstep+1 @@ -270,7 +270,8 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & moisture_increment = h2osoi_vol(c,j) ! update volumetric soil moisture - !fix h2osoi_vol(c,j) = sdat_soilm%avs(1)%rAttr(ism,ig,:) !wrong!!!!! + n = ig + (j-1)*ldomain%ni*ldomain%nj + h2osoi_vol(c,j) = sdat_soilm%avs(1)%rAttr(ism,n) h2osoi_vol(c,j) = min(h2osoi_vol(c,j), watsat(c, j)) ! calculate liq/ice mass fractions From 8d71d62b791c61d21f1b9172d2c4bfb35065f711 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 12 Jul 2019 13:20:17 -0600 Subject: [PATCH 0328/1973] Get the 3D grid GSmap setup and working when the prescribed soil moisture streams are turned on --- src/biogeophys/SoilMoistureStreamMod.F90 | 4 +- src/main/clm_initializeMod.F90 | 5 ++- src/main/decompInitMod.F90 | 51 ++++++++++++++++++++++++ src/main/decompMod.F90 | 14 ++++--- 4 files changed, 64 insertions(+), 10 deletions(-) diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index ff29e90e2f..0420366aa4 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -16,7 +16,7 @@ module SoilMoistureStreamMod use clm_varctl , only : iulog, use_soil_moisture_streams use clm_varcon , only : grlnd use controlMod , only : NLFilename - use decompMod , only : gsmap_lnd_gdc2glo + use decompMod , only : gsMap_lnd2Dsoi_gdc2glo use domainMod , only : ldomain use fileutils , only : getavu, relavu use ColumnType , only : col @@ -151,7 +151,7 @@ subroutine PrescribedSoilMoistureInit(bounds) pio_subsystem=pio_subsystem, & pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & + gsmap=gsMap_lnd2Dsoi_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & nzg=nlevsoi, & yearFirst=stream_year_first_soilm, & diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index f61e647044..01e0d3cdb8 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -46,12 +46,12 @@ subroutine initialize1( ) ! CLM initialization first phase ! ! !USES: - use clm_varpar , only: clm_varpar_init, natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec + use clm_varpar , only: clm_varpar_init, natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec, nlevsoi use clm_varcon , only: clm_varcon_init use landunit_varcon , only: landunit_varcon_init, max_lunit use clm_varctl , only: fsurdat, fatmlndfrc, noland, version use pftconMod , only: pftcon - use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp + use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp, decompInit_lnd3D use domainMod , only: domain_check, ldomain, domain_init use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data, surfrd_get_num_patches use controlMod , only: control_init, control_print, NLFilename @@ -127,6 +127,7 @@ subroutine initialize1( ) call decompInit_lnd(ni, nj, amask) deallocate(amask) + if(use_soil_moisture_streams) call decompInit_lnd3D(ni, nj, nlevsoi) ! *** Get JUST gridcell processor bounds *** ! Remaining bounds (landunits, columns, patches) will be determined ! after the call to decompInit_glcp - so get_proc_bounds is called diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 709c0b5e36..cef1bd7f00 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -27,6 +27,7 @@ module decompInitMod ! ! !PUBLIC MEMBER FUNCTIONS: public decompInit_lnd ! initializes lnd grid decomposition into clumps and processors + public decompInit_lnd3D ! initializes lnd grid 3D decomposition public decompInit_clumps ! initializes atm grid decomposition into clumps public decompInit_glcp ! initializes g,l,c,p decomp info ! @@ -312,6 +313,56 @@ subroutine decompInit_lnd(lni,lnj,amask) end subroutine decompInit_lnd + !------------------------------------------------------------------------------ + subroutine decompInit_lnd3D(lni,lnj,lnk) + ! + ! !DESCRIPTION: + ! + ! Create a 3D decomposition gsmap for the global 2D grid with soil levels + ! as the 3rd dimesnion. + ! + ! !USES: + ! + ! !ARGUMENTS: + implicit none + integer , intent(in) :: lni,lnj,lnk ! domain global size + ! + ! !LOCAL VARIABLES: + integer :: n,k ! indices + integer :: beg,end,lsize,gsize ! used for gsmap init + integer, pointer :: gindex(:) ! global index for gsmap init + + + ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) + + call get_proc_bounds(beg, end) + allocate(gindex(beg:end*lnk)) + do k = 1, lnk + do n = beg,end + gindex(n) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) + enddo + enddo + lsize = end*lnk-beg+1 + gsize = lni * lnj * lnk + call mct_gsMap_init(gsMap_lnd2Dsoi_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) + deallocate(gindex) + + ! Diagnostic output + + if (masterproc) then + write(iulog,*)' 2D GSMap' + write(iulog,*)' longitude points = ',lni + write(iulog,*)' latitude points = ',lnj + write(iulog,*)' soil levels = ',lnk + write(iulog,*)' gsMap Characteristics' + write(iulog,*) ' lnd gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lnd2Dsoi_gdc2glo) + write(iulog,*) + end if + + call shr_sys_flush(iulog) + + end subroutine decompInit_lnd3D + !------------------------------------------------------------------------------ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) ! diff --git a/src/main/decompMod.F90 b/src/main/decompMod.F90 index 13204fabca..3f885e090b 100644 --- a/src/main/decompMod.F90 +++ b/src/main/decompMod.F90 @@ -118,12 +118,14 @@ module decompMod public decomp_type type(decomp_type),public,target :: ldecomp - type(mct_gsMap) ,public,target :: gsMap_lnd_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_gce_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_lun_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_col_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_patch_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_cohort_gdc2glo + type(mct_gsMap) ,public,target :: gsMap_lnd_gdc2glo ! GS map for full 2D land grid + type(mct_gsMap) ,public,target :: gsMap_gce_gdc2glo ! GS map for 1D gridcells + type(mct_gsMap) ,public,target :: gsMap_lun_gdc2glo ! GS map for 1D landunits + type(mct_gsMap) ,public,target :: gsMap_col_gdc2glo ! GS map for 1d columns + type(mct_gsMap) ,public,target :: gsMap_patch_gdc2glo ! GS map for 1D patches + type(mct_gsMap) ,public,target :: gsMap_cohort_gdc2glo ! GS map for 1D cohorts (only for FATES) + + type(mct_gsMap) ,public,target :: gsMap_lnd2Dsoi_gdc2glo ! GS map for full 3D land grid with soil levels as 3rd dim !------------------------------------------------------------------------------ contains From 7db097fb38937415d96ef6af50595fd2a0a2e69f Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 12 Jul 2019 14:09:03 -0600 Subject: [PATCH 0329/1973] modify indexing of gindex --- src/main/decompInitMod.F90 | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index cef1bd7f00..f0880953ec 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -328,21 +328,32 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) integer , intent(in) :: lni,lnj,lnk ! domain global size ! ! !LOCAL VARIABLES: - integer :: n,k ! indices + integer :: m,n,k ! indices integer :: beg,end,lsize,gsize ! used for gsmap init integer, pointer :: gindex(:) ! global index for gsmap init ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) - call get_proc_bounds(beg, end) - allocate(gindex(beg:end*lnk)) +!!$ call get_proc_bounds(beg, end) +!!$ allocate(gindex(beg:end*lnk)) +!!$ do k = 1, lnk +!!$ do n = beg,end +!!$ gindex(n) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) +!!$ enddo +!!$ enddo +!!$ lsize = end*lnk-beg+1 + + lsize = (end-beg+1)*lnk + write(iulog,*) 'decomp3d: ', lni,lnj,lnk, lsize, beg,end + allocate(gindex(1:lsize)) do k = 1, lnk - do n = beg,end - gindex(n) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) - enddo + do n = beg,end + m = (k-1)*(end-beg+1)+k + gindex(m) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) + enddo enddo - lsize = end*lnk-beg+1 + gsize = lni * lnj * lnk call mct_gsMap_init(gsMap_lnd2Dsoi_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) deallocate(gindex) @@ -350,7 +361,7 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) ! Diagnostic output if (masterproc) then - write(iulog,*)' 2D GSMap' + write(iulog,*)' 3D GSMap' write(iulog,*)' longitude points = ',lni write(iulog,*)' latitude points = ',lnj write(iulog,*)' soil levels = ',lnk From 0a7f53a5e15d876fa0491490c94d9baea008b91c Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 12 Jul 2019 14:19:58 -0600 Subject: [PATCH 0330/1973] add back get_proc_bounds call --- src/main/decompInitMod.F90 | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index f0880953ec..21dcae1418 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -335,17 +335,8 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) -!!$ call get_proc_bounds(beg, end) -!!$ allocate(gindex(beg:end*lnk)) -!!$ do k = 1, lnk -!!$ do n = beg,end -!!$ gindex(n) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) -!!$ enddo -!!$ enddo -!!$ lsize = end*lnk-beg+1 - + call get_proc_bounds(beg, end) lsize = (end-beg+1)*lnk - write(iulog,*) 'decomp3d: ', lni,lnj,lnk, lsize, beg,end allocate(gindex(1:lsize)) do k = 1, lnk do n = beg,end From ea3e1c29d31b6d73c7a996ec208b7fd1bb1098f4 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 12 Jul 2019 14:25:29 -0600 Subject: [PATCH 0331/1973] fix m index --- src/main/decompInitMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 21dcae1418..74a2c8804e 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -340,7 +340,7 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) allocate(gindex(1:lsize)) do k = 1, lnk do n = beg,end - m = (k-1)*(end-beg+1)+k + m = (k-1)*(end-beg+1)+(n-beg+1) gindex(m) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) enddo enddo From 2864be092feac394488bedd1a96d0f491d5ec8f5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 14 Jul 2019 22:54:15 -0600 Subject: [PATCH 0332/1973] Changes required for soil_moisture streams, get the right year for the file, and 3D grids don't allow mapping, so set mapping to none --- bld/namelist_files/namelist_defaults_ctsm.xml | 8 ++++---- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 9373092bd9..50355b75e9 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1018,13 +1018,13 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc .false. -1980 -1980 -1980 +1997 +1997 +1997 /project/tss/swensosc/MIPs/LS3MIP/LFMIP-pdLC-SST.H2OSOI.natveg.1980-2014.MONS_climo.nc -bilinear +none .false. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index f7510efd6d..432bc4d215 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1642,7 +1642,7 @@ Filename of input stream data for USTAR + group="soil_moisture_streams" valid_values="none,bilinear,nn,nnoni,nnonj,spval,copy" > From 4e798eb7f31f926ebe701ac8576f14cec030a219 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 14 Jul 2019 22:55:51 -0600 Subject: [PATCH 0333/1973] Add nlevel option to clm_domain_mct for 3D grid to dom_clm --- src/main/ndepStreamMod.F90 | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/main/ndepStreamMod.F90 b/src/main/ndepStreamMod.F90 index e4acd648b8..79bd86234d 100644 --- a/src/main/ndepStreamMod.F90 +++ b/src/main/ndepStreamMod.F90 @@ -15,7 +15,7 @@ module ndepStreamMod use clm_varctl , only: iulog use abortutils , only: endrun use fileutils , only: getavu, relavu - use decompMod , only: bounds_type, ldecomp, gsmap_lnd_gdc2glo + use decompMod , only: bounds_type, ldecomp use domainMod , only: ldomain ! !PUBLIC TYPES: @@ -58,6 +58,7 @@ subroutine ndep_init(bounds, NLFilename) use shr_nl_mod , only : shr_nl_find_group_name use shr_log_mod , only : errMsg => shr_log_errMsg use shr_mpi_mod , only : shr_mpi_bcast + use decompMod , only : gsmap_lnd_gdc2glo ! ! arguments implicit none @@ -258,7 +259,7 @@ subroutine ndep_interp(bounds, atm2lnd_inst) end subroutine ndep_interp !============================================================================== - subroutine clm_domain_mct(bounds, dom_clm) + subroutine clm_domain_mct(bounds, dom_clm, nlevels) !------------------------------------------------------------------- ! Set domain data type for internal clm grid @@ -268,24 +269,37 @@ subroutine clm_domain_mct(bounds, dom_clm) use mct_mod , only : mct_ggrid, mct_gsMap_lsize, mct_gGrid_init use mct_mod , only : mct_gsMap_orderedPoints, mct_gGrid_importIAttr use mct_mod , only : mct_gGrid_importRAttr + use mct_mod , only : mct_gsMap + use decompMod , only : gsmap_lnd_gdc2glo, gsMap_lnd2Dsoi_gdc2glo implicit none ! ! arguments type(bounds_type), intent(in) :: bounds type(mct_ggrid), intent(out) :: dom_clm ! Output domain information for land model + integer, intent(in), optional :: nlevels ! Number of levels if this is a 3D field ! ! local variables - integer :: g,i,j ! index + integer :: g,i,j,k ! index integer :: lsize ! land model domain data size real(r8), pointer :: data(:) ! temporary integer , pointer :: idata(:) ! temporary + integer :: nlevs ! Number of vertical levels + type(mct_gsMap), pointer :: gsmap => null() ! MCT GS map !------------------------------------------------------------------- + ! SEt number of levels, and get the GS map for either the 2D or 3D grid + nlevs = 1 + if ( present(nlevels) ) nlevs = nlevels + if ( nlevs == 1 ) then + gsmap => gsmap_lnd_gdc2glo + else + gsmap => gsMap_lnd2Dsoi_gdc2glo + end if ! ! Initialize mct domain type ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) ! Note that in addition land carries around landfrac for the purposes of domain checking ! - lsize = mct_gsMap_lsize(gsmap_lnd_gdc2glo, mpicom) + lsize = mct_gsMap_lsize(gsmap, mpicom) call mct_gGrid_init( GGrid=dom_clm, CoordChars=trim(seq_flds_dom_coord), & OtherChars=trim(seq_flds_dom_other), lsize=lsize ) ! @@ -295,7 +309,8 @@ subroutine clm_domain_mct(bounds, dom_clm) ! ! Determine global gridpoint number attribute, GlobGridNum, which is set automatically by MCT ! - call mct_gsMap_orderedPoints(gsmap_lnd_gdc2glo, iam, idata) + call mct_gsMap_orderedPoints(gsmap, iam, idata) + gsmap => null() call mct_gGrid_importIAttr(dom_clm,'GlobGridNum',idata,lsize) ! ! Determine domain (numbering scheme is: West to East and South to North to South pole) @@ -314,34 +329,44 @@ subroutine clm_domain_mct(bounds, dom_clm) ! Fill in correct values for domain components ! Note aream will be filled in in the atm-lnd mapper ! + do k = 1, nlevs do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = ldomain%lonc(g) end do + end do call mct_gGrid_importRattr(dom_clm,"lon",data,lsize) + do k = 1, nlevs do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = ldomain%latc(g) end do + end do call mct_gGrid_importRattr(dom_clm,"lat",data,lsize) + do k = 1, nlevs do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = ldomain%area(g)/(re*re) end do + end do call mct_gGrid_importRattr(dom_clm,"area",data,lsize) + do k = 1, nlevs do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = real(ldomain%mask(g), r8) end do + end do call mct_gGrid_importRattr(dom_clm,"mask",data,lsize) + do k = 1, nlevs do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = real(ldomain%frac(g), r8) end do + end do call mct_gGrid_importRattr(dom_clm,"frac",data,lsize) deallocate(data) From 3cd9ab95e19798dcdd9cec35842a304dbe235814 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 14 Jul 2019 22:56:57 -0600 Subject: [PATCH 0334/1973] Change beg:end to begg:endg since end is a keyword in fortran --- src/main/decompInitMod.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 74a2c8804e..45b04442e6 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -329,18 +329,18 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) ! ! !LOCAL VARIABLES: integer :: m,n,k ! indices - integer :: beg,end,lsize,gsize ! used for gsmap init - integer, pointer :: gindex(:) ! global index for gsmap init + integer :: begg,endg,lsize,gsize ! used for gsmap init + integer, pointer :: gindex(:) ! global index for gsmap init ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) - call get_proc_bounds(beg, end) - lsize = (end-beg+1)*lnk + call get_proc_bounds(begg, endg) + lsize = (endg-begg+1)*lnk allocate(gindex(1:lsize)) do k = 1, lnk - do n = beg,end - m = (k-1)*(end-beg+1)+(n-beg+1) + do n = begg,endg + m = (k-1)*(endg-begg+1)+(n-begg+1) gindex(m) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) enddo enddo From 6b9d6c425bede3cb055d90346cd352a47ae2841f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 14 Jul 2019 22:58:39 -0600 Subject: [PATCH 0335/1973] Pass nlevels to clm_domain_mct for the 3D grid of soil moisture streams --- src/biogeophys/SoilMoistureStreamMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 0420366aa4..2b849405ab 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -82,7 +82,7 @@ subroutine PrescribedSoilMoistureInit(bounds) integer :: nml_error ! namelist i/o error flag type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldfilename_soilm ! ustar stream filename to read - character(len=CL) :: soilm_mapalgo = 'bilinear' ! Mapping alogrithm + character(len=CL) :: soilm_mapalgo = 'none' ! Mapping alogrithm character(*), parameter :: subName = "('soil_moisture_init')" character(*), parameter :: F00 = "('(soil_moisture_init) ',4a)" @@ -138,7 +138,7 @@ subroutine PrescribedSoilMoistureInit(bounds) endif - call clm_domain_mct (bounds, dom_clm) + call clm_domain_mct (bounds, dom_clm, nlevels=nlevsoi) ! ! create the field list for these fields...use in shr_strdata_create From 3864119f8a4657e3a00cf96215e5b5aea7613f66 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 15 Jul 2019 14:55:26 -0600 Subject: [PATCH 0336/1973] broadcast use_soil_moisture_streams and add begg3d, endg3d indices --- src/main/controlMod.F90 | 2 ++ src/main/decompInitMod.F90 | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 668dd25cfa..a26c004b7c 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -764,6 +764,8 @@ subroutine control_spmd() call mpi_bcast (use_luna, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_soil_moisture_streams, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_lai_streams, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_bedrock, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 45b04442e6..435841dd33 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -286,6 +286,7 @@ subroutine decompInit_lnd(lni,lnj,amask) ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) call get_proc_bounds(beg, end) + allocate(gindex(beg:end)) do n = beg,end gindex(n) = ldecomp%gdc2glo(n) @@ -330,23 +331,29 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) ! !LOCAL VARIABLES: integer :: m,n,k ! indices integer :: begg,endg,lsize,gsize ! used for gsmap init + integer :: begg3d,endg3d integer, pointer :: gindex(:) ! global index for gsmap init ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) - call get_proc_bounds(begg, endg) - lsize = (endg-begg+1)*lnk - allocate(gindex(1:lsize)) + begg3d = (begg-1)*lnk + 1 + endg3d = endg*lnk + lsize = (endg3d - begg3d + 1 ) + allocate(gindex(begg3d:endg3d)) do k = 1, lnk do n = begg,endg - m = (k-1)*(endg-begg+1)+(n-begg+1) + m = (begg-1)*lnk + (k-1)*(endg-begg+1) + (n-begg+1) gindex(m) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) +! write(*,*) 'm3d: ', m +! write(*,*) 'm3d: ', m,ldecomp%gdc2glo(n),gindex(m) enddo enddo gsize = lni * lnj * lnk + call mct_gsMap_init(gsMap_lnd2Dsoi_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) + deallocate(gindex) ! Diagnostic output From 9d2784d05df876a2e213f0fc105649734de2baed Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 15 Jul 2019 15:43:27 -0600 Subject: [PATCH 0337/1973] Change indexing, write some info on gsmap before running it --- src/main/decompInitMod.F90 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 45b04442e6..1c4a4a1b4f 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -338,24 +338,29 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) call get_proc_bounds(begg, endg) lsize = (endg-begg+1)*lnk allocate(gindex(1:lsize)) + m = 0 do k = 1, lnk do n = begg,endg - m = (k-1)*(endg-begg+1)+(n-begg+1) + m = m+1 gindex(m) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) enddo enddo gsize = lni * lnj * lnk + if (masterproc) then + write(iulog,*)' 3D GSMap' + write(iulog,*)' longitude points = ',lni + write(iulog,*)' latitude points = ',lnj + write(iulog,*)' soil levels = ',lnk + write(iulog,*)' gsize = ',gsize + write(iulog,*)' lsize = ',lsize + end if call mct_gsMap_init(gsMap_lnd2Dsoi_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) deallocate(gindex) ! Diagnostic output if (masterproc) then - write(iulog,*)' 3D GSMap' - write(iulog,*)' longitude points = ',lni - write(iulog,*)' latitude points = ',lnj - write(iulog,*)' soil levels = ',lnk write(iulog,*)' gsMap Characteristics' write(iulog,*) ' lnd gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lnd2Dsoi_gdc2glo) write(iulog,*) From 652988ff177da7a25dff348e71a37c34531be9c8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 16 Jul 2019 16:33:11 -0600 Subject: [PATCH 0338/1973] Apply patch of release-clm5.0.22 to release-clm5.0.25 to master --- bld/namelist_files/namelist_defaults_ctsm.xml | 195 ++++++------------ .../namelist_defaults_ctsm_tools.xml | 4 + .../namelist_definition_ctsm.xml | 4 +- bld/unit_testers/build-namelist_test.pl | 29 ++- cime_config/config_component.xml | 10 +- cime_config/config_compsets.xml | 19 ++ cime_config/testdefs/testlist_clm.xml | 40 +++- .../cmip6_waccm_nociso_deck/README | 17 ++ .../cmip6_waccm_nociso_deck/include_user_mods | 2 + tools/mksurfdata_map/src/mksurfdat.F90 | 22 +- tools/ncl_scripts/getco2_historical.ncl | 5 +- 11 files changed, 195 insertions(+), 152 deletions(-) create mode 100644 cime_config/usermods_dirs/cmip6_waccm_nociso_deck/README create mode 100644 cime_config/usermods_dirs/cmip6_waccm_nociso_deck/include_user_mods diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f497bbd07e..7828aa2153 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -88,7 +88,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). Ball-Berry1987 -lnd/clm2/isotopes/atm_delta_C13_CMIP6_1850-2015_yearly_v2.0_c171012.nc +lnd/clm2/isotopes/atm_delta_C13_CMIP6_1850-2015_yearly_v2.0_c190528.nc lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP119_1850-2100_yearly_c181209.nc lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP126_1850-2100_yearly_c181209.nc lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP245_1850-2100_yearly_c181209.nc @@ -96,7 +96,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP534os_1850-2100_yearly_c181209.nc lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP5B_1850-2100_yearly_c181209.nc -lnd/clm2/isotopes/atm_delta_C14_CMIP6_3x1_global_1850-2015_yearly_v2.0_c171012.nc +lnd/clm2/isotopes/atm_delta_C14_CMIP6_3x1_global_1850-2015_yearly_v2.0_c190528.nc lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP119_3x1_global_1850-2100_yearly_c181209.nc lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP126_3x1_global_1850-2100_yearly_c181209.nc lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP245_3x1_global_1850-2100_yearly_c181209.nc @@ -738,8 +738,6 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_4x5_hist_16pfts_Irrig_CMIP6_sim lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_10x15_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc - -lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne120np4_hist_16pfts_Irrig_CMIP6_simyr2000_c190304.nc lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_16pfts_Irrig_CMIP6_simyr2000_c190303.nc @@ -748,9 +746,6 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne16np4_hist_16pfts_Irrig_CMIP6 lnd/clm2/surfdata_map/surfdata_0.125nldas2_hist_16pfts_Irrig_CMIP6_simyr2005_c190412.nc - -lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_conus_30_x8_hist_16pfts_Irrig_CMIP6_simyr2000_c190128.nc - lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_5x5_amazon_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc @@ -776,16 +771,11 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_smallvilleIA_hist_78pfts_CMIP6_simyr2000_c190214.nc - -lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne120np4_hist_78pfts_CMIP6_simyr2000_c190304.nc lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c190303.nc lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne16np4_hist_78pfts_CMIP6_simyr2000_c190214.nc - -lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_78pfts_CMIP6_simyr2000_c190128.nc - lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_camdenNJ_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc @@ -813,14 +803,9 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_4x5_hist_16pfts_Irrig_CMIP6_sim lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850_c190214.nc - -lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850_c190304.nc lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850_c190303.nc - -lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_16pfts_Irrig_CMIP6_simyr1850_c190128.nc - lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_48x96_hist_78pfts_CMIP6_simyr1850_c190214.nc @@ -841,14 +826,9 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_78pfts_CMIP6_simyr1850_c190214.nc - -lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne120np4_hist_78pfts_CMIP6_simyr1850_c190304.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_78pfts_CMIP6_simyr1850_c190128.nc - lnd/clm2/surfdata_map/surfdata_0.9x1.25_hist_16pfts_nourb_CMIP6_simyrPtVg_c181114.nc @@ -869,14 +849,9 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_78pfts_CMIP6_simyr1850_c190128.n lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c1908304.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_conus_30_x8_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c181003.nc - lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c190304.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c179824.nc -lnd/clm2/surfdata_map/landuse.timeseries_conus_30_x8_hist_78pfts_CMIP6_simyr1850-2015_c181004.nc - 2000 2000 -1850 -2015 - lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc -lnd/clm2/ndepdata/fndep_clm_SSP585_b.e21.BWSSP585cmip6.f09_g17.CMIP6-SSP5-8.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190211.nc +lnd/clm2/ndepdata/fndep_clm_SSP585_b.e21.BWSSP585cmip6.f09_g17.CMIP6-SSP5-8.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190211.nc lnd/clm2/ndepdata/fndep_clm_SSP126_b.e21.BWSSP126cmip6.f09_g17.CMIP6-SSP1-2.6-WACCM.001_2014-2101_monthly_0.9x1.25_c190221.nc @@ -1127,29 +1095,9 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_78pfts_CMIP6_simyr1850_c190128.n NDEP_month limit - -extend -NDEP_year -lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc - - -lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100810.nc -lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp8.5_simyr1849-2106_1.9x2.5_c100428.nc +cycle +NDEP_month +limit bilinear @@ -2063,80 +2011,6 @@ lnd/clm2/surfdata_map/surfdata_conus_30_x8_hist_78pfts_CMIP6_simyr1850_c190128.n lnd/clm2/mappingdata/maps/48x96/map_1km-merge-10min_HYDRO1K-merge-nomask_to_48x96_nomask_aave_da_c130405.nc -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_MODIS_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_0.25x0.25_MODIS_to_32x64_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_AVHRR_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_10x10min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_IGBP-GSDP_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ISRIC-WISE_to_32x64_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ORNL-Soil_to_32x64_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS_to_32x64_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODISv2_to_32x64_nomask_aave_da_c190505.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS-wCsp_to_32x64_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_USGS_to_32x64_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_LandScan2004_to_32x64_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner-mergeGIS_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_0.9x1.25_GRDC_to_32x64_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/32x64/map_360x720_cruncep_to_32x64_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/32x64/map_1km-merge-10min_HYDRO1K-merge-nomask_to_32x64_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_MODIS_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_0.25x0.25_MODIS_to_8x16_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_AVHRR_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_10x10min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_IGBP-GSDP_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ISRIC-WISE_to_8x16_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ORNL-Soil_to_8x16_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS_to_8x16_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODISv2_to_8x16_nomask_aave_da_c190505.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS-wCsp_to_8x16_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_USGS_to_8x16_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_LandScan2004_to_8x16_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner-mergeGIS_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_0.9x1.25_GRDC_to_8x16_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/8x16/map_360x720_cruncep_to_8x16_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/8x16/map_1km-merge-10min_HYDRO1K-merge-nomask_to_8x16_nomask_aave_da_c130411.nc - lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_MODIS_to_4x5_nomask_aave_da_c110822.nc lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_ORNL-Soil_to_ne4np4_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS_to_ne4np4_nomask_aave_da_c120906.nc +lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODISv2_to_ne4np4_nomask_aave_da_c190514.nc lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS-wCsp_to_ne4np4_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_MODIS_to_ne16np4_nomask_aave_da_c110922.nc lnd/clm2/mappingdata/maps/ne16np4/map_0.25x0.25_MODIS_to_ne16np4_nomask_aave_da_c170321.nc +lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_MODISv2_to_ne16np4_nomask_aave_da_c190514.nc lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_AVHRR_to_ne16np4_nomask_aave_da_c110922.nc lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_irrig_to_ne120np4_aave_da_110817.nc lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS_to_ne120np4_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODISv2_to_ne120np4_nomask_aave_da_c190514.nc lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS-wCsp_to_ne120np4_nomask_aave_da_c160425.nc lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_ORNL-Soil_to_ne240np4_nomask_aave_da_c170706.nc lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS_to_ne240np4_nomask_aave_da_c111111.nc +lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODISv2_to_ne240np4_nomask_aave_da_c190514.nc lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS-wCsp_to_ne240np4_nomask_aave_da_c160425.nc + + + +lnd/clm2/mappingdata/maps/94x192/map_3x3min_USGS_to_94x192_nomask_aave_da_c120926.nc +lnd/clm2/mappingdata/maps/94x192/map_0.5x0.5_nomask_to_94x192_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_5x5min_ORNL-Soil_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_94x192_nomask_to_0.5x0.5_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_5x5min_IGBP-GSDP_to_94x192_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_3x3min_MODIS-wCsp_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_1km-merge-10min_HYDRO1K-merge-nomask_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_0.5x0.5_MODIS_to_94x192_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_5x5min_nomask_to_94x192_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_0.5x0.5_USGS_to_94x192_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_0.9x1.25_GRDC_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_10x10min_nomask_to_94x192_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_10x10min_IGBPmergeICESatGIS_to_94x192_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_3x3min_LandScan2004_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_360x720cru_cruncep_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_3x3min_GLOBE-Gardner_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_0.25x0.25_MODIS_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_0.5x0.5_AVHRR_to_94x192_nomask_aave_da_c110823.nc +lnd/clm2/mappingdata/maps/94x192/map_5x5min_ISRIC-WISE_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_3x3min_GLOBE-Gardner-mergeGIS_to_94x192_nomask_aave_da_c190521.nc +lnd/clm2/mappingdata/maps/94x192/map_3x3min_MODISv2_to_94x192_nomask_aave_da_c190521.nc + + diff --git a/bld/namelist_files/namelist_defaults_ctsm_tools.xml b/bld/namelist_files/namelist_defaults_ctsm_tools.xml index 0c1b365782..8c33e29fdc 100644 --- a/bld/namelist_files/namelist_defaults_ctsm_tools.xml +++ b/bld/namelist_files/namelist_defaults_ctsm_tools.xml @@ -989,16 +989,20 @@ attributes from the config_cache.xml file (with keys converted to upper-case). atm/waccm/lb/LBC_17500116-20150116_CMIP6_0p5degLat_c180905.nc atm/waccm/lb/LBC_1750-2015_CMIP6_GlobAnnAvg_c180926.nc +atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP119_0p5degLat_c190514.nc atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP126_0p5degLat_c180905.nc atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP245_0p5degLat_c180905.nc atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP370_0p5degLat_c180905.nc +atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP119_0p5degLat_c190514.nc atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP460_0p5degLat_c180905.nc atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP534os_0p5degLat_c180905.nc atm/waccm/lb/LBC_20140116-25001216_CMIP6_SSP585_0p5degLat_c180905.nc +atm/waccm/lb/LBC_2014-2500_CMIP6_SSP119_0p5degLat_GlobAnnAvg_c190514.nc atm/waccm/lb/LBC_2014-2500_CMIP6_SSP126_0p5degLat_GlobAnnAvg_c190301.nc atm/waccm/lb/LBC_2014-2500_CMIP6_SSP245_0p5degLat_GlobAnnAvg_c190301.nc atm/waccm/lb/LBC_2014-2500_CMIP6_SSP370_0p5degLat_GlobAnnAvg_c190301.nc +atm/waccm/lb/LBC_2014-2500_CMIP6_SSP434_0p5degLat_GlobAnnAvg_c190514.nc atm/waccm/lb/LBC_2014-2500_CMIP6_SSP460_0p5degLat_GlobAnnAvg_c190301.nc atm/waccm/lb/LBC_2014-2500_CMIP6_SSP534os_0p5degLat_GlobAnnAvg_c190301.nc atm/waccm/lb/LBC_2014-2500_CMIP6_SSP585_0p5degLat_GlobAnnAvg_c190301.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 8d9b632c18..58ad309997 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1848,9 +1848,9 @@ CLM run type. +"conus_30_x8,512x1024,360x720cru,128x256,64x128,48x96,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4,ne60np4,ne120np4,ne240np4,1km-merge-10min"> Horizontal resolutions -Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools +Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min, 1km-merge-10min and 0.33x0.33 are only used for CLM toolsI $ntests ); @@ -334,7 +334,7 @@ sub make_config_cache { foreach my $options ( "-bgc bgc -use_case 1850-2100_SSP1-2.6_transient -namelist '&a start_ymd=20100101/'", "-bgc sp -use_case 1850-2100_SSP2-4.5_transient -namelist '&a start_ymd=18501223/'", - "-bgc bgc -use_case 1850-2100_SSP4-6.0_transient -namelist '&a start_ymd=20701029/'", + "-bgc bgc -use_case 1850-2100_SSP3-7.0_transient -namelist '&a start_ymd=20701029/'", "-bgc fates -use_case 2000_control -no-megan", "-bgc cn -use_case 1850-2100_SSP5-8.5_transient -namelist '&a start_ymd=19201023/'", "-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop", @@ -1084,6 +1084,10 @@ sub make_config_cache { $res eq "360x720cru" || $res eq "512x1024" ) { next; + # Resolutions not supported on release branch + } elsif ( $res eq "ne120np4" || + $res eq "conus_30_x8" ) { + next; } &make_env_run(); @@ -1214,8 +1218,8 @@ sub make_config_cache { &make_config_cache($phys); my @glc_res = ( "48x96", "0.9x1.25", "1.9x2.5" ); my @use_cases = ( "1850-2100_SSP1-2.6_transient", - "1850-2100_SSP3-4.5_transient", - "1850-2100_SSP4-6.0_transient", + "1850-2100_SSP2-4.5_transient", + "1850-2100_SSP3-7.0_transient", "1850-2100_SSP5-8.5_transient", "1850_control", "2000_control", @@ -1269,8 +1273,7 @@ sub make_config_cache { $mode = "-phys $phys"; my @tran_res = ( "0.9x1.25", "1.9x2.5", "10x15" ); foreach my $usecase ( "1850_control", "1850-2100_SSP5-8.5_transient", "1850-2100_SSP1-2.6_transient", "1850-2100_SSP3-7.0_transient", - "1850-2100_SSP4-3.4_transient", "1850-2100_SSP5-3.4_transient", "1850-2100_SSP2-4.5_transient", "1850-2100_SSP1-1.9_transient", - "1850-2100_SSP4-6.0_transient" ) { + "1850-2100_SSP2-4.5_transient" ) { foreach my $res ( @tran_res ) { $options = "-res $res -bgc bgc -crop -use_case $usecase -envxml_dir . "; &make_env_run(); @@ -1289,6 +1292,16 @@ sub make_config_cache { &cleanup(); } } +# The SSP's that fail... +my $res = "0.9x1.25"; +foreach my $usecase ( "1850-2100_SSP4-3.4_transient", "1850-2100_SSP5-3.4_transient", "1850-2100_SSP1-1.9_transient", + "1850-2100_SSP4-6.0_transient" ) { + $options = "-res $res -bgc bgc -crop -use_case $usecase -envxml_dir . "; + &make_env_run(); + eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; + isnt( $?, 0, $usecase ); + system( "cat $tempfile" ); +} print "\n==================================================\n"; print "Test clm4.5/clm5.0 resolutions \n"; @@ -1322,7 +1335,7 @@ sub make_config_cache { my @clmoptions = ( "-bgc bgc -envxml_dir .", "-bgc sp -envxml_dir .", ); foreach my $clmopts ( @clmoptions ) { - my @clmres = ( "ne16np4", "360x720cru" ); + my @clmres = ( "ne16np4" ); foreach my $res ( @clmres ) { $options = "-res $res -envxml_dir . "; &make_env_run( ); diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 31649e4dd4..79d6046575 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -181,11 +181,11 @@ constant,diagnostic,prognostic constant - diagnostic + diagnostic diagnostic prognostic diagnostic - diagnostic + diagnostic run_component_clm env_run.xml @@ -252,8 +252,10 @@ - $COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_deck - $COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_deck + $COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_deck + $COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_nociso_deck + $COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_deck + $COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_nociso_deck run_component_clm env_case.xml diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 6f8cc4db80..0476ba3a79 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -144,6 +144,15 @@ 2000_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV + + + I2000Clm50BgcCropQianGs + 2000_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV + + I2000Clm50BgcCruGs 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV @@ -221,6 +230,16 @@ HIST_DATM%QIA_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV + + + + IHistClm50BgcCropQianGs + HIST_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV + + IHistClm50BgcCropGs diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 629034e4b2..6d0a249a03 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -932,7 +932,7 @@ - + @@ -1102,7 +1102,6 @@ - @@ -1403,6 +1402,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1864,6 +1890,16 @@ + + + + + + + + + diff --git a/cime_config/usermods_dirs/cmip6_waccm_nociso_deck/README b/cime_config/usermods_dirs/cmip6_waccm_nociso_deck/README new file mode 100644 index 0000000000..79cbbeefe8 --- /dev/null +++ b/cime_config/usermods_dirs/cmip6_waccm_nociso_deck/README @@ -0,0 +1,17 @@ +WACCM DECK runs should be configured similarly to CAM DECK runs, but +without virtual elevation classes over Antarctica. At 2-degree we ++also decided to NOT turn on Carbon isotopes. + +(2018-10-22) In discussions between Bill Sacks and Bill Lipscomb: We +have decided NOT to turn on virtual Antarctica columns for any of the +WACCM simulations (DECK or ScenarioMIP): these weren't turned on in the +WACCM PI-Control or historical runs (either by accident or +intentionally: I'm not sure which, and can't find emails describing this +decision). Since this setting needs to be compatible with the REFCASE, +it's simpler if we keep it consistent for all WACCM runs, and there +seems to be only limited value in turning on virtual Antarctica columns +in the remaining WACCM runs (1% CO2, 4xCO2 and ScenarioMIP) when they +weren't on in the WACCM PI-Control or Historical runs. And Mike Mills +says that there won't be any more sharing of initial conditions between +CAM and WACCM CMIP6 runs, so it's fine if the two sets remain different +in this respect. diff --git a/cime_config/usermods_dirs/cmip6_waccm_nociso_deck/include_user_mods b/cime_config/usermods_dirs/cmip6_waccm_nociso_deck/include_user_mods new file mode 100644 index 0000000000..64c3f6f670 --- /dev/null +++ b/cime_config/usermods_dirs/cmip6_waccm_nociso_deck/include_user_mods @@ -0,0 +1,2 @@ +../_includes/cmip6_glaciers_cplhist +../output_crop diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index 173807dd9c..85d8d72703 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -705,7 +705,7 @@ program mksurfdat pctwet(n) = 100._r8 - pctlak(n) pctgla(n) = 0._r8 else - pctwet(n) = 100._r8 - pctgla(n) - pctlak(n) + pctwet(n) = max(100._r8 - pctgla(n) - pctlak(n), 0.0_r8) end if pcturb(n) = 0._r8 call pctnatpft(n)%set_pct_l2g(0._r8) @@ -1319,6 +1319,26 @@ subroutine normalizencheck_landuse(ldomain) do n = 1,ns_o ! Check preconditions + if ( pctlak(n) < 0.0_r8 )then + write(6,*) subname, ' ERROR: pctlak is negative!' + write(6,*) 'n, pctlak = ', n, pctlak(n) + call abort() + end if + if ( pctwet(n) < 0.0_r8 )then + write(6,*) subname, ' ERROR: pctwet is negative!' + write(6,*) 'n, pctwet = ', n, pctwet(n) + call abort() + end if + if ( pcturb(n) < 0.0_r8 )then + write(6,*) subname, ' ERROR: pcturb is negative!' + write(6,*) 'n, pcturb = ', n, pcturb(n) + call abort() + end if + if ( pctgla(n) < 0.0_r8 )then + write(6,*) subname, ' ERROR: pctgla is negative!' + write(6,*) 'n, pctgla = ', n, pctgla(n) + call abort() + end if suma = pctlak(n) + pctwet(n) + pcturb(n) + pctgla(n) if (suma > (100._r8 + tol_loose)) then diff --git a/tools/ncl_scripts/getco2_historical.ncl b/tools/ncl_scripts/getco2_historical.ncl index 7284dc88b7..c071fa42d6 100644 --- a/tools/ncl_scripts/getco2_historical.ncl +++ b/tools/ncl_scripts/getco2_historical.ncl @@ -54,7 +54,7 @@ begin ntime = dimsizes( ncg->date ); sim_yr2 = ncg->date(ntime-1) / 10000; - sim_yr_rng = "_simyr_"+sim_yr0 + "-" + sim_yr2; + sim_yr_rng = "simyr_"+sim_yr0 + "-" + sim_yr2; cmip_vers = "_CMIP6_"; outco2filename = "fco2_datm_"+hgrid+sim_yr_rng+cmip_vers+"c"+sdate+".nc"; @@ -99,7 +99,7 @@ begin end if end if nco->$vars(i)$@units = units(i); - nco->$vars(i)$@lname = lname(i); + nco->$vars(i)$@long_name = lname(i); end do filevardef ( nco, "time", "float", (/ "time" /) ); filevardef ( nco, "time_bnds", "float", (/ "time", "bounds" /) ); @@ -166,6 +166,7 @@ begin ; nco->date = (/ ncg->date /); nco->time = (/ ncg->time /); + nco->time_bnds = (/ ncg->time_bnds /); nco->date@comment = "This variable is NOT used when read by datm, the time coordinate is used"; ; ; CO2 From 7b26add37e56d11304a89e2cd145ed4ee3c64dcb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 16 Jul 2019 16:48:45 -0600 Subject: [PATCH 0339/1973] Update rtm for a simple bug fix --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 71f9466b64..4a177f238f 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -16,7 +16,7 @@ required = True local_path = components/rtm protocol = git repo_url = https://github.com/ESCOMP/rtm -tag = rtm1_0_68 +tag = rtm1_0_69 required = True [mosart] From 16ffd857a4b2b5e8382781c7a2d608e196343b36 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 17 Jul 2019 12:12:58 -0600 Subject: [PATCH 0340/1973] Makefile working using lnd_comp_esmf.o but still it is not used in Lilac .... --- lilac/lilac/Makefile | 14 +++++++++++--- lilac/lilac/lilac_mod.F90 | 10 +++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index 92817a8381..edc21ddded 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -46,12 +46,20 @@ include $(ESMFMKFILE) demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) mv demo_driver demo_driver.exe - rm *.o *.mod + #rm *.o *.mod # module dependencies: -demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o -lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o +demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o +#demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o +lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o lnd_comp_esmf.o +#lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o +shr_string_mod.o: shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o +shr_log_mod.o: atmos_cap.o: lilac_utils.o +#lnd_comp_esmf.o: shr_string_mod.o abort_utils.o +shr_sys_mod.o: shr_log_mod.o +abort_utils.o: +clm_varctl.o: # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- .PHONY: dust clean distclean berzerk diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index d97e4c0f7b..2622af5afe 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -7,9 +7,10 @@ module lilac_mod ! !USES use ESMF use lilac_utils - use atmos_cap , only : atmos_register - use lnd_cap , only : lnd_register - use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register + use atmos_cap , only : atmos_register + use lnd_cap , only : lnd_register + !use lnd_comp_esmf , only : lnd_register + use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register implicit none @@ -44,8 +45,7 @@ module lilac_mod subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) use atmos_cap , only : a2c_fldlist, c2a_fldlist - use lnd_cap , only : l2c_fldlist, c2l_fldlist - + use lnd_cap, only : l2c_fldlist, c2l_fldlist character(len=*), parameter :: subname=trim(modname)//': [lilac_init] ' ! input/output variables From 75390f00efd5529142fade32193a111ebec6b713 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 17 Jul 2019 12:44:14 -0600 Subject: [PATCH 0341/1973] add time interpolation namelist variable --- bld/CLMBuildNamelist.pm | 2 + bld/namelist_files/namelist_defaults_ctsm.xml | 1 + .../namelist_definition_ctsm.xml | 4 + src/biogeophys/SoilMoistureStreamMod.F90 | 79 +++++++++++-------- 4 files changed, 54 insertions(+), 32 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 6be5aea79f..53b0339609 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3357,6 +3357,8 @@ sub setup_logic_soilm_streams { add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_mapalgo', 'hgrid'=>$nl_flags->{'res'} ); + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_tintalgo', + 'hgrid'=>$nl_flags->{'res'} ); add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 50355b75e9..5f6fac1326 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1025,6 +1025,7 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc/project/tss/swensosc/MIPs/LS3MIP/LFMIP-pdLC-SST.H2OSOI.natveg.1980-2014.MONS_climo.nc none +linear .false. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 432bc4d215..5c3c8e8962 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1645,6 +1645,10 @@ Filename of input stream data for USTAR group="soil_moisture_streams" valid_values="none,bilinear,nn,nnoni,nnonj,spval,copy" > + + + diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 2b849405ab..7de6fd83e1 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -19,6 +19,7 @@ module SoilMoistureStreamMod use decompMod , only : gsMap_lnd2Dsoi_gdc2glo use domainMod , only : ldomain use fileutils , only : getavu, relavu + use LandunitType , only : lun use ColumnType , only : col use SoilStateType , only : soilstate_type use WaterStateBulkType, only : waterstatebulk_type @@ -83,6 +84,7 @@ subroutine PrescribedSoilMoistureInit(bounds) type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldfilename_soilm ! ustar stream filename to read character(len=CL) :: soilm_mapalgo = 'none' ! Mapping alogrithm + character(len=CL) :: soilm_tintalgo = 'linear' ! Time interpolation alogrithm character(*), parameter :: subName = "('soil_moisture_init')" character(*), parameter :: F00 = "('(soil_moisture_init) ',4a)" @@ -97,6 +99,7 @@ subroutine PrescribedSoilMoistureInit(bounds) stream_year_last_soilm, & model_year_align_soilm, & soilm_mapalgo, & + soilm_tintalgo, & stream_fldfilename_soilm ! Default values for namelist @@ -126,6 +129,8 @@ subroutine PrescribedSoilMoistureInit(bounds) call shr_mpi_bcast(stream_year_last_soilm, mpicom) call shr_mpi_bcast(model_year_align_soilm, mpicom) call shr_mpi_bcast(stream_fldfilename_soilm, mpicom) + call shr_mpi_bcast(soilm_mapalgo, mpicom) + call shr_mpi_bcast(soilm_tintalgo, mpicom) if (masterproc) then @@ -135,6 +140,8 @@ subroutine PrescribedSoilMoistureInit(bounds) write(iulog,*) ' stream_year_last_soilm = ',stream_year_last_soilm write(iulog,*) ' model_year_align_soilm = ',model_year_align_soilm write(iulog,*) ' stream_fldfilename_soilm = ',trim(stream_fldfilename_soilm) + write(iulog,*) ' soilm_mapalgo = ',trim(soilm_mapalgo) + write(iulog,*) ' soilm_tintalgo = ',trim(soilm_tintalgo) endif @@ -145,7 +152,7 @@ subroutine PrescribedSoilMoistureInit(bounds) ! fldList = trim(soilmString) - write(iulog,*) 'fieldlist: ', trim(fldList), nlevsoi + if (masterproc) write(iulog,*) 'fieldlist: ', trim(fldList) call shr_strdata_create(sdat_soilm,name="soil_moisture", & pio_subsystem=pio_subsystem, & @@ -172,11 +179,11 @@ subroutine PrescribedSoilMoistureInit(bounds) fldListModel=fldList, & fillalgo='none', & mapalgo=soilm_mapalgo, & + tintalgo=soilm_tintalgo, & calendar=get_calendar(), & dtlimit = 15._r8, & taxmode='cycle' ) - write(*,*) 'initializedstream' if (masterproc) then call shr_strdata_print(sdat_soilm,'soil moisture data') endif @@ -196,7 +203,8 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & ! !USES: use clm_time_manager, only : get_curr_date use clm_varpar , only : nlevsoi - use clm_varcon , only : denh2o, denice + use clm_varcon , only : denh2o, denice, watmin + use landunit_varcon , only : istsoil ! ! !ARGUMENTS: implicit none @@ -216,7 +224,9 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & real(r8) :: soilm_liq_frac ! liquid fraction of soil moisture real(r8) :: soilm_ice_frac ! ice fraction of soil moisture real(r8) :: moisture_increment ! soil moisture adjustment increment + real(r8) :: h2osoi_vol_initial ! initial vwc value character(len=CL) :: stream_var_name + !----------------------------------------------------------------------- associate( & @@ -251,40 +261,45 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & g_to_ig(g) = ig end do -! write(iulog,*) 'sdatavs: ',sdat_soilm%avs - write(iulog,*) ' ' -! write(iulog,*) 'sdatsize: ',sdat_soilm%avs(1) - call mct_aVect_info(2, sdat_soilm%avs(1)) - ! Read data from stream into column level variable do c = bounds%begc, bounds%endc - ! - ! Set variable for each gridcell/column combination - ! - ig = g_to_ig(col%gridcell(c)) - - ! this is a 2d field (gridcell/nlevsoi) ! - do j = 1, nlevsoi - ! initialize increment to original soil moisture value - moisture_increment = h2osoi_vol(c,j) + if(lun%itype(col%landunit(c)) == istsoil) then + ! + ! Set variable for each gridcell/column combination + ! + ig = g_to_ig(col%gridcell(c)) - ! update volumetric soil moisture - n = ig + (j-1)*ldomain%ni*ldomain%nj - h2osoi_vol(c,j) = sdat_soilm%avs(1)%rAttr(ism,n) - h2osoi_vol(c,j) = min(h2osoi_vol(c,j), watsat(c, j)) - - ! calculate liq/ice mass fractions - soilm_liq_frac = h2osoi_liq(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) - soilm_ice_frac = h2osoi_ice(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) - ! update moisture increment (relative to original value) - moisture_increment = h2osoi_vol(c,j) - moisture_increment + ! this is a 2d field (gridcell/nlevsoi) ! + do j = 1, nlevsoi + + n = ig + (j-1)*(bounds%endg-bounds%begg+1) + + ! if soil water is zero, liq/ice fractions cannot be calculated + if((h2osoi_liq(c, j) + h2osoi_ice(c, j)) > 0._r8) then + + ! save original soil moisture value + h2osoi_vol_initial = h2osoi_vol(c,j) - ! update liq/ice water mass due to (volumetric) moisture increment - h2osoi_liq(c,j) = h2osoi_liq(c,j) + (soilm_liq_frac * moisture_increment * dz(c, j) * denh2o) - h2osoi_ice(c,j) = h2osoi_ice(c,j) + (soilm_ice_frac * moisture_increment * dz(c, j) * denice) - enddo - + ! update volumetric soil moisture + h2osoi_vol(c,j) = sdat_soilm%avs(1)%rAttr(ism,n) + + ! calculate liq/ice mass fractions + soilm_liq_frac = h2osoi_liq(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) + soilm_ice_frac = h2osoi_ice(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) + + ! calculate moisture increment + moisture_increment = h2osoi_vol(c,j) - h2osoi_vol_initial + ! add limitation check + moisture_increment = min((watsat(c,j) - h2osoi_vol_initial),max(-(h2osoi_vol_initial-watmin),moisture_increment)) + + ! update liq/ice water mass due to (volumetric) moisture increment + h2osoi_liq(c,j) = h2osoi_liq(c,j) + (soilm_liq_frac * moisture_increment * dz(c, j) * denh2o) + h2osoi_ice(c,j) = h2osoi_ice(c,j) + (soilm_ice_frac * moisture_increment * dz(c, j) * denice) + + endif + enddo + endif end do end associate From 1fb040162e6f3e2b635b97480e937214ef5a0a3e Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 17 Jul 2019 12:57:30 -0600 Subject: [PATCH 0342/1973] add back changes to decompInit --- src/main/decompInitMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 5dab799ae7..21c2c8e1cf 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -337,16 +337,16 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) call get_proc_bounds(begg, endg) - lsize = endg + (lnk-1)*(endg-begg+1) - allocate(gindex(begg:lsize)) + begg3d = (begg-1)*lnk + 1 + endg3d = endg*lnk + lsize = (endg3d - begg3d + 1 ) + allocate(gindex(begg3d:endg3d)) do k = 1, lnk do n = begg,endg - m = n + (k-1)*(endg-begg+1) + m = (begg-1)*lnk + (k-1)*(endg-begg+1) + (n-begg+1) gindex(m) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) enddo enddo - lsize = m - begg + 1 - gsize = lni * lnj * lnk call mct_gsMap_init(gsMap_lnd2Dsoi_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) From 3a20bd512ef51b8c0c64e1b488637c36605a56d0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 17 Jul 2019 14:58:41 -0600 Subject: [PATCH 0343/1973] Only set soilm streams if turned on, change filename to one checked in, add a couple more namelist tests for it, also check if streams are off, but streams namelist items are used --- bld/CLMBuildNamelist.pm | 44 ++++++++++++------- bld/namelist_files/namelist_defaults_ctsm.xml | 3 +- .../namelist_definition_ctsm.xml | 2 +- bld/unit_testers/build-namelist_test.pl | 10 ++++- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 6be5aea79f..fc514ae536 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3355,23 +3355,35 @@ sub setup_logic_soilm_streams { my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_; add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_mapalgo', - 'hgrid'=>$nl_flags->{'res'} ); - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_soilm', 'phys'=>$nl_flags->{'phys'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_soilm') != - $nl->get_value('stream_year_last_soilm') ) { - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'model_year_align_soilm', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + if ( &value_is_true( $nl->get_value('use_soil_moisture_streams') ) ) { + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_mapalgo', + 'hgrid'=>$nl_flags->{'res'} ); + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_soilm', 'phys'=>$nl_flags->{'phys'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + # Set align year, if first and last years are different + if ( $nl->get_value('stream_year_first_soilm') != + $nl->get_value('stream_year_last_soilm') ) { + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, + 'model_year_align_soilm', 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + } + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_soilm', 'phys'=>$nl_flags->{'phys'}, + 'hgrid'=>$nl_flags->{'res'} ); + } else { + if ( defined($nl->get_value('stream_year_first_soilm')) || + defined($nl->get_value('soilm_mapalgo')) || + defined($nl->get_value('model_year_align_soilm')) || + defined($nl->get_value('stream_fldfilename_soilm')) || + defined($nl->get_value('stream_year_last_soilm')) ) { + $log->fatal_error("One of the soilm streams namelist items (stream_year_first_soilm, soilm_mapalgo," . + " model_year_align_soilm, stream_fldfilename_soilm, stream_fldfilename_soilm)" . + " is defined, but use_soil_moisture_streams option NOT set to true"); + } } - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_soilm', 'phys'=>$nl_flags->{'phys'}, - 'hgrid'=>"0.9x1.25" ); } #------------------------------------------------------------------------------- diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 50355b75e9..0213140079 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1017,12 +1017,13 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.ncnn + .false. 1997 1997 1997 -/project/tss/swensosc/MIPs/LS3MIP/LFMIP-pdLC-SST.H2OSOI.natveg.1980-2014.MONS_climo.nc +lnd/clm2/prescribed_data/LFMIP-pdLC-SST.H2OSOI.0.9x1.25.20levsoi.natveg.climo1980-2014.MONS_c190709.nc none diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 432bc4d215..d3f0f666bb 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1642,7 +1642,7 @@ Filename of input stream data for USTAR + group="soil_moisture_streams" valid_values="none" > diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 39756d8055..e8fdc63201 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 927; +my $ntests = 932; if ( defined($opts{'compare'}) ) { - $ntests += 588; + $ntests += 591; } plan( tests=>$ntests ); @@ -336,6 +336,7 @@ sub make_config_cache { "-bgc sp -use_case 1850-2100_rcp4.5_transient -namelist '&a start_ymd=18501223/'", "-bgc bgc -use_case 1850-2100_rcp6_transient -namelist '&a start_ymd=20701029/'", "-bgc fates -use_case 2000_control -no-megan", + "-bgc sp -use_case 2000_control -res 0.9x1.25 -namelist '&a use_soil_moisture_streams = T/'", "-bgc cn -use_case 1850-2100_rcp8.5_transient -namelist '&a start_ymd=19201023/'", "-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop", ) { @@ -408,6 +409,11 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm4_5", }, + "soilm_stream wo use" =>{ options=>"-res 0.9x1.25 -envxml_dir .", + namelst=>"use_soil_moisture_streams = .false.,stream_fldfilename_soilm='missing_file'", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_0", + }, "clm50CNDVwtransient" =>{ options=>" -envxml_dir . -use_case 20thC_transient -dynamic_vegetation -res 10x15", namelst=>"", GLC_TWO_WAY_COUPLING=>"FALSE", From 79fe43170e442b48aa4e71f47dd752b6ea8be3be Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 17 Jul 2019 15:07:29 -0600 Subject: [PATCH 0344/1973] Add test for prescribed soil moisture and lai streams --- cime_config/testdefs/testlist_clm.xml | 10 ++++++++++ .../testdefs/testmods_dirs/clm/prescribed/README | 7 +++++++ .../testmods_dirs/clm/prescribed/include_user_mods | 1 + .../testdefs/testmods_dirs/clm/prescribed/user_nl_clm | 2 ++ 4 files changed, 20 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/prescribed/README create mode 100644 cime_config/testdefs/testmods_dirs/clm/prescribed/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/prescribed/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 8966bacc3d..6c06872c75 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -68,6 +68,16 @@ + + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/prescribed/README b/cime_config/testdefs/testmods_dirs/clm/prescribed/README new file mode 100644 index 0000000000..4c0c56bb8c --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/prescribed/README @@ -0,0 +1,7 @@ +This test-mods turns on using the prescribed moisture streams file +(rather than prognosing it in the model). And it turns on the lai streams +to test that's working as well. + +The only resolution we currently have data for is f09, so this must be done +at 0.9x1.25 resolution. And it makes the most sense for present day and +Satellite Phenology (Sp). diff --git a/cime_config/testdefs/testmods_dirs/clm/prescribed/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/prescribed/include_user_mods new file mode 100644 index 0000000000..fe0e18cf88 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/prescribed/include_user_mods @@ -0,0 +1 @@ +../default diff --git a/cime_config/testdefs/testmods_dirs/clm/prescribed/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/prescribed/user_nl_clm new file mode 100644 index 0000000000..2e3ab9129b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/prescribed/user_nl_clm @@ -0,0 +1,2 @@ + use_soil_moisture_streams = .true. + use_lai_streams = .true. From b49e14ce2644cf0432b844c006aaa149dcf8a9ca Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 17 Jul 2019 15:43:15 -0600 Subject: [PATCH 0345/1973] some changes to top-level CMakeLists.txt --- lilac/CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 07e67320e6..b5b58b299d 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -2,12 +2,17 @@ cmake_minimum_required(VERSION 2.8.12.1) project(LILAC Fortran) enable_language(Fortran) +#include(CIME_initial_setup) +#include(CIME_utils) + set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") find_package(MPI REQUIRED) +add_definitions(-DHIDE_MPI) # TODO: This should be found from the find_package call but its not working #set(CMAKE_Fortran_COMPILER "/usr/lib64/mpich/bin/mpif90") +#find_package (ESMF) find_package(ESMF REQUIRED) # Local CMake modules @@ -29,12 +34,12 @@ set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp -lesmf") # TODO: This should not be necessary but certain header files are missing from the build #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include -I/usr/src/lilac/external/esmf/build_config/Linux.gfortran.default -I /usr/src/lilac/external/esmf/src/include") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I /usr/src/esmf/src/include") - - +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I/usr/src/esmf/src/include -L/glade/u/home/dunlap/ESMF-INSTALL/8.0.0bs29/lib/libg/Linux.intel.64.mpt.default") +include_directories("/glade/u/home/dunlap/ESMF-INSTALL/8.0.0bs29/lib/libg/Linux.intel.64.mpt.default") +include_directories("/glade/scratch/negins/testlilac2/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/") message(STATUS "==============================================================") message(STATUS "Fortran Compiler : ${CMAKE_Fortran_COMPILER}") message(STATUS "cmake Fortran Flags : ${CMAKE_Fortran_FLAGS}") From bedf9e41a4a829f2446a775441b51fc202ef4157 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 17 Jul 2019 15:43:36 -0600 Subject: [PATCH 0346/1973] saving this version of our Makefile before going to a new branch.... --- lilac/lilac/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index edc21ddded..f813fd788e 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -43,7 +43,7 @@ include $(ESMFMKFILE) # ----------------------------------------------------------------------------- -demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o +demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o lnd_comp_esmf.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) mv demo_driver demo_driver.exe #rm *.o *.mod From b4abaa479f552b223f943b61034099a683efb2a2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 17 Jul 2019 15:47:29 -0600 Subject: [PATCH 0347/1973] Move deallocate of gindex until after write statement that uses it, noticed on hobart_nag --- src/main/decompInitMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 21c2c8e1cf..c6b8e1764b 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -350,8 +350,6 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) gsize = lni * lnj * lnk call mct_gsMap_init(gsMap_lnd2Dsoi_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) - deallocate(gindex) - ! Diagnostic output if (masterproc) then @@ -367,6 +365,8 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) write(iulog,*) end if + deallocate(gindex) + call shr_sys_flush(iulog) end subroutine decompInit_lnd3D From 7ec3f2be07fbdf70e334ce995bf0fbaa978456e5 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 17 Jul 2019 15:53:07 -0600 Subject: [PATCH 0348/1973] this makefile is working using dummy land cap.... --- lilac/lilac/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index f813fd788e..c422356efb 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -43,7 +43,7 @@ include $(ESMFMKFILE) # ----------------------------------------------------------------------------- -demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o lnd_comp_esmf.o +demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) mv demo_driver demo_driver.exe #rm *.o *.mod @@ -51,7 +51,7 @@ demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_c # module dependencies: demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o #demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o -lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o lnd_comp_esmf.o +lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o #lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o shr_string_mod.o: shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o shr_log_mod.o: From e2560d33a4d04703edb0f5eb20cd3d0b1583b090 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 17 Jul 2019 15:53:54 -0600 Subject: [PATCH 0349/1973] this makefile is working using dummy land cap.... --- lilac/lilac/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index c422356efb..b424fe060e 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -49,11 +49,11 @@ demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_c #rm *.o *.mod # module dependencies: -demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o -#demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o +#demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o +demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o #lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o -shr_string_mod.o: shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o +#shr_string_mod.o: shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o shr_log_mod.o: atmos_cap.o: lilac_utils.o #lnd_comp_esmf.o: shr_string_mod.o abort_utils.o From 8d2974a518e033af3ca55bc8b40e923bc66a0670 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 17 Jul 2019 17:50:24 -0600 Subject: [PATCH 0350/1973] saving before switching branch --- lilac/lilac/lilac_mod.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 2622af5afe..a25491c2db 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -8,8 +8,10 @@ module lilac_mod use ESMF use lilac_utils use atmos_cap , only : atmos_register - use lnd_cap , only : lnd_register - !use lnd_comp_esmf , only : lnd_register + !use lnd_cap , only : lnd_register + use lnd_comp_esmf + !use clm_share , only : lnd_register + !use lnd , only : lnd_register use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register implicit none From 7ab5f600a8b5a7265558e44a9337190d7582ea92 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 18 Jul 2019 16:57:34 -0600 Subject: [PATCH 0351/1973] saving... --- lilac/lilac/demo_driver.F90 | 5 +++++ lilac/lilac/lilac_mod.F90 | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index 2276664d68..9f6bd766cf 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -87,7 +87,12 @@ program demo_lilac_driver do curr_time = start_time, end_time if (curr_time == start_time) then + ! Initalization phase + print *, "--------------------------" + print *, " LILAC Initalization phase" + print *, "--------------------------" + call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm ) else if (curr_time == end_time ) then ! Finalization phase diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index a25491c2db..3984fc536a 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -8,8 +8,10 @@ module lilac_mod use ESMF use lilac_utils use atmos_cap , only : atmos_register - !use lnd_cap , only : lnd_register - use lnd_comp_esmf + use lnd_cap , only : lnd_register + !use lnd_shr_methods + !use lnd_comp_esmf + !use lnd_comp_esmf , only : lnd_register !use clm_share , only : lnd_register !use lnd , only : lnd_register use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register @@ -88,6 +90,10 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) a2l_fldnum = 3 l2a_fldnum = 3 + print *, "---------------------------------------" + print *, " Lilac Demo Application Start " + print *, "---------------------------------------" + !------------------------------------------------------------------------- ! Initialize ESMF, set the default calendar and log type. !------------------------------------------------------------------------- @@ -96,9 +102,6 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) call ESMF_LogWrite(subname//"Initializing ESMF ", ESMF_LOGMSG_INFO) - print *, "---------------------------------------" - print *, " Lilac Demo Application Start " - print *, "---------------------------------------" !------------------------------------------------------------------------- ! Read in configuration data -- namelist.input from host atmosphere(wrf) !------------------------------------------------------------------------- From 456401b25a364055ccafc76200c9c48f020d3c24 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 19 Jul 2019 12:41:59 -0600 Subject: [PATCH 0352/1973] saving changes made to CMake. --- lilac/CMakeLists.txt | 48 +++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index b5b58b299d..0506f8751b 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -2,19 +2,30 @@ cmake_minimum_required(VERSION 2.8.12.1) project(LILAC Fortran) enable_language(Fortran) -#include(CIME_initial_setup) -#include(CIME_utils) - set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") find_package(MPI REQUIRED) -add_definitions(-DHIDE_MPI) # TODO: This should be found from the find_package call but its not working #set(CMAKE_Fortran_COMPILER "/usr/lib64/mpich/bin/mpif90") -#find_package (ESMF) find_package(ESMF REQUIRED) +# -lclm libclm.a +SET(NAMES libclm.a) + +find_library(LIB_TO_INCLUDE + libclm.a + PATHS /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib/) +#find_library(LIB_TO_INCLUDE /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib/) + +message(STATUS "include_directories for ${NAMES}: ${LIB_TO_INCLUDE}") +#include_directories(${LIB_TO_INCLUDE}) +#link_directories(${LIB_TO_INCLUDE}) +message(STATUS "include_directories for ${NAMES}: ${LIB_TO_INCLUDE}") +#find_library(LIB_TO_INCLUDE /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib/) +message(STATUS "include_directories: ${LIB_TO_INCLUDE}") +#target_link_libraries (${LIB_TO_INCLUDE}) + # Local CMake modules if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") @@ -34,24 +45,33 @@ set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp -lesmf") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") # TODO: This should not be necessary but certain header files are missing from the build #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include -I/usr/src/lilac/external/esmf/build_config/Linux.gfortran.default -I /usr/src/lilac/external/esmf/src/include") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I/usr/src/esmf/src/include -L/glade/u/home/dunlap/ESMF-INSTALL/8.0.0bs29/lib/libg/Linux.intel.64.mpt.default") -include_directories("/glade/u/home/dunlap/ESMF-INSTALL/8.0.0bs29/lib/libg/Linux.intel.64.mpt.default") -include_directories("/glade/scratch/negins/testlilac2/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/") +#set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I /usr/src/esmf/src/include") +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/include -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib -lclm -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib ") + + message(STATUS "==============================================================") message(STATUS "Fortran Compiler : ${CMAKE_Fortran_COMPILER}") message(STATUS "cmake Fortran Flags : ${CMAKE_Fortran_FLAGS}") message(STATUS "==============================================================") +message(STATUS "==============================================================") #add_executable("lilac.exe" ../lilac/*.F90) -add_executable(${PROJECT_NAME}.exe ../lilac/demo_driver.F90 - ../lilac/lilac_mod.F90 ../lilac/atmos_cap.F90 ../lilac/lilac_utils.F90 - ../lilac/lnd_cap.F90 ../lilac/cpl_mod.F90) +# +# Compile. +# +file(GLOB_RECURSE sources lilac/*.F90) + +#add_executable(${PROJECT_NAME}.exe ../lilac/demo_driver.F90 +# ../lilac/lilac_mod.F90 ../lilac/atmos_cap.F90 ../lilac/lilac_utils.F90 +# ../lilac/lnd_cap.F90 ../lilac/cpl_mod.F90) +add_executable(${PROJECT_NAME}.exe ${sources}) +target_link_libraries(${PROJECT_NAME}.exe ${LIB_TO_INCLUDE}) #emo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o -add_subdirectory(lilac) -add_subdirectory(tests) +#add_subdirectory(lilac) +#add_subdirectory(tests) From ef3c30e79d73ff0c28c4f735ed8fd99f4e18742b Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 19 Jul 2019 12:44:15 -0600 Subject: [PATCH 0353/1973] WORKING and RUNNING (not debugged) version of LILAC with CTSM. CTSM LILAC CAP and lilac mod should be debugged now.... --- lilac/lilac/batch.sub | 22 ++++++++++++++++++++++ lilac/lilac/lilac_mod.F90 | 5 +---- 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 lilac/lilac/batch.sub diff --git a/lilac/lilac/batch.sub b/lilac/lilac/batch.sub new file mode 100644 index 0000000000..746db8d477 --- /dev/null +++ b/lilac/lilac/batch.sub @@ -0,0 +1,22 @@ +#!/bin/tcsh +#PBS -N job_name +#####PBS -A P54048000 +#PBS -A P93300606 +#PBS -l walltime=00:05:00 +#PBS -q regular +#PBS -j oe +#PBS -l select=2:ncpus=2:mpiprocs=4 +##PBS -l select=1:ncpus=1:mpiprocs=1 + +ml + +### Set TMPDIR as recommended +setenv TMPDIR /glade/scratch/$USER/temp +mkdir -p $TMPDIR + + +echo "hello" +### Run the executable +set MPI_SHEPHERD=true +source /glade/scratch/negins/test_clean/.env_mach_specific.csh +mpiexec_mpt ./demo_driver diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 3984fc536a..4d5fb164e2 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -8,12 +8,9 @@ module lilac_mod use ESMF use lilac_utils use atmos_cap , only : atmos_register - use lnd_cap , only : lnd_register !use lnd_shr_methods !use lnd_comp_esmf - !use lnd_comp_esmf , only : lnd_register - !use clm_share , only : lnd_register - !use lnd , only : lnd_register + use lnd_comp_esmf , only : lnd_register use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register implicit none From cbe599bd7816f6a631ab7e1f32a286ca054a6bea Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 19 Jul 2019 12:50:10 -0600 Subject: [PATCH 0354/1973] update --- lilac/lilac/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/lilac/.gitignore b/lilac/lilac/.gitignore index d52decad68..3ddd2df7eb 100644 --- a/lilac/lilac/.gitignore +++ b/lilac/lilac/.gitignore @@ -2,4 +2,4 @@ job_name* PET* *.exe -batch.sub +#batch.sub From cb41840d82c23c99496f18c73a939df05a27ecb1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 24 Jul 2019 15:32:58 -0600 Subject: [PATCH 0355/1973] Remove soilm_mapalgo, as has to be none for the 3D grid, correct the documentation on the new soilm streams --- bld/CLMBuildNamelist.pm | 5 +---- bld/namelist_files/namelist_defaults_ctsm.xml | 1 - bld/namelist_files/namelist_definition_ctsm.xml | 13 +++++-------- src/biogeophys/SoilMoistureStreamMod.F90 | 13 ++++++++----- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 9bf51bacd4..ce483dc8b9 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3356,8 +3356,6 @@ sub setup_logic_soilm_streams { add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); if ( &value_is_true( $nl->get_value('use_soil_moisture_streams') ) ) { - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_mapalgo', - 'hgrid'=>$nl_flags->{'res'} ); add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_tintalgo', 'hgrid'=>$nl_flags->{'res'} ); add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, @@ -3377,11 +3375,10 @@ sub setup_logic_soilm_streams { 'hgrid'=>$nl_flags->{'res'} ); } else { if ( defined($nl->get_value('stream_year_first_soilm')) || - defined($nl->get_value('soilm_mapalgo')) || defined($nl->get_value('model_year_align_soilm')) || defined($nl->get_value('stream_fldfilename_soilm')) || defined($nl->get_value('stream_year_last_soilm')) ) { - $log->fatal_error("One of the soilm streams namelist items (stream_year_first_soilm, soilm_mapalgo," . + $log->fatal_error("One of the soilm streams namelist items (stream_year_first_soilm, " . " model_year_align_soilm, stream_fldfilename_soilm, stream_fldfilename_soilm)" . " is defined, but use_soil_moisture_streams option NOT set to true"); } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 78ad54b799..39065fa564 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1025,7 +1025,6 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nclnd/clm2/prescribed_data/LFMIP-pdLC-SST.H2OSOI.0.9x1.25.20levsoi.natveg.climo1980-2014.MONS_c190709.nc -none linear diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 60fc482590..5da1b43069 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1618,17 +1618,17 @@ to hydrologic variables (either TWS or ZWT) -Toggle to turn on use of soil moisture streams (EXPERIMENTAL and NOT tested) +Toggle to turn on use of input prescribed soil moisture streams rather than have CLM prognose it (EXPERIMENTAL) -First year to loop over for USTAR data +First year to loop over for prescribed soil moisture streams data -Last year to loop over for USTAR data +Last year to loop over for prescribed soil moisture streams data -Filename of input stream data for USTAR - - - +Filename of input stream data for prescribed soil moisture streams data +Time interpolation method to use for prescribed soil moisture streams data diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 7de6fd83e1..764a51d31f 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -69,6 +69,7 @@ subroutine PrescribedSoilMoistureInit(bounds) use shr_stream_mod , only : shr_stream_file_null use shr_string_mod , only : shr_string_listCreateField use clm_varpar , only : nlevsoi + use shr_dmodel_mod , only : shr_dmodel_gGridCompare ! ! !ARGUMENTS: implicit none @@ -83,7 +84,6 @@ subroutine PrescribedSoilMoistureInit(bounds) integer :: nml_error ! namelist i/o error flag type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldfilename_soilm ! ustar stream filename to read - character(len=CL) :: soilm_mapalgo = 'none' ! Mapping alogrithm character(len=CL) :: soilm_tintalgo = 'linear' ! Time interpolation alogrithm character(*), parameter :: subName = "('soil_moisture_init')" @@ -98,7 +98,6 @@ subroutine PrescribedSoilMoistureInit(bounds) stream_year_first_soilm, & stream_year_last_soilm, & model_year_align_soilm, & - soilm_mapalgo, & soilm_tintalgo, & stream_fldfilename_soilm @@ -129,7 +128,6 @@ subroutine PrescribedSoilMoistureInit(bounds) call shr_mpi_bcast(stream_year_last_soilm, mpicom) call shr_mpi_bcast(model_year_align_soilm, mpicom) call shr_mpi_bcast(stream_fldfilename_soilm, mpicom) - call shr_mpi_bcast(soilm_mapalgo, mpicom) call shr_mpi_bcast(soilm_tintalgo, mpicom) if (masterproc) then @@ -140,7 +138,6 @@ subroutine PrescribedSoilMoistureInit(bounds) write(iulog,*) ' stream_year_last_soilm = ',stream_year_last_soilm write(iulog,*) ' model_year_align_soilm = ',model_year_align_soilm write(iulog,*) ' stream_fldfilename_soilm = ',trim(stream_fldfilename_soilm) - write(iulog,*) ' soilm_mapalgo = ',trim(soilm_mapalgo) write(iulog,*) ' soilm_tintalgo = ',trim(soilm_tintalgo) endif @@ -178,12 +175,18 @@ subroutine PrescribedSoilMoistureInit(bounds) fldListFile=fldList, & fldListModel=fldList, & fillalgo='none', & - mapalgo=soilm_mapalgo, & + mapalgo='none', & tintalgo=soilm_tintalgo, & calendar=get_calendar(), & dtlimit = 15._r8, & taxmode='cycle' ) + ! --- It looks like there isn't a way to verify that the input and output grids are the same -- the following does not work --- + !if ( .not. shr_dmodel_gGridCompare(sdat_soilm%grid, sdat_soilm%gsmap, dom_clm, gsMap_lnd2Dsoi_gdc2glo, method=1, & + ! mpicom=mpicom ) )then + ! call endrun(subname // ':: ERROR soil_moisture_streams data is NOT on the same grid that you are running on') + !end if + if (masterproc) then call shr_strdata_print(sdat_soilm,'soil moisture data') endif From 4220e7c1c6c32bf2b73a54043bca861a535fa6b3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 24 Jul 2019 15:35:47 -0600 Subject: [PATCH 0356/1973] Remove the grid comparison that fails to catch differences in the soilm grid to the grid running on --- src/biogeophys/SoilMoistureStreamMod.F90 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 764a51d31f..ade2d4b0dd 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -69,7 +69,6 @@ subroutine PrescribedSoilMoistureInit(bounds) use shr_stream_mod , only : shr_stream_file_null use shr_string_mod , only : shr_string_listCreateField use clm_varpar , only : nlevsoi - use shr_dmodel_mod , only : shr_dmodel_gGridCompare ! ! !ARGUMENTS: implicit none @@ -181,12 +180,6 @@ subroutine PrescribedSoilMoistureInit(bounds) dtlimit = 15._r8, & taxmode='cycle' ) - ! --- It looks like there isn't a way to verify that the input and output grids are the same -- the following does not work --- - !if ( .not. shr_dmodel_gGridCompare(sdat_soilm%grid, sdat_soilm%gsmap, dom_clm, gsMap_lnd2Dsoi_gdc2glo, method=1, & - ! mpicom=mpicom ) )then - ! call endrun(subname // ':: ERROR soil_moisture_streams data is NOT on the same grid that you are running on') - !end if - if (masterproc) then call shr_strdata_print(sdat_soilm,'soil moisture data') endif From ba1d74f9c2b23f97fa6cef25543f85ce5f59a7ff Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 25 Jul 2019 11:01:44 -0600 Subject: [PATCH 0357/1973] fixing makefile... now it works with -lclm and link to ctsm library... but it does not build ctsm and pio......etc. --- lilac/lilac/Makefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index b424fe060e..f835636887 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -33,7 +33,7 @@ include $(ESMFMKFILE) $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< %.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $< + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(CTSM_INC) $(CTSM_LIB) $< %.o : %.c $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< @@ -41,10 +41,14 @@ include $(ESMFMKFILE) % : %.C $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< - +CTSM_BLD_DIR = /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf +CTSM_INC = -I$(CTSM_BLD_DIR)/include +CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm +# ----------------------------------------------------------------------------- +EXTRA_LIBS = -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib # ----------------------------------------------------------------------------- demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) + $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) mv demo_driver demo_driver.exe #rm *.o *.mod @@ -52,14 +56,8 @@ demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_c #demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o -#lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o -#shr_string_mod.o: shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o -shr_log_mod.o: +###shr_string_mod.o: shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o atmos_cap.o: lilac_utils.o -#lnd_comp_esmf.o: shr_string_mod.o abort_utils.o -shr_sys_mod.o: shr_log_mod.o -abort_utils.o: -clm_varctl.o: # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- .PHONY: dust clean distclean berzerk From 4872fdcaab8f28d469232d3baa8db2775b749b6e Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 25 Jul 2019 11:14:48 -0600 Subject: [PATCH 0358/1973] adding some comments to atmos_cap.F90 for tracking.... --- lilac/lilac/atmos_cap.F90 | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index 8f0e5e40c4..04b192b206 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -138,21 +138,28 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! create field !!! Here we want to pass pointers !field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(a2c_fldlist(n)%stdname), rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) - call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8), rc=rc) + !call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8), rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_FieldPrint(field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !call ESMF_LogWrite(subname//"fieldget!", ESMF_LOGMSG_INFO) + !call ESMF_FieldGet(field, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out ! add field to field bundle call ESMF_FieldBundleAdd(a2c_fb, (/field/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - print *, a2c_fldlist(n)%farrayptr1d - print *, "this field is created" + !print *, a2c_fldlist(n)%farrayptr1d + !print *, "this field is created" enddo + call ESMF_LogWrite(subname//"fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" @@ -177,6 +184,10 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) do n = 1,c2a_fldlist_num + print *, "**********************************************************" + print *, "creating field for l2a:" + print *, trim(c2a_fldlist(n)%stdname) + ! create field !!! Here we want to pass pointers if (mesh_switch) then @@ -186,17 +197,19 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) - call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8)*5.5, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8)*5.5, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out else field = ESMF_FieldCreate(atmos_grid, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr2d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if + end if + call ESMF_LogWrite(subname//"line 208 and going.... .... !", ESMF_LOGMSG_INFO) ! add field to field bundle call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) print *, "**********************************************************" print *, "creating field for c2a:" From 817a007af63b526de047d6f18e399a561a5d09e9 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 25 Jul 2019 11:15:18 -0600 Subject: [PATCH 0359/1973] hard coding correct size in demo_driver --- lilac/lilac/demo_driver.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index 9f6bd766cf..9422fc6eea 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -49,7 +49,10 @@ program demo_lilac_driver ! real atmosphere: begc = 1 - endc = 13824 + !endc = 10 + endc = 6912 + !endc = 13824 + !endc = 13968 start_time = 1 end_time = 10 From b1afc82b7c677578a50e80d1fdf8ffe2b74dea38 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 25 Jul 2019 11:15:57 -0600 Subject: [PATCH 0360/1973] changing dummy atmos and land to real atmos and land.... --- lilac/lilac/lilac_mod.F90 | 65 ++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 4d5fb164e2..de009c4a9a 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -32,8 +32,8 @@ module lilac_mod type(ESMF_Calendar),target :: calendar integer :: yy,mm,dd,sec ! ! Gridded Components and Coupling Components - type(ESMF_GridComp) :: dummy_atmos_comp - type(ESMF_GridComp) :: dummy_land_comp + type(ESMF_GridComp) :: atmos_gcomp + type(ESMF_GridComp) :: land_gcomp type(ESMF_CplComp) :: cpl_atm2lnd_comp type(ESMF_CplComp) :: cpl_lnd2atm_comp type(ESMF_State) :: atm2lnd_l_state , atm2lnd_a_state @@ -109,7 +109,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) open(fileunit, status="old", file="./namelist", action="read", iostat=rc) - if (rc == 0) then + if (rc .ne. 0) then call ESMF_LogSetError(rcToCheck=ESMF_RC_FILE_OPEN, msg="Failed to open namelist file 'namelist'", line=__LINE__, file=__FILE__) call ESMF_Finalize(endflag=ESMF_END_ABORT) endif @@ -190,22 +190,22 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! ======================================================================= ! create_fldlist !------------------------------------------------------------------------- - ! Create Gridded Component! --- dummy atmosphere ( atmos_cap) + ! Create Gridded Component! -- atmosphere ( atmos_cap) !------------------------------------------------------------------------- - gcname1 = "Dummy Atmosphere or Atmosphere Cap" - dummy_atmos_comp = ESMF_GridCompCreate(name=gcname1, rc=rc) + gcname1 = " Atmosphere or Atmosphere Cap" + atmos_gcomp = ESMF_GridCompCreate(name=gcname1, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Created "//trim(gcname1)//" component", ESMF_LOGMSG_INFO) - print *, "Dummy Atmosphere Gridded Component Created!" + print *, "Atmosphere Gridded Component Created!" !------------------------------------------------------------------------- - ! Create Gridded Component! --- dummy land ( land cap ) + ! Create Gridded Component! --- CTSM land ( land_capX ) !------------------------------------------------------------------------- - gcname2 = "Dummy Land or Land Cap" - dummy_land_comp = ESMF_GridCompCreate(name=gcname2, rc=rc) + gcname2 = " Land ctsm " + land_gcomp = ESMF_GridCompCreate(name=gcname2, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Created "//trim(gcname2)//" component", ESMF_LOGMSG_INFO) - print *, "Dummy Land Gridded Component Created!" + print *, " Land (ctsm) Gridded Component Created!" !------------------------------------------------------------------------- ! Create Coupling Component! --- Coupler from atmos to land @@ -230,14 +230,14 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) !------------------------------------------------------------------------- ! Register section -- set services -- atmos_cap !------------------------------------------------------------------------- - call ESMF_GridCompSetServices(dummy_atmos_comp, userRoutine=atmos_register, rc=rc) + call ESMF_GridCompSetServices(atmos_gcomp, userRoutine=atmos_register, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"dummy atmos SetServices finished!", ESMF_LOGMSG_INFO) - print *, "Dummy Atmosphere Gridded Component SetServices finished!" + call ESMF_LogWrite(subname//" atmos SetServices finished!", ESMF_LOGMSG_INFO) + print *, " Atmosphere Gridded Component SetServices finished!" !------------------------------------------------------------------------- ! Register section -- set services -- land cap !------------------------------------------------------------------------- - call ESMF_GridCompSetServices(dummy_land_comp, userRoutine=lnd_register, rc=rc) + call ESMF_GridCompSetServices(land_gcomp, userRoutine=lnd_register, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"land SetServices finished!", ESMF_LOGMSG_INFO) print *, "Land Gridded Component SetServices finished!" @@ -314,14 +314,17 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! 3- cpl_atm2lnd 4- cpl_lnd2atm ! ! ------------------------------------------------------------------------- - call ESMF_GridCompInitialize(dummy_atmos_comp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) + call ESMF_GridCompInitialize(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atmos_cap or dummy_atmos_comp initialized", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp initialized", ESMF_LOGMSG_INFO) print *, "atmos_cap initialize finished, rc =", rc - call ESMF_GridCompInitialize(dummy_land_comp , importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//"now we are initializing CTSM ....", ESMF_LOGMSG_INFO) + print *, "now we are initializing CTSM, rc =", rc + call ESMF_GridCompInitialize(land_gcomp , importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"lnd_cap or dummy_land_comp initialized", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"lnd_cap or land_gcomp initialized", ESMF_LOGMSG_INFO) print *, "lnd_cap initialize finished, rc =", rc ! All 4 states that are module variables are no longer empty - have been initialized @@ -391,9 +394,9 @@ subroutine lilac_run( ) !!! if we want to loop through clock in atmos cap. !do while (.NOT. ESMF_ClockIsStopTime(local_clock, rc=rc)) - call ESMF_GridCompRun(dummy_atmos_comp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=local_clock, rc=rc) + call ESMF_GridCompRun(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=local_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atmos_cap or dummy_atmos_comp is running", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp is running", ESMF_LOGMSG_INFO) print *, "Running atmos_cap gridded component , rc =", rc call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=local_clock, rc=rc) @@ -401,9 +404,9 @@ subroutine lilac_run( ) call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) print *, "Running coupler component..... cpl_atm2lnd_comp , rc =", rc - call ESMF_GridCompRun(dummy_land_comp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=local_clock, rc=rc) + call ESMF_GridCompRun(land_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=local_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"lnd_cap or dummy_land_comp is running", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"lnd_cap or land_gcomp is running", ESMF_LOGMSG_INFO) print *, "Running lnd_cap gridded component , rc =", rc call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=local_clock, rc=rc) @@ -447,11 +450,11 @@ subroutine lilac_final( ) print *, " Lilac Finalizing " print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" !------------------------------------------------------------------------- - ! Gridded Component Finalizing! --- dummy atmosphere + ! Gridded Component Finalizing! --- atmosphere !------------------------------------------------------------------------- - call ESMF_GridCompFinalize(dummy_atmos_comp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) + call ESMF_GridCompFinalize(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atmos_cap or dummy_atmos_comp is running", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp is running", ESMF_LOGMSG_INFO) print *, "Finalizing atmos_cap gridded component , rc =", rc !------------------------------------------------------------------------- @@ -463,11 +466,11 @@ subroutine lilac_final( ) print *, "Finalizing coupler component..... cpl_atm2lnd_comp , rc =", rc !------------------------------------------------------------------------- - ! Gridded Component Finalizing! --- dummy land + ! Gridded Component Finalizing! --- land !------------------------------------------------------------------------- - call ESMF_GridCompFinalize(dummy_land_comp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) + call ESMF_GridCompFinalize(land_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"lnd_cap or dummy_land_comp is running", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"lnd_cap or land_gcomp is running", ESMF_LOGMSG_INFO) print *, "Finalizing lnd_cap gridded component , rc =", rc !------------------------------------------------------------------------- @@ -496,9 +499,9 @@ subroutine lilac_final( ) call ESMF_LogWrite(subname//"destroying all components ", ESMF_LOGMSG_INFO) print *, "ready to destroy all components" - call ESMF_GridCompDestroy(dummy_atmos_comp, rc=rc) + call ESMF_GridCompDestroy(atmos_gcomp, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_GridCompDestroy(dummy_land_comp, rc=rc) + call ESMF_GridCompDestroy(land_gcomp, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) call ESMF_CplCompDestroy(cpl_atm2lnd_comp, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) From 7416f57e5070669bbcc9963c0e49ae1c62e0cd44 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 25 Jul 2019 11:16:36 -0600 Subject: [PATCH 0361/1973] updating batch.script.... --- lilac/lilac/batch.sub | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lilac/lilac/batch.sub b/lilac/lilac/batch.sub index 746db8d477..5d968ed7c9 100644 --- a/lilac/lilac/batch.sub +++ b/lilac/lilac/batch.sub @@ -2,10 +2,12 @@ #PBS -N job_name #####PBS -A P54048000 #PBS -A P93300606 -#PBS -l walltime=00:05:00 -#PBS -q regular -#PBS -j oe -#PBS -l select=2:ncpus=2:mpiprocs=4 +#PBS -l walltime=00:10:00 +#PBS -q premium +##PBS -q regular +###PBS -j oe +##PBS -l select=2:ncpus=2:mpiprocs=4 +#PBS -l select=1:ncpus=1:mpiprocs=2 ##PBS -l select=1:ncpus=1:mpiprocs=1 ml @@ -19,4 +21,4 @@ echo "hello" ### Run the executable set MPI_SHEPHERD=true source /glade/scratch/negins/test_clean/.env_mach_specific.csh -mpiexec_mpt ./demo_driver +mpiexec_mpt ./demo_driver.exe From d3693bfc364eee109b00687b96808b3b271faeb5 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 25 Jul 2019 12:45:14 -0600 Subject: [PATCH 0362/1973] removing .mod and .o after making.... --- lilac/lilac/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index f835636887..40c5157b89 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -50,7 +50,7 @@ EXTRA_LIBS = -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothre demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) mv demo_driver demo_driver.exe - #rm *.o *.mod + rm *.o *.mod # module dependencies: #demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o From aa6be37deeb379dd68a7177fb7460deb6c16424b Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 25 Jul 2019 12:52:01 -0600 Subject: [PATCH 0363/1973] saving before adding the default values and units.... --- lilac/lilac/lilac_utils.F90 | 174 +++++++++++++++++++++++++++++++++--- 1 file changed, 163 insertions(+), 11 deletions(-) diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index c4a665527e..ce57848dbb 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -20,6 +20,8 @@ module lilac_utils character(len=128) :: units real(ESMF_KIND_R8), pointer :: farrayptr1d(:) ! this will be filled in by lilac when it gets its data from the host atm real(ESMF_KIND_R8), pointer :: farrayptr2d(:,:) ! this will be filled in by lilac when it gets its data from the host atm + integer :: ungridded_lbound = 0 + integer :: ungridded_ubound = 0 end type fld_list_type !!! 1d for when we have mesh and 2d for when we have grids.... @@ -60,27 +62,38 @@ module lilac_utils contains !=============================================================================== - subroutine fldlist_add(num, fldlist, stdname, default_value, units) - ! This adds a field to a fieldlist! + subroutine fldlist_add(num, fldlist, stdname, default_value, units, ungridded_lbound, ungridded_ubound) + ! This adds a field to a fieldlist! + ! input/output variables integer, intent(inout) :: num type(fld_list_type), intent(inout) :: fldlist(:) character(len=*), intent(in) :: stdname real, optional, intent(in) :: default_value character(len=*), optional, intent(in) :: units + integer, optional, intent(in) :: ungridded_lbound + integer, optional, intent(in) :: ungridded_ubound ! local variables integer :: rc - character(len=*), parameter :: subname='(fldlist_add)' + character(len=*), parameter :: subname=':[fldlist_add]' !------------------------------------------------------------------------------- ! Set up a list of field information num = num + 1 if (num > fldsMax) then call ESMF_LogWrite(subname//"?!", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(trim(subname)//": ERROR num > fldsMax "//trim(stdname), & + ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__) + return endif fldlist(num)%stdname = trim(stdname) + if (present(ungridded_lbound) .and. present(ungridded_ubound)) then + fldlist(num)%ungridded_lbound = ungridded_lbound + fldlist(num)%ungridded_ubound = ungridded_ubound + end if + if(present(default_value)) then fldlist(num)%default_value = default_value else @@ -94,17 +107,156 @@ subroutine fldlist_add(num, fldlist, stdname, default_value, units) end subroutine fldlist_add - subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist ) + subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, rof_prognostic, glc_present ) + ! add all the necessary fields one by one to the fieldlist - type(fld_list_type), intent(inout) :: a2c_fldlist - type(fld_list_type), intent(inout) :: c2a_fldlist - type(fld_list_type), intent(inout) :: l2c_fldlist - type(fld_list_type), intent(inout) :: c2l_fldlist + type(fld_list_type), intent(inout) :: a2c_fldlist(fldsMax) + type(fld_list_type), intent(inout) :: c2a_fldlist(fldsMax) + type(fld_list_type), intent(inout) :: l2c_fldlist(fldsMax) + type(fld_list_type), intent(inout) :: c2l_fldlist(fldsMax) + + !type (fld_list_type) :: fldsToLnd(fldsMax) + !type (fld_list_type) :: fldsFrLnd(fldsMax) + + !integer :: fldsFrCpl_num, fldsToCpl_num + integer :: fldsToLnd_num != 0 ! From atmosphere to land (a2c and c2l) + integer :: fldsFrLnd_num != 0 ! From land to atmosphere (l2c and c2a) + integer, parameter :: fldsMax = 100 + + + logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model + logical , intent(in) :: rof_prognostic ! .true. => running with a prognostic ROF model + + ! TODO (NS) : I should add default value and units here..... + + !------------------------------------------------------------------------- + ! !---- from atm ----! a2c_fldlist & c2l_fldlist + !------------------------------------------------------------------------- + !--------------------------a2c_fldlist------------------------------------ + ! from atm - states + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_z' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_topo' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_u' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_v' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_ptem' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_pbot' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_tbot' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_shum' ) + !call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_methane' ) + + ! from atm - fluxes + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_lwdn' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_rainc' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_rainl' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_snowc' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_snowl' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_swndr' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_swvdr' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_swndf' ) + call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_swvdf' ) + + !--------------------------c2l_fldlist------------------------------------ + ! from atm - states + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_z' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_topo' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_u' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_v' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_ptem' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_pbot' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_tbot' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_shum' ) + !call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_methane' ) + + ! from atm - fluxes + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_lwdn' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_rainc' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_rainl' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_snowc' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_snowl' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swndr' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swvdr' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swndf' ) + call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swvdf' ) + + !------------------------------------------------------------------------- + ! !---- from lnd ----! l2c_fldlist & c2a_fldlist + !------------------------------------------------------------------------- + !--------------------------l2c_fldlist------------------------------------ + ! export land states + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_lfrin' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_t' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_tref' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_qref' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_avsdr' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_anidr' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_avsdf' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_anidf' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_snowh' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_u10' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_fv' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_ram1' ) + + + ! export fluxes to river + if (rof_prognostic) then + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofsur' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofgwl' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofsub' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofi' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_irrig' ) + end if + + ! export fluxes to atm + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_taux' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_tauy' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_lat' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_sen' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_lwup' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_evap' ) + call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_swnet' ) + + ! call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_methane' ) + + + !--------------------------c2a_fldlist------------------------------------ + ! export land states + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_lfrin' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_t' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_tref' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_qref' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_avsdr' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_anidr' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_avsdf' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_anidf' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_snowh' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_u10' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_fv' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_ram1' ) + + + ! export fluxes to river + if (rof_prognostic) then + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_rofsur' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_rofgwl' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_rofsub' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_rofi' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_irrig' ) + end if + + ! export fluxes to atm + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_taux' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_tauy' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_lat' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_sen' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_lwup' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_evap' ) + call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_swnet' ) + + ! call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_methane' ) + - integer :: fldsFrCpl_num, fldsToCpl_num - ! from atm - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'atmos2lnd_var', default_value=0.0, units='m') + !call fldlist_add(fldsToCpl_num, fldsToCpl, 'atmos2lnd_var', default_value=0.0, units='m') ! from lnd !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'lnd2atmos_var', default_value=0.0, units='m') From 4d4062285cb00ad67d0bc9356e7c0c45fafd9578 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 25 Jul 2019 12:55:00 -0600 Subject: [PATCH 0364/1973] working on CMake from other branch and building the necessary libraries....this builds a lilac.exe... --- lilac/CMakeLists.txt | 77 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 8 deletions(-) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 0506f8751b..864aa7a0a7 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -1,29 +1,90 @@ cmake_minimum_required(VERSION 2.8.12.1) -project(LILAC Fortran) + + +### ********** ### +set (CIME_ROOT "/glade/work/negins/UFSCOMP/cime") +message ("CIME_ROOT: ${CIME_ROOT}") +set (CIME_CMAKE_MODULE_DIRECTORY "/glade/work/negins/UFSCOMP/cime/src/CMake/") +message ("CIME_CMAKE_MODULE_DIRECTORY: ${CIME_CMAKE_MODULE_DIRECTORY}") + +list(APPEND CMAKE_MODULE_PATH ${CIME_CMAKE_MODULE_DIRECTORY}) +message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") +include(CIME_initial_setup) + +message("----------------------------------------------------") + +project(LILAC Fortran C) enable_language(Fortran) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") +# We rely on pio for cmake utilities like findnetcdf.cmake, so that we don't +# need to duplicate this cmake code +message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") +list(APPEND CMAKE_MODULE_PATH "${CIME_ROOT}/src/externals/pio2/cmake") +message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") + +message("----------------------------------------------------") + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") +message ("CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") +message("----------------------------------------------------") find_package(MPI REQUIRED) # TODO: This should be found from the find_package call but its not working #set(CMAKE_Fortran_COMPILER "/usr/lib64/mpich/bin/mpif90") find_package(ESMF REQUIRED) + +include(CIME_utils) +message("----------------------------------------------------") + +find_package(NetCDF COMPONENTS C Fortran) +include_directories(${NetCDF_C_INCLUDE_DIRS} ${NetCDF_Fortran_INCLUDE_DIRS}) +message("NetCDF_C_INCLUDE_DIRS: ${NetCDF_C_INCLUDE_DIRS}") +message("----------------------------------------------------") + +##=======## +#set(CESM_ROOT "/glade/work/negins/UFSCOMP/") +#set(CSM_SHR "/glade/work/negins/UFSCOMP/components/clm/src/unit_test_stubs/csm_share/") + +#add_subdirectory(${CESM_ROOT}/models/csm_share/shr csm_share) +#add_subdirectory(${CSM_SHR} ) + +#==============### +set(SHARE_ROOT "${CIME_ROOT}/src/share") +#add_subdirectory(${CIME_ROOT}/src/share/util csm_share) +#add_subdirectory(${CIME_ROOT}/src/share/unit_test_stubs/util csm_share_stubs) +#add_subdirectory(${CIME_ROOT}/src/share/esmf_wrf_timemgr esmf_wrf_timemgr) +#add_subdirectory(${CIME_ROOT}/src/drivers/mct/shr drv_share) +#message("----------------------------------------------------") + + +add_subdirectory(${SHARE_ROOT}/util csm_share) +add_subdirectory(${SHARE_ROOT}/unit_test_stubs/util csm_share_stubs) +include_directories(${SHARE_ROOT}/include) + +# esmf_wrf_timemgr not built here because it depends on csm_share. +#add_subdirectory(${SHARE_ROOT}/esmf_wrf_timemgr esmf_wrf_timemgr) +#include_directories(${SHARE_ROOT}/esmf_wrf_timemgr) + + + + # -lclm libclm.a SET(NAMES libclm.a) -find_library(LIB_TO_INCLUDE - libclm.a - PATHS /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib/) +#find_library(LIB_TO_INCLUDE +# libclm.a +# PATHS /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib/) #find_library(LIB_TO_INCLUDE /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib/) -message(STATUS "include_directories for ${NAMES}: ${LIB_TO_INCLUDE}") +#message(STATUS "include_directories for ${NAMES}: ${LIB_TO_INCLUDE}") #include_directories(${LIB_TO_INCLUDE}) #link_directories(${LIB_TO_INCLUDE}) -message(STATUS "include_directories for ${NAMES}: ${LIB_TO_INCLUDE}") +#message(STATUS "include_directories for ${NAMES}: ${LIB_TO_INCLUDE}") #find_library(LIB_TO_INCLUDE /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib/) -message(STATUS "include_directories: ${LIB_TO_INCLUDE}") +#message(STATUS "include_directories: ${LIB_TO_INCLUDE}") #target_link_libraries (${LIB_TO_INCLUDE}) # Local CMake modules From 0f9009a1fa4f4a0757c5b90663a5250104f97432 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 28 Jul 2019 16:19:03 -0600 Subject: [PATCH 0365/1973] Add optional 3D Glacier fields back in with a new namelist item outnc_3dglc that output them only when set --- tools/mksurfdata_map/mksurfdata.pl | 8 ++++ tools/mksurfdata_map/src/mkfileMod.F90 | 17 +++++++ tools/mksurfdata_map/src/mkglcmecMod.F90 | 61 +++++++++++++++++++++++- tools/mksurfdata_map/src/mksurfdat.F90 | 46 ++++++++++++++++-- tools/mksurfdata_map/src/mkvarctl.F90 | 3 +- 5 files changed, 130 insertions(+), 5 deletions(-) diff --git a/tools/mksurfdata_map/mksurfdata.pl b/tools/mksurfdata_map/mksurfdata.pl index fc5f1bd8ea..02e6f28659 100755 --- a/tools/mksurfdata_map/mksurfdata.pl +++ b/tools/mksurfdata_map/mksurfdata.pl @@ -52,6 +52,7 @@ my %opts = ( hgrid=>"all", vic=>0, + 3dglc=>0, ssp_rcp=>"hist", debug=>0, exedir=>undef, @@ -146,6 +147,7 @@ sub usage { -usrname "clm_usrdat_name" CLM user data name to find grid file with. -vic Add the fields required for the VIC model + -3dglc Add the optional 3D glacier fields for verification of the glacier model NOTE: years, res, and ssp_rcp can be comma delimited lists. @@ -363,6 +365,11 @@ sub write_namelist_file { map_fvic = '$map->{'vic'}' mksrf_fvic = '$datfil->{'vic'}' outnc_vic = .true. +EOF + } + if ( $opts{'3dglc'} ) { + print $fh <<"EOF"; + outnc_3dglc = .true. EOF } if ( ! $opts{'fast_maps'} ) { @@ -457,6 +464,7 @@ sub write_namelist_file { "pft_idx=s" => \$opts{'pft_idx'}, "ssp_rcp=s" => \$opts{'ssp_rcp'}, "vic!" => \$opts{'vic'}, + "3dglc!" => \$opts{'3dglc'}, "rundir=s" => \$opts{'rundir'}, "soil_col=i" => \$opts{'soil_col'}, "soil_fmx=f" => \$opts{'soil_fmx'}, diff --git a/tools/mksurfdata_map/src/mkfileMod.F90 b/tools/mksurfdata_map/src/mkfileMod.F90 index 3c5852796a..52e819623b 100644 --- a/tools/mksurfdata_map/src/mkfileMod.F90 +++ b/tools/mksurfdata_map/src/mkfileMod.F90 @@ -486,6 +486,23 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) lev1name='nglcec', & long_name='mean elevation on glacier elevation classes', units='m') + if ( outnc_3dglc ) then + call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_MEC_GIC', xtype=xtype, & + lev1name='nglcec', & + long_name='percent smaller glaciers and ice caps for each glacier elevation class (% of landunit)', units='unitless') + + call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_MEC_ICESHEET', xtype=xtype, & + lev1name='nglcec', & + long_name='percent ice sheet for each glacier elevation class (% of landunit)', units='unitless') + + call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_GIC', xtype=xtype, & + long_name='percent ice caps/glaciers (% of landunit)', units='unitless') + + call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_ICESHEET', xtype=xtype, & + long_name='percent ice sheet (% of landunit)', units='unitless') + + end if + call ncd_def_spatial_var(ncid=ncid, varname='PCT_URBAN', xtype=xtype, & lev1name='numurbl', & long_name='percent urban for each density type', units='unitless') diff --git a/tools/mksurfdata_map/src/mkglcmecMod.F90 b/tools/mksurfdata_map/src/mkglcmecMod.F90 index 8ee41dd5ba..b750d34206 100644 --- a/tools/mksurfdata_map/src/mkglcmecMod.F90 +++ b/tools/mksurfdata_map/src/mkglcmecMod.F90 @@ -125,7 +125,9 @@ end subroutine mkglcmecInit ! !INTERFACE: subroutine mkglcmec(ldomain, mapfname, & datfname_fglacier, ndiag, & - pctglcmec_o, topoglcmec_o ) + pctglcmec_o, topoglcmec_o, & + pctglcmec_gic_o, pctglcmec_icesheet_o, & + pctglc_gic_o, pctglc_icesheet_o) ! ! !DESCRIPTION: ! make percent glacier on multiple elevation classes, mean elevation for each @@ -158,6 +160,10 @@ subroutine mkglcmec(ldomain, mapfname, & integer , intent(in) :: ndiag ! unit number for diag out real(r8) , intent(out):: pctglcmec_o (:,:) ! % for each elevation class on output glacier grid (% of landunit) real(r8) , intent(out):: topoglcmec_o(:,:) ! mean elevation for each elevation classs on output glacier grid + real(r8), optional, intent(out):: pctglcmec_gic_o(:,:) ! % glc gic on output grid, by elevation class (% of landunit) + real(r8), optional, intent(out):: pctglcmec_icesheet_o(:,:) ! % glc ice sheet on output grid, by elevation class (% of landunit) + real(r8), optional, intent(out):: pctglc_gic_o(:) ! % glc gic on output grid, summed across elevation classes (% of landunit) + real(r8), optional, intent(out):: pctglc_icesheet_o(:) ! % glc ice sheet on output grid, summed across elevation classes (% of landunit) ! ! !CALLED FROM: ! subroutine mksrfdat in module mksrfdatMod @@ -203,6 +209,16 @@ subroutine mkglcmec(ldomain, mapfname, & pctglcmec_o(:,:) = 0. topoglcmec_o(:,:) = 0. + if ( outnc_3dglc )then + if ( (.not. present(pctglcmec_gic_o)) .or. (.not. present(pctglcmec_icesheet_o)) .or. & + (.not. present(pctglc_gic_o) .or. (.not. present(pctglc_icesheet_o) )then + call shr_sys_abort( subname//' ERROR: 3D glacier fields were NOT sent in and they are required' ) + end if + pctglcmec_gic_o(:,:) = 0. + pctglcmec_icesheet_o(:,:) = 0. + pctglc_gic_o(:) = 0. + pctglc_icesheet_o(:) = 0. + end if ! Set number of output points @@ -304,6 +320,10 @@ subroutine mkglcmec(ldomain, mapfname, & if (frac > 0) then pctglc_i = pctglc_gic_i(ni) + pctglc_icesheet_i(ni) pctglcmec_o(no,m) = pctglcmec_o(no,m) + wt*pctglc_i / frac + if ( outnc_3dglc )then + pctglcmec_gic_o(no,m) = pctglcmec_gic_o(no,m) + wt*pctglc_gic_i(ni) / frac + pctglcmec_icesheet_o(no,m) = pctglcmec_icesheet_o(no,m) + wt*pctglc_icesheet_i(ni) / frac + end if ! note that, by weighting the following by pctglc_i, we are getting something ! like the average topographic height over glaciated areas - NOT the average @@ -359,14 +379,27 @@ subroutine mkglcmec(ldomain, mapfname, & if (pctglc_tot_o(no) > 0._r8) then pctglcmec_o(no,:) = pctglcmec_o(no,:) / pctglc_tot_o(no) * 100._r8 + if ( outnc_3dglc )then + pctglcmec_gic_o(no,:) = pctglcmec_gic_o(no,:) / pctglc_tot_o(no) * 100._r8 + pctglcmec_icesheet_o(no,:) = pctglcmec_icesheet_o(no,:) / pctglc_tot_o(no) * 100._r8 + end if else ! Division of landunit is ambiguous. Apply the rule that all area is assigned to ! the lowest elevation class, and all GIC. pctglcmec_o(no,1) = 100._r8 + if ( outnc_3dglc )then + pctglcmec_gic_o(no,1) = 100._r8 + end if end if end do + ! Set pctglc_gic_o to sum of pctglcmec_gic_o across elevation classes, and similarly for pctglc_icesheet_o + if ( outnc_3dglc )then + pctglc_gic_o = sum(pctglcmec_gic_o, dim=2) + pctglc_icesheet_o = sum(pctglcmec_icesheet_o, dim=2) + end if + ! -------------------------------------------------------------------- ! Perform various sanity checks ! -------------------------------------------------------------------- @@ -382,6 +415,32 @@ subroutine mkglcmec(ldomain, mapfname, & end if end do + ! Confirm that GIC + ICESHEET = 100% + if ( outnc_3dglc )then + do no = 1,ns_o + if (abs((pctglc_gic_o(no) + pctglc_icesheet_o(no)) - 100._r8) > eps) then + write(6,*)'GIC + ICESHEET differs from 100% at no,pctglc_gic,pctglc_icesheet,lon,lat=', & + no,pctglc_gic_o(no),pctglc_icesheet_o(no),& + tgridmap%xc_dst(no),tgridmap%yc_dst(no) + errors = .true. + end if + end do + + ! Check that GIC + ICESHEET = total glacier at each elevation class + do m = 1, nglcec + do no = 1,ns_o + if (abs((pctglcmec_gic_o(no,m) + pctglcmec_icesheet_o(no,m)) - & + pctglcmec_o(no,m)) > eps) then + write(6,*)'GIC + ICESHEET differs from total GLC ' + write(6,*)'at no,m,pctglcmec,pctglcmec_gic,pctglcmec_icesheet = ' + write(6,*) no,m,pctglcmec_o(no,m),pctglcmec_gic_o(no,m),pctglcmec_icesheet_o(no,m) + errors = .true. + end if + end do + end do + end if + + ! Error check: are all elevations within elevation class range do no = 1,ns_o do m = 1,nglcec diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index 85d8d72703..84e285d2b5 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -97,8 +97,12 @@ program mksurfdat real(r8), pointer :: harvest1D(:) ! harvest 1D data: normalized harvesting real(r8), pointer :: harvest2D(:,:) ! harvest 1D data: normalized harvesting real(r8), allocatable :: pctgla(:) ! percent of grid cell that is glacier + real(r8), allocatable :: pctglc_gic(:) ! percent of grid cell that is gic (% of glc landunit) + real(r8), allocatable :: pctglc_icesheet(:) ! percent of grid cell that is ice sheet (% of glc landunit) real(r8), allocatable :: pctglcmec(:,:) ! glacier_mec pct coverage in each class (% of landunit) real(r8), allocatable :: topoglcmec(:,:) ! glacier_mec sfc elevation in each gridcell and class + real(r8), allocatable :: pctglcmec_gic(:,:) ! GIC pct coverage in each class (% of landunit) + real(r8), allocatable :: pctglcmec_icesheet(:,:) ! icesheet pct coverage in each class (% of landunit) real(r8), allocatable :: elevclass(:) ! glacier_mec elevation classes integer, allocatable :: glacier_region(:) ! glacier region ID real(r8), allocatable :: pctlak(:) ! percent of grid cell that is lake @@ -206,6 +210,7 @@ program mksurfdat outnc_double, & outnc_dims, & outnc_vic, & + outnc_3dglc, & fsurdat, & fdyndat, & fsurlog, & @@ -276,6 +281,7 @@ program mksurfdat ! outnc_double ------ If output should be in double precision ! outnc_large_files - If output should be in NetCDF large file format ! outnc_vic --------- Output fields needed for VIC + ! outnc_3dglc ------- Output 3D glacier fields (normally only needed for comparasion) ! nglcec ------------ If you want to change the number of Glacier elevation classes ! gitdescribe ------- Description of this version from git ! ====================================== @@ -303,6 +309,7 @@ program mksurfdat outnc_large_files = .false. outnc_double = .true. outnc_vic = .false. + outnc_3dglc = .false. all_urban = .false. no_inlandwet = .true. @@ -352,6 +359,9 @@ program mksurfdat if ( outnc_vic )then write(6,*)'Output VIC fields' end if + if ( outnc_3dglc )then + write(6,*)'Output optional 3D glacier fields (mostly used for verification of the glacier model)' + end if if ( all_urban )then write(6,*) 'Output ALL data in file as 100% urban' end if @@ -781,13 +791,28 @@ program mksurfdat allocate (pctglcmec(ns_o,nglcec), & topoglcmec(ns_o,nglcec) ) + if ( outnc_3dglc )then + allocate( & + pctglcmec_gic(ns_o,nglcec), & + pctglcmec_icesheet(ns_o,nglcec)) + allocate (pctglc_gic(ns_o)) + allocate (pctglc_icesheet(ns_o)) + end if pctglcmec(:,:) = spval topoglcmec(:,:) = spval - call mkglcmec (ldomain, mapfname=map_fglacier, & - datfname_fglacier=mksrf_fglacier, ndiag=ndiag, & - pctglcmec_o=pctglcmec, topoglcmec_o=topoglcmec ) + if ( outnc_3dglc )then + call mkglcmec (ldomain, mapfname=map_fglacier, & + datfname_fglacier=mksrf_fglacier, ndiag=ndiag, & + pctglcmec_o=pctglcmec, topoglcmec_o=topoglcmec, & + pctglcmec_gic_o=pctglcmec_gic, pctglcmec_icesheet_o=pctglcmec_icesheet, & + pctglc_gic_o=pctglc_gic, pctglc_icesheet_o=pctglc_icesheet) + else + call mkglcmec (ldomain, mapfname=map_fglacier, & + datfname_fglacier=mksrf_fglacier, ndiag=ndiag, & + pctglcmec_o=pctglcmec, topoglcmec_o=topoglcmec ) + end if ! Determine fractional land from pft dataset @@ -869,6 +894,20 @@ program mksurfdat call check_ret(nf_inq_varid(ncid, 'TOPO_GLC_MEC', varid), subname) call check_ret(nf_put_var_double(ncid, varid, topoglcmec), subname) + if ( outnc_3dglc )then + call check_ret(nf_inq_varid(ncid, 'PCT_GLC_MEC_GIC', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, pctglcmec_gic), subname) + + call check_ret(nf_inq_varid(ncid, 'PCT_GLC_MEC_ICESHEET', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, pctglcmec_icesheet), subname) + + call check_ret(nf_inq_varid(ncid, 'PCT_GLC_GIC', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, pctglc_gic), subname) + + call check_ret(nf_inq_varid(ncid, 'PCT_GLC_ICESHEET', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, pctglc_icesheet), subname) + end if + call check_ret(nf_inq_varid(ncid, 'PCT_URBAN', varid), subname) call check_ret(nf_put_var_double(ncid, varid, urbn_classes_g), subname) @@ -1005,6 +1044,7 @@ program mksurfdat deallocate ( organic ) deallocate ( ef1_btr, ef1_fet, ef1_fdt, ef1_shr, ef1_grs, ef1_crp ) deallocate ( pctglcmec, topoglcmec) + if ( outnc_3dglc ) deallocate ( pctglc_gic, pctglc_icesheet) deallocate ( elevclass ) deallocate ( fmax ) deallocate ( pctsand, pctclay ) diff --git a/tools/mksurfdata_map/src/mkvarctl.F90 b/tools/mksurfdata_map/src/mkvarctl.F90 index 44585b7fc0..8c8172c22d 100644 --- a/tools/mksurfdata_map/src/mkvarctl.F90 +++ b/tools/mksurfdata_map/src/mkvarctl.F90 @@ -22,7 +22,8 @@ module mkvarctl logical, public :: outnc_double ! output ALL data in files as 64-bit integer, public :: outnc_dims = 2 ! only applicable to lat/lon grids logical, public :: outnc_1d ! true => output file is 1d - logical, public :: outnc_vic ! true => output file is 1d + logical, public :: outnc_vic ! true => output VIC fields + logical, public :: outnc_3dglc ! true => output 3D glacier fields character(len= 32), public :: mksrf_gridnm = ' ' ! name of grid to use on output file character(len=256), public :: mksrf_fgrid = ' ' ! land grid file name to use From 3b28bd743c0b4be0ebf4c597a2e372b850548366 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 29 Jul 2019 11:10:41 -0600 Subject: [PATCH 0366/1973] Do FATES update changes by hand, do some hand checking to make sure it's correct --- src/utils/clmfates_interfaceMod.F90 | 309 ++++++++++++++++++++-------- 1 file changed, 218 insertions(+), 91 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 79e71cc7ae..e661ace1dc 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -45,7 +45,8 @@ module CLMFatesInterfaceMod use SoilStateType , only : soilstate_type use clm_varctl , only : iulog - use clm_varctl , only : use_vertsoilc + use clm_varctl , only : use_vertsoilc + use clm_varctl , only : fates_parteh_mode use clm_varctl , only : use_fates_spitfire use clm_varctl , only : use_fates_planthydro use clm_varctl , only : use_fates_ed_st3 @@ -64,7 +65,6 @@ module CLMFatesInterfaceMod use clm_varpar , only : ivis use clm_varpar , only : inir use clm_varpar , only : nlevgrnd - use clm_varpar , only : nlevsoi use clm_varpar , only : nlevdecomp use clm_varpar , only : nlevdecomp_full use PhotosynthesisMod , only : photosyns_type @@ -104,14 +104,14 @@ module CLMFatesInterfaceMod use FatesInterfaceMod , only : allocate_bcout use FatesInterfaceMod , only : SetFatesTime use FatesInterfaceMod , only : set_fates_ctrlparms + use FatesInterfaceMod , only : InitPARTEHGlobals use FatesHistoryInterfaceMod, only : fates_history_interface_type use FatesRestartInterfaceMod, only : fates_restart_interface_type use ChecksBalancesMod , only : SummarizeNetFluxes, FATES_BGC_Carbon_BalanceCheck use EDTypesMod , only : ed_patch_type - use FatesHydraulicsMemMod , only : nlevsoi_hyd - use FatesInterfaceMod , only : hlm_numlevgrnd, hlm_numlevsoil, hlm_numlevdecomp_full + use FatesInterfaceMod , only : hlm_numlevgrnd use EDMainMod , only : ed_ecosystem_dynamics use EDMainMod , only : ed_update_site use EDInitMod , only : zero_site @@ -256,6 +256,7 @@ subroutine init(this, bounds_proc ) integer, allocatable :: collist (:) type(bounds_type) :: bounds_clump integer :: nmaxcol + integer :: ndecomp ! Initialize the FATES communicators with the HLM ! This involves to stages @@ -288,15 +289,13 @@ subroutine init(this, bounds_proc ) call set_fates_ctrlparms('nir_sw_index',ival=inir) call set_fates_ctrlparms('num_lev_ground',ival=nlevgrnd) - call set_fates_ctrlparms('num_lev_soil',ival=nlevsoi) - call set_fates_ctrlparms('num_levdecomp',ival=nlevdecomp) - call set_fates_ctrlparms('num_levdecomp_full',ival=nlevdecomp_full) call set_fates_ctrlparms('hlm_name',cval='CLM') call set_fates_ctrlparms('hio_ignore_val',rval=spval) call set_fates_ctrlparms('soilwater_ipedof',ival=get_ipedof(0)) call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) ! RGK: FATES IGNORES ! AND DOESNT TOUCH ! THE BARE SOIL PATCH + call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) if(is_restart()) then pass_is_restart = 1 @@ -444,8 +443,17 @@ subroutine init(this, bounds_proc ) ! No information about the patch or cohort structure is needed at this step do s = 1, this%fates(nc)%nsites - call allocate_bcin(this%fates(nc)%bc_in(s)) - call allocate_bcout(this%fates(nc)%bc_out(s)) + + c = this%f2hmap(nc)%fcolumn(s) + + if (use_vertsoilc) then + ndecomp = col%nbedrock(c) + else + ndecomp = 1 + end if + + call allocate_bcin(this%fates(nc)%bc_in(s),col%nbedrock(c),ndecomp) + call allocate_bcout(this%fates(nc)%bc_out(s),col%nbedrock(c),ndecomp) call this%fates(nc)%zero_bcs(s) ! Pass any grid-cell derived attributes to the site @@ -463,7 +471,9 @@ subroutine init(this, bounds_proc ) call this%init_soil_depths(nc) - if (use_fates_planthydro) call InitHydrSites(this%fates(nc)%sites) + if (use_fates_planthydro) then + call InitHydrSites(this%fates(nc)%sites,this%fates(nc)%bc_in,maxveg_ed) + end if if( this%fates(nc)%nsites == 0 ) then @@ -487,8 +497,16 @@ subroutine init(this, bounds_proc ) end do !$OMP END PARALLEL DO + + ! This will initialize all globals associated with the chosen + ! Plant Allocation and Reactive Transport hypothesis. This includes + ! mapping tables and global variables. These will be read-only + ! and only required once per machine instance (thus no requirements + ! to have it instanced on each thread + call InitPARTEHGlobals() + call this%init_history_io(bounds_proc) ! Report Fates Parameters (debug flag in lower level routines) @@ -567,6 +585,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: mon ! month (1, ..., 12) integer :: day ! day of month (1, ..., 31) integer :: sec ! seconds of the day + integer :: nlevsoil ! number of soil layers at the site + integer :: nld_si ! site specific number of decomposition layers integer :: current_year integer :: current_month integer :: current_day @@ -609,15 +629,19 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s=1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - this%fates(nc)%bc_in(s)%h2o_liqvol_gl(1:nlevsoi) = & - waterstatebulk_inst%h2osoi_vol_col(c,1:nlevsoi) + + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + + this%fates(nc)%bc_in(s)%h2o_liqvol_sl(1:nlevsoil) = & + waterstatebulk_inst%h2osoi_vol_col(c,1:nlevsoil) ! TO-DO: SHOULD THIS BE LIQVOL OR IS VOL OK? (RGK-02-2017) this%fates(nc)%bc_in(s)%t_veg24_si = & temperature_inst%t_veg24_patch(col%patchi(c)) - this%fates(nc)%bc_in(s)%max_rooting_depth_index_col = canopystate_inst%altmax_lastyear_indx_col(c) + this%fates(nc)%bc_in(s)%max_rooting_depth_index_col = & + min(nlevsoil, canopystate_inst%altmax_lastyear_indx_col(c)) do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno p = ifp+col%patchi(c) @@ -637,12 +661,12 @@ subroutine dynamics_driv(this, nc, bounds_clump, & if(use_fates_planthydro)then - this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoi) = soilstate_inst%hksat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoi) = soilstate_inst%watsat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoi) = soilstate_inst%watres_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoi) = soilstate_inst%sucsat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoi) = soilstate_inst%bsw_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoi) = waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoi) + this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoil) = soilstate_inst%hksat_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoil) = soilstate_inst%watsat_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoil) = soilstate_inst%watres_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoil) = soilstate_inst%sucsat_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoil) = soilstate_inst%bsw_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoil) = waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoil) end if @@ -678,12 +702,19 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lab_c_col(c,:) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_lab_c_col(:) - soilbiogeochem_carbonflux_inst%FATES_c_to_litr_cel_c_col(c,:) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_cel_c_col(:) - soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lig_c_col(c,:) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_lig_c_col(:) + + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lab_c_col(c,1:nlevdecomp) = 0.0_r8 + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_cel_c_col(c,1:nlevdecomp) = 0.0_r8 + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lig_c_col(c,1:nlevdecomp) = 0.0_r8 + + nld_si = this%fates(nc)%bc_in(s)%nlevdecomp + + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lab_c_col(c,1:nld_si) = & + this%fates(nc)%bc_out(s)%FATES_c_to_litr_lab_c_col(1:nld_si) + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_cel_c_col(c,1:nld_si) = & + this%fates(nc)%bc_out(s)%FATES_c_to_litr_cel_c_col(1:nld_si) + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lig_c_col(c,1:nld_si) = & + this%fates(nc)%bc_out(s)%FATES_c_to_litr_lig_c_col(1:nld_si) end do @@ -779,17 +810,17 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & ! ! Diagnose water storage in canopy if hydraulics is on ! ! This updates the internal value and the bc_out value. ! ! If hydraulics is off, it returns 0 storage - ! if ( use_fates_planthydro ) then + if ( use_fates_planthydro ) then ! call UpdateH2OVeg(this%fates(nc)%nsites, & ! this%fates(nc)%sites, & ! this%fates(nc)%bc_out) ! - ! do s = 1, this%fates(nc)%nsites - ! c = this%f2hmap(nc)%fcolumn(s) - ! waterstate_inst%total_plant_stored_h2o_col(c) = & - ! this%fates(nc)%bc_out(s)%plant_stored_h2o_si - ! end do - ! end if + do s = 1, this%fates(nc)%nsites + c = this%f2hmap(nc)%fcolumn(s) + waterstate_inst%total_plant_stored_h2o_col(c) = & + this%fates(nc)%bc_out(s)%plant_stored_h2o_si + end do + end if !--------------------------------------------------------------------------------- ! Convert FATES dynamics into HLM usable information @@ -826,7 +857,15 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & ! Set the bareground patch indicator patch%is_bareground(col%patchi(c)) = .true. npatch = this%fates(nc)%sites(s)%youngest_patch%patchno - patch%wt_ed(col%patchi(c)) = 1.0-sum(this%fates(nc)%bc_out(s)%canopy_fraction_pa(1:npatch)) + + ! Precision errors on the canopy_fraction_pa sum, even small (e-12) + ! do exist, and can create potentially negetive bare-soil fractions + ! (ie -1e-12 or smaller). Even though this is effectively zero, + ! it can generate weird logic scenarios in the ctsm/elm code, so we + ! protext it here with a lower bound of 0.0_r8. + + patch%wt_ed(col%patchi(c)) = max(0.0_r8, & + 1.0_r8-sum(this%fates(nc)%bc_out(s)%canopy_fraction_pa(1:npatch))) if(sum(this%fates(nc)%bc_out(s)%canopy_fraction_pa(1:npatch))>1.0_r8)then write(iulog,*)'Projected Canopy Area of all FATES patches' @@ -870,7 +909,7 @@ end subroutine wrap_update_hlmfates_dyn ! ==================================================================================== subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & - canopystate_inst, frictionvel_inst ) + canopystate_inst, frictionvel_inst, soilstate_inst ) ! --------------------------------------------------------------------------------- ! The ability to restart the model is handled through three different types of calls @@ -905,6 +944,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst type(canopystate_type) , intent(inout) :: canopystate_inst type(frictionvel_type) , intent(inout) :: frictionvel_inst + type(soilstate_type) , intent(inout) :: soilstate_inst ! Locals type(bounds_type) :: bounds_clump @@ -916,6 +956,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & integer :: s ! Fates site index integer :: g ! grid-cell index integer :: dk_index + integer :: nlevsoil character(len=fates_long_string_length) :: ioname integer :: nvar integer :: ivar @@ -1101,12 +1142,40 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & this%fates(nc)%bc_in(s) ) end do + ! ------------------------------------------------------------------------ + ! Re-populate all the hydraulics variables that are dependent + ! on the key hydro state variables and plant carbon/geometry + ! ------------------------------------------------------------------------ + if (use_fates_planthydro) then + + do s = 1,this%fates(nc)%nsites + c = this%f2hmap(nc)%fcolumn(s) + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoil) = & + soilstate_inst%hksat_col(c,1:nlevsoil) + end do + + call RestartHydrStates(this%fates(nc)%sites, & + this%fates(nc)%nsites, & + this%fates(nc)%bc_in, & + this%fates(nc)%bc_out) + end if + ! ------------------------------------------------------------------------ ! Update diagnostics of FATES ecosystem structure used in HLM. ! ------------------------------------------------------------------------ call this%wrap_update_hlmfates_dyn(nc,bounds_clump, & waterdiagnosticbulk_inst,canopystate_inst,frictionvel_inst) + + ! ------------------------------------------------------------------------ + ! Update the 3D patch level radiation absorption fractions + ! ------------------------------------------------------------------------ + call this%fates_restart%update_3dpatch_radiation(this%fates(nc)%nsites, & + this%fates(nc)%sites, & + this%fates(nc)%bc_out) + + ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ @@ -1145,6 +1214,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & ! locals real(r8) :: vol_ice real(r8) :: eff_porosity + integer :: nlevsoil ! Number of soil layers at each site integer :: j integer :: s integer :: c @@ -1170,39 +1240,39 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & ! Called prior to init_patches(). Site level rhizosphere shells must ! be set prior to cohort initialization. ! ---------------------------------------------------------------------------- + if (use_fates_planthydro) then do s = 1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoi) = & - soilstate_inst%watsat_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoi) = & - soilstate_inst%watres_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoi) = & - soilstate_inst%sucsat_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoi) = & - soilstate_inst%bsw_col(c,1:nlevsoi) + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil - this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoi) = & - waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoi) = & - soilstate_inst%hksat_col(c,1:nlevsoi) + this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoil) = & + soilstate_inst%watsat_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoil) = & + soilstate_inst%sucsat_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoil) = & + soilstate_inst%bsw_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoil) = & + waterstate_inst%h2osoi_liq_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoil) = & + soilstate_inst%hksat_col(c,1:nlevsoil) - do j = 1, nlevsoi + do j = 1, nlevsoil vol_ice = min(soilstate_inst%watsat_col(c,j), & waterstatebulk_inst%h2osoi_ice_col(c,j)/(col%dz(c,j)*denice)) eff_porosity = max(0.01_r8,soilstate_inst%watsat_col(c,j)-vol_ice) - this%fates(nc)%bc_in(s)%eff_porosity_gl(j) = eff_porosity + this%fates(nc)%bc_in(s)%eff_porosity_sl(j) = eff_porosity end do end do - if (use_fates_planthydro) call HydrSiteColdStart(this%fates(nc)%sites,this%fates(nc)%bc_in) + call HydrSiteColdStart(this%fates(nc)%sites,this%fates(nc)%bc_in) end if call init_patches(this%fates(nc)%nsites, this%fates(nc)%sites, & @@ -1390,6 +1460,7 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & integer :: j integer :: ifp integer :: p + integer :: nlevsoil associate(& sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) @@ -1424,24 +1495,25 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil ! Check to see if this column is in the exposed veg filter if( any(filterc==c) )then this%fates(nc)%bc_in(s)%filter_btran = .true. - do j = 1,nlevgrnd - this%fates(nc)%bc_in(s)%tempk_gl(j) = t_soisno(c,j) - this%fates(nc)%bc_in(s)%h2o_liqvol_gl(j) = h2osoi_liqvol(c,j) - this%fates(nc)%bc_in(s)%eff_porosity_gl(j) = eff_porosity(c,j) - this%fates(nc)%bc_in(s)%watsat_gl(j) = watsat(c,j) + do j = 1,nlevsoil + this%fates(nc)%bc_in(s)%tempk_sl(j) = t_soisno(c,j) + this%fates(nc)%bc_in(s)%h2o_liqvol_sl(j) = h2osoi_liqvol(c,j) + this%fates(nc)%bc_in(s)%eff_porosity_sl(j) = eff_porosity(c,j) + this%fates(nc)%bc_in(s)%watsat_sl(j) = watsat(c,j) end do else this%fates(nc)%bc_in(s)%filter_btran = .false. - this%fates(nc)%bc_in(s)%tempk_gl(:) = -999._r8 - this%fates(nc)%bc_in(s)%h2o_liqvol_gl(:) = -999._r8 - this%fates(nc)%bc_in(s)%eff_porosity_gl(:) = -999._r8 - this%fates(nc)%bc_in(s)%watsat_gl(:) = -999._r8 + this%fates(nc)%bc_in(s)%tempk_sl(:) = -999._r8 + this%fates(nc)%bc_in(s)%h2o_liqvol_sl(:) = -999._r8 + this%fates(nc)%bc_in(s)%eff_porosity_sl(:) = -999._r8 + this%fates(nc)%bc_in(s)%watsat_sl(:) = -999._r8 end if end do @@ -1462,15 +1534,16 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & ! Now that the active layers of water uptake have been decided by fates ! Calculate the suction that is passed back to fates - ! Note that the filter_btran is unioned with active_suction_gl + ! Note that the filter_btran is unioned with active_suction_sl do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - do j = 1,nlevgrnd - if(this%fates(nc)%bc_out(s)%active_suction_gl(j)) then + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + do j = 1,nlevsoil + if(this%fates(nc)%bc_out(s)%active_suction_sl(j)) then s_node = max(h2osoi_liqvol(c,j)/eff_porosity(c,j),0.01_r8) call soil_water_retention_curve%soil_suction(c,j,s_node, soilstate_inst, smp_node) - this%fates(nc)%bc_in(s)%smp_gl(j) = smp_node + this%fates(nc)%bc_in(s)%smp_sl(j) = smp_node end if end do end do @@ -1499,17 +1572,17 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & ! ------------------------------------------------------------------------------- do s = 1, this%fates(nc)%nsites - + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil c = this%f2hmap(nc)%fcolumn(s) do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno p = ifp+col%patchi(c) - do j = 1,nlevgrnd + do j = 1,nlevsoil rresis(p,j) = -999.9 ! We do not calculate this correctly ! it should not thought of as valid output until we decide to. - rootr(p,j) = this%fates(nc)%bc_out(s)%rootr_pagl(ifp,j) + rootr(p,j) = this%fates(nc)%bc_out(s)%rootr_pasl(ifp,j) btran(p) = this%fates(nc)%bc_out(s)%btran_pa(ifp) btran2(p) = -999.9 ! Not available, force to nonsense @@ -1530,7 +1603,6 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & use abortutils , only : endrun use decompMod , only : bounds_type use clm_varcon , only : rgas, tfrz, namep - use clm_varpar , only : nlevsoi use clm_varctl , only : iulog use pftconMod , only : pftcon use perf_mod , only : t_startf, t_stopf @@ -1557,6 +1629,7 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & type(canopystate_type) , intent(inout) :: canopystate_inst type(photosyns_type) , intent(inout) :: photosyns_inst + integer :: nlevsoil ! number of soil layers in this site integer :: s,c,p,ifp,j,icp real(r8) :: dtime @@ -1575,9 +1648,11 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & c = this%f2hmap(nc)%fcolumn(s) - do j = 1,nlevsoi - this%fates(nc)%bc_in(s)%t_soisno_gl(j) = t_soisno(c,j) ! soil temperature (Kelvin) - end do + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + + do j = 1,nlevsoil + this%fates(nc)%bc_in(s)%t_soisno_sl(j) = t_soisno(c,j) ! soil temperature (Kelvin) + end do this%fates(nc)%bc_in(s)%forc_pbot = forc_pbot(c) ! atmospheric pressure (Pa) do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno @@ -1879,7 +1954,9 @@ subroutine init_history_io(this,bounds_proc) use FatesIOVariableKindMod, only : site_r8, site_ground_r8, site_size_pft_r8 use FatesIOVariableKindMod, only : site_size_r8, site_pft_r8, site_age_r8 use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8 + use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 + use FatesIOVariableKindMod, only : site_height_r8 use FatesIODimensionsMod, only : fates_bounds_type @@ -2064,6 +2141,15 @@ subroutine init_history_io(this,bounds_proc) ptr_col=this%fates_hist%hvars(ivar)%r82d, & default=trim(vdefault), & set_lake=0._r8,set_urb=0._r8) + case(site_height_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index + dim2name = this%fates_hist%dim_bounds(d_index)%name + call hist_addfld2d(fname=trim(vname),units=trim(vunits), & + type2d=trim(dim2name), & + avgflag=trim(vavgflag),long_name=trim(vlong), & + ptr_col=this%fates_hist%hvars(ivar)%r82d, & + default=trim(vdefault), & + set_lake=0._r8,set_urb=0._r8) case(site_fuel_r8) d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index dim2name = this%fates_hist%dim_bounds(d_index)%name @@ -2119,6 +2205,25 @@ subroutine init_history_io(this,bounds_proc) default=trim(vdefault), & set_lake=0._r8,set_urb=0._r8) + case(site_scagpft_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index + dim2name = this%fates_hist%dim_bounds(d_index)%name + call hist_addfld2d(fname=trim(vname),units=trim(vunits), & + type2d=trim(dim2name), & + avgflag=trim(vavgflag),long_name=trim(vlong), & + ptr_col=this%fates_hist%hvars(ivar)%r82d, & + default=trim(vdefault), & + set_lake=0._r8,set_urb=0._r8) + case(site_agepft_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index + dim2name = this%fates_hist%dim_bounds(d_index)%name + call hist_addfld2d(fname=trim(vname),units=trim(vunits), & + type2d=trim(dim2name), & + avgflag=trim(vavgflag),long_name=trim(vlong), & + ptr_col=this%fates_hist%hvars(ivar)%r82d, & + default=trim(vdefault), & + set_lake=0._r8,set_urb=0._r8) + case default write(iulog,*) 'A FATES iotype was created that was not registerred' @@ -2142,15 +2247,20 @@ subroutine init_soil_depths(this, nc) integer :: s ! site index integer :: c ! column index integer :: j ! Depth index + integer :: nlevsoil + integer :: nlevdecomp do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - this%fates(nc)%bc_in(s)%zi_sisl(0:hlm_numlevsoil) = col%zi(c,0:hlm_numlevsoil) - this%fates(nc)%bc_in(s)%dz_sisl(1:hlm_numlevsoil) = col%dz(c,1:hlm_numlevsoil) - this%fates(nc)%bc_in(s)%z_sisl(1:hlm_numlevsoil) = col%z(c,1:hlm_numlevsoil) - this%fates(nc)%bc_in(s)%dz_decomp_sisl(1:hlm_numlevdecomp_full) = & - dzsoi_decomp(1:hlm_numlevdecomp_full) + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + nlevdecomp = this%fates(nc)%bc_in(s)%nlevdecomp + + this%fates(nc)%bc_in(s)%zi_sisl(0:nlevsoil) = col%zi(c,0:nlevsoil) + this%fates(nc)%bc_in(s)%dz_sisl(1:nlevsoil) = col%dz(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%z_sisl(1:nlevsoil) = col%z(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%dz_decomp_sisl(1:nlevdecomp) = & + dzsoi_decomp(1:nlevdecomp) end do return @@ -2174,6 +2284,7 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & integer :: l integer :: nc integer :: num_filter_fates + integer :: nlevsoil if( .not. use_fates_planthydro ) return @@ -2198,7 +2309,8 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - waterfluxbulk_inst%qflx_rootsoi_col(c,:) = this%fates(nc)%bc_out(s)%qflx_soil2root_sisl(:) + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + waterfluxbulk_inst%qflx_rootsoi_col(c,1:nlevsoil) = this%fates(nc)%bc_out(s)%qflx_soil2root_sisl(1:nlevsoil) end do end subroutine ComputeRootSoilFlux @@ -2256,6 +2368,7 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & integer :: j integer :: ifp integer :: p + integer :: nlevsoil real(r8) :: dtime @@ -2268,21 +2381,25 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & ! ------------------------------------------------------------------------------------ do s = 1, this%fates(nc)%nsites + c = this%f2hmap(nc)%fcolumn(s) + + nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + this%fates(nc)%bc_in(s)%smpmin_si = & soilstate_inst%smpmin_col(c) - this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoi) = & - soilstate_inst%watsat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoi) = & - soilstate_inst%watres_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoi) = & - soilstate_inst%sucsat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoi) = & - soilstate_inst%bsw_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoi) = & - waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%eff_porosity_gl(1:nlevsoi) = & - soilstate_inst%eff_porosity_col(c,1:nlevsoi) + this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoil) = & + soilstate_inst%watsat_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoil) = & + soilstate_inst%watres_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoil) = & + soilstate_inst%sucsat_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoil) = & + soilstate_inst%bsw_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoil) = & + waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%eff_porosity_sl(1:nlevsoil) = & + soilstate_inst%eff_porosity_col(c,1:nlevsoil) do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno p = ifp+col%patchi(c) @@ -2329,6 +2446,7 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) use FatesIODimensionsMod, only : fates_bounds_type use FatesInterfaceMod, only : nlevsclass, nlevage + use FatesInterfaceMod, only : nlevheight use EDtypesMod, only : nfsc, ncwd use EDtypesMod, only : nlevleaf, nclmax use FatesInterfaceMod, only : maxveg_ed => numpft @@ -2363,9 +2481,18 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%age_class_begin = 1 fates%age_class_end = nlevage + fates%height_begin = 1 + fates%height_end = nlevheight + fates%sizeage_class_begin = 1 fates%sizeage_class_end = nlevsclass * nlevage + + fates%agepft_class_begin = 1 + fates%agepft_class_end = nlevage * maxveg_ed + fates%sizeagepft_class_begin = 1 + fates%sizeagepft_class_end = nlevsclass * nlevage * maxveg_ed + fates%fuel_begin = 1 fates%fuel_end = nfsc From ef23451e5059dc1944238e77a0cdb392baf5a04f Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 2 Aug 2019 11:20:26 -0600 Subject: [PATCH 0367/1973] Land initialization complete: Successfully initialized the land model! :-) |||| Working with b9b543f8ea7989d4cc6414180db91a7050206c4f lnd_emsf_comp.F90 --- lilac/lilac/Makefile | 18 ++++++---- lilac/lilac/batch.sub | 10 +++--- lilac/lilac/demo_driver.F90 | 2 +- lilac/lilac/lilac_mod.F90 | 69 ++++++++++++++++++++++++++++++++++--- 4 files changed, 83 insertions(+), 16 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index 40c5157b89..0c26d0d75b 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -33,7 +33,7 @@ include $(ESMFMKFILE) $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< %.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(CTSM_INC) $(CTSM_LIB) $< + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) $(EXTRA_LIBS) $(MORE_LIBS) $< %.o : %.c $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< @@ -44,23 +44,27 @@ include $(ESMFMKFILE) CTSM_BLD_DIR = /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf CTSM_INC = -I$(CTSM_BLD_DIR)/include CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm +TRACEBACK_FLAGS = -g -traceback -debug all -check all # ----------------------------------------------------------------------------- -EXTRA_LIBS = -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib +#EXTRA_LIBS = -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib +EXTRA_LIBS = -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib +MORE_LIBS = -I/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ +#EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/pio/pio2 # ----------------------------------------------------------------------------- demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) + $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) $(TRACEBACK_FLAGS) $(MORE_LIBS) mv demo_driver demo_driver.exe - rm *.o *.mod + #rm *.o *.mod # module dependencies: #demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o -lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o +lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o #shr_pio_mod.o ###shr_string_mod.o: shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o atmos_cap.o: lilac_utils.o # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- -.PHONY: dust clean distclean berzerk +.PHONY: dust clean distclean berzerk remake dust: rm -f PET*.ESMF_LogFile DE.nc FLAG.nc OMEGA.nc SIE.nc U_velocity.nc V_velocity.nc clean: @@ -68,3 +72,5 @@ clean: distclean: dust clean berzerk: rm -f PET*.ESMF_LogFile job_name* *.o *.mod *.exe +remake: + rm lilac_mod.o demo_driver.o demo_driver.exe & make diff --git a/lilac/lilac/batch.sub b/lilac/lilac/batch.sub index 5d968ed7c9..de2b1018ac 100644 --- a/lilac/lilac/batch.sub +++ b/lilac/lilac/batch.sub @@ -3,11 +3,13 @@ #####PBS -A P54048000 #PBS -A P93300606 #PBS -l walltime=00:10:00 -#PBS -q premium +##PBS -q premium +#PBS -q share ##PBS -q regular -###PBS -j oe -##PBS -l select=2:ncpus=2:mpiprocs=4 -#PBS -l select=1:ncpus=1:mpiprocs=2 +#PBS -j oe + +#PBS -l select=2:ncpus=2:mpiprocs=4 +##PBS -l select=1:ncpus=1:mpiprocs=2 ##PBS -l select=1:ncpus=1:mpiprocs=1 ml diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index 9422fc6eea..269df07b66 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -50,7 +50,7 @@ program demo_lilac_driver ! real atmosphere: begc = 1 !endc = 10 - endc = 6912 + endc = 6912/4 !endc = 13824 !endc = 13968 diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index de009c4a9a..fa2a31993b 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -13,6 +13,9 @@ module lilac_mod use lnd_comp_esmf , only : lnd_register use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register + use mpi, only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS + use shr_pio_mod, only : shr_pio_init1, shr_pio_init2 + implicit none @@ -61,7 +64,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) !character(len=*) :: atm_mesh_filepath !!! For now this is hardcoded in the atmos init - integer :: rc , urc + integer :: rc , urc character(len=ESMF_MAXSTR) :: gcname1 , gcname2 ! Gridded components names character(len=ESMF_MAXSTR) :: ccname1 , ccname2 ! Coupling components names integer :: a2l_fldnum , l2a_fldnum @@ -78,6 +81,13 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) e_month, e_day, e_hour, e_min + integer :: COMP_COMM + integer :: ierr + integer :: ntasks,mytask ! mpicom size and rank + + integer :: ncomps = 1 ! land only + + !!! above: https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/pio-xlis-bld/xlis_main.F90 !------------------------------------------------------------------------ @@ -91,11 +101,58 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) print *, " Lilac Demo Application Start " print *, "---------------------------------------" + !----------------------------------------------------------------------------- + ! Initiallize MPI + !----------------------------------------------------------------------------- + + ! this is coming from + ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 + call MPI_init(ierr) + COMP_COMM = MPI_COMM_WORLD + + !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 + if (ierr .ne. MPI_SUCCESS) then + print *,'Error starting MPI program. Terminating.' + call MPI_ABORT(MPI_COMM_WORLD, ierr) + end if + + + + ! + + call MPI_COMM_RANK(COMP_COMM, mytask, ierr) + call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) + + print *, "MPI initialization done ..., ntasks=", ntasks + + !----------------------------------------------------------------------------- + ! Initialize PIO + !----------------------------------------------------------------------------- + + ! this is coming from + ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 + ! with call shr_pio_init1(8, "drv_in", COMP_COMM) + + ! For planned future use of async io using pio2. The IO tasks are seperated from the compute tasks here + ! and COMP_COMM will be MPI_COMM_NULL on the IO tasks which then call shr_pio_init2 and do not return until + ! the model completes. All other tasks call ESMF_Initialize. 8 is the maximum number of component models + ! supported + + call shr_pio_init1(ncomps, "drv_in", COMP_COMM) + ! NS Question: How many should ncomps (above 1) be?????? + + if (COMP_COMM .eq. MPI_COMM_NULL) then + !call shr_pio_init2( + call mpi_finalize(ierror=rc) + stop + endif +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !------------------------------------------------------------------------- ! Initialize ESMF, set the default calendar and log type. !------------------------------------------------------------------------- - call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN, rc=rc) + call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN,logappendflag=.false., rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogSet(flush=.true.) call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) call ESMF_LogWrite(subname//"Initializing ESMF ", ESMF_LOGMSG_INFO) @@ -107,7 +164,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out print *, "---------------------------------------" - open(fileunit, status="old", file="./namelist", action="read", iostat=rc) + open(fileunit, status="old", file="namelist_lilac", action="read", iostat=rc) if (rc .ne. 0) then call ESMF_LogSetError(rcToCheck=ESMF_RC_FILE_OPEN, msg="Failed to open namelist file 'namelist'", line=__LINE__, file=__FILE__) @@ -128,6 +185,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) allocate (l2c_fldlist(l2a_fldnum)) allocate (c2l_fldlist(a2l_fldnum)) print *, "creating empty field lists !" + call ESMF_LogWrite(subname//"EMPTY field lists are created...", ESMF_LOGMSG_INFO) ! ======================================================================= ! maybe move to create_fldlist? ! call create_fldlists(c2a_fldlist, a2c_fldlist, ) @@ -320,8 +378,9 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) print *, "atmos_cap initialize finished, rc =", rc rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//"now we are initializing CTSM ....", ESMF_LOGMSG_INFO) - print *, "now we are initializing CTSM, rc =", rc + print *, rc + call ESMF_LogWrite(subname//"Now we are initializing CTSM ....", ESMF_LOGMSG_INFO) + print *, "Now we are initializing CTSM, rc =", rc call ESMF_GridCompInitialize(land_gcomp , importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"lnd_cap or land_gcomp initialized", ESMF_LOGMSG_INFO) From d68c9e14bbc3b9086b8b31377a95b943c1fa8ef7 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 7 Aug 2019 11:17:34 -0600 Subject: [PATCH 0368/1973] using create_fldlists instead of manually allocating these.... --- lilac/lilac/lilac_mod.F90 | 71 ++++++++------------------------------- 1 file changed, 14 insertions(+), 57 deletions(-) diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index fa2a31993b..55e9797f73 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -94,8 +94,8 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! Initialize return code rc = ESMF_SUCCESS - a2l_fldnum = 3 - l2a_fldnum = 3 + a2l_fldnum = 14 + l2a_fldnum = 16 print *, "---------------------------------------" print *, " Lilac Demo Application Start " @@ -179,72 +179,29 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! value to them. !------------------------------------------------------------------------- - allocate (a2c_fldlist(a2l_fldnum)) - allocate (c2a_fldlist(l2a_fldnum)) + !allocate (a2c_fldlist(a2l_fldnum)) + !allocate (c2a_fldlist(l2a_fldnum)) - allocate (l2c_fldlist(l2a_fldnum)) - allocate (c2l_fldlist(a2l_fldnum)) + !allocate (l2c_fldlist(l2a_fldnum)) + !allocate (c2l_fldlist(a2l_fldnum)) + allocate (a2c_fldlist(fldsMax)) + allocate (c2a_fldlist(fldsMax)) + + allocate (l2c_fldlist(fldsmax)) + allocate (c2l_fldlist(fldsmax)) print *, "creating empty field lists !" call ESMF_LogWrite(subname//"EMPTY field lists are created...", ESMF_LOGMSG_INFO) ! ======================================================================= ! maybe move to create_fldlist? ! call create_fldlists(c2a_fldlist, a2c_fldlist, ) - + call create_fldlists(a2c_fldlist, c2a_fldlist,l2c_fldlist, c2l_fldlist) !------------------------------------------------------------------------- ! !---- from atm ----! a2c_fldlist & c2l_fldlist !------------------------------------------------------------------------- - a2c_fldlist(1)%stdname = 'uwind' - a2c_fldlist(1)%farrayptr1d => atm2lnd1d%uwind !*** this now sets the module variable memory in atmos_cap.F90 - print *, a2c_fldlist(1)%stdname - !print *, a2c_fldlist(1)%farrayptr1d(:) - a2c_fldlist(2)%stdname = 'vwind' - a2c_fldlist(2)%farrayptr1d => atm2lnd1d%vwind !*** this now sets the module variable memory in atmos_cap.F90 - print *, a2c_fldlist(2)%stdname - !print *, a2c_fldlist(2)%farrayptr1d(:) - a2c_fldlist(3)%stdname = 'tbot' - a2c_fldlist(3)%farrayptr1d => atm2lnd1d%vwind - print *, a2c_fldlist(3)%stdname - !print *, a2c_fldlist(3)%farrayptr1d - - - !!! Where should these point to? pointer to an empty array which will be filled in the land.... - - ! Similary we need c2a_fldlist - c2l_fldlist(1)%stdname = 'uwind' - print *, c2l_fldlist(1)%stdname - c2l_fldlist(2)%stdname = 'vwind' - print *, c2l_fldlist(1)%stdname - c2l_fldlist(3)%stdname = 'tbot' - print *, c2l_fldlist(1)%stdname - - !------------------------------------------------------------------------- ! !---- from land ----! l2c_fldlist & c2a_fldlist !------------------------------------------------------------------------- - - l2c_fldlist(1)%stdname = 'lwup' - l2c_fldlist(1)%farrayptr1d => lnd2atm1d%lwup - print *, l2c_fldlist(1)%stdname - - l2c_fldlist(2)%stdname = 'taux' - print *, l2c_fldlist(2)%stdname - l2c_fldlist(2)%farrayptr1d => lnd2atm1d%taux - - l2c_fldlist(3)%stdname = 'tauy' - print *, l2c_fldlist(3)%stdname - l2c_fldlist(3)%farrayptr1d => lnd2atm1d%taux - - - c2a_fldlist(1)%stdname = 'lwup' - print *, c2a_fldlist(1)%stdname - - c2a_fldlist(2)%stdname = 'taux' - print *, c2a_fldlist(2)%stdname - - c2a_fldlist(3)%stdname = 'tauy' - print *, c2a_fldlist(3)%stdname - ! ======================================================================= ! create_fldlist !------------------------------------------------------------------------- @@ -384,7 +341,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) call ESMF_GridCompInitialize(land_gcomp , importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"lnd_cap or land_gcomp initialized", ESMF_LOGMSG_INFO) - print *, "lnd_cap initialize finished, rc =", rc + !print *, "lnd_cap initialize finished, rc =", rc ! All 4 states that are module variables are no longer empty - have been initialized @@ -414,7 +371,7 @@ subroutine lilac_run( ) integer :: rc, urc character(len=ESMF_MAXSTR) :: gcname1, gcname2 ! Gridded components names character(len=ESMF_MAXSTR) :: ccname1, ccname2 ! Coupling components names - !integer, parameter :: fldsMax = 100 + integer, parameter :: fldsMax = 100 integer :: a2l_fldnum, l2a_fldnum ! input/output variables From 4b4a9fe23af7ff0d14f2a26250eabb19d7ac102a Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 8 Aug 2019 12:10:27 -0600 Subject: [PATCH 0369/1973] adding the default values for atm --> lnd --- lilac/lilac/lilac_utils.F90 | 101 +++++++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index ce57848dbb..15be7b0153 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -13,6 +13,7 @@ module lilac_utils integer, parameter :: fldsMax = 100 + character(*) , parameter :: modname = "lilac_utils" ! !PUBLIC TYPES: type :: fld_list_type character(len=128) :: stdname @@ -75,8 +76,9 @@ subroutine fldlist_add(num, fldlist, stdname, default_value, units, ungridded_lb ! local variables integer :: rc - character(len=*), parameter :: subname=':[fldlist_add]' + character(len=*), parameter :: subname=trim(modname)//':[fldlist_add]' !------------------------------------------------------------------------------- + call ESMF_LogWrite(subname//"inside fldlist_add!", ESMF_LOGMSG_INFO) ! Set up a list of field information num = num + 1 @@ -107,7 +109,8 @@ subroutine fldlist_add(num, fldlist, stdname, default_value, units, ungridded_lb end subroutine fldlist_add - subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, rof_prognostic, glc_present ) + !subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, rof_prognostic, glc_present ) + subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist) ! add all the necessary fields one by one to the fieldlist type(fld_list_type), intent(inout) :: a2c_fldlist(fldsMax) @@ -115,45 +118,67 @@ subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, r type(fld_list_type), intent(inout) :: l2c_fldlist(fldsMax) type(fld_list_type), intent(inout) :: c2l_fldlist(fldsMax) - !type (fld_list_type) :: fldsToLnd(fldsMax) - !type (fld_list_type) :: fldsFrLnd(fldsMax) - - !integer :: fldsFrCpl_num, fldsToCpl_num - integer :: fldsToLnd_num != 0 ! From atmosphere to land (a2c and c2l) - integer :: fldsFrLnd_num != 0 ! From land to atmosphere (l2c and c2a) + ! I use this as an index! + integer :: fldsToLnd_num != 0 ! From atmosphere to land (c2l) + integer :: fldsFrLnd_num != 0 ! From land to atmosphere (l2c) + integer :: fldsToAtm_num != 0 ! From land to atmosphere (c2a) + integer :: fldsFrAtm_num != 0 ! From atmosphere to land (a2c) integer, parameter :: fldsMax = 100 - logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model - logical , intent(in) :: rof_prognostic ! .true. => running with a prognostic ROF model + ! TODO (NS) : Should we move these to the land cap???? + logical :: glc_present ! .true. => running with a non-stub GLC model + logical :: rof_prognostic ! .true. => running with a prognostic ROF model + character(len=*), parameter :: subname=trim(modname)//':[create_fldlists]' ! TODO (NS) : I should add default value and units here..... + fldsToLnd_num= 0 + fldsFrLnd_num= 0 + fldsToAtm_num= 0 + fldsFrAtm_num= 0 + + call ESMF_LogWrite(subname//"is called!", ESMF_LOGMSG_INFO) + !------------------------------------------------------------------------- ! !---- from atm ----! a2c_fldlist & c2l_fldlist !------------------------------------------------------------------------- !--------------------------a2c_fldlist------------------------------------ ! from atm - states - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_z' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_topo' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_u' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_v' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_ptem' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_pbot' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_tbot' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_shum' ) - !call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Sa_methane' ) + !call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_z' ) + !call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_topo' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_z' , default_value=30.0 , units='m/s') + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_topo' , default_value=10.0 , units='m') + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_u' , default_value=0.0 , units='m/s') + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_v' , default_value=0.0 , units='m/s') + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_ptem' , default_value=280.0 , units='degK') + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_pbot' , default_value=100100.0 , units='pa' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_tbot' , default_value=280.0 , units='degk' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_shum' , default_value=0.0004 , units='kg/kg' ) + !call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_methane' ) + + call ESMF_LogWrite(subname//"from atmosphere states are added!" , ESMF_LOGMSG_INFO) + + + + ! from atm - fluxes - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_lwdn' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_rainc' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_rainl' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_snowc' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_snowl' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_swndr' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_swvdr' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_swndf' ) - call fldlist_add(fldsToLnd_num, a2c_fldlist, 'Faxa_swvdf' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_lwdn' , default_value=200.0 , units='W/m2' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_rainc' , default_value=4.0e-8 , units='kg/m2s' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_rainl' , default_value=3.0e-8 , units='kg/m2s' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_snowc' , default_value=1.0e-8 , units='kg/m2s' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_snowl' , default_value=2.0e-8 , units='kg/m2s' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_swndr' , default_value=100.0 , units='W/m2' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_swvdr' , default_value=90.0 , units='W/m2' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_swndf' , default_value=20.0 , units='W/m2' ) + call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_swvdf' , default_value=40.0 , units='W/m2' ) + + call ESMF_LogWrite(subname//"from atmosphere fluxes are added!", ESMF_LOGMSG_INFO) + + ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphidry') + ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphodry') + ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphiwet') !--------------------------c2l_fldlist------------------------------------ ! from atm - states @@ -166,6 +191,7 @@ subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, r call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_tbot' ) call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_shum' ) !call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_methane' ) + call ESMF_LogWrite(subname//"from atmosphere states are added!", ESMF_LOGMSG_INFO) ! from atm - fluxes call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_lwdn' ) @@ -177,6 +203,7 @@ subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, r call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swvdr' ) call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swndf' ) call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swvdf' ) + call ESMF_LogWrite(subname//"from atmosphere fluxes are added!", ESMF_LOGMSG_INFO) !------------------------------------------------------------------------- ! !---- from lnd ----! l2c_fldlist & c2a_fldlist @@ -195,25 +222,41 @@ subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, r call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_u10' ) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_fv' ) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_ram1' ) + call ESMF_LogWrite(subname//"l2c: from land states are added!", ESMF_LOGMSG_INFO) - + rof_prognostic = .false. ! export fluxes to river if (rof_prognostic) then + call ESMF_LogWrite(subname//"Okay we are in rof_prognostic", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofsur' ) + call ESMF_LogWrite(subname//"Okay we are in rof_prognostic 13", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofgwl' ) + call ESMF_LogWrite(subname//"Okay we are in rof_prognostic 14", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofsub' ) + call ESMF_LogWrite(subname//"Okay we are in rof_prognostic 15", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofi' ) + call ESMF_LogWrite(subname//"Okay we are in rof_prognostic 16", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_irrig' ) + call ESMF_LogWrite(subname//"l2c: from land states are added for rof_prognostic!", ESMF_LOGMSG_INFO) end if ! export fluxes to atm + call ESMF_LogWrite(subname//"l2c: now adding fluxes to atmosphere!", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_taux' ) + call ESMF_LogWrite(subname//"l2c: Fall_taux!", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_tauy' ) + call ESMF_LogWrite(subname//"l2c: Fall_taux!", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_lat' ) + call ESMF_LogWrite(subname//"l2c: Fall_lat!", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_sen' ) + call ESMF_LogWrite(subname//"l2c: Fall_sen!", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_lwup' ) + call ESMF_LogWrite(subname//"l2c: Fall_lwup!", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_evap' ) + call ESMF_LogWrite(subname//"l2c: Fall_evap!", ESMF_LOGMSG_INFO) call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_swnet' ) + call ESMF_LogWrite(subname//"l2c: Fall_lat!", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"l2c: from land fluxes are added!", ESMF_LOGMSG_INFO) ! call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_methane' ) From 34e1a79ad819a281ae5e245b3f49f5b95d4f1c8c Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 8 Aug 2019 12:11:06 -0600 Subject: [PATCH 0370/1973] ptr with default values for atmos_cap --- lilac/lilac/atmos_cap.F90 | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index 04b192b206..b0a4eeaa6c 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -5,7 +5,8 @@ module atmos_cap ! !USES use ESMF - use lilac_utils + use lilac_utils, only : fld_list_type + implicit none @@ -21,9 +22,8 @@ module atmos_cap !type (fld_list_type) :: a2c_fldlist(fldsMax) !type (fld_list_type) :: c2a_fldlist(fldsMax) - integer :: a2c_fldlist_num - integer :: c2a_fldlist_num - + integer :: a2c_fldlist_num + integer :: c2a_fldlist_num !private public :: atmos_register @@ -88,7 +88,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) mesh_switch = .True. if(mesh_switch) then - ! For now this is our dummy mesh: + ! For now this is our dummy mesh: !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' !! Negin: This did not work.... atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc' @@ -122,12 +122,11 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) a2c_fb = ESMF_FieldBundleCreate(name="a2c_fb", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"field bundle", ESMF_LOGMSG_INFO) ! Create individual fields and add to field bundle -- a2l !call fldlist_add(a2c_fldlist_num, a2c_fldlist, 'dum_var2' ) - a2c_fldlist_num = 3 + a2c_fldlist_num = 14 do n = 1,a2c_fldlist_num @@ -180,7 +179,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out ! Create individual fields and add to field bundle -- l2a - c2a_fldlist_num = 3 + c2a_fldlist_num = 16 do n = 1,c2a_fldlist_num @@ -191,9 +190,9 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! create field !!! Here we want to pass pointers if (mesh_switch) then - !field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2a_fldlist(n)%stdname), rc=rc) + field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2a_fldlist(n)%stdname), rc=rc) !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr1d, rc=rc) - field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) + !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) @@ -225,6 +224,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out print *, "!lnd2atm_a_state is filld with dummy_var field bundle!" + ! Set Attributes needed by land + call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) end subroutine atmos_init From 50350e4beedf5f0a1ed2a2cc90dd1fdcf720d8a2 Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 12 Aug 2019 16:38:55 -0600 Subject: [PATCH 0371/1973] so that there is no intereference with the suboutine... --- lilac/lilac/lnd_cap.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/lilac/lnd_cap.F90 b/lilac/lilac/lnd_cap.F90 index 0bf6d78dd4..3e73d4e6c1 100644 --- a/lilac/lilac/lnd_cap.F90 +++ b/lilac/lilac/lnd_cap.F90 @@ -1,6 +1,6 @@ module lnd_cap use ESMF - use lilac_utils + use lilac_utils, only : fld_list_type implicit none From 7beecf21f5980bc7cf4e6b412ef540ab3538cb0c Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 12 Aug 2019 16:39:46 -0600 Subject: [PATCH 0372/1973] FOR NOW, we are setting these default values.... --- lilac/lilac/demo_driver.F90 | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index 269df07b66..0ae762c74c 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -70,26 +70,37 @@ program demo_lilac_driver allocate ( rand1 (begc:endc) ) ; call random_number (rand1) allocate ( rand2 (begc:endc) ) ; call random_number (rand2) + !allocating these values of default for now! + allocate ( atm2lnd%Sa_z (begc:endc) ) ; atm2lnd%Sa_z (:) = 30.0 + allocate ( atm2lnd%Sa_topo (begc:endc) ) ; atm2lnd%Sa_topo (:) = 10.0 + allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 0.0 + allocate ( atm2lnd%Sa_v (begc:endc) ) ; atm2lnd%Sa_v (:) = 0.0 + allocate ( atm2lnd%Sa_ptem (begc:endc) ) ; atm2lnd%Sa_ptem (:) = 280.0 + allocate ( atm2lnd%Sa_pbot (begc:endc) ) ; atm2lnd%Sa_pbot (:) = 100100.0 + allocate ( atm2lnd%Sa_tbot (begc:endc) ) ; atm2lnd%Sa_tbot (:) = 280.0 + allocate ( atm2lnd%Sa_shum (begc:endc) ) ; atm2lnd%Sa_shum (:) = 0.0004 + allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) ; atm2lnd%Faxa_lwdn (:) = 500.0 !200.0 + allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 4.0e-8 + allocate ( atm2lnd%Faxa_rainl (begc:endc) ) ; atm2lnd%Faxa_rainl (:) = 3.0e-8 + allocate ( atm2lnd%Faxa_snowc (begc:endc) ) ; atm2lnd%Faxa_snowc (:) = 1.0e-8 + allocate ( atm2lnd%Faxa_snowl (begc:endc) ) ; atm2lnd%Faxa_snowl (:) = 2.0e-8 + allocate ( atm2lnd%Faxa_swndr (begc:endc) ) ; atm2lnd%Faxa_swndr (:) = 100.0 + allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 90.0 + allocate ( atm2lnd%Faxa_swndf (begc:endc) ) ; atm2lnd%Faxa_swndf (:) = 20.0 + allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) ; atm2lnd%Faxa_swvdf (:) = 40.0 - allocate ( atm2lnd%uwind (begc:endc) ) ; atm2lnd%uwind (:) = rand1 - allocate ( atm2lnd%vwind (begc:endc) ) ; atm2lnd%vwind (:) = rand1 - allocate ( atm2lnd%tbot (begc:endc) ) ; atm2lnd%tbot (:) = rand1 !endc = 18048 ? should this be the size of the land or atmosphere??? + allocate ( lnd2atm%lwup (begc:endc) ) ; lnd2atm%lwup (:) = rand2 allocate ( lnd2atm%taux (begc:endc) ) ; lnd2atm%taux (:) = rand2 allocate ( lnd2atm%tauy (begc:endc) ) ; lnd2atm%tauy (:) = rand2 - - print *, "=======================================" - print *, atm2lnd%uwind(1:10) - print *, "=======================================" - !------------------------------------------------------------------------ ! looping over imaginary time .... !------------------------------------------------------------------------ do curr_time = start_time, end_time - if (curr_time == start_time) then + if (curr_time == start_time) then ! Initalization phase print *, "--------------------------" From be64eb43dd1a7e285d9f173171f8968c9a1f79af Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 12 Aug 2019 16:41:04 -0600 Subject: [PATCH 0373/1973] changing the atm2lnd datatype to encompass variables needed by CTSM --- lilac/lilac/lilac_utils.F90 | 84 ++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 16 deletions(-) diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index 15be7b0153..0758ac74f9 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -19,37 +19,85 @@ module lilac_utils character(len=128) :: stdname real*8 :: default_value character(len=128) :: units - real(ESMF_KIND_R8), pointer :: farrayptr1d(:) ! this will be filled in by lilac when it gets its data from the host atm + real(ESMF_KIND_R8), pointer :: farrayptr1d(:) ! this will be filled in by lilac when it gets its data from the host atm real(ESMF_KIND_R8), pointer :: farrayptr2d(:,:) ! this will be filled in by lilac when it gets its data from the host atm integer :: ungridded_lbound = 0 integer :: ungridded_ubound = 0 end type fld_list_type !!! 1d for when we have mesh and 2d for when we have grids.... - - type :: atm2lnd_data1d_type - real*8, pointer :: uwind (:) - real*8, pointer :: vwind (:) - real*8, pointer :: tbot (:) + type , public :: atm2lnd_data1d_type + real*8, pointer :: Sa_z (:) + real*8, pointer :: Sa_topo (:) + real*8, pointer :: Sa_u (:) + real*8, pointer :: Sa_v (:) + real*8, pointer :: Sa_ptem (:) + real*8, pointer :: Sa_pbot (:) + real*8, pointer :: Sa_tbot (:) + real*8, pointer :: Sa_shum (:) + !real*8, pointer :: Sa_methane (:) + ! from atm - fluxes + real*8, pointer :: Faxa_lwdn (:) + real*8, pointer :: Faxa_rainc (:) + real*8, pointer :: Faxa_rainl (:) + real*8, pointer :: Faxa_snowc (:) + real*8, pointer :: Faxa_snowl (:) + real*8, pointer :: Faxa_swndr (:) + real*8, pointer :: Faxa_swvdr (:) + real*8, pointer :: Faxa_swndf (:) + real*8, pointer :: Faxa_swvdf (:) end type atm2lnd_data1d_type +! + + type , public :: atm2lnd_data2d_type + real*8, pointer :: Sa_z (:,:) + real*8, pointer :: Sa_topo (:,:) + real*8, pointer :: Sa_u (:,:) + real*8, pointer :: Sa_v (:,:) + real*8, pointer :: Sa_ptem (:,:) + real*8, pointer :: Sa_pbot (:,:) + real*8, pointer :: Sa_tbot (:,:) + real*8, pointer :: Sa_shum (:,:) + !real*8, pointer :: Sa_methane (:,:) + ! from atm - fluxes + real*8, pointer :: Faxa_lwdn (:,:) + real*8, pointer :: Faxa_rainc (:,:) + real*8, pointer :: Faxa_rainl (:,:) + real*8, pointer :: Faxa_snowc (:,:) + real*8, pointer :: Faxa_snowl (:,:) + real*8, pointer :: Faxa_swndr (:,:) + real*8, pointer :: Faxa_swvdr (:,:) + real*8, pointer :: Faxa_swndf (:,:) + real*8, pointer :: Faxa_swvdf (:,:) + end type atm2lnd_data2d_type + + + + + !type :: atm2lnd_data1d_type + ! real*8, pointer :: uwind (:) + ! real*8, pointer :: vwind (:) + ! real*8, pointer :: tbot (:) + !end type atm2lnd_data1d_type + type :: lnd2atm_data1d_type real*8, pointer :: lwup (:) real*8, pointer :: taux (:) real*8, pointer :: tauy (:) end type lnd2atm_data1d_type - type :: atm2lnd_data2d_type - real*8, pointer :: uwind (:,:) - real*8, pointer :: vwind (:,:) - real*8, pointer :: tbot (:,:) - end type atm2lnd_data2d_type + !type :: atm2lnd_data2d_type + ! real*8, pointer :: uwind (:,:) + ! real*8, pointer :: vwind (:,:) + ! real*8, pointer :: tbot (:,:) + !end type atm2lnd_data2d_type - type :: lnd2atm_data2d_type - real*8, pointer :: lwup (:,:) - real*8, pointer :: taux (:,:) - real*8, pointer :: tauy (:,:) - end type lnd2atm_data2d_type + !type :: lnd2atm_data2d_type + ! real*8, pointer :: lwup (:,:) + ! real*8, pointer :: taux (:,:) + ! real*8, pointer :: tauy (:,:) + ! end type lnd2atm_data2d_type type :: this_clock integer, pointer :: yy @@ -107,6 +155,10 @@ subroutine fldlist_add(num, fldlist, stdname, default_value, units, ungridded_lb fldlist(num)%units = "" end if + !allocate (fldlist%farrayptr1d(fldsMax)) + + !fldlist%farrayptr1d = default_value + end subroutine fldlist_add !subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, rof_prognostic, glc_present ) From c96b5176f7a96c9472bf27b5a3516dc0fcba8d08 Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 12 Aug 2019 16:41:55 -0600 Subject: [PATCH 0374/1973] Make the necessary changes in lila_mod to work with the new atm2lnd needed by CTSM --- lilac/lilac/lilac_mod.F90 | 96 +++++++++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 55e9797f73..904f171efe 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -6,10 +6,11 @@ module lilac_mod ! !USES use ESMF - use lilac_utils + use lilac_utils , only : fld_list_type, fldsMax, create_fldlists + use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type + use lilac_utils , only : atm2lnd_data2d_type , lnd2atm_data2d_type use atmos_cap , only : atmos_register !use lnd_shr_methods - !use lnd_comp_esmf use lnd_comp_esmf , only : lnd_register use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register @@ -18,6 +19,11 @@ module lilac_mod implicit none + !TODO (NS,2019-08-07): + ! We will move this later to lnd_cap (ctsm_cap) and atmos_cap + !use atmos_cap , only : a2l_fldnum + integer , public , parameter :: a2l_fldnum = 14 + integer , public , parameter :: l2a_fldnum = 16 public :: lilac_init public :: lilac_run @@ -48,8 +54,9 @@ module lilac_mod subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) - use atmos_cap , only : a2c_fldlist, c2a_fldlist - use lnd_cap, only : l2c_fldlist, c2l_fldlist + use atmos_cap , only : a2c_fldlist , c2a_fldlist + use lnd_cap , only : l2c_fldlist , c2l_fldlist + character(len=*), parameter :: subname=trim(modname)//': [lilac_init] ' ! input/output variables @@ -67,7 +74,6 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) integer :: rc , urc character(len=ESMF_MAXSTR) :: gcname1 , gcname2 ! Gridded components names character(len=ESMF_MAXSTR) :: ccname1 , ccname2 ! Coupling components names - integer :: a2l_fldnum , l2a_fldnum ! Namelist and related variables @@ -87,6 +93,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) integer :: ncomps = 1 ! land only + integer :: n !!! above: https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/pio-xlis-bld/xlis_main.F90 @@ -94,8 +101,6 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! Initialize return code rc = ESMF_SUCCESS - a2l_fldnum = 14 - l2a_fldnum = 16 print *, "---------------------------------------" print *, " Lilac Demo Application Start " @@ -146,7 +151,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) call mpi_finalize(ierror=rc) stop endif -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !------------------------------------------------------------------------- ! Initialize ESMF, set the default calendar and log type. !------------------------------------------------------------------------- @@ -179,30 +184,61 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! value to them. !------------------------------------------------------------------------- + !------------------------------------------------------------------------- + ! !---- from atm ----! a2c_fldlist & c2l_fldlist + !------------------------------------------------------------------------- !allocate (a2c_fldlist(a2l_fldnum)) - !allocate (c2a_fldlist(l2a_fldnum)) + !allocate (c2l_fldlist(a2l_fldnum)) + !------------------------------------------------------------------------- + ! !---- from land ----! l2c_fldlist & c2a_fldlist + !------------------------------------------------------------------------- + !allocate (c2a_fldlist(l2a_fldnum)) !allocate (l2c_fldlist(l2a_fldnum)) - !allocate (c2l_fldlist(a2l_fldnum)) + allocate (a2c_fldlist(fldsMax)) allocate (c2a_fldlist(fldsMax)) allocate (l2c_fldlist(fldsmax)) allocate (c2l_fldlist(fldsmax)) + print *, "creating empty field lists !" - call ESMF_LogWrite(subname//"EMPTY field lists are created...", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"fielldlists are allocated!", ESMF_LOGMSG_INFO) + + ! create field lists + call create_fldlists(a2c_fldlist, c2a_fldlist,l2c_fldlist, c2l_fldlist) + call ESMF_LogWrite(subname//"fielldlists are created!", ESMF_LOGMSG_INFO) - ! ======================================================================= ! maybe move to create_fldlist? - ! call create_fldlists(c2a_fldlist, a2c_fldlist, ) - call create_fldlists(a2c_fldlist, c2a_fldlist,l2c_fldlist, c2l_fldlist) !------------------------------------------------------------------------- - ! !---- from atm ----! a2c_fldlist & c2l_fldlist + ! !---- from atm ----! a2c_fldlist filling the arrayptr.. !------------------------------------------------------------------------- - ! !---- from land ----! l2c_fldlist & c2a_fldlist - !------------------------------------------------------------------------- - ! ======================================================================= ! create_fldlist + ! FIXME: This should go to the demo_driver or real atmosphere...... + !allocate( a2c_fldlist(fldsmax)%farrayptr1d(1728)) + !do n = 1,a2l_fldnum + ! print *, " index is ", n + ! a2c_fldlist(1)%farrayptr1d(:) = 300.0 + !end do + + a2c_fldlist(1)%farrayptr1d => atm2lnd1d%Sa_z + a2c_fldlist(2)%farrayptr1d => atm2lnd1d%Sa_topo + a2c_fldlist(3)%farrayptr1d => atm2lnd1d%Sa_u + a2c_fldlist(4)%farrayptr1d => atm2lnd1d%Sa_v + a2c_fldlist(5)%farrayptr1d => atm2lnd1d%Sa_ptem + a2c_fldlist(6)%farrayptr1d => atm2lnd1d%Sa_pbot + a2c_fldlist(7)%farrayptr1d => atm2lnd1d%Sa_shum + a2c_fldlist(8)%farrayptr1d => atm2lnd1d%Faxa_lwdn + a2c_fldlist(9)%farrayptr1d => atm2lnd1d%Faxa_rainc + a2c_fldlist(10)%farrayptr1d => atm2lnd1d%Faxa_rainl + a2c_fldlist(11)%farrayptr1d => atm2lnd1d%Faxa_snowc + a2c_fldlist(12)%farrayptr1d => atm2lnd1d%Faxa_snowl + a2c_fldlist(13)%farrayptr1d => atm2lnd1d%Faxa_swndr + a2c_fldlist(14)%farrayptr1d => atm2lnd1d%Faxa_swvdr + a2c_fldlist(15)%farrayptr1d => atm2lnd1d%Faxa_swndf + a2c_fldlist(16)%farrayptr1d => atm2lnd1d%Faxa_swvdf + + ! ======================================================================== !------------------------------------------------------------------------- ! Create Gridded Component! -- atmosphere ( atmos_cap) @@ -299,6 +335,8 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) call ESMF_CalendarPrint ( calendar , rc=rc) print *, "---------------------------------------" + ! ======================================================================== + !------------------------------------------------------------------------- ! Create the necessary import and export states used to pass data ! between components. @@ -332,28 +370,22 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) call ESMF_GridCompInitialize(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp initialized", ESMF_LOGMSG_INFO) - print *, "atmos_cap initialize finished, rc =", rc - rc = ESMF_SUCCESS - print *, rc - call ESMF_LogWrite(subname//"Now we are initializing CTSM ....", ESMF_LOGMSG_INFO) - print *, "Now we are initializing CTSM, rc =", rc call ESMF_GridCompInitialize(land_gcomp , importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"lnd_cap or land_gcomp initialized", ESMF_LOGMSG_INFO) - !print *, "lnd_cap initialize finished, rc =", rc ! All 4 states that are module variables are no longer empty - have been initialized call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) - print *, "coupler :: cpl_atm2lnd_comp initialize finished, rc =", rc + print *, "coupler :: cpl_atm2lnd_comp initialize finished" !, rc =", rc call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) - print *, "coupler :: cpl_lnd2atm_comp initialize finished, rc =", rc + print *, "coupler :: cpl_lnd2atm_comp initialize finished" !, rc =", rc end subroutine lilac_init @@ -371,8 +403,7 @@ subroutine lilac_run( ) integer :: rc, urc character(len=ESMF_MAXSTR) :: gcname1, gcname2 ! Gridded components names character(len=ESMF_MAXSTR) :: ccname1, ccname2 ! Coupling components names - integer, parameter :: fldsMax = 100 - integer :: a2l_fldnum, l2a_fldnum + !integer, parameter :: fldsMax = 100 ! input/output variables !type(atm2lnd_data1d_type), intent(in), optional :: atm2lnd1d @@ -413,22 +444,22 @@ subroutine lilac_run( ) call ESMF_GridCompRun(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=local_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp is running", ESMF_LOGMSG_INFO) - print *, "Running atmos_cap gridded component , rc =", rc + print *, "Running atmos_cap gridded component "!, rc =", rc call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=local_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) - print *, "Running coupler component..... cpl_atm2lnd_comp , rc =", rc + print *, "Running coupler component..... cpl_atm2lnd_comp"! , rc =", rc call ESMF_GridCompRun(land_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=local_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"lnd_cap or land_gcomp is running", ESMF_LOGMSG_INFO) - print *, "Running lnd_cap gridded component , rc =", rc + print *, "Running lnd_cap gridded component"! , rc =", rc call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=local_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) - print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc + print *, "Running coupler component..... cpl_lnd2atm_comp" ! , rc =", rc ! Advance the time call ESMF_ClockAdvance(local_clock, rc=rc) @@ -455,7 +486,6 @@ subroutine lilac_final( ) character(len=ESMF_MAXSTR) :: gcname1, gcname2 ! Gridded components names character(len=ESMF_MAXSTR) :: ccname1, ccname2 ! Coupling components names !integer, parameter :: fldsMax = 100 - integer :: a2l_fldnum, l2a_fldnum !------------------------------------------------------------------------ !------------------------------------------------------------------------ From 178ad5dd4fb8b1c70eabb8c488a2be20bf67f490 Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 13 Aug 2019 12:09:56 -0600 Subject: [PATCH 0375/1973] saving before moving to the new branch for changing fieldbundles.... --- lilac/lilac/Makefile | 2 +- lilac/lilac/atmos_cap.F90 | 15 ++++++++++----- lilac/lilac/batch.sub | 4 ++-- lilac/lilac/lilac_utils.F90 | 10 +++++----- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index 0c26d0d75b..a1509ffded 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -68,7 +68,7 @@ atmos_cap.o: lilac_utils.o dust: rm -f PET*.ESMF_LogFile DE.nc FLAG.nc OMEGA.nc SIE.nc U_velocity.nc V_velocity.nc clean: - rm -f *.exe *.o *.mod + rm -f *.exe distclean: dust clean berzerk: rm -f PET*.ESMF_LogFile job_name* *.o *.mod *.exe diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index b0a4eeaa6c..4d88db09c8 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -126,13 +126,14 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! Create individual fields and add to field bundle -- a2l !call fldlist_add(a2c_fldlist_num, a2c_fldlist, 'dum_var2' ) - a2c_fldlist_num = 14 + a2c_fldlist_num = 16 do n = 1,a2c_fldlist_num print *, "**********************************************************" print *, "creating field for a2l:" print *, trim(a2c_fldlist(n)%stdname) + print *, a2c_fldlist(n)%farrayptr1d ! create field !!! Here we want to pass pointers @@ -143,6 +144,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) !call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8), rc=rc) !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + print *, 'Here we are printing field!' call ESMF_FieldPrint(field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out !call ESMF_LogWrite(subname//"fieldget!", ESMF_LOGMSG_INFO) @@ -154,6 +156,9 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_StateAdd(atm2lnd_a_state, (/field/) , rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !print *, a2c_fldlist(n)%farrayptr1d !print *, "this field is created" @@ -163,8 +168,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" ! Add field bundle to state - call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"atm2lnd_a_state is filled with dummy_var field bundle!", ESMF_LOGMSG_INFO) print *, "!atm2lnd_a_state is filld with dummy_var field bundle!" @@ -190,8 +195,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! create field !!! Here we want to pass pointers if (mesh_switch) then - field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2a_fldlist(n)%stdname), rc=rc) - !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr1d, rc=rc) + !field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2a_fldlist(n)%stdname), rc=rc) + field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2a_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out diff --git a/lilac/lilac/batch.sub b/lilac/lilac/batch.sub index de2b1018ac..be736f5181 100644 --- a/lilac/lilac/batch.sub +++ b/lilac/lilac/batch.sub @@ -3,8 +3,8 @@ #####PBS -A P54048000 #PBS -A P93300606 #PBS -l walltime=00:10:00 -##PBS -q premium -#PBS -q share +#PBS -q premium +##PBS -q share ##PBS -q regular #PBS -j oe diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index 0758ac74f9..467c977869 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -93,11 +93,11 @@ module lilac_utils ! real*8, pointer :: tbot (:,:) !end type atm2lnd_data2d_type - !type :: lnd2atm_data2d_type - ! real*8, pointer :: lwup (:,:) - ! real*8, pointer :: taux (:,:) - ! real*8, pointer :: tauy (:,:) - ! end type lnd2atm_data2d_type + type :: lnd2atm_data2d_type + real*8, pointer :: lwup (:,:) + real*8, pointer :: taux (:,:) + real*8, pointer :: tauy (:,:) + end type lnd2atm_data2d_type type :: this_clock integer, pointer :: yy From 744c7f26e05c162cf43e3c7be9ae4ca4db68d2b6 Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 13 Aug 2019 16:10:10 -0600 Subject: [PATCH 0376/1973] after screwing things over, now ctsm initializes again.... --- lilac/lilac/Makefile | 10 +++++----- lilac/lilac/atmos_cap.F90 | 17 +++++++++-------- lilac/lilac/cpl_mod.F90 | 4 ++++ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index a1509ffded..6773b5a5b8 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -41,15 +41,15 @@ include $(ESMFMKFILE) % : %.C $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< -CTSM_BLD_DIR = /glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf +CTSM_BLD_DIR = /glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf CTSM_INC = -I$(CTSM_BLD_DIR)/include CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm TRACEBACK_FLAGS = -g -traceback -debug all -check all # ----------------------------------------------------------------------------- -#EXTRA_LIBS = -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib -EXTRA_LIBS = -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib -MORE_LIBS = -I/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -#EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/pio/pio2 +#EXTRA_LIBS = -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib +EXTRA_LIBS = -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib +MORE_LIBS = -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ +#EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/pio/pio2 # ----------------------------------------------------------------------------- demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) $(TRACEBACK_FLAGS) $(MORE_LIBS) diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index 4d88db09c8..ff76d7a03c 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -26,7 +26,7 @@ module atmos_cap integer :: c2a_fldlist_num !private - public :: atmos_register + public :: atmos_register !real(kind=ESMF_KIND_R8), dimension(:), public, pointer, save :: fldptr !======================================================================== @@ -126,7 +126,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! Create individual fields and add to field bundle -- a2l !call fldlist_add(a2c_fldlist_num, a2c_fldlist, 'dum_var2' ) - a2c_fldlist_num = 16 + a2c_fldlist_num = 14 do n = 1,a2c_fldlist_num @@ -156,8 +156,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_StateAdd(atm2lnd_a_state, (/field/) , rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !call ESMF_StateAdd(atm2lnd_a_state, (/field/) , rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out !print *, a2c_fldlist(n)%farrayptr1d !print *, "this field is created" @@ -168,8 +168,9 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" ! Add field bundle to state - !call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"atm2lnd_a_state is filled with dummy_var field bundle!", ESMF_LOGMSG_INFO) print *, "!atm2lnd_a_state is filld with dummy_var field bundle!" @@ -184,7 +185,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out ! Create individual fields and add to field bundle -- l2a - c2a_fldlist_num = 16 + c2a_fldlist_num = 14 do n = 1,c2a_fldlist_num @@ -213,7 +214,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! add field to field bundle call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) print *, "**********************************************************" print *, "creating field for c2a:" diff --git a/lilac/lilac/cpl_mod.F90 b/lilac/lilac/cpl_mod.F90 index 5372b007c9..bf45323496 100644 --- a/lilac/lilac/cpl_mod.F90 +++ b/lilac/lilac/cpl_mod.F90 @@ -88,6 +88,10 @@ subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) call ESMF_StateGet(exportState, "c2l_fb", export_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + !call ESMF_FieldBundlePrint (import_fieldbundle, rc=rc) + call ESMF_FieldBundlePrint (export_fieldbundle, rc=rc) + call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) From 1e858ad4620de08517edf78045daae820aacb4ae Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 13 Aug 2019 16:27:01 -0600 Subject: [PATCH 0377/1973] back to the point 1...... after initialize.... --- lilac/lilac/cpl_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/lilac/cpl_mod.F90 b/lilac/lilac/cpl_mod.F90 index bf45323496..8d4afdf261 100644 --- a/lilac/lilac/cpl_mod.F90 +++ b/lilac/lilac/cpl_mod.F90 @@ -90,7 +90,7 @@ subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) !call ESMF_FieldBundlePrint (import_fieldbundle, rc=rc) - call ESMF_FieldBundlePrint (export_fieldbundle, rc=rc) + !call ESMF_FieldBundlePrint (export_fieldbundle, rc=rc) call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out From c89073163cf14b1436e471a7680a517f4cd6da26 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 15 Aug 2019 16:23:42 -0600 Subject: [PATCH 0378/1973] this versionof lilac initailizes CTSM successfdully and runs for three time steps..... the cap is 65c74cb --- lilac/lilac/atmos_cap.F90 | 63 +++++++++++++++++++------------- lilac/lilac/cpl_mod.F90 | 27 +++++++++++--- lilac/lilac/demo_driver.F90 | 23 ++++++++---- lilac/lilac/lilac_mod.F90 | 71 +++++++++++++++++++++++++------------ lilac/lilac/lilac_utils.F90 | 15 ++++++-- 5 files changed, 139 insertions(+), 60 deletions(-) diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index ff76d7a03c..1d1792a9cd 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -6,10 +6,11 @@ module atmos_cap ! !USES use ESMF use lilac_utils, only : fld_list_type - - + use spmdMod , only : masterproc implicit none + include 'mpif.h' + character(*), parameter :: modname = "atmos_cap" !!integer, parameter :: fldsMax = 100 @@ -29,6 +30,12 @@ module atmos_cap public :: atmos_register !real(kind=ESMF_KIND_R8), dimension(:), public, pointer, save :: fldptr + + integer :: mpierror, numprocs + integer :: i, myid + integer status(MPI_STATUS_SIZE) + + !======================================================================== contains !======================================================================== @@ -86,6 +93,10 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! Read in the mesh ----or----- Generate the grid !------------------------------------------------------------------------- mesh_switch = .True. + call MPI_Comm_size(MPI_COMM_WORLD, numprocs, mpierror) + call MPI_Comm_rank(MPI_COMM_WORLD, myid, mpierror) + + if(mesh_switch) then ! For now this is our dummy mesh: @@ -126,15 +137,10 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! Create individual fields and add to field bundle -- a2l !call fldlist_add(a2c_fldlist_num, a2c_fldlist, 'dum_var2' ) - a2c_fldlist_num = 14 + a2c_fldlist_num = 17 do n = 1,a2c_fldlist_num - print *, "**********************************************************" - print *, "creating field for a2l:" - print *, trim(a2c_fldlist(n)%stdname) - print *, a2c_fldlist(n)%farrayptr1d - ! create field !!! Here we want to pass pointers !field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(a2c_fldlist(n)%stdname), rc=rc) @@ -144,9 +150,15 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) !call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8), rc=rc) !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - print *, 'Here we are printing field!' - call ESMF_FieldPrint(field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (myid == 0) then + print *, 'Here we are printing field!' + print *, "**********************************************************" + print *, "creating field for a2l:" + print *, trim(a2c_fldlist(n)%stdname) + print *, a2c_fldlist(n)%farrayptr1d + call ESMF_FieldPrint(field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + end if !call ESMF_LogWrite(subname//"fieldget!", ESMF_LOGMSG_INFO) !call ESMF_FieldGet(field, rc=rc) !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -185,19 +197,19 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out ! Create individual fields and add to field bundle -- l2a - c2a_fldlist_num = 14 + c2a_fldlist_num = 12 do n = 1,c2a_fldlist_num - print *, "**********************************************************" - print *, "creating field for l2a:" - print *, trim(c2a_fldlist(n)%stdname) + !print *, "**********************************************************" + !print *, "creating field for l2a:" + !print *, trim(c2a_fldlist(n)%stdname) ! create field !!! Here we want to pass pointers if (mesh_switch) then - !field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2a_fldlist(n)%stdname), rc=rc) - field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2a_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) + field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2a_fldlist(n)%stdname), rc=rc) + !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr1d, rc=rc) !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -216,19 +228,22 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) - print *, "**********************************************************" - print *, "creating field for c2a:" - print *, trim(c2a_fldlist(n)%stdname) - !print *, c2a_fldlist(n)%farrayptr1d - + if (myid == 0) then + print *, "creating field for c2a:" + print *, n + print *, trim(c2a_fldlist(n)%stdname) + print *, c2a_fldlist(n)%farrayptr1d + !call ESMF_FieldPrint(field, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + end if enddo - print *, "!Fields For Coupler (c2a_fldlist) Field Bundle Created!" + !print *, "!Fields For Coupler (c2a_fldlist) Field Bundle Created!" ! Add field bundle to state call ESMF_StateAdd(lnd2atm_a_state, (/c2a_fb/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - print *, "!lnd2atm_a_state is filld with dummy_var field bundle!" + !print *, "!lnd2atm_a_state is filld with dummy_var field bundle!" ! Set Attributes needed by land call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) diff --git a/lilac/lilac/cpl_mod.F90 b/lilac/lilac/cpl_mod.F90 index 8d4afdf261..e6573eaa3a 100644 --- a/lilac/lilac/cpl_mod.F90 +++ b/lilac/lilac/cpl_mod.F90 @@ -10,6 +10,8 @@ module cpl_mod use ESMF implicit none + include 'mpif.h' + private @@ -19,6 +21,12 @@ module cpl_mod character(*), parameter :: modname = " cpl_mod" type(ESMF_RouteHandle), save :: rh_atm2lnd, rh_lnd2atm + + integer :: mpierror, numprocs + integer :: i, myid + integer status(MPI_STATUS_SIZE) + + !====================================================================== contains !====================================================================== @@ -82,15 +90,26 @@ subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) print *, "Coupler for atmosphere to land initialize routine called" call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_StateGet(importState, "a2c_fb", import_fieldbundle, rc=rc) + call MPI_Comm_size(MPI_COMM_WORLD, numprocs, mpierror) + call MPI_Comm_rank(MPI_COMM_WORLD, myid, mpierror) + + + + call ESMF_StateGet(importState, trim("a2c_fb"), import_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_StateGet(exportState, "c2l_fb", export_fieldbundle, rc=rc) + call ESMF_StateGet(exportState, trim("c2l_fb"), export_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !call ESMF_FieldBundlePrint (import_fieldbundle, rc=rc) - !call ESMF_FieldBundlePrint (export_fieldbundle, rc=rc) + if (myid == 0) then + print *, "PRINTING FIELDBUNDLES" + call ESMF_FieldBundlePrint (import_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_FieldBundlePrint (export_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + end if + call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index 0ae762c74c..c261bcf299 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -73,13 +73,13 @@ program demo_lilac_driver !allocating these values of default for now! allocate ( atm2lnd%Sa_z (begc:endc) ) ; atm2lnd%Sa_z (:) = 30.0 allocate ( atm2lnd%Sa_topo (begc:endc) ) ; atm2lnd%Sa_topo (:) = 10.0 - allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 0.0 - allocate ( atm2lnd%Sa_v (begc:endc) ) ; atm2lnd%Sa_v (:) = 0.0 + allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 20.0 + allocate ( atm2lnd%Sa_v (begc:endc) ) ; atm2lnd%Sa_v (:) = 40.0 allocate ( atm2lnd%Sa_ptem (begc:endc) ) ; atm2lnd%Sa_ptem (:) = 280.0 allocate ( atm2lnd%Sa_pbot (begc:endc) ) ; atm2lnd%Sa_pbot (:) = 100100.0 allocate ( atm2lnd%Sa_tbot (begc:endc) ) ; atm2lnd%Sa_tbot (:) = 280.0 allocate ( atm2lnd%Sa_shum (begc:endc) ) ; atm2lnd%Sa_shum (:) = 0.0004 - allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) ; atm2lnd%Faxa_lwdn (:) = 500.0 !200.0 + allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) ; atm2lnd%Faxa_lwdn (:) = 200.0 allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 4.0e-8 allocate ( atm2lnd%Faxa_rainl (begc:endc) ) ; atm2lnd%Faxa_rainl (:) = 3.0e-8 allocate ( atm2lnd%Faxa_snowc (begc:endc) ) ; atm2lnd%Faxa_snowc (:) = 1.0e-8 @@ -91,9 +91,20 @@ program demo_lilac_driver !endc = 18048 ? should this be the size of the land or atmosphere??? - allocate ( lnd2atm%lwup (begc:endc) ) ; lnd2atm%lwup (:) = rand2 - allocate ( lnd2atm%taux (begc:endc) ) ; lnd2atm%taux (:) = rand2 - allocate ( lnd2atm%tauy (begc:endc) ) ; lnd2atm%tauy (:) = rand2 + + + allocate ( lnd2atm%Sl_lfrin (begc:endc) ) ; lnd2atm%Sl_lfrin (:) = 0 + allocate ( lnd2atm%Sl_t (begc:endc) ) ; lnd2atm%Sl_t (:) = 0 + allocate ( lnd2atm%Sl_tref (begc:endc) ) ; lnd2atm%Sl_tref (:) = 0 + allocate ( lnd2atm%Sl_qref (begc:endc) ) ; lnd2atm%Sl_qref (:) = 0 + allocate ( lnd2atm%Sl_avsdr (begc:endc) ) ; lnd2atm%Sl_avsdr (:) = 0 + allocate ( lnd2atm%Sl_anidr (begc:endc) ) ; lnd2atm%Sl_anidr (:) = 0 + allocate ( lnd2atm%Sl_avsdf (begc:endc) ) ; lnd2atm%Sl_avsdf (:) = 0 + allocate ( lnd2atm%Sl_anidf (begc:endc) ) ; lnd2atm%Sl_anidf (:) = 0 + allocate ( lnd2atm%Sl_snowh (begc:endc) ) ; lnd2atm%Sl_snowh (:) = 0 + allocate ( lnd2atm%Sl_u10 (begc:endc) ) ; lnd2atm%Sl_u10 (:) = 0 + allocate ( lnd2atm%Sl_fv (begc:endc) ) ; lnd2atm%Sl_fv (:) = 0 + allocate ( lnd2atm%Sl_ram1 (begc:endc) ) ; lnd2atm%Sl_ram1 (:) = 0 !------------------------------------------------------------------------ ! looping over imaginary time .... diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 904f171efe..252d623eaa 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -22,8 +22,8 @@ module lilac_mod !TODO (NS,2019-08-07): ! We will move this later to lnd_cap (ctsm_cap) and atmos_cap !use atmos_cap , only : a2l_fldnum - integer , public , parameter :: a2l_fldnum = 14 - integer , public , parameter :: l2a_fldnum = 16 + integer , public , parameter :: a2l_fldnum = 17 + integer , public , parameter :: l2a_fldnum = 12 public :: lilac_init public :: lilac_run @@ -71,7 +71,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) !character(len=*) :: atm_mesh_filepath !!! For now this is hardcoded in the atmos init - integer :: rc , urc + integer :: rc , userRC character(len=ESMF_MAXSTR) :: gcname1 , gcname2 ! Gridded components names character(len=ESMF_MAXSTR) :: ccname1 , ccname2 ! Coupling components names @@ -227,16 +227,37 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) a2c_fldlist(4)%farrayptr1d => atm2lnd1d%Sa_v a2c_fldlist(5)%farrayptr1d => atm2lnd1d%Sa_ptem a2c_fldlist(6)%farrayptr1d => atm2lnd1d%Sa_pbot - a2c_fldlist(7)%farrayptr1d => atm2lnd1d%Sa_shum - a2c_fldlist(8)%farrayptr1d => atm2lnd1d%Faxa_lwdn - a2c_fldlist(9)%farrayptr1d => atm2lnd1d%Faxa_rainc - a2c_fldlist(10)%farrayptr1d => atm2lnd1d%Faxa_rainl - a2c_fldlist(11)%farrayptr1d => atm2lnd1d%Faxa_snowc - a2c_fldlist(12)%farrayptr1d => atm2lnd1d%Faxa_snowl - a2c_fldlist(13)%farrayptr1d => atm2lnd1d%Faxa_swndr - a2c_fldlist(14)%farrayptr1d => atm2lnd1d%Faxa_swvdr - a2c_fldlist(15)%farrayptr1d => atm2lnd1d%Faxa_swndf - a2c_fldlist(16)%farrayptr1d => atm2lnd1d%Faxa_swvdf + a2c_fldlist(7)%farrayptr1d => atm2lnd1d%Sa_tbot + a2c_fldlist(8)%farrayptr1d => atm2lnd1d%Sa_shum + + a2c_fldlist(9)%farrayptr1d => atm2lnd1d%Faxa_lwdn + a2c_fldlist(10)%farrayptr1d => atm2lnd1d%Faxa_rainc + a2c_fldlist(11)%farrayptr1d => atm2lnd1d%Faxa_rainl + a2c_fldlist(12)%farrayptr1d => atm2lnd1d%Faxa_snowc + a2c_fldlist(13)%farrayptr1d => atm2lnd1d%Faxa_snowl + a2c_fldlist(14)%farrayptr1d => atm2lnd1d%Faxa_swndr + a2c_fldlist(15)%farrayptr1d => atm2lnd1d%Faxa_swvdr + a2c_fldlist(16)%farrayptr1d => atm2lnd1d%Faxa_swndf + a2c_fldlist(17)%farrayptr1d => atm2lnd1d%Faxa_swvdf + !------------------------------------------------------------------------- + + ! should I point to zero??? + + c2a_fldlist(1)%farrayptr1d => lnd2atm1d%Sl_lfrin + c2a_fldlist(2)%farrayptr1d => lnd2atm1d%Sl_t + c2a_fldlist(3)%farrayptr1d => lnd2atm1d%Sl_tref + c2a_fldlist(4)%farrayptr1d => lnd2atm1d%Sl_qref + c2a_fldlist(5)%farrayptr1d => lnd2atm1d%Sl_avsdr + c2a_fldlist(6)%farrayptr1d => lnd2atm1d%Sl_anidr + c2a_fldlist(7)%farrayptr1d => lnd2atm1d%Sl_avsdf + c2a_fldlist(8)%farrayptr1d => lnd2atm1d%Sl_anidf + + c2a_fldlist(9)%farrayptr1d => lnd2atm1d%Sl_snowh + c2a_fldlist(10)%farrayptr1d => lnd2atm1d%Sl_u10 + c2a_fldlist(11)%farrayptr1d => lnd2atm1d%Sl_fv + c2a_fldlist(12)%farrayptr1d => lnd2atm1d%Sl_ram1 + + ! ======================================================================== @@ -400,7 +421,7 @@ subroutine lilac_run( ) type(ESMF_State) :: importState, exportState ! local variables - integer :: rc, urc + integer :: rc, userRC character(len=ESMF_MAXSTR) :: gcname1, gcname2 ! Gridded components names character(len=ESMF_MAXSTR) :: ccname1, ccname2 ! Coupling components names !integer, parameter :: fldsMax = 100 @@ -441,25 +462,29 @@ subroutine lilac_run( ) !!! if we want to loop through clock in atmos cap. !do while (.NOT. ESMF_ClockIsStopTime(local_clock, rc=rc)) - call ESMF_GridCompRun(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=local_clock, rc=rc) + call ESMF_GridCompRun(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=local_clock, rc=rc, userRC=userRC) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp is running", ESMF_LOGMSG_INFO) - print *, "Running atmos_cap gridded component "!, rc =", rc + print *, "Running atmos_cap gridded component , rc =", rc - call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=local_clock, rc=rc) + call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=local_clock, rc=rc , userRC=userRC) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) - print *, "Running coupler component..... cpl_atm2lnd_comp"! , rc =", rc + print *, "Running coupler component..... cpl_atm2lnd_comp , rc =", rc - call ESMF_GridCompRun(land_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=local_clock, rc=rc) + call ESMF_GridCompRun(land_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=local_clock, rc=rc, userRC=userRC) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"lnd_cap or land_gcomp is running", ESMF_LOGMSG_INFO) - print *, "Running lnd_cap gridded component"! , rc =", rc + print *, "Running lnd_cap gridded component , rc =", rc - call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=local_clock, rc=rc) + call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=local_clock, rc=rc, userRC=userRC) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) - print *, "Running coupler component..... cpl_lnd2atm_comp" ! , rc =", rc + print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc ! Advance the time call ESMF_ClockAdvance(local_clock, rc=rc) @@ -482,7 +507,7 @@ subroutine lilac_final( ) type(ESMF_State) :: importState, exportState ! local variables - integer :: rc, urc + integer :: rc, userRC character(len=ESMF_MAXSTR) :: gcname1, gcname2 ! Gridded components names character(len=ESMF_MAXSTR) :: ccname1, ccname2 ! Coupling components names !integer, parameter :: fldsMax = 100 diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index 467c977869..29e45dad99 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -82,9 +82,18 @@ module lilac_utils !end type atm2lnd_data1d_type type :: lnd2atm_data1d_type - real*8, pointer :: lwup (:) - real*8, pointer :: taux (:) - real*8, pointer :: tauy (:) + real*8, pointer :: Sl_lfrin (:) + real*8, pointer :: Sl_t (:) + real*8, pointer :: Sl_tref (:) + real*8, pointer :: Sl_qref (:) + real*8, pointer :: Sl_avsdr (:) + real*8, pointer :: Sl_anidr (:) + real*8, pointer :: Sl_avsdf (:) + real*8, pointer :: Sl_anidf (:) + real*8, pointer :: Sl_snowh (:) + real*8, pointer :: Sl_u10 (:) + real*8, pointer :: Sl_fv (:) + real*8, pointer :: Sl_ram1 (:) end type lnd2atm_data1d_type !type :: atm2lnd_data2d_type From 2cc189a63f386d3f59baa7490309175fb1b4da5d Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 23 Aug 2019 10:09:58 -0600 Subject: [PATCH 0379/1973] add deallocate statement --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- bld/namelist_files/namelist_definition_ctsm.xml | 6 +++--- src/biogeophys/SoilMoistureStreamMod.F90 | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 5f6fac1326..e79ae8f709 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1022,7 +1022,7 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc1997 1997 -/project/tss/swensosc/MIPs/LS3MIP/LFMIP-pdLC-SST.H2OSOI.natveg.1980-2014.MONS_climo.nc +/project/tss/swensosc/MIPdata/LS3MIP/LFMIP-pdLC-SST.H2OSOI.natveg.1980-2014.MONS_climo.nc none linear diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 5c3c8e8962..3c0fef2db5 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1623,12 +1623,12 @@ Toggle to turn on use of soil moisture streams (EXPERIMENTAL and NOT tested) -First year to loop over for USTAR data +First year to loop over for soil moisture data -Last year to loop over for USTAR data +Last year to loop over for soil moisture data -Filename of input stream data for USTAR +Filename of input stream data for soil moisture Date: Fri, 23 Aug 2019 11:30:51 -0600 Subject: [PATCH 0380/1973] this version of lilac initailizes CTSM successfdully and runs until it finishes...YAY!........... the cap is 65c74cb --- lilac/lilac/batch.sub | 4 ++-- lilac/lilac/demo_driver.F90 | 2 +- lilac/lilac/lilac_mod.F90 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lilac/lilac/batch.sub b/lilac/lilac/batch.sub index be736f5181..5a25dd32b9 100644 --- a/lilac/lilac/batch.sub +++ b/lilac/lilac/batch.sub @@ -3,8 +3,8 @@ #####PBS -A P54048000 #PBS -A P93300606 #PBS -l walltime=00:10:00 -#PBS -q premium -##PBS -q share +###PBS -q premium +#PBS -q share ##PBS -q regular #PBS -j oe diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index c261bcf299..66914b37c0 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -55,7 +55,7 @@ program demo_lilac_driver !endc = 13968 start_time = 1 - end_time = 10 + end_time = 50 itime_step = 1 seed_val = 0 diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 252d623eaa..84c29384a9 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -346,7 +346,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) !clock = ESMF_ClockCreate(timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1 , s=0, calendar=Calendar, rc=rc) - call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) + call ESMF_TimeSet(StopTime , yy=2000, mm=03, dd=01, s=0, calendar=Calendar, rc=rc) call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) clock = ESMF_ClockCreate(name='lilac_drv_EClock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, stopTime=stopTime, rc=rc) From 93c009dd9cf87ba3b195963013a8b25825da2b51 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 27 Aug 2019 10:46:47 -0600 Subject: [PATCH 0381/1973] fix initial leaf temperature bug --- src/biogeochem/CNVegStructUpdateMod.F90 | 28 ++- src/biogeophys/CanopyFluxesMod.F90 | 241 +++++++++++------------- src/biogeophys/CanopyStateType.F90 | 40 +++- src/main/clm_initializeMod.F90 | 2 +- src/main/clm_instMod.F90 | 2 - src/main/clm_varcon.F90 | 4 +- src/main/pftconMod.F90 | 25 ++- src/main/readParamsMod.F90 | 6 +- 8 files changed, 191 insertions(+), 157 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 6a990ce89a..7db10f675f 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -42,7 +42,8 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & use pftconMod , only : ntrp_corn, nirrig_trp_corn use pftconMod , only : nsugarcane, nirrig_sugarcane use pftconMod , only : pftcon - use clm_varctl , only : spinup_state + use clm_varctl , only : spinup_state, use_biomass_heat_storage + use clm_varcon , only : c_to_b use clm_time_manager , only : get_rad_step_size ! ! !ARGUMENTS: @@ -97,7 +98,9 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & dwood => pftcon%dwood , & ! Input: density of wood (gC/m^3) ztopmx => pftcon%ztopmx , & ! Input: laimx => pftcon%laimx , & ! Input: - + nstem => pftcon%nstem , & ! Input: Tree number density (#ind/m2) + fbw => pftcon%fbw , & ! Input: Fraction of fresh biomass that is water + allom2 => dgv_ecophyscon%allom2 , & ! Input: [real(r8) (:) ] ecophys const allom3 => dgv_ecophyscon%allom3 , & ! Input: [real(r8) (:) ] ecophys const @@ -110,6 +113,7 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C + livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C farea_burned => cnveg_state_inst%farea_burned_col , & ! Input: [real(r8) (:) ] F. Li and S. Levis htmx => cnveg_state_inst%htmx_patch , & ! Output: [real(r8) (:) ] max hgt attained by a crop during yr (m) @@ -120,6 +124,8 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & ! *** Key Output from CN*** tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow + stem_biomass => canopystate_inst%stem_biomass_patch , & ! Output: [real(r8) (:) ] Aboveground stem biomass (kg/m**2) + leaf_biomass => canopystate_inst%leaf_biomass_patch , & ! Output: [real(r8) (:) ] Aboveground leave biomass (kg/m**2) htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow @@ -205,14 +211,28 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & !correct height calculation if doing accelerated spinup if (spinup_state == 2) then htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper * taper)/ & - (SHR_CONST_PI * stocking * dwood(ivt(p))))**(1._r8/3._r8) + (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) else htop(p) = ((3._r8 * deadstemc(p) * taper * taper)/ & - (SHR_CONST_PI * stocking * dwood(ivt(p))))**(1._r8/3._r8) + (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) end if endif + ! calculate vegetation physiological parameters used in biomass heat storage + if (use_biomass_heat_storage) then + ! Assumes fbw the same for leaves and stems + leaf_biomass(p) = max(0.0025_r8,leafc(p)) & + * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) + + stem_biomass(p) = (deadstemc(p) + livestemc(p)) & + * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) + + if (spinup_state == 2) then + stem_biomass(p) = 10._r8 * stem_biomass(p) + end if + end if + ! Peter Thornton, 5/3/2004 ! Adding test to keep htop from getting too close to forcing height for windspeed ! Also added for grass, below, although it is not likely to ever be an issue. diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 4540b4b2ef..a129c33406 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -14,7 +14,7 @@ module CanopyFluxesMod use shr_log_mod , only : errMsg => shr_log_errMsg use abortutils , only : endrun use clm_varctl , only : iulog, use_cn, use_lch4, use_c13, use_c14, use_cndv, use_fates, & - use_luna, use_hydrstress + use_luna, use_hydrstress, use_biomass_heat_storage use clm_varpar , only : nlevgrnd, nlevsno, mxpft use clm_varcon , only : namep use pftconMod , only : pftcon @@ -37,7 +37,7 @@ module CanopyFluxesMod use TemperatureType , only : temperature_type use WaterFluxBulkType , only : waterfluxbulk_type use WaterStateBulkType , only : waterstatebulk_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use CanopyHydrologyMod , only : IsSnowvegFlagOn, IsSnowvegFlagOnRad use HumanIndexMod , only : humanindex_type use ch4Mod , only : ch4_type @@ -52,24 +52,6 @@ module CanopyFluxesMod ! !PUBLIC TYPES: implicit none ! - ! !PUBLIC VARIABLES: - - type :: canopyflux_params_type - real(r8), allocatable, public :: dbh (:) - real(r8), allocatable, public :: fbw (:) - real(r8), allocatable, public :: nstem (:) - real(r8), allocatable, public :: rstem (:) - real(r8), allocatable, public :: wood_density (:) - contains - procedure, private :: allocParams - end type canopyflux_params_type - ! - type(canopyflux_params_type), public, protected :: params_inst ! params_inst is populated in readParamsMod - - type, public :: canopyflux_type - contains - procedure, public :: ReadParams - end type canopyflux_type ! !PUBLIC MEMBER FUNCTIONS: public :: CanopyFluxesReadNML ! Read in namelist settings @@ -88,83 +70,12 @@ module CanopyFluxesMod logical, private :: snowveg_on = .false. ! snowveg_flag = 'ON' logical, private :: snowveg_onrad = .true. ! snowveg_flag = 'ON_RAD' logical, private :: use_undercanopy_stability = .true. ! use undercanopy stability term or not - logical, private :: use_biomass_heat_storage = .false. ! include biomass heat storage character(len=*), parameter, private :: sourcefile = & __FILE__ !------------------------------------------------------------------------------ contains - !----------------------------------------------------------------------- - subroutine allocParams ( this ) - ! - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - implicit none - - ! !ARGUMENTS: - class(canopyflux_params_type) :: this - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'allocParams' - !----------------------------------------------------------------------- - - ! allocate parameters - - allocate( this%dbh (0:mxpft) ) ; this%dbh(:) = nan - allocate( this%fbw (0:mxpft) ) ; this%fbw(:) = nan - allocate( this%nstem (0:mxpft) ) ; this%nstem(:) = nan - allocate( this%rstem (0:mxpft) ) ; this%rstem(:) = nan - allocate( this%wood_density(0:mxpft) ) ; this%wood_density(:) = nan - - end subroutine allocParams - - !----------------------------------------------------------------------- - subroutine readParams ( this, ncid ) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - implicit none - - ! !ARGUMENTS: - class(canopyflux_type) :: this - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'readParams' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: temp1d(0:mxpft) ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! read in parameters - - - call params_inst%allocParams() - - tString = "dbh" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%dbh=temp1d - tString = "fbw" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%fbw=temp1d - tString = "nstem" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%nstem=temp1d - tString = "rstem" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rstem=temp1d - tString = "wood_density" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%wood_density=temp1d - - end subroutine readParams - !------------------------------------------------------------------------ subroutine CanopyFluxesReadNML(NLFilename) ! @@ -260,7 +171,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! !USES: use shr_const_mod , only : SHR_CONST_RGAS, shr_const_pi use clm_time_manager , only : get_step_size, get_prev_date,is_end_curr_day - use clm_varcon , only : sb, cpair, hvap, vkc, grav, denice + use clm_varcon , only : sb, cpair, hvap, vkc, grav, denice, c_to_b use clm_varcon , only : denh2o, tfrz, csoilc, tlsai_crit, alpha_aero use clm_varcon , only : c14ratio use perf_mod , only : t_startf, t_stopf @@ -382,7 +293,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: efsh ! sensible heat from leaf [mm/s] real(r8) :: obuold(bounds%begp:bounds%endp) ! monin-obukhov length from previous iteration real(r8) :: tlbef(bounds%begp:bounds%endp) ! leaf temperature from previous iteration [K] - real(r8) :: tsbef(bounds%begp:bounds%endp) ! stem temperature from previous iteration [K] + real(r8) :: tl_ini(bounds%begp:bounds%endp) ! leaf temperature from beginning of time step [K] + real(r8) :: ts_ini(bounds%begp:bounds%endp) ! stem temperature from beginning of time step [K] real(r8) :: ecidif ! excess energies [W/m2] real(r8) :: err(bounds%begp:bounds%endp) ! balance error real(r8) :: erre ! balance error @@ -443,6 +355,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, integer :: iv logical :: is_end_day ! is end of current day + real(r8) :: dbh(bounds%begp:bounds%endp) !diameter at breast height of vegetation real(r8) :: cp_veg(bounds%begp:bounds%endp) !heat capacity of veg real(r8) :: cp_stem(bounds%begp:bounds%endp) !heat capacity of stems real(r8) :: dt_stem(bounds%begp:bounds%endp) !change in stem temperature @@ -457,12 +370,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: carea_stem real(r8) :: rstema ! biomass parameters - real(r8), parameter :: c_to_b = 2.0_r8 !(g biomass /g C) - real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume real(r8), parameter :: k_cyl_area = 1.0 !departure from cylindrical area real(r8), parameter :: k_internal = 0.0 !self-absorbtion of leaf/stem longwave + real(r8), parameter :: min_stem_diameter = 0.01!minimum stem diameter for which to calculate stem interactions @@ -473,14 +385,19 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, SHR_ASSERT_ALL((ubound(leafn_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) associate( & - t_stem => temperature_inst%t_stem_patch , & ! Output: [real(r8) (:) ] stem temperature (Kelvin) - hs_canopy => energyflux_inst%hs_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] - soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:) ] soil evaporative resistance - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) - max_dayl => grc%max_dayl , & ! Input: [real(r8) (:) ] maximum daylength for this grid cell (s) - - dleaf => pftcon%dleaf , & ! Input: characteristic leaf dimension (m) + t_stem => temperature_inst%t_stem_patch , & ! Output: [real(r8) (:) ] stem temperature (Kelvin) + hs_canopy => energyflux_inst%hs_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] + soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:) ] soil evaporative resistance + snl => col%snl , & ! Input: [integer (:) ] number of snow layers + dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) + max_dayl => grc%max_dayl , & ! Input: [real(r8) (:) ] maximum daylength for this grid cell (s) + + dleaf => pftcon%dleaf , & ! Input: characteristic leaf dimension (m) + dbh_param => pftcon%dbh , & ! Input: diameter at brest height (m) + fbw => pftcon%fbw , & ! Input: fraction of biomass that is water + nstem => pftcon%nstem , & ! Input: stem number density (#ind/m2) + rstem => pftcon%rstem , & ! Input: stem restistance per stem diameter (s/m**2) + wood_density => pftcon%wood_density , & ! Input: dry wood density (kg/m3) forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) forc_q => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) @@ -533,6 +450,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit leaf area laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded leaf area displa => canopystate_inst%displa_patch , & ! Input: [real(r8) (:) ] displacement height (m) + stem_biomass => canopystate_inst%stem_biomass_patch , & ! Output: [real(r8) (:) ] Aboveground stem biomass (kg/m**2) + leaf_biomass => canopystate_inst%leaf_biomass_patch , & ! Output: [real(r8) (:) ] Aboveground leaf biomass (kg/m**2) htop => canopystate_inst%htop_patch , & ! Input: [real(r8) (:) ] canopy top(m) altmax_lastyear_indx => canopystate_inst%altmax_lastyear_indx_col , & ! Input: [integer (:) ] prior year maximum annual depth of thaw altmax_indx => canopystate_inst%altmax_indx_col , & ! Input: [integer (:) ] maximum annual depth of thaw @@ -726,17 +645,26 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! when elai = 0, do not multiply by k_vert (i.e. fstem = 1) if(elai(p) > 0._r8) fstem(p) = k_vert * fstem(p) + ! if using Satellite Phenology mode, use values in parameter file + ! otherwise calculate dbh from stem biomass + if(.not. use_cn .or. .not. use_biomass_heat_storage) then + dbh(p) = dbh_param(patch%itype(p)) + else + dbh(p) = 2._r8 * sqrt(stem_biomass(p) * (1._r8 - fbw(patch%itype(p))) / ( shr_const_pi * htop(p) * k_cyl_vol & + * nstem(patch%itype(p)) * wood_density(patch%itype(p)))) + endif + ! leaf and stem surface area sa_leaf(p) = elai(p) ! double in spirit of full surface area for sensible heat sa_leaf(p) = 2.*sa_leaf(p) - sa_stem(p) = params_inst%nstem(patch%itype(p))*(htop(p)*shr_const_pi*params_inst%dbh(patch%itype(p))) + sa_stem(p) = nstem(patch%itype(p))*(htop(p)*shr_const_pi*dbh(p)) ! adjust for departure of cylindrical stem model sa_stem(p) = k_cyl_area * sa_stem(p) ! do not calculate separate leaf/stem heat capacity for grasses - if(patch%itype(p) > 11) then + if(patch%itype(p) > 11 .or. dbh(p) < min_stem_diameter) then fstem(p) = 0.0 sa_stem(p) = 0.0 endif @@ -746,31 +674,49 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, sa_stem(p) = 0._r8 sa_leaf(p) = (elai(p)+esai(p)) endif - - ! internal longwave fluxes between leaf and stem + + ! cross-sectional area of stems + carea_stem = shr_const_pi * (dbh(p)*0.5)**2 + + ! if using Satellite Phenology mode, calculate leaf and stem + ! biomass + if(.not. use_cn) then + ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) + leaf_biomass(p) = 0.25_r8 * max(0.01_r8, sa_leaf(p)) & + / (1.-fbw(patch%itype(p))) + stem_biomass(p) = carea_stem * htop(p) * k_cyl_vol & + * nstem(patch%itype(p)) * wood_density(patch%itype(p)) & + /(1.-fbw(patch%itype(p))) + endif + +! internal longwave fluxes between leaf and stem ! surface area term must be equal, remainder cancels ! (use same area of interaction i.e. ignore leaf <-> leaf) sa_internal(p) = min(sa_leaf(p),sa_stem(p)) sa_internal(p) = k_internal * sa_internal(p) ! calculate specify heat capacity of vegetation -!(lma * c2b = lma_dry, lma * c2b * (fw/(1-fw)) = lma_wet, sum these) +! as weighted averaged of dry biomass and water ! lma_dry has units of kg dry mass /m2 here (table 2 of bonan 2017) ! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K -! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) - cp_veg(p) = (0.25_r8 * max(0.01_r8,elai(p))) * (1400._r8 + (params_inst%fbw(patch%itype(p))/(1.-params_inst%fbw(patch%itype(p))))*4188._r8) + cp_veg(p) = leaf_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) ! use non-zero, but small, heat capacity if(.not.use_biomass_heat_storage) then - cp_veg(p) = 1.e-3_r8 + cp_veg(p) = 0._r8 endif - carea_stem = shr_const_pi * (params_inst%dbh(patch%itype(p))*0.5)**2 +! cp-stem will have units J/k/ground_area + cp_stem(p) = stem_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) + +!!$ if(abs(cp_stem(p)) > 0. ) then +!!$ else +!!$ write(iulog,*) 'badcp: ', c, p, cp_stem(p) +!!$ write(iulog,*) 'badcp2: ', stem_biomass(p),fbw(patch%itype(p)) +!!$ endif + -! cp-stem will have units J/k/ground_area (here assuming 1 stem/m2) - cp_stem(p) = (1400._r8 + (params_inst%fbw(patch%itype(p))/(1.-params_inst%fbw(patch%itype(p))))*4188._r8) -! use weight of dry wood - cp_stem(p) = params_inst%nstem(patch%itype(p))* cp_stem(p) * params_inst%wood_density(patch%itype(p)) * htop(p) * carea_stem + ! adjust for departure from cylindrical stem model cp_stem(p) = k_cyl_vol * cp_stem(p) enddo @@ -931,6 +877,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, call MoninObukIni(ur(p), thv(c), dthv(p), zldis(p), z0mv(p), um(p), obu(p)) num_iter(p) = 0 + ! Record initial veg/stem temperatures + tl_ini(p) = t_veg(p) + ts_ini(p) = t_stem(p) end do ! Set counter for leaf temperature iteration (itlef) @@ -953,9 +902,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, temp1(begp:endp), temp2(begp:endp), temp12m(begp:endp), temp22m(begp:endp), fm(begp:endp), & frictionvel_inst) - - - do f = 1, fn p = filterp(f) @@ -963,7 +909,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, g = patch%gridcell(p) tlbef(p) = t_veg(p) - tsbef(p) = t_stem(p) del2(p) = del(p) ! Determine aerodynamic resistances @@ -1107,7 +1052,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, wtg(p) = 1._r8/rah(p,2) ! ground ! wtstem = sa_stem(p)/rb(p) ! stem ! add resistance between internal stem temperature and canopy air - rstema = params_inst%rstem(patch%itype(p))*params_inst%dbh(patch%itype(p)) + rstema = rstem(patch%itype(p))*dbh(p) wtstem = sa_stem(p)/(rstema + rb(p)) ! stem wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) @@ -1232,12 +1177,26 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, dt_veg(p) = ((1.-fstem(p))*(sabv(p) + air(p) & + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & - efsh - efe(p) - lw_leaf(p) + lw_stem(p) & - - (cp_veg(p)/dtime)*(t_veg(p) - tlbef(p))) & + - (cp_veg(p)/dtime)*(t_veg(p) - tl_ini(p))) & / ((1.-fstem(p))*(- 4._r8*bir(p)*t_veg(p)**3) & + 4._r8*sa_internal(p)*emv(p)*sb*t_veg(p)**3 & +dc1*wtga(p) +dc2*wtgaq*qsatldT(p) + cp_veg(p)/dtime) t_veg(p) = tlbef(p) + dt_veg(p) + if(t_veg(p) > 0. .and. t_veg(p) < 1000.) then + else + write(iulog,*) 'badtemp: ', c, p, t_veg(p),fstem(p) + write(iulog,'(a12,i4,6f12.6)') 'badtemp2: ', & + patch%itype(p),- 4._r8*bir(p), & + 4._r8*sa_internal(p)*emv(p)*sb, & + dc1*wtga(p) ,dc2*wtgaq*qsatldT(p) , cp_veg(p)/dtime +! write(iulog,'(a12,i4,6f12.6)') 'badtemp3: ',patch%itype(p),wtga(p),wta0(p),wtg0,wtstem0(p),rstema,rb(p) + + write(iulog,'(a12,i4,6f12.6)') 'badtemp3: ', & + patch%itype(p),dbh(p),dbh_param(patch%itype(p)) + endif + + dels = dt_veg(p) del(p) = abs(dels) err(p) = 0._r8 @@ -1251,7 +1210,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, + lw_stem(p) & - (efsh + dc1*wtga(p)*dt_veg(p)) - (efe(p) + & dc2*wtgaq*qsatldT(p)*dt_veg(p)) & - - (cp_veg(p)/dtime)*(t_veg(p) - tlbef(p)) + - (cp_veg(p)/dtime)*(t_veg(p) - tl_ini(p)) end if ! Fluxes from leaves to canopy space @@ -1391,20 +1350,32 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, err(p) = (1.-fstem(p))*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & - lw_leaf(p) + lw_stem(p) - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) & - - ((t_veg(p)-tlbef(p))*cp_veg(p)/dtime) + - ((t_veg(p)-tl_ini(p))*cp_veg(p)/dtime) ! Update stem temperature; adjust outgoing longwave ! does not account for changes in SH or internal LW, ! as that would change result for t_veg above - dt_stem(p) = (fstem(p)*(sabv(p) + air(p) + bir(p)*tsbef(p)**4 & - + cir(p)*lw_grnd) - eflx_sh_stem(p) & - + lw_leaf(p)- lw_stem(p))/(cp_stem(p)/dtime & - - fstem(p)*bir(p)*4.*tsbef(p)**3) - - hs_canopy(p) = dt_stem(p)*cp_stem(p)/dtime & - +(t_veg(p)-tlbef(p))*cp_veg(p)/dtime - - t_stem(p) = t_stem(p) + dt_stem(p) + if (use_biomass_heat_storage) then + if (stem_biomass(p) > 0._r8) then + dt_stem(p) = (fstem(p)*(sabv(p) + air(p) + bir(p)*ts_ini(p)**4 & + + cir(p)*lw_grnd) - eflx_sh_stem(p) & + + lw_leaf(p)- lw_stem(p))/(cp_stem(p)/dtime & + - fstem(p)*bir(p)*4.*ts_ini(p)**3) + else + dt_stem(p) = 0._r8 + endif + + hs_canopy(p) = dt_stem(p)*cp_stem(p)/dtime & + +(t_veg(p)-tl_ini(p))*cp_veg(p)/dtime + + t_stem(p) = t_stem(p) + dt_stem(p) + endif + + if(t_stem(p) > 0. .and. t_stem(p) < 1000.) then + else + write(iulog,'(a12,3i8,6f12.6)') 'badtemp4: ', c, p, patch%itype(p), t_stem(p), cp_stem(p) + write(iulog,'(a12,i8,6f12.6)') 'badtemp5: ', patch%itype(p), fstem(p),stem_biomass(p), cp_veg(p),leaf_biomass(p) + endif delt = wtal(p)*t_grnd(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p)-wtstem0(p)*t_stem(p) @@ -1485,12 +1456,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & - emv(p)*emg(c)*sb*(tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1.-fstem(p))+tsbef(p)**3*(tsbef(p) + 4._r8*dt_stem(p))*fstem(p)) + emv(p)*emg(c)*sb*(tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1.-fstem(p))+ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p))*fstem(p)) ! Upward longwave radiation above the canopy ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-fstem(p))*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+fstem(p)*tsbef(p)**3*(tsbef(p) + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-fstem(p))*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+fstem(p)*ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction diff --git a/src/biogeophys/CanopyStateType.F90 b/src/biogeophys/CanopyStateType.F90 index bfb5196d79..f4008815d4 100644 --- a/src/biogeophys/CanopyStateType.F90 +++ b/src/biogeophys/CanopyStateType.F90 @@ -36,6 +36,8 @@ module CanopyStateType real(r8) , pointer :: laisha_z_patch (:,:) ! patch patch shaded leaf area for canopy layer real(r8) , pointer :: mlaidiff_patch (:) ! patch difference between lai month one and month two (for dry deposition of chemical tracers) real(r8) , pointer :: annlai_patch (:,:) ! patch 12 months of monthly lai from input data set (for dry deposition of chemical tracers) + real(r8) , pointer :: stem_biomass_patch (:) ! Aboveground stem biomass (kg/m**2) + real(r8) , pointer :: leaf_biomass_patch (:) ! Aboveground leaf biomass (kg/m**2) real(r8) , pointer :: htop_patch (:) ! patch canopy top (m) real(r8) , pointer :: hbot_patch (:) ! patch canopy bottom (m) real(r8) , pointer :: displa_patch (:) ! patch displacement height (m) @@ -127,6 +129,8 @@ subroutine InitAllocate(this, bounds) allocate(this%laisha_z_patch (begp:endp,1:nlevcan)) ; this%laisha_z_patch (:,:) = nan allocate(this%mlaidiff_patch (begp:endp)) ; this%mlaidiff_patch (:) = nan allocate(this%annlai_patch (12,begp:endp)) ; this%annlai_patch (:,:) = nan + allocate(this%stem_biomass_patch (begp:endp)) ; this%stem_biomass_patch (:) = nan + allocate(this%leaf_biomass_patch (begp:endp)) ; this%leaf_biomass_patch (:) = nan allocate(this%htop_patch (begp:endp)) ; this%htop_patch (:) = nan allocate(this%hbot_patch (begp:endp)) ; this%hbot_patch (:) = nan allocate(this%displa_patch (begp:endp)) ; this%displa_patch (:) = nan @@ -198,6 +202,16 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='shaded projected leaf area index', & ptr_patch=this%laisha_patch, set_urb=0._r8) + this%stem_biomass_patch(begp:endp) = spval + call hist_addfld1d (fname='AGSB', units='kg/m^2', & + avgflag='A', long_name='Aboveground stem biomass', & + ptr_patch=this%stem_biomass_patch, default='inactive') + + this%leaf_biomass_patch(begp:endp) = spval + call hist_addfld1d (fname='AGLB', units='kg/m^2', & + avgflag='A', long_name='Aboveground leaf biomass', & + ptr_patch=this%leaf_biomass_patch, default='inactive') + if (use_cn .or. use_fates) then this%fsun_patch(begp:endp) = spval call hist_addfld1d (fname='FSUN', units='proportion', & @@ -509,14 +523,16 @@ subroutine InitCold(this, bounds) l = patch%landunit(p) this%frac_veg_nosno_patch(p) = 0._r8 - this%tlai_patch(p) = 0._r8 - this%tsai_patch(p) = 0._r8 - this%elai_patch(p) = 0._r8 - this%esai_patch(p) = 0._r8 - this%htop_patch(p) = 0._r8 - this%hbot_patch(p) = 0._r8 - this%dewmx_patch(p) = 0.1_r8 - this%vegwp_patch(p,:) = -2.5e4_r8 + this%tlai_patch(p) = 0._r8 + this%tsai_patch(p) = 0._r8 + this%elai_patch(p) = 0._r8 + this%esai_patch(p) = 0._r8 + this%stem_biomass_patch(p)= 0._r8 + this%leaf_biomass_patch(p)= 0._r8 + this%htop_patch(p) = 0._r8 + this%hbot_patch(p) = 0._r8 + this%dewmx_patch(p) = 0.1_r8 + this%vegwp_patch(p,:) = -2.5e4_r8 if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then this%laisun_patch(p) = 0._r8 @@ -585,6 +601,14 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', long_name='one-sided stem area index, with burying by snow', units='', & interpinic_flag='interp', readvar=readvar, data=this%esai_patch) + call restartvar(ncid=ncid, flag=flag, varname='stem_biomass', xtype=ncd_double, & + dim1name='pft', long_name='stem biomass', units='kg/m^2', & + interpinic_flag='interp', readvar=readvar, data=this%stem_biomass_patch) + + call restartvar(ncid=ncid, flag=flag, varname='leaf_biomass', xtype=ncd_double, & + dim1name='pft', long_name='leaf biomass', units='kg/m^2', & + interpinic_flag='interp', readvar=readvar, data=this%leaf_biomass_patch) + call restartvar(ncid=ncid, flag=flag, varname='htop', xtype=ncd_double, & dim1name='pft', long_name='canopy top', units='m', & interpinic_flag='interp', readvar=readvar, data=this%htop_patch) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 2bc4e96039..1f35c4744c 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -340,7 +340,7 @@ subroutine initialize2( ) allocate(nutrient_competition_method, & source=create_nutrient_competition_method(bounds_proc)) - call readParameters(nutrient_competition_method, photosyns_inst, canopyflux_inst) + call readParameters(nutrient_competition_method, photosyns_inst) ! ------------------------------------------------------------------------ ! Initialize time manager diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 2278f924b6..43c3fae406 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -50,7 +50,6 @@ module clm_instMod use OzoneBaseMod , only : ozone_base_type use OzoneFactoryMod , only : create_and_init_ozone_type use PhotosynthesisMod , only : photosyns_type - use CanopyFluxesMod , only : canopyflux_type use SoilHydrologyType , only : soilhydrology_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type use SoilStateType , only : soilstate_type @@ -102,7 +101,6 @@ module clm_instMod type(lakestate_type) :: lakestate_inst class(ozone_base_type), allocatable :: ozone_inst type(photosyns_type) :: photosyns_inst - type(canopyflux_type) :: canopyflux_inst type(soilstate_type) :: soilstate_inst type(soilhydrology_type) :: soilhydrology_inst type(saturated_excess_runoff_type) :: saturated_excess_runoff_inst diff --git a/src/main/clm_varcon.F90 b/src/main/clm_varcon.F90 index d0a2053568..3c60372f8b 100644 --- a/src/main/clm_varcon.F90 +++ b/src/main/clm_varcon.F90 @@ -122,11 +122,13 @@ module clm_varcon real(r8) :: thk_bedrock = 3.0_r8 ! thermal conductivity of 'typical' saturated granitic rock ! (Clauser and Huenges, 1995)(W/m/K) - real(r8) :: csol_bedrock = 2.0e6_r8 ! vol. heat capacity of granite/sandstone J/(m3 K)(Shabbir, 2000) !scs + real(r8) :: csol_bedrock = 2.0e6_r8 ! vol. heat capacity of granite/sandstone J/(m3 K)(Shabbir, 2000) real(r8), parameter :: zmin_bedrock = 0.4_r8 ! minimum soil depth [m] real(r8), parameter :: aquifer_water_baseline = 5000._r8 ! baseline value for water in the unconfined aquifer [mm] + real(r8), parameter :: c_to_b = 2.0_r8 ! conversion between mass carbon and total biomass (g biomass /g C) + !!! C13 real(r8), parameter :: preind_atm_del13c = -6.0 ! preindustrial value for atmospheric del13C real(r8), parameter :: preind_atm_ratio = SHR_CONST_PDB + (preind_atm_del13c * SHR_CONST_PDB)/1000.0 ! 13C/12C diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 53fb8d0d0c..69fddaf981 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -485,7 +485,7 @@ subroutine InitRead(this) use fileutils , only : getfil use ncdio_pio , only : ncd_io, ncd_pio_closefile, ncd_pio_openfile, file_desc_t use ncdio_pio , only : ncd_inqdid, ncd_inqdlen - use clm_varctl , only : paramfile, use_fates, use_flexibleCN, use_dynroot + use clm_varctl , only : paramfile, use_fates, use_flexibleCN, use_dynroot, use_biomass_heat_storage use spmdMod , only : masterproc use CLMFatesParamInterfaceMod, only : FatesReadPFTs ! @@ -1014,6 +1014,29 @@ subroutine InitRead(this) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) end if + ! + ! Biomass heat storage variables + ! + if (use_biomass_heat_storage ) then + call ncd_io('dbh',this%dbh, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + call ncd_io('fbw',this%fbw, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + call ncd_io('nstem',this%nstem, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + call ncd_io('rstem',this%rstem, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + call ncd_io('wood_density',this%wood_density, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + else + this%dbh = 0.0 + this%fbw = 0.0 + call ncd_io('nstem',this%nstem, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + this%rstem = 0.0 + this%wood_density = 0.0 + end if + call ncd_pio_closefile(ncid) call FatesReadPFTs() diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index f1c7a4aa43..32281eb057 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -23,7 +23,7 @@ module readParamsMod contains !----------------------------------------------------------------------- - subroutine readParameters (nutrient_competition_method, photosyns_inst, canopyflux_inst) + subroutine readParameters (nutrient_competition_method, photosyns_inst) ! ! ! USES: use CNSharedParamsMod , only : CNParamsReadShared @@ -43,11 +43,9 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst, canopyfl use NutrientCompetitionMethodMod , only : nutrient_competition_method_type use clm_varctl, only : NLFilename_in use PhotosynthesisMod , only : photosyns_type - use CanopyFluxesMod , only : canopyflux_type ! ! !ARGUMENTS: type(photosyns_type) , intent(in) :: photosyns_inst - type(canopyflux_type) , intent(in) :: canopyflux_inst class(nutrient_competition_method_type), intent(in) :: nutrient_competition_method ! ! !LOCAL VARIABLES: @@ -99,8 +97,6 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst, canopyfl ! Biogeophysics ! call photosyns_inst%ReadParams( ncid ) - call canopyflux_inst%ReadParams( ncid ) - ! call ncd_pio_closefile(ncid) From b1185b9342b90cfc4c5b07444a7d22f555d35faa Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 29 Aug 2019 09:21:29 -0600 Subject: [PATCH 0382/1973] initialize dt_stem --- src/biogeophys/CanopyFluxesMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index cc7f2570df..c2b444492a 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1437,6 +1437,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(t_veg(p)-tl_ini(p))*cp_veg(p)/dtime t_stem(p) = t_stem(p) + dt_stem(p) + else + dt_stem(p) = 0._r8 endif delt = wtal(p)*t_grnd(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p)-wtstem0(p)*t_stem(p) From 19f0d9e23f5ade9b297fb698d3b202c193fea676 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 29 Aug 2019 12:02:19 -0600 Subject: [PATCH 0383/1973] temporary Makefile for Lilac -- hard-coded everythin. --- lilac/lilac/Makefile | 101 +++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 43 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index 6773b5a5b8..3cc63fd44e 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -1,22 +1,26 @@ -# GNU Makefile template for user ESMF application - -################################################################################ -################################################################################ -## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ## -## 'include' line below. Following the ESMF User's Guide, a complete ESMF ## -## installation should ensure that a single environment variable "ESMFMKFILE" ## -## is made available on the system. This variable should point to the ## -## "esmf.mk" file. ## -## ## -## This example Makefile uses the "ESMFMKFILE" environment variable. ## -## ## -## If you notice that this Makefile cannot find variable ESMFMKFILE then ## -## please contact the person responsible for the ESMF installation on your ## -## system. ## -## As a work-around you can simply hardcode the path to "esmf.mk" in the ## -## include line below. However, doing so will render this Makefile a lot less ## -## flexible and non-portable. ## -################################################################################ + +#================================================================================ +# Makefile to compile the lilac program +#================================================================================ +## This is temporary Makefile for building lilac against CTSM pre-compiled library + + + +#================================================================================ +### Finding and including esmf.mk +#================================================================================ + +# Note: This fully portable Makefile template depends on finding environment +# # variable "ESMFMKFILE" set to point to the appropriate "esmf.mk" file, +# # as is discussed in the User's Guide. +# # However, you can still use this Makefile template even if the person +# # that installed ESMF on your system did not provide for a mechanism to +# # automatically set the environment variable "ESMFMKFILE". In this case +# # either manually set "ESMFMKFILE" in your environment or hard code the +# # location of "esmf.mk" into the include statement below. +# # Notice that the latter approach has negative impact on flexibility and +# # portability. + ifneq ($(origin ESMFMKFILE), environment) $(error Environment variable ESMFMKFILE was not set.) @@ -24,53 +28,64 @@ endif include $(ESMFMKFILE) -################################################################################ -################################################################################ +#================================================================================ +### Define directory paths +#================================================================================ +# Temporarily hard-coded +# TODO: Please fix this part. +CTSM_BLD_DIR = /glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf +CTSM_INC = -I$(CTSM_BLD_DIR)/include +CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm +TRACEBACK_FLAGS = -g -traceback -debug all -check all +# ----------------------------------------------------------------------------- +#EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/pio/pio2 +EXTRA_LIBS = -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib +MORE_LIBSi = -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ +# ----------------------------------------------------------------------------- + + +#================================================================================ +### Compiler and linker rules using ESMF_ variables supplied by esmf.mk +#================================================================================ .SUFFIXES: .f90 .F90 .c .C %.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $< + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREENOCPP) $< %.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) $(EXTRA_LIBS) $(MORE_LIBS) $< - + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + %.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< + $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) \ + $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< % : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< + $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) \ + $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< -CTSM_BLD_DIR = /glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf -CTSM_INC = -I$(CTSM_BLD_DIR)/include -CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm -TRACEBACK_FLAGS = -g -traceback -debug all -check all -# ----------------------------------------------------------------------------- -#EXTRA_LIBS = -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib -EXTRA_LIBS = -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib -MORE_LIBS = -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -#EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/pio/pio2 -# ----------------------------------------------------------------------------- demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) $(TRACEBACK_FLAGS) $(MORE_LIBS) mv demo_driver demo_driver.exe - #rm *.o *.mod + rm *.o *.mod # module dependencies: #demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o #shr_pio_mod.o -###shr_string_mod.o: shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o atmos_cap.o: lilac_utils.o + # ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- -.PHONY: dust clean distclean berzerk remake -dust: - rm -f PET*.ESMF_LogFile DE.nc FLAG.nc OMEGA.nc SIE.nc U_velocity.nc V_velocity.nc + +.PHONY: clean berzerk remake clean: rm -f *.exe -distclean: dust clean berzerk: rm -f PET*.ESMF_LogFile job_name* *.o *.mod *.exe remake: rm lilac_mod.o demo_driver.o demo_driver.exe & make +# ----------------------------------------------------------------------------- From 57d676e3061387b35917da3b5f8858a0feb65156 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 29 Aug 2019 12:35:05 -0600 Subject: [PATCH 0384/1973] removing the swap file (.swp) that was pushed by mistake... --- lilac/lilac/.cpl_mod.F90.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 lilac/lilac/.cpl_mod.F90.swp diff --git a/lilac/lilac/.cpl_mod.F90.swp b/lilac/lilac/.cpl_mod.F90.swp deleted file mode 100644 index f5b5fe720ede7c4567a1fb56a69411949340a14d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&2JM&7>6emLQMG*J+(#ZBvmB`Suv!Qsv@}}b!=gjgvgG2C`e|r9w#f-v#Z^) z+Hl~bYB-XfIPeD`1P3^CK;l-Ztwaw!_t1X;BCXZGE9 zpP6^omUsF1x0QMR<3A|g z2FL&zAOmE843GgbKnC6+1Iis?SCH?nDCfoKbtLr~?a~VwAOmE843GgbKnBPF86X2> zfDDiUGVl%>Fq(|r+0EGQQ6!Jw|GVG+pB-ZCDfk=w0iJ*d;AgM_u7h>31oGezI0*hZ z$k+?;JNOM;01Vtcz}PwPazA7Dz$|$FKKg)P!7b1Mb?`O#Yah-9Hoy(g0s=I_C*Wm< zu|L6mumL1!g97*r>;oAv1|E(vb`!YZ3^)cdU<^Fk%h+x3Be({xf-B$z$bcvCau=+F zpTIdV15SaX;A8L+_z;YOJwUsB570&i$N(95`wa-$#z- z%J2|#WuhMg{ltp!a$Nr-Ro0R??Ib^W646-@3xCv_E3(0fine23oDAMa7gO(T(yOKn zC3?NAw(EE*crVAr551jD4lKHM(P_K-P#xa2P3#5zh6u?<{csJhI8!dnG>2=N9AX)U zr(rs@j1;iFO7WoJmg8~Tz|bj&BZ%X>tHKk|YAMUGtxJOU2Gp=^(d>;udISdi57 z@Sv%$gcq$joLj9dCVM`)piFWTlQmpp%9ae~aTX)ivW=BOuppEcW*al#oUJbD;wtF+ z3MW$kxTvOULY1WQ))pO1`2N)dLFP+Kr_atdDhrjR%FJBlyAldEmaDFzWcYqrmS-w+ z^=c_R>+4FXUjtE6uU}}=zWSL5Yl*(t)C|^{ch~El2isf=;A#&XDg;x#l zG6gfdPc&M3l#{agTak9PzL4XaW$bliD&HNpycNmusT@^sD#|Xa82+RES&g~ocx&gFHLY~(*OVf From 1ba00d8d6b2b89de990aab1c58b8328bbd9f039e Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 29 Aug 2019 12:36:33 -0600 Subject: [PATCH 0385/1973] updating the .gitignore file... --- lilac/lilac/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/lilac/.gitignore b/lilac/lilac/.gitignore index 3ddd2df7eb..d52decad68 100644 --- a/lilac/lilac/.gitignore +++ b/lilac/lilac/.gitignore @@ -2,4 +2,4 @@ job_name* PET* *.exe -#batch.sub +batch.sub From 4b2f343c008f75a9cc4f2f0e2aaf0b54169d9803 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 29 Aug 2019 12:38:37 -0600 Subject: [PATCH 0386/1973] removing the redundant files..... --- lilac/lilac/batch.sub | 26 - lilac/lilac_joe/CMakeLists.txt | 4 - lilac/lilac_joe/core.f90 | 464 ------------------ lilac/lilac_joe/drivers/lilac_data_driver.f90 | 207 -------- lilac/lilac_joe/esmf_utils.f90 | 224 --------- lilac/lilac_joe/lilac_utils.f90 | 121 ----- 6 files changed, 1046 deletions(-) delete mode 100644 lilac/lilac/batch.sub delete mode 100644 lilac/lilac_joe/CMakeLists.txt delete mode 100644 lilac/lilac_joe/core.f90 delete mode 100644 lilac/lilac_joe/drivers/lilac_data_driver.f90 delete mode 100644 lilac/lilac_joe/esmf_utils.f90 delete mode 100644 lilac/lilac_joe/lilac_utils.f90 diff --git a/lilac/lilac/batch.sub b/lilac/lilac/batch.sub deleted file mode 100644 index 5a25dd32b9..0000000000 --- a/lilac/lilac/batch.sub +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/tcsh -#PBS -N job_name -#####PBS -A P54048000 -#PBS -A P93300606 -#PBS -l walltime=00:10:00 -###PBS -q premium -#PBS -q share -##PBS -q regular -#PBS -j oe - -#PBS -l select=2:ncpus=2:mpiprocs=4 -##PBS -l select=1:ncpus=1:mpiprocs=2 -##PBS -l select=1:ncpus=1:mpiprocs=1 - -ml - -### Set TMPDIR as recommended -setenv TMPDIR /glade/scratch/$USER/temp -mkdir -p $TMPDIR - - -echo "hello" -### Run the executable -set MPI_SHEPHERD=true -source /glade/scratch/negins/test_clean/.env_mach_specific.csh -mpiexec_mpt ./demo_driver.exe diff --git a/lilac/lilac_joe/CMakeLists.txt b/lilac/lilac_joe/CMakeLists.txt deleted file mode 100644 index a92669e0ff..0000000000 --- a/lilac/lilac_joe/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Compile LILAC library -file(GLOB_RECURSE LILAC_SOURCES *.f90 *.h) -add_library(lilac ${LILAC_SOURCES}) -target_include_directories(lilac PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/lilac/lilac_joe/core.f90 b/lilac/lilac_joe/core.f90 deleted file mode 100644 index af33240e6d..0000000000 --- a/lilac/lilac_joe/core.f90 +++ /dev/null @@ -1,464 +0,0 @@ -module lilac - - use ESMF - use esmf_utils - - use lilac_utils , only create_fldlists, fldsMax - - - implicit none - - character(*), parameter :: modname = "(core)" - integer, parameter :: LILAC_SUCCESS = ESMF_SUCCESS - - ! shared module level variables - character(len=*) :: atm_mesh_filepath - type(LilacFields) :: a2x_state - type(LilacFields) :: x2a_state - - !-------------------------------------------------------------------------- - ! Public interfaces - !-------------------------------------------------------------------------- - public :: start - public :: init - public :: run - public :: final - - private :: atmos_register - private :: land_register - private :: cpl_register - - type, public :: LilacType - private - - type(ESMFInfoType) :: esmf_info - - contains - procedure, public :: init => init - procedure, public :: run => run - procedure, public :: final => final - - ! register methods - procedure, nopass, private :: atmos_register => atmos_register - procedure, nopass, private :: land_register => land_register - procedure, nopass, private :: cpl_register => cpl_register - - ! Init methods - procedure, nopass, private :: atmos_init => atmos_init - procedure, nopass, private :: land_init => land_init - procedure, nopass, private :: coupler_init => coupler_init - - ! Run methods - procedure, nopass, private :: atmos_copy_atm_to_lilac => atmos_copy_atm_to_lilac - procedure, nopass, private :: atmos_copy_lilac_to_atm => atmos_copy_lilac_to_atm - procedure, nopass, private :: land_run => land_run - procedure, nopass, private :: coupler_run => coupler_run - - ! Final methods - procedure, nopass, private :: atmos_final => atmos_final - procedure, nopass, private :: land_final => land_final - procedure, nopass, private :: coupler_final => coupler_final - - end type LilacType - - type, public :: LilacFields - private - - real, dimension(:, :), allocatable :: fields - character(len=:), allocatable :: field_names(:) - - contains - procedure, public :: init => init_lilac_state - procedure, public :: get => get_lilac_field - end type LilacFields - -contains - - subroutine start(self, rc) - implicit none - class(LilacType), intent(inout) :: self - integer, intent(in) :: rc=ESMF_SUCCESS - - character(len=*), parameter :: subname=trim(modname)//':(init) ' - - call ESMF_LogWrite(subname//"Starting lilac and setting up ESMF", ESMF_LOGMSG_INFO) - - ! Initialize ESMF structures - call self%esmf_info%start(rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - end subroutine start - - subroutine init(self, clock, x2a_state, a2x_state, rc) - implicit none - class(LilacType), intent(inout) :: self - type(ESMF_Clock) :: clock ! Input synchronization clock - type(LilacFields) :: x2a_state - type(LilacFields) :: a2x_state - integer, intent(in) :: rc=ESMF_SUCCESS - - character(len=*), parameter :: subname=trim(modname)//':(init) ' - - call ESMF_LogWrite(subname//"Initializing lilac", ESMF_LOGMSG_INFO) - - call self%esmf_info%start(atmos_register, land_register, cpl_register, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - end subroutine init - - subroutine run(self, clock, x2a_state, a2x_state, rc) - implicit none - class(LilacType), intent(inout) :: self - type(ESMF_Clock) :: clock ! Input synchronization clock - type(LilacFields) :: x2a_state - type(LilacFields) :: a2x_state - integer, intent(in) :: rc=ESMF_SUCCESS - - character(len=*), parameter :: subname=trim(modname)//':(run) ' - - call ESMF_LogWrite(subname//"Running lilac", ESMF_LOGMSG_INFO) - - ! save states to module level variable here - - call self%esmf_info%run(rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - end subroutine run - - subroutine final(self, rc) - implicit none - class(LilacType), intent(inout) :: self - integer, intent(in) :: rc=ESMF_SUCCESS - - character(len=*), parameter :: subname=trim(modname)//':(final) ' - - call ESMF_LogWrite(subname//"Finalizing lilac", ESMF_LOGMSG_INFO) - - call self%esmf_info%final(rc) - - end subroutine final - - subroutine atmos_register(comp, rc) - type(ESMF_GridComp) :: comp ! must not be optional - integer, intent(in) :: rc=ESMF_SUCCESS - - character(len=*), parameter :: subname=trim(modname)//':(atmos_register) ' - - ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=atmos_init, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_copy_atm_to_lilac, phase=1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_copy_lilac_to_atm, phase=2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=atmos_final, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - rc = ESMF_SUCCESS - - end subroutine atmos_register - - subroutine land_register(comp, rc) - type(ESMF_GridComp) :: comp ! must not be optional - integer, intent(out) :: rc ! must not be optional - character(len=*), parameter :: subname=trim(modname)//':(lnd_register) ' - - ! land_* comes from ctsm esmf cap - - ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=land_init, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=land_run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=land_final, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - rc = ESMF_SUCCESS - - end subroutine land_register - - subroutine cpl_register(comp, rc) - type(ESMF_CplComp) :: comp ! must not be optional - integer, intent(out) :: rc ! must not be optional - character(len=*), parameter :: subname=trim(modname)//':(cpl_register) ' - - rc = ESMF_FAILURE - - ! Register the callback routines. - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=coupler_init, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=coupler_run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_CplCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=coupler_final, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_LogWrite(subname//"CouplerMod: Registered Initialize, Run, and Finalize routines", ESMF_LOGMSG_INFO) - - rc = ESMF_SUCCESS - - end subroutine cpl_register - - subroutine atmos_init(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - type (fld_list_type) :: fldsToCpl(fldsMax) - type (fld_list_type) :: fldsFrCpl(fldsMax) - integer :: fldsToCpl_num - integer :: fldsFrCpl_num - - character(len=*), parameter :: subname=trim(modname)//':(atmos_init) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - ! read in the mesh - if (masterproc) then - write(iulog,*)'mesh file for domain is ',trim(atm_mesh_filepath) - end if - ! move to lilac dummy atmosphere init? - EMesh = ESMF_MeshCreate(filename=trim(atm_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! create field lists - call create_fldlists(fldsFrCpl, fldsToCpl, fldsToCpl_num, fldsFrCpl_num) - - ! Create States - x2a_state = ESMF_StateCreate(name="x2a_state", stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - a2x_state = ESMF_StateCreate(name="x2a_state", stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! Coupler to Atmosphere Fields - FBout = ESMF_FieldBundleCreate(name="x2a_fields", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! Create individual states and add to field bundle - do n = 1,fldsFrCpl_num - ! create field - field = ESMF_FieldCreate(lmesh, ESMF_TYPEKIND_R8, meshloc=meshloc, name=trim(fldsFrCpl(n)%stdname), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! add field to field bundle - call ESMF_FieldBundleAdd(FBout, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - enddo - - ! Add FB to state - call ESMF_StateAdd(x2a_state, (/FBout/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! Atmosphere to Coupler Fields - FBout = ESMF_FieldBundleCreate(name="a2x_fields", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! Create individual states and add to field bundle - do n = 1,fldsToCpl_num - ! create field - field = ESMF_FieldCreate(lmesh, ESMF_TYPEKIND_R8, meshloc=meshloc, name=trim(fldsToCpl(n)%stdname), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! initialize with default value - call ESMF_FieldGet(lfield, farrayPtr=fldptr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ldptr = fldsToCpl(n)%default_value - - ! add field to field bundle - call ESMF_FieldBundleAdd(FBout, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - enddo - - ! Add FB to state - call ESMF_StateAdd(a2x_state, (/FBout/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - end subroutine atmos_init - - subroutine land_init(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(land_init) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"land_init has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine land_init - - subroutine coupler_init(comp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(coupler_init) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"coupler_init has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine coupler_init - - subroutine atmos_copy_atm_to_lilac(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(atmos_copy_atm_to_lilac) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"atmos_copy_atm_to_lilac has not been implemented yet", ESMF_LOGMSG_INFO) - - ! loop over fields, copying pointer from import to export state - - end subroutine atmos_copy_atm_to_lilac - - subroutine atmos_copy_lilac_to_atm(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(atmos_copy_lilac_to_atm) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"atmos_copy_lilac_to_atm has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine atmos_copy_lilac_to_atm - - subroutine land_run(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(land_run) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"land_run has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine land_run - - subroutine coupler_run(comp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(coupler_run) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"coupler_run has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine coupler_run - - subroutine atmos_final(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(atmos_final) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"atmos_final has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine atmos_final - - subroutine land_final(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(land_final) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"land_final has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine land_final - - subroutine coupler_final(comp, importState, exportState, clock, rc) - type(ESMF_CplComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//':(coupler_final) ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"coupler_final has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine coupler_final - - subroutine init_lilac_state(self, field_list, nlocal) - implicit none - class(LilacFields), intent(inout) :: self - type(fld_list_type), intent(inout) :: field_list(:) - integer, intent(in) :: nlocal - - integer :: nfields, i - - nfields = size(field_list) - - allocate(character(MAXCHAR) :: self%field_names(nfields)) - allocate(self%fields(nfields, nlocal)) - - do i = 1, nfields - self%field_names(i) = field_list(i)%stdname - self%fields(i) = field_list(i)%default_value - enddo - - end subroutine init_lilac_state - - - function get_lilac_field(self, field_name) result(array_ptr) - implicit none - class(LilacFields) :: self - character(len=*) :: field_name - pointer :: array_ptr - - integer :: i - - nfields = size(self%field_names) - - do i = 1, nfields - if (field_name .eq. (self%field_names(i))) then - ptr => self%fields(i, :) - return - endif - enddo - - ! Raise error here - call ESMF_LogWrite("KeyError: Did not find variable in LilacFields object" // field_name, ESMF_LOGMSG_INFO) - - end function get_lilac_field - -end module lilac diff --git a/lilac/lilac_joe/drivers/lilac_data_driver.f90 b/lilac/lilac_joe/drivers/lilac_data_driver.f90 deleted file mode 100644 index b1dfe32665..0000000000 --- a/lilac/lilac_joe/drivers/lilac_data_driver.f90 +++ /dev/null @@ -1,207 +0,0 @@ - -program lilac_data_driver - - use seq_infodata_mod, only: seq_infodata_putdata - use shr_sys_mod , only: shr_sys_flush - use shr_orb_mod , only: shr_orb_params - use shr_file_mod , only: shr_file_setlogunit, shr_file_setloglevel - use shr_pio_mod , only: shr_pio_init1, shr_pio_init2 - use ESMF - - use lilac_utils , only create_fldlists, fldsMax - - - implicit none - -#include ! mpi library include file - - !----- Clocks ----- - type(ESMF_Clock) :: EClock ! Input synchronization clock - type(ESMF_Time) :: CurrTime, StartTime, StopTime - type(ESMF_TimeInterval) :: TimeStep - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar),target :: Calendar - integer :: yy,mm,dd,sec - - !----- MPI/MCT ----- - integer :: mpicom_lilac_drv ! local mpicom - integer :: ID_lilac_drv ! mct ID - integer :: ncomps ! number of separate components for MCT - integer :: ntasks,mytask ! mpicom size and rank - integer :: global_comm ! copy of mpi_comm_world for pio - integer,allocatable :: comp_id(:) ! for pio init2 - logical,allocatable :: comp_iamin(:) ! for pio init2 - character(len=64),allocatable :: comp_name(:) ! for pio init2 - integer,allocatable :: comp_comm(:), comp_comm_iam(:) ! for pio_init2 - - !----- Land Coupling Data ----- - type(LilacGrid) :: gridComp - type(LilacFields) :: a2x_state - type(LilacFields) :: x2a_state - - integer :: orb_iyear ! Orbitalle - real*8 :: orb_eccen, orb_obliq, orb_mvelp, orb_obliqr, orb_lambm0, orb_mvelpp - character(len=128) :: case_name, case_desc, model_version, hostname, username - character(len=128) :: start_type - logical :: brnch_retain_casename, single_column, atm_aero - real*8 :: scmlat, scmlon - - !----- Atm Model ----- - integer :: atm_nx, atm_ny - integer :: gsize, lsize, gstart, gend ! domain decomp info - integer, allocatable :: gindex(:) ! domain decomp info - type(mct_aVect) :: x2l_a ! data for land on atm decomp - type(mct_aVect) :: l2x_a ! data from land on atm decomp - type(mct_gsMap) :: gsmap_atm ! gsmap data for atm - type(mct_rearr) :: rearr_atm2lnd ! rearranger for atm to land - type(mct_rearr) :: rearr_lnd2atm ! rearranger for land to atm - - !----- Other ----- - integer :: n,m ! counter - character(len=128) :: string ! temporary string - integer :: ierr, rc ! local error status - integer :: iunit = 250 ! lilac_drv log unit number - integer :: sunit = 249 ! share log unit number - character(len=*),parameter :: subname = 'lilac_drv' - - type (fld_list_type) :: fldsToCpl(fldsMax) - type (fld_list_type) :: fldsFrCpl(fldsMax) - - !---------------------------------------------- - - !---------------------------------------------- - !--- MPI/MCT --- - !---------------------------------------------- - - call MPI_Init(ierr) - call MPI_Comm_Dup(MPI_COMM_WORLD, mpicom_lilac_drv, ierr) - call MPI_COMM_RANK(mpicom_lilac_drv, mytask, ierr) - call MPI_COMM_SIZE(mpicom_lilac_drv, ntasks, ierr) - - call lilac%start() - - !---------------------------------------------- - !--- Log File and PIO --- - !---------------------------------------------- - - global_comm = MPI_COMM_WORLD - call shr_pio_init1(ncomps, 'pio_in', global_comm) - allocate(comp_id(ncomps),comp_name(ncomps),comp_iamin(ncomps),comp_comm(ncomps),comp_comm_iam(ncomps)) - do n = 1,ncomps - comp_id(n) = ID_lilac_drv - comp_name(n) = 'LND' - comp_iamin(n) = .true. - comp_comm(n) = mpicom_lilac_drv - comp_comm_iam(n) = mytask - enddo - call shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam) - deallocate(comp_id,comp_name,comp_iamin,comp_comm,comp_comm_iam) - - write(string,'(a,i4.4)') 'lilac_drv.log.',mytask - open(iunit, file=trim(string)) - write(iunit,*) subname,' STARTING' - call shr_sys_flush(iunit) - - write(iunit,*) subname,' ntasks = ',ntasks - write(iunit,*) subname,' mytask = ',mytask - write(iunit,*) subname,' mct ID = ',ID_lilac_drv - call shr_sys_flush(iunit) - call shr_file_setLogUnit(sunit) - call shr_file_setLogLevel(1) - - !---------------------------------------------- - !--- Clocks --- - !---------------------------------------------- - Calendar = ESMF_CalendarCreate(name='lilac_drv_NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) - call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeSet(StopTime , yy=2000, mm=1, dd=10, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) - EClock = ESMF_ClockCreate(name='lilac_drv_EClock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, stopTime=stopTime, rc=rc) - - EAlarm_stop = ESMF_AlarmCreate(name='seq_timemgr_alarm_stop', clock=EClock, ringTime=StopTime, rc=rc) - EAlarm_rest = ESMF_AlarmCreate(name='seq_timemgr_alarm_restart', clock=EClock, ringTime=StopTime, rc=rc) - - call ESMF_TimeGet( StartTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StartTime ymds=',yy,mm,dd,sec - call ESMF_TimeGet( StopTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' StopTime ymds=',yy,mm,dd,sec - call shr_sys_flush(iunit) - - !--- set orbital params - orb_iyear = 1990 - call shr_orb_params(orb_iyear, orb_eccen, orb_obliq, orb_mvelp, orb_obliqr, orb_lambm0, orb_mvelpp, .true.) - - !--- set case information - case_name = 'lilac_drv' - case_desc = 'lilac_drv with clm' - model_version = 'lilac_drv0.1' - hostname = 'undefined' - username = 'undefined' - start_type = 'startup' - brnch_retain_casename = .true. - single_column = .false. - scmlat = 0.0 - scmlon = 0.0 - atm_aero = .true. - call seq_infodata_putData(infodata, case_name=case_name, & - case_desc=case_desc, single_column=single_column, & - scmlat=scmlat, scmlon=scmlon, & - brnch_retain_casename=brnch_retain_casename, & - start_type=start_type, model_version=model_version, & - hostname=hostname, username=username, & - atm_aero=atm_aero ) - - !---------------------------------------------- - !--- lnd_init --- - !---------------------------------------------- - - write(iunit,*) subname,' calling lilac%init' - call shr_sys_flush(iunit) - - call create_fldlists(fldsFrCpl, fldsToCpl) - - - call lilac%init(EClock, x2a_state, a2x_state, rc=rc) - - !---------------------------------------------- - !--- atm and atm/lnd coupling init --- - !---------------------------------------------- - - !---------------------------------------------- - !--- Time Loop --- - !---------------------------------------------- - - call ESMF_ClockGet(Eclock, currTime=CurrTime, rc=rc) - do while (CurrTime < StopTime) - call ESMF_ClockAdvance(EClock, rc=rc) - call ESMF_ClockGet(EClock, currTime=CurrTime, rc=rc) - call ESMF_TimeGet(CurrTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) - write(iunit,'(1x,2a,4i6)') subname,' lilac_drv ymds=',yy,mm,dd,sec - call shr_sys_flush(iunit) - - ! can manually override the alarms as needed - call ESMF_AlarmRingerOff(EAlarm_rest, rc=rc) - if (mod(dd,5)==0 .and. sec==0) call ESMF_AlarmRingerOn(EAlarm_rest,rc) - - ! run lilac - write(iunit,*) subname,' call lilac%run',yy,mm,dd,sec - call lilac%run(EClock, x2a_state, a2x_state, rc=rc) - enddo - - !---------------------------------------------- - !--- lnd_final --- - !---------------------------------------------- - - write(iunit,*) subname,' calling lilac%final()' - call shr_sys_flush(iunit) - call lilac%final() - - !---------------------------------------------- - !--- Done --- - !---------------------------------------------- - - write(iunit,*) subname,' DONE' - call shr_sys_flush(iunit) - call MPI_Finalize(ierr) - -end program lilac_data_driver diff --git a/lilac/lilac_joe/esmf_utils.f90 b/lilac/lilac_joe/esmf_utils.f90 deleted file mode 100644 index 527d8081a1..0000000000 --- a/lilac/lilac_joe/esmf_utils.f90 +++ /dev/null @@ -1,224 +0,0 @@ -module esmf_utils - - ! Wrappers and derived types exposing ESMF components to LILAC - -#include "ESMF.h" - use ESMF - - implicit none - private - - character(*), parameter :: modname = "(esmf_utils)" - - interface - subroutine userRoutine(gridcomp, rc) - use ESMF_CompMod - implicit none - type(ESMF_GridComp) :: gridcomp ! must not be optional - integer, intent(out) :: rc ! must not be optional - end subroutine userRoutine - end interface - - interface - subroutine userCplRoutine(cplcomp, rc) - use ESMF_CompMod - implicit none - type(ESMF_CplComp) :: cplcomp ! must not be optional - integer, intent(out) :: rc ! must not be optional - end subroutine userCplRoutine - end interface - - ! Consider renaming ESMFInfoType (add lilac to name) - type, public :: ESMFInfoType - private - - type(ESMF_VM) :: vm - type(ESMF_State) :: land_import - type(ESMF_State) :: land_export - type(ESMF_State) :: atmos_import - type(ESMF_State) :: atmos_export - type(ESMF_GridComp) :: atmos_comp - type(ESMF_GridComp) :: land_comp - type(ESMF_CplComp) :: cpl_comp - - contains - procedure, public :: init => init - procedure, public :: run => run - procedure, public :: final => final - - end type ESMFInfoType - -contains - - subroutine start(self, rc) - implicit none - integer, intent(in) :: rc=ESMF_SUCCESS - - integer :: localPet, petCount - - character(len=*), parameter :: subname=trim(modname)//':(start) ' - - call ESMF_LogWrite(subname//"esmf_info%start()", ESMF_LOGMSG_INFO) - - ! Initialize framework and get back default global VM - - ! only run if not esmf_isintialized() - call ESMF_Initialize(vm=self%vm, defaultlogfilename="lilac.log", logkindflag=ESMF_LOGKIND_MULTI, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! Get number of PETs we are running with - call ESMF_VMGet(self%vm, petCount=petCount, localPet=localPet, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - end subroutine start - - subroutine init(self, atmos_register, land_register, cpl_register, rc) - implicit none - class(ESMFInfoType), intent(inout) :: self - procedure(userRoutine) :: atmos_register - procedure(userRoutine) :: land_register - procedure(userCplRoutine) :: cpl_register - integer, intent(in) :: rc=ESMF_SUCCESS - - ! Local variables - character(len=ESMF_MAXSTR) :: cname1, cname2, cplname - integer :: rc=ESMF_SUCCESS - - character(len=*), parameter :: subname=trim(modname)//':(init) ' - - call ESMF_LogWrite(subname//"esmf_info%init()", ESMF_LOGMSG_INFO) - - ! Create section - !------------------------------------------------------------------------- - ! Create the 2 model components and a coupler - cname1 = "land" - ! use petList to define land on all PET - self%land_comp = ESMF_GridCompCreate(name=cname1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Created "//trim(cname1)//" component", ESMF_LOGMSG_INFO) - - cname2 = "atmosphere" - ! use petList to define atmosphere on all PET - self%atmos_comp = ESMF_GridCompCreate(name=cname2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Created "//trim(cname2)//" component", ESMF_LOGMSG_INFO) - - cplname = "lilac coupler" - ! no petList means that coupler component runs on all PETs - self%cpl_comp = ESMF_CplCompCreate(name=cplname, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Created "//trim(cplname)//" component", ESMF_LOGMSG_INFO) - - call ESMF_LogWrite(subname//"Comp Creates finished", ESMF_LOGMSG_INFO) - - ! Register section - !------------------------------------------------------------------------- - call ESMF_GridCompSetServices(self%atmos_comp, userRoutine=atmos_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atmos SetServices finished", ESMF_LOGMSG_INFO) - - call ESMF_GridCompSetServices(self%land_comp, userRoutine=land_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"land SetServices finished", ESMF_LOGMSG_INFO) - - call ESMF_CplCompSetServices(self%cpl_comp, userRoutine=cpl_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Cpl SetServices finished", ESMF_LOGMSG_INFO) - - ! Init section - !------------------------------------------------------------------------- - ! land import/export states - self%land_import = ESMF_StateCreate(name="land import", stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - self%land_export = ESMF_StateCreate(name="land export", stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompInitialize(self%land_comp, importState=self%land_import, exportState=self%land_export, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Land Initialize finished", ESMF_LOGMSG_INFO) - - ! atmosphere import/export state - self%atmos_import = ESMF_StateCreate(name="atmos import", stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - self%atmos_export = ESMF_StateCreate(name="atmos export", stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompInitialize(self%atmos_comp, exportState=self%atmos_export, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Atmosphere Initialize finished", ESMF_LOGMSG_INFO) - - end subroutine init - - subroutine run(self, rc) - implicit none - class(ESMFInfoType), intent(inout) :: self - integer :: rc=ESMF_SUCCESS - character(len=*), parameter :: subname=trim(modname)//':(run) ' - - call ESMF_LogWrite(subname//"esmf_info%run()", ESMF_LOGMSG_INFO) - - ! atmosphere run - ! atmos_run phase 1: copy the atmos state and put it into atmos export - call ESMF_GridCompRun(self%atmos_comp, exportState=self%atmos_export, phase=1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Atmosphere Run returned", ESMF_LOGMSG_INFO) - - ! coupler run - call ESMF_CplCompRun(self%cpl_comp, importState=self%atmos_export, exportState=self%land_import, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Coupler Run returned", ESMF_LOGMSG_INFO) - - ! land run - call ESMF_GridCompRun(self%land_comp, importState=self%land_import, exportState=self%land_export, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Land Run returned", ESMF_LOGMSG_INFO) - - ! coupler run - call ESMF_CplCompRun(self%cpl_comp, importState=self%land_export, exportState=self%atmos_import, rc=rc) - call ESMF_LogWrite(subname//"Coupler Run returned", ESMF_LOGMSG_INFO) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! atmos run phase 2: copy the atmos state and put it into atmos export - call ESMF_GridCompRun(self%atmos_comp, importState=self%atmos_import, phase=2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Atmosphere Run returned", ESMF_LOGMSG_INFO) - - end subroutine run - - subroutine final(self, rc) - implicit none - class(ESMFInfoType), intent(inout) :: self - integer :: rc=ESMF_SUCCESS - character(len=*), parameter :: subname=trim(modname)//':(final) ' - - call ESMF_LogWrite(subname//"esmf_info%final()", ESMF_LOGMSG_INFO) - - ! Destroy section - call ESMF_GridCompDestroy(self%atmos_comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompDestroy(self%land_comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_CplCompDestroy(self%cpl_comp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_StateDestroy(self%land_export, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_StateDestroy(self%land_import, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_StateDestroy(self%atmos_export, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_StateDestroy(self%atmos_import, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_LogWrite(subname//"All Destroy routines done", ESMF_LOGMSG_INFO) - - end subroutine final - -end module esmf_utils diff --git a/lilac/lilac_joe/lilac_utils.f90 b/lilac/lilac_joe/lilac_utils.f90 deleted file mode 100644 index be5d0df6db..0000000000 --- a/lilac/lilac_joe/lilac_utils.f90 +++ /dev/null @@ -1,121 +0,0 @@ -module lilac_utils - - integer, parameter :: fldsMax = 100 - - - type fld_list_type - character(len=128) :: stdname - real*8 :: default_value - character(len=128) :: units - end type fld_list_type - - subroutine fldlist_add(num, fldlist, stdname, default_value, units) - integer intent(inout) :: num - type(fld_list_type) intent(inout) :: fldlist(:) - character(len=*) intent(in) :: stdname - real, optional intent(in) :: default_value - character(len=*), optional intent(in) :: units - - ! local variables - integer :: rc - character(len=*), parameter :: subname='(fldlist_add)' - !------------------------------------------------------------------------------- - - ! Set up a list of field information - num = num + 1 - if (num > fldsMax) then - call ESMF_LogWrite(trim(subname)//": ERROR num > fldsMax "//trim(stdname), ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__, rc=rc) return - endif - fldlist(num)%stdname = trim(stdname) - if(present(default_value)) then - fldlist(num)%default_value = default_value - else - fldlist(num)%default_value = 0. - end if - if(present(units)) then - fldlist(num)%units = trim(units) - else - fldlist(num)%units = "" - end if - - end subroutine fldlist_add - - subroutine create_fldlists(fldsFrCpl, fldsToCpl, fldsToCpl_num, fldsFrCpl_num) - type(fld_list_type) intent(inout) :: fldsFrCpl(:) - type(fld_list_type) intent(inout) :: fldsToCpl(:) - integer, intent(out) :: fldsToCpl_num = 0 - integer, intent(out) :: fldsFrCpl_num = 0 - - ! import fields - ! call fldlist_add(fldsFrCpl_num, fldsFrCpl, trim(flds_scalar_name)) - - integer :: fldsFrCpl_num, fldsToCpl_num - - ! land states - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_lfrin' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_t' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_tref' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_qref' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_avsdr' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_anidr' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_avsdf' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_anidf' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_snowh' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_u10' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_fv' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_ram1' ) - - ! fluxes to atm - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_taux' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_tauy' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_lat' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_sen' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_lwup' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_evap' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_swnet' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_flxdst1' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_flxdst2' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_flxdst3' ) - call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_flxdst4' ) - - ! call fldlist_add(fldsToCpl_num, fldsToCpl, trim(flds_scalar_name)) - - ! from atm - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_z', default_value=30.0, units='m') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_topo') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_u', default_value=0.0, units='m/s') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_v', default_value=0.0, units='m/s') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_ptem', default_value=280.0, 'degK') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_pbot', default_value=100100.0, units='Pa') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_tbot', default_value=280.0, units='degK') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_shum', default_value=0.0004, units='kg/kg') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_methane' ) - - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_lwdn', default_value=200.0, units='W/m2') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_rainc', default_value=4.0e-8, units='kg/m2s') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_rainl', default_value=3.0e-8, units='kg/m2s') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_snowc', default_value=1.0e-8, units='kg/m2s') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_snowl', default_value=2.0e-8, units='kg/m2s') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_swndr', default_value=100.0, units='W/m2') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_swvdr', default_value=90.0, units='W/m2') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_swndf', default_value=20.0, units='W/m2') - call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_swvdf', default_value=40.0, units='W/m2') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphidry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphodry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphiwet') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_ocphidry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_ocphodry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_ocphiwet') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstdry1' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstdry2' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstdry3' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstdry4' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstwet1' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstwet2' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstwet3' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstwet4' ) - - ! more: https://github.com/mvertens/ctsm/blob/ae02ffe25dbc4a85c769c9137b5b3d50f2843e89/src/cpl/nuopc/lnd_import_export.F90#L131 - end subroutine create_fldlists - -end module lilac_utils From bd5d0f45616a4211e1498e7cdfca7c0c945cf914 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 29 Aug 2019 15:28:09 -0600 Subject: [PATCH 0387/1973] Some clean ups for the PR --- lilac/CMakeLists.txt | 142 ++++++++++++++++++++++++++++-------- lilac/lilac/Makefile | 2 +- lilac/lilac/atmos_cap.F90 | 123 +++++++++++++------------------ lilac/lilac/demo_driver.F90 | 3 +- 4 files changed, 165 insertions(+), 105 deletions(-) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 864aa7a0a7..7d45799a7d 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -1,41 +1,136 @@ cmake_minimum_required(VERSION 2.8.12.1) +##include("/glade/work/negins/UFSCOMP/cime/tools/Macros.cmake") - -### ********** ### set (CIME_ROOT "/glade/work/negins/UFSCOMP/cime") message ("CIME_ROOT: ${CIME_ROOT}") + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") +message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") + + set (CIME_CMAKE_MODULE_DIRECTORY "/glade/work/negins/UFSCOMP/cime/src/CMake/") message ("CIME_CMAKE_MODULE_DIRECTORY: ${CIME_CMAKE_MODULE_DIRECTORY}") + list(APPEND CMAKE_MODULE_PATH ${CIME_CMAKE_MODULE_DIRECTORY}) +message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") + +set (MACRO_ROOT "/glade/work/negins/UFSCOMP/cime/tools/") +include(${MACRO_ROOT}/Macros.cmake) + +list(APPEND CMAKE_MODULE_PATH ${MACRO_ROOT}) message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") -include(CIME_initial_setup) -message("----------------------------------------------------") +set (CLM_ROOT "/glade/work/negins/UFSCOMP/components/clm") + +message("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") + +include_directories (${CMAKE_SOURCE_DIR}/cmake/CMakeModules/) +include (${CMAKE_SOURCE_DIR}/cmake/CMakeModules/genf90_utils.cmake) +include (${CMAKE_SOURCE_DIR}/cmake/CMakeModules/Sourcelist_utils.cmake) +include (${CMAKE_SOURCE_DIR}/cmake/CMakeModules/pFUnit_utils.cmake) +include (${CMAKE_SOURCE_DIR}/cmake/CMakeModules/FindpFUnit.cmake) + + +#include (Macros.cmake) +#include(CIME_initial_setup) + +message("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") + +### ------------------------------------------------------------- + +# project name project(LILAC Fortran C) enable_language(Fortran) + +# This definition is needed to avoid having ESMF depend on mpi +add_definitions(-DHIDE_MPI) + + +message("----------------------------------------------------") +message ("CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") +message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") +message("----------------------------------------------------") + + + +message("----------------------------------------------------") +# Add source directories from other share code (csm_share, etc.). This should be +# done first, so that in case of name collisions, the CLM versions take +# precedence (when there are two files with the same name, the one added later +# wins). +add_subdirectory(${CIME_ROOT}/src/share/util csm_share) +add_subdirectory(${CIME_ROOT}/src/share/unit_test_stubs/util csm_share_stubs) +add_subdirectory(${CIME_ROOT}/src/share/esmf_wrf_timemgr esmf_wrf_timemgr) +add_subdirectory(${CIME_ROOT}/src/drivers/mct/shr drv_share) +message("----------------------------------------------------") + +# Extract just the files we need from drv_share +set (drv_sources_needed_base + glc_elevclass_mod.F90 + ) +extract_sources("${drv_sources_needed_base}" "${drv_sources}" drv_sources_needed) + +message("~~~~~~~~~~~~~~~~~~~~~~CLM_ROOT~~~~~~~~~~~~~~~~~~~~~~") +# Add CLM source directories (these add their own test directories) +add_subdirectory(${CLM_ROOT}/src/utils clm_utils) +add_subdirectory(${CLM_ROOT}/src/biogeochem clm_biogeochem) +add_subdirectory(${CLM_ROOT}/src/soilbiogeochem clm_soilbiogeochem) +add_subdirectory(${CLM_ROOT}/src/biogeophys clm_biogeophys) +add_subdirectory(${CLM_ROOT}/src/dyn_subgrid clm_dyn_subgrid) +add_subdirectory(${CLM_ROOT}/src/main clm_main) +add_subdirectory(${CLM_ROOT}/src/init_interp clm_init_interp) +add_subdirectory(${CLM_ROOT}/src/fates/main fates_main) + +# Add general unit test directories (stubbed out files, etc.) +add_subdirectory(unit_test_stubs) +add_subdirectory(unit_test_shr) + + +# Remove shr_mpi_mod from share_sources. +# This is needed because we want to use the mock shr_mpi_mod in place of the real one +# +# TODO: this should be moved into a general-purpose function in Sourcelist_utils. +# Then this block of code could be replaced with a single call, like: +# remove_source_file(${share_sources} "shr_mpi_mod.F90")} + +foreach (sourcefile ${share_sources}) + string(REGEX MATCH "shr_mpi_mod.F90" match_found ${sourcefile}) + if(match_found) + list(REMOVE_ITEM share_sources ${sourcefile}) + endif() +endforeach() + + # We rely on pio for cmake utilities like findnetcdf.cmake, so that we don't # need to duplicate this cmake code message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") -list(APPEND CMAKE_MODULE_PATH "${CIME_ROOT}/src/externals/pio2/cmake") +list (APPEND CMAKE_MODULE_PATH "${CIME_ROOT}/src/externals/pio2/cmake") message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") -message("----------------------------------------------------") -list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/CMakeModules") -message ("CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") -message ("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") +add_subdirectory (${CIME_ROOT}/src/externals/pio2/test) + +message("----------------------------------------------------") +option(ENABLE_PFUNIT "Enable pfUnit testing Framework" ON) +if (ENABLE_PFUNIT) + find_package(pfUnit) + include(pfUnit_utils) + include_directories("${PFUNIT_INCLUDE_DIRS}") +endif (ENABLE_PFUNIT) message("----------------------------------------------------") + find_package(MPI REQUIRED) # TODO: This should be found from the find_package call but its not working #set(CMAKE_Fortran_COMPILER "/usr/lib64/mpich/bin/mpif90") find_package(ESMF REQUIRED) +message("------------include (CIME_utils)--------------------") include(CIME_utils) message("----------------------------------------------------") @@ -51,23 +146,7 @@ message("----------------------------------------------------") #add_subdirectory(${CESM_ROOT}/models/csm_share/shr csm_share) #add_subdirectory(${CSM_SHR} ) -#==============### -set(SHARE_ROOT "${CIME_ROOT}/src/share") -#add_subdirectory(${CIME_ROOT}/src/share/util csm_share) -#add_subdirectory(${CIME_ROOT}/src/share/unit_test_stubs/util csm_share_stubs) -#add_subdirectory(${CIME_ROOT}/src/share/esmf_wrf_timemgr esmf_wrf_timemgr) -#add_subdirectory(${CIME_ROOT}/src/drivers/mct/shr drv_share) -#message("----------------------------------------------------") - - -add_subdirectory(${SHARE_ROOT}/util csm_share) -add_subdirectory(${SHARE_ROOT}/unit_test_stubs/util csm_share_stubs) -include_directories(${SHARE_ROOT}/include) - -# esmf_wrf_timemgr not built here because it depends on csm_share. -#add_subdirectory(${SHARE_ROOT}/esmf_wrf_timemgr esmf_wrf_timemgr) -#include_directories(${SHARE_ROOT}/esmf_wrf_timemgr) - +message("----------------------------------------------------") @@ -87,6 +166,7 @@ SET(NAMES libclm.a) #message(STATUS "include_directories: ${LIB_TO_INCLUDE}") #target_link_libraries (${LIB_TO_INCLUDE}) + # Local CMake modules if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") @@ -107,10 +187,11 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") + # TODO: This should not be necessary but certain header files are missing from the build #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include -I/usr/src/lilac/external/esmf/build_config/Linux.gfortran.default -I /usr/src/lilac/external/esmf/src/include") #set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I /usr/src/esmf/src/include") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/include -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib -lclm -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib ") +#set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/include -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib -lclm -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib ") message(STATUS "==============================================================") @@ -125,14 +206,15 @@ message(STATUS "==============================================================") # # Compile. # -file(GLOB_RECURSE sources lilac/*.F90) +file(GLOB_RECURSE SOURCES lilac/*.F90) +#add_subdirectory(lilac) #add_executable(${PROJECT_NAME}.exe ../lilac/demo_driver.F90 # ../lilac/lilac_mod.F90 ../lilac/atmos_cap.F90 ../lilac/lilac_utils.F90 # ../lilac/lnd_cap.F90 ../lilac/cpl_mod.F90) -add_executable(${PROJECT_NAME}.exe ${sources}) +add_executable (${PROJECT_NAME}.exe ${SOURCES}) target_link_libraries(${PROJECT_NAME}.exe ${LIB_TO_INCLUDE}) -#emo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o +#demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o #add_subdirectory(lilac) #add_subdirectory(tests) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index 3cc63fd44e..6c377917b7 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -40,7 +40,7 @@ TRACEBACK_FLAGS = -g -traceback -debug all -check all # ----------------------------------------------------------------------------- #EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/pio/pio2 EXTRA_LIBS = -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib -MORE_LIBSi = -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ +MORE_LIBS = -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/clm/obj/ -I//glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/csm_share/ # ----------------------------------------------------------------------------- diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index 1d1792a9cd..e295ad2718 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -2,39 +2,29 @@ module atmos_cap !----------------------------------------------------------------------- ! !DESCRIPTION: + ! This is a dummy atmosphere cap for setting up lilac structure. ! !USES use ESMF - use lilac_utils, only : fld_list_type - use spmdMod , only : masterproc + use lilac_utils , only : fld_list_type + use spmdMod , only : masterproc implicit none include 'mpif.h' - character(*), parameter :: modname = "atmos_cap" - - !!integer, parameter :: fldsMax = 100 - - type(ESMF_Field), public, save :: field - - type(fld_list_type), public, allocatable :: c2a_fldlist(:) - type(fld_list_type), public, allocatable :: a2c_fldlist(:) - - !type (fld_list_type) :: a2c_fldlist(fldsMax) - !type (fld_list_type) :: c2a_fldlist(fldsMax) - - integer :: a2c_fldlist_num - integer :: c2a_fldlist_num - !private - - public :: atmos_register + character(*), parameter :: modname = "atmos_cap" + !!integer, parameter :: fldsMax = 100 + type(ESMF_Field), public , save :: field + type(fld_list_type), public , allocatable :: c2a_fldlist(:) + type(fld_list_type), public , allocatable :: a2c_fldlist(:) + integer :: a2c_fldlist_num + integer :: c2a_fldlist_num + public :: atmos_register !real(kind=ESMF_KIND_R8), dimension(:), public, pointer, save :: fldptr - - - integer :: mpierror, numprocs - integer :: i, myid - integer status(MPI_STATUS_SIZE) - + integer :: mpierror, numprocs + integer :: i, myid + integer status(MPI_STATUS_SIZE) ! Status of message + integer, parameter :: debug = 0 ! internal debug leve !======================================================================== contains @@ -46,9 +36,13 @@ subroutine atmos_register (comp, rc) integer, intent(out) :: rc character(len=*), parameter :: subname=trim(modname)//':(atmos_register) ' + !------------------------------------------------------------------------- + print *, "in user register routine" + ! Initialize return code rc = ESMF_SUCCESS + ! Set the entry points for standard ESMF Component methods call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=atmos_init, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -64,6 +58,7 @@ end subroutine atmos_register subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) + type (ESMF_GridComp) :: comp type (ESMF_State) :: lnd2atm_a_state, atm2lnd_a_state type (ESMF_Clock) :: clock @@ -81,6 +76,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) logical :: mesh_switch character(len=*), parameter :: subname=trim(modname)//': [atmos_init] ' !integer :: regDecomp(:,:) + !------------------------------------------------------------------------- ! Initialize return code rc = ESMF_SUCCESS @@ -99,6 +95,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) if(mesh_switch) then + ! TODO: hard-coded mesh file name shoulb be corrected. ! For now this is our dummy mesh: !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' !! Negin: This did not work.... atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc' @@ -109,6 +106,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) print *, "!Mesh for atmosphere is created!" else + !TODO: Fix how you want to create the grid here if mesh_switch is off !atmos_grid= ESMF_GridCreateNoPeriDimUfrmR( maxIndex=(/180,360 /), & ! minCornerCoord=(/0._ESMF_KIND_R8, 0._ESMF_KIND_R8/), & ! maxCornerCoord=(/180._ESMF_KIND_R8, 360._ESMF_KIND_R8/), & @@ -125,7 +123,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) endif !------------------------------------------------------------------------- - ! Atmosphere to Coupler (land) Fields -- a2l + ! Atmosphere to Coupler (land) Fields -- atmos --> land ! I- Create empty field bundle -- a2c_fb ! II- Create Fields and add them to field bundle ! III - Add a2c_fb to state (atm2lnd_a_state) @@ -134,9 +132,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) a2c_fb = ESMF_FieldBundleCreate(name="a2c_fb", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! Create individual fields and add to field bundle -- a2l + ! Create individual fields and add to field bundle -- a2c - !call fldlist_add(a2c_fldlist_num, a2c_fldlist, 'dum_var2' ) a2c_fldlist_num = 17 do n = 1,a2c_fldlist_num @@ -150,15 +147,16 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) !call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8), rc=rc) !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (myid == 0) then - print *, 'Here we are printing field!' - print *, "**********************************************************" - print *, "creating field for a2l:" + if (myid == 0 .and debug > 0) then + print *, "***************************************************" + print *, "Here we are printing field!" + print *, "creating field for a2c:" print *, trim(a2c_fldlist(n)%stdname) print *, a2c_fldlist(n)%farrayptr1d call ESMF_FieldPrint(field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if + end if + !call ESMF_LogWrite(subname//"fieldget!", ESMF_LOGMSG_INFO) !call ESMF_FieldGet(field, rc=rc) !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -167,83 +165,64 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) call ESMF_FieldBundleAdd(a2c_fb, (/field/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + enddo - !call ESMF_StateAdd(atm2lnd_a_state, (/field/) , rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - !print *, a2c_fldlist(n)%farrayptr1d - !print *, "this field is created" - enddo call ESMF_LogWrite(subname//"fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) - print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" ! Add field bundle to state call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - + call ESMF_LogWrite(subname//"atm2lnd_a_state is filled with dummy_var field bundle!", ESMF_LOGMSG_INFO) print *, "!atm2lnd_a_state is filld with dummy_var field bundle!" !------------------------------------------------------------------------- - ! Coupler (land) to Atmosphere Fields -- l2a - ! I- Create Field Bundle -- c2a_fb for now - ! II- Create Fields and add them to field bundle + ! Coupler (land) to Atmosphere Fields -- c2a + ! I- Create Field Bundle -- c2a_fb for because we are in atmos + ! II- Create Fields and add them to field bundle ! III - Add c2a_fb to state (lnd2atm_a_state) !------------------------------------------------------------------------- c2a_fb = ESMF_FieldBundleCreate (name="c2a_fb", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! Create individual fields and add to field bundle -- l2a + ! Create individual fields and add to field bundle -- c2a c2a_fldlist_num = 12 do n = 1,c2a_fldlist_num - !print *, "**********************************************************" - !print *, "creating field for l2a:" - !print *, trim(c2a_fldlist(n)%stdname) - ! create field - !!! Here we want to pass pointers if (mesh_switch) then field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2a_fldlist(n)%stdname), rc=rc) !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr1d, rc=rc) - !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) - !call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8)*5.5, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - else field = ESMF_FieldCreate(atmos_grid, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr2d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out end if - call ESMF_LogWrite(subname//"line 208 and going.... .... !", ESMF_LOGMSG_INFO) - ! add field to field bundle - call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) - - if (myid == 0) then - print *, "creating field for c2a:" - print *, n - print *, trim(c2a_fldlist(n)%stdname) - print *, c2a_fldlist(n)%farrayptr1d - !call ESMF_FieldPrint(field, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if + ! add field to field bundle + call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + if (myid == 0 .and debug > 0) then + print *, "creating field for c2a:" + print *, n + print *, trim(c2a_fldlist(n)%stdname) + print *, c2a_fldlist(n)%farrayptr1d + call ESMF_FieldPrint(field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + end if enddo - !print *, "!Fields For Coupler (c2a_fldlist) Field Bundle Created!" + call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) ! Add field bundle to state call ESMF_StateAdd(lnd2atm_a_state, (/c2a_fb/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !print *, "!lnd2atm_a_state is filld with dummy_var field bundle!" ! Set Attributes needed by land call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) @@ -261,7 +240,7 @@ subroutine atmos_run(comp, importState, exportState, clock, rc) ! Initialize return code rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//"SHOULD ATMOS_RUN DO ANYTHING REALLY?? ", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"Should atmos_run ", ESMF_LOGMSG_INFO) end subroutine atmos_run subroutine atmos_final(comp, importState, exportState, clock, rc) diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index 66914b37c0..a0af468dda 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -49,7 +49,6 @@ program demo_lilac_driver ! real atmosphere: begc = 1 - !endc = 10 endc = 6912/4 !endc = 13824 !endc = 13968 @@ -70,7 +69,7 @@ program demo_lilac_driver allocate ( rand1 (begc:endc) ) ; call random_number (rand1) allocate ( rand2 (begc:endc) ) ; call random_number (rand2) - !allocating these values of default for now! + !allocating these values from atmosphere for now! allocate ( atm2lnd%Sa_z (begc:endc) ) ; atm2lnd%Sa_z (:) = 30.0 allocate ( atm2lnd%Sa_topo (begc:endc) ) ; atm2lnd%Sa_topo (:) = 10.0 allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 20.0 From 8b81aa6d2e9dc82eed29c907bd6a0724b85b190d Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 30 Aug 2019 12:21:00 -0600 Subject: [PATCH 0388/1973] typo fixed --- lilac/lilac/atmos_cap.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index e295ad2718..55228da5d8 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -147,7 +147,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) !call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8), rc=rc) !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (myid == 0 .and debug > 0) then + if (myid == 0 .and. debug > 0) then print *, "***************************************************" print *, "Here we are printing field!" print *, "creating field for a2c:" @@ -208,7 +208,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (myid == 0 .and debug > 0) then + if (myid == 0 .and. debug > 0) then print *, "creating field for c2a:" print *, n print *, trim(c2a_fldlist(n)%stdname) From 5ef06759de0632ca6f70cdcddc92ad0cc473f439 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 4 Sep 2019 16:26:33 -0600 Subject: [PATCH 0389/1973] First step in allowing for nlevgrnd to be less than nlevurb. Changes are to: src/biogeophys/SoilFluxesMod.F90 src/biogeophys/SoilTemperatureMod.F90 src/main/clm_driver.F90 Code passes as bfb with ctsm1.0.dev035 for this test: ERP_Ld3.f09_g17.I1850Clm50BgcCropCru.cheyenne_intel.clm-ciso --- src/biogeophys/SoilFluxesMod.F90 | 27 +- src/biogeophys/SoilTemperatureMod.F90 | 503 ++++++++++++++++++++++---- src/main/clm_driver.F90 | 3 + 3 files changed, 466 insertions(+), 67 deletions(-) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index 2a22ffa891..d319873c8c 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -377,8 +377,13 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & p = filter_nolakep(fp) c = patch%column(p) - if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then +! Do this for perv and imperv road for -nlevsno+1,nlevgrnd +!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & +!KO .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then +!KO + if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & + .and. col%itype(c) /= icol_roof) then +!KO ! area weight heat absorbed by snow layers if (j >= col%snl(c)+1 .and. j < 1) errsoi_patch(p) = errsoi_patch(p) & - frac_sno_eff(c)*(t_soisno(c,j)-tssbef(c,j))/fact(c,j) @@ -387,6 +392,24 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & end if end do end do +!KO +! Do this for sunwall, shadewall, roof but for -nlevsno+1,nlevurb + do j = -nlevsno+1,nlevurb + do fp = 1,num_urbanp + p = filter_urbanp(fp) + c = patch%column(p) + + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) then + ! area weight heat absorbed by snow layers + if (j >= col%snl(c)+1 .and. j < 1) errsoi_patch(p) = errsoi_patch(p) & + - frac_sno_eff(c)*(t_soisno(c,j)-tssbef(c,j))/fact(c,j) + if (j >= 1) errsoi_patch(p) = errsoi_patch(p) & + - (t_soisno(c,j)-tssbef(c,j))/fact(c,j) + end if + end do + end do +!KO call t_stopf('bgp2_loop_3') call t_startf('bgp2_loop_4') diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 6e28ff1e5f..b570ac288a 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -118,7 +118,10 @@ module SoilTemperatureMod contains !----------------------------------------------------------------------- - subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_nolakec, filter_nolakec, & +!KO subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_nolakec, filter_nolakec, & +!KO + subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter_urbanc, num_nolakec, filter_nolakec, & +!KO atm2lnd_inst, urbanparams_inst, canopystate_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst,& solarabs_inst, soilstate_inst, energyflux_inst, temperature_inst, urbantv_inst) ! @@ -158,6 +161,10 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_nolakec, filte integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points integer , intent(in) :: num_urbanl ! number of urban landunits in clump integer , intent(in) :: filter_urbanl(:) ! urban landunit filter +!KO + integer , intent(in) :: num_urbanc ! number of urban columns in clump + integer , intent(in) :: filter_urbanc(:) ! urban column filter +!KO type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(urbanparams_type) , intent(in) :: urbanparams_inst type(urbantv_type) , intent(in) :: urbantv_inst @@ -430,12 +437,66 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_nolakec, filte ! Melting or Freezing +! Do this for perv and imperv road for -nlevsno+1,nlevgrnd do j = -nlevsno+1,nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) +!KO l = col%landunit(c) +!KO if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & +!KO .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then +!KO +!KO if (j >= snl(c)+1) then +!KO if (j <= nlevurb-1) then +!KO fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) +!KO else if (j == nlevurb) then +!KO ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across +!KO if ( IsSimpleBuildTemp() )then +!KO ! the bottom "soil" layer and the equations are derived assuming a prescribed internal +!KO ! building temperature. (See Oleson urban notes of 6/18/03). +!KO ! Note new formulation for fn, this will be used below in net energey flux computations +!KO fn1(c,j) = tk(c,j) * (t_building(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) +!KO fn(c,j) = tk(c,j) * (t_building(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) + +!KO else +!KO ! the bottom "soil" layer and the equations are derived assuming a prognostic inner +!KO ! surface temperature. +!KO if (ctype(c) == icol_sunwall) then +!KO fn1(c,j) = tk(c,j) * (t_sunw_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) +!KO fn(c,j) = tk(c,j) * (t_sunw_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) +!KO else if (ctype(c) == icol_shadewall) then +!KO fn1(c,j) = tk(c,j) * (t_shdw_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) +!KO fn(c,j) = tk(c,j) * (t_shdw_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) +!KO else if (ctype(c) == icol_roof) then +!KO fn1(c,j) = tk(c,j) * (t_roof_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) +!KO fn(c,j) = tk(c,j) * (t_roof_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) +!KO end if +!KO end if +!KO end if +!KO end if +!KO else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & +!KO + if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & +!KO + .and. col%itype(c) /= icol_roof) then + if (j >= snl(c)+1) then + if (j <= nlevgrnd-1) then + fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) + else if (j == nlevgrnd) then + fn1(c,j) = 0._r8 + end if + end if + end if + end do + end do + +!KO +! Do this for sunwall, shadewall, roof but for -nlevsno+1,nlevurb + do j = -nlevsno+1,nlevurb + do fc = 1,num_urbanc + c = filter_urbanc(fc) l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) then if (j >= snl(c)+1) then if (j <= nlevurb-1) then fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) @@ -464,18 +525,10 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_nolakec, filte end if end if end if - else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= snl(c)+1) then - if (j <= nlevgrnd-1) then - fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j == nlevgrnd) then - fn1(c,j) = 0._r8 - end if - end if end if end do end do +!KO do fc = 1,num_nolakec c = filter_nolakec(fc) @@ -665,9 +718,9 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ) ! Thermal conductivity of soil from Farouki (1981) - ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) - ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., - ! 41, 1011-1026. +!KO ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) +!KO ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., +!KO ! 41, 1011-1026. do j = -nlevsno+1,nlevgrnd do fc = 1, num_nolakec @@ -676,15 +729,23 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! Only examine levels from 1->nlevgrnd if (j >= 1) then l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then - thk(c,j) = tk_wall(l,j) - else if (col%itype(c) == icol_roof .and. j <= nlevurb) then - thk(c,j) = tk_roof(l,j) - else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then - thk(c,j) = tk_improad(l,j) - else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & - .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & - col%itype(c) /= icol_roof) then +!KO if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then +!KO thk(c,j) = tk_wall(l,j) +!KO else if (col%itype(c) == icol_roof .and. j <= nlevurb) then +!KO thk(c,j) = tk_roof(l,j) +!KO else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then +!KO thk(c,j) = tk_improad(l,j) +!KO else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & +!KO +!KO .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & +!KO col%itype(c) /= icol_roof) then +!KO + !KO This will include pervious road for all nlevgrnd layers and impervious road for j > nlev_improad +!KO + if ((lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec & + .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & + col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) .or. & + (col%itype(c) == icol_road_imperv .and. j > nlev_improad(l))) then satw = (h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice)/(dz(c,j)*watsat(c,j)) satw = min(1._r8, satw) @@ -725,13 +786,62 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & end do end do + do j = 1,nlevurb + do fc = 1, num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then + thk(c,j) = tk_wall(l,j) + else if (col%itype(c) == icol_roof) then + thk(c,j) = tk_roof(l,j) + else if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then + thk(c,j) = tk_improad(l,j) + end if + + end do + end do +!KO + ! Thermal conductivity at the layer interface do j = -nlevsno+1,nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) +!KO if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & +!KO .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then +!KO if (j >= snl(c)+1 .AND. j <= nlevurb-1) then +!KO tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & +!KO /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) +!KO else if (j == nlevurb) then + +!KO ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across +!KO ! the bottom "soil" layer and the equations are derived assuming a prescribed internal +!KO ! building temperature. (See Oleson urban notes of 6/18/03). +!KO tk(c,j) = thk(c,j) +!KO end if +!KO else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & +!KO .and. col%itype(c) /= icol_roof) then +!KO + if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & + .and. col%itype(c) /= icol_roof) then +!KO + if (j >= snl(c)+1 .AND. j <= nlevgrnd-1) then + tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & + /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) + else if (j == nlevgrnd) then + tk(c,j) = 0._r8 + end if + end if + end do + end do + +!KO + do j = -nlevsno+1,nlevurb + do fc = 1,num_nolakec + c = filter_nolakec(fc) if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then + .or. col%itype(c) == icol_roof)) then if (j >= snl(c)+1 .AND. j <= nlevurb-1) then tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) @@ -742,17 +852,10 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! building temperature. (See Oleson urban notes of 6/18/03). tk(c,j) = thk(c,j) end if - else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= snl(c)+1 .AND. j <= nlevgrnd-1) then - tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & - /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) - else if (j == nlevgrnd) then - tk(c,j) = 0._r8 - end if end if end do end do +!KO ! calculate thermal conductivity of h2osfc do fc = 1, num_nolakec @@ -763,23 +866,27 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & enddo ! Soil heat capacity, from de Vires (1963) - ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) - ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., - ! 41, 1011-1026. +!KO ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) +!KO ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., +!KO ! 41, 1011-1026. do j = 1, nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then - cv(c,j) = cv_wall(l,j) * dz(c,j) - else if (col%itype(c) == icol_roof .and. j <= nlevurb) then - cv(c,j) = cv_roof(l,j) * dz(c,j) - else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then - cv(c,j) = cv_improad(l,j) * dz(c,j) - else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & - .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & - col%itype(c) /= icol_roof) then +! if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then +! cv(c,j) = cv_wall(l,j) * dz(c,j) +! else if (col%itype(c) == icol_roof .and. j <= nlevurb) then +! cv(c,j) = cv_roof(l,j) * dz(c,j) +! else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then +! cv(c,j) = cv_improad(l,j) * dz(c,j) +! else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & +! .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & +! col%itype(c) /= icol_roof) then + if ((lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec & + .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & + col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) .or. & + (col%itype(c) == icol_road_imperv .and. j > nlev_improad(l))) then cv(c,j) = csol(c,j)*(1-watsat(c,j))*dz(c,j) + (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) if (j > nbedrock(c)) cv(c,j) = csol_bedrock*dz(c,j) else if (lun%itype(l) == istwet) then @@ -788,7 +895,8 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & else if (lun%itype(l) == istice_mec) then cv(c,j) = (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) endif - if (j == 1) then + if (j == 1 .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & + col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) then if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8) then cv(c,j) = cv(c,j) + cpice*h2osno(c) end if @@ -796,6 +904,29 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & enddo end do +!KO + do j = 1, nlevurb + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then + cv(c,j) = cv_wall(l,j) * dz(c,j) + else if (col%itype(c) == icol_roof) then + cv(c,j) = cv_roof(l,j) * dz(c,j) + else if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then + cv(c,j) = cv_improad(l,j) * dz(c,j) + endif + if (j == 1 .and. (col%itype(c) == icol_sunwall .or. & + col%itype(c) == icol_shadewall .or. col%itype(c) == icol_roof .or. & + col%itype(c) == icol_road_imperv)) then + if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8) then + cv(c,j) = cv(c,j) + cpice*h2osno(c) + end if + end if + end do + end do +!KO + ! Snow heat capacity do j = -nlevsno+1,0 @@ -1195,8 +1326,12 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & l = col%landunit(c) supercool(c,j) = 0.0_r8 ! add in urban condition if-block +!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & +!KO .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then +!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then + .and. col%itype(c) /= icol_roof)) then +!KO @@ -1239,13 +1374,56 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end do enddo +!KO + do j = 1,nlevurb + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + + if (col%itype(c) == icol_roof) then + + if (h2osoi_ice(c,j) > 0. .AND. t_soisno(c,j) > tfrz) then + imelt(c,j) = 1 + ! tinc(c,j) = t_soisno(c,j) - tfrz + tinc(c,j) = tfrz - t_soisno(c,j) + t_soisno(c,j) = tfrz + endif + + supercool(c,j) = 0.0_r8 + + if (h2osoi_liq(c,j) > supercool(c,j) .AND. t_soisno(c,j) < tfrz) then + imelt(c,j) = 2 + ! tinc(c,j) = t_soisno(c,j) - tfrz + tinc(c,j) = tfrz - t_soisno(c,j) + t_soisno(c,j) = tfrz + endif + + ! If snow exists, but its thickness is less than the critical value (0.01 m) + if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8 .AND. j == 1) then + if (t_soisno(c,j) > tfrz) then + imelt(c,j) = 1 + ! tincc,j) = t_soisno(c,j) - tfrz + tinc(c,j) = tfrz - t_soisno(c,j) + t_soisno(c,j) = tfrz + endif + endif + + endif + + end do + enddo +!KO do j = -nlevsno+1,nlevgrnd ! all layers do fc = 1,num_nolakec c = filter_nolakec(fc) +!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & +!KO .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then +!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then + .and. col%itype(c) /= icol_roof)) then +!KO if (j >= snl(c)+1) then @@ -1392,6 +1570,159 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end do ! end of column-loop enddo ! end of level-loop +!KO + do j = -nlevsno+1,nlevurb + do fc = 1,num_nolakec + c = filter_nolakec(fc) + + if (col%itype(c) == icol_roof) then + + if (j >= snl(c)+1) then + + ! Calculate the energy surplus and loss for melting and freezing + if (imelt(c,j) > 0) then + + ! added unique cases for this calculation, + ! to account for absorbed solar radiation in each layer + + !================================================================== + if (j == snl(c)+1) then ! top layer + if(j > 0) then + hm(c,j) = dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j) + else + hm(c,j) = frac_sno_eff(c)*(dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j)) + endif + + if ( j==1 .and. frac_h2osfc(c) /= 0.0_r8 ) then + hm(c,j) = hm(c,j) - frac_h2osfc(c)*(dhsdT(c)*tinc(c,j)) + end if + else if (j == 1) then + hm(c,j) = (1.0_r8 - frac_sno_eff(c) - frac_h2osfc(c)) & + *dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j) + else ! non-interfacial snow/soil layers + if(j < 1) then + hm(c,j) = - frac_sno_eff(c)*(tinc(c,j)/fact(c,j)) + else + hm(c,j) = - tinc(c,j)/fact(c,j) + endif + endif + endif + + ! These two errors were checked carefully (Y. Dai). They result from the + ! computed error of "Tridiagonal-Matrix" in subroutine "thermal". + if (imelt(c,j) == 1 .AND. hm(c,j) < 0._r8) then + hm(c,j) = 0._r8 + imelt(c,j) = 0 + endif + if (imelt(c,j) == 2 .AND. hm(c,j) > 0._r8) then + hm(c,j) = 0._r8 + imelt(c,j) = 0 + endif + + ! The rate of melting and freezing + + if (imelt(c,j) > 0 .and. abs(hm(c,j)) > 0._r8) then + xm(c,j) = hm(c,j)*dtime/hfus ! kg/m2 + + ! If snow exists, but its thickness is less than the critical value + ! (1 cm). Note: more work is needed to determine how to tune the + ! snow depth for this case + if (j == 1) then + if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8 .AND. xm(c,j) > 0._r8) then + temp1 = h2osno(c) ! kg/m2 + h2osno(c) = max(0._r8,temp1-xm(c,j)) + propor = h2osno(c)/temp1 + snow_depth(c) = propor * snow_depth(c) + heatr = hm(c,j) - hfus*(temp1-h2osno(c))/dtime ! W/m2 + if (heatr > 0._r8) then + xm(c,j) = heatr*dtime/hfus ! kg/m2 + hm(c,j) = heatr ! W/m2 + else + xm(c,j) = 0._r8 + hm(c,j) = 0._r8 + endif + qflx_snomelt(c) = max(0._r8,(temp1-h2osno(c)))/dtime ! kg/(m2 s) + ! no snow layers, so qflx_snomelt_lyr is not set + xmf(c) = hfus*qflx_snomelt(c) + qflx_snow_drain(c) = qflx_snomelt(c) + endif + endif + + heatr = 0._r8 + if (xm(c,j) > 0._r8) then + h2osoi_ice(c,j) = max(0._r8, wice0(c,j)-xm(c,j)) + heatr = hm(c,j) - hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime + else if (xm(c,j) < 0._r8) then + if (j <= 0) then + h2osoi_ice(c,j) = min(wmass0(c,j), wice0(c,j)-xm(c,j)) ! snow + else + if (wmass0(c,j) < supercool(c,j)) then + h2osoi_ice(c,j) = 0._r8 + else + h2osoi_ice(c,j) = min(wmass0(c,j) - supercool(c,j),wice0(c,j)-xm(c,j)) + endif + endif + heatr = hm(c,j) - hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime + endif + + h2osoi_liq(c,j) = max(0._r8,wmass0(c,j)-h2osoi_ice(c,j)) + + if (abs(heatr) > 0._r8) then + if (j == snl(c)+1) then + + if(j==1) then + t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr & + /(1._r8-(1.0_r8 - frac_h2osfc(c))*fact(c,j)*dhsdT(c)) + else + t_soisno(c,j) = t_soisno(c,j) + (fact(c,j)/frac_sno_eff(c))*heatr & + /(1._r8-fact(c,j)*dhsdT(c)) + + endif + + else if (j == 1) then + + t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr & + /(1._r8-(1.0_r8 - frac_sno_eff(c) - frac_h2osfc(c))*fact(c,j)*dhsdT(c)) + else + if(j > 0) then + t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr + else + if(frac_sno_eff(c) > 0._r8) t_soisno(c,j) = t_soisno(c,j) + (fact(c,j)/frac_sno_eff(c))*heatr + endif + endif + + if (j <= 0) then ! snow + if (h2osoi_liq(c,j)*h2osoi_ice(c,j)>0._r8) t_soisno(c,j) = tfrz + end if + endif ! end of heatr > 0 if-block + + if (j >= 1) then + xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime + else + xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime + endif + + if (imelt(c,j) == 1 .AND. j < 1) then + qflx_snomelt_lyr(c,j) = max(0._r8,(wice0(c,j)-h2osoi_ice(c,j)))/dtime + qflx_snomelt(c) = qflx_snomelt(c) + qflx_snomelt_lyr(c,j) + endif + + ! layer freezing mass flux (positive): + if (imelt(c,j) == 2 .AND. j < 1) then + qflx_snofrz_lyr(c,j) = max(0._r8,(h2osoi_ice(c,j)-wice0(c,j)))/dtime + qflx_snofrz(c) = qflx_snofrz(c) + qflx_snofrz_lyr(c,j) + endif + + endif + + endif ! end of snow layer if-block + + endif + + end do ! end of column-loop + enddo ! end of level-loop +!KO + ! Needed for history file output do fc = 1,num_nolakec @@ -1728,8 +2059,64 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then +! if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & +! .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then +! if (j >= col%snl(c)+1) then +! if (j == col%snl(c)+1) then +! fact(c,j) = dtime/cv(c,j) +! fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) +! else if (j <= nlevurb-1) then +! fact(c,j) = dtime/cv(c,j) +! fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) +! dzm = (z(c,j)-z(c,j-1)) +! else if (j == nlevurb) then +! fact(c,j) = dtime/cv(c,j) +! if ( IsSimpleBuildTemp() )then +! ! the bottom "soil" layer and the equations are derived assuming a prescribed internal +! ! building temperature. (See Oleson urban notes of 6/18/03). +! fn(c,j) = tk(c,j) * (t_building(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) +! else +! ! the bottom "soil" layer and the equations are derived assuming a prognostic inner +! ! surface temperature. +! if (ctype(c) == icol_sunwall) then +! fn(c,j) = tk(c,j) * (t_sunw_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) +! else if (ctype(c) == icol_shadewall) then +! fn(c,j) = tk(c,j) * (t_shdw_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) +! else if (ctype(c) == icol_roof) then +! fn(c,j) = tk(c,j) * (t_roof_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) +! end if +! end if +! end if +! end if +!KO else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & +!KO .and. col%itype(c) /= icol_roof) then +!KO + if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & + .and. col%itype(c) /= icol_roof) then +!KO + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + fact(c,j) = dtime/cv(c,j) * dz(c,j) / (0.5_r8*(z(c,j)-zi(c,j-1)+capr*(z(c,j+1)-zi(c,j-1)))) + fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) + else if (j <= nlevgrnd-1) then + fact(c,j) = dtime/cv(c,j) + fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) + dzm = (z(c,j)-z(c,j-1)) + else if (j == nlevgrnd) then + fact(c,j) = dtime/cv(c,j) + fn(c,j) = eflx_bot(c) + end if + end if + end if + end do + end do +!KO + do j = -nlevsno+1,nlevurb + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) then if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then fact(c,j) = dtime/cv(c,j) @@ -1757,24 +2144,10 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti end if end if end if - else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - fact(c,j) = dtime/cv(c,j) * dz(c,j) / (0.5_r8*(z(c,j)-zi(c,j-1)+capr*(z(c,j+1)-zi(c,j-1)))) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j <= nlevgrnd-1) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - dzm = (z(c,j)-z(c,j-1)) - else if (j == nlevgrnd) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = eflx_bot(c) - end if - end if end if end do end do +!KO end associate diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 37cd7e3fb5..4222a332a8 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -705,6 +705,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_startf('soiltemperature') call SoilTemperature(bounds_clump, & filter(nc)%num_urbanl , filter(nc)%urbanl, & +!KO + filter(nc)%num_urbanc , filter(nc)%urbanc, & +!KO filter(nc)%num_nolakec , filter(nc)%nolakec, & atm2lnd_inst, urbanparams_inst, canopystate_inst, water_inst%waterstatebulk_inst, & water_inst%waterdiagnosticbulk_inst, water_inst%waterfluxbulk_inst, & From 9883a92f422bb2ec19280012876733020c7b9a82 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 12 Sep 2019 22:32:43 -0600 Subject: [PATCH 0390/1973] Bring in updates from release-clm5.0.26 adn release-clm5.0.27 --- bld/CLMBuildNamelist.pm | 44 ++++++++++++++ bld/namelist_files/namelist_defaults_ctsm.xml | 13 +++++ .../namelist_defaults_ctsm_tools.xml | 8 +-- .../namelist_definition_ctsm.xml | 33 ++++++++++- cime_config/config_archive.xml | 24 ++++++++ cime_config/testdefs/testlist_clm.xml | 31 +++++++++- src/biogeochem/CNVegetationFacade.F90 | 7 +++ src/main/clm_initializeMod.F90 | 3 + src/main/clm_varctl.F90 | 6 ++ src/main/controlMod.F90 | 4 ++ src/main/decompInitMod.F90 | 57 +++++++++++++++++++ tools/mksurfdata_map/mksurfdata.pl | 5 ++ tools/mksurfdata_map/src/mkfileMod.F90 | 17 ++++++ tools/mksurfdata_map/src/mkglcmecMod.F90 | 2 + tools/mksurfdata_map/src/mksurfdat.F90 | 17 ++++++ 15 files changed, 264 insertions(+), 7 deletions(-) create mode 100644 cime_config/config_archive.xml diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index d3a5010c19..59e94b825b 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1625,6 +1625,11 @@ sub process_namelist_inline_logic { ########################################## setup_logic_soilm_streams($opts, $nl_flags, $definition, $defaults, $nl); + ########################################## + # namelist group: soil_moisture_streams # + ########################################## + setup_logic_soilm_streams($opts, $nl_flags, $definition, $defaults, $nl, $physv); + ################################## # namelist group: bgc_shared ################################## @@ -3427,6 +3432,45 @@ sub setup_logic_soilm_streams { #------------------------------------------------------------------------------- +sub setup_logic_soilm_streams { + # prescribed soil moisture streams require clm4_5/clm5_0 + my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_; + + if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); + if ( &value_is_true( $nl->get_value('use_soil_moisture_streams') ) ) { + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_tintalgo', + 'hgrid'=>$nl_flags->{'res'} ); + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_soilm', 'phys'=>$nl_flags->{'phys'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + # Set align year, if first and last years are different + if ( $nl->get_value('stream_year_first_soilm') != + $nl->get_value('stream_year_last_soilm') ) { + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, + 'model_year_align_soilm', 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + } + add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_soilm', 'phys'=>$nl_flags->{'phys'}, + 'hgrid'=>$nl_flags->{'res'} ); + } else { + if ( defined($nl->get_value('stream_year_first_soilm')) || + defined($nl->get_value('model_year_align_soilm')) || + defined($nl->get_value('stream_fldfilename_soilm')) || + defined($nl->get_value('stream_year_last_soilm')) ) { + $log->fatal_error("One of the soilm streams namelist items (stream_year_first_soilm, " . + " model_year_align_soilm, stream_fldfilename_soilm, stream_fldfilename_soilm)" . + " is defined, but use_soil_moisture_streams option NOT set to true"); + } + } + } +} + +#------------------------------------------------------------------------------- + sub setup_logic_lai_streams { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f7b1d14e4d..6a36351c61 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1132,6 +1132,17 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 linear + + +.false. +1997 +1997 +1997 + +lnd/clm2/prescribed_data/LFMIP-pdLC-SST.H2OSOI.0.9x1.25.20levsoi.natveg.climo1980-2014.MONS_c190709.nc + +linear + .false. 2001 @@ -2557,6 +2568,8 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 >lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_LandScan2004_to_0.125x0.125_nomask_aave_da_c140702.nc lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODIS_to_0.125x0.125_nomask_aave_da_c140702.nc +lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODISv2_to_0.125x0.125_nomask_aave_da_c190613.nc lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODIS-wCsp_to_0.125x0.125_nomask_aave_da_c160427.nc lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190119/mksrf_lai_histclm52deg005_earthstatmirca_2005.c190119.nc +>lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190116/mksrf_lai_histclm52deg005_earthstatmirca_2005.c190119.nc lnd/clm2/rawdata/mksrf_soitex.10level.c010119.nc lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190119/mksrf_soilcolor_histclm52deg005_earthstatmirca_2005.c190116.nc +>lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190116/mksrf_soilcolor_histclm52deg005_earthstatmirca_2005.c190116.nc lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190119/mksrf_landuse_clm52deg005_histLUH2_1850.c190119.nc +>lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190116/mksrf_landuse_clm52deg005_histLUH2_1850.c190119.nc lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190119/mksrf_landuse_clm52deg005_histLUH2_2005.c190119.nc +>lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190116/mksrf_landuse_clm52deg005_histLUH2_2005.c190119.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 06817ce7ef..f7c6a3f859 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1657,6 +1657,37 @@ Filename of input stream data for prescribed soil moisture streams data Time interpolation method to use for prescribed soil moisture streams data + + +Toggle to turn on use of input prescribed soil moisture streams rather than have CLM prognose it (EXPERIMENTAL) + + + +First year to loop over for prescribed soil moisture streams data + + + +Last year to loop over for prescribed soil moisture streams data + + + +Simulation year that aligns with stream_year_first_soilm value + + + +Filename of input stream data for prescribed soil moisture streams data + + + +Time interpolation method to use for prescribed soil moisture streams data + + @@ -1933,7 +1964,7 @@ CLM datasets exist for years: 1000 (for testing), 1850, and 2000 +"constant,1000-1002,1000-1004,850-1850,1850-1855,1850-2000,1850-2005,1850-2100,1980-2015,2000-2100"> Range of years to simulate transitory datasets for (such as dynamic: land-use datasets, aerosol-deposition, Nitrogen deposition rates etc.) Constant means simulation will be held at a constant year given in sim_year. A sim_year_range of 1000-1002 or 1000-1004 corresponds to data used for testing only, NOT corresponding to any real datasets. diff --git a/cime_config/config_archive.xml b/cime_config/config_archive.xml new file mode 100644 index 0000000000..4c2412a0e3 --- /dev/null +++ b/cime_config/config_archive.xml @@ -0,0 +1,24 @@ + + + r + rh\d? + h\d*.*\.nc$ + e + locfnh + + rpointer.lnd$NINST_STRING + ./$CASE.clm2$NINST_STRING.r.$DATENAME.nc + + + rpointer.lnd + rpointer.lnd_9999 + casename.clm2.r.1976-01-01-00000.nc + casename.clm2.rh4.1976-01-01-00000.nc + casename.clm2.h0.1976-01-01-00000.nc + casename.clm2.h0.1976-01-01-00000.nc.base + casename.clm2_0002.e.postassim.1976-01-01-00000.nc + casename.clm2_0002.e.preassim.1976-01-01-00000.nc + anothercasename.clm2.i.1976-01-01-00000.nc + + + diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 4cd6693419..8e130c69ff 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -11,6 +11,7 @@ + @@ -18,6 +19,7 @@ + @@ -269,6 +271,7 @@ + @@ -319,6 +322,7 @@ + @@ -448,6 +452,7 @@ + @@ -614,6 +619,7 @@ + @@ -638,7 +644,6 @@ - @@ -658,7 +663,6 @@ - @@ -694,6 +698,7 @@ + @@ -712,6 +717,15 @@ + + + + + + + + + @@ -839,6 +853,9 @@ + + + @@ -1082,6 +1099,7 @@ + @@ -1230,6 +1248,7 @@ + @@ -1246,6 +1265,7 @@ + @@ -1263,6 +1283,7 @@ + @@ -1411,6 +1432,7 @@ + @@ -1464,6 +1486,7 @@ + @@ -1649,6 +1672,7 @@ + @@ -1913,6 +1937,8 @@ + + @@ -1922,6 +1948,7 @@ + diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 83c29dbdb9..1298b9053a 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -723,6 +723,13 @@ subroutine DynamicAreaConservation(this, bounds, clump_index, & soilbiogeochem_nitrogenstate_inst) call t_stopf('CNUpdateDynPatch') + ! This call fixes issue #741 by performing precision control on decomp_cpools_vr_col + call t_startf('SoilBiogeochemPrecisionControl') + call SoilBiogeochemPrecisionControl(num_soilc_with_inactive, filter_soilc_with_inactive, & + soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & + c14_soilbiogeochem_carbonstate_inst,soilbiogeochem_nitrogenstate_inst) + call t_stopf('SoilBiogeochemPrecisionControl') + call t_startf('dyn_cnbal_col') call dyn_cnbal_col(bounds, clump_index, column_state_updater, & soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 52dfa3ec96..eb4f0193a5 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -257,6 +257,9 @@ subroutine initialize1( ) end subroutine initialize1 + if(use_soil_moisture_streams) then + call PrescribedSoilMoistureInit(bounds_proc) + endif !----------------------------------------------------------------------- subroutine initialize2( ) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 186282592d..f74567c31b 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -262,6 +262,12 @@ module clm_varctl logical, public :: use_soil_moisture_streams = .false. ! true => use prescribed soil moisture stream + !---------------------------------------------------------- + ! prescribed soil moisture streams switch + !---------------------------------------------------------- + + logical, public :: use_soil_moisture_streams = .false. ! true => use prescribed soil moisture stream + !---------------------------------------------------------- ! lai streams switch for Sat. Phenology !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 2ce6627286..8a784d0bbf 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -239,6 +239,8 @@ subroutine control_init( ) namelist /clm_inparm/ use_soil_moisture_streams + namelist /clm_inparm/ use_soil_moisture_streams + namelist /clm_inparm/ use_lai_streams namelist /clm_inparm/ use_bedrock @@ -743,6 +745,8 @@ subroutine control_spmd() call mpi_bcast (use_soil_moisture_streams, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_soil_moisture_streams, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_lai_streams, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_bedrock, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index c6b8e1764b..e12420f526 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -371,6 +371,63 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) end subroutine decompInit_lnd3D + !------------------------------------------------------------------------------ + subroutine decompInit_lnd3D(lni,lnj,lnk) + ! + ! !DESCRIPTION: + ! + ! Create a 3D decomposition gsmap for the global 2D grid with soil levels + ! as the 3rd dimesnion. + ! + ! !USES: + ! + ! !ARGUMENTS: + implicit none + integer , intent(in) :: lni,lnj,lnk ! domain global size + ! + ! !LOCAL VARIABLES: + integer :: m,n,k ! indices + integer :: begg,endg,lsize,gsize ! used for gsmap init + integer :: begg3d,endg3d + integer, pointer :: gindex(:) ! global index for gsmap init + + + ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) + call get_proc_bounds(begg, endg) + begg3d = (begg-1)*lnk + 1 + endg3d = endg*lnk + lsize = (endg3d - begg3d + 1 ) + allocate(gindex(begg3d:endg3d)) + do k = 1, lnk + do n = begg,endg + m = (begg-1)*lnk + (k-1)*(endg-begg+1) + (n-begg+1) + gindex(m) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) + enddo + enddo + gsize = lni * lnj * lnk + call mct_gsMap_init(gsMap_lnd2Dsoi_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) + + ! Diagnostic output + + if (masterproc) then + write(iulog,*)' 3D GSMap' + write(iulog,*)' longitude points = ',lni + write(iulog,*)' latitude points = ',lnj + write(iulog,*)' soil levels = ',lnk + write(iulog,*)' gsize = ',gsize + write(iulog,*)' lsize = ',lsize + write(iulog,*)' bounds(gindex) = ',size(gindex) + write(iulog,*)' gsMap Characteristics' + write(iulog,*) ' lnd gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lnd2Dsoi_gdc2glo) + write(iulog,*) + end if + + deallocate(gindex) + + call shr_sys_flush(iulog) + + end subroutine decompInit_lnd3D + !------------------------------------------------------------------------------ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) ! diff --git a/tools/mksurfdata_map/mksurfdata.pl b/tools/mksurfdata_map/mksurfdata.pl index 02e6f28659..3f7512254e 100755 --- a/tools/mksurfdata_map/mksurfdata.pl +++ b/tools/mksurfdata_map/mksurfdata.pl @@ -365,6 +365,11 @@ sub write_namelist_file { map_fvic = '$map->{'vic'}' mksrf_fvic = '$datfil->{'vic'}' outnc_vic = .true. +EOF + } + if ( $opts{'glc'} ) { + print $fh <<"EOF"; + outnc_3dglc = .true. EOF } if ( $opts{'3dglc'} ) { diff --git a/tools/mksurfdata_map/src/mkfileMod.F90 b/tools/mksurfdata_map/src/mkfileMod.F90 index 52e819623b..d332781223 100644 --- a/tools/mksurfdata_map/src/mkfileMod.F90 +++ b/tools/mksurfdata_map/src/mkfileMod.F90 @@ -503,6 +503,23 @@ subroutine mkfile(domain, fname, harvdata, dynlanduse) end if + if ( outnc_3dglc ) then + call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_MEC_GIC', xtype=xtype, & + lev1name='nglcec', & + long_name='percent smaller glaciers and ice caps for each glacier elevation class (% of landunit)', units='unitless') + + call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_MEC_ICESHEET', xtype=xtype, & + lev1name='nglcec', & + long_name='percent ice sheet for each glacier elevation class (% of landunit)', units='unitless') + + call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_GIC', xtype=xtype, & + long_name='percent ice caps/glaciers (% of landunit)', units='unitless') + + call ncd_def_spatial_var(ncid=ncid, varname='PCT_GLC_ICESHEET', xtype=xtype, & + long_name='percent ice sheet (% of landunit)', units='unitless') + + end if + call ncd_def_spatial_var(ncid=ncid, varname='PCT_URBAN', xtype=xtype, & lev1name='numurbl', & long_name='percent urban for each density type', units='unitless') diff --git a/tools/mksurfdata_map/src/mkglcmecMod.F90 b/tools/mksurfdata_map/src/mkglcmecMod.F90 index b750d34206..4adbb91df6 100644 --- a/tools/mksurfdata_map/src/mkglcmecMod.F90 +++ b/tools/mksurfdata_map/src/mkglcmecMod.F90 @@ -146,11 +146,13 @@ subroutine mkglcmec(ldomain, mapfname, & ! variables in an arbitrary way. ! ! !USES: + use shr_sys_mod, only : shr_sys_abort use mkdomainMod, only : domain_type, domain_clean, domain_read use mkgridmapMod use mkvarpar use mkutilsMod, only : slightly_below, slightly_above use mkncdio + use mkvarctl , only : outnc_3dglc ! ! !ARGUMENTS: implicit none diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index 84e285d2b5..b6752a7185 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -362,6 +362,9 @@ program mksurfdat if ( outnc_3dglc )then write(6,*)'Output optional 3D glacier fields (mostly used for verification of the glacier model)' end if + if ( outnc_3dglc )then + write(6,*)'Output optional 3D glacier fields (mostly used for verification of the glacier model)' + end if if ( all_urban )then write(6,*) 'Output ALL data in file as 100% urban' end if @@ -908,6 +911,20 @@ program mksurfdat call check_ret(nf_put_var_double(ncid, varid, pctglc_icesheet), subname) end if + if ( outnc_3dglc )then + call check_ret(nf_inq_varid(ncid, 'PCT_GLC_MEC_GIC', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, pctglcmec_gic), subname) + + call check_ret(nf_inq_varid(ncid, 'PCT_GLC_MEC_ICESHEET', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, pctglcmec_icesheet), subname) + + call check_ret(nf_inq_varid(ncid, 'PCT_GLC_GIC', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, pctglc_gic), subname) + + call check_ret(nf_inq_varid(ncid, 'PCT_GLC_ICESHEET', varid), subname) + call check_ret(nf_put_var_double(ncid, varid, pctglc_icesheet), subname) + end if + call check_ret(nf_inq_varid(ncid, 'PCT_URBAN', varid), subname) call check_ret(nf_put_var_double(ncid, varid, urbn_classes_g), subname) From 998473ee2030daafb964f2891e791333abd5702c Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 18 Sep 2019 11:52:24 -0600 Subject: [PATCH 0391/1973] Second step in allowing for nlevgrnd to be less than nlevurb. Code passes as bfb with ctsm1.0.dev035 for this test: ERP_Ld3.f09_g17.I1850Clm50BgcCropCru.cheyenne_intel.clm-ciso --- src/biogeophys/CanopyTemperatureMod.F90 | 41 ++++++++++- src/biogeophys/HydrologyDrainageMod.F90 | 22 +++++- src/biogeophys/HydrologyNoDrainageMod.F90 | 22 +++++- src/biogeophys/SoilWaterMovementMod.F90 | 78 ++++++++++++-------- src/biogeophys/TotalWaterAndHeatMod.F90 | 51 ++++++++++--- src/biogeophys/TridiagonalMod.F90 | 90 ++++++++++++++--------- src/biogeophys/UrbanParamsType.F90 | 9 ++- src/main/clm_driver.F90 | 3 + 8 files changed, 225 insertions(+), 91 deletions(-) diff --git a/src/biogeophys/CanopyTemperatureMod.F90 b/src/biogeophys/CanopyTemperatureMod.F90 index b1c3c6cc67..fbe76b561e 100644 --- a/src/biogeophys/CanopyTemperatureMod.F90 +++ b/src/biogeophys/CanopyTemperatureMod.F90 @@ -47,6 +47,9 @@ module CanopyTemperatureMod !------------------------------------------------------------------------------ subroutine CanopyTemperature(bounds, & num_nolakec, filter_nolakec, num_nolakep, filter_nolakep, & +!KO + num_urbanc, filter_urbanc, & +!KO clm_fates, & atm2lnd_inst, canopystate_inst, soilstate_inst, frictionvel_inst, & waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & @@ -90,6 +93,10 @@ subroutine CanopyTemperature(bounds, & integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter integer , intent(in) :: filter_nolakep(:) ! patch filter for non-lake points +!KO + integer , intent(in) :: num_urbanc ! number of urban columns in clump + integer , intent(in) :: filter_urbanc(:) ! urban column filter +!KO type(hlm_fates_interface_type), intent(inout) :: clm_fates type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(canopystate_type) , intent(inout) :: canopystate_inst @@ -107,6 +114,9 @@ subroutine CanopyTemperature(bounds, & integer :: j ! soil/snow level index integer :: fp ! lake filter patch index integer :: fc ! lake filter column index +!KO + integer :: nlev ! greater of nlevgrnd and nlevurb +!KO real(r8) :: qred ! soil surface relative humidity real(r8) :: avmuir ! ir inverse optical depth per unit leaf area real(r8) :: eg ! water vapor pressure at temperature T [pa] @@ -218,10 +228,14 @@ subroutine CanopyTemperature(bounds, & do j = -nlevsno+1, nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) .and. j > nlevurb) then - tssbef(c,j) = spval - else +!KO if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & +!KO .or. col%itype(c) == icol_roof) .and. j > nlevurb) then +!KO tssbef(c,j) = spval +!KO else +!KO + if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & + .and. col%itype(c) /= icol_roof) then +!KO tssbef(c,j) = t_soisno(c,j) end if ! record t_h2osfc prior to updating @@ -229,6 +243,25 @@ subroutine CanopyTemperature(bounds, & end do end do +!KO + nlev = max0(nlevgrnd,nlevurb) + do j = -nlevsno+1, nlev + do fc = 1,num_urbanc + c = filter_urbanc(fc) + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) then + if (j > nlevurb) then + tssbef(c,j) = spval + else + tssbef(c,j) = t_soisno(c,j) + end if + end if + ! record t_h2osfc prior to updating + t_h2osfc_bef(c) = t_h2osfc(c) + end do + end do +!KO + ! calculate moisture stress/resistance for soil evaporation call calc_soilevap_resis(bounds, num_nolakec, filter_nolakec, & soilstate_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, temperature_inst) diff --git a/src/biogeophys/HydrologyDrainageMod.F90 b/src/biogeophys/HydrologyDrainageMod.F90 index c9f2c9eba1..f4cc9175d7 100644 --- a/src/biogeophys/HydrologyDrainageMod.F90 +++ b/src/biogeophys/HydrologyDrainageMod.F90 @@ -151,14 +151,30 @@ subroutine HydrologyDrainage(bounds, & do j = 1, nlevgrnd do fc = 1, num_nolakec c = filter_nolakec(fc) - if ((ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall & - .or. ctype(c) == icol_roof) .and. j > nlevurb) then - else +!KO if ((ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall & +!KO .or. ctype(c) == icol_roof) .and. j > nlevurb) then +!KO + if (ctype(c) /= icol_sunwall .and. ctype(c) /= icol_shadewall & + .and. ctype(c) /= icol_roof) then +!KO +!KO else h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) end if end do end do +!KO + do j = 1, nlevurb + do fc = 1, num_urbanc + c = filter_urbanc(fc) + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) then + h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) + end if + end do + end do +!KO + call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & waterstatebulk_inst, waterdiagnosticbulk_inst, & subtract_dynbal_baselines = .false., & diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index 1823c826c0..a942c0eff6 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -514,13 +514,29 @@ subroutine HydrologyNoDrainage(bounds, & do j = 1, nlevgrnd do fc = 1, num_nolakec c = filter_nolakec(fc) - if ((ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall & - .or. ctype(c) == icol_roof) .and. j > nlevurb) then - else +!KO if ((ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall & +!KO .or. ctype(c) == icol_roof) .and. j > nlevurb) then +!KO + if (ctype(c) /= icol_sunwall .and. ctype(c) /= icol_shadewall & + .and. ctype(c) /= icol_roof) then +!KO +!KO else + h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) + end if + end do + end do + +!KO + do j = 1, nlevurb + do fc = 1, num_urbanc + c = filter_urbanc(fc) + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) then h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) end if end do end do +!KO ! if (use_cn) then ! Update soilpsi. diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 index 05be0685f4..ffa37d55fa 100644 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ b/src/biogeophys/SoilWaterMovementMod.F90 @@ -2188,43 +2188,59 @@ subroutine TridiagonalCol (ci, lbj, ubj, jtop, a, b, c, r, u) bet = b(jtop) do j = lbj, ubj - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then - if (j >= jtop) then - if (j == jtop) then - u(j) = r(j) / bet - else - gam(j) = c(j-1) / bet - bet = b(j) - a(j) * gam(j) - u(j) = (r(j) - a(j)*u(j-1)) / bet - end if - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop) then - if (j == jtop) then - u(j) = r(j) / bet - else - gam(j) = c(j-1) / bet - bet = b(j) - a(j) * gam(j) - u(j) = (r(j) - a(j)*u(j-1)) / bet - end if +!KO if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & +!KO .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then +!KO if (j >= jtop) then +!KO if (j == jtop) then +!KO u(j) = r(j) / bet +!KO else +!KO gam(j) = c(j-1) / bet +!KO bet = b(j) - a(j) * gam(j) +!KO u(j) = (r(j) - a(j)*u(j-1)) / bet +!KO end if +!KO end if +!KO else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & +!KO .and. col%itype(ci) /= icol_roof) then +!KO if (j >= jtop) then +!KO if (j == jtop) then +!KO u(j) = r(j) / bet +!KO else +!KO gam(j) = c(j-1) / bet +!KO bet = b(j) - a(j) * gam(j) +!KO u(j) = (r(j) - a(j)*u(j-1)) / bet +!KO end if +!KO end if +!KO end if +!KO + if (j >= jtop) then + if (j == jtop) then + u(j) = r(j) / bet + else + gam(j) = c(j-1) / bet + bet = b(j) - a(j) * gam(j) + u(j) = (r(j) - a(j)*u(j-1)) / bet end if end if +!KO end do do j = ubj-1,lbj,-1 - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then - if (j >= jtop) then - u(j) = u(j) - gam(j+1) * u(j+1) - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop) then - u(j) = u(j) - gam(j+1) * u(j+1) - end if +!KO if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & +!KO .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then +!KO if (j >= jtop) then +!KO u(j) = u(j) - gam(j+1) * u(j+1) +!KO end if +!KO else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & +!KO .and. col%itype(ci) /= icol_roof) then +!KO if (j >= jtop) then +!KO u(j) = u(j) - gam(j+1) * u(j+1) +!KO end if +!KO end if +!KO + if (j >= jtop) then + u(j) = u(j) - gam(j+1) * u(j+1) end if +!KO end do end subroutine TridiagonalCol diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index be06681fb0..566de39e1c 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -348,6 +348,9 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & ! !LOCAL VARIABLES: integer :: c, j, fc ! indices logical :: has_h2o ! whether this point potentially has water to add +!KO + integer :: nlev ! greater of nlevgrnd and nlevurb +!KO character(len=*), parameter :: subname = 'AccumulateSoilLiqIceMassNonLake' !----------------------------------------------------------------------- @@ -360,7 +363,13 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & h2osoi_liq => waterstate_inst%h2osoi_liq_col & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) ) - do j = 1, nlevgrnd +!KO + nlev = max0(nlevgrnd,nlevurb) +!KO +!KO do j = 1, nlevgrnd +!KO + do j = 1, nlev +!KO do fc = 1, num_c c = filter_c(fc) if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then @@ -372,7 +381,12 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & has_h2o = .false. end if else - has_h2o = .true. +!KO has_h2o = .true. +!KO + if (j <= nlevgrnd) then + has_h2o = .true. + end if +!KO end if if (has_h2o) then @@ -719,6 +733,9 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & ! !LOCAL VARIABLES: integer :: fc integer :: l, c, j +!KO + integer :: nlev ! greater of nlevgrnd and nlevurb +!KO logical :: has_h2o ! whether this point potentially has water to add real(r8) :: soil_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: liquid water in soil, excluding latent heat [J/m^2] @@ -755,7 +772,11 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & soil_latent_heat_liquid(c) = 0._r8 end do - do j = 1, nlevgrnd +!KO + nlev = max0(nlevgrnd,nlevurb) + do j = 1, nlev +!KO +!KO do j = 1, nlevgrnd do fc = 1, num_c c = filter_c(fc) l = col%landunit(c) @@ -777,17 +798,23 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & end if else - has_h2o = .true. +!KO + if (j <= nlevgrnd) then +!KO + has_h2o = .true. - if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then - soil_heat_dry_mass(c) = soil_heat_dry_mass(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (cv_improad(l,j) * dz(c,j))) - else if (lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec) then - ! Note that this also includes impervious roads below nlev_improad (where - ! we have soil) - soil_heat_dry_mass(c) = soil_heat_dry_mass(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (csol(c,j)*(1-watsat(c,j))*dz(c,j))) + if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then + soil_heat_dry_mass(c) = soil_heat_dry_mass(c) + & + TempToHeat(temp = t_soisno(c,j), cv = (cv_improad(l,j) * dz(c,j))) + else if (lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec) then + ! Note that this also includes impervious roads below nlev_improad (where + ! we have soil) + soil_heat_dry_mass(c) = soil_heat_dry_mass(c) + & + TempToHeat(temp = t_soisno(c,j), cv = (csol(c,j)*(1-watsat(c,j))*dz(c,j))) + end if +!KO end if +!KO end if if (has_h2o) then diff --git a/src/biogeophys/TridiagonalMod.F90 b/src/biogeophys/TridiagonalMod.F90 index 68dbd71cce..bfb296f50d 100644 --- a/src/biogeophys/TridiagonalMod.F90 +++ b/src/biogeophys/TridiagonalMod.F90 @@ -28,8 +28,8 @@ subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevurb - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall +!KO use clm_varpar , only : nlevurb +!KO use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use clm_varctl , only : iulog use decompMod , only : bounds_type use ColumnType , only : col @@ -39,8 +39,12 @@ subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) type(bounds_type), intent(in) :: bounds integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices integer , intent(in) :: jtop( bounds%begc: ) ! top level for each column [col] - integer , intent(in) :: numf ! filter dimension - integer , intent(in) :: filter(:) ! filter +!KO integer , intent(in) :: numf ! filter dimension +!KO integer , intent(in) :: filter(:) ! filter +!KO + integer , intent(in) :: numf ! filter dimension (should not include hydrologically inactive points) + integer , intent(in) :: filter(:) ! filter (should not include hydrologically inactive points) +!KO real(r8), intent(in) :: a( bounds%begc: , lbj: ) ! "a" left off diagonal of tridiagonal matrix [col, j] real(r8), intent(in) :: b( bounds%begc: , lbj: ) ! "b" diagonal column for tridiagonal matrix [col, j] real(r8), intent(in) :: c( bounds%begc: , lbj: ) ! "c" right off diagonal tridiagonal matrix [col, j] @@ -70,46 +74,62 @@ subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) do j = lbj, ubj do fc = 1,numf ci = filter(fc) - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then - if (j >= jtop(ci)) then - if (j == jtop(ci)) then - u(ci,j) = r(ci,j) / bet(ci) - else - gam(ci,j) = c(ci,j-1) / bet(ci) - bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) - u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) - end if - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop(ci)) then - if (j == jtop(ci)) then - u(ci,j) = r(ci,j) / bet(ci) - else - gam(ci,j) = c(ci,j-1) / bet(ci) - bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) - u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) - end if +!KO if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & +!KO .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then +!KO if (j >= jtop(ci)) then +!KO if (j == jtop(ci)) then +!KO u(ci,j) = r(ci,j) / bet(ci) +!KO else +!KO gam(ci,j) = c(ci,j-1) / bet(ci) +!KO bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) +!KO u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) +!KO end if +!KO end if +!KO else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & +!KO .and. col%itype(ci) /= icol_roof) then +!KO if (j >= jtop(ci)) then +!KO if (j == jtop(ci)) then +!KO u(ci,j) = r(ci,j) / bet(ci) +!KO else +!KO gam(ci,j) = c(ci,j-1) / bet(ci) +!KO bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) +!KO u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) +!KO end if +!KO end if +!KO end if +!KO + if (j >= jtop(ci)) then + if (j == jtop(ci)) then + u(ci,j) = r(ci,j) / bet(ci) + else + gam(ci,j) = c(ci,j-1) / bet(ci) + bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) + u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) end if end if +!KO end do end do do j = ubj-1,lbj,-1 do fc = 1,numf ci = filter(fc) - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then - if (j >= jtop(ci)) then - u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop(ci)) then - u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) - end if +!KO if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & +!KO .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then +!KO if (j >= jtop(ci)) then +!KO u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) +!KO end if +!KO else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & +!KO .and. col%itype(ci) /= icol_roof) then +!KO if (j >= jtop(ci)) then +!KO u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) +!KO end if +!KO end if +!KO + if (j >= jtop(ci)) then + u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) end if +!KO end do end do diff --git a/src/biogeophys/UrbanParamsType.F90 b/src/biogeophys/UrbanParamsType.F90 index 4b4187c3af..2e3c7c4766 100644 --- a/src/biogeophys/UrbanParamsType.F90 +++ b/src/biogeophys/UrbanParamsType.F90 @@ -122,8 +122,11 @@ subroutine Init(this, bounds) ! ! !USES: use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevcan, nlevcan, numrad, nlevgrnd, nlevurb - use clm_varpar , only : nlevsoi, nlevgrnd +!KO use clm_varpar , only : nlevcan, nlevcan, numrad, nlevgrnd, nlevurb +!KO use clm_varpar , only : nlevsoi, nlevgrnd +!KO + use clm_varpar , only : numrad, nlevurb +!KO use clm_varctl , only : use_vancouver, use_mexicocity use clm_varcon , only : vkc use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall @@ -195,7 +198,7 @@ subroutine Init(this, bounds) do l = bounds%begl,bounds%endl - ! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom +!KO ! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom if (lun%urbpoi(l)) then g = lun%gridcell(l) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 4222a332a8..3df74fec7f 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -540,6 +540,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call CanopyTemperature(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_nolakep, filter(nc)%nolakep, & +!KO + filter(nc)%num_urbanc, filter(nc)%urbanc, & +!KO clm_fates, & atm2lnd_inst, canopystate_inst, soilstate_inst, frictionvel_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & From 72cb106834c4fc12767dcc5c5ec1a283ba42581d Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 18 Sep 2019 13:28:09 -0600 Subject: [PATCH 0392/1973] Clean out !KO --- src/biogeophys/CanopyTemperatureMod.F90 | 14 --- src/biogeophys/HydrologyDrainageMod.F90 | 7 -- src/biogeophys/HydrologyNoDrainageMod.F90 | 7 -- src/biogeophys/SoilFluxesMod.F90 | 8 +- src/biogeophys/SoilTemperatureMod.F90 | 143 +--------------------- src/biogeophys/SoilWaterMovementMod.F90 | 38 ------ src/biogeophys/TotalWaterAndHeatMod.F90 | 19 --- src/biogeophys/TridiagonalMod.F90 | 44 ------- src/biogeophys/UrbanParamsType.F90 | 5 - src/main/clm_driver.F90 | 4 - 10 files changed, 5 insertions(+), 284 deletions(-) diff --git a/src/biogeophys/CanopyTemperatureMod.F90 b/src/biogeophys/CanopyTemperatureMod.F90 index fbe76b561e..44500cd74e 100644 --- a/src/biogeophys/CanopyTemperatureMod.F90 +++ b/src/biogeophys/CanopyTemperatureMod.F90 @@ -47,9 +47,7 @@ module CanopyTemperatureMod !------------------------------------------------------------------------------ subroutine CanopyTemperature(bounds, & num_nolakec, filter_nolakec, num_nolakep, filter_nolakep, & -!KO num_urbanc, filter_urbanc, & -!KO clm_fates, & atm2lnd_inst, canopystate_inst, soilstate_inst, frictionvel_inst, & waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & @@ -93,10 +91,8 @@ subroutine CanopyTemperature(bounds, & integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter integer , intent(in) :: filter_nolakep(:) ! patch filter for non-lake points -!KO integer , intent(in) :: num_urbanc ! number of urban columns in clump integer , intent(in) :: filter_urbanc(:) ! urban column filter -!KO type(hlm_fates_interface_type), intent(inout) :: clm_fates type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(canopystate_type) , intent(inout) :: canopystate_inst @@ -114,9 +110,7 @@ subroutine CanopyTemperature(bounds, & integer :: j ! soil/snow level index integer :: fp ! lake filter patch index integer :: fc ! lake filter column index -!KO integer :: nlev ! greater of nlevgrnd and nlevurb -!KO real(r8) :: qred ! soil surface relative humidity real(r8) :: avmuir ! ir inverse optical depth per unit leaf area real(r8) :: eg ! water vapor pressure at temperature T [pa] @@ -228,14 +222,8 @@ subroutine CanopyTemperature(bounds, & do j = -nlevsno+1, nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) -!KO if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & -!KO .or. col%itype(c) == icol_roof) .and. j > nlevurb) then -!KO tssbef(c,j) = spval -!KO else -!KO if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & .and. col%itype(c) /= icol_roof) then -!KO tssbef(c,j) = t_soisno(c,j) end if ! record t_h2osfc prior to updating @@ -243,7 +231,6 @@ subroutine CanopyTemperature(bounds, & end do end do -!KO nlev = max0(nlevgrnd,nlevurb) do j = -nlevsno+1, nlev do fc = 1,num_urbanc @@ -260,7 +247,6 @@ subroutine CanopyTemperature(bounds, & t_h2osfc_bef(c) = t_h2osfc(c) end do end do -!KO ! calculate moisture stress/resistance for soil evaporation call calc_soilevap_resis(bounds, num_nolakec, filter_nolakec, & diff --git a/src/biogeophys/HydrologyDrainageMod.F90 b/src/biogeophys/HydrologyDrainageMod.F90 index f4cc9175d7..053b5634f6 100644 --- a/src/biogeophys/HydrologyDrainageMod.F90 +++ b/src/biogeophys/HydrologyDrainageMod.F90 @@ -151,19 +151,13 @@ subroutine HydrologyDrainage(bounds, & do j = 1, nlevgrnd do fc = 1, num_nolakec c = filter_nolakec(fc) -!KO if ((ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall & -!KO .or. ctype(c) == icol_roof) .and. j > nlevurb) then -!KO if (ctype(c) /= icol_sunwall .and. ctype(c) /= icol_shadewall & .and. ctype(c) /= icol_roof) then -!KO -!KO else h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) end if end do end do -!KO do j = 1, nlevurb do fc = 1, num_urbanc c = filter_urbanc(fc) @@ -173,7 +167,6 @@ subroutine HydrologyDrainage(bounds, & end if end do end do -!KO call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & waterstatebulk_inst, waterdiagnosticbulk_inst, & diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index a942c0eff6..465fe0857d 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -514,19 +514,13 @@ subroutine HydrologyNoDrainage(bounds, & do j = 1, nlevgrnd do fc = 1, num_nolakec c = filter_nolakec(fc) -!KO if ((ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall & -!KO .or. ctype(c) == icol_roof) .and. j > nlevurb) then -!KO if (ctype(c) /= icol_sunwall .and. ctype(c) /= icol_shadewall & .and. ctype(c) /= icol_roof) then -!KO -!KO else h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) end if end do end do -!KO do j = 1, nlevurb do fc = 1, num_urbanc c = filter_urbanc(fc) @@ -536,7 +530,6 @@ subroutine HydrologyNoDrainage(bounds, & end if end do end do -!KO ! if (use_cn) then ! Update soilpsi. diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index d319873c8c..db451d59df 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -378,12 +378,8 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & c = patch%column(p) ! Do this for perv and imperv road for -nlevsno+1,nlevgrnd -!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & -!KO .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then -!KO if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & .and. col%itype(c) /= icol_roof) then -!KO ! area weight heat absorbed by snow layers if (j >= col%snl(c)+1 .and. j < 1) errsoi_patch(p) = errsoi_patch(p) & - frac_sno_eff(c)*(t_soisno(c,j)-tssbef(c,j))/fact(c,j) @@ -392,7 +388,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & end if end do end do -!KO + ! Do this for sunwall, shadewall, roof but for -nlevsno+1,nlevurb do j = -nlevsno+1,nlevurb do fp = 1,num_urbanp @@ -409,7 +405,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & end if end do end do -!KO + call t_stopf('bgp2_loop_3') call t_startf('bgp2_loop_4') diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index b570ac288a..e411315a2a 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -118,10 +118,7 @@ module SoilTemperatureMod contains !----------------------------------------------------------------------- -!KO subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_nolakec, filter_nolakec, & -!KO subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter_urbanc, num_nolakec, filter_nolakec, & -!KO atm2lnd_inst, urbanparams_inst, canopystate_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst,& solarabs_inst, soilstate_inst, energyflux_inst, temperature_inst, urbantv_inst) ! @@ -161,10 +158,8 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points integer , intent(in) :: num_urbanl ! number of urban landunits in clump integer , intent(in) :: filter_urbanl(:) ! urban landunit filter -!KO integer , intent(in) :: num_urbanc ! number of urban columns in clump integer , intent(in) :: filter_urbanc(:) ! urban column filter -!KO type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(urbanparams_type) , intent(in) :: urbanparams_inst type(urbantv_type) , intent(in) :: urbantv_inst @@ -441,42 +436,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter do j = -nlevsno+1,nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) -!KO l = col%landunit(c) -!KO if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & -!KO .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then -!KO -!KO if (j >= snl(c)+1) then -!KO if (j <= nlevurb-1) then -!KO fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) -!KO else if (j == nlevurb) then -!KO ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across -!KO if ( IsSimpleBuildTemp() )then -!KO ! the bottom "soil" layer and the equations are derived assuming a prescribed internal -!KO ! building temperature. (See Oleson urban notes of 6/18/03). -!KO ! Note new formulation for fn, this will be used below in net energey flux computations -!KO fn1(c,j) = tk(c,j) * (t_building(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) -!KO fn(c,j) = tk(c,j) * (t_building(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) - -!KO else -!KO ! the bottom "soil" layer and the equations are derived assuming a prognostic inner -!KO ! surface temperature. -!KO if (ctype(c) == icol_sunwall) then -!KO fn1(c,j) = tk(c,j) * (t_sunw_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) -!KO fn(c,j) = tk(c,j) * (t_sunw_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) -!KO else if (ctype(c) == icol_shadewall) then -!KO fn1(c,j) = tk(c,j) * (t_shdw_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) -!KO fn(c,j) = tk(c,j) * (t_shdw_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) -!KO else if (ctype(c) == icol_roof) then -!KO fn1(c,j) = tk(c,j) * (t_roof_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) -!KO fn(c,j) = tk(c,j) * (t_roof_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) -!KO end if -!KO end if -!KO end if -!KO end if -!KO else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & -!KO if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & -!KO .and. col%itype(c) /= icol_roof) then if (j >= snl(c)+1) then if (j <= nlevgrnd-1) then @@ -489,7 +449,6 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter end do end do -!KO ! Do this for sunwall, shadewall, roof but for -nlevsno+1,nlevurb do j = -nlevsno+1,nlevurb do fc = 1,num_urbanc @@ -528,7 +487,6 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter end if end do end do -!KO do fc = 1,num_nolakec c = filter_nolakec(fc) @@ -718,9 +676,6 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ) ! Thermal conductivity of soil from Farouki (1981) -!KO ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) -!KO ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., -!KO ! 41, 1011-1026. do j = -nlevsno+1,nlevgrnd do fc = 1, num_nolakec @@ -729,19 +684,8 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! Only examine levels from 1->nlevgrnd if (j >= 1) then l = col%landunit(c) -!KO if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then -!KO thk(c,j) = tk_wall(l,j) -!KO else if (col%itype(c) == icol_roof .and. j <= nlevurb) then -!KO thk(c,j) = tk_roof(l,j) -!KO else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then -!KO thk(c,j) = tk_improad(l,j) -!KO else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & -!KO -!KO .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & -!KO col%itype(c) /= icol_roof) then -!KO - !KO This will include pervious road for all nlevgrnd layers and impervious road for j > nlev_improad -!KO + + ! This will include pervious road for all nlevgrnd layers and impervious road for j > nlev_improad if ((lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec & .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) .or. & @@ -801,31 +745,14 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & end do end do -!KO ! Thermal conductivity at the layer interface do j = -nlevsno+1,nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) -!KO if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & -!KO .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then -!KO if (j >= snl(c)+1 .AND. j <= nlevurb-1) then -!KO tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & -!KO /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) -!KO else if (j == nlevurb) then - -!KO ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across -!KO ! the bottom "soil" layer and the equations are derived assuming a prescribed internal -!KO ! building temperature. (See Oleson urban notes of 6/18/03). -!KO tk(c,j) = thk(c,j) -!KO end if -!KO else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & -!KO .and. col%itype(c) /= icol_roof) then -!KO if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & .and. col%itype(c) /= icol_roof) then -!KO if (j >= snl(c)+1 .AND. j <= nlevgrnd-1) then tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) @@ -836,7 +763,6 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & end do end do -!KO do j = -nlevsno+1,nlevurb do fc = 1,num_nolakec c = filter_nolakec(fc) @@ -855,7 +781,6 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & end if end do end do -!KO ! calculate thermal conductivity of h2osfc do fc = 1, num_nolakec @@ -866,23 +791,11 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & enddo ! Soil heat capacity, from de Vires (1963) -!KO ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) -!KO ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., -!KO ! 41, 1011-1026. do j = 1, nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) -! if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then -! cv(c,j) = cv_wall(l,j) * dz(c,j) -! else if (col%itype(c) == icol_roof .and. j <= nlevurb) then -! cv(c,j) = cv_roof(l,j) * dz(c,j) -! else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then -! cv(c,j) = cv_improad(l,j) * dz(c,j) -! else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & -! .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & -! col%itype(c) /= icol_roof) then if ((lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec & .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) .or. & @@ -904,7 +817,6 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & enddo end do -!KO do j = 1, nlevurb do fc = 1,num_nolakec c = filter_nolakec(fc) @@ -925,7 +837,6 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & end if end do end do -!KO ! Snow heat capacity @@ -1326,14 +1237,8 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & l = col%landunit(c) supercool(c,j) = 0.0_r8 ! add in urban condition if-block -!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & -!KO .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then -!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & .and. col%itype(c) /= icol_roof)) then -!KO - - if (h2osoi_ice(c,j) > 0. .AND. t_soisno(c,j) > tfrz) then imelt(c,j) = 1 @@ -1374,7 +1279,6 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end do enddo -!KO do j = 1,nlevurb do fc = 1,num_nolakec c = filter_nolakec(fc) @@ -1412,18 +1316,13 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end do enddo -!KO do j = -nlevsno+1,nlevgrnd ! all layers do fc = 1,num_nolakec c = filter_nolakec(fc) -!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & -!KO .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then -!KO if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & .and. col%itype(c) /= icol_roof)) then -!KO if (j >= snl(c)+1) then @@ -1570,7 +1469,6 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end do ! end of column-loop enddo ! end of level-loop -!KO do j = -nlevsno+1,nlevurb do fc = 1,num_nolakec c = filter_nolakec(fc) @@ -1721,7 +1619,6 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end do ! end of column-loop enddo ! end of level-loop -!KO ! Needed for history file output @@ -2059,41 +1956,8 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) -! if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & -! .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then -! if (j >= col%snl(c)+1) then -! if (j == col%snl(c)+1) then -! fact(c,j) = dtime/cv(c,j) -! fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) -! else if (j <= nlevurb-1) then -! fact(c,j) = dtime/cv(c,j) -! fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) -! dzm = (z(c,j)-z(c,j-1)) -! else if (j == nlevurb) then -! fact(c,j) = dtime/cv(c,j) -! if ( IsSimpleBuildTemp() )then -! ! the bottom "soil" layer and the equations are derived assuming a prescribed internal -! ! building temperature. (See Oleson urban notes of 6/18/03). -! fn(c,j) = tk(c,j) * (t_building(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) -! else -! ! the bottom "soil" layer and the equations are derived assuming a prognostic inner -! ! surface temperature. -! if (ctype(c) == icol_sunwall) then -! fn(c,j) = tk(c,j) * (t_sunw_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) -! else if (ctype(c) == icol_shadewall) then -! fn(c,j) = tk(c,j) * (t_shdw_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) -! else if (ctype(c) == icol_roof) then -! fn(c,j) = tk(c,j) * (t_roof_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) -! end if -! end if -! end if -! end if -!KO else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & -!KO .and. col%itype(c) /= icol_roof) then -!KO if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & .and. col%itype(c) /= icol_roof) then -!KO if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then fact(c,j) = dtime/cv(c,j) * dz(c,j) / (0.5_r8*(z(c,j)-zi(c,j-1)+capr*(z(c,j+1)-zi(c,j-1)))) @@ -2110,7 +1974,7 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti end if end do end do -!KO + do j = -nlevsno+1,nlevurb do fc = 1,num_nolakec c = filter_nolakec(fc) @@ -2147,7 +2011,6 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti end if end do end do -!KO end associate diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 index ffa37d55fa..d3eeee9506 100644 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ b/src/biogeophys/SoilWaterMovementMod.F90 @@ -2188,30 +2188,6 @@ subroutine TridiagonalCol (ci, lbj, ubj, jtop, a, b, c, r, u) bet = b(jtop) do j = lbj, ubj -!KO if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & -!KO .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then -!KO if (j >= jtop) then -!KO if (j == jtop) then -!KO u(j) = r(j) / bet -!KO else -!KO gam(j) = c(j-1) / bet -!KO bet = b(j) - a(j) * gam(j) -!KO u(j) = (r(j) - a(j)*u(j-1)) / bet -!KO end if -!KO end if -!KO else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & -!KO .and. col%itype(ci) /= icol_roof) then -!KO if (j >= jtop) then -!KO if (j == jtop) then -!KO u(j) = r(j) / bet -!KO else -!KO gam(j) = c(j-1) / bet -!KO bet = b(j) - a(j) * gam(j) -!KO u(j) = (r(j) - a(j)*u(j-1)) / bet -!KO end if -!KO end if -!KO end if -!KO if (j >= jtop) then if (j == jtop) then u(j) = r(j) / bet @@ -2221,26 +2197,12 @@ subroutine TridiagonalCol (ci, lbj, ubj, jtop, a, b, c, r, u) u(j) = (r(j) - a(j)*u(j-1)) / bet end if end if -!KO end do do j = ubj-1,lbj,-1 -!KO if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & -!KO .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then -!KO if (j >= jtop) then -!KO u(j) = u(j) - gam(j+1) * u(j+1) -!KO end if -!KO else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & -!KO .and. col%itype(ci) /= icol_roof) then -!KO if (j >= jtop) then -!KO u(j) = u(j) - gam(j+1) * u(j+1) -!KO end if -!KO end if -!KO if (j >= jtop) then u(j) = u(j) - gam(j+1) * u(j+1) end if -!KO end do end subroutine TridiagonalCol diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 566de39e1c..dbe5466056 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -348,9 +348,7 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & ! !LOCAL VARIABLES: integer :: c, j, fc ! indices logical :: has_h2o ! whether this point potentially has water to add -!KO integer :: nlev ! greater of nlevgrnd and nlevurb -!KO character(len=*), parameter :: subname = 'AccumulateSoilLiqIceMassNonLake' !----------------------------------------------------------------------- @@ -363,13 +361,8 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & h2osoi_liq => waterstate_inst%h2osoi_liq_col & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) ) -!KO nlev = max0(nlevgrnd,nlevurb) -!KO -!KO do j = 1, nlevgrnd -!KO do j = 1, nlev -!KO do fc = 1, num_c c = filter_c(fc) if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then @@ -381,12 +374,9 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & has_h2o = .false. end if else -!KO has_h2o = .true. -!KO if (j <= nlevgrnd) then has_h2o = .true. end if -!KO end if if (has_h2o) then @@ -733,9 +723,7 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & ! !LOCAL VARIABLES: integer :: fc integer :: l, c, j -!KO integer :: nlev ! greater of nlevgrnd and nlevurb -!KO logical :: has_h2o ! whether this point potentially has water to add real(r8) :: soil_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: liquid water in soil, excluding latent heat [J/m^2] @@ -772,11 +760,8 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & soil_latent_heat_liquid(c) = 0._r8 end do -!KO nlev = max0(nlevgrnd,nlevurb) do j = 1, nlev -!KO -!KO do j = 1, nlevgrnd do fc = 1, num_c c = filter_c(fc) l = col%landunit(c) @@ -798,9 +783,7 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & end if else -!KO if (j <= nlevgrnd) then -!KO has_h2o = .true. if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then @@ -812,9 +795,7 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & soil_heat_dry_mass(c) = soil_heat_dry_mass(c) + & TempToHeat(temp = t_soisno(c,j), cv = (csol(c,j)*(1-watsat(c,j))*dz(c,j))) end if -!KO end if -!KO end if if (has_h2o) then diff --git a/src/biogeophys/TridiagonalMod.F90 b/src/biogeophys/TridiagonalMod.F90 index bfb296f50d..f46a195ced 100644 --- a/src/biogeophys/TridiagonalMod.F90 +++ b/src/biogeophys/TridiagonalMod.F90 @@ -28,8 +28,6 @@ subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg -!KO use clm_varpar , only : nlevurb -!KO use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use clm_varctl , only : iulog use decompMod , only : bounds_type use ColumnType , only : col @@ -39,12 +37,8 @@ subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) type(bounds_type), intent(in) :: bounds integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices integer , intent(in) :: jtop( bounds%begc: ) ! top level for each column [col] -!KO integer , intent(in) :: numf ! filter dimension -!KO integer , intent(in) :: filter(:) ! filter -!KO integer , intent(in) :: numf ! filter dimension (should not include hydrologically inactive points) integer , intent(in) :: filter(:) ! filter (should not include hydrologically inactive points) -!KO real(r8), intent(in) :: a( bounds%begc: , lbj: ) ! "a" left off diagonal of tridiagonal matrix [col, j] real(r8), intent(in) :: b( bounds%begc: , lbj: ) ! "b" diagonal column for tridiagonal matrix [col, j] real(r8), intent(in) :: c( bounds%begc: , lbj: ) ! "c" right off diagonal tridiagonal matrix [col, j] @@ -74,30 +68,6 @@ subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) do j = lbj, ubj do fc = 1,numf ci = filter(fc) -!KO if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & -!KO .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then -!KO if (j >= jtop(ci)) then -!KO if (j == jtop(ci)) then -!KO u(ci,j) = r(ci,j) / bet(ci) -!KO else -!KO gam(ci,j) = c(ci,j-1) / bet(ci) -!KO bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) -!KO u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) -!KO end if -!KO end if -!KO else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & -!KO .and. col%itype(ci) /= icol_roof) then -!KO if (j >= jtop(ci)) then -!KO if (j == jtop(ci)) then -!KO u(ci,j) = r(ci,j) / bet(ci) -!KO else -!KO gam(ci,j) = c(ci,j-1) / bet(ci) -!KO bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) -!KO u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) -!KO end if -!KO end if -!KO end if -!KO if (j >= jtop(ci)) then if (j == jtop(ci)) then u(ci,j) = r(ci,j) / bet(ci) @@ -107,29 +77,15 @@ subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) end if end if -!KO end do end do do j = ubj-1,lbj,-1 do fc = 1,numf ci = filter(fc) -!KO if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & -!KO .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then -!KO if (j >= jtop(ci)) then -!KO u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) -!KO end if -!KO else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & -!KO .and. col%itype(ci) /= icol_roof) then -!KO if (j >= jtop(ci)) then -!KO u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) -!KO end if -!KO end if -!KO if (j >= jtop(ci)) then u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) end if -!KO end do end do diff --git a/src/biogeophys/UrbanParamsType.F90 b/src/biogeophys/UrbanParamsType.F90 index 2e3c7c4766..74b2315a10 100644 --- a/src/biogeophys/UrbanParamsType.F90 +++ b/src/biogeophys/UrbanParamsType.F90 @@ -122,11 +122,7 @@ subroutine Init(this, bounds) ! ! !USES: use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) -!KO use clm_varpar , only : nlevcan, nlevcan, numrad, nlevgrnd, nlevurb -!KO use clm_varpar , only : nlevsoi, nlevgrnd -!KO use clm_varpar , only : numrad, nlevurb -!KO use clm_varctl , only : use_vancouver, use_mexicocity use clm_varcon , only : vkc use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall @@ -198,7 +194,6 @@ subroutine Init(this, bounds) do l = bounds%begl,bounds%endl -!KO ! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom if (lun%urbpoi(l)) then g = lun%gridcell(l) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 3df74fec7f..729cf1d93e 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -540,9 +540,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call CanopyTemperature(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_nolakep, filter(nc)%nolakep, & -!KO filter(nc)%num_urbanc, filter(nc)%urbanc, & -!KO clm_fates, & atm2lnd_inst, canopystate_inst, soilstate_inst, frictionvel_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & @@ -708,9 +706,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_startf('soiltemperature') call SoilTemperature(bounds_clump, & filter(nc)%num_urbanl , filter(nc)%urbanl, & -!KO filter(nc)%num_urbanc , filter(nc)%urbanc, & -!KO filter(nc)%num_nolakec , filter(nc)%nolakec, & atm2lnd_inst, urbanparams_inst, canopystate_inst, water_inst%waterstatebulk_inst, & water_inst%waterdiagnosticbulk_inst, water_inst%waterfluxbulk_inst, & From 03e0c04ac0d464149a76662f334be89ae4d7ad40 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 30 Sep 2019 09:37:22 -0600 Subject: [PATCH 0393/1973] Third step Works for urban and veg single point cases with nlevgrnd=4 and finidat Works for global 1deg NWP case with nlevgrnd=4 and cold start, but not with finidat. Works for global 1deg NWP case with nlevgrnd=5 and finidat --- src/biogeophys/AerosolMod.F90 | 6 +- src/biogeophys/SoilStateInitTimeConstMod.F90 | 4 +- src/biogeophys/SoilStateType.F90 | 40 +-- src/biogeophys/SoilTemperatureMod.F90 | 268 +++++++++---------- src/biogeophys/TemperatureType.F90 | 10 +- src/biogeophys/TotalWaterAndHeatMod.F90 | 2 + src/biogeophys/UrbBuildTempOleson2015Mod.F90 | 2 +- src/biogeophys/WaterStateBulkType.F90 | 4 +- src/biogeophys/WaterStateType.F90 | 12 +- src/biogeophys/Waterlnd2atmBulkType.F90 | 4 +- src/main/ColumnType.F90 | 8 +- src/main/histFileMod.F90 | 17 +- src/main/initVerticalMod.F90 | 10 + src/main/lnd2atmMod.F90 | 4 +- 14 files changed, 202 insertions(+), 189 deletions(-) diff --git a/src/biogeophys/AerosolMod.F90 b/src/biogeophys/AerosolMod.F90 index f6a8761f67..99109f24d0 100644 --- a/src/biogeophys/AerosolMod.F90 +++ b/src/biogeophys/AerosolMod.F90 @@ -7,7 +7,7 @@ module AerosolMod use shr_log_mod , only : errMsg => shr_log_errMsg use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) use decompMod , only : bounds_type - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb use clm_time_manager , only : get_step_size use atm2lndType , only : atm2lnd_type use WaterFluxBulkType , only : waterfluxbulk_type @@ -372,8 +372,8 @@ subroutine Restart(this, bounds, ncid, flag, & logical :: readvar ! determine if variable is on initial file !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(h2osoi_ice_col) == (/bounds%endc,nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osoi_liq_col) == (/bounds%endc,nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(h2osoi_ice_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(h2osoi_liq_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) call restartvar(ncid=ncid, flag=flag, varname='mss_bcpho', xtype=ncd_double, & dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 index 136c21ca1c..277a5d67bd 100644 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ b/src/biogeophys/SoilStateInitTimeConstMod.F90 @@ -361,7 +361,7 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) else if (lun%urbpoi(l) .and. (col%itype(c) /= icol_road_perv) .and. (col%itype(c) /= icol_road_imperv) )then ! Urban Roof, sunwall, shadewall properties set to special value - do lev = 1,nlevgrnd + do lev = 1,max0(nlevgrnd,nlevurb) soilstate_inst%watsat_col(c,lev) = spval soilstate_inst%watfc_col(c,lev) = spval soilstate_inst%bsw_col(c,lev) = spval @@ -377,7 +377,7 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) end if end do - do lev = 1,nlevgrnd + do lev = 1,max0(nlevgrnd,nlevurb) soilstate_inst%tkmg_col(c,lev) = spval soilstate_inst%tksatu_col(c,lev) = spval soilstate_inst%tkdry_col(c,lev) = spval diff --git a/src/biogeophys/SoilStateType.F90 b/src/biogeophys/SoilStateType.F90 index 8a68980450..1712e20527 100644 --- a/src/biogeophys/SoilStateType.F90 +++ b/src/biogeophys/SoilStateType.F90 @@ -7,7 +7,7 @@ module SoilStateType use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) use decompMod , only : bounds_type use abortutils , only : endrun - use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlayer, nlevsno + use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlayer, nlevsno, nlevurb use clm_varcon , only : spval use clm_varctl , only : use_hydrstress, use_cn, use_lch4, use_dynroot use clm_varctl , only : iulog, hist_wrtch4diag @@ -129,40 +129,40 @@ subroutine InitAllocate(this, bounds) allocate(this%cellorg_col (begc:endc,nlevsoi)) ; this%cellorg_col (:,:) = nan allocate(this%cellsand_col (begc:endc,nlevsoi)) ; this%cellsand_col (:,:) = nan allocate(this%cellclay_col (begc:endc,nlevsoi)) ; this%cellclay_col (:,:) = nan - allocate(this%bd_col (begc:endc,nlevgrnd)) ; this%bd_col (:,:) = nan + allocate(this%bd_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%bd_col (:,:) = nan - allocate(this%hksat_col (begc:endc,nlevgrnd)) ; this%hksat_col (:,:) = spval - allocate(this%hksat_min_col (begc:endc,nlevgrnd)) ; this%hksat_min_col (:,:) = spval - allocate(this%hk_l_col (begc:endc,nlevgrnd)) ; this%hk_l_col (:,:) = nan - allocate(this%smp_l_col (begc:endc,nlevgrnd)) ; this%smp_l_col (:,:) = nan + allocate(this%hksat_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%hksat_col (:,:) = spval + allocate(this%hksat_min_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%hksat_min_col (:,:) = spval + allocate(this%hk_l_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%hk_l_col (:,:) = nan + allocate(this%smp_l_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%smp_l_col (:,:) = nan allocate(this%smpmin_col (begc:endc)) ; this%smpmin_col (:) = nan - allocate(this%bsw_col (begc:endc,nlevgrnd)) ; this%bsw_col (:,:) = nan - allocate(this%watsat_col (begc:endc,nlevgrnd)) ; this%watsat_col (:,:) = nan - allocate(this%watdry_col (begc:endc,nlevgrnd)) ; this%watdry_col (:,:) = spval - allocate(this%watopt_col (begc:endc,nlevgrnd)) ; this%watopt_col (:,:) = spval - allocate(this%watfc_col (begc:endc,nlevgrnd)) ; this%watfc_col (:,:) = nan - allocate(this%sucsat_col (begc:endc,nlevgrnd)) ; this%sucsat_col (:,:) = spval + allocate(this%bsw_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%bsw_col (:,:) = nan + allocate(this%watsat_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%watsat_col (:,:) = nan + allocate(this%watdry_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%watdry_col (:,:) = spval + allocate(this%watopt_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%watopt_col (:,:) = spval + allocate(this%watfc_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%watfc_col (:,:) = nan + allocate(this%sucsat_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%sucsat_col (:,:) = spval allocate(this%dsl_col (begc:endc)) ; this%dsl_col (:) = spval!nan allocate(this%soilresis_col (begc:endc)) ; this%soilresis_col (:) = spval!nan allocate(this%soilbeta_col (begc:endc)) ; this%soilbeta_col (:) = nan allocate(this%soilalpha_col (begc:endc)) ; this%soilalpha_col (:) = nan allocate(this%soilalpha_u_col (begc:endc)) ; this%soilalpha_u_col (:) = nan - allocate(this%soilpsi_col (begc:endc,nlevgrnd)) ; this%soilpsi_col (:,:) = nan + allocate(this%soilpsi_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%soilpsi_col (:,:) = nan allocate(this%wtfact_col (begc:endc)) ; this%wtfact_col (:) = nan allocate(this%porosity_col (begc:endc,nlayer)) ; this%porosity_col (:,:) = spval - allocate(this%eff_porosity_col (begc:endc,nlevgrnd)) ; this%eff_porosity_col (:,:) = spval + allocate(this%eff_porosity_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%eff_porosity_col (:,:) = spval allocate(this%gwc_thr_col (begc:endc)) ; this%gwc_thr_col (:) = nan - allocate(this%thk_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%thk_col (:,:) = nan - allocate(this%tkmg_col (begc:endc,nlevgrnd)) ; this%tkmg_col (:,:) = nan - allocate(this%tkdry_col (begc:endc,nlevgrnd)) ; this%tkdry_col (:,:) = nan - allocate(this%tksatu_col (begc:endc,nlevgrnd)) ; this%tksatu_col (:,:) = nan - allocate(this%csol_col (begc:endc,nlevgrnd)) ; this%csol_col (:,:) = nan + allocate(this%thk_col (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%thk_col (:,:) = nan + allocate(this%tkmg_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%tkmg_col (:,:) = nan + allocate(this%tkdry_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%tkdry_col (:,:) = nan + allocate(this%tksatu_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%tksatu_col (:,:) = nan + allocate(this%csol_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%csol_col (:,:) = nan allocate(this%rootr_patch (begp:endp,1:nlevgrnd)) ; this%rootr_patch (:,:) = nan allocate(this%root_depth_patch (begp:endp)) ; this%root_depth_patch (:) = nan - allocate(this%rootr_col (begc:endc,nlevgrnd)) ; this%rootr_col (:,:) = nan + allocate(this%rootr_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%rootr_col (:,:) = nan allocate(this%rootr_road_perv_col (begc:endc,1:nlevgrnd)) ; this%rootr_road_perv_col (:,:) = nan allocate(this%rootfr_patch (begp:endp,1:nlevgrnd)) ; this%rootfr_patch (:,:) = nan allocate(this%crootfr_patch (begp:endp,1:nlevgrnd)) ; this%crootfr_patch (:,:) = nan diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index e411315a2a..a99ce12a40 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -28,6 +28,7 @@ module SoilTemperatureMod use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch + use clm_varpar , only : nlevurb ! ! !PUBLIC TYPES: implicit none @@ -178,10 +179,10 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter integer :: fl ! urban filtered landunit indices integer :: jtop(bounds%begc:bounds%endc) ! top level at each column real(r8) :: dtime ! land model time step (sec) - real(r8) :: cv (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat capacity [J/(m2 K)] - real(r8) :: tk (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! thermal conductivity [W/(m K)] - real(r8) :: fn (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat diffusion through the layer interface [W/m2] - real(r8) :: fn1(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat diffusion through the layer interface [W/m2] + real(r8) :: cv (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! heat capacity [J/(m2 K)] + real(r8) :: tk (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! thermal conductivity [W/(m K)] + real(r8) :: fn (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! heat diffusion through the layer interface [W/m2] + real(r8) :: fn1(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! heat diffusion through the layer interface [W/m2] real(r8) :: dzm ! used in computing tridiagonal matrix real(r8) :: dzp ! used in computing tridiagonal matrix real(r8) :: sabg_lyr_col(bounds%begc:bounds%endc,-nlevsno+1:1) ! absorbed solar radiation (col,lyr) [W/m2] @@ -192,9 +193,9 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter real(r8) :: fn_h2osfc(bounds%begc:bounds%endc) ! heat diffusion through standing-water/soil interface [W/m2] real(r8) :: dz_h2osfc(bounds%begc:bounds%endc) ! height of standing surface water [m] integer, parameter :: nband=5 - real(r8) :: bmatrix(bounds%begc:bounds%endc,nband,-nlevsno:nlevgrnd) ! banded matrix for numerical solution of temperature - real(r8) :: tvector(bounds%begc:bounds%endc,-nlevsno:nlevgrnd) ! initial temperature solution [Kelvin] - real(r8) :: rvector(bounds%begc:bounds%endc,-nlevsno:nlevgrnd) ! RHS vector for numerical solution of temperature + real(r8) :: bmatrix(bounds%begc:bounds%endc,nband,-nlevsno:max0(nlevgrnd,nlevurb)) ! banded matrix for numerical solution of temperature + real(r8) :: tvector(bounds%begc:bounds%endc,-nlevsno:max0(nlevgrnd,nlevurb)) ! initial temperature solution [Kelvin] + real(r8) :: rvector(bounds%begc:bounds%endc,-nlevsno:max0(nlevgrnd,nlevurb)) ! RHS vector for numerical solution of temperature real(r8) :: tk_h2osfc(bounds%begc:bounds%endc) ! thermal conductivity of h2osfc [W/(m K)] [col] real(r8) :: dhsdT(bounds%begc:bounds%endc) ! temperature derivative of "hs" [col] real(r8) :: hs_soil(bounds%begc:bounds%endc) ! heat flux on soil [W/m2] @@ -401,15 +402,14 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter tvector(c,0) = t_h2osfc(c) ! soil layers; top layer will have one offset and one extra coefficient - tvector(c,1:nlevgrnd) = t_soisno(c,1:nlevgrnd) + tvector(c,1:max0(nlevgrnd,nlevurb)) = t_soisno(c,1:max0(nlevgrnd,nlevurb)) enddo call t_startf( 'SoilTempBandDiag') ! Solve the system - - call BandDiagonal(bounds, -nlevsno, nlevgrnd, jtop(begc:endc), jbot(begc:endc), & + call BandDiagonal(bounds, -nlevsno, max0(nlevgrnd,nlevurb), jtop(begc:endc), jbot(begc:endc), & num_nolakec, filter_nolakec, nband, bmatrix(begc:endc, :, :), & rvector(begc:endc, :), tvector(begc:endc, :)) call t_stopf( 'SoilTempBandDiag') @@ -421,7 +421,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter do j = snl(c)+1, 0 t_soisno(c,j) = tvector(c,j-1) !snow layers end do - t_soisno(c,1:nlevgrnd) = tvector(c,1:nlevgrnd) !soil layers + t_soisno(c,1:max0(nlevgrnd,nlevurb)) = tvector(c,1:max0(nlevgrnd,nlevurb)) !soil layers if (frac_h2osfc(c) == 0._r8) then t_h2osfc(c)=t_soisno(c,1) @@ -639,8 +639,8 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & call t_startf( 'SoilThermProp' ) ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) associate( & @@ -1117,14 +1117,14 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & real(r8) :: dtime !land model time step (sec) real(r8) :: heatr !energy residual or loss after melting or freezing real(r8) :: temp1 !temporary variables [kg/m2] - real(r8) :: hm(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !energy residual [W/m2] - real(r8) :: xm(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !melting or freezing within a time step [kg/m2] - real(r8) :: wmass0(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of ice and liquid (kg/m2) - real(r8) :: wice0 (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of ice (kg/m2) - real(r8) :: wliq0 (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of liquid (kg/m2) - real(r8) :: supercool(bounds%begc:bounds%endc,nlevgrnd) !supercooled water in soil (kg/m2) + real(r8) :: hm(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) !energy residual [W/m2] + real(r8) :: xm(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) !melting or freezing within a time step [kg/m2] + real(r8) :: wmass0(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb))!initial mass of ice and liquid (kg/m2) + real(r8) :: wice0 (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb))!initial mass of ice (kg/m2) + real(r8) :: wliq0 (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb))!initial mass of liquid (kg/m2) + real(r8) :: supercool(bounds%begc:bounds%endc,max0(nlevgrnd,nlevurb)) !supercooled water in soil (kg/m2) real(r8) :: propor !proportionality constant (-) - real(r8) :: tinc(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !t(n+1)-t(n) (K) + real(r8) :: tinc(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) !t(n+1)-t(n) (K) real(r8) :: smp !frozen water potential (mm) !----------------------------------------------------------------------- @@ -1284,7 +1284,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & c = filter_nolakec(fc) l = col%landunit(c) - if (col%itype(c) == icol_roof) then + if (col%itype(c) == icol_roof .or. col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then if (h2osoi_ice(c,j) > 0. .AND. t_soisno(c,j) > tfrz) then imelt(c,j) = 1 @@ -1473,7 +1473,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & do fc = 1,num_nolakec c = filter_nolakec(fc) - if (col%itype(c) == icol_roof) then + if (col%itype(c) == icol_roof .or. col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then if (j >= snl(c)+1) then @@ -1930,10 +1930,10 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate(& zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) @@ -2065,11 +2065,11 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & ! !LOCAL VARIABLES: integer :: j,c ! indices integer :: fc ! lake filtered column indices - real(r8) :: rt (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "r" vector for tridiagonal solution + real(r8) :: rt (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! "r" vector for tridiagonal solution real(r8) :: fn_h2osfc(bounds%begc:bounds%endc) ! heat diffusion through standing-water/soil interface [W/m2] real(r8) :: rt_snow(bounds%begc:bounds%endc,-nlevsno:-1) ! RHS vector corresponding to snow layers real(r8) :: rt_ssw(bounds%begc:bounds%endc,1) ! RHS vector corresponding to standing surface water - real(r8) :: rt_soil(bounds%begc:bounds%endc,1:nlevgrnd) ! RHS vector corresponding to soil layer + real(r8) :: rt_soil(bounds%begc:bounds%endc,1:max0(nlevgrnd,nlevurb)) ! RHS vector corresponding to soil layer !----------------------------------------------------------------------- ! Enforce expected array sizes @@ -2079,13 +2079,13 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rvector) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rvector) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) @@ -2145,7 +2145,7 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & c = filter_nolakec(fc) rvector(c, -nlevsno:-1) = rt_snow(c, -nlevsno:-1) rvector(c, 0 ) = rt_ssw(c, 1 ) - rvector(c, 1:nlevgrnd) = rt_soil(c, 1:nlevgrnd ) + rvector(c, 1:max0(nlevgrnd,nlevurb)) = rt_soil(c, 1:max0(nlevgrnd,nlevurb) ) end do end associate @@ -2184,9 +2184,9 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) @@ -2262,9 +2262,9 @@ subroutine SetRHSVec_SnowUrban(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) @@ -2339,9 +2339,9 @@ subroutine SetRHSVec_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) associate( & @@ -2422,9 +2422,9 @@ subroutine SetRHSVec_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) @@ -2504,9 +2504,9 @@ subroutine SetRHSVec_SnowNonUrban(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) associate( & @@ -2586,7 +2586,7 @@ subroutine SetRHSVec_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc,1/)), errMsg(sourcefile, __LINE__)) @@ -2647,14 +2647,14 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate(& begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -2750,13 +2750,13 @@ subroutine SetRHSVec_SoilUrban(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -2833,12 +2833,12 @@ subroutine SetRHSVec_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) @@ -2925,13 +2925,13 @@ subroutine SetRHSVec_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) @@ -3012,13 +3012,13 @@ subroutine SetRHSVec_SoilNonUrban(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) @@ -3097,13 +3097,13 @@ subroutine SetRHSVec_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolak SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) ! ! surface water ----------------------------------------------------------------- @@ -3162,14 +3162,14 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & ! !LOCAL VARIABLES: integer :: j,c ! indices integer :: fc ! lake filtered column indices - real(r8) :: at (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "a" vector for tridiagonal matrix - real(r8) :: bt (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "b" vector for tridiagonal matrix - real(r8) :: ct (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "c" vector for tridiagonal matrix + real(r8) :: at (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! "a" vector for tridiagonal matrix + real(r8) :: bt (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! "b" vector for tridiagonal matrix + real(r8) :: ct (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! "c" vector for tridiagonal matrix real(r8) :: dzm ! used in computing tridiagonal matrix real(r8) :: dzp ! used in computing tridiagonal matrix real(r8) :: bmatrix_snow(bounds%begc:bounds%endc,nband,-nlevsno:-1 ) ! block-diagonal matrix for snow layers real(r8) :: bmatrix_ssw(bounds%begc:bounds%endc,nband, 0:0 ) ! block-diagonal matrix for standing surface water - real(r8) :: bmatrix_soil(bounds%begc:bounds%endc,nband, 1:nlevgrnd) ! block-diagonal matrix for soil layers + real(r8) :: bmatrix_soil(bounds%begc:bounds%endc,nband, 1:max0(nlevgrnd,nlevurb)) ! block-diagonal matrix for soil layers real(r8) :: bmatrix_snow_soil(bounds%begc:bounds%endc,nband,-1:-1) ! off-diagonal matrix for snow-soil interaction real(r8) :: bmatrix_ssw_soil(bounds%begc:bounds%endc,nband, 0:0 ) ! off-diagonal matrix for standing surface water-soil interaction real(r8) :: bmatrix_soil_snow(bounds%begc:bounds%endc,nband, 1:1 ) ! off-diagonal matrix for soil-snow interaction @@ -3178,12 +3178,12 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) @@ -3336,12 +3336,12 @@ subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nb ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_ssw) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_ssw_soil) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_ssw) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) ! Assemble the full matrix @@ -3365,8 +3365,8 @@ subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nb ! Soil bmatrix(c,2:3,1 ) = bmatrix_soil(c,2:3,1 ) - bmatrix(c,2:4,2:nlevgrnd-1) = bmatrix_soil(c,2:4,2:nlevgrnd-1) - bmatrix(c,3:4,nlevgrnd ) = bmatrix_soil(c,3:4,nlevgrnd ) + bmatrix(c,2:4,2:max0(nlevgrnd,nlevurb)-1) = bmatrix_soil(c,2:4,2:max0(nlevgrnd,nlevurb)-1) + bmatrix(c,3:4,max0(nlevgrnd,nlevurb) ) = bmatrix_soil(c,3:4,max0(nlevgrnd,nlevurb) ) ! Soil-Snow bmatrix(c,5,1) = bmatrix_soil_snow(c,5,1) @@ -3405,8 +3405,8 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) @@ -3462,8 +3462,8 @@ subroutine SetMatrix_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3521,8 +3521,8 @@ subroutine SetMatrix_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3600,8 +3600,8 @@ subroutine SetMatrix_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3677,8 +3677,8 @@ subroutine SetMatrix_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3743,8 +3743,8 @@ subroutine SetMatrix_Snow_Soil(bounds, num_nolakec, filter_nolakec, nband, & !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3793,8 +3793,8 @@ subroutine SetMatrix_Snow_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3847,8 +3847,8 @@ subroutine SetMatrix_Snow_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3914,8 +3914,8 @@ subroutine SetMatrix_Snow_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nba !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3981,8 +3981,8 @@ subroutine SetMatrix_Snow_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nban !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -4051,13 +4051,13 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -4135,12 +4135,12 @@ subroutine SetMatrix_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate(& begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -4203,11 +4203,11 @@ subroutine SetMatrix_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & zi => col%zi , & ! Input: [real(r8) (:,:)] interface level below a "z" level (m) @@ -4296,12 +4296,12 @@ subroutine SetMatrix_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) @@ -4393,12 +4393,12 @@ subroutine SetMatrix_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) @@ -4479,8 +4479,8 @@ subroutine SetMatrix_Soil_Snow(bounds, num_nolakec, filter_nolakec, nband, & !------------------------------------------------------------------------------ ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) @@ -4534,8 +4534,8 @@ subroutine SetMatrix_Soil_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) @@ -4590,8 +4590,8 @@ subroutine SetMatrix_Soil_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) associate( & @@ -4657,8 +4657,8 @@ subroutine SetMatrix_Soil_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nba !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) @@ -4729,8 +4729,8 @@ subroutine SetMatrix_Soil_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nban !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) @@ -4802,9 +4802,9 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_ssw) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) @@ -4858,9 +4858,9 @@ subroutine SetMatrix_StandingSurfaceWater_Soil(bounds, num_nolakec, filter_nolak !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_ssw_soil) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) @@ -4912,7 +4912,7 @@ subroutine SetMatrix_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolak ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_ssw) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 87b9a6ffe1..dd47920698 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -204,8 +204,8 @@ subroutine InitAllocate(this, bounds) endif allocate(this%t_h2osfc_col (begc:endc)) ; this%t_h2osfc_col (:) = nan allocate(this%t_h2osfc_bef_col (begc:endc)) ; this%t_h2osfc_bef_col (:) = nan - allocate(this%t_ssbef_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%t_ssbef_col (:,:) = nan - allocate(this%t_soisno_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%t_soisno_col (:,:) = nan + allocate(this%t_ssbef_col (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%t_ssbef_col (:,:) = nan + allocate(this%t_soisno_col (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%t_soisno_col (:,:) = nan allocate(this%t_lake_col (begc:endc,1:nlevlak)) ; this%t_lake_col (:,:) = nan allocate(this%t_grnd_col (begc:endc)) ; this%t_grnd_col (:) = nan allocate(this%t_grnd_r_col (begc:endc)) ; this%t_grnd_r_col (:) = nan @@ -268,7 +268,7 @@ subroutine InitAllocate(this, bounds) allocate(this%liquid_water_temp2_grc (begg:endg)) ; this%liquid_water_temp2_grc (:) = nan ! flags - allocate(this%imelt_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%imelt_col (:,:) = huge(1) + allocate(this%imelt_col (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%imelt_col (:,:) = huge(1) ! emissivities allocate(this%emv_patch (begp:endp)) ; this%emv_patch (:) = nan @@ -276,7 +276,7 @@ subroutine InitAllocate(this, bounds) allocate(this%xmf_col (begc:endc)) ; this%xmf_col (:) = nan allocate(this%xmf_h2osfc_col (begc:endc)) ; this%xmf_h2osfc_col (:) = nan - allocate(this%fact_col (begc:endc, -nlevsno+1:nlevgrnd)) ; this%fact_col (:,:) = nan + allocate(this%fact_col (begc:endc, -nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%fact_col (:,:) = nan allocate(this%c_h2osfc_col (begc:endc)) ; this%c_h2osfc_col (:) = nan end subroutine InitAllocate @@ -670,7 +670,7 @@ subroutine InitCold(this, bounds, & do c = bounds%begc,bounds%endc l = col%landunit(c) - this%t_soisno_col(c,-nlevsno+1:nlevgrnd) = spval + this%t_soisno_col(c,-nlevsno+1:max0(nlevgrnd,nlevurb)) = spval ! Snow level temperatures - all land points if (snl(c) < 0) then diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index dbe5466056..4ca30075c4 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -376,6 +376,8 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & else if (j <= nlevgrnd) then has_h2o = .true. + else + has_h2o = .false. end if end if diff --git a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 b/src/biogeophys/UrbBuildTempOleson2015Mod.F90 index eaf1c14c36..561501ff72 100644 --- a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 +++ b/src/biogeophys/UrbBuildTempOleson2015Mod.F90 @@ -302,7 +302,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) associate(& clandunit => col%landunit , & ! Input: [integer (:)] column's landunit diff --git a/src/biogeophys/WaterStateBulkType.F90 b/src/biogeophys/WaterStateBulkType.F90 index 3c7db77798..dabf007751 100644 --- a/src/biogeophys/WaterStateBulkType.F90 +++ b/src/biogeophys/WaterStateBulkType.F90 @@ -13,7 +13,7 @@ module WaterStateBulkType use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type - use clm_varpar , only : nlevgrnd, nlevsno + use clm_varpar , only : nlevgrnd, nlevsno, nlevurb use clm_varcon , only : spval use WaterStateType , only : waterstate_type use WaterInfoBaseType, only : water_info_base_type @@ -212,7 +212,7 @@ subroutine RestartBulk(this, bounds, ncid, flag, & logical :: readvar !------------------------------------------------------------------------ - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)) , errMsg(sourcefile, __LINE__)) call this%restart (bounds, ncid, flag=flag, & watsat_col=watsat_col(bounds%begc:bounds%endc,:)) diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index 8806a51eda..cee05f2c23 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -115,15 +115,15 @@ subroutine InitAllocate(this, bounds, tracer_vars) call AllocateVar2d(var = this%h2osoi_vol_col, name = 'h2osoi_vol_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & - dim2beg = 1, dim2end = nlevgrnd) + dim2beg = 1, dim2end = max0(nlevgrnd,nlevurb)) call AllocateVar2d(var = this%h2osoi_ice_col, name = 'h2osoi_ice_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & - dim2beg = -nlevsno+1, dim2end = nlevgrnd) + dim2beg = -nlevsno+1, dim2end = max0(nlevgrnd,nlevurb)) call AllocateVar2d(var = this%h2osoi_liq_col, name = 'h2osoi_liq_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & - dim2beg = -nlevsno+1, dim2end = nlevgrnd) + dim2beg = -nlevsno+1, dim2end = max0(nlevgrnd,nlevurb)) call AllocateVar1d(var = this%snocan_patch, name = 'snocan_patch', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_PATCH) @@ -307,8 +307,8 @@ subroutine InitCold(this, bounds, & !----------------------------------------------------------------------- SHR_ASSERT_ALL((ubound(h2osno_input_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)) , errMsg(sourcefile, __LINE__)) ratio = this%info%get_ratio() @@ -530,7 +530,7 @@ subroutine Restart(this, bounds, ncid, flag, & real(r8) :: totwat ! total soil water (mm) !------------------------------------------------------------------------ - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)) , errMsg(sourcefile, __LINE__)) call restartvar(ncid=ncid, flag=flag, & varname=this%info%fname('H2OSFC'), & diff --git a/src/biogeophys/Waterlnd2atmBulkType.F90 b/src/biogeophys/Waterlnd2atmBulkType.F90 index a00668a364..c18d7cbd24 100644 --- a/src/biogeophys/Waterlnd2atmBulkType.F90 +++ b/src/biogeophys/Waterlnd2atmBulkType.F90 @@ -12,7 +12,7 @@ module Waterlnd2atmBulkType ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 use decompMod , only : bounds_type - use clm_varpar , only : nlevgrnd + use clm_varpar , only : nlevgrnd, nlevurb use WaterLnd2atmType , only : waterlnd2atm_type use WaterInfoBaseType, only : water_info_base_type use WaterTracerContainerType, only : water_tracer_container_type @@ -78,7 +78,7 @@ subroutine InitBulkAllocate(this, bounds) begg = bounds%begg; endg= bounds%endg - allocate(this%h2osoi_vol_grc (begg:endg,1:nlevgrnd)) ; this%h2osoi_vol_grc (:,:) = ival + allocate(this%h2osoi_vol_grc (begg:endg,1:max0(nlevgrnd,nlevurb))) ; this%h2osoi_vol_grc (:,:) = ival end subroutine InitBulkAllocate diff --git a/src/main/ColumnType.F90 b/src/main/ColumnType.F90 index 84dccdd96f..a6552f7127 100644 --- a/src/main/ColumnType.F90 +++ b/src/main/ColumnType.F90 @@ -20,7 +20,7 @@ module ColumnType ! use shr_kind_mod , only : r8 => shr_kind_r8 use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak + use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevurb use clm_varcon , only : spval, ispval use shr_sys_mod , only : shr_sys_abort use clm_varctl , only : iulog @@ -116,9 +116,9 @@ subroutine Init(this, begc, endc) ! The following is set in initVerticalMod allocate(this%snl (begc:endc)) ; this%snl (:) = ispval !* cannot be averaged up - allocate(this%dz (begc:endc,-nlevsno+1:nlevgrnd)) ; this%dz (:,:) = nan - allocate(this%z (begc:endc,-nlevsno+1:nlevgrnd)) ; this%z (:,:) = nan - allocate(this%zi (begc:endc,-nlevsno+0:nlevgrnd)) ; this%zi (:,:) = nan + allocate(this%dz (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%dz (:,:) = nan + allocate(this%z (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%z (:,:) = nan + allocate(this%zi (begc:endc,-nlevsno+0:max0(nlevgrnd,nlevurb))) ; this%zi (:,:) = nan allocate(this%zii (begc:endc)) ; this%zii (:) = nan allocate(this%lakedepth (begc:endc)) ; this%lakedepth (:) = spval allocate(this%dz_lake (begc:endc,nlevlak)) ; this%dz_lake (:,:) = nan diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 0092004c37..e38cb186f5 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -15,6 +15,7 @@ module histFileMod use clm_varctl , only : iulog, use_vertsoilc, use_fates use clm_varcon , only : spval, ispval, dzsoi_decomp use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort + use clm_varpar , only : nlevurb use decompMod , only : get_proc_bounds, get_proc_global, bounds_type use GetGlobalValuesMod , only : GetGlobalIndex use GridcellType , only : grc @@ -2251,10 +2252,10 @@ subroutine htape_timeconst3D(t, & /) !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) !------------------------------------------------------------------------------- !*** Non-time varying 3D fields *** @@ -3370,10 +3371,10 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & character(len=*),parameter :: subname = 'hist_htapes_wrapup' !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) ! get current step diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index f452de2edd..7cbae087f1 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -480,11 +480,21 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof col%z(c,1:nlevgrnd) = zsoi(1:nlevgrnd) col%zi(c,0:nlevgrnd) = zisoi(0:nlevgrnd) col%dz(c,1:nlevgrnd) = dzsoi(1:nlevgrnd) + if (nlevgrnd < nlevurb) then + col%z(c,nlevgrnd+1:nlevurb) = spval + col%zi(c,nlevgrnd+1:nlevurb) = spval + col%dz(c,nlevgrnd+1:nlevurb) = spval + end if end if else if (lun%itype(l) /= istdlak) then col%z(c,1:nlevgrnd) = zsoi(1:nlevgrnd) col%zi(c,0:nlevgrnd) = zisoi(0:nlevgrnd) col%dz(c,1:nlevgrnd) = dzsoi(1:nlevgrnd) + if (nlevgrnd < nlevurb) then + col%z(c,nlevgrnd+1:nlevurb) = spval + col%zi(c,nlevgrnd+1:nlevurb) = spval + col%dz(c,nlevgrnd+1:nlevurb) = spval + end if end if end do diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index 8350b51ea9..3e28bb4d4c 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -11,7 +11,7 @@ module lnd2atmMod use shr_log_mod , only : errMsg => shr_log_errMsg use shr_megan_mod , only : shr_megan_mechcomps_n use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n - use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. + use clm_varpar , only : numrad, ndst, nlevgrnd, nlevurb !ndst = number of dust bins. use clm_varcon , only : rair, grav, cpair, hfus, tfrz, spval use clm_varctl , only : iulog, use_lch4 use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND @@ -98,7 +98,7 @@ subroutine lnd2atm_minimal(bounds, & end associate end do - call c2g(bounds, nlevgrnd, & + call c2g(bounds, max0(nlevgrnd,nlevurb), & water_inst%waterstatebulk_inst%h2osoi_vol_col (bounds%begc:bounds%endc, :), & water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc (bounds%begg:bounds%endg, :), & c2l_scale_type= 'urbanf', l2g_scale_type='unity') From 3b2b32b280839de218023199569a3d5242df1784 Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 1 Oct 2019 11:16:50 -0600 Subject: [PATCH 0394/1973] changes necessary for the CTSM LILAC cap. --- src/cpl/lilac/for_negin | 19 + src/cpl/lilac/lnd_comp_esmf.F90 | 1024 ++++++++++++++++++ src/cpl/lilac/lnd_import_export.F90 | 1519 +++++++++++++++++++++++++++ src/cpl/lilac/lnd_shr_methods.F90 | 794 ++++++++++++++ src/cpl/lilac/shr_utils_mod.F90 | 47 + src/cpl/mct/clm_cpl_indices.F90 | 330 ++++++ src/cpl/mct/lnd_comp_mct.F90 | 688 ++++++++++++ src/cpl/mct/lnd_import_export.F90 | 431 ++++++++ 8 files changed, 4852 insertions(+) create mode 100644 src/cpl/lilac/for_negin create mode 100644 src/cpl/lilac/lnd_comp_esmf.F90 create mode 100644 src/cpl/lilac/lnd_import_export.F90 create mode 100644 src/cpl/lilac/lnd_shr_methods.F90 create mode 100644 src/cpl/lilac/shr_utils_mod.F90 create mode 100644 src/cpl/mct/clm_cpl_indices.F90 create mode 100644 src/cpl/mct/lnd_comp_mct.F90 create mode 100644 src/cpl/mct/lnd_import_export.F90 diff --git a/src/cpl/lilac/for_negin b/src/cpl/lilac/for_negin new file mode 100644 index 0000000000..c5986a0408 --- /dev/null +++ b/src/cpl/lilac/for_negin @@ -0,0 +1,19 @@ + ! Initialize PIO + + integer, pointer :: comms(:), comps(:) + character(len=32), allocatable :: compLabels(:) + logical, allocatable :: comp_iamin(:) + integer, allocatable :: comp_comm_iam(:) + + allocate(comms(1), comps(1), compLabels(1), comp_iamin(1), comp_comm_iam(1)) + + comms(1) = Global_Comm + comps(1) = 1 + compLabels(1) = 'lnd' + comp_iamin(1) = .true. + + call ESMF_VMGet(vm, mpiCommunicator=comms(1), localPet=comp_comm_iam(1), rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call shr_pio_init2(comps, compLabel, comp_iamin, comms, comp_comm_iam) + diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 new file mode 100644 index 0000000000..48f17e9525 --- /dev/null +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -0,0 +1,1024 @@ +module lnd_comp_esmf + + !---------------------------------------------------------------------------- + ! This is the ESMF cap for CTSM + !---------------------------------------------------------------------------- + use ESMF + use shr_kind_mod , only : shr_kind_r8, SHR_KIND_CL + use shr_string_mod , only : shr_string_listGetNum + use abortutils , only : endrun + use domainMod , only : ldomain + use decompMod , only : ldecomp, bounds_type, get_proc_bounds + use clm_varctl , only : iulog + !use clm_initializeMod , only : lnd2atm_inst, atm2lnd_inst + !use clm_cpl_indices + use lnd_import_export + + use ESMF + use mct_mod , only : mct_world_init, mct_world_clean, mct_die + use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl + use shr_sys_mod , only : shr_sys_abort + use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit + use shr_orb_mod , only : shr_orb_decl + use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date + use spmdMod , only : masterproc, mpicom, spmd_init + use decompMod , only : bounds_type, ldecomp, get_proc_bounds + use domainMod , only : ldomain + use controlMod , only : control_setNL + use clm_varorb , only : eccen, obliqr, lambm0, mvelpp + use clm_varctl , only : single_column, clm_varctl_set, iulog + use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_time_manager , only : set_timemgr_init, advance_timestep + use clm_time_manager , only : set_nextsw_cday, update_rad_dtime + use clm_time_manager , only : get_nstep, get_step_size + use clm_time_manager , only : get_curr_date, get_curr_calday + use clm_initializeMod , only : initialize1, initialize2 + use clm_driver , only : clm_drv + use perf_mod , only : t_startf, t_stopf, t_barrierf + use lnd_import_export , only : import_fields, export_fields + use lnd_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit + use lnd_shr_methods , only : log_clock_advance + !use lnd_import_export , only : realize_fields + ! !PUBLIC MEMBER FUNCTIONS: + implicit none + private ! By default make data private except + ! + public :: lnd_register ! register clm initial, run, final methods + public :: lnd_init ! clm initialization + public :: lnd_run ! clm run phase + public :: lnd_final ! clm finalization/cleanup + + !NS: from https://github.com/amangupta2/CAM_Trunk/blob/33b0fd4bc2c3b945b93655ee8b5e20f1acf5625b/components/cam/src/cpl/nuopc/atm_comp_nuopc.F90 + !-------------------------------------------------------------------------- + ! Private module data + !-------------------------------------------------------------------------- + + !type fld_list_type + ! character(len=128) :: stdname + !end type fld_list_type + + integer , parameter :: dbug_flag = 6 + type(ESMF_Field), public, save :: field + !type(cam_in_t) , pointer :: cam_in(:) + !type(cam_out_t) , pointer :: cam_out(:) + !integer , pointer :: dof(:) ! global index space decomposition + !integer :: shrlogunit ! original log unit + !integer :: shrloglev ! original log level + !character(len=256) :: rsfilename_spec_cam ! Filename specifier for restart surface file + !character(*) ,parameter :: modName = "ctsm_lilac" + !character(*) ,parameter :: u_FILE_u = & + ! __FILE__ + + + + character(len=CL) :: flds_scalar_name = '' + integer :: flds_scalar_num = 0 + integer :: flds_scalar_index_nx = 0 + integer :: flds_scalar_index_ny = 0 + integer :: flds_scalar_index_nextsw_cday = 0 + logical :: glc_present = .false. ! .true. => running with a non-stubGLC model + logical :: rof_prognostic = .false. ! .true. => running with a prognostic ROF model + integer, parameter :: dbug = 1 + !character(*),parameter :: modName = "(lnd_comp_nuopc)" + character(*) ,parameter :: modName = "ctsm_lilac" + character(*),parameter :: u_FILE_u = & + __FILE__! + type(ESMF_Mesh) :: Emesh, EMeshTemp, lnd_mesh ! esmf meshes +!=============================================================================== +contains +!=============================================================================== + + subroutine lnd_register(comp, rc) + + ! Register the clm initial, run, and final phase methods with ESMF. + + ! input/output argumenents + type(ESMF_GridComp) :: comp ! CLM grid component + integer, intent(out) :: rc ! return status + + ! local variables + character(len=*), parameter :: subname=trim(modname)//': [lnd_register] ' + !----------------------------------------------------------------------- + + print *, "in lnd register routine" + rc = ESMF_SUCCESS + call ESMF_LogSet ( flush =.true.) + call ESMF_LogWrite(subname//"lnd gridcompset entry points setting ....!", ESMF_LOGMSG_INFO) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, lnd_init, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, lnd_run, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, lnd_final, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_LogWrite(subname//"lnd gridcompset entry points finished!", ESMF_LOGMSG_INFO) + end subroutine lnd_register + + !=============================================================================== + + subroutine lnd_init(comp, import_state, export_state, clock, rc) + + ! Initialize land surface model and obtain relevant atmospheric model arrays + ! back from (i.e. albedos, surface temperature and snow cover over land). + + use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel + use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel + use shr_file_mod , only : shr_file_getUnit, shr_file_setIO + use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday + !use clm_initializeMod, only : initialize1, initialize2, lnd2atm_inst, lnd2glc_inst + use clm_initializeMod, only : initialize1, initialize2 + use clm_varctl , only : finidat,single_column, clm_varctl_set, noland + + use clm_varctl , only : inst_index, inst_suffix, inst_name + use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_varorb , only : eccen, obliqr, lambm0, mvelpp + use controlMod , only : control_setNL + use spmdMod , only : masterproc, spmd_init + !NS + use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst + use mpi, only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE + use shr_pio_mod, only : shr_pio_init1, shr_pio_init2 + use glc_elevclass_mod , only : glc_elevclass_init + ! input/output variables + type(ESMF_GridComp) :: comp ! CLM gridded component + type(ESMF_State) :: import_state ! CLM import state + type(ESMF_State) :: export_state ! CLM export state + type(ESMF_Clock) :: clock ! ESMF synchronization clock + integer, intent(out) :: rc ! Return code + + ! local variable + integer :: mpicom_lnd, mpicom_vm, gsize + type(ESMF_ArraySpec) :: arrayspec + type(ESMF_DistGrid) :: distgrid + type(ESMF_Array) :: dom, l2x, x2l + type(ESMF_VM) :: vm + integer :: lsize ! size of attribute vector + integer :: g,i,j ! indices + integer :: dtime_sync ! coupling time-step from the input synchronization clock + integer :: dtime_clm ! clm time-step + logical :: exists ! true if file exists + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + character(len=SHR_KIND_CL) :: caseid ! case identifier name + character(len=SHR_KIND_CL) :: ctitle ! case description title + character(len=SHR_KIND_CL) :: starttype ! start-type (startup, continue, branch, hybrid) + character(len=SHR_KIND_CL) :: calendar ! calendar type name + character(len=SHR_KIND_CL) :: hostname ! hostname of machine running on + character(len=SHR_KIND_CL) :: version ! Model version + character(len=SHR_KIND_CL) :: username ! user running the model + integer :: nsrest ! clm restart type + integer :: ref_ymd ! reference date (YYYYMMDD) + integer :: ref_tod ! reference time of day (sec) + integer :: start_ymd ! start date (YYYYMMDD) + integer :: start_tod ! start time of day (sec) + integer :: stop_ymd ! stop date (YYYYMMDD) + integer :: stop_tod ! stop time of day (sec) + logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type + logical :: atm_aero ! Flag if aerosol data sent from atm model + integer :: lbnum ! input to memory diagnostic + integer :: shrlogunit,shrloglev ! old values for log unit and log level + integer :: logunit ! original log unit + + type(bounds_type) :: bounds ! bounds + integer :: nfields + real(R8), pointer :: fptr(:, :) + character(ESMF_MAXSTR) :: convCIM, purpComp + integer :: ierr + + ! MCT + integer :: ncomps = 1 + integer, pointer :: comps(:) ! array with component ids + integer, pointer :: comms(:) ! array with mpicoms + character(len=32), allocatable :: compLabels(:) + integer,allocatable :: comp_id(:) ! for pio init2 + character(len=64),allocatable :: comp_name(:) ! for pio init2 + integer,allocatable :: comp_comm(:) ! for pio_init2 + logical,allocatable :: comp_iamin(:) ! for pio init2 + integer,allocatable :: comp_comm_iam(:) ! for pio_init2 + + ! + character(len=32), parameter :: sub = 'lnd_init' + character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" + + + integer :: ymd ! CTSM current date (YYYYMMDD) + integer :: orb_iyear_align ! associated with model year + integer :: orb_cyear ! orbital year for current orbital computation + integer :: orb_iyear ! orbital year for current orbital computation + integer :: orb_eccen ! orbital year for current orbital computation + integer :: yy, mm ,dd , curr_tod, curr_ymd ! orbital year for current orbital computation + + !----------------------------------------------------------------------- + ! NS : from + ! https://github.com/amangupta2/CAM_Trunk/blob/33b0fd4bc2c3b945b93655ee8b5e20f1acf5625b/components/cam/src/cpl/nuopc/atm_comp_nuopc.F90 + + !local variables + type(ESMF_Time) :: currTime ! Current time + type(ESMF_Time) :: startTime ! Start time + type(ESMF_Time) :: stopTime ! Stop time + type(ESMF_Time) :: refTime ! Ref time + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Calendar) :: esmf_calendar ! esmf calendar + type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type + !type(ESMF_DistGrid) :: distGrid + !type(ESMF_Field) :: field + + + character(len=*), parameter :: subname=trim(modName)//': [lnd_init_lilac_cap] ' + + ! NS: From : + integer, pointer :: gindex(:) ! global index space for land and ocean points + integer, pointer :: gindex_lnd(:) ! global index space for just land points + integer, pointer :: gindex_ocn(:) ! global index space for just ocean points + character(ESMF_MAXSTR) :: cvalue ! config data + integer :: nlnd, nocn ! local size ofarrays + !integer :: g,n ! indices + integer :: n ! indices + + + integer :: dtime ! time step increment (sec) + + type(ESMF_FieldBundle) :: c2l_fb + type(ESMF_FieldBundle) :: l2c_fb + + + type(ESMF_State) :: importState, exportState + + + integer :: glc_nec = 10 ! number of glc elevation classes + !! FIXME(ns, 2019-07-29) + !! glc_nec should be set from driver or higher level lilac? + integer :: compid ! component id + !------------------------------------------------------------------------ + + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//' is called!', ESMF_LOGMSG_INFO) + + !------------------------------------------------------------------------ + ! Initialize clm MPI communicator + !------------------------------------------------------------------------ + call ESMF_VMGetCurrent(vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + call ESMF_LogWrite(subname//"ESMF_VMGetCurrent", ESMF_LOGMSG_INFO) + call ESMF_VMPrint (vm, rc = rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + call ESMF_VMGet(vm, mpiCommunicator=mpicom_vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + call ESMF_LogWrite(subname//"ESMF_VMGet", ESMF_LOGMSG_INFO) + + ! duplicate the mpi communicator from the current VM + call MPI_Comm_dup(mpicom_vm, mpicom_lnd, rc) + call ESMF_LogWrite(subname//"MPI_Comm_dup...", ESMF_LOGMSG_INFO) + + !!!! NS : BOTH MPI_INIT and PIO_INIT1 are in lilac_mod.F90 + + + !------------------------------------------------------------------------ + ! Initialize mct + ! (needed for data models and cice prescribed capability) + ! (needed for data model share code - e.g. nitrogen deposition) + !------------------------------------------------------------------------ + ! TODO: FIX THIS PLEASE!!!! + + allocate(comms(1), comps(1), compLabels(1), comp_iamin(1), comp_comm_iam(1), comp_name(1),stat=ierr) + + comms(1) = mpicom_lnd !or call MPI_Comm_dup(mpicom_vm, comms(1), ierr) + comps(1) = 1 + compLabels(1) = 'LND' + comp_iamin(1) = .true. + comp_name(1) = 'LND' + + call ESMF_VMGet(vm, mpiCommunicator=comms(1), localPet=comp_comm_iam(1), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + call shr_pio_init2(comps, compLabels, comp_iamin, comms, comp_comm_iam) + + call ESMF_LogWrite(subname//"after shr_pio_init2", ESMF_LOGMSG_INFO) + + call ESMF_LogWrite(subname//"Now calling mct_world_init", ESMF_LOGMSG_INFO) + call mct_world_init(ncomps, mpicom_lnd, comms, comps) + call ESMF_LogWrite(subname//"mct world initialized! ", ESMF_LOGMSG_INFO) + + !deallocate(comms, comps, compLabels, comp_iamin, comp_comm_iam, comp_name) ??? + + ! Initialize model mpi info + compid = 1 + call spmd_init( mpicom_lnd, compid) + call ESMF_LogWrite(subname//"initialized model mpi info using spmd_init", ESMF_LOGMSG_INFO) + + !------------------------------------------------------------------------ + !--- Log File --- + !------------------------------------------------------------------------ + + inst_name = 'LND' + inst_index = 1 + inst_suffix = "" + + ! Initialize io log unit + !! TODO: Put this in a subroutine..... + call shr_file_getLogUnit (shrlogunit) + if (masterproc) then + inquire(file='lnd_modelio.nml'//trim(inst_suffix),exist=exists) + if (exists) then + iulog = shr_file_getUnit() + call shr_file_setIO('lnd_modelio.nml'//trim(inst_suffix),iulog) + end if + write(iulog,format) "CLM land model initialization" + else + iulog = shrlogunit + end if + + call shr_file_getLogLevel(shrloglev) + call shr_file_setLogUnit (iulog) + + !------------------------------------------------------------------------ + !--- Orbital Values --- + !------------------------------------------------------------------------ + + + ! TODO: orbital values should be provided by lilac - but for now lets use defaults + !! hard wire these these in and we can decide on maybe having a + !namelist/ + + !call shr_cal_date2ymd(ymd,year,month,day) + !orb_cyear = orb_iyear + (year - orb_iyear_align) + + ! call shr_orb_params(& + ! orb_cyear=2000, orb_eccen=orb_eccen, orb_obliq=orb_obliq, orb_mvelp=orb_mvelpp, & + ! orb_obliqr=obliqr, orb_lambm0=orb_lambm0, orb_mvelpp=orb_mvelpp, masterproc) + + !---------------------- + ! Consistency check on namelist filename + !---------------------- + call control_setNL("lnd_in") + + !---------------------- + ! Get properties from clock + !---------------------- + + + call ESMF_ClockGet( clock, & + currTime=currTime, startTime=startTime, stopTime=stopTime, refTime=RefTime, & + timeStep=timeStep, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=curr_tod, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,curr_ymd) + + call ESMF_TimeGet( startTime, yy=yy, mm=mm, dd=dd, s=start_tod, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,start_ymd) + + call ESMF_TimeGet( stopTime, yy=yy, mm=mm, dd=dd, s=stop_tod, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,stop_ymd) + + call ESMF_TimeGet( refTime, yy=yy, mm=mm, dd=dd, s=ref_tod, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,ref_ymd) + + call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (esmf_caltype == ESMF_CALKIND_NOLEAP) then + calendar = shr_cal_noleap + else if (esmf_caltype == ESMF_CALKIND_GREGORIAN) then + calendar = shr_cal_gregorian + else + call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) + end if + + ! TODO: how do we set case_name and nsrest - should we hardwire for now? + caseid = 'test_lilac' + nsrest = nsrStartup + call ESMF_LogWrite(subname//"time manager Initialized....", ESMF_LOGMSG_INFO) + + !---------------------- + ! Initialize CTSM time manager + !---------------------- + + call set_timemgr_init( & + calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & + ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & + stop_tod_in=stop_tod) + call ESMF_LogWrite(subname//"time manager is set now!", ESMF_LOGMSG_INFO) + + !---------------------- + ! Read namelist, grid and surface data + !---------------------- + + ! set default values for run control variables + call clm_varctl_set(caseid_in=caseid, nsrest_in=nsrest) + call ESMF_LogWrite(subname//"default values for run control variables are set...", ESMF_LOGMSG_INFO) + + + + !---------------------- + ! Initialize glc_elevclass module + !---------------------- + call glc_elevclass_init(glc_nec) + + !---------------------- + ! Initialize1 + !---------------------- + + ! note that the memory for gindex_ocn will be allocated in the following call + call initialize1(gindex_ocn) + ! call initialize1() + + call ESMF_LogWrite(subname//"initialize1 done...", ESMF_LOGMSG_INFO) + + ! obtain global index array for just land points which includes mask=0 or ocean points + call get_proc_bounds( bounds ) + + !print ,* "bound is :", bounds + !print ,* "bounds%begg :", bounds%begg + !print ,* "bounds%endg : ", bounds%endg + nlnd = bounds%endg - bounds%begg + 1 + allocate(gindex_lnd(nlnd)) + !print ,* "nlnd is :", nlnd + do g = bounds%begg,bounds%endg + n = 1 + (g - bounds%begg) + gindex_lnd(n) = ldecomp%gdc2glo(g) + end do + + call ESMF_LogWrite(subname//"obtained global index", ESMF_LOGMSG_INFO) + + ! create a global index that includes both land and ocean points + nocn = size(gindex_ocn) + allocate(gindex(nlnd + nocn)) + do n = 1,nlnd+nocn + if (n <= nlnd) then + gindex(n) = gindex_lnd(n) + else + gindex(n) = gindex_ocn(n-nlnd) + end if + end do + + ! create distGrid from global index array + DistGrid = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + deallocate(gindex) + call ESMF_LogWrite(subname//"DistGrid created......", ESMF_LOGMSG_INFO) + + !-------------------------------- + ! generate the mesh on ctsm distribution + !-------------------------------- + + ! TODO: mesh file should come into clm as a namelist for lilac only + ! for now need to hardwire this in cvalue here + cvalue = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' ! this will need to be filled in to run + + EMeshTemp = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (masterproc) then + write(iulog,*)'mesh file for domain is ',trim(cvalue) + end if + + ! recreate the mesh using the above distGrid + EMesh = ESMF_MeshCreate(EMeshTemp, elementDistgrid=Distgrid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_LogWrite(subname//" Create Mesh using distgrid ....", ESMF_LOGMSG_INFO) + lnd_mesh = EMesh + !-------------------------------- + ! Finish initializing ctsm + !-------------------------------- + call ESMF_LogWrite(subname//"before initialize2", ESMF_LOGMSG_INFO) + + call initialize2() + + call ESMF_LogWrite(subname//"initialize2 done...", ESMF_LOGMSG_INFO) + + !-------------------------------- + ! Check that ctsm internal dtime aligns with ctsm coupling interval + !-------------------------------- + call ESMF_LogWrite(subname//"cheking CTSM dtime and coupling intervals....", ESMF_LOGMSG_INFO) + + call ESMF_ClockGet( clock, timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_TimeIntervalGet( timeStep, s=dtime_sync, rc=rc ) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + dtime_clm = get_step_size() + + if (masterproc) then + write(iulog,*)'dtime_sync= ',dtime_sync,' dtime_ctsm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) + end if + if (mod(dtime_sync,dtime_clm) /= 0) then + write(iulog,*)'ctsm dtime ',dtime_clm,' and clock dtime ',dtime_sync,' never align' + rc = ESMF_FAILURE + return + end if + + !-------------------------------- + ! Create import state (only assume input from atm - not rof and glc) + !-------------------------------- + + c2l_fb = ESMF_FieldBundleCreate ( name='c2l_fb', rc=rc) + + + call fldbundle_add( 'Sa_z' , c2l_fb,rc) !1 + call fldbundle_add( 'Sa_topo' , c2l_fb,rc) !2 + call fldbundle_add( 'Sa_u' , c2l_fb,rc) !3 + call fldbundle_add( 'Sa_v' , c2l_fb,rc) !4 + call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) !5 + call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) !6 + call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) !7 + call fldbundle_add( 'Sa_shum' , c2l_fb,rc) !8 + + call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) !9 + call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) !10 + call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) !11 + call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) !12 + call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) !13 + call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) !14 + call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) !15 + call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) !16 + call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) !17 + call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/), rc=rc) + !call ESMF_StateAdd(importState, fieldbundleList = (/c2l_fb/), rc=rc) + + ! Create export state + + l2c_fb = ESMF_FieldBundleCreate(name='l2c_fb', rc=rc) + !call fldbundle_add( 'Sl_lfrint' , l2c_fb,rc) !1 + call fldbundle_add( 'Sl_lfrin' , l2c_fb,rc) !1 + call fldbundle_add( 'Sl_t' , l2c_fb,rc) !2 + call fldbundle_add( 'Sl_tref' , l2c_fb,rc) !3 + call fldbundle_add( 'Sl_qref' , l2c_fb,rc) !4 + call fldbundle_add( 'Sl_avsdr' , l2c_fb,rc) !5 + call fldbundle_add( 'Sl_anidr' , l2c_fb,rc) !6 + call fldbundle_add( 'Sl_avsdf' , l2c_fb,rc) !7 + call fldbundle_add( 'Sl_anidf' , l2c_fb,rc) !8 + call fldbundle_add( 'Sl_snowh' , l2c_fb,rc) !9 + call fldbundle_add( 'Fall_u10' , l2c_fb,rc) !10 + call fldbundle_add( 'Fall_fv' , l2c_fb,rc) !11 + call fldbundle_add( 'Fall_ram1' , l2c_fb,rc) !12 + !call fldbundle_add( 'Fall_taux' , l2c_fb,rc) !10 + !call fldbundle_add( 'Fall_lwup' , l2c_fb,rc) !14 + !call fldbundle_add( 'Fall_evap' , l2c_fb,rc) !15 + !call fldbundle_add( 'Fall_swniet' , l2c_fb,rc) !16 + call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb/), rc=rc) + !call ESMF_StateAdd(exportState, fieldbundleList = (/l2c_fb/), rc=rc) + + + + + + + + + + + + !-------------------------------- + ! Create land export state + !-------------------------------- + call ESMF_LogWrite(subname//"Creating land export state", ESMF_LOGMSG_INFO) + + ! FIXME (NS, 2019-07-30) + ! FIX THIS EXPORT STATES!!!!!! MAYBE REWRITE WITH THE ORIGINAL STRUCTURE + ! IN MIND + + ! Fill in export state at end of initialization + call export_fields(comp, bounds, glc_present, rof_prognostic, & + water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_LogWrite(subname//"Getting Calendar Day of nextsw calculation...", ESMF_LOGMSG_INFO) + + ! Get calendar day of next sw (shortwave) calculation (nextsw_cday) + if (nsrest == nsrStartup) then + call ESMF_ClockGet( clock, currTime=currTime, rc=rc ) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_TimeGet( currTime, dayOfYear_r8=nextsw_cday, rc=rc ) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + end if + + + ! Set nextsw_cday + call ESMF_LogWrite(subname//"Setting nextsw cday......", ESMF_LOGMSG_INFO) + !call ESMF_LogWrite(subname//nextsw_cday, ESMF_LOGMSG_INFO) + call set_nextsw_cday( nextsw_cday ) + + ! Set Attributes + call ESMF_LogWrite(subname//"setting attribute!", ESMF_LOGMSG_INFO) + + call ESMF_AttributeSet(export_state, name="lnd_nx", value=ldomain%ni, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"setting attribute! lnd_nx", ESMF_LOGMSG_INFO) + + call ESMF_AttributeSet(export_state, name="lnd_ny", value=ldomain%nj, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"setting attribute-lnd_ny!", ESMF_LOGMSG_INFO) + + + + + call ESMF_LogWrite(subname//"State_SetScalar....!", ESMF_LOGMSG_INFO) + !Set scalars in export state + !call State_SetScalar(dble(ldomain%ni), flds_scalar_index_nx, export_state, & + ! flds_scalar_name, flds_scalar_num, rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + !call State_SetScalar(dble(ldomain%nj), flds_scalar_index_ny, exportState, & + ! flds_scalar_name, flds_scalar_num, rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + + !-------------------------------- + ! diagnostics + !-------------------------------- + + if (dbug > 1) then + call State_diagnose(export_state, subname//':ExportState',rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif + + + + ! Reset shr logging to original values + + call shr_file_setLogUnit (shrlogunit) + call shr_file_setLogLevel(shrloglev) + +#ifdef USE_ESMF_METADATA + convCIM = "CIM" + purpComp = "Model Component Simulation Description" + call ESMF_AttributeAdd(comp, convention=convCIM, purpose=purpComp, rc=rc) + call ESMF_AttributeSet(comp, "ShortName", "CTSM", convention=convCIM, purpose=purpComp, rc=rc) + call ESMF_AttributeSet(comp, "LongName", "Community Land Model", convention=convCIM, purpose=purpComp, rc=rc) + call ESMF_AttributeSet(comp, "Description", "Community Land Model", convention=convCIM, purpose=purpComp, rc=rc) + call ESMF_AttributeSet(comp, "ReleaseDate", "2017", convention=convCIM, purpose=purpComp, rc=rc) + call ESMF_AttributeSet(comp, "ModelType", "Terrestrial", convention=convCIM, purpose=purpComp, rc=rc) + call ESMF_AttributeSet(comp, "Name", "TBD", convention=convCIM, purpose=purpComp, rc=rc) + call ESMF_AttributeSet(comp, "EmailAddress", TBD, convention=convCIM, purpose=purpComp, rc=rc) + call ESMF_AttributeSet(comp, "ResponsiblePartyRole", "contact", convention=convCIM, purpose=purpComp, rc=rc) +#endif + + +#if (defined _MEMTRACE) + if(masterproc) then + write(iulog,*) TRIM(Sub) // ':end::' + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_int:end::',lbnum) + call memmon_reset_addr() + endif +#endif + + call ESMF_LogWrite(subname//' CTSM INITIALIZATION DONE SUCCESSFULLY!!!! ', ESMF_LOGMSG_INFO) + + end subroutine lnd_init + + !--------------------------------------------------------------------------- + + !subroutine fldbundle_add(stdname, fldptr, fieldbundle,rc) + subroutine fldbundle_add(stdname, fieldbundle,rc) + type(ESMF_Field) :: field + !type(ESMF_Mesh) :: lnd_mesh + character(len=*), intent(in) :: stdname + type (ESMF_FieldBundle) :: fieldbundle + integer, intent(out) :: rc + + print *, "in lnd register routine" + + rc = ESMF_SUCCESS + + !field = ESMF_FieldCreate(lnd_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(stdname), rc=rc) + field = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(stdname), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + end subroutine fldbundle_add + + !--------------------------------------------------------------------------- + subroutine lnd_run(gcomp, import_state, export_state, clock, rc) + + !------------------------ + ! Run CTSM + !------------------------ + + use clm_instMod , only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst + use lnd_import_export , only : import_fields, export_fields + use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst + + ! input/output variables + type(ESMF_GridComp) :: gcomp ! CLM gridded component + type(ESMF_State) :: import_state ! CLM import state + type(ESMF_State) :: export_state ! CLM export state + type(ESMF_Clock) :: clock ! ESMF synchronization clock + integer, intent(out) :: rc ! Return code + + ! local variables: + type(ESMF_Alarm) :: alarm + type(ESMF_Time) :: currTime + type(ESMF_Time) :: nextTime + type(ESMF_State) :: importState, exportState + character(ESMF_MAXSTR) :: cvalue + character(ESMF_MAXSTR) :: case_name ! case name + integer :: ymd ! CTSM current date (YYYYMMDD) + integer :: yr ! CTSM current year + integer :: mon ! CTSM current month + integer :: day ! CTSM current day + integer :: tod ! CTSM current time of day (sec) + integer :: ymd_sync ! Sync date (YYYYMMDD) + integer :: yr_sync ! Sync current year + integer :: mon_sync ! Sync current month + integer :: day_sync ! Sync current day + integer :: tod_sync ! Sync current time of day (sec) + integer :: dtime ! time step increment (sec) + integer :: nstep ! time step index + logical :: rstwr ! .true. ==> write restart file before returning + logical :: nlend ! .true. ==> last time-step + logical :: dosend ! true => send data back to driver + logical :: doalb ! .true. ==> do albedo calculation on this time step + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + real(r8) :: caldayp1 ! ctsm calday plus dtime offset + integer :: lbnum ! input to memory diagnostic + integer :: g,i ! counters + real(r8) :: calday ! calendar day for nstep + real(r8) :: declin ! solar declination angle in radians for nstep + real(r8) :: declinp1 ! solar declination angle in radians for nstep+1 + real(r8) :: eccf ! earth orbit eccentricity factor + type(bounds_type) :: bounds ! bounds + character(len=32) :: rdate ! date char string for restart file names + integer :: shrlogunit ! original log unit + character(len=*),parameter :: subname=trim(modName)//':[lnd_run] ' + !------------------------------------------------------------------------------- + + + + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + + call shr_file_getLogUnit (shrlogunit) + call shr_file_setLogUnit (iulog) + call ESMF_LogWrite(subname//' shr_file_getLogunits....', ESMF_LOGMSG_INFO) + +#if (defined _MEMTRACE) + if(masterproc) then + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_comp_nuopc_ModelAdvance:start::',lbnum) + endif +#endif + + !-------------------------------- + ! Determine time of next atmospheric shortwave calculation + !-------------------------------- + + !call ESMF_AttributeGet(export_state, name="nextsw_cday", value=nextsw_cday, rc=rc) + !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + + !call set_nextsw_cday( nextsw_cday ) + + ! in nuopc it is like this...... + !call State_GetScalar(import_state, & + ! flds_scalar_index_nextsw_cday, nextsw_cday, & + ! flds_scalar_name, flds_scalar_num, rc) + !call ESMF_LogWrite(subname//'after state_getscalar for determining nextsw_cday', ESMF_LOGMSG_INFO) + !call set_nextsw_cday( nextsw_cday ) + !call ESMF_LogWrite(subname//'settitng nextsw_cday', ESMF_LOGMSG_INFO) + + + !---------------------- + ! Obtain orbital values + !---------------------- + + !call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !read(cvalue,*) eccen + + !call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !read(cvalue,*) obliqr + + !call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !read(cvalue,*) lambm0 + + !call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !read(cvalue,*) mvelpp + + + + + !-------------------------------- + ! Unpack import state + !-------------------------------- + + call t_startf ('lc_lnd_import') + + call get_proc_bounds(bounds) + call ESMF_LogWrite(subname//'after get_proc_bounds', ESMF_LOGMSG_INFO) + !call import_fields( import_state, bounds, glc_present, rof_prognostic, atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc ) + call import_fields( gcomp , bounds, glc_present, rof_prognostic, atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call t_stopf ('lc_lnd_import') + + !-------------------------------- + ! Run model + !-------------------------------- + + dtime = get_step_size() + dosend = .false. + do while(.not. dosend) + + ! TODO: This is currently hard-wired - is there a better way for nuopc? + ! Note that the model clock is updated at the end of the time step not at the beginning + nstep = get_nstep() + if (nstep > 0) then + dosend = .true. + end if + + !-------------------------------- + ! Determine doalb based on nextsw_cday sent from atm model + !-------------------------------- + + caldayp1 = get_curr_calday(offset=dtime) + + if (nstep == 0) then + doalb = .false. + else if (nstep == 1) then + doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) + else + doalb = (nextsw_cday >= -0.5_r8) + end if + call update_rad_dtime(doalb) + + !-------------------------------- + ! Determine if time to write restart + !-------------------------------- + + !call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + !if (ESMF_AlarmIsRinging(alarm, rc=rc)) then + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !rstwr = .true. + !call ESMF_AlarmRingerOff( alarm, rc=rc ) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !else + !rstwr = .false. + !endif + + !-------------------------------- + ! Determine if time to stop + !-------------------------------- + + !call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + !if (ESMF_AlarmIsRinging(alarm, rc=rc)) then + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !nlend = .true. + !call ESMF_AlarmRingerOff( alarm, rc=rc ) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !else + ! nlend = .false. + !endif + + !-------------------------------- + ! Run CTSM + !-------------------------------- + + call t_barrierf('sync_ctsm_run1', mpicom) + + call t_startf ('shr_orb_decl') + calday = get_curr_calday() + call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) + call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) + call t_stopf ('shr_orb_decl') + + call t_startf ('ctsm_run') + + ! Restart File - use nexttimestr rather than currtimestr here since that is the time at the end of + ! the timestep and is preferred for restart file names + + call ESMF_ClockGetNextTime(clock, nextTime=nextTime, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet(nexttime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync, mon_sync, day_sync, tod_sync + + call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) + + call t_stopf ('ctsm_run') + + !-------------------------------- + ! Pack export state + !-------------------------------- + + call t_startf ('lc_lnd_export') + + !call export_fields(exportState, bounds, glc_present, rof_prognostic, & + ! water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) + !call export_fields(exportState, bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call t_stopf ('lc_lnd_export') + + !-------------------------------- + ! Advance ctsm time step + !-------------------------------- + + call t_startf ('lc_ctsm2_adv_timestep') + call advance_timestep() + call t_stopf ('lc_ctsm2_adv_timestep') + + end do + + ! Check that internal clock is in sync with master clock + ! Note that the driver clock has not been updated yet - so at this point + ! CTSM is actually 1 coupling intervals ahead of the driver clock + + call get_curr_date( yr, mon, day, tod, offset=-2*dtime ) + ymd = yr*10000 + mon*100 + day + tod = tod + + call ESMF_ClockGet( clock, currTime=currTime, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeGet( currTime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yr_sync, mon_sync, day_sync, ymd_sync) + + if ( (ymd /= ymd_sync) .and. (tod /= tod_sync) ) then + write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod + write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync + rc = ESMF_FAILURE + call ESMF_LogWrite(subname//" CTSM clock not in sync with Master Sync clock",ESMF_LOGMSG_ERROR) + end if + + !-------------------------------- + ! diagnostics + !-------------------------------- + + !if (dbug > 1) then + ! call State_diagnose(exportState,subname//':ES',rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! if (masterproc) then + ! call log_clock_advance(clock, 'CTSM', iulog, rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! end if + !end if + + !-------------------------------- + ! Reset shr logging to my original values + !-------------------------------- + + call shr_file_setLogUnit (shrlogunit) + + call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) + +#if (defined _MEMTRACE) + if(masterproc) then + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_comp_nuopc_ModelAdvance:end::',lbnum) + call memmon_reset_addr() + endif +#endif + + end subroutine lnd_run + + !--------------------------------------------------------------------------- + + subroutine lnd_final(comp, import_state, export_state, clock, rc) + ! + ! !DESCRIPTION: + ! Finalize land surface model + ! + ! !ARGUMENTS: + type(ESMF_GridComp) :: comp ! CLM gridded component + type(ESMF_State) :: import_state ! CLM import state + type(ESMF_State) :: export_state ! CLM export state + type(ESMF_Clock) :: clock ! ESMF synchronization clock + integer, intent(out) :: rc ! Return code + !--------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Destroy ESMF objects + !call esmfshr_util_StateArrayDestroy(export_state,'domain',rc) + !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + + !call esmfshr_util_StateArrayDestroy(export_state,'d2x',rc) + !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + + !call esmfshr_util_StateArrayDestroy(import_state,'x2d',rc) + !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + + end subroutine lnd_final + + end module lnd_comp_esmf diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 new file mode 100644 index 0000000000..1514cd6aac --- /dev/null +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -0,0 +1,1519 @@ +module lnd_import_export + use ESMF , only : ESMF_GridComp, ESMF_State, ESMF_Mesh, ESMF_StateGet + use ESMF , only : ESMF_StatePrint + use ESMF , only : ESMF_GridCompGet + use ESMF , only : ESMF_KIND_R8, ESMF_SUCCESS, ESMF_MAXSTR, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_ERROR, ESMF_LogFoundError + use ESMF , only : ESMF_STATEITEM_NOTFOUND, ESMF_StateItem_Flag + use ESMF , only : operator(/=), operator(==) + !use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise, NUOPC_IsConnected + !use NUOPC_Model , only : NUOPC_ModelGet + use shr_kind_mod , only : r8 => shr_kind_r8, cx=>shr_kind_cx, cxx=>shr_kind_cxx, cs=>shr_kind_cs + use shr_infnan_mod , only : isnan => shr_infnan_isnan + use shr_string_mod , only : shr_string_listGetName, shr_string_listGetNum + use shr_sys_mod , only : shr_sys_abort + use clm_varctl , only : iulog + use clm_time_manager , only : get_nstep + use decompmod , only : bounds_type + use lnd2atmType , only : lnd2atm_type + use lnd2glcMod , only : lnd2glc_type + use atm2lndType , only : atm2lnd_type + use glc2lndMod , only : glc2lnd_type + use domainMod , only : ldomain + use spmdMod , only : masterproc + use seq_drydep_mod , only : seq_drydep_readnl, n_drydep, seq_drydep_init + use shr_megan_mod , only : shr_megan_readnl, shr_megan_mechcomps_n + use shr_fire_emis_mod , only : shr_fire_emis_readnl, shr_fire_emis_mechcomps_n + use shr_carma_mod , only : shr_carma_readnl + use shr_ndep_mod , only : shr_ndep_readnl + use glc_elevclass_mod , only : glc_elevclass_init + use lnd_shr_methods , only : chkerr + + implicit none + private ! except + +! public :: advertise_fields +! public :: realize_fields + public :: import_fields + public :: export_fields + + private :: fldlist_add + private :: fldlist_realize + private :: state_getimport + private :: state_setexport + private :: state_getfldptr + private :: check_for_nans + + type fld_list_type + character(len=128) :: stdname + integer :: ungridded_lbound = 0 + integer :: ungridded_ubound = 0 + end type fld_list_type + + integer, parameter :: fldsMax = 100 + integer :: fldsToLnd_num = 0 + integer :: fldsFrLnd_num = 0 + type (fld_list_type) :: fldsToLnd(fldsMax) + type (fld_list_type) :: fldsFrLnd(fldsMax) + integer, parameter :: gridTofieldMap = 2 ! ungridded dimension is innermost + + ! from atm->lnd + integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn + + ! from lnd->atm + character(len=cx) :: carma_fields ! List of CARMA fields from lnd->atm + integer :: drydep_nflds ! number of dry deposition velocity fields lnd-> atm + integer :: megan_nflds ! number of MEGAN voc fields from lnd-> atm + integer :: emis_nflds ! number of fire emission fields from lnd-> atm + + logical :: flds_co2a ! use case + logical :: flds_co2b ! use case + logical :: flds_co2c ! use case + integer :: glc_nec ! number of glc elevation classes + integer, parameter :: debug = 1 ! internal debug level + + character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" + character(*),parameter :: u_FILE_u = & + __FILE__ + character(*),parameter :: modname = "[lnd_import_export]: " + +!=============================================================================== +contains +!=============================================================================== + +! subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, rof_prognostic, rc) +! +! use clm_varctl, only : ndep_from_cpl +! +! ! input/output variables +! type(ESMF_GridComp) :: gcomp +! character(len=*) , intent(in) :: flds_scalar_name +! logical , intent(in) :: glc_present +! logical , intent(in) :: rof_prognostic +! integer , intent(out) :: rc +! +! ! local variables +! type(ESMF_State) :: importState +! type(ESMF_State) :: exportState +! character(ESMF_MAXSTR) :: stdname +! character(ESMF_MAXSTR) :: cvalue +! character(len=2) :: nec_str +! integer :: n, num +! character(len=128) :: fldname +! character(len=*), parameter :: subname='(lnd_import_export:advertise_fields)' +! !------------------------------------------------------------------------------- +! +! rc = ESMF_SUCCESS +! +! call NUOPC_ModelGet(gcomp, importState=importState, exportState=exportState, rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! +! !-------------------------------- +! ! determine necessary toggles for below +! !-------------------------------- +! +! call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! read(cvalue,*) flds_co2a +! call ESMF_LogWrite('flds_co2a = '// trim(cvalue), ESMF_LOGMSG_INFO) +! +! call NUOPC_CompAttributeGet(gcomp, name='flds_co2b', value=cvalue, rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! read(cvalue,*) flds_co2b +! call ESMF_LogWrite('flds_co2b = '// trim(cvalue), ESMF_LOGMSG_INFO) +! +! call NUOPC_CompAttributeGet(gcomp, name='flds_co2c', value=cvalue, rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! read(cvalue,*) flds_co2c +! call ESMF_LogWrite('flds_co2c = '// trim(cvalue), ESMF_LOGMSG_INFO) +! +! ! Determine number of elevation classes +! call NUOPC_CompAttributeGet(gcomp, name='glc_nec', value=cvalue, rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! read(cvalue,*) glc_nec +! call ESMF_LogWrite('glc_nec = '// trim(cvalue), ESMF_LOGMSG_INFO) +! if (glc_nec < 1) then +! call shr_sys_abort('ERROR: In CLM4.5 and later, glc_nec must be at least 1.') +! end if +! +! ! Initialize glc_elevclass module +! call glc_elevclass_init(glc_nec) +! +! !-------------------------------- +! ! Advertise export fields +! !-------------------------------- +! +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, trim(flds_scalar_name)) +! +! ! export land states +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_lfrin' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_t' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_tref' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_qref' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdr' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidr' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdf' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidf' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_snowh' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_u10' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_fv' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_ram1' ) +! +! ! export fluxes to river +! if (rof_prognostic) then +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofsur' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofgwl' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofsub' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofi' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_irrig' ) +! end if +! +! ! export fluxes to atm +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_taux' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_tauy' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lat' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_sen' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lwup' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_evap' ) +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_swnet' ) +! +! ! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_methane' ) +! +! ! dust fluxes from land (4 sizes) +! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_flxdst', ungridded_lbound=1, ungridded_ubound=4) +! +! ! co2 fields from land +! if (flds_co2b .or. flds_co2c) then +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_fco2_lnd' ) +! end if +! +! ! Dry Deposition velocities from land - ALSO initialize drydep here +! call seq_drydep_readnl("drv_flds_in", drydep_nflds) +! if (n_drydep .ne. drydep_nflds) call shr_sys_abort('ERROR: drydep field count mismatch') +! if (n_drydep > 0) then +! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_ddvel', ungridded_lbound=1, ungridded_ubound=drydep_nflds) +! end if +! call seq_drydep_init( ) +! +! ! MEGAN VOC emissions fluxes from land +! megan_nflds=0 +! call shr_megan_readnl('drv_flds_in', megan_nflds) +! if (shr_megan_mechcomps_n .ne. megan_nflds) call shr_sys_abort('ERROR: megan field count mismatch') +! if (shr_megan_mechcomps_n > 0) then +! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_voc', ungridded_lbound=1, ungridded_ubound=megan_nflds) +! end if +! +! ! Fire emissions fluxes from land +! call shr_fire_emis_readnl('drv_flds_in', emis_nflds) +! if (shr_fire_emis_mechcomps_n .ne. emis_nflds) call shr_sys_abort('ERROR: fire_emis field count mismatch') +! if (shr_fire_emis_mechcomps_n > 0) then +! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_fire', ungridded_lbound=1, ungridded_ubound=emis_nflds) +! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_fztop') +! end if +! ! CARMA volumetric soil water from land +! ! TODO: is the following correct - the CARMA field exchange is very confusing in mct +! call shr_carma_readnl('drv_flds_in', carma_fields) +! if (carma_fields /= ' ') then +! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_soilw') ! optional for carma +! end if +! +! if (glc_present) then +! ! lnd->glc states from land all lnd->glc elevation classes (1:glc_nec) plus bare land (index 0). +! ! The following puts all of the elevation class fields as an +! ! undidstributed dimension in the export state field +! +! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_tsrf_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) +! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_topo_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) +! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Flgl_qice_elev', ungridded_lbound=1, ungridded_ubound=glc_nec+1) +! end if +! +! ! Now advertise above export fields +! do n = 1,fldsFrLnd_num +! call NUOPC_Advertise(exportState, standardName=fldsFrLnd(n)%stdname, & +! TransferOfferGeomObject='will provide', rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! enddo +! +! !-------------------------------- +! ! Advertise import fields +! !-------------------------------- +! +! call fldlist_add(fldsToLnd_num, fldsToLnd, trim(flds_scalar_name)) +! +! ! from atm - states +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_z' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_topo' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_u' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_v' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_ptem' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_pbot' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_tbot' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_shum' ) +! !call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_methane' ) +! +! ! from atm - fluxes +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_lwdn' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_rainc' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_rainl' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_snowc' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_snowl' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swndr' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swvdr' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swndf' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swvdf' ) +! +! ! from atm - black carbon deposition fluxes (3) +! ! (1) => bcphidry, (2) => bcphodry, (3) => bcphiwet +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_bcph', ungridded_lbound=1, ungridded_ubound=3) +! +! ! from atm - organic carbon deposition fluxes (3) +! ! (1) => ocphidry, (2) => ocphodry, (3) => ocphiwet +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_ocph', ungridded_lbound=1, ungridded_ubound=3) +! +! ! from atm - wet dust deposition frluxes (4 sizes) +! ! (1) => dstwet1, (2) => dstwet2, (3) => dstwet3, (4) => dstwet4 +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_dstwet', ungridded_lbound=1, ungridded_ubound=4) +! +! ! from - atm dry dust deposition frluxes (4 sizes) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_dstdry', ungridded_lbound=1, ungridded_ubound=4) +! +! ! from atm - nitrogen deposition +! call shr_ndep_readnl("drv_flds_in", ndep_nflds) +! if (ndep_nflds > 0) then +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=ndep_nflds) +! ! This sets a variable in clm_varctl +! ndep_from_cpl = .true. +! end if +! +! ! from atm - co2 exchange scenarios +! if (flds_co2a .or. flds_co2b .or. flds_co2c) then +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_co2prog') +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_co2diag') +! end if +! +! if (rof_prognostic) then +! ! from river +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_flood' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_volr' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_volrmch' ) +! end if +! +! if (glc_present) then +! ! from land-ice (glc) - no elevation classes +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_icemask' ) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_icemask_coupled_fluxes') +! +! ! from land-ice (glc) - fields for all glc->lnd elevation classes (1:glc_nec) plus bare land (index 0) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_ice_covered_elev', ungridded_lbound=1, ungridded_ubound=glc_nec+1) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_topo_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) +! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flgg_hflx_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) +! end if +! +! ! Now advertise import fields +! do n = 1,fldsToLnd_num +! call NUOPC_Advertise(importState, standardName=fldsToLnd(n)%stdname, & +! TransferOfferGeomObject='will provide', rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! enddo +! +! end subroutine advertise_fields +! +! !=============================================================================== +! +! subroutine realize_fields(gcomp, Emesh, flds_scalar_name, flds_scalar_num, rc) +! +! ! input/output variables +! type(ESMF_GridComp) , intent(inout) :: gcomp +! type(ESMF_Mesh) , intent(in) :: Emesh +! character(len=*) , intent(in) :: flds_scalar_name +! integer , intent(in) :: flds_scalar_num +! integer , intent(out) :: rc +! +! ! local variables +! type(ESMF_State) :: importState +! type(ESMF_State) :: exportState +! character(len=*), parameter :: subname='(lnd_import_export:realize_fields)' +! !--------------------------------------------------------------------------- +! +! rc = ESMF_SUCCESS +! +! call NUOPC_ModelGet(gcomp, importState=importState, exportState=exportState, rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! +! call fldlist_realize( & +! state=ExportState, & +! fldList=fldsFrLnd, & +! numflds=fldsFrLnd_num, & +! flds_scalar_name=flds_scalar_name, & +! flds_scalar_num=flds_scalar_num, & +! tag=subname//':clmExport',& +! mesh=Emesh, rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! +! call fldlist_realize( & +! state=importState, & +! fldList=fldsToLnd, & +! numflds=fldsToLnd_num, & +! flds_scalar_name=flds_scalar_name, & +! flds_scalar_num=flds_scalar_num, & +! tag=subname//':clmImport',& +! mesh=Emesh, rc=rc) +! if (ChkErr(rc,__LINE__,u_FILE_u)) return +! +! end subroutine realize_fields + + !=============================================================================== + + subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & + atm2lnd_inst, glc2lnd_inst, wateratm2lndbulk_inst, rc) + + !--------------------------------------------------------------------------- + ! Convert the input data from the mediator to the land model + !--------------------------------------------------------------------------- + + use clm_varctl , only: co2_type, co2_ppmv, use_c13, ndep_from_cpl + use clm_varcon , only: rair, o2_molar_const, c13ratio + use shr_const_mod , only: SHR_CONST_TKFRZ + use Wateratm2lndBulkType , only: wateratm2lndbulk_type + + ! input/output variabes + type(ESMF_GridComp) :: gcomp + type(bounds_type) , intent(in) :: bounds ! bounds + logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model + logical , intent(in) :: rof_prognostic ! .true. => running with a prognostic ROF model + type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! clm internal input data type + type(glc2lnd_type) , intent(inout) :: glc2lnd_inst ! clm internal input data type + type(Wateratm2lndbulk_type) , intent(inout) :: wateratm2lndbulk_inst + integer , intent(out) :: rc + + ! local variables + type(ESMF_State) :: importState + type(ESMF_StateItem_Flag) :: itemFlag + real(r8), pointer :: dataPtr(:) + character(len=128) :: fldname + integer :: num + integer :: begg, endg ! bounds + integer :: g,i,k ! indices + real(r8) :: e ! vapor pressure (Pa) + real(r8) :: qsat ! saturation specific humidity (kg/kg) + real(r8) :: co2_ppmv_diag(bounds%begg:bounds%endg) ! temporary + real(r8) :: co2_ppmv_prog(bounds%begg:bounds%endg) ! temporary + real(r8) :: co2_ppmv_val ! temporary + real(r8) :: esatw ! saturation vapor pressure over water (Pa) + real(r8) :: esati ! saturation vapor pressure over ice (Pa) + real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water + real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice + real(r8) :: tdc, t ! Kelvins to Celcius function and its input + real(r8) :: forc_t ! atmospheric temperature (Kelvin) + real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) + real(r8) :: forc_pbot ! atmospheric pressure (Pa) + real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s + real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s + real(r8) :: forc_noy(bounds%begg:bounds%endg) + real(r8) :: forc_nhx(bounds%begg:bounds%endg) + real(r8) :: frac_grc(bounds%begg:bounds%endg, 0:glc_nec) + real(r8) :: topo_grc(bounds%begg:bounds%endg, 0:glc_nec) + real(r8) :: hflx_grc(bounds%begg:bounds%endg, 0:glc_nec) + real(r8) :: icemask_grc(bounds%begg:bounds%endg) + real(r8) :: icemask_coupled_fluxes_grc(bounds%begg:bounds%endg) + character(len=*), parameter :: subname='(lnd_import_export:import_fields)' + !character(len=* ) , parameter :: subname=trim(modname ) //' : (import_fields) ' + + ! Constants to compute vapor pressure + parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & + a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & + a4=3.031240396e-06_r8, a5=2.034080948e-08_r8, & + a6=6.136820929e-11_r8) + + parameter (b0=6.109177956_r8 , b1=5.034698970e-01_r8, & + b2=1.886013408e-02_r8, b3=4.176223716e-04_r8, & + b4=5.824720280e-06_r8, b5=4.838803174e-08_r8, & + b6=1.838826904e-10_r8) + + ! function declarations + tdc(t) = min( 50._r8, max(-50._r8,(t-SHR_CONST_TKFRZ)) ) + esatw(t) = 100._r8*(a0+t*(a1+t*(a2+t*(a3+t*(a4+t*(a5+t*a6)))))) + esati(t) = 100._r8*(b0+t*(b1+t*(b2+t*(b3+t*(b4+t*(b5+t*b6)))))) + !--------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + + ! Get import state + !call NUOPC_ModelGet(gcomp, importState=importState, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Get import state + call ESMF_GridCompGet(gcomp, importState=importState, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Set bounds + begg = bounds%begg; endg=bounds%endg + + ! Note: precipitation fluxes received from the coupler + ! are in units of kg/s/m^2. To convert these precipitation rates + ! in units of mm/sec, one must divide by 1000 kg/m^3 and multiply + ! by 1000 mm/m resulting in an overall factor of unity. + ! Below the units are therefore given in mm/s. + + !-------------------------- + ! Required atmosphere input fields + !-------------------------- + + call state_getimport(importState, 'Sa_z', bounds, output=atm2lnd_inst%forc_hgt_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Sa_topo', bounds, output=atm2lnd_inst%forc_topo_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Sa_u', bounds, output=atm2lnd_inst%forc_u_grc, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Sa_v', bounds, output=atm2lnd_inst%forc_v_grc, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Sa_ptem', bounds, output=atm2lnd_inst%forc_th_not_downscaled_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Sa_shum', bounds, output=wateratm2lndbulk_inst%forc_q_not_downscaled_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Sa_pbot', bounds, output=atm2lnd_inst%forc_pbot_not_downscaled_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Sa_tbot', bounds, output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_rainc', bounds, output=forc_rainc, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_rainl', bounds, output=forc_rainl, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_snowc', bounds, output=forc_snowc, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_snowl', bounds, output=forc_snowl, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_lwdn', bounds, output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_swvdr', bounds, output=atm2lnd_inst%forc_solad_grc(:,1), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_swndr', bounds, output=atm2lnd_inst%forc_solad_grc(:,2), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_swvdf', bounds, output=atm2lnd_inst%forc_solai_grc(:,1), rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_getimport(importState, 'Faxa_swndf', bounds, output=atm2lnd_inst%forc_solai_grc(:,2), rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + + +!!!# ! Atmosphere prognostic/prescribed aerosol fields +!!!# +!!!# ! bcphidry +!!!# call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,1), & +!!!# ungridded_index=1, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# ! bcphodry +!!!# call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,2), & +!!!# ungridded_index=2, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# ! bcphiwet +!!!# call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,3), & +!!!# ungridded_index=3, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# +!!!# ! ocphidry +!!!# call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,4), & +!!!# ungridded_index=1, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# ! bcphodry +!!!# call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,5), & +!!!# ungridded_index=2, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# ! bcphiwet +!!!# call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,6), & +!!!# ungridded_index=3, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# +!!!# call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,7), & +!!!# ungridded_index=1, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,8), & +!!!# ungridded_index=1, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# +!!!# call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,9), & +!!!# ungridded_index=2, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,10), & +!!!# ungridded_index=2, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# +!!!# call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,11), & +!!!# ungridded_index=3, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,12), & +!!!# ungridded_index=3, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# +!!!# call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,13), & +!!!# ungridded_index=4, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,14), & +!!!# ungridded_index=4, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# +!!!# call state_getimport(importState, 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# +!!!# ! The mediator is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec +!!!# ! so the following conversion needs to happen +!!!# +!!!# call state_getimport(importState, 'Faxa_nhx', bounds, output=forc_nhx, ungridded_index=1, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# call state_getimport(importState, 'Faxa_noy', bounds, output=forc_noy, ungridded_index=2, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# do g = begg,endg +!!!# atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 +!!!# end do +!!!# +!!!# !-------------------------- +!!!# ! Atmosphere co2 +!!!# !-------------------------- +!!!# +!!!# fldName = 'Sa_co2prog' +!!!# call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) +!!!# if ( ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'prognostic') then +!!!# call shr_sys_abort( subname//' ERROR: must have nonzero Sa_co2prog for co2_type equal to prognostic' ) +!!!# end if +!!!# if (itemflag /= ESMF_STATEITEM_NOTFOUND) then +!!!# call state_getfldptr(importState, trim(fldname), dataPtr, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# do g = begg,endg +!!!# co2_ppmv_prog(g) = dataPtr(g-begg+1) ! co2 atm prognostic +!!!# end do +!!!# else +!!!# do g = begg,endg +!!!# co2_ppmv_prog(g) = co2_ppmv +!!!# end do +!!!# end if +!!!# +!!!# fldName = 'Sa_co2diag' +!!!# call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) +!!!# if ( ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'diagnostic') then +!!!# call shr_sys_abort( subname//' ERROR: must have nonzero Sa_co2prog for co2_type equal to prognostic' ) +!!!# end if +!!!# if (itemflag /= ESMF_STATEITEM_NOTFOUND) then +!!!# call state_getfldptr(importState, trim(fldname), dataPtr, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# do g = begg,endg +!!!# co2_ppmv_diag(g) = dataPtr(g-begg+1) ! co2 atm diagnostic +!!!# end do +!!!# else +!!!# do g = begg,endg +!!!# co2_ppmv_diag(g) = co2_ppmv +!!!# end do +!!!# end if +!!!# +!!!# ! Note that the following does unit conversions from ppmv to partial pressures (Pa) +!!!# ! Note that forc_pbot is in Pa +!!!# do g = begg,endg +!!!# if (co2_type == 'prognostic') then +!!!# co2_ppmv_val = co2_ppmv_prog(g) +!!!# else if (co2_type == 'diagnostic') then +!!!# co2_ppmv_val = co2_ppmv_diag(g) +!!!# else +!!!# co2_ppmv_val = co2_ppmv +!!!# end if +!!!# forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) +!!!# atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_val * 1.e-6_r8 * forc_pbot +!!!# if (use_c13) then +!!!# atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_val * c13ratio * 1.e-6_r8 * forc_pbot +!!!# end if +!!!# end do +!!!# +!!!# !-------------------------- +!!!# ! Flooding back from river +!!!# !-------------------------- +!!!# +!!!# ! sign convention is positive downward and hierarchy is atm/glc/lnd/rof/ice/ocn. +!!!# ! so water sent from rof to land is negative, +!!!# ! change the sign to indicate addition of water to system. +!!!# +!!!# if (rof_prognostic) then +!!!# call state_getimport(importState, 'Flrr_flood', bounds, output=wateratm2lndbulk_inst%forc_flood_grc, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# wateratm2lndbulk_inst%forc_flood_grc(:) = -wateratm2lndbulk_inst%forc_flood_grc(:) +!!!# else + wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 +!!!# end if +!!!# +!!!# if (rof_prognostic) then +!!!# call state_getimport(importState, 'Flrr_volr', bounds, output=wateratm2lndbulk_inst%volr_grc, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# wateratm2lndbulk_inst%volr_grc(:) = wateratm2lndbulk_inst%volr_grc(:) * (ldomain%area(:) * 1.e6_r8) +!!!# else +!!!# wateratm2lndbulk_inst%volr_grc(:) = 0._r8 +!!!# end if +!!!# +!!!# if (rof_prognostic) then +!!!# call state_getimport(importState, 'Flrr_volrmch', bounds, output=wateratm2lndbulk_inst%volrmch_grc, rc=rc ) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# wateratm2lndbulk_inst%volrmch_grc(:) = wateratm2lndbulk_inst%volrmch_grc(:) * (ldomain%area(:) * 1.e6_r8) +!!!# else +!!!# wateratm2lndbulk_inst%volrmch_grc(:) = 0._r8 +!!!# end if +!!!# +!!!# !-------------------------- +!!!# ! Land-ice (glc) fields +!!!# !-------------------------- +!!!# +!!!# if (glc_present) then +!!!# ! We could avoid setting these fields if glc_present is .false., if that would +!!!# ! help with performance. (The downside would be that we wouldn't have these fields +!!!# ! available for diagnostic purposes or to force a later T compset with dlnd.) +!!!# +!!!# do num = 0,glc_nec +!!!# call state_getimport(importState, 'Sg_ice_covered_elev', bounds, frac_grc(:,num), ungridded_index=num+1, rc=rc) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# call state_getimport(importState, 'Sg_topo_elev' , bounds, topo_grc(:,num), ungridded_index=num+1, rc=rc) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# call state_getimport(importState, 'Flgg_hflx_elev' , bounds, hflx_grc(:,num), ungridded_index=num+1, rc=rc) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# end do +!!!# call state_getimport(importState, 'Sg_icemask' , bounds, icemask_grc, rc=rc) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# call state_getimport(importState, 'Sg_icemask_coupled_fluxes', bounds, icemask_grc, rc=rc) +!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return +!!!# +!!!# call glc2lnd_inst%set_glc2lnd_fields_nuopc( bounds, glc_present, & +!!!# frac_grc, topo_grc, hflx_grc, icemask_grc, icemask_coupled_fluxes_grc) +!!!# end if + + !-------------------------- + ! Derived quantities + !-------------------------- + + do g = begg, endg + forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) + forc_q = wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) + forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) + + atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] + atm2lnd_inst%forc_hgt_t_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of temperature [m] + atm2lnd_inst%forc_hgt_q_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of humidity [m] + + atm2lnd_inst%forc_vp_grc(g) = forc_q * forc_pbot / (0.622_r8 + 0.378_r8 * forc_q) + + atm2lnd_inst%forc_rho_not_downscaled_grc(g) = & + (forc_pbot - 0.378_r8 * atm2lnd_inst%forc_vp_grc(g)) / (rair * forc_t) + + atm2lnd_inst%forc_po2_grc(g) = o2_molar_const * forc_pbot + + atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv * 1.e-6_r8 * forc_pbot + + atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) + + atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & + atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) + + wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) + wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) + + if (forc_t > SHR_CONST_TKFRZ) then + e = esatw(tdc(forc_t)) + else + e = esati(tdc(forc_t)) + end if + qsat = 0.622_r8*e / (forc_pbot - 0.378_r8*e) + + ! modify specific humidity if precip occurs + if (1==2) then + if ((forc_rainc(g)+forc_rainl(g)) > 0._r8) then + forc_q = 0.95_r8*qsat + !forc_q = qsat + wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q + endif + endif + + wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) + wateratm2lndbulk_inst%volr_grc(g) = 0._r8 + wateratm2lndbulk_inst%volrmch_grc(g) = 0._r8 + end do + + !-------------------------- + ! Error checks + !-------------------------- + + ! Check that solar, specific-humidity and LW downward aren't negative + do g = begg,endg + if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 ) then + call shr_sys_abort( subname//& + ' ERROR: Longwave down sent from the atmosphere model is negative or zero' ) + end if + if ( (atm2lnd_inst%forc_solad_grc(g,1) < 0.0_r8) .or. & + (atm2lnd_inst%forc_solad_grc(g,2) < 0.0_r8) .or. & + (atm2lnd_inst%forc_solai_grc(g,1) < 0.0_r8) .or. & + (atm2lnd_inst%forc_solai_grc(g,2) < 0.0_r8) ) then + call shr_sys_abort( subname//& + ' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & + ' from the atmosphere model is negative or zero' ) + end if + if ( wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then + call shr_sys_abort( subname//& + ' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) + end if + end do + + ! Make sure relative humidity is properly bounded + ! atm2lnd_inst%forc_rh_grc(g) = min( 100.0_r8, atm2lnd_inst%forc_rh_grc(g) ) + ! atm2lnd_inst%forc_rh_grc(g) = max( 0.0_r8, atm2lnd_inst%forc_rh_grc(g) ) + + end subroutine import_fields + +!============================================================================== + + subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & + waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) + + !------------------------------- + ! Pack the export state + !------------------------------- + + use Waterlnd2atmBulkType , only: waterlnd2atmbulk_type + + ! input/output variables + type(ESMF_GridComp) :: gcomp + type(bounds_type) , intent(in) :: bounds ! bounds + logical , intent(in) :: glc_present + logical , intent(in) :: rof_prognostic + type(waterlnd2atmbulk_type) , intent(inout) :: waterlnd2atmbulk_inst + type(lnd2atm_type) , intent(inout) :: lnd2atm_inst ! land to atmosphere exchange data type + type(lnd2glc_type) , intent(inout) :: lnd2glc_inst ! land to atmosphere exchange data type + integer , intent(out) :: rc + + !type(datawrapper) :: wrap2 + ! local variables + type(ESMF_State) :: exportState + integer :: i, g, num + real(r8) :: array(bounds%begg:bounds%endg) + character(len=*), parameter :: subname='(lnd_import_export:export_fields)' + !--------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Get export state + !call NUOPC_ModelGet(gcomp, exportState=exportState, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Get export state (ESMF) + call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc) ! do we need the clock now? + !call ESMF_GridCompGet(gcomp, exportState, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! ----------------------- + ! output to mediator + ! ----------------------- + + call state_setexport(exportState, 'Sl_lfrin', bounds, input=ldomain%frac, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! ----------------------- + ! output to atm + ! ----------------------- + + call state_setexport(exportState, 'Sl_t', bounds, input=lnd2atm_inst%t_rad_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_snowh', bounds, & + input=waterlnd2atmbulk_inst%h2osno_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_avsdr', bounds, input=lnd2atm_inst%albd_grc(bounds%begg:,1), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_anidr', bounds, input=lnd2atm_inst%albd_grc(bounds%begg:,2), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_avsdf', bounds, input=lnd2atm_inst%albi_grc(bounds%begg:,1), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_anidf', bounds, input=lnd2atm_inst%albi_grc(bounds%begg:,2), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_tref', bounds, input=lnd2atm_inst%t_ref2m_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_qref', bounds, input=waterlnd2atmbulk_inst%q_ref2m_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_u10', bounds, input=lnd2atm_inst%u_ref10m_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_taux', bounds, input=lnd2atm_inst%taux_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_tauy', bounds, input=lnd2atm_inst%tauy_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_lat', bounds, input=lnd2atm_inst%eflx_lh_tot_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_sen', bounds, input=lnd2atm_inst%eflx_sh_tot_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_lwup', bounds, input=lnd2atm_inst%eflx_lwrad_out_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_evap', bounds, input=waterlnd2atmbulk_inst%qflx_evap_tot_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_swnet', bounds, input=lnd2atm_inst%fsa_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,1), & + minus=.true., ungridded_index=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,2), & + minus=.true., ungridded_index=2, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,3), & + minus=.true., ungridded_index=3, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,4), & + minus=.true., ungridded_index=4, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Fall_methane', bounds, input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_ram1', bounds, input=lnd2atm_inst%ram1_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_fv', bounds, input=lnd2atm_inst%fv_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call state_setexport(exportState, 'Sl_soilw', bounds, & + input=waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! co2 from land + if (flds_co2b .or. flds_co2c) then + call state_setexport(exportState, 'Fall_fco2_lnd', bounds, lnd2atm_inst%net_carbon_exchange_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! dry dep velocities + do num = 1, drydep_nflds + call state_setexport(exportState, 'Sl_ddvel', bounds, input=lnd2atm_inst%ddvel_grc(:,num), & + ungridded_index=num, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + + ! MEGAN VOC emis fluxes + do num = 1, shr_megan_mechcomps_n + call state_setexport(exportState, 'Fall_voc', bounds, input=lnd2atm_inst%flxvoc_grc(:,num), minus=.true., & + ungridded_index=num, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + + ! fire emis fluxes + do num = 1, emis_nflds + call state_setexport(exportState, 'Fall_fire', bounds, input=lnd2atm_inst%fireflx_grc(:,num), minus=.true., & + ungridded_index=num, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + if (emis_nflds > 0) then + call state_setexport(exportState, 'Sl_fztopo', bounds, input=lnd2atm_inst%fireztop_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif + ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. + ! i.e. water sent from land to rof is positive + + ! ----------------------- + ! output to river + ! ----------------------- + + ! surface runoff is the sum of qflx_over, qflx_h2osfc_surf + ! do g = bounds%begg,bounds%endg + ! array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) + ! end do + call state_setexport(exportState, 'Flrl_rofsur', bounds, input=waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain + do g = bounds%begg,bounds%endg + array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) + end do + call state_setexport(exportState, 'Flrl_rofsub', bounds, input=array, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! qgwl sent individually to coupler + call state_setexport(exportState, 'Flrl_rofgwl', bounds, input=waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! ice sent individually to coupler + call state_setexport(exportState, 'Flrl_rofi', bounds, input=waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! irrigation flux to be removed from main channel storage (negative) + call state_setexport(exportState, 'Flrl_irrig', bounds, input=waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! ----------------------- + ! output to glc + ! ----------------------- + + ! We could avoid setting these fields if glc_present is .false., if that would + ! help with performance. (The downside would be that we wouldn't have these fields + ! available for diagnostic purposes or to force a later T compset with dlnd.) + + do num = 0,glc_nec + call state_setexport(exportState, 'Sl_tsrf_elev', bounds, input=lnd2glc_inst%tsrf_grc(:,num), & + ungridded_index=num+1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport(exportState, 'Sl_topo_elev', bounds, input=lnd2glc_inst%topo_grc(:,num), & + ungridded_index=num+1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport(exportState, 'Flgl_qice_elev', bounds, input=lnd2glc_inst%qice_grc(:,num), & + ungridded_index=num+1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + + end subroutine export_fields + + !=============================================================================== + + subroutine fldlist_add(num, fldlist, stdname, ungridded_lbound, ungridded_ubound) + + ! input/output variables + integer, intent(inout) :: num + type(fld_list_type), intent(inout) :: fldlist(:) + character(len=*), intent(in) :: stdname + integer, optional, intent(in) :: ungridded_lbound + integer, optional, intent(in) :: ungridded_ubound + + ! local variables + integer :: rc + character(len=*), parameter :: subname='(lnd_import_export:fldlist_add)' + !------------------------------------------------------------------------------- + + ! Set up a list of field information + + num = num + 1 + if (num > fldsMax) then + call ESMF_LogWrite(trim(subname)//": ERROR num > fldsMax "//trim(stdname), & + ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__) + return + endif + fldlist(num)%stdname = trim(stdname) + + if (present(ungridded_lbound) .and. present(ungridded_ubound)) then + fldlist(num)%ungridded_lbound = ungridded_lbound + fldlist(num)%ungridded_ubound = ungridded_ubound + end if + + end subroutine fldlist_add + + !=============================================================================== + + subroutine fldlist_realize(state, fldList, numflds, flds_scalar_name, flds_scalar_num, mesh, tag, rc) + + use NUOPC , only : NUOPC_IsConnected, NUOPC_Realize + use ESMF , only : ESMF_MeshLoc_Element, ESMF_FieldCreate, ESMF_TYPEKIND_R8 + use ESMF , only : ESMF_MAXSTR, ESMF_Field, ESMF_State, ESMF_Mesh, ESMF_StateRemove, ESMF_FieldBundle + use ESMF , only : ESMF_FieldBundle, ESMF_FieldBundleCreate, ESMF_FieldBundleAdd, ESMF_StateAdd + use ESMF , only : ESMF_LogFoundError, ESMF_LOGMSG_INFO, ESMF_SUCCESS + use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_ERROR, ESMF_LOGERR_PASSTHRU + + ! input/output variables + type(ESMF_State) , intent(inout) :: state + type(fld_list_type) , intent(in) :: fldList(:) + integer , intent(in) :: numflds + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(in) :: flds_scalar_num + character(len=*) , intent(in) :: tag + type(ESMF_Mesh) , intent(in) :: mesh + integer , intent(inout) :: rc + + ! local variables + integer :: n + type(ESMF_Field) :: field + character(len=80) :: stdname + character(len=*),parameter :: subname='(lnd_import_export:fldlist_realize)' + type (ESMF_FieldBundle) :: l2c_fb , c2l_fb + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + +!! do n = 1, numflds +!! stdname = fldList(n)%stdname +!! if (NUOPC_IsConnected(state, fieldName=stdname)) then +!! if (stdname == trim(flds_scalar_name)) then +!! call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected on root pe", & +!! ESMF_LOGMSG_INFO) +!! ! Create the scalar field +!! call SetScalarField(field, flds_scalar_name, flds_scalar_num, rc=rc) +!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return +!! else +!! ! Create the field +!! if (fldlist(n)%ungridded_lbound > 0 .and. fldlist(n)%ungridded_ubound > 0) then +!! field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, & +!! ungriddedLbound=(/fldlist(n)%ungridded_lbound/), & +!! ungriddedUbound=(/fldlist(n)%ungridded_ubound/), & +!! gridToFieldMap=(/gridToFieldMap/), rc=rc) +!! if (ChkErr(rc,__LINE__,u_FILE_u)) return +!! else +!! field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) +!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return +!! end if +!! call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected using mesh", & +!! ESMF_LOGMSG_INFO) +!! endif +!! +!! ! NOW call NUOPC_Realize +!! call NUOPC_Realize(state, field=field, rc=rc) +!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return +!! else +!! if (stdname /= trim(flds_scalar_name)) then +!! call ESMF_LogWrite(subname // trim(tag) // " Field = "// trim(stdname) // " is not connected.", & +!! ESMF_LOGMSG_INFO) +!! call ESMF_StateRemove(state, (/stdname/), rc=rc) +!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return +!! end if +!! end if +!! end do + + + + + + + l2c_fb = ESMF_FieldBundleCreate (name="l2c_fb", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + do n = 1, numflds + stdname = fldList(n)%stdname + if (stdname == trim(flds_scalar_name)) then + call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected on root pe", ESMF_LOGMSG_INFO) + ! Create the scalar field + call SetScalarField(field, flds_scalar_name, flds_scalar_num, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + else + ! Create the field + if (fldlist(n)%ungridded_lbound > 0 .and. fldlist(n)%ungridded_ubound > 0) then + field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, & + ungriddedLbound=(/fldlist(n)%ungridded_lbound/), & + ungriddedUbound=(/fldlist(n)%ungridded_ubound/), & + gridToFieldMap=(/gridToFieldMap/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + end if + call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected using mesh", & + ESMF_LOGMSG_INFO) + endif + call ESMF_FieldBundleAdd(l2c_fb, (/field/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + call ESMF_StateAdd(state, (/l2c_fb/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + if (masterproc .and. debug > 0) then + write(iulog,F01)' lnd2atm_l_state is filld with l2c_fb field bundle!' + end if + end do + + + + + + + + + + + contains !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + subroutine SetScalarField(field, flds_scalar_name, flds_scalar_num, rc) + ! ---------------------------------------------- + ! create a field with scalar data on the root pe + ! ---------------------------------------------- + use ESMF, only : ESMF_Field, ESMF_DistGrid, ESMF_Grid + use ESMF, only : ESMF_DistGridCreate, ESMF_GridCreate, ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU + use ESMF, only : ESMF_FieldCreate, ESMF_GridCreate, ESMF_TYPEKIND_R8 + + type(ESMF_Field) , intent(inout) :: field + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(in) :: flds_scalar_num + integer , intent(inout) :: rc + + ! local variables + type(ESMF_Distgrid) :: distgrid + type(ESMF_Grid) :: grid + character(len=*), parameter :: subname='(lnd_import_export:SetScalarField)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + ! create a DistGrid with a single index space element, which gets mapped onto DE 0. + distgrid = ESMF_DistGridCreate(minIndex=(/1/), maxIndex=(/1/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + grid = ESMF_GridCreate(distgrid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + field = ESMF_FieldCreate(name=trim(flds_scalar_name), grid=grid, typekind=ESMF_TYPEKIND_R8, & + ungriddedLBound=(/1/), ungriddedUBound=(/flds_scalar_num/), gridToFieldMap=(/2/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + end subroutine SetScalarField + + end subroutine fldlist_realize + + !=============================================================================== + + subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) + + use ESMF , only : ESMF_Field, ESMF_FieldBundle + use ESMF , only : ESMF_FieldBundleGet + ! ---------------------------------------------- + ! Map import state field to output array + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_State) , intent(in) :: state + type(bounds_type) , intent(in) :: bounds + character(len=*) , intent(in) :: fldname + real(r8) , intent(out) :: output(bounds%begg:bounds%endg) + integer, optional , intent(in) :: ungridded_index + integer , intent(out) :: rc + + ! local variables + integer :: g, i,n + + integer :: fieldcount + + real(R8), pointer :: fldptr1d(:) + real(R8), pointer :: fldptr2d(:,:) + type(ESMF_StateItem_Flag) :: itemFlag + character(len=cs) :: cvalue + character(len=*), parameter :: subname='(lnd_import_export:state_getimport)' + + type (ESMF_FieldBundle):: field + type(ESMF_Field) :: lfield + type (ESMF_FieldBundle):: fieldBundle + logical :: isPresent + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + + ! Determine if field with name fldname exists in state + + !call ESMF_StateGet(state, trim(fldname), itemFlag, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! print out what is in our state??? + if (masterproc .and. debug > 0) then + write(iulog,F01)' Show me what is in the state? for '//trim(fldname) + call ESMF_StatePrint(state, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! Determine if fieldbundle exists in state + call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) + + ! if fieldbundle exists then create output array - else do nothing + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + ! Get the field bundle??? + call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_LogWrite(subname//'c2l_fb found and now ... getting '//trim(fldname), ESMF_LOGMSG_INFO) + call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=field, isPresent=isPresent, rc=rc) + !call ESMF_FieldBundleGet(fieldBundle,field=field, rc=rc) + !call ESMF_FieldBundleGet(fieldBundle, fieldCount=fieldCount, rc=rc) + + + ! Now for error checking we can put ... if (isPresent...) + ! get field pointer + if (present(ungridded_index)) then + write(cvalue,*) ungridded_index + call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname)//" index "//trim(cvalue), & + ESMF_LOGMSG_INFO) + call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname),ESMF_LOGMSG_INFO) + call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! determine output array + if (present(ungridded_index)) then + if (gridToFieldMap == 1) then + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + output(g) = fldptr2d(n,ungridded_index) + end do + else if (gridToFieldMap == 2) then + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + output(g) = fldptr2d(ungridded_index,n) + end do + end if + else + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + output(g) = fldptr1d(n) + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + write(iulog,F01)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) + end if + end do + end if + + ! write debug output if appropriate + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + do g = bounds%begg,bounds%endg + i = 1 + g - bounds%begg + write(iulog,F01)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) + end do + end if + + ! check for nans + call check_for_nans(output, trim(fldname), bounds%begg) + end if + + end subroutine state_getimport + + !=============================================================================== + + subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index, rc) + + ! ---------------------------------------------- + ! Map input array to export state field + ! ---------------------------------------------- + + use shr_const_mod, only : fillvalue=>SHR_CONST_SPVAL + + ! input/output variables + type(ESMF_State) , intent(inout) :: state + type(bounds_type) , intent(in) :: bounds + character(len=*) , intent(in) :: fldname + real(r8) , intent(in) :: input(bounds%begg:bounds%endg) + logical, optional , intent(in) :: minus + integer, optional , intent(in) :: ungridded_index + integer , intent(out) :: rc + + ! local variables + integer :: g, i, n + real(R8), pointer :: fldptr1d(:) + real(R8), pointer :: fldptr2d(:,:) + character(len=cs) :: cvalue + type(ESMF_StateItem_Flag) :: itemFlag + character(len=*), parameter :: subname='(lnd_import_export:state_setexport)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + ! Determine if field with name fldname exists in state + call ESMF_StateGet(state, trim(fldname), itemFlag, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! if field exists then create output array - else do nothing + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + + ! get field pointer + if (present(ungridded_index)) then + call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname)//" index "//trim(cvalue), & + ESMF_LOGMSG_INFO) + call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname), ESMF_LOGMSG_INFO) + call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! TODO: if fillvalue = shr_const_spval the snowhl sent to the atm will have the spval over some points + ! rather than 0 - this is very odd and needs to be understood + ! fldptr(:) = fillvalue + + ! determine output array + if (present(ungridded_index)) then + if (gridToFieldMap == 1) then + fldptr2d(:,ungridded_index) = 0._r8 + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + fldptr2d(n,ungridded_index) = input(g) + end do + if (present(minus)) then + fldptr2d(:,ungridded_index) = -fldptr2d(:,ungridded_index) + end if + else if (gridToFieldMap == 2) then + fldptr2d(ungridded_index,:) = 0._r8 + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + fldptr2d(ungridded_index,n) = input(g) + end do + if (present(minus)) then + fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) + end if + end if + else + fldptr1d(:) = 0._r8 + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + fldptr1d(n) = input(g) + end do + if (present(minus)) then + fldptr1d(:) = -fldptr1d(:) + end if + end if + + ! write debug output if appropriate + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + do g = bounds%begg,bounds%endg + i = 1 + g - bounds%begg + write(iulog,F01)'export: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,input(g) + end do + end if + + ! check for nans + call check_for_nans(input, trim(fldname), bounds%begg) + end if + + end subroutine state_setexport + + !=============================================================================== + + subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) + + ! ---------------------------------------------- + ! Get pointer to a state field + ! ---------------------------------------------- + + use ESMF , only : ESMF_State, ESMF_Field, ESMF_Mesh, ESMF_FieldStatus_Flag + use ESMF , only : ESMF_FieldBundle + use ESMF , only : ESMF_StateGet, ESMF_FieldGet, ESMF_MeshGet + use ESMF , only : ESMF_FIELDSTATUS_COMPLETE, ESMF_FAILURE + use ESMF , only : ESMF_FieldBundleGet + + ! input/output variables + type(ESMF_State), intent(in) :: State + character(len=*), intent(in) :: fldname + real(R8), pointer, optional , intent(out) :: fldptr1d(:) + real(R8), pointer, optional , intent(out) :: fldptr2d(:,:) + integer, intent(out) :: rc + + ! local variables + type(ESMF_FieldStatus_Flag) :: status + type(ESMF_Field) :: lfield + type(ESMF_Mesh) :: lmesh + integer :: nnodes, nelements + character(len=*), parameter :: subname='(lnd_import_export:state_getfldptr)' + + type(ESMF_StateItem_Flag) :: itemFlag + type(ESMF_FieldBundle) :: fieldBundle + logical :: isPresent + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + ! Determine if this field bundle exist.... + ! TODO: combine the error checks.... + + call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) + !call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Get the fieldbundle from state... + call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + + call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) + !call ESMF_FieldBundleGet(fieldBundle,trim(fldname), lfield, isPresent, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldGet(lfield, status=status, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (status /= ESMF_FIELDSTATUS_COMPLETE) then + call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + rc = ESMF_FAILURE + return + else + call ESMF_FieldGet(lfield, mesh=lmesh, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(lmesh, numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (nnodes == 0 .and. nelements == 0) then + call ESMF_LogWrite(trim(subname)//": no local nodes or elements ", ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + + if (present(fldptr1d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc .and. debug > 0) then + write(iulog,F01)' in '//trim(subname)//'fldptr1d for '//trim(fldname)//' is ' + end if + !print *, "FLDPTR1D is" + !print *, FLDPTR1d + else if (present(fldptr2d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") + end if + endif ! status + + end subroutine state_getfldptr + + !=============================================================================== + + subroutine check_for_nans(array, fname, begg) + + ! input/output variables + real(r8) , intent(in) :: array(:) + character(len=*) , intent(in) :: fname + integer , intent(in) :: begg +! + ! local variables + integer :: i + !------------------------------------------------------------------------------- + + ! Check if any input from mediator or output to mediator is NaN + + if (any(isnan(array))) then + write(iulog,*) '# of NaNs = ', count(isnan(array)) + write(iulog,*) 'Which are NaNs = ', isnan(array) + do i = 1, size(array) + if (isnan(array(i))) then + write(iulog,*) "NaN found in field ", trim(fname), ' at gridcell index ',begg+i-1 + end if + end do + call shr_sys_abort(' ERROR: One or more of the output from CLM to the coupler are NaN ' ) + end if + end subroutine check_for_nans + +end module lnd_import_export diff --git a/src/cpl/lilac/lnd_shr_methods.F90 b/src/cpl/lilac/lnd_shr_methods.F90 new file mode 100644 index 0000000000..d0fda756fa --- /dev/null +++ b/src/cpl/lilac/lnd_shr_methods.F90 @@ -0,0 +1,794 @@ +module lnd_shr_methods + + use ESMF , only : operator(<), operator(/=), operator(+) + use ESMF , only : operator(-), operator(*) , operator(>=) + use ESMF , only : operator(<=), operator(>), operator(==) + use ESMF , only : ESMF_LOGERR_PASSTHRU, ESMF_LogFoundError, ESMF_LOGMSG_ERROR, ESMF_MAXSTR + use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_FAILURE + use ESMF , only : ESMF_State, ESMF_StateGet + use ESMF , only : ESMF_Field, ESMF_FieldGet + use ESMF , only : ESMF_GridComp, ESMF_GridCompGet, ESMF_GridCompSet + use ESMF , only : ESMF_GeomType_Flag, ESMF_FieldStatus_Flag + use ESMF , only : ESMF_Mesh, ESMF_MeshGet + use ESMF , only : ESMF_GEOMTYPE_MESH, ESMF_GEOMTYPE_GRID, ESMF_FIELDSTATUS_COMPLETE + use ESMF , only : ESMF_Clock, ESMF_ClockCreate, ESMF_ClockGet, ESMF_ClockSet + use ESMF , only : ESMF_ClockPrint, ESMF_ClockAdvance + use ESMF , only : ESMF_Alarm, ESMF_AlarmCreate, ESMF_AlarmGet, ESMF_AlarmSet + use ESMF , only : ESMF_Calendar, ESMF_CALKIND_NOLEAP, ESMF_CALKIND_GREGORIAN + use ESMF , only : ESMF_Time, ESMF_TimeGet, ESMF_TimeSet + use ESMF , only : ESMF_TimeInterval, ESMF_TimeIntervalSet, ESMF_TimeIntervalGet + use ESMF , only : ESMF_VM, ESMF_VMGet, ESMF_VMBroadcast, ESMF_VMGetCurrent + use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs + use shr_sys_mod , only : shr_sys_abort + use shr_file_mod , only : shr_file_setlogunit, shr_file_getLogUnit + + implicit none + private + + public :: memcheck + public :: log_clock_advance + public :: state_getscalar + public :: state_setscalar + public :: state_diagnose + public :: alarmInit + public :: chkerr + + private :: timeInit + private :: field_getfldptr + + ! Clock and alarm options + character(len=*), private, parameter :: & + optNONE = "none" , & + optNever = "never" , & + optNSteps = "nsteps" , & + optNStep = "nstep" , & + optNSeconds = "nseconds" , & + optNSecond = "nsecond" , & + optNMinutes = "nminutes" , & + optNMinute = "nminute" , & + optNHours = "nhours" , & + optNHour = "nhour" , & + optNDays = "ndays" , & + optNDay = "nday" , & + optNMonths = "nmonths" , & + optNMonth = "nmonth" , & + optNYears = "nyears" , & + optNYear = "nyear" , & + optMonthly = "monthly" , & + optYearly = "yearly" , & + optDate = "date" , & + optIfdays0 = "ifdays0" + + ! Module data + integer, parameter :: SecPerDay = 86400 ! Seconds per day + integer, parameter :: memdebug_level=1 + character(len=1024) :: msgString + character(len=*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine memcheck(string, level, mastertask) + + ! input/output variables + character(len=*) , intent(in) :: string + integer , intent(in) :: level + logical , intent(in) :: mastertask + + ! local variables + integer :: ierr + integer, external :: GPTLprint_memusage + !----------------------------------------------------------------------- + + if ((mastertask .and. memdebug_level > level) .or. memdebug_level > level+1) then + ierr = GPTLprint_memusage(string) + endif + + end subroutine memcheck + +!=============================================================================== + + subroutine log_clock_advance(clock, component, logunit, rc) + + ! input/output variables + type(ESMF_Clock) :: clock + character(len=*) , intent(in) :: component + integer , intent(in) :: logunit + integer , intent(out) :: rc + + ! local variables + character(len=CL) :: cvalue, prestring + !----------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + write(prestring, *) "------>Advancing ",trim(component)," from: " + call ESMF_ClockPrint(clock, options="currTime", unit=cvalue, preString=trim(prestring), rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(logunit, *) trim(cvalue) + + call ESMF_ClockPrint(clock, options="stopTime", unit=cvalue, & + preString="--------------------------------> to: ", rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(logunit, *) trim(cvalue) + + end subroutine log_clock_advance + +!=============================================================================== + + subroutine state_getscalar(state, scalar_id, scalar_value, flds_scalar_name, flds_scalar_num, rc) + + ! ---------------------------------------------- + ! Get scalar data from State for a particular name and broadcast it to all other pets + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_State), intent(in) :: state + integer, intent(in) :: scalar_id + real(r8), intent(out) :: scalar_value + character(len=*), intent(in) :: flds_scalar_name + integer, intent(in) :: flds_scalar_num + integer, intent(inout) :: rc + + ! local variables + integer :: mytask, ierr, len + type(ESMF_VM) :: vm + type(ESMF_Field) :: field + real(r8), pointer :: farrayptr(:,:) + real(r8) :: tmp(1) + character(len=*), parameter :: subname='(state_getscalar)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + call ESMF_VMGetCurrent(vm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_LogWrite(subname//'after VMGetCurrent', ESMF_LOGMSG_INFO) + call ESMF_VMGet(vm, localPet=mytask, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(subname//'after VMGet', ESMF_LOGMSG_INFO) + + call ESMF_LogWrite(subname//'before ESMF_StateGet', ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//'or field is '//trim(flds_scalar_name), ESMF_LOGMSG_INFO) + + call ESMF_StateGet(State, itemName=trim(flds_scalar_name), field=field, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(subname//'after ESMF_StateGet', ESMF_LOGMSG_INFO) + + if (mytask == 0) then + call ESMF_FieldGet(field, farrayPtr = farrayptr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then + call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + endif + tmp(:) = farrayptr(scalar_id,:) + endif + call ESMF_VMBroadCast(vm, tmp, 1, 0, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + scalar_value = tmp(1) + + end subroutine state_getscalar + +!================================================================================ + + subroutine state_setscalar(scalar_value, scalar_id, State, flds_scalar_name, flds_scalar_num, rc) + + ! ---------------------------------------------- + ! Set scalar data from State for a particular name + ! ---------------------------------------------- + + ! input/output arguments + real(r8), intent(in) :: scalar_value + integer, intent(in) :: scalar_id + type(ESMF_State), intent(inout) :: State + character(len=*), intent(in) :: flds_scalar_name + integer, intent(in) :: flds_scalar_num + integer, intent(inout) :: rc + + ! local variables + integer :: mytask + type(ESMF_Field) :: lfield + type(ESMF_VM) :: vm + real(r8), pointer :: farrayptr(:,:) + character(len=*), parameter :: subname='(state_setscalar)' + ! ---------------------------------------------- + + call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + + + rc = ESMF_SUCCESS + + call ESMF_VMGetCurrent(vm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(subname//'after VMGetCurrent', ESMF_LOGMSG_INFO) + + call ESMF_VMGet(vm, localPet=mytask, rc=rc) + call ESMF_LogWrite(subname//'after VMGet', ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + print *, trim(flds_scalar_name) + + call ESMF_LogWrite(subname//'before ESMF_StateSet', ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//'itemName:'//trim(flds_scalar_name), ESMF_LOGMSG_INFO) + !call ESMF_LogWrite(subname//'State: '//State, ESMF_LOGMSG_INFO) + !print *, 'itemName:', trim(flds_scalar_name) + !print *, 'lfield:', lfield + + call ESMF_StateGet(State, itemName=trim(flds_scalar_name), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (mytask == 0) then + call ESMF_LogWrite(subname//'before FieldGet', ESMF_LOGMSG_INFO) + !print *, 'lfield:', lfield + !print *, 'this farrayptr is ', farrayptr + call ESMF_FieldGet(lfield, farrayPtr = farrayptr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then + call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + endif + farrayptr(scalar_id,1) = scalar_value + endif + + end subroutine state_setscalar + +!=============================================================================== + + subroutine state_diagnose(State, string, rc) + + ! ---------------------------------------------- + ! Diagnose status of State + ! ---------------------------------------------- + + type(ESMF_State), intent(in) :: state + character(len=*), intent(in) :: string + integer , intent(out) :: rc + + ! local variables + integer :: i,j,n + type(ESMf_Field) :: lfield + integer :: fieldCount, lrank + character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) + real(r8), pointer :: dataPtr1d(:) + real(r8), pointer :: dataPtr2d(:,:) + character(len=*),parameter :: subname='(state_diagnose)' + ! ---------------------------------------------- + + call ESMF_StateGet(state, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + + call ESMF_StateGet(state, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1, fieldCount + + call ESMF_StateGet(state, itemName=lfieldnamelist(n), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call field_getfldptr(lfield, fldptr1=dataPtr1d, fldptr2=dataPtr2d, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (lrank == 0) then + ! no local data + elseif (lrank == 1) then + if (size(dataPtr1d) > 0) then + write(msgString,'(A,3g14.7,i8)') trim(string)//': '//trim(lfieldnamelist(n)), & + minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) + else + write(msgString,'(A,a)') trim(string)//': '//trim(lfieldnamelist(n))," no data" + endif + elseif (lrank == 2) then + if (size(dataPtr2d) > 0) then + write(msgString,'(A,3g14.7,i8)') trim(string)//': '//trim(lfieldnamelist(n)), & + minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) + else + write(msgString,'(A,a)') trim(string)//': '//trim(lfieldnamelist(n))," no data" + endif + else + call ESMF_LogWrite(trim(subname)//": ERROR rank not supported ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + enddo + + deallocate(lfieldnamelist) + + end subroutine state_diagnose + +!=============================================================================== + + subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) + + ! ---------------------------------------------- + ! for a field, determine rank and return fldptr1 or fldptr2 + ! abort is true by default and will abort if fldptr is not yet allocated in field + ! rank returns 0, 1, or 2. 0 means fldptr not allocated and abort=false + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_Field) , intent(in) :: field + real(r8), pointer , intent(inout), optional :: fldptr1(:) + real(r8), pointer , intent(inout), optional :: fldptr2(:,:) + integer , intent(out) , optional :: rank + logical , intent(in) , optional :: abort + integer , intent(out) , optional :: rc + + ! local variables + type(ESMF_GeomType_Flag) :: geomtype + type(ESMF_FieldStatus_Flag) :: status + type(ESMF_Mesh) :: lmesh + integer :: lrank, nnodes, nelements + logical :: labort + character(len=*), parameter :: subname='(field_getfldptr)' + ! ---------------------------------------------- + + if (.not.present(rc)) then + call ESMF_LogWrite(trim(subname)//": ERROR rc not present ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + rc = ESMF_SUCCESS + + labort = .true. + if (present(abort)) then + labort = abort + endif + lrank = -99 + + call ESMF_FieldGet(field, status=status, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (status /= ESMF_FIELDSTATUS_COMPLETE) then + lrank = 0 + if (labort) then + call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + rc = ESMF_FAILURE + return + else + call ESMF_LogWrite(trim(subname)//": WARNING data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + endif + else + + call ESMF_FieldGet(field, geomtype=geomtype, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (geomtype == ESMF_GEOMTYPE_GRID) then + call ESMF_FieldGet(field, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + elseif (geomtype == ESMF_GEOMTYPE_MESH) then + call ESMF_FieldGet(field, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(field, mesh=lmesh, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(lmesh, numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (nnodes == 0 .and. nelements == 0) lrank = 0 + else + call ESMF_LogWrite(trim(subname)//": ERROR geomtype not supported ", & + ESMF_LOGMSG_INFO, rc=rc) + rc = ESMF_FAILURE + return + endif ! geomtype + + if (lrank == 0) then + call ESMF_LogWrite(trim(subname)//": no local nodes or elements ", & + ESMF_LOGMSG_INFO) + elseif (lrank == 1) then + if (.not.present(fldptr1)) then + call ESMF_LogWrite(trim(subname)//": ERROR missing rank=1 array ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + call ESMF_FieldGet(field, farrayPtr=fldptr1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + elseif (lrank == 2) then + if (.not.present(fldptr2)) then + call ESMF_LogWrite(trim(subname)//": ERROR missing rank=2 array ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + call ESMF_FieldGet(field, farrayPtr=fldptr2, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + else + call ESMF_LogWrite(trim(subname)//": ERROR in rank ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + endif ! status + + if (present(rank)) then + rank = lrank + endif + + end subroutine field_getfldptr + +!=============================================================================== + + subroutine alarmInit( clock, alarm, option, & + opt_n, opt_ymd, opt_tod, RefTime, alarmname, rc) + + ! Setup an alarm in a clock + ! Notes: The ringtime sent to AlarmCreate MUST be the next alarm + ! time. If you send an arbitrary but proper ringtime from the + ! past and the ring interval, the alarm will always go off on the + ! next clock advance and this will cause serious problems. Even + ! if it makes sense to initialize an alarm with some reference + ! time and the alarm interval, that reference time has to be + ! advance forward to be >= the current time. In the logic below + ! we set an appropriate "NextAlarm" and then we make sure to + ! advance it properly based on the ring interval. + + ! input/output variables + type(ESMF_Clock) , intent(inout) :: clock ! clock + type(ESMF_Alarm) , intent(inout) :: alarm ! alarm + character(len=*) , intent(in) :: option ! alarm option + integer , optional , intent(in) :: opt_n ! alarm freq + integer , optional , intent(in) :: opt_ymd ! alarm ymd + integer , optional , intent(in) :: opt_tod ! alarm tod (sec) + type(ESMF_Time) , optional , intent(in) :: RefTime ! ref time + character(len=*) , optional , intent(in) :: alarmname ! alarm name + integer , intent(inout) :: rc ! Return code + + ! local variables + type(ESMF_Calendar) :: cal ! calendar + integer :: lymd ! local ymd + integer :: ltod ! local tod + integer :: cyy,cmm,cdd,csec ! time info + character(len=64) :: lalarmname ! local alarm name + logical :: update_nextalarm ! update next alarm + type(ESMF_Time) :: CurrTime ! Current Time + type(ESMF_Time) :: NextAlarm ! Next restart alarm time + type(ESMF_TimeInterval) :: AlarmInterval ! Alarm interval + integer :: sec + character(len=*), parameter :: subname = '(set_alarmInit): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lalarmname = 'alarm_unknown' + if (present(alarmname)) lalarmname = trim(alarmname) + ltod = 0 + if (present(opt_tod)) ltod = opt_tod + lymd = -1 + if (present(opt_ymd)) lymd = opt_ymd + + call ESMF_ClockGet(clock, CurrTime=CurrTime, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeGet(CurrTime, yy=cyy, mm=cmm, dd=cdd, s=csec, rc=rc ) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! initial guess of next alarm, this will be updated below + if (present(RefTime)) then + NextAlarm = RefTime + else + NextAlarm = CurrTime + endif + + ! Determine calendar + call ESMF_ClockGet(clock, calendar=cal) + + ! Determine inputs for call to create alarm + selectcase (trim(option)) + + case (optNONE) + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) + if (chkerr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .false. + + case (optNever) + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) + if (chkerr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .false. + + case (optDate) + if (.not. present(opt_ymd)) then + call shr_sys_abort(subname//trim(option)//' requires opt_ymd') + end if + if (lymd < 0 .or. ltod < 0) then + call shr_sys_abort(subname//trim(option)//'opt_ymd, opt_tod invalid') + end if + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call timeInit(NextAlarm, lymd, cal, ltod, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .false. + + case (optIfdays0) + if (.not. present(opt_ymd)) then + call shr_sys_abort(subname//trim(option)//' requires opt_ymd') + end if + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=opt_n, s=0, calendar=cal, rc=rc ) + if (chkerr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .true. + + case (optNSteps) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNStep) + if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNSeconds) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNSecond) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMinutes) + call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMinute) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNHours) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNHour) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNDays) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNDay) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMonths) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMonth) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optMonthly) + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=1, s=0, calendar=cal, rc=rc ) + if (chkerr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .true. + + case (optNYears) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNYear) + if (.not.present(opt_n)) then + call shr_sys_abort(subname//trim(option)//' requires opt_n') + end if + if (opt_n <= 0) then + call shr_sys_abort(subname//trim(option)//' invalid opt_n') + end if + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optYearly) + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=1, dd=1, s=0, calendar=cal, rc=rc ) + if (chkerr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .true. + + case default + call shr_sys_abort(subname//'unknown option '//trim(option)) + + end select + + ! -------------------------------------------------------------------------------- + ! --- AlarmInterval and NextAlarm should be set --- + ! -------------------------------------------------------------------------------- + + ! --- advance Next Alarm so it won't ring on first timestep for + ! --- most options above. go back one alarminterval just to be careful + + if (update_nextalarm) then + NextAlarm = NextAlarm - AlarmInterval + do while (NextAlarm <= CurrTime) + NextAlarm = NextAlarm + AlarmInterval + enddo + endif + + alarm = ESMF_AlarmCreate( name=lalarmname, clock=clock, ringTime=NextAlarm, & + ringInterval=AlarmInterval, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + end subroutine alarmInit + +!=============================================================================== + + subroutine timeInit( Time, ymd, cal, tod, rc) + + ! Create the ESMF_Time object corresponding to the given input time, + ! given in YMD (Year Month Day) and TOD (Time-of-day) format. + ! Set the time by an integer as YYYYMMDD and integer seconds in the day + + ! input/output parameters: + type(ESMF_Time) , intent(inout) :: Time ! ESMF time + integer , intent(in) :: ymd ! year, month, day YYYYMMDD + type(ESMF_Calendar) , intent(in) :: cal ! ESMF calendar + integer , intent(in) :: tod ! time of day in seconds + integer , intent(out) :: rc + + ! local variables + integer :: year, mon, day ! year, month, day as integers + integer :: tdate ! temporary date + integer :: date ! coded-date (yyyymmdd) + character(len=*), parameter :: subname='(timeInit)' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + if ( (ymd < 0) .or. (tod < 0) .or. (tod > SecPerDay) )then + call shr_sys_abort( subname//'ERROR yymmdd is a negative number or time-of-day out of bounds' ) + end if + + tdate = abs(date) + year = int(tdate/10000) + if (date < 0) year = -year + mon = int( mod(tdate,10000)/ 100) + day = mod(tdate, 100) + + call ESMF_TimeSet( Time, yy=year, mm=mon, dd=day, s=tod, calendar=cal, rc=rc ) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + end subroutine timeInit + +!=============================================================================== + + logical function chkerr(rc, line, file) + + integer, intent(in) :: rc + integer, intent(in) :: line + character(len=*), intent(in) :: file + + integer :: lrc + + chkerr = .false. + lrc = rc + if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=line, file=file)) then + chkerr = .true. + endif + end function chkerr + + + + + ! FROM + +end module lnd_shr_methods diff --git a/src/cpl/lilac/shr_utils_mod.F90 b/src/cpl/lilac/shr_utils_mod.F90 new file mode 100644 index 0000000000..90aba85801 --- /dev/null +++ b/src/cpl/lilac/shr_utils_mod.F90 @@ -0,0 +1,47 @@ +module shr_utils_mod + + use shr_sys_mod, only : shr_sys_abort + implicit none + private + + public :: shr_utils_ChkErr + + character(*), parameter :: u_FILE_u = __FILE__ + +!========================================================= +contains +!========================================================= + + logical function shr_utils_ChkErr(rc, line, file, mpierr) + + use mpi , only : MPI_ERROR_STRING, MPI_MAX_ERROR_STRING, MPI_SUCCESS + use ESMF, only : ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU, ESMF_LOGMSG_INFO + use ESMF, only : ESMF_FAILURE, ESMF_LogWrite + + ! input/output arguments + integer , intent(in) :: rc + integer , intent(in) :: line + character(len=*) , intent(in) :: file + logical, optional , intent(in) :: mpierr + + ! local variables + character(MPI_MAX_ERROR_STRING) :: lstring + integer :: dbrc, lrc, len, ierr + !------------------------------------------ + + shr_utils_ChkErr = .false. + lrc = rc + if (present(mpierr) .and. mpierr) then + if (rc == MPI_SUCCESS) return + call MPI_ERROR_STRING(rc, lstring, len, ierr) + call ESMF_LogWrite("ERROR: "//trim(lstring), ESMF_LOGMSG_INFO, line=line, file=file, rc=dbrc) + lrc = ESMF_FAILURE + endif + + if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=line, file=file)) then + shr_utils_ChkErr = .true. + endif + + end function shr_utils_ChkErr + +end module shr_utils_mod diff --git a/src/cpl/mct/clm_cpl_indices.F90 b/src/cpl/mct/clm_cpl_indices.F90 new file mode 100644 index 0000000000..525b709cc6 --- /dev/null +++ b/src/cpl/mct/clm_cpl_indices.F90 @@ -0,0 +1,330 @@ +module clm_cpl_indices + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Module containing the indices for the fields passed between CLM and + ! the driver. Includes the River Transport Model fields (RTM) and the + ! fields needed by the land-ice component (sno). + ! + ! !USES: + + use shr_sys_mod, only : shr_sys_abort + implicit none + + SAVE + private ! By default make data private + ! + ! !PUBLIC MEMBER FUNCTIONS: + public :: clm_cpl_indices_set ! Set the coupler indices + ! + ! !PUBLIC DATA MEMBERS: + ! + integer , public :: glc_nec ! number of elevation classes for glacier_mec landunits + ! (from coupler) - must equal maxpatch_glcmec from namelist + + ! lnd -> drv (required) + + integer, public ::index_l2x_Flrl_rofsur ! lnd->rtm input liquid surface fluxes + integer, public ::index_l2x_Flrl_rofgwl ! lnd->rtm input liquid gwl fluxes + integer, public ::index_l2x_Flrl_rofsub ! lnd->rtm input liquid subsurface fluxes + integer, public ::index_l2x_Flrl_rofi ! lnd->rtm input frozen fluxes + integer, public ::index_l2x_Flrl_irrig ! irrigation withdrawal + + integer, public ::index_l2x_Sl_t ! temperature + integer, public ::index_l2x_Sl_tref ! 2m reference temperature + integer, public ::index_l2x_Sl_qref ! 2m reference specific humidity + integer, public ::index_l2x_Sl_avsdr ! albedo: direct , visible + integer, public ::index_l2x_Sl_anidr ! albedo: direct , near-ir + integer, public ::index_l2x_Sl_avsdf ! albedo: diffuse, visible + integer, public ::index_l2x_Sl_anidf ! albedo: diffuse, near-ir + integer, public ::index_l2x_Sl_snowh ! snow height + integer, public ::index_l2x_Sl_u10 ! 10m wind + integer, public ::index_l2x_Sl_ddvel ! dry deposition velocities (optional) + integer, public ::index_l2x_Sl_fv ! friction velocity + integer, public ::index_l2x_Sl_ram1 ! aerodynamical resistance + integer, public ::index_l2x_Sl_soilw ! volumetric soil water + integer, public ::index_l2x_Fall_taux ! wind stress, zonal + integer, public ::index_l2x_Fall_tauy ! wind stress, meridional + integer, public ::index_l2x_Fall_lat ! latent heat flux + integer, public ::index_l2x_Fall_sen ! sensible heat flux + integer, public ::index_l2x_Fall_lwup ! upward longwave heat flux + integer, public ::index_l2x_Fall_evap ! evaporation water flux + integer, public ::index_l2x_Fall_swnet ! heat flux shortwave net + integer, public ::index_l2x_Fall_fco2_lnd ! co2 flux **For testing set to 0 + integer, public ::index_l2x_Fall_flxdst1 ! dust flux size bin 1 + integer, public ::index_l2x_Fall_flxdst2 ! dust flux size bin 2 + integer, public ::index_l2x_Fall_flxdst3 ! dust flux size bin 3 + integer, public ::index_l2x_Fall_flxdst4 ! dust flux size bin 4 + integer, public ::index_l2x_Fall_flxvoc ! MEGAN fluxes + integer, public ::index_l2x_Fall_flxfire ! Fire fluxes + integer, public ::index_l2x_Sl_ztopfire ! Top of fire emissions (m) + + ! In the following, index 0 is bare land, other indices are glc elevation classes + integer, allocatable, public ::index_l2x_Sl_tsrf(:) ! glc MEC temperature + integer, allocatable, public ::index_l2x_Sl_topo(:) ! glc MEC topo height + integer, allocatable, public ::index_l2x_Flgl_qice(:) ! glc MEC ice flux + + integer, public ::index_x2l_Sa_methane + integer, public ::index_l2x_Fall_methane + + integer, public :: nflds_l2x = 0 + + ! drv -> lnd (required) + + integer, public ::index_x2l_Sa_z ! bottom atm level height + integer, public ::index_x2l_Sa_topo ! atm surface height (m) + integer, public ::index_x2l_Sa_u ! bottom atm level zon wind + integer, public ::index_x2l_Sa_v ! bottom atm level mer wind + integer, public ::index_x2l_Sa_ptem ! bottom atm level pot temp + integer, public ::index_x2l_Sa_shum ! bottom atm level spec hum + integer, public ::index_x2l_Sa_pbot ! bottom atm level pressure + integer, public ::index_x2l_Sa_tbot ! bottom atm level temp + integer, public ::index_x2l_Faxa_lwdn ! downward lw heat flux + integer, public ::index_x2l_Faxa_rainc ! prec: liquid "convective" + integer, public ::index_x2l_Faxa_rainl ! prec: liquid "large scale" + integer, public ::index_x2l_Faxa_snowc ! prec: frozen "convective" + integer, public ::index_x2l_Faxa_snowl ! prec: frozen "large scale" + integer, public ::index_x2l_Faxa_swndr ! sw: nir direct downward + integer, public ::index_x2l_Faxa_swvdr ! sw: vis direct downward + integer, public ::index_x2l_Faxa_swndf ! sw: nir diffuse downward + integer, public ::index_x2l_Faxa_swvdf ! sw: vis diffuse downward + integer, public ::index_x2l_Sa_co2prog ! bottom atm level prognostic co2 + integer, public ::index_x2l_Sa_co2diag ! bottom atm level diagnostic co2 + integer, public ::index_x2l_Faxa_bcphidry ! flux: Black Carbon hydrophilic dry deposition + integer, public ::index_x2l_Faxa_bcphodry ! flux: Black Carbon hydrophobic dry deposition + integer, public ::index_x2l_Faxa_bcphiwet ! flux: Black Carbon hydrophilic wet deposition + integer, public ::index_x2l_Faxa_ocphidry ! flux: Organic Carbon hydrophilic dry deposition + integer, public ::index_x2l_Faxa_ocphodry ! flux: Organic Carbon hydrophobic dry deposition + integer, public ::index_x2l_Faxa_ocphiwet ! flux: Organic Carbon hydrophilic dry deposition + integer, public ::index_x2l_Faxa_dstwet1 ! flux: Size 1 dust -- wet deposition + integer, public ::index_x2l_Faxa_dstwet2 ! flux: Size 2 dust -- wet deposition + integer, public ::index_x2l_Faxa_dstwet3 ! flux: Size 3 dust -- wet deposition + integer, public ::index_x2l_Faxa_dstwet4 ! flux: Size 4 dust -- wet deposition + integer, public ::index_x2l_Faxa_dstdry1 ! flux: Size 1 dust -- dry deposition + integer, public ::index_x2l_Faxa_dstdry2 ! flux: Size 2 dust -- dry deposition + integer, public ::index_x2l_Faxa_dstdry3 ! flux: Size 3 dust -- dry deposition + integer, public ::index_x2l_Faxa_dstdry4 ! flux: Size 4 dust -- dry deposition + + integer, public ::index_x2l_Faxa_nhx ! flux nhx from atm + integer, public ::index_x2l_Faxa_noy ! flux noy from atm + + integer, public ::index_x2l_Flrr_flood ! rtm->lnd rof flood flux + integer, public ::index_x2l_Flrr_volr ! rtm->lnd rof volr total volume + integer, public ::index_x2l_Flrr_volrmch ! rtm->lnd rof volr main channel volume + + ! In the following, index 0 is bare land, other indices are glc elevation classes + integer, allocatable, public ::index_x2l_Sg_ice_covered(:) ! Fraction of glacier from glc model + integer, allocatable, public ::index_x2l_Sg_topo(:) ! Topo height from glc model + integer, allocatable, public ::index_x2l_Flgg_hflx(:) ! Heat flux from glc model + + integer, public ::index_x2l_Sg_icemask + integer, public ::index_x2l_Sg_icemask_coupled_fluxes + + integer, public :: nflds_x2l = 0 + + !----------------------------------------------------------------------- + +contains + + !----------------------------------------------------------------------- + subroutine clm_cpl_indices_set( ) + ! + ! !DESCRIPTION: + ! Set the coupler indices needed by the land model coupler + ! interface. + ! + ! !USES: + use seq_flds_mod , only: seq_flds_x2l_fields, seq_flds_l2x_fields + use mct_mod , only: mct_aVect, mct_aVect_init, mct_avect_indexra + use mct_mod , only: mct_aVect_clean, mct_avect_nRattr + use seq_drydep_mod , only: drydep_fields_token, lnd_drydep + use shr_megan_mod , only: shr_megan_fields_token, shr_megan_mechcomps_n + use shr_fire_emis_mod,only: shr_fire_emis_fields_token, shr_fire_emis_ztop_token, shr_fire_emis_mechcomps_n + use clm_varctl , only: ndep_from_cpl + use glc_elevclass_mod, only: glc_get_num_elevation_classes, glc_elevclass_as_string + ! + ! !ARGUMENTS: + implicit none + ! + ! !REVISION HISTORY: + ! Author: Mariana Vertenstein + ! 01/2011, Erik Kluzek: Added protex headers + ! + ! !LOCAL VARIABLES: + type(mct_aVect) :: l2x ! temporary, land to coupler + type(mct_aVect) :: x2l ! temporary, coupler to land + integer :: num + character(len=:), allocatable :: nec_str ! string version of glc elev. class number + character(len=64) :: name + character(len=32) :: subname = 'clm_cpl_indices_set' ! subroutine name + !----------------------------------------------------------------------- + + ! Determine attribute vector indices + + ! create temporary attribute vectors + call mct_aVect_init(x2l, rList=seq_flds_x2l_fields, lsize=1) + nflds_x2l = mct_avect_nRattr(x2l) + + call mct_aVect_init(l2x, rList=seq_flds_l2x_fields, lsize=1) + nflds_l2x = mct_avect_nRattr(l2x) + + !------------------------------------------------------------- + ! clm -> drv + !------------------------------------------------------------- + + index_l2x_Flrl_rofsur = mct_avect_indexra(l2x,'Flrl_rofsur') + index_l2x_Flrl_rofgwl = mct_avect_indexra(l2x,'Flrl_rofgwl') + index_l2x_Flrl_rofsub = mct_avect_indexra(l2x,'Flrl_rofsub') + index_l2x_Flrl_rofi = mct_avect_indexra(l2x,'Flrl_rofi') + index_l2x_Flrl_irrig = mct_avect_indexra(l2x,'Flrl_irrig') + + index_l2x_Sl_t = mct_avect_indexra(l2x,'Sl_t') + index_l2x_Sl_snowh = mct_avect_indexra(l2x,'Sl_snowh') + index_l2x_Sl_avsdr = mct_avect_indexra(l2x,'Sl_avsdr') + index_l2x_Sl_anidr = mct_avect_indexra(l2x,'Sl_anidr') + index_l2x_Sl_avsdf = mct_avect_indexra(l2x,'Sl_avsdf') + index_l2x_Sl_anidf = mct_avect_indexra(l2x,'Sl_anidf') + index_l2x_Sl_tref = mct_avect_indexra(l2x,'Sl_tref') + index_l2x_Sl_qref = mct_avect_indexra(l2x,'Sl_qref') + index_l2x_Sl_u10 = mct_avect_indexra(l2x,'Sl_u10') + index_l2x_Sl_ram1 = mct_avect_indexra(l2x,'Sl_ram1') + index_l2x_Sl_fv = mct_avect_indexra(l2x,'Sl_fv') + index_l2x_Sl_soilw = mct_avect_indexra(l2x,'Sl_soilw',perrwith='quiet') + + if ( lnd_drydep )then + index_l2x_Sl_ddvel = mct_avect_indexra(l2x, trim(drydep_fields_token)) + else + index_l2x_Sl_ddvel = 0 + end if + + index_l2x_Fall_taux = mct_avect_indexra(l2x,'Fall_taux') + index_l2x_Fall_tauy = mct_avect_indexra(l2x,'Fall_tauy') + index_l2x_Fall_lat = mct_avect_indexra(l2x,'Fall_lat') + index_l2x_Fall_sen = mct_avect_indexra(l2x,'Fall_sen') + index_l2x_Fall_lwup = mct_avect_indexra(l2x,'Fall_lwup') + index_l2x_Fall_evap = mct_avect_indexra(l2x,'Fall_evap') + index_l2x_Fall_swnet = mct_avect_indexra(l2x,'Fall_swnet') + index_l2x_Fall_flxdst1 = mct_avect_indexra(l2x,'Fall_flxdst1') + index_l2x_Fall_flxdst2 = mct_avect_indexra(l2x,'Fall_flxdst2') + index_l2x_Fall_flxdst3 = mct_avect_indexra(l2x,'Fall_flxdst3') + index_l2x_Fall_flxdst4 = mct_avect_indexra(l2x,'Fall_flxdst4') + + index_l2x_Fall_fco2_lnd = mct_avect_indexra(l2x,'Fall_fco2_lnd',perrwith='quiet') + + index_l2x_Fall_methane = mct_avect_indexra(l2x,'Fall_methane',perrWith='quiet') + + ! MEGAN fluxes + if (shr_megan_mechcomps_n>0) then + index_l2x_Fall_flxvoc = mct_avect_indexra(l2x,trim(shr_megan_fields_token)) + else + index_l2x_Fall_flxvoc = 0 + endif + + ! Fire fluxes + if (shr_fire_emis_mechcomps_n>0) then + index_l2x_Fall_flxfire = mct_avect_indexra(l2x,trim(shr_fire_emis_fields_token)) + index_l2x_Sl_ztopfire = mct_avect_indexra(l2x,trim(shr_fire_emis_ztop_token)) + else + index_l2x_Fall_flxfire = 0 + index_l2x_Sl_ztopfire = 0 + endif + + !------------------------------------------------------------- + ! drv -> clm + !------------------------------------------------------------- + + index_x2l_Sa_z = mct_avect_indexra(x2l,'Sa_z') + index_x2l_Sa_topo = mct_avect_indexra(x2l,'Sa_topo') + index_x2l_Sa_u = mct_avect_indexra(x2l,'Sa_u') + index_x2l_Sa_v = mct_avect_indexra(x2l,'Sa_v') + index_x2l_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') + index_x2l_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') + index_x2l_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') + index_x2l_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') + index_x2l_Sa_co2prog = mct_avect_indexra(x2l,'Sa_co2prog',perrwith='quiet') + index_x2l_Sa_co2diag = mct_avect_indexra(x2l,'Sa_co2diag',perrwith='quiet') + + index_x2l_Sa_methane = mct_avect_indexra(x2l,'Sa_methane',perrWith='quiet') + + index_x2l_Flrr_volr = mct_avect_indexra(x2l,'Flrr_volr') + index_x2l_Flrr_volrmch = mct_avect_indexra(x2l,'Flrr_volrmch') + + index_x2l_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') + index_x2l_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') + index_x2l_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') + index_x2l_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') + index_x2l_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') + index_x2l_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') + index_x2l_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') + index_x2l_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') + index_x2l_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') + index_x2l_Faxa_bcphidry = mct_avect_indexra(x2l,'Faxa_bcphidry') + index_x2l_Faxa_bcphodry = mct_avect_indexra(x2l,'Faxa_bcphodry') + index_x2l_Faxa_bcphiwet = mct_avect_indexra(x2l,'Faxa_bcphiwet') + index_x2l_Faxa_ocphidry = mct_avect_indexra(x2l,'Faxa_ocphidry') + index_x2l_Faxa_ocphodry = mct_avect_indexra(x2l,'Faxa_ocphodry') + index_x2l_Faxa_ocphiwet = mct_avect_indexra(x2l,'Faxa_ocphiwet') + index_x2l_Faxa_dstdry1 = mct_avect_indexra(x2l,'Faxa_dstdry1') + index_x2l_Faxa_dstdry2 = mct_avect_indexra(x2l,'Faxa_dstdry2') + index_x2l_Faxa_dstdry3 = mct_avect_indexra(x2l,'Faxa_dstdry3') + index_x2l_Faxa_dstdry4 = mct_avect_indexra(x2l,'Faxa_dstdry4') + index_x2l_Faxa_dstwet1 = mct_avect_indexra(x2l,'Faxa_dstwet1') + index_x2l_Faxa_dstwet2 = mct_avect_indexra(x2l,'Faxa_dstwet2') + index_x2l_Faxa_dstwet3 = mct_avect_indexra(x2l,'Faxa_dstwet3') + index_x2l_Faxa_dstwet4 = mct_avect_indexra(x2l,'Faxa_dstwet4') + + index_x2l_Faxa_nhx = mct_avect_indexra(x2l,'Faxa_nhx', perrWith='quiet') + index_x2l_Faxa_noy = mct_avect_indexra(x2l,'Faxa_noy', perrWith='quiet') + + if (index_x2l_Faxa_nhx > 0 .and. index_x2l_Faxa_noy > 0) then + ndep_from_cpl = .true. + end if + + index_x2l_Flrr_flood = mct_avect_indexra(x2l,'Flrr_flood') + + !------------------------------------------------------------- + ! glc coupling + !------------------------------------------------------------- + + index_x2l_Sg_icemask = mct_avect_indexra(x2l,'Sg_icemask') + index_x2l_Sg_icemask_coupled_fluxes = mct_avect_indexra(x2l,'Sg_icemask_coupled_fluxes') + + glc_nec = glc_get_num_elevation_classes() + if (glc_nec < 1) then + call shr_sys_abort('ERROR: In CLM4.5 and later, glc_nec must be at least 1.') + end if + + ! Create coupling fields for all glc elevation classes (1:glc_nec) plus bare land + ! (index 0). + allocate(index_l2x_Sl_tsrf(0:glc_nec)) + allocate(index_l2x_Sl_topo(0:glc_nec)) + allocate(index_l2x_Flgl_qice(0:glc_nec)) + allocate(index_x2l_Sg_ice_covered(0:glc_nec)) + allocate(index_x2l_Sg_topo(0:glc_nec)) + allocate(index_x2l_Flgg_hflx(0:glc_nec)) + + do num = 0,glc_nec + nec_str = glc_elevclass_as_string(num) + + name = 'Sg_ice_covered' // nec_str + index_x2l_Sg_ice_covered(num) = mct_avect_indexra(x2l,trim(name)) + name = 'Sg_topo' // nec_str + index_x2l_Sg_topo(num) = mct_avect_indexra(x2l,trim(name)) + name = 'Flgg_hflx' // nec_str + index_x2l_Flgg_hflx(num) = mct_avect_indexra(x2l,trim(name)) + + name = 'Sl_tsrf' // nec_str + index_l2x_Sl_tsrf(num) = mct_avect_indexra(l2x,trim(name)) + name = 'Sl_topo' // nec_str + index_l2x_Sl_topo(num) = mct_avect_indexra(l2x,trim(name)) + name = 'Flgl_qice' // nec_str + index_l2x_Flgl_qice(num) = mct_avect_indexra(l2x,trim(name)) + end do + + call mct_aVect_clean(x2l) + call mct_aVect_clean(l2x) + + end subroutine clm_cpl_indices_set + +!======================================================================= + +end module clm_cpl_indices diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 new file mode 100644 index 0000000000..42e038ea48 --- /dev/null +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -0,0 +1,688 @@ +module lnd_comp_mct + + !--------------------------------------------------------------------------- + ! !DESCRIPTION: + ! Interface of the active land model component of CESM the CLM (Community Land Model) + ! with the main CESM driver. This is a thin interface taking CESM driver information + ! in MCT (Model Coupling Toolkit) format and converting it to use by CLM. + ! + ! !uses: + use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_sys_mod , only : shr_sys_flush + use mct_mod , only : mct_avect, mct_gsmap, mct_gGrid + use decompmod , only : bounds_type, ldecomp + use lnd_import_export, only : lnd_import, lnd_export + ! + ! !public member functions: + implicit none + save + private ! by default make data private + ! + ! !public member functions: + public :: lnd_init_mct ! clm initialization + public :: lnd_run_mct ! clm run phase + public :: lnd_final_mct ! clm finalization/cleanup + ! + ! !private member functions: + private :: lnd_setgsmap_mct ! set the land model mct gs map + private :: lnd_domain_mct ! set the land model domain information + private :: lnd_handle_resume ! handle pause/resume signals from the coupler + !--------------------------------------------------------------------------- + +contains + + !==================================================================================== + + subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) + ! + ! !DESCRIPTION: + ! Initialize land surface model and obtain relevant atmospheric model arrays + ! back from (i.e. albedos, surface temperature and snow cover over land). + ! + ! !USES: + use shr_kind_mod , only : shr_kind_cl + use abortutils , only : endrun + use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday + use clm_initializeMod, only : initialize1, initialize2 + use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst + use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog, noland + use clm_varctl , only : inst_index, inst_suffix, inst_name + use clm_varorb , only : eccen, obliqr, lambm0, mvelpp + use controlMod , only : control_setNL + use decompMod , only : get_proc_bounds + use domainMod , only : ldomain + use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel + use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel + use shr_file_mod , only : shr_file_getUnit, shr_file_setIO + use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs + use seq_timemgr_mod , only : seq_timemgr_EClockGetData + use seq_infodata_mod , only : seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData, & + seq_infodata_start_type_start, seq_infodata_start_type_cont, & + seq_infodata_start_type_brnch + use seq_comm_mct , only : seq_comm_suffix, seq_comm_inst, seq_comm_name + use seq_flds_mod , only : seq_flds_x2l_fields, seq_flds_l2x_fields + use spmdMod , only : masterproc, spmd_init + use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_cpl_indices , only : clm_cpl_indices_set + use mct_mod , only : mct_aVect_init, mct_aVect_zero, mct_gsMap_lsize + use ESMF + ! + ! !ARGUMENTS: + type(ESMF_Clock), intent(inout) :: EClock ! Input synchronization clock + type(seq_cdata), intent(inout) :: cdata_l ! Input land-model driver data + type(mct_aVect), intent(inout) :: x2l_l, l2x_l ! land model import and export states + character(len=*), optional, intent(in) :: NLFilename ! Namelist filename to read + ! + ! !LOCAL VARIABLES: + integer :: LNDID ! Land identifyer + integer :: mpicom_lnd ! MPI communicator + type(mct_gsMap), pointer :: GSMap_lnd ! Land model MCT GS map + type(mct_gGrid), pointer :: dom_l ! Land model domain + type(seq_infodata_type), pointer :: infodata ! CESM driver level info data + integer :: lsize ! size of attribute vector + integer :: g,i,j ! indices + integer :: dtime_sync ! coupling time-step from the input synchronization clock + integer :: dtime_clm ! clm time-step + logical :: exists ! true if file exists + logical :: atm_aero ! Flag if aerosol data sent from atm model + real(r8) :: scmlat ! single-column latitude + real(r8) :: scmlon ! single-column longitude + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + character(len=SHR_KIND_CL) :: caseid ! case identifier name + character(len=SHR_KIND_CL) :: ctitle ! case description title + character(len=SHR_KIND_CL) :: starttype ! start-type (startup, continue, branch, hybrid) + character(len=SHR_KIND_CL) :: calendar ! calendar type name + character(len=SHR_KIND_CL) :: hostname ! hostname of machine running on + character(len=SHR_KIND_CL) :: version ! Model version + character(len=SHR_KIND_CL) :: username ! user running the model + integer :: nsrest ! clm restart type + integer :: ref_ymd ! reference date (YYYYMMDD) + integer :: ref_tod ! reference time of day (sec) + integer :: start_ymd ! start date (YYYYMMDD) + integer :: start_tod ! start time of day (sec) + integer :: stop_ymd ! stop date (YYYYMMDD) + integer :: stop_tod ! stop time of day (sec) + logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type + integer :: lbnum ! input to memory diagnostic + integer :: shrlogunit,shrloglev ! old values for log unit and log level + type(bounds_type) :: bounds ! bounds + character(len=32), parameter :: sub = 'lnd_init_mct' + character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" + !----------------------------------------------------------------------- + + ! Set cdata data + + call seq_cdata_setptrs(cdata_l, ID=LNDID, mpicom=mpicom_lnd, & + gsMap=GSMap_lnd, dom=dom_l, infodata=infodata) + + ! Determine attriute vector indices + + call clm_cpl_indices_set() + + ! Initialize clm MPI communicator + + call spmd_init( mpicom_lnd, LNDID ) + +#if (defined _MEMTRACE) + if(masterproc) then + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_init_mct:start::',lbnum) + endif +#endif + + inst_name = seq_comm_name(LNDID) + inst_index = seq_comm_inst(LNDID) + inst_suffix = seq_comm_suffix(LNDID) + + ! Initialize io log unit + + call shr_file_getLogUnit (shrlogunit) + if (masterproc) then + inquire(file='lnd_modelio.nml'//trim(inst_suffix),exist=exists) + if (exists) then + iulog = shr_file_getUnit() + call shr_file_setIO('lnd_modelio.nml'//trim(inst_suffix),iulog) + end if + write(iulog,format) "CLM land model initialization" + else + iulog = shrlogunit + end if + + call shr_file_getLogLevel(shrloglev) + call shr_file_setLogUnit (iulog) + + ! Use infodata to set orbital values + + call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & + orb_lambm0=lambm0, orb_obliqr=obliqr ) + + ! Consistency check on namelist filename + + call control_setNL("lnd_in"//trim(inst_suffix)) + + ! Initialize clm + ! initialize1 reads namelist, grid and surface data (need this to initialize gsmap) + ! initialize2 performs rest of initialization + + call seq_timemgr_EClockGetData(EClock, & + start_ymd=start_ymd, & + start_tod=start_tod, ref_ymd=ref_ymd, & + ref_tod=ref_tod, stop_ymd=stop_ymd, & + stop_tod=stop_tod, & + calendar=calendar ) + call seq_infodata_GetData(infodata, case_name=caseid, & + case_desc=ctitle, single_column=single_column, & + scmlat=scmlat, scmlon=scmlon, & + brnch_retain_casename=brnch_retain_casename, & + start_type=starttype, model_version=version, & + hostname=hostname, username=username ) + call set_timemgr_init( calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & + ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & + stop_tod_in=stop_tod) + if ( trim(starttype) == trim(seq_infodata_start_type_start)) then + nsrest = nsrStartup + else if (trim(starttype) == trim(seq_infodata_start_type_cont) ) then + nsrest = nsrContinue + else if (trim(starttype) == trim(seq_infodata_start_type_brnch)) then + nsrest = nsrBranch + else + call endrun( sub//' ERROR: unknown starttype' ) + end if + + call clm_varctl_set(caseid_in=caseid, ctitle_in=ctitle, & + brnch_retain_casename_in=brnch_retain_casename, & + single_column_in=single_column, scmlat_in=scmlat, & + scmlon_in=scmlon, nsrest_in=nsrest, version_in=version, & + hostname_in=hostname, username_in=username) + + ! Read namelist, grid and surface data + + call initialize1( ) + + ! If no land then exit out of initialization + + if ( noland ) then + call seq_infodata_PutData( infodata, lnd_present =.false.) + call seq_infodata_PutData( infodata, lnd_prognostic=.false.) + return + end if + + ! Determine if aerosol and dust deposition come from atmosphere component + + call seq_infodata_GetData(infodata, atm_aero=atm_aero ) + if ( .not. atm_aero )then + call endrun( sub//' ERROR: atmosphere model MUST send aerosols to CLM' ) + end if + + ! Initialize clm gsMap, clm domain and clm attribute vectors + + call get_proc_bounds( bounds ) + + call lnd_SetgsMap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) + lsize = mct_gsMap_lsize(gsMap_lnd, mpicom_lnd) + + call lnd_domain_mct( bounds, lsize, gsMap_lnd, dom_l ) + + call mct_aVect_init(x2l_l, rList=seq_flds_x2l_fields, lsize=lsize) + call mct_aVect_zero(x2l_l) + + call mct_aVect_init(l2x_l, rList=seq_flds_l2x_fields, lsize=lsize) + call mct_aVect_zero(l2x_l) + + ! Finish initializing clm + + call initialize2() + + ! Check that clm internal dtime aligns with clm coupling interval + + call seq_timemgr_EClockGetData(EClock, dtime=dtime_sync ) + dtime_clm = get_step_size() + if (masterproc) then + write(iulog,*)'dtime_sync= ',dtime_sync,& + ' dtime_clm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) + end if + if (mod(dtime_sync,dtime_clm) /= 0) then + write(iulog,*)'clm dtime ',dtime_clm,' and Eclock dtime ',& + dtime_sync,' never align' + call endrun( sub//' ERROR: time out of sync' ) + end if + + ! Create land export state + + call lnd_export(bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) + + ! Fill in infodata settings + + call seq_infodata_PutData(infodata, lnd_prognostic=.true.) + call seq_infodata_PutData(infodata, lnd_nx=ldomain%ni, lnd_ny=ldomain%nj) + + ! Get infodata info + + call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) + call set_nextsw_cday(nextsw_cday) + call lnd_handle_resume( cdata_l ) + + ! Reset shr logging to original values + + call shr_file_setLogUnit (shrlogunit) + call shr_file_setLogLevel(shrloglev) + +#if (defined _MEMTRACE) + if(masterproc) then + write(iulog,*) TRIM(Sub) // ':end::' + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_int_mct:end::',lbnum) + call memmon_reset_addr() + endif +#endif + + end subroutine lnd_init_mct + + !==================================================================================== + + subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) + ! + ! !DESCRIPTION: + ! Run clm model + ! + ! !USES: + use shr_kind_mod , only : r8 => shr_kind_r8 + use clm_instMod , only : water_inst, lnd2atm_inst, atm2lnd_inst, lnd2glc_inst, glc2lnd_inst + use clm_driver , only : clm_drv + use clm_time_manager, only : get_curr_date, get_nstep, get_curr_calday, get_step_size + use clm_time_manager, only : advance_timestep, set_nextsw_cday,update_rad_dtime + use decompMod , only : get_proc_bounds + use abortutils , only : endrun + use clm_varctl , only : iulog + use clm_varorb , only : eccen, obliqr, lambm0, mvelpp + use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel + use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel + use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs + use seq_timemgr_mod , only : seq_timemgr_EClockGetData, seq_timemgr_StopAlarmIsOn + use seq_timemgr_mod , only : seq_timemgr_RestartAlarmIsOn, seq_timemgr_EClockDateInSync + use seq_infodata_mod, only : seq_infodata_type, seq_infodata_GetData + use spmdMod , only : masterproc, mpicom + use perf_mod , only : t_startf, t_stopf, t_barrierf + use shr_orb_mod , only : shr_orb_decl + use ESMF + ! + ! !ARGUMENTS: + type(ESMF_Clock) , intent(inout) :: EClock ! Input synchronization clock from driver + type(seq_cdata) , intent(inout) :: cdata_l ! Input driver data for land model + type(mct_aVect) , intent(inout) :: x2l_l ! Import state to land model + type(mct_aVect) , intent(inout) :: l2x_l ! Export state from land model + ! + ! !LOCAL VARIABLES: + integer :: ymd_sync ! Sync date (YYYYMMDD) + integer :: yr_sync ! Sync current year + integer :: mon_sync ! Sync current month + integer :: day_sync ! Sync current day + integer :: tod_sync ! Sync current time of day (sec) + integer :: ymd ! CLM current date (YYYYMMDD) + integer :: yr ! CLM current year + integer :: mon ! CLM current month + integer :: day ! CLM current day + integer :: tod ! CLM current time of day (sec) + integer :: dtime ! time step increment (sec) + integer :: nstep ! time step index + logical :: rstwr_sync ! .true. ==> write restart file before returning + logical :: rstwr ! .true. ==> write restart file before returning + logical :: nlend_sync ! Flag signaling last time-step + logical :: nlend ! .true. ==> last time-step + logical :: dosend ! true => send data back to driver + logical :: doalb ! .true. ==> do albedo calculation on this time step + logical :: rof_prognostic ! .true. => running with a prognostic ROF model + logical :: glc_present ! .true. => running with a non-stub GLC model + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + real(r8) :: caldayp1 ! clm calday plus dtime offset + integer :: shrlogunit,shrloglev ! old values for share log unit and log level + integer :: lbnum ! input to memory diagnostic + integer :: g,i,lsize ! counters + real(r8) :: calday ! calendar day for nstep + real(r8) :: declin ! solar declination angle in radians for nstep + real(r8) :: declinp1 ! solar declination angle in radians for nstep+1 + real(r8) :: eccf ! earth orbit eccentricity factor + real(r8) :: recip ! reciprical + logical,save :: first_call = .true. ! first call work + type(seq_infodata_type),pointer :: infodata ! CESM information from the driver + type(mct_gGrid), pointer :: dom_l ! Land model domain data + type(bounds_type) :: bounds ! bounds + character(len=32) :: rdate ! date char string for restart file names + character(len=32), parameter :: sub = "lnd_run_mct" + !--------------------------------------------------------------------------- + + ! Determine processor bounds + + call get_proc_bounds(bounds) + +#if (defined _MEMTRACE) + if(masterproc) then + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_run_mct:start::',lbnum) + endif +#endif + + ! Reset shr logging to my log file + call shr_file_getLogUnit (shrlogunit) + call shr_file_getLogLevel(shrloglev) + call shr_file_setLogUnit (iulog) + + ! Determine time of next atmospheric shortwave calculation + call seq_cdata_setptrs(cdata_l, infodata=infodata, dom=dom_l) + call seq_timemgr_EClockGetData(EClock, & + curr_ymd=ymd, curr_tod=tod_sync, & + curr_yr=yr_sync, curr_mon=mon_sync, curr_day=day_sync) + call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) + + call set_nextsw_cday( nextsw_cday ) + dtime = get_step_size() + + ! Handle pause/resume signals from coupler + call lnd_handle_resume( cdata_l ) + + write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync,mon_sync,day_sync,tod_sync + nlend_sync = seq_timemgr_StopAlarmIsOn( EClock ) + rstwr_sync = seq_timemgr_RestartAlarmIsOn( EClock ) + + ! Determine if we're running with a prognostic ROF model, and if we're running with a + ! non-stub GLC model. These won't change throughout the run, but we can't count on + ! their being set in initialization, so need to get them in the run method. + + call seq_infodata_GetData( infodata, & + rof_prognostic=rof_prognostic, & + glc_present=glc_present) + + ! Map MCT to land data type + ! Perform downscaling if appropriate + + + ! Map to clm (only when state and/or fluxes need to be updated) + + call t_startf ('lc_lnd_import') + call lnd_import( bounds, & + x2l = x2l_l%rattr, & + glc_present = glc_present, & + atm2lnd_inst = atm2lnd_inst, & + glc2lnd_inst = glc2lnd_inst, & + wateratm2lndbulk_inst = water_inst%wateratm2lndbulk_inst) + call t_stopf ('lc_lnd_import') + + ! Use infodata to set orbital values if updated mid-run + + call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & + orb_lambm0=lambm0, orb_obliqr=obliqr ) + + ! Loop over time steps in coupling interval + + dosend = .false. + do while(.not. dosend) + + ! Determine if dosend + ! When time is not updated at the beginning of the loop - then return only if + ! are in sync with clock before time is updated + + call get_curr_date( yr, mon, day, tod ) + ymd = yr*10000 + mon*100 + day + tod = tod + dosend = (seq_timemgr_EClockDateInSync( EClock, ymd, tod)) + + ! Determine doalb based on nextsw_cday sent from atm model + + nstep = get_nstep() + caldayp1 = get_curr_calday(offset=dtime) + if (nstep == 0) then + doalb = .false. + else if (nstep == 1) then + doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) + else + doalb = (nextsw_cday >= -0.5_r8) + end if + call update_rad_dtime(doalb) + + ! Determine if time to write cam restart and stop + + rstwr = .false. + if (rstwr_sync .and. dosend) rstwr = .true. + nlend = .false. + if (nlend_sync .and. dosend) nlend = .true. + + ! Run clm + + call t_barrierf('sync_clm_run1', mpicom) + call t_startf ('clm_run') + call t_startf ('shr_orb_decl') + calday = get_curr_calday() + call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) + call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) + call t_stopf ('shr_orb_decl') + call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) + call t_stopf ('clm_run') + + ! Create l2x_l export state - add river runoff input to l2x_l if appropriate + + call t_startf ('lc_lnd_export') + call lnd_export(bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) + call t_stopf ('lc_lnd_export') + + ! Advance clm time step + + call t_startf ('lc_clm2_adv_timestep') + call advance_timestep() + call t_stopf ('lc_clm2_adv_timestep') + + end do + + ! Check that internal clock is in sync with master clock + + call get_curr_date( yr, mon, day, tod, offset=-dtime ) + ymd = yr*10000 + mon*100 + day + tod = tod + if ( .not. seq_timemgr_EClockDateInSync( EClock, ymd, tod ) )then + call seq_timemgr_EclockGetData( EClock, curr_ymd=ymd_sync, curr_tod=tod_sync ) + write(iulog,*)' clm ymd=',ymd ,' clm tod= ',tod + write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync + call endrun( sub//":: CLM clock not in sync with Master Sync clock" ) + end if + + ! Reset shr logging to my original values + + call shr_file_setLogUnit (shrlogunit) + call shr_file_setLogLevel(shrloglev) + +#if (defined _MEMTRACE) + if(masterproc) then + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_run_mct:end::',lbnum) + call memmon_reset_addr() + endif +#endif + + first_call = .false. + + end subroutine lnd_run_mct + + !==================================================================================== + + subroutine lnd_final_mct( EClock, cdata_l, x2l_l, l2x_l) + ! + ! !DESCRIPTION: + ! Finalize land surface model + + use seq_cdata_mod ,only : seq_cdata, seq_cdata_setptrs + use seq_timemgr_mod ,only : seq_timemgr_EClockGetData, seq_timemgr_StopAlarmIsOn + use seq_timemgr_mod ,only : seq_timemgr_RestartAlarmIsOn, seq_timemgr_EClockDateInSync + use esmf + ! + ! !ARGUMENTS: + type(ESMF_Clock) , intent(inout) :: EClock ! Input synchronization clock from driver + type(seq_cdata) , intent(inout) :: cdata_l ! Input driver data for land model + type(mct_aVect) , intent(inout) :: x2l_l ! Import state to land model + type(mct_aVect) , intent(inout) :: l2x_l ! Export state from land model + !--------------------------------------------------------------------------- + + ! fill this in + end subroutine lnd_final_mct + + !==================================================================================== + + subroutine lnd_setgsmap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) + ! + ! !DESCRIPTION: + ! Set the MCT GS map for the land model + ! + ! !USES: + use shr_kind_mod , only : r8 => shr_kind_r8 + use domainMod , only : ldomain + use mct_mod , only : mct_gsMap, mct_gsMap_init + implicit none + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds ! bounds + integer , intent(in) :: mpicom_lnd ! MPI communicator for the clm land model + integer , intent(in) :: LNDID ! Land model identifyer number + type(mct_gsMap) , intent(out) :: gsMap_lnd ! Resulting MCT GS map for the land model + ! + ! !LOCAL VARIABLES: + integer,allocatable :: gindex(:) ! Number the local grid points + integer :: i, j, n, gi ! Indices + integer :: lsize,gsize ! GS Map size + integer :: ier ! Error code + !--------------------------------------------------------------------------- + + ! Build the land grid numbering for MCT + ! NOTE: Numbering scheme is: West to East and South to North + ! starting at south pole. Should be the same as what's used in SCRIP + + allocate(gindex(bounds%begg:bounds%endg),stat=ier) + + ! number the local grid + + do n = bounds%begg, bounds%endg + gindex(n) = ldecomp%gdc2glo(n) + end do + lsize = bounds%endg - bounds%begg + 1 + gsize = ldomain%ni * ldomain%nj + + call mct_gsMap_init( gsMap_lnd, gindex, mpicom_lnd, LNDID, lsize, gsize ) + + deallocate(gindex) + + end subroutine lnd_SetgsMap_mct + + !==================================================================================== + + subroutine lnd_domain_mct( bounds, lsize, gsMap_l, dom_l ) + ! + ! !DESCRIPTION: + ! Send the land model domain information to the coupler + ! + ! !USES: + use clm_varcon , only: re + use domainMod , only: ldomain + use spmdMod , only: iam + use mct_mod , only: mct_gGrid_importIAttr + use mct_mod , only: mct_gGrid_importRAttr, mct_gGrid_init, mct_gsMap_orderedPoints + use seq_flds_mod, only: seq_flds_dom_coord, seq_flds_dom_other + ! + ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds ! bounds + integer , intent(in) :: lsize ! land model domain data size + type(mct_gsMap), intent(inout) :: gsMap_l ! Output land model MCT GS map + type(mct_ggrid), intent(out) :: dom_l ! Output domain information for land model + ! + ! Local Variables + integer :: g,i,j ! index + real(r8), pointer :: data(:) ! temporary + integer , pointer :: idata(:) ! temporary + !--------------------------------------------------------------------------- + ! + ! Initialize mct domain type + ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) + ! Note that in addition land carries around landfrac for the purposes of domain checking + ! + call mct_gGrid_init( GGrid=dom_l, CoordChars=trim(seq_flds_dom_coord), & + OtherChars=trim(seq_flds_dom_other), lsize=lsize ) + ! + ! Allocate memory + ! + allocate(data(lsize)) + ! + ! Determine global gridpoint number attribute, GlobGridNum, which is set automatically by MCT + ! + call mct_gsMap_orderedPoints(gsMap_l, iam, idata) + call mct_gGrid_importIAttr(dom_l,'GlobGridNum',idata,lsize) + ! + ! Determine domain (numbering scheme is: West to East and South to North to South pole) + ! Initialize attribute vector with special value + ! + data(:) = -9999.0_R8 + call mct_gGrid_importRAttr(dom_l,"lat" ,data,lsize) + call mct_gGrid_importRAttr(dom_l,"lon" ,data,lsize) + call mct_gGrid_importRAttr(dom_l,"area" ,data,lsize) + call mct_gGrid_importRAttr(dom_l,"aream",data,lsize) + data(:) = 0.0_R8 + call mct_gGrid_importRAttr(dom_l,"mask" ,data,lsize) + ! + ! Fill in correct values for domain components + ! Note aream will be filled in in the atm-lnd mapper + ! + do g = bounds%begg,bounds%endg + i = 1 + (g - bounds%begg) + data(i) = ldomain%lonc(g) + end do + call mct_gGrid_importRattr(dom_l,"lon",data,lsize) + + do g = bounds%begg,bounds%endg + i = 1 + (g - bounds%begg) + data(i) = ldomain%latc(g) + end do + call mct_gGrid_importRattr(dom_l,"lat",data,lsize) + + do g = bounds%begg,bounds%endg + i = 1 + (g - bounds%begg) + data(i) = ldomain%area(g)/(re*re) + end do + call mct_gGrid_importRattr(dom_l,"area",data,lsize) + + do g = bounds%begg,bounds%endg + i = 1 + (g - bounds%begg) + data(i) = real(ldomain%mask(g), r8) + end do + call mct_gGrid_importRattr(dom_l,"mask",data,lsize) + + do g = bounds%begg,bounds%endg + i = 1 + (g - bounds%begg) + data(i) = real(ldomain%frac(g), r8) + end do + call mct_gGrid_importRattr(dom_l,"frac",data,lsize) + + deallocate(data) + deallocate(idata) + + end subroutine lnd_domain_mct + + !==================================================================================== + + subroutine lnd_handle_resume( cdata_l ) + ! + ! !DESCRIPTION: + ! Handle resume signals for Data Assimilation (DA) + ! + ! !USES: + use clm_time_manager , only : update_DA_nstep + use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs + implicit none + ! !ARGUMENTS: + type(seq_cdata), intent(inout) :: cdata_l ! Input land-model driver data + ! !LOCAL VARIABLES: + logical :: resume_from_data_assim ! flag if we are resuming after data assimulation was done + !--------------------------------------------------------------------------- + + ! Check to see if restart was modified and we are resuming from data + ! assimilation + call seq_cdata_setptrs(cdata_l, post_assimilation=resume_from_data_assim) + if ( resume_from_data_assim ) call update_DA_nstep() + + end subroutine lnd_handle_resume + +end module lnd_comp_mct diff --git a/src/cpl/mct/lnd_import_export.F90 b/src/cpl/mct/lnd_import_export.F90 new file mode 100644 index 0000000000..f3784bc55f --- /dev/null +++ b/src/cpl/mct/lnd_import_export.F90 @@ -0,0 +1,431 @@ +module lnd_import_export + + use shr_kind_mod , only: r8 => shr_kind_r8, cl=>shr_kind_cl + use abortutils , only: endrun + use decompmod , only: bounds_type + use lnd2atmType , only: lnd2atm_type + use lnd2glcMod , only: lnd2glc_type + use atm2lndType , only: atm2lnd_type + use glc2lndMod , only: glc2lnd_type + use Waterlnd2atmBulkType , only: waterlnd2atmbulk_type + use Wateratm2lndBulkType , only: wateratm2lndbulk_type + use clm_cpl_indices + ! + implicit none + !=============================================================================== + +contains + + !=============================================================================== + subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wateratm2lndbulk_inst) + + !--------------------------------------------------------------------------- + ! !DESCRIPTION: + ! Convert the input data from the coupler to the land model + ! + ! !USES: + use seq_flds_mod , only: seq_flds_x2l_fields + use clm_varctl , only: co2_type, co2_ppmv, iulog, use_c13 + use clm_varctl , only: ndep_from_cpl + use clm_varcon , only: rair, o2_molar_const, c13ratio + use shr_const_mod , only: SHR_CONST_TKFRZ + use shr_string_mod , only: shr_string_listGetName + use domainMod , only: ldomain + use shr_infnan_mod , only : isnan => shr_infnan_isnan + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds ! bounds + real(r8) , intent(in) :: x2l(:,:) ! driver import state to land model + logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model + type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! clm internal input data type + type(glc2lnd_type) , intent(inout) :: glc2lnd_inst ! clm internal input data type + type(wateratm2lndbulk_type), intent(inout) :: wateratm2lndbulk_inst ! clm internal input data type + ! + ! !LOCAL VARIABLES: + integer :: g,i,k,nstep,ier ! indices, number of steps, and error code + real(r8) :: forc_rainc ! rainxy Atm flux mm/s + real(r8) :: e ! vapor pressure (Pa) + real(r8) :: qsat ! saturation specific humidity (kg/kg) + real(r8) :: forc_t ! atmospheric temperature (Kelvin) + real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) + real(r8) :: forc_pbot ! atmospheric pressure (Pa) + real(r8) :: forc_rainl ! rainxy Atm flux mm/s + real(r8) :: forc_snowc ! snowfxy Atm flux mm/s + real(r8) :: forc_snowl ! snowfxl Atm flux mm/s + real(r8) :: co2_ppmv_diag ! temporary + real(r8) :: co2_ppmv_prog ! temporary + real(r8) :: co2_ppmv_val ! temporary + integer :: co2_type_idx ! integer flag for co2_type options + real(r8) :: esatw ! saturation vapor pressure over water (Pa) + real(r8) :: esati ! saturation vapor pressure over ice (Pa) + real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water + real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice + real(r8) :: tdc, t ! Kelvins to Celcius function and its input + character(len=32) :: fname ! name of field that is NaN + character(len=32), parameter :: sub = 'lnd_import' + + ! Constants to compute vapor pressure + parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & + a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & + a4=3.031240396e-06_r8, a5=2.034080948e-08_r8, & + a6=6.136820929e-11_r8) + + parameter (b0=6.109177956_r8 , b1=5.034698970e-01_r8, & + b2=1.886013408e-02_r8, b3=4.176223716e-04_r8, & + b4=5.824720280e-06_r8, b5=4.838803174e-08_r8, & + b6=1.838826904e-10_r8) + ! + ! function declarations + ! + tdc(t) = min( 50._r8, max(-50._r8,(t-SHR_CONST_TKFRZ)) ) + esatw(t) = 100._r8*(a0+t*(a1+t*(a2+t*(a3+t*(a4+t*(a5+t*a6)))))) + esati(t) = 100._r8*(b0+t*(b1+t*(b2+t*(b3+t*(b4+t*(b5+t*b6)))))) + !--------------------------------------------------------------------------- + + co2_type_idx = 0 + if (co2_type == 'prognostic') then + co2_type_idx = 1 + else if (co2_type == 'diagnostic') then + co2_type_idx = 2 + end if + if (co2_type == 'prognostic' .and. index_x2l_Sa_co2prog == 0) then + call endrun( sub//' ERROR: must have nonzero index_x2l_Sa_co2prog for co2_type equal to prognostic' ) + else if (co2_type == 'diagnostic' .and. index_x2l_Sa_co2diag == 0) then + call endrun( sub//' ERROR: must have nonzero index_x2l_Sa_co2diag for co2_type equal to diagnostic' ) + end if + + ! Note that the precipitation fluxes received from the coupler + ! are in units of kg/s/m^2. To convert these precipitation rates + ! in units of mm/sec, one must divide by 1000 kg/m^3 and multiply + ! by 1000 mm/m resulting in an overall factor of unity. + ! Below the units are therefore given in mm/s. + + + do g = bounds%begg,bounds%endg + i = 1 + (g - bounds%begg) + + ! Determine flooding input, sign convention is positive downward and + ! hierarchy is atm/glc/lnd/rof/ice/ocn. so water sent from rof to land is negative, + ! change the sign to indicate addition of water to system. + + wateratm2lndbulk_inst%forc_flood_grc(g) = -x2l(index_x2l_Flrr_flood,i) + + wateratm2lndbulk_inst%volr_grc(g) = x2l(index_x2l_Flrr_volr,i) * (ldomain%area(g) * 1.e6_r8) + wateratm2lndbulk_inst%volrmch_grc(g)= x2l(index_x2l_Flrr_volrmch,i) * (ldomain%area(g) * 1.e6_r8) + + ! Determine required receive fields + + atm2lnd_inst%forc_hgt_grc(g) = x2l(index_x2l_Sa_z,i) ! zgcmxy Atm state m + atm2lnd_inst%forc_topo_grc(g) = x2l(index_x2l_Sa_topo,i) ! Atm surface height (m) + atm2lnd_inst%forc_u_grc(g) = x2l(index_x2l_Sa_u,i) ! forc_uxy Atm state m/s + atm2lnd_inst%forc_v_grc(g) = x2l(index_x2l_Sa_v,i) ! forc_vxy Atm state m/s + atm2lnd_inst%forc_solad_grc(g,2) = x2l(index_x2l_Faxa_swndr,i) ! forc_sollxy Atm flux W/m^2 + atm2lnd_inst%forc_solad_grc(g,1) = x2l(index_x2l_Faxa_swvdr,i) ! forc_solsxy Atm flux W/m^2 + atm2lnd_inst%forc_solai_grc(g,2) = x2l(index_x2l_Faxa_swndf,i) ! forc_solldxy Atm flux W/m^2 + atm2lnd_inst%forc_solai_grc(g,1) = x2l(index_x2l_Faxa_swvdf,i) ! forc_solsdxy Atm flux W/m^2 + + atm2lnd_inst%forc_th_not_downscaled_grc(g) = x2l(index_x2l_Sa_ptem,i) ! forc_thxy Atm state K + wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = x2l(index_x2l_Sa_shum,i) ! forc_qxy Atm state kg/kg + atm2lnd_inst%forc_pbot_not_downscaled_grc(g) = x2l(index_x2l_Sa_pbot,i) ! ptcmxy Atm state Pa + atm2lnd_inst%forc_t_not_downscaled_grc(g) = x2l(index_x2l_Sa_tbot,i) ! forc_txy Atm state K + atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) = x2l(index_x2l_Faxa_lwdn,i) ! flwdsxy Atm flux W/m^2 + + forc_rainc = x2l(index_x2l_Faxa_rainc,i) ! mm/s + forc_rainl = x2l(index_x2l_Faxa_rainl,i) ! mm/s + forc_snowc = x2l(index_x2l_Faxa_snowc,i) ! mm/s + forc_snowl = x2l(index_x2l_Faxa_snowl,i) ! mm/s + + ! atmosphere coupling, for prognostic/prescribed aerosols + atm2lnd_inst%forc_aer_grc(g,1) = x2l(index_x2l_Faxa_bcphidry,i) + atm2lnd_inst%forc_aer_grc(g,2) = x2l(index_x2l_Faxa_bcphodry,i) + atm2lnd_inst%forc_aer_grc(g,3) = x2l(index_x2l_Faxa_bcphiwet,i) + atm2lnd_inst%forc_aer_grc(g,4) = x2l(index_x2l_Faxa_ocphidry,i) + atm2lnd_inst%forc_aer_grc(g,5) = x2l(index_x2l_Faxa_ocphodry,i) + atm2lnd_inst%forc_aer_grc(g,6) = x2l(index_x2l_Faxa_ocphiwet,i) + atm2lnd_inst%forc_aer_grc(g,7) = x2l(index_x2l_Faxa_dstwet1,i) + atm2lnd_inst%forc_aer_grc(g,8) = x2l(index_x2l_Faxa_dstdry1,i) + atm2lnd_inst%forc_aer_grc(g,9) = x2l(index_x2l_Faxa_dstwet2,i) + atm2lnd_inst%forc_aer_grc(g,10) = x2l(index_x2l_Faxa_dstdry2,i) + atm2lnd_inst%forc_aer_grc(g,11) = x2l(index_x2l_Faxa_dstwet3,i) + atm2lnd_inst%forc_aer_grc(g,12) = x2l(index_x2l_Faxa_dstdry3,i) + atm2lnd_inst%forc_aer_grc(g,13) = x2l(index_x2l_Faxa_dstwet4,i) + atm2lnd_inst%forc_aer_grc(g,14) = x2l(index_x2l_Faxa_dstdry4,i) + + ! Determine optional receive fields + + if (index_x2l_Sa_co2prog /= 0) then + co2_ppmv_prog = x2l(index_x2l_Sa_co2prog,i) ! co2 atm state prognostic + else + co2_ppmv_prog = co2_ppmv + end if + + if (index_x2l_Sa_co2diag /= 0) then + co2_ppmv_diag = x2l(index_x2l_Sa_co2diag,i) ! co2 atm state diagnostic + else + co2_ppmv_diag = co2_ppmv + end if + + if (index_x2l_Sa_methane /= 0) then + atm2lnd_inst%forc_pch4_grc(g) = x2l(index_x2l_Sa_methane,i) + endif + + ! Determine derived quantities for required fields + + forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) + forc_q = wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) + forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) + + atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] + atm2lnd_inst%forc_hgt_t_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of temperature [m] + atm2lnd_inst%forc_hgt_q_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of humidity [m] + atm2lnd_inst%forc_vp_grc(g) = forc_q * forc_pbot / (0.622_r8 + 0.378_r8 * forc_q) + atm2lnd_inst%forc_rho_not_downscaled_grc(g) = & + (forc_pbot - 0.378_r8 * atm2lnd_inst%forc_vp_grc(g)) / (rair * forc_t) + atm2lnd_inst%forc_po2_grc(g) = o2_molar_const * forc_pbot + atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) + atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & + atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) + + wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc + forc_rainl + wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc + forc_snowl + + if (forc_t > SHR_CONST_TKFRZ) then + e = esatw(tdc(forc_t)) + else + e = esati(tdc(forc_t)) + end if + qsat = 0.622_r8*e / (forc_pbot - 0.378_r8*e) + + !modify specific humidity if precip occurs + if(1==2) then + if((forc_rainc+forc_rainl) > 0._r8) then + forc_q = 0.95_r8*qsat + ! forc_q = qsat + wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q + endif + endif + + wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) + + ! Check that solar, specific-humidity and LW downward aren't negative + if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 )then + call endrun( sub//' ERROR: Longwave down sent from the atmosphere model is negative or zero' ) + end if + if ( (atm2lnd_inst%forc_solad_grc(g,1) < 0.0_r8) .or. (atm2lnd_inst%forc_solad_grc(g,2) < 0.0_r8) & + .or. (atm2lnd_inst%forc_solai_grc(g,1) < 0.0_r8) .or. (atm2lnd_inst%forc_solai_grc(g,2) < 0.0_r8) ) then + call endrun( sub//' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & + ' from the atmosphere model is negative or zero' ) + end if + if ( wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then + call endrun( sub//' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) + end if + + ! Check if any input from the coupler is NaN + if ( any(isnan(x2l(:,i))) )then + write(iulog,*) '# of NaNs = ', count(isnan(x2l(:,i))) + write(iulog,*) 'Which are NaNs = ', isnan(x2l(:,i)) + do k = 1, size(x2l(:,i)) + if ( isnan(x2l(k,i)) )then + call shr_string_listGetName( seq_flds_x2l_fields, k, fname ) + write(iulog,*) trim(fname) + end if + end do + write(iulog,*) 'gridcell index = ', g + call endrun( sub//' ERROR: One or more of the input from the atmosphere model are NaN '// & + '(Not a Number from a bad floating point calculation)' ) + end if + + ! Make sure relative humidity is properly bounded + ! wateratm2lndbulk_inst%forc_rh_grc(g) = min( 100.0_r8, wateratm2lndbulk_inst%forc_rh_grc(g) ) + ! wateratm2lndbulk_inst%forc_rh_grc(g) = max( 0.0_r8, wateratm2lndbulk_inst%forc_rh_grc(g) ) + + ! Determine derived quantities for optional fields + ! Note that the following does unit conversions from ppmv to partial pressures (Pa) + ! Note that forc_pbot is in Pa + + if (co2_type_idx == 1) then + co2_ppmv_val = co2_ppmv_prog + else if (co2_type_idx == 2) then + co2_ppmv_val = co2_ppmv_diag + else + co2_ppmv_val = co2_ppmv + end if + if ( (co2_ppmv_val < 10.0_r8) .or. (co2_ppmv_val > 15000.0_r8) )then + call endrun( sub//' ERROR: CO2 is outside of an expected range' ) + end if + atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_val * 1.e-6_r8 * forc_pbot + if (use_c13) then + atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_val * c13ratio * 1.e-6_r8 * forc_pbot + end if + + if (ndep_from_cpl) then + ! The coupler is sending ndep in units if kgN/m2/s - and clm uses units of gN/m2/sec - so the + ! following conversion needs to happen + atm2lnd_inst%forc_ndep_grc(g) = (x2l(index_x2l_Faxa_nhx, i) + x2l(index_x2l_faxa_noy, i))*1000._r8 + end if + + end do + + call glc2lnd_inst%set_glc2lnd_fields( & + bounds = bounds, & + glc_present = glc_present, & + ! NOTE(wjs, 2017-12-13) the x2l argument doesn't have the typical bounds + ! subsetting (bounds%begg:bounds%endg). This mirrors the lack of these bounds in + ! the call to lnd_import from lnd_run_mct. This is okay as long as this code is + ! outside a clump loop. + x2l = x2l, & + index_x2l_Sg_ice_covered = index_x2l_Sg_ice_covered, & + index_x2l_Sg_topo = index_x2l_Sg_topo, & + index_x2l_Flgg_hflx = index_x2l_Flgg_hflx, & + index_x2l_Sg_icemask = index_x2l_Sg_icemask, & + index_x2l_Sg_icemask_coupled_fluxes = index_x2l_Sg_icemask_coupled_fluxes) + + end subroutine lnd_import + + !=============================================================================== + + subroutine lnd_export( bounds, waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x) + + !--------------------------------------------------------------------------- + ! !DESCRIPTION: + ! Convert the data to be sent from the clm model to the coupler + ! + ! !USES: + use shr_kind_mod , only : r8 => shr_kind_r8 + use seq_flds_mod , only : seq_flds_l2x_fields + use clm_varctl , only : iulog + use clm_time_manager , only : get_nstep + use seq_drydep_mod , only : n_drydep + use shr_megan_mod , only : shr_megan_mechcomps_n + use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n + use domainMod , only : ldomain + use shr_string_mod , only : shr_string_listGetName + use shr_infnan_mod , only : isnan => shr_infnan_isnan + ! + ! !ARGUMENTS: + implicit none + type(bounds_type) , intent(in) :: bounds ! bounds + type(lnd2atm_type), intent(inout) :: lnd2atm_inst ! clm land to atmosphere exchange data type + type(lnd2glc_type), intent(inout) :: lnd2glc_inst ! clm land to atmosphere exchange data type + type(waterlnd2atmbulk_type), intent(in) :: waterlnd2atmbulk_inst + real(r8) , intent(out) :: l2x(:,:)! land to coupler export state on land grid + ! + ! !LOCAL VARIABLES: + integer :: g,i,k ! indices + integer :: ier ! error status + integer :: nstep ! time step index + integer :: dtime ! time step + integer :: num ! counter + character(len=32) :: fname ! name of field that is NaN + character(len=32), parameter :: sub = 'lnd_export' + !--------------------------------------------------------------------------- + + ! cesm sign convention is that fluxes are positive downward + + l2x(:,:) = 0.0_r8 + + do g = bounds%begg,bounds%endg + i = 1 + (g-bounds%begg) + l2x(index_l2x_Sl_t,i) = lnd2atm_inst%t_rad_grc(g) + l2x(index_l2x_Sl_snowh,i) = waterlnd2atmbulk_inst%h2osno_grc(g) + l2x(index_l2x_Sl_avsdr,i) = lnd2atm_inst%albd_grc(g,1) + l2x(index_l2x_Sl_anidr,i) = lnd2atm_inst%albd_grc(g,2) + l2x(index_l2x_Sl_avsdf,i) = lnd2atm_inst%albi_grc(g,1) + l2x(index_l2x_Sl_anidf,i) = lnd2atm_inst%albi_grc(g,2) + l2x(index_l2x_Sl_tref,i) = lnd2atm_inst%t_ref2m_grc(g) + l2x(index_l2x_Sl_qref,i) = waterlnd2atmbulk_inst%q_ref2m_grc(g) + l2x(index_l2x_Sl_u10,i) = lnd2atm_inst%u_ref10m_grc(g) + l2x(index_l2x_Fall_taux,i) = -lnd2atm_inst%taux_grc(g) + l2x(index_l2x_Fall_tauy,i) = -lnd2atm_inst%tauy_grc(g) + l2x(index_l2x_Fall_lat,i) = -lnd2atm_inst%eflx_lh_tot_grc(g) + l2x(index_l2x_Fall_sen,i) = -lnd2atm_inst%eflx_sh_tot_grc(g) + l2x(index_l2x_Fall_lwup,i) = -lnd2atm_inst%eflx_lwrad_out_grc(g) + l2x(index_l2x_Fall_evap,i) = -waterlnd2atmbulk_inst%qflx_evap_tot_grc(g) + l2x(index_l2x_Fall_swnet,i) = lnd2atm_inst%fsa_grc(g) + if (index_l2x_Fall_fco2_lnd /= 0) then + l2x(index_l2x_Fall_fco2_lnd,i) = -lnd2atm_inst%net_carbon_exchange_grc(g) + end if + + ! Additional fields for DUST, PROGSSLT, dry-deposition and VOC + ! These are now standard fields, but the check on the index makes sure the driver handles them + if (index_l2x_Sl_ram1 /= 0 ) l2x(index_l2x_Sl_ram1,i) = lnd2atm_inst%ram1_grc(g) + if (index_l2x_Sl_fv /= 0 ) l2x(index_l2x_Sl_fv,i) = lnd2atm_inst%fv_grc(g) + if (index_l2x_Sl_soilw /= 0 ) l2x(index_l2x_Sl_soilw,i) = waterlnd2atmbulk_inst%h2osoi_vol_grc(g,1) + if (index_l2x_Fall_flxdst1 /= 0 ) l2x(index_l2x_Fall_flxdst1,i)= -lnd2atm_inst%flxdst_grc(g,1) + if (index_l2x_Fall_flxdst2 /= 0 ) l2x(index_l2x_Fall_flxdst2,i)= -lnd2atm_inst%flxdst_grc(g,2) + if (index_l2x_Fall_flxdst3 /= 0 ) l2x(index_l2x_Fall_flxdst3,i)= -lnd2atm_inst%flxdst_grc(g,3) + if (index_l2x_Fall_flxdst4 /= 0 ) l2x(index_l2x_Fall_flxdst4,i)= -lnd2atm_inst%flxdst_grc(g,4) + + + ! for dry dep velocities + if (index_l2x_Sl_ddvel /= 0 ) then + l2x(index_l2x_Sl_ddvel:index_l2x_Sl_ddvel+n_drydep-1,i) = & + lnd2atm_inst%ddvel_grc(g,:n_drydep) + end if + + ! for MEGAN VOC emis fluxes + if (index_l2x_Fall_flxvoc /= 0 ) then + l2x(index_l2x_Fall_flxvoc:index_l2x_Fall_flxvoc+shr_megan_mechcomps_n-1,i) = & + -lnd2atm_inst%flxvoc_grc(g,:shr_megan_mechcomps_n) + end if + + + ! for fire emis fluxes + if (index_l2x_Fall_flxfire /= 0 ) then + l2x(index_l2x_Fall_flxfire:index_l2x_Fall_flxfire+shr_fire_emis_mechcomps_n-1,i) = & + -lnd2atm_inst%fireflx_grc(g,:shr_fire_emis_mechcomps_n) + l2x(index_l2x_Sl_ztopfire,i) = lnd2atm_inst%fireztop_grc(g) + end if + + if (index_l2x_Fall_methane /= 0) then + l2x(index_l2x_Fall_methane,i) = -lnd2atm_inst%flux_ch4_grc(g) + endif + + ! sign convention is positive downward with + ! hierarchy of atm/glc/lnd/rof/ice/ocn. + ! I.e. water sent from land to rof is positive + + l2x(index_l2x_Flrl_rofsur,i) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + + ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain + l2x(index_l2x_Flrl_rofsub,i) = waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) & + + waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) + + ! qgwl sent individually to coupler + l2x(index_l2x_Flrl_rofgwl,i) = waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) + + ! ice sent individually to coupler + l2x(index_l2x_Flrl_rofi,i) = waterlnd2atmbulk_inst%qflx_rofice_grc(g) + + ! irrigation flux to be removed from main channel storage (negative) + l2x(index_l2x_Flrl_irrig,i) = - waterlnd2atmbulk_inst%qirrig_grc(g) + + ! glc coupling + ! We could avoid setting these fields if glc_present is .false., if that would + ! help with performance. (The downside would be that we wouldn't have these fields + ! available for diagnostic purposes or to force a later T compset with dlnd.) + do num = 0,glc_nec + l2x(index_l2x_Sl_tsrf(num),i) = lnd2glc_inst%tsrf_grc(g,num) + l2x(index_l2x_Sl_topo(num),i) = lnd2glc_inst%topo_grc(g,num) + l2x(index_l2x_Flgl_qice(num),i) = lnd2glc_inst%qice_grc(g,num) + end do + + ! Check if any output sent to the coupler is NaN + if ( any(isnan(l2x(:,i))) )then + write(iulog,*) '# of NaNs = ', count(isnan(l2x(:,i))) + write(iulog,*) 'Which are NaNs = ', isnan(l2x(:,i)) + do k = 1, size(l2x(:,i)) + if ( isnan(l2x(k,i)) )then + call shr_string_listGetName( seq_flds_l2x_fields, k, fname ) + write(iulog,*) trim(fname) + end if + end do + write(iulog,*) 'gridcell index = ', g + call endrun( sub//' ERROR: One or more of the output from CLM to the coupler are NaN ' ) + end if + + end do + + end subroutine lnd_export + +end module lnd_import_export From ab22caa74b00a85418dc71296b785dc1bac381ab Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 1 Oct 2019 14:13:28 -0600 Subject: [PATCH 0395/1973] Changes related to restart and initialization --- src/biogeophys/TotalWaterAndHeatMod.F90 | 2 ++ src/biogeophys/WaterStateType.F90 | 2 +- src/main/ColumnType.F90 | 2 +- src/main/initVerticalMod.F90 | 4 ++-- src/main/restFileMod.F90 | 6 +++--- src/main/subgridRestMod.F90 | 14 +++++++------- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 4ca30075c4..68fe98e725 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -797,6 +797,8 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & soil_heat_dry_mass(c) = soil_heat_dry_mass(c) + & TempToHeat(temp = t_soisno(c,j), cv = (csol(c,j)*(1-watsat(c,j))*dz(c,j))) end if + else + has_h2o = .false. end if end if diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index cee05f2c23..cf5ba781f7 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -446,7 +446,7 @@ subroutine InitCold(this, bounds, & !-------------------------------------------- do c = bounds%begc, bounds%endc - do j = 1,nlevgrnd + do j = 1,max0(nlevgrnd,nlevurb) if (this%h2osoi_vol_col(c,j) /= spval) then if (t_soisno_col(c,j) <= tfrz) then this%h2osoi_ice_col(c,j) = col%dz(c,j)*denice*this%h2osoi_vol_col(c,j) ! ratio already applied diff --git a/src/main/ColumnType.F90 b/src/main/ColumnType.F90 index a6552f7127..80745fb014 100644 --- a/src/main/ColumnType.F90 +++ b/src/main/ColumnType.F90 @@ -125,7 +125,7 @@ subroutine Init(this, begc, endc) allocate(this%z_lake (begc:endc,nlevlak)) ; this%z_lake (:,:) = nan allocate(this%nbedrock (begc:endc)) ; this%nbedrock (:) = ispval - allocate(this%levgrnd_class(begc:endc,nlevgrnd)) ; this%levgrnd_class(:,:) = ispval + allocate(this%levgrnd_class(begc:endc,max0(nlevgrnd,nlevurb))) ; this%levgrnd_class(:,:) = ispval allocate(this%micro_sigma (begc:endc)) ; this%micro_sigma (:) = nan allocate(this%n_melt (begc:endc)) ; this%n_melt (:) = nan allocate(this%topo_slope (begc:endc)) ; this%topo_slope (:) = nan diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index 7cbae087f1..0eda4673ba 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -683,9 +683,9 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof if (col%nbedrock(c) < nlevsoi) then col%levgrnd_class(c, (col%nbedrock(c) + 1) : nlevsoi) = LEVGRND_CLASS_SHALLOW_BEDROCK end if - col%levgrnd_class(c, (nlevsoi + 1) : nlevgrnd) = LEVGRND_CLASS_DEEP_BEDROCK + col%levgrnd_class(c, (nlevsoi + 1) : max0(nlevgrnd,nlevurb)) = LEVGRND_CLASS_DEEP_BEDROCK else - col%levgrnd_class(c, 1:nlevgrnd) = LEVGRND_CLASS_STANDARD + col%levgrnd_class(c, 1:max0(nlevgrnd,nlevurb)) = LEVGRND_CLASS_STANDARD end if end do diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index c352572d02..0dc115087a 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -516,12 +516,12 @@ subroutine restFile_dimset( ncid ) call ncd_defdim(ncid , namep , nump , dimid) call ncd_defdim(ncid , nameCohort , numCohort , dimid) - call ncd_defdim(ncid , 'levgrnd' , nlevgrnd , dimid) + call ncd_defdim(ncid , 'levgrnd' , max0(nlevgrnd,nlevurb) , dimid) call ncd_defdim(ncid , 'levurb' , nlevurb , dimid) call ncd_defdim(ncid , 'levlak' , nlevlak , dimid) call ncd_defdim(ncid , 'levsno' , nlevsno , dimid) call ncd_defdim(ncid , 'levsno1' , nlevsno+1 , dimid) - call ncd_defdim(ncid , 'levtot' , nlevsno+nlevgrnd, dimid) + call ncd_defdim(ncid , 'levtot' , nlevsno+max0(nlevgrnd,nlevurb), dimid) call ncd_defdim(ncid , 'numrad' , numrad , dimid) call ncd_defdim(ncid , 'levcan' , nlevcan , dimid) if ( use_hydrstress ) then @@ -717,7 +717,7 @@ subroutine restFile_dimcheck( ncid ) msg = 'You can deal with this mismatch by rerunning with ' // & 'use_init_interp = .true. in user_nl_clm' call check_dim(ncid, 'levsno' , nlevsno, msg=msg) - call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg) + call check_dim(ncid, 'levgrnd' , max0(nlevgrnd,nlevurb), msg=msg) call check_dim(ncid, 'levurb' , nlevurb) call check_dim(ncid, 'levlak' , nlevlak) diff --git a/src/main/subgridRestMod.F90 b/src/main/subgridRestMod.F90 index 6237061393..2cf97f6feb 100644 --- a/src/main/subgridRestMod.F90 +++ b/src/main/subgridRestMod.F90 @@ -12,7 +12,7 @@ module subgridRestMod use domainMod , only : ldomain use clm_time_manager , only : get_curr_date use clm_varcon , only : nameg, namel, namec, namep - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb use pio , only : file_desc_t use ncdio_pio , only : ncd_int, ncd_double use GetGlobalValuesMod , only : GetGlobalIndex @@ -308,8 +308,8 @@ subroutine subgridRest_write_only(bounds, ncid, flag) long_name='class in which each layer falls', units=' ', & interpinic_flag='skip', readvar=readvar, data=col%levgrnd_class) - allocate(temp2d_r(bounds%begc:bounds%endc, 1:nlevgrnd)) - temp2d_r(bounds%begc:bounds%endc, 1:nlevgrnd) = col%z(bounds%begc:bounds%endc, 1:nlevgrnd) + allocate(temp2d_r(bounds%begc:bounds%endc, 1:max0(nlevgrnd,nlevurb))) + temp2d_r(bounds%begc:bounds%endc, 1:max0(nlevgrnd,nlevurb)) = col%z(bounds%begc:bounds%endc, 1:max0(nlevgrnd,nlevurb)) call restartvar(ncid=ncid, flag=flag, varname='COL_Z', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & long_name='layer depth, excluding snow layers', units='m', & @@ -413,10 +413,10 @@ subroutine subgridRest_write_only(bounds, ncid, flag) long_name='pft active flag (1=active, 0=inactive)', units='', & interpinic_flag='skip', readvar=readvar, data=iparr) - allocate(temp2d_i(bounds%begp:bounds%endp, 1:nlevgrnd)) + allocate(temp2d_i(bounds%begp:bounds%endp, 1:max0(nlevgrnd,nlevurb))) do p=bounds%begp,bounds%endp c = patch%column(p) - temp2d_i(p, 1:nlevgrnd) = col%levgrnd_class(c, 1:nlevgrnd) + temp2d_i(p, 1:max0(nlevgrnd,nlevurb)) = col%levgrnd_class(c, 1:max0(nlevgrnd,nlevurb)) end do call restartvar(ncid=ncid, flag=flag, varname='LEVGRND_CLASS_p', xtype=ncd_int, & dim1name='pft', dim2name='levgrnd', switchdim=.true., & @@ -424,10 +424,10 @@ subroutine subgridRest_write_only(bounds, ncid, flag) interpinic_flag='skip', readvar=readvar, data=temp2d_i) deallocate(temp2d_i) - allocate(temp2d_r(bounds%begp:bounds%endp, 1:nlevgrnd)) + allocate(temp2d_r(bounds%begp:bounds%endp, 1:max0(nlevgrnd,nlevurb))) do p=bounds%begp,bounds%endp c = patch%column(p) - temp2d_r(p, 1:nlevgrnd) = col%z(c, 1:nlevgrnd) + temp2d_r(p, 1:max0(nlevgrnd,nlevurb)) = col%z(c, 1:max0(nlevgrnd,nlevurb)) end do call restartvar(ncid=ncid, flag=flag, varname='COL_Z_p', xtype=ncd_double, & dim1name='pft', dim2name='levgrnd', switchdim=.true., & From 8cc42bcc999c9488ddf20ee895e0c57999c2d883 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 2 Oct 2019 15:00:31 -0600 Subject: [PATCH 0396/1973] Substitute nlevmaxurbgnrd for max0(nlevgrnd,nlevurb) --- src/biogeophys/AerosolMod.F90 | 6 +- src/biogeophys/CanopyTemperatureMod.F90 | 6 +- src/biogeophys/SoilStateInitTimeConstMod.F90 | 6 +- src/biogeophys/SoilStateType.F90 | 41 ++- src/biogeophys/SoilTemperatureMod.F90 | 347 +++++++++---------- src/biogeophys/TemperatureType.F90 | 12 +- src/biogeophys/TotalWaterAndHeatMod.F90 | 8 +- src/biogeophys/UrbBuildTempOleson2015Mod.F90 | 4 +- src/biogeophys/WaterStateBulkType.F90 | 4 +- src/biogeophys/WaterStateType.F90 | 16 +- src/biogeophys/Waterlnd2atmBulkType.F90 | 4 +- src/main/ColumnType.F90 | 12 +- src/main/clm_varpar.F90 | 2 + src/main/histFileMod.F90 | 24 +- src/main/initVerticalMod.F90 | 6 +- src/main/lnd2atmMod.F90 | 4 +- src/main/restFileMod.F90 | 12 +- src/main/subgridRestMod.F90 | 22 +- 18 files changed, 267 insertions(+), 269 deletions(-) diff --git a/src/biogeophys/AerosolMod.F90 b/src/biogeophys/AerosolMod.F90 index 99109f24d0..df13d093c2 100644 --- a/src/biogeophys/AerosolMod.F90 +++ b/src/biogeophys/AerosolMod.F90 @@ -7,7 +7,7 @@ module AerosolMod use shr_log_mod , only : errMsg => shr_log_errMsg use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) use decompMod , only : bounds_type - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd use clm_time_manager , only : get_step_size use atm2lndType , only : atm2lnd_type use WaterFluxBulkType , only : waterfluxbulk_type @@ -372,8 +372,8 @@ subroutine Restart(this, bounds, ncid, flag, & logical :: readvar ! determine if variable is on initial file !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(h2osoi_ice_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osoi_liq_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(h2osoi_ice_col) == (/bounds%endc,nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(h2osoi_liq_col) == (/bounds%endc,nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) call restartvar(ncid=ncid, flag=flag, varname='mss_bcpho', xtype=ncd_double, & dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & diff --git a/src/biogeophys/CanopyTemperatureMod.F90 b/src/biogeophys/CanopyTemperatureMod.F90 index 44500cd74e..292b54782c 100644 --- a/src/biogeophys/CanopyTemperatureMod.F90 +++ b/src/biogeophys/CanopyTemperatureMod.F90 @@ -80,7 +80,7 @@ subroutine CanopyTemperature(bounds, & use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use column_varcon , only : icol_road_imperv, icol_road_perv use landunit_varcon , only : istice_mec, istwet, istsoil, istdlak, istcrop, istdlak - use clm_varpar , only : nlevgrnd, nlevurb, nlevsno, nlevsoi + use clm_varpar , only : nlevgrnd, nlevurb, nlevmaxurbgrnd, nlevsno, nlevsoi use clm_varctl , only : use_fates use CLMFatesInterfaceMod, only : hlm_fates_interface_type @@ -110,7 +110,6 @@ subroutine CanopyTemperature(bounds, & integer :: j ! soil/snow level index integer :: fp ! lake filter patch index integer :: fc ! lake filter column index - integer :: nlev ! greater of nlevgrnd and nlevurb real(r8) :: qred ! soil surface relative humidity real(r8) :: avmuir ! ir inverse optical depth per unit leaf area real(r8) :: eg ! water vapor pressure at temperature T [pa] @@ -231,8 +230,7 @@ subroutine CanopyTemperature(bounds, & end do end do - nlev = max0(nlevgrnd,nlevurb) - do j = -nlevsno+1, nlev + do j = -nlevsno+1, nlevmaxurbgrnd do fc = 1,num_urbanc c = filter_urbanc(fc) if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 index 277a5d67bd..c30e2751a5 100644 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ b/src/biogeophys/SoilStateInitTimeConstMod.F90 @@ -96,7 +96,7 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) use ncdio_pio , only : file_desc_t, ncd_io, ncd_double, ncd_int, ncd_inqvdlen use ncdio_pio , only : ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen use clm_varpar , only : numrad - use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlevsoifl, nlayer, nlayert, nlevurb, nlevsno + use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlevsoifl, nlayer, nlayert, nlevmaxurbgrnd, nlevsno use clm_varcon , only : zsoi, dzsoi, zisoi, spval use clm_varcon , only : secspday, pc, mu, denh2o, denice, grlnd use clm_varctl , only : use_cn, use_lch4, use_fates @@ -361,7 +361,7 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) else if (lun%urbpoi(l) .and. (col%itype(c) /= icol_road_perv) .and. (col%itype(c) /= icol_road_imperv) )then ! Urban Roof, sunwall, shadewall properties set to special value - do lev = 1,max0(nlevgrnd,nlevurb) + do lev = 1,nlevmaxurbgrnd soilstate_inst%watsat_col(c,lev) = spval soilstate_inst%watfc_col(c,lev) = spval soilstate_inst%bsw_col(c,lev) = spval @@ -377,7 +377,7 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) end if end do - do lev = 1,max0(nlevgrnd,nlevurb) + do lev = 1,nlevmaxurbgrnd soilstate_inst%tkmg_col(c,lev) = spval soilstate_inst%tksatu_col(c,lev) = spval soilstate_inst%tkdry_col(c,lev) = spval diff --git a/src/biogeophys/SoilStateType.F90 b/src/biogeophys/SoilStateType.F90 index 1712e20527..592a240099 100644 --- a/src/biogeophys/SoilStateType.F90 +++ b/src/biogeophys/SoilStateType.F90 @@ -7,7 +7,7 @@ module SoilStateType use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) use decompMod , only : bounds_type use abortutils , only : endrun - use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlayer, nlevsno, nlevurb + use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlayer, nlevsno, nlevmaxurbgrnd use clm_varcon , only : spval use clm_varctl , only : use_hydrstress, use_cn, use_lch4, use_dynroot use clm_varctl , only : iulog, hist_wrtch4diag @@ -129,40 +129,39 @@ subroutine InitAllocate(this, bounds) allocate(this%cellorg_col (begc:endc,nlevsoi)) ; this%cellorg_col (:,:) = nan allocate(this%cellsand_col (begc:endc,nlevsoi)) ; this%cellsand_col (:,:) = nan allocate(this%cellclay_col (begc:endc,nlevsoi)) ; this%cellclay_col (:,:) = nan - allocate(this%bd_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%bd_col (:,:) = nan + allocate(this%bd_col (begc:endc,nlevmaxurbgrnd)) ; this%bd_col (:,:) = nan - allocate(this%hksat_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%hksat_col (:,:) = spval - allocate(this%hksat_min_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%hksat_min_col (:,:) = spval - allocate(this%hk_l_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%hk_l_col (:,:) = nan - allocate(this%smp_l_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%smp_l_col (:,:) = nan + allocate(this%hksat_col (begc:endc,nlevmaxurbgrnd)) ; this%hksat_col (:,:) = spval + allocate(this%hksat_min_col (begc:endc,nlevmaxurbgrnd)) ; this%hksat_min_col (:,:) = spval + allocate(this%hk_l_col (begc:endc,nlevmaxurbgrnd)) ; this%hk_l_col (:,:) = nan + allocate(this%smp_l_col (begc:endc,nlevmaxurbgrnd)) ; this%smp_l_col (:,:) = nan allocate(this%smpmin_col (begc:endc)) ; this%smpmin_col (:) = nan - - allocate(this%bsw_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%bsw_col (:,:) = nan - allocate(this%watsat_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%watsat_col (:,:) = nan - allocate(this%watdry_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%watdry_col (:,:) = spval - allocate(this%watopt_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%watopt_col (:,:) = spval - allocate(this%watfc_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%watfc_col (:,:) = nan - allocate(this%sucsat_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%sucsat_col (:,:) = spval + allocate(this%bsw_col (begc:endc,nlevmaxurbgrnd)) ; this%bsw_col (:,:) = nan + allocate(this%watsat_col (begc:endc,nlevmaxurbgrnd)) ; this%watsat_col (:,:) = nan + allocate(this%watdry_col (begc:endc,nlevmaxurbgrnd)) ; this%watdry_col (:,:) = spval + allocate(this%watopt_col (begc:endc,nlevmaxurbgrnd)) ; this%watopt_col (:,:) = spval + allocate(this%watfc_col (begc:endc,nlevmaxurbgrnd)) ; this%watfc_col (:,:) = nan + allocate(this%sucsat_col (begc:endc,nlevmaxurbgrnd)) ; this%sucsat_col (:,:) = spval allocate(this%dsl_col (begc:endc)) ; this%dsl_col (:) = spval!nan allocate(this%soilresis_col (begc:endc)) ; this%soilresis_col (:) = spval!nan allocate(this%soilbeta_col (begc:endc)) ; this%soilbeta_col (:) = nan allocate(this%soilalpha_col (begc:endc)) ; this%soilalpha_col (:) = nan allocate(this%soilalpha_u_col (begc:endc)) ; this%soilalpha_u_col (:) = nan - allocate(this%soilpsi_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%soilpsi_col (:,:) = nan + allocate(this%soilpsi_col (begc:endc,nlevmaxurbgrnd)) ; this%soilpsi_col (:,:) = nan allocate(this%wtfact_col (begc:endc)) ; this%wtfact_col (:) = nan allocate(this%porosity_col (begc:endc,nlayer)) ; this%porosity_col (:,:) = spval - allocate(this%eff_porosity_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%eff_porosity_col (:,:) = spval + allocate(this%eff_porosity_col (begc:endc,nlevmaxurbgrnd)) ; this%eff_porosity_col (:,:) = spval allocate(this%gwc_thr_col (begc:endc)) ; this%gwc_thr_col (:) = nan - allocate(this%thk_col (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%thk_col (:,:) = nan - allocate(this%tkmg_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%tkmg_col (:,:) = nan - allocate(this%tkdry_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%tkdry_col (:,:) = nan - allocate(this%tksatu_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%tksatu_col (:,:) = nan - allocate(this%csol_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%csol_col (:,:) = nan + allocate(this%thk_col (begc:endc,-nlevsno+1:nlevmaxurbgrnd)) ; this%thk_col (:,:) = nan + allocate(this%tkmg_col (begc:endc,nlevmaxurbgrnd)) ; this%tkmg_col (:,:) = nan + allocate(this%tkdry_col (begc:endc,nlevmaxurbgrnd)) ; this%tkdry_col (:,:) = nan + allocate(this%tksatu_col (begc:endc,nlevmaxurbgrnd)) ; this%tksatu_col (:,:) = nan + allocate(this%csol_col (begc:endc,nlevmaxurbgrnd)) ; this%csol_col (:,:) = nan allocate(this%rootr_patch (begp:endp,1:nlevgrnd)) ; this%rootr_patch (:,:) = nan allocate(this%root_depth_patch (begp:endp)) ; this%root_depth_patch (:) = nan - allocate(this%rootr_col (begc:endc,max0(nlevgrnd,nlevurb))) ; this%rootr_col (:,:) = nan + allocate(this%rootr_col (begc:endc,nlevmaxurbgrnd)) ; this%rootr_col (:,:) = nan allocate(this%rootr_road_perv_col (begc:endc,1:nlevgrnd)) ; this%rootr_road_perv_col (:,:) = nan allocate(this%rootfr_patch (begp:endp,1:nlevgrnd)) ; this%rootfr_patch (:,:) = nan allocate(this%crootfr_patch (begp:endp,1:nlevgrnd)) ; this%crootfr_patch (:,:) = nan diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index a99ce12a40..6cc233dc89 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -28,7 +28,6 @@ module SoilTemperatureMod use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch - use clm_varpar , only : nlevurb ! ! !PUBLIC TYPES: implicit none @@ -144,7 +143,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter ! ! !USES: use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevmaxurbgrnd use clm_varctl , only : iulog use clm_varcon , only : cnfac, cpice, cpliq, denh2o use landunit_varcon , only : istsoil, istcrop @@ -179,10 +178,10 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter integer :: fl ! urban filtered landunit indices integer :: jtop(bounds%begc:bounds%endc) ! top level at each column real(r8) :: dtime ! land model time step (sec) - real(r8) :: cv (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! heat capacity [J/(m2 K)] - real(r8) :: tk (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! thermal conductivity [W/(m K)] - real(r8) :: fn (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! heat diffusion through the layer interface [W/m2] - real(r8) :: fn1(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! heat diffusion through the layer interface [W/m2] + real(r8) :: cv (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! heat capacity [J/(m2 K)] + real(r8) :: tk (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! thermal conductivity [W/(m K)] + real(r8) :: fn (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! heat diffusion through the layer interface [W/m2] + real(r8) :: fn1(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! heat diffusion through the layer interface [W/m2] real(r8) :: dzm ! used in computing tridiagonal matrix real(r8) :: dzp ! used in computing tridiagonal matrix real(r8) :: sabg_lyr_col(bounds%begc:bounds%endc,-nlevsno+1:1) ! absorbed solar radiation (col,lyr) [W/m2] @@ -193,9 +192,9 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter real(r8) :: fn_h2osfc(bounds%begc:bounds%endc) ! heat diffusion through standing-water/soil interface [W/m2] real(r8) :: dz_h2osfc(bounds%begc:bounds%endc) ! height of standing surface water [m] integer, parameter :: nband=5 - real(r8) :: bmatrix(bounds%begc:bounds%endc,nband,-nlevsno:max0(nlevgrnd,nlevurb)) ! banded matrix for numerical solution of temperature - real(r8) :: tvector(bounds%begc:bounds%endc,-nlevsno:max0(nlevgrnd,nlevurb)) ! initial temperature solution [Kelvin] - real(r8) :: rvector(bounds%begc:bounds%endc,-nlevsno:max0(nlevgrnd,nlevurb)) ! RHS vector for numerical solution of temperature + real(r8) :: bmatrix(bounds%begc:bounds%endc,nband,-nlevsno:nlevmaxurbgrnd) ! banded matrix for numerical solution of temperature + real(r8) :: tvector(bounds%begc:bounds%endc,-nlevsno:nlevmaxurbgrnd) ! initial temperature solution [Kelvin] + real(r8) :: rvector(bounds%begc:bounds%endc,-nlevsno:nlevmaxurbgrnd) ! RHS vector for numerical solution of temperature real(r8) :: tk_h2osfc(bounds%begc:bounds%endc) ! thermal conductivity of h2osfc [W/(m K)] [col] real(r8) :: dhsdT(bounds%begc:bounds%endc) ! temperature derivative of "hs" [col] real(r8) :: hs_soil(bounds%begc:bounds%endc) ! heat flux on soil [W/m2] @@ -402,14 +401,14 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter tvector(c,0) = t_h2osfc(c) ! soil layers; top layer will have one offset and one extra coefficient - tvector(c,1:max0(nlevgrnd,nlevurb)) = t_soisno(c,1:max0(nlevgrnd,nlevurb)) + tvector(c,1:nlevmaxurbgrnd) = t_soisno(c,1:nlevmaxurbgrnd) enddo call t_startf( 'SoilTempBandDiag') ! Solve the system - call BandDiagonal(bounds, -nlevsno, max0(nlevgrnd,nlevurb), jtop(begc:endc), jbot(begc:endc), & + call BandDiagonal(bounds, -nlevsno, nlevmaxurbgrnd, jtop(begc:endc), jbot(begc:endc), & num_nolakec, filter_nolakec, nband, bmatrix(begc:endc, :, :), & rvector(begc:endc, :), tvector(begc:endc, :)) call t_stopf( 'SoilTempBandDiag') @@ -421,7 +420,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter do j = snl(c)+1, 0 t_soisno(c,j) = tvector(c,j-1) !snow layers end do - t_soisno(c,1:max0(nlevgrnd,nlevurb)) = tvector(c,1:max0(nlevgrnd,nlevurb)) !soil layers + t_soisno(c,1:nlevmaxurbgrnd) = tvector(c,1:nlevmaxurbgrnd) !soil layers if (frac_h2osfc(c) == 0._r8) then t_h2osfc(c)=t_soisno(c,1) @@ -607,7 +606,7 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! flux from the interface to the node j+1. ! ! !USES: - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevsoi + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevsoi, nlevmaxurbgrnd use clm_varcon , only : denh2o, denice, tfrz, tkwat, tkice, tkair, cpice, cpliq, thk_bedrock, csol_bedrock use landunit_varcon , only : istice_mec, istwet use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv @@ -639,8 +638,8 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & call t_startf( 'SoilThermProp' ) ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) associate( & @@ -1093,7 +1092,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & ! ! !USES: use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsno, nlevgrnd,nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevmaxurbgrnd use clm_varctl , only : iulog use clm_varcon , only : tfrz, hfus, grav use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv @@ -1117,14 +1116,14 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & real(r8) :: dtime !land model time step (sec) real(r8) :: heatr !energy residual or loss after melting or freezing real(r8) :: temp1 !temporary variables [kg/m2] - real(r8) :: hm(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) !energy residual [W/m2] - real(r8) :: xm(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) !melting or freezing within a time step [kg/m2] - real(r8) :: wmass0(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb))!initial mass of ice and liquid (kg/m2) - real(r8) :: wice0 (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb))!initial mass of ice (kg/m2) - real(r8) :: wliq0 (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb))!initial mass of liquid (kg/m2) - real(r8) :: supercool(bounds%begc:bounds%endc,max0(nlevgrnd,nlevurb)) !supercooled water in soil (kg/m2) + real(r8) :: hm(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) !energy residual [W/m2] + real(r8) :: xm(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) !melting or freezing within a time step [kg/m2] + real(r8) :: wmass0(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd)!initial mass of ice and liquid (kg/m2) + real(r8) :: wice0 (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd)!initial mass of ice (kg/m2) + real(r8) :: wliq0 (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd)!initial mass of liquid (kg/m2) + real(r8) :: supercool(bounds%begc:bounds%endc,nlevmaxurbgrnd) !supercooled water in soil (kg/m2) real(r8) :: propor !proportionality constant (-) - real(r8) :: tinc(bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) !t(n+1)-t(n) (K) + real(r8) :: tinc(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) !t(n+1)-t(n) (K) real(r8) :: smp !frozen water potential (mm) !----------------------------------------------------------------------- @@ -1907,7 +1906,7 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti ! !USES: use clm_varcon , only : capr, cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevmaxurbgrnd use UrbanParamsType, only : IsSimpleBuildTemp ! ! !ARGUMENTS: @@ -1930,10 +1929,10 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate(& zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) @@ -2038,7 +2037,7 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & ! !USES: use clm_varcon , only : cnfac, cpliq use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2065,11 +2064,11 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & ! !LOCAL VARIABLES: integer :: j,c ! indices integer :: fc ! lake filtered column indices - real(r8) :: rt (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! "r" vector for tridiagonal solution + real(r8) :: rt (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! "r" vector for tridiagonal solution real(r8) :: fn_h2osfc(bounds%begc:bounds%endc) ! heat diffusion through standing-water/soil interface [W/m2] real(r8) :: rt_snow(bounds%begc:bounds%endc,-nlevsno:-1) ! RHS vector corresponding to snow layers real(r8) :: rt_ssw(bounds%begc:bounds%endc,1) ! RHS vector corresponding to standing surface water - real(r8) :: rt_soil(bounds%begc:bounds%endc,1:max0(nlevgrnd,nlevurb)) ! RHS vector corresponding to soil layer + real(r8) :: rt_soil(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) ! RHS vector corresponding to soil layer !----------------------------------------------------------------------- ! Enforce expected array sizes @@ -2079,13 +2078,13 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rvector) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rvector) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) @@ -2145,7 +2144,7 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & c = filter_nolakec(fc) rvector(c, -nlevsno:-1) = rt_snow(c, -nlevsno:-1) rvector(c, 0 ) = rt_ssw(c, 1 ) - rvector(c, 1:max0(nlevgrnd,nlevurb)) = rt_soil(c, 1:max0(nlevgrnd,nlevurb) ) + rvector(c, 1:nlevmaxurbgrnd) = rt_soil(c, 1:nlevmaxurbgrnd ) end do end associate @@ -2161,7 +2160,7 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & ! Sets up RHS vector corresponding to snow layers. ! ! !USES: - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2184,9 +2183,9 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) @@ -2234,7 +2233,7 @@ subroutine SetRHSVec_SnowUrban(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2262,9 +2261,9 @@ subroutine SetRHSVec_SnowUrban(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) @@ -2309,7 +2308,7 @@ subroutine SetRHSVec_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2339,9 +2338,9 @@ subroutine SetRHSVec_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) associate( & @@ -2391,7 +2390,7 @@ subroutine SetRHSVec_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2422,9 +2421,9 @@ subroutine SetRHSVec_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) @@ -2476,7 +2475,7 @@ subroutine SetRHSVec_SnowNonUrban(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2504,9 +2503,9 @@ subroutine SetRHSVec_SnowNonUrban(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) associate( & @@ -2555,7 +2554,7 @@ subroutine SetRHSVec_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2586,7 +2585,7 @@ subroutine SetRHSVec_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc,1/)), errMsg(sourcefile, __LINE__)) @@ -2621,7 +2620,7 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2647,14 +2646,14 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate(& begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -2721,7 +2720,7 @@ subroutine SetRHSVec_SoilUrban(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2750,13 +2749,13 @@ subroutine SetRHSVec_SoilUrban(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -2805,7 +2804,7 @@ subroutine SetRHSVec_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevurb, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2833,12 +2832,12 @@ subroutine SetRHSVec_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) @@ -2896,7 +2895,7 @@ subroutine SetRHSVec_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2925,13 +2924,13 @@ subroutine SetRHSVec_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) @@ -2983,7 +2982,7 @@ subroutine SetRHSVec_SoilNonUrban(bounds, num_nolakec, filter_nolakec, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3012,13 +3011,13 @@ subroutine SetRHSVec_SoilNonUrban(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) @@ -3068,7 +3067,7 @@ subroutine SetRHSVec_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolak ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3097,13 +3096,13 @@ subroutine SetRHSVec_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolak SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) ! ! surface water ----------------------------------------------------------------- @@ -3141,7 +3140,7 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3162,14 +3161,14 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & ! !LOCAL VARIABLES: integer :: j,c ! indices integer :: fc ! lake filtered column indices - real(r8) :: at (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! "a" vector for tridiagonal matrix - real(r8) :: bt (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! "b" vector for tridiagonal matrix - real(r8) :: ct (bounds%begc:bounds%endc,-nlevsno+1:max0(nlevgrnd,nlevurb)) ! "c" vector for tridiagonal matrix + real(r8) :: at (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! "a" vector for tridiagonal matrix + real(r8) :: bt (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! "b" vector for tridiagonal matrix + real(r8) :: ct (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! "c" vector for tridiagonal matrix real(r8) :: dzm ! used in computing tridiagonal matrix real(r8) :: dzp ! used in computing tridiagonal matrix real(r8) :: bmatrix_snow(bounds%begc:bounds%endc,nband,-nlevsno:-1 ) ! block-diagonal matrix for snow layers real(r8) :: bmatrix_ssw(bounds%begc:bounds%endc,nband, 0:0 ) ! block-diagonal matrix for standing surface water - real(r8) :: bmatrix_soil(bounds%begc:bounds%endc,nband, 1:max0(nlevgrnd,nlevurb)) ! block-diagonal matrix for soil layers + real(r8) :: bmatrix_soil(bounds%begc:bounds%endc,nband, 1:nlevmaxurbgrnd) ! block-diagonal matrix for soil layers real(r8) :: bmatrix_snow_soil(bounds%begc:bounds%endc,nband,-1:-1) ! off-diagonal matrix for snow-soil interaction real(r8) :: bmatrix_ssw_soil(bounds%begc:bounds%endc,nband, 0:0 ) ! off-diagonal matrix for standing surface water-soil interaction real(r8) :: bmatrix_soil_snow(bounds%begc:bounds%endc,nband, 1:1 ) ! off-diagonal matrix for soil-snow interaction @@ -3178,12 +3177,12 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) @@ -3311,7 +3310,7 @@ subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nb ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3336,12 +3335,12 @@ subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nb ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_ssw) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_ssw_soil) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_ssw) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) ! Assemble the full matrix @@ -3365,8 +3364,8 @@ subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nb ! Soil bmatrix(c,2:3,1 ) = bmatrix_soil(c,2:3,1 ) - bmatrix(c,2:4,2:max0(nlevgrnd,nlevurb)-1) = bmatrix_soil(c,2:4,2:max0(nlevgrnd,nlevurb)-1) - bmatrix(c,3:4,max0(nlevgrnd,nlevurb) ) = bmatrix_soil(c,3:4,max0(nlevgrnd,nlevurb) ) + bmatrix(c,2:4,2:nlevmaxurbgrnd-1) = bmatrix_soil(c,2:4,2:nlevmaxurbgrnd-1) + bmatrix(c,3:4,nlevmaxurbgrnd ) = bmatrix_soil(c,3:4,nlevmaxurbgrnd ) ! Soil-Snow bmatrix(c,5,1) = bmatrix_soil_snow(c,5,1) @@ -3388,7 +3387,7 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3405,8 +3404,8 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) @@ -3446,7 +3445,7 @@ subroutine SetMatrix_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3462,8 +3461,8 @@ subroutine SetMatrix_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3499,7 +3498,7 @@ subroutine SetMatrix_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevurb, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3521,8 +3520,8 @@ subroutine SetMatrix_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3578,7 +3577,7 @@ subroutine SetMatrix_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3600,8 +3599,8 @@ subroutine SetMatrix_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3655,7 +3654,7 @@ subroutine SetMatrix_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3677,8 +3676,8 @@ subroutine SetMatrix_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3730,7 +3729,7 @@ subroutine SetMatrix_Snow_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd implicit none type(bounds_type), intent(in) :: bounds ! bounds @@ -3743,8 +3742,8 @@ subroutine SetMatrix_Snow_Soil(bounds, num_nolakec, filter_nolakec, nband, & !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3779,7 +3778,7 @@ subroutine SetMatrix_Snow_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3793,8 +3792,8 @@ subroutine SetMatrix_Snow_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3827,7 +3826,7 @@ subroutine SetMatrix_Snow_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevurb, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3847,8 +3846,8 @@ subroutine SetMatrix_Snow_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3894,7 +3893,7 @@ subroutine SetMatrix_Snow_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nba ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3914,8 +3913,8 @@ subroutine SetMatrix_Snow_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nba !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -3961,7 +3960,7 @@ subroutine SetMatrix_Snow_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nban ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -3981,8 +3980,8 @@ subroutine SetMatrix_Snow_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nban !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) associate(& @@ -4025,7 +4024,7 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4051,13 +4050,13 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -4116,7 +4115,7 @@ subroutine SetMatrix_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4135,12 +4134,12 @@ subroutine SetMatrix_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate(& begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -4179,7 +4178,7 @@ subroutine SetMatrix_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevurb, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4203,11 +4202,11 @@ subroutine SetMatrix_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & zi => col%zi , & ! Input: [real(r8) (:,:)] interface level below a "z" level (m) @@ -4271,7 +4270,7 @@ subroutine SetMatrix_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4296,12 +4295,12 @@ subroutine SetMatrix_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) @@ -4368,7 +4367,7 @@ subroutine SetMatrix_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4393,12 +4392,12 @@ subroutine SetMatrix_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate( & z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) @@ -4464,7 +4463,7 @@ subroutine SetMatrix_Soil_Snow(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4479,8 +4478,8 @@ subroutine SetMatrix_Soil_Snow(bounds, num_nolakec, filter_nolakec, nband, & !------------------------------------------------------------------------------ ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) @@ -4519,7 +4518,7 @@ subroutine SetMatrix_Soil_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4534,8 +4533,8 @@ subroutine SetMatrix_Soil_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) @@ -4570,7 +4569,7 @@ subroutine SetMatrix_Soil_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevurb, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4590,8 +4589,8 @@ subroutine SetMatrix_Soil_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) associate( & @@ -4636,7 +4635,7 @@ subroutine SetMatrix_Soil_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nba ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_road_imperv, icol_road_perv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4657,8 +4656,8 @@ subroutine SetMatrix_Soil_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nba !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) @@ -4708,7 +4707,7 @@ subroutine SetMatrix_Soil_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nban ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4729,8 +4728,8 @@ subroutine SetMatrix_Soil_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nban !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) @@ -4777,7 +4776,7 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4802,9 +4801,9 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_ssw) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) @@ -4835,7 +4834,7 @@ subroutine SetMatrix_StandingSurfaceWater_Soil(bounds, num_nolakec, filter_nolak ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4858,9 +4857,9 @@ subroutine SetMatrix_StandingSurfaceWater_Soil(bounds, num_nolakec, filter_nolak !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_ssw_soil) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) @@ -4890,7 +4889,7 @@ subroutine SetMatrix_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolak ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -4912,7 +4911,7 @@ subroutine SetMatrix_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolak ! Enforce expected array sizes SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(bmatrix_soil_ssw) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index dd47920698..610b349d47 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -8,7 +8,7 @@ module TemperatureType use decompMod , only : bounds_type use abortutils , only : endrun use clm_varctl , only : use_cndv, iulog, use_luna, use_crop - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevlak, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevlak, nlevurb, nlevmaxurbgrnd use clm_varcon , only : spval, ispval use GridcellType , only : grc use LandunitType , only : lun @@ -204,8 +204,8 @@ subroutine InitAllocate(this, bounds) endif allocate(this%t_h2osfc_col (begc:endc)) ; this%t_h2osfc_col (:) = nan allocate(this%t_h2osfc_bef_col (begc:endc)) ; this%t_h2osfc_bef_col (:) = nan - allocate(this%t_ssbef_col (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%t_ssbef_col (:,:) = nan - allocate(this%t_soisno_col (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%t_soisno_col (:,:) = nan + allocate(this%t_ssbef_col (begc:endc,-nlevsno+1:nlevmaxurbgrnd)) ; this%t_ssbef_col (:,:) = nan + allocate(this%t_soisno_col (begc:endc,-nlevsno+1:nlevmaxurbgrnd)) ; this%t_soisno_col (:,:) = nan allocate(this%t_lake_col (begc:endc,1:nlevlak)) ; this%t_lake_col (:,:) = nan allocate(this%t_grnd_col (begc:endc)) ; this%t_grnd_col (:) = nan allocate(this%t_grnd_r_col (begc:endc)) ; this%t_grnd_r_col (:) = nan @@ -268,7 +268,7 @@ subroutine InitAllocate(this, bounds) allocate(this%liquid_water_temp2_grc (begg:endg)) ; this%liquid_water_temp2_grc (:) = nan ! flags - allocate(this%imelt_col (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%imelt_col (:,:) = huge(1) + allocate(this%imelt_col (begc:endc,-nlevsno+1:nlevmaxurbgrnd)) ; this%imelt_col (:,:) = huge(1) ! emissivities allocate(this%emv_patch (begp:endp)) ; this%emv_patch (:) = nan @@ -276,7 +276,7 @@ subroutine InitAllocate(this, bounds) allocate(this%xmf_col (begc:endc)) ; this%xmf_col (:) = nan allocate(this%xmf_h2osfc_col (begc:endc)) ; this%xmf_h2osfc_col (:) = nan - allocate(this%fact_col (begc:endc, -nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%fact_col (:,:) = nan + allocate(this%fact_col (begc:endc, -nlevsno+1:nlevmaxurbgrnd)) ; this%fact_col (:,:) = nan allocate(this%c_h2osfc_col (begc:endc)) ; this%c_h2osfc_col (:) = nan end subroutine InitAllocate @@ -670,7 +670,7 @@ subroutine InitCold(this, bounds, & do c = bounds%begc,bounds%endc l = col%landunit(c) - this%t_soisno_col(c,-nlevsno+1:max0(nlevgrnd,nlevurb)) = spval + this%t_soisno_col(c,-nlevsno+1:nlevmaxurbgrnd) = spval ! Snow level temperatures - all land points if (snl(c) < 0) then diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 68fe98e725..528bb37f12 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -10,7 +10,7 @@ module TotalWaterAndHeatMod use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use clm_varcon , only : cpice, cpliq, denh2o, tfrz, hfus - use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb + use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb, nlevmaxurbgrnd use ColumnType , only : col use LandunitType , only : lun use subgridAveMod , only : p2c @@ -361,8 +361,7 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & h2osoi_liq => waterstate_inst%h2osoi_liq_col & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) ) - nlev = max0(nlevgrnd,nlevurb) - do j = 1, nlev + do j = 1, nlevmaxurbgrnd do fc = 1, num_c c = filter_c(fc) if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then @@ -762,8 +761,7 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & soil_latent_heat_liquid(c) = 0._r8 end do - nlev = max0(nlevgrnd,nlevurb) - do j = 1, nlev + do j = 1, nlevmaxurbgrnd do fc = 1, num_c c = filter_c(fc) l = col%landunit(c) diff --git a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 b/src/biogeophys/UrbBuildTempOleson2015Mod.F90 index 561501ff72..b5cd98a6c7 100644 --- a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 +++ b/src/biogeophys/UrbBuildTempOleson2015Mod.F90 @@ -210,7 +210,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use clm_varctl , only : iulog use abortutils , only : endrun - use clm_varpar , only : nlevurb, nlevsno, nlevgrnd + use clm_varpar , only : nlevurb, nlevsno, nlevmaxurbgrnd use UrbanParamsType , only : urban_hac, urban_hac_off, urban_hac_on, urban_wasteheat_on ! ! !ARGUMENTS: @@ -302,7 +302,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) associate(& clandunit => col%landunit , & ! Input: [integer (:)] column's landunit diff --git a/src/biogeophys/WaterStateBulkType.F90 b/src/biogeophys/WaterStateBulkType.F90 index dabf007751..217d4d063e 100644 --- a/src/biogeophys/WaterStateBulkType.F90 +++ b/src/biogeophys/WaterStateBulkType.F90 @@ -13,7 +13,7 @@ module WaterStateBulkType use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type - use clm_varpar , only : nlevgrnd, nlevsno, nlevurb + use clm_varpar , only : nlevmaxurbgrnd, nlevsno use clm_varcon , only : spval use WaterStateType , only : waterstate_type use WaterInfoBaseType, only : water_info_base_type @@ -212,7 +212,7 @@ subroutine RestartBulk(this, bounds, ncid, flag, & logical :: readvar !------------------------------------------------------------------------ - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevmaxurbgrnd/)) , errMsg(sourcefile, __LINE__)) call this%restart (bounds, ncid, flag=flag, & watsat_col=watsat_col(bounds%begc:bounds%endc,:)) diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index cf5ba781f7..b22332a052 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -14,7 +14,7 @@ module WaterStateType use decompMod , only : bounds_type use decompMod , only : BOUNDS_SUBGRID_PATCH, BOUNDS_SUBGRID_COLUMN use clm_varctl , only : use_bedrock, iulog - use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb, nlevsno + use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb, nlevmaxurbgrnd, nlevsno use clm_varcon , only : spval use LandunitType , only : lun use ColumnType , only : col @@ -115,15 +115,15 @@ subroutine InitAllocate(this, bounds, tracer_vars) call AllocateVar2d(var = this%h2osoi_vol_col, name = 'h2osoi_vol_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & - dim2beg = 1, dim2end = max0(nlevgrnd,nlevurb)) + dim2beg = 1, dim2end = nlevmaxurbgrnd) call AllocateVar2d(var = this%h2osoi_ice_col, name = 'h2osoi_ice_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & - dim2beg = -nlevsno+1, dim2end = max0(nlevgrnd,nlevurb)) + dim2beg = -nlevsno+1, dim2end = nlevmaxurbgrnd) call AllocateVar2d(var = this%h2osoi_liq_col, name = 'h2osoi_liq_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & - dim2beg = -nlevsno+1, dim2end = max0(nlevgrnd,nlevurb)) + dim2beg = -nlevsno+1, dim2end = nlevmaxurbgrnd) call AllocateVar1d(var = this%snocan_patch, name = 'snocan_patch', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_PATCH) @@ -307,8 +307,8 @@ subroutine InitCold(this, bounds, & !----------------------------------------------------------------------- SHR_ASSERT_ALL((ubound(h2osno_input_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevmaxurbgrnd/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soisno_col) == (/bounds%endc,nlevmaxurbgrnd/)) , errMsg(sourcefile, __LINE__)) ratio = this%info%get_ratio() @@ -446,7 +446,7 @@ subroutine InitCold(this, bounds, & !-------------------------------------------- do c = bounds%begc, bounds%endc - do j = 1,max0(nlevgrnd,nlevurb) + do j = 1,nlevmaxurbgrnd if (this%h2osoi_vol_col(c,j) /= spval) then if (t_soisno_col(c,j) <= tfrz) then this%h2osoi_ice_col(c,j) = col%dz(c,j)*denice*this%h2osoi_vol_col(c,j) ! ratio already applied @@ -530,7 +530,7 @@ subroutine Restart(this, bounds, ncid, flag, & real(r8) :: totwat ! total soil water (mm) !------------------------------------------------------------------------ - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,max0(nlevgrnd,nlevurb)/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevmaxurbgrnd/)) , errMsg(sourcefile, __LINE__)) call restartvar(ncid=ncid, flag=flag, & varname=this%info%fname('H2OSFC'), & diff --git a/src/biogeophys/Waterlnd2atmBulkType.F90 b/src/biogeophys/Waterlnd2atmBulkType.F90 index c18d7cbd24..6c1bee4bde 100644 --- a/src/biogeophys/Waterlnd2atmBulkType.F90 +++ b/src/biogeophys/Waterlnd2atmBulkType.F90 @@ -12,7 +12,7 @@ module Waterlnd2atmBulkType ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 use decompMod , only : bounds_type - use clm_varpar , only : nlevgrnd, nlevurb + use clm_varpar , only : nlevmaxurbgrnd use WaterLnd2atmType , only : waterlnd2atm_type use WaterInfoBaseType, only : water_info_base_type use WaterTracerContainerType, only : water_tracer_container_type @@ -78,7 +78,7 @@ subroutine InitBulkAllocate(this, bounds) begg = bounds%begg; endg= bounds%endg - allocate(this%h2osoi_vol_grc (begg:endg,1:max0(nlevgrnd,nlevurb))) ; this%h2osoi_vol_grc (:,:) = ival + allocate(this%h2osoi_vol_grc (begg:endg,1:nlevmaxurbgrnd)) ; this%h2osoi_vol_grc (:,:) = ival end subroutine InitBulkAllocate diff --git a/src/main/ColumnType.F90 b/src/main/ColumnType.F90 index 80745fb014..5a87f3a497 100644 --- a/src/main/ColumnType.F90 +++ b/src/main/ColumnType.F90 @@ -20,7 +20,7 @@ module ColumnType ! use shr_kind_mod , only : r8 => shr_kind_r8 use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevmaxurbgrnd use clm_varcon , only : spval, ispval use shr_sys_mod , only : shr_sys_abort use clm_varctl , only : iulog @@ -116,16 +116,16 @@ subroutine Init(this, begc, endc) ! The following is set in initVerticalMod allocate(this%snl (begc:endc)) ; this%snl (:) = ispval !* cannot be averaged up - allocate(this%dz (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%dz (:,:) = nan - allocate(this%z (begc:endc,-nlevsno+1:max0(nlevgrnd,nlevurb))) ; this%z (:,:) = nan - allocate(this%zi (begc:endc,-nlevsno+0:max0(nlevgrnd,nlevurb))) ; this%zi (:,:) = nan + allocate(this%dz (begc:endc,-nlevsno+1:nlevmaxurbgrnd)) ; this%dz (:,:) = nan + allocate(this%z (begc:endc,-nlevsno+1:nlevmaxurbgrnd)) ; this%z (:,:) = nan + allocate(this%zi (begc:endc,-nlevsno+0:nlevmaxurbgrnd)) ; this%zi (:,:) = nan allocate(this%zii (begc:endc)) ; this%zii (:) = nan allocate(this%lakedepth (begc:endc)) ; this%lakedepth (:) = spval allocate(this%dz_lake (begc:endc,nlevlak)) ; this%dz_lake (:,:) = nan allocate(this%z_lake (begc:endc,nlevlak)) ; this%z_lake (:,:) = nan - allocate(this%nbedrock (begc:endc)) ; this%nbedrock (:) = ispval - allocate(this%levgrnd_class(begc:endc,max0(nlevgrnd,nlevurb))) ; this%levgrnd_class(:,:) = ispval + allocate(this%nbedrock (begc:endc)) ; this%nbedrock (:) = ispval + allocate(this%levgrnd_class(begc:endc,nlevmaxurbgrnd)) ; this%levgrnd_class(:,:) = ispval allocate(this%micro_sigma (begc:endc)) ; this%micro_sigma (:) = nan allocate(this%n_melt (begc:endc)) ; this%n_melt (:) = nan allocate(this%topo_slope (begc:endc)) ; this%topo_slope (:) = nan diff --git a/src/main/clm_varpar.F90 b/src/main/clm_varpar.F90 index c19caf5bd5..6824910396 100644 --- a/src/main/clm_varpar.F90 +++ b/src/main/clm_varpar.F90 @@ -29,6 +29,7 @@ module clm_varpar integer, public :: nlevgrnd ! number of ground layers ! (includes lower layers that are hydrologically inactive) integer, public :: nlevurb ! number of urban layers + integer, public :: nlevmaxurbgrnd ! maximum of the number of ground and urban layers integer, public :: nlevlak ! number of lake layers integer, public :: nlevdecomp ! number of biogeochemically active soil layers integer, public :: nlevdecomp_full ! number of biogeochemical layers @@ -162,6 +163,7 @@ subroutine clm_varpar_init(actual_maxsoil_patches, actual_numcft) write(iulog,*) subname//' ERROR: Unrecognized soil layer structure: ', trim(soil_layerstruct) call shr_sys_abort(subname//' ERROR: Unrecognized soil layer structure') endif + nlevmaxurbgrnd = max0(nlevurb,nlevgrnd) if ( masterproc ) write(iulog, *) 'soil_layerstruct varpar ',soil_layerstruct,nlevsoi,nlevgrnd if (use_vichydro) then diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index e38cb186f5..b6b2fcf25f 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -15,7 +15,6 @@ module histFileMod use clm_varctl , only : iulog, use_vertsoilc, use_fates use clm_varcon , only : spval, ispval, dzsoi_decomp use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort - use clm_varpar , only : nlevurb use decompMod , only : get_proc_bounds, get_proc_global, bounds_type use GetGlobalValuesMod , only : GetGlobalIndex use GridcellType , only : grc @@ -1885,7 +1884,7 @@ subroutine htape_create (t, histrest) ! wrapper calls to define the history file contents. ! ! !USES: - use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, nlevurb, numrad, nlevcan, nvegwcs,nlevsoi + use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, nlevurb, nlevmaxurbgrnd, numrad, nlevcan, nvegwcs,nlevsoi use clm_varpar , only : natpft_size, cft_size, maxpatch_glcmec, nlevdecomp_full use landunit_varcon , only : max_lunit use clm_varctl , only : caseid, ctitle, fsurdat, finidat, paramfile @@ -2032,6 +2031,7 @@ subroutine htape_create (t, histrest) if (nlevurb > 0) then call ncd_defdim(lnfid, 'levurb' , nlevurb, dimid) end if + call ncd_defdim(lnfid, 'levmaxurbgrnd' , nlevmaxurbgrnd, dimid) call ncd_defdim(lnfid, 'levlak' , nlevlak, dimid) call ncd_defdim(lnfid, 'numrad' , numrad , dimid) call ncd_defdim(lnfid, 'levsno' , nlevsno , dimid) @@ -2210,7 +2210,7 @@ subroutine htape_timeconst3D(t, & ! ! !USES: use subgridAveMod , only : c2g - use clm_varpar , only : nlevgrnd ,nlevlak + use clm_varpar , only : nlevgrnd ,nlevlak, nlevmaxurbgrnd use shr_string_mod , only : shr_string_listAppend use domainMod , only : ldomain ! @@ -2252,10 +2252,10 @@ subroutine htape_timeconst3D(t, & /) !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) !------------------------------------------------------------------------------- !*** Non-time varying 3D fields *** @@ -3338,7 +3338,7 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time, get_prev_date use clm_varcon , only : secspday use perf_mod , only : t_startf, t_stopf - use clm_varpar , only : nlevgrnd + use clm_varpar , only : nlevmaxurbgrnd ! ! !ARGUMENTS: logical, intent(in) :: rstwr ! true => write restart file this step @@ -3371,10 +3371,10 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & character(len=*),parameter :: subname = 'hist_htapes_wrapup' !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, max0(nlevgrnd,nlevurb)/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) ! get current step diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index 0eda4673ba..8ae1df2260 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -14,7 +14,7 @@ module initVerticalMod use spmdMod , only : masterproc use clm_varpar , only : nlevsno, nlevgrnd, nlevlak use clm_varpar , only : toplev_equalspace, nlev_equalspace - use clm_varpar , only : nlevsoi, nlevsoifl, nlevurb + use clm_varpar , only : nlevsoi, nlevsoifl, nlevurb, nlevmaxurbgrnd use clm_varctl , only : fsurdat, iulog use clm_varctl , only : use_vancouver, use_mexicocity, use_vertsoilc, use_extralakelayers use clm_varctl , only : use_bedrock, soil_layerstruct @@ -683,9 +683,9 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof if (col%nbedrock(c) < nlevsoi) then col%levgrnd_class(c, (col%nbedrock(c) + 1) : nlevsoi) = LEVGRND_CLASS_SHALLOW_BEDROCK end if - col%levgrnd_class(c, (nlevsoi + 1) : max0(nlevgrnd,nlevurb)) = LEVGRND_CLASS_DEEP_BEDROCK + col%levgrnd_class(c, (nlevsoi + 1) : nlevmaxurbgrnd) = LEVGRND_CLASS_DEEP_BEDROCK else - col%levgrnd_class(c, 1:max0(nlevgrnd,nlevurb)) = LEVGRND_CLASS_STANDARD + col%levgrnd_class(c, 1:nlevmaxurbgrnd) = LEVGRND_CLASS_STANDARD end if end do diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index 3e28bb4d4c..c720e2ff08 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -11,7 +11,7 @@ module lnd2atmMod use shr_log_mod , only : errMsg => shr_log_errMsg use shr_megan_mod , only : shr_megan_mechcomps_n use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n - use clm_varpar , only : numrad, ndst, nlevgrnd, nlevurb !ndst = number of dust bins. + use clm_varpar , only : numrad, ndst, nlevgrnd, nlevmaxurbgrnd !ndst = number of dust bins. use clm_varcon , only : rair, grav, cpair, hfus, tfrz, spval use clm_varctl , only : iulog, use_lch4 use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND @@ -98,7 +98,7 @@ subroutine lnd2atm_minimal(bounds, & end associate end do - call c2g(bounds, max0(nlevgrnd,nlevurb), & + call c2g(bounds, nlevmaxurbgrnd, & water_inst%waterstatebulk_inst%h2osoi_vol_col (bounds%begc:bounds%endc, :), & water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc (bounds%begg:bounds%endg, :), & c2l_scale_type= 'urbanf', l2g_scale_type='unity') diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 0dc115087a..8eb6d1d912 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -484,7 +484,7 @@ subroutine restFile_dimset( ncid ) use clm_varctl , only : caseid, ctitle, version, username, hostname, fsurdat use clm_varctl , only : conventions, source use dynSubgridControlMod , only : get_flanduse_timeseries - use clm_varpar , only : numrad, nlevlak, nlevsno, nlevgrnd, nlevurb, nlevcan + use clm_varpar , only : numrad, nlevlak, nlevsno, nlevgrnd, nlevurb, nlevmaxurbgrnd, nlevcan use clm_varpar , only : maxpatch_glcmec, nvegwcs use decompMod , only : get_proc_global ! @@ -516,12 +516,13 @@ subroutine restFile_dimset( ncid ) call ncd_defdim(ncid , namep , nump , dimid) call ncd_defdim(ncid , nameCohort , numCohort , dimid) - call ncd_defdim(ncid , 'levgrnd' , max0(nlevgrnd,nlevurb) , dimid) + call ncd_defdim(ncid , 'levgrnd' , nlevgrnd , dimid) call ncd_defdim(ncid , 'levurb' , nlevurb , dimid) + call ncd_defdim(ncid , 'levmaxurbgrnd' , nlevmaxurbgrnd , dimid) call ncd_defdim(ncid , 'levlak' , nlevlak , dimid) call ncd_defdim(ncid , 'levsno' , nlevsno , dimid) call ncd_defdim(ncid , 'levsno1' , nlevsno+1 , dimid) - call ncd_defdim(ncid , 'levtot' , nlevsno+max0(nlevgrnd,nlevurb), dimid) + call ncd_defdim(ncid , 'levtot' , nlevsno+nlevmaxurbgrnd, dimid) call ncd_defdim(ncid , 'numrad' , numrad , dimid) call ncd_defdim(ncid , 'levcan' , nlevcan , dimid) if ( use_hydrstress ) then @@ -679,7 +680,7 @@ subroutine restFile_dimcheck( ncid ) ! ! !USES: use decompMod, only : get_proc_global - use clm_varpar, only : nlevsno, nlevlak, nlevgrnd, nlevurb + use clm_varpar, only : nlevsno, nlevlak, nlevgrnd, nlevurb, nlevmaxurbgrnd use clm_varctl, only : single_column, nsrest, nsrStartup ! ! !ARGUMENTS: @@ -717,8 +718,9 @@ subroutine restFile_dimcheck( ncid ) msg = 'You can deal with this mismatch by rerunning with ' // & 'use_init_interp = .true. in user_nl_clm' call check_dim(ncid, 'levsno' , nlevsno, msg=msg) - call check_dim(ncid, 'levgrnd' , max0(nlevgrnd,nlevurb), msg=msg) + call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg) call check_dim(ncid, 'levurb' , nlevurb) + call check_dim(ncid, 'levmaxurbgrnd' , nlevmaxurbgrnd, msg=msg) call check_dim(ncid, 'levlak' , nlevlak) end subroutine restFile_dimcheck diff --git a/src/main/subgridRestMod.F90 b/src/main/subgridRestMod.F90 index 2cf97f6feb..9183eb9f05 100644 --- a/src/main/subgridRestMod.F90 +++ b/src/main/subgridRestMod.F90 @@ -12,7 +12,7 @@ module subgridRestMod use domainMod , only : ldomain use clm_time_manager , only : get_curr_date use clm_varcon , only : nameg, namel, namec, namep - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd use pio , only : file_desc_t use ncdio_pio , only : ncd_int, ncd_double use GetGlobalValuesMod , only : GetGlobalIndex @@ -304,14 +304,14 @@ subroutine subgridRest_write_only(bounds, ncid, flag) interpinic_flag='skip', readvar=readvar, data=icarr) call restartvar(ncid=ncid, flag=flag, varname='LEVGRND_CLASS', xtype=ncd_int, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & + dim1name='column', dim2name='levmaxurbgrnd', switchdim=.true., & long_name='class in which each layer falls', units=' ', & interpinic_flag='skip', readvar=readvar, data=col%levgrnd_class) - allocate(temp2d_r(bounds%begc:bounds%endc, 1:max0(nlevgrnd,nlevurb))) - temp2d_r(bounds%begc:bounds%endc, 1:max0(nlevgrnd,nlevurb)) = col%z(bounds%begc:bounds%endc, 1:max0(nlevgrnd,nlevurb)) + allocate(temp2d_r(bounds%begc:bounds%endc, 1:nlevmaxurbgrnd)) + temp2d_r(bounds%begc:bounds%endc, 1:nlevmaxurbgrnd) = col%z(bounds%begc:bounds%endc, 1:nlevmaxurbgrnd) call restartvar(ncid=ncid, flag=flag, varname='COL_Z', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & + dim1name='column', dim2name='levmaxurbgrnd', switchdim=.true., & long_name='layer depth, excluding snow layers', units='m', & interpinic_flag='skip', readvar=readvar, data=temp2d_r) deallocate(temp2d_r) @@ -413,24 +413,24 @@ subroutine subgridRest_write_only(bounds, ncid, flag) long_name='pft active flag (1=active, 0=inactive)', units='', & interpinic_flag='skip', readvar=readvar, data=iparr) - allocate(temp2d_i(bounds%begp:bounds%endp, 1:max0(nlevgrnd,nlevurb))) + allocate(temp2d_i(bounds%begp:bounds%endp, 1:nlevmaxurbgrnd)) do p=bounds%begp,bounds%endp c = patch%column(p) - temp2d_i(p, 1:max0(nlevgrnd,nlevurb)) = col%levgrnd_class(c, 1:max0(nlevgrnd,nlevurb)) + temp2d_i(p, 1:nlevmaxurbgrnd) = col%levgrnd_class(c, 1:nlevmaxurbgrnd) end do call restartvar(ncid=ncid, flag=flag, varname='LEVGRND_CLASS_p', xtype=ncd_int, & - dim1name='pft', dim2name='levgrnd', switchdim=.true., & + dim1name='pft', dim2name='levmaxurbgrnd', switchdim=.true., & long_name='class in which each layer falls, patch-level', units=' ', & interpinic_flag='skip', readvar=readvar, data=temp2d_i) deallocate(temp2d_i) - allocate(temp2d_r(bounds%begp:bounds%endp, 1:max0(nlevgrnd,nlevurb))) + allocate(temp2d_r(bounds%begp:bounds%endp, 1:nlevmaxurbgrnd)) do p=bounds%begp,bounds%endp c = patch%column(p) - temp2d_r(p, 1:max0(nlevgrnd,nlevurb)) = col%z(c, 1:max0(nlevgrnd,nlevurb)) + temp2d_r(p, 1:nlevmaxurbgrnd) = col%z(c, 1:nlevmaxurbgrnd) end do call restartvar(ncid=ncid, flag=flag, varname='COL_Z_p', xtype=ncd_double, & - dim1name='pft', dim2name='levgrnd', switchdim=.true., & + dim1name='pft', dim2name='levmaxurbgrnd', switchdim=.true., & long_name='layer depth, excluding snow layers, patch-level', units='m', & interpinic_flag='skip', readvar=readvar, data=temp2d_r) deallocate(temp2d_r) From 912bf132c0cfae8390fd5b0c5fa3b8a63c18503a Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 4 Oct 2019 10:09:30 -0600 Subject: [PATCH 0397/1973] Change some arrays from max0(nlevgrnd,nlevurb) to nlevmaxurbgrnd --- src/biogeophys/SoilStateInitTimeConstMod.F90 | 18 +++++----- src/biogeophys/SoilStateType.F90 | 35 ++++++++++---------- src/main/histFileMod.F90 | 14 ++++---- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 index c30e2751a5..53b32e3e22 100644 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ b/src/biogeophys/SoilStateInitTimeConstMod.F90 @@ -355,7 +355,7 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) soilstate_inst%tkmg_col(c,lev) = spval soilstate_inst%tksatu_col(c,lev) = spval soilstate_inst%tkdry_col(c,lev) = spval - soilstate_inst%csol_col(c,lev)= spval + soilstate_inst%csol_col(c,lev) = spval end do else if (lun%urbpoi(l) .and. (col%itype(c) /= icol_road_perv) .and. (col%itype(c) /= icol_road_imperv) )then @@ -363,13 +363,6 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) ! Urban Roof, sunwall, shadewall properties set to special value do lev = 1,nlevmaxurbgrnd soilstate_inst%watsat_col(c,lev) = spval - soilstate_inst%watfc_col(c,lev) = spval - soilstate_inst%bsw_col(c,lev) = spval - soilstate_inst%hksat_col(c,lev) = spval - soilstate_inst%sucsat_col(c,lev) = spval - soilstate_inst%watdry_col(c,lev) = spval - soilstate_inst%watopt_col(c,lev) = spval - soilstate_inst%bd_col(c,lev) = spval if (lev <= nlevsoi) then soilstate_inst%cellsand_col(c,lev) = spval soilstate_inst%cellclay_col(c,lev) = spval @@ -377,7 +370,14 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) end if end do - do lev = 1,nlevmaxurbgrnd + do lev = 1,nlevgrnd + soilstate_inst%watfc_col(c,lev) = spval + soilstate_inst%bsw_col(c,lev) = spval + soilstate_inst%hksat_col(c,lev) = spval + soilstate_inst%sucsat_col(c,lev) = spval + soilstate_inst%watdry_col(c,lev) = spval + soilstate_inst%watopt_col(c,lev) = spval + soilstate_inst%bd_col(c,lev) = spval soilstate_inst%tkmg_col(c,lev) = spval soilstate_inst%tksatu_col(c,lev) = spval soilstate_inst%tkdry_col(c,lev) = spval diff --git a/src/biogeophys/SoilStateType.F90 b/src/biogeophys/SoilStateType.F90 index 592a240099..d2b44688b1 100644 --- a/src/biogeophys/SoilStateType.F90 +++ b/src/biogeophys/SoilStateType.F90 @@ -129,39 +129,40 @@ subroutine InitAllocate(this, bounds) allocate(this%cellorg_col (begc:endc,nlevsoi)) ; this%cellorg_col (:,:) = nan allocate(this%cellsand_col (begc:endc,nlevsoi)) ; this%cellsand_col (:,:) = nan allocate(this%cellclay_col (begc:endc,nlevsoi)) ; this%cellclay_col (:,:) = nan - allocate(this%bd_col (begc:endc,nlevmaxurbgrnd)) ; this%bd_col (:,:) = nan + allocate(this%bd_col (begc:endc,nlevgrnd)) ; this%bd_col (:,:) = nan - allocate(this%hksat_col (begc:endc,nlevmaxurbgrnd)) ; this%hksat_col (:,:) = spval - allocate(this%hksat_min_col (begc:endc,nlevmaxurbgrnd)) ; this%hksat_min_col (:,:) = spval - allocate(this%hk_l_col (begc:endc,nlevmaxurbgrnd)) ; this%hk_l_col (:,:) = nan - allocate(this%smp_l_col (begc:endc,nlevmaxurbgrnd)) ; this%smp_l_col (:,:) = nan + allocate(this%hksat_col (begc:endc,nlevgrnd)) ; this%hksat_col (:,:) = spval + allocate(this%hksat_min_col (begc:endc,nlevgrnd)) ; this%hksat_min_col (:,:) = spval + allocate(this%hk_l_col (begc:endc,nlevgrnd)) ; this%hk_l_col (:,:) = nan + allocate(this%smp_l_col (begc:endc,nlevgrnd)) ; this%smp_l_col (:,:) = nan allocate(this%smpmin_col (begc:endc)) ; this%smpmin_col (:) = nan - allocate(this%bsw_col (begc:endc,nlevmaxurbgrnd)) ; this%bsw_col (:,:) = nan + + allocate(this%bsw_col (begc:endc,nlevgrnd)) ; this%bsw_col (:,:) = nan allocate(this%watsat_col (begc:endc,nlevmaxurbgrnd)) ; this%watsat_col (:,:) = nan - allocate(this%watdry_col (begc:endc,nlevmaxurbgrnd)) ; this%watdry_col (:,:) = spval - allocate(this%watopt_col (begc:endc,nlevmaxurbgrnd)) ; this%watopt_col (:,:) = spval - allocate(this%watfc_col (begc:endc,nlevmaxurbgrnd)) ; this%watfc_col (:,:) = nan - allocate(this%sucsat_col (begc:endc,nlevmaxurbgrnd)) ; this%sucsat_col (:,:) = spval + allocate(this%watdry_col (begc:endc,nlevgrnd)) ; this%watdry_col (:,:) = spval + allocate(this%watopt_col (begc:endc,nlevgrnd)) ; this%watopt_col (:,:) = spval + allocate(this%watfc_col (begc:endc,nlevgrnd)) ; this%watfc_col (:,:) = nan + allocate(this%sucsat_col (begc:endc,nlevgrnd)) ; this%sucsat_col (:,:) = spval allocate(this%dsl_col (begc:endc)) ; this%dsl_col (:) = spval!nan allocate(this%soilresis_col (begc:endc)) ; this%soilresis_col (:) = spval!nan allocate(this%soilbeta_col (begc:endc)) ; this%soilbeta_col (:) = nan allocate(this%soilalpha_col (begc:endc)) ; this%soilalpha_col (:) = nan allocate(this%soilalpha_u_col (begc:endc)) ; this%soilalpha_u_col (:) = nan - allocate(this%soilpsi_col (begc:endc,nlevmaxurbgrnd)) ; this%soilpsi_col (:,:) = nan + allocate(this%soilpsi_col (begc:endc,nlevgrnd)) ; this%soilpsi_col (:,:) = nan allocate(this%wtfact_col (begc:endc)) ; this%wtfact_col (:) = nan allocate(this%porosity_col (begc:endc,nlayer)) ; this%porosity_col (:,:) = spval - allocate(this%eff_porosity_col (begc:endc,nlevmaxurbgrnd)) ; this%eff_porosity_col (:,:) = spval + allocate(this%eff_porosity_col (begc:endc,nlevgrnd)) ; this%eff_porosity_col (:,:) = spval allocate(this%gwc_thr_col (begc:endc)) ; this%gwc_thr_col (:) = nan allocate(this%thk_col (begc:endc,-nlevsno+1:nlevmaxurbgrnd)) ; this%thk_col (:,:) = nan - allocate(this%tkmg_col (begc:endc,nlevmaxurbgrnd)) ; this%tkmg_col (:,:) = nan - allocate(this%tkdry_col (begc:endc,nlevmaxurbgrnd)) ; this%tkdry_col (:,:) = nan - allocate(this%tksatu_col (begc:endc,nlevmaxurbgrnd)) ; this%tksatu_col (:,:) = nan - allocate(this%csol_col (begc:endc,nlevmaxurbgrnd)) ; this%csol_col (:,:) = nan + allocate(this%tkmg_col (begc:endc,nlevgrnd)) ; this%tkmg_col (:,:) = nan + allocate(this%tkdry_col (begc:endc,nlevgrnd)) ; this%tkdry_col (:,:) = nan + allocate(this%tksatu_col (begc:endc,nlevgrnd)) ; this%tksatu_col (:,:) = nan + allocate(this%csol_col (begc:endc,nlevgrnd)) ; this%csol_col (:,:) = nan allocate(this%rootr_patch (begp:endp,1:nlevgrnd)) ; this%rootr_patch (:,:) = nan allocate(this%root_depth_patch (begp:endp)) ; this%root_depth_patch (:) = nan - allocate(this%rootr_col (begc:endc,nlevmaxurbgrnd)) ; this%rootr_col (:,:) = nan + allocate(this%rootr_col (begc:endc,nlevgrnd)) ; this%rootr_col (:,:) = nan allocate(this%rootr_road_perv_col (begc:endc,1:nlevgrnd)) ; this%rootr_road_perv_col (:,:) = nan allocate(this%rootfr_patch (begp:endp,1:nlevgrnd)) ; this%rootfr_patch (:,:) = nan allocate(this%crootfr_patch (begp:endp,1:nlevgrnd)) ; this%crootfr_patch (:,:) = nan diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index b6b2fcf25f..70e35dbf4a 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2253,9 +2253,9 @@ subroutine htape_timeconst3D(t, & !----------------------------------------------------------------------- SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) !------------------------------------------------------------------------------- !*** Non-time varying 3D fields *** @@ -3338,7 +3338,7 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time, get_prev_date use clm_varcon , only : secspday use perf_mod , only : t_startf, t_stopf - use clm_varpar , only : nlevmaxurbgrnd + use clm_varpar , only : nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: logical, intent(in) :: rstwr ! true => write restart file this step @@ -3372,9 +3372,9 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & !----------------------------------------------------------------------- SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevmaxurbgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) ! get current step From 3fefc5969d2c29868d12b24abbba55206b2e7cee Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 4 Oct 2019 11:06:40 -0600 Subject: [PATCH 0398/1973] merge to master --- bld/CLMBuildNamelist.pm | 2 - src/biogeophys/CanopyFluxesMod.F90 | 93 +----------------------------- src/main/clm_initializeMod.F90 | 2 +- src/main/clm_instMod.F90 | 1 - src/main/initGridCellsMod.F90 | 2 +- src/main/readParamsMod.F90 | 5 +- 6 files changed, 6 insertions(+), 99 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index ce01d8ba37..e2909f1b14 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2083,9 +2083,7 @@ sub error_if_set { sub setup_logic_pftsoilcolumn { my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_individual_pft_soil_column'); - } } #------------------------------------------------------------------------------- diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 27f334316e..a0d59afc23 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -52,26 +52,6 @@ module CanopyFluxesMod ! !PUBLIC TYPES: implicit none ! - ! !PUBLIC VARIABLES: - - type :: canopyflux_params_type - real(r8), allocatable, public :: dbh (:) - real(r8), allocatable, public :: fbw (:) - real(r8), allocatable, public :: nstem (:) - real(r8), allocatable, public :: rstem (:) - real(r8), allocatable, public :: wood_density (:) - contains - procedure, private :: allocParams - end type canopyflux_params_type - ! - type(canopyflux_params_type), public, protected :: params_inst ! params_inst is populated in readParamsMod - - type, public :: canopyflux_type - contains - procedure, public :: ReadParams - end type canopyflux_type - ! - ! !PUBLIC MEMBER FUNCTIONS: public :: CanopyFluxesReadNML ! Read in namelist settings public :: CanopyFluxes ! Calculate canopy fluxes @@ -86,6 +66,7 @@ module CanopyFluxesMod real(r8) :: cv ! Turbulent transfer coeff. between canopy surface and canopy air (m/s^(1/2)) end type params_type type(params_type), private :: params_inst + ! ! !PUBLIC DATA MEMBERS: ! true => btran is based only on unfrozen soil levels @@ -96,7 +77,7 @@ module CanopyFluxesMod logical, public :: perchroot_alt = .false. ! ! !PRIVATE DATA MEMBERS: - logical, private :: use_undercanopy_stability = .true. ! use undercanopy stability term or not + logical, private :: use_undercanopy_stability = .false. ! use undercanopy stability term or not integer, private :: itmax_canopy_fluxes = -1 ! max # of iterations used in subroutine CanopyFluxes character(len=*), parameter, private :: sourcefile = & @@ -105,76 +86,6 @@ module CanopyFluxesMod contains - !----------------------------------------------------------------------- - subroutine allocParams ( this ) - ! - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - implicit none - - ! !ARGUMENTS: - class(canopyflux_params_type) :: this - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'allocParams' - !----------------------------------------------------------------------- - - ! allocate parameters - - allocate( this%dbh (0:mxpft) ) ; this%dbh(:) = nan - allocate( this%fbw (0:mxpft) ) ; this%fbw(:) = nan - allocate( this%nstem (0:mxpft) ) ; this%nstem(:) = nan - allocate( this%rstem (0:mxpft) ) ; this%rstem(:) = nan - allocate( this%wood_density(0:mxpft) ) ; this%wood_density(:) = nan - - end subroutine allocParams - - !----------------------------------------------------------------------- - subroutine readParams ( this, ncid ) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - implicit none - - ! !ARGUMENTS: - class(canopyflux_type) :: this - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'readParams' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: temp1d(0:mxpft) ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! read in parameters - - - call params_inst%allocParams() - - tString = "dbh" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%dbh=temp1d - tString = "fbw" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%fbw=temp1d - tString = "nstem" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%nstem=temp1d - tString = "rstem" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rstem=temp1d - tString = "wood_density" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%wood_density=temp1d - - end subroutine readParams - !------------------------------------------------------------------------ subroutine CanopyFluxesReadNML(NLFilename) ! diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index eaa1768d26..aa27b18a6c 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -346,7 +346,7 @@ subroutine initialize2( ) allocate(nutrient_competition_method, & source=create_nutrient_competition_method(bounds_proc)) - call readParameters(nutrient_competition_method, photosyns_inst, canopyflux_inst) + call readParameters(nutrient_competition_method, photosyns_inst) ! ------------------------------------------------------------------------ ! Initialize time manager diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index d5ff28044e..276df5e3d3 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -52,7 +52,6 @@ module clm_instMod use OzoneBaseMod , only : ozone_base_type use OzoneFactoryMod , only : create_and_init_ozone_type use PhotosynthesisMod , only : photosyns_type - use CanopyFluxesMod , only : canopyflux_type use SoilHydrologyType , only : soilhydrology_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type use SoilStateType , only : soilstate_type diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 index 01ac91b4e6..7e959af786 100644 --- a/src/main/initGridCellsMod.F90 +++ b/src/main/initGridCellsMod.F90 @@ -293,7 +293,7 @@ subroutine set_landunit_veg_noncompete (ltype, gi, li, ci, pi) ! !USES use clm_instur, only : wt_lunit, wt_nat_patch use subgridMod, only : subgrid_get_info_natveg, natveg_patch_exists - use clm_varpar, only : numpft, maxpatch_pft, natpft_lb, natpft_ub + use clm_varpar, only : maxpatch_pft, natpft_lb, natpft_ub ! ! !ARGUMENTS: integer , intent(in) :: ltype ! landunit type diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index 4a57f8da43..710f29c31f 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -23,7 +23,7 @@ module readParamsMod contains !----------------------------------------------------------------------- - subroutine readParameters (nutrient_competition_method, photosyns_inst, canopyflux_inst) + subroutine readParameters (nutrient_competition_method, photosyns_inst) ! ! ! USES: use CNSharedParamsMod , only : CNParamsReadShared @@ -53,11 +53,10 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst, canopyfl use NutrientCompetitionMethodMod , only : nutrient_competition_method_type use clm_varctl, only : NLFilename_in use PhotosynthesisMod , only : photosyns_type - use CanopyFluxesMod , only : canopyflux_type + ! ! !ARGUMENTS: type(photosyns_type) , intent(in) :: photosyns_inst - type(canopyflux_type) , intent(in) :: canopyflux_inst class(nutrient_competition_method_type), intent(in) :: nutrient_competition_method ! ! !LOCAL VARIABLES: From e9ccd6b5b31268ade075409f5207804296b089f1 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 9 Oct 2019 11:04:07 -0600 Subject: [PATCH 0399/1973] Update soil organic matter properties in Hydrology chapter --- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index fb387d25c2..c4e0824ea7 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -620,9 +620,8 @@ organic components. The water content at saturation (i.e. porosity) is \theta_{sat,i} =(1-f_{om,i} )\theta_{sat,\min ,i} +f_{om,i} \theta_{sat,om} where :math:`f_{om,i}` is the soil organic matter fraction, -:math:`\theta_{sat,om} =0.9` (:ref:`Farouki 1981 `; -:ref:`Letts et al. 2000 `) is the -porosity of organic matter and the porosity of the mineral soil +:math:`\theta_{sat,om}` is the +porosity of organic matter, and the porosity of the mineral soil :math:`\theta_{sat,\min ,i}` is .. math:: @@ -637,7 +636,7 @@ The exponent :math:`B_{i}` is B_{i} =(1-f_{om,i} )B_{\min ,i} +f_{om,i} B_{om} -where :math:`B_{om} = 2.7` \ (:ref:`Letts et al. 2000 `) and +where :math:`B_{om}` is for organic matter and .. math:: :label: 7.93 @@ -659,7 +658,7 @@ where the saturated soil matric potential (mm) is \psi _{sat,i} =(1-f_{om,i} )\psi _{sat,\min ,i} +f_{om,i} \psi _{sat,om} -where :math:`\psi _{sat,om} = -10.3` \ mm (:ref:`Letts et al. 2000 `) is the +where :math:`\psi _{sat,om}` \ is the saturated organic matter matric potential and the saturated mineral soil matric potential :math:`\psi _{sat,\min ,i}` \ is @@ -723,6 +722,31 @@ as k_{sat} \left[z_{h,\, i} \right]=f_{uncon,\, i} k_{sat,\, uncon} \left[z_{h,\, i} \right]+(1-f_{uncon,\, i} )k_{sat,\, om} \left[z_{h,\, i} \right]. +The soil organic matter properties implicitly account for the standard observed profile of organic matter +properties as + +.. math:: + :label: 1.101 + + \theta_{sat,om} = max(0.93 - 0.1\times z_{i} / zsapric, 0.83). + +.. math:: + :label: 1.102 + + B_{om} = min(2.7 + 9.3\times z_{i} / zsapric, 12.0). + +.. math:: + :label: 1.103 + + \psi_{sat,om} = min(10.3 - 0.2\times z_{i} / zsapric, 10.1). + +.. math:: + :label: 1.104 + + k_{sat,om} = max(0.28 - 0.2799\times z_{i} / zsapric, k_{sat,\, \min } \left[z_{h,\, i} \right]). + +where :math:`zsapric =0.5` \m is the depth that organic matter takes on the characteristics of sapric peat. + .. _Numerical Solution Hydrology: Numerical Solution From 0aad0e1793e8b323a05ad38dc6ef0b486ff66172 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 9 Oct 2019 11:41:30 -0600 Subject: [PATCH 0400/1973] changing the mesh file --- lilac/lilac/atmos_cap.F90 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index 55228da5d8..145af984fa 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -8,6 +8,7 @@ module atmos_cap use ESMF use lilac_utils , only : fld_list_type use spmdMod , only : masterproc + use clm_varctl , only : iulog implicit none include 'mpif.h' @@ -26,6 +27,13 @@ module atmos_cap integer status(MPI_STATUS_SIZE) ! Status of message integer, parameter :: debug = 0 ! internal debug leve + + + character(len=128) :: fldname + integer, parameter :: begc = 1 !-- internal debug level + integer, parameter :: endc = 3312/4/2/2 !-- internal debug level + character(*),parameter :: F02 = "('[atmos_cap]',a,i5,2x,d26.19)" + !======================================================================== contains !======================================================================== @@ -98,7 +106,9 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! TODO: hard-coded mesh file name shoulb be corrected. ! For now this is our dummy mesh: !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' !! Negin: This did not work.... - atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc' + !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc' + atmos_mesh_filepath = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + atmos_mesh = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out @@ -167,14 +177,18 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) enddo + fldname = 'Sa_topo' + do i=begc, endc + write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, a2c_fldlist(2)%farrayptr1d(i) + enddo + call ESMF_LogWrite(subname//"fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" ! Add field bundle to state call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"atm2lnd_a_state is filled with dummy_var field bundle!", ESMF_LOGMSG_INFO) print *, "!atm2lnd_a_state is filld with dummy_var field bundle!" From d608acbf9dcbac666623661108b58ab4510acfeb Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 9 Oct 2019 11:45:45 -0600 Subject: [PATCH 0401/1973] some clean up of printing statements during debugging phase. --- lilac/lilac/lilac_mod.F90 | 71 ++++++++++++++++++++++++------------- lilac/lilac/lilac_utils.F90 | 6 ++-- 2 files changed, 50 insertions(+), 27 deletions(-) diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 84c29384a9..8f69f2e492 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -6,17 +6,19 @@ module lilac_mod ! !USES use ESMF - use lilac_utils , only : fld_list_type, fldsMax, create_fldlists - use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type - use lilac_utils , only : atm2lnd_data2d_type , lnd2atm_data2d_type + use lilac_utils , only : fld_list_type, fldsMax, create_fldlists + use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type + use lilac_utils , only : atm2lnd_data2d_type , lnd2atm_data2d_type use atmos_cap , only : atmos_register !use lnd_shr_methods use lnd_comp_esmf , only : lnd_register use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register - use mpi, only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS - use shr_pio_mod, only : shr_pio_init1, shr_pio_init2 + use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS + use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 + use clm_varctl , only : iulog + use spmdMod , only : masterproc implicit none !TODO (NS,2019-08-07): @@ -87,24 +89,29 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) e_month, e_day, e_hour, e_min - integer :: COMP_COMM - integer :: ierr - integer :: ntasks,mytask ! mpicom size and rank - - integer :: ncomps = 1 ! land only - - integer :: n + integer :: COMP_COMM + integer :: ierr + integer :: ntasks,mytask ! mpicom size and rank + integer :: ncomps = 1 ! land only + integer :: n + integer :: i + integer, parameter :: debug = 1 !-- internal debug level !!! above: https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/pio-xlis-bld/xlis_main.F90 + character(len=128) :: fldname + integer, parameter :: begc = 1 !-- internal debug level + integer, parameter :: endc = 3312/4/2/2 !-- internal debug level + character(*),parameter :: F02 = "('[lilac_mod]',a,i5,2x,d26.19)" !------------------------------------------------------------------------ ! Initialize return code rc = ESMF_SUCCESS - - print *, "---------------------------------------" - print *, " Lilac Demo Application Start " - print *, "---------------------------------------" + if (masterproc) then + print *, "---------------------------------------" + print *, " Lilac Demo Application Start " + print *, "---------------------------------------" + end if !----------------------------------------------------------------------------- ! Initiallize MPI @@ -121,14 +128,14 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) call MPI_ABORT(MPI_COMM_WORLD, ierr) end if - - ! call MPI_COMM_RANK(COMP_COMM, mytask, ierr) call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) - print *, "MPI initialization done ..., ntasks=", ntasks + if (masterproc) then + print *, "MPI initialization done ..., ntasks=", ntasks + end if !----------------------------------------------------------------------------- ! Initialize PIO @@ -167,7 +174,10 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! Read in namelist file ... call ESMF_UtilIOUnitGet(unit=fileunit, rc=rc) ! get an available Fortran unit number if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - print *, "---------------------------------------" + + if (masterproc) then + print *, "---------------------------------------" + end if open(fileunit, status="old", file="namelist_lilac", action="read", iostat=rc) @@ -202,7 +212,10 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) allocate (l2c_fldlist(fldsmax)) allocate (c2l_fldlist(fldsmax)) - print *, "creating empty field lists !" + if (masterproc) then + print *, "creating empty field lists !" + end if + call ESMF_LogWrite(subname//"fielldlists are allocated!", ESMF_LOGMSG_INFO) ! create field lists @@ -223,6 +236,13 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) a2c_fldlist(1)%farrayptr1d => atm2lnd1d%Sa_z a2c_fldlist(2)%farrayptr1d => atm2lnd1d%Sa_topo + + !if (masterproc .and. debug > 0) then + fldname = 'Sa_topo' + do i=begc, endc + write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, a2c_fldlist(2)%farrayptr1d(i) + end do + !end if a2c_fldlist(3)%farrayptr1d => atm2lnd1d%Sa_u a2c_fldlist(4)%farrayptr1d => atm2lnd1d%Sa_v a2c_fldlist(5)%farrayptr1d => atm2lnd1d%Sa_ptem @@ -347,13 +367,14 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1 , s=0, calendar=Calendar, rc=rc) call ESMF_TimeSet(StopTime , yy=2000, mm=03, dd=01, s=0, calendar=Calendar, rc=rc) - call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) + !call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) + call ESMF_TimeIntervalSet(TimeStep, s=1800, rc=rc) clock = ESMF_ClockCreate(name='lilac_drv_EClock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, stopTime=stopTime, rc=rc) print *, "---------------------------------------" - call ESMF_ClockPrint (clock, rc=rc) + !call ESMF_ClockPrint (clock, rc=rc) print *, "=======================================" - call ESMF_CalendarPrint ( calendar , rc=rc) + !call ESMF_CalendarPrint ( calendar , rc=rc) print *, "---------------------------------------" ! ======================================================================== @@ -450,7 +471,7 @@ subroutine lilac_run( ) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out print *, "Run Loop Start time" - call ESMF_ClockPrint(local_clock, options="currtime string", rc=rc) + !call ESMF_ClockPrint(local_clock, options="currtime string", rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out !------------------------------------------------------------------------- diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index 29e45dad99..ef1074a909 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -35,9 +35,9 @@ module lilac_utils real*8, pointer :: Sa_pbot (:) real*8, pointer :: Sa_tbot (:) real*8, pointer :: Sa_shum (:) - !real*8, pointer :: Sa_methane (:) + real*8, pointer :: Sa_methane (:) ! from atm - fluxes - real*8, pointer :: Faxa_lwdn (:) + real*8, pointer :: Faxa_lwdn (:) real*8, pointer :: Faxa_rainc (:) real*8, pointer :: Faxa_rainl (:) real*8, pointer :: Faxa_snowc (:) @@ -46,6 +46,8 @@ module lilac_utils real*8, pointer :: Faxa_swvdr (:) real*8, pointer :: Faxa_swndf (:) real*8, pointer :: Faxa_swvdf (:) + + real*8, pointer :: Faxa_bcph (:) end type atm2lnd_data1d_type ! From 2abed4b4d9d782c1f63849b50213606890ed07d0 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 9 Oct 2019 11:46:42 -0600 Subject: [PATCH 0402/1973] changing regrid to redist for getting bfb... --- lilac/lilac/cpl_mod.F90 | 117 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 7 deletions(-) diff --git a/lilac/lilac/cpl_mod.F90 b/lilac/lilac/cpl_mod.F90 index e6573eaa3a..0fbe51677c 100644 --- a/lilac/lilac/cpl_mod.F90 +++ b/lilac/lilac/cpl_mod.F90 @@ -8,6 +8,7 @@ module cpl_mod !----------------------------------------------------------------------- ! !USES use ESMF + use clm_varctl , only : iulog implicit none include 'mpif.h' @@ -26,7 +27,12 @@ module cpl_mod integer :: i, myid integer status(MPI_STATUS_SIZE) - + character(len=128) :: fldname + integer, parameter :: begc = 1 !-- internal debug level + integer, parameter :: endc = 3312/4/2/2 !-- internal debug level + character(*),parameter :: F01 = "('[cpl_mod] ',a,i5,2x,i5,2x,d21.14)" + character(*),parameter :: F02 = "('[cpl_mod]',a,i5,2x,d26.19)" + integer, parameter :: debug = 1 !-- internaldebug level !====================================================================== contains !====================================================================== @@ -111,7 +117,8 @@ subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) end if - call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) + call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) + !call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) end subroutine cpl_atm2lnd_init @@ -136,7 +143,8 @@ subroutine cpl_lnd2atm_init(cplcomp, importState, exportState, clock, rc) call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + !call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) end subroutine cpl_lnd2atm_init @@ -155,6 +163,8 @@ subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_run] ' + real, pointer :: fldptr1d(:) + rc = ESMF_SUCCESS print *, "Running cpl_atm2lnd_run" call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) @@ -168,7 +178,11 @@ subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//" got c2l fieldbundle!", ESMF_LOGMSG_INFO) - call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) + !fldname = 'Sa_topo' + !call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + + !call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) + call ESMF_FieldBundleRedist(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//" regridding fieldbundles from atmos to land!", ESMF_LOGMSG_INFO) @@ -195,7 +209,8 @@ subroutine cpl_lnd2atm_run(cplcomp, importState, exportState, clock, rc) call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + call ESMF_FieldBundleRedist(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + !call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//" regridding fieldbundles from land to atmos!", ESMF_LOGMSG_INFO) @@ -249,8 +264,96 @@ subroutine cpl_lnd2atm_final(cplcomp, importState, exportState, clock, rc) end subroutine cpl_lnd2atm_final - - + !=============================================================================== + + subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) + + ! ---------------------------------------------- + ! Get pointer to a state field + ! ---------------------------------------------- + + use ESMF , only : ESMF_State, ESMF_Field, ESMF_Mesh, ESMF_FieldStatus_Flag + use ESMF , only : ESMF_FieldBundle + use ESMF , only : ESMF_StateGet, ESMF_FieldGet, ESMF_MeshGet + use ESMF , only : ESMF_FIELDSTATUS_COMPLETE, ESMF_FAILURE + use ESMF , only : ESMF_FieldBundleGet + + ! input/output variables + type(ESMF_State), intent(in) :: State + character(len=*), intent(in) :: fldname + real , pointer, optional , intent(out) :: fldptr1d(:) + real , pointer, optional , intent(out) :: fldptr2d(:,:) + integer, intent(out) :: rc + + ! local variables + type(ESMF_FieldStatus_Flag) :: status + type(ESMF_Field) :: lfield + type(ESMF_Mesh) :: lmesh + integer :: nnodes, nelements + character(len=*), parameter :: subname='(lnd_import_export:state_getfldptr)' + + type(ESMF_StateItem_Flag) :: itemFlag + type(ESMF_FieldBundle) :: fieldBundle + logical :: isPresent + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + ! Determine if this field bundle exist.... + ! TODO: combine the error checks.... + + + call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) + !call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + ! Get the fieldbundle from state... + call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + + call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) + !call ESMF_FieldBundleGet(fieldBundle,trim(fldname), lfield, isPresent, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_FieldGet(lfield, status=status, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + if (status /= ESMF_FIELDSTATUS_COMPLETE) then + call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + rc = ESMF_FAILURE + return + else + call ESMF_FieldGet(lfield, mesh=lmesh, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_MeshGet(lmesh, numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + if (nnodes == 0 .and. nelements == 0) then + call ESMF_LogWrite(trim(subname)//": no local nodes or elements ", ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + + if (present(fldptr1d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if ( debug > 0) then + write(iulog,F01)' in '//trim(subname)//'fldptr1d for '//trim(fldname)//' is ' + end if + !print *, "FLDPTR1D is" + !print *, FLDPTR1d + else if (present(fldptr2d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + else + !call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") + end if + endif ! status + + + end subroutine state_getfldptr From 80a8959518cb78079b7ffcba008e09d0f24c3980 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 9 Oct 2019 11:49:12 -0600 Subject: [PATCH 0403/1973] makefile changes to make with debug options of ctsm debug mode.... --- lilac/lilac/Makefile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index 6c377917b7..77ebef6d87 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -33,14 +33,22 @@ include $(ESMFMKFILE) #================================================================================ # Temporarily hard-coded # TODO: Please fix this part. -CTSM_BLD_DIR = /glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf +CASE_NAME = why01-g +#CASE_NAME = ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_testing +#CASE_NAME = ctsm1.0.dev066_MCT_I2000Clm50Sp_03 +#CASE_NAME = lilac_ctsm +CTSM_BLD_DIR = /glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf CTSM_INC = -I$(CTSM_BLD_DIR)/include CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm -TRACEBACK_FLAGS = -g -traceback -debug all -check all +#TRACEBACK_FLAGS = -g -traceback -debug all -check all -O2 -r8 +#TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O2 -debug minimal -DLINUX -DCESMCOUPLED -DFORTRANUNDERSCORE -DCPRINTEL -DNDEBUG -DUSE_ESMF_LIB -DMCT_INTERFACE -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=8 -DESMF_VERSION_MINOR=0 -DATM_PRESENT -DICE_PRESENT -DLND_PRESENT -DOCN_PRESENT -DROF_PRESENT -DGLC_PRESENT -DWAV_PRESENT -DESP_PRESENT -free -DUSE_CONTIGUOUS=contiguous +#TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DCESMCOUPLED -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DUSE_ESMF_LIB -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -DATM_PRESENT -DICE_PRESENT -DLND_PRESENT -DOCN_PRESENT -DROF_PRESENT -DGLC_PRESENT -DWAV_PRESENT -DESP_PRESENT -free -DUSE_CONTIGUOUS=contiguous +TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DCESMCOUPLED -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DUSE_ESMF_LIB -DMCT_INTERFACE -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -DATM_PRESENT -DICE_PRESENT -DLND_PRESENT -DOCN_PRESENT -DROF_PRESENT -DGLC_PRESENT -DWAV_PRESENT -DESP_PRESENT -free -DUSE_CONTIGUOUS=contiguous + # ----------------------------------------------------------------------------- -#EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/pio/pio2 -EXTRA_LIBS = -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib -MORE_LIBS = -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -L/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nuopc/nuopc/esmf/c1a1l1/csm_share/ -I/glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/clm/obj/ -I//glade/scratch/negins/lilac_ctsm/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/csm_share/ +#EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/nuopc/pio/pio2 +EXTRA_LIBS = -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib +MORE_LIBS = -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ # ----------------------------------------------------------------------------- @@ -83,7 +91,7 @@ atmos_cap.o: lilac_utils.o .PHONY: clean berzerk remake clean: - rm -f *.exe + rm -f *.exe *.o berzerk: rm -f PET*.ESMF_LogFile job_name* *.o *.mod *.exe remake: From 1afe65a4d797c698301a682d8edd7d29cdc2e083 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 9 Oct 2019 11:51:02 -0600 Subject: [PATCH 0404/1973] clean up and changint the values of both swvdr and swndf to 20.0... --- lilac/lilac/demo_driver.F90 | 73 ++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 26 deletions(-) diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index a0af468dda..221b1c5f3a 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -22,8 +22,9 @@ program demo_lilac_driver ! modules use ESMF use lilac_mod - use lilac_utils, only : atm2lnd_data1d_type , lnd2atm_data1d_type, atm2lnd_data2d_type, atm2lnd_data2d_type , this_clock - + use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type, atm2lnd_data2d_type, atm2lnd_data2d_type , this_clock + use clm_varctl , only : iulog + use spmdMod , only : masterproc implicit none ! TO DO: change the name and the derived data types @@ -44,17 +45,24 @@ program demo_lilac_driver integer :: end_time !-- end_time end time integer :: curr_time !-- cur_time current time integer :: itime_step !-- itime_step counter of time steps + integer :: g,i,k !-- indices + integer, parameter :: debug = 1 !-- internal debug level + + character(len=128) :: fldname + character(*),parameter :: F01 = "(a,i4,d26.19)" + character(*),parameter :: F02 = "('[demo_driver]',a,i5,2x,d26.19)" !------------------------------------------------------------------------ ! real atmosphere: begc = 1 - endc = 6912/4 + !endc = 6912/4/2 + endc = 3312/4/2/2 !endc = 13824 !endc = 13968 start_time = 1 - end_time = 50 + end_time = 5 itime_step = 1 seed_val = 0 @@ -70,27 +78,40 @@ program demo_lilac_driver allocate ( rand2 (begc:endc) ) ; call random_number (rand2) !allocating these values from atmosphere for now! - allocate ( atm2lnd%Sa_z (begc:endc) ) ; atm2lnd%Sa_z (:) = 30.0 - allocate ( atm2lnd%Sa_topo (begc:endc) ) ; atm2lnd%Sa_topo (:) = 10.0 - allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 20.0 - allocate ( atm2lnd%Sa_v (begc:endc) ) ; atm2lnd%Sa_v (:) = 40.0 - allocate ( atm2lnd%Sa_ptem (begc:endc) ) ; atm2lnd%Sa_ptem (:) = 280.0 - allocate ( atm2lnd%Sa_pbot (begc:endc) ) ; atm2lnd%Sa_pbot (:) = 100100.0 - allocate ( atm2lnd%Sa_tbot (begc:endc) ) ; atm2lnd%Sa_tbot (:) = 280.0 - allocate ( atm2lnd%Sa_shum (begc:endc) ) ; atm2lnd%Sa_shum (:) = 0.0004 - allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) ; atm2lnd%Faxa_lwdn (:) = 200.0 - allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 4.0e-8 - allocate ( atm2lnd%Faxa_rainl (begc:endc) ) ; atm2lnd%Faxa_rainl (:) = 3.0e-8 - allocate ( atm2lnd%Faxa_snowc (begc:endc) ) ; atm2lnd%Faxa_snowc (:) = 1.0e-8 - allocate ( atm2lnd%Faxa_snowl (begc:endc) ) ; atm2lnd%Faxa_snowl (:) = 2.0e-8 - allocate ( atm2lnd%Faxa_swndr (begc:endc) ) ; atm2lnd%Faxa_swndr (:) = 100.0 - allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 90.0 - allocate ( atm2lnd%Faxa_swndf (begc:endc) ) ; atm2lnd%Faxa_swndf (:) = 20.0 - allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) ; atm2lnd%Faxa_swvdf (:) = 40.0 + allocate ( atm2lnd%Sa_z (begc:endc) ) ; atm2lnd%Sa_z (:) = 30.0d0 + allocate ( atm2lnd%Sa_topo (begc:endc) ) ; atm2lnd%Sa_topo (:) = 10.0d0 + allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 20.0d0 + allocate ( atm2lnd%Sa_v (begc:endc) ) ; atm2lnd%Sa_v (:) = 40.0d0 + allocate ( atm2lnd%Sa_ptem (begc:endc) ) ; atm2lnd%Sa_ptem (:) = 280.0d0 + allocate ( atm2lnd%Sa_pbot (begc:endc) ) ; atm2lnd%Sa_pbot (:) = 100100.0d0 + allocate ( atm2lnd%Sa_tbot (begc:endc) ) ; atm2lnd%Sa_tbot (:) = 280.0d0 + allocate ( atm2lnd%Sa_shum (begc:endc) ) ; atm2lnd%Sa_shum (:) = 0.0004d0 + allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) ; atm2lnd%Faxa_lwdn (:) = 200.0d0 + !allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 4.0d-8 + allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 0.0d0 + allocate ( atm2lnd%Faxa_rainl (begc:endc) ) ; atm2lnd%Faxa_rainl (:) = 3.0d-8 + allocate ( atm2lnd%Faxa_snowc (begc:endc) ) ; atm2lnd%Faxa_snowc (:) = 1.0d-8 + allocate ( atm2lnd%Faxa_snowl (begc:endc) ) ; atm2lnd%Faxa_snowl (:) = 2.0d-8 + allocate ( atm2lnd%Faxa_swndr (begc:endc) ) ; atm2lnd%Faxa_swndr (:) = 100.0d0 + allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 20.0d0 + allocate ( atm2lnd%Faxa_swndf (begc:endc) ) ; atm2lnd%Faxa_swndf (:) = 20.0d0 + allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) ; atm2lnd%Faxa_swvdf (:) = 40.0d0 + + + fldname = 'Sa_topo' + if (debug > 0) then + do i=begc, endc + write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, atm2lnd%Sa_topo(i) + !write (iulog,F01)'i = ',i, atm2lnd%Sa_topo(i) + enddo + end if + !allocate ( atm2lnd%Faxa_bcph (begc:endc) ) ; atm2lnd%Faxa_bcph (:) = 0.0d0 !endc = 18048 ? should this be the size of the land or atmosphere??? + !print *, atm2lnd%Sa_topo(1:100) + allocate ( lnd2atm%Sl_lfrin (begc:endc) ) ; lnd2atm%Sl_lfrin (:) = 0 allocate ( lnd2atm%Sl_t (begc:endc) ) ; lnd2atm%Sl_t (:) = 0 @@ -111,12 +132,12 @@ program demo_lilac_driver do curr_time = start_time, end_time if (curr_time == start_time) then - ! Initalization phase - print *, "--------------------------" - print *, " LILAC Initalization phase" - print *, "--------------------------" - + !if (masterproc) then + print *, "--------------------------" + print *, " LILAC Initalization phase" + print *, "--------------------------" + !end if call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm ) else if (curr_time == end_time ) then ! Finalization phase From 1fb0ab73e83c7675a46b40eec3185beeacff5602 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 9 Oct 2019 12:46:49 -0600 Subject: [PATCH 0405/1973] adding the correct lilac cap file to this branch.... this is working for the first time step except for 3 fields. --- src/cpl/lilac/lnd_comp_esmf.F90 | 87 ++++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 48f17e9525..10a5c2513e 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -141,6 +141,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) use mpi, only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE use shr_pio_mod, only : shr_pio_init1, shr_pio_init2 use glc_elevclass_mod , only : glc_elevclass_init + use shr_orb_mod , only : shr_orb_params ! input/output variables type(ESMF_GridComp) :: comp ! CLM gridded component type(ESMF_State) :: import_state ! CLM import state @@ -235,6 +236,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) integer :: nlnd, nocn ! local size ofarrays !integer :: g,n ! indices integer :: n ! indices + integer :: year, month, day integer :: dtime ! time step increment (sec) @@ -346,9 +348,26 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !call shr_cal_date2ymd(ymd,year,month,day) !orb_cyear = orb_iyear + (year - orb_iyear_align) - ! call shr_orb_params(& - ! orb_cyear=2000, orb_eccen=orb_eccen, orb_obliq=orb_obliq, orb_mvelp=orb_mvelpp, & - ! orb_obliqr=obliqr, orb_lambm0=orb_lambm0, orb_mvelpp=orb_mvelpp, masterproc) + orb_cyear = 2000 + call shr_orb_params(orb_cyear, eccen, obliqr, mvelpp, & + obliqr, lambm0, mvelpp, masterproc) + + ! for now hard-coding: + !nextsw_cday = 1.02083333333333 + !eccen = 1.670366039276560E-002 + !mvelpp = 4.93745779048816 + !lambm0 = -3.247249566152933E-0020 + !obliqr = 0.409101122579779 + + !if ((debug >1) .and. (masterproc)) then + if (masterproc) then + write(iulog,*) 'shr_obs_params is setting these:', eccen + write(iulog,*) 'eccen is : ', eccen + write(iulog,*) 'mvelpp is : ', mvelpp + + write(iulog,*) 'lambm0 is : ', lambm0 + write(iulog,*) 'obliqr is : ', obliqr + end if !---------------------- ! Consistency check on namelist filename @@ -537,11 +556,10 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) !12 call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) !13 call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) !14 - call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) !15 - call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) !16 + call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) !15 + call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) !16 call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) !17 call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/), rc=rc) - !call ESMF_StateAdd(importState, fieldbundleList = (/c2l_fb/), rc=rc) ! Create export state @@ -604,10 +622,12 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Set nextsw_cday - call ESMF_LogWrite(subname//"Setting nextsw cday......", ESMF_LOGMSG_INFO) - !call ESMF_LogWrite(subname//nextsw_cday, ESMF_LOGMSG_INFO) call set_nextsw_cday( nextsw_cday ) + if (masterproc) then + write(iulog,*) 'TimeGet ... nextsw_cday is : ', nextsw_cday + end if + ! Set Attributes call ESMF_LogWrite(subname//"setting attribute!", ESMF_LOGMSG_INFO) @@ -619,9 +639,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) call ESMF_LogWrite(subname//"setting attribute-lnd_ny!", ESMF_LOGMSG_INFO) - - - call ESMF_LogWrite(subname//"State_SetScalar....!", ESMF_LOGMSG_INFO) !Set scalars in export state !call State_SetScalar(dble(ldomain%ni), flds_scalar_index_nx, export_state, & @@ -663,6 +680,8 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_AttributeSet(comp, "Name", "TBD", convention=convCIM, purpose=purpComp, rc=rc) call ESMF_AttributeSet(comp, "EmailAddress", TBD, convention=convCIM, purpose=purpComp, rc=rc) call ESMF_AttributeSet(comp, "ResponsiblePartyRole", "contact", convention=convCIM, purpose=purpComp, rc=rc) + ! adding this nextsw_cday + call ESMF_AttributeSet(comp, "nextsw_cday", nextsw_cday, convention=convCIM, purpose=purpComp, rc=rc) #endif @@ -754,6 +773,8 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) character(len=32) :: rdate ! date char string for restart file names integer :: shrlogunit ! original log unit character(len=*),parameter :: subname=trim(modName)//':[lnd_run] ' + + character(*),parameter :: F02 = "('[lnd_comp_esmf] ',d26.19)" !------------------------------------------------------------------------------- @@ -776,11 +797,22 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! Determine time of next atmospheric shortwave calculation !-------------------------------- + !call ESMF_AttributeGet(export_state, name="nextsw_cday", value=nextsw_cday, rc=rc) !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) !call set_nextsw_cday( nextsw_cday ) + call State_GetScalar(import_state, & + flds_scalar_index_nextsw_cday, nextsw_cday, & + flds_scalar_name, flds_scalar_num, rc) + call set_nextsw_cday( nextsw_cday ) + + + if (masterproc) then + write(iulog,*) 'State_GetScalar ... nextsw_cday is : ', nextsw_cday + end if + ! in nuopc it is like this...... !call State_GetScalar(import_state, & ! flds_scalar_index_nextsw_cday, nextsw_cday, & @@ -848,6 +880,13 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) caldayp1 = get_curr_calday(offset=dtime) + nextsw_cday = caldayp1 + if (masterproc) then + write(iulog,*) 'dtime : ', dtime + write(iulog,*) 'caldayp1 : ', caldayp1 + write(iulog,*) 'nextsw_cday : ', nextsw_cday + end if + !nextsw_cday = 1.02083333333333 if (nstep == 0) then doalb = .false. else if (nstep == 1) then @@ -855,6 +894,10 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) else doalb = (nextsw_cday >= -0.5_r8) end if + + if (masterproc) then + write(iulog,*) 'doalb is: ', doalb + end if call update_rad_dtime(doalb) !-------------------------------- @@ -897,8 +940,26 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) call t_startf ('shr_orb_decl') calday = get_curr_calday() + + if (masterproc) then + write(iulog, *)'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + write(iulog, *)'call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf )' + write(iulog, *)'call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf )' + write(iulog,*) 'calday is : ', calday + write(iulog,*) 'previous nextsw_cday is : ', nextsw_cday + end if + + !nextsw_cday = 1.02083333333333 + call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) + + if (masterproc) then + write(iulog,*) 'hardwired nextsw_cday is : ', nextsw_cday + write(iulog,*) 'declin is : ', declin + write(iulog,*) 'declinp1 is : ', declinp1 + end if + call t_stopf ('shr_orb_decl') call t_startf ('ctsm_run') @@ -922,8 +983,8 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) call t_startf ('lc_lnd_export') - !call export_fields(exportState, bounds, glc_present, rof_prognostic, & - ! water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) + call export_fields(gcomp, bounds, glc_present, rof_prognostic, & + water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) !call export_fields(exportState, bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, rc) !if (ChkErr(rc,__LINE__,u_FILE_u)) return From 3c5b395d445efebac0cc6a19410d635f3bd97231 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 11 Oct 2019 11:43:26 -0600 Subject: [PATCH 0406/1973] adding some debuging print statements.... --- src/cpl/lilac/lnd_comp_esmf.F90 | 62 ++++++++++++++++++----------- src/cpl/lilac/lnd_import_export.F90 | 6 ++- 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 10a5c2513e..ac980e4b4b 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -774,7 +774,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) integer :: shrlogunit ! original log unit character(len=*),parameter :: subname=trim(modName)//':[lnd_run] ' - character(*),parameter :: F02 = "('[lnd_comp_esmf] ',d26.19)" + character(*),parameter :: F02 = "('[lnd_comp_esmf] ',a, d26.19)" !------------------------------------------------------------------------------- @@ -878,26 +878,39 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! Determine doalb based on nextsw_cday sent from atm model !-------------------------------- + calday = get_curr_calday() caldayp1 = get_curr_calday(offset=dtime) - nextsw_cday = caldayp1 - if (masterproc) then - write(iulog,*) 'dtime : ', dtime - write(iulog,*) 'caldayp1 : ', caldayp1 - write(iulog,*) 'nextsw_cday : ', nextsw_cday - end if - !nextsw_cday = 1.02083333333333 + !TODO(NS): nextsw_cday should come directly from atmosphere! What + !should we do + ! For now I am setting nextsw_cday to be the same caldayp1 + + + nextsw_cday = calday if (nstep == 0) then - doalb = .false. + doalb = .false. + nextsw_cday = caldayp1 else if (nstep == 1) then - doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) - else + !doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) + doalb = .false. + else doalb = (nextsw_cday >= -0.5_r8) end if if (masterproc) then write(iulog,*) 'doalb is: ', doalb end if + + if (masterproc) then + write(iulog,*) '------------ LILAC ----------------' + write(iulog,*) 'nstep : ', nstep + write(iulog,*) 'dtime : ', dtime + write(iulog,*) 'calday : ', calday + write(iulog,*) 'caldayp1 : ', caldayp1 + write(iulog,*) 'nextsw_cday : ', nextsw_cday + write(iulog,*) '-------------------------------------' + end if + call update_rad_dtime(doalb) !-------------------------------- @@ -941,23 +954,26 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) call t_startf ('shr_orb_decl') calday = get_curr_calday() - if (masterproc) then - write(iulog, *)'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' - write(iulog, *)'call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf )' - write(iulog, *)'call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf )' - write(iulog,*) 'calday is : ', calday - write(iulog,*) 'previous nextsw_cday is : ', nextsw_cday - end if - - !nextsw_cday = 1.02083333333333 call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) + if (masterproc) then - write(iulog,*) 'hardwired nextsw_cday is : ', nextsw_cday - write(iulog,*) 'declin is : ', declin - write(iulog,*) 'declinp1 is : ', declinp1 + write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + write(iulog,*) 'call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, decl' + write(iulog,*) 'call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, decl' + write(iulog,F02) 'calday is : ', calday + write(iulog,F02) 'eccen is : ', eccen + write(iulog,F02) 'mvelpp is : ', mvelpp + write(iulog,F02) 'lambm0 is : ', lambm0 + write(iulog,F02) 'obliqr is : ', obliqr + write(iulog,F02) 'clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic)' + write(iulog,* ) 'doalb : ', doalb + write(iulog,F02) 'declin is : ', declin + write(iulog,F02) 'declinp1 is : ', declinp1 + write(iulog,F02) 'rof_prognostic : ', rof_prognostic + write(iulog,* ) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' end if call t_stopf ('shr_orb_decl') diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 1514cd6aac..e1b9435b23 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -73,6 +73,7 @@ module lnd_import_export integer, parameter :: debug = 1 ! internal debug level character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" + character(*),parameter :: F02 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d26.19)" character(*),parameter :: u_FILE_u = & __FILE__ character(*),parameter :: modname = "[lnd_import_export]: " @@ -729,6 +730,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) + if (forc_t > SHR_CONST_TKFRZ) then e = esatw(tdc(forc_t)) else @@ -1282,7 +1284,7 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) n = g - bounds%begg + 1 output(g) = fldptr1d(n) if (masterproc .and. debug > 0 .and. get_nstep() < 5) then - write(iulog,F01)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) + write(iulog,F02)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) end if end do end if @@ -1291,7 +1293,7 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) if (masterproc .and. debug > 0 .and. get_nstep() < 5) then do g = bounds%begg,bounds%endg i = 1 + g - bounds%begg - write(iulog,F01)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) + write(iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) end do end if From 44638c7501262bb7afc6440e02741e2d3ec93412 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 11 Oct 2019 11:44:48 -0600 Subject: [PATCH 0407/1973] deleting the extra files of MCT --- src/cpl/clm_cpl_indices.F90 | 330 ---------------- src/cpl/lnd_comp_mct.F90 | 688 ---------------------------------- src/cpl/lnd_import_export.F90 | 431 --------------------- 3 files changed, 1449 deletions(-) delete mode 100644 src/cpl/clm_cpl_indices.F90 delete mode 100644 src/cpl/lnd_comp_mct.F90 delete mode 100644 src/cpl/lnd_import_export.F90 diff --git a/src/cpl/clm_cpl_indices.F90 b/src/cpl/clm_cpl_indices.F90 deleted file mode 100644 index 525b709cc6..0000000000 --- a/src/cpl/clm_cpl_indices.F90 +++ /dev/null @@ -1,330 +0,0 @@ -module clm_cpl_indices - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing the indices for the fields passed between CLM and - ! the driver. Includes the River Transport Model fields (RTM) and the - ! fields needed by the land-ice component (sno). - ! - ! !USES: - - use shr_sys_mod, only : shr_sys_abort - implicit none - - SAVE - private ! By default make data private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: clm_cpl_indices_set ! Set the coupler indices - ! - ! !PUBLIC DATA MEMBERS: - ! - integer , public :: glc_nec ! number of elevation classes for glacier_mec landunits - ! (from coupler) - must equal maxpatch_glcmec from namelist - - ! lnd -> drv (required) - - integer, public ::index_l2x_Flrl_rofsur ! lnd->rtm input liquid surface fluxes - integer, public ::index_l2x_Flrl_rofgwl ! lnd->rtm input liquid gwl fluxes - integer, public ::index_l2x_Flrl_rofsub ! lnd->rtm input liquid subsurface fluxes - integer, public ::index_l2x_Flrl_rofi ! lnd->rtm input frozen fluxes - integer, public ::index_l2x_Flrl_irrig ! irrigation withdrawal - - integer, public ::index_l2x_Sl_t ! temperature - integer, public ::index_l2x_Sl_tref ! 2m reference temperature - integer, public ::index_l2x_Sl_qref ! 2m reference specific humidity - integer, public ::index_l2x_Sl_avsdr ! albedo: direct , visible - integer, public ::index_l2x_Sl_anidr ! albedo: direct , near-ir - integer, public ::index_l2x_Sl_avsdf ! albedo: diffuse, visible - integer, public ::index_l2x_Sl_anidf ! albedo: diffuse, near-ir - integer, public ::index_l2x_Sl_snowh ! snow height - integer, public ::index_l2x_Sl_u10 ! 10m wind - integer, public ::index_l2x_Sl_ddvel ! dry deposition velocities (optional) - integer, public ::index_l2x_Sl_fv ! friction velocity - integer, public ::index_l2x_Sl_ram1 ! aerodynamical resistance - integer, public ::index_l2x_Sl_soilw ! volumetric soil water - integer, public ::index_l2x_Fall_taux ! wind stress, zonal - integer, public ::index_l2x_Fall_tauy ! wind stress, meridional - integer, public ::index_l2x_Fall_lat ! latent heat flux - integer, public ::index_l2x_Fall_sen ! sensible heat flux - integer, public ::index_l2x_Fall_lwup ! upward longwave heat flux - integer, public ::index_l2x_Fall_evap ! evaporation water flux - integer, public ::index_l2x_Fall_swnet ! heat flux shortwave net - integer, public ::index_l2x_Fall_fco2_lnd ! co2 flux **For testing set to 0 - integer, public ::index_l2x_Fall_flxdst1 ! dust flux size bin 1 - integer, public ::index_l2x_Fall_flxdst2 ! dust flux size bin 2 - integer, public ::index_l2x_Fall_flxdst3 ! dust flux size bin 3 - integer, public ::index_l2x_Fall_flxdst4 ! dust flux size bin 4 - integer, public ::index_l2x_Fall_flxvoc ! MEGAN fluxes - integer, public ::index_l2x_Fall_flxfire ! Fire fluxes - integer, public ::index_l2x_Sl_ztopfire ! Top of fire emissions (m) - - ! In the following, index 0 is bare land, other indices are glc elevation classes - integer, allocatable, public ::index_l2x_Sl_tsrf(:) ! glc MEC temperature - integer, allocatable, public ::index_l2x_Sl_topo(:) ! glc MEC topo height - integer, allocatable, public ::index_l2x_Flgl_qice(:) ! glc MEC ice flux - - integer, public ::index_x2l_Sa_methane - integer, public ::index_l2x_Fall_methane - - integer, public :: nflds_l2x = 0 - - ! drv -> lnd (required) - - integer, public ::index_x2l_Sa_z ! bottom atm level height - integer, public ::index_x2l_Sa_topo ! atm surface height (m) - integer, public ::index_x2l_Sa_u ! bottom atm level zon wind - integer, public ::index_x2l_Sa_v ! bottom atm level mer wind - integer, public ::index_x2l_Sa_ptem ! bottom atm level pot temp - integer, public ::index_x2l_Sa_shum ! bottom atm level spec hum - integer, public ::index_x2l_Sa_pbot ! bottom atm level pressure - integer, public ::index_x2l_Sa_tbot ! bottom atm level temp - integer, public ::index_x2l_Faxa_lwdn ! downward lw heat flux - integer, public ::index_x2l_Faxa_rainc ! prec: liquid "convective" - integer, public ::index_x2l_Faxa_rainl ! prec: liquid "large scale" - integer, public ::index_x2l_Faxa_snowc ! prec: frozen "convective" - integer, public ::index_x2l_Faxa_snowl ! prec: frozen "large scale" - integer, public ::index_x2l_Faxa_swndr ! sw: nir direct downward - integer, public ::index_x2l_Faxa_swvdr ! sw: vis direct downward - integer, public ::index_x2l_Faxa_swndf ! sw: nir diffuse downward - integer, public ::index_x2l_Faxa_swvdf ! sw: vis diffuse downward - integer, public ::index_x2l_Sa_co2prog ! bottom atm level prognostic co2 - integer, public ::index_x2l_Sa_co2diag ! bottom atm level diagnostic co2 - integer, public ::index_x2l_Faxa_bcphidry ! flux: Black Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_bcphodry ! flux: Black Carbon hydrophobic dry deposition - integer, public ::index_x2l_Faxa_bcphiwet ! flux: Black Carbon hydrophilic wet deposition - integer, public ::index_x2l_Faxa_ocphidry ! flux: Organic Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_ocphodry ! flux: Organic Carbon hydrophobic dry deposition - integer, public ::index_x2l_Faxa_ocphiwet ! flux: Organic Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_dstwet1 ! flux: Size 1 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet2 ! flux: Size 2 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet3 ! flux: Size 3 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet4 ! flux: Size 4 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstdry1 ! flux: Size 1 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry2 ! flux: Size 2 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry3 ! flux: Size 3 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry4 ! flux: Size 4 dust -- dry deposition - - integer, public ::index_x2l_Faxa_nhx ! flux nhx from atm - integer, public ::index_x2l_Faxa_noy ! flux noy from atm - - integer, public ::index_x2l_Flrr_flood ! rtm->lnd rof flood flux - integer, public ::index_x2l_Flrr_volr ! rtm->lnd rof volr total volume - integer, public ::index_x2l_Flrr_volrmch ! rtm->lnd rof volr main channel volume - - ! In the following, index 0 is bare land, other indices are glc elevation classes - integer, allocatable, public ::index_x2l_Sg_ice_covered(:) ! Fraction of glacier from glc model - integer, allocatable, public ::index_x2l_Sg_topo(:) ! Topo height from glc model - integer, allocatable, public ::index_x2l_Flgg_hflx(:) ! Heat flux from glc model - - integer, public ::index_x2l_Sg_icemask - integer, public ::index_x2l_Sg_icemask_coupled_fluxes - - integer, public :: nflds_x2l = 0 - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine clm_cpl_indices_set( ) - ! - ! !DESCRIPTION: - ! Set the coupler indices needed by the land model coupler - ! interface. - ! - ! !USES: - use seq_flds_mod , only: seq_flds_x2l_fields, seq_flds_l2x_fields - use mct_mod , only: mct_aVect, mct_aVect_init, mct_avect_indexra - use mct_mod , only: mct_aVect_clean, mct_avect_nRattr - use seq_drydep_mod , only: drydep_fields_token, lnd_drydep - use shr_megan_mod , only: shr_megan_fields_token, shr_megan_mechcomps_n - use shr_fire_emis_mod,only: shr_fire_emis_fields_token, shr_fire_emis_ztop_token, shr_fire_emis_mechcomps_n - use clm_varctl , only: ndep_from_cpl - use glc_elevclass_mod, only: glc_get_num_elevation_classes, glc_elevclass_as_string - ! - ! !ARGUMENTS: - implicit none - ! - ! !REVISION HISTORY: - ! Author: Mariana Vertenstein - ! 01/2011, Erik Kluzek: Added protex headers - ! - ! !LOCAL VARIABLES: - type(mct_aVect) :: l2x ! temporary, land to coupler - type(mct_aVect) :: x2l ! temporary, coupler to land - integer :: num - character(len=:), allocatable :: nec_str ! string version of glc elev. class number - character(len=64) :: name - character(len=32) :: subname = 'clm_cpl_indices_set' ! subroutine name - !----------------------------------------------------------------------- - - ! Determine attribute vector indices - - ! create temporary attribute vectors - call mct_aVect_init(x2l, rList=seq_flds_x2l_fields, lsize=1) - nflds_x2l = mct_avect_nRattr(x2l) - - call mct_aVect_init(l2x, rList=seq_flds_l2x_fields, lsize=1) - nflds_l2x = mct_avect_nRattr(l2x) - - !------------------------------------------------------------- - ! clm -> drv - !------------------------------------------------------------- - - index_l2x_Flrl_rofsur = mct_avect_indexra(l2x,'Flrl_rofsur') - index_l2x_Flrl_rofgwl = mct_avect_indexra(l2x,'Flrl_rofgwl') - index_l2x_Flrl_rofsub = mct_avect_indexra(l2x,'Flrl_rofsub') - index_l2x_Flrl_rofi = mct_avect_indexra(l2x,'Flrl_rofi') - index_l2x_Flrl_irrig = mct_avect_indexra(l2x,'Flrl_irrig') - - index_l2x_Sl_t = mct_avect_indexra(l2x,'Sl_t') - index_l2x_Sl_snowh = mct_avect_indexra(l2x,'Sl_snowh') - index_l2x_Sl_avsdr = mct_avect_indexra(l2x,'Sl_avsdr') - index_l2x_Sl_anidr = mct_avect_indexra(l2x,'Sl_anidr') - index_l2x_Sl_avsdf = mct_avect_indexra(l2x,'Sl_avsdf') - index_l2x_Sl_anidf = mct_avect_indexra(l2x,'Sl_anidf') - index_l2x_Sl_tref = mct_avect_indexra(l2x,'Sl_tref') - index_l2x_Sl_qref = mct_avect_indexra(l2x,'Sl_qref') - index_l2x_Sl_u10 = mct_avect_indexra(l2x,'Sl_u10') - index_l2x_Sl_ram1 = mct_avect_indexra(l2x,'Sl_ram1') - index_l2x_Sl_fv = mct_avect_indexra(l2x,'Sl_fv') - index_l2x_Sl_soilw = mct_avect_indexra(l2x,'Sl_soilw',perrwith='quiet') - - if ( lnd_drydep )then - index_l2x_Sl_ddvel = mct_avect_indexra(l2x, trim(drydep_fields_token)) - else - index_l2x_Sl_ddvel = 0 - end if - - index_l2x_Fall_taux = mct_avect_indexra(l2x,'Fall_taux') - index_l2x_Fall_tauy = mct_avect_indexra(l2x,'Fall_tauy') - index_l2x_Fall_lat = mct_avect_indexra(l2x,'Fall_lat') - index_l2x_Fall_sen = mct_avect_indexra(l2x,'Fall_sen') - index_l2x_Fall_lwup = mct_avect_indexra(l2x,'Fall_lwup') - index_l2x_Fall_evap = mct_avect_indexra(l2x,'Fall_evap') - index_l2x_Fall_swnet = mct_avect_indexra(l2x,'Fall_swnet') - index_l2x_Fall_flxdst1 = mct_avect_indexra(l2x,'Fall_flxdst1') - index_l2x_Fall_flxdst2 = mct_avect_indexra(l2x,'Fall_flxdst2') - index_l2x_Fall_flxdst3 = mct_avect_indexra(l2x,'Fall_flxdst3') - index_l2x_Fall_flxdst4 = mct_avect_indexra(l2x,'Fall_flxdst4') - - index_l2x_Fall_fco2_lnd = mct_avect_indexra(l2x,'Fall_fco2_lnd',perrwith='quiet') - - index_l2x_Fall_methane = mct_avect_indexra(l2x,'Fall_methane',perrWith='quiet') - - ! MEGAN fluxes - if (shr_megan_mechcomps_n>0) then - index_l2x_Fall_flxvoc = mct_avect_indexra(l2x,trim(shr_megan_fields_token)) - else - index_l2x_Fall_flxvoc = 0 - endif - - ! Fire fluxes - if (shr_fire_emis_mechcomps_n>0) then - index_l2x_Fall_flxfire = mct_avect_indexra(l2x,trim(shr_fire_emis_fields_token)) - index_l2x_Sl_ztopfire = mct_avect_indexra(l2x,trim(shr_fire_emis_ztop_token)) - else - index_l2x_Fall_flxfire = 0 - index_l2x_Sl_ztopfire = 0 - endif - - !------------------------------------------------------------- - ! drv -> clm - !------------------------------------------------------------- - - index_x2l_Sa_z = mct_avect_indexra(x2l,'Sa_z') - index_x2l_Sa_topo = mct_avect_indexra(x2l,'Sa_topo') - index_x2l_Sa_u = mct_avect_indexra(x2l,'Sa_u') - index_x2l_Sa_v = mct_avect_indexra(x2l,'Sa_v') - index_x2l_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') - index_x2l_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') - index_x2l_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') - index_x2l_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') - index_x2l_Sa_co2prog = mct_avect_indexra(x2l,'Sa_co2prog',perrwith='quiet') - index_x2l_Sa_co2diag = mct_avect_indexra(x2l,'Sa_co2diag',perrwith='quiet') - - index_x2l_Sa_methane = mct_avect_indexra(x2l,'Sa_methane',perrWith='quiet') - - index_x2l_Flrr_volr = mct_avect_indexra(x2l,'Flrr_volr') - index_x2l_Flrr_volrmch = mct_avect_indexra(x2l,'Flrr_volrmch') - - index_x2l_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') - index_x2l_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') - index_x2l_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') - index_x2l_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') - index_x2l_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') - index_x2l_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') - index_x2l_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') - index_x2l_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') - index_x2l_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') - index_x2l_Faxa_bcphidry = mct_avect_indexra(x2l,'Faxa_bcphidry') - index_x2l_Faxa_bcphodry = mct_avect_indexra(x2l,'Faxa_bcphodry') - index_x2l_Faxa_bcphiwet = mct_avect_indexra(x2l,'Faxa_bcphiwet') - index_x2l_Faxa_ocphidry = mct_avect_indexra(x2l,'Faxa_ocphidry') - index_x2l_Faxa_ocphodry = mct_avect_indexra(x2l,'Faxa_ocphodry') - index_x2l_Faxa_ocphiwet = mct_avect_indexra(x2l,'Faxa_ocphiwet') - index_x2l_Faxa_dstdry1 = mct_avect_indexra(x2l,'Faxa_dstdry1') - index_x2l_Faxa_dstdry2 = mct_avect_indexra(x2l,'Faxa_dstdry2') - index_x2l_Faxa_dstdry3 = mct_avect_indexra(x2l,'Faxa_dstdry3') - index_x2l_Faxa_dstdry4 = mct_avect_indexra(x2l,'Faxa_dstdry4') - index_x2l_Faxa_dstwet1 = mct_avect_indexra(x2l,'Faxa_dstwet1') - index_x2l_Faxa_dstwet2 = mct_avect_indexra(x2l,'Faxa_dstwet2') - index_x2l_Faxa_dstwet3 = mct_avect_indexra(x2l,'Faxa_dstwet3') - index_x2l_Faxa_dstwet4 = mct_avect_indexra(x2l,'Faxa_dstwet4') - - index_x2l_Faxa_nhx = mct_avect_indexra(x2l,'Faxa_nhx', perrWith='quiet') - index_x2l_Faxa_noy = mct_avect_indexra(x2l,'Faxa_noy', perrWith='quiet') - - if (index_x2l_Faxa_nhx > 0 .and. index_x2l_Faxa_noy > 0) then - ndep_from_cpl = .true. - end if - - index_x2l_Flrr_flood = mct_avect_indexra(x2l,'Flrr_flood') - - !------------------------------------------------------------- - ! glc coupling - !------------------------------------------------------------- - - index_x2l_Sg_icemask = mct_avect_indexra(x2l,'Sg_icemask') - index_x2l_Sg_icemask_coupled_fluxes = mct_avect_indexra(x2l,'Sg_icemask_coupled_fluxes') - - glc_nec = glc_get_num_elevation_classes() - if (glc_nec < 1) then - call shr_sys_abort('ERROR: In CLM4.5 and later, glc_nec must be at least 1.') - end if - - ! Create coupling fields for all glc elevation classes (1:glc_nec) plus bare land - ! (index 0). - allocate(index_l2x_Sl_tsrf(0:glc_nec)) - allocate(index_l2x_Sl_topo(0:glc_nec)) - allocate(index_l2x_Flgl_qice(0:glc_nec)) - allocate(index_x2l_Sg_ice_covered(0:glc_nec)) - allocate(index_x2l_Sg_topo(0:glc_nec)) - allocate(index_x2l_Flgg_hflx(0:glc_nec)) - - do num = 0,glc_nec - nec_str = glc_elevclass_as_string(num) - - name = 'Sg_ice_covered' // nec_str - index_x2l_Sg_ice_covered(num) = mct_avect_indexra(x2l,trim(name)) - name = 'Sg_topo' // nec_str - index_x2l_Sg_topo(num) = mct_avect_indexra(x2l,trim(name)) - name = 'Flgg_hflx' // nec_str - index_x2l_Flgg_hflx(num) = mct_avect_indexra(x2l,trim(name)) - - name = 'Sl_tsrf' // nec_str - index_l2x_Sl_tsrf(num) = mct_avect_indexra(l2x,trim(name)) - name = 'Sl_topo' // nec_str - index_l2x_Sl_topo(num) = mct_avect_indexra(l2x,trim(name)) - name = 'Flgl_qice' // nec_str - index_l2x_Flgl_qice(num) = mct_avect_indexra(l2x,trim(name)) - end do - - call mct_aVect_clean(x2l) - call mct_aVect_clean(l2x) - - end subroutine clm_cpl_indices_set - -!======================================================================= - -end module clm_cpl_indices diff --git a/src/cpl/lnd_comp_mct.F90 b/src/cpl/lnd_comp_mct.F90 deleted file mode 100644 index 42e038ea48..0000000000 --- a/src/cpl/lnd_comp_mct.F90 +++ /dev/null @@ -1,688 +0,0 @@ -module lnd_comp_mct - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Interface of the active land model component of CESM the CLM (Community Land Model) - ! with the main CESM driver. This is a thin interface taking CESM driver information - ! in MCT (Model Coupling Toolkit) format and converting it to use by CLM. - ! - ! !uses: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use mct_mod , only : mct_avect, mct_gsmap, mct_gGrid - use decompmod , only : bounds_type, ldecomp - use lnd_import_export, only : lnd_import, lnd_export - ! - ! !public member functions: - implicit none - save - private ! by default make data private - ! - ! !public member functions: - public :: lnd_init_mct ! clm initialization - public :: lnd_run_mct ! clm run phase - public :: lnd_final_mct ! clm finalization/cleanup - ! - ! !private member functions: - private :: lnd_setgsmap_mct ! set the land model mct gs map - private :: lnd_domain_mct ! set the land model domain information - private :: lnd_handle_resume ! handle pause/resume signals from the coupler - !--------------------------------------------------------------------------- - -contains - - !==================================================================================== - - subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize land surface model and obtain relevant atmospheric model arrays - ! back from (i.e. albedos, surface temperature and snow cover over land). - ! - ! !USES: - use shr_kind_mod , only : shr_kind_cl - use abortutils , only : endrun - use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday - use clm_initializeMod, only : initialize1, initialize2 - use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst - use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog, noland - use clm_varctl , only : inst_index, inst_suffix, inst_name - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use controlMod , only : control_setNL - use decompMod , only : get_proc_bounds - use domainMod , only : ldomain - use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel - use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel - use shr_file_mod , only : shr_file_getUnit, shr_file_setIO - use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod , only : seq_timemgr_EClockGetData - use seq_infodata_mod , only : seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData, & - seq_infodata_start_type_start, seq_infodata_start_type_cont, & - seq_infodata_start_type_brnch - use seq_comm_mct , only : seq_comm_suffix, seq_comm_inst, seq_comm_name - use seq_flds_mod , only : seq_flds_x2l_fields, seq_flds_l2x_fields - use spmdMod , only : masterproc, spmd_init - use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch - use clm_cpl_indices , only : clm_cpl_indices_set - use mct_mod , only : mct_aVect_init, mct_aVect_zero, mct_gsMap_lsize - use ESMF - ! - ! !ARGUMENTS: - type(ESMF_Clock), intent(inout) :: EClock ! Input synchronization clock - type(seq_cdata), intent(inout) :: cdata_l ! Input land-model driver data - type(mct_aVect), intent(inout) :: x2l_l, l2x_l ! land model import and export states - character(len=*), optional, intent(in) :: NLFilename ! Namelist filename to read - ! - ! !LOCAL VARIABLES: - integer :: LNDID ! Land identifyer - integer :: mpicom_lnd ! MPI communicator - type(mct_gsMap), pointer :: GSMap_lnd ! Land model MCT GS map - type(mct_gGrid), pointer :: dom_l ! Land model domain - type(seq_infodata_type), pointer :: infodata ! CESM driver level info data - integer :: lsize ! size of attribute vector - integer :: g,i,j ! indices - integer :: dtime_sync ! coupling time-step from the input synchronization clock - integer :: dtime_clm ! clm time-step - logical :: exists ! true if file exists - logical :: atm_aero ! Flag if aerosol data sent from atm model - real(r8) :: scmlat ! single-column latitude - real(r8) :: scmlon ! single-column longitude - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - character(len=SHR_KIND_CL) :: caseid ! case identifier name - character(len=SHR_KIND_CL) :: ctitle ! case description title - character(len=SHR_KIND_CL) :: starttype ! start-type (startup, continue, branch, hybrid) - character(len=SHR_KIND_CL) :: calendar ! calendar type name - character(len=SHR_KIND_CL) :: hostname ! hostname of machine running on - character(len=SHR_KIND_CL) :: version ! Model version - character(len=SHR_KIND_CL) :: username ! user running the model - integer :: nsrest ! clm restart type - integer :: ref_ymd ! reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (sec) - integer :: start_ymd ! start date (YYYYMMDD) - integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type - integer :: lbnum ! input to memory diagnostic - integer :: shrlogunit,shrloglev ! old values for log unit and log level - type(bounds_type) :: bounds ! bounds - character(len=32), parameter :: sub = 'lnd_init_mct' - character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" - !----------------------------------------------------------------------- - - ! Set cdata data - - call seq_cdata_setptrs(cdata_l, ID=LNDID, mpicom=mpicom_lnd, & - gsMap=GSMap_lnd, dom=dom_l, infodata=infodata) - - ! Determine attriute vector indices - - call clm_cpl_indices_set() - - ! Initialize clm MPI communicator - - call spmd_init( mpicom_lnd, LNDID ) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_init_mct:start::',lbnum) - endif -#endif - - inst_name = seq_comm_name(LNDID) - inst_index = seq_comm_inst(LNDID) - inst_suffix = seq_comm_suffix(LNDID) - - ! Initialize io log unit - - call shr_file_getLogUnit (shrlogunit) - if (masterproc) then - inquire(file='lnd_modelio.nml'//trim(inst_suffix),exist=exists) - if (exists) then - iulog = shr_file_getUnit() - call shr_file_setIO('lnd_modelio.nml'//trim(inst_suffix),iulog) - end if - write(iulog,format) "CLM land model initialization" - else - iulog = shrlogunit - end if - - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (iulog) - - ! Use infodata to set orbital values - - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & - orb_lambm0=lambm0, orb_obliqr=obliqr ) - - ! Consistency check on namelist filename - - call control_setNL("lnd_in"//trim(inst_suffix)) - - ! Initialize clm - ! initialize1 reads namelist, grid and surface data (need this to initialize gsmap) - ! initialize2 performs rest of initialization - - call seq_timemgr_EClockGetData(EClock, & - start_ymd=start_ymd, & - start_tod=start_tod, ref_ymd=ref_ymd, & - ref_tod=ref_tod, stop_ymd=stop_ymd, & - stop_tod=stop_tod, & - calendar=calendar ) - call seq_infodata_GetData(infodata, case_name=caseid, & - case_desc=ctitle, single_column=single_column, & - scmlat=scmlat, scmlon=scmlon, & - brnch_retain_casename=brnch_retain_casename, & - start_type=starttype, model_version=version, & - hostname=hostname, username=username ) - call set_timemgr_init( calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & - stop_tod_in=stop_tod) - if ( trim(starttype) == trim(seq_infodata_start_type_start)) then - nsrest = nsrStartup - else if (trim(starttype) == trim(seq_infodata_start_type_cont) ) then - nsrest = nsrContinue - else if (trim(starttype) == trim(seq_infodata_start_type_brnch)) then - nsrest = nsrBranch - else - call endrun( sub//' ERROR: unknown starttype' ) - end if - - call clm_varctl_set(caseid_in=caseid, ctitle_in=ctitle, & - brnch_retain_casename_in=brnch_retain_casename, & - single_column_in=single_column, scmlat_in=scmlat, & - scmlon_in=scmlon, nsrest_in=nsrest, version_in=version, & - hostname_in=hostname, username_in=username) - - ! Read namelist, grid and surface data - - call initialize1( ) - - ! If no land then exit out of initialization - - if ( noland ) then - call seq_infodata_PutData( infodata, lnd_present =.false.) - call seq_infodata_PutData( infodata, lnd_prognostic=.false.) - return - end if - - ! Determine if aerosol and dust deposition come from atmosphere component - - call seq_infodata_GetData(infodata, atm_aero=atm_aero ) - if ( .not. atm_aero )then - call endrun( sub//' ERROR: atmosphere model MUST send aerosols to CLM' ) - end if - - ! Initialize clm gsMap, clm domain and clm attribute vectors - - call get_proc_bounds( bounds ) - - call lnd_SetgsMap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) - lsize = mct_gsMap_lsize(gsMap_lnd, mpicom_lnd) - - call lnd_domain_mct( bounds, lsize, gsMap_lnd, dom_l ) - - call mct_aVect_init(x2l_l, rList=seq_flds_x2l_fields, lsize=lsize) - call mct_aVect_zero(x2l_l) - - call mct_aVect_init(l2x_l, rList=seq_flds_l2x_fields, lsize=lsize) - call mct_aVect_zero(l2x_l) - - ! Finish initializing clm - - call initialize2() - - ! Check that clm internal dtime aligns with clm coupling interval - - call seq_timemgr_EClockGetData(EClock, dtime=dtime_sync ) - dtime_clm = get_step_size() - if (masterproc) then - write(iulog,*)'dtime_sync= ',dtime_sync,& - ' dtime_clm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) - end if - if (mod(dtime_sync,dtime_clm) /= 0) then - write(iulog,*)'clm dtime ',dtime_clm,' and Eclock dtime ',& - dtime_sync,' never align' - call endrun( sub//' ERROR: time out of sync' ) - end if - - ! Create land export state - - call lnd_export(bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) - - ! Fill in infodata settings - - call seq_infodata_PutData(infodata, lnd_prognostic=.true.) - call seq_infodata_PutData(infodata, lnd_nx=ldomain%ni, lnd_ny=ldomain%nj) - - ! Get infodata info - - call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) - call set_nextsw_cday(nextsw_cday) - call lnd_handle_resume( cdata_l ) - - ! Reset shr logging to original values - - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) - -#if (defined _MEMTRACE) - if(masterproc) then - write(iulog,*) TRIM(Sub) // ':end::' - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_int_mct:end::',lbnum) - call memmon_reset_addr() - endif -#endif - - end subroutine lnd_init_mct - - !==================================================================================== - - subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) - ! - ! !DESCRIPTION: - ! Run clm model - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_instMod , only : water_inst, lnd2atm_inst, atm2lnd_inst, lnd2glc_inst, glc2lnd_inst - use clm_driver , only : clm_drv - use clm_time_manager, only : get_curr_date, get_nstep, get_curr_calday, get_step_size - use clm_time_manager, only : advance_timestep, set_nextsw_cday,update_rad_dtime - use decompMod , only : get_proc_bounds - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel - use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel - use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod , only : seq_timemgr_EClockGetData, seq_timemgr_StopAlarmIsOn - use seq_timemgr_mod , only : seq_timemgr_RestartAlarmIsOn, seq_timemgr_EClockDateInSync - use seq_infodata_mod, only : seq_infodata_type, seq_infodata_GetData - use spmdMod , only : masterproc, mpicom - use perf_mod , only : t_startf, t_stopf, t_barrierf - use shr_orb_mod , only : shr_orb_decl - use ESMF - ! - ! !ARGUMENTS: - type(ESMF_Clock) , intent(inout) :: EClock ! Input synchronization clock from driver - type(seq_cdata) , intent(inout) :: cdata_l ! Input driver data for land model - type(mct_aVect) , intent(inout) :: x2l_l ! Import state to land model - type(mct_aVect) , intent(inout) :: l2x_l ! Export state from land model - ! - ! !LOCAL VARIABLES: - integer :: ymd_sync ! Sync date (YYYYMMDD) - integer :: yr_sync ! Sync current year - integer :: mon_sync ! Sync current month - integer :: day_sync ! Sync current day - integer :: tod_sync ! Sync current time of day (sec) - integer :: ymd ! CLM current date (YYYYMMDD) - integer :: yr ! CLM current year - integer :: mon ! CLM current month - integer :: day ! CLM current day - integer :: tod ! CLM current time of day (sec) - integer :: dtime ! time step increment (sec) - integer :: nstep ! time step index - logical :: rstwr_sync ! .true. ==> write restart file before returning - logical :: rstwr ! .true. ==> write restart file before returning - logical :: nlend_sync ! Flag signaling last time-step - logical :: nlend ! .true. ==> last time-step - logical :: dosend ! true => send data back to driver - logical :: doalb ! .true. ==> do albedo calculation on this time step - logical :: rof_prognostic ! .true. => running with a prognostic ROF model - logical :: glc_present ! .true. => running with a non-stub GLC model - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - real(r8) :: caldayp1 ! clm calday plus dtime offset - integer :: shrlogunit,shrloglev ! old values for share log unit and log level - integer :: lbnum ! input to memory diagnostic - integer :: g,i,lsize ! counters - real(r8) :: calday ! calendar day for nstep - real(r8) :: declin ! solar declination angle in radians for nstep - real(r8) :: declinp1 ! solar declination angle in radians for nstep+1 - real(r8) :: eccf ! earth orbit eccentricity factor - real(r8) :: recip ! reciprical - logical,save :: first_call = .true. ! first call work - type(seq_infodata_type),pointer :: infodata ! CESM information from the driver - type(mct_gGrid), pointer :: dom_l ! Land model domain data - type(bounds_type) :: bounds ! bounds - character(len=32) :: rdate ! date char string for restart file names - character(len=32), parameter :: sub = "lnd_run_mct" - !--------------------------------------------------------------------------- - - ! Determine processor bounds - - call get_proc_bounds(bounds) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_run_mct:start::',lbnum) - endif -#endif - - ! Reset shr logging to my log file - call shr_file_getLogUnit (shrlogunit) - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (iulog) - - ! Determine time of next atmospheric shortwave calculation - call seq_cdata_setptrs(cdata_l, infodata=infodata, dom=dom_l) - call seq_timemgr_EClockGetData(EClock, & - curr_ymd=ymd, curr_tod=tod_sync, & - curr_yr=yr_sync, curr_mon=mon_sync, curr_day=day_sync) - call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) - - call set_nextsw_cday( nextsw_cday ) - dtime = get_step_size() - - ! Handle pause/resume signals from coupler - call lnd_handle_resume( cdata_l ) - - write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync,mon_sync,day_sync,tod_sync - nlend_sync = seq_timemgr_StopAlarmIsOn( EClock ) - rstwr_sync = seq_timemgr_RestartAlarmIsOn( EClock ) - - ! Determine if we're running with a prognostic ROF model, and if we're running with a - ! non-stub GLC model. These won't change throughout the run, but we can't count on - ! their being set in initialization, so need to get them in the run method. - - call seq_infodata_GetData( infodata, & - rof_prognostic=rof_prognostic, & - glc_present=glc_present) - - ! Map MCT to land data type - ! Perform downscaling if appropriate - - - ! Map to clm (only when state and/or fluxes need to be updated) - - call t_startf ('lc_lnd_import') - call lnd_import( bounds, & - x2l = x2l_l%rattr, & - glc_present = glc_present, & - atm2lnd_inst = atm2lnd_inst, & - glc2lnd_inst = glc2lnd_inst, & - wateratm2lndbulk_inst = water_inst%wateratm2lndbulk_inst) - call t_stopf ('lc_lnd_import') - - ! Use infodata to set orbital values if updated mid-run - - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & - orb_lambm0=lambm0, orb_obliqr=obliqr ) - - ! Loop over time steps in coupling interval - - dosend = .false. - do while(.not. dosend) - - ! Determine if dosend - ! When time is not updated at the beginning of the loop - then return only if - ! are in sync with clock before time is updated - - call get_curr_date( yr, mon, day, tod ) - ymd = yr*10000 + mon*100 + day - tod = tod - dosend = (seq_timemgr_EClockDateInSync( EClock, ymd, tod)) - - ! Determine doalb based on nextsw_cday sent from atm model - - nstep = get_nstep() - caldayp1 = get_curr_calday(offset=dtime) - if (nstep == 0) then - doalb = .false. - else if (nstep == 1) then - doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) - else - doalb = (nextsw_cday >= -0.5_r8) - end if - call update_rad_dtime(doalb) - - ! Determine if time to write cam restart and stop - - rstwr = .false. - if (rstwr_sync .and. dosend) rstwr = .true. - nlend = .false. - if (nlend_sync .and. dosend) nlend = .true. - - ! Run clm - - call t_barrierf('sync_clm_run1', mpicom) - call t_startf ('clm_run') - call t_startf ('shr_orb_decl') - calday = get_curr_calday() - call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) - call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) - call t_stopf ('shr_orb_decl') - call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) - call t_stopf ('clm_run') - - ! Create l2x_l export state - add river runoff input to l2x_l if appropriate - - call t_startf ('lc_lnd_export') - call lnd_export(bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) - call t_stopf ('lc_lnd_export') - - ! Advance clm time step - - call t_startf ('lc_clm2_adv_timestep') - call advance_timestep() - call t_stopf ('lc_clm2_adv_timestep') - - end do - - ! Check that internal clock is in sync with master clock - - call get_curr_date( yr, mon, day, tod, offset=-dtime ) - ymd = yr*10000 + mon*100 + day - tod = tod - if ( .not. seq_timemgr_EClockDateInSync( EClock, ymd, tod ) )then - call seq_timemgr_EclockGetData( EClock, curr_ymd=ymd_sync, curr_tod=tod_sync ) - write(iulog,*)' clm ymd=',ymd ,' clm tod= ',tod - write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync - call endrun( sub//":: CLM clock not in sync with Master Sync clock" ) - end if - - ! Reset shr logging to my original values - - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_run_mct:end::',lbnum) - call memmon_reset_addr() - endif -#endif - - first_call = .false. - - end subroutine lnd_run_mct - - !==================================================================================== - - subroutine lnd_final_mct( EClock, cdata_l, x2l_l, l2x_l) - ! - ! !DESCRIPTION: - ! Finalize land surface model - - use seq_cdata_mod ,only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod ,only : seq_timemgr_EClockGetData, seq_timemgr_StopAlarmIsOn - use seq_timemgr_mod ,only : seq_timemgr_RestartAlarmIsOn, seq_timemgr_EClockDateInSync - use esmf - ! - ! !ARGUMENTS: - type(ESMF_Clock) , intent(inout) :: EClock ! Input synchronization clock from driver - type(seq_cdata) , intent(inout) :: cdata_l ! Input driver data for land model - type(mct_aVect) , intent(inout) :: x2l_l ! Import state to land model - type(mct_aVect) , intent(inout) :: l2x_l ! Export state from land model - !--------------------------------------------------------------------------- - - ! fill this in - end subroutine lnd_final_mct - - !==================================================================================== - - subroutine lnd_setgsmap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) - ! - ! !DESCRIPTION: - ! Set the MCT GS map for the land model - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use domainMod , only : ldomain - use mct_mod , only : mct_gsMap, mct_gsMap_init - implicit none - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: mpicom_lnd ! MPI communicator for the clm land model - integer , intent(in) :: LNDID ! Land model identifyer number - type(mct_gsMap) , intent(out) :: gsMap_lnd ! Resulting MCT GS map for the land model - ! - ! !LOCAL VARIABLES: - integer,allocatable :: gindex(:) ! Number the local grid points - integer :: i, j, n, gi ! Indices - integer :: lsize,gsize ! GS Map size - integer :: ier ! Error code - !--------------------------------------------------------------------------- - - ! Build the land grid numbering for MCT - ! NOTE: Numbering scheme is: West to East and South to North - ! starting at south pole. Should be the same as what's used in SCRIP - - allocate(gindex(bounds%begg:bounds%endg),stat=ier) - - ! number the local grid - - do n = bounds%begg, bounds%endg - gindex(n) = ldecomp%gdc2glo(n) - end do - lsize = bounds%endg - bounds%begg + 1 - gsize = ldomain%ni * ldomain%nj - - call mct_gsMap_init( gsMap_lnd, gindex, mpicom_lnd, LNDID, lsize, gsize ) - - deallocate(gindex) - - end subroutine lnd_SetgsMap_mct - - !==================================================================================== - - subroutine lnd_domain_mct( bounds, lsize, gsMap_l, dom_l ) - ! - ! !DESCRIPTION: - ! Send the land model domain information to the coupler - ! - ! !USES: - use clm_varcon , only: re - use domainMod , only: ldomain - use spmdMod , only: iam - use mct_mod , only: mct_gGrid_importIAttr - use mct_mod , only: mct_gGrid_importRAttr, mct_gGrid_init, mct_gsMap_orderedPoints - use seq_flds_mod, only: seq_flds_dom_coord, seq_flds_dom_other - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: lsize ! land model domain data size - type(mct_gsMap), intent(inout) :: gsMap_l ! Output land model MCT GS map - type(mct_ggrid), intent(out) :: dom_l ! Output domain information for land model - ! - ! Local Variables - integer :: g,i,j ! index - real(r8), pointer :: data(:) ! temporary - integer , pointer :: idata(:) ! temporary - !--------------------------------------------------------------------------- - ! - ! Initialize mct domain type - ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) - ! Note that in addition land carries around landfrac for the purposes of domain checking - ! - call mct_gGrid_init( GGrid=dom_l, CoordChars=trim(seq_flds_dom_coord), & - OtherChars=trim(seq_flds_dom_other), lsize=lsize ) - ! - ! Allocate memory - ! - allocate(data(lsize)) - ! - ! Determine global gridpoint number attribute, GlobGridNum, which is set automatically by MCT - ! - call mct_gsMap_orderedPoints(gsMap_l, iam, idata) - call mct_gGrid_importIAttr(dom_l,'GlobGridNum',idata,lsize) - ! - ! Determine domain (numbering scheme is: West to East and South to North to South pole) - ! Initialize attribute vector with special value - ! - data(:) = -9999.0_R8 - call mct_gGrid_importRAttr(dom_l,"lat" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"lon" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"area" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"aream",data,lsize) - data(:) = 0.0_R8 - call mct_gGrid_importRAttr(dom_l,"mask" ,data,lsize) - ! - ! Fill in correct values for domain components - ! Note aream will be filled in in the atm-lnd mapper - ! - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%lonc(g) - end do - call mct_gGrid_importRattr(dom_l,"lon",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%latc(g) - end do - call mct_gGrid_importRattr(dom_l,"lat",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%area(g)/(re*re) - end do - call mct_gGrid_importRattr(dom_l,"area",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%mask(g), r8) - end do - call mct_gGrid_importRattr(dom_l,"mask",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%frac(g), r8) - end do - call mct_gGrid_importRattr(dom_l,"frac",data,lsize) - - deallocate(data) - deallocate(idata) - - end subroutine lnd_domain_mct - - !==================================================================================== - - subroutine lnd_handle_resume( cdata_l ) - ! - ! !DESCRIPTION: - ! Handle resume signals for Data Assimilation (DA) - ! - ! !USES: - use clm_time_manager , only : update_DA_nstep - use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs - implicit none - ! !ARGUMENTS: - type(seq_cdata), intent(inout) :: cdata_l ! Input land-model driver data - ! !LOCAL VARIABLES: - logical :: resume_from_data_assim ! flag if we are resuming after data assimulation was done - !--------------------------------------------------------------------------- - - ! Check to see if restart was modified and we are resuming from data - ! assimilation - call seq_cdata_setptrs(cdata_l, post_assimilation=resume_from_data_assim) - if ( resume_from_data_assim ) call update_DA_nstep() - - end subroutine lnd_handle_resume - -end module lnd_comp_mct diff --git a/src/cpl/lnd_import_export.F90 b/src/cpl/lnd_import_export.F90 deleted file mode 100644 index f3784bc55f..0000000000 --- a/src/cpl/lnd_import_export.F90 +++ /dev/null @@ -1,431 +0,0 @@ -module lnd_import_export - - use shr_kind_mod , only: r8 => shr_kind_r8, cl=>shr_kind_cl - use abortutils , only: endrun - use decompmod , only: bounds_type - use lnd2atmType , only: lnd2atm_type - use lnd2glcMod , only: lnd2glc_type - use atm2lndType , only: atm2lnd_type - use glc2lndMod , only: glc2lnd_type - use Waterlnd2atmBulkType , only: waterlnd2atmbulk_type - use Wateratm2lndBulkType , only: wateratm2lndbulk_type - use clm_cpl_indices - ! - implicit none - !=============================================================================== - -contains - - !=============================================================================== - subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wateratm2lndbulk_inst) - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Convert the input data from the coupler to the land model - ! - ! !USES: - use seq_flds_mod , only: seq_flds_x2l_fields - use clm_varctl , only: co2_type, co2_ppmv, iulog, use_c13 - use clm_varctl , only: ndep_from_cpl - use clm_varcon , only: rair, o2_molar_const, c13ratio - use shr_const_mod , only: SHR_CONST_TKFRZ - use shr_string_mod , only: shr_string_listGetName - use domainMod , only: ldomain - use shr_infnan_mod , only : isnan => shr_infnan_isnan - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - real(r8) , intent(in) :: x2l(:,:) ! driver import state to land model - logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! clm internal input data type - type(glc2lnd_type) , intent(inout) :: glc2lnd_inst ! clm internal input data type - type(wateratm2lndbulk_type), intent(inout) :: wateratm2lndbulk_inst ! clm internal input data type - ! - ! !LOCAL VARIABLES: - integer :: g,i,k,nstep,ier ! indices, number of steps, and error code - real(r8) :: forc_rainc ! rainxy Atm flux mm/s - real(r8) :: e ! vapor pressure (Pa) - real(r8) :: qsat ! saturation specific humidity (kg/kg) - real(r8) :: forc_t ! atmospheric temperature (Kelvin) - real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) - real(r8) :: forc_pbot ! atmospheric pressure (Pa) - real(r8) :: forc_rainl ! rainxy Atm flux mm/s - real(r8) :: forc_snowc ! snowfxy Atm flux mm/s - real(r8) :: forc_snowl ! snowfxl Atm flux mm/s - real(r8) :: co2_ppmv_diag ! temporary - real(r8) :: co2_ppmv_prog ! temporary - real(r8) :: co2_ppmv_val ! temporary - integer :: co2_type_idx ! integer flag for co2_type options - real(r8) :: esatw ! saturation vapor pressure over water (Pa) - real(r8) :: esati ! saturation vapor pressure over ice (Pa) - real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water - real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice - real(r8) :: tdc, t ! Kelvins to Celcius function and its input - character(len=32) :: fname ! name of field that is NaN - character(len=32), parameter :: sub = 'lnd_import' - - ! Constants to compute vapor pressure - parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & - a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & - a4=3.031240396e-06_r8, a5=2.034080948e-08_r8, & - a6=6.136820929e-11_r8) - - parameter (b0=6.109177956_r8 , b1=5.034698970e-01_r8, & - b2=1.886013408e-02_r8, b3=4.176223716e-04_r8, & - b4=5.824720280e-06_r8, b5=4.838803174e-08_r8, & - b6=1.838826904e-10_r8) - ! - ! function declarations - ! - tdc(t) = min( 50._r8, max(-50._r8,(t-SHR_CONST_TKFRZ)) ) - esatw(t) = 100._r8*(a0+t*(a1+t*(a2+t*(a3+t*(a4+t*(a5+t*a6)))))) - esati(t) = 100._r8*(b0+t*(b1+t*(b2+t*(b3+t*(b4+t*(b5+t*b6)))))) - !--------------------------------------------------------------------------- - - co2_type_idx = 0 - if (co2_type == 'prognostic') then - co2_type_idx = 1 - else if (co2_type == 'diagnostic') then - co2_type_idx = 2 - end if - if (co2_type == 'prognostic' .and. index_x2l_Sa_co2prog == 0) then - call endrun( sub//' ERROR: must have nonzero index_x2l_Sa_co2prog for co2_type equal to prognostic' ) - else if (co2_type == 'diagnostic' .and. index_x2l_Sa_co2diag == 0) then - call endrun( sub//' ERROR: must have nonzero index_x2l_Sa_co2diag for co2_type equal to diagnostic' ) - end if - - ! Note that the precipitation fluxes received from the coupler - ! are in units of kg/s/m^2. To convert these precipitation rates - ! in units of mm/sec, one must divide by 1000 kg/m^3 and multiply - ! by 1000 mm/m resulting in an overall factor of unity. - ! Below the units are therefore given in mm/s. - - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - - ! Determine flooding input, sign convention is positive downward and - ! hierarchy is atm/glc/lnd/rof/ice/ocn. so water sent from rof to land is negative, - ! change the sign to indicate addition of water to system. - - wateratm2lndbulk_inst%forc_flood_grc(g) = -x2l(index_x2l_Flrr_flood,i) - - wateratm2lndbulk_inst%volr_grc(g) = x2l(index_x2l_Flrr_volr,i) * (ldomain%area(g) * 1.e6_r8) - wateratm2lndbulk_inst%volrmch_grc(g)= x2l(index_x2l_Flrr_volrmch,i) * (ldomain%area(g) * 1.e6_r8) - - ! Determine required receive fields - - atm2lnd_inst%forc_hgt_grc(g) = x2l(index_x2l_Sa_z,i) ! zgcmxy Atm state m - atm2lnd_inst%forc_topo_grc(g) = x2l(index_x2l_Sa_topo,i) ! Atm surface height (m) - atm2lnd_inst%forc_u_grc(g) = x2l(index_x2l_Sa_u,i) ! forc_uxy Atm state m/s - atm2lnd_inst%forc_v_grc(g) = x2l(index_x2l_Sa_v,i) ! forc_vxy Atm state m/s - atm2lnd_inst%forc_solad_grc(g,2) = x2l(index_x2l_Faxa_swndr,i) ! forc_sollxy Atm flux W/m^2 - atm2lnd_inst%forc_solad_grc(g,1) = x2l(index_x2l_Faxa_swvdr,i) ! forc_solsxy Atm flux W/m^2 - atm2lnd_inst%forc_solai_grc(g,2) = x2l(index_x2l_Faxa_swndf,i) ! forc_solldxy Atm flux W/m^2 - atm2lnd_inst%forc_solai_grc(g,1) = x2l(index_x2l_Faxa_swvdf,i) ! forc_solsdxy Atm flux W/m^2 - - atm2lnd_inst%forc_th_not_downscaled_grc(g) = x2l(index_x2l_Sa_ptem,i) ! forc_thxy Atm state K - wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = x2l(index_x2l_Sa_shum,i) ! forc_qxy Atm state kg/kg - atm2lnd_inst%forc_pbot_not_downscaled_grc(g) = x2l(index_x2l_Sa_pbot,i) ! ptcmxy Atm state Pa - atm2lnd_inst%forc_t_not_downscaled_grc(g) = x2l(index_x2l_Sa_tbot,i) ! forc_txy Atm state K - atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) = x2l(index_x2l_Faxa_lwdn,i) ! flwdsxy Atm flux W/m^2 - - forc_rainc = x2l(index_x2l_Faxa_rainc,i) ! mm/s - forc_rainl = x2l(index_x2l_Faxa_rainl,i) ! mm/s - forc_snowc = x2l(index_x2l_Faxa_snowc,i) ! mm/s - forc_snowl = x2l(index_x2l_Faxa_snowl,i) ! mm/s - - ! atmosphere coupling, for prognostic/prescribed aerosols - atm2lnd_inst%forc_aer_grc(g,1) = x2l(index_x2l_Faxa_bcphidry,i) - atm2lnd_inst%forc_aer_grc(g,2) = x2l(index_x2l_Faxa_bcphodry,i) - atm2lnd_inst%forc_aer_grc(g,3) = x2l(index_x2l_Faxa_bcphiwet,i) - atm2lnd_inst%forc_aer_grc(g,4) = x2l(index_x2l_Faxa_ocphidry,i) - atm2lnd_inst%forc_aer_grc(g,5) = x2l(index_x2l_Faxa_ocphodry,i) - atm2lnd_inst%forc_aer_grc(g,6) = x2l(index_x2l_Faxa_ocphiwet,i) - atm2lnd_inst%forc_aer_grc(g,7) = x2l(index_x2l_Faxa_dstwet1,i) - atm2lnd_inst%forc_aer_grc(g,8) = x2l(index_x2l_Faxa_dstdry1,i) - atm2lnd_inst%forc_aer_grc(g,9) = x2l(index_x2l_Faxa_dstwet2,i) - atm2lnd_inst%forc_aer_grc(g,10) = x2l(index_x2l_Faxa_dstdry2,i) - atm2lnd_inst%forc_aer_grc(g,11) = x2l(index_x2l_Faxa_dstwet3,i) - atm2lnd_inst%forc_aer_grc(g,12) = x2l(index_x2l_Faxa_dstdry3,i) - atm2lnd_inst%forc_aer_grc(g,13) = x2l(index_x2l_Faxa_dstwet4,i) - atm2lnd_inst%forc_aer_grc(g,14) = x2l(index_x2l_Faxa_dstdry4,i) - - ! Determine optional receive fields - - if (index_x2l_Sa_co2prog /= 0) then - co2_ppmv_prog = x2l(index_x2l_Sa_co2prog,i) ! co2 atm state prognostic - else - co2_ppmv_prog = co2_ppmv - end if - - if (index_x2l_Sa_co2diag /= 0) then - co2_ppmv_diag = x2l(index_x2l_Sa_co2diag,i) ! co2 atm state diagnostic - else - co2_ppmv_diag = co2_ppmv - end if - - if (index_x2l_Sa_methane /= 0) then - atm2lnd_inst%forc_pch4_grc(g) = x2l(index_x2l_Sa_methane,i) - endif - - ! Determine derived quantities for required fields - - forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) - forc_q = wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) - forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) - - atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] - atm2lnd_inst%forc_hgt_t_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of temperature [m] - atm2lnd_inst%forc_hgt_q_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of humidity [m] - atm2lnd_inst%forc_vp_grc(g) = forc_q * forc_pbot / (0.622_r8 + 0.378_r8 * forc_q) - atm2lnd_inst%forc_rho_not_downscaled_grc(g) = & - (forc_pbot - 0.378_r8 * atm2lnd_inst%forc_vp_grc(g)) / (rair * forc_t) - atm2lnd_inst%forc_po2_grc(g) = o2_molar_const * forc_pbot - atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) - atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & - atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) - - wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc + forc_rainl - wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc + forc_snowl - - if (forc_t > SHR_CONST_TKFRZ) then - e = esatw(tdc(forc_t)) - else - e = esati(tdc(forc_t)) - end if - qsat = 0.622_r8*e / (forc_pbot - 0.378_r8*e) - - !modify specific humidity if precip occurs - if(1==2) then - if((forc_rainc+forc_rainl) > 0._r8) then - forc_q = 0.95_r8*qsat - ! forc_q = qsat - wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q - endif - endif - - wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) - - ! Check that solar, specific-humidity and LW downward aren't negative - if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 )then - call endrun( sub//' ERROR: Longwave down sent from the atmosphere model is negative or zero' ) - end if - if ( (atm2lnd_inst%forc_solad_grc(g,1) < 0.0_r8) .or. (atm2lnd_inst%forc_solad_grc(g,2) < 0.0_r8) & - .or. (atm2lnd_inst%forc_solai_grc(g,1) < 0.0_r8) .or. (atm2lnd_inst%forc_solai_grc(g,2) < 0.0_r8) ) then - call endrun( sub//' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & - ' from the atmosphere model is negative or zero' ) - end if - if ( wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then - call endrun( sub//' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) - end if - - ! Check if any input from the coupler is NaN - if ( any(isnan(x2l(:,i))) )then - write(iulog,*) '# of NaNs = ', count(isnan(x2l(:,i))) - write(iulog,*) 'Which are NaNs = ', isnan(x2l(:,i)) - do k = 1, size(x2l(:,i)) - if ( isnan(x2l(k,i)) )then - call shr_string_listGetName( seq_flds_x2l_fields, k, fname ) - write(iulog,*) trim(fname) - end if - end do - write(iulog,*) 'gridcell index = ', g - call endrun( sub//' ERROR: One or more of the input from the atmosphere model are NaN '// & - '(Not a Number from a bad floating point calculation)' ) - end if - - ! Make sure relative humidity is properly bounded - ! wateratm2lndbulk_inst%forc_rh_grc(g) = min( 100.0_r8, wateratm2lndbulk_inst%forc_rh_grc(g) ) - ! wateratm2lndbulk_inst%forc_rh_grc(g) = max( 0.0_r8, wateratm2lndbulk_inst%forc_rh_grc(g) ) - - ! Determine derived quantities for optional fields - ! Note that the following does unit conversions from ppmv to partial pressures (Pa) - ! Note that forc_pbot is in Pa - - if (co2_type_idx == 1) then - co2_ppmv_val = co2_ppmv_prog - else if (co2_type_idx == 2) then - co2_ppmv_val = co2_ppmv_diag - else - co2_ppmv_val = co2_ppmv - end if - if ( (co2_ppmv_val < 10.0_r8) .or. (co2_ppmv_val > 15000.0_r8) )then - call endrun( sub//' ERROR: CO2 is outside of an expected range' ) - end if - atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_val * 1.e-6_r8 * forc_pbot - if (use_c13) then - atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_val * c13ratio * 1.e-6_r8 * forc_pbot - end if - - if (ndep_from_cpl) then - ! The coupler is sending ndep in units if kgN/m2/s - and clm uses units of gN/m2/sec - so the - ! following conversion needs to happen - atm2lnd_inst%forc_ndep_grc(g) = (x2l(index_x2l_Faxa_nhx, i) + x2l(index_x2l_faxa_noy, i))*1000._r8 - end if - - end do - - call glc2lnd_inst%set_glc2lnd_fields( & - bounds = bounds, & - glc_present = glc_present, & - ! NOTE(wjs, 2017-12-13) the x2l argument doesn't have the typical bounds - ! subsetting (bounds%begg:bounds%endg). This mirrors the lack of these bounds in - ! the call to lnd_import from lnd_run_mct. This is okay as long as this code is - ! outside a clump loop. - x2l = x2l, & - index_x2l_Sg_ice_covered = index_x2l_Sg_ice_covered, & - index_x2l_Sg_topo = index_x2l_Sg_topo, & - index_x2l_Flgg_hflx = index_x2l_Flgg_hflx, & - index_x2l_Sg_icemask = index_x2l_Sg_icemask, & - index_x2l_Sg_icemask_coupled_fluxes = index_x2l_Sg_icemask_coupled_fluxes) - - end subroutine lnd_import - - !=============================================================================== - - subroutine lnd_export( bounds, waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x) - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Convert the data to be sent from the clm model to the coupler - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use seq_flds_mod , only : seq_flds_l2x_fields - use clm_varctl , only : iulog - use clm_time_manager , only : get_nstep - use seq_drydep_mod , only : n_drydep - use shr_megan_mod , only : shr_megan_mechcomps_n - use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n - use domainMod , only : ldomain - use shr_string_mod , only : shr_string_listGetName - use shr_infnan_mod , only : isnan => shr_infnan_isnan - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - type(lnd2atm_type), intent(inout) :: lnd2atm_inst ! clm land to atmosphere exchange data type - type(lnd2glc_type), intent(inout) :: lnd2glc_inst ! clm land to atmosphere exchange data type - type(waterlnd2atmbulk_type), intent(in) :: waterlnd2atmbulk_inst - real(r8) , intent(out) :: l2x(:,:)! land to coupler export state on land grid - ! - ! !LOCAL VARIABLES: - integer :: g,i,k ! indices - integer :: ier ! error status - integer :: nstep ! time step index - integer :: dtime ! time step - integer :: num ! counter - character(len=32) :: fname ! name of field that is NaN - character(len=32), parameter :: sub = 'lnd_export' - !--------------------------------------------------------------------------- - - ! cesm sign convention is that fluxes are positive downward - - l2x(:,:) = 0.0_r8 - - do g = bounds%begg,bounds%endg - i = 1 + (g-bounds%begg) - l2x(index_l2x_Sl_t,i) = lnd2atm_inst%t_rad_grc(g) - l2x(index_l2x_Sl_snowh,i) = waterlnd2atmbulk_inst%h2osno_grc(g) - l2x(index_l2x_Sl_avsdr,i) = lnd2atm_inst%albd_grc(g,1) - l2x(index_l2x_Sl_anidr,i) = lnd2atm_inst%albd_grc(g,2) - l2x(index_l2x_Sl_avsdf,i) = lnd2atm_inst%albi_grc(g,1) - l2x(index_l2x_Sl_anidf,i) = lnd2atm_inst%albi_grc(g,2) - l2x(index_l2x_Sl_tref,i) = lnd2atm_inst%t_ref2m_grc(g) - l2x(index_l2x_Sl_qref,i) = waterlnd2atmbulk_inst%q_ref2m_grc(g) - l2x(index_l2x_Sl_u10,i) = lnd2atm_inst%u_ref10m_grc(g) - l2x(index_l2x_Fall_taux,i) = -lnd2atm_inst%taux_grc(g) - l2x(index_l2x_Fall_tauy,i) = -lnd2atm_inst%tauy_grc(g) - l2x(index_l2x_Fall_lat,i) = -lnd2atm_inst%eflx_lh_tot_grc(g) - l2x(index_l2x_Fall_sen,i) = -lnd2atm_inst%eflx_sh_tot_grc(g) - l2x(index_l2x_Fall_lwup,i) = -lnd2atm_inst%eflx_lwrad_out_grc(g) - l2x(index_l2x_Fall_evap,i) = -waterlnd2atmbulk_inst%qflx_evap_tot_grc(g) - l2x(index_l2x_Fall_swnet,i) = lnd2atm_inst%fsa_grc(g) - if (index_l2x_Fall_fco2_lnd /= 0) then - l2x(index_l2x_Fall_fco2_lnd,i) = -lnd2atm_inst%net_carbon_exchange_grc(g) - end if - - ! Additional fields for DUST, PROGSSLT, dry-deposition and VOC - ! These are now standard fields, but the check on the index makes sure the driver handles them - if (index_l2x_Sl_ram1 /= 0 ) l2x(index_l2x_Sl_ram1,i) = lnd2atm_inst%ram1_grc(g) - if (index_l2x_Sl_fv /= 0 ) l2x(index_l2x_Sl_fv,i) = lnd2atm_inst%fv_grc(g) - if (index_l2x_Sl_soilw /= 0 ) l2x(index_l2x_Sl_soilw,i) = waterlnd2atmbulk_inst%h2osoi_vol_grc(g,1) - if (index_l2x_Fall_flxdst1 /= 0 ) l2x(index_l2x_Fall_flxdst1,i)= -lnd2atm_inst%flxdst_grc(g,1) - if (index_l2x_Fall_flxdst2 /= 0 ) l2x(index_l2x_Fall_flxdst2,i)= -lnd2atm_inst%flxdst_grc(g,2) - if (index_l2x_Fall_flxdst3 /= 0 ) l2x(index_l2x_Fall_flxdst3,i)= -lnd2atm_inst%flxdst_grc(g,3) - if (index_l2x_Fall_flxdst4 /= 0 ) l2x(index_l2x_Fall_flxdst4,i)= -lnd2atm_inst%flxdst_grc(g,4) - - - ! for dry dep velocities - if (index_l2x_Sl_ddvel /= 0 ) then - l2x(index_l2x_Sl_ddvel:index_l2x_Sl_ddvel+n_drydep-1,i) = & - lnd2atm_inst%ddvel_grc(g,:n_drydep) - end if - - ! for MEGAN VOC emis fluxes - if (index_l2x_Fall_flxvoc /= 0 ) then - l2x(index_l2x_Fall_flxvoc:index_l2x_Fall_flxvoc+shr_megan_mechcomps_n-1,i) = & - -lnd2atm_inst%flxvoc_grc(g,:shr_megan_mechcomps_n) - end if - - - ! for fire emis fluxes - if (index_l2x_Fall_flxfire /= 0 ) then - l2x(index_l2x_Fall_flxfire:index_l2x_Fall_flxfire+shr_fire_emis_mechcomps_n-1,i) = & - -lnd2atm_inst%fireflx_grc(g,:shr_fire_emis_mechcomps_n) - l2x(index_l2x_Sl_ztopfire,i) = lnd2atm_inst%fireztop_grc(g) - end if - - if (index_l2x_Fall_methane /= 0) then - l2x(index_l2x_Fall_methane,i) = -lnd2atm_inst%flux_ch4_grc(g) - endif - - ! sign convention is positive downward with - ! hierarchy of atm/glc/lnd/rof/ice/ocn. - ! I.e. water sent from land to rof is positive - - l2x(index_l2x_Flrl_rofsur,i) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) - - ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - l2x(index_l2x_Flrl_rofsub,i) = waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) & - + waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) - - ! qgwl sent individually to coupler - l2x(index_l2x_Flrl_rofgwl,i) = waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) - - ! ice sent individually to coupler - l2x(index_l2x_Flrl_rofi,i) = waterlnd2atmbulk_inst%qflx_rofice_grc(g) - - ! irrigation flux to be removed from main channel storage (negative) - l2x(index_l2x_Flrl_irrig,i) = - waterlnd2atmbulk_inst%qirrig_grc(g) - - ! glc coupling - ! We could avoid setting these fields if glc_present is .false., if that would - ! help with performance. (The downside would be that we wouldn't have these fields - ! available for diagnostic purposes or to force a later T compset with dlnd.) - do num = 0,glc_nec - l2x(index_l2x_Sl_tsrf(num),i) = lnd2glc_inst%tsrf_grc(g,num) - l2x(index_l2x_Sl_topo(num),i) = lnd2glc_inst%topo_grc(g,num) - l2x(index_l2x_Flgl_qice(num),i) = lnd2glc_inst%qice_grc(g,num) - end do - - ! Check if any output sent to the coupler is NaN - if ( any(isnan(l2x(:,i))) )then - write(iulog,*) '# of NaNs = ', count(isnan(l2x(:,i))) - write(iulog,*) 'Which are NaNs = ', isnan(l2x(:,i)) - do k = 1, size(l2x(:,i)) - if ( isnan(l2x(k,i)) )then - call shr_string_listGetName( seq_flds_l2x_fields, k, fname ) - write(iulog,*) trim(fname) - end if - end do - write(iulog,*) 'gridcell index = ', g - call endrun( sub//' ERROR: One or more of the output from CLM to the coupler are NaN ' ) - end if - - end do - - end subroutine lnd_export - -end module lnd_import_export From fcfcbdc138b038df211d036b15514684075b8e67 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 11 Oct 2019 14:55:13 -0600 Subject: [PATCH 0408/1973] some clean ups.... --- lilac/lilac/atmos_cap.F90 | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index 145af984fa..a897c60e51 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -25,7 +25,7 @@ module atmos_cap integer :: mpierror, numprocs integer :: i, myid integer status(MPI_STATUS_SIZE) ! Status of message - integer, parameter :: debug = 0 ! internal debug leve + integer, parameter :: debug = 1 ! internal debug leve @@ -113,7 +113,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) atmos_mesh = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Mesh for atmosphere is created!", ESMF_LOGMSG_INFO) - print *, "!Mesh for atmosphere is created!" + !print *, "!Mesh for atmosphere is created!" else !TODO: Fix how you want to create the grid here if mesh_switch is off @@ -129,7 +129,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) regDecomp=(/1,petcount/),& rc=rc) call ESMF_LogWrite(subname//"Grid for atmosphere is created!", ESMF_LOGMSG_INFO) - print *, "Grid for atmosphere is created!" + !print *, "Grid for atmosphere is created!" endif !------------------------------------------------------------------------- @@ -163,8 +163,8 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) print *, "creating field for a2c:" print *, trim(a2c_fldlist(n)%stdname) print *, a2c_fldlist(n)%farrayptr1d - call ESMF_FieldPrint(field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !call ESMF_FieldPrint(field, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out end if !call ESMF_LogWrite(subname//"fieldget!", ESMF_LOGMSG_INFO) @@ -177,11 +177,14 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) enddo - fldname = 'Sa_topo' - do i=begc, endc - write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, a2c_fldlist(2)%farrayptr1d(i) - enddo - + if (myid == 0 .and. debug > 0) then + do n = 1,a2c_fldlist_num + do i=begc, endc + fldname = a2c_fldlist(n)%stdname + write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, a2c_fldlist(n)%farrayptr1d(i) + enddo + enddo + end if call ESMF_LogWrite(subname//"fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" From a5e2510d6a03bae179d61067a481ba613f1efa1f Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 11 Oct 2019 14:57:25 -0600 Subject: [PATCH 0409/1973] changing the way driver used to work to run for all time steps.... --- lilac/lilac/demo_driver.F90 | 45 ++++++++++++++++++++++--------------- lilac/lilac/lilac_mod.F90 | 1 + 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index 221b1c5f3a..698ac94d68 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -62,7 +62,7 @@ program demo_lilac_driver !endc = 13968 start_time = 1 - end_time = 5 + end_time = 48 itime_step = 1 seed_val = 0 @@ -93,7 +93,8 @@ program demo_lilac_driver allocate ( atm2lnd%Faxa_snowc (begc:endc) ) ; atm2lnd%Faxa_snowc (:) = 1.0d-8 allocate ( atm2lnd%Faxa_snowl (begc:endc) ) ; atm2lnd%Faxa_snowl (:) = 2.0d-8 allocate ( atm2lnd%Faxa_swndr (begc:endc) ) ; atm2lnd%Faxa_swndr (:) = 100.0d0 - allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 20.0d0 + + allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 50.0d0 allocate ( atm2lnd%Faxa_swndf (begc:endc) ) ; atm2lnd%Faxa_swndf (:) = 20.0d0 allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) ; atm2lnd%Faxa_swvdf (:) = 40.0d0 @@ -102,7 +103,6 @@ program demo_lilac_driver if (debug > 0) then do i=begc, endc write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, atm2lnd%Sa_topo(i) - !write (iulog,F01)'i = ',i, atm2lnd%Sa_topo(i) enddo end if !allocate ( atm2lnd%Faxa_bcph (begc:endc) ) ; atm2lnd%Faxa_bcph (:) = 0.0d0 @@ -130,24 +130,33 @@ program demo_lilac_driver ! looping over imaginary time .... !------------------------------------------------------------------------ + call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm ) do curr_time = start_time, end_time - if (curr_time == start_time) then - ! Initalization phase - !if (masterproc) then - print *, "--------------------------" - print *, " LILAC Initalization phase" - print *, "--------------------------" - !end if - call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm ) - else if (curr_time == end_time ) then - ! Finalization phase - call lilac_final ( ) - call ESMF_Finalize ( ) - else call lilac_run ( ) - endif - itime_step = itime_step + 1 + itime_step = itime_step + 1 end do + call lilac_final ( ) + call ESMF_Finalize ( ) + + + !do curr_time = start_time, end_time + ! if (curr_time == start_time) then + ! ! Initalization phase + ! !if (masterproc) then + ! print *, "--------------------------" + ! print *, " LILAC Initalization phase" + ! print *, "--------------------------" + ! !end if + ! call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm ) + ! else if (curr_time == end_time ) then + ! ! Finalization phase + ! call lilac_final ( ) + ! call ESMF_Finalize ( ) + ! else + ! call lilac_run ( ) + ! endif + ! itime_step = itime_step + 1 + !end do print *, "=======================================" print *, " ............. DONE ..................." diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 8f69f2e492..d462bc3c66 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -255,6 +255,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) a2c_fldlist(11)%farrayptr1d => atm2lnd1d%Faxa_rainl a2c_fldlist(12)%farrayptr1d => atm2lnd1d%Faxa_snowc a2c_fldlist(13)%farrayptr1d => atm2lnd1d%Faxa_snowl + a2c_fldlist(14)%farrayptr1d => atm2lnd1d%Faxa_swndr a2c_fldlist(15)%farrayptr1d => atm2lnd1d%Faxa_swvdr a2c_fldlist(16)%farrayptr1d => atm2lnd1d%Faxa_swndf From 33e0dfa3359820e3564b20272cf8649485cf3a99 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 14 Oct 2019 14:33:30 -0600 Subject: [PATCH 0410/1973] Rework SoilTemperatureMod to eliminate duplicate code --- src/biogeophys/SoilTemperatureMod.F90 | 316 +++++--------------------- 1 file changed, 55 insertions(+), 261 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 6cc233dc89..0a43a2058c 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -431,30 +431,12 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter ! Melting or Freezing -! Do this for perv and imperv road for -nlevsno+1,nlevgrnd - do j = -nlevsno+1,nlevgrnd + do j = -nlevsno+1,nlevmaxurbgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) - if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= snl(c)+1) then - if (j <= nlevgrnd-1) then - fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j == nlevgrnd) then - fn1(c,j) = 0._r8 - end if - end if - end if - end do - end do - -! Do this for sunwall, shadewall, roof but for -nlevsno+1,nlevurb - do j = -nlevsno+1,nlevurb - do fc = 1,num_urbanc - c = filter_urbanc(fc) l = col%landunit(c) - if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) then + if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then if (j >= snl(c)+1) then if (j <= nlevurb-1) then fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) @@ -483,6 +465,15 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter end if end if end if + else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & + .and. col%itype(c) /= icol_roof) then + if (j >= snl(c)+1) then + if (j <= nlevgrnd-1) then + fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) + else if (j == nlevgrnd) then + fn1(c,j) = 0._r8 + end if + end if end if end do end do @@ -747,26 +738,11 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! Thermal conductivity at the layer interface - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= snl(c)+1 .AND. j <= nlevgrnd-1) then - tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & - /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) - else if (j == nlevgrnd) then - tk(c,j) = 0._r8 - end if - end if - end do - end do - - do j = -nlevsno+1,nlevurb + do j = -nlevsno+1,nlevmaxurbgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then + .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then if (j >= snl(c)+1 .AND. j <= nlevurb-1) then tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) @@ -777,6 +753,14 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! building temperature. (See Oleson urban notes of 6/18/03). tk(c,j) = thk(c,j) end if + else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & + .and. col%itype(c) /= icol_roof) then + if (j >= snl(c)+1 .AND. j <= nlevgrnd-1) then + tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & + /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) + else if (j == nlevgrnd) then + tk(c,j) = 0._r8 + end if end if end do end do @@ -1230,19 +1214,24 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & enddo ! end of level-loop !-- soil layers --------------------------------------------------- - do j = 1,nlevgrnd + + do j = 1,nlevmaxurbgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) supercool(c,j) = 0.0_r8 ! add in urban condition if-block if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof)) then + .and. col%itype(c) /= icol_roof .and. j <= nlevgrnd) .or. & + (col%itype(c) == icol_sunwall .and. col%itype(c) == icol_shadewall & + .and. col%itype(c) == icol_roof .and. j <= nlevurb)) then + + if (h2osoi_ice(c,j) > 0. .AND. t_soisno(c,j) > tfrz) then imelt(c,j) = 1 ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) + tinc(c,j) = tfrz - t_soisno(c,j) t_soisno(c,j) = tfrz endif @@ -1259,45 +1248,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & if (h2osoi_liq(c,j) > supercool(c,j) .AND. t_soisno(c,j) < tfrz) then imelt(c,j) = 2 ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) - t_soisno(c,j) = tfrz - endif - - ! If snow exists, but its thickness is less than the critical value (0.01 m) - if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8 .AND. j == 1) then - if (t_soisno(c,j) > tfrz) then - imelt(c,j) = 1 - ! tincc,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) - t_soisno(c,j) = tfrz - endif - endif - - endif - - end do - enddo - - do j = 1,nlevurb - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - - if (col%itype(c) == icol_roof .or. col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - - if (h2osoi_ice(c,j) > 0. .AND. t_soisno(c,j) > tfrz) then - imelt(c,j) = 1 - ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) - t_soisno(c,j) = tfrz - endif - - supercool(c,j) = 0.0_r8 - - if (h2osoi_liq(c,j) > supercool(c,j) .AND. t_soisno(c,j) < tfrz) then - imelt(c,j) = 2 - ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) + tinc(c,j) = tfrz - t_soisno(c,j) t_soisno(c,j) = tfrz endif @@ -1316,12 +1267,14 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end do enddo - do j = -nlevsno+1,nlevgrnd ! all layers + do j = -nlevsno+1,nlevmaxurbgrnd ! all layers do fc = 1,num_nolakec c = filter_nolakec(fc) if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof)) then + .and. col%itype(c) /= icol_roof .and. j <= nlevgrnd) .or. & + (col%itype(c) == icol_sunwall .and. col%itype(c) == icol_shadewall & + .and. col%itype(c) == icol_roof .and. j <= nlevurb)) then if (j >= snl(c)+1) then @@ -1390,7 +1343,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & qflx_snomelt(c) = max(0._r8,(temp1-h2osno(c)))/dtime ! kg/(m2 s) ! no snow layers, so qflx_snomelt_lyr is not set xmf(c) = hfus*qflx_snomelt(c) - qflx_snow_drain(c) = qflx_snomelt(c) + qflx_snow_drain(c) = qflx_snomelt(c) endif endif @@ -1442,158 +1395,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end if endif ! end of heatr > 0 if-block - if (j >= 1) then - xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - else - xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - endif - - if (imelt(c,j) == 1 .AND. j < 1) then - qflx_snomelt_lyr(c,j) = max(0._r8,(wice0(c,j)-h2osoi_ice(c,j)))/dtime - qflx_snomelt(c) = qflx_snomelt(c) + qflx_snomelt_lyr(c,j) - endif - - ! layer freezing mass flux (positive): - if (imelt(c,j) == 2 .AND. j < 1) then - qflx_snofrz_lyr(c,j) = max(0._r8,(h2osoi_ice(c,j)-wice0(c,j)))/dtime - qflx_snofrz(c) = qflx_snofrz(c) + qflx_snofrz_lyr(c,j) - endif - - endif - - endif ! end of snow layer if-block - - endif - - end do ! end of column-loop - enddo ! end of level-loop - - do j = -nlevsno+1,nlevurb - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - if (col%itype(c) == icol_roof .or. col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - - if (j >= snl(c)+1) then - - ! Calculate the energy surplus and loss for melting and freezing - if (imelt(c,j) > 0) then - - ! added unique cases for this calculation, - ! to account for absorbed solar radiation in each layer - - !================================================================== - if (j == snl(c)+1) then ! top layer - if(j > 0) then - hm(c,j) = dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j) - else - hm(c,j) = frac_sno_eff(c)*(dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j)) - endif - - if ( j==1 .and. frac_h2osfc(c) /= 0.0_r8 ) then - hm(c,j) = hm(c,j) - frac_h2osfc(c)*(dhsdT(c)*tinc(c,j)) - end if - else if (j == 1) then - hm(c,j) = (1.0_r8 - frac_sno_eff(c) - frac_h2osfc(c)) & - *dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j) - else ! non-interfacial snow/soil layers - if(j < 1) then - hm(c,j) = - frac_sno_eff(c)*(tinc(c,j)/fact(c,j)) - else - hm(c,j) = - tinc(c,j)/fact(c,j) - endif - endif - endif - - ! These two errors were checked carefully (Y. Dai). They result from the - ! computed error of "Tridiagonal-Matrix" in subroutine "thermal". - if (imelt(c,j) == 1 .AND. hm(c,j) < 0._r8) then - hm(c,j) = 0._r8 - imelt(c,j) = 0 - endif - if (imelt(c,j) == 2 .AND. hm(c,j) > 0._r8) then - hm(c,j) = 0._r8 - imelt(c,j) = 0 - endif - - ! The rate of melting and freezing - - if (imelt(c,j) > 0 .and. abs(hm(c,j)) > 0._r8) then - xm(c,j) = hm(c,j)*dtime/hfus ! kg/m2 - - ! If snow exists, but its thickness is less than the critical value - ! (1 cm). Note: more work is needed to determine how to tune the - ! snow depth for this case - if (j == 1) then - if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8 .AND. xm(c,j) > 0._r8) then - temp1 = h2osno(c) ! kg/m2 - h2osno(c) = max(0._r8,temp1-xm(c,j)) - propor = h2osno(c)/temp1 - snow_depth(c) = propor * snow_depth(c) - heatr = hm(c,j) - hfus*(temp1-h2osno(c))/dtime ! W/m2 - if (heatr > 0._r8) then - xm(c,j) = heatr*dtime/hfus ! kg/m2 - hm(c,j) = heatr ! W/m2 - else - xm(c,j) = 0._r8 - hm(c,j) = 0._r8 - endif - qflx_snomelt(c) = max(0._r8,(temp1-h2osno(c)))/dtime ! kg/(m2 s) - ! no snow layers, so qflx_snomelt_lyr is not set - xmf(c) = hfus*qflx_snomelt(c) - qflx_snow_drain(c) = qflx_snomelt(c) - endif - endif - - heatr = 0._r8 - if (xm(c,j) > 0._r8) then - h2osoi_ice(c,j) = max(0._r8, wice0(c,j)-xm(c,j)) - heatr = hm(c,j) - hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - else if (xm(c,j) < 0._r8) then - if (j <= 0) then - h2osoi_ice(c,j) = min(wmass0(c,j), wice0(c,j)-xm(c,j)) ! snow - else - if (wmass0(c,j) < supercool(c,j)) then - h2osoi_ice(c,j) = 0._r8 - else - h2osoi_ice(c,j) = min(wmass0(c,j) - supercool(c,j),wice0(c,j)-xm(c,j)) - endif - endif - heatr = hm(c,j) - hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - endif - - h2osoi_liq(c,j) = max(0._r8,wmass0(c,j)-h2osoi_ice(c,j)) - - if (abs(heatr) > 0._r8) then - if (j == snl(c)+1) then - - if(j==1) then - t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr & - /(1._r8-(1.0_r8 - frac_h2osfc(c))*fact(c,j)*dhsdT(c)) - else - t_soisno(c,j) = t_soisno(c,j) + (fact(c,j)/frac_sno_eff(c))*heatr & - /(1._r8-fact(c,j)*dhsdT(c)) - - endif - - else if (j == 1) then - - t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr & - /(1._r8-(1.0_r8 - frac_sno_eff(c) - frac_h2osfc(c))*fact(c,j)*dhsdT(c)) - else - if(j > 0) then - t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr - else - if(frac_sno_eff(c) > 0._r8) t_soisno(c,j) = t_soisno(c,j) + (fact(c,j)/frac_sno_eff(c))*heatr - endif - endif - - if (j <= 0) then ! snow - if (h2osoi_liq(c,j)*h2osoi_ice(c,j)>0._r8) t_soisno(c,j) = tfrz - end if - endif ! end of heatr > 0 if-block - - if (j >= 1) then + if (j >= 1) then xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime else xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime @@ -1951,35 +1753,12 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti ! tridiagonal matrix and set up vector r and vectors a, b, c that define tridiagonal ! matrix and solve system - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - fact(c,j) = dtime/cv(c,j) * dz(c,j) / (0.5_r8*(z(c,j)-zi(c,j-1)+capr*(z(c,j+1)-zi(c,j-1)))) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j <= nlevgrnd-1) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - dzm = (z(c,j)-z(c,j-1)) - else if (j == nlevgrnd) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = eflx_bot(c) - end if - end if - end if - end do - end do - - do j = -nlevsno+1,nlevurb + do j = -nlevsno+1,nlevmaxurbgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) then + if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then fact(c,j) = dtime/cv(c,j) @@ -2007,6 +1786,21 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti end if end if end if + else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & + .and. col%itype(c) /= icol_roof .and. j <= nlevgrnd) then + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + fact(c,j) = dtime/cv(c,j) * dz(c,j) / (0.5_r8*(z(c,j)-zi(c,j-1)+capr*(z(c,j+1)-zi(c,j-1)))) + fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) + else if (j <= nlevgrnd-1) then + fact(c,j) = dtime/cv(c,j) + fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) + dzm = (z(c,j)-z(c,j-1)) + else if (j == nlevgrnd) then + fact(c,j) = dtime/cv(c,j) + fn(c,j) = eflx_bot(c) + end if + end if end if end do end do From 53aab26f426a1d64733e8fd6aec1441f823601a7 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 15 Oct 2019 08:53:05 -0600 Subject: [PATCH 0411/1973] Fix bugs in SoilTemperatureMod --- src/biogeophys/SoilTemperatureMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 0a43a2058c..f4df66b622 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -1164,7 +1164,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & qflx_snow_drain(c) = 0._r8 end do - do j = -nlevsno+1,nlevgrnd ! all layers + do j = -nlevsno+1,nlevmaxurbgrnd ! all layers do fc = 1,num_nolakec c = filter_nolakec(fc) if (j >= snl(c)+1) then @@ -1223,8 +1223,8 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & ! add in urban condition if-block if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & .and. col%itype(c) /= icol_roof .and. j <= nlevgrnd) .or. & - (col%itype(c) == icol_sunwall .and. col%itype(c) == icol_shadewall & - .and. col%itype(c) == icol_roof .and. j <= nlevurb)) then + ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) .and. j <= nlevurb)) then @@ -1273,8 +1273,8 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & .and. col%itype(c) /= icol_roof .and. j <= nlevgrnd) .or. & - (col%itype(c) == icol_sunwall .and. col%itype(c) == icol_shadewall & - .and. col%itype(c) == icol_roof .and. j <= nlevurb)) then + ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) .and. j <= nlevurb)) then if (j >= snl(c)+1) then From 27d3c83c599f85632e9d7b985486868cba81071c Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 21 Oct 2019 14:53:20 -0600 Subject: [PATCH 0412/1973] working with Bill on sending and reiceving back decomposition from the atmosphere. --- lilac/lilac/demo_driver.F90 | 126 +++++++++++++++++++++++++++++------- lilac/lilac/lilac_mod.F90 | 1 - 2 files changed, 103 insertions(+), 24 deletions(-) diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index 698ac94d68..dd17d17094 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -1,3 +1,94 @@ +module demo_mod +!---------------------------------------------------------------------------- + use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS + use spmdMod , only : masterproc + implicit none + private + public :: demo_init + integer :: ierr + integer :: COMP_COMM + integer :: npts ! domain global size + integer :: num_local +!---------------------------------------------------------------------------- +contains +!---------------------------------------------------------------------------- + subroutine demo_init(gindex_atm) + !! TODO: IS THE INTENT CORRECT FOR GINDEX_ATM + integer , allocatable, intent(inout) :: gindex_atm(:) + integer :: ntasks + integer :: mytask + !----------------------------------------------------------------------------- + ! Initiallize MPI + !----------------------------------------------------------------------------- + + npts = 3312 + ! this is coming from + ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 + call MPI_init(ierr) + COMP_COMM = MPI_COMM_WORLD + + !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 + if (ierr .ne. MPI_SUCCESS) then + print *,'Error starting MPI program. Terminating.' + call MPI_ABORT(MPI_COMM_WORLD, ierr) + end if + + ! + + call MPI_COMM_RANK(COMP_COMM, mytask, ierr) + call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) + + if (masterproc) then + print *, "MPI initialization done ..., ntasks=", ntasks + end if + + call decompInit_atm( ntasks, mytask, gindex_atm) + print *, "gindex_atm for ", mytask,"is: ", gindex_atm + print *, "size gindex_atm for ", mytask,"is: ", size(gindex_atm) + end subroutine demo_init + + subroutine decompInit_atm( ntasks, mytask, gindex_atm) + + ! !DESCRIPTION: + + ! !USES: + + ! !ARGUMENTS: + integer , intent(in) :: ntasks + integer , intent(in) :: mytask + integer , allocatable, intent(out) :: gindex_atm(:) ! this variable is allocated here, and is assumed to start unallocated + ! !LOCAL VARIABLES: + integer :: my_start + integer :: my_end + integer :: i_local + integer :: i_global + !------------------------------------------------------------------------------ + ! create the a global index array for ocean points + + num_local = npts / ntasks + + my_start = num_local*mytask + min(mytask, mod(npts, ntasks)) + 1 + ! The first mod(npts,ntasks) of ntasks are the ones that have an extra point + if (mytask < mod(npts, ntasks)) then + num_local = num_local + 1 + end if + my_end = my_start + num_local - 1 + + allocate(gindex_atm(num_local)) + + i_global = my_start + do i_local = 1, num_local + gindex_atm(i_local) = i_global + i_global = i_global +1 + end do + + end subroutine decompInit_atm + + +end module demo_mod + + + program demo_lilac_driver !---------------------------------------------------------------------------- @@ -12,7 +103,7 @@ program demo_lilac_driver ! atmos cap land cap ____________. ......... gridded components ! | | | ! | | river cap - ! oceaan (MOM, POM)? | | + ! ocean (MOM, POM)? | | ! | Mizzouroute... ! CTSM ! @@ -22,9 +113,10 @@ program demo_lilac_driver ! modules use ESMF use lilac_mod - use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type, atm2lnd_data2d_type, atm2lnd_data2d_type , this_clock + use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type , atm2lnd_data2d_type , atm2lnd_data2d_type , this_clock use clm_varctl , only : iulog use spmdMod , only : masterproc + use demo_mod , only : demo_init implicit none ! TO DO: change the name and the derived data types @@ -52,8 +144,8 @@ program demo_lilac_driver character(*),parameter :: F01 = "(a,i4,d26.19)" character(*),parameter :: F02 = "('[demo_driver]',a,i5,2x,d26.19)" + integer , allocatable :: gindex_atm(:) !------------------------------------------------------------------------ - ! real atmosphere: begc = 1 !endc = 6912/4/2 @@ -126,6 +218,14 @@ program demo_lilac_driver allocate ( lnd2atm%Sl_fv (begc:endc) ) ; lnd2atm%Sl_fv (:) = 0 allocate ( lnd2atm%Sl_ram1 (begc:endc) ) ; lnd2atm%Sl_ram1 (:) = 0 + + + !------------------------------------------------------------------------ + ! The newly added demo_init + !------------------------------------------------------------------------ + + call demo_init(gindex_atm) + !------------------------------------------------------------------------ ! looping over imaginary time .... !------------------------------------------------------------------------ @@ -138,26 +238,6 @@ program demo_lilac_driver call lilac_final ( ) call ESMF_Finalize ( ) - - !do curr_time = start_time, end_time - ! if (curr_time == start_time) then - ! ! Initalization phase - ! !if (masterproc) then - ! print *, "--------------------------" - ! print *, " LILAC Initalization phase" - ! print *, "--------------------------" - ! !end if - ! call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm ) - ! else if (curr_time == end_time ) then - ! ! Finalization phase - ! call lilac_final ( ) - ! call ESMF_Finalize ( ) - ! else - ! call lilac_run ( ) - ! endif - ! itime_step = itime_step + 1 - !end do - print *, "=======================================" print *, " ............. DONE ..................." print *, "=======================================" diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index d462bc3c66..b0545d4105 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -119,7 +119,6 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) ! this is coming from ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 - call MPI_init(ierr) COMP_COMM = MPI_COMM_WORLD !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 From a0549941e107afdca541d13c30ddbea51a5d7d65 Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 21 Oct 2019 14:59:06 -0600 Subject: [PATCH 0413/1973] just cleanup --- lilac/lilac/demo_driver.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index dd17d17094..ef98c2da48 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -189,6 +189,7 @@ program demo_lilac_driver allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 50.0d0 allocate ( atm2lnd%Faxa_swndf (begc:endc) ) ; atm2lnd%Faxa_swndf (:) = 20.0d0 allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) ; atm2lnd%Faxa_swvdf (:) = 40.0d0 + !allocate ( atm2lnd%Faxa_bcph (begc:endc) ) ; atm2lnd%Faxa_bcph (:) = 0.0d0 fldname = 'Sa_topo' @@ -197,7 +198,6 @@ program demo_lilac_driver write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, atm2lnd%Sa_topo(i) enddo end if - !allocate ( atm2lnd%Faxa_bcph (begc:endc) ) ; atm2lnd%Faxa_bcph (:) = 0.0d0 !endc = 18048 ? should this be the size of the land or atmosphere??? From 893f9efe187f85ef0c1152479544fb75eaf0d3a6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 19 Nov 2019 13:47:20 -0700 Subject: [PATCH 0414/1973] removed DEBUG write statement --- src/cpl/nuopc/lnd_import_export.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index eb1b06663a..6fcc84ab80 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -197,7 +197,6 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, rof_prognostic ! Fire emissions fluxes from land call shr_fire_emis_readnl('drv_flds_in', emis_nflds) - write(6,*)'DEBUG: emis_nflds= ',emis_nflds if (emis_nflds > 0) then call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_fire', ungridded_lbound=1, ungridded_ubound=emis_nflds) call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_fztop') From 44ddbbcad845ea65a4f3d6521e7c8e430870356f Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 25 Nov 2019 13:45:14 -0700 Subject: [PATCH 0415/1973] adding decomposition stuff and everything else --- lilac/lilac/atmos_cap.F90 | 12 +- lilac/lilac/demo_driver.F90 | 391 ++++++++++++++++++++++++++++-------- lilac/lilac/demo_mod.F90 | 231 +++++++++++++++++++++ lilac/lilac/demo_utils.F90 | 160 +++++++++++++++ lilac/lilac/lilac_mod.F90 | 21 +- 5 files changed, 717 insertions(+), 98 deletions(-) create mode 100644 lilac/lilac/demo_mod.F90 create mode 100644 lilac/lilac/demo_utils.F90 diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/atmos_cap.F90 index a897c60e51..c56c66cfe7 100644 --- a/lilac/lilac/atmos_cap.F90 +++ b/lilac/lilac/atmos_cap.F90 @@ -18,6 +18,8 @@ module atmos_cap type(ESMF_Field), public , save :: field type(fld_list_type), public , allocatable :: c2a_fldlist(:) type(fld_list_type), public , allocatable :: a2c_fldlist(:) + integer , public , allocatable :: dummy_gindex_atm(:) + integer :: a2c_fldlist_num integer :: c2a_fldlist_num public :: atmos_register @@ -76,11 +78,12 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) type (ESMF_FieldBundle) :: c2a_fb , a2c_fb integer :: n type(ESMF_Mesh) :: atmos_mesh + type(ESMF_Mesh) :: atmos_mesh_tmp character(len=ESMF_MAXSTR) :: atmos_mesh_filepath integer :: petCount, localrc, urc integer :: mid, by2, quart, by4 type(ESMF_Grid) :: atmos_grid - type(ESMF_DistGrid) :: distgridIN, distgridFS + type(ESMF_DistGrid) :: atmos_distgrid logical :: mesh_switch character(len=*), parameter :: subname=trim(modname)//': [atmos_init] ' !integer :: regDecomp(:,:) @@ -110,10 +113,15 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) atmos_mesh_filepath = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - atmos_mesh = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + atmos_mesh_tmp = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out call ESMF_LogWrite(subname//"Mesh for atmosphere is created!", ESMF_LOGMSG_INFO) !print *, "!Mesh for atmosphere is created!" + + atmos_distgrid = ESMF_DistGridCreate (arbSeqIndexList=dummy_gindex_atm, rc=rc) + + ! recreate the mesh using the above distgrid + atmos_mesh = ESMF_MeshCreate(atmos_mesh_tmp, elementDistgrid=atmos_distgrid, rc=rc) else !TODO: Fix how you want to create the grid here if mesh_switch is off diff --git a/lilac/lilac/demo_driver.F90 b/lilac/lilac/demo_driver.F90 index ef98c2da48..2cefc3b73d 100644 --- a/lilac/lilac/demo_driver.F90 +++ b/lilac/lilac/demo_driver.F90 @@ -2,28 +2,37 @@ module demo_mod !---------------------------------------------------------------------------- use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS use spmdMod , only : masterproc + use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type , atm2lnd_data2d_type , atm2lnd_data2d_type , this_clock implicit none private - public :: demo_init - integer :: ierr - integer :: COMP_COMM - integer :: npts ! domain global size - integer :: num_local + public :: demo_init + public :: read_netcdf_mesh + integer :: ierr + integer :: COMP_COMM + integer :: npts ! domain global size + integer :: num_local + integer :: n_points + real, dimension(:,:), allocatable :: centerCoords !---------------------------------------------------------------------------- contains !---------------------------------------------------------------------------- - subroutine demo_init(gindex_atm) + subroutine demo_init(gindex_atm, atm2lnd, lnd2atm) !! TODO: IS THE INTENT CORRECT FOR GINDEX_ATM - integer , allocatable, intent(inout) :: gindex_atm(:) - integer :: ntasks - integer :: mytask + integer , allocatable, intent(inout) :: gindex_atm(:) + type (atm2lnd_data1d_type), intent(inout) :: atm2lnd + type (lnd2atm_data1d_type), intent(inout) :: lnd2atm + integer :: ntasks + integer :: mytask + character(len=128) :: filename + integer :: endc !----------------------------------------------------------------------------- ! Initiallize MPI !----------------------------------------------------------------------------- npts = 3312 - ! this is coming from - ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 + + write(*, *) "MPI initialization starts ..." + call MPI_init(ierr) COMP_COMM = MPI_COMM_WORLD @@ -38,52 +47,295 @@ subroutine demo_init(gindex_atm) call MPI_COMM_RANK(COMP_COMM, mytask, ierr) call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) - if (masterproc) then + if (mytask == 0 ) then print *, "MPI initialization done ..., ntasks=", ntasks end if - + + + !----------------------------------------------------------------------------- + ! Read mesh file to get number of points (n_points) + !----------------------------------------------------------------------------- + filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + call read_netcdf_mesh(filename, n_points) + + !----------------------------------------------------------------------------- + ! atmosphere domain decomposition + !----------------------------------------------------------------------------- + + npts = n_points + print *, "npts for ", mytask, "is:", npts call decompInit_atm( ntasks, mytask, gindex_atm) print *, "gindex_atm for ", mytask,"is: ", gindex_atm print *, "size gindex_atm for ", mytask,"is: ", size(gindex_atm) + + !----------------------------------------------------------------------------- + ! allocate and fill in atm2lnd + !----------------------------------------------------------------------------- + + endc = npts /ntasks + call fill_in (atm2lnd, lnd2atm, 1, endc, gindex_atm) end subroutine demo_init subroutine decompInit_atm( ntasks, mytask, gindex_atm) - ! !DESCRIPTION: + ! !DESCRIPTION: + ! !USES: + + ! !ARGUMENTS: + integer , intent(in) :: ntasks + integer , intent(in) :: mytask + integer , allocatable, intent(out) :: gindex_atm(:) ! this variable is allocated here, and is assumed to start unallocated + ! !LOCAL VARIABLES: + integer :: my_start + integer :: my_end + integer :: i_local + integer :: i_global + !------------------------------------------------------------------------------ + ! create the a global index array for ocean points + + num_local = npts / ntasks + + my_start = num_local*mytask + min(mytask, mod(npts, ntasks)) + 1 + ! The first mod(npts,ntasks) of ntasks are the ones that have an extra point + if (mytask < mod(npts, ntasks)) then + num_local = num_local + 1 + end if + my_end = my_start + num_local - 1 - ! !USES: + allocate(gindex_atm(num_local)) - ! !ARGUMENTS: - integer , intent(in) :: ntasks - integer , intent(in) :: mytask - integer , allocatable, intent(out) :: gindex_atm(:) ! this variable is allocated here, and is assumed to start unallocated - ! !LOCAL VARIABLES: - integer :: my_start - integer :: my_end - integer :: i_local - integer :: i_global - !------------------------------------------------------------------------------ - ! create the a global index array for ocean points + i_global = my_start + do i_local = 1, num_local + gindex_atm(i_local) = i_global + i_global = i_global +1 + end do - num_local = npts / ntasks + end subroutine decompInit_atm - my_start = num_local*mytask + min(mytask, mod(npts, ntasks)) + 1 - ! The first mod(npts,ntasks) of ntasks are the ones that have an extra point - if (mytask < mod(npts, ntasks)) then - num_local = num_local + 1 - end if - my_end = my_start + num_local - 1 + subroutine read_netcdf_mesh(filename, n_points) - allocate(gindex_atm(num_local)) + use netcdf + implicit none - i_global = my_start - do i_local = 1, num_local - gindex_atm(i_local) = i_global - i_global = i_global +1 - end do + ! + ! Parameters + ! - end subroutine decompInit_atm + ! + ! Arguments | Global Variables + ! + character(*) , intent(in) :: filename + integer , intent(inout) :: n_points + + ! + ! Local Variables + ! + integer :: idfile + + integer :: ierror + integer :: dimid_node + integer :: dimid_elem + integer :: dimid_maxnodepe + integer :: dimid_coordDim + + integer :: iddim_node + integer :: iddim_elem + integer :: iddim_maxnodepe + integer :: iddim_coordDim + + integer :: idvar_nodeCoords + integer :: idvar_CenterCoords + + character (len=100) :: string + + + integer :: nnode + integer :: nelem + integer :: maxnodePE + integer :: coordDim + real, dimension(:,:), allocatable :: nodeCoords + !----------------------------------------------------------------------------- + ! Open mesh file and get the idfile + ierror = nf90_open ( filename, NF90_NOWRITE, idfile) ; call nc_check_err(ierror, "opening file", filename) + + ! Get the dimid of dimensions + ierror = nf90_inq_dimid(idfile, 'nodeCount' , dimid_node ) ; call nc_check_err(ierror, "inq_dimid nodeCount", filename) + ierror = nf90_inq_dimid(idfile, 'elementCount' , dimid_elem ); call nc_check_err(ierror, "inq_dimid elementCount", filename) + ierror = nf90_inq_dimid(idfile, 'maxNodePElement' , dimid_maxnodepe ); call nc_check_err(ierror, "inq_dimid maxNodePElement", filename) + ierror = nf90_inq_dimid(idfile, 'coordDim' , dimid_coordDim ); call nc_check_err(ierror, "coordDim", filename) + + ! Inquire dimensions based on their dimeid(s) + ierror = nf90_inquire_dimension(idfile, dimid_node , string, nnode ); call nc_check_err(ierror, "inq_dim nodeCount", filename) + ierror = nf90_inquire_dimension(idfile, dimid_elem , string, nelem ); call nc_check_err(ierror, "inq_dim elementCount", filename) + ierror = nf90_inquire_dimension(idfile, dimid_maxnodepe , string, maxnodePE ); call nc_check_err(ierror, "inq_dim maxNodePElement", filename) + ierror = nf90_inquire_dimension(idfile, dimid_coordDim , string, coordDim ); call nc_check_err(ierror, "inq_dim coordDim", filename) + + print *, "=======================================" + print *, "nnode is : ", nnode + print *, "nelem is : ", nelem + print *, "coordDim is :", coordDim + print *, "=======================================" + + allocate (nodeCoords(coordDim, nnode)) + allocate (centerCoords(coordDim, nelem)) + ! Get variable IDs (varid) + ierror = nf90_inq_varid(idfile, 'nodeCoords' , idvar_nodeCoords ); call nc_check_err(ierror, "inq_varid nodeCoords", filename) + ierror = nf90_inq_varid(idfile, 'centerCoords' , idvar_centerCoords ); call nc_check_err(ierror, "inq_varid centerCoords", filename) + + ! Get variables values from varids + ierror = nf90_get_var(idfile, idvar_nodeCoords , nodeCoords , start=(/ 1,1/) , count=(/ coordDim, nnode /) ); call nc_check_err(ierror,"get_var nodeCoords", filename) + ierror = nf90_get_var(idfile, idvar_CenterCoords , centerCoords , start=(/ 1,1/) , count=(/ coordDim, nelem /) ); call nc_check_err(ierror,"get_var CenterCoords", filename) + + !print *, "lons : ",centerCoords(1,:) + + n_points = nelem + + end subroutine read_netcdf_mesh + + subroutine nc_check_err(ierror, description, filename) + !------------------------------------------------------------------------------- + ! $HeadURL: https://svn.oss.deltares.nl/repos/delft3d/trunk/src/engines_gpl/wave/packages/data/src/nc_check_err.f90 $ + !!--declarations---------------------------------------------------------------- + use netcdf + ! + implicit none + ! + ! Global variables + ! + integer , intent(in) :: ierror + character(*), intent(in) :: description + character(*), intent(in) :: filename + ! + ! Local variables + ! + ! + ! real, parameter :: PI = 3.1415927 + + !! executable statements ------------------------------------------------------- + ! + if (ierror /= nf90_noerr) then + print *, "ERROR" + write (*,'(6a)') 'ERROR ', trim(description), '. NetCDF file : "', trim(filename), '". Error message:', nf90_strerror(ierror) + endif + end subroutine nc_check_err + + subroutine fill_in (atm2lnd , lnd2atm , begc, endc , gindex_atm) + ! !ARGUMENTS: + type (atm2lnd_data1d_type), intent(inout) :: atm2lnd + type (lnd2atm_data1d_type), intent(inout) :: lnd2atm + + integer , intent(in) :: begc + integer , intent(in) :: endc + + + real :: lat + real :: lon + + integer , allocatable, intent(in) :: gindex_atm(:) + !integer :: i + integer :: i_local + integer :: i_global + + + ! tbot is going to be analytical function + + allocate ( atm2lnd%Sa_z (begc:endc) ) !; atm2lnd%Sa_z (:) = 30.0d0 + allocate ( atm2lnd%Sa_topo (begc:endc) ) !; atm2lnd%Sa_topo (:) = 10.0d0 + allocate ( atm2lnd%Sa_u (begc:endc) ) !; atm2lnd%Sa_u (:) = 20.0d0 + allocate ( atm2lnd%Sa_v (begc:endc) ) !; atm2lnd%Sa_v (:) = 40.0d0 + allocate ( atm2lnd%Sa_ptem (begc:endc) ) !; atm2lnd%Sa_ptem (:) = 280.0d0 + allocate ( atm2lnd%Sa_pbot (begc:endc) ) !; atm2lnd%Sa_pbot (:) = 100100.0d0 + allocate ( atm2lnd%Sa_tbot (begc:endc) ) !; atm2lnd%Sa_tbot (:) = 280.0 + allocate ( atm2lnd%Sa_shum (begc:endc) ) !; atm2lnd%Sa_shum (:) = 0.0004d0 + + allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) !; atm2lnd%Faxa_lwdn (:) = 200.0d0 + allocate ( atm2lnd%Faxa_rainc (begc:endc) ) !; atm2lnd%Faxa_rainc (:) = 0.0d0 + allocate ( atm2lnd%Faxa_rainl (begc:endc) ) !; atm2lnd%Faxa_rainl (:) = 3.0d-8 + allocate ( atm2lnd%Faxa_snowc (begc:endc) ) !; atm2lnd%Faxa_snowc (:) = 1.0d-8 + allocate ( atm2lnd%Faxa_snowl (begc:endc) ) !; atm2lnd%Faxa_snowl (:) = 2.0d-8 + + allocate ( atm2lnd%Faxa_swndr (begc:endc) ) !; atm2lnd%Faxa_swndr (:) = 100.0d0 + allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) !; atm2lnd%Faxa_swvdr (:) = 50.0d0 + allocate ( atm2lnd%Faxa_swndf (begc:endc) ) !; atm2lnd%Faxa_swndf (:) = 20.0d0 + allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) !; atm2lnd%Faxa_swvdf (:) = 40.0d0 + + do i_local = begc, endc + + i_global = gindex_atm(i_local) + lon = centerCoords(1,i_global) + lat = centerCoords(2,i_global) + + ! rounding to nearest int + lon = real(nint(lon)) + lat = real(nint(lat)) + ! This is i_local + print *, "i_local is:", i_local, "i_global is :", i_global, "lon:", lon, "lat:", lat + !atm2lnd%Sa_tbot(i_local) = 280.0d0 + (sin (lat)+ cos(lon))*1.0d0 + !atm2lnd%Sa_tbot(i_local) = 280.0d0 + cos(lon)*1.0d0 + + atm2lnd%Sa_z (i_local) = 30.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Sa_topo (i_local) = 10.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Sa_u (i_local) = 20.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Sa_v (i_local) = 40.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Sa_ptem (i_local) = 280.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Sa_pbot (i_local) = 100100.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Sa_tbot (i_local) = 280.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Sa_shum (i_local) = 0.0004d0 !+(lat*0.01d0 + lon*0.01d0)*1.0e-8 + atm2lnd%Faxa_lwdn (i_local) = 200.0d0 + lat *0.01d0 + lon *0.01d0 + + !atm2lnd%Faxa_rainc (i_local) = 0.0d0 + (lat*0.01d0 + lon*0.01d0)*1.0e-8 + atm2lnd%Faxa_rainl (i_local) = 3.0d-8 + (lat*0.01d0 + lon*0.01d0)*1.0e-8 + atm2lnd%Faxa_snowc (i_local) = 1.0d-8 + (lat*0.01d0 + lon*0.01d0)*1.0e-8 + atm2lnd%Faxa_snowl (i_local) = 2.0d-8 + (lat*0.01d0 + lon*0.01d0)*1.0e-8 + atm2lnd%Faxa_swndr (i_local) = 100.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Faxa_swvdr (i_local) = 50.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Faxa_swndf (i_local) = 20.0d0 + lat *0.01d0 + lon *0.01d0 + atm2lnd%Faxa_swvdf (i_local) = 40.0d0 + lat *0.01d0 + lon *0.01d0 + !atm2lnd%Sa_tbot(i) = 280.0 + sin ( lat )*1.0 + !atm2lnd%Sa_tbot(i) = 280.0 + cos(lon)*1.0 + + ! radian instead of degrees: + !lon = lon* PI/180.0 + !lat = lat* PI/180.0 + end do + + !allocating these values from atmosphere for now! + !allocate ( atm2lnd%Sa_z (begc:endc) ) ; atm2lnd%Sa_z (:) = 30.0d0 + !allocate ( atm2lnd%Sa_topo (begc:endc) ) ; atm2lnd%Sa_topo (:) = 10.0d0 + !allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 20.0d0 + !allocate ( atm2lnd%Sa_v (begc:endc) ) ; atm2lnd%Sa_v (:) = 40.0d0 + !allocate ( atm2lnd%Sa_ptem (begc:endc) ) ; atm2lnd%Sa_ptem (:) = 280.0d0 + !allocate ( atm2lnd%Sa_pbot (begc:endc) ) ; atm2lnd%Sa_pbot (:) = 100100.0d0 + !allocate ( atm2lnd%Sa_tbot (begc:endc) ) ; atm2lnd%Sa_tbot (:) = 280.0d0 + !allocate ( atm2lnd%Sa_shum (begc:endc) ) ; atm2lnd%Sa_shum (:) = 0.0004d0 + !allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) ; atm2lnd%Faxa_lwdn (:) = 200.0d0 + !allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 4.0d-8 + allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 0.0d0 + !allocate ( atm2lnd%Faxa_rainl (begc:endc) ) ; atm2lnd%Faxa_rainl (:) = 3.0d-8 + !allocate ( atm2lnd%Faxa_snowc (begc:endc) ) ; atm2lnd%Faxa_snowc (:) = 1.0d-8 + !allocate ( atm2lnd%Faxa_snowl (begc:endc) ) ; atm2lnd%Faxa_snowl (:) = 2.0d-8 + + !allocate ( atm2lnd%Faxa_swndr (begc:endc) ) ; atm2lnd%Faxa_swndr (:) = 100.0d0 + !allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 50.0d0 + !allocate ( atm2lnd%Faxa_swndf (begc:endc) ) ; atm2lnd%Faxa_swndf (:) = 20.0d0 + !allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) ; atm2lnd%Faxa_swvdf (:) = 40.0d0 + !allocate ( atm2lnd%Faxa_bcph (begc:endc) ) ; atm2lnd%Faxa_bcph (:) = 0.0d0 + + + allocate ( lnd2atm%Sl_lfrin (begc:endc) ) ; lnd2atm%Sl_lfrin (:) = 0 + allocate ( lnd2atm%Sl_t (begc:endc) ) ; lnd2atm%Sl_t (:) = 0 + allocate ( lnd2atm%Sl_tref (begc:endc) ) ; lnd2atm%Sl_tref (:) = 0 + allocate ( lnd2atm%Sl_qref (begc:endc) ) ; lnd2atm%Sl_qref (:) = 0 + allocate ( lnd2atm%Sl_avsdr (begc:endc) ) ; lnd2atm%Sl_avsdr (:) = 0 + allocate ( lnd2atm%Sl_anidr (begc:endc) ) ; lnd2atm%Sl_anidr (:) = 0 + allocate ( lnd2atm%Sl_avsdf (begc:endc) ) ; lnd2atm%Sl_avsdf (:) = 0 + allocate ( lnd2atm%Sl_anidf (begc:endc) ) ; lnd2atm%Sl_anidf (:) = 0 + allocate ( lnd2atm%Sl_snowh (begc:endc) ) ; lnd2atm%Sl_snowh (:) = 0 + allocate ( lnd2atm%Sl_u10 (begc:endc) ) ; lnd2atm%Sl_u10 (:) = 0 + allocate ( lnd2atm%Sl_fv (begc:endc) ) ; lnd2atm%Sl_fv (:) = 0 + allocate ( lnd2atm%Sl_ram1 (begc:endc) ) ; lnd2atm%Sl_ram1 (:) = 0 + end subroutine fill_in end module demo_mod @@ -117,6 +369,7 @@ program demo_lilac_driver use clm_varctl , only : iulog use spmdMod , only : masterproc use demo_mod , only : demo_init + use demo_mod , only : read_netcdf_mesh implicit none ! TO DO: change the name and the derived data types @@ -145,6 +398,7 @@ program demo_lilac_driver character(*),parameter :: F01 = "(a,i4,d26.19)" character(*),parameter :: F02 = "('[demo_driver]',a,i5,2x,d26.19)" integer , allocatable :: gindex_atm(:) + !------------------------------------------------------------------------ ! real atmosphere: begc = 1 @@ -169,68 +423,31 @@ program demo_lilac_driver allocate ( rand1 (begc:endc) ) ; call random_number (rand1) allocate ( rand2 (begc:endc) ) ; call random_number (rand2) - !allocating these values from atmosphere for now! - allocate ( atm2lnd%Sa_z (begc:endc) ) ; atm2lnd%Sa_z (:) = 30.0d0 - allocate ( atm2lnd%Sa_topo (begc:endc) ) ; atm2lnd%Sa_topo (:) = 10.0d0 - allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 20.0d0 - allocate ( atm2lnd%Sa_v (begc:endc) ) ; atm2lnd%Sa_v (:) = 40.0d0 - allocate ( atm2lnd%Sa_ptem (begc:endc) ) ; atm2lnd%Sa_ptem (:) = 280.0d0 - allocate ( atm2lnd%Sa_pbot (begc:endc) ) ; atm2lnd%Sa_pbot (:) = 100100.0d0 - allocate ( atm2lnd%Sa_tbot (begc:endc) ) ; atm2lnd%Sa_tbot (:) = 280.0d0 - allocate ( atm2lnd%Sa_shum (begc:endc) ) ; atm2lnd%Sa_shum (:) = 0.0004d0 - allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) ; atm2lnd%Faxa_lwdn (:) = 200.0d0 - !allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 4.0d-8 - allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 0.0d0 - allocate ( atm2lnd%Faxa_rainl (begc:endc) ) ; atm2lnd%Faxa_rainl (:) = 3.0d-8 - allocate ( atm2lnd%Faxa_snowc (begc:endc) ) ; atm2lnd%Faxa_snowc (:) = 1.0d-8 - allocate ( atm2lnd%Faxa_snowl (begc:endc) ) ; atm2lnd%Faxa_snowl (:) = 2.0d-8 - allocate ( atm2lnd%Faxa_swndr (begc:endc) ) ; atm2lnd%Faxa_swndr (:) = 100.0d0 - - allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 50.0d0 - allocate ( atm2lnd%Faxa_swndf (begc:endc) ) ; atm2lnd%Faxa_swndf (:) = 20.0d0 - allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) ; atm2lnd%Faxa_swvdf (:) = 40.0d0 - !allocate ( atm2lnd%Faxa_bcph (begc:endc) ) ; atm2lnd%Faxa_bcph (:) = 0.0d0 - - - fldname = 'Sa_topo' - if (debug > 0) then - do i=begc, endc - write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, atm2lnd%Sa_topo(i) - enddo - end if - - !endc = 18048 ? should this be the size of the land or atmosphere??? - - !print *, atm2lnd%Sa_topo(1:100) + !fldname = 'Sa_topo' + !if (debug > 0) then + ! do i=begc, endc + ! write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, atm2lnd%Sa_topo(i) + ! enddo + ! end if - allocate ( lnd2atm%Sl_lfrin (begc:endc) ) ; lnd2atm%Sl_lfrin (:) = 0 - allocate ( lnd2atm%Sl_t (begc:endc) ) ; lnd2atm%Sl_t (:) = 0 - allocate ( lnd2atm%Sl_tref (begc:endc) ) ; lnd2atm%Sl_tref (:) = 0 - allocate ( lnd2atm%Sl_qref (begc:endc) ) ; lnd2atm%Sl_qref (:) = 0 - allocate ( lnd2atm%Sl_avsdr (begc:endc) ) ; lnd2atm%Sl_avsdr (:) = 0 - allocate ( lnd2atm%Sl_anidr (begc:endc) ) ; lnd2atm%Sl_anidr (:) = 0 - allocate ( lnd2atm%Sl_avsdf (begc:endc) ) ; lnd2atm%Sl_avsdf (:) = 0 - allocate ( lnd2atm%Sl_anidf (begc:endc) ) ; lnd2atm%Sl_anidf (:) = 0 - allocate ( lnd2atm%Sl_snowh (begc:endc) ) ; lnd2atm%Sl_snowh (:) = 0 - allocate ( lnd2atm%Sl_u10 (begc:endc) ) ; lnd2atm%Sl_u10 (:) = 0 - allocate ( lnd2atm%Sl_fv (begc:endc) ) ; lnd2atm%Sl_fv (:) = 0 - allocate ( lnd2atm%Sl_ram1 (begc:endc) ) ; lnd2atm%Sl_ram1 (:) = 0 + !print *, atm2lnd%Sa_topo(1:100) !------------------------------------------------------------------------ ! The newly added demo_init + ! all allocate will go here: !------------------------------------------------------------------------ - call demo_init(gindex_atm) + call demo_init(gindex_atm, atm2lnd , lnd2atm) !------------------------------------------------------------------------ ! looping over imaginary time .... !------------------------------------------------------------------------ - call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm ) + call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm , gindex_atm = gindex_atm ) do curr_time = start_time, end_time call lilac_run ( ) itime_step = itime_step + 1 diff --git a/lilac/lilac/demo_mod.F90 b/lilac/lilac/demo_mod.F90 new file mode 100644 index 0000000000..7b077afcbf --- /dev/null +++ b/lilac/lilac/demo_mod.F90 @@ -0,0 +1,231 @@ +module demo_mod +!---------------------------------------------------------------------------- + use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS + use spmdMod , only : masterproc + implicit none + private + public :: demo_init + public :: read_netcdf_mesh + integer :: ierr + integer :: COMP_COMM + integer :: npts ! domain global size + integer :: num_local +!---------------------------------------------------------------------------- +contains +!---------------------------------------------------------------------------- + subroutine demo_init(gindex_atm) + !! TODO: IS THE INTENT CORRECT FOR GINDEX_ATM + integer , allocatable, intent(inout) :: gindex_atm(:) + integer :: ntasks + integer :: mytask + !----------------------------------------------------------------------------- + ! Initiallize MPI + !----------------------------------------------------------------------------- + + npts = 3312 + ! this is coming from + ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 + call MPI_init(ierr) + COMP_COMM = MPI_COMM_WORLD + + !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 + if (ierr .ne. MPI_SUCCESS) then + print *,'Error starting MPI program. Terminating.' + call MPI_ABORT(MPI_COMM_WORLD, ierr) + end if + + ! + + call MPI_COMM_RANK(COMP_COMM, mytask, ierr) + call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) + + if (masterproc) then + print *, "MPI initialization done ..., ntasks=", ntasks + end if + + call decompInit_atm( ntasks, mytask, gindex_atm) + print *, "gindex_atm for ", mytask,"is: ", gindex_atm + print *, "size gindex_atm for ", mytask,"is: ", size(gindex_atm) + end subroutine demo_init + + subroutine decompInit_atm( ntasks, mytask, gindex_atm) + + ! !DESCRIPTION: + + ! !USES: + + ! !ARGUMENTS: + integer , intent(in) :: ntasks + integer , intent(in) :: mytask + integer , allocatable, intent(out) :: gindex_atm(:) ! this variable is allocated here, and is assumed to start unallocated + ! !LOCAL VARIABLES: + integer :: my_start + integer :: my_end + integer :: i_local + integer :: i_global + !------------------------------------------------------------------------------ + ! create the a global index array for ocean points + + num_local = npts / ntasks + + my_start = num_local*mytask + min(mytask, mod(npts, ntasks)) + 1 + ! The first mod(npts,ntasks) of ntasks are the ones that have an extra point + if (mytask < mod(npts, ntasks)) then + num_local = num_local + 1 + end if + my_end = my_start + num_local - 1 + + allocate(gindex_atm(num_local)) + + i_global = my_start + do i_local = 1, num_local + gindex_atm(i_local) = i_global + i_global = i_global +1 + end do + + end subroutine decompInit_atm + + subroutine read_netcdf_mesh(filename) + + use netcdf + implicit none + + ! + ! Parameters + ! + + ! + ! Arguments | Global Variables + ! + character(*) , intent(in) :: filename + + + ! + ! Local Variables + ! + + integer :: idfile + + integer :: ierror + integer :: dimid_node + integer :: dimid_elem + integer :: dimid_maxnodepe + integer :: dimid_coordDim + + integer :: iddim_node + integer :: iddim_elem + integer :: iddim_maxnodepe + integer :: iddim_coordDim + + integer :: idvar_nodeCoords + integer :: idvar_CenterCoords + + character (len=100) :: string + + + integer :: nnode + integer :: nelem + integer :: maxnodePE + integer :: coordDim + real, dimension(:,:), allocatable :: centerCoords + real, dimension(:,:), allocatable :: nodeCoords + !----------------------------------------------------------------------------- + ! Open mesh file and get the idfile + ierror = nf90_open ( filename, NF90_NOWRITE, idfile) ; call nc_check_err(ierror, "opening file", filename) + + ! Get the dimid of dimensions + ierror = nf90_inq_dimid(idfile, 'nodeCount' , dimid_node ) ; call nc_check_err(ierror, "inq_dimid nodeCount", filename) + ierror = nf90_inq_dimid(idfile, 'elementCount' , dimid_elem ); call nc_check_err(ierror, "inq_dimid elementCount", filename) + ierror = nf90_inq_dimid(idfile, 'maxNodePElement' , dimid_maxnodepe ); call nc_check_err(ierror, "inq_dimid maxNodePElement", filename) + ierror = nf90_inq_dimid(idfile, 'coordDim' , dimid_coordDim ); call nc_check_err(ierror, "coordDim", filename) + + ! Inquire dimensions based on their dimeid(s) + ierror = nf90_inquire_dimension(idfile, dimid_node , string, nnode ); call nc_check_err(ierror, "inq_dim nodeCount", filename) + ierror = nf90_inquire_dimension(idfile, dimid_elem , string, nelem ); call nc_check_err(ierror, "inq_dim elementCount", filename) + ierror = nf90_inquire_dimension(idfile, dimid_maxnodepe , string, maxnodePE ); call nc_check_err(ierror, "inq_dim maxNodePElement", filename) + ierror = nf90_inquire_dimension(idfile, dimid_coordDim , string, coordDim ); call nc_check_err(ierror, "inq_dim coordDim", filename) + + print *, "=======================================" + print *, "nnode is : ", nnode + print *, "nelem is : ", nelem + print *, "coordDim is :", coordDim + print *, "=======================================" + + allocate (nodeCoords(coordDim, nnode)) + allocate (centerCoords(coordDim, nelem)) + ! Get variable IDs (varid) + ierror = nf90_inq_varid(idfile, 'nodeCoords' , idvar_nodeCoords ); call nc_check_err(ierror, "inq_varid nodeCoords", filename) + ierror = nf90_inq_varid(idfile, 'centerCoords' , idvar_centerCoords ); call nc_check_err(ierror, "inq_varid centerCoords", filename) + + ! Get variables values from varids + ierror = nf90_get_var(idfile, idvar_nodeCoords , nodeCoords , start=(/ 1,1/) , count=(/ coordDim, nnode /) ); call nc_check_err(ierror,"get_var nodeCoords", filename) + ierror = nf90_get_var(idfile, idvar_CenterCoords , centerCoords , start=(/ 1,1/) , count=(/ coordDim, nelem /) ); call nc_check_err(ierror,"get_var CenterCoords", filename) + + print *, "lons : ",centerCoords(1,:) + + end subroutine read_netcdf_mesh + +subroutine nc_check_err(ierror, description, filename) +!----- GPL --------------------------------------------------------------------- +! +! Copyright (C) Stichting Deltares, 2011-2018. +! +! This program is free software: you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation version 3. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program. If not, see . +! +! contact: delft3d.support@deltares.nl +! Stichting Deltares +! P.O. Box 177 +! 2600 MH Delft, The Netherlands +! +! All indications and logos of, and references to, "Delft3D" and "Deltares" +! are registered trademarks of Stichting Deltares, and remain the property of +! Stichting Deltares. All rights reserved. +! +!------------------------------------------------------------------------------- +! $Id: nc_check_err.f90 7992 2018-01-09 10:27:35Z mourits $ +! $HeadURL: https://svn.oss.deltares.nl/repos/delft3d/trunk/src/engines_gpl/wave/packages/data/src/nc_check_err.f90 $ +!!--description----------------------------------------------------------------- +! NONE +!!--pseudo code and references-------------------------------------------------- +! NONE +!!--declarations---------------------------------------------------------------- + use netcdf + ! + implicit none +! +! Global variables +! + integer , intent(in) :: ierror + character(*), intent(in) :: description + character(*), intent(in) :: filename +! +! Local variables +! +! +!! executable statements ------------------------------------------------------- +! + if (ierror /= nf90_noerr) then + print *, "ERROR" + write (*,'(6a)') 'ERROR ', trim(description), '. NetCDF file : "', trim(filename), '". Error message:', nf90_strerror(ierror) + endif +end subroutine nc_check_err + + + + + + + +end module demo_mod + + diff --git a/lilac/lilac/demo_utils.F90 b/lilac/lilac/demo_utils.F90 new file mode 100644 index 0000000000..6189145936 --- /dev/null +++ b/lilac/lilac/demo_utils.F90 @@ -0,0 +1,160 @@ +module demo_utils +!---------------------------------------------------------------------------- + use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS + use spmdMod , only : masterproc + implicit none + private + public :: demo_init + public :: read_netcdf_mesh + integer :: ierr + integer :: COMP_COMM + integer :: npts ! domain global size + integer :: num_local +!---------------------------------------------------------------------------- +contains +!---------------------------------------------------------------------------- + subroutine demo_init(gindex_atm) + !! TODO: IS THE INTENT CORRECT FOR GINDEX_ATM + integer , allocatable, intent(inout) :: gindex_atm(:) + integer :: ntasks + integer :: mytask + !----------------------------------------------------------------------------- + ! Initiallize MPI + !----------------------------------------------------------------------------- + + npts = 3312 + ! this is coming from + ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 + call MPI_init(ierr) + COMP_COMM = MPI_COMM_WORLD + + !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 + if (ierr .ne. MPI_SUCCESS) then + print *,'Error starting MPI program. Terminating.' + call MPI_ABORT(MPI_COMM_WORLD, ierr) + end if + + ! + + call MPI_COMM_RANK(COMP_COMM, mytask, ierr) + call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) + + if (masterproc) then + print *, "MPI initialization done ..., ntasks=", ntasks + end if + + call decompInit_atm( ntasks, mytask, gindex_atm) + print *, "gindex_atm for ", mytask,"is: ", gindex_atm + print *, "size gindex_atm for ", mytask,"is: ", size(gindex_atm) + end subroutine demo_init + + subroutine decompInit_atm( ntasks, mytask, gindex_atm) + + ! !DESCRIPTION: + + ! !USES: + + ! !ARGUMENTS: + integer , intent(in) :: ntasks + integer , intent(in) :: mytask + integer , allocatable, intent(out) :: gindex_atm(:) ! this variable is allocated here, and is assumed to start unallocated + ! !LOCAL VARIABLES: + integer :: my_start + integer :: my_end + integer :: i_local + integer :: i_global + !------------------------------------------------------------------------------ + ! create the a global index array for ocean points + + num_local = npts / ntasks + + my_start = num_local*mytask + min(mytask, mod(npts, ntasks)) + 1 + ! The first mod(npts,ntasks) of ntasks are the ones that have an extra point + if (mytask < mod(npts, ntasks)) then + num_local = num_local + 1 + end if + my_end = my_start + num_local - 1 + + allocate(gindex_atm(num_local)) + + i_global = my_start + do i_local = 1, num_local + gindex_atm(i_local) = i_global + i_global = i_global +1 + end do + + end subroutine decompInit_atm + + subroutine read_netcdf_mesh(filename) + + use netcdf + implicit none + + ! + ! Parameters + ! + + ! + ! Arguments | Global Variables + ! + character(*) , intent(in) :: filename + + + ! + ! Local Variables + ! + + integer :: idfile + + integer :: ierror + integer :: dimid_node + integer :: dimid_elem + integer :: dimid_maxnodepe + integer :: dimid_coordDim + + integer :: iddim_node + integer :: iddim_elem + integer :: iddim_maxnodepe + integer :: iddim_coordDim + + integer :: idvar_nodeCoords + integer :: idvar_CenterCoords + + character (len=100) :: string + + integer :: nnode + integer :: nelem + integer :: maxnodePE + integer :: coordDim + !----------------------------------------------------------------------------- + ! Open mesh file and get the idfile + ierror = nf90_open ( filename, NF90_NOWRITE, idfile); call nc_check_err(ierror, "opening file", filename) + + ! Get the dimid of dimensions + ierror = nf90_inq_dimid(idfile, 'nodeCount' , dimid_node ); call nc_check_err(ierror, "inq_dimid nodeCount", filename) + ierror = nf90_inq_dimid(idfile, 'elementCount' , dimid_elem ); call nc_check_err(ierror, "inq_dimid elementCount", filename) + ierror = nf90_inq_dimid(idfile, 'maxNodePElement' , dimid_maxnodepe ); call nc_check_err(ierror, "inq_dimid maxNodePElement", filename) + ierror = nf90_inq_dimid(idfile, 'coordDim' , dimid_coordDim ); call nc_check_err(ierror, "coordDim", filename) + + ! Inquire dimensions based on their dimeid(s) + ierror = nf90_inquire_dimension(idfile, iddim_node , string, nnode ); call nc_check_err(ierror, "inq_dim nodeCount", filename) + ierror = nf90_inquire_dimension(idfile, iddim_elem , string, nelem ); call nc_check_err(ierror, "inq_dim elementCount", filename) + ierror = nf90_inquire_dimension(idfile, iddim_maxnodepe , string, maxnodePE ); call nc_check_err(ierror, "inq_dim maxNodePElement", filename) + ierror = nf90_inquire_dimension(idfile, iddim_coordDim , string, coordDim ); call nc_check_err(ierror, "inq_dim coordDim", filename) + + + ! Get variable IDs (varid) + ierror = nf90_inq_varid(idfile, 'nodeCoords' , idvar_nodeCoords ); call nc_check_err(ierror, "inq_varid nodeCoords", filename) + ierror = nf90_inq_varid(idfile, 'CenterCoords' , idvar_CenterCoords ); call nc_check_err(ierror, "inq_varid CenterCoords", filename) + + ! Get variables values from varids + !ierror = nf90_get_var(idfile, idvar_nodeCoords , nodeCoords , start=(/ 1,1/) , count=(/ nnode, coordDim /) ); call nc_check_err(ierror,"get_var nodeCoords", filename) + !ierror = nf90_get_var(idfile, idvar_CenterCoords , CenterCoords , start=(/ 1,1/) , count=(/ nelem, coordDim /) ); call nc_check_err(ierror,"get_var CenterCoords", filename) + + + + + end subroutine read_netcdf_mesh + +end module demo_utils + diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index b0545d4105..1e53604cb6 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -54,19 +54,21 @@ module lilac_mod contains !======================================================================== - subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) + subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d, gindex_atm) use atmos_cap , only : a2c_fldlist , c2a_fldlist + use atmos_cap , only : dummy_gindex_atm use lnd_cap , only : l2c_fldlist , c2l_fldlist character(len=*), parameter :: subname=trim(modname)//': [lilac_init] ' ! input/output variables - type(atm2lnd_data1d_type), intent(in), optional :: atm2lnd1d - type(atm2lnd_data2d_type), intent(in), optional :: atm2lnd2d - type(lnd2atm_data1d_type), intent(in), optional :: lnd2atm1d - type(lnd2atm_data2d_type), intent(in), optional :: lnd2atm2d + type(atm2lnd_data1d_type), intent(in), optional :: atm2lnd1d + type(atm2lnd_data2d_type), intent(in), optional :: atm2lnd2d + type(lnd2atm_data1d_type), intent(in), optional :: lnd2atm1d + type(lnd2atm_data2d_type), intent(in), optional :: lnd2atm2d + integer , allocatable :: gindex_atm(:) ! local variables type(ESMF_State) :: importState, exportState @@ -122,10 +124,10 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) COMP_COMM = MPI_COMM_WORLD !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 - if (ierr .ne. MPI_SUCCESS) then - print *,'Error starting MPI program. Terminating.' - call MPI_ABORT(MPI_COMM_WORLD, ierr) - end if + !if (ierr .ne. MPI_SUCCESS) then + ! print *,'Error starting MPI program. Terminating.' + ! call MPI_ABORT(MPI_COMM_WORLD, ierr) + !end if ! @@ -279,6 +281,7 @@ subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d) + dummy_gindex_atm = gindex_atm ! ======================================================================== !------------------------------------------------------------------------- From afd735fb0bc9bf7fedec851336b5c01ec2ba289a Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 25 Nov 2019 23:21:14 -0700 Subject: [PATCH 0416/1973] small changes in the Makefile... --- lilac/lilac/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/lilac/Makefile b/lilac/lilac/Makefile index 77ebef6d87..feab757abf 100644 --- a/lilac/lilac/Makefile +++ b/lilac/lilac/Makefile @@ -83,10 +83,10 @@ demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_c # module dependencies: #demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o -demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o +demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o demo_utils.o demo_mod.o lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o #shr_pio_mod.o atmos_cap.o: lilac_utils.o - +demo_mod.o: # ----------------------------------------------------------------------------- .PHONY: clean berzerk remake From dc10dd23b91d92e34accbae99ef0a8c1ec812ad6 Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 25 Nov 2019 23:22:36 -0700 Subject: [PATCH 0417/1973] the latest version of the CMakeLists. This is not working... --- lilac/CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lilac/CMakeLists.txt b/lilac/CMakeLists.txt index 7d45799a7d..89ae531242 100644 --- a/lilac/CMakeLists.txt +++ b/lilac/CMakeLists.txt @@ -188,11 +188,6 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_COMPILER_LINE}") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_LINK_LINE} -g -cpp") -# TODO: This should not be necessary but certain header files are missing from the build -#set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I /usr/include/ -I/usr/src/lilac/external/esmf/src/Infrastructure/Util/include -I/usr/src/lilac/external/esmf/build_config/Linux.gfortran.default -I /usr/src/lilac/external/esmf/src/include") -#set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/usr/include/ -I/usr/src/esmf/src/Infrastructure/Util/include/ -I/usr/src/esmf/build_config/Linux.gfortran.default -I /usr/src/esmf/src/include") -#set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/include -L/glade/scratch/negins/baghale6/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/lib -lclm -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/nuopc/esmf/c1a1l1/lib -lcsm_share -L/glade/scratch/negins/test_clean/bld/intel/mpt/nodebug/nothreads/nuopc/lib -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2/lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib ") - message(STATUS "==============================================================") message(STATUS "Fortran Compiler : ${CMAKE_Fortran_COMPILER}") @@ -215,6 +210,6 @@ file(GLOB_RECURSE SOURCES lilac/*.F90) add_executable (${PROJECT_NAME}.exe ${SOURCES}) target_link_libraries(${PROJECT_NAME}.exe ${LIB_TO_INCLUDE}) -#demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o + #add_subdirectory(lilac) #add_subdirectory(tests) From 4ce5985f451dfc8cdfc5afe9a1cc31696e7ee47c Mon Sep 17 00:00:00 2001 From: negin513 Date: Mon, 25 Nov 2019 23:27:57 -0700 Subject: [PATCH 0418/1973] tiny changes in printing outputs.... --- src/cpl/lilac/lnd_comp_esmf.F90 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index ac980e4b4b..ddf03eb6a8 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -897,22 +897,23 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) doalb = (nextsw_cday >= -0.5_r8) end if - if (masterproc) then - write(iulog,*) 'doalb is: ', doalb - end if if (masterproc) then write(iulog,*) '------------ LILAC ----------------' write(iulog,*) 'nstep : ', nstep write(iulog,*) 'dtime : ', dtime - write(iulog,*) 'calday : ', calday - write(iulog,*) 'caldayp1 : ', caldayp1 - write(iulog,*) 'nextsw_cday : ', nextsw_cday + write(iulog,F02) 'calday : ', calday + write(iulog,F02) 'caldayp1 : ', caldayp1 + write(iulog,F02) 'nextsw_cday : ', nextsw_cday write(iulog,*) '-------------------------------------' end if call update_rad_dtime(doalb) + if (masterproc) then + write(iulog,*) 'doalb is: ', doalb + end if + !-------------------------------- ! Determine if time to write restart !-------------------------------- @@ -961,6 +962,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) if (masterproc) then write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + write(iulog,* ) 'doalb : ', doalb write(iulog,*) 'call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, decl' write(iulog,*) 'call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, decl' write(iulog,F02) 'calday is : ', calday @@ -969,7 +971,6 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) write(iulog,F02) 'lambm0 is : ', lambm0 write(iulog,F02) 'obliqr is : ', obliqr write(iulog,F02) 'clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic)' - write(iulog,* ) 'doalb : ', doalb write(iulog,F02) 'declin is : ', declin write(iulog,F02) 'declinp1 is : ', declinp1 write(iulog,F02) 'rof_prognostic : ', rof_prognostic From cdb48e599a87ecea39339782769ec69c3adf5e61 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 26 Nov 2019 10:27:43 -0700 Subject: [PATCH 0419/1973] renamed files in lilac/ and created a new atm_driver directory and moved the atm_driver.F90 to there --- lilac/{lilac => atm_driver}/Makefile | 0 .../atm_driver.F90} | 0 lilac/lilac/demo_mod.F90 | 231 ---------------- lilac/lilac/demo_utils.F90 | 160 ----------- .../lilac/{atmos_cap.F90 => lilac_atmcap.F90} | 0 lilac/lilac/{cpl_mod.F90 => lilac_cpl.F90} | 0 lilac/lilac/lnd_cap.F90 | 250 ------------------ 7 files changed, 641 deletions(-) rename lilac/{lilac => atm_driver}/Makefile (100%) rename lilac/{lilac/demo_driver.F90 => atm_driver/atm_driver.F90} (100%) delete mode 100644 lilac/lilac/demo_mod.F90 delete mode 100644 lilac/lilac/demo_utils.F90 rename lilac/lilac/{atmos_cap.F90 => lilac_atmcap.F90} (100%) rename lilac/lilac/{cpl_mod.F90 => lilac_cpl.F90} (100%) delete mode 100644 lilac/lilac/lnd_cap.F90 diff --git a/lilac/lilac/Makefile b/lilac/atm_driver/Makefile similarity index 100% rename from lilac/lilac/Makefile rename to lilac/atm_driver/Makefile diff --git a/lilac/lilac/demo_driver.F90 b/lilac/atm_driver/atm_driver.F90 similarity index 100% rename from lilac/lilac/demo_driver.F90 rename to lilac/atm_driver/atm_driver.F90 diff --git a/lilac/lilac/demo_mod.F90 b/lilac/lilac/demo_mod.F90 deleted file mode 100644 index 7b077afcbf..0000000000 --- a/lilac/lilac/demo_mod.F90 +++ /dev/null @@ -1,231 +0,0 @@ -module demo_mod -!---------------------------------------------------------------------------- - use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS - use spmdMod , only : masterproc - implicit none - private - public :: demo_init - public :: read_netcdf_mesh - integer :: ierr - integer :: COMP_COMM - integer :: npts ! domain global size - integer :: num_local -!---------------------------------------------------------------------------- -contains -!---------------------------------------------------------------------------- - subroutine demo_init(gindex_atm) - !! TODO: IS THE INTENT CORRECT FOR GINDEX_ATM - integer , allocatable, intent(inout) :: gindex_atm(:) - integer :: ntasks - integer :: mytask - !----------------------------------------------------------------------------- - ! Initiallize MPI - !----------------------------------------------------------------------------- - - npts = 3312 - ! this is coming from - ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 - call MPI_init(ierr) - COMP_COMM = MPI_COMM_WORLD - - !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 - if (ierr .ne. MPI_SUCCESS) then - print *,'Error starting MPI program. Terminating.' - call MPI_ABORT(MPI_COMM_WORLD, ierr) - end if - - ! - - call MPI_COMM_RANK(COMP_COMM, mytask, ierr) - call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) - - if (masterproc) then - print *, "MPI initialization done ..., ntasks=", ntasks - end if - - call decompInit_atm( ntasks, mytask, gindex_atm) - print *, "gindex_atm for ", mytask,"is: ", gindex_atm - print *, "size gindex_atm for ", mytask,"is: ", size(gindex_atm) - end subroutine demo_init - - subroutine decompInit_atm( ntasks, mytask, gindex_atm) - - ! !DESCRIPTION: - - ! !USES: - - ! !ARGUMENTS: - integer , intent(in) :: ntasks - integer , intent(in) :: mytask - integer , allocatable, intent(out) :: gindex_atm(:) ! this variable is allocated here, and is assumed to start unallocated - ! !LOCAL VARIABLES: - integer :: my_start - integer :: my_end - integer :: i_local - integer :: i_global - !------------------------------------------------------------------------------ - ! create the a global index array for ocean points - - num_local = npts / ntasks - - my_start = num_local*mytask + min(mytask, mod(npts, ntasks)) + 1 - ! The first mod(npts,ntasks) of ntasks are the ones that have an extra point - if (mytask < mod(npts, ntasks)) then - num_local = num_local + 1 - end if - my_end = my_start + num_local - 1 - - allocate(gindex_atm(num_local)) - - i_global = my_start - do i_local = 1, num_local - gindex_atm(i_local) = i_global - i_global = i_global +1 - end do - - end subroutine decompInit_atm - - subroutine read_netcdf_mesh(filename) - - use netcdf - implicit none - - ! - ! Parameters - ! - - ! - ! Arguments | Global Variables - ! - character(*) , intent(in) :: filename - - - ! - ! Local Variables - ! - - integer :: idfile - - integer :: ierror - integer :: dimid_node - integer :: dimid_elem - integer :: dimid_maxnodepe - integer :: dimid_coordDim - - integer :: iddim_node - integer :: iddim_elem - integer :: iddim_maxnodepe - integer :: iddim_coordDim - - integer :: idvar_nodeCoords - integer :: idvar_CenterCoords - - character (len=100) :: string - - - integer :: nnode - integer :: nelem - integer :: maxnodePE - integer :: coordDim - real, dimension(:,:), allocatable :: centerCoords - real, dimension(:,:), allocatable :: nodeCoords - !----------------------------------------------------------------------------- - ! Open mesh file and get the idfile - ierror = nf90_open ( filename, NF90_NOWRITE, idfile) ; call nc_check_err(ierror, "opening file", filename) - - ! Get the dimid of dimensions - ierror = nf90_inq_dimid(idfile, 'nodeCount' , dimid_node ) ; call nc_check_err(ierror, "inq_dimid nodeCount", filename) - ierror = nf90_inq_dimid(idfile, 'elementCount' , dimid_elem ); call nc_check_err(ierror, "inq_dimid elementCount", filename) - ierror = nf90_inq_dimid(idfile, 'maxNodePElement' , dimid_maxnodepe ); call nc_check_err(ierror, "inq_dimid maxNodePElement", filename) - ierror = nf90_inq_dimid(idfile, 'coordDim' , dimid_coordDim ); call nc_check_err(ierror, "coordDim", filename) - - ! Inquire dimensions based on their dimeid(s) - ierror = nf90_inquire_dimension(idfile, dimid_node , string, nnode ); call nc_check_err(ierror, "inq_dim nodeCount", filename) - ierror = nf90_inquire_dimension(idfile, dimid_elem , string, nelem ); call nc_check_err(ierror, "inq_dim elementCount", filename) - ierror = nf90_inquire_dimension(idfile, dimid_maxnodepe , string, maxnodePE ); call nc_check_err(ierror, "inq_dim maxNodePElement", filename) - ierror = nf90_inquire_dimension(idfile, dimid_coordDim , string, coordDim ); call nc_check_err(ierror, "inq_dim coordDim", filename) - - print *, "=======================================" - print *, "nnode is : ", nnode - print *, "nelem is : ", nelem - print *, "coordDim is :", coordDim - print *, "=======================================" - - allocate (nodeCoords(coordDim, nnode)) - allocate (centerCoords(coordDim, nelem)) - ! Get variable IDs (varid) - ierror = nf90_inq_varid(idfile, 'nodeCoords' , idvar_nodeCoords ); call nc_check_err(ierror, "inq_varid nodeCoords", filename) - ierror = nf90_inq_varid(idfile, 'centerCoords' , idvar_centerCoords ); call nc_check_err(ierror, "inq_varid centerCoords", filename) - - ! Get variables values from varids - ierror = nf90_get_var(idfile, idvar_nodeCoords , nodeCoords , start=(/ 1,1/) , count=(/ coordDim, nnode /) ); call nc_check_err(ierror,"get_var nodeCoords", filename) - ierror = nf90_get_var(idfile, idvar_CenterCoords , centerCoords , start=(/ 1,1/) , count=(/ coordDim, nelem /) ); call nc_check_err(ierror,"get_var CenterCoords", filename) - - print *, "lons : ",centerCoords(1,:) - - end subroutine read_netcdf_mesh - -subroutine nc_check_err(ierror, description, filename) -!----- GPL --------------------------------------------------------------------- -! -! Copyright (C) Stichting Deltares, 2011-2018. -! -! This program is free software: you can redistribute it and/or modify -! it under the terms of the GNU General Public License as published by -! the Free Software Foundation version 3. -! -! This program is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -! GNU General Public License for more details. -! -! You should have received a copy of the GNU General Public License -! along with this program. If not, see . -! -! contact: delft3d.support@deltares.nl -! Stichting Deltares -! P.O. Box 177 -! 2600 MH Delft, The Netherlands -! -! All indications and logos of, and references to, "Delft3D" and "Deltares" -! are registered trademarks of Stichting Deltares, and remain the property of -! Stichting Deltares. All rights reserved. -! -!------------------------------------------------------------------------------- -! $Id: nc_check_err.f90 7992 2018-01-09 10:27:35Z mourits $ -! $HeadURL: https://svn.oss.deltares.nl/repos/delft3d/trunk/src/engines_gpl/wave/packages/data/src/nc_check_err.f90 $ -!!--description----------------------------------------------------------------- -! NONE -!!--pseudo code and references-------------------------------------------------- -! NONE -!!--declarations---------------------------------------------------------------- - use netcdf - ! - implicit none -! -! Global variables -! - integer , intent(in) :: ierror - character(*), intent(in) :: description - character(*), intent(in) :: filename -! -! Local variables -! -! -!! executable statements ------------------------------------------------------- -! - if (ierror /= nf90_noerr) then - print *, "ERROR" - write (*,'(6a)') 'ERROR ', trim(description), '. NetCDF file : "', trim(filename), '". Error message:', nf90_strerror(ierror) - endif -end subroutine nc_check_err - - - - - - - -end module demo_mod - - diff --git a/lilac/lilac/demo_utils.F90 b/lilac/lilac/demo_utils.F90 deleted file mode 100644 index 6189145936..0000000000 --- a/lilac/lilac/demo_utils.F90 +++ /dev/null @@ -1,160 +0,0 @@ -module demo_utils -!---------------------------------------------------------------------------- - use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS - use spmdMod , only : masterproc - implicit none - private - public :: demo_init - public :: read_netcdf_mesh - integer :: ierr - integer :: COMP_COMM - integer :: npts ! domain global size - integer :: num_local -!---------------------------------------------------------------------------- -contains -!---------------------------------------------------------------------------- - subroutine demo_init(gindex_atm) - !! TODO: IS THE INTENT CORRECT FOR GINDEX_ATM - integer , allocatable, intent(inout) :: gindex_atm(:) - integer :: ntasks - integer :: mytask - !----------------------------------------------------------------------------- - ! Initiallize MPI - !----------------------------------------------------------------------------- - - npts = 3312 - ! this is coming from - ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 - call MPI_init(ierr) - COMP_COMM = MPI_COMM_WORLD - - !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 - if (ierr .ne. MPI_SUCCESS) then - print *,'Error starting MPI program. Terminating.' - call MPI_ABORT(MPI_COMM_WORLD, ierr) - end if - - ! - - call MPI_COMM_RANK(COMP_COMM, mytask, ierr) - call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) - - if (masterproc) then - print *, "MPI initialization done ..., ntasks=", ntasks - end if - - call decompInit_atm( ntasks, mytask, gindex_atm) - print *, "gindex_atm for ", mytask,"is: ", gindex_atm - print *, "size gindex_atm for ", mytask,"is: ", size(gindex_atm) - end subroutine demo_init - - subroutine decompInit_atm( ntasks, mytask, gindex_atm) - - ! !DESCRIPTION: - - ! !USES: - - ! !ARGUMENTS: - integer , intent(in) :: ntasks - integer , intent(in) :: mytask - integer , allocatable, intent(out) :: gindex_atm(:) ! this variable is allocated here, and is assumed to start unallocated - ! !LOCAL VARIABLES: - integer :: my_start - integer :: my_end - integer :: i_local - integer :: i_global - !------------------------------------------------------------------------------ - ! create the a global index array for ocean points - - num_local = npts / ntasks - - my_start = num_local*mytask + min(mytask, mod(npts, ntasks)) + 1 - ! The first mod(npts,ntasks) of ntasks are the ones that have an extra point - if (mytask < mod(npts, ntasks)) then - num_local = num_local + 1 - end if - my_end = my_start + num_local - 1 - - allocate(gindex_atm(num_local)) - - i_global = my_start - do i_local = 1, num_local - gindex_atm(i_local) = i_global - i_global = i_global +1 - end do - - end subroutine decompInit_atm - - subroutine read_netcdf_mesh(filename) - - use netcdf - implicit none - - ! - ! Parameters - ! - - ! - ! Arguments | Global Variables - ! - character(*) , intent(in) :: filename - - - ! - ! Local Variables - ! - - integer :: idfile - - integer :: ierror - integer :: dimid_node - integer :: dimid_elem - integer :: dimid_maxnodepe - integer :: dimid_coordDim - - integer :: iddim_node - integer :: iddim_elem - integer :: iddim_maxnodepe - integer :: iddim_coordDim - - integer :: idvar_nodeCoords - integer :: idvar_CenterCoords - - character (len=100) :: string - - integer :: nnode - integer :: nelem - integer :: maxnodePE - integer :: coordDim - !----------------------------------------------------------------------------- - ! Open mesh file and get the idfile - ierror = nf90_open ( filename, NF90_NOWRITE, idfile); call nc_check_err(ierror, "opening file", filename) - - ! Get the dimid of dimensions - ierror = nf90_inq_dimid(idfile, 'nodeCount' , dimid_node ); call nc_check_err(ierror, "inq_dimid nodeCount", filename) - ierror = nf90_inq_dimid(idfile, 'elementCount' , dimid_elem ); call nc_check_err(ierror, "inq_dimid elementCount", filename) - ierror = nf90_inq_dimid(idfile, 'maxNodePElement' , dimid_maxnodepe ); call nc_check_err(ierror, "inq_dimid maxNodePElement", filename) - ierror = nf90_inq_dimid(idfile, 'coordDim' , dimid_coordDim ); call nc_check_err(ierror, "coordDim", filename) - - ! Inquire dimensions based on their dimeid(s) - ierror = nf90_inquire_dimension(idfile, iddim_node , string, nnode ); call nc_check_err(ierror, "inq_dim nodeCount", filename) - ierror = nf90_inquire_dimension(idfile, iddim_elem , string, nelem ); call nc_check_err(ierror, "inq_dim elementCount", filename) - ierror = nf90_inquire_dimension(idfile, iddim_maxnodepe , string, maxnodePE ); call nc_check_err(ierror, "inq_dim maxNodePElement", filename) - ierror = nf90_inquire_dimension(idfile, iddim_coordDim , string, coordDim ); call nc_check_err(ierror, "inq_dim coordDim", filename) - - - ! Get variable IDs (varid) - ierror = nf90_inq_varid(idfile, 'nodeCoords' , idvar_nodeCoords ); call nc_check_err(ierror, "inq_varid nodeCoords", filename) - ierror = nf90_inq_varid(idfile, 'CenterCoords' , idvar_CenterCoords ); call nc_check_err(ierror, "inq_varid CenterCoords", filename) - - ! Get variables values from varids - !ierror = nf90_get_var(idfile, idvar_nodeCoords , nodeCoords , start=(/ 1,1/) , count=(/ nnode, coordDim /) ); call nc_check_err(ierror,"get_var nodeCoords", filename) - !ierror = nf90_get_var(idfile, idvar_CenterCoords , CenterCoords , start=(/ 1,1/) , count=(/ nelem, coordDim /) ); call nc_check_err(ierror,"get_var CenterCoords", filename) - - - - - end subroutine read_netcdf_mesh - -end module demo_utils - diff --git a/lilac/lilac/atmos_cap.F90 b/lilac/lilac/lilac_atmcap.F90 similarity index 100% rename from lilac/lilac/atmos_cap.F90 rename to lilac/lilac/lilac_atmcap.F90 diff --git a/lilac/lilac/cpl_mod.F90 b/lilac/lilac/lilac_cpl.F90 similarity index 100% rename from lilac/lilac/cpl_mod.F90 rename to lilac/lilac/lilac_cpl.F90 diff --git a/lilac/lilac/lnd_cap.F90 b/lilac/lilac/lnd_cap.F90 deleted file mode 100644 index 3e73d4e6c1..0000000000 --- a/lilac/lilac/lnd_cap.F90 +++ /dev/null @@ -1,250 +0,0 @@ -module lnd_cap - use ESMF - use lilac_utils, only : fld_list_type - - implicit none - - character(*), parameter :: modname = " lnd_cap" - - !!integer, parameter :: fldsMax = 100 - - type(ESMF_Field), public, save :: field - type(ESMF_Field), public, save :: field_sie, field_u - - type(fld_list_type), public, allocatable :: c2l_fldlist(:) - type(fld_list_type), public, allocatable :: l2c_fldlist(:) - - !private - - public lnd_register - !public :: add_fields - !public :: import_fields - !public :: export_fields - - contains - -!------------------------------------------------------------------------- -! land register -!------------------------------------------------------------------------- - subroutine lnd_register(comp, rc) - - type(ESMF_GridComp) :: comp ! must not be optional - integer, intent(out) :: rc - character(len=*), parameter :: subname=trim(modname)//': [lnd_register] ' - - print *, "in lnd register routine" - - rc = ESMF_SUCCESS - ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=lnd_init, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=lnd_run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=lnd_final, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - end subroutine lnd_register - -!------------------------------------------------------------------------- -! land init -!------------------------------------------------------------------------- - - subroutine lnd_init(comp, atm2lnd_l_state, lnd2atm_l_state, clock, rc) - - type (ESMF_GridComp) :: comp - type (ESMF_State) :: atm2lnd_l_state, lnd2atm_l_state - type (ESMF_Clock) :: clock - integer, intent(out) :: rc - - type (ESMF_FieldBundle) :: l2c_fb , c2l_fb - integer :: n - - - logical mesh_switch - integer :: petCount, localrc, urc - type(ESMF_Mesh) :: lnd_mesh - character(len=ESMF_MAXSTR) :: lnd_mesh_filepath - - character(len=*), parameter :: subname=trim(modname)//': [lnd_init] ' - - type(ESMF_Grid) :: lnd_grid - - integer :: c2l_fldlist_num - integer :: l2c_fldlist_num - !integer :: regDecomp(:,:) - - ! Initialize return code - rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//"------------------------!", ESMF_LOGMSG_INFO) - - call ESMF_GridCompGet(comp, petcount=petcount, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - - - print *, " Empty land is created !!!!" - print *, "in land routine routine" - !------------------------------------------------------------------------- - ! Read in the mesh ----or----- Generate the grid - !------------------------------------------------------------------------- - mesh_switch = .true. - if(mesh_switch) then - print *, "creating mesh for land" - ! For now this is our dummy mesh: - !lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' !! T31 and T62 did not work.... - !lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T62_040121_ESMFmesh.nc' - lnd_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - lnd_mesh = ESMF_MeshCreate(filename=trim(lnd_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Mesh for land is created!", ESMF_LOGMSG_INFO) - print *, "!Mesh for land is created!" - else - lnd_grid = ESMF_GridCreateNoPeriDimUfrm( minIndex= (/1,1/), maxIndex=(/180,360 /), & - maxCornerCoord=(/180._ESMF_KIND_R8, 360._ESMF_KIND_R8/), & - minCornerCoord=(/0._ESMF_KIND_R8, 0._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART,& - regDecomp=(/petcount,1/),& - rc=rc) - call ESMF_GridCompGet(comp, grid= lnd_grid , petcount=petcount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Grid for land is created!", ESMF_LOGMSG_INFO) - print *, "Grid for land is created!" - endif - - - - !------------------------------------------------------------------------- - ! Coupler (land) to Atmosphere Fields -- l2a - ! I- Create Field Bundle -- l2c_fb for now - ! II- Create Fields and add them to field bundle - ! III - Add l2c_fb to state (lnd2atm_l_state) - !------------------------------------------------------------------------- - - l2c_fb = ESMF_FieldBundleCreate (name="l2c_fb", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - print *, 'l2c_fb is created' - ! Create individual fields and add to field bundle -- l2a - l2c_fldlist_num = 3 - - do n = 1,l2c_fldlist_num - - ! create field - !!! Here we want to pass pointers - if (mesh_switch) then - field = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(l2c_fldlist(n)%stdname), rc=rc) - !field = ESMF_FieldCreate(lnd_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(l2c_fldlist(n)%stdname), farrayPtr=l2c_fldlist(n)%farrayptr1d, rc= - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - else - field = ESMF_FieldCreate(lnd_grid, name=trim(l2c_fldlist(n)%stdname), farrayPtr=l2c_fldlist(n)%farrayptr2d, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if - ! add field to field bundle - call ESMF_FieldBundleAdd(l2c_fb, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - print *, "**********************************************************" - print *, "creating field for l2a:" - print *, trim(l2c_fldlist(n)%stdname) - print *, l2c_fldlist(n)%farrayptr1d - - enddo - - print *, "!Fields For Coupler (l2c_fldlist) Field Bundle Created!" - - ! Add field bundle to state - call ESMF_StateAdd(lnd2atm_l_state, (/l2c_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - print *, "!lnd2atm_l_state is filld with dummy_var field bundle!" - - - !------------------------------------------------------------------------- - ! Atmosphere to Coupler (land) Fields -- a2l - ! I- Create empty field bundle -- c2l_fb - ! II- Create Fields and add them to field bundle - ! III - Add c2l_fb to state (atm2lnd_l_state) - !------------------------------------------------------------------------- - - c2l_fb = ESMF_FieldBundleCreate(name="c2l_fb", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! Create individual fields and add to field bundle -- a2l - - !call fldlist_add(c2l_fldlist_num, c2l_fldlist, 'dum_var2' ) - c2l_fldlist_num = 3 - - do n = 1,c2l_fldlist_num - - ! create field - !!! Here we want to pass pointers - field = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2l_fldlist(n)%stdname), rc=rc) - !field = ESMF_FieldCreate(lnd_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2l_fldlist(n)%stdname), farrayPtr=c2l_fldlist(n)%farrayptr1d, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !call ESMF_FieldGet(field, farrayPtr=fldptr, rc=rc) - !fldptr = c2l_fldlist(n)%default_value - - ! add field to field bundle - call ESMF_FieldBundleAdd(c2l_fb, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - - print *, "**********************************************************" - print *, "creating field for a2l:" - print *, trim(c2l_fldlist(n)%stdname) - print *, c2l_fldlist(n)%farrayptr1d - - enddo - - print *, "!Fields to Coupler (atmos to land ) (c2l_fb) Field Bundle Created!" - - ! Add field bundle to state - call ESMF_StateAdd(atm2lnd_l_state, (/c2l_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - print *, "!atm2lnd_l_state is filld with dummy_var field bundle!" - - - - end subroutine lnd_init - -!------------------------------------------------------------------------- -! land run -!------------------------------------------------------------------------- - subroutine lnd_run(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//': [lnd_run] ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"lnd_run has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine lnd_run - -!------------------------------------------------------------------------- -! land final -!------------------------------------------------------------------------- - subroutine lnd_final(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//': [lnd_final] ' - - ! Initialize return code - rc = ESMF_SUCCESS - - call ESMF_LogWrite(subname//"lnd_final is called but has not been implemented yet", ESMF_LOGMSG_INFO) - - end subroutine lnd_final - !=============================================================================== - - - - - -end module lnd_cap From a1dcf769a455782bae42000772865d4e50e20b34 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 26 Nov 2019 11:49:19 -0700 Subject: [PATCH 0420/1973] updates that reproduce Negin's last baselines --- lilac/atm_driver/Makefile | 85 ++- lilac/atm_driver/atm_driver.F90 | 718 ++++++++------------ lilac/atm_driver/cheyenne.sub | 39 ++ lilac/atm_driver/drv_flds_in | 7 + lilac/atm_driver/drv_in | 268 ++++++++ lilac/atm_driver/lnd_in | 238 +++++++ lilac/atm_driver/namelist_lilac | 10 + lilac/lilac/lilac_atmcap.F90 | 471 ++++++-------- lilac/lilac/lilac_cpl.F90 | 583 ++++++++--------- lilac/lilac/lilac_mod.F90 | 1078 ++++++++++++++----------------- lilac/lilac/lilac_utils.F90 | 759 +++++++++------------- 11 files changed, 2179 insertions(+), 2077 deletions(-) create mode 100644 lilac/atm_driver/cheyenne.sub create mode 100644 lilac/atm_driver/drv_flds_in create mode 100644 lilac/atm_driver/drv_in create mode 100644 lilac/atm_driver/lnd_in create mode 100644 lilac/atm_driver/namelist_lilac diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index feab757abf..ee3fb76810 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -18,14 +18,15 @@ # # automatically set the environment variable "ESMFMKFILE". In this case # # either manually set "ESMFMKFILE" in your environment or hard code the # # location of "esmf.mk" into the include statement below. -# # Notice that the latter approach has negative impact on flexibility and +# # Notice that the latter approach has negative impact on flexibility and # # portability. -ifneq ($(origin ESMFMKFILE), environment) -$(error Environment variable ESMFMKFILE was not set.) -endif +#ifneq ($(origin ESMFMKFILE), environment) +#$(error Environment variable ESMFMKFILE was not set.) +#endif +ESMFMKFILE = /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libO/Linux.intel.64.mpt.default/esmf.mk include $(ESMFMKFILE) #================================================================================ @@ -33,24 +34,20 @@ include $(ESMFMKFILE) #================================================================================ # Temporarily hard-coded # TODO: Please fix this part. -CASE_NAME = why01-g -#CASE_NAME = ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_testing -#CASE_NAME = ctsm1.0.dev066_MCT_I2000Clm50Sp_03 -#CASE_NAME = lilac_ctsm -CTSM_BLD_DIR = /glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf -CTSM_INC = -I$(CTSM_BLD_DIR)/include -CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm -#TRACEBACK_FLAGS = -g -traceback -debug all -check all -O2 -r8 -#TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O2 -debug minimal -DLINUX -DCESMCOUPLED -DFORTRANUNDERSCORE -DCPRINTEL -DNDEBUG -DUSE_ESMF_LIB -DMCT_INTERFACE -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=8 -DESMF_VERSION_MINOR=0 -DATM_PRESENT -DICE_PRESENT -DLND_PRESENT -DOCN_PRESENT -DROF_PRESENT -DGLC_PRESENT -DWAV_PRESENT -DESP_PRESENT -free -DUSE_CONTIGUOUS=contiguous -#TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DCESMCOUPLED -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DUSE_ESMF_LIB -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -DATM_PRESENT -DICE_PRESENT -DLND_PRESENT -DOCN_PRESENT -DROF_PRESENT -DGLC_PRESENT -DWAV_PRESENT -DESP_PRESENT -free -DUSE_CONTIGUOUS=contiguous -TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DCESMCOUPLED -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DUSE_ESMF_LIB -DMCT_INTERFACE -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -DATM_PRESENT -DICE_PRESENT -DLND_PRESENT -DOCN_PRESENT -DROF_PRESENT -DGLC_PRESENT -DWAV_PRESENT -DESP_PRESENT -free -DUSE_CONTIGUOUS=contiguous +CASE_NAME = why01-g +CTSM_BLD_DIR = /glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf +CTSM_INC = -I$(CTSM_BLD_DIR)/include +CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm +#TRACEBACK_FLAGS = -g -traceback -debug all -check all -O2 -r8 +TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free # ----------------------------------------------------------------------------- -#EXTRA_LIBS = $(EXTRA_LIBS) -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/nuopc/pio/pio2 -EXTRA_LIBS = -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib -MORE_LIBS = -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ +EXTRA_LIBS = -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib +MORE_LIBS = -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ # ----------------------------------------------------------------------------- +DRIVER_DIR = $(CURDIR) +LILAC_DIR = $(DRIVER_DIR)/../lilac #================================================================================ ### Compiler and linker rules using ESMF_ variables supplied by esmf.mk @@ -59,7 +56,7 @@ MORE_LIBS = -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mc .SUFFIXES: .f90 .F90 .c .C %.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREENOCPP) $< %.o : %.F90 @@ -68,25 +65,47 @@ MORE_LIBS = -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mc $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -%.o : %.c - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) \ - $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< +lilac_atmcap.o : $(LILAC_DIR)/lilac_atmcap.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + +lilac_cpl.o : $(LILAC_DIR)/lilac_cpl.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + +lilac_utils.o : $(LILAC_DIR)/lilac_utils.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + +lilac_mod.o : $(LILAC_DIR)/lilac_mod.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< -% : %.C - $(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) \ - $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $< +atm_driver.o : $(DRIVER_DIR)/atm_driver.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< -demo_driver: demo_driver.o atmos_cap.o lilac_mod.o lilac_utils.o cpl_mod.o lnd_cap.o +atm_driver: atm_driver.o lilac_atmcap.o lilac_mod.o lilac_utils.o lilac_cpl.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) $(TRACEBACK_FLAGS) $(MORE_LIBS) - mv demo_driver demo_driver.exe + mv atm_driver atm_driver.exe rm *.o *.mod # module dependencies: -#demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o -demo_driver.o: lilac_mod.o atmos_cap.o lilac_utils.o cpl_mod.o demo_utils.o demo_mod.o -lilac_mod.o: atmos_cap.o lilac_utils.o cpl_mod.o lnd_cap.o #shr_pio_mod.o -atmos_cap.o: lilac_utils.o -demo_mod.o: +#atm_driver.o: lilac_mod.o lilac_atmcap.o lilac_utils.o lilac_cpl.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o +atm_driver.o: lilac_mod.o lilac_atmcap.o lilac_utils.o lilac_cpl.o +lilac_mod.o: lilac_atmcap.o lilac_utils.o lilac_cpl.o #shr_pio_mod.o +lilac_atmcap.o: lilac_utils.o + # ----------------------------------------------------------------------------- .PHONY: clean berzerk remake @@ -95,5 +114,5 @@ clean: berzerk: rm -f PET*.ESMF_LogFile job_name* *.o *.mod *.exe remake: - rm lilac_mod.o demo_driver.o demo_driver.exe & make + rm lilac_mod.o atm_driver.o atm_driver.exe & make # ----------------------------------------------------------------------------- diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 2cefc3b73d..7a264b7eb9 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -1,464 +1,312 @@ -module demo_mod -!---------------------------------------------------------------------------- - use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS - use spmdMod , only : masterproc - use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type , atm2lnd_data2d_type , atm2lnd_data2d_type , this_clock - implicit none - private - public :: demo_init - public :: read_netcdf_mesh - integer :: ierr - integer :: COMP_COMM - integer :: npts ! domain global size - integer :: num_local - integer :: n_points - real, dimension(:,:), allocatable :: centerCoords -!---------------------------------------------------------------------------- +program atm_driver + + !---------------------------------------------------------------------------- + ! This is a driver for running lilac with CTSM + ! There can be no references to ESMF in the driver (the host atmosphere cannot + ! be required to know or use ESMF) + ! + ! hierarchy seen here: + ! + ! atm driver* (WRF, atm_driver, ...) + ! | + ! | + ! lilac (not an ESMF gridded component!) + ! | |________________________.____________.......... gridded components + ! | | | + ! ESMF lilac_atmcap ESMF land cap ESMF river cap + ! | | + ! CTSM Mizzouroute... + !---------------------------------------------------------------------------- + + use lilac_mod , only : lilac_init, lilac_run, lilac_final + use lilac_utils , only : lilac_atm2lnd, lilac_lnd2atm, gindex_atm + use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS + + implicit none + + integer :: comp_comm + integer :: ierr + real , allocatable :: centerCoords(:,:) + real , allocatable :: lon(:), lat(:) + integer :: mytask, ntasks + integer :: my_start, my_end + integer :: i_local, i_global + integer :: nlocal, nglobal + integer :: start_time !-- start_time start time + integer :: end_time !-- end_time end time + integer :: curr_time !-- cur_time current time + integer :: itime_step !-- itime_step counter of time steps + integer :: g,i,k !-- indices + character(len=128) :: filename + !------------------------------------------------------------------------ + + start_time = 1 + end_time = 48 + + !----------------------------------------------------------------------------- + ! Initiallize MPI + !----------------------------------------------------------------------------- + + write(*, *) "MPI initialization starts ..." + + call MPI_init(ierr) + if (ierr .ne. MPI_SUCCESS) then + print *,'Error starting MPI program. Terminating.' + call MPI_ABORT(MPI_COMM_WORLD, ierr) + end if + + comp_comm = MPI_COMM_WORLD + call MPI_COMM_RANK(comp_comm, mytask, ierr) + call MPI_COMM_SIZE(comp_comm, ntasks, ierr) + + if (mytask == 0 ) then + print *, "MPI initialization done ..., ntasks=", ntasks + end if + + !----------------------------------------------------------------------------- + ! Read mesh file to get number of points (n_points) + !----------------------------------------------------------------------------- + filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + call read_netcdf_mesh(filename, nglobal) + if (mytask == 0 ) then + print *, "number of global points is is:", nglobal + end if + + !----------------------------------------------------------------------------- + ! atmosphere domain decomposition + !----------------------------------------------------------------------------- + + nlocal = nglobal / ntasks + + my_start = nlocal*mytask + min(mytask, mod(nglobal, ntasks)) + 1 + ! The first mod(nglobal,ntasks) of ntasks are the ones that have an extra point + if (mytask < mod(nglobal, ntasks)) then + nlocal = nlocal + 1 + end if + my_end = my_start + nlocal - 1 + + allocate(gindex_atm(nlocal)) + + i_global = my_start + do i_local = 1, nlocal + gindex_atm(i_local) = i_global + i_global = i_global + 1 + end do + + !------------------------------------------------------------------------ + ! Initialize lilac + !------------------------------------------------------------------------ + + call lilac_init(nlocal) + + !------------------------------------------------------------------------ + ! Fill in atm2lnd type pointer data + !------------------------------------------------------------------------ + + ! first determine lats and lons + allocate(lon(nlocal)) + allocate(lat(nlocal)) + do i = 1,nlocal + i_global = gindex_atm(i) + lon(i) = centerCoords(1,i_global) + lon(i) = real(nint(lon(i))) ! rounding to nearest int + lat(i) = centerCoords(2,i_global) + lat(i) = real(nint(lat(i))) ! rounding to nearest int + end do + + ! now fill in the dataptr values + call atm_to_lilac (lon, lat) + + !------------------------------------------------------------------------ + ! Run lilac + !------------------------------------------------------------------------ + + itime_step = 1 + do curr_time = start_time, end_time + call lilac_run( ) + itime_step = itime_step + 1 + end do + + !------------------------------------------------------------------------ + ! Finalize lilac + !------------------------------------------------------------------------ + + call lilac_final( ) + + if (mytask == 0 ) then + print *, "=======================================" + print *, " ............. DONE ..................." + print *, "=======================================" + end if + + !===================== contains -!---------------------------------------------------------------------------- - subroutine demo_init(gindex_atm, atm2lnd, lnd2atm) - !! TODO: IS THE INTENT CORRECT FOR GINDEX_ATM - integer , allocatable, intent(inout) :: gindex_atm(:) - type (atm2lnd_data1d_type), intent(inout) :: atm2lnd - type (lnd2atm_data1d_type), intent(inout) :: lnd2atm - integer :: ntasks - integer :: mytask - character(len=128) :: filename - integer :: endc - !----------------------------------------------------------------------------- - ! Initiallize MPI - !----------------------------------------------------------------------------- - - npts = 3312 - - write(*, *) "MPI initialization starts ..." - - call MPI_init(ierr) - COMP_COMM = MPI_COMM_WORLD - - !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 - if (ierr .ne. MPI_SUCCESS) then - print *,'Error starting MPI program. Terminating.' - call MPI_ABORT(MPI_COMM_WORLD, ierr) - end if - - ! - - call MPI_COMM_RANK(COMP_COMM, mytask, ierr) - call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) - - if (mytask == 0 ) then - print *, "MPI initialization done ..., ntasks=", ntasks - end if - - - !----------------------------------------------------------------------------- - ! Read mesh file to get number of points (n_points) - !----------------------------------------------------------------------------- - filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - call read_netcdf_mesh(filename, n_points) - - !----------------------------------------------------------------------------- - ! atmosphere domain decomposition - !----------------------------------------------------------------------------- - - npts = n_points - print *, "npts for ", mytask, "is:", npts - call decompInit_atm( ntasks, mytask, gindex_atm) - print *, "gindex_atm for ", mytask,"is: ", gindex_atm - print *, "size gindex_atm for ", mytask,"is: ", size(gindex_atm) - - !----------------------------------------------------------------------------- - ! allocate and fill in atm2lnd - !----------------------------------------------------------------------------- - - endc = npts /ntasks - call fill_in (atm2lnd, lnd2atm, 1, endc, gindex_atm) - end subroutine demo_init - - subroutine decompInit_atm( ntasks, mytask, gindex_atm) - - ! !DESCRIPTION: - ! !USES: - - ! !ARGUMENTS: - integer , intent(in) :: ntasks - integer , intent(in) :: mytask - integer , allocatable, intent(out) :: gindex_atm(:) ! this variable is allocated here, and is assumed to start unallocated - ! !LOCAL VARIABLES: - integer :: my_start - integer :: my_end - integer :: i_local - integer :: i_global - !------------------------------------------------------------------------------ - ! create the a global index array for ocean points - - num_local = npts / ntasks - - my_start = num_local*mytask + min(mytask, mod(npts, ntasks)) + 1 - ! The first mod(npts,ntasks) of ntasks are the ones that have an extra point - if (mytask < mod(npts, ntasks)) then - num_local = num_local + 1 - end if - my_end = my_start + num_local - 1 - - allocate(gindex_atm(num_local)) - - i_global = my_start - do i_local = 1, num_local - gindex_atm(i_local) = i_global - i_global = i_global +1 - end do - - end subroutine decompInit_atm - - subroutine read_netcdf_mesh(filename, n_points) - - use netcdf - implicit none - - ! - ! Parameters - ! - - ! - ! Arguments | Global Variables - ! - character(*) , intent(in) :: filename - integer , intent(inout) :: n_points - - ! - ! Local Variables - ! - - integer :: idfile - - integer :: ierror - integer :: dimid_node - integer :: dimid_elem - integer :: dimid_maxnodepe - integer :: dimid_coordDim - - integer :: iddim_node - integer :: iddim_elem - integer :: iddim_maxnodepe - integer :: iddim_coordDim - - integer :: idvar_nodeCoords - integer :: idvar_CenterCoords - - character (len=100) :: string - - - integer :: nnode - integer :: nelem - integer :: maxnodePE - integer :: coordDim - real, dimension(:,:), allocatable :: nodeCoords - !----------------------------------------------------------------------------- - ! Open mesh file and get the idfile - ierror = nf90_open ( filename, NF90_NOWRITE, idfile) ; call nc_check_err(ierror, "opening file", filename) - - ! Get the dimid of dimensions - ierror = nf90_inq_dimid(idfile, 'nodeCount' , dimid_node ) ; call nc_check_err(ierror, "inq_dimid nodeCount", filename) - ierror = nf90_inq_dimid(idfile, 'elementCount' , dimid_elem ); call nc_check_err(ierror, "inq_dimid elementCount", filename) - ierror = nf90_inq_dimid(idfile, 'maxNodePElement' , dimid_maxnodepe ); call nc_check_err(ierror, "inq_dimid maxNodePElement", filename) - ierror = nf90_inq_dimid(idfile, 'coordDim' , dimid_coordDim ); call nc_check_err(ierror, "coordDim", filename) - - ! Inquire dimensions based on their dimeid(s) - ierror = nf90_inquire_dimension(idfile, dimid_node , string, nnode ); call nc_check_err(ierror, "inq_dim nodeCount", filename) - ierror = nf90_inquire_dimension(idfile, dimid_elem , string, nelem ); call nc_check_err(ierror, "inq_dim elementCount", filename) - ierror = nf90_inquire_dimension(idfile, dimid_maxnodepe , string, maxnodePE ); call nc_check_err(ierror, "inq_dim maxNodePElement", filename) - ierror = nf90_inquire_dimension(idfile, dimid_coordDim , string, coordDim ); call nc_check_err(ierror, "inq_dim coordDim", filename) - - print *, "=======================================" - print *, "nnode is : ", nnode - print *, "nelem is : ", nelem - print *, "coordDim is :", coordDim - print *, "=======================================" - - allocate (nodeCoords(coordDim, nnode)) - allocate (centerCoords(coordDim, nelem)) - ! Get variable IDs (varid) - ierror = nf90_inq_varid(idfile, 'nodeCoords' , idvar_nodeCoords ); call nc_check_err(ierror, "inq_varid nodeCoords", filename) - ierror = nf90_inq_varid(idfile, 'centerCoords' , idvar_centerCoords ); call nc_check_err(ierror, "inq_varid centerCoords", filename) - - ! Get variables values from varids - ierror = nf90_get_var(idfile, idvar_nodeCoords , nodeCoords , start=(/ 1,1/) , count=(/ coordDim, nnode /) ); call nc_check_err(ierror,"get_var nodeCoords", filename) - ierror = nf90_get_var(idfile, idvar_CenterCoords , centerCoords , start=(/ 1,1/) , count=(/ coordDim, nelem /) ); call nc_check_err(ierror,"get_var CenterCoords", filename) - - !print *, "lons : ",centerCoords(1,:) - - n_points = nelem - - end subroutine read_netcdf_mesh - - subroutine nc_check_err(ierror, description, filename) - !------------------------------------------------------------------------------- - ! $HeadURL: https://svn.oss.deltares.nl/repos/delft3d/trunk/src/engines_gpl/wave/packages/data/src/nc_check_err.f90 $ - !!--declarations---------------------------------------------------------------- - use netcdf - ! - implicit none - ! - ! Global variables - ! - integer , intent(in) :: ierror - character(*), intent(in) :: description - character(*), intent(in) :: filename - ! - ! Local variables - ! - ! - ! real, parameter :: PI = 3.1415927 - - !! executable statements ------------------------------------------------------- - ! - if (ierror /= nf90_noerr) then - print *, "ERROR" - write (*,'(6a)') 'ERROR ', trim(description), '. NetCDF file : "', trim(filename), '". Error message:', nf90_strerror(ierror) - endif - end subroutine nc_check_err - - subroutine fill_in (atm2lnd , lnd2atm , begc, endc , gindex_atm) - ! !ARGUMENTS: - type (atm2lnd_data1d_type), intent(inout) :: atm2lnd - type (lnd2atm_data1d_type), intent(inout) :: lnd2atm - - integer , intent(in) :: begc - integer , intent(in) :: endc - - - real :: lat - real :: lon - - integer , allocatable, intent(in) :: gindex_atm(:) - !integer :: i - integer :: i_local - integer :: i_global - - - ! tbot is going to be analytical function - - allocate ( atm2lnd%Sa_z (begc:endc) ) !; atm2lnd%Sa_z (:) = 30.0d0 - allocate ( atm2lnd%Sa_topo (begc:endc) ) !; atm2lnd%Sa_topo (:) = 10.0d0 - allocate ( atm2lnd%Sa_u (begc:endc) ) !; atm2lnd%Sa_u (:) = 20.0d0 - allocate ( atm2lnd%Sa_v (begc:endc) ) !; atm2lnd%Sa_v (:) = 40.0d0 - allocate ( atm2lnd%Sa_ptem (begc:endc) ) !; atm2lnd%Sa_ptem (:) = 280.0d0 - allocate ( atm2lnd%Sa_pbot (begc:endc) ) !; atm2lnd%Sa_pbot (:) = 100100.0d0 - allocate ( atm2lnd%Sa_tbot (begc:endc) ) !; atm2lnd%Sa_tbot (:) = 280.0 - allocate ( atm2lnd%Sa_shum (begc:endc) ) !; atm2lnd%Sa_shum (:) = 0.0004d0 - - allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) !; atm2lnd%Faxa_lwdn (:) = 200.0d0 - allocate ( atm2lnd%Faxa_rainc (begc:endc) ) !; atm2lnd%Faxa_rainc (:) = 0.0d0 - allocate ( atm2lnd%Faxa_rainl (begc:endc) ) !; atm2lnd%Faxa_rainl (:) = 3.0d-8 - allocate ( atm2lnd%Faxa_snowc (begc:endc) ) !; atm2lnd%Faxa_snowc (:) = 1.0d-8 - allocate ( atm2lnd%Faxa_snowl (begc:endc) ) !; atm2lnd%Faxa_snowl (:) = 2.0d-8 - - allocate ( atm2lnd%Faxa_swndr (begc:endc) ) !; atm2lnd%Faxa_swndr (:) = 100.0d0 - allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) !; atm2lnd%Faxa_swvdr (:) = 50.0d0 - allocate ( atm2lnd%Faxa_swndf (begc:endc) ) !; atm2lnd%Faxa_swndf (:) = 20.0d0 - allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) !; atm2lnd%Faxa_swvdf (:) = 40.0d0 - - do i_local = begc, endc - - i_global = gindex_atm(i_local) - lon = centerCoords(1,i_global) - lat = centerCoords(2,i_global) - - ! rounding to nearest int - lon = real(nint(lon)) - lat = real(nint(lat)) - ! This is i_local - print *, "i_local is:", i_local, "i_global is :", i_global, "lon:", lon, "lat:", lat - !atm2lnd%Sa_tbot(i_local) = 280.0d0 + (sin (lat)+ cos(lon))*1.0d0 - !atm2lnd%Sa_tbot(i_local) = 280.0d0 + cos(lon)*1.0d0 - - atm2lnd%Sa_z (i_local) = 30.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Sa_topo (i_local) = 10.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Sa_u (i_local) = 20.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Sa_v (i_local) = 40.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Sa_ptem (i_local) = 280.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Sa_pbot (i_local) = 100100.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Sa_tbot (i_local) = 280.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Sa_shum (i_local) = 0.0004d0 !+(lat*0.01d0 + lon*0.01d0)*1.0e-8 - atm2lnd%Faxa_lwdn (i_local) = 200.0d0 + lat *0.01d0 + lon *0.01d0 - - !atm2lnd%Faxa_rainc (i_local) = 0.0d0 + (lat*0.01d0 + lon*0.01d0)*1.0e-8 - atm2lnd%Faxa_rainl (i_local) = 3.0d-8 + (lat*0.01d0 + lon*0.01d0)*1.0e-8 - atm2lnd%Faxa_snowc (i_local) = 1.0d-8 + (lat*0.01d0 + lon*0.01d0)*1.0e-8 - atm2lnd%Faxa_snowl (i_local) = 2.0d-8 + (lat*0.01d0 + lon*0.01d0)*1.0e-8 - atm2lnd%Faxa_swndr (i_local) = 100.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Faxa_swvdr (i_local) = 50.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Faxa_swndf (i_local) = 20.0d0 + lat *0.01d0 + lon *0.01d0 - atm2lnd%Faxa_swvdf (i_local) = 40.0d0 + lat *0.01d0 + lon *0.01d0 - !atm2lnd%Sa_tbot(i) = 280.0 + sin ( lat )*1.0 - !atm2lnd%Sa_tbot(i) = 280.0 + cos(lon)*1.0 - - ! radian instead of degrees: - !lon = lon* PI/180.0 - !lat = lat* PI/180.0 - end do - - !allocating these values from atmosphere for now! - !allocate ( atm2lnd%Sa_z (begc:endc) ) ; atm2lnd%Sa_z (:) = 30.0d0 - !allocate ( atm2lnd%Sa_topo (begc:endc) ) ; atm2lnd%Sa_topo (:) = 10.0d0 - !allocate ( atm2lnd%Sa_u (begc:endc) ) ; atm2lnd%Sa_u (:) = 20.0d0 - !allocate ( atm2lnd%Sa_v (begc:endc) ) ; atm2lnd%Sa_v (:) = 40.0d0 - !allocate ( atm2lnd%Sa_ptem (begc:endc) ) ; atm2lnd%Sa_ptem (:) = 280.0d0 - !allocate ( atm2lnd%Sa_pbot (begc:endc) ) ; atm2lnd%Sa_pbot (:) = 100100.0d0 - !allocate ( atm2lnd%Sa_tbot (begc:endc) ) ; atm2lnd%Sa_tbot (:) = 280.0d0 - !allocate ( atm2lnd%Sa_shum (begc:endc) ) ; atm2lnd%Sa_shum (:) = 0.0004d0 - !allocate ( atm2lnd%Faxa_lwdn (begc:endc) ) ; atm2lnd%Faxa_lwdn (:) = 200.0d0 - !allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 4.0d-8 - allocate ( atm2lnd%Faxa_rainc (begc:endc) ) ; atm2lnd%Faxa_rainc (:) = 0.0d0 - !allocate ( atm2lnd%Faxa_rainl (begc:endc) ) ; atm2lnd%Faxa_rainl (:) = 3.0d-8 - !allocate ( atm2lnd%Faxa_snowc (begc:endc) ) ; atm2lnd%Faxa_snowc (:) = 1.0d-8 - !allocate ( atm2lnd%Faxa_snowl (begc:endc) ) ; atm2lnd%Faxa_snowl (:) = 2.0d-8 - - !allocate ( atm2lnd%Faxa_swndr (begc:endc) ) ; atm2lnd%Faxa_swndr (:) = 100.0d0 - !allocate ( atm2lnd%Faxa_swvdr (begc:endc) ) ; atm2lnd%Faxa_swvdr (:) = 50.0d0 - !allocate ( atm2lnd%Faxa_swndf (begc:endc) ) ; atm2lnd%Faxa_swndf (:) = 20.0d0 - !allocate ( atm2lnd%Faxa_swvdf (begc:endc) ) ; atm2lnd%Faxa_swvdf (:) = 40.0d0 - !allocate ( atm2lnd%Faxa_bcph (begc:endc) ) ; atm2lnd%Faxa_bcph (:) = 0.0d0 - - - allocate ( lnd2atm%Sl_lfrin (begc:endc) ) ; lnd2atm%Sl_lfrin (:) = 0 - allocate ( lnd2atm%Sl_t (begc:endc) ) ; lnd2atm%Sl_t (:) = 0 - allocate ( lnd2atm%Sl_tref (begc:endc) ) ; lnd2atm%Sl_tref (:) = 0 - allocate ( lnd2atm%Sl_qref (begc:endc) ) ; lnd2atm%Sl_qref (:) = 0 - allocate ( lnd2atm%Sl_avsdr (begc:endc) ) ; lnd2atm%Sl_avsdr (:) = 0 - allocate ( lnd2atm%Sl_anidr (begc:endc) ) ; lnd2atm%Sl_anidr (:) = 0 - allocate ( lnd2atm%Sl_avsdf (begc:endc) ) ; lnd2atm%Sl_avsdf (:) = 0 - allocate ( lnd2atm%Sl_anidf (begc:endc) ) ; lnd2atm%Sl_anidf (:) = 0 - allocate ( lnd2atm%Sl_snowh (begc:endc) ) ; lnd2atm%Sl_snowh (:) = 0 - allocate ( lnd2atm%Sl_u10 (begc:endc) ) ; lnd2atm%Sl_u10 (:) = 0 - allocate ( lnd2atm%Sl_fv (begc:endc) ) ; lnd2atm%Sl_fv (:) = 0 - allocate ( lnd2atm%Sl_ram1 (begc:endc) ) ; lnd2atm%Sl_ram1 (:) = 0 - end subroutine fill_in - -end module demo_mod - - - -program demo_lilac_driver - - !---------------------------------------------------------------------------- - !*** All the components are in the hierarchy seen here: - ! - ! main driver* (WRF) - ! | - ! | - ! lilac (not a gridded component!) - ! | |________________________. - ! | | - ! atmos cap land cap ____________. ......... gridded components - ! | | | - ! | | river cap - ! ocean (MOM, POM)? | | - ! | Mizzouroute... - ! CTSM - ! - ! - !---------------------------------------------------------------------------- - - ! modules - use ESMF - use lilac_mod - use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type , atm2lnd_data2d_type , atm2lnd_data2d_type , this_clock - use clm_varctl , only : iulog - use spmdMod , only : masterproc - use demo_mod , only : demo_init - use demo_mod , only : read_netcdf_mesh + !===================== + + subroutine read_netcdf_mesh(filename, nglobal) + + use netcdf implicit none - ! TO DO: change the name and the derived data types - ! data types for 1d arrays for meshes - type (atm2lnd_data1d_type) :: atm2lnd - type (lnd2atm_data1d_type) :: lnd2atm + ! input/output variables + character(*) , intent(in) :: filename + integer , intent(out) :: nglobal + + ! local Variables + integer :: idfile + integer :: ierror + integer :: dimid_elem + integer :: dimid_coordDim + integer :: iddim_elem + integer :: iddim_coordDim + integer :: idvar_CenterCoords + integer :: nelem + integer :: coordDim + character (len=100) :: string + !----------------------------------------------------------------------------- + + ! Open mesh file and get the idfile + ierror = nf90_open(filename, NF90_NOWRITE, idfile) + call nc_check_err(ierror, "opening file", filename) + + ! Get the dimid of dimensions + ierror = nf90_inq_dimid(idfile, 'elementCount', dimid_elem) + call nc_check_err(ierror, "inq_dimid elementCount", filename) + ierror = nf90_inq_dimid(idfile, 'coordDim', dimid_coordDim) + call nc_check_err(ierror, "coordDim", filename) + + ! Inquire dimensions based on their dimeid(s) + ierror = nf90_inquire_dimension(idfile, dimid_elem, string, nelem) + call nc_check_err(ierror, "inq_dim elementCount", filename) + ierror = nf90_inquire_dimension(idfile, dimid_coordDim, string, coordDim) + call nc_check_err(ierror, "inq_dim coordDim", filename) + + if (mytask == 0 ) then + print *, "=======================================" + print *, "number of elements is : ", nelem + print *, "coordDim is :", coordDim + print *, "=======================================" + end if + + ! Get coordinate values + allocate (centerCoords(coordDim, nelem)) + + ierror = nf90_inq_varid(idfile, 'centerCoords' , idvar_centerCoords) + call nc_check_err(ierror, "inq_varid centerCoords", filename) + ierror = nf90_get_var(idfile, idvar_CenterCoords, centerCoords, start=(/1,1/), count=(/coordDim, nelem/)) + call nc_check_err(ierror,"get_var CenterCoords", filename) + + nglobal = nelem + + end subroutine read_netcdf_mesh + + !======================================================================== + subroutine nc_check_err(ierror, description, filename) + use netcdf + integer , intent(in) :: ierror + character(*), intent(in) :: description + character(*), intent(in) :: filename + + if (ierror /= nf90_noerr) then + write (*,'(6a)') 'ERROR ', trim(description),'. NetCDF file : "', trim(filename),& + '". Error message:', nf90_strerror(ierror) + endif + end subroutine nc_check_err - type (this_clock) :: this_time + !======================================================================== + subroutine atm_to_lilac (lon, lat) - real , allocatable :: rand1(:) - real , allocatable :: rand2(:) + ! input/output variables + real, intent(in) :: lon(:) + real, intent(in) :: lat(:) - integer , allocatable :: seed(:) - integer :: seed_val, n + ! local variables + integer :: lsize + real*8, allocatable :: data(:) + integer :: i + integer :: i_local + ! -------------------------------------------------------- - integer :: begc,endc - integer :: start_time !-- start_time start time - integer :: end_time !-- end_time end time - integer :: curr_time !-- cur_time current time - integer :: itime_step !-- itime_step counter of time steps - integer :: g,i,k !-- indices - integer, parameter :: debug = 1 !-- internal debug level + lsize = size(lon) + allocate(data(lsize)) - character(len=128) :: fldname + data(:) = 30.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Sa_z', data) - character(*),parameter :: F01 = "(a,i4,d26.19)" - character(*),parameter :: F02 = "('[demo_driver]',a,i5,2x,d26.19)" - integer , allocatable :: gindex_atm(:) + data(:) = 10.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Sa_topo', data) - !------------------------------------------------------------------------ - ! real atmosphere: - begc = 1 - !endc = 6912/4/2 - endc = 3312/4/2/2 - !endc = 13824 - !endc = 13968 + data(:) = 20.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Sa_u', data) - start_time = 1 - end_time = 48 - itime_step = 1 + data(:) = 40.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Sa_v', data) - seed_val = 0 - n = endc - begc + 1 + data(:) = 280.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Sa_ptem', data) + data(:) = 100100.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Sa_pbot', data) - ! making 2 random arrays with a seed. - call random_seed (size = n ) - allocate ( seed (n ) ) ; seed (:) = seed_val - call random_seed (put = seed ) + data(:) = 280.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Sa_tbot', data) + + data(:) = 0.0004d0 !+(lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + call lilac_atm2lnd('Sa_shum', data) + + data(:) = 200.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Faxa_lwdn', data) - allocate ( rand1 (begc:endc) ) ; call random_number (rand1) - allocate ( rand2 (begc:endc) ) ; call random_number (rand2) + data(:) = 0.0d0 + call lilac_atm2lnd('Faxa_rainc', data) + data(:) = 3.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + call lilac_atm2lnd('Faxa_rainl', data) - !fldname = 'Sa_topo' - !if (debug > 0) then - ! do i=begc, endc - ! write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, atm2lnd%Sa_topo(i) - ! enddo - ! end if + data(:) = 1.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + call lilac_atm2lnd('Faxa_snowc', data) + data(:) = 2.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + call lilac_atm2lnd('Faxa_snowl', data) - !print *, atm2lnd%Sa_topo(1:100) + data(:) = 100.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Faxa_swndr', data) + data(:) = 50.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Faxa_swvdr', data) + data(:) = 20.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Faxa_swndf', data) - !------------------------------------------------------------------------ - ! The newly added demo_init - ! all allocate will go here: - !------------------------------------------------------------------------ + data(:) = 40.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + call lilac_atm2lnd('Faxa_swvdf', data) - call demo_init(gindex_atm, atm2lnd , lnd2atm) + end subroutine atm_to_lilac - !------------------------------------------------------------------------ - ! looping over imaginary time .... - !------------------------------------------------------------------------ + !======================================================================== + subroutine lilac_to_atm () - call lilac_init ( atm2lnd1d = atm2lnd , lnd2atm1d = lnd2atm , gindex_atm = gindex_atm ) - do curr_time = start_time, end_time - call lilac_run ( ) - itime_step = itime_step + 1 - end do - call lilac_final ( ) - call ESMF_Finalize ( ) + ! local variables + integer :: lsize + real*8, allocatable :: data(:) + ! -------------------------------------------- - print *, "=======================================" - print *, " ............. DONE ..................." - print *, "=======================================" + lsize = size(gindex_atm) + allocate(data(lsize)) + call lilac_lnd2atm('Sl_lfrin' , data) + call lilac_lnd2atm('Sl_t' , data) + call lilac_lnd2atm('Sl_tref' , data) + call lilac_lnd2atm('Sl_qref' , data) + call lilac_lnd2atm('Sl_avsdr' , data) + call lilac_lnd2atm('Sl_anidr' , data) + call lilac_lnd2atm('Sl_avsdf' , data) + call lilac_lnd2atm('Sl_anidf' , data) + call lilac_lnd2atm('Sl_snowh' , data) + call lilac_lnd2atm('Sl_u10' , data) + call lilac_lnd2atm('Sl_fv' , data) + call lilac_lnd2atm('Sl_ram1' , data) -end program demo_lilac_driver + end subroutine lilac_to_atm +end program diff --git a/lilac/atm_driver/cheyenne.sub b/lilac/atm_driver/cheyenne.sub new file mode 100644 index 0000000000..fab83413c0 --- /dev/null +++ b/lilac/atm_driver/cheyenne.sub @@ -0,0 +1,39 @@ +#!/bin/tcsh +#PBS -N job_name +#PBS -A P93300606 +#PBS -l walltime=00:10:00 +#PBS -q premium +##PBS -q share +##PBS -q regular +#PBS -j oe + +#PBS -l select=2:ncpus=4:mpiprocs=8 +##PBS -l select=1:ncpus=1:mpiprocs=2 +##PBS -l select=1:ncpus=1:mpiprocs=1 + +#ml ??? + +### Set TMPDIR as recommended +setenv TMPDIR /glade/scratch/$USER +mkdir -p $TMPDIR + +echo "hello" +### Run the executable +set MPI_SHEPHERD=true + +source /glade/u/apps/ch/opt/lmod/7.5.3/lmod/lmod/init/csh +module purge +module load ncarenv/1.2 intel/19.0.2 esmf_libs mkl mpt/2.19 netcdf-mpi/4.6.1 pnetcdf/1.11.0 ncarcompilers/0.4.1 +setenv OMP_STACKSIZE 256M +setenv MPI_TYPE_DEPTH 16 +setenv MPI_IB_CONGESTED 1 +setenv MPI_USE_ARRAY None +setenv ESMFMKFILE /glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default/esmf.mk +setenv ESMF_RUNTIME_PROFILE ON +setenv ESMF_RUNTIME_PROFILE_OUTPUT SUMMARY +setenv UGCSINPUTPATH /glade/work/turuncu/FV3GFS/benchmark-inputs/2012010100/gfs/fcst +setenv UGCSFIXEDFILEPATH /glade/work/turuncu/FV3GFS/fix_am +setenv UGCSADDONPATH /glade/work/turuncu/FV3GFS/addon +#setenv MPI_USE_ARRAY false + +mpiexec_mpt ./atm_driver.exe diff --git a/lilac/atm_driver/drv_flds_in b/lilac/atm_driver/drv_flds_in new file mode 100644 index 0000000000..bca8f84a0b --- /dev/null +++ b/lilac/atm_driver/drv_flds_in @@ -0,0 +1,7 @@ +&megan_emis_nl + megan_factors_file = '/glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc' + megan_specifier = 'ISOP = isoprene', + 'C10H16 = pinene_a + carene_3 + thujene_a', 'CH3OH = methanol', + 'C2H5OH = ethanol', 'CH2O = formaldehyde', 'CH3CHO = acetaldehyde', + 'CH3COOH = acetic_acid', 'CH3COCH3 = acetone' +/ diff --git a/lilac/atm_driver/drv_in b/lilac/atm_driver/drv_in new file mode 100644 index 0000000000..76d084e624 --- /dev/null +++ b/lilac/atm_driver/drv_in @@ -0,0 +1,268 @@ +&cime_driver_inst + ninst_driver = 1 +/ +&cime_pes + atm_layout = "concurrent" + atm_ntasks = 36 + atm_nthreads = 1 + atm_pestride = 1 + atm_rootpe = 0 + cpl_ntasks = 36 + cpl_nthreads = 1 + cpl_pestride = 1 + cpl_rootpe = 36 + esp_layout = "concurrent" + esp_ntasks = 1 + esp_nthreads = 1 + esp_pestride = 1 + esp_rootpe = 0 + glc_layout = "concurrent" + glc_ntasks = 36 + glc_nthreads = 1 + glc_pestride = 1 + glc_rootpe = 36 + iac_layout = "concurrent" + iac_ntasks = 1 + iac_nthreads = 1 + iac_pestride = 1 + iac_rootpe = 0 + ice_layout = "concurrent" + ice_ntasks = 36 + ice_nthreads = 1 + ice_pestride = 1 + ice_rootpe = 36 + info_taskmap_comp = 0 + info_taskmap_model = 0 + lnd_layout = "concurrent" + lnd_ntasks = 36 + lnd_nthreads = 1 + lnd_pestride = 1 + lnd_rootpe = 36 + ocn_layout = "concurrent" + ocn_ntasks = 36 + ocn_nthreads = 1 + ocn_pestride = 1 + ocn_rootpe = 36 + rof_layout = "concurrent" + rof_ntasks = 36 + rof_nthreads = 1 + rof_pestride = 1 + rof_rootpe = 36 + wav_layout = "concurrent" + wav_ntasks = 36 + wav_nthreads = 1 + wav_pestride = 1 + wav_rootpe = 36 +/ +&esmf_inparm + esmf_logfile_kind = "ESMF_LOGKIND_NONE" +/ +&papi_inparm + papi_ctr1_str = "PAPI_FP_OPS" + papi_ctr2_str = "PAPI_NO_CTR" + papi_ctr3_str = "PAPI_NO_CTR" + papi_ctr4_str = "PAPI_NO_CTR" +/ +&pio_default_inparm + pio_async_interface = .false. + pio_blocksize = -1 + pio_buffer_size_limit = -1 + pio_debug_level = 0 + pio_rearr_comm_enable_hs_comp2io = .true. + pio_rearr_comm_enable_hs_io2comp = .false. + pio_rearr_comm_enable_isend_comp2io = .false. + pio_rearr_comm_enable_isend_io2comp = .true. + pio_rearr_comm_fcd = "2denable" + pio_rearr_comm_max_pend_req_comp2io = 0 + pio_rearr_comm_max_pend_req_io2comp = 64 + pio_rearr_comm_type = "p2p" +/ +&prof_inparm + profile_add_detail = .false. + profile_barrier = .false. + profile_depth_limit = 4 + profile_detail_limit = 2 + profile_disable = .false. + profile_global_stats = .true. + profile_outpe_num = 1 + profile_outpe_stride = 0 + profile_ovhd_measurement = .false. + profile_papi_enable = .false. + profile_single_file = .false. + profile_timer = 4 +/ +&seq_cplflds_inparm + flds_bgc_oi = .false. + flds_co2_dmsa = .false. + flds_co2a = .false. + flds_co2b = .false. + flds_co2c = .false. + flds_wiso = .false. + glc_nec = 10 + ice_ncat = 1 + nan_check_component_fields = .true. + seq_flds_i2o_per_cat = .false. +/ +&seq_cplflds_userspec + cplflds_custom = "" +/ +&seq_infodata_inparm + aoflux_grid = "ocn" + aqua_planet = .false. + aqua_planet_sst = 1 + atm_gnam = "4x5" + bfbflag = .false. + brnch_retain_casename = .false. + budget_ann = 1 + budget_daily = 0 + budget_inst = 0 + budget_ltann = 1 + budget_ltend = 0 + budget_month = 1 + case_desc = "UNSET" + case_name = "datm_test_mct01" + cime_model = "cesm" + coldair_outbreak_mod = .true. + cpl_decomp = 0 + cpl_seq_option = "CESM1_MOD" + do_budgets = .false. + do_histinit = .false. + drv_threading = .false. + eps_aarea = 9e-07 + eps_agrid = 1e-12 + eps_amask = 1e-13 + eps_frac = 1.0e-02 + eps_oarea = 0.1 + eps_ogrid = 0.01 + eps_omask = 1e-06 + flux_albav = .false. + flux_convergence = 0.01 + flux_diurnal = .false. + flux_epbal = "off" + flux_max_iteration = 5 + force_stop_at = "month" + glc_gnam = "null" + glc_renormalize_smb = "on_if_glc_coupled_fluxes" + histaux_a2x = .false. + histaux_a2x1hr = .false. + histaux_a2x1hri = .false. + histaux_a2x24hr = .false. + histaux_a2x3hr = .false. + histaux_a2x3hrp = .false. + histaux_double_precision = .false. + histaux_l2x = .false. + histaux_l2x1yrg = .false. + histaux_r2x = .false. + histavg_atm = .true. + histavg_glc = .true. + histavg_iac = .true. + histavg_ice = .true. + histavg_lnd = .true. + histavg_ocn = .true. + histavg_rof = .true. + histavg_wav = .true. + histavg_xao = .true. + hostname = "cheyenne" + iac_gnam = "null" + ice_gnam = "null" + info_debug = 1 + lnd_gnam = "4x5" + logfilepostfix = ".log" + max_cplstep_time = 0.0 + mct_usealltoall = .false. + mct_usevector = .false. + model_doi_url = "https://doi.org/10.5065/D67H1H0V" + model_version = "cesm-cmeps-v0.8-19-gae1c5be" + ocn_gnam = "null" + orb_eccen = 1.e36 + orb_iyear = 2000 + orb_iyear_align = 2000 + orb_mode = "fixed_year" + orb_mvelp = 1.e36 + orb_obliq = 1.e36 + outpathroot = "./" + reprosum_allow_infnan = .false. + reprosum_diffmax = -1.0e-8 + reprosum_recompute = .false. + reprosum_use_ddpdd = .false. + restart_file = "str_undefined" + rof_gnam = "null" + run_barriers = .false. + scmlat = -999. + scmlon = -999. + shr_map_dopole = .true. + single_column = .false. + start_type = "startup" + tchkpt_dir = "./timing/checkpoints" + tfreeze_option = "mushy" + timing_dir = "./timing" + username = "negins" + vect_map = "cart3d" + wall_time_limit = -1.0 + wav_gnam = "null" + wv_sat_scheme = "GoffGratch" + wv_sat_table_spacing = 1.0D0 + wv_sat_transition_start = 20.0D0 + wv_sat_use_tables = .false. +/ +&seq_timemgr_inparm + atm_cpl_dt = 1800 + atm_cpl_offset = 0 + barrier_n = 1 + barrier_option = "ndays" + barrier_ymd = -999 + calendar = "NO_LEAP" + data_assimilation_atm = .false. + data_assimilation_cpl = .false. + data_assimilation_glc = .false. + data_assimilation_iac = .false. + data_assimilation_ice = .false. + data_assimilation_lnd = .false. + data_assimilation_ocn = .false. + data_assimilation_rof = .false. + data_assimilation_wav = .false. + end_restart = .false. + esp_cpl_offset = 0 + esp_run_on_pause = .true. + glc_avg_period = "yearly" + glc_cpl_dt = 1800 + glc_cpl_offset = 0 + histavg_n = -999 + histavg_option = "never" + histavg_ymd = -999 + history_n = -999 + history_option = "never" + history_ymd = -999 + iac_cpl_offset = 0 + ice_cpl_dt = 1800 + ice_cpl_offset = 0 + lnd_cpl_dt = 1800 + lnd_cpl_offset = 0 + ocn_cpl_dt = 1800 + ocn_cpl_offset = 0 + pause_active_atm = .false. + pause_active_cpl = .false. + pause_active_glc = .false. + pause_active_iac = .false. + pause_active_ice = .false. + pause_active_lnd = .false. + pause_active_ocn = .false. + pause_active_rof = .false. + pause_active_wav = .false. + pause_n = 0 + pause_option = "never" + restart_n = 5 + restart_option = "ndays" + restart_ymd = -999 + rof_cpl_dt = 1800 + start_tod = 0 + start_ymd = 00010101 + stop_n = 5 + stop_option = "ndays" + stop_ymd = -999 + tprof_n = -999 + tprof_option = "never" + tprof_ymd = -999 + wav_cpl_dt = 1800 + wav_cpl_offset = 0 +/ diff --git a/lilac/atm_driver/lnd_in b/lilac/atm_driver/lnd_in new file mode 100644 index 0000000000..2a0b650433 --- /dev/null +++ b/lilac/atm_driver/lnd_in @@ -0,0 +1,238 @@ +&clm_inparm + albice = 0.50,0.30 + co2_ppmv = 367.0 + co2_type = 'constant' + collapse_urban = .false. + create_crop_landunit = .true. + crop_fsat_equals_zero = .false. + dtime = 1800 + fatmlndfrc = '/glade/p/cesmdata/cseg/inputdata/share/domains/domain.lnd.fv4x5_gx3v7.091218.nc' + finidat = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180715.nc' + fsnowaging = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc' + fsnowoptics = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc' + fsurdat = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc' + glc_do_dynglacier = .false. + glc_snow_persistence_max_days = 0 + h2osno_max = 10000.0 + hist_mfilt = 1 + hist_ndens = 1 + hist_nhtfrq = 1 + irrigate = .true. + maxpatch_glcmec = 10 + maxpatch_pft = 17 + n_dom_landunits = 0 + n_dom_pfts = 0 + nlevsno = 12 + nsegspc = 35 + paramfile = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/paramdata/clm5_params.c190829.nc' + run_zero_weight_urban = .false. + snow_cover_fraction_method = 'SwensonLawrence2012' + soil_layerstruct_predefined = '20SL_8.5m' + spinup_state = 0 + toosmall_crop = 0.d00 + toosmall_glacier = 0.d00 + toosmall_lake = 0.d00 + toosmall_soil = 0.d00 + toosmall_urban = 0.d00 + toosmall_wetland = 0.d00 + use_bedrock = .true. + use_century_decomp = .false. + use_cn = .false. + use_crop = .false. + use_dynroot = .false. + use_fates = .false. + use_fertilizer = .false. + use_fun = .false. + use_grainproduct = .false. + use_hydrstress = .true. + use_init_interp = .true. + use_lai_streams = .false. + use_lch4 = .false. + use_luna = .true. + use_nitrif_denitrif = .false. + use_subgrid_fluxes = .true. + use_vertsoilc = .false. +/ +&ndepdyn_nml +/ +&popd_streams +/ +&urbantv_streams + stream_fldfilename_urbantv = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc' + stream_year_first_urbantv = 2000 + stream_year_last_urbantv = 2000 + urbantvmapalgo = 'nn' +/ +&light_streams +/ +&lai_streams + lai_mapalgo = 'bilinear' + model_year_align_lai = 2001 + stream_fldfilename_lai = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/lai_streams/MODISPFTLAI_0.5x0.5_c140711.nc' + stream_year_first_lai = 2001 + stream_year_last_lai = 2013 +/ +&atm2lnd_inparm + glcmec_downscale_longwave = .true. + lapse_rate = 0.006 + lapse_rate_longwave = 0.032 + longwave_downscaling_limit = 0.5 + precip_repartition_glc_all_rain_t = 0. + precip_repartition_glc_all_snow_t = -2. + precip_repartition_nonglc_all_rain_t = 2. + precip_repartition_nonglc_all_snow_t = 0. + repartition_rain_snow = .true. +/ +&lnd2atm_inparm + melt_non_icesheet_ice_runoff = .true. +/ +&clm_canopyhydrology_inparm + interception_fraction = 1.0 + maximum_leaf_wetted_fraction = 0.05 + use_clm5_fpi = .true. +/ +&cnphenology +/ +&clm_soilhydrology_inparm +/ +&dynamic_subgrid + reset_dynbal_baselines = .false. +/ +&cnvegcarbonstate +/ +&finidat_consistency_checks +/ +&dynpft_consistency_checks +/ +&clm_initinterp_inparm + init_interp_method = 'general' +/ +¢ury_soilbgcdecompcascade +/ +&soilhydrology_inparm + baseflow_scalar = 0.001d00 +/ +&luna + jmaxb1 = 0.093563 +/ +&friction_velocity + zetamaxstable = 0.5d00 +/ +&mineral_nitrogen_dynamics +/ +&soilwater_movement_inparm + dtmin = 60. + expensive = 42 + flux_calculation = 1 + inexpensive = 1 + lower_boundary_condition = 2 + soilwater_movement_method = 1 + upper_boundary_condition = 1 + verysmall = 1.e-8 + xtolerlower = 1.e-2 + xtolerupper = 1.e-1 +/ +&rooting_profile_inparm + rooting_profile_method_carbon = 1 + rooting_profile_method_water = 1 +/ +&soil_resis_inparm + soil_resis_method = 1 +/ +&bgc_shared +/ +&canopyfluxes_inparm + itmax_canopy_fluxes = 40 + use_undercanopy_stability = .false. +/ +&aerosol + fresh_snw_rds_max = 204.526d00 +/ +&clmu_inparm + building_temp_method = 1 + urban_hac = 'ON_WASTEHEAT' + urban_traffic = .false. +/ +&clm_soilstate_inparm + organic_frac_squared = .false. +/ +&clm_nitrogen + lnc_opt = .false. +/ +&clm_snowhydrology_inparm + lotmp_snowdensity_method = 'Slater2017' + reset_snow = .false. + reset_snow_glc = .false. + reset_snow_glc_ela = 1.e9 + snow_dzmax_l_1 = 0.03d00 + snow_dzmax_l_2 = 0.07d00 + snow_dzmax_u_1 = 0.02d00 + snow_dzmax_u_2 = 0.05d00 + snow_dzmin_1 = 0.010d00 + snow_dzmin_2 = 0.015d00 + snow_overburden_compaction_method = 'Vionnet2012' + upplim_destruct_metamorph = 175.d00 + wind_dependent_snow_density = .true. +/ +&cnprecision_inparm +/ +&clm_glacier_behavior + glacier_region_behavior = 'single_at_atm_topo','virtual','virtual','multiple' + glacier_region_ice_runoff_behavior = 'melted','melted','remains_ice','remains_ice' + glacier_region_melt_behavior = 'remains_in_place','replaced_by_ice','replaced_by_ice','replaced_by_ice' +/ +&crop +/ +&irrigation_inparm + irrig_depth = 0.6 + irrig_length = 14400 + irrig_method_default = 'drip' + irrig_min_lai = 0.0 + irrig_start_time = 21600 + irrig_target_smp = -3400. + irrig_threshold_fraction = 1.0 + limit_irrigation_if_rof_enabled = .false. + use_groundwater_irrigation = .false. +/ +&surfacealbedo_inparm + snowveg_affects_radiation = .true. +/ +&water_tracers_inparm + enable_water_isotopes = .false. + enable_water_tracer_consistency_checks = .false. +/ +&clm_humanindex_inparm + calc_human_stress_indices = 'FAST' +/ +&cnmresp_inparm +/ +&photosyns_inparm + leafresp_method = 0 + light_inhibit = .true. + modifyphoto_and_lmr_forcrop = .true. + rootstem_acc = .false. + stomatalcond_method = 'Medlyn2011' +/ +&cnfire_inparm +/ +&cn_general +/ +&nitrif_inparm +/ +&lifire_inparm +/ +&ch4finundated +/ +&clm_canopy_inparm + leaf_mr_vcm = 0.015d00 +/ +&scf_swenson_lawrence_2012_inparm + int_snow_max = 2000. + n_melt_glcmec = 10.0d00 +/ +!#-------------------------------------------------------------------------------------------------------------------------- +!# lnd_in:: Comment: +!# This namelist was created using the following command-line: +!# /glade/work/negins/ctsm_negin/bld/CLM build-namelist -cimeroot /glade/work/negins/ctsm_negin/cime/scripts/Tools/../.. -infile /glade/scratch/negins/ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_lilac_2/Buildconf/clmconf/namelist -csmdata /glade/p/cesmdata/cseg/inputdata -inputdata /glade/scratch/negins/ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_lilac_2/Buildconf/clm.input_data_list -ignore_ic_year -namelist &clm_inparm start_ymd=20000101 / -use_case 2000_control -res 4x5 -clm_start_type default -envxml_dir /glade/scratch/negins/ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_lilac_2 -l_ncpl 48 -configuration clm -structure standard -lnd_frac /glade/p/cesmdata/cseg/inputdata/share/domains/domain.lnd.fv4x5_gx3v7.091218.nc -glc_nec 10 -co2_ppmv 367.0 -co2_type constant -config /glade/scratch/negins/ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_lilac_2/Buildconf/clmconf/config_cache.xml -bgc sp -clm_accelerated_spinup off -lnd_tuning_mode clm5_0_GSWP3v1 -mask gx3v7 +!# For help on options use: /glade/work/negins/ctsm_negin/bld/CLM build-namelist -help +!#-------------------------------------------------------------------------------------------------------------------------- diff --git a/lilac/atm_driver/namelist_lilac b/lilac/atm_driver/namelist_lilac new file mode 100644 index 0000000000..d766ab7ef7 --- /dev/null +++ b/lilac/atm_driver/namelist_lilac @@ -0,0 +1,10 @@ +&input + s_month = 5, + s_day = 15, + s_hour = 9, + s_min = 0, + e_month = 5, + e_day = 15, + e_hour = 9, + e_min = 30 +/ diff --git a/lilac/lilac/lilac_atmcap.F90 b/lilac/lilac/lilac_atmcap.F90 index c56c66cfe7..3fbd3bb189 100644 --- a/lilac/lilac/lilac_atmcap.F90 +++ b/lilac/lilac/lilac_atmcap.F90 @@ -1,297 +1,226 @@ -module atmos_cap +module lilac_atmcap - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! This is a dummy atmosphere cap for setting up lilac structure. + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! This is a dummy atmosphere cap for setting up lilac structure. + !----------------------------------------------------------------------- - ! !USES - use ESMF - use lilac_utils , only : fld_list_type - use spmdMod , only : masterproc - use clm_varctl , only : iulog - implicit none + ! !USES + use ESMF + use lilac_utils , only : atm2lnd, lnd2atm, gindex_atm + implicit none - include 'mpif.h' + include 'mpif.h' - character(*), parameter :: modname = "atmos_cap" - !!integer, parameter :: fldsMax = 100 - type(ESMF_Field), public , save :: field - type(fld_list_type), public , allocatable :: c2a_fldlist(:) - type(fld_list_type), public , allocatable :: a2c_fldlist(:) - integer , public , allocatable :: dummy_gindex_atm(:) + public :: atmos_register - integer :: a2c_fldlist_num - integer :: c2a_fldlist_num - public :: atmos_register - !real(kind=ESMF_KIND_R8), dimension(:), public, pointer, save :: fldptr - integer :: mpierror, numprocs - integer :: i, myid - integer status(MPI_STATUS_SIZE) ! Status of message - integer, parameter :: debug = 1 ! internal debug leve + integer :: mytask + character(*), parameter :: modname = "atmos_cap" + integer, parameter :: debug = 0 ! internal debug level +!======================================================================== +contains +!======================================================================== + subroutine atmos_register (comp, rc) - character(len=128) :: fldname - integer, parameter :: begc = 1 !-- internal debug level - integer, parameter :: endc = 3312/4/2/2 !-- internal debug level - character(*),parameter :: F02 = "('[atmos_cap]',a,i5,2x,d26.19)" + type(ESMF_GridComp) :: comp ! must not be optional + integer, intent(out) :: rc + + ! local variables + type(ESMF_VM) :: vm + character(len=*), parameter :: subname=trim(modname)//':(atmos_register) ' + !------------------------------------------------------------------------- + + call ESMF_VMGetGlobal(vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_VMGet(vm, localPet=mytask, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - !======================================================================== - contains - !======================================================================== + if (mytask == 0) then + print *, "in user register routine" + end if + + ! Initialize return code + rc = ESMF_SUCCESS + + ! Set the entry points for standard ESMF Component methods + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=atmos_init, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_run, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=atmos_final, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + end subroutine atmos_register + +!======================================================================== + + subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) + + ! input/output variables + type (ESMF_GridComp) :: comp + type (ESMF_State) :: lnd2atm_a_state, atm2lnd_a_state + type (ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + type(ESMF_Mesh) :: atmos_mesh + type(ESMF_DistGrid) :: atmos_distgrid + type(ESMF_Field) :: field + type(ESMF_FieldBundle) :: c2a_fb , a2c_fb + character(len=ESMF_MAXSTR) :: atmos_mesh_filepath + integer :: n, i, myid + integer :: mpierror, numprocs + integer :: petCount, localrc, urc + character(*),parameter :: F02 = "('[atmos_cap]',a,i5,2x,d26.19)" + character(len=*), parameter :: subname=trim(modname)//': [atmos_init] ' + !------------------------------------------------------------------------- + + ! Initialize return code + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//"------------------------!", ESMF_LOGMSG_INFO) + + call ESMF_GridCompGet (comp, petcount=petcount, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + + !------------------------------------------------------------------------- + ! Read in the mesh + !------------------------------------------------------------------------- + + ! TODO: use ESMF VM calls + call MPI_Comm_size(MPI_COMM_WORLD, numprocs, mpierror) + call MPI_Comm_rank(MPI_COMM_WORLD, myid, mpierror) + + atmos_mesh_filepath = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - subroutine atmos_register (comp, rc) - - type(ESMF_GridComp) :: comp ! must not be optional - integer, intent(out) :: rc - character(len=*), parameter :: subname=trim(modname)//':(atmos_register) ' - - !------------------------------------------------------------------------- - - print *, "in user register routine" - - ! Initialize return code - rc = ESMF_SUCCESS + atmos_distgrid = ESMF_DistGridCreate (arbSeqIndexList=gindex_atm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=atmos_init, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + atmos_mesh = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, & + elementDistGrid=atmos_distgrid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_LogWrite(subname//"Mesh for atmosphere is created!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + !print *, "!Mesh for atmosphere is created!" + end if - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + !------------------------------------------------------------------------- + ! Atmosphere to Coupler (land) Fields -- atmos --> land + ! - Create empty field bundle -- a2c_fb + ! - Create Fields and add them to field bundle + ! - Add a2c_fb to state (atm2lnd_a_state) + !------------------------------------------------------------------------- + + ! Create individual fields and add to field bundle -- a2c + a2c_fb = ESMF_FieldBundleCreate(name="a2c_fb", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=atmos_final, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - end subroutine atmos_register - - - - subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) - - type (ESMF_GridComp) :: comp - type (ESMF_State) :: lnd2atm_a_state, atm2lnd_a_state - type (ESMF_Clock) :: clock - integer, intent(out) :: rc - - ! local variables - type (ESMF_FieldBundle) :: c2a_fb , a2c_fb - integer :: n - type(ESMF_Mesh) :: atmos_mesh - type(ESMF_Mesh) :: atmos_mesh_tmp - character(len=ESMF_MAXSTR) :: atmos_mesh_filepath - integer :: petCount, localrc, urc - integer :: mid, by2, quart, by4 - type(ESMF_Grid) :: atmos_grid - type(ESMF_DistGrid) :: atmos_distgrid - logical :: mesh_switch - character(len=*), parameter :: subname=trim(modname)//': [atmos_init] ' - !integer :: regDecomp(:,:) - - !------------------------------------------------------------------------- - ! Initialize return code - rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//"------------------------!", ESMF_LOGMSG_INFO) - - call ESMF_GridCompGet (comp, petcount=petcount, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - - !------------------------------------------------------------------------- - ! Read in the mesh ----or----- Generate the grid - !------------------------------------------------------------------------- - mesh_switch = .True. - call MPI_Comm_size(MPI_COMM_WORLD, numprocs, mpierror) - call MPI_Comm_rank(MPI_COMM_WORLD, myid, mpierror) - - - - if(mesh_switch) then - ! TODO: hard-coded mesh file name shoulb be corrected. - ! For now this is our dummy mesh: - !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/T31_040122_ESMFmesh.nc' !! Negin: This did not work.... - !atmos_mesh_filepath = '/gpfs/fs1/p/cesmdata/cseg/inputdata/share/meshes/fv1.9x2.5_141008_ESMFmesh.nc' - atmos_mesh_filepath = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - - - atmos_mesh_tmp = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Mesh for atmosphere is created!", ESMF_LOGMSG_INFO) - !print *, "!Mesh for atmosphere is created!" - - atmos_distgrid = ESMF_DistGridCreate (arbSeqIndexList=dummy_gindex_atm, rc=rc) - - ! recreate the mesh using the above distgrid - atmos_mesh = ESMF_MeshCreate(atmos_mesh_tmp, elementDistgrid=atmos_distgrid, rc=rc) - - else - !TODO: Fix how you want to create the grid here if mesh_switch is off - !atmos_grid= ESMF_GridCreateNoPeriDimUfrmR( maxIndex=(/180,360 /), & - ! minCornerCoord=(/0._ESMF_KIND_R8, 0._ESMF_KIND_R8/), & - ! maxCornerCoord=(/180._ESMF_KIND_R8, 360._ESMF_KIND_R8/), & - ! regDecomp=(/petcount,1/), rc=rc) - - atmos_grid = ESMF_GridCreateNoPeriDimUfrm( minIndex= (/1,1/), maxIndex=(/180,360 /), & - maxCornerCoord=(/180._ESMF_KIND_R8, 360._ESMF_KIND_R8/), & - minCornerCoord=(/0._ESMF_KIND_R8, 0._ESMF_KIND_R8/), & - coordSys=ESMF_COORDSYS_CART,& - regDecomp=(/1,petcount/),& - rc=rc) - call ESMF_LogWrite(subname//"Grid for atmosphere is created!", ESMF_LOGMSG_INFO) - !print *, "Grid for atmosphere is created!" - endif - - !------------------------------------------------------------------------- - ! Atmosphere to Coupler (land) Fields -- atmos --> land - ! I- Create empty field bundle -- a2c_fb - ! II- Create Fields and add them to field bundle - ! III - Add a2c_fb to state (atm2lnd_a_state) - !------------------------------------------------------------------------- - - a2c_fb = ESMF_FieldBundleCreate(name="a2c_fb", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! Create individual fields and add to field bundle -- a2c - - a2c_fldlist_num = 17 - - do n = 1,a2c_fldlist_num - - ! create field - !!! Here we want to pass pointers - !field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(a2c_fldlist(n)%stdname), rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(a2c_fldlist(n)%stdname), farrayPtr=a2c_fldlist(n)%farrayptr1d, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !call ESMF_FieldFill(field, dataFillScheme = "sincos" , rc=rc) - !call ESMF_FieldFill(field, dataFillScheme = "const" , const1=real(n, ESMF_KIND_R8), rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (myid == 0 .and. debug > 0) then - print *, "***************************************************" - print *, "Here we are printing field!" - print *, "creating field for a2c:" - print *, trim(a2c_fldlist(n)%stdname) - print *, a2c_fldlist(n)%farrayptr1d - !call ESMF_FieldPrint(field, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if - - !call ESMF_LogWrite(subname//"fieldget!", ESMF_LOGMSG_INFO) - !call ESMF_FieldGet(field, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! add field to field bundle - call ESMF_FieldBundleAdd(a2c_fb, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - enddo - - if (myid == 0 .and. debug > 0) then - do n = 1,a2c_fldlist_num - do i=begc, endc - fldname = a2c_fldlist(n)%stdname - write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, a2c_fldlist(n)%farrayptr1d(i) - enddo - enddo - end if - - call ESMF_LogWrite(subname//"fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) - print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" - - ! Add field bundle to state - call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atm2lnd_a_state is filled with dummy_var field bundle!", ESMF_LOGMSG_INFO) - print *, "!atm2lnd_a_state is filld with dummy_var field bundle!" - - !------------------------------------------------------------------------- - ! Coupler (land) to Atmosphere Fields -- c2a - ! I- Create Field Bundle -- c2a_fb for because we are in atmos - ! II- Create Fields and add them to field bundle - ! III - Add c2a_fb to state (lnd2atm_a_state) - !------------------------------------------------------------------------- - - c2a_fb = ESMF_FieldBundleCreate (name="c2a_fb", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - ! Create individual fields and add to field bundle -- c2a - c2a_fldlist_num = 12 - - do n = 1,c2a_fldlist_num - - ! create field - if (mesh_switch) then - field = ESMF_FieldCreate(atmos_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(c2a_fldlist(n)%stdname), rc=rc) - !field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr1d, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - else - field = ESMF_FieldCreate(atmos_grid, name=trim(c2a_fldlist(n)%stdname), farrayPtr=c2a_fldlist(n)%farrayptr2d, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if - - ! add field to field bundle - call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - if (myid == 0 .and. debug > 0) then - print *, "creating field for c2a:" - print *, n - print *, trim(c2a_fldlist(n)%stdname) - print *, c2a_fldlist(n)%farrayptr1d - call ESMF_FieldPrint(field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if - enddo - - call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) + ! create fields and add to field bundle + do n = 1, size(atm2lnd) + field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & + name=trim(atm2lnd(n)%fldname), farrayPtr=atm2lnd(n)%dataptr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_FieldBundleAdd(a2c_fb, (/field/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + end do - ! Add field bundle to state - call ESMF_StateAdd(lnd2atm_a_state, (/c2a_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//"fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" + end if - ! Set Attributes needed by land - call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) - - end subroutine atmos_init - - subroutine atmos_run(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc - - character(len=*), parameter :: subname=trim(modname)//': [atmos_run] ' - - ! Initialize return code - rc = ESMF_SUCCESS + ! Add field bundle to state + call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//"Should atmos_run ", ESMF_LOGMSG_INFO) - end subroutine atmos_run + call ESMF_LogWrite(subname//"atm2lnd_a_state is filled with dummy_var field bundle!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "!atm2lnd_a_state is filld with dummy_var field bundle!" + end if - subroutine atmos_final(comp, importState, exportState, clock, rc) - type(ESMF_GridComp) :: comp - type(ESMF_State) :: importState, exportState - type(ESMF_Clock) :: clock - integer, intent(out) :: rc + !------------------------------------------------------------------------- + ! Coupler (land) to Atmosphere Fields -- c2a + ! - Create Field Bundle -- c2a_fb for because we are in atmos + ! - Create Fields and add them to field bundle + ! - Add c2a_fb to state (lnd2atm_a_state) + !------------------------------------------------------------------------- - character(len=*), parameter :: subname=trim(modname)//': [atmos_final] ' - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle + c2a_fb = ESMF_FieldBundleCreate (name="c2a_fb", rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - ! Initialize return code - rc = ESMF_SUCCESS + ! create fields and add to field bundle + do n = 1, size(lnd2atm) + field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & + name=trim(lnd2atm(n)%fldname), farrayPtr=lnd2atm(n)%dataptr, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + if (debug > 0) then + call ESMF_FieldPrint(field, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + end if + end do + call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) + + ! Add field bundle to state + call ESMF_StateAdd(lnd2atm_a_state, (/c2a_fb/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_StateGet(importState, "c2a_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + ! Set Attributes needed by land + call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) ! TODO: mv what in the world is this??? - call ESMF_StateGet(exportState, "a2c_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail ou + end subroutine atmos_init +!======================================================================== - call ESMF_FieldBundleDestroy(import_fieldbundle, rc=rc) - call ESMF_FieldBundleDestroy(export_fieldbundle, rc=rc) + subroutine atmos_run(comp, importState, exportState, clock, rc) - call ESMF_LogWrite(subname//"?? Are there any other thing for destroying in atmos_final??", ESMF_LOGMSG_INFO) + ! input/output variables + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc - end subroutine atmos_final + ! local variables + character(len=*), parameter :: subname=trim(modname)//': [atmos_run] ' -end module atmos_cap + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"Should atmos_run ", ESMF_LOGMSG_INFO) + + end subroutine atmos_run + +!======================================================================== + + subroutine atmos_final(comp, importState, exportState, clock, rc) + type(ESMF_GridComp) :: comp + type(ESMF_State) :: importState, exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + character(len=*), parameter :: subname=trim(modname)//': [atmos_final] ' + type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle + + ! Initialize return code + rc = ESMF_SUCCESS + + call ESMF_StateGet(importState, "c2a_fb", import_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_StateGet(exportState, "a2c_fb", export_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_FieldBundleDestroy(import_fieldbundle, rc=rc) + call ESMF_FieldBundleDestroy(export_fieldbundle, rc=rc) + + call ESMF_LogWrite(subname//"?? Are there any other thing for destroying in atmos_final??", ESMF_LOGMSG_INFO) + + end subroutine atmos_final + +end module lilac_atmcap diff --git a/lilac/lilac/lilac_cpl.F90 b/lilac/lilac/lilac_cpl.F90 index 0fbe51677c..b88b4e361a 100644 --- a/lilac/lilac/lilac_cpl.F90 +++ b/lilac/lilac/lilac_cpl.F90 @@ -1,362 +1,363 @@ -module cpl_mod +module lilac_cpl - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing all routines for both couplers - ! 1- coupler 1 : atm ---> lnd (cpl_atm2lnd) - ! 2- coupler 2 : lnd ---> atm (cpl_lnd2atm) - !----------------------------------------------------------------------- - ! !USES - use ESMF - use clm_varctl , only : iulog - implicit none + !----------------------------------------------------------------------- + ! Module containing all routines for both couplers + ! 1- coupler 1 : atm ---> lnd (cpl_atm2lnd) + ! 2- coupler 2 : lnd ---> atm (cpl_lnd2atm) + !----------------------------------------------------------------------- - include 'mpif.h' + use ESMF + implicit none - private + include 'mpif.h' !TODO: remove this and use ESMF + private - public :: cpl_atm2lnd_register - public :: cpl_lnd2atm_register + public :: cpl_atm2lnd_register + public :: cpl_lnd2atm_register - character(*), parameter :: modname = " cpl_mod" - type(ESMF_RouteHandle), save :: rh_atm2lnd, rh_lnd2atm + type(ESMF_RouteHandle) :: rh_atm2lnd + type(ESMF_RouteHandle) :: rh_lnd2atm + integer :: mytask + character(*), parameter :: modname = "lilac_cpl" - integer :: mpierror, numprocs - integer :: i, myid - integer status(MPI_STATUS_SIZE) +!====================================================================== +contains +!====================================================================== - character(len=128) :: fldname - integer, parameter :: begc = 1 !-- internal debug level - integer, parameter :: endc = 3312/4/2/2 !-- internal debug level - character(*),parameter :: F01 = "('[cpl_mod] ',a,i5,2x,i5,2x,d21.14)" - character(*),parameter :: F02 = "('[cpl_mod]',a,i5,2x,d26.19)" - integer, parameter :: debug = 1 !-- internaldebug level - !====================================================================== - contains - !====================================================================== + subroutine cpl_atm2lnd_register(cplcomp, rc) - subroutine cpl_atm2lnd_register(cplcomp, rc) - type(ESMF_CplComp ) :: cplcomp - integer, intent(out ) :: rc - character(len=* ) , parameter :: subname=trim(modname ) //' : [cpl_atm2lnd_register] ' - - rc = ESMF_SUCCESS - print *, "in cpl_atm2lnd_register routine" - - ! Register the callback routines. - ! Set the entry points for coupler ESMF Component methods - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine= cpl_atm2lnd_init, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_atm2lnd_run , rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_atm2lnd_final, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - end subroutine cpl_atm2lnd_register - - subroutine cpl_lnd2atm_register(cplcomp, rc) - type(ESMF_CplComp ) :: cplcomp - integer, intent(out ) :: rc - character(len=* ) , parameter :: subname=trim(modname ) //' : [cpl_lnd2atm_register] ' - - - rc = ESMF_SUCCESS - print *, "in cpl_lnd2atm_register routine" - - ! Register the callback routines. - ! Set the entry points for coupler ESMF Component methods - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, cpl_lnd2atm_init, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_lnd2atm_run , rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_lnd2atm_final, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - end subroutine cpl_lnd2atm_register - - !-------------------------------------------------------------------------- - ! couplers init.... - !-------------------------------------------------------------------------- - - subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) - - type (ESMF_CplComp ) :: cplcomp - type (ESMF_State ) :: importState - type (ESMF_State ) :: exportState - type (ESMF_Clock ) :: clock - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle - integer, intent(out ) :: rc - character(len=* ) , parameter :: subname=trim(modname) //': [cpl_atm2lnd_init] ' - - rc = ESMF_SUCCESS - print *, "Coupler for atmosphere to land initialize routine called" - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - - call MPI_Comm_size(MPI_COMM_WORLD, numprocs, mpierror) - call MPI_Comm_rank(MPI_COMM_WORLD, myid, mpierror) - - - - call ESMF_StateGet(importState, trim("a2c_fb"), import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_StateGet(exportState, trim("c2l_fb"), export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - - if (myid == 0) then - print *, "PRINTING FIELDBUNDLES" - call ESMF_FieldBundlePrint (import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_FieldBundlePrint (export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if - - - call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) - !call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) - end subroutine cpl_atm2lnd_init - - subroutine cpl_lnd2atm_init(cplcomp, importState, exportState, clock, rc) - - type (ESMF_CplComp ) :: cplcomp - type (ESMF_State ) :: importState - type (ESMF_State ) :: exportState - type (ESMF_Clock ) :: clock - type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle - integer, intent(out ) :: rc - character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_lnd2atm_init] ' + ! input/output variables + type(ESMF_CplComp ) :: cplcomp + integer, intent(out ) :: rc - rc = ESMF_SUCCESS - print *, "Coupler for land to atmosphere initialize routine called" - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) + ! local variables + type(ESMF_VM) :: vm + character(len=*) , parameter :: subname=trim(modname ) //' : [cpl_atm2lnd_register] ' + !--------------------------------------------------- - call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + rc = ESMF_SUCCESS - call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_VMGetGlobal(vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_VMGet(vm, localPet=mytask, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - !call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) - end subroutine cpl_lnd2atm_init + print *,'mytask= ',mytask + if (mytask == 0) then + print *, "in cpl_atm2lnd_register routine" + end if - !-------------------------------------------------------------------------- - ! Couplers Run phase - !-------------------------------------------------------------------------- + ! Register the callback routines. + ! Set the entry points for coupler ESMF Component methods + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine= cpl_atm2lnd_init, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_atm2lnd_run , rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - type(ESMF_CplComp ) :: cplcomp - type(ESMF_State ) :: importState - type(ESMF_State ) :: exportState - type(ESMF_Clock ) :: clock - integer, intent(out ) :: rc - type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle - character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_run] ' + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_atm2lnd_final, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + end subroutine cpl_atm2lnd_register - real, pointer :: fldptr1d(:) +!====================================================================== - rc = ESMF_SUCCESS - print *, "Running cpl_atm2lnd_run" - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) + subroutine cpl_lnd2atm_register(cplcomp, rc) - call ESMF_StateGet(importState, trim("a2c_fb"), import_fieldbundle, rc=rc) - !call ESMF_StateGet(importState, itemName=trim("a2c_fb"), item=import_fieldbundle, rc=rc) ! this syntax was not working??? - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//" got a2c fieldbundle!", ESMF_LOGMSG_INFO) + type(ESMF_CplComp) :: cplcomp + integer, intent(out ) :: rc - call ESMF_StateGet(exportState, trim("c2l_fb"), export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//" got c2l fieldbundle!", ESMF_LOGMSG_INFO) + ! local variables + character(len=* ) , parameter :: subname=trim(modname ) //' : [cpl_lnd2atm_register] ' + !--------------------------------------------------- - !fldname = 'Sa_topo' - !call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + rc = ESMF_SUCCESS + if (mytask == 0) then + print *, "in cpl_lnd2atm_register routine" + end if - !call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) - call ESMF_FieldBundleRedist(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//" regridding fieldbundles from atmos to land!", ESMF_LOGMSG_INFO) + ! Register the callback routines. + ! Set the entry points for coupler ESMF Component methods + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, cpl_lnd2atm_init, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - end subroutine cpl_atm2lnd_run + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_lnd2atm_run , rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_lnd2atm_final, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + end subroutine cpl_lnd2atm_register - subroutine cpl_lnd2atm_run(cplcomp, importState, exportState, clock, rc) +!====================================================================== - type(ESMF_CplComp ) :: cplcomp - type(ESMF_State ) :: importState - type(ESMF_State ) :: exportState - type(ESMF_Clock ) :: clock - integer, intent(out ) :: rc - type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle - character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_lnd2atm_run] ' + subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) - rc = ESMF_SUCCESS - print *, "Running cpl_lnd2atm_run" - call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) + ! input/output variables + type (ESMF_CplComp ) :: cplcomp + type (ESMF_State ) :: importState + type (ESMF_State ) :: exportState + type (ESMF_Clock ) :: clock + integer, intent(out ) :: rc - call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + ! local variables + type (ESMF_FieldBundle) :: import_fieldbundle + type (ESMF_FieldBundle) :: export_fieldbundle + integer :: n + integer :: fieldcount + character(len=128), allocatable :: fieldlist(:) + character(len=128) :: cvalue + character(len=*), parameter :: subname=trim(modname) //': [cpl_atm2lnd_init] ' + !--------------------------------------------------- - call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + rc = ESMF_SUCCESS + if (mytask == 0) then + print *, "Coupler for atmosphere to land initialize routine called" + end if + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) + + call ESMF_StateGet(importState, "a2c_fb", import_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_FieldBundleGet(import_fieldbundle, fieldCount=fieldCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + write(cvalue,*) fieldcount + call ESMF_LogWrite(subname//" a2c_fb field count = "//trim(cvalue), ESMF_LOGMSG_INFO) + allocate(fieldlist(fieldcount)) + call ESMF_FieldBundleGet(import_fieldbundle, fieldNameList=fieldlist, rc=rc) + do n = 1,fieldCount + write(cvalue,*) n + call ESMF_LogWrite(subname//" a2c_fb field "//trim(cvalue)//' = '//trim(fieldlist(n)), ESMF_LOGMSG_INFO) + end do + deallocate(fieldlist) + if (mytask == 0) then + print *, ' a2c_fb field count = ',fieldcount + end if + + call ESMF_StateGet(exportState, "c2l_fb", export_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_FieldBundleGet(export_fieldbundle, fieldCount=fieldCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + write(cvalue,*) fieldcount + call ESMF_LogWrite(subname//" c2l_fb field count = "//trim(cvalue), ESMF_LOGMSG_INFO) + allocate(fieldlist(fieldcount)) + call ESMF_FieldBundleGet(export_fieldbundle, fieldNameList=fieldlist, rc=rc) + do n = 1,fieldCount + write(cvalue,*) n + call ESMF_LogWrite(subname//" c2l_fb field "//trim(cvalue)//' = '//trim(fieldlist(n)), ESMF_LOGMSG_INFO) + end do + deallocate(fieldlist) + if (mytask == 0) then + print *, ' c2l_fb field count = ',fieldcount + end if + + if (mytask == 0) then + print *, "PRINTING FIELDBUNDLES from atm->lnd" + call ESMF_FieldBundlePrint (import_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_FieldBundlePrint (export_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + end if + + call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) + + end subroutine cpl_atm2lnd_init + +!====================================================================== + + subroutine cpl_lnd2atm_init(cplcomp, importState, exportState, clock, rc) + + type (ESMF_CplComp ) :: cplcomp + type (ESMF_State ) :: importState + type (ESMF_State ) :: exportState + type (ESMF_Clock ) :: clock + integer, intent(out ) :: rc - call ESMF_FieldBundleRedist(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - !call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//" regridding fieldbundles from land to atmos!", ESMF_LOGMSG_INFO) + ! local variables + type (ESMF_FieldBundle) :: import_fieldbundle + type (ESMF_FieldBundle) :: export_fieldbundle + integer :: n + integer :: fieldcount + character(len=128), allocatable :: fieldlist(:) + character(len=128) :: cvalue + character(len=*) , parameter :: subname=trim(modname ) //': [cpl_lnd2atm_init] ' + !--------------------------------------------------- - end subroutine cpl_lnd2atm_run + rc = ESMF_SUCCESS - !-------------------------------------------------------------------------- - ! couplers final phase - !-------------------------------------------------------------------------- + if (mytask == 0) then + print *, "Coupler for land to atmosphere initialize routine called" + end if + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) + + call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_FieldBundleGet(import_fieldbundle, fieldCount=fieldCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + write(cvalue,*) fieldcount + call ESMF_LogWrite(subname//" l2c_fb field count = "//trim(cvalue), ESMF_LOGMSG_INFO) + allocate(fieldlist(fieldcount)) + call ESMF_FieldBundleGet(import_fieldbundle, fieldNameList=fieldlist, rc=rc) + do n = 1,fieldCount + write(cvalue,*) n + call ESMF_LogWrite(subname//" l2c_fb field "//trim(cvalue)//' = '//trim(fieldlist(n)), ESMF_LOGMSG_INFO) + end do + deallocate(fieldlist) + if (mytask == 0) then + print *, ' l2c_fb field count = ',fieldcount + end if + + call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_FieldBundleGet(export_fieldbundle, fieldCount=fieldCount, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + write(cvalue,*) fieldcount + call ESMF_LogWrite(subname//" c2a_fb field count = "//trim(cvalue), ESMF_LOGMSG_INFO) + allocate(fieldlist(fieldcount)) + call ESMF_FieldBundleGet(export_fieldbundle, fieldNameList=fieldlist, rc=rc) + do n = 1,fieldCount + write(cvalue,*) n + call ESMF_LogWrite(subname//" c2a_fb field "//trim(cvalue)//' = '//trim(fieldlist(n)), ESMF_LOGMSG_INFO) + end do + deallocate(fieldlist) + if (mytask == 0) then + print *, ' c2a_fb field count = ',fieldcount + end if + + call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) + + end subroutine cpl_lnd2atm_init + +!====================================================================== + + subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) + + type(ESMF_CplComp) :: cplcomp + type(ESMF_State) :: importState + type(ESMF_State) :: exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc - subroutine cpl_atm2lnd_final(cplcomp, importState, exportState, clock, rc) + ! local variables + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_run] ' + !--------------------------------------------------- - type (ESMF_CplComp ) :: cplcomp - type (ESMF_State ) :: importState - type (ESMF_State ) :: exportState - type (ESMF_Clock ) :: clock - type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle - integer, intent(out ) :: rc - character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_final] ' + rc = ESMF_SUCCESS + if (mytask == 0) then + print *, "Running cpl_atm2lnd_run" + end if + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - rc = ESMF_SUCCESS + call ESMF_StateGet(importState, trim("a2c_fb"), import_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//" got a2c fieldbundle!", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) + call ESMF_StateGet(exportState, trim("c2l_fb"), export_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//" got c2l fieldbundle!", ESMF_LOGMSG_INFO) - ! Only thing to do here is release redist (or regrid) and route handles - call ESMF_FieldBundleRegridRelease (routehandle=rh_atm2lnd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_FieldBundleRedist(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//" regridding fieldbundles from atmos to land!", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//" rh_atm2lnd route handle released!", ESMF_LOGMSG_INFO) + end subroutine cpl_atm2lnd_run - end subroutine cpl_atm2lnd_final +!====================================================================== - subroutine cpl_lnd2atm_final(cplcomp, importState, exportState, clock, rc) + subroutine cpl_lnd2atm_run(cplcomp, importState, exportState, clock, rc) - type (ESMF_CplComp ) :: cplcomp - type (ESMF_State ) :: importState - type (ESMF_State ) :: exportState - type (ESMF_Clock ) :: clock - type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle - integer, intent(out ) :: rc - character(len=* ) , parameter :: subname=trim(modname) //': [cpl_lnd2atm_final] ' + type(ESMF_CplComp) :: cplcomp + type(ESMF_State) :: importState + type(ESMF_State) :: exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc - rc = ESMF_SUCCESS + ! local variables + type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle + character(len=*) , parameter :: subname=trim(modname ) //': [cpl_lnd2atm_run] ' + !--------------------------------------------------- - call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) - ! Only thing to do here is release redist (or regrid) and route handles - call ESMF_FieldBundleRegridRelease (routehandle=rh_lnd2atm , rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + rc = ESMF_SUCCESS + if (mytask == 0) then + print *, "Running cpl_lnd2atm_run" + end if + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//" rh_lnd2atm route handle released!", ESMF_LOGMSG_INFO) + call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - end subroutine cpl_lnd2atm_final + call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_FieldBundleRedist(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - !=============================================================================== + call ESMF_LogWrite(subname//" regridding fieldbundles from land to atmos!", ESMF_LOGMSG_INFO) - subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) + end subroutine cpl_lnd2atm_run - ! ---------------------------------------------- - ! Get pointer to a state field - ! ---------------------------------------------- +!====================================================================== - use ESMF , only : ESMF_State, ESMF_Field, ESMF_Mesh, ESMF_FieldStatus_Flag - use ESMF , only : ESMF_FieldBundle - use ESMF , only : ESMF_StateGet, ESMF_FieldGet, ESMF_MeshGet - use ESMF , only : ESMF_FIELDSTATUS_COMPLETE, ESMF_FAILURE - use ESMF , only : ESMF_FieldBundleGet + subroutine cpl_atm2lnd_final(cplcomp, importState, exportState, clock, rc) ! input/output variables - type(ESMF_State), intent(in) :: State - character(len=*), intent(in) :: fldname - real , pointer, optional , intent(out) :: fldptr1d(:) - real , pointer, optional , intent(out) :: fldptr2d(:,:) - integer, intent(out) :: rc + type (ESMF_CplComp) :: cplcomp + type (ESMF_State) :: importState + type (ESMF_State) :: exportState + type (ESMF_Clock) :: clock + integer, intent(out) :: rc ! local variables - type(ESMF_FieldStatus_Flag) :: status - type(ESMF_Field) :: lfield - type(ESMF_Mesh) :: lmesh - integer :: nnodes, nelements - character(len=*), parameter :: subname='(lnd_import_export:state_getfldptr)' - - type(ESMF_StateItem_Flag) :: itemFlag - type(ESMF_FieldBundle) :: fieldBundle - logical :: isPresent - ! ---------------------------------------------- + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + character(len=*) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_final] ' + !--------------------------------------------------- rc = ESMF_SUCCESS - ! Determine if this field bundle exist.... - ! TODO: combine the error checks.... - + call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) - call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) - !call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + ! Only thing to do here is release redist (or regrid) and route handles + call ESMF_FieldBundleRegridRelease (routehandle=rh_atm2lnd, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - ! Get the fieldbundle from state... - call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_LogWrite(subname//" rh_atm2lnd route handle released!", ESMF_LOGMSG_INFO) + end subroutine cpl_atm2lnd_final - call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) - !call ESMF_FieldBundleGet(fieldBundle,trim(fldname), lfield, isPresent, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out +!====================================================================== - call ESMF_FieldGet(lfield, status=status, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + subroutine cpl_lnd2atm_final(cplcomp, importState, exportState, clock, rc) - if (status /= ESMF_FIELDSTATUS_COMPLETE) then - call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) - rc = ESMF_FAILURE - return - else - call ESMF_FieldGet(lfield, mesh=lmesh, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_MeshGet(lmesh, numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - if (nnodes == 0 .and. nelements == 0) then - call ESMF_LogWrite(trim(subname)//": no local nodes or elements ", ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - - if (present(fldptr1d)) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if ( debug > 0) then - write(iulog,F01)' in '//trim(subname)//'fldptr1d for '//trim(fldname)//' is ' - end if - !print *, "FLDPTR1D is" - !print *, FLDPTR1d - else if (present(fldptr2d)) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - else - !call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") - end if - endif ! status + type (ESMF_CplComp) :: cplcomp + type (ESMF_State) :: importState + type (ESMF_State) :: exportState + type (ESMF_Clock) :: clock + integer, intent(out) :: rc + ! local variables + character(len=*) , parameter :: subname=trim(modname) //': [cpl_lnd2atm_final] ' + !--------------------------------------------------- - end subroutine state_getfldptr + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) + ! Only thing to do here is release redist (or regrid) and route handles + call ESMF_FieldBundleRegridRelease (routehandle=rh_lnd2atm , rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//" rh_lnd2atm route handle released!", ESMF_LOGMSG_INFO) -end module cpl_mod + end subroutine cpl_lnd2atm_final +end module lilac_cpl diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 1e53604cb6..25a72c6287 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -1,614 +1,476 @@ module lilac_mod + !----------------------------------------------------------------------- + ! !DESCRIPTION: + !----------------------------------------------------------------------- + + use ESMF + implicit none + + public :: lilac_init + public :: lilac_run + + ! Clock, TimeInterval, and Times + type(ESMF_Clock) :: clock + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Time) :: startTime + type(ESMF_Time) :: stopTime + type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest + type(ESMF_Calendar),target :: calendar + integer :: yy,mm,dd,sec + + ! Gridded Components and Coupling Components + type(ESMF_GridComp) :: atm_gcomp + type(ESMF_GridComp) :: lnd_gcomp + type(ESMF_CplComp) :: cpl_atm2lnd_comp + type(ESMF_CplComp) :: cpl_lnd2atm_comp + type(ESMF_State) :: atm2lnd_l_state, atm2lnd_a_state + type(ESMF_State) :: lnd2atm_a_state, lnd2atm_l_state + character(*) , parameter :: modname = "lilac_mod" + + integer :: mytask + +!======================================================================== +contains +!======================================================================== + + subroutine lilac_init(lsize) + + ! -------------------------------------------------------------------------------- + ! This is called by the host atmosphere + ! -------------------------------------------------------------------------------- + + use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd + use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register + use lilac_atmcap , only : atmos_register + use lnd_comp_esmf , only : lnd_register !ctsm routine + use shr_pio_mod , only : shr_pio_init1 + + ! input/output variables + integer, intent(in) :: lsize + + ! local variables + type(ESMF_State) :: importState, exportState + type(ESMF_VM) :: vm + integer :: rc + character(len=ESMF_MAXSTR) :: cname !components or cpl names + integer :: COMP_COMM + integer :: ierr + integer :: mpic ! mpi communicator + integer :: n, i + integer :: fileunit + integer, parameter :: debug = 1 !-- internal debug level + character(len=*), parameter :: subname=trim(modname)//': [lilac_init] ' + + ! Namelist and related variables + integer :: s_month, s_day, s_hour, s_min + integer :: e_month, e_day, e_hour, e_min + namelist /input/ s_month, s_day, s_hour, s_min, e_month, e_day, e_hour, e_min + !------------------------------------------------------------------------ - !----------------------------------------------------------------------- - ! !DESCRIPTION: - - ! !USES - use ESMF - use lilac_utils , only : fld_list_type, fldsMax, create_fldlists - use lilac_utils , only : atm2lnd_data1d_type , lnd2atm_data1d_type - use lilac_utils , only : atm2lnd_data2d_type , lnd2atm_data2d_type - use atmos_cap , only : atmos_register - !use lnd_shr_methods - use lnd_comp_esmf , only : lnd_register - use cpl_mod , only : cpl_atm2lnd_register , cpl_lnd2atm_register - - use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS - use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 - - use clm_varctl , only : iulog - use spmdMod , only : masterproc - implicit none - - !TODO (NS,2019-08-07): - ! We will move this later to lnd_cap (ctsm_cap) and atmos_cap - !use atmos_cap , only : a2l_fldnum - integer , public , parameter :: a2l_fldnum = 17 - integer , public , parameter :: l2a_fldnum = 12 - - public :: lilac_init - public :: lilac_run - - character(*) , parameter :: modname = "lilac_mod" - !type(fld_list_type), public :: a2c_fldlist, c2a_fldlist !defined in atmosphere and land caps.... - + ! Initialize return code + rc = ESMF_SUCCESS + + !------------------------------------------------------------------------- + ! Initialize ESMF, set the default calendar and log type. + !------------------------------------------------------------------------- + + ! TODO: cannot assume that the calendar is always gregorian unless CTSM assumes this as well + ! Need to coordinate the calendar info between lilac and the host component + call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN, logappendflag=.false., rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_LogSet(flush=.true.) + + call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"Initializing ESMF ", ESMF_LOGMSG_INFO) + + ! Initialize pio (needed by CTSM) - TODO: this should be done within CTSM not here + + call ESMF_VMGetGlobal(vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_VMGet(vm, localPet=mytask, mpiCommunicator=mpic, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call shr_pio_init1(ncomps=1, nlfilename="drv_in", Global_Comm=mpic) ! TODO: make the filename lilac_in + + ! Initialize atm2lnd and lnd2atm data types + call lilac_init_atm2lnd(lsize) + call lilac_init_lnd2atm(lsize) + + !------------------------------------------------------------------------- + ! Read in configuration data -- namelist.input from host atmosphere(wrf) + !------------------------------------------------------------------------- + + ! Read in namelist file ... + + if (mytask == 0) then + print *, "---------------------------------------" + end if + + ! TODO: put checks for error below + ! TODO: only the master lilac proc should read the namelist file and do a broadcast to the + ! other processors + open(newunit=fileunit, status="old", file="namelist_lilac", action="read", iostat=rc) + read(fileunit, input) + close(fileunit) + + !------------------------------------------------------------------------- + ! Create Gridded Component! -- atmosphere ( atmos_cap) + !------------------------------------------------------------------------- + cname = " Atmosphere or Atmosphere Cap" + atm_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Atmosphere Gridded Component Created!" + end if + + !------------------------------------------------------------------------- + ! Create Gridded Component! --- CTSM land ( land_capX ) + !------------------------------------------------------------------------- + cname = " Land ctsm " + lnd_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, " Land (ctsm) Gridded Component Created!" + end if + + !------------------------------------------------------------------------- + ! Create Coupling Component! --- Coupler from atmos to land + !------------------------------------------------------------------------- + cname = "Coupler from atmosphere to land" + cpl_atm2lnd_comp = ESMF_CplCompCreate(name=cname, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "1st Coupler Component (atmosphere to land ) Created!" + end if + + !------------------------------------------------------------------------- + ! Create Coupling Component! -- Coupler from land to atmos + !------------------------------------------------------------------------- + cname = "Coupler from land to atmosphere" + cpl_lnd2atm_comp = ESMF_CplCompCreate(name=cname, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "2nd Coupler Component (land to atmosphere) Created!" + end if + + !------------------------------------------------------------------------- + ! Register section -- set services -- atmos_cap + !------------------------------------------------------------------------- + call ESMF_GridCompSetServices(atm_gcomp, userRoutine=atmos_register, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//" atmos SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, " Atmosphere Gridded Component SetServices finished!" + end if + + !------------------------------------------------------------------------- + ! Register section -- set services -- land cap + !------------------------------------------------------------------------- + call ESMF_GridCompSetServices(lnd_gcomp, userRoutine=lnd_register, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"land SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Land Gridded Component SetServices finished!" + end if + + !------------------------------------------------------------------------- + ! Register section -- set services -- coupler atmosphere to land + !------------------------------------------------------------------------- + call ESMF_CplCompSetServices(cpl_atm2lnd_comp, userRoutine=cpl_atm2lnd_register, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"Coupler from atmosphere to land SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Coupler from atmosphere to land SetServices finished!" + end if + + !------------------------------------------------------------------------- + ! Register section -- set services -- coupler land to atmosphere + !------------------------------------------------------------------------- + call ESMF_CplCompSetServices(cpl_lnd2atm_comp, userRoutine=cpl_lnd2atm_register, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"Coupler from land to atmosphere SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Coupler from land to atmosphere SetServices finished!" + end if + !------------------------------------------------------------------------- + ! Create and initialize a clock! + ! Clock is initialized here from namelist.input from WRF..... still we + ! are looping over time from host atmosphere + !------------------------------------------------------------------------- + calendar = ESMF_CalendarCreate(name='lilac_drv_NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) + call ESMF_TimeIntervalSet(TimeStep, s=2, rc=rc) ! time step every 2second + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + !call ESMF_TimeSet(startTime, yy=2003, mm=s_month, dd=s_day, h=s_hour, m=s_min, s=0, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + !call ESMF_TimeSet(stopTime, yy=2003, mm=e_month, dd=e_day, h=e_hour, m=e_min, s=0, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + !clock = ESMF_ClockCreate(timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1 , s=0, calendar=Calendar, rc=rc) + call ESMF_TimeSet(StopTime , yy=2000, mm=03, dd=01, s=0, calendar=Calendar, rc=rc) + !call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) + call ESMF_TimeIntervalSet(TimeStep, s=1800, rc=rc) + clock = ESMF_ClockCreate(name='lilac_drv_EClock', TimeStep=TimeStep, startTime=StartTime, & + RefTime=StartTime, stopTime=stopTime, rc=rc) + + if (mytask == 0) then + print *, "---------------------------------------" + end if + !call ESMF_ClockPrint (clock, rc=rc) + if (mytask == 0) then + print *, "=======================================" + end if + !call ESMF_CalendarPrint ( calendar , rc=rc) + if (mytask == 0) then + print *, "---------------------------------------" + end if + + ! ------------------------------------------------------------------------- + ! Initialze lilac_atm gridded component + ! First Create the empty import and export states used to pass data + ! between components. (these are module variables) + ! ------------------------------------------------------------------------- + + atm2lnd_a_state = ESMF_StateCreate(name='atm_state_on_atm_mesh', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + lnd2atm_a_state = ESMF_StateCreate(name='lnd_state_on_lnd_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_GridCompInitialize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp initialized", ESMF_LOGMSG_INFO) + + call ESMF_LogWrite(subname//"lilac_atm gridded component initialized", ESMF_LOGMSG_INFO) + + ! ------------------------------------------------------------------------- + ! Initialze CTSM Gridded Component + ! First Create the empty import and export states used to pass data + ! between components. (these are module variables) + ! ------------------------------------------------------------------------- + + atm2lnd_l_state = ESMF_StateCreate(name='atm_state_on_lnd_mesh', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + lnd2atm_l_state = ESMF_StateCreate(name='lnd_state_on_atm_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_GridCompInitialize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp initialized", ESMF_LOGMSG_INFO) + + call ESMF_LogWrite(subname//"CTSM gridded component initialized", ESMF_LOGMSG_INFO) + + ! ------------------------------------------------------------------------- + ! Initialze LILAC coupler components + ! ------------------------------------------------------------------------- + + call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "coupler :: cpl_atm2lnd_comp initialize finished" !, rc =", rc + end if + + call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "coupler :: cpl_lnd2atm_comp initialize finished" !, rc =", rc + end if + + end subroutine lilac_init + + !======================================================================== + + subroutine lilac_run( ) + + ! local variables + type(ESMF_State) :: importState, exportState + integer :: rc, userRC + type (ESMF_Clock) :: local_clock + character(len=*), parameter :: subname=trim(modname)//': [lilac_run] ' !------------------------------------------------------------------------ - ! !Clock, TimeInterval, and Times - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar),target :: calendar - integer :: yy,mm,dd,sec - ! ! Gridded Components and Coupling Components - type(ESMF_GridComp) :: atmos_gcomp - type(ESMF_GridComp) :: land_gcomp - type(ESMF_CplComp) :: cpl_atm2lnd_comp - type(ESMF_CplComp) :: cpl_lnd2atm_comp - type(ESMF_State) :: atm2lnd_l_state , atm2lnd_a_state - type(ESMF_State) :: lnd2atm_a_state, lnd2atm_l_state - - !======================================================================== - contains - !======================================================================== - - subroutine lilac_init( atm2lnd1d, atm2lnd2d, lnd2atm1d, lnd2atm2d, gindex_atm) - - use atmos_cap , only : a2c_fldlist , c2a_fldlist - use atmos_cap , only : dummy_gindex_atm - use lnd_cap , only : l2c_fldlist , c2l_fldlist - - character(len=*), parameter :: subname=trim(modname)//': [lilac_init] ' - - ! input/output variables - type(atm2lnd_data1d_type), intent(in), optional :: atm2lnd1d - type(atm2lnd_data2d_type), intent(in), optional :: atm2lnd2d - type(lnd2atm_data1d_type), intent(in), optional :: lnd2atm1d - type(lnd2atm_data2d_type), intent(in), optional :: lnd2atm2d - - integer , allocatable :: gindex_atm(:) - ! local variables - - type(ESMF_State) :: importState, exportState - - !character(len=*) :: atm_mesh_filepath !!! For now this is hardcoded in the atmos init - - integer :: rc , userRC - character(len=ESMF_MAXSTR) :: gcname1 , gcname2 ! Gridded components names - character(len=ESMF_MAXSTR) :: ccname1 , ccname2 ! Coupling components names - - - ! Namelist and related variables - integer :: fileunit - integer :: i_max, j_max - real(ESMF_KIND_R8) :: x_min, x_max, y_min, y_max - integer :: s_month, s_day, s_hour, s_min - integer :: e_month, e_day, e_hour, e_min - namelist /input/ i_max, j_max, x_min, x_max, y_min, y_max, & - s_month, s_day, s_hour, s_min, & - e_month, e_day, e_hour, e_min - - - integer :: COMP_COMM - integer :: ierr - integer :: ntasks,mytask ! mpicom size and rank - integer :: ncomps = 1 ! land only - integer :: n - integer :: i - integer, parameter :: debug = 1 !-- internal debug level - !!! above: https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/pio-xlis-bld/xlis_main.F90 - - - character(len=128) :: fldname - integer, parameter :: begc = 1 !-- internal debug level - integer, parameter :: endc = 3312/4/2/2 !-- internal debug level - character(*),parameter :: F02 = "('[lilac_mod]',a,i5,2x,d26.19)" - !------------------------------------------------------------------------ - ! Initialize return code - rc = ESMF_SUCCESS - - if (masterproc) then - print *, "---------------------------------------" - print *, " Lilac Demo Application Start " - print *, "---------------------------------------" - end if - - !----------------------------------------------------------------------------- - ! Initiallize MPI - !----------------------------------------------------------------------------- - - ! this is coming from - ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 - COMP_COMM = MPI_COMM_WORLD - - !https://github.com/yudong-tian/LIS-CLM4.5SP/blob/8cec515a628325c73058cfa466db63210cd562ac/xlis-bld/xlis_main.F90 - !if (ierr .ne. MPI_SUCCESS) then - ! print *,'Error starting MPI program. Terminating.' - ! call MPI_ABORT(MPI_COMM_WORLD, ierr) - !end if - - ! - - call MPI_COMM_RANK(COMP_COMM, mytask, ierr) - call MPI_COMM_SIZE(COMP_COMM, ntasks, ierr) - - if (masterproc) then - print *, "MPI initialization done ..., ntasks=", ntasks - end if - - !----------------------------------------------------------------------------- - ! Initialize PIO - !----------------------------------------------------------------------------- - - ! this is coming from - ! /glade/work/mvertens/ctsm.nuopc/cime/src/drivers/nuopc/drivers/cime/esmApp.F90 - ! with call shr_pio_init1(8, "drv_in", COMP_COMM) - - ! For planned future use of async io using pio2. The IO tasks are seperated from the compute tasks here - ! and COMP_COMM will be MPI_COMM_NULL on the IO tasks which then call shr_pio_init2 and do not return until - ! the model completes. All other tasks call ESMF_Initialize. 8 is the maximum number of component models - ! supported - - call shr_pio_init1(ncomps, "drv_in", COMP_COMM) - ! NS Question: How many should ncomps (above 1) be?????? - - if (COMP_COMM .eq. MPI_COMM_NULL) then - !call shr_pio_init2( - call mpi_finalize(ierror=rc) - stop - endif - - !------------------------------------------------------------------------- - ! Initialize ESMF, set the default calendar and log type. - !------------------------------------------------------------------------- - call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN,logappendflag=.false., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogSet(flush=.true.) - call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"Initializing ESMF ", ESMF_LOGMSG_INFO) - - !------------------------------------------------------------------------- - ! Read in configuration data -- namelist.input from host atmosphere(wrf) - !------------------------------------------------------------------------- - ! Read in namelist file ... - call ESMF_UtilIOUnitGet(unit=fileunit, rc=rc) ! get an available Fortran unit number - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - if (masterproc) then - print *, "---------------------------------------" - end if - - open(fileunit, status="old", file="namelist_lilac", action="read", iostat=rc) - - if (rc .ne. 0) then - call ESMF_LogSetError(rcToCheck=ESMF_RC_FILE_OPEN, msg="Failed to open namelist file 'namelist'", line=__LINE__, file=__FILE__) - call ESMF_Finalize(endflag=ESMF_END_ABORT) - endif - read(fileunit, input) - continue - close(fileunit) - - !------------------------------------------------------------------------- - ! Create Field lists -- Basically create a list of fields and add a default - ! value to them. - !------------------------------------------------------------------------- - - !------------------------------------------------------------------------- - ! !---- from atm ----! a2c_fldlist & c2l_fldlist - !------------------------------------------------------------------------- - !allocate (a2c_fldlist(a2l_fldnum)) - !allocate (c2l_fldlist(a2l_fldnum)) - - !------------------------------------------------------------------------- - ! !---- from land ----! l2c_fldlist & c2a_fldlist - !------------------------------------------------------------------------- - !allocate (c2a_fldlist(l2a_fldnum)) - !allocate (l2c_fldlist(l2a_fldnum)) - - allocate (a2c_fldlist(fldsMax)) - allocate (c2a_fldlist(fldsMax)) - - allocate (l2c_fldlist(fldsmax)) - allocate (c2l_fldlist(fldsmax)) - - if (masterproc) then - print *, "creating empty field lists !" - end if - - call ESMF_LogWrite(subname//"fielldlists are allocated!", ESMF_LOGMSG_INFO) - - ! create field lists - call create_fldlists(a2c_fldlist, c2a_fldlist,l2c_fldlist, c2l_fldlist) - call ESMF_LogWrite(subname//"fielldlists are created!", ESMF_LOGMSG_INFO) - - !------------------------------------------------------------------------- - ! !---- from atm ----! a2c_fldlist filling the arrayptr.. - !------------------------------------------------------------------------- - - - ! FIXME: This should go to the demo_driver or real atmosphere...... - !allocate( a2c_fldlist(fldsmax)%farrayptr1d(1728)) - !do n = 1,a2l_fldnum - ! print *, " index is ", n - ! a2c_fldlist(1)%farrayptr1d(:) = 300.0 - !end do - - a2c_fldlist(1)%farrayptr1d => atm2lnd1d%Sa_z - a2c_fldlist(2)%farrayptr1d => atm2lnd1d%Sa_topo - - !if (masterproc .and. debug > 0) then - fldname = 'Sa_topo' - do i=begc, endc - write (iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',i, a2c_fldlist(2)%farrayptr1d(i) - end do - !end if - a2c_fldlist(3)%farrayptr1d => atm2lnd1d%Sa_u - a2c_fldlist(4)%farrayptr1d => atm2lnd1d%Sa_v - a2c_fldlist(5)%farrayptr1d => atm2lnd1d%Sa_ptem - a2c_fldlist(6)%farrayptr1d => atm2lnd1d%Sa_pbot - a2c_fldlist(7)%farrayptr1d => atm2lnd1d%Sa_tbot - a2c_fldlist(8)%farrayptr1d => atm2lnd1d%Sa_shum - - a2c_fldlist(9)%farrayptr1d => atm2lnd1d%Faxa_lwdn - a2c_fldlist(10)%farrayptr1d => atm2lnd1d%Faxa_rainc - a2c_fldlist(11)%farrayptr1d => atm2lnd1d%Faxa_rainl - a2c_fldlist(12)%farrayptr1d => atm2lnd1d%Faxa_snowc - a2c_fldlist(13)%farrayptr1d => atm2lnd1d%Faxa_snowl - - a2c_fldlist(14)%farrayptr1d => atm2lnd1d%Faxa_swndr - a2c_fldlist(15)%farrayptr1d => atm2lnd1d%Faxa_swvdr - a2c_fldlist(16)%farrayptr1d => atm2lnd1d%Faxa_swndf - a2c_fldlist(17)%farrayptr1d => atm2lnd1d%Faxa_swvdf - !------------------------------------------------------------------------- - - ! should I point to zero??? - - c2a_fldlist(1)%farrayptr1d => lnd2atm1d%Sl_lfrin - c2a_fldlist(2)%farrayptr1d => lnd2atm1d%Sl_t - c2a_fldlist(3)%farrayptr1d => lnd2atm1d%Sl_tref - c2a_fldlist(4)%farrayptr1d => lnd2atm1d%Sl_qref - c2a_fldlist(5)%farrayptr1d => lnd2atm1d%Sl_avsdr - c2a_fldlist(6)%farrayptr1d => lnd2atm1d%Sl_anidr - c2a_fldlist(7)%farrayptr1d => lnd2atm1d%Sl_avsdf - c2a_fldlist(8)%farrayptr1d => lnd2atm1d%Sl_anidf - - c2a_fldlist(9)%farrayptr1d => lnd2atm1d%Sl_snowh - c2a_fldlist(10)%farrayptr1d => lnd2atm1d%Sl_u10 - c2a_fldlist(11)%farrayptr1d => lnd2atm1d%Sl_fv - c2a_fldlist(12)%farrayptr1d => lnd2atm1d%Sl_ram1 - - - - dummy_gindex_atm = gindex_atm - ! ======================================================================== - - !------------------------------------------------------------------------- - ! Create Gridded Component! -- atmosphere ( atmos_cap) - !------------------------------------------------------------------------- - gcname1 = " Atmosphere or Atmosphere Cap" - atmos_gcomp = ESMF_GridCompCreate(name=gcname1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Created "//trim(gcname1)//" component", ESMF_LOGMSG_INFO) - print *, "Atmosphere Gridded Component Created!" - - !------------------------------------------------------------------------- - ! Create Gridded Component! --- CTSM land ( land_capX ) - !------------------------------------------------------------------------- - gcname2 = " Land ctsm " - land_gcomp = ESMF_GridCompCreate(name=gcname2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Created "//trim(gcname2)//" component", ESMF_LOGMSG_INFO) - print *, " Land (ctsm) Gridded Component Created!" - - !------------------------------------------------------------------------- - ! Create Coupling Component! --- Coupler from atmos to land - !------------------------------------------------------------------------- - ccname1 = "Coupler from atmosphere to land" - cpl_atm2lnd_comp = ESMF_CplCompCreate(name=ccname1, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Created "//trim(ccname1)//" component", ESMF_LOGMSG_INFO) - print *, "1st Coupler Component (atmosphere to land ) Created!" - - !------------------------------------------------------------------------- - ! Create Coupling Component! -- Coupler from land to atmos - !------------------------------------------------------------------------- - ccname2 = "Coupler from land to atmosphere" - cpl_lnd2atm_comp = ESMF_CplCompCreate(name=ccname2, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Created "//trim(ccname2)//" component", ESMF_LOGMSG_INFO) - print *, "2nd Coupler Component (land to atmosphere) Created!" - - ! ======================================================================== - - !------------------------------------------------------------------------- - ! Register section -- set services -- atmos_cap - !------------------------------------------------------------------------- - call ESMF_GridCompSetServices(atmos_gcomp, userRoutine=atmos_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//" atmos SetServices finished!", ESMF_LOGMSG_INFO) - print *, " Atmosphere Gridded Component SetServices finished!" - !------------------------------------------------------------------------- - ! Register section -- set services -- land cap - !------------------------------------------------------------------------- - call ESMF_GridCompSetServices(land_gcomp, userRoutine=lnd_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"land SetServices finished!", ESMF_LOGMSG_INFO) - print *, "Land Gridded Component SetServices finished!" - !------------------------------------------------------------------------- - ! Register section -- set services -- coupler atmosphere to land - !------------------------------------------------------------------------- - call ESMF_CplCompSetServices(cpl_atm2lnd_comp, userRoutine=cpl_atm2lnd_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Coupler from atmosphere to land SetServices finished!", ESMF_LOGMSG_INFO) - print *, "Coupler from atmosphere to land SetServices finished!" - !------------------------------------------------------------------------- - ! Register section -- set services -- coupler land to atmosphere - !------------------------------------------------------------------------- - call ESMF_CplCompSetServices(cpl_lnd2atm_comp, userRoutine=cpl_lnd2atm_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"Coupler from land to atmosphere SetServices finished!", ESMF_LOGMSG_INFO) - print *, "Coupler from land to atmosphere SetServices finished!" - - ! ======================================================================== - - !------------------------------------------------------------------------- - ! Create and initialize a clock! - ! Clock is initialized here from namelist.input from WRF..... still we - ! are looping over time from host atmosphere - !------------------------------------------------------------------------- - calendar = ESMF_CalendarCreate(name='lilac_drv_NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) - call ESMF_TimeIntervalSet(TimeStep, s=2, rc=rc) ! time step every 2second - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - !call ESMF_TimeSet(startTime, yy=2003, mm=s_month, dd=s_day, h=s_hour, m=s_min, s=0, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !call ESMF_TimeSet(stopTime, yy=2003, mm=e_month, dd=e_day, h=e_hour, m=e_min, s=0, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !clock = ESMF_ClockCreate(timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1 , s=0, calendar=Calendar, rc=rc) - call ESMF_TimeSet(StopTime , yy=2000, mm=03, dd=01, s=0, calendar=Calendar, rc=rc) - !call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) - call ESMF_TimeIntervalSet(TimeStep, s=1800, rc=rc) - clock = ESMF_ClockCreate(name='lilac_drv_EClock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, stopTime=stopTime, rc=rc) - - print *, "---------------------------------------" - !call ESMF_ClockPrint (clock, rc=rc) - print *, "=======================================" - !call ESMF_CalendarPrint ( calendar , rc=rc) - print *, "---------------------------------------" - - ! ======================================================================== - - !------------------------------------------------------------------------- - ! Create the necessary import and export states used to pass data - ! between components. - !------------------------------------------------------------------------- - - ! following 4 states are lilac module variables: - ! 1- atm2lnd_a_state 2- atm2lnd_l_state 3- lnd2atm_a_state 4-lnd2atm_l_state - - atm2lnd_a_state = ESMF_StateCreate(name=gcname1, stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - atm2lnd_l_state = ESMF_StateCreate(name=gcname1, stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - lnd2atm_a_state = ESMF_StateCreate(name=gcname2, stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - lnd2atm_l_state = ESMF_StateCreate(name=gcname2, stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_LogWrite(subname//"Empty import and export states are created!!", ESMF_LOGMSG_INFO) - print *, "Empty import and export states are created!!" - - ! returns a valid state_to_lnd_atm and an empty state_from_land_atmgrid - - ! ------------------------------------------------------------------------- - ! Grid Componenet Initialization -- 1- atmos cap 2- lnd cap ! - ! 3- cpl_atm2lnd 4- cpl_lnd2atm ! - ! ------------------------------------------------------------------------- - - call ESMF_GridCompInitialize(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp initialized", ESMF_LOGMSG_INFO) - - call ESMF_GridCompInitialize(land_gcomp , importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"lnd_cap or land_gcomp initialized", ESMF_LOGMSG_INFO) - - ! All 4 states that are module variables are no longer empty - have been initialized - - call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) - print *, "coupler :: cpl_atm2lnd_comp initialize finished" !, rc =", rc - - call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) - print *, "coupler :: cpl_lnd2atm_comp initialize finished" !, rc =", rc - - end subroutine lilac_init - - !======================================================================== - - subroutine lilac_run( ) - - use atmos_cap, only : a2c_fldlist, c2a_fldlist - use lnd_cap, only : l2c_fldlist, c2l_fldlist - - character(len=*), parameter :: subname=trim(modname)//': [lilac_run] ' - type(ESMF_State) :: importState, exportState - - ! local variables - integer :: rc, userRC - character(len=ESMF_MAXSTR) :: gcname1, gcname2 ! Gridded components names - character(len=ESMF_MAXSTR) :: ccname1, ccname2 ! Coupling components names - !integer, parameter :: fldsMax = 100 - - ! input/output variables - !type(atm2lnd_data1d_type), intent(in), optional :: atm2lnd1d - !type(atm2lnd_data2d_type), intent(in), optional :: atm2lnd2d - !type(lnd2atm_data1d_type), intent(in), optional :: lnd2atm1d - !type(lnd2atm_data2d_type), intent(in), optional :: lnd2atm2d - - type (ESMF_Clock) :: local_clock - - !------------------------------------------------------------------------ - ! Initialize return code - rc = ESMF_SUCCESS - - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - print *, " Lilac Run " - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - - !------------------------------------------------------------------------- - ! Create a local clock from the general clock! - !------------------------------------------------------------------------- - - local_clock = ESMF_ClockCreate(clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - print *, "Run Loop Start time" - !call ESMF_ClockPrint(local_clock, options="currtime string", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - !------------------------------------------------------------------------- - ! We are running components in this order: - ! 1- atmos_cap 2- cpl_atm2lnd - ! 3- lnd_cap 4- cpl_lnd2atm - !------------------------------------------------------------------------- - ! lilac run the RunComponent phase in a time loop - - !!! if we want to loop through clock in atmos cap. - !do while (.NOT. ESMF_ClockIsStopTime(local_clock, rc=rc)) - call ESMF_GridCompRun(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=local_clock, rc=rc, userRC=userRC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp is running", ESMF_LOGMSG_INFO) - print *, "Running atmos_cap gridded component , rc =", rc - - call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=local_clock, rc=rc , userRC=userRC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) - print *, "Running coupler component..... cpl_atm2lnd_comp , rc =", rc - - call ESMF_GridCompRun(land_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=local_clock, rc=rc, userRC=userRC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"lnd_cap or land_gcomp is running", ESMF_LOGMSG_INFO) - print *, "Running lnd_cap gridded component , rc =", rc - - call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=local_clock, rc=rc, userRC=userRC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) - print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc - - ! Advance the time - call ESMF_ClockAdvance(local_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"time is icremented now... (ClockAdvance)", ESMF_LOGMSG_INFO) - print *, "time is icremented now... (ClockAdvance) , rc =", rc - - !end do - - end subroutine lilac_run - - - subroutine lilac_final( ) - - use atmos_cap, only : a2c_fldlist, c2a_fldlist - use lnd_cap, only : l2c_fldlist, c2l_fldlist - - - character(len=*), parameter :: subname=trim(modname)//': [lilac_final] ' - type(ESMF_State) :: importState, exportState - - ! local variables - integer :: rc, userRC - character(len=ESMF_MAXSTR) :: gcname1, gcname2 ! Gridded components names - character(len=ESMF_MAXSTR) :: ccname1, ccname2 ! Coupling components names - !integer, parameter :: fldsMax = 100 - - !------------------------------------------------------------------------ - !------------------------------------------------------------------------ - ! Initialize return code - rc = ESMF_SUCCESS - - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - print *, " Lilac Finalizing " - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - !------------------------------------------------------------------------- - ! Gridded Component Finalizing! --- atmosphere - !------------------------------------------------------------------------- - call ESMF_GridCompFinalize(atmos_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"atmos_cap or atmos_gcomp is running", ESMF_LOGMSG_INFO) - print *, "Finalizing atmos_cap gridded component , rc =", rc - - !------------------------------------------------------------------------- - ! Coupler component Finalizing --- coupler atmos to land - !------------------------------------------------------------------------- - call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) - print *, "Finalizing coupler component..... cpl_atm2lnd_comp , rc =", rc - - !------------------------------------------------------------------------- - ! Gridded Component Finalizing! --- land - !------------------------------------------------------------------------- - call ESMF_GridCompFinalize(land_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"lnd_cap or land_gcomp is running", ESMF_LOGMSG_INFO) - print *, "Finalizing lnd_cap gridded component , rc =", rc - - !------------------------------------------------------------------------- - ! Coupler component Finalizing --- coupler land to atmos - !------------------------------------------------------------------------- - call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) - print *, "Finalizing coupler component..... cpl_lnd2atm_comp , rc =", rc - - - ! Then clean them up - call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"destroying all states ", ESMF_LOGMSG_INFO) - - print *, "ready to destroy all states" - call ESMF_StateDestroy(atm2lnd_a_state , rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateDestroy(atm2lnd_l_state, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateDestroy(lnd2atm_a_state, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateDestroy(lnd2atm_l_state, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_LogWrite(subname//"destroying all components ", ESMF_LOGMSG_INFO) - print *, "ready to destroy all components" - - call ESMF_GridCompDestroy(atmos_gcomp, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_GridCompDestroy(land_gcomp, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompDestroy(cpl_atm2lnd_comp, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompDestroy(cpl_lnd2atm_comp, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - - call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) - print *, "end of Lilac Finalization routine" - - end subroutine lilac_final - - - end module lilac_mod + ! Initialize return code + rc = ESMF_SUCCESS + + if (mytask == 0) then + print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + print *, " Lilac Run " + print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + end if + + !------------------------------------------------------------------------- + ! Create a local clock from the general clock! + !------------------------------------------------------------------------- + + local_clock = ESMF_ClockCreate(clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + if (mytask == 0) then + print *, "Run Loop Start time" + end if + !call ESMF_ClockPrint(local_clock, options="currtime string", rc=rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + !------------------------------------------------------------------------- + ! We are running components in this order: + ! 1- atmos_cap 2- cpl_atm2lnd! 3- lnd_cap 4- cpl_lnd2atm + !------------------------------------------------------------------------- + + ! if we want to loop through clock in atmos cap. + !do while (.NOT. ESMF_ClockIsStopTime(local_clock, rc=rc)) + call ESMF_GridCompRun(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, & + clock=local_clock, rc=rc, userRC=userRC) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Running atmos_cap gridded component , rc =", rc + end if + + call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, & + clock=local_clock, rc=rc , userRC=userRC) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Running coupler component..... cpl_atm2lnd_comp , rc =", rc + end if + + call ESMF_GridCompRun(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, & + clock=local_clock, rc=rc, userRC=userRC) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Running lnd_cap gridded component , rc =", rc + end if + + call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, & + clock=local_clock, rc=rc, userRC=userRC) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc + end if + + ! Advance the time + call ESMF_ClockAdvance(local_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"time is icremented now... (ClockAdvance)", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "time is icremented now... (ClockAdvance) , rc =", rc + end if + + end subroutine lilac_run + +!======================================================================== + + subroutine lilac_final( ) + + ! local variables + type(ESMF_State) :: importState, exportState + integer :: rc, userRC + character(len=*), parameter :: subname=trim(modname)//': [lilac_final] ' + !------------------------------------------------------------------------ + ! Initialize return code + rc = ESMF_SUCCESS + + if (mytask == 0) then + print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + print *, " Lilac Finalizing " + print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + end if + + !------------------------------------------------------------------------- + ! Gridded Component Finalizing! --- atmosphere + !------------------------------------------------------------------------- + call ESMF_GridCompFinalize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Finalizing atmos_cap gridded component , rc =", rc + end if + + !------------------------------------------------------------------------- + ! Coupler component Finalizing --- coupler atmos to land + !------------------------------------------------------------------------- + call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Finalizing coupler component..... cpl_atm2lnd_comp , rc =", rc + end if + + !------------------------------------------------------------------------- + ! Gridded Component Finalizing! --- land + !------------------------------------------------------------------------- + call ESMF_GridCompFinalize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Finalizing lnd_cap gridded component , rc =", rc + end if + + !------------------------------------------------------------------------- + ! Coupler component Finalizing --- coupler land to atmos + !------------------------------------------------------------------------- + call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "Finalizing coupler component..... cpl_lnd2atm_comp , rc =", rc + end if + + ! Then clean them up + call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"destroying all states ", ESMF_LOGMSG_INFO) + + if (mytask == 0) then + print *, "ready to destroy all states" + end if + call ESMF_StateDestroy(atm2lnd_a_state , rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateDestroy(atm2lnd_l_state, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateDestroy(lnd2atm_a_state, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateDestroy(lnd2atm_l_state, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_LogWrite(subname//"destroying all components ", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "ready to destroy all components" + end if + + call ESMF_GridCompDestroy(atm_gcomp, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_GridCompDestroy(lnd_gcomp, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompDestroy(cpl_atm2lnd_comp, rc=rc) + + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompDestroy(cpl_lnd2atm_comp, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, "end of Lilac Finalization routine" + end if + + ! Finalize ESMF + call ESMF_Finalize ( ) + + end subroutine lilac_final + +end module lilac_mod diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index ef1074a909..7bce4b8f99 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -1,443 +1,324 @@ module lilac_utils - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! - !!! NS: THIS IS FROM JH WORK - - use ESMF - - implicit none - - public fldlist_add , create_fldlists - - integer, parameter :: fldsMax = 100 - - character(*) , parameter :: modname = "lilac_utils" - ! !PUBLIC TYPES: - type :: fld_list_type - character(len=128) :: stdname - real*8 :: default_value - character(len=128) :: units - real(ESMF_KIND_R8), pointer :: farrayptr1d(:) ! this will be filled in by lilac when it gets its data from the host atm - real(ESMF_KIND_R8), pointer :: farrayptr2d(:,:) ! this will be filled in by lilac when it gets its data from the host atm - integer :: ungridded_lbound = 0 - integer :: ungridded_ubound = 0 - end type fld_list_type - - !!! 1d for when we have mesh and 2d for when we have grids.... - type , public :: atm2lnd_data1d_type - real*8, pointer :: Sa_z (:) - real*8, pointer :: Sa_topo (:) - real*8, pointer :: Sa_u (:) - real*8, pointer :: Sa_v (:) - real*8, pointer :: Sa_ptem (:) - real*8, pointer :: Sa_pbot (:) - real*8, pointer :: Sa_tbot (:) - real*8, pointer :: Sa_shum (:) - real*8, pointer :: Sa_methane (:) - ! from atm - fluxes - real*8, pointer :: Faxa_lwdn (:) - real*8, pointer :: Faxa_rainc (:) - real*8, pointer :: Faxa_rainl (:) - real*8, pointer :: Faxa_snowc (:) - real*8, pointer :: Faxa_snowl (:) - real*8, pointer :: Faxa_swndr (:) - real*8, pointer :: Faxa_swvdr (:) - real*8, pointer :: Faxa_swndf (:) - real*8, pointer :: Faxa_swvdf (:) - - real*8, pointer :: Faxa_bcph (:) - end type atm2lnd_data1d_type - -! - - type , public :: atm2lnd_data2d_type - real*8, pointer :: Sa_z (:,:) - real*8, pointer :: Sa_topo (:,:) - real*8, pointer :: Sa_u (:,:) - real*8, pointer :: Sa_v (:,:) - real*8, pointer :: Sa_ptem (:,:) - real*8, pointer :: Sa_pbot (:,:) - real*8, pointer :: Sa_tbot (:,:) - real*8, pointer :: Sa_shum (:,:) - !real*8, pointer :: Sa_methane (:,:) - ! from atm - fluxes - real*8, pointer :: Faxa_lwdn (:,:) - real*8, pointer :: Faxa_rainc (:,:) - real*8, pointer :: Faxa_rainl (:,:) - real*8, pointer :: Faxa_snowc (:,:) - real*8, pointer :: Faxa_snowl (:,:) - real*8, pointer :: Faxa_swndr (:,:) - real*8, pointer :: Faxa_swvdr (:,:) - real*8, pointer :: Faxa_swndf (:,:) - real*8, pointer :: Faxa_swvdf (:,:) - end type atm2lnd_data2d_type - - - - - !type :: atm2lnd_data1d_type - ! real*8, pointer :: uwind (:) - ! real*8, pointer :: vwind (:) - ! real*8, pointer :: tbot (:) - !end type atm2lnd_data1d_type - - type :: lnd2atm_data1d_type - real*8, pointer :: Sl_lfrin (:) - real*8, pointer :: Sl_t (:) - real*8, pointer :: Sl_tref (:) - real*8, pointer :: Sl_qref (:) - real*8, pointer :: Sl_avsdr (:) - real*8, pointer :: Sl_anidr (:) - real*8, pointer :: Sl_avsdf (:) - real*8, pointer :: Sl_anidf (:) - real*8, pointer :: Sl_snowh (:) - real*8, pointer :: Sl_u10 (:) - real*8, pointer :: Sl_fv (:) - real*8, pointer :: Sl_ram1 (:) - end type lnd2atm_data1d_type - - !type :: atm2lnd_data2d_type - ! real*8, pointer :: uwind (:,:) - ! real*8, pointer :: vwind (:,:) - ! real*8, pointer :: tbot (:,:) - !end type atm2lnd_data2d_type - - type :: lnd2atm_data2d_type - real*8, pointer :: lwup (:,:) - real*8, pointer :: taux (:,:) - real*8, pointer :: tauy (:,:) - end type lnd2atm_data2d_type - - type :: this_clock - integer, pointer :: yy - integer, pointer :: mm - integer, pointer :: dd - integer, pointer :: hh - integer, pointer :: mn - integer, pointer :: ss - end type this_clock - !=============================================================================== - contains - !=============================================================================== - - subroutine fldlist_add(num, fldlist, stdname, default_value, units, ungridded_lbound, ungridded_ubound) - ! This adds a field to a fieldlist! - ! input/output variables - integer, intent(inout) :: num - type(fld_list_type), intent(inout) :: fldlist(:) - character(len=*), intent(in) :: stdname - real, optional, intent(in) :: default_value - character(len=*), optional, intent(in) :: units - integer, optional, intent(in) :: ungridded_lbound - integer, optional, intent(in) :: ungridded_ubound - - ! local variables - integer :: rc - character(len=*), parameter :: subname=trim(modname)//':[fldlist_add]' - !------------------------------------------------------------------------------- - call ESMF_LogWrite(subname//"inside fldlist_add!", ESMF_LOGMSG_INFO) - - ! Set up a list of field information - num = num + 1 - if (num > fldsMax) then - call ESMF_LogWrite(subname//"?!", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(trim(subname)//": ERROR num > fldsMax "//trim(stdname), & - ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__) - return - endif - - fldlist(num)%stdname = trim(stdname) - - if (present(ungridded_lbound) .and. present(ungridded_ubound)) then - fldlist(num)%ungridded_lbound = ungridded_lbound - fldlist(num)%ungridded_ubound = ungridded_ubound - end if - - if(present(default_value)) then - fldlist(num)%default_value = default_value - else - fldlist(num)%default_value = 0. - end if - if(present(units)) then - fldlist(num)%units = trim(units) - else - fldlist(num)%units = "" - end if - - !allocate (fldlist%farrayptr1d(fldsMax)) - - !fldlist%farrayptr1d = default_value - - end subroutine fldlist_add - - !subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist, rof_prognostic, glc_present ) - subroutine create_fldlists(a2c_fldlist, c2l_fldlist, l2c_fldlist, c2a_fldlist) - - ! add all the necessary fields one by one to the fieldlist - type(fld_list_type), intent(inout) :: a2c_fldlist(fldsMax) - type(fld_list_type), intent(inout) :: c2a_fldlist(fldsMax) - type(fld_list_type), intent(inout) :: l2c_fldlist(fldsMax) - type(fld_list_type), intent(inout) :: c2l_fldlist(fldsMax) - - ! I use this as an index! - integer :: fldsToLnd_num != 0 ! From atmosphere to land (c2l) - integer :: fldsFrLnd_num != 0 ! From land to atmosphere (l2c) - integer :: fldsToAtm_num != 0 ! From land to atmosphere (c2a) - integer :: fldsFrAtm_num != 0 ! From atmosphere to land (a2c) - integer, parameter :: fldsMax = 100 - - - ! TODO (NS) : Should we move these to the land cap???? - logical :: glc_present ! .true. => running with a non-stub GLC model - logical :: rof_prognostic ! .true. => running with a prognostic ROF model - - character(len=*), parameter :: subname=trim(modname)//':[create_fldlists]' - ! TODO (NS) : I should add default value and units here..... - - fldsToLnd_num= 0 - fldsFrLnd_num= 0 - fldsToAtm_num= 0 - fldsFrAtm_num= 0 - - call ESMF_LogWrite(subname//"is called!", ESMF_LOGMSG_INFO) - - !------------------------------------------------------------------------- - ! !---- from atm ----! a2c_fldlist & c2l_fldlist - !------------------------------------------------------------------------- - !--------------------------a2c_fldlist------------------------------------ - ! from atm - states - !call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_z' ) - !call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_topo' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_z' , default_value=30.0 , units='m/s') - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_topo' , default_value=10.0 , units='m') - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_u' , default_value=0.0 , units='m/s') - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_v' , default_value=0.0 , units='m/s') - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_ptem' , default_value=280.0 , units='degK') - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_pbot' , default_value=100100.0 , units='pa' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_tbot' , default_value=280.0 , units='degk' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_shum' , default_value=0.0004 , units='kg/kg' ) - !call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Sa_methane' ) - - call ESMF_LogWrite(subname//"from atmosphere states are added!" , ESMF_LOGMSG_INFO) - - - - - - ! from atm - fluxes - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_lwdn' , default_value=200.0 , units='W/m2' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_rainc' , default_value=4.0e-8 , units='kg/m2s' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_rainl' , default_value=3.0e-8 , units='kg/m2s' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_snowc' , default_value=1.0e-8 , units='kg/m2s' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_snowl' , default_value=2.0e-8 , units='kg/m2s' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_swndr' , default_value=100.0 , units='W/m2' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_swvdr' , default_value=90.0 , units='W/m2' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_swndf' , default_value=20.0 , units='W/m2' ) - call fldlist_add(fldsToLnd_num , a2c_fldlist , 'Faxa_swvdf' , default_value=40.0 , units='W/m2' ) - - call ESMF_LogWrite(subname//"from atmosphere fluxes are added!", ESMF_LOGMSG_INFO) - - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphidry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphodry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphiwet') - - !--------------------------c2l_fldlist------------------------------------ - ! from atm - states - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_z' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_topo' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_u' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_v' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_ptem' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_pbot' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_tbot' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_shum' ) - !call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Sa_methane' ) - call ESMF_LogWrite(subname//"from atmosphere states are added!", ESMF_LOGMSG_INFO) - - ! from atm - fluxes - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_lwdn' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_rainc' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_rainl' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_snowc' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_snowl' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swndr' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swvdr' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swndf' ) - call fldlist_add(fldsToLnd_num, c2l_fldlist, 'Faxa_swvdf' ) - call ESMF_LogWrite(subname//"from atmosphere fluxes are added!", ESMF_LOGMSG_INFO) - - !------------------------------------------------------------------------- - ! !---- from lnd ----! l2c_fldlist & c2a_fldlist - !------------------------------------------------------------------------- - !--------------------------l2c_fldlist------------------------------------ - ! export land states - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_lfrin' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_t' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_tref' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_qref' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_avsdr' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_anidr' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_avsdf' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_anidf' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_snowh' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_u10' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_fv' ) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Sl_ram1' ) - call ESMF_LogWrite(subname//"l2c: from land states are added!", ESMF_LOGMSG_INFO) - - rof_prognostic = .false. - ! export fluxes to river - if (rof_prognostic) then - call ESMF_LogWrite(subname//"Okay we are in rof_prognostic", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofsur' ) - call ESMF_LogWrite(subname//"Okay we are in rof_prognostic 13", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofgwl' ) - call ESMF_LogWrite(subname//"Okay we are in rof_prognostic 14", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofsub' ) - call ESMF_LogWrite(subname//"Okay we are in rof_prognostic 15", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_rofi' ) - call ESMF_LogWrite(subname//"Okay we are in rof_prognostic 16", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Flrl_irrig' ) - call ESMF_LogWrite(subname//"l2c: from land states are added for rof_prognostic!", ESMF_LOGMSG_INFO) - end if - - ! export fluxes to atm - call ESMF_LogWrite(subname//"l2c: now adding fluxes to atmosphere!", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_taux' ) - call ESMF_LogWrite(subname//"l2c: Fall_taux!", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_tauy' ) - call ESMF_LogWrite(subname//"l2c: Fall_taux!", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_lat' ) - call ESMF_LogWrite(subname//"l2c: Fall_lat!", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_sen' ) - call ESMF_LogWrite(subname//"l2c: Fall_sen!", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_lwup' ) - call ESMF_LogWrite(subname//"l2c: Fall_lwup!", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_evap' ) - call ESMF_LogWrite(subname//"l2c: Fall_evap!", ESMF_LOGMSG_INFO) - call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_swnet' ) - call ESMF_LogWrite(subname//"l2c: Fall_lat!", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"l2c: from land fluxes are added!", ESMF_LOGMSG_INFO) - - ! call fldlist_add(fldsFrLnd_num, l2c_fldlist, 'Fall_methane' ) - - - !--------------------------c2a_fldlist------------------------------------ - ! export land states - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_lfrin' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_t' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_tref' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_qref' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_avsdr' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_anidr' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_avsdf' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_anidf' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_snowh' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_u10' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_fv' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Sl_ram1' ) - - - ! export fluxes to river - if (rof_prognostic) then - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_rofsur' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_rofgwl' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_rofsub' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_rofi' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Flrl_irrig' ) - end if - - ! export fluxes to atm - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_taux' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_tauy' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_lat' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_sen' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_lwup' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_evap' ) - call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_swnet' ) - - ! call fldlist_add(fldsFrLnd_num, c2a_fldlist, 'Fall_methane' ) - - - - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'atmos2lnd_var', default_value=0.0, units='m') - ! from lnd - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'lnd2atmos_var', default_value=0.0, units='m') - - - ! sets the module variable memory in atmos_cap.F9 print *, a2c_fldlist(1)%stdname - !!! First from atmosphere to land fields - ! import fields - ! call fldlist_add(fldsFrCpl_num, fldsFrCpl, trim(flds_scalar_name)) - - !call fldlist_add(fldsToLnd_num, fldsToLnd, trim(flds_scalar_name)) - - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_topo') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_u', default_value=0.0, units='m/s') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_v', default_value=0.0, units='m/s') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_ptem', default_value=280.0, units= 'degK') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_pbot', default_value=100100.0, units='Pa') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_tbot', default_value=280.0, units='degK') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_shum', default_value=0.0004, units='kg/kg') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Sa_methane' ) - - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_lwdn', default_value=200.0, units='W/m2') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_rainc', default_value=4.0e-8, units='kg/m2s') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_rainl', default_value=3.0e-8, units='kg/m2s') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_snowc', default_value=1.0e-8, units='kg/m2s') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_snowl', default_value=2.0e-8, units='kg/m2s') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_swndr', default_value=100.0, units='W/m2') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_swvdr', default_value=90.0, units='W/m2') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_swndf', default_value=20.0, units='W/m2') - !call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_swvdf', default_value=40.0, units='W/m2') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphidry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphodry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_bcphiwet') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_ocphidry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_ocphodry') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_ocphiwet') - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstdry1' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstdry2' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstdry3' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstdry4' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstwet1' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstwet2' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstwet3' ) - ! call fldlist_add(fldsToCpl_num, fldsToCpl, 'Faxa_dstwet4' ) - - ! land states - - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_lfrin' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_t' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_tref' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_qref' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_avsdr' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_anidr' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_avsdf' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_anidf' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_snowh' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_u10' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_fv' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Sl_ram1' ) - - ! fluxes to atm - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_taux' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_tauy' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_lat' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_sen' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_lwup' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_evap' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_swnet' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_flxdst1' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_flxdst2' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_flxdst3' ) - !call fldlist_add(fldsFrCpl_num, fldsFrCpl, 'Fall_flxdst4' ) - - - - ! more: https://github.com/mvertens/ctsm/blob/ae02ffe25dbc4a85c769c9137b5b3d50f2843e89/src/cpl/nuopc/lnd_import_export.F90#L131 - end subroutine create_fldlists + implicit none + private + + public :: this_clock + public :: lilac_init_atm2lnd + public :: lilac_init_lnd2atm + public :: lilac_atm2lnd + public :: lilac_lnd2atm + + ! Global index space info for atm data + ! the HOST ATMOSPHERE is also responsible for filling in the gindex information + ! this is used to create the distgrid for the mesh in lilac *** + integer, public, allocatable :: gindex_atm (:) + + type :: atm2lnd_type + character(len=128) :: fldname + real*8, pointer :: dataptr(:) + character(len=64) :: units + logical :: provided_by_atm + logical :: required_fr_atm + end type atm2lnd_type + type(atm2lnd_type), pointer, public :: atm2lnd(:) + + type :: lnd2atm_type + character(len=128) :: fldname + real*8, pointer :: dataptr(:) + character(len=64) :: units + end type lnd2atm_type + type(atm2lnd_type), pointer, public :: lnd2atm(:) + + type :: this_clock + integer, pointer :: yy + integer, pointer :: mm + integer, pointer :: dd + integer, pointer :: hh + integer, pointer :: mn + integer, pointer :: ss + end type this_clock + +!======================================================================== +contains +!======================================================================== + + ! *** NOTE - THE HOST ATMOSPHERE IS RESPONSIBLE for calling + ! lilac_init that then calls the initialization routines for atm2lnd and lnd2atm + + ! host atm init call will simply be + ! call lilac_init() + + ! host atm run phase will be + ! call lilac_atm2lnd(fldname, data1d) + + subroutine lilac_init_atm2lnd(lsize) + integer, intent(in) :: lsize + integer :: n + + ! TODO: how is the atm going to specify which fields are not provided = + ! should it pass an array of character strings or a colon deliminited set of fields + ! to specify the fields it will not provide - and then these are checked against those fields + + call atm2lnd_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_v' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_ptem' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_pbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_tbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_shum' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_lwdn' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainc' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainl' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowc' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowl' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndr' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdr' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + + ! TODO: optional fields - if these are uncommented then need to make sure that they are also appear in the lnd + ! import state + ! CRITICAL the fields in the export state from lilac_atmcap MUST match the fields in the import state to the land + ! this is not being checked currently and msut be + !call atm2lnd_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) + !call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) + + ! now add dataptr memory for all of the fields and set default values of provided_by_atm to false + do n = 1,size(atm2lnd) + allocate(atm2lnd(n)%dataptr(lsize)) + atm2lnd(n)%provided_by_atm = .false. + end do + end subroutine lilac_init_atm2lnd + +!======================================================================== + + subroutine lilac_init_lnd2atm(lsize) + integer, intent(in) :: lsize + integer :: n + + call lnd2atm_add_fld (lnd2atm, fldname='Sl_lfrin' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_t' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_tref' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_qref' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdr' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_anidr' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdf' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_anidf' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_snowh' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_u10' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_fv' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_ram1' , units='unknown', lsize=lsize) + + ! TODO: for now are commenting these since they are in the lnd send - however this + ! is not correct and the lnd send should reintroduce these as soon as possible and + ! the following should be uncommented + !call lnd2atm_add_fld (lnd2atm, fldname='Fall_lwup' , units='unknown', lsize=lsize) + !call lnd2atm_add_fld (lnd2atm, fldname='Fall_taux' , units='unknown', lsize=lsize) + !call lnd2atm_add_fld (lnd2atm, fldname='Fall_tauy' , units='unknown', lsize=lsize) + + ! now add dataptr memory for all of the fields + do n = 1,size(lnd2atm) + allocate(lnd2atm(n)%dataptr(lsize)) + end do + end subroutine lilac_init_lnd2atm + +!======================================================================== + + subroutine lilac_atm2lnd(fldname, data) + + ! input/output variables + character(len=*), intent(in) :: fldname + real*8, intent(in) :: data(:) + + ! local variables + integer :: n + logical :: found + ! -------------------------------------------- + + found = .false. + do n = 1,size(atm2lnd) + if (trim(fldname) == atm2lnd(n)%fldname) then + found = .true. + if (size(data) /= size(atm2lnd(n)%dataptr)) then + ! call abort - TODO: what is the abort call in lilac + else + atm2lnd(n)%dataptr(:) = data(:) + end if + atm2lnd(n)%provided_by_atm = .true. + exit + end if + end do + if (.not. found) then + ! abort + end if + + end subroutine lilac_atm2lnd + + subroutine lilac_atm2lnd_check() + + ! local variables + integer :: n + ! -------------------------------------------- + + ! if there are fields that the atmosphere does not provide but that are required - then abort + do n = 1,size(atm2lnd) + if (atm2lnd(n)%required_fr_atm .and. (.not. atm2lnd(n)%provided_by_atm)) then + ! call abort or provide default values? + else if (.not. atm2lnd(n)%provided_by_atm) then + ! create default values + end if + end do + end subroutine lilac_atm2lnd_check + +!======================================================================== + + subroutine lilac_lnd2atm(fldname, data) + ! input/output variables + character(len=*), intent(in) :: fldname + real*8, intent(out) :: data(:) + + ! local variables + integer :: n + ! -------------------------------------------- + + do n = 1,size(lnd2atm) + if (trim(fldname) == lnd2atm(n)%fldname) then + if (size(data) /= size(lnd2atm(n)%dataptr)) then + ! call abort - TODO: what is the abort call in lilac + else + data(:) = lnd2atm(n)%dataptr(:) + end if + end if + end do + end subroutine lilac_lnd2atm + +!======================================================================== + + subroutine atm2lnd_add_fld(flds, fldname, units, required_fr_atm, lsize) + + ! ---------------------------------------------- + ! Add an entry to to the flds array + ! Use pointers to create an extensible allocatable array. + ! to allow the size of flds to grow, the process for + ! adding a new field is: + ! 1) allocate newflds to be N (one element larger than flds) + ! 2) copy flds into first N-1 elements of newflds + ! 3) newest flds entry is Nth element of newflds + ! 4) deallocate / nullify flds + ! 5) point flds => newflds + ! ---------------------------------------------- + + type(atm2lnd_type), pointer :: flds(:) + character(len=*) , intent(in) :: fldname + character(len=*) , intent(in) :: units + logical , intent(in) :: required_fr_atm + integer , intent(in) :: lsize + + ! local variables + integer :: n,oldsize,newsize + type(atm2lnd_type), pointer :: newflds(:) + character(len=*), parameter :: subname='(lilac_utils_add_atm2lnd_fld)' + ! ---------------------------------------------- + + if (associated(flds)) then + oldsize = size(flds) + else + oldsize = 0 + end if + newsize = oldsize + 1 + + if (oldsize > 0) then + ! 1) allocate newfld to be size (one element larger than input flds) + allocate(newflds(newsize)) + + ! 2) copy flds into first N-1 elements of newflds + do n = 1,oldsize + newflds(n)%fldname = flds(n)%fldname + newflds(n)%units = flds(n)%units + newflds(n)%required_fr_atm = flds(n)%required_fr_atm + end do + + ! 3) deallocate / nullify flds + if (oldsize > 0) then + deallocate(flds) + nullify(flds) + end if + + ! 4) point flds => new_flds + flds => newflds + + ! 5) update flds information for new entry + flds(newsize)%fldname = trim(fldname) + flds(newsize)%units = trim(units) + flds(newsize)%required_fr_atm = required_fr_atm + + else + allocate(flds(newsize)) + flds(newsize)%fldname = trim(fldname) + flds(newsize)%units = trim(units) + flds(newsize)%required_fr_atm = required_fr_atm + end if + + end subroutine atm2lnd_add_fld + +!======================================================================== + + subroutine lnd2atm_add_fld(flds, fldname, units, lsize) + + ! ---------------------------------------------- + ! Add an entry to to the flds array + ! Use pointers to create an extensible allocatable array. + ! to allow the size of flds to grow, the process for + ! adding a new field is: + ! 1) allocate newflds to be N (one element larger than flds) + ! 2) copy flds into first N-1 elements of newflds + ! 3) newest flds entry is Nth element of newflds + ! 4) deallocate / nullify flds + ! 5) point flds => newflds + ! ---------------------------------------------- + + type(atm2lnd_type), pointer :: flds(:) + character(len=*) , intent(in) :: fldname + character(len=*) , intent(in) :: units + integer , intent(in) :: lsize + + ! local variables + integer :: n,oldsize,newsize + type(atm2lnd_type), pointer :: newflds(:) + character(len=*), parameter :: subname='(lilac_init_lnd2atm)' + ! ---------------------------------------------- + + if (associated(flds)) then + oldsize = size(flds) + else + oldsize = 0 + end if + newsize = oldsize + 1 + + ! 1) allocate newfld to be size (one element larger than input flds) + allocate(newflds(newsize)) + + ! 2) copy flds into first N-1 elements of newflds + do n = 1,oldsize + newflds(n)%fldname = flds(n)%fldname + newflds(n)%units = flds(n)%units + end do + + ! 3) deallocate / nullify flds + if (oldsize > 0) then + deallocate(flds) + nullify(flds) + end if + + ! 4) point flds => new_flds + flds => newflds + + ! 5) now update flds information for new entry + flds(newsize)%fldname = trim(fldname) + flds(newsize)%units = trim(units) + + end subroutine lnd2atm_add_fld end module lilac_utils From 62787851ab9c31979da5763a4394a1679009930c Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 26 Nov 2019 16:20:55 -0700 Subject: [PATCH 0421/1973] adding the new compset for LILAC testing.... --- cime_config/config_compsets.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 912bac56ef..33fa57651f 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -53,6 +53,11 @@ 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + I2000Clm50SpRsGs + 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm50BgcCru 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV From f6d81e122e0799893a1035d55759225035657a11 Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 26 Nov 2019 16:22:02 -0700 Subject: [PATCH 0422/1973] changes in buildlib to build lilac directory instead of mct. --- cime_config/buildlib | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index 86f1e479fa..f4cd613a6c 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -52,7 +52,9 @@ def _main_func(): os.path.join(lnd_root,"src","fates","biogeochem"), os.path.join(lnd_root,"src","fates","fire"), os.path.join(lnd_root,"src","utils"), - os.path.join(lnd_root,"src","cpl")] + os.path.join(lnd_root,"src","cpl"), + #os.path.join(lnd_root,"src","cpl","mct"), + os.path.join(lnd_root,"src","cpl","lilac")] with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) filepath.write("\n") From 379e032d5acf8df4b9c18f5aa659afdbb4bfb017 Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 26 Nov 2019 16:29:11 -0700 Subject: [PATCH 0423/1973] adding gindex_ocn to initlization subroutine. --- src/main/clm_initializeMod.F90 | 112 ++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 52 deletions(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index aa27b18a6c..4cd1073488 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -17,19 +17,20 @@ module clm_initializeMod use perf_mod , only : t_startf, t_stopf use readParamsMod , only : readParameters use ncdio_pio , only : file_desc_t - use GridcellType , only : grc ! instance - use LandunitType , only : lun ! instance - use ColumnType , only : col ! instance - use PatchType , only : patch ! instance + use GridcellType , only : grc ! instance + use LandunitType , only : lun ! instance + use ColumnType , only : col ! instance + use PatchType , only : patch ! instance use reweightMod , only : reweight_wrapup use filterMod , only : allocFilters, filter, filter_inactive_and_active use FatesInterfaceMod, only : set_fates_global_elements use dynSubgridControlMod, only: dynSubgridControl_init, get_reset_dynbal_baselines - use clm_instMod - ! + use clm_instMod + ! implicit none - private ! By default everything is private + private ! By default everything is private + ! public :: initialize1 ! Phase one initialization public :: initialize2 ! Phase two initialization @@ -38,18 +39,19 @@ module clm_initializeMod contains !----------------------------------------------------------------------- - subroutine initialize1( ) + subroutine initialize1(gindex_ocn) ! ! !DESCRIPTION: - ! CLM initialization first phase + ! CLM initialization first phase ! ! !USES: use clm_varpar , only: clm_varpar_init, natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec use clm_varcon , only: clm_varcon_init use landunit_varcon , only: landunit_varcon_init, max_lunit - use clm_varctl , only: fsurdat, fatmlndfrc, noland, version - use pftconMod , only: pftcon + use clm_varctl , only: fsurdat, fatmlndfrc, noland, version + use pftconMod , only: pftcon use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp + use decompInitMod , only: decompInit_ocn use domainMod , only: domain_check, ldomain, domain_init use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data, surfrd_get_num_patches use controlMod , only: control_init, control_print, NLFilename @@ -57,6 +59,10 @@ subroutine initialize1( ) use initGridCellsMod , only: initGridCells use ch4varcon , only: ch4conrd use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp + use dynSubgridControlMod, only: dynSubgridControl_init + ! + ! !ARGUMENTS + integer, pointer, optional :: gindex_ocn(:) ! ! !LOCAL VARIABLES: integer :: ier ! error status @@ -64,7 +70,7 @@ subroutine initialize1( ) integer :: nl ! gdc and glo lnd indices integer :: ns, ni, nj ! global grid sizes integer :: begg, endg ! processor bounds - type(bounds_type) :: bounds_proc + type(bounds_type) :: bounds_proc type(bounds_type) :: bounds_clump integer :: nclumps ! number of clumps on this processor integer :: nc ! clump index @@ -123,10 +129,13 @@ subroutine initialize1( ) ! ------------------------------------------------------------------------ call decompInit_lnd(ni, nj, amask) + if (present(gindex_ocn)) then + call decompInit_ocn(ni, nj, amask, gindex_ocn=gindex_ocn) + end if deallocate(amask) ! *** Get JUST gridcell processor bounds *** - ! Remaining bounds (landunits, columns, patches) will be determined + ! Remaining bounds (landunits, columns, patches) will be determined ! after the call to decompInit_glcp - so get_proc_bounds is called ! twice and the gridcell information is just filled in twice @@ -172,7 +181,6 @@ subroutine initialize1( ) call pftcon%Init() ! Read surface dataset and set up subgrid weight arrays - call surfrd_get_data(begg, endg, ldomain, fsurdat, actual_numcft) ! ------------------------------------------------------------------------ @@ -184,11 +192,11 @@ subroutine initialize1( ) ! Sets: ! fates_maxElementsPerPatch ! fates_maxElementsPerSite (where a site is roughly equivalent to a column) - ! + ! ! (Note: fates_maxELementsPerSite is the critical variable used by CLM ! to allocate space) ! ------------------------------------------------------------------------ - + call set_fates_global_elements(use_fates) ! ------------------------------------------------------------------------ @@ -200,7 +208,7 @@ subroutine initialize1( ) ! *** Get ALL processor bounds - for gridcells, landunit, columns and patches *** call get_proc_bounds(bounds_proc) - + ! Allocate memory for subgrid data structures ! This is needed here BEFORE the following call to initGridcells ! Note that the assumption is made that none of the subgrid initialization @@ -237,7 +245,7 @@ subroutine initialize1( ) ! ------------------------------------------------------------------------ ! Set CH4 Model Parameters from namelist. - ! Need to do before initTimeConst so that it knows whether to + ! Need to do before initTimeConst so that it knows whether to ! look for several optional parameters on surfdata file. if (use_lch4) then @@ -265,7 +273,7 @@ subroutine initialize2( ) use shr_orb_mod , only : shr_orb_decl use shr_scam_mod , only : shr_scam_getCloseLatLon use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - use accumulMod , only : print_accum_fields + use accumulMod , only : print_accum_fields use clm_varpar , only : nlevsno use clm_varcon , only : spval use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat @@ -273,7 +281,7 @@ subroutine initialize2( ) use clm_varctl , only : use_crop, ndep_from_cpl use clm_varorb , only : eccen, mvelpp, lambm0, obliqr use clm_time_manager , only : get_step_size_real, get_curr_calday - use clm_time_manager , only : get_curr_date, get_nstep, advance_timestep + use clm_time_manager , only : get_curr_date, get_nstep, advance_timestep use clm_time_manager , only : timemgr_init, timemgr_restart_io, timemgr_restart, is_restart use CIsoAtmTimeseriesMod , only : C14_init_BombSpike, use_c14_bombspike, C13_init_TimeSeries, use_c13_timeseries use DaylengthMod , only : InitDaylength @@ -285,9 +293,9 @@ subroutine initialize2( ) use histFileMod , only : hist_htapes_build, htapes_fieldlist, hist_printflds use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal use restFileMod , only : restFile_getfile, restFile_open, restFile_close - use restFileMod , only : restFile_read, restFile_write + use restFileMod , only : restFile_read, restFile_write use ndepStreamMod , only : ndep_init, ndep_interp - use LakeCon , only : LakeConInit + use LakeCon , only : LakeConInit use SatellitePhenologyMod , only : SatellitePhenologyInit, readAnnualVegetation, interpMonthlyVeg use SnowSnicarMod , only : SnowAge_init, SnowOptics_init use lnd2atmMod , only : lnd2atm_minimal @@ -296,7 +304,7 @@ subroutine initialize2( ) use clm_instMod , only : clm_fates use BalanceCheckMod , only : BalanceCheckInit ! - ! !ARGUMENTS + ! !ARGUMENTS ! ! !LOCAL VARIABLES: integer :: c,i,j,k,l,p! indices @@ -306,7 +314,7 @@ subroutine initialize2( ) integer :: ncsec ! current time of day [seconds] integer :: nc ! clump index integer :: nclumps ! number of clumps on this processor - character(len=256) :: fnamer ! name of netcdf restart file + character(len=256) :: fnamer ! name of netcdf restart file character(len=256) :: pnamer ! full pathname of netcdf restart file character(len=256) :: locfn ! local file name type(file_desc_t) :: ncid ! netcdf id @@ -326,7 +334,7 @@ subroutine initialize2( ) integer :: begc, endc integer :: begl, endl real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - character(len=32) :: subname = 'initialize2' + character(len=32) :: subname = 'initialize2' !---------------------------------------------------------------------- call t_startf('clm_init2') @@ -352,7 +360,7 @@ subroutine initialize2( ) ! Initialize time manager ! ------------------------------------------------------------------------ - if (nsrest == nsrStartup) then + if (nsrest == nsrStartup) then call timemgr_init() else call restFile_getfile(file=fnamer, path=pnamer) @@ -376,12 +384,12 @@ subroutine initialize2( ) call shr_orb_decl( caldaym1, eccen, mvelpp, lambm0, obliqr, declinm1, eccf ) call t_stopf('init_orbd') - + call InitDaylength(bounds_proc, declin=declin, declinm1=declinm1, obliquity=obliqr) ! Initialize Balance checking (after time-manager) call BalanceCheckInit() - + ! History file variables if (use_cn) then @@ -395,7 +403,7 @@ subroutine initialize2( ) end if ! ------------------------------------------------------------------------ - ! Initialize component data structures + ! Initialize component data structures ! ------------------------------------------------------------------------ ! Note: new logic is in place that sets all the history fields to spval so @@ -485,7 +493,7 @@ subroutine initialize2( ) ! be moved into bgc_vegetation_inst%Init2 if (n_drydep > 0 .and. drydep_method == DD_XLND) then - ! Must do this also when drydeposition is used so that estimates of monthly + ! Must do this also when drydeposition is used so that estimates of monthly ! differences in LAI can be computed call SatellitePhenologyInit(bounds_proc) end if @@ -502,10 +510,10 @@ subroutine initialize2( ) end if - + ! ------------------------------------------------------------------------ - ! On restart only - process the history namelist. + ! On restart only - process the history namelist. ! ------------------------------------------------------------------------ ! Later the namelist from the restart file will be used. This allows basic @@ -516,7 +524,7 @@ subroutine initialize2( ) end if ! ------------------------------------------------------------------------ - ! Read restart/initial info + ! Read restart/initial info ! ------------------------------------------------------------------------ is_cold_start = .false. @@ -530,13 +538,13 @@ subroutine initialize2( ) if (masterproc) then write(iulog,*)'Using cold start initial conditions ' end if - else + else if (masterproc) then write(iulog,*)'Interpolating initial conditions from ',trim(finidat_interp_source),& ' and creating new initial conditions ', trim(finidat_interp_dest) end if end if - else + else if (masterproc) then write(iulog,*)'Reading initial conditions from ',trim(finidat) end if @@ -578,7 +586,7 @@ subroutine initialize2( ) ! Read new interpolated conditions file back in call restFile_read(bounds_proc, finidat_interp_dest, glc_behavior) - ! Reset finidat to now be finidat_interp_dest + ! Reset finidat to now be finidat_interp_dest ! (to be compatible with routines still using finidat) finidat = trim(finidat_interp_dest) @@ -630,11 +638,11 @@ subroutine initialize2( ) end if ! ------------------------------------------------------------------------ - ! Initialize active history fields. + ! Initialize active history fields. ! ------------------------------------------------------------------------ - ! This is only done if not a restart run. If a restart run, then this - ! information has already been obtained from the restart data read above. + ! This is only done if not a restart run. If a restart run, then this + ! information has already been obtained from the restart data read above. ! Note that routine hist_htapes_build needs time manager information, ! so this call must be made after the restart information has been read. @@ -647,7 +655,7 @@ subroutine initialize2( ) ! ------------------------------------------------------------------------ ! The following is called for both initial and restart runs and must - ! must be called after the restart file is read + ! must be called after the restart file is read call atm2lnd_inst%initAccVars(bounds_proc) call temperature_inst%initAccVars(bounds_proc) @@ -661,11 +669,11 @@ subroutine initialize2( ) call crop_inst%initAccVars(bounds_proc) end if - !------------------------------------------------------------ + !------------------------------------------------------------ ! Read monthly vegetation - !------------------------------------------------------------ + !------------------------------------------------------------ - ! Even if CN is on, and dry-deposition is active, read CLMSP annual vegetation + ! Even if CN is on, and dry-deposition is active, read CLMSP annual vegetation ! to get estimates of monthly LAI if ( n_drydep > 0 .and. drydep_method == DD_XLND )then @@ -677,9 +685,9 @@ subroutine initialize2( ) end if end if - !------------------------------------------------------------ + !------------------------------------------------------------ ! Determine gridcell averaged properties to send to atm - !------------------------------------------------------------ + !------------------------------------------------------------ if (nsrest == nsrStartup) then call t_startf('init_map2gc') @@ -688,9 +696,9 @@ subroutine initialize2( ) call t_stopf('init_map2gc') end if - !------------------------------------------------------------ + !------------------------------------------------------------ ! Initialize sno export state to send to glc - !------------------------------------------------------------ + !------------------------------------------------------------ !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) do nc = 1,nclumps @@ -705,9 +713,9 @@ subroutine initialize2( ) end do !$OMP END PARALLEL DO - !------------------------------------------------------------ + !------------------------------------------------------------ ! Deallocate wt_nat_patch - !------------------------------------------------------------ + !------------------------------------------------------------ ! wt_nat_patch was allocated in initialize1, but needed to be kept around through ! initialize2 for some consistency checking; now it can be deallocated @@ -717,7 +725,7 @@ subroutine initialize2( ) ! -------------------------------------------------------------- ! Initialise the fates model state structure ! -------------------------------------------------------------- - + if ( use_fates .and. .not.is_restart() .and. finidat == ' ') then call clm_fates%init_coldstart(water_inst%waterstatebulk_inst, & water_inst%waterdiagnosticbulk_inst, canopystate_inst, & @@ -730,9 +738,9 @@ subroutine initialize2( ) deallocate(topo_glc_mec, fert_cft, irrig_method) - !------------------------------------------------------------ + !------------------------------------------------------------ ! Write log output for end of initialization - !------------------------------------------------------------ + !------------------------------------------------------------ call t_startf('init_wlog') if (masterproc) then From 0ba99a2cc3f2bb100b213cc5b6ea4658c1650bbb Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 26 Nov 2019 16:30:12 -0700 Subject: [PATCH 0424/1973] adding decomposition initalization for ocean to src/main/decompInitMod.F90 --- src/main/decompInitMod.F90 | 106 ++++++++++++++++++++++++++++--------- 1 file changed, 81 insertions(+), 25 deletions(-) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 709c0b5e36..c5f743085b 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -14,8 +14,8 @@ module decompInitMod use clm_varctl , only : iulog, use_fates use clm_varcon , only : grlnd use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col + use LandunitType , only : lun + use ColumnType , only : col use PatchType , only : patch use glcBehaviorMod , only : glc_behavior_type use decompMod @@ -26,8 +26,9 @@ module decompInitMod implicit none ! ! !PUBLIC MEMBER FUNCTIONS: - public decompInit_lnd ! initializes lnd grid decomposition into clumps and processors - public decompInit_clumps ! initializes atm grid decomposition into clumps + public decompInit_lnd ! initializes grid land points decomposition into clumps and processors + public decompInit_ocn ! initializes grid ocean points decomposition + public decompInit_clumps ! initializes grid decomposition into clumps public decompInit_glcp ! initializes g,l,c,p decomp info ! ! !PRIVATE TYPES: @@ -87,8 +88,8 @@ subroutine decompInit_lnd(lni,lnj,amask) call endrun(msg=errMsg(sourcefile, __LINE__)) end if - ! allocate and initialize procinfo and clumps - ! beg and end indices initialized for simple addition of cells later + ! allocate and initialize procinfo and clumps + ! beg and end indices initialized for simple addition of cells later allocate(procinfo%cid(clump_pproc), stat=ier) if (ier /= 0) then @@ -135,7 +136,7 @@ subroutine decompInit_lnd(lni,lnj,amask) clumps(:)%endp = 0 clumps(:)%endCohort = 0 - ! assign clumps to proc round robin + ! assign clumps to proc round robin cid = 0 do n = 1,nclumps pid = mod(n-1,npes) @@ -207,7 +208,7 @@ subroutine decompInit_lnd(lni,lnj,amask) !--- give gridcell cell to pe that owns cid --- !--- this needs to be done to subsequently use function - !--- get_proc_bounds(begg,endg) + !--- get_proc_bounds(begg,endg) if (iam == clumps(cid)%owner) then procinfo%ncells = procinfo%ncells + 1 endif @@ -226,7 +227,7 @@ subroutine decompInit_lnd(lni,lnj,amask) (clumps(m)%owner == clumps(cid)%owner .and. m > cid)) then clumps(m)%begg = clumps(m)%begg + 1 endif - + if ((clumps(m)%owner > clumps(cid)%owner) .or. & (clumps(m)%owner == clumps(cid)%owner .and. m >= cid)) then clumps(m)%endg = clumps(m)%endg + 1 @@ -312,6 +313,61 @@ subroutine decompInit_lnd(lni,lnj,amask) end subroutine decompInit_lnd + !------------------------------------------------------------------------------ + subroutine decompInit_ocn(ni, nj, amask, gindex_ocn) + + ! !DESCRIPTION: + ! calculate a decomposition of only ocn points (needed for the nuopc interface) + + ! !USES: + use spmdMod , only : npes, iam + + ! !ARGUMENTS: + integer , intent(in) :: amask(:) + integer , intent(in) :: ni,nj ! domain global size + integer , pointer :: gindex_ocn(:) + + ! !LOCAL VARIABLES: + integer :: n,i,j,nocn + integer :: nlnd_global + integer :: nocn_global + integer :: nocn_local + integer :: my_ocn_start, my_ocn_end + !------------------------------------------------------------------------------ + + ! count total land and ocean gridcells + nlnd_global = 0 + nocn_global = 0 + do n = 1,ni*nj + if (amask(n) == 1) then + nlnd_global = nlnd_global + 1 + else + nocn_global = nocn_global + 1 + endif + enddo + + ! create the a global index array for ocean points + nocn_local = nocn_global / npes + + my_ocn_start = nocn_local*iam + min(iam, mod(nocn_global, npes)) + 1 + if (iam < mod(nocn_global, npes)) then + nocn_local = nocn_local + 1 + end if + my_ocn_end = my_ocn_start + nocn_local - 1 + + allocate(gindex_ocn(nocn_local)) + nocn = 0 + do n = 1,ni*nj + if (amask(n) == 0) then + nocn = nocn + 1 + if (nocn >= my_ocn_start .and. nocn <= my_ocn_end) then + gindex_ocn(nocn - my_ocn_start + 1) = n + end if + end if + end do + + end subroutine decompInit_ocn + !------------------------------------------------------------------------------ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) ! @@ -354,15 +410,15 @@ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) allocate(allvecl(nclumps,5)) ! local clumps [gcells,lunit,cols,patches,coh] allocate(allvecg(nclumps,5)) ! global clumps [gcells,lunit,cols,patches,coh] - ! Determine the number of gridcells, landunits, columns, and patches, cohorts - ! on this processor + ! Determine the number of gridcells, landunits, columns, and patches, cohorts + ! on this processor ! Determine number of landunits, columns and patches for each global ! gridcell index (an) that is associated with the local gridcell index (ln) ilunits=0 icols=0 ipatches=0 - icohorts=0 + icohorts=0 allvecg= 0 allvecl= 0 @@ -375,8 +431,8 @@ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) allvecl(cid,1) = allvecl(cid,1) + 1 allvecl(cid,2) = allvecl(cid,2) + ilunits ! number of landunits for local clump cid allvecl(cid,3) = allvecl(cid,3) + icols ! number of columns for local clump cid - allvecl(cid,4) = allvecl(cid,4) + ipatches ! number of patches for local clump cid - allvecl(cid,5) = allvecl(cid,5) + icohorts ! number of cohorts for local clump cid + allvecl(cid,4) = allvecl(cid,4) + ipatches ! number of patches for local clump cid + allvecl(cid,5) = allvecl(cid,5) + icohorts ! number of cohorts for local clump cid enddo call mpi_allreduce(allvecl,allvecg,size(allvecg),MPI_INTEGER,MPI_SUM,mpicom,ier) @@ -405,7 +461,7 @@ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) !--- give gridcell to cid --- !--- increment the beg and end indices --- - clumps(cid)%nlunits = clumps(cid)%nlunits + ilunits + clumps(cid)%nlunits = clumps(cid)%nlunits + ilunits clumps(cid)%ncols = clumps(cid)%ncols + icols clumps(cid)%npatches = clumps(cid)%npatches + ipatches clumps(cid)%nCohorts = clumps(cid)%nCohorts + icohorts @@ -464,7 +520,7 @@ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) write(iulog ,*) 'decompInit_glcp(): allvecg error ncols ',iam,n,clumps(n)%ncols ,allvecg(n,3) write(iulog ,*) 'decompInit_glcp(): allvecg error patches',iam,n,clumps(n)%npatches ,allvecg(n,4) write(iulog ,*) 'decompInit_glcp(): allvecg error cohorts',iam,n,clumps(n)%nCohorts ,allvecg(n,5) - + call endrun(msg=errMsg(sourcefile, __LINE__)) endif enddo @@ -527,7 +583,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) character(len=32), parameter :: subname = 'decompInit_glcp' !------------------------------------------------------------------------------ - !init + !init call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp, & begCohort, endCohort) @@ -557,7 +613,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) endif allocate(coCount(begg:endg)) coCount(:) = 0 - allocate(ioff(begg:endg)) + allocate(ioff(begg:endg)) ioff(:) = 0 ! Determine gcount, lcount, ccount and pcount @@ -595,7 +651,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) endif call scatter_data_from_master(gstart, arrayglob, grlnd) - ! lstart for gridcell (n) is the total number of the landunits + ! lstart for gridcell (n) is the total number of the landunits ! over gridcells 1->n-1 arrayglob(:) = 0 @@ -687,7 +743,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) do li = begl,endl gi = lun%gridcell(li) !===this is determined internally from how landunits are spread out in memory gindex(li) = lstart(gi) + ioff(gi) !=== the output gindex is ALWAYS the same regardless of how landuntis are spread out in memory - ioff(gi) = ioff(gi) + 1 + ioff(gi) = ioff(gi) + 1 ! check that this is less than [lstart(gi) + lcount(gi)] enddo locsize = endl-begl+1 @@ -702,7 +758,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) do ci = begc,endc gi = col%gridcell(ci) gindex(ci) = cstart(gi) + ioff(gi) - ioff(gi) = ioff(gi) + 1 + ioff(gi) = ioff(gi) + 1 ! check that this is less than [cstart(gi) + ccount(gi)] enddo locsize = endc-begc+1 @@ -717,7 +773,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) do pi = begp,endp gi = patch%gridcell(pi) gindex(pi) = pstart(gi) + ioff(gi) - ioff(gi) = ioff(gi) + 1 + ioff(gi) = ioff(gi) + 1 ! check that this is less than [pstart(gi) + pcount(gi)] enddo locsize = endp-begp+1 @@ -726,7 +782,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) deallocate(gindex) ! FATES gsmap for the cohort/element vector - + if ( use_fates ) then allocate(gindex(begCohort:endCohort)) ioff(:) = 0 @@ -775,7 +831,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) write(iulog,*) end if - ! Write out clump and proc info, one pe at a time, + ! Write out clump and proc info, one pe at a time, ! barrier to control pes overwriting each other on stdout call shr_sys_flush(iulog) @@ -870,7 +926,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) ' clump id= ',procinfo%cid(n), & ' beg patch = ',clumps(cid)%begp, & ' end patch = ',clumps(cid)%endp, & - ' total patches per clump = ',clumps(cid)%npatches + ' total patches per clump = ',clumps(cid)%npatches write(iulog,*)'proc= ',pid,' clump no = ',n, & ' clump id= ',procinfo%cid(n), & ' beg cohort = ',clumps(cid)%begCohort, & From d774f21621afb1b83b07e0fe1c12bba8deef7276 Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 26 Nov 2019 16:33:35 -0700 Subject: [PATCH 0425/1973] making changes in mct_gGrid_init CoordChars to get 'lat:lon:hgt' --- src/main/ndepStreamMod.F90 | 76 +++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/src/main/ndepStreamMod.F90 b/src/main/ndepStreamMod.F90 index e4acd648b8..ac8548a8c1 100644 --- a/src/main/ndepStreamMod.F90 +++ b/src/main/ndepStreamMod.F90 @@ -1,13 +1,13 @@ module ndepStreamMod - !----------------------------------------------------------------------- - ! !DESCRIPTION: + !----------------------------------------------------------------------- + ! !DESCRIPTION: ! Contains methods for reading in nitrogen deposition data file - ! Also includes functions for dynamic ndep file handling and + ! Also includes functions for dynamic ndep file handling and ! interpolation. ! ! !USES - use shr_kind_mod, only: r8 => shr_kind_r8, CL => shr_kind_cl + use shr_kind_mod, only: r8 => shr_kind_r8, CL => shr_kind_cl use shr_strdata_mod, only: shr_strdata_type, shr_strdata_create use shr_strdata_mod, only: shr_strdata_print, shr_strdata_advance use mct_mod , only: mct_ggrid @@ -15,7 +15,7 @@ module ndepStreamMod use clm_varctl , only: iulog use abortutils , only: endrun use fileutils , only: getavu, relavu - use decompMod , only: bounds_type, ldecomp, gsmap_lnd_gdc2glo + use decompMod , only: bounds_type, ldecomp, gsmap_lnd_gdc2glo use domainMod , only: ldomain ! !PUBLIC TYPES: @@ -34,7 +34,7 @@ module ndepStreamMod type(shr_strdata_type) :: sdat ! input data stream integer :: stream_year_first_ndep ! first year in stream to use integer :: stream_year_last_ndep ! last year in stream to use - integer :: model_year_align_ndep ! align stream_year_firstndep with + integer :: model_year_align_ndep ! align stream_year_firstndep with logical :: divide_by_secs_per_yr = .true. ! divide by the number of seconds per year character(len=*), parameter, private :: sourcefile = & @@ -46,8 +46,8 @@ module ndepStreamMod !============================================================================== subroutine ndep_init(bounds, NLFilename) - ! - ! Initialize data stream information. + ! + ! Initialize data stream information. ! ! Uses: use shr_kind_mod , only : CS => shr_kind_cs @@ -61,13 +61,13 @@ subroutine ndep_init(bounds, NLFilename) ! ! arguments implicit none - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! local variables integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_ndep character(len=CL) :: ndepmapalgo = 'bilinear' character(len=CS) :: ndep_taxmode = 'extend' @@ -118,9 +118,9 @@ subroutine ndep_init(bounds, NLFilename) if (masterproc) then write(iulog,*) ' ' write(iulog,*) 'ndepdyn stream settings:' - write(iulog,*) ' stream_year_first_ndep = ',stream_year_first_ndep - write(iulog,*) ' stream_year_last_ndep = ',stream_year_last_ndep - write(iulog,*) ' model_year_align_ndep = ',model_year_align_ndep + write(iulog,*) ' stream_year_first_ndep = ',stream_year_first_ndep + write(iulog,*) ' stream_year_last_ndep = ',stream_year_last_ndep + write(iulog,*) ' model_year_align_ndep = ',model_year_align_ndep write(iulog,*) ' stream_fldFileName_ndep = ',stream_fldFileName_ndep write(iulog,*) ' ndep_varList = ',ndep_varList write(iulog,*) ' ndep_taxmode = ',ndep_taxmode @@ -133,7 +133,7 @@ subroutine ndep_init(bounds, NLFilename) call clm_domain_mct (bounds, dom_clm) call shr_strdata_create(sdat,name="clmndep", & - pio_subsystem=pio_subsystem, & + pio_subsystem=pio_subsystem, & pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & @@ -146,7 +146,7 @@ subroutine ndep_init(bounds, NLFilename) domFileName=trim(stream_fldFileName_ndep), & domTvarName='time', & domXvarName='lon' , & - domYvarName='lat' , & + domYvarName='lat' , & domAreaName='area', & domMaskName='mask', & filePath='', & @@ -165,7 +165,7 @@ subroutine ndep_init(bounds, NLFilename) end subroutine ndep_init !================================================================ - + subroutine check_units( stream_fldFileName_ndep, ndep_varList ) !------------------------------------------------------------------- ! Check that units are correct on the file and if need any conversion @@ -222,11 +222,11 @@ subroutine ndep_interp(bounds, atm2lnd_inst) use atm2lndType , only : atm2lnd_type ! ! Arguments - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds type(atm2lnd_type), intent(inout) :: atm2lnd_inst ! ! Local variables - integer :: g, ig + integer :: g, ig integer :: year ! year (0, ...) for nstep+1 integer :: mon ! month (1, ..., 12) for nstep+1 integer :: day ! day of month (1, ..., 31) for nstep+1 @@ -254,7 +254,7 @@ subroutine ndep_interp(bounds, atm2lnd_inst) atm2lnd_inst%forc_ndep_grc(g) = sdat%avs(1)%rAttr(1,ig) end do end if - + end subroutine ndep_interp !============================================================================== @@ -264,14 +264,13 @@ subroutine clm_domain_mct(bounds, dom_clm) ! Set domain data type for internal clm grid use clm_varcon , only : re use domainMod , only : ldomain - use seq_flds_mod use mct_mod , only : mct_ggrid, mct_gsMap_lsize, mct_gGrid_init use mct_mod , only : mct_gsMap_orderedPoints, mct_gGrid_importIAttr use mct_mod , only : mct_gGrid_importRAttr implicit none - ! + ! ! arguments - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(mct_ggrid), intent(out) :: dom_clm ! Output domain information for land model ! ! local variables @@ -284,10 +283,10 @@ subroutine clm_domain_mct(bounds, dom_clm) ! Initialize mct domain type ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) ! Note that in addition land carries around landfrac for the purposes of domain checking - ! + ! lsize = mct_gsMap_lsize(gsmap_lnd_gdc2glo, mpicom) - call mct_gGrid_init( GGrid=dom_clm, CoordChars=trim(seq_flds_dom_coord), & - OtherChars=trim(seq_flds_dom_other), lsize=lsize ) + call mct_gGrid_init( GGrid=dom_clm, & + CoordChars='lat:lon:hgt', OtherChars='area:aream:mask:frac', lsize=lsize ) ! ! Allocate memory ! @@ -301,13 +300,13 @@ subroutine clm_domain_mct(bounds, dom_clm) ! Determine domain (numbering scheme is: West to East and South to North to South pole) ! Initialize attribute vector with special value ! - data(:) = -9999.0_R8 - call mct_gGrid_importRAttr(dom_clm,"lat" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"lon" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"area" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"aream",data,lsize) - data(:) = 0.0_R8 - call mct_gGrid_importRAttr(dom_clm,"mask" ,data,lsize) + data(:) = -9999.0_R8 + call mct_gGrid_importRAttr(dom_clm,"lat" ,data,lsize) + call mct_gGrid_importRAttr(dom_clm,"lon" ,data,lsize) + call mct_gGrid_importRAttr(dom_clm,"area" ,data,lsize) + call mct_gGrid_importRAttr(dom_clm,"aream",data,lsize) + data(:) = 0.0_R8 + call mct_gGrid_importRAttr(dom_clm,"mask" ,data,lsize) ! ! Determine bounds ! @@ -318,36 +317,35 @@ subroutine clm_domain_mct(bounds, dom_clm) i = 1 + (g - bounds%begg) data(i) = ldomain%lonc(g) end do - call mct_gGrid_importRattr(dom_clm,"lon",data,lsize) + call mct_gGrid_importRattr(dom_clm,"lon",data,lsize) do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = ldomain%latc(g) end do - call mct_gGrid_importRattr(dom_clm,"lat",data,lsize) + call mct_gGrid_importRattr(dom_clm,"lat",data,lsize) do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = ldomain%area(g)/(re*re) end do - call mct_gGrid_importRattr(dom_clm,"area",data,lsize) + call mct_gGrid_importRattr(dom_clm,"area",data,lsize) do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = real(ldomain%mask(g), r8) end do - call mct_gGrid_importRattr(dom_clm,"mask",data,lsize) + call mct_gGrid_importRattr(dom_clm,"mask",data,lsize) do g = bounds%begg,bounds%endg i = 1 + (g - bounds%begg) data(i) = real(ldomain%frac(g), r8) end do - call mct_gGrid_importRattr(dom_clm,"frac",data,lsize) + call mct_gGrid_importRattr(dom_clm,"frac",data,lsize) deallocate(data) deallocate(idata) end subroutine clm_domain_mct - -end module ndepStreamMod +end module ndepStreamMod From 96f8d3426ba470e127847aadfb758603a9246153 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 27 Nov 2019 09:06:15 -0700 Subject: [PATCH 0426/1973] more updates to make the driver more flexible and start cleaning up the Makefile --- lilac/atm_driver/Makefile | 30 ++---- lilac/atm_driver/atm_driver.F90 | 133 ++++++++++++++--------- lilac/atm_driver/atm_driver_in | 16 +++ lilac/atm_driver/cheyenne.sub | 2 +- lilac/atm_driver/namelist_lilac | 10 -- lilac/lilac/lilac_atmcap.F90 | 92 ++++++++-------- lilac/lilac/lilac_cpl.F90 | 4 - lilac/lilac/lilac_mod.F90 | 181 ++++++++++++++++---------------- lilac/lilac/lilac_utils.F90 | 7 +- 9 files changed, 244 insertions(+), 231 deletions(-) create mode 100644 lilac/atm_driver/atm_driver_in delete mode 100644 lilac/atm_driver/namelist_lilac diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index ee3fb76810..860c6743d7 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -1,32 +1,14 @@ - #================================================================================ # Makefile to compile the lilac program #================================================================================ ## This is temporary Makefile for building lilac against CTSM pre-compiled library - - #================================================================================ ### Finding and including esmf.mk #================================================================================ -# Note: This fully portable Makefile template depends on finding environment -# # variable "ESMFMKFILE" set to point to the appropriate "esmf.mk" file, -# # as is discussed in the User's Guide. -# # However, you can still use this Makefile template even if the person -# # that installed ESMF on your system did not provide for a mechanism to -# # automatically set the environment variable "ESMFMKFILE". In this case -# # either manually set "ESMFMKFILE" in your environment or hard code the -# # location of "esmf.mk" into the include statement below. -# # Notice that the latter approach has negative impact on flexibility and -# # portability. - - -#ifneq ($(origin ESMFMKFILE), environment) -#$(error Environment variable ESMFMKFILE was not set.) -#endif - -ESMFMKFILE = /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libO/Linux.intel.64.mpt.default/esmf.mk +ESMFMKFILE = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk +ESMF_LIB_DIR = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default include $(ESMFMKFILE) #================================================================================ @@ -35,15 +17,15 @@ include $(ESMFMKFILE) # Temporarily hard-coded # TODO: Please fix this part. CASE_NAME = why01-g -CTSM_BLD_DIR = /glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf +CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf CTSM_INC = -I$(CTSM_BLD_DIR)/include CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm #TRACEBACK_FLAGS = -g -traceback -debug all -check all -O2 -r8 TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free # ----------------------------------------------------------------------------- -EXTRA_LIBS = -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -L/glade/u/home/dunlap/YAML-INSTALL/lib -Wl,-rpath,/glade/u/home/dunlap/ESMF-INSTALL/intel19/8.0.0bs32/lib/libO/Linux.intel.64.mpt.default -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/home/dunlap/YAML-INSTALL/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -lyaml-cpp -cxxlib -MORE_LIBS = -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/negins/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ +EXTRA_LIBS = -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib +MORE_LIBS = -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ # ----------------------------------------------------------------------------- DRIVER_DIR = $(CURDIR) @@ -110,7 +92,7 @@ lilac_atmcap.o: lilac_utils.o .PHONY: clean berzerk remake clean: - rm -f *.exe *.o + rm -f *.exe *.o *.mod *.optr* berzerk: rm -f PET*.ESMF_LogFile job_name* *.o *.mod *.exe remake: diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 7a264b7eb9..32d42f18f9 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -13,42 +13,54 @@ program atm_driver ! lilac (not an ESMF gridded component!) ! | |________________________.____________.......... gridded components ! | | | - ! ESMF lilac_atmcap ESMF land cap ESMF river cap - ! | | - ! CTSM Mizzouroute... + ! ESMF lilac_atmcap ESMF CTSM cap ESMF river cap (Mizzouroute, Mosart) !---------------------------------------------------------------------------- use lilac_mod , only : lilac_init, lilac_run, lilac_final - use lilac_utils , only : lilac_atm2lnd, lilac_lnd2atm, gindex_atm + use lilac_utils , only : lilac_atm2lnd, lilac_lnd2atm + use shr_sys_mod , only : shr_sys_abort use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS implicit none - integer :: comp_comm - integer :: ierr - real , allocatable :: centerCoords(:,:) - real , allocatable :: lon(:), lat(:) - integer :: mytask, ntasks - integer :: my_start, my_end - integer :: i_local, i_global - integer :: nlocal, nglobal - integer :: start_time !-- start_time start time - integer :: end_time !-- end_time end time - integer :: curr_time !-- cur_time current time - integer :: itime_step !-- itime_step counter of time steps - integer :: g,i,k !-- indices - character(len=128) :: filename + integer :: comp_comm + integer :: ierr + real , allocatable :: centerCoords(:,:) + real , allocatable :: lon(:), lat(:) + integer , allocatable :: atm_global_index(:) + integer :: mytask, ntasks + integer :: my_start, my_end + integer :: i_local, i_global + integer :: nlocal, nglobal + integer :: nstep ! time step counter + integer :: g,i,k ! indices + integer :: fileunit ! for namelist input + + ! Namelist and related variables + character(len=512) :: atm_mesh_filename + character(len=128) :: atm_calendar + integer :: atm_timestep + integer :: atm_start_year ! (yyyy) + integer :: atm_start_mon ! (mm) + integer :: atm_start_day + integer :: atm_start_secs + integer :: atm_stop_year ! (yyyy) + integer :: atm_stop_mon ! (mm) + integer :: atm_stop_day + integer :: atm_stop_secs + integer :: atm_timestep_start ! for internal time loop only + integer :: atm_timestep_stop ! for internal time loop only + + namelist /lilac_input/ atm_mesh_filename, atm_calendar, atm_timestep, & + atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & + atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, & + atm_timestep_start, atm_timestep_stop !------------------------------------------------------------------------ - start_time = 1 - end_time = 48 - !----------------------------------------------------------------------------- ! Initiallize MPI !----------------------------------------------------------------------------- - write(*, *) "MPI initialization starts ..." - call MPI_init(ierr) if (ierr .ne. MPI_SUCCESS) then print *,'Error starting MPI program. Terminating.' @@ -63,13 +75,33 @@ program atm_driver print *, "MPI initialization done ..., ntasks=", ntasks end if + !----------------------------------------------------------------------------- + ! Read in namelist file ... + !----------------------------------------------------------------------------- + + if (mytask == 0) then + print *,"---------------------------------------" + print *, "MPI initialized in atm_driver ..." + end if + + ! The following will read this on all processors - might want to do a read just on the + ! master processor and broadcast in the future + + open(newunit=fileunit, status="old", file="atm_driver_in") + read(fileunit, lilac_input, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort( 'problem on read of atm_driver_in') + end if + close(fileunit) + !----------------------------------------------------------------------------- ! Read mesh file to get number of points (n_points) !----------------------------------------------------------------------------- - filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - call read_netcdf_mesh(filename, nglobal) + + call read_netcdf_mesh(atm_mesh_filename, nglobal) if (mytask == 0 ) then - print *, "number of global points is is:", nglobal + print *, " atm_driver mesh file ",trim(atm_mesh_filename) + print *, "number of global points in mesh is:", nglobal end if !----------------------------------------------------------------------------- @@ -85,11 +117,11 @@ program atm_driver end if my_end = my_start + nlocal - 1 - allocate(gindex_atm(nlocal)) + allocate(atm_global_index(nlocal)) i_global = my_start do i_local = 1, nlocal - gindex_atm(i_local) = i_global + atm_global_index(i_local) = i_global i_global = i_global + 1 end do @@ -97,7 +129,12 @@ program atm_driver ! Initialize lilac !------------------------------------------------------------------------ - call lilac_init(nlocal) + if (mytask == 0 ) then + print *, " initializing lilac " + end if + call lilac_init(atm_global_index, atm_mesh_filename, atm_calendar, atm_timestep, & + atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & + atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) !------------------------------------------------------------------------ ! Fill in atm2lnd type pointer data @@ -107,7 +144,7 @@ program atm_driver allocate(lon(nlocal)) allocate(lat(nlocal)) do i = 1,nlocal - i_global = gindex_atm(i) + i_global = atm_global_index(i) lon(i) = centerCoords(1,i_global) lon(i) = real(nint(lon(i))) ! rounding to nearest int lat(i) = centerCoords(2,i_global) @@ -121,10 +158,8 @@ program atm_driver ! Run lilac !------------------------------------------------------------------------ - itime_step = 1 - do curr_time = start_time, end_time + do nstep = atm_timestep_start, atm_timestep_stop call lilac_run( ) - itime_step = itime_step + 1 end do !------------------------------------------------------------------------ @@ -154,7 +189,7 @@ subroutine read_netcdf_mesh(filename, nglobal) ! local Variables integer :: idfile - integer :: ierror + integer :: ierr integer :: dimid_elem integer :: dimid_coordDim integer :: iddim_elem @@ -166,20 +201,20 @@ subroutine read_netcdf_mesh(filename, nglobal) !----------------------------------------------------------------------------- ! Open mesh file and get the idfile - ierror = nf90_open(filename, NF90_NOWRITE, idfile) - call nc_check_err(ierror, "opening file", filename) + ierr = nf90_open(filename, NF90_NOWRITE, idfile) + call nc_check_err(ierr, "opening file", filename) ! Get the dimid of dimensions - ierror = nf90_inq_dimid(idfile, 'elementCount', dimid_elem) - call nc_check_err(ierror, "inq_dimid elementCount", filename) - ierror = nf90_inq_dimid(idfile, 'coordDim', dimid_coordDim) - call nc_check_err(ierror, "coordDim", filename) + ierr = nf90_inq_dimid(idfile, 'elementCount', dimid_elem) + call nc_check_err(ierr, "inq_dimid elementCount", filename) + ierr = nf90_inq_dimid(idfile, 'coordDim', dimid_coordDim) + call nc_check_err(ierr, "coordDim", filename) ! Inquire dimensions based on their dimeid(s) - ierror = nf90_inquire_dimension(idfile, dimid_elem, string, nelem) - call nc_check_err(ierror, "inq_dim elementCount", filename) - ierror = nf90_inquire_dimension(idfile, dimid_coordDim, string, coordDim) - call nc_check_err(ierror, "inq_dim coordDim", filename) + ierr = nf90_inquire_dimension(idfile, dimid_elem, string, nelem) + call nc_check_err(ierr, "inq_dim elementCount", filename) + ierr = nf90_inquire_dimension(idfile, dimid_coordDim, string, coordDim) + call nc_check_err(ierr, "inq_dim coordDim", filename) if (mytask == 0 ) then print *, "=======================================" @@ -191,10 +226,10 @@ subroutine read_netcdf_mesh(filename, nglobal) ! Get coordinate values allocate (centerCoords(coordDim, nelem)) - ierror = nf90_inq_varid(idfile, 'centerCoords' , idvar_centerCoords) - call nc_check_err(ierror, "inq_varid centerCoords", filename) - ierror = nf90_get_var(idfile, idvar_CenterCoords, centerCoords, start=(/1,1/), count=(/coordDim, nelem/)) - call nc_check_err(ierror,"get_var CenterCoords", filename) + ierr = nf90_inq_varid(idfile, 'centerCoords' , idvar_centerCoords) + call nc_check_err(ierr, "inq_varid centerCoords", filename) + ierr = nf90_get_var(idfile, idvar_CenterCoords, centerCoords, start=(/1,1/), count=(/coordDim, nelem/)) + call nc_check_err(ierr,"get_var CenterCoords", filename) nglobal = nelem @@ -291,7 +326,7 @@ subroutine lilac_to_atm () real*8, allocatable :: data(:) ! -------------------------------------------- - lsize = size(gindex_atm) + lsize = size(atm_global_index) allocate(data(lsize)) call lilac_lnd2atm('Sl_lfrin' , data) diff --git a/lilac/atm_driver/atm_driver_in b/lilac/atm_driver/atm_driver_in new file mode 100644 index 0000000000..ba32e9e528 --- /dev/null +++ b/lilac/atm_driver/atm_driver_in @@ -0,0 +1,16 @@ +&lilac_input + atm_start_year = 2000 + atm_start_mon = 1 + atm_start_day = 1 + atm_start_secs = 0 + atm_stop_year = 2000 + atm_stop_mon = 1 + atm_stop_day = 2 + atm_stop_secs = 0 + atm_timestep = 1800 + atm_calendar = 'NOLEAP' + atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + atm_timestep_start = 1 + atm_timestep_stop = 48 + +/ diff --git a/lilac/atm_driver/cheyenne.sub b/lilac/atm_driver/cheyenne.sub index fab83413c0..4733e8ae3e 100644 --- a/lilac/atm_driver/cheyenne.sub +++ b/lilac/atm_driver/cheyenne.sub @@ -36,4 +36,4 @@ setenv UGCSFIXEDFILEPATH /glade/work/turuncu/FV3GFS/fix_am setenv UGCSADDONPATH /glade/work/turuncu/FV3GFS/addon #setenv MPI_USE_ARRAY false -mpiexec_mpt ./atm_driver.exe +mpiexec_mpt -p "%g:" ./atm_driver.exe diff --git a/lilac/atm_driver/namelist_lilac b/lilac/atm_driver/namelist_lilac deleted file mode 100644 index d766ab7ef7..0000000000 --- a/lilac/atm_driver/namelist_lilac +++ /dev/null @@ -1,10 +0,0 @@ -&input - s_month = 5, - s_day = 15, - s_hour = 9, - s_min = 0, - e_month = 5, - e_day = 15, - e_hour = 9, - e_min = 30 -/ diff --git a/lilac/lilac/lilac_atmcap.F90 b/lilac/lilac/lilac_atmcap.F90 index 3fbd3bb189..2909dfdbab 100644 --- a/lilac/lilac/lilac_atmcap.F90 +++ b/lilac/lilac/lilac_atmcap.F90 @@ -7,29 +7,26 @@ module lilac_atmcap ! !USES use ESMF - use lilac_utils , only : atm2lnd, lnd2atm, gindex_atm + use lilac_utils , only : atm2lnd, lnd2atm, gindex_atm, atm_mesh_filename implicit none - include 'mpif.h' + public :: lilac_atmos_register - public :: atmos_register - - integer :: mytask - character(*), parameter :: modname = "atmos_cap" - integer, parameter :: debug = 0 ! internal debug level + integer :: mytask + integer, parameter :: debug = 0 ! internal debug level !======================================================================== contains !======================================================================== - subroutine atmos_register (comp, rc) + subroutine lilac_atmos_register (comp, rc) type(ESMF_GridComp) :: comp ! must not be optional integer, intent(out) :: rc ! local variables type(ESMF_VM) :: vm - character(len=*), parameter :: subname=trim(modname)//':(atmos_register) ' + character(len=*), parameter :: subname='(lilac_atmos_register): ' !------------------------------------------------------------------------- call ESMF_VMGetGlobal(vm=vm, rc=rc) @@ -45,67 +42,58 @@ subroutine atmos_register (comp, rc) rc = ESMF_SUCCESS ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=atmos_init, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=lilac_atmos_init, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=atmos_run, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=lilac_atmos_run, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=atmos_final, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=lilac_atmos_final, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - end subroutine atmos_register + end subroutine lilac_atmos_register !======================================================================== - subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) + subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! input/output variables - type (ESMF_GridComp) :: comp - type (ESMF_State) :: lnd2atm_a_state, atm2lnd_a_state - type (ESMF_Clock) :: clock - integer, intent(out) :: rc + type (ESMF_GridComp) :: comp + type (ESMF_State) :: lnd2atm_a_state, atm2lnd_a_state + type (ESMF_Clock) :: clock + integer, intent(out) :: rc ! local variables - type(ESMF_Mesh) :: atmos_mesh - type(ESMF_DistGrid) :: atmos_distgrid + type(ESMF_Mesh) :: atm_mesh + type(ESMF_DistGrid) :: atm_distgrid type(ESMF_Field) :: field type(ESMF_FieldBundle) :: c2a_fb , a2c_fb - character(len=ESMF_MAXSTR) :: atmos_mesh_filepath - integer :: n, i, myid - integer :: mpierror, numprocs - integer :: petCount, localrc, urc - character(*),parameter :: F02 = "('[atmos_cap]',a,i5,2x,d26.19)" - character(len=*), parameter :: subname=trim(modname)//': [atmos_init] ' + integer :: n, i + character(len=*), parameter :: subname='(lilac_atmos_init): ' !------------------------------------------------------------------------- ! Initialize return code rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//"------------------------!", ESMF_LOGMSG_INFO) - call ESMF_GridCompGet (comp, petcount=petcount, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"------------------------!", ESMF_LOGMSG_INFO) !------------------------------------------------------------------------- - ! Read in the mesh + ! Read in the atm mesh !------------------------------------------------------------------------- - ! TODO: use ESMF VM calls - call MPI_Comm_size(MPI_COMM_WORLD, numprocs, mpierror) - call MPI_Comm_rank(MPI_COMM_WORLD, myid, mpierror) - - atmos_mesh_filepath = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + ! Note that in the call to lilac_atm the host atmospere sent both the gindex_atm and + ! the atm_mesh_filename that were then set as module variables in lilac_utils - atmos_distgrid = ESMF_DistGridCreate (arbSeqIndexList=gindex_atm, rc=rc) + atm_distgrid = ESMF_DistGridCreate (arbSeqIndexList=gindex_atm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - atmos_mesh = ESMF_MeshCreate(filename=trim(atmos_mesh_filepath), fileformat=ESMF_FILEFORMAT_ESMFMESH, & - elementDistGrid=atmos_distgrid, rc=rc) + atm_mesh = ESMF_MeshCreate(filename=trim(atm_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, & + elementDistGrid=atm_distgrid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//"Mesh for atmosphere is created!", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(trim(subname)//"Mesh for atmosphere is created for "//trim(atm_mesh_filename), ESMF_LOGMSG_INFO) if (mytask == 0) then - !print *, "!Mesh for atmosphere is created!" + print *, trim(subname) // "Mesh for atmosphere is created for "//trim(atm_mesh_filename) end if !------------------------------------------------------------------------- @@ -121,7 +109,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! create fields and add to field bundle do n = 1, size(atm2lnd) - field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & + field = ESMF_FieldCreate(atm_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & name=trim(atm2lnd(n)%fldname), farrayPtr=atm2lnd(n)%dataptr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_FieldBundleAdd(a2c_fb, (/field/), rc=rc) @@ -154,7 +142,7 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! create fields and add to field bundle do n = 1, size(lnd2atm) - field = ESMF_FieldCreate(atmos_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & + field = ESMF_FieldCreate(atm_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & name=trim(lnd2atm(n)%fldname), farrayPtr=lnd2atm(n)%dataptr, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) @@ -174,11 +162,11 @@ subroutine atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! Set Attributes needed by land call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) ! TODO: mv what in the world is this??? - end subroutine atmos_init + end subroutine lilac_atmos_init !======================================================================== - subroutine atmos_run(comp, importState, exportState, clock, rc) + subroutine lilac_atmos_run(comp, importState, exportState, clock, rc) ! input/output variables type(ESMF_GridComp) :: comp @@ -187,25 +175,29 @@ subroutine atmos_run(comp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - character(len=*), parameter :: subname=trim(modname)//': [atmos_run] ' + character(len=*), parameter :: subname='(lilac_atmos_run):' ! Initialize return code rc = ESMF_SUCCESS call ESMF_LogWrite(subname//"Should atmos_run ", ESMF_LOGMSG_INFO) - end subroutine atmos_run + end subroutine lilac_atmos_run !======================================================================== - subroutine atmos_final(comp, importState, exportState, clock, rc) + subroutine lilac_atmos_final(comp, importState, exportState, clock, rc) + + ! input/output variables type(ESMF_GridComp) :: comp type(ESMF_State) :: importState, exportState type(ESMF_Clock) :: clock integer, intent(out) :: rc - character(len=*), parameter :: subname=trim(modname)//': [atmos_final] ' - type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle + ! local variables + type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle + character(len=*), parameter :: subname='( lilac_atmos_final): ' + !------------------------------------------------------------------------- ! Initialize return code rc = ESMF_SUCCESS @@ -221,6 +213,6 @@ subroutine atmos_final(comp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"?? Are there any other thing for destroying in atmos_final??", ESMF_LOGMSG_INFO) - end subroutine atmos_final + end subroutine lilac_atmos_final end module lilac_atmcap diff --git a/lilac/lilac/lilac_cpl.F90 b/lilac/lilac/lilac_cpl.F90 index b88b4e361a..c28de3c7e3 100644 --- a/lilac/lilac/lilac_cpl.F90 +++ b/lilac/lilac/lilac_cpl.F90 @@ -8,9 +8,6 @@ module lilac_cpl use ESMF implicit none - - include 'mpif.h' !TODO: remove this and use ESMF - private public :: cpl_atm2lnd_register @@ -44,7 +41,6 @@ subroutine cpl_atm2lnd_register(cplcomp, rc) call ESMF_VMGet(vm, localPet=mytask, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - print *,'mytask= ',mytask if (mytask == 0) then print *, "in cpl_atm2lnd_register routine" end if diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 25a72c6287..84dbda6ef5 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -11,13 +11,8 @@ module lilac_mod public :: lilac_run ! Clock, TimeInterval, and Times - type(ESMF_Clock) :: clock - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - type(ESMF_Calendar),target :: calendar - integer :: yy,mm,dd,sec + type(ESMF_Clock) :: lilac_clock + type(ESMF_Calendar),target :: lilac_calendar ! Gridded Components and Coupling Components type(ESMF_GridComp) :: atm_gcomp @@ -34,38 +29,52 @@ module lilac_mod contains !======================================================================== - subroutine lilac_init(lsize) + subroutine lilac_init(atm_global_index, atm_mesh_filepath, atm_calendar, atm_timestep, & + atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & + atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) ! -------------------------------------------------------------------------------- ! This is called by the host atmosphere ! -------------------------------------------------------------------------------- - use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd + use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd, gindex_atm, atm_mesh_filename use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register - use lilac_atmcap , only : atmos_register + use lilac_atmcap , only : lilac_atmos_register use lnd_comp_esmf , only : lnd_register !ctsm routine use shr_pio_mod , only : shr_pio_init1 ! input/output variables - integer, intent(in) :: lsize + ! input/output variables + integer , intent(in) :: atm_global_index(:) + character(len=*) , intent(in) :: atm_mesh_filepath + character(len=*) , intent(in) :: atm_calendar + integer , intent(in) :: atm_timestep + integer , intent(in) :: atm_start_year !(yyyy) + integer , intent(in) :: atm_start_mon !(mm) + integer , intent(in) :: atm_start_day + integer , intent(in) :: atm_start_secs + integer , intent(in) :: atm_stop_year !(yyyy) + integer , intent(in) :: atm_stop_mon !(mm) + integer , intent(in) :: atm_stop_day + integer , intent(in) :: atm_stop_secs ! local variables + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Time) :: startTime + type(ESMF_Time) :: stopTime + type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest + integer :: yy,mm,dd,sec + integer :: lsize type(ESMF_State) :: importState, exportState type(ESMF_VM) :: vm integer :: rc character(len=ESMF_MAXSTR) :: cname !components or cpl names - integer :: COMP_COMM integer :: ierr integer :: mpic ! mpi communicator integer :: n, i integer :: fileunit integer, parameter :: debug = 1 !-- internal debug level character(len=*), parameter :: subname=trim(modname)//': [lilac_init] ' - - ! Namelist and related variables - integer :: s_month, s_day, s_hour, s_min - integer :: e_month, e_day, e_hour, e_min - namelist /input/ s_month, s_day, s_hour, s_min, e_month, e_day, e_hour, e_min !------------------------------------------------------------------------ ! Initialize return code @@ -94,47 +103,38 @@ subroutine lilac_init(lsize) call shr_pio_init1(ncomps=1, nlfilename="drv_in", Global_Comm=mpic) ! TODO: make the filename lilac_in - ! Initialize atm2lnd and lnd2atm data types - call lilac_init_atm2lnd(lsize) - call lilac_init_lnd2atm(lsize) - - !------------------------------------------------------------------------- - ! Read in configuration data -- namelist.input from host atmosphere(wrf) - !------------------------------------------------------------------------- - - ! Read in namelist file ... + ! Initialize lilac_util module variable gindex_atm + lsize = size(atm_global_index) + allocate(gindex_atm(lsize)) + gindex_atm(:) = atm_global_index(:) - if (mytask == 0) then - print *, "---------------------------------------" - end if + ! Initialize lilac_util module variable for atm mesh file + atm_mesh_filename = atm_mesh_filepath - ! TODO: put checks for error below - ! TODO: only the master lilac proc should read the namelist file and do a broadcast to the - ! other processors - open(newunit=fileunit, status="old", file="namelist_lilac", action="read", iostat=rc) - read(fileunit, input) - close(fileunit) + ! Initialize lilac_util module data atm2lnd and lnd2atm + call lilac_init_atm2lnd(lsize) + call lilac_init_lnd2atm(lsize) !------------------------------------------------------------------------- - ! Create Gridded Component! -- atmosphere ( atmos_cap) + ! Create Gridded Component -- lilac atmos_cap !------------------------------------------------------------------------- - cname = " Atmosphere or Atmosphere Cap" + cname = " LILAC atm cap " atm_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Atmosphere Gridded Component Created!" + print *, trim(subname) // "lilac atm cap gridded component created" end if !------------------------------------------------------------------------- - ! Create Gridded Component! --- CTSM land ( land_capX ) + ! Create Gridded Component -- CTSM land !------------------------------------------------------------------------- - cname = " Land ctsm " + cname = " CTSM " lnd_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, " Land (ctsm) Gridded Component Created!" + print *, trim(subname) // " ctsm gridded component created" end if !------------------------------------------------------------------------- @@ -145,7 +145,7 @@ subroutine lilac_init(lsize) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "1st Coupler Component (atmosphere to land ) Created!" + print *, trim(subname) // " coupler component (atmosphere to land) created" end if !------------------------------------------------------------------------- @@ -156,17 +156,17 @@ subroutine lilac_init(lsize) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "2nd Coupler Component (land to atmosphere) Created!" + print *, trim(subname) // " coupler component (land to atmosphere) created" end if !------------------------------------------------------------------------- ! Register section -- set services -- atmos_cap !------------------------------------------------------------------------- - call ESMF_GridCompSetServices(atm_gcomp, userRoutine=atmos_register, rc=rc) + call ESMF_GridCompSetServices(atm_gcomp, userRoutine=lilac_atmos_register, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//" atmos SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, " Atmosphere Gridded Component SetServices finished!" + print *, trim(subname) // " lilac atm cap setservices finished" end if !------------------------------------------------------------------------- @@ -176,7 +176,7 @@ subroutine lilac_init(lsize) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"land SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Land Gridded Component SetServices finished!" + print *, trim(subname) // " CTSM setservices finished" end if !------------------------------------------------------------------------- @@ -186,7 +186,7 @@ subroutine lilac_init(lsize) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"Coupler from atmosphere to land SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Coupler from atmosphere to land SetServices finished!" + print *, trim(subname) // " coupler from atmosphere to land setservices finished" end if !------------------------------------------------------------------------- @@ -196,40 +196,43 @@ subroutine lilac_init(lsize) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"Coupler from land to atmosphere SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Coupler from land to atmosphere SetServices finished!" + print *, trim(subname) // " coupler from land to atmosphere setservices finished" end if + + !------------------------------------------------------------------------- + ! Create and initialize the lilac_clock and calendar !------------------------------------------------------------------------- - ! Create and initialize a clock! - ! Clock is initialized here from namelist.input from WRF..... still we - ! are looping over time from host atmosphere - !------------------------------------------------------------------------- - calendar = ESMF_CalendarCreate(name='lilac_drv_NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) - call ESMF_TimeIntervalSet(TimeStep, s=2, rc=rc) ! time step every 2second - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - - !call ESMF_TimeSet(startTime, yy=2003, mm=s_month, dd=s_day, h=s_hour, m=s_min, s=0, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - !call ESMF_TimeSet(stopTime, yy=2003, mm=e_month, dd=e_day, h=e_hour, m=e_min, s=0, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - !clock = ESMF_ClockCreate(timeStep=timeStep, startTime=startTime, stopTime=stopTime, rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_TimeSet(StartTime, yy=2000, mm=1, dd=1 , s=0, calendar=Calendar, rc=rc) - call ESMF_TimeSet(StopTime , yy=2000, mm=03, dd=01, s=0, calendar=Calendar, rc=rc) - !call ESMF_TimeIntervalSet(TimeStep, s=3600, rc=rc) - call ESMF_TimeIntervalSet(TimeStep, s=1800, rc=rc) - clock = ESMF_ClockCreate(name='lilac_drv_EClock', TimeStep=TimeStep, startTime=StartTime, & - RefTime=StartTime, stopTime=stopTime, rc=rc) - if (mytask == 0) then - print *, "---------------------------------------" - end if - !call ESMF_ClockPrint (clock, rc=rc) - if (mytask == 0) then - print *, "=======================================" + if (trim(atm_calendar) == 'NOLEAP') then + lilac_calendar = ESMF_CalendarCreate(name='NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) + else if (trim(atm_calendar) == 'GREGORIAN') then + lilac_calendar = ESMF_CalendarCreate(name='NOLEAP', calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc ) + else + ! TODO: add supported calendars here end if - !call ESMF_CalendarPrint ( calendar , rc=rc) + + call ESMF_TimeIntervalSet(TimeStep, s=atm_timestep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_TimeSet(StartTime, yy=atm_start_year, mm=atm_start_mon, dd=atm_start_day , s=atm_start_secs, & + calendar=lilac_calendar, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_TimeSet(StopTime , yy=atm_stop_year , mm=atm_stop_mon , dd=atm_stop_day , s=atm_stop_secs , & + calendar=lilac_calendar, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + lilac_clock = ESMF_ClockCreate(name='lilac_clock', TimeStep=TimeStep, startTime=StartTime, & + RefTime=StartTime, stopTime=stopTime, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (mytask == 0) then - print *, "---------------------------------------" + print *, trim(subname) // "---------------------------------------" + call ESMF_ClockPrint (lilac_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_CalendarPrint (lilac_calendar , rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + print *, trim(subname) // "---------------------------------------" end if ! ------------------------------------------------------------------------- @@ -243,7 +246,7 @@ subroutine lilac_init(lsize) lnd2atm_a_state = ESMF_StateCreate(name='lnd_state_on_lnd_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_GridCompInitialize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) + call ESMF_GridCompInitialize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp initialized", ESMF_LOGMSG_INFO) @@ -260,7 +263,7 @@ subroutine lilac_init(lsize) lnd2atm_l_state = ESMF_StateCreate(name='lnd_state_on_atm_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_GridCompInitialize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) + call ESMF_GridCompInitialize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp initialized", ESMF_LOGMSG_INFO) @@ -270,18 +273,18 @@ subroutine lilac_init(lsize) ! Initialze LILAC coupler components ! ------------------------------------------------------------------------- - call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=clock, rc=rc) + call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "coupler :: cpl_atm2lnd_comp initialize finished" !, rc =", rc + print *, trim(subname) // "coupler :: cpl_atm2lnd_comp initialize finished" !, rc =", rc end if - call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=clock, rc=rc) + call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "coupler :: cpl_lnd2atm_comp initialize finished" !, rc =", rc + print *, trim(subname) // "coupler :: cpl_lnd2atm_comp initialize finished" !, rc =", rc end if end subroutine lilac_init @@ -310,22 +313,18 @@ subroutine lilac_run( ) ! Create a local clock from the general clock! !------------------------------------------------------------------------- - local_clock = ESMF_ClockCreate(clock, rc=rc) + local_clock = ESMF_ClockCreate(lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return if (mytask == 0) then print *, "Run Loop Start time" end if - !call ESMF_ClockPrint(local_clock, options="currtime string", rc=rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return !------------------------------------------------------------------------- ! We are running components in this order: ! 1- atmos_cap 2- cpl_atm2lnd! 3- lnd_cap 4- cpl_lnd2atm !------------------------------------------------------------------------- - ! if we want to loop through clock in atmos cap. - !do while (.NOT. ESMF_ClockIsStopTime(local_clock, rc=rc)) call ESMF_GridCompRun(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, & clock=local_clock, rc=rc, userRC=userRC) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return @@ -395,7 +394,7 @@ subroutine lilac_final( ) !------------------------------------------------------------------------- ! Gridded Component Finalizing! --- atmosphere !------------------------------------------------------------------------- - call ESMF_GridCompFinalize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=clock, rc=rc) + call ESMF_GridCompFinalize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -405,7 +404,7 @@ subroutine lilac_final( ) !------------------------------------------------------------------------- ! Coupler component Finalizing --- coupler atmos to land !------------------------------------------------------------------------- - call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=clock, rc=rc) + call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -415,7 +414,7 @@ subroutine lilac_final( ) !------------------------------------------------------------------------- ! Gridded Component Finalizing! --- land !------------------------------------------------------------------------- - call ESMF_GridCompFinalize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=clock, rc=rc) + call ESMF_GridCompFinalize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -425,7 +424,7 @@ subroutine lilac_final( ) !------------------------------------------------------------------------- ! Coupler component Finalizing --- coupler land to atmos !------------------------------------------------------------------------- - call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=clock, rc=rc) + call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index 7bce4b8f99..1012654080 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -9,11 +9,14 @@ module lilac_utils public :: lilac_atm2lnd public :: lilac_lnd2atm + ! the HOST ATMOSPHERE atm sends gindex_atm and atm_mesh_filename via the inputs to lilac_init + ! Global index space info for atm data - ! the HOST ATMOSPHERE is also responsible for filling in the gindex information - ! this is used to create the distgrid for the mesh in lilac *** integer, public, allocatable :: gindex_atm (:) + ! Mesh file to be read in by lilac_atm + character(len=256), public :: atm_mesh_filename + type :: atm2lnd_type character(len=128) :: fldname real*8, pointer :: dataptr(:) From a136950318dbb51ceac2942a5d049c8430067c0c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 27 Nov 2019 10:54:56 -0700 Subject: [PATCH 0427/1973] updates to caps including removal of commented code that will not be used --- src/cpl/lilac/for_negin | 19 - src/cpl/lilac/lnd_comp_esmf.F90 | 1934 +++++++++++++-------------- src/cpl/lilac/lnd_import_export.F90 | 787 ++--------- src/cpl/lilac/lnd_shr_methods.F90 | 581 +------- src/cpl/lilac/shr_utils_mod.F90 | 47 - 5 files changed, 1036 insertions(+), 2332 deletions(-) delete mode 100644 src/cpl/lilac/for_negin delete mode 100644 src/cpl/lilac/shr_utils_mod.F90 diff --git a/src/cpl/lilac/for_negin b/src/cpl/lilac/for_negin deleted file mode 100644 index c5986a0408..0000000000 --- a/src/cpl/lilac/for_negin +++ /dev/null @@ -1,19 +0,0 @@ - ! Initialize PIO - - integer, pointer :: comms(:), comps(:) - character(len=32), allocatable :: compLabels(:) - logical, allocatable :: comp_iamin(:) - integer, allocatable :: comp_comm_iam(:) - - allocate(comms(1), comps(1), compLabels(1), comp_iamin(1), comp_comm_iam(1)) - - comms(1) = Global_Comm - comps(1) = 1 - compLabels(1) = 'lnd' - comp_iamin(1) = .true. - - call ESMF_VMGet(vm, mpiCommunicator=comms(1), localPet=comp_comm_iam(1), rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - call shr_pio_init2(comps, compLabel, comp_iamin, comms, comp_comm_iam) - diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index ddf03eb6a8..87db539ad6 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -1,1102 +1,1030 @@ module lnd_comp_esmf - !---------------------------------------------------------------------------- - ! This is the ESMF cap for CTSM - !---------------------------------------------------------------------------- - use ESMF - use shr_kind_mod , only : shr_kind_r8, SHR_KIND_CL - use shr_string_mod , only : shr_string_listGetNum - use abortutils , only : endrun - use domainMod , only : ldomain - use decompMod , only : ldecomp, bounds_type, get_proc_bounds - use clm_varctl , only : iulog - !use clm_initializeMod , only : lnd2atm_inst, atm2lnd_inst - !use clm_cpl_indices - use lnd_import_export - - use ESMF - use mct_mod , only : mct_world_init, mct_world_clean, mct_die - use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl - use shr_sys_mod , only : shr_sys_abort - use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit - use shr_orb_mod , only : shr_orb_decl - use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date - use spmdMod , only : masterproc, mpicom, spmd_init - use decompMod , only : bounds_type, ldecomp, get_proc_bounds - use domainMod , only : ldomain - use controlMod , only : control_setNL - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use clm_varctl , only : single_column, clm_varctl_set, iulog - use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch - use clm_time_manager , only : set_timemgr_init, advance_timestep - use clm_time_manager , only : set_nextsw_cday, update_rad_dtime - use clm_time_manager , only : get_nstep, get_step_size - use clm_time_manager , only : get_curr_date, get_curr_calday - use clm_initializeMod , only : initialize1, initialize2 - use clm_driver , only : clm_drv - use perf_mod , only : t_startf, t_stopf, t_barrierf - use lnd_import_export , only : import_fields, export_fields - use lnd_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit - use lnd_shr_methods , only : log_clock_advance - !use lnd_import_export , only : realize_fields - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private ! By default make data private except - ! - public :: lnd_register ! register clm initial, run, final methods - public :: lnd_init ! clm initialization - public :: lnd_run ! clm run phase - public :: lnd_final ! clm finalization/cleanup - - !NS: from https://github.com/amangupta2/CAM_Trunk/blob/33b0fd4bc2c3b945b93655ee8b5e20f1acf5625b/components/cam/src/cpl/nuopc/atm_comp_nuopc.F90 - !-------------------------------------------------------------------------- - ! Private module data - !-------------------------------------------------------------------------- - - !type fld_list_type - ! character(len=128) :: stdname - !end type fld_list_type - - integer , parameter :: dbug_flag = 6 - type(ESMF_Field), public, save :: field - !type(cam_in_t) , pointer :: cam_in(:) - !type(cam_out_t) , pointer :: cam_out(:) - !integer , pointer :: dof(:) ! global index space decomposition - !integer :: shrlogunit ! original log unit - !integer :: shrloglev ! original log level - !character(len=256) :: rsfilename_spec_cam ! Filename specifier for restart surface file - !character(*) ,parameter :: modName = "ctsm_lilac" - !character(*) ,parameter :: u_FILE_u = & - ! __FILE__ - - - - character(len=CL) :: flds_scalar_name = '' - integer :: flds_scalar_num = 0 - integer :: flds_scalar_index_nx = 0 - integer :: flds_scalar_index_ny = 0 - integer :: flds_scalar_index_nextsw_cday = 0 - logical :: glc_present = .false. ! .true. => running with a non-stubGLC model - logical :: rof_prognostic = .false. ! .true. => running with a prognostic ROF model - integer, parameter :: dbug = 1 - !character(*),parameter :: modName = "(lnd_comp_nuopc)" - character(*) ,parameter :: modName = "ctsm_lilac" - character(*),parameter :: u_FILE_u = & + !---------------------------------------------------------------------------- + ! This is the ESMF cap for CTSM + !---------------------------------------------------------------------------- + + use ESMF + use mct_mod , only : mct_world_init, mct_world_clean, mct_die + use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl + use shr_sys_mod , only : shr_sys_abort + use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit + use shr_orb_mod , only : shr_orb_decl + use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date + use spmdMod , only : masterproc, mpicom, spmd_init + use decompMod , only : bounds_type, ldecomp, get_proc_bounds + use domainMod , only : ldomain + use controlMod , only : control_setNL + use clm_varorb , only : eccen, obliqr, lambm0, mvelpp + use clm_varctl , only : single_column, clm_varctl_set, iulog + use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_time_manager , only : set_timemgr_init, advance_timestep + use clm_time_manager , only : set_nextsw_cday, update_rad_dtime + use clm_time_manager , only : get_nstep, get_step_size + use clm_time_manager , only : get_curr_date, get_curr_calday + use clm_initializeMod , only : initialize1, initialize2 + use clm_driver , only : clm_drv + use perf_mod , only : t_startf, t_stopf, t_barrierf + use lnd_import_export , only : import_fields, export_fields + use lnd_shr_methods , only : chkerr, state_diagnose + + implicit none + private ! By default make data private except + + public :: lnd_register ! register clm initial, run, final methods + public :: lnd_init ! clm initialization + public :: lnd_run ! clm run phase + public :: lnd_final ! clm finalization/cleanup + + !-------------------------------------------------------------------------- + ! Private module data + !-------------------------------------------------------------------------- + + integer , parameter :: dbug_flag = 6 + type(ESMF_Field), public, save :: field + + logical :: glc_present = .false. ! .true. => running with a non-stubGLC model + logical :: rof_prognostic = .false. ! .true. => running with a prognostic ROF model + integer, parameter :: memdebug_level=1 + integer, parameter :: dbug = 1 + character(*) ,parameter :: modName = "lnd_comp_esmf" + character(*),parameter :: u_FILE_u = & __FILE__! - type(ESMF_Mesh) :: Emesh, EMeshTemp, lnd_mesh ! esmf meshes + type(ESMF_Mesh) :: Emesh, EMeshTemp, lnd_mesh ! esmf meshes + !=============================================================================== contains !=============================================================================== - subroutine lnd_register(comp, rc) - - ! Register the clm initial, run, and final phase methods with ESMF. - - ! input/output argumenents - type(ESMF_GridComp) :: comp ! CLM grid component - integer, intent(out) :: rc ! return status - - ! local variables - character(len=*), parameter :: subname=trim(modname)//': [lnd_register] ' - !----------------------------------------------------------------------- - - print *, "in lnd register routine" - rc = ESMF_SUCCESS - call ESMF_LogSet ( flush =.true.) - call ESMF_LogWrite(subname//"lnd gridcompset entry points setting ....!", ESMF_LOGMSG_INFO) - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, lnd_init, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, lnd_run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, lnd_final, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_LogWrite(subname//"lnd gridcompset entry points finished!", ESMF_LOGMSG_INFO) - end subroutine lnd_register - - !=============================================================================== - - subroutine lnd_init(comp, import_state, export_state, clock, rc) - - ! Initialize land surface model and obtain relevant atmospheric model arrays - ! back from (i.e. albedos, surface temperature and snow cover over land). - - use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel - use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel - use shr_file_mod , only : shr_file_getUnit, shr_file_setIO - use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday - !use clm_initializeMod, only : initialize1, initialize2, lnd2atm_inst, lnd2glc_inst - use clm_initializeMod, only : initialize1, initialize2 - use clm_varctl , only : finidat,single_column, clm_varctl_set, noland - - use clm_varctl , only : inst_index, inst_suffix, inst_name - use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use controlMod , only : control_setNL - use spmdMod , only : masterproc, spmd_init - !NS - use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst - use mpi, only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE - use shr_pio_mod, only : shr_pio_init1, shr_pio_init2 - use glc_elevclass_mod , only : glc_elevclass_init - use shr_orb_mod , only : shr_orb_params - ! input/output variables - type(ESMF_GridComp) :: comp ! CLM gridded component - type(ESMF_State) :: import_state ! CLM import state - type(ESMF_State) :: export_state ! CLM export state - type(ESMF_Clock) :: clock ! ESMF synchronization clock - integer, intent(out) :: rc ! Return code - - ! local variable - integer :: mpicom_lnd, mpicom_vm, gsize - type(ESMF_ArraySpec) :: arrayspec - type(ESMF_DistGrid) :: distgrid - type(ESMF_Array) :: dom, l2x, x2l - type(ESMF_VM) :: vm - integer :: lsize ! size of attribute vector - integer :: g,i,j ! indices - integer :: dtime_sync ! coupling time-step from the input synchronization clock - integer :: dtime_clm ! clm time-step - logical :: exists ! true if file exists - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - character(len=SHR_KIND_CL) :: caseid ! case identifier name - character(len=SHR_KIND_CL) :: ctitle ! case description title - character(len=SHR_KIND_CL) :: starttype ! start-type (startup, continue, branch, hybrid) - character(len=SHR_KIND_CL) :: calendar ! calendar type name - character(len=SHR_KIND_CL) :: hostname ! hostname of machine running on - character(len=SHR_KIND_CL) :: version ! Model version - character(len=SHR_KIND_CL) :: username ! user running the model - integer :: nsrest ! clm restart type - integer :: ref_ymd ! reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (sec) - integer :: start_ymd ! start date (YYYYMMDD) - integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type - logical :: atm_aero ! Flag if aerosol data sent from atm model - integer :: lbnum ! input to memory diagnostic - integer :: shrlogunit,shrloglev ! old values for log unit and log level - integer :: logunit ! original log unit - - type(bounds_type) :: bounds ! bounds - integer :: nfields - real(R8), pointer :: fptr(:, :) - character(ESMF_MAXSTR) :: convCIM, purpComp - integer :: ierr - - ! MCT - integer :: ncomps = 1 - integer, pointer :: comps(:) ! array with component ids - integer, pointer :: comms(:) ! array with mpicoms - character(len=32), allocatable :: compLabels(:) - integer,allocatable :: comp_id(:) ! for pio init2 - character(len=64),allocatable :: comp_name(:) ! for pio init2 - integer,allocatable :: comp_comm(:) ! for pio_init2 - logical,allocatable :: comp_iamin(:) ! for pio init2 - integer,allocatable :: comp_comm_iam(:) ! for pio_init2 - - ! - character(len=32), parameter :: sub = 'lnd_init' - character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" - - - integer :: ymd ! CTSM current date (YYYYMMDD) - integer :: orb_iyear_align ! associated with model year - integer :: orb_cyear ! orbital year for current orbital computation - integer :: orb_iyear ! orbital year for current orbital computation - integer :: orb_eccen ! orbital year for current orbital computation - integer :: yy, mm ,dd , curr_tod, curr_ymd ! orbital year for current orbital computation - - !----------------------------------------------------------------------- - ! NS : from - ! https://github.com/amangupta2/CAM_Trunk/blob/33b0fd4bc2c3b945b93655ee8b5e20f1acf5625b/components/cam/src/cpl/nuopc/atm_comp_nuopc.F90 - - !local variables - type(ESMF_Time) :: currTime ! Current time - type(ESMF_Time) :: startTime ! Start time - type(ESMF_Time) :: stopTime ! Stop time - type(ESMF_Time) :: refTime ! Ref time - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar - type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type - !type(ESMF_DistGrid) :: distGrid - !type(ESMF_Field) :: field - - - character(len=*), parameter :: subname=trim(modName)//': [lnd_init_lilac_cap] ' - - ! NS: From : - integer, pointer :: gindex(:) ! global index space for land and ocean points - integer, pointer :: gindex_lnd(:) ! global index space for just land points - integer, pointer :: gindex_ocn(:) ! global index space for just ocean points - character(ESMF_MAXSTR) :: cvalue ! config data - integer :: nlnd, nocn ! local size ofarrays - !integer :: g,n ! indices - integer :: n ! indices - integer :: year, month, day - - - integer :: dtime ! time step increment (sec) - - type(ESMF_FieldBundle) :: c2l_fb - type(ESMF_FieldBundle) :: l2c_fb - - - type(ESMF_State) :: importState, exportState - - - integer :: glc_nec = 10 ! number of glc elevation classes - !! FIXME(ns, 2019-07-29) - !! glc_nec should be set from driver or higher level lilac? - integer :: compid ! component id - !------------------------------------------------------------------------ - - rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//' is called!', ESMF_LOGMSG_INFO) - - !------------------------------------------------------------------------ - ! Initialize clm MPI communicator - !------------------------------------------------------------------------ - call ESMF_VMGetCurrent(vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - call ESMF_LogWrite(subname//"ESMF_VMGetCurrent", ESMF_LOGMSG_INFO) - call ESMF_VMPrint (vm, rc = rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - call ESMF_VMGet(vm, mpiCommunicator=mpicom_vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - call ESMF_LogWrite(subname//"ESMF_VMGet", ESMF_LOGMSG_INFO) - - ! duplicate the mpi communicator from the current VM - call MPI_Comm_dup(mpicom_vm, mpicom_lnd, rc) - call ESMF_LogWrite(subname//"MPI_Comm_dup...", ESMF_LOGMSG_INFO) - - !!!! NS : BOTH MPI_INIT and PIO_INIT1 are in lilac_mod.F90 - - - !------------------------------------------------------------------------ - ! Initialize mct - ! (needed for data models and cice prescribed capability) - ! (needed for data model share code - e.g. nitrogen deposition) - !------------------------------------------------------------------------ - ! TODO: FIX THIS PLEASE!!!! - - allocate(comms(1), comps(1), compLabels(1), comp_iamin(1), comp_comm_iam(1), comp_name(1),stat=ierr) - - comms(1) = mpicom_lnd !or call MPI_Comm_dup(mpicom_vm, comms(1), ierr) - comps(1) = 1 - compLabels(1) = 'LND' - comp_iamin(1) = .true. - comp_name(1) = 'LND' - - call ESMF_VMGet(vm, mpiCommunicator=comms(1), localPet=comp_comm_iam(1), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - call shr_pio_init2(comps, compLabels, comp_iamin, comms, comp_comm_iam) + subroutine lnd_register(comp, rc) - call ESMF_LogWrite(subname//"after shr_pio_init2", ESMF_LOGMSG_INFO) + ! Register the clm initial, run, and final phase methods with ESMF. - call ESMF_LogWrite(subname//"Now calling mct_world_init", ESMF_LOGMSG_INFO) - call mct_world_init(ncomps, mpicom_lnd, comms, comps) - call ESMF_LogWrite(subname//"mct world initialized! ", ESMF_LOGMSG_INFO) - - !deallocate(comms, comps, compLabels, comp_iamin, comp_comm_iam, comp_name) ??? - - ! Initialize model mpi info - compid = 1 - call spmd_init( mpicom_lnd, compid) - call ESMF_LogWrite(subname//"initialized model mpi info using spmd_init", ESMF_LOGMSG_INFO) - - !------------------------------------------------------------------------ - !--- Log File --- - !------------------------------------------------------------------------ - - inst_name = 'LND' - inst_index = 1 - inst_suffix = "" - - ! Initialize io log unit - !! TODO: Put this in a subroutine..... - call shr_file_getLogUnit (shrlogunit) - if (masterproc) then - inquire(file='lnd_modelio.nml'//trim(inst_suffix),exist=exists) - if (exists) then - iulog = shr_file_getUnit() - call shr_file_setIO('lnd_modelio.nml'//trim(inst_suffix),iulog) - end if - write(iulog,format) "CLM land model initialization" - else - iulog = shrlogunit - end if - - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (iulog) + ! input/output argumenents + type(ESMF_GridComp) :: comp ! CLM grid component + integer, intent(out) :: rc ! return status - !------------------------------------------------------------------------ - !--- Orbital Values --- - !------------------------------------------------------------------------ + ! local variables + character(len=*), parameter :: subname=trim(modname)//': [lnd_register] ' + !----------------------------------------------------------------------- + print *, "in lnd register routine" + rc = ESMF_SUCCESS + call ESMF_LogSet ( flush =.true.) + call ESMF_LogWrite(subname//"lnd gridcompset entry points setting ....!", ESMF_LOGMSG_INFO) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, lnd_init, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - ! TODO: orbital values should be provided by lilac - but for now lets use defaults - !! hard wire these these in and we can decide on maybe having a - !namelist/ + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, lnd_run, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !call shr_cal_date2ymd(ymd,year,month,day) - !orb_cyear = orb_iyear + (year - orb_iyear_align) - - orb_cyear = 2000 - call shr_orb_params(orb_cyear, eccen, obliqr, mvelpp, & - obliqr, lambm0, mvelpp, masterproc) - - ! for now hard-coding: - !nextsw_cday = 1.02083333333333 - !eccen = 1.670366039276560E-002 - !mvelpp = 4.93745779048816 - !lambm0 = -3.247249566152933E-0020 - !obliqr = 0.409101122579779 - - !if ((debug >1) .and. (masterproc)) then - if (masterproc) then - write(iulog,*) 'shr_obs_params is setting these:', eccen - write(iulog,*) 'eccen is : ', eccen - write(iulog,*) 'mvelpp is : ', mvelpp - - write(iulog,*) 'lambm0 is : ', lambm0 - write(iulog,*) 'obliqr is : ', obliqr - end if - - !---------------------- - ! Consistency check on namelist filename - !---------------------- - call control_setNL("lnd_in") - - !---------------------- - ! Get properties from clock - !---------------------- - - - call ESMF_ClockGet( clock, & - currTime=currTime, startTime=startTime, stopTime=stopTime, refTime=RefTime, & - timeStep=timeStep, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=curr_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,curr_ymd) - - call ESMF_TimeGet( startTime, yy=yy, mm=mm, dd=dd, s=start_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,start_ymd) - - call ESMF_TimeGet( stopTime, yy=yy, mm=mm, dd=dd, s=stop_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,stop_ymd) - - call ESMF_TimeGet( refTime, yy=yy, mm=mm, dd=dd, s=ref_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,ref_ymd) - - call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - if (esmf_caltype == ESMF_CALKIND_NOLEAP) then - calendar = shr_cal_noleap - else if (esmf_caltype == ESMF_CALKIND_GREGORIAN) then - calendar = shr_cal_gregorian - else - call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) - end if - - ! TODO: how do we set case_name and nsrest - should we hardwire for now? - caseid = 'test_lilac' - nsrest = nsrStartup - call ESMF_LogWrite(subname//"time manager Initialized....", ESMF_LOGMSG_INFO) - - !---------------------- - ! Initialize CTSM time manager - !---------------------- - - call set_timemgr_init( & - calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & - stop_tod_in=stop_tod) - call ESMF_LogWrite(subname//"time manager is set now!", ESMF_LOGMSG_INFO) - - !---------------------- - ! Read namelist, grid and surface data - !---------------------- - - ! set default values for run control variables - call clm_varctl_set(caseid_in=caseid, nsrest_in=nsrest) - call ESMF_LogWrite(subname//"default values for run control variables are set...", ESMF_LOGMSG_INFO) - - - - !---------------------- - ! Initialize glc_elevclass module - !---------------------- - call glc_elevclass_init(glc_nec) - - !---------------------- - ! Initialize1 - !---------------------- - - ! note that the memory for gindex_ocn will be allocated in the following call - call initialize1(gindex_ocn) - ! call initialize1() - - call ESMF_LogWrite(subname//"initialize1 done...", ESMF_LOGMSG_INFO) - - ! obtain global index array for just land points which includes mask=0 or ocean points - call get_proc_bounds( bounds ) - - !print ,* "bound is :", bounds - !print ,* "bounds%begg :", bounds%begg - !print ,* "bounds%endg : ", bounds%endg - nlnd = bounds%endg - bounds%begg + 1 - allocate(gindex_lnd(nlnd)) - !print ,* "nlnd is :", nlnd - do g = bounds%begg,bounds%endg - n = 1 + (g - bounds%begg) - gindex_lnd(n) = ldecomp%gdc2glo(g) - end do - - call ESMF_LogWrite(subname//"obtained global index", ESMF_LOGMSG_INFO) - - ! create a global index that includes both land and ocean points - nocn = size(gindex_ocn) - allocate(gindex(nlnd + nocn)) - do n = 1,nlnd+nocn - if (n <= nlnd) then - gindex(n) = gindex_lnd(n) - else - gindex(n) = gindex_ocn(n-nlnd) - end if - end do - - ! create distGrid from global index array - DistGrid = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - deallocate(gindex) - call ESMF_LogWrite(subname//"DistGrid created......", ESMF_LOGMSG_INFO) - - !-------------------------------- - ! generate the mesh on ctsm distribution - !-------------------------------- - - ! TODO: mesh file should come into clm as a namelist for lilac only - ! for now need to hardwire this in cvalue here - cvalue = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' ! this will need to be filled in to run - - EMeshTemp = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (masterproc) then - write(iulog,*)'mesh file for domain is ',trim(cvalue) - end if - - ! recreate the mesh using the above distGrid - EMesh = ESMF_MeshCreate(EMeshTemp, elementDistgrid=Distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_LogWrite(subname//" Create Mesh using distgrid ....", ESMF_LOGMSG_INFO) - lnd_mesh = EMesh - !-------------------------------- - ! Finish initializing ctsm - !-------------------------------- - call ESMF_LogWrite(subname//"before initialize2", ESMF_LOGMSG_INFO) - - call initialize2() - - call ESMF_LogWrite(subname//"initialize2 done...", ESMF_LOGMSG_INFO) - - !-------------------------------- - ! Check that ctsm internal dtime aligns with ctsm coupling interval - !-------------------------------- - call ESMF_LogWrite(subname//"cheking CTSM dtime and coupling intervals....", ESMF_LOGMSG_INFO) - - call ESMF_ClockGet( clock, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_TimeIntervalGet( timeStep, s=dtime_sync, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - dtime_clm = get_step_size() + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, lnd_final, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (masterproc) then - write(iulog,*)'dtime_sync= ',dtime_sync,' dtime_ctsm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) - end if - if (mod(dtime_sync,dtime_clm) /= 0) then - write(iulog,*)'ctsm dtime ',dtime_clm,' and clock dtime ',dtime_sync,' never align' - rc = ESMF_FAILURE - return - end if + call ESMF_LogWrite(subname//"lnd gridcompset entry points finished!", ESMF_LOGMSG_INFO) + end subroutine lnd_register - !-------------------------------- - ! Create import state (only assume input from atm - not rof and glc) - !-------------------------------- - - c2l_fb = ESMF_FieldBundleCreate ( name='c2l_fb', rc=rc) - - - call fldbundle_add( 'Sa_z' , c2l_fb,rc) !1 - call fldbundle_add( 'Sa_topo' , c2l_fb,rc) !2 - call fldbundle_add( 'Sa_u' , c2l_fb,rc) !3 - call fldbundle_add( 'Sa_v' , c2l_fb,rc) !4 - call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) !5 - call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) !6 - call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) !7 - call fldbundle_add( 'Sa_shum' , c2l_fb,rc) !8 - - call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) !9 - call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) !10 - call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) !11 - call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) !12 - call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) !13 - call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) !14 - call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) !15 - call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) !16 - call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) !17 - call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/), rc=rc) - - ! Create export state + !=============================================================================== - l2c_fb = ESMF_FieldBundleCreate(name='l2c_fb', rc=rc) - !call fldbundle_add( 'Sl_lfrint' , l2c_fb,rc) !1 - call fldbundle_add( 'Sl_lfrin' , l2c_fb,rc) !1 - call fldbundle_add( 'Sl_t' , l2c_fb,rc) !2 - call fldbundle_add( 'Sl_tref' , l2c_fb,rc) !3 - call fldbundle_add( 'Sl_qref' , l2c_fb,rc) !4 - call fldbundle_add( 'Sl_avsdr' , l2c_fb,rc) !5 - call fldbundle_add( 'Sl_anidr' , l2c_fb,rc) !6 - call fldbundle_add( 'Sl_avsdf' , l2c_fb,rc) !7 - call fldbundle_add( 'Sl_anidf' , l2c_fb,rc) !8 - call fldbundle_add( 'Sl_snowh' , l2c_fb,rc) !9 - call fldbundle_add( 'Fall_u10' , l2c_fb,rc) !10 - call fldbundle_add( 'Fall_fv' , l2c_fb,rc) !11 - call fldbundle_add( 'Fall_ram1' , l2c_fb,rc) !12 - !call fldbundle_add( 'Fall_taux' , l2c_fb,rc) !10 - !call fldbundle_add( 'Fall_lwup' , l2c_fb,rc) !14 - !call fldbundle_add( 'Fall_evap' , l2c_fb,rc) !15 - !call fldbundle_add( 'Fall_swniet' , l2c_fb,rc) !16 - call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb/), rc=rc) - !call ESMF_StateAdd(exportState, fieldbundleList = (/l2c_fb/), rc=rc) + subroutine lnd_init(comp, import_state, export_state, clock, rc) + ! Initialize land surface model and obtain relevant atmospheric model arrays + ! back from (i.e. albedos, surface temperature and snow cover over land). + use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel + use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel + use shr_file_mod , only : shr_file_getUnit, shr_file_setIO + use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday + use clm_initializeMod , only : initialize1, initialize2 + use clm_varctl , only : finidat,single_column, clm_varctl_set, noland + use clm_varctl , only : inst_index, inst_suffix, inst_name + use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_varorb , only : eccen, obliqr, lambm0, mvelpp + use controlMod , only : control_setNL + use spmdMod , only : masterproc, spmd_init + use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst + use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE + use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 + use glc_elevclass_mod , only : glc_elevclass_init + use shr_orb_mod , only : shr_orb_params + + ! input/output variables + type(ESMF_GridComp) :: comp ! CLM gridded component + type(ESMF_State) :: import_state ! CLM import state + type(ESMF_State) :: export_state ! CLM export state + type(ESMF_Clock) :: clock ! ESMF synchronization clock + integer, intent(out) :: rc ! Return code + + ! local variable + integer :: mpicom_lnd, mpicom_vm, gsize + type(ESMF_ArraySpec) :: arrayspec + type(ESMF_DistGrid) :: distgrid + type(ESMF_Array) :: dom, l2x, x2l + type(ESMF_VM) :: vm + integer :: lsize ! size of attribute vector + integer :: g,i,j ! indices + integer :: dtime_sync ! coupling time-step from the input synchronization clock + integer :: dtime_clm ! clm time-step + logical :: exists ! true if file exists + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + character(len=CL) :: caseid ! case identifier name + character(len=CL) :: ctitle ! case description title + character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) + character(len=CL) :: calendar ! calendar type name + character(len=CL) :: hostname ! hostname of machine running on + character(len=CL) :: version ! Model version + character(len=CL) :: username ! user running the model + integer :: nsrest ! clm restart type + integer :: ref_ymd ! reference date (YYYYMMDD) + integer :: ref_tod ! reference time of day (sec) + integer :: start_ymd ! start date (YYYYMMDD) + integer :: start_tod ! start time of day (sec) + integer :: stop_ymd ! stop date (YYYYMMDD) + integer :: stop_tod ! stop time of day (sec) + logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type + logical :: atm_aero ! Flag if aerosol data sent from atm model + integer :: lbnum ! input to memory diagnostic + integer :: shrlogunit,shrloglev ! old values for log unit and log level + integer :: logunit ! original log unit + type(bounds_type) :: bounds ! bounds + integer :: nfields + real(R8), pointer :: fptr(:, :) + integer :: ierr + integer :: ncomps = 1 + integer, pointer :: comps(:) ! array with component ids + integer, pointer :: comms(:) ! array with mpicoms + character(len=32), allocatable :: compLabels(:) + integer,allocatable :: comp_id(:) ! for pio init2 + character(len=64),allocatable :: comp_name(:) ! for pio init2 + integer,allocatable :: comp_comm(:) ! for pio_init2 + logical,allocatable :: comp_iamin(:) ! for pio init2 + integer,allocatable :: comp_comm_iam(:) ! for pio_init2 + integer :: ymd ! CTSM current date (YYYYMMDD) + integer :: orb_iyear_align ! associated with model year + integer :: orb_cyear ! orbital year for current orbital computation + integer :: orb_iyear ! orbital year for current orbital computation + integer :: orb_eccen ! orbital year for current orbital computation + integer :: yy, mm ,dd , curr_tod, curr_ymd ! orbital year for current orbital computation + type(ESMF_Time) :: currTime ! Current time + type(ESMF_Time) :: startTime ! Start time + type(ESMF_Time) :: stopTime ! Stop time + type(ESMF_Time) :: refTime ! Ref time + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Calendar) :: esmf_calendar ! esmf calendar + type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type + integer, pointer :: gindex(:) ! global index space for land and ocean points + integer, pointer :: gindex_lnd(:) ! global index space for just land points + integer, pointer :: gindex_ocn(:) ! global index space for just ocean points + character(ESMF_MAXSTR) :: cvalue ! config data + integer :: nlnd, nocn ! local size ofarrays + integer :: n ! indices + integer :: year, month, day + integer :: dtime ! time step increment (sec) + type(ESMF_FieldBundle) :: c2l_fb + type(ESMF_FieldBundle) :: l2c_fb + type(ESMF_State) :: importState, exportState + integer :: glc_nec = 10 ! number of glc elevation classes + integer :: compid ! component id + character(len=32), parameter :: sub = 'lnd_init' + character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" + character(len=*), parameter :: subname=trim(modName)//': [lnd_init_lilac_cap] ' + !------------------------------------------------------------------------ + + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//' is called!', ESMF_LOGMSG_INFO) + + !------------------------------------------------------------------------ + ! Initialize clm MPI communicator + !------------------------------------------------------------------------ + call ESMF_VMGetCurrent(vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + call ESMF_LogWrite(subname//"ESMF_VMGetCurrent", ESMF_LOGMSG_INFO) + call ESMF_VMPrint (vm, rc = rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + call ESMF_VMGet(vm, mpiCommunicator=mpicom_vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + call ESMF_LogWrite(subname//"ESMF_VMGet", ESMF_LOGMSG_INFO) + + ! duplicate the mpi communicator from the current VM + call MPI_Comm_dup(mpicom_vm, mpicom_lnd, rc) + call ESMF_LogWrite(subname//"MPI_Comm_dup...", ESMF_LOGMSG_INFO) + +!!!! NS : BOTH MPI_INIT and PIO_INIT1 are in lilac_mod.F90 + + + !------------------------------------------------------------------------ + ! Initialize mct + ! (needed for data models and cice prescribed capability) + ! (needed for data model share code - e.g. nitrogen deposition) + !------------------------------------------------------------------------ + ! TODO: FIX THIS PLEASE!!!! + + allocate(comms(1), comps(1), compLabels(1), comp_iamin(1), comp_comm_iam(1), comp_name(1),stat=ierr) + + comms(1) = mpicom_lnd !or call MPI_Comm_dup(mpicom_vm, comms(1), ierr) + comps(1) = 1 + compLabels(1) = 'LND' + comp_iamin(1) = .true. + comp_name(1) = 'LND' + + call ESMF_VMGet(vm, mpiCommunicator=comms(1), localPet=comp_comm_iam(1), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + + call shr_pio_init2(comps, compLabels, comp_iamin, comms, comp_comm_iam) + + call ESMF_LogWrite(subname//"after shr_pio_init2", ESMF_LOGMSG_INFO) + + call ESMF_LogWrite(subname//"Now calling mct_world_init", ESMF_LOGMSG_INFO) + call mct_world_init(ncomps, mpicom_lnd, comms, comps) + call ESMF_LogWrite(subname//"mct world initialized! ", ESMF_LOGMSG_INFO) + + !deallocate(comms, comps, compLabels, comp_iamin, comp_comm_iam, comp_name) ??? + + ! Initialize model mpi info + compid = 1 + call spmd_init( mpicom_lnd, compid) + call ESMF_LogWrite(subname//"initialized model mpi info using spmd_init", ESMF_LOGMSG_INFO) + + !------------------------------------------------------------------------ + !--- Log File --- + !------------------------------------------------------------------------ + + inst_name = 'LND' + inst_index = 1 + inst_suffix = "" + + ! Initialize io log unit + !! TODO: Put this in a subroutine..... + call shr_file_getLogUnit (shrlogunit) + if (masterproc) then + inquire(file='lnd_modelio.nml'//trim(inst_suffix),exist=exists) + if (exists) then + iulog = shr_file_getUnit() + call shr_file_setIO('lnd_modelio.nml'//trim(inst_suffix),iulog) + end if + write(iulog,format) "CLM land model initialization" + else + iulog = shrlogunit + end if + + call shr_file_getLogLevel(shrloglev) + call shr_file_setLogUnit (iulog) + + !------------------------------------------------------------------------ + !--- Orbital Values --- + !------------------------------------------------------------------------ + + + ! TODO: orbital values should be provided by lilac - but for now lets use defaults + !! hard wire these these in and we can decide on maybe having a + !namelist/ + + !call shr_cal_date2ymd(ymd,year,month,day) + !orb_cyear = orb_iyear + (year - orb_iyear_align) + + orb_cyear = 2000 + call shr_orb_params(orb_cyear, eccen, obliqr, mvelpp, & + obliqr, lambm0, mvelpp, masterproc) + ! for now hard-coding: + !nextsw_cday = 1.02083333333333 + !eccen = 1.670366039276560E-002 + !mvelpp = 4.93745779048816 + !lambm0 = -3.247249566152933E-0020 + !obliqr = 0.409101122579779 + + !if ((debug >1) .and. (masterproc)) then + if (masterproc) then + write(iulog,*) 'shr_obs_params is setting these:', eccen + write(iulog,*) 'eccen is : ', eccen + write(iulog,*) 'mvelpp is : ', mvelpp + + write(iulog,*) 'lambm0 is : ', lambm0 + write(iulog,*) 'obliqr is : ', obliqr + end if + + !---------------------- + ! Consistency check on namelist filename + !---------------------- + call control_setNL("lnd_in") + + !---------------------- + ! Get properties from clock + !---------------------- + + + call ESMF_ClockGet( clock, & + currTime=currTime, startTime=startTime, stopTime=stopTime, refTime=RefTime, & + timeStep=timeStep, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=curr_tod, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,curr_ymd) + + call ESMF_TimeGet( startTime, yy=yy, mm=mm, dd=dd, s=start_tod, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,start_ymd) + + call ESMF_TimeGet( stopTime, yy=yy, mm=mm, dd=dd, s=stop_tod, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,stop_ymd) + + call ESMF_TimeGet( refTime, yy=yy, mm=mm, dd=dd, s=ref_tod, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,ref_ymd) + + call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (esmf_caltype == ESMF_CALKIND_NOLEAP) then + calendar = shr_cal_noleap + else if (esmf_caltype == ESMF_CALKIND_GREGORIAN) then + calendar = shr_cal_gregorian + else + call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) + end if + + ! TODO: how do we set case_name and nsrest - should we hardwire for now? + caseid = 'test_lilac' + nsrest = nsrStartup + call ESMF_LogWrite(subname//"time manager Initialized....", ESMF_LOGMSG_INFO) + + !---------------------- + ! Initialize CTSM time manager + !---------------------- + + call set_timemgr_init( & + calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & + ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & + stop_tod_in=stop_tod) + call ESMF_LogWrite(subname//"time manager is set now!", ESMF_LOGMSG_INFO) + + !---------------------- + ! Read namelist, grid and surface data + !---------------------- + + ! set default values for run control variables + call clm_varctl_set(caseid_in=caseid, nsrest_in=nsrest) + call ESMF_LogWrite(subname//"default values for run control variables are set...", ESMF_LOGMSG_INFO) + + + + !---------------------- + ! Initialize glc_elevclass module + !---------------------- + call glc_elevclass_init(glc_nec) + + !---------------------- + ! Initialize1 + !---------------------- + + ! note that the memory for gindex_ocn will be allocated in the following call + call initialize1(gindex_ocn) + ! call initialize1() + + call ESMF_LogWrite(subname//"initialize1 done...", ESMF_LOGMSG_INFO) + + ! obtain global index array for just land points which includes mask=0 or ocean points + call get_proc_bounds( bounds ) + + !print ,* "bound is :", bounds + !print ,* "bounds%begg :", bounds%begg + !print ,* "bounds%endg : ", bounds%endg + nlnd = bounds%endg - bounds%begg + 1 + allocate(gindex_lnd(nlnd)) + !print ,* "nlnd is :", nlnd + do g = bounds%begg,bounds%endg + n = 1 + (g - bounds%begg) + gindex_lnd(n) = ldecomp%gdc2glo(g) + end do + + call ESMF_LogWrite(subname//"obtained global index", ESMF_LOGMSG_INFO) + + ! create a global index that includes both land and ocean points + nocn = size(gindex_ocn) + allocate(gindex(nlnd + nocn)) + do n = 1,nlnd+nocn + if (n <= nlnd) then + gindex(n) = gindex_lnd(n) + else + gindex(n) = gindex_ocn(n-nlnd) + end if + end do + + ! create distGrid from global index array + DistGrid = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + deallocate(gindex) + call ESMF_LogWrite(subname//"DistGrid created......", ESMF_LOGMSG_INFO) + + !-------------------------------- + ! generate the mesh on ctsm distribution + !-------------------------------- + + ! TODO: mesh file should come into clm as a namelist for lilac only + ! for now need to hardwire this in cvalue here + cvalue = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' ! this will need to be filled in to run + + EMeshTemp = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (masterproc) then + write(iulog,*)'mesh file for domain is ',trim(cvalue) + end if + + ! recreate the mesh using the above distGrid + EMesh = ESMF_MeshCreate(EMeshTemp, elementDistgrid=Distgrid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + call ESMF_LogWrite(subname//" Create Mesh using distgrid ....", ESMF_LOGMSG_INFO) + lnd_mesh = EMesh + !-------------------------------- + ! Finish initializing ctsm + !-------------------------------- + call ESMF_LogWrite(subname//"before initialize2", ESMF_LOGMSG_INFO) + + call initialize2() + + call ESMF_LogWrite(subname//"initialize2 done...", ESMF_LOGMSG_INFO) + + !-------------------------------- + ! Check that ctsm internal dtime aligns with ctsm coupling interval + !-------------------------------- + call ESMF_LogWrite(subname//"cheking CTSM dtime and coupling intervals....", ESMF_LOGMSG_INFO) + + call ESMF_ClockGet( clock, timeStep=timeStep, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + call ESMF_TimeIntervalGet( timeStep, s=dtime_sync, rc=rc ) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + + dtime_clm = get_step_size() + if (masterproc) then + write(iulog,*)'dtime_sync= ',dtime_sync,' dtime_ctsm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) + end if + if (mod(dtime_sync,dtime_clm) /= 0) then + write(iulog,*)'ctsm dtime ',dtime_clm,' and clock dtime ',dtime_sync,' never align' + rc = ESMF_FAILURE + return + end if + !-------------------------------- + ! Create import state (only assume input from atm - not rof and glc) + !-------------------------------- + + c2l_fb = ESMF_FieldBundleCreate ( name='c2l_fb', rc=rc) + + + call fldbundle_add( 'Sa_z' , c2l_fb,rc) !1 + call fldbundle_add( 'Sa_topo' , c2l_fb,rc) !2 + call fldbundle_add( 'Sa_u' , c2l_fb,rc) !3 + call fldbundle_add( 'Sa_v' , c2l_fb,rc) !4 + call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) !5 + call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) !6 + call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) !7 + call fldbundle_add( 'Sa_shum' , c2l_fb,rc) !8 + + call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) !9 + call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) !10 + call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) !11 + call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) !12 + call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) !13 + call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) !14 + call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) !15 + call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) !16 + call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) !17 + call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/), rc=rc) + ! Create export state + l2c_fb = ESMF_FieldBundleCreate(name='l2c_fb', rc=rc) + !call fldbundle_add( 'Sl_lfrint' , l2c_fb,rc) !1 + call fldbundle_add( 'Sl_lfrin' , l2c_fb,rc) !1 + call fldbundle_add( 'Sl_t' , l2c_fb,rc) !2 + call fldbundle_add( 'Sl_tref' , l2c_fb,rc) !3 + call fldbundle_add( 'Sl_qref' , l2c_fb,rc) !4 + call fldbundle_add( 'Sl_avsdr' , l2c_fb,rc) !5 + call fldbundle_add( 'Sl_anidr' , l2c_fb,rc) !6 + call fldbundle_add( 'Sl_avsdf' , l2c_fb,rc) !7 + call fldbundle_add( 'Sl_anidf' , l2c_fb,rc) !8 + call fldbundle_add( 'Sl_snowh' , l2c_fb,rc) !9 + call fldbundle_add( 'Fall_u10' , l2c_fb,rc) !10 + call fldbundle_add( 'Fall_fv' , l2c_fb,rc) !11 + call fldbundle_add( 'Fall_ram1' , l2c_fb,rc) !12 + !call fldbundle_add( 'Fall_taux' , l2c_fb,rc) !10 + !call fldbundle_add( 'Fall_lwup' , l2c_fb,rc) !14 + !call fldbundle_add( 'Fall_evap' , l2c_fb,rc) !15 + !call fldbundle_add( 'Fall_swniet' , l2c_fb,rc) !16 + call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb/), rc=rc) + !call ESMF_StateAdd(exportState, fieldbundleList = (/l2c_fb/), rc=rc) - !-------------------------------- - ! Create land export state - !-------------------------------- - call ESMF_LogWrite(subname//"Creating land export state", ESMF_LOGMSG_INFO) - ! FIXME (NS, 2019-07-30) - ! FIX THIS EXPORT STATES!!!!!! MAYBE REWRITE WITH THE ORIGINAL STRUCTURE - ! IN MIND - ! Fill in export state at end of initialization - call export_fields(comp, bounds, glc_present, rof_prognostic, & - water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(subname//"Getting Calendar Day of nextsw calculation...", ESMF_LOGMSG_INFO) - ! Get calendar day of next sw (shortwave) calculation (nextsw_cday) - if (nsrest == nsrStartup) then - call ESMF_ClockGet( clock, currTime=currTime, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_TimeGet( currTime, dayOfYear_r8=nextsw_cday, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end if - ! Set nextsw_cday - call set_nextsw_cday( nextsw_cday ) + !-------------------------------- + ! Create land export state + !-------------------------------- + call ESMF_LogWrite(subname//"Creating land export state", ESMF_LOGMSG_INFO) - if (masterproc) then - write(iulog,*) 'TimeGet ... nextsw_cday is : ', nextsw_cday - end if + ! FIXME (NS, 2019-07-30) + ! FIX THIS EXPORT STATES!!!!!! MAYBE REWRITE WITH THE ORIGINAL STRUCTURE + ! IN MIND - ! Set Attributes - call ESMF_LogWrite(subname//"setting attribute!", ESMF_LOGMSG_INFO) + ! Fill in export state at end of initialization + call export_fields(comp, bounds, glc_present, rof_prognostic, & + water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_AttributeSet(export_state, name="lnd_nx", value=ldomain%ni, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - call ESMF_LogWrite(subname//"setting attribute! lnd_nx", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"Getting Calendar Day of nextsw calculation...", ESMF_LOGMSG_INFO) - call ESMF_AttributeSet(export_state, name="lnd_ny", value=ldomain%nj, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - call ESMF_LogWrite(subname//"setting attribute-lnd_ny!", ESMF_LOGMSG_INFO) + ! Get calendar day of next sw (shortwave) calculation (nextsw_cday) + if (nsrest == nsrStartup) then + call ESMF_ClockGet( clock, currTime=currTime, rc=rc ) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_LogWrite(subname//"State_SetScalar....!", ESMF_LOGMSG_INFO) - !Set scalars in export state - !call State_SetScalar(dble(ldomain%ni), flds_scalar_index_nx, export_state, & - ! flds_scalar_name, flds_scalar_num, rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet( currTime, dayOfYear_r8=nextsw_cday, rc=rc ) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + end if - !call State_SetScalar(dble(ldomain%nj), flds_scalar_index_ny, exportState, & - ! flds_scalar_name, flds_scalar_num, rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Set nextsw_cday + call set_nextsw_cday( nextsw_cday ) - !-------------------------------- - ! diagnostics - !-------------------------------- + if (masterproc) then + write(iulog,*) 'TimeGet ... nextsw_cday is : ', nextsw_cday + end if - if (dbug > 1) then - call State_diagnose(export_state, subname//':ExportState',rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - endif + ! Set Attributes + call ESMF_LogWrite(subname//"setting attribute!", ESMF_LOGMSG_INFO) + call ESMF_AttributeSet(export_state, name="lnd_nx", value=ldomain%ni, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"setting attribute! lnd_nx", ESMF_LOGMSG_INFO) + call ESMF_AttributeSet(export_state, name="lnd_ny", value=ldomain%nj, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"setting attribute-lnd_ny!", ESMF_LOGMSG_INFO) - ! Reset shr logging to original values + !-------------------------------- + ! diagnostics + !-------------------------------- - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) + if (dbug > 1) then + call State_diagnose(export_state, subname//':ExportState',rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif -#ifdef USE_ESMF_METADATA - convCIM = "CIM" - purpComp = "Model Component Simulation Description" - call ESMF_AttributeAdd(comp, convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "ShortName", "CTSM", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "LongName", "Community Land Model", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "Description", "Community Land Model", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "ReleaseDate", "2017", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "ModelType", "Terrestrial", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "Name", "TBD", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "EmailAddress", TBD, convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "ResponsiblePartyRole", "contact", convention=convCIM, purpose=purpComp, rc=rc) - ! adding this nextsw_cday - call ESMF_AttributeSet(comp, "nextsw_cday", nextsw_cday, convention=convCIM, purpose=purpComp, rc=rc) -#endif + ! Reset shr logging to original values + call shr_file_setLogUnit (shrlogunit) + call shr_file_setLogLevel(shrloglev) #if (defined _MEMTRACE) - if(masterproc) then - write(iulog,*) TRIM(Sub) // ':end::' - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_int:end::',lbnum) - call memmon_reset_addr() - endif + if(masterproc) then + write(iulog,*) TRIM(Sub) // ':end::' + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_int:end::',lbnum) + call memmon_reset_addr() + endif #endif call ESMF_LogWrite(subname//' CTSM INITIALIZATION DONE SUCCESSFULLY!!!! ', ESMF_LOGMSG_INFO) end subroutine lnd_init - !--------------------------------------------------------------------------- - - !subroutine fldbundle_add(stdname, fldptr, fieldbundle,rc) - subroutine fldbundle_add(stdname, fieldbundle,rc) - type(ESMF_Field) :: field - !type(ESMF_Mesh) :: lnd_mesh - character(len=*), intent(in) :: stdname - type (ESMF_FieldBundle) :: fieldbundle - integer, intent(out) :: rc - - print *, "in lnd register routine" - - rc = ESMF_SUCCESS - - !field = ESMF_FieldCreate(lnd_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(stdname), rc=rc) - field = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(stdname), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end subroutine fldbundle_add - - !--------------------------------------------------------------------------- - subroutine lnd_run(gcomp, import_state, export_state, clock, rc) - - !------------------------ - ! Run CTSM - !------------------------ - - use clm_instMod , only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst - use lnd_import_export , only : import_fields, export_fields - use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst - - ! input/output variables - type(ESMF_GridComp) :: gcomp ! CLM gridded component - type(ESMF_State) :: import_state ! CLM import state - type(ESMF_State) :: export_state ! CLM export state - type(ESMF_Clock) :: clock ! ESMF synchronization clock - integer, intent(out) :: rc ! Return code - - ! local variables: - type(ESMF_Alarm) :: alarm - type(ESMF_Time) :: currTime - type(ESMF_Time) :: nextTime - type(ESMF_State) :: importState, exportState - character(ESMF_MAXSTR) :: cvalue - character(ESMF_MAXSTR) :: case_name ! case name - integer :: ymd ! CTSM current date (YYYYMMDD) - integer :: yr ! CTSM current year - integer :: mon ! CTSM current month - integer :: day ! CTSM current day - integer :: tod ! CTSM current time of day (sec) - integer :: ymd_sync ! Sync date (YYYYMMDD) - integer :: yr_sync ! Sync current year - integer :: mon_sync ! Sync current month - integer :: day_sync ! Sync current day - integer :: tod_sync ! Sync current time of day (sec) - integer :: dtime ! time step increment (sec) - integer :: nstep ! time step index - logical :: rstwr ! .true. ==> write restart file before returning - logical :: nlend ! .true. ==> last time-step - logical :: dosend ! true => send data back to driver - logical :: doalb ! .true. ==> do albedo calculation on this time step - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - real(r8) :: caldayp1 ! ctsm calday plus dtime offset - integer :: lbnum ! input to memory diagnostic - integer :: g,i ! counters - real(r8) :: calday ! calendar day for nstep - real(r8) :: declin ! solar declination angle in radians for nstep - real(r8) :: declinp1 ! solar declination angle in radians for nstep+1 - real(r8) :: eccf ! earth orbit eccentricity factor - type(bounds_type) :: bounds ! bounds - character(len=32) :: rdate ! date char string for restart file names - integer :: shrlogunit ! original log unit - character(len=*),parameter :: subname=trim(modName)//':[lnd_run] ' - - character(*),parameter :: F02 = "('[lnd_comp_esmf] ',a, d26.19)" - !------------------------------------------------------------------------------- - - - - rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - - call shr_file_getLogUnit (shrlogunit) - call shr_file_setLogUnit (iulog) - call ESMF_LogWrite(subname//' shr_file_getLogunits....', ESMF_LOGMSG_INFO) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_comp_nuopc_ModelAdvance:start::',lbnum) - endif -#endif - - !-------------------------------- - ! Determine time of next atmospheric shortwave calculation - !-------------------------------- - - - !call ESMF_AttributeGet(export_state, name="nextsw_cday", value=nextsw_cday, rc=rc) - !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - - !call set_nextsw_cday( nextsw_cday ) - - call State_GetScalar(import_state, & - flds_scalar_index_nextsw_cday, nextsw_cday, & - flds_scalar_name, flds_scalar_num, rc) - call set_nextsw_cday( nextsw_cday ) - - - if (masterproc) then - write(iulog,*) 'State_GetScalar ... nextsw_cday is : ', nextsw_cday - end if - - ! in nuopc it is like this...... - !call State_GetScalar(import_state, & - ! flds_scalar_index_nextsw_cday, nextsw_cday, & - ! flds_scalar_name, flds_scalar_num, rc) - !call ESMF_LogWrite(subname//'after state_getscalar for determining nextsw_cday', ESMF_LOGMSG_INFO) - !call set_nextsw_cday( nextsw_cday ) - !call ESMF_LogWrite(subname//'settitng nextsw_cday', ESMF_LOGMSG_INFO) - + !--------------------------------------------------------------------------- - !---------------------- - ! Obtain orbital values - !---------------------- + !subroutine fldbundle_add(stdname, fldptr, fieldbundle,rc) + subroutine fldbundle_add(stdname, fieldbundle,rc) + type(ESMF_Field) :: field + !type(ESMF_Mesh) :: lnd_mesh + character(len=*), intent(in) :: stdname + type (ESMF_FieldBundle) :: fieldbundle + integer, intent(out) :: rc - !call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !read(cvalue,*) eccen + print *, "in lnd register routine" - !call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !read(cvalue,*) obliqr + rc = ESMF_SUCCESS - !call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !read(cvalue,*) lambm0 + !field = ESMF_FieldCreate(lnd_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(stdname), rc=rc) + field = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(stdname), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - !call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !read(cvalue,*) mvelpp + call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + end subroutine fldbundle_add + !--------------------------------------------------------------------------- + subroutine lnd_run(gcomp, import_state, export_state, clock, rc) + !------------------------ + ! Run CTSM + !------------------------ + use clm_instMod , only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst + use lnd_import_export , only : import_fields, export_fields + use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst + + ! input/output variables + type(ESMF_GridComp) :: gcomp ! CLM gridded component + type(ESMF_State) :: import_state ! CLM import state + type(ESMF_State) :: export_state ! CLM export state + type(ESMF_Clock) :: clock ! ESMF synchronization clock + integer, intent(out) :: rc ! Return code + + ! local variables: + type(ESMF_Alarm) :: alarm + type(ESMF_Time) :: currTime + type(ESMF_Time) :: nextTime + type(ESMF_State) :: importState, exportState + character(ESMF_MAXSTR) :: cvalue + character(ESMF_MAXSTR) :: case_name ! case name + integer :: ymd ! CTSM current date (YYYYMMDD) + integer :: yr ! CTSM current year + integer :: mon ! CTSM current month + integer :: day ! CTSM current day + integer :: tod ! CTSM current time of day (sec) + integer :: ymd_sync ! Sync date (YYYYMMDD) + integer :: yr_sync ! Sync current year + integer :: mon_sync ! Sync current month + integer :: day_sync ! Sync current day + integer :: tod_sync ! Sync current time of day (sec) + integer :: dtime ! time step increment (sec) + integer :: nstep ! time step index + logical :: rstwr ! .true. ==> write restart file before returning + logical :: nlend ! .true. ==> last time-step + logical :: dosend ! true => send data back to driver + logical :: doalb ! .true. ==> do albedo calculation on this time step + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + real(r8) :: caldayp1 ! ctsm calday plus dtime offset + integer :: lbnum ! input to memory diagnostic + integer :: g,i ! counters + real(r8) :: calday ! calendar day for nstep + real(r8) :: declin ! solar declination angle in radians for nstep + real(r8) :: declinp1 ! solar declination angle in radians for nstep+1 + real(r8) :: eccf ! earth orbit eccentricity factor + type(bounds_type) :: bounds ! bounds + character(len=32) :: rdate ! date char string for restart file names + integer :: shrlogunit ! original log unit + character(len=*),parameter :: subname=trim(modName)//':[lnd_run] ' + + character(*),parameter :: F02 = "('[lnd_comp_esmf] ',a, d26.19)" + !------------------------------------------------------------------------------- + + + + rc = ESMF_SUCCESS + call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + + call shr_file_getLogUnit (shrlogunit) + call shr_file_setLogUnit (iulog) + call ESMF_LogWrite(subname//' shr_file_getLogunits....', ESMF_LOGMSG_INFO) - !-------------------------------- - ! Unpack import state - !-------------------------------- - - call t_startf ('lc_lnd_import') - - call get_proc_bounds(bounds) - call ESMF_LogWrite(subname//'after get_proc_bounds', ESMF_LOGMSG_INFO) - !call import_fields( import_state, bounds, glc_present, rof_prognostic, atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc ) - call import_fields( gcomp , bounds, glc_present, rof_prognostic, atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call t_stopf ('lc_lnd_import') - - !-------------------------------- - ! Run model - !-------------------------------- - - dtime = get_step_size() - dosend = .false. - do while(.not. dosend) - - ! TODO: This is currently hard-wired - is there a better way for nuopc? - ! Note that the model clock is updated at the end of the time step not at the beginning - nstep = get_nstep() - if (nstep > 0) then - dosend = .true. - end if - - !-------------------------------- - ! Determine doalb based on nextsw_cday sent from atm model - !-------------------------------- - - calday = get_curr_calday() - caldayp1 = get_curr_calday(offset=dtime) - - !TODO(NS): nextsw_cday should come directly from atmosphere! What - !should we do - ! For now I am setting nextsw_cday to be the same caldayp1 - - - nextsw_cday = calday - if (nstep == 0) then - doalb = .false. - nextsw_cday = caldayp1 - else if (nstep == 1) then - !doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) - doalb = .false. - else - doalb = (nextsw_cday >= -0.5_r8) - end if - - - if (masterproc) then - write(iulog,*) '------------ LILAC ----------------' - write(iulog,*) 'nstep : ', nstep - write(iulog,*) 'dtime : ', dtime - write(iulog,F02) 'calday : ', calday - write(iulog,F02) 'caldayp1 : ', caldayp1 - write(iulog,F02) 'nextsw_cday : ', nextsw_cday - write(iulog,*) '-------------------------------------' - end if - - call update_rad_dtime(doalb) +#if (defined _MEMTRACE) + if(masterproc) then + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_comp_nuopc_ModelAdvance:start::',lbnum) + endif +#endif - if (masterproc) then - write(iulog,*) 'doalb is: ', doalb - end if + !---------------------- + ! Obtain orbital values + !---------------------- + + !call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !read(cvalue,*) eccen + + !call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !read(cvalue,*) obliqr + + !call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !read(cvalue,*) lambm0 + + !call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !read(cvalue,*) mvelpp + + !-------------------------------- + ! Unpack import state + !-------------------------------- + + call t_startf ('lc_lnd_import') + + call get_proc_bounds(bounds) + call ESMF_LogWrite(subname//'after get_proc_bounds', ESMF_LOGMSG_INFO) + call import_fields( gcomp , bounds, glc_present, rof_prognostic, atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call t_stopf ('lc_lnd_import') + + !-------------------------------- + ! Run model + !-------------------------------- + + dtime = get_step_size() + dosend = .false. + do while(.not. dosend) + + ! TODO: This is currently hard-wired - is there a better way for nuopc? + ! Note that the model clock is updated at the end of the time step not at the beginning + nstep = get_nstep() + if (nstep > 0) then + dosend = .true. + end if + + !-------------------------------- + ! Determine calendar day info + !-------------------------------- + + calday = get_curr_calday() + caldayp1 = get_curr_calday(offset=dtime) + + !-------------------------------- + ! Get time of next atmospheric shortwave calculation + !-------------------------------- + + ! TODO(NS): nextsw_cday should come directly from atmosphere! + ! For now I am setting nextsw_cday to be the same caldayp1 + + nextsw_cday = calday + if (masterproc) then + write(iulog,*) 'State_GetScalar ... nextsw_cday is : ', nextsw_cday + end if + + !-------------------------------- + ! Determine doalb based on nextsw_cday sent from atm model + !-------------------------------- + + if (nstep == 0) then + doalb = .false. + nextsw_cday = caldayp1 + else if (nstep == 1) then + !doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) + doalb = .false. + else + doalb = (nextsw_cday >= -0.5_r8) + end if + + if (masterproc) then + write(iulog,*) '------------ LILAC ----------------' + write(iulog,*) 'nstep : ', nstep + write(iulog,*) 'dtime : ', dtime + write(iulog,F02) 'calday : ', calday + write(iulog,F02) 'caldayp1 : ', caldayp1 + write(iulog,F02) 'nextsw_cday : ', nextsw_cday + write(iulog,*) '-------------------------------------' + end if + + call update_rad_dtime(doalb) + + if (masterproc) then + write(iulog,*) 'doalb is: ', doalb + end if + + !-------------------------------- + ! Determine if time to write restart + !-------------------------------- + + !call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + !if (ESMF_AlarmIsRinging(alarm, rc=rc)) then + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !rstwr = .true. + !call ESMF_AlarmRingerOff( alarm, rc=rc ) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !else + !rstwr = .false. + !endif + + ! TODO: for now hardwire rstwr to .false. + rstwr = .false. + + !-------------------------------- + ! Determine if time to stop + !-------------------------------- + + !call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + !if (ESMF_AlarmIsRinging(alarm, rc=rc)) then + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !nlend = .true. + !call ESMF_AlarmRingerOff( alarm, rc=rc ) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !else + ! nlend = .false. + !endif + + !-------------------------------- + ! Run CTSM + !-------------------------------- + + call t_barrierf('sync_ctsm_run1', mpicom) + + call t_startf ('shr_orb_decl') + calday = get_curr_calday() + + call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) + call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) + + if (masterproc) then + write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + write(iulog,* ) 'doalb : ', doalb + write(iulog,*) 'call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, decl' + write(iulog,*) 'call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, decl' + write(iulog,F02) 'calday is : ', calday + write(iulog,F02) 'eccen is : ', eccen + write(iulog,F02) 'mvelpp is : ', mvelpp + write(iulog,F02) 'lambm0 is : ', lambm0 + write(iulog,F02) 'obliqr is : ', obliqr + write(iulog,F02) 'clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic)' + write(iulog,F02) 'declin is : ', declin + write(iulog,F02) 'declinp1 is : ', declinp1 + write(iulog,F02) 'rof_prognostic : ', rof_prognostic + write(iulog,* ) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + end if + + call t_stopf ('shr_orb_decl') + + call t_startf ('ctsm_run') + + ! Restart File - use nexttimestr rather than currtimestr here since that is the time at the end of + ! the timestep and is preferred for restart file names + + call ESMF_ClockGetNextTime(clock, nextTime=nextTime, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet(nexttime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync, mon_sync, day_sync, tod_sync + + call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) + + call t_stopf ('ctsm_run') + + !-------------------------------- + ! Pack export state + !-------------------------------- + + call t_startf ('lc_lnd_export') + + call export_fields(gcomp, bounds, glc_present, rof_prognostic, & + water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) + !call export_fields(exportState, bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call t_stopf ('lc_lnd_export') - !-------------------------------- - ! Determine if time to write restart - !-------------------------------- + !-------------------------------- + ! Advance ctsm time step + !-------------------------------- + + call t_startf ('lc_ctsm2_adv_timestep') + call advance_timestep() + call t_stopf ('lc_ctsm2_adv_timestep') + + end do + + ! Check that internal clock is in sync with master clock + ! Note that the driver clock has not been updated yet - so at this point + ! CTSM is actually 1 coupling intervals ahead of the driver clock + + call get_curr_date( yr, mon, day, tod, offset=-2*dtime ) + ymd = yr*10000 + mon*100 + day + tod = tod + + call ESMF_ClockGet( clock, currTime=currTime, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - !call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet( currTime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yr_sync, mon_sync, day_sync, ymd_sync) - !if (ESMF_AlarmIsRinging(alarm, rc=rc)) then - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !rstwr = .true. - !call ESMF_AlarmRingerOff( alarm, rc=rc ) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !else - !rstwr = .false. - !endif + if ( (ymd /= ymd_sync) .and. (tod /= tod_sync) ) then + write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod + write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync + rc = ESMF_FAILURE + call ESMF_LogWrite(subname//" CTSM clock not in sync with Master Sync clock",ESMF_LOGMSG_ERROR) + end if - !-------------------------------- - ! Determine if time to stop - !-------------------------------- + !-------------------------------- + ! diagnostics + !-------------------------------- - !call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + !if (dbug > 1) then + ! call State_diagnose(exportState,subname//':ES',rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! if (masterproc) then + ! call log_clock_advance(clock, 'CTSM', iulog, rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! end if + !end if - !if (ESMF_AlarmIsRinging(alarm, rc=rc)) then - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !nlend = .true. - !call ESMF_AlarmRingerOff( alarm, rc=rc ) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !else - ! nlend = .false. - !endif - - !-------------------------------- - ! Run CTSM - !-------------------------------- - - call t_barrierf('sync_ctsm_run1', mpicom) - - call t_startf ('shr_orb_decl') - calday = get_curr_calday() - - - call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) - call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) - - - if (masterproc) then - write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' - write(iulog,* ) 'doalb : ', doalb - write(iulog,*) 'call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, decl' - write(iulog,*) 'call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, decl' - write(iulog,F02) 'calday is : ', calday - write(iulog,F02) 'eccen is : ', eccen - write(iulog,F02) 'mvelpp is : ', mvelpp - write(iulog,F02) 'lambm0 is : ', lambm0 - write(iulog,F02) 'obliqr is : ', obliqr - write(iulog,F02) 'clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic)' - write(iulog,F02) 'declin is : ', declin - write(iulog,F02) 'declinp1 is : ', declinp1 - write(iulog,F02) 'rof_prognostic : ', rof_prognostic - write(iulog,* ) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' - end if - - call t_stopf ('shr_orb_decl') - - call t_startf ('ctsm_run') - - ! Restart File - use nexttimestr rather than currtimestr here since that is the time at the end of - ! the timestep and is preferred for restart file names - - call ESMF_ClockGetNextTime(clock, nextTime=nextTime, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeGet(nexttime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync, mon_sync, day_sync, tod_sync - - call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) - - call t_stopf ('ctsm_run') + !-------------------------------- + ! Reset shr logging to my original values + !-------------------------------- - !-------------------------------- - ! Pack export state - !-------------------------------- + call shr_file_setLogUnit (shrlogunit) - call t_startf ('lc_lnd_export') - - call export_fields(gcomp, bounds, glc_present, rof_prognostic, & - water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) - !call export_fields(exportState, bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) - call t_stopf ('lc_lnd_export') +#if (defined _MEMTRACE) + if(masterproc) then + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_comp_nuopc_ModelAdvance:end::',lbnum) + call memmon_reset_addr() + endif +#endif - !-------------------------------- - ! Advance ctsm time step - !-------------------------------- + end subroutine lnd_run - call t_startf ('lc_ctsm2_adv_timestep') - call advance_timestep() - call t_stopf ('lc_ctsm2_adv_timestep') + !--------------------------------------------------------------------------- - end do + subroutine lnd_final(comp, import_state, export_state, clock, rc) + ! + ! !DESCRIPTION: + ! Finalize land surface model + ! + ! !ARGUMENTS: + type(ESMF_GridComp) :: comp ! CLM gridded component + type(ESMF_State) :: import_state ! CLM import state + type(ESMF_State) :: export_state ! CLM export state + type(ESMF_Clock) :: clock ! ESMF synchronization clock + integer, intent(out) :: rc ! Return code + !--------------------------------------------------------------------------- - ! Check that internal clock is in sync with master clock - ! Note that the driver clock has not been updated yet - so at this point - ! CTSM is actually 1 coupling intervals ahead of the driver clock + rc = ESMF_SUCCESS - call get_curr_date( yr, mon, day, tod, offset=-2*dtime ) - ymd = yr*10000 + mon*100 + day - tod = tod + ! Destroy ESMF objects + !call esmfshr_util_StateArrayDestroy(export_state,'domain',rc) + !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - call ESMF_ClockGet( clock, currTime=currTime, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call esmfshr_util_StateArrayDestroy(export_state,'d2x',rc) + !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - call ESMF_TimeGet( currTime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yr_sync, mon_sync, day_sync, ymd_sync) + !call esmfshr_util_StateArrayDestroy(import_state,'x2d',rc) + !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - if ( (ymd /= ymd_sync) .and. (tod /= tod_sync) ) then - write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod - write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync - rc = ESMF_FAILURE - call ESMF_LogWrite(subname//" CTSM clock not in sync with Master Sync clock",ESMF_LOGMSG_ERROR) - end if + end subroutine lnd_final - !-------------------------------- - ! diagnostics - !-------------------------------- + !=============================================================================== - !if (dbug > 1) then - ! call State_diagnose(exportState,subname//':ES',rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! if (masterproc) then - ! call log_clock_advance(clock, 'CTSM', iulog, rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! end if - !end if + subroutine log_clock_advance(clock, logunit, rc) - !-------------------------------- - ! Reset shr logging to my original values - !-------------------------------- + ! input/output variables + type(ESMF_Clock) :: clock + integer , intent(in) :: logunit + integer , intent(out) :: rc - call shr_file_setLogUnit (shrlogunit) + ! local variables + character(len=CL) :: cvalue, prestring + !----------------------------------------------------------------------- - call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) + rc = ESMF_SUCCESS -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_comp_nuopc_ModelAdvance:end::',lbnum) - call memmon_reset_addr() - endif -#endif + write(prestring, *) "------>Advancing CTSM from: " + call ESMF_ClockPrint(clock, options="currTime", unit=cvalue, preString=trim(prestring), rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(logunit, *) trim(cvalue) - end subroutine lnd_run + call ESMF_ClockPrint(clock, options="stopTime", unit=cvalue, & + preString="--------------------------------> to: ", rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(logunit, *) trim(cvalue) - !--------------------------------------------------------------------------- + end subroutine log_clock_advance - subroutine lnd_final(comp, import_state, export_state, clock, rc) - ! - ! !DESCRIPTION: - ! Finalize land surface model - ! - ! !ARGUMENTS: - type(ESMF_GridComp) :: comp ! CLM gridded component - type(ESMF_State) :: import_state ! CLM import state - type(ESMF_State) :: export_state ! CLM export state - type(ESMF_Clock) :: clock ! ESMF synchronization clock - integer, intent(out) :: rc ! Return code - !--------------------------------------------------------------------------- +!=============================================================================== - rc = ESMF_SUCCESS + subroutine memcheck(string, level, mastertask) - ! Destroy ESMF objects - !call esmfshr_util_StateArrayDestroy(export_state,'domain',rc) - !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + ! input/output variables + character(len=*) , intent(in) :: string + integer , intent(in) :: level + logical , intent(in) :: mastertask - !call esmfshr_util_StateArrayDestroy(export_state,'d2x',rc) - !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + ! local variables + integer :: ierr + integer, external :: GPTLprint_memusage + !----------------------------------------------------------------------- - !call esmfshr_util_StateArrayDestroy(import_state,'x2d',rc) - !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + if ((mastertask .and. memdebug_level > level) .or. memdebug_level > level+1) then + ierr = GPTLprint_memusage(string) + endif - end subroutine lnd_final + end subroutine memcheck - end module lnd_comp_esmf +end module lnd_comp_esmf diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index e1b9435b23..9f8c7c0d5c 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -1,13 +1,6 @@ module lnd_import_export - use ESMF , only : ESMF_GridComp, ESMF_State, ESMF_Mesh, ESMF_StateGet - use ESMF , only : ESMF_StatePrint - use ESMF , only : ESMF_GridCompGet - use ESMF , only : ESMF_KIND_R8, ESMF_SUCCESS, ESMF_MAXSTR, ESMF_LOGMSG_INFO - use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_ERROR, ESMF_LogFoundError - use ESMF , only : ESMF_STATEITEM_NOTFOUND, ESMF_StateItem_Flag - use ESMF , only : operator(/=), operator(==) - !use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise, NUOPC_IsConnected - !use NUOPC_Model , only : NUOPC_ModelGet + + use ESMF use shr_kind_mod , only : r8 => shr_kind_r8, cx=>shr_kind_cx, cxx=>shr_kind_cxx, cs=>shr_kind_cs use shr_infnan_mod , only : isnan => shr_infnan_isnan use shr_string_mod , only : shr_string_listGetName, shr_string_listGetNum @@ -32,13 +25,10 @@ module lnd_import_export implicit none private ! except -! public :: advertise_fields -! public :: realize_fields public :: import_fields public :: export_fields private :: fldlist_add - private :: fldlist_realize private :: state_getimport private :: state_setexport private :: state_getfldptr @@ -58,18 +48,14 @@ module lnd_import_export integer, parameter :: gridTofieldMap = 2 ! ungridded dimension is innermost ! from atm->lnd - integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn + integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn ! from lnd->atm - character(len=cx) :: carma_fields ! List of CARMA fields from lnd->atm integer :: drydep_nflds ! number of dry deposition velocity fields lnd-> atm integer :: megan_nflds ! number of MEGAN voc fields from lnd-> atm integer :: emis_nflds ! number of fire emission fields from lnd-> atm - logical :: flds_co2a ! use case - logical :: flds_co2b ! use case - logical :: flds_co2c ! use case - integer :: glc_nec ! number of glc elevation classes + integer :: glc_nec = 10 ! number of glc elevation classes integer, parameter :: debug = 1 ! internal debug level character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" @@ -78,291 +64,8 @@ module lnd_import_export __FILE__ character(*),parameter :: modname = "[lnd_import_export]: " -!=============================================================================== + !=============================================================================== contains -!=============================================================================== - -! subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, rof_prognostic, rc) -! -! use clm_varctl, only : ndep_from_cpl -! -! ! input/output variables -! type(ESMF_GridComp) :: gcomp -! character(len=*) , intent(in) :: flds_scalar_name -! logical , intent(in) :: glc_present -! logical , intent(in) :: rof_prognostic -! integer , intent(out) :: rc -! -! ! local variables -! type(ESMF_State) :: importState -! type(ESMF_State) :: exportState -! character(ESMF_MAXSTR) :: stdname -! character(ESMF_MAXSTR) :: cvalue -! character(len=2) :: nec_str -! integer :: n, num -! character(len=128) :: fldname -! character(len=*), parameter :: subname='(lnd_import_export:advertise_fields)' -! !------------------------------------------------------------------------------- -! -! rc = ESMF_SUCCESS -! -! call NUOPC_ModelGet(gcomp, importState=importState, exportState=exportState, rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! -! !-------------------------------- -! ! determine necessary toggles for below -! !-------------------------------- -! -! call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! read(cvalue,*) flds_co2a -! call ESMF_LogWrite('flds_co2a = '// trim(cvalue), ESMF_LOGMSG_INFO) -! -! call NUOPC_CompAttributeGet(gcomp, name='flds_co2b', value=cvalue, rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! read(cvalue,*) flds_co2b -! call ESMF_LogWrite('flds_co2b = '// trim(cvalue), ESMF_LOGMSG_INFO) -! -! call NUOPC_CompAttributeGet(gcomp, name='flds_co2c', value=cvalue, rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! read(cvalue,*) flds_co2c -! call ESMF_LogWrite('flds_co2c = '// trim(cvalue), ESMF_LOGMSG_INFO) -! -! ! Determine number of elevation classes -! call NUOPC_CompAttributeGet(gcomp, name='glc_nec', value=cvalue, rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! read(cvalue,*) glc_nec -! call ESMF_LogWrite('glc_nec = '// trim(cvalue), ESMF_LOGMSG_INFO) -! if (glc_nec < 1) then -! call shr_sys_abort('ERROR: In CLM4.5 and later, glc_nec must be at least 1.') -! end if -! -! ! Initialize glc_elevclass module -! call glc_elevclass_init(glc_nec) -! -! !-------------------------------- -! ! Advertise export fields -! !-------------------------------- -! -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, trim(flds_scalar_name)) -! -! ! export land states -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_lfrin' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_t' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_tref' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_qref' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdr' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidr' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdf' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidf' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_snowh' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_u10' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_fv' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_ram1' ) -! -! ! export fluxes to river -! if (rof_prognostic) then -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofsur' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofgwl' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofsub' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofi' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_irrig' ) -! end if -! -! ! export fluxes to atm -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_taux' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_tauy' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lat' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_sen' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lwup' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_evap' ) -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_swnet' ) -! -! ! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_methane' ) -! -! ! dust fluxes from land (4 sizes) -! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_flxdst', ungridded_lbound=1, ungridded_ubound=4) -! -! ! co2 fields from land -! if (flds_co2b .or. flds_co2c) then -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_fco2_lnd' ) -! end if -! -! ! Dry Deposition velocities from land - ALSO initialize drydep here -! call seq_drydep_readnl("drv_flds_in", drydep_nflds) -! if (n_drydep .ne. drydep_nflds) call shr_sys_abort('ERROR: drydep field count mismatch') -! if (n_drydep > 0) then -! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_ddvel', ungridded_lbound=1, ungridded_ubound=drydep_nflds) -! end if -! call seq_drydep_init( ) -! -! ! MEGAN VOC emissions fluxes from land -! megan_nflds=0 -! call shr_megan_readnl('drv_flds_in', megan_nflds) -! if (shr_megan_mechcomps_n .ne. megan_nflds) call shr_sys_abort('ERROR: megan field count mismatch') -! if (shr_megan_mechcomps_n > 0) then -! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_voc', ungridded_lbound=1, ungridded_ubound=megan_nflds) -! end if -! -! ! Fire emissions fluxes from land -! call shr_fire_emis_readnl('drv_flds_in', emis_nflds) -! if (shr_fire_emis_mechcomps_n .ne. emis_nflds) call shr_sys_abort('ERROR: fire_emis field count mismatch') -! if (shr_fire_emis_mechcomps_n > 0) then -! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_fire', ungridded_lbound=1, ungridded_ubound=emis_nflds) -! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_fztop') -! end if -! ! CARMA volumetric soil water from land -! ! TODO: is the following correct - the CARMA field exchange is very confusing in mct -! call shr_carma_readnl('drv_flds_in', carma_fields) -! if (carma_fields /= ' ') then -! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_soilw') ! optional for carma -! end if -! -! if (glc_present) then -! ! lnd->glc states from land all lnd->glc elevation classes (1:glc_nec) plus bare land (index 0). -! ! The following puts all of the elevation class fields as an -! ! undidstributed dimension in the export state field -! -! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_tsrf_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) -! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_topo_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) -! call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Flgl_qice_elev', ungridded_lbound=1, ungridded_ubound=glc_nec+1) -! end if -! -! ! Now advertise above export fields -! do n = 1,fldsFrLnd_num -! call NUOPC_Advertise(exportState, standardName=fldsFrLnd(n)%stdname, & -! TransferOfferGeomObject='will provide', rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! enddo -! -! !-------------------------------- -! ! Advertise import fields -! !-------------------------------- -! -! call fldlist_add(fldsToLnd_num, fldsToLnd, trim(flds_scalar_name)) -! -! ! from atm - states -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_z' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_topo' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_u' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_v' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_ptem' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_pbot' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_tbot' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_shum' ) -! !call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_methane' ) -! -! ! from atm - fluxes -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_lwdn' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_rainc' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_rainl' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_snowc' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_snowl' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swndr' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swvdr' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swndf' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swvdf' ) -! -! ! from atm - black carbon deposition fluxes (3) -! ! (1) => bcphidry, (2) => bcphodry, (3) => bcphiwet -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_bcph', ungridded_lbound=1, ungridded_ubound=3) -! -! ! from atm - organic carbon deposition fluxes (3) -! ! (1) => ocphidry, (2) => ocphodry, (3) => ocphiwet -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_ocph', ungridded_lbound=1, ungridded_ubound=3) -! -! ! from atm - wet dust deposition frluxes (4 sizes) -! ! (1) => dstwet1, (2) => dstwet2, (3) => dstwet3, (4) => dstwet4 -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_dstwet', ungridded_lbound=1, ungridded_ubound=4) -! -! ! from - atm dry dust deposition frluxes (4 sizes) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_dstdry', ungridded_lbound=1, ungridded_ubound=4) -! -! ! from atm - nitrogen deposition -! call shr_ndep_readnl("drv_flds_in", ndep_nflds) -! if (ndep_nflds > 0) then -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=ndep_nflds) -! ! This sets a variable in clm_varctl -! ndep_from_cpl = .true. -! end if -! -! ! from atm - co2 exchange scenarios -! if (flds_co2a .or. flds_co2b .or. flds_co2c) then -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_co2prog') -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_co2diag') -! end if -! -! if (rof_prognostic) then -! ! from river -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_flood' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_volr' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_volrmch' ) -! end if -! -! if (glc_present) then -! ! from land-ice (glc) - no elevation classes -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_icemask' ) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_icemask_coupled_fluxes') -! -! ! from land-ice (glc) - fields for all glc->lnd elevation classes (1:glc_nec) plus bare land (index 0) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_ice_covered_elev', ungridded_lbound=1, ungridded_ubound=glc_nec+1) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_topo_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) -! call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flgg_hflx_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) -! end if -! -! ! Now advertise import fields -! do n = 1,fldsToLnd_num -! call NUOPC_Advertise(importState, standardName=fldsToLnd(n)%stdname, & -! TransferOfferGeomObject='will provide', rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! enddo -! -! end subroutine advertise_fields -! -! !=============================================================================== -! -! subroutine realize_fields(gcomp, Emesh, flds_scalar_name, flds_scalar_num, rc) -! -! ! input/output variables -! type(ESMF_GridComp) , intent(inout) :: gcomp -! type(ESMF_Mesh) , intent(in) :: Emesh -! character(len=*) , intent(in) :: flds_scalar_name -! integer , intent(in) :: flds_scalar_num -! integer , intent(out) :: rc -! -! ! local variables -! type(ESMF_State) :: importState -! type(ESMF_State) :: exportState -! character(len=*), parameter :: subname='(lnd_import_export:realize_fields)' -! !--------------------------------------------------------------------------- -! -! rc = ESMF_SUCCESS -! -! call NUOPC_ModelGet(gcomp, importState=importState, exportState=exportState, rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! -! call fldlist_realize( & -! state=ExportState, & -! fldList=fldsFrLnd, & -! numflds=fldsFrLnd_num, & -! flds_scalar_name=flds_scalar_name, & -! flds_scalar_num=flds_scalar_num, & -! tag=subname//':clmExport',& -! mesh=Emesh, rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! -! call fldlist_realize( & -! state=importState, & -! fldList=fldsToLnd, & -! numflds=fldsToLnd_num, & -! flds_scalar_name=flds_scalar_name, & -! flds_scalar_num=flds_scalar_num, & -! tag=subname//':clmImport',& -! mesh=Emesh, rc=rc) -! if (ChkErr(rc,__LINE__,u_FILE_u)) return -! -! end subroutine realize_fields - !=============================================================================== subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & @@ -443,12 +146,9 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) ! Get import state - !call NUOPC_ModelGet(gcomp, importState=importState, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Get import state call ESMF_GridCompGet(gcomp, importState=importState, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Set bounds begg = bounds%begg; endg=bounds%endg @@ -513,192 +213,81 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_getimport(importState, 'Faxa_swndf', bounds, output=atm2lnd_inst%forc_solai_grc(:,2), rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - -!!!# ! Atmosphere prognostic/prescribed aerosol fields -!!!# -!!!# ! bcphidry -!!!# call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,1), & -!!!# ungridded_index=1, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# ! bcphodry -!!!# call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,2), & -!!!# ungridded_index=2, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# ! bcphiwet -!!!# call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,3), & -!!!# ungridded_index=3, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# -!!!# ! ocphidry -!!!# call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,4), & -!!!# ungridded_index=1, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# ! bcphodry -!!!# call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,5), & -!!!# ungridded_index=2, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# ! bcphiwet -!!!# call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,6), & -!!!# ungridded_index=3, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# -!!!# call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,7), & -!!!# ungridded_index=1, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,8), & -!!!# ungridded_index=1, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# -!!!# call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,9), & -!!!# ungridded_index=2, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,10), & -!!!# ungridded_index=2, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# -!!!# call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,11), & -!!!# ungridded_index=3, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,12), & -!!!# ungridded_index=3, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# -!!!# call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,13), & -!!!# ungridded_index=4, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,14), & -!!!# ungridded_index=4, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# -!!!# call state_getimport(importState, 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# -!!!# ! The mediator is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec -!!!# ! so the following conversion needs to happen -!!!# -!!!# call state_getimport(importState, 'Faxa_nhx', bounds, output=forc_nhx, ungridded_index=1, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# call state_getimport(importState, 'Faxa_noy', bounds, output=forc_noy, ungridded_index=2, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# do g = begg,endg -!!!# atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 -!!!# end do -!!!# -!!!# !-------------------------- -!!!# ! Atmosphere co2 -!!!# !-------------------------- -!!!# -!!!# fldName = 'Sa_co2prog' -!!!# call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) -!!!# if ( ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'prognostic') then -!!!# call shr_sys_abort( subname//' ERROR: must have nonzero Sa_co2prog for co2_type equal to prognostic' ) -!!!# end if -!!!# if (itemflag /= ESMF_STATEITEM_NOTFOUND) then -!!!# call state_getfldptr(importState, trim(fldname), dataPtr, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# do g = begg,endg -!!!# co2_ppmv_prog(g) = dataPtr(g-begg+1) ! co2 atm prognostic -!!!# end do -!!!# else -!!!# do g = begg,endg -!!!# co2_ppmv_prog(g) = co2_ppmv -!!!# end do -!!!# end if -!!!# -!!!# fldName = 'Sa_co2diag' -!!!# call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) -!!!# if ( ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'diagnostic') then -!!!# call shr_sys_abort( subname//' ERROR: must have nonzero Sa_co2prog for co2_type equal to prognostic' ) -!!!# end if -!!!# if (itemflag /= ESMF_STATEITEM_NOTFOUND) then -!!!# call state_getfldptr(importState, trim(fldname), dataPtr, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# do g = begg,endg -!!!# co2_ppmv_diag(g) = dataPtr(g-begg+1) ! co2 atm diagnostic -!!!# end do -!!!# else -!!!# do g = begg,endg -!!!# co2_ppmv_diag(g) = co2_ppmv -!!!# end do -!!!# end if -!!!# -!!!# ! Note that the following does unit conversions from ppmv to partial pressures (Pa) -!!!# ! Note that forc_pbot is in Pa -!!!# do g = begg,endg -!!!# if (co2_type == 'prognostic') then -!!!# co2_ppmv_val = co2_ppmv_prog(g) -!!!# else if (co2_type == 'diagnostic') then -!!!# co2_ppmv_val = co2_ppmv_diag(g) -!!!# else -!!!# co2_ppmv_val = co2_ppmv -!!!# end if -!!!# forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) -!!!# atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_val * 1.e-6_r8 * forc_pbot -!!!# if (use_c13) then -!!!# atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_val * c13ratio * 1.e-6_r8 * forc_pbot -!!!# end if -!!!# end do -!!!# -!!!# !-------------------------- -!!!# ! Flooding back from river -!!!# !-------------------------- -!!!# -!!!# ! sign convention is positive downward and hierarchy is atm/glc/lnd/rof/ice/ocn. -!!!# ! so water sent from rof to land is negative, -!!!# ! change the sign to indicate addition of water to system. -!!!# -!!!# if (rof_prognostic) then -!!!# call state_getimport(importState, 'Flrr_flood', bounds, output=wateratm2lndbulk_inst%forc_flood_grc, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# wateratm2lndbulk_inst%forc_flood_grc(:) = -wateratm2lndbulk_inst%forc_flood_grc(:) -!!!# else - wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 -!!!# end if -!!!# -!!!# if (rof_prognostic) then -!!!# call state_getimport(importState, 'Flrr_volr', bounds, output=wateratm2lndbulk_inst%volr_grc, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# wateratm2lndbulk_inst%volr_grc(:) = wateratm2lndbulk_inst%volr_grc(:) * (ldomain%area(:) * 1.e6_r8) -!!!# else -!!!# wateratm2lndbulk_inst%volr_grc(:) = 0._r8 -!!!# end if -!!!# -!!!# if (rof_prognostic) then -!!!# call state_getimport(importState, 'Flrr_volrmch', bounds, output=wateratm2lndbulk_inst%volrmch_grc, rc=rc ) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# wateratm2lndbulk_inst%volrmch_grc(:) = wateratm2lndbulk_inst%volrmch_grc(:) * (ldomain%area(:) * 1.e6_r8) -!!!# else -!!!# wateratm2lndbulk_inst%volrmch_grc(:) = 0._r8 -!!!# end if -!!!# -!!!# !-------------------------- -!!!# ! Land-ice (glc) fields -!!!# !-------------------------- -!!!# -!!!# if (glc_present) then -!!!# ! We could avoid setting these fields if glc_present is .false., if that would -!!!# ! help with performance. (The downside would be that we wouldn't have these fields -!!!# ! available for diagnostic purposes or to force a later T compset with dlnd.) -!!!# -!!!# do num = 0,glc_nec -!!!# call state_getimport(importState, 'Sg_ice_covered_elev', bounds, frac_grc(:,num), ungridded_index=num+1, rc=rc) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# call state_getimport(importState, 'Sg_topo_elev' , bounds, topo_grc(:,num), ungridded_index=num+1, rc=rc) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# call state_getimport(importState, 'Flgg_hflx_elev' , bounds, hflx_grc(:,num), ungridded_index=num+1, rc=rc) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# end do -!!!# call state_getimport(importState, 'Sg_icemask' , bounds, icemask_grc, rc=rc) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# call state_getimport(importState, 'Sg_icemask_coupled_fluxes', bounds, icemask_grc, rc=rc) -!!!# if (ChkErr(rc,__LINE__,u_FILE_u)) return -!!!# -!!!# call glc2lnd_inst%set_glc2lnd_fields_nuopc( bounds, glc_present, & -!!!# frac_grc, topo_grc, hflx_grc, icemask_grc, icemask_coupled_fluxes_grc) -!!!# end if + ! ! Atmosphere prognostic/prescribed aerosol fields + + ! ! bcphidry + ! call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,1), & + ! ungridded_index=1, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ! bcphodry + ! call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,2), & + ! ungridded_index=2, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ! bcphiwet + ! call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,3), & + ! ungridded_index=3, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! ! ocphidry + ! call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,4), & + ! ungridded_index=1, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ! bcphodry + ! call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,5), & + ! ungridded_index=2, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ! bcphiwet + ! call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,6), & + ! ungridded_index=3, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,7), & + ! ungridded_index=1, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,8), & + ! ungridded_index=1, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,9), & + ! ungridded_index=2, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,10), & + ! ungridded_index=2, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,11), & + ! ungridded_index=3, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,12), & + ! ungridded_index=3, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,13), & + ! ungridded_index=4, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,14), & + ! ungridded_index=4, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! call state_getimport(importState, 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! ! The mediator is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec + ! ! so the following conversion needs to happen + + ! call state_getimport(importState, 'Faxa_nhx', bounds, output=forc_nhx, ungridded_index=1, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call state_getimport(importState, 'Faxa_noy', bounds, output=forc_noy, ungridded_index=2, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! do g = begg,endg + ! atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 + ! end do + + !-------------------------- + ! Set force flood back from river to 0 + !-------------------------- + + wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 !-------------------------- ! Derived quantities @@ -725,7 +314,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & - atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) + atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) @@ -742,7 +331,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & if (1==2) then if ((forc_rainc(g)+forc_rainl(g)) > 0._r8) then forc_q = 0.95_r8*qsat - !forc_q = qsat + !forc_q = qsat wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q endif endif @@ -782,7 +371,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end subroutine import_fields -!============================================================================== + !============================================================================== subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) @@ -908,12 +497,6 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & input=waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! co2 from land - if (flds_co2b .or. flds_co2c) then - call state_setexport(exportState, 'Fall_fco2_lnd', bounds, lnd2atm_inst%net_carbon_exchange_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - ! dry dep velocities do num = 1, drydep_nflds call state_setexport(exportState, 'Sl_ddvel', bounds, input=lnd2atm_inst%ddvel_grc(:,num), & @@ -1028,166 +611,8 @@ end subroutine fldlist_add !=============================================================================== - subroutine fldlist_realize(state, fldList, numflds, flds_scalar_name, flds_scalar_num, mesh, tag, rc) - - use NUOPC , only : NUOPC_IsConnected, NUOPC_Realize - use ESMF , only : ESMF_MeshLoc_Element, ESMF_FieldCreate, ESMF_TYPEKIND_R8 - use ESMF , only : ESMF_MAXSTR, ESMF_Field, ESMF_State, ESMF_Mesh, ESMF_StateRemove, ESMF_FieldBundle - use ESMF , only : ESMF_FieldBundle, ESMF_FieldBundleCreate, ESMF_FieldBundleAdd, ESMF_StateAdd - use ESMF , only : ESMF_LogFoundError, ESMF_LOGMSG_INFO, ESMF_SUCCESS - use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_ERROR, ESMF_LOGERR_PASSTHRU - - ! input/output variables - type(ESMF_State) , intent(inout) :: state - type(fld_list_type) , intent(in) :: fldList(:) - integer , intent(in) :: numflds - character(len=*) , intent(in) :: flds_scalar_name - integer , intent(in) :: flds_scalar_num - character(len=*) , intent(in) :: tag - type(ESMF_Mesh) , intent(in) :: mesh - integer , intent(inout) :: rc - - ! local variables - integer :: n - type(ESMF_Field) :: field - character(len=80) :: stdname - character(len=*),parameter :: subname='(lnd_import_export:fldlist_realize)' - type (ESMF_FieldBundle) :: l2c_fb , c2l_fb - ! ---------------------------------------------- - - rc = ESMF_SUCCESS - -!! do n = 1, numflds -!! stdname = fldList(n)%stdname -!! if (NUOPC_IsConnected(state, fieldName=stdname)) then -!! if (stdname == trim(flds_scalar_name)) then -!! call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected on root pe", & -!! ESMF_LOGMSG_INFO) -!! ! Create the scalar field -!! call SetScalarField(field, flds_scalar_name, flds_scalar_num, rc=rc) -!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return -!! else -!! ! Create the field -!! if (fldlist(n)%ungridded_lbound > 0 .and. fldlist(n)%ungridded_ubound > 0) then -!! field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, & -!! ungriddedLbound=(/fldlist(n)%ungridded_lbound/), & -!! ungriddedUbound=(/fldlist(n)%ungridded_ubound/), & -!! gridToFieldMap=(/gridToFieldMap/), rc=rc) -!! if (ChkErr(rc,__LINE__,u_FILE_u)) return -!! else -!! field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) -!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return -!! end if -!! call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected using mesh", & -!! ESMF_LOGMSG_INFO) -!! endif -!! -!! ! NOW call NUOPC_Realize -!! call NUOPC_Realize(state, field=field, rc=rc) -!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return -!! else -!! if (stdname /= trim(flds_scalar_name)) then -!! call ESMF_LogWrite(subname // trim(tag) // " Field = "// trim(stdname) // " is not connected.", & -!! ESMF_LOGMSG_INFO) -!! call ESMF_StateRemove(state, (/stdname/), rc=rc) -!! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return -!! end if -!! end if -!! end do - - - - - - - l2c_fb = ESMF_FieldBundleCreate (name="l2c_fb", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - do n = 1, numflds - stdname = fldList(n)%stdname - if (stdname == trim(flds_scalar_name)) then - call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected on root pe", ESMF_LOGMSG_INFO) - ! Create the scalar field - call SetScalarField(field, flds_scalar_name, flds_scalar_num, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - else - ! Create the field - if (fldlist(n)%ungridded_lbound > 0 .and. fldlist(n)%ungridded_ubound > 0) then - field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, & - ungriddedLbound=(/fldlist(n)%ungridded_lbound/), & - ungriddedUbound=(/fldlist(n)%ungridded_ubound/), & - gridToFieldMap=(/gridToFieldMap/), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - end if - call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected using mesh", & - ESMF_LOGMSG_INFO) - endif - call ESMF_FieldBundleAdd(l2c_fb, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - call ESMF_StateAdd(state, (/l2c_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - if (masterproc .and. debug > 0) then - write(iulog,F01)' lnd2atm_l_state is filld with l2c_fb field bundle!' - end if - end do - - - - - - - - - - - contains !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - subroutine SetScalarField(field, flds_scalar_name, flds_scalar_num, rc) - ! ---------------------------------------------- - ! create a field with scalar data on the root pe - ! ---------------------------------------------- - use ESMF, only : ESMF_Field, ESMF_DistGrid, ESMF_Grid - use ESMF, only : ESMF_DistGridCreate, ESMF_GridCreate, ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU - use ESMF, only : ESMF_FieldCreate, ESMF_GridCreate, ESMF_TYPEKIND_R8 - - type(ESMF_Field) , intent(inout) :: field - character(len=*) , intent(in) :: flds_scalar_name - integer , intent(in) :: flds_scalar_num - integer , intent(inout) :: rc - - ! local variables - type(ESMF_Distgrid) :: distgrid - type(ESMF_Grid) :: grid - character(len=*), parameter :: subname='(lnd_import_export:SetScalarField)' - ! ---------------------------------------------- - - rc = ESMF_SUCCESS - - ! create a DistGrid with a single index space element, which gets mapped onto DE 0. - distgrid = ESMF_DistGridCreate(minIndex=(/1/), maxIndex=(/1/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - grid = ESMF_GridCreate(distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - field = ESMF_FieldCreate(name=trim(flds_scalar_name), grid=grid, typekind=ESMF_TYPEKIND_R8, & - ungriddedLBound=(/1/), ungriddedUBound=(/flds_scalar_num/), gridToFieldMap=(/2/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - end subroutine SetScalarField - - end subroutine fldlist_realize - - !=============================================================================== - subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) - use ESMF , only : ESMF_Field, ESMF_FieldBundle - use ESMF , only : ESMF_FieldBundleGet ! ---------------------------------------------- ! Map import state field to output array ! ---------------------------------------------- @@ -1228,10 +653,10 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) ! print out what is in our state??? if (masterproc .and. debug > 0) then - write(iulog,F01)' Show me what is in the state? for '//trim(fldname) - call ESMF_StatePrint(state, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + write(iulog,F01)' Show me what is in the state? for '//trim(fldname) + call ESMF_StatePrint(state, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if ! Determine if fieldbundle exists in state call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) @@ -1240,19 +665,19 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) ! if fieldbundle exists then create output array - else do nothing if (itemflag /= ESMF_STATEITEM_NOTFOUND) then - ! Get the field bundle??? - call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Get the field bundle??? + call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(subname//'c2l_fb found and now ... getting '//trim(fldname), ESMF_LOGMSG_INFO) - call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - !call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=field, isPresent=isPresent, rc=rc) - !call ESMF_FieldBundleGet(fieldBundle,field=field, rc=rc) - !call ESMF_FieldBundleGet(fieldBundle, fieldCount=fieldCount, rc=rc) + call ESMF_LogWrite(subname//'c2l_fb found and now ... getting '//trim(fldname), ESMF_LOGMSG_INFO) + call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=field, isPresent=isPresent, rc=rc) + !call ESMF_FieldBundleGet(fieldBundle,field=field, rc=rc) + !call ESMF_FieldBundleGet(fieldBundle, fieldCount=fieldCount, rc=rc) - ! Now for error checking we can put ... if (isPresent...) + ! Now for error checking we can put ... if (isPresent...) ! get field pointer if (present(ungridded_index)) then write(cvalue,*) ungridded_index @@ -1284,8 +709,8 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) n = g - bounds%begg + 1 output(g) = fldptr1d(n) if (masterproc .and. debug > 0 .and. get_nstep() < 5) then - write(iulog,F02)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) - end if + write(iulog,F02)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) + end if end do end if @@ -1410,12 +835,6 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) ! Get pointer to a state field ! ---------------------------------------------- - use ESMF , only : ESMF_State, ESMF_Field, ESMF_Mesh, ESMF_FieldStatus_Flag - use ESMF , only : ESMF_FieldBundle - use ESMF , only : ESMF_StateGet, ESMF_FieldGet, ESMF_MeshGet - use ESMF , only : ESMF_FIELDSTATUS_COMPLETE, ESMF_FAILURE - use ESMF , only : ESMF_FieldBundleGet - ! input/output variables type(ESMF_State), intent(in) :: State character(len=*), intent(in) :: fldname @@ -1443,7 +862,7 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) !call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - + ! Get the fieldbundle from state... call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1478,7 +897,7 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc .and. debug > 0) then write(iulog,F01)' in '//trim(subname)//'fldptr1d for '//trim(fldname)//' is ' - end if + end if !print *, "FLDPTR1D is" !print *, FLDPTR1d else if (present(fldptr2d)) then @@ -1499,7 +918,7 @@ subroutine check_for_nans(array, fname, begg) real(r8) , intent(in) :: array(:) character(len=*) , intent(in) :: fname integer , intent(in) :: begg -! + ! ! local variables integer :: i !------------------------------------------------------------------------------- diff --git a/src/cpl/lilac/lnd_shr_methods.F90 b/src/cpl/lilac/lnd_shr_methods.F90 index d0fda756fa..c20a3e4360 100644 --- a/src/cpl/lilac/lnd_shr_methods.F90 +++ b/src/cpl/lilac/lnd_shr_methods.F90 @@ -1,243 +1,24 @@ module lnd_shr_methods - use ESMF , only : operator(<), operator(/=), operator(+) - use ESMF , only : operator(-), operator(*) , operator(>=) - use ESMF , only : operator(<=), operator(>), operator(==) - use ESMF , only : ESMF_LOGERR_PASSTHRU, ESMF_LogFoundError, ESMF_LOGMSG_ERROR, ESMF_MAXSTR - use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_FAILURE - use ESMF , only : ESMF_State, ESMF_StateGet - use ESMF , only : ESMF_Field, ESMF_FieldGet - use ESMF , only : ESMF_GridComp, ESMF_GridCompGet, ESMF_GridCompSet - use ESMF , only : ESMF_GeomType_Flag, ESMF_FieldStatus_Flag - use ESMF , only : ESMF_Mesh, ESMF_MeshGet - use ESMF , only : ESMF_GEOMTYPE_MESH, ESMF_GEOMTYPE_GRID, ESMF_FIELDSTATUS_COMPLETE - use ESMF , only : ESMF_Clock, ESMF_ClockCreate, ESMF_ClockGet, ESMF_ClockSet - use ESMF , only : ESMF_ClockPrint, ESMF_ClockAdvance - use ESMF , only : ESMF_Alarm, ESMF_AlarmCreate, ESMF_AlarmGet, ESMF_AlarmSet - use ESMF , only : ESMF_Calendar, ESMF_CALKIND_NOLEAP, ESMF_CALKIND_GREGORIAN - use ESMF , only : ESMF_Time, ESMF_TimeGet, ESMF_TimeSet - use ESMF , only : ESMF_TimeInterval, ESMF_TimeIntervalSet, ESMF_TimeIntervalGet - use ESMF , only : ESMF_VM, ESMF_VMGet, ESMF_VMBroadcast, ESMF_VMGetCurrent + use ESMF use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort - use shr_file_mod , only : shr_file_setlogunit, shr_file_getLogUnit implicit none private - public :: memcheck - public :: log_clock_advance - public :: state_getscalar - public :: state_setscalar public :: state_diagnose - public :: alarmInit public :: chkerr - private :: timeInit private :: field_getfldptr - ! Clock and alarm options - character(len=*), private, parameter :: & - optNONE = "none" , & - optNever = "never" , & - optNSteps = "nsteps" , & - optNStep = "nstep" , & - optNSeconds = "nseconds" , & - optNSecond = "nsecond" , & - optNMinutes = "nminutes" , & - optNMinute = "nminute" , & - optNHours = "nhours" , & - optNHour = "nhour" , & - optNDays = "ndays" , & - optNDay = "nday" , & - optNMonths = "nmonths" , & - optNMonth = "nmonth" , & - optNYears = "nyears" , & - optNYear = "nyear" , & - optMonthly = "monthly" , & - optYearly = "yearly" , & - optDate = "date" , & - optIfdays0 = "ifdays0" - ! Module data - integer, parameter :: SecPerDay = 86400 ! Seconds per day - integer, parameter :: memdebug_level=1 - character(len=1024) :: msgString + character(len=1024) :: msgString character(len=*), parameter :: u_FILE_u = & __FILE__ !=============================================================================== contains -!=============================================================================== - - subroutine memcheck(string, level, mastertask) - - ! input/output variables - character(len=*) , intent(in) :: string - integer , intent(in) :: level - logical , intent(in) :: mastertask - - ! local variables - integer :: ierr - integer, external :: GPTLprint_memusage - !----------------------------------------------------------------------- - - if ((mastertask .and. memdebug_level > level) .or. memdebug_level > level+1) then - ierr = GPTLprint_memusage(string) - endif - - end subroutine memcheck - -!=============================================================================== - - subroutine log_clock_advance(clock, component, logunit, rc) - - ! input/output variables - type(ESMF_Clock) :: clock - character(len=*) , intent(in) :: component - integer , intent(in) :: logunit - integer , intent(out) :: rc - - ! local variables - character(len=CL) :: cvalue, prestring - !----------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - write(prestring, *) "------>Advancing ",trim(component)," from: " - call ESMF_ClockPrint(clock, options="currTime", unit=cvalue, preString=trim(prestring), rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - write(logunit, *) trim(cvalue) - - call ESMF_ClockPrint(clock, options="stopTime", unit=cvalue, & - preString="--------------------------------> to: ", rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - write(logunit, *) trim(cvalue) - - end subroutine log_clock_advance - -!=============================================================================== - - subroutine state_getscalar(state, scalar_id, scalar_value, flds_scalar_name, flds_scalar_num, rc) - - ! ---------------------------------------------- - ! Get scalar data from State for a particular name and broadcast it to all other pets - ! ---------------------------------------------- - - ! input/output variables - type(ESMF_State), intent(in) :: state - integer, intent(in) :: scalar_id - real(r8), intent(out) :: scalar_value - character(len=*), intent(in) :: flds_scalar_name - integer, intent(in) :: flds_scalar_num - integer, intent(inout) :: rc - - ! local variables - integer :: mytask, ierr, len - type(ESMF_VM) :: vm - type(ESMF_Field) :: field - real(r8), pointer :: farrayptr(:,:) - real(r8) :: tmp(1) - character(len=*), parameter :: subname='(state_getscalar)' - ! ---------------------------------------------- - - rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - call ESMF_VMGetCurrent(vm, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - call ESMF_LogWrite(subname//'after VMGetCurrent', ESMF_LOGMSG_INFO) - call ESMF_VMGet(vm, localPet=mytask, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(subname//'after VMGet', ESMF_LOGMSG_INFO) - - call ESMF_LogWrite(subname//'before ESMF_StateGet', ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//'or field is '//trim(flds_scalar_name), ESMF_LOGMSG_INFO) - - call ESMF_StateGet(State, itemName=trim(flds_scalar_name), field=field, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(subname//'after ESMF_StateGet', ESMF_LOGMSG_INFO) - - if (mytask == 0) then - call ESMF_FieldGet(field, farrayPtr = farrayptr, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then - call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO, line=__LINE__, file=u_FILE_u) - rc = ESMF_FAILURE - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - endif - tmp(:) = farrayptr(scalar_id,:) - endif - call ESMF_VMBroadCast(vm, tmp, 1, 0, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - scalar_value = tmp(1) - - end subroutine state_getscalar - -!================================================================================ - - subroutine state_setscalar(scalar_value, scalar_id, State, flds_scalar_name, flds_scalar_num, rc) - - ! ---------------------------------------------- - ! Set scalar data from State for a particular name - ! ---------------------------------------------- - - ! input/output arguments - real(r8), intent(in) :: scalar_value - integer, intent(in) :: scalar_id - type(ESMF_State), intent(inout) :: State - character(len=*), intent(in) :: flds_scalar_name - integer, intent(in) :: flds_scalar_num - integer, intent(inout) :: rc - - ! local variables - integer :: mytask - type(ESMF_Field) :: lfield - type(ESMF_VM) :: vm - real(r8), pointer :: farrayptr(:,:) - character(len=*), parameter :: subname='(state_setscalar)' - ! ---------------------------------------------- - - call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - - - rc = ESMF_SUCCESS - - call ESMF_VMGetCurrent(vm, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(subname//'after VMGetCurrent', ESMF_LOGMSG_INFO) - - call ESMF_VMGet(vm, localPet=mytask, rc=rc) - call ESMF_LogWrite(subname//'after VMGet', ESMF_LOGMSG_INFO) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - print *, trim(flds_scalar_name) - - call ESMF_LogWrite(subname//'before ESMF_StateSet', ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//'itemName:'//trim(flds_scalar_name), ESMF_LOGMSG_INFO) - !call ESMF_LogWrite(subname//'State: '//State, ESMF_LOGMSG_INFO) - !print *, 'itemName:', trim(flds_scalar_name) - !print *, 'lfield:', lfield - - call ESMF_StateGet(State, itemName=trim(flds_scalar_name), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - if (mytask == 0) then - call ESMF_LogWrite(subname//'before FieldGet', ESMF_LOGMSG_INFO) - !print *, 'lfield:', lfield - !print *, 'this farrayptr is ', farrayptr - call ESMF_FieldGet(lfield, farrayPtr = farrayptr, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then - call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - endif - farrayptr(scalar_id,1) = scalar_value - endif - - end subroutine state_setscalar - !=============================================================================== subroutine state_diagnose(State, string, rc) @@ -416,359 +197,6 @@ subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) end subroutine field_getfldptr -!=============================================================================== - - subroutine alarmInit( clock, alarm, option, & - opt_n, opt_ymd, opt_tod, RefTime, alarmname, rc) - - ! Setup an alarm in a clock - ! Notes: The ringtime sent to AlarmCreate MUST be the next alarm - ! time. If you send an arbitrary but proper ringtime from the - ! past and the ring interval, the alarm will always go off on the - ! next clock advance and this will cause serious problems. Even - ! if it makes sense to initialize an alarm with some reference - ! time and the alarm interval, that reference time has to be - ! advance forward to be >= the current time. In the logic below - ! we set an appropriate "NextAlarm" and then we make sure to - ! advance it properly based on the ring interval. - - ! input/output variables - type(ESMF_Clock) , intent(inout) :: clock ! clock - type(ESMF_Alarm) , intent(inout) :: alarm ! alarm - character(len=*) , intent(in) :: option ! alarm option - integer , optional , intent(in) :: opt_n ! alarm freq - integer , optional , intent(in) :: opt_ymd ! alarm ymd - integer , optional , intent(in) :: opt_tod ! alarm tod (sec) - type(ESMF_Time) , optional , intent(in) :: RefTime ! ref time - character(len=*) , optional , intent(in) :: alarmname ! alarm name - integer , intent(inout) :: rc ! Return code - - ! local variables - type(ESMF_Calendar) :: cal ! calendar - integer :: lymd ! local ymd - integer :: ltod ! local tod - integer :: cyy,cmm,cdd,csec ! time info - character(len=64) :: lalarmname ! local alarm name - logical :: update_nextalarm ! update next alarm - type(ESMF_Time) :: CurrTime ! Current Time - type(ESMF_Time) :: NextAlarm ! Next restart alarm time - type(ESMF_TimeInterval) :: AlarmInterval ! Alarm interval - integer :: sec - character(len=*), parameter :: subname = '(set_alarmInit): ' - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - lalarmname = 'alarm_unknown' - if (present(alarmname)) lalarmname = trim(alarmname) - ltod = 0 - if (present(opt_tod)) ltod = opt_tod - lymd = -1 - if (present(opt_ymd)) lymd = opt_ymd - - call ESMF_ClockGet(clock, CurrTime=CurrTime, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - call ESMF_TimeGet(CurrTime, yy=cyy, mm=cmm, dd=cdd, s=csec, rc=rc ) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! initial guess of next alarm, this will be updated below - if (present(RefTime)) then - NextAlarm = RefTime - else - NextAlarm = CurrTime - endif - - ! Determine calendar - call ESMF_ClockGet(clock, calendar=cal) - - ! Determine inputs for call to create alarm - selectcase (trim(option)) - - case (optNONE) - call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) - if (chkerr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .false. - - case (optNever) - call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) - if (chkerr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .false. - - case (optDate) - if (.not. present(opt_ymd)) then - call shr_sys_abort(subname//trim(option)//' requires opt_ymd') - end if - if (lymd < 0 .or. ltod < 0) then - call shr_sys_abort(subname//trim(option)//'opt_ymd, opt_tod invalid') - end if - call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call timeInit(NextAlarm, lymd, cal, ltod, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .false. - - case (optIfdays0) - if (.not. present(opt_ymd)) then - call shr_sys_abort(subname//trim(option)//' requires opt_ymd') - end if - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=opt_n, s=0, calendar=cal, rc=rc ) - if (chkerr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .true. - - case (optNSteps) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNStep) - if (.not.present(opt_n)) call shr_sys_abort(subname//trim(option)//' requires opt_n') - if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') - call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNSeconds) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNSecond) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNMinutes) - call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNMinute) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNHours) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNHour) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNDays) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNDay) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNMonths) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNMonth) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optMonthly) - call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=1, s=0, calendar=cal, rc=rc ) - if (chkerr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .true. - - case (optNYears) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optNYear) - if (.not.present(opt_n)) then - call shr_sys_abort(subname//trim(option)//' requires opt_n') - end if - if (opt_n <= 0) then - call shr_sys_abort(subname//trim(option)//' invalid opt_n') - end if - call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. - - case (optYearly) - call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=cyy, mm=1, dd=1, s=0, calendar=cal, rc=rc ) - if (chkerr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .true. - - case default - call shr_sys_abort(subname//'unknown option '//trim(option)) - - end select - - ! -------------------------------------------------------------------------------- - ! --- AlarmInterval and NextAlarm should be set --- - ! -------------------------------------------------------------------------------- - - ! --- advance Next Alarm so it won't ring on first timestep for - ! --- most options above. go back one alarminterval just to be careful - - if (update_nextalarm) then - NextAlarm = NextAlarm - AlarmInterval - do while (NextAlarm <= CurrTime) - NextAlarm = NextAlarm + AlarmInterval - enddo - endif - - alarm = ESMF_AlarmCreate( name=lalarmname, clock=clock, ringTime=NextAlarm, & - ringInterval=AlarmInterval, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - end subroutine alarmInit - -!=============================================================================== - - subroutine timeInit( Time, ymd, cal, tod, rc) - - ! Create the ESMF_Time object corresponding to the given input time, - ! given in YMD (Year Month Day) and TOD (Time-of-day) format. - ! Set the time by an integer as YYYYMMDD and integer seconds in the day - - ! input/output parameters: - type(ESMF_Time) , intent(inout) :: Time ! ESMF time - integer , intent(in) :: ymd ! year, month, day YYYYMMDD - type(ESMF_Calendar) , intent(in) :: cal ! ESMF calendar - integer , intent(in) :: tod ! time of day in seconds - integer , intent(out) :: rc - - ! local variables - integer :: year, mon, day ! year, month, day as integers - integer :: tdate ! temporary date - integer :: date ! coded-date (yyyymmdd) - character(len=*), parameter :: subname='(timeInit)' - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - if ( (ymd < 0) .or. (tod < 0) .or. (tod > SecPerDay) )then - call shr_sys_abort( subname//'ERROR yymmdd is a negative number or time-of-day out of bounds' ) - end if - - tdate = abs(date) - year = int(tdate/10000) - if (date < 0) year = -year - mon = int( mod(tdate,10000)/ 100) - day = mod(tdate, 100) - - call ESMF_TimeSet( Time, yy=year, mm=mon, dd=day, s=tod, calendar=cal, rc=rc ) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - end subroutine timeInit - !=============================================================================== logical function chkerr(rc, line, file) @@ -786,9 +214,4 @@ logical function chkerr(rc, line, file) endif end function chkerr - - - - ! FROM - end module lnd_shr_methods diff --git a/src/cpl/lilac/shr_utils_mod.F90 b/src/cpl/lilac/shr_utils_mod.F90 deleted file mode 100644 index 90aba85801..0000000000 --- a/src/cpl/lilac/shr_utils_mod.F90 +++ /dev/null @@ -1,47 +0,0 @@ -module shr_utils_mod - - use shr_sys_mod, only : shr_sys_abort - implicit none - private - - public :: shr_utils_ChkErr - - character(*), parameter :: u_FILE_u = __FILE__ - -!========================================================= -contains -!========================================================= - - logical function shr_utils_ChkErr(rc, line, file, mpierr) - - use mpi , only : MPI_ERROR_STRING, MPI_MAX_ERROR_STRING, MPI_SUCCESS - use ESMF, only : ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU, ESMF_LOGMSG_INFO - use ESMF, only : ESMF_FAILURE, ESMF_LogWrite - - ! input/output arguments - integer , intent(in) :: rc - integer , intent(in) :: line - character(len=*) , intent(in) :: file - logical, optional , intent(in) :: mpierr - - ! local variables - character(MPI_MAX_ERROR_STRING) :: lstring - integer :: dbrc, lrc, len, ierr - !------------------------------------------ - - shr_utils_ChkErr = .false. - lrc = rc - if (present(mpierr) .and. mpierr) then - if (rc == MPI_SUCCESS) return - call MPI_ERROR_STRING(rc, lstring, len, ierr) - call ESMF_LogWrite("ERROR: "//trim(lstring), ESMF_LOGMSG_INFO, line=line, file=file, rc=dbrc) - lrc = ESMF_FAILURE - endif - - if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=line, file=file)) then - shr_utils_ChkErr = .true. - endif - - end function shr_utils_ChkErr - -end module shr_utils_mod From 0011114aff6dc50d85c19effe13aec47cd7604f2 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 27 Nov 2019 19:09:07 -0700 Subject: [PATCH 0428/1973] incremental changes to expose what still needs to be done for the lilac cap --- src/cpl/lilac/lnd_comp_esmf.F90 | 161 ++++++++------------------- src/cpl/lilac/lnd_import_export.F90 | 164 +++++++++------------------- 2 files changed, 99 insertions(+), 226 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 87db539ad6..a1317fb467 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -4,29 +4,37 @@ module lnd_comp_esmf ! This is the ESMF cap for CTSM !---------------------------------------------------------------------------- + ! External libraries use ESMF + use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE use mct_mod , only : mct_world_init, mct_world_clean, mct_die + use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 + use perf_mod , only : t_startf, t_stopf, t_barrierf + + ! ctsm and share code use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl use shr_sys_mod , only : shr_sys_abort - use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit - use shr_orb_mod , only : shr_orb_decl + use shr_file_mod , only : shr_file_setLogUnit, shr_file_getLogUnit + use shr_orb_mod , only : shr_orb_decl, shr_orb_params use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date use spmdMod , only : masterproc, mpicom, spmd_init use decompMod , only : bounds_type, ldecomp, get_proc_bounds use domainMod , only : ldomain use controlMod , only : control_setNL use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use clm_varctl , only : single_column, clm_varctl_set, iulog + use clm_varctl , only : clm_varctl_set, iulog, finidat use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_time_manager , only : set_timemgr_init, advance_timestep use clm_time_manager , only : set_nextsw_cday, update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size - use clm_time_manager , only : get_curr_date, get_curr_calday + use clm_time_manager , only : get_curr_date, get_curr_calday, set_nextsw_cday use clm_initializeMod , only : initialize1, initialize2 use clm_driver , only : clm_drv - use perf_mod , only : t_startf, t_stopf, t_barrierf use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_diagnose + use spmdMod , only : masterproc, spmd_init + use glc_elevclass_mod , only : glc_elevclass_init implicit none private ! By default make data private except @@ -40,15 +48,14 @@ module lnd_comp_esmf ! Private module data !-------------------------------------------------------------------------- - integer , parameter :: dbug_flag = 6 - type(ESMF_Field), public, save :: field + integer , parameter :: dbug_flag = 6 + type(ESMF_Field), public, save :: field - logical :: glc_present = .false. ! .true. => running with a non-stubGLC model - logical :: rof_prognostic = .false. ! .true. => running with a prognostic ROF model - integer, parameter :: memdebug_level=1 - integer, parameter :: dbug = 1 - character(*) ,parameter :: modName = "lnd_comp_esmf" - character(*),parameter :: u_FILE_u = & + integer :: glc_nec = 10 ! number of glc elevation classes + integer, parameter :: memdebug_level=1 + integer, parameter :: dbug = 1 + character(*) , parameter :: modName = "lnd_comp_esmf" + character(*), parameter :: u_FILE_u = & __FILE__! type(ESMF_Mesh) :: Emesh, EMeshTemp, lnd_mesh ! esmf meshes @@ -91,23 +98,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Initialize land surface model and obtain relevant atmospheric model arrays ! back from (i.e. albedos, surface temperature and snow cover over land). - use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel - use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel - use shr_file_mod , only : shr_file_getUnit, shr_file_setIO - use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday - use clm_initializeMod , only : initialize1, initialize2 - use clm_varctl , only : finidat,single_column, clm_varctl_set, noland - use clm_varctl , only : inst_index, inst_suffix, inst_name - use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use controlMod , only : control_setNL - use spmdMod , only : masterproc, spmd_init - use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst - use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE - use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 - use glc_elevclass_mod , only : glc_elevclass_init - use shr_orb_mod , only : shr_orb_params - ! input/output variables type(ESMF_GridComp) :: comp ! CLM gridded component type(ESMF_State) :: import_state ! CLM import state @@ -144,7 +134,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type logical :: atm_aero ! Flag if aerosol data sent from atm model integer :: lbnum ! input to memory diagnostic - integer :: shrlogunit,shrloglev ! old values for log unit and log level + integer :: shrlogunit ! old values for log unit and log level integer :: logunit ! original log unit type(bounds_type) :: bounds ! bounds integer :: nfields @@ -183,7 +173,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) type(ESMF_FieldBundle) :: c2l_fb type(ESMF_FieldBundle) :: l2c_fb type(ESMF_State) :: importState, exportState - integer :: glc_nec = 10 ! number of glc elevation classes integer :: compid ! component id character(len=32), parameter :: sub = 'lnd_init' character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" @@ -251,35 +240,23 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !--- Log File --- !------------------------------------------------------------------------ - inst_name = 'LND' - inst_index = 1 - inst_suffix = "" + inst_name = 'LND'; inst_index = 1; inst_suffix = "" ! Initialize io log unit - !! TODO: Put this in a subroutine..... call shr_file_getLogUnit (shrlogunit) if (masterproc) then - inquire(file='lnd_modelio.nml'//trim(inst_suffix),exist=exists) - if (exists) then - iulog = shr_file_getUnit() - call shr_file_setIO('lnd_modelio.nml'//trim(inst_suffix),iulog) - end if write(iulog,format) "CLM land model initialization" else iulog = shrlogunit end if - - call shr_file_getLogLevel(shrloglev) call shr_file_setLogUnit (iulog) !------------------------------------------------------------------------ !--- Orbital Values --- !------------------------------------------------------------------------ - ! TODO: orbital values should be provided by lilac - but for now lets use defaults - !! hard wire these these in and we can decide on maybe having a - !namelist/ + !! hard wire these these in and we can decide on maybe having a namelist/ !call shr_cal_date2ymd(ymd,year,month,day) !orb_cyear = orb_iyear + (year - orb_iyear_align) @@ -370,8 +347,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call clm_varctl_set(caseid_in=caseid, nsrest_in=nsrest) call ESMF_LogWrite(subname//"default values for run control variables are set...", ESMF_LOGMSG_INFO) - - !---------------------- ! Initialize glc_elevclass module !---------------------- @@ -390,9 +365,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! obtain global index array for just land points which includes mask=0 or ocean points call get_proc_bounds( bounds ) - !print ,* "bound is :", bounds - !print ,* "bounds%begg :", bounds%begg - !print ,* "bounds%endg : ", bounds%endg nlnd = bounds%endg - bounds%begg + 1 allocate(gindex_lnd(nlnd)) !print ,* "nlnd is :", nlnd @@ -520,28 +492,15 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb/), rc=rc) !call ESMF_StateAdd(exportState, fieldbundleList = (/l2c_fb/), rc=rc) - - - - - - - - - - !-------------------------------- ! Create land export state !-------------------------------- call ESMF_LogWrite(subname//"Creating land export state", ESMF_LOGMSG_INFO) - ! FIXME (NS, 2019-07-30) - ! FIX THIS EXPORT STATES!!!!!! MAYBE REWRITE WITH THE ORIGINAL STRUCTURE - ! IN MIND - ! Fill in export state at end of initialization - call export_fields(comp, bounds, glc_present, rof_prognostic, & - water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) + call export_fields(comp, bounds, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -556,7 +515,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out end if - ! Set nextsw_cday call set_nextsw_cday( nextsw_cday ) @@ -584,11 +542,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return endif - ! Reset shr logging to original values - - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) - #if (defined _MEMTRACE) if(masterproc) then write(iulog,*) TRIM(Sub) // ':end::' @@ -631,10 +584,6 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! Run CTSM !------------------------ - use clm_instMod , only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst - use lnd_import_export , only : import_fields, export_fields - use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst - ! input/output variables type(ESMF_GridComp) :: gcomp ! CLM gridded component type(ESMF_State) :: import_state ! CLM import state @@ -675,21 +624,13 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) real(r8) :: eccf ! earth orbit eccentricity factor type(bounds_type) :: bounds ! bounds character(len=32) :: rdate ! date char string for restart file names - integer :: shrlogunit ! original log unit character(len=*),parameter :: subname=trim(modName)//':[lnd_run] ' - character(*),parameter :: F02 = "('[lnd_comp_esmf] ',a, d26.19)" !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - call shr_file_getLogUnit (shrlogunit) - call shr_file_setLogUnit (iulog) - call ESMF_LogWrite(subname//' shr_file_getLogunits....', ESMF_LOGMSG_INFO) - #if (defined _MEMTRACE) if(masterproc) then lbnum=1 @@ -717,17 +658,19 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) !if (ChkErr(rc,__LINE__,u_FILE_u)) return !read(cvalue,*) mvelpp + !-------------------------------- + ! Get processor bounds + !-------------------------------- + + call get_proc_bounds(bounds) + !-------------------------------- ! Unpack import state !-------------------------------- call t_startf ('lc_lnd_import') - - call get_proc_bounds(bounds) - call ESMF_LogWrite(subname//'after get_proc_bounds', ESMF_LOGMSG_INFO) - call import_fields( gcomp , bounds, glc_present, rof_prognostic, atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc ) + call import_fields( gcomp, bounds, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf ('lc_lnd_import') !-------------------------------- @@ -843,27 +786,25 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) if (masterproc) then write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' - write(iulog,* ) 'doalb : ', doalb + write(iulog,*) 'doalb : ', doalb write(iulog,*) 'call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, decl' write(iulog,*) 'call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, decl' - write(iulog,F02) 'calday is : ', calday - write(iulog,F02) 'eccen is : ', eccen - write(iulog,F02) 'mvelpp is : ', mvelpp - write(iulog,F02) 'lambm0 is : ', lambm0 - write(iulog,F02) 'obliqr is : ', obliqr + write(iulog,F02) 'calday is : ', calday + write(iulog,F02) 'eccen is : ', eccen + write(iulog,F02) 'mvelpp is : ', mvelpp + write(iulog,F02) 'lambm0 is : ', lambm0 + write(iulog,F02) 'obliqr is : ', obliqr write(iulog,F02) 'clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic)' - write(iulog,F02) 'declin is : ', declin - write(iulog,F02) 'declinp1 is : ', declinp1 - write(iulog,F02) 'rof_prognostic : ', rof_prognostic + write(iulog,F02) 'declin is : ', declin + write(iulog,F02) 'declinp1 is : ', declinp1 write(iulog,* ) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' end if call t_stopf ('shr_orb_decl') - call t_startf ('ctsm_run') - ! Restart File - use nexttimestr rather than currtimestr here since that is the time at the end of ! the timestep and is preferred for restart file names + ! TODO: is this correct for lilac? call ESMF_ClockGetNextTime(clock, nextTime=nextTime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -871,8 +812,8 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync, mon_sync, day_sync, tod_sync - call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) - + call t_startf ('ctsm_run') + call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic=.false.) call t_stopf ('ctsm_run') !-------------------------------- @@ -880,12 +821,8 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) !-------------------------------- call t_startf ('lc_lnd_export') - - call export_fields(gcomp, bounds, glc_present, rof_prognostic, & - water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) - !call export_fields(exportState, bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - + call export_fields(gcomp, bounds, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call t_stopf ('lc_lnd_export') !-------------------------------- @@ -933,12 +870,6 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! end if !end if - !-------------------------------- - ! Reset shr logging to my original values - !-------------------------------- - - call shr_file_setLogUnit (shrlogunit) - call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) #if (defined _MEMTRACE) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 9f8c7c0d5c..3dc2dd66f4 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -5,22 +5,19 @@ module lnd_import_export use shr_infnan_mod , only : isnan => shr_infnan_isnan use shr_string_mod , only : shr_string_listGetName, shr_string_listGetNum use shr_sys_mod , only : shr_sys_abort - use clm_varctl , only : iulog + use shr_const_mod , only : SHR_CONST_TKFRZ, fillvalue=>SHR_CONST_SPVAL + use clm_varctl , only : iulog, co2_ppmv, ndep_from_cpl + use clm_varcon , only : rair, o2_molar_const use clm_time_manager , only : get_nstep + use spmdMod , only : masterproc use decompmod , only : bounds_type use lnd2atmType , only : lnd2atm_type use lnd2glcMod , only : lnd2glc_type use atm2lndType , only : atm2lnd_type - use glc2lndMod , only : glc2lnd_type use domainMod , only : ldomain - use spmdMod , only : masterproc - use seq_drydep_mod , only : seq_drydep_readnl, n_drydep, seq_drydep_init - use shr_megan_mod , only : shr_megan_readnl, shr_megan_mechcomps_n - use shr_fire_emis_mod , only : shr_fire_emis_readnl, shr_fire_emis_mechcomps_n - use shr_carma_mod , only : shr_carma_readnl - use shr_ndep_mod , only : shr_ndep_readnl - use glc_elevclass_mod , only : glc_elevclass_init + use shr_megan_mod , only : shr_megan_mechcomps_n ! TODO: need to add a namelist read nere use lnd_shr_methods , only : chkerr + use clm_instMod , only : atm2lnd_inst, lnd2atm_inst, water_inst implicit none private ! except @@ -45,18 +42,20 @@ module lnd_import_export integer :: fldsFrLnd_num = 0 type (fld_list_type) :: fldsToLnd(fldsMax) type (fld_list_type) :: fldsFrLnd(fldsMax) - integer, parameter :: gridTofieldMap = 2 ! ungridded dimension is innermost + integer, parameter :: gridTofieldMap = 2 ! ungridded dimension is innermost + + logical :: glc_present = .false. ! .true. => running with a non-stubGLC model + logical :: rof_prognostic = .false. ! .true. => running with a prognostic ROF model ! from atm->lnd - integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn + integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn ! from lnd->atm - integer :: drydep_nflds ! number of dry deposition velocity fields lnd-> atm - integer :: megan_nflds ! number of MEGAN voc fields from lnd-> atm - integer :: emis_nflds ! number of fire emission fields from lnd-> atm + integer :: drydep_nflds ! number of dry deposition velocity fields lnd-> atm + integer :: emis_nflds ! number of fire emission fields from lnd-> atm - integer :: glc_nec = 10 ! number of glc elevation classes - integer, parameter :: debug = 1 ! internal debug level + integer :: glc_nec = 10 ! number of glc elevation classes + integer, parameter :: debug = 1 ! internal debug level character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" character(*),parameter :: F02 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d26.19)" @@ -64,44 +63,28 @@ module lnd_import_export __FILE__ character(*),parameter :: modname = "[lnd_import_export]: " - !=============================================================================== +!=============================================================================== contains - !=============================================================================== +!=============================================================================== - subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & - atm2lnd_inst, glc2lnd_inst, wateratm2lndbulk_inst, rc) + subroutine import_fields( gcomp, bounds, rc) !--------------------------------------------------------------------------- ! Convert the input data from the mediator to the land model !--------------------------------------------------------------------------- - use clm_varctl , only: co2_type, co2_ppmv, use_c13, ndep_from_cpl - use clm_varcon , only: rair, o2_molar_const, c13ratio - use shr_const_mod , only: SHR_CONST_TKFRZ - use Wateratm2lndBulkType , only: wateratm2lndbulk_type - ! input/output variabes - type(ESMF_GridComp) :: gcomp - type(bounds_type) , intent(in) :: bounds ! bounds - logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model - logical , intent(in) :: rof_prognostic ! .true. => running with a prognostic ROF model - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! clm internal input data type - type(glc2lnd_type) , intent(inout) :: glc2lnd_inst ! clm internal input data type - type(Wateratm2lndbulk_type) , intent(inout) :: wateratm2lndbulk_inst - integer , intent(out) :: rc + type(ESMF_GridComp) :: gcomp + type(bounds_type) , intent(in) :: bounds ! bounds + integer , intent(out) :: rc ! local variables type(ESMF_State) :: importState - type(ESMF_StateItem_Flag) :: itemFlag - real(r8), pointer :: dataPtr(:) - character(len=128) :: fldname integer :: num integer :: begg, endg ! bounds integer :: g,i,k ! indices real(r8) :: e ! vapor pressure (Pa) real(r8) :: qsat ! saturation specific humidity (kg/kg) - real(r8) :: co2_ppmv_diag(bounds%begg:bounds%endg) ! temporary - real(r8) :: co2_ppmv_prog(bounds%begg:bounds%endg) ! temporary real(r8) :: co2_ppmv_val ! temporary real(r8) :: esatw ! saturation vapor pressure over water (Pa) real(r8) :: esati ! saturation vapor pressure over ice (Pa) @@ -117,13 +100,8 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s real(r8) :: forc_noy(bounds%begg:bounds%endg) real(r8) :: forc_nhx(bounds%begg:bounds%endg) - real(r8) :: frac_grc(bounds%begg:bounds%endg, 0:glc_nec) real(r8) :: topo_grc(bounds%begg:bounds%endg, 0:glc_nec) - real(r8) :: hflx_grc(bounds%begg:bounds%endg, 0:glc_nec) - real(r8) :: icemask_grc(bounds%begg:bounds%endg) - real(r8) :: icemask_coupled_fluxes_grc(bounds%begg:bounds%endg) character(len=*), parameter :: subname='(lnd_import_export:import_fields)' - !character(len=* ) , parameter :: subname=trim(modname ) //' : (import_fields) ' ! Constants to compute vapor pressure parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & @@ -177,7 +155,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_getimport(importState, 'Sa_ptem', bounds, output=atm2lnd_inst%forc_th_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_shum', bounds, output=wateratm2lndbulk_inst%forc_q_not_downscaled_grc, rc=rc) + call state_getimport(importState, 'Sa_shum', bounds, output=water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'Sa_pbot', bounds, output=atm2lnd_inst%forc_pbot_not_downscaled_grc, rc=rc) @@ -287,7 +265,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! Set force flood back from river to 0 !-------------------------- - wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 + water_inst%wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 !-------------------------- ! Derived quantities @@ -295,7 +273,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & do g = begg, endg forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) - forc_q = wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) + forc_q = water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] @@ -316,8 +294,8 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) - wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) - wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) + water_inst%wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) + water_inst%wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) if (forc_t > SHR_CONST_TKFRZ) then @@ -332,13 +310,13 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & if ((forc_rainc(g)+forc_rainl(g)) > 0._r8) then forc_q = 0.95_r8*qsat !forc_q = qsat - wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q + water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q endif endif - wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) - wateratm2lndbulk_inst%volr_grc(g) = 0._r8 - wateratm2lndbulk_inst%volrmch_grc(g) = 0._r8 + water_inst%wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) + water_inst%wateratm2lndbulk_inst%volr_grc(g) = 0._r8 + water_inst%wateratm2lndbulk_inst%volrmch_grc(g) = 0._r8 end do !-------------------------- @@ -359,7 +337,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & ' from the atmosphere model is negative or zero' ) end if - if ( wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then + if ( water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then call shr_sys_abort( subname//& ' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) end if @@ -373,42 +351,28 @@ end subroutine import_fields !============================================================================== - subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & - waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) + subroutine export_fields(gcomp, bounds, rc) !------------------------------- ! Pack the export state !------------------------------- - use Waterlnd2atmBulkType , only: waterlnd2atmbulk_type - ! input/output variables - type(ESMF_GridComp) :: gcomp - type(bounds_type) , intent(in) :: bounds ! bounds - logical , intent(in) :: glc_present - logical , intent(in) :: rof_prognostic - type(waterlnd2atmbulk_type) , intent(inout) :: waterlnd2atmbulk_inst - type(lnd2atm_type) , intent(inout) :: lnd2atm_inst ! land to atmosphere exchange data type - type(lnd2glc_type) , intent(inout) :: lnd2glc_inst ! land to atmosphere exchange data type - integer , intent(out) :: rc - - !type(datawrapper) :: wrap2 + type(ESMF_GridComp) :: gcomp + type(bounds_type) , intent(in) :: bounds ! bounds + integer , intent(out) :: rc + ! local variables - type(ESMF_State) :: exportState - integer :: i, g, num - real(r8) :: array(bounds%begg:bounds%endg) + type(ESMF_State) :: exportState + integer :: i, g, num + real(r8) :: array(bounds%begg:bounds%endg) character(len=*), parameter :: subname='(lnd_import_export:export_fields)' !--------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! Get export state - !call NUOPC_ModelGet(gcomp, exportState=exportState, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Get export state (ESMF) call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc) ! do we need the clock now? - !call ESMF_GridCompGet(gcomp, exportState, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ----------------------- @@ -425,8 +389,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_setexport(exportState, 'Sl_t', bounds, input=lnd2atm_inst%t_rad_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_snowh', bounds, & - input=waterlnd2atmbulk_inst%h2osno_grc, rc=rc) + call state_setexport(exportState, 'Sl_snowh', bounds, input=water_inst%waterlnd2atmbulk_inst%h2osno_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_setexport(exportState, 'Sl_avsdr', bounds, input=lnd2atm_inst%albd_grc(bounds%begg:,1), rc=rc) @@ -444,7 +407,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_setexport(exportState, 'Sl_tref', bounds, input=lnd2atm_inst%t_ref2m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_qref', bounds, input=waterlnd2atmbulk_inst%q_ref2m_grc, rc=rc) + call state_setexport(exportState, 'Sl_qref', bounds, input=water_inst%waterlnd2atmbulk_inst%q_ref2m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_setexport(exportState, 'Sl_u10', bounds, input=lnd2atm_inst%u_ref10m_grc, rc=rc) @@ -465,7 +428,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_setexport(exportState, 'Fall_lwup', bounds, input=lnd2atm_inst%eflx_lwrad_out_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_evap', bounds, input=waterlnd2atmbulk_inst%qflx_evap_tot_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'Fall_evap', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_evap_tot_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_setexport(exportState, 'Fall_swnet', bounds, input=lnd2atm_inst%fsa_grc, rc=rc) @@ -493,8 +456,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_setexport(exportState, 'Sl_fv', bounds, input=lnd2atm_inst%fv_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_soilw', bounds, & - input=waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) + call state_setexport(exportState, 'Sl_soilw', bounds, input=water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! dry dep velocities @@ -529,51 +491,33 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! ----------------------- ! surface runoff is the sum of qflx_over, qflx_h2osfc_surf - ! do g = bounds%begg,bounds%endg - ! array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) - ! end do - call state_setexport(exportState, 'Flrl_rofsur', bounds, input=waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) + ! do g = bounds%begg,bounds%endg + ! array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) + ! end do + + call state_setexport(exportState, 'Flrl_rofsur', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain do g = bounds%begg,bounds%endg - array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) + array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) end do call state_setexport(exportState, 'Flrl_rofsub', bounds, input=array, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! qgwl sent individually to coupler - call state_setexport(exportState, 'Flrl_rofgwl', bounds, input=waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) + call state_setexport(exportState, 'Flrl_rofgwl', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ice sent individually to coupler - call state_setexport(exportState, 'Flrl_rofi', bounds, input=waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) + call state_setexport(exportState, 'Flrl_rofi', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! irrigation flux to be removed from main channel storage (negative) - call state_setexport(exportState, 'Flrl_irrig', bounds, input=waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'Flrl_irrig', bounds, input=water_inst%waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ----------------------- - ! output to glc - ! ----------------------- - - ! We could avoid setting these fields if glc_present is .false., if that would - ! help with performance. (The downside would be that we wouldn't have these fields - ! available for diagnostic purposes or to force a later T compset with dlnd.) - - do num = 0,glc_nec - call state_setexport(exportState, 'Sl_tsrf_elev', bounds, input=lnd2glc_inst%tsrf_grc(:,num), & - ungridded_index=num+1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_topo_elev', bounds, input=lnd2glc_inst%topo_grc(:,num), & - ungridded_index=num+1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Flgl_qice_elev', bounds, input=lnd2glc_inst%qice_grc(:,num), & - ungridded_index=num+1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - end subroutine export_fields !=============================================================================== @@ -736,8 +680,6 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index ! Map input array to export state field ! ---------------------------------------------- - use shr_const_mod, only : fillvalue=>SHR_CONST_SPVAL - ! input/output variables type(ESMF_State) , intent(inout) :: state type(bounds_type) , intent(in) :: bounds From 94dda7797c271fa023712845a274e4c4e477579d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 28 Nov 2019 10:17:05 -0700 Subject: [PATCH 0429/1973] more changes to clarify time manager input from lilac driver --- src/cpl/lilac/lnd_comp_esmf.F90 | 436 ++++++++++++++++---------------- src/main/clm_initializeMod.F90 | 5 +- src/main/controlMod.F90 | 25 +- 3 files changed, 245 insertions(+), 221 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index a1317fb467..98535e47f4 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -14,7 +14,7 @@ module lnd_comp_esmf ! ctsm and share code use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl use shr_sys_mod , only : shr_sys_abort - use shr_file_mod , only : shr_file_setLogUnit, shr_file_getLogUnit + use shr_file_mod , only : shr_file_setLogUnit, shr_file_getLogUnit use shr_orb_mod , only : shr_orb_decl, shr_orb_params use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date use spmdMod , only : masterproc, mpicom, spmd_init @@ -22,7 +22,7 @@ module lnd_comp_esmf use domainMod , only : ldomain use controlMod , only : control_setNL use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use clm_varctl , only : clm_varctl_set, iulog, finidat + use clm_varctl , only : clm_varctl_set, iulog, finidat use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_time_manager , only : set_timemgr_init, advance_timestep @@ -34,7 +34,7 @@ module lnd_comp_esmf use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_diagnose use spmdMod , only : masterproc, spmd_init - use glc_elevclass_mod , only : glc_elevclass_init + use glc_elevclass_mod , only : glc_elevclass_init ! TODO: is this needed? implicit none private ! By default make data private except @@ -48,16 +48,12 @@ module lnd_comp_esmf ! Private module data !-------------------------------------------------------------------------- - integer , parameter :: dbug_flag = 6 - type(ESMF_Field), public, save :: field - - integer :: glc_nec = 10 ! number of glc elevation classes - integer, parameter :: memdebug_level=1 - integer, parameter :: dbug = 1 - character(*) , parameter :: modName = "lnd_comp_esmf" - character(*), parameter :: u_FILE_u = & - __FILE__! - type(ESMF_Mesh) :: Emesh, EMeshTemp, lnd_mesh ! esmf meshes + integer :: glc_nec = 10 ! fixed # of glc elevation classes + integer, parameter :: memdebug_level=1 + integer, parameter :: dbug = 1 + character(*), parameter :: modName = "lnd_comp_esmf" + character(*), parameter :: u_FILE_u = & + __FILE__ !=============================================================================== contains @@ -77,16 +73,18 @@ subroutine lnd_register(comp, rc) print *, "in lnd register routine" rc = ESMF_SUCCESS + call ESMF_LogSet ( flush =.true.) call ESMF_LogWrite(subname//"lnd gridcompset entry points setting ....!", ESMF_LOGMSG_INFO) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, lnd_init, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, lnd_run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, lnd_final, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//"lnd gridcompset entry points finished!", ESMF_LOGMSG_INFO) end subroutine lnd_register @@ -106,77 +104,72 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) integer, intent(out) :: rc ! Return code ! local variable + type(ESMF_Mesh) :: lnd_mesh + character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file + integer :: ierr integer :: mpicom_lnd, mpicom_vm, gsize - type(ESMF_ArraySpec) :: arrayspec type(ESMF_DistGrid) :: distgrid - type(ESMF_Array) :: dom, l2x, x2l type(ESMF_VM) :: vm - integer :: lsize ! size of attribute vector - integer :: g,i,j ! indices - integer :: dtime_sync ! coupling time-step from the input synchronization clock - integer :: dtime_clm ! clm time-step - logical :: exists ! true if file exists - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - character(len=CL) :: caseid ! case identifier name - character(len=CL) :: ctitle ! case description title - character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) - character(len=CL) :: calendar ! calendar type name - character(len=CL) :: hostname ! hostname of machine running on - character(len=CL) :: version ! Model version - character(len=CL) :: username ! user running the model - integer :: nsrest ! clm restart type - integer :: ref_ymd ! reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (sec) - integer :: start_ymd ! start date (YYYYMMDD) - integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type - logical :: atm_aero ! Flag if aerosol data sent from atm model - integer :: lbnum ! input to memory diagnostic - integer :: shrlogunit ! old values for log unit and log level - integer :: logunit ! original log unit - type(bounds_type) :: bounds ! bounds + integer :: lsize ! size of attribute vector + integer :: g,i,j ! indices + logical :: exists ! true if file exists + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + character(len=CL) :: caseid ! case identifier name + character(len=CL) :: ctitle ! case description title + character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) + character(len=CL) :: calendar ! calendar type name + character(len=CL) :: hostname ! hostname of machine running on + character(len=CL) :: version ! Model version + character(len=CL) :: username ! user running the model + integer :: nsrest ! clm restart type + integer :: ref_ymd ! reference date (YYYYMMDD) + integer :: ref_tod ! reference time of day (sec) + integer :: start_ymd ! start date (YYYYMMDD) + integer :: start_tod ! start time of day (sec) + integer :: stop_ymd ! stop date (YYYYMMDD) + integer :: stop_tod ! stop time of day (sec) + logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type + logical :: atm_aero ! Flag if aerosol data sent from atm model + integer :: lbnum ! input to memory diagnostic + integer :: shrlogunit ! old values for log unit and log level + integer :: logunit ! original log unit + type(bounds_type) :: bounds ! bounds integer :: nfields - real(R8), pointer :: fptr(:, :) - integer :: ierr integer :: ncomps = 1 - integer, pointer :: comps(:) ! array with component ids - integer, pointer :: comms(:) ! array with mpicoms + integer, pointer :: comps(:) ! array with component ids + integer, pointer :: comms(:) ! array with mpicoms character(len=32), allocatable :: compLabels(:) - integer,allocatable :: comp_id(:) ! for pio init2 - character(len=64),allocatable :: comp_name(:) ! for pio init2 - integer,allocatable :: comp_comm(:) ! for pio_init2 - logical,allocatable :: comp_iamin(:) ! for pio init2 - integer,allocatable :: comp_comm_iam(:) ! for pio_init2 - integer :: ymd ! CTSM current date (YYYYMMDD) - integer :: orb_iyear_align ! associated with model year - integer :: orb_cyear ! orbital year for current orbital computation - integer :: orb_iyear ! orbital year for current orbital computation - integer :: orb_eccen ! orbital year for current orbital computation - integer :: yy, mm ,dd , curr_tod, curr_ymd ! orbital year for current orbital computation - type(ESMF_Time) :: currTime ! Current time - type(ESMF_Time) :: startTime ! Start time - type(ESMF_Time) :: stopTime ! Stop time - type(ESMF_Time) :: refTime ! Ref time + integer,allocatable :: comp_id(:) ! for pio init2 + character(len=64),allocatable :: comp_name(:) ! for pio init2 + integer,allocatable :: comp_comm(:) ! for pio_init2 + logical,allocatable :: comp_iamin(:) ! for pio init2 + integer,allocatable :: comp_comm_iam(:) ! for pio_init2 + integer :: ymd ! CTSM current date (YYYYMMDD) + integer :: orb_iyear_align ! associated with model year + integer :: orb_cyear ! orbital year for current orbital computation + integer :: orb_iyear ! orbital year for current orbital computation + integer :: orb_eccen ! orbital year for current orbital computation + integer :: dtime_lilac ! coupling time-step from the input lilac clock + integer :: curr_tod, curr_ymd + integer :: yy, mm, dd + type(ESMF_Time) :: currTime ! Current time + type(ESMF_Time) :: startTime ! Start time + type(ESMF_Time) :: stopTime ! Stop time + type(ESMF_Time) :: refTime ! Ref time type(ESMF_TimeInterval) :: timeStep - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar - type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type - integer, pointer :: gindex(:) ! global index space for land and ocean points - integer, pointer :: gindex_lnd(:) ! global index space for just land points - integer, pointer :: gindex_ocn(:) ! global index space for just ocean points - character(ESMF_MAXSTR) :: cvalue ! config data - integer :: nlnd, nocn ! local size ofarrays - integer :: n ! indices - integer :: year, month, day - integer :: dtime ! time step increment (sec) + type(ESMF_Calendar) :: esmf_calendar ! esmf calendar + type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type + integer, pointer :: gindex(:) ! global index space for land and ocean points + integer, pointer :: gindex_lnd(:) ! global index space for just land points + integer, pointer :: gindex_ocn(:) ! global index space for just ocean points + integer :: nlnd, nocn ! local size ofarrays + integer :: n ! indices + integer :: dtime ! time step increment (sec) type(ESMF_FieldBundle) :: c2l_fb type(ESMF_FieldBundle) :: l2c_fb type(ESMF_State) :: importState, exportState - integer :: compid ! component id - character(len=32), parameter :: sub = 'lnd_init' - character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" - character(len=*), parameter :: subname=trim(modName)//': [lnd_init_lilac_cap] ' + integer :: compid ! component id + character(len=*), parameter :: subname=trim(modName)//': [lnd_init] ' !------------------------------------------------------------------------ rc = ESMF_SUCCESS @@ -245,7 +238,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Initialize io log unit call shr_file_getLogUnit (shrlogunit) if (masterproc) then - write(iulog,format) "CLM land model initialization" + write(iulog,*) trim(subname) // "CLM land model initialization" else iulog = shrlogunit end if @@ -274,12 +267,12 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !if ((debug >1) .and. (masterproc)) then if (masterproc) then - write(iulog,*) 'shr_obs_params is setting these:', eccen - write(iulog,*) 'eccen is : ', eccen - write(iulog,*) 'mvelpp is : ', mvelpp + write(iulog,*) trim(subname) // 'shr_obs_params is setting these:', eccen + write(iulog,*) trim(subname) // 'eccen is : ', eccen + write(iulog,*) trim(subname) // 'mvelpp is : ', mvelpp - write(iulog,*) 'lambm0 is : ', lambm0 - write(iulog,*) 'obliqr is : ', obliqr + write(iulog,*) trim(subname) // 'lambm0 is : ', lambm0 + write(iulog,*) trim(subname) // 'obliqr is : ', obliqr end if !---------------------- @@ -287,14 +280,16 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- call control_setNL("lnd_in") + ! TODO: how do we set case_name and nsrest - should we hardwire for now? + caseid = 'test_lilac' + nsrest = nsrStartup + !---------------------- - ! Get properties from clock + ! Initialize module variables in clm_time_manger.F90 !---------------------- - call ESMF_ClockGet( clock, & - currTime=currTime, startTime=startTime, stopTime=stopTime, refTime=RefTime, & - timeStep=timeStep, rc=rc) + currTime=currTime, startTime=startTime, stopTime=stopTime, refTime=RefTime, timeStep=timeStep, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=curr_tod, rc=rc ) @@ -324,20 +319,13 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) end if - ! TODO: how do we set case_name and nsrest - should we hardwire for now? - caseid = 'test_lilac' - nsrest = nsrStartup - call ESMF_LogWrite(subname//"time manager Initialized....", ESMF_LOGMSG_INFO) - - !---------------------- - ! Initialize CTSM time manager - !---------------------- + ! The following sets the module variables in clm_time_mamanger.F90 - BUT DOES NOT intialize the + ! clock. Routine timemgr_init (called by initialize1) initializes the clock using the module variables + ! that have been set via calls to set_timemgr_init. call set_timemgr_init( & calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & - stop_tod_in=stop_tod) - call ESMF_LogWrite(subname//"time manager is set now!", ESMF_LOGMSG_INFO) + ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, stop_tod_in=stop_tod) !---------------------- ! Read namelist, grid and surface data @@ -350,17 +338,38 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- ! Initialize glc_elevclass module !---------------------- - call glc_elevclass_init(glc_nec) + + call glc_elevclass_init(glc_nec) ! TODO: is this needed still? !---------------------- - ! Initialize1 + ! Call initialize1 !---------------------- - ! note that the memory for gindex_ocn will be allocated in the following call - call initialize1(gindex_ocn) - ! call initialize1() + call ESMF_TimeIntervalGet(timeStep, s=dtime_lilac, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (masterproc) then + write(iulog,*)'dtime_lilac= ',dtime_lilac + end if + + ! Note that routine controlMod.F90 will initialze the dtime module + ! variable in clm_time_manager to the dtime_lilac AND NOT the + ! dtime read in from the clm_inparm namelist in this case. Note + ! that the memory for gindex_ocn will be allocated in the following call + + call initialize1(gindex_ocn=gindex_ocn, dtime_driver=dtime_lilac) + + call ESMF_LogWrite(subname//"ctsm time manager initialized....", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"ctsm initialize1 done...", ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"initialize1 done...", ESMF_LOGMSG_INFO) + !-------------------------------- + ! generate the land mesh on ctsm distribution + !-------------------------------- + + ! TODO: mesh file should come into clm as a namelist for lilac only + ! for now need to hardwire this in lnd_mesh_filename here + + lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' ! obtain global index array for just land points which includes mask=0 or ocean points call get_proc_bounds( bounds ) @@ -388,120 +397,123 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! create distGrid from global index array DistGrid = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return deallocate(gindex) call ESMF_LogWrite(subname//"DistGrid created......", ESMF_LOGMSG_INFO) - !-------------------------------- - ! generate the mesh on ctsm distribution - !-------------------------------- - - ! TODO: mesh file should come into clm as a namelist for lilac only - ! for now need to hardwire this in cvalue here - cvalue = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' ! this will need to be filled in to run - - EMeshTemp = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + lnd_mesh = ESMF_MeshCreate(filename=trim(lnd_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, elementDistgrid=Distgrid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return if (masterproc) then - write(iulog,*)'mesh file for domain is ',trim(cvalue) + write(iulog,*)'mesh file for domain is ',trim(lnd_mesh_filename) end if + call ESMF_LogWrite(subname//" Create Mesh using file ...."//trim(lnd_mesh_filename), ESMF_LOGMSG_INFO) - ! recreate the mesh using the above distGrid - EMesh = ESMF_MeshCreate(EMeshTemp, elementDistgrid=Distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_LogWrite(subname//" Create Mesh using distgrid ....", ESMF_LOGMSG_INFO) - lnd_mesh = EMesh !-------------------------------- ! Finish initializing ctsm !-------------------------------- - call ESMF_LogWrite(subname//"before initialize2", ESMF_LOGMSG_INFO) call initialize2() - - call ESMF_LogWrite(subname//"initialize2 done...", ESMF_LOGMSG_INFO) - - !-------------------------------- - ! Check that ctsm internal dtime aligns with ctsm coupling interval - !-------------------------------- - call ESMF_LogWrite(subname//"cheking CTSM dtime and coupling intervals....", ESMF_LOGMSG_INFO) - - call ESMF_ClockGet( clock, timeStep=timeStep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - call ESMF_TimeIntervalGet( timeStep, s=dtime_sync, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - dtime_clm = get_step_size() - - if (masterproc) then - write(iulog,*)'dtime_sync= ',dtime_sync,' dtime_ctsm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) - end if - if (mod(dtime_sync,dtime_clm) /= 0) then - write(iulog,*)'ctsm dtime ',dtime_clm,' and clock dtime ',dtime_sync,' never align' - rc = ESMF_FAILURE - return - end if + call ESMF_LogWrite(subname//"ctsm initialize2 done...", ESMF_LOGMSG_INFO) !-------------------------------- ! Create import state (only assume input from atm - not rof and glc) !-------------------------------- + ! First create an empty field bundle c2l_fb = ESMF_FieldBundleCreate ( name='c2l_fb', rc=rc) + ! Now add fields on lnd_mesh to this field bundle + call fldbundle_add( 'Sa_z' , c2l_fb,rc) !1 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_topo' , c2l_fb,rc) !2 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_u' , c2l_fb,rc) !3 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_v' , c2l_fb,rc) !4 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) !5 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) !6 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) !7 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_shum' , c2l_fb,rc) !8 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) !9 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) !10 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) !11 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) !12 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) !13 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) !14 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) !15 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) !16 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) !17 + if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_z' , c2l_fb,rc) !1 - call fldbundle_add( 'Sa_topo' , c2l_fb,rc) !2 - call fldbundle_add( 'Sa_u' , c2l_fb,rc) !3 - call fldbundle_add( 'Sa_v' , c2l_fb,rc) !4 - call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) !5 - call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) !6 - call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) !7 - call fldbundle_add( 'Sa_shum' , c2l_fb,rc) !8 - - call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) !9 - call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) !10 - call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) !11 - call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) !12 - call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) !13 - call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) !14 - call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) !15 - call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) !16 - call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) !17 call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/), rc=rc) + !-------------------------------- ! Create export state + !-------------------------------- + ! First create an empty field bundle l2c_fb = ESMF_FieldBundleCreate(name='l2c_fb', rc=rc) - !call fldbundle_add( 'Sl_lfrint' , l2c_fb,rc) !1 - call fldbundle_add( 'Sl_lfrin' , l2c_fb,rc) !1 + + ! Now add fields on lnd_mesh to this field bundle + call fldbundle_add( 'Sl_lfrin' , l2c_fb,rc) !1 + if (ChkErr(rc,__LINE__,u_FILE_u)) return call fldbundle_add( 'Sl_t' , l2c_fb,rc) !2 + if (ChkErr(rc,__LINE__,u_FILE_u)) return call fldbundle_add( 'Sl_tref' , l2c_fb,rc) !3 + if (ChkErr(rc,__LINE__,u_FILE_u)) return call fldbundle_add( 'Sl_qref' , l2c_fb,rc) !4 + if (ChkErr(rc,__LINE__,u_FILE_u)) return call fldbundle_add( 'Sl_avsdr' , l2c_fb,rc) !5 + if (ChkErr(rc,__LINE__,u_FILE_u)) return call fldbundle_add( 'Sl_anidr' , l2c_fb,rc) !6 + if (ChkErr(rc,__LINE__,u_FILE_u)) return call fldbundle_add( 'Sl_avsdf' , l2c_fb,rc) !7 + if (ChkErr(rc,__LINE__,u_FILE_u)) return call fldbundle_add( 'Sl_anidf' , l2c_fb,rc) !8 + if (ChkErr(rc,__LINE__,u_FILE_u)) return call fldbundle_add( 'Sl_snowh' , l2c_fb,rc) !9 - call fldbundle_add( 'Fall_u10' , l2c_fb,rc) !10 - call fldbundle_add( 'Fall_fv' , l2c_fb,rc) !11 - call fldbundle_add( 'Fall_ram1' , l2c_fb,rc) !12 - !call fldbundle_add( 'Fall_taux' , l2c_fb,rc) !10 - !call fldbundle_add( 'Fall_lwup' , l2c_fb,rc) !14 - !call fldbundle_add( 'Fall_evap' , l2c_fb,rc) !15 - !call fldbundle_add( 'Fall_swniet' , l2c_fb,rc) !16 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_u10' , l2c_fb,rc) !10 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_fv' , l2c_fb,rc) !11 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_ram1' , l2c_fb,rc) !12 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call fldbundle_add( 'Fall_taux' , l2c_fb,rc) !10 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call fldbundle_add( 'Fall_lwup' , l2c_fb,rc) !14 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call fldbundle_add( 'Fall_evap' , l2c_fb,rc) !15 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call fldbundle_add( 'Fall_swnet' , l2c_fb,rc) !16 + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb/), rc=rc) - !call ESMF_StateAdd(exportState, fieldbundleList = (/l2c_fb/), rc=rc) !-------------------------------- ! Create land export state !-------------------------------- + call ESMF_LogWrite(subname//"Creating land export state", ESMF_LOGMSG_INFO) ! Fill in export state at end of initialization call export_fields(comp, bounds, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"Getting Calendar Day of nextsw calculation...", ESMF_LOGMSG_INFO) @@ -509,10 +521,10 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Get calendar day of next sw (shortwave) calculation (nextsw_cday) if (nsrest == nsrStartup) then call ESMF_ClockGet( clock, currTime=currTime, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_TimeGet( currTime, dayOfYear_r8=nextsw_cday, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return end if ! Set nextsw_cday @@ -553,31 +565,33 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_LogWrite(subname//' CTSM INITIALIZATION DONE SUCCESSFULLY!!!! ', ESMF_LOGMSG_INFO) + !--------------------------- + contains + !--------------------------- + + subroutine fldbundle_add(stdname, fieldbundle,rc) + !--------------------------- + ! Create an empty input field with name 'stdname' to add to fieldbundle + !--------------------------- + + ! input/output variables + character(len=*) , intent(in) :: stdname + type (ESMF_FieldBundle) , intent(inout) :: fieldbundle + integer , intent(out) :: rc + ! local variables + type(ESMF_Field) :: field + !------------------------------------------------------------------------------- + rc = ESMF_SUCCESS + field = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(stdname), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end subroutine fldbundle_add + end subroutine lnd_init !--------------------------------------------------------------------------- - !subroutine fldbundle_add(stdname, fldptr, fieldbundle,rc) - subroutine fldbundle_add(stdname, fieldbundle,rc) - type(ESMF_Field) :: field - !type(ESMF_Mesh) :: lnd_mesh - character(len=*), intent(in) :: stdname - type (ESMF_FieldBundle) :: fieldbundle - integer, intent(out) :: rc - - print *, "in lnd register routine" - - rc = ESMF_SUCCESS - - !field = ESMF_FieldCreate(lnd_mesh, meshloc=ESMF_MESHLOC_ELEMENT, name=trim(stdname), rc=rc) - field = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(stdname), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - - call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! bail out - end subroutine fldbundle_add - - !--------------------------------------------------------------------------- subroutine lnd_run(gcomp, import_state, export_state, clock, rc) !------------------------ @@ -597,7 +611,6 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) type(ESMF_Time) :: nextTime type(ESMF_State) :: importState, exportState character(ESMF_MAXSTR) :: cvalue - character(ESMF_MAXSTR) :: case_name ! case name integer :: ymd ! CTSM current date (YYYYMMDD) integer :: yr ! CTSM current year integer :: mon ! CTSM current month @@ -624,8 +637,8 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) real(r8) :: eccf ! earth orbit eccentricity factor type(bounds_type) :: bounds ! bounds character(len=32) :: rdate ! date char string for restart file names - character(len=*),parameter :: subname=trim(modName)//':[lnd_run] ' - character(*),parameter :: F02 = "('[lnd_comp_esmf] ',a, d26.19)" + character(*) , parameter :: F02 = "('[lnd_comp_esmf] ',a, d26.19)" + character(len=*), parameter :: subname=trim(modName)//':[lnd_run] ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -704,7 +717,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) nextsw_cday = calday if (masterproc) then - write(iulog,*) 'State_GetScalar ... nextsw_cday is : ', nextsw_cday + write(iulog,*) trim(subname) // '... nextsw_cday is : ', nextsw_cday end if !-------------------------------- @@ -723,11 +736,11 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) if (masterproc) then write(iulog,*) '------------ LILAC ----------------' - write(iulog,*) 'nstep : ', nstep - write(iulog,*) 'dtime : ', dtime - write(iulog,F02) 'calday : ', calday - write(iulog,F02) 'caldayp1 : ', caldayp1 - write(iulog,F02) 'nextsw_cday : ', nextsw_cday + write(iulog,*) trim(subname) // 'nstep : ', nstep + write(iulog,*) trim(subname) // 'dtime : ', dtime + write(iulog,*) trim(subname) // 'calday : ', calday + write(iulog,*) trim(subname) // 'caldayp1 : ', caldayp1 + write(iulog,*) trim(subname) // 'nextsw_cday : ', nextsw_cday write(iulog,*) '-------------------------------------' end if @@ -786,15 +799,12 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) if (masterproc) then write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' - write(iulog,*) 'doalb : ', doalb - write(iulog,*) 'call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, decl' - write(iulog,*) 'call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, decl' + write(iulog,*) 'doalb : ', doalb write(iulog,F02) 'calday is : ', calday write(iulog,F02) 'eccen is : ', eccen write(iulog,F02) 'mvelpp is : ', mvelpp write(iulog,F02) 'lambm0 is : ', lambm0 write(iulog,F02) 'obliqr is : ', obliqr - write(iulog,F02) 'clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic)' write(iulog,F02) 'declin is : ', declin write(iulog,F02) 'declinp1 is : ', declinp1 write(iulog,* ) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' @@ -829,9 +839,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! Advance ctsm time step !-------------------------------- - call t_startf ('lc_ctsm2_adv_timestep') call advance_timestep() - call t_stopf ('lc_ctsm2_adv_timestep') end do @@ -911,6 +919,8 @@ subroutine lnd_final(comp, import_state, export_state, clock, rc) end subroutine lnd_final + !--------------------------------------------------------------------------- + !=============================================================================== subroutine log_clock_advance(clock, logunit, rc) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 4cd1073488..c6dfb7593b 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -39,7 +39,7 @@ module clm_initializeMod contains !----------------------------------------------------------------------- - subroutine initialize1(gindex_ocn) + subroutine initialize1(gindex_ocn, dtime_driver) ! ! !DESCRIPTION: ! CLM initialization first phase @@ -63,6 +63,7 @@ subroutine initialize1(gindex_ocn) ! ! !ARGUMENTS integer, pointer, optional :: gindex_ocn(:) + integer, intent(in), optional :: dtime_driver ! ! !LOCAL VARIABLES: integer :: ier ! error status @@ -94,7 +95,7 @@ subroutine initialize1(gindex_ocn) call shr_sys_flush(iulog) endif - call control_init() + call control_init(dtime_driver) call ncd_pio_init() call surfrd_get_num_patches(fsurdat, actual_maxsoil_patches, actual_numcft) call clm_varpar_init(actual_maxsoil_patches, actual_numcft) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 097b138209..122b7af309 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -109,7 +109,8 @@ subroutine control_setNL( NLfile ) end subroutine control_setNL !------------------------------------------------------------------------ - subroutine control_init( ) + + subroutine control_init(dtime_driver) ! ! !DESCRIPTION: ! Initialize CLM run control information @@ -124,6 +125,9 @@ subroutine control_init( ) use CNPhenologyMod , only : CNPhenologyReadNML use landunit_varcon , only : max_lunit ! + ! ARGUMENTS + integer, intent(in), optional :: dtime_driver + ! !LOCAL VARIABLES: integer :: i ! loop indices integer :: ierr ! error code @@ -339,20 +343,29 @@ subroutine control_init( ) ! Process some namelist variables, and perform consistency checks ! ---------------------------------------------------------------------- - call set_timemgr_init( dtime_in=dtime ) - - if (use_init_interp) then - call apply_use_init_interp(finidat_interp_dest, finidat, finidat_interp_source) + if (present(dtime_driver)) then + ! overwrite dtime with dtime_in - instead of what is being used in the namelist + if (masterproc) then + write(iulog,*) 'WARNING: using dtime from cap rather than what is being read in from namelist' + end if + dtime = dtime_driver end if - ! History and restart files + ! Now initialize the module variable dtime in clm_time_manger - this will be utilized to create the + ! internal clm clock + call set_timemgr_init( dtime_in=dtime ) + ! History and restart files (dependent on settings of dtime) do i = 1, max_tapes if (hist_nhtfrq(i) < 0) then hist_nhtfrq(i) = nint(-hist_nhtfrq(i)*SHR_CONST_CDAY/(24._r8*dtime)) endif end do + if (use_init_interp) then + call apply_use_init_interp(finidat_interp_dest, finidat, finidat_interp_source) + end if + if (maxpatch_glcmec <= 0) then call endrun(msg=' ERROR: maxpatch_glcmec must be at least 1 ' // & errMsg(sourcefile, __LINE__)) From 80f0c5ce123239e003bcc6fde575a4bc5426a395 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 28 Nov 2019 11:19:19 -0700 Subject: [PATCH 0430/1973] cleaned up initialization of mct and shr_pio_init2 --- src/cpl/lilac/lnd_comp_esmf.F90 | 230 +++++++++++++++----------------- 1 file changed, 105 insertions(+), 125 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 98535e47f4..4e1a3e7688 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -17,7 +17,7 @@ module lnd_comp_esmf use shr_file_mod , only : shr_file_setLogUnit, shr_file_getLogUnit use shr_orb_mod , only : shr_orb_decl, shr_orb_params use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date - use spmdMod , only : masterproc, mpicom, spmd_init + use spmdMod , only : masterproc, spmd_init, mpicom use decompMod , only : bounds_type, ldecomp, get_proc_bounds use domainMod , only : ldomain use controlMod , only : control_setNL @@ -66,16 +66,11 @@ subroutine lnd_register(comp, rc) ! input/output argumenents type(ESMF_GridComp) :: comp ! CLM grid component integer, intent(out) :: rc ! return status - - ! local variables - character(len=*), parameter :: subname=trim(modname)//': [lnd_register] ' !----------------------------------------------------------------------- - print *, "in lnd register routine" rc = ESMF_SUCCESS call ESMF_LogSet ( flush =.true.) - call ESMF_LogWrite(subname//"lnd gridcompset entry points setting ....!", ESMF_LOGMSG_INFO) call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, lnd_init, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return @@ -86,7 +81,8 @@ subroutine lnd_register(comp, rc) call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, lnd_final, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//"lnd gridcompset entry points finished!", ESMF_LOGMSG_INFO) + call ESMF_LogWrite("lnd gridcompset entry points finished!", ESMF_LOGMSG_INFO) + end subroutine lnd_register !=============================================================================== @@ -104,146 +100,140 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) integer, intent(out) :: rc ! Return code ! local variable - type(ESMF_Mesh) :: lnd_mesh - character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file - integer :: ierr - integer :: mpicom_lnd, mpicom_vm, gsize - type(ESMF_DistGrid) :: distgrid - type(ESMF_VM) :: vm - integer :: lsize ! size of attribute vector - integer :: g,i,j ! indices + integer :: ierr ! error code + integer :: n,g,i,j ! indices logical :: exists ! true if file exists real(r8) :: nextsw_cday ! calday from clock of next radiation computation character(len=CL) :: caseid ! case identifier name character(len=CL) :: ctitle ! case description title character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) - character(len=CL) :: calendar ! calendar type name - character(len=CL) :: hostname ! hostname of machine running on - character(len=CL) :: version ! Model version - character(len=CL) :: username ! user running the model integer :: nsrest ! clm restart type - integer :: ref_ymd ! reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (sec) - integer :: start_ymd ! start date (YYYYMMDD) - integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type logical :: atm_aero ! Flag if aerosol data sent from atm model integer :: lbnum ! input to memory diagnostic integer :: shrlogunit ! old values for log unit and log level - integer :: logunit ! original log unit type(bounds_type) :: bounds ! bounds - integer :: nfields - integer :: ncomps = 1 - integer, pointer :: comps(:) ! array with component ids - integer, pointer :: comms(:) ! array with mpicoms - character(len=32), allocatable :: compLabels(:) - integer,allocatable :: comp_id(:) ! for pio init2 - character(len=64),allocatable :: comp_name(:) ! for pio init2 - integer,allocatable :: comp_comm(:) ! for pio_init2 - logical,allocatable :: comp_iamin(:) ! for pio init2 - integer,allocatable :: comp_comm_iam(:) ! for pio_init2 - integer :: ymd ! CTSM current date (YYYYMMDD) - integer :: orb_iyear_align ! associated with model year - integer :: orb_cyear ! orbital year for current orbital computation - integer :: orb_iyear ! orbital year for current orbital computation - integer :: orb_eccen ! orbital year for current orbital computation + + ! generation of field bundles + type(ESMF_State) :: importState, exportState + type(ESMF_FieldBundle) :: c2l_fb + type(ESMF_FieldBundle) :: l2c_fb + + ! mesh generation + type(ESMF_Mesh) :: lnd_mesh + character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file + integer :: nlnd, nocn ! local size ofarrays + integer, pointer :: gindex(:) ! global index space for land and ocean points + integer, pointer :: gindex_lnd(:) ! global index space for just land points + integer, pointer :: gindex_ocn(:) ! global index space for just ocean points + type(ESMF_DistGrid) :: distgrid + + ! clock info + character(len=CL) :: calendar ! calendar type name + type(ESMF_CalKind_Flag) :: caltype ! calendar type from lilac clock + integer :: curr_tod, curr_ymd ! current time info + integer :: yy, mm, dd ! query output from lilac clock integer :: dtime_lilac ! coupling time-step from the input lilac clock - integer :: curr_tod, curr_ymd - integer :: yy, mm, dd + integer :: ref_ymd ! reference date (YYYYMMDD) + integer :: ref_tod ! reference time of day (sec) + integer :: start_ymd ! start date (YYYYMMDD) + integer :: start_tod ! start time of day (sec) + integer :: stop_ymd ! stop date (YYYYMMDD) + integer :: stop_tod ! stop time of day (sec) type(ESMF_Time) :: currTime ! Current time type(ESMF_Time) :: startTime ! Start time type(ESMF_Time) :: stopTime ! Stop time type(ESMF_Time) :: refTime ! Ref time - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar - type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type - integer, pointer :: gindex(:) ! global index space for land and ocean points - integer, pointer :: gindex_lnd(:) ! global index space for just land points - integer, pointer :: gindex_ocn(:) ! global index space for just ocean points - integer :: nlnd, nocn ! local size ofarrays - integer :: n ! indices - integer :: dtime ! time step increment (sec) - type(ESMF_FieldBundle) :: c2l_fb - type(ESMF_FieldBundle) :: l2c_fb - type(ESMF_State) :: importState, exportState - integer :: compid ! component id - character(len=*), parameter :: subname=trim(modName)//': [lnd_init] ' + type(ESMF_TimeInterval) :: timeStep ! time step from lilac clock + + ! orbital info + integer :: orb_iyear_align ! associated with model year + integer :: orb_cyear ! orbital year for current orbital computation + integer :: orb_iyear ! orbital year for current orbital computation + integer :: orb_eccen ! orbital year for current orbital computation + + ! for pio_init2 and mct + type(ESMF_VM) :: vm + integer :: mpicom_vm + integer :: ncomps = 1 + integer, pointer :: mycomms(:) ! for mct + integer, pointer :: myids(:) ! for mct + integer :: compids(1) = (/1/) ! for both mct and pio_init2 - array with component ids + integer :: comms(1) ! for both mct and pio_init2 - array with mpicoms + character(len=32) :: compLabels(1) = (/'LND'/) ! for pio_init2 + character(len=64) :: comp_name(1) = (/'LND'/) ! for pio_init2 + logical :: comp_iamin(1) = (/.true./) ! for pio init2 + integer :: iam(1) ! for pio_init2 + character(len=*), parameter :: subname=trim(modName)//': (lnd_init) ' !------------------------------------------------------------------------ rc = ESMF_SUCCESS call ESMF_LogWrite(subname//' is called!', ESMF_LOGMSG_INFO) !------------------------------------------------------------------------ - ! Initialize clm MPI communicator + ! Query VM for local PET and mpi communicator !------------------------------------------------------------------------ - call ESMF_VMGetCurrent(vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - call ESMF_LogWrite(subname//"ESMF_VMGetCurrent", ESMF_LOGMSG_INFO) - call ESMF_VMPrint (vm, rc = rc) + ! NOTE : both MPI_INIT and PIO_INIT1 are initialized in lilac_mod.F90 + + call ESMF_VMGetCurrent(vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - call ESMF_VMGet(vm, mpiCommunicator=mpicom_vm, rc=rc) + call ESMF_VMGet(vm, mpiCommunicator=mpicom_vm, localPet=iam(1), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return call ESMF_LogWrite(subname//"ESMF_VMGet", ESMF_LOGMSG_INFO) - ! duplicate the mpi communicator from the current VM - call MPI_Comm_dup(mpicom_vm, mpicom_lnd, rc) - call ESMF_LogWrite(subname//"MPI_Comm_dup...", ESMF_LOGMSG_INFO) - -!!!! NS : BOTH MPI_INIT and PIO_INIT1 are in lilac_mod.F90 + !call ESMF_VMPrint (vm, rc = rc) + !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + comms(1) = mpicom_vm !------------------------------------------------------------------------ - ! Initialize mct - ! (needed for data models and cice prescribed capability) - ! (needed for data model share code - e.g. nitrogen deposition) + ! Initialize pio_init2 TODO: is this needed here? !------------------------------------------------------------------------ - ! TODO: FIX THIS PLEASE!!!! - - allocate(comms(1), comps(1), compLabels(1), comp_iamin(1), comp_comm_iam(1), comp_name(1),stat=ierr) - - comms(1) = mpicom_lnd !or call MPI_Comm_dup(mpicom_vm, comms(1), ierr) - comps(1) = 1 - compLabels(1) = 'LND' - comp_iamin(1) = .true. - comp_name(1) = 'LND' - call ESMF_VMGet(vm, mpiCommunicator=comms(1), localPet=comp_comm_iam(1), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + call shr_pio_init2(compids, compLabels, comp_iamin, comms, iam) + call ESMF_LogWrite(subname//"initialized shr_pio_init2 ...", ESMF_LOGMSG_INFO) - call shr_pio_init2(comps, compLabels, comp_iamin, comms, comp_comm_iam) + !------------------------------------------------------------------------ + ! Initialize mct - needed for data model share code - e.g. nitrogen deposition + !------------------------------------------------------------------------ - call ESMF_LogWrite(subname//"after shr_pio_init2", ESMF_LOGMSG_INFO) + allocate(mycomms(1), myids(1)) + mycomms = (/mpicom_vm/) ; myids = (/1/) - call ESMF_LogWrite(subname//"Now calling mct_world_init", ESMF_LOGMSG_INFO) - call mct_world_init(ncomps, mpicom_lnd, comms, comps) - call ESMF_LogWrite(subname//"mct world initialized! ", ESMF_LOGMSG_INFO) + call mct_world_init(ncomps, mpicom_vm, mycomms, myids) + call ESMF_LogWrite(subname//"initialized mct ... ", ESMF_LOGMSG_INFO) - !deallocate(comms, comps, compLabels, comp_iamin, comp_comm_iam, comp_name) ??? + !------------------------------------------------------------------------ + ! Initialize internal ctsm MPI info + !------------------------------------------------------------------------ - ! Initialize model mpi info - compid = 1 - call spmd_init( mpicom_lnd, compid) + call spmd_init( clm_mpicom=mpicom_vm, lndid=1) call ESMF_LogWrite(subname//"initialized model mpi info using spmd_init", ESMF_LOGMSG_INFO) !------------------------------------------------------------------------ !--- Log File --- !------------------------------------------------------------------------ + ! TODO: by default iulog = 6 in clm_varctl - this should be generalized so that we + ! can control the output log file for ctsm running with a lilac driver + inst_name = 'LND'; inst_index = 1; inst_suffix = "" ! Initialize io log unit call shr_file_getLogUnit (shrlogunit) - if (masterproc) then - write(iulog,*) trim(subname) // "CLM land model initialization" - else - iulog = shrlogunit + if (.not. masterproc) then + iulog = shrlogunit ! All shr code output will go to iulog for masterproc end if call shr_file_setLogUnit (iulog) + if (masterproc) then + write(iulog,*) "=========================================" + write(iulog,*) " starting (lnd_comp_esmf): lnd_comp_init " + write(iulog,*) " CLM land model initialization" + end if + !------------------------------------------------------------------------ !--- Orbital Values --- !------------------------------------------------------------------------ @@ -265,14 +255,12 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !lambm0 = -3.247249566152933E-0020 !obliqr = 0.409101122579779 - !if ((debug >1) .and. (masterproc)) then if (masterproc) then - write(iulog,*) trim(subname) // 'shr_obs_params is setting these:', eccen - write(iulog,*) trim(subname) // 'eccen is : ', eccen - write(iulog,*) trim(subname) // 'mvelpp is : ', mvelpp - - write(iulog,*) trim(subname) // 'lambm0 is : ', lambm0 - write(iulog,*) trim(subname) // 'obliqr is : ', obliqr + write(iulog,*) 'shr_obs_params is setting the following:' + write(iulog,*) 'eccen is : ', eccen + write(iulog,*) 'mvelpp is : ', mvelpp + write(iulog,*) 'lambm0 is : ', lambm0 + write(iulog,*) 'obliqr is : ', obliqr end if !---------------------- @@ -308,20 +296,20 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,ref_ymd) - call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) + call ESMF_TimeGet( currTime, calkindflag=caltype, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (esmf_caltype == ESMF_CALKIND_NOLEAP) then + if (caltype == ESMF_CALKIND_NOLEAP) then calendar = shr_cal_noleap - else if (esmf_caltype == ESMF_CALKIND_GREGORIAN) then + else if (caltype == ESMF_CALKIND_GREGORIAN) then calendar = shr_cal_gregorian else call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) end if - ! The following sets the module variables in clm_time_mamanger.F90 - BUT DOES NOT intialize the + ! The following sets the module variables in clm_time_mamanger.F90 - BUT DOES NOT intialize the ! clock. Routine timemgr_init (called by initialize1) initializes the clock using the module variables - ! that have been set via calls to set_timemgr_init. + ! that have been set via calls to set_timemgr_init. call set_timemgr_init( & calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & @@ -339,7 +327,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Initialize glc_elevclass module !---------------------- - call glc_elevclass_init(glc_nec) ! TODO: is this needed still? + call glc_elevclass_init(glc_nec) ! TODO: is this needed still? !---------------------- ! Call initialize1 @@ -369,14 +357,13 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! TODO: mesh file should come into clm as a namelist for lilac only ! for now need to hardwire this in lnd_mesh_filename here - lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' ! obtain global index array for just land points which includes mask=0 or ocean points call get_proc_bounds( bounds ) nlnd = bounds%endg - bounds%begg + 1 allocate(gindex_lnd(nlnd)) - !print ,* "nlnd is :", nlnd do g = bounds%begg,bounds%endg n = 1 + (g - bounds%begg) gindex_lnd(n) = ldecomp%gdc2glo(g) @@ -565,6 +552,9 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_LogWrite(subname//' CTSM INITIALIZATION DONE SUCCESSFULLY!!!! ', ESMF_LOGMSG_INFO) + write(iulog,*) " finished (lnd_comp_esmf): lnd_comp_init " + write(iulog,*) "=========================================" + !--------------------------- contains !--------------------------- @@ -893,11 +883,11 @@ end subroutine lnd_run !--------------------------------------------------------------------------- subroutine lnd_final(comp, import_state, export_state, clock, rc) - ! - ! !DESCRIPTION: + !--------------------------------- ! Finalize land surface model - ! - ! !ARGUMENTS: + !--------------------------------- + + ! input/output variables type(ESMF_GridComp) :: comp ! CLM gridded component type(ESMF_State) :: import_state ! CLM import state type(ESMF_State) :: export_state ! CLM export state @@ -907,20 +897,10 @@ subroutine lnd_final(comp, import_state, export_state, clock, rc) rc = ESMF_SUCCESS - ! Destroy ESMF objects - !call esmfshr_util_StateArrayDestroy(export_state,'domain',rc) - !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - - !call esmfshr_util_StateArrayDestroy(export_state,'d2x',rc) - !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - - !call esmfshr_util_StateArrayDestroy(import_state,'x2d',rc) - !if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + ! TODO: Destroy ESMF objects end subroutine lnd_final - !--------------------------------------------------------------------------- - !=============================================================================== subroutine log_clock_advance(clock, logunit, rc) From e962ff9162ed3111055dbe045ee38272c48de7b8 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 28 Nov 2019 12:17:06 -0700 Subject: [PATCH 0431/1973] updates to clean up error handling and clock advance --- lilac/atm_driver/atm_driver.F90 | 4 +- lilac/lilac/lilac_mod.F90 | 100 ++++++++++++++------------------ 2 files changed, 47 insertions(+), 57 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 32d42f18f9..f6e61f35ff 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -174,9 +174,9 @@ program atm_driver print *, "=======================================" end if - !===================== +!======================================================= contains - !===================== +!======================================================= subroutine read_netcdf_mesh(filename, nglobal) diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 84dbda6ef5..8e9badc0dd 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -14,13 +14,16 @@ module lilac_mod type(ESMF_Clock) :: lilac_clock type(ESMF_Calendar),target :: lilac_calendar - ! Gridded Components and Coupling Components + ! Gridded components and states in gridded components type(ESMF_GridComp) :: atm_gcomp type(ESMF_GridComp) :: lnd_gcomp - type(ESMF_CplComp) :: cpl_atm2lnd_comp - type(ESMF_CplComp) :: cpl_lnd2atm_comp type(ESMF_State) :: atm2lnd_l_state, atm2lnd_a_state type(ESMF_State) :: lnd2atm_a_state, lnd2atm_l_state + + ! Coupler components + type(ESMF_CplComp) :: cpl_atm2lnd_comp + type(ESMF_CplComp) :: cpl_lnd2atm_comp + character(*) , parameter :: modname = "lilac_mod" integer :: mytask @@ -37,13 +40,13 @@ subroutine lilac_init(atm_global_index, atm_mesh_filepath, atm_calendar, atm_tim ! This is called by the host atmosphere ! -------------------------------------------------------------------------------- - use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd, gindex_atm, atm_mesh_filename + use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd + use lilac_utils , only : gindex_atm, atm_mesh_filename use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register use lilac_atmcap , only : lilac_atmos_register use lnd_comp_esmf , only : lnd_register !ctsm routine use shr_pio_mod , only : shr_pio_init1 - ! input/output variables ! input/output variables integer , intent(in) :: atm_global_index(:) character(len=*) , intent(in) :: atm_mesh_filepath @@ -59,11 +62,11 @@ subroutine lilac_init(atm_global_index, atm_mesh_filepath, atm_calendar, atm_tim integer , intent(in) :: atm_stop_secs ! local variables - type(ESMF_TimeInterval) :: timeStep - type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest - integer :: yy,mm,dd,sec + type(ESMF_TimeInterval) :: timeStep + type(ESMF_Time) :: startTime + type(ESMF_Time) :: stopTime + type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest + integer :: yy,mm,dd,sec integer :: lsize type(ESMF_State) :: importState, exportState type(ESMF_VM) :: vm @@ -293,14 +296,14 @@ end subroutine lilac_init subroutine lilac_run( ) + use shr_sys_mod, only : shr_sys_abort + ! local variables type(ESMF_State) :: importState, exportState - integer :: rc, userRC - type (ESMF_Clock) :: local_clock + integer :: rc character(len=*), parameter :: subname=trim(modname)//': [lilac_run] ' !------------------------------------------------------------------------ - ! Initialize return code rc = ESMF_SUCCESS if (mytask == 0) then @@ -309,62 +312,49 @@ subroutine lilac_run( ) print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" end if - !------------------------------------------------------------------------- - ! Create a local clock from the general clock! - !------------------------------------------------------------------------- - - local_clock = ESMF_ClockCreate(lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - - if (mytask == 0) then - print *, "Run Loop Start time" - end if - - !------------------------------------------------------------------------- - ! We are running components in this order: - ! 1- atmos_cap 2- cpl_atm2lnd! 3- lnd_cap 4- cpl_lnd2atm - !------------------------------------------------------------------------- - + ! Run lilac atmcap + call ESMF_LogWrite(subname//"running lilac atmos_cap", ESMF_LOGMSG_INFO) + if (mytask == 0) print *, "Running atmos_cap gridded component , rc =", rc call ESMF_GridCompRun(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, & - clock=local_clock, rc=rc, userRC=userRC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - - call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) - if (mytask == 0) then - print *, "Running atmos_cap gridded component , rc =", rc + clock=lilac_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in running lilac atm_cap") end if - call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, & - clock=local_clock, rc=rc , userRC=userRC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + ! Run cpl_atm2lnd call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) - if (mytask == 0) then - print *, "Running coupler component..... cpl_atm2lnd_comp , rc =", rc + if (mytask == 0) print *, "Running coupler component..... cpl_atm2lnd_comp" + call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, & + clock=lilac_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in running cpl_atm2lnd") end if + ! Run ctsm + call ESMF_LogWrite(subname//"running ctsm", ESMF_LOGMSG_INFO) + if (mytask == 0) print *, "Running ctsm" call ESMF_GridCompRun(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, & - clock=local_clock, rc=rc, userRC=userRC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) - if (mytask == 0) then - print *, "Running lnd_cap gridded component , rc =", rc + clock=lilac_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in running ctsm") end if - call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, & - clock=local_clock, rc=rc, userRC=userRC) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - if (ESMF_LogFoundError(rcToCheck=userRC, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + ! Run cpl_lnd2atm call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc end if + call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, & + clock=lilac_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in cpl_lnd2atm") + end if - ! Advance the time - call ESMF_ClockAdvance(local_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + ! Advance the time at the end of the time step + call ESMF_ClockAdvance(lilac_clock, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in advancing time step") + end if call ESMF_LogWrite(subname//"time is icremented now... (ClockAdvance)", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, "time is icremented now... (ClockAdvance) , rc =", rc From 66b6335eb7b6ece9e65b46a82e62f83462d63280 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 28 Nov 2019 12:18:40 -0700 Subject: [PATCH 0432/1973] rename of sync clock to lilac_clock and turn off debug mode --- src/cpl/lilac/lnd_comp_esmf.F90 | 47 ++++++++++++++++++----------- src/cpl/lilac/lnd_import_export.F90 | 2 +- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 4e1a3e7688..e3d3d58820 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -552,8 +552,10 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_LogWrite(subname//' CTSM INITIALIZATION DONE SUCCESSFULLY!!!! ', ESMF_LOGMSG_INFO) - write(iulog,*) " finished (lnd_comp_esmf): lnd_comp_init " - write(iulog,*) "=========================================" + if (masterproc) then + write(iulog,*) " finished (lnd_comp_esmf): lnd_comp_init " + write(iulog,*) "=========================================" + end if !--------------------------- contains @@ -606,11 +608,11 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) integer :: mon ! CTSM current month integer :: day ! CTSM current day integer :: tod ! CTSM current time of day (sec) - integer :: ymd_sync ! Sync date (YYYYMMDD) - integer :: yr_sync ! Sync current year - integer :: mon_sync ! Sync current month - integer :: day_sync ! Sync current day - integer :: tod_sync ! Sync current time of day (sec) + integer :: ymd_lilac ! Sync date (YYYYMMDD) + integer :: yr_lilac ! Sync current year + integer :: mon_lilac ! Sync current month + integer :: day_lilac ! Sync current day + integer :: tod_lilac ! Sync current time of day (sec) integer :: dtime ! time step increment (sec) integer :: nstep ! time step index logical :: rstwr ! .true. ==> write restart file before returning @@ -808,9 +810,9 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) call ESMF_ClockGetNextTime(clock, nextTime=nextTime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeGet(nexttime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc) + call ESMF_TimeGet(nexttime, yy=yr_lilac, mm=mon_lilac, dd=day_lilac, s=tod_lilac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync, mon_sync, day_sync, tod_sync + write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_lilac, mon_lilac, day_lilac, tod_lilac call t_startf ('ctsm_run') call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic=.false.) @@ -833,26 +835,35 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) end do - ! Check that internal clock is in sync with master clock - ! Note that the driver clock has not been updated yet - so at this point - ! CTSM is actually 1 coupling intervals ahead of the driver clock + !-------------------------------- + ! Check that internal clock is in sync with lilac driver clock + !-------------------------------- + ! Get ctsm current time info call get_curr_date( yr, mon, day, tod, offset=-2*dtime ) ymd = yr*10000 + mon*100 + day tod = tod + ! Get lilac clock info call ESMF_ClockGet( clock, currTime=currTime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeGet( currTime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc ) + call ESMF_TimeGet( currTime, yy=yr_lilac, mm=mon_lilac, dd=day_lilac, s=tod_lilac, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yr_sync, mon_sync, day_sync, ymd_sync) + call shr_cal_ymd2date(yr_lilac, mon_lilac, day_lilac, ymd_lilac) + + if (masterproc) then + write(iulog,*)'lilac ymd=',ymd ,' lilac tod= ',tod + end if + + ! Note that the driver clock has not been updated yet - so at this point + ! CTSM is actually 1 coupling intervals ahead of the driver clock - if ( (ymd /= ymd_sync) .and. (tod /= tod_sync) ) then - write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod - write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync + if ( (ymd /= ymd_lilac) .and. (tod /= tod_lilac) ) then + write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod + write(iulog,*)'lilac ymd=',ymd_lilac,' lilac tod= ',tod_lilac rc = ESMF_FAILURE - call ESMF_LogWrite(subname//" CTSM clock not in sync with Master Sync clock",ESMF_LOGMSG_ERROR) + call ESMF_LogWrite(subname//" CTSM clock not in sync with lilac clock",ESMF_LOGMSG_ERROR) end if !-------------------------------- diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 3dc2dd66f4..35f6308ff3 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -55,7 +55,7 @@ module lnd_import_export integer :: emis_nflds ! number of fire emission fields from lnd-> atm integer :: glc_nec = 10 ! number of glc elevation classes - integer, parameter :: debug = 1 ! internal debug level + integer, parameter :: debug = 0 ! internal debug level character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" character(*),parameter :: F02 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d26.19)" From 2eb502475b271d4080242246f5daa1c166585780 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 28 Nov 2019 13:40:45 -0700 Subject: [PATCH 0433/1973] added start and stop alarm functionality --- lilac/atm_driver/atm_driver.F90 | 6 +++- lilac/lilac/lilac_mod.F90 | 49 ++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index f6e61f35ff..56a6759a8a 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -159,7 +159,11 @@ program atm_driver !------------------------------------------------------------------------ do nstep = atm_timestep_start, atm_timestep_stop - call lilac_run( ) + if (nstep == atm_timestep_stop) then + call lilac_run(restart_alarm_is_ringing=.true., stop_alarm_is_ringing=.true.) + else + call lilac_run(restart_alarm_is_ringing=.false., stop_alarm_is_ringing=.false.) + end if end do !------------------------------------------------------------------------ diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 8e9badc0dd..56250e0399 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -13,6 +13,8 @@ module lilac_mod ! Clock, TimeInterval, and Times type(ESMF_Clock) :: lilac_clock type(ESMF_Calendar),target :: lilac_calendar + type(ESMF_Alarm) :: lilac_restart_alarm + type(ESMF_Alarm) :: lilac_stop_alarm ! Gridded components and states in gridded components type(ESMF_GridComp) :: atm_gcomp @@ -40,12 +42,13 @@ subroutine lilac_init(atm_global_index, atm_mesh_filepath, atm_calendar, atm_tim ! This is called by the host atmosphere ! -------------------------------------------------------------------------------- - use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd - use lilac_utils , only : gindex_atm, atm_mesh_filename - use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register - use lilac_atmcap , only : lilac_atmos_register - use lnd_comp_esmf , only : lnd_register !ctsm routine - use shr_pio_mod , only : shr_pio_init1 + use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd + use lilac_utils , only : gindex_atm, atm_mesh_filename + use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register + use lilac_atmcap , only : lilac_atmos_register + use lnd_comp_esmf , only : lnd_register !ctsm routine + use shr_pio_mod , only : shr_pio_init1 + use shr_sys_mod , only : shr_sys_abort ! input/output variables integer , intent(in) :: atm_global_index(:) @@ -238,6 +241,18 @@ subroutine lilac_init(atm_global_index, atm_mesh_filepath, atm_calendar, atm_tim print *, trim(subname) // "---------------------------------------" end if + ! Add a restart alarm to the clock + lilac_restart_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_restart_alarm', rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort('error in initializing restart alarm') + end if + + ! Add a stop alarm to the clock + lilac_stop_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_stop_alarm', rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort('error in initializing stop alarm') + end if + ! ------------------------------------------------------------------------- ! Initialze lilac_atm gridded component ! First Create the empty import and export states used to pass data @@ -294,10 +309,14 @@ end subroutine lilac_init !======================================================================== - subroutine lilac_run( ) + subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) use shr_sys_mod, only : shr_sys_abort + ! input/output variables + logical, intent(in) :: restart_alarm_is_ringing + logical, intent(in) :: stop_alarm_is_ringing + ! local variables type(ESMF_State) :: importState, exportState integer :: rc @@ -312,6 +331,22 @@ subroutine lilac_run( ) print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" end if + ! Set the clock restart alarm if restart_alarm_ringing is true + if (restart_alarm_is_ringing) then + call ESMF_AlarmRingerOn(lilac_restart_alarm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in running lilac atm_cap") + end if + end if + + ! Set the clock stop alarm if stop_alarm_ringing is true + if (stop_alarm_is_ringing) then + call ESMF_AlarmRingerOn(lilac_stop_alarm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in running lilac atm_cap") + end if + end if + ! Run lilac atmcap call ESMF_LogWrite(subname//"running lilac atmos_cap", ESMF_LOGMSG_INFO) if (mytask == 0) print *, "Running atmos_cap gridded component , rc =", rc From 2b464b445ad3020111f0f9a14e1c36a2f62c26d8 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 09:27:40 -0700 Subject: [PATCH 0434/1973] new buildnml functionality for lilac cap --- lilac_config/buildnml | 207 ++++++++++++++++++++++++++++++++ lilac_config/lnd_input.py | 23 ++++ src/cpl/lilac/lnd_comp_esmf.F90 | 107 ++++++++--------- 3 files changed, 282 insertions(+), 55 deletions(-) create mode 100755 lilac_config/buildnml create mode 100644 lilac_config/lnd_input.py diff --git a/lilac_config/buildnml b/lilac_config/buildnml new file mode 100755 index 0000000000..b4a4ab198e --- /dev/null +++ b/lilac_config/buildnml @@ -0,0 +1,207 @@ +#!/usr/bin/env python + +""" +CLM namelist creator +""" +import sys, os, shutil, subprocess, logging +import six +from lnd_input import * + +logger = logging.getLogger(__name__) + +# Find python version +PY3 = sys.version_info[0] > 2 +PYSUBVER = sys.version_info[1] + +_config_cache_template = """ + + + +Specifies clm physics + +""" + +# Note the following is needed in env_lilac.xml otherwise the following error appers in the call to build_namelist +#err=ERROR : CLM build-namelist::CLMBuildNamelist::logical_to_fortran() : Unexpected value in logical_to_fortran: + +_env_lilac_template = """ + + + + + logical + TRUE,FALSE + + + +""" + +_hack=object() + +############################################################################### +def run_cmd(cmd, input_str=None, from_dir=None, verbose=None, + arg_stdout=_hack, arg_stderr=_hack, env=None, combine_output=False): +############################################################################### + + """ + Wrapper around subprocess to make it much more convenient to run shell commands + + >>> run_cmd('ls file_i_hope_doesnt_exist')[0] != 0 + True + """ + import subprocess # Not safe to do globally, module not available in older pythons + + # Real defaults for these value should be subprocess.PIPE + if arg_stdout is _hack: + arg_stdout = subprocess.PIPE + elif isinstance(arg_stdout, six.string_types): + arg_stdout = _convert_to_fd(arg_stdout, from_dir) + + if arg_stderr is _hack: + arg_stderr = subprocess.STDOUT if combine_output else subprocess.PIPE + elif isinstance(arg_stderr, six.string_types): + arg_stderr = _convert_to_fd(arg_stdout, from_dir) + + if (verbose != False and (verbose or logger.isEnabledFor(logging.DEBUG))): + logger.info("RUN: {}\nFROM: {}".format(cmd, os.getcwd() if from_dir is None else from_dir)) + + if (input_str is not None): + stdin = subprocess.PIPE + else: + stdin = None + + proc = subprocess.Popen(cmd, + shell=True, + stdout=arg_stdout, + stderr=arg_stderr, + stdin=stdin, + cwd=from_dir, + env=env) + + output, errput = proc.communicate(input_str) + if output is not None: + try: + output = output.decode('utf-8', errors='ignore').strip() + except AttributeError: + pass + if errput is not None: + try: + errput = errput.decode('utf-8', errors='ignore').strip() + except AttributeError: + pass + + stat = proc.wait() + if six.PY2: + if isinstance(arg_stdout, file): # pylint: disable=undefined-variable + arg_stdout.close() # pylint: disable=no-member + if isinstance(arg_stderr, file) and arg_stderr is not arg_stdout: # pylint: disable=undefined-variable + arg_stderr.close() # pylint: disable=no-member + else: + if isinstance(arg_stdout, io.IOBase): + arg_stdout.close() # pylint: disable=no-member + if isinstance(arg_stderr, io.IOBase) and arg_stderr is not arg_stdout: + arg_stderr.close() # pylint: disable=no-member + + + if (verbose != False and (verbose or logger.isEnabledFor(logging.DEBUG))): + if stat != 0: + logger.info(" stat: {:d}\n".format(stat)) + if output: + logger.info(" output: {}\n".format(output)) + if errput: + logger.info(" errput: {}\n".format(errput)) + + return stat, output, errput + +############################################################################### +def buildnml(): +############################################################################### + + """Build the clm namelist """ + + # A few notes: + # - tuning parameters and initial conditions should be optimized for what CLM model version and + # what meteorlogical forcing combination? valid values are: + # clm5_0_cam6.0, clm5_0_GSWP3v1, clm5_0_CRUv7, clm4_5_CRUv7, clm4_5_GSWP3v1, clm4_5_cam6.0 + # - only support startup or continue runs for now + + glc_nec = str(10) # + lnd_ncpl = str(1) # this will not be used - but is only here as a place holder to satisfy build_namelist + nomeg = "" + caseroot = "." + + # set path for the namelist assume that build namelist in lilac_conf/namelist + clmconf = os.path.join(os.getcwd(),"namelist") + infile = os.path.join(clmconf, "namelist") + inputdata_file = os.path.join(clmconf, "clm.input_data_list") + config_cache = os.path.join(clmconf, "config_cache.xml") + env_lilac = os.path.join(clmconf, "env_lilac.xml") + lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) + + # create clmconf if it does not exist + if not os.path.isdir(clmconf): + os.makedirs(clmconf) + + # clean inputdata_file if it does exist + if os.path.exists(inputdata_file): + os.remove(inputdata_file) + + # Create config_cache.xml file + # Note that build-namelist utilizes the contents of the config_cache.xml file in + # the namelist_defaults.xml file to obtain namelist variables + config_cache_text = _config_cache_template.format(clm_phys=clm_phys) + with open(config_cache, 'w') as tempfile: + tempfile.write(config_cache_text) + + # Create env_lilac text + env_lilac_text = _env_lilac_template.format() + with open(env_lilac, 'w') as tempfile: + tempfile.write(env_lilac_text) + + # ----------------------------------------------------- + # call build-namelist + # ----------------------------------------------------- + + cmd = os.path.join(os.pardir, "bld","build-namelist") + command = [cmd, + '-csmdata', din_loc_root, + '-inputdata', inputdata_file, ignore, + '-namelist', '\'&clm_inparm start_ymd={} {}/\''.format(start_ymd, clm_namelist_opts), + '-use_case',use_case, + '-res', lnd_grid, + '-mask',gridmask, + '-clm_start_type', start_type, + '-l_ncpl', lnd_ncpl, + '-configuration', configuration, + '-structure', structure, + '-lnd_frac', lndfrac_file, + '-glc_nec', glc_nec, + '-co2_ppmv', ccsm_co2_ppmv, + '-co2_type', clm_co2_type, + '-clm_accelerated_spinup', spinup, + '-lnd_tuning_mode',lnd_tuning_mode, + '-config',os.path.join(clmconf, "config_cache.xml"), + '-envxml_dir', os.path.join(os.getcwd(), "namelist"), + nomeg, clm_bldnml_opts] + + cmd = ' '.join(command) + rc, out, err = run_cmd(cmd, from_dir=os.getcwd()) + + #TODO: need to put in error handling + #raise Exception("Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) + + # ----------------------------------------------------- + # copy resolved namelist to rundir + # ----------------------------------------------------- + + if os.path.isdir(rundir): + file1 = os.path.join(clmconf, "lnd_in") + file2 = os.path.join(rundir , "lnd_in") + logger.debug("CLM namelist copy: file1 %s file2 %s " %(file1, file2)) + shutil.copy(file1,file2) + +############################################################################### +if __name__ == "__main__": + buildnml() + + diff --git a/lilac_config/lnd_input.py b/lilac_config/lnd_input.py new file mode 100644 index 0000000000..c6cfe23caa --- /dev/null +++ b/lilac_config/lnd_input.py @@ -0,0 +1,23 @@ +# set the run directory +rundir = "/glade/u/home/mvertens/src/LILAC/lilac_atm_driver" + +# set the input namelist options for clm's build-namelist +clm_phys = "clm5_0" +start_type = "default" +start_ymd = "20000101" +startfile_type = "finidat" +ignore = "-ignore_ic_year" +configuration = "clm" +structure = "standard" +ccsm_co2_ppmv = str(367.0) +clm_co2_type = "constant" +clm_bldnml_opts = "-bgc sp" +use_case = "2000_control" +lnd_tuning_mode = "clm5_0_GSWP3v1" +spinup = "off" +gridmask = "gx3v7" +lnd_grid = "4x5" +lnd_domain_file = "domain.lnd.fv4x5_gx3v7.091218.nc" +lnd_domain_path = "/glade/p/cesmdata/cseg/inputdata/share/domains" +din_loc_root = "/glade/p/cesmdata/cseg/inputdata" +clm_namelist_opts = "" diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index e3d3d58820..1b88a27204 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -674,7 +674,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) !-------------------------------- call t_startf ('lc_lnd_import') - call import_fields( gcomp, bounds, rc) + call import_fields(gcomp, bounds, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call t_stopf ('lc_lnd_import') @@ -701,7 +701,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) caldayp1 = get_curr_calday(offset=dtime) !-------------------------------- - ! Get time of next atmospheric shortwave calculation + ! Get time of next atmospheric shortwave calculation !-------------------------------- ! TODO(NS): nextsw_cday should come directly from atmosphere! @@ -712,6 +712,25 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) write(iulog,*) trim(subname) // '... nextsw_cday is : ', nextsw_cday end if + !-------------------------------- + ! Obtain orbital values + !-------------------------------- + + call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) + call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) + + if (masterproc) then + write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + write(iulog,F02) 'calday is : ', calday + write(iulog,F02) 'eccen is : ', eccen + write(iulog,F02) 'mvelpp is : ', mvelpp + write(iulog,F02) 'lambm0 is : ', lambm0 + write(iulog,F02) 'obliqr is : ', obliqr + write(iulog,F02) 'declin is : ', declin + write(iulog,F02) 'declinp1 is : ', declinp1 + write(iulog,* ) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' + end if + !-------------------------------- ! Determine doalb based on nextsw_cday sent from atm model !-------------------------------- @@ -728,54 +747,53 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) if (masterproc) then write(iulog,*) '------------ LILAC ----------------' - write(iulog,*) trim(subname) // 'nstep : ', nstep - write(iulog,*) trim(subname) // 'dtime : ', dtime - write(iulog,*) trim(subname) // 'calday : ', calday - write(iulog,*) trim(subname) // 'caldayp1 : ', caldayp1 - write(iulog,*) trim(subname) // 'nextsw_cday : ', nextsw_cday + write(iulog,*) 'nstep : ', nstep + write(iulog,*) 'calday : ', calday + write(iulog,*) 'caldayp1 : ', caldayp1 + write(iulog,*) 'nextsw_cday : ', nextsw_cday + write(iulog,*) 'doalb : ', doalb write(iulog,*) '-------------------------------------' end if call update_rad_dtime(doalb) - if (masterproc) then - write(iulog,*) 'doalb is: ', doalb - end if - !-------------------------------- ! Determine if time to write restart !-------------------------------- - !call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - - !if (ESMF_AlarmIsRinging(alarm, rc=rc)) then - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !rstwr = .true. - !call ESMF_AlarmRingerOff( alarm, rc=rc ) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !else - !rstwr = .false. - !endif + call ESMF_ClockGetAlarm(clock, alarmname='lilac_restart_alarm', alarm=alarm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! TODO: for now hardwire rstwr to .false. - rstwr = .false. + if (ESMF_AlarmIsRinging(alarm, rc=rc)) then + if (ChkErr(rc,__LINE__,u_FILE_u)) return + rstwr = .true. + call ESMF_AlarmRingerOff( alarm, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + rstwr = .false. + endif + if (masterproc) then + write(iulog,*)' restart alarm is ',rstwr + end if !-------------------------------- ! Determine if time to stop !-------------------------------- - !call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_ClockGetAlarm(clock, alarmname='lilac_stop_alarm', alarm=alarm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - !if (ESMF_AlarmIsRinging(alarm, rc=rc)) then - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !nlend = .true. - !call ESMF_AlarmRingerOff( alarm, rc=rc ) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - !else - ! nlend = .false. - !endif + if (ESMF_AlarmIsRinging(alarm, rc=rc)) then + if (ChkErr(rc,__LINE__,u_FILE_u)) return + nlend = .true. + call ESMF_AlarmRingerOff( alarm, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + nlend = .false. + endif + if (masterproc) then + write(iulog,*)' stop alarm is ',nlend + end if !-------------------------------- ! Run CTSM @@ -783,27 +801,6 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) call t_barrierf('sync_ctsm_run1', mpicom) - call t_startf ('shr_orb_decl') - calday = get_curr_calday() - - call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) - call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) - - if (masterproc) then - write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' - write(iulog,*) 'doalb : ', doalb - write(iulog,F02) 'calday is : ', calday - write(iulog,F02) 'eccen is : ', eccen - write(iulog,F02) 'mvelpp is : ', mvelpp - write(iulog,F02) 'lambm0 is : ', lambm0 - write(iulog,F02) 'obliqr is : ', obliqr - write(iulog,F02) 'declin is : ', declin - write(iulog,F02) 'declinp1 is : ', declinp1 - write(iulog,* ) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' - end if - - call t_stopf ('shr_orb_decl') - ! Restart File - use nexttimestr rather than currtimestr here since that is the time at the end of ! the timestep and is preferred for restart file names ! TODO: is this correct for lilac? From 34b001a94d51e6b3b5e5c4ec5d7b96795a40fdfd Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 09:55:13 -0700 Subject: [PATCH 0435/1973] updated buildnml --- lilac_config/buildnml | 37 +++++++++++++------------------------ lilac_config/lnd_input.py | 2 +- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index b4a4ab198e..5d65dcfce5 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -125,19 +125,11 @@ def buildnml(): # clm5_0_cam6.0, clm5_0_GSWP3v1, clm5_0_CRUv7, clm4_5_CRUv7, clm4_5_GSWP3v1, clm4_5_cam6.0 # - only support startup or continue runs for now - glc_nec = str(10) # - lnd_ncpl = str(1) # this will not be used - but is only here as a place holder to satisfy build_namelist - nomeg = "" - caseroot = "." - # set path for the namelist assume that build namelist in lilac_conf/namelist - clmconf = os.path.join(os.getcwd(),"namelist") - infile = os.path.join(clmconf, "namelist") + clmconf = rundir inputdata_file = os.path.join(clmconf, "clm.input_data_list") config_cache = os.path.join(clmconf, "config_cache.xml") - env_lilac = os.path.join(clmconf, "env_lilac.xml") - lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) - + # create clmconf if it does not exist if not os.path.isdir(clmconf): os.makedirs(clmconf) @@ -153,7 +145,8 @@ def buildnml(): with open(config_cache, 'w') as tempfile: tempfile.write(config_cache_text) - # Create env_lilac text + # Create temporary env_lilac.xml + env_lilac = os.path.join(clmconf, "env_lilac.xml") env_lilac_text = _env_lilac_template.format() with open(env_lilac, 'w') as tempfile: tempfile.write(env_lilac_text) @@ -171,34 +164,30 @@ def buildnml(): '-res', lnd_grid, '-mask',gridmask, '-clm_start_type', start_type, - '-l_ncpl', lnd_ncpl, + '-l_ncpl', str(1), # this will not be used in lilac - but is needed as input '-configuration', configuration, '-structure', structure, - '-lnd_frac', lndfrac_file, - '-glc_nec', glc_nec, + '-lnd_frac', os.path.join(lnd_domain_path,lnd_domain_file), + '-glc_nec', str(10), '-co2_ppmv', ccsm_co2_ppmv, '-co2_type', clm_co2_type, '-clm_accelerated_spinup', spinup, '-lnd_tuning_mode',lnd_tuning_mode, '-config',os.path.join(clmconf, "config_cache.xml"), '-envxml_dir', os.path.join(os.getcwd(), "namelist"), - nomeg, clm_bldnml_opts] + clm_bldnml_opts] cmd = ' '.join(command) rc, out, err = run_cmd(cmd, from_dir=os.getcwd()) - - #TODO: need to put in error handling - #raise Exception("Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) + if rc > 0: + raise Exception("Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) # ----------------------------------------------------- - # copy resolved namelist to rundir + # remove temporary files from rundir # ----------------------------------------------------- - if os.path.isdir(rundir): - file1 = os.path.join(clmconf, "lnd_in") - file2 = os.path.join(rundir , "lnd_in") - logger.debug("CLM namelist copy: file1 %s file2 %s " %(file1, file2)) - shutil.copy(file1,file2) + os.remove(os.path.join(rundir, "config_cache.xml")) + os.remove(os.path.join(rundir, "env_lilac.xml")) ############################################################################### if __name__ == "__main__": diff --git a/lilac_config/lnd_input.py b/lilac_config/lnd_input.py index c6cfe23caa..afee3840ac 100644 --- a/lilac_config/lnd_input.py +++ b/lilac_config/lnd_input.py @@ -1,5 +1,5 @@ # set the run directory -rundir = "/glade/u/home/mvertens/src/LILAC/lilac_atm_driver" +rundir = "/glade/u/home/mvertens/src/LILAC/lilac/atm_driver" # set the input namelist options for clm's build-namelist clm_phys = "clm5_0" From e294a021509ae057e150b40fadd4c97f8bc1076a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 10:06:28 -0700 Subject: [PATCH 0436/1973] cleaner version of buildnml --- lilac_config/buildnml | 49 +++++++++++---------------------------- lilac_config/lnd_input.py | 5 ++++ 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 5d65dcfce5..73d6b3036c 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -1,18 +1,15 @@ #!/usr/bin/env python """ -CLM namelist creator +CTSM namelist creator """ + import sys, os, shutil, subprocess, logging import six from lnd_input import * logger = logging.getLogger(__name__) -# Find python version -PY3 = sys.version_info[0] > 2 -PYSUBVER = sys.version_info[1] - _config_cache_template = """ @@ -117,48 +114,31 @@ def run_cmd(cmd, input_str=None, from_dir=None, verbose=None, def buildnml(): ############################################################################### - """Build the clm namelist """ - - # A few notes: - # - tuning parameters and initial conditions should be optimized for what CLM model version and - # what meteorlogical forcing combination? valid values are: - # clm5_0_cam6.0, clm5_0_GSWP3v1, clm5_0_CRUv7, clm4_5_CRUv7, clm4_5_GSWP3v1, clm4_5_cam6.0 - # - only support startup or continue runs for now + """Build the ctsm namelist """ - # set path for the namelist assume that build namelist in lilac_conf/namelist - clmconf = rundir - inputdata_file = os.path.join(clmconf, "clm.input_data_list") - config_cache = os.path.join(clmconf, "config_cache.xml") - - # create clmconf if it does not exist - if not os.path.isdir(clmconf): - os.makedirs(clmconf) + # check if rundir exists + if not os.path.isdir(rundir): + raise Exception("rundir %s does not exist".format(rundir)) - # clean inputdata_file if it does exist - if os.path.exists(inputdata_file): - os.remove(inputdata_file) - - # Create config_cache.xml file + # create config_cache.xml file # Note that build-namelist utilizes the contents of the config_cache.xml file in # the namelist_defaults.xml file to obtain namelist variables + config_cache = os.path.join(rundir, "config_cache.xml") config_cache_text = _config_cache_template.format(clm_phys=clm_phys) with open(config_cache, 'w') as tempfile: tempfile.write(config_cache_text) - # Create temporary env_lilac.xml - env_lilac = os.path.join(clmconf, "env_lilac.xml") + # create temporary env_lilac.xml + env_lilac = os.path.join(rundir, "env_lilac.xml") env_lilac_text = _env_lilac_template.format() with open(env_lilac, 'w') as tempfile: tempfile.write(env_lilac_text) - # ----------------------------------------------------- # call build-namelist - # ----------------------------------------------------- - cmd = os.path.join(os.pardir, "bld","build-namelist") command = [cmd, '-csmdata', din_loc_root, - '-inputdata', inputdata_file, ignore, + '-inputdata', os.path.join(rundir, "clm.input_data_list"), '-namelist', '\'&clm_inparm start_ymd={} {}/\''.format(start_ymd, clm_namelist_opts), '-use_case',use_case, '-res', lnd_grid, @@ -173,8 +153,8 @@ def buildnml(): '-co2_type', clm_co2_type, '-clm_accelerated_spinup', spinup, '-lnd_tuning_mode',lnd_tuning_mode, - '-config',os.path.join(clmconf, "config_cache.xml"), - '-envxml_dir', os.path.join(os.getcwd(), "namelist"), + '-config',os.path.join(rundir, "config_cache.xml"), + '-envxml_dir', rundir, clm_bldnml_opts] cmd = ' '.join(command) @@ -182,10 +162,7 @@ def buildnml(): if rc > 0: raise Exception("Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) - # ----------------------------------------------------- # remove temporary files from rundir - # ----------------------------------------------------- - os.remove(os.path.join(rundir, "config_cache.xml")) os.remove(os.path.join(rundir, "env_lilac.xml")) diff --git a/lilac_config/lnd_input.py b/lilac_config/lnd_input.py index afee3840ac..a613ea6a80 100644 --- a/lilac_config/lnd_input.py +++ b/lilac_config/lnd_input.py @@ -1,3 +1,8 @@ +# - tuning parameters and initial conditions should be optimized for what CLM model version and +# what meteorlogical forcing combination? valid values are: +# clm5_0_cam6.0, clm5_0_GSWP3v1, clm5_0_CRUv7, clm4_5_CRUv7, clm4_5_GSWP3v1, clm4_5_cam6.0 +# - only support startup or continue runs for now + # set the run directory rundir = "/glade/u/home/mvertens/src/LILAC/lilac/atm_driver" From 638acf0182ed8c59a604209ebfa342382687302b Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 10:39:28 -0700 Subject: [PATCH 0437/1973] added new parsing for buildnml --- lilac_config/buildnml | 33 +++++++++++++++++++++++++-------- lilac_config/lnd_input.py | 7 +++---- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 73d6b3036c..31a368acb8 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -4,9 +4,10 @@ CTSM namelist creator """ -import sys, os, shutil, subprocess, logging +import sys, os, shutil, subprocess, logging, argparse import six from lnd_input import * +from argparse import RawTextHelpFormatter logger = logging.getLogger(__name__) @@ -35,6 +36,23 @@ _env_lilac_template = """ _hack=object() +############################################################################### +def parse_command_line(args, description): +############################################################################### + + parser = argparse.ArgumentParser(formatter_class=RawTextHelpFormatter, description=description) + + parser.add_argument("--rundir", type=str, default=os.getcwd(), + help="(required) specify the full path of the run directory)") + + arguments = parser.parse_args(args) + + # check if rundir exists + if not os.path.isdir(arguments.rundir): + raise Exception("rundir %s does not exist".format(arguments.rundir)) + + return arguments.rundir + ############################################################################### def run_cmd(cmd, input_str=None, from_dir=None, verbose=None, arg_stdout=_hack, arg_stderr=_hack, env=None, combine_output=False): @@ -111,15 +129,11 @@ def run_cmd(cmd, input_str=None, from_dir=None, verbose=None, return stat, output, errput ############################################################################### -def buildnml(): +def buildnml(rundir, bldnmldir): ############################################################################### """Build the ctsm namelist """ - # check if rundir exists - if not os.path.isdir(rundir): - raise Exception("rundir %s does not exist".format(rundir)) - # create config_cache.xml file # Note that build-namelist utilizes the contents of the config_cache.xml file in # the namelist_defaults.xml file to obtain namelist variables @@ -135,7 +149,7 @@ def buildnml(): tempfile.write(env_lilac_text) # call build-namelist - cmd = os.path.join(os.pardir, "bld","build-namelist") + cmd = os.path.abspath(os.path.join(bldnmldir, os.pardir, "bld","build-namelist")) command = [cmd, '-csmdata', din_loc_root, '-inputdata', os.path.join(rundir, "clm.input_data_list"), @@ -167,7 +181,10 @@ def buildnml(): os.remove(os.path.join(rundir, "env_lilac.xml")) ############################################################################### + if __name__ == "__main__": - buildnml() + rundir = parse_command_line(sys.argv[1:], __doc__) + bldnmldir = os.path.dirname(os.path.abspath(__file__)) + buildnml(rundir, bldnmldir) diff --git a/lilac_config/lnd_input.py b/lilac_config/lnd_input.py index a613ea6a80..d2b202dcae 100644 --- a/lilac_config/lnd_input.py +++ b/lilac_config/lnd_input.py @@ -1,12 +1,11 @@ +# ------------------------------------------------------------------------- +# set the input namelist options for clm's build-namelist +# ------------------------------------------------------------------------- # - tuning parameters and initial conditions should be optimized for what CLM model version and # what meteorlogical forcing combination? valid values are: # clm5_0_cam6.0, clm5_0_GSWP3v1, clm5_0_CRUv7, clm4_5_CRUv7, clm4_5_GSWP3v1, clm4_5_cam6.0 # - only support startup or continue runs for now -# set the run directory -rundir = "/glade/u/home/mvertens/src/LILAC/lilac/atm_driver" - -# set the input namelist options for clm's build-namelist clm_phys = "clm5_0" start_type = "default" start_ymd = "20000101" From 18aa660ba0b0cd1b10684c311ed5a124c20c0b37 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 10:53:14 -0700 Subject: [PATCH 0438/1973] removed hard-wired lnd_in and drv_flds_in - now generated via calls to lilac_config/buildnml in ctsm --- lilac/atm_driver/README | 14 +++ lilac/atm_driver/drv_flds_in | 7 -- lilac/atm_driver/lnd_in | 238 ----------------------------------- 3 files changed, 14 insertions(+), 245 deletions(-) create mode 100644 lilac/atm_driver/README delete mode 100644 lilac/atm_driver/drv_flds_in delete mode 100644 lilac/atm_driver/lnd_in diff --git a/lilac/atm_driver/README b/lilac/atm_driver/README new file mode 100644 index 0000000000..09b9e0d255 --- /dev/null +++ b/lilac/atm_driver/README @@ -0,0 +1,14 @@ +assume the ctsm code base is checked out in $CTSM_ROOTDIR + +- to customize the generated namelist - edit the file + > $CTSM_ROOTDIR/lilac_config/lnd_input.py + +- to create the ctsm namelist FROM THIS DIRECTORY: + > $CTSM_ROOTDIR/lilac_config/buildnml + +- this will now create the files lnd_in, drv_flds_in, and clm.input_data_list in this directory + THIS ONLY NEEDS TO BE DONE ONCE + to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory + + + diff --git a/lilac/atm_driver/drv_flds_in b/lilac/atm_driver/drv_flds_in deleted file mode 100644 index bca8f84a0b..0000000000 --- a/lilac/atm_driver/drv_flds_in +++ /dev/null @@ -1,7 +0,0 @@ -&megan_emis_nl - megan_factors_file = '/glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc' - megan_specifier = 'ISOP = isoprene', - 'C10H16 = pinene_a + carene_3 + thujene_a', 'CH3OH = methanol', - 'C2H5OH = ethanol', 'CH2O = formaldehyde', 'CH3CHO = acetaldehyde', - 'CH3COOH = acetic_acid', 'CH3COCH3 = acetone' -/ diff --git a/lilac/atm_driver/lnd_in b/lilac/atm_driver/lnd_in deleted file mode 100644 index 2a0b650433..0000000000 --- a/lilac/atm_driver/lnd_in +++ /dev/null @@ -1,238 +0,0 @@ -&clm_inparm - albice = 0.50,0.30 - co2_ppmv = 367.0 - co2_type = 'constant' - collapse_urban = .false. - create_crop_landunit = .true. - crop_fsat_equals_zero = .false. - dtime = 1800 - fatmlndfrc = '/glade/p/cesmdata/cseg/inputdata/share/domains/domain.lnd.fv4x5_gx3v7.091218.nc' - finidat = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180715.nc' - fsnowaging = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc' - fsnowoptics = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc' - fsurdat = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc' - glc_do_dynglacier = .false. - glc_snow_persistence_max_days = 0 - h2osno_max = 10000.0 - hist_mfilt = 1 - hist_ndens = 1 - hist_nhtfrq = 1 - irrigate = .true. - maxpatch_glcmec = 10 - maxpatch_pft = 17 - n_dom_landunits = 0 - n_dom_pfts = 0 - nlevsno = 12 - nsegspc = 35 - paramfile = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/paramdata/clm5_params.c190829.nc' - run_zero_weight_urban = .false. - snow_cover_fraction_method = 'SwensonLawrence2012' - soil_layerstruct_predefined = '20SL_8.5m' - spinup_state = 0 - toosmall_crop = 0.d00 - toosmall_glacier = 0.d00 - toosmall_lake = 0.d00 - toosmall_soil = 0.d00 - toosmall_urban = 0.d00 - toosmall_wetland = 0.d00 - use_bedrock = .true. - use_century_decomp = .false. - use_cn = .false. - use_crop = .false. - use_dynroot = .false. - use_fates = .false. - use_fertilizer = .false. - use_fun = .false. - use_grainproduct = .false. - use_hydrstress = .true. - use_init_interp = .true. - use_lai_streams = .false. - use_lch4 = .false. - use_luna = .true. - use_nitrif_denitrif = .false. - use_subgrid_fluxes = .true. - use_vertsoilc = .false. -/ -&ndepdyn_nml -/ -&popd_streams -/ -&urbantv_streams - stream_fldfilename_urbantv = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc' - stream_year_first_urbantv = 2000 - stream_year_last_urbantv = 2000 - urbantvmapalgo = 'nn' -/ -&light_streams -/ -&lai_streams - lai_mapalgo = 'bilinear' - model_year_align_lai = 2001 - stream_fldfilename_lai = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/lai_streams/MODISPFTLAI_0.5x0.5_c140711.nc' - stream_year_first_lai = 2001 - stream_year_last_lai = 2013 -/ -&atm2lnd_inparm - glcmec_downscale_longwave = .true. - lapse_rate = 0.006 - lapse_rate_longwave = 0.032 - longwave_downscaling_limit = 0.5 - precip_repartition_glc_all_rain_t = 0. - precip_repartition_glc_all_snow_t = -2. - precip_repartition_nonglc_all_rain_t = 2. - precip_repartition_nonglc_all_snow_t = 0. - repartition_rain_snow = .true. -/ -&lnd2atm_inparm - melt_non_icesheet_ice_runoff = .true. -/ -&clm_canopyhydrology_inparm - interception_fraction = 1.0 - maximum_leaf_wetted_fraction = 0.05 - use_clm5_fpi = .true. -/ -&cnphenology -/ -&clm_soilhydrology_inparm -/ -&dynamic_subgrid - reset_dynbal_baselines = .false. -/ -&cnvegcarbonstate -/ -&finidat_consistency_checks -/ -&dynpft_consistency_checks -/ -&clm_initinterp_inparm - init_interp_method = 'general' -/ -¢ury_soilbgcdecompcascade -/ -&soilhydrology_inparm - baseflow_scalar = 0.001d00 -/ -&luna - jmaxb1 = 0.093563 -/ -&friction_velocity - zetamaxstable = 0.5d00 -/ -&mineral_nitrogen_dynamics -/ -&soilwater_movement_inparm - dtmin = 60. - expensive = 42 - flux_calculation = 1 - inexpensive = 1 - lower_boundary_condition = 2 - soilwater_movement_method = 1 - upper_boundary_condition = 1 - verysmall = 1.e-8 - xtolerlower = 1.e-2 - xtolerupper = 1.e-1 -/ -&rooting_profile_inparm - rooting_profile_method_carbon = 1 - rooting_profile_method_water = 1 -/ -&soil_resis_inparm - soil_resis_method = 1 -/ -&bgc_shared -/ -&canopyfluxes_inparm - itmax_canopy_fluxes = 40 - use_undercanopy_stability = .false. -/ -&aerosol - fresh_snw_rds_max = 204.526d00 -/ -&clmu_inparm - building_temp_method = 1 - urban_hac = 'ON_WASTEHEAT' - urban_traffic = .false. -/ -&clm_soilstate_inparm - organic_frac_squared = .false. -/ -&clm_nitrogen - lnc_opt = .false. -/ -&clm_snowhydrology_inparm - lotmp_snowdensity_method = 'Slater2017' - reset_snow = .false. - reset_snow_glc = .false. - reset_snow_glc_ela = 1.e9 - snow_dzmax_l_1 = 0.03d00 - snow_dzmax_l_2 = 0.07d00 - snow_dzmax_u_1 = 0.02d00 - snow_dzmax_u_2 = 0.05d00 - snow_dzmin_1 = 0.010d00 - snow_dzmin_2 = 0.015d00 - snow_overburden_compaction_method = 'Vionnet2012' - upplim_destruct_metamorph = 175.d00 - wind_dependent_snow_density = .true. -/ -&cnprecision_inparm -/ -&clm_glacier_behavior - glacier_region_behavior = 'single_at_atm_topo','virtual','virtual','multiple' - glacier_region_ice_runoff_behavior = 'melted','melted','remains_ice','remains_ice' - glacier_region_melt_behavior = 'remains_in_place','replaced_by_ice','replaced_by_ice','replaced_by_ice' -/ -&crop -/ -&irrigation_inparm - irrig_depth = 0.6 - irrig_length = 14400 - irrig_method_default = 'drip' - irrig_min_lai = 0.0 - irrig_start_time = 21600 - irrig_target_smp = -3400. - irrig_threshold_fraction = 1.0 - limit_irrigation_if_rof_enabled = .false. - use_groundwater_irrigation = .false. -/ -&surfacealbedo_inparm - snowveg_affects_radiation = .true. -/ -&water_tracers_inparm - enable_water_isotopes = .false. - enable_water_tracer_consistency_checks = .false. -/ -&clm_humanindex_inparm - calc_human_stress_indices = 'FAST' -/ -&cnmresp_inparm -/ -&photosyns_inparm - leafresp_method = 0 - light_inhibit = .true. - modifyphoto_and_lmr_forcrop = .true. - rootstem_acc = .false. - stomatalcond_method = 'Medlyn2011' -/ -&cnfire_inparm -/ -&cn_general -/ -&nitrif_inparm -/ -&lifire_inparm -/ -&ch4finundated -/ -&clm_canopy_inparm - leaf_mr_vcm = 0.015d00 -/ -&scf_swenson_lawrence_2012_inparm - int_snow_max = 2000. - n_melt_glcmec = 10.0d00 -/ -!#-------------------------------------------------------------------------------------------------------------------------- -!# lnd_in:: Comment: -!# This namelist was created using the following command-line: -!# /glade/work/negins/ctsm_negin/bld/CLM build-namelist -cimeroot /glade/work/negins/ctsm_negin/cime/scripts/Tools/../.. -infile /glade/scratch/negins/ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_lilac_2/Buildconf/clmconf/namelist -csmdata /glade/p/cesmdata/cseg/inputdata -inputdata /glade/scratch/negins/ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_lilac_2/Buildconf/clm.input_data_list -ignore_ic_year -namelist &clm_inparm start_ymd=20000101 / -use_case 2000_control -res 4x5 -clm_start_type default -envxml_dir /glade/scratch/negins/ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_lilac_2 -l_ncpl 48 -configuration clm -structure standard -lnd_frac /glade/p/cesmdata/cseg/inputdata/share/domains/domain.lnd.fv4x5_gx3v7.091218.nc -glc_nec 10 -co2_ppmv 367.0 -co2_type constant -config /glade/scratch/negins/ctsm1.0.dev066_MCT_I2000Clm50SpRsGs_lilac_2/Buildconf/clmconf/config_cache.xml -bgc sp -clm_accelerated_spinup off -lnd_tuning_mode clm5_0_GSWP3v1 -mask gx3v7 -!# For help on options use: /glade/work/negins/ctsm_negin/bld/CLM build-namelist -help -!#-------------------------------------------------------------------------------------------------------------------------- From 8625a0d4783908d3890b9b8119d65d6e44b572f3 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 12:47:00 -0700 Subject: [PATCH 0439/1973] more updates to clean up atm driver --- lilac/atm_driver/Makefile | 2 - lilac/atm_driver/atm_driver.F90 | 48 +++---- lilac/atm_driver/atm_driver_in | 4 +- lilac/atm_driver/drv_in | 234 -------------------------------- lilac/lilac/lilac_mod.F90 | 22 ++- lilac/lilac/lilac_utils.F90 | 15 +- 6 files changed, 46 insertions(+), 279 deletions(-) diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 860c6743d7..a2521fca0a 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -14,8 +14,6 @@ include $(ESMFMKFILE) #================================================================================ ### Define directory paths #================================================================================ -# Temporarily hard-coded -# TODO: Please fix this part. CASE_NAME = why01-g CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf CTSM_INC = -I$(CTSM_BLD_DIR)/include diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 56a6759a8a..146ba9b9c2 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -26,7 +26,7 @@ program atm_driver integer :: comp_comm integer :: ierr real , allocatable :: centerCoords(:,:) - real , allocatable :: lon(:), lat(:) + real , allocatable :: atm_lons(:), atm_lats(:) integer , allocatable :: atm_global_index(:) integer :: mytask, ntasks integer :: my_start, my_end @@ -37,7 +37,7 @@ program atm_driver integer :: fileunit ! for namelist input ! Namelist and related variables - character(len=512) :: atm_mesh_filename + character(len=512) :: atm_mesh_file character(len=128) :: atm_calendar integer :: atm_timestep integer :: atm_start_year ! (yyyy) @@ -51,7 +51,7 @@ program atm_driver integer :: atm_timestep_start ! for internal time loop only integer :: atm_timestep_stop ! for internal time loop only - namelist /lilac_input/ atm_mesh_filename, atm_calendar, atm_timestep, & + namelist /atm_driver_input/ atm_mesh_file, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, & atm_timestep_start, atm_timestep_stop @@ -88,7 +88,7 @@ program atm_driver ! master processor and broadcast in the future open(newunit=fileunit, status="old", file="atm_driver_in") - read(fileunit, lilac_input, iostat=ierr) + read(fileunit, atm_driver_input, iostat=ierr) if (ierr > 0) then call shr_sys_abort( 'problem on read of atm_driver_in') end if @@ -98,9 +98,10 @@ program atm_driver ! Read mesh file to get number of points (n_points) !----------------------------------------------------------------------------- - call read_netcdf_mesh(atm_mesh_filename, nglobal) + print *, "DEBUG: atm_mesh_file = ",trim(atm_mesh_file) + call read_netcdf_mesh(atm_mesh_file, nglobal) if (mytask == 0 ) then - print *, " atm_driver mesh file ",trim(atm_mesh_filename) + print *, " atm_driver mesh file ",trim(atm_mesh_file) print *, "number of global points in mesh is:", nglobal end if @@ -125,6 +126,17 @@ program atm_driver i_global = i_global + 1 end do + ! first determine lats and lons + allocate(atm_lons(nlocal)) + allocate(atm_lats(nlocal)) + do i = 1,nlocal + i_global = atm_global_index(i) + atm_lons(i) = centerCoords(1,i_global) + atm_lons(i) = real(nint(atm_lons(i))) ! rounding to nearest int + atm_lats(i) = centerCoords(2,i_global) + atm_lats(i) = real(nint(atm_lats(i))) ! rounding to nearest int + end do + !------------------------------------------------------------------------ ! Initialize lilac !------------------------------------------------------------------------ @@ -132,7 +144,8 @@ program atm_driver if (mytask == 0 ) then print *, " initializing lilac " end if - call lilac_init(atm_global_index, atm_mesh_filename, atm_calendar, atm_timestep, & + call lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & + atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) @@ -140,19 +153,8 @@ program atm_driver ! Fill in atm2lnd type pointer data !------------------------------------------------------------------------ - ! first determine lats and lons - allocate(lon(nlocal)) - allocate(lat(nlocal)) - do i = 1,nlocal - i_global = atm_global_index(i) - lon(i) = centerCoords(1,i_global) - lon(i) = real(nint(lon(i))) ! rounding to nearest int - lat(i) = centerCoords(2,i_global) - lat(i) = real(nint(lat(i))) ! rounding to nearest int - end do - ! now fill in the dataptr values - call atm_to_lilac (lon, lat) + call atm_driver_to_lilac (atm_lons, atm_lats) !------------------------------------------------------------------------ ! Run lilac @@ -253,7 +255,7 @@ subroutine nc_check_err(ierror, description, filename) end subroutine nc_check_err !======================================================================== - subroutine atm_to_lilac (lon, lat) + subroutine atm_driver_to_lilac (lon, lat) ! input/output variables real, intent(in) :: lon(:) @@ -320,10 +322,10 @@ subroutine atm_to_lilac (lon, lat) data(:) = 40.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atm2lnd('Faxa_swvdf', data) - end subroutine atm_to_lilac + end subroutine atm_driver_to_lilac !======================================================================== - subroutine lilac_to_atm () + subroutine lilac_to_atm_driver () ! local variables integer :: lsize @@ -346,6 +348,6 @@ subroutine lilac_to_atm () call lilac_lnd2atm('Sl_fv' , data) call lilac_lnd2atm('Sl_ram1' , data) - end subroutine lilac_to_atm + end subroutine lilac_to_atm_driver end program diff --git a/lilac/atm_driver/atm_driver_in b/lilac/atm_driver/atm_driver_in index ba32e9e528..b4becacda4 100644 --- a/lilac/atm_driver/atm_driver_in +++ b/lilac/atm_driver/atm_driver_in @@ -1,4 +1,5 @@ -&lilac_input +&atm_driver_input + atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' atm_start_year = 2000 atm_start_mon = 1 atm_start_day = 1 @@ -9,7 +10,6 @@ atm_stop_secs = 0 atm_timestep = 1800 atm_calendar = 'NOLEAP' - atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' atm_timestep_start = 1 atm_timestep_stop = 48 diff --git a/lilac/atm_driver/drv_in b/lilac/atm_driver/drv_in index 76d084e624..0282ee8721 100644 --- a/lilac/atm_driver/drv_in +++ b/lilac/atm_driver/drv_in @@ -1,62 +1,3 @@ -&cime_driver_inst - ninst_driver = 1 -/ -&cime_pes - atm_layout = "concurrent" - atm_ntasks = 36 - atm_nthreads = 1 - atm_pestride = 1 - atm_rootpe = 0 - cpl_ntasks = 36 - cpl_nthreads = 1 - cpl_pestride = 1 - cpl_rootpe = 36 - esp_layout = "concurrent" - esp_ntasks = 1 - esp_nthreads = 1 - esp_pestride = 1 - esp_rootpe = 0 - glc_layout = "concurrent" - glc_ntasks = 36 - glc_nthreads = 1 - glc_pestride = 1 - glc_rootpe = 36 - iac_layout = "concurrent" - iac_ntasks = 1 - iac_nthreads = 1 - iac_pestride = 1 - iac_rootpe = 0 - ice_layout = "concurrent" - ice_ntasks = 36 - ice_nthreads = 1 - ice_pestride = 1 - ice_rootpe = 36 - info_taskmap_comp = 0 - info_taskmap_model = 0 - lnd_layout = "concurrent" - lnd_ntasks = 36 - lnd_nthreads = 1 - lnd_pestride = 1 - lnd_rootpe = 36 - ocn_layout = "concurrent" - ocn_ntasks = 36 - ocn_nthreads = 1 - ocn_pestride = 1 - ocn_rootpe = 36 - rof_layout = "concurrent" - rof_ntasks = 36 - rof_nthreads = 1 - rof_pestride = 1 - rof_rootpe = 36 - wav_layout = "concurrent" - wav_ntasks = 36 - wav_nthreads = 1 - wav_pestride = 1 - wav_rootpe = 36 -/ -&esmf_inparm - esmf_logfile_kind = "ESMF_LOGKIND_NONE" -/ &papi_inparm papi_ctr1_str = "PAPI_FP_OPS" papi_ctr2_str = "PAPI_NO_CTR" @@ -91,178 +32,3 @@ profile_single_file = .false. profile_timer = 4 / -&seq_cplflds_inparm - flds_bgc_oi = .false. - flds_co2_dmsa = .false. - flds_co2a = .false. - flds_co2b = .false. - flds_co2c = .false. - flds_wiso = .false. - glc_nec = 10 - ice_ncat = 1 - nan_check_component_fields = .true. - seq_flds_i2o_per_cat = .false. -/ -&seq_cplflds_userspec - cplflds_custom = "" -/ -&seq_infodata_inparm - aoflux_grid = "ocn" - aqua_planet = .false. - aqua_planet_sst = 1 - atm_gnam = "4x5" - bfbflag = .false. - brnch_retain_casename = .false. - budget_ann = 1 - budget_daily = 0 - budget_inst = 0 - budget_ltann = 1 - budget_ltend = 0 - budget_month = 1 - case_desc = "UNSET" - case_name = "datm_test_mct01" - cime_model = "cesm" - coldair_outbreak_mod = .true. - cpl_decomp = 0 - cpl_seq_option = "CESM1_MOD" - do_budgets = .false. - do_histinit = .false. - drv_threading = .false. - eps_aarea = 9e-07 - eps_agrid = 1e-12 - eps_amask = 1e-13 - eps_frac = 1.0e-02 - eps_oarea = 0.1 - eps_ogrid = 0.01 - eps_omask = 1e-06 - flux_albav = .false. - flux_convergence = 0.01 - flux_diurnal = .false. - flux_epbal = "off" - flux_max_iteration = 5 - force_stop_at = "month" - glc_gnam = "null" - glc_renormalize_smb = "on_if_glc_coupled_fluxes" - histaux_a2x = .false. - histaux_a2x1hr = .false. - histaux_a2x1hri = .false. - histaux_a2x24hr = .false. - histaux_a2x3hr = .false. - histaux_a2x3hrp = .false. - histaux_double_precision = .false. - histaux_l2x = .false. - histaux_l2x1yrg = .false. - histaux_r2x = .false. - histavg_atm = .true. - histavg_glc = .true. - histavg_iac = .true. - histavg_ice = .true. - histavg_lnd = .true. - histavg_ocn = .true. - histavg_rof = .true. - histavg_wav = .true. - histavg_xao = .true. - hostname = "cheyenne" - iac_gnam = "null" - ice_gnam = "null" - info_debug = 1 - lnd_gnam = "4x5" - logfilepostfix = ".log" - max_cplstep_time = 0.0 - mct_usealltoall = .false. - mct_usevector = .false. - model_doi_url = "https://doi.org/10.5065/D67H1H0V" - model_version = "cesm-cmeps-v0.8-19-gae1c5be" - ocn_gnam = "null" - orb_eccen = 1.e36 - orb_iyear = 2000 - orb_iyear_align = 2000 - orb_mode = "fixed_year" - orb_mvelp = 1.e36 - orb_obliq = 1.e36 - outpathroot = "./" - reprosum_allow_infnan = .false. - reprosum_diffmax = -1.0e-8 - reprosum_recompute = .false. - reprosum_use_ddpdd = .false. - restart_file = "str_undefined" - rof_gnam = "null" - run_barriers = .false. - scmlat = -999. - scmlon = -999. - shr_map_dopole = .true. - single_column = .false. - start_type = "startup" - tchkpt_dir = "./timing/checkpoints" - tfreeze_option = "mushy" - timing_dir = "./timing" - username = "negins" - vect_map = "cart3d" - wall_time_limit = -1.0 - wav_gnam = "null" - wv_sat_scheme = "GoffGratch" - wv_sat_table_spacing = 1.0D0 - wv_sat_transition_start = 20.0D0 - wv_sat_use_tables = .false. -/ -&seq_timemgr_inparm - atm_cpl_dt = 1800 - atm_cpl_offset = 0 - barrier_n = 1 - barrier_option = "ndays" - barrier_ymd = -999 - calendar = "NO_LEAP" - data_assimilation_atm = .false. - data_assimilation_cpl = .false. - data_assimilation_glc = .false. - data_assimilation_iac = .false. - data_assimilation_ice = .false. - data_assimilation_lnd = .false. - data_assimilation_ocn = .false. - data_assimilation_rof = .false. - data_assimilation_wav = .false. - end_restart = .false. - esp_cpl_offset = 0 - esp_run_on_pause = .true. - glc_avg_period = "yearly" - glc_cpl_dt = 1800 - glc_cpl_offset = 0 - histavg_n = -999 - histavg_option = "never" - histavg_ymd = -999 - history_n = -999 - history_option = "never" - history_ymd = -999 - iac_cpl_offset = 0 - ice_cpl_dt = 1800 - ice_cpl_offset = 0 - lnd_cpl_dt = 1800 - lnd_cpl_offset = 0 - ocn_cpl_dt = 1800 - ocn_cpl_offset = 0 - pause_active_atm = .false. - pause_active_cpl = .false. - pause_active_glc = .false. - pause_active_iac = .false. - pause_active_ice = .false. - pause_active_lnd = .false. - pause_active_ocn = .false. - pause_active_rof = .false. - pause_active_wav = .false. - pause_n = 0 - pause_option = "never" - restart_n = 5 - restart_option = "ndays" - restart_ymd = -999 - rof_cpl_dt = 1800 - start_tod = 0 - start_ymd = 00010101 - stop_n = 5 - stop_option = "ndays" - stop_ymd = -999 - tprof_n = -999 - tprof_option = "never" - tprof_ymd = -999 - wav_cpl_dt = 1800 - wav_cpl_offset = 0 -/ diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 56250e0399..dfd74754c1 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -2,6 +2,9 @@ module lilac_mod !----------------------------------------------------------------------- ! !DESCRIPTION: + ! This is the driver for running CTSM and the ESMF lilac atm cap that + ! is put in place to ensure that the host atmosphere does not need to + ! know about ESMF !----------------------------------------------------------------------- use ESMF @@ -34,7 +37,8 @@ module lilac_mod contains !======================================================================== - subroutine lilac_init(atm_global_index, atm_mesh_filepath, atm_calendar, atm_timestep, & + subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & + atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) @@ -51,8 +55,10 @@ subroutine lilac_init(atm_global_index, atm_mesh_filepath, atm_calendar, atm_tim use shr_sys_mod , only : shr_sys_abort ! input/output variables + character(len=*) , intent(in) :: atm_mesh_file integer , intent(in) :: atm_global_index(:) - character(len=*) , intent(in) :: atm_mesh_filepath + real , intent(in) :: atm_lons(:) + real , intent(in) :: atm_lats(:) character(len=*) , intent(in) :: atm_calendar integer , intent(in) :: atm_timestep integer , intent(in) :: atm_start_year !(yyyy) @@ -109,15 +115,19 @@ subroutine lilac_init(atm_global_index, atm_mesh_filepath, atm_calendar, atm_tim call shr_pio_init1(ncomps=1, nlfilename="drv_in", Global_Comm=mpic) ! TODO: make the filename lilac_in - ! Initialize lilac_util module variable gindex_atm + !------------------------------------------------------------------------- + ! Initial lilac_utils module variables + !------------------------------------------------------------------------- + + ! Initialize gindex_atm lsize = size(atm_global_index) allocate(gindex_atm(lsize)) gindex_atm(:) = atm_global_index(:) - ! Initialize lilac_util module variable for atm mesh file - atm_mesh_filename = atm_mesh_filepath + ! Initialize atm_mesh_filename + atm_mesh_filename = atm_mesh_file - ! Initialize lilac_util module data atm2lnd and lnd2atm + ! Initialize datatypes atm2lnd and lnd2atm call lilac_init_atm2lnd(lsize) call lilac_init_lnd2atm(lsize) diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index 1012654080..25a05cf73b 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -3,20 +3,20 @@ module lilac_utils implicit none private - public :: this_clock public :: lilac_init_atm2lnd public :: lilac_init_lnd2atm public :: lilac_atm2lnd public :: lilac_lnd2atm - ! the HOST ATMOSPHERE atm sends gindex_atm and atm_mesh_filename via the inputs to lilac_init - ! Global index space info for atm data integer, public, allocatable :: gindex_atm (:) ! Mesh file to be read in by lilac_atm character(len=256), public :: atm_mesh_filename + ! Mesh file to be read in by ctsm + character(len=256), public :: lnd_mesh_filename + type :: atm2lnd_type character(len=128) :: fldname real*8, pointer :: dataptr(:) @@ -33,15 +33,6 @@ module lilac_utils end type lnd2atm_type type(atm2lnd_type), pointer, public :: lnd2atm(:) - type :: this_clock - integer, pointer :: yy - integer, pointer :: mm - integer, pointer :: dd - integer, pointer :: hh - integer, pointer :: mn - integer, pointer :: ss - end type this_clock - !======================================================================== contains !======================================================================== From b876970a5a8920359349580647194612ea6e46cd Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 13:00:09 -0700 Subject: [PATCH 0440/1973] moved drv_in to lilac_in and moved it to the ctsm directory --- lilac/atm_driver/drv_in | 34 ---------------------------------- lilac/lilac/lilac_mod.F90 | 2 +- 2 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 lilac/atm_driver/drv_in diff --git a/lilac/atm_driver/drv_in b/lilac/atm_driver/drv_in deleted file mode 100644 index 0282ee8721..0000000000 --- a/lilac/atm_driver/drv_in +++ /dev/null @@ -1,34 +0,0 @@ -&papi_inparm - papi_ctr1_str = "PAPI_FP_OPS" - papi_ctr2_str = "PAPI_NO_CTR" - papi_ctr3_str = "PAPI_NO_CTR" - papi_ctr4_str = "PAPI_NO_CTR" -/ -&pio_default_inparm - pio_async_interface = .false. - pio_blocksize = -1 - pio_buffer_size_limit = -1 - pio_debug_level = 0 - pio_rearr_comm_enable_hs_comp2io = .true. - pio_rearr_comm_enable_hs_io2comp = .false. - pio_rearr_comm_enable_isend_comp2io = .false. - pio_rearr_comm_enable_isend_io2comp = .true. - pio_rearr_comm_fcd = "2denable" - pio_rearr_comm_max_pend_req_comp2io = 0 - pio_rearr_comm_max_pend_req_io2comp = 64 - pio_rearr_comm_type = "p2p" -/ -&prof_inparm - profile_add_detail = .false. - profile_barrier = .false. - profile_depth_limit = 4 - profile_detail_limit = 2 - profile_disable = .false. - profile_global_stats = .true. - profile_outpe_num = 1 - profile_outpe_stride = 0 - profile_ovhd_measurement = .false. - profile_papi_enable = .false. - profile_single_file = .false. - profile_timer = 4 -/ diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index dfd74754c1..aa129b145a 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -113,7 +113,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & call ESMF_VMGet(vm, localPet=mytask, mpiCommunicator=mpic, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call shr_pio_init1(ncomps=1, nlfilename="drv_in", Global_Comm=mpic) ! TODO: make the filename lilac_in + call shr_pio_init1(ncomps=1, nlfilename="lilac_in", Global_Comm=mpic) !------------------------------------------------------------------------- ! Initial lilac_utils module variables From 9ae025a66d2e12670e47494f4fe696765a5bef7e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 15:36:01 -0700 Subject: [PATCH 0441/1973] updated error code handling for initialization --- lilac/lilac/lilac_mod.F90 | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index aa129b145a..d8725a8dbe 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -275,9 +275,9 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_GridCompInitialize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp initialized", ESMF_LOGMSG_INFO) - + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in initializing atmcap") + end if call ESMF_LogWrite(subname//"lilac_atm gridded component initialized", ESMF_LOGMSG_INFO) ! ------------------------------------------------------------------------- @@ -292,9 +292,9 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_GridCompInitialize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp initialized", ESMF_LOGMSG_INFO) - + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in initializing ctsm") + end if call ESMF_LogWrite(subname//"CTSM gridded component initialized", ESMF_LOGMSG_INFO) ! ------------------------------------------------------------------------- @@ -302,17 +302,19 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! ------------------------------------------------------------------------- call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) - if (mytask == 0) then - print *, trim(subname) // "coupler :: cpl_atm2lnd_comp initialize finished" !, rc =", rc + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in initializing cpl_lnd2atm coupler component") end if + call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in initializing cpl_atm2lnd coupler component") + end if call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) + if (mytask == 0) then - print *, trim(subname) // "coupler :: cpl_lnd2atm_comp initialize finished" !, rc =", rc + print *, trim(subname) // "finished lilac initialization" end if end subroutine lilac_init From db7c754415f791138cd581af6099275f8f0ffff2 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 15:38:08 -0700 Subject: [PATCH 0442/1973] added land mesh info to lilac_in filename --- lilac_config/buildnml | 5 ++ src/cpl/lilac/lnd_comp_esmf.F90 | 140 ++++++++++++++++++-------------- 2 files changed, 82 insertions(+), 63 deletions(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 31a368acb8..d88ad29199 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -179,6 +179,11 @@ def buildnml(rundir, bldnmldir): # remove temporary files from rundir os.remove(os.path.join(rundir, "config_cache.xml")) os.remove(os.path.join(rundir, "env_lilac.xml")) + os.remove(os.path.join(rundir, "drv_flds_in")) + + # copy lilac_in to rundir - mesh file is defined in lilac_in + shutil.copy(os.path.join(bldnmldir,"lilac_in"), + os.path.join(rundir, "lilac_in")) ############################################################################### diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 1b88a27204..9ac64ab13e 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -4,19 +4,23 @@ module lnd_comp_esmf ! This is the ESMF cap for CTSM !---------------------------------------------------------------------------- - ! External libraries + ! external libraries use ESMF use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE + use mpi , only : MPI_BCAST, MPI_CHARACTER use mct_mod , only : mct_world_init, mct_world_clean, mct_die use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 use perf_mod , only : t_startf, t_stopf, t_barrierf - ! ctsm and share code + ! cime share code use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl use shr_sys_mod , only : shr_sys_abort use shr_file_mod , only : shr_file_setLogUnit, shr_file_getLogUnit use shr_orb_mod , only : shr_orb_decl, shr_orb_params use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date + use glc_elevclass_mod , only : glc_elevclass_init ! TODO: is this needed? + + ! ctsm code use spmdMod , only : masterproc, spmd_init, mpicom use decompMod , only : bounds_type, ldecomp, get_proc_bounds use domainMod , only : ldomain @@ -33,8 +37,6 @@ module lnd_comp_esmf use clm_driver , only : clm_drv use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_diagnose - use spmdMod , only : masterproc, spmd_init - use glc_elevclass_mod , only : glc_elevclass_init ! TODO: is this needed? implicit none private ! By default make data private except @@ -100,70 +102,75 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) integer, intent(out) :: rc ! Return code ! local variable - integer :: ierr ! error code - integer :: n,g,i,j ! indices - logical :: exists ! true if file exists - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - character(len=CL) :: caseid ! case identifier name - character(len=CL) :: ctitle ! case description title - character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) - integer :: nsrest ! clm restart type - logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type - logical :: atm_aero ! Flag if aerosol data sent from atm model - integer :: lbnum ! input to memory diagnostic - integer :: shrlogunit ! old values for log unit and log level - type(bounds_type) :: bounds ! bounds + integer :: ierr ! error code + integer :: n,g,i,j ! indices + logical :: exists ! true if file exists + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + character(len=CL) :: caseid ! case identifier name + character(len=CL) :: ctitle ! case description title + character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) + integer :: nsrest ! clm restart type + logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type + logical :: atm_aero ! Flag if aerosol data sent from atm model + integer :: lbnum ! input to memory diagnostic + integer :: shrlogunit ! old values for log unit and log level + type(bounds_type) :: bounds ! bounds ! generation of field bundles - type(ESMF_State) :: importState, exportState - type(ESMF_FieldBundle) :: c2l_fb - type(ESMF_FieldBundle) :: l2c_fb + type(ESMF_State) :: importState, exportState + type(ESMF_FieldBundle) :: c2l_fb + type(ESMF_FieldBundle) :: l2c_fb ! mesh generation - type(ESMF_Mesh) :: lnd_mesh - character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file - integer :: nlnd, nocn ! local size ofarrays - integer, pointer :: gindex(:) ! global index space for land and ocean points - integer, pointer :: gindex_lnd(:) ! global index space for just land points - integer, pointer :: gindex_ocn(:) ! global index space for just ocean points - type(ESMF_DistGrid) :: distgrid + type(ESMF_Mesh) :: lnd_mesh + character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file + integer :: nlnd, nocn ! local size ofarrays + integer, pointer :: gindex(:) ! global index space for land and ocean points + integer, pointer :: gindex_lnd(:) ! global index space for just land points + integer, pointer :: gindex_ocn(:) ! global index space for just ocean points + type(ESMF_DistGrid) :: distgrid + integer :: fileunit ! clock info - character(len=CL) :: calendar ! calendar type name - type(ESMF_CalKind_Flag) :: caltype ! calendar type from lilac clock - integer :: curr_tod, curr_ymd ! current time info - integer :: yy, mm, dd ! query output from lilac clock - integer :: dtime_lilac ! coupling time-step from the input lilac clock - integer :: ref_ymd ! reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (sec) - integer :: start_ymd ! start date (YYYYMMDD) - integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - type(ESMF_Time) :: currTime ! Current time - type(ESMF_Time) :: startTime ! Start time - type(ESMF_Time) :: stopTime ! Stop time - type(ESMF_Time) :: refTime ! Ref time - type(ESMF_TimeInterval) :: timeStep ! time step from lilac clock + character(len=CL) :: calendar ! calendar type name + type(ESMF_CalKind_Flag) :: caltype ! calendar type from lilac clock + integer :: curr_tod, curr_ymd ! current time info + integer :: yy, mm, dd ! query output from lilac clock + integer :: dtime_lilac ! coupling time-step from the input lilac clock + integer :: ref_ymd ! reference date (YYYYMMDD) + integer :: ref_tod ! reference time of day (sec) + integer :: start_ymd ! start date (YYYYMMDD) + integer :: start_tod ! start time of day (sec) + integer :: stop_ymd ! stop date (YYYYMMDD) + integer :: stop_tod ! stop time of day (sec) + type(ESMF_Time) :: currTime ! Current time + type(ESMF_Time) :: startTime ! Start time + type(ESMF_Time) :: stopTime ! Stop time + type(ESMF_Time) :: refTime ! Ref time + type(ESMF_TimeInterval) :: timeStep ! time step from lilac clock ! orbital info - integer :: orb_iyear_align ! associated with model year - integer :: orb_cyear ! orbital year for current orbital computation - integer :: orb_iyear ! orbital year for current orbital computation - integer :: orb_eccen ! orbital year for current orbital computation + integer :: orb_iyear_align ! associated with model year + integer :: orb_cyear ! orbital year for current orbital computation + integer :: orb_iyear ! orbital year for current orbital computation + integer :: orb_eccen ! orbital year for current orbital computation ! for pio_init2 and mct - type(ESMF_VM) :: vm - integer :: mpicom_vm - integer :: ncomps = 1 - integer, pointer :: mycomms(:) ! for mct - integer, pointer :: myids(:) ! for mct - integer :: compids(1) = (/1/) ! for both mct and pio_init2 - array with component ids - integer :: comms(1) ! for both mct and pio_init2 - array with mpicoms - character(len=32) :: compLabels(1) = (/'LND'/) ! for pio_init2 - character(len=64) :: comp_name(1) = (/'LND'/) ! for pio_init2 - logical :: comp_iamin(1) = (/.true./) ! for pio init2 - integer :: iam(1) ! for pio_init2 + type(ESMF_VM) :: vm + integer :: mpicom_vm + integer :: ncomps = 1 + integer, pointer :: mycomms(:) ! for mct + integer, pointer :: myids(:) ! for mct + integer :: compids(1) = (/1/) ! for both mct and pio_init2 - array with component ids + integer :: comms(1) ! for both mct and pio_init2 - array with mpicoms + character(len=32) :: compLabels(1) = (/'LND'/) ! for pio_init2 + character(len=64) :: comp_name(1) = (/'LND'/) ! for pio_init2 + logical :: comp_iamin(1) = (/.true./) ! for pio init2 + integer :: iam(1) ! for pio_init2 + + ! input namelist read for ctsm mesh + namelist /lnd_mesh_inparm/ lnd_mesh_filename + character(len=*), parameter :: subname=trim(modName)//': (lnd_init) ' !------------------------------------------------------------------------ @@ -354,11 +361,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! generate the land mesh on ctsm distribution !-------------------------------- - ! TODO: mesh file should come into clm as a namelist for lilac only - ! for now need to hardwire this in lnd_mesh_filename here - - lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - ! obtain global index array for just land points which includes mask=0 or ocean points call get_proc_bounds( bounds ) @@ -388,6 +390,18 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) deallocate(gindex) call ESMF_LogWrite(subname//"DistGrid created......", ESMF_LOGMSG_INFO) + ! obtain the mesh filename from the namelist + if (masterproc) then + open(newunit=fileunit, status="old", file="lilac_in") + read(fileunit, lnd_mesh_inparm, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort( 'problem on read of lilac_in') + end if + close(fileunit) + end if + call MPI_BCAST(lnd_mesh_filename, len(lnd_mesh_filename), MPI_CHARACTER, 0, mpicom, ierr) + + ! create esmf mesh using distgrid and lnd_mesh_filename lnd_mesh = ESMF_MeshCreate(filename=trim(lnd_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, elementDistgrid=Distgrid, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return if (masterproc) then From 8189b9bead630a8f6858822288835f594652d67a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 15:52:49 -0700 Subject: [PATCH 0443/1973] added hard-wired lilac_in namelist for now --- lilac_config/lilac_in | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lilac_config/lilac_in diff --git a/lilac_config/lilac_in b/lilac_config/lilac_in new file mode 100644 index 0000000000..6b217cc324 --- /dev/null +++ b/lilac_config/lilac_in @@ -0,0 +1,37 @@ +&lnd_mesh_inparm + lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' +/ +&papi_inparm + papi_ctr1_str = "PAPI_FP_OPS" + papi_ctr2_str = "PAPI_NO_CTR" + papi_ctr3_str = "PAPI_NO_CTR" + papi_ctr4_str = "PAPI_NO_CTR" +/ +&pio_default_inparm + pio_async_interface = .false. + pio_blocksize = -1 + pio_buffer_size_limit = -1 + pio_debug_level = 0 + pio_rearr_comm_enable_hs_comp2io = .true. + pio_rearr_comm_enable_hs_io2comp = .false. + pio_rearr_comm_enable_isend_comp2io = .false. + pio_rearr_comm_enable_isend_io2comp = .true. + pio_rearr_comm_fcd = "2denable" + pio_rearr_comm_max_pend_req_comp2io = 0 + pio_rearr_comm_max_pend_req_io2comp = 64 + pio_rearr_comm_type = "p2p" +/ +&prof_inparm + profile_add_detail = .false. + profile_barrier = .false. + profile_depth_limit = 4 + profile_detail_limit = 2 + profile_disable = .false. + profile_global_stats = .true. + profile_outpe_num = 1 + profile_outpe_stride = 0 + profile_ovhd_measurement = .false. + profile_papi_enable = .false. + profile_single_file = .false. + profile_timer = 4 +/ From d3837caa08ff58be7e7cd130748c50ed40152adf Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 29 Nov 2019 22:34:54 -0700 Subject: [PATCH 0444/1973] added files for lilac history output - but have not turned on implementation --- lilac/atm_driver/Makefile | 44 +- lilac/lilac/lilac_constants.F90 | 16 + lilac/lilac/lilac_history.F90 | 284 +++++ lilac/lilac/lilac_io.F90 | 1832 +++++++++++++++++++++++++++++++ lilac/lilac/lilac_methods.F90 | 1709 ++++++++++++++++++++++++++++ lilac/lilac/lilac_mod.F90 | 23 +- lilac/lilac/lilac_time.F90 | 541 +++++++++ lilac/lilac/lilac_utils.F90 | 2 + 8 files changed, 4437 insertions(+), 14 deletions(-) create mode 100644 lilac/lilac/lilac_constants.F90 create mode 100644 lilac/lilac/lilac_history.F90 create mode 100644 lilac/lilac/lilac_io.F90 create mode 100644 lilac/lilac/lilac_methods.F90 create mode 100644 lilac/lilac/lilac_time.F90 diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index a2521fca0a..96846db837 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -15,12 +15,15 @@ include $(ESMFMKFILE) ### Define directory paths #================================================================================ CASE_NAME = why01-g -CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf +PIO_INC = -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/include +CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf CTSM_INC = -I$(CTSM_BLD_DIR)/include CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm + #TRACEBACK_FLAGS = -g -traceback -debug all -check all -O2 -r8 TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free + # ----------------------------------------------------------------------------- EXTRA_LIBS = -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib MORE_LIBS = -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ @@ -69,6 +72,36 @@ lilac_mod.o : $(LILAC_DIR)/lilac_mod.F90 $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< +lilac_constants.o : $(LILAC_DIR)/lilac_constants.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + +lilac_methods.o : $(LILAC_DIR)/lilac_methods.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + +lilac_time.o : $(LILAC_DIR)/lilac_time.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + +lilac_io.o : $(LILAC_DIR)/lilac_io.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) $(PIO_INC) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + +lilac_history.o : $(LILAC_DIR)/lilac_history.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ + $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(EXTRA_LIBS) $(MORE_LIBS) $< + atm_driver.o : $(DRIVER_DIR)/atm_driver.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ @@ -81,11 +114,14 @@ atm_driver: atm_driver.o lilac_atmcap.o lilac_mod.o lilac_utils.o lilac_cpl.o rm *.o *.mod # module dependencies: -#atm_driver.o: lilac_mod.o lilac_atmcap.o lilac_utils.o lilac_cpl.o shr_string_mod.o shr_kind_mod.o shr_sys_mod.o shr_log_mod.o shr_timer_mod.o atm_driver.o: lilac_mod.o lilac_atmcap.o lilac_utils.o lilac_cpl.o -lilac_mod.o: lilac_atmcap.o lilac_utils.o lilac_cpl.o #shr_pio_mod.o +lilac_mod.o: lilac_atmcap.o lilac_utils.o lilac_cpl.o lilac_history.o lilac_atmcap.o: lilac_utils.o - +lilac_constants.o : +lilac_methods.o: lilac_constants.o +lilac_time.o: lilac_constants.o lilac_methods.o +lilac_io.o: lilac_constants.o lilac_methods.o +lilac_history.o: lilac_constants.o lilac_methods.o lilac_io.o lilac_time.o # ----------------------------------------------------------------------------- .PHONY: clean berzerk remake diff --git a/lilac/lilac/lilac_constants.F90 b/lilac/lilac/lilac_constants.F90 new file mode 100644 index 0000000000..d564e14420 --- /dev/null +++ b/lilac/lilac/lilac_constants.F90 @@ -0,0 +1,16 @@ +module lilac_constants + + use shr_kind_mod, only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8 + + implicit none + public + + logical, parameter :: lilac_constants_statewrite_flag = .false. + real(R8), parameter :: lilac_constants_spval_init = 0.0_R8 ! spval for initialization + real(R8), parameter :: lilac_constants_spval = 0.0_R8 ! spval + real(R8), parameter :: lilac_constants_czero = 0.0_R8 ! spval + integer, parameter :: lilac_constants_ispval_mask = -987987 ! spval for RH mask values + integer, parameter :: lilac_constants_SecPerDay = 86400 ! Seconds per day + integer :: lilac_constants_dbug_flag = 0 + +end module lilac_constants diff --git a/lilac/lilac/lilac_history.F90 b/lilac/lilac/lilac_history.F90 new file mode 100644 index 0000000000..e72099985a --- /dev/null +++ b/lilac/lilac/lilac_history.F90 @@ -0,0 +1,284 @@ +module lilac_history + + !----------------------------------------------------------------------------- + ! Mediator Phases + !----------------------------------------------------------------------------- + + use ESMF + use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl, r8=>shr_kind_r8 + use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag + use lilac_constants , only : SecPerDay => lilac_constants_SecPerDay + use lilac_methods , only : FB_reset => lilac_methods_FB_reset + use lilac_methods , only : FB_diagnose => lilac_methods_FB_diagnose + use lilac_methods , only : FB_GetFldPtr => lilac_methods_FB_GetFldPtr + use lilac_methods , only : FB_accum => lilac_methods_FB_accum + use lilac_methods , only : chkerr + use lilac_time , only : alarmInit => lilac_time_alarmInit + use lilac_io , only : lilac_io_write, lilac_io_wopen, lilac_io_enddef + use lilac_io , only : lilac_io_close, lilac_io_date2yyyymmdd, lilac_io_sec2hms + use lilac_io , only : lilac_io_ymd2date + + implicit none + private + + public :: lilac_history_alarm_init + public :: lilac_history_write + + type(ESMF_Alarm) :: AlarmHist + type(ESMF_Alarm) :: AlarmHistAvg + character(*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine lilac_history_alarm_init(clock, hist_freq_n, hist_freq_option, rc) + + ! Initialize lilac history file alarm + + ! input/output variables + type(ESMF_Clock) :: clock ! lilac clock + integer , intent(in) :: hist_freq_n + character(len=*) , intent(in) :: hist_freq_option + integer , intent(out) :: rc + + ! local variables + type(ESMF_Time) :: currtime + type(ESMF_Time) :: reftime + type(ESMF_Time) :: starttime + type(ESMF_Time) :: nexttime + type(ESMF_Calendar) :: calendar ! calendar type + character(len=64) :: currtimestr + character(CS) :: histavg_option ! Histavg option units + integer :: yr,mon,day,sec ! time units + character(CL) :: freq_option ! freq_option setting (ndays, nsteps, etc) + integer :: freq_n ! freq_n setting relative to freq_option + integer :: iam + character(len=*), parameter :: subname='(lilac_history_alarm_init)' + !--------------------------------------- + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO, rc=rc) + endif + rc = ESMF_SUCCESS + + !--------------------------------------- + ! Get the clock info + !--------------------------------------- + + call ESMF_ClockGet(clock, currtime=currtime, reftime=reftime, starttime=starttime, calendar=calendar, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeGet(currtime,yy=yr, mm=mon, dd=day, s=sec, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(currtimestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',sec + if (dbug_flag > 1) then + call ESMF_LogWrite(trim(subname)//": currtime = "//trim(currtimestr), ESMF_LOGMSG_INFO, rc=rc) + endif + + !--------------------------------------- + ! Initialize thie history alarm + !--------------------------------------- + + call alarmInit(clock, AlarmHist, option=freq_option, opt_n=freq_n, RefTime=RefTime, alarmname='history', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine lilac_history_alarm_init + + !=============================================================================== + + subroutine lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state, lnd2atm_a_state, clock, rc) + + ! Write lilac history file + + ! input/output variables + type(ESMF_State) :: atm2lnd_a_state + type(ESMF_State) :: atm2lnd_l_state + type(ESMF_State) :: lnd2atm_l_state + type(ESMF_State) :: lnd2atm_a_state + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + type(ESMF_FieldBundle) :: c2a_fb , a2c_fb, c2l_fb, l2c_fb + type(ESMF_VM) :: vm + type(ESMF_Time) :: currtime + type(ESMF_Time) :: reftime + type(ESMF_Time) :: starttime + type(ESMF_Time) :: nexttime + type(ESMF_TimeInterval) :: timediff ! Used to calculate curr_time + type(ESMF_Calendar) :: calendar ! calendar type + character(len=64) :: currtimestr + character(len=64) :: nexttimestr + character(CS) :: histavg_option ! Histavg option units + integer :: i,j,m,n,n1,ncnt + integer :: start_ymd ! Starting date YYYYMMDD + integer :: start_tod ! Starting time-of-day (s) + integer :: nx,ny ! global grid size + integer :: yr,mon,day,sec ! time units + real(r8) :: rval ! real tmp value + real(r8) :: dayssince ! Time interval since reference time + integer :: fk ! index + character(CL) :: time_units ! units of time variable + character(CL) :: case_name ! case name + character(CL) :: hist_file ! Local path to history filename + character(CS) :: cpl_inst_tag ! instance tag + character(CL) :: freq_option ! freq_option setting (ndays, nsteps, etc) + integer :: freq_n ! freq_n setting relative to freq_option + logical :: alarmIsOn ! generic alarm flag + real(r8) :: tbnds(2) ! CF1.0 time bounds + logical :: whead,wdata ! for writing restart/history cdf files + integer :: dbrc + integer :: iam + logical,save :: first_call = .true. + character(len=*), parameter :: subname='(lilac_history_write)' + !--------------------------------------- + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO, rc=rc) + endif + rc = ESMF_SUCCESS + + !--------------------------------------- + ! --- Get the communicator and localpet + !--------------------------------------- + + call ESMF_VMGetGlobal(vm=vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + call ESMF_VMGet(vm, localPet=iam, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + !--------------------------------------- + ! --- Get the clock info + !--------------------------------------- + + call ESMF_ClockGet(clock, currtime=currtime, reftime=reftime, starttime=starttime, calendar=calendar, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_ClockGetNextTime(clock, nextTime=nexttime, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeGet(currtime,yy=yr, mm=mon, dd=day, s=sec, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(currtimestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',sec + if (dbug_flag > 1) then + call ESMF_LogWrite(trim(subname)//": currtime = "//trim(currtimestr), ESMF_LOGMSG_INFO, rc=rc) + endif + + call ESMF_TimeGet(nexttime,yy=yr, mm=mon, dd=day, s=sec, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(nexttimestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',sec + if (dbug_flag > 1) then + call ESMF_LogWrite(trim(subname)//": nexttime = "//trim(nexttimestr), ESMF_LOGMSG_INFO, rc=rc) + endif + timediff = nexttime - reftime + call ESMF_TimeIntervalGet(timediff, d=day, s=sec, rc=rc) + dayssince = day + sec/real(SecPerDay,R8) + + call ESMF_TimeGet(reftime, yy=yr, mm=mon, dd=day, s=sec, rc=rc) + call lilac_io_ymd2date(yr,mon,day,start_ymd) + start_tod = sec + time_units = 'days since ' // trim(lilac_io_date2yyyymmdd(start_ymd)) // ' ' // lilac_io_sec2hms(start_tod, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + !--------------------------------------- + ! --- History Alarms + !--------------------------------------- + + if (ESMF_AlarmIsRinging(AlarmHist, rc=rc)) then + if (ChkErr(rc,__LINE__,u_FILE_u)) return + alarmIsOn = .true. + call ESMF_AlarmRingerOff( AlarmHist, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + alarmisOn = .false. + endif + + !--------------------------------------- + ! --- History File + ! Use nexttimestr rather than currtimestr here since that is the time at the end of + ! the timestep and is preferred for history file names + !--------------------------------------- + + if (alarmIsOn) then + write(hist_file,"(6a)") & + trim(case_name), '.cpl',trim(cpl_inst_tag),'.hi.', trim(nexttimestr),'.nc' + call ESMF_LogWrite(trim(subname)//": write "//trim(hist_file), ESMF_LOGMSG_INFO, rc=rc) + call lilac_io_wopen(hist_file, vm, iam, clobber=.true.) + + do m = 1,2 + whead=.false. + wdata=.false. + if (m == 1) then + whead=.true. + elseif (m == 2) then + wdata=.true. + call lilac_io_enddef(hist_file) + endif + + tbnds = dayssince + + call ESMF_LogWrite(trim(subname)//": time "//trim(time_units), ESMF_LOGMSG_INFO, rc=rc) + if (tbnds(1) >= tbnds(2)) then + call lilac_io_write(hist_file, iam, & + time_units=time_units, calendar=calendar, time_val=dayssince, & + whead=whead, wdata=wdata, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call lilac_io_write(hist_file, iam, & + time_units=time_units, calendar=calendar, time_val=dayssince, & + whead=whead, wdata=wdata, tbnds=tbnds, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif + + nx = 72 ! hard-wire for now + ny = 46 ! hard-wire for now + + call ESMF_StateGet(atm2lnd_a_state, 'a2c_fb', a2c_fb) ! from atm + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, a2c_fb, & + nx=nx, ny=ny, nt=1, whead=whead, wdata=wdata, pre='a2c_from_atm', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(atm2lnd_l_state, 'c2l_fb', c2l_fb) ! to land + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, c2l_fb, & + nx=nx, ny=ny, nt=1, whead=whead, wdata=wdata, pre='c2l_to_land', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(lnd2atm_l_state, 'l2c_fb', l2c_fb) ! from land + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, c2l_fb, & + nx=nx, ny=ny, nt=1, whead=whead, wdata=wdata, pre='l2c_from_land', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(lnd2atm_a_state, 'c2a_fb', c2a_fb) ! to atm + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, c2l_fb, & + nx=nx, ny=ny, nt=1, whead=whead, wdata=wdata, pre='c2a_to_atm', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + enddo + + call lilac_io_close(hist_file, iam, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + endif + + !--------------------------------------- + !--- clean up + !--------------------------------------- + + first_call = .false. + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO, rc=rc) + endif + + end subroutine lilac_history_write + + !=============================================================================== + +end module lilac_history diff --git a/lilac/lilac/lilac_io.F90 b/lilac/lilac/lilac_io.F90 new file mode 100644 index 0000000000..d5aeabf48f --- /dev/null +++ b/lilac/lilac/lilac_io.F90 @@ -0,0 +1,1832 @@ +module lilac_io + + !------------------------------------------ + ! Create mediator history files + !------------------------------------------ + + use ESMF + use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl + use shr_kind_mod , only : r4=>shr_kind_r4, i8=>shr_kind_i8, r8=>shr_kind_r8 + use shr_const_mod , only : fillvalue => SHR_CONST_SPVAL + use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat + use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag + use lilac_methods , only : FB_getFieldN => lilac_methods_FB_getFieldN + use lilac_methods , only : FB_getFldPtr => lilac_methods_FB_getFldPtr + use lilac_methods , only : FB_getNameN => lilac_methods_FB_getNameN + use lilac_methods , only : chkerr + use pio , only : file_desc_t, iosystem_desc_t + use pio , only : var_desc_t, io_desc_t, PIO_UNLIMITED + use pio , only : pio_def_dim, pio_inq_dimid, pio_real, pio_put_att, pio_double + use pio , only : pio_inq_varid, pio_setframe, pio_write_darray, pio_initdecomp, pio_freedecomp + use pio , only : pio_syncfile, pio_offset_kind, pio_int + use pio , only : pio_double, pio_def_dim, pio_def_var, pio_put_att, pio_put_var + use pio , only : PIO_IOTYPE_PNETCDF, PIO_IOTYPE_NETCDF, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR + use pio , only : pio_openfile, pio_createfile, PIO_GLOBAL, pio_enddef + use pio , only : pio_put_att, pio_redef, pio_get_att + use pio , only : pio_seterrorhandling, pio_file_is_open, pio_clobber, pio_write, pio_noclobber + use pio , only : pio_file_is_open, pio_closefile + use pio , only : pio_redef, pio_enddef + use pio , only : var_desc_t, pio_def_dim + use pio , only : pio_put_att, pio_put_var + use pio , only : pio_int, pio_char + use pio , only : var_desc_t, pio_def_var, pio_put_att + use pio , only : pio_double, pio_noerr, pio_put_var + use pio , only : file_desc_T, var_desc_t, io_desc_t, pio_nowrite, pio_openfile + use pio , only : pio_noerr, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR + use pio , only : pio_double, pio_get_att, pio_seterrorhandling, pio_freedecomp, pio_closefile + use pio , only : pio_read_darray, pio_offset_kind, pio_setframe + use pio , only : file_desc_T, var_desc_t, io_desc_t, pio_nowrite, pio_openfile + use pio , only : pio_noerr, pio_inq_varndims + use pio , only : pio_inq_dimid, pio_inq_dimlen, pio_inq_vardimid + use pio , only : pio_double, pio_seterrorhandling, pio_initdecomp + use pio , only : var_desc_t, file_desc_t, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR, pio_seterrorhandling + use pio , only : pio_get_var, pio_get_att, pio_openfile + use pio , only : pio_nowrite, pio_openfile, pio_global + use pio , only : pio_closefile + use pio , only : file_desc_t, var_desc_t, pio_openfile, pio_closefile, pio_seterrorhandling + use pio , only : PIO_BCAST_ERROR, PIO_INTERNAL_ERROR, pio_get_var + use pio , only : pio_nowrite, pio_openfile, pio_global, pio_get_att + use pio , only : file_desc_t, var_desc_t, pio_seterrorhandling, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR + use pio , only : pio_closefile, pio_get_var + use pio , only : pio_openfile, pio_global, pio_get_att, pio_nowrite + use pio , only : var_desc_t, pio_def_dim, pio_put_att + use pio , only : pio_put_var + use pio , only : var_desc_t, pio_def_dim + use pio , only : pio_put_var, pio_double, pio_put_att + + implicit none + private + + integer :: logunit = 6 ! TODO: fix this + integer :: lilac_id + + ! public member functions: + public :: lilac_io_wopen + public :: lilac_io_close + public :: lilac_io_redef + public :: lilac_io_enddef + public :: lilac_io_sec2hms + public :: lilac_io_read + public :: lilac_io_write + public :: lilac_io_init + public :: lilac_io_date2yyyymmdd + public :: lilac_io_datetod2string + public :: lilac_io_ymd2date + + ! private member functions + private :: lilac_io_file_exists + + ! public data members: + interface lilac_io_read + module procedure lilac_io_read_FB + module procedure lilac_io_read_int + module procedure lilac_io_read_int1d + module procedure lilac_io_read_r8 + module procedure lilac_io_read_r81d + module procedure lilac_io_read_char + end interface lilac_io_read + interface lilac_io_write + module procedure lilac_io_write_FB + module procedure lilac_io_write_int + module procedure lilac_io_write_int1d + module procedure lilac_io_write_r8 + module procedure lilac_io_write_r81d + module procedure lilac_io_write_char + module procedure lilac_io_write_time + end interface lilac_io_write + interface lilac_io_date2ymd + module procedure lilac_io_date2ymd_int + module procedure lilac_io_date2ymd_long + end interface lilac_io_date2ymd + interface lilac_io_datetod2string + module procedure lilac_io_datetod2string_int + module procedure lilac_io_datetod2string_long + end interface lilac_io_datetod2string + interface lilac_io_ymd2date + module procedure lilac_io_ymd2date_int + module procedure lilac_io_ymd2date_long + end interface lilac_io_ymd2date + + !------------------------------------------------------------------------------- + ! module data + !------------------------------------------------------------------------------- + + character(*),parameter :: prefix = "lilac_io_" + character(*),parameter :: modName = "(lilac_io_mod) " + character(*),parameter :: version = "lilac0" + integer , parameter :: file_desc_t_cnt = 20 ! Note - this is hard-wired for now + integer , parameter :: number_strlen = 2 + character(CL) :: wfilename = '' + type(file_desc_t) :: io_file(0:file_desc_t_cnt) + integer :: pio_iotype + integer :: pio_ioformat + type(iosystem_desc_t), pointer :: io_subsystem + character(*),parameter :: u_file_u = & + __FILE__ + +!================================================================================= +contains +!================================================================================= + + logical function lilac_io_file_exists(vm, iam, filename) + + !--------------- + ! inquire if i/o file exists + !--------------- + + ! input/output variables + type(ESMF_VM) :: vm + integer, intent(in) :: iam + character(len=*), intent(in) :: filename + + ! local variables + integer :: tmp(1) + integer :: rc + !------------------------------------------------------------------------------- + + lilac_io_file_exists = .false. + if (iam==0) inquire(file=trim(filename),exist=lilac_io_file_exists) + if (lilac_io_file_exists) tmp(1) = 1 + + call ESMF_VMBroadCast(vm, tmp, 1, 0, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if(tmp(1) == 1) lilac_io_file_exists = .true. + + end function lilac_io_file_exists + + !=============================================================================== + subroutine lilac_io_init() + + !--------------- + ! initialize pio + !--------------- + +#ifdef INTERNAL_PIO_INIT + ! if CMEPS is the only component using PIO, then it needs to initialize PIO + use shr_pio_mod , only : shr_pio_init2 + + type(ESMF_VM) :: vm + integer :: comms(1), comps(1) + logical :: comp_iamin(1) + integer :: comp_comm_iam(1) + character(len=32) :: compLabels(1) + integer :: rc + + call ESMF_VMGetCurrent(vm=vm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_VMGet(vm, mpiCommunicator=comms(1), localPet=comp_comm_iam(1), rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + comps(1) = lilac_id + compLabels(1) = "MED" + comp_iamin(1) = .true. + + call shr_pio_init2(comps, compLabels, comp_iamin, comms, comp_comm_iam) +#endif + + io_subsystem => shr_pio_getiosys(lilac_id) + pio_iotype = shr_pio_getiotype(lilac_id) + pio_ioformat = shr_pio_getioformat(lilac_id) + + end subroutine lilac_io_init + + !=============================================================================== + subroutine lilac_io_wopen(filename, vm, iam, clobber, file_ind, model_doi_url) + + !--------------- + ! open netcdf file + !--------------- + + ! input/output arguments + character(*), intent(in) :: filename + type(ESMF_VM) :: vm + integer, intent(in) :: iam + logical, optional, intent(in) :: clobber + integer, optional, intent(in) :: file_ind + character(CL), optional, intent(in) :: model_doi_url + + ! local variables + logical :: lclobber + integer :: rcode + integer :: nmode + integer :: lfile_ind + integer :: rc + character(CL) :: lversion + character(CL) :: lmodel_doi_url + character(*),parameter :: subName = '(lilac_io_wopen) ' + !------------------------------------------------------------------------------- + + lversion=trim(version) + + lclobber = .false. + if (present(clobber)) lclobber=clobber + + lmodel_doi_url = 'unset' + if (present(model_doi_url)) lmodel_doi_url = model_doi_url + + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + + if (.not. pio_file_is_open(io_file(lfile_ind))) then + + ! filename not open + wfilename = filename + + if (lilac_io_file_exists(vm, iam, filename)) then + if (lclobber) then + nmode = pio_clobber + ! only applies to classic NETCDF files. + if(pio_iotype == PIO_IOTYPE_NETCDF .or. pio_iotype == PIO_IOTYPE_PNETCDF) then + nmode = ior(nmode,pio_ioformat) + endif + rcode = pio_createfile(io_subsystem, io_file(lfile_ind), pio_iotype, trim(filename), nmode) + if(iam==0) write(logunit,*) subname,' create file ',trim(filename) + else + rcode = pio_openfile(io_subsystem, io_file(lfile_ind), pio_iotype, trim(filename), pio_write) + if (iam==0) then + write(logunit,*) subname,' open file ',trim(filename) + end if + call pio_seterrorhandling(io_file(lfile_ind),PIO_BCAST_ERROR) + rcode = pio_get_att(io_file(lfile_ind),pio_global,"file_version",lversion) + call pio_seterrorhandling(io_file(lfile_ind),PIO_INTERNAL_ERROR) + if (trim(lversion) /= trim(version)) then + rcode = pio_redef(io_file(lfile_ind)) + rcode = pio_put_att(io_file(lfile_ind),pio_global,"file_version",version) + rcode = pio_enddef(io_file(lfile_ind)) + endif + endif + else + nmode = pio_noclobber + ! only applies to classic NETCDF files. + if(pio_iotype == PIO_IOTYPE_NETCDF .or. pio_iotype == PIO_IOTYPE_PNETCDF) then + nmode = ior(nmode,pio_ioformat) + endif + rcode = pio_createfile(io_subsystem, io_file(lfile_ind), pio_iotype, trim(filename), nmode) + if (iam==0) then + write(logunit,*) subname,' create file ',trim(filename) + end if + rcode = pio_put_att(io_file(lfile_ind),pio_global,"file_version",version) + rcode = pio_put_att(io_file(lfile_ind),pio_global,"model_doi_url",lmodel_doi_url) + endif + elseif (trim(wfilename) /= trim(filename)) then + ! filename is open, better match open filename + if(iam==0) write(logunit,*) subname,' different filename currently open ',trim(filename) + if(iam==0) write(logunit,*) subname,' different wfilename currently open ',trim(wfilename) + call ESMF_LogWrite(subname//'different file currently open '//trim(filename), ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + else + ! filename is already open, just return + endif + + end subroutine lilac_io_wopen + + !=============================================================================== + subroutine lilac_io_close(filename, iam, file_ind, rc) + + !--------------- + ! close netcdf file + !--------------- + + ! input/output variables + character(*), intent(in) :: filename + integer, intent(in) :: iam + integer,optional, intent(in) :: file_ind + integer , intent(out) :: rc + + ! local variables + integer :: lfile_ind + character(*),parameter :: subName = '(lilac_io_close) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + + if (.not. pio_file_is_open(io_file(lfile_ind))) then + ! filename not open, just return + elseif (trim(wfilename) == trim(filename)) then + ! filename matches, close it + call pio_closefile(io_file(lfile_ind)) + else + ! different filename is open, abort + if (iam==0) write(logunit,*) subname,' different filename currently open, aborting ',trim(filename) + if (iam==0) write(logunit,*) subname,' different wfilename currently open, aborting ',trim(wfilename) + call ESMF_LogWrite(subname//'different file currently open, aborting '//trim(filename), ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + endif + wfilename = '' + end subroutine lilac_io_close + + !=============================================================================== + subroutine lilac_io_redef(filename,file_ind) + + ! input/output variables + character(len=*), intent(in) :: filename + integer,optional,intent(in):: file_ind + + ! local variables + integer :: lfile_ind + integer :: rcode + !------------------------------------------------------------------------------- + + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + rcode = pio_redef(io_file(lfile_ind)) + + end subroutine lilac_io_redef + + !=============================================================================== + subroutine lilac_io_enddef(filename,file_ind) + + ! input/output variables + character(len=*) , intent(in) :: filename + integer,optional , intent(in) :: file_ind + + ! local variables + integer :: lfile_ind + integer :: rcode + !------------------------------------------------------------------------------- + + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + + rcode = pio_enddef(io_file(lfile_ind)) + end subroutine lilac_io_enddef + + !=============================================================================== + character(len=24) function lilac_io_date2yyyymmdd (date) + + integer, intent(in) :: date ! date expressed as an integer: yyyymmdd + + call lilac_io_datetod2string(date_str = lilac_io_date2yyyymmdd, ymd = date) + + end function lilac_io_date2yyyymmdd + + !=============================================================================== + character(len=8) function lilac_io_sec2hms (seconds, rc) + + ! input arguments + integer, intent(in) :: seconds + integer, intent(out) :: rc + + ! local variables + integer :: hours ! hours of hh:mm:ss + integer :: minutes ! minutes of hh:mm:ss + integer :: secs ! seconds of hh:mm:ss + !---------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + if (seconds < 0 .or. seconds > 86400) then + write(logunit,*)'lilac_io_sec2hms: bad input seconds:', seconds + call ESMF_LogWrite('lilac_io_sec2hms: bad input seconds', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + + hours = seconds / 3600 + minutes = (seconds - hours*3600) / 60 + secs = (seconds - hours*3600 - minutes*60) + + if (minutes < 0 .or. minutes > 60) then + write(logunit,*)'lilac_io_sec2hms: bad minutes = ',minutes + call ESMF_LogWrite('lilac_io_sec2hms: bad minutes', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + + if (secs < 0 .or. secs > 60) then + write(logunit,*)'lilac_io_sec2hms: bad secs = ',secs + call ESMF_LogWrite('lilac_io_sec2hms: bad secs', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + + write(lilac_io_sec2hms,80) hours, minutes, secs +80 format(i2.2,':',i2.2,':',i2.2) + + end function lilac_io_sec2hms + + !=============================================================================== + subroutine lilac_io_write_FB(filename, iam, FB, whead, wdata, nx, ny, nt, & + fillval, pre, tavg, use_float, file_ind, rc) + + !--------------- + ! Write FB to netcdf file + !--------------- + + ! input/output variables + character(len=*), intent(in) :: filename ! file + integer, intent(in) :: iam ! local pet + type(ESMF_FieldBundle), intent(in) :: FB ! data to be written + logical, optional, intent(in) :: whead ! write header + logical, optional, intent(in) :: wdata ! write data + integer , optional, intent(in) :: nx ! 2d grid size if available + integer , optional, intent(in) :: ny ! 2d grid size if available + integer , optional, intent(in) :: nt ! time sample + real(r8), optional, intent(in) :: fillval ! fill value + character(len=*), optional, intent(in) :: pre ! prefix to variable name + logical, optional, intent(in) :: tavg ! is this a tavg + logical, optional, intent(in) :: use_float ! write output as float rather than double + integer, optional, intent(in) :: file_ind + integer, intent(out):: rc + + ! local variables + type(ESMF_Field) :: field + type(ESMF_Mesh) :: mesh + type(ESMF_Distgrid) :: distgrid + type(ESMF_VM) :: VM + integer :: mpicom + integer :: rcode + integer :: nf,ns,ng + integer :: k,n + integer :: ndims, nelements + integer ,target :: dimid2(2) + integer ,target :: dimid3(3) + integer ,pointer :: dimid(:) + type(var_desc_t) :: varid + type(io_desc_t) :: iodesc + integer(kind=Pio_Offset_Kind) :: frame + character(CL) :: itemc ! string converted to char + character(CL) :: name1 ! var name + character(CL) :: cunit ! var units + character(CL) :: lname ! long name + character(CL) :: sname ! standard name + character(CL) :: lpre ! local prefix + logical :: lwhead, lwdata + logical :: luse_float + integer :: lnx,lny + real(r8) :: lfillvalue + integer, pointer :: minIndexPTile(:,:) + integer, pointer :: maxIndexPTile(:,:) + integer :: dimCount, tileCount + integer, pointer :: Dof(:) + integer :: lfile_ind + real(r8), pointer :: fldptr1(:) + real(r8), pointer :: fldptr2(:,:) + real(r8), allocatable :: ownedElemCoords(:), ownedElemCoords_x(:), ownedElemCoords_y(:) + character(len=number_strlen) :: cnumber + character(CL) :: tmpstr + type(ESMF_Field) :: lfield + integer :: rank + integer :: ungriddedUBound(1) ! currently the size must equal 1 for rank 2 fields + integer :: gridToFieldMap(1) ! currently the size must equal 1 for rank 2 fields + logical :: isPresent + character(*),parameter :: subName = '(lilac_io_write_FB) ' + !------------------------------------------------------------------------------- + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_Success + + lfillvalue = fillvalue + if (present(fillval)) then + lfillvalue = fillval + endif + + lpre = ' ' + if (present(pre)) then + lpre = trim(pre) + endif + + if (.not. ESMF_FieldBundleIsCreated(FB, rc=rc)) then + call ESMF_LogWrite(trim(subname)//" FB "//trim(lpre)//" not created", ESMF_LOGMSG_INFO) + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + rc = ESMF_Success + return + endif + + lwhead = .true. + lwdata = .true. + if (present(whead)) lwhead = whead + if (present(wdata)) lwdata = wdata + + if (.not.lwhead .and. .not.lwdata) then + ! should we write a warning? + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + return + endif + + luse_float = .false. + if (present(use_float)) luse_float = use_float + + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + + call ESMF_FieldBundleGet(FB, fieldCount=nf, rc=rc) + write(tmpstr,*) subname//' field count = '//trim(lpre),nf + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + if (nf < 1) then + call ESMF_LogWrite(trim(subname)//" FB "//trim(lpre)//" empty", ESMF_LOGMSG_INFO) + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + rc = ESMF_Success + return + endif + + call FB_getFieldN(FB, 1, field, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldGet(field, mesh=mesh, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(mesh, elementDistgrid=distgrid, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(mesh, spatialDim=ndims, numOwnedElements=nelements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write(tmpstr,*) subname, 'ndims, nelements = ', ndims, nelements + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + if (.not. allocated(ownedElemCoords) .and. ndims > 0 .and. nelements > 0) then + allocate(ownedElemCoords(ndims*nelements)) + allocate(ownedElemCoords_x(ndims*nelements/2)) + allocate(ownedElemCoords_y(ndims*nelements/2)) + + call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ownedElemCoords_x = ownedElemCoords(1::2) + ownedElemCoords_y = ownedElemCoords(2::2) + end if + + call ESMF_DistGridGet(distgrid, dimCount=dimCount, tileCount=tileCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + allocate(minIndexPTile(dimCount, tileCount), maxIndexPTile(dimCount, tileCount)) + call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, maxIndexPTile=maxIndexPTile, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! write(tmpstr,*) subname,' counts = ',dimcount,tilecount,minindexptile,maxindexptile + ! call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + ! TODO: this is not getting the global size correct for a FB coming in that does not have + ! all the global grid values in the distgrid - e.g. CTSM + + ng = maxval(maxIndexPTile) + lnx = ng + lny = 1 + deallocate(minIndexPTile, maxIndexPTile) + + frame = -1 + if (present(nt)) then + frame = nt + endif + if (present(nx)) then + if (nx > 0) lnx = nx + endif + if (present(ny)) then + if (ny > 0) lny = ny + endif + if (lnx*lny /= ng) then + write(tmpstr,*) subname,' ERROR: grid2d size not consistent ',ng,lnx,lny + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + !TODO: this should not be an error for say CTSM which does not send a global grid + !rc = ESMF_FAILURE + !return + endif + + if (lwhead) then + rcode = pio_def_dim(io_file(lfile_ind),trim(lpre)//'_nx',lnx,dimid2(1)) + rcode = pio_def_dim(io_file(lfile_ind),trim(lpre)//'_ny',lny,dimid2(2)) + + if (present(nt)) then + dimid3(1:2) = dimid2 + rcode = pio_inq_dimid(io_file(lfile_ind),'time',dimid3(3)) + dimid => dimid3 + else + dimid => dimid2 + endif + + write(tmpstr,*) subname,' dimid = ',dimid + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + do k = 1,nf + call FB_getNameN(FB, k, itemc, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Determine rank of field with name itemc + call ESMF_FieldBundleGet(FB, itemc, field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, rank=rank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! TODO (mvertens, 2019-03-13): this is a temporary mod to NOT write hgt + if (trim(itemc) /= "hgt") then + if (rank == 2) then + call ESMF_FieldGet(lfield, ungriddedUBound=ungriddedUBound, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(cnumber,'(i0)') ungriddedUbound(1) + call ESMF_LogWrite(trim(subname)//':'//'field '//trim(itemc)// & + ' has an griddedUBound of '//trim(cnumber), ESMF_LOGMSG_INFO) + + ! Create a new output variable for each element of the undistributed dimension + do n = 1,ungriddedUBound(1) + if (trim(itemc) /= "hgt") then + write(cnumber,'(i0)') n + name1 = trim(lpre)//'_'//trim(itemc)//trim(cnumber) + call ESMF_LogWrite(trim(subname)//': defining '//trim(name1), ESMF_LOGMSG_INFO) + if (luse_float) then + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_REAL, dimid, varid) + rcode = pio_put_att(io_file(lfile_ind), varid,"_FillValue",real(lfillvalue,r4)) + else + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_DOUBLE, dimid, varid) + rcode = pio_put_att(io_file(lfile_ind),varid,"_FillValue",lfillvalue) + end if + if (chkerr(rc,__LINE__,u_FILE_u)) return + rcode = pio_put_att(io_file(lfile_ind), varid, "units" , trim(cunit)) + rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", trim(name1)) + if (present(tavg)) then + if (tavg) then + rcode = pio_put_att(io_file(lfile_ind), varid, "cell_methods", "time: mean") + endif + endif + end if + end do + else + name1 = trim(lpre)//'_'//trim(itemc) + call ESMF_LogWrite(trim(subname)//':'//trim(itemc)//':'//trim(name1),ESMF_LOGMSG_INFO) + if (luse_float) then + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_REAL, dimid, varid) + rcode = pio_put_att(io_file(lfile_ind), varid, "_FillValue", real(lfillvalue, r4)) + else + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_DOUBLE, dimid, varid) + rcode = pio_put_att(io_file(lfile_ind), varid, "_FillValue", lfillvalue) + end if + if (chkerr(rc,__LINE__,u_FILE_u)) return + rcode = pio_put_att(io_file(lfile_ind), varid, "units", trim(cunit)) + rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", trim(name1)) + if (present(tavg)) then + if (tavg) then + rcode = pio_put_att(io_file(lfile_ind), varid, "cell_methods", "time: mean") + endif + end if + end if + end if + end do + + ! Add coordinate information to file + name1 = trim(lpre)//'_lon' + if (luse_float) then + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_REAL, dimid, varid) + else + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_DOUBLE, dimid, varid) + end if + rcode = pio_put_att(io_file(lfile_ind), varid, "long_name", "longitude") + rcode = pio_put_att(io_file(lfile_ind), varid, "units", "degrees_east") + rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", "longitude") + + name1 = trim(lpre)//'_lat' + if (luse_float) then + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_REAL, dimid, varid) + else + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_DOUBLE, dimid, varid) + end if + rcode = pio_put_att(io_file(lfile_ind), varid, "long_name", "latitude") + rcode = pio_put_att(io_file(lfile_ind), varid, "units", "degrees_north") + rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", "latitude") + + ! Finish define mode + if (lwdata) call lilac_io_enddef(filename, file_ind=lfile_ind) + + end if + + if (lwdata) then + + ! use distgrid extracted from field 1 above + call ESMF_DistGridGet(distgrid, localDE=0, elementCount=ns, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(dof(ns)) + call ESMF_DistGridGet(distgrid, localDE=0, seqIndexList=dof, rc=rc) + write(tmpstr,*) subname,' dof = ',ns,size(dof),dof(1),dof(ns) !,minval(dof),maxval(dof) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + call pio_initdecomp(io_subsystem, pio_double, (/lnx,lny/), dof, iodesc) + + ! call pio_writedof(lpre, (/lnx,lny/), int(dof,kind=PIO_OFFSET_KIND), mpicom) + + deallocate(dof) + + do k = 1,nf + call FB_getNameN(FB, k, itemc, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call FB_getFldPtr(FB, itemc, & + fldptr1=fldptr1, fldptr2=fldptr2, rank=rank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! TODO (mvertens, 2019-03-13): this is a temporary mod to NOT write hgt + if (trim(itemc) /= "hgt") then + if (rank == 2) then + + ! Determine the size of the ungridded dimension and the index where the undistributed dimension is located + call ESMF_FieldBundleGet(FB, itemc, field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, ungriddedUBound=ungriddedUBound, gridToFieldMap=gridToFieldMap, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Output for each ungriddedUbound index + do n = 1,ungriddedUBound(1) + write(cnumber,'(i0)') n + name1 = trim(lpre)//'_'//trim(itemc)//trim(cnumber) + rcode = pio_inq_varid(io_file(lfile_ind), trim(name1), varid) + call pio_setframe(io_file(lfile_ind),varid,frame) + + if (gridToFieldMap(1) == 1) then + call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr2(:,n), rcode, fillval=lfillvalue) + else if (gridToFieldMap(1) == 2) then + call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr2(n,:), rcode, fillval=lfillvalue) + end if + end do + else if (rank == 1) then + name1 = trim(lpre)//'_'//trim(itemc) + rcode = pio_inq_varid(io_file(lfile_ind), trim(name1), varid) + call pio_setframe(io_file(lfile_ind),varid,frame) + call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr1, rcode, fillval=lfillvalue) + end if ! end if rank is 2 or 1 + + end if ! end if not "hgt" + end do ! end loop over fields in FB + + ! Fill coordinate variables + name1 = trim(lpre)//'_lon' + rcode = pio_inq_varid(io_file(lfile_ind), trim(name1), varid) + call pio_setframe(io_file(lfile_ind),varid,frame) + call pio_write_darray(io_file(lfile_ind), varid, iodesc, ownedElemCoords_x, rcode, fillval=lfillvalue) + + name1 = trim(lpre)//'_lat' + rcode = pio_inq_varid(io_file(lfile_ind), trim(name1), varid) + call pio_setframe(io_file(lfile_ind),varid,frame) + call pio_write_darray(io_file(lfile_ind), varid, iodesc, ownedElemCoords_y, rcode, fillval=lfillvalue) + + call pio_syncfile(io_file(lfile_ind)) + call pio_freedecomp(io_file(lfile_ind), iodesc) + endif + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_io_write_FB + + !=============================================================================== + subroutine lilac_io_write_int(filename, iam, idata, dname, whead, wdata, file_ind, rc) + + !--------------- + ! Write scalar integer to netcdf file + !--------------- + + ! intput/output variables + character(len=*) ,intent(in) :: filename ! file + integer ,intent(in) :: iam ! local pet + integer ,intent(in) :: idata ! data to be written + character(len=*) ,intent(in) :: dname ! name of data + logical,optional ,intent(in) :: whead ! write header + logical,optional ,intent(in) :: wdata ! write data + integer,optional ,intent(in) :: file_ind + integer ,intent(out):: rc + + ! local variables + integer :: rcode + type(var_desc_t) :: varid + character(CL) :: cunit ! var units + logical :: lwhead, lwdata + integer :: lfile_ind + character(*),parameter :: subName = '(lilac_io_write_int) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lwhead = .true. + lwdata = .true. + if (present(whead)) lwhead = whead + if (present(wdata)) lwdata = wdata + + if (.not.lwhead .and. .not.lwdata) then + ! should we write a warning? + return + endif + + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + + if (lwhead) then + ! if (chkerr(rc,__LINE__,u_FILE_u)) return + ! rcode = pio_put_att(io_file(lfile_ind),varid,"units",trim(cunit)) + rcode = pio_def_var(io_file(lfile_ind),trim(dname),PIO_INT,varid) + rcode = pio_put_att(io_file(lfile_ind),varid,"standard_name",trim(dname)) + if (lwdata) call lilac_io_enddef(filename, file_ind=lfile_ind) + endif + + if (lwdata) then + rcode = pio_inq_varid(io_file(lfile_ind),trim(dname),varid) + rcode = pio_put_var(io_file(lfile_ind),varid,idata) + ! write(logunit,*) subname,' wrote AV ',trim(dname),lwhead,lwdata + endif + + end subroutine lilac_io_write_int + + !=============================================================================== + subroutine lilac_io_write_int1d(filename, iam, idata, dname, whead, wdata, file_ind, rc) + + !--------------- + ! Write 1d integer array to netcdf file + !--------------- + + ! input/output arguments + character(len=*),intent(in) :: filename ! file + integer ,intent(in) :: iam ! local pet + integer ,intent(in) :: idata(:) ! data to be written + character(len=*),intent(in) :: dname ! name of data + logical,optional,intent(in) :: whead ! write header + logical,optional,intent(in) :: wdata ! write data + integer,optional,intent(in) :: file_ind + integer , intent(out) :: rc + + ! local variables + integer :: rcode + integer :: dimid(1) + type(var_desc_t) :: varid + character(CL) :: cunit ! var units + character(CL) :: lname ! long name + character(CL) :: sname ! standard name + integer :: lnx + logical :: lwhead, lwdata + integer :: lfile_ind + character(*),parameter :: subName = '(lilac_io_write_int1d) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lwhead = .true. + lwdata = .true. + if (present(whead)) lwhead = whead + if (present(wdata)) lwdata = wdata + + if (.not.lwhead .and. .not.lwdata) then + ! should we write a warning? + return + endif + + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + + if (lwhead) then + !rcode = pio_put_att(io_file(lfile_ind),varid,"units",trim(cunit)) + lnx = size(idata) + rcode = pio_def_dim(io_file(lfile_ind),trim(dname)//'_nx',lnx,dimid(1)) + rcode = pio_def_var(io_file(lfile_ind),trim(dname),PIO_INT,dimid,varid) + rcode = pio_put_att(io_file(lfile_ind),varid,"standard_name",trim(dname)) + if (lwdata) call lilac_io_enddef(filename, file_ind=lfile_ind) + endif + + if (lwdata) then + rcode = pio_inq_varid(io_file(lfile_ind),trim(dname),varid) + rcode = pio_put_var(io_file(lfile_ind),varid,idata) + endif + + ! write(logunit,*) subname,' wrote AV ',trim(dname),lwhead,lwdata + + end subroutine lilac_io_write_int1d + + !=============================================================================== + subroutine lilac_io_write_r8(filename, iam, rdata, dname, whead, wdata, file_ind, rc) + + !--------------- + ! Write scalar double to netcdf file + !--------------- + + ! input/output arguments + character(len=*),intent(in) :: filename ! file + integer ,intent(in) :: iam ! local pet + real(r8) ,intent(in) :: rdata ! data to be written + character(len=*),intent(in) :: dname ! name of data + logical,optional,intent(in) :: whead ! write header + logical,optional,intent(in) :: wdata ! write data + integer,optional,intent(in) :: file_ind + integer ,intent(out):: rc + + ! local variables + integer :: rcode + type(var_desc_t) :: varid + character(CL) :: cunit ! var units + logical :: lwhead, lwdata + integer :: lfile_ind + character(*),parameter :: subName = '(lilac_io_write_r8) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lwhead = .true. + if (present(whead)) lwhead = whead + lwdata = .true. + if (present(wdata)) lwdata = wdata + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + + if (.not.lwhead .and. .not.lwdata) then + ! should we write a warning? + return + endif + + if (lwhead) then + rcode = pio_def_var(io_file(lfile_ind),trim(dname),PIO_DOUBLE,varid) + if (rcode==PIO_NOERR) then + !rcode = pio_put_att(io_file(lfile_ind),varid,"units",trim(cunit)) + rcode = pio_put_att(io_file(lfile_ind),varid,"standard_name",trim(dname)) + if (lwdata) call lilac_io_enddef(filename, file_ind=lfile_ind) + end if + endif + + if (lwdata) then + rcode = pio_inq_varid(io_file(lfile_ind),trim(dname),varid) + rcode = pio_put_var(io_file(lfile_ind),varid,rdata) + endif + + end subroutine lilac_io_write_r8 + + !=============================================================================== + subroutine lilac_io_write_r81d(filename, iam, rdata, dname, whead, wdata, file_ind, rc) + + !--------------- + ! Write 1d double array to netcdf file + !--------------- + + ! !INPUT/OUTPUT PARAMETERS: + character(len=*),intent(in) :: filename ! file + integer ,intent(in) :: iam + real(r8) ,intent(in) :: rdata(:) ! data to be written + character(len=*),intent(in) :: dname ! name of data + logical,optional,intent(in) :: whead ! write header + logical,optional,intent(in) :: wdata ! write data + integer,optional,intent(in) :: file_ind + integer ,intent(out):: rc + + ! local variables + integer :: rcode + integer :: dimid(1) + type(var_desc_t) :: varid + character(CL) :: cunit ! var units + integer :: lnx + logical :: lwhead, lwdata + integer :: lfile_ind + character(*),parameter :: subName = '(lilac_io_write_r81d) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lwhead = .true. + if (present(whead)) lwhead = whead + lwdata = .true. + if (present(wdata)) lwdata = wdata + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + + if (.not.lwhead .and. .not.lwdata) then + ! should we write a warning? + return + endif + + if (lwhead) then + lnx = size(rdata) + rcode = pio_def_dim(io_file(lfile_ind),trim(dname)//'_nx',lnx,dimid(1)) + rcode = pio_def_var(io_file(lfile_ind),trim(dname),PIO_DOUBLE,dimid,varid) + !rcode = pio_put_att(io_file(lfile_ind),varid,"units",trim(cunit)) + rcode = pio_put_att(io_file(lfile_ind),varid,"standard_name",trim(dname)) + if (lwdata) call lilac_io_enddef(filename, file_ind=lfile_ind) + endif + + if (lwdata) then + rcode = pio_inq_varid(io_file(lfile_ind),trim(dname),varid) + rcode = pio_put_var(io_file(lfile_ind),varid,rdata) + endif + + end subroutine lilac_io_write_r81d + + !=============================================================================== + subroutine lilac_io_write_char(filename, iam, rdata, dname, whead, wdata, file_ind, rc) + + !--------------- + ! Write char string to netcdf file + !--------------- + + ! input/output arguments + character(len=*),intent(in) :: filename ! file + integer ,intent(in) :: iam ! local pet + character(len=*),intent(in) :: rdata ! data to be written + character(len=*),intent(in) :: dname ! name of data + logical,optional,intent(in) :: whead ! write header + logical,optional,intent(in) :: wdata ! write data + integer,optional,intent(in) :: file_ind + integer ,intent(out):: rc + + ! local variables + integer :: rcode + integer :: dimid(1) + type(var_desc_t) :: varid + character(CL) :: cunit ! var units + character(CL) :: lname ! long name + character(CL) :: sname ! standard name + integer :: lnx + logical :: lwhead, lwdata + integer :: lfile_ind + character(CL) :: charvar ! buffer for string read/write + character(*),parameter :: subName = '(lilac_io_write_char) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lwhead = .true. + if (present(whead)) lwhead = whead + lwdata = .true. + if (present(wdata)) lwdata = wdata + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + if (.not.lwhead .and. .not.lwdata) then + ! should we write a warning? + return + endif + + if (lwhead) then + lnx = len(charvar) + rcode = pio_def_dim(io_file(lfile_ind),trim(dname)//'_len',lnx,dimid(1)) + rcode = pio_def_var(io_file(lfile_ind),trim(dname),PIO_CHAR,dimid,varid) + !rcode = pio_put_att(io_file(lfile_ind),varid,"units",trim(cunit)) + rcode = pio_put_att(io_file(lfile_ind),varid,"standard_name",trim(dname)) + if (lwdata) call lilac_io_enddef(filename, file_ind=lfile_ind) + endif + if (lwdata) then + charvar = '' + charvar = trim(rdata) + rcode = pio_inq_varid(io_file(lfile_ind),trim(dname),varid) + rcode = pio_put_var(io_file(lfile_ind),varid,charvar) + endif + + end subroutine lilac_io_write_char + + !=============================================================================== + subroutine lilac_io_write_time(filename, iam, time_units, calendar, time_val, nt,& + whead, wdata, tbnds, file_ind, rc) + + !--------------- + ! Write time variable to netcdf file + !--------------- + + ! input/output variables + character(len=*) , intent(in) :: filename ! file + integer , intent(in) :: iam ! local pet + character(len=*) , intent(in) :: time_units ! units of time + type(ESMF_Calendar) , intent(in) :: calendar ! calendar + real(r8) , intent(in) :: time_val ! data to be written + integer , optional, intent(in) :: nt + logical , optional, intent(in) :: whead ! write header + logical , optional, intent(in) :: wdata ! write data + real(r8) , optional, intent(in) :: tbnds(2) ! time bounds + integer , optional, intent(in) :: file_ind + integer , intent(out):: rc + + ! local variables + integer :: rcode + integer :: dimid(1) + integer :: dimid2(2) + type(var_desc_t) :: varid + logical :: lwhead, lwdata + integer :: start(4),count(4) + real(r8) :: time_val_1d(1) + integer :: lfile_ind + character(CL) :: calname ! calendar name + character(*),parameter :: subName = '(lilac_io_write_time) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lwhead = .true. + if (present(whead)) lwhead = whead + lwdata = .true. + if (present(wdata)) lwdata = wdata + lfile_ind = 0 + if (present(file_ind)) lfile_ind=file_ind + if (.not.lwhead .and. .not.lwdata) then + ! should we write a warning? + return + endif + + ! Write out header + if (lwhead) then + rcode = pio_def_dim(io_file(lfile_ind),'time',PIO_UNLIMITED,dimid(1)) + rcode = pio_def_var(io_file(lfile_ind),'time',PIO_DOUBLE,dimid,varid) + rcode = pio_put_att(io_file(lfile_ind),varid,'units',trim(time_units)) + + if (calendar == ESMF_CALKIND_360DAY) then + calname = '360_day' + else if (calendar == ESMF_CALKIND_GREGORIAN) then + calname = 'gregorian' + else if (calendar == ESMF_CALKIND_JULIAN) then + calname = 'julian' + else if (calendar == ESMF_CALKIND_JULIANDAY) then + calname = 'ESMF_CALKIND_JULIANDAY' + else if (calendar == ESMF_CALKIND_MODJULIANDAY) then + calname = 'ESMF_CALKIND_MODJULIANDAY' + else if (calendar == ESMF_CALKIND_NOCALENDAR) then + calname = 'none' + else if (calendar == ESMF_CALKIND_NOLEAP) then + calname = 'noleap' + end if + rcode = pio_put_att(io_file(lfile_ind),varid,'calendar',trim(calname)) + + if (present(tbnds)) then + dimid2(2) = dimid(1) + rcode = pio_put_att(io_file(lfile_ind),varid,'bounds','time_bnds') + rcode = pio_def_dim(io_file(lfile_ind),'ntb',2,dimid2(1)) + rcode = pio_def_var(io_file(lfile_ind),'time_bnds',PIO_DOUBLE,dimid2,varid) + endif + if (lwdata) call lilac_io_enddef(filename, file_ind=lfile_ind) + endif + + ! Write out data + if (lwdata) then + start = 1 + count = 1 + if (present(nt)) then + start(1) = nt + endif + time_val_1d(1) = time_val + rcode = pio_inq_varid(io_file(lfile_ind),'time',varid) + rcode = pio_put_var(io_file(lfile_ind),varid,start,count,time_val_1d) + if (present(tbnds)) then + rcode = pio_inq_varid(io_file(lfile_ind),'time_bnds',varid) + start = 1 + count = 1 + if (present(nt)) then + start(2) = nt + endif + count(1) = 2 + rcode = pio_put_var(io_file(lfile_ind),varid,start,count,tbnds) + endif + endif + + end subroutine lilac_io_write_time + + !=============================================================================== + subroutine lilac_io_read_FB(filename, vm, iam, FB, pre, frame, rc) + + !--------------- + ! Read FB from netcdf file + !--------------- + + + ! input/output arguments + character(len=*) ,intent(in) :: filename ! file + type(ESMF_VM) ,intent(in) :: vm + integer ,intent(in) :: iam + type(ESMF_FieldBundle) ,intent(in) :: FB ! data to be read + character(len=*) ,optional ,intent(in) :: pre ! prefix to variable name + integer(kind=PIO_OFFSET_KIND) ,optional ,intent(in) :: frame + integer ,intent(out) :: rc + + ! local variables + type(ESMF_Field) :: lfield + integer :: rcode + integer :: nf,ns,ng + integer :: k,n,l + type(file_desc_t) :: pioid + type(var_desc_t) :: varid + type(io_desc_t) :: iodesc + character(CL) :: itemc ! string converted to char + character(CL) :: name1 ! var name + character(CL) :: lpre ! local prefix + real(r8) :: lfillvalue + integer :: tmp(1) + integer :: rank, lsize + real(r8), pointer :: fldptr1(:), fldptr1_tmp(:) + real(r8), pointer :: fldptr2(:,:) + character(CL) :: tmpstr + character(len=16) :: cnumber + integer(kind=Pio_Offset_Kind) :: lframe + integer :: ungriddedUBound(1) ! currently the size must equal 1 for rank 2 fieldds + integer :: gridToFieldMap(1) ! currently the size must equal 1 for rank 2 fieldds + character(*),parameter :: subName = '(lilac_io_read_FB) ' + !------------------------------------------------------------------------------- + rc = ESMF_Success + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + lpre = ' ' + if (present(pre)) then + lpre = trim(pre) + endif + if (present(frame)) then + lframe = frame + else + lframe = 1 + endif + if (.not. ESMF_FieldBundleIsCreated(FB,rc=rc)) then + call ESMF_LogWrite(trim(subname)//" FB "//trim(lpre)//" not created", ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + endif + return + endif + + call ESMF_FieldBundleGet(FB, fieldCount=nf, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(tmpstr,*) subname//' field count = '//trim(lpre),nf + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (nf < 1) then + call ESMF_LogWrite(trim(subname)//" FB "//trim(lpre)//" empty", ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + endif + return + endif + + if (lilac_io_file_exists(vm, iam, trim(filename))) then + rcode = pio_openfile(io_subsystem, pioid, pio_iotype, trim(filename),pio_nowrite) + call ESMF_LogWrite(trim(subname)//' open file '//trim(filename), ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + else + call ESMF_LogWrite(trim(subname)//' ERROR: file invalid '//trim(filename), & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + call pio_seterrorhandling(pioid, PIO_BCAST_ERROR) + + do k = 1,nf + ! Get name of field + call FB_getNameN(FB, k, itemc, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Get iodesc for all fields based on iodesc of first field (assumes that all fields have + ! the same iodesc) + if (k == 1) then + call ESMF_FieldBundleGet(FB, itemc, field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, rank=rank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (rank == 2) then + name1 = trim(lpre)//'_'//trim(itemc)//'1' + else if (rank == 1) then + name1 = trim(lpre)//'_'//trim(itemc) + end if + call lilac_io_read_init_iodesc(FB, name1, pioid, iodesc, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + end if + + call ESMF_LogWrite(trim(subname)//' reading field '//trim(itemc), ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Get pointer to field bundle field + ! Field bundle might be 2d or 1d - but field on mediator history or restart file will always be 1d + call FB_getFldPtr(FB, itemc, & + fldptr1=fldptr1, fldptr2=fldptr2, rank=rank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (rank == 2) then + + ! Determine the size of the ungridded dimension and the + ! index where the undistributed dimension is located + call ESMF_FieldBundleGet(FB, itemc, field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, ungriddedUBound=ungriddedUBound, gridToFieldMap=gridToFieldMap, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (gridToFieldMap(1) == 1) then + lsize = size(fldptr2, dim=1) + else if (gridToFieldMap(1) == 2) then + lsize = size(fldptr2, dim=2) + end if + allocate(fldptr1_tmp(lsize)) + + do n = 1,ungriddedUBound(1) + ! Creat a name for the 1d field on the mediator history or restart file based on the + ! ungridded dimension index of the field bundle 2d fiedl + write(cnumber,'(i0)') n + name1 = trim(lpre)//'_'//trim(itemc)//trim(cnumber) + + rcode = pio_inq_varid(pioid, trim(name1), varid) + if (rcode == pio_noerr) then + call ESMF_LogWrite(trim(subname)//' read field '//trim(name1), ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call pio_setframe(pioid, varid, lframe) + call pio_read_darray(pioid, varid, iodesc, fldptr1_tmp, rcode) + rcode = pio_get_att(pioid, varid, "_FillValue", lfillvalue) + if (rcode /= pio_noerr) then + lfillvalue = fillvalue + endif + do l = 1,size(fldptr1_tmp) + if (fldptr1_tmp(l) == lfillvalue) fldptr1_tmp(l) = 0.0_r8 + enddo + else + fldptr1_tmp = 0.0_r8 + endif + if (gridToFieldMap(1) == 1) then + fldptr2(:,n) = fldptr1_tmp(:) + else if (gridToFieldMap(1) == 2) then + fldptr2(n,:) = fldptr1_tmp(:) + end if + end do + + deallocate(fldptr1_tmp) + + else if (rank == 1) then + name1 = trim(lpre)//'_'//trim(itemc) + + rcode = pio_inq_varid(pioid, trim(name1), varid) + if (rcode == pio_noerr) then + call ESMF_LogWrite(trim(subname)//' read field '//trim(name1), ESMF_LOGMSG_INFO) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call pio_setframe(pioid,varid,lframe) + call pio_read_darray(pioid, varid, iodesc, fldptr1, rcode) + rcode = pio_get_att(pioid,varid,"_FillValue",lfillvalue) + if (rcode /= pio_noerr) then + lfillvalue = fillvalue + endif + do n = 1,size(fldptr1) + if (fldptr1(n) == lfillvalue) fldptr1(n) = 0.0_r8 + enddo + else + fldptr1 = 0.0_r8 + endif + end if + + enddo ! end of loop over fields + call pio_seterrorhandling(pioid,PIO_INTERNAL_ERROR) + + call pio_freedecomp(pioid, iodesc) + call pio_closefile(pioid) + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_io_read_FB + + !=============================================================================== + subroutine lilac_io_read_init_iodesc(FB, name1, pioid, iodesc, rc) + + + ! input/output variables + type(ESMF_FieldBundle) , intent(in) :: FB + character(len=*) , intent(in) :: name1 + type(file_desc_t) , intent(in) :: pioid + type(io_desc_t) , intent(inout) :: iodesc + integer , intent(out) :: rc + + ! local variables + type(ESMF_Field) :: field + type(ESMF_Mesh) :: mesh + type(ESMF_Distgrid) :: distgrid + integer :: rcode + integer :: ns,ng + integer :: n,ndims + integer, pointer :: dimid(:) + type(var_desc_t) :: varid + integer :: lnx,lny + integer :: tmp(1) + integer, pointer :: minIndexPTile(:,:) + integer, pointer :: maxIndexPTile(:,:) + integer :: dimCount, tileCount + integer, pointer :: Dof(:) + character(CL) :: tmpstr + integer :: rank + character(*),parameter :: subName = '(lilac_io_read_init_iodesc) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + rcode = pio_inq_varid(pioid, trim(name1), varid) + if (rcode == pio_noerr) then + + rcode = pio_inq_varndims(pioid, varid, ndims) + write(tmpstr,*) trim(subname),' ndims = ',ndims + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + allocate(dimid(ndims)) + rcode = pio_inq_vardimid(pioid, varid, dimid(1:ndims)) + rcode = pio_inq_dimlen(pioid, dimid(1), lnx) + write(tmpstr,*) trim(subname),' lnx = ',lnx + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + if (ndims>=2) then + rcode = pio_inq_dimlen(pioid, dimid(2), lny) + else + lny = 1 + end if + deallocate(dimid) + + write(tmpstr,*) trim(subname),' lny = ',lny + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + ng = lnx * lny + + call FB_getFieldN(FB, 1, field, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldGet(field, mesh=mesh, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(mesh, elementDistgrid=distgrid, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_DistGridGet(distgrid, dimCount=dimCount, tileCount=tileCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + allocate(minIndexPTile(dimCount, tileCount), maxIndexPTile(dimCount, tileCount)) + call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & + maxIndexPTile=maxIndexPTile, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + !write(tmpstr,*) subname,' counts = ',dimcount,tilecount,minindexptile,maxindexptile + !call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + if (ng > maxval(maxIndexPTile)) then + write(tmpstr,*) subname,' WARNING: dimensions do not match', lnx, lny, maxval(maxIndexPTile) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + !TODO: this should not be an error for say CTSM which does not send a global grid + !rc = ESMF_Failure + !return + endif + + call ESMF_DistGridGet(distgrid, localDE=0, elementCount=ns, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + allocate(dof(ns)) + call ESMF_DistGridGet(distgrid, localDE=0, seqIndexList=dof, rc=rc) + write(tmpstr,*) subname,' dof = ',ns,size(dof),dof(1),dof(ns) !,minval(dof),maxval(dof) + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + call pio_initdecomp(io_subsystem, pio_double, (/lnx,lny/), dof, iodesc) + deallocate(dof) + + deallocate(minIndexPTile, maxIndexPTile) + + end if ! end if rcode check + + end subroutine lilac_io_read_init_iodesc + + !=============================================================================== + subroutine lilac_io_read_int(filename, vm, iam, idata, dname, rc) + + !--------------- + ! Read scalar integer from netcdf file + !--------------- + + ! input/output arguments + character(len=*) , intent(in) :: filename ! file + type(ESMF_VM) :: vm + integer , intent(in) :: iam + integer , intent(inout) :: idata ! integer data + character(len=*) , intent(in) :: dname ! name of data + integer , intent(out) :: rc + + ! local variables + integer :: i1d(1) + character(*),parameter :: subName = '(lilac_io_read_int) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + call lilac_io_read_int1d(filename, vm, iam, i1d, dname, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + idata = i1d(1) + + end subroutine lilac_io_read_int + + !=============================================================================== + subroutine lilac_io_read_int1d(filename, vm, iam, idata, dname, rc) + + !--------------- + ! Read 1d integer array from netcdf file + !--------------- + + ! input/output arguments + character(len=*), intent(in) :: filename ! file + type(ESMF_VM) :: vm + integer, intent(in) :: iam + integer , intent(inout) :: idata(:) ! integer data + character(len=*), intent(in) :: dname ! name of data + integer , intent(out) :: rc + + ! local variables + integer :: rcode + type(file_desc_t) :: pioid + type(var_desc_t) :: varid + character(CL) :: lversion + character(CL) :: name1 + character(*),parameter :: subName = '(lilac_io_read_int1d) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lversion=trim(version) + + if (lilac_io_file_exists(vm, iam, filename)) then + rcode = pio_openfile(io_subsystem, pioid, pio_iotype, trim(filename),pio_nowrite) + call pio_seterrorhandling(pioid,PIO_BCAST_ERROR) + rcode = pio_get_att(pioid,pio_global,"file_version",lversion) + call pio_seterrorhandling(pioid,PIO_INTERNAL_ERROR) + else + if(iam==0) write(logunit,*) subname,' ERROR: file invalid ',trim(filename),' ',trim(dname) + call ESMF_LogWrite(trim(subname)//'ERROR: file invalid '//trim(filename)//' '//trim(dname), ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + endif + + if (trim(lversion) == trim(version)) then + name1 = trim(dname) + else + name1 = trim(prefix)//trim(dname) + endif + rcode = pio_inq_varid(pioid,trim(name1),varid) + rcode = pio_get_var(pioid,varid,idata) + + call pio_closefile(pioid) + end subroutine lilac_io_read_int1d + + !=============================================================================== + subroutine lilac_io_read_r8(filename, vm, iam, rdata, dname, rc) + + !--------------- + ! Read scalar double from netcdf file + !--------------- + + ! input/output arguments + character(len=*) , intent(in) :: filename ! file + type(ESMF_VM) :: vm + integer , intent(in) :: iam + real(r8) , intent(inout) :: rdata ! real data + character(len=*) , intent(in) :: dname ! name of data + integer , intent(out) :: rc + + ! local variables + real(r8) :: r1d(1) + character(*),parameter :: subName = '(lilac_io_read_r8) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + call lilac_io_read_r81d(filename, vm, iam, r1d,dname, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + rdata = r1d(1) + + end subroutine lilac_io_read_r8 + + !=============================================================================== + subroutine lilac_io_read_r81d(filename, vm, iam, rdata, dname, rc) + + !--------------- + ! Read 1d double array from netcdf file + !--------------- + + + ! input/output arguments + character(len=*), intent(in) :: filename ! file + type(ESMF_VM) :: vm + integer , intent(in) :: iam + real(r8) , intent(inout) :: rdata(:) ! real data + character(len=*), intent(in) :: dname ! name of data + integer , intent(out) :: rc + + ! local variables + integer :: rcode + type(file_desc_T) :: pioid + type(var_desc_t) :: varid + character(CL) :: lversion + character(CL) :: name1 + character(*),parameter :: subName = '(lilac_io_read_r81d) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lversion=trim(version) + + if (lilac_io_file_exists(vm, iam, filename)) then + rcode = pio_openfile(io_subsystem, pioid, pio_iotype, trim(filename),pio_nowrite) + call pio_seterrorhandling(pioid,PIO_BCAST_ERROR) + rcode = pio_get_att(pioid,pio_global,"file_version",lversion) + call pio_seterrorhandling(pioid,PIO_INTERNAL_ERROR) + else + if(iam==0) write(logunit,*) subname,' ERROR: file invalid ',trim(filename),' ',trim(dname) + call ESMF_LogWrite(trim(subname)//'ERROR: file invalid '//trim(filename)//' '//trim(dname), ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + endif + + if (trim(lversion) == trim(version)) then + name1 = trim(dname) + else + name1 = trim(prefix)//trim(dname) + endif + rcode = pio_inq_varid(pioid,trim(name1),varid) + rcode = pio_get_var(pioid,varid,rdata) + + call pio_closefile(pioid) + end subroutine lilac_io_read_r81d + + !=============================================================================== + subroutine lilac_io_read_char(filename, vm, iam, rdata, dname, rc) + + !--------------- + ! Read char string from netcdf file + !--------------- + + ! input/output arguments + character(len=*), intent(in) :: filename ! file + type(ESMF_VM) :: vm + integer, intent(in) :: iam + character(len=*), intent(inout) :: rdata ! character data + character(len=*), intent(in) :: dname ! name of data + integer , intent(out) :: rc + + ! local variables + integer :: rcode + type(file_desc_T) :: pioid + type(var_desc_t) :: varid + character(CL) :: lversion + character(CL) :: name1 + character(CL) :: charvar ! buffer for string read/write + character(*),parameter :: subName = '(lilac_io_read_char) ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lversion=trim(version) + + if (lilac_io_file_exists(vm, iam, filename)) then + rcode = pio_openfile(io_subsystem, pioid, pio_iotype, trim(filename),pio_nowrite) + ! write(logunit,*) subname,' open file ',trim(filename) + call pio_seterrorhandling(pioid,PIO_BCAST_ERROR) + rcode = pio_get_att(pioid,pio_global,"file_version",lversion) + call pio_seterrorhandling(pioid,PIO_INTERNAL_ERROR) + else + if(iam==0) write(logunit,*) subname,' ERROR: file invalid ',trim(filename),' ',trim(dname) + call ESMF_LogWrite(trim(subname)//'ERROR: file invalid '//trim(filename)//' '//trim(dname), ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + endif + + if (trim(lversion) == trim(version)) then + name1 = trim(dname) + else + name1 = trim(prefix)//trim(dname) + endif + rcode = pio_inq_varid(pioid,trim(name1),varid) + rcode = pio_get_var(pioid,varid,charvar) + rdata = trim(charvar) + + call pio_closefile(pioid) + end subroutine lilac_io_read_char + + !=============================================================================== + subroutine lilac_io_date2ymd_int (date,year,month,day) + ! Converts coded-date (yyyymmdd) to year/month/day. + ! input/output variables + integer,intent(in) :: date ! coded-date (yyyymmdd) + integer,intent(out) :: year,month,day ! calendar year,month,day + ! local variables + integer :: tdate ! temporary date + !------------------------------------------------------------------------------- + + tdate = abs(date) + year =int(tdate/10000) + if (date < 0) year = -year + month = int( mod(tdate,10000)/ 100) + day = mod(tdate, 100) + end subroutine lilac_io_date2ymd_int + + subroutine lilac_io_date2ymd_long (date,year,month,day) + ! Converts coded-date (yyyymmdd) to year/month/day. + ! input/output variables + integer(I8),intent(in) :: date ! coded-date ([yy]yyyymmdd) + integer ,intent(out) :: year,month,day ! calendar year,month,day + ! local variables + integer(I8) :: tdate ! temporary date + character(*),parameter :: subName = "(lilac_io_date2ymd_long)" + !------------------------------------------------------------------------------- + + tdate = abs(date) + year =int(tdate/10000) + if (date < 0) year = -year + month = int( mod(tdate,10000_I8)/ 100) + day = mod(tdate, 100_I8) + end subroutine lilac_io_date2ymd_long + + !=============================================================================== + subroutine lilac_io_datetod2string_int(date_str, ymd, tod) + ! Converts coded date (yyyymmdd) and optional time of day to a string like + ! 'yyyy-mm-dd-ttttt' (if tod is present) or 'yyyy-mm-dd' (if tod is absent). + ! yyyy in the output string will have at least 4 but no more than 6 characters (with + ! leading zeroes if necessary). + + ! input/output variables + character(len=*) , intent(out) :: date_str + integer , intent(in) :: ymd + integer, optional, intent(in) :: tod + + ! local variables + integer :: yy, mm, dd + character(len=6) :: year_str + character(len=3) :: month_str + character(len=3) :: day_str + character(len=6) :: time_str + !--------------------------------------- + + call lilac_io_date2ymd(ymd, yy, mm, dd) + + ! Convert year, month, day and time of day to a string like 'yyyy-mm-dd-ttttt'. + ! yyyy in the output string will have at least 4 but no more than 6 characters (with + ! leading zeroes if necessary). + write(year_str,'(i6.4)') yy + year_str = adjustl(year_str) + write(month_str,'(a,i2.2)') '-',mm + write(day_str ,'(a,i2.2)') '-',dd + if (present(tod)) then + write(time_str,'(a,i5.5)') '-',tod + else + time_str = ' ' + end if + date_str = trim(year_str) // trim(month_str) // trim(day_str) // trim(time_str) + + end subroutine lilac_io_datetod2string_int + + subroutine lilac_io_datetod2string_long(date_str, ymd, tod) + ! Converts coded date (yyyymmdd) and optional time of day to a string like + ! 'yyyy-mm-dd-ttttt' (if tod is present) or 'yyyy-mm-dd' (if tod is absent). + ! yyyy in the output string will have at least 4 but no more than 6 characters (with + ! leading zeroes if necessary). + + ! input/output variables + character(len=*) , intent(out) :: date_str + integer(i8) , intent(in) :: ymd + integer, optional, intent(in) :: tod + + ! local variables + integer :: yy, mm, dd + character(len=6) :: year_str + character(len=3) :: month_str + character(len=3) :: day_str + character(len=6) :: time_str + !--------------------------------------- + + call lilac_io_date2ymd(ymd, yy, mm, dd) + + ! Convert year, month, day and time of day to a string like 'yyyy-mm-dd-ttttt'. + ! yyyy in the output string will have at least 4 but no more than 6 characters (with + ! leading zeroes if necessary). + write(year_str,'(i6.4)') yy + year_str = adjustl(year_str) + write(month_str,'(a,i2.2)') '-',mm + write(day_str ,'(a,i2.2)') '-',dd + if (present(tod)) then + write(time_str,'(a,i5.5)') '-',tod + else + time_str = ' ' + end if + date_str = trim(year_str) // trim(month_str) // trim(day_str) // trim(time_str) + + end subroutine lilac_io_datetod2string_long + + !=============================================================================== + subroutine lilac_io_ymd2date_int(year,month,day,date) + ! Converts year, month, day to coded-date + + ! input/output variables + integer,intent(in ) :: year,month,day ! calendar year,month,day + integer,intent(out) :: date ! coded (yyyymmdd) calendar date + !--------------------------------------- + + ! NOTE: this calendar has a year zero (but no day or month zero) + date = abs(year)*10000 + month*100 + day ! coded calendar date + if (year < 0) date = -date + end subroutine lilac_io_ymd2date_int + + subroutine lilac_io_ymd2date_long(year,month,day,date) + ! Converts year, month, day to coded-date + + ! input/output variables + integer ,intent(in ) :: year,month,day ! calendar year,month,day + integer(I8),intent(out) :: date ! coded ([yy]yyyymmdd) calendar date + !--------------------------------------- + + ! NOTE: this calendar has a year zero (but no day or month zero) + date = abs(year)*10000_I8 + month*100 + day ! coded calendar date + if (year < 0) date = -date + end subroutine lilac_io_ymd2date_long + +end module lilac_io diff --git a/lilac/lilac/lilac_methods.F90 b/lilac/lilac/lilac_methods.F90 new file mode 100644 index 0000000000..7052a6a355 --- /dev/null +++ b/lilac/lilac/lilac_methods.F90 @@ -0,0 +1,1709 @@ +module lilac_methods + + !----------------------------------------------------------------------------- + ! Generic operation methods used by the Mediator Component. + !----------------------------------------------------------------------------- + + use ESMF + use mpi , only : MPI_ERROR_STRING, MPI_MAX_ERROR_STRING, MPI_SUCCESS + use shr_kind_mod , only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8 + use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag + use lilac_constants , only : czero => lilac_constants_czero + use lilac_constants , only : spval_init => lilac_constants_spval_init + + implicit none + private + + interface lilac_methods_FB_accum ; module procedure & + lilac_methods_FB_accumFB2FB + end interface + + interface lilac_methods_FB_copy ; module procedure & + lilac_methods_FB_copyFB2FB + end interface + + interface lilac_methods_FieldPtr_compare ; module procedure & + lilac_methods_FieldPtr_compare1, & + lilac_methods_FieldPtr_compare2 + end interface + + ! used/reused in module + + logical :: isPresent + character(len=1024) :: msgString + type(ESMF_GeomType_Flag) :: geomtype + type(ESMF_FieldStatus_Flag) :: status + character(*) , parameter :: u_FILE_u = & + __FILE__ + + public lilac_methods_FB_copy + public lilac_methods_FB_accum + public lilac_methods_FB_average + public lilac_methods_FB_reset + public lilac_methods_FB_clean + public lilac_methods_FB_diagnose + public lilac_methods_FB_FldChk + public lilac_methods_FB_GetFldPtr + public lilac_methods_FB_getNameN + public lilac_methods_FB_getFieldN + public lilac_methods_FB_getFieldByName + public lilac_methods_FB_getNumflds + public lilac_methods_FB_Field_diagnose + public lilac_methods_State_diagnose + public lilac_methods_State_GetFldPtr + public lilac_methods_State_SetScalar + public lilac_methods_State_GetScalar + public lilac_methods_Clock_TimePrint + public lilac_methods_FieldPtr_compare + public chkerr + + private lilac_methods_Mesh_Print + private lilac_methods_Mesh_Write + private lilac_methods_Field_GetFldPtr + private lilac_methods_FB_SetFldPtr + private lilac_methods_FB_copyFB2FB + private lilac_methods_FB_accumFB2FB + private lilac_methods_State_getNameN + private lilac_methods_State_SetFldPtr + +!----------------------------------------------------------------------------- +contains +!----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_getNameN(FB, fieldnum, fieldname, rc) + + ! ---------------------------------------------- + ! Get name of field number fieldnum in input field bundle FB + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_FieldBundle), intent(in) :: FB + integer , intent(in) :: fieldnum + character(len=*) , intent(out) :: fieldname + integer , intent(out) :: rc + + ! local variables + integer :: fieldCount + character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) + character(len=*),parameter :: subname='(lilac_methods_FB_getNameN)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + fieldname = ' ' + + call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (fieldnum > fieldCount) then + call ESMF_LogWrite(trim(subname)//": ERROR fieldnum > fieldCount ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + + allocate(lfieldnamelist(fieldCount)) + call ESMF_FieldBundleGet(FB, fieldNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + fieldname = lfieldnamelist(fieldnum) + + deallocate(lfieldnamelist) + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_getNameN + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_getFieldN(FB, fieldnum, field, rc) + + ! ---------------------------------------------- + ! Get field with number fieldnum in input field bundle FB + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_FieldBundle), intent(in) :: FB + integer , intent(in) :: fieldnum + type(ESMF_Field) , intent(inout) :: field + integer , intent(out) :: rc + + ! local variables + character(len=ESMF_MAXSTR) :: name + character(len=*),parameter :: subname='(lilac_methods_FB_getFieldN)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + call lilac_methods_FB_getNameN(FB, fieldnum, name, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldBundleGet(FB, fieldName=name, field=field, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_getFieldN + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_getFieldByName(FB, fieldname, field, rc) + + ! ---------------------------------------------- + ! Get field associated with fieldname out of FB + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_FieldBundle), intent(in) :: FB + character(len=*) , intent(in) :: fieldname + type(ESMF_Field) , intent(inout) :: field + integer , intent(out) :: rc + + ! local variables + character(len=*),parameter :: subname='(lilac_methods_FB_getFieldByName)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + call ESMF_FieldBundleGet(FB, fieldName=fieldname, field=field, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_getFieldByName + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_State_getNameN(State, fieldnum, fieldname, rc) + + ! ---------------------------------------------- + ! Get field number fieldnum name out of State + ! ---------------------------------------------- + + type(ESMF_State), intent(in) :: State + integer , intent(in) :: fieldnum + character(len=*), intent(out) :: fieldname + integer , intent(out) :: rc + + ! local variables + integer :: fieldCount + character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) + character(len=*),parameter :: subname='(lilac_methods_State_getNameN)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + fieldname = ' ' + + call ESMF_StateGet(State, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (fieldnum > fieldCount) then + call ESMF_LogWrite(trim(subname)//": ERROR fieldnum > fieldCount ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + + allocate(lfieldnamelist(fieldCount)) + call ESMF_StateGet(State, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + fieldname = lfieldnamelist(fieldnum) + + deallocate(lfieldnamelist) + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_State_getNameN + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_clean(FB, rc) + + ! ---------------------------------------------- + ! Destroy fields in FB and FB + ! ---------------------------------------------- + + type(ESMF_FieldBundle), intent(inout) :: FB + integer , intent(out) :: rc + + ! local variables + integer :: i,j,n + integer :: fieldCount + character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) + type(ESMF_Field) :: field + character(len=*),parameter :: subname='(lilac_methods_FB_clean)' + ! ---------------------------------------------- + + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + rc = ESMF_SUCCESS + + call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_FieldBundleGet(FB, fieldNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1, fieldCount + call ESMF_FieldBundleGet(FB, fieldName=lfieldnamelist(n), field=field, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldDestroy(field, rc=rc, noGarbage=.true.) + if (chkerr(rc,__LINE__,u_FILE_u)) return + enddo + + call ESMF_FieldBundleDestroy(FB, rc=rc, noGarbage=.true.) + if (chkerr(rc,__LINE__,u_FILE_u)) return + deallocate(lfieldnamelist) + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + + end subroutine lilac_methods_FB_clean + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_reset(FB, value, rc) + ! ---------------------------------------------- + ! Set all fields to value in FB + ! If value is not provided, reset to 0.0 + ! ---------------------------------------------- + + ! intput/output variables + type(ESMF_FieldBundle), intent(inout) :: FB + real(R8) , intent(in), optional :: value + integer , intent(out) :: rc + + ! local variables + integer :: i,j,n + integer :: fieldCount + character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) + real(R8) :: lvalue + character(len=*),parameter :: subname='(lilac_methods_FB_reset)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + lvalue = czero + if (present(value)) then + lvalue = value + endif + + call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_FieldBundleGet(FB, fieldNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1, fieldCount + call lilac_methods_FB_SetFldPtr(FB, lfieldnamelist(n), lvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + enddo + + deallocate(lfieldnamelist) + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_reset + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_average(FB, count, rc) + + ! ---------------------------------------------- + ! Set all fields to zero in FB + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_FieldBundle), intent(inout) :: FB + integer , intent(in) :: count + integer , intent(out) :: rc + + ! local variables + integer :: i,j,n + integer :: fieldCount, lrank + character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) + real(R8), pointer :: dataPtr1(:) + real(R8), pointer :: dataPtr2(:,:) + character(len=*),parameter :: subname='(lilac_methods_FB_average)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + if (count == 0) then + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": WARNING count is 0", ESMF_LOGMSG_INFO) + end if + !call ESMF_LogWrite(trim(subname)//": WARNING count is 0 set avg to spval", ESMF_LOGMSG_INFO) + !call lilac_methods_FB_reset(FB, value=spval, rc=rc) + !if (chkerr(rc,__LINE__,u_FILE_u)) return + + else + + call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_FieldBundleGet(FB, fieldNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + call lilac_methods_FB_GetFldPtr(FB, lfieldnamelist(n), dataPtr1, dataPtr2, lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (lrank == 0) then + ! no local data + elseif (lrank == 1) then + do i=lbound(dataptr1,1),ubound(dataptr1,1) + dataptr1(i) = dataptr1(i) / real(count, R8) + enddo + elseif (lrank == 2) then + do j=lbound(dataptr2,2),ubound(dataptr2,2) + do i=lbound(dataptr2,1),ubound(dataptr2,1) + dataptr2(i,j) = dataptr2(i,j) / real(count, R8) + enddo + enddo + else + call ESMF_LogWrite(trim(subname)//": ERROR rank not supported ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + enddo + deallocate(lfieldnamelist) + + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_average + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_diagnose(FB, string, rc) + + ! ---------------------------------------------- + ! Diagnose status of FB + ! ---------------------------------------------- + + type(ESMF_FieldBundle) , intent(inout) :: FB + character(len=*) , intent(in), optional :: string + integer , intent(out) :: rc + + ! local variables + integer :: i,j,n + integer :: fieldCount, lrank + character(ESMF_MAXSTR), pointer :: lfieldnamelist(:) + character(len=CL) :: lstring + real(R8), pointer :: dataPtr1d(:) + real(R8), pointer :: dataPtr2d(:,:) + character(len=*), parameter :: subname='(lilac_methods_FB_diagnose)' + ! ---------------------------------------------- + + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + rc = ESMF_SUCCESS + + lstring = '' + if (present(string)) then + lstring = trim(string) // ' ' + endif + + ! Determine number of fields in field bundle and allocate memory for lfieldnamelist + call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + + ! Get the fields in the field bundle + call ESMF_FieldBundleGet(FB, fieldNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! For each field in the bundle, get its memory location and print out the field + do n = 1, fieldCount + call lilac_methods_FB_GetFldPtr(FB, lfieldnamelist(n), & + fldptr1=dataPtr1d, fldptr2=dataPtr2d, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (lrank == 0) then + ! no local data + + elseif (lrank == 1) then + if (size(dataPtr1d) > 0) then + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & + minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) + else + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), " no data" + endif + + elseif (lrank == 2) then + if (size(dataPtr2d) > 0) then + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n))//' ', & + minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) + else + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & + " no data" + endif + + else + call ESMF_LogWrite(trim(subname)//": ERROR rank not supported ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + enddo + + ! Deallocate memory + deallocate(lfieldnamelist) + + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + + end subroutine lilac_methods_FB_diagnose + + !----------------------------------------------------------------------------- + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_State_diagnose(State, string, rc) + + ! ---------------------------------------------- + ! Diagnose status of State + ! ---------------------------------------------- + + type(ESMF_State), intent(in) :: State + character(len=*), intent(in), optional :: string + integer , intent(out) :: rc + + ! local variables + integer :: i,j,n + integer :: fieldCount, lrank + character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) + character(len=CS) :: lstring + real(R8), pointer :: dataPtr1d(:) + real(R8), pointer :: dataPtr2d(:,:) + character(len=*),parameter :: subname='(lilac_methods_State_diagnose)' + ! ---------------------------------------------- + + if (dbug_flag > 5) then + call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + endif + + lstring = '' + if (present(string)) then + lstring = trim(string) + endif + + call ESMF_StateGet(State, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + + call ESMF_StateGet(State, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1, fieldCount + + call lilac_methods_State_GetFldPtr(State, lfieldnamelist(n), & + fldptr1=dataPtr1d, fldptr2=dataPtr2d, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (lrank == 0) then + ! no local data + + elseif (lrank == 1) then + if (size(dataPtr1d) > 0) then + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & + minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) + else + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & + " no data" + endif + + elseif (lrank == 2) then + if (size(dataPtr2d) > 0) then + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & + minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) + else + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(lfieldnamelist(n)), & + " no data" + endif + + else + call ESMF_LogWrite(trim(subname)//": ERROR rank not supported ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + + enddo + + deallocate(lfieldnamelist) + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_State_diagnose + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_Field_diagnose(FB, fieldname, string, rc) + + ! ---------------------------------------------- + ! Diagnose status of State + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_FieldBundle), intent(inout) :: FB + character(len=*), intent(in) :: fieldname + character(len=*), intent(in), optional :: string + integer , intent(out) :: rc + + ! local variables + integer :: lrank + character(len=CS) :: lstring + real(R8), pointer :: dataPtr1d(:) + real(R8), pointer :: dataPtr2d(:,:) + character(len=*),parameter :: subname='(lilac_methods_FB_FieldDiagnose)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + lstring = '' + if (present(string)) then + lstring = trim(string) + endif + + call lilac_methods_FB_GetFldPtr(FB, fieldname, dataPtr1d, dataPtr2d, lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (lrank == 0) then + ! no local data + elseif (lrank == 1) then + if (size(dataPtr1d) > 0) then + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname), & + minval(dataPtr1d), maxval(dataPtr1d), sum(dataPtr1d), size(dataPtr1d) + else + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname)," no data" + endif + elseif (lrank == 2) then + if (size(dataPtr2d) > 0) then + write(msgString,'(A,3g14.7,i8)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname), & + minval(dataPtr2d), maxval(dataPtr2d), sum(dataPtr2d), size(dataPtr2d) + else + write(msgString,'(A,a)') trim(subname)//' '//trim(lstring)//': '//trim(fieldname)," no data" + endif + else + call ESMF_LogWrite(trim(subname)//": ERROR rank not supported ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_Field_diagnose + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_copyFB2FB(FBout, FBin, rc) + + ! ---------------------------------------------- + ! Copy common field names from FBin to FBout + ! ---------------------------------------------- + + type(ESMF_FieldBundle), intent(inout) :: FBout + type(ESMF_FieldBundle), intent(in) :: FBin + integer , intent(out) :: rc + character(len=*), parameter :: subname='(lilac_methods_FB_copyFB2FB)' + ! ---------------------------------------------- + + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + rc = ESMF_SUCCESS + + call lilac_methods_FB_accum(FBout, FBin, copy=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_copyFB2FB + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_accumFB2FB(FBout, FBin, copy, rc) + + ! ---------------------------------------------- + ! Accumulate common field names from FBin to FBout + ! If copy is passed in and true, the this is a copy + ! ---------------------------------------------- + + type(ESMF_FieldBundle), intent(inout) :: FBout + type(ESMF_FieldBundle), intent(in) :: FBin + logical, optional , intent(in) :: copy + integer , intent(out) :: rc + + ! local variables + integer :: i,j,n + integer :: fieldCount, lranki, lranko + character(ESMF_MAXSTR) ,pointer :: lfieldnamelist(:) + logical :: exists + logical :: lcopy + real(R8), pointer :: dataPtri1(:) , dataPtro1(:) + real(R8), pointer :: dataPtri2(:,:), dataPtro2(:,:) + character(len=*), parameter :: subname='(lilac_methods_FB_accumFB2FB)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + lcopy = .false. ! accumulate by default + if (present(copy)) then + lcopy = copy + endif + + call ESMF_FieldBundleGet(FBout, fieldCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_FieldBundleGet(FBout, fieldNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1, fieldCount + call ESMF_FieldBundleGet(FBin, fieldName=lfieldnamelist(n), isPresent=exists, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (exists) then + call lilac_methods_FB_GetFldPtr(FBin, lfieldnamelist(n), dataPtri1, dataPtri2, lranki, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call lilac_methods_FB_GetFldPtr(FBout, lfieldnamelist(n), dataPtro1, dataPtro2, lranko, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (lranki == 1 .and. lranko == 1) then + + if (.not.lilac_methods_FieldPtr_Compare(dataPtro1, dataPtri1, subname, rc)) then + call ESMF_LogWrite(trim(subname)//": ERROR in dataPtr1 size ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + + if (lcopy) then + do i=lbound(dataPtri1,1),ubound(dataPtri1,1) + dataPtro1(i) = dataPtri1(i) + enddo + else + do i=lbound(dataPtri1,1),ubound(dataPtri1,1) + dataPtro1(i) = dataPtro1(i) + dataPtri1(i) + enddo + endif + + elseif (lranki == 2 .and. lranko == 2) then + + if (.not.lilac_methods_FieldPtr_Compare(dataPtro2, dataPtri2, subname, rc)) then + call ESMF_LogWrite(trim(subname)//": ERROR in dataPtr2 size ", ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + endif + + if (lcopy) then + do j=lbound(dataPtri2,2),ubound(dataPtri2,2) + do i=lbound(dataPtri2,1),ubound(dataPtri2,1) + dataPtro2(i,j) = dataPtri2(i,j) + enddo + enddo + else + do j=lbound(dataPtri2,2),ubound(dataPtri2,2) + do i=lbound(dataPtri2,1),ubound(dataPtri2,1) + dataPtro2(i,j) = dataPtro2(i,j) + dataPtri2(i,j) + enddo + enddo + endif + + else + + write(msgString,'(a,2i8)') trim(subname)//": ranki, ranko = ",lranki,lranko + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(trim(subname)//": ERROR ranki ranko not supported "//trim(lfieldnamelist(n)), & + ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return + + endif + + endif + enddo + + deallocate(lfieldnamelist) + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_accumFB2FB + + !----------------------------------------------------------------------------- + + logical function lilac_methods_FB_FldChk(FB, fldname, rc) + + ! ---------------------------------------------- + ! Determine if field with fldname is in input field bundle + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_FieldBundle), intent(in) :: FB + character(len=*) , intent(in) :: fldname + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(lilac_methods_FB_FldChk)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + ! If field bundle is not created then set return to .false. + if (.not. ESMF_FieldBundleIsCreated(FB)) then + lilac_methods_FB_FldChk = .false. + return + end if + + ! If field bundle is created determine if fldname is present in field bundle + lilac_methods_FB_FldChk = .false. + + call ESMF_FieldBundleGet(FB, fieldName=trim(fldname), isPresent=isPresent, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) then + call ESMF_LogWrite(trim(subname)//" Error checking field: "//trim(fldname), & + ESMF_LOGMSG_ERROR) + return + endif + if (isPresent) then + lilac_methods_FB_FldChk = .true. + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end function lilac_methods_FB_FldChk + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_Field_GetFldPtr(field, fldptr1, fldptr2, rank, abort, rc) + + ! ---------------------------------------------- + ! for a field, determine rank and return fldptr1 or fldptr2 + ! abort is true by default and will abort if fldptr is not yet allocated in field + ! rank returns 0, 1, or 2. 0 means fldptr not allocated and abort=false + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_Field) , intent(in) :: field + real(R8), pointer , intent(inout), optional :: fldptr1(:) + real(R8), pointer , intent(inout), optional :: fldptr2(:,:) + integer , intent(out) , optional :: rank + logical , intent(in) , optional :: abort + integer , intent(out) , optional :: rc + + ! local variables + type(ESMF_Mesh) :: lmesh + integer :: lrank, nnodes, nelements + logical :: labort + character(len=*), parameter :: subname='(lilac_methods_Field_GetFldPtr)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + + if (.not.present(rc)) then + call ESMF_LogWrite(trim(subname)//": ERROR rc not present ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + rc = ESMF_SUCCESS + + labort = .true. + if (present(abort)) then + labort = abort + endif + lrank = -99 + + call ESMF_FieldGet(field, status=status, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (status /= ESMF_FIELDSTATUS_COMPLETE) then + lrank = 0 + if (labort) then + call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + rc = ESMF_FAILURE + return + else + call ESMF_LogWrite(trim(subname)//": WARNING data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + endif + else + + call ESMF_FieldGet(field, geomtype=geomtype, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (geomtype == ESMF_GEOMTYPE_GRID) then + call ESMF_FieldGet(field, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + elseif (geomtype == ESMF_GEOMTYPE_MESH) then + call ESMF_FieldGet(field, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(field, mesh=lmesh, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(lmesh, numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (nnodes == 0 .and. nelements == 0) lrank = 0 + + else + call ESMF_LogWrite(trim(subname)//": ERROR geomtype not supported ", & + ESMF_LOGMSG_INFO, rc=rc) + rc = ESMF_FAILURE + return + endif ! geomtype + + if (lrank == 0) then + call ESMF_LogWrite(trim(subname)//": no local nodes or elements ", & + ESMF_LOGMSG_INFO) + + elseif (lrank == 1) then + if (.not.present(fldptr1)) then + call ESMF_LogWrite(trim(subname)//": ERROR missing rank=1 array ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + call ESMF_FieldGet(field, farrayPtr=fldptr1, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + elseif (lrank == 2) then + if (.not.present(fldptr2)) then + call ESMF_LogWrite(trim(subname)//": ERROR missing rank=2 array ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + call ESMF_FieldGet(field, farrayPtr=fldptr2, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + else + call ESMF_LogWrite(trim(subname)//": ERROR in rank ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + endif ! status + + if (present(rank)) then + rank = lrank + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_Field_GetFldPtr + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field, rc) + + ! ---------------------------------------------- + ! Get pointer to a field bundle field + ! ---------------------------------------------- + + type(ESMF_FieldBundle) , intent(in) :: FB + character(len=*) , intent(in) :: fldname + real(R8), pointer , intent(inout), optional :: fldptr1(:) + real(R8), pointer , intent(inout), optional :: fldptr2(:,:) + integer , intent(out), optional :: rank + integer , intent(out), optional :: rc + type(ESMF_Field) , intent(out), optional :: field + + ! local variables + type(ESMF_Field) :: lfield + integer :: lrank + character(len=*), parameter :: subname='(lilac_methods_FB_GetFldPtr)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + + if (.not.present(rc)) then + call ESMF_LogWrite(trim(subname)//": ERROR rc not present "//trim(fldname), & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + rc = ESMF_SUCCESS + + if (.not. lilac_methods_FB_FldChk(FB, trim(fldname), rc=rc)) then + call ESMF_LogWrite(trim(subname)//": ERROR field "//trim(fldname)//" not in FB ", & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + call ESMF_FieldBundleGet(FB, fieldName=trim(fldname), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call lilac_methods_Field_GetFldPtr(lfield, & + fldptr1=fldptr1, fldptr2=fldptr2, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (present(rank)) then + rank = lrank + endif + if (present(field)) then + field = lfield + endif + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_GetFldPtr + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_SetFldPtr(FB, fldname, val, rc) + + type(ESMF_FieldBundle), intent(in) :: FB + character(len=*) , intent(in) :: fldname + real(R8) , intent(in) :: val + integer , intent(out) :: rc + + ! local variables + type(ESMF_Field) :: lfield + integer :: lrank + real(R8), pointer :: fldptr1(:) + real(R8), pointer :: fldptr2(:,:) + character(len=*), parameter :: subname='(lilac_methods_FB_SetFldPtr)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + call lilac_methods_FB_GetFldPtr(FB, fldname, fldptr1, fldptr2, lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (lrank == 0) then + ! no local data + elseif (lrank == 1) then + fldptr1 = val + elseif (lrank == 2) then + fldptr2 = val + else + call ESMF_LogWrite(trim(subname)//": ERROR in rank "//trim(fldname), & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_FB_SetFldPtr + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_State_GetFldPtr(ST, fldname, fldptr1, fldptr2, rank, rc) + ! ---------------------------------------------- + ! Get pointer to a state field + ! ---------------------------------------------- + + type(ESMF_State), intent(in) :: ST + character(len=*), intent(in) :: fldname + real(R8), pointer, intent(inout), optional :: fldptr1(:) + real(R8), pointer, intent(inout), optional :: fldptr2(:,:) + integer , intent(out), optional :: rank + integer , intent(out), optional :: rc + + ! local variables + type(ESMF_Field) :: lfield + integer :: lrank + character(len=*), parameter :: subname='(lilac_methods_State_GetFldPtr)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + + if (.not.present(rc)) then + call ESMF_LogWrite(trim(subname)//": ERROR rc not present "//trim(fldname), & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + rc = ESMF_SUCCESS + + call ESMF_StateGet(ST, itemName=trim(fldname), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call lilac_methods_Field_GetFldPtr(lfield, & + fldptr1=fldptr1, fldptr2=fldptr2, rank=lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (present(rank)) then + rank = lrank + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_State_GetFldPtr + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_State_SetFldPtr(ST, fldname, val, rc) + + type(ESMF_State) , intent(in) :: ST + character(len=*) , intent(in) :: fldname + real(R8), intent(in) :: val + integer , intent(out) :: rc + + ! local variables + type(ESMF_Field) :: lfield + integer :: lrank + real(R8), pointer :: fldptr1(:) + real(R8), pointer :: fldptr2(:,:) + character(len=*), parameter :: subname='(lilac_methods_State_SetFldPtr)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + call lilac_methods_State_GetFldPtr(ST, fldname, fldptr1, fldptr2, lrank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (lrank == 0) then + ! no local data + elseif (lrank == 1) then + fldptr1 = val + elseif (lrank == 2) then + fldptr2 = val + else + call ESMF_LogWrite(trim(subname)//": ERROR in rank "//trim(fldname), & + ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + return + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_State_SetFldPtr + + !----------------------------------------------------------------------------- + + logical function lilac_methods_FieldPtr_Compare1(fldptr1, fldptr2, cstring, rc) + + real(R8), pointer, intent(in) :: fldptr1(:) + real(R8), pointer, intent(in) :: fldptr2(:) + character(len=*) , intent(in) :: cstring + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(lilac_methods_FieldPtr_Compare1)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + lilac_methods_FieldPtr_Compare1 = .false. + if (lbound(fldptr2,1) /= lbound(fldptr1,1) .or. & + ubound(fldptr2,1) /= ubound(fldptr1,1)) then + call ESMF_LogWrite(trim(subname)//": ERROR in data size "//trim(cstring), ESMF_LOGMSG_ERROR, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(msgString,*) trim(subname)//': fldptr1 ',lbound(fldptr1),ubound(fldptr1) + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + write(msgString,*) trim(subname)//': fldptr2 ',lbound(fldptr2),ubound(fldptr2) + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + else + lilac_methods_FieldPtr_Compare1 = .true. + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end function lilac_methods_FieldPtr_Compare1 + + !----------------------------------------------------------------------------- + + logical function lilac_methods_FieldPtr_Compare2(fldptr1, fldptr2, cstring, rc) + + real(R8), pointer, intent(in) :: fldptr1(:,:) + real(R8), pointer, intent(in) :: fldptr2(:,:) + character(len=*) , intent(in) :: cstring + integer , intent(out) :: rc + + ! local variables + character(len=*), parameter :: subname='(lilac_methods_FieldPtr_Compare2)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + lilac_methods_FieldPtr_Compare2 = .false. + if (lbound(fldptr2,2) /= lbound(fldptr1,2) .or. & + lbound(fldptr2,1) /= lbound(fldptr1,1) .or. & + ubound(fldptr2,2) /= ubound(fldptr1,2) .or. & + ubound(fldptr2,1) /= ubound(fldptr1,1)) then + call ESMF_LogWrite(trim(subname)//": ERROR in data size "//trim(cstring), ESMF_LOGMSG_ERROR, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(msgString,*) trim(subname)//': fldptr2 ',lbound(fldptr2),ubound(fldptr2) + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + write(msgString,*) trim(subname)//': fldptr1 ',lbound(fldptr1),ubound(fldptr1) + call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO) + else + lilac_methods_FieldPtr_Compare2 = .true. + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end function lilac_methods_FieldPtr_Compare2 + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_Mesh_Print(mesh, string, rc) + + type(ESMF_Mesh) , intent(in) :: mesh + character(len=*), intent(in) :: string + integer , intent(out) :: rc + + type(ESMF_Distgrid) :: distgrid + type(ESMF_DELayout) :: delayout + integer :: pdim, sdim, nnodes, nelements + integer :: localDeCount + integer :: DeCount + integer :: dimCount, tileCount + integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:) + type(ESMF_MeshStatus_Flag) :: meshStatus + logical :: elemDGPresent, nodeDGPresent + character(len=*),parameter :: subname='(lilac_methods_Mesh_Print)' + ! ---------------------------------------------- + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + rc = ESMF_SUCCESS + + call ESMF_MeshGet(mesh, elementDistGridIsPresent=elemDGPresent, & + nodalDistgridIsPresent=nodeDGPresent, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(mesh, status=meshStatus, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! first get the distgrid, which should be available + if (elemDGPresent) then + call ESMF_MeshGet(mesh, elementDistgrid=distgrid, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": distGrid=element" + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_DistGridGet(distgrid, deLayout=deLayout, dimCount=dimCount, & + tileCount=tileCount, deCount=deCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": dimCount=", dimCount + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": tileCount=", tileCount + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": deCount=", deCount + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_DELayoutGet(deLayout, localDeCount=localDeCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": localDeCount=", localDeCount + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount + allocate(minIndexPTile(dimCount, tileCount), & + maxIndexPTile(dimCount, tileCount)) + + ! get minIndex and maxIndex arrays + call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & + maxIndexPTile=maxIndexPTile, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": minIndexPTile=", minIndexPTile + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": maxIndexPTile=", maxIndexPTile + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + deallocate(minIndexPTile, maxIndexPTile) + + endif + + if (nodeDGPresent) then + call ESMF_MeshGet(mesh, nodalDistgrid=distgrid, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": distGrid=nodal" + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_DistGridGet(distgrid, deLayout=deLayout, dimCount=dimCount, & + tileCount=tileCount, deCount=deCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": dimCount=", dimCount + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": tileCount=", tileCount + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": deCount=", deCount + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_DELayoutGet(deLayout, localDeCount=localDeCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": localDeCount=", localDeCount + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! allocate minIndexPTile and maxIndexPTile accord. to dimCount and tileCount + allocate(minIndexPTile(dimCount, tileCount), & + maxIndexPTile(dimCount, tileCount)) + + ! get minIndex and maxIndex arrays + call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & + maxIndexPTile=maxIndexPTile, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": minIndexPTile=", minIndexPTile + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": maxIndexPTile=", maxIndexPTile + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + deallocate(minIndexPTile, maxIndexPTile) + + endif + + if (.not. elemDGPresent .and. .not. nodeDGPresent) then + call ESMF_LogWrite(trim(subname)//": cannot print distgrid from mesh", & + ESMF_LOGMSG_WARNING, rc=rc) + return + endif + + ! if mesh is complete, also get additional parameters + if (meshStatus==ESMF_MESHSTATUS_COMPLETE) then + ! access localDeCount to show this is a real Grid + call ESMF_MeshGet(mesh, parametricDim=pdim, spatialDim=sdim, & + numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write (msgString,*) trim(subname)//":"//trim(string)//": parametricDim=", pdim + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + write (msgString,*) trim(subname)//":"//trim(string)//": spatialDim=", sdim + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + write (msgString,*) trim(subname)//":"//trim(string)//": numOwnedNodes=", nnodes + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + write (msgString,*) trim(subname)//":"//trim(string)//": numOwnedElements=", nelements + call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + endif + + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_Mesh_Print + + +!----------------------------------------------------------------------------- + subroutine lilac_methods_Clock_TimePrint(clock,string,rc) + + ! input/output variables + type(ESMF_Clock) , intent(in) :: clock + character(len=*) , intent(in),optional :: string + integer , intent(out) :: rc + + ! local variables + type(ESMF_Time) :: time + type(ESMF_TimeInterval) :: timeStep + character(len=CS) :: timestr + character(len=CL) :: lstring + character(len=*), parameter :: subname='(lilac_methods_Clock_TimePrint)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + + if (present(string)) then + lstring = trim(subname)//":"//trim(string) + else + lstring = trim(subname) + endif + + call ESMF_ClockGet(clock,currtime=time,rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet(time,timestring=timestr,rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(trim(lstring)//": currtime = "//trim(timestr), ESMF_LOGMSG_INFO) + + call ESMF_ClockGet(clock,starttime=time,rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet(time,timestring=timestr,rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(trim(lstring)//": startime = "//trim(timestr), ESMF_LOGMSG_INFO) + + call ESMF_ClockGet(clock,stoptime=time,rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet(time,timestring=timestr,rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(trim(lstring)//": stoptime = "//trim(timestr), ESMF_LOGMSG_INFO) + + call ESMF_ClockGet(clock,timestep=timestep,rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeIntervalGet(timestep,timestring=timestr,rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(trim(lstring)//": timestep = "//trim(timestr), ESMF_LOGMSG_INFO) + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_Clock_TimePrint + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_Mesh_Write(mesh, string, rc) + + type(ESMF_Mesh) ,intent(in) :: mesh + character(len=*),intent(in) :: string + integer ,intent(out) :: rc + + ! local + integer :: n,l,i,lsize,ndims + character(len=CS) :: name + type(ESMF_DISTGRID) :: distgrid + type(ESMF_Array) :: array + real(R8), pointer :: rawdata(:) + real(R8), pointer :: coord(:) + character(len=*),parameter :: subname='(lilac_methods_Mesh_Write)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + if (dbug_flag > 10) then + call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) + endif + +#if (1 == 0) + !--- elements --- + + call ESMF_MeshGet(mesh, spatialDim=ndims, numownedElements=lsize, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(rawdata(ndims*lsize)) + allocate(coord(lsize)) + + call ESMF_MeshGet(mesh, elementDistgrid=distgrid, ownedElemCoords=rawdata, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1,ndims + name = "unknown" + if (n == 1) name = "lon_element" + if (n == 2) name = "lat_element" + do l = 1,lsize + i = 2*(l-1) + n + coord(l) = rawdata(i) + array = ESMF_ArrayCreate(distgrid, farrayPtr=coord, name=name, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call lilac_methods_Array_diagnose(array, string=trim(string)//"_"//trim(name), rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_ArrayWrite(array, trim(string)//"_"//trim(name)//".nc", overwrite=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + enddo + enddo + + deallocate(rawdata,coord) + + !--- nodes --- + + call ESMF_MeshGet(mesh, spatialDim=ndims, numownedNodes=lsize, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(rawdata(ndims*lsize)) + allocate(coord(lsize)) + + call ESMF_MeshGet(mesh, nodalDistgrid=distgrid, ownedNodeCoords=rawdata, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1,ndims + name = "unknown" + if (n == 1) name = "lon_nodes" + if (n == 2) name = "lat_nodes" + do l = 1,lsize + i = 2*(l-1) + n + coord(l) = rawdata(i) + array = ESMF_ArrayCreate(distgrid, farrayPtr=coord, name=name, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call lilac_methods_Array_diagnose(array, string=trim(string)//"_"//trim(name), rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_ArrayWrite(array, trim(string)//"_"//trim(name)//".nc", overwrite=.true., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + enddo + enddo + + deallocate(rawdata,coord) +#else + call ESMF_LogWrite(trim(subname)//": turned off right now", ESMF_LOGMSG_INFO) +#endif + + if (dbug_flag > 5) then + call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) + endif + + end subroutine lilac_methods_Mesh_Write + + !----------------------------------------------------------------------------- + +!================================================================================ + + subroutine lilac_methods_State_GetScalar(state, scalar_id, scalar_value, flds_scalar_name, flds_scalar_num, rc) + + ! ---------------------------------------------- + ! Get scalar data from State for a particular name and broadcast it to all other pets + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_State), intent(in) :: state + integer, intent(in) :: scalar_id + real(R8), intent(out) :: scalar_value + character(len=*), intent(in) :: flds_scalar_name + integer, intent(in) :: flds_scalar_num + integer, intent(inout) :: rc + + ! local variables + integer :: mytask, ierr, len, icount + type(ESMF_VM) :: vm + type(ESMF_Field) :: field + real(R8), pointer :: farrayptr(:,:) + real(r8) :: tmp(1) + character(len=*), parameter :: subname='(lilac_methods_State_GetScalar)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_VMGetCurrent(vm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_VMGet(vm, localPet=mytask, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! check item exist or not? + call ESMF_StateGet(State, itemSearch=trim(flds_scalar_name), itemCount=icount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (icount > 0) then + call ESMF_StateGet(State, itemName=trim(flds_scalar_name), field=field, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (mytask == 0) then + call ESMF_FieldGet(field, farrayPtr = farrayptr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then + call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO, line=__LINE__, file=u_FILE_u) + rc = ESMF_FAILURE + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + endif + tmp(:) = farrayptr(scalar_id,:) + endif + call ESMF_VMBroadCast(vm, tmp, 1, 0, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + scalar_value = tmp(1) + else + call ESMF_LogWrite(trim(subname)//": no ESMF_Field found named: "//trim(flds_scalar_name), ESMF_LOGMSG_INFO) + end if + + end subroutine lilac_methods_State_GetScalar + +!================================================================================ + + subroutine lilac_methods_State_SetScalar(scalar_value, scalar_id, State, flds_scalar_name, flds_scalar_num, rc) + + ! ---------------------------------------------- + ! Set scalar data from State for a particular name + ! ---------------------------------------------- + + ! input/output arguments + real(R8), intent(in) :: scalar_value + integer, intent(in) :: scalar_id + type(ESMF_State), intent(inout) :: State + character(len=*), intent(in) :: flds_scalar_name + integer, intent(in) :: flds_scalar_num + integer, intent(inout) :: rc + + ! local variables + integer :: mytask + type(ESMF_Field) :: field + type(ESMF_VM) :: vm + real(R8), pointer :: farrayptr(:,:) + character(len=*), parameter :: subname='(lilac_methods_State_SetScalar)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_VMGetCurrent(vm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_VMGet(vm, localPet=mytask, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(State, itemName=trim(flds_scalar_name), field=field, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (mytask == 0) then + call ESMF_FieldGet(field, farrayPtr = farrayptr, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then + call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + endif + farrayptr(scalar_id,1) = scalar_value + endif + + end subroutine lilac_methods_State_SetScalar + + !----------------------------------------------------------------------------- + + subroutine lilac_methods_FB_getNumFlds(FB, string, nflds, rc) + + ! ---------------------------------------------- + ! Determine if fieldbundle is created and if so, the number of non-scalar + ! fields in the field bundle + ! ---------------------------------------------- + + ! input/output variables + type(ESMF_FieldBundle) , intent(in) :: FB + character(len=*) , intent(in) :: string + integer , intent(out) :: nflds + integer , intent(inout) :: rc + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + if (.not. ESMF_FieldBundleIsCreated(FB)) then + call ESMF_LogWrite(trim(string)//": has not been created, returning", ESMF_LOGMSG_INFO) + nflds = 0 + else + ! Note - the scalar field has been removed from all mediator + ! field bundles - so this is why we check if the fieldCount is 0 and not 1 here + + call ESMF_FieldBundleGet(FB, fieldCount=nflds, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (nflds == 0) then + call ESMF_LogWrite(trim(string)//": only has scalar data, returning", ESMF_LOGMSG_INFO) + end if + end if + + end subroutine lilac_methods_FB_getNumFlds + +!=============================================================================== + + logical function ChkErr(rc, line, file, mpierr) + + integer, intent(in) :: rc + integer, intent(in) :: line + + character(len=*), intent(in) :: file + logical, optional, intent(in) :: mpierr + + character(MPI_MAX_ERROR_STRING) :: lstring + integer :: dbrc, lrc, len, ierr + + ChkErr = .false. + lrc = rc + if (present(mpierr) .and. mpierr) then + if (rc == MPI_SUCCESS) return + call MPI_ERROR_STRING(rc, lstring, len, ierr) + call ESMF_LogWrite("ERROR: "//trim(lstring), ESMF_LOGMSG_INFO, line=line, file=file, rc=dbrc) + lrc = ESMF_FAILURE + endif + + if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=line, file=file)) then + ChkErr = .true. + endif + + end function ChkErr + +end module lilac_methods + diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index d8725a8dbe..19ee588c75 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -13,22 +13,24 @@ module lilac_mod public :: lilac_init public :: lilac_run + ! Gridded components and states in gridded components + type(ESMF_GridComp) :: atm_gcomp + type(ESMF_GridComp) :: lnd_gcomp + + ! Coupler components + type(ESMF_CplComp) :: cpl_atm2lnd_comp + type(ESMF_CplComp) :: cpl_lnd2atm_comp + + ! States + type(ESMF_State) :: atm2lnd_l_state, atm2lnd_a_state + type(ESMF_State) :: lnd2atm_a_state, lnd2atm_l_state + ! Clock, TimeInterval, and Times type(ESMF_Clock) :: lilac_clock type(ESMF_Calendar),target :: lilac_calendar type(ESMF_Alarm) :: lilac_restart_alarm type(ESMF_Alarm) :: lilac_stop_alarm - ! Gridded components and states in gridded components - type(ESMF_GridComp) :: atm_gcomp - type(ESMF_GridComp) :: lnd_gcomp - type(ESMF_State) :: atm2lnd_l_state, atm2lnd_a_state - type(ESMF_State) :: lnd2atm_a_state, lnd2atm_l_state - - ! Coupler components - type(ESMF_CplComp) :: cpl_atm2lnd_comp - type(ESMF_CplComp) :: cpl_lnd2atm_comp - character(*) , parameter :: modname = "lilac_mod" integer :: mytask @@ -324,6 +326,7 @@ end subroutine lilac_init subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) use shr_sys_mod, only : shr_sys_abort + use lilac_history ! input/output variables logical, intent(in) :: restart_alarm_is_ringing diff --git a/lilac/lilac/lilac_time.F90 b/lilac/lilac/lilac_time.F90 new file mode 100644 index 0000000000..724925565b --- /dev/null +++ b/lilac/lilac/lilac_time.F90 @@ -0,0 +1,541 @@ +module lilac_time + + use ESMF + use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl, r8=>shr_kind_r8 + use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag + use lilac_methods , only : chkerr + + implicit none + private ! default private + + public :: lilac_time_alarmInit ! initialize an alarm + + ! Clock and alarm options + character(len=*), private, parameter :: & + optNONE = "none" , & + optNever = "never" , & + optNSteps = "nsteps" , & + optNStep = "nstep" , & + optNSeconds = "nseconds" , & + optNSecond = "nsecond" , & + optNMinutes = "nminutes" , & + optNMinute = "nminute" , & + optNHours = "nhours" , & + optNHour = "nhour" , & + optNDays = "ndays" , & + optNDay = "nday" , & + optNMonths = "nmonths" , & + optNMonth = "nmonth" , & + optNYears = "nyears" , & + optNYear = "nyear" , & + optMonthly = "monthly" , & + optYearly = "yearly" , & + optIfdays0 = "ifdays0" , & + optGLCCouplingPeriod = "glc_coupling_period" + + ! Module data + integer, parameter :: SecPerDay = 86400 ! Seconds per day + character(len=*), parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine lilac_time_alarmInit( clock, alarm, option, & + opt_n, opt_ymd, opt_tod, RefTime, alarmname, rc) + + ! !DESCRIPTION: Setup an alarm in a clock + ! Notes: The ringtime sent to AlarmCreate MUST be the next alarm + ! time. If you send an arbitrary but proper ringtime from the + ! past and the ring interval, the alarm will always go off on the + ! next clock advance and this will cause serious problems. Even + ! if it makes sense to initialize an alarm with some reference + ! time and the alarm interval, that reference time has to be + ! advance forward to be >= the current time. In the logic below + ! we set an appropriate "NextAlarm" and then we make sure to + ! advance it properly based on the ring interval. + + ! input/output variables + type(ESMF_Clock) , intent(inout) :: clock ! clock + type(ESMF_Alarm) , intent(inout) :: alarm ! alarm + character(len=*) , intent(in) :: option ! alarm option + integer , optional , intent(in) :: opt_n ! alarm freq + integer , optional , intent(in) :: opt_ymd ! alarm ymd + integer , optional , intent(in) :: opt_tod ! alarm tod (sec) + type(ESMF_Time) , optional , intent(in) :: RefTime ! ref time + character(len=*) , optional , intent(in) :: alarmname ! alarm name + integer , intent(inout) :: rc ! Return code + + ! local variables + type(ESMF_Calendar) :: cal ! calendar + integer :: lymd ! local ymd + integer :: ltod ! local tod + integer :: cyy,cmm,cdd,csec ! time info + character(len=64) :: lalarmname ! local alarm name + logical :: update_nextalarm ! update next alarm + type(ESMF_Time) :: CurrTime ! Current Time + type(ESMF_Time) :: NextAlarm ! Next restart alarm time + type(ESMF_TimeInterval) :: AlarmInterval ! Alarm interval + integer :: sec + character(len=*), parameter :: subname = '(lilac_time_alarmInit): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + lalarmname = 'alarm_unknown' + if (present(alarmname)) lalarmname = trim(alarmname) + ltod = 0 + if (present(opt_tod)) ltod = opt_tod + lymd = -1 + if (present(opt_ymd)) lymd = opt_ymd + + call ESMF_ClockGet(clock, CurrTime=CurrTime, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeGet(CurrTime, yy=cyy, mm=cmm, dd=cdd, s=csec, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! initial guess of next alarm, this will be updated below + if (present(RefTime)) then + NextAlarm = RefTime + else + NextAlarm = CurrTime + endif + + ! Get calendar from clock + call ESMF_ClockGet(clock, calendar=cal) + + ! Determine inputs for call to create alarm + selectcase (trim(option)) + + case (optNONE) + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .false. + + case (optNever) + call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .false. + + case (optIfdays0) + if (.not. present(opt_ymd)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_ymd', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=opt_n, s=0, calendar=cal, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .true. + + case (optNSteps) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNStep) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNSeconds) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNSecond) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMinutes) + call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMinute) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNHours) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNHour) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNDays) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNDay) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMonths) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMonth) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optMonthly) + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=1, s=0, calendar=cal, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .true. + + case (optNYears) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNYear) + if (.not.present(opt_n)) then + call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + if (opt_n <= 0) then + call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optYearly) + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeSet( NextAlarm, yy=cyy, mm=1, dd=1, s=0, calendar=cal, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + update_nextalarm = .true. + + case default + call ESMF_LogWrite(subname//'unknown option '//trim(option), ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + + end select + + ! -------------------------------------------------------------------------------- + ! --- AlarmInterval and NextAlarm should be set --- + ! -------------------------------------------------------------------------------- + + ! --- advance Next Alarm so it won't ring on first timestep for + ! --- most options above. go back one alarminterval just to be careful + + if (update_nextalarm) then + NextAlarm = NextAlarm - AlarmInterval + do while (NextAlarm <= CurrTime) + NextAlarm = NextAlarm + AlarmInterval + enddo + endif + + alarm = ESMF_AlarmCreate( name=lalarmname, clock=clock, ringTime=NextAlarm, & + ringInterval=AlarmInterval, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine lilac_time_alarmInit + + !=============================================================================== + + subroutine lilac_time_read_restart(restart_file, & + start_ymd, start_tod, ref_ymd, ref_tod, curr_ymd, curr_tod, rc) + + use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr + use netcdf , only : nf90_inq_varid, nf90_get_var, nf90_close + use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO + + ! input/output variables + character(len=*), intent(in) :: restart_file + integer, intent(out) :: ref_ymd ! Reference date (YYYYMMDD) + integer, intent(out) :: ref_tod ! Reference time of day (seconds) + integer, intent(out) :: start_ymd ! Start date (YYYYMMDD) + integer, intent(out) :: start_tod ! Start time of day (seconds) + integer, intent(out) :: curr_ymd ! Current ymd (YYYYMMDD) + integer, intent(out) :: curr_tod ! Current tod (seconds) + integer, intent(out) :: rc + + ! local variables + integer :: status, ncid, varid ! netcdf stuff + character(CL) :: tmpstr ! temporary + character(len=*), parameter :: subname = "(lilac_time_read_restart)" + !---------------------------------------------------------------- + + ! use netcdf here since it's serial + status = nf90_open(restart_file, NF90_NOWRITE, ncid) + if (status /= nf90_NoErr) then + print *,__FILE__,__LINE__,trim(restart_file) + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_open', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + endif + status = nf90_inq_varid(ncid, 'start_ymd', varid) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid start_ymd', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_get_var(ncid, varid, start_ymd) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var start_ymd', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_inq_varid(ncid, 'start_tod', varid) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid start_tod', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_get_var(ncid, varid, start_tod) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var start_tod', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_inq_varid(ncid, 'ref_ymd', varid) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid ref_ymd', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_get_var(ncid, varid, ref_ymd) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var ref_ymd', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_inq_varid(ncid, 'ref_tod', varid) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid ref_tod', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_get_var(ncid, varid, ref_tod) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var ref_tod', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_inq_varid(ncid, 'curr_ymd', varid) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid curr_ymd', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_get_var(ncid, varid, curr_ymd) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var curr_ymd', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_inq_varid(ncid, 'curr_tod', varid) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid curr_tod', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_get_var(ncid, varid, curr_tod) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var curr_tod', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + status = nf90_close(ncid) + if (status /= nf90_NoErr) then + call ESMF_LogWrite(trim(subname)//' ERROR: nf90_close', ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return + end if + + write(tmpstr,*) trim(subname)//" read start_ymd = ",start_ymd + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + write(tmpstr,*) trim(subname)//" read start_tod = ",start_tod + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + write(tmpstr,*) trim(subname)//" read ref_ymd = ",ref_ymd + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + write(tmpstr,*) trim(subname)//" read ref_tod = ",ref_tod + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + write(tmpstr,*) trim(subname)//" read curr_ymd = ",curr_ymd + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + write(tmpstr,*) trim(subname)//" read curr_tod = ",curr_tod + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + + end subroutine lilac_time_read_restart + +end module lilac_time + + diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index 25a05cf73b..d35066ef17 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -1,5 +1,7 @@ module lilac_utils + ! NOTE: the following cannot depend on any esmf objects - since it will be used by the host atmosphere + implicit none private From 30638dbf917a3459cb3d3302073282055d046ae3 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 30 Nov 2019 11:11:25 -0700 Subject: [PATCH 0445/1973] changes to get lilac coupler history files working --- lilac/atm_driver/Makefile | 28 ++++---- lilac/lilac/lilac_history.F90 | 23 +++--- lilac/lilac/lilac_io.F90 | 129 +++++++++++----------------------- lilac/lilac/lilac_mod.F90 | 23 +++++- 4 files changed, 87 insertions(+), 116 deletions(-) diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 96846db837..01486380a1 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -20,14 +20,12 @@ CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/no CTSM_INC = -I$(CTSM_BLD_DIR)/include CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm -#TRACEBACK_FLAGS = -g -traceback -debug all -check all -O2 -r8 TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free - -# ----------------------------------------------------------------------------- EXTRA_LIBS = -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib + MORE_LIBS = -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -# ----------------------------------------------------------------------------- + DRIVER_DIR = $(CURDIR) LILAC_DIR = $(DRIVER_DIR)/../lilac @@ -54,46 +52,46 @@ lilac_atmcap.o : $(LILAC_DIR)/lilac_atmcap.F90 $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -lilac_cpl.o : $(LILAC_DIR)/lilac_cpl.F90 +lilac_mod.o : $(LILAC_DIR)/lilac_mod.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) $(PIO_INC) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -lilac_utils.o : $(LILAC_DIR)/lilac_utils.F90 +lilac_io.o : $(LILAC_DIR)/lilac_io.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) $(PIO_INC) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -lilac_mod.o : $(LILAC_DIR)/lilac_mod.F90 +lilac_cpl.o : $(LILAC_DIR)/lilac_cpl.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -lilac_constants.o : $(LILAC_DIR)/lilac_constants.F90 +lilac_utils.o : $(LILAC_DIR)/lilac_utils.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -lilac_methods.o : $(LILAC_DIR)/lilac_methods.F90 +lilac_constants.o : $(LILAC_DIR)/lilac_constants.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -lilac_time.o : $(LILAC_DIR)/lilac_time.F90 +lilac_methods.o : $(LILAC_DIR)/lilac_methods.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -lilac_io.o : $(LILAC_DIR)/lilac_io.F90 +lilac_time.o : $(LILAC_DIR)/lilac_time.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) $(PIO_INC) \ + $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< lilac_history.o : $(LILAC_DIR)/lilac_history.F90 @@ -108,7 +106,7 @@ atm_driver.o : $(DRIVER_DIR)/atm_driver.F90 $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -atm_driver: atm_driver.o lilac_atmcap.o lilac_mod.o lilac_utils.o lilac_cpl.o +atm_driver: atm_driver.o lilac_atmcap.o lilac_mod.o lilac_utils.o lilac_cpl.o lilac_history.o lilac_methods.o lilac_time.o lilac_io.o lilac_constants.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) $(TRACEBACK_FLAGS) $(MORE_LIBS) mv atm_driver atm_driver.exe rm *.o *.mod diff --git a/lilac/lilac/lilac_history.F90 b/lilac/lilac/lilac_history.F90 index e72099985a..69ce98ae00 100644 --- a/lilac/lilac/lilac_history.F90 +++ b/lilac/lilac/lilac_history.F90 @@ -187,14 +187,17 @@ subroutine lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state ! --- History Alarms !--------------------------------------- - if (ESMF_AlarmIsRinging(AlarmHist, rc=rc)) then - if (ChkErr(rc,__LINE__,u_FILE_u)) return - alarmIsOn = .true. - call ESMF_AlarmRingerOff( AlarmHist, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - alarmisOn = .false. - endif + ! if (ESMF_AlarmIsRinging(AlarmHist, rc=rc)) then + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! alarmIsOn = .true. + ! call ESMF_AlarmRingerOff( AlarmHist, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! else + ! alarmisOn = .false. + ! endif + ! hard-wire for now + alarmisOn = .true. + case_name = 'test_lilac' !--------------------------------------- ! --- History File @@ -203,9 +206,9 @@ subroutine lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state !--------------------------------------- if (alarmIsOn) then - write(hist_file,"(6a)") & - trim(case_name), '.cpl',trim(cpl_inst_tag),'.hi.', trim(nexttimestr),'.nc' + write(hist_file,"(6a)") trim(case_name), '.cpl.hi.',trim(nexttimestr),'.nc' call ESMF_LogWrite(trim(subname)//": write "//trim(hist_file), ESMF_LOGMSG_INFO, rc=rc) + call lilac_io_wopen(hist_file, vm, iam, clobber=.true.) do m = 1,2 diff --git a/lilac/lilac/lilac_io.F90 b/lilac/lilac/lilac_io.F90 index d5aeabf48f..c118d881ca 100644 --- a/lilac/lilac/lilac_io.F90 +++ b/lilac/lilac/lilac_io.F90 @@ -14,51 +14,24 @@ module lilac_io use lilac_methods , only : FB_getFldPtr => lilac_methods_FB_getFldPtr use lilac_methods , only : FB_getNameN => lilac_methods_FB_getNameN use lilac_methods , only : chkerr - use pio , only : file_desc_t, iosystem_desc_t - use pio , only : var_desc_t, io_desc_t, PIO_UNLIMITED - use pio , only : pio_def_dim, pio_inq_dimid, pio_real, pio_put_att, pio_double - use pio , only : pio_inq_varid, pio_setframe, pio_write_darray, pio_initdecomp, pio_freedecomp - use pio , only : pio_syncfile, pio_offset_kind, pio_int - use pio , only : pio_double, pio_def_dim, pio_def_var, pio_put_att, pio_put_var - use pio , only : PIO_IOTYPE_PNETCDF, PIO_IOTYPE_NETCDF, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR - use pio , only : pio_openfile, pio_createfile, PIO_GLOBAL, pio_enddef - use pio , only : pio_put_att, pio_redef, pio_get_att - use pio , only : pio_seterrorhandling, pio_file_is_open, pio_clobber, pio_write, pio_noclobber - use pio , only : pio_file_is_open, pio_closefile - use pio , only : pio_redef, pio_enddef - use pio , only : var_desc_t, pio_def_dim - use pio , only : pio_put_att, pio_put_var - use pio , only : pio_int, pio_char - use pio , only : var_desc_t, pio_def_var, pio_put_att - use pio , only : pio_double, pio_noerr, pio_put_var - use pio , only : file_desc_T, var_desc_t, io_desc_t, pio_nowrite, pio_openfile - use pio , only : pio_noerr, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR - use pio , only : pio_double, pio_get_att, pio_seterrorhandling, pio_freedecomp, pio_closefile - use pio , only : pio_read_darray, pio_offset_kind, pio_setframe - use pio , only : file_desc_T, var_desc_t, io_desc_t, pio_nowrite, pio_openfile - use pio , only : pio_noerr, pio_inq_varndims - use pio , only : pio_inq_dimid, pio_inq_dimlen, pio_inq_vardimid - use pio , only : pio_double, pio_seterrorhandling, pio_initdecomp - use pio , only : var_desc_t, file_desc_t, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR, pio_seterrorhandling - use pio , only : pio_get_var, pio_get_att, pio_openfile - use pio , only : pio_nowrite, pio_openfile, pio_global - use pio , only : pio_closefile - use pio , only : file_desc_t, var_desc_t, pio_openfile, pio_closefile, pio_seterrorhandling - use pio , only : PIO_BCAST_ERROR, PIO_INTERNAL_ERROR, pio_get_var - use pio , only : pio_nowrite, pio_openfile, pio_global, pio_get_att - use pio , only : file_desc_t, var_desc_t, pio_seterrorhandling, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR - use pio , only : pio_closefile, pio_get_var - use pio , only : pio_openfile, pio_global, pio_get_att, pio_nowrite - use pio , only : var_desc_t, pio_def_dim, pio_put_att - use pio , only : pio_put_var - use pio , only : var_desc_t, pio_def_dim - use pio , only : pio_put_var, pio_double, pio_put_att + use pio , only : file_desc_t, iosystem_desc_t, var_desc_t, io_desc_t, file_desc_t + use pio , only : PIO_DOUBLE, PIO_REAL, PIO_INT, PIO_CHAR,PIO_UNLIMITED, PIO_GLOBAL + use pio , only : PIO_IOTYPE_PNETCDF, PIO_IOTYPE_NETCDF, PIO_BCAST_ERROR, PIO_INTERNAL_ERROR, PIO_NOERR + use pio , only : pio_openfile, pio_createfile, pio_nowrite, pio_redef, pio_enddef, pio_closefile + use pio , only : pio_syncfile, pio_offset_kind + use pio , only : pio_initdecomp, pio_freedecomp + use pio , only : pio_seterrorhandling, pio_file_is_open, pio_clobber, pio_noclobber, pio_setframe + use pio , only : pio_inq_dimid, pio_inq_dimlen, pio_inq_vardimid, pio_inq_varid, pio_inq_varndims + use pio , only : pio_def_dim, pio_def_var + use pio , only : pio_get_var, pio_get_att + use pio , only : pio_put_var, pio_put_att + use pio , only : pio_write, pio_write_darray + use pio , only : pio_read_darray implicit none private integer :: logunit = 6 ! TODO: fix this - integer :: lilac_id ! public member functions: public :: lilac_io_wopen @@ -111,16 +84,18 @@ module lilac_io ! module data !------------------------------------------------------------------------------- + type(iosystem_desc_t), pointer :: io_subsystem + integer :: pio_iotype + integer :: pio_ioformat + + integer , parameter :: file_desc_t_cnt = 20 ! Note - this is hard-wired for now + type(file_desc_t) :: io_file(0:file_desc_t_cnt) + character(*),parameter :: prefix = "lilac_io_" character(*),parameter :: modName = "(lilac_io_mod) " character(*),parameter :: version = "lilac0" - integer , parameter :: file_desc_t_cnt = 20 ! Note - this is hard-wired for now integer , parameter :: number_strlen = 2 character(CL) :: wfilename = '' - type(file_desc_t) :: io_file(0:file_desc_t_cnt) - integer :: pio_iotype - integer :: pio_ioformat - type(iosystem_desc_t), pointer :: io_subsystem character(*),parameter :: u_file_u = & __FILE__ @@ -128,6 +103,19 @@ module lilac_io contains !================================================================================= + subroutine lilac_io_init() + + !--------------- + ! initialize module variables + !--------------- + + io_subsystem => shr_pio_getiosys(compid=1) + pio_iotype = shr_pio_getiotype(compid=1) + pio_ioformat = shr_pio_getioformat(compid=1) + + end subroutine lilac_io_init + + !=============================================================================== logical function lilac_io_file_exists(vm, iam, filename) !--------------- @@ -155,43 +143,6 @@ logical function lilac_io_file_exists(vm, iam, filename) end function lilac_io_file_exists - !=============================================================================== - subroutine lilac_io_init() - - !--------------- - ! initialize pio - !--------------- - -#ifdef INTERNAL_PIO_INIT - ! if CMEPS is the only component using PIO, then it needs to initialize PIO - use shr_pio_mod , only : shr_pio_init2 - - type(ESMF_VM) :: vm - integer :: comms(1), comps(1) - logical :: comp_iamin(1) - integer :: comp_comm_iam(1) - character(len=32) :: compLabels(1) - integer :: rc - - call ESMF_VMGetCurrent(vm=vm, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - call ESMF_VMGet(vm, mpiCommunicator=comms(1), localPet=comp_comm_iam(1), rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - comps(1) = lilac_id - compLabels(1) = "MED" - comp_iamin(1) = .true. - - call shr_pio_init2(comps, compLabels, comp_iamin, comms, comp_comm_iam) -#endif - - io_subsystem => shr_pio_getiosys(lilac_id) - pio_iotype = shr_pio_getiotype(lilac_id) - pio_ioformat = shr_pio_getioformat(lilac_id) - - end subroutine lilac_io_init - !=============================================================================== subroutine lilac_io_wopen(filename, vm, iam, clobber, file_ind, model_doi_url) @@ -249,11 +200,11 @@ subroutine lilac_io_wopen(filename, vm, iam, clobber, file_ind, model_doi_url) write(logunit,*) subname,' open file ',trim(filename) end if call pio_seterrorhandling(io_file(lfile_ind),PIO_BCAST_ERROR) - rcode = pio_get_att(io_file(lfile_ind),pio_global,"file_version",lversion) + rcode = pio_get_att(io_file(lfile_ind),PIO_GLOBAL,"file_version",lversion) call pio_seterrorhandling(io_file(lfile_ind),PIO_INTERNAL_ERROR) if (trim(lversion) /= trim(version)) then rcode = pio_redef(io_file(lfile_ind)) - rcode = pio_put_att(io_file(lfile_ind),pio_global,"file_version",version) + rcode = pio_put_att(io_file(lfile_ind),PIO_GLOBAL,"file_version",version) rcode = pio_enddef(io_file(lfile_ind)) endif endif @@ -267,8 +218,8 @@ subroutine lilac_io_wopen(filename, vm, iam, clobber, file_ind, model_doi_url) if (iam==0) then write(logunit,*) subname,' create file ',trim(filename) end if - rcode = pio_put_att(io_file(lfile_ind),pio_global,"file_version",version) - rcode = pio_put_att(io_file(lfile_ind),pio_global,"model_doi_url",lmodel_doi_url) + rcode = pio_put_att(io_file(lfile_ind),PIO_GLOBAL,"file_version",version) + rcode = pio_put_att(io_file(lfile_ind),PIO_GLOBAL,"model_doi_url",lmodel_doi_url) endif elseif (trim(wfilename) /= trim(filename)) then ! filename is open, better match open filename @@ -1539,7 +1490,7 @@ subroutine lilac_io_read_int1d(filename, vm, iam, idata, dname, rc) if (lilac_io_file_exists(vm, iam, filename)) then rcode = pio_openfile(io_subsystem, pioid, pio_iotype, trim(filename),pio_nowrite) call pio_seterrorhandling(pioid,PIO_BCAST_ERROR) - rcode = pio_get_att(pioid,pio_global,"file_version",lversion) + rcode = pio_get_att(pioid,PIO_GLOBAL,"file_version",lversion) call pio_seterrorhandling(pioid,PIO_INTERNAL_ERROR) else if(iam==0) write(logunit,*) subname,' ERROR: file invalid ',trim(filename),' ',trim(dname) @@ -1619,7 +1570,7 @@ subroutine lilac_io_read_r81d(filename, vm, iam, rdata, dname, rc) if (lilac_io_file_exists(vm, iam, filename)) then rcode = pio_openfile(io_subsystem, pioid, pio_iotype, trim(filename),pio_nowrite) call pio_seterrorhandling(pioid,PIO_BCAST_ERROR) - rcode = pio_get_att(pioid,pio_global,"file_version",lversion) + rcode = pio_get_att(pioid,PIO_GLOBAL,"file_version",lversion) call pio_seterrorhandling(pioid,PIO_INTERNAL_ERROR) else if(iam==0) write(logunit,*) subname,' ERROR: file invalid ',trim(filename),' ',trim(dname) @@ -1672,7 +1623,7 @@ subroutine lilac_io_read_char(filename, vm, iam, rdata, dname, rc) rcode = pio_openfile(io_subsystem, pioid, pio_iotype, trim(filename),pio_nowrite) ! write(logunit,*) subname,' open file ',trim(filename) call pio_seterrorhandling(pioid,PIO_BCAST_ERROR) - rcode = pio_get_att(pioid,pio_global,"file_version",lversion) + rcode = pio_get_att(pioid,PIO_GLOBAL,"file_version",lversion) call pio_seterrorhandling(pioid,PIO_INTERNAL_ERROR) else if(iam==0) write(logunit,*) subname,' ERROR: file invalid ',trim(filename),' ',trim(dname) diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 19ee588c75..1ff52d6a19 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -48,6 +48,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! This is called by the host atmosphere ! -------------------------------------------------------------------------------- + use lilac_io , only : lilac_io_init use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd use lilac_utils , only : gindex_atm, atm_mesh_filename use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register @@ -108,6 +109,10 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) call ESMF_LogWrite(subname//"Initializing ESMF ", ESMF_LOGMSG_INFO) + !------------------------------------------------------------------------- + ! Initialize pio with first initialization + !------------------------------------------------------------------------- + ! Initialize pio (needed by CTSM) - TODO: this should be done within CTSM not here call ESMF_VMGetGlobal(vm=vm, rc=rc) @@ -319,14 +324,21 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & print *, trim(subname) // "finished lilac initialization" end if + !------------------------------------------------------------------------- + ! Initialize lilac_io_mod module data + !------------------------------------------------------------------------- + + call lilac_io_init() + call ESMF_LogWrite(subname//"initialized lilac_io ...", ESMF_LOGMSG_INFO) + end subroutine lilac_init !======================================================================== subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) - use shr_sys_mod, only : shr_sys_abort - use lilac_history + use shr_sys_mod , only : shr_sys_abort + use lilac_history, only : lilac_history_write ! input/output variables logical, intent(in) :: restart_alarm_is_ringing @@ -400,6 +412,13 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) call shr_sys_abort("lilac error in cpl_lnd2atm") end if + ! Write out history output + call lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state, lnd2atm_a_state, & + lilac_clock, rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort("lilac error in history write") + end if + ! Advance the time at the end of the time step call ESMF_ClockAdvance(lilac_clock, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then From ead027e82a4079ebb93149ed3986f41dfc0379c4 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 30 Nov 2019 11:13:08 -0700 Subject: [PATCH 0446/1973] updates necessary to get lilac history output working --- src/cpl/lilac/lnd_comp_esmf.F90 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 9ac64ab13e..96846d3d1f 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -2,17 +2,17 @@ module lnd_comp_esmf !---------------------------------------------------------------------------- ! This is the ESMF cap for CTSM + ! NOTE : both mpi_init and pio_init1 are initialized in lilac_mod.F90 !---------------------------------------------------------------------------- ! external libraries use ESMF - use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE use mpi , only : MPI_BCAST, MPI_CHARACTER - use mct_mod , only : mct_world_init, mct_world_clean, mct_die - use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 + use mct_mod , only : mct_world_init use perf_mod , only : t_startf, t_stopf, t_barrierf ! cime share code + use shr_pio_mod , only : shr_pio_init2 use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl use shr_sys_mod , only : shr_sys_abort use shr_file_mod , only : shr_file_setLogUnit, shr_file_getLogUnit @@ -157,8 +157,8 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! for pio_init2 and mct type(ESMF_VM) :: vm - integer :: mpicom_vm - integer :: ncomps = 1 + integer :: mpicom_vm + integer :: ncomps = 1 ! for mct integer, pointer :: mycomms(:) ! for mct integer, pointer :: myids(:) ! for mct integer :: compids(1) = (/1/) ! for both mct and pio_init2 - array with component ids @@ -181,8 +181,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Query VM for local PET and mpi communicator !------------------------------------------------------------------------ - ! NOTE : both MPI_INIT and PIO_INIT1 are initialized in lilac_mod.F90 - call ESMF_VMGetCurrent(vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return @@ -190,15 +188,11 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return call ESMF_LogWrite(subname//"ESMF_VMGet", ESMF_LOGMSG_INFO) - !call ESMF_VMPrint (vm, rc = rc) - !if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - - comms(1) = mpicom_vm - !------------------------------------------------------------------------ ! Initialize pio_init2 TODO: is this needed here? !------------------------------------------------------------------------ + comms(1) = mpicom_vm call shr_pio_init2(compids, compLabels, comp_iamin, comms, iam) call ESMF_LogWrite(subname//"initialized shr_pio_init2 ...", ESMF_LOGMSG_INFO) From 9afc8be37c1667b195543b62b5d878fc5b50947e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 30 Nov 2019 13:06:46 -0700 Subject: [PATCH 0447/1973] now building lilac as part of CTSM - and not as part of the host atm --- lilac/atm_driver/Makefile | 79 ++++---------------------------- lilac/lilac/lilac_fields.F90 | 87 ++++++++++++++++++++++++++++++++++++ lilac/lilac/lilac_mod.F90 | 1 + lilac/lilac/lilac_utils.F90 | 12 +++-- 4 files changed, 101 insertions(+), 78 deletions(-) create mode 100644 lilac/lilac/lilac_fields.F90 diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 01486380a1..b1e137c957 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -14,17 +14,16 @@ include $(ESMFMKFILE) #================================================================================ ### Define directory paths #================================================================================ -CASE_NAME = why01-g -PIO_INC = -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/include -CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf -CTSM_INC = -I$(CTSM_BLD_DIR)/include -CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm +CASE_NAME = why01-g +CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf +CTSM_INC = -I$(CTSM_BLD_DIR)/include +CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free -EXTRA_LIBS = -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib +EXTRA_LIBS = -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib -MORE_LIBS = -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ +MORE_LIBS = -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ DRIVER_DIR = $(CURDIR) @@ -46,80 +45,18 @@ LILAC_DIR = $(DRIVER_DIR)/../lilac $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -lilac_atmcap.o : $(LILAC_DIR)/lilac_atmcap.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - -lilac_mod.o : $(LILAC_DIR)/lilac_mod.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) $(PIO_INC) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - -lilac_io.o : $(LILAC_DIR)/lilac_io.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) $(PIO_INC) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - -lilac_cpl.o : $(LILAC_DIR)/lilac_cpl.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - -lilac_utils.o : $(LILAC_DIR)/lilac_utils.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - -lilac_constants.o : $(LILAC_DIR)/lilac_constants.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - -lilac_methods.o : $(LILAC_DIR)/lilac_methods.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - -lilac_time.o : $(LILAC_DIR)/lilac_time.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - -lilac_history.o : $(LILAC_DIR)/lilac_history.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< - atm_driver.o : $(DRIVER_DIR)/atm_driver.F90 $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ $(EXTRA_LIBS) $(MORE_LIBS) $< -atm_driver: atm_driver.o lilac_atmcap.o lilac_mod.o lilac_utils.o lilac_cpl.o lilac_history.o lilac_methods.o lilac_time.o lilac_io.o lilac_constants.o +atm_driver: atm_driver.o $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) $(TRACEBACK_FLAGS) $(MORE_LIBS) mv atm_driver atm_driver.exe - rm *.o *.mod # module dependencies: -atm_driver.o: lilac_mod.o lilac_atmcap.o lilac_utils.o lilac_cpl.o -lilac_mod.o: lilac_atmcap.o lilac_utils.o lilac_cpl.o lilac_history.o -lilac_atmcap.o: lilac_utils.o -lilac_constants.o : -lilac_methods.o: lilac_constants.o -lilac_time.o: lilac_constants.o lilac_methods.o -lilac_io.o: lilac_constants.o lilac_methods.o -lilac_history.o: lilac_constants.o lilac_methods.o lilac_io.o lilac_time.o +atm_driver.o: # ----------------------------------------------------------------------------- .PHONY: clean berzerk remake diff --git a/lilac/lilac/lilac_fields.F90 b/lilac/lilac/lilac_fields.F90 new file mode 100644 index 0000000000..c31f41a120 --- /dev/null +++ b/lilac/lilac/lilac_fields.F90 @@ -0,0 +1,87 @@ +module lilac_fields + + ! This module is used by both CTSM and the lilac atmcap to ensure that the field bundles + ! exchanged between components are identical + + use ESMF + use lilac_methods, only : chkerr + use lilac_utils , only : atm2lnd, lnd2atm + + implicit none + public + + character(*),parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine lilac_field_bundle_to_land(mesh, fieldbundle, rc) + + type(ESMF_Mesh) :: mesh + type(ESMF_FieldBundle) :: fieldbundle + integer, intent(out) :: rc + + integer :: n + + rc = ESMF_SUCCESS + + ! Add empty fields to field bundle + do n = 1, size(atm2lnd) + call fldbundle_add(trim(atm2lnd(n)%fldname), mesh, fieldbundle, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + + end subroutine lilac_field_bundle_to_land + + !=============================================================================== + + subroutine lilac_field_bundle_from_land(mesh, fieldbundle, rc) + + type(ESMF_Mesh) :: mesh + type(ESMF_FieldBundle) :: fieldbundle + integer, intent(out) :: rc + + integer :: n + + rc = ESMF_SUCCESS + + ! Add empty fields to field bundle + do n = 1, size(atm2lnd) + call fldbundle_add( trim(lnd2atm(n)%fldname), mesh, fieldbundle, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + + end subroutine lilac_field_bundle_from_land + + !=============================================================================== + + subroutine fldbundle_add(fldname, mesh, fieldbundle, rc) + + !--------------------------- + ! Create an empty input field with name 'stdname' to add to fieldbundle + !--------------------------- + + ! input/output variables + character(len=*) , intent(in) :: fldname + type(ESMF_Mesh) , intent(in) :: mesh + type(ESMF_FieldBundle) , intent(inout) :: fieldbundle + integer , intent(out) :: rc + + ! local variables + type(ESMF_Field) :: field + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(fldname), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine fldbundle_add + + +end module lilac_fields diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/lilac/lilac_mod.F90 index 1ff52d6a19..b3febbfae7 100644 --- a/lilac/lilac/lilac_mod.F90 +++ b/lilac/lilac/lilac_mod.F90 @@ -135,6 +135,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & atm_mesh_filename = atm_mesh_file ! Initialize datatypes atm2lnd and lnd2atm + ! This must be done BEFORE the component initialization call lilac_init_atm2lnd(lsize) call lilac_init_lnd2atm(lsize) diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/lilac/lilac_utils.F90 index d35066ef17..08877ffb51 100644 --- a/lilac/lilac/lilac_utils.F90 +++ b/lilac/lilac/lilac_utils.F90 @@ -106,13 +106,11 @@ subroutine lilac_init_lnd2atm(lsize) call lnd2atm_add_fld (lnd2atm, fldname='Sl_u10' , units='unknown', lsize=lsize) call lnd2atm_add_fld (lnd2atm, fldname='Sl_fv' , units='unknown', lsize=lsize) call lnd2atm_add_fld (lnd2atm, fldname='Sl_ram1' , units='unknown', lsize=lsize) - - ! TODO: for now are commenting these since they are in the lnd send - however this - ! is not correct and the lnd send should reintroduce these as soon as possible and - ! the following should be uncommented - !call lnd2atm_add_fld (lnd2atm, fldname='Fall_lwup' , units='unknown', lsize=lsize) - !call lnd2atm_add_fld (lnd2atm, fldname='Fall_taux' , units='unknown', lsize=lsize) - !call lnd2atm_add_fld (lnd2atm, fldname='Fall_tauy' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_lwup' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_taux' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_tauy' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_evap' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_swnet', units='unknown', lsize=lsize) ! now add dataptr memory for all of the fields do n = 1,size(lnd2atm) From 518aa63f2432c29dc1a9feb0f0cce21d2fe13487 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 30 Nov 2019 13:35:48 -0700 Subject: [PATCH 0448/1973] cleanup of Makefile to have minimal information for driver --- lilac/atm_driver/Makefile | 49 +++++++++++---------------------- lilac/atm_driver/atm_driver.F90 | 6 ++-- 2 files changed, 19 insertions(+), 36 deletions(-) diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index b1e137c957..58e9ea1fd0 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -1,63 +1,46 @@ #================================================================================ -# Makefile to compile the lilac program +# Makefile to compile atm_driver on cheyenne #================================================================================ -## This is temporary Makefile for building lilac against CTSM pre-compiled library #================================================================================ -### Finding and including esmf.mk +# Define directory paths #================================================================================ ESMFMKFILE = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk ESMF_LIB_DIR = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default include $(ESMFMKFILE) -#================================================================================ -### Define directory paths -#================================================================================ CASE_NAME = why01-g CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf -CTSM_INC = -I$(CTSM_BLD_DIR)/include -CTSM_LIB = -L$(CTSM_BLD_DIR)/lib -lclm - -TRACEBACK_FLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free +MCT_LIB = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib +SHR_LIB = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib +SHR_INC = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ +CTSM_INC = $(CTSM_BLD_DIR)/clm/obj -EXTRA_LIBS = -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -lcsm_share -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib +FFLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free -MORE_LIBS = -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -L/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -I/glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/clm/obj/ -I//glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ +LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(MCT_LIB) -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib - -DRIVER_DIR = $(CURDIR) -LILAC_DIR = $(DRIVER_DIR)/../lilac +INCLUDES = -I$(CTSM_BLD_DIR)/include -I$(SHR_INC) -I$(CTSM_INC) #================================================================================ -### Compiler and linker rules using ESMF_ variables supplied by esmf.mk +# Compiler and linker rules using ESMF_ variables supplied by esmf.mk #================================================================================ -.SUFFIXES: .f90 .F90 .c .C - -%.o : %.f90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREENOCPP) $< +.SUFFIXES: .F90 %.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(INCLUDES) $(FFLAGS) $< -atm_driver.o : $(DRIVER_DIR)/atm_driver.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) \ - $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) $(ESMF_F90COMPILEFREENOCPP) \ - $(CTSM_INC) $(CTSM_LIB) $(TRACEBACK_FLAGS) \ - $(EXTRA_LIBS) $(MORE_LIBS) $< +atm_driver.o : $(CURDIR)/atm_driver.F90 + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(INCLUDES) $(FFLAGS) $< atm_driver: atm_driver.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(CTSM_INC) $(CTSM_LIB) $(EXTRA_LIBS) $(TRACEBACK_FLAGS) $(MORE_LIBS) + $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(LIBS) mv atm_driver atm_driver.exe # module dependencies: atm_driver.o: -# ----------------------------------------------------------------------------- .PHONY: clean berzerk remake clean: @@ -66,4 +49,4 @@ berzerk: rm -f PET*.ESMF_LogFile job_name* *.o *.mod *.exe remake: rm lilac_mod.o atm_driver.o atm_driver.exe & make -# ----------------------------------------------------------------------------- + diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 146ba9b9c2..f13069396d 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -16,10 +16,9 @@ program atm_driver ! ESMF lilac_atmcap ESMF CTSM cap ESMF river cap (Mizzouroute, Mosart) !---------------------------------------------------------------------------- + use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS use lilac_mod , only : lilac_init, lilac_run, lilac_final use lilac_utils , only : lilac_atm2lnd, lilac_lnd2atm - use shr_sys_mod , only : shr_sys_abort - use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS implicit none @@ -90,7 +89,8 @@ program atm_driver open(newunit=fileunit, status="old", file="atm_driver_in") read(fileunit, atm_driver_input, iostat=ierr) if (ierr > 0) then - call shr_sys_abort( 'problem on read of atm_driver_in') + print *, 'Error on reading atm_driver_in' + call MPI_ABORT(MPI_COMM_WORLD, ierr) end if close(fileunit) From 3bf9bee9bc40e26b95c664041bca4f3f589392c7 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 30 Nov 2019 14:36:02 -0700 Subject: [PATCH 0449/1973] made lilac a part of the ctsm build and created new config file that is input into lilac buildnml - and that is located in the host atm driver --- cime_config/buildlib | 28 ++++++- lilac_config/buildnml | 58 ++++++++++++- lilac_config/lnd_input.py | 27 ------ src/cpl/lilac/lnd_import_export.F90 | 124 ++++++---------------------- 4 files changed, 103 insertions(+), 134 deletions(-) delete mode 100644 lilac_config/lnd_input.py diff --git a/cime_config/buildlib b/cime_config/buildlib index f4cd613a6c..9493767c0c 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -20,6 +20,15 @@ from CIME.utils import run_cmd, expect logger = logging.getLogger(__name__) +############################################################################### +def _get_osvar(key, default): +############################################################################### + if key in os.environ: + value = os.environ[key] + else: + value = default + return value + ############################################################################### def _main_func(): ############################################################################### @@ -33,12 +42,19 @@ def _main_func(): gmake_j = case.get_value("GMAKE_J") gmake = case.get_value("GMAKE") + lilac_mode = _get_osvar('LILAC_MODE', 'off') + print "DEBUG: lilac_mode is ",lilac_mode + if lilac_mode == 'on': + lilac_src = _get_osvar('LILAC_SRC', None) + expect(lilac_src, "environment variable LILAC_SRC must be set") + #------------------------------------------------------- # create Filepath file #------------------------------------------------------- filepath_file = os.path.join(bldroot,"Filepath") if not os.path.isfile(filepath_file): caseroot = case.get_value("CASEROOT") + paths = [os.path.join(caseroot,"SourceMods","src.clm"), os.path.join(lnd_root,"src","main"), os.path.join(lnd_root,"src","biogeophys"), @@ -51,10 +67,14 @@ def _main_func(): os.path.join(lnd_root,"src","fates","biogeophys"), os.path.join(lnd_root,"src","fates","biogeochem"), os.path.join(lnd_root,"src","fates","fire"), - os.path.join(lnd_root,"src","utils"), - os.path.join(lnd_root,"src","cpl"), - #os.path.join(lnd_root,"src","cpl","mct"), - os.path.join(lnd_root,"src","cpl","lilac")] + os.path.join(lnd_root,"src","utils")] + + if lilac_mode == 'off': + paths.append(os.path.join(lnd_root,"src","cpl","mct")) + else: + paths.append(os.path.join(lnd_root,"src","cpl","lilac")) + paths.append(lilac_src) + with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) filepath.write("\n") diff --git a/lilac_config/buildnml b/lilac_config/buildnml index d88ad29199..9f0e0e82b0 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -6,8 +6,30 @@ CTSM namelist creator import sys, os, shutil, subprocess, logging, argparse import six -from lnd_input import * -from argparse import RawTextHelpFormatter +from argparse import RawTextHelpFormatter + +try: + # python2 + from ConfigParser import SafeConfigParser as config_parser + from ConfigParser import MissingSectionHeaderError + from ConfigParser import NoSectionError, NoOptionError + + def config_string_cleaner(text): + """convert strings into unicode + """ + return text.decode('utf-8') +except ImportError: + # python3 + from configparser import ConfigParser as config_parser + from configparser import MissingSectionHeaderError + from configparser import NoSectionError, NoOptionError + + def config_string_cleaner(text): + """Python3 already uses unicode strings, so just return the string + without modification. + + """ + return text logger = logging.getLogger(__name__) @@ -134,6 +156,32 @@ def buildnml(rundir, bldnmldir): """Build the ctsm namelist """ + file_path = os.path.join(rundir,'ctsm.cfg') + + # read the config file + config = config_parser() + config.read(file_path) # TODO: add the code in externals_description.py to get the error checks + + clm_phys = config.get('buildnml_input', 'clm_phys') + start_type = config.get('buildnml_input', 'start_type') + start_ymd = config.get('buildnml_input', 'start_ymd') + startfile_type = config.get('buildnml_input', 'startfile_type') + ignore = config.get('buildnml_input', 'ignore') + configuration = config.get('buildnml_input', 'configuration') + structure = config.get('buildnml_input', 'structure') + ccsm_co2_ppmv = config.get('buildnml_input', 'ccsm_co2_ppmv') + clm_co2_type = config.get('buildnml_input', 'clm_co2_type') + clm_bldnml_opts = config.get('buildnml_input', 'clm_bldnml_opts') + use_case = config.get('buildnml_input', 'use_case') + lnd_tuning_mode = config.get('buildnml_input', 'lnd_tuning_mode') + spinup = config.get('buildnml_input', 'spinup') + gridmask = config.get('buildnml_input', 'gridmask') + lnd_grid = config.get('buildnml_input', 'lnd_grid') + lnd_domain_file = config.get('buildnml_input', 'lnd_domain_file') + lnd_domain_path = config.get('buildnml_input', 'lnd_domain_path') + din_loc_root = config.get('buildnml_input', 'din_loc_root') + clm_namelist_opts = config.get('buildnml_input', 'clm_namelist_opts') + # create config_cache.xml file # Note that build-namelist utilizes the contents of the config_cache.xml file in # the namelist_defaults.xml file to obtain namelist variables @@ -176,7 +224,11 @@ def buildnml(rundir, bldnmldir): if rc > 0: raise Exception("Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) - # remove temporary files from rundir + # remove temporary files in bldnmldir + os.remove(os.path.join(bldnmldir, "lnd_in")) + os.remove(os.path.join(bldnmldir, "clm.input_data_list")) + + # remove temporary files in rundir os.remove(os.path.join(rundir, "config_cache.xml")) os.remove(os.path.join(rundir, "env_lilac.xml")) os.remove(os.path.join(rundir, "drv_flds_in")) diff --git a/lilac_config/lnd_input.py b/lilac_config/lnd_input.py deleted file mode 100644 index d2b202dcae..0000000000 --- a/lilac_config/lnd_input.py +++ /dev/null @@ -1,27 +0,0 @@ -# ------------------------------------------------------------------------- -# set the input namelist options for clm's build-namelist -# ------------------------------------------------------------------------- -# - tuning parameters and initial conditions should be optimized for what CLM model version and -# what meteorlogical forcing combination? valid values are: -# clm5_0_cam6.0, clm5_0_GSWP3v1, clm5_0_CRUv7, clm4_5_CRUv7, clm4_5_GSWP3v1, clm4_5_cam6.0 -# - only support startup or continue runs for now - -clm_phys = "clm5_0" -start_type = "default" -start_ymd = "20000101" -startfile_type = "finidat" -ignore = "-ignore_ic_year" -configuration = "clm" -structure = "standard" -ccsm_co2_ppmv = str(367.0) -clm_co2_type = "constant" -clm_bldnml_opts = "-bgc sp" -use_case = "2000_control" -lnd_tuning_mode = "clm5_0_GSWP3v1" -spinup = "off" -gridmask = "gx3v7" -lnd_grid = "4x5" -lnd_domain_file = "domain.lnd.fv4x5_gx3v7.091218.nc" -lnd_domain_path = "/glade/p/cesmdata/cseg/inputdata/share/domains" -din_loc_root = "/glade/p/cesmdata/cseg/inputdata" -clm_namelist_opts = "" diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 35f6308ff3..e310dbd4c8 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -9,15 +9,15 @@ module lnd_import_export use clm_varctl , only : iulog, co2_ppmv, ndep_from_cpl use clm_varcon , only : rair, o2_molar_const use clm_time_manager , only : get_nstep + use clm_instMod , only : atm2lnd_inst, lnd2atm_inst, water_inst + use domainMod , only : ldomain use spmdMod , only : masterproc use decompmod , only : bounds_type use lnd2atmType , only : lnd2atm_type use lnd2glcMod , only : lnd2glc_type use atm2lndType , only : atm2lnd_type - use domainMod , only : ldomain - use shr_megan_mod , only : shr_megan_mechcomps_n ! TODO: need to add a namelist read nere use lnd_shr_methods , only : chkerr - use clm_instMod , only : atm2lnd_inst, lnd2atm_inst, water_inst + use shr_megan_mod , only : shr_megan_mechcomps_n ! TODO: need to add a namelist read nere implicit none private ! except @@ -25,28 +25,11 @@ module lnd_import_export public :: import_fields public :: export_fields - private :: fldlist_add private :: state_getimport private :: state_setexport private :: state_getfldptr private :: check_for_nans - type fld_list_type - character(len=128) :: stdname - integer :: ungridded_lbound = 0 - integer :: ungridded_ubound = 0 - end type fld_list_type - - integer, parameter :: fldsMax = 100 - integer :: fldsToLnd_num = 0 - integer :: fldsFrLnd_num = 0 - type (fld_list_type) :: fldsToLnd(fldsMax) - type (fld_list_type) :: fldsFrLnd(fldsMax) - integer, parameter :: gridTofieldMap = 2 ! ungridded dimension is innermost - - logical :: glc_present = .false. ! .true. => running with a non-stubGLC model - logical :: rof_prognostic = .false. ! .true. => running with a prognostic ROF model - ! from atm->lnd integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn @@ -522,39 +505,6 @@ end subroutine export_fields !=============================================================================== - subroutine fldlist_add(num, fldlist, stdname, ungridded_lbound, ungridded_ubound) - - ! input/output variables - integer, intent(inout) :: num - type(fld_list_type), intent(inout) :: fldlist(:) - character(len=*), intent(in) :: stdname - integer, optional, intent(in) :: ungridded_lbound - integer, optional, intent(in) :: ungridded_ubound - - ! local variables - integer :: rc - character(len=*), parameter :: subname='(lnd_import_export:fldlist_add)' - !------------------------------------------------------------------------------- - - ! Set up a list of field information - - num = num + 1 - if (num > fldsMax) then - call ESMF_LogWrite(trim(subname)//": ERROR num > fldsMax "//trim(stdname), & - ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__) - return - endif - fldlist(num)%stdname = trim(stdname) - - if (present(ungridded_lbound) .and. present(ungridded_ubound)) then - fldlist(num)%ungridded_lbound = ungridded_lbound - fldlist(num)%ungridded_ubound = ungridded_ubound - end if - - end subroutine fldlist_add - - !=============================================================================== - subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) ! ---------------------------------------------- @@ -570,20 +520,17 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) integer , intent(out) :: rc ! local variables - integer :: g, i,n - - integer :: fieldcount - - real(R8), pointer :: fldptr1d(:) - real(R8), pointer :: fldptr2d(:,:) - type(ESMF_StateItem_Flag) :: itemFlag - character(len=cs) :: cvalue + integer :: g, i,n + integer :: fieldcount + real(R8), pointer :: fldptr1d(:) + real(R8), pointer :: fldptr2d(:,:) + type(ESMF_StateItem_Flag) :: itemFlag + character(len=cs) :: cvalue + type (ESMF_FieldBundle) :: field + type(ESMF_Field) :: lfield + type (ESMF_FieldBundle) :: fieldBundle + logical :: isPresent character(len=*), parameter :: subname='(lnd_import_export:state_getimport)' - - type (ESMF_FieldBundle):: field - type(ESMF_Field) :: lfield - type (ESMF_FieldBundle):: fieldBundle - logical :: isPresent ! ---------------------------------------------- rc = ESMF_SUCCESS @@ -605,7 +552,6 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) ! Determine if fieldbundle exists in state call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - !call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) ! if fieldbundle exists then create output array - else do nothing if (itemflag /= ESMF_STATEITEM_NOTFOUND) then @@ -616,10 +562,6 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) call ESMF_LogWrite(subname//'c2l_fb found and now ... getting '//trim(fldname), ESMF_LOGMSG_INFO) call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - !call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=field, isPresent=isPresent, rc=rc) - !call ESMF_FieldBundleGet(fieldBundle,field=field, rc=rc) - !call ESMF_FieldBundleGet(fieldBundle, fieldCount=fieldCount, rc=rc) - ! Now for error checking we can put ... if (isPresent...) ! get field pointer @@ -637,17 +579,10 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) ! determine output array if (present(ungridded_index)) then - if (gridToFieldMap == 1) then - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr2d(n,ungridded_index) - end do - else if (gridToFieldMap == 2) then - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr2d(ungridded_index,n) - end do - end if + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + output(g) = fldptr2d(ungridded_index,n) + end do else do g = bounds%begg, bounds%endg n = g - bounds%begg + 1 @@ -725,24 +660,13 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index ! determine output array if (present(ungridded_index)) then - if (gridToFieldMap == 1) then - fldptr2d(:,ungridded_index) = 0._r8 - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - fldptr2d(n,ungridded_index) = input(g) - end do - if (present(minus)) then - fldptr2d(:,ungridded_index) = -fldptr2d(:,ungridded_index) - end if - else if (gridToFieldMap == 2) then - fldptr2d(ungridded_index,:) = 0._r8 - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - fldptr2d(ungridded_index,n) = input(g) - end do - if (present(minus)) then - fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) - end if + fldptr2d(ungridded_index,:) = 0._r8 + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + fldptr2d(ungridded_index,n) = input(g) + end do + if (present(minus)) then + fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) end if else fldptr1d(:) = 0._r8 From be7f7313b0e721a43e2e460abe4b79e77b377019 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 30 Nov 2019 18:35:47 -0700 Subject: [PATCH 0450/1973] new ctsm.config file to call ctsm's buildnml and updated README as well as Makefile --- lilac/atm_driver/Makefile | 13 +++---- lilac/atm_driver/README | 75 ++++++++++++++++++++++++++++++++++----- lilac/atm_driver/ctsm.cfg | 20 +++++++++++ 3 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 lilac/atm_driver/ctsm.cfg diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 58e9ea1fd0..220741e3a3 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -10,12 +10,13 @@ ESMFMKFILE = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.def ESMF_LIB_DIR = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default include $(ESMFMKFILE) -CASE_NAME = why01-g -CTSM_BLD_DIR = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf -MCT_LIB = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/lib -SHR_LIB = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -SHR_INC = /glade/scratch/mvertens/$(CASE_NAME)/bld/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -CTSM_INC = $(CTSM_BLD_DIR)/clm/obj +BLD_DIR = /glade/scratch/mvertens/test_lilac/bld + +CTSM_BLD_DIR = $(BLD_DIR)/intel/mpt/debug/nothreads/mct/mct/esmf +MCT_LIB = $(BLD_DIR)/intel/mpt/debug/nothreads/mct/lib +SHR_LIB = $(BLD_DIR)/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib +SHR_INC = $(BLD_DIR)/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ +CTSM_INC = $(CTSM_BLD_DIR)/clm/obj FFLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free diff --git a/lilac/atm_driver/README b/lilac/atm_driver/README index 09b9e0d255..25b7bc0a54 100644 --- a/lilac/atm_driver/README +++ b/lilac/atm_driver/README @@ -1,14 +1,73 @@ -assume the ctsm code base is checked out in $CTSM_ROOTDIR +1) to build ctsm and lilac (these are now built together in a single +library and linked as part of generating the executable) -- to customize the generated namelist - edit the file - > $CTSM_ROOTDIR/lilac_config/lnd_input.py + > cd ../../ + > git clone https://github.com/mvertens/ctsm.git + > cd ctsm + > git checkout mvertens/lilac_cap + > ./manage_externals/checkout_externals -v + > cd cime/scripts + > ./create_newcase --case /glade/scratch/mvertens/test_lilac --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver mct + > cd /glade/scratch/mvertens/test_lilac -- to create the ctsm namelist FROM THIS DIRECTORY: - > $CTSM_ROOTDIR/lilac_config/buildnml + > ./xmlchange USE_ESMF_LIB=TRUE + > ./xmlchange DEBUG=TRUE -- this will now create the files lnd_in, drv_flds_in, and clm.input_data_list in this directory - THIS ONLY NEEDS TO BE DONE ONCE - to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory + > remove the following lines from env_mach_specific: + esmf_libs + + esmf-7.1.0r-defio-mpi-g + + + esmf-7.1.0r-defio-mpi-O + + + esmf-7.1.0r-ncdfio-uni-g + + + esmf-7.1.0r-ncdfio-uni-O + + + > remove the string comp_interface="nuopc" from the following lines + + + + + > make the following changes + + /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libO/Linux.intel.64.mpt.default/esmf.mk to + /glade/work/turuncu/ESMF/8.0.0b50/lib/libO/Linux.intel.64.mpt.default/esmf.mk + /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libg/Linux.intel.64.mpt.default/esmf.mk to + /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk + + > set the following environment variables (***THIS IS CRITICAL to have the lilac code built as part of ctsm) + + export LILAC_MODE='on' + eport LILAC_SRC = (in this case ../lilac/lilac) + + > ./case.setup + > ./case.build + +2) To build the atm_driver executable on cheyenne - edit the Makefile to change BLD_DIR + + > make clean + > make atm_driver + +3) to generate the input namelists + + - to customize the generated namelist - edit the file ctsm.cfg (in this directory) + + - to create the ctsm namelist FROM THIS DIRECTORY: + assume the ctsm code base is checked out in $CTSM_ROOTDIR + > $CTSM_ROOTDIR/lilac_config/buildnml + + - this will now create the files lnd_in, drv_flds_in, and clm.input_data_list in this directory + THIS ONLY NEEDS TO BE DONE ONCE + to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory + +4) run the atm_driver on cheyenne + + > qsub cheyenne.sub diff --git a/lilac/atm_driver/ctsm.cfg b/lilac/atm_driver/ctsm.cfg new file mode 100644 index 0000000000..95764fb0bd --- /dev/null +++ b/lilac/atm_driver/ctsm.cfg @@ -0,0 +1,20 @@ +[buildnml_input] +clm_phys = clm5_0 +start_type = default +start_ymd = 20000101 +startfile_type = finidat +ignore = -ignore_ic_year +configuration = clm +structure = standard +ccsm_co2_ppmv = 367.0 +clm_co2_type = constant +clm_bldnml_opts = -bgc sp +use_case = 2000_control +lnd_tuning_mode = clm5_0_GSWP3v1 +spinup = off +gridmask = gx3v7 +lnd_grid = 4x5 +lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc +lnd_domain_path = /glade/p/cesmdata/cseg/inputdata/share/domains +din_loc_root = /glade/p/cesmdata/cseg/inputdata +clm_namelist_opts = "" From 9483cccda0220d0bdf97bf458dbe1c60d8263dcf Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 1 Dec 2019 09:29:03 -0700 Subject: [PATCH 0451/1973] bringing in lilac as an external to be easily built as part of the ctsm library --- Externals.cfg | 7 +++++ README.lilac | 75 ++++++++++++++++++++++++++++++++++++++++++++ cime_config/buildlib | 7 ++--- 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 README.lilac diff --git a/Externals.cfg b/Externals.cfg index 36775f16fe..41e2deb264 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -4,6 +4,13 @@ protocol = externals_only externals = Externals_CLM.cfg required = True +[lilac] +local_path = . +protocol = git +repo_url = https://github.com/NCAR/lilac.git +branch = master +required = True + [cism] local_path = components/cism protocol = git diff --git a/README.lilac b/README.lilac new file mode 100644 index 0000000000..6473f603e6 --- /dev/null +++ b/README.lilac @@ -0,0 +1,75 @@ +1) set the following environment variables (***THIS IS CRITICAL to have the lilac code built as part of ctsm) + > export LILAC_MODE='on' + + +2) check out the code (ctsm and lilac are now bundled together) and built as one library + + SRC_ROOT is where tsm is checked out + + > git clone https://github.com/mvertens/ctsm.git + > cd ctsm (this is $SRCROOT) + > git checkout mvertens/lilac_cap + > ./manage_externals/checkout_externals -v + +3) build the ctsm/lilac library using a CIME case + + > cd $SRCROOT/cime/scripts + > ./create_newcase --case /glade/scratch/mvertens/test_lilac --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver mct + + > cd /glade/scratch/mvertens/test_lilac + > ./xmlchange USE_ESMF_LIB=TRUE + > ./xmlchange DEBUG=TRUE + + > remove the following lines from env_mach_specific: + + esmf_libs + + esmf-7.1.0r-defio-mpi-g + + + esmf-7.1.0r-defio-mpi-O + + + esmf-7.1.0r-ncdfio-uni-g + + + esmf-7.1.0r-ncdfio-uni-O + + + > remove the string comp_interface="nuopc" from the following lines + + + + + > make the following changes + + /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libO/Linux.intel.64.mpt.default/esmf.mk to + /glade/work/turuncu/ESMF/8.0.0b50/lib/libO/Linux.intel.64.mpt.default/esmf.mk + /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libg/Linux.intel.64.mpt.default/esmf.mk to + /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk + + > ./case.setup + > ./case.build + +4) To build the atm_driver executable on cheyenne - edit the Makefile to change BLD_DIR + + > cd $SRCROOT/lilac/atm_driver + > make clean + > make atm_driver + +4) to generate the input namelists + + - to customize the generated namelist - edit the file ctsm.cfg (in this directory) + - to create the ctsm namelist FROM THIS DIRECTORY: + + > $SRC_ROOT/lilac_config/buildnml + + - this will now create the files lnd_in, drv_flds_in, and clm.input_data_list in this directory + THIS ONLY NEEDS TO BE DONE ONCE + to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory + +5) run the atm_driver on cheyenne + + > qsub cheyenne.sub + + diff --git a/cime_config/buildlib b/cime_config/buildlib index 9493767c0c..6b23d23b11 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -43,10 +43,9 @@ def _main_func(): gmake = case.get_value("GMAKE") lilac_mode = _get_osvar('LILAC_MODE', 'off') - print "DEBUG: lilac_mode is ",lilac_mode if lilac_mode == 'on': - lilac_src = _get_osvar('LILAC_SRC', None) - expect(lilac_src, "environment variable LILAC_SRC must be set") + ctsm_root = case.get_value("SRCROOT") + lilac_src = os.path.join(ctsm_root,"lilac","lilac") #------------------------------------------------------- # create Filepath file @@ -72,8 +71,8 @@ def _main_func(): if lilac_mode == 'off': paths.append(os.path.join(lnd_root,"src","cpl","mct")) else: - paths.append(os.path.join(lnd_root,"src","cpl","lilac")) paths.append(lilac_src) + paths.append(os.path.join(lnd_root,"src","cpl","lilac")) with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) From 43a7b78946126326c1becbec8214944cf553b301 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 1 Dec 2019 10:23:52 -0700 Subject: [PATCH 0452/1973] moved lilac/ directory to src/ --- lilac/atm_driver/README | 38 +++++++++++++----------- lilac/{lilac => src}/.gitignore | 0 lilac/{lilac => src}/lilac_atmcap.F90 | 0 lilac/{lilac => src}/lilac_constants.F90 | 0 lilac/{lilac => src}/lilac_cpl.F90 | 10 +++++-- lilac/{lilac => src}/lilac_fields.F90 | 1 + lilac/{lilac => src}/lilac_history.F90 | 0 lilac/{lilac => src}/lilac_io.F90 | 0 lilac/{lilac => src}/lilac_methods.F90 | 0 lilac/{lilac => src}/lilac_mod.F90 | 0 lilac/{lilac => src}/lilac_time.F90 | 0 lilac/{lilac => src}/lilac_utils.F90 | 0 12 files changed, 29 insertions(+), 20 deletions(-) rename lilac/{lilac => src}/.gitignore (100%) rename lilac/{lilac => src}/lilac_atmcap.F90 (100%) rename lilac/{lilac => src}/lilac_constants.F90 (100%) rename lilac/{lilac => src}/lilac_cpl.F90 (98%) rename lilac/{lilac => src}/lilac_fields.F90 (97%) rename lilac/{lilac => src}/lilac_history.F90 (100%) rename lilac/{lilac => src}/lilac_io.F90 (100%) rename lilac/{lilac => src}/lilac_methods.F90 (100%) rename lilac/{lilac => src}/lilac_mod.F90 (100%) rename lilac/{lilac => src}/lilac_time.F90 (100%) rename lilac/{lilac => src}/lilac_utils.F90 (100%) diff --git a/lilac/atm_driver/README b/lilac/atm_driver/README index 25b7bc0a54..6473f603e6 100644 --- a/lilac/atm_driver/README +++ b/lilac/atm_driver/README @@ -1,15 +1,22 @@ -1) to build ctsm and lilac (these are now built together in a single -library and linked as part of generating the executable) +1) set the following environment variables (***THIS IS CRITICAL to have the lilac code built as part of ctsm) + > export LILAC_MODE='on' + + +2) check out the code (ctsm and lilac are now bundled together) and built as one library + + SRC_ROOT is where tsm is checked out - > cd ../../ > git clone https://github.com/mvertens/ctsm.git - > cd ctsm + > cd ctsm (this is $SRCROOT) > git checkout mvertens/lilac_cap > ./manage_externals/checkout_externals -v - > cd cime/scripts + +3) build the ctsm/lilac library using a CIME case + + > cd $SRCROOT/cime/scripts > ./create_newcase --case /glade/scratch/mvertens/test_lilac --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver mct - > cd /glade/scratch/mvertens/test_lilac + > cd /glade/scratch/mvertens/test_lilac > ./xmlchange USE_ESMF_LIB=TRUE > ./xmlchange DEBUG=TRUE @@ -34,39 +41,34 @@ library and linked as part of generating the executable) - > make the following changes + > make the following changes /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libO/Linux.intel.64.mpt.default/esmf.mk to /glade/work/turuncu/ESMF/8.0.0b50/lib/libO/Linux.intel.64.mpt.default/esmf.mk /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libg/Linux.intel.64.mpt.default/esmf.mk to /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk - > set the following environment variables (***THIS IS CRITICAL to have the lilac code built as part of ctsm) - - export LILAC_MODE='on' - eport LILAC_SRC = (in this case ../lilac/lilac) - > ./case.setup > ./case.build -2) To build the atm_driver executable on cheyenne - edit the Makefile to change BLD_DIR +4) To build the atm_driver executable on cheyenne - edit the Makefile to change BLD_DIR + > cd $SRCROOT/lilac/atm_driver > make clean > make atm_driver -3) to generate the input namelists +4) to generate the input namelists - to customize the generated namelist - edit the file ctsm.cfg (in this directory) - - to create the ctsm namelist FROM THIS DIRECTORY: - assume the ctsm code base is checked out in $CTSM_ROOTDIR - > $CTSM_ROOTDIR/lilac_config/buildnml + + > $SRC_ROOT/lilac_config/buildnml - this will now create the files lnd_in, drv_flds_in, and clm.input_data_list in this directory THIS ONLY NEEDS TO BE DONE ONCE to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory -4) run the atm_driver on cheyenne +5) run the atm_driver on cheyenne > qsub cheyenne.sub diff --git a/lilac/lilac/.gitignore b/lilac/src/.gitignore similarity index 100% rename from lilac/lilac/.gitignore rename to lilac/src/.gitignore diff --git a/lilac/lilac/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 similarity index 100% rename from lilac/lilac/lilac_atmcap.F90 rename to lilac/src/lilac_atmcap.F90 diff --git a/lilac/lilac/lilac_constants.F90 b/lilac/src/lilac_constants.F90 similarity index 100% rename from lilac/lilac/lilac_constants.F90 rename to lilac/src/lilac_constants.F90 diff --git a/lilac/lilac/lilac_cpl.F90 b/lilac/src/lilac_cpl.F90 similarity index 98% rename from lilac/lilac/lilac_cpl.F90 rename to lilac/src/lilac_cpl.F90 index c28de3c7e3..1414c86528 100644 --- a/lilac/lilac/lilac_cpl.F90 +++ b/lilac/src/lilac_cpl.F90 @@ -7,6 +7,8 @@ module lilac_cpl !----------------------------------------------------------------------- use ESMF + use shr_sys_mod, only : shr_sys_abort + implicit none private @@ -157,7 +159,9 @@ subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) end if call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort('error in initializing cpl_atm2lnd') + end if call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) @@ -227,7 +231,9 @@ subroutine cpl_lnd2atm_init(cplcomp, importState, exportState, clock, rc) end if call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call shr_sys_abort('error in initializing cpl_lnd2atm') + end if call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) diff --git a/lilac/lilac/lilac_fields.F90 b/lilac/src/lilac_fields.F90 similarity index 97% rename from lilac/lilac/lilac_fields.F90 rename to lilac/src/lilac_fields.F90 index c31f41a120..355e6f9a88 100644 --- a/lilac/lilac/lilac_fields.F90 +++ b/lilac/src/lilac_fields.F90 @@ -29,6 +29,7 @@ subroutine lilac_field_bundle_to_land(mesh, fieldbundle, rc) ! Add empty fields to field bundle do n = 1, size(atm2lnd) + write(6,*)'DEBUG: ',n, trim(atm2lnd(n)%fldname) call fldbundle_add(trim(atm2lnd(n)%fldname), mesh, fieldbundle, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do diff --git a/lilac/lilac/lilac_history.F90 b/lilac/src/lilac_history.F90 similarity index 100% rename from lilac/lilac/lilac_history.F90 rename to lilac/src/lilac_history.F90 diff --git a/lilac/lilac/lilac_io.F90 b/lilac/src/lilac_io.F90 similarity index 100% rename from lilac/lilac/lilac_io.F90 rename to lilac/src/lilac_io.F90 diff --git a/lilac/lilac/lilac_methods.F90 b/lilac/src/lilac_methods.F90 similarity index 100% rename from lilac/lilac/lilac_methods.F90 rename to lilac/src/lilac_methods.F90 diff --git a/lilac/lilac/lilac_mod.F90 b/lilac/src/lilac_mod.F90 similarity index 100% rename from lilac/lilac/lilac_mod.F90 rename to lilac/src/lilac_mod.F90 diff --git a/lilac/lilac/lilac_time.F90 b/lilac/src/lilac_time.F90 similarity index 100% rename from lilac/lilac/lilac_time.F90 rename to lilac/src/lilac_time.F90 diff --git a/lilac/lilac/lilac_utils.F90 b/lilac/src/lilac_utils.F90 similarity index 100% rename from lilac/lilac/lilac_utils.F90 rename to lilac/src/lilac_utils.F90 From c0c0e80d9aa5662762996d9a7dcb48ce1eceb440 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 1 Dec 2019 10:34:10 -0700 Subject: [PATCH 0453/1973] cleanup of minor problems --- README.lilac | 57 +++++++-------- cime_config/buildlib | 2 +- src/cpl/lilac/lnd_comp_esmf.F90 | 123 ++++++++++++++------------------ 3 files changed, 77 insertions(+), 105 deletions(-) diff --git a/README.lilac b/README.lilac index 6473f603e6..615ca71149 100644 --- a/README.lilac +++ b/README.lilac @@ -1,10 +1,9 @@ 1) set the following environment variables (***THIS IS CRITICAL to have the lilac code built as part of ctsm) > export LILAC_MODE='on' - 2) check out the code (ctsm and lilac are now bundled together) and built as one library - SRC_ROOT is where tsm is checked out + SRC_ROOT is where ctsm is checked out > git clone https://github.com/mvertens/ctsm.git > cd ctsm (this is $SRCROOT) @@ -15,41 +14,33 @@ > cd $SRCROOT/cime/scripts > ./create_newcase --case /glade/scratch/mvertens/test_lilac --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver mct - > cd /glade/scratch/mvertens/test_lilac > ./xmlchange USE_ESMF_LIB=TRUE > ./xmlchange DEBUG=TRUE - > remove the following lines from env_mach_specific: - - esmf_libs - - esmf-7.1.0r-defio-mpi-g - - - esmf-7.1.0r-defio-mpi-O - - - esmf-7.1.0r-ncdfio-uni-g - - - esmf-7.1.0r-ncdfio-uni-O - - - > remove the string comp_interface="nuopc" from the following lines - - - - - > make the following changes - - /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libO/Linux.intel.64.mpt.default/esmf.mk to - /glade/work/turuncu/ESMF/8.0.0b50/lib/libO/Linux.intel.64.mpt.default/esmf.mk - /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libg/Linux.intel.64.mpt.default/esmf.mk to - /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk - - > ./case.setup - > ./case.build + esmf_libs + + esmf-7.1.0r-defio-mpi-g + + + esmf-7.1.0r-defio-mpi-O + + + esmf-7.1.0r-ncdfio-uni-g + + + esmf-7.1.0r-ncdfio-uni-O + + > remove the string comp_interface="nuopc" from the following lines + + + > make the following changes + /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libO/Linux.intel.64.mpt.default/esmf.mk to + /glade/work/turuncu/ESMF/8.0.0b50/lib/libO/Linux.intel.64.mpt.default/esmf.mk + /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libg/Linux.intel.64.mpt.default/esmf.mk to + /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk + > ./case.setup + > ./case.build 4) To build the atm_driver executable on cheyenne - edit the Makefile to change BLD_DIR diff --git a/cime_config/buildlib b/cime_config/buildlib index 6b23d23b11..55c5254c8d 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -45,7 +45,7 @@ def _main_func(): lilac_mode = _get_osvar('LILAC_MODE', 'off') if lilac_mode == 'on': ctsm_root = case.get_value("SRCROOT") - lilac_src = os.path.join(ctsm_root,"lilac","lilac") + lilac_src = os.path.join(ctsm_root,"lilac","src") #------------------------------------------------------- # create Filepath file diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 96846d3d1f..c66e02d4f8 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -10,6 +10,7 @@ module lnd_comp_esmf use mpi , only : MPI_BCAST, MPI_CHARACTER use mct_mod , only : mct_world_init use perf_mod , only : t_startf, t_stopf, t_barrierf + use lilac_fields , only : lilac_field_bundle_to_land, lilac_field_bundle_from_land ! cime share code use shr_pio_mod , only : shr_pio_init2 @@ -414,88 +415,68 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Create import state (only assume input from atm - not rof and glc) !-------------------------------- - ! First create an empty field bundle + ! NOTE: currently this must be the same list as in lilac_init_atm2lnd + + ! create an empty field bundle c2l_fb = ESMF_FieldBundleCreate ( name='c2l_fb', rc=rc) - ! Now add fields on lnd_mesh to this field bundle - call fldbundle_add( 'Sa_z' , c2l_fb,rc) !1 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_topo' , c2l_fb,rc) !2 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_u' , c2l_fb,rc) !3 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_v' , c2l_fb,rc) !4 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) !5 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) !6 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) !7 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_shum' , c2l_fb,rc) !8 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) !9 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) !10 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) !11 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) !12 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) !13 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) !14 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) !15 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) !16 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) !17 - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call lilac_field_bundle_to_land(lnd_mesh, c2l_fb, rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/), rc=rc) + ! Now add fields on lnd_mesh to this field bundle + call fldbundle_add( 'Sa_z' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_topo' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_u' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_v' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_shum' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! add the field bundle to the export state + call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/)) !-------------------------------- ! Create export state !-------------------------------- - ! First create an empty field bundle + ! NOTE: currently this must be the same list as in lilac_init_lnd2atm + + ! Create an empty field bundle l2c_fb = ESMF_FieldBundleCreate(name='l2c_fb', rc=rc) - ! Now add fields on lnd_mesh to this field bundle - call fldbundle_add( 'Sl_lfrin' , l2c_fb,rc) !1 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_t' , l2c_fb,rc) !2 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_tref' , l2c_fb,rc) !3 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_qref' , l2c_fb,rc) !4 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_avsdr' , l2c_fb,rc) !5 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_anidr' , l2c_fb,rc) !6 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_avsdf' , l2c_fb,rc) !7 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_anidf' , l2c_fb,rc) !8 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_snowh' , l2c_fb,rc) !9 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_u10' , l2c_fb,rc) !10 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_fv' , l2c_fb,rc) !11 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_ram1' , l2c_fb,rc) !12 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call fldbundle_add( 'Fall_taux' , l2c_fb,rc) !10 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call fldbundle_add( 'Fall_lwup' , l2c_fb,rc) !14 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call fldbundle_add( 'Fall_evap' , l2c_fb,rc) !15 - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call fldbundle_add( 'Fall_swnet' , l2c_fb,rc) !16 - if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call lilac_field_bundle_from_land(lnd_mesh, l2c_fb, rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Now add fields on lnd_mesh to this field bundle + call fldbundle_add( 'Sl_lfrin' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sl_t' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sl_tref' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sl_qref' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sl_avsdr' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sl_anidr' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sl_avsdf' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sl_anidf' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sl_snowh' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_u10' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_fv' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_ram1' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_lwup' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_taux' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_tauy' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_evap' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Fall_swnet' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Add the field bundle to the state call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb/), rc=rc) !-------------------------------- From ab9f287d4e7f6fac5b2dcbdf7fe3329041ed8067 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 1 Dec 2019 11:23:33 -0700 Subject: [PATCH 0454/1973] fixed buildlib problems and added nuopc driver for future capability --- .gitignore | 1 + Externals.cfg | 3 ++- Externals_cime.cfg | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 Externals_cime.cfg diff --git a/.gitignore b/.gitignore index 4a5672d970..9a16cf5eb1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ manage_externals.log /tools/PTCLM/ /cime/ /components/ +/lilac # ignore svn directories **/.svn/** diff --git a/Externals.cfg b/Externals.cfg index 41e2deb264..72d1e54b5c 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -5,7 +5,7 @@ externals = Externals_CLM.cfg required = True [lilac] -local_path = . +local_path = lilac protocol = git repo_url = https://github.com/NCAR/lilac.git branch = master @@ -38,6 +38,7 @@ local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime tag = branch_tags/cime5.8.3_chint17-05 +externals = ../Externals_cime.cfg required = True [externals_description] diff --git a/Externals_cime.cfg b/Externals_cime.cfg new file mode 100644 index 0000000000..d4e79f0364 --- /dev/null +++ b/Externals_cime.cfg @@ -0,0 +1,9 @@ +[cmeps] +tag = 181ff1e +protocol = git +repo_url = https://github.com/ESCOMP/CMEPS.git +local_path = src/drivers/nuopc/ +required = True + +[externals_description] +schema_version = 1.0.0 From 21984974ee94f1df14b8f1da957e5feb2ae9c4e6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 1 Dec 2019 11:30:11 -0700 Subject: [PATCH 0455/1973] bug fix --- lilac_config/buildnml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 9f0e0e82b0..6cbaa419c1 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -224,10 +224,6 @@ def buildnml(rundir, bldnmldir): if rc > 0: raise Exception("Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) - # remove temporary files in bldnmldir - os.remove(os.path.join(bldnmldir, "lnd_in")) - os.remove(os.path.join(bldnmldir, "clm.input_data_list")) - # remove temporary files in rundir os.remove(os.path.join(rundir, "config_cache.xml")) os.remove(os.path.join(rundir, "env_lilac.xml")) From 7757b05499f74d5944e726d0028d41cbbf622143 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 1 Dec 2019 14:32:34 -0700 Subject: [PATCH 0456/1973] updates for new stream capability --- lilac/src/lilac_atmaero.F90 | 237 ++++++++++++++++++++++++++++++++++++ lilac/src/lilac_mod.F90 | 7 ++ 2 files changed, 244 insertions(+) create mode 100644 lilac/src/lilac_atmaero.F90 diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 new file mode 100644 index 0000000000..df5741a8a2 --- /dev/null +++ b/lilac/src/lilac_atmaero.F90 @@ -0,0 +1,237 @@ +module lilac_atmaero + + !----------------------------------------------------------------------- + ! Contains methods for reading in atmosphere aerosal data + ! This will be done on the CTSM grid with the CTSM decomposition + ! (after the redistribution from atm-> lnd) + !----------------------------------------------------------------------- + + use ESMF + + ! share code uses + use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_cl, CS => shr_kind_cs + use shr_sys_mod , only : shr_sys_abort + use shr_nl_mod , only : shr_nl_find_group_name + use shr_log_mod , only : shr_log_errMsg + use shr_mpi_mod , only : shr_mpi_bcast + use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create + use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance + use shr_cal_mod , only : shr_cal_ymd2date + use shr_pio_mod , only : shr_pio_getiotype + use mct_mod , only : mct_avect_indexra, mct_ggrid + + ! ctsm uses + use ncdio_pio , only : pio_subsystem + use decompMod , only : bounds_type, get_proc_bounds, gsmap_lnd_gdc2glo + use domainMod , only : ldomain + use spmdMod , only : mpicom, masterproc, comp_id + use ndepStreamMod , only : clm_domain_mct + use clm_time_manager , only : get_calendar + + ! lilac share + use lilac_methods , only : chkerr + + implicit none + private + + public :: lilac_atmaero_init ! initialize stream data type sdat + public :: lilac_atmaero_interp ! interpolates between two years of ndep file data + + ! module data + type(shr_strdata_type) :: sdat ! input data stream + + character(*),parameter :: u_file_u = & + __FILE__ + +!============================================================================== +contains +!============================================================================== + + subroutine lilac_atmaero_init() + + ! ---------------------------------------- + ! Initialize data stream information. + ! ---------------------------------------- + + ! local variables + integer :: nunit + integer :: ierr ! namelist i/o error flag + type(mct_ggrid) :: domain_mct ! domain information + character(len=cl) :: stream_fldfilename_atmaero ! name of input stream file + character(len=CL) :: mapalgo = 'bilinear' ! type of 2d mapping + character(len=CS) :: taxmode = 'extend' ! time extrapolation + character(len=CL) :: fldlistFile ! name of fields in input stream file + character(len=CL) :: fldlistModel ! name of fields in data stream code + integer :: stream_year_first_atmaero ! first year in stream to use + integer :: stream_year_last_atmaero ! last year in stream to use + integer :: model_year_align_atmaero ! align stream_year_first with model year + type(bounds_type) :: bounds + !----------------------------------------------------------------------- + + namelist /atmaero_stream/ & + stream_year_first_atmaero, & + stream_year_last_atmaero, & + model_year_align_atmaero, & + stream_fldfilename_atmaero + + ! default values for namelist + stream_year_first_atmaero = 1 ! first year in stream to use + stream_year_last_atmaero = 1 ! last year in stream to use + model_year_align_atmaero = 1 ! align stream_year_first_atmaero with this model year + stream_fldFileName_atmaero = ' ' + + ! Read namelist + if (masterproc) then + open(newunit=nunit, file='lilac_in', status='old', iostat=ierr ) + call shr_nl_find_group_name(nunit, 'atmaero_stream', status=ierr) + if (ierr == 0) then + read(nunit, atmaero_stream, iostat=ierr) + if (ierr /= 0) then + call shr_sys_abort(' ERROR reading namelist '//shr_log_errMsg(u_file_u, __LINE__)) + end if + else + call shr_sys_abort(' ERROR finding namelist '//shr_log_errMsg(u_file_u, __LINE__)) + end if + close(nunit) + endif + + call shr_mpi_bcast(stream_year_first_atmaero , mpicom) + call shr_mpi_bcast(stream_year_last_atmaero , mpicom) + call shr_mpi_bcast(model_year_align_atmaero , mpicom) + call shr_mpi_bcast(stream_fldfilename_atmaero, mpicom) + + if (masterproc) then + print *, ' ' + print *, 'atmaero stream settings:' + print *, ' stream_year_first_atmaero = ',stream_year_first_atmaero + print *, ' stream_year_last_atmaero = ',stream_year_last_atmaero + print *, ' model_year_align_atmaero = ',model_year_align_atmaero + print *, ' stream_fldFileName_atmaero = ',stream_fldFileName_atmaero + print *, ' ' + endif + + ! Create the mct domain + call get_proc_bounds(bounds) + call clm_domain_mct (bounds, domain_mct) + + ! Create the field list for these urbantv fields...use in shr_strdata_create + fldlistFile = 'BCDEPWET:BCPHODRY:BCPHIDRY:' + fldlistFile = trim(fldlistFile) // 'OCDEPWET:OCPHIDRY:OCPHODRY:DSTX01WD:' + fldlistFile = trim(fldlistFile) // 'DSTX01DD:DSTX02WD:DSTX02DD:DSTX03WD:' + fldlistFile = trim(fldlistFile) // 'DSTX03DD:DSTX04WD:DSTX04DD' + + fldlistModel = 'bcphiwet:bcphodry:bcphidry:' + fldlistModel = trim(fldlistModel) // 'ocphiwet:ocphidry:ocphodry:' + fldlistModel = trim(fldlistModel) // 'dstwet1:dstdry1:dstwet2:dstdry2' + fldlistModel = trim(fldlistModel) // 'dstwet3:dstdry3:dstwet4:dstdry4' + + call shr_strdata_create(sdat,& + name = "atmaero", & + pio_subsystem = pio_subsystem, & + pio_iotype = shr_pio_getiotype(compid= 1), & + mpicom = mpicom, & + compid = comp_id, & + gsmap = gsmap_lnd_gdc2glo, & + ggrid = domain_mct, & + nxg = ldomain%ni, & + nyg = ldomain%nj, & + yearFirst = stream_year_first_atmaero, & + yearLast = stream_year_last_atmaero, & + yearAlign = model_year_align_atmaero, & + offset = 0, & + domFilePath = '', & + domfilename = trim(stream_fldfilename_atmaero), & + domTvarName = 'time', & + domXvarName = 'lon' , & + domYvarName = 'lat' , & + domAreaName = 'area', & + domMaskName = 'mask', & + filePath = '', & + filename = (/trim(stream_fldfilename_atmaero)/), & + fldListFile = trim(fldlistFile), & + fldListModel = trim(fldlistModel), & + fillalgo = 'none', & + mapalgo = mapalgo, & + calendar = get_calendar(), & + taxmode = taxmode ) + + if (masterproc) then + call shr_strdata_print(sdat,'ATMAERO data') + endif + + end subroutine lilac_atmaero_init + + !================================================================ + + subroutine lilac_atmaero_interp(c2l_fb, clock, rc) + + ! input/output variables + type(ESMF_FieldBundle) :: c2l_fb + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + type(ESMF_Time) :: currTime + integer :: yy, mm, dd, sec, curr_ymd + !----------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_ClockGet( clock, currTime=currTime, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=sec, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_cal_ymd2date(yy,mm,dd,curr_ymd) + + call shr_strdata_advance(sdat, curr_ymd, sec, mpicom, 'atmaero') + + ! Set field bundle data + call set_fieldbundle_data('Faxa_bcphidry' , c2l_fb, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_bcphodry' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_bcphiwet' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_ocphidry' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_ocphodry' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_ocphiwet' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstwet1' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstdry1' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstwet2' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstdry2' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstwet3' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstdry3' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstwet4' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstdry4' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine lilac_atmaero_interp + + !============================================================================== + + subroutine set_fieldbundle_data(fldname, fieldbundle, rc) + + ! input/output data + character(len=*) , intent(in) :: fldname + type(ESMF_FieldBundle) , intent(inout) :: fieldbundle + integer , intent(out) :: rc + + ! local data + type(ESMF_field) :: lfield + integer :: n, nfld, indx + real(r8), pointer :: fldptr1d(:) + !----------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_FieldBundleGet(fieldBundle, fieldName=trim(fldname), field=lfield, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + nfld = mct_avect_indexra(sdat%avs(1),trim(fldname)) + do indx = 1, size(fldptr1d) + fldptr1d(n)= sdat%avs(1)%rAttr(nfld,indx) + end do + + end subroutine set_fieldbundle_data + +end module lilac_atmaero diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index b3febbfae7..ec3f43c320 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -54,6 +54,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register use lilac_atmcap , only : lilac_atmos_register use lnd_comp_esmf , only : lnd_register !ctsm routine + use lilac_atmaero , only : lilac_atmaero_init use shr_pio_mod , only : shr_pio_init1 use shr_sys_mod , only : shr_sys_abort @@ -332,6 +333,12 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & call lilac_io_init() call ESMF_LogWrite(subname//"initialized lilac_io ...", ESMF_LOGMSG_INFO) + !------------------------------------------------------------------------- + ! Initialize atmaero stream data (using share strearm capability from CIME) + !------------------------------------------------------------------------- + + call lilac_atmaero_init() + end subroutine lilac_init !======================================================================== From aa296fc3b00fd39b5586d2cf48aad7cd2a600717 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 1 Dec 2019 14:33:14 -0700 Subject: [PATCH 0457/1973] new stream capability in lilac_in --- lilac_config/lilac_in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lilac_config/lilac_in b/lilac_config/lilac_in index 6b217cc324..198c8aea6e 100644 --- a/lilac_config/lilac_in +++ b/lilac_config/lilac_in @@ -1,6 +1,11 @@ &lnd_mesh_inparm lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' / +&atmaero_stream + stream_fldfilename_atmaero='/glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc' + stream_year_first_atmaero = 2000 + stream_year_last_atmaero = 2000 +/ &papi_inparm papi_ctr1_str = "PAPI_FP_OPS" papi_ctr2_str = "PAPI_NO_CTR" From 64a5ac9abfb6efed3b7a67fd313b950ec1629d75 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 2 Dec 2019 16:24:46 -0700 Subject: [PATCH 0458/1973] receiving prescribed aerosols from lilac --- src/cpl/lilac/lnd_comp_esmf.F90 | 55 +++++--- src/cpl/lilac/lnd_import_export.F90 | 193 ++++++++++++---------------- 2 files changed, 115 insertions(+), 133 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index c66e02d4f8..6e4628a82e 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -10,7 +10,7 @@ module lnd_comp_esmf use mpi , only : MPI_BCAST, MPI_CHARACTER use mct_mod , only : mct_world_init use perf_mod , only : t_startf, t_stopf, t_barrierf - use lilac_fields , only : lilac_field_bundle_to_land, lilac_field_bundle_from_land + use lilac_fields , only : lilac_field_bundle_to_land, lilac_field_bundle_from_land ! cime share code use shr_pio_mod , only : shr_pio_init2 @@ -158,8 +158,8 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! for pio_init2 and mct type(ESMF_VM) :: vm - integer :: mpicom_vm - integer :: ncomps = 1 ! for mct + integer :: mpicom_vm + integer :: ncomps = 1 ! for mct integer, pointer :: mycomms(:) ! for mct integer, pointer :: myids(:) ! for mct integer :: compids(1) = (/1/) ! for both mct and pio_init2 - array with component ids @@ -424,23 +424,38 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Now add fields on lnd_mesh to this field bundle - call fldbundle_add( 'Sa_z' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_topo' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_u' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_v' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_shum' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_z' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_topo' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_u' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_v' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Sa_shum' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call fldbundle_add( 'Faxa_bcphidry' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_bcphodry' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_bcphiwet' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_ocphidry' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_ocphodry' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_ocphiwet' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_dstwet1' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_dstdry1' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_dstwet2' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_dstdry2' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_dstwet3' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_dstdry3' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_dstwet4' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add( 'Faxa_dstdry4' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return ! add the field bundle to the export state call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/)) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index e310dbd4c8..0510eeff56 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -53,7 +53,7 @@ module lnd_import_export subroutine import_fields( gcomp, bounds, rc) !--------------------------------------------------------------------------- - ! Convert the input data from the mediator to the land model + ! Convert the input data from the lilac to the land model !--------------------------------------------------------------------------- ! input/output variabes @@ -176,69 +176,45 @@ subroutine import_fields( gcomp, bounds, rc) ! ! Atmosphere prognostic/prescribed aerosol fields - ! ! bcphidry - ! call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,1), & - ! ungridded_index=1, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! bcphodry - ! call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,2), & - ! ungridded_index=2, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! bcphiwet - ! call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,3), & - ! ungridded_index=3, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! ! ocphidry - ! call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,4), & - ! ungridded_index=1, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! bcphodry - ! call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,5), & - ! ungridded_index=2, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! bcphiwet - ! call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,6), & - ! ungridded_index=3, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,7), & - ! ungridded_index=1, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,8), & - ! ungridded_index=1, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,9), & - ! ungridded_index=2, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,10), & - ! ungridded_index=2, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_bcphidry', bounds, output=atm2lnd_inst%forc_aer_grc(:,1), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_bcphodry', bounds, output=atm2lnd_inst%forc_aer_grc(:,2), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_bcphiwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,3), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,11), & - ! ungridded_index=3, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,12), & - ! ungridded_index=3, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_ocphidry', bounds, output=atm2lnd_inst%forc_aer_grc(:,4), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_ocphodry', bounds, output=atm2lnd_inst%forc_aer_grc(:,5), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_ocphiwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,6), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,13), & - ! ungridded_index=4, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,14), & - ! ungridded_index=4, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_dstwet1', bounds, output=atm2lnd_inst%forc_aer_grc(:,7), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_dstdry1', bounds, output=atm2lnd_inst%forc_aer_grc(:,8), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_dstwet2', bounds, output=atm2lnd_inst%forc_aer_grc(:,9), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_dstdry2', bounds, output=atm2lnd_inst%forc_aer_grc(:,10), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_dstwet3', bounds, output=atm2lnd_inst%forc_aer_grc(:,11), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_dstdry3', bounds, output=atm2lnd_inst%forc_aer_grc(:,12), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_dstwet4', bounds, output=atm2lnd_inst%forc_aer_grc(:,13), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport(importState, 'Faxa_dstdry4', bounds, output=atm2lnd_inst%forc_aer_grc(:,14), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! call state_getimport(importState, 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! The mediator is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec - ! ! so the following conversion needs to happen - - ! call state_getimport(importState, 'Faxa_nhx', bounds, output=forc_nhx, ungridded_index=1, rc=rc ) + ! The lilac is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec + ! so the following conversion needs to happen + ! call state_getimport(importState, 'Faxa_nhx', bounds, output=forc_nhx, rc=rc ) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Faxa_noy', bounds, output=forc_noy, ungridded_index=2, rc=rc ) + ! call state_getimport(importState, 'Faxa_noy', bounds, output=forc_noy, rc=rc ) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! do g = begg,endg ! atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 @@ -359,16 +335,12 @@ subroutine export_fields(gcomp, bounds, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ----------------------- - ! output to mediator + ! output to atm ! ----------------------- call state_setexport(exportState, 'Sl_lfrin', bounds, input=ldomain%frac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ----------------------- - ! output to atm - ! ----------------------- - call state_setexport(exportState, 'Sl_t', bounds, input=lnd2atm_inst%t_rad_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -417,20 +389,13 @@ subroutine export_fields(gcomp, bounds, rc) call state_setexport(exportState, 'Fall_swnet', bounds, input=lnd2atm_inst%fsa_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,1), & - minus=.true., ungridded_index=1, rc=rc) + call state_setexport(exportState, 'Fall_flxdst1', bounds, input=lnd2atm_inst%flxdst_grc(:,1), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,2), & - minus=.true., ungridded_index=2, rc=rc) + call state_setexport(exportState, 'Fall_flxdst2', bounds, input=lnd2atm_inst%flxdst_grc(:,2), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,3), & - minus=.true., ungridded_index=3, rc=rc) + call state_setexport(exportState, 'Fall_flxdst3', bounds, input=lnd2atm_inst%flxdst_grc(:,3), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,4), & - minus=.true., ungridded_index=4, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_methane', bounds, input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'Fall_flxdst4', bounds, input=lnd2atm_inst%flxdst_grc(:,4), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_setexport(exportState, 'Sl_ram1', bounds, input=lnd2atm_inst%ram1_grc, rc=rc) @@ -439,33 +404,35 @@ subroutine export_fields(gcomp, bounds, rc) call state_setexport(exportState, 'Sl_fv', bounds, input=lnd2atm_inst%fv_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_soilw', bounds, input=water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! methanem + ! call state_setexport(exportState, 'Fall_methane', bounds, input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! soil water + ! call state_setexport(exportState, 'Sl_soilw', bounds, input=water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! dry dep velocities - do num = 1, drydep_nflds - call state_setexport(exportState, 'Sl_ddvel', bounds, input=lnd2atm_inst%ddvel_grc(:,num), & - ungridded_index=num, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do + ! do num = 1, drydep_nflds + ! call state_setexport(exportState, 'Sl_ddvel', bounds, input=lnd2atm_inst%ddvel_grc(:,num), ungridded_index=num, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! end do ! MEGAN VOC emis fluxes - do num = 1, shr_megan_mechcomps_n - call state_setexport(exportState, 'Fall_voc', bounds, input=lnd2atm_inst%flxvoc_grc(:,num), minus=.true., & - ungridded_index=num, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do + ! do num = 1, shr_megan_mechcomps_n + ! call state_setexport(exportState, 'Fall_voc', bounds, input=lnd2atm_inst%flxvoc_grc(:,num), minus=.true., ungridded_index=num, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! end do ! fire emis fluxes - do num = 1, emis_nflds - call state_setexport(exportState, 'Fall_fire', bounds, input=lnd2atm_inst%fireflx_grc(:,num), minus=.true., & - ungridded_index=num, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - if (emis_nflds > 0) then - call state_setexport(exportState, 'Sl_fztopo', bounds, input=lnd2atm_inst%fireztop_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - endif + ! do num = 1, emis_nflds + ! call state_setexport(exportState, 'Fall_fire', bounds, input=lnd2atm_inst%fireflx_grc(:,num), minus=.true., ungridded_index=num, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! end do + ! if (emis_nflds > 0) then + ! call state_setexport(exportState, 'Sl_fztopo', bounds, input=lnd2atm_inst%fireztop_grc, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! endif ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. ! i.e. water sent from land to rof is positive @@ -478,28 +445,28 @@ subroutine export_fields(gcomp, bounds, rc) ! array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) ! end do - call state_setexport(exportState, 'Flrl_rofsur', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call state_setexport(exportState, 'Flrl_rofsur', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - do g = bounds%begg,bounds%endg - array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & - water_inst%waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) - end do - call state_setexport(exportState, 'Flrl_rofsub', bounds, input=array, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain + ! do g = bounds%begg,bounds%endg + ! array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & + ! water_inst%waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) + ! end do + ! call state_setexport(exportState, 'Flrl_rofsub', bounds, input=array, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! qgwl sent individually to coupler - call state_setexport(exportState, 'Flrl_rofgwl', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ! qgwl sent individually to coupler + ! call state_setexport(exportState, 'Flrl_rofgwl', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ice sent individually to coupler - call state_setexport(exportState, 'Flrl_rofi', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ! ice sent individually to coupler + ! call state_setexport(exportState, 'Flrl_rofi', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! irrigation flux to be removed from main channel storage (negative) - call state_setexport(exportState, 'Flrl_irrig', bounds, input=water_inst%waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ! irrigation flux to be removed from main channel storage (negative) + ! call state_setexport(exportState, 'Flrl_irrig', bounds, input=water_inst%waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine export_fields @@ -789,7 +756,7 @@ subroutine check_for_nans(array, fname, begg) integer :: i !------------------------------------------------------------------------------- - ! Check if any input from mediator or output to mediator is NaN + ! Check if any input from lilac or output to lilac is NaN if (any(isnan(array))) then write(iulog,*) '# of NaNs = ', count(isnan(array)) From 16134a7c5b3413547c13f872d901f805ba576751 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 2 Dec 2019 16:26:53 -0700 Subject: [PATCH 0459/1973] added new prescribed aerosol functionality --- lilac/src/lilac_atmaero.F90 | 226 ++++++++++++++++++++++++++---------- lilac/src/lilac_atmcap.F90 | 84 +++++++------- lilac/src/lilac_cpl.F90 | 4 +- lilac/src/lilac_fields.F90 | 1 - lilac/src/lilac_mod.F90 | 184 ++++++++++++++--------------- lilac/src/lilac_utils.F90 | 119 +++++++++++-------- 6 files changed, 368 insertions(+), 250 deletions(-) diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 index df5741a8a2..be31be5105 100644 --- a/lilac/src/lilac_atmaero.F90 +++ b/lilac/src/lilac_atmaero.F90 @@ -1,8 +1,8 @@ module lilac_atmaero !----------------------------------------------------------------------- - ! Contains methods for reading in atmosphere aerosal data - ! This will be done on the CTSM grid with the CTSM decomposition + ! Contains methods for reading in atmosphere aerosal data + ! This will be done on the CTSM grid with the CTSM decomposition ! (after the redistribution from atm-> lnd) !----------------------------------------------------------------------- @@ -18,24 +18,25 @@ module lilac_atmaero use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance use shr_cal_mod , only : shr_cal_ymd2date use shr_pio_mod , only : shr_pio_getiotype - use mct_mod , only : mct_avect_indexra, mct_ggrid + use mct_mod , only : mct_avect_indexra, mct_gsmap, mct_ggrid + use mct_mod , only : mct_gsmap_init, mct_gsmap_orderedpoints + use mct_mod , only : mct_ggrid_init, mct_ggrid_importIAttr, mct_ggrid_importRattr ! ctsm uses use ncdio_pio , only : pio_subsystem - use decompMod , only : bounds_type, get_proc_bounds, gsmap_lnd_gdc2glo use domainMod , only : ldomain - use spmdMod , only : mpicom, masterproc, comp_id - use ndepStreamMod , only : clm_domain_mct use clm_time_manager , only : get_calendar - ! lilac share + ! lilac uses + use lilac_utils , only : gindex_atm use lilac_methods , only : chkerr + use lilac_methods , only : lilac_methods_FB_getFieldN implicit none private - public :: lilac_atmaero_init ! initialize stream data type sdat - public :: lilac_atmaero_interp ! interpolates between two years of ndep file data + public :: lilac_atmaero_init ! initialize stream data type sdat + public :: lilac_atmaero_interp ! interpolates between two years of ndep file data ! module data type(shr_strdata_type) :: sdat ! input data stream @@ -47,25 +48,46 @@ module lilac_atmaero contains !============================================================================== - subroutine lilac_atmaero_init() + subroutine lilac_atmaero_init(atm2lnd_a_state, rc) ! ---------------------------------------- ! Initialize data stream information. ! ---------------------------------------- + ! input/output variables + type(ESMF_State) , intent(inout) :: atm2lnd_a_state + integer , intent(out) :: rc + ! local variables - integer :: nunit - integer :: ierr ! namelist i/o error flag - type(mct_ggrid) :: domain_mct ! domain information - character(len=cl) :: stream_fldfilename_atmaero ! name of input stream file - character(len=CL) :: mapalgo = 'bilinear' ! type of 2d mapping - character(len=CS) :: taxmode = 'extend' ! time extrapolation - character(len=CL) :: fldlistFile ! name of fields in input stream file - character(len=CL) :: fldlistModel ! name of fields in data stream code - integer :: stream_year_first_atmaero ! first year in stream to use - integer :: stream_year_last_atmaero ! last year in stream to use - integer :: model_year_align_atmaero ! align stream_year_first with model year - type(bounds_type) :: bounds + type(ESMF_VM) :: vm + type(ESMF_Mesh) :: lmesh + type(ESMF_FieldBundle) :: lfieldbundle + type(ESMF_Field) :: lfield + type(mct_ggrid) :: ggrid_atm ! domain information + type(mct_gsmap) :: gsmap_atm ! decompositoin info + integer :: mytask ! mpi task number + integer :: mpicom ! mpi communicator + integer :: n,i,j ! index + integer :: lsize ! local size + integer :: gsize ! global size + integer :: nunit ! namelist input unit + integer :: ierr ! namelist i/o error flag + character(len=cl) :: stream_fldfilename_atmaero ! name of input stream file + character(len=CL) :: mapalgo = 'bilinear' ! type of 2d mapping + character(len=CS) :: taxmode = 'extend' ! time extrapolation + character(len=CL) :: fldlistFile ! name of fields in input stream file + character(len=CL) :: fldlistModel ! name of fields in data stream code + integer :: stream_year_first_atmaero ! first year in stream to use + integer :: stream_year_last_atmaero ! last year in stream to use + integer :: model_year_align_atmaero ! align stream_year_first with model year + integer :: spatialDim + integer :: numOwnedElements + real(r8), pointer :: ownedElemCoords(:) + real(r8), pointer :: mesh_lons(:) + real(r8), pointer :: mesh_lats(:) + real(r8), pointer :: mesh_areas(:) + real(r8), pointer :: rdata(:) + integer , pointer :: idata(:) !----------------------------------------------------------------------- namelist /atmaero_stream/ & @@ -80,8 +102,14 @@ subroutine lilac_atmaero_init() model_year_align_atmaero = 1 ! align stream_year_first_atmaero with this model year stream_fldFileName_atmaero = ' ' + ! get mytask and mpicom + call ESMF_VMGetCurrent(vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_VMGet(vm, localPet=mytask, mpiCommunicator=mpicom, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + ! Read namelist - if (masterproc) then + if (mytask == 0) then open(newunit=nunit, file='lilac_in', status='old', iostat=ierr ) call shr_nl_find_group_name(nunit, 'atmaero_stream', status=ierr) if (ierr == 0) then @@ -100,7 +128,7 @@ subroutine lilac_atmaero_init() call shr_mpi_bcast(model_year_align_atmaero , mpicom) call shr_mpi_bcast(stream_fldfilename_atmaero, mpicom) - if (masterproc) then + if (mytask == 0) then print *, ' ' print *, 'atmaero stream settings:' print *, ' stream_year_first_atmaero = ',stream_year_first_atmaero @@ -110,30 +138,85 @@ subroutine lilac_atmaero_init() print *, ' ' endif - ! Create the mct domain - call get_proc_bounds(bounds) - call clm_domain_mct (bounds, domain_mct) - - ! Create the field list for these urbantv fields...use in shr_strdata_create + ! ------------------------------ + ! create the field list for these urbantv fields...use in shr_strdata_create + ! ------------------------------ fldlistFile = 'BCDEPWET:BCPHODRY:BCPHIDRY:' fldlistFile = trim(fldlistFile) // 'OCDEPWET:OCPHIDRY:OCPHODRY:DSTX01WD:' fldlistFile = trim(fldlistFile) // 'DSTX01DD:DSTX02WD:DSTX02DD:DSTX03WD:' fldlistFile = trim(fldlistFile) // 'DSTX03DD:DSTX04WD:DSTX04DD' - fldlistModel = 'bcphiwet:bcphodry:bcphidry:' - fldlistModel = trim(fldlistModel) // 'ocphiwet:ocphidry:ocphodry:' - fldlistModel = trim(fldlistModel) // 'dstwet1:dstdry1:dstwet2:dstdry2' - fldlistModel = trim(fldlistModel) // 'dstwet3:dstdry3:dstwet4:dstdry4' + fldlistModel = 'Faxa_bcphiwet:Faxa_bcphodry:Faxa_bcphidry:' + fldlistModel = trim(fldlistModel) // 'Faxa_ocphiwet:Faxa_ocphidry:Faxa_ocphodry:' + fldlistModel = trim(fldlistModel) // 'Faxa_dstwet1:Faxa_dstdry1:Faxa_dstwet2:Faxa_dstdry2:' + fldlistModel = trim(fldlistModel) // 'Faxa_dstwet3:Faxa_dstdry3:Faxa_dstwet4:Faxa_dstdry4' + + ! ------------------------------ + ! create the mct gsmap + ! ------------------------------ + lsize = size(gindex_atm) + gsize = ldomain%ni * ldomain%nj + call mct_gsmap_init( gsmap_atm, gindex_atm, mpicom, 1, lsize, gsize ) + + ! ------------------------------ + ! obtain mesh lats, lons and areas + ! ------------------------------ + call ESMF_StateGet(atm2lnd_a_state, 'a2c_fb', lfieldbundle, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call lilac_methods_FB_getFieldN(lfieldbundle, fieldnum=1, field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldGet(lfield, mesh=lmesh, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(lmesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (numOwnedElements /= lsize) then + call shr_sys_abort('ERROR: numOwnedElements is not equal to lsize') + end if + allocate(ownedElemCoords(spatialDim*numOwnedElements)) + + call ESMF_MeshGet(lmesh, ownedElemCoords=ownedElemCoords, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + allocate(mesh_lons(numOwnedElements)) + allocate(mesh_lats(numOwnedElements)) + allocate(mesh_areas(numOwnedElements)) + do n = 1,numOwnedElements + mesh_lons(n) = ownedElemCoords(2*n-1) + mesh_lats(n) = ownedElemCoords(2*n) + mesh_areas(n) = 1.e36 ! hard-wire for now for testing + end do + + ! ------------------------------ + ! create the mct ggrid + ! ------------------------------ + call mct_ggrid_init( ggrid=ggrid_atm, CoordChars='lat:lon:hgt', OtherChars='area:aream:mask:frac', lsize=lsize) + call mct_gsmap_orderedpoints(gsmap_atm, mytask, idata) + call mct_gGrid_importIAttr(ggrid_atm,'GlobGridNum', idata, lsize) + call mct_gGrid_importRattr(ggrid_atm,"lon" , mesh_lons , lsize) + call mct_gGrid_importRattr(ggrid_atm,"lat" , mesh_lats , lsize) + call mct_gGrid_importRattr(ggrid_atm,"area", mesh_areas, lsize) + allocate(rdata(lsize)) + rdata(:) = 1._R8 + call mct_gGrid_importRattr(ggrid_atm,"mask", rdata, lsize) + deallocate(mesh_lons, mesh_lats, mesh_areas, rdata) + + ! ------------------------------ + ! create the stream data sdat + ! ------------------------------ call shr_strdata_create(sdat,& name = "atmaero", & pio_subsystem = pio_subsystem, & pio_iotype = shr_pio_getiotype(compid= 1), & mpicom = mpicom, & - compid = comp_id, & - gsmap = gsmap_lnd_gdc2glo, & - ggrid = domain_mct, & - nxg = ldomain%ni, & + compid = 1, & + gsmap = gsmap_atm, & + ggrid = ggrid_atm, & + nxg = ldomain%ni, & nyg = ldomain%nj, & yearFirst = stream_year_first_atmaero, & yearLast = stream_year_last_atmaero, & @@ -155,7 +238,7 @@ subroutine lilac_atmaero_init() calendar = get_calendar(), & taxmode = taxmode ) - if (masterproc) then + if (mytask == 0) then call shr_strdata_print(sdat,'ATMAERO data') endif @@ -163,20 +246,32 @@ end subroutine lilac_atmaero_init !================================================================ - subroutine lilac_atmaero_interp(c2l_fb, clock, rc) + subroutine lilac_atmaero_interp(atm2lnd_a_state, clock, rc) ! input/output variables - type(ESMF_FieldBundle) :: c2l_fb + type(ESMF_State) :: atm2lnd_a_state type(ESMF_Clock) :: clock - integer, intent(out) :: rc + integer, intent(out) :: rc ! local variables - type(ESMF_Time) :: currTime - integer :: yy, mm, dd, sec, curr_ymd + type(ESMF_VM) :: vm + integer :: mpicom ! mpi communicator + integer :: mytask ! mpi task number + type(ESMF_FieldBundle) :: lfieldbundle + type(ESMF_Time) :: currTime + integer :: yy, mm, dd, sec, curr_ymd + character(len=*), parameter :: subname='lilac_atmaero: [lilac_atmaero_interp]' !----------------------------------------------------------------------- rc = ESMF_SUCCESS + ! get mytask and mpicom + call ESMF_VMGetCurrent(vm, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_VMGet(vm, localPet=mytask, mpiCommunicator=mpicom, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + + ! get current time info call ESMF_ClockGet( clock, currTime=currTime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -184,23 +279,27 @@ subroutine lilac_atmaero_interp(c2l_fb, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,curr_ymd) + ! advance the streams call shr_strdata_advance(sdat, curr_ymd, sec, mpicom, 'atmaero') - ! Set field bundle data - call set_fieldbundle_data('Faxa_bcphidry' , c2l_fb, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_bcphodry' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_bcphiwet' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_ocphidry' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_ocphodry' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_ocphiwet' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstwet1' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstdry1' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstwet2' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstdry2' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstwet3' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstdry3' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstwet4' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstdry4' , c2l_fb, rc=rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! set field bundle data + call ESMF_StateGet(atm2lnd_a_state, "a2c_fb", lfieldbundle, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call set_fieldbundle_data('Faxa_bcphidry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_bcphodry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_bcphiwet' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_ocphidry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_ocphodry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_ocphiwet' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstwet1' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstdry1' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstwet2' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstdry2' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstwet3' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstdry3' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstwet4' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + call set_fieldbundle_data('Faxa_dstdry4' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine lilac_atmaero_interp @@ -215,7 +314,7 @@ subroutine set_fieldbundle_data(fldname, fieldbundle, rc) ! local data type(ESMF_field) :: lfield - integer :: n, nfld, indx + integer :: nfld, i real(r8), pointer :: fldptr1d(:) !----------------------------------------------------------------------- @@ -227,9 +326,14 @@ subroutine set_fieldbundle_data(fldname, fieldbundle, rc) call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! error check + if (size(fldptr1d) /= size(sdat%avs(1)%rAttr, dim=2)) then + call shr_sys_abort("ERROR: size of fldptr1d and sdat%avs(1)%rattr dim2 are not equal") + end if + nfld = mct_avect_indexra(sdat%avs(1),trim(fldname)) - do indx = 1, size(fldptr1d) - fldptr1d(n)= sdat%avs(1)%rAttr(nfld,indx) + do i = 1, size(fldptr1d) + fldptr1d(i)= sdat%avs(1)%rAttr(nfld,i) end do end subroutine set_fieldbundle_data diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 2909dfdbab..d03db5a0b2 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -5,9 +5,10 @@ module lilac_atmcap ! This is a dummy atmosphere cap for setting up lilac structure. !----------------------------------------------------------------------- - ! !USES use ESMF - use lilac_utils , only : atm2lnd, lnd2atm, gindex_atm, atm_mesh_filename + use lilac_utils , only : atm2lnd, lnd2atm, gindex_atm, atm_mesh_filename + use lilac_methods, only : chkerr + implicit none public :: lilac_atmos_register @@ -15,6 +16,9 @@ module lilac_atmcap integer :: mytask integer, parameter :: debug = 0 ! internal debug level + character(*),parameter :: u_FILE_u = & + __FILE__ + !======================================================================== contains !======================================================================== @@ -30,9 +34,9 @@ subroutine lilac_atmos_register (comp, rc) !------------------------------------------------------------------------- call ESMF_VMGetGlobal(vm=vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_VMGet(vm, localPet=mytask, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return if (mytask == 0) then print *, "in user register routine" @@ -43,13 +47,13 @@ subroutine lilac_atmos_register (comp, rc) ! Set the entry points for standard ESMF Component methods call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=lilac_atmos_init, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=lilac_atmos_run, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=lilac_atmos_final, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine lilac_atmos_register @@ -85,11 +89,14 @@ subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! the atm_mesh_filename that were then set as module variables in lilac_utils atm_distgrid = ESMF_DistGridCreate (arbSeqIndexList=gindex_atm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! TODO: the addUserArea failed for the 4x5 grid - need to have a more robust approach - unless the area will simply be ignored for now? + ! atm_mesh = ESMF_MeshCreate(filename=trim(atm_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, & + ! elementDistGrid=atm_distgrid, addUserArea=.true., rc=rc) atm_mesh = ESMF_MeshCreate(filename=trim(atm_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, & elementDistGrid=atm_distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(trim(subname)//"Mesh for atmosphere is created for "//trim(atm_mesh_filename), ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -97,67 +104,64 @@ subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) end if !------------------------------------------------------------------------- - ! Atmosphere to Coupler (land) Fields -- atmos --> land - ! - Create empty field bundle -- a2c_fb - ! - Create Fields and add them to field bundle - ! - Add a2c_fb to state (atm2lnd_a_state) + ! Create a2c_fb field bundle and add to atm2lnd_a_state !------------------------------------------------------------------------- - ! Create individual fields and add to field bundle -- a2c + ! create empty field bundle "a2c_fb" a2c_fb = ESMF_FieldBundleCreate(name="a2c_fb", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! create fields and add to field bundle do n = 1, size(atm2lnd) field = ESMF_FieldCreate(atm_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & name=trim(atm2lnd(n)%fldname), farrayPtr=atm2lnd(n)%dataptr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldBundleAdd(a2c_fb, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - end do + if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(subname//"fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) - if (mytask == 0) then - print *, "!Fields to Coupler (atmos to land ) (a2c_fb) Field Bundle Created!" - end if + if (debug > 0) then + call ESMF_FieldPrint(field, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + end do - ! Add field bundle to state + ! add field bundle to atm2lnd_a_state call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - - call ESMF_LogWrite(subname//"atm2lnd_a_state is filled with dummy_var field bundle!", ESMF_LOGMSG_INFO) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(subname//"lilac a2c_fb fieldbundle created and added to atm2lnd_a_state", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "!atm2lnd_a_state is filld with dummy_var field bundle!" + print *, "lilac a2c_fb fieldbundle created and added to atm2lnd_a_state" end if !------------------------------------------------------------------------- - ! Coupler (land) to Atmosphere Fields -- c2a - ! - Create Field Bundle -- c2a_fb for because we are in atmos - ! - Create Fields and add them to field bundle - ! - Add c2a_fb to state (lnd2atm_a_state) + ! Create c2a_fb field bundle and add to lnd2atm_a_state + ! Also add nextsw_cday attributes !------------------------------------------------------------------------- + ! create empty field bundle "c2a_fb" c2a_fb = ESMF_FieldBundleCreate (name="c2a_fb", rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! create fields and add to field bundle do n = 1, size(lnd2atm) field = ESMF_FieldCreate(atm_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & name=trim(lnd2atm(n)%fldname), farrayPtr=lnd2atm(n)%dataptr, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return if (debug > 0) then call ESMF_FieldPrint(field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if end do - call ESMF_LogWrite(subname//"c2a fieldbundleadd is finished .... !", ESMF_LOGMSG_INFO) - ! Add field bundle to state + ! add field bundle to lnd2atm_a_state call ESMF_StateAdd(lnd2atm_a_state, (/c2a_fb/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(subname//"lilac c2a_fb fieldbundle is done and added to lnd2atm_a_state", ESMF_LOGMSG_INFO) ! Set Attributes needed by land call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) ! TODO: mv what in the world is this??? @@ -203,10 +207,10 @@ subroutine lilac_atmos_final(comp, importState, exportState, clock, rc) rc = ESMF_SUCCESS call ESMF_StateGet(importState, "c2a_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_StateGet(exportState, "a2c_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldBundleDestroy(import_fieldbundle, rc=rc) call ESMF_FieldBundleDestroy(export_fieldbundle, rc=rc) diff --git a/lilac/src/lilac_cpl.F90 b/lilac/src/lilac_cpl.F90 index 1414c86528..db15c4d60d 100644 --- a/lilac/src/lilac_cpl.F90 +++ b/lilac/src/lilac_cpl.F90 @@ -260,11 +260,11 @@ subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) end if call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_StateGet(importState, trim("a2c_fb"), import_fieldbundle, rc=rc) + call ESMF_StateGet(importState, "a2c_fb", import_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//" got a2c fieldbundle!", ESMF_LOGMSG_INFO) - call ESMF_StateGet(exportState, trim("c2l_fb"), export_fieldbundle, rc=rc) + call ESMF_StateGet(exportState, "c2l_fb", export_fieldbundle, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return call ESMF_LogWrite(subname//" got c2l fieldbundle!", ESMF_LOGMSG_INFO) diff --git a/lilac/src/lilac_fields.F90 b/lilac/src/lilac_fields.F90 index 355e6f9a88..c31f41a120 100644 --- a/lilac/src/lilac_fields.F90 +++ b/lilac/src/lilac_fields.F90 @@ -29,7 +29,6 @@ subroutine lilac_field_bundle_to_land(mesh, fieldbundle, rc) ! Add empty fields to field bundle do n = 1, size(atm2lnd) - write(6,*)'DEBUG: ',n, trim(atm2lnd(n)%fldname) call fldbundle_add(trim(atm2lnd(n)%fldname), mesh, fieldbundle, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index ec3f43c320..3da662f34f 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -8,6 +8,25 @@ module lilac_mod !----------------------------------------------------------------------- use ESMF + + ! lilac routines + use lilac_io , only : lilac_io_init + use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd + use lilac_utils , only : gindex_atm, atm_mesh_filename + use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register + use lilac_atmcap , only : lilac_atmos_register + use lilac_atmaero , only : lilac_atmaero_init + use lilac_atmaero , only : lilac_atmaero_interp + use lilac_history , only : lilac_history_write + use lilac_methods , only : chkerr + + ! shr code routines + use shr_pio_mod , only : shr_pio_init1 + use shr_sys_mod , only : shr_sys_abort + + ! ctsm routines + use lnd_comp_esmf , only : lnd_register ! ctsm routine + implicit none public :: lilac_init @@ -22,8 +41,8 @@ module lilac_mod type(ESMF_CplComp) :: cpl_lnd2atm_comp ! States - type(ESMF_State) :: atm2lnd_l_state, atm2lnd_a_state - type(ESMF_State) :: lnd2atm_a_state, lnd2atm_l_state + type(ESMF_State) :: atm2lnd_a_state, atm2lnd_l_state + type(ESMF_State) :: lnd2atm_l_state, lnd2atm_a_state ! Clock, TimeInterval, and Times type(ESMF_Clock) :: lilac_clock @@ -35,6 +54,9 @@ module lilac_mod integer :: mytask + character(*), parameter :: u_FILE_u = & + __FILE__ + !======================================================================== contains !======================================================================== @@ -48,23 +70,13 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! This is called by the host atmosphere ! -------------------------------------------------------------------------------- - use lilac_io , only : lilac_io_init - use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd - use lilac_utils , only : gindex_atm, atm_mesh_filename - use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register - use lilac_atmcap , only : lilac_atmos_register - use lnd_comp_esmf , only : lnd_register !ctsm routine - use lilac_atmaero , only : lilac_atmaero_init - use shr_pio_mod , only : shr_pio_init1 - use shr_sys_mod , only : shr_sys_abort - ! input/output variables character(len=*) , intent(in) :: atm_mesh_file integer , intent(in) :: atm_global_index(:) real , intent(in) :: atm_lons(:) real , intent(in) :: atm_lats(:) character(len=*) , intent(in) :: atm_calendar - integer , intent(in) :: atm_timestep + integer , intent(in) :: atm_timestep integer , intent(in) :: atm_start_year !(yyyy) integer , intent(in) :: atm_start_mon !(mm) integer , intent(in) :: atm_start_day @@ -86,7 +98,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & integer :: rc character(len=ESMF_MAXSTR) :: cname !components or cpl names integer :: ierr - integer :: mpic ! mpi communicator + integer :: mpic ! mpi communicator integer :: n, i integer :: fileunit integer, parameter :: debug = 1 !-- internal debug level @@ -102,8 +114,8 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! TODO: cannot assume that the calendar is always gregorian unless CTSM assumes this as well ! Need to coordinate the calendar info between lilac and the host component - call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN, logappendflag=.false., rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN, logappendflag=.false., rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogSet(flush=.true.) @@ -117,9 +129,9 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! Initialize pio (needed by CTSM) - TODO: this should be done within CTSM not here call ESMF_VMGetGlobal(vm=vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_VMGet(vm, localPet=mytask, mpiCommunicator=mpic, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call shr_pio_init1(ncomps=1, nlfilename="lilac_in", Global_Comm=mpic) @@ -135,7 +147,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! Initialize atm_mesh_filename atm_mesh_filename = atm_mesh_file - ! Initialize datatypes atm2lnd and lnd2atm + ! Initialize datatypes atm2lnd and lnd2atm ! This must be done BEFORE the component initialization call lilac_init_atm2lnd(lsize) call lilac_init_lnd2atm(lsize) @@ -145,7 +157,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & !------------------------------------------------------------------------- cname = " LILAC atm cap " atm_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac atmcap initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // "lilac atm cap gridded component created" @@ -156,7 +168,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & !------------------------------------------------------------------------- cname = " CTSM " lnd_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac ctsm initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " ctsm gridded component created" @@ -167,7 +179,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & !------------------------------------------------------------------------- cname = "Coupler from atmosphere to land" cpl_atm2lnd_comp = ESMF_CplCompCreate(name=cname, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_a2l initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " coupler component (atmosphere to land) created" @@ -178,7 +190,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & !------------------------------------------------------------------------- cname = "Coupler from land to atmosphere" cpl_lnd2atm_comp = ESMF_CplCompCreate(name=cname, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_l2a initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " coupler component (land to atmosphere) created" @@ -188,7 +200,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! Register section -- set services -- atmos_cap !------------------------------------------------------------------------- call ESMF_GridCompSetServices(atm_gcomp, userRoutine=lilac_atmos_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('atm_gcomp register failure') call ESMF_LogWrite(subname//" atmos SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " lilac atm cap setservices finished" @@ -198,7 +210,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! Register section -- set services -- land cap !------------------------------------------------------------------------- call ESMF_GridCompSetServices(lnd_gcomp, userRoutine=lnd_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('lnd_gcomp register failure') call ESMF_LogWrite(subname//"land SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " CTSM setservices finished" @@ -208,7 +220,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! Register section -- set services -- coupler atmosphere to land !------------------------------------------------------------------------- call ESMF_CplCompSetServices(cpl_atm2lnd_comp, userRoutine=cpl_atm2lnd_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_atm2lnd_comp register failure') call ESMF_LogWrite(subname//"Coupler from atmosphere to land SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " coupler from atmosphere to land setservices finished" @@ -218,7 +230,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! Register section -- set services -- coupler land to atmosphere !------------------------------------------------------------------------- call ESMF_CplCompSetServices(cpl_lnd2atm_comp, userRoutine=cpl_lnd2atm_register, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2atm_comp register failure') call ESMF_LogWrite(subname//"Coupler from land to atmosphere SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " coupler from land to atmosphere setservices finished" @@ -236,41 +248,37 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! TODO: add supported calendars here end if - call ESMF_TimeIntervalSet(TimeStep, s=atm_timestep, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_TimeIntervalSet(TimeStep, s=atm_timestep, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeSet(StartTime, yy=atm_start_year, mm=atm_start_mon, dd=atm_start_day , s=atm_start_secs, & calendar=lilac_calendar, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeSet(StopTime , yy=atm_stop_year , mm=atm_stop_mon , dd=atm_stop_day , s=atm_stop_secs , & calendar=lilac_calendar, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return lilac_clock = ESMF_ClockCreate(name='lilac_clock', TimeStep=TimeStep, startTime=StartTime, & RefTime=StartTime, stopTime=stopTime, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return if (mytask == 0) then print *, trim(subname) // "---------------------------------------" call ESMF_ClockPrint (lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_CalendarPrint (lilac_calendar , rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return print *, trim(subname) // "---------------------------------------" end if ! Add a restart alarm to the clock lilac_restart_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_restart_alarm', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort('error in initializing restart alarm') - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing restart alarm') ! Add a stop alarm to the clock lilac_stop_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_stop_alarm', rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort('error in initializing stop alarm') - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing stop alarm') ! ------------------------------------------------------------------------- ! Initialze lilac_atm gridded component @@ -278,15 +286,14 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! between components. (these are module variables) ! ------------------------------------------------------------------------- - atm2lnd_a_state = ESMF_StateCreate(name='atm_state_on_atm_mesh', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - lnd2atm_a_state = ESMF_StateCreate(name='lnd_state_on_lnd_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + atm2lnd_a_state = ESMF_StateCreate(name='state_from_atm_on_atm_mesh', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + lnd2atm_a_state = ESMF_StateCreate(name='state_from_land_on_atm_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_GridCompInitialize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in initializing atmcap") - end if + call ESMF_GridCompInitialize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing atmcap") call ESMF_LogWrite(subname//"lilac_atm gridded component initialized", ESMF_LOGMSG_INFO) ! ------------------------------------------------------------------------- @@ -295,31 +302,28 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! between components. (these are module variables) ! ------------------------------------------------------------------------- - atm2lnd_l_state = ESMF_StateCreate(name='atm_state_on_lnd_mesh', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - lnd2atm_l_state = ESMF_StateCreate(name='lnd_state_on_atm_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + atm2lnd_l_state = ESMF_StateCreate(name='state_from_atm_on_land_mesh', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + lnd2atm_l_state = ESMF_StateCreate(name='state_from_land_on_land_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_GridCompInitialize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in initializing ctsm") - end if + call ESMF_GridCompInitialize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing ctsm") call ESMF_LogWrite(subname//"CTSM gridded component initialized", ESMF_LOGMSG_INFO) ! ------------------------------------------------------------------------- ! Initialze LILAC coupler components ! ------------------------------------------------------------------------- - call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in initializing cpl_lnd2atm coupler component") - end if + call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_atm2lnd component") call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) - call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in initializing cpl_atm2lnd coupler component") - end if + call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -337,7 +341,8 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! Initialize atmaero stream data (using share strearm capability from CIME) !------------------------------------------------------------------------- - call lilac_atmaero_init() + call lilac_atmaero_init(atm2lnd_a_state, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing lilac_atmaero_init") end subroutine lilac_init @@ -345,9 +350,6 @@ end subroutine lilac_init subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) - use shr_sys_mod , only : shr_sys_abort - use lilac_history, only : lilac_history_write - ! input/output variables logical, intent(in) :: restart_alarm_is_ringing logical, intent(in) :: stop_alarm_is_ringing @@ -369,45 +371,39 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! Set the clock restart alarm if restart_alarm_ringing is true if (restart_alarm_is_ringing) then call ESMF_AlarmRingerOn(lilac_restart_alarm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in running lilac atm_cap") - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") end if ! Set the clock stop alarm if stop_alarm_ringing is true if (stop_alarm_is_ringing) then call ESMF_AlarmRingerOn(lilac_stop_alarm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in running lilac atm_cap") - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") end if - ! Run lilac atmcap + ! Run lilac atmcap - update the atm2lnd_a_state call ESMF_LogWrite(subname//"running lilac atmos_cap", ESMF_LOGMSG_INFO) if (mytask == 0) print *, "Running atmos_cap gridded component , rc =", rc call ESMF_GridCompRun(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, & clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in running lilac atm_cap") - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") + + ! Update prescribed aerosols atm2lnd_a_state + call lilac_atmaero_interp(atm2lnd_a_state, lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac_atmaero_interp") ! Run cpl_atm2lnd call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) print *, "Running coupler component..... cpl_atm2lnd_comp" call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, & clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in running cpl_atm2lnd") - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_atm2lnd") ! Run ctsm call ESMF_LogWrite(subname//"running ctsm", ESMF_LOGMSG_INFO) if (mytask == 0) print *, "Running ctsm" call ESMF_GridCompRun(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, & clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in running ctsm") - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") ! Run cpl_lnd2atm call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) @@ -416,22 +412,16 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) end if call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, & clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in cpl_lnd2atm") - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in cpl_lnd2atm") ! Write out history output call lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state, lnd2atm_a_state, & lilac_clock, rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in history write") - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") ! Advance the time at the end of the time step call ESMF_ClockAdvance(lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort("lilac error in advancing time step") - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in advancing time step") call ESMF_LogWrite(subname//"time is icremented now... (ClockAdvance)", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, "time is icremented now... (ClockAdvance) , rc =", rc @@ -462,7 +452,7 @@ subroutine lilac_final( ) ! Gridded Component Finalizing! --- atmosphere !------------------------------------------------------------------------- call ESMF_GridCompFinalize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, "Finalizing atmos_cap gridded component , rc =", rc @@ -472,7 +462,7 @@ subroutine lilac_final( ) ! Coupler component Finalizing --- coupler atmos to land !------------------------------------------------------------------------- call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, "Finalizing coupler component..... cpl_atm2lnd_comp , rc =", rc @@ -482,7 +472,7 @@ subroutine lilac_final( ) ! Gridded Component Finalizing! --- land !------------------------------------------------------------------------- call ESMF_GridCompFinalize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, "Finalizing lnd_cap gridded component , rc =", rc @@ -492,7 +482,7 @@ subroutine lilac_final( ) ! Coupler component Finalizing --- coupler land to atmos !------------------------------------------------------------------------- call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=lilac_clock, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, "Finalizing coupler component..... cpl_lnd2atm_comp , rc =", rc diff --git a/lilac/src/lilac_utils.F90 b/lilac/src/lilac_utils.F90 index 08877ffb51..f83245d6f9 100644 --- a/lilac/src/lilac_utils.F90 +++ b/lilac/src/lilac_utils.F90 @@ -1,6 +1,21 @@ module lilac_utils - ! NOTE: the following cannot depend on any esmf objects - since it will be used by the host atmosphere + ! *********************************************************************** + ! NOTE: THE FOLLOWING CANNOT DEPEND ON ANY ESMF OBJECTS + ! since it will be used by the host atmosphere + ! This is the ONLY lilac routine that is required to be ESMF independent + ! + ! THE HOST ATMOSPHERE IS RESPONSIBLE for calling lilac_init() and in turn + ! lilac_init() calls the initialization routines for atm2lnd and lnd2atm + ! + ! the host atm init call will be + ! call lilac_init() + ! the host atm run phase will be + ! call lilac_atm2lnd(fldname, data1d) + ! call lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) + ! call lilac_lnd2atm(fldname, data1d) + ! + ! *********************************************************************** implicit none private @@ -13,7 +28,7 @@ module lilac_utils ! Global index space info for atm data integer, public, allocatable :: gindex_atm (:) - ! Mesh file to be read in by lilac_atm + ! Mesh file to be read in by lilac_atm character(len=256), public :: atm_mesh_filename ! Mesh file to be read in by ctsm @@ -24,7 +39,7 @@ module lilac_utils real*8, pointer :: dataptr(:) character(len=64) :: units logical :: provided_by_atm - logical :: required_fr_atm + logical :: required_fr_atm end type atm2lnd_type type(atm2lnd_type), pointer, public :: atm2lnd(:) @@ -39,44 +54,50 @@ module lilac_utils contains !======================================================================== - ! *** NOTE - THE HOST ATMOSPHERE IS RESPONSIBLE for calling - ! lilac_init that then calls the initialization routines for atm2lnd and lnd2atm - - ! host atm init call will simply be - ! call lilac_init() - - ! host atm run phase will be - ! call lilac_atm2lnd(fldname, data1d) - subroutine lilac_init_atm2lnd(lsize) integer, intent(in) :: lsize integer :: n - ! TODO: how is the atm going to specify which fields are not provided = + ! TODO: how is the atm going to specify which fields are not provided = ! should it pass an array of character strings or a colon deliminited set of fields ! to specify the fields it will not provide - and then these are checked against those fields - call atm2lnd_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_v' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_ptem' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_pbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_tbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_shum' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_lwdn' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainc' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainl' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowc' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowl' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndr' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdr' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndf' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_v' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_ptem' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_pbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_tbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Sa_shum' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_lwdn' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainc' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainl' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowc' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowl' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndr' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdr' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet1' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry1' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet2' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry2' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet3' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry3' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet4' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry4' , units='unknown', required_fr_atm=.true. , lsize=lsize) ! TODO: optional fields - if these are uncommented then need to make sure that they are also appear in the lnd ! import state - ! CRITICAL the fields in the export state from lilac_atmcap MUST match the fields in the import state to the land + ! CRITICAL the fields in the export state from lilac_atmcap MUST match the fields in the import state to the land ! this is not being checked currently and msut be !call atm2lnd_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) !call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) @@ -88,29 +109,29 @@ subroutine lilac_init_atm2lnd(lsize) end do end subroutine lilac_init_atm2lnd -!======================================================================== + !======================================================================== subroutine lilac_init_lnd2atm(lsize) integer, intent(in) :: lsize integer :: n call lnd2atm_add_fld (lnd2atm, fldname='Sl_lfrin' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_t' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_tref' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_qref' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdr' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_anidr' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdf' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_anidf' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_snowh' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_u10' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_fv' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_ram1' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_lwup' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_taux' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_tauy' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_evap' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_swnet', units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_t' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_tref' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_qref' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdr' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_anidr' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdf' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_anidf' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_snowh' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_u10' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_fv' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Sl_ram1' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_lwup' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_taux' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_tauy' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_evap' , units='unknown', lsize=lsize) + call lnd2atm_add_fld (lnd2atm, fldname='Fall_swnet', units='unknown', lsize=lsize) ! now add dataptr memory for all of the fields do n = 1,size(lnd2atm) @@ -159,7 +180,7 @@ subroutine lilac_atm2lnd_check() ! if there are fields that the atmosphere does not provide but that are required - then abort do n = 1,size(atm2lnd) if (atm2lnd(n)%required_fr_atm .and. (.not. atm2lnd(n)%provided_by_atm)) then - ! call abort or provide default values? + ! call abort or provide default values? else if (.not. atm2lnd(n)%provided_by_atm) then ! create default values end if From 35971908b5f99d49a5665659396e8955525829f6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 2 Dec 2019 17:30:27 -0700 Subject: [PATCH 0460/1973] new approach to consistency in lilac/clm fields --- lilac/src/lilac_fields.F90 | 87 --------------- lilac/src/lilac_utils.F90 | 216 +++++++++++++++++++++++++------------ 2 files changed, 147 insertions(+), 156 deletions(-) delete mode 100644 lilac/src/lilac_fields.F90 diff --git a/lilac/src/lilac_fields.F90 b/lilac/src/lilac_fields.F90 deleted file mode 100644 index c31f41a120..0000000000 --- a/lilac/src/lilac_fields.F90 +++ /dev/null @@ -1,87 +0,0 @@ -module lilac_fields - - ! This module is used by both CTSM and the lilac atmcap to ensure that the field bundles - ! exchanged between components are identical - - use ESMF - use lilac_methods, only : chkerr - use lilac_utils , only : atm2lnd, lnd2atm - - implicit none - public - - character(*),parameter :: u_FILE_u = & - __FILE__ - -!=============================================================================== -contains -!=============================================================================== - - subroutine lilac_field_bundle_to_land(mesh, fieldbundle, rc) - - type(ESMF_Mesh) :: mesh - type(ESMF_FieldBundle) :: fieldbundle - integer, intent(out) :: rc - - integer :: n - - rc = ESMF_SUCCESS - - ! Add empty fields to field bundle - do n = 1, size(atm2lnd) - call fldbundle_add(trim(atm2lnd(n)%fldname), mesh, fieldbundle, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - - end subroutine lilac_field_bundle_to_land - - !=============================================================================== - - subroutine lilac_field_bundle_from_land(mesh, fieldbundle, rc) - - type(ESMF_Mesh) :: mesh - type(ESMF_FieldBundle) :: fieldbundle - integer, intent(out) :: rc - - integer :: n - - rc = ESMF_SUCCESS - - ! Add empty fields to field bundle - do n = 1, size(atm2lnd) - call fldbundle_add( trim(lnd2atm(n)%fldname), mesh, fieldbundle, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - - end subroutine lilac_field_bundle_from_land - - !=============================================================================== - - subroutine fldbundle_add(fldname, mesh, fieldbundle, rc) - - !--------------------------- - ! Create an empty input field with name 'stdname' to add to fieldbundle - !--------------------------- - - ! input/output variables - character(len=*) , intent(in) :: fldname - type(ESMF_Mesh) , intent(in) :: mesh - type(ESMF_FieldBundle) , intent(inout) :: fieldbundle - integer , intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(fldname), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - end subroutine fldbundle_add - - -end module lilac_fields diff --git a/lilac/src/lilac_utils.F90 b/lilac/src/lilac_utils.F90 index f83245d6f9..3a765e0f8d 100644 --- a/lilac/src/lilac_utils.F90 +++ b/lilac/src/lilac_utils.F90 @@ -1,10 +1,6 @@ module lilac_utils ! *********************************************************************** - ! NOTE: THE FOLLOWING CANNOT DEPEND ON ANY ESMF OBJECTS - ! since it will be used by the host atmosphere - ! This is the ONLY lilac routine that is required to be ESMF independent - ! ! THE HOST ATMOSPHERE IS RESPONSIBLE for calling lilac_init() and in turn ! lilac_init() calls the initialization routines for atm2lnd and lnd2atm ! @@ -14,9 +10,13 @@ module lilac_utils ! call lilac_atm2lnd(fldname, data1d) ! call lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! call lilac_lnd2atm(fldname, data1d) - ! ! *********************************************************************** + use ESMF + use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_cl, CS => shr_kind_cs + use shr_sys_mod , only : shr_sys_abort + use lilac_methods , only : chkerr + implicit none private @@ -24,20 +24,25 @@ module lilac_utils public :: lilac_init_lnd2atm public :: lilac_atm2lnd public :: lilac_lnd2atm + public :: lilac_field_bundle_to_land + public :: lilac_field_bundle_fr_land + + private :: lilac_atm2lnd_add_fld + private :: lilac_lnd2atm_add_fld ! Global index space info for atm data integer, public, allocatable :: gindex_atm (:) ! Mesh file to be read in by lilac_atm - character(len=256), public :: atm_mesh_filename + character(len=CL), public :: atm_mesh_filename ! Mesh file to be read in by ctsm - character(len=256), public :: lnd_mesh_filename + character(len=CL), public :: lnd_mesh_filename type :: atm2lnd_type - character(len=128) :: fldname - real*8, pointer :: dataptr(:) - character(len=64) :: units + character(len=CL) :: fldname + real(r8), pointer :: dataptr(:) + character(len=CS) :: units logical :: provided_by_atm logical :: required_fr_atm end type atm2lnd_type @@ -45,11 +50,14 @@ module lilac_utils type :: lnd2atm_type character(len=128) :: fldname - real*8, pointer :: dataptr(:) + real(r8), pointer :: dataptr(:) character(len=64) :: units end type lnd2atm_type type(atm2lnd_type), pointer, public :: lnd2atm(:) + character(*), parameter :: u_FILE_u = & + __FILE__ + !======================================================================== contains !======================================================================== @@ -62,45 +70,45 @@ subroutine lilac_init_atm2lnd(lsize) ! should it pass an array of character strings or a colon deliminited set of fields ! to specify the fields it will not provide - and then these are checked against those fields - call atm2lnd_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_v' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_ptem' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_pbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_tbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Sa_shum' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_lwdn' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainc' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainl' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowc' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowl' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndr' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdr' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndf' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdf' , units='unknown', required_fr_atm=.true. , lsize=lsize) - - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet1' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry1' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet2' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry2' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet3' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry3' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet4' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry4' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_v' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_ptem' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_pbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_tbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_shum' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_lwdn' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainc' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainl' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowc' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowl' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndr' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdr' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet1' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry1' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet2' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry2' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet3' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry3' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet4' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry4' , units='unknown', required_fr_atm=.true. , lsize=lsize) ! TODO: optional fields - if these are uncommented then need to make sure that they are also appear in the lnd ! import state ! CRITICAL the fields in the export state from lilac_atmcap MUST match the fields in the import state to the land ! this is not being checked currently and msut be - !call atm2lnd_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) - !call atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) + !call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) + !call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) ! now add dataptr memory for all of the fields and set default values of provided_by_atm to false do n = 1,size(atm2lnd) @@ -115,23 +123,23 @@ subroutine lilac_init_lnd2atm(lsize) integer, intent(in) :: lsize integer :: n - call lnd2atm_add_fld (lnd2atm, fldname='Sl_lfrin' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_t' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_tref' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_qref' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdr' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_anidr' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdf' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_anidf' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_snowh' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_u10' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_fv' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Sl_ram1' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_lwup' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_taux' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_tauy' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_evap' , units='unknown', lsize=lsize) - call lnd2atm_add_fld (lnd2atm, fldname='Fall_swnet', units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_lfrin' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_t' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_tref' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_qref' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdr' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_anidr' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdf' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_anidf' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_snowh' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_u10' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_fv' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_ram1' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_lwup' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_taux' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_tauy' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_evap' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_swnet', units='unknown', lsize=lsize) ! now add dataptr memory for all of the fields do n = 1,size(lnd2atm) @@ -145,7 +153,7 @@ subroutine lilac_atm2lnd(fldname, data) ! input/output variables character(len=*), intent(in) :: fldname - real*8, intent(in) :: data(:) + real(r8), intent(in) :: data(:) ! local variables integer :: n @@ -171,6 +179,8 @@ subroutine lilac_atm2lnd(fldname, data) end subroutine lilac_atm2lnd +!======================================================================== + subroutine lilac_atm2lnd_check() ! local variables @@ -191,8 +201,8 @@ end subroutine lilac_atm2lnd_check subroutine lilac_lnd2atm(fldname, data) ! input/output variables - character(len=*), intent(in) :: fldname - real*8, intent(out) :: data(:) + character(len=*) , intent(in) :: fldname + real(r8) , intent(out) :: data(:) ! local variables integer :: n @@ -211,7 +221,7 @@ end subroutine lilac_lnd2atm !======================================================================== - subroutine atm2lnd_add_fld(flds, fldname, units, required_fr_atm, lsize) + subroutine lilac_atm2lnd_add_fld(flds, fldname, units, required_fr_atm, lsize) ! ---------------------------------------------- ! Add an entry to to the flds array @@ -276,11 +286,11 @@ subroutine atm2lnd_add_fld(flds, fldname, units, required_fr_atm, lsize) flds(newsize)%required_fr_atm = required_fr_atm end if - end subroutine atm2lnd_add_fld + end subroutine lilac_atm2lnd_add_fld !======================================================================== - subroutine lnd2atm_add_fld(flds, fldname, units, lsize) + subroutine lilac_lnd2atm_add_fld(flds, fldname, units, lsize) ! ---------------------------------------------- ! Add an entry to to the flds array @@ -334,6 +344,74 @@ subroutine lnd2atm_add_fld(flds, fldname, units, lsize) flds(newsize)%fldname = trim(fldname) flds(newsize)%units = trim(units) - end subroutine lnd2atm_add_fld + end subroutine lilac_lnd2atm_add_fld + +!======================================================================== + + subroutine lilac_field_bundle_to_land(mesh, fieldbundle, rc) + + type(ESMF_Mesh) :: mesh + type(ESMF_FieldBundle) :: fieldbundle + integer, intent(out) :: rc + + integer :: n + + rc = ESMF_SUCCESS + + ! Add empty fields to field bundle + do n = 1, size(atm2lnd) + call fldbundle_add(trim(atm2lnd(n)%fldname), mesh, fieldbundle, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + + end subroutine lilac_field_bundle_to_land + +!=============================================================================== + + subroutine lilac_field_bundle_fr_land(mesh, fieldbundle, rc) + + type(ESMF_Mesh) :: mesh + type(ESMF_FieldBundle) :: fieldbundle + integer, intent(out) :: rc + + integer :: n + + rc = ESMF_SUCCESS + + ! Add empty fields to field bundle + do n = 1, size(atm2lnd) + call fldbundle_add( trim(lnd2atm(n)%fldname), mesh, fieldbundle, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + + end subroutine lilac_field_bundle_fr_land + +!=============================================================================== + + subroutine fldbundle_add(fldname, mesh, fieldbundle, rc) + + !--------------------------- + ! Create an empty input field with name 'stdname' to add to fieldbundle + !--------------------------- + + ! input/output variables + character(len=*) , intent(in) :: fldname + type(ESMF_Mesh) , intent(in) :: mesh + type(ESMF_FieldBundle) , intent(inout) :: fieldbundle + integer , intent(out) :: rc + + ! local variables + type(ESMF_Field) :: field + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(fldname), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end subroutine fldbundle_add end module lilac_utils From a2f3610174c5300f9ec271e36a1787ad3f674478 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 2 Dec 2019 17:31:00 -0700 Subject: [PATCH 0461/1973] new approach in consistency of lilac/clm fields --- src/cpl/lilac/lnd_comp_esmf.F90 | 73 ++++++--------------------------- 1 file changed, 12 insertions(+), 61 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 6e4628a82e..f27ac92767 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -10,7 +10,7 @@ module lnd_comp_esmf use mpi , only : MPI_BCAST, MPI_CHARACTER use mct_mod , only : mct_world_init use perf_mod , only : t_startf, t_stopf, t_barrierf - use lilac_fields , only : lilac_field_bundle_to_land, lilac_field_bundle_from_land + use lilac_utils , only : lilac_field_bundle_to_land, lilac_field_bundle_fr_land ! cime share code use shr_pio_mod , only : shr_pio_init2 @@ -418,44 +418,12 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! NOTE: currently this must be the same list as in lilac_init_atm2lnd ! create an empty field bundle - c2l_fb = ESMF_FieldBundleCreate ( name='c2l_fb', rc=rc) - - !call lilac_field_bundle_to_land(lnd_mesh, c2l_fb, rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + c2l_fb = ESMF_FieldBundleCreate (name='c2l_fb', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Now add fields on lnd_mesh to this field bundle - call fldbundle_add( 'Sa_z' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_topo' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_u' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_v' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_ptem' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_pbot' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_tbot' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sa_shum' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_lwdn' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_rainc' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_rainl' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_snowc' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_snowl' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swndr' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swvdr' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swndf' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_swvdf' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call fldbundle_add( 'Faxa_bcphidry' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_bcphodry' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_bcphiwet' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_ocphidry' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_ocphodry' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_ocphiwet' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_dstwet1' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_dstdry1' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_dstwet2' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_dstdry2' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_dstwet3' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_dstdry3' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_dstwet4' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Faxa_dstdry4' , c2l_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! now add fields on lnd_mesh to this field bundle + call lilac_field_bundle_to_land(lnd_mesh, c2l_fb, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! add the field bundle to the export state call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/)) @@ -466,32 +434,15 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! NOTE: currently this must be the same list as in lilac_init_lnd2atm - ! Create an empty field bundle + ! create an empty field bundle l2c_fb = ESMF_FieldBundleCreate(name='l2c_fb', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - !call lilac_field_bundle_from_land(lnd_mesh, l2c_fb, rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! now add fields on lnd_mesh to this field bundle + call lilac_field_bundle_fr_land(lnd_mesh, l2c_fb, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Now add fields on lnd_mesh to this field bundle - call fldbundle_add( 'Sl_lfrin' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_t' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_tref' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_qref' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_avsdr' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_anidr' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_avsdf' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_anidf' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Sl_snowh' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_u10' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_fv' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_ram1' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_lwup' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_taux' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_tauy' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_evap' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldbundle_add( 'Fall_swnet' , l2c_fb,rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Add the field bundle to the state + ! add the field bundle to the state call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb/), rc=rc) !-------------------------------- From 219856a9df3e60840fdba029fce321159f91cfb3 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 2 Dec 2019 19:46:56 -0700 Subject: [PATCH 0462/1973] fixed bug --- lilac/src/lilac_utils.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/src/lilac_utils.F90 b/lilac/src/lilac_utils.F90 index 3a765e0f8d..2c6b6d343e 100644 --- a/lilac/src/lilac_utils.F90 +++ b/lilac/src/lilac_utils.F90 @@ -379,7 +379,7 @@ subroutine lilac_field_bundle_fr_land(mesh, fieldbundle, rc) rc = ESMF_SUCCESS ! Add empty fields to field bundle - do n = 1, size(atm2lnd) + do n = 1, size(lnd2atm) call fldbundle_add( trim(lnd2atm(n)%fldname), mesh, fieldbundle, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do From 58f96b3ad6cd239b62dbcb503ba401532fe11475 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 2 Dec 2019 20:13:07 -0700 Subject: [PATCH 0463/1973] made lilac_atmaero more generic --- lilac/src/lilac_atmaero.F90 | 50 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 index be31be5105..f54481ae62 100644 --- a/lilac/src/lilac_atmaero.F90 +++ b/lilac/src/lilac_atmaero.F90 @@ -72,14 +72,14 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) integer :: gsize ! global size integer :: nunit ! namelist input unit integer :: ierr ! namelist i/o error flag - character(len=cl) :: stream_fldfilename_atmaero ! name of input stream file + character(len=cl) :: stream_fldfilename ! name of input stream file character(len=CL) :: mapalgo = 'bilinear' ! type of 2d mapping character(len=CS) :: taxmode = 'extend' ! time extrapolation character(len=CL) :: fldlistFile ! name of fields in input stream file character(len=CL) :: fldlistModel ! name of fields in data stream code - integer :: stream_year_first_atmaero ! first year in stream to use - integer :: stream_year_last_atmaero ! last year in stream to use - integer :: model_year_align_atmaero ! align stream_year_first with model year + integer :: stream_year_first ! first year in stream to use + integer :: stream_year_last ! last year in stream to use + integer :: model_year_align ! align stream_year_first with model year integer :: spatialDim integer :: numOwnedElements real(r8), pointer :: ownedElemCoords(:) @@ -91,16 +91,16 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) !----------------------------------------------------------------------- namelist /atmaero_stream/ & - stream_year_first_atmaero, & - stream_year_last_atmaero, & - model_year_align_atmaero, & - stream_fldfilename_atmaero + stream_year_first, & + stream_year_last, & + model_year_align, & + stream_fldfilename ! default values for namelist - stream_year_first_atmaero = 1 ! first year in stream to use - stream_year_last_atmaero = 1 ! last year in stream to use - model_year_align_atmaero = 1 ! align stream_year_first_atmaero with this model year - stream_fldFileName_atmaero = ' ' + stream_year_first = 1 ! first year in stream to use + stream_year_last = 1 ! last year in stream to use + model_year_align = 1 ! align stream_year_first with this model year + stream_fldFileName = ' ' ! get mytask and mpicom call ESMF_VMGetCurrent(vm, rc=rc) @@ -123,18 +123,18 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) close(nunit) endif - call shr_mpi_bcast(stream_year_first_atmaero , mpicom) - call shr_mpi_bcast(stream_year_last_atmaero , mpicom) - call shr_mpi_bcast(model_year_align_atmaero , mpicom) - call shr_mpi_bcast(stream_fldfilename_atmaero, mpicom) + call shr_mpi_bcast(stream_year_first , mpicom) + call shr_mpi_bcast(stream_year_last , mpicom) + call shr_mpi_bcast(model_year_align , mpicom) + call shr_mpi_bcast(stream_fldfilename, mpicom) if (mytask == 0) then print *, ' ' print *, 'atmaero stream settings:' - print *, ' stream_year_first_atmaero = ',stream_year_first_atmaero - print *, ' stream_year_last_atmaero = ',stream_year_last_atmaero - print *, ' model_year_align_atmaero = ',model_year_align_atmaero - print *, ' stream_fldFileName_atmaero = ',stream_fldFileName_atmaero + print *, ' stream_year_first = ',stream_year_first + print *, ' stream_year_last = ',stream_year_last + print *, ' model_year_align = ',model_year_align + print *, ' stream_fldFileName = ',stream_fldFileName print *, ' ' endif @@ -218,19 +218,19 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) ggrid = ggrid_atm, & nxg = ldomain%ni, & nyg = ldomain%nj, & - yearFirst = stream_year_first_atmaero, & - yearLast = stream_year_last_atmaero, & - yearAlign = model_year_align_atmaero, & + yearFirst = stream_year_first, & + yearLast = stream_year_last, & + yearAlign = model_year_align, & offset = 0, & domFilePath = '', & - domfilename = trim(stream_fldfilename_atmaero), & + domfilename = trim(stream_fldfilename), & domTvarName = 'time', & domXvarName = 'lon' , & domYvarName = 'lat' , & domAreaName = 'area', & domMaskName = 'mask', & filePath = '', & - filename = (/trim(stream_fldfilename_atmaero)/), & + filename = (/trim(stream_fldfilename)/), & fldListFile = trim(fldlistFile), & fldListModel = trim(fldlistModel), & fillalgo = 'none', & From 0e1d8d705d6370febf3bcaa872a4026cc5067312 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 2 Dec 2019 20:13:42 -0700 Subject: [PATCH 0464/1973] made stream input more generic --- lilac_config/lilac_in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lilac_config/lilac_in b/lilac_config/lilac_in index 198c8aea6e..7e738d65d6 100644 --- a/lilac_config/lilac_in +++ b/lilac_config/lilac_in @@ -2,9 +2,9 @@ lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' / &atmaero_stream - stream_fldfilename_atmaero='/glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc' - stream_year_first_atmaero = 2000 - stream_year_last_atmaero = 2000 + stream_fldfilename='/glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc' + stream_year_first = 2000 + stream_year_last = 2000 / &papi_inparm papi_ctr1_str = "PAPI_FP_OPS" From adbc3af36f79a210d7f544978c40fb5df55d1a2f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 3 Dec 2019 13:22:49 -0700 Subject: [PATCH 0465/1973] Remove submodules (esmf, pfunit) --- external/esmf | 1 - external/pfunit | 1 - lilac/.gitmodules | 8 -------- 3 files changed, 10 deletions(-) delete mode 160000 external/esmf delete mode 160000 external/pfunit diff --git a/external/esmf b/external/esmf deleted file mode 160000 index 3a9c142262..0000000000 --- a/external/esmf +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3a9c142262b247189abd8dbca0d63e6dbb3a8207 diff --git a/external/pfunit b/external/pfunit deleted file mode 160000 index 14339d668c..0000000000 --- a/external/pfunit +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 14339d668c3f7440c408422dea68d750ee59ad9d diff --git a/lilac/.gitmodules b/lilac/.gitmodules index 3836c21e6b..e69de29bb2 100644 --- a/lilac/.gitmodules +++ b/lilac/.gitmodules @@ -1,8 +0,0 @@ -[submodule "external/pfunit"] - path = external/pfunit - url = https://github.com/laristra/pfunit.git - shallow = true -[submodule "external/esmf"] - path = external/esmf - url = https://git.code.sf.net/p/esmf/esmf - shallow = true From 1344b414b1e49c5e4956efdc105c39708f664ff7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 3 Dec 2019 13:23:10 -0700 Subject: [PATCH 0466/1973] Remove now-empty .gitmodules file --- lilac/.gitmodules | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 lilac/.gitmodules diff --git a/lilac/.gitmodules b/lilac/.gitmodules deleted file mode 100644 index e69de29bb2..0000000000 From 8fae5d70047526682b769e4e4e0604121b9058f6 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 3 Dec 2019 13:48:15 -0700 Subject: [PATCH 0467/1973] Stop bringing in lilac as an external We're going to include lilac directly rather than as an external. --- .gitignore | 1 - Externals.cfg | 7 ------- 2 files changed, 8 deletions(-) diff --git a/.gitignore b/.gitignore index 9a16cf5eb1..4a5672d970 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ manage_externals.log /tools/PTCLM/ /cime/ /components/ -/lilac # ignore svn directories **/.svn/** diff --git a/Externals.cfg b/Externals.cfg index 72d1e54b5c..9f124b5043 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -4,13 +4,6 @@ protocol = externals_only externals = Externals_CLM.cfg required = True -[lilac] -local_path = lilac -protocol = git -repo_url = https://github.com/NCAR/lilac.git -branch = master -required = True - [cism] local_path = components/cism protocol = git From 7a61923b1bd2353c6bcfcea8b87d2767a39552c4 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 3 Dec 2019 20:03:49 -0700 Subject: [PATCH 0468/1973] added lilac as an external --- Externals.cfg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Externals.cfg b/Externals.cfg index 9f124b5043..72d1e54b5c 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -4,6 +4,13 @@ protocol = externals_only externals = Externals_CLM.cfg required = True +[lilac] +local_path = lilac +protocol = git +repo_url = https://github.com/NCAR/lilac.git +branch = master +required = True + [cism] local_path = components/cism protocol = git From b91023e7ec6db94cef6ed911ef70ddc1bf7f5067 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 3 Dec 2019 20:40:18 -0700 Subject: [PATCH 0469/1973] Revert "added lilac as an external" This reverts commit 7a61923b1bd2353c6bcfcea8b87d2767a39552c4. --- Externals.cfg | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 72d1e54b5c..9f124b5043 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -4,13 +4,6 @@ protocol = externals_only externals = Externals_CLM.cfg required = True -[lilac] -local_path = lilac -protocol = git -repo_url = https://github.com/NCAR/lilac.git -branch = master -required = True - [cism] local_path = components/cism protocol = git From e1eeadff5f1dd10073b6fcc9153fec6272d0c07a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 3 Dec 2019 21:03:22 -0700 Subject: [PATCH 0470/1973] Remove top-level dot files in lilac These files (.gitignore, .dockerignore, .travis.yml) served a purpose when lilac was its own repository, but I think they no longer serve their intended purpose now that lilac is inlined into the ctsm repository. However, it's possible that we may want to bring back some of the contents of these at some point, e.g., bringing them to the top level of CTSM. --- lilac/.dockerignore | 329 -------------------------------------------- lilac/.gitignore | 17 --- lilac/.travis.yml | 21 --- 3 files changed, 367 deletions(-) delete mode 100644 lilac/.dockerignore delete mode 100644 lilac/.gitignore delete mode 100644 lilac/.travis.yml diff --git a/lilac/.dockerignore b/lilac/.dockerignore deleted file mode 100644 index 2fc5d54e03..0000000000 --- a/lilac/.dockerignore +++ /dev/null @@ -1,329 +0,0 @@ -# Created by .ignore support plugin (hsz.mobi) - -### Vim template -# swap -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -# session -Session.vim -# temporary -.netrwhist -*~ - -# auto-generated tag files -tags - -### Cpp template -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - -### CMake template -CMakeCache.txt -CMakeFiles -CMakeScripts -Makefile -cmake_install.cmake -install_manifest.txt -CTestTestfile.cmake - -### Emacs template -# -*- mode: gitignore; -*- -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -*.elc -auto-save-list -tramp -.\#* - -# Org-mode -.org-id-locations -*_archive - -# flymake-mode -*_flymake.* - -# eshell files -/eshell/history -/eshell/lastdir - -# elpa packages -/elpa/ - -# reftex files -*.rel - -# AUCTeX auto folder -/auto/ - -# cask packages -.cask/ -dist/ - -# Flycheck -flycheck_*.el - -# server auth directory -/server/ - -# projectiles files -.projectile### VirtualEnv template -# Virtualenv -# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ -.Python -[Bb]in -[Ii]nclude -[Ll]ib -[Ll]ib64 -[Ll]ocal -[Ss]cripts -pyvenv.cfg -.venv -pip-selfcheck.json - -### Linux template -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -### C template -# Object files -*.o -*.ko -*.obj -*.elf - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su - -### Windows template -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -### KDevelop4 template -*.kdev4 -.kdev4/ - -### Python template -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# IPython Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# dotenv -.env - -# virtualenv -venv/ -ENV/ - -# Spyder project settings -.spyderproject - -# Rope project settings -.ropeproject - -### Xcode template -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## Build generated -build/ -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata/ - -## Other -*.moved-aside -*.xccheckout -*.xcscmblueprint - -### NodeJS template -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git -node_modules - -build/ \ No newline at end of file diff --git a/lilac/.gitignore b/lilac/.gitignore deleted file mode 100644 index 6e5803401e..0000000000 --- a/lilac/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -# directories that are checked out by the tool -cime/ -cime_config/ -components/ - -# generated local files -*.log - -# editor files -*~ -*.bak - -# generated python files -*.pyc - -build/ -_build/ diff --git a/lilac/.travis.yml b/lilac/.travis.yml deleted file mode 100644 index 40f2c1981a..0000000000 --- a/lilac/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: cpp -sudo: required -dist: trusty -notifications: - email: false - -services: - - docker - -before_install: - - docker version - - docker-compose version - -install: - - docker-compose build lilac - -before_script: - - docker-compose images - -script: - - docker run -t lilac From fd921b659bc6d29c5d434e356e175dc8ded4717a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 3 Dec 2019 21:16:41 -0700 Subject: [PATCH 0471/1973] Fix link for new forums --- .github/ISSUE_TEMPLATE/02_support_needed.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/02_support_needed.md b/.github/ISSUE_TEMPLATE/02_support_needed.md index d3c69aaf6a..18f5597abc 100644 --- a/.github/ISSUE_TEMPLATE/02_support_needed.md +++ b/.github/ISSUE_TEMPLATE/02_support_needed.md @@ -8,7 +8,7 @@ about: Ask for help with using CTSM We have limited staff and ability to provide support. Here are some resources that might provide help: - User's Guide: https://escomp.github.io/ctsm-docs/doc/build/html/users_guide/index.html -- CLM Forum: https://bb.cgd.ucar.edu/forums/land-modeling-clm +- CESM's land modeling forum: https://xenforo.cgd.ucar.edu/cesm/ - README files amongst the source code - GitHub CTSM issues: https://github.com/escomp/ctsm/issues/ - Also make sure this issue is unique to CTSM and not really an issue with CESM or CIME From bc7d02fb2c5caa22ba97017c94820b5c64c94fc7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 4 Dec 2019 10:54:44 -0700 Subject: [PATCH 0472/1973] Remove lilac readme and license files These are no longer needed now that lilac has been folded in to ctsm. --- lilac/LICENSE | 34 ---------------------------------- lilac/README.md | 12 ------------ 2 files changed, 46 deletions(-) delete mode 100644 lilac/LICENSE delete mode 100644 lilac/README.md diff --git a/lilac/LICENSE b/lilac/LICENSE deleted file mode 100644 index 0ba25429ac..0000000000 --- a/lilac/LICENSE +++ /dev/null @@ -1,34 +0,0 @@ -Copyright (c) 2018, University Corporation for Atmospheric Research (UCAR) -All rights reserved. - -Developed by: - University Corporation for Atmospheric Research - National Center for Atmospheric Research - https://www2.cesm.ucar.edu/working-groups/sewg - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the "Software"), -to deal with the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the documentation - and/or other materials provided with the distribution. - - Neither the names of [Name of Development Group, UCAR], - nor the names of its contributors may be used to endorse or promote - products derived from this Software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/lilac/README.md b/lilac/README.md deleted file mode 100644 index 4184eb80d3..0000000000 --- a/lilac/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# LILAC - -LILAC, Lightweight Infrastructure for Land Atmosphere Coupling. - -[![Build Status](https://travis-ci.org/jhamman/lilac.svg?branch=master)](https://travis-ci.org/jhamman/lilac) -[![Documentation Status](https://readthedocs.org/projects/ctsm-lilac/badge/?version=latest)](https://ctsm-lilac.readthedocs.io/en/latest/?badge=latest) - -Currently working on: - - Setting up CI and CMake - - setup/test style (borrow from geostreams) - - setup unit tests with pfunit - From 2f434bdef15baf1daa19828e217af2062d943613 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 5 Dec 2019 05:20:44 -0700 Subject: [PATCH 0473/1973] Add some information to README.lilac --- README.lilac | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/README.lilac b/README.lilac index 615ca71149..daa7f01db4 100644 --- a/README.lilac +++ b/README.lilac @@ -5,16 +5,17 @@ SRC_ROOT is where ctsm is checked out - > git clone https://github.com/mvertens/ctsm.git + > git clone https://github.com/ESCOMP/ctsm.git > cd ctsm (this is $SRCROOT) - > git checkout mvertens/lilac_cap + > git checkout lilac_cap > ./manage_externals/checkout_externals -v 3) build the ctsm/lilac library using a CIME case > cd $SRCROOT/cime/scripts - > ./create_newcase --case /glade/scratch/mvertens/test_lilac --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver mct - > cd /glade/scratch/mvertens/test_lilac + > export CASEDIR=/glade/scratch/mvertens/test_lilac + > ./create_newcase --case $CASEDIR --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver mct + > cd $CASEDIR > ./xmlchange USE_ESMF_LIB=TRUE > ./xmlchange DEBUG=TRUE > remove the following lines from env_mach_specific: @@ -42,10 +43,14 @@ > ./case.setup > ./case.build + The last step will fail in building the executable; that's okay: all + we need from it is the component libraries. + 4) To build the atm_driver executable on cheyenne - edit the Makefile to change BLD_DIR > cd $SRCROOT/lilac/atm_driver > make clean + > source $CASEDIR/.env_mach_specific.sh > make atm_driver 4) to generate the input namelists @@ -59,8 +64,28 @@ THIS ONLY NEEDS TO BE DONE ONCE to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory -5) run the atm_driver on cheyenne +5) write CTSM history files every time step + + insert the following after the initial '&clm_inparm' in lnd_in: + + hist_nhtfrq = 1 + hist_mfilt = 1 + hist_ndens = 1 + +6) run the atm_driver on cheyenne > qsub cheyenne.sub +7) compare with latest baselines + + use something like this to compare the last clm and last cpl hist files: + + > basedir=/glade/p/cgd/tss/ctsm_baselines/lilac_20191202 + > cprnc test_lilac.clm2.h0.2000-01-02-00000.nc $basedir/test_lilac.clm2.h0.2000-01-02-00000.nc | tail -30 + > cprnc test_lilac.cpl.hi.2000-01-02-00000.nc $basedir/test_lilac.cpl.hi.2000-01-02-00000.nc | tail -30 + +8) if there are differences, and those are intentional, then create new + baselines + copy all *.nc files, plus ctsm.cfg, lilac_in and lnd_in to the + baseline directory From 36d46d11a7d9ccb8599d20a9de3b84e19b1cb7f0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 5 Dec 2019 07:03:42 -0700 Subject: [PATCH 0474/1973] Building lilac source: use lnd_root rather than SRCROOT --- cime_config/buildlib | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index a7d8ac63d6..e382668c15 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -46,8 +46,6 @@ def _main_func(): lilac_mode = _get_osvar('LILAC_MODE', 'off') if lilac_mode == 'on': driver = "lilac" - ctsm_root = case.get_value("SRCROOT") - lilac_src = os.path.join(ctsm_root,"lilac","src") #------------------------------------------------------- # create Filepath file @@ -73,7 +71,7 @@ def _main_func(): os.path.join(lnd_root,"src","cpl",driver)] if lilac_mode == 'on': - paths.append(lilac_src) + paths.append(os.path.join(lnd_root,"lilac","src")) with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) From 5f1683a694537b8e898a10fcfd5b60f459b08cbc Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 5 Dec 2019 12:07:18 -0700 Subject: [PATCH 0475/1973] Update build to use new nuopc driver capabilities --- README.lilac | 50 +++++++++++---------------------------- lilac/atm_driver/Makefile | 15 ++++++------ 2 files changed, 22 insertions(+), 43 deletions(-) diff --git a/README.lilac b/README.lilac index daa7f01db4..93d74413a3 100644 --- a/README.lilac +++ b/README.lilac @@ -14,46 +14,24 @@ > cd $SRCROOT/cime/scripts > export CASEDIR=/glade/scratch/mvertens/test_lilac - > ./create_newcase --case $CASEDIR --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver mct + > ./create_newcase --case $CASEDIR --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver nuopc > cd $CASEDIR - > ./xmlchange USE_ESMF_LIB=TRUE > ./xmlchange DEBUG=TRUE - > remove the following lines from env_mach_specific: - esmf_libs - - esmf-7.1.0r-defio-mpi-g - - - esmf-7.1.0r-defio-mpi-O - - - esmf-7.1.0r-ncdfio-uni-g - - - esmf-7.1.0r-ncdfio-uni-O - - > remove the string comp_interface="nuopc" from the following lines - - - > make the following changes - /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libO/Linux.intel.64.mpt.default/esmf.mk to - /glade/work/turuncu/ESMF/8.0.0b50/lib/libO/Linux.intel.64.mpt.default/esmf.mk - /glade/work/dunlap/ESMF-INSTALL/8.0.0bs38/lib/libg/Linux.intel.64.mpt.default/esmf.mk to - /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk - > ./case.setup - > ./case.build - - The last step will fail in building the executable; that's okay: all - we need from it is the component libraries. - -4) To build the atm_driver executable on cheyenne - edit the Makefile to change BLD_DIR + > ./case.setup + > ./case.build --sharedlib-only + +4) To build the atm_driver executable on cheyenne + + - First, edit the Makefile to change BLD_DIR + + - Then, build with: > cd $SRCROOT/lilac/atm_driver > make clean > source $CASEDIR/.env_mach_specific.sh > make atm_driver -4) to generate the input namelists +5) to generate the input namelists - to customize the generated namelist - edit the file ctsm.cfg (in this directory) - to create the ctsm namelist FROM THIS DIRECTORY: @@ -64,7 +42,7 @@ THIS ONLY NEEDS TO BE DONE ONCE to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory -5) write CTSM history files every time step +6) write CTSM history files every time step insert the following after the initial '&clm_inparm' in lnd_in: @@ -72,11 +50,11 @@ hist_mfilt = 1 hist_ndens = 1 -6) run the atm_driver on cheyenne +7) run the atm_driver on cheyenne > qsub cheyenne.sub -7) compare with latest baselines +8) compare with latest baselines use something like this to compare the last clm and last cpl hist files: @@ -84,7 +62,7 @@ > cprnc test_lilac.clm2.h0.2000-01-02-00000.nc $basedir/test_lilac.clm2.h0.2000-01-02-00000.nc | tail -30 > cprnc test_lilac.cpl.hi.2000-01-02-00000.nc $basedir/test_lilac.cpl.hi.2000-01-02-00000.nc | tail -30 -8) if there are differences, and those are intentional, then create new +9) if there are differences, and those are intentional, then create new baselines copy all *.nc files, plus ctsm.cfg, lilac_in and lnd_in to the diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 220741e3a3..9ae826927f 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -10,17 +10,18 @@ ESMFMKFILE = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.def ESMF_LIB_DIR = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default include $(ESMFMKFILE) -BLD_DIR = /glade/scratch/mvertens/test_lilac/bld +BLD_DIR = /glade/scratch/mvertens/test_lilac/bld -CTSM_BLD_DIR = $(BLD_DIR)/intel/mpt/debug/nothreads/mct/mct/esmf -MCT_LIB = $(BLD_DIR)/intel/mpt/debug/nothreads/mct/lib -SHR_LIB = $(BLD_DIR)/intel/mpt/debug/nothreads/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/lib -SHR_INC = $(BLD_DIR)/intel/mpt/debug/mct/mct/esmf/c1a1l1i1o1r1g1w1i1e1/csm_share/ -CTSM_INC = $(CTSM_BLD_DIR)/clm/obj +SHARED_BLD_DIR = $(BLD_DIR)/intel/mpt/debug/nothreads/nuopc +CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf +DEPENDS_LIB = $(SHARED_BLD_DIR)/lib +SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib +SHR_INC = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/csm_share +CTSM_INC = $(CTSM_BLD_DIR)/clm/obj FFLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free -LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(MCT_LIB) -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib +LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib INCLUDES = -I$(CTSM_BLD_DIR)/include -I$(SHR_INC) -I$(CTSM_INC) From e98234b960b0fd46610040a602ffe2df6cd56e77 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 5 Dec 2019 12:20:01 -0700 Subject: [PATCH 0476/1973] Get BLDDIR from an environment variable It was getting to be a pain to have to keep changing the Makefile. --- README.lilac | 4 +++- lilac/atm_driver/Makefile | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.lilac b/README.lilac index 93d74413a3..7cfe3b2429 100644 --- a/README.lilac +++ b/README.lilac @@ -22,7 +22,9 @@ 4) To build the atm_driver executable on cheyenne - - First, edit the Makefile to change BLD_DIR + - First, set BLDDIR - e.g.: + + > export BLDDIR=/glade/scratch/sacks/test_lilac_1205a/bld - Then, build with: diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 9ae826927f..69de97f6fe 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -4,15 +4,16 @@ #================================================================================ # Define directory paths +# +# Note: You must set the environment BLDDIR before running this - e.g. +# export BLDDIR=/glade/scratch/sacks/test_lilac_1205a/bld #================================================================================ ESMFMKFILE = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk ESMF_LIB_DIR = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default include $(ESMFMKFILE) -BLD_DIR = /glade/scratch/mvertens/test_lilac/bld - -SHARED_BLD_DIR = $(BLD_DIR)/intel/mpt/debug/nothreads/nuopc +SHARED_BLD_DIR = $(BLDDIR)/intel/mpt/debug/nothreads/nuopc CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf DEPENDS_LIB = $(SHARED_BLD_DIR)/lib SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib From 63beebb3f37b6b01da070f2a310ba9586095dd6d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 5 Dec 2019 12:20:36 -0700 Subject: [PATCH 0477/1973] pio is now split into piof and pioc --- lilac/atm_driver/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 69de97f6fe..d17925627c 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -22,7 +22,7 @@ CTSM_INC = $(CTSM_BLD_DIR)/clm/obj FFLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free -LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpio -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib +LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib INCLUDES = -I$(CTSM_BLD_DIR)/include -I$(SHR_INC) -I$(CTSM_INC) From 507c7507ceb3a42fa774d1ca1e570fb6d6d8940d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 5 Dec 2019 12:52:17 -0700 Subject: [PATCH 0478/1973] updates to git mosart working in lilac --- cime_config/buildlib | 7 +- lilac/atm_driver/atm_driver.F90 | 2 +- {lilac_config => lilac/atm_driver}/lilac_in | 21 +- lilac/src/lilac_cpl.F90 | 469 +++++++++++++++----- lilac/src/lilac_history.F90 | 144 +++--- lilac/src/lilac_mod.F90 | 298 ++++++++++--- lilac/src/lilac_utils.F90 | 40 +- lilac_config/buildnml | 4 - src/cpl/lilac/lnd_comp_esmf.F90 | 271 ++++++----- src/cpl/lilac/lnd_import_export.F90 | 452 ++++++++++--------- 10 files changed, 1105 insertions(+), 603 deletions(-) rename {lilac_config => lilac/atm_driver}/lilac_in (86%) diff --git a/cime_config/buildlib b/cime_config/buildlib index 55c5254c8d..dee71eba92 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -45,7 +45,6 @@ def _main_func(): lilac_mode = _get_osvar('LILAC_MODE', 'off') if lilac_mode == 'on': ctsm_root = case.get_value("SRCROOT") - lilac_src = os.path.join(ctsm_root,"lilac","src") #------------------------------------------------------- # create Filepath file @@ -71,8 +70,12 @@ def _main_func(): if lilac_mode == 'off': paths.append(os.path.join(lnd_root,"src","cpl","mct")) else: - paths.append(lilac_src) paths.append(os.path.join(lnd_root,"src","cpl","lilac")) + lilac_src = os.path.join(ctsm_root,"lilac","src") + paths.append(lilac_src) + mosart_src = os.path.join(ctsm_root,"components","mosart","src") + paths.append(os.path.join(mosart_src,"riverroute")) + paths.append(os.path.join(mosart_src,"cpl","lilac")) with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index f13069396d..a9622e00b0 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -144,7 +144,7 @@ program atm_driver if (mytask == 0 ) then print *, " initializing lilac " end if - call lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & + call lilac_init(comp_comm, atm_mesh_file, atm_global_index, atm_lons, atm_lats, & atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) diff --git a/lilac_config/lilac_in b/lilac/atm_driver/lilac_in similarity index 86% rename from lilac_config/lilac_in rename to lilac/atm_driver/lilac_in index 7e738d65d6..b51fbe35fc 100644 --- a/lilac_config/lilac_in +++ b/lilac/atm_driver/lilac_in @@ -1,17 +1,18 @@ -&lnd_mesh_inparm +&lilac_run_input + starttype = 'startup' + caseid = 'test_lilac' +/ +&lilac_lnd_input lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' / +&lilac_rof_input + rof_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/r05_nomask_c110308_ESMFmesh.nc' +/ &atmaero_stream stream_fldfilename='/glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc' stream_year_first = 2000 stream_year_last = 2000 / -&papi_inparm - papi_ctr1_str = "PAPI_FP_OPS" - papi_ctr2_str = "PAPI_NO_CTR" - papi_ctr3_str = "PAPI_NO_CTR" - papi_ctr4_str = "PAPI_NO_CTR" -/ &pio_default_inparm pio_async_interface = .false. pio_blocksize = -1 @@ -26,6 +27,12 @@ pio_rearr_comm_max_pend_req_io2comp = 64 pio_rearr_comm_type = "p2p" / +&papi_inparm + papi_ctr1_str = "PAPI_FP_OPS" + papi_ctr2_str = "PAPI_NO_CTR" + papi_ctr3_str = "PAPI_NO_CTR" + papi_ctr4_str = "PAPI_NO_CTR" +/ &prof_inparm profile_add_detail = .false. profile_barrier = .false. diff --git a/lilac/src/lilac_cpl.F90 b/lilac/src/lilac_cpl.F90 index db15c4d60d..86167e927b 100644 --- a/lilac/src/lilac_cpl.F90 +++ b/lilac/src/lilac_cpl.F90 @@ -1,26 +1,34 @@ module lilac_cpl !----------------------------------------------------------------------- - ! Module containing all routines for both couplers - ! 1- coupler 1 : atm ---> lnd (cpl_atm2lnd) - ! 2- coupler 2 : lnd ---> atm (cpl_lnd2atm) + ! Module containing all routines for couplers !----------------------------------------------------------------------- use ESMF - use shr_sys_mod, only : shr_sys_abort + use shr_sys_mod , only : shr_sys_abort + use lilac_methods, only : chkerr implicit none private public :: cpl_atm2lnd_register public :: cpl_lnd2atm_register + public :: cpl_lnd2rof_register + public :: cpl_rof2lnd_register type(ESMF_RouteHandle) :: rh_atm2lnd type(ESMF_RouteHandle) :: rh_lnd2atm + type(ESMF_RouteHandle) :: rh_lnd2rof + type(ESMF_RouteHandle) :: rh_rof2lnd + integer :: mytask + integer, parameter :: ispval_mask = -987987 ! spval for RH mask values character(*), parameter :: modname = "lilac_cpl" + character(*), parameter :: u_FILE_u = & + __FILE__ + !====================================================================== contains !====================================================================== @@ -39,9 +47,9 @@ subroutine cpl_atm2lnd_register(cplcomp, rc) rc = ESMF_SUCCESS call ESMF_VMGetGlobal(vm=vm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_VMGet(vm, localPet=mytask, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return if (mytask == 0) then print *, "in cpl_atm2lnd_register routine" @@ -49,7 +57,7 @@ subroutine cpl_atm2lnd_register(cplcomp, rc) ! Register the callback routines. ! Set the entry points for coupler ESMF Component methods - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine= cpl_atm2lnd_init, rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine=cpl_atm2lnd_init, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_atm2lnd_run , rc=rc) @@ -57,6 +65,7 @@ subroutine cpl_atm2lnd_register(cplcomp, rc) call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_atm2lnd_final, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + end subroutine cpl_atm2lnd_register !====================================================================== @@ -77,16 +86,83 @@ subroutine cpl_lnd2atm_register(cplcomp, rc) ! Register the callback routines. ! Set the entry points for coupler ESMF Component methods - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, cpl_lnd2atm_init, rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine=cpl_lnd2atm_init, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_lnd2atm_run , rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN, userRoutine=cpl_lnd2atm_run , rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_lnd2atm_final, rc=rc) + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE, userRoutine=cpl_lnd2atm_final, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + end subroutine cpl_lnd2atm_register +!====================================================================== + + subroutine cpl_lnd2rof_register(cplcomp, rc) + + ! input/output variables + type(ESMF_CplComp ) :: cplcomp + integer, intent(out ) :: rc + + ! local variables + type(ESMF_VM) :: vm + character(len=*) , parameter :: subname=trim(modname ) //' : [cpl_atm2lnd_register] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_VMGetGlobal(vm=vm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_VMGet(vm, localPet=mytask, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if (mytask == 0) then + print *, "in cpl_atm2lnd_register routine" + end if + + ! Register the callback routines. + ! Set the entry points for coupler ESMF Component methods + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine=cpl_lnd2rof_init, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_lnd2rof_run , rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_lnd2rof_final, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + end subroutine cpl_lnd2rof_register + +!====================================================================== + + subroutine cpl_rof2lnd_register(cplcomp, rc) + + type(ESMF_CplComp) :: cplcomp + integer, intent(out ) :: rc + + ! local variables + character(len=* ) , parameter :: subname=trim(modname ) //' : [cpl_rof2lnd_register] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS + if (mytask == 0) then + print *, "in cpl_rof2lnd_register routine" + end if + + ! Register the callback routines. + ! Set the entry points for coupler ESMF Component methods + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_INITIALIZE, userRoutine=cpl_rof2lnd_init, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_RUN , userRoutine=cpl_rof2lnd_run , rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + call ESMF_CplCompSetEntryPoint(cplcomp, ESMF_METHOD_FINALIZE , userRoutine=cpl_rof2lnd_final, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + end subroutine cpl_rof2lnd_register + !====================================================================== subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) @@ -101,10 +177,6 @@ subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) ! local variables type (ESMF_FieldBundle) :: import_fieldbundle type (ESMF_FieldBundle) :: export_fieldbundle - integer :: n - integer :: fieldcount - character(len=128), allocatable :: fieldlist(:) - character(len=128) :: cvalue character(len=*), parameter :: subname=trim(modname) //': [cpl_atm2lnd_init] ' !--------------------------------------------------- @@ -114,56 +186,15 @@ subroutine cpl_atm2lnd_init(cplcomp, importState, exportState, clock, rc) end if call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_StateGet(importState, "a2c_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - - call ESMF_FieldBundleGet(import_fieldbundle, fieldCount=fieldCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - write(cvalue,*) fieldcount - call ESMF_LogWrite(subname//" a2c_fb field count = "//trim(cvalue), ESMF_LOGMSG_INFO) - allocate(fieldlist(fieldcount)) - call ESMF_FieldBundleGet(import_fieldbundle, fieldNameList=fieldlist, rc=rc) - do n = 1,fieldCount - write(cvalue,*) n - call ESMF_LogWrite(subname//" a2c_fb field "//trim(cvalue)//' = '//trim(fieldlist(n)), ESMF_LOGMSG_INFO) - end do - deallocate(fieldlist) - if (mytask == 0) then - print *, ' a2c_fb field count = ',fieldcount - end if - - call ESMF_StateGet(exportState, "c2l_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - - call ESMF_FieldBundleGet(export_fieldbundle, fieldCount=fieldCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - write(cvalue,*) fieldcount - call ESMF_LogWrite(subname//" c2l_fb field count = "//trim(cvalue), ESMF_LOGMSG_INFO) - allocate(fieldlist(fieldcount)) - call ESMF_FieldBundleGet(export_fieldbundle, fieldNameList=fieldlist, rc=rc) - do n = 1,fieldCount - write(cvalue,*) n - call ESMF_LogWrite(subname//" c2l_fb field "//trim(cvalue)//' = '//trim(fieldlist(n)), ESMF_LOGMSG_INFO) - end do - deallocate(fieldlist) - if (mytask == 0) then - print *, ' c2l_fb field count = ',fieldcount - end if - - if (mytask == 0) then - print *, "PRINTING FIELDBUNDLES from atm->lnd" - call ESMF_FieldBundlePrint (import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_FieldBundlePrint (export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - end if + call cpl_get_fieldbundle(importState, 'a2c_fb', import_fieldbundle, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call cpl_get_fieldbundle(exportState, 'c2l_fb_atm', export_fieldbundle, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort('error in initializing cpl_atm2lnd') - end if + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing cpl_atm2lnd') - call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"cpl_atm2lnd_init finished!", ESMF_LOGMSG_INFO) end subroutine cpl_atm2lnd_init @@ -180,69 +211,118 @@ subroutine cpl_lnd2atm_init(cplcomp, importState, exportState, clock, rc) ! local variables type (ESMF_FieldBundle) :: import_fieldbundle type (ESMF_FieldBundle) :: export_fieldbundle - integer :: n - integer :: fieldcount - character(len=128), allocatable :: fieldlist(:) - character(len=128) :: cvalue character(len=*) , parameter :: subname=trim(modname ) //': [cpl_lnd2atm_init] ' !--------------------------------------------------- rc = ESMF_SUCCESS - if (mytask == 0) then print *, "Coupler for land to atmosphere initialize routine called" end if call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call cpl_get_fieldbundle(importState, 'l2c_fb_atm', import_fieldbundle, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call cpl_get_fieldbundle(exportState, 'c2a_fb', export_fieldbundle, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldBundleGet(import_fieldbundle, fieldCount=fieldCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - write(cvalue,*) fieldcount - call ESMF_LogWrite(subname//" l2c_fb field count = "//trim(cvalue), ESMF_LOGMSG_INFO) - allocate(fieldlist(fieldcount)) - call ESMF_FieldBundleGet(import_fieldbundle, fieldNameList=fieldlist, rc=rc) - do n = 1,fieldCount - write(cvalue,*) n - call ESMF_LogWrite(subname//" l2c_fb field "//trim(cvalue)//' = '//trim(fieldlist(n)), ESMF_LOGMSG_INFO) - end do - deallocate(fieldlist) + call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing cpl_lnd2atm') + + call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) + + end subroutine cpl_lnd2atm_init + +!====================================================================== + + subroutine cpl_lnd2rof_init(cplcomp, importState, exportState, clock, rc) + + ! input/output variables + type (ESMF_CplComp ) :: cplcomp + type (ESMF_State ) :: importState + type (ESMF_State ) :: exportState + type (ESMF_Clock ) :: clock + integer, intent(out ) :: rc + + ! local variables + type (ESMF_FieldBundle) :: import_fieldbundle + type (ESMF_FieldBundle) :: export_fieldbundle + integer :: srcTermProcessing_Value = 0 ! should this be a module variable? + character(len=*), parameter :: subname=trim(modname) //': [cpl_lnd2rof_init] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS if (mytask == 0) then - print *, ' l2c_fb field count = ',fieldcount + print *, "Coupler for atmosphere to land initialize routine called" end if + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call cpl_get_fieldbundle(importState, 'l2c_fb_rof', import_fieldbundle, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call cpl_get_fieldbundle(exportState, 'c2r_fb', export_fieldbundle, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2rof, & + srcMaskValues=(/ispval_mask/), dstMaskValues=(/ispval_mask/), & + regridmethod=ESMF_REGRIDMETHOD_CONSERVE, & + normType=ESMF_NORMTYPE_FRACAREA, & + srcTermProcessing=srcTermProcessing_Value, & + ignoreDegenerate=.true., & + unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, & + rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing cpl_lnd2rof') + + call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) + + end subroutine cpl_lnd2rof_init + +!====================================================================== + + subroutine cpl_rof2lnd_init(cplcomp, importState, exportState, clock, rc) + + type (ESMF_CplComp ) :: cplcomp + type (ESMF_State ) :: importState + type (ESMF_State ) :: exportState + type (ESMF_Clock ) :: clock + integer, intent(out ) :: rc + + ! local variables + type (ESMF_FieldBundle) :: import_fieldbundle + type (ESMF_FieldBundle) :: export_fieldbundle + integer :: srcTermProcessing_Value = 0 ! should this be a module variable? + character(len=*) , parameter :: subname=trim(modname ) //': [cpl_rof2lnd_init] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS - call ESMF_FieldBundleGet(export_fieldbundle, fieldCount=fieldCount, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - write(cvalue,*) fieldcount - call ESMF_LogWrite(subname//" c2a_fb field count = "//trim(cvalue), ESMF_LOGMSG_INFO) - allocate(fieldlist(fieldcount)) - call ESMF_FieldBundleGet(export_fieldbundle, fieldNameList=fieldlist, rc=rc) - do n = 1,fieldCount - write(cvalue,*) n - call ESMF_LogWrite(subname//" c2a_fb field "//trim(cvalue)//' = '//trim(fieldlist(n)), ESMF_LOGMSG_INFO) - end do - deallocate(fieldlist) if (mytask == 0) then - print *, ' c2a_fb field count = ',fieldcount + print *, "Coupler for land to atmosphere initialize routine called" end if + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_FieldBundleRedistStore(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call shr_sys_abort('error in initializing cpl_lnd2atm') - end if + call cpl_get_fieldbundle(importState, 'r2c_fb', import_fieldbundle, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call cpl_get_fieldbundle(exportState, 'c2l_fb_rof', export_fieldbundle, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldBundleRegridStore(import_fieldbundle, export_fieldbundle, routehandle=rh_rof2lnd, & + srcMaskValues=(/ispval_mask/), dstMaskValues=(/ispval_mask/), & + regridmethod=ESMF_REGRIDMETHOD_CONSERVE, & + normType=ESMF_NORMTYPE_FRACAREA, & + srcTermProcessing=srcTermProcessing_Value, & + ignoreDegenerate=.true., & + unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, & + rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing cpl_rof2lnd') call ESMF_LogWrite(subname//"cpl init finished!", ESMF_LOGMSG_INFO) - end subroutine cpl_lnd2atm_init + end subroutine cpl_rof2lnd_init !====================================================================== subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) + ! input/output variables type(ESMF_CplComp) :: cplcomp type(ESMF_State) :: importState type(ESMF_State) :: exportState @@ -251,7 +331,7 @@ subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) ! local variables type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle - character(len=* ) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_run] ' + character(len=*) , parameter :: subname=trim(modname ) //': [cpl_atm2lnd_run] ' !--------------------------------------------------- rc = ESMF_SUCCESS @@ -261,15 +341,12 @@ subroutine cpl_atm2lnd_run(cplcomp, importState, exportState, clock, rc) call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) call ESMF_StateGet(importState, "a2c_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//" got a2c fieldbundle!", ESMF_LOGMSG_INFO) - - call ESMF_StateGet(exportState, "c2l_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - call ESMF_LogWrite(subname//" got c2l fieldbundle!", ESMF_LOGMSG_INFO) - + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(exportState, "c2l_fb_atm", export_fieldbundle, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldBundleRedist(import_fieldbundle, export_fieldbundle, routehandle=rh_atm2lnd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(subname//" regridding fieldbundles from atmos to land!", ESMF_LOGMSG_INFO) end subroutine cpl_atm2lnd_run @@ -295,19 +372,82 @@ subroutine cpl_lnd2atm_run(cplcomp, importState, exportState, clock, rc) end if call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) - call ESMF_StateGet(importState, "l2c_fb", import_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - + call ESMF_StateGet(importState, "l2c_fb_atm", import_fieldbundle, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_StateGet(exportState, "c2a_fb", export_fieldbundle, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldBundleRedist(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2atm, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//" regridding fieldbundles from land to atmos!", ESMF_LOGMSG_INFO) end subroutine cpl_lnd2atm_run +!====================================================================== + + subroutine cpl_lnd2rof_run(cplcomp, importState, exportState, clock, rc) + + ! input/output variables + type(ESMF_CplComp) :: cplcomp + type(ESMF_State) :: importState + type(ESMF_State) :: exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + character(len=* ) , parameter :: subname=trim(modname) //': [cpl_lnd2rof_run] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS + if (mytask == 0) then + print *, "Running cpl_lnd2rof_run" + end if + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) + + call ESMF_StateGet(importState, "l2c_fb_rof", import_fieldbundle, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(exportState, "c2r_fb", export_fieldbundle, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_lnd2rof, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_LogWrite(subname//" regridding fieldbundles from land to river!", ESMF_LOGMSG_INFO) + + end subroutine cpl_lnd2rof_run + +!====================================================================== + + subroutine cpl_rof2lnd_run(cplcomp, importState, exportState, clock, rc) + + type(ESMF_CplComp) :: cplcomp + type(ESMF_State) :: importState + type(ESMF_State) :: exportState + type(ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + type (ESMF_FieldBundle ) :: import_fieldbundle, export_fieldbundle + character(len=*) , parameter :: subname=trim(modname) //': [cpl_rof2lnd_run] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS + if (mytask == 0) then + print *, "Running cpl_rof2lnd_run" + end if + call ESMF_LogWrite(subname//"-----------------!", ESMF_LOGMSG_INFO) + + call ESMF_StateGet(importState, "r2c_fb", import_fieldbundle, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(exportState, "c2l_fb_rof", export_fieldbundle, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldBundleRegrid(import_fieldbundle, export_fieldbundle, routehandle=rh_rof2lnd, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_LogWrite(subname//" regridding fieldbundles from river to land!", ESMF_LOGMSG_INFO) + + end subroutine cpl_rof2lnd_run + !====================================================================== subroutine cpl_atm2lnd_final(cplcomp, importState, exportState, clock, rc) @@ -330,7 +470,7 @@ subroutine cpl_atm2lnd_final(cplcomp, importState, exportState, clock, rc) ! Only thing to do here is release redist (or regrid) and route handles call ESMF_FieldBundleRegridRelease (routehandle=rh_atm2lnd, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//" rh_atm2lnd route handle released!", ESMF_LOGMSG_INFO) @@ -356,10 +496,107 @@ subroutine cpl_lnd2atm_final(cplcomp, importState, exportState, clock, rc) ! Only thing to do here is release redist (or regrid) and route handles call ESMF_FieldBundleRegridRelease (routehandle=rh_lnd2atm , rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//" rh_lnd2atm route handle released!", ESMF_LOGMSG_INFO) end subroutine cpl_lnd2atm_final +!====================================================================== + + subroutine cpl_lnd2rof_final(cplcomp, importState, exportState, clock, rc) + + type (ESMF_CplComp) :: cplcomp + type (ESMF_State) :: importState + type (ESMF_State) :: exportState + type (ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + character(len=*) , parameter :: subname=trim(modname) //': [cpl_lnd2rof_final] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) + + ! Only thing to do here is release redist (or regrid) and route handles + call ESMF_FieldBundleRegridRelease (routehandle=rh_lnd2rof , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_LogWrite(subname//" rh_lnd2rof route handle released!", ESMF_LOGMSG_INFO) + + end subroutine cpl_lnd2rof_final + +!====================================================================== + + subroutine cpl_rof2lnd_final(cplcomp, importState, exportState, clock, rc) + + type (ESMF_CplComp) :: cplcomp + type (ESMF_State) :: importState + type (ESMF_State) :: exportState + type (ESMF_Clock) :: clock + integer, intent(out) :: rc + + ! local variables + character(len=*) , parameter :: subname=trim(modname) //': [cpl_rof2lnd_final] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_LogWrite(subname//"---------------------------------!", ESMF_LOGMSG_INFO) + + ! Only thing to do here is release redist (or regrid) and route handles + call ESMF_FieldBundleRegridRelease (routehandle=rh_rof2lnd , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_LogWrite(subname//" rh_rof2lnd route handle released!", ESMF_LOGMSG_INFO) + + end subroutine cpl_rof2lnd_final + +!====================================================================== + + subroutine cpl_get_fieldbundle(state, fbname, fieldbundle, rc) + + ! input/output variables + type(ESMF_State) :: state + character(len=*) :: fbname + type(ESMF_FieldBundle) :: fieldbundle + integer, intent(out) :: rc + + ! local variables + integer :: n + integer :: fieldcount + character(len=128), allocatable :: fieldlist(:) + character(len=128) :: cvalue + character(len=*), parameter :: subname=trim(modname) //': [cpl_get_fieldbundle] ' + !--------------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_StateGet(state, trim(fbname), fieldbundle, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_FieldBundleGet(fieldbundle, fieldCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + write(cvalue,*) fieldcount + call ESMF_LogWrite(subname//" trim(fbname)//' field count = "//trim(cvalue), ESMF_LOGMSG_INFO) + allocate(fieldlist(fieldcount)) + + call ESMF_FieldBundleGet(fieldbundle, fieldNameList=fieldlist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + do n = 1,fieldCount + write(cvalue,*) n + call ESMF_LogWrite(subname//trim(fbname)//" field "//trim(cvalue)//' = '//trim(fieldlist(n)), & + ESMF_LOGMSG_INFO) + end do + deallocate(fieldlist) + if (mytask == 0) then + print *, trim(fbname)//' field count = ',fieldcount + end if + + end subroutine cpl_get_fieldbundle + end module lilac_cpl diff --git a/lilac/src/lilac_history.F90 b/lilac/src/lilac_history.F90 index 69ce98ae00..b8e50b892b 100644 --- a/lilac/src/lilac_history.F90 +++ b/lilac/src/lilac_history.F90 @@ -1,7 +1,7 @@ module lilac_history !----------------------------------------------------------------------------- - ! Mediator Phases + ! LILAC history output !----------------------------------------------------------------------------- use ESMF @@ -18,6 +18,10 @@ module lilac_history use lilac_io , only : lilac_io_close, lilac_io_date2yyyymmdd, lilac_io_sec2hms use lilac_io , only : lilac_io_ymd2date + ! For global domains + ! TODO: need to generalize obtaining global domains via state attributes + use domainMod , only : ldomain + implicit none private @@ -88,50 +92,58 @@ end subroutine lilac_history_alarm_init !=============================================================================== - subroutine lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state, lnd2atm_a_state, clock, rc) + subroutine lilac_history_write(atm2cpl_state, lnd2cpl_state, rof2cpl_state, & + cpl2atm_state, cpl2lnd_state, cpl2rof_state, clock, rc) ! Write lilac history file ! input/output variables - type(ESMF_State) :: atm2lnd_a_state - type(ESMF_State) :: atm2lnd_l_state - type(ESMF_State) :: lnd2atm_l_state - type(ESMF_State) :: lnd2atm_a_state + type(ESMF_State) :: atm2cpl_state + type(ESMF_State) :: lnd2cpl_state + type(ESMF_State) :: rof2cpl_state + type(ESMF_State) :: cpl2atm_state + type(ESMF_State) :: cpl2lnd_state + type(ESMF_State) :: cpl2rof_state type(ESMF_Clock) :: clock integer, intent(out) :: rc ! local variables - type(ESMF_FieldBundle) :: c2a_fb , a2c_fb, c2l_fb, l2c_fb - type(ESMF_VM) :: vm - type(ESMF_Time) :: currtime - type(ESMF_Time) :: reftime - type(ESMF_Time) :: starttime - type(ESMF_Time) :: nexttime - type(ESMF_TimeInterval) :: timediff ! Used to calculate curr_time - type(ESMF_Calendar) :: calendar ! calendar type - character(len=64) :: currtimestr - character(len=64) :: nexttimestr - character(CS) :: histavg_option ! Histavg option units - integer :: i,j,m,n,n1,ncnt - integer :: start_ymd ! Starting date YYYYMMDD - integer :: start_tod ! Starting time-of-day (s) - integer :: nx,ny ! global grid size - integer :: yr,mon,day,sec ! time units - real(r8) :: rval ! real tmp value - real(r8) :: dayssince ! Time interval since reference time - integer :: fk ! index - character(CL) :: time_units ! units of time variable - character(CL) :: case_name ! case name - character(CL) :: hist_file ! Local path to history filename - character(CS) :: cpl_inst_tag ! instance tag - character(CL) :: freq_option ! freq_option setting (ndays, nsteps, etc) - integer :: freq_n ! freq_n setting relative to freq_option - logical :: alarmIsOn ! generic alarm flag - real(r8) :: tbnds(2) ! CF1.0 time bounds - logical :: whead,wdata ! for writing restart/history cdf files - integer :: dbrc - integer :: iam - logical,save :: first_call = .true. + type(ESMF_FieldBundle) :: c2a_fb, a2c_fb + type(ESMF_FieldBundle) :: c2l_fb_atm, c2l_fb_rof, l2c_fb_atm, l2c_fb_rof + type(ESMF_FieldBundle) :: c2r_fb, r2c_fb + type(ESMF_VM) :: vm + type(ESMF_Time) :: currtime + type(ESMF_Time) :: reftime + type(ESMF_Time) :: starttime + type(ESMF_Time) :: nexttime + type(ESMF_TimeInterval) :: timediff ! Used to calculate curr_time + type(ESMF_Calendar) :: calendar ! calendar type + character(len=CS) :: currtimestr + integer :: nx_atm, ny_atm + integer :: nx_lnd, ny_lnd + integer :: nx_rof, ny_rof + character(len=CS) :: nexttimestr + character(CS) :: histavg_option ! Histavg option units + integer :: i,j,m,n,n1,ncnt + integer :: start_ymd ! Starting date YYYYMMDD + integer :: start_tod ! Starting time-of-day (s) + integer :: nx,ny ! global grid size + integer :: yr,mon,day,sec ! time units + real(r8) :: rval ! real tmp value + real(r8) :: dayssince ! Time interval since reference time + integer :: fk ! index + character(CL) :: time_units ! units of time variable + character(CL) :: case_name ! case name + character(CL) :: hist_file ! Local path to history filename + character(CS) :: cpl_inst_tag ! instance tag + character(CL) :: freq_option ! freq_option setting (ndays, nsteps, etc) + integer :: freq_n ! freq_n setting relative to freq_option + logical :: alarmIsOn ! generic alarm flag + real(r8) :: tbnds(2) ! CF1.0 time bounds + logical :: whead,wdata ! for writing restart/history cdf files + integer :: dbrc + integer :: iam + logical,save :: first_call = .true. character(len=*), parameter :: subname='(lilac_history_write)' !--------------------------------------- @@ -236,33 +248,61 @@ subroutine lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state if (ChkErr(rc,__LINE__,u_FILE_u)) return endif - nx = 72 ! hard-wire for now - ny = 46 ! hard-wire for now + nx_atm = ldomain%ni + ny_atm = ldomain%nj + nx_lnd = ldomain%ni + ny_lnd = ldomain%nj + nx_rof = 720 !TODO: remove this hard-wiring + ny_rof = 360 !TODO: remove this hard-wiring - call ESMF_StateGet(atm2lnd_a_state, 'a2c_fb', a2c_fb) ! from atm + call ESMF_StateGet(cpl2atm_state, 'c2a_fb', c2a_fb) ! to atm if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, a2c_fb, & - nx=nx, ny=ny, nt=1, whead=whead, wdata=wdata, pre='a2c_from_atm', rc=rc) + call lilac_io_write(hist_file, iam, c2a_fb, & + nx=nx_atm, ny=ny_atm, nt=1, whead=whead, wdata=wdata, pre='cpl_to_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateGet(atm2lnd_l_state, 'c2l_fb', c2l_fb) ! to land + call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_atm', c2l_fb_atm) ! to land if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2l_fb, & - nx=nx, ny=ny, nt=1, whead=whead, wdata=wdata, pre='c2l_to_land', rc=rc) + call lilac_io_write(hist_file, iam, c2l_fb_atm, & + nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='cpl_to_lnd_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateGet(lnd2atm_l_state, 'l2c_fb', l2c_fb) ! from land + ! call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_rof', c2l_fb_rof) ! to land + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call lilac_io_write(hist_file, iam, c2l_fb_rof, & + ! nx=nx_lnd, ny=ny_lnd, nt=1, whead=.true., wdata=wdata, pre='cpl_to_lnd_rof', rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(cpl2rof_state, 'c2r_fb', c2r_fb) ! to rof if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2l_fb, & - nx=nx, ny=ny, nt=1, whead=whead, wdata=wdata, pre='l2c_from_land', rc=rc) + call lilac_io_write(hist_file, iam, c2r_fb, & + nx=nx_rof, ny=ny_rof, nt=1, whead=whead, wdata=wdata, pre='cpl_to_rof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateGet(lnd2atm_a_state, 'c2a_fb', c2a_fb) ! to atm + call ESMF_StateGet(atm2cpl_state, 'a2c_fb', a2c_fb) ! from atm if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2l_fb, & - nx=nx, ny=ny, nt=1, whead=whead, wdata=wdata, pre='c2a_to_atm', rc=rc) + call lilac_io_write(hist_file, iam, a2c_fb, & + nx=nx_atm, ny=ny_atm, nt=1, whead=whead, wdata=wdata, pre='atm_to_cpl', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_atm', l2c_fb_atm) ! from land + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, l2c_fb_atm, & + nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_atm', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_rof', l2c_fb_rof) ! from land + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call lilac_io_write(hist_file, iam, l2c_fb_rof, & + ! nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_rof', rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! call ESMF_StateGet(rof2cpl_state, 'r2c_fb', r2c_fb) ! from rof + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call lilac_io_write(hist_file, iam, r2c_fb, & + ! nx=nx_rof, ny=ny_rof, nt=1, whead=whead, wdata=wdata, pre='rof_to_cpl', rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + enddo call lilac_io_close(hist_file, iam, rc=rc) @@ -282,6 +322,4 @@ subroutine lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state end subroutine lilac_history_write - !=============================================================================== - end module lilac_history diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 3da662f34f..da45c6219a 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -7,42 +7,52 @@ module lilac_mod ! know about ESMF !----------------------------------------------------------------------- + ! External libraries use ESMF + use mct_mod , only : mct_world_init + + ! shr code routines + use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 + use shr_sys_mod , only : shr_sys_abort ! lilac routines use lilac_io , only : lilac_io_init use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd use lilac_utils , only : gindex_atm, atm_mesh_filename use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register + use lilac_cpl , only : cpl_lnd2rof_register, cpl_rof2lnd_register use lilac_atmcap , only : lilac_atmos_register use lilac_atmaero , only : lilac_atmaero_init use lilac_atmaero , only : lilac_atmaero_interp use lilac_history , only : lilac_history_write use lilac_methods , only : chkerr - ! shr code routines - use shr_pio_mod , only : shr_pio_init1 - use shr_sys_mod , only : shr_sys_abort - ! ctsm routines use lnd_comp_esmf , only : lnd_register ! ctsm routine + ! mosart routines + use rof_comp_esmf , only : rof_register ! mosart routine + implicit none public :: lilac_init public :: lilac_run ! Gridded components and states in gridded components - type(ESMF_GridComp) :: atm_gcomp - type(ESMF_GridComp) :: lnd_gcomp + type(ESMF_GridComp) :: atm_gcomp + type(ESMF_GridComp) :: lnd_gcomp + type(ESMF_GridComp) :: rof_gcomp ! Coupler components - type(ESMF_CplComp) :: cpl_atm2lnd_comp - type(ESMF_CplComp) :: cpl_lnd2atm_comp + type(ESMF_CplComp) :: cpl_atm2lnd_comp + type(ESMF_CplComp) :: cpl_lnd2atm_comp + type(ESMF_CplComp) :: cpl_lnd2rof_comp + type(ESMF_CplComp) :: cpl_rof2lnd_comp ! States - type(ESMF_State) :: atm2lnd_a_state, atm2lnd_l_state - type(ESMF_State) :: lnd2atm_l_state, lnd2atm_a_state + type(ESMF_State) :: atm2cpl_state, cpl2atm_state ! on atm mesh (1 field bundle) + type(ESMF_State) :: lnd2cpl_state, cpl2lnd_state ! on lnd mesh (2 field bundles) + type(ESMF_State) :: rof2cpl_state, cpl2rof_state ! on rof mesh (1 field bundle) ! Clock, TimeInterval, and Times type(ESMF_Clock) :: lilac_clock @@ -50,18 +60,17 @@ module lilac_mod type(ESMF_Alarm) :: lilac_restart_alarm type(ESMF_Alarm) :: lilac_stop_alarm - character(*) , parameter :: modname = "lilac_mod" - - integer :: mytask + integer :: mytask - character(*), parameter :: u_FILE_u = & + character(*) , parameter :: modname = "lilac_mod" + character(*), parameter :: u_FILE_u = & __FILE__ !======================================================================== contains !======================================================================== - subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & + subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lats, & atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) @@ -71,20 +80,21 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! -------------------------------------------------------------------------------- ! input/output variables - character(len=*) , intent(in) :: atm_mesh_file - integer , intent(in) :: atm_global_index(:) - real , intent(in) :: atm_lons(:) - real , intent(in) :: atm_lats(:) - character(len=*) , intent(in) :: atm_calendar - integer , intent(in) :: atm_timestep - integer , intent(in) :: atm_start_year !(yyyy) - integer , intent(in) :: atm_start_mon !(mm) - integer , intent(in) :: atm_start_day - integer , intent(in) :: atm_start_secs - integer , intent(in) :: atm_stop_year !(yyyy) - integer , intent(in) :: atm_stop_mon !(mm) - integer , intent(in) :: atm_stop_day - integer , intent(in) :: atm_stop_secs + integer , intent(inout) :: mpicom ! input commiunicator from atm + character(len=*) , intent(in) :: atm_mesh_file + integer , intent(in) :: atm_global_index(:) + real , intent(in) :: atm_lons(:) + real , intent(in) :: atm_lats(:) + character(len=*) , intent(in) :: atm_calendar + integer , intent(in) :: atm_timestep + integer , intent(in) :: atm_start_year !(yyyy) + integer , intent(in) :: atm_start_mon !(mm) + integer , intent(in) :: atm_start_day + integer , intent(in) :: atm_start_secs + integer , intent(in) :: atm_stop_year !(yyyy) + integer , intent(in) :: atm_stop_mon !(mm) + integer , intent(in) :: atm_stop_day + integer , intent(in) :: atm_stop_secs ! local variables type(ESMF_TimeInterval) :: timeStep @@ -98,42 +108,64 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & integer :: rc character(len=ESMF_MAXSTR) :: cname !components or cpl names integer :: ierr - integer :: mpic ! mpi communicator integer :: n, i integer :: fileunit integer, parameter :: debug = 1 !-- internal debug level character(len=*), parameter :: subname=trim(modname)//': [lilac_init] ' + + ! initialization of mct and pio + integer :: ncomps = 1 ! for mct + integer, pointer :: mycomms(:) ! for mct + integer, pointer :: myids(:) ! for mct + integer :: compids(1) = (/1/) ! for pio_init2 - array with component ids + integer :: comms(1) ! for both mct and pio_init2 - array with mpicoms + character(len=32) :: compLabels(1) = (/'LND'/) ! for pio_init2 + character(len=64) :: comp_name(1) = (/'LND'/) ! for pio_init2 + logical :: comp_iamin(1) = (/.true./) ! for pio init2 !------------------------------------------------------------------------ ! Initialize return code rc = ESMF_SUCCESS + !------------------------------------------------------------------------- + ! Initialize pio with first initialization + ! AFTER call to MPI_init (which is in the host atm driver) and + ! BEFORE call to ESMF_Initialize + !------------------------------------------------------------------------- + call shr_pio_init1(ncomps=1, nlfilename="lilac_in", Global_Comm=mpicom) + !------------------------------------------------------------------------- ! Initialize ESMF, set the default calendar and log type. !------------------------------------------------------------------------- ! TODO: cannot assume that the calendar is always gregorian unless CTSM assumes this as well ! Need to coordinate the calendar info between lilac and the host component - call ESMF_Initialize(defaultCalKind=ESMF_CALKIND_GREGORIAN, logappendflag=.false., rc=rc) + call ESMF_Initialize(mpiCommunicator=mpicom, defaultCalKind=ESMF_CALKIND_GREGORIAN, & + logappendflag=.false., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogSet(flush=.true.) - call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) call ESMF_LogWrite(subname//"Initializing ESMF ", ESMF_LOGMSG_INFO) - !------------------------------------------------------------------------- - ! Initialize pio with first initialization - !------------------------------------------------------------------------- - - ! Initialize pio (needed by CTSM) - TODO: this should be done within CTSM not here - call ESMF_VMGetGlobal(vm=vm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMGet(vm, localPet=mytask, mpiCommunicator=mpic, rc=rc) + call ESMF_VMGet(vm, localPet=mytask, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call shr_pio_init1(ncomps=1, nlfilename="lilac_in", Global_Comm=mpic) + !------------------------------------------------------------------------- + ! Initialize MCT (this is needed for data model functionality) + !------------------------------------------- + allocate(mycomms(1), myids(1)) + mycomms = (/mpicom/) ; myids = (/1/) + call mct_world_init(ncomps, mpicom, mycomms, myids) + call ESMF_LogWrite(subname//"initialized mct ... ", ESMF_LOGMSG_INFO) + + !------------------------------------------------------------------------- + ! Initialize PIO with second initialization + !------------------------------------------------------------------------- + call shr_pio_init2(compids, compLabels, comp_iamin, (/mpicom/), (/mytask/)) + call ESMF_LogWrite(subname//"initialized shr_pio_init2 ...", ESMF_LOGMSG_INFO) !------------------------------------------------------------------------- ! Initial lilac_utils module variables @@ -148,7 +180,8 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & atm_mesh_filename = atm_mesh_file ! Initialize datatypes atm2lnd and lnd2atm - ! This must be done BEFORE the component initialization + ! This must be done BEFORE the atmcap initialization - since the dataptr attributes + ! are only needed to initialize the atmcap field bundles call lilac_init_atm2lnd(lsize) call lilac_init_lnd2atm(lsize) @@ -174,6 +207,17 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & print *, trim(subname) // " ctsm gridded component created" end if + !------------------------------------------------------------------------- + ! Create Gridded Component -- MOSART river + !------------------------------------------------------------------------- + cname = " MOSART " + rof_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac mosart initialization') + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, trim(subname) // " mosart gridded component created" + end if + !------------------------------------------------------------------------- ! Create Coupling Component! --- Coupler from atmos to land !------------------------------------------------------------------------- @@ -197,7 +241,29 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & end if !------------------------------------------------------------------------- - ! Register section -- set services -- atmos_cap + ! Create Coupling Component! --- Coupler from rof to land + !------------------------------------------------------------------------- + cname = "Coupler from river to land" + cpl_rof2lnd_comp = ESMF_CplCompCreate(name=cname, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_r2l initialization') + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, trim(subname) // " coupler component (atmosphere to land) created" + end if + + !------------------------------------------------------------------------- + ! Create Coupling Component! -- Coupler from land to atmos + !------------------------------------------------------------------------- + cname = "Coupler from land to river" + cpl_lnd2rof_comp = ESMF_CplCompCreate(name=cname, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_l2r initialization') + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, trim(subname) // " coupler component (land to atmosphere) created" + end if + + !------------------------------------------------------------------------- + ! Register section -- set services -- atmcap !------------------------------------------------------------------------- call ESMF_GridCompSetServices(atm_gcomp, userRoutine=lilac_atmos_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('atm_gcomp register failure') @@ -207,11 +273,21 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & end if !------------------------------------------------------------------------- - ! Register section -- set services -- land cap + ! Register section -- set services -- ctsm !------------------------------------------------------------------------- call ESMF_GridCompSetServices(lnd_gcomp, userRoutine=lnd_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('lnd_gcomp register failure') - call ESMF_LogWrite(subname//"land SetServices finished!", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"CSTM SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, trim(subname) // " CTSM setservices finished" + end if + + !------------------------------------------------------------------------- + ! Register section -- set services -- mosart + !------------------------------------------------------------------------- + call ESMF_GridCompSetServices(rof_gcomp, userRoutine=rof_register, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') + call ESMF_LogWrite(subname//"MOSART SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " CTSM setservices finished" end if @@ -226,6 +302,16 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & print *, trim(subname) // " coupler from atmosphere to land setservices finished" end if + !------------------------------------------------------------------------- + ! Register section -- set services -- river to land + !------------------------------------------------------------------------- + call ESMF_CplCompSetServices(cpl_rof2lnd_comp, userRoutine=cpl_rof2lnd_register, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') + call ESMF_LogWrite(subname//"Coupler from river to land SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, trim(subname) // " coupler from river to land setservices finished" + end if + !------------------------------------------------------------------------- ! Register section -- set services -- coupler land to atmosphere !------------------------------------------------------------------------- @@ -236,6 +322,16 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & print *, trim(subname) // " coupler from land to atmosphere setservices finished" end if + !------------------------------------------------------------------------- + ! Register section -- set services -- coupler land to river + !------------------------------------------------------------------------- + call ESMF_CplCompSetServices(cpl_lnd2rof_comp, userRoutine=cpl_lnd2rof_register, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') + call ESMF_LogWrite(subname//"Coupler from land to river SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + print *, trim(subname) // " coupler from land to river setservices finished" + end if + !------------------------------------------------------------------------- ! Create and initialize the lilac_clock and calendar !------------------------------------------------------------------------- @@ -286,12 +382,12 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! between components. (these are module variables) ! ------------------------------------------------------------------------- - atm2lnd_a_state = ESMF_StateCreate(name='state_from_atm_on_atm_mesh', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + atm2cpl_state = ESMF_StateCreate(name='state_from_atm', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - lnd2atm_a_state = ESMF_StateCreate(name='state_from_land_on_atm_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + cpl2atm_state = ESMF_StateCreate(name='state_to_atm', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_GridCompInitialize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, & + call ESMF_GridCompInitialize(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing atmcap") call ESMF_LogWrite(subname//"lilac_atm gridded component initialized", ESMF_LOGMSG_INFO) @@ -302,30 +398,63 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! between components. (these are module variables) ! ------------------------------------------------------------------------- - atm2lnd_l_state = ESMF_StateCreate(name='state_from_atm_on_land_mesh', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + cpl2lnd_state = ESMF_StateCreate(name='state_to_land', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - lnd2atm_l_state = ESMF_StateCreate(name='state_from_land_on_land_mesh', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + lnd2cpl_state = ESMF_StateCreate(name='state_fr_land', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_GridCompInitialize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, & + call ESMF_GridCompInitialize(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing ctsm") call ESMF_LogWrite(subname//"CTSM gridded component initialized", ESMF_LOGMSG_INFO) + ! ------------------------------------------------------------------------- + ! Initialze MOSART Gridded Component + ! First Create the empty import and export states used to pass data + ! between components. (these are module variables) + ! ------------------------------------------------------------------------- + + cpl2rof_state = ESMF_StateCreate(name='state_to_river', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + rof2cpl_state = ESMF_StateCreate(name='state_fr_river', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_GridCompInitialize(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing mosart") + call ESMF_LogWrite(subname//"MOSART gridded component initialized", ESMF_LOGMSG_INFO) + ! ------------------------------------------------------------------------- ! Initialze LILAC coupler components ! ------------------------------------------------------------------------- - call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, & + ! Note that the lnd2cpl_state and cpl2lnd_state are each made up of 2 field bundles, + ! one for the river and one for the atm - + + ! The following fills in the atm field bundle in cpl2lnd_state + call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_atm2lnd component") call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) - call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, & + ! The following fills in the rof field bundle in cpl2lnd_state + call ESMF_CplCompInitialize(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) + ! The following maps the atm field bundle in lnd2cpl_state to the atm mesh + call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2cpl_state, exportState=cpl2atm_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") + call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) + + ! The following maps the rof field bundle in lnd2cpl_state to the rof mesh + call ESMF_CplCompInitialize(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2rof component") + call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) + if (mytask == 0) then print *, trim(subname) // "finished lilac initialization" end if @@ -341,7 +470,7 @@ subroutine lilac_init(atm_mesh_file, atm_global_index, atm_lons, atm_lats, & ! Initialize atmaero stream data (using share strearm capability from CIME) !------------------------------------------------------------------------- - call lilac_atmaero_init(atm2lnd_a_state, rc) + call lilac_atmaero_init(atm2cpl_state, rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing lilac_atmaero_init") end subroutine lilac_init @@ -380,28 +509,28 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") end if - ! Run lilac atmcap - update the atm2lnd_a_state + ! Run lilac atmcap - update the cpl2atm_state call ESMF_LogWrite(subname//"running lilac atmos_cap", ESMF_LOGMSG_INFO) if (mytask == 0) print *, "Running atmos_cap gridded component , rc =", rc - call ESMF_GridCompRun(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, & + call ESMF_GridCompRun(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") - ! Update prescribed aerosols atm2lnd_a_state - call lilac_atmaero_interp(atm2lnd_a_state, lilac_clock, rc=rc) + ! Update prescribed aerosols atm2cpl_a_state + call lilac_atmaero_interp(atm2cpl_state, lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac_atmaero_interp") ! Run cpl_atm2lnd call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) print *, "Running coupler component..... cpl_atm2lnd_comp" - call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, & + call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_atm2lnd") ! Run ctsm call ESMF_LogWrite(subname//"running ctsm", ESMF_LOGMSG_INFO) if (mytask == 0) print *, "Running ctsm" - call ESMF_GridCompRun(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, & + call ESMF_GridCompRun(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") @@ -410,13 +539,34 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) if (mytask == 0) then print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc end if - call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, & + call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2cpl_state, exportState=cpl2atm_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in cpl_lnd2atm") + ! Run cpl_lnd2rof + call ESMF_LogWrite(subname//"running cpl_lnd2rof_comp ", ESMF_LOGMSG_INFO) + if (mytask == 0) print *, "Running coupler component..... cpl_lnd2rof_comp" + call ESMF_CplCompRun(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_lnd2rof") + + ! Run mosart + call ESMF_LogWrite(subname//"running mosart", ESMF_LOGMSG_INFO) + if (mytask == 0) print *, "Running mosart" + call ESMF_GridCompRun(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") + + ! Run cpl_rof2lnd + ! call ESMF_LogWrite(subname//"running cpl_rof2lnd_comp ", ESMF_LOGMSG_INFO) + ! if (mytask == 0) print *, "Running coupler component..... cpl_rof2lnd_comp" + ! call ESMF_CplCompRun(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & + ! clock=lilac_clock, rc=rc) + ! if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_rof2lnd") + ! Write out history output - call lilac_history_write(atm2lnd_a_state, atm2lnd_l_state, lnd2atm_l_state, lnd2atm_a_state, & - lilac_clock, rc) + call lilac_history_write(atm2cpl_state, lnd2cpl_state, rof2cpl_state, & + cpl2atm_state, cpl2lnd_state, cpl2rof_state, lilac_clock, rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") ! Advance the time at the end of the time step @@ -451,7 +601,7 @@ subroutine lilac_final( ) !------------------------------------------------------------------------- ! Gridded Component Finalizing! --- atmosphere !------------------------------------------------------------------------- - call ESMF_GridCompFinalize(atm_gcomp, importState=lnd2atm_a_state, exportState=atm2lnd_a_state, clock=lilac_clock, rc=rc) + call ESMF_GridCompFinalize(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -461,7 +611,7 @@ subroutine lilac_final( ) !------------------------------------------------------------------------- ! Coupler component Finalizing --- coupler atmos to land !------------------------------------------------------------------------- - call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2lnd_a_state, exportState=atm2lnd_l_state, clock=lilac_clock, rc=rc) + call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -471,7 +621,7 @@ subroutine lilac_final( ) !------------------------------------------------------------------------- ! Gridded Component Finalizing! --- land !------------------------------------------------------------------------- - call ESMF_GridCompFinalize(lnd_gcomp, importState=atm2lnd_l_state, exportState=lnd2atm_l_state, clock=lilac_clock, rc=rc) + call ESMF_GridCompFinalize(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -481,7 +631,7 @@ subroutine lilac_final( ) !------------------------------------------------------------------------- ! Coupler component Finalizing --- coupler land to atmos !------------------------------------------------------------------------- - call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=lnd2atm_l_state, exportState=lnd2atm_a_state, clock=lilac_clock, rc=rc) + call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=cpl2lnd_state, exportState=cpl2atm_state, clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -495,13 +645,17 @@ subroutine lilac_final( ) if (mytask == 0) then print *, "ready to destroy all states" end if - call ESMF_StateDestroy(atm2lnd_a_state , rc=rc) + call ESMF_StateDestroy(atm2cpl_state , rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateDestroy(atm2lnd_l_state, rc=rc) + call ESMF_StateDestroy(cpl2atm_state, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateDestroy(lnd2atm_a_state, rc=rc) + call ESMF_StateDestroy(lnd2cpl_state, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateDestroy(lnd2atm_l_state, rc=rc) + call ESMF_StateDestroy(cpl2lnd_state, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateDestroy(rof2cpl_state, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateDestroy(cpl2rof_state, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) call ESMF_LogWrite(subname//"destroying all components ", ESMF_LOGMSG_INFO) @@ -513,8 +667,10 @@ subroutine lilac_final( ) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) call ESMF_GridCompDestroy(lnd_gcomp, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_CplCompDestroy(cpl_atm2lnd_comp, rc=rc) + call ESMF_GridCompDestroy(rof_gcomp, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_CplCompDestroy(cpl_atm2lnd_comp, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) call ESMF_CplCompDestroy(cpl_lnd2atm_comp, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) diff --git a/lilac/src/lilac_utils.F90 b/lilac/src/lilac_utils.F90 index 2c6b6d343e..89e4fb3130 100644 --- a/lilac/src/lilac_utils.F90 +++ b/lilac/src/lilac_utils.F90 @@ -123,23 +123,29 @@ subroutine lilac_init_lnd2atm(lsize) integer, intent(in) :: lsize integer :: n - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_lfrin' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_t' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_tref' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_qref' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdr' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_anidr' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_avsdf' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_anidf' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_snowh' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_u10' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_fv' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Sl_ram1' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_lwup' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_taux' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_tauy' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_evap' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm, fldname='Fall_swnet', units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_lfrin' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_t' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_tref' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_qref' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_avsdr' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_anidr' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_avsdf' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_anidf' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_snowh' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_u10' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_fv' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_ram1' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_taux' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_tauy' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_lat' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_sen' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_lwup' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_evap' , units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_swnet', units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_flxdst1', units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_flxdst2', units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_flxdst3', units='unknown', lsize=lsize) + call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_flxdst4', units='unknown', lsize=lsize) ! now add dataptr memory for all of the fields do n = 1,size(lnd2atm) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 6cbaa419c1..d808edefa8 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -229,10 +229,6 @@ def buildnml(rundir, bldnmldir): os.remove(os.path.join(rundir, "env_lilac.xml")) os.remove(os.path.join(rundir, "drv_flds_in")) - # copy lilac_in to rundir - mesh file is defined in lilac_in - shutil.copy(os.path.join(bldnmldir,"lilac_in"), - os.path.join(rundir, "lilac_in")) - ############################################################################### if __name__ == "__main__": diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index f27ac92767..a0db265893 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -8,18 +8,17 @@ module lnd_comp_esmf ! external libraries use ESMF use mpi , only : MPI_BCAST, MPI_CHARACTER - use mct_mod , only : mct_world_init use perf_mod , only : t_startf, t_stopf, t_barrierf use lilac_utils , only : lilac_field_bundle_to_land, lilac_field_bundle_fr_land ! cime share code - use shr_pio_mod , only : shr_pio_init2 use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl use shr_sys_mod , only : shr_sys_abort use shr_file_mod , only : shr_file_setLogUnit, shr_file_getLogUnit use shr_orb_mod , only : shr_orb_decl, shr_orb_params use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date - use glc_elevclass_mod , only : glc_elevclass_init ! TODO: is this needed? + use shr_nl_mod , only : shr_nl_find_group_name + use glc_elevclass_mod , only : glc_elevclass_init ! ctsm code use spmdMod , only : masterproc, spmd_init, mpicom @@ -28,7 +27,7 @@ module lnd_comp_esmf use controlMod , only : control_setNL use clm_varorb , only : eccen, obliqr, lambm0, mvelpp use clm_varctl , only : clm_varctl_set, iulog, finidat - use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_varctl , only : nsrStartup, nsrContinue use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_time_manager , only : set_timemgr_init, advance_timestep use clm_time_manager , only : set_nextsw_cday, update_rad_dtime @@ -103,74 +102,65 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) integer, intent(out) :: rc ! Return code ! local variable - integer :: ierr ! error code - integer :: n,g,i,j ! indices - logical :: exists ! true if file exists - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - character(len=CL) :: caseid ! case identifier name - character(len=CL) :: ctitle ! case description title - character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) - integer :: nsrest ! clm restart type - logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type - logical :: atm_aero ! Flag if aerosol data sent from atm model - integer :: lbnum ! input to memory diagnostic - integer :: shrlogunit ! old values for log unit and log level - type(bounds_type) :: bounds ! bounds - - ! generation of field bundles + integer :: ierr ! error code + integer :: n,g,i,j ! indices + logical :: exists ! true if file exists + real(r8) :: nextsw_cday ! calday from clock of next radiation computation + character(len=CL) :: caseid ! case identifier name + character(len=CL) :: ctitle ! case description title + character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) + integer :: nsrest ! clm restart type + logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type + logical :: atm_aero ! Flag if aerosol data sent from atm model + integer :: lbnum ! input to memory diagnostic + integer :: shrlogunit ! old values for log unit and log level + type(bounds_type) :: bounds ! bounds + + ! generation of field bundles type(ESMF_State) :: importState, exportState - type(ESMF_FieldBundle) :: c2l_fb - type(ESMF_FieldBundle) :: l2c_fb + type(ESMF_FieldBundle) :: c2l_fb_atm, c2l_fb_rof ! field bundles in import state + type(ESMF_FieldBundle) :: l2c_fb_atm, l2c_fb_rof ! field bundles in export state - ! mesh generation + ! mesh generation type(ESMF_Mesh) :: lnd_mesh - character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file - integer :: nlnd, nocn ! local size ofarrays - integer, pointer :: gindex(:) ! global index space for land and ocean points - integer, pointer :: gindex_lnd(:) ! global index space for just land points - integer, pointer :: gindex_ocn(:) ! global index space for just ocean points + character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file + integer :: nlnd, nocn ! local size ofarrays + integer, pointer :: gindex(:) ! global index space for land and ocean points + integer, pointer :: gindex_lnd(:) ! global index space for just land points + integer, pointer :: gindex_ocn(:) ! global index space for just ocean points type(ESMF_DistGrid) :: distgrid integer :: fileunit - ! clock info - character(len=CL) :: calendar ! calendar type name - type(ESMF_CalKind_Flag) :: caltype ! calendar type from lilac clock - integer :: curr_tod, curr_ymd ! current time info - integer :: yy, mm, dd ! query output from lilac clock - integer :: dtime_lilac ! coupling time-step from the input lilac clock - integer :: ref_ymd ! reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (sec) - integer :: start_ymd ! start date (YYYYMMDD) - integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - type(ESMF_Time) :: currTime ! Current time - type(ESMF_Time) :: startTime ! Start time - type(ESMF_Time) :: stopTime ! Stop time - type(ESMF_Time) :: refTime ! Ref time - type(ESMF_TimeInterval) :: timeStep ! time step from lilac clock - - ! orbital info - integer :: orb_iyear_align ! associated with model year - integer :: orb_cyear ! orbital year for current orbital computation - integer :: orb_iyear ! orbital year for current orbital computation - integer :: orb_eccen ! orbital year for current orbital computation - - ! for pio_init2 and mct + ! clock info + character(len=CL) :: calendar ! calendar type name + type(ESMF_CalKind_Flag) :: caltype ! calendar type from lilac clock + integer :: curr_tod, curr_ymd ! current time info + integer :: yy, mm, dd ! query output from lilac clock + integer :: dtime_lilac ! coupling time-step from the input lilac clock + integer :: ref_ymd ! reference date (YYYYMMDD) + integer :: ref_tod ! reference time of day (sec) + integer :: start_ymd ! start date (YYYYMMDD) + integer :: start_tod ! start time of day (sec) + integer :: stop_ymd ! stop date (YYYYMMDD) + integer :: stop_tod ! stop time of day (sec) + type(ESMF_Time) :: currTime ! Current time + type(ESMF_Time) :: startTime ! Start time + type(ESMF_Time) :: stopTime ! Stop time + type(ESMF_Time) :: refTime ! Ref time + type(ESMF_TimeInterval) :: timeStep ! time step from lilac clock + + ! orbital info + integer :: orb_iyear_align ! associated with model year + integer :: orb_cyear ! orbital year for current orbital computation + integer :: orb_iyear ! orbital year for current orbital computation + integer :: orb_eccen ! orbital year for current orbital computation + type(ESMF_VM) :: vm integer :: mpicom_vm - integer :: ncomps = 1 ! for mct - integer, pointer :: mycomms(:) ! for mct - integer, pointer :: myids(:) ! for mct - integer :: compids(1) = (/1/) ! for both mct and pio_init2 - array with component ids - integer :: comms(1) ! for both mct and pio_init2 - array with mpicoms - character(len=32) :: compLabels(1) = (/'LND'/) ! for pio_init2 - character(len=64) :: comp_name(1) = (/'LND'/) ! for pio_init2 - logical :: comp_iamin(1) = (/.true./) ! for pio init2 - integer :: iam(1) ! for pio_init2 - - ! input namelist read for ctsm mesh - namelist /lnd_mesh_inparm/ lnd_mesh_filename + + ! input namelist read for ctsm mesh and run info + namelist /lilac_lnd_input/ lnd_mesh_filename + namelist /lilac_run_input/ caseid, starttype character(len=*), parameter :: subname=trim(modName)//': (lnd_init) ' !------------------------------------------------------------------------ @@ -185,28 +175,10 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_VMGetCurrent(vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return - call ESMF_VMGet(vm, mpiCommunicator=mpicom_vm, localPet=iam(1), rc=rc) + call ESMF_VMGet(vm, mpiCommunicator=mpicom_vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return call ESMF_LogWrite(subname//"ESMF_VMGet", ESMF_LOGMSG_INFO) - !------------------------------------------------------------------------ - ! Initialize pio_init2 TODO: is this needed here? - !------------------------------------------------------------------------ - - comms(1) = mpicom_vm - call shr_pio_init2(compids, compLabels, comp_iamin, comms, iam) - call ESMF_LogWrite(subname//"initialized shr_pio_init2 ...", ESMF_LOGMSG_INFO) - - !------------------------------------------------------------------------ - ! Initialize mct - needed for data model share code - e.g. nitrogen deposition - !------------------------------------------------------------------------ - - allocate(mycomms(1), myids(1)) - mycomms = (/mpicom_vm/) ; myids = (/1/) - - call mct_world_init(ncomps, mpicom_vm, mycomms, myids) - call ESMF_LogWrite(subname//"initialized mct ... ", ESMF_LOGMSG_INFO) - !------------------------------------------------------------------------ ! Initialize internal ctsm MPI info !------------------------------------------------------------------------ @@ -270,9 +242,39 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- call control_setNL("lnd_in") - ! TODO: how do we set case_name and nsrest - should we hardwire for now? - caseid = 'test_lilac' - nsrest = nsrStartup + !---------------------- + ! Read in lilac_in namelists + !---------------------- + + if (masterproc) then + open(newunit=fileunit, status="old", file="lilac_in") + call shr_nl_find_group_name(fileunit, 'lilac_run_input', ierr) + if (ierr == 0) then + read(fileunit, lilac_run_input, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort( 'problem on read of lilac_run_input') + end if + end if + call shr_nl_find_group_name(fileunit, 'lilac_lnd_input', ierr) + if (ierr == 0) then + read(fileunit, lilac_lnd_input, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort( 'problem on read of lilac_lnd_input') + end if + end if + close(fileunit) + end if + call mpi_bcast(lnd_mesh_filename, len(lnd_mesh_filename), MPI_CHARACTER, 0, mpicom, ierr) + call mpi_bcast(starttype, len(starttype), MPI_CHARACTER, 0, mpicom, ierr) + call mpi_bcast(caseid, len(caseid), MPI_CHARACTER, 0, mpicom, ierr) + + if (trim(starttype) == trim('startup')) then + nsrest = nsrStartup + else if (trim(starttype) == trim('continue') ) then + nsrest = nsrContinue + else + call shr_sys_abort( subname//' ERROR: unknown starttype'//trim(starttype) ) + end if !---------------------- ! Initialize module variables in clm_time_manger.F90 @@ -329,7 +331,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Initialize glc_elevclass module !---------------------- - call glc_elevclass_init(glc_nec) ! TODO: is this needed still? + call glc_elevclass_init(glc_nec) !---------------------- ! Call initialize1 @@ -385,20 +387,12 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) deallocate(gindex) call ESMF_LogWrite(subname//"DistGrid created......", ESMF_LOGMSG_INFO) - ! obtain the mesh filename from the namelist - if (masterproc) then - open(newunit=fileunit, status="old", file="lilac_in") - read(fileunit, lnd_mesh_inparm, iostat=ierr) - if (ierr > 0) then - call shr_sys_abort( 'problem on read of lilac_in') - end if - close(fileunit) - end if - call MPI_BCAST(lnd_mesh_filename, len(lnd_mesh_filename), MPI_CHARACTER, 0, mpicom, ierr) - ! create esmf mesh using distgrid and lnd_mesh_filename - lnd_mesh = ESMF_MeshCreate(filename=trim(lnd_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, elementDistgrid=Distgrid, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + lnd_mesh = ESMF_MeshCreate(filename=trim(lnd_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, & + elementDistgrid=Distgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) then + call shr_sys_abort("Error in creating mesh "// trim(lnd_mesh_filename)) + end if if (masterproc) then write(iulog,*)'mesh file for domain is ',trim(lnd_mesh_filename) end if @@ -415,38 +409,70 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Create import state (only assume input from atm - not rof and glc) !-------------------------------- - ! NOTE: currently this must be the same list as in lilac_init_atm2lnd + ! create an empty field bundle for import of atm fields + c2l_fb_atm = ESMF_FieldBundleCreate (name='c2l_fb_atm', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! create an empty field bundle - c2l_fb = ESMF_FieldBundleCreate (name='c2l_fb', rc=rc) + ! now add atm import fields on lnd_mesh to this field bundle + call lilac_field_bundle_to_land(lnd_mesh, c2l_fb_atm, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! now add fields on lnd_mesh to this field bundle - call lilac_field_bundle_to_land(lnd_mesh, c2l_fb, rc) + ! add the field bundle to the state + call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb_atm/)) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! add the field bundle to the export state - call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb/)) + ! create an empty field bundle for the import of rof fields + c2l_fb_rof = ESMF_FieldBundleCreate (name='c2l_fb_rof', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call fldbundle_add('Flrr_flood', c2l_fb_rof, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add('Flrr_volr', c2l_fb_rof, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add('Flrr_volrmch', c2l_fb_rof, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! add the field bundle to the state + call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb_rof/)) + if (ChkErr(rc,__LINE__,u_FILE_u)) return !-------------------------------- ! Create export state !-------------------------------- - ! NOTE: currently this must be the same list as in lilac_init_lnd2atm - - ! create an empty field bundle - l2c_fb = ESMF_FieldBundleCreate(name='l2c_fb', rc=rc) + ! create an empty field bundle for atm export fields + l2c_fb_atm = ESMF_FieldBundleCreate(name='l2c_fb_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! now add fields on lnd_mesh to this field bundle - call lilac_field_bundle_fr_land(lnd_mesh, l2c_fb, rc) + ! now add atm export fields on lnd_mesh to this field bundle + call lilac_field_bundle_fr_land(lnd_mesh, l2c_fb_atm, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! add the field bundle to the state - call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb/), rc=rc) + call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb_atm/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! create an empty field bundle for rof export fields + l2c_fb_rof = ESMF_FieldBundleCreate(name='l2c_fb_rof', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! now add rof export fields on lnd_mesh to this field bundle + call fldbundle_add('Flrl_rofsur', l2c_fb_rof, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add('Flrl_rofgwl', l2c_fb_rof, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add('Flrl_rofsub', l2c_fb_rof, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add('Flrl_rofi', l2c_fb_rof, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call fldbundle_add('Flrl_irrig', l2c_fb_rof, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb_rof/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return !-------------------------------- - ! Create land export state + ! Fill in land export state !-------------------------------- call ESMF_LogWrite(subname//"Creating land export state", ESMF_LOGMSG_INFO) @@ -479,13 +505,13 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Set Attributes call ESMF_LogWrite(subname//"setting attribute!", ESMF_LOGMSG_INFO) - call ESMF_AttributeSet(export_state, name="lnd_nx", value=ldomain%ni, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - call ESMF_LogWrite(subname//"setting attribute! lnd_nx", ESMF_LOGMSG_INFO) + ! call ESMF_AttributeSet(export_state, name="lnd_nx", value=ldomain%ni, rc=rc) + ! if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + ! call ESMF_LogWrite(subname//"setting attribute lnd_nx", ESMF_LOGMSG_INFO) - call ESMF_AttributeSet(export_state, name="lnd_ny", value=ldomain%nj, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - call ESMF_LogWrite(subname//"setting attribute-lnd_ny!", ESMF_LOGMSG_INFO) + ! call ESMF_AttributeSet(export_state, name="lnd_ny", value=ldomain%nj, rc=rc) + ! if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + ! call ESMF_LogWrite(subname//"setting attribute lnd_ny!", ESMF_LOGMSG_INFO) !-------------------------------- ! diagnostics @@ -516,7 +542,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) contains !--------------------------- - subroutine fldbundle_add(stdname, fieldbundle,rc) + subroutine fldbundle_add(stdname, fieldbundle, rc) !--------------------------- ! Create an empty input field with name 'stdname' to add to fieldbundle !--------------------------- @@ -556,7 +582,6 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) type(ESMF_Alarm) :: alarm type(ESMF_Time) :: currTime type(ESMF_Time) :: nextTime - type(ESMF_State) :: importState, exportState character(ESMF_MAXSTR) :: cvalue integer :: ymd ! CTSM current date (YYYYMMDD) integer :: yr ! CTSM current year diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 0510eeff56..ac39ae1fc0 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -123,98 +123,129 @@ subroutine import_fields( gcomp, bounds, rc) ! Required atmosphere input fields !-------------------------- - call state_getimport(importState, 'Sa_z', bounds, output=atm2lnd_inst%forc_hgt_grc, rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_z', bounds, & + output=atm2lnd_inst%forc_hgt_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_topo', bounds, output=atm2lnd_inst%forc_topo_grc, rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_topo', bounds, & + output=atm2lnd_inst%forc_topo_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_u', bounds, output=atm2lnd_inst%forc_u_grc, rc=rc ) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_u', bounds, & + output=atm2lnd_inst%forc_u_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_v', bounds, output=atm2lnd_inst%forc_v_grc, rc=rc ) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_v', bounds, & + output=atm2lnd_inst%forc_v_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_ptem', bounds, output=atm2lnd_inst%forc_th_not_downscaled_grc, rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_ptem', bounds, & + output=atm2lnd_inst%forc_th_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_shum', bounds, output=water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc, rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_shum', bounds, & + output=water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_pbot', bounds, output=atm2lnd_inst%forc_pbot_not_downscaled_grc, rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_pbot', bounds, & + output=atm2lnd_inst%forc_pbot_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sa_tbot', bounds, output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_tbot', bounds, & + output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_rainc', bounds, output=forc_rainc, rc=rc ) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainc', bounds, & + output=forc_rainc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_rainl', bounds, output=forc_rainl, rc=rc ) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainl', bounds, & + output=forc_rainl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_snowc', bounds, output=forc_snowc, rc=rc ) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowc', bounds, & + output=forc_snowc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_snowl', bounds, output=forc_snowl, rc=rc ) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowl', bounds, & + output=forc_snowl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_lwdn', bounds, output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_lwdn', bounds, & + output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_swvdr', bounds, output=atm2lnd_inst%forc_solad_grc(:,1), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swvdr', bounds, & + output=atm2lnd_inst%forc_solad_grc(:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_swndr', bounds, output=atm2lnd_inst%forc_solad_grc(:,2), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swndr', bounds, & + output=atm2lnd_inst%forc_solad_grc(:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_swvdf', bounds, output=atm2lnd_inst%forc_solai_grc(:,1), rc=rc ) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swvdf', bounds, & + output=atm2lnd_inst%forc_solai_grc(:,1), rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_swndf', bounds, output=atm2lnd_inst%forc_solai_grc(:,2), rc=rc ) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swndf', bounds, & + output=atm2lnd_inst%forc_solai_grc(:,2), rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ! Atmosphere prognostic/prescribed aerosol fields - call state_getimport(importState, 'Faxa_bcphidry', bounds, output=atm2lnd_inst%forc_aer_grc(:,1), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphidry', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_bcphodry', bounds, output=atm2lnd_inst%forc_aer_grc(:,2), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphodry', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_bcphiwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,3), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphiwet', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,3), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_ocphidry', bounds, output=atm2lnd_inst%forc_aer_grc(:,4), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphidry', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,4), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_ocphodry', bounds, output=atm2lnd_inst%forc_aer_grc(:,5), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphodry', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,5), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_ocphiwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,6), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphiwet', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,6), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstwet1', bounds, output=atm2lnd_inst%forc_aer_grc(:,7), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet1', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,7), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstdry1', bounds, output=atm2lnd_inst%forc_aer_grc(:,8), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry1', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,8), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstwet2', bounds, output=atm2lnd_inst%forc_aer_grc(:,9), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet2', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,9), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstdry2', bounds, output=atm2lnd_inst%forc_aer_grc(:,10), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry2', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,10), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstwet3', bounds, output=atm2lnd_inst%forc_aer_grc(:,11), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet3', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,11), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstdry3', bounds, output=atm2lnd_inst%forc_aer_grc(:,12), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry3', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,12), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstwet4', bounds, output=atm2lnd_inst%forc_aer_grc(:,13), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet4', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,13), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstdry4', bounds, output=atm2lnd_inst%forc_aer_grc(:,14), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry4', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,14), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) + ! call state_getimport(importState, 'c2l_fb_atm', 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! The lilac is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec ! so the following conversion needs to happen - ! call state_getimport(importState, 'Faxa_nhx', bounds, output=forc_nhx, rc=rc ) + ! call state_getimport(importState, 'c2l_fb_atm', 'Faxa_nhx', bounds, output=forc_nhx, rc=rc ) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'Faxa_noy', bounds, output=forc_noy, rc=rc ) + ! call state_getimport(importState, 'c2l_fb_atm', 'Faxa_noy', bounds, output=forc_noy, rc=rc ) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! do g = begg,endg ! atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 @@ -338,99 +369,127 @@ subroutine export_fields(gcomp, bounds, rc) ! output to atm ! ----------------------- - call state_setexport(exportState, 'Sl_lfrin', bounds, input=ldomain%frac, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_lfrin', bounds, & + input=ldomain%frac, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_t', bounds, input=lnd2atm_inst%t_rad_grc, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_t', bounds, & + input=lnd2atm_inst%t_rad_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_snowh', bounds, input=water_inst%waterlnd2atmbulk_inst%h2osno_grc, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_snowh', bounds, & + input=water_inst%waterlnd2atmbulk_inst%h2osno_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_avsdr', bounds, input=lnd2atm_inst%albd_grc(bounds%begg:,1), rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_avsdr', bounds, & + input=lnd2atm_inst%albd_grc(bounds%begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_anidr', bounds, input=lnd2atm_inst%albd_grc(bounds%begg:,2), rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_anidr', bounds, & + input=lnd2atm_inst%albd_grc(bounds%begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_avsdf', bounds, input=lnd2atm_inst%albi_grc(bounds%begg:,1), rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_avsdf', bounds, & + input=lnd2atm_inst%albi_grc(bounds%begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_anidf', bounds, input=lnd2atm_inst%albi_grc(bounds%begg:,2), rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_anidf', bounds, & + input=lnd2atm_inst%albi_grc(bounds%begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_tref', bounds, input=lnd2atm_inst%t_ref2m_grc, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_tref', bounds, & + input=lnd2atm_inst%t_ref2m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_qref', bounds, input=water_inst%waterlnd2atmbulk_inst%q_ref2m_grc, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_qref', bounds, & + input=water_inst%waterlnd2atmbulk_inst%q_ref2m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_u10', bounds, input=lnd2atm_inst%u_ref10m_grc, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_u10', bounds, & + input=lnd2atm_inst%u_ref10m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_taux', bounds, input=lnd2atm_inst%taux_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_taux', bounds, & + input=lnd2atm_inst%taux_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_tauy', bounds, input=lnd2atm_inst%tauy_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_tauy', bounds, & + input=lnd2atm_inst%tauy_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_lat', bounds, input=lnd2atm_inst%eflx_lh_tot_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_lat', bounds, & + input=lnd2atm_inst%eflx_lh_tot_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_sen', bounds, input=lnd2atm_inst%eflx_sh_tot_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_sen', bounds, & + input=lnd2atm_inst%eflx_sh_tot_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_lwup', bounds, input=lnd2atm_inst%eflx_lwrad_out_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_lwup', bounds, & + input=lnd2atm_inst%eflx_lwrad_out_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_evap', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_evap_tot_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_evap', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qflx_evap_tot_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_swnet', bounds, input=lnd2atm_inst%fsa_grc, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_swnet', bounds, & + input=lnd2atm_inst%fsa_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst1', bounds, input=lnd2atm_inst%flxdst_grc(:,1), minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst1', bounds, & + input=lnd2atm_inst%flxdst_grc(:,1), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst2', bounds, input=lnd2atm_inst%flxdst_grc(:,2), minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst2', bounds, & + input=lnd2atm_inst%flxdst_grc(:,2), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst3', bounds, input=lnd2atm_inst%flxdst_grc(:,3), minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst3', bounds, & + input=lnd2atm_inst%flxdst_grc(:,3), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst4', bounds, input=lnd2atm_inst%flxdst_grc(:,4), minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst4', bounds, & + input=lnd2atm_inst%flxdst_grc(:,4), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_ram1', bounds, input=lnd2atm_inst%ram1_grc, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_ram1', bounds, & + input=lnd2atm_inst%ram1_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_fv', bounds, input=lnd2atm_inst%fv_grc, rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_fv', bounds, & + input=lnd2atm_inst%fv_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! methanem - ! call state_setexport(exportState, 'Fall_methane', bounds, input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_methane', bounds, & + ! input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! soil water - ! call state_setexport(exportState, 'Sl_soilw', bounds, input=water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_soilw', bounds, & + ! input=water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! dry dep velocities ! do num = 1, drydep_nflds - ! call state_setexport(exportState, 'Sl_ddvel', bounds, input=lnd2atm_inst%ddvel_grc(:,num), ungridded_index=num, rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_ddvel', bounds, & + ! input=lnd2atm_inst%ddvel_grc(:,num), ungridded_index=num, rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! end do ! MEGAN VOC emis fluxes ! do num = 1, shr_megan_mechcomps_n - ! call state_setexport(exportState, 'Fall_voc', bounds, input=lnd2atm_inst%flxvoc_grc(:,num), minus=.true., ungridded_index=num, rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_voc', bounds, & + ! input=lnd2atm_inst%flxvoc_grc(:,num), minus=.true., ungridded_index=num, rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! end do ! fire emis fluxes ! do num = 1, emis_nflds - ! call state_setexport(exportState, 'Fall_fire', bounds, input=lnd2atm_inst%fireflx_grc(:,num), minus=.true., ungridded_index=num, rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_fire', bounds, & + ! input=lnd2atm_inst%fireflx_grc(:,num), minus=.true., ungridded_index=num, rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! end do ! if (emis_nflds > 0) then - ! call state_setexport(exportState, 'Sl_fztopo', bounds, input=lnd2atm_inst%fireztop_grc, rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_fztopo', bounds, input=lnd2atm_inst%fireztop_grc, rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! endif ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. @@ -442,37 +501,43 @@ subroutine export_fields(gcomp, bounds, rc) ! surface runoff is the sum of qflx_over, qflx_h2osfc_surf ! do g = bounds%begg,bounds%endg - ! array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) + ! array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + & + ! water_inst%waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) ! end do - ! call state_setexport(exportState, 'Flrl_rofsur', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofsur', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - ! do g = bounds%begg,bounds%endg - ! array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & - ! water_inst%waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) - ! end do - ! call state_setexport(exportState, 'Flrl_rofsub', bounds, input=array, rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain + do g = bounds%begg,bounds%endg + array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) + end do + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofsub', bounds, & + input=array, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! qgwl sent individually to coupler - ! call state_setexport(exportState, 'Flrl_rofgwl', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! qgwl sent individually to coupler + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofgwl', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! ice sent individually to coupler - ! call state_setexport(exportState, 'Flrl_rofi', bounds, input=water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! ice sent individually to coupler + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofi', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ! irrigation flux to be removed from main channel storage (negative) - ! call state_setexport(exportState, 'Flrl_irrig', bounds, input=water_inst%waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! irrigation flux to be removed from main channel storage (negative) + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_irrig', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine export_fields !=============================================================================== - subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) + subroutine state_getimport(state, fb, fldname, bounds, output, ungridded_index, rc) ! ---------------------------------------------- ! Map import state field to output array @@ -480,8 +545,9 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) ! input/output variables type(ESMF_State) , intent(in) :: state - type(bounds_type) , intent(in) :: bounds + character(len=*) , intent(in) :: fb character(len=*) , intent(in) :: fldname + type(bounds_type) , intent(in) :: bounds real(r8) , intent(out) :: output(bounds%begg:bounds%endg) integer, optional , intent(in) :: ungridded_index integer , intent(out) :: rc @@ -504,79 +570,65 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - ! Determine if field with name fldname exists in state - - !call ESMF_StateGet(state, trim(fldname), itemFlag, rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! print out what is in our state??? if (masterproc .and. debug > 0) then write(iulog,F01)' Show me what is in the state? for '//trim(fldname) call ESMF_StatePrint(state, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - ! Determine if fieldbundle exists in state - call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) + ! Get the field bundle + call ESMF_StateGet(state, trim(fb), fieldBundle, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("ERROR: fb "//trim(fb)//" not found in import state") + + ! Get the field + call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! if fieldbundle exists then create output array - else do nothing - if (itemflag /= ESMF_STATEITEM_NOTFOUND) then - ! Get the field bundle??? - call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) + ! Get the pointer to data in the field + if (present(ungridded_index)) then + write(cvalue,*) ungridded_index + call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname)//" index "//trim(cvalue), & + ESMF_LOGMSG_INFO) + call state_getfldptr(state, trim(fb), trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_LogWrite(subname//'c2l_fb found and now ... getting '//trim(fldname), ESMF_LOGMSG_INFO) - call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) + else + call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname),ESMF_LOGMSG_INFO) + call state_getfldptr(state, trim(fb), trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if - ! Now for error checking we can put ... if (isPresent...) - ! get field pointer - if (present(ungridded_index)) then - write(cvalue,*) ungridded_index - call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname)//" index "//trim(cvalue), & - ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname),ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - ! determine output array - if (present(ungridded_index)) then - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr2d(ungridded_index,n) - end do - else - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr1d(n) - if (masterproc .and. debug > 0 .and. get_nstep() < 5) then - write(iulog,F02)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) - end if - end do - end if - - ! write debug output if appropriate - if (masterproc .and. debug > 0 .and. get_nstep() < 5) then - do g = bounds%begg,bounds%endg - i = 1 + g - bounds%begg - write(iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) - end do - end if + ! Fill in output array + if (present(ungridded_index)) then + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + output(g) = fldptr2d(ungridded_index,n) + end do + else + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + output(g) = fldptr1d(n) + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + write(iulog,F02)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) + end if + end do + end if - ! check for nans - call check_for_nans(output, trim(fldname), bounds%begg) + ! Write debug output if appropriate + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + do g = bounds%begg,bounds%endg + i = 1 + g - bounds%begg + write(iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) + end do end if + ! Check for nans + call check_for_nans(output, trim(fldname), bounds%begg) + end subroutine state_getimport !=============================================================================== - subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index, rc) + subroutine state_setexport(state, fb, fldname, bounds, input, minus, ungridded_index, rc) ! ---------------------------------------------- ! Map input array to export state field @@ -584,6 +636,7 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index ! input/output variables type(ESMF_State) , intent(inout) :: state + character(len=*) , intent(in) :: fb type(bounds_type) , intent(in) :: bounds character(len=*) , intent(in) :: fldname real(r8) , intent(in) :: input(bounds%begg:bounds%endg) @@ -596,73 +649,64 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index real(R8), pointer :: fldptr1d(:) real(R8), pointer :: fldptr2d(:,:) character(len=cs) :: cvalue - type(ESMF_StateItem_Flag) :: itemFlag character(len=*), parameter :: subname='(lnd_import_export:state_setexport)' ! ---------------------------------------------- rc = ESMF_SUCCESS - ! Determine if field with name fldname exists in state - call ESMF_StateGet(state, trim(fldname), itemFlag, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! if field exists then create output array - else do nothing - if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + ! get field pointer + if (present(ungridded_index)) then + call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname)//" index "//trim(cvalue), & + ESMF_LOGMSG_INFO) + call state_getfldptr(state, trim(fb), trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname), ESMF_LOGMSG_INFO) + call state_getfldptr(state, trim(fb), trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if - ! get field pointer - if (present(ungridded_index)) then - call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname)//" index "//trim(cvalue), & - ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname), ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + ! TODO: if fillvalue = shr_const_spval the snowhl sent to the atm will have the spval over some points + ! rather than 0 - this is very odd and needs to be understood + ! fldptr(:) = fillvalue - ! TODO: if fillvalue = shr_const_spval the snowhl sent to the atm will have the spval over some points - ! rather than 0 - this is very odd and needs to be understood - ! fldptr(:) = fillvalue - - ! determine output array - if (present(ungridded_index)) then - fldptr2d(ungridded_index,:) = 0._r8 - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - fldptr2d(ungridded_index,n) = input(g) - end do - if (present(minus)) then - fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) - end if - else - fldptr1d(:) = 0._r8 - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - fldptr1d(n) = input(g) - end do - if (present(minus)) then - fldptr1d(:) = -fldptr1d(:) - end if + ! determine output array + if (present(ungridded_index)) then + fldptr2d(ungridded_index,:) = 0._r8 + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + fldptr2d(ungridded_index,n) = input(g) + end do + if (present(minus)) then + fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) end if - - ! write debug output if appropriate - if (masterproc .and. debug > 0 .and. get_nstep() < 5) then - do g = bounds%begg,bounds%endg - i = 1 + g - bounds%begg - write(iulog,F01)'export: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,input(g) - end do + else + fldptr1d(:) = 0._r8 + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + fldptr1d(n) = input(g) + end do + if (present(minus)) then + fldptr1d(:) = -fldptr1d(:) end if + end if - ! check for nans - call check_for_nans(input, trim(fldname), bounds%begg) + ! write debug output if appropriate + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + do g = bounds%begg,bounds%endg + i = 1 + g - bounds%begg + write(iulog,F01)'export: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,input(g) + end do end if + ! check for nans + call check_for_nans(input, trim(fldname), bounds%begg) + end subroutine state_setexport !=============================================================================== - subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) + subroutine state_getfldptr(State, fb, fldname, fldptr1d, fldptr2d, rc) ! ---------------------------------------------- ! Get pointer to a state field @@ -670,6 +714,7 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) ! input/output variables type(ESMF_State), intent(in) :: State + character(len=*), intent(in) :: fb character(len=*), intent(in) :: fldname real(R8), pointer, optional , intent(out) :: fldptr1d(:) real(R8), pointer, optional , intent(out) :: fldptr2d(:,:) @@ -680,31 +725,21 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) type(ESMF_Field) :: lfield type(ESMF_Mesh) :: lmesh integer :: nnodes, nelements - character(len=*), parameter :: subname='(lnd_import_export:state_getfldptr)' - - type(ESMF_StateItem_Flag) :: itemFlag type(ESMF_FieldBundle) :: fieldBundle - logical :: isPresent + character(len=*), parameter :: subname='(lnd_import_export:state_getfldptr)' ! ---------------------------------------------- rc = ESMF_SUCCESS - ! Determine if this field bundle exist.... - ! TODO: combine the error checks.... - - call ESMF_StateGet(state, "c2l_fb", itemFlag, rc=rc) - !call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Get the fieldbundle from state... - call ESMF_StateGet(state, "c2l_fb", fieldBundle, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - + ! Get the fieldbundle from the state... + call ESMF_StateGet(state, trim(fb), fieldBundle, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("ERROR: fb "//trim(fb)//" not found in state") - call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, isPresent=isPresent, rc=rc) - !call ESMF_FieldBundleGet(fieldBundle,trim(fldname), lfield, isPresent, rc) + ! Get the field from the field bundle + call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Get the status of the field call ESMF_FieldGet(lfield, status=status, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -725,14 +760,13 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) return end if + ! Get the data from the field if (present(fldptr1d)) then call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc .and. debug > 0) then write(iulog,F01)' in '//trim(subname)//'fldptr1d for '//trim(fldname)//' is ' end if - !print *, "FLDPTR1D is" - !print *, FLDPTR1d else if (present(fldptr2d)) then call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 72719b05b03853582e65ed5545d84a227f9ba2e4 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 5 Dec 2019 12:53:10 -0700 Subject: [PATCH 0479/1973] addition of mosart input file --- lilac/atm_driver/mosart_in | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lilac/atm_driver/mosart_in diff --git a/lilac/atm_driver/mosart_in b/lilac/atm_driver/mosart_in new file mode 100644 index 0000000000..d7844885bb --- /dev/null +++ b/lilac/atm_driver/mosart_in @@ -0,0 +1,21 @@ +&mosart_inparm + bypass_routing_option = "direct_in_place" + decomp_option = "roundrobin" + delt_mosart = 1800 + do_rtm = .true. + do_rtmflood = .false. + finidat_rtm = " " + frivinp_rtm = "/glade/p/cesmdata/cseg/inputdata/rof/mosart/MOSART_routing_Global_0.5x0.5_c170601.nc" + ice_runoff = .true. + qgwl_runoff_option = "threshold" + rtmhist_fexcl1 = "" + rtmhist_fexcl2 = "" + rtmhist_fexcl3 = "" + rtmhist_fincl1 = "" + rtmhist_fincl2 = "" + rtmhist_fincl3 = "" + rtmhist_mfilt = 1 + rtmhist_ndens = 1 + rtmhist_nhtfrq = 1 + smat_option = "Xonly" +/ From c9ad20319ef463b916f146e7437e1af4878b5be8 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 5 Dec 2019 19:05:36 -0700 Subject: [PATCH 0480/1973] updated mosart branch and README.lilac --- Externals.cfg | 2 +- README.lilac | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index bec4d33548..e75d8469df 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -23,7 +23,7 @@ required = True local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/mosart -tag = mosart1_0_35 +branch = lilac_cap required = True [cime] diff --git a/README.lilac b/README.lilac index 7cfe3b2429..8e38c7d7ab 100644 --- a/README.lilac +++ b/README.lilac @@ -1,19 +1,20 @@ -1) set the following environment variables (***THIS IS CRITICAL to have the lilac code built as part of ctsm) - > export LILAC_MODE='on' - -2) check out the code (ctsm and lilac are now bundled together) and built as one library - - SRC_ROOT is where ctsm is checked out +1) check out the code (ctsm and lilac are now bundled together) and built as one library > git clone https://github.com/ESCOMP/ctsm.git - > cd ctsm (this is $SRCROOT) > git checkout lilac_cap > ./manage_externals/checkout_externals -v +1) set the following environment variables (***THIS IS CRITICAL to have the lilac code built as part of ctsm) + SRC_ROOT is where ctsm is checked out + + > export LILAC_MODE='on' + > export SRCROOT=`pwd` + > export CASEDIR=/glade/scratch/mvertens/test_lilac + > export BLDDIR=$CASEDIR/bld + 3) build the ctsm/lilac library using a CIME case > cd $SRCROOT/cime/scripts - > export CASEDIR=/glade/scratch/mvertens/test_lilac > ./create_newcase --case $CASEDIR --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver nuopc > cd $CASEDIR > ./xmlchange DEBUG=TRUE @@ -22,12 +23,6 @@ 4) To build the atm_driver executable on cheyenne - - First, set BLDDIR - e.g.: - - > export BLDDIR=/glade/scratch/sacks/test_lilac_1205a/bld - - - Then, build with: - > cd $SRCROOT/lilac/atm_driver > make clean > source $CASEDIR/.env_mach_specific.sh From c2cc6c3f49b44c884665f1aed5446d507da974ab Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 5 Dec 2019 19:43:38 -0700 Subject: [PATCH 0481/1973] hard-wired coupled_to_river variable to .false. --- lilac/src/lilac_history.F90 | 94 ++++++++++++++++++--------------- lilac/src/lilac_mod.F90 | 102 +++++++++++++++++++++--------------- 2 files changed, 110 insertions(+), 86 deletions(-) diff --git a/lilac/src/lilac_history.F90 b/lilac/src/lilac_history.F90 index b8e50b892b..e754bc9151 100644 --- a/lilac/src/lilac_history.F90 +++ b/lilac/src/lilac_history.F90 @@ -92,20 +92,22 @@ end subroutine lilac_history_alarm_init !=============================================================================== - subroutine lilac_history_write(atm2cpl_state, lnd2cpl_state, rof2cpl_state, & - cpl2atm_state, cpl2lnd_state, cpl2rof_state, clock, rc) + subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & + lnd2cpl_state, cpl2lnd_state, rof2cpl_state, cpl2rof_state, clock, rc) + ! ------------------------------ ! Write lilac history file + ! ------------------------------ ! input/output variables - type(ESMF_State) :: atm2cpl_state - type(ESMF_State) :: lnd2cpl_state - type(ESMF_State) :: rof2cpl_state - type(ESMF_State) :: cpl2atm_state - type(ESMF_State) :: cpl2lnd_state - type(ESMF_State) :: cpl2rof_state - type(ESMF_Clock) :: clock - integer, intent(out) :: rc + type(ESMF_State) :: atm2cpl_state + type(ESMF_State) :: cpl2atm_state + type(ESMF_State) :: lnd2cpl_state + type(ESMF_State) :: cpl2lnd_state + type(ESMF_State), optional :: rof2cpl_state + type(ESMF_State), optional :: cpl2rof_state + type(ESMF_Clock) :: clock + integer, intent(out) :: rc ! local variables type(ESMF_FieldBundle) :: c2a_fb, a2c_fb @@ -218,7 +220,7 @@ subroutine lilac_history_write(atm2cpl_state, lnd2cpl_state, rof2cpl_state, & !--------------------------------------- if (alarmIsOn) then - write(hist_file,"(6a)") trim(case_name), '.cpl.hi.',trim(nexttimestr),'.nc' + write(hist_file,"(6a)") trim(case_name), '.lilac.hi.',trim(nexttimestr),'.nc' call ESMF_LogWrite(trim(subname)//": write "//trim(hist_file), ESMF_LOGMSG_INFO, rc=rc) call lilac_io_wopen(hist_file, vm, iam, clobber=.true.) @@ -255,53 +257,59 @@ subroutine lilac_history_write(atm2cpl_state, lnd2cpl_state, rof2cpl_state, & nx_rof = 720 !TODO: remove this hard-wiring ny_rof = 360 !TODO: remove this hard-wiring - call ESMF_StateGet(cpl2atm_state, 'c2a_fb', c2a_fb) ! to atm + call ESMF_StateGet(atm2cpl_state, 'a2c_fb', a2c_fb) ! from atm if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2a_fb, & - nx=nx_atm, ny=ny_atm, nt=1, whead=whead, wdata=wdata, pre='cpl_to_atm', rc=rc) + call lilac_io_write(hist_file, iam, a2c_fb, & + nx=nx_atm, ny=ny_atm, nt=1, whead=whead, wdata=wdata, pre='atm_to_cpl', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_atm', c2l_fb_atm) ! to land + call ESMF_StateGet(cpl2atm_state, 'c2a_fb', c2a_fb) ! to atm if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2l_fb_atm, & - nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='cpl_to_lnd_atm', rc=rc) + call lilac_io_write(hist_file, iam, c2a_fb, & + nx=nx_atm, ny=ny_atm, nt=1, whead=whead, wdata=wdata, pre='cpl_to_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_rof', c2l_fb_rof) ! to land - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call lilac_io_write(hist_file, iam, c2l_fb_rof, & - ! nx=nx_lnd, ny=ny_lnd, nt=1, whead=.true., wdata=wdata, pre='cpl_to_lnd_rof', rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_StateGet(cpl2rof_state, 'c2r_fb', c2r_fb) ! to rof + call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_atm', l2c_fb_atm) ! from lnd if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2r_fb, & - nx=nx_rof, ny=ny_rof, nt=1, whead=whead, wdata=wdata, pre='cpl_to_rof', rc=rc) + call lilac_io_write(hist_file, iam, l2c_fb_atm, & + nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateGet(atm2cpl_state, 'a2c_fb', a2c_fb) ! from atm + call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_rof', l2c_fb_rof) ! from lnd if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, a2c_fb, & - nx=nx_atm, ny=ny_atm, nt=1, whead=whead, wdata=wdata, pre='atm_to_cpl', rc=rc) + call lilac_io_write(hist_file, iam, l2c_fb_rof, & + nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_rof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_atm', l2c_fb_atm) ! from land + call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_atm', c2l_fb_atm) ! to lnd if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, l2c_fb_atm, & - nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_atm', rc=rc) + call lilac_io_write(hist_file, iam, c2l_fb_atm, & + nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='cpl_to_lnd_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_rof', l2c_fb_rof) ! from land - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call lilac_io_write(hist_file, iam, l2c_fb_rof, & - ! nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_rof', rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! call ESMF_StateGet(rof2cpl_state, 'r2c_fb', r2c_fb) ! from rof - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call lilac_io_write(hist_file, iam, r2c_fb, & - ! nx=nx_rof, ny=ny_rof, nt=1, whead=whead, wdata=wdata, pre='rof_to_cpl', rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (present(rof2cpl_state)) then + call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_rof', c2l_fb_rof) ! to lnd + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, c2l_fb_rof, & + nx=nx_lnd, ny=ny_lnd, nt=1, whead=.true., wdata=wdata, pre='cpl_to_lnd_rof', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + if (present(cpl2rof_state)) then + call ESMF_StateGet(cpl2rof_state, 'c2r_fb', c2r_fb) ! to rof + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, c2r_fb, & + nx=nx_rof, ny=ny_rof, nt=1, whead=whead, wdata=wdata, pre='cpl_to_rof', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + if (present(rof2cpl_state)) then + call ESMF_StateGet(rof2cpl_state, 'r2c_fb', r2c_fb) ! from rof + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, r2c_fb, & + nx=nx_rof, ny=ny_rof, nt=1, whead=whead, wdata=wdata, pre='rof_to_cpl', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if enddo diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index da45c6219a..aa155e3a93 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -60,6 +60,9 @@ module lilac_mod type(ESMF_Alarm) :: lilac_restart_alarm type(ESMF_Alarm) :: lilac_stop_alarm + ! Coupling to mosart is now set to .false. by default + logical :: couple_to_river = .false. + integer :: mytask character(*) , parameter :: modname = "lilac_mod" @@ -409,20 +412,22 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat call ESMF_LogWrite(subname//"CTSM gridded component initialized", ESMF_LOGMSG_INFO) ! ------------------------------------------------------------------------- - ! Initialze MOSART Gridded Component + ! Initialize MOSART Gridded Component ! First Create the empty import and export states used to pass data ! between components. (these are module variables) ! ------------------------------------------------------------------------- - cpl2rof_state = ESMF_StateCreate(name='state_to_river', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - rof2cpl_state = ESMF_StateCreate(name='state_fr_river', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return + if (couple_to_river) then + cpl2rof_state = ESMF_StateCreate(name='state_to_river', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + rof2cpl_state = ESMF_StateCreate(name='state_fr_river', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_GridCompInitialize(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & - clock=lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing mosart") - call ESMF_LogWrite(subname//"MOSART gridded component initialized", ESMF_LOGMSG_INFO) + call ESMF_GridCompInitialize(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing mosart") + call ESMF_LogWrite(subname//"MOSART gridded component initialized", ESMF_LOGMSG_INFO) + end if ! ------------------------------------------------------------------------- ! Initialze LILAC coupler components @@ -437,23 +442,25 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_atm2lnd component") call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) - ! The following fills in the rof field bundle in cpl2lnd_state - call ESMF_CplCompInitialize(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & - clock=lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") - call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) - ! The following maps the atm field bundle in lnd2cpl_state to the atm mesh call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2cpl_state, exportState=cpl2atm_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) - ! The following maps the rof field bundle in lnd2cpl_state to the rof mesh - call ESMF_CplCompInitialize(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & - clock=lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2rof component") - call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) + if (couple_to_river) then + ! The following maps the rof field bundle in lnd2cpl_state to the rof mesh + call ESMF_CplCompInitialize(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2rof component") + call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) + + ! The following fills in the rof field bundle in cpl2lnd_state + call ESMF_CplCompInitialize(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") + call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) + end if if (mytask == 0) then print *, trim(subname) // "finished lilac initialization" @@ -543,31 +550,40 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in cpl_lnd2atm") - ! Run cpl_lnd2rof - call ESMF_LogWrite(subname//"running cpl_lnd2rof_comp ", ESMF_LOGMSG_INFO) - if (mytask == 0) print *, "Running coupler component..... cpl_lnd2rof_comp" - call ESMF_CplCompRun(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & - clock=lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_lnd2rof") - - ! Run mosart - call ESMF_LogWrite(subname//"running mosart", ESMF_LOGMSG_INFO) - if (mytask == 0) print *, "Running mosart" - call ESMF_GridCompRun(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & - clock=lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") - - ! Run cpl_rof2lnd - ! call ESMF_LogWrite(subname//"running cpl_rof2lnd_comp ", ESMF_LOGMSG_INFO) - ! if (mytask == 0) print *, "Running coupler component..... cpl_rof2lnd_comp" - ! call ESMF_CplCompRun(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & - ! clock=lilac_clock, rc=rc) - ! if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_rof2lnd") + if (couple_to_river) then + ! Run cpl_lnd2rof + call ESMF_LogWrite(subname//"running cpl_lnd2rof_comp ", ESMF_LOGMSG_INFO) + if (mytask == 0) print *, "Running coupler component..... cpl_lnd2rof_comp" + call ESMF_CplCompRun(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_lnd2rof") + + ! Run mosart + call ESMF_LogWrite(subname//"running mosart", ESMF_LOGMSG_INFO) + if (mytask == 0) print *, "Running mosart" + call ESMF_GridCompRun(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") + + ! Run cpl_rof2lnd + ! TODO: uncommenting this needs to be tested + ! call ESMF_LogWrite(subname//"running cpl_rof2lnd_comp ", ESMF_LOGMSG_INFO) + ! if (mytask == 0) print *, "Running coupler component..... cpl_rof2lnd_comp" + ! call ESMF_CplCompRun(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & + ! clock=lilac_clock, rc=rc) + ! if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_rof2lnd") + end if ! Write out history output - call lilac_history_write(atm2cpl_state, lnd2cpl_state, rof2cpl_state, & - cpl2atm_state, cpl2lnd_state, cpl2rof_state, lilac_clock, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") + if (couple_to_river) then + call lilac_history_write(atm2cpl_state, cpl2atm_state, lnd2cpl_state, cpl2lnd_state, & + rof2cpl_state=rof2cpl_state, cpl2rof_state=cpl2rof_state, clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") + else + call lilac_history_write(atm2cpl_state, cpl2atm_state, lnd2cpl_state, cpl2lnd_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") + end if ! Advance the time at the end of the time step call ESMF_ClockAdvance(lilac_clock, rc=rc) From 2b40c6bd04df222fa5e79a63a1ae8c47d88fe444 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 5 Dec 2019 21:42:22 -0700 Subject: [PATCH 0482/1973] moved lilac_utils.F90 contents into lilac_atmcap.R90 and removed the file --- lilac/atm_driver/atm_driver.F90 | 62 ++--- lilac/src/lilac_atmaero.F90 | 2 +- lilac/src/lilac_atmcap.F90 | 267 +++++++++++++++++++- lilac/src/lilac_mod.F90 | 11 +- lilac/src/lilac_utils.F90 | 423 -------------------------------- src/cpl/lilac/lnd_comp_esmf.F90 | 23 +- 6 files changed, 314 insertions(+), 474 deletions(-) delete mode 100644 lilac/src/lilac_utils.F90 diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index a9622e00b0..8f826862ec 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -18,7 +18,7 @@ program atm_driver use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS use lilac_mod , only : lilac_init, lilac_run, lilac_final - use lilac_utils , only : lilac_atm2lnd, lilac_lnd2atm + use lilac_atmcap, only : lilac_atmcap_atm2lnd, lilac_atmcap_lnd2atm implicit none @@ -272,60 +272,60 @@ subroutine atm_driver_to_lilac (lon, lat) allocate(data(lsize)) data(:) = 30.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Sa_z', data) + call lilac_atmcap_atm2lnd('Sa_z', data) data(:) = 10.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Sa_topo', data) + call lilac_atmcap_atm2lnd('Sa_topo', data) data(:) = 20.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Sa_u', data) + call lilac_atmcap_atm2lnd('Sa_u', data) data(:) = 40.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Sa_v', data) + call lilac_atmcap_atm2lnd('Sa_v', data) data(:) = 280.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Sa_ptem', data) + call lilac_atmcap_atm2lnd('Sa_ptem', data) data(:) = 100100.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Sa_pbot', data) + call lilac_atmcap_atm2lnd('Sa_pbot', data) data(:) = 280.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Sa_tbot', data) + call lilac_atmcap_atm2lnd('Sa_tbot', data) data(:) = 0.0004d0 !+(lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 - call lilac_atm2lnd('Sa_shum', data) + call lilac_atmcap_atm2lnd('Sa_shum', data) data(:) = 200.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Faxa_lwdn', data) + call lilac_atmcap_atm2lnd('Faxa_lwdn', data) data(:) = 0.0d0 - call lilac_atm2lnd('Faxa_rainc', data) + call lilac_atmcap_atm2lnd('Faxa_rainc', data) data(:) = 3.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 - call lilac_atm2lnd('Faxa_rainl', data) + call lilac_atmcap_atm2lnd('Faxa_rainl', data) data(:) = 1.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 - call lilac_atm2lnd('Faxa_snowc', data) + call lilac_atmcap_atm2lnd('Faxa_snowc', data) data(:) = 2.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 - call lilac_atm2lnd('Faxa_snowl', data) + call lilac_atmcap_atm2lnd('Faxa_snowl', data) data(:) = 100.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Faxa_swndr', data) + call lilac_atmcap_atm2lnd('Faxa_swndr', data) data(:) = 50.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Faxa_swvdr', data) + call lilac_atmcap_atm2lnd('Faxa_swvdr', data) data(:) = 20.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Faxa_swndf', data) + call lilac_atmcap_atm2lnd('Faxa_swndf', data) data(:) = 40.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 - call lilac_atm2lnd('Faxa_swvdf', data) + call lilac_atmcap_atm2lnd('Faxa_swvdf', data) end subroutine atm_driver_to_lilac !======================================================================== - subroutine lilac_to_atm_driver () + subroutine lilac_to_atm_driver ! local variables integer :: lsize @@ -335,18 +335,18 @@ subroutine lilac_to_atm_driver () lsize = size(atm_global_index) allocate(data(lsize)) - call lilac_lnd2atm('Sl_lfrin' , data) - call lilac_lnd2atm('Sl_t' , data) - call lilac_lnd2atm('Sl_tref' , data) - call lilac_lnd2atm('Sl_qref' , data) - call lilac_lnd2atm('Sl_avsdr' , data) - call lilac_lnd2atm('Sl_anidr' , data) - call lilac_lnd2atm('Sl_avsdf' , data) - call lilac_lnd2atm('Sl_anidf' , data) - call lilac_lnd2atm('Sl_snowh' , data) - call lilac_lnd2atm('Sl_u10' , data) - call lilac_lnd2atm('Sl_fv' , data) - call lilac_lnd2atm('Sl_ram1' , data) + call lilac_atmcap_lnd2atm('Sl_lfrin' , data) + call lilac_atmcap_lnd2atm('Sl_t' , data) + call lilac_atmcap_lnd2atm('Sl_tref' , data) + call lilac_atmcap_lnd2atm('Sl_qref' , data) + call lilac_atmcap_lnd2atm('Sl_avsdr' , data) + call lilac_atmcap_lnd2atm('Sl_anidr' , data) + call lilac_atmcap_lnd2atm('Sl_avsdf' , data) + call lilac_atmcap_lnd2atm('Sl_anidf' , data) + call lilac_atmcap_lnd2atm('Sl_snowh' , data) + call lilac_atmcap_lnd2atm('Sl_u10' , data) + call lilac_atmcap_lnd2atm('Sl_fv' , data) + call lilac_atmcap_lnd2atm('Sl_ram1' , data) end subroutine lilac_to_atm_driver diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 index f54481ae62..2ac17d8da7 100644 --- a/lilac/src/lilac_atmaero.F90 +++ b/lilac/src/lilac_atmaero.F90 @@ -28,7 +28,7 @@ module lilac_atmaero use clm_time_manager , only : get_calendar ! lilac uses - use lilac_utils , only : gindex_atm + use lilac_atmcap , only : gindex_atm use lilac_methods , only : chkerr use lilac_methods , only : lilac_methods_FB_getFieldN diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index d03db5a0b2..5ff1541a49 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -1,28 +1,281 @@ module lilac_atmcap !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! This is a dummy atmosphere cap for setting up lilac structure. + ! This is an ESMF lilac cap for the host atmosphere + ! + ! THE HOST ATMOSPHERE IS RESPONSIBLE for calling lilac_init() and in turn + ! lilac_init() calls the initialization routines for atm2lnd and lnd2atm + ! + ! the host atm init call will be + ! call lilac_init() + ! the host atm run phase will be + ! call lilac_atm2lnd(fldname, data1d) + ! call lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) + ! call lilac_lnd2atm(fldname, data1d) !----------------------------------------------------------------------- use ESMF - use lilac_utils , only : atm2lnd, lnd2atm, gindex_atm, atm_mesh_filename - use lilac_methods, only : chkerr + use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_cl, CS => shr_kind_cs + use shr_sys_mod , only : shr_sys_abort + use lilac_methods , only : chkerr implicit none public :: lilac_atmos_register + public :: lilac_atmcap_init + public :: lilac_atmcap_atm2lnd + public :: lilac_atmcap_lnd2atm + + private :: lilac_atmcap_add_fld + + ! Global index space info for atm data + integer, public, allocatable :: gindex_atm (:) + + ! Mesh file to be read in by lilac_atm + character(len=CL), public :: atm_mesh_filename + + type :: atmcap_type + character(len=CL) :: fldname + real(r8), pointer :: dataptr(:) + character(len=CS) :: units + logical :: provided_by_atm + logical :: required_fr_atm + end type atmcap_type + type(atmcap_type), pointer, public :: atm2lnd(:) + type(atmcap_type), pointer, public :: lnd2atm(:) + integer :: mytask integer, parameter :: debug = 0 ! internal debug level - character(*),parameter :: u_FILE_u = & + character(*), parameter :: u_FILE_u = & __FILE__ !======================================================================== contains !======================================================================== + subroutine lilac_atmcap_init() + integer :: n, lsize + + lsize = size(gindex_atm) + + ! TODO: how is the atm going to specify which fields are not provided = + ! should it pass an array of character strings or a colon deliminited set of fields + ! to specify the fields it will not provide - and then these are checked against those fields + + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_v' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_ptem' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_pbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_tbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_shum' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_lwdn' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_rainc' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_rainl' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_snowc' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_snowl' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_swndr' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_swvdr' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_swndf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_swvdf' , units='unknown', required_fr_atm=.true. , lsize=lsize) + + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_ocphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_ocphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_ocphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet1' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry1' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet2' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry2' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet3' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry3' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet4' , units='unknown', required_fr_atm=.true. , lsize=lsize) + call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry4' , units='unknown', required_fr_atm=.true. , lsize=lsize) + + ! TODO: optional fields - if these are uncommented then need to make sure that they are also appear in the lnd + ! import state + ! CRITICAL the fields in the export state from lilac_atmcap MUST match the fields in the import state to the land + ! this is not being checked currently and msut be + !call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) + !call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) + + ! now add dataptr memory for all of the fields and set default values of provided_by_atm to false + do n = 1,size(atm2lnd) + allocate(atm2lnd(n)%dataptr(lsize)) + atm2lnd(n)%provided_by_atm = .false. + end do + + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_lfrin' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_t' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_tref' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_qref' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_avsdr' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_anidr' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_avsdf' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_anidf' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_snowh' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_u10' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_fv' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_ram1' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_taux' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_tauy' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_lat' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_sen' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_lwup' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_evap' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_swnet' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_flxdst1' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_flxdst2' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_flxdst3' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_flxdst4' , units='unknown', lsize=lsize) + + ! now add dataptr memory for all of the fields + do n = 1,size(lnd2atm) + allocate(lnd2atm(n)%dataptr(lsize)) + end do + + end subroutine lilac_atmcap_init + +!======================================================================== + subroutine lilac_atmcap_atm2lnd(fldname, data) + + ! input/output variables + character(len=*), intent(in) :: fldname + real(r8), intent(in) :: data(:) + + ! local variables + integer :: n + logical :: found + ! -------------------------------------------- + + found = .false. + do n = 1,size(atm2lnd) + if (trim(fldname) == atm2lnd(n)%fldname) then + found = .true. + if (size(data) /= size(atm2lnd(n)%dataptr)) then + ! call abort - TODO: what is the abort call in lilac + else + atm2lnd(n)%dataptr(:) = data(:) + end if + atm2lnd(n)%provided_by_atm = .true. + exit + end if + end do + if (.not. found) then + ! abort + end if + + contains + + subroutine lilac_atm2lnd_check() + integer :: n ! if there are fields that the atmosphere does not provide but + ! that are required - then abort + do n = 1,size(atm2lnd) + if (atm2lnd(n)%required_fr_atm .and. (.not. atm2lnd(n)%provided_by_atm)) then + ! call abort or provide default values? + else if (.not. atm2lnd(n)%provided_by_atm) then + ! create default values + end if + end do + end subroutine lilac_atm2lnd_check + + end subroutine lilac_atmcap_atm2lnd + +!======================================================================== + subroutine lilac_atmcap_lnd2atm(fldname, data) + character(len=*) , intent(in) :: fldname + real(r8) , intent(out) :: data(:) + integer :: n + + do n = 1,size(lnd2atm) + if (trim(fldname) == lnd2atm(n)%fldname) then + if (size(data) /= size(lnd2atm(n)%dataptr)) then + ! call abort - TODO: what is the abort call in lilac + else + data(:) = lnd2atm(n)%dataptr(:) + end if + end if + end do + end subroutine lilac_atmcap_lnd2atm + +!======================================================================== + subroutine lilac_atmcap_add_fld(flds, fldname, units, lsize, required_fr_atm) + + ! ---------------------------------------------- + ! Add an entry to to the flds array + ! Use pointers to create an extensible allocatable array. + ! to allow the size of flds to grow, the process for + ! adding a new field is: + ! 1) allocate newflds to be N (one element larger than flds) + ! 2) copy flds into first N-1 elements of newflds + ! 3) newest flds entry is Nth element of newflds + ! 4) deallocate / nullify flds + ! 5) point flds => newflds + ! ---------------------------------------------- + + type(atmcap_type), pointer :: flds(:) + character(len=*) , intent(in) :: fldname + character(len=*) , intent(in) :: units + integer , intent(in) :: lsize + logical, optional, intent(in) :: required_fr_atm + + ! local variables + integer :: n,oldsize,newsize + type(atmcap_type), pointer :: newflds(:) + character(len=*), parameter :: subname='(lilac_atmcap_atm2lnd_fld)' + ! ---------------------------------------------- + + if (associated(flds)) then + oldsize = size(flds) + else + oldsize = 0 + end if + newsize = oldsize + 1 + + if (oldsize > 0) then + ! 1) allocate newfld to be size (one element larger than input flds) + allocate(newflds(newsize)) + + ! 2) copy flds into first N-1 elements of newflds + do n = 1,oldsize + newflds(n)%fldname = flds(n)%fldname + newflds(n)%units = flds(n)%units + newflds(n)%required_fr_atm = flds(n)%required_fr_atm + end do + + ! 3) deallocate / nullify flds + if (oldsize > 0) then + deallocate(flds) + nullify(flds) + end if + + ! 4) point flds => new_flds + flds => newflds + + ! 5) update flds information for new entry + flds(newsize)%fldname = trim(fldname) + flds(newsize)%units = trim(units) + if (present(required_fr_atm)) then + flds(newsize)%required_fr_atm = required_fr_atm + end if + + else + allocate(flds(newsize)) + flds(newsize)%fldname = trim(fldname) + flds(newsize)%units = trim(units) + if (present(required_fr_atm)) then + flds(newsize)%required_fr_atm = required_fr_atm + end if + end if + + end subroutine lilac_atmcap_add_fld + + !======================================================================== subroutine lilac_atmos_register (comp, rc) type(ESMF_GridComp) :: comp ! must not be optional @@ -86,7 +339,7 @@ subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) !------------------------------------------------------------------------- ! Note that in the call to lilac_atm the host atmospere sent both the gindex_atm and - ! the atm_mesh_filename that were then set as module variables in lilac_utils + ! the atm_mesh_filename that were then set as module variables here atm_distgrid = ESMF_DistGridCreate (arbSeqIndexList=gindex_atm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -169,7 +422,6 @@ subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) end subroutine lilac_atmos_init !======================================================================== - subroutine lilac_atmos_run(comp, importState, exportState, clock, rc) ! input/output variables @@ -189,7 +441,6 @@ subroutine lilac_atmos_run(comp, importState, exportState, clock, rc) end subroutine lilac_atmos_run !======================================================================== - subroutine lilac_atmos_final(comp, importState, exportState, clock, rc) ! input/output variables diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index aa155e3a93..52ddcd0a88 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -17,8 +17,8 @@ module lilac_mod ! lilac routines use lilac_io , only : lilac_io_init - use lilac_utils , only : lilac_init_lnd2atm, lilac_init_atm2lnd - use lilac_utils , only : gindex_atm, atm_mesh_filename + use lilac_atmcap , only : lilac_atmcap_init + use lilac_atmcap , only : gindex_atm, atm_mesh_filename use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register use lilac_cpl , only : cpl_lnd2rof_register, cpl_rof2lnd_register use lilac_atmcap , only : lilac_atmos_register @@ -171,7 +171,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat call ESMF_LogWrite(subname//"initialized shr_pio_init2 ...", ESMF_LOGMSG_INFO) !------------------------------------------------------------------------- - ! Initial lilac_utils module variables + ! Initial lilac_atmcap module variables !------------------------------------------------------------------------- ! Initialize gindex_atm @@ -184,9 +184,8 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat ! Initialize datatypes atm2lnd and lnd2atm ! This must be done BEFORE the atmcap initialization - since the dataptr attributes - ! are only needed to initialize the atmcap field bundles - call lilac_init_atm2lnd(lsize) - call lilac_init_lnd2atm(lsize) + ! are needed to initialize the atmcap field bundles + call lilac_atmcap_init() !------------------------------------------------------------------------- ! Create Gridded Component -- lilac atmos_cap diff --git a/lilac/src/lilac_utils.F90 b/lilac/src/lilac_utils.F90 deleted file mode 100644 index 89e4fb3130..0000000000 --- a/lilac/src/lilac_utils.F90 +++ /dev/null @@ -1,423 +0,0 @@ -module lilac_utils - - ! *********************************************************************** - ! THE HOST ATMOSPHERE IS RESPONSIBLE for calling lilac_init() and in turn - ! lilac_init() calls the initialization routines for atm2lnd and lnd2atm - ! - ! the host atm init call will be - ! call lilac_init() - ! the host atm run phase will be - ! call lilac_atm2lnd(fldname, data1d) - ! call lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) - ! call lilac_lnd2atm(fldname, data1d) - ! *********************************************************************** - - use ESMF - use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_cl, CS => shr_kind_cs - use shr_sys_mod , only : shr_sys_abort - use lilac_methods , only : chkerr - - implicit none - private - - public :: lilac_init_atm2lnd - public :: lilac_init_lnd2atm - public :: lilac_atm2lnd - public :: lilac_lnd2atm - public :: lilac_field_bundle_to_land - public :: lilac_field_bundle_fr_land - - private :: lilac_atm2lnd_add_fld - private :: lilac_lnd2atm_add_fld - - ! Global index space info for atm data - integer, public, allocatable :: gindex_atm (:) - - ! Mesh file to be read in by lilac_atm - character(len=CL), public :: atm_mesh_filename - - ! Mesh file to be read in by ctsm - character(len=CL), public :: lnd_mesh_filename - - type :: atm2lnd_type - character(len=CL) :: fldname - real(r8), pointer :: dataptr(:) - character(len=CS) :: units - logical :: provided_by_atm - logical :: required_fr_atm - end type atm2lnd_type - type(atm2lnd_type), pointer, public :: atm2lnd(:) - - type :: lnd2atm_type - character(len=128) :: fldname - real(r8), pointer :: dataptr(:) - character(len=64) :: units - end type lnd2atm_type - type(atm2lnd_type), pointer, public :: lnd2atm(:) - - character(*), parameter :: u_FILE_u = & - __FILE__ - -!======================================================================== -contains -!======================================================================== - - subroutine lilac_init_atm2lnd(lsize) - integer, intent(in) :: lsize - integer :: n - - ! TODO: how is the atm going to specify which fields are not provided = - ! should it pass an array of character strings or a colon deliminited set of fields - ! to specify the fields it will not provide - and then these are checked against those fields - - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_v' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_ptem' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_pbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_tbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_shum' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_lwdn' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainc' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_rainl' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowc' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_snowl' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndr' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdr' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_swndf' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_swvdf' , units='unknown', required_fr_atm=.true. , lsize=lsize) - - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_ocphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet1' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry1' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet2' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry2' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet3' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry3' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstwet4' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_dstdry4' , units='unknown', required_fr_atm=.true. , lsize=lsize) - - ! TODO: optional fields - if these are uncommented then need to make sure that they are also appear in the lnd - ! import state - ! CRITICAL the fields in the export state from lilac_atmcap MUST match the fields in the import state to the land - ! this is not being checked currently and msut be - !call lilac_atm2lnd_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) - !call lilac_atm2lnd_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) - - ! now add dataptr memory for all of the fields and set default values of provided_by_atm to false - do n = 1,size(atm2lnd) - allocate(atm2lnd(n)%dataptr(lsize)) - atm2lnd(n)%provided_by_atm = .false. - end do - end subroutine lilac_init_atm2lnd - - !======================================================================== - - subroutine lilac_init_lnd2atm(lsize) - integer, intent(in) :: lsize - integer :: n - - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_lfrin' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_t' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_tref' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_qref' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_avsdr' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_anidr' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_avsdf' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_anidf' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_snowh' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_u10' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_fv' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Sl_ram1' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_taux' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_tauy' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_lat' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_sen' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_lwup' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_evap' , units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_swnet', units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_flxdst1', units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_flxdst2', units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_flxdst3', units='unknown', lsize=lsize) - call lilac_lnd2atm_add_fld (lnd2atm , fldname='Fall_flxdst4', units='unknown', lsize=lsize) - - ! now add dataptr memory for all of the fields - do n = 1,size(lnd2atm) - allocate(lnd2atm(n)%dataptr(lsize)) - end do - end subroutine lilac_init_lnd2atm - -!======================================================================== - - subroutine lilac_atm2lnd(fldname, data) - - ! input/output variables - character(len=*), intent(in) :: fldname - real(r8), intent(in) :: data(:) - - ! local variables - integer :: n - logical :: found - ! -------------------------------------------- - - found = .false. - do n = 1,size(atm2lnd) - if (trim(fldname) == atm2lnd(n)%fldname) then - found = .true. - if (size(data) /= size(atm2lnd(n)%dataptr)) then - ! call abort - TODO: what is the abort call in lilac - else - atm2lnd(n)%dataptr(:) = data(:) - end if - atm2lnd(n)%provided_by_atm = .true. - exit - end if - end do - if (.not. found) then - ! abort - end if - - end subroutine lilac_atm2lnd - -!======================================================================== - - subroutine lilac_atm2lnd_check() - - ! local variables - integer :: n - ! -------------------------------------------- - - ! if there are fields that the atmosphere does not provide but that are required - then abort - do n = 1,size(atm2lnd) - if (atm2lnd(n)%required_fr_atm .and. (.not. atm2lnd(n)%provided_by_atm)) then - ! call abort or provide default values? - else if (.not. atm2lnd(n)%provided_by_atm) then - ! create default values - end if - end do - end subroutine lilac_atm2lnd_check - -!======================================================================== - - subroutine lilac_lnd2atm(fldname, data) - ! input/output variables - character(len=*) , intent(in) :: fldname - real(r8) , intent(out) :: data(:) - - ! local variables - integer :: n - ! -------------------------------------------- - - do n = 1,size(lnd2atm) - if (trim(fldname) == lnd2atm(n)%fldname) then - if (size(data) /= size(lnd2atm(n)%dataptr)) then - ! call abort - TODO: what is the abort call in lilac - else - data(:) = lnd2atm(n)%dataptr(:) - end if - end if - end do - end subroutine lilac_lnd2atm - -!======================================================================== - - subroutine lilac_atm2lnd_add_fld(flds, fldname, units, required_fr_atm, lsize) - - ! ---------------------------------------------- - ! Add an entry to to the flds array - ! Use pointers to create an extensible allocatable array. - ! to allow the size of flds to grow, the process for - ! adding a new field is: - ! 1) allocate newflds to be N (one element larger than flds) - ! 2) copy flds into first N-1 elements of newflds - ! 3) newest flds entry is Nth element of newflds - ! 4) deallocate / nullify flds - ! 5) point flds => newflds - ! ---------------------------------------------- - - type(atm2lnd_type), pointer :: flds(:) - character(len=*) , intent(in) :: fldname - character(len=*) , intent(in) :: units - logical , intent(in) :: required_fr_atm - integer , intent(in) :: lsize - - ! local variables - integer :: n,oldsize,newsize - type(atm2lnd_type), pointer :: newflds(:) - character(len=*), parameter :: subname='(lilac_utils_add_atm2lnd_fld)' - ! ---------------------------------------------- - - if (associated(flds)) then - oldsize = size(flds) - else - oldsize = 0 - end if - newsize = oldsize + 1 - - if (oldsize > 0) then - ! 1) allocate newfld to be size (one element larger than input flds) - allocate(newflds(newsize)) - - ! 2) copy flds into first N-1 elements of newflds - do n = 1,oldsize - newflds(n)%fldname = flds(n)%fldname - newflds(n)%units = flds(n)%units - newflds(n)%required_fr_atm = flds(n)%required_fr_atm - end do - - ! 3) deallocate / nullify flds - if (oldsize > 0) then - deallocate(flds) - nullify(flds) - end if - - ! 4) point flds => new_flds - flds => newflds - - ! 5) update flds information for new entry - flds(newsize)%fldname = trim(fldname) - flds(newsize)%units = trim(units) - flds(newsize)%required_fr_atm = required_fr_atm - - else - allocate(flds(newsize)) - flds(newsize)%fldname = trim(fldname) - flds(newsize)%units = trim(units) - flds(newsize)%required_fr_atm = required_fr_atm - end if - - end subroutine lilac_atm2lnd_add_fld - -!======================================================================== - - subroutine lilac_lnd2atm_add_fld(flds, fldname, units, lsize) - - ! ---------------------------------------------- - ! Add an entry to to the flds array - ! Use pointers to create an extensible allocatable array. - ! to allow the size of flds to grow, the process for - ! adding a new field is: - ! 1) allocate newflds to be N (one element larger than flds) - ! 2) copy flds into first N-1 elements of newflds - ! 3) newest flds entry is Nth element of newflds - ! 4) deallocate / nullify flds - ! 5) point flds => newflds - ! ---------------------------------------------- - - type(atm2lnd_type), pointer :: flds(:) - character(len=*) , intent(in) :: fldname - character(len=*) , intent(in) :: units - integer , intent(in) :: lsize - - ! local variables - integer :: n,oldsize,newsize - type(atm2lnd_type), pointer :: newflds(:) - character(len=*), parameter :: subname='(lilac_init_lnd2atm)' - ! ---------------------------------------------- - - if (associated(flds)) then - oldsize = size(flds) - else - oldsize = 0 - end if - newsize = oldsize + 1 - - ! 1) allocate newfld to be size (one element larger than input flds) - allocate(newflds(newsize)) - - ! 2) copy flds into first N-1 elements of newflds - do n = 1,oldsize - newflds(n)%fldname = flds(n)%fldname - newflds(n)%units = flds(n)%units - end do - - ! 3) deallocate / nullify flds - if (oldsize > 0) then - deallocate(flds) - nullify(flds) - end if - - ! 4) point flds => new_flds - flds => newflds - - ! 5) now update flds information for new entry - flds(newsize)%fldname = trim(fldname) - flds(newsize)%units = trim(units) - - end subroutine lilac_lnd2atm_add_fld - -!======================================================================== - - subroutine lilac_field_bundle_to_land(mesh, fieldbundle, rc) - - type(ESMF_Mesh) :: mesh - type(ESMF_FieldBundle) :: fieldbundle - integer, intent(out) :: rc - - integer :: n - - rc = ESMF_SUCCESS - - ! Add empty fields to field bundle - do n = 1, size(atm2lnd) - call fldbundle_add(trim(atm2lnd(n)%fldname), mesh, fieldbundle, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - - end subroutine lilac_field_bundle_to_land - -!=============================================================================== - - subroutine lilac_field_bundle_fr_land(mesh, fieldbundle, rc) - - type(ESMF_Mesh) :: mesh - type(ESMF_FieldBundle) :: fieldbundle - integer, intent(out) :: rc - - integer :: n - - rc = ESMF_SUCCESS - - ! Add empty fields to field bundle - do n = 1, size(lnd2atm) - call fldbundle_add( trim(lnd2atm(n)%fldname), mesh, fieldbundle, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - - end subroutine lilac_field_bundle_fr_land - -!=============================================================================== - - subroutine fldbundle_add(fldname, mesh, fieldbundle, rc) - - !--------------------------- - ! Create an empty input field with name 'stdname' to add to fieldbundle - !--------------------------- - - ! input/output variables - character(len=*) , intent(in) :: fldname - type(ESMF_Mesh) , intent(in) :: mesh - type(ESMF_FieldBundle) , intent(inout) :: fieldbundle - integer , intent(out) :: rc - - ! local variables - type(ESMF_Field) :: field - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT , name=trim(fldname), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_FieldBundleAdd(fieldbundle, (/field/), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - end subroutine fldbundle_add - -end module lilac_utils diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index a0db265893..61fb8adc12 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -9,7 +9,9 @@ module lnd_comp_esmf use ESMF use mpi , only : MPI_BCAST, MPI_CHARACTER use perf_mod , only : t_startf, t_stopf, t_barrierf - use lilac_utils , only : lilac_field_bundle_to_land, lilac_field_bundle_fr_land + + ! lilac code + use lilac_atmcap , only : atm2lnd, lnd2atm ! cime share code use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl @@ -120,6 +122,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) type(ESMF_State) :: importState, exportState type(ESMF_FieldBundle) :: c2l_fb_atm, c2l_fb_rof ! field bundles in import state type(ESMF_FieldBundle) :: l2c_fb_atm, l2c_fb_rof ! field bundles in export state + type(ESMF_Field) :: lfield ! mesh generation type(ESMF_Mesh) :: lnd_mesh @@ -414,8 +417,13 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! now add atm import fields on lnd_mesh to this field bundle - call lilac_field_bundle_to_land(lnd_mesh, c2l_fb_atm, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + do n = 1, size(atm2lnd) + lfield = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT, & + name=trim(atm2lnd(n)%fldname), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldBundleAdd(c2l_fb_atm, (/lfield/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do ! add the field bundle to the state call ESMF_StateAdd(import_state, fieldbundleList = (/c2l_fb_atm/)) @@ -445,8 +453,13 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! now add atm export fields on lnd_mesh to this field bundle - call lilac_field_bundle_fr_land(lnd_mesh, l2c_fb_atm, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + do n = 1, size(lnd2atm) + lfield = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT, & + name=trim(lnd2atm(n)%fldname), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldBundleAdd(l2c_fb_atm, (/lfield/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do ! add the field bundle to the state call ESMF_StateAdd(export_state, fieldbundleList = (/l2c_fb_atm/), rc=rc) From 06f1a20d3c7234e752b3dff7d43b34bb50164537 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 5 Dec 2019 21:44:10 -0700 Subject: [PATCH 0483/1973] updated Externals.cfg to point to latest mosart lilac_cap hash --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index e75d8469df..d2c294c57f 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -23,7 +23,7 @@ required = True local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/mosart -branch = lilac_cap +tag = 14d02bb required = True [cime] From 4a79f0f3f5bd45cf1e4b6cada2350de9e3d3345a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 6 Dec 2019 09:33:15 -0700 Subject: [PATCH 0484/1973] When running lilac, by default write CTSM history every day This is helpful for testing --- README.lilac | 16 ++++------------ lilac/atm_driver/ctsm.cfg | 6 +++++- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.lilac b/README.lilac index ec3465d41b..59da475bc8 100644 --- a/README.lilac +++ b/README.lilac @@ -4,7 +4,7 @@ > git checkout lilac_cap > ./manage_externals/checkout_externals -v -1) set the following environment variables (***THIS IS CRITICAL to have the lilac code built as part of ctsm) +2) set the following environment variables (***LILAC_MODE IS CRITICAL to have the lilac code built as part of ctsm) SRCROOT is where ctsm is checked out > export LILAC_MODE='on' @@ -39,19 +39,11 @@ THIS ONLY NEEDS TO BE DONE ONCE to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory -6) write CTSM history files every time step - - insert the following after the initial '&clm_inparm' in lnd_in: - - hist_nhtfrq = 1 - hist_mfilt = 1 - hist_ndens = 1 - -7) run the atm_driver on cheyenne +6) run the atm_driver on cheyenne > qsub cheyenne.sub -8) compare with latest baselines +7) compare with latest baselines use something like this to compare the last clm and last cpl hist files: @@ -59,7 +51,7 @@ > cprnc test_lilac.clm2.h0.2000-01-02-00000.nc $basedir/test_lilac.clm2.h0.2000-01-02-00000.nc | tail -30 > cprnc test_lilac.cpl.hi.2000-01-02-00000.nc $basedir/test_lilac.cpl.hi.2000-01-02-00000.nc | tail -30 -9) if there are differences, and those are intentional, then create new +8) if there are differences, and those are intentional, then create new baselines copy all *.nc files, plus ctsm.cfg, lilac_in and lnd_in to the diff --git a/lilac/atm_driver/ctsm.cfg b/lilac/atm_driver/ctsm.cfg index 95764fb0bd..a2e46981e7 100644 --- a/lilac/atm_driver/ctsm.cfg +++ b/lilac/atm_driver/ctsm.cfg @@ -17,4 +17,8 @@ lnd_grid = 4x5 lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc lnd_domain_path = /glade/p/cesmdata/cseg/inputdata/share/domains din_loc_root = /glade/p/cesmdata/cseg/inputdata -clm_namelist_opts = "" +# clm_namelist_opts can contain space-separated settings of individual namelist variables; +# this should NOT be enclosed in quotes; example: +# clm_namelist_opts = foo=1 bar=2 +# The current setting is useful for testing (giving double-precision output every day) +clm_namelist_opts = hist_nhtfrq=-24 hist_mfilt=1 hist_ndens=1 From e5c384b5532975132d5ff5eb2cf48bcfd538c16e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 6 Dec 2019 16:51:03 -0700 Subject: [PATCH 0485/1973] cleaned up lilac_mod interface to atm_driver and lilac_atmcap module --- lilac/atm_driver/atm_driver.F90 | 30 ++- lilac/atm_driver/atm_driver_in | 2 + lilac/atm_driver/lilac_in | 3 + lilac/src/lilac_atmaero.F90 | 18 ++ lilac/src/lilac_atmcap.F90 | 390 +++++++++++++++++--------------- lilac/src/lilac_mod.F90 | 131 ++++------- 6 files changed, 290 insertions(+), 284 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 8f826862ec..1b5d82bd86 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -19,6 +19,7 @@ program atm_driver use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS use lilac_mod , only : lilac_init, lilac_run, lilac_final use lilac_atmcap, only : lilac_atmcap_atm2lnd, lilac_atmcap_lnd2atm + use shr_sys_mod , only : shr_sys_abort implicit none @@ -37,6 +38,8 @@ program atm_driver ! Namelist and related variables character(len=512) :: atm_mesh_file + integer :: atm_global_nx + integer :: atm_global_ny character(len=128) :: atm_calendar integer :: atm_timestep integer :: atm_start_year ! (yyyy) @@ -50,7 +53,8 @@ program atm_driver integer :: atm_timestep_start ! for internal time loop only integer :: atm_timestep_stop ! for internal time loop only - namelist /atm_driver_input/ atm_mesh_file, atm_calendar, atm_timestep, & + namelist /atm_driver_input/ atm_mesh_file, atm_global_nx, atm_global_ny, & + atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, & atm_timestep_start, atm_timestep_stop @@ -96,13 +100,19 @@ program atm_driver !----------------------------------------------------------------------------- ! Read mesh file to get number of points (n_points) + ! Also read in global number of lons and lats (needed for lilac history output) !----------------------------------------------------------------------------- - print *, "DEBUG: atm_mesh_file = ",trim(atm_mesh_file) call read_netcdf_mesh(atm_mesh_file, nglobal) + if (atm_global_nx * atm_global_ny /= nglobal) then + print *, " atm global nx, ny, nglobal = ",atm_global_nx, atm_global_ny, nglobal + call shr_sys_abort("Error atm_nx*atm_ny is not equal to nglobal") + end if if (mytask == 0 ) then print *, " atm_driver mesh file ",trim(atm_mesh_file) - print *, "number of global points in mesh is:", nglobal + print *, " atm global nx = ",atm_global_nx + print *, " atm global nx = ",atm_global_ny + print *, " atm number of global points in mesh is:", nglobal end if !----------------------------------------------------------------------------- @@ -144,23 +154,19 @@ program atm_driver if (mytask == 0 ) then print *, " initializing lilac " end if - call lilac_init(comp_comm, atm_mesh_file, atm_global_index, atm_lons, atm_lats, & - atm_calendar, atm_timestep, & + call lilac_init(comp_comm, atm_global_index, atm_lons, atm_lats, & + atm_global_nx, atm_global_ny, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) - !------------------------------------------------------------------------ - ! Fill in atm2lnd type pointer data - !------------------------------------------------------------------------ - - ! now fill in the dataptr values - call atm_driver_to_lilac (atm_lons, atm_lats) - !------------------------------------------------------------------------ ! Run lilac !------------------------------------------------------------------------ do nstep = atm_timestep_start, atm_timestep_stop + ! fill in the dataptr values in atm2lnd type in lilac_atmcap + call atm_driver_to_lilac (atm_lons, atm_lats) + if (nstep == atm_timestep_stop) then call lilac_run(restart_alarm_is_ringing=.true., stop_alarm_is_ringing=.true.) else diff --git a/lilac/atm_driver/atm_driver_in b/lilac/atm_driver/atm_driver_in index b4becacda4..4d88e0b9b1 100644 --- a/lilac/atm_driver/atm_driver_in +++ b/lilac/atm_driver/atm_driver_in @@ -1,5 +1,7 @@ &atm_driver_input atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + atm_global_nx = 72 + atm_global_ny = 46 atm_start_year = 2000 atm_start_mon = 1 atm_start_day = 1 diff --git a/lilac/atm_driver/lilac_in b/lilac/atm_driver/lilac_in index b51fbe35fc..51b288ba84 100644 --- a/lilac/atm_driver/lilac_in +++ b/lilac/atm_driver/lilac_in @@ -2,6 +2,9 @@ starttype = 'startup' caseid = 'test_lilac' / +&lilac_atmcap_input + atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' +/ &lilac_lnd_input lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' / diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 index 2ac17d8da7..cc9b6a175a 100644 --- a/lilac/src/lilac_atmaero.F90 +++ b/lilac/src/lilac_atmaero.F90 @@ -90,6 +90,8 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) integer , pointer :: idata(:) !----------------------------------------------------------------------- + rc = ESMF_SUCCESS + namelist /atmaero_stream/ & stream_year_first, & stream_year_last, & @@ -162,18 +164,28 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) ! obtain mesh lats, lons and areas ! ------------------------------ + write(6,*)'DEBUG: here1' + call ESMF_StateGet(atm2lnd_a_state, 'a2c_fb', lfieldbundle, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(6,*)'DEBUG: here1a' + call lilac_methods_FB_getFieldN(lfieldbundle, fieldnum=1, field=lfield, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + write(6,*)'DEBUG: here1b' + call ESMF_FieldGet(lfield, mesh=lmesh, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + write(6,*)'DEBUG: here1c' + call ESMF_MeshGet(lmesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(6,*)'DEBUG: here2' + if (numOwnedElements /= lsize) then call shr_sys_abort('ERROR: numOwnedElements is not equal to lsize') end if @@ -182,6 +194,8 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) call ESMF_MeshGet(lmesh, ownedElemCoords=ownedElemCoords, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(6,*)'DEBUG: here3' + allocate(mesh_lons(numOwnedElements)) allocate(mesh_lats(numOwnedElements)) allocate(mesh_areas(numOwnedElements)) @@ -205,6 +219,8 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) call mct_gGrid_importRattr(ggrid_atm,"mask", rdata, lsize) deallocate(mesh_lons, mesh_lats, mesh_areas, rdata) + write(6,*)'DEBUG: here4' + ! ------------------------------ ! create the stream data sdat ! ------------------------------ @@ -238,6 +254,8 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) calendar = get_calendar(), & taxmode = taxmode ) + write(6,*)'DEBUG: here5' + if (mytask == 0) then call shr_strdata_print(sdat,'ATMAERO data') endif diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 5ff1541a49..9cc7eba862 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -6,9 +6,9 @@ module lilac_atmcap ! THE HOST ATMOSPHERE IS RESPONSIBLE for calling lilac_init() and in turn ! lilac_init() calls the initialization routines for atm2lnd and lnd2atm ! - ! the host atm init call will be + ! the host atm init call will be ! call lilac_init() - ! the host atm run phase will be + ! the host atm run phase will be ! call lilac_atm2lnd(fldname, data1d) ! call lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! call lilac_lnd2atm(fldname, data1d) @@ -21,19 +21,19 @@ module lilac_atmcap implicit none - public :: lilac_atmos_register - public :: lilac_atmcap_init public :: lilac_atmcap_atm2lnd public :: lilac_atmcap_lnd2atm + public :: lilac_atmcap_register private :: lilac_atmcap_add_fld - ! Global index space info for atm data - integer, public, allocatable :: gindex_atm (:) - - ! Mesh file to be read in by lilac_atm - character(len=CL), public :: atm_mesh_filename + ! Input from host atmosphere + integer, public, allocatable :: gindex_atm(:) ! global index space + integer, public, allocatable :: atm_lons(:) ! local longitudes + integer, public, allocatable :: atm_lats(:) ! local latitudes + integer, public :: atm_global_nx + integer, public :: atm_global_ny type :: atmcap_type character(len=CL) :: fldname @@ -45,9 +45,8 @@ module lilac_atmcap type(atmcap_type), pointer, public :: atm2lnd(:) type(atmcap_type), pointer, public :: lnd2atm(:) - integer :: mytask - integer, parameter :: debug = 0 ! internal debug level - + integer :: mytask + integer , parameter :: debug = 0 ! internal debug level character(*), parameter :: u_FILE_u = & __FILE__ @@ -55,10 +54,34 @@ module lilac_atmcap contains !======================================================================== - subroutine lilac_atmcap_init() - integer :: n, lsize + subroutine lilac_atmcap_init_vars(atm_gindex_in, atm_lons_in, atm_lats_in, atm_global_nx_in, atm_global_ny_in) + + ! input/output variables + integer , intent(in) :: atm_gindex_in(:) + real , intent(in) :: atm_lons_in(:) + real , intent(in) :: atm_lats_in(:) + integer , intent(in) :: atm_global_nx_in + integer , intent(in) :: atm_global_ny_in + + ! glocal variables + integer :: n, lsize, fileunit + ! -------------------------------------------- + + lsize = size(atm_gindex_in) + allocate(gindex_atm(lsize)) + allocate(atm_lons(lsize)) + allocate(atm_lats(lsize)) + + ! set module variables + gindex_atm(:) = atm_gindex_in(:) + atm_lons(:) = atm_lons_in(:) + atm_lats(:) = atm_lats_in(:) + atm_global_nx = atm_global_nx_in + atm_global_ny = atm_global_ny_in - lsize = size(gindex_atm) + !------------------------------------------------------------------------- + ! Set module arrays atm2lnd and lnd2atm + !------------------------------------------------------------------------- ! TODO: how is the atm going to specify which fields are not provided = ! should it pass an array of character strings or a colon deliminited set of fields @@ -96,13 +119,8 @@ subroutine lilac_atmcap_init() call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry3' , units='unknown', required_fr_atm=.true. , lsize=lsize) call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet4' , units='unknown', required_fr_atm=.true. , lsize=lsize) call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry4' , units='unknown', required_fr_atm=.true. , lsize=lsize) - - ! TODO: optional fields - if these are uncommented then need to make sure that they are also appear in the lnd - ! import state - ! CRITICAL the fields in the export state from lilac_atmcap MUST match the fields in the import state to the land - ! this is not being checked currently and msut be - !call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) - !call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) + ! call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) + ! call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) ! now add dataptr memory for all of the fields and set default values of provided_by_atm to false do n = 1,size(atm2lnd) @@ -139,145 +157,12 @@ subroutine lilac_atmcap_init() allocate(lnd2atm(n)%dataptr(lsize)) end do - end subroutine lilac_atmcap_init - -!======================================================================== - subroutine lilac_atmcap_atm2lnd(fldname, data) - - ! input/output variables - character(len=*), intent(in) :: fldname - real(r8), intent(in) :: data(:) - - ! local variables - integer :: n - logical :: found - ! -------------------------------------------- - - found = .false. - do n = 1,size(atm2lnd) - if (trim(fldname) == atm2lnd(n)%fldname) then - found = .true. - if (size(data) /= size(atm2lnd(n)%dataptr)) then - ! call abort - TODO: what is the abort call in lilac - else - atm2lnd(n)%dataptr(:) = data(:) - end if - atm2lnd(n)%provided_by_atm = .true. - exit - end if - end do - if (.not. found) then - ! abort - end if - - contains - - subroutine lilac_atm2lnd_check() - integer :: n ! if there are fields that the atmosphere does not provide but - ! that are required - then abort - do n = 1,size(atm2lnd) - if (atm2lnd(n)%required_fr_atm .and. (.not. atm2lnd(n)%provided_by_atm)) then - ! call abort or provide default values? - else if (.not. atm2lnd(n)%provided_by_atm) then - ! create default values - end if - end do - end subroutine lilac_atm2lnd_check - - end subroutine lilac_atmcap_atm2lnd - -!======================================================================== - subroutine lilac_atmcap_lnd2atm(fldname, data) - character(len=*) , intent(in) :: fldname - real(r8) , intent(out) :: data(:) - integer :: n - - do n = 1,size(lnd2atm) - if (trim(fldname) == lnd2atm(n)%fldname) then - if (size(data) /= size(lnd2atm(n)%dataptr)) then - ! call abort - TODO: what is the abort call in lilac - else - data(:) = lnd2atm(n)%dataptr(:) - end if - end if - end do - end subroutine lilac_atmcap_lnd2atm - -!======================================================================== - subroutine lilac_atmcap_add_fld(flds, fldname, units, lsize, required_fr_atm) - - ! ---------------------------------------------- - ! Add an entry to to the flds array - ! Use pointers to create an extensible allocatable array. - ! to allow the size of flds to grow, the process for - ! adding a new field is: - ! 1) allocate newflds to be N (one element larger than flds) - ! 2) copy flds into first N-1 elements of newflds - ! 3) newest flds entry is Nth element of newflds - ! 4) deallocate / nullify flds - ! 5) point flds => newflds - ! ---------------------------------------------- - - type(atmcap_type), pointer :: flds(:) - character(len=*) , intent(in) :: fldname - character(len=*) , intent(in) :: units - integer , intent(in) :: lsize - logical, optional, intent(in) :: required_fr_atm - - ! local variables - integer :: n,oldsize,newsize - type(atmcap_type), pointer :: newflds(:) - character(len=*), parameter :: subname='(lilac_atmcap_atm2lnd_fld)' - ! ---------------------------------------------- - - if (associated(flds)) then - oldsize = size(flds) - else - oldsize = 0 - end if - newsize = oldsize + 1 - - if (oldsize > 0) then - ! 1) allocate newfld to be size (one element larger than input flds) - allocate(newflds(newsize)) - - ! 2) copy flds into first N-1 elements of newflds - do n = 1,oldsize - newflds(n)%fldname = flds(n)%fldname - newflds(n)%units = flds(n)%units - newflds(n)%required_fr_atm = flds(n)%required_fr_atm - end do - - ! 3) deallocate / nullify flds - if (oldsize > 0) then - deallocate(flds) - nullify(flds) - end if - - ! 4) point flds => new_flds - flds => newflds - - ! 5) update flds information for new entry - flds(newsize)%fldname = trim(fldname) - flds(newsize)%units = trim(units) - if (present(required_fr_atm)) then - flds(newsize)%required_fr_atm = required_fr_atm - end if - - else - allocate(flds(newsize)) - flds(newsize)%fldname = trim(fldname) - flds(newsize)%units = trim(units) - if (present(required_fr_atm)) then - flds(newsize)%required_fr_atm = required_fr_atm - end if - end if - - end subroutine lilac_atmcap_add_fld + end subroutine lilac_atmcap_init_vars !======================================================================== - subroutine lilac_atmos_register (comp, rc) + subroutine lilac_atmcap_register (comp, rc) + ! input/output variables type(ESMF_GridComp) :: comp ! must not be optional integer, intent(out) :: rc @@ -299,20 +184,20 @@ subroutine lilac_atmos_register (comp, rc) rc = ESMF_SUCCESS ! Set the entry points for standard ESMF Component methods - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=lilac_atmos_init, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_INITIALIZE, userRoutine=lilac_atmcap_init, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=lilac_atmos_run, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_RUN, userRoutine=lilac_atmcap_run, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=lilac_atmos_final, rc=rc) + call ESMF_GridCompSetEntryPoint(comp, ESMF_METHOD_FINALIZE, userRoutine=lilac_atmcap_final, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end subroutine lilac_atmos_register + end subroutine lilac_atmcap_register !======================================================================== - subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) + subroutine lilac_atmcap_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! input/output variables type (ESMF_GridComp) :: comp @@ -321,12 +206,15 @@ subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) integer, intent(out) :: rc ! local variables + integer :: fileunit type(ESMF_Mesh) :: atm_mesh type(ESMF_DistGrid) :: atm_distgrid type(ESMF_Field) :: field type(ESMF_FieldBundle) :: c2a_fb , a2c_fb - integer :: n, i - character(len=*), parameter :: subname='(lilac_atmos_init): ' + integer :: n, i, ierr + character(len=cl) :: atm_mesh_filename + character(len=*), parameter :: subname='(lilac_atmcap_init): ' + namelist /lilac_atmcap_input/ atm_mesh_filename !------------------------------------------------------------------------- ! Initialize return code @@ -338,18 +226,30 @@ subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! Read in the atm mesh !------------------------------------------------------------------------- - ! Note that in the call to lilac_atm the host atmospere sent both the gindex_atm and + ! read in mesh file name from namelist + open(newunit=fileunit, status="old", file="lilac_in") + read(fileunit, lilac_atmcap_input, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort(trim(subname) // 'error reading in lilac_atm_input') + end if + close(fileunit) + + ! Note that in the call to lilac_atm the host atmospere sent both the gindex_atm and ! the atm_mesh_filename that were then set as module variables here atm_distgrid = ESMF_DistGridCreate (arbSeqIndexList=gindex_atm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! TODO: the addUserArea failed for the 4x5 grid - need to have a more robust approach - unless the area will simply be ignored for now? - ! atm_mesh = ESMF_MeshCreate(filename=trim(atm_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, & + ! TODO: the addUserArea failed for the 4x5 grid - need to have a + ! more robust approach - unless the area will simply be ignored for now? + ! atm_mesh = ESMF_MeshCreate(filename=trim(atm_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, & ! elementDistGrid=atm_distgrid, addUserArea=.true., rc=rc) atm_mesh = ESMF_MeshCreate(filename=trim(atm_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, & elementDistGrid=atm_distgrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) then + call shr_sys_abort(trim(subname) // 'Error: failure in creating lilac atmcap from meshfile '//& + trim(atm_mesh_filename)) + end if call ESMF_LogWrite(trim(subname)//"Mesh for atmosphere is created for "//trim(atm_mesh_filename), ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -419,10 +319,10 @@ subroutine lilac_atmos_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) ! Set Attributes needed by land call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) ! TODO: mv what in the world is this??? - end subroutine lilac_atmos_init + end subroutine lilac_atmcap_init !======================================================================== - subroutine lilac_atmos_run(comp, importState, exportState, clock, rc) + subroutine lilac_atmcap_run(comp, importState, exportState, clock, rc) ! input/output variables type(ESMF_GridComp) :: comp @@ -430,18 +330,14 @@ subroutine lilac_atmos_run(comp, importState, exportState, clock, rc) type(ESMF_Clock) :: clock integer, intent(out) :: rc - ! local variables - character(len=*), parameter :: subname='(lilac_atmos_run):' - ! Initialize return code + ! This routine does nothing - its all in the atm->lnd coupler rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//"Should atmos_run ", ESMF_LOGMSG_INFO) - - end subroutine lilac_atmos_run + end subroutine lilac_atmcap_run !======================================================================== - subroutine lilac_atmos_final(comp, importState, exportState, clock, rc) + subroutine lilac_atmcap_final(comp, importState, exportState, clock, rc) ! input/output variables type(ESMF_GridComp) :: comp @@ -466,8 +362,142 @@ subroutine lilac_atmos_final(comp, importState, exportState, clock, rc) call ESMF_FieldBundleDestroy(import_fieldbundle, rc=rc) call ESMF_FieldBundleDestroy(export_fieldbundle, rc=rc) - call ESMF_LogWrite(subname//"?? Are there any other thing for destroying in atmos_final??", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"Finished lilac_atmcap_final", ESMF_LOGMSG_INFO) + + end subroutine lilac_atmcap_final + +!======================================================================== + subroutine lilac_atmcap_atm2lnd(fldname, data) + + ! input/output variables + character(len=*), intent(in) :: fldname + real(r8), intent(in) :: data(:) + + ! local variables + integer :: n + logical :: found + ! -------------------------------------------- + + found = .false. + do n = 1,size(atm2lnd) + if (trim(fldname) == atm2lnd(n)%fldname) then + found = .true. + if (size(data) /= size(atm2lnd(n)%dataptr)) then + ! call abort - TODO: what is the abort call in lilac + else + atm2lnd(n)%dataptr(:) = data(:) + end if + atm2lnd(n)%provided_by_atm = .true. + exit + end if + end do + if (.not. found) then + ! abort + end if + + contains + + subroutine lilac_atm2lnd_check() + integer :: n ! if there are fields that the atmosphere does not provide but + ! that are required - then abort + do n = 1,size(atm2lnd) + if (atm2lnd(n)%required_fr_atm .and. (.not. atm2lnd(n)%provided_by_atm)) then + ! call abort or provide default values? + else if (.not. atm2lnd(n)%provided_by_atm) then + ! create default values + end if + end do + end subroutine lilac_atm2lnd_check + + end subroutine lilac_atmcap_atm2lnd + +!======================================================================== + subroutine lilac_atmcap_lnd2atm(fldname, data) + character(len=*) , intent(in) :: fldname + real(r8) , intent(out) :: data(:) + integer :: n + + do n = 1,size(lnd2atm) + if (trim(fldname) == lnd2atm(n)%fldname) then + if (size(data) /= size(lnd2atm(n)%dataptr)) then + ! call abort - TODO: what is the abort call in lilac + else + data(:) = lnd2atm(n)%dataptr(:) + end if + end if + end do + end subroutine lilac_atmcap_lnd2atm + +!======================================================================== + subroutine lilac_atmcap_add_fld(flds, fldname, units, lsize, required_fr_atm) + + ! ---------------------------------------------- + ! Add an entry to to the flds array + ! Use pointers to create an extensible allocatable array. + ! to allow the size of flds to grow, the process for + ! adding a new field is: + ! 1) allocate newflds to be N (one element larger than flds) + ! 2) copy flds into first N-1 elements of newflds + ! 3) newest flds entry is Nth element of newflds + ! 4) deallocate / nullify flds + ! 5) point flds => newflds + ! ---------------------------------------------- + + type(atmcap_type), pointer :: flds(:) + character(len=*) , intent(in) :: fldname + character(len=*) , intent(in) :: units + integer , intent(in) :: lsize + logical, optional, intent(in) :: required_fr_atm + + ! local variables + integer :: n,oldsize,newsize + type(atmcap_type), pointer :: newflds(:) + character(len=*), parameter :: subname='(lilac_atmcap_atm2lnd_fld)' + ! ---------------------------------------------- + + if (associated(flds)) then + oldsize = size(flds) + else + oldsize = 0 + end if + newsize = oldsize + 1 + + if (oldsize > 0) then + ! 1) allocate newfld to be size (one element larger than input flds) + allocate(newflds(newsize)) + + ! 2) copy flds into first N-1 elements of newflds + do n = 1,oldsize + newflds(n)%fldname = flds(n)%fldname + newflds(n)%units = flds(n)%units + newflds(n)%required_fr_atm = flds(n)%required_fr_atm + end do + + ! 3) deallocate / nullify flds + if (oldsize > 0) then + deallocate(flds) + nullify(flds) + end if + + ! 4) point flds => new_flds + flds => newflds + + ! 5) update flds information for new entry + flds(newsize)%fldname = trim(fldname) + flds(newsize)%units = trim(units) + if (present(required_fr_atm)) then + flds(newsize)%required_fr_atm = required_fr_atm + end if + + else + allocate(flds(newsize)) + flds(newsize)%fldname = trim(fldname) + flds(newsize)%units = trim(units) + if (present(required_fr_atm)) then + flds(newsize)%required_fr_atm = required_fr_atm + end if + end if - end subroutine lilac_atmos_final + end subroutine lilac_atmcap_add_fld end module lilac_atmcap diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 52ddcd0a88..0d0ce9cc21 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -1,10 +1,9 @@ module lilac_mod !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! This is the driver for running CTSM and the ESMF lilac atm cap that - ! is put in place to ensure that the host atmosphere does not need to - ! know about ESMF + ! This is the driver for running CTSM, the ESMF lilac atm cap, and + ! optionally the MOSART river model that is put in place to ensure + ! that the host atmosphere does not need to know about ESMF !----------------------------------------------------------------------- ! External libraries @@ -17,26 +16,27 @@ module lilac_mod ! lilac routines use lilac_io , only : lilac_io_init - use lilac_atmcap , only : lilac_atmcap_init - use lilac_atmcap , only : gindex_atm, atm_mesh_filename - use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register - use lilac_cpl , only : cpl_lnd2rof_register, cpl_rof2lnd_register - use lilac_atmcap , only : lilac_atmos_register - use lilac_atmaero , only : lilac_atmaero_init - use lilac_atmaero , only : lilac_atmaero_interp + use lilac_atmaero , only : lilac_atmaero_init, lilac_atmaero_interp + use lilac_atmcap , only : lilac_atmcap_init_vars use lilac_history , only : lilac_history_write use lilac_methods , only : chkerr - ! ctsm routines + ! lilac register phaes + use lilac_atmcap , only : lilac_atmcap_register + use lilac_cpl , only : cpl_atm2lnd_register, cpl_lnd2atm_register + use lilac_cpl , only : cpl_lnd2rof_register, cpl_rof2lnd_register + + ! ctsm register use lnd_comp_esmf , only : lnd_register ! ctsm routine - ! mosart routines + ! mosart register use rof_comp_esmf , only : rof_register ! mosart routine implicit none public :: lilac_init public :: lilac_run + public :: lilac_final ! Gridded components and states in gridded components type(ESMF_GridComp) :: atm_gcomp @@ -73,8 +73,8 @@ module lilac_mod contains !======================================================================== - subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lats, & - atm_calendar, atm_timestep, & + subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & + atm_global_nx, atm_global_ny, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) @@ -84,10 +84,11 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat ! input/output variables integer , intent(inout) :: mpicom ! input commiunicator from atm - character(len=*) , intent(in) :: atm_mesh_file integer , intent(in) :: atm_global_index(:) real , intent(in) :: atm_lons(:) real , intent(in) :: atm_lats(:) + integer , intent(in) :: atm_global_nx + integer , intent(in) :: atm_global_ny character(len=*) , intent(in) :: atm_calendar integer , intent(in) :: atm_timestep integer , intent(in) :: atm_start_year !(yyyy) @@ -132,7 +133,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat !------------------------------------------------------------------------- ! Initialize pio with first initialization - ! AFTER call to MPI_init (which is in the host atm driver) and + ! AFTER call to MPI_init (which is in the host atm driver) and ! BEFORE call to ESMF_Initialize !------------------------------------------------------------------------- call shr_pio_init1(ncomps=1, nlfilename="lilac_in", Global_Comm=mpicom) @@ -141,8 +142,11 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat ! Initialize ESMF, set the default calendar and log type. !------------------------------------------------------------------------- - ! TODO: cannot assume that the calendar is always gregorian unless CTSM assumes this as well - ! Need to coordinate the calendar info between lilac and the host component + ! NOTE: the default calendar is set to GREGORIAN and is reset below in the initialization of + ! the lilac clock + ! TODO: ensure that CTSM queries the lilac_clock for the calendar and initializes its own + ! internal clock accordingly + ! TODO: the same is true for the datm time manager that reads in prescribed data call ESMF_Initialize(mpiCommunicator=mpicom, defaultCalKind=ESMF_CALKIND_GREGORIAN, & logappendflag=.false., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -171,24 +175,13 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat call ESMF_LogWrite(subname//"initialized shr_pio_init2 ...", ESMF_LOGMSG_INFO) !------------------------------------------------------------------------- - ! Initial lilac_atmcap module variables + ! Initial lilac atmosphere cap module variables !------------------------------------------------------------------------- - - ! Initialize gindex_atm - lsize = size(atm_global_index) - allocate(gindex_atm(lsize)) - gindex_atm(:) = atm_global_index(:) - - ! Initialize atm_mesh_filename - atm_mesh_filename = atm_mesh_file - - ! Initialize datatypes atm2lnd and lnd2atm - ! This must be done BEFORE the atmcap initialization - since the dataptr attributes - ! are needed to initialize the atmcap field bundles - call lilac_atmcap_init() + ! This must be done BEFORE the atmcap initialization + call lilac_atmcap_init_vars(atm_global_index, atm_lons, atm_lats, atm_global_nx, atm_global_ny) !------------------------------------------------------------------------- - ! Create Gridded Component -- lilac atmos_cap + ! Create Gridded and Coupler Components !------------------------------------------------------------------------- cname = " LILAC atm cap " atm_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) @@ -198,9 +191,6 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // "lilac atm cap gridded component created" end if - !------------------------------------------------------------------------- - ! Create Gridded Component -- CTSM land - !------------------------------------------------------------------------- cname = " CTSM " lnd_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac ctsm initialization') @@ -209,9 +199,6 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " ctsm gridded component created" end if - !------------------------------------------------------------------------- - ! Create Gridded Component -- MOSART river - !------------------------------------------------------------------------- cname = " MOSART " rof_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac mosart initialization') @@ -220,9 +207,6 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " mosart gridded component created" end if - !------------------------------------------------------------------------- - ! Create Coupling Component! --- Coupler from atmos to land - !------------------------------------------------------------------------- cname = "Coupler from atmosphere to land" cpl_atm2lnd_comp = ESMF_CplCompCreate(name=cname, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_a2l initialization') @@ -231,9 +215,6 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " coupler component (atmosphere to land) created" end if - !------------------------------------------------------------------------- - ! Create Coupling Component! -- Coupler from land to atmos - !------------------------------------------------------------------------- cname = "Coupler from land to atmosphere" cpl_lnd2atm_comp = ESMF_CplCompCreate(name=cname, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_l2a initialization') @@ -242,9 +223,6 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " coupler component (land to atmosphere) created" end if - !------------------------------------------------------------------------- - ! Create Coupling Component! --- Coupler from rof to land - !------------------------------------------------------------------------- cname = "Coupler from river to land" cpl_rof2lnd_comp = ESMF_CplCompCreate(name=cname, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_r2l initialization') @@ -253,9 +231,6 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " coupler component (atmosphere to land) created" end if - !------------------------------------------------------------------------- - ! Create Coupling Component! -- Coupler from land to atmos - !------------------------------------------------------------------------- cname = "Coupler from land to river" cpl_lnd2rof_comp = ESMF_CplCompCreate(name=cname, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_l2r initialization') @@ -265,18 +240,18 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat end if !------------------------------------------------------------------------- - ! Register section -- set services -- atmcap + ! Register gridded and coupler components !------------------------------------------------------------------------- - call ESMF_GridCompSetServices(atm_gcomp, userRoutine=lilac_atmos_register, rc=rc) + + ! Register section -- set services -- atmcap + call ESMF_GridCompSetServices(atm_gcomp, userRoutine=lilac_atmcap_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('atm_gcomp register failure') call ESMF_LogWrite(subname//" atmos SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then print *, trim(subname) // " lilac atm cap setservices finished" end if - !------------------------------------------------------------------------- ! Register section -- set services -- ctsm - !------------------------------------------------------------------------- call ESMF_GridCompSetServices(lnd_gcomp, userRoutine=lnd_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('lnd_gcomp register failure') call ESMF_LogWrite(subname//"CSTM SetServices finished!", ESMF_LOGMSG_INFO) @@ -284,9 +259,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " CTSM setservices finished" end if - !------------------------------------------------------------------------- ! Register section -- set services -- mosart - !------------------------------------------------------------------------- call ESMF_GridCompSetServices(rof_gcomp, userRoutine=rof_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') call ESMF_LogWrite(subname//"MOSART SetServices finished!", ESMF_LOGMSG_INFO) @@ -294,9 +267,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " CTSM setservices finished" end if - !------------------------------------------------------------------------- ! Register section -- set services -- coupler atmosphere to land - !------------------------------------------------------------------------- call ESMF_CplCompSetServices(cpl_atm2lnd_comp, userRoutine=cpl_atm2lnd_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_atm2lnd_comp register failure') call ESMF_LogWrite(subname//"Coupler from atmosphere to land SetServices finished!", ESMF_LOGMSG_INFO) @@ -304,9 +275,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " coupler from atmosphere to land setservices finished" end if - !------------------------------------------------------------------------- ! Register section -- set services -- river to land - !------------------------------------------------------------------------- call ESMF_CplCompSetServices(cpl_rof2lnd_comp, userRoutine=cpl_rof2lnd_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') call ESMF_LogWrite(subname//"Coupler from river to land SetServices finished!", ESMF_LOGMSG_INFO) @@ -314,9 +283,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " coupler from river to land setservices finished" end if - !------------------------------------------------------------------------- ! Register section -- set services -- coupler land to atmosphere - !------------------------------------------------------------------------- call ESMF_CplCompSetServices(cpl_lnd2atm_comp, userRoutine=cpl_lnd2atm_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2atm_comp register failure') call ESMF_LogWrite(subname//"Coupler from land to atmosphere SetServices finished!", ESMF_LOGMSG_INFO) @@ -324,9 +291,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat print *, trim(subname) // " coupler from land to atmosphere setservices finished" end if - !------------------------------------------------------------------------- ! Register section -- set services -- coupler land to river - !------------------------------------------------------------------------- call ESMF_CplCompSetServices(cpl_lnd2rof_comp, userRoutine=cpl_lnd2rof_register, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') call ESMF_LogWrite(subname//"Coupler from land to river SetServices finished!", ESMF_LOGMSG_INFO) @@ -341,7 +306,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat if (trim(atm_calendar) == 'NOLEAP') then lilac_calendar = ESMF_CalendarCreate(name='NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) else if (trim(atm_calendar) == 'GREGORIAN') then - lilac_calendar = ESMF_CalendarCreate(name='NOLEAP', calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc ) + lilac_calendar = ESMF_CalendarCreate(name='GREGORIAN', calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc ) else ! TODO: add supported calendars here end if @@ -379,11 +344,12 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing stop alarm') ! ------------------------------------------------------------------------- - ! Initialze lilac_atm gridded component + ! Initialize LILAC gridded components ! First Create the empty import and export states used to pass data ! between components. (these are module variables) ! ------------------------------------------------------------------------- + ! Initialze lilac_atm gridded component atm2cpl_state = ESMF_StateCreate(name='state_from_atm', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return cpl2atm_state = ESMF_StateCreate(name='state_to_atm', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) @@ -394,12 +360,7 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing atmcap") call ESMF_LogWrite(subname//"lilac_atm gridded component initialized", ESMF_LOGMSG_INFO) - ! ------------------------------------------------------------------------- ! Initialze CTSM Gridded Component - ! First Create the empty import and export states used to pass data - ! between components. (these are module variables) - ! ------------------------------------------------------------------------- - cpl2lnd_state = ESMF_StateCreate(name='state_to_land', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return lnd2cpl_state = ESMF_StateCreate(name='state_fr_land', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) @@ -410,13 +371,8 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing ctsm") call ESMF_LogWrite(subname//"CTSM gridded component initialized", ESMF_LOGMSG_INFO) - ! ------------------------------------------------------------------------- - ! Initialize MOSART Gridded Component - ! First Create the empty import and export states used to pass data - ! between components. (these are module variables) - ! ------------------------------------------------------------------------- - if (couple_to_river) then + ! Initialize MOSART Gridded Component cpl2rof_state = ESMF_StateCreate(name='state_to_river', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return rof2cpl_state = ESMF_StateCreate(name='state_fr_river', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) @@ -429,12 +385,11 @@ subroutine lilac_init(mpicom, atm_mesh_file, atm_global_index, atm_lons, atm_lat end if ! ------------------------------------------------------------------------- - ! Initialze LILAC coupler components + ! Initialize LILAC coupler components ! ------------------------------------------------------------------------- - ! Note that the lnd2cpl_state and cpl2lnd_state are each made up of 2 field bundles, - ! one for the river and one for the atm - - + ! Note that the lnd2cpl_state and cpl2lnd_state are each made up of 2 field bundles, + ! one for the river and one for the atm - ! The following fills in the atm field bundle in cpl2lnd_state call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, & clock=lilac_clock, rc=rc) @@ -550,7 +505,7 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in cpl_lnd2atm") if (couple_to_river) then - ! Run cpl_lnd2rof + ! Run cpl_lnd2rof call ESMF_LogWrite(subname//"running cpl_lnd2rof_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) print *, "Running coupler component..... cpl_lnd2rof_comp" call ESMF_CplCompRun(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & @@ -613,9 +568,7 @@ subroutine lilac_final( ) print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" end if - !------------------------------------------------------------------------- ! Gridded Component Finalizing! --- atmosphere - !------------------------------------------------------------------------- call ESMF_GridCompFinalize(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) @@ -623,9 +576,7 @@ subroutine lilac_final( ) print *, "Finalizing atmos_cap gridded component , rc =", rc end if - !------------------------------------------------------------------------- ! Coupler component Finalizing --- coupler atmos to land - !------------------------------------------------------------------------- call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) @@ -633,9 +584,7 @@ subroutine lilac_final( ) print *, "Finalizing coupler component..... cpl_atm2lnd_comp , rc =", rc end if - !------------------------------------------------------------------------- ! Gridded Component Finalizing! --- land - !------------------------------------------------------------------------- call ESMF_GridCompFinalize(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) @@ -643,9 +592,7 @@ subroutine lilac_final( ) print *, "Finalizing lnd_cap gridded component , rc =", rc end if - !------------------------------------------------------------------------- ! Coupler component Finalizing --- coupler land to atmos - !------------------------------------------------------------------------- call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=cpl2lnd_state, exportState=cpl2atm_state, clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) From d3294b0884d580e9dac52b12360a7a729d2bfda0 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 6 Dec 2019 19:43:11 -0700 Subject: [PATCH 0486/1973] cleanup of history alarms --- lilac/atm_driver/lilac_in | 4 + lilac/src/lilac_atmaero.F90 | 16 --- lilac/src/lilac_atmcap.F90 | 3 +- lilac/src/lilac_history.F90 | 154 +++++++++++++++++----------- lilac/src/lilac_mod.F90 | 17 ++- src/cpl/lilac/lnd_comp_esmf.F90 | 71 ++++++------- src/cpl/lilac/lnd_import_export.F90 | 18 +--- 7 files changed, 147 insertions(+), 136 deletions(-) diff --git a/lilac/atm_driver/lilac_in b/lilac/atm_driver/lilac_in index 51b288ba84..852cd48637 100644 --- a/lilac/atm_driver/lilac_in +++ b/lilac/atm_driver/lilac_in @@ -2,6 +2,10 @@ starttype = 'startup' caseid = 'test_lilac' / +&lilac_io_input + lilac_histfreq_n = 4 + lilac_histfreq_option = 'nsteps' +/ &lilac_atmcap_input atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' / diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 index cc9b6a175a..a09d2955a0 100644 --- a/lilac/src/lilac_atmaero.F90 +++ b/lilac/src/lilac_atmaero.F90 @@ -164,28 +164,18 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) ! obtain mesh lats, lons and areas ! ------------------------------ - write(6,*)'DEBUG: here1' - call ESMF_StateGet(atm2lnd_a_state, 'a2c_fb', lfieldbundle, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - write(6,*)'DEBUG: here1a' - call lilac_methods_FB_getFieldN(lfieldbundle, fieldnum=1, field=lfield, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - write(6,*)'DEBUG: here1b' - call ESMF_FieldGet(lfield, mesh=lmesh, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - write(6,*)'DEBUG: here1c' - call ESMF_MeshGet(lmesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - write(6,*)'DEBUG: here2' - if (numOwnedElements /= lsize) then call shr_sys_abort('ERROR: numOwnedElements is not equal to lsize') end if @@ -194,8 +184,6 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) call ESMF_MeshGet(lmesh, ownedElemCoords=ownedElemCoords, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - write(6,*)'DEBUG: here3' - allocate(mesh_lons(numOwnedElements)) allocate(mesh_lats(numOwnedElements)) allocate(mesh_areas(numOwnedElements)) @@ -219,8 +207,6 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) call mct_gGrid_importRattr(ggrid_atm,"mask", rdata, lsize) deallocate(mesh_lons, mesh_lats, mesh_areas, rdata) - write(6,*)'DEBUG: here4' - ! ------------------------------ ! create the stream data sdat ! ------------------------------ @@ -254,8 +240,6 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) calendar = get_calendar(), & taxmode = taxmode ) - write(6,*)'DEBUG: here5' - if (mytask == 0) then call shr_strdata_print(sdat,'ATMAERO data') endif diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 9cc7eba862..635f3b29dd 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -214,6 +214,7 @@ subroutine lilac_atmcap_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) integer :: n, i, ierr character(len=cl) :: atm_mesh_filename character(len=*), parameter :: subname='(lilac_atmcap_init): ' + namelist /lilac_atmcap_input/ atm_mesh_filename !------------------------------------------------------------------------- @@ -230,7 +231,7 @@ subroutine lilac_atmcap_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) open(newunit=fileunit, status="old", file="lilac_in") read(fileunit, lilac_atmcap_input, iostat=ierr) if (ierr > 0) then - call shr_sys_abort(trim(subname) // 'error reading in lilac_atm_input') + call shr_sys_abort(trim(subname) // 'error reading in lilac_atmcap_input') end if close(fileunit) diff --git a/lilac/src/lilac_history.F90 b/lilac/src/lilac_history.F90 index e754bc9151..5643737a26 100644 --- a/lilac/src/lilac_history.F90 +++ b/lilac/src/lilac_history.F90 @@ -6,28 +6,28 @@ module lilac_history use ESMF use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl, r8=>shr_kind_r8 - use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag - use lilac_constants , only : SecPerDay => lilac_constants_SecPerDay - use lilac_methods , only : FB_reset => lilac_methods_FB_reset - use lilac_methods , only : FB_diagnose => lilac_methods_FB_diagnose - use lilac_methods , only : FB_GetFldPtr => lilac_methods_FB_GetFldPtr - use lilac_methods , only : FB_accum => lilac_methods_FB_accum + use shr_sys_mod , only : shr_sys_abort + use lilac_atmcap , only : atm_nx => atm_global_nx + use lilac_atmcap , only : atm_ny => atm_global_ny + use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag + use lilac_constants , only : SecPerDay => lilac_constants_SecPerDay + use lilac_time , only : alarmInit => lilac_time_alarmInit + use lilac_methods , only : FB_reset => lilac_methods_FB_reset + use lilac_methods , only : FB_diagnose => lilac_methods_FB_diagnose + use lilac_methods , only : FB_GetFldPtr => lilac_methods_FB_GetFldPtr + use lilac_methods , only : FB_accum => lilac_methods_FB_accum use lilac_methods , only : chkerr - use lilac_time , only : alarmInit => lilac_time_alarmInit use lilac_io , only : lilac_io_write, lilac_io_wopen, lilac_io_enddef use lilac_io , only : lilac_io_close, lilac_io_date2yyyymmdd, lilac_io_sec2hms use lilac_io , only : lilac_io_ymd2date - ! For global domains - ! TODO: need to generalize obtaining global domains via state attributes - use domainMod , only : ldomain - implicit none private - public :: lilac_history_alarm_init + public :: lilac_history_init public :: lilac_history_write + character(CL) :: histfile_prefix type(ESMF_Alarm) :: AlarmHist type(ESMF_Alarm) :: AlarmHistAvg character(*), parameter :: u_FILE_u = & @@ -37,14 +37,14 @@ module lilac_history contains !=============================================================================== - subroutine lilac_history_alarm_init(clock, hist_freq_n, hist_freq_option, rc) + subroutine lilac_history_init(clock, rc) + ! ------------------------------------------ ! Initialize lilac history file alarm + ! ------------------------------------------ ! input/output variables type(ESMF_Clock) :: clock ! lilac clock - integer , intent(in) :: hist_freq_n - character(len=*) , intent(in) :: hist_freq_option integer , intent(out) :: rc ! local variables @@ -54,12 +54,20 @@ subroutine lilac_history_alarm_init(clock, hist_freq_n, hist_freq_option, rc) type(ESMF_Time) :: nexttime type(ESMF_Calendar) :: calendar ! calendar type character(len=64) :: currtimestr - character(CS) :: histavg_option ! Histavg option units integer :: yr,mon,day,sec ! time units character(CL) :: freq_option ! freq_option setting (ndays, nsteps, etc) integer :: freq_n ! freq_n setting relative to freq_option integer :: iam - character(len=*), parameter :: subname='(lilac_history_alarm_init)' + integer :: fileunit + integer :: ierr + character(CL) :: caseid + character(CS) :: starttype + character(CS) :: lilac_histfreq_option + integer :: lilac_histfreq_n + character(len=*), parameter :: subname='(lilac_history_init)' + + namelist /lilac_run_input/ caseid, starttype + namelist /lilac_io_input/ lilac_histfreq_n, lilac_histfreq_option !--------------------------------------- if (dbug_flag > 5) then @@ -67,6 +75,23 @@ subroutine lilac_history_alarm_init(clock, hist_freq_n, hist_freq_option, rc) endif rc = ESMF_SUCCESS + ! read in caseid + open(newunit=fileunit, status="old", file="lilac_in") + read(fileunit, lilac_run_input, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort(trim(subname) // 'error reading in lilac_run_input') + end if + close(fileunit) + write(histfile_prefix,"(2a)") trim(caseid),'.lilac.hi.' + + ! read in history file output frequencies + open(newunit=fileunit, status="old", file="lilac_in") + read(fileunit, lilac_io_input, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort(trim(subname) // 'error reading in lilac_io_input') + end if + close(fileunit) + !--------------------------------------- ! Get the clock info !--------------------------------------- @@ -85,10 +110,11 @@ subroutine lilac_history_alarm_init(clock, hist_freq_n, hist_freq_option, rc) ! Initialize thie history alarm !--------------------------------------- - call alarmInit(clock, AlarmHist, option=freq_option, opt_n=freq_n, RefTime=RefTime, alarmname='history', rc=rc) + call alarmInit(clock, AlarmHist, option=lilac_histfreq_option, opt_n=lilac_histfreq_n, & + RefTime=RefTime, alarmname='lilac_history_alarm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end subroutine lilac_history_alarm_init + end subroutine lilac_history_init !=============================================================================== @@ -121,29 +147,24 @@ subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & type(ESMF_TimeInterval) :: timediff ! Used to calculate curr_time type(ESMF_Calendar) :: calendar ! calendar type character(len=CS) :: currtimestr - integer :: nx_atm, ny_atm - integer :: nx_lnd, ny_lnd - integer :: nx_rof, ny_rof character(len=CS) :: nexttimestr - character(CS) :: histavg_option ! Histavg option units - integer :: i,j,m,n,n1,ncnt + integer :: i,j,m,n integer :: start_ymd ! Starting date YYYYMMDD integer :: start_tod ! Starting time-of-day (s) integer :: nx,ny ! global grid size integer :: yr,mon,day,sec ! time units real(r8) :: rval ! real tmp value real(r8) :: dayssince ! Time interval since reference time - integer :: fk ! index character(CL) :: time_units ! units of time variable - character(CL) :: case_name ! case name character(CL) :: hist_file ! Local path to history filename - character(CS) :: cpl_inst_tag ! instance tag character(CL) :: freq_option ! freq_option setting (ndays, nsteps, etc) integer :: freq_n ! freq_n setting relative to freq_option logical :: alarmIsOn ! generic alarm flag real(r8) :: tbnds(2) ! CF1.0 time bounds logical :: whead,wdata ! for writing restart/history cdf files - integer :: dbrc + character(CL) :: cvalue + integer :: lnd_nx, lnd_ny + integer :: rof_nx, rof_ny integer :: iam logical,save :: first_call = .true. character(len=*), parameter :: subname='(lilac_history_write)' @@ -201,17 +222,17 @@ subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & ! --- History Alarms !--------------------------------------- - ! if (ESMF_AlarmIsRinging(AlarmHist, rc=rc)) then - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! alarmIsOn = .true. - ! call ESMF_AlarmRingerOff( AlarmHist, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! else - ! alarmisOn = .false. - ! endif - ! hard-wire for now + if (ESMF_AlarmIsRinging(AlarmHist, rc=rc)) then + if (ChkErr(rc,__LINE__,u_FILE_u)) return + alarmIsOn = .true. + call ESMF_AlarmRingerOff( AlarmHist, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + alarmIsOn = .false. + endif + + ! TODO: remove this hard-wiring alarmisOn = .true. - case_name = 'test_lilac' !--------------------------------------- ! --- History File @@ -220,7 +241,7 @@ subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & !--------------------------------------- if (alarmIsOn) then - write(hist_file,"(6a)") trim(case_name), '.lilac.hi.',trim(nexttimestr),'.nc' + write(hist_file,"(3a)") trim(histfile_prefix),trim(nexttimestr),'.nc' call ESMF_LogWrite(trim(subname)//": write "//trim(hist_file), ESMF_LOGMSG_INFO, rc=rc) call lilac_io_wopen(hist_file, vm, iam, clobber=.true.) @@ -250,64 +271,73 @@ subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & if (ChkErr(rc,__LINE__,u_FILE_u)) return endif - nx_atm = ldomain%ni - ny_atm = ldomain%nj - nx_lnd = ldomain%ni - ny_lnd = ldomain%nj - nx_rof = 720 !TODO: remove this hard-wiring - ny_rof = 360 !TODO: remove this hard-wiring + ! obtain global sizes for lnd_nx and lnd_ny + call ESMF_AttributeGet(lnd2cpl_state, name="lnd_nx", value=cvalue, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + read(cvalue,*) lnd_nx + call ESMF_LogWrite(subname//"got attribute lnd_nx "//trim(cvalue), ESMF_LOGMSG_INFO) + call ESMF_AttributeGet(lnd2cpl_state, name="lnd_ny", value=cvalue, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + read(cvalue,*) lnd_ny + call ESMF_LogWrite(subname//"got attribute lnd_nx "//trim(cvalue), ESMF_LOGMSG_INFO) call ESMF_StateGet(atm2cpl_state, 'a2c_fb', a2c_fb) ! from atm if (ChkErr(rc,__LINE__,u_FILE_u)) return call lilac_io_write(hist_file, iam, a2c_fb, & - nx=nx_atm, ny=ny_atm, nt=1, whead=whead, wdata=wdata, pre='atm_to_cpl', rc=rc) + nx=atm_nx, ny=atm_ny, nt=1, whead=whead, wdata=wdata, pre='atm_to_cpl', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_StateGet(cpl2atm_state, 'c2a_fb', c2a_fb) ! to atm if (ChkErr(rc,__LINE__,u_FILE_u)) return call lilac_io_write(hist_file, iam, c2a_fb, & - nx=nx_atm, ny=ny_atm, nt=1, whead=whead, wdata=wdata, pre='cpl_to_atm', rc=rc) + nx=atm_nx, ny=atm_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_atm', l2c_fb_atm) ! from lnd if (ChkErr(rc,__LINE__,u_FILE_u)) return call lilac_io_write(hist_file, iam, l2c_fb_atm, & - nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_atm', rc=rc) + nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_rof', l2c_fb_rof) ! from lnd if (ChkErr(rc,__LINE__,u_FILE_u)) return call lilac_io_write(hist_file, iam, l2c_fb_rof, & - nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_rof', rc=rc) + nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_rof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_atm', c2l_fb_atm) ! to lnd if (ChkErr(rc,__LINE__,u_FILE_u)) return call lilac_io_write(hist_file, iam, c2l_fb_atm, & - nx=nx_lnd, ny=ny_lnd, nt=1, whead=whead, wdata=wdata, pre='cpl_to_lnd_atm', rc=rc) + nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_lnd_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (present(rof2cpl_state)) then - call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_rof', c2l_fb_rof) ! to lnd + if (present(rof2cpl_state) .and. present(cpl2rof_state)) then + ! obtain global sizes for rof_nx and rof_ny + call ESMF_AttributeGet(rof2cpl_state, name="rof_nx", value=cvalue, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + read(cvalue,*) rof_nx + call ESMF_LogWrite(subname//"got attribute rof_nx "//trim(cvalue), ESMF_LOGMSG_INFO) + call ESMF_AttributeGet(rof2cpl_state, name="rof_ny", value=cvalue, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + read(cvalue,*) rof_ny + call ESMF_LogWrite(subname//"got attribute rof_nx "//trim(cvalue), ESMF_LOGMSG_INFO) + + call ESMF_StateGet(rof2cpl_state, 'r2c_fb', r2c_fb) ! from rof if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2l_fb_rof, & - nx=nx_lnd, ny=ny_lnd, nt=1, whead=.true., wdata=wdata, pre='cpl_to_lnd_rof', rc=rc) + call lilac_io_write(hist_file, iam, r2c_fb, & + nx=rof_nx, ny=rof_ny, nt=1, whead=whead, wdata=wdata, pre='rof_to_cpl', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (present(cpl2rof_state)) then call ESMF_StateGet(cpl2rof_state, 'c2r_fb', c2r_fb) ! to rof if (ChkErr(rc,__LINE__,u_FILE_u)) return call lilac_io_write(hist_file, iam, c2r_fb, & - nx=nx_rof, ny=ny_rof, nt=1, whead=whead, wdata=wdata, pre='cpl_to_rof', rc=rc) + nx=rof_nx, ny=rof_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_rof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (present(rof2cpl_state)) then - call ESMF_StateGet(rof2cpl_state, 'r2c_fb', r2c_fb) ! from rof + call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_rof', c2l_fb_rof) ! to rof if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, r2c_fb, & - nx=nx_rof, ny=ny_rof, nt=1, whead=whead, wdata=wdata, pre='rof_to_cpl', rc=rc) + call lilac_io_write(hist_file, iam, c2l_fb_rof, & + nx=lnd_nx, ny=lnd_ny, nt=1, whead=.true., wdata=wdata, pre='cpl_to_lnd_rof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 0d0ce9cc21..8fc5560904 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -18,6 +18,7 @@ module lilac_mod use lilac_io , only : lilac_io_init use lilac_atmaero , only : lilac_atmaero_init, lilac_atmaero_interp use lilac_atmcap , only : lilac_atmcap_init_vars + use lilac_history , only : lilac_history_init use lilac_history , only : lilac_history_write use lilac_methods , only : chkerr @@ -420,19 +421,27 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & print *, trim(subname) // "finished lilac initialization" end if + !------------------------------------------------------------------------- + ! Initialize atmaero stream data (using share strearm capability from CIME) + !------------------------------------------------------------------------- + + call lilac_atmaero_init(atm2cpl_state, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing lilac_atmaero_init") + !------------------------------------------------------------------------- ! Initialize lilac_io_mod module data !------------------------------------------------------------------------- call lilac_io_init() - call ESMF_LogWrite(subname//"initialized lilac_io ...", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"initialized lilac io ...", ESMF_LOGMSG_INFO) !------------------------------------------------------------------------- - ! Initialize atmaero stream data (using share strearm capability from CIME) + ! Initialize lilac history output !------------------------------------------------------------------------- - call lilac_atmaero_init(atm2cpl_state, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing lilac_atmaero_init") + call lilac_history_init(lilac_clock, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing lilac_history_init") + call ESMF_LogWrite(subname//"initialized lilac history output ...", ESMF_LOGMSG_INFO) end subroutine lilac_init diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 61fb8adc12..958b67d8d4 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -34,7 +34,7 @@ module lnd_comp_esmf use clm_time_manager , only : set_timemgr_init, advance_timestep use clm_time_manager , only : set_nextsw_cday, update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size - use clm_time_manager , only : get_curr_date, get_curr_calday, set_nextsw_cday + use clm_time_manager , only : get_curr_date, get_curr_calday use clm_initializeMod , only : initialize1, initialize2 use clm_driver , only : clm_drv use lnd_import_export , only : import_fields, export_fields @@ -117,14 +117,15 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) integer :: lbnum ! input to memory diagnostic integer :: shrlogunit ! old values for log unit and log level type(bounds_type) :: bounds ! bounds + character(len=CL) :: cvalue - ! generation of field bundles + ! generation of field bundles type(ESMF_State) :: importState, exportState type(ESMF_FieldBundle) :: c2l_fb_atm, c2l_fb_rof ! field bundles in import state type(ESMF_FieldBundle) :: l2c_fb_atm, l2c_fb_rof ! field bundles in export state type(ESMF_Field) :: lfield - ! mesh generation + ! mesh generation type(ESMF_Mesh) :: lnd_mesh character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file integer :: nlnd, nocn ! local size ofarrays @@ -134,7 +135,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) type(ESMF_DistGrid) :: distgrid integer :: fileunit - ! clock info + ! clock info character(len=CL) :: calendar ! calendar type name type(ESMF_CalKind_Flag) :: caltype ! calendar type from lilac clock integer :: curr_tod, curr_ymd ! current time info @@ -152,7 +153,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) type(ESMF_Time) :: refTime ! Ref time type(ESMF_TimeInterval) :: timeStep ! time step from lilac clock - ! orbital info + ! orbital info integer :: orb_iyear_align ! associated with model year integer :: orb_cyear ! orbital year for current orbital computation integer :: orb_iyear ! orbital year for current orbital computation @@ -222,15 +223,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !orb_cyear = orb_iyear + (year - orb_iyear_align) orb_cyear = 2000 - call shr_orb_params(orb_cyear, eccen, obliqr, mvelpp, & - obliqr, lambm0, mvelpp, masterproc) - - ! for now hard-coding: - !nextsw_cday = 1.02083333333333 - !eccen = 1.670366039276560E-002 - !mvelpp = 4.93745779048816 - !lambm0 = -3.247249566152933E-0020 - !obliqr = 0.409101122579779 + call shr_orb_params(orb_cyear, eccen, obliqr, mvelpp, obliqr, lambm0, mvelpp, masterproc) if (masterproc) then write(iulog,*) 'shr_obs_params is setting the following:' @@ -445,7 +438,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !-------------------------------- - ! Create export state + ! Create ctsm export state !-------------------------------- ! create an empty field bundle for atm export fields @@ -485,47 +478,47 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !-------------------------------- - ! Fill in land export state + ! Fill in ctsm export state !-------------------------------- - call ESMF_LogWrite(subname//"Creating land export state", ESMF_LOGMSG_INFO) + call export_fields(export_state, bounds, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - ! Fill in export state at end of initialization - call export_fields(comp, bounds, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(cvalue,*) ldomain%ni + call ESMF_AttributeSet(export_state, name="lnd_nx", value=trim(cvalue), rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"set attribute lnd_nx to "//trim(cvalue), ESMF_LOGMSG_INFO) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(cvalue,*) ldomain%nj + call ESMF_AttributeSet(export_state, name="lnd_ny", value=trim(cvalue), rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"set attribute lnd_ny to "//trim(cvalue), ESMF_LOGMSG_INFO) - call ESMF_LogWrite(subname//"Getting Calendar Day of nextsw calculation...", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"Created land export state", ESMF_LOGMSG_INFO) + !-------------------------------- ! Get calendar day of next sw (shortwave) calculation (nextsw_cday) + !-------------------------------- + if (nsrest == nsrStartup) then call ESMF_ClockGet( clock, currTime=currTime, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeGet( currTime, dayOfYear_r8=nextsw_cday, rc=rc ) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + ! TODO: get this from the import state nextsw_cday attribute end if ! Set nextsw_cday - call set_nextsw_cday( nextsw_cday ) + call set_nextsw_cday(nextsw_cday_in=nextsw_cday) + write(cvalue,*) nextsw_cday + call ESMF_LogWrite(subname//"Calendar Day of nextsw calculation is "//trim(cvalue), ESMF_LOGMSG_INFO) if (masterproc) then write(iulog,*) 'TimeGet ... nextsw_cday is : ', nextsw_cday end if - ! Set Attributes - call ESMF_LogWrite(subname//"setting attribute!", ESMF_LOGMSG_INFO) - - ! call ESMF_AttributeSet(export_state, name="lnd_nx", value=ldomain%ni, rc=rc) - ! if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - ! call ESMF_LogWrite(subname//"setting attribute lnd_nx", ESMF_LOGMSG_INFO) - - ! call ESMF_AttributeSet(export_state, name="lnd_ny", value=ldomain%nj, rc=rc) - ! if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - ! call ESMF_LogWrite(subname//"setting attribute lnd_ny!", ESMF_LOGMSG_INFO) - !-------------------------------- ! diagnostics !-------------------------------- @@ -667,7 +660,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) !-------------------------------- call t_startf ('lc_lnd_import') - call import_fields(gcomp, bounds, rc) + call import_fields(import_state, bounds, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call t_stopf ('lc_lnd_import') @@ -813,7 +806,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) !-------------------------------- call t_startf ('lc_lnd_export') - call export_fields(gcomp, bounds, rc) + call export_fields(export_state, bounds, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call t_stopf ('lc_lnd_export') diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index ac39ae1fc0..9768b6dc25 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -50,19 +50,18 @@ module lnd_import_export contains !=============================================================================== - subroutine import_fields( gcomp, bounds, rc) + subroutine import_fields( importState, bounds, rc) !--------------------------------------------------------------------------- ! Convert the input data from the lilac to the land model !--------------------------------------------------------------------------- ! input/output variabes - type(ESMF_GridComp) :: gcomp + type(ESMF_State) :: importState type(bounds_type) , intent(in) :: bounds ! bounds integer , intent(out) :: rc ! local variables - type(ESMF_State) :: importState integer :: num integer :: begg, endg ! bounds integer :: g,i,k ! indices @@ -106,10 +105,6 @@ subroutine import_fields( gcomp, bounds, rc) rc = ESMF_SUCCESS call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - ! Get import state - call ESMF_GridCompGet(gcomp, importState=importState, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Set bounds begg = bounds%begg; endg=bounds%endg @@ -341,19 +336,18 @@ end subroutine import_fields !============================================================================== - subroutine export_fields(gcomp, bounds, rc) + subroutine export_fields(exportState, bounds, rc) !------------------------------- ! Pack the export state !------------------------------- ! input/output variables - type(ESMF_GridComp) :: gcomp + type(ESMF_State) :: exportState type(bounds_type) , intent(in) :: bounds ! bounds integer , intent(out) :: rc ! local variables - type(ESMF_State) :: exportState integer :: i, g, num real(r8) :: array(bounds%begg:bounds%endg) character(len=*), parameter :: subname='(lnd_import_export:export_fields)' @@ -361,10 +355,6 @@ subroutine export_fields(gcomp, bounds, rc) rc = ESMF_SUCCESS - ! Get export state (ESMF) - call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc) ! do we need the clock now? - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ----------------------- ! output to atm ! ----------------------- From a5f20ecdf6ed3a81fe5e8bfdb030960988b152ce Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 7 Dec 2019 15:52:08 -0700 Subject: [PATCH 0487/1973] put in consistency check to verify that lats/lons read in from mesh are same as lats/lons obtained from host atm --- lilac/src/lilac_atmaero.F90 | 11 +-- lilac/src/lilac_atmcap.F90 | 112 ++++++++++++++++------ lilac/src/lilac_history.F90 | 2 +- lilac/src/lilac_io.F90 | 158 +++++++++++++++----------------- src/cpl/lilac/lnd_comp_esmf.F90 | 15 +-- 5 files changed, 169 insertions(+), 129 deletions(-) diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 index a09d2955a0..6472d0a01e 100644 --- a/lilac/src/lilac_atmaero.F90 +++ b/lilac/src/lilac_atmaero.F90 @@ -90,14 +90,12 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) integer , pointer :: idata(:) !----------------------------------------------------------------------- - rc = ESMF_SUCCESS - - namelist /atmaero_stream/ & - stream_year_first, & - stream_year_last, & - model_year_align, & + namelist /atmaero_stream/ & + stream_year_first, stream_year_last, model_year_align, & stream_fldfilename + rc = ESMF_SUCCESS + ! default values for namelist stream_year_first = 1 ! first year in stream to use stream_year_last = 1 ! last year in stream to use @@ -124,7 +122,6 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) end if close(nunit) endif - call shr_mpi_bcast(stream_year_first , mpicom) call shr_mpi_bcast(stream_year_last , mpicom) call shr_mpi_bcast(model_year_align , mpicom) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 635f3b29dd..1b915911aa 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -28,13 +28,16 @@ module lilac_atmcap private :: lilac_atmcap_add_fld - ! Input from host atmosphere + ! Time invariant input from host atmosphere integer, public, allocatable :: gindex_atm(:) ! global index space integer, public, allocatable :: atm_lons(:) ! local longitudes integer, public, allocatable :: atm_lats(:) ! local latitudes integer, public :: atm_global_nx integer, public :: atm_global_ny + ! Time variant input from host atmosphere + real(r8) :: nextsw_cday = 1.e36_r8 ! calendar day of the next sw calculation + type :: atmcap_type character(len=CL) :: fldname real(r8), pointer :: dataptr(:) @@ -168,7 +171,7 @@ subroutine lilac_atmcap_register (comp, rc) ! local variables type(ESMF_VM) :: vm - character(len=*), parameter :: subname='(lilac_atmos_register): ' + character(len=*), parameter :: subname='(lilac_atmcap_register): ' !------------------------------------------------------------------------- call ESMF_VMGetGlobal(vm=vm, rc=rc) @@ -197,26 +200,34 @@ end subroutine lilac_atmcap_register !======================================================================== - subroutine lilac_atmcap_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) + subroutine lilac_atmcap_init (comp, lnd2atm_state, atm2lnd_state, clock, rc) ! input/output variables type (ESMF_GridComp) :: comp - type (ESMF_State) :: lnd2atm_a_state, atm2lnd_a_state + type (ESMF_State) :: lnd2atm_state + type (ESMF_State) :: atm2lnd_state type (ESMF_Clock) :: clock integer, intent(out) :: rc ! local variables - integer :: fileunit - type(ESMF_Mesh) :: atm_mesh - type(ESMF_DistGrid) :: atm_distgrid - type(ESMF_Field) :: field - type(ESMF_FieldBundle) :: c2a_fb , a2c_fb - integer :: n, i, ierr - character(len=cl) :: atm_mesh_filename + integer :: fileunit + type(ESMF_Mesh) :: atm_mesh + type(ESMF_DistGrid) :: atm_distgrid + type(ESMF_Field) :: field + type(ESMF_FieldBundle) :: c2a_fb , a2c_fb + integer :: n, i, ierr + integer :: lsize + character(len=cl) :: atm_mesh_filename + character(len=cl) :: cvalue + integer :: spatialDim + integer :: numOwnedElements + real(r8), pointer :: ownedElemCoords(:) + real(r8) :: mesh_lon, mesh_lat + real(r8) :: tolerance = 1.e-5_r8 character(len=*), parameter :: subname='(lilac_atmcap_init): ' + !------------------------------------------------------------------------- namelist /lilac_atmcap_input/ atm_mesh_filename - !------------------------------------------------------------------------- ! Initialize return code rc = ESMF_SUCCESS @@ -258,7 +269,42 @@ subroutine lilac_atmcap_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) end if !------------------------------------------------------------------------- - ! Create a2c_fb field bundle and add to atm2lnd_a_state + ! Check that lons and lats from the host atmospere match those read + ! in from the atm mesh file + !------------------------------------------------------------------------- + + call ESMF_MeshGet(atm_mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + lsize = size(gindex_atm) + if (numOwnedElements /= lsize) then + print *, 'numOwnedElements in atm_mesh = ',numOwnedElements + print *, 'local size from gindex_atm from host atm = ',lsize + call shr_sys_abort('ERROR: numOwnedElements is not equal to lsize') + end if + + allocate(ownedElemCoords(spatialDim*numOwnedElements)) + call ESMF_MeshGet(atm_mesh, ownedElemCoords=ownedElemCoords, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + do n = 1, lsize + mesh_lon = ownedElemCoords(2*n-1) + mesh_lat = ownedElemCoords(2*n) + if ( abs(mesh_lon - atm_lons(n)) > tolerance) then + write(6,101),n, atm_lons(n), mesh_lon +101 format('ERROR: lilac_atmcap: n, lon, mesh_lon = ',i6,2(f20.10,2x)) + call shr_sys_abort() + end if + if ( abs(mesh_lat - atm_lats(n)) > tolerance) then + write(6,102),n, atm_lats(n), mesh_lat +102 format('ERROR: lilac_atmcap: n, lat, mesh_lat = ',i6,2(f20.10,2x)) + call shr_sys_abort() + end if + end do + deallocate(ownedElemCoords) + + !------------------------------------------------------------------------- + ! Create a2c_fb field bundle and add to atm2lnd_state !------------------------------------------------------------------------- ! create empty field bundle "a2c_fb" @@ -280,17 +326,21 @@ subroutine lilac_atmcap_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) end if end do - ! add field bundle to atm2lnd_a_state - call ESMF_StateAdd(atm2lnd_a_state, (/a2c_fb/), rc=rc) + ! add field bundle to atm2lnd_state + call ESMF_StateAdd(atm2lnd_state, (/a2c_fb/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(subname//"lilac a2c_fb fieldbundle created and added to atm2lnd_a_state", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"lilac a2c_fb fieldbundle created and added to atm2lnd_state", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "lilac a2c_fb fieldbundle created and added to atm2lnd_a_state" + print *, "lilac a2c_fb fieldbundle created and added to atm2lnd_state" end if + ! add nextsw_cday attributes + write(cvalue,*) nextsw_cday + call ESMF_AttributeSet(atm2lnd_state, name="nextsw_cday", value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + !------------------------------------------------------------------------- - ! Create c2a_fb field bundle and add to lnd2atm_a_state - ! Also add nextsw_cday attributes + ! Create c2a_fb field bundle and add to lnd2atm_state !------------------------------------------------------------------------- ! create empty field bundle "c2a_fb" @@ -312,13 +362,10 @@ subroutine lilac_atmcap_init (comp, lnd2atm_a_state, atm2lnd_a_state, clock, rc) end if end do - ! add field bundle to lnd2atm_a_state - call ESMF_StateAdd(lnd2atm_a_state, (/c2a_fb/), rc=rc) + ! add field bundle to lnd2atm_state + call ESMF_StateAdd(lnd2atm_state, (/c2a_fb/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(subname//"lilac c2a_fb fieldbundle is done and added to lnd2atm_a_state", ESMF_LOGMSG_INFO) - - ! Set Attributes needed by land - call ESMF_AttributeSet(lnd2atm_a_state, name="nextsw_cday", value=11, rc=rc) ! TODO: mv what in the world is this??? + call ESMF_LogWrite(subname//"lilac c2a_fb fieldbundle is done and added to lnd2atm_state", ESMF_LOGMSG_INFO) end subroutine lilac_atmcap_init @@ -348,7 +395,7 @@ subroutine lilac_atmcap_final(comp, importState, exportState, clock, rc) ! local variables type (ESMF_FieldBundle) :: import_fieldbundle, export_fieldbundle - character(len=*), parameter :: subname='( lilac_atmos_final): ' + character(len=*), parameter :: subname='( lilac_atmcap_final): ' !------------------------------------------------------------------------- ! Initialize return code @@ -377,6 +424,7 @@ subroutine lilac_atmcap_atm2lnd(fldname, data) ! local variables integer :: n logical :: found + character(len=*), parameter :: subname='(lilac_atmcap_atm2lnd)' ! -------------------------------------------- found = .false. @@ -384,7 +432,7 @@ subroutine lilac_atmcap_atm2lnd(fldname, data) if (trim(fldname) == atm2lnd(n)%fldname) then found = .true. if (size(data) /= size(atm2lnd(n)%dataptr)) then - ! call abort - TODO: what is the abort call in lilac + call shr_sys_abort(trim(subname) // 'size(data) not equal to size(atm2lnd(n)%dataptr') else atm2lnd(n)%dataptr(:) = data(:) end if @@ -393,7 +441,7 @@ subroutine lilac_atmcap_atm2lnd(fldname, data) end if end do if (.not. found) then - ! abort + call shr_sys_abort(trim(subname) // 'atm2lnd field name ' // trim(fldname) //' not found') end if contains @@ -414,14 +462,20 @@ end subroutine lilac_atmcap_atm2lnd !======================================================================== subroutine lilac_atmcap_lnd2atm(fldname, data) + + ! input/output variables character(len=*) , intent(in) :: fldname real(r8) , intent(out) :: data(:) + + ! local variables integer :: n + character(len=*), parameter :: subname='(lilac_atmcap_lnd2atm)' + ! -------------------------------------------- do n = 1,size(lnd2atm) if (trim(fldname) == lnd2atm(n)%fldname) then if (size(data) /= size(lnd2atm(n)%dataptr)) then - ! call abort - TODO: what is the abort call in lilac + call shr_sys_abort(trim(subname) // 'size(data) not equal to size(lnd2atm(n)%dataptr') else data(:) = lnd2atm(n)%dataptr(:) end if diff --git a/lilac/src/lilac_history.F90 b/lilac/src/lilac_history.F90 index 5643737a26..8bb0654707 100644 --- a/lilac/src/lilac_history.F90 +++ b/lilac/src/lilac_history.F90 @@ -65,10 +65,10 @@ subroutine lilac_history_init(clock, rc) character(CS) :: lilac_histfreq_option integer :: lilac_histfreq_n character(len=*), parameter :: subname='(lilac_history_init)' + !--------------------------------------- namelist /lilac_run_input/ caseid, starttype namelist /lilac_io_input/ lilac_histfreq_n, lilac_histfreq_option - !--------------------------------------- if (dbug_flag > 5) then call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO, rc=rc) diff --git a/lilac/src/lilac_io.F90 b/lilac/src/lilac_io.F90 index c118d881ca..431d785e06 100644 --- a/lilac/src/lilac_io.F90 +++ b/lilac/src/lilac_io.F90 @@ -9,6 +9,7 @@ module lilac_io use shr_kind_mod , only : r4=>shr_kind_r4, i8=>shr_kind_i8, r8=>shr_kind_r8 use shr_const_mod , only : fillvalue => SHR_CONST_SPVAL use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat + use shr_sys_mod , only : shr_sys_abort use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag use lilac_methods , only : FB_getFieldN => lilac_methods_FB_getFieldN use lilac_methods , only : FB_getFldPtr => lilac_methods_FB_getFldPtr @@ -523,9 +524,6 @@ subroutine lilac_io_write_FB(filename, iam, FB, whead, wdata, nx, ny, nt, & ! write(tmpstr,*) subname,' counts = ',dimcount,tilecount,minindexptile,maxindexptile ! call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) - ! TODO: this is not getting the global size correct for a FB coming in that does not have - ! all the global grid values in the distgrid - e.g. CTSM - ng = maxval(maxIndexPTile) lnx = ng lny = 1 @@ -544,10 +542,8 @@ subroutine lilac_io_write_FB(filename, iam, FB, whead, wdata, nx, ny, nt, & if (lnx*lny /= ng) then write(tmpstr,*) subname,' ERROR: grid2d size not consistent ',ng,lnx,lny call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) - - !TODO: this should not be an error for say CTSM which does not send a global grid - !rc = ESMF_FAILURE - !return + call shr_sys_abort() + !This should not be an error for say CTSM which does not send a global grid endif if (lwhead) then @@ -575,56 +571,53 @@ subroutine lilac_io_write_FB(filename, iam, FB, whead, wdata, nx, ny, nt, & call ESMF_FieldGet(lfield, rank=rank, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! TODO (mvertens, 2019-03-13): this is a temporary mod to NOT write hgt - if (trim(itemc) /= "hgt") then - if (rank == 2) then - call ESMF_FieldGet(lfield, ungriddedUBound=ungriddedUBound, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - write(cnumber,'(i0)') ungriddedUbound(1) - call ESMF_LogWrite(trim(subname)//':'//'field '//trim(itemc)// & - ' has an griddedUBound of '//trim(cnumber), ESMF_LOGMSG_INFO) - - ! Create a new output variable for each element of the undistributed dimension - do n = 1,ungriddedUBound(1) - if (trim(itemc) /= "hgt") then - write(cnumber,'(i0)') n - name1 = trim(lpre)//'_'//trim(itemc)//trim(cnumber) - call ESMF_LogWrite(trim(subname)//': defining '//trim(name1), ESMF_LOGMSG_INFO) - if (luse_float) then - rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_REAL, dimid, varid) - rcode = pio_put_att(io_file(lfile_ind), varid,"_FillValue",real(lfillvalue,r4)) - else - rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_DOUBLE, dimid, varid) - rcode = pio_put_att(io_file(lfile_ind),varid,"_FillValue",lfillvalue) - end if - if (chkerr(rc,__LINE__,u_FILE_u)) return - rcode = pio_put_att(io_file(lfile_ind), varid, "units" , trim(cunit)) - rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", trim(name1)) - if (present(tavg)) then - if (tavg) then - rcode = pio_put_att(io_file(lfile_ind), varid, "cell_methods", "time: mean") - endif - endif + if (rank == 2) then + call ESMF_FieldGet(lfield, ungriddedUBound=ungriddedUBound, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + write(cnumber,'(i0)') ungriddedUbound(1) + call ESMF_LogWrite(trim(subname)//':'//'field '//trim(itemc)// & + ' has an griddedUBound of '//trim(cnumber), ESMF_LOGMSG_INFO) + + ! Create a new output variable for each element of the undistributed dimension + do n = 1,ungriddedUBound(1) + if (trim(itemc) /= "hgt") then + write(cnumber,'(i0)') n + name1 = trim(lpre)//'_'//trim(itemc)//trim(cnumber) + call ESMF_LogWrite(trim(subname)//': defining '//trim(name1), ESMF_LOGMSG_INFO) + if (luse_float) then + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_REAL, dimid, varid) + rcode = pio_put_att(io_file(lfile_ind), varid,"_FillValue",real(lfillvalue,r4)) + else + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_DOUBLE, dimid, varid) + rcode = pio_put_att(io_file(lfile_ind),varid,"_FillValue",lfillvalue) end if - end do - else - name1 = trim(lpre)//'_'//trim(itemc) - call ESMF_LogWrite(trim(subname)//':'//trim(itemc)//':'//trim(name1),ESMF_LOGMSG_INFO) - if (luse_float) then - rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_REAL, dimid, varid) - rcode = pio_put_att(io_file(lfile_ind), varid, "_FillValue", real(lfillvalue, r4)) - else - rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_DOUBLE, dimid, varid) - rcode = pio_put_att(io_file(lfile_ind), varid, "_FillValue", lfillvalue) - end if - if (chkerr(rc,__LINE__,u_FILE_u)) return - rcode = pio_put_att(io_file(lfile_ind), varid, "units", trim(cunit)) - rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", trim(name1)) - if (present(tavg)) then - if (tavg) then - rcode = pio_put_att(io_file(lfile_ind), varid, "cell_methods", "time: mean") + if (chkerr(rc,__LINE__,u_FILE_u)) return + rcode = pio_put_att(io_file(lfile_ind), varid, "units" , trim(cunit)) + rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", trim(name1)) + if (present(tavg)) then + if (tavg) then + rcode = pio_put_att(io_file(lfile_ind), varid, "cell_methods", "time: mean") + endif endif end if + end do + else + name1 = trim(lpre)//'_'//trim(itemc) + call ESMF_LogWrite(trim(subname)//':'//trim(itemc)//':'//trim(name1),ESMF_LOGMSG_INFO) + if (luse_float) then + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_REAL, dimid, varid) + rcode = pio_put_att(io_file(lfile_ind), varid, "_FillValue", real(lfillvalue, r4)) + else + rcode = pio_def_var(io_file(lfile_ind), trim(name1), PIO_DOUBLE, dimid, varid) + rcode = pio_put_att(io_file(lfile_ind), varid, "_FillValue", lfillvalue) + end if + if (chkerr(rc,__LINE__,u_FILE_u)) return + rcode = pio_put_att(io_file(lfile_ind), varid, "units", trim(cunit)) + rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", trim(name1)) + if (present(tavg)) then + if (tavg) then + rcode = pio_put_att(io_file(lfile_ind), varid, "cell_methods", "time: mean") + endif end if end if end do @@ -679,37 +672,34 @@ subroutine lilac_io_write_FB(filename, iam, FB, whead, wdata, nx, ny, nt, & fldptr1=fldptr1, fldptr2=fldptr2, rank=rank, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! TODO (mvertens, 2019-03-13): this is a temporary mod to NOT write hgt - if (trim(itemc) /= "hgt") then - if (rank == 2) then - - ! Determine the size of the ungridded dimension and the index where the undistributed dimension is located - call ESMF_FieldBundleGet(FB, itemc, field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(lfield, ungriddedUBound=ungriddedUBound, gridToFieldMap=gridToFieldMap, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return + if (rank == 2) then - ! Output for each ungriddedUbound index - do n = 1,ungriddedUBound(1) - write(cnumber,'(i0)') n - name1 = trim(lpre)//'_'//trim(itemc)//trim(cnumber) - rcode = pio_inq_varid(io_file(lfile_ind), trim(name1), varid) - call pio_setframe(io_file(lfile_ind),varid,frame) + ! Determine the size of the ungridded dimension and the index where the undistributed dimension is located + call ESMF_FieldBundleGet(FB, itemc, field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, ungriddedUBound=ungriddedUBound, gridToFieldMap=gridToFieldMap, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return - if (gridToFieldMap(1) == 1) then - call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr2(:,n), rcode, fillval=lfillvalue) - else if (gridToFieldMap(1) == 2) then - call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr2(n,:), rcode, fillval=lfillvalue) - end if - end do - else if (rank == 1) then - name1 = trim(lpre)//'_'//trim(itemc) + ! Output for each ungriddedUbound index + do n = 1,ungriddedUBound(1) + write(cnumber,'(i0)') n + name1 = trim(lpre)//'_'//trim(itemc)//trim(cnumber) rcode = pio_inq_varid(io_file(lfile_ind), trim(name1), varid) call pio_setframe(io_file(lfile_ind),varid,frame) - call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr1, rcode, fillval=lfillvalue) - end if ! end if rank is 2 or 1 - end if ! end if not "hgt" + if (gridToFieldMap(1) == 1) then + call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr2(:,n), rcode, fillval=lfillvalue) + else if (gridToFieldMap(1) == 2) then + call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr2(n,:), rcode, fillval=lfillvalue) + end if + end do + else if (rank == 1) then + name1 = trim(lpre)//'_'//trim(itemc) + rcode = pio_inq_varid(io_file(lfile_ind), trim(name1), varid) + call pio_setframe(io_file(lfile_ind),varid,frame) + call pio_write_darray(io_file(lfile_ind), varid, iodesc, fldptr1, rcode, fillval=lfillvalue) + end if ! end if rank is 2 or 1 + end do ! end loop over fields in FB ! Fill coordinate variables @@ -1404,15 +1394,13 @@ subroutine lilac_io_read_init_iodesc(FB, name1, pioid, iodesc, rc) call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, & maxIndexPTile=maxIndexPTile, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - !write(tmpstr,*) subname,' counts = ',dimcount,tilecount,minindexptile,maxindexptile - !call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + ! write(tmpstr,*) subname,' counts = ',dimcount,tilecount,minindexptile,maxindexptile + ! call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) if (ng > maxval(maxIndexPTile)) then write(tmpstr,*) subname,' WARNING: dimensions do not match', lnx, lny, maxval(maxIndexPTile) call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) - !TODO: this should not be an error for say CTSM which does not send a global grid - !rc = ESMF_Failure - !return + !This should not be an error for CTSM which does not send a global grid endif call ESMF_DistGridGet(distgrid, localDE=0, elementCount=ns, rc=rc) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 958b67d8d4..369c3c8260 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -707,13 +707,14 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) if (masterproc) then write(iulog,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' - write(iulog,F02) 'calday is : ', calday - write(iulog,F02) 'eccen is : ', eccen - write(iulog,F02) 'mvelpp is : ', mvelpp - write(iulog,F02) 'lambm0 is : ', lambm0 - write(iulog,F02) 'obliqr is : ', obliqr - write(iulog,F02) 'declin is : ', declin - write(iulog,F02) 'declinp1 is : ', declinp1 + write(iulog,F02) 'nextsw_cday is : ', nextsw_cday + write(iulog,F02) 'calday is : ', calday + write(iulog,F02) 'eccen is : ', eccen + write(iulog,F02) 'mvelpp is : ', mvelpp + write(iulog,F02) 'lambm0 is : ', lambm0 + write(iulog,F02) 'obliqr is : ', obliqr + write(iulog,F02) 'declin is : ', declin + write(iulog,F02) 'declinp1 is : ', declinp1 write(iulog,* ) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' end if From 900de73e80412262491214186b93bc34b67c409d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 8 Dec 2019 12:09:18 -0700 Subject: [PATCH 0488/1973] changes to clean up lilac alarms and start getting in lilac restart capability --- lilac/atm_driver/lilac_in | 2 +- lilac/src/lilac_history.F90 | 310 ++++++--------- lilac/src/lilac_mod.F90 | 189 +++++---- lilac/src/lilac_time.F90 | 775 +++++++++++++++++------------------- 4 files changed, 597 insertions(+), 679 deletions(-) diff --git a/lilac/atm_driver/lilac_in b/lilac/atm_driver/lilac_in index 852cd48637..25c69a8abd 100644 --- a/lilac/atm_driver/lilac_in +++ b/lilac/atm_driver/lilac_in @@ -3,8 +3,8 @@ caseid = 'test_lilac' / &lilac_io_input - lilac_histfreq_n = 4 lilac_histfreq_option = 'nsteps' + lilac_histfreq_n = 4 / &lilac_atmcap_input atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' diff --git a/lilac/src/lilac_history.F90 b/lilac/src/lilac_history.F90 index 8bb0654707..58da52d614 100644 --- a/lilac/src/lilac_history.F90 +++ b/lilac/src/lilac_history.F90 @@ -7,19 +7,14 @@ module lilac_history use ESMF use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl, r8=>shr_kind_r8 use shr_sys_mod , only : shr_sys_abort + use lilac_time , only : lilac_time_alarmInit use lilac_atmcap , only : atm_nx => atm_global_nx use lilac_atmcap , only : atm_ny => atm_global_ny - use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag use lilac_constants , only : SecPerDay => lilac_constants_SecPerDay - use lilac_time , only : alarmInit => lilac_time_alarmInit - use lilac_methods , only : FB_reset => lilac_methods_FB_reset - use lilac_methods , only : FB_diagnose => lilac_methods_FB_diagnose - use lilac_methods , only : FB_GetFldPtr => lilac_methods_FB_GetFldPtr - use lilac_methods , only : FB_accum => lilac_methods_FB_accum - use lilac_methods , only : chkerr use lilac_io , only : lilac_io_write, lilac_io_wopen, lilac_io_enddef use lilac_io , only : lilac_io_close, lilac_io_date2yyyymmdd, lilac_io_sec2hms use lilac_io , only : lilac_io_ymd2date + use lilac_methods , only : chkerr implicit none private @@ -28,8 +23,6 @@ module lilac_history public :: lilac_history_write character(CL) :: histfile_prefix - type(ESMF_Alarm) :: AlarmHist - type(ESMF_Alarm) :: AlarmHistAvg character(*), parameter :: u_FILE_u = & __FILE__ @@ -37,53 +30,36 @@ module lilac_history contains !=============================================================================== - subroutine lilac_history_init(clock, rc) + subroutine lilac_history_init(clock, caseid, rc) ! ------------------------------------------ ! Initialize lilac history file alarm ! ------------------------------------------ ! input/output variables - type(ESMF_Clock) :: clock ! lilac clock - integer , intent(out) :: rc + type(ESMF_Clock) :: clock ! lilac clock + character(CL), intent(in) :: caseid + integer , intent(out) :: rc ! local variables + type(ESMF_Alarm) :: alarmhist type(ESMF_Time) :: currtime - type(ESMF_Time) :: reftime - type(ESMF_Time) :: starttime - type(ESMF_Time) :: nexttime - type(ESMF_Calendar) :: calendar ! calendar type character(len=64) :: currtimestr integer :: yr,mon,day,sec ! time units character(CL) :: freq_option ! freq_option setting (ndays, nsteps, etc) integer :: freq_n ! freq_n setting relative to freq_option - integer :: iam integer :: fileunit integer :: ierr - character(CL) :: caseid - character(CS) :: starttype + character(CS) :: cvalue character(CS) :: lilac_histfreq_option integer :: lilac_histfreq_n character(len=*), parameter :: subname='(lilac_history_init)' !--------------------------------------- - namelist /lilac_run_input/ caseid, starttype namelist /lilac_io_input/ lilac_histfreq_n, lilac_histfreq_option - if (dbug_flag > 5) then - call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO, rc=rc) - endif rc = ESMF_SUCCESS - ! read in caseid - open(newunit=fileunit, status="old", file="lilac_in") - read(fileunit, lilac_run_input, iostat=ierr) - if (ierr > 0) then - call shr_sys_abort(trim(subname) // 'error reading in lilac_run_input') - end if - close(fileunit) - write(histfile_prefix,"(2a)") trim(caseid),'.lilac.hi.' - ! read in history file output frequencies open(newunit=fileunit, status="old", file="lilac_in") read(fileunit, lilac_io_input, iostat=ierr) @@ -92,26 +68,33 @@ subroutine lilac_history_init(clock, rc) end if close(fileunit) + write(histfile_prefix,"(2a)") trim(caseid),'.lilac.hi.' + write(6,*)'DEBUG: histfile_prefix = ',histfile_prefix + !--------------------------------------- ! Get the clock info !--------------------------------------- - call ESMF_ClockGet(clock, currtime=currtime, reftime=reftime, starttime=starttime, calendar=calendar, rc=rc) + call ESMF_ClockGet(clock, currtime=currtime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeGet(currtime,yy=yr, mm=mon, dd=day, s=sec, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return write(currtimestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',sec - if (dbug_flag > 1) then - call ESMF_LogWrite(trim(subname)//": currtime = "//trim(currtimestr), ESMF_LOGMSG_INFO, rc=rc) - endif + call ESMF_LogWrite(trim(subname)//": currtime = "//trim(currtimestr), ESMF_LOGMSG_INFO, rc=rc) !--------------------------------------- - ! Initialize thie history alarm + ! Initialize the history alarm !--------------------------------------- - call alarmInit(clock, AlarmHist, option=lilac_histfreq_option, opt_n=lilac_histfreq_n, & - RefTime=RefTime, alarmname='lilac_history_alarm', rc=rc) + call ESMF_LogWrite(trim(subname)//"Initializing lilac history alarm ", ESMF_LOGMSG_INFO, rc=rc) + call ESMF_LogWrite(trim(subname)//"Initializing lilac history frequency option "//trim(lilac_histfreq_option), & + ESMF_LOGMSG_INFO, rc=rc) + write(cvalue,*)lilac_histfreq_n + call ESMF_LogWrite(trim(subname)//"Initializing lilac history frequency "//trim(cvalue), & + ESMF_LOGMSG_INFO, rc=rc) + + call lilac_time_alarminit(clock, alarmhist, 'lilac_history_alarm', lilac_histfreq_option, lilac_histfreq_n, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine lilac_history_init @@ -141,13 +124,12 @@ subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & type(ESMF_FieldBundle) :: c2r_fb, r2c_fb type(ESMF_VM) :: vm type(ESMF_Time) :: currtime - type(ESMF_Time) :: reftime + character(len=CS) :: currtimestr type(ESMF_Time) :: starttime type(ESMF_Time) :: nexttime + character(len=CS) :: nexttimestr type(ESMF_TimeInterval) :: timediff ! Used to calculate curr_time type(ESMF_Calendar) :: calendar ! calendar type - character(len=CS) :: currtimestr - character(len=CS) :: nexttimestr integer :: i,j,m,n integer :: start_ymd ! Starting date YYYYMMDD integer :: start_tod ! Starting time-of-day (s) @@ -159,20 +141,15 @@ subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & character(CL) :: hist_file ! Local path to history filename character(CL) :: freq_option ! freq_option setting (ndays, nsteps, etc) integer :: freq_n ! freq_n setting relative to freq_option - logical :: alarmIsOn ! generic alarm flag real(r8) :: tbnds(2) ! CF1.0 time bounds logical :: whead,wdata ! for writing restart/history cdf files character(CL) :: cvalue integer :: lnd_nx, lnd_ny integer :: rof_nx, rof_ny integer :: iam - logical,save :: first_call = .true. character(len=*), parameter :: subname='(lilac_history_write)' !--------------------------------------- - if (dbug_flag > 5) then - call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO, rc=rc) - endif rc = ESMF_SUCCESS !--------------------------------------- @@ -189,7 +166,7 @@ subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & ! --- Get the clock info !--------------------------------------- - call ESMF_ClockGet(clock, currtime=currtime, reftime=reftime, starttime=starttime, calendar=calendar, rc=rc) + call ESMF_ClockGet(clock, currtime=currtime, starttime=starttime, calendar=calendar, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_ClockGetNextTime(clock, nextTime=nexttime, rc=rc) @@ -198,166 +175,133 @@ subroutine lilac_history_write(atm2cpl_state, cpl2atm_state, & call ESMF_TimeGet(currtime,yy=yr, mm=mon, dd=day, s=sec, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return write(currtimestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',sec - if (dbug_flag > 1) then - call ESMF_LogWrite(trim(subname)//": currtime = "//trim(currtimestr), ESMF_LOGMSG_INFO, rc=rc) - endif + call ESMF_LogWrite(trim(subname)//": currtime = "//trim(currtimestr), ESMF_LOGMSG_INFO, rc=rc) call ESMF_TimeGet(nexttime,yy=yr, mm=mon, dd=day, s=sec, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return write(nexttimestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',sec - if (dbug_flag > 1) then - call ESMF_LogWrite(trim(subname)//": nexttime = "//trim(nexttimestr), ESMF_LOGMSG_INFO, rc=rc) - endif - timediff = nexttime - reftime + call ESMF_LogWrite(trim(subname)//": nexttime = "//trim(nexttimestr), ESMF_LOGMSG_INFO, rc=rc) + timediff = nexttime - starttime call ESMF_TimeIntervalGet(timediff, d=day, s=sec, rc=rc) dayssince = day + sec/real(SecPerDay,R8) - call ESMF_TimeGet(reftime, yy=yr, mm=mon, dd=day, s=sec, rc=rc) + call ESMF_TimeGet(starttime, yy=yr, mm=mon, dd=day, s=sec, rc=rc) call lilac_io_ymd2date(yr,mon,day,start_ymd) start_tod = sec time_units = 'days since ' // trim(lilac_io_date2yyyymmdd(start_ymd)) // ' ' // lilac_io_sec2hms(start_tod, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !--------------------------------------- - ! --- History Alarms - !--------------------------------------- - - if (ESMF_AlarmIsRinging(AlarmHist, rc=rc)) then - if (ChkErr(rc,__LINE__,u_FILE_u)) return - alarmIsOn = .true. - call ESMF_AlarmRingerOff( AlarmHist, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - alarmIsOn = .false. - endif - - ! TODO: remove this hard-wiring - alarmisOn = .true. - - !--------------------------------------- - ! --- History File + ! Write lilac history file ! Use nexttimestr rather than currtimestr here since that is the time at the end of ! the timestep and is preferred for history file names !--------------------------------------- - if (alarmIsOn) then - write(hist_file,"(3a)") trim(histfile_prefix),trim(nexttimestr),'.nc' - call ESMF_LogWrite(trim(subname)//": write "//trim(hist_file), ESMF_LOGMSG_INFO, rc=rc) - - call lilac_io_wopen(hist_file, vm, iam, clobber=.true.) - - do m = 1,2 - whead=.false. - wdata=.false. - if (m == 1) then - whead=.true. - elseif (m == 2) then - wdata=.true. - call lilac_io_enddef(hist_file) - endif - - tbnds = dayssince - - call ESMF_LogWrite(trim(subname)//": time "//trim(time_units), ESMF_LOGMSG_INFO, rc=rc) - if (tbnds(1) >= tbnds(2)) then - call lilac_io_write(hist_file, iam, & - time_units=time_units, calendar=calendar, time_val=dayssince, & - whead=whead, wdata=wdata, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call lilac_io_write(hist_file, iam, & - time_units=time_units, calendar=calendar, time_val=dayssince, & - whead=whead, wdata=wdata, tbnds=tbnds, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - endif - - ! obtain global sizes for lnd_nx and lnd_ny - call ESMF_AttributeGet(lnd2cpl_state, name="lnd_nx", value=cvalue, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - read(cvalue,*) lnd_nx - call ESMF_LogWrite(subname//"got attribute lnd_nx "//trim(cvalue), ESMF_LOGMSG_INFO) - call ESMF_AttributeGet(lnd2cpl_state, name="lnd_ny", value=cvalue, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - read(cvalue,*) lnd_ny - call ESMF_LogWrite(subname//"got attribute lnd_nx "//trim(cvalue), ESMF_LOGMSG_INFO) - - call ESMF_StateGet(atm2cpl_state, 'a2c_fb', a2c_fb) ! from atm - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, a2c_fb, & - nx=atm_nx, ny=atm_ny, nt=1, whead=whead, wdata=wdata, pre='atm_to_cpl', rc=rc) + write(hist_file,"(3a)") trim(histfile_prefix),trim(nexttimestr),'.nc' + call ESMF_LogWrite(trim(subname)//": write "//trim(hist_file), ESMF_LOGMSG_INFO, rc=rc) + + call lilac_io_wopen(hist_file, vm, iam, clobber=.true.) + + do m = 1,2 + whead=.false. + wdata=.false. + if (m == 1) then + whead=.true. + elseif (m == 2) then + wdata=.true. + call lilac_io_enddef(hist_file) + endif + + tbnds = dayssince + + call ESMF_LogWrite(trim(subname)//": time "//trim(time_units), ESMF_LOGMSG_INFO, rc=rc) + if (tbnds(1) >= tbnds(2)) then + call lilac_io_write(hist_file, iam, & + time_units=time_units, calendar=calendar, time_val=dayssince, & + whead=whead, wdata=wdata, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_StateGet(cpl2atm_state, 'c2a_fb', c2a_fb) ! to atm + else + call lilac_io_write(hist_file, iam, & + time_units=time_units, calendar=calendar, time_val=dayssince, & + whead=whead, wdata=wdata, tbnds=tbnds, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2a_fb, & - nx=atm_nx, ny=atm_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_atm', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_atm', l2c_fb_atm) ! from lnd + endif + + ! obtain global sizes for lnd_nx and lnd_ny + call ESMF_AttributeGet(lnd2cpl_state, name="lnd_nx", value=cvalue, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + read(cvalue,*) lnd_nx + call ESMF_LogWrite(subname//"got attribute lnd_nx "//trim(cvalue), ESMF_LOGMSG_INFO) + call ESMF_AttributeGet(lnd2cpl_state, name="lnd_ny", value=cvalue, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + read(cvalue,*) lnd_ny + call ESMF_LogWrite(subname//"got attribute lnd_nx "//trim(cvalue), ESMF_LOGMSG_INFO) + + call ESMF_StateGet(atm2cpl_state, 'a2c_fb', a2c_fb) ! from atm + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, a2c_fb, & + nx=atm_nx, ny=atm_ny, nt=1, whead=whead, wdata=wdata, pre='atm_to_cpl', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(cpl2atm_state, 'c2a_fb', c2a_fb) ! to atm + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, c2a_fb, & + nx=atm_nx, ny=atm_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_atm', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_atm', l2c_fb_atm) ! from lnd + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, l2c_fb_atm, & + nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_atm', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_rof', l2c_fb_rof) ! from lnd + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, l2c_fb_rof, & + nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_rof', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_atm', c2l_fb_atm) ! to lnd + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_io_write(hist_file, iam, c2l_fb_atm, & + nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_lnd_atm', rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (present(rof2cpl_state) .and. present(cpl2rof_state)) then + ! obtain global sizes for rof_nx and rof_ny + call ESMF_AttributeGet(rof2cpl_state, name="rof_nx", value=cvalue, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + read(cvalue,*) rof_nx + call ESMF_LogWrite(subname//"got attribute rof_nx "//trim(cvalue), ESMF_LOGMSG_INFO) + call ESMF_AttributeGet(rof2cpl_state, name="rof_ny", value=cvalue, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + read(cvalue,*) rof_ny + call ESMF_LogWrite(subname//"got attribute rof_nx "//trim(cvalue), ESMF_LOGMSG_INFO) + + call ESMF_StateGet(rof2cpl_state, 'r2c_fb', r2c_fb) ! from rof if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, l2c_fb_atm, & - nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_atm', rc=rc) + call lilac_io_write(hist_file, iam, r2c_fb, & + nx=rof_nx, ny=rof_ny, nt=1, whead=whead, wdata=wdata, pre='rof_to_cpl', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_StateGet(lnd2cpl_state, 'l2c_fb_rof', l2c_fb_rof) ! from lnd + + call ESMF_StateGet(cpl2rof_state, 'c2r_fb', c2r_fb) ! to rof if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, l2c_fb_rof, & - nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='lnd_to_cpl_rof', rc=rc) + call lilac_io_write(hist_file, iam, c2r_fb, & + nx=rof_nx, ny=rof_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_rof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_atm', c2l_fb_atm) ! to lnd + + call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_rof', c2l_fb_rof) ! to rof if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2l_fb_atm, & - nx=lnd_nx, ny=lnd_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_lnd_atm', rc=rc) + call lilac_io_write(hist_file, iam, c2l_fb_rof, & + nx=lnd_nx, ny=lnd_ny, nt=1, whead=.true., wdata=wdata, pre='cpl_to_lnd_rof', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - if (present(rof2cpl_state) .and. present(cpl2rof_state)) then - ! obtain global sizes for rof_nx and rof_ny - call ESMF_AttributeGet(rof2cpl_state, name="rof_nx", value=cvalue, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - read(cvalue,*) rof_nx - call ESMF_LogWrite(subname//"got attribute rof_nx "//trim(cvalue), ESMF_LOGMSG_INFO) - call ESMF_AttributeGet(rof2cpl_state, name="rof_ny", value=cvalue, rc=rc) - if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) - read(cvalue,*) rof_ny - call ESMF_LogWrite(subname//"got attribute rof_nx "//trim(cvalue), ESMF_LOGMSG_INFO) - - call ESMF_StateGet(rof2cpl_state, 'r2c_fb', r2c_fb) ! from rof - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, r2c_fb, & - nx=rof_nx, ny=rof_ny, nt=1, whead=whead, wdata=wdata, pre='rof_to_cpl', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_StateGet(cpl2rof_state, 'c2r_fb', c2r_fb) ! to rof - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2r_fb, & - nx=rof_nx, ny=rof_ny, nt=1, whead=whead, wdata=wdata, pre='cpl_to_rof', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_StateGet(cpl2lnd_state, 'c2l_fb_rof', c2l_fb_rof) ! to rof - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(hist_file, iam, c2l_fb_rof, & - nx=lnd_nx, ny=lnd_ny, nt=1, whead=.true., wdata=wdata, pre='cpl_to_lnd_rof', rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - enddo - - call lilac_io_close(hist_file, iam, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - endif - - !--------------------------------------- - !--- clean up - !--------------------------------------- - - first_call = .false. - - if (dbug_flag > 5) then - call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO, rc=rc) - endif - + end if + + enddo + + call lilac_io_close(hist_file, iam, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end subroutine lilac_history_write end module lilac_history diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 8fc5560904..9e56c25dc8 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -16,6 +16,8 @@ module lilac_mod ! lilac routines use lilac_io , only : lilac_io_init + use lilac_time , only : lilac_time_clockinit, lilac_time_alarminit + use lilac_time , only : lilac_time_restart_write, lilac_time_restart_read use lilac_atmaero , only : lilac_atmaero_init, lilac_atmaero_interp use lilac_atmcap , only : lilac_atmcap_init_vars use lilac_history , only : lilac_history_init @@ -65,11 +67,14 @@ module lilac_mod logical :: couple_to_river = .false. integer :: mytask + character(ESMF_MAXSTR) :: starttype character(*) , parameter :: modname = "lilac_mod" character(*), parameter :: u_FILE_u = & __FILE__ + integer :: logunit = 6 ! TODO: generalize this + !======================================================================== contains !======================================================================== @@ -102,6 +107,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & integer , intent(in) :: atm_stop_secs ! local variables + character(ESMF_MAXSTR) :: caseid type(ESMF_TimeInterval) :: timeStep type(ESMF_Time) :: startTime type(ESMF_Time) :: stopTime @@ -129,6 +135,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & logical :: comp_iamin(1) = (/.true./) ! for pio init2 !------------------------------------------------------------------------ + namelist /lilac_run_input/ caseid, starttype + ! Initialize return code rc = ESMF_SUCCESS @@ -175,6 +183,14 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & call shr_pio_init2(compids, compLabels, comp_iamin, (/mpicom/), (/mytask/)) call ESMF_LogWrite(subname//"initialized shr_pio_init2 ...", ESMF_LOGMSG_INFO) + ! read in caseid + open(newunit=fileunit, status="old", file="lilac_in") + read(fileunit, lilac_run_input, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort(trim(subname) // 'error reading in lilac_run_input') + end if + close(fileunit) + !------------------------------------------------------------------------- ! Initial lilac atmosphere cap module variables !------------------------------------------------------------------------- @@ -189,7 +205,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac atmcap initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // "lilac atm cap gridded component created" + write(logunit,*) trim(subname) // "lilac atm cap gridded component created" end if cname = " CTSM " @@ -197,7 +213,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac ctsm initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " ctsm gridded component created" + write(logunit,*) trim(subname) // " ctsm gridded component created" end if cname = " MOSART " @@ -205,7 +221,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac mosart initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " mosart gridded component created" + write(logunit,*) trim(subname) // " mosart gridded component created" end if cname = "Coupler from atmosphere to land" @@ -213,7 +229,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_a2l initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " coupler component (atmosphere to land) created" + write(logunit,*) trim(subname) // " coupler component (atmosphere to land) created" end if cname = "Coupler from land to atmosphere" @@ -221,7 +237,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_l2a initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " coupler component (land to atmosphere) created" + write(logunit,*) trim(subname) // " coupler component (land to atmosphere) created" end if cname = "Coupler from river to land" @@ -229,7 +245,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_r2l initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " coupler component (atmosphere to land) created" + write(logunit,*) trim(subname) // " coupler component (atmosphere to land) created" end if cname = "Coupler from land to river" @@ -237,7 +253,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_l2r initialization') call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " coupler component (land to atmosphere) created" + write(logunit,*) trim(subname) // " coupler component (land to atmosphere) created" end if !------------------------------------------------------------------------- @@ -249,7 +265,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('atm_gcomp register failure') call ESMF_LogWrite(subname//" atmos SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " lilac atm cap setservices finished" + write(logunit,*) trim(subname) // " lilac atm cap setservices finished" end if ! Register section -- set services -- ctsm @@ -257,7 +273,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('lnd_gcomp register failure') call ESMF_LogWrite(subname//"CSTM SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " CTSM setservices finished" + write(logunit,*) trim(subname) // " CTSM setservices finished" end if ! Register section -- set services -- mosart @@ -265,7 +281,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') call ESMF_LogWrite(subname//"MOSART SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " CTSM setservices finished" + write(logunit,*) trim(subname) // " CTSM setservices finished" end if ! Register section -- set services -- coupler atmosphere to land @@ -273,7 +289,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_atm2lnd_comp register failure') call ESMF_LogWrite(subname//"Coupler from atmosphere to land SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " coupler from atmosphere to land setservices finished" + write(logunit,*) trim(subname) // " coupler from atmosphere to land setservices finished" end if ! Register section -- set services -- river to land @@ -281,7 +297,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') call ESMF_LogWrite(subname//"Coupler from river to land SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " coupler from river to land setservices finished" + write(logunit,*) trim(subname) // " coupler from river to land setservices finished" end if ! Register section -- set services -- coupler land to atmosphere @@ -289,7 +305,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2atm_comp register failure') call ESMF_LogWrite(subname//"Coupler from land to atmosphere SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " coupler from land to atmosphere setservices finished" + write(logunit,*) trim(subname) // " coupler from land to atmosphere setservices finished" end if ! Register section -- set services -- coupler land to river @@ -297,52 +313,20 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') call ESMF_LogWrite(subname//"Coupler from land to river SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, trim(subname) // " coupler from land to river setservices finished" + write(logunit,*) trim(subname) // " coupler from land to river setservices finished" end if !------------------------------------------------------------------------- - ! Create and initialize the lilac_clock and calendar + ! Create and initialize the lilac_clock, alarms and calendar !------------------------------------------------------------------------- - if (trim(atm_calendar) == 'NOLEAP') then - lilac_calendar = ESMF_CalendarCreate(name='NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) - else if (trim(atm_calendar) == 'GREGORIAN') then - lilac_calendar = ESMF_CalendarCreate(name='GREGORIAN', calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc ) - else - ! TODO: add supported calendars here - end if - - call ESMF_TimeIntervalSet(TimeStep, s=atm_timestep, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - call ESMF_TimeSet(StartTime, yy=atm_start_year, mm=atm_start_mon, dd=atm_start_day , s=atm_start_secs, & - calendar=lilac_calendar, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - call ESMF_TimeSet(StopTime , yy=atm_stop_year , mm=atm_stop_mon , dd=atm_stop_day , s=atm_stop_secs , & - calendar=lilac_calendar, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - lilac_clock = ESMF_ClockCreate(name='lilac_clock', TimeStep=TimeStep, startTime=StartTime, & - RefTime=StartTime, stopTime=stopTime, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - if (mytask == 0) then - print *, trim(subname) // "---------------------------------------" - call ESMF_ClockPrint (lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_CalendarPrint (lilac_calendar , rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - print *, trim(subname) // "---------------------------------------" - end if - - ! Add a restart alarm to the clock - lilac_restart_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_restart_alarm', rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing restart alarm') + call lilac_time_clockInit(caseid, starttype, atm_calendar, atm_timestep, & + atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & + atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, logunit, & + lilac_clock, rc) - ! Add a stop alarm to the clock - lilac_stop_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_stop_alarm', rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing stop alarm') + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing clock") + call ESMF_LogWrite(subname//"lilac_clock initialized", ESMF_LOGMSG_INFO) ! ------------------------------------------------------------------------- ! Initialize LILAC gridded components @@ -418,7 +402,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & end if if (mytask == 0) then - print *, trim(subname) // "finished lilac initialization" + write(logunit,*) trim(subname) // "finished lilac initialization" end if !------------------------------------------------------------------------- @@ -439,7 +423,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & ! Initialize lilac history output !------------------------------------------------------------------------- - call lilac_history_init(lilac_clock, rc) + call lilac_history_init(lilac_clock, caseid, rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing lilac_history_init") call ESMF_LogWrite(subname//"initialized lilac history output ...", ESMF_LOGMSG_INFO) @@ -454,6 +438,8 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) logical, intent(in) :: stop_alarm_is_ringing ! local variables + type(ESMF_Alarm) :: lilac_history_alarm + type(ESMF_Alarm) :: lilac_restart_alarm type(ESMF_State) :: importState, exportState integer :: rc character(len=*), parameter :: subname=trim(modname)//': [lilac_run] ' @@ -462,26 +448,33 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) rc = ESMF_SUCCESS if (mytask == 0) then - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - print *, " Lilac Run " - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + write(logunit,*) "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + write(logunit,*) " Lilac Run " + write(logunit,*) "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" end if + ! Note that the lilac caps for ctsm and possible mosart will + ! listen to the restart and stop alarms on the lilac clock + ! Set the clock restart alarm if restart_alarm_ringing is true if (restart_alarm_is_ringing) then + call ESMF_ClockGetAlarm(lilac_clock, 'lilac_restart_alarm', lilac_restart_alarm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_restart_alarm") call ESMF_AlarmRingerOn(lilac_restart_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") end if ! Set the clock stop alarm if stop_alarm_ringing is true if (stop_alarm_is_ringing) then + call ESMF_ClockGetAlarm(lilac_clock, 'lilac_restart_alarm', lilac_stop_alarm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_restart_alarm") call ESMF_AlarmRingerOn(lilac_stop_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") end if ! Run lilac atmcap - update the cpl2atm_state call ESMF_LogWrite(subname//"running lilac atmos_cap", ESMF_LOGMSG_INFO) - if (mytask == 0) print *, "Running atmos_cap gridded component , rc =", rc + if (mytask == 0) write(logunit,*) "Running atmos_cap gridded component , rc =", rc call ESMF_GridCompRun(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") @@ -492,14 +485,16 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! Run cpl_atm2lnd call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) - if (mytask == 0) print *, "Running coupler component..... cpl_atm2lnd_comp" + if (mytask == 0) write(logunit,*) "Running coupler component..... cpl_atm2lnd_comp" call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_atm2lnd") ! Run ctsm + ! Write ctsm restart file if lilac_restart_alarm is ringing + ! Finalize ctsm if lilac_stop_alarm is ringing call ESMF_LogWrite(subname//"running ctsm", ESMF_LOGMSG_INFO) - if (mytask == 0) print *, "Running ctsm" + if (mytask == 0) write(logunit,*) "Running ctsm" call ESMF_GridCompRun(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") @@ -507,7 +502,7 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! Run cpl_lnd2atm call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Running coupler component..... cpl_lnd2atm_comp , rc =", rc + write(logunit,*) "Running coupler component..... cpl_lnd2atm_comp , rc =", rc end if call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2cpl_state, exportState=cpl2atm_state, & clock=lilac_clock, rc=rc) @@ -516,14 +511,16 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) if (couple_to_river) then ! Run cpl_lnd2rof call ESMF_LogWrite(subname//"running cpl_lnd2rof_comp ", ESMF_LOGMSG_INFO) - if (mytask == 0) print *, "Running coupler component..... cpl_lnd2rof_comp" + if (mytask == 0) write(logunit,*) "Running coupler component..... cpl_lnd2rof_comp" call ESMF_CplCompRun(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_lnd2rof") ! Run mosart + ! Write mosart restart file if lilac_restart_alarm is ringing + ! Finalize mosart if lilac_stop_alarm is ringing call ESMF_LogWrite(subname//"running mosart", ESMF_LOGMSG_INFO) - if (mytask == 0) print *, "Running mosart" + if (mytask == 0) write(logunit,*) "Running mosart" call ESMF_GridCompRun(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") @@ -531,29 +528,45 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! Run cpl_rof2lnd ! TODO: uncommenting this needs to be tested ! call ESMF_LogWrite(subname//"running cpl_rof2lnd_comp ", ESMF_LOGMSG_INFO) - ! if (mytask == 0) print *, "Running coupler component..... cpl_rof2lnd_comp" + ! if (mytask == 0) write(logunit,*) "Running coupler component..... cpl_rof2lnd_comp" ! call ESMF_CplCompRun(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & ! clock=lilac_clock, rc=rc) ! if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_rof2lnd") end if - ! Write out history output - if (couple_to_river) then - call lilac_history_write(atm2cpl_state, cpl2atm_state, lnd2cpl_state, cpl2lnd_state, & - rof2cpl_state=rof2cpl_state, cpl2rof_state=cpl2rof_state, clock=lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") - else - call lilac_history_write(atm2cpl_state, cpl2atm_state, lnd2cpl_state, cpl2lnd_state, & - clock=lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") - end if - - ! Advance the time at the end of the time step + ! Write out lilac history output if lilac_history_alarm is ringing + call ESMF_ClockGetAlarm(lilac_clock, 'lilac_history_alarm', lilac_history_alarm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_history_alarm") + if (ESMF_AlarmIsRinging(lilac_history_alarm, rc=rc)) then + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_AlarmRingerOff( lilac_history_alarm, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (couple_to_river) then + call lilac_history_write(atm2cpl_state, cpl2atm_state, lnd2cpl_state, cpl2lnd_state, & + rof2cpl_state=rof2cpl_state, cpl2rof_state=cpl2rof_state, clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") + else + call lilac_history_write(atm2cpl_state, cpl2atm_state, lnd2cpl_state, cpl2lnd_state, & + clock=lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in history write") + end if + end if + + ! Write out lilac restart output if lilac_restart_alarm is ringing + if (ESMF_AlarmIsRinging(lilac_restart_alarm, rc=rc)) then + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_AlarmRingerOff( lilac_restart_alarm, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lilac_time_restart_write(lilac_clock, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in restart write") + end if + + ! Advance the lilac clock at the end of the time step call ESMF_ClockAdvance(lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in advancing time step") call ESMF_LogWrite(subname//"time is icremented now... (ClockAdvance)", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "time is icremented now... (ClockAdvance) , rc =", rc + write(logunit,*) "time is icremented now... (ClockAdvance) , rc =", rc end if end subroutine lilac_run @@ -572,9 +585,9 @@ subroutine lilac_final( ) rc = ESMF_SUCCESS if (mytask == 0) then - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - print *, " Lilac Finalizing " - print *, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + write(logunit,*) "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + write(logunit,*) " Lilac Finalizing " + write(logunit,*) "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" end if ! Gridded Component Finalizing! --- atmosphere @@ -582,7 +595,7 @@ subroutine lilac_final( ) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Finalizing atmos_cap gridded component , rc =", rc + write(logunit,*) "Finalizing atmos_cap gridded component , rc =", rc end if ! Coupler component Finalizing --- coupler atmos to land @@ -590,7 +603,7 @@ subroutine lilac_final( ) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Finalizing coupler component..... cpl_atm2lnd_comp , rc =", rc + write(logunit,*) "Finalizing coupler component..... cpl_atm2lnd_comp , rc =", rc end if ! Gridded Component Finalizing! --- land @@ -598,7 +611,7 @@ subroutine lilac_final( ) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Finalizing lnd_cap gridded component , rc =", rc + write(logunit,*) "Finalizing lnd_cap gridded component , rc =", rc end if ! Coupler component Finalizing --- coupler land to atmos @@ -606,7 +619,7 @@ subroutine lilac_final( ) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "Finalizing coupler component..... cpl_lnd2atm_comp , rc =", rc + write(logunit,*) "Finalizing coupler component..... cpl_lnd2atm_comp , rc =", rc end if ! Then clean them up @@ -614,7 +627,7 @@ subroutine lilac_final( ) call ESMF_LogWrite(subname//"destroying all states ", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "ready to destroy all states" + write(logunit,*) "ready to destroy all states" end if call ESMF_StateDestroy(atm2cpl_state , rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) @@ -631,7 +644,7 @@ subroutine lilac_final( ) call ESMF_LogWrite(subname//"destroying all components ", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "ready to destroy all components" + write(logunit,*) "ready to destroy all components" end if call ESMF_GridCompDestroy(atm_gcomp, rc=rc) @@ -648,7 +661,7 @@ subroutine lilac_final( ) call ESMF_LogWrite(subname//".........................", ESMF_LOGMSG_INFO) if (mytask == 0) then - print *, "end of Lilac Finalization routine" + write(logunit,*) "end of Lilac Finalization routine" end if ! Finalize ESMF diff --git a/lilac/src/lilac_time.F90 b/lilac/src/lilac_time.F90 index 724925565b..7a38bd57ec 100644 --- a/lilac/src/lilac_time.F90 +++ b/lilac/src/lilac_time.F90 @@ -1,39 +1,39 @@ module lilac_time use ESMF - use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl, r8=>shr_kind_r8 - use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag - use lilac_methods , only : chkerr + use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl, r8=>shr_kind_r8 + use shr_sys_mod , only : shr_sys_abort + use shr_cal_mod , only : shr_cal_ymd2date + use lilac_io , only : lilac_io_write, lilac_io_wopen, lilac_io_enddef + use lilac_io , only : lilac_io_close, lilac_io_date2yyyymmdd, lilac_io_sec2hms + use lilac_methods , only : chkerr + use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr + use netcdf , only : nf90_inq_varid, nf90_get_var, nf90_close implicit none private ! default private - public :: lilac_time_alarmInit ! initialize an alarm + public :: lilac_time_clockinit ! initialize the lilac clock + public :: lilac_time_alarminit ! initialize an alarm + public :: lilac_time_restart_write ! only writes the time info + public :: lilac_time_restart_read ! only reads the time info ! Clock and alarm options character(len=*), private, parameter :: & optNONE = "none" , & optNever = "never" , & optNSteps = "nsteps" , & - optNStep = "nstep" , & optNSeconds = "nseconds" , & - optNSecond = "nsecond" , & optNMinutes = "nminutes" , & - optNMinute = "nminute" , & optNHours = "nhours" , & - optNHour = "nhour" , & optNDays = "ndays" , & - optNDay = "nday" , & optNMonths = "nmonths" , & - optNMonth = "nmonth" , & - optNYears = "nyears" , & - optNYear = "nyear" , & - optMonthly = "monthly" , & - optYearly = "yearly" , & - optIfdays0 = "ifdays0" , & - optGLCCouplingPeriod = "glc_coupling_period" + optNYears = "nyears" ! Module data + character(len=ESMF_MAXSTR) :: caseid + type(ESMF_Calendar) :: lilac_calendar + integer :: mytask integer, parameter :: SecPerDay = 86400 ! Seconds per day character(len=*), parameter :: u_FILE_u = & __FILE__ @@ -42,11 +42,185 @@ module lilac_time contains !=============================================================================== - subroutine lilac_time_alarmInit( clock, alarm, option, & - opt_n, opt_ymd, opt_tod, RefTime, alarmname, rc) + subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep, & + atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & + atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, logunit, & + lilac_clock, rc) - ! !DESCRIPTION: Setup an alarm in a clock - ! Notes: The ringtime sent to AlarmCreate MUST be the next alarm + ! ------------------------------------------------- + ! Initialize the lilac clock + ! ------------------------------------------------- + + ! input/output variables + character(len=*) , intent(in) :: caseid_in + character(len=*) , intent(in) :: starttype + character(len=*) , intent(in) :: atm_calendar + integer , intent(in) :: atm_timestep + integer , intent(in) :: atm_start_year !(yyyy) + integer , intent(in) :: atm_start_mon !(mm) + integer , intent(in) :: atm_start_day + integer , intent(in) :: atm_start_secs + integer , intent(in) :: atm_stop_year !(yyyy) + integer , intent(in) :: atm_stop_mon !(mm) + integer , intent(in) :: atm_stop_day + integer , intent(in) :: atm_stop_secs + integer , intent(in) :: logunit + type(ESMF_Clock) , intent(inout) :: lilac_clock + integer , intent(out) :: rc + + ! local variables + type(ESMF_Alarm) :: lilac_restart_alarm + type(ESMF_Alarm) :: lilac_stop_alarm + type(ESMF_Clock) :: clock + type(ESMF_VM) :: vm + type(ESMF_Time) :: StartTime ! Start time + type(ESMF_Time) :: CurrTime ! Current time + type(ESMF_Time) :: StopTime ! Stop time + type(ESMF_Time) :: Clocktime ! Loop time + type(ESMF_TimeInterval) :: TimeStep ! Clock time-step + integer :: start_ymd ! Start date (YYYYMMDD) + integer :: start_tod ! Start time of day (seconds) + integer :: curr_ymd ! Current ymd (YYYYMMDD) + integer :: curr_tod ! Current tod (seconds) + integer :: stop_n ! Number until stop + integer :: stop_ymd ! Stop date (YYYYMMDD) + integer :: stop_tod ! Stop time-of-day + character(CS) :: stop_option ! Stop option units + character(len=CL) :: restart_file + character(len=CL) :: restart_pfile + integer :: yr, mon, day ! Year, month, day as integers + integer :: unitn ! unit number + integer :: ierr ! Return code + integer :: tmp(2) ! Array for Broadcast + character(len=*), parameter :: subname = '(lilactime_clockInit): ' + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + caseid = trim(caseid_in) + + ! ------------------------------ + ! get my task + ! ------------------------------ + + call ESMF_VMGetCurrent(vm=vm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_VMGet(vm, localPet=mytask, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! ------------------------------ + ! create lilac_calendar + ! ------------------------------ + + if (trim(atm_calendar) == 'NOLEAP') then + lilac_calendar = ESMF_CalendarCreate(name='NOLEAP', calkindflag=ESMF_CALKIND_NOLEAP, rc=rc ) + else if (trim(atm_calendar) == 'GREGORIAN') then + lilac_calendar = ESMF_CalendarCreate(name='GREGORIAN', calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc ) + else + ! TODO: add supported calendars here + end if + + ! ------------------------------ + ! create and initialize lilac_clock + ! ------------------------------ + + call ESMF_TimeIntervalSet(TimeStep, s=atm_timestep, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeSet(StartTime, yy=atm_start_year, mm=atm_start_mon, dd=atm_start_day , s=atm_start_secs, & + calendar=lilac_calendar, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_TimeSet(StopTime , yy=atm_stop_year , mm=atm_stop_mon , dd=atm_stop_day , s=atm_stop_secs , & + calendar=lilac_calendar, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! Create the lilac clock (NOTE: the reference time is set to the start time) + lilac_clock = ESMF_ClockCreate(name='lilac_clock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, & + stopTime=stopTime, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + + ! ------------------------------ + ! For a continue run - obtain current time from the lilac restart file and + ! advance the clock to the current time for a continue run + ! ------------------------------ + + if (starttype == 'continue') then + + ! Read the pointer file to obtain the restart file, read the restart file for curr_ymd and curr_tod + ! and then convert this to an esmf current time (currtime) + if ( len_trim(restart_pfile) == 0 ) then + call ESMF_LogWrite(trim(subname)//' ERROR restart_pfile must be defined', & + ESMF_LOGMSG_INFO, line=__LINE__, file=__FILE__) + rc = ESMF_FAILURE + return + end if + restart_pfile = trim(restart_pfile) + if (mytask == 0) then + call ESMF_LogWrite(trim(subname)//" reading rpointer file = "//trim(restart_pfile), ESMF_LOGMSG_INFO) + open(newunit=unitn, file=restart_pfile, form='FORMATTED', status='old',iostat=ierr) + if (ierr < 0) call shr_sys_abort(trim(subname)//' ERROR rpointer file open returns error') + read(unitn,'(a)', iostat=ierr) restart_file + if (ierr < 0) call shr_sys_abort(trim(subname)//' ERROR rpointer file read returns error') + close(unitn) + call ESMF_LogWrite(trim(subname)//" read driver restart from "//trim(restart_file), ESMF_LOGMSG_INFO) + + ! Read the restart file on mastertask and then broadcast the data + call lilac_time_restart_read(restart_file, curr_ymd, curr_tod, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif + tmp(1) = curr_ymd ; tmp(2) = curr_tod + call ESMF_VMBroadcast(vm, tmp, 4, 0, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + curr_ymd = tmp(1) ; curr_tod = tmp(2) + + ! Determine current time + yr = int(curr_ymd/10000) + mon = int( mod(curr_ymd,10000)/ 100) + day = mod(curr_ymd, 100) + call ESMF_TimeSet( currtime, yy=yr, mm=mon, dd=day, s=curr_tod, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Advance the clock to the current time (in case of a restart) + call ESMF_ClockGet(clock, currTime=clocktime, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do while( clocktime < CurrTime) + call ESMF_ClockAdvance( clock, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_ClockGet( clock, currTime=clocktime, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end do + end if + + ! Write out diagnostic info + if (mytask == 0) then + print *, trim(subname) // "---------------------------------------" + call ESMF_CalendarPrint (lilac_calendar , rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_ClockPrint (lilac_clock, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + print *, trim(subname) // "---------------------------------------" + end if + + ! Add a restart alarm and stop alarm to the clock + ! NTOE: The restart alarm and stop alarm will only go off at the end of the run + ! NOTE: The history alarm will be added in lilac_history_init and can go off multiple times during the run + + lilac_restart_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_restart_alarm', rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing restart alarm') + + lilac_stop_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_stop_alarm', rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing stop alarm') + + end subroutine lilac_time_clockInit + +!=============================================================================== + + subroutine lilac_time_alarmInit( clock, alarm, alarmname, option, opt_n, rc) + + ! Setup an alarm in a clock + ! The ringtime sent to AlarmCreate MUST be the next alarm ! time. If you send an arbitrary but proper ringtime from the ! past and the ring interval, the alarm will always go off on the ! next clock advance and this will cause serious problems. Even @@ -57,22 +231,18 @@ subroutine lilac_time_alarmInit( clock, alarm, option, & ! advance it properly based on the ring interval. ! input/output variables - type(ESMF_Clock) , intent(inout) :: clock ! clock - type(ESMF_Alarm) , intent(inout) :: alarm ! alarm - character(len=*) , intent(in) :: option ! alarm option - integer , optional , intent(in) :: opt_n ! alarm freq - integer , optional , intent(in) :: opt_ymd ! alarm ymd - integer , optional , intent(in) :: opt_tod ! alarm tod (sec) - type(ESMF_Time) , optional , intent(in) :: RefTime ! ref time - character(len=*) , optional , intent(in) :: alarmname ! alarm name - integer , intent(inout) :: rc ! Return code + type(ESMF_Clock) , intent(inout) :: clock ! clock + type(ESMF_Alarm) , intent(inout) :: alarm ! alarm + character(len=*) , intent(in) :: alarmname ! alarm name + character(len=*) , intent(in) :: option ! alarm option + integer , intent(in) :: opt_n ! alarm freq + integer , intent(inout) :: rc ! Return code ! local variables type(ESMF_Calendar) :: cal ! calendar integer :: lymd ! local ymd integer :: ltod ! local tod integer :: cyy,cmm,cdd,csec ! time info - character(len=64) :: lalarmname ! local alarm name logical :: update_nextalarm ! update next alarm type(ESMF_Time) :: CurrTime ! Current Time type(ESMF_Time) :: NextAlarm ! Next restart alarm time @@ -83,13 +253,6 @@ subroutine lilac_time_alarmInit( clock, alarm, option, & rc = ESMF_SUCCESS - lalarmname = 'alarm_unknown' - if (present(alarmname)) lalarmname = trim(alarmname) - ltod = 0 - if (present(opt_tod)) ltod = opt_tod - lymd = -1 - if (present(opt_ymd)) lymd = opt_ymd - call ESMF_ClockGet(clock, CurrTime=CurrTime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -97,333 +260,214 @@ subroutine lilac_time_alarmInit( clock, alarm, option, & if (ChkErr(rc,__LINE__,u_FILE_u)) return ! initial guess of next alarm, this will be updated below - if (present(RefTime)) then - NextAlarm = RefTime - else - NextAlarm = CurrTime - endif + NextAlarm = CurrTime ! Get calendar from clock call ESMF_ClockGet(clock, calendar=cal) ! Determine inputs for call to create alarm - selectcase (trim(option)) + if (trim(option) == optNone .or. trim(option) == optNever) then - case (optNONE) call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return update_nextalarm = .false. - case (optNever) - call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .false. + else if ( trim(option) == optNSteps .or. trim(option) == optNSeconds .or. & + trim(option) == optNMinutes .or. trim(option) == optNHours .or. trim(option) == optNDays) then - case (optIfdays0) - if (.not. present(opt_ymd)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_ymd', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=opt_n, s=0, calendar=cal, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .true. + write(6,*)'DEBUG: hist_option, hist_n= ',trim(option), opt_n - case (optNSteps) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return AlarmInterval = AlarmInterval * opt_n update_nextalarm = .true. - case (optNStep) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + else - case (optNSeconds) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + call ESMF_LogWrite(subname//'unknown option '//trim(option), ESMF_LOGMSG_INFO) + rc = ESMF_FAILURE + return - case (optNSecond) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + end if - case (optNMinutes) - call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + ! ------------------------------------------------- + ! AlarmInterval and NextAlarm should be set + ! ------------------------------------------------- - case (optNMinute) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + ! advance Next Alarm so it won't ring on first timestep for + ! most options above. go back one alarminterval just to be careful - case (optNHours) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + if (update_nextalarm) then + NextAlarm = NextAlarm - AlarmInterval + do while (NextAlarm <= CurrTime) + NextAlarm = NextAlarm + AlarmInterval + enddo + endif - case (optNHour) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + alarm = ESMF_AlarmCreate( name=alarmname, clock=clock, ringTime=NextAlarm, & + ringInterval=AlarmInterval, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - case (optNDays) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + end subroutine lilac_time_alarmInit - case (optNDay) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. +!=============================================================================== - case (optNMonths) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + subroutine lilac_time_restart_write(clock, rc) - case (optNMonth) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + ! ------------------------------------------------- + ! Write lilac restart time info + ! ------------------------------------------------- - case (optMonthly) - call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=cyy, mm=cmm, dd=1, s=0, calendar=cal, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .true. + ! Input/output variables + type(ESMF_Clock) :: clock + integer, intent(out) :: rc - case (optNYears) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + ! local variables + type(ESMF_VM) :: vm + type(ESMF_Time) :: currtime, starttime, nexttime + type(ESMF_TimeInterval) :: timediff ! Used to calculate curr_time + type(ESMF_Calendar) :: calendar + character(len=64) :: currtimestr, nexttimestr + integer :: i,j,m,n,n1,ncnt + integer :: curr_ymd ! Current date YYYYMMDD + integer :: curr_tod ! Current time-of-day (s) + integer :: start_ymd ! Starting date YYYYMMDD + integer :: start_tod ! Starting time-of-day (s) + integer :: next_ymd ! Starting date YYYYMMDD + integer :: next_tod ! Starting time-of-day (s) + integer :: nx,ny ! global grid size + integer :: yr,mon,day,sec ! time units + real(R8) :: dayssince ! Time interval since reference time + integer :: unitn ! unit number + character(ESMF_MAXSTR) :: time_units ! units of time variable + character(ESMF_MAXSTR) :: restart_file ! Local path to restart filename + character(ESMF_MAXSTR) :: restart_pfile ! Local path to restart pointer filename + character(ESMF_MAXSTR) :: freq_option ! freq_option setting (ndays, nsteps, etc) + integer :: freq_n ! freq_n setting relative to freq_option + real(R8) :: tbnds(2) ! CF1.0 time bounds + logical :: whead,wdata ! for writing restart/restart cdf files + character(len=*), parameter :: subname='(lilac_time_phases_restart_write)' + !--------------------------------------- - case (optNYear) - if (.not.present(opt_n)) then - call ESMF_LogWrite(subname//trim(option)//' requires opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - if (opt_n <= 0) then - call ESMF_LogWrite(subname//trim(option)//' invalid opt_n', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - AlarmInterval = AlarmInterval * opt_n - update_nextalarm = .true. + rc = ESMF_SUCCESS - case (optYearly) - call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=cyy, mm=1, dd=1, s=0, calendar=cal, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - update_nextalarm = .true. + call ESMF_VMGetCurrent(vm=vm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return - case default - call ESMF_LogWrite(subname//'unknown option '//trim(option), ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return + call ESMF_ClockGet(clock, currtime=currtime, starttime=starttime, calendar=calendar, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - end select + call ESMF_ClockGetNextTime(clock, nextTime=nexttime, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! -------------------------------------------------------------------------------- - ! --- AlarmInterval and NextAlarm should be set --- - ! -------------------------------------------------------------------------------- + call ESMF_TimeGet(currtime, yy=yr, mm=mon, dd=day, s=sec, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(currtimestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',sec + call ESMF_LogWrite(trim(subname)//": currtime = "//trim(currtimestr), ESMF_LOGMSG_INFO, rc=rc) - ! --- advance Next Alarm so it won't ring on first timestep for - ! --- most options above. go back one alarminterval just to be careful + call ESMF_TimeGet(nexttime,yy=yr, mm=mon, dd=day, s=sec, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + write(nexttimestr,'(i4.4,a,i2.2,a,i2.2,a,i5.5)') yr,'-',mon,'-',day,'-',sec + call ESMF_LogWrite(trim(subname)//": nexttime = "//trim(nexttimestr), ESMF_LOGMSG_INFO, rc=rc) - if (update_nextalarm) then - NextAlarm = NextAlarm - AlarmInterval - do while (NextAlarm <= CurrTime) - NextAlarm = NextAlarm + AlarmInterval - enddo - endif + timediff = nexttime - starttime + call ESMF_TimeIntervalGet(timediff, d=day, s=sec, rc=rc) + dayssince = day + sec/real(SecPerDay,R8) - alarm = ESMF_AlarmCreate( name=lalarmname, clock=clock, ringTime=NextAlarm, & - ringInterval=AlarmInterval, rc=rc) + call ESMF_TimeGet(starttime, yy=yr, mm=mon, dd=day, s=sec, rc=rc) + call shr_cal_ymd2date(yr,mon,day,start_ymd) + start_tod = sec + time_units = 'days since '//trim(lilac_io_date2yyyymmdd(start_ymd))//' '//lilac_io_sec2hms(start_tod, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end subroutine lilac_time_alarmInit + call ESMF_TimeGet(nexttime, yy=yr, mm=mon, dd=day, s=sec, rc=rc) + call shr_cal_ymd2date(yr,mon,day,next_ymd) + next_tod = sec + + call ESMF_TimeGet(currtime, yy=yr, mm=mon, dd=day, s=sec, rc=rc) + call shr_cal_ymd2date(yr,mon,day,curr_ymd) + curr_tod = sec + + !--------------------------------------- + ! Write restart file + ! Use nexttimestr rather than currtimestr here since that is the time at the end of + ! the timestep and is preferred for restart file names + !--------------------------------------- + + write(restart_file,"(5a)") trim(caseid),'.lilac','.r.', trim(nexttimestr),'.nc' + + if (mytask == 0) then + open(newunit=unitn, file="rpointer.lilac", form='FORMATTED') + write(unitn,'(a)') trim(restart_file) + close(unitn) + call ESMF_LogWrite(trim(subname)//" wrote lilac restart pointer file rpointer.lilac", ESMF_LOGMSG_INFO) + endif + + call ESMF_LogWrite(trim(subname)//": write "//trim(restart_file), ESMF_LOGMSG_INFO) + call lilac_io_wopen(restart_file, vm, mytask, clobber=.true.) + + do m = 1,2 + if (m == 1) then + whead = .true. + wdata = .false. + else if (m == 2) then + whead = .false. + wdata = .true. + endif + if (wdata) then + call lilac_io_enddef(restart_file) + end if + + tbnds = dayssince + call ESMF_LogWrite(trim(subname)//": time "//trim(time_units), ESMF_LOGMSG_INFO) + if (tbnds(1) >= tbnds(2)) then + call lilac_io_write(restart_file, iam=mytask, & + time_units=time_units, calendar=calendar, time_val=dayssince, & + whead=whead, wdata=wdata, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call lilac_io_write(restart_file, iam=mytask, & + time_units=time_units, calendar=calendar, time_val=dayssince, & + whead=whead, wdata=wdata, tbnds=tbnds, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif + + ! Write out next ymd/tod in place of curr ymd/tod because + ! the currently the restart represents the time at end of + ! the current timestep and that is where we want to start the next run. + + call lilac_io_write(restart_file, mytask, start_ymd, 'start_ymd', whead=whead, wdata=wdata, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call lilac_io_write(restart_file, mytask, start_tod, 'start_tod', whead=whead, wdata=wdata, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call lilac_io_write(restart_file, mytask, next_ymd , 'curr_ymd' , whead=whead, wdata=wdata, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call lilac_io_write(restart_file, mytask, next_tod , 'curr_tod' , whead=whead, wdata=wdata, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call lilac_io_close(restart_file, mytask, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end do + + end subroutine lilac_time_restart_write !=============================================================================== - subroutine lilac_time_read_restart(restart_file, & - start_ymd, start_tod, ref_ymd, ref_tod, curr_ymd, curr_tod, rc) + subroutine lilac_time_restart_read(restart_file, curr_ymd, curr_tod, rc) - use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr - use netcdf , only : nf90_inq_varid, nf90_get_var, nf90_close - use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO + ! ------------------------------------------------- + ! Read the restart time info needed to initialize the clock + ! ------------------------------------------------- ! input/output variables character(len=*), intent(in) :: restart_file - integer, intent(out) :: ref_ymd ! Reference date (YYYYMMDD) - integer, intent(out) :: ref_tod ! Reference time of day (seconds) - integer, intent(out) :: start_ymd ! Start date (YYYYMMDD) - integer, intent(out) :: start_tod ! Start time of day (seconds) integer, intent(out) :: curr_ymd ! Current ymd (YYYYMMDD) integer, intent(out) :: curr_tod ! Current tod (seconds) integer, intent(out) :: rc @@ -431,111 +475,28 @@ subroutine lilac_time_read_restart(restart_file, & ! local variables integer :: status, ncid, varid ! netcdf stuff character(CL) :: tmpstr ! temporary - character(len=*), parameter :: subname = "(lilac_time_read_restart)" + character(len=*), parameter :: subname = "(lilac_time_restart_read)" !---------------------------------------------------------------- ! use netcdf here since it's serial status = nf90_open(restart_file, NF90_NOWRITE, ncid) - if (status /= nf90_NoErr) then - print *,__FILE__,__LINE__,trim(restart_file) - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_open', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - endif - status = nf90_inq_varid(ncid, 'start_ymd', varid) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid start_ymd', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - status = nf90_get_var(ncid, varid, start_ymd) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var start_ymd', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - status = nf90_inq_varid(ncid, 'start_tod', varid) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid start_tod', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - status = nf90_get_var(ncid, varid, start_tod) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var start_tod', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - status = nf90_inq_varid(ncid, 'ref_ymd', varid) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid ref_ymd', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - status = nf90_get_var(ncid, varid, ref_ymd) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var ref_ymd', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - status = nf90_inq_varid(ncid, 'ref_tod', varid) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid ref_tod', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if - status = nf90_get_var(ncid, varid, ref_tod) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var ref_tod', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_open') status = nf90_inq_varid(ncid, 'curr_ymd', varid) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid curr_ymd', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + if (status /= nf90_NoErr) call shr_sys_abort('ERROR: nf90_inq_varid curr_ymd') status = nf90_get_var(ncid, varid, curr_ymd) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var curr_ymd', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_get_var curr_ymd') status = nf90_inq_varid(ncid, 'curr_tod', varid) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid curr_tod', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_inq_varid curr_tod') status = nf90_get_var(ncid, varid, curr_tod) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var curr_tod', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_get_var curr_tod') status = nf90_close(ncid) - if (status /= nf90_NoErr) then - call ESMF_LogWrite(trim(subname)//' ERROR: nf90_close', ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_close') - write(tmpstr,*) trim(subname)//" read start_ymd = ",start_ymd - call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) - write(tmpstr,*) trim(subname)//" read start_tod = ",start_tod - call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) - write(tmpstr,*) trim(subname)//" read ref_ymd = ",ref_ymd - call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) - write(tmpstr,*) trim(subname)//" read ref_tod = ",ref_tod - call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) write(tmpstr,*) trim(subname)//" read curr_ymd = ",curr_ymd call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) write(tmpstr,*) trim(subname)//" read curr_tod = ",curr_tod call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) - end subroutine lilac_time_read_restart + end subroutine lilac_time_restart_read end module lilac_time - - From 9133c7ed4d16260cb6968ae3842cddb5ee833ead Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 8 Dec 2019 20:03:51 -0700 Subject: [PATCH 0489/1973] validated restart capability - but there are still roundoff level differences on restart for the aerosol deposition fields --- lilac/atm_driver/atm_driver.F90 | 7 +- lilac/atm_driver/atm_driver_in | 10 +-- lilac/atm_driver/lilac_in | 3 +- lilac/src/lilac_atmaero.F90 | 12 +-- lilac/src/lilac_history.F90 | 5 +- lilac/src/lilac_mod.F90 | 45 ++++++++--- lilac/src/lilac_time.F90 | 137 ++++++++++++++++++++------------ src/cpl/lilac/lnd_comp_esmf.F90 | 52 ++++++------ 8 files changed, 161 insertions(+), 110 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 1b5d82bd86..fca1852f78 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -52,12 +52,13 @@ program atm_driver integer :: atm_stop_secs integer :: atm_timestep_start ! for internal time loop only integer :: atm_timestep_stop ! for internal time loop only + character(len=32) :: atm_starttype namelist /atm_driver_input/ atm_mesh_file, atm_global_nx, atm_global_ny, & atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, & - atm_timestep_start, atm_timestep_stop + atm_timestep_start, atm_timestep_stop, atm_starttype !------------------------------------------------------------------------ !----------------------------------------------------------------------------- @@ -152,12 +153,12 @@ program atm_driver !------------------------------------------------------------------------ if (mytask == 0 ) then - print *, " initializing lilac " + print *, " initializing lilac with start type ",trim(atm_starttype) end if call lilac_init(comp_comm, atm_global_index, atm_lons, atm_lats, & atm_global_nx, atm_global_ny, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) + atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, atm_starttype) !------------------------------------------------------------------------ ! Run lilac diff --git a/lilac/atm_driver/atm_driver_in b/lilac/atm_driver/atm_driver_in index 4d88e0b9b1..89f832df21 100644 --- a/lilac/atm_driver/atm_driver_in +++ b/lilac/atm_driver/atm_driver_in @@ -6,13 +6,13 @@ atm_start_mon = 1 atm_start_day = 1 atm_start_secs = 0 + atm_timestep = 1800 + atm_calendar = 'NOLEAP' + atm_starttype = 'startup' atm_stop_year = 2000 atm_stop_mon = 1 - atm_stop_day = 2 + atm_stop_day = 3 atm_stop_secs = 0 - atm_timestep = 1800 - atm_calendar = 'NOLEAP' atm_timestep_start = 1 - atm_timestep_stop = 48 - + atm_timestep_stop = 96 / diff --git a/lilac/atm_driver/lilac_in b/lilac/atm_driver/lilac_in index 25c69a8abd..0849c35816 100644 --- a/lilac/atm_driver/lilac_in +++ b/lilac/atm_driver/lilac_in @@ -1,8 +1,7 @@ &lilac_run_input - starttype = 'startup' caseid = 'test_lilac' / -&lilac_io_input +&lilac_history_input lilac_histfreq_option = 'nsteps' lilac_histfreq_n = 4 / diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 index 6472d0a01e..4008c9b942 100644 --- a/lilac/src/lilac_atmaero.F90 +++ b/lilac/src/lilac_atmaero.F90 @@ -48,14 +48,14 @@ module lilac_atmaero contains !============================================================================== - subroutine lilac_atmaero_init(atm2lnd_a_state, rc) + subroutine lilac_atmaero_init(atm2cpl_state, rc) ! ---------------------------------------- ! Initialize data stream information. ! ---------------------------------------- ! input/output variables - type(ESMF_State) , intent(inout) :: atm2lnd_a_state + type(ESMF_State) , intent(inout) :: atm2cpl_state integer , intent(out) :: rc ! local variables @@ -161,7 +161,7 @@ subroutine lilac_atmaero_init(atm2lnd_a_state, rc) ! obtain mesh lats, lons and areas ! ------------------------------ - call ESMF_StateGet(atm2lnd_a_state, 'a2c_fb', lfieldbundle, rc=rc) + call ESMF_StateGet(atm2cpl_state, 'a2c_fb', lfieldbundle, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call lilac_methods_FB_getFieldN(lfieldbundle, fieldnum=1, field=lfield, rc=rc) @@ -245,10 +245,10 @@ end subroutine lilac_atmaero_init !================================================================ - subroutine lilac_atmaero_interp(atm2lnd_a_state, clock, rc) + subroutine lilac_atmaero_interp(atm2cpl_state, clock, rc) ! input/output variables - type(ESMF_State) :: atm2lnd_a_state + type(ESMF_State) :: atm2cpl_state type(ESMF_Clock) :: clock integer, intent(out) :: rc @@ -282,7 +282,7 @@ subroutine lilac_atmaero_interp(atm2lnd_a_state, clock, rc) call shr_strdata_advance(sdat, curr_ymd, sec, mpicom, 'atmaero') ! set field bundle data - call ESMF_StateGet(atm2lnd_a_state, "a2c_fb", lfieldbundle, rc=rc) + call ESMF_StateGet(atm2cpl_state, "a2c_fb", lfieldbundle, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call set_fieldbundle_data('Faxa_bcphidry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/lilac/src/lilac_history.F90 b/lilac/src/lilac_history.F90 index 58da52d614..d6215b2cb1 100644 --- a/lilac/src/lilac_history.F90 +++ b/lilac/src/lilac_history.F90 @@ -56,20 +56,19 @@ subroutine lilac_history_init(clock, caseid, rc) character(len=*), parameter :: subname='(lilac_history_init)' !--------------------------------------- - namelist /lilac_io_input/ lilac_histfreq_n, lilac_histfreq_option + namelist /lilac_history_input/ lilac_histfreq_n, lilac_histfreq_option rc = ESMF_SUCCESS ! read in history file output frequencies open(newunit=fileunit, status="old", file="lilac_in") - read(fileunit, lilac_io_input, iostat=ierr) + read(fileunit, lilac_history_input, iostat=ierr) if (ierr > 0) then call shr_sys_abort(trim(subname) // 'error reading in lilac_io_input') end if close(fileunit) write(histfile_prefix,"(2a)") trim(caseid),'.lilac.hi.' - write(6,*)'DEBUG: histfile_prefix = ',histfile_prefix !--------------------------------------- ! Get the clock info diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 9e56c25dc8..0a5dd3c2c3 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -82,7 +82,7 @@ module lilac_mod subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & atm_global_nx, atm_global_ny, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs) + atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, starttype_in) ! -------------------------------------------------------------------------------- ! This is called by the host atmosphere @@ -105,6 +105,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & integer , intent(in) :: atm_stop_mon !(mm) integer , intent(in) :: atm_stop_day integer , intent(in) :: atm_stop_secs + character(len=*) , intent(in) :: starttype_in ! local variables character(ESMF_MAXSTR) :: caseid @@ -135,11 +136,16 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & logical :: comp_iamin(1) = (/.true./) ! for pio init2 !------------------------------------------------------------------------ - namelist /lilac_run_input/ caseid, starttype + namelist /lilac_run_input/ caseid ! Initialize return code rc = ESMF_SUCCESS + !------------------------------------------------------------------------- + ! Set module variable starttype + !------------------------------------------------------------------------- + starttype = starttype_in + !------------------------------------------------------------------------- ! Initialize pio with first initialization ! AFTER call to MPI_init (which is in the host atm driver) and @@ -334,35 +340,44 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & ! between components. (these are module variables) ! ------------------------------------------------------------------------- - ! Initialze lilac_atm gridded component + ! Create import and export states for atm_gcomp atm2cpl_state = ESMF_StateCreate(name='state_from_atm', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return cpl2atm_state = ESMF_StateCreate(name='state_to_atm', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + ! Initialze lilac_atm gridded component call ESMF_GridCompInitialize(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing atmcap") call ESMF_LogWrite(subname//"lilac_atm gridded component initialized", ESMF_LOGMSG_INFO) - ! Initialze CTSM Gridded Component + ! Create import and export states for lnd_gcomp (i.e. CTSM) cpl2lnd_state = ESMF_StateCreate(name='state_to_land', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return lnd2cpl_state = ESMF_StateCreate(name='state_fr_land', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + ! Add caseid and starttype as attributes of cpl2lnd_state + call ESMF_AttributeSet(cpl2lnd_state, name="caseid", value=trim(caseid), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_AttributeSet(cpl2lnd_state, name="starttype", value=trim(starttype), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Initialze CTSM Gridded Component call ESMF_GridCompInitialize(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing ctsm") call ESMF_LogWrite(subname//"CTSM gridded component initialized", ESMF_LOGMSG_INFO) if (couple_to_river) then - ! Initialize MOSART Gridded Component + ! Create import and export states for rof_gcomp (i.e. MOSART) cpl2rof_state = ESMF_StateCreate(name='state_to_river', stateintent=ESMF_STATEINTENT_EXPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return rof2cpl_state = ESMF_StateCreate(name='state_fr_river', stateintent=ESMF_STATEINTENT_IMPORT, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + ! Initialize MOSART Gridded Component call ESMF_GridCompInitialize(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & clock=lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing mosart") @@ -458,10 +473,17 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! Set the clock restart alarm if restart_alarm_ringing is true if (restart_alarm_is_ringing) then + ! Turn on lilac restart alarm (this will be needed by ctsm) call ESMF_ClockGetAlarm(lilac_clock, 'lilac_restart_alarm', lilac_restart_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_restart_alarm") call ESMF_AlarmRingerOn(lilac_restart_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") + call ESMF_LogWrite(subname//"lilac restart alarm is ringing", ESMF_LOGMSG_INFO) + if (ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("Error in querying lilac restart alarm ring") + + ! Write out lilac restart output if lilac_restart_alarm is ringing + call lilac_time_restart_write(lilac_clock, rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in restart write") end if ! Set the clock stop alarm if stop_alarm_ringing is true @@ -470,6 +492,7 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_restart_alarm") call ESMF_AlarmRingerOn(lilac_stop_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") + call ESMF_LogWrite(subname//"lilac stop alarm is ringing", ESMF_LOGMSG_INFO) end if ! Run lilac atmcap - update the cpl2atm_state @@ -538,9 +561,9 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) call ESMF_ClockGetAlarm(lilac_clock, 'lilac_history_alarm', lilac_history_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_history_alarm") if (ESMF_AlarmIsRinging(lilac_history_alarm, rc=rc)) then - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("Error in querying lilac history alarm ring") call ESMF_AlarmRingerOff( lilac_history_alarm, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("Error in turning ringer off in lilac history alarm") if (couple_to_river) then call lilac_history_write(atm2cpl_state, cpl2atm_state, lnd2cpl_state, cpl2lnd_state, & rof2cpl_state=rof2cpl_state, cpl2rof_state=cpl2rof_state, clock=lilac_clock, rc=rc) @@ -552,13 +575,11 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) end if end if - ! Write out lilac restart output if lilac_restart_alarm is ringing - if (ESMF_AlarmIsRinging(lilac_restart_alarm, rc=rc)) then - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (restart_alarm_is_ringing) then + call ESMF_ClockGetAlarm(lilac_clock, 'lilac_restart_alarm', lilac_restart_alarm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_restart_alarm") call ESMF_AlarmRingerOff( lilac_restart_alarm, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_time_restart_write(lilac_clock, rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in restart write") end if ! Advance the lilac clock at the end of the time step diff --git a/lilac/src/lilac_time.F90 b/lilac/src/lilac_time.F90 index 7a38bd57ec..748d0e69b6 100644 --- a/lilac/src/lilac_time.F90 +++ b/lilac/src/lilac_time.F90 @@ -78,6 +78,7 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep type(ESMF_Time) :: StopTime ! Stop time type(ESMF_Time) :: Clocktime ! Loop time type(ESMF_TimeInterval) :: TimeStep ! Clock time-step + type(ESMF_TimeInterval) :: TimeStep_advance integer :: start_ymd ! Start date (YYYYMMDD) integer :: start_tod ! Start time of day (seconds) integer :: curr_ymd ! Current ymd (YYYYMMDD) @@ -88,7 +89,7 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep character(CS) :: stop_option ! Stop option units character(len=CL) :: restart_file character(len=CL) :: restart_pfile - integer :: yr, mon, day ! Year, month, day as integers + integer :: yr, mon, day, secs ! Year, month, day, seconds as integers integer :: unitn ! unit number integer :: ierr ! Return code integer :: tmp(2) ! Array for Broadcast @@ -140,7 +141,6 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep stopTime=stopTime, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! ------------------------------ ! For a continue run - obtain current time from the lilac restart file and ! advance the clock to the current time for a continue run @@ -150,14 +150,8 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep ! Read the pointer file to obtain the restart file, read the restart file for curr_ymd and curr_tod ! and then convert this to an esmf current time (currtime) - if ( len_trim(restart_pfile) == 0 ) then - call ESMF_LogWrite(trim(subname)//' ERROR restart_pfile must be defined', & - ESMF_LOGMSG_INFO, line=__LINE__, file=__FILE__) - rc = ESMF_FAILURE - return - end if - restart_pfile = trim(restart_pfile) if (mytask == 0) then + restart_pfile = 'rpointer.lilac' call ESMF_LogWrite(trim(subname)//" reading rpointer file = "//trim(restart_pfile), ESMF_LOGMSG_INFO) open(newunit=unitn, file=restart_pfile, form='FORMATTED', status='old',iostat=ierr) if (ierr < 0) call shr_sys_abort(trim(subname)//' ERROR rpointer file open returns error') @@ -167,10 +161,10 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep call ESMF_LogWrite(trim(subname)//" read driver restart from "//trim(restart_file), ESMF_LOGMSG_INFO) ! Read the restart file on mastertask and then broadcast the data - call lilac_time_restart_read(restart_file, curr_ymd, curr_tod, rc) + call lilac_time_restart_read(restart_file, start_ymd, start_tod, curr_ymd, curr_tod, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + tmp(1) = curr_ymd ; tmp(2) = curr_tod endif - tmp(1) = curr_ymd ; tmp(2) = curr_tod call ESMF_VMBroadcast(vm, tmp, 4, 0, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return curr_ymd = tmp(1) ; curr_tod = tmp(2) @@ -182,15 +176,44 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep call ESMF_TimeSet( currtime, yy=yr, mm=mon, dd=day, s=curr_tod, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Advance the clock to the current time (in case of a restart) - call ESMF_ClockGet(clock, currTime=clocktime, rc=rc ) + ! Determine the current time from the lilac clock + call ESMF_ClockGet(lilac_clock, currtime=clocktime, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - do while( clocktime < CurrTime) - call ESMF_ClockAdvance( clock, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_ClockGet( clock, currTime=clocktime, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do + + ! Compute the time step difference from the current time from the restart file to the current lilac clock time + ! (which is really just the start time) + + TimeStep_advance = currtime - clocktime + call ESMF_TimeIntervalGet(timestep_advance, s=secs, rc=rc) + if (mytask == 0) write(6,*)'DEBUG: time step advance is ',secs + + ! Advance the clock to the current time (in case of a restart) + call ESMF_ClockAdvance (lilac_clock, timestep=timestep_advance, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing restart alarm') + + ! call ESMF_TimeGet(currtime, yy=cyr, mm=cmon, dd=cday, s=csecs, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! do while( clocktime < currtime) + ! call ESMF_ClockAdvance( lilac_clock, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call ESMF_ClockGet( lilac_clock, currTime=clocktime, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! !DEBUG + ! call ESMF_TimeGet(currtime, yy=cyr, mm=cmon, dd=cday, s=csecs, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! if (mytask == 0) write(6,*)'DEBUG: currtime yy,mm,dd,sec= ',cyr, cmon, cday, csecs + + ! call ESMF_TimeGet(clocktime, yy=yr, mm=mon, dd=day, s=secs, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! if (mytask == 0) write(6,*)'DEBUG: clocktime yy,mm,dd,sec= ',yr, mon, day, secs + + ! if (clocktime < currtime) then + ! if (mytask == 0) write(6,*)'DEBUG: clock time is less than current time' + ! end if + ! !DEBUG + ! end do + end if ! Write out diagnostic info @@ -277,8 +300,6 @@ subroutine lilac_time_alarmInit( clock, alarm, alarmname, option, opt_n, rc) else if ( trim(option) == optNSteps .or. trim(option) == optNSeconds .or. & trim(option) == optNMinutes .or. trim(option) == optNHours .or. trim(option) == optNDays) then - write(6,*)'DEBUG: hist_option, hist_n= ',trim(option), opt_n - if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -310,6 +331,7 @@ subroutine lilac_time_alarmInit( clock, alarm, alarmname, option, opt_n, rc) alarm = ESMF_AlarmCreate( name=alarmname, clock=clock, ringTime=NextAlarm, & ringInterval=AlarmInterval, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(subname//'created lilac alarm '//trim(alarmname), ESMF_LOGMSG_INFO) end subroutine lilac_time_alarmInit @@ -347,8 +369,8 @@ subroutine lilac_time_restart_write(clock, rc) character(ESMF_MAXSTR) :: restart_pfile ! Local path to restart pointer filename character(ESMF_MAXSTR) :: freq_option ! freq_option setting (ndays, nsteps, etc) integer :: freq_n ! freq_n setting relative to freq_option - real(R8) :: tbnds(2) ! CF1.0 time bounds - logical :: whead,wdata ! for writing restart/restart cdf files + logical :: write_header ! true => write netcdf header + logical :: write_data ! true => write netcdf data character(len=*), parameter :: subname='(lilac_time_phases_restart_write)' !--------------------------------------- @@ -398,6 +420,7 @@ subroutine lilac_time_restart_write(clock, rc) !--------------------------------------- write(restart_file,"(5a)") trim(caseid),'.lilac','.r.', trim(nexttimestr),'.nc' + call ESMF_LogWrite(subname//"lilac restart file is "//trim(restart_file), ESMF_LOGMSG_INFO) if (mytask == 0) then open(newunit=unitn, file="rpointer.lilac", form='FORMATTED') @@ -406,61 +429,50 @@ subroutine lilac_time_restart_write(clock, rc) call ESMF_LogWrite(trim(subname)//" wrote lilac restart pointer file rpointer.lilac", ESMF_LOGMSG_INFO) endif - call ESMF_LogWrite(trim(subname)//": write "//trim(restart_file), ESMF_LOGMSG_INFO) + call ESMF_LogWrite(trim(subname)//": writing "//trim(restart_file), ESMF_LOGMSG_INFO) call lilac_io_wopen(restart_file, vm, mytask, clobber=.true.) do m = 1,2 if (m == 1) then - whead = .true. - wdata = .false. - else if (m == 2) then - whead = .false. - wdata = .true. + write_header = .true. ; write_data = .false. + else + write_header = .false. ; write_data = .true. endif - if (wdata) then + + if (write_data) then call lilac_io_enddef(restart_file) end if - tbnds = dayssince call ESMF_LogWrite(trim(subname)//": time "//trim(time_units), ESMF_LOGMSG_INFO) - if (tbnds(1) >= tbnds(2)) then - call lilac_io_write(restart_file, iam=mytask, & - time_units=time_units, calendar=calendar, time_val=dayssince, & - whead=whead, wdata=wdata, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call lilac_io_write(restart_file, iam=mytask, & - time_units=time_units, calendar=calendar, time_val=dayssince, & - whead=whead, wdata=wdata, tbnds=tbnds, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - endif + call lilac_io_write(restart_file, iam=mytask, & + time_units=time_units, calendar=calendar, time_val=dayssince, & + whead=write_header, wdata=write_data, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Write out next ymd/tod in place of curr ymd/tod because ! the currently the restart represents the time at end of ! the current timestep and that is where we want to start the next run. - call lilac_io_write(restart_file, mytask, start_ymd, 'start_ymd', whead=whead, wdata=wdata, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call lilac_io_write(restart_file, mytask, start_tod, 'start_tod', whead=whead, wdata=wdata, rc=rc) + call lilac_io_write(restart_file, mytask, next_ymd , 'curr_ymd' , whead=write_header, wdata=write_data, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call lilac_io_write(restart_file, mytask, next_ymd , 'curr_ymd' , whead=whead, wdata=wdata, rc=rc) + call lilac_io_write(restart_file, mytask, next_tod , 'curr_tod' , whead=write_header, wdata=write_data, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lilac_io_write(restart_file, mytask, next_tod , 'curr_tod' , whead=whead, wdata=wdata, rc=rc) + call lilac_io_write(restart_file, mytask, start_ymd , 'start_ymd' , whead=write_header, wdata=write_data, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call lilac_io_close(restart_file, mytask, rc=rc) + call lilac_io_write(restart_file, mytask, start_tod , 'start_tod' , whead=write_header, wdata=write_data, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do + call lilac_io_close(restart_file, mytask, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_LogWrite(trim(subname)//": closing "//trim(restart_file), ESMF_LOGMSG_INFO) + end subroutine lilac_time_restart_write !=============================================================================== - subroutine lilac_time_restart_read(restart_file, curr_ymd, curr_tod, rc) + subroutine lilac_time_restart_read(restart_file, start_ymd, start_tod, curr_ymd, curr_tod, rc) ! ------------------------------------------------- ! Read the restart time info needed to initialize the clock @@ -468,6 +480,8 @@ subroutine lilac_time_restart_read(restart_file, curr_ymd, curr_tod, rc) ! input/output variables character(len=*), intent(in) :: restart_file + integer, intent(out) :: start_ymd ! Current ymd (YYYYMMDD) + integer, intent(out) :: start_tod ! Current tod (seconds) integer, intent(out) :: curr_ymd ! Current ymd (YYYYMMDD) integer, intent(out) :: curr_tod ! Current tod (seconds) integer, intent(out) :: rc @@ -481,6 +495,7 @@ subroutine lilac_time_restart_read(restart_file, curr_ymd, curr_tod, rc) ! use netcdf here since it's serial status = nf90_open(restart_file, NF90_NOWRITE, ncid) if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_open') + status = nf90_inq_varid(ncid, 'curr_ymd', varid) if (status /= nf90_NoErr) call shr_sys_abort('ERROR: nf90_inq_varid curr_ymd') status = nf90_get_var(ncid, varid, curr_ymd) @@ -489,9 +504,25 @@ subroutine lilac_time_restart_read(restart_file, curr_ymd, curr_tod, rc) if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_inq_varid curr_tod') status = nf90_get_var(ncid, varid, curr_tod) if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_get_var curr_tod') + + status = nf90_inq_varid(ncid, 'start_ymd', varid) + if (status /= nf90_NoErr) call shr_sys_abort('ERROR: nf90_inq_varid start_ymd') + status = nf90_get_var(ncid, varid, start_ymd) + if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_get_var start_ymd') + status = nf90_inq_varid(ncid, 'start_tod', varid) + if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_inq_varid start_tod') + status = nf90_get_var(ncid, varid, start_tod) + if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_get_var start_tod') + + status = nf90_close(ncid) if (status /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_close') + write(tmpstr,*) trim(subname)//" read start_ymd = ",start_ymd + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + write(tmpstr,*) trim(subname)//" read start_tod = ",start_tod + call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) + write(tmpstr,*) trim(subname)//" read curr_ymd = ",curr_ymd call ESMF_LogWrite(trim(tmpstr), ESMF_LOGMSG_INFO) write(tmpstr,*) trim(subname)//" read curr_tod = ",curr_tod diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 369c3c8260..92db721b38 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -103,22 +103,23 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) type(ESMF_Clock) :: clock ! ESMF synchronization clock integer, intent(out) :: rc ! Return code - ! local variable + ! local variables integer :: ierr ! error code integer :: n,g,i,j ! indices logical :: exists ! true if file exists - real(r8) :: nextsw_cday ! calday from clock of next radiation computation character(len=CL) :: caseid ! case identifier name - character(len=CL) :: ctitle ! case description title character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) + real(r8) :: nextsw_cday ! calday next radiation computation integer :: nsrest ! clm restart type - logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type - logical :: atm_aero ! Flag if aerosol data sent from atm model integer :: lbnum ! input to memory diagnostic integer :: shrlogunit ! old values for log unit and log level type(bounds_type) :: bounds ! bounds character(len=CL) :: cvalue + ! communicator info + type(ESMF_VM) :: vm + integer :: mpicom_vm + ! generation of field bundles type(ESMF_State) :: importState, exportState type(ESMF_FieldBundle) :: c2l_fb_atm, c2l_fb_rof ! field bundles in import state @@ -159,16 +160,12 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) integer :: orb_iyear ! orbital year for current orbital computation integer :: orb_eccen ! orbital year for current orbital computation - type(ESMF_VM) :: vm - integer :: mpicom_vm - - ! input namelist read for ctsm mesh and run info - namelist /lilac_lnd_input/ lnd_mesh_filename - namelist /lilac_run_input/ caseid, starttype - character(len=*), parameter :: subname=trim(modName)//': (lnd_init) ' !------------------------------------------------------------------------ + ! input namelist read for ctsm mesh + namelist /lilac_lnd_input/ lnd_mesh_filename + rc = ESMF_SUCCESS call ESMF_LogWrite(subname//' is called!', ESMF_LOGMSG_INFO) @@ -191,7 +188,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_LogWrite(subname//"initialized model mpi info using spmd_init", ESMF_LOGMSG_INFO) !------------------------------------------------------------------------ - !--- Log File --- + ! Initialize output log file !------------------------------------------------------------------------ ! TODO: by default iulog = 6 in clm_varctl - this should be generalized so that we @@ -244,13 +241,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (masterproc) then open(newunit=fileunit, status="old", file="lilac_in") - call shr_nl_find_group_name(fileunit, 'lilac_run_input', ierr) - if (ierr == 0) then - read(fileunit, lilac_run_input, iostat=ierr) - if (ierr > 0) then - call shr_sys_abort( 'problem on read of lilac_run_input') - end if - end if call shr_nl_find_group_name(fileunit, 'lilac_lnd_input', ierr) if (ierr == 0) then read(fileunit, lilac_lnd_input, iostat=ierr) @@ -261,8 +251,18 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) close(fileunit) end if call mpi_bcast(lnd_mesh_filename, len(lnd_mesh_filename), MPI_CHARACTER, 0, mpicom, ierr) - call mpi_bcast(starttype, len(starttype), MPI_CHARACTER, 0, mpicom, ierr) - call mpi_bcast(caseid, len(caseid), MPI_CHARACTER, 0, mpicom, ierr) + + !---------------------- + ! Obtain caseid and start type from attributes in import state + !---------------------- + + call ESMF_AttributeGet(import_state, name="caseid", value=caseid, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"caseid is "//trim(caseid), ESMF_LOGMSG_INFO) + + call ESMF_AttributeGet(import_state, name="starttype", value=starttype, rc=rc) + if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) + call ESMF_LogWrite(subname//"starttype is "//trim(starttype), ESMF_LOGMSG_INFO) if (trim(starttype) == trim('startup')) then nsrest = nsrStartup @@ -633,19 +633,19 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! Obtain orbital values !---------------------- - !call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, rc=rc) + !call ESMF_AttributeGet(gcomp, name='orb_eccen', value=cvalue, rc=rc) !if (ChkErr(rc,__LINE__,u_FILE_u)) return !read(cvalue,*) eccen - !call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, rc=rc) + !call ESMF_AttributeGet(gcomp, name='orb_obliqr', value=cvalue, rc=rc) !if (ChkErr(rc,__LINE__,u_FILE_u)) return !read(cvalue,*) obliqr - !call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, rc=rc) + !call ESMF_AttributeGet(gcomp, name='orb_lambm0', value=cvalue, rc=rc) !if (ChkErr(rc,__LINE__,u_FILE_u)) return !read(cvalue,*) lambm0 - !call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, rc=rc) + !call ESMF_AttributeGet(gcomp, name='orb_mvelpp', value=cvalue, rc=rc) !if (ChkErr(rc,__LINE__,u_FILE_u)) return !read(cvalue,*) mvelpp From f9bed6d21668cfa13f93c0ff19a097e461769c1c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 9 Dec 2019 13:00:54 -0700 Subject: [PATCH 0490/1973] simplified atm_driver_in to no longer specify time steps --- lilac/atm_driver/atm_driver.F90 | 25 +++++++++++++++---------- lilac/atm_driver/atm_driver_in | 14 ++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index fca1852f78..8fdeafb6ff 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -32,9 +32,10 @@ program atm_driver integer :: my_start, my_end integer :: i_local, i_global integer :: nlocal, nglobal - integer :: nstep ! time step counter integer :: g,i,k ! indices integer :: fileunit ! for namelist input + integer :: nstep ! time step counter + integer :: atm_nsteps ! number of time steps of the simulation ! Namelist and related variables character(len=512) :: atm_mesh_file @@ -43,22 +44,19 @@ program atm_driver character(len=128) :: atm_calendar integer :: atm_timestep integer :: atm_start_year ! (yyyy) - integer :: atm_start_mon ! (mm) - integer :: atm_start_day - integer :: atm_start_secs integer :: atm_stop_year ! (yyyy) + integer :: atm_start_mon ! (mm) integer :: atm_stop_mon ! (mm) + integer :: atm_start_day integer :: atm_stop_day + integer :: atm_start_secs integer :: atm_stop_secs - integer :: atm_timestep_start ! for internal time loop only - integer :: atm_timestep_stop ! for internal time loop only character(len=32) :: atm_starttype namelist /atm_driver_input/ atm_mesh_file, atm_global_nx, atm_global_ny, & atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, & - atm_timestep_start, atm_timestep_stop, atm_starttype + atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, atm_starttype !------------------------------------------------------------------------ !----------------------------------------------------------------------------- @@ -164,11 +162,18 @@ program atm_driver ! Run lilac !------------------------------------------------------------------------ - do nstep = atm_timestep_start, atm_timestep_stop + if ( atm_stop_year == atm_start_year .and. atm_stop_mon == atm_start_mon .and. & + atm_stop_secs == atm_start_secs) then + atm_nsteps = ((atm_stop_day - atm_start_day) * 86400.) / atm_timestep + else + call shr_sys_abort('not supporting start and stop years,months and secs to be different') + end if + + do nstep = 1,atm_nsteps ! fill in the dataptr values in atm2lnd type in lilac_atmcap call atm_driver_to_lilac (atm_lons, atm_lats) - if (nstep == atm_timestep_stop) then + if (nstep == atm_nsteps) then call lilac_run(restart_alarm_is_ringing=.true., stop_alarm_is_ringing=.true.) else call lilac_run(restart_alarm_is_ringing=.false., stop_alarm_is_ringing=.false.) diff --git a/lilac/atm_driver/atm_driver_in b/lilac/atm_driver/atm_driver_in index 89f832df21..e178f6f471 100644 --- a/lilac/atm_driver/atm_driver_in +++ b/lilac/atm_driver/atm_driver_in @@ -2,17 +2,15 @@ atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' atm_global_nx = 72 atm_global_ny = 46 - atm_start_year = 2000 - atm_start_mon = 1 - atm_start_day = 1 - atm_start_secs = 0 atm_timestep = 1800 atm_calendar = 'NOLEAP' - atm_starttype = 'startup' + atm_start_year = 2000 atm_stop_year = 2000 + atm_start_mon = 1 atm_stop_mon = 1 - atm_stop_day = 3 + atm_start_secs = 0 atm_stop_secs = 0 - atm_timestep_start = 1 - atm_timestep_stop = 96 + atm_start_day = 1 + atm_stop_day = 2 + atm_starttype = 'startup' / From 1b662f8bb73137fd55110107cba36d6571c074ea Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 9 Dec 2019 19:04:33 -0700 Subject: [PATCH 0491/1973] changes to get restart working correctly --- lilac/atm_driver/atm_driver.F90 | 79 +++++++++++++++++++++++++++++---- lilac/atm_driver/atm_driver_in | 2 +- lilac/src/lilac_time.F90 | 23 ---------- 3 files changed, 72 insertions(+), 32 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 8fdeafb6ff..8aaa2985a2 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -16,9 +16,12 @@ program atm_driver ! ESMF lilac_atmcap ESMF CTSM cap ESMF river cap (Mizzouroute, Mosart) !---------------------------------------------------------------------------- + use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close + use netcdf , only : nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_varid, nf90_get_var use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS use lilac_mod , only : lilac_init, lilac_run, lilac_final use lilac_atmcap, only : lilac_atmcap_atm2lnd, lilac_atmcap_lnd2atm + use shr_cal_mod , only : shr_cal_date2ymd use shr_sys_mod , only : shr_sys_abort implicit none @@ -36,6 +39,11 @@ program atm_driver integer :: fileunit ! for namelist input integer :: nstep ! time step counter integer :: atm_nsteps ! number of time steps of the simulation + character(len=512) :: restart_file ! local path to lilac restart filename + integer :: idfile, varid + integer :: atm_restart_ymd + integer :: atm_restart_year, atm_restart_mon + integer :: atm_restart_day, atm_restart_secs ! Namelist and related variables character(len=512) :: atm_mesh_file @@ -162,11 +170,65 @@ program atm_driver ! Run lilac !------------------------------------------------------------------------ - if ( atm_stop_year == atm_start_year .and. atm_stop_mon == atm_start_mon .and. & - atm_stop_secs == atm_start_secs) then - atm_nsteps = ((atm_stop_day - atm_start_day) * 86400.) / atm_timestep - else - call shr_sys_abort('not supporting start and stop years,months and secs to be different') + ! Assume that will always run for N days (no partial days) + + if (atm_starttype == 'startup') then + + if ( atm_stop_year /= atm_start_year) then + call shr_sys_abort('not supporting start and stop years to be different') + else if (atm_stop_mon /= atm_start_mon) then + call shr_sys_abort('not supporting start and stop months to be different') + else if (atm_stop_secs /= 0 .or. atm_start_secs /= 0) then + call shr_sys_abort('not supporting start and stop secs to be nonzero') + else + atm_nsteps = ((atm_stop_day - atm_start_day) * 86400.) / atm_timestep + end if + + else ! continue + + open(newunit=fileunit, file='rpointer.lilac', form='FORMATTED', status='old',iostat=ierr) + if (ierr < 0) call shr_sys_abort('Error opening rpointer.lilac') + read(fileunit,'(a)', iostat=ierr) restart_file + if (ierr < 0) call shr_sys_abort('Error reading rpointer.lilac') + close(fileunit) + if (mytask == 0) then + print *,'lilac restart_file = ',trim(restart_file) + end if + + ierr = nf90_open(restart_file, NF90_NOWRITE, idfile) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_open') + + ierr = nf90_inq_varid(idfile, 'curr_ymd', varid) + if (ierr /= nf90_NoErr) call shr_sys_abort('ERROR: nf90_inq_varid curr_ymd') + ierr = nf90_get_var(idfile, varid, atm_restart_ymd) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_get_var curr_ymd') + + ierr = nf90_inq_varid(idfile, 'curr_tod', varid) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_inq_varid curr_tod') + ierr = nf90_get_var(idfile, varid, atm_restart_secs) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_get_var curr_tod') + + ierr = nf90_close(idfile) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_close') + + if (mytask == 0) then + print *,'restart_ymd = ',atm_restart_ymd + end if + call shr_cal_date2ymd(atm_restart_ymd, atm_restart_year, atm_restart_mon, atm_restart_day) + + if ( atm_stop_year /= atm_restart_year) then + write(6,*)'atm_stop_year = ',atm_stop_year,'atm_restart_year = ',atm_restart_year + call shr_sys_abort('not supporting restart and stop years to be different') + else if (atm_stop_mon /= atm_restart_mon) then + write(6,*)'atm_stop_mon = ',atm_stop_mon,'atm_restart_mon = ',atm_restart_mon + call shr_sys_abort('not supporting restart and stop months to be different') + else if (atm_stop_secs /= 0 .or. atm_restart_secs /= 0) then + write(6,*)'atm_stop_secs = ',atm_stop_secs,'atm_restart_secs = ',atm_restart_secs + call shr_sys_abort('not supporting restart and stop secs to be nonzero') + else + atm_nsteps = ((atm_stop_day - atm_restart_day) * 86400.) / atm_timestep + end if + end if do nstep = 1,atm_nsteps @@ -198,9 +260,6 @@ program atm_driver subroutine read_netcdf_mesh(filename, nglobal) - use netcdf - implicit none - ! input/output variables character(*) , intent(in) :: filename integer , intent(out) :: nglobal @@ -249,6 +308,10 @@ subroutine read_netcdf_mesh(filename, nglobal) ierr = nf90_get_var(idfile, idvar_CenterCoords, centerCoords, start=(/1,1/), count=(/coordDim, nelem/)) call nc_check_err(ierr,"get_var CenterCoords", filename) + ! Close the file + ierr = nf90_close(idfile) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_close') + nglobal = nelem end subroutine read_netcdf_mesh diff --git a/lilac/atm_driver/atm_driver_in b/lilac/atm_driver/atm_driver_in index e178f6f471..09d1037741 100644 --- a/lilac/atm_driver/atm_driver_in +++ b/lilac/atm_driver/atm_driver_in @@ -11,6 +11,6 @@ atm_start_secs = 0 atm_stop_secs = 0 atm_start_day = 1 - atm_stop_day = 2 + atm_stop_day = 3 atm_starttype = 'startup' / diff --git a/lilac/src/lilac_time.F90 b/lilac/src/lilac_time.F90 index 748d0e69b6..dd41284ef2 100644 --- a/lilac/src/lilac_time.F90 +++ b/lilac/src/lilac_time.F90 @@ -191,29 +191,6 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep call ESMF_ClockAdvance (lilac_clock, timestep=timestep_advance, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing restart alarm') - ! call ESMF_TimeGet(currtime, yy=cyr, mm=cmon, dd=cday, s=csecs, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! do while( clocktime < currtime) - ! call ESMF_ClockAdvance( lilac_clock, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call ESMF_ClockGet( lilac_clock, currTime=clocktime, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! !DEBUG - ! call ESMF_TimeGet(currtime, yy=cyr, mm=cmon, dd=cday, s=csecs, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! if (mytask == 0) write(6,*)'DEBUG: currtime yy,mm,dd,sec= ',cyr, cmon, cday, csecs - - ! call ESMF_TimeGet(clocktime, yy=yr, mm=mon, dd=day, s=secs, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! if (mytask == 0) write(6,*)'DEBUG: clocktime yy,mm,dd,sec= ',yr, mon, day, secs - - ! if (clocktime < currtime) then - ! if (mytask == 0) write(6,*)'DEBUG: clock time is less than current time' - ! end if - ! !DEBUG - ! end do - end if ! Write out diagnostic info From 819a3414bb57e0f6cf45d269824b6f24427318b7 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 9 Dec 2019 19:27:51 -0700 Subject: [PATCH 0492/1973] fixed bug in setting default calendar needed for restart --- lilac/src/lilac_time.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lilac/src/lilac_time.F90 b/lilac/src/lilac_time.F90 index dd41284ef2..358fecbb31 100644 --- a/lilac/src/lilac_time.F90 +++ b/lilac/src/lilac_time.F90 @@ -118,8 +118,10 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep else if (trim(atm_calendar) == 'GREGORIAN') then lilac_calendar = ESMF_CalendarCreate(name='GREGORIAN', calkindflag=ESMF_CALKIND_GREGORIAN, rc=rc ) else - ! TODO: add supported calendars here + call shr_sys_abort(trim(subname)//'ERROR: only NOLEAP and GREGORIAN calendars currently supported') end if + call ESMF_CalendarSetDefault(lilac_calendar, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort(trim(subname)//'ERROR: default calendar set error') ! ------------------------------ ! create and initialize lilac_clock @@ -139,7 +141,7 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep ! Create the lilac clock (NOTE: the reference time is set to the start time) lilac_clock = ESMF_ClockCreate(name='lilac_clock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, & stopTime=stopTime, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort(trim(subname)//'error initializing lilac clock') ! ------------------------------ ! For a continue run - obtain current time from the lilac restart file and From 2235b9c1c19029aec61d411ee3fba77b504b9b46 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Dec 2019 12:40:57 -0700 Subject: [PATCH 0493/1973] Remove a few unnecessary things from the lilac atm_driver Makefile --- lilac/atm_driver/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index d17925627c..bc42d6b752 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -7,24 +7,23 @@ # # Note: You must set the environment BLDDIR before running this - e.g. # export BLDDIR=/glade/scratch/sacks/test_lilac_1205a/bld +# +# ESMFMKFILE must also be set in the environment #================================================================================ -ESMFMKFILE = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default/esmf.mk -ESMF_LIB_DIR = /glade/work/turuncu/ESMF/8.0.0b50/lib/libg/Linux.intel.64.mpt.default include $(ESMFMKFILE) SHARED_BLD_DIR = $(BLDDIR)/intel/mpt/debug/nothreads/nuopc CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf DEPENDS_LIB = $(SHARED_BLD_DIR)/lib SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib -SHR_INC = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/csm_share CTSM_INC = $(CTSM_BLD_DIR)/clm/obj FFLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free -LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIB_DIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIB_DIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib +LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIBSDIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIBSDIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib -INCLUDES = -I$(CTSM_BLD_DIR)/include -I$(SHR_INC) -I$(CTSM_INC) +INCLUDES = -I$(CTSM_INC) #================================================================================ # Compiler and linker rules using ESMF_ variables supplied by esmf.mk From 2d5082974bf2e711e7ba88a15562db10d4323a37 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Dec 2019 13:02:50 -0700 Subject: [PATCH 0494/1973] Split parts of Makefile into a ctsm.mk file The point of this is: I'll move to auto-generating this ctsm.mk file; then it can be included in the atmosphere model build. --- lilac/atm_driver/Makefile | 23 ++++++++--------------- lilac/atm_driver/ctsm.mk | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 lilac/atm_driver/ctsm.mk diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index bc42d6b752..41840146cd 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -3,28 +3,21 @@ #================================================================================ #================================================================================ -# Define directory paths -# # Note: You must set the environment BLDDIR before running this - e.g. # export BLDDIR=/glade/scratch/sacks/test_lilac_1205a/bld # # ESMFMKFILE must also be set in the environment #================================================================================ -include $(ESMFMKFILE) +include $(CURDIR)/ctsm.mk -SHARED_BLD_DIR = $(BLDDIR)/intel/mpt/debug/nothreads/nuopc -CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf -DEPENDS_LIB = $(SHARED_BLD_DIR)/lib -SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib -CTSM_INC = $(CTSM_BLD_DIR)/clm/obj +# Most atmosphere model builds shouldn't need this directly, but we use +# it here in order to easily get a f90 compiler and f90 compile opts for +# building atm_driver.o. +include $(ESMFMKFILE) FFLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free -LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L$(ESMF_LIBSDIR) -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,$(ESMF_LIBSDIR) -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -lesmf -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib - -INCLUDES = -I$(CTSM_INC) - #================================================================================ # Compiler and linker rules using ESMF_ variables supplied by esmf.mk #================================================================================ @@ -32,13 +25,13 @@ INCLUDES = -I$(CTSM_INC) .SUFFIXES: .F90 %.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(INCLUDES) $(FFLAGS) $< + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(CTSM_INCLUDES) $(FFLAGS) $< atm_driver.o : $(CURDIR)/atm_driver.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(INCLUDES) $(FFLAGS) $< + $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(CTSM_INCLUDES) $(FFLAGS) $< atm_driver: atm_driver.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) -o $@ $^ $(ESMF_F90ESMFLINKLIBS) $(LIBS) + $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) -o $@ $^ $(CTSM_LIBS) mv atm_driver atm_driver.exe # module dependencies: diff --git a/lilac/atm_driver/ctsm.mk b/lilac/atm_driver/ctsm.mk new file mode 100644 index 0000000000..e344fcfd26 --- /dev/null +++ b/lilac/atm_driver/ctsm.mk @@ -0,0 +1,27 @@ +# ====================================================================== +# Include this file to get makefile variables needed to include / link +# LILAC/CTSM in an atmosphere model's build +# +# Variables of interest are: +# - CTSM_INCLUDES: add this to the compilation line +# - CTSM_LIBS: add this to the link line +# +# Note: You must set the environment BLDDIR before running this - e.g. +# export BLDDIR=/glade/scratch/sacks/test_lilac_1205a/bld +# +# ESMFMKFILE must also be set in the environment +# ====================================================================== + +include $(ESMFMKFILE) + +SHARED_BLD_DIR = $(BLDDIR)/intel/mpt/debug/nothreads/nuopc +CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf +DEPENDS_LIB = $(SHARED_BLD_DIR)/lib +SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib +CTSM_INC = $(CTSM_BLD_DIR)/clm/obj + +LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib + +CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(CTSM_INC) + +CTSM_LIBS = $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(LIBS) From 97d1725131cf797ae23a477df5909c65fb369e06 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Dec 2019 13:41:19 -0700 Subject: [PATCH 0495/1973] Write a ctsm.mk file in the course of building ctsm with LILAC_MODE set We'll use this in place of the current ctsm.mk file to do an atmosphere build (either for atm_driver or a real atmosphere). --- cime_config/buildlib | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/cime_config/buildlib b/cime_config/buildlib index a71e4e5615..b63dc930c8 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -29,6 +29,52 @@ def _get_osvar(key, default): value = default return value +############################################################################### +def _write_ctsm_mk(exeroot): + """Writes a ctsm.mk file in exeroot. + + This file can be included by atmosphere model builds outside of cime. + + NOTE: This currently has some hard-coded settings for cheyenne. Also, it assumes that + ESMFMKFILE is set in your environment. + """ + + ctsm_mk_path = os.path.join(exeroot, 'ctsm.mk') + esmfmkfile = os.environ['ESMFMKFILE'] + with open(ctsm_mk_path, 'w') as ctsm_mk: + ctsm_mk.write(""" +# ====================================================================== +# Include this file to get makefile variables needed to include / link +# LILAC/CTSM in an atmosphere model's build +# +# Variables of interest are: +# - CTSM_INCLUDES: add this to the compilation line +# - CTSM_LIBS: add this to the link line +# ====================================================================== + +# ====================================================================== +# The following settings are meant for internal use, and generally +# should not be included directly in an atmosphere model's build. +# ====================================================================== + +include {esmfmkfile} + +SHARED_BLD_DIR = {exeroot}/intel/mpt/debug/nothreads/nuopc +CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf +DEPENDS_LIB = $(SHARED_BLD_DIR)/lib +SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib +CTSM_INC = $(CTSM_BLD_DIR)/clm/obj + +LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib + +# ====================================================================== +# The following settings should be included in an atmosphere model's build. +# ====================================================================== + +CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(CTSM_INC) +CTSM_LIBS = $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(LIBS) +""".format(exeroot=exeroot, esmfmkfile=esmfmkfile)) + ############################################################################### def _main_func(): ############################################################################### @@ -46,6 +92,7 @@ def _main_func(): lilac_mode = _get_osvar('LILAC_MODE', 'off') if lilac_mode == 'on': driver = "lilac" + _write_ctsm_mk(exeroot=case.get_value("EXEROOT")) #------------------------------------------------------- # create Filepath file From 514d7baaff69aea6756ed92dc0fe9aa4c5533965 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Dec 2019 15:03:04 -0700 Subject: [PATCH 0496/1973] Fix ctsm.mk so that share code is included in the include paths This is needed for compilation to work. Note that my last 3 commits (where I was messing with the build) were originally on top of 63beebb3, then I rebased them to be up to date with the lilac_cap branch. When I did this rebase, the build started failing; this fixes it. I thought that we could skip SHR_INC in CTSM_INCLUDES: this include is needed when compiling CTSM source, but I didn't think it would be needed when compiling the atmosphere. However, without that, I get an error when compiling atm_driver.F90: /glade/work/sacks/ctsm_code/current_branch1/lilac/atm_driver/atm_driver.F90(23): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [SHR_KIND_MOD] use lilac_atmcap, only : lilac_atmcap_atm2lnd, lilac_atmcap_lnd2atm ------^ So apparently it needs to be able to find SHR_KIND_MOD due to its indirect use? (There are also errors due to new direct uses of share code from atm_driver.F90, but the surprising thing to me was this apparent need to have indirectly-used modules in the include path.) --- cime_config/buildlib | 3 ++- lilac/atm_driver/ctsm.mk | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index b63dc930c8..53b5a54434 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -63,6 +63,7 @@ SHARED_BLD_DIR = {exeroot}/intel/mpt/debug/nothreads/nuopc CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf DEPENDS_LIB = $(SHARED_BLD_DIR)/lib SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib +SHR_INC = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/csm_share CTSM_INC = $(CTSM_BLD_DIR)/clm/obj LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib @@ -71,7 +72,7 @@ LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lp # The following settings should be included in an atmosphere model's build. # ====================================================================== -CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(CTSM_INC) +CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(SHR_INC) -I$(CTSM_INC) CTSM_LIBS = $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(LIBS) """.format(exeroot=exeroot, esmfmkfile=esmfmkfile)) diff --git a/lilac/atm_driver/ctsm.mk b/lilac/atm_driver/ctsm.mk index e344fcfd26..c094f1b6a0 100644 --- a/lilac/atm_driver/ctsm.mk +++ b/lilac/atm_driver/ctsm.mk @@ -18,10 +18,11 @@ SHARED_BLD_DIR = $(BLDDIR)/intel/mpt/debug/nothreads/nuopc CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf DEPENDS_LIB = $(SHARED_BLD_DIR)/lib SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib +SHR_INC = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/csm_share CTSM_INC = $(CTSM_BLD_DIR)/clm/obj LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib -CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(CTSM_INC) +CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(SHR_INC) -I$(CTSM_INC) CTSM_LIBS = $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(LIBS) From adce16aea1d66d1111b1d5d0a8e98d2e7e7c31ba Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Dec 2019 15:35:11 -0700 Subject: [PATCH 0497/1973] Use the auto-generated ctsm.mk file in the atm_driver build And delete the original one in the source tree --- README.lilac | 42 +++++++++++++++++++++++++++++++++------ lilac/atm_driver/Makefile | 9 +++++---- lilac/atm_driver/ctsm.mk | 28 -------------------------- 3 files changed, 41 insertions(+), 38 deletions(-) delete mode 100644 lilac/atm_driver/ctsm.mk diff --git a/README.lilac b/README.lilac index 59da475bc8..cf12106e85 100644 --- a/README.lilac +++ b/README.lilac @@ -1,3 +1,7 @@ +======================================================================== +I. Building a CTSM / LILAC library for inclusion in an atmosphere model +======================================================================== + 1) check out the code (ctsm and lilac are now bundled together) and built as one library > git clone https://github.com/ESCOMP/ctsm.git @@ -10,7 +14,6 @@ > export LILAC_MODE='on' > export SRCROOT=`pwd` > export CASEDIR=/glade/scratch/mvertens/test_lilac - > export BLDDIR=$CASEDIR/bld 3) build the ctsm/lilac library using a CIME case @@ -21,14 +24,22 @@ > ./case.setup > ./case.build --sharedlib-only -4) To build the atm_driver executable on cheyenne +======================================================================== +II. Building and running the test atmosphere driver +======================================================================== + +After following the above instructions for building a CTSM / LILAC +library (I), do the following: + +1) To build the atm_driver executable on cheyenne (***CTSM_MKFILE IS CRITICAL for the operation of the atm_driver makefile) + > export CTSM_MKFILE=$CASEDIR/bld/ctsm.mk > cd $SRCROOT/lilac/atm_driver > make clean > source $CASEDIR/.env_mach_specific.sh > make atm_driver -5) to generate the input namelists +2) to generate the input namelists - to customize the generated namelist - edit the file ctsm.cfg (in this directory) - to create the ctsm namelist FROM THIS DIRECTORY: @@ -39,11 +50,11 @@ THIS ONLY NEEDS TO BE DONE ONCE to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory -6) run the atm_driver on cheyenne +3) run the atm_driver on cheyenne > qsub cheyenne.sub -7) compare with latest baselines +4) compare with latest baselines use something like this to compare the last clm and last cpl hist files: @@ -51,8 +62,27 @@ > cprnc test_lilac.clm2.h0.2000-01-02-00000.nc $basedir/test_lilac.clm2.h0.2000-01-02-00000.nc | tail -30 > cprnc test_lilac.cpl.hi.2000-01-02-00000.nc $basedir/test_lilac.cpl.hi.2000-01-02-00000.nc | tail -30 -8) if there are differences, and those are intentional, then create new +5) if there are differences, and those are intentional, then create new baselines copy all *.nc files, plus ctsm.cfg, lilac_in and lnd_in to the baseline directory + +======================================================================== +III. Linking the CTSM / LILAC library into another atmosphere model +======================================================================== + +After following the above instructions for building a CTSM / LILAC +library (I), you should do the following, assuming that the atmosphere +model is built using a makefile: + +1) Set some environment variable (e.g., CTSM_MKFILE) to point to the + ctsm.mk file generated in CTSM's bld directory. + +2) Modify the atmosphere model's makefile to include the file given by + the environment variable $CTSM_MAKEFILE. + +3) In the compilation line for the atmosphere model, add + $(CTSM_INCLUDES) + +4) In the link line for the atmosphere model, add $(CTSM_LIBS) diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 41840146cd..e586643f81 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -3,17 +3,18 @@ #================================================================================ #================================================================================ -# Note: You must set the environment BLDDIR before running this - e.g. -# export BLDDIR=/glade/scratch/sacks/test_lilac_1205a/bld +# Note: You must set the environment variable CTSM_MKFILE before running this - e.g. +# export CTSM_MKFILE=/glade/scratch/sacks/test_lilac_1205a/bld/ctsm.mk # # ESMFMKFILE must also be set in the environment #================================================================================ -include $(CURDIR)/ctsm.mk +include $(CTSM_MKFILE) # Most atmosphere model builds shouldn't need this directly, but we use # it here in order to easily get a f90 compiler and f90 compile opts for -# building atm_driver.o. +# building atm_driver.o. (This is a bit of a kludge that we should +# change later.) include $(ESMFMKFILE) FFLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free diff --git a/lilac/atm_driver/ctsm.mk b/lilac/atm_driver/ctsm.mk deleted file mode 100644 index c094f1b6a0..0000000000 --- a/lilac/atm_driver/ctsm.mk +++ /dev/null @@ -1,28 +0,0 @@ -# ====================================================================== -# Include this file to get makefile variables needed to include / link -# LILAC/CTSM in an atmosphere model's build -# -# Variables of interest are: -# - CTSM_INCLUDES: add this to the compilation line -# - CTSM_LIBS: add this to the link line -# -# Note: You must set the environment BLDDIR before running this - e.g. -# export BLDDIR=/glade/scratch/sacks/test_lilac_1205a/bld -# -# ESMFMKFILE must also be set in the environment -# ====================================================================== - -include $(ESMFMKFILE) - -SHARED_BLD_DIR = $(BLDDIR)/intel/mpt/debug/nothreads/nuopc -CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf -DEPENDS_LIB = $(SHARED_BLD_DIR)/lib -SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib -SHR_INC = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/csm_share -CTSM_INC = $(CTSM_BLD_DIR)/clm/obj - -LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib - -CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(SHR_INC) -I$(CTSM_INC) - -CTSM_LIBS = $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(LIBS) From f8ab9ccbb62bc39ae61a8b0934fdf35dea42947c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 16 Dec 2019 09:38:56 -0700 Subject: [PATCH 0498/1973] Update 02_support_needed.md --- .github/ISSUE_TEMPLATE/02_support_needed.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/02_support_needed.md b/.github/ISSUE_TEMPLATE/02_support_needed.md index 18f5597abc..a199e5217d 100644 --- a/.github/ISSUE_TEMPLATE/02_support_needed.md +++ b/.github/ISSUE_TEMPLATE/02_support_needed.md @@ -8,7 +8,7 @@ about: Ask for help with using CTSM We have limited staff and ability to provide support. Here are some resources that might provide help: - User's Guide: https://escomp.github.io/ctsm-docs/doc/build/html/users_guide/index.html -- CESM's land modeling forum: https://xenforo.cgd.ucar.edu/cesm/ +- CESM's land modeling forum: https://xenforo.cgd.ucar.edu/cesm/land-river-runoff.134/ - README files amongst the source code - GitHub CTSM issues: https://github.com/escomp/ctsm/issues/ - Also make sure this issue is unique to CTSM and not really an issue with CESM or CIME From eb022120f58b58decf793cbb657a6815e1f6af80 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Dec 2019 19:48:38 -0700 Subject: [PATCH 0499/1973] In ctsm.mk file, handle either debug or nodebug Previously, it only worked if built in DEBUG mode --- cime_config/buildlib | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index 53b5a54434..eb08f06144 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -30,15 +30,24 @@ def _get_osvar(key, default): return value ############################################################################### -def _write_ctsm_mk(exeroot): +def _write_ctsm_mk(exeroot, debug): """Writes a ctsm.mk file in exeroot. This file can be included by atmosphere model builds outside of cime. NOTE: This currently has some hard-coded settings for cheyenne. Also, it assumes that ESMFMKFILE is set in your environment. + + Arguments: + exeroot (str): path to build directory + debug (str): TRUE if building in debug mode, FALSE otherwise """ + if debug.lower() == 'true': + debug_path = 'debug' + else: + debug_path = 'nodebug' + ctsm_mk_path = os.path.join(exeroot, 'ctsm.mk') esmfmkfile = os.environ['ESMFMKFILE'] with open(ctsm_mk_path, 'w') as ctsm_mk: @@ -59,7 +68,7 @@ def _write_ctsm_mk(exeroot): include {esmfmkfile} -SHARED_BLD_DIR = {exeroot}/intel/mpt/debug/nothreads/nuopc +SHARED_BLD_DIR = {exeroot}/intel/mpt/{debug_path}/nothreads/nuopc CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf DEPENDS_LIB = $(SHARED_BLD_DIR)/lib SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib @@ -74,7 +83,7 @@ LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lp CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(SHR_INC) -I$(CTSM_INC) CTSM_LIBS = $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(LIBS) -""".format(exeroot=exeroot, esmfmkfile=esmfmkfile)) +""".format(esmfmkfile=esmfmkfile, exeroot=exeroot, debug_path=debug_path)) ############################################################################### def _main_func(): @@ -93,7 +102,8 @@ def _main_func(): lilac_mode = _get_osvar('LILAC_MODE', 'off') if lilac_mode == 'on': driver = "lilac" - _write_ctsm_mk(exeroot=case.get_value("EXEROOT")) + _write_ctsm_mk(exeroot=case.get_value("EXEROOT"), + debug=case.get_value("DEBUG")) #------------------------------------------------------- # create Filepath file From 8e03e4071d1dd3dcee5fc28c751d61b481654b3e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Dec 2019 19:52:07 -0700 Subject: [PATCH 0500/1973] Apparently the case's DEBUG is a logical, not a string --- cime_config/buildlib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index eb08f06144..1cc10f0bc5 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -40,10 +40,10 @@ def _write_ctsm_mk(exeroot, debug): Arguments: exeroot (str): path to build directory - debug (str): TRUE if building in debug mode, FALSE otherwise + debug (logical): True if building in debug mode, False otherwise """ - if debug.lower() == 'true': + if debug: debug_path = 'debug' else: debug_path = 'nodebug' From 7fea397a2dfbaa8d7359370eff4454e43e8a6af0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Dec 2019 20:02:07 -0700 Subject: [PATCH 0501/1973] In LILAC buildnml, handle gridmask of null/UNSET --- lilac_config/buildnml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index d808edefa8..4fefdaaf9d 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -204,7 +204,6 @@ def buildnml(rundir, bldnmldir): '-namelist', '\'&clm_inparm start_ymd={} {}/\''.format(start_ymd, clm_namelist_opts), '-use_case',use_case, '-res', lnd_grid, - '-mask',gridmask, '-clm_start_type', start_type, '-l_ncpl', str(1), # this will not be used in lilac - but is needed as input '-configuration', configuration, @@ -218,6 +217,8 @@ def buildnml(rundir, bldnmldir): '-config',os.path.join(rundir, "config_cache.xml"), '-envxml_dir', rundir, clm_bldnml_opts] + if gridmask != 'null' and gridmask != 'UNSET': + command.extend(['-mask', gridmask]) cmd = ' '.join(command) rc, out, err = run_cmd(cmd, from_dir=os.getcwd()) From efdca62b7a597ba079c28a5d53a97d2359bb0ea5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Dec 2019 20:25:30 -0700 Subject: [PATCH 0502/1973] lons and lats need to be real, not integer --- lilac/src/lilac_atmcap.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 1b915911aa..e2939a3921 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -30,8 +30,8 @@ module lilac_atmcap ! Time invariant input from host atmosphere integer, public, allocatable :: gindex_atm(:) ! global index space - integer, public, allocatable :: atm_lons(:) ! local longitudes - integer, public, allocatable :: atm_lats(:) ! local latitudes + real , public, allocatable :: atm_lons(:) ! local longitudes + real , public, allocatable :: atm_lats(:) ! local latitudes integer, public :: atm_global_nx integer, public :: atm_global_ny From 5a30e176960f8dbd5d0da45d5333637f2dba89d8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Dec 2019 20:36:04 -0700 Subject: [PATCH 0503/1973] Send un-rounded lats and lons to lilac We want rounded lats and lons for the generation of fake data, but not for the values sent from the atm driver to lilac. --- lilac/atm_driver/atm_driver.F90 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 8aaa2985a2..ab6d43971f 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -149,9 +149,7 @@ program atm_driver do i = 1,nlocal i_global = atm_global_index(i) atm_lons(i) = centerCoords(1,i_global) - atm_lons(i) = real(nint(atm_lons(i))) ! rounding to nearest int atm_lats(i) = centerCoords(2,i_global) - atm_lats(i) = real(nint(atm_lats(i))) ! rounding to nearest int end do !------------------------------------------------------------------------ @@ -337,6 +335,8 @@ subroutine atm_driver_to_lilac (lon, lat) real, intent(in) :: lat(:) ! local variables + real, allocatable :: lon_rounded(:) + real, allocatable :: lat_rounded(:) integer :: lsize real*8, allocatable :: data(:) integer :: i @@ -344,8 +344,15 @@ subroutine atm_driver_to_lilac (lon, lat) ! -------------------------------------------------------- lsize = size(lon) + allocate(lon_rounded(lsize)) + allocate(lat_rounded(lsize)) allocate(data(lsize)) + do i = 1, lsize + lon_rounded(i) = real(nint(lon(i))) + lat_rounded(i) = real(nint(lat(i))) + end do + data(:) = 30.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Sa_z', data) From 324a209cdf1bb34f210031dfe8fac01fd97d3a4c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 17 Dec 2019 11:37:02 -0700 Subject: [PATCH 0504/1973] In LILAC atm driver, call mpi_finalize --- lilac/atm_driver/atm_driver.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index ab6d43971f..7ed7c9f4c5 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -252,6 +252,8 @@ program atm_driver print *, "=======================================" end if + call MPI_finalize(ierr) + !======================================================= contains !======================================================= From 62b27442209a079eba675d9680cc69d802f804ab Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 17 Dec 2019 12:37:39 -0700 Subject: [PATCH 0505/1973] In LILAC's ESMF_Finalize, keep mpi alive Rocky Dunlap suggested this: We want to keep mpi alive so that the atmosphere can do any finalization it needs. --- lilac/src/lilac_mod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 0a5dd3c2c3..aab27201d7 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -685,8 +685,9 @@ subroutine lilac_final( ) write(logunit,*) "end of Lilac Finalization routine" end if - ! Finalize ESMF - call ESMF_Finalize ( ) + ! Finalize ESMF; keep mpi alive so that atmosphere can do any finalization needed + ! before it calls MPI_Finalize + call ESMF_Finalize (endflag=ESMF_END_KEEPMPI) end subroutine lilac_final From 529892089535a5c435da979bc1468b45c4499c9a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 17 Dec 2019 13:47:43 -0700 Subject: [PATCH 0506/1973] Only destroy rof esmf objects if they were actually created --- lilac/src/lilac_mod.F90 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index aab27201d7..6d89080d72 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -658,10 +658,13 @@ subroutine lilac_final( ) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) call ESMF_StateDestroy(cpl2lnd_state, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateDestroy(rof2cpl_state, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_StateDestroy(cpl2rof_state, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + if (couple_to_river) then + call ESMF_StateDestroy(rof2cpl_state, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + call ESMF_StateDestroy(cpl2rof_state, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + end if call ESMF_LogWrite(subname//"destroying all components ", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -672,8 +675,11 @@ subroutine lilac_final( ) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) call ESMF_GridCompDestroy(lnd_gcomp, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) - call ESMF_GridCompDestroy(rof_gcomp, rc=rc) - if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + + if (couple_to_river) then + call ESMF_GridCompDestroy(rof_gcomp, rc=rc) + if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) + end if call ESMF_CplCompDestroy(cpl_atm2lnd_comp, rc=rc) if(rc /= ESMF_SUCCESS) call ESMF_Finalize(endflag=ESMF_END_ABORT, rc=rc) From 13edb59504ee8b813e16729efccbaf89fff02788 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 18 Dec 2019 13:15:21 -0700 Subject: [PATCH 0507/1973] Add lnd_modelio.nml file This is needed in order to set various pio parameters I took these settings from a recent I compset case --- lilac/atm_driver/lnd_modelio.nml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lilac/atm_driver/lnd_modelio.nml diff --git a/lilac/atm_driver/lnd_modelio.nml b/lilac/atm_driver/lnd_modelio.nml new file mode 100644 index 0000000000..0032f9135b --- /dev/null +++ b/lilac/atm_driver/lnd_modelio.nml @@ -0,0 +1,8 @@ +&pio_inparm + pio_netcdf_format = "64bit_offset" + pio_numiotasks = -99 + pio_rearranger = 1 + pio_root = 1 + pio_stride = 36 + pio_typename = "pnetcdf" +/ From b16be4719e74baf470683346dd67a0b91886dfba Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 18 Dec 2019 16:13:18 -0700 Subject: [PATCH 0508/1973] Add to README.lilac --- README.lilac | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.lilac b/README.lilac index cf12106e85..48dca4184b 100644 --- a/README.lilac +++ b/README.lilac @@ -46,7 +46,7 @@ library (I), do the following: > $SRCROOT/lilac_config/buildnml - - this will now create the files lnd_in, drv_flds_in, and clm.input_data_list in this directory + - this will now create the files lnd_in and clm.input_data_list in this directory THIS ONLY NEEDS TO BE DONE ONCE to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory @@ -86,3 +86,22 @@ model is built using a makefile: $(CTSM_INCLUDES) 4) In the link line for the atmosphere model, add $(CTSM_LIBS) + +======================================================================== +IV. Running CTSM / LILAC from another atmosphere model +======================================================================== + +After (III), the following steps are needed to stage the inputs needed +for running the atmosphere model + +1) Generate the input namelists following the instructions given in part + (II). + +2) Copy the following files from $SRCROOT/lilac/atm_driver into the + directory from which the atmosphere model will be run: + + - lilac_in + - lnd_in + - lnd_modelio.nml + +3) Run the atmosphere model From 93c898437ea1eec314b321c8ed063d5ff019cc51 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 22 Dec 2019 19:10:32 -0700 Subject: [PATCH 0509/1973] updates for single point and regional ctsm/datm --- cime_config/config_compsets.xml | 20 ++- cime_config/testdefs/testlist_clm.xml | 38 +++--- src/cpl/nuopc/lnd_comp_nuopc.F90 | 190 +++++++++++++++++++++----- src/cpl/nuopc/lnd_import_export.F90 | 5 +- 4 files changed, 191 insertions(+), 62 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index a1954b5dde..c3d9d0a3ec 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -37,13 +37,13 @@ - I1PtClm50SpGs - 2000_DATM%1PT_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV + I1PtClm50SpRsGs + 2000_DATM%1PT_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV - I1PtClm45SpGs - 2000_DATM%1PT_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV + I1PtClm45SpRsGs + 2000_DATM%1PT_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV @@ -160,6 +160,11 @@ 2000_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm50BgcCruRsGs + 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm50BgcCruGs 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV @@ -326,7 +331,12 @@ 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - + + + I2000Clm45FatesRsGs + 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm45FatesGs 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_RTM_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 73c04e27f9..5920b85901 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -8,7 +8,7 @@ - + @@ -842,7 +842,7 @@ - + @@ -876,7 +876,7 @@ - + @@ -884,7 +884,7 @@ - + @@ -892,7 +892,7 @@ - + @@ -1125,7 +1125,7 @@ - + @@ -1133,7 +1133,7 @@ - + @@ -1141,7 +1141,7 @@ - + @@ -1234,7 +1234,7 @@ - + @@ -1243,7 +1243,7 @@ - + @@ -1305,7 +1305,7 @@ - + @@ -1468,7 +1468,7 @@ - + @@ -1477,7 +1477,7 @@ - + @@ -1514,7 +1514,7 @@ - + @@ -1523,7 +1523,7 @@ - + @@ -1531,7 +1531,7 @@ - + @@ -1541,7 +1541,7 @@ - + @@ -1849,7 +1849,7 @@ - + @@ -1886,7 +1886,7 @@ - + diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index e5a1174868..5854e7b2cf 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -26,17 +26,21 @@ module lnd_comp_nuopc use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_varctl , only : single_column, clm_varctl_set, iulog use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_varcon , only : re use clm_time_manager , only : set_timemgr_init, advance_timestep use clm_time_manager , only : set_nextsw_cday, update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size use clm_time_manager , only : get_curr_date, get_curr_calday use clm_initializeMod , only : initialize1, initialize2 use clm_driver , only : clm_drv - use perf_mod , only : t_startf, t_stopf, t_barrierf use lnd_import_export , only : advertise_fields, realize_fields use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit use lnd_shr_methods , only : set_component_logging, get_component_instance, log_clock_advance + use perf_mod , only : t_startf, t_stopf, t_barrierf + use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror + use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var + use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable implicit none private ! except @@ -159,6 +163,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) character(len=CL) :: cvalue character(len=CL) :: logmsg logical :: isPresent, isSet + logical :: cism_evolve character(len=*), parameter :: subname=trim(modName)//':(InitializeAdvertise) ' character(len=*), parameter :: format = "('("//trim(subname)//") :',A)" !------------------------------------------------------------------------------- @@ -277,13 +282,25 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (trim(cvalue) == 'sglc') then glc_present = .false. else - glc_present = .true. + glc_present = .true. + cism_evolve = .true. + call NUOPC_CompAttributeGet(gcomp, name="cism_evolve", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) then + call ESMF_LogWrite(trim(subname)//' cism_evolve = '//trim(cvalue), ESMF_LOGMSG_INFO) + write (cism_evolve,*) cvalue + else + call shr_sys_abort(subname//'Need to set cism_evolve if glc is present') + endif end if - write(iulog,*)' rof_prognostic = ',rof_prognostic - write(iulog,*)' glc_present = ',glc_present + if (masterproc) then + write(iulog,*)' rof_prognostic = ',rof_prognostic + write(iulog,*)' glc_present = ',glc_present + if (glc_present) write(iulog,*)' cism_evolve = ',cism_evolve + end if - call advertise_fields(gcomp, flds_scalar_name, glc_present, rof_prognostic, rc) + call advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !---------------------------------------------------------------------------- @@ -309,7 +326,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_Mesh) :: Emesh, EMeshTemp ! esmf meshes + type(ESMF_Mesh) :: mesh ! esmf mesh type(ESMF_DistGrid) :: DistGrid ! esmf global index space descriptor type(ESMF_Time) :: currTime ! Current time type(ESMF_Time) :: startTime ! Start time @@ -349,8 +366,24 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type integer :: lbnum ! input to memory diagnostic type(bounds_type) :: bounds ! bounds - integer :: shrlogunit ! original log unit - character(ESMF_MAXSTR) :: convCIM, purpComp + integer :: shrlogunit ! original log unit + real(r8) :: mesh_lon, mesh_lat, mesh_area + real(r8) :: tolerance_latlon = 1.e-5 + real(r8) :: tolerance_area = 1.e-3 + integer :: spatialDim + integer :: numOwnedElements + real(R8), pointer :: ownedElemCoords(:) + real(r8), pointer :: areaPtr(:) + type(ESMF_Field) :: areaField + integer :: dimid_ni, dimid_nj, dimid_nv + integer :: ncid, ierr + integer :: ni, nj, nv + integer :: varid_xv, varid_yv + real(r8), allocatable :: xv(:,:,:), yv(:,:,:) + integer :: maxIndex(2) + real(r8) :: mincornerCoord(2) + real(r8) :: maxcornerCoord(2) + type(ESMF_Grid) :: lgrid character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -396,13 +429,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call NUOPC_CompAttributeGet(gcomp, name='case_name', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) caseid - - !TODO: case_desc does not appear in the esm_AddAttributes in esm.F90 - ! just hard-wire from now - is this even needed? - ! call NUOPC_CompAttributeGet(gcomp, name='case_desc', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! read(cvalue,*) ctitle - ctitle='UNSET' + ctitle= trim(caseid) call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -552,18 +579,78 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - EMeshTemp = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,*)'mesh file for domain is ',trim(cvalue) + if (cvalue == 'create_mesh') then + ! get the datm grid from the domain file + call NUOPC_CompAttributeGet(gcomp, name='domain_lnd', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! open file + ierr = nf90_open(cvalue, NF90_NOWRITE, ncid) + call nc_check_err(ierr, 'nf90_open', trim(cvalue)) + ! get dimension ids + ierr = nf90_inq_dimid(ncid, 'ni', dimid_ni) + call nc_check_err(ierr, 'nf90_inq_dimid for ni', trim(cvalue)) + ierr = nf90_inq_dimid(ncid, 'nj', dimid_nj) + call nc_check_err(ierr, 'nf90_inq_dimid for nj', trim(cvalue)) + ierr = nf90_inq_dimid(ncid, 'nv', dimid_nv) + call nc_check_err(ierr, 'nf90_inq_dimid for nv', trim(cvalue)) + ! get dimension values + ierr = nf90_inquire_dimension(ncid, dimid_ni, len=ni) + call nc_check_err(ierr, 'nf90_inq_dimension for ni', trim(cvalue)) + ierr = nf90_inquire_dimension(ncid, dimid_nj, len=nj) + call nc_check_err(ierr, 'nf90_inq_dimension for nj', trim(cvalue)) + ierr = nf90_inquire_dimension(ncid, dimid_nv, len=nv) + call nc_check_err(ierr, 'nf90_inq_dimension for nv', trim(cvalue)) + ! get variable ids + ierr = nf90_inq_varid(ncid, 'xv', varid_xv) + call nc_check_err(ierr, 'nf90_inq_varid for xv', trim(cvalue)) + ierr = nf90_inq_varid(ncid, 'yv', varid_yv) + call nc_check_err(ierr, 'nf90_inq_varid for yv', trim(cvalue)) + ! allocate memory for variables and get variable values + allocate(xv(nv,ni,nj), yv(nv,ni,nj)) + ierr = nf90_get_var(ncid, varid_xv, xv) + call nc_check_err(ierr, 'nf90_get_var for xv', trim(cvalue)) + ierr = nf90_get_var(ncid, varid_yv, yv) + call nc_check_err(ierr, 'nf90_get_var for yv', trim(cvalue)) + ! close file + ierr = nf90_close(ncid) + call nc_check_err(ierr, 'nf90_close', trim(cvalue)) + ! create the grid + maxIndex(1) = ni ! number of lons + maxIndex(2) = nj ! number of lats + mincornerCoord(1) = xv(1,1,1) ! min lon + mincornerCoord(2) = yv(1,1,1) ! min lat + maxcornerCoord(1) = xv(3,ni,nj) ! max lon + maxcornerCoord(2) = yv(3,ni,nj) ! max lat + deallocate(xv,yv) + write(6,*)'DEBUG: maxcornerCoord = ',maxcornerCoord + lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & + mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & + staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! create the mesh from the grid + mesh = ESMF_MeshCreate(lgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + ! read in the mesh from the file + mesh = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, & + elementDistgrid=Distgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(iulog,*)'mesh file for domain is ',trim(cvalue) + end if end if - ! recreate the mesh using the above distGrid - EMesh = ESMF_MeshCreate(EMeshTemp, elementDistgrid=Distgrid, rc=rc) + ! Determine the areas on the mesh + areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='mesh_areas', meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldRegridGetArea(areaField, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(areaField, farrayPtr=areaPtr, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! realize the actively coupled fields - call realize_fields(gcomp, Emesh, flds_scalar_name, flds_scalar_num, rc) + call realize_fields(gcomp, mesh, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !-------------------------------- @@ -572,6 +659,39 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call initialize2() + !-------------------------------- + ! Check that lats, lons and areas on mesh are the same as those internal to ctsm + ! obtain mesh lats and lons + !-------------------------------- + + call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(ownedElemCoords(spatialDim*numOwnedElements)) + call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = bounds%begg,bounds%endg + n = 1 + (g - bounds%begg) + mesh_lon = ownedElemCoords(2*n-1) + mesh_lat = ownedElemCoords(2*n) + mesh_area = areaPtr(n) + if (abs(mesh_lon - ldomain%lonc(g)) > tolerance_latlon) then + write(6,100)'ERROR: clm_lon, mesh_lon, diff_lon = ',& + ldomain%lonc(g), mesh_lon, abs(mesh_lon - ldomain%lonc(g)) + !call shr_sys_abort() + end if + if (abs(mesh_lat - ldomain%latc(g)) > tolerance_latlon) then + write(6,100)'ERROR: clm_lat, mesh_lat, diff_lat = ',& + ldomain%latc(g), mesh_lat, abs(mesh_lat - ldomain%latc(g)) + !call shr_sys_abort() + end if + if (abs(mesh_area - ldomain%area(g)/(re*re)) > tolerance_area) then + write(6,100)'ERROR: clm_area, mesh_area, diff_area = ',& + ldomain%area(g)/(re*re), mesh_area, abs(mesh_area - ldomain%area(g)/(re*re)) + !call shr_sys_abort() + end if + end do +100 format(a,3(d13.5,2x)) + !-------------------------------- ! Check that ctsm internal dtime aligns with ctsm coupling interval !-------------------------------- @@ -631,20 +751,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call shr_file_setLogUnit (shrlogunit) -#ifdef USE_ESMF_METADATA - convCIM = "CIM" - purpComp = "Model Component Simulation Description" - call ESMF_AttributeAdd(comp, convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "ShortName", "CTSM", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "LongName", "Community Land Model", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "Description", "Community Land Model", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "ReleaseDate", "2017", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "ModelType", "Terrestrial", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "Name", "TBD", convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "EmailAddress", TBD, convention=convCIM, purpose=purpComp, rc=rc) - call ESMF_AttributeSet(comp, "ResponsiblePartyRole", "contact", convention=convCIM, purpose=purpComp, rc=rc) -#endif - #if (defined _MEMTRACE) if(masterproc) then write(iulog,*) TRIM(Sub) // ':end::' @@ -1091,4 +1197,16 @@ end subroutine ModelFinalize !=============================================================================== + subroutine nc_check_err(ierror, description, filename) + integer , intent(in) :: ierror + character(*), intent(in) :: description + character(*), intent(in) :: filename + + if (ierror /= nf90_noerr) then + write (*,'(6a)') 'ERROR ', trim(description),'. NetCDF file : "', trim(filename),& + '". Error message:', trim(nf90_strerror(ierror)) + call shr_sys_abort() + endif + end subroutine nc_check_err + end module lnd_comp_nuopc diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 6fcc84ab80..715fa9ed09 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -78,7 +78,7 @@ module lnd_import_export contains !=============================================================================== - subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, rof_prognostic, rc) + subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, rc) use clm_varctl, only : ndep_from_cpl @@ -86,6 +86,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, rof_prognostic type(ESMF_GridComp) :: gcomp character(len=*) , intent(in) :: flds_scalar_name logical , intent(in) :: glc_present + logical , intent(in) :: cism_evolve logical , intent(in) :: rof_prognostic integer , intent(out) :: rc @@ -208,7 +209,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, rof_prognostic call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_soilw') ! optional for carma end if - if (glc_present) then + if (glc_present .and. cism_evolve) then ! lnd->glc states from land all lnd->glc elevation classes (1:glc_nec) plus bare land (index 0). ! The following puts all of the elevation class fields as an ! undidstributed dimension in the export state field From ae9f24be371d0006a0d6764d2c3581d338ef1325 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 27 Dec 2019 10:48:32 -0700 Subject: [PATCH 0510/1973] updates to get aux_clm test working --- cime_config/config_compsets.xml | 5 + cime_config/testdefs/testlist_clm_nuopc.xml | 1919 +++++++++++++++++++ src/cpl/nuopc/lnd_comp_nuopc.F90 | 1 - src/cpl/nuopc/lnd_import_export.F90 | 121 +- 4 files changed, 1980 insertions(+), 66 deletions(-) create mode 100644 cime_config/testdefs/testlist_clm_nuopc.xml diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index c3d9d0a3ec..bf0cb94221 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -192,6 +192,11 @@ 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV + + I2000Clm50FatesRsGs + 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_SROF_SGLC_SWAV + + I1850Clm50Bgc 1850_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV diff --git a/cime_config/testdefs/testlist_clm_nuopc.xml b/cime_config/testdefs/testlist_clm_nuopc.xml new file mode 100644 index 0000000000..00ab21d38e --- /dev/null +++ b/cime_config/testdefs/testlist_clm_nuopc.xml @@ -0,0 +1,1919 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 5854e7b2cf..f11b7014c1 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -109,7 +109,6 @@ subroutine SetServices(gcomp, rc) call ESMF_MethodRemove(gcomp, label=model_label_SetRunClock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call NUOPC_CompSpecialize(gcomp, specLabel=model_label_SetRunClock, & specRoutine=ModelSetRunClock, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 715fa9ed09..e4928f37a1 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -386,25 +386,23 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8), pointer :: dataPtr(:) character(len=128) :: fldname integer :: num - integer :: begg, endg ! bounds - integer :: g,i,k ! indices - real(r8) :: e ! vapor pressure (Pa) - real(r8) :: qsat ! saturation specific humidity (kg/kg) - real(r8) :: co2_ppmv_diag(bounds%begg:bounds%endg) ! temporary - real(r8) :: co2_ppmv_prog(bounds%begg:bounds%endg) ! temporary - real(r8) :: co2_ppmv_val ! temporary - real(r8) :: esatw ! saturation vapor pressure over water (Pa) - real(r8) :: esati ! saturation vapor pressure over ice (Pa) - real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water - real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice - real(r8) :: tdc, t ! Kelvins to Celcius function and its input - real(r8) :: forc_t ! atmospheric temperature (Kelvin) - real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) - real(r8) :: forc_pbot ! atmospheric pressure (Pa) - real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s - real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s - real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s - real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s + integer :: begg, endg ! bounds + integer :: g,i,k ! indices + real(r8) :: e ! vapor pressure (Pa) + real(r8) :: qsat ! saturation specific humidity (kg/kg) + real(r8) :: esatw ! saturation vapor pressure over water (Pa) + real(r8) :: esati ! saturation vapor pressure over ice (Pa) + real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water + real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice + real(r8) :: tdc, t ! Kelvins to Celcius function and its input + real(r8) :: forc_t ! atmospheric temperature (Kelvin) + real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) + real(r8) :: forc_pbot ! atmospheric pressure (Pa) + real(r8) :: co2_ppmv_input(bounds%begg:bounds%endg) ! temporary + real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s + real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s real(r8) :: forc_noy(bounds%begg:bounds%endg) real(r8) :: forc_nhx(bounds%begg:bounds%endg) real(r8) :: frac_grc(bounds%begg:bounds%endg, 0:glc_nec) @@ -521,11 +519,11 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,4), & ungridded_index=1, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! bcphodry + ! ocphodry call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,5), & ungridded_index=2, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! bcphiwet + ! ocphiwet call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,6), & ungridded_index=3, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -576,56 +574,47 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! Atmosphere co2 !-------------------------- - fldName = 'Sa_co2prog' - call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) - if ( ChkErr(rc,__LINE__,u_FILE_u)) return - if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'prognostic') then - call shr_sys_abort( subname//' ERROR: must have nonzero Sa_co2prog for co2_type equal to prognostic' ) - end if - if (itemflag /= ESMF_STATEITEM_NOTFOUND) then - call state_getfldptr(importState, trim(fldname), dataPtr, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg,endg - co2_ppmv_prog(g) = dataPtr(g-begg+1) ! co2 atm prognostic - end do - else - do g = begg,endg - co2_ppmv_prog(g) = co2_ppmv - end do - end if - - fldName = 'Sa_co2diag' - call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) - if ( ChkErr(rc,__LINE__,u_FILE_u)) return - if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'diagnostic') then - call shr_sys_abort( subname//' ERROR: must have nonzero Sa_co2prog for co2_type equal to prognostic' ) - end if - if (itemflag /= ESMF_STATEITEM_NOTFOUND) then - call state_getfldptr(importState, trim(fldname), dataPtr, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg,endg - co2_ppmv_diag(g) = dataPtr(g-begg+1) ! co2 atm diagnostic - end do - else - do g = begg,endg - co2_ppmv_diag(g) = co2_ppmv - end do + ! Set default value to a constant and overwrite for prognostic and diagnostic + do g = begg,endg + co2_ppmv_input(g) = co2_ppmv + end do + if (co2_type == 'prognostic') then + fldName = 'Sa_co2prog' + call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) + if ( ChkErr(rc,__LINE__,u_FILE_u)) return + if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'prognostic') then + call shr_sys_abort( subname//' ERROR: must have Sa_co2prog in import state if co2_type is prognostic' ) + end if + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + call state_getfldptr(importState, trim(fldname), dataPtr, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg,endg + co2_ppmv_input(g) = dataPtr(g-begg+1) ! co2 atm prognostic + end do + end if + else if (co2_type == 'diagnostic') then + fldName = 'Sa_co2diag' + call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) + if ( ChkErr(rc,__LINE__,u_FILE_u)) return + if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'diagnostic') then + call shr_sys_abort( subname//' ERROR: must have Sa_co2diag in import state if co2_type equal diagnostic') + end if + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + call state_getfldptr(importState, trim(fldname), dataPtr, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg,endg + co2_ppmv_input(g) = dataPtr(g-begg+1) ! co2 atm diagnostic + end do + end if end if ! Note that the following does unit conversions from ppmv to partial pressures (Pa) ! Note that forc_pbot is in Pa do g = begg,endg - if (co2_type == 'prognostic') then - co2_ppmv_val = co2_ppmv_prog(g) - else if (co2_type == 'diagnostic') then - co2_ppmv_val = co2_ppmv_diag(g) - else - co2_ppmv_val = co2_ppmv - end if forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) - atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_val * 1.e-6_r8 * forc_pbot + atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_input(g) * 1.e-6_r8 * forc_pbot if (use_c13) then - atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_val * c13ratio * 1.e-6_r8 * forc_pbot + atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_input(g) * c13ratio * 1.e-6_r8 * forc_pbot end if end do @@ -1239,11 +1228,12 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index ! TODO: if fillvalue = shr_const_spval the snowhl sent to the atm will have the spval over some points ! rather than 0 - this is very odd and needs to be understood - ! fldptr(:) = fillvalue + !fldptr1d(:) = fillvalue ! determine output array if (present(ungridded_index)) then fldptr2d(ungridded_index,:) = 0._r8 + !fldptr2d(ungridded_index,:) = fillvalue do g = bounds%begg, bounds%endg n = g - bounds%begg + 1 fldptr2d(ungridded_index,n) = input(g) @@ -1253,6 +1243,7 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index end if else fldptr1d(:) = 0._r8 + !fldptr1d(:) = fillvalue do g = bounds%begg, bounds%endg n = g - bounds%begg + 1 fldptr1d(n) = input(g) From b3ffed5c529a07073d465aa5fe824a102d614b14 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 27 Dec 2019 16:38:05 -0700 Subject: [PATCH 0511/1973] Minor tweak to README.lilac --- README.lilac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.lilac b/README.lilac index 48dca4184b..3f30846745 100644 --- a/README.lilac +++ b/README.lilac @@ -13,7 +13,7 @@ I. Building a CTSM / LILAC library for inclusion in an atmosphere model > export LILAC_MODE='on' > export SRCROOT=`pwd` - > export CASEDIR=/glade/scratch/mvertens/test_lilac + > export CASEDIR=/glade/scratch/$USER/test_lilac 3) build the ctsm/lilac library using a CIME case From 1d9bd3e7bdc59df96f2f4eef228658afb0d582dd Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 30 Dec 2019 13:01:54 -0700 Subject: [PATCH 0512/1973] dont rely on netcdf for type conversion --- src/main/histFileMod.F90 | 183 +++++++++++++++++++------------------- src/main/ncdio_pio.F90.in | 56 ++++++------ 2 files changed, 122 insertions(+), 117 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 23690ad51f..c3898e67c9 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -13,20 +13,20 @@ module histFileMod use spmdMod , only : masterproc use abortutils , only : endrun use clm_varctl , only : iulog, use_vertsoilc, use_fates - use clm_varcon , only : spval, ispval, dzsoi_decomp + use clm_varcon , only : spval, ispval, dzsoi_decomp use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort use decompMod , only : get_proc_bounds, get_proc_global, bounds_type use GetGlobalValuesMod , only : GetGlobalIndex - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch + use GridcellType , only : grc + use LandunitType , only : lun + use ColumnType , only : col + use PatchType , only : patch use EDTypesMod , only : nclmax use EDTypesMod , only : nlevleaf use FatesInterfaceMod , only : nlevsclass, nlevage use EDTypesMod , only : nfsc, ncwd use FatesInterfaceMod , only : maxveg_fates => numpft - use ncdio_pio + use ncdio_pio ! implicit none @@ -160,7 +160,7 @@ module histFileMod private :: hfields_write ! Write a variable to a history tape private :: hfields_1dinfo ! Define/output 1d subgrid info if appropriate private :: hist_update_hbuf_field_1d ! Updates history buffer for specific field and tape - private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape + private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape private :: hist_set_snow_field_2d ! Set values in history field dimensioned by levsno private :: list_index ! Find index of field in exclude list private :: set_hist_filename ! Determine history dataset filenames @@ -196,7 +196,7 @@ module histFileMod integer :: end1d_out ! on-node 1d hbuf pointer end index integer :: num1d_out ! size of hbuf first dimension (all nodes) integer :: num2d ! size of hbuf second dimension (e.g. number of vertical levels) - integer :: hpindex ! history pointer index + integer :: hpindex ! history pointer index character(len=scale_type_strlen) :: p2c_scale_type ! scale factor when averaging patch to column character(len=scale_type_strlen) :: c2l_scale_type ! scale factor when averaging column to landunit character(len=scale_type_strlen) :: l2g_scale_type ! scale factor when averaging landunit to gridcell @@ -352,7 +352,7 @@ subroutine masterlist_addfld (fname, type1d, type1d_out, & integer :: numl ! total number of landunits across all processors integer :: numc ! total number of columns across all processors integer :: nump ! total number of pfts across all processors - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'masterlist_addfld' !------------------------------------------------------------------------ @@ -673,7 +673,7 @@ subroutine htapes_fieldlist() fexcl(:,8) = hist_fexcl8(:) fexcl(:,9) = hist_fexcl9(:) fexcl(:,10) = hist_fexcl10(:) - + ! First ensure contents of fincl and fexcl are valid names @@ -853,7 +853,7 @@ end subroutine htapes_fieldlist logical function is_mapping_upto_subgrid( type1d, type1d_out ) result ( mapping) ! ! !DESCRIPTION: - ! + ! ! Return true if this field will be mapped into a higher subgrid level ! If false it will be output on it's native grid ! @@ -909,7 +909,7 @@ subroutine htape_addfld (t, f, avgflag) integer :: beg1d_out,end1d_out ! history output per-proc 1d beginning and ending indices integer :: beg1d,end1d ! beginning and ending indices for this field (assume already set) integer :: num1d_out ! history output 1d size - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'htape_addfld' !----------------------------------------------------------------------- @@ -1012,7 +1012,7 @@ subroutine htape_addfld (t, f, avgflag) ! Fields native bounds beg1d = masterlist(f)%field%beg1d end1d = masterlist(f)%field%end1d - + ! Alloccate and initialize history buffer and related info num2d = tape(t)%hlist(n)%field%num2d @@ -1050,7 +1050,7 @@ subroutine hist_update_hbuf(bounds) ! into its history buffer for appropriate tapes. ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -1064,7 +1064,7 @@ subroutine hist_update_hbuf(bounds) !$OMP PARALLEL DO PRIVATE (f, num2d) do f = 1,tape(t)%nflds num2d = tape(t)%hlist(f)%field%num2d - if ( num2d == 1) then + if ( num2d == 1) then call hist_update_hbuf_field_1d (t, f, bounds) else call hist_update_hbuf_field_2d (t, f, bounds, num2d) @@ -1092,7 +1092,7 @@ subroutine hist_update_hbuf_field_1d (t, f, bounds) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: hpindex ! history pointer index @@ -1306,7 +1306,7 @@ subroutine hist_update_hbuf_field_1d (t, f, bounds) if ( end1d .eq. ubound(field,1) ) then k_offset = 0 else - k_offset = 1 - beg1d + k_offset = 1 - beg1d endif do k = beg1d,end1d valid = .true. @@ -1386,7 +1386,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds integer, intent(in) :: num2d ! size of second dimension ! ! !LOCAL VARIABLES: @@ -1409,7 +1409,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) integer , pointer :: nacs(:,:) ! accumulation counter real(r8), pointer :: field(:,:) ! clm 2d pointer field logical :: field_allocated! whether 'field' was allocated here - logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) + logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) !(this refers to a point being active, NOT a history field being active) real(r8), allocatable :: field_gcell(:,:) ! gridcell level field (used if mapping to gridcell is done) character(len=*),parameter :: subname = 'hist_update_hbuf_field_2d' @@ -1709,7 +1709,7 @@ end subroutine hist_update_hbuf_field_2d subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d, beg1d, end1d) ! ! !DESCRIPTION: - ! Set values in history field dimensioned by levsno. + ! Set values in history field dimensioned by levsno. ! ! This routine handles what to do when a given snow layer doesn't exist for a given ! point, based on the no_snow_behavior argument. Options are: @@ -1779,7 +1779,7 @@ subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d num_snow_layers = abs(snl(c)) num_nonexistent_layers = num_levels - num_snow_layers - + ! Fill output field appropriately for each layer ! When only a subset of snow layers exist, it is the LAST num_snow_layers that exist ! Levels are rearranged such that the top snow layer (surface layer) becomes level 1, etc. @@ -1790,7 +1790,7 @@ subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d do level = (num_levels-num_nonexistent_layers), 1, -1 field_out(point, level) = field_in(point, level+num_nonexistent_layers) end do - + end do end associate @@ -1942,7 +1942,7 @@ subroutine htape_create (t, histrest) else lnfid => nfid(t) endif - + ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 ! - 1-d hist files have problems with pnetcdf. A better workaround in terms of @@ -2055,7 +2055,7 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'string_length', hist_dim_name_length, strlen_dimid) call ncd_defdim(lnfid, 'scale_type_string_length', scale_type_strlen, dimid) call ncd_defdim( lnfid, 'levdcmp', nlevdecomp_full, dimid) - + if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) call ncd_defdim(lnfid, 'fates_levscls', nlevsclass, dimid) @@ -2106,7 +2106,7 @@ subroutine htape_add_ltype_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_ltype_metadata' !----------------------------------------------------------------------- - + do ltype = 1, max_lunit attname = att_prefix // landunit_names(ltype) call ncd_putatt(lnfid, ncd_global, attname, ltype) @@ -2157,7 +2157,7 @@ subroutine htape_add_natpft_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_natpft_metadata' !----------------------------------------------------------------------- - + do ptype = natpft_lb, natpft_ub ptype_1_indexing = ptype + (1 - natpft_lb) attname = att_prefix // pftname(ptype) @@ -2187,7 +2187,7 @@ subroutine htape_add_cft_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_cft_metadata' !----------------------------------------------------------------------- - + do ptype = cft_lb, cft_ub ptype_1_indexing = ptype + (1 - cft_lb) attname = att_prefix // pftname(ptype) @@ -2215,11 +2215,11 @@ subroutine htape_timeconst3D(t, & ! ! !ARGUMENTS: integer , intent(in) :: t ! tape index - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) + real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) character(len=*) , intent(in) :: mode ! 'define' or 'write' ! ! !LOCAL VARIABLES: @@ -2435,7 +2435,7 @@ subroutine htape_timeconst3D(t, & l = col%landunit(c) if (lun%lakpoi(l)) then ! Field indices MUST match varnamesl array order above! - if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) + if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) if (ifld ==2) histil(c,lev) = col%dz_lake(c,lev) end if end do @@ -2546,9 +2546,9 @@ subroutine htape_timeconst(t, mode) long_name='coordinate lake levels', units='m', ncid=nfid(t)) call ncd_defvar(varname='levdcmp', xtype=tape(t)%ncprec, dim1name='levdcmp', & long_name='coordinate soil levels', units='m', ncid=nfid(t)) - + if(use_fates)then - + call ncd_defvar(varname='fates_levscls', xtype=tape(t)%ncprec, dim1name='fates_levscls', & long_name='FATES diameter size class lower bound', units='cm', ncid=nfid(t)) call ncd_defvar(varname='fates_scmap_levscag', xtype=ncd_int, dim1name='fates_levscag', & @@ -2632,7 +2632,7 @@ subroutine htape_timeconst(t, mode) dim1id(1) = time_dimid str = 'days since ' // basedate // " " // basesec call ncd_defvar(nfid(t), 'time', tape(t)%ncprec, 1, dim1id, varid, & - long_name='time',units=str) + long_name='time',units=str) cal = get_calendar() if ( trim(cal) == NO_LEAP_C )then caldesc = "noleap" @@ -2653,7 +2653,7 @@ subroutine htape_timeconst(t, mode) else sec_hist_nhtfrq = hist_nhtfrq(t) end if - + dtime = get_step_size() if (sec_hist_nhtfrq == 0) then !month time_period_freq = 'month_1' @@ -3021,7 +3021,7 @@ subroutine hfields_1dinfo(t, mode) integer , pointer :: ilarr(:) ! temporary integer , pointer :: iparr(:) ! temporary type(file_desc_t), pointer :: ncid ! netcdf file - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'hfields_1dinfo' !----------------------------------------------------------------------- @@ -3342,11 +3342,11 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & ! !ARGUMENTS: logical, intent(in) :: rstwr ! true => write restart file this step logical, intent(in) :: nlend ! true => end of run on this step - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) + real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -3530,8 +3530,8 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & endif end do - ! Reset number of time samples to zero if file is full - + ! Reset number of time samples to zero if file is full + do t = 1, ntapes if (.not. history_tape_in_use(t)) then cycle @@ -3541,7 +3541,7 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & tape(t)%ntimes = 0 end if end do - + end subroutine hist_htapes_wrapup !----------------------------------------------------------------------- @@ -3563,7 +3563,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) use pio ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(file_desc_t), intent(inout) :: ncid ! netcdf file character(len=*) , intent(in) :: flag !'read' or 'write' character(len=*) , intent(in), optional :: rdate ! restart file time stamp for name @@ -3693,7 +3693,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ier = PIO_put_att(ncid, vardesc%varid, 'interpinic_flag', iflag_skip) ! max_nflds is the maximum number of fields on any tape - ! max_flds is the maximum number possible number of fields + ! max_flds is the maximum number possible number of fields max_nflds = max_nFields() @@ -3726,7 +3726,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) num2d = tape(t)%hlist(f)%field%num2d nacs => tape(t)%hlist(f)%nacs hbuf => tape(t)%hlist(f)%hbuf - + if (type1d_out == grlnd) then if (ldomain%isgrid2d) then dim1name = 'lon' ; dim2name = 'lat' @@ -3736,10 +3736,10 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) else dim1name = type1d_out ; dim2name = 'undefined' endif - + if (dim2name == 'undefined') then if (num2d == 1) then - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & + call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & dim1name=dim1name, & long_name=trim(long_name), units=trim(units)) call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & @@ -3781,9 +3781,9 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_defdim( ncid_hist(t), 'avgflag_len' , avgflag_strlen, dimid) call ncd_defdim( ncid_hist(t), 'scalar' , 1 , dimid) call ncd_defdim( ncid_hist(t), 'max_chars' , max_chars , dimid) - call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) - call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) - + call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) + call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) + call ncd_defvar(ncid=ncid_hist(t), varname='nhtfrq', xtype=ncd_int, & long_name="Frequency of history writes", & comment="Namelist item", & @@ -3823,7 +3823,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_defvar(ncid=ncid_hist(t), varname='begtime', xtype=ncd_double, & long_name="Beginning time", units="time units", & dim1name='scalar') - + call ncd_defvar(ncid=ncid_hist(t), varname='num2d', xtype=ncd_int, & long_name="Size of second dimension", units="unitless", & dim1name='max_nflds' ) @@ -3865,7 +3865,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_enddef(ncid_hist(t)) - end do ! end of ntapes loop + end do ! end of ntapes loop RETURN @@ -3889,7 +3889,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_io('locfnh', my_locfnh, 'write', ncid, nt=t) call ncd_io('locfnhr', my_locfnhr, 'write', ncid, nt=t) end do - + fincl(:,1) = hist_fincl1(:) fincl(:,2) = hist_fincl2(:) fincl(:,3) = hist_fincl3(:) @@ -3938,7 +3938,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) itemp(:) = 0 do f=1,tape(t)%nflds itemp(f) = tape(t)%hlist(f)%field%num2d - end do + end do call ncd_io(varname='num2d', data=itemp(:), ncid=ncid_hist(t), flag='write') itemp(:) = 0 @@ -3981,7 +3981,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_io('l2g_scale_type', l2g_scale_type, 'write', ncid_hist(t)) deallocate(tname,tlongname,tunits,tmpstr,tavgflag) deallocate(p2c_scale_type, c2l_scale_type, l2g_scale_type) - enddo + enddo deallocate(itemp) ! @@ -4035,7 +4035,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end if ! Determine necessary indices - the following is needed if model decomposition is different on restart - + start(1)=1 if ( is_restart() )then @@ -4050,7 +4050,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) if ( t == 1 )then call ncd_inqdlen(ncid_hist(1),dimid,max_nflds,name='max_nflds') - + allocate(itemp(max_nflds)) end if @@ -4233,7 +4233,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) hist_fexcl10(:) = fexcl(:,10) end if - + if ( allocated(itemp) ) deallocate(itemp) end if @@ -4244,8 +4244,8 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ! so that subsequent time samples are added until the file is full. ! A new history file is used on a branch run. !====================================================================== - - if (flag == 'write') then + + if (flag == 'write') then do t = 1,ntapes if (.not. history_tape_in_use(t)) then @@ -4272,7 +4272,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) write(iulog,*) trim(subname),' ERROR: allocation' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - + hbuf1d(beg1d_out:end1d_out) = hbuf(beg1d_out:end1d_out,1) nacs1d(beg1d_out:end1d_out) = nacs(beg1d_out:end1d_out,1) @@ -4296,9 +4296,9 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_pio_closefile(ncid_hist(t)) - end do ! end of ntapes loop + end do ! end of ntapes loop - else if (flag == 'read') then + else if (flag == 'read') then ! Read history restart information if history files are not full @@ -4319,7 +4319,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end1d_out = tape(t)%hlist(f)%field%end1d_out nacs => tape(t)%hlist(f)%nacs hbuf => tape(t)%hlist(f)%hbuf - + if (num2d == 1) then allocate(hbuf1d(beg1d_out:end1d_out), & nacs1d(beg1d_out:end1d_out), stat=status) @@ -4327,15 +4327,15 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) write(iulog,*) trim(subname),' ERROR: allocation' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - + call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name), & dim1name=type1d_out, data=hbuf1d) call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name_acc), & dim1name=type1d_out, data=nacs1d) - + hbuf(beg1d_out:end1d_out,1) = hbuf1d(beg1d_out:end1d_out) nacs(beg1d_out:end1d_out,1) = nacs1d(beg1d_out:end1d_out) - + deallocate(hbuf1d) deallocate(nacs1d) else @@ -4347,13 +4347,13 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end do end if - + call ncd_pio_closefile(ncid_hist(t)) - + end do - + end if - + end subroutine hist_restart_ncd !----------------------------------------------------------------------- @@ -4375,7 +4375,7 @@ integer function max_nFields() end do return end function max_nFields - + !----------------------------------------------------------------------- character(len=max_namlen) function getname (inname) ! @@ -4572,7 +4572,7 @@ subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds ! boudns + type(bounds_type):: bounds ! boudns character(len=16):: l_default ! local version of 'default' character(len=*),parameter :: subname = 'hist_addfld1d' !------------------------------------------------------------------------ @@ -4798,13 +4798,13 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds + type(bounds_type):: bounds character(len=16):: l_default ! local version of 'default' character(len=*),parameter :: subname = 'hist_addfld2d' !------------------------------------------------------------------------ call get_proc_bounds(bounds) - + ! Error-check no_snow_behavior optional argument: It should be present if and only if ! type2d is 'levsno', and its value should be one of the public no_snow_* parameters ! defined above. @@ -4883,7 +4883,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('levsno') num2d = nlevsno case ('nlevcan') - num2d = nlevcan + num2d = nlevcan case ('nvegwcs') num2d = nvegwcs case default @@ -5184,12 +5184,12 @@ end subroutine hist_add_subscript subroutine strip_null(str) character(len=*), intent(inout) :: str - integer :: i + integer :: i do i=1,len(str) if(ichar(str(i:i))==0) str(i:i)=' ' end do end subroutine strip_null - + !------------------------------------------------------------------------ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rstwr, nlend) ! @@ -5209,7 +5209,7 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, logical, intent(out) :: if_stop !true => last time step of run logical, intent(out) :: if_disphist(ntapes) !true => save and dispose history file logical, intent(in) :: rstwr - logical, intent(in) :: nlend + logical, intent(in) :: nlend ! ! !LOCAL VARIABLES: integer :: t ! history tape index @@ -5219,26 +5219,26 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rest_now = .false. stop_now = .false. - + if (nlend) stop_now = .true. if (rstwr) rest_now = .true. - + if_stop = stop_now - + if (stop_now) then ! End of run - dispose all history files - + if_disphist(1:ntapes) = .true. - + else if (rest_now) then ! Restart - dispose all history files - + do t = 1,ntapes if_disphist(t) = .true. end do else ! Dispose - + if_disphist(1:ntapes) = .false. do t = 1,ntapes if (hist_ntimes(t) == hist_mfilt(t)) then @@ -5246,7 +5246,7 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, endif end do endif - + end subroutine hist_do_disp !----------------------------------------------------------------------- @@ -5286,4 +5286,3 @@ end function avgflag_valid end module histFileMod - diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index f4a8dcfad1..0e3469ebbd 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -9,7 +9,7 @@ module ncdio_pio ! Generic interfaces to write fields to netcdf files for CLM ! ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, i4=>shr_kind_i4, shr_kind_cl + use shr_kind_mod , only : r8 => shr_kind_r8, i4=>shr_kind_i4, shr_kind_cl, r4 => shr_kind_r4 use shr_infnan_mod , only : nan => shr_infnan_nan, isnan => shr_infnan_isnan, assignment(=) use shr_sys_mod , only : shr_sys_abort use shr_file_mod , only : shr_file_getunit, shr_file_freeunit @@ -33,6 +33,7 @@ module ncdio_pio use pio , only : pio_put_att, pio_put_var, pio_read_darray, pio_real, pio_seterrorhandling use pio , only : pio_setframe, pio_unlimited, pio_write, pio_write_darray, var_desc_t use pio , only : pio_iotask_rank, PIO_REARR_SUBSET, PIO_REARR_BOX + use pio , only : pio_set_log_level, pio_inq_vartype ! ! !PUBLIC TYPES: implicit none @@ -217,7 +218,7 @@ contains ! !ARGUMENTS: class(file_desc_t), intent(inout) :: file ! PIO file handle to close !----------------------------------------------------------------------- - + integer :: ierr call pio_closefile(file) end subroutine ncd_pio_closefile @@ -1457,13 +1458,13 @@ contains if(present(nt)) ndims=ndims+1 call ncd_inqvid (ncid, varname, varid, vardesc) #if ({DIMS}==0) - temp(1) = data if (present(nt)) then + temp(1) = data start(1) = nt count(1) = 1 status = pio_put_var(ncid, varid, start(1:1), count(1:1), temp) else - status = pio_put_var(ncid, varid, temp) + status = pio_put_var(ncid, varid, data) end if #elif ({DIMS}==1) start(1) = 1 ; count(1) = size(data) @@ -1611,6 +1612,7 @@ contains integer :: count(3) ! netcdf count index integer :: status ! error code logical :: varpresent ! if true, variable is on tape + integer :: xtype ! type of var in file integer , pointer :: idata(:) ! Temporary integer data to send to file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc @@ -1683,13 +1685,11 @@ contains do n = 1,ndims_iod status = pio_inq_dimlen(ncid,dids(n),dims(n)) enddo -#if ({ITYPE}==TYPELOGICAL) - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_INT, iodnum) -#else + status = pio_inq_vartype(ncid, vardesc, xtype) + call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) -#endif + xtype, iodnum) + iodesc_plus => iodesc_list(iodnum) if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) @@ -1729,13 +1729,9 @@ contains do n = 1,ndims_iod status = pio_inq_dimlen(ncid,dids(n),dims(n)) enddo -#if ({ITYPE}==TYPELOGICAL) - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_INT, iodnum) -#else + status = pio_inq_vartype(ncid, vardesc, xtype) call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) -#endif + xtype, iodnum) iodesc_plus => iodesc_list(iodnum) if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) @@ -1752,7 +1748,11 @@ contains #elif ({ITYPE}==TYPEINT) call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=ispval) #elif ({ITYPE}==TYPEDOUBLE) - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=spval) + if (iodesc_plus%type == pio_double) then + call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=spval) + else + call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, real(data,kind=r4), status, fillval=real(spval,kind=r4)) + endif #endif else @@ -1808,6 +1808,7 @@ contains logical :: varpresent ! if true, variable is on tape integer :: lb1,lb2 integer :: ub1,ub2 + integer :: xtype ! netcdf type of variable on file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc character(len=*),parameter :: subname='ncd_io_2d_{TYPE}' ! subroutine name @@ -1890,12 +1891,13 @@ contains do n = 1,ndims_iod status = pio_inq_dimlen(ncid,dids(n),dims(n)) enddo + status = pio_inq_vartype(ncid, vardesc, xtype) if (present(switchdim)) then call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum, switchdim=.true.) + xtype, iodnum, switchdim=.true.) else call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) + xtype, iodnum) end if iodesc_plus => iodesc_list(iodnum) if (present(nt)) then @@ -1944,12 +1946,13 @@ contains do n = 1,ndims_iod status = pio_inq_dimlen(ncid,dids(n),dims(n)) enddo + status = pio_inq_vartype(ncid, vardesc, xtype) if (present(switchdim)) then call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum, switchdim=.true.) + xtype, iodnum, switchdim=.true.) else call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) + xtype, iodnum) end if iodesc_plus => iodesc_list(iodnum) if (present(nt)) then @@ -2031,6 +2034,7 @@ contains integer :: iodnum ! iodesc num in list integer :: start(5) ! netcdf start index integer :: count(5) ! netcdf count index + integer :: xtype ! netcdf type of variable on file logical :: varpresent ! if true, variable is on tape type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc @@ -2087,8 +2091,9 @@ contains do n = 1,ndims_iod status = pio_inq_dimlen(ncid,dids(n),dims(n)) enddo + status = pio_inq_vartype(ncid, vardesc, xtype) call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) + xtype, iodnum) iodesc_plus => iodesc_list(iodnum) if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) @@ -2116,8 +2121,9 @@ contains do n = 1,ndims_iod status = pio_inq_dimlen(ncid,dids(n),dims(n)) enddo + status = pio_inq_vartype(ncid, vardesc, xtype) call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) + xtype, iodnum) iodesc_plus => iodesc_list(iodnum) if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) @@ -2516,10 +2522,10 @@ contains deallocate(gsmOP) - call pio_initdecomp(pio_subsystem, baseTYPE, dims(1:ndims), compDOF, iodesc_list(iodnum)%iodesc) +! call pio_initdecomp(pio_subsystem, baseTYPE, dims(1:ndims), compDOF, iodesc_list(iodnum)%iodesc) + call pio_initdecomp(pio_subsystem, xTYPE, dims(1:ndims), compDOF, iodesc_list(iodnum)%iodesc) deallocate(compDOF) - iodesc_list(iodnum)%type = xtype iodesc_list(iodnum)%ndims = ndims iodesc_list(iodnum)%dims = 0 From 814e8809a2d3464c7741a07279861abc02905f10 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 30 Dec 2019 13:31:52 -0700 Subject: [PATCH 0513/1973] follow through --- src/main/ncdio_pio.F90.in | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 0e3469ebbd..3ccc9f19a4 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -33,7 +33,7 @@ module ncdio_pio use pio , only : pio_put_att, pio_put_var, pio_read_darray, pio_real, pio_seterrorhandling use pio , only : pio_setframe, pio_unlimited, pio_write, pio_write_darray, var_desc_t use pio , only : pio_iotask_rank, PIO_REARR_SUBSET, PIO_REARR_BOX - use pio , only : pio_set_log_level, pio_inq_vartype + use pio , only : pio_inq_vartype ! ! !PUBLIC TYPES: implicit none @@ -1809,6 +1809,7 @@ contains integer :: lb1,lb2 integer :: ub1,ub2 integer :: xtype ! netcdf type of variable on file + type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc character(len=*),parameter :: subname='ncd_io_2d_{TYPE}' ! subroutine name @@ -1972,11 +1973,19 @@ contains call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=ispval) end if #else - if (present(switchdim)) then - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status, fillval=spval) + if (iodesc_plus%type == pio_double) then + if (present(switchdim)) then + call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status, fillval=spval) + else + call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=spval) + end if else - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=spval) - end if + if (present(switchdim)) then + call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, real(temp, kind=r4), status, fillval=real(spval, kind=r4)) + else + call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, real(data, kind=r4), status, fillval=real(spval, kind=r4)) + end if + endif if ( present(cnvrtnan2fill) )then do j = lb2,ub2 do i = lb1,ub1 From 54f009f714f7ce5af54c4ef090c983c0eb276891 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 30 Dec 2019 13:45:28 -0700 Subject: [PATCH 0514/1973] updates for aux_clm testing --- cime_config/testdefs/testlist_clm.xml | 250 ++++++++++---------- cime_config/testdefs/testlist_clm_nuopc.xml | 38 +-- src/cpl/nuopc/lnd_comp_nuopc.F90 | 11 +- 3 files changed, 152 insertions(+), 147 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 5920b85901..ed5c675f3e 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -100,7 +100,7 @@ - + @@ -108,7 +108,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -157,7 +157,7 @@ - + @@ -165,7 +165,7 @@ - + @@ -174,7 +174,7 @@ - + @@ -183,7 +183,7 @@ - + @@ -191,7 +191,7 @@ - + @@ -199,7 +199,7 @@ - + @@ -207,16 +207,16 @@ - + - + - + @@ -224,7 +224,7 @@ - + @@ -232,7 +232,7 @@ - + @@ -240,7 +240,7 @@ - + @@ -248,7 +248,7 @@ - + @@ -256,7 +256,7 @@ - + @@ -265,7 +265,7 @@ - + @@ -273,7 +273,7 @@ - + @@ -282,7 +282,7 @@ - + @@ -290,7 +290,7 @@ - + @@ -298,7 +298,7 @@ - + @@ -306,7 +306,7 @@ - + @@ -314,7 +314,7 @@ - + @@ -324,7 +324,7 @@ - + @@ -332,7 +332,7 @@ - + @@ -340,7 +340,7 @@ - + @@ -348,7 +348,7 @@ - + @@ -359,7 +359,7 @@ - + @@ -367,7 +367,7 @@ - + @@ -375,7 +375,7 @@ - + @@ -383,7 +383,7 @@ - + @@ -391,7 +391,7 @@ - + @@ -400,7 +400,7 @@ - + @@ -409,16 +409,16 @@ - + - + - + @@ -436,7 +436,7 @@ - + @@ -444,7 +444,7 @@ - + @@ -460,7 +460,7 @@ - + @@ -469,7 +469,7 @@ - + @@ -477,7 +477,7 @@ - + @@ -485,7 +485,7 @@ - + @@ -494,7 +494,7 @@ - + @@ -502,7 +502,7 @@ - + @@ -510,7 +510,7 @@ - + @@ -518,7 +518,7 @@ - + @@ -526,7 +526,7 @@ - + @@ -534,7 +534,7 @@ - + @@ -542,7 +542,7 @@ - + @@ -550,7 +550,7 @@ - + @@ -558,7 +558,7 @@ - + @@ -566,16 +566,16 @@ - + - + - + @@ -593,7 +593,7 @@ - + @@ -601,7 +601,7 @@ - + @@ -609,7 +609,7 @@ - + @@ -617,7 +617,7 @@ - + @@ -627,7 +627,7 @@ - + @@ -637,7 +637,7 @@ - + @@ -646,7 +646,7 @@ - + @@ -656,7 +656,7 @@ - + @@ -665,7 +665,7 @@ - + @@ -673,7 +673,7 @@ - + @@ -682,7 +682,7 @@ - + @@ -690,16 +690,16 @@ - + - + - + @@ -709,7 +709,7 @@ - + @@ -717,7 +717,7 @@ - + @@ -726,7 +726,7 @@ - + @@ -736,12 +736,12 @@ - + - + @@ -754,7 +754,7 @@ - + @@ -786,11 +786,11 @@ - + - + @@ -842,7 +842,7 @@ - + @@ -859,7 +859,7 @@ - + @@ -876,7 +876,7 @@ - + @@ -884,7 +884,7 @@ - + @@ -892,7 +892,7 @@ - + @@ -900,7 +900,7 @@ - + @@ -909,7 +909,7 @@ - + @@ -918,7 +918,7 @@ - + @@ -927,7 +927,7 @@ - + @@ -946,7 +946,7 @@ - + @@ -955,7 +955,7 @@ - + @@ -964,7 +964,7 @@ - + @@ -978,7 +978,7 @@ - + @@ -990,7 +990,7 @@ - + @@ -1009,7 +1009,7 @@ - + @@ -1068,14 +1068,14 @@ - + - + @@ -1125,7 +1125,7 @@ - + @@ -1133,7 +1133,7 @@ - + @@ -1141,7 +1141,7 @@ - + @@ -1151,7 +1151,7 @@ - + @@ -1172,7 +1172,7 @@ - + @@ -1234,7 +1234,7 @@ - + @@ -1243,7 +1243,7 @@ - + @@ -1262,7 +1262,7 @@ - + @@ -1305,7 +1305,7 @@ - + @@ -1313,7 +1313,7 @@ - + @@ -1323,7 +1323,7 @@ - + @@ -1331,7 +1331,7 @@ - + @@ -1417,7 +1417,7 @@ - + @@ -1425,7 +1425,7 @@ - + @@ -1468,7 +1468,7 @@ - + @@ -1477,7 +1477,7 @@ - + @@ -1514,7 +1514,7 @@ - + @@ -1523,7 +1523,7 @@ - + @@ -1531,7 +1531,7 @@ - + @@ -1541,7 +1541,7 @@ - + @@ -1664,13 +1664,13 @@ - + - + @@ -1686,13 +1686,13 @@ - + - + @@ -1722,7 +1722,7 @@ - + @@ -1730,7 +1730,7 @@ - + @@ -1738,7 +1738,7 @@ - + @@ -1746,7 +1746,7 @@ - + @@ -1781,7 +1781,7 @@ - + @@ -1876,7 +1876,7 @@ - + @@ -1886,7 +1886,7 @@ - + diff --git a/cime_config/testdefs/testlist_clm_nuopc.xml b/cime_config/testdefs/testlist_clm_nuopc.xml index 00ab21d38e..0578ecd5f4 100644 --- a/cime_config/testdefs/testlist_clm_nuopc.xml +++ b/cime_config/testdefs/testlist_clm_nuopc.xml @@ -1,3 +1,5 @@ +PET_P36x1_D_Vnuopc.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default + @@ -100,7 +102,7 @@ - + @@ -256,7 +258,7 @@ - + @@ -432,7 +434,7 @@ - + @@ -740,7 +742,7 @@ - + @@ -859,7 +861,7 @@ - + @@ -900,7 +902,7 @@ - + @@ -909,7 +911,7 @@ - + @@ -918,7 +920,7 @@ - + @@ -927,7 +929,7 @@ - + @@ -946,7 +948,7 @@ - + @@ -964,7 +966,7 @@ - + @@ -990,7 +992,7 @@ - + @@ -1074,7 +1076,7 @@ - + @@ -1262,7 +1264,7 @@ - + @@ -1417,7 +1419,7 @@ - + @@ -1425,7 +1427,7 @@ - + @@ -1781,7 +1783,7 @@ - + @@ -1876,7 +1878,7 @@ - + diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index f11b7014c1..4c26b42205 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -325,7 +325,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_Mesh) :: mesh ! esmf mesh + type(ESMF_Mesh) :: mesh, gridmesh ! esmf mesh type(ESMF_DistGrid) :: DistGrid ! esmf global index space descriptor type(ESMF_Time) :: currTime ! Current time type(ESMF_Time) :: startTime ! Start time @@ -574,7 +574,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! generate the mesh and realize fields !-------------------------------- - ! read in the mesh + ! determine if the mesh will be created or read in call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -621,14 +621,17 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) maxcornerCoord(1) = xv(3,ni,nj) ! max lon maxcornerCoord(2) = yv(3,ni,nj) ! max lat deallocate(xv,yv) - write(6,*)'DEBUG: maxcornerCoord = ',maxcornerCoord lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! create the mesh from the grid - mesh = ESMF_MeshCreate(lgrid, rc=rc) + gridmesh = ESMF_MeshCreate(lgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Now redistribute the mesh to use the internal distrid + mesh = ESMF_MeshCreate(gridmesh, elementDistgrid=Distgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else ! read in the mesh from the file From dff78064da7491b2e81fa6e7b7be649fe58c1a84 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 30 Dec 2019 14:27:39 -0700 Subject: [PATCH 0515/1973] Update files used in lilac baseline comparisons --- README.lilac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.lilac b/README.lilac index 3f30846745..95f464c0fb 100644 --- a/README.lilac +++ b/README.lilac @@ -59,8 +59,8 @@ library (I), do the following: use something like this to compare the last clm and last cpl hist files: > basedir=/glade/p/cgd/tss/ctsm_baselines/lilac_20191202 - > cprnc test_lilac.clm2.h0.2000-01-02-00000.nc $basedir/test_lilac.clm2.h0.2000-01-02-00000.nc | tail -30 - > cprnc test_lilac.cpl.hi.2000-01-02-00000.nc $basedir/test_lilac.cpl.hi.2000-01-02-00000.nc | tail -30 + > cprnc test_lilac.clm2.h0.2000-01-03-00000.nc $basedir/test_lilac.clm2.h0.2000-01-03-00000.nc | tail -30 + > cprnc test_lilac.lilac.hi.2000-01-02-81000.nc $basedir/test_lilac.lilac.hi.2000-01-02-81000.nc | tail -30 5) if there are differences, and those are intentional, then create new baselines From 27c938b0fe3a23df8bb499f8d45483f0e59e0c16 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 2 Jan 2020 14:17:17 -0700 Subject: [PATCH 0516/1973] Fix units in comment Note this in lnd2atmMod: do g = bounds%begg,bounds%endg bulk_or_tracer%waterlnd2atm_inst%h2osno_grc(g) = & bulk_or_tracer%waterlnd2atm_inst%h2osno_grc(g)/1000._r8 end do --- src/biogeophys/Waterlnd2atmType.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeophys/Waterlnd2atmType.F90 b/src/biogeophys/Waterlnd2atmType.F90 index fdef91695c..ed6e9ca0dd 100644 --- a/src/biogeophys/Waterlnd2atmType.F90 +++ b/src/biogeophys/Waterlnd2atmType.F90 @@ -25,7 +25,7 @@ module Waterlnd2atmType class(water_info_base_type), pointer :: info real(r8), pointer :: q_ref2m_grc (:) ! 2m surface specific humidity (kg/kg) - real(r8), pointer :: h2osno_grc (:) ! snow water (mm H2O) + real(r8), pointer :: h2osno_grc (:) ! snow water (m H2O) real(r8), pointer :: qflx_evap_tot_grc (:) ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg real(r8), pointer :: qflx_rofliq_grc (:) ! rof liq forcing real(r8), pointer :: qflx_rofliq_qsur_grc (:) ! rof liq -- surface runoff component From 913c4476c4991397270474148b2697d9006527fe Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 2 Jan 2020 14:21:52 -0700 Subject: [PATCH 0517/1973] Add figures for tools chapter, the section on the details of running mksurfdata_map seems to be missing --- .../using-clm-tools/creating-domain-files.rst | 27 ++++++++++++------- ...g-input-for-surface-dataset-generation.rst | 14 +++++----- .../creating-surface-datasets.rst | 22 +++++++++------ 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst index c804a7bea7..eb4f19471d 100644 --- a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst +++ b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst @@ -6,24 +6,33 @@ Creating CLM domain files ***************************** -*gen_domain* to create a domain file for datm from a mapping file. **gen_domain** is a tool that is a part of CIME. The domain file is then used by BOTH DATM AND CLM to define the grid and land-mask. The general data flow is shown in two figures. `Figure 2-4 `_ shows the general flow for a general global case (or for a regional grid that DOES include ocean). `Figure 2-5 `_ shows the use of **mknoocnmap.pl** (see `the Section called Using mknocnmap.pl to create grid and maps for single-point regional grids `_) to create a regional or single-point map file that is then run through **gen_domain** to create the domain file for it. As stated before `Figure 2-2 `_ is the legend for both of these figures. See `the +*gen_domain* to create a domain file for datm from a mapping file. **gen_domain** is a tool that is a part of CIME. The domain file is then used by BOTH DATM AND CLM to define the grid and land-mask. The general data flow is shown in two figures. :numref:`Figure mkmapdata.sh` shows the general flow for a general global case (or for a regional grid that DOES include ocean). :numref:`Figure mknoocnmap.pl` shows the use of **mknoocnmap.pl** (see `the Section called Using mknocnmap.pl to create grid and maps for single-point regional grids `_) to create a regional or single-point map file that is then run through **gen_domain** to create the domain file for it. As stated before :numref:`Figure Data_Flow_Legend` is the legend for both of these figures. See `the $CIMEROOT/tools/mapping/gen_domain_files/README `_ file for more help on **gen_domain**. Here we create domain files for a regular global domain. -Figure 2-4. Global Domain file creation -======================================= +Global Domain file creation +=========================== -Insert figure 2-4 +.. _Figure Global-Domain -Starting from SCRIP grid files for both your atmosphere and ocean, you use **$CIMEROOT/tools/mapping/gen_mapping_files/gen_cesm_maps.sh** to create a mapping file between the atmosphere and ocean. That mapping file is then used as input to **gen_domain** to create output domain files for both atmosphere and ocean. The atmosphere domain file is then used by both CLM and DATM for I compsets, while the ocean domain file is ignored. For this process you have to define your SCRIP grid files on your own. For a regional or single-point case that doesn't include ocean see `Figure 2-5 `_. (See `Figure 2-2 `_ for the legend for this figure.) +.. figure:: GlobalDomain.jpeg + +Global Domain file creation + +Starting from SCRIP grid files for both your atmosphere and ocean, you use **$CIMEROOT/tools/mapping/gen_mapping_files/gen_cesm_maps.sh** to create a mapping file between the atmosphere and ocean. That mapping file is then used as input to **gen_domain** to create output domain files for both atmosphere and ocean. The atmosphere domain file is then used by both CLM and DATM for I compsets, while the ocean domain file is ignored. For this process you have to define your SCRIP grid files on your own. For a regional or single-point case that doesn't include ocean see :numref:`Figure mknoocnmap.pl`. (See :numref:`Figure Global-Domain` for the legend for this figure.) Note, that the SCRIP grid file used to start this process, is also used in **mkmapdata.sh** (see `the Section called Creating mapping files that mksurfdata_map will use `_). Next we create domain files for a single-point or regional domain. -Figure 2-5. Domain file creation using mknoocnmap.pl -==================================================== -Insert figure 2-5 +Domain file creation using mknoocnmap.pl +======================================== + +.. _Figure mknoocnmap.pl + +.. figure:: mknoocnmap.jpeg + +Domain file creation using mknoocnmap.pl -For a regular latitude/longitude grid that can be used for regional or single point simulations -- you can use **mknoocnmap.pl**. It creates a SCRIP grid file that can then be used as input to **mkmapdata.sh** as well as a SCRIP mapping file that is then input to **gen_domain**. The output of **gen_domain** is a atmosphere domain file used by both CLM and DATM and a ocean domain file that is ignored. (See `Figure 2-2 `_ for the legend for this figure.) +For a regular latitude/longitude grid that can be used for regional or single point simulations -- you can use **mknoocnmap.pl**. It creates a SCRIP grid file that can then be used as input to **mkmapdata.sh** as well as a SCRIP mapping file that is then input to **gen_domain**. The output of **gen_domain** is a atmosphere domain file used by both CLM and DATM and a ocean domain file that is ignored. (See :numref:`Figure mknoocnmap.pl` for the legend for this figure.) In this case the process creates both SCRIP grid files to be used by **mkmapdata.sh** as well as the domain files that will be used by both CLM and DATM. diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index c044c283af..c1a2f1e637 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -37,7 +37,7 @@ If you want to create a regular latitude/longitude single-point or regional grid -nx Number of longitudes (default is 1) -ny Number of latitudes (default is 1) -See `Figure 2-5 `_ for a visual representation of this process. +See :numref:`Figure mknoocnmap.pl` for a visual representation of this process. 2. Creating mapping files for mksurfdata_map @@ -48,7 +48,7 @@ See `Figure 2-5 `_ for a visual representation of this process. The bash shell script ``$CTSMROOT/tools/mkmapgrids/mkmapdata.sh`` uses **ESMF_RegridWeightGen** to create a list of maps from the raw datasets that are input to **mksurfdata_map**. Each dataset that has a different grid, or land-mask needs a different mapping file for it, but many different raw datasets share the same grid/land-mask as other files. Hence, there doesn't need to be a different mapping file for EACH raw dataset -- just for each raw dataset that has a DIFFERENT grid or land-mask.. -See `Figure 2-3 `_ for a visual representation of how this works. +See :numref:`Figure mkmapdata.sh` for a visual representation of how this works. The bash script figures out which mapping files it needs to create and then runs **ESMF_RegridWeightGen** for each one. You can then either enter the datasets into the XML database (see `Chapter 3 `_ or leave the files in place, and use the "-res usrspec -usr_gname -usr_gdate" options to **mksurfdata_map** (see `the Section called Running mksurfdata.pl `_ below). mkmapdata.sh has a help option with the following @@ -105,8 +105,10 @@ mkmapdata.sh has a help option with the following ********************** -Figure 2-3. Details of running mkmapdata.sh -------------------------------------------- -Insert figure 2-3 +.. _Figure mkmapdata.sh -Each of the raw datasets for **mksurfdata_map** needs a mapping file to map from the output grid you are running on to the grid and land-mask for that dataset. This is what **mkmapdata.sh** does. To create the mapping files you need a SCRIP grid file to correspond with each resolution and land mask that you have a raw data file in **mksurfdata_map**. Some raw datasets share the same grid and land mask -- hence they can share the same SCRIP grid file. The output maps created here go into **mksurfdata_map** see `Figure 2-6 `_. +.. figure:: mkmapdata_details.jpeg + +Details of running mkmapdata.sh + +Each of the raw datasets for **mksurfdata_map** needs a mapping file to map from the output grid you are running on to the grid and land-mask for that dataset. This is what **mkmapdata.sh** does. To create the mapping files you need a SCRIP grid file to correspond with each resolution and land mask that you have a raw data file in **mksurfdata_map**. Some raw datasets share the same grid and land mask -- hence they can share the same SCRIP grid file. The output maps created here go into **mksurfdata_map** see :numref:`Figure mksurfdatamap`. diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index c5a5644034..bc9469a4ad 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -6,17 +6,23 @@ Creating Surface Datasets =========================== -When just creating a replacement file for an existing one, the relevant tool should be used directly to create the file. When you are creating a set of files for a new resolution there are some dependencies between the tools that you need to keep in mind when creating them. The main dependency is that you MUST create a SCRIP grid file first as the SCRIP grid dataset is then input into the other tools. Also look at `Table 3-1 `_ which gives information on the files required and when. `Figure 2-1 `_ shows an overview of the general data-flow for creation of the fsurdat datasets. +When just creating a replacement file for an existing one, the relevant tool should be used directly to create the file. When you are creating a set of files for a new resolution there are some dependencies between the tools that you need to keep in mind when creating them. The main dependency is that you MUST create a SCRIP grid file first as the SCRIP grid dataset is then input into the other tools. Also look at `Table 3-1 `_ which gives information on the files required and when. :numref:`Figure Data_Flow` shows an overview of the general data-flow for creation of the fsurdat datasets. -Figure 2-1. Data Flow for Creation of Surface Datasets from Raw SCRIP Grid Files --------------------------------------------------------------------------------- -Insert figure 2-1 +.. _Figure Data_Flow -Starting from a SCRIP grid file that describes the grid you will run the model on, you first run **mkmapdata.sh** to create a list of mapping files. See `Figure 2-3 `_ for a more detailed view of how **mkmapdata.sh** works. The mapping files tell **mksurfdata_map** how to map between the output grid and the raw datasets that it uses as input. The output of **mksurfdata_map** is a surface dataset that you then use for running the model. See `Figure 2-6 `_ for a more detailed view of how **mksurfdata_map** works. +.. figure:: mkmapdata_mksurfdata.jpeg -`Figure 2-2 `_ is the legend for this figure (`Figure 2-1 `_) and other figures in this chapter (`Figure 2-4 `_, `Figure 2-5 `_, and `Figure 2-6 `_). -Figure 2-2. Legend for Data Flow Figures -Insert figure 2-2 +Data Flow for Creation of Surface Datasets from Raw SCRIP Grid Files + +Starting from a SCRIP grid file that describes the grid you will run the model on, you first run **mkmapdata.sh** to create a list of mapping files. See :numref:`Figure mkmapdata.sh` for a more detailed view of how **mkmapdata.sh** works. The mapping files tell **mksurfdata_map** how to map between the output grid and the raw datasets that it uses as input. The output of **mksurfdata_map** is a surface dataset that you then use for running the model. See `Figure :numref:`Figure mksurfdatamap` for a more detailed view of how **mksurfdata_map** works. + +:numref:`Figure Data_Flow_Legend` is the legend for this figure (:numref:`Figure Data_Flow`) and other figures in this chapter (:numref:`Figure Global_Domain`, :numref:`Figure mknoocnmap.pl` and :numref:`Figure mksurfdatamap`). + +.. _Figure Data_Flow_Legend + +.. figure:: LegendCLMToolDataFlow.jpeg + +Legend for Data Flow Figures Green arrows define the input to a program, while red arrows define the output. Cylinders define files that are either created by a program or used as input for a program. Boxes are programs. From 48be76a4cc0fa9853eae7ecfbdbbba5f9f941c29 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 2 Jan 2020 15:33:21 -0700 Subject: [PATCH 0518/1973] Add figures to tools for users guide --- .../users_guide/using-clm-tools/creating-domain-files.rst | 4 ++-- .../creating-input-for-surface-dataset-generation.rst | 2 +- .../users_guide/using-clm-tools/creating-surface-datasets.rst | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst index eb4f19471d..9e61bfce7f 100644 --- a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst +++ b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst @@ -18,7 +18,7 @@ Global Domain file creation .. figure:: GlobalDomain.jpeg -Global Domain file creation + Global Domain file creation Starting from SCRIP grid files for both your atmosphere and ocean, you use **$CIMEROOT/tools/mapping/gen_mapping_files/gen_cesm_maps.sh** to create a mapping file between the atmosphere and ocean. That mapping file is then used as input to **gen_domain** to create output domain files for both atmosphere and ocean. The atmosphere domain file is then used by both CLM and DATM for I compsets, while the ocean domain file is ignored. For this process you have to define your SCRIP grid files on your own. For a regional or single-point case that doesn't include ocean see :numref:`Figure mknoocnmap.pl`. (See :numref:`Figure Global-Domain` for the legend for this figure.) @@ -31,7 +31,7 @@ Domain file creation using mknoocnmap.pl .. figure:: mknoocnmap.jpeg -Domain file creation using mknoocnmap.pl + Domain file creation using mknoocnmap.pl For a regular latitude/longitude grid that can be used for regional or single point simulations -- you can use **mknoocnmap.pl**. It creates a SCRIP grid file that can then be used as input to **mkmapdata.sh** as well as a SCRIP mapping file that is then input to **gen_domain**. The output of **gen_domain** is a atmosphere domain file used by both CLM and DATM and a ocean domain file that is ignored. (See :numref:`Figure mknoocnmap.pl` for the legend for this figure.) diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index c1a2f1e637..6877a1f1e5 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -109,6 +109,6 @@ mkmapdata.sh has a help option with the following .. figure:: mkmapdata_details.jpeg -Details of running mkmapdata.sh + Details of running mkmapdata.sh Each of the raw datasets for **mksurfdata_map** needs a mapping file to map from the output grid you are running on to the grid and land-mask for that dataset. This is what **mkmapdata.sh** does. To create the mapping files you need a SCRIP grid file to correspond with each resolution and land mask that you have a raw data file in **mksurfdata_map**. Some raw datasets share the same grid and land mask -- hence they can share the same SCRIP grid file. The output maps created here go into **mksurfdata_map** see :numref:`Figure mksurfdatamap`. diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index bc9469a4ad..7db5817adf 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -12,7 +12,7 @@ When just creating a replacement file for an existing one, the relevant tool sho .. figure:: mkmapdata_mksurfdata.jpeg -Data Flow for Creation of Surface Datasets from Raw SCRIP Grid Files + Data Flow for Creation of Surface Datasets from Raw SCRIP Grid Files Starting from a SCRIP grid file that describes the grid you will run the model on, you first run **mkmapdata.sh** to create a list of mapping files. See :numref:`Figure mkmapdata.sh` for a more detailed view of how **mkmapdata.sh** works. The mapping files tell **mksurfdata_map** how to map between the output grid and the raw datasets that it uses as input. The output of **mksurfdata_map** is a surface dataset that you then use for running the model. See `Figure :numref:`Figure mksurfdatamap` for a more detailed view of how **mksurfdata_map** works. @@ -22,7 +22,7 @@ Starting from a SCRIP grid file that describes the grid you will run the model o .. figure:: LegendCLMToolDataFlow.jpeg -Legend for Data Flow Figures + Legend for Data Flow Figures Green arrows define the input to a program, while red arrows define the output. Cylinders define files that are either created by a program or used as input for a program. Boxes are programs. From bc307472162ac8393ef5bb06e68013341fe89025 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 2 Jan 2020 16:59:24 -0700 Subject: [PATCH 0519/1973] Add missing colons to figure targets --- .../users_guide/using-clm-tools/creating-domain-files.rst | 4 ++-- .../creating-input-for-surface-dataset-generation.rst | 2 +- .../users_guide/using-clm-tools/creating-surface-datasets.rst | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst index 9e61bfce7f..972967da0c 100644 --- a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst +++ b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst @@ -14,7 +14,7 @@ Here we create domain files for a regular global domain. Global Domain file creation =========================== -.. _Figure Global-Domain +.. _Figure Global-Domain: .. figure:: GlobalDomain.jpeg @@ -27,7 +27,7 @@ Note, that the SCRIP grid file used to start this process, is also used in **mkm Domain file creation using mknoocnmap.pl ======================================== -.. _Figure mknoocnmap.pl +.. _Figure mknoocnmap.pl: .. figure:: mknoocnmap.jpeg diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index 6877a1f1e5..6048baa98c 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -105,7 +105,7 @@ mkmapdata.sh has a help option with the following ********************** -.. _Figure mkmapdata.sh +.. _Figure mkmapdata.sh: .. figure:: mkmapdata_details.jpeg diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index 7db5817adf..ce02fec2f6 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -8,7 +8,7 @@ When just creating a replacement file for an existing one, the relevant tool should be used directly to create the file. When you are creating a set of files for a new resolution there are some dependencies between the tools that you need to keep in mind when creating them. The main dependency is that you MUST create a SCRIP grid file first as the SCRIP grid dataset is then input into the other tools. Also look at `Table 3-1 `_ which gives information on the files required and when. :numref:`Figure Data_Flow` shows an overview of the general data-flow for creation of the fsurdat datasets. -.. _Figure Data_Flow +.. _Figure Data_Flow: .. figure:: mkmapdata_mksurfdata.jpeg @@ -18,7 +18,7 @@ Starting from a SCRIP grid file that describes the grid you will run the model o :numref:`Figure Data_Flow_Legend` is the legend for this figure (:numref:`Figure Data_Flow`) and other figures in this chapter (:numref:`Figure Global_Domain`, :numref:`Figure mknoocnmap.pl` and :numref:`Figure mksurfdatamap`). -.. _Figure Data_Flow_Legend +.. _Figure Data_Flow_Legend: .. figure:: LegendCLMToolDataFlow.jpeg From 959d6b08859b9d91cefcce1653e6c8a593197913 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 7 Jan 2020 13:43:33 -0700 Subject: [PATCH 0520/1973] Add in needed statement for the version on master --- bld/unit_testers/build-namelist_test.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 7ad63f6b57..4d40cd1bfe 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -1277,6 +1277,7 @@ sub make_config_cache { # Transient ssp_rcp scenarios that work $phys = "clm5_0"; $mode = "-phys $phys"; +&make_config_cache($phys); my @tran_res = ( "0.9x1.25", "1.9x2.5", "10x15" ); foreach my $usecase ( "1850_control", "1850-2100_SSP5-8.5_transient", "1850-2100_SSP1-2.6_transient", "1850-2100_SSP3-7.0_transient", "1850-2100_SSP2-4.5_transient" ) { From e21e7dc67386f6c9ee093fd255de3037166f83af Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 7 Jan 2020 14:04:26 -0700 Subject: [PATCH 0521/1973] Get the build-namelist unit test working, it had duplicated versions of a soilm set logic function and duplicate calls, and the argument list sent in wasn't correct, so I corrected it --- bld/CLMBuildNamelist.pm | 58 +++++------------------------------------ 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 59e94b825b..99f09997de 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1620,11 +1620,6 @@ sub process_namelist_inline_logic { ################################## setup_logic_lai_streams($opts, $nl_flags, $definition, $defaults, $nl); - ########################################## - # namelist group: soil_moisture_streams # - ########################################## - setup_logic_soilm_streams($opts, $nl_flags, $definition, $defaults, $nl); - ########################################## # namelist group: soil_moisture_streams # ########################################## @@ -3397,64 +3392,26 @@ sub setup_logic_megan { sub setup_logic_soilm_streams { # prescribed soil moisture streams require clm4_5/clm5_0 - my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); - if ( &value_is_true( $nl->get_value('use_soil_moisture_streams') ) ) { - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_tintalgo', - 'hgrid'=>$nl_flags->{'res'} ); - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_soilm', 'phys'=>$nl_flags->{'phys'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_soilm') != - $nl->get_value('stream_year_last_soilm') ) { - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'model_year_align_soilm', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - } - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_soilm', 'phys'=>$nl_flags->{'phys'}, - 'hgrid'=>$nl_flags->{'res'} ); - } else { - if ( defined($nl->get_value('stream_year_first_soilm')) || - defined($nl->get_value('model_year_align_soilm')) || - defined($nl->get_value('stream_fldfilename_soilm')) || - defined($nl->get_value('stream_year_last_soilm')) ) { - $log->fatal_error("One of the soilm streams namelist items (stream_year_first_soilm, " . - " model_year_align_soilm, stream_fldfilename_soilm, stream_fldfilename_soilm)" . - " is defined, but use_soil_moisture_streams option NOT set to true"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_soilm_streams { - # prescribed soil moisture streams require clm4_5/clm5_0 - my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_; + my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); if ( &value_is_true( $nl->get_value('use_soil_moisture_streams') ) ) { - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_tintalgo', + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_tintalgo', 'hgrid'=>$nl_flags->{'res'} ); - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_soilm', 'phys'=>$nl_flags->{'phys'}, + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_soilm', 'phys'=>$nl_flags->{'phys'}, 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); # Set align year, if first and last years are different if ( $nl->get_value('stream_year_first_soilm') != $nl->get_value('stream_year_last_soilm') ) { - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_soilm', 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); } - add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_soilm', 'phys'=>$nl_flags->{'phys'}, + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_soilm', 'phys'=>$nl_flags->{'phys'}, 'hgrid'=>$nl_flags->{'res'} ); } else { if ( defined($nl->get_value('stream_year_first_soilm')) || @@ -3466,7 +3423,6 @@ sub setup_logic_soilm_streams { " is defined, but use_soil_moisture_streams option NOT set to true"); } } - } } #------------------------------------------------------------------------------- From 967efcbe99a66ef956d36fdc8d8dbbf2c593e041 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 7 Jan 2020 15:36:04 -0700 Subject: [PATCH 0522/1973] Changes needed to get it to compile/link --- src/main/clm_initializeMod.F90 | 4 -- src/main/clm_instMod.F90 | 2 +- src/main/clm_varctl.F90 | 10 ++--- src/main/controlMod.F90 | 4 -- src/main/decompInitMod.F90 | 57 ----------------------------- src/utils/clmfates_interfaceMod.F90 | 5 ++- 6 files changed, 8 insertions(+), 74 deletions(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index eb4f0193a5..98cad91328 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -257,10 +257,6 @@ subroutine initialize1( ) end subroutine initialize1 - if(use_soil_moisture_streams) then - call PrescribedSoilMoistureInit(bounds_proc) - endif - !----------------------------------------------------------------------- subroutine initialize2( ) ! diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 276df5e3d3..9c2562ac78 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -568,7 +568,7 @@ subroutine clm_instRest(bounds, ncid, flag) call clm_fates%restart(bounds, ncid, flag=flag, & waterdiagnosticbulk_inst=water_inst%waterdiagnosticbulk_inst, & canopystate_inst=canopystate_inst, & - frictionvel_inst=frictionvel_inst) + frictionvel_inst=frictionvel_inst, soilstate_inst=soilstate_inst) end if diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index f74567c31b..2273d362e4 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -221,6 +221,10 @@ module clm_varctl logical, public :: use_fates = .false. ! true => use fates ! These are INTERNAL to the FATES module + integer, public :: fates_parteh_mode = -9 ! 1 => carbon only + ! 2 => C+N+P (not enabled yet) + ! no others enabled + logical, public :: use_fates_spitfire = .false. ! true => use spitfire model logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro @@ -262,12 +266,6 @@ module clm_varctl logical, public :: use_soil_moisture_streams = .false. ! true => use prescribed soil moisture stream - !---------------------------------------------------------- - ! prescribed soil moisture streams switch - !---------------------------------------------------------- - - logical, public :: use_soil_moisture_streams = .false. ! true => use prescribed soil moisture stream - !---------------------------------------------------------- ! lai streams switch for Sat. Phenology !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 8a784d0bbf..2ce6627286 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -239,8 +239,6 @@ subroutine control_init( ) namelist /clm_inparm/ use_soil_moisture_streams - namelist /clm_inparm/ use_soil_moisture_streams - namelist /clm_inparm/ use_lai_streams namelist /clm_inparm/ use_bedrock @@ -745,8 +743,6 @@ subroutine control_spmd() call mpi_bcast (use_soil_moisture_streams, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_soil_moisture_streams, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_lai_streams, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_bedrock, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index e12420f526..c6b8e1764b 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -371,63 +371,6 @@ subroutine decompInit_lnd3D(lni,lnj,lnk) end subroutine decompInit_lnd3D - !------------------------------------------------------------------------------ - subroutine decompInit_lnd3D(lni,lnj,lnk) - ! - ! !DESCRIPTION: - ! - ! Create a 3D decomposition gsmap for the global 2D grid with soil levels - ! as the 3rd dimesnion. - ! - ! !USES: - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: lni,lnj,lnk ! domain global size - ! - ! !LOCAL VARIABLES: - integer :: m,n,k ! indices - integer :: begg,endg,lsize,gsize ! used for gsmap init - integer :: begg3d,endg3d - integer, pointer :: gindex(:) ! global index for gsmap init - - - ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) - call get_proc_bounds(begg, endg) - begg3d = (begg-1)*lnk + 1 - endg3d = endg*lnk - lsize = (endg3d - begg3d + 1 ) - allocate(gindex(begg3d:endg3d)) - do k = 1, lnk - do n = begg,endg - m = (begg-1)*lnk + (k-1)*(endg-begg+1) + (n-begg+1) - gindex(m) = ldecomp%gdc2glo(n) + (k-1)*(lni*lnj) - enddo - enddo - gsize = lni * lnj * lnk - call mct_gsMap_init(gsMap_lnd2Dsoi_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) - - ! Diagnostic output - - if (masterproc) then - write(iulog,*)' 3D GSMap' - write(iulog,*)' longitude points = ',lni - write(iulog,*)' latitude points = ',lnj - write(iulog,*)' soil levels = ',lnk - write(iulog,*)' gsize = ',gsize - write(iulog,*)' lsize = ',lsize - write(iulog,*)' bounds(gindex) = ',size(gindex) - write(iulog,*)' gsMap Characteristics' - write(iulog,*) ' lnd gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lnd2Dsoi_gdc2glo) - write(iulog,*) - end if - - deallocate(gindex) - - call shr_sys_flush(iulog) - - end subroutine decompInit_lnd3D - !------------------------------------------------------------------------------ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) ! diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index b71c8c9529..be0eeb4060 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -817,7 +817,7 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & ! do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - waterstate_inst%total_plant_stored_h2o_col(c) = & + waterdiagnosticbulk_inst%total_plant_stored_h2o_col(c) = & this%fates(nc)%bc_out(s)%plant_stored_h2o_si end do end if @@ -932,6 +932,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & use FatesIOVariableKindMod, only : site_r8, site_int, cohort_r8, cohort_int use EDMainMod, only : ed_update_site use FatesInterfaceMod, only: fates_maxElementsPerSite + use FatesPlantHydraulicsMod, only : RestartHydrStates implicit none @@ -1258,7 +1259,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & soilstate_inst%bsw_col(c,1:nlevsoil) this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoil) = & - waterstate_inst%h2osoi_liq_col(c,1:nlevsoil) + waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoil) this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoil) = & soilstate_inst%hksat_col(c,1:nlevsoil) From 904a334da823427b4a17c02ccfb7b9e2f7c31a96 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 7 Jan 2020 16:43:22 -0700 Subject: [PATCH 0523/1973] Remove frictionvel instance in fates restart call as wasn't being used, this will compile/link --- src/main/clm_instMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 698ec47c7c..aab218ed62 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -576,7 +576,7 @@ subroutine clm_instRest(bounds, ncid, flag, writing_finidat_interp_dest_file) call clm_fates%restart(bounds, ncid, flag=flag, & waterdiagnosticbulk_inst=water_inst%waterdiagnosticbulk_inst, & canopystate_inst=canopystate_inst, & - frictionvel_inst=frictionvel_inst, soilstate_inst=soilstate_inst) + soilstate_inst=soilstate_inst) end if diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 94df399eb0..24782a663d 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -908,7 +908,7 @@ end subroutine wrap_update_hlmfates_dyn ! ==================================================================================== subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & - canopystate_inst, frictionvel_inst, soilstate_inst ) + canopystate_inst, soilstate_inst ) ! --------------------------------------------------------------------------------- ! The ability to restart the model is handled through three different types of calls @@ -943,7 +943,6 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & character(len=*) , intent(in) :: flag type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst type(canopystate_type) , intent(inout) :: canopystate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst type(soilstate_type) , intent(inout) :: soilstate_inst ! Locals @@ -1165,7 +1164,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & ! Update diagnostics of FATES ecosystem structure used in HLM. ! ------------------------------------------------------------------------ call this%wrap_update_hlmfates_dyn(nc,bounds_clump, & - waterdiagnosticbulk_inst,canopystate_inst,frictionvel_inst) + waterdiagnosticbulk_inst,canopystate_inst) ! ------------------------------------------------------------------------ ! Update the 3D patch level radiation absorption fractions From 17148903f53fdfce62c5d516c292997f42014694 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 7 Jan 2020 16:56:08 -0700 Subject: [PATCH 0524/1973] Make a couple changes by hand, remove edison in testlist, and update user_nl_clm for prescribed test-mod --- cime_config/testdefs/testlist_clm.xml | 6 ------ .../testdefs/testmods_dirs/clm/prescribed/user_nl_clm | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 9b9e041a18..03c66ecd08 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -853,7 +853,6 @@ - @@ -1338,7 +1337,6 @@ - @@ -1826,7 +1824,6 @@ - @@ -1836,7 +1833,6 @@ - @@ -1861,7 +1857,6 @@ - @@ -1879,7 +1874,6 @@ - diff --git a/cime_config/testdefs/testmods_dirs/clm/prescribed/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/prescribed/user_nl_clm index 2e3ab9129b..c2290397dd 100644 --- a/cime_config/testdefs/testmods_dirs/clm/prescribed/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/prescribed/user_nl_clm @@ -1,2 +1,6 @@ use_soil_moisture_streams = .true. use_lai_streams = .true. + hist_fincl1 += 'H2OSOI_PRESCRIBED_GRC' + soilm_tintalgo = 'lower' ! set time interpolation to use lower value, so can compare to input dataset + lai_tintalgo = 'lower' ! set time interpolation to use lower value, so can compare more directly to input dataset + soilm_ignore_data_if_missing = .true. From 438b8b03ab4bbee026cfc068ed096742fa3ee543 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 8 Jan 2020 15:54:29 -0700 Subject: [PATCH 0525/1973] Bring in updates for release-clm5.0.28 and release-clm5.0.29. Use patch to apply the difference and move it to the branch. Conflicts on the files: ./cime_config/testdefs/ExpectedTestFails.xml ./bld/unit_testers/build-namelist_test.pl ./bld/namelist_files/use_cases/1850_control.xml ./bld/namelist_files/namelist_defaults_ctsm.xml ./bld/CLMBuildNamelist.pm ./doc/ChangeSum ./src/main/clm_driver.F90 ./src/biogeophys/SoilMoistureStreamMod.F90 ./src/biogeophys/WaterStateType.F90 ./src/biogeophys/UrbanTimeVarType.F90 --- .gitignore | 3 + bld/CLMBuildNamelist.pm | 68 +- bld/namelist_files/namelist_defaults_ctsm.xml | 29 +- .../namelist_definition_ctsm.xml | 38 + bld/namelist_files/use_cases/1850_control.xml | 5 +- .../use_cases/1850_noanthro_control.xml | 3 + bld/namelist_files/use_cases/2000_control.xml | 3 + bld/namelist_files/use_cases/2010_control.xml | 3 + .../use_cases/20thC_transient.xml | 4 + bld/unit_testers/build-namelist_test.pl | 17 +- doc/ChangeSum | 19 + src/biogeochem/CNFireBaseMod.F90 | 15 +- src/biogeochem/SatellitePhenologyMod.F90 | 76 +- src/biogeophys/SoilMoistureStreamMod.F90 | 230 ++++-- src/biogeophys/UrbanTimeVarType.F90 | 8 +- src/biogeophys/WaterStateType.F90 | 17 + src/main/clm_driver.F90 | 24 +- src/main/controlMod.F90 | 2 +- src/main/ndepStreamMod.F90 | 11 +- test/tools/input_tests_master | 4 +- test/tools/test_driver.sh | 86 ++- test/tools/tests_posttag_izumi_nompi | 6 + tools/mkmapdata/mkmapdata.sh | 2 +- tools/mksurfdata_map/mksurfdata.pl | 1 + tools/mksurfdata_map/src/CMakeLists.txt | 13 +- tools/mksurfdata_map/src/mkdomainMod.F90 | 42 +- .../mksurfdata_map/src/mkpftConstantsMod.F90 | 2 +- tools/mksurfdata_map/src/mkpftMod.F90 | 685 +++++++++++------- tools/mksurfdata_map/src/mksurfdat.F90 | 22 +- tools/mksurfdata_map/src/test/CMakeLists.txt | 3 +- .../src/test/mkpftmod_test/CMakeLists.txt | 9 + .../src/test/mkpftmod_test/test_pftInit.pf | 297 ++++++++ .../src/test/mkpftmod_test/test_pft_oride.pf | 127 ++++ .../src/test/mkpftmod_test/test_pftrun.pf | 204 ++++++ .../src/unit_test_stubs/abort.F90 | 25 + .../src/unit_test_stubs/mkncdio.F90 | 62 +- 36 files changed, 1735 insertions(+), 430 deletions(-) create mode 100644 test/tools/tests_posttag_izumi_nompi create mode 100644 tools/mksurfdata_map/src/test/mkpftmod_test/CMakeLists.txt create mode 100644 tools/mksurfdata_map/src/test/mkpftmod_test/test_pftInit.pf create mode 100644 tools/mksurfdata_map/src/test/mkpftmod_test/test_pft_oride.pf create mode 100644 tools/mksurfdata_map/src/test/mkpftmod_test/test_pftrun.pf create mode 100644 tools/mksurfdata_map/src/unit_test_stubs/abort.F90 diff --git a/.gitignore b/.gitignore index 77a7aad528..7948b49eed 100644 --- a/.gitignore +++ b/.gitignore @@ -90,6 +90,9 @@ clm.input_data_list clm.input_data_list.previous *.stdout.txt.o* +# mksurfdata unit tests +unit_test_build + # Tools executables /tools/mksurfdata_map/mksurfdata_map /tools/mkprocdata_map/mkprocdata_map diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 99f09997de..d4131a5d08 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1011,36 +1011,23 @@ sub setup_cmdl_maxpft { } $nl_flags->{'maxpft'} = $val; - if ( ($nl_flags->{'bgc_mode'} ne "sp") && ($nl_flags->{'maxpft'} != $maxpatchpft{$nl_flags->{'use_crop'}}) ) { - $log->fatal_error("** For CN or BGC mode you MUST set max patch PFT's to $maxpatchpft{$nl_flags->{'use_crop'}}\n" . - "**\n" . - "** When the crop model is on then it must be set to $maxpatchpft{'crop'} otherwise to $maxpatchpft{'nocrop'}\n" . - "** Set the bgc mode, crop and maxpft by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -bgc, -crop and -maxpft\n" . - "** * by a default configuration file, specified by -defaults\n" . - "**"); - } - if ( $nl_flags->{'maxpft'} > $maxpatchpft{$nl_flags->{'use_crop'}} ) { - $log->fatal_error("** Max patch PFT's can NOT exceed $maxpatchpft{$nl_flags->{'use_crop'}}\n" . - "**\n" . - "** Set maxpft by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -maxpft\n" . - "** * by a default configuration file, specified by -defaults\n" . - "**"); - } - if ( $nl_flags->{'maxpft'} != $maxpatchpft{$nl_flags->{'use_crop'}} ) { - $log->warning("running with maxpft NOT equal to $maxpatchpft{$nl_flags->{'use_crop'}} is " . - "NOT validated / scientifically supported." ); - } - $log->verbose_message("Using $nl_flags->{'maxpft'} for maxpft."); - $var = "maxpatch_pft"; - $val = $nl_flags->{'maxpft'}; my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); + if ( ! defined($nl->get_variable_value($group, $var)) ) { + $val = $nl_flags->{'maxpft'}; + $nl->set_variable_value($group, $var, $val); + } + $val = $nl->get_variable_value($group, $var); + my @valid_values = ($maxpatchpft{'.true.'}, $maxpatchpft{'.false.'} ); + my $found = 0; + foreach my $valid_val ( @valid_values ) { + if ( $val == $valid_val ) { + $found = 1; + last; + } + } + if ( ! $found ) { + $log->warning("$var has a value ($val) that is normally NOT valid. Normal valid values are: @valid_values"); } } @@ -1860,6 +1847,12 @@ sub setup_logic_start_type { if (not defined $nl->get_value('nrevsn')) { $log->fatal_error("nrevsn is required for a branch type."); } + if (defined $nl->get_value('use_init_interp')) { + if ( &value_is_true($nl->get_value('use_init_interp') ) ) { + # Always print this warning, but don't stop if it happens + print "\nWARNING: use_init_interp will NOT happen for a branch case.\n\n"; + } + } } else { if (defined $nl->get_value('nrevsn')) { $log->fatal_error("nrevsn should ONLY be set for a branch type."); @@ -3254,9 +3247,10 @@ sub setup_logic_popd_streams { if ( defined($nl->get_value('stream_year_first_popdens')) || defined($nl->get_value('stream_year_last_popdens')) || defined($nl->get_value('model_year_align_popdens')) || + defined($nl->get_value('popdens_tintalgo' )) || defined($nl->get_value('stream_fldfilename_popdens')) ) { $log->fatal_error("When bgc is SP (NOT CN or BGC) or fire_method==nofire none of: stream_year_first_popdens,\n" . - "stream_year_last_popdens, model_year_align_popdens, nor\n" . + "stream_year_last_popdens, model_year_align_popdens, popdens_tintalgo nor\n" . "stream_fldfilename_popdens can be set!"); } } @@ -3315,9 +3309,10 @@ sub setup_logic_lightning_streams { if ( defined($nl->get_value('stream_year_first_lightng')) || defined($nl->get_value('stream_year_last_lightng')) || defined($nl->get_value('model_year_align_lightng')) || + defined($nl->get_value('lightng_tintalgo' )) || defined($nl->get_value('stream_fldfilename_lightng')) ) { $log->fatal_error("When bgc is SP (NOT CN or BGC) or fire_method==nofire none of: stream_year_first_lightng,\n" . - "stream_year_last_lightng, model_year_align_lightng, nor\n" . + "stream_year_last_lightng, model_year_align_lightng, lightng_tintalgo nor\n" . "stream_fldfilename_lightng can be set!"); } } @@ -3398,6 +3393,8 @@ sub setup_logic_soilm_streams { if ( &value_is_true( $nl->get_value('use_soil_moisture_streams') ) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_tintalgo', 'hgrid'=>$nl_flags->{'res'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilm_offset', + 'hgrid'=>$nl_flags->{'res'} ); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_soilm', 'phys'=>$nl_flags->{'phys'}, 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); @@ -3413,13 +3410,21 @@ sub setup_logic_soilm_streams { } add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_soilm', 'phys'=>$nl_flags->{'phys'}, 'hgrid'=>$nl_flags->{'res'} ); + if ( ($opts->{'use_case'} =~ /_transient$/) && + (remove_leading_and_trailing_quotes($nl->get_value("soilm_tintalgo")) eq "linear") ) { + $log->warning("For a transient case, soil moisture streams, should NOT use soilm_tintalgo='linear'" . + " since vegetated areas could go from missing to not missing or vice versa" ); + } } else { if ( defined($nl->get_value('stream_year_first_soilm')) || defined($nl->get_value('model_year_align_soilm')) || defined($nl->get_value('stream_fldfilename_soilm')) || + defined($nl->get_value('soilm_tintalgo')) || + defined($nl->get_value('soilm_offset')) || defined($nl->get_value('stream_year_last_soilm')) ) { $log->fatal_error("One of the soilm streams namelist items (stream_year_first_soilm, " . " model_year_align_soilm, stream_fldfilename_soilm, stream_fldfilename_soilm)" . + " soilm_tintalgo soilm_offset" . " is defined, but use_soil_moisture_streams option NOT set to true"); } } @@ -3462,9 +3467,10 @@ sub setup_logic_lai_streams { if ( defined($nl->get_value('stream_year_first_lai')) || defined($nl->get_value('stream_year_last_lai')) || defined($nl->get_value('model_year_align_lai')) || + defined($nl->get_value('lai_tintalgo' )) || defined($nl->get_value('stream_fldfilename_lai')) ) { $log->fatal_error("When bgc is NOT SP none of the following can be set: stream_year_first_lai,\n" . - "stream_year_last_lai, model_year_align_lai, nor\n" . + "stream_year_last_lai, model_year_align_lai, lai_tintalgo nor\n" . "stream_fldfilename_lai (eg. don't use this option with BGC,CN,CNDV nor BGDCV)."); } } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 6a36351c61..462be23234 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1080,28 +1080,26 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 2000 lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc +lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc + lnd/clm2/ndepdata/fndep_clm_SSP585_b.e21.BWSSP585cmip6.f09_g17.CMIP6-SSP5-8.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190211.nc - +>lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc lnd/clm2/ndepdata/fndep_clm_SSP126_b.e21.BWSSP126cmip6.f09_g17.CMIP6-SSP1-2.6-WACCM.001_2014-2101_monthly_0.9x1.25_c190221.nc +>lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc lnd/clm2/ndepdata/fndep_clm_SSP245_b.e21.BWSSP245cmip6.f09_g17.CMIP6-SSP2-4.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc +>lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP2-4.5-WACCM_1849-2101_monthly_c191007.nc lnd/clm2/ndepdata/fndep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc - -lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc +>lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP3-7.0-WACCM_1849-2101_monthly_c191007.nc - lnd/clm2/ndepdata/fndep_clm_SSP585_b.e21.BWSSP585cmip6.f09_g17.CMIP6-SSP5-8.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190211.nc +>lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc lnd/clm2/ndepdata/fndep_clm_SSP126_b.e21.BWSSP126cmip6.f09_g17.CMIP6-SSP1-2.6-WACCM.001_2014-2101_monthly_0.9x1.25_c190221.nc +>lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc lnd/clm2/ndepdata/fndep_clm_SSP245_b.e21.BWSSP245cmip6.f09_g17.CMIP6-SSP2-4.5-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc +>lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc lnd/clm2/ndepdata/fndep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2014-2101_monthly_0.9x1.25_c190401.nc +>lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP3-7.0-WACCM_1849-2101_monthly_c191007.nc cycle NDEP_month @@ -1139,9 +1137,10 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 1997 1997 -lnd/clm2/prescribed_data/LFMIP-pdLC-SST.H2OSOI.0.9x1.25.20levsoi.natveg.climo1980-2014.MONS_c190709.nc +lnd/clm2/prescribed_data/LFMIP-pdLC-SST.H2OSOI.0.9x1.25.20levsoi.natveg.1980-2014.MONS_climo.c190716.nc linear +0 .false. @@ -1251,6 +1250,10 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 2106 2015 +2015 +2106 +2015 + 2000 2000 diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index f7c6a3f859..3dafa5591c 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1599,6 +1599,11 @@ Time interpolation mode to determine how to handle data before and after the tim limit = Only use the data within the times available -- abort if the model tries to go outside it + +Time interpolation method to use for Nitrogen Deposition + + Colon delimited list of variables to read from the streams file for nitrogen deposition @@ -1688,6 +1693,19 @@ Filename of input stream data for prescribed soil moisture streams data Time interpolation method to use for prescribed soil moisture streams data + +Offset in time coordinate for soil moisture streams (sec) + + + +If false will abort if using soil moisture streams and find a point where the model shows H2OSOI_VOL +should be set because it's vegetated, but the input soilm streams dataset shows that point is missing. +If true, will ignore the prescribed soilm data for that point and let the model run for that point without +prescribed data. + + @@ -1719,6 +1737,11 @@ Simulation year that aligns with stream_year_first_lai value Filename of input stream data for LAI + +Time interpolation method to use with LAI streams + + Mapping method from LAI input file to the model resolution @@ -1755,6 +1778,11 @@ Simulation year that aligns with stream_year_first_lightng value Filename of input stream data for Lightning + +Time interpolation method to use with Lightning streams + + Mapping method from Lightning input file to the model resolution @@ -1792,6 +1820,11 @@ Simulation year that aligns with stream_year_first_popdens value Filename of input stream data for human population density + +Time interpolation method to use with human population density streams + + Mapping method from human population density input file to the model resolution @@ -1829,6 +1862,11 @@ Simulation year that aligns with stream_year_first_urbantv value Filename of input stream data for urban time varying + +Time interpolation method to use with urban time varying streams + + Mapping method from urban time varying input file to the model resolution diff --git a/bld/namelist_files/use_cases/1850_control.xml b/bld/namelist_files/use_cases/1850_control.xml index bafb1e2774..3a0c39af38 100644 --- a/bld/namelist_files/use_cases/1850_control.xml +++ b/bld/namelist_files/use_cases/1850_control.xml @@ -24,7 +24,7 @@ 1850 1850 -1850 +1850 1850 1850 @@ -32,6 +32,9 @@ lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc +lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc + cycle NDEP_month diff --git a/bld/namelist_files/use_cases/1850_noanthro_control.xml b/bld/namelist_files/use_cases/1850_noanthro_control.xml index bba281aee6..971b0cf410 100644 --- a/bld/namelist_files/use_cases/1850_noanthro_control.xml +++ b/bld/namelist_files/use_cases/1850_noanthro_control.xml @@ -42,6 +42,9 @@ 1850 1850 +1850 +1850 + NONE diff --git a/bld/namelist_files/use_cases/2000_control.xml b/bld/namelist_files/use_cases/2000_control.xml index f829e97772..f5d2cd59e9 100644 --- a/bld/namelist_files/use_cases/2000_control.xml +++ b/bld/namelist_files/use_cases/2000_control.xml @@ -30,4 +30,7 @@ 2000 2000 +2000 +2000 + diff --git a/bld/namelist_files/use_cases/2010_control.xml b/bld/namelist_files/use_cases/2010_control.xml index e61ac4dd4b..244009df02 100644 --- a/bld/namelist_files/use_cases/2010_control.xml +++ b/bld/namelist_files/use_cases/2010_control.xml @@ -33,4 +33,7 @@ 2010 2010 +2010 +2010 + diff --git a/bld/namelist_files/use_cases/20thC_transient.xml b/bld/namelist_files/use_cases/20thC_transient.xml index 8dfa8fc1a6..ff56232b8e 100644 --- a/bld/namelist_files/use_cases/20thC_transient.xml +++ b/bld/namelist_files/use_cases/20thC_transient.xml @@ -42,4 +42,8 @@ 2106 1850 +1850 +2106 +1850 + diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 4d40cd1bfe..559968c3b3 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 809; +my $ntests = 822; if ( defined($opts{'compare'}) ) { - $ntests += 492; + $ntests += 495; } plan( tests=>$ntests ); @@ -299,6 +299,7 @@ sub make_config_cache { "-clm_start_type startup", "-namelist '&a irrigate=.false./' -crop -bgc bgc", "-envxml_dir . -infile myuser_nl_clm", "-ignore_ic_date -clm_start_type branch -namelist '&a nrevsn=\"thing.nc\"/' -bgc bgc -crop", + "-clm_start_type branch -namelist '&a nrevsn=\"thing.nc\",use_init_interp=T/'", "-ignore_ic_date -clm_start_type startup -namelist '&a finidat=\"thing.nc\"/' -bgc bgc -crop", ) { my $file = $startfile; @@ -433,7 +434,7 @@ sub make_config_cache { "dribble_crphrv w/o crop" =>{ options=>" -envxml_dir . -bgc cn -no-crop", namelst=>"dribble_crophrv_xsmrpool_2atm=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", - phys=>"clm5_0", + conopts=>"-phys clm5_0", }, "CNDV with flanduse_timeseries - clm4_5"=>{ options=>"-bgc bgc -dynamic_vegetation -envxml_dir . -ignore_warnings", namelst=>"flanduse_timeseries='my_flanduse_timeseries_file.nc'", @@ -1012,16 +1013,21 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, - "use_c14_wo_bgc" =>{ options=>"-envxml_dir . -bgc cndv", + "use_c14_wo_bgc" =>{ options=>"-envxml_dir . -bgc cn", namelst=>"use_c14=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, - "maxpft_wrong" =>{ options=>"-envxml_dir . -bgc cndv", + "maxpft_wrong" =>{ options=>"-envxml_dir . -bgc cn", namelst=>"maxpatch_pft=19", GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, + "soilm_stream w transient" =>{ options=>"-res 0.9x1.25 -envxml_dir . -use_case 20thC_transient", + namelst=>"use_soil_moisture_streams=T,soilm_tintalgo='linear'", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_0", + }, "bad_megan_spec" =>{ options=>"-envxml_dir . -bgc bgc -megan", namelst=>"megan_specifier='ZZTOP=zztop'", GLC_TWO_WAY_COUPLING=>"FALSE", @@ -1040,6 +1046,7 @@ sub make_config_cache { # Now run with -ignore_warnings and make sure it works $options .= " -ignore_warnings"; eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); }; + is( $?, 0, $key ); is( $@, '', "$options" ); system( "cat $tempfile" ); } diff --git a/doc/ChangeSum b/doc/ChangeSum index b65d73cf15..69d7091d5f 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,24 @@ Tag Who Date Summary ============================================================================================================================ +release-clm5.0.29 erik 11/19/2019 Some answer changes needed for prescribed soil-moisture and clm4_5 defaults (1850-ndep, and urbantv settings) +release-clm5.0.28 erik 11/14/2019 Several bit-for-bit fixes especially around soil-moisture streams +release-clm5.0.27 erik 08/13/2019 Add presoribed soil moisture streams as an option, and a few fixes +release-clm5.0.26 sacks 07/29/2019 Add a CN precision control call to fix problems related to small negative values +release-clm5.0.25 erik 05/29/2019 Change two files from NetCDF-4 format to NetCDF-3 (because some machines have trouble with NetCDF-4 in pnetcdf) +release-clm5.0.25 erik 05/29/2019 Change two files from NetCDF-4 format to NetCDF-3 (because some machines have trouble with NetCDF-4 in pnetcdf) +release-clm5.0.24 erik 05/22/2019 Correct ndep end year for SSPs, 2-degree CMIP6WACCMDECK with C-isotopes off, fixes mksurfdata for high resolution +release-clm5.0.23 erik 05/15/2019 Update cime to bring in CO2 transient files for the CMIP6 SSP's as well as presaero for three of them +release-clm5.0.22 erik 05/08/2019 Fix carbon isotope bug that caused wrong answers for isotopes under transient land-use change +release-clm5.0.22 erik 05/08/2019 Fix carbon isotope bug that caused wrong answers for isotopes under transient land-use change +release-clm5.0.21 erik 05/03/2019 New ndep files, update fates, fix some issues +release-clm5.0.20 erik 03/12/2019 Update all fsurdat files and bring in files for future scenarios, remove CMIP5 rcp options, bring in some bug fixes +release-clm5.0.19 erik 03/08/2019 SKIPPED ON MASTER -- Update cime version +release-clm5.0.18 erik 02/13/2019 Add NoAnthro compset, reduce fields on fsurdat in mksurfdata_map, initial add of tools/contrib directory +release-clm5.0.17 sacks 01/23/2019 History fields for vertically-resolved sums of soil C and N, and minor fixes +release-clm5.0.16 erik 01/15/2019 PtVg and ssp_rcp future scenario options and Antarctica wetlands fix to mksurfdata, and option to dribble crop harvest XSMRPOOL flux to atmosphere +release-clm5.0.15 sacks 12/06/2018 SKIPPED ON MASTER -- Option for rain-to-snow +release-clm5.0.14 erik 11/29/2018 Update cime and fix surface dataset for f05 1850 non-crop case +release-clm5.0.13 erik 11/14/2018 Update externals with new CO2/presearo/rtm/mosart, add science_support, change testing ctsm1.0.dev080 sacks 12/02/2019 Update externals, minor fixes to work with latest cime, get nuopc cap working ctsm1.0.dev079 sacks 11/04/2019 Change a few uses of shr_kind ctsm1.0.dev078 oleson 10/31/2019 Fix rootr calculation with use_hydrstress true diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 75f10e9555..91a60d5f0c 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -986,6 +986,7 @@ subroutine hdm_init( this, bounds, NLFilename ) type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_popdens ! population density streams filename character(len=CL) :: popdensmapalgo = 'bilinear' ! mapping alogrithm for population density + character(len=CL) :: popdens_tintalgo = 'nearest'! time interpolation alogrithm for population density character(*), parameter :: subName = "('hdmdyn_init')" character(*), parameter :: F00 = "('(hdmdyn_init) ',4a)" !----------------------------------------------------------------------- @@ -995,7 +996,8 @@ subroutine hdm_init( this, bounds, NLFilename ) stream_year_last_popdens, & model_year_align_popdens, & popdensmapalgo, & - stream_fldFileName_popdens + stream_fldFileName_popdens, & + popdens_tintalgo ! Default values for namelist stream_year_first_popdens = 1 ! first year in stream to use @@ -1022,6 +1024,7 @@ subroutine hdm_init( this, bounds, NLFilename ) call shr_mpi_bcast(stream_year_last_popdens, mpicom) call shr_mpi_bcast(model_year_align_popdens, mpicom) call shr_mpi_bcast(stream_fldFileName_popdens, mpicom) + call shr_mpi_bcast(popdens_tintalgo, mpicom) if (masterproc) then write(iulog,*) ' ' @@ -1030,6 +1033,7 @@ subroutine hdm_init( this, bounds, NLFilename ) write(iulog,*) ' stream_year_last_popdens = ',stream_year_last_popdens write(iulog,*) ' model_year_align_popdens = ',model_year_align_popdens write(iulog,*) ' stream_fldFileName_popdens = ',stream_fldFileName_popdens + write(iulog,*) ' popdens_tintalgo = ',popdens_tintalgo write(iulog,*) ' ' endif @@ -1059,7 +1063,7 @@ subroutine hdm_init( this, bounds, NLFilename ) fillalgo='none', & mapalgo=popdensmapalgo, & calendar=get_calendar(), & - tintalgo='nearest', & + tintalgo=popdens_tintalgo, & taxmode='extend' ) if (masterproc) then @@ -1138,6 +1142,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) integer :: nml_error ! namelist i/o error flag type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_lightng ! lightning stream filename to read + character(len=CL) :: lightng_tintalgo = 'linear'! time interpolation alogrithm character(len=CL) :: lightngmapalgo = 'bilinear'! Mapping alogrithm character(*), parameter :: subName = "('lnfmdyn_init')" character(*), parameter :: F00 = "('(lnfmdyn_init) ',4a)" @@ -1148,7 +1153,8 @@ subroutine lnfm_init( this, bounds, NLFilename ) stream_year_last_lightng, & model_year_align_lightng, & lightngmapalgo, & - stream_fldFileName_lightng + stream_fldFileName_lightng, & + lightng_tintalgo ! Default values for namelist stream_year_first_lightng = 1 ! first year in stream to use @@ -1175,6 +1181,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) call shr_mpi_bcast(stream_year_last_lightng, mpicom) call shr_mpi_bcast(model_year_align_lightng, mpicom) call shr_mpi_bcast(stream_fldFileName_lightng, mpicom) + call shr_mpi_bcast(lightng_tintalgo, mpicom) if (masterproc) then write(iulog,*) ' ' @@ -1183,6 +1190,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) write(iulog,*) ' stream_year_last_lightng = ',stream_year_last_lightng write(iulog,*) ' model_year_align_lightng = ',model_year_align_lightng write(iulog,*) ' stream_fldFileName_lightng = ',stream_fldFileName_lightng + write(iulog,*) ' lightng_tintalgo = ',lightng_tintalgo write(iulog,*) ' ' endif @@ -1210,6 +1218,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) fldListFile='lnfm', & fldListModel='lnfm', & fillalgo='none', & + tintalgo=lightng_tintalgo, & mapalgo=lightngmapalgo, & calendar=get_calendar(), & taxmode='cycle' ) diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 9b287a85b2..62cc027641 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -1,5 +1,7 @@ module SatellitePhenologyMod +#include "shr_assert.h" + !----------------------------------------------------------------------- ! !DESCRIPTION: ! CLM Satelitte Phenology model (SP) ecosystem dynamics (phenology, vegetation). @@ -40,16 +42,18 @@ module SatellitePhenologyMod public :: SatellitePhenologyInit ! Dynamically allocate memory public :: interpMonthlyVeg ! interpolate monthly vegetation data public :: readAnnualVegetation ! Read in annual vegetation (needed for Dry-deposition) + public :: lai_advance ! Advance the LAI streams (outside of a Open-MP threading loop) ! ! !PRIVATE MEMBER FUNCTIONS: private :: readMonthlyVegetation ! read monthly vegetation data for two months - private :: lai_init ! position datasets for LAI - private :: lai_interp ! interpolates between two years of LAI data + private :: lai_init ! position datasets for LAI + private :: lai_interp ! interpolates between two years of LAI data (when LAI streams are being used) ! !PRIVATE MEMBER DATA: type(shr_strdata_type) :: sdat_lai ! LAI input data stream ! ! !PRIVATE TYPES: + integer, allocatable :: g_to_ig(:) ! Array matching gridcell index to data index integer , private :: InterpMonths1 ! saved month index real(r8), private :: timwt(2) ! time weights for month 1 and month 2 real(r8), private, allocatable :: mlai2t(:,:) ! lai for interpolation (2 months) @@ -98,6 +102,7 @@ subroutine lai_init(bounds) type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_lai ! lai stream filename to read character(len=CL) :: lai_mapalgo = 'bilinear' ! Mapping alogrithm + character(len=CL) :: lai_tintalgo = 'linear' ! Time interpolation alogrithm character(*), parameter :: subName = "('laidyn_init')" character(*), parameter :: F00 = "('(laidyn_init) ',4a)" @@ -113,7 +118,8 @@ subroutine lai_init(bounds) stream_year_last_lai, & model_year_align_lai, & lai_mapalgo, & - stream_fldFileName_lai + stream_fldFileName_lai, & + lai_tintalgo ! Default values for namelist stream_year_first_lai = 1 ! first year in stream to use @@ -142,6 +148,7 @@ subroutine lai_init(bounds) call shr_mpi_bcast(stream_year_last_lai, mpicom) call shr_mpi_bcast(model_year_align_lai, mpicom) call shr_mpi_bcast(stream_fldFileName_lai, mpicom) + call shr_mpi_bcast(lai_tintalgo, mpicom) if (masterproc) then @@ -151,6 +158,7 @@ subroutine lai_init(bounds) write(iulog,*) ' stream_year_last_lai = ',stream_year_last_lai write(iulog,*) ' model_year_align_lai = ',model_year_align_lai write(iulog,*) ' stream_fldFileName_lai = ',trim(stream_fldFileName_lai) + write(iulog,*) ' lai_tintalgo = ',trim(lai_tintalgo) endif @@ -184,6 +192,7 @@ subroutine lai_init(bounds) fldListModel=fldList, & fillalgo='none', & mapalgo=lai_mapalgo, & + tintalgo=lai_tintalgo, & calendar=get_calendar(), & taxmode='cycle' ) @@ -195,37 +204,71 @@ end subroutine lai_init !----------------------------------------------------------------------- ! - ! lai_interp + ! lai_advance ! !----------------------------------------------------------------------- - subroutine lai_interp(bounds, canopystate_inst) + subroutine lai_advance( bounds ) ! - ! Interpolate data stream information for Lai. + ! Advance LAI streams ! ! !USES: use clm_time_manager, only : get_curr_date - use pftconMod , only : noveg ! ! !ARGUMENTS: implicit none type(bounds_type) , intent(in) :: bounds - type(canopystate_type) , intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: - integer :: ivt, p, g, ip, ig, gpft + integer :: g, ig ! Indices integer :: year ! year (0, ...) for nstep+1 integer :: mon ! month (1, ..., 12) for nstep+1 integer :: day ! day of month (1, ..., 31) for nstep+1 integer :: sec ! seconds into current date for nstep+1 integer :: mcdate ! Current model date (yyyymmdd) - character(len=CL) :: stream_var_name !----------------------------------------------------------------------- call get_curr_date(year, mon, day, sec) mcdate = year*10000 + mon*100 + day call shr_strdata_advance(sdat_lai, mcdate, sec, mpicom, 'laidyn') + if ( .not. allocated(g_to_ig) )then + allocate (g_to_ig(bounds%begg:bounds%endg) ) + + ig = 0 + do g = bounds%begg,bounds%endg + ig = ig+1 + g_to_ig(g) = ig + end do + end if + + end subroutine lai_advance + + !----------------------------------------------------------------------- + ! + ! lai_interp + ! + !----------------------------------------------------------------------- + subroutine lai_interp(bounds, canopystate_inst) + ! + ! Interpolate data stream information for Lai. + ! + ! !USES: + use pftconMod , only : noveg + ! + ! !ARGUMENTS: + implicit none + type(bounds_type) , intent(in) :: bounds + type(canopystate_type) , intent(inout) :: canopystate_inst + ! + ! !LOCAL VARIABLES: + integer :: ivt, p, ip, ig + character(len=CL) :: stream_var_name + !----------------------------------------------------------------------- + SHR_ASSERT_FL( (lbound(g_to_ig,1) <= bounds%begg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(g_to_ig,1) >= bounds%endg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(sdat_lai%avs(1)%rAttr,2) <= g_to_ig(bounds%begg) ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(sdat_lai%avs(1)%rAttr,2) >= g_to_ig(bounds%endg) ), sourcefile, __LINE__) do p = bounds%begp, bounds%endp ivt = patch%itype(p) if (ivt /= noveg) then ! vegetated pft @@ -233,17 +276,7 @@ subroutine lai_interp(bounds, canopystate_inst) stream_var_name = 'LAI_'//trim(adjustl(stream_var_name)) ip = mct_aVect_indexRA(sdat_lai%avs(1),trim(stream_var_name)) endif - gpft = patch%gridcell(p) - - ! - ! Determine vector index corresponding to gpft - ! - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if (g == gpft) exit - end do - + ig = g_to_ig(patch%gridcell(p)) ! ! Set lai for each gridcell/patch combination ! @@ -337,6 +370,7 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & call lai_interp(bounds, canopystate_inst) endif + do fp = 1, num_nolakep p = filter_nolakep(fp) c = patch%column(p) diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index d48e554f43..64611f4578 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -1,5 +1,7 @@ module SoilMoistureStreamMod +#include "shr_assert.h" + !----------------------------------------------------------------------- ! !DESCRIPTION: ! Read in soil moisture from data stream @@ -35,10 +37,16 @@ module SoilMoistureStreamMod ! ! !PUBLIC MEMBER FUNCTIONS: public :: PrescribedSoilMoistureInit ! position datasets for soil moisture + public :: PrescribedSoilMoistureAdvance ! Advance the soil moisture stream (outside of Open-MP loops) public :: PrescribedSoilMoistureInterp ! interpolates between two periods of soil moisture data ! !PRIVATE MEMBER DATA: - type(shr_strdata_type) :: sdat_soilm ! soil moisture input data stream + type(shr_strdata_type) :: sdat_soilm ! soil moisture input data stream + integer :: ism ! Soil moisture steram index + integer, allocatable :: g_to_ig(:) ! Array matching gridcell index to data index + logical :: soilm_ignore_data_if_missing ! If should ignore overridding a point with soil moisture data + ! from the streams file, if the streams file shows that point + ! as missing (namelist item) ! ! !PRIVATE TYPES: @@ -65,7 +73,6 @@ subroutine PrescribedSoilMoistureInit(bounds) use shr_pio_mod , only : shr_pio_getiotype use clm_nlUtilsMod , only : find_nlgroup_name use ndepStreamMod , only : clm_domain_mct - use histFileMod , only : hist_addfld1d use shr_stream_mod , only : shr_stream_file_null use shr_string_mod , only : shr_string_listCreateField use clm_varpar , only : nlevsoi @@ -81,30 +88,35 @@ subroutine PrescribedSoilMoistureInit(bounds) integer :: model_year_align_soilm ! align stream_year_first_soilm with integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag + integer :: soilm_offset ! Offset in time for dataset (sec) type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldfilename_soilm ! ustar stream filename to read character(len=CL) :: soilm_tintalgo = 'linear' ! Time interpolation alogrithm - character(*), parameter :: subName = "('soil_moisture_init')" - character(*), parameter :: F00 = "('(soil_moisture_init) ',4a)" + character(*), parameter :: subName = "('PrescribedSoilMoistureInit')" + character(*), parameter :: F00 = "('(PrescribedSoilMoistureInit) ',4a)" character(*), parameter :: soilmString = "H2OSOI" ! base string for field string character(SHR_KIND_CXX) :: fldList ! field string !----------------------------------------------------------------------- ! ! deal with namelist variables here in init ! - namelist /soil_moisture_streams/ & - stream_year_first_soilm, & - stream_year_last_soilm, & - model_year_align_soilm, & - soilm_tintalgo, & + namelist /soil_moisture_streams/ & + stream_year_first_soilm, & + stream_year_last_soilm, & + model_year_align_soilm, & + soilm_tintalgo, & + soilm_offset, & + soilm_ignore_data_if_missing, & stream_fldfilename_soilm ! Default values for namelist - stream_year_first_soilm = 1 ! first year in stream to use - stream_year_last_soilm = 1 ! last year in stream to use - model_year_align_soilm = 1 ! align stream_year_first_soilm with this model year - stream_fldfilename_soilm = shr_stream_file_null + stream_year_first_soilm = 1 ! first year in stream to use + stream_year_last_soilm = 1 ! last year in stream to use + model_year_align_soilm = 1 ! align stream_year_first_soilm with this model year + stream_fldfilename_soilm = shr_stream_file_null + soilm_offset = 0 + soilm_ignore_data_if_missing = .false. ! Read soilm_streams namelist if (masterproc) then @@ -128,6 +140,8 @@ subroutine PrescribedSoilMoistureInit(bounds) call shr_mpi_bcast(model_year_align_soilm, mpicom) call shr_mpi_bcast(stream_fldfilename_soilm, mpicom) call shr_mpi_bcast(soilm_tintalgo, mpicom) + call shr_mpi_bcast(soilm_offset, mpicom) + call shr_mpi_bcast(soilm_ignore_data_if_missing, mpicom) if (masterproc) then @@ -138,6 +152,12 @@ subroutine PrescribedSoilMoistureInit(bounds) write(iulog,*) ' model_year_align_soilm = ',model_year_align_soilm write(iulog,*) ' stream_fldfilename_soilm = ',trim(stream_fldfilename_soilm) write(iulog,*) ' soilm_tintalgo = ',trim(soilm_tintalgo) + write(iulog,*) ' soilm_offset = ',soilm_offset + if ( soilm_ignore_data_if_missing )then + write(iulog,*) ' Do NOT override a point with streams data if the streams data is missing' + else + write(iulog,*) ' Abort, if you find a model point where the input streams data is set to missing value' + end if endif @@ -160,7 +180,7 @@ subroutine PrescribedSoilMoistureInit(bounds) yearFirst=stream_year_first_soilm, & yearLast=stream_year_last_soilm, & yearAlign=model_year_align_soilm, & - offset=0, & + offset=soilm_offset, & domFilePath='', & domFileName=trim(stream_fldFileName_soilm), & domTvarName='time', & @@ -186,6 +206,60 @@ subroutine PrescribedSoilMoistureInit(bounds) end subroutine PrescribedSoilMoistureInit + + !----------------------------------------------------------------------- + ! + ! PrescribedSoilMoistureAdvance + ! + !----------------------------------------------------------------------- + subroutine PrescribedSoilMoistureAdvance( bounds ) + ! + ! Advanace the prescribed soil moisture stream + ! + ! !USES: + use clm_time_manager, only : get_curr_date + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + character(len=CL) :: stream_var_name + integer :: g, ig + integer :: ier ! error code + integer :: year ! year (0, ...) for nstep+1 + integer :: mon ! month (1, ..., 12) for nstep+1 + integer :: day ! day of month (1, ..., 31) for nstep+1 + integer :: sec ! seconds into current date for nstep+1 + integer :: mcdate ! Current model date (yyyymmdd) + + call get_curr_date(year, mon, day, sec) + mcdate = year*10000 + mon*100 + day + + stream_var_name = 'H2OSOI' + + ! Determine variable index + ism = mct_aVect_indexRA(sdat_soilm%avs(1),trim(stream_var_name)) + + call shr_strdata_advance(sdat_soilm, mcdate, sec, mpicom, trim(stream_var_name)) + + ! Map gridcell to AV index + ier = 0 + if ( .not. allocated(g_to_ig) )then + allocate (g_to_ig(bounds%begg:bounds%endg), stat=ier) + if (ier /= 0) then + write(iulog,*) 'Prescribed soil moisture allocation error' + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + + ig = 0 + do g = bounds%begg,bounds%endg + ig = ig+1 + g_to_ig(g) = ig + end do + end if + + end subroutine PrescribedSoilMoistureAdvance + !----------------------------------------------------------------------- ! ! PrescribedSoilMoistureInterp @@ -199,8 +273,8 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & ! !USES: use clm_time_manager, only : get_curr_date use clm_varpar , only : nlevsoi - use clm_varcon , only : denh2o, denice, watmin - use landunit_varcon , only : istsoil + use clm_varcon , only : denh2o, denice, watmin, spval + use landunit_varcon , only : istsoil, istcrop ! ! !ARGUMENTS: implicit none @@ -209,67 +283,86 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst ! ! !LOCAL VARIABLES: - integer :: c, g, j, ism, ig, n - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - integer :: ier ! error code - integer, allocatable :: g_to_ig(:) + integer :: c, g, j, ig, n real(r8) :: soilm_liq_frac ! liquid fraction of soil moisture real(r8) :: soilm_ice_frac ! ice fraction of soil moisture real(r8) :: moisture_increment ! soil moisture adjustment increment real(r8) :: h2osoi_vol_initial ! initial vwc value - character(len=CL) :: stream_var_name + character(*), parameter :: subName = "('PrescribedSoilMoistureInterp')" !----------------------------------------------------------------------- + SHR_ASSERT_FL( (lbound(sdat_soilm%avs(1)%rAttr,1) == ism ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(sdat_soilm%avs(1)%rAttr,1) == ism ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(g_to_ig,1) <= bounds%begg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(g_to_ig,1) >= bounds%endg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(sdat_soilm%avs(1)%rAttr,2) <= g_to_ig(bounds%begg) ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(sdat_soilm%avs(1)%rAttr,2) >= g_to_ig(bounds%endg)+(nlevsoi-1)*size(g_to_ig) ), sourcefile, __LINE__) associate( & dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input/Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input/Output: [real(r8) (:,:) ] ice water (kg/m2) - h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Output: volumetric soil water (m3/m3) + h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input/Output: [real(r8) (:,:) ] liquid water (kg/m2) + h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input/Output: [real(r8) (:,:) ] ice water (kg/m2) + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col , & ! Output: volumetric soil water (m3/m3) + h2osoi_vol_prs => waterstatebulk_inst%h2osoi_vol_prs_grc & ! Output: prescribed volumetric soil water (m3/m3) ) + SHR_ASSERT_FL( (lbound(h2osoi_vol,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_vol,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_vol,2) == 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_vol,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(dz,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(dz,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(dz,2) <= 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(dz,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(watsat,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(watsat,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(watsat,2) <= 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(watsat,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_liq,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_liq,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_liq,2) <= 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_liq,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_ice,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_ice,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_ice,2) <= 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_ice,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_vol_prs,1) <= bounds%begg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_vol_prs,1) >= bounds%endg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_vol_prs,2) == 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_vol_prs,2) >= nlevsoi ), sourcefile, __LINE__) + ! + ! Set the prescribed soil moisture read from the file everywhere + ! + do g = bounds%begg, bounds%endg + ig = g_to_ig(g) + do j = 1, nlevsoi + + !n = ig + (j-1)*size(g_to_ig) + n = ig + (j-1)*size(g_to_ig) - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - stream_var_name = 'H2OSOI' - - ! Determine variable index - ism = mct_aVect_indexRA(sdat_soilm%avs(1),trim(stream_var_name)) - - call shr_strdata_advance(sdat_soilm, mcdate, sec, mpicom, trim(stream_var_name)) - - ! Map gridcell to AV index - ier = 0 - allocate (g_to_ig(bounds%begg:bounds%endg), stat=ier) - if (ier /= 0) then - write(iulog,*) 'Prescribed soil moisture allocation error' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - g_to_ig(g) = ig + h2osoi_vol_prs(g,j) = sdat_soilm%avs(1)%rAttr(ism,n) + + ! If soil moiture is being interpolated in time and the result is + ! large that probably means one of the two data points is missing (set to spval) + if ( h2osoi_vol_prs(g,j) > 10.0_r8 .and. (h2osoi_vol_prs(g,j) /= spval) )then + h2osoi_vol_prs(g,j) = spval + end if + + end do end do - ! Read data from stream into column level variable - do c = bounds%begc, bounds%endc - if(lun%itype(col%landunit(c)) == istsoil) then - ! - ! Set variable for each gridcell/column combination - ! - ig = g_to_ig(col%gridcell(c)) + ! + ! Set variable for each gridcell/column combination + ! + g = col%gridcell(c) + ig = g_to_ig(g) + if ( (lun%itype(col%landunit(c)) == istsoil) .or. (lun%itype(col%landunit(c)) == istcrop) ) then ! this is a 2d field (gridcell/nlevsoi) ! do j = 1, nlevsoi - n = ig + (j-1)*(bounds%endg-bounds%begg+1) + n = ig + (j-1)*size(g_to_ig) ! if soil water is zero, liq/ice fractions cannot be calculated if((h2osoi_liq(c, j) + h2osoi_ice(c, j)) > 0._r8) then @@ -277,8 +370,21 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & ! save original soil moisture value h2osoi_vol_initial = h2osoi_vol(c,j) - ! update volumetric soil moisture - h2osoi_vol(c,j) = sdat_soilm%avs(1)%rAttr(ism,n) + ! Check if the vegetated land mask from the dataset on the + ! file is different + if ( (h2osoi_vol_prs(g,j) == spval) .and. (h2osoi_vol_initial /= spval) )then + if ( soilm_ignore_data_if_missing )then + cycle + else + write(iulog,*) 'Input soil moisture dataset is not vegetated as expected: gridcell=', & + g, ' active = ', col%active(c) + call endrun(subname // ' ERROR:: The input soil moisture stream is NOT vegetated for one of the land points' ) + end if + end if + + ! update volumetric soil moisture from data prescribed from the file + h2osoi_vol(c,j) = h2osoi_vol_prs(g,j) + ! calculate liq/ice mass fractions soilm_liq_frac = h2osoi_liq(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) @@ -293,11 +399,13 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & h2osoi_liq(c,j) = h2osoi_liq(c,j) + (soilm_liq_frac * moisture_increment * dz(c, j) * denh2o) h2osoi_ice(c,j) = h2osoi_ice(c,j) + (soilm_ice_frac * moisture_increment * dz(c, j) * denice) + else + call endrun(subname // ':: ERROR h2osoil liquid plus ice is zero') endif enddo endif end do - deallocate (g_to_ig) + end associate end subroutine PrescribedSoilMoistureInterp diff --git a/src/biogeophys/UrbanTimeVarType.F90 b/src/biogeophys/UrbanTimeVarType.F90 index c23b5ff050..a340b4a3ff 100644 --- a/src/biogeophys/UrbanTimeVarType.F90 +++ b/src/biogeophys/UrbanTimeVarType.F90 @@ -124,6 +124,7 @@ subroutine urbantv_init(this, bounds, NLFilename) type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_urbantv ! urban tv streams filename character(len=CL) :: urbantvmapalgo = 'nn' ! mapping alogrithm for urban ac + character(len=CL) :: urbantv_tintalgo = 'linear' ! time interpolation alogrithm character(len=CL) :: fldList ! field string character(*), parameter :: urbantvString = "tbuildmax_" ! base string for field string character(*), parameter :: subName = "('urbantv_init')" @@ -134,7 +135,8 @@ subroutine urbantv_init(this, bounds, NLFilename) stream_year_last_urbantv, & model_year_align_urbantv, & urbantvmapalgo, & - stream_fldFileName_urbantv + stream_fldFileName_urbantv, & + urbantv_tintalgo !----------------------------------------------------------------------- begl = bounds%begl; endl = bounds%endl @@ -164,6 +166,7 @@ subroutine urbantv_init(this, bounds, NLFilename) call shr_mpi_bcast(stream_year_last_urbantv, mpicom) call shr_mpi_bcast(model_year_align_urbantv, mpicom) call shr_mpi_bcast(stream_fldFileName_urbantv, mpicom) + call shr_mpi_bcast(urbantv_tintalgo, mpicom) if (masterproc) then write(iulog,*) ' ' @@ -172,6 +175,7 @@ subroutine urbantv_init(this, bounds, NLFilename) write(iulog,*) ' stream_year_last_urbantv = ',stream_year_last_urbantv write(iulog,*) ' model_year_align_urbantv = ',model_year_align_urbantv write(iulog,*) ' stream_fldFileName_urbantv = ',stream_fldFileName_urbantv + write(iulog,*) ' urbantv_tintalgo = ',urbantv_tintalgo write(iulog,*) ' ' endif @@ -211,7 +215,7 @@ subroutine urbantv_init(this, bounds, NLFilename) fillalgo='none', & mapalgo=urbantvmapalgo, & calendar=get_calendar(), & - tintalgo='linear', & + tintalgo=urbantv_tintalgo, & taxmode='extend' ) if (masterproc) then diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index 468bd83b2b..891acd7ad1 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -35,6 +35,7 @@ module WaterStateType real(r8), pointer :: h2osoi_liq_col (:,:) ! col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) real(r8), pointer :: h2osoi_ice_col (:,:) ! col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd) real(r8), pointer :: h2osoi_vol_col (:,:) ! col volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) + real(r8), pointer :: h2osoi_vol_prs_grc (:,:) ! grc volumetric soil water prescribed (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) real(r8), pointer :: h2osfc_col (:) ! col surface water (mm H2O) real(r8), pointer :: snocan_patch (:) ! patch canopy snow water (mm H2O) real(r8), pointer :: liqcan_patch (:) ! patch canopy liquid water (mm H2O) @@ -118,6 +119,10 @@ subroutine InitAllocate(this, bounds, tracer_vars) container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & dim2beg = 1, dim2end = nlevgrnd) + call AllocateVar2d(var = this%h2osoi_vol_col, name = 'h2osoi_vol_prs_grc', & + container = tracer_vars, & + bounds = bounds, subgrid_level = BOUNDS_SUBGRID_GRIDCELL, & + dim2beg = 1, dim2end = nlevgrnd) call AllocateVar2d(var = this%h2osoi_ice_col, name = 'h2osoi_ice_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & @@ -155,6 +160,7 @@ subroutine InitHistory(this, bounds) ! ! !USES: use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal + use clm_varctl , only : use_soil_moisture_streams ! ! !ARGUMENTS: class(waterstate_type), intent(in) :: this @@ -178,6 +184,7 @@ subroutine InitHistory(this, bounds) avgflag='A', & long_name=this%info%lname('Snow liquid water content'), & ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') + data2dptr => this%h2osoi_liq_col(:,-nlevsno+1:0) data2dptr => this%h2osoi_ice_col(:,-nlevsno+1:0) call hist_addfld2d ( & @@ -195,6 +202,15 @@ subroutine InitHistory(this, bounds) long_name=this%info%lname('volumetric soil water (natural vegetated and crop landunits only)'), & ptr_col=this%h2osoi_vol_col, l2g_scale_type='veg') + if ( use_soil_moisture_streams )then + call hist_addfld2d ( & + fname=this%info%fname('H2OSOI_PRESCRIBED_GRC'), & + units='mm3/mm3', type2d='levsoi', & + avgflag='A', & + long_name=this%info%lname('volumetric soil water prescribed (vegetated landunits only)'), & + ptr_col=this%h2osoi_vol_prs_grc, l2g_scale_type='veg', default='inactive') + end if + ! this%h2osoi_liq_col(begc:endc,:) = spval ! call hist_addfld2d ( & ! fname=this%info%fname('SOILLIQ'), & @@ -312,6 +328,7 @@ subroutine InitCold(this, bounds, & ! and urban pervious road (other urban columns have zero soil water) this%h2osoi_vol_col(bounds%begc:bounds%endc, 1:) = spval + this%h2osoi_vol_prs_grc(bounds%begg:bounds%endg, 1:) = spval this%h2osoi_liq_col(bounds%begc:bounds%endc,-nlevsno+1:) = spval this%h2osoi_ice_col(bounds%begc:bounds%endc,-nlevsno+1:) = spval do c = bounds%begc,bounds%endc diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 69ccc85838..e7ebcf7e66 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -82,7 +82,7 @@ module clm_driver use clm_instMod use clm_instMod , only : soil_water_retention_curve use EDBGCDynMod , only : EDBGCDyn, EDBGCDynSummary - use SoilMoistureStreamMod , only : PrescribedSoilMoistureInterp + use SoilMoistureStreamMod , only : PrescribedSoilMoistureInterp, PrescribedSoilMoistureAdvance ! ! !PUBLIC TYPES: implicit none @@ -110,7 +110,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! the calling tree is given in the description of this module. ! ! !USES: - use clm_time_manager, only : get_curr_date + use clm_time_manager , only : get_curr_date + use clm_varctl , only : use_lai_streams + use SatellitePhenologyMod, only : lai_advance ! ! !ARGUMENTS: implicit none @@ -317,6 +319,15 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro glc_behavior) call t_stopf('dyn_subgrid') + ! ============================================================================ + ! If soil moisture is prescribed from data streams set it here + ! NOTE: This call needs to happen outside loops over nclumps (as streams are not threadsafe). + ! ============================================================================ + if (use_soil_moisture_streams) then + call t_startf('prescribed_sm') + call PrescribedSoilMoistureAdvance( bounds_proc ) + call t_stopf('prescribed_sm') + endif ! ============================================================================ ! Initialize the column-level mass balance checks for water, carbon & nitrogen. ! @@ -336,13 +347,12 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro do nc = 1,nclumps call get_clump_bounds(nc, bounds_clump) - if (use_soil_moisture_streams) then + if (use_soil_moisture_streams) then call t_startf('prescribed_sm') call PrescribedSoilMoistureInterp(bounds_clump, soilstate_inst, & water_inst%waterstatebulk_inst) call t_stopf('prescribed_sm') endif - call t_startf('begwbal') call BeginWaterBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & @@ -393,6 +403,12 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! Get time varying urban data call urbantv_inst%urbantv_interp(bounds_proc) + ! When LAI streams are being used + ! NOTE: This call needs to happen outside loops over nclumps (as streams are not threadsafe) + if ((.not. use_cn) .and. (.not. use_fates) .and. (doalb) .and. use_lai_streams) then + call lai_advance( bounds_proc ) + endif + ! ============================================================================ ! Initialize variables from previous time step, downscale atm forcings, and ! Determine canopy interception and precipitation onto ground surface. diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 4e47185063..79b0e2bec4 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -1094,7 +1094,7 @@ subroutine apply_use_init_interp(finidat_interp_dest, finidat, finidat_interp_so !----------------------------------------------------------------------- if (finidat == ' ') then - call endrun(msg=' ERROR: Can only set use_init_interp if finidat is set') + write(iulog,*)' WARNING: Setting use_init_interp has no effect if finidat is not also set' end if if (finidat_interp_source /= ' ') then diff --git a/src/main/ndepStreamMod.F90 b/src/main/ndepStreamMod.F90 index a0dd618227..7a4bc66ac5 100644 --- a/src/main/ndepStreamMod.F90 +++ b/src/main/ndepStreamMod.F90 @@ -71,6 +71,7 @@ subroutine ndep_init(bounds, NLFilename) type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_ndep character(len=CL) :: ndepmapalgo = 'bilinear' + character(len=CL) :: ndep_tintalgo = 'linear' character(len=CS) :: ndep_taxmode = 'extend' character(len=CL) :: ndep_varlist = 'NDEP_year' character(*), parameter :: shr_strdata_unset = 'NOT_SET' @@ -80,11 +81,12 @@ subroutine ndep_init(bounds, NLFilename) namelist /ndepdyn_nml/ & stream_year_first_ndep, & - stream_year_last_ndep, & + stream_year_last_ndep, & model_year_align_ndep, & ndepmapalgo, ndep_taxmode, & ndep_varlist, & - stream_fldFileName_ndep + stream_fldFileName_ndep, & + ndep_tintalgo ! Default values for namelist stream_year_first_ndep = 1 ! first year in stream to use @@ -115,6 +117,7 @@ subroutine ndep_init(bounds, NLFilename) call shr_mpi_bcast(stream_fldFileName_ndep, mpicom) call shr_mpi_bcast(ndep_varlist , mpicom) call shr_mpi_bcast(ndep_taxmode , mpicom) + call shr_mpi_bcast(ndep_tintalgo , mpicom) if (masterproc) then write(iulog,*) ' ' @@ -125,6 +128,7 @@ subroutine ndep_init(bounds, NLFilename) write(iulog,*) ' stream_fldFileName_ndep = ',stream_fldFileName_ndep write(iulog,*) ' ndep_varList = ',ndep_varList write(iulog,*) ' ndep_taxmode = ',ndep_taxmode + write(iulog,*) ' ndep_tintalgo = ',ndep_tintalgo write(iulog,*) ' ' endif ! Read in units @@ -156,8 +160,9 @@ subroutine ndep_init(bounds, NLFilename) fldListModel=ndep_varlist, & fillalgo='none', & mapalgo=ndepmapalgo, & + tintalgo=ndep_tintalgo, & calendar=get_calendar(), & - taxmode=ndep_taxmode ) + taxmode=ndep_taxmode ) if (masterproc) then diff --git a/test/tools/input_tests_master b/test/tools/input_tests_master index 90b8aa293a..eef1daf901 100644 --- a/test/tools/input_tests_master +++ b/test/tools/input_tests_master @@ -27,8 +27,8 @@ smi74 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-20 bli74 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds smi78 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds bli78 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds -smiT4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp24_2000^tools__ds -bliT4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp24_2000^tools__ds +smiT4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_crp_2000^tools__ds +bliT4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_crp_2000^tools__ds smiT2 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_crp_SSP5-8.5_1850-2100^tools__s bliT2 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_crp_SSP5-8.5_1850-2100^tools__s diff --git a/test/tools/test_driver.sh b/test/tools/test_driver.sh index 935b7d2dd2..39b945fcdc 100755 --- a/test/tools/test_driver.sh +++ b/test/tools/test_driver.sh @@ -219,7 +219,87 @@ export INC_NETCDF=\${NETCDF_PATH}/include export LIB_NETCDF=\${NETCDF_PATH}/lib export MAKE_CMD="gmake -j 5" ##using hyper-threading on hobart export MACH_WORKSPACE="/scratch/cluster" -export CPRNC_EXE=/fs/cgd/csm/tools/cprnc_hobart/cprnc +export CPRNC_EXE=/fs/cgd/csm/tools/cprnc/cprnc +export DATM_QIAN_DATA_DIR="/project/tss/atm_forcing.datm7.Qian.T62.c080727" +dataroot="/fs/cgd/csm" +export TOOLSSLIBS="" +echo_arg="-e" + +EOF +##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to batch script ^^^^^^^^^^^^^^^^^^^ + ;; + + ## izumi + izumi* | i*.unified.ucar.edu) + submit_script="test_driver_izumi_${cur_time}.sh" + export PATH=/cluster/torque/bin:${PATH} + +##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv writing to batch script vvvvvvvvvvvvvvvvvvv +cat > ./${submit_script} << EOF +#!/bin/sh +# + +# Name of the queue (CHANGE THIS if needed) +#PBS -q long +# Number of nodes (CHANGE THIS if needed) +#PBS -l nodes=1:ppn=24 +# output file base name +#PBS -N test_dr +# Put standard error and standard out in same file +#PBS -j oe +# Export all Environment variables +#PBS -V +# End of options + +if [ -n "\$PBS_JOBID" ]; then #batch job + export JOBID=\`echo \${PBS_JOBID} | cut -f1 -d'.'\` + initdir=\${PBS_O_WORKDIR} +fi + +if [ "\$PBS_ENVIRONMENT" = "PBS_BATCH" ]; then + interactive="NO" + input_file="tests_posttag_izumi" +else + interactive="YES" + input_file="tests_posttag_izumi_nompi" +fi + +##omp threads +if [ -z "\$CLM_THREADS" ]; then #threads NOT set on command line + export CLM_THREADS=2 +fi +export CLM_RESTART_THREADS=1 + +##mpi tasks +export CLM_TASKS=24 +export CLM_RESTART_TASKS=20 + +export P4_GLOBMEMSIZE=500000000 + + +export CESM_MACH="izumi" + +ulimit -s unlimited +ulimit -c unlimited + +export CESM_COMP="intel" +export TOOLS_MAKE_STRING="USER_FC=ifort USER_CC=icc " +export TOOLS_CONF_STRING=" -mpilib mpi-serial" +export CFG_STRING="" +export INITMODULES="/usr/share/Modules/init/sh" + +. \$INITMODULES +module purge +module load compiler/intel/19.0.1 +module load tool/nco/4.7.5 +module load tool/netcdf/4.6.1/intel + +export NETCDF_DIR=\$NETCDF_PATH +export INC_NETCDF=\${NETCDF_PATH}/include +export LIB_NETCDF=\${NETCDF_PATH}/lib +export MAKE_CMD="gmake -j 5" ##using hyper-threading on izumi +export MACH_WORKSPACE="/scratch/cluster" +export CPRNC_EXE=/fs/cgd/csm/tools/cprnc/cprnc.izumi export DATM_QIAN_DATA_DIR="/project/tss/atm_forcing.datm7.Qian.T62.c080727" dataroot="/fs/cgd/csm" export TOOLSSLIBS="" @@ -230,7 +310,7 @@ EOF ;; * ) - echo "Only setup to work on: cheyenne and hobart" + echo "Only setup to work on: cheyenne, hobart and izumi" exit @@ -542,7 +622,7 @@ case $arg1 in * ) echo "" echo "**********************" - echo "usage on cheyenne and hobart: " + echo "usage on cheyenne, hobart, and izumi: " echo "./test_driver.sh -i" echo "" echo "valid arguments: " diff --git a/test/tools/tests_posttag_izumi_nompi b/test/tools/tests_posttag_izumi_nompi new file mode 100644 index 0000000000..4655f29853 --- /dev/null +++ b/test/tools/tests_posttag_izumi_nompi @@ -0,0 +1,6 @@ +smc#4 blc#4 +smi54 bli54 +smi57 bli57 +smiT4 bliT4 +smf84 blf84 +smfc4 blfc4 diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index 02d52fe6d7..d0691a9817 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -343,7 +343,7 @@ case $hostname in REGRID_PROC=36 fi esmfvers=7.1.0r - intelvers=17.0.1 + intelvers=18.0.5 # Could also use intel/19.0.2 EBK 10/4/2019 module load esmf_libs/$esmfvers module load intel/$intelvers module load ncl diff --git a/tools/mksurfdata_map/mksurfdata.pl b/tools/mksurfdata_map/mksurfdata.pl index 3f7512254e..a1815ecbd9 100755 --- a/tools/mksurfdata_map/mksurfdata.pl +++ b/tools/mksurfdata_map/mksurfdata.pl @@ -395,6 +395,7 @@ sub write_namelist_file { } if ( defined($opts{'pft_override'}) ) { print $fh <<"EOF"; + all_veg = .true. pft_frc = $opts{'pft_frc'} pft_idx = $opts{'pft_idx'} EOF diff --git a/tools/mksurfdata_map/src/CMakeLists.txt b/tools/mksurfdata_map/src/CMakeLists.txt index 0cf2ca90b0..3179c3cdc9 100644 --- a/tools/mksurfdata_map/src/CMakeLists.txt +++ b/tools/mksurfdata_map/src/CMakeLists.txt @@ -11,16 +11,27 @@ include(CIME_utils) # Build library containing stuff needed for the unit tests list(APPEND mksurfdat_sources shr_kind_mod.F90 + shr_log_mod.F90 + nanMod.F90 + shr_string_mod.F90 + fileutils.F90 + shr_timer_mod.F90 + shr_file_mod.F90 mkgridmapMod.F90 mkindexmapMod.F90 mkpftConstantsMod.F90 mkpctPftTypeMod.F90 + mkpftMod.F90 + mkdomainMod.F90 + mkgridmapMod.F90 mkutilsMod.F90 mkpftUtilsMod.F90 mksoilUtilsMod.F90 mkvarctl.F90 mkvarpar.F90 shr_const_mod.F90 + shr_sys_mod.F90 + unit_test_stubs/abort.F90 unit_test_stubs/mkncdio.F90) add_library(mksurfdat ${mksurfdat_sources}) @@ -29,4 +40,4 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) link_directories(${CMAKE_CURRENT_BINARY_DIR}) # Add the test directory -add_subdirectory(test) \ No newline at end of file +add_subdirectory(test) diff --git a/tools/mksurfdata_map/src/mkdomainMod.F90 b/tools/mksurfdata_map/src/mkdomainMod.F90 index 94cc2594ec..1a66c0f4c5 100644 --- a/tools/mksurfdata_map/src/mkdomainMod.F90 +++ b/tools/mksurfdata_map/src/mkdomainMod.F90 @@ -49,6 +49,7 @@ module mkdomainMod public domain_read_map public domain_write public domain_checksame + public for_test_create_domain ! For unit testing create a simple domain ! ! ! !REVISION HISTORY: @@ -916,7 +917,46 @@ subroutine domain_checksame( srcdomain, dstdomain, tgridmap ) call abort() end if end do - end subroutine domain_checksame +!----------------------------------------------------------------------- +!BOP +! +! !IROUTINE: for_test_create_domain +! +! !INTERFACE: + subroutine for_test_create_domain( domain ) +! +! !DESCRIPTION: +! Create a simple domain for unit testing +! +! USES: + implicit none +! !ARGUMENTS: + type(domain_type), intent(inout) :: domain ! input domain +! !LOCAL VARIABLES: + integer, parameter :: ns_o = 2 + + call domain_init( domain, ns_o ) + domain%latc = (/ 42.0_r8, 40.0_r8 /) + domain%lonc = (/ -105.0_r8, -100.0_r8 /) + domain%latn = (/ 43.0_r8, 41.0_r8 /) + domain%lats = (/ 41.0_r8, 39.0_r8 /) + domain%lone = (/ -104.0_r8, -99.0_r8 /) + domain%lonw = (/ -106.0_r8, -101.0_r8 /) + domain%mask = (/ 1, 1 /) + domain%frac = (/ 1.0_r8, 1.0_r8 /) + domain%area = (/ 49284.0_r8, 49284.0_r8 /) ! This is NOT the correct area! + + domain%edgen = maxval( domain%latn ) + domain%edges = minval( domain%lats ) + domain%edgew = minval( domain%lonw ) + domain%edgee = maxval( domain%lone ) + + domain%maskset = .true. + domain%fracset = .true. + domain%is_2d = .false. + + end subroutine for_test_create_domain + end module mkdomainMod diff --git a/tools/mksurfdata_map/src/mkpftConstantsMod.F90 b/tools/mksurfdata_map/src/mkpftConstantsMod.F90 index 0355f9b696..241873c339 100644 --- a/tools/mksurfdata_map/src/mkpftConstantsMod.F90 +++ b/tools/mksurfdata_map/src/mkpftConstantsMod.F90 @@ -23,7 +23,7 @@ module mkpftConstantsMod integer, parameter, public :: maxpft = 78 ! maximum # of PFT - integer, public :: num_natpft ! number of PFTs on the natural vegetation + integer, public :: num_natpft = -1 ! number of PFTs on the natural vegetation ! landunit, NOT including bare ground ! (includes generic crops for runs with ! create_crop_landunit=false) diff --git a/tools/mksurfdata_map/src/mkpftMod.F90 b/tools/mksurfdata_map/src/mkpftMod.F90 index fb86543944..35928af530 100644 --- a/tools/mksurfdata_map/src/mkpftMod.F90 +++ b/tools/mksurfdata_map/src/mkpftMod.F90 @@ -15,6 +15,7 @@ module mkpftMod !!USES: use shr_kind_mod, only : r8 => shr_kind_r8 use shr_sys_mod , only : shr_sys_flush + use mkvarpar , only : noveg use mkvarctl , only : numpft use mkdomainMod , only : domain_checksame use mkpftConstantsMod @@ -47,9 +48,28 @@ module mkpftMod ! ! !PRIVATE DATA MEMBERS: ! - logical, private :: zero_out = .false. ! Flag to zero out PFT - logical, private :: use_input_pft = .false. ! Flag to override PFT with input values - integer, private :: nzero ! index of first zero fraction + logical, public, protected :: use_input_pft = .false. ! Flag to override PFT with input values + logical, public, protected :: presc_cover = .false. ! Flag to prescribe vegetation coverage + integer, private :: nzero ! index of first zero fraction + + type, public :: pft_oride ! Public only for unit testing + real(r8) :: crop ! Percent covered by crops + real(r8) :: natveg ! Percent covered by natural vegetation + real(r8), allocatable :: natpft(:) ! Percent of each natural PFT within the natural veg landunit + real(r8), allocatable :: cft(:) ! Percent of each crop CFT within the crop landunit + contains + procedure, public :: InitZeroOut ! Initialize the PFT override object to zero out all vegetation + procedure, public :: InitAllPFTIndex ! Initialize the PFT override object with PFT indeces for all veg and crop types + procedure, public :: Clean ! Clean up a PFT Override object + end type pft_oride + + interface pft_oride + module procedure :: constructor ! PFT Overide object constructor + end interface pft_oride + + type(pft_oride), private :: pft_override ! Module instance of PFT override object + ! Used for both zeroing out PFT's as well + ! as setting specified PFT's over the gridcell ! ! !PRIVATE MEMBER FUNCTIONS: ! @@ -65,7 +85,7 @@ module mkpftMod ! !IROUTINE: mkpftInit ! ! !INTERFACE: -subroutine mkpftInit( zero_out_l, all_veg ) +subroutine mkpftInit( zero_out_l, all_veg_l ) ! ! !DESCRIPTION: ! Initialize of Make PFT data @@ -74,9 +94,9 @@ subroutine mkpftInit( zero_out_l, all_veg ) ! ! !ARGUMENTS: implicit none - logical, intent(IN) :: zero_out_l ! If veg should be zero'ed out - logical, intent(OUT) :: all_veg ! If should zero out other fractions so that - ! all land-cover is vegetation + logical, intent(IN) :: zero_out_l ! If veg should be zero'ed out + logical, intent(IN) :: all_veg_l ! If should zero out other fractions so that + ! all land-cover is vegetation ! ! !CALLED FROM: ! subroutine mksrfdat in module mksrfdatMod @@ -89,28 +109,48 @@ subroutine mkpftInit( zero_out_l, all_veg ) !EOP real(r8), parameter :: hndrd = 100.0_r8 ! A hundred percent character(len=32) :: subname = 'mkpftMod::mkpftInit() ' + logical :: error_happened ! If an error was triggered so should return !----------------------------------------------------------------------- write (6, '(a, a, a)') "In ", trim(subname), "..." - call mkpft_check_oride( ) + if ( maxpft < numpft ) then + write(6,*) subname//'number PFT is > max allowed!' + call abort() + return + end if + nzero = -1 + call mkpft_check_oride( error_happened ) + if ( error_happened )then + write(6,*) subname//'Problem setting pft override settings' + return + end if + if ( zero_out_l .and. use_input_pft )then + write(6,*) subname//"trying to both zero out all PFT's as well as set them to specific values" + call abort() + return + end if + ! If zeroing out, set use_input_pft to true so the pft_override will be used + if( zero_out_l )then + nzero = 0 + pft_frc(0) = 0.0_r8 + pft_idx(0) = noveg + use_input_pft = .true. + end if if ( use_input_pft ) then - if ( maxpft < numpft ) then - write(6,*) subname//'number PFT is > max allowed!' - call abort() - end if - write(6,*) 'Set PFT fraction to : ', pft_frc(0:nzero-1) - write(6,*) 'With PFT index : ', pft_idx(0:nzero-1) + write(6,*) 'Set PFT fraction to : ', pft_frc(0:nzero) + write(6,*) 'With PFT index : ', pft_idx(0:nzero) + end if + if ( all_veg_l .and. .not. use_input_pft )then + write(6,*) subname//'if all_veg is set to true then specified PFT indices must be provided (i.e. pft_frc and pft_idx)' + call abort() + return end if - all_veg = use_input_pft - - if ( zero_out_l .and. all_veg )then + if ( zero_out_l .and. all_veg_l )then write(6,*) subname//'zeroing out vegetation and setting vegetation to 100% is a contradiction!' call abort() + return end if - ! Copy local zero out to module data version - zero_out = zero_out_l - ! Determine number of PFTs on the natural vegetation landunit, and number of CFTs on ! the crop landunit. ! @@ -128,7 +168,7 @@ subroutine mkpftInit( zero_out_l, all_veg ) ! these are set up so that they always span 0:numpft, so that there is a 1:1 ! correspondence between an element in a full 0:numpft array and an element with the ! same index in either a natpft array or a cft array. - natpft_lb = 0 + natpft_lb = noveg natpft_ub = num_natpft cft_lb = num_natpft+1 cft_ub = cft_lb + num_cft - 1 @@ -138,6 +178,29 @@ subroutine mkpftInit( zero_out_l, all_veg ) if (cft_ub /= numpft) then write(6,*) 'CFT_UB set up incorrectly: cft_ub, numpft = ', cft_ub, numpft call abort() + return + end if + ! + ! Set the PFT override values if applicable + ! + pft_override = pft_oride() + presc_cover = .false. + if( zero_out_l )then + call pft_override%InitZeroOut() + presc_cover = .true. + else if ( use_input_pft ) then + call pft_override%InitAllPFTIndex() + if ( .not. all_veg_l )then + if ( pft_override%crop <= 0.0 )then + write(6,*) "Warning: PFT/CFT's are being overridden, but no crop type is being asked for" + end if + if ( pft_override%natveg <= 0.0 )then + write(6,*) "Warning: PFT/CFT's are being overridden, but no natural vegetation type is being asked for" + end if + presc_cover = .false. + else + presc_cover = .true. + end if end if end subroutine mkpftInit @@ -148,9 +211,8 @@ end subroutine mkpftInit ! !IROUTINE: mkpft ! ! !INTERFACE: -subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & - pctlnd_o, pctnatpft_o, pctcft_o, & - pctcft_o_saved) +subroutine mkpft(ldomain, mapfname, fpft, ndiag, & + pctlnd_o, pctnatpft_o, pctcft_o) ! ! !DESCRIPTION: ! Make PFT data @@ -165,14 +227,6 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & ! Upon return from this routine, the % cover of the natural veg + crop landunits is ! generally 100% everywhere; this will be normalized later to account for special landunits. ! -! If allow_no_crops is true, then we allow the input dataset to have no prognostic crop -! information (i.e., only contain information about the "standard" PFTs). In this case, -! pctcft_o_saved MUST be given. If the input dataset is found to not have information -! about the prognostic crops, then we take the generic c3 crop cover from the input -! dataset to specify the crop landunit area, and we take the individual crop breakdown -! from pctcft_o_saved (which will generally have come from some other input dataset that -! DID contain prognostic crop information). -! ! !USES: use mkdomainMod, only : domain_type, domain_clean, domain_read use mkgridmapMod @@ -189,13 +243,9 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & character(len=*) , intent(in) :: mapfname ! input mapping file name character(len=*) , intent(in) :: fpft ! input pft dataset file name integer , intent(in) :: ndiag ! unit number for diag out - logical , intent(in) :: allow_no_crops ! if it's okay to not have prognostic crops in the input file real(r8) , intent(out):: pctlnd_o(:) ! output grid:%land/gridcell type(pct_pft_type), intent(out):: pctnatpft_o(:) ! natural PFT cover type(pct_pft_type), intent(out):: pctcft_o(:) ! crop (CFT) cover - -! saved crop cover information, in case the input dataset does not contain information about prognostic crops - type(pct_pft_type), intent(in), optional :: pctcft_o_saved(:) ! ! !CALLED FROM: ! subroutine mksrfdat in module mksrfdatMod @@ -236,9 +286,9 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & integer :: ndims ! number of dimensions for a variable on the file integer :: dimlens(3) ! dimension lengths for a variable on the file integer :: ier ! error status - logical :: missing_crops ! if we need prognostic crop info, but the input dataset is missing this crop info real(r8) :: relerr = 0.0001_r8 ! max error: sum overlap wts ne 1 logical :: oldformat ! if input file is in the old format or not (based on what variables exist) + logical :: error_happened ! If an error was triggered so should return character(len=35) veg(0:maxpft) ! vegetation types character(len=32) :: subname = 'mkpftMod::mkpft()' @@ -249,16 +299,6 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & write (6,*) 'Attempting to make PFTs .....' call shr_sys_flush(6) - if (allow_no_crops) then - if (.not. present(pctcft_o_saved)) then - write(6,*) subname, ' ERROR: when allow_no_crops is true, pctcft_o_saved must be given' - call abort() - end if - end if - - ! Start by assuming the input dataset is NOT missing crop info - missing_crops = .false. - ! ----------------------------------------------------------------- ! Set the vegetation types ! ----------------------------------------------------------------- @@ -351,15 +391,15 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & else write(6,*) subname//': parameter numpft is NOT set to a known value (should be 16 or more) =',numpft call abort() + return end if + ns_o = ldomain%ns + ! ----------------------------------------------------------------- ! Read input PFT file ! ----------------------------------------------------------------- - - ns_o = ldomain%ns - - if ( .not. use_input_pft ) then + if ( .not. presc_cover ) then ! Obtain input grid info, read PCT_PFT call domain_read(tdomain,fpft) @@ -371,62 +411,57 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & ! Check what variables exist to determine what format the file is in call check_ret(nf_inq_varid (ncid, 'PCT_PFT', varid), subname, varexists=oldformat) - if ( .not. oldformat ) then - call check_ret(nf_inq_dimid (ncid, 'natpft', dimid), subname) - call check_ret(nf_inq_dimlen (ncid, dimid, natpft_i), subname) - call check_ret(nf_inq_dimid (ncid, 'cft', dimid), subname) - call check_ret(nf_inq_dimlen (ncid, dimid, ncft_i), subname) - numpft_i = natpft_i + ncft_i - else - call check_ret(nf_inq_dimid (ncid, 'pft', dimid), subname) - call check_ret(nf_inq_dimlen (ncid, dimid, numpft_i), subname) + if ( oldformat ) then + write(6,*) subname//' ERROR: PCT_PFT field on the the file so it is in the old format, which is no longer supported' + call abort() + return end if + call check_ret(nf_inq_dimid (ncid, 'natpft', dimid), subname) + call check_ret(nf_inq_dimlen (ncid, dimid, natpft_i), subname) + call check_ret(nf_inq_dimid (ncid, 'cft', dimid), subname) + call check_ret(nf_inq_dimlen (ncid, dimid, ncft_i), subname) + numpft_i = natpft_i + ncft_i ! Check if the number of pfts on the input matches the expected number. A mismatch - ! is okay in the case that the input has the standard number of pfts (i.e., no - ! prognostic crop info), if allow_no_crops is true. Otherwise, a mismatch is an error. + ! is okay if the input raw dataset has prognostic crops and the output does not. if (numpft_i .ne. numpft+1) then if (numpft_i .eq. numstdpft+1) then - if (allow_no_crops) then - write(6,*) subname//': using non-crop input file for a surface dataset with crops' - write(6,*) "(this is okay: we'll use the saved crop breakdown from the non-transient input file)" - missing_crops = .true. - else - write(6,*) subname//' ERROR: trying to use non-crop input file' - write(6,*) 'for a surface dataset with crops, but allow_no_crops is false' - write(6,*) "(This can happen if you're trying to use a non-crop input file" - write(6,*) "for the surface dataset itself: a non-crop input file is only" - write(6,*) "allowed for the transient PFT information.)" - call abort() - end if - else if (numpft_i > numstdpft+1 .and. numpft_i == maxpft+1 .and. .not. oldformat) then + write(6,*) subname//' ERROR: trying to use non-crop input file' + write(6,*) 'for a surface dataset with crops.' + call abort() + return + else if (numpft_i > numstdpft+1 .and. numpft_i == maxpft+1) then write(6,*) subname//' WARNING: using a crop input raw dataset for a non-crop output surface dataset' else write(6,*) subname//': parameter numpft+1= ',numpft+1, & 'does not equal input dataset numpft= ',numpft_i call abort() + return end if endif ! If file is in the new format, expect the following variables: ! PCT_NATVEG, PCT_CROP, PCT_NAT_PFT, PCT_CFT - if ( .not. oldformat )then - allocate(pctnatveg_i(ns_i), & - pctnatveg_o(ns_o), & - pctcrop_i(ns_i), & - pctcrop_o(ns_o), & - pct_cft_i(ns_i,1:num_cft), & - pct_cft_o(ns_o,1:num_cft), & - pct_nat_pft_i(ns_i,0:num_natpft), & - pct_nat_pft_o(ns_o,0:num_natpft), & - stat=ier) - if (ier/=0) call abort() - - call check_ret(nf_inq_varid (ncid, 'PCT_NATVEG', varid), subname) - call check_ret(nf_get_var_double (ncid, varid, pctnatveg_i), subname) - call check_ret(nf_inq_varid (ncid, 'PCT_CROP', varid), subname) - call check_ret(nf_get_var_double (ncid, varid, pctcrop_i), subname) + allocate(pctnatveg_i(ns_i), & + pctnatveg_o(ns_o), & + pctcrop_i(ns_i), & + pctcrop_o(ns_o), & + pct_cft_i(ns_i,1:num_cft), & + pct_cft_o(ns_o,1:num_cft), & + pct_nat_pft_i(ns_i,0:num_natpft), & + pct_nat_pft_o(ns_o,0:num_natpft), & + stat=ier) + if (ier/=0)then + call abort() + return + end if + + call check_ret(nf_inq_varid (ncid, 'PCT_NATVEG', varid), subname) + call check_ret(nf_get_var_double (ncid, varid, pctnatveg_i), subname) + call check_ret(nf_inq_varid (ncid, 'PCT_CROP', varid), subname) + call check_ret(nf_get_var_double (ncid, varid, pctcrop_i), subname) + if ( .not. use_input_pft )then call check_ret(nf_inq_varid (ncid, 'PCT_CFT', varid), subname) call get_dim_lengths(ncid, 'PCT_CFT', ndims, dimlens(:) ) if ( ndims == 3 .and. dimlens(1)*dimlens(2) == ns_i .and. dimlens(3) == num_cft )then @@ -446,59 +481,56 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & else write(6,*) subname//': ERROR: dimensions for PCT_CROP are NOT what is expected' call abort() + return end if call check_ret(nf_inq_varid (ncid, 'PCT_NAT_PFT', varid), subname) call check_ret(nf_get_var_double (ncid, varid, pct_nat_pft_i), subname) - - ! Read in from the old format with PCT_PFT alone - else - allocate(pctpft_i(ns_i,0:(numpft_i-1)), & - pctpft_o(ns_o,0:(numpft_i-1)), & - stat=ier) - if (ier/=0) call abort() - - call check_ret(nf_inq_varid (ncid, 'PCT_PFT', varid), subname) - call check_ret(nf_get_var_double (ncid, varid, pctpft_i), subname) end if call check_ret(nf_close(ncid), subname) + ! ----------------------------------------------------------------- + ! Otherwise if vegetation is prescribed everywhere + ! ----------------------------------------------------------------- else - oldformat = .true. ns_i = 1 numpft_i = numpft+1 - allocate(pctpft_o(ns_o,0:numpft), stat=ier) - if (ier/=0) call abort() + allocate(pctnatveg_i(ns_i), & + pctnatveg_o(ns_o), & + pctcrop_i(ns_i), & + pctcrop_o(ns_o), & + pct_cft_i(ns_i,1:num_cft), & + pct_cft_o(ns_o,1:num_cft), & + pct_nat_pft_i(ns_i,0:num_natpft), & + pct_nat_pft_o(ns_o,0:num_natpft), & + stat=ier) + if (ier/=0)then + call abort() + return + end if + end if + allocate(pctpft_i(ns_i,0:(numpft_i-1)), & + pctpft_o(ns_o,0:(numpft_i-1)), & + pctnatpft_i(ns_i), & + pctcft_i(ns_i), & + stat=ier) + if (ier/=0)then + call abort() + return end if ! Determine pctpft_o on output grid - if ( zero_out ) then - - pctpft_o(:,:) = 0._r8 - pctlnd_o(:) = 100._r8 - pctnatveg_o(:) = 0._r8 - pctcrop_o(:) = 0._r8 - pct_nat_pft_o(:,:) = 0._r8 - pct_nat_pft_o(:,0) = 100._r8 - pct_cft_o(:,:) = 0._r8 - pct_cft_o(:,1) = 100._r8 - - else if ( use_input_pft ) then + ! If total vegetation cover is prescribed from input... + if ( use_input_pft .and. presc_cover ) then - call mkpft_check_oride( ) - - ! set PFT based on input pft_frc and pft_idx - pctpft_o(:,:) = 0._r8 - pctlnd_o(:) = 100._r8 - do m = 0, numpft - ! Once reach a PFT where fraction goes to zero -- exit - if ( pft_frc(m) .eq. 0.0_r8 ) exit - do no = 1,ns_o - pctpft_o(no,pft_idx(m)) = pft_frc(m) - end do + do no = 1,ns_o + pctlnd_o(no) = 100._r8 + pctnatveg_o(no) = pft_override%natveg + pctcrop_o(no) = pft_override%crop end do + ! otherewise if total cover isn't prescribed read it from the datasets else ! Compute pctlnd_o, pctpft_o @@ -519,10 +551,13 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & end do ! New format with extra variables on input - if ( .not. oldformat ) then - call gridmap_areaave(tgridmap, pctnatveg_i, pctnatveg_o, nodata=0._r8) - call gridmap_areaave(tgridmap, pctcrop_i, pctcrop_o, nodata=0._r8) + call gridmap_areaave(tgridmap, pctnatveg_i, pctnatveg_o, nodata=0._r8) + call gridmap_areaave(tgridmap, pctcrop_i, pctcrop_o, nodata=0._r8) + ! + ! If specific PFT/CFT's are NOT prescribed set them from the input file + ! + if ( .not. use_input_pft )then do m = 0, num_natpft call gridmap_areaave_scs(tgridmap, pct_nat_pft_i(:,m), pct_nat_pft_o(:,m), & nodata=0._r8,src_wt=pctnatveg_i*0.01_r8,dst_wt=pctnatveg_o*0.01_r8) @@ -549,131 +584,120 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & end if enddo end do - ! Old format with just PCTPFT + ! Otherwise do some error checking to make sure specific veg types are given where nat-veg and crop is assigned else - do m = 0, numpft_i - 1 - call gridmap_areaave(tgridmap, pctpft_i(:,m), pctpft_o(:,m), nodata=0._r8) - do no = 1,ns_o - if (pctlnd_o(no) < 1.0e-6) then - if (m == 0) then - pctpft_o(no,m) = 100._r8 - else - pctpft_o(no,m) = 0._r8 - endif + do no = 1,ns_o + if (pctlnd_o(no) > 1.0e-6 .and. pctnatveg_o(no) > 1.0e-6) then + if ( pft_override%natveg <= 0.0_r8 )then + write(6,*) subname//': ERROR: no natural vegetation PFTs are being prescribed but there are natural '// & + 'vegetation areas: provide at least one natural veg PFT' + call abort() + return end if - enddo - enddo + end if + if (pctlnd_o(no) > 1.0e-6 .and. pctcrop_o(no) > 1.0e-6) then + if ( pft_override%crop <= 0.0_r8 )then + write(6,*) subname//': ERROR: no crop CFTs are being prescribed but there are crop areas: provide at least one CFT' + call abort() + return + end if + end if + end do end if + end if + ! + ! If specific PFT/CFT's are prescribed set them directly + ! + if ( use_input_pft )then + do no = 1,ns_o + if (pctlnd_o(no) > 1.0e-6 .and. pctnatveg_o(no) > 1.0e-6) then + pct_nat_pft_o(no,noveg:num_natpft) = pft_override%natpft(noveg:num_natpft) + else + pct_nat_pft_o(no,noveg) = 100._r8 + pct_nat_pft_o(no,noveg+1:) = 0._r8 + end if + if (pctlnd_o(no) > 1.0e-6 .and. pctcrop_o(no) > 1.0e-6) then + pct_cft_o(no,1:num_cft) = pft_override%cft(1:num_cft) + else + pct_cft_o(no,1) = 100._r8 + pct_cft_o(no,2:) = 0._r8 + end if + pctpft_o(no,natpft_lb:natpft_ub) = pct_nat_pft_o(no,0:num_natpft) + pctpft_o(no,cft_lb:cft_ub) = pct_cft_o(no,1:num_cft) + end do end if + ! Error check: percents should sum to 100 for land grid cells, within roundoff ! Also correct sums so that if they differ slightly from 100, they are corrected to ! equal 100 more exactly. - if ( (.not. zero_out) .and. oldformat) then - do no = 1,ns_o - wst_sum = 0. - do m = 0, numpft_i - 1 - wst_sum = wst_sum + pctpft_o(no,m) - enddo - if (abs(wst_sum-100._r8) > relerr) then - write (6,*) subname//'error: pft = ', & - (pctpft_o(no,m), m = 0, numpft_i-1), & - ' do not sum to 100. at no = ',no,' but to ', wst_sum - stop - end if - - ! Correct sum so that if it differs slightly from 100, it is corrected to equal - ! 100 more exactly - do m = 0, numpft_i - 1 - pctpft_o(no,m) = pctpft_o(no,m) * 100._r8 / wst_sum - end do + do no = 1,ns_o + wst_sum = 0. + do m = 0, num_natpft + wst_sum = wst_sum + pct_nat_pft_o(no,m) + enddo + if (abs(wst_sum-100._r8) > relerr) then + write (6,*) subname//'error: nat pft = ', & + (pct_nat_pft_o(no,m), m = 0, num_natpft), & + ' do not sum to 100. at no = ',no,' but to ', wst_sum + stop + end if + ! Correct sum so that if it differs slightly from 100, it is corrected to equal + ! 100 more exactly + do m = 1, num_natpft + pct_nat_pft_o(no,m) = pct_nat_pft_o(no,m) * 100._r8 / wst_sum end do - else if ( (.not. zero_out) .and. (.not. oldformat) ) then - do no = 1,ns_o - wst_sum = 0. - do m = 0, num_natpft - wst_sum = wst_sum + pct_nat_pft_o(no,m) - enddo - if (abs(wst_sum-100._r8) > relerr) then - write (6,*) subname//'error: nat pft = ', & - (pct_nat_pft_o(no,m), m = 0, num_natpft), & - ' do not sum to 100. at no = ',no,' but to ', wst_sum - stop - end if - - ! Correct sum so that if it differs slightly from 100, it is corrected to equal - ! 100 more exactly - do m = 1, num_natpft - pct_nat_pft_o(no,m) = pct_nat_pft_o(no,m) * 100._r8 / wst_sum - end do - - wst_sum = 0. - do m = 1, num_cft - wst_sum = wst_sum + pct_cft_o(no,m) - enddo - if (abs(wst_sum-100._r8) > relerr) then - write (6,*) subname//'error: crop cft = ', & - (pct_cft_o(no,m), m = 1, num_cft), & - ' do not sum to 100. at no = ',no,' but to ', wst_sum - stop - end if - ! Correct sum so that if it differs slightly from 100, it is corrected to equal - ! 100 more exactly - do m = 1, num_cft - pct_cft_o(no,m) = pct_cft_o(no,m) * 100._r8 / wst_sum - end do + wst_sum = 0. + do m = 1, num_cft + wst_sum = wst_sum + pct_cft_o(no,m) + enddo + if (abs(wst_sum-100._r8) > relerr) then + write (6,*) subname//'error: crop cft = ', & + (pct_cft_o(no,m), m = 1, num_cft), & + ' do not sum to 100. at no = ',no,' but to ', wst_sum + stop + end if + ! Correct sum so that if it differs slightly from 100, it is corrected to equal + ! 100 more exactly + do m = 1, num_cft + pct_cft_o(no,m) = pct_cft_o(no,m) * 100._r8 / wst_sum end do - end if + + end do ! Convert % pft as % of grid cell to % pft on the landunit and % of landunit on the ! grid cell - if (missing_crops) then - do no = 1,ns_o - call convert_from_p2g(pct_p2g=pctpft_o(no,:), pctcft_saved=pctcft_o_saved(no), & - pctnatpft=pctnatpft_o(no), pctcft=pctcft_o(no)) - end do - else if ( .not. oldformat ) then - do no = 1,ns_o - pctnatpft_o(no) = pct_pft_type( pct_nat_pft_o(no,:), pctnatveg_o(no), first_pft_index=natpft_lb ) - pctcft_o(no) = pct_pft_type( pct_cft_o(no,:), pctcrop_o(no), first_pft_index=cft_lb ) - end do - else - do no = 1,ns_o - call convert_from_p2g(pct_p2g=pctpft_o(no,:), & - pctnatpft=pctnatpft_o(no), pctcft=pctcft_o(no)) - end do - end if + do no = 1,ns_o + pctnatpft_o(no) = pct_pft_type( pct_nat_pft_o(no,:), pctnatveg_o(no), first_pft_index=natpft_lb ) + pctcft_o(no) = pct_pft_type( pct_cft_o(no,:), pctcrop_o(no), first_pft_index=cft_lb ) + end do ! ----------------------------------------------------------------- ! Error check ! Compare global areas on input and output grids + ! Only when you aren't prescribing the vegetation coverage everywhere + ! If use_input_pft is set this will compare the global coverage of + ! the prescribed vegetation to the coverage of PFT/CFT's on the input + ! datasets. ! ----------------------------------------------------------------- - if ( .not. (zero_out .or. use_input_pft) ) then + if ( .not. presc_cover ) then ! Convert to pctpft over grid if using new format - if ( .not. oldformat ) then - allocate(pctpft_i(ns_i,0:(numpft_i-1)), & - pctpft_o(ns_o,0:(numpft_i-1)), & - pctnatpft_i(ns_i), & - pctcft_i(ns_i), & - stat=ier) - if (ier/=0) call abort() - do ni = 1, ns_i - pctnatpft_i(ni) = pct_pft_type( pct_nat_pft_i(ni,:), pctnatveg_i(ni), first_pft_index=natpft_lb ) - pctcft_i(ni) = pct_pft_type( pct_cft_i(ni,:), pctcrop_i(ni), first_pft_index=cft_lb ) - end do + do ni = 1, ns_i + pctnatpft_i(ni) = pct_pft_type( pct_nat_pft_i(ni,:), pctnatveg_i(ni), first_pft_index=natpft_lb ) + pctcft_i(ni) = pct_pft_type( pct_cft_i(ni,:), pctcrop_i(ni), first_pft_index=cft_lb ) + end do - do no = 1,ns_o - pctpft_o(no,natpft_lb:natpft_ub) = pctnatpft_o(no)%get_pct_p2g() - pctpft_o(no,cft_lb:cft_ub) = pctcft_o(no)%get_pct_p2g() - end do - end if + do no = 1,ns_o + pctpft_o(no,natpft_lb:natpft_ub) = pctnatpft_o(no)%get_pct_p2g() + pctpft_o(no,cft_lb:cft_ub) = pctcft_o(no)%get_pct_p2g() + end do allocate(gpft_i(0:numpft_i-1)) allocate(gpft_o(0:numpft_i-1)) @@ -723,29 +747,25 @@ subroutine mkpft(ldomain, mapfname, fpft, ndiag, allow_no_crops, & call shr_sys_flush(ndiag) deallocate(gpft_i, gpft_o) - if ( .not. oldformat ) then - deallocate(pctpft_o) - end if end if + deallocate( pctnatpft_i ) + deallocate( pctcft_i ) + deallocate(pctpft_o) ! Deallocate dynamic memory - if ( .not. oldformat ) then - deallocate(pctnatveg_i) - deallocate(pctnatveg_o) - deallocate(pctcrop_i) - deallocate(pctcrop_o) - deallocate(pct_cft_i) - deallocate(pct_cft_o) - deallocate(pct_nat_pft_i) - deallocate(pct_nat_pft_o) - else - deallocate(pctpft_o) - end if - call domain_clean(tdomain) - if ( .not. zero_out .and. .not. use_input_pft ) then + deallocate(pctnatveg_i) + deallocate(pctnatveg_o) + deallocate(pctcrop_i) + deallocate(pctcrop_o) + deallocate(pct_cft_i) + deallocate(pct_cft_o) + deallocate(pct_nat_pft_i) + deallocate(pct_nat_pft_o) + if ( .not. presc_cover ) then + call domain_clean(tdomain) call gridmap_clean(tgridmap) end if @@ -805,6 +825,7 @@ subroutine mkpft_parse_oride( string ) if ( rc /= 0 )then write(6,*) subname//'Trouble finding pft_frac start end tags' call abort() + return end if num_elms = shr_string_countChar( substring, ",", rc ) read(substring,*) pft_frc(0:num_elms) @@ -812,10 +833,12 @@ subroutine mkpft_parse_oride( string ) if ( rc /= 0 )then write(6,*) subname//'Trouble finding pft_index start end tags' call abort() + return end if if ( num_elms /= shr_string_countChar( substring, ",", rc ) )then write(6,*) subname//'number of elements different between frc and idx fields' call abort() + return end if read(substring,*) pft_idx(0:num_elms) !----------------------------------------------------------------------- @@ -830,14 +853,14 @@ end subroutine mkpft_parse_oride ! !IROUTINE: mkpft_check_oride ! ! !INTERFACE: -subroutine mkpft_check_oride( ) +subroutine mkpft_check_oride( error_happened ) ! ! !DESCRIPTION: ! Check that the pft override values are valid ! !USES: -! -! !ARGUMENTS: implicit none +! !ARGUMENTS: + logical, intent(out) :: error_happened ! Result, true if there was a problem ! ! !REVISION HISTORY: ! Author: Erik Kluzek @@ -851,51 +874,64 @@ subroutine mkpft_check_oride( ) character(len=32) :: subname = 'mkpftMod::mkpft_check_oride() ' !----------------------------------------------------------------------- + error_happened = .false. sumpft = sum(pft_frc) if ( sumpft == 0.0 )then ! PFT fraction is NOT used use_input_pft = .false. else if ( abs(sumpft - hndrd) > 1.e-6 )then write(6, '(a, a, f15.12)') trim(subname), 'Sum of PFT fraction is NOT equal to 100% =', sumpft - write(6,*) 'Set PFT fraction to : ', pft_frc(0:nzero-1) - write(6,*) 'With PFT index : ', pft_idx(0:nzero-1) + write(6,*) 'Set PFT fraction to : ', pft_frc(0:nzero) + write(6,*) 'With PFT index : ', pft_idx(0:nzero) + error_happened = .true. call abort() + return else use_input_pft = .true. - nzero = 0 + nzero = numpft do i = 0, numpft if ( pft_frc(i) == 0.0_r8 )then - nzero = i + nzero = i-1 exit end if end do ! PFT fraction IS used, and sum is OK, now check details - do i = 0, nzero -1 + do i = 0, nzero if ( pft_frc(i) < 0.0_r8 .or. pft_frc(i) > hndrd )then write(6,*) subname//'PFT fraction is out of range: pft_frc=', pft_frc(i) + error_happened = .true. call abort() + return else if ( pft_frc(i) > 0.0_r8 .and. pft_idx(i) == -1 )then write(6,*) subname//'PFT fraction > zero, but index NOT set: pft_idx=', pft_idx(i) + error_happened = .true. call abort() + return end if ! PFT index out of range if ( pft_idx(i) < 0 .or. pft_idx(i) > numpft )then write(6,*) subname//'PFT index is out of range: ', pft_idx(i) + error_happened = .true. call abort() + return end if ! Make sure index values NOT used twice do j = 0, i-1 if ( pft_idx(i) == pft_idx(j) )then write(6,*) subname//'Same PFT index is used twice: ', pft_idx(i) + error_happened = .true. call abort() + return end if end do end do ! Make sure the rest of the fraction is zero and index are not set as well - do i = nzero, numpft + do i = nzero+1, numpft if ( pft_frc(i) /= 0.0_r8 .or. pft_idx(i) /= -1 )then write(6,*) subname//'After PFT fraction is zeroed out, fraction is non zero, or index set' + error_happened = .true. call abort() + return end if end do end if @@ -969,10 +1005,6 @@ subroutine mkpftAtt( ncid, dynlanduse, xtype ) str = 'TRUE' call check_ret(nf_put_att_text (ncid, NF_GLOBAL, & 'pft_override', len_trim(str), trim(str)), subname) - else if ( zero_out )then - str = 'TRUE' - call check_ret(nf_put_att_text (ncid, NF_GLOBAL, & - 'zero_out_pft_override', len_trim(str), trim(str)), subname) else str = get_filename(mksrf_fvegtyp) call check_ret(nf_put_att_text(ncid, NF_GLOBAL, & @@ -1083,6 +1115,143 @@ subroutine mkpftAtt( ncid, dynlanduse, xtype ) end subroutine mkpftAtt +!----------------------------------------------------------------------- +!BOP +! +! !IROUTINE: constructor +! +! !INTERFACE: +function constructor( ) result(this) +! +! !DESCRIPTION: +! Construct a new PFT override object +! +! !ARGUMENTS: + implicit none + type(pft_oride) :: this +!EOP + character(len=32) :: subname = 'mkpftMod::constructor() ' + + this%crop = -1.0_r8 + this%natveg = -1.0_r8 + if ( num_natpft < 0 )then + write(6,*) subname//'num_natpft is NOT set = ', num_natpft + call abort() + return + end if + if ( num_cft < 0 )then + write(6,*) subname//'num_cft is NOT set = ', num_cft + call abort() + return + end if + allocate( this%natpft(noveg:num_natpft) ) + allocate( this%cft(1:num_cft) ) + this%natpft(:) = -1.0_r8 + this%cft(:) = -1.0_r8 + call this%InitZeroOut() +end function constructor + + +!----------------------------------------------------------------------- +!BOP +! +! !IROUTINE: InitZeroOut +! +! !INTERFACE: +subroutine InitZeroOut( this ) +! +! !DESCRIPTION: +! Initialize a pft_oride object with vegetation that's zeroed out +! +! !ARGUMENTS: + implicit none + class(pft_oride), intent(inout) :: this +!EOP + this%crop = 0.0_r8 + this%natveg = 0.0_r8 + + this%natpft = 0.0_r8 + this%natpft(noveg) = 100.0_r8 + this%cft = 0.0_r8 + this%cft(1) = 100.0_r8 +end subroutine InitZeroOut + +!----------------------------------------------------------------------- +!BOP +! +! !IROUTINE: InitZeroOut +! +! !INTERFACE: +subroutine InitAllPFTIndex( this ) +! +! !DESCRIPTION: +! Initialize a pft_oride object with vegetation that's zeroed out +! +! !ARGUMENTS: + implicit none + class(pft_oride), intent(inout) :: this +!EOP + integer :: m, i ! Indices + real(r8) :: croptot ! Total of crop + real(r8) :: natvegtot ! Total of natural vegetation + character(len=32) :: subname = 'mkpftMod::coInitAllPFTIndex() ' + + croptot = 0.0_r8 + natvegtot = 0.0_r8 + this%natpft = 0.0_r8 + this%cft = 0.0_r8 + do m = noveg, nzero + i = pft_idx(m) + if ( (i < noveg) .or. (i > numpft) )then + write(6,*) subname//'PFT index is out of valid range' + call abort() + return + else if ( i <= num_natpft )then + this%natpft(i) = pft_frc(m) + natvegtot = natvegtot + pft_frc(m) + else + this%cft(i-num_natpft) = pft_frc(m) + croptot = croptot + pft_frc(m) + end if + end do + this%crop = croptot + this%natveg = natvegtot + ! Renormalize + if ( natvegtot > 0.0_r8 )then + this%natpft = 100.0_r8 * this%natpft / natvegtot + else + this%natpft(noveg) = 100.0_r8 + end if + if (croptot > 0.0_r8 )then + this%cft = 100.0_r8 * this%cft / croptot + else + this%cft(1) = 100.0_r8 + end if + +end subroutine InitAllPFTIndex + +!----------------------------------------------------------------------- +!BOP +! +! !IROUTINE: clean +! +! !INTERFACE: +subroutine Clean( this ) +! +! !DESCRIPTION: +! Clean up a PFT Oride object +! +! !ARGUMENTS: + implicit none + class(pft_oride), intent(inout) :: this +!EOP + this%crop = -1.0_r8 + this%natveg = -1.0_r8 + deallocate( this%natpft ) + deallocate( this%cft ) + +end subroutine Clean + !----------------------------------------------------------------------- end module mkpftMod diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index b6752a7185..acba4e8719 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -93,7 +93,6 @@ program mksurfdat type(pct_pft_type), allocatable :: pctnatpft_max(:) ! % of grid cell maximum PFTs of the time series type(pct_pft_type), allocatable :: pctcft(:) ! % of grid cell that is crop, and breakdown into CFTs type(pct_pft_type), allocatable :: pctcft_max(:) ! % of grid cell maximum CFTs of the time series - type(pct_pft_type), allocatable :: pctcft_saved(:) ! version of pctcft saved from the initial call to mkpft real(r8), pointer :: harvest1D(:) ! harvest 1D data: normalized harvesting real(r8), pointer :: harvest2D(:,:) ! harvest 1D data: normalized harvesting real(r8), allocatable :: pctgla(:) ! percent of grid cell that is glacier @@ -181,6 +180,7 @@ program mksurfdat soil_fmax, & soil_clay, & pft_idx, & + all_veg, & pft_frc, & all_urban, & no_inlandwet, & @@ -288,6 +288,7 @@ program mksurfdat ! Optional settings to change values for entire area ! ====================================== ! all_urban --------- If entire area is urban + ! all_veg ----------- If entire area is to be vegetated (pft_idx and pft_frc then required) ! no_inlandwet ------ If wetland should be set to 0% over land ! soil_color -------- If you want to change the soil_color to this value everywhere ! soil_clay --------- If you want to change the soil_clay % to this value everywhere @@ -311,6 +312,7 @@ program mksurfdat outnc_vic = .false. outnc_3dglc = .false. all_urban = .false. + all_veg = .false. no_inlandwet = .true. ! default value for bug work around @@ -380,7 +382,7 @@ program mksurfdat ! Call module initialization routines ! call mksoilInit( ) - call mkpftInit( all_urban, all_veg ) + call mkpftInit( zero_out_l=all_urban, all_veg_l=all_veg ) allocate ( elevclass(nglcec+1) ) call mkglcmecInit (elevclass) call mkurbanInit (mksrf_furban) @@ -435,7 +437,6 @@ program mksurfdat pctnatpft_max(ns_o) , & pctcft(ns_o) , & pctcft_max(ns_o) , & - pctcft_saved(ns_o) , & pctgla(ns_o) , & pctlak(ns_o) , & pctwet(ns_o) , & @@ -564,21 +565,16 @@ program mksurfdat ! Make PFTs [pctnatpft, pctcft] from dataset [fvegtyp] call mkpft(ldomain, mapfname=map_fpft, fpft=mksrf_fvegtyp, & - ndiag=ndiag, allow_no_crops=.false., & - pctlnd_o=pctlnd_pft, pctnatpft_o=pctnatpft, pctcft_o=pctcft) + ndiag=ndiag, pctlnd_o=pctlnd_pft, pctnatpft_o=pctnatpft, pctcft_o=pctcft) ! Create harvesting data at model resolution call mkharvest_init( ns_o, spval, harvdata, mksrf_fhrvtyp ) - if ( .not. any(pft_frc > 0.0_r8 ) )then + if ( .not. all_veg )then call mkharvest( ldomain, mapfname=map_fharvest, datfname=mksrf_fhrvtyp, & ndiag=ndiag, harvdata=harvdata ) end if - ! Save the version of pctcft before any corrections are made. In particular, we want - ! to save the version before remove_small_cover is called. - pctcft_saved = pctcft - ! Make inland water [pctlak, pctwet] [flakwat] [fwetlnd] call mklakwat (ldomain, mapfname=map_flakwat, datfname=mksrf_flakwat, & @@ -1136,7 +1132,7 @@ program mksurfdat ! ! If pft fraction override is set, than intrepret string as PFT and harvesting override values ! - if ( any(pft_frc > 0.0_r8 ) )then + if ( all_veg )then fname = ' ' fhrvname = ' ' call mkpft_parse_oride(string) @@ -1160,9 +1156,7 @@ program mksurfdat ! Create pctpft data at model resolution call mkpft(ldomain, mapfname=map_fpft, fpft=fname, & - ndiag=ndiag, allow_no_crops=.false., & - pctlnd_o=pctlnd_pft_dyn, pctnatpft_o=pctnatpft, pctcft_o=pctcft, & - pctcft_o_saved=pctcft_saved) + ndiag=ndiag, pctlnd_o=pctlnd_pft_dyn, pctnatpft_o=pctnatpft, pctcft_o=pctcft ) ! Create harvesting data at model resolution diff --git a/tools/mksurfdata_map/src/test/CMakeLists.txt b/tools/mksurfdata_map/src/test/CMakeLists.txt index 5cfb20f21b..81e413cb85 100644 --- a/tools/mksurfdata_map/src/test/CMakeLists.txt +++ b/tools/mksurfdata_map/src/test/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory(mkpctPftType_test) add_subdirectory(mkpftUtils_test) +add_subdirectory(mkpftmod_test) add_subdirectory(mkgridmap_test) add_subdirectory(mkindexmap_test) -add_subdirectory(mksoilUtils_test) \ No newline at end of file +add_subdirectory(mksoilUtils_test) diff --git a/tools/mksurfdata_map/src/test/mkpftmod_test/CMakeLists.txt b/tools/mksurfdata_map/src/test/mkpftmod_test/CMakeLists.txt new file mode 100644 index 0000000000..8fcb75145f --- /dev/null +++ b/tools/mksurfdata_map/src/test/mkpftmod_test/CMakeLists.txt @@ -0,0 +1,9 @@ +set (pfunit_sources + test_pftrun.pf + test_pft_oride.pf + test_pftInit.pf) + +create_pFUnit_test(mkpftMod test_mkpft_exe + "${pfunit_sources}" "") + +target_link_libraries(test_mkpft_exe mksurfdat) diff --git a/tools/mksurfdata_map/src/test/mkpftmod_test/test_pftInit.pf b/tools/mksurfdata_map/src/test/mkpftmod_test/test_pftInit.pf new file mode 100644 index 0000000000..1ddb143961 --- /dev/null +++ b/tools/mksurfdata_map/src/test/mkpftmod_test/test_pftInit.pf @@ -0,0 +1,297 @@ +module test_pftInit + + ! Tests of mkpftMod: pft_override functions + + use pfunit_mod + + use shr_kind_mod, only : r8 => shr_kind_r8 + use mkpftMod + use mkvarctl, only: numpft + use mkvarpar, only: numstdpft, noveg + use mkpftConstantsMod, only: maxpft, c3cropindex + + implicit none + save + + @TestCase + type, extends(TestCase) :: TestMkPFT + contains + procedure :: setUp + procedure :: tearDown + end type TestMkPFT + +contains + + subroutine setUp(this) + class(TestMkPFT), intent(inout) :: this + numpft = numstdpft + pft_idx(0:maxpft) = -1 + pft_frc(0:maxpft) = 0.0_r8 + end subroutine setUp + + subroutine tearDown(this) + class(TestMkPFT), intent(inout) :: this + + end subroutine tearDown + + @Test + subroutine test_runmkpftInit(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + all_veg_l = .false. + call mkpftInit( zero_out_l, all_veg_l ) + @assertFalse( use_input_pft ) + @assertFalse( presc_cover ) + + end subroutine test_runmkpftInit + + @Test + subroutine test_runmkpftInitZero(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .true. + all_veg_l = .false. + call mkpftInit( zero_out_l, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + @assertEqual( pft_idx(0), noveg ) + @assertEqual( pft_frc(0), 0.0_r8 ) + + end subroutine test_runmkpftInitZero + + @Test + subroutine test_runmkpftInitPftORide(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + pft_idx(0) = 1 + pft_frc(0) = 100._r8 + all_veg_l = .true. + call mkpftInit( zero_out_l, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + + end subroutine test_runmkpftInitPftORide + + + @Test + subroutine test_runmkpftInitPftORideButNOTAllVeg(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + pft_idx(0:1) = (/ 1, c3cropindex /) + pft_frc(0:1) = (/ 50._r8, 50.0_r8 /) + all_veg_l = .true. + call mkpftInit( zero_out_l, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + + end subroutine test_runmkpftInitPftORideButNOTAllVeg + + + @Test + subroutine test_runmkpftInitPftORideCrop(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + numpft = maxpft + pft_idx(0) = 17 + pft_frc(0) = 100._r8 + all_veg_l = .true. + call mkpftInit( zero_out_l, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + + end subroutine test_runmkpftInitPftORideCrop + + + @Test + subroutine test_runmkpftInitPftORideAll(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + integer :: i + + zero_out_l = .false. + numpft = numstdpft + do i = 0, numpft + pft_idx(i) = i + pft_frc(i) = 1.0_r8 + end do + pft_frc(numpft) = 100._r8 - sum(pft_frc(0:numpft-1)) + @assertEqual( 100.0_r8, sum(pft_frc) ) + all_veg_l = .true. + call mkpftInit( zero_out_l, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + + end subroutine test_runmkpftInitPftORideAll + + @Test + subroutine test_runmkpftInitPFTOrideWarnNoCrop(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + numpft = maxpft + pft_idx(0) = 1 + pft_frc(0) = 100._r8 + all_veg_l = .true. + call mkpftInit( zero_out_l, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + + end subroutine test_runmkpftInitPFTOrideWarnNoCrop + + @Test + subroutine test_runmkpftInitPFTOrideWarnNoNatVeg(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + numpft = maxpft + pft_idx(0) = c3cropindex + pft_frc(0) = 100._r8 + all_veg_l = .true. + call mkpftInit( zero_out_l, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + + end subroutine test_runmkpftInitPFTOrideWarnNoNatVeg + + @Test + subroutine test_runmkpftInitBadZeroNInput(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .true. + numpft = maxpft + pft_idx(0) = numstdpft+1 + pft_frc(0) = 100._r8 + all_veg_l = .true. + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + + end subroutine test_runmkpftInitBadZeroNInput + + @Test + subroutine test_runmkpftInitBadAllVeg(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + all_veg_l = .true. + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + + end subroutine test_runmkpftInitBadAllVeg + + @Test + subroutine test_runmkpftInitBadNotSum(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + all_veg_l = .true. + numpft = maxpft + pft_idx(0) = numstdpft+1 + pft_frc(0) = 99._r8 + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + + end subroutine test_runmkpftInitBadNotSum + + @Test + subroutine test_runmkpftInitBadPFTOutRange(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + all_veg_l = .true. + numpft = numstdpft + pft_idx(0) = numstdpft+1 + pft_frc(0) = 100._r8 + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + + end subroutine test_runmkpftInitBadPFTOutRange + + @Test + subroutine test_runmkpftInitBadPFTBadVals(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + all_veg_l = .true. + numpft = maxpft + pft_idx(0:1) = (/ numstdpft+1, numstdpft+2 /) + pft_frc(0:1) = (/ 101._r8, -1._r8 /) + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + + end subroutine test_runmkpftInitBadPFTBadVals + + @Test + subroutine test_runmkpftInitBadnumpft(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + all_veg_l = .true. + numpft = 79 + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + + end subroutine test_runmkpftInitBadnumpft + + @Test + subroutine test_runmkpftInitBadFrcNotIdx(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + all_veg_l = .true. + numpft = maxpft + pft_idx(0) = numstdpft+1 + pft_frc(0:1) = (/ 99._r8, 1._r8 /) + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + + end subroutine test_runmkpftInitBadFrcNotIdx + + @Test + subroutine test_runmkpftInitBadIdxTwice(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + all_veg_l = .true. + numpft = maxpft + pft_idx(0:1) = (/ 17, 17 /) + pft_frc(0:1) = (/ 99._r8, 1._r8 /) + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + + end subroutine test_runmkpftInitBadIdxTwice + + @Test + subroutine test_runmkpftInitBadFrcAfterZero(this) + class(TestMkPFT), intent(inout) :: this + logical :: zero_out_l, all_veg_l + + zero_out_l = .false. + numpft = maxpft + all_veg_l = .true. + pft_idx(0:2) = (/ 17, -1, 18 /) + pft_frc(0:2) = (/ 99._r8, 0.0_r8, 1._r8 /) + call mkpftInit( zero_out_l, all_veg_l ) + @assertExceptionRaised( "ABORTED:" ) + end subroutine test_runmkpftInitBadFrcAfterZero + + +end module test_pftInit diff --git a/tools/mksurfdata_map/src/test/mkpftmod_test/test_pft_oride.pf b/tools/mksurfdata_map/src/test/mkpftmod_test/test_pft_oride.pf new file mode 100644 index 0000000000..97cfc66d1e --- /dev/null +++ b/tools/mksurfdata_map/src/test/mkpftmod_test/test_pft_oride.pf @@ -0,0 +1,127 @@ +module test_pft_oride + + ! Tests of mkpftMod: pft_override functions + + use pfunit_mod + + use shr_kind_mod, only : r8 => shr_kind_r8 + use mkpftMod + use mkvarctl, only : numpft + use mkvarpar, only : numstdpft + use mkpftConstantsMod, only : c3cropindex, c3irrcropindex + + implicit none + save + + @TestCase + type, extends(TestCase) :: TestPFTORide + type(pft_oride) :: pftoverride + contains + procedure :: setUp + procedure :: tearDown + end type TestPFTORide + + logical :: zero_out, all_veg_l + +contains + + subroutine setUp(this) + class(TestPFTORide), intent(inout) :: this + + pft_idx(:) = -1 + pft_frc(:) = 0.0_r8 + zero_out = .false. + numpft = numstdpft + all_veg_l = .false. + call mkpftInit( zero_out, all_veg_l ) + this%pftoverride = pft_oride( ) + end subroutine setUp + + subroutine tearDown(this) + class(TestPFTORide), intent(inout) :: this + + call this%pftoverride%Clean() + + end subroutine tearDown + + @Test + subroutine test_runmkpftZero(this) + class(TestPFTORide), intent(inout) :: this + + zero_out = .true. + all_veg_l = .false. + call mkpftInit( zero_out, all_veg_l ) + call this%pftoverride%InitZeroOut() + @assertEqual( 0.0_r8, this%pftoverride%crop ) + @assertEqual( 0.0_r8, this%pftoverride%natveg ) + @assertEqual( 100.0_r8, sum(this%pftoverride%cft)) + @assertEqual( 100.0_r8, sum(this%pftoverride%natpft)) + + end subroutine test_runmkpftZero + + @Test + subroutine test_runSetpft(this) + class(TestPFTORide), intent(inout) :: this + integer, parameter :: pftidx = 1 + + pft_idx(0) = pftidx + pft_frc(0) = 100.0_r8 + zero_out = .false. + all_veg_l = .true. + call mkpftInit( zero_out, all_veg_l ) + call this%pftoverride%InitAllPFTIndex() + @assertEqual( 0.0_r8, this%pftoverride%crop ) + @assertEqual( 100.0_r8, this%pftoverride%natveg ) + @assertEqual( 100.0_r8, sum(this%pftoverride%cft) ) + @assertEqual( 100.0_r8, sum(this%pftoverride%natpft) ) + @assertEqual( 100.0_r8, this%pftoverride%natpft(pftidx) ) + + end subroutine test_runSetpft + + @Test + subroutine test_runSetCrop(this) + class(TestPFTORide), intent(inout) :: this + integer :: cftidx + + cftidx = c3cropindex + pft_idx(0) = cftidx + pft_frc(0) = 100.0_r8 + zero_out = .false. + all_veg_l = .true. + call mkpftInit( zero_out, all_veg_l ) + call this%pftoverride%InitAllPFTIndex() + @assertEqual( 100.0_r8, this%pftoverride%crop ) + @assertEqual( 0.0_r8, this%pftoverride%natveg ) + @assertEqual( 100.0_r8, sum(this%pftoverride%cft) ) + @assertEqual( 100.0_r8, sum(this%pftoverride%natpft) ) + @assertEqual( 100.0_r8, this%pftoverride%cft(numpft-cftidx) ) + + end subroutine test_runSetCrop + + @Test + subroutine test_runSetMix(this) + class(TestPFTORide), intent(inout) :: this + integer :: cftidx, cftidx2, pftidx2 + integer, parameter :: pftidx = 1 + + zero_out = .false. + pftidx2 = c3cropindex-1 + cftidx = c3cropindex + cftidx2 = c3irrcropindex + pft_idx(0:3) = (/ pftidx, pftidx2, cftidx, cftidx2 /) + pft_frc(0:3) = (/ 25.0_r8, 25.0_r8, 25.0_r8, 25.0_r8 /) + all_veg_l = .true. + call mkpftInit( zero_out, all_veg_l ) + call this%pftoverride%InitAllPFTIndex() + @assertEqual( 50.0_r8, this%pftoverride%crop ) + @assertEqual( 50.0_r8, this%pftoverride%natveg ) + @assertEqual( 100.0_r8, sum(this%pftoverride%cft) ) + @assertEqual( 100.0_r8, sum(this%pftoverride%natpft) ) + @assertEqual( 50.0_r8, this%pftoverride%natpft(pftidx) ) + @assertEqual( 50.0_r8, this%pftoverride%natpft(pftidx2) ) + @assertEqual( 50.0_r8, this%pftoverride%cft(1) ) + @assertEqual( 50.0_r8, this%pftoverride%cft(2) ) + + end subroutine test_runSetMix + +end module test_pft_oride diff --git a/tools/mksurfdata_map/src/test/mkpftmod_test/test_pftrun.pf b/tools/mksurfdata_map/src/test/mkpftmod_test/test_pftrun.pf new file mode 100644 index 0000000000..389748764b --- /dev/null +++ b/tools/mksurfdata_map/src/test/mkpftmod_test/test_pftrun.pf @@ -0,0 +1,204 @@ +module test_pftrun + + ! Tests of mkpftMod: pft_override functions + + use pfunit_mod + + use shr_kind_mod, only : r8 => shr_kind_r8 + use mkpftMod + use mkvarctl, only: numpft + use mkvarpar, only: numstdpft + use mkpftConstantsMod, only: maxpft, c3cropindex, c3irrcropindex + use mkpctPftTypeMod , only : pct_pft_type + use mkdomainMod , only : domain_type, for_test_create_domain, domain_clean + + implicit none + save + + @TestCase + type, extends(TestCase) :: TestMkPFTRun + character(len=12) :: mapfname + character(len=12) :: fpft + type(domain_type) :: ldomain + integer :: ndiag + real(r8), allocatable :: expected(:) + real(r8) :: expected_cft(2) + real(r8) :: expected_pft(0:14) + type(pct_pft_type), allocatable :: pctnatpft(:) ! % of grid cell that is nat veg, and breakdown into PFTs + real(r8), allocatable :: pctlnd_pft(:) ! PFT data: % of gridcell for PFTs + type(pct_pft_type), allocatable :: pctcft(:) ! % of grid cell that is crop, and breakdown into CFTs + contains + procedure :: setUp + procedure :: tearDown + end type TestMkPFTRun + +contains + + subroutine setUp(this) + class(TestMkPFTRun), intent(inout) :: this + integer :: ns_o + + numpft = numstdpft + pft_idx(0:maxpft) = -1 + pft_frc(0:maxpft) = 0.0_r8 + this%ndiag = 6 + this%mapfname = "none" + this%fpft = "none" + call for_test_create_domain( this%ldomain ) + ns_o = this%ldomain%ns + allocate( this%pctnatpft(ns_o) ) + allocate( this%pctlnd_pft(ns_o) ) + allocate( this%pctcft(ns_o) ) + allocate( this%expected(ns_o) ) + this%expected = 0.0_r8 + this%expected_cft = 0.0_r8 + this%expected_pft = 0.0_r8 + end subroutine setUp + + subroutine tearDown(this) + class(TestMkPFTRun), intent(inout) :: this + + deallocate( this%pctnatpft ) + deallocate( this%pctlnd_pft ) + deallocate( this%pctcft ) + deallocate( this%expected ) + call domain_clean( this%ldomain ) + + end subroutine tearDown + + @Test + subroutine test_runmkpftZero(this) + class(TestMkPFTRun), intent(inout) :: this + logical :: zero_out, all_veg_l + integer :: n + + zero_out = .true. + all_veg_l = .false. + call mkpftInit( zero_out, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + call mkpft(this%ldomain, this%mapfname, this%fpft, this%ndiag, & + pctlnd_o=this%pctlnd_pft, pctnatpft_o=this%pctnatpft, pctcft_o=this%pctcft) + this%expected = 100.0_r8 + @assertEqual( this%expected, this%pctlnd_pft ) + do n = 1, this%ldomain%ns + @assertEqual( this%pctnatpft(n)%get_pct_l2g(), 0.0_r8 ) + @assertEqual( this%pctcft(n)%get_pct_l2g(), 0.0_r8 ) + this%expected_pft = 0.0_r8 + this%expected_pft(0) = 100.0_r8 + this%expected_cft = 0.0_r8 + this%expected_cft(1) = 100.0_r8 + @assertEqual( this%pctnatpft(n)%get_pct_p2l(), this%expected_pft ) + @assertEqual( this%pctcft(n)%get_pct_p2l(), this%expected_cft ) + end do + + end subroutine test_runmkpftZero + + @Test + subroutine test_runmkpftPftORide(this) + class(TestMkPFTRun), intent(inout) :: this + logical :: zero_out, all_veg_l + integer :: n + integer, parameter :: pftidx = 1 + + zero_out = .false. + all_veg_l = .true. + pft_idx(0) = pftidx + pft_frc(0) = 100._r8 + call mkpftInit( zero_out, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + call mkpft(this%ldomain, this%mapfname, this%fpft, this%ndiag, & + pctlnd_o=this%pctlnd_pft, pctnatpft_o=this%pctnatpft, pctcft_o=this%pctcft) + this%expected = 100.0_r8 + @assertEqual( this%expected, this%pctlnd_pft ) + do n = 1, this%ldomain%ns + @assertEqual( this%pctnatpft(n)%get_pct_l2g(), 100.0_r8 ) + @assertEqual( this%pctcft(n)%get_pct_l2g(), 0.0_r8 ) + this%expected_pft = 0.0_r8 + this%expected_pft(pftidx) = 100.0_r8 + this%expected_cft = 0.0_r8 + this%expected_cft(1) = 100.0_r8 + @assertEqual( this%pctnatpft(n)%get_pct_p2l(), this%expected_pft ) + @assertEqual( this%pctcft(n)%get_pct_p2l(), this%expected_cft ) + end do + + end subroutine test_runmkpftPftORide + + + @Test + subroutine test_runmkpftPftORideWCrop(this) + use mkvarpar, only: numstdpft, numstdcft + class(TestMkPFTRun), intent(inout) :: this + logical :: zero_out, all_veg_l + integer :: n + integer :: cftidx + integer, parameter :: pftidx = 1 + + cftidx = c3cropindex + zero_out = .false. + all_veg_l = .true. + @assertLessThan( pftidx, numstdpft-numstdcft+1 ) + @assertGreaterThan( cftidx, numstdpft-numstdcft ) + pft_idx(0:1) = (/ pftidx, cftidx /) + pft_frc(0:1) = (/ 50.0_r8, 50.0_r8 /) + call mkpftInit( zero_out, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + call mkpft(this%ldomain, this%mapfname, this%fpft, this%ndiag, & + pctlnd_o=this%pctlnd_pft, pctnatpft_o=this%pctnatpft, pctcft_o=this%pctcft) + this%expected = 100.0_r8 + @assertEqual( this%expected, this%pctlnd_pft ) + do n = 1, this%ldomain%ns + @assertEqual( this%pctnatpft(n)%get_pct_l2g(), 50.0_r8 ) + @assertEqual( this%pctcft(n)%get_pct_l2g(), 50.0_r8 ) + this%expected_pft = 0.0_r8 + this%expected_pft(pftidx) = 100.0_r8 + this%expected_cft = 0.0_r8 + this%expected_cft(numstdpft-cftidx) = 100.0_r8 + @assertEqual( this%pctnatpft(n)%get_pct_p2l(), this%expected_pft ) + @assertEqual( this%pctcft(n)%get_pct_p2l(), this%expected_cft ) + end do + + end subroutine test_runmkpftPftORideWCrop + + @Test + subroutine test_runmkpft4PftORideWCrop(this) + use mkvarpar, only: numstdpft, numstdcft + class(TestMkPFTRun), intent(inout) :: this + logical :: zero_out, all_veg_l + integer :: n + integer :: cftidx, cftidx2 + integer, parameter :: pftidx = 1, pftidx2 = 2 + + cftidx = c3cropindex + cftidx2 = c3irrcropindex + zero_out = .false. + all_veg_l = .true. + @assertLessThan( pftidx, numstdpft-numstdcft+1 ) + @assertLessThan( pftidx2, numstdpft-numstdcft+1 ) + @assertGreaterThan( cftidx, numstdpft-numstdcft ) + @assertGreaterThan( cftidx2, numstdpft-numstdcft ) + pft_idx(0:3) = (/ pftidx, pftidx2, cftidx, cftidx2 /) + pft_frc(0:3) = (/ 25.0_r8, 25.0_r8, 25.0_r8, 25.0_r8 /) + call mkpftInit( zero_out, all_veg_l ) + @assertTrue( use_input_pft ) + @assertTrue( presc_cover ) + call mkpft(this%ldomain, this%mapfname, this%fpft, this%ndiag, & + pctlnd_o=this%pctlnd_pft, pctnatpft_o=this%pctnatpft, pctcft_o=this%pctcft) + this%expected = 100.0_r8 + @assertEqual( this%expected, this%pctlnd_pft ) + do n = 1, this%ldomain%ns + @assertEqual( this%pctnatpft(n)%get_pct_l2g(), 50.0_r8 ) + @assertEqual( this%pctcft(n)%get_pct_l2g(), 50.0_r8 ) + this%expected_pft = 0.0_r8 + this%expected_pft(pftidx) = 50.0_r8 + this%expected_pft(pftidx2) = 50.0_r8 + this%expected_cft = 50.0_r8 + @assertEqual( this%pctnatpft(n)%get_pct_p2l(), this%expected_pft ) + @assertEqual( this%pctcft(n)%get_pct_p2l(), this%expected_cft ) + end do + + end subroutine test_runmkpft4PftORideWCrop + +end module test_pftrun diff --git a/tools/mksurfdata_map/src/unit_test_stubs/abort.F90 b/tools/mksurfdata_map/src/unit_test_stubs/abort.F90 new file mode 100644 index 0000000000..aa1d8b76c2 --- /dev/null +++ b/tools/mksurfdata_map/src/unit_test_stubs/abort.F90 @@ -0,0 +1,25 @@ +subroutine abort() + ! Replacement for abort that throws a pfunit exception rather than aborting + ! + ! This can be used to test expected errors (i.e., failure testing). + ! + ! If this occurs within a pFUnit-based test: + ! + ! - If you have code like: + ! + ! @assertExceptionRaised("ABORTED:") + ! + ! - If you don't have + ! + ! @assertExceptionRaised + ! + ! or + ! + ! call assertExceptionRaised + ! + ! then this will result in the given pFUnit test failing. + use pfunit_mod, only : throw + implicit none + + call throw("ABORTED:") +end subroutine abort diff --git a/tools/mksurfdata_map/src/unit_test_stubs/mkncdio.F90 b/tools/mksurfdata_map/src/unit_test_stubs/mkncdio.F90 index f8768b7b08..1bf6a8afdf 100644 --- a/tools/mksurfdata_map/src/unit_test_stubs/mkncdio.F90 +++ b/tools/mksurfdata_map/src/unit_test_stubs/mkncdio.F90 @@ -20,10 +20,19 @@ module mkncdio public :: nf_get_var_int public :: nf_get_vara_double public :: nf_get_att_double + public :: ncd_defvar + public :: ncd_def_spatial_var + + public :: get_dim_lengths public :: check_ret public :: convert_latlon + interface nf_get_var_double + module procedure nf_get_var_double_1d + module procedure nf_get_var_double_2d + end interface nf_get_var_double + interface nf_get_vara_double module procedure nf_get_vara_double_2d end interface nf_get_vara_double @@ -33,6 +42,43 @@ module mkncdio integer, parameter, public :: nf_max_name = 64 contains + +!----------------------------------------------------------------------- + subroutine ncd_defvar(ncid, varname, xtype, & + dim1name, dim2name, & + long_name, units ) +! + implicit none + integer , intent(in) :: ncid ! input unit + character(len=*), intent(in) :: varname ! variable name + integer , intent(in) :: xtype ! external type + character(len=*), intent(in), optional :: dim1name ! dimension name + character(len=*), intent(in), optional :: dim2name ! dimension name + character(len=*), intent(in), optional :: long_name ! attribute + character(len=*), intent(in), optional :: units ! attribute +! + end subroutine ncd_defvar + + !----------------------------------------------------------------------- + subroutine ncd_def_spatial_var(ncid, varname, xtype, long_name, units, lev1name, lev2name) + integer , intent(in) :: ncid ! input unit + character(len=*) , intent(in) :: varname ! variable name + integer , intent(in) :: xtype ! external type + character(len=*) , intent(in) :: long_name ! attribute + character(len=*) , intent(in) :: units ! attribute + character(len=*) , optional, intent(in) :: lev1name ! name of first level (or time) dimension + character(len=*) , optional, intent(in) :: lev2name ! name of second level (or time) dimension + end subroutine ncd_def_spatial_var + + subroutine get_dim_lengths(ncid, varname, ndims, dim_lengths) + integer , intent(in) :: ncid ! netcdf id of an open netcdf file + character(len=*), intent(in) :: varname ! name of variable of interest + integer , intent(out):: ndims ! number of dimensions of variable + integer , intent(out):: dim_lengths(:) ! lengths of dimensions of variable + + dim_lengths = 0 + end subroutine get_dim_lengths + integer function nf_open(filename, mode, ncid) character(len=*), intent(in) :: filename integer, intent(in) :: mode @@ -109,14 +155,23 @@ integer function nf_inq_vardimid(ncid, varid, dimids) nf_inq_vardimid = 0 end function nf_inq_vardimid - integer function nf_get_var_double(ncid, vid, data) + integer function nf_get_var_double_1d(ncid, vid, data) integer, intent(in) :: ncid integer, intent(in) :: vid real(r8), intent(out) :: data(:) data(:) = 0._r8 - nf_get_var_double = 0 - end function nf_get_var_double + nf_get_var_double_1d = 0 + end function nf_get_var_double_1d + + integer function nf_get_var_double_2d(ncid, vid, data) + integer, intent(in) :: ncid + integer, intent(in) :: vid + real(r8), intent(out) :: data(:,:) + + data(:,:) = 0._r8 + nf_get_var_double_2d = 0 + end function nf_get_var_double_2d integer function nf_get_var_int(ncid, vid, data) integer, intent(in) :: ncid @@ -145,6 +200,7 @@ integer function nf_get_att_double(ncid, varid, attname, attval) real(r8), intent(out) :: attval attval = 0._r8 + nf_get_att_double = 0 end function nf_get_att_double subroutine check_ret(ret, calling, varexists) From f280237624b6ed8f3f03fc1327310b6d85bbfd1f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 8 Jan 2020 16:54:41 -0700 Subject: [PATCH 0526/1973] Couple changes to get the test case SMS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-defau to build/link/run --- src/biogeophys/SoilMoistureStreamMod.F90 | 4 ++-- src/biogeophys/WaterStateType.F90 | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 64611f4578..5548ed0211 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -10,7 +10,7 @@ module SoilMoistureStreamMod use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_kind_mod , only : CL => shr_kind_CL + use shr_kind_mod , only : CL => shr_kind_CL, CXX => shr_kind_CXX use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use abortutils , only : endrun @@ -96,7 +96,7 @@ subroutine PrescribedSoilMoistureInit(bounds) character(*), parameter :: subName = "('PrescribedSoilMoistureInit')" character(*), parameter :: F00 = "('(PrescribedSoilMoistureInit) ',4a)" character(*), parameter :: soilmString = "H2OSOI" ! base string for field string - character(SHR_KIND_CXX) :: fldList ! field string + character(CXX) :: fldList ! field string !----------------------------------------------------------------------- ! ! deal with namelist variables here in init diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index 891acd7ad1..baff2902f9 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -12,7 +12,7 @@ module WaterStateType use shr_log_mod , only : errMsg => shr_log_errMsg use abortutils , only : endrun use decompMod , only : bounds_type - use decompMod , only : BOUNDS_SUBGRID_PATCH, BOUNDS_SUBGRID_COLUMN + use decompMod , only : BOUNDS_SUBGRID_PATCH, BOUNDS_SUBGRID_COLUMN, BOUNDS_SUBGRID_GRIDCELL use clm_varctl , only : use_bedrock, iulog use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb, nlevsno use clm_varcon , only : spval, namec @@ -119,7 +119,7 @@ subroutine InitAllocate(this, bounds, tracer_vars) container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & dim2beg = 1, dim2end = nlevgrnd) - call AllocateVar2d(var = this%h2osoi_vol_col, name = 'h2osoi_vol_prs_grc', & + call AllocateVar2d(var = this%h2osoi_vol_prs_grc, name = 'h2osoi_vol_prs_grc', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_GRIDCELL, & dim2beg = 1, dim2end = nlevgrnd) @@ -184,7 +184,6 @@ subroutine InitHistory(this, bounds) avgflag='A', & long_name=this%info%lname('Snow liquid water content'), & ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - data2dptr => this%h2osoi_liq_col(:,-nlevsno+1:0) data2dptr => this%h2osoi_ice_col(:,-nlevsno+1:0) call hist_addfld2d ( & From 1fb57761e33c701863330f549a09458b016a77cb Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 9 Jan 2020 16:32:25 -0700 Subject: [PATCH 0527/1973] updates to have single point runs not have to change compsets --- cime_config/config_compsets.xml | 14 +++- cime_config/testdefs/testlist_clm.xml | 96 +++++++++++++-------------- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 +- 3 files changed, 61 insertions(+), 51 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index bf0cb94221..f3e1448df3 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -37,12 +37,12 @@ - I1PtClm50SpRsGs + I1PtClm50SpGs 2000_DATM%1PT_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV - I1PtClm45SpRsGs + I1PtClm45SpGs 2000_DATM%1PT_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV @@ -53,6 +53,16 @@ 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + IHistClm50BgcRsGs + HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV + + + IHistClm50SpRsGs + HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm50SpRsGs diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index ed5c675f3e..16d16853a3 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -8,7 +8,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -212,7 +212,7 @@ - + @@ -415,7 +415,7 @@ - + @@ -432,7 +432,7 @@ - + @@ -572,7 +572,7 @@ - + @@ -696,7 +696,7 @@ - + @@ -741,7 +741,7 @@ - + @@ -786,7 +786,7 @@ - + @@ -842,7 +842,7 @@ - + @@ -859,7 +859,7 @@ - + @@ -876,7 +876,7 @@ - + @@ -884,7 +884,7 @@ - + @@ -892,7 +892,7 @@ - + @@ -900,7 +900,7 @@ - + @@ -909,7 +909,7 @@ - + @@ -918,7 +918,7 @@ - + @@ -927,7 +927,7 @@ - + @@ -946,7 +946,7 @@ - + @@ -964,7 +964,7 @@ - + @@ -978,7 +978,7 @@ - + @@ -990,7 +990,7 @@ - + @@ -1075,7 +1075,7 @@ - + @@ -1125,7 +1125,7 @@ - + @@ -1133,7 +1133,7 @@ - + @@ -1141,7 +1141,7 @@ - + @@ -1151,7 +1151,7 @@ - + @@ -1234,7 +1234,7 @@ - + @@ -1243,7 +1243,7 @@ - + @@ -1262,7 +1262,7 @@ - + @@ -1305,7 +1305,7 @@ - + @@ -1313,7 +1313,7 @@ - + @@ -1323,7 +1323,7 @@ - + @@ -1331,7 +1331,7 @@ - + @@ -1417,7 +1417,7 @@ - + @@ -1425,7 +1425,7 @@ - + @@ -1468,7 +1468,7 @@ - + @@ -1477,7 +1477,7 @@ - + @@ -1514,7 +1514,7 @@ - + @@ -1523,7 +1523,7 @@ - + @@ -1531,7 +1531,7 @@ - + @@ -1541,7 +1541,7 @@ - + @@ -1670,7 +1670,7 @@ - + @@ -1692,7 +1692,7 @@ - + @@ -1781,7 +1781,7 @@ - + @@ -1849,7 +1849,7 @@ - + @@ -1876,7 +1876,7 @@ - + @@ -1886,7 +1886,7 @@ - + diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 4c26b42205..c15677fd9c 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -66,7 +66,7 @@ module lnd_comp_nuopc logical :: glc_present logical :: rof_prognostic - integer, parameter :: dbug = 1 + integer, parameter :: dbug = 0 character(*),parameter :: modName = "(lnd_comp_nuopc)" character(*),parameter :: u_FILE_u = & __FILE__ From 48864209fe4a1bbd15a011595c5072164460c288 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 9 Jan 2020 16:33:25 -0700 Subject: [PATCH 0528/1973] changes to have orbital calculation done in cap --- cime_config/config_compsets.xml | 10 + src/cpl/mct/lnd_comp_mct.F90 | 7 + src/cpl/nuopc/lnd_comp_nuopc.F90 | 292 +++++++++++++++++++++------- src/cpl/nuopc/lnd_import_export.F90 | 6 + src/main/clm_initializeMod.F90 | 11 +- src/main/surfrdMod.F90 | 2 +- 6 files changed, 246 insertions(+), 82 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index f3e1448df3..7ca17cf1cf 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -63,6 +63,16 @@ HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV + + + IHistClm50BgcRsGs + HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV + + + IHistClm50SpRsGs + HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm50SpRsGs diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index 8a8f86342b..f1d385cc30 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -156,6 +156,13 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & orb_lambm0=lambm0, orb_obliqr=obliqr ) + if (masterproc) then + write(iulog,*)' orb_eccen = ',eccen + write(iulog,*)' orb_obliqr = ',obliqr + write(iulog,*)' orb_lambm0 = ',lambm0 + write(iulog,*)' orb_mvelpp = ',mvelpp + end if + ! Consistency check on namelist filename call control_setNL("lnd_in"//trim(inst_suffix)) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index c15677fd9c..4b94aad763 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -5,42 +5,42 @@ module lnd_comp_nuopc !---------------------------------------------------------------------------- use ESMF - use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize - use NUOPC , only : NUOPC_CompFilterPhaseMap, NUOPC_CompAttributeGet, NUOPC_CompAttributeSet - use NUOPC_Model , only : model_routine_SS => SetServices - use NUOPC_Model , only : model_label_Advance => label_Advance - use NUOPC_Model , only : model_label_DataInitialize => label_DataInitialize - use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock - use NUOPC_Model , only : model_label_Finalize => label_Finalize - use NUOPC_Model , only : NUOPC_ModelGet - use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl - use shr_sys_mod , only : shr_sys_abort - use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit - use shr_orb_mod , only : shr_orb_decl - use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date - use spmdMod , only : masterproc, mpicom, spmd_init - use decompMod , only : bounds_type, ldecomp, get_proc_bounds - use domainMod , only : ldomain - use controlMod , only : control_setNL - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use clm_varctl , only : inst_index, inst_suffix, inst_name - use clm_varctl , only : single_column, clm_varctl_set, iulog - use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch - use clm_varcon , only : re - use clm_time_manager , only : set_timemgr_init, advance_timestep - use clm_time_manager , only : set_nextsw_cday, update_rad_dtime - use clm_time_manager , only : get_nstep, get_step_size - use clm_time_manager , only : get_curr_date, get_curr_calday - use clm_initializeMod , only : initialize1, initialize2 - use clm_driver , only : clm_drv - use lnd_import_export , only : advertise_fields, realize_fields - use lnd_import_export , only : import_fields, export_fields - use lnd_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit - use lnd_shr_methods , only : set_component_logging, get_component_instance, log_clock_advance - use perf_mod , only : t_startf, t_stopf, t_barrierf - use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror - use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var - use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable + use NUOPC , only : NUOPC_CompDerive, NUOPC_CompSetEntryPoint, NUOPC_CompSpecialize + use NUOPC , only : NUOPC_CompFilterPhaseMap, NUOPC_CompAttributeGet, NUOPC_CompAttributeSet + use NUOPC_Model , only : model_routine_SS => SetServices + use NUOPC_Model , only : model_label_Advance => label_Advance + use NUOPC_Model , only : model_label_DataInitialize => label_DataInitialize + use NUOPC_Model , only : model_label_SetRunClock => label_SetRunClock + use NUOPC_Model , only : model_label_Finalize => label_Finalize + use NUOPC_Model , only : NUOPC_ModelGet + use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl + use shr_sys_mod , only : shr_sys_abort + use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit + use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT + use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date + use spmdMod , only : masterproc, mpicom, spmd_init + use decompMod , only : bounds_type, ldecomp, get_proc_bounds + use domainMod , only : ldomain + use controlMod , only : control_setNL + use clm_varorb , only : eccen, obliqr, lambm0, mvelpp + use clm_varctl , only : inst_index, inst_suffix, inst_name + use clm_varctl , only : single_column, clm_varctl_set, iulog + use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch + use clm_varcon , only : re + use clm_time_manager , only : set_timemgr_init, advance_timestep + use clm_time_manager , only : set_nextsw_cday, update_rad_dtime + use clm_time_manager , only : get_nstep, get_step_size + use clm_time_manager , only : get_curr_date, get_curr_calday + use clm_initializeMod , only : initialize1, initialize2 + use clm_driver , only : clm_drv + use lnd_import_export , only : advertise_fields, realize_fields + use lnd_import_export , only : import_fields, export_fields + use lnd_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit + use lnd_shr_methods , only : set_component_logging, get_component_instance, log_clock_advance + use perf_mod , only : t_startf, t_stopf, t_barrierf + use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror + use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var + use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable implicit none private ! except @@ -53,6 +53,8 @@ module lnd_comp_nuopc private :: ModelSetRunClock private :: ModelAdvance private :: ModelFinalize + private :: clm_orbital_init + private :: clm_orbital_update !-------------------------------------------------------------------------- ! Private module data @@ -71,6 +73,17 @@ module lnd_comp_nuopc character(*),parameter :: u_FILE_u = & __FILE__ + character(len=CL) :: orb_mode ! attribute - orbital mode + integer :: orb_iyear ! attribute - orbital year + integer :: orb_iyear_align ! attribute - associated with model year + real(R8) :: orb_obliq ! attribute - obliquity in degrees + real(R8) :: orb_mvelp ! attribute - moving vernal equinox longitude + real(R8) :: orb_eccen ! attribute and update- orbital eccentricity + + character(len=*) , parameter :: orb_fixed_year = 'fixed_year' + character(len=*) , parameter :: orb_variable_year = 'variable_year' + character(len=*) , parameter :: orb_fixed_parameters = 'fixed_parameters' + !=============================================================================== contains !=============================================================================== @@ -407,24 +420,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Obtain attribute values !---------------------- - ! Note - the orbital inquiries set the values in clm_varorb via the module use statements - - call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) eccen - - call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) obliqr - - call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) lambm0 - - call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) mvelpp - call NUOPC_CompAttributeGet(gcomp, name='case_name', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) caseid @@ -515,6 +510,16 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) end if + !---------------------- + ! Initialize module orbital values and update orbital + !---------------------- + + call clm_orbital_init(gcomp, iulog, masterproc, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + call clm_orbital_update(clock, iulog, masterproc, eccen, obliqr, lambm0, mvelpp, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + !---------------------- ! Initialize CTSM time manager !---------------------- @@ -545,6 +550,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! note that the memory for gindex_ocn will be allocated in the following call call initialize1(gindex_ocn) + ! If no land then abort for now + ! TODO: need to handle the case of noland with CMEPS + ! if ( noland ) then + ! call shr_sys_abort(trim(subname)//"ERROR: Currently cannot handle case of single column with non-land") + ! end if + ! obtain global index array for just land points which includes mask=0 or ocean points call get_proc_bounds( bounds ) nlnd = bounds%endg - bounds%begg + 1 @@ -577,6 +588,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! determine if the mesh will be created or read in call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (single_column) cvalue = 'create_mesh' if (cvalue == 'create_mesh') then ! get the datm grid from the domain file @@ -774,7 +786,7 @@ subroutine ModelAdvance(gcomp, rc) ! Run CTSM !------------------------ - use clm_instMod , only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst + use clm_instMod, only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst ! input/output variables type(ESMF_GridComp) :: gcomp @@ -848,24 +860,9 @@ subroutine ModelAdvance(gcomp, rc) call set_nextsw_cday( nextsw_cday ) !---------------------- - ! Obtain orbital values + ! Get orbital values !---------------------- - call NUOPC_CompAttributeGet(gcomp, name='orb_eccen', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) eccen - - call NUOPC_CompAttributeGet(gcomp, name='orb_obliqr', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) obliqr - - call NUOPC_CompAttributeGet(gcomp, name='orb_lambm0', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) lambm0 - - call NUOPC_CompAttributeGet(gcomp, name='orb_mvelpp', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) mvelpp !-------------------------------- ! Unpack import state @@ -949,6 +946,11 @@ subroutine ModelAdvance(gcomp, rc) call t_barrierf('sync_ctsm_run1', mpicom) call t_startf ('shr_orb_decl') + + ! Note - the orbital inquiries set the values in clm_varorb via the module use statements + call clm_orbital_update(clock, iulog, masterproc, eccen, obliqr, lambm0, mvelpp, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + calday = get_curr_calday() call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) @@ -1199,6 +1201,154 @@ end subroutine ModelFinalize !=============================================================================== + subroutine clm_orbital_init(gcomp, logunit, mastertask, rc) + + !---------------------------------------------------------- + ! Initialize orbital related values + !---------------------------------------------------------- + + ! input/output variables + type(ESMF_GridComp) , intent(in) :: gcomp + integer , intent(in) :: logunit + logical , intent(in) :: mastertask + integer , intent(out) :: rc ! output error + + ! local variables + character(len=CL) :: msgstr ! temporary + character(len=CL) :: cvalue ! temporary + character(len=*) , parameter :: subname = "(clm_orbital_init)" + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Determine orbital attributes from input + call NUOPC_CompAttributeGet(gcomp, name="orb_mode", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_mode + + call NUOPC_CompAttributeGet(gcomp, name="orb_iyear", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_iyear + + call NUOPC_CompAttributeGet(gcomp, name="orb_iyear_align", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_iyear_align + + call NUOPC_CompAttributeGet(gcomp, name="orb_obliq", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_obliq + + call NUOPC_CompAttributeGet(gcomp, name="orb_eccen", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_eccen + + call NUOPC_CompAttributeGet(gcomp, name="orb_mvelp", value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) orb_mvelp + + ! Error checks + if (trim(orb_mode) == trim(orb_fixed_year)) then + orb_obliq = SHR_ORB_UNDEF_REAL + orb_eccen = SHR_ORB_UNDEF_REAL + orb_mvelp = SHR_ORB_UNDEF_REAL + if (orb_iyear == SHR_ORB_UNDEF_INT) then + if (mastertask) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: fixed_year settings = ',orb_iyear + write (msgstr, *) ' ERROR: invalid settings for orb_mode '//trim(orb_mode) + end if + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + return ! bail out + endif + elseif (trim(orb_mode) == trim(orb_variable_year)) then + orb_obliq = SHR_ORB_UNDEF_REAL + orb_eccen = SHR_ORB_UNDEF_REAL + orb_mvelp = SHR_ORB_UNDEF_REAL + if (orb_iyear == SHR_ORB_UNDEF_INT .or. orb_iyear_align == SHR_ORB_UNDEF_INT) then + if (mastertask) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: variable_year settings = ',orb_iyear, orb_iyear_align + write (msgstr, *) subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode) + end if + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + return ! bail out + endif + elseif (trim(orb_mode) == trim(orb_fixed_parameters)) then + !-- force orb_iyear to undef to make sure shr_orb_params works properly + orb_iyear = SHR_ORB_UNDEF_INT + orb_iyear_align = SHR_ORB_UNDEF_INT + if (orb_eccen == SHR_ORB_UNDEF_REAL .or. & + orb_obliq == SHR_ORB_UNDEF_REAL .or. & + orb_mvelp == SHR_ORB_UNDEF_REAL) then + if (mastertask) then + write(logunit,*) trim(subname),' ERROR: invalid settings orb_mode =',trim(orb_mode) + write(logunit,*) trim(subname),' ERROR: orb_eccen = ',orb_eccen + write(logunit,*) trim(subname),' ERROR: orb_obliq = ',orb_obliq + write(logunit,*) trim(subname),' ERROR: orb_mvelp = ',orb_mvelp + write (msgstr, *) subname//' ERROR: invalid settings for orb_mode '//trim(orb_mode) + end if + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + return ! bail out + endif + else + write (msgstr, *) subname//' ERROR: invalid orb_mode '//trim(orb_mode) + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + rc = ESMF_FAILURE + return ! bail out + endif + + end subroutine clm_orbital_init + + !=============================================================================== + + subroutine clm_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm0, mvelpp, rc) + + !---------------------------------------------------------- + ! Update orbital settings + !---------------------------------------------------------- + + ! input/output variables + type(ESMF_Clock) , intent(in) :: clock + integer , intent(in) :: logunit + logical , intent(in) :: mastertask + real(R8) , intent(inout) :: eccen ! orbital eccentricity + real(R8) , intent(inout) :: obliqr ! Earths obliquity in rad + real(R8) , intent(inout) :: lambm0 ! Mean long of perihelion at vernal equinox (radians) + real(R8) , intent(inout) :: mvelpp ! moving vernal equinox longitude of perihelion plus pi (radians) + integer , intent(out) :: rc ! output error + + ! local variables + type(ESMF_Time) :: CurrTime ! current time + integer :: year ! model year at current time + integer :: orb_year ! orbital year for current orbital computation + character(len=CL) :: msgstr ! temporary + character(len=*) , parameter :: subname = "(clm_orbital_update)" + !------------------------------------------- + + if (trim(orb_mode) == trim(orb_variable_year)) then + call ESMF_ClockGet(clock, CurrTime=CurrTime, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_TimeGet(CurrTime, yy=year, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + orb_year = orb_iyear + (year - orb_iyear_align) + else + orb_year = orb_iyear + end if + + eccen = orb_eccen + call shr_orb_params(orb_year, eccen, orb_obliq, orb_mvelp, obliqr, lambm0, mvelpp, mastertask) + + if ( eccen == SHR_ORB_UNDEF_REAL .or. obliqr == SHR_ORB_UNDEF_REAL .or. & + mvelpp == SHR_ORB_UNDEF_REAL .or. lambm0 == SHR_ORB_UNDEF_REAL) then + write (msgstr, *) subname//' ERROR: orb params incorrect' + call ESMF_LogSetError(ESMF_RC_NOT_VALID, msg=msgstr, line=__LINE__, file=__FILE__, rcToReturn=rc) + return ! bail out + endif + + end subroutine clm_orbital_update + + !=============================================================================== + subroutine nc_check_err(ierror, description, filename) integer , intent(in) :: ierror character(*), intent(in) :: description diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index e4928f37a1..ae0dd12788 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -592,6 +592,9 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & co2_ppmv_input(g) = dataPtr(g-begg+1) ! co2 atm prognostic end do end if + if (masterproc) then + write(iulog,*)'DEBUG: nstep, Sa_co2diag= ',get_nstep(),co2_ppmv_input(begg) + end if else if (co2_type == 'diagnostic') then fldName = 'Sa_co2diag' call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) @@ -606,6 +609,9 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & co2_ppmv_input(g) = dataPtr(g-begg+1) ! co2 atm diagnostic end do end if + if (masterproc) then + write(iulog,*)'DEBUG: nstep, Sa_co2prog= ',get_nstep(),co2_ppmv_input(begg) + end if end if ! Note that the following does unit conversions from ppmv to partial pressures (Pa) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index b7549eb282..c2015113de 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -270,13 +270,12 @@ subroutine initialize2( ) ! ! !USES: use shr_orb_mod , only : shr_orb_decl - use shr_scam_mod , only : shr_scam_getCloseLatLon use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND use accumulMod , only : print_accum_fields use clm_varpar , only : nlevsno use clm_varcon , only : spval use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat - use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn, use_fates + use clm_varctl , only : use_century_decomp, use_cn, use_fates use clm_varctl , only : use_crop, ndep_from_cpl use clm_varorb , only : eccen, mvelpp, lambm0, obliqr use clm_time_manager , only : get_step_size_real, get_curr_calday @@ -427,14 +426,6 @@ subroutine initialize2( ) avgflag='A', long_name='convective boundary height', & ptr_col=col%zii, default='inactive') - ! If single-column determine closest latitude and longitude - - if (single_column) then - call getfil (fsurdat, locfn, 0) - call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - closelat, closelon, closelatidx, closelonidx) - end if - ! Initialize instances of all derived types as well as time constant variables call clm_instInit(bounds_proc) diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index e2ea0a06ca..771165459d 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -13,7 +13,7 @@ module surfrdMod use clm_varpar , only : nlevsoifl use landunit_varcon , only : numurbl use clm_varcon , only : grlnd - use clm_varctl , only : iulog, scmlat, scmlon, single_column + use clm_varctl , only : iulog use clm_varctl , only : use_cndv, use_crop use surfrdUtilsMod , only : check_sums_equal_1, collapse_crop_types, collapse_to_dominant, collapse_crop_var, collapse_individual_lunits use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile From ca9c1abc1c4e9991491a555ef5c9e59bab64d816 Mon Sep 17 00:00:00 2001 From: chen693 Date: Fri, 10 Jan 2020 17:01:25 -0800 Subject: [PATCH 0529/1973] add switchgrass and miscanthus --- src/biogeochem/CNPhenologyMod.F90 | 62 ++++++++++++++++++++++--- src/biogeochem/CNVegStructUpdateMod.F90 | 8 +++- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 400d46e11a..a0c34e7472 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -1436,6 +1436,10 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & use pftconMod , only : ntrp_corn, nsugarcane, ntrp_soybean, ncotton, nrice use pftconMod , only : nirrig_trp_corn, nirrig_sugarcane, nirrig_trp_soybean use pftconMod , only : nirrig_cotton, nirrig_rice + + ! Y. Cheng + use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass + use clm_varcon , only : spval, secspday use clm_varctl , only : use_fertilizer use clm_varctl , only : use_c13, use_c14 @@ -1728,9 +1732,13 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ivt(p) == ntrp_soybean .or. ivt(p) == nirrig_trp_soybean) then gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) end if + + ! Y. Cheng, add switchgrass and Miscanthus if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then + ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & + ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & + ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then gddmaturity(p) = max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) gddmaturity(p) = max(950._r8, min(gddmaturity(p)+150._r8, 1850._r8)) end if @@ -1777,9 +1785,13 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ivt(p) == ntrp_soybean .or. ivt(p) == nirrig_trp_soybean) then gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) end if + + ! Y. Cheng, add switchgrass and Miscanthus if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then + ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & + ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & + ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then gddmaturity(p) = max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) end if if (ivt(p) == nswheat .or. ivt(p) == nirrig_swheat .or. & @@ -1838,9 +1850,12 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! calculate linear relationship between huigrain fraction and relative ! maturity rating for maize + ! Y. Cheng, add switchgrass and Miscanthus if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then + ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & + ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & + ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then ! the following estimation of crmcorn from gddmaturity is based on a linear ! regression using data from Pioneer-brand corn hybrids (Kucharik, 2003, ! Earth Interactions 7:1-33: fig. 2) @@ -2373,6 +2388,9 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & ! ! !USES: use pftconMod , only : npcropmin + ! Y. Cheng + use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass + use CNSharedParamsMod, only : use_fun use clm_varctl , only : CNratio_floating ! @@ -2452,8 +2470,22 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & if (offset_counter(p) == dt) then t1 = 1.0_r8 / dt - leafc_to_litter(p) = t1 * leafc(p) + cpool_to_leafc(p) + !leafc_to_litter(p) = t1 * leafc(p) + cpool_to_leafc(p) frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) + + ! Y. Cheng, cut 70% AGB for switchgrass and Miscanthus and move to grainc_to_food + if (ivt(p)==nmiscanthus .or. ivt(p)==nirrig_miscanthus .or. ivt(p)==nswitchgrass .or. ivt(p)==nirrig_switchgrass) then + leafc_to_litter(p) = t1 * leafc(p)*0.3 + cpool_to_leafc(p) + grainc_to_food(p) =grainc_to_food(p)+ t1 * leafc(p) * 0.7 + grainn_to_food(p) =grainn_to_food(p)+ t1 * leafn(p) * 0.7 + +! leafc_to_litter(p) = (t1 * leafc(p) + cpool_to_leafc(p))*0.3 +! grainc_to_food(p) =grainc_to_food(p)+ (t1 * leafc(p) + cpool_to_leafc(p))*0.7 +! grainn_to_food(p) =grainn_to_food(p)+ t1 * leafn(p) * 0.7 + else + leafc_to_litter(p) = t1 * leafc(p) + cpool_to_leafc(p) + end if + ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" if (ivt(p) >= npcropmin) then @@ -2464,8 +2496,15 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & grainc_to_seed(p) = t1 * min(-cropseedc_deficit(p), grainc(p)) grainn_to_seed(p) = t1 * min(-cropseedn_deficit(p), grainn(p)) ! Send the remaining grain to the food product pool - grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) - grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) + + ! Y. Cheng, because I calculated grainc_to_food and grainn_to_food earlier + if (ivt(p)==nmiscanthus .or. ivt(p)==nirrig_miscanthus .or. ivt(p)==nswitchgrass .or. ivt(p)==nirrig_switchgrass) then + grainc_to_food(p) = grainc_to_food(p) + t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) + grainn_to_food(p) = grainn_to_food(p) + t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) + else + grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) + grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) + end if livestemc_to_litter(p) = t1 * livestemc(p) + cpool_to_livestemc(p) end if @@ -2556,6 +2595,17 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & prev_leafc_to_litter(p) = leafc_to_litter(p) prev_frootc_to_litter(p) = frootc_to_litter(p) + + ! Y. Cheng, cut 70% AGB for switchgrass and Miscanthus + if (offset_counter(p) == dt) then + if (ivt(p)==nmiscanthus .or. ivt(p)==nirrig_miscanthus .or. ivt(p)==nswitchgrass .or. ivt(p)==nirrig_switchgrass) then + grainc(p) = grainc(p) + leafc(p)*0.7 + leafc(p) = leafc(p) * 0.3 + grainn(p) = grainn(p) + leafn(p)*0.7 + leafn(p) = leafn(p) * 0.3 + end if + end if + end if ! end if offset period end do ! end patch loop diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 6a990ce89a..b3556a367e 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -41,6 +41,9 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & use pftconMod , only : ntmp_corn, nirrig_tmp_corn use pftconMod , only : ntrp_corn, nirrig_trp_corn use pftconMod , only : nsugarcane, nirrig_sugarcane + ! Y. Cheng + use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass + use pftconMod , only : pftcon use clm_varctl , only : spinup_state use clm_time_manager , only : get_rad_step_size @@ -230,9 +233,12 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & if (tlai(p) >= laimx(ivt(p))) peaklai(p) = 1 ! used in CNAllocation + ! Y. Cheng, add switchgrass and Miscanthus if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then + ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & + ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & + ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then tsai(p) = 0.1_r8 * tlai(p) else tsai(p) = 0.2_r8 * tlai(p) From 90ec6c34d6b97e5ad9c26e0b6462ccbf5a6d3eac Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 10 Jan 2020 22:58:19 -0700 Subject: [PATCH 0530/1973] updates to have orbital calculation done in cap rather than in driver --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 13 +++++++++++-- src/cpl/nuopc/lnd_import_export.F90 | 10 ++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 4b94aad763..075c93c8ed 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -517,7 +517,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call clm_orbital_init(gcomp, iulog, masterproc, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call clm_orbital_update(clock, iulog, masterproc, eccen, obliqr, lambm0, mvelpp, rc) + call clm_orbital_update(clock, iulog, masterproc, eccen, obliqr, lambm0, mvelpp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !---------------------- @@ -1322,6 +1322,8 @@ subroutine clm_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm0 integer :: year ! model year at current time integer :: orb_year ! orbital year for current orbital computation character(len=CL) :: msgstr ! temporary + logical :: lprint + logical :: first_time = .true. character(len=*) , parameter :: subname = "(clm_orbital_update)" !------------------------------------------- @@ -1331,12 +1333,19 @@ subroutine clm_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm0 call ESMF_TimeGet(CurrTime, yy=year, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return orb_year = orb_iyear + (year - orb_iyear_align) + lprint = mastertask else orb_year = orb_iyear + if (first_time) then + lprint = mastertask + first_time = .false. + else + lprint = .false. + end if end if eccen = orb_eccen - call shr_orb_params(orb_year, eccen, orb_obliq, orb_mvelp, obliqr, lambm0, mvelpp, mastertask) + call shr_orb_params(orb_year, eccen, orb_obliq, orb_mvelp, obliqr, lambm0, mvelpp, lprint) if ( eccen == SHR_ORB_UNDEF_REAL .or. obliqr == SHR_ORB_UNDEF_REAL .or. & mvelpp == SHR_ORB_UNDEF_REAL .or. lambm0 == SHR_ORB_UNDEF_REAL) then diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index ae0dd12788..564348854e 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -592,9 +592,6 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & co2_ppmv_input(g) = dataPtr(g-begg+1) ! co2 atm prognostic end do end if - if (masterproc) then - write(iulog,*)'DEBUG: nstep, Sa_co2diag= ',get_nstep(),co2_ppmv_input(begg) - end if else if (co2_type == 'diagnostic') then fldName = 'Sa_co2diag' call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) @@ -609,9 +606,6 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & co2_ppmv_input(g) = dataPtr(g-begg+1) ! co2 atm diagnostic end do end if - if (masterproc) then - write(iulog,*)'DEBUG: nstep, Sa_co2prog= ',get_nstep(),co2_ppmv_input(begg) - end if end if ! Note that the following does unit conversions from ppmv to partial pressures (Pa) @@ -1169,7 +1163,7 @@ subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) end if ! write debug output if appropriate - if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + if (masterproc .and. debug > 0 .and. get_nstep() < 48) then do g = bounds%begg,bounds%endg i = 1 + g - bounds%begg write(iulog,F01)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) @@ -1260,7 +1254,7 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index end if ! write debug output if appropriate - if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + if (masterproc .and. debug > 0 .and. get_nstep() < 48) then do g = bounds%begg,bounds%endg i = 1 + g - bounds%begg write(iulog,F01)'export: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,input(g) From 282d9a0f622fe5286fc551da3ef99b1eaf5143ec Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Tue, 21 Jan 2020 12:51:05 -0700 Subject: [PATCH 0531/1973] add definitions for fv3 grids C24,C48,C96,C192,C384 --- bld/namelist_files/namelist_defaults_ctsm.xml | 226 ++++++++++++++++++ .../namelist_definition_ctsm.xml | 2 +- 2 files changed, 227 insertions(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index a32c807f16..5c911cb4ad 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -618,6 +618,16 @@ attributes from the config_cache.xml file (with keys converted to upper-case). + +lnd/clm2/surfdata_map/surfdata_C24_16pfts_Irrig_CMIP6_simyr2000_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C48_16pfts_Irrig_CMIP6_simyr2000_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C96_16pfts_Irrig_CMIP6_simyr2000_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C192_16pfts_Irrig_CMIP6_simyr2000_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C384_16pfts_Irrig_CMIP6_simyr2000_c181018.nc lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr2000_c170824.nc @@ -654,6 +664,16 @@ lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr2000_c171214.n >lnd/clm2/surfdata_map/surfdata_64x128_16pfts_Irrig_CMIP6_simyr2000_c170824.nc + +lnd/clm2/surfdata_map/surfdata_C384_78pfts_CMIP6_simyr2000_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C192_78pfts_CMIP6_simyr2000_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C96_78pfts_CMIP6_simyr2000_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C48_78pfts_CMIP6_simyr2000_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C24_78pfts_CMIP6_simyr2000_c181018.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc @@ -694,6 +714,16 @@ lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr1850_c170824.n lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr1850_c170824.nc + +lnd/clm2/surfdata_map/surfdata_C384_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C192_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C96_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C48_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C24_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr1850_c170919.nc @@ -720,6 +750,16 @@ lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc lnd/clm2/surfdata_map/surfdata_48x96_78pfts_CMIP6_simyr1850_c170824.nc + +lnd/clm2/surfdata_map/surfdata_C384_hist_78pfts_CMIP6_simyr1850_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C192_hist_78pfts_CMIP6_simyr1850_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C48_hist_78pfts_CMIP6_simyr1850_c181018.nc + +lnd/clm2/surfdata_map/surfdata_C24_hist_78pfts_CMIP6_simyr1850_c181018.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc @@ -2112,6 +2152,192 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc + +lnd/clm2/mappingdata/maps/C24/map_0.5x0.5_MODIS_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_0.25x0.25_MODIS_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_0.5x0.5_AVHRR_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_10x10min_nomask_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_5x5min_IGBP-GSDP_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_5x5min_nomask_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_5x5min_ISRIC-WISE_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_5x5min_ORNL-Soil_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_3x3min_MODIS-wCsp_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_3x3min_USGS_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_3x3min_LandScan2004_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_3x3min_GLOBE-Gardner_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_3x3min_GLOBE-Gardner-mergeGIS_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_0.9x1.25_GRDC_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_360x720cru_cruncep_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C24/map_C24_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc + + + + +lnd/clm2/mappingdata/maps/C48/map_0.5x0.5_MODIS_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_0.25x0.25_MODIS_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_0.5x0.5_AVHRR_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_10x10min_nomask_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_5x5min_IGBP-GSDP_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_5x5min_nomask_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_5x5min_ISRIC-WISE_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_5x5min_ORNL-Soil_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_3x3min_MODIS-wCsp_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_3x3min_USGS_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_3x3min_LandScan2004_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_3x3min_GLOBE-Gardner_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_3x3min_GLOBE-Gardner-mergeGIS_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_0.9x1.25_GRDC_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_360x720cru_cruncep_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_C48_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc + + + +lnd/clm2/mappingdata/maps/C96/map_0.5x0.5_MODIS_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_0.25x0.25_MODIS_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_0.5x0.5_AVHRR_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_10x10min_nomask_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_5x5min_IGBP-GSDP_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_5x5min_nomask_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_5x5min_ISRIC-WISE_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_5x5min_ORNL-Soil_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_3x3min_MODIS-wCsp_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_3x3min_USGS_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_3x3min_LandScan2004_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_3x3min_GLOBE-Gardner_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_3x3min_GLOBE-Gardner-mergeGIS_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_0.9x1.25_GRDC_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_360x720cru_cruncep_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_C96_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc + + + +lnd/clm2/mappingdata/maps/C192/map_0.5x0.5_MODIS_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_0.25x0.25_MODIS_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_0.5x0.5_AVHRR_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_10x10min_nomask_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_5x5min_IGBP-GSDP_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_5x5min_nomask_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_5x5min_ISRIC-WISE_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_5x5min_ORNL-Soil_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_3x3min_MODIS-wCsp_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_3x3min_USGS_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_3x3min_LandScan2004_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_3x3min_GLOBE-Gardner_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_3x3min_GLOBE-Gardner-mergeGIS_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_0.9x1.25_GRDC_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_360x720cru_cruncep_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_C192_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc + + + +lnd/clm2/mappingdata/maps/C384/map_0.5x0.5_MODIS_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_0.25x0.25_MODIS_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_0.5x0.5_AVHRR_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_10x10min_nomask_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_5x5min_IGBP-GSDP_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_5x5min_nomask_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_5x5min_ISRIC-WISE_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_5x5min_ORNL-Soil_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_3x3min_MODIS-wCsp_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_3x3min_USGS_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_3x3min_LandScan2004_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_3x3min_GLOBE-Gardner_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_3x3min_GLOBE-Gardner-mergeGIS_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_0.9x1.25_GRDC_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_360x720cru_cruncep_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C384_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_C384_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc + + lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_MODIS_to_ne4np4_nomask_aave_da_c110923.nc +"512x1024,360x720cru,128x256,64x128,48x96,32x64,8x16,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4,ne60np4,ne120np4,ne240np4,1km-merge-10min,C24,C48,C96,C192,C384"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools From d1f8a1d31c7ede7489b247190e839987c6037a85 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 25 Jan 2020 11:26:56 -0700 Subject: [PATCH 0532/1973] Calculate gridcell-level momentum roughness length This can be sent to atmosphere models that want it --- src/biogeophys/FrictionVelocityMod.F90 | 69 ++++++++++++++++++++++++++ src/main/clm_driver.F90 | 14 ++++++ src/main/lnd2atmMod.F90 | 5 ++ src/main/lnd2atmType.F90 | 2 + 4 files changed, 90 insertions(+) diff --git a/src/biogeophys/FrictionVelocityMod.F90 b/src/biogeophys/FrictionVelocityMod.F90 index 0416a9e053..19af9c9343 100644 --- a/src/biogeophys/FrictionVelocityMod.F90 +++ b/src/biogeophys/FrictionVelocityMod.F90 @@ -55,6 +55,7 @@ module FrictionVelocityMod real(r8), pointer, public :: z0mg_col (:) ! col roughness length over ground, momentum [m] real(r8), pointer, public :: z0hg_col (:) ! col roughness length over ground, sensible heat [m] real(r8), pointer, public :: z0qg_col (:) ! col roughness length over ground, latent heat [m] + real(r8), pointer, public :: z0m_actual_patch (:) ! patch roughness length actually used in flux calculations, momentum [m] contains @@ -62,6 +63,7 @@ module FrictionVelocityMod procedure, public :: Init procedure, public :: Restart procedure, public :: SetRoughnessLengthsAndForcHeightsNonLake ! Set roughness lengths and forcing heights for non-lake points + procedure, public :: SetActualRoughnessLengths ! Set roughness lengths actually used in flux calculations procedure, public :: FrictionVelocity ! Calculate friction velocity procedure, public :: MoninObukIni ! Initialization of the Monin-Obukhov length @@ -136,6 +138,7 @@ subroutine InitAllocate(this, bounds) allocate(this%z0mg_col (begc:endc)) ; this%z0mg_col (:) = nan allocate(this%z0qg_col (begc:endc)) ; this%z0qg_col (:) = nan allocate(this%z0hg_col (begc:endc)) ; this%z0hg_col (:) = nan + allocate(this%z0m_actual_patch (begp:endp)) ; this%z0m_actual_patch (:) = nan end subroutine InitAllocate @@ -493,6 +496,72 @@ subroutine SetRoughnessLengthsAndForcHeightsNonLake(this, bounds, & end subroutine SetRoughnessLengthsAndForcHeightsNonLake + !----------------------------------------------------------------------- + subroutine SetActualRoughnessLengths(this, bounds, & + num_exposedvegp, filter_exposedvegp, & + num_noexposedvegp, filter_noexposedvegp, & + num_urbanp, filter_urbanp, & + num_lakep, filter_lakep) + ! + ! !DESCRIPTION: + ! Set roughness lengths actually used in flux calculations + ! + ! !ARGUMENTS: + class(frictionvel_type) , intent(inout) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 (but does NOT include lake or urban) + integer , intent(in) :: num_urbanp ! number of points in filter_urbanp + integer , intent(in) :: filter_urbanp(:) ! patch filter for urban + integer , intent(in) :: num_lakep ! number of points in filter_lakep + integer , intent(in) :: filter_lakep(:) ! patch filter for lake + ! + ! !LOCAL VARIABLES: + integer :: fp, p, c, l + + character(len=*), parameter :: subname = 'SetActualRoughnessLengths' + !----------------------------------------------------------------------- + + associate( & + z_0_town => lun%z_0_town , & ! Input: [real(r8) (:)] momentum roughness length of urban landunit [m] + + z0mv => this%z0mv_patch , & ! Input: [real(r8) (:)] roughness length over vegetation, momentum [m] + z0mg => this%z0mg_col , & ! Input: [real(r8) (:)] roughness length over ground, momentum [m] + z0m_actual => this%z0m_actual_patch & ! Output: [real(r8) (:)] roughness length actually used in flux calculations, momentum [m] + ) + + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + + z0m_actual(p) = z0mv(p) + end do + + do fp = 1, num_noexposedvegp + p = filter_noexposedvegp(fp) + c = patch%column(p) + + z0m_actual(p) = z0mg(c) + end do + + do fp = 1, num_urbanp + p = filter_urbanp(fp) + l = patch%landunit(p) + + z0m_actual(p) = z_0_town(l) + end do + + do fp = 1, num_lakep + p = filter_lakep(fp) + c = patch%column(p) + + z0m_actual(p) = z0mg(c) + end do + + end associate + end subroutine SetActualRoughnessLengths + !------------------------------------------------------------------------------ subroutine FrictionVelocity(this, lbn, ubn, fn, filtern, & displa, z0m, z0h, z0q, & diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index f931d3ee40..e6f51fc2a1 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -575,6 +575,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! Determine fluxes ! ============================================================================ + call t_startf('bgp_fluxes') call t_startf('bgflux') ! Bareground fluxes for all patches except lakes and urban landunits @@ -657,6 +658,19 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro humanindex_inst) call t_stopf('bgplake') + call frictionvel_inst%SetActualRoughnessLengths( & + bounds = bounds_clump, & + num_exposedvegp = filter(nc)%num_exposedvegp, & + filter_exposedvegp = filter(nc)%exposedvegp, & + num_noexposedvegp = filter(nc)%num_noexposedvegp, & + filter_noexposedvegp = filter(nc)%noexposedvegp, & + num_urbanp = filter(nc)%num_urbanp, & + filter_urbanp = filter(nc)%urbanp, & + num_lakep = filter(nc)%num_lakep, & + filter_lakep = filter(nc)%lakep) + + call t_stopf('bgp_fluxes') + if (irrigate) then ! ============================================================================ diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index acb0f5cfff..658f5e6286 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -240,6 +240,11 @@ subroutine lnd2atm(bounds, & lnd2atm_inst%fsa_grc (bounds%begg:bounds%endg), & p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') + call p2g(bounds, & + frictionvel_inst%z0m_actual_patch (bounds%begp:bounds%endp), & + lnd2atm_inst%z0m_grc (bounds%begg:bounds%endg), & + p2c_scale_type='unity', c2l_scale_type= 'urbans', l2g_scale_type='unity') + call p2g(bounds, & frictionvel_inst%fv_patch (bounds%begp:bounds%endp), & lnd2atm_inst%fv_grc (bounds%begg:bounds%endg), & diff --git a/src/main/lnd2atmType.F90 b/src/main/lnd2atmType.F90 index 509a8afaf2..48a65c77aa 100644 --- a/src/main/lnd2atmType.F90 +++ b/src/main/lnd2atmType.F90 @@ -47,6 +47,7 @@ module lnd2atmType real(r8), pointer :: eflx_sh_ice_to_liq_col(:) => null() ! sensible HF generated from conversion of ice runoff to liquid (W/m**2) [+ to atm] real(r8), pointer :: eflx_lwrad_out_grc (:) => null() ! IR (longwave) radiation (W/m**2) real(r8), pointer :: fsa_grc (:) => null() ! solar rad absorbed (total) (W/m**2) + real(r8), pointer :: z0m_grc (:) => null() ! roughness length, momentum (m) real(r8), pointer :: net_carbon_exchange_grc(:) => null() ! net CO2 flux (kg CO2/m**2/s) [+ to atm] real(r8), pointer :: nem_grc (:) => null() ! gridcell average net methane correction to CO2 flux (g C/m^2/s) real(r8), pointer :: ram1_grc (:) => null() ! aerodynamical resistance (s/m) @@ -145,6 +146,7 @@ subroutine InitAllocate(this, bounds) allocate(this%eflx_sh_ice_to_liq_col(begc:endc)) ; this%eflx_sh_ice_to_liq_col(:) = ival allocate(this%eflx_lh_tot_grc (begg:endg)) ; this%eflx_lh_tot_grc (:) =ival allocate(this%fsa_grc (begg:endg)) ; this%fsa_grc (:) =ival + allocate(this%z0m_grc (begg:endg)) ; this%z0m_grc (:) =ival allocate(this%net_carbon_exchange_grc(begg:endg)) ; this%net_carbon_exchange_grc(:) =ival allocate(this%nem_grc (begg:endg)) ; this%nem_grc (:) =ival allocate(this%ram1_grc (begg:endg)) ; this%ram1_grc (:) =ival From 6665f3e760026175f497d21708fd2fc1b7ab8abd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 27 Jan 2020 11:41:44 -0700 Subject: [PATCH 0533/1973] Add Sl_z0m export field in lilac coupling --- lilac/src/lilac_atmcap.F90 | 1 + src/cpl/lilac/lnd_import_export.F90 | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index e2939a3921..eb7aaba40e 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -143,6 +143,7 @@ subroutine lilac_atmcap_init_vars(atm_gindex_in, atm_lons_in, atm_lats_in, atm_g call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_u10' , units='unknown', lsize=lsize) call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_fv' , units='unknown', lsize=lsize) call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_ram1' , units='unknown', lsize=lsize) + call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_z0m' , units='m' , lsize=lsize) call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_taux' , units='unknown', lsize=lsize) call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_tauy' , units='unknown', lsize=lsize) call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_lat' , units='unknown', lsize=lsize) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 9768b6dc25..9fc41fc296 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -448,6 +448,10 @@ subroutine export_fields(exportState, bounds, rc) input=lnd2atm_inst%fv_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_z0m', bounds, & + input=lnd2atm_inst%z0m_grc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! methanem ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_methane', bounds, & ! input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) From 10297afcbb83fa3695468f6f700957c0f9f3d6ec Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 27 Jan 2020 11:51:58 -0700 Subject: [PATCH 0534/1973] Add a default-inactive history variable for lnd2atm%z0m_grc --- src/main/lnd2atmType.F90 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/lnd2atmType.F90 b/src/main/lnd2atmType.F90 index 48a65c77aa..512ab41ec7 100644 --- a/src/main/lnd2atmType.F90 +++ b/src/main/lnd2atmType.F90 @@ -270,6 +270,14 @@ subroutine InitHistory(this, bounds) ptr_lnd=this%net_carbon_exchange_grc, & default='inactive') + ! No need to set this to spval (or 0) because it is a gridcell-level field, so should + ! have valid values everywhere + call hist_addfld1d(fname='Z0M_TO_COUPLER', units='m', & + avgflag='A', & + long_name='roughness length, momentum: gridcell average sent to coupler', & + ptr_lnd=this%z0m_grc, & + default='inactive') + if (use_lch4) then this%flux_ch4_grc(begg:endg) = 0._r8 call hist_addfld1d (fname='FCH4', units='kgC/m2/s', & From 0779ae0405ffd37bd6ecae94bfadb66064174de4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 28 Jan 2020 13:41:42 -0700 Subject: [PATCH 0535/1973] Change atm_lats and atm_lons to double precision --- lilac/atm_driver/atm_driver.F90 | 6 +++--- lilac/src/lilac_atmcap.F90 | 14 +++++++------- lilac/src/lilac_mod.F90 | 5 +++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 7ed7c9f4c5..09239c05ed 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -29,7 +29,7 @@ program atm_driver integer :: comp_comm integer :: ierr real , allocatable :: centerCoords(:,:) - real , allocatable :: atm_lons(:), atm_lats(:) + real*8 , allocatable :: atm_lons(:), atm_lats(:) integer , allocatable :: atm_global_index(:) integer :: mytask, ntasks integer :: my_start, my_end @@ -333,8 +333,8 @@ end subroutine nc_check_err subroutine atm_driver_to_lilac (lon, lat) ! input/output variables - real, intent(in) :: lon(:) - real, intent(in) :: lat(:) + real*8, intent(in) :: lon(:) + real*8, intent(in) :: lat(:) ! local variables real, allocatable :: lon_rounded(:) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index eb7aaba40e..2c0f756592 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -29,11 +29,11 @@ module lilac_atmcap private :: lilac_atmcap_add_fld ! Time invariant input from host atmosphere - integer, public, allocatable :: gindex_atm(:) ! global index space - real , public, allocatable :: atm_lons(:) ! local longitudes - real , public, allocatable :: atm_lats(:) ! local latitudes - integer, public :: atm_global_nx - integer, public :: atm_global_ny + integer , public, allocatable :: gindex_atm(:) ! global index space + real(r8), public, allocatable :: atm_lons(:) ! local longitudes + real(r8), public, allocatable :: atm_lats(:) ! local latitudes + integer , public :: atm_global_nx + integer , public :: atm_global_ny ! Time variant input from host atmosphere real(r8) :: nextsw_cday = 1.e36_r8 ! calendar day of the next sw calculation @@ -61,8 +61,8 @@ subroutine lilac_atmcap_init_vars(atm_gindex_in, atm_lons_in, atm_lats_in, atm_g ! input/output variables integer , intent(in) :: atm_gindex_in(:) - real , intent(in) :: atm_lons_in(:) - real , intent(in) :: atm_lats_in(:) + real(r8), intent(in) :: atm_lons_in(:) + real(r8), intent(in) :: atm_lats_in(:) integer , intent(in) :: atm_global_nx_in integer , intent(in) :: atm_global_ny_in diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 6d89080d72..620a06f18e 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -13,6 +13,7 @@ module lilac_mod ! shr code routines use shr_pio_mod , only : shr_pio_init1, shr_pio_init2 use shr_sys_mod , only : shr_sys_abort + use shr_kind_mod , only : r8 => shr_kind_r8 ! lilac routines use lilac_io , only : lilac_io_init @@ -91,8 +92,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & ! input/output variables integer , intent(inout) :: mpicom ! input commiunicator from atm integer , intent(in) :: atm_global_index(:) - real , intent(in) :: atm_lons(:) - real , intent(in) :: atm_lats(:) + real(r8) , intent(in) :: atm_lons(:) + real(r8) , intent(in) :: atm_lats(:) integer , intent(in) :: atm_global_nx integer , intent(in) :: atm_global_ny character(len=*) , intent(in) :: atm_calendar From ed6b4b520ec1951256dcf25f3016d5612502f81b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 29 Jan 2020 06:08:33 -0700 Subject: [PATCH 0536/1973] Fix typo regarding stop alarm --- lilac/src/lilac_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 620a06f18e..5bf23dbb1a 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -489,8 +489,8 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! Set the clock stop alarm if stop_alarm_ringing is true if (stop_alarm_is_ringing) then - call ESMF_ClockGetAlarm(lilac_clock, 'lilac_restart_alarm', lilac_stop_alarm, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_restart_alarm") + call ESMF_ClockGetAlarm(lilac_clock, 'lilac_stop_alarm', lilac_stop_alarm, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_stop_alarm") call ESMF_AlarmRingerOn(lilac_stop_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") call ESMF_LogWrite(subname//"lilac stop alarm is ringing", ESMF_LOGMSG_INFO) From adcb690265cc501b72840b520b7c4cacb37d4ec1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 29 Jan 2020 14:14:05 -0700 Subject: [PATCH 0537/1973] Remove some unused code from the time manager The point of this removal is to facilitate removing stop time from the time manager. So I have removed some unused routines related to stop time. I have also removed the unused get_clock because I want to prevent anyone from trying to get the clock and then trying to get the soon-to-be-non-existent stop time out of the clock. --- src/main/histFileMod.F90 | 3 -- src/main/restFileMod.F90 | 3 -- src/utils/clm_time_manager.F90 | 89 ---------------------------------- 3 files changed, 95 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 23690ad51f..849d2f43df 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -5199,9 +5199,6 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, ! Remove history files unless this is end of run or ! history file is not full. ! - ! !USES: - use clm_time_manager, only : is_last_step - ! ! !ARGUMENTS: integer, intent(in) :: ntapes !actual number of history tapes integer, intent(in) :: hist_ntimes(ntapes) !current numbers of time samples on history tape diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 4f718b9228..91967c5ed3 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -361,9 +361,6 @@ subroutine restFile_closeRestart( file ) ! Close restart file and write restart pointer file if ! in write mode, otherwise just close restart file if in read mode ! - ! !USES: - use clm_time_manager, only : is_last_step - ! ! !ARGUMENTS: character(len=*) , intent(in) :: file ! local output filename ! diff --git a/src/utils/clm_time_manager.F90 b/src/utils/clm_time_manager.F90 index 889258fd06..599e73e0a3 100644 --- a/src/utils/clm_time_manager.F90 +++ b/src/utils/clm_time_manager.F90 @@ -21,7 +21,6 @@ module clm_time_manager timemgr_restart, &! restart the time manager using info from timemgr_restart timemgr_datediff, &! calculate difference between two time instants advance_timestep, &! increment timestep number - get_clock, &! get the clock from the time-manager get_curr_ESMF_Time, &! get current time in terms of the ESMF_Time get_step_size, &! return step size in seconds get_step_size_real, &! return step size in seconds, real-valued @@ -54,7 +53,6 @@ module clm_time_manager is_end_curr_month, &! return true on last timestep in current month is_beg_curr_year, &! return true on first timestep in current year is_end_curr_year, &! return true on last timestep in current year - is_last_step, &! return true on last timestep is_perpetual, &! return true if perpetual calendar is in use is_near_local_noon, &! return true if near local noon is_restart, &! return true if this is a restart run @@ -111,7 +109,6 @@ module clm_time_manager logical, save :: tm_first_restart_step = .false. ! true for first step of a restart or branch run logical, save :: tm_perp_calendar = .false. ! true when using perpetual calendar logical, save :: timemgr_set = .false. ! true when timemgr initialized - integer, save :: nestep = uninit_int ! ending time-step ! ! Next short-wave radiation calendar day ! @@ -126,7 +123,6 @@ module clm_time_manager private :: timemgr_spmdbcast private :: init_calendar private :: init_clock - private :: calc_nestep private :: timemgr_print private :: TimeGetymd private :: check_timemgr_initialized @@ -646,10 +642,6 @@ subroutine timemgr_restart( ) tm_first_restart_step = .true. - ! Calculate ending time step - - call calc_nestep( ) - ! Print configuration summary to log file (stdout). if (masterproc) call timemgr_print() @@ -660,33 +652,6 @@ end subroutine timemgr_restart !========================================================================================= - subroutine calc_nestep() - !--------------------------------------------------------------------------------- - ! - ! Calculate ending timestep number - ! Calculation of ending timestep number (nestep) assumes a constant stepsize. - ! - character(len=*), parameter :: sub = 'clm::calc_nestep' - integer :: ntspday ! Number of time-steps per day - type(ESMF_TimeInterval) :: diff ! - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: stop_date ! stop date for run - integer :: ndays, nsecs ! Number of days, seconds to ending time - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, stopTime=stop_date, startTime=start_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - ntspday = isecspday/dtime - diff = stop_date - start_date - call ESMF_TimeIntervalGet( diff, d=ndays, s=nsecs, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet calculating nestep') - nestep = ntspday*ndays + nsecs/dtime - if ( mod(nsecs,dtime) /= 0 ) nestep = nestep + 1 - end subroutine calc_nestep - - !========================================================================================= - subroutine init_calendar( ) !--------------------------------------------------------------------------------- @@ -781,7 +746,6 @@ subroutine timemgr_print() write(iulog,*)' Reference date (yr mon day tod): ', ref_yr, ref_mon, & ref_day, ref_tod write(iulog,*)' Current step number: ', nstep - write(iulog,*)' Ending step number: ', nestep write(iulog,*)' Current date (yr mon day tod): ', curr_yr, curr_mon, & curr_day, curr_tod @@ -814,30 +778,6 @@ end subroutine advance_timestep !========================================================================================= - subroutine get_clock( clock ) - - ! Return the ESMF clock - - type(ESMF_Clock), intent(inout) :: clock - - character(len=*), parameter :: sub = 'clm::get_clock' - type(ESMF_TimeInterval) :: step_size - type(ESMF_Time) :: start_date, stop_date, ref_date - integer :: rc - - if ( .not. check_timemgr_initialized(sub) ) return - - call ESMF_ClockGet( tm_clock, timeStep=step_size, startTime=start_date, & - stoptime=stop_date, reftime=ref_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - call ESMF_ClockSet(clock, timeStep=step_size, startTime=start_date, & - stoptime=stop_date, reftime=ref_date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockSet') - - end subroutine get_clock - - !========================================================================================= - function get_curr_ESMF_Time( ) ! Return the current time as ESMF_Time @@ -1780,34 +1720,6 @@ end function is_first_step_of_this_run_segment !========================================================================================= - logical function is_last_step() - - !--------------------------------------------------------------------------------- - ! Return true on last timestep. - - ! Local variables - character(len=*), parameter :: sub = 'clm::is_last_step' - type(ESMF_Time) :: stop_date - type(ESMF_Time) :: curr_date - type(ESMF_TimeInterval) :: time_step - integer :: rc - !--------------------------------------------------------------------------------- - - if ( .not. check_timemgr_initialized(sub) ) return - - call ESMF_ClockGet( tm_clock, stopTime=stop_date, & - currTime=curr_date, TimeStep=time_step, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - if ( curr_date+time_step > stop_date ) then - is_last_step = .true. - else - is_last_step = .false. - end if - - end function is_last_step - - !========================================================================================= - logical function is_perpetual() ! Return true on last timestep. @@ -2004,7 +1916,6 @@ subroutine timemgr_reset() tm_first_restart_step = .false. tm_perp_calendar = .false. timemgr_set = .false. - nestep = uninit_int nextsw_cday = uninit_r8 From 9ef8f2bceeb1b5e8dee9bdfe639fc7c7b683bf31 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 31 Jan 2020 15:25:24 -0700 Subject: [PATCH 0538/1973] Don't set a real stop time on CTSM's internal clock Stop time was being set but never used. For LILAC, it is awkward to require the stop time to be set in initialization. So I'm removing the need for it entirely. We instead set a dummy stop time far in the future. (If we were using the real ESMF time manager, we could avoid setting stopTime on the clock, but it appears that cime's ESMF time manager requires stopTime to be set.) Also remove unused get_timemgr_defaults. --- src/cpl/lilac/lnd_comp_esmf.F90 | 11 +- src/cpl/mct/lnd_comp_mct.F90 | 10 +- src/cpl/nuopc/lnd_comp_nuopc.F90 | 13 +-- src/utils/clm_time_manager.F90 | 191 ++++++------------------------- 4 files changed, 44 insertions(+), 181 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 92db721b38..36df5fba26 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -146,11 +146,8 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) integer :: ref_tod ! reference time of day (sec) integer :: start_ymd ! start date (YYYYMMDD) integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) type(ESMF_Time) :: currTime ! Current time type(ESMF_Time) :: startTime ! Start time - type(ESMF_Time) :: stopTime ! Stop time type(ESMF_Time) :: refTime ! Ref time type(ESMF_TimeInterval) :: timeStep ! time step from lilac clock @@ -277,7 +274,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- call ESMF_ClockGet( clock, & - currTime=currTime, startTime=startTime, stopTime=stopTime, refTime=RefTime, timeStep=timeStep, rc=rc) + currTime=currTime, startTime=startTime, refTime=RefTime, timeStep=timeStep, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=curr_tod, rc=rc ) @@ -288,10 +285,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,start_ymd) - call ESMF_TimeGet( stopTime, yy=yy, mm=mm, dd=dd, s=stop_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,stop_ymd) - call ESMF_TimeGet( refTime, yy=yy, mm=mm, dd=dd, s=ref_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,ref_ymd) @@ -313,7 +306,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call set_timemgr_init( & calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, stop_tod_in=stop_tod) + ref_ymd_in=ref_ymd, ref_tod_in=ref_tod) !---------------------- ! Read namelist, grid and surface data diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index 8a8f86342b..eeacdcd89a 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -100,8 +100,6 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) integer :: ref_tod ! reference time of day (sec) integer :: start_ymd ! start date (YYYYMMDD) integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type integer :: lbnum ! input to memory diagnostic integer :: shrlogunit,shrloglev ! old values for log unit and log level @@ -167,8 +165,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) call seq_timemgr_EClockGetData(EClock, & start_ymd=start_ymd, & start_tod=start_tod, ref_ymd=ref_ymd, & - ref_tod=ref_tod, stop_ymd=stop_ymd, & - stop_tod=stop_tod, & + ref_tod=ref_tod, & calendar=calendar ) call seq_infodata_GetData(infodata, case_name=caseid, & case_desc=ctitle, single_column=single_column, & @@ -177,8 +174,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) start_type=starttype, model_version=version, & hostname=hostname, username=username ) call set_timemgr_init( calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & - stop_tod_in=stop_tod) + ref_ymd_in=ref_ymd, ref_tod_in=ref_tod) if ( trim(starttype) == trim(seq_infodata_start_type_start)) then nsrest = nsrStartup else if (trim(starttype) == trim(seq_infodata_start_type_cont) ) then @@ -439,7 +435,7 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) end if call update_rad_dtime(doalb) - ! Determine if time to write cam restart and stop + ! Determine if time to write restart and stop rstwr = .false. if (rstwr_sync .and. dosend) rstwr = .true. diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index e5a1174868..df4919d10d 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -313,7 +313,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) type(ESMF_DistGrid) :: DistGrid ! esmf global index space descriptor type(ESMF_Time) :: currTime ! Current time type(ESMF_Time) :: startTime ! Start time - type(ESMF_Time) :: stopTime ! Stop time type(ESMF_Time) :: refTime ! Ref time type(ESMF_TimeInterval) :: timeStep ! Model timestep type(ESMF_Calendar) :: esmf_calendar ! esmf calendar @@ -323,8 +322,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: yy,mm,dd ! Temporaries for time query integer :: start_ymd ! start date (YYYYMMDD) integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) integer :: curr_ymd ! Start date (YYYYMMDD) integer :: curr_tod ! Start time of day (sec) integer :: dtime_sync ! coupling time-step from the input synchronization clock @@ -458,7 +455,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !---------------------- call ESMF_ClockGet( clock, & - currTime=currTime, startTime=startTime, stopTime=stopTime, refTime=RefTime, & + currTime=currTime, startTime=startTime, refTime=RefTime, & timeStep=timeStep, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -470,10 +467,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,start_ymd) - call ESMF_TimeGet( stopTime, yy=yy, mm=mm, dd=dd, s=stop_tod, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call shr_cal_ymd2date(yy,mm,dd,stop_ymd) - call ESMF_TimeGet( refTime, yy=yy, mm=mm, dd=dd, s=ref_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,ref_ymd) @@ -498,9 +491,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) start_ymd_in=start_ymd, & start_tod_in=start_tod, & ref_ymd_in=ref_ymd, & - ref_tod_in=ref_tod, & - stop_ymd_in=stop_ymd, & - stop_tod_in=stop_tod) + ref_tod_in=ref_tod) !---------------------- ! Read namelist, grid and surface data diff --git a/src/utils/clm_time_manager.F90 b/src/utils/clm_time_manager.F90 index 599e73e0a3..f4b69a2608 100644 --- a/src/utils/clm_time_manager.F90 +++ b/src/utils/clm_time_manager.F90 @@ -14,7 +14,6 @@ module clm_time_manager ! Public methods public ::& - get_timemgr_defaults, &! get startup default values set_timemgr_init, &! setup startup values timemgr_init, &! time manager initialization timemgr_restart_io, &! read/write time manager restart info and restart time manager @@ -76,6 +75,9 @@ module clm_time_manager integer, parameter :: uninit_int = -999999999 real(r8), parameter :: uninit_r8 = -999999999.0 + ! We'll use this really big year to effectively mean infinitely into the future. + integer, parameter :: really_big_year = 999999999 + ! Input integer, save ::& dtime = uninit_int, &! timestep in seconds @@ -84,11 +86,8 @@ module clm_time_manager ! Input from CESM driver integer, save ::& - nelapse = uninit_int, &! number of timesteps (or days if negative) to extend a run start_ymd = uninit_int, &! starting date for run in yearmmdd format start_tod = 0, &! starting time of day for run in seconds - stop_ymd = uninit_int, &! stopping date for run in yearmmdd format - stop_tod = 0, &! stopping time of day for run in seconds ref_ymd = uninit_int, &! reference date for time coordinate in yearmmdd format ref_tod = 0 ! reference time of day for time coordinate in seconds type(ESMF_Calendar), target, save :: tm_cal ! calendar @@ -131,57 +130,18 @@ module clm_time_manager contains !========================================================================================= - subroutine get_timemgr_defaults( calendar_out, start_ymd_out, start_tod_out, ref_ymd_out, & - ref_tod_out, stop_ymd_out, stop_tod_out, nelapse_out, & - dtime_out ) - - !--------------------------------------------------------------------------------- - ! get time manager startup default values - ! - ! Arguments - character(len=*), optional, intent(OUT) :: calendar_out ! Calendar type - integer , optional, intent(OUT) :: nelapse_out ! Number of step (or days) to advance - integer , optional, intent(OUT) :: start_ymd_out ! Start date (YYYYMMDD) - integer , optional, intent(OUT) :: start_tod_out ! Start time of day (sec) - integer , optional, intent(OUT) :: ref_ymd_out ! Reference date (YYYYMMDD) - integer , optional, intent(OUT) :: ref_tod_out ! Reference time of day (sec) - integer , optional, intent(OUT) :: stop_ymd_out ! Stop date (YYYYMMDD) - integer , optional, intent(OUT) :: stop_tod_out ! Stop time of day (sec) - integer , optional, intent(OUT) :: dtime_out ! Time-step (sec) - ! - character(len=*), parameter :: sub = 'clm::get_timemgr_defaults' - - if ( timemgr_set ) call shr_sys_abort( sub//":: timemgr_init or timemgr_restart already called" ) - if (present(calendar_out) ) calendar_out = trim(calendar) - if (present(start_ymd_out) ) start_ymd_out = start_ymd - if (present(start_tod_out) ) start_tod_out = start_tod - if (present(ref_ymd_out) ) ref_ymd_out = ref_ymd - if (present(ref_tod_out) ) ref_tod_out = ref_tod - if (present(stop_ymd_out) ) stop_ymd_out = stop_ymd - if (present(stop_tod_out) ) stop_tod_out = stop_tod - if (present(nelapse_out) ) nelapse_out = nelapse - if (present(dtime_out) ) dtime_out = dtime - - end subroutine get_timemgr_defaults - - !========================================================================================= - subroutine set_timemgr_init( calendar_in, start_ymd_in, start_tod_in, ref_ymd_in, & - ref_tod_in, stop_ymd_in, stop_tod_in, perpetual_run_in, & - perpetual_ymd_in, nelapse_in, dtime_in ) + ref_tod_in, perpetual_run_in, perpetual_ymd_in, dtime_in ) !--------------------------------------------------------------------------------- ! set time manager startup values ! ! Arguments character(len=*), optional, intent(IN) :: calendar_in ! Calendar type - integer , optional, intent(IN) :: nelapse_in ! Number of step (or days) to advance integer , optional, intent(IN) :: start_ymd_in ! Start date (YYYYMMDD) integer , optional, intent(IN) :: start_tod_in ! Start time of day (sec) integer , optional, intent(IN) :: ref_ymd_in ! Reference date (YYYYMMDD) integer , optional, intent(IN) :: ref_tod_in ! Reference time of day (sec) - integer , optional, intent(IN) :: stop_ymd_in ! Stop date (YYYYMMDD) - integer , optional, intent(IN) :: stop_tod_in ! Stop time of day (sec) logical , optional, intent(IN) :: perpetual_run_in ! If in perpetual mode or not integer , optional, intent(IN) :: perpetual_ymd_in ! Perpetual date (YYYYMMDD) integer , optional, intent(IN) :: dtime_in ! Time-step (sec) @@ -194,8 +154,6 @@ subroutine set_timemgr_init( calendar_in, start_ymd_in, start_tod_in, r if (present(start_tod_in) ) start_tod = start_tod_in if (present(ref_ymd_in) ) ref_ymd = ref_ymd_in if (present(ref_tod_in) ) ref_tod = ref_tod_in - if (present(stop_ymd_in) ) stop_ymd = stop_ymd_in - if (present(stop_tod_in) ) stop_tod = stop_tod_in if (present(perpetual_run_in) )then tm_perp_calendar = perpetual_run_in if ( tm_perp_calendar ) then @@ -204,7 +162,6 @@ subroutine set_timemgr_init( calendar_in, start_ymd_in, start_tod_in, r perpetual_ymd = perpetual_ymd_in end if end if - if (present(nelapse_in) ) nelapse = nelapse_in if (present(dtime_in) ) dtime = dtime_in end subroutine set_timemgr_init @@ -222,11 +179,8 @@ subroutine timemgr_init( ) integer :: rc ! return code integer :: yr, mon, day, tod ! Year, month, day, and second as integers type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: stop_date ! stop date for run type(ESMF_Time) :: curr_date ! temporary date used in logic type(ESMF_Time) :: ref_date ! reference date for time coordinate - logical :: run_length_specified = .false. - type(ESMF_Time) :: current ! current date (from clock) type(ESMF_TimeInterval) :: day_step_size ! day step size type(ESMF_TimeInterval) :: step_size ! timestep size !--------------------------------------------------------------------------------- @@ -252,53 +206,12 @@ subroutine timemgr_init( ) curr_date = start_date - ! Initalize stop date. - - stop_date = TimeSetymd( 99991231, stop_tod, "stop_date" ) - call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') call ESMF_TimeIntervalSet( day_step_size, d=1, rc=rc ) call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting day_step_size') - if ( stop_ymd /= uninit_int ) then - current = TimeSetymd( stop_ymd, stop_tod, "stop_date" ) - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( nelapse /= uninit_int ) then - if ( nelapse >= 0 ) then - current = curr_date + step_size*nelapse - else - current = curr_date - day_step_size*nelapse - end if - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( .not. run_length_specified ) then - call shr_sys_abort (sub//': Must specify stop_ymd or nelapse') - end if - - ! Error check - - if ( stop_date <= start_date ) then - write(iulog,*)sub, ': stop date must be specified later than start date: ' - call ESMF_TimeGet( start_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Start date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - if ( curr_date >= stop_date ) then - write(iulog,*)sub, ': stop date must be specified later than current date: ' - call ESMF_TimeGet( curr_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Current date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - ! Initalize reference date for time coordinate. if ( ref_ymd /= uninit_int ) then @@ -309,7 +222,7 @@ subroutine timemgr_init( ) ! Initialize clock - call init_clock( start_date, ref_date, curr_date, stop_date ) + call init_clock( start_date, ref_date, curr_date) ! Initialize date used for perpetual calendar day calculation. @@ -327,18 +240,17 @@ end subroutine timemgr_init !========================================================================================= - subroutine init_clock( start_date, ref_date, curr_date, stop_date ) + subroutine init_clock( start_date, ref_date, curr_date ) !--------------------------------------------------------------------------------- - ! Purpose: Initialize the clock based on the start_date, ref_date, and curr_date - ! as well as the settings from the namelist specifying the time to stop + ! Purpose: Initialize the clock based on the start_date, ref_date and curr_date ! type(ESMF_Time), intent(in) :: start_date ! start date for run type(ESMF_Time), intent(in) :: ref_date ! reference date for time coordinate type(ESMF_Time), intent(in) :: curr_date ! current date (equal to start_date) - type(ESMF_Time), intent(in) :: stop_date ! stop date for run ! character(len=*), parameter :: sub = 'clm::init_clock' + type(ESMF_Time) :: stop_date ! stop date for run type(ESMF_TimeInterval) :: step_size ! timestep size type(ESMF_Time) :: current ! current date (from clock) integer :: rc ! return code @@ -347,6 +259,33 @@ subroutine init_clock( start_date, ref_date, curr_date, stop_date ) call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') + ! We don't use a stop time in the CTSM clock. Instead, we set the clock to + ! effectively have a stop time infinitely far into the future, and rely on other + ! mechanisms to tell CTSM when to stop. If we were always using the real ESMF + ! library, we could avoid setting the stopTime on the clock. But the ESMF time + ! manager included in cime appears to require stopTime. + call ESMF_TimeSet(stop_date, yy=really_big_year, mm=12, dd=31, s=0, & + calendar=tm_cal, rc=rc) + + ! Error check + + if ( stop_date <= start_date ) then + write(iulog,*)sub, ': Assumed stop date is earlier than start date: ' + call ESMF_TimeGet( start_date, yy=yr, mm=mon, dd=day, s=tod ) + write(iulog,*) ' Start date (yr, mon, day, tod): ', yr, mon, day, tod + call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) + write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod + call shr_sys_abort + end if + if ( stop_date <= curr_date ) then + write(iulog,*)sub, ': Assumed stop date is earlier than current date: ' + call ESMF_TimeGet( curr_date, yy=yr, mm=mon, dd=day, s=tod ) + write(iulog,*) ' Current date (yr, mon, day, tod): ', yr, mon, day, tod + call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) + write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod + call shr_sys_abort + end if + ! Initialize the clock tm_clock = ESMF_ClockCreate(name="CLM Time-manager clock", timeStep=step_size, startTime=start_date, & @@ -551,11 +490,8 @@ subroutine timemgr_restart( ) type(ESMF_Time) :: start_date ! start date for run type(ESMF_Time) :: ref_date ! reference date for run type(ESMF_Time) :: curr_date ! date of data in restart file - type(ESMF_Time) :: stop_date ! stop date for run - type(ESMF_Time) :: current ! current date (from clock) type(ESMF_TimeInterval) :: day_step_size ! day step size type(ESMF_TimeInterval) :: step_size ! timestep size - logical :: run_length_specified = .false. !--------------------------------------------------------------------------------- call timemgr_spmdbcast( ) @@ -575,52 +511,12 @@ subroutine timemgr_restart( ) curr_date = TimeSetymd( rst_curr_ymd, rst_curr_tod, "curr_date" ) - ! Initialize stop date from sync clock or namelist input - - stop_date = TimeSetymd( 99991231, stop_tod, "stop_date" ) - call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') call ESMF_TimeIntervalSet( day_step_size, d=1, rc=rc ) call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting day_step_size') - if ( stop_ymd /= uninit_int ) then - current = TimeSetymd( stop_ymd, stop_tod, "stop_date" ) - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - else if ( nelapse /= uninit_int ) then - if ( nelapse >= 0 ) then - current = curr_date + step_size*nelapse - else - current = curr_date - day_step_size*nelapse - end if - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( .not. run_length_specified ) then - call shr_sys_abort (sub//': Must specify stop_ymd or nelapse') - end if - - ! Error check - - if ( stop_date <= start_date ) then - write(iulog,*)sub, ': stop date must be specified later than start date: ' - call ESMF_TimeGet( start_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Start date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - if ( curr_date >= stop_date ) then - write(iulog,*)sub, ': stop date must be specified later than current date: ' - call ESMF_TimeGet( curr_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Current date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - ! Initialize nstep_rad_prev from restart info nstep_rad_prev = rst_nstep_rad_prev @@ -631,7 +527,7 @@ subroutine timemgr_restart( ) ! Initialize clock - call init_clock( start_date, ref_date, curr_date, stop_date ) + call init_clock( start_date, ref_date, curr_date) ! Advance the timestep. ! Data from the restart file corresponds to the last timestep of the previous run. @@ -693,10 +589,6 @@ subroutine timemgr_print() start_mon = uninit_int, &! start month start_day = uninit_int, &! start day of month start_tod = uninit_int, &! start time of day - stop_yr = uninit_int, &! stop year - stop_mon = uninit_int, &! stop month - stop_day = uninit_int, &! stop day of month - stop_tod = uninit_int, &! stop time of day ref_yr = uninit_int, &! reference year ref_mon = uninit_int, &! reference month ref_day = uninit_int, &! reference day of month @@ -707,14 +599,13 @@ subroutine timemgr_print() curr_tod = uninit_int ! current time of day integer(ESMF_KIND_I8) :: step_no type(ESMF_Time) :: start_date! start date for run - type(ESMF_Time) :: stop_date ! stop date for run type(ESMF_Time) :: curr_date ! date of data in restart file type(ESMF_Time) :: ref_date ! reference date type(ESMF_TimeInterval) :: step ! Time-step !--------------------------------------------------------------------------------- call ESMF_ClockGet( tm_clock, startTime=start_date, currTime=curr_date, & - refTime=ref_date, stopTime=stop_date, timeStep=step, & + refTime=ref_date, timeStep=step, & advanceCount=step_no, rc=rc ) call chkrc(rc, sub//': error return from ESMF_ClockGet') nstep = step_no @@ -727,9 +618,6 @@ subroutine timemgr_print() call ESMF_TimeGet( start_date, yy=start_yr, mm=start_mon, dd=start_day, & s=start_tod, rc=rc ) call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeGet( stop_date, yy=stop_yr, mm=stop_mon, dd=stop_day, & - s=stop_tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') call ESMF_TimeGet( ref_date, yy=ref_yr, mm=ref_mon, dd=ref_day, s=ref_tod, & rc=rc ) call chkrc(rc, sub//': error return from ESMF_TimeGet') @@ -741,8 +629,6 @@ subroutine timemgr_print() write(iulog,*)' Timestep size (seconds): ', step_sec write(iulog,*)' Start date (yr mon day tod): ', start_yr, start_mon, & start_day, start_tod - write(iulog,*)' Stop date (yr mon day tod): ', stop_yr, stop_mon, & - stop_day, stop_tod write(iulog,*)' Reference date (yr mon day tod): ', ref_yr, ref_mon, & ref_day, ref_tod write(iulog,*)' Current step number: ', nstep @@ -1894,11 +1780,8 @@ subroutine timemgr_reset() dtime_rad = uninit_int nstep_rad_prev = uninit_int - nelapse = uninit_int start_ymd = uninit_int start_tod = 0 - stop_ymd = uninit_int - stop_tod = 0 ref_ymd = uninit_int ref_tod = 0 From 9410cf43796d19196bed144b239476c9714fd33f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 31 Jan 2020 15:49:35 -0700 Subject: [PATCH 0539/1973] Don't set stopTime on LILAC's clock Stopping will be determined via an argument to lilac_run. This allows us to avoid passing the atmosphere's stop time in lilac initialization, which could be awkward (and wasn't being used anyway). Also, rename arguments to lilac_run to avoid referencing the somewhat obscure alarm idea. --- lilac/atm_driver/atm_driver.F90 | 6 ++-- lilac/src/lilac_atmcap.F90 | 2 +- lilac/src/lilac_methods.F90 | 6 ---- lilac/src/lilac_mod.F90 | 23 ++++++---------- lilac/src/lilac_time.F90 | 49 ++++++++++++++++----------------- 5 files changed, 35 insertions(+), 51 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 09239c05ed..1e93269446 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -162,7 +162,7 @@ program atm_driver call lilac_init(comp_comm, atm_global_index, atm_lons, atm_lats, & atm_global_nx, atm_global_ny, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, atm_starttype) + atm_starttype) !------------------------------------------------------------------------ ! Run lilac @@ -234,9 +234,9 @@ program atm_driver call atm_driver_to_lilac (atm_lons, atm_lats) if (nstep == atm_nsteps) then - call lilac_run(restart_alarm_is_ringing=.true., stop_alarm_is_ringing=.true.) + call lilac_run(write_restarts_now=.true., stop_now=.true.) else - call lilac_run(restart_alarm_is_ringing=.false., stop_alarm_is_ringing=.false.) + call lilac_run(write_restarts_now=.false., stop_now=.false.) end if end do diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 2c0f756592..88fd3e45aa 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -10,7 +10,7 @@ module lilac_atmcap ! call lilac_init() ! the host atm run phase will be ! call lilac_atm2lnd(fldname, data1d) - ! call lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) + ! call lilac_run(write_restarts_now, stop_now) ! call lilac_lnd2atm(fldname, data1d) !----------------------------------------------------------------------- diff --git a/lilac/src/lilac_methods.F90 b/lilac/src/lilac_methods.F90 index 7052a6a355..cdfff14c8b 100644 --- a/lilac/src/lilac_methods.F90 +++ b/lilac/src/lilac_methods.F90 @@ -1422,12 +1422,6 @@ subroutine lilac_methods_Clock_TimePrint(clock,string,rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(trim(lstring)//": startime = "//trim(timestr), ESMF_LOGMSG_INFO) - call ESMF_ClockGet(clock,stoptime=time,rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeGet(time,timestring=timestr,rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_LogWrite(trim(lstring)//": stoptime = "//trim(timestr), ESMF_LOGMSG_INFO) - call ESMF_ClockGet(clock,timestep=timestep,rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeIntervalGet(timestep,timestring=timestr,rc=rc) diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 5bf23dbb1a..5b217f0298 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -83,7 +83,7 @@ module lilac_mod subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & atm_global_nx, atm_global_ny, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, starttype_in) + starttype_in) ! -------------------------------------------------------------------------------- ! This is called by the host atmosphere @@ -102,18 +102,12 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & integer , intent(in) :: atm_start_mon !(mm) integer , intent(in) :: atm_start_day integer , intent(in) :: atm_start_secs - integer , intent(in) :: atm_stop_year !(yyyy) - integer , intent(in) :: atm_stop_mon !(mm) - integer , intent(in) :: atm_stop_day - integer , intent(in) :: atm_stop_secs character(len=*) , intent(in) :: starttype_in ! local variables character(ESMF_MAXSTR) :: caseid type(ESMF_TimeInterval) :: timeStep type(ESMF_Time) :: startTime - type(ESMF_Time) :: stopTime - type(ESMF_Alarm) :: EAlarm_stop, EAlarm_rest integer :: yy,mm,dd,sec integer :: lsize type(ESMF_State) :: importState, exportState @@ -329,8 +323,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & call lilac_time_clockInit(caseid, starttype, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, logunit, & - lilac_clock, rc) + logunit, lilac_clock, rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing clock") call ESMF_LogWrite(subname//"lilac_clock initialized", ESMF_LOGMSG_INFO) @@ -447,11 +440,11 @@ end subroutine lilac_init !======================================================================== - subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) + subroutine lilac_run(write_restarts_now, stop_now) ! input/output variables - logical, intent(in) :: restart_alarm_is_ringing - logical, intent(in) :: stop_alarm_is_ringing + logical, intent(in) :: write_restarts_now ! if true, CTSM will write restarts at end of time step + logical, intent(in) :: stop_now ! if true, CTSM will do some finalization at end of time step ! local variables type(ESMF_Alarm) :: lilac_history_alarm @@ -473,7 +466,7 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) ! listen to the restart and stop alarms on the lilac clock ! Set the clock restart alarm if restart_alarm_ringing is true - if (restart_alarm_is_ringing) then + if (write_restarts_now) then ! Turn on lilac restart alarm (this will be needed by ctsm) call ESMF_ClockGetAlarm(lilac_clock, 'lilac_restart_alarm', lilac_restart_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_restart_alarm") @@ -488,7 +481,7 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) end if ! Set the clock stop alarm if stop_alarm_ringing is true - if (stop_alarm_is_ringing) then + if (stop_now) then call ESMF_ClockGetAlarm(lilac_clock, 'lilac_stop_alarm', lilac_stop_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_stop_alarm") call ESMF_AlarmRingerOn(lilac_stop_alarm, rc=rc) @@ -576,7 +569,7 @@ subroutine lilac_run(restart_alarm_is_ringing, stop_alarm_is_ringing) end if end if - if (restart_alarm_is_ringing) then + if (write_restarts_now) then call ESMF_ClockGetAlarm(lilac_clock, 'lilac_restart_alarm', lilac_restart_alarm, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in obtaining lilac_restart_alarm") call ESMF_AlarmRingerOff( lilac_restart_alarm, rc=rc ) diff --git a/lilac/src/lilac_time.F90 b/lilac/src/lilac_time.F90 index 358fecbb31..1438451cca 100644 --- a/lilac/src/lilac_time.F90 +++ b/lilac/src/lilac_time.F90 @@ -35,6 +35,10 @@ module lilac_time type(ESMF_Calendar) :: lilac_calendar integer :: mytask integer, parameter :: SecPerDay = 86400 ! Seconds per day + + ! We'll use this really big year to effectively mean infinitely into the future. + integer, parameter :: really_big_year = 999999999 + character(len=*), parameter :: u_FILE_u = & __FILE__ @@ -44,8 +48,7 @@ module lilac_time subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, logunit, & - lilac_clock, rc) + logunit, lilac_clock, rc) ! ------------------------------------------------- ! Initialize the lilac clock @@ -60,10 +63,6 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep integer , intent(in) :: atm_start_mon !(mm) integer , intent(in) :: atm_start_day integer , intent(in) :: atm_start_secs - integer , intent(in) :: atm_stop_year !(yyyy) - integer , intent(in) :: atm_stop_mon !(mm) - integer , intent(in) :: atm_stop_day - integer , intent(in) :: atm_stop_secs integer , intent(in) :: logunit type(ESMF_Clock) , intent(inout) :: lilac_clock integer , intent(out) :: rc @@ -75,7 +74,6 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep type(ESMF_VM) :: vm type(ESMF_Time) :: StartTime ! Start time type(ESMF_Time) :: CurrTime ! Current time - type(ESMF_Time) :: StopTime ! Stop time type(ESMF_Time) :: Clocktime ! Loop time type(ESMF_TimeInterval) :: TimeStep ! Clock time-step type(ESMF_TimeInterval) :: TimeStep_advance @@ -83,10 +81,6 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep integer :: start_tod ! Start time of day (seconds) integer :: curr_ymd ! Current ymd (YYYYMMDD) integer :: curr_tod ! Current tod (seconds) - integer :: stop_n ! Number until stop - integer :: stop_ymd ! Stop date (YYYYMMDD) - integer :: stop_tod ! Stop time-of-day - character(CS) :: stop_option ! Stop option units character(len=CL) :: restart_file character(len=CL) :: restart_pfile integer :: yr, mon, day, secs ! Year, month, day, seconds as integers @@ -134,13 +128,11 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep calendar=lilac_calendar, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet(StopTime , yy=atm_stop_year , mm=atm_stop_mon , dd=atm_stop_day , s=atm_stop_secs , & - calendar=lilac_calendar, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! Create the lilac clock (NOTE: the reference time is set to the start time) + ! Create the lilac clock + ! NOTE: the reference time is set to the start time + ! NOTE: no stop time is given. Stopping will be determined via an argument passed to lilac_run. lilac_clock = ESMF_ClockCreate(name='lilac_clock', TimeStep=TimeStep, startTime=StartTime, RefTime=StartTime, & - stopTime=stopTime, rc=rc) + rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort(trim(subname)//'error initializing lilac clock') ! ------------------------------ @@ -205,15 +197,20 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep print *, trim(subname) // "---------------------------------------" end if - ! Add a restart alarm and stop alarm to the clock - ! NTOE: The restart alarm and stop alarm will only go off at the end of the run + ! Add a restart alarm and stop alarm to the clock. + ! + ! These alarms are initially set up to never go off, but they are turned on by + ! arguments passed to lilac_run. + ! ! NOTE: The history alarm will be added in lilac_history_init and can go off multiple times during the run - lilac_restart_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_restart_alarm', rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing restart alarm') + call lilac_time_alarmInit(lilac_clock, lilac_restart_alarm, 'lilac_restart_alarm', & + option = optNever, opt_n = -1) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - lilac_stop_alarm = ESMF_AlarmCreate(lilac_clock, ringTime=StopTime, name='lilac_stop_alarm', rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error in initializing stop alarm') + call lilac_time_alarmInit(lilac_clock, lilac_stop_alarm, 'lilac_stop_alarm', & + option = optNever, opt_n = -1) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine lilac_time_clockInit @@ -237,7 +234,7 @@ subroutine lilac_time_alarmInit( clock, alarm, alarmname, option, opt_n, rc) type(ESMF_Alarm) , intent(inout) :: alarm ! alarm character(len=*) , intent(in) :: alarmname ! alarm name character(len=*) , intent(in) :: option ! alarm option - integer , intent(in) :: opt_n ! alarm freq + integer , intent(in) :: opt_n ! alarm freq (ignored for option of optNone or optNever) integer , intent(inout) :: rc ! Return code ! local variables @@ -270,9 +267,9 @@ subroutine lilac_time_alarmInit( clock, alarm, alarmname, option, opt_n, rc) ! Determine inputs for call to create alarm if (trim(option) == optNone .or. trim(option) == optNever) then - call ESMF_TimeIntervalSet(AlarmInterval, yy=9999, rc=rc) + call ESMF_TimeIntervalSet(AlarmInterval, yy=really_big_year, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeSet( NextAlarm, yy=9999, mm=12, dd=1, s=0, calendar=cal, rc=rc ) + call ESMF_TimeSet( NextAlarm, yy=really_big_year, mm=12, dd=1, s=0, calendar=cal, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return update_nextalarm = .false. From f8c3cc713c4ab3ee69bfcf534e26e74c705c108c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 1 Feb 2020 09:50:19 -0700 Subject: [PATCH 0540/1973] Fix compilation errors --- lilac/src/lilac_time.F90 | 4 ++-- src/utils/clm_time_manager.F90 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lilac/src/lilac_time.F90 b/lilac/src/lilac_time.F90 index 1438451cca..524270f283 100644 --- a/lilac/src/lilac_time.F90 +++ b/lilac/src/lilac_time.F90 @@ -205,11 +205,11 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep ! NOTE: The history alarm will be added in lilac_history_init and can go off multiple times during the run call lilac_time_alarmInit(lilac_clock, lilac_restart_alarm, 'lilac_restart_alarm', & - option = optNever, opt_n = -1) + option = optNever, opt_n = -1, rc = rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call lilac_time_alarmInit(lilac_clock, lilac_stop_alarm, 'lilac_stop_alarm', & - option = optNever, opt_n = -1) + option = optNever, opt_n = -1, rc = rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine lilac_time_clockInit diff --git a/src/utils/clm_time_manager.F90 b/src/utils/clm_time_manager.F90 index f4b69a2608..9ad956ebc8 100644 --- a/src/utils/clm_time_manager.F90 +++ b/src/utils/clm_time_manager.F90 @@ -177,7 +177,6 @@ subroutine timemgr_init( ) ! character(len=*), parameter :: sub = 'clm::timemgr_init' integer :: rc ! return code - integer :: yr, mon, day, tod ! Year, month, day, and second as integers type(ESMF_Time) :: start_date ! start date for run type(ESMF_Time) :: curr_date ! temporary date used in logic type(ESMF_Time) :: ref_date ! reference date for time coordinate @@ -253,6 +252,7 @@ subroutine init_clock( start_date, ref_date, curr_date ) type(ESMF_Time) :: stop_date ! stop date for run type(ESMF_TimeInterval) :: step_size ! timestep size type(ESMF_Time) :: current ! current date (from clock) + integer :: yr, mon, day, tod ! Year, month, day, and second as integers integer :: rc ! return code !--------------------------------------------------------------------------------- From eefd78ba64fd75b1747952f22b3b3e2e86789f16 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 3 Feb 2020 16:45:10 -0700 Subject: [PATCH 0541/1973] Update buildnamelist testing for new grids --- bld/unit_testers/build-namelist_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 77ea34f13c..7a1c65f489 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 927; +my $ntests = 947; if ( defined($opts{'compare'}) ) { - $ntests += 588; + $ntests += 603; } plan( tests=>$ntests ); From 7c0d6dc75b11fc75b2da1930ebfc09ceca2f3fd3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 4 Feb 2020 13:36:35 -0700 Subject: [PATCH 0542/1973] Don't send Sl_lfrin to LILAC I don't think this will be needed by atmosphere models in general. If it's needed later, we can always add it back in. --- lilac/atm_driver/atm_driver.F90 | 1 - lilac/src/lilac_atmcap.F90 | 1 - src/cpl/lilac/lnd_import_export.F90 | 4 ---- 3 files changed, 6 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 1e93269446..1d94bae6b2 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -419,7 +419,6 @@ subroutine lilac_to_atm_driver lsize = size(atm_global_index) allocate(data(lsize)) - call lilac_atmcap_lnd2atm('Sl_lfrin' , data) call lilac_atmcap_lnd2atm('Sl_t' , data) call lilac_atmcap_lnd2atm('Sl_tref' , data) call lilac_atmcap_lnd2atm('Sl_qref' , data) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 88fd3e45aa..337b00fe62 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -131,7 +131,6 @@ subroutine lilac_atmcap_init_vars(atm_gindex_in, atm_lons_in, atm_lats_in, atm_g atm2lnd(n)%provided_by_atm = .false. end do - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_lfrin' , units='unknown', lsize=lsize) call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_t' , units='unknown', lsize=lsize) call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_tref' , units='unknown', lsize=lsize) call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_qref' , units='unknown', lsize=lsize) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 9fc41fc296..4f26d6f671 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -359,10 +359,6 @@ subroutine export_fields(exportState, bounds, rc) ! output to atm ! ----------------------- - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_lfrin', bounds, & - input=ldomain%frac, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_t', bounds, & input=lnd2atm_inst%t_rad_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 8c99cba0a7695e4330f726d2891598ce236d3be0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 4 Feb 2020 13:40:49 -0700 Subject: [PATCH 0543/1973] Remove some unneeded code in state_getimport --- src/cpl/lilac/lnd_import_export.F90 | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 4f26d6f671..8dce2d0a0c 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -544,15 +544,9 @@ subroutine state_getimport(state, fb, fldname, bounds, output, ungridded_index, ! local variables integer :: g, i,n - integer :: fieldcount real(R8), pointer :: fldptr1d(:) real(R8), pointer :: fldptr2d(:,:) - type(ESMF_StateItem_Flag) :: itemFlag character(len=cs) :: cvalue - type (ESMF_FieldBundle) :: field - type(ESMF_Field) :: lfield - type (ESMF_FieldBundle) :: fieldBundle - logical :: isPresent character(len=*), parameter :: subname='(lnd_import_export:state_getimport)' ! ---------------------------------------------- @@ -566,14 +560,6 @@ subroutine state_getimport(state, fb, fldname, bounds, output, ungridded_index, if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - ! Get the field bundle - call ESMF_StateGet(state, trim(fb), fieldBundle, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("ERROR: fb "//trim(fb)//" not found in import state") - - ! Get the field - call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Get the pointer to data in the field if (present(ungridded_index)) then write(cvalue,*) ungridded_index From 5a9363f1b9d2a6beef005d70c5f0b870698e09d8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 5 Feb 2020 05:54:27 -0700 Subject: [PATCH 0544/1973] Pass atm landfrac to CTSM and check land mask consistency It is important to ensure that CTSM is running over any point that the atmosphere considers to be land. (The reverse doesn't matter: it's okay for CTSM to run over ocean points; this will result in less efficiency, but won't cause scientific problems.) --- lilac/atm_driver/atm_driver.F90 | 10 +++++ lilac/src/lilac_atmcap.F90 | 1 + src/cpl/lilac/lnd_comp_esmf.F90 | 5 ++- src/cpl/lilac/lnd_import_export.F90 | 65 +++++++++++++++++++++++++++-- 4 files changed, 77 insertions(+), 4 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 1d94bae6b2..9dbc32de50 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -355,6 +355,16 @@ subroutine atm_driver_to_lilac (lon, lat) lat_rounded(i) = real(nint(lat(i))) end do + ! We don't have a good way to set a land mask / fraction in this demo driver. Since it + ! is okay for the atmosphere to call a point ocean when CTSM calls it land, but not + ! the reverse, here we call all points ocean. In a real atmosphere, the atmosphere + ! should set landfrac to > 0 for any point for which it needs land input, to ensure + ! that CTSM is running over all of the necessary points. Note that this landfrac + ! variable doesn't actually impact the running of CTSM, but it is used for + ! consistency checking. + data(:) = 0.d0 + call lilac_atmcap_atm2lnd('Sa_landfrac', data) + data(:) = 30.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Sa_z', data) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 337b00fe62..d03ba1e506 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -90,6 +90,7 @@ subroutine lilac_atmcap_init_vars(atm_gindex_in, atm_lons_in, atm_lats_in, atm_g ! should it pass an array of character strings or a colon deliminited set of fields ! to specify the fields it will not provide - and then these are checked against those fields + call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_landfrac' , units='fraction', required_fr_atm=.true. , lsize=lsize) call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 36df5fba26..8068e6d42c 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -608,6 +608,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) real(r8) :: eccf ! earth orbit eccentricity factor type(bounds_type) :: bounds ! bounds character(len=32) :: rdate ! date char string for restart file names + logical :: first_call = .true. ! true if and only if this is the first time this routine is called in this execution character(*) , parameter :: F02 = "('[lnd_comp_esmf] ',a, d26.19)" character(len=*), parameter :: subname=trim(modName)//':[lnd_run] ' !------------------------------------------------------------------------------- @@ -653,7 +654,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) !-------------------------------- call t_startf ('lc_lnd_import') - call import_fields(import_state, bounds, rc) + call import_fields(import_state, bounds, first_call, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call t_stopf ('lc_lnd_import') @@ -866,6 +867,8 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) endif #endif + first_call = .false. + end subroutine lnd_run !--------------------------------------------------------------------------- diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 8dce2d0a0c..726143211f 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -50,15 +50,16 @@ module lnd_import_export contains !=============================================================================== - subroutine import_fields( importState, bounds, rc) + subroutine import_fields( importState, bounds, first_call, rc) !--------------------------------------------------------------------------- - ! Convert the input data from the lilac to the land model + ! Convert the input data from lilac to the land model !--------------------------------------------------------------------------- - ! input/output variabes + ! input/output variables type(ESMF_State) :: importState type(bounds_type) , intent(in) :: bounds ! bounds + logical , intent(in) :: first_call ! true if and only if this is the first time we're calling import_fields from the run method integer , intent(out) :: rc ! local variables @@ -108,6 +109,14 @@ subroutine import_fields( importState, bounds, rc) ! Set bounds begg = bounds%begg; endg=bounds%endg + if (first_call) then + ! We only do this for the first call because we assume that the atmosphere's land + ! mask is constant in time. To allow for a varying land mask in the atmosphere + ! (doing checking each time), remove this first_call conditional. + call check_atm_landfrac(importState, bounds, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + ! Note: precipitation fluxes received from the coupler ! are in units of kg/s/m^2. To convert these precipitation rates ! in units of mm/sec, one must divide by 1000 kg/m^3 and multiply @@ -334,6 +343,56 @@ subroutine import_fields( importState, bounds, rc) end subroutine import_fields + !=============================================================================== + + subroutine check_atm_landfrac(importState, bounds, rc) + + ! ------------------------------------------------------------------------ + ! Import Sa_landfrac and check it against CTSM's internal land mask. + ! + ! We require that CTSM's internal land mask contains all of the atmosphere's land + ! points (defined as points with landfrac > 0). It is okay for CTSM to include some + ! points that the atmosphere considers to be ocean, but not the reverse. + ! ------------------------------------------------------------------------ + + ! input/output variables + type(ESMF_State) :: importState + type(bounds_type) , intent(in) :: bounds + integer , intent(out) :: rc + + ! local variables + real(r8), pointer :: atm_landfrac(:) + integer :: last_land_index + integer :: n + + character(len=*), parameter :: subname='(check_atm_landfrac)' + !--------------------------------------------------------------------------- + + ! Implementation notes: The CTSM decomposition is set up so that ocean points appear + ! at the end of the vectors received from the coupler. Thus, in order to check if + ! there are any points that the atmosphere considers land but CTSM considers ocean, + ! it is sufficient to check the points following the typical ending bounds in the + ! vectors received from the coupler. + ! + ! Note that we can't use state_getimport here, because that only gets points from + ! bounds%begg:bounds%endg, whereas we want the points following bounds%endg. + + call state_getfldptr(importState, 'c2l_fb_atm', 'Sa_landfrac', fldptr1d=atm_landfrac, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + last_land_index = bounds%endg - bounds%begg + 1 + do n = last_land_index + 1, ubound(atm_landfrac, 1) + if (atm_landfrac(n) > 0._r8) then + write(iulog,*) 'At point ', n, ' atm landfrac = ', atm_landfrac(n) + write(iulog,*) 'but CTSM thinks this is ocean.' + write(iulog,*) "Make sure the mask on CTSM's fatmlndfrc file agrees with the atmosphere's land mask" + call shr_sys_abort( subname//& + ' ERROR: atm landfrac > 0 for a point that CTSM thinks is ocean') + end if + end do + + end subroutine check_atm_landfrac + !============================================================================== subroutine export_fields(exportState, bounds, rc) From d974ad2d2b317a8ada5941f0dcd60b6f08be9c1a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 5 Feb 2020 06:36:03 -0700 Subject: [PATCH 0545/1973] Add a comment --- src/cpl/lilac/lnd_import_export.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 726143211f..beae8c7fb4 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -112,7 +112,10 @@ subroutine import_fields( importState, bounds, first_call, rc) if (first_call) then ! We only do this for the first call because we assume that the atmosphere's land ! mask is constant in time. To allow for a varying land mask in the atmosphere - ! (doing checking each time), remove this first_call conditional. + ! (doing checking each time), remove this first_call conditional. (It would be + ! more straightforward to pass this and check it in initialization, but that would + ! require atm-land communication in initialization, which currently isn't done + ! with the LILAC coupler.) call check_atm_landfrac(importState, bounds, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if From 34c9b79e3379390bee322bf1a09dd7ca53aa2301 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 5 Feb 2020 11:30:37 -0700 Subject: [PATCH 0546/1973] Tweak some of the fields sent from dummy atm to land Goals: - All fields should be non-zero - All fields should be spatially-varying - All fields should have different values --- lilac/atm_driver/atm_driver.F90 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 9dbc32de50..b977a2ec94 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -365,6 +365,10 @@ subroutine atm_driver_to_lilac (lon, lat) data(:) = 0.d0 call lilac_atmcap_atm2lnd('Sa_landfrac', data) + ! In the following, try to have each field have different values, in order to catch + ! mis-matches (e.g., if foo and bar were accidentally swapped in CTSM, we couldn't + ! catch that if they both had the same value). + data(:) = 30.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Sa_z', data) @@ -377,7 +381,7 @@ subroutine atm_driver_to_lilac (lon, lat) data(:) = 40.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Sa_v', data) - data(:) = 280.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 280.1d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Sa_ptem', data) data(:) = 100100.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 @@ -386,22 +390,22 @@ subroutine atm_driver_to_lilac (lon, lat) data(:) = 280.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Sa_tbot', data) - data(:) = 0.0004d0 !+(lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + data(:) = 0.0004d0 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 call lilac_atmcap_atm2lnd('Sa_shum', data) data(:) = 200.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Faxa_lwdn', data) - data(:) = 0.0d0 + data(:) = 1.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 call lilac_atmcap_atm2lnd('Faxa_rainc', data) - data(:) = 3.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + data(:) = 2.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 call lilac_atmcap_atm2lnd('Faxa_rainl', data) - data(:) = 1.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + data(:) = 1.0d-9 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-9 call lilac_atmcap_atm2lnd('Faxa_snowc', data) - data(:) = 2.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + data(:) = 2.0d-9 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-9 call lilac_atmcap_atm2lnd('Faxa_snowl', data) data(:) = 100.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 @@ -410,10 +414,10 @@ subroutine atm_driver_to_lilac (lon, lat) data(:) = 50.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Faxa_swvdr', data) - data(:) = 20.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 25.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Faxa_swndf', data) - data(:) = 40.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 45.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 call lilac_atmcap_atm2lnd('Faxa_swvdf', data) end subroutine atm_driver_to_lilac From a05469c9526402ff2744b8aa86a38e5abe2f47ea Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 5 Feb 2020 12:01:03 -0700 Subject: [PATCH 0547/1973] Remove unused lat_rounded and lon_rounded These were originally here for the sake of comparison against datm: The idea was that lats and lons could differ by a little between datm and this dummy driver, but the rounded-to-the-nearest-integer values should be the same. But it looks like either these were never used, or they were used at one point but then stopped being used. --- lilac/atm_driver/atm_driver.F90 | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index b977a2ec94..e68d6fe221 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -337,24 +337,14 @@ subroutine atm_driver_to_lilac (lon, lat) real*8, intent(in) :: lat(:) ! local variables - real, allocatable :: lon_rounded(:) - real, allocatable :: lat_rounded(:) integer :: lsize real*8, allocatable :: data(:) - integer :: i integer :: i_local ! -------------------------------------------------------- lsize = size(lon) - allocate(lon_rounded(lsize)) - allocate(lat_rounded(lsize)) allocate(data(lsize)) - do i = 1, lsize - lon_rounded(i) = real(nint(lon(i))) - lat_rounded(i) = real(nint(lat(i))) - end do - ! We don't have a good way to set a land mask / fraction in this demo driver. Since it ! is okay for the atmosphere to call a point ocean when CTSM calls it land, but not ! the reverse, here we call all points ocean. In a real atmosphere, the atmosphere From faf75629eea0f61990f4134340da2180ceefbfa0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 5 Feb 2020 12:05:55 -0700 Subject: [PATCH 0548/1973] Introduce a shared variable for dummy atm's space-time perturbation --- lilac/atm_driver/atm_driver.F90 | 39 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index e68d6fe221..4d75881814 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -338,13 +338,18 @@ subroutine atm_driver_to_lilac (lon, lat) ! local variables integer :: lsize + real*8, allocatable :: space_time_perturbation(:) real*8, allocatable :: data(:) + integer :: i integer :: i_local ! -------------------------------------------------------- lsize = size(lon) + allocate(space_time_perturbation(lsize)) allocate(data(lsize)) + space_time_perturbation(:) = lat(:)*0.01d0 + lon(:)*0.01d0 + ! We don't have a good way to set a land mask / fraction in this demo driver. Since it ! is okay for the atmosphere to call a point ocean when CTSM calls it land, but not ! the reverse, here we call all points ocean. In a real atmosphere, the atmosphere @@ -359,55 +364,55 @@ subroutine atm_driver_to_lilac (lon, lat) ! mis-matches (e.g., if foo and bar were accidentally swapped in CTSM, we couldn't ! catch that if they both had the same value). - data(:) = 30.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 30.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Sa_z', data) - data(:) = 10.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 10.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Sa_topo', data) - data(:) = 20.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 20.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Sa_u', data) - data(:) = 40.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 40.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Sa_v', data) - data(:) = 280.1d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 280.1d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Sa_ptem', data) - data(:) = 100100.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 100100.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Sa_pbot', data) - data(:) = 280.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 280.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Sa_tbot', data) - data(:) = 0.0004d0 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + data(:) = 0.0004d0 + space_time_perturbation(:)*1.0e-8 call lilac_atmcap_atm2lnd('Sa_shum', data) - data(:) = 200.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 200.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Faxa_lwdn', data) - data(:) = 1.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + data(:) = 1.0d-8 + space_time_perturbation(:)*1.0e-8 call lilac_atmcap_atm2lnd('Faxa_rainc', data) - data(:) = 2.0d-8 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-8 + data(:) = 2.0d-8 + space_time_perturbation(:)*1.0e-8 call lilac_atmcap_atm2lnd('Faxa_rainl', data) - data(:) = 1.0d-9 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-9 + data(:) = 1.0d-9 + space_time_perturbation(:)*1.0e-9 call lilac_atmcap_atm2lnd('Faxa_snowc', data) - data(:) = 2.0d-9 + (lat(:)*0.01d0 + lon(:)*0.01d0)*1.0e-9 + data(:) = 2.0d-9 + space_time_perturbation(:)*1.0e-9 call lilac_atmcap_atm2lnd('Faxa_snowl', data) - data(:) = 100.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 100.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Faxa_swndr', data) - data(:) = 50.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 50.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Faxa_swvdr', data) - data(:) = 25.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 25.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Faxa_swndf', data) - data(:) = 45.0d0 + lat(:)*0.01d0 + lon(:)*0.01d0 + data(:) = 45.0d0 + space_time_perturbation(:) call lilac_atmcap_atm2lnd('Faxa_swvdf', data) end subroutine atm_driver_to_lilac From ec35b5043b50a9a1271cd99368aba2880c5262df Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 5 Feb 2020 13:16:45 -0700 Subject: [PATCH 0549/1973] Add a time dependence in lilac's demo atm driver --- lilac/atm_driver/atm_driver.F90 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 4d75881814..eb0bf03814 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -231,7 +231,7 @@ program atm_driver do nstep = 1,atm_nsteps ! fill in the dataptr values in atm2lnd type in lilac_atmcap - call atm_driver_to_lilac (atm_lons, atm_lats) + call atm_driver_to_lilac (atm_lons, atm_lats, nstep, atm_nsteps) if (nstep == atm_nsteps) then call lilac_run(write_restarts_now=.true., stop_now=.true.) @@ -330,14 +330,18 @@ subroutine nc_check_err(ierror, description, filename) end subroutine nc_check_err !======================================================================== - subroutine atm_driver_to_lilac (lon, lat) + subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) ! input/output variables real*8, intent(in) :: lon(:) real*8, intent(in) :: lat(:) + integer, intent(in) :: nstep ! current step number + integer, intent(in) :: atm_nsteps ! total number of steps in simulation ! local variables integer :: lsize + real*8 :: time_midpoint + real*8 :: time_perturbation real*8, allocatable :: space_time_perturbation(:) real*8, allocatable :: data(:) integer :: i @@ -348,7 +352,10 @@ subroutine atm_driver_to_lilac (lon, lat) allocate(space_time_perturbation(lsize)) allocate(data(lsize)) - space_time_perturbation(:) = lat(:)*0.01d0 + lon(:)*0.01d0 + ! The time perturbation will range from about -0.5 to 0.5 + time_midpoint = atm_nsteps / 2.d0 + time_perturbation = 0.5d0 * (nstep - time_midpoint)/time_midpoint + space_time_perturbation(:) = time_perturbation + lat(:)*0.01d0 + lon(:)*0.01d0 ! We don't have a good way to set a land mask / fraction in this demo driver. Since it ! is okay for the atmosphere to call a point ocean when CTSM calls it land, but not From 6b9cc2f394e009342910d4fb46655c31fccfdf0c Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 16 Jan 2020 15:03:21 -0700 Subject: [PATCH 0550/1973] adding masterproc conditionals to Fates parameters read to avoid redundant write statements --- src/utils/clmfates_paraminterfaceMod.F90 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/utils/clmfates_paraminterfaceMod.F90 b/src/utils/clmfates_paraminterfaceMod.F90 index 3c750552df..95fef7640c 100644 --- a/src/utils/clmfates_paraminterfaceMod.F90 +++ b/src/utils/clmfates_paraminterfaceMod.F90 @@ -172,11 +172,12 @@ end subroutine GetUsedDimensionSizes !----------------------------------------------------------------------- subroutine ParametersFromNetCDF(filename, is_host_file, fates_params) - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils, only : endrun - use fileutils , only : getfil - use ncdio_pio , only : file_desc_t, ncd_pio_closefile, ncd_pio_openfile - use paramUtilMod, only : readNcdio + use shr_kind_mod , only : r8 => shr_kind_r8 + use abortutils , only : endrun + use fileutils , only : getfil + use ncdio_pio , only : file_desc_t , ncd_pio_closefile , ncd_pio_openfile + use paramUtilMod , only : readNcdio + use spmdMod , only : masterproc use FatesParametersInterface, only : fates_parameters_type use FatesParametersInterface, only : param_string_length, max_dimensions, max_used_dimensions @@ -227,7 +228,9 @@ subroutine ParametersFromNetCDF(filename, is_host_file, fates_params) call endrun(msg='unsupported number of dimensions reading parameters.') end select - write(fates_log(), *) 'clmfates_interfaceMod.F90:: reading '//trim(name) + if (masterproc) then + write(fates_log(), *) 'clmfates_interfaceMod.F90:: reading '//trim(name) + end if call readNcdio(ncid, name, dimension_shape, dimension_names, subname, data(1:size_dim_1, 1:size_dim_2)) call fates_params%SetData(i, data(1:size_dim_1, 1:size_dim_2)) end if From a74d8a9112039eaf3eca5d10454c2ddf602962b9 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 16 Jan 2020 15:15:29 -0700 Subject: [PATCH 0551/1973] change Ln3 to Ln6 in test suites to enable the related test (SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart) pass for cmpes. (Issue #874). --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 36b083427a..4838fa099d 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -256,7 +256,7 @@ - + From 0cef59b62b56c95dd3665d719be76e668b438229 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 16 Jan 2020 15:30:55 -0700 Subject: [PATCH 0552/1973] removing forc_psrf_grc that is not being used in atm2lnd fields (Issue #878) --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- src/main/atm2lndType.F90 | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index a32c807f16..ceaeba094c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -954,7 +954,7 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc.true. .false. -0.83d-06 +0.83d-06 0.015d00 diff --git a/src/main/atm2lndType.F90 b/src/main/atm2lndType.F90 index d89e58dbff..a2d09ca85c 100644 --- a/src/main/atm2lndType.F90 +++ b/src/main/atm2lndType.F90 @@ -78,7 +78,6 @@ module atm2lndType real(r8), pointer :: forc_hgt_t_grc (:) => null() ! obs height of temperature [m] (new) real(r8), pointer :: forc_hgt_q_grc (:) => null() ! obs height of humidity [m] (new) real(r8), pointer :: forc_vp_grc (:) => null() ! atmospheric vapor pressure (Pa) - real(r8), pointer :: forc_psrf_grc (:) => null() ! surface pressure (Pa) real(r8), pointer :: forc_pco2_grc (:) => null() ! CO2 partial pressure (Pa) real(r8), pointer :: forc_pco2_240_patch (:) => null() ! 10-day mean CO2 partial pressure (Pa) real(r8), pointer :: forc_solad_grc (:,:) => null() ! direct beam radiation (numrad) (vis=forc_sols , nir=forc_soll ) @@ -474,7 +473,6 @@ subroutine InitAllocate(this, bounds) allocate(this%forc_hgt_t_grc (begg:endg)) ; this%forc_hgt_t_grc (:) = ival allocate(this%forc_hgt_q_grc (begg:endg)) ; this%forc_hgt_q_grc (:) = ival allocate(this%forc_vp_grc (begg:endg)) ; this%forc_vp_grc (:) = ival - allocate(this%forc_psrf_grc (begg:endg)) ; this%forc_psrf_grc (:) = ival allocate(this%forc_pco2_grc (begg:endg)) ; this%forc_pco2_grc (:) = ival allocate(this%forc_solad_grc (begg:endg,numrad)) ; this%forc_solad_grc (:,:) = ival allocate(this%forc_solai_grc (begg:endg,numrad)) ; this%forc_solai_grc (:,:) = ival @@ -992,7 +990,6 @@ subroutine Clean(this) deallocate(this%forc_hgt_t_grc) deallocate(this%forc_hgt_q_grc) deallocate(this%forc_vp_grc) - deallocate(this%forc_psrf_grc) deallocate(this%forc_pco2_grc) deallocate(this%forc_solad_grc) deallocate(this%forc_solai_grc) From dfd339d2a405e7f5698761d89c9666b21b9d7a57 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 16 Jan 2020 15:33:25 -0700 Subject: [PATCH 0553/1973] renaming forc_psrf in DryDepVelocity.F90 to forc_pbot (Issue # 878) --- src/biogeochem/DryDepVelocity.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/DryDepVelocity.F90 b/src/biogeochem/DryDepVelocity.F90 index 4f083953de..99daf9580c 100644 --- a/src/biogeochem/DryDepVelocity.F90 +++ b/src/biogeochem/DryDepVelocity.F90 @@ -286,7 +286,7 @@ subroutine depvel_compute( bounds, & forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (visible only) forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric temperature (Kelvin) forc_q => wateratm2lndbulk_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric specific humidity (kg/kg) - forc_psrf => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] downscaled surface pressure (Pa) + forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] downscaled surface pressure (Pa) forc_rain => wateratm2lndbulk_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] downscaled rain rate [mm/s] h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) @@ -318,7 +318,7 @@ subroutine depvel_compute( bounds, & c = patch%column(pi) g = patch%gridcell(pi) - pg = forc_psrf(c) + pg = forc_pbot(c) spec_hum = forc_q(c) rain = forc_rain(c) sfc_temp = forc_t(c) From 35cba22dccd8b84c8ed05223b43e8bd2d7e31c64 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 16 Jan 2020 15:44:21 -0700 Subject: [PATCH 0554/1973] Remove ReadNL private subroutine in CTSM/src/main/initVerticalMod.F90 which is not being used (Issue #745) --- src/main/initVerticalMod.F90 | 55 ------------------------------------ 1 file changed, 55 deletions(-) diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index cffe404830..62790a175a 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -41,7 +41,6 @@ module initVerticalMod public :: initVertical ! !PRIVATE MEMBER FUNCTIONS: - private :: ReadNL private :: hasBedrock ! true if the given column type includes bedrock layers ! @@ -53,60 +52,6 @@ module initVerticalMod contains - !------------------------------------------------------------------------ - subroutine ReadNL( ) - ! - ! !DESCRIPTION: - ! Read namelist for SoilStateType - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getavu, relavu, opnfil - use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : iulog - use spmdMod , only : mpicom, masterproc - use controlMod , only : NLFilename - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'InitVertical_readnl' ! subroutine name - !----------------------------------------------------------------------- - - character(len=*), parameter :: nl_name = 'clm_inparm' ! Namelist name - - ! MUST agree with name in namelist and read - namelist /clm_inparm/ use_bedrock - - ! preset values - - use_bedrock = .false. - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in '//nl_name//' namelist' - call opnfil (NLFilename, unitn, 'F') - call find_nlgroup_name(unitn, nl_name, status=ierr) - if (ierr == 0) then - read(unit=unitn, nml=clm_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - call shr_mpi_bcast(use_bedrock, mpicom) - - end subroutine ReadNL - !------------------------------------------------------------------------ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof) use clm_varcon, only : zmin_bedrock From 793ecfbc683bb184fabb146b32b20df94d1dadd2 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 16 Jan 2020 16:19:18 -0700 Subject: [PATCH 0555/1973] clarifying zisno levels in the variable long name (Issue #838) --- src/main/subgridRestMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/subgridRestMod.F90 b/src/main/subgridRestMod.F90 index 867660939e..14df9c8710 100644 --- a/src/main/subgridRestMod.F90 +++ b/src/main/subgridRestMod.F90 @@ -532,7 +532,7 @@ subroutine subgridRest_write_and_read(bounds, ncid, flag) end if call restartvar(ncid=ncid, flag=flag, varname='ZISNO', xtype=ncd_double, & dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno, upperb2=-1, & - long_name='snow interface depth', units='m', & + long_name='snow interface depth at the top of layer j', units='m', & interpinic_flag='interp', readvar=readvar, data=temp2d) if (flag == 'read') then col%zi(bounds%begc:bounds%endc,-nlevsno:-1) = temp2d(bounds%begc:bounds%endc,-nlevsno:-1) From 9914fc975f5ac9328443030f5184504c4067a26d Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Fri, 17 Jan 2020 15:03:45 -0700 Subject: [PATCH 0556/1973] Removing the conditionals ( OMP ifdefs) for bounds assertion when threading is on (Issue #811) --- src/biogeochem/CNPrecisionControlMod.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 1f5e10b127..c93a2e55d7 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -435,7 +435,6 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n SHR_ASSERT_ALL_FL((ubound(nitrogen_patch) == (/bounds%endp/)), 'ubnd(nitro)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//sourcefile, lineno) -#ifndef _OPENMP if ( present(c13) .and. use_c13 )then SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) @@ -444,7 +443,6 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) end if -#endif if ( present(pc13) )then SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) end if @@ -522,7 +520,6 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l SHR_ASSERT_ALL_FL((ubound(carbon_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), sourcefile, __LINE__) -#ifndef _OPENMP if ( present(c13) .and. use_c13 )then SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), sourcefile, __LINE__) @@ -531,7 +528,6 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), sourcefile, __LINE__) end if -#endif if ( present(pc13) )then SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), sourcefile, __LINE__) end if From 888d9259ed91d5180b188657ef909d3e8ae19660 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Fri, 17 Jan 2020 15:09:32 -0700 Subject: [PATCH 0557/1973] rewording of zisno levels variable long name (Issue #838) --- src/main/subgridRestMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/subgridRestMod.F90 b/src/main/subgridRestMod.F90 index 14df9c8710..ee5c9bf22d 100644 --- a/src/main/subgridRestMod.F90 +++ b/src/main/subgridRestMod.F90 @@ -532,7 +532,7 @@ subroutine subgridRest_write_and_read(bounds, ncid, flag) end if call restartvar(ncid=ncid, flag=flag, varname='ZISNO', xtype=ncd_double, & dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno, upperb2=-1, & - long_name='snow interface depth at the top of layer j', units='m', & + long_name='snow interface depth at the top of the given layer', units='m', & interpinic_flag='interp', readvar=readvar, data=temp2d) if (flag == 'read') then col%zi(bounds%begc:bounds%endc,-nlevsno:-1) = temp2d(bounds%begc:bounds%endc,-nlevsno:-1) From f0984e375bc93ee84f2b3aba848fbf6884495196 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 27 Jan 2020 15:36:48 -0700 Subject: [PATCH 0558/1973] Fixing the wrong wallclock time on SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs... test. --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 4838fa099d..8c5f30c220 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1900,7 +1900,7 @@ - + From 007ff4cead3dbf9f4ecee367074442629c16f891 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 27 Jan 2020 15:54:52 -0700 Subject: [PATCH 0559/1973] fixing the bound assertions bug -- removing pointer attribute from c13 and c14 --- src/biogeochem/CNPrecisionControlMod.F90 | 52 ++++++++++++------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index c93a2e55d7..26910546ea 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -413,20 +413,20 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n ! ! !ARGUMENTS: implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8), intent(inout) :: carbon_patch(bounds%begp:) - real(r8), intent(inout) :: nitrogen_patch(bounds%begp:) - real(r8), intent(inout) :: pc(bounds%begp:) - real(r8), intent(inout) :: pn(bounds%begp:) - integer, intent(in) :: lineno - real(r8), intent(inout), optional, pointer :: c13(:) - real(r8), intent(inout), optional, pointer :: c14(:) - real(r8), intent(inout), optional :: pc13(bounds%begp:) - real(r8), intent(inout), optional :: pc14(bounds%begp:) - logical , intent(in) , optional :: croponly - logical , intent(in) , optional :: allowneg + type(bounds_type) , intent(in) :: bounds ! bounds + integer , intent(in) :: num_soilp ! number of soil patchs in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + real(r8), intent(inout) :: carbon_patch(bounds%begp:) + real(r8), intent(inout) :: nitrogen_patch(bounds%begp:) + real(r8), intent(inout) :: pc(bounds%begp:) + real(r8), intent(inout) :: pn(bounds%begp:) + integer, intent(in) :: lineno + real(r8), intent(inout), optional :: c13 (bounds%begp:) + real(r8), intent(inout), optional :: c14 (bounds%begp:) + real(r8), intent(inout), optional :: pc13(bounds%begp:) + real(r8), intent(inout), optional :: pc14(bounds%begp:) + logical , intent(in) , optional :: croponly + logical , intent(in) , optional :: allowneg logical :: lcroponly, lallowneg integer :: fp, p @@ -502,18 +502,18 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l ! ! !ARGUMENTS: implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8) , intent(inout) :: carbon_patch(bounds%begp:) - real(r8) , intent(inout) :: pc(bounds%begp:) - integer , intent(in) :: lineno - real(r8) , intent(inout), optional, pointer :: c13(:) - real(r8) , intent(inout), optional, pointer :: c14(:) - real(r8) , intent(inout), optional :: pc13(bounds%begp:) - real(r8) , intent(inout), optional :: pc14(bounds%begp:) - logical , intent(in) , optional :: croponly - logical , intent(in) , optional :: allowneg + type(bounds_type), intent (in) :: bounds ! bounds + integer , intent (in) :: num_soilp ! number of soil patchs in filter + integer , intent (in) :: filter_soilp(:) ! filter for soil patches + real(r8) , intent (inout) :: carbon_patch(bounds%begp:) + real(r8) , intent (inout) :: pc(bounds%begp:) + integer , intent (in) :: lineno + real(r8) , intent (inout), optional :: c13 (bounds%begp:) + real(r8) , intent (inout), optional :: c14 (bounds%begp:) + real(r8) , intent (inout), optional :: pc13(bounds%begp:) + real(r8) , intent (inout), optional :: pc14(bounds%begp:) + logical , intent (in) , optional :: croponly + logical , intent (in) , optional :: allowneg logical :: lcroponly, lallowneg integer :: fp, p From 11752f30a80990593d9d98a1ba9101ff653f0007 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 27 Jan 2020 16:15:12 -0700 Subject: [PATCH 0560/1973] just alignment.... --- src/biogeochem/CNPrecisionControlMod.F90 | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 26910546ea..90f62ed243 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -413,20 +413,20 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n ! ! !ARGUMENTS: implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8), intent(inout) :: carbon_patch(bounds%begp:) - real(r8), intent(inout) :: nitrogen_patch(bounds%begp:) - real(r8), intent(inout) :: pc(bounds%begp:) - real(r8), intent(inout) :: pn(bounds%begp:) - integer, intent(in) :: lineno - real(r8), intent(inout), optional :: c13 (bounds%begp:) - real(r8), intent(inout), optional :: c14 (bounds%begp:) - real(r8), intent(inout), optional :: pc13(bounds%begp:) - real(r8), intent(inout), optional :: pc14(bounds%begp:) - logical , intent(in) , optional :: croponly - logical , intent(in) , optional :: allowneg + type(bounds_type) , intent (in) :: bounds ! bounds + integer , intent (in) :: num_soilp ! number of soil patchs in filter + integer , intent (in) :: filter_soilp(:) ! filter for soil patches + real(r8) , intent (inout) :: carbon_patch(bounds%begp:) + real(r8) , intent (inout) :: nitrogen_patch(bounds%begp:) + real(r8) , intent (inout) :: pc(bounds%begp:) + real(r8) , intent (inout) :: pn(bounds%begp:) + integer , intent (in) :: lineno + real(r8) , intent (inout), optional :: c13 (bounds%begp:) + real(r8) , intent (inout), optional :: c14 (bounds%begp:) + real(r8) , intent (inout), optional :: pc13(bounds%begp:) + real(r8) , intent (inout), optional :: pc14(bounds%begp:) + logical , intent (in) , optional :: croponly + logical , intent (in) , optional :: allowneg logical :: lcroponly, lallowneg integer :: fp, p From 1fa14a278a3c5cbced18138e152f240438ac96d4 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 27 Jan 2020 16:19:35 -0700 Subject: [PATCH 0561/1973] removing the lower bound check for c13 c14 --- src/biogeochem/CNPrecisionControlMod.F90 | 30 +++++++++++------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 90f62ed243..f27fe7290a 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -413,20 +413,20 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n ! ! !ARGUMENTS: implicit none - type(bounds_type) , intent (in) :: bounds ! bounds - integer , intent (in) :: num_soilp ! number of soil patchs in filter - integer , intent (in) :: filter_soilp(:) ! filter for soil patches - real(r8) , intent (inout) :: carbon_patch(bounds%begp:) - real(r8) , intent (inout) :: nitrogen_patch(bounds%begp:) - real(r8) , intent (inout) :: pc(bounds%begp:) - real(r8) , intent (inout) :: pn(bounds%begp:) - integer , intent (in) :: lineno - real(r8) , intent (inout), optional :: c13 (bounds%begp:) - real(r8) , intent (inout), optional :: c14 (bounds%begp:) - real(r8) , intent (inout), optional :: pc13(bounds%begp:) - real(r8) , intent (inout), optional :: pc14(bounds%begp:) - logical , intent (in) , optional :: croponly - logical , intent (in) , optional :: allowneg + type(bounds_type), intent (in) :: bounds ! bounds + integer , intent (in) :: num_soilp ! number of soil patchs in filter + integer , intent (in) :: filter_soilp(:) ! filter for soil patches + real(r8) , intent (inout) :: carbon_patch(bounds%begp:) + real(r8) , intent (inout) :: nitrogen_patch(bounds%begp:) + real(r8) , intent (inout) :: pc(bounds%begp:) + real(r8) , intent (inout) :: pn(bounds%begp:) + integer , intent (in) :: lineno + real(r8) , intent (inout), optional :: c13 (bounds%begp:) + real(r8) , intent (inout), optional :: c14 (bounds%begp:) + real(r8) , intent (inout), optional :: pc13(bounds%begp:) + real(r8) , intent (inout), optional :: pc14(bounds%begp:) + logical , intent (in) , optional :: croponly + logical , intent (in) , optional :: allowneg logical :: lcroponly, lallowneg integer :: fp, p @@ -521,11 +521,9 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l SHR_ASSERT_ALL_FL((ubound(carbon_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), sourcefile, __LINE__) if ( present(c13) .and. use_c13 )then - SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), sourcefile, __LINE__) end if if ( present(c14) .and. use_c14 )then - SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), sourcefile, __LINE__) end if if ( present(pc13) )then From ddffaf6e9e4b661f249bb311e3d1545a4f7560b7 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 27 Jan 2020 16:21:06 -0700 Subject: [PATCH 0562/1973] Also removing the lower bound check for c13 c14 --- src/biogeochem/CNPrecisionControlMod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index f27fe7290a..8cb0d8167e 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -436,11 +436,9 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//sourcefile, lineno) if ( present(c13) .and. use_c13 )then - SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) end if if ( present(c14) .and. use_c14 )then - SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) end if if ( present(pc13) )then From f4d743964bb0a0d7266a6cea29f1a83dd75e1b42 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 27 Jan 2020 16:46:44 -0700 Subject: [PATCH 0563/1973] adding ubounds for all arrays called by TrancateCandNState, TruncateCStates ,and etc..... --- src/biogeochem/CNPrecisionControlMod.F90 | 162 +++++++++++------------ 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 8cb0d8167e..4657194ed9 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -204,177 +204,177 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! leaf C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & ns%leafn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%leafc_patch(bounds%begp:bounds%endp), c14=c14cs%leafc_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! leaf storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & - ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%leafc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%leafc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! leaf transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & - ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! froot C and N ! EBK KO DML: For some reason frootc/frootn can go negative and allowing ! it to be negative is important for C4 crops (otherwise they die) Jun/3/2016 if ( prec_control_for_froot ) then call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & - ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) + ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%frootc_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true. ) end if ! froot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & - ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%frootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! froot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & - ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) if ( use_crop )then ! grain C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & - ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%grainc_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & - ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%grainc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & - ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & - pn(bounds%begp:), __LINE__, & - c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) + ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), & + pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), c14=c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true., croponly=.true. ) end if ! livestem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & - ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%livestemc_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livestem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livestem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & - ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%deadstemc_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_storage_patch, c14=c14cs%deadstemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & - ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%livecrootc_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%deadcrootc_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + __LINE__, c13=c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%gresp_storage_patch, c14=c14cs%gresp_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + pc(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%gresp_storage_patch(bounds%begp:bounds%endp), c14=c14cs%gresp_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! gresp_xfer(c only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%gresp_xfer_patch, c14=c14cs%gresp_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + pc(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%gresp_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%gresp_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! cpool (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%cpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%cpool_patch, c14=c14cs%cpool_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + pc(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%cpool_patch(bounds%begp:bounds%endp), c14=c14cs%cpool_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) if ( use_crop )then ! xsmrpool (C only) ! xsmr is a pool to balance the budget and as such can be freely negative call TruncateCStates( bounds, filter_soilp, num_soilp, cs%xsmrpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%xsmrpool_patch, c14=c14cs%xsmrpool_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) + pc(bounds%begc:bounds%endc), __LINE__, & + c13=c13cs%xsmrpool_patch(bounds%begp:bounds%endp), c14=c14cs%xsmrpool_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true., croponly=.true. ) end if ! retransn (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), pn(bounds%begp:), & + call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), pn(bounds%begc:bounds%endc), & __LINE__ ) ! npool (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), pn(bounds%begp:), & + call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), pn(bounds%begc:bounds%endc), & __LINE__ ) ! patch loop From 3f5e33ee4feadef35ca3346a81253e1e52b99ddb Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 27 Jan 2020 17:10:58 -0700 Subject: [PATCH 0564/1973] correcting the in the upper bound name... --- src/biogeochem/CNPrecisionControlMod.F90 | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 4657194ed9..d052db8d7d 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -210,13 +210,13 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! leaf storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & - ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%leafc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%leafc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! leaf transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & - ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) @@ -225,46 +225,46 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! it to be negative is important for C4 crops (otherwise they die) Jun/3/2016 if ( prec_control_for_froot ) then call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & - ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%frootc_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true. ) end if ! froot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & - ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%frootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! froot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & - ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) if ( use_crop )then ! grain C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & - ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%grainc_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & - ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%grainc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & - ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), & - pn(bounds%begc:bounds%endc), __LINE__, & + ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), & + pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), c14=c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true., croponly=.true. ) @@ -272,90 +272,90 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! livestem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & - ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%livestemc_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livestem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livestem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & - ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%deadstemc_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & - ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%livecrootc_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), __LINE__, & + ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%deadcrootc_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begc:bounds%endc), pn(bounds%begc:bounds%endc), & + ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__, c13=c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begc:bounds%endc), __LINE__, & + pc(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%gresp_storage_patch(bounds%begp:bounds%endp), c14=c14cs%gresp_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! gresp_xfer(c only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begc:bounds%endc), __LINE__, & + pc(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%gresp_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%gresp_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! cpool (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%cpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begc:bounds%endc), __LINE__, & + pc(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%cpool_patch(bounds%begp:bounds%endp), c14=c14cs%cpool_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) @@ -363,18 +363,18 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! xsmrpool (C only) ! xsmr is a pool to balance the budget and as such can be freely negative call TruncateCStates( bounds, filter_soilp, num_soilp, cs%xsmrpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begc:bounds%endc), __LINE__, & + pc(bounds%begp:bounds%endp), __LINE__, & c13=c13cs%xsmrpool_patch(bounds%begp:bounds%endp), c14=c14cs%xsmrpool_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true., croponly=.true. ) end if ! retransn (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), pn(bounds%begc:bounds%endc), & + call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__ ) ! npool (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), pn(bounds%begc:bounds%endc), & + call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & __LINE__ ) ! patch loop From 67088d7527b729bdffaffe0484c4b77497db1932 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 29 Jan 2020 13:25:30 -0700 Subject: [PATCH 0565/1973] cleaning up CNPrecisionControlMod.F90: breaking long lines + adjusting.... --- src/biogeochem/CNPrecisionControlMod.F90 | 173 ++++++++++++++--------- 1 file changed, 110 insertions(+), 63 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index d052db8d7d..88609d9757 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -205,19 +205,24 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & ns%leafn_patch(bounds%begp:bounds%endp), & pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%leafc_patch(bounds%begp:bounds%endp), c14=c14cs%leafc_patch(bounds%begp:bounds%endp), & + c13=c13cs%leafc_patch(bounds%begp:bounds%endp), & + c14=c14cs%leafc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! leaf storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & - ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%leafc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%leafc_storage_patch(bounds%begp:bounds%endp), & + ns%leafn_storage_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%leafc_storage_patch(bounds%begp:bounds%endp), & + c14=c14cs%leafc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! leaf transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & - ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), & + ns%leafn_xfer_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), & + c14=c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! froot C and N @@ -225,138 +230,178 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! it to be negative is important for C4 crops (otherwise they die) Jun/3/2016 if ( prec_control_for_froot ) then call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & - ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%frootc_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_patch(bounds%begp:bounds%endp), & + ns%frootn_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%frootc_patch(bounds%begp:bounds%endp), & + c14=c14cs%frootc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true. ) end if ! froot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & - ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%frootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%frootn_storage_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%frootc_storage_patch(bounds%begp:bounds%endp), & + c14=c14cs%frootc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! froot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & - ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), & + ns%frootn_xfer_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), & + c14=c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) if ( use_crop )then ! grain C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & - ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%grainc_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_patch(bounds%begp:bounds%endp), & + ns%grainn_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%grainc_patch(bounds%begp:bounds%endp), & + c14=c14cs%grainc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & - ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%grainc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_storage_patch(bounds%begp:bounds%endp), & + ns%grainn_storage_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%grainc_storage_patch(bounds%begp:bounds%endp), & + c14=c14cs%grainc_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & - ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), & + ns%grainn_xfer_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), & + c14=c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), & - pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), c14=c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & + ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & + c14=c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true., croponly=.true. ) end if ! livestem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & - ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%livestemc_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_patch(bounds%begp:bounds%endp), & + ns%livestemn_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%livestemc_patch(bounds%begp:bounds%endp), & + c14=c14cs%livestemc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livestem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livestemn_storage_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), & + c14=c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livestem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livestemn_xfer_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & + c14=c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & - ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%deadstemc_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_patch(bounds%begp:bounds%endp), & + ns%deadstemn_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%deadstemc_patch(bounds%begp:bounds%endp), & + c14=c14cs%deadstemc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadstemn_storage_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & + c14=c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadstem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & + c14=c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & - ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%livecrootc_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_patch(bounds%begp:bounds%endp), & + ns%livecrootn_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%livecrootc_patch(bounds%begp:bounds%endp), & + c14=c14cs%livecrootc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livecrootn_storage_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & + c14=c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! livecroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & + c14=c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%deadcrootc_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_patch(bounds%begp:bounds%endp), & + ns%deadcrootn_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%deadcrootc_patch(bounds%begp:bounds%endp), & + c14=c14cs%deadcrootc_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & + c14=c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! deadcroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__, c13=c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), & + pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & + c13=c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & + c14=c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & pc(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%gresp_storage_patch(bounds%begp:bounds%endp), c14=c14cs%gresp_storage_patch(bounds%begp:bounds%endp), & + c13=c13cs%gresp_storage_patch(bounds%begp:bounds%endp),& + c14=c14cs%gresp_storage_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! gresp_xfer(c only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_xfer_patch(bounds%begp:bounds%endp), & pc(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%gresp_xfer_patch(bounds%begp:bounds%endp), c14=c14cs%gresp_xfer_patch(bounds%begp:bounds%endp), & + c13=c13cs%gresp_xfer_patch(bounds%begp:bounds%endp), & + c14=c14cs%gresp_xfer_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) ! cpool (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%cpool_patch(bounds%begp:bounds%endp), & pc(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%cpool_patch(bounds%begp:bounds%endp), c14=c14cs%cpool_patch(bounds%begp:bounds%endp), & + c13=c13cs%cpool_patch(bounds%begp:bounds%endp), & + c14=c14cs%cpool_patch(bounds%begp:bounds%endp), & pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) if ( use_crop )then @@ -364,18 +409,20 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! xsmr is a pool to balance the budget and as such can be freely negative call TruncateCStates( bounds, filter_soilp, num_soilp, cs%xsmrpool_patch(bounds%begp:bounds%endp), & pc(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%xsmrpool_patch(bounds%begp:bounds%endp), c14=c14cs%xsmrpool_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true., croponly=.true. ) + c13=c13cs%xsmrpool_patch(bounds%begp:bounds%endp), & + c14=c14cs%xsmrpool_patch(bounds%begp:bounds%endp), & + pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), & + allowneg=.true., croponly=.true. ) end if ! retransn (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__ ) + call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), & + pn(bounds%begp:bounds%endp), __LINE__ ) ! npool (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), & - __LINE__ ) + call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), & + pn(bounds%begp:bounds%endp), __LINE__ ) ! patch loop do fp = 1,num_soilp @@ -552,7 +599,7 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l else if ( abs(carbon_patch(p)) < ccrit) then pc(p) = pc(p) + carbon_patch(p) carbon_patch(p) = 0._r8 - + if ( use_c13 .and. present(c13) .and. present(pc13) ) then pc13(p) = pc13(p) + c13(p) c13(p) = 0._r8 From 46422d885ac5c1b0bd6044f9916b50031fc85d6d Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 5 Feb 2020 15:16:45 -0700 Subject: [PATCH 0566/1973] reverting changes made in PR for issue #811 to master --mostly removing the bounds.... --- src/biogeochem/CNPrecisionControlMod.F90 | 275 ++++++++++------------- 1 file changed, 118 insertions(+), 157 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 88609d9757..1f5e10b127 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -204,225 +204,178 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! leaf C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & ns%leafn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%leafc_patch(bounds%begp:bounds%endp), & - c14=c14cs%leafc_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! leaf storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & - ns%leafn_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%leafc_storage_patch(bounds%begp:bounds%endp), & - c14=c14cs%leafc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! leaf transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & - ns%leafn_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), & - c14=c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! froot C and N ! EBK KO DML: For some reason frootc/frootn can go negative and allowing ! it to be negative is important for C4 crops (otherwise they die) Jun/3/2016 if ( prec_control_for_froot ) then call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & - ns%frootn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%frootc_patch(bounds%begp:bounds%endp), & - c14=c14cs%frootc_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true. ) + ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) end if ! froot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & - ns%frootn_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%frootc_storage_patch(bounds%begp:bounds%endp), & - c14=c14cs%frootc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! froot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & - ns%frootn_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), & - c14=c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) if ( use_crop )then ! grain C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & - ns%grainn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%grainc_patch(bounds%begp:bounds%endp), & - c14=c14cs%grainc_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) + ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) ! grain storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & - ns%grainn_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%grainc_storage_patch(bounds%begp:bounds%endp), & - c14=c14cs%grainc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) + ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & - ns%grainn_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), & - c14=c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), croponly=.true. ) + ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - c14=c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), allowneg=.true., croponly=.true. ) + ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & + pn(bounds%begp:), __LINE__, & + c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) end if ! livestem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & - ns%livestemn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%livestemc_patch(bounds%begp:bounds%endp), & - c14=c14cs%livestemc_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livestem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - ns%livestemn_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - c14=c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livestem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - ns%livestemn_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - c14=c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadstem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & - ns%deadstemn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%deadstemc_patch(bounds%begp:bounds%endp), & - c14=c14cs%deadstemc_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadstem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - ns%deadstemn_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - c14=c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%deadstemc_storage_patch, c14=c14cs%deadstemc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadstem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - c14=c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livecroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & - ns%livecrootn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%livecrootc_patch(bounds%begp:bounds%endp), & - c14=c14cs%livecrootc_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livecroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - ns%livecrootn_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - c14=c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livecroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - c14=c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadcroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%deadcrootc_patch(bounds%begp:bounds%endp), & - c14=c14cs%deadcrootc_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & + c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadcroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - c14=c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadcroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), pn(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - c14=c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%gresp_storage_patch(bounds%begp:bounds%endp),& - c14=c14cs%gresp_storage_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + pc(bounds%begp:), __LINE__, & + c13=c13cs%gresp_storage_patch, c14=c14cs%gresp_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! gresp_xfer(c only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - c14=c14cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + pc(bounds%begp:), __LINE__, & + c13=c13cs%gresp_xfer_patch, c14=c14cs%gresp_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! cpool (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%cpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%cpool_patch(bounds%begp:bounds%endp), & - c14=c14cs%cpool_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp) ) + pc(bounds%begp:), __LINE__, & + c13=c13cs%cpool_patch, c14=c14cs%cpool_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) if ( use_crop )then ! xsmrpool (C only) ! xsmr is a pool to balance the budget and as such can be freely negative call TruncateCStates( bounds, filter_soilp, num_soilp, cs%xsmrpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:bounds%endp), __LINE__, & - c13=c13cs%xsmrpool_patch(bounds%begp:bounds%endp), & - c14=c14cs%xsmrpool_patch(bounds%begp:bounds%endp), & - pc13=pc13(bounds%begp:bounds%endp), pc14=pc14(bounds%begp:bounds%endp), & - allowneg=.true., croponly=.true. ) + pc(bounds%begp:), __LINE__, & + c13=c13cs%xsmrpool_patch, c14=c14cs%xsmrpool_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) end if ! retransn (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), & - pn(bounds%begp:bounds%endp), __LINE__ ) + call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), pn(bounds%begp:), & + __LINE__ ) ! npool (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), & - pn(bounds%begp:bounds%endp), __LINE__ ) + call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), pn(bounds%begp:), & + __LINE__ ) ! patch loop do fp = 1,num_soilp @@ -460,20 +413,20 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n ! ! !ARGUMENTS: implicit none - type(bounds_type), intent (in) :: bounds ! bounds - integer , intent (in) :: num_soilp ! number of soil patchs in filter - integer , intent (in) :: filter_soilp(:) ! filter for soil patches - real(r8) , intent (inout) :: carbon_patch(bounds%begp:) - real(r8) , intent (inout) :: nitrogen_patch(bounds%begp:) - real(r8) , intent (inout) :: pc(bounds%begp:) - real(r8) , intent (inout) :: pn(bounds%begp:) - integer , intent (in) :: lineno - real(r8) , intent (inout), optional :: c13 (bounds%begp:) - real(r8) , intent (inout), optional :: c14 (bounds%begp:) - real(r8) , intent (inout), optional :: pc13(bounds%begp:) - real(r8) , intent (inout), optional :: pc14(bounds%begp:) - logical , intent (in) , optional :: croponly - logical , intent (in) , optional :: allowneg + type(bounds_type) , intent(in) :: bounds ! bounds + integer , intent(in) :: num_soilp ! number of soil patchs in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + real(r8), intent(inout) :: carbon_patch(bounds%begp:) + real(r8), intent(inout) :: nitrogen_patch(bounds%begp:) + real(r8), intent(inout) :: pc(bounds%begp:) + real(r8), intent(inout) :: pn(bounds%begp:) + integer, intent(in) :: lineno + real(r8), intent(inout), optional, pointer :: c13(:) + real(r8), intent(inout), optional, pointer :: c14(:) + real(r8), intent(inout), optional :: pc13(bounds%begp:) + real(r8), intent(inout), optional :: pc14(bounds%begp:) + logical , intent(in) , optional :: croponly + logical , intent(in) , optional :: allowneg logical :: lcroponly, lallowneg integer :: fp, p @@ -482,12 +435,16 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n SHR_ASSERT_ALL_FL((ubound(nitrogen_patch) == (/bounds%endp/)), 'ubnd(nitro)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//sourcefile, lineno) +#ifndef _OPENMP if ( present(c13) .and. use_c13 )then + SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) end if if ( present(c14) .and. use_c14 )then + SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) end if +#endif if ( present(pc13) )then SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) end if @@ -547,30 +504,34 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l ! ! !ARGUMENTS: implicit none - type(bounds_type), intent (in) :: bounds ! bounds - integer , intent (in) :: num_soilp ! number of soil patchs in filter - integer , intent (in) :: filter_soilp(:) ! filter for soil patches - real(r8) , intent (inout) :: carbon_patch(bounds%begp:) - real(r8) , intent (inout) :: pc(bounds%begp:) - integer , intent (in) :: lineno - real(r8) , intent (inout), optional :: c13 (bounds%begp:) - real(r8) , intent (inout), optional :: c14 (bounds%begp:) - real(r8) , intent (inout), optional :: pc13(bounds%begp:) - real(r8) , intent (inout), optional :: pc14(bounds%begp:) - logical , intent (in) , optional :: croponly - logical , intent (in) , optional :: allowneg + type(bounds_type), intent(in) :: bounds ! bounds + integer , intent(in) :: num_soilp ! number of soil patchs in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + real(r8) , intent(inout) :: carbon_patch(bounds%begp:) + real(r8) , intent(inout) :: pc(bounds%begp:) + integer , intent(in) :: lineno + real(r8) , intent(inout), optional, pointer :: c13(:) + real(r8) , intent(inout), optional, pointer :: c14(:) + real(r8) , intent(inout), optional :: pc13(bounds%begp:) + real(r8) , intent(inout), optional :: pc14(bounds%begp:) + logical , intent(in) , optional :: croponly + logical , intent(in) , optional :: allowneg logical :: lcroponly, lallowneg integer :: fp, p SHR_ASSERT_ALL_FL((ubound(carbon_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), sourcefile, __LINE__) +#ifndef _OPENMP if ( present(c13) .and. use_c13 )then + SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), sourcefile, __LINE__) end if if ( present(c14) .and. use_c14 )then + SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), sourcefile, __LINE__) end if +#endif if ( present(pc13) )then SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), sourcefile, __LINE__) end if @@ -599,7 +560,7 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l else if ( abs(carbon_patch(p)) < ccrit) then pc(p) = pc(p) + carbon_patch(p) carbon_patch(p) = 0._r8 - + if ( use_c13 .and. present(c13) .and. present(pc13) ) then pc13(p) = pc13(p) + c13(p) c13(p) = 0._r8 From bfaefc4f5da465e5b23d014166cd8d7517161021 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 5 Feb 2020 16:00:38 -0700 Subject: [PATCH 0567/1973] solution to #811--using filter for c13 and c14 truncate...clm_short:pass --- src/biogeochem/CNPrecisionControlMod.F90 | 447 +++++++++++++++++++---- 1 file changed, 368 insertions(+), 79 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 1f5e10b127..a9d701651c 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -120,6 +120,8 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! !LOCAL VARIABLES: integer :: p,j,k ! indices integer :: fp ! filter indices + integer :: num_truncatep ! number of points in filter_truncatep + integer :: filter_truncatep(bounds%endp-bounds%begp+1) ! filter for points that need truncation real(r8):: pc(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections Carbon real(r8):: pn(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections nitrogen real(r8):: pc13(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections @@ -205,20 +207,54 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & ns%leafn_patch(bounds%begp:bounds%endp), & pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + ! c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & + ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if + ! leaf storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + !c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! leaf transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + !c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! froot C and N ! EBK KO DML: For some reason frootc/frootn can go negative and allowing @@ -226,120 +262,331 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & if ( prec_control_for_froot ) then call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) + num_truncatep, filter_truncatep) + !c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if end if ! froot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + !c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! froot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + !c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if if ( use_crop )then ! grain C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + num_truncatep, filter_truncatep) + !c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + __LINE__, num_truncatep, filter_truncatep) + + !c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + num_truncatep, filter_truncatep) + !c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & - pn(bounds%begp:), __LINE__, & - c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) +! call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & +! ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & +! pn(bounds%begp:), __LINE__, & +! num_truncatep, filter_truncatep) + !c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if end if ! livestem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + !c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livestem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - + __LINE__, num_truncatep, filter_truncatep) + !c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & + ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livestem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + !c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & + ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + !c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_storage_patch, c14=c14cs%deadstemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) +! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) +! c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & +! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + !c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + !c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & + ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) +! c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & +! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + !c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + + !c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & + ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + !c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & + ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & @@ -397,8 +644,11 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & end subroutine CNPrecisionControl - subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & - pc13, pc14, croponly, allowneg ) + subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, & + num_truncatep, filter_truncatep, croponly, allowneg ) + + !subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & + ! pc13, pc14, croponly, allowneg ) ! ! !DESCRIPTION: ! Truncate paired Carbon and Nitrogen states. If a paired carbon and nitrogen state iare too small truncate @@ -421,10 +671,8 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n real(r8), intent(inout) :: pc(bounds%begp:) real(r8), intent(inout) :: pn(bounds%begp:) integer, intent(in) :: lineno - real(r8), intent(inout), optional, pointer :: c13(:) - real(r8), intent(inout), optional, pointer :: c14(:) - real(r8), intent(inout), optional :: pc13(bounds%begp:) - real(r8), intent(inout), optional :: pc14(bounds%begp:) + integer, intent(out) :: num_truncatep ! number of points in filter_truncatep + integer, intent(out) :: filter_truncatep(:) ! filter for points that need truncation logical , intent(in) , optional :: croponly logical , intent(in) , optional :: allowneg @@ -435,22 +683,22 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n SHR_ASSERT_ALL_FL((ubound(nitrogen_patch) == (/bounds%endp/)), 'ubnd(nitro)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//sourcefile, lineno) -#ifndef _OPENMP - if ( present(c13) .and. use_c13 )then - SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) - SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) - end if - if ( present(c14) .and. use_c14 )then - SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) - SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) - end if -#endif - if ( present(pc13) )then - SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) - end if - if ( present(pc14) )then - SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), 'ubnd(pc14)'//sourcefile, lineno) - end if +!#ifndef _OPENMP +! if ( present(c13) .and. use_c13 )then +! SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) +! SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) +! end if +! if ( present(c14) .and. use_c14 )then +! SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) +! SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) +! end if +!#endif +! if ( present(pc13) )then +! SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) +! end if +! if ( present(pc14) )then +! SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), 'ubnd(pc14)'//sourcefile, lineno) +! end if ! patch loop lcroponly = .false. if ( present(croponly) )then @@ -460,6 +708,8 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n if ( present(allowneg) )then if ( allowneg ) lallowneg = .true. end if + + num_truncatep = 0 do fp = 1,num_soilp p = filter_soilp(fp) @@ -469,20 +719,23 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n write(iulog,*) 'ERROR: limits = ', cnegcrit, nnegcrit call endrun(msg='ERROR: carbon or nitrogen state critically negative '//errMsg(sourcefile, lineno)) else if ( abs(carbon_patch(p)) < ccrit .or. (use_nguardrail .and. abs(nitrogen_patch(p)) < ncrit) ) then + num_truncatep = num_truncatep + 1 + filter_truncatep(num_truncatep) = p + pc(p) = pc(p) + carbon_patch(p) carbon_patch(p) = 0._r8 - + pn(p) = pn(p) + nitrogen_patch(p) nitrogen_patch(p) = 0._r8 - if ( use_c13 .and. present(c13) .and. present(pc13) ) then - pc13(p) = pc13(p) + c13(p) - c13(p) = 0._r8 - endif - if ( use_c14 .and. present(c14) .and. present(pc14)) then - pc14(p) = pc14(p) + c14(p) - c14(p) = 0._r8 - endif + !if ( use_c13 .and. present(c13) .and. present(pc13) ) then + ! pc13(p) = pc13(p) + c13(p) + ! c13(p) = 0._r8 + !endif + !if ( use_c14 .and. present(c14) .and. present(pc14)) then + ! pc14(p) = pc14(p) + c14(p) + ! c14(p) = 0._r8 + !endif end if end if end do @@ -612,4 +865,40 @@ subroutine TruncateNStates( bounds, filter_soilp, num_soilp, nitrogen_patch, pn, end do end subroutine TruncateNStates + !----------------------------------------------------------------------- + subroutine TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + state_patch, truncation_patch, lineno) + ! + ! !DESCRIPTION: + ! Given a filter of points for which we have already determined that truncation should + ! occur, do the truncation for the given patch-level state, putting the truncation + ! amount in truncation_patch. + ! + use decompMod , only : bounds_type + ! !ARGUMENTS: + implicit none + type(bounds_type) , intent(in) :: bounds ! bounds + integer, intent(in) :: num_truncatep ! number of points in filter_truncatep + integer, intent(in) :: filter_truncatep(:) ! filter for points that need truncation + real(r8), intent(inout) :: state_patch(bounds%begp: ) + real(r8), intent(inout) :: truncation_patch(bounds%begp: ) + integer, intent(in) :: lineno + ! + ! !LOCAL VARIABLES: + + integer :: fp, p + character(len=*), parameter :: subname = 'TruncateAdditional' + !----------------------------------------------------------------------- + + SHR_ASSERT_FL((ubound(state_patch, 1) == bounds%endp), 'state_patch '//sourcefile, lineno) + SHR_ASSERT_FL((ubound(truncation_patch, 1) == bounds%endp), 'truncation_patch '//sourcefile, lineno) + + do fp = 1, num_truncatep + p = filter_truncatep(fp) + truncation_patch(p) = truncation_patch(p) + state_patch(p) + state_patch(p) = 0._r8 + end do + + end subroutine TruncateAdditional + end module CNPrecisionControlMod From 7d68e476991413d45e437b491d7fa67f85f1dbf1 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 5 Feb 2020 22:12:08 -0700 Subject: [PATCH 0568/1973] uncommenting TruncateCandNStates -- clm_short:fail --- src/biogeochem/CNPrecisionControlMod.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index a9d701651c..f2e9f15acc 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -365,10 +365,10 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & end if ! grain transfer C and N -! call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & -! ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & -! pn(bounds%begp:), __LINE__, & -! num_truncatep, filter_truncatep) + call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & + ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & + pn(bounds%begp:), __LINE__, & + num_truncatep, filter_truncatep) !c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) if (use_c13) then From 0898414d22a3b9f422d854035aab319d1f00977a Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 5 Feb 2020 23:51:38 -0700 Subject: [PATCH 0569/1973] reverting all the changes we made for #811 --- src/biogeochem/CNPrecisionControlMod.F90 | 441 ++++------------------- 1 file changed, 76 insertions(+), 365 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index f2e9f15acc..1f5e10b127 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -120,8 +120,6 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! !LOCAL VARIABLES: integer :: p,j,k ! indices integer :: fp ! filter indices - integer :: num_truncatep ! number of points in filter_truncatep - integer :: filter_truncatep(bounds%endp-bounds%begp+1) ! filter for points that need truncation real(r8):: pc(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections Carbon real(r8):: pn(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections nitrogen real(r8):: pc13(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections @@ -207,54 +205,20 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & ns%leafn_patch(bounds%begp:bounds%endp), & pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - ! c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & - ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%leafc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%leafc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if - + c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! leaf storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%leafc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%leafc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! leaf transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! froot C and N ! EBK KO DML: For some reason frootc/frootn can go negative and allowing @@ -262,331 +226,120 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & if ( prec_control_for_froot ) then call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%frootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%frootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) end if ! froot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - !c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%frootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%frootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! froot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) if ( use_crop )then ! grain C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%grainc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%grainc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) ! grain storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - - !c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%grainc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%grainc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) end if ! livestem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livestemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livestemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livestem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - !c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & - ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + ! livestem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - !c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & - ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadstem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadstemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadstemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadstem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) -! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%deadstemc_storage_patch, c14=c14cs%deadstemc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadstem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) -! c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & -! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livecroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livecrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livecrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livecroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - !c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & - ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! livecroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) -! c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & -! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadcroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - !c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadcrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadcrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadcroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - - !c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & - ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! deadcroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - !c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & - ! pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + __LINE__, c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & + pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & @@ -644,11 +397,8 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & end subroutine CNPrecisionControl - subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, & - num_truncatep, filter_truncatep, croponly, allowneg ) - - !subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & - ! pc13, pc14, croponly, allowneg ) + subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & + pc13, pc14, croponly, allowneg ) ! ! !DESCRIPTION: ! Truncate paired Carbon and Nitrogen states. If a paired carbon and nitrogen state iare too small truncate @@ -671,8 +421,10 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n real(r8), intent(inout) :: pc(bounds%begp:) real(r8), intent(inout) :: pn(bounds%begp:) integer, intent(in) :: lineno - integer, intent(out) :: num_truncatep ! number of points in filter_truncatep - integer, intent(out) :: filter_truncatep(:) ! filter for points that need truncation + real(r8), intent(inout), optional, pointer :: c13(:) + real(r8), intent(inout), optional, pointer :: c14(:) + real(r8), intent(inout), optional :: pc13(bounds%begp:) + real(r8), intent(inout), optional :: pc14(bounds%begp:) logical , intent(in) , optional :: croponly logical , intent(in) , optional :: allowneg @@ -683,22 +435,22 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n SHR_ASSERT_ALL_FL((ubound(nitrogen_patch) == (/bounds%endp/)), 'ubnd(nitro)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//sourcefile, lineno) -!#ifndef _OPENMP -! if ( present(c13) .and. use_c13 )then -! SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) -! SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) -! end if -! if ( present(c14) .and. use_c14 )then -! SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) -! SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) -! end if -!#endif -! if ( present(pc13) )then -! SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) -! end if -! if ( present(pc14) )then -! SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), 'ubnd(pc14)'//sourcefile, lineno) -! end if +#ifndef _OPENMP + if ( present(c13) .and. use_c13 )then + SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) + SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) + end if + if ( present(c14) .and. use_c14 )then + SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) + SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) + end if +#endif + if ( present(pc13) )then + SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) + end if + if ( present(pc14) )then + SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), 'ubnd(pc14)'//sourcefile, lineno) + end if ! patch loop lcroponly = .false. if ( present(croponly) )then @@ -708,8 +460,6 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n if ( present(allowneg) )then if ( allowneg ) lallowneg = .true. end if - - num_truncatep = 0 do fp = 1,num_soilp p = filter_soilp(fp) @@ -719,23 +469,20 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n write(iulog,*) 'ERROR: limits = ', cnegcrit, nnegcrit call endrun(msg='ERROR: carbon or nitrogen state critically negative '//errMsg(sourcefile, lineno)) else if ( abs(carbon_patch(p)) < ccrit .or. (use_nguardrail .and. abs(nitrogen_patch(p)) < ncrit) ) then - num_truncatep = num_truncatep + 1 - filter_truncatep(num_truncatep) = p - pc(p) = pc(p) + carbon_patch(p) carbon_patch(p) = 0._r8 - + pn(p) = pn(p) + nitrogen_patch(p) nitrogen_patch(p) = 0._r8 - !if ( use_c13 .and. present(c13) .and. present(pc13) ) then - ! pc13(p) = pc13(p) + c13(p) - ! c13(p) = 0._r8 - !endif - !if ( use_c14 .and. present(c14) .and. present(pc14)) then - ! pc14(p) = pc14(p) + c14(p) - ! c14(p) = 0._r8 - !endif + if ( use_c13 .and. present(c13) .and. present(pc13) ) then + pc13(p) = pc13(p) + c13(p) + c13(p) = 0._r8 + endif + if ( use_c14 .and. present(c14) .and. present(pc14)) then + pc14(p) = pc14(p) + c14(p) + c14(p) = 0._r8 + endif end if end if end do @@ -865,40 +612,4 @@ subroutine TruncateNStates( bounds, filter_soilp, num_soilp, nitrogen_patch, pn, end do end subroutine TruncateNStates - !----------------------------------------------------------------------- - subroutine TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - state_patch, truncation_patch, lineno) - ! - ! !DESCRIPTION: - ! Given a filter of points for which we have already determined that truncation should - ! occur, do the truncation for the given patch-level state, putting the truncation - ! amount in truncation_patch. - ! - use decompMod , only : bounds_type - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer, intent(in) :: num_truncatep ! number of points in filter_truncatep - integer, intent(in) :: filter_truncatep(:) ! filter for points that need truncation - real(r8), intent(inout) :: state_patch(bounds%begp: ) - real(r8), intent(inout) :: truncation_patch(bounds%begp: ) - integer, intent(in) :: lineno - ! - ! !LOCAL VARIABLES: - - integer :: fp, p - character(len=*), parameter :: subname = 'TruncateAdditional' - !----------------------------------------------------------------------- - - SHR_ASSERT_FL((ubound(state_patch, 1) == bounds%endp), 'state_patch '//sourcefile, lineno) - SHR_ASSERT_FL((ubound(truncation_patch, 1) == bounds%endp), 'truncation_patch '//sourcefile, lineno) - - do fp = 1, num_truncatep - p = filter_truncatep(fp) - truncation_patch(p) = truncation_patch(p) + state_patch(p) - state_patch(p) = 0._r8 - end do - - end subroutine TruncateAdditional - end module CNPrecisionControlMod From a1a5ab96af76dbea9636e7ad5c431739d5fcd68c Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 6 Feb 2020 12:15:42 -0700 Subject: [PATCH 0570/1973] Update ChangeLog --- doc/ChangeLog | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 139 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 431d21a68d..c6052c8b63 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,142 @@ =============================================================== +Tag name: ctsm1.0.dev083 +Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) +Date: Thu Feb 6 12:12:26 MST 2020 +One-line Summary: Some BFB Fixes: Resolve issues #683, # 874, #878, # 885, # 745, #838 + +Purpose of changes +------------------ + +Resolved issues: + +ESCOMP/ctsm#683 : Writing out FATES parameters only on masterproc. +ESCOMP/ctsm#874 : Changing the number of timesteps to run for + SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStar + to prevent failing with CMEPS. +ESCOMP/ctsm#878 : Removing the unused atm2lnd field. +ESCOMP/ctsm#885 : Changing the defaults for br_root in namelist_defaults to + enable FUN with CLM4.5. +ESCOMP/ctsm#745 : Removing ReadNL private subroutine from initVerticalMod.F90. +ESCOMP/ctsm#838 : Clarifying ZISNO in the variable long name. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +Resolves : + - ESCOMP/ctsm#683 + - ESCOMP/ctsm#874 + - ESCOMP/ctsm#878 + - ESCOMP/ctsm#885 + - ESCOMP/ctsm#745 + - ESCOMP/ctsm#838 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + +Changes made to namelist defaults (e.g., changed parameter values): + Not any changes in parameter values. + changing the default for br_root in namelist_defaults to enable FUN with + CLM4.5. + +Changes to the datasets (e.g., parameter, surface or initial files): + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: + Changed the number of timesteps from Ln3 to Ln6 for + SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStar + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: + - what platforms/compilers: + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: + + URL for LMWG diagnostics output used to validate new climate: + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev082 Originator(s): oleson (Keith Oleson) Date: Sat Feb 1 09:28:41 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 4d7344a666..eae920b738 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev083 negins 02/06/2020 Some BFB Fixes: Resolve issues #683, # 874, #878, # 885, # 745, #838 ctsm1.0.dev082 oleson 02/01/2020 Rename variables to avoid confusion; fix QSNOEVAP diagnostic ctsm1.0.dev081 slevis 01/13/2020 Speed up restart writes ctsm1.0.dev080 sacks 12/02/2019 Update externals, minor fixes to work with latest cime, get nuopc cap working From 4fb83efee27489c96eca0f615085bb1200f1d909 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 6 Feb 2020 14:14:59 -0700 Subject: [PATCH 0571/1973] TruncateCandNStates adding TruncateAdditional for c13 and c14--for when they are not allocated... --- src/biogeochem/CNPrecisionControlMod.F90 | 396 ++++++++++++++++++----- 1 file changed, 321 insertions(+), 75 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 1f5e10b127..50e84b3b2a 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -120,6 +120,8 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! !LOCAL VARIABLES: integer :: p,j,k ! indices integer :: fp ! filter indices + integer :: num_truncatep ! number of points in filter_truncatep + integer :: filter_truncatep(bounds%endp-bounds%begp+1) ! filter for points that need truncation real(r8):: pc(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections Carbon real(r8):: pn(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections nitrogen real(r8):: pc13(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections @@ -205,20 +207,48 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & ns%leafn_patch(bounds%begp:bounds%endp), & pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if + ! leaf storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! leaf transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! froot C and N ! EBK KO DML: For some reason frootc/frootn can go negative and allowing @@ -226,120 +256,294 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & if ( prec_control_for_froot ) then call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) + num_truncatep, filter_truncatep, allowneg=.true.) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if end if ! froot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! froot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if if ( use_crop )then ! grain C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + num_truncatep, filter_truncatep, croponly=.true. ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + __LINE__, num_truncatep, filter_truncatep, croponly=.true. ) + + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) + num_truncatep, filter_truncatep, croponly=.true.) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & pn(bounds%begp:), __LINE__, & - c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) + num_truncatep, filter_truncatep, & + allowneg=.true., croponly=.true. ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if end if ! livestem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livestem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livestem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_storage_patch, c14=c14cs%deadstemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & @@ -397,8 +601,11 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & end subroutine CNPrecisionControl - subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & - pc13, pc14, croponly, allowneg ) + subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, & + num_truncatep, filter_truncatep, croponly, allowneg ) + + !subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & + ! pc13, pc14, croponly, allowneg ) ! ! !DESCRIPTION: ! Truncate paired Carbon and Nitrogen states. If a paired carbon and nitrogen state iare too small truncate @@ -421,10 +628,8 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n real(r8), intent(inout) :: pc(bounds%begp:) real(r8), intent(inout) :: pn(bounds%begp:) integer, intent(in) :: lineno - real(r8), intent(inout), optional, pointer :: c13(:) - real(r8), intent(inout), optional, pointer :: c14(:) - real(r8), intent(inout), optional :: pc13(bounds%begp:) - real(r8), intent(inout), optional :: pc14(bounds%begp:) + integer, intent(out) :: num_truncatep ! number of points in filter_truncatep + integer, intent(out) :: filter_truncatep(:) ! filter for points that need truncation logical , intent(in) , optional :: croponly logical , intent(in) , optional :: allowneg @@ -435,22 +640,22 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n SHR_ASSERT_ALL_FL((ubound(nitrogen_patch) == (/bounds%endp/)), 'ubnd(nitro)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//sourcefile, lineno) -#ifndef _OPENMP - if ( present(c13) .and. use_c13 )then - SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) - SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) - end if - if ( present(c14) .and. use_c14 )then - SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) - SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) - end if -#endif - if ( present(pc13) )then - SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) - end if - if ( present(pc14) )then - SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), 'ubnd(pc14)'//sourcefile, lineno) - end if +!#ifndef _OPENMP +! if ( present(c13) .and. use_c13 )then +! SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) +! SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) +! end if +! if ( present(c14) .and. use_c14 )then +! SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) +! SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) +! end if +!#endif +! if ( present(pc13) )then +! SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) +! end if +! if ( present(pc14) )then +! SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), 'ubnd(pc14)'//sourcefile, lineno) +! end if ! patch loop lcroponly = .false. if ( present(croponly) )then @@ -460,6 +665,8 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n if ( present(allowneg) )then if ( allowneg ) lallowneg = .true. end if + + num_truncatep = 0 do fp = 1,num_soilp p = filter_soilp(fp) @@ -469,20 +676,23 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n write(iulog,*) 'ERROR: limits = ', cnegcrit, nnegcrit call endrun(msg='ERROR: carbon or nitrogen state critically negative '//errMsg(sourcefile, lineno)) else if ( abs(carbon_patch(p)) < ccrit .or. (use_nguardrail .and. abs(nitrogen_patch(p)) < ncrit) ) then + num_truncatep = num_truncatep + 1 + filter_truncatep(num_truncatep) = p + pc(p) = pc(p) + carbon_patch(p) carbon_patch(p) = 0._r8 - + pn(p) = pn(p) + nitrogen_patch(p) nitrogen_patch(p) = 0._r8 - if ( use_c13 .and. present(c13) .and. present(pc13) ) then - pc13(p) = pc13(p) + c13(p) - c13(p) = 0._r8 - endif - if ( use_c14 .and. present(c14) .and. present(pc14)) then - pc14(p) = pc14(p) + c14(p) - c14(p) = 0._r8 - endif + !if ( use_c13 .and. present(c13) .and. present(pc13) ) then + ! pc13(p) = pc13(p) + c13(p) + ! c13(p) = 0._r8 + !endif + !if ( use_c14 .and. present(c14) .and. present(pc14)) then + ! pc14(p) = pc14(p) + c14(p) + ! c14(p) = 0._r8 + !endif end if end if end do @@ -612,4 +822,40 @@ subroutine TruncateNStates( bounds, filter_soilp, num_soilp, nitrogen_patch, pn, end do end subroutine TruncateNStates + !----------------------------------------------------------------------- + subroutine TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + state_patch, truncation_patch, lineno) + ! + ! !DESCRIPTION: + ! Given a filter of points for which we have already determined that truncation should + ! occur, do the truncation for the given patch-level state, putting the truncation + ! amount in truncation_patch. + ! + use decompMod , only : bounds_type + ! !ARGUMENTS: + implicit none + type(bounds_type) , intent(in) :: bounds ! bounds + integer, intent(in) :: num_truncatep ! number of points in filter_truncatep + integer, intent(in) :: filter_truncatep(:) ! filter for points that need truncation + real(r8), intent(inout) :: state_patch(bounds%begp: ) + real(r8), intent(inout) :: truncation_patch(bounds%begp: ) + integer, intent(in) :: lineno + ! + ! !LOCAL VARIABLES: + + integer :: fp, p + character(len=*), parameter :: subname = 'TruncateAdditional' + !----------------------------------------------------------------------- + + SHR_ASSERT_FL((ubound(state_patch, 1) == bounds%endp), 'state_patch '//sourcefile, lineno) + SHR_ASSERT_FL((ubound(truncation_patch, 1) == bounds%endp), 'truncation_patch '//sourcefile, lineno) + + do fp = 1, num_truncatep + p = filter_truncatep(fp) + truncation_patch(p) = truncation_patch(p) + state_patch(p) + state_patch(p) = 0._r8 + end do + + end subroutine TruncateAdditional + end module CNPrecisionControlMod From 3bf53cee321a71c77659553619127fe13e79f831 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 6 Feb 2020 15:25:51 -0700 Subject: [PATCH 0572/1973] TruncateCStates adding TruncateAdditional for c13 and c14--for when they are not allocated... --- src/biogeochem/CNPrecisionControlMod.F90 | 129 +++++++++++++++-------- 1 file changed, 85 insertions(+), 44 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 50e84b3b2a..fbd16b7c5c 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -547,29 +547,71 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%gresp_storage_patch, c14=c14cs%gresp_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%gresp_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%gresp_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! gresp_xfer(c only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%gresp_xfer_patch, c14=c14cs%gresp_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) + !pc(bounds%begp:), __LINE__, & + !c13=c13cs%gresp_xfer_patch, c14=c14cs%gresp_xfer_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%gresp_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%gresp_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! cpool (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%cpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%cpool_patch, c14=c14cs%cpool_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) + !pc(bounds%begp:), __LINE__, & + !c13=c13cs%cpool_patch, c14=c14cs%cpool_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%cpool_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%cpool_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if if ( use_crop )then ! xsmrpool (C only) ! xsmr is a pool to balance the budget and as such can be freely negative call TruncateCStates( bounds, filter_soilp, num_soilp, cs%xsmrpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%xsmrpool_patch, c14=c14cs%xsmrpool_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) + pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep, & + allowneg=.true., croponly=.true. ) + !pc(bounds%begp:), __LINE__, & + !c13=c13cs%xsmrpool_patch, c14=c14cs%xsmrpool_patch, & + !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) + if (use_c13) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c13cs%xsmrpool_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & + c14cs%xsmrpool_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if end if @@ -698,7 +740,8 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n end do end subroutine TruncateCandNStates - subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, lineno, c13, c14, pc13, pc14, croponly, allowneg ) + subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, lineno, & + num_truncatep, filter_truncatep, croponly, allowneg ) ! ! !DESCRIPTION: ! Truncate Carbon states. If a carbon state is too small truncate it to @@ -720,10 +763,8 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l real(r8) , intent(inout) :: carbon_patch(bounds%begp:) real(r8) , intent(inout) :: pc(bounds%begp:) integer , intent(in) :: lineno - real(r8) , intent(inout), optional, pointer :: c13(:) - real(r8) , intent(inout), optional, pointer :: c14(:) - real(r8) , intent(inout), optional :: pc13(bounds%begp:) - real(r8) , intent(inout), optional :: pc14(bounds%begp:) + integer , intent(out) :: num_truncatep ! number of points in filter_truncatep + integer , intent(out) :: filter_truncatep(:) ! filter for points that need truncation logical , intent(in) , optional :: croponly logical , intent(in) , optional :: allowneg @@ -732,25 +773,25 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l SHR_ASSERT_ALL_FL((ubound(carbon_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), sourcefile, __LINE__) -#ifndef _OPENMP - if ( present(c13) .and. use_c13 )then - SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), sourcefile, __LINE__) - end if - if ( present(c14) .and. use_c14 )then - SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), sourcefile, __LINE__) - end if -#endif - if ( present(pc13) )then - SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), sourcefile, __LINE__) - end if - if ( present(pc14) )then - SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), sourcefile, __LINE__) - end if - if ( -ccrit < cnegcrit )then - call endrun(msg='ERROR: cnegcrit should be less than -ccrit: '//errMsg(sourcefile, lineno)) - end if +!#ifndef _OPENMP +! if ( present(c13) .and. use_c13 )then +! SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), sourcefile, __LINE__) +! SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), sourcefile, __LINE__) +! end if +! if ( present(c14) .and. use_c14 )then +! SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), sourcefile, __LINE__) +! SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), sourcefile, __LINE__) +! end if +!#endif +! if ( present(pc13) )then +! SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), sourcefile, __LINE__) +! end if +! if ( present(pc14) )then +! SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), sourcefile, __LINE__) +! end if +! if ( -ccrit < cnegcrit )then +! call endrun(msg='ERROR: cnegcrit should be less than -ccrit: '//errMsg(sourcefile, lineno)) +! end if lcroponly = .false. if ( present(croponly) )then if ( croponly ) lcroponly = .true. @@ -771,14 +812,14 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l pc(p) = pc(p) + carbon_patch(p) carbon_patch(p) = 0._r8 - if ( use_c13 .and. present(c13) .and. present(pc13) ) then - pc13(p) = pc13(p) + c13(p) - c13(p) = 0._r8 - endif - if ( use_c14 .and. present(c14) .and. present(pc14)) then - pc14(p) = pc14(p) + c14(p) - c14(p) = 0._r8 - endif + !if ( use_c13 .and. present(c13) .and. present(pc13) ) then + ! pc13(p) = pc13(p) + c13(p) + ! c13(p) = 0._r8 + !endif + !if ( use_c14 .and. present(c14) .and. present(pc14)) then + ! pc14(p) = pc14(p) + c14(p) + ! c14(p) = 0._r8 + !endif end if end if end do From ec5f32dca432a0c39a97ab7e54e48916b29e612d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 6 Feb 2020 15:29:38 -0700 Subject: [PATCH 0573/1973] Minor ChangeLog updates --- doc/ChangeLog | 46 ++++++++++++++-------------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index c6052c8b63..df0a0498d9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -11,11 +11,11 @@ Resolved issues: ESCOMP/ctsm#683 : Writing out FATES parameters only on masterproc. ESCOMP/ctsm#874 : Changing the number of timesteps to run for - SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStar - to prevent failing with CMEPS. + SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStar + to prevent failing with CMEPS. ESCOMP/ctsm#878 : Removing the unused atm2lnd field. ESCOMP/ctsm#885 : Changing the defaults for br_root in namelist_defaults to - enable FUN with CLM4.5. + enable FUN with CLM4.5. ESCOMP/ctsm#745 : Removing ReadNL private subroutine from initVerticalMod.F90. ESCOMP/ctsm#838 : Clarifying ZISNO in the variable long name. @@ -52,14 +52,14 @@ Notes of particular relevance for users Caveats for users (e.g., need to interpolate initial conditions): none -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none -Changes made to namelist defaults (e.g., changed parameter values): +Changes made to namelist defaults (e.g., changed parameter values): Not any changes in parameter values. changing the default for br_root in namelist_defaults to enable FUN with CLM4.5. -Changes to the datasets (e.g., parameter, surface or initial files): +Changes to the datasets (e.g., parameter, surface or initial files): none Substantial timing or memory changes: none @@ -67,7 +67,7 @@ Notes of particular relevance for developers: (including Code reviews and testin --------------------------------------------- NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide -Caveats for developers (e.g., code that is duplicated that requires double maintenance): +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none Changes to tests or testing: Changed the number of timesteps from Ln3 to Ln6 for @@ -82,19 +82,19 @@ CTSM testing: build-namelist tests: - cheyenne - + cheyenne - not run tools-tests (test/tools): - cheyenne - + cheyenne - not run PTCLM testing (tools/shared/PTCLM/test): - cheyenne - + cheyenne - not run python testing (see instructions in python/README.md; document testing done): - (any machine) - + (any machine) - not run regular tests (aux_clm): @@ -107,33 +107,15 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: - - URL for LMWG diagnostics output used to validate new climate: - +Changes answers relative to baseline: NO Detailed list of changes ------------------------ -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) +https://github.com/ESCOMP/CTSM/pull/897 =============================================================== =============================================================== From 362af79d6a8243579ac371545229397a99a3b846 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Feb 2020 16:02:17 -0700 Subject: [PATCH 0574/1973] Add mizuRoute as a component --- Externals.cfg | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index b15f54e496..9a62c22138 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -26,11 +26,18 @@ repo_url = https://github.com/ESCOMP/mosart tag = mosart1_0_35 required = True +[mizuRoute] +local_path = components/mizuRoute +protocol = git +repo_url = https://github.com/ekluzek/mizuRoute +branch = ctsm-coupling +required = True + [cime] local_path = cime protocol = git -repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.15_a01 +repo_url = https://github.com/ekluzek/cime +branch = mizuRoute externals = ../Externals_cime.cfg required = True From 1c90c456562344b230d88100af5e038ca0cac912 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 6 Feb 2020 17:01:43 -0700 Subject: [PATCH 0575/1973] just cleanning up.... --- src/biogeochem/CNPrecisionControlMod.F90 | 524 +++++++++++------------ 1 file changed, 258 insertions(+), 266 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index fbd16b7c5c..0fa2416897 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -208,15 +208,16 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ns%leafn_patch(bounds%begp:bounds%endp), & pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep) + if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%leafc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%leafc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) end if @@ -225,14 +226,14 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep) if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%leafc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) end if if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%leafc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) end if ! leaf transfer C and N @@ -240,14 +241,14 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep) if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) end if if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%leafc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) end if ! froot C and N @@ -258,30 +259,30 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep, allowneg=.true.) if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%frootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) end if if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%frootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) end if end if ! froot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & - ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) + ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%frootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) end if if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%frootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) end if ! froot transfer C and N @@ -289,14 +290,14 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep) if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) end if if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%frootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) end if if ( use_crop )then @@ -304,47 +305,47 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep, croponly=.true. ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%grainc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%grainc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & __LINE__, num_truncatep, filter_truncatep, croponly=.true. ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%grainc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%grainc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep, croponly=.true.) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%grainc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! grain transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & @@ -353,14 +354,14 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & num_truncatep, filter_truncatep, & allowneg=.true., croponly=.true. ) if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) end if if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) end if end if @@ -369,229 +370,223 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livestemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livestemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livestem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) + ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livestem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%livestemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadstemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadstemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadstem transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livecrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livecrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! livecroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) + ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadcrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadcrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot storage C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! deadcroot transfer C and N call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & + __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! gresp_storage (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%gresp_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%gresp_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%gresp_storage_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%gresp_storage_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! gresp_xfer(c only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) - !pc(bounds%begp:), __LINE__, & - !c13=c13cs%gresp_xfer_patch, c14=c14cs%gresp_xfer_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%gresp_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%gresp_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%gresp_xfer_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%gresp_xfer_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if ! cpool (C only) call TruncateCStates( bounds, filter_soilp, num_soilp, cs%cpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) - !pc(bounds%begp:), __LINE__, & - !c13=c13cs%cpool_patch, c14=c14cs%cpool_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%cpool_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%cpool_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep) + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%cpool_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%cpool_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if if ( use_crop )then ! xsmrpool (C only) @@ -599,19 +594,16 @@ subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & call TruncateCStates( bounds, filter_soilp, num_soilp, cs%xsmrpool_patch(bounds%begp:bounds%endp), & pc(bounds%begp:), __LINE__, num_truncatep, filter_truncatep, & allowneg=.true., croponly=.true. ) - !pc(bounds%begp:), __LINE__, & - !c13=c13cs%xsmrpool_patch, c14=c14cs%xsmrpool_patch, & - !pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) - if (use_c13) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c13cs%xsmrpool_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & - __LINE__) - end if - if (use_c14) then - call TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - c14cs%xsmrpool_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & - __LINE__) - end if + if (use_c13) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c13cs%xsmrpool_patch(bounds%begp:bounds%endp), pc13(bounds%begp:bounds%endp), & + __LINE__) + end if + if (use_c14) then + call TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + c14cs%xsmrpool_patch(bounds%begp:bounds%endp), pc14(bounds%begp:bounds%endp), & + __LINE__) + end if end if @@ -763,8 +755,8 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l real(r8) , intent(inout) :: carbon_patch(bounds%begp:) real(r8) , intent(inout) :: pc(bounds%begp:) integer , intent(in) :: lineno - integer , intent(out) :: num_truncatep ! number of points in filter_truncatep - integer , intent(out) :: filter_truncatep(:) ! filter for points that need truncation + integer , intent(out) :: num_truncatep ! number of points in filter_truncatep + integer , intent(out) :: filter_truncatep(:) ! filter for points that need truncation logical , intent(in) , optional :: croponly logical , intent(in) , optional :: allowneg From d74be3abd88badca4dc9a21af9a2b19212f3de00 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Feb 2020 22:06:40 -0700 Subject: [PATCH 0576/1973] Add a mizuRoute compset --- cime_config/config_compsets.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index a1954b5dde..88e6ad94e1 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -65,6 +65,11 @@ 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_RTM_SGLC_SWAV + + I2000Clm50SpMizGs + 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MIZUROUTE_SGLC_SWAV + + I2000Clm50BgcCru 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV From ecb5f29fd060fad7431272b612654176b939df5f Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 6 Feb 2020 23:17:07 -0700 Subject: [PATCH 0577/1973] some clean ups... --- src/biogeochem/CNPrecisionControlMod.F90 | 55 +----------------------- 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 0fa2416897..605099a90f 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -674,22 +674,7 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n SHR_ASSERT_ALL_FL((ubound(nitrogen_patch) == (/bounds%endp/)), 'ubnd(nitro)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//sourcefile, lineno) SHR_ASSERT_ALL_FL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//sourcefile, lineno) -!#ifndef _OPENMP -! if ( present(c13) .and. use_c13 )then -! SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//sourcefile, lineno) -! SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//sourcefile, lineno) -! end if -! if ( present(c14) .and. use_c14 )then -! SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//sourcefile, lineno) -! SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//sourcefile, lineno) -! end if -!#endif -! if ( present(pc13) )then -! SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//sourcefile, lineno) -! end if -! if ( present(pc14) )then -! SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), 'ubnd(pc14)'//sourcefile, lineno) -! end if + ! patch loop lcroponly = .false. if ( present(croponly) )then @@ -718,15 +703,6 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n pn(p) = pn(p) + nitrogen_patch(p) nitrogen_patch(p) = 0._r8 - - !if ( use_c13 .and. present(c13) .and. present(pc13) ) then - ! pc13(p) = pc13(p) + c13(p) - ! c13(p) = 0._r8 - !endif - !if ( use_c14 .and. present(c14) .and. present(pc14)) then - ! pc14(p) = pc14(p) + c14(p) - ! c14(p) = 0._r8 - !endif end if end if end do @@ -765,25 +741,7 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l SHR_ASSERT_ALL_FL((ubound(carbon_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), sourcefile, __LINE__) -!#ifndef _OPENMP -! if ( present(c13) .and. use_c13 )then -! SHR_ASSERT_ALL_FL((lbound(c13) == (/bounds%begp/)), sourcefile, __LINE__) -! SHR_ASSERT_ALL_FL((ubound(c13) == (/bounds%endp/)), sourcefile, __LINE__) -! end if -! if ( present(c14) .and. use_c14 )then -! SHR_ASSERT_ALL_FL((lbound(c14) == (/bounds%begp/)), sourcefile, __LINE__) -! SHR_ASSERT_ALL_FL((ubound(c14) == (/bounds%endp/)), sourcefile, __LINE__) -! end if -!#endif -! if ( present(pc13) )then -! SHR_ASSERT_ALL_FL((ubound(pc13) == (/bounds%endp/)), sourcefile, __LINE__) -! end if -! if ( present(pc14) )then -! SHR_ASSERT_ALL_FL((ubound(pc14) == (/bounds%endp/)), sourcefile, __LINE__) -! end if -! if ( -ccrit < cnegcrit )then -! call endrun(msg='ERROR: cnegcrit should be less than -ccrit: '//errMsg(sourcefile, lineno)) -! end if + lcroponly = .false. if ( present(croponly) )then if ( croponly ) lcroponly = .true. @@ -803,15 +761,6 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l else if ( abs(carbon_patch(p)) < ccrit) then pc(p) = pc(p) + carbon_patch(p) carbon_patch(p) = 0._r8 - - !if ( use_c13 .and. present(c13) .and. present(pc13) ) then - ! pc13(p) = pc13(p) + c13(p) - ! c13(p) = 0._r8 - !endif - !if ( use_c14 .and. present(c14) .and. present(pc14)) then - ! pc14(p) = pc14(p) + c14(p) - ! c14(p) = 0._r8 - !endif end if end if end do From 67470cf4251abb051197b55ee79f7d1fcfc82a82 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 7 Feb 2020 13:19:58 -0700 Subject: [PATCH 0578/1973] Write fields sent to atm at end of run This is useful for validating the fields sent from CTSM to the atmosphere, ensuring that that side of the data flow is working right. I'll use it to do a one-time manual validation, then it will also be leveraged in the future to ensure that this side of the data flow doesn't break, by checking these files in our automated testing of lilac with the demo atm driver. --- lilac/atm_driver/atm_driver.F90 | 145 ++++++++++++++++++++++++++------ lilac/atm_driver/atm_driver_in | 1 + 2 files changed, 118 insertions(+), 28 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index eb0bf03814..3b9f318fcb 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -16,9 +16,12 @@ program atm_driver ! ESMF lilac_atmcap ESMF CTSM cap ESMF river cap (Mizzouroute, Mosart) !---------------------------------------------------------------------------- - use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close - use netcdf , only : nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_varid, nf90_get_var + use netcdf , only : nf90_open, nf90_create, nf90_enddef, nf90_close + use netcdf , only : nf90_clobber, nf90_write, nf90_nowrite, nf90_noerr, nf90_double + use netcdf , only : nf90_def_dim, nf90_def_var, nf90_put_var + use netcdf , only : nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_varid, nf90_get_var use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS + use mpi , only : MPI_GATHER, MPI_DOUBLE use lilac_mod , only : lilac_init, lilac_run, lilac_final use lilac_atmcap, only : lilac_atmcap_atm2lnd, lilac_atmcap_lnd2atm use shr_cal_mod , only : shr_cal_date2ymd @@ -32,6 +35,7 @@ program atm_driver real*8 , allocatable :: atm_lons(:), atm_lats(:) integer , allocatable :: atm_global_index(:) integer :: mytask, ntasks + logical :: masterproc integer :: my_start, my_end integer :: i_local, i_global integer :: nlocal, nglobal @@ -46,6 +50,7 @@ program atm_driver integer :: atm_restart_day, atm_restart_secs ! Namelist and related variables + character(len=512) :: caseid character(len=512) :: atm_mesh_file integer :: atm_global_nx integer :: atm_global_ny @@ -61,7 +66,7 @@ program atm_driver integer :: atm_stop_secs character(len=32) :: atm_starttype - namelist /atm_driver_input/ atm_mesh_file, atm_global_nx, atm_global_ny, & + namelist /atm_driver_input/ caseid, atm_mesh_file, atm_global_nx, atm_global_ny, & atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & atm_stop_year, atm_stop_mon, atm_stop_day, atm_stop_secs, atm_starttype @@ -80,8 +85,13 @@ program atm_driver comp_comm = MPI_COMM_WORLD call MPI_COMM_RANK(comp_comm, mytask, ierr) call MPI_COMM_SIZE(comp_comm, ntasks, ierr) + if (mytask == 0) then + masterproc = .true. + else + masterproc = .false. + end if - if (mytask == 0 ) then + if (masterproc ) then print *, "MPI initialization done ..., ntasks=", ntasks end if @@ -89,7 +99,7 @@ program atm_driver ! Read in namelist file ... !----------------------------------------------------------------------------- - if (mytask == 0) then + if (masterproc) then print *,"---------------------------------------" print *, "MPI initialized in atm_driver ..." end if @@ -115,7 +125,7 @@ program atm_driver print *, " atm global nx, ny, nglobal = ",atm_global_nx, atm_global_ny, nglobal call shr_sys_abort("Error atm_nx*atm_ny is not equal to nglobal") end if - if (mytask == 0 ) then + if (masterproc ) then print *, " atm_driver mesh file ",trim(atm_mesh_file) print *, " atm global nx = ",atm_global_nx print *, " atm global nx = ",atm_global_ny @@ -124,6 +134,10 @@ program atm_driver !----------------------------------------------------------------------------- ! atmosphere domain decomposition + ! + ! Note that other code in this module relies on this simple decomposition, where we + ! assign the first points to task 0, then the next points to task 1, etc. Specifically, + ! code in write_lilac_to_atm_driver_fields relies on this decomposition. !----------------------------------------------------------------------------- nlocal = nglobal / ntasks @@ -156,7 +170,7 @@ program atm_driver ! Initialize lilac !------------------------------------------------------------------------ - if (mytask == 0 ) then + if (masterproc ) then print *, " initializing lilac with start type ",trim(atm_starttype) end if call lilac_init(comp_comm, atm_global_index, atm_lons, atm_lats, & @@ -189,7 +203,7 @@ program atm_driver read(fileunit,'(a)', iostat=ierr) restart_file if (ierr < 0) call shr_sys_abort('Error reading rpointer.lilac') close(fileunit) - if (mytask == 0) then + if (masterproc) then print *,'lilac restart_file = ',trim(restart_file) end if @@ -209,7 +223,7 @@ program atm_driver ierr = nf90_close(idfile) if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_close') - if (mytask == 0) then + if (masterproc) then print *,'restart_ymd = ',atm_restart_ymd end if call shr_cal_date2ymd(atm_restart_ymd, atm_restart_year, atm_restart_mon, atm_restart_day) @@ -240,13 +254,20 @@ program atm_driver end if end do + call write_lilac_to_atm_driver_fields( & + caseid = caseid, & + nlocal = nlocal, & + atm_global_nx = atm_global_nx, & + atm_global_ny = atm_global_ny, & + masterproc = masterproc) + !------------------------------------------------------------------------ ! Finalize lilac !------------------------------------------------------------------------ call lilac_final( ) - if (mytask == 0 ) then + if (masterproc ) then print *, "=======================================" print *, " ............. DONE ..................." print *, "=======================================" @@ -293,7 +314,7 @@ subroutine read_netcdf_mesh(filename, nglobal) ierr = nf90_inquire_dimension(idfile, dimid_coordDim, string, coordDim) call nc_check_err(ierr, "inq_dim coordDim", filename) - if (mytask == 0 ) then + if (masterproc ) then print *, "=======================================" print *, "number of elements is : ", nelem print *, "coordDim is :", coordDim @@ -425,28 +446,96 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) end subroutine atm_driver_to_lilac !======================================================================== - subroutine lilac_to_atm_driver + subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, atm_global_ny, masterproc) + + ! Fetch lnd2atm fields from LILAC and write them out. + ! + ! This should only be called once, at the end of the run. (Calling it multiple times + ! will lead to the output file being overwritten.) + + ! input/output variables + character(len=*), intent(in) :: caseid + integer, intent(in) :: nlocal + integer, intent(in) :: atm_global_nx + integer, intent(in) :: atm_global_ny + logical, intent(in) :: masterproc ! local variables - integer :: lsize + integer, parameter :: field_name_len = 64 + integer :: ierr + integer :: ncid + integer :: dimid_x + integer :: dimid_y + integer :: nglobal + integer :: i + integer, allocatable :: varids(:) + character(len=field_name_len) :: field_name real*8, allocatable :: data(:) + real*8, allocatable :: data_global(:) + real*8, allocatable :: data_2d(:,:) + + character(len=field_name_len), parameter :: fields(23) = [character(len=field_name_len) :: & + 'Sl_t', 'Sl_tref', 'Sl_qref', 'Sl_avsdr', 'Sl_anidr', 'Sl_avsdf', 'Sl_anidf', & + 'Sl_snowh', 'Sl_u10', 'Sl_fv', 'Sl_ram1', 'Sl_z0m', & + 'Fall_taux', 'Fall_tauy', 'Fall_lat', 'Fall_sen', 'Fall_lwup', 'Fall_evap', 'Fall_swnet', & + 'Fall_flxdst1', 'Fall_flxdst2', 'Fall_flxdst3', 'Fall_flxdst4'] ! -------------------------------------------- - lsize = size(atm_global_index) - allocate(data(lsize)) + if (masterproc) then + ! Use an arbitrary time rather than trying to figure out the correct time stamp. This + ! works because this subroutine is only called once, at the end of the run + ierr = nf90_create(trim(caseid)//'.atm.h0.0001-01.nc', nf90_clobber, ncid) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_create atm driver output file') + + ierr = nf90_def_dim(ncid, 'atm_nx', atm_global_nx, dimid_x) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_def_dim nx atm driver output file') + ierr = nf90_def_dim(ncid, 'atm_ny', atm_global_ny, dimid_y) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_def_dim ny atm driver output file') + + allocate(varids(size(fields))) + do i = 1, size(fields) + field_name = fields(i) + ierr = nf90_def_var(ncid, field_name, nf90_double, [dimid_x, dimid_y], varids(i)) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_def_var atm driver output file: '//trim(field_name)) + end do + + ierr = nf90_enddef(ncid) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_enddef atm driver output file') + end if + + allocate(data(nlocal)) + nglobal = atm_global_nx * atm_global_ny + if (masterproc) then + allocate(data_global(nglobal)) + allocate(data_2d(atm_global_nx, atm_global_ny)) + end if + + do i = 1, size(fields) + field_name = fields(i) + call lilac_atmcap_lnd2atm(field_name, data) + + ! Because of the way we set up the decomposition, we can use a simple mpi_gather + ! without needing to worry about any rearrangement, and points will appear in the + ! correct order on the master proc. Specifically, we rely on the fact that the + ! first points are assigned to task 0, then the next points to task 1, etc. + call mpi_gather(data, size(data), mpi_double, data_global, nglobal, mpi_double, 0, & + mpi_comm_world, ierr) + if (ierr .ne. MPI_SUCCESS) then + call shr_sys_abort(' ERROR in mpi_gather for ' // trim(field_name)) + end if + + if (masterproc) then + data_2d = reshape(data_global, [atm_global_nx, atm_global_ny]) + ierr = nf90_put_var(ncid, varids(i), data_2d) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_put_var atm driver output file: '//trim(field_name)) + end if + end do + + if (masterproc) then + ierr = nf90_close(ncid) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_close atm driver output file') + end if - call lilac_atmcap_lnd2atm('Sl_t' , data) - call lilac_atmcap_lnd2atm('Sl_tref' , data) - call lilac_atmcap_lnd2atm('Sl_qref' , data) - call lilac_atmcap_lnd2atm('Sl_avsdr' , data) - call lilac_atmcap_lnd2atm('Sl_anidr' , data) - call lilac_atmcap_lnd2atm('Sl_avsdf' , data) - call lilac_atmcap_lnd2atm('Sl_anidf' , data) - call lilac_atmcap_lnd2atm('Sl_snowh' , data) - call lilac_atmcap_lnd2atm('Sl_u10' , data) - call lilac_atmcap_lnd2atm('Sl_fv' , data) - call lilac_atmcap_lnd2atm('Sl_ram1' , data) - - end subroutine lilac_to_atm_driver + end subroutine write_lilac_to_atm_driver_fields end program diff --git a/lilac/atm_driver/atm_driver_in b/lilac/atm_driver/atm_driver_in index 09d1037741..a9bda2e0d3 100644 --- a/lilac/atm_driver/atm_driver_in +++ b/lilac/atm_driver/atm_driver_in @@ -1,4 +1,5 @@ &atm_driver_input + caseid = 'test_lilac' atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' atm_global_nx = 72 atm_global_ny = 46 From 899a6faac902e0d3fc4f40325dee1376736adf29 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 10 Feb 2020 09:54:38 -0700 Subject: [PATCH 0579/1973] Allocate data_global on non-master procs Without this, I get an error: Attempt to fetch from allocatable variable DATA_GLOBAL when it is not allocated --- lilac/atm_driver/atm_driver.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 3b9f318fcb..01cfef8b72 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -508,6 +508,8 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, atm_g if (masterproc) then allocate(data_global(nglobal)) allocate(data_2d(atm_global_nx, atm_global_ny)) + else + allocate(data_global(1)) end if do i = 1, size(fields) From 20913fab9aacab8df71954bffd41d43e41828c7d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 10 Feb 2020 12:17:10 -0700 Subject: [PATCH 0580/1973] Need to use mpi_gatherv rather than mpi_gather There are different counts per proc, so need mpi_gatherv. Also, I had previously made a mistake in using the global count for the receive count; this is supposed to be the number of points received per task. --- lilac/atm_driver/atm_driver.F90 | 46 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 01cfef8b72..ca5594f6bc 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -21,7 +21,7 @@ program atm_driver use netcdf , only : nf90_def_dim, nf90_def_var, nf90_put_var use netcdf , only : nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_varid, nf90_get_var use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS - use mpi , only : MPI_GATHER, MPI_DOUBLE + use mpi , only : MPI_GATHER, MPI_INT, MPI_DOUBLE use lilac_mod , only : lilac_init, lilac_run, lilac_final use lilac_atmcap, only : lilac_atmcap_atm2lnd, lilac_atmcap_lnd2atm use shr_cal_mod , only : shr_cal_date2ymd @@ -259,6 +259,7 @@ program atm_driver nlocal = nlocal, & atm_global_nx = atm_global_nx, & atm_global_ny = atm_global_ny, & + ntasks = ntasks, & masterproc = masterproc) !------------------------------------------------------------------------ @@ -446,7 +447,8 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) end subroutine atm_driver_to_lilac !======================================================================== - subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, atm_global_ny, masterproc) + subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, & + atm_global_ny, ntasks, masterproc) ! Fetch lnd2atm fields from LILAC and write them out. ! @@ -458,6 +460,7 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, atm_g integer, intent(in) :: nlocal integer, intent(in) :: atm_global_nx integer, intent(in) :: atm_global_ny + integer, intent(in) :: ntasks logical, intent(in) :: masterproc ! local variables @@ -470,6 +473,8 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, atm_g integer :: i integer, allocatable :: varids(:) character(len=field_name_len) :: field_name + integer, allocatable :: counts(:) + integer, allocatable :: displacements(:) real*8, allocatable :: data(:) real*8, allocatable :: data_global(:) real*8, allocatable :: data_2d(:,:) @@ -481,6 +486,10 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, atm_g 'Fall_flxdst1', 'Fall_flxdst2', 'Fall_flxdst3', 'Fall_flxdst4'] ! -------------------------------------------- + ! ------------------------------------------------------------------------ + ! Set up output file + ! ------------------------------------------------------------------------ + if (masterproc) then ! Use an arbitrary time rather than trying to figure out the correct time stamp. This ! works because this subroutine is only called once, at the end of the run @@ -503,27 +512,52 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, atm_g if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_enddef atm driver output file') end if + ! ------------------------------------------------------------------------ + ! Determine number of points on each processor and set up arrays needed for gathering + ! data to master proc + ! ------------------------------------------------------------------------ + allocate(data(nlocal)) nglobal = atm_global_nx * atm_global_ny if (masterproc) then + allocate(counts(ntasks)) + allocate(displacements(ntasks)) allocate(data_global(nglobal)) allocate(data_2d(atm_global_nx, atm_global_ny)) else + allocate(counts(1)) + allocate(displacements(1)) allocate(data_global(1)) end if + call mpi_gather(nlocal, 1, mpi_int, counts, 1, mpi_int, 0, mpi_comm_world, ierr) + if (ierr .ne. MPI_SUCCESS) then + call shr_sys_abort(' ERROR in mpi_gather for counts') + end if + + if (masterproc) then + displacements(1) = 0 + do i = 2, ntasks + displacements(i) = displacements(i-1) + counts(i-1) + end do + end if + + ! ------------------------------------------------------------------------ + ! Retrieve data for each field, gather to master and write to file + ! ------------------------------------------------------------------------ + do i = 1, size(fields) field_name = fields(i) call lilac_atmcap_lnd2atm(field_name, data) - ! Because of the way we set up the decomposition, we can use a simple mpi_gather + ! Because of the way we set up the decomposition, we can use a simple mpi_gatherv ! without needing to worry about any rearrangement, and points will appear in the ! correct order on the master proc. Specifically, we rely on the fact that the ! first points are assigned to task 0, then the next points to task 1, etc. - call mpi_gather(data, size(data), mpi_double, data_global, nglobal, mpi_double, 0, & - mpi_comm_world, ierr) + call mpi_gatherv(data, size(data), mpi_double, data_global, counts, displacements, & + mpi_double, 0, mpi_comm_world, ierr) if (ierr .ne. MPI_SUCCESS) then - call shr_sys_abort(' ERROR in mpi_gather for ' // trim(field_name)) + call shr_sys_abort(' ERROR in mpi_gatherv for ' // trim(field_name)) end if if (masterproc) then From f9ce288291978b97d3e504b8a58b789d7263530a Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 10 Feb 2020 12:44:02 -0700 Subject: [PATCH 0581/1973] cleaning up the commented out line.... --- src/biogeochem/CNPrecisionControlMod.F90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 605099a90f..2785a7bb88 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -637,9 +637,6 @@ end subroutine CNPrecisionControl subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, & num_truncatep, filter_truncatep, croponly, allowneg ) - - !subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & - ! pc13, pc14, croponly, allowneg ) ! ! !DESCRIPTION: ! Truncate paired Carbon and Nitrogen states. If a paired carbon and nitrogen state iare too small truncate From ed0227f02f435c794edcb9d001f4dfc4924ae7e9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 10 Feb 2020 16:03:32 -0700 Subject: [PATCH 0582/1973] Add to readme: also compare output from demo atm driver --- README.lilac | 1 + 1 file changed, 1 insertion(+) diff --git a/README.lilac b/README.lilac index 95f464c0fb..dd3ee0e0fe 100644 --- a/README.lilac +++ b/README.lilac @@ -61,6 +61,7 @@ library (I), do the following: > basedir=/glade/p/cgd/tss/ctsm_baselines/lilac_20191202 > cprnc test_lilac.clm2.h0.2000-01-03-00000.nc $basedir/test_lilac.clm2.h0.2000-01-03-00000.nc | tail -30 > cprnc test_lilac.lilac.hi.2000-01-02-81000.nc $basedir/test_lilac.lilac.hi.2000-01-02-81000.nc | tail -30 + > cprnc test_lilac.atm.h0.0001-01.nc $basedir/test_lilac.atm.h0.0001-01.nc | tail -30 5) if there are differences, and those are intentional, then create new baselines From 5af1f5750991c7cf87fb83d05640fe79df296961 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 11 Feb 2020 09:42:43 -0700 Subject: [PATCH 0583/1973] Fix uses of some optional arguments --- src/cpl/lilac/lnd_import_export.F90 | 10 ++++++++-- src/cpl/lilac/lnd_shr_methods.F90 | 13 +++---------- src/cpl/nuopc/lnd_import_export.F90 | 10 ++++++++-- src/cpl/nuopc/lnd_shr_methods.F90 | 13 +++---------- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index beae8c7fb4..5807d58a8c 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -683,6 +683,7 @@ subroutine state_setexport(state, fb, fldname, bounds, input, minus, ungridded_i integer , intent(out) :: rc ! local variables + logical :: l_minus ! local version of minus integer :: g, i, n real(R8), pointer :: fldptr1d(:) real(R8), pointer :: fldptr2d(:,:) @@ -692,6 +693,11 @@ subroutine state_setexport(state, fb, fldname, bounds, input, minus, ungridded_i rc = ESMF_SUCCESS + l_minus = .false. + if (present(minus)) then + l_minus = minus + end if + ! get field pointer if (present(ungridded_index)) then call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname)//" index "//trim(cvalue), & @@ -715,7 +721,7 @@ subroutine state_setexport(state, fb, fldname, bounds, input, minus, ungridded_i n = g - bounds%begg + 1 fldptr2d(ungridded_index,n) = input(g) end do - if (present(minus)) then + if (l_minus) then fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) end if else @@ -724,7 +730,7 @@ subroutine state_setexport(state, fb, fldname, bounds, input, minus, ungridded_i n = g - bounds%begg + 1 fldptr1d(n) = input(g) end do - if (present(minus)) then + if (l_minus) then fldptr1d(:) = -fldptr1d(:) end if end if diff --git a/src/cpl/lilac/lnd_shr_methods.F90 b/src/cpl/lilac/lnd_shr_methods.F90 index c20a3e4360..078aef08d9 100644 --- a/src/cpl/lilac/lnd_shr_methods.F90 +++ b/src/cpl/lilac/lnd_shr_methods.F90 @@ -53,7 +53,7 @@ subroutine state_diagnose(State, string, rc) call ESMF_StateGet(state, itemName=lfieldnamelist(n), field=lfield, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call field_getfldptr(lfield, fldptr1=dataPtr1d, fldptr2=dataPtr2d, rank=lrank, rc=rc) + call field_getfldptr(lfield, rc=rc, fldptr1=dataPtr1d, fldptr2=dataPtr2d, rank=lrank) if (chkerr(rc,__LINE__,u_FILE_u)) return if (lrank == 0) then @@ -86,7 +86,7 @@ end subroutine state_diagnose !=============================================================================== - subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) + subroutine field_getfldptr(field, rc, fldptr1, fldptr2, rank, abort) ! ---------------------------------------------- ! for a field, determine rank and return fldptr1 or fldptr2 @@ -96,11 +96,11 @@ subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) ! input/output variables type(ESMF_Field) , intent(in) :: field + integer , intent(out) :: rc real(r8), pointer , intent(inout), optional :: fldptr1(:) real(r8), pointer , intent(inout), optional :: fldptr2(:,:) integer , intent(out) , optional :: rank logical , intent(in) , optional :: abort - integer , intent(out) , optional :: rc ! local variables type(ESMF_GeomType_Flag) :: geomtype @@ -111,13 +111,6 @@ subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) character(len=*), parameter :: subname='(field_getfldptr)' ! ---------------------------------------------- - if (.not.present(rc)) then - call ESMF_LogWrite(trim(subname)//": ERROR rc not present ", & - ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) - rc = ESMF_FAILURE - return - endif - rc = ESMF_SUCCESS labort = .true. diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 6fcc84ab80..55497578f7 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -1206,6 +1206,7 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index integer , intent(out) :: rc ! local variables + logical :: l_minus ! local version of minus integer :: g, i, n real(R8), pointer :: fldptr1d(:) real(R8), pointer :: fldptr2d(:,:) @@ -1216,6 +1217,11 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index rc = ESMF_SUCCESS + l_minus = .false. + if (present(minus)) then + l_minus = minus + end if + ! Determine if field with name fldname exists in state call ESMF_StateGet(state, trim(fldname), itemFlag, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1247,7 +1253,7 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index n = g - bounds%begg + 1 fldptr2d(ungridded_index,n) = input(g) end do - if (present(minus)) then + if (l_minus) then fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) end if else @@ -1256,7 +1262,7 @@ subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index n = g - bounds%begg + 1 fldptr1d(n) = input(g) end do - if (present(minus)) then + if (l_minus) then fldptr1d(:) = -fldptr1d(:) end if end if diff --git a/src/cpl/nuopc/lnd_shr_methods.F90 b/src/cpl/nuopc/lnd_shr_methods.F90 index 344eda650e..13438e855f 100644 --- a/src/cpl/nuopc/lnd_shr_methods.F90 +++ b/src/cpl/nuopc/lnd_shr_methods.F90 @@ -321,7 +321,7 @@ subroutine state_diagnose(State, string, rc) call ESMF_StateGet(state, itemName=lfieldnamelist(n), field=lfield, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - call field_getfldptr(lfield, fldptr1=dataPtr1d, fldptr2=dataPtr2d, rank=lrank, rc=rc) + call field_getfldptr(lfield, rc=rc, fldptr1=dataPtr1d, fldptr2=dataPtr2d, rank=lrank) if (chkerr(rc,__LINE__,u_FILE_u)) return if (lrank == 0) then @@ -354,7 +354,7 @@ end subroutine state_diagnose !=============================================================================== - subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) + subroutine field_getfldptr(field, rc, fldptr1, fldptr2, rank, abort) ! ---------------------------------------------- ! for a field, determine rank and return fldptr1 or fldptr2 @@ -364,11 +364,11 @@ subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) ! input/output variables type(ESMF_Field) , intent(in) :: field + integer , intent(out) :: rc real(r8), pointer , intent(inout), optional :: fldptr1(:) real(r8), pointer , intent(inout), optional :: fldptr2(:,:) integer , intent(out) , optional :: rank logical , intent(in) , optional :: abort - integer , intent(out) , optional :: rc ! local variables type(ESMF_GeomType_Flag) :: geomtype @@ -379,13 +379,6 @@ subroutine field_getfldptr(field, fldptr1, fldptr2, rank, abort, rc) character(len=*), parameter :: subname='(field_getfldptr)' ! ---------------------------------------------- - if (.not.present(rc)) then - call ESMF_LogWrite(trim(subname)//": ERROR rc not present ", & - ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) - rc = ESMF_FAILURE - return - endif - rc = ESMF_SUCCESS labort = .true. From 024aa5c6f8764248d35c3b08dbfc4f1426a93f76 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 11 Feb 2020 10:00:17 -0700 Subject: [PATCH 0584/1973] In nuopc cap, abort if error in fldlist_add Previously, an error seemed to be silently ignored if ESMF logging wasn't set up to abort on error. --- src/cpl/nuopc/lnd_import_export.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 55497578f7..eed5a3e0c6 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -989,7 +989,7 @@ subroutine fldlist_add(num, fldlist, stdname, ungridded_lbound, ungridded_ubound if (num > fldsMax) then call ESMF_LogWrite(trim(subname)//": ERROR num > fldsMax "//trim(stdname), & ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__) - return + call shr_sys_abort(trim(subname)//": ERROR: num > fldsMax") endif fldlist(num)%stdname = trim(stdname) From 9189241c01dbeb22819f3fc9d73bbc6d71a6720f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Feb 2020 14:49:32 -0700 Subject: [PATCH 0585/1973] Changes to get a simple case to compile/link/run/pass SMS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default --- src/main/controlMod.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 79b0e2bec4..e2f75958cd 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -225,7 +225,8 @@ subroutine control_init( ) use_fates_planthydro, use_fates_ed_st3, & use_fates_ed_prescribed_phys, & use_fates_inventory_init, & - fates_inventory_ctrl_filename + fates_inventory_ctrl_filename, & + fates_parteh_mode ! CLM 5.0 nitrogen flags @@ -718,6 +719,7 @@ subroutine control_spmd() call mpi_bcast (use_fates_inventory_init, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (fates_inventory_ctrl_filename, len(fates_inventory_ctrl_filename), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fates_paramfile, len(fates_paramfile) , MPI_CHARACTER, 0, mpicom, ier) + call mpi_bcast (fates_parteh_mode, 1, MPI_INTEGER, 0, mpicom, ier) ! flexibleCN nitrogen model call mpi_bcast (use_flexibleCN, 1, MPI_LOGICAL, 0, mpicom, ier) @@ -1061,6 +1063,7 @@ subroutine control_print () write(iulog, *) ' use_fates_spitfire = ', use_fates_spitfire write(iulog, *) ' use_fates_logging = ', use_fates_logging write(iulog, *) ' fates_paramfile = ', fates_paramfile + write(iulog, *) ' fates_parteh_mode = ', fates_parteh_mode write(iulog, *) ' use_fates_planthydro = ', use_fates_planthydro write(iulog, *) ' use_fates_ed_st3 = ',use_fates_ed_st3 write(iulog, *) ' use_fates_ed_prescribed_phys = ',use_fates_ed_prescribed_phys From cbc80dc85beb57ba86d1c192fcadde987fb67634 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Feb 2020 14:50:09 -0700 Subject: [PATCH 0586/1973] Add some notes to ChangeSum about which release tags came to master --- doc/ChangeSum | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/doc/ChangeSum b/doc/ChangeSum index 69d7091d5f..34e896932f 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -5,11 +5,9 @@ release-clm5.0.28 erik 11/14/2019 Several bit-for-bit fixes especially around release-clm5.0.27 erik 08/13/2019 Add presoribed soil moisture streams as an option, and a few fixes release-clm5.0.26 sacks 07/29/2019 Add a CN precision control call to fix problems related to small negative values release-clm5.0.25 erik 05/29/2019 Change two files from NetCDF-4 format to NetCDF-3 (because some machines have trouble with NetCDF-4 in pnetcdf) -release-clm5.0.25 erik 05/29/2019 Change two files from NetCDF-4 format to NetCDF-3 (because some machines have trouble with NetCDF-4 in pnetcdf) release-clm5.0.24 erik 05/22/2019 Correct ndep end year for SSPs, 2-degree CMIP6WACCMDECK with C-isotopes off, fixes mksurfdata for high resolution release-clm5.0.23 erik 05/15/2019 Update cime to bring in CO2 transient files for the CMIP6 SSP's as well as presaero for three of them release-clm5.0.22 erik 05/08/2019 Fix carbon isotope bug that caused wrong answers for isotopes under transient land-use change -release-clm5.0.22 erik 05/08/2019 Fix carbon isotope bug that caused wrong answers for isotopes under transient land-use change release-clm5.0.21 erik 05/03/2019 New ndep files, update fates, fix some issues release-clm5.0.20 erik 03/12/2019 Update all fsurdat files and bring in files for future scenarios, remove CMIP5 rcp options, bring in some bug fixes release-clm5.0.19 erik 03/08/2019 SKIPPED ON MASTER -- Update cime version @@ -92,16 +90,16 @@ release-clm5.0.13 erik 11/14/2018 Update externals with new CO2/presearo/rtm/ ctsm1.0.dev011 sacks 09/12/2018 Add water tracer consistency checks, and other water tracer work ctsm1.0.dev010 sacks 08/30/2018 Update cime to cime5.7.3 ctsm1.0.dev009 sacks 08/22/2018 Fix initialization of AnnET in InitAccVars - ctsm1.0.dev008 erik 08/14/2018 Update 1850 ndep file and last year for streams for Historical transient cases + ctsm1.0.dev008 erik 08/14/2018 Update 1850 ndep file and last year for streams for Historical transient cases (corresponds to release-clm5.0.05) ctsm1.0.dev007 sacks 08/05/2018 Avoid glacier dynamic landunit adjustments in first time step ctsm1.0.dev006 sacks 08/04/2018 Minor bug fixes, cleanup, documentation and enhancements - ctsm1.0.dev005 sacks 08/03/2018 Rework water data types to accommodate isotopes and other tracers - ctsm1.0.dev004 erik 07/18/2018 Add some new diagnostic fields, fix a few issues, update cmip6 output + ctsm1.0.dev005 sacks 08/03/2018 Rework water data types to accommodate isotopes and other tracers (skipped on release-clm5.0) + ctsm1.0.dev004 erik 07/18/2018 Add some new diagnostic fields, fix a few issues, update cmip6 output (corresponds to release-clm5.0.04) ctsm1.0.dev003 erik 07/15/2018 Update cime/cism to work on upgraded hobart and with glade changes on cheyenne ctsm1.0.dev002 erik 07/06/2018 Fix NFIX flux variables so special land-units are zeroed out, tools update, add some *_MAX fields on mksurfdata_map for transient cases - ctsm1.0.dev001 sacks 06/22/2018 Begin separating SoilHydrology flux calculations - clm5.0.dev013 erik 06/12/2018 cleanup and update cime and cism - clm5.0.dev012 sacks 05/17/2018 Fixes for variable_year orbital mode + ctsm1.0.dev001 sacks 06/22/2018 Begin separating SoilHydrology flux calculations (this was skipped on release branch) + clm5.0.dev013 erik 06/12/2018 cleanup and update cime and cism (corresponds to release-clm5.0.03) + clm5.0.dev012 sacks 05/17/2018 Fixes for variable_year orbital mode (corresponds to release-clm5.0.01 and release-clm5.0.02) clm5.0.dev011 erik 05/16/2018 1850 ndep update, cism update, PE layouts, turn BFBFLAG for testing clm5.0.dev010 erik 05/15/2018 Update cime version to version in cesm2.0.beta10, changes answers for 1850 compsets because of orbit clm5.0.dev009 sacks 05/10/2018 New init_interp method From 0202c6997e23395dbe7fb1a195a8a3e7263d2501 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Feb 2020 16:00:28 -0700 Subject: [PATCH 0587/1973] Copy some files from release-clm5.0.29 to make sure they are correct --- bld/namelist_files/namelist_defaults.xsl | 2 +- bld/namelist_files/namelist_defaults_usr_files.xml | 11 ++++++----- bld/namelist_files/use_cases/README | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bld/namelist_files/namelist_defaults.xsl b/bld/namelist_files/namelist_defaults.xsl index 20a8c4a8ad..6960cfbef9 100644 --- a/bld/namelist_files/namelist_defaults.xsl +++ b/bld/namelist_files/namelist_defaults.xsl @@ -28,7 +28,7 @@
  • Site specific point name (sitespf_pt)
  • Crop model (crop)
  • Data model forcing source (forcing)
  • -
  • Representative concentration pathway for future scenarios (rcp)
  • +
  • Representative concentration pathway for future scenarios (SSP-rcp)
  • New good wood harvest (newwoodharv)
  • CN Spin-up mode (spinup)
  • Type of file (type)
  • diff --git a/bld/namelist_files/namelist_defaults_usr_files.xml b/bld/namelist_files/namelist_defaults_usr_files.xml index 8ef06f8014..41e6dcd47b 100644 --- a/bld/namelist_files/namelist_defaults_usr_files.xml +++ b/bld/namelist_files/namelist_defaults_usr_files.xml @@ -23,13 +23,14 @@ provided they are in the valid list expressed above. lnd/clm2/initdata/clmi.${clm_usr_name}_${mask}_simyr${sim_year}.nc +lnd/clm2/surfdata/surfdata_${clm_usr_name}_simyr${sim_year}.nc lnd/clm2/surfdata_map/surfdata_${clm_usr_name}_simyr${sim_year}.nc -null -lnd/clm2/surfdata/landuse.timeseries_${clm_usr_name}_simyr${sim_year_range}.nc -lnd/clm2/surfdata/landuse.timeseries_${clm_usr_name}_simyr1849-2006.nc -lnd/clm2/surfdata/landuse.timeseries_rcp${rcp}_${clm_usr_name}_simyr${sim_year_range}.nc -lnd/clm2/surfdata/landuse.timeseries_rcp${rcp}_${clm_usr_name}_simyr1849-2006.nc +null +lnd/clm2/surfdata/landuse.timeseries_${clm_usr_name}_simyr${sim_year_range}.nc +lnd/clm2/surfdata/landuse.timeseries_${clm_usr_name}_simyr1849-2006.nc +lnd/clm2/surfdata/landuse.timeseries_${ssp_rcp}_${clm_usr_name}_simyr${sim_year_range}.nc +lnd/clm2/surfdata/landuse.timeseries_${ssp_rcp}_${clm_usr_name}_simyr1849-2006.nc diff --git a/bld/namelist_files/use_cases/README b/bld/namelist_files/use_cases/README index 40b992332b..4ccaf00bdc 100644 --- a/bld/namelist_files/use_cases/README +++ b/bld/namelist_files/use_cases/README @@ -11,7 +11,7 @@ Ending suffix requires one of these endings: _transient, _control or _pd Transient cases: - yyyy-yyyy_$rcp$desc_transient (for example 1850-2100_rcp8.5_transient) + yyyy-yyyy_$ssp_rcp$desc_transient (for example 1850-2100_SSP5-8.5_transient) or @@ -30,9 +30,9 @@ Where yyyy = Simulation year (such as 1850 or 2000). yyyy-yyyy = Range of simulation years to run over (i.e.. 1850-2000). -$rcp = Representative concentration pathway (rcp) description string +$ssp_rcp = Shared Socieconomic Pathway (SSP) Representative concentration pathway (RCP) description string for future scenarios: - rcp#.# (for example: rcp8.5, rcp6, rcp4.5, rcp2.6) + SSP#-#.# (for example: SSP5-8.5, SSP1-2.6, SSP4-6.0 [can be blank for historical cases]. $desc = Description of anything else -- alpha-numeric. Should start with an underscore ("_") if not by itself From 0bc9741c243937873d3542b02c34379b97cef976 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Feb 2020 16:22:52 -0700 Subject: [PATCH 0588/1973] Reapply the fates update from release-clm5.0.20 to release-clm5.0.21 under the src directory --- src/CMakeLists.txt | 1 - src/main/histFileMod.F90 | 35 +++++++++++++++++++++++++++++ src/utils/clmfates_interfaceMod.F90 | 12 +++++++++- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index be66201047..3e4ab93151 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,7 +35,6 @@ add_subdirectory(${CLM_ROOT}/src/biogeophys clm_biogeophys) add_subdirectory(${CLM_ROOT}/src/dyn_subgrid clm_dyn_subgrid) add_subdirectory(${CLM_ROOT}/src/main clm_main) add_subdirectory(${CLM_ROOT}/src/init_interp clm_init_interp) -add_subdirectory(${CLM_ROOT}/src/fates/main fates_main) # Add general unit test directories (stubbed out files, etc.) add_subdirectory(unit_test_stubs) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 23690ad51f..5e33ac4c2d 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -24,6 +24,7 @@ module histFileMod use EDTypesMod , only : nclmax use EDTypesMod , only : nlevleaf use FatesInterfaceMod , only : nlevsclass, nlevage + use FatesInterfaceMod , only : nlevheight use EDTypesMod , only : nfsc, ncwd use FatesInterfaceMod , only : maxveg_fates => numpft use ncdio_pio @@ -2058,9 +2059,12 @@ subroutine htape_create (t, histrest) if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) + call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * numpft_ed, dimid) + call ncd_defdim(lnfid, 'fates_levagepft', nlevage * numpft_ed, dimid) call ncd_defdim(lnfid, 'fates_levscls', nlevsclass, dimid) call ncd_defdim(lnfid, 'fates_levpft', maxveg_fates, dimid) call ncd_defdim(lnfid, 'fates_levage', nlevage, dimid) + call ncd_defdim(lnfid, 'fates_levheight', nlevheight, dimid) call ncd_defdim(lnfid, 'fates_levfuel', nfsc, dimid) call ncd_defdim(lnfid, 'fates_levcwdsc', ncwd, dimid) call ncd_defdim(lnfid, 'fates_levscpf', nlevsclass*maxveg_fates, dimid) @@ -2484,9 +2488,15 @@ subroutine htape_timeconst(t, mode) use FatesInterfaceMod, only : fates_hdim_pfmap_levscpf use FatesInterfaceMod, only : fates_hdim_scmap_levscpf use FatesInterfaceMod, only : fates_hdim_levage + use FatesInterfaceMod, only : fates_hdim_levheight use FatesInterfaceMod, only : fates_hdim_levpft use FatesInterfaceMod, only : fates_hdim_scmap_levscag use FatesInterfaceMod, only : fates_hdim_agmap_levscag + use FatesInterfaceMod, only : fates_hdim_scmap_levscagpft + use FatesInterfaceMod, only : fates_hdim_agmap_levscagpft + use FatesInterfaceMod, only : fates_hdim_pftmap_levscagpft + use FatesInterfaceMod, only : fates_hdim_agmap_levagepft + use FatesInterfaceMod, only : fates_hdim_pftmap_levagepft use FatesInterfaceMod, only : fates_hdim_levfuel use FatesInterfaceMod, only : fates_hdim_levcwdsc use FatesInterfaceMod, only : fates_hdim_levcan @@ -2561,6 +2571,8 @@ subroutine htape_timeconst(t, mode) long_name='FATES size index of the combined pft-size class dimension', units='-', ncid=nfid(t)) call ncd_defvar(varname='fates_levage',xtype=tape(t)%ncprec, dim1name='fates_levage', & long_name='FATES patch age (yr)', ncid=nfid(t)) + call ncd_defvar(varname='fates_levheight',xtype=tape(t)%ncprec, dim1name='fates_levheight', & + long_name='FATES height (m)', ncid=nfid(t)) call ncd_defvar(varname='fates_levpft',xtype=ncd_int, dim1name='fates_levpft', & long_name='FATES pft number', ncid=nfid(t)) call ncd_defvar(varname='fates_levfuel',xtype=ncd_int, dim1name='fates_levfuel', & @@ -2579,6 +2591,17 @@ subroutine htape_timeconst(t, mode) long_name='FATES leaf level of combined canopy x leaf x pft dimension', ncid=nfid(t)) call ncd_defvar(varname='fates_pftmap_levcnlfpf',xtype=ncd_int, dim1name='fates_levcnlfpf', & long_name='FATES PFT level of combined canopy x leaf x pft dimension', ncid=nfid(t)) + call ncd_defvar(varname='fates_scmap_levscagpft', xtype=ncd_int, dim1name='fates_levscagpf', & + long_name='FATES size-class map into size x patch age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_agmap_levscagpft', xtype=ncd_int, dim1name='fates_levscagpf', & + long_name='FATES age-class map into size x patch age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_pftmap_levscagpft', xtype=ncd_int, dim1name='fates_levscagpf', & + long_name='FATES pft map into size x patch age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_pftmap_levagepft', xtype=ncd_int, dim1name='fates_levagepft', & + long_name='FATES pft map into patch age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_agmap_levagepft', xtype=ncd_int, dim1name='fates_levagepft', & + long_name='FATES age-class map into patch age x pft', units='-', ncid=nfid(t)) + end if @@ -2599,6 +2622,7 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='fates_pftmap_levscpf',data=fates_hdim_pfmap_levscpf, ncid=nfid(t), flag='write') call ncd_io(varname='fates_scmap_levscpf',data=fates_hdim_scmap_levscpf, ncid=nfid(t), flag='write') call ncd_io(varname='fates_levage',data=fates_hdim_levage, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_levheight',data=fates_hdim_levheight, ncid=nfid(t), flag='write') call ncd_io(varname='fates_levpft',data=fates_hdim_levpft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_levfuel',data=fates_hdim_levfuel, ncid=nfid(t), flag='write') call ncd_io(varname='fates_levcwdsc',data=fates_hdim_levcwdsc, ncid=nfid(t), flag='write') @@ -2608,6 +2632,11 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='fates_canmap_levcnlfpf',data=fates_hdim_canmap_levcnlfpf, ncid=nfid(t), flag='write') call ncd_io(varname='fates_lfmap_levcnlfpf',data=fates_hdim_lfmap_levcnlfpf, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levcnlfpf',data=fates_hdim_pftmap_levcnlfpf, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_scmap_levscagpft',data=fates_hdim_scmap_levscagpft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_agmap_levscagpft',data=fates_hdim_agmap_levscagpft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_pftmap_levscagpft',data=fates_hdim_pftmap_levscagpft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_pftmap_levagepft',data=fates_hdim_pftmap_levagepft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_agmap_levagepft',data=fates_hdim_agmap_levagepft, ncid=nfid(t), flag='write') end if endif @@ -4848,6 +4877,8 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, num2d = maxveg_fates case ('fates_levage') num2d = nlevage + case ('fates_levheight') + num2d = nlevheight case ('fates_levfuel') num2d = nfsc case ('fates_levcwdsc') @@ -4856,6 +4887,10 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, num2d = nlevsclass*maxveg_fates case ('fates_levscag') num2d = nlevsclass*nlevage + case ('fates_levscagpf') + num2d = nlevsclass*nlevage*numpft_ed + case ('fates_levagepft') + num2d = nlevage*numpft_ed case ('fates_levcan') num2d = nclmax case ('fates_levcnlf') diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 24782a663d..afad5f82e8 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -131,6 +131,7 @@ module CLMFatesInterfaceMod use FatesPlantHydraulicsMod, only : HydrSiteColdStart use FatesPlantHydraulicsMod, only : InitHydrSites use FatesPlantHydraulicsMod, only : UpdateH2OVeg + use FatesPlantHydraulicsMod, only : RestartHydrStates implicit none @@ -241,7 +242,7 @@ subroutine init(this, bounds_proc ) logical :: verbose_output integer :: pass_masterproc integer :: pass_vertsoilc - integer :: pass_spitfire + integer :: pass_spitfire integer :: pass_ed_st3 integer :: pass_ed_prescribed_phys integer :: pass_logging @@ -2150,6 +2151,15 @@ subroutine init_history_io(this,bounds_proc) ptr_col=this%fates_hist%hvars(ivar)%r82d, & default=trim(vdefault), & set_lake=0._r8,set_urb=0._r8) + case(site_height_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index + dim2name = this%fates_hist%dim_bounds(d_index)%name + call hist_addfld2d(fname=trim(vname),units=trim(vunits), & + type2d=trim(dim2name), & + avgflag=trim(vavgflag),long_name=trim(vlong), & + ptr_col=this%fates_hist%hvars(ivar)%r82d, & + default=trim(vdefault), & + set_lake=0._r8,set_urb=0._r8) case(site_fuel_r8) d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index dim2name = this%fates_hist%dim_bounds(d_index)%name From 16121e1131bc757708972261ae5cb9a05026d29c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Feb 2020 16:53:21 -0700 Subject: [PATCH 0589/1973] Some changes to get fates working again --- src/main/histFileMod.F90 | 8 ++++---- src/utils/clmfates_interfaceMod.F90 | 9 --------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 5e33ac4c2d..d1bc292f74 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2059,8 +2059,8 @@ subroutine htape_create (t, histrest) if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) - call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * numpft_ed, dimid) - call ncd_defdim(lnfid, 'fates_levagepft', nlevage * numpft_ed, dimid) + call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levagepft', nlevage * maxveg_fates, dimid) call ncd_defdim(lnfid, 'fates_levscls', nlevsclass, dimid) call ncd_defdim(lnfid, 'fates_levpft', maxveg_fates, dimid) call ncd_defdim(lnfid, 'fates_levage', nlevage, dimid) @@ -4888,9 +4888,9 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('fates_levscag') num2d = nlevsclass*nlevage case ('fates_levscagpf') - num2d = nlevsclass*nlevage*numpft_ed + num2d = nlevsclass*nlevage*maxveg_fates case ('fates_levagepft') - num2d = nlevage*numpft_ed + num2d = nlevage*maxveg_fates case ('fates_levcan') num2d = nclmax case ('fates_levcnlf') diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index afad5f82e8..7ebf6d92e3 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2151,15 +2151,6 @@ subroutine init_history_io(this,bounds_proc) ptr_col=this%fates_hist%hvars(ivar)%r82d, & default=trim(vdefault), & set_lake=0._r8,set_urb=0._r8) - case(site_height_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) case(site_fuel_r8) d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index dim2name = this%fates_hist%dim_bounds(d_index)%name From 55c7e9d926e56995ec45fbc851f560be7dc4baf4 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Tue, 11 Feb 2020 20:07:29 -0700 Subject: [PATCH 0590/1973] Updating the filter in TruncateCStates --- src/biogeochem/CNPrecisionControlMod.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 2785a7bb88..7467dc6387 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -747,6 +747,8 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l if ( present(allowneg) )then if ( allowneg ) lallowneg = .true. end if + + num_truncatep = 0 do fp = 1,num_soilp p = filter_soilp(fp) @@ -756,6 +758,10 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l write(iulog,*) 'ERROR: limit = ', cnegcrit call endrun(msg='ERROR: carbon state critically negative '//errMsg(sourcefile, lineno)) else if ( abs(carbon_patch(p)) < ccrit) then + + num_truncatep = num_truncatep + 1 + filter_truncatep(num_truncatep) = p + pc(p) = pc(p) + carbon_patch(p) carbon_patch(p) = 0._r8 end if From eea3dec2132818713bf4dd58ff55c5044b3aa25d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Feb 2020 21:18:18 -0700 Subject: [PATCH 0591/1973] Add FatesHydro and ciso_dec2050Start testmods from release branch and fix the pointer for prescribed soilm history term --- .../testdefs/testmods_dirs/clm/FatesHydro/shell_commands | 1 + .../testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm | 5 +++++ .../testmods_dirs/clm/ciso_dec2050Start/include_user_mods | 2 ++ .../testmods_dirs/clm/ciso_dec2050Start/shell_commands | 1 + .../testdefs/testmods_dirs/clm/ciso_dec2050Start/user_nl_clm | 3 +++ src/biogeophys/WaterStateType.F90 | 2 +- 6 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesHydro/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm create mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/include_user_mods create mode 100755 cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/user_nl_clm diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesHydro/shell_commands b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/shell_commands new file mode 100644 index 0000000000..2a9f09bd75 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/shell_commands @@ -0,0 +1 @@ +./xmlchange CLM_FORCE_COLDSTART="on" diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm new file mode 100644 index 0000000000..2435b5bc7e --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm @@ -0,0 +1,5 @@ +hist_empty_htapes = .true. +use_fates_planthydro= .true. +hist_fincl1 = 'FATES_ERRH2O_SCPF','FATES_TRAN_SCPF','FATES_ROOTUPTAKE_SCPF','FATES_ROOTUPTAKE01_SCPF', +'FATES_SAPFLOW_COL_SCPF','FATES_ITERH1_COL_SCPF','FATES_ATH_COL_SCPF','FATES_TTH_COL_SCPF', +'FATES_STH_COL_SCPF','FATES_LTH_COL_SCPF','FATES_AWP_COL_SCPF','FATES_BTRAN_COL_SCPF' diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/include_user_mods new file mode 100644 index 0000000000..c9053f7b07 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/include_user_mods @@ -0,0 +1,2 @@ +../ciso +../decStart diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/shell_commands b/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/shell_commands new file mode 100755 index 0000000000..8bd67a0031 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/shell_commands @@ -0,0 +1 @@ +./xmlchange RUN_STARTDATE=2050-12-30 diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/user_nl_clm new file mode 100644 index 0000000000..f5f43b3aff --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/ciso_dec2050Start/user_nl_clm @@ -0,0 +1,3 @@ +! Initial condition file from a coupled run at 2015 that will work with this setup.. + finidat = "$DIN_LOC_ROOT/cesm2_init/b.e21.BHIST.f09_g17.CMIP6-historical.010/2015-01-01/b.e21.BHIST.f09_g17.CMIP6-historical.010.clm2.r.2015-01-01-00000.nc" + use_init_interp = T diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index baff2902f9..398f528ebf 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -207,7 +207,7 @@ subroutine InitHistory(this, bounds) units='mm3/mm3', type2d='levsoi', & avgflag='A', & long_name=this%info%lname('volumetric soil water prescribed (vegetated landunits only)'), & - ptr_col=this%h2osoi_vol_prs_grc, l2g_scale_type='veg', default='inactive') + ptr_gcell=this%h2osoi_vol_prs_grc, l2g_scale_type='veg', default='inactive') end if ! this%h2osoi_liq_col(begc:endc,:) = spval From 294f9e706704258e907b2680f0b358af1335c1bc Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 09:53:45 -0700 Subject: [PATCH 0592/1973] Minor changes in CLMBuildNamelist to reduce prints to stdout For the sake of running CLMBuildNamelist using lilac's buildnml, I wanted to remove prints to stdout when things were working correctly. This commit removes two sets of output: (1) Messages about the obsolescence of glob: File::Glob::glob() will disappear in perl 5.30. Use File::Glob::bsd_glob() instead. at /Users/sacks/ctsm/ctsm2/bld/CLMBuildNamelist.pm line 4105. (2) Messages about the use case: CLM adding use_case 2000_control defaults for var 'sim_year' with val '2000' CLM adding use_case 2000_control defaults for var 'sim_year_range' with val 'constant' CLM adding use_case 2000_control defaults for var 'stream_year_first_urbantv' with val '2000' CLM adding use_case 2000_control defaults for var 'stream_year_last_urbantv' with val '2000' CLM adding use_case 2000_control defaults for var 'use_case_desc' with val 'Conditions to simulate 2000 land-use' --- bld/CLMBuildNamelist.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index ae58cbaf12..0ccf7ffb0d 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -35,7 +35,7 @@ use File::Basename qw(dirname); use English; use Getopt::Long; use IO::File; -use File::Glob ':glob'; +use File::Glob ':bsd_glob'; #------------------------------------------------------------------------------- # @@ -476,7 +476,7 @@ sub read_envxml_case_files { my %envxml = (); if ( defined($opts->{'envxml_dir'}) ) { (-d $opts->{'envxml_dir'}) or $log->fatal_error( "envxml_dir is not a directory" ); - my @files = glob( $opts->{'envxml_dir'}."/env_*xml" ); + my @files = bsd_glob( $opts->{'envxml_dir'}."/env_*xml" ); ($#files >= 0) or $log->fatal_error( "there are no env_*xml files in the envxml_dir" ); foreach my $file (@files) { $log->verbose_message( "Open env.xml file: $file" ); @@ -1443,7 +1443,7 @@ sub process_namelist_commandline_use_case { my $val = $uc_defaults->get_value($var, \%settings ); if ( defined($val) ) { - $log->message("CLM adding use_case $opts->{'use_case'} defaults for var '$var' with val '$val'"); + $log->verbose_message("CLM adding use_case $opts->{'use_case'} defaults for var '$var' with val '$val'"); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl_usecase, $var, 'val'=>$val); } @@ -4102,7 +4102,7 @@ sub validate_options { # create the @expect array by listing the files in $use_case_dir # and strip off the ".xml" part of the filename @expect = (); - my @files = glob("$opts->{'use_case_dir'}/*.xml"); + my @files = bsd_glob("$opts->{'use_case_dir'}/*.xml"); foreach my $file (@files) { $file =~ m{.*/(.*)\.xml}; &check_use_case_name( $1 ); @@ -4116,7 +4116,7 @@ sub validate_options { } else { print "Use cases are:...\n\n"; my @ucases; - foreach my $file( sort( glob($opts->{'use_case_dir'}."/*.xml") ) ) { + foreach my $file( sort( bsd_glob($opts->{'use_case_dir'}."/*.xml") ) ) { my $use_case; if ( $file =~ /\/([^\/]+)\.xml$/ ) { &check_use_case_name( $1 ); From a18cbb07fed3931ed019eb03ada3ff3b0e8ee932 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 10:58:49 -0700 Subject: [PATCH 0593/1973] LILAC buildnml: Remove python2 support and run_cmd function Removing python2 support because it relied on six, which may not be present on every system. Removing run_cmd function because it introduced unnecessary complexity. --- lilac_config/buildnml | 131 +++++------------------------------------- 1 file changed, 15 insertions(+), 116 deletions(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 4fefdaaf9d..a826d9477b 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -1,37 +1,13 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ CTSM namelist creator """ -import sys, os, shutil, subprocess, logging, argparse -import six -from argparse import RawTextHelpFormatter +import sys, os, subprocess, argparse -try: - # python2 - from ConfigParser import SafeConfigParser as config_parser - from ConfigParser import MissingSectionHeaderError - from ConfigParser import NoSectionError, NoOptionError - - def config_string_cleaner(text): - """convert strings into unicode - """ - return text.decode('utf-8') -except ImportError: - # python3 - from configparser import ConfigParser as config_parser - from configparser import MissingSectionHeaderError - from configparser import NoSectionError, NoOptionError - - def config_string_cleaner(text): - """Python3 already uses unicode strings, so just return the string - without modification. - - """ - return text - -logger = logging.getLogger(__name__) +from configparser import ConfigParser +from configparser import NoSectionError, NoOptionError _config_cache_template = """ @@ -41,7 +17,7 @@ _config_cache_template = """ """ -# Note the following is needed in env_lilac.xml otherwise the following error appers in the call to build_namelist +# Note the following is needed in env_lilac.xml otherwise the following error appears in the call to build_namelist #err=ERROR : CLM build-namelist::CLMBuildNamelist::logical_to_fortran() : Unexpected value in logical_to_fortran: _env_lilac_template = """ @@ -62,10 +38,10 @@ _hack=object() def parse_command_line(args, description): ############################################################################### - parser = argparse.ArgumentParser(formatter_class=RawTextHelpFormatter, description=description) + parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=description) parser.add_argument("--rundir", type=str, default=os.getcwd(), - help="(required) specify the full path of the run directory)") + help="specify the full path of the run directory") arguments = parser.parse_args(args) @@ -75,81 +51,6 @@ def parse_command_line(args, description): return arguments.rundir -############################################################################### -def run_cmd(cmd, input_str=None, from_dir=None, verbose=None, - arg_stdout=_hack, arg_stderr=_hack, env=None, combine_output=False): -############################################################################### - - """ - Wrapper around subprocess to make it much more convenient to run shell commands - - >>> run_cmd('ls file_i_hope_doesnt_exist')[0] != 0 - True - """ - import subprocess # Not safe to do globally, module not available in older pythons - - # Real defaults for these value should be subprocess.PIPE - if arg_stdout is _hack: - arg_stdout = subprocess.PIPE - elif isinstance(arg_stdout, six.string_types): - arg_stdout = _convert_to_fd(arg_stdout, from_dir) - - if arg_stderr is _hack: - arg_stderr = subprocess.STDOUT if combine_output else subprocess.PIPE - elif isinstance(arg_stderr, six.string_types): - arg_stderr = _convert_to_fd(arg_stdout, from_dir) - - if (verbose != False and (verbose or logger.isEnabledFor(logging.DEBUG))): - logger.info("RUN: {}\nFROM: {}".format(cmd, os.getcwd() if from_dir is None else from_dir)) - - if (input_str is not None): - stdin = subprocess.PIPE - else: - stdin = None - - proc = subprocess.Popen(cmd, - shell=True, - stdout=arg_stdout, - stderr=arg_stderr, - stdin=stdin, - cwd=from_dir, - env=env) - - output, errput = proc.communicate(input_str) - if output is not None: - try: - output = output.decode('utf-8', errors='ignore').strip() - except AttributeError: - pass - if errput is not None: - try: - errput = errput.decode('utf-8', errors='ignore').strip() - except AttributeError: - pass - - stat = proc.wait() - if six.PY2: - if isinstance(arg_stdout, file): # pylint: disable=undefined-variable - arg_stdout.close() # pylint: disable=no-member - if isinstance(arg_stderr, file) and arg_stderr is not arg_stdout: # pylint: disable=undefined-variable - arg_stderr.close() # pylint: disable=no-member - else: - if isinstance(arg_stdout, io.IOBase): - arg_stdout.close() # pylint: disable=no-member - if isinstance(arg_stderr, io.IOBase) and arg_stderr is not arg_stdout: - arg_stderr.close() # pylint: disable=no-member - - - if (verbose != False and (verbose or logger.isEnabledFor(logging.DEBUG))): - if stat != 0: - logger.info(" stat: {:d}\n".format(stat)) - if output: - logger.info(" output: {}\n".format(output)) - if errput: - logger.info(" errput: {}\n".format(errput)) - - return stat, output, errput - ############################################################################### def buildnml(rundir, bldnmldir): ############################################################################### @@ -159,8 +60,8 @@ def buildnml(rundir, bldnmldir): file_path = os.path.join(rundir,'ctsm.cfg') # read the config file - config = config_parser() - config.read(file_path) # TODO: add the code in externals_description.py to get the error checks + config = ConfigParser() + config.read(file_path) clm_phys = config.get('buildnml_input', 'clm_phys') start_type = config.get('buildnml_input', 'start_type') @@ -201,8 +102,8 @@ def buildnml(rundir, bldnmldir): command = [cmd, '-csmdata', din_loc_root, '-inputdata', os.path.join(rundir, "clm.input_data_list"), - '-namelist', '\'&clm_inparm start_ymd={} {}/\''.format(start_ymd, clm_namelist_opts), - '-use_case',use_case, + '-namelist', '&clm_inparm start_ymd={} {}/'.format(start_ymd, clm_namelist_opts), + '-use_case',use_case, '-res', lnd_grid, '-clm_start_type', start_type, '-l_ncpl', str(1), # this will not be used in lilac - but is needed as input @@ -215,15 +116,13 @@ def buildnml(rundir, bldnmldir): '-clm_accelerated_spinup', spinup, '-lnd_tuning_mode',lnd_tuning_mode, '-config',os.path.join(rundir, "config_cache.xml"), - '-envxml_dir', rundir, - clm_bldnml_opts] + '-envxml_dir', rundir] + command.extend(clm_bldnml_opts.split()) if gridmask != 'null' and gridmask != 'UNSET': command.extend(['-mask', gridmask]) - cmd = ' '.join(command) - rc, out, err = run_cmd(cmd, from_dir=os.getcwd()) - if rc > 0: - raise Exception("Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) + subprocess.check_call(command, + universal_newlines=True) # remove temporary files in rundir os.remove(os.path.join(rundir, "config_cache.xml")) From a992fae968c138dd9aff2b468f518eab2f89c3c0 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 12 Feb 2020 11:28:16 -0700 Subject: [PATCH 0594/1973] aligning and clean ups... --- src/biogeochem/CNPrecisionControlMod.F90 | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 7467dc6387..3162ff142b 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -706,7 +706,7 @@ subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, n end subroutine TruncateCandNStates subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, lineno, & - num_truncatep, filter_truncatep, croponly, allowneg ) + num_truncatep, filter_truncatep, croponly, allowneg ) ! ! !DESCRIPTION: ! Truncate Carbon states. If a carbon state is too small truncate it to @@ -808,8 +808,8 @@ subroutine TruncateNStates( bounds, filter_soilp, num_soilp, nitrogen_patch, pn, end subroutine TruncateNStates !----------------------------------------------------------------------- - subroutine TruncateAdditional(bounds, num_truncatep, filter_truncatep, & - state_patch, truncation_patch, lineno) + subroutine TruncateAdditional( bounds, num_truncatep, filter_truncatep, & + state_patch, truncation_patch, lineno) ! ! !DESCRIPTION: ! Given a filter of points for which we have already determined that truncation should @@ -819,20 +819,19 @@ subroutine TruncateAdditional(bounds, num_truncatep, filter_truncatep, & use decompMod , only : bounds_type ! !ARGUMENTS: implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer, intent(in) :: num_truncatep ! number of points in filter_truncatep - integer, intent(in) :: filter_truncatep(:) ! filter for points that need truncation - real(r8), intent(inout) :: state_patch(bounds%begp: ) - real(r8), intent(inout) :: truncation_patch(bounds%begp: ) - integer, intent(in) :: lineno + type(bounds_type) , intent (in) :: bounds ! bounds + integer , intent (in) :: num_truncatep ! number of points in filter_truncatep + integer , intent (in) :: filter_truncatep(:) ! filter for points that need truncation + real(r8) , intent (inout) :: state_patch(bounds%begp: ) + real(r8) , intent (inout) :: truncation_patch(bounds%begp: ) + integer , intent (in) :: lineno ! ! !LOCAL VARIABLES: - - integer :: fp, p + integer :: fp, p character(len=*), parameter :: subname = 'TruncateAdditional' !----------------------------------------------------------------------- - SHR_ASSERT_FL((ubound(state_patch, 1) == bounds%endp), 'state_patch '//sourcefile, lineno) + SHR_ASSERT_FL((ubound(state_patch, 1) == bounds%endp), 'state_patch ' //sourcefile, lineno) SHR_ASSERT_FL((ubound(truncation_patch, 1) == bounds%endp), 'truncation_patch '//sourcefile, lineno) do fp = 1, num_truncatep From c2e0c50dab546a22036eb258f1e385249afc1b2b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 11:32:53 -0700 Subject: [PATCH 0595/1973] Add better error handling in config.get calls --- lilac_config/buildnml | 59 ++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index a826d9477b..4d90cb582f 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -47,10 +47,29 @@ def parse_command_line(args, description): # check if rundir exists if not os.path.isdir(arguments.rundir): - raise Exception("rundir %s does not exist".format(arguments.rundir)) + raise RuntimeError("rundir %s does not exist".format(arguments.rundir)) return arguments.rundir +############################################################################### +def get_config_value(config, section, item, file_path): + """Get a given item from a given section of the config object + + Give a helpful error message if we can't find the given section or item + + Note that the file_path argument is only used for the sake of the error message + """ + try: + val = config.get(section, item) + except NoSectionError: + print("ERROR: Config file {} must contain section '{}'\n".format(file_path, section)) + raise + except NoOptionError: + print("ERROR: Config file {} must contain item '{}' in section '{}'\n".format( + file_path, item, section)) + raise + return val + ############################################################################### def buildnml(rundir, bldnmldir): ############################################################################### @@ -63,25 +82,25 @@ def buildnml(rundir, bldnmldir): config = ConfigParser() config.read(file_path) - clm_phys = config.get('buildnml_input', 'clm_phys') - start_type = config.get('buildnml_input', 'start_type') - start_ymd = config.get('buildnml_input', 'start_ymd') - startfile_type = config.get('buildnml_input', 'startfile_type') - ignore = config.get('buildnml_input', 'ignore') - configuration = config.get('buildnml_input', 'configuration') - structure = config.get('buildnml_input', 'structure') - ccsm_co2_ppmv = config.get('buildnml_input', 'ccsm_co2_ppmv') - clm_co2_type = config.get('buildnml_input', 'clm_co2_type') - clm_bldnml_opts = config.get('buildnml_input', 'clm_bldnml_opts') - use_case = config.get('buildnml_input', 'use_case') - lnd_tuning_mode = config.get('buildnml_input', 'lnd_tuning_mode') - spinup = config.get('buildnml_input', 'spinup') - gridmask = config.get('buildnml_input', 'gridmask') - lnd_grid = config.get('buildnml_input', 'lnd_grid') - lnd_domain_file = config.get('buildnml_input', 'lnd_domain_file') - lnd_domain_path = config.get('buildnml_input', 'lnd_domain_path') - din_loc_root = config.get('buildnml_input', 'din_loc_root') - clm_namelist_opts = config.get('buildnml_input', 'clm_namelist_opts') + clm_phys = get_config_value(config, 'buildnml_input', 'clm_phys', file_path) + start_type = get_config_value(config, 'buildnml_input', 'start_type', file_path) + start_ymd = get_config_value(config, 'buildnml_input', 'start_ymd', file_path) + startfile_type = get_config_value(config, 'buildnml_input', 'startfile_type', file_path) + ignore = get_config_value(config, 'buildnml_input', 'ignore', file_path) + configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path) + structure = get_config_value(config, 'buildnml_input', 'structure', file_path) + ccsm_co2_ppmv = get_config_value(config, 'buildnml_input', 'ccsm_co2_ppmv', file_path) + clm_co2_type = get_config_value(config, 'buildnml_input', 'clm_co2_type', file_path) + clm_bldnml_opts = get_config_value(config, 'buildnml_input', 'clm_bldnml_opts', file_path) + use_case = get_config_value(config, 'buildnml_input', 'use_case', file_path) + lnd_tuning_mode = get_config_value(config, 'buildnml_input', 'lnd_tuning_mode', file_path) + spinup = get_config_value(config, 'buildnml_input', 'spinup', file_path) + gridmask = get_config_value(config, 'buildnml_input', 'gridmask', file_path) + lnd_grid = get_config_value(config, 'buildnml_input', 'lnd_grid', file_path) + lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) + lnd_domain_path = get_config_value(config, 'buildnml_input', 'lnd_domain_path', file_path) + din_loc_root = get_config_value(config, 'buildnml_input', 'din_loc_root', file_path) + clm_namelist_opts = get_config_value(config, 'buildnml_input', 'clm_namelist_opts', file_path) # create config_cache.xml file # Note that build-namelist utilizes the contents of the config_cache.xml file in From 6c9c8b5d8ea000f6ff26d5b094eec116ad034981 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 12 Feb 2020 12:56:36 -0700 Subject: [PATCH 0596/1973] error checking in TruncateCStates for comparing cnegcrit and -ccrit --- src/biogeochem/CNPrecisionControlMod.F90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 index 3162ff142b..2617dce9ac 100644 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ b/src/biogeochem/CNPrecisionControlMod.F90 @@ -739,6 +739,9 @@ subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, l SHR_ASSERT_ALL_FL((ubound(carbon_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(pc) == (/bounds%endp/)), sourcefile, __LINE__) + if ( -ccrit < cnegcrit )then + call endrun(msg='ERROR: cnegcrit should be less than -ccrit: '//errMsg(sourcefile, lineno)) + end if lcroponly = .false. if ( present(croponly) )then if ( croponly ) lcroponly = .true. From ef75e803be570c897b2e46adbbde64a6d63c4cd1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 13:14:24 -0700 Subject: [PATCH 0597/1973] Add -ignore_ic_year to build-namelist call This was being read from the config file but not actually passed to build-namelist. For now, we assume the use of -ignore_ic_year, NOT -ignore_ic_date. --- lilac/atm_driver/ctsm.cfg | 1 - lilac_config/buildnml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lilac/atm_driver/ctsm.cfg b/lilac/atm_driver/ctsm.cfg index a2e46981e7..9705e84a27 100644 --- a/lilac/atm_driver/ctsm.cfg +++ b/lilac/atm_driver/ctsm.cfg @@ -3,7 +3,6 @@ clm_phys = clm5_0 start_type = default start_ymd = 20000101 startfile_type = finidat -ignore = -ignore_ic_year configuration = clm structure = standard ccsm_co2_ppmv = 367.0 diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 4d90cb582f..6e40c9502a 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -86,7 +86,6 @@ def buildnml(rundir, bldnmldir): start_type = get_config_value(config, 'buildnml_input', 'start_type', file_path) start_ymd = get_config_value(config, 'buildnml_input', 'start_ymd', file_path) startfile_type = get_config_value(config, 'buildnml_input', 'startfile_type', file_path) - ignore = get_config_value(config, 'buildnml_input', 'ignore', file_path) configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path) structure = get_config_value(config, 'buildnml_input', 'structure', file_path) ccsm_co2_ppmv = get_config_value(config, 'buildnml_input', 'ccsm_co2_ppmv', file_path) @@ -123,6 +122,7 @@ def buildnml(rundir, bldnmldir): '-inputdata', os.path.join(rundir, "clm.input_data_list"), '-namelist', '&clm_inparm start_ymd={} {}/'.format(start_ymd, clm_namelist_opts), '-use_case',use_case, + '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date '-res', lnd_grid, '-clm_start_type', start_type, '-l_ncpl', str(1), # this will not be used in lilac - but is needed as input From a981e8ccfbee6b26809d29c69f9f86c1e81dfcfd Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 12 Feb 2020 14:03:04 -0700 Subject: [PATCH 0598/1973] Change to point to Naoki's branch rather than mine --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 9a62c22138..13d84a4054 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -29,7 +29,7 @@ required = True [mizuRoute] local_path = components/mizuRoute protocol = git -repo_url = https://github.com/ekluzek/mizuRoute +repo_url = https://github.com/nmizukami/mizuRoute branch = ctsm-coupling required = True From 2952c703d4ed6c80399279b164623205170ec168 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 14:46:42 -0700 Subject: [PATCH 0599/1973] Fix pylint issues --- lilac/atm_driver/ctsm.cfg | 1 - lilac_config/buildnml | 107 +++++++++++++++++++++----------------- 2 files changed, 60 insertions(+), 48 deletions(-) diff --git a/lilac/atm_driver/ctsm.cfg b/lilac/atm_driver/ctsm.cfg index 9705e84a27..3bea08674f 100644 --- a/lilac/atm_driver/ctsm.cfg +++ b/lilac/atm_driver/ctsm.cfg @@ -2,7 +2,6 @@ clm_phys = clm5_0 start_type = default start_ymd = 20000101 -startfile_type = finidat configuration = clm structure = standard ccsm_co2_ppmv = 367.0 diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 6e40c9502a..dc76f9bcb1 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -4,12 +4,15 @@ CTSM namelist creator """ -import sys, os, subprocess, argparse +import sys +import os +import subprocess +import argparse from configparser import ConfigParser from configparser import NoSectionError, NoOptionError -_config_cache_template = """ +_CONFIG_CACHE_TEMPLATE = """ @@ -17,10 +20,13 @@ _config_cache_template = """ """ -# Note the following is needed in env_lilac.xml otherwise the following error appears in the call to build_namelist -#err=ERROR : CLM build-namelist::CLMBuildNamelist::logical_to_fortran() : Unexpected value in logical_to_fortran: +# Note the following is needed in env_lilac.xml otherwise the following error appears in +# the call to build_namelist -_env_lilac_template = """ +#err=ERROR : CLM build-namelist::CLMBuildNamelist::logical_to_fortran() : +# Unexpected value in logical_to_fortran: + +_ENV_LILAC_TEMPLATE = """ @@ -32,13 +38,14 @@ _env_lilac_template = """ """ -_hack=object() - ############################################################################### def parse_command_line(args, description): ############################################################################### - parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=description) + """Parse the command line, return rundir""" + + parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, + description=description) parser.add_argument("--rundir", type=str, default=os.getcwd(), help="specify the full path of the run directory") @@ -47,7 +54,7 @@ def parse_command_line(args, description): # check if rundir exists if not os.path.isdir(arguments.rundir): - raise RuntimeError("rundir %s does not exist".format(arguments.rundir)) + raise RuntimeError("rundir {} does not exist".format(arguments.rundir)) return arguments.rundir @@ -74,70 +81,71 @@ def get_config_value(config, section, item, file_path): def buildnml(rundir, bldnmldir): ############################################################################### - """Build the ctsm namelist """ + """Build the ctsm namelist""" + + # pylint: disable=too-many-locals - file_path = os.path.join(rundir,'ctsm.cfg') + file_path = os.path.join(rundir, 'ctsm.cfg') # read the config file config = ConfigParser() config.read(file_path) - clm_phys = get_config_value(config, 'buildnml_input', 'clm_phys', file_path) - start_type = get_config_value(config, 'buildnml_input', 'start_type', file_path) - start_ymd = get_config_value(config, 'buildnml_input', 'start_ymd', file_path) - startfile_type = get_config_value(config, 'buildnml_input', 'startfile_type', file_path) - configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path) - structure = get_config_value(config, 'buildnml_input', 'structure', file_path) - ccsm_co2_ppmv = get_config_value(config, 'buildnml_input', 'ccsm_co2_ppmv', file_path) - clm_co2_type = get_config_value(config, 'buildnml_input', 'clm_co2_type', file_path) - clm_bldnml_opts = get_config_value(config, 'buildnml_input', 'clm_bldnml_opts', file_path) - use_case = get_config_value(config, 'buildnml_input', 'use_case', file_path) - lnd_tuning_mode = get_config_value(config, 'buildnml_input', 'lnd_tuning_mode', file_path) - spinup = get_config_value(config, 'buildnml_input', 'spinup', file_path) - gridmask = get_config_value(config, 'buildnml_input', 'gridmask', file_path) - lnd_grid = get_config_value(config, 'buildnml_input', 'lnd_grid', file_path) - lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) - lnd_domain_path = get_config_value(config, 'buildnml_input', 'lnd_domain_path', file_path) - din_loc_root = get_config_value(config, 'buildnml_input', 'din_loc_root', file_path) + clm_phys = get_config_value(config, 'buildnml_input', 'clm_phys', file_path) + start_type = get_config_value(config, 'buildnml_input', 'start_type', file_path) + start_ymd = get_config_value(config, 'buildnml_input', 'start_ymd', file_path) + configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path) + structure = get_config_value(config, 'buildnml_input', 'structure', file_path) + ccsm_co2_ppmv = get_config_value(config, 'buildnml_input', 'ccsm_co2_ppmv', file_path) + clm_co2_type = get_config_value(config, 'buildnml_input', 'clm_co2_type', file_path) + clm_bldnml_opts = get_config_value(config, 'buildnml_input', 'clm_bldnml_opts', file_path) + use_case = get_config_value(config, 'buildnml_input', 'use_case', file_path) + lnd_tuning_mode = get_config_value(config, 'buildnml_input', 'lnd_tuning_mode', file_path) + spinup = get_config_value(config, 'buildnml_input', 'spinup', file_path) + gridmask = get_config_value(config, 'buildnml_input', 'gridmask', file_path) + lnd_grid = get_config_value(config, 'buildnml_input', 'lnd_grid', file_path) + lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) + lnd_domain_path = get_config_value(config, 'buildnml_input', 'lnd_domain_path', file_path) + din_loc_root = get_config_value(config, 'buildnml_input', 'din_loc_root', file_path) clm_namelist_opts = get_config_value(config, 'buildnml_input', 'clm_namelist_opts', file_path) - # create config_cache.xml file - # Note that build-namelist utilizes the contents of the config_cache.xml file in + # create config_cache.xml file + # Note that build-namelist utilizes the contents of the config_cache.xml file in # the namelist_defaults.xml file to obtain namelist variables - config_cache = os.path.join(rundir, "config_cache.xml") - config_cache_text = _config_cache_template.format(clm_phys=clm_phys) + config_cache = os.path.join(rundir, "config_cache.xml") + config_cache_text = _CONFIG_CACHE_TEMPLATE.format(clm_phys=clm_phys) with open(config_cache, 'w') as tempfile: tempfile.write(config_cache_text) # create temporary env_lilac.xml env_lilac = os.path.join(rundir, "env_lilac.xml") - env_lilac_text = _env_lilac_template.format() + env_lilac_text = _ENV_LILAC_TEMPLATE.format() with open(env_lilac, 'w') as tempfile: tempfile.write(env_lilac_text) # call build-namelist - cmd = os.path.abspath(os.path.join(bldnmldir, os.pardir, "bld","build-namelist")) + cmd = os.path.abspath(os.path.join(bldnmldir, os.pardir, "bld", "build-namelist")) command = [cmd, - '-csmdata', din_loc_root, - '-inputdata', os.path.join(rundir, "clm.input_data_list"), + '-csmdata', din_loc_root, + '-inputdata', os.path.join(rundir, "clm.input_data_list"), '-namelist', '&clm_inparm start_ymd={} {}/'.format(start_ymd, clm_namelist_opts), - '-use_case',use_case, + '-use_case', use_case, '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date - '-res', lnd_grid, - '-clm_start_type', start_type, + '-res', lnd_grid, + '-clm_start_type', start_type, '-l_ncpl', str(1), # this will not be used in lilac - but is needed as input - '-configuration', configuration, + '-configuration', configuration, '-structure', structure, - '-lnd_frac', os.path.join(lnd_domain_path,lnd_domain_file), - '-glc_nec', str(10), + '-lnd_frac', os.path.join(lnd_domain_path, lnd_domain_file), + '-glc_nec', str(10), '-co2_ppmv', ccsm_co2_ppmv, - '-co2_type', clm_co2_type, + '-co2_type', clm_co2_type, '-clm_accelerated_spinup', spinup, - '-lnd_tuning_mode',lnd_tuning_mode, - '-config',os.path.join(rundir, "config_cache.xml"), + '-lnd_tuning_mode', lnd_tuning_mode, + '-config', os.path.join(rundir, "config_cache.xml"), '-envxml_dir', rundir] command.extend(clm_bldnml_opts.split()) - if gridmask != 'null' and gridmask != 'UNSET': + if gridmask not in ('null', 'UNSET'): command.extend(['-mask', gridmask]) subprocess.check_call(command, @@ -149,10 +157,15 @@ def buildnml(rundir, bldnmldir): os.remove(os.path.join(rundir, "drv_flds_in")) ############################################################################### +def main(): + """Main function""" -if __name__ == "__main__": rundir = parse_command_line(sys.argv[1:], __doc__) bldnmldir = os.path.dirname(os.path.abspath(__file__)) buildnml(rundir, bldnmldir) +############################################################################### + +if __name__ == "__main__": + main() From 7c29ebb6d6708ee2435bea9aa5cb1b02695f8146 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 15:04:47 -0700 Subject: [PATCH 0600/1973] For now, use -no-megan in lilac's buildnml Eventually we'll want more flexibility in this respect, but for now assume no-megan. See also https://github.com/ESCOMP/CTSM/issues/924. Note that this doesn't appear to actually change anything about lnd_in. --- lilac_config/buildnml | 1 + 1 file changed, 1 insertion(+) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index dc76f9bcb1..30c1ee6b2e 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -142,6 +142,7 @@ def buildnml(rundir, bldnmldir): '-co2_type', clm_co2_type, '-clm_accelerated_spinup', spinup, '-lnd_tuning_mode', lnd_tuning_mode, + '-no-megan', '-config', os.path.join(rundir, "config_cache.xml"), '-envxml_dir', rundir] command.extend(clm_bldnml_opts.split()) From c8b628a5a968f7017b74dc86beee2785e5b66b20 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 15:16:41 -0700 Subject: [PATCH 0601/1973] Remove any existing clm.input_data_list file Otherwise build-namelist keeps appending to the same file, leading to lots of duplicate entries if you rerun the script multiple times --- lilac_config/buildnml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 30c1ee6b2e..479e53bb34 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -123,11 +123,15 @@ def buildnml(rundir, bldnmldir): with open(env_lilac, 'w') as tempfile: tempfile.write(env_lilac_text) + # remove any existing clm.input_data_list file + inputdatalist_path = os.path.join(rundir, "clm.input_data_list") + os.remove(inputdatalist_path) + # call build-namelist cmd = os.path.abspath(os.path.join(bldnmldir, os.pardir, "bld", "build-namelist")) command = [cmd, '-csmdata', din_loc_root, - '-inputdata', os.path.join(rundir, "clm.input_data_list"), + '-inputdata', inputdatalist_path, '-namelist', '&clm_inparm start_ymd={} {}/'.format(start_ymd, clm_namelist_opts), '-use_case', use_case, '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date From 62b8d39a1a60964c87ca82e4849736c3bfd3f4ff Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 15:32:48 -0700 Subject: [PATCH 0602/1973] Fix cprnc command in readme --- README.lilac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.lilac b/README.lilac index dd3ee0e0fe..edaf916403 100644 --- a/README.lilac +++ b/README.lilac @@ -61,7 +61,7 @@ library (I), do the following: > basedir=/glade/p/cgd/tss/ctsm_baselines/lilac_20191202 > cprnc test_lilac.clm2.h0.2000-01-03-00000.nc $basedir/test_lilac.clm2.h0.2000-01-03-00000.nc | tail -30 > cprnc test_lilac.lilac.hi.2000-01-02-81000.nc $basedir/test_lilac.lilac.hi.2000-01-02-81000.nc | tail -30 - > cprnc test_lilac.atm.h0.0001-01.nc $basedir/test_lilac.atm.h0.0001-01.nc | tail -30 + > cprnc -m test_lilac.atm.h0.0001-01.nc $basedir/test_lilac.atm.h0.0001-01.nc | tail -30 5) if there are differences, and those are intentional, then create new baselines From d9701e03560215c362c7108ec6a383cab0417a9e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Feb 2020 16:55:55 -0700 Subject: [PATCH 0603/1973] Add some references to GitHub issues --- lilac_config/buildnml | 2 +- src/cpl/lilac/lnd_comp_esmf.F90 | 16 ++++++++++++++-- src/cpl/lilac/lnd_import_export.F90 | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 479e53bb34..5ce6010a3c 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -146,7 +146,7 @@ def buildnml(rundir, bldnmldir): '-co2_type', clm_co2_type, '-clm_accelerated_spinup', spinup, '-lnd_tuning_mode', lnd_tuning_mode, - '-no-megan', + '-no-megan', # Eventually make this dynamic (see https://github.com/ESCOMP/CTSM/issues/926) '-config', os.path.join(rundir, "config_cache.xml"), '-envxml_dir', rundir] command.extend(clm_bldnml_opts.split()) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 8068e6d42c..56d4ebc164 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -190,6 +190,8 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! TODO: by default iulog = 6 in clm_varctl - this should be generalized so that we ! can control the output log file for ctsm running with a lilac driver + ! + ! See also https://github.com/ESCOMP/CTSM/issues/861 inst_name = 'LND'; inst_index = 1; inst_suffix = "" @@ -212,6 +214,8 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! TODO: orbital values should be provided by lilac - but for now lets use defaults !! hard wire these these in and we can decide on maybe having a namelist/ + ! + ! See also https://github.com/ESCOMP/CTSM/issues/865 !call shr_cal_date2ymd(ymd,year,month,day) !orb_cyear = orb_iyear + (year - orb_iyear_align) @@ -501,6 +505,8 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else ! TODO: get this from the import state nextsw_cday attribute + ! + ! See also https://github.com/ESCOMP/CTSM/issues/860 end if ! Set nextsw_cday @@ -666,8 +672,12 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) dosend = .false. do while(.not. dosend) - ! TODO: This is currently hard-wired - is there a better way for nuopc? - ! Note that the model clock is updated at the end of the time step not at the beginning + ! We assume that the land model time step matches the coupling interval. However, + ! we still need this while loop to handle the initial time step (time 0). We may + ! want to get rid of this time step 0 in the lilac coupling, at which point we + ! should be able to remove this while loop and dosend variable. + ! + ! See also https://github.com/ESCOMP/CTSM/issues/925 nstep = get_nstep() if (nstep > 0) then dosend = .true. @@ -686,6 +696,8 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! TODO(NS): nextsw_cday should come directly from atmosphere! ! For now I am setting nextsw_cday to be the same caldayp1 + ! + ! See also https://github.com/ESCOMP/CTSM/issues/860 nextsw_cday = calday if (masterproc) then diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 5807d58a8c..d47069b63a 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -17,7 +17,7 @@ module lnd_import_export use lnd2glcMod , only : lnd2glc_type use atm2lndType , only : atm2lnd_type use lnd_shr_methods , only : chkerr - use shr_megan_mod , only : shr_megan_mechcomps_n ! TODO: need to add a namelist read nere + use shr_megan_mod , only : shr_megan_mechcomps_n ! TODO: need to add a namelist read here (see https://github.com/ESCOMP/CTSM/issues/926) implicit none private ! except From dd8c99c512e2e82713c4be778bc867e54c39c0b7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 13 Feb 2020 14:48:38 -0700 Subject: [PATCH 0604/1973] Remove some todo notes related to calendar By adding some print statements, I checked that both CTSM and lilac_atmaero use the calendar prescribed by atm_driver_in. --- lilac/src/lilac_mod.F90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 5b217f0298..0716416ece 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -154,9 +154,6 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & ! NOTE: the default calendar is set to GREGORIAN and is reset below in the initialization of ! the lilac clock - ! TODO: ensure that CTSM queries the lilac_clock for the calendar and initializes its own - ! internal clock accordingly - ! TODO: the same is true for the datm time manager that reads in prescribed data call ESMF_Initialize(mpiCommunicator=mpicom, defaultCalKind=ESMF_CALKIND_GREGORIAN, & logappendflag=.false., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return From 2a7fe085ccec28c598a1322e98efb6c4e0053f7a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 13 Feb 2020 14:52:21 -0700 Subject: [PATCH 0605/1973] Change 'and' to 'or' in time sync check --- src/cpl/lilac/lnd_comp_esmf.F90 | 2 +- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 56d4ebc164..fc7a7ba6b7 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -849,7 +849,7 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! Note that the driver clock has not been updated yet - so at this point ! CTSM is actually 1 coupling intervals ahead of the driver clock - if ( (ymd /= ymd_lilac) .and. (tod /= tod_lilac) ) then + if ( (ymd /= ymd_lilac) .or. (tod /= tod_lilac) ) then write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod write(iulog,*)'lilac ymd=',ymd_lilac,' lilac tod= ',tod_lilac rc = ESMF_FAILURE diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index df4919d10d..d3218c5b8d 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -889,7 +889,7 @@ subroutine ModelAdvance(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yr_sync, mon_sync, day_sync, ymd_sync) - if ( (ymd /= ymd_sync) .and. (tod /= tod_sync) ) then + if ( (ymd /= ymd_sync) .or. (tod /= tod_sync) ) then write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync rc = ESMF_FAILURE From b4212e284180fd8ed031357643a966af78e15aa5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 13 Feb 2020 15:03:37 -0700 Subject: [PATCH 0606/1973] Return after detecting clocks out of sync This follows the pattern of what is done elsewhere when setting rc = ESMF_FAILURE: we generally return immediately after doing that. --- src/cpl/lilac/lnd_comp_esmf.F90 | 3 ++- src/cpl/nuopc/lnd_comp_nuopc.F90 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index fc7a7ba6b7..5a8455b173 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -852,8 +852,9 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) if ( (ymd /= ymd_lilac) .or. (tod /= tod_lilac) ) then write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod write(iulog,*)'lilac ymd=',ymd_lilac,' lilac tod= ',tod_lilac - rc = ESMF_FAILURE call ESMF_LogWrite(subname//" CTSM clock not in sync with lilac clock",ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return end if !-------------------------------- diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index d3218c5b8d..4ee197c746 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -892,8 +892,9 @@ subroutine ModelAdvance(gcomp, rc) if ( (ymd /= ymd_sync) .or. (tod /= tod_sync) ) then write(iulog,*)'ctsm ymd=',ymd ,' ctsm tod= ',tod write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync - rc = ESMF_FAILURE call ESMF_LogWrite(subname//" CTSM clock not in sync with Master Sync clock",ESMF_LOGMSG_ERROR) + rc = ESMF_FAILURE + return end if !-------------------------------- From da5236a262ceab8cabb123bd6f81cad3a17db5cc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 19 Feb 2020 12:17:13 -0700 Subject: [PATCH 0607/1973] Apply changes from release-clm5.0.11 to release-clm5.0.12 --- bld/CLMBuildNamelist.pm | 5 +- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- cime_config/config_compsets.xml | 5 ++ cime_config/testdefs/testlist_clm.xml | 62 ++++++------------- doc/ChangeSum | 1 + 5 files changed, 30 insertions(+), 45 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index d4131a5d08..2bca486908 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2286,10 +2286,11 @@ sub setup_logic_initial_conditions { my $try = 0; my $done = 2; my $use_init_interp_default = $nl->get_value($useinitvar); + $settings{$useinitvar} = $use_init_interp_default; if ( string_is_undef_or_empty( $use_init_interp_default ) ) { - $use_init_interp_default = ".false."; + $use_init_interp_default = $defaults->get_value($useinitvar, \%settings); + $settings{$useinitvar} = ".false."; } - $settings{$useinitvar} = $use_init_interp_default; do { $try++; add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, %settings ); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 462be23234..fb323a51cc 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -506,7 +506,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 75 -1850,2000 +1850,2000,2010 .true. diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 9fd6766669..7468801ac0 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -65,6 +65,11 @@ 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_RTM_SGLC_SWAV
    + + I2010Clm50Sp + 2010_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + I2000Clm50BgcCru 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 03c66ecd08..e1d621cef9 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -91,6 +91,7 @@ + @@ -120,7 +121,7 @@ - + @@ -177,14 +178,6 @@ - - - - - - - - @@ -203,14 +196,6 @@ - - - - - - - - @@ -219,14 +204,6 @@ - - - - - - - - @@ -339,7 +316,6 @@ - @@ -462,6 +438,7 @@ + @@ -510,8 +487,9 @@ - + + @@ -922,13 +900,6 @@ - - - - - - - @@ -1073,23 +1044,17 @@ + - - - - - - - - + @@ -1106,6 +1071,7 @@ + @@ -1140,6 +1106,14 @@ + + + + + + + + @@ -1237,6 +1211,7 @@ + @@ -1320,6 +1295,7 @@ + @@ -1494,6 +1470,7 @@ + @@ -1646,6 +1623,7 @@ + diff --git a/doc/ChangeSum b/doc/ChangeSum index 34e896932f..6b696d986d 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -17,6 +17,7 @@ release-clm5.0.16 erik 01/15/2019 PtVg and ssp_rcp future scenario options an release-clm5.0.15 sacks 12/06/2018 SKIPPED ON MASTER -- Option for rain-to-snow release-clm5.0.14 erik 11/29/2018 Update cime and fix surface dataset for f05 1850 non-crop case release-clm5.0.13 erik 11/14/2018 Update externals with new CO2/presearo/rtm/mosart, add science_support, change testing +release-clm5.0.12 erik 11/03/2018 New IC files for clm45/clm50 coupled cases, add 2010 compset (IC FILES UPDATE SKIPPED ON MASTER) ctsm1.0.dev080 sacks 12/02/2019 Update externals, minor fixes to work with latest cime, get nuopc cap working ctsm1.0.dev079 sacks 11/04/2019 Change a few uses of shr_kind ctsm1.0.dev078 oleson 10/31/2019 Fix rootr calculation with use_hydrstress true From eb004f686aa6bf7470acc046911ea5a955a236f1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 19 Feb 2020 13:07:00 -0700 Subject: [PATCH 0608/1973] Add some more changes from release-clm5.0.20 that didn't seem to make it in --- bld/CLMBuildNamelist.pm | 16 ++--- .../namelist_defaults_overall.xml | 16 ++++- bld/namelist_files/use_cases/1850_control.xml | 2 - .../use_cases/1850_noanthro_control.xml | 1 - bld/unit_testers/build-namelist_test.pl | 2 +- cime_config/config_component.xml | 19 +++-- cime_config/config_compsets.xml | 44 +++++++++++- .../clm/glcMEC_spunup_1way/user_nl_clm | 2 +- src/biogeochem/CNVegCarbonStateType.F90 | 9 +-- src/biogeochem/ch4Mod.F90 | 70 +++---------------- src/biogeophys/WaterFluxBulkType.F90 | 7 ++ src/biogeophys/WaterFluxType.F90 | 7 -- tools/mksurfdata_map/Makefile.data | 69 ++++++++++++++++-- 13 files changed, 164 insertions(+), 100 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index d4131a5d08..535dc59304 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3104,16 +3104,12 @@ sub setup_logic_nitrogen_deposition { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndepmapalgo', 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, 'hgrid'=>$nl_flags->{'res'}, 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); - if ( defined($opts->{'use_case'}) ) { - if ( ($nl_flags->{'lnd_tuning_mode'} =~ /clm5_0_cam/) && ($opts->{'use_case'} eq "1850_control") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndep_taxmode', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, - 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndep_varlist', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, - 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} ); - } - } + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndep_taxmode', 'phys'=>$nl_flags->{'phys'}, + 'use_cn'=>$nl_flags->{'use_cn'}, + 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndep_varlist', 'phys'=>$nl_flags->{'phys'}, + 'use_cn'=>$nl_flags->{'use_cn'}, + 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} ); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_ndep', 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index 1e6b0f08e2..b85454fb94 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -13,14 +13,26 @@ determine default values for namelists. --> -startup -startup +startup +startup +startup +startup +arb_ic +arb_ic arb_ic arb_ic arb_ic arb_ic cold +arb_ic + + + +flanduse_timeseries +flanduse_timeseries + + /fs/cgd/csm/inputdata diff --git a/bld/namelist_files/use_cases/1850_control.xml b/bld/namelist_files/use_cases/1850_control.xml index 3a0c39af38..501d734129 100644 --- a/bld/namelist_files/use_cases/1850_control.xml +++ b/bld/namelist_files/use_cases/1850_control.xml @@ -37,6 +37,4 @@ cycle -NDEP_month - diff --git a/bld/namelist_files/use_cases/1850_noanthro_control.xml b/bld/namelist_files/use_cases/1850_noanthro_control.xml index 971b0cf410..cc0cc66ccf 100644 --- a/bld/namelist_files/use_cases/1850_noanthro_control.xml +++ b/bld/namelist_files/use_cases/1850_noanthro_control.xml @@ -23,7 +23,6 @@ 1850 cycle -NDEP_month 1925 1925 diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 559968c3b3..fa456ef89f 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -304,7 +304,7 @@ sub make_config_cache { ) { my $file = $startfile; &make_env_run(); - eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; + eval{ system( "$bldnml -res 0.9x1.25 -envxml_dir . $options > $tempfile 2>&1 " ); }; is( $@, '', "options: $options" ); $cfiles->checkfilesexist( "$options", $mode ); $cfiles->shownmldiff( "default", $mode ); diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index cd17948726..388fcd88ee 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -121,18 +121,23 @@ char UNSET - + 2010_control 2000_control 1850_control 1850_noanthro_control 20thC_transient - 1850-2100_rcp6_transient - 1850-2100_rcp4.5_transient - 1850-2100_rcp2.6_transient - 1850-2100_rcp8.5_transient - 20thC_transient - 1850-2100_rcp4.5_transient + 1850-2100_SSP5-8.5_transient + 1850-2100_SSP1-2.6_transient + 1850-2100_SSP3-7.0_transient + 1850-2100_SSP5-3.4_transient + 1850-2100_SSP2-4.5_transient + 1850-2100_SSP1-1.9_transient + 1850-2100_SSP4-3.4_transient + 1850-2100_SSP4-6.0_transient + 1850-2100_SSP5-8.5_transient + 20thC_transient + 1850-2100_SSP5-8.5_transient run_component_clm env_run.xml diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 9fd6766669..b03cfa649b 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -12,7 +12,7 @@ The notation for the compset longname is TIME_ATM[%phys]_LND[%phys]_ICE[%phys]_OCN[%phys]_ROF[%phys]_GLC[%phys]_WAV[%phys][_BGC%phys] Where for the CAM specific compsets below the following is supported - TIME = Time period (e.g. 2000, HIST, RCP8...) + TIME = Time period (e.g. 2000, HIST, SSP585...) ATM = [CAM40, CAM50, CAM55] LND = [CLM45, CLM50, SLND] ICE = [CICE, DICE, SICE] @@ -246,6 +246,47 @@ HIST_DATM%QIA_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV + + + ISSP585Clm50BgcCrop + SSP585_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + ISSP126Clm50BgcCrop + SSP126_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + ISSP119Clm50BgcCrop + SSP119_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + ISSP245Clm50BgcCrop + SSP245_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + ISSP370Clm50BgcCrop + SSP370_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + ISSP434Clm50BgcCrop + SSP434_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + ISSP460Clm50BgcCrop + SSP460_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + + + ISSP534Clm50BgcCrop + SSP534_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + -lnd/clm2/paramdata/fates_params_default_2trop.c190114.nc +lnd/clm2/paramdata/fates_params_api.8.0.0_12pft_c191216.nc diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index b85454fb94..d147e2e9f0 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -54,9 +54,8 @@ determine default values for namelists. constant - -1 -0 + +0 1 diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index d12defc385..3209505820 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -81,6 +81,27 @@
    + + + FAIL + NGEET/fates#510 + + + + + + FAIL + NGEET/fates#508 + + + + + + FAIL + NGEET/fates#508 + + + FAIL diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index e1d621cef9..ace8d97736 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1896,6 +1896,7 @@ + @@ -1923,7 +1924,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm index 487ad09863..e7f1e272d1 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm @@ -3,9 +3,11 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .true. use_fates_spitfire= .true. -hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', +hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN_ELEM','LITTER_OUT_ELEM', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC','NPLANT_SCAG','NPLANT_SCPF', - 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' + 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', + 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN', + 'LITTER_FINES_AG_ELEM','LITTER_FINES_BG_ELEM','LITTER_CWD_AG_ELEM','LITTER_CWD_BG_ELEM', + 'SEED_BANK' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm index a869310636..d7c9b447a4 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm @@ -28,4 +28,6 @@ hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE',' 'STORAGE_FLUX_UNDERSTORY_SCLS','NPP_LEAF_UNDERSTORY_SCLS','NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS', 'NPP_BDEAD_UNDERSTORY_SCLS','NPP_BSEED_UNDERSTORY_SCLS','NPP_STORE_UNDERSTORY_SCLS','RDARK_UNDERSTORY_SCLS', 'LIVESTEM_MR_UNDERSTORY_SCLS','LIVECROOT_MR_UNDERSTORY_SCLS','FROOT_MR_UNDERSTORY_SCLS','RESP_G_UNDERSTORY_SCLS', - 'RESP_M_UNDERSTORY_SCLS' + 'RESP_M_UNDERSTORY_SCLS','LITTER_IN_ELEM','LITTER_OUT_ELEM','SEED_BANK_ELEM','SEEDS_IN_LOCAL_ELEM','SEEDS_IN_EXTERN_ELEM', + 'SEED_GERM_ELEM','SEED_DECAY','CBALANCE_ERROR_FATES','ERROR_FATES','LITTER_FINES_AG_ELEM','LITTER_FINES_BG_ELEM','LITTER_CWD_BG_ELEM', + 'LITTER_CWD_AG_ELEM','LITTER_CWD' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm index 144569c412..25c9d2a116 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm @@ -2,5 +2,5 @@ hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT' 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC','NPLANT_SCAG','NPLANT_SCPF', + 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm index f9d31eecbb..fc057c0be3 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm @@ -2,4 +2,4 @@ hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT' 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC' + 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR' diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/include_user_mods new file mode 100644 index 0000000000..fe0e18cf88 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/include_user_mods @@ -0,0 +1 @@ +../default diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/shell_commands new file mode 100644 index 0000000000..19326795bb --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/shell_commands @@ -0,0 +1,4 @@ +#!/bin/bash + +./xmlchange LND_TUNING_MODE="clm5_0_cam6.0" + diff --git a/doc/ChangeSum b/doc/ChangeSum index 6b696d986d..7dda763077 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ +release-clm5.0.30 erik 01/21/2020 Update FATES to sci.1.30.0_api.8.0.0 release-clm5.0.29 erik 11/19/2019 Some answer changes needed for prescribed soil-moisture and clm4_5 defaults (1850-ndep, and urbantv settings) release-clm5.0.28 erik 11/14/2019 Several bit-for-bit fixes especially around soil-moisture streams release-clm5.0.27 erik 08/13/2019 Add presoribed soil moisture streams as an option, and a few fixes diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 25125eb071..cb68d92aec 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -22,7 +22,6 @@ module CanopyFluxesMod use ActiveLayerMod , only : active_layer_type use PhotosynthesisMod , only : Photosynthesis, PhotoSynthesisHydraulicStress, PhotosynthesisTotal, Fractionation use EDAccumulateFluxesMod , only : AccumulateFluxes_ED - use EDBtranMod , only : btran_ed use SoilMoistStressMod , only : calc_effective_soilporosity, calc_volumetric_h2oliq use SoilMoistStressMod , only : calc_root_moist_stress, set_perchroot_opt use SimpleMathMod , only : array_div_vector diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 5548ed0211..3b1e22f9a5 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -358,7 +358,9 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & g = col%gridcell(c) ig = g_to_ig(g) - if ( (lun%itype(col%landunit(c)) == istsoil) .or. (lun%itype(col%landunit(c)) == istcrop) ) then + ! EBK Jan/2020, also check weights on gridcell (See https://github.com/ESCOMP/CTSM/issues/847) + if ( (lun%itype(col%landunit(c)) == istsoil) .or. (lun%itype(col%landunit(c)) == istcrop) .and. & + (col%wtgcell(c) /= 0._r8) ) then ! this is a 2d field (gridcell/nlevsoi) ! do j = 1, nlevsoi diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index d1bc292f74..526543b6be 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -25,7 +25,9 @@ module histFileMod use EDTypesMod , only : nlevleaf use FatesInterfaceMod , only : nlevsclass, nlevage use FatesInterfaceMod , only : nlevheight - use EDTypesMod , only : nfsc, ncwd + use EDTypesMod , only : nfsc + use FatesLitterMod , only : ncwd + use EDTypesMod , only : num_elements_fates => num_elements use FatesInterfaceMod , only : maxveg_fates => numpft use ncdio_pio @@ -196,6 +198,9 @@ module histFileMod integer :: beg1d_out ! on-node 1d hbuf pointer start index integer :: end1d_out ! on-node 1d hbuf pointer end index integer :: num1d_out ! size of hbuf first dimension (all nodes) + integer :: numdims ! the actual number of dimensions, this allows + ! for 2D arrays, where the second dimension is allowed + ! to be 1 integer :: num2d ! size of hbuf second dimension (e.g. number of vertical levels) integer :: hpindex ! history pointer index character(len=scale_type_strlen) :: p2c_scale_type ! scale factor when averaging patch to column @@ -316,7 +321,7 @@ subroutine hist_printflds() end subroutine hist_printflds !----------------------------------------------------------------------- - subroutine masterlist_addfld (fname, type1d, type1d_out, & + subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & type2d, num2d, units, avgflag, long_name, hpindex, & p2c_scale_type, c2l_scale_type, l2g_scale_type, & no_snow_behavior) @@ -332,6 +337,7 @@ subroutine masterlist_addfld (fname, type1d, type1d_out, & ! ! !ARGUMENTS: character(len=*), intent(in) :: fname ! field name + integer , intent(in) :: numdims ! number of dimensions character(len=*), intent(in) :: type1d ! 1d data type character(len=*), intent(in) :: type1d_out ! 1d output type character(len=*), intent(in) :: type2d ! 2d output type @@ -410,6 +416,7 @@ subroutine masterlist_addfld (fname, type1d, type1d_out, & masterlist(f)%field%type1d = type1d masterlist(f)%field%type1d_out = type1d_out masterlist(f)%field%type2d = type2d + masterlist(f)%field%numdims = numdims masterlist(f)%field%num2d = num2d masterlist(f)%field%hpindex = hpindex masterlist(f)%field%p2c_scale_type = p2c_scale_type @@ -1057,17 +1064,20 @@ subroutine hist_update_hbuf(bounds) integer :: t ! tape index integer :: f ! field index integer :: num2d ! size of second dimension (e.g. number of vertical levels) + integer :: numdims ! number of dimensions character(len=*),parameter :: subname = 'hist_update_hbuf' character(len=hist_dim_name_length) :: type2d ! hbuf second dimension type ["levgrnd","levlak","numrad","ltype","natpft","cft","glc_nec","elevclas","subname(n)"] !----------------------------------------------------------------------- do t = 1,ntapes -!$OMP PARALLEL DO PRIVATE (f, num2d) +!$OMP PARALLEL DO PRIVATE (f, num2d, numdims) do f = 1,tape(t)%nflds - num2d = tape(t)%hlist(f)%field%num2d - if ( num2d == 1) then + numdims = tape(t)%hlist(f)%field%numdims + + if ( numdims == 1) then call hist_update_hbuf_field_1d (t, f, bounds) else + num2d = tape(t)%hlist(f)%field%num2d call hist_update_hbuf_field_2d (t, f, bounds, num2d) end if end do @@ -2071,6 +2081,10 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'fates_levcan', nclmax, dimid) call ncd_defdim(lnfid, 'fates_levcnlf', nlevleaf * nclmax, dimid) call ncd_defdim(lnfid, 'fates_levcnlfpf', nlevleaf * nclmax * maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levelem', num_elements_fates, dimid) + call ncd_defdim(lnfid, 'fates_levelpft', num_elements_fates * maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levelcwd', num_elements_fates * ncwd, dimid) + call ncd_defdim(lnfid, 'fates_levelage', num_elements_fates * nlevage, dimid) end if if ( .not. lhistrest )then @@ -2505,6 +2519,15 @@ subroutine htape_timeconst(t, mode) use FatesInterfaceMod, only : fates_hdim_canmap_levcnlfpf use FatesInterfaceMod, only : fates_hdim_lfmap_levcnlfpf use FatesInterfaceMod, only : fates_hdim_pftmap_levcnlfpf + use FatesInterfaceMod, only : fates_hdim_levelem + use FatesInterfaceMod, only : fates_hdim_elmap_levelpft + use FatesInterfaceMod, only : fates_hdim_pftmap_levelpft + use FatesInterfaceMod, only : fates_hdim_elmap_levelcwd + use FatesInterfaceMod, only : fates_hdim_cwdmap_levelcwd + use FatesInterfaceMod, only : fates_hdim_elmap_levelage + use FatesInterfaceMod, only : fates_hdim_agemap_levelage + + ! ! !ARGUMENTS: integer, intent(in) :: t ! tape index @@ -2601,6 +2624,20 @@ subroutine htape_timeconst(t, mode) long_name='FATES pft map into patch age x pft', units='-', ncid=nfid(t)) call ncd_defvar(varname='fates_agmap_levagepft', xtype=ncd_int, dim1name='fates_levagepft', & long_name='FATES age-class map into patch age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_levelem',xtype=ncd_int, dim1name='fates_levelem', & + long_name='FATES element (C,N,P,...) identifier', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_elmap_levelpft', xtype=ncd_int, dim1name='fates_levelpft', & + long_name='FATES element map into element x pft ', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_pftmap_levelpft', xtype=ncd_int, dim1name='fates_levelpft', & + long_name='FATES pft map into element x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_elmap_levelcwd', xtype=ncd_int, dim1name='fates_levelcwd', & + long_name='FATES element map into element x cwd', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_cwdmap_levelcwd', xtype=ncd_int, dim1name='fates_levelcwd', & + long_name='FATES cwd map into element x cwd', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_elmap_levelage', xtype=ncd_int, dim1name='fates_levelage', & + long_name='FATES element map into age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_agemap_levelage', xtype=ncd_int, dim1name='fates_levelage', & + long_name='FATES element map into age x pft', units='-', ncid=nfid(t)) end if @@ -2636,7 +2673,14 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='fates_agmap_levscagpft',data=fates_hdim_agmap_levscagpft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levscagpft',data=fates_hdim_pftmap_levscagpft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levagepft',data=fates_hdim_pftmap_levagepft, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_agmap_levagepft',data=fates_hdim_agmap_levagepft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_agmap_levagepft',data=fates_hdim_agmap_levagepft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_levelem',data=fates_hdim_levelem, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_elmap_levelpft',data=fates_hdim_elmap_levelpft, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_pftmap_levelpft',data=fates_hdim_pftmap_levelpft, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_elmap_levelcwd',data=fates_hdim_elmap_levelcwd, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_cwdmap_levelcwd',data=fates_hdim_cwdmap_levelcwd, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_elmap_levelage',data=fates_hdim_elmap_levelage, ncid=nfid(t),flag='write') + call ncd_io(varname='fates_agemap_levelage',data=fates_hdim_agemap_levelage, ncid=nfid(t),flag='write') end if endif @@ -2882,6 +2926,7 @@ subroutine hfields_write(t, mode) integer :: num2d ! hbuf second dimension size integer :: nt ! time index integer :: ier ! error status + integer :: numdims ! number of dimensions character(len=avgflag_strlen) :: avgflag ! time averaging flag character(len=max_chars) :: long_name! long name character(len=max_chars) :: units ! units @@ -2925,6 +2970,7 @@ subroutine hfields_write(t, mode) end1d_out = tape(t)%hlist(f)%field%end1d_out num1d_out = tape(t)%hlist(f)%field%num1d_out type2d = tape(t)%hlist(f)%field%type2d + numdims = tape(t)%hlist(f)%field%numdims num2d = tape(t)%hlist(f)%field%num2d nt = tape(t)%ntimes @@ -2957,7 +3003,7 @@ subroutine hfields_write(t, mode) endif if (dim2name == 'undefined') then - if (num2d == 1) then + if (numdims == 1) then call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & dim1name=dim1name, dim2name='time', & long_name=long_name, units=units, cell_method=avgstr, & @@ -2969,7 +3015,7 @@ subroutine hfields_write(t, mode) missing_value=spval, fill_value=spval) end if else - if (num2d == 1) then + if (numdims == 1) then call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & dim1name=dim1name, dim2name=dim2name, dim3name='time', & long_name=long_name, units=units, cell_method=avgstr, & @@ -2990,7 +3036,7 @@ subroutine hfields_write(t, mode) ! Allocate dynamic memory - if (num2d == 1) then + if (numdims == 1) then allocate(hist1do(beg1d_out:end1d_out), stat=ier) if (ier /= 0) then write(iulog,*) trim(subname),' ERROR: allocation' @@ -3001,7 +3047,7 @@ subroutine hfields_write(t, mode) ! Write history output. Always output land and ocean runoff on xy grid. - if (num2d == 1) then + if (numdims == 1) then call ncd_io(flag='write', varname=varname, & dim1name=type1d_out, data=hist1do, ncid=nfid(t), nt=nt) else @@ -3012,7 +3058,7 @@ subroutine hfields_write(t, mode) ! Deallocate dynamic memory - if (num2d == 1) then + if (numdims == 1) then deallocate(hist1do) end if @@ -4755,10 +4801,11 @@ subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & ! Add field to masterlist - call masterlist_addfld (fname=trim(fname), type1d=l_type1d, type1d_out=l_type1d_out, & - type2d='unset', num2d=1, & - units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, l2g_scale_type=scale_type_l2g) + call masterlist_addfld (fname=trim(fname), numdims=1, type1d=l_type1d, & + type1d_out=l_type1d_out, type2d='unset', num2d=1, & + units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & + p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & + l2g_scale_type=scale_type_l2g) l_default = 'active' if (present(default)) then @@ -4901,6 +4948,14 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, num2d = max_lunit case ('natpft') num2d = natpft_size + case ('fates_levelem') + num2d = num_elements_fates + case ('fates_levelpft') + num2d = num_elements_fates*numpft_fates + case ('fates_levelcwd') + num2d = num_elements_fates*ncwd + case ('fates_levelage') + num2d = num_elements_fates*nlevage case('cft') if (cft_size > 0) then num2d = cft_size @@ -5062,12 +5117,12 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, ! Add field to masterlist - call masterlist_addfld (fname=trim(fname), type1d=l_type1d, type1d_out=l_type1d_out, & - type2d=type2d, num2d=num2d, & - units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, l2g_scale_type=scale_type_l2g, & - no_snow_behavior=no_snow_behavior) - + call masterlist_addfld (fname=trim(fname), numdims=2, type1d=l_type1d, & + type1d_out=l_type1d_out, type2d=type2d, num2d=num2d, & + units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & + p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & + l2g_scale_type=scale_type_l2g, no_snow_behavior=no_snow_behavior) + l_default = 'active' if (present(default)) then l_default = default diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 7ebf6d92e3..dab61587ef 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -110,8 +110,8 @@ module CLMFatesInterfaceMod use FatesHistoryInterfaceMod, only : fates_history_interface_type use FatesRestartInterfaceMod, only : fates_restart_interface_type - use ChecksBalancesMod , only : SummarizeNetFluxes, FATES_BGC_Carbon_BalanceCheck use EDTypesMod , only : ed_patch_type + use EDTypesMod , only : num_elements use FatesInterfaceMod , only : hlm_numlevgrnd use EDMainMod , only : ed_ecosystem_dynamics use EDMainMod , only : ed_update_site @@ -126,7 +126,7 @@ module CLMFatesInterfaceMod use EDCanopyStructureMod , only : canopy_summarization, update_hlm_dynamics use FatesPlantRespPhotosynthMod, only : FatesPlantRespPhotosynthDrive use EDAccumulateFluxesMod , only : AccumulateFluxes_ED - use EDPhysiologyMod , only : flux_into_litter_pools + use EDPhysiologyMod , only : FluxIntoLitterPools use FatesPlantHydraulicsMod, only : hydraulics_drive use FatesPlantHydraulicsMod, only : HydrSiteColdStart use FatesPlantHydraulicsMod, only : InitHydrSites @@ -691,7 +691,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! call subroutine to aggregate fates litter output fluxes and ! package them for handing across interface - call flux_into_litter_pools(this%fates(nc)%nsites, & + call FluxIntoLitterPools(this%fates(nc)%nsites, & this%fates(nc)%sites, & this%fates(nc)%bc_in, & this%fates(nc)%bc_out) @@ -712,11 +712,14 @@ subroutine dynamics_driv(this, nc, bounds_clump, & nld_si = this%fates(nc)%bc_in(s)%nlevdecomp soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lab_c_col(c,1:nld_si) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_lab_c_col(1:nld_si) + this%fates(nc)%bc_out(s)%litt_flux_lab_c_si(1:nld_si) + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_cel_c_col(c,1:nld_si) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_cel_c_col(1:nld_si) + this%fates(nc)%bc_out(s)%litt_flux_cel_c_si(1:nld_si) + soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lig_c_col(c,1:nld_si) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_lig_c_col(1:nld_si) + this%fates(nc)%bc_out(s)%litt_flux_lig_c_si(1:nld_si) + end do @@ -1227,11 +1230,12 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & call get_clump_bounds(nc, bounds_clump) do s = 1,this%fates(nc)%nsites - call init_site_vars(this%fates(nc)%sites(s)) + call init_site_vars(this%fates(nc)%sites(s),this%fates(nc)%bc_in(s) ) call zero_site(this%fates(nc)%sites(s)) end do - call set_site_properties(this%fates(nc)%nsites, this%fates(nc)%sites) + call set_site_properties(this%fates(nc)%nsites, & + this%fates(nc)%sites) ! ---------------------------------------------------------------------------- ! Initialize Hydraulics Code if turned on @@ -1299,7 +1303,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & end if end do !$OMP END PARALLEL DO - + end subroutine init_coldstart ! ====================================================================================== @@ -1861,9 +1865,6 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & type(soilbiogeochem_carbonstate_type), intent(in) :: soilbiogeochem_carbonstate_inst ! locals - real(r8) :: dtime - integer :: nstep - logical :: is_beg_day integer :: s,c associate(& @@ -1879,29 +1880,14 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & this%fates(nc)%bc_in(s)%tot_litc = totlitc(c) end do - is_beg_day = is_beg_curr_day() - dtime = get_step_size_real() - nstep = get_nstep() - - call SummarizeNetFluxes(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - is_beg_day) - - call FATES_BGC_Carbon_Balancecheck(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - is_beg_day, & - dtime, nstep) - ! Update history variables that track these variables call this%fates_hist%update_history_cbal(nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites) + this%fates(nc)%nsites, & + this%fates(nc)%sites, & + this%fates(nc)%bc_in) - end associate end subroutine wrap_bgc_summary @@ -1957,7 +1943,8 @@ subroutine init_history_io(this,bounds_proc) use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8 use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 - use FatesIOVariableKindMod, only : site_height_r8 + use FatesIOVariableKindMod, only : site_height_r8, site_elem_r8, site_elpft_r8 + use FatesIOVariableKindMod, only : site_elcwd_r8, site_elage_r8 use FatesIODimensionsMod, only : fates_bounds_type @@ -2078,152 +2065,29 @@ subroutine init_history_io(this,bounds_proc) default=trim(vdefault), & set_lake=0._r8,set_urb=0._r8) - case(patch_ground_r8) + case(patch_ground_r8, patch_size_pft_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index dim2name = this%fates_hist%dim_bounds(d_index)%name call hist_addfld2d(fname=trim(vname),units=trim(vunits), & ! <--- addfld2d type2d=trim(dim2name), & ! <--- type2d avgflag=trim(vavgflag),long_name=trim(vlong), & ptr_patch=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) + default=trim(vdefault)) - case(patch_size_pft_r8) + case(site_ground_r8, site_size_pft_r8, site_size_r8, site_pft_r8, & + site_age_r8, site_height_r8, site_fuel_r8, site_cwdsc_r8, & + site_can_r8,site_cnlf_r8, site_cnlfpft_r8, site_scag_r8, & + site_scagpft_r8, site_agepft_r8, site_elem_r8, site_elpft_r8, & + site_elcwd_r8, site_elage_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index dim2name = this%fates_hist%dim_bounds(d_index)%name call hist_addfld2d(fname=trim(vname),units=trim(vunits), & type2d=trim(dim2name), & avgflag=trim(vavgflag),long_name=trim(vlong), & ptr_patch=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_ground_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_size_pft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_size_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_pft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_age_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_height_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_fuel_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cwdsc_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_can_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cnlf_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cnlfpft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_scag_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - - case(site_scagpft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_agepft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) + default=trim(vdefault)) case default @@ -2262,6 +2126,27 @@ subroutine init_soil_depths(this, nc) this%fates(nc)%bc_in(s)%z_sisl(1:nlevsoil) = col%z(c,1:nlevsoil) this%fates(nc)%bc_in(s)%dz_decomp_sisl(1:nlevdecomp) = & dzsoi_decomp(1:nlevdecomp) + + if (use_vertsoilc) then + do j=1,nlevsoil + this%fates(nc)%bc_in(s)%decomp_id(j) = j + ! Check to make sure that dz = dz_decomp_sisl when vertical soil dynamics + ! are active + if(abs(this%fates(nc)%bc_in(s)%dz_decomp_sisl(j)-this%fates(nc)%bc_in(s)%dz_sisl(j))>1.e-10_r8)then + write(iulog,*) 'when vertical soil decomp dynamics are on' + write(iulog,*) 'fates assumes that the decomposition depths equal the soil depths' + write(iulog,*) 'layer: ',j + write(iulog,*) 'dz_decomp_sisl(j): ',this%fates(nc)%bc_in(s)%dz_decomp_sisl(j) + write(iulog,*) 'dz_sisl(j): ',this%fates(nc)%bc_in(s)%dz_sisl(j) + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + end do + else + do j=1,nlevsoil + this%fates(nc)%bc_in(s)%decomp_id(j) = 1 + end do + end if + end do return @@ -2448,10 +2333,11 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) use FatesIODimensionsMod, only : fates_bounds_type use FatesInterfaceMod, only : nlevsclass, nlevage use FatesInterfaceMod, only : nlevheight - use EDtypesMod, only : nfsc, ncwd - use EDtypesMod, only : nlevleaf, nclmax + use EDtypesMod, only : nfsc + use FatesLitterMod, only : ncwd + use EDtypesMod, only : nlevleaf, nclmax use FatesInterfaceMod, only : maxveg_ed => numpft - use clm_varpar, only : nlevgrnd + use clm_varpar, only : nlevgrnd implicit none @@ -2508,6 +2394,19 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%cnlfpft_begin = 1 fates%cnlfpft_end = nlevleaf * nclmax * maxveg_ed + + fates%elem_begin = 1 + fates%elem_end = num_elements + + fates%elpft_begin = 1 + fates%elpft_end = num_elements * numpft_fates + + fates%elcwd_begin = 1 + fates%elcwd_end = num_elements * ncwd + + fates%elage_begin = 1 + fates%elage_end = num_elements * nlevage + end subroutine hlm_bounds_to_fates_bounds diff --git a/test/tools/test_driver.sh b/test/tools/test_driver.sh index 39b945fcdc..0cd322b9d2 100755 --- a/test/tools/test_driver.sh +++ b/test/tools/test_driver.sh @@ -40,15 +40,15 @@ input_file="tests_pretag_cheyenne_nompi" c_threads=36 -export INITMODULES="/glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/sh" +export INITMODULES="/glade/u/apps/ch/opt/lmod/8.1.7/lmod/lmod/init/sh" . \$INITMODULES module purge -module load ncarenv/1.0 -module load intel/17.0.1 +module load ncarenv +module load intel module load mkl -module load ncarcompilers/0.3.5 -module load netcdf/4.4.1.1 +module load ncarcompilers +module load netcdf module load nco module load python @@ -88,7 +88,7 @@ EOF ;; ## DAV cluster - geyser* | caldera* | pronghorn*) + casper* | pronghorn*) submit_script="test_driver_dav${cur_time}.sh" ##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv writing to batch script vvvvvvvvvvvvvvvvvvv @@ -101,16 +101,16 @@ input_file="tests_posttag_dav_mpi" c_threads=36 -export INITMODULES="/glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/sh" +export INITMODULES="/glade/u/apps/ch/opt/lmod/8.1.7/lmod/lmod/init/sh" . \$INITMODULES module purge -module load ncarenv/1.0 -module load intel/12.1.5 +module load ncarenv +module load intel module load mkl module load ncarcompilers -module load netcdf/4.3.3.1 -module load mpich-slurm/3.2.1 +module load netcdf +module load openmpi module load nco module load python @@ -210,9 +210,9 @@ export INITMODULES="/usr/share/Modules/init/sh" . \$INITMODULES module purge -module load compiler/intel/18.0.3 -module load tool/nco/4.7.5 -module load tool/netcdf/4.6.1/intel +module load compiler/intel +module load tool/nco +module load tool/netcdf export NETCDF_DIR=\$NETCDF_PATH export INC_NETCDF=\${NETCDF_PATH}/include @@ -290,9 +290,9 @@ export INITMODULES="/usr/share/Modules/init/sh" . \$INITMODULES module purge -module load compiler/intel/19.0.1 -module load tool/nco/4.7.5 -module load tool/netcdf/4.6.1/intel +module load compiler/intel +module load tool/nco +module load tool/netcdf export NETCDF_DIR=\$NETCDF_PATH export INC_NETCDF=\${NETCDF_PATH}/include diff --git a/tools/mkmapdata/mknoocnmap.pl b/tools/mkmapdata/mknoocnmap.pl index 67e65e6a70..5438c8bcd3 100755 --- a/tools/mkmapdata/mknoocnmap.pl +++ b/tools/mkmapdata/mknoocnmap.pl @@ -256,13 +256,19 @@ sub absolute_path { print "\n\nCreate SCRIP grid and mapping files for a single-point\n"; } # land grid... +my $GITDES = `cd $scrdir; git describe; cd -`; +$GITDES =~ s/\n//g; my $grddir = absolute_path( "$scrdir/../mkmapgrids" ); -my $grid1 = "$grddir/SCRIPgrid_${name}_nomask_c${cdate}.nc"; +my $cwd = getcwd(); +my $datdir = $grddir; +if ( $cwd ne $scrdir ) { + $datdir = $cwd; +} +my $grid1 = "$datdir/SCRIPgrid_${name}_nomask_c${cdate}.nc"; my $cmdenv = "env S_LAT=$S_lat W_LON=$W_lon N_LAT=$N_lat E_LON=$E_lon " . - "NX=$nx NY=$ny PTNAME=$name $print "; + "NX=$nx NY=$ny PTNAME=$name GITDES=$GITDES $print "; -chdir( "$grddir" ); -my $cmd = "$cmdenv GRIDFILE=$grid1 ncl mkscripgrid.ncl"; +my $cmd = "$cmdenv GRIDFILE=$grid1 ncl $scrdir/../mkmapgrids/mkscripgrid.ncl"; if ( $printlev > 0 ) { print "Create land SCRIP gridfile\n"; print "Execute: $cmd\n"; @@ -270,8 +276,8 @@ sub absolute_path { system( $cmd ); # ocean grid... -my $grid2 = "$grddir/SCRIPgrid_${name}_noocean_c${cdate}.nc"; -my $cmd = "$cmdenv GRIDFILE=$grid2 IMASK=0 ncl mkscripgrid.ncl"; +my $grid2 = "$datdir/SCRIPgrid_${name}_noocean_c${cdate}.nc"; +my $cmd = "$cmdenv GRIDFILE=$grid2 IMASK=0 ncl $scrdir/../mkmapgrids/mkscripgrid.ncl"; if ( $printlev > 0 ) { print "Create ocean SCRIP gridfile\n"; print "Execute: $cmd\n"; @@ -281,10 +287,9 @@ sub absolute_path { # Now create a unity mapping between the two... # Note reversal of grid1 & grid2, because we want an ocean -> land # mapping file -chdir( "$scrdir" ); -my $mapfile = "map_${name}_noocean_to_${name}_nomask_aave_da_${cdate}.nc"; +my $mapfile = "$datdir/map_${name}_noocean_to_${name}_nomask_aave_da_${cdate}.nc"; my $cmd = "env GRIDFILE1=$grid2 GRIDFILE2=$grid1 MAPFILE=$mapfile " . - "$print ncl $scrdir/mkunitymap.ncl"; + "GITDES=$GITDES $print ncl $scrdir/mkunitymap.ncl"; if ( $printlev > 0 ) { print "Create unity mapping file between the two gridfile\n"; diff --git a/tools/mkmapdata/mkunitymap.ncl b/tools/mkmapdata/mkunitymap.ncl index ce0c17f988..7570f7eedd 100644 --- a/tools/mkmapdata/mkunitymap.ncl +++ b/tools/mkmapdata/mkunitymap.ncl @@ -23,6 +23,8 @@ begin print_str = getenv("PRINT"); ; Do Extra printing for debugging + gitdescribe = getenv("GITDES"); ; Git describe from the source clone + if ( ismissing(gridfile1) )then print( "ERROR: GRIDFILE1 is missing!" ); exit @@ -45,6 +47,10 @@ begin end if end if + if ( ismissing(gitdescribe) )then + gitdescribe = systemfunc( "git describe" ) + end if + ; ; Open up the input grid files ; @@ -134,7 +140,7 @@ begin nc@grid_file_dst = gridfile2; nc@title = "SCRIP mapping file between identical grids without ocean"; nc@history = ldate+": create using mkunitymap.ncl"; - nc@Version = systemfunc( "git describe" ); + nc@Version = gitdescribe; ; ; Fraction diff --git a/tools/mkmapgrids/mkscripgrid.ncl b/tools/mkmapgrids/mkscripgrid.ncl index 0bfb26671c..65b9306f2d 100644 --- a/tools/mkmapgrids/mkscripgrid.ncl +++ b/tools/mkmapgrids/mkscripgrid.ncl @@ -36,6 +36,8 @@ begin outfilename = getenv("GRIDFILE"); ; Get filename from env variable + gitdescribe = getenv("GITDES"); ; Git describe from the source clone + if ( ismissing(nx) )then nx = 1; end if @@ -82,6 +84,10 @@ begin end if end if + if ( ismissing(gitdescribe) )then + gitdescribe = systemfunc( "git describe" ) + end if + system( "/bin/rm -f "+outfilename ); if ( printn )then print( "output file: "+outfilename ); @@ -156,7 +162,7 @@ end nc = addfile( outfilename, "w" ); nc@history = ldate+": create using mkscripgrid.ncl"; nc@comment = "Ocean is assumed to non-existant at this point"; - nc@Version = systemfunc( "git describe" ); + nc@Version = gitdescribe; if ( printn )then print( "================================================================================================" ); print( "Successfully created SCRIP grid file: "+outfilename); From d4c0a0b3c8a1da33c992ea2ae047226585da6af8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 19 Feb 2020 16:52:26 -0700 Subject: [PATCH 0613/1973] Changes so will compile/run, was using numpft_fates rather than the newer variable name --- src/main/histFileMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 526543b6be..25fed266c1 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -4951,7 +4951,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('fates_levelem') num2d = num_elements_fates case ('fates_levelpft') - num2d = num_elements_fates*numpft_fates + num2d = num_elements_fates*maxveg_fates case ('fates_levelcwd') num2d = num_elements_fates*ncwd case ('fates_levelage') diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index dab61587ef..8fe1f63b1d 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2399,7 +2399,7 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%elem_end = num_elements fates%elpft_begin = 1 - fates%elpft_end = num_elements * numpft_fates + fates%elpft_end = num_elements * maxveg_ed fates%elcwd_begin = 1 fates%elcwd_end = num_elements * ncwd From ece16d855c9259f31e6f17076aca58cd66e983c5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 20 Feb 2020 14:20:04 -0700 Subject: [PATCH 0614/1973] Fix spelling error in ChangeLog --- doc/ChangeLog | 2 +- doc/ChangeSum | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 57a2075431..cf7d461530 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,7 +2,7 @@ Tag name: ctsm1.0.dev084 Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) Date: Wed Feb 19 15:05:03 MST 2020 -One-line Summary: Bounds assertion for C istopoes when threading is on +One-line Summary: Bounds assertion for C isotopes when threading is on Purpose of changes ------------------ diff --git a/doc/ChangeSum b/doc/ChangeSum index fca42da30e..c59c6a2359 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm1.0.dev084 negins 02/19/2020 Bounds assertion for C istopoes when threading is on + ctsm1.0.dev084 negins 02/19/2020 Bounds assertion for C isotopes when threading is on ctsm1.0.dev083 negins 02/06/2020 Some BFB Fixes: Resolve issues #683, # 874, #878, # 885, # 745, #838 ctsm1.0.dev082 oleson 02/01/2020 Rename variables to avoid confusion; fix QSNOEVAP diagnostic ctsm1.0.dev081 slevis 01/13/2020 Speed up restart writes From 2d277c107940aa941d0649432e0aba9cc3d94cd2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 20 Feb 2020 16:01:19 -0700 Subject: [PATCH 0615/1973] Make gindex_ocn intent(inout) rather than intent(out) Although gindex_ocn could be intent(out), intel18.0.3 generates a runtime segmentation fault in runs that don't have this argument present when this is declared intent(out). (It works fine on intel 19.0.2 when declared as intent(out).) Resolves ESCOMP/ctsm#930 --- src/main/clm_initializeMod.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 535e8bc2a3..32ff522a91 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -61,7 +61,12 @@ subroutine initialize1(gindex_ocn, dtime_driver) use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp ! ! !ARGUMENTS - integer, pointer, optional, intent(out) :: gindex_ocn(:) ! If present, this will hold the decomposition of ocean points (which is needed for the nuopc interface); note that this variable is allocated here, and is assumed to start unallocated + ! COMPILER_BUG(wjs, 2020-02-20, intel18.0.3) Although gindex_ocn could be + ! intent(out), intel18.0.3 generates a runtime segmentation fault in runs that don't + ! have this argument present when this is declared intent(out). (It works fine on + ! intel 19.0.2 when declared as intent(out).) See also + ! https://github.com/ESCOMP/CTSM/issues/930. + integer, pointer, optional, intent(inout) :: gindex_ocn(:) ! If present, this will hold the decomposition of ocean points (which is needed for the nuopc interface); note that this variable is allocated here, and is assumed to start unallocated integer, intent(in), optional :: dtime_driver ! ! !LOCAL VARIABLES: From 6e416d9cca8bf86f5a9cf1ee4bc7d45dc5db657b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 21 Feb 2020 06:06:39 -0700 Subject: [PATCH 0616/1973] Check userRc in addition to rc Some ESMF routines have an optional userRc argument that holds the return code from the user callback that is called from these ESMF routines. It is important to check this argument, too, in order to catch errors that occur in the user routine. In fact, most errors will show up in this argument rather than the standard rc argument: the userRc argument captures any error that is raised in routines like lnd_init and lnd_run. --- lilac/src/lilac_mod.F90 | 87 +++++++++++++++++++++++++++-------------- 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 0716416ece..d05746c89c 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -112,7 +112,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & integer :: lsize type(ESMF_State) :: importState, exportState type(ESMF_VM) :: vm - integer :: rc + integer :: user_rc, rc character(len=ESMF_MAXSTR) :: cname !components or cpl names integer :: ierr integer :: n, i @@ -259,7 +259,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & !------------------------------------------------------------------------- ! Register section -- set services -- atmcap - call ESMF_GridCompSetServices(atm_gcomp, userRoutine=lilac_atmcap_register, rc=rc) + call ESMF_GridCompSetServices(atm_gcomp, userRoutine=lilac_atmcap_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('atm_gcomp register failure') if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('atm_gcomp register failure') call ESMF_LogWrite(subname//" atmos SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -267,7 +268,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & end if ! Register section -- set services -- ctsm - call ESMF_GridCompSetServices(lnd_gcomp, userRoutine=lnd_register, rc=rc) + call ESMF_GridCompSetServices(lnd_gcomp, userRoutine=lnd_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('lnd_gcomp register failure') if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('lnd_gcomp register failure') call ESMF_LogWrite(subname//"CSTM SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -275,7 +277,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & end if ! Register section -- set services -- mosart - call ESMF_GridCompSetServices(rof_gcomp, userRoutine=rof_register, rc=rc) + call ESMF_GridCompSetServices(rof_gcomp, userRoutine=rof_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') call ESMF_LogWrite(subname//"MOSART SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -283,7 +286,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & end if ! Register section -- set services -- coupler atmosphere to land - call ESMF_CplCompSetServices(cpl_atm2lnd_comp, userRoutine=cpl_atm2lnd_register, rc=rc) + call ESMF_CplCompSetServices(cpl_atm2lnd_comp, userRoutine=cpl_atm2lnd_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_atm2lnd_comp register failure') if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_atm2lnd_comp register failure') call ESMF_LogWrite(subname//"Coupler from atmosphere to land SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -291,7 +295,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & end if ! Register section -- set services -- river to land - call ESMF_CplCompSetServices(cpl_rof2lnd_comp, userRoutine=cpl_rof2lnd_register, rc=rc) + call ESMF_CplCompSetServices(cpl_rof2lnd_comp, userRoutine=cpl_rof2lnd_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') call ESMF_LogWrite(subname//"Coupler from river to land SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -299,7 +304,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & end if ! Register section -- set services -- coupler land to atmosphere - call ESMF_CplCompSetServices(cpl_lnd2atm_comp, userRoutine=cpl_lnd2atm_register, rc=rc) + call ESMF_CplCompSetServices(cpl_lnd2atm_comp, userRoutine=cpl_lnd2atm_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2atm_comp register failure') if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2atm_comp register failure') call ESMF_LogWrite(subname//"Coupler from land to atmosphere SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -307,7 +313,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & end if ! Register section -- set services -- coupler land to river - call ESMF_CplCompSetServices(cpl_lnd2rof_comp, userRoutine=cpl_lnd2rof_register, rc=rc) + call ESMF_CplCompSetServices(cpl_lnd2rof_comp, userRoutine=cpl_lnd2rof_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') call ESMF_LogWrite(subname//"Coupler from land to river SetServices finished!", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -339,7 +346,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & ! Initialze lilac_atm gridded component call ESMF_GridCompInitialize(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing atmcap") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing atmcap") call ESMF_LogWrite(subname//"lilac_atm gridded component initialized", ESMF_LOGMSG_INFO) @@ -357,7 +365,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & ! Initialze CTSM Gridded Component call ESMF_GridCompInitialize(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing ctsm") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing ctsm") call ESMF_LogWrite(subname//"CTSM gridded component initialized", ESMF_LOGMSG_INFO) @@ -370,7 +379,8 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & ! Initialize MOSART Gridded Component call ESMF_GridCompInitialize(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing mosart") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing mosart") call ESMF_LogWrite(subname//"MOSART gridded component initialized", ESMF_LOGMSG_INFO) end if @@ -383,26 +393,30 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & ! one for the river and one for the atm - ! The following fills in the atm field bundle in cpl2lnd_state call ESMF_CplCompInitialize(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_atm2lnd component") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_atm2lnd component") call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) ! The following maps the atm field bundle in lnd2cpl_state to the atm mesh call ESMF_CplCompInitialize(cpl_lnd2atm_comp, importState=lnd2cpl_state, exportState=cpl2atm_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) if (couple_to_river) then ! The following maps the rof field bundle in lnd2cpl_state to the rof mesh call ESMF_CplCompInitialize(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2rof component") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2rof component") call ESMF_LogWrite(subname//"coupler :: cpl_atm2lnd_comp initialized", ESMF_LOGMSG_INFO) ! The following fills in the rof field bundle in cpl2lnd_state call ESMF_CplCompInitialize(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing cpl_lnd2atm component") call ESMF_LogWrite(subname//"coupler :: cpl_lnd2atm_comp initialized", ESMF_LOGMSG_INFO) end if @@ -447,7 +461,7 @@ subroutine lilac_run(write_restarts_now, stop_now) type(ESMF_Alarm) :: lilac_history_alarm type(ESMF_Alarm) :: lilac_restart_alarm type(ESMF_State) :: importState, exportState - integer :: rc + integer :: user_rc, rc character(len=*), parameter :: subname=trim(modname)//': [lilac_run] ' !------------------------------------------------------------------------ @@ -490,7 +504,8 @@ subroutine lilac_run(write_restarts_now, stop_now) call ESMF_LogWrite(subname//"running lilac atmos_cap", ESMF_LOGMSG_INFO) if (mytask == 0) write(logunit,*) "Running atmos_cap gridded component , rc =", rc call ESMF_GridCompRun(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") ! Update prescribed aerosols atm2cpl_a_state @@ -501,7 +516,8 @@ subroutine lilac_run(write_restarts_now, stop_now) call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) write(logunit,*) "Running coupler component..... cpl_atm2lnd_comp" call ESMF_CplCompRun(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_atm2lnd") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_atm2lnd") ! Run ctsm @@ -510,7 +526,8 @@ subroutine lilac_run(write_restarts_now, stop_now) call ESMF_LogWrite(subname//"running ctsm", ESMF_LOGMSG_INFO) if (mytask == 0) write(logunit,*) "Running ctsm" call ESMF_GridCompRun(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") ! Run cpl_lnd2atm @@ -519,7 +536,8 @@ subroutine lilac_run(write_restarts_now, stop_now) write(logunit,*) "Running coupler component..... cpl_lnd2atm_comp , rc =", rc end if call ESMF_CplCompRun(cpl_lnd2atm_comp, importState=lnd2cpl_state, exportState=cpl2atm_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in cpl_lnd2atm") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in cpl_lnd2atm") if (couple_to_river) then @@ -527,7 +545,8 @@ subroutine lilac_run(write_restarts_now, stop_now) call ESMF_LogWrite(subname//"running cpl_lnd2rof_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) write(logunit,*) "Running coupler component..... cpl_lnd2rof_comp" call ESMF_CplCompRun(cpl_lnd2rof_comp, importState=lnd2cpl_state, exportState=cpl2rof_state, & - clock=lilac_clock, rc=rc) + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_lnd2rof") if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_lnd2rof") ! Run mosart @@ -536,15 +555,17 @@ subroutine lilac_run(write_restarts_now, stop_now) call ESMF_LogWrite(subname//"running mosart", ESMF_LOGMSG_INFO) if (mytask == 0) write(logunit,*) "Running mosart" call ESMF_GridCompRun(rof_gcomp, importState=cpl2rof_state, exportState=rof2cpl_state, & - clock=lilac_clock, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running ctsm") + clock=lilac_clock, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running rof") + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running rof") ! Run cpl_rof2lnd ! TODO: uncommenting this needs to be tested ! call ESMF_LogWrite(subname//"running cpl_rof2lnd_comp ", ESMF_LOGMSG_INFO) ! if (mytask == 0) write(logunit,*) "Running coupler component..... cpl_rof2lnd_comp" ! call ESMF_CplCompRun(cpl_rof2lnd_comp, importState=rof2cpl_state, exportState=cpl2lnd_state, & - ! clock=lilac_clock, rc=rc) + ! clock=lilac_clock, userRc=user_rc, rc=rc) + ! if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_rof2lnd") ! if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running cpl_rof2lnd") end if @@ -589,7 +610,7 @@ subroutine lilac_final( ) ! local variables type(ESMF_State) :: importState, exportState - integer :: rc, userRC + integer :: rc, user_rc character(len=*), parameter :: subname=trim(modname)//': [lilac_final] ' !------------------------------------------------------------------------ @@ -603,7 +624,9 @@ subroutine lilac_final( ) end if ! Gridded Component Finalizing! --- atmosphere - call ESMF_GridCompFinalize(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, clock=lilac_clock, rc=rc) + call ESMF_GridCompFinalize(atm_gcomp, importState=cpl2atm_state, exportState=atm2cpl_state, clock=lilac_clock, & + userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) return if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"atmos_cap or atm_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -611,7 +634,9 @@ subroutine lilac_final( ) end if ! Coupler component Finalizing --- coupler atmos to land - call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, clock=lilac_clock, rc=rc) + call ESMF_CplCompFinalize(cpl_atm2lnd_comp, importState=atm2cpl_state, exportState=cpl2lnd_state, clock=lilac_clock, & + userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) return if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -619,7 +644,9 @@ subroutine lilac_final( ) end if ! Gridded Component Finalizing! --- land - call ESMF_GridCompFinalize(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, clock=lilac_clock, rc=rc) + call ESMF_GridCompFinalize(lnd_gcomp, importState=cpl2lnd_state, exportState=lnd2cpl_state, clock=lilac_clock, & + userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) return if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"lnd_cap or lnd_gcomp is running", ESMF_LOGMSG_INFO) if (mytask == 0) then @@ -627,7 +654,9 @@ subroutine lilac_final( ) end if ! Coupler component Finalizing --- coupler land to atmos - call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=cpl2lnd_state, exportState=cpl2atm_state, clock=lilac_clock, rc=rc) + call ESMF_CplCompFinalize(cpl_lnd2atm_comp, importState=cpl2lnd_state, exportState=cpl2atm_state, clock=lilac_clock, & + userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) return if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogWrite(subname//"running cpl_lnd2atm_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) then From 2301d1301d12da6b09e4d0050ac2a3fd3450972b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 24 Feb 2020 13:55:27 -0700 Subject: [PATCH 0617/1973] Change mpi_bcast to shr_mpi_bcast I needed this on my mac because 'use mpi' doesn't work there (I think we'd need to '#include ', but it's more robust to just use shr_mpi_mod). --- Externals.cfg | 2 +- src/cpl/lilac/lnd_comp_esmf.F90 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index d2c294c57f..041aa445bc 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -23,7 +23,7 @@ required = True local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/mosart -tag = 14d02bb +tag = a4baa3c required = True [cime] diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 5a8455b173..676d4bf34c 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -7,7 +7,7 @@ module lnd_comp_esmf ! external libraries use ESMF - use mpi , only : MPI_BCAST, MPI_CHARACTER + use shr_mpi_mod , only : shr_mpi_bcast use perf_mod , only : t_startf, t_stopf, t_barrierf ! lilac code @@ -251,7 +251,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) end if close(fileunit) end if - call mpi_bcast(lnd_mesh_filename, len(lnd_mesh_filename), MPI_CHARACTER, 0, mpicom, ierr) + call shr_mpi_bcast(lnd_mesh_filename, mpicom) !---------------------- ! Obtain caseid and start type from attributes in import state From cf476b41f384cdc10fcb7a3ecf2f953113eef1c3 Mon Sep 17 00:00:00 2001 From: chen693 Date: Mon, 24 Feb 2020 13:57:52 -0800 Subject: [PATCH 0618/1973] add a parameter for cutting a certain fraction of crop leaf biomass at harvest --- src/main/pftconMod.F90 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 27a61403bc..4e5e60b3bb 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -134,6 +134,7 @@ module pftconMod real(r8), allocatable :: slatop (:) ! SLA at top of canopy [m^2/gC] real(r8), allocatable :: dsladlai (:) ! dSLA/dLAI [m^2/gC] real(r8), allocatable :: leafcn (:) ! leaf C:N [gC/gN] + real(r8), allocatable :: harvfrac (:) ! cut fraction for harvest [-] real(r8), allocatable :: flnr (:) ! fraction of leaf N in Rubisco [no units] real(r8), allocatable :: woody (:) ! woody lifeform flag (0 or 1) real(r8), allocatable :: lflitcn (:) ! leaf litter C:N (gC/gN) @@ -356,7 +357,8 @@ subroutine InitAllocate (this) allocate( this%fnitr (0:mxpft) ) allocate( this%slatop (0:mxpft) ) allocate( this%dsladlai (0:mxpft) ) - allocate( this%leafcn (0:mxpft) ) + allocate( this%leafcn (0:mxpft) ) + allocate( this%harvfrac (0:mxpft) ) allocate( this%flnr (0:mxpft) ) allocate( this%woody (0:mxpft) ) allocate( this%lflitcn (0:mxpft) ) @@ -658,6 +660,10 @@ subroutine InitRead(this) call ncd_io('leafcn', this%leafcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + + ! Y. Cheng, harvest fraction for crops during offset period + call ncd_io('harvfrac', this%harvfrac, 'read', ncid, readvar=readv, posNOTonfile=.true.) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('flnr', this%flnr, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) @@ -1282,6 +1288,7 @@ subroutine Clean(this) deallocate( this%slatop) deallocate( this%dsladlai) deallocate( this%leafcn) + deallocate( this%harvfrac) deallocate( this%flnr) deallocate( this%woody) deallocate( this%lflitcn) From da3b1a0ac0e9b4d10596e108b3faf1e8af5676d1 Mon Sep 17 00:00:00 2001 From: chen693 Date: Mon, 24 Feb 2020 14:02:38 -0800 Subject: [PATCH 0619/1973] add a new biofuelc_harvest flux to store the cut fraction of crop carbon during offset period --- src/biogeochem/CNVegCarbonFluxType.F90 | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 5729a1a9f2..5a5aa3f448 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -134,6 +134,10 @@ module CNVegCarbonFluxType real(r8), pointer :: frootc_to_litter_patch (:) ! fine root C litterfall (gC/m2/s) real(r8), pointer :: livestemc_to_litter_patch (:) ! live stem C litterfall (gC/m2/s) real(r8), pointer :: grainc_to_food_patch (:) ! grain C to food for prognostic crop(gC/m2/s) + + ! Y. Cheng + real(r8), pointer :: biofuelc_harvest_patch (:) ! biofuel C for bioenergy crops that are harvested (gC/m2/s) + real(r8), pointer :: grainc_to_seed_patch (:) ! grain C to seed for prognostic crop(gC/m2/s) ! maintenance respiration fluxes @@ -596,6 +600,7 @@ subroutine InitAllocate(this, bounds, carbon_type) allocate(this%cpool_to_grainc_storage_patch (begp:endp)) ; this%cpool_to_grainc_storage_patch (:) = nan allocate(this%livestemc_to_litter_patch (begp:endp)) ; this%livestemc_to_litter_patch (:) = nan allocate(this%grainc_to_food_patch (begp:endp)) ; this%grainc_to_food_patch (:) = nan + allocate(this%biofuelc_harvest_patch (begp:endp)) ; this%biofuelc_harvest_patch (:) = nan allocate(this%grainc_to_seed_patch (begp:endp)) ; this%grainc_to_seed_patch (:) = nan allocate(this%grainc_xfer_to_grainc_patch (begp:endp)) ; this%grainc_xfer_to_grainc_patch (:) = nan allocate(this%cpool_grain_gr_patch (begp:endp)) ; this%cpool_grain_gr_patch (:) = nan @@ -825,6 +830,13 @@ subroutine InitHistory(this, bounds, carbon_type) avgflag='A', long_name='grain C to food', & ptr_patch=this%grainc_to_food_patch) + ! Y. Cheng + this%biofuelc_harvest_patch(begp:endp) = spval + call hist_addfld1d (fname='BIOFUELC_HARVEST', units='gC/m^2/s', & + avgflag='A', long_name='biofuel C harvest', & + ptr_patch=this%biofuelc_harvest_patch) + + this%grainc_to_seed_patch(begp:endp) = spval call hist_addfld1d (fname='GRAINC_TO_SEED', units='gC/m^2/s', & avgflag='A', long_name='grain C to seed', & @@ -3511,6 +3523,13 @@ subroutine RestartBulkOnly ( this, bounds, ncid, flag ) dim1name='pft', & long_name='grain C to food', units='gC/m2/s', & interpinic_flag='interp', readvar=readvar, data=this%grainc_to_food_patch) + + + ! Y. Cheng + call restartvar(ncid=ncid, flag=flag, varname='biofuelc_harvest', xtype=ncd_double, & + dim1name='pft', & + long_name='biofuelc harvest', units='gC/m2/s', & + interpinic_flag='interp', readvar=readvar, data=this%biofuelc_harvest_patch) call restartvar(ncid=ncid, flag=flag, varname='cpool_to_grainc', xtype=ncd_double, & dim1name='pft', & @@ -3848,6 +3867,9 @@ subroutine SetValues ( this, & this%xsmrpool_to_atm_patch(i) = value_patch this%livestemc_to_litter_patch(i) = value_patch this%grainc_to_food_patch(i) = value_patch + + this%biofuelc_harvest_patch(i) = value_patch + this%grainc_to_seed_patch(i) = value_patch this%grainc_xfer_to_grainc_patch(i) = value_patch this%cpool_to_grainc_patch(i) = value_patch @@ -4292,7 +4314,8 @@ subroutine Summary_carbonflux(this, & if (.not. use_grainproduct) then this%litfall_patch(p) = & this%litfall_patch(p) + & - this%grainc_to_food_patch(p) + this%grainc_to_food_patch(p) + & + this%biofuelc_harvest_patch(p) !Y.Cheng end if end if From 32db2413c712d755c760128fa8256cc343e12e31 Mon Sep 17 00:00:00 2001 From: chen693 Date: Mon, 24 Feb 2020 14:03:27 -0800 Subject: [PATCH 0620/1973] add calculation for the new biofuelc_harvest flux --- src/biogeochem/CNCIsoFluxMod.F90 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNCIsoFluxMod.F90 b/src/biogeochem/CNCIsoFluxMod.F90 index 07e693c540..8c79e50d33 100644 --- a/src/biogeochem/CNCIsoFluxMod.F90 +++ b/src/biogeochem/CNCIsoFluxMod.F90 @@ -404,6 +404,13 @@ subroutine CIsoFlux1(num_soilc, filter_soilc, num_soilp, filter_soilp, & iso_cnveg_cs%grainc_patch , cnveg_cs%grainc_patch, & num_soilp , filter_soilp, 1._r8, 0, isotope) + ! Y. Cheng + call CIsoFluxCalc(& + iso_cnveg_cf%biofuelc_harvest_patch , cnveg_cf%biofuelc_harvest_patch, & + iso_cnveg_cs%grainc_patch , cnveg_cs%grainc_patch, & + num_soilp , filter_soilp, 1._r8, 0, isotope) + + call CIsoFluxCalc(& iso_cnveg_cf%grainc_to_seed_patch , cnveg_cf%grainc_to_seed_patch, & iso_cnveg_cs%grainc_patch , cnveg_cs%grainc_patch, & @@ -1193,6 +1200,9 @@ subroutine CNCIsoLitterToColumn (num_soilc, filter_soilc, & !DML livestemc_to_litter => iso_cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] grainc_to_food => iso_cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] + + ! Y. Cheng + biofuelc_harvest => iso_cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Input: [real(r8) (:) ] !DML phenology_c_to_litr_met_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) phenology_c_to_litr_cel_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) @@ -1232,15 +1242,18 @@ subroutine CNCIsoLitterToColumn (num_soilc, filter_soilc, & + livestemc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & + livestemc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - + ! Y. Cheng if (.not. use_grainproduct) then ! grain litter carbon fluxes phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) end if end if From 526b28d48ae9acefb210dfb10d4564cf54587b35 Mon Sep 17 00:00:00 2001 From: chen693 Date: Mon, 24 Feb 2020 14:04:06 -0800 Subject: [PATCH 0621/1973] add a new biofueln_harvest flux to store the cut fraction of crop nitrogen during offset period --- src/biogeochem/CNVegNitrogenFluxType.F90 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90 index f9f2b37215..edfa857998 100644 --- a/src/biogeochem/CNVegNitrogenFluxType.F90 +++ b/src/biogeochem/CNVegNitrogenFluxType.F90 @@ -131,6 +131,7 @@ module CNVegNitrogenFluxType ! litterfall fluxes real(r8), pointer :: livestemn_to_litter_patch (:) ! patch livestem N to litter (gN/m2/s) real(r8), pointer :: grainn_to_food_patch (:) ! patch grain N to food for prognostic crop (gN/m2/s) + real(r8), pointer :: biofueln_harvest_patch (:) ! patch biofuel N for bioenergy crops that are harvested (gN/m2/s) real(r8), pointer :: grainn_to_seed_patch (:) ! patch grain N to seed for prognostic crop (gN/m2/s) real(r8), pointer :: leafn_to_litter_patch (:) ! patch leaf N litterfall (gN/m2/s) real(r8), pointer :: leafn_to_retransn_patch (:) ! patch leaf N to retranslocated N pool (gN/m2/s) @@ -413,6 +414,7 @@ subroutine InitAllocate(this, bounds) allocate(this%npool_to_grainn_storage_patch (begp:endp)) ; this%npool_to_grainn_storage_patch (:) = nan allocate(this%livestemn_to_litter_patch (begp:endp)) ; this%livestemn_to_litter_patch (:) = nan allocate(this%grainn_to_food_patch (begp:endp)) ; this%grainn_to_food_patch (:) = nan + allocate(this%biofueln_harvest_patch (begp:endp)) ; this%biofueln_harvest_patch (:) = nan allocate(this%grainn_to_seed_patch (begp:endp)) ; this%grainn_to_seed_patch (:) = nan allocate(this%grainn_xfer_to_grainn_patch (begp:endp)) ; this%grainn_xfer_to_grainn_patch (:) = nan allocate(this%grainn_storage_to_xfer_patch (begp:endp)) ; this%grainn_storage_to_xfer_patch (:) = nan @@ -1370,6 +1372,13 @@ subroutine Restart (this, bounds, ncid, flag ) long_name='grain N to food', units='gN/m2/s', & interpinic_flag='interp', readvar=readvar, data=this%grainn_to_food_patch) end if + + if (use_crop) then + call restartvar(ncid=ncid, flag=flag, varname='biofueln_harvest', xtype=ncd_double, & + dim1name='pft', & + long_name='biofuel N harvested', units='gN/m2/s', & + interpinic_flag='interp', readvar=readvar, data=this%biofueln_harvest_patch) + end if if (use_crop) then call restartvar(ncid=ncid, flag=flag, varname='npool_to_grainn', xtype=ncd_double, & @@ -1679,6 +1688,7 @@ subroutine SetValues ( this, & i = filter_patch(fi) this%livestemn_to_litter_patch(i) = value_patch this%grainn_to_food_patch(i) = value_patch + this%biofueln_harvest_patch(i) = value_patch this%grainn_to_seed_patch(i) = value_patch this%grainn_xfer_to_grainn_patch(i) = value_patch this%npool_to_grainn_patch(i) = value_patch From c71986216540425deb5c8178023d9ae6e8f6638a Mon Sep 17 00:00:00 2001 From: chen693 Date: Mon, 24 Feb 2020 14:29:44 -0800 Subject: [PATCH 0622/1973] cut a certain fraction of crop leaf biomass during offset period --- ...PhenologyMod_cut_newFlux_newCutParam_N.F90 | 3060 +++++++++++++++++ 1 file changed, 3060 insertions(+) create mode 100644 src/biogeochem/CNPhenologyMod_cut_newFlux_newCutParam_N.F90 diff --git a/src/biogeochem/CNPhenologyMod_cut_newFlux_newCutParam_N.F90 b/src/biogeochem/CNPhenologyMod_cut_newFlux_newCutParam_N.F90 new file mode 100644 index 0000000000..3079f12670 --- /dev/null +++ b/src/biogeochem/CNPhenologyMod_cut_newFlux_newCutParam_N.F90 @@ -0,0 +1,3060 @@ +module CNPhenologyMod + +#include "shr_assert.h" + + !----------------------------------------------------------------------- + ! !MODULE: CNPhenologyMod + ! + ! !DESCRIPTION: + ! Module holding routines used in phenology model for coupled carbon + ! nitrogen code. + ! + ! !USES: + use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_log_mod , only : errMsg => shr_log_errMsg + use shr_sys_mod , only : shr_sys_flush + use decompMod , only : bounds_type + use clm_varpar , only : maxveg, nlevdecomp_full + use clm_varctl , only : iulog, use_cndv + use clm_varcon , only : tfrz + use abortutils , only : endrun + use CanopyStateType , only : canopystate_type + use CNDVType , only : dgvs_type + use CNVegstateType , only : cnveg_state_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type + use CNVegCarbonFluxType , only : cnveg_carbonflux_type + use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type + use CNVegnitrogenfluxType , only : cnveg_nitrogenflux_type + use CropType , only : crop_type + use pftconMod , only : pftcon + use SoilStateType , only : soilstate_type + use TemperatureType , only : temperature_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use ColumnType , only : col + use GridcellType , only : grc + use PatchType , only : patch + use atm2lndType , only : atm2lnd_type + use atm2lndType , only : atm2lnd_type + ! + implicit none + private + ! + ! !PUBLIC MEMBER FUNCTIONS: + public :: readParams ! Read parameters + public :: CNPhenologyreadNML ! Read namelist + public :: CNPhenologyInit ! Initialization + public :: CNPhenology ! Update + ! + ! !PRIVATE DATA MEMBERS: + type, private :: params_type + real(r8) :: crit_dayl ! critical day length for senescence + real(r8) :: ndays_on ! number of days to complete leaf onset + real(r8) :: ndays_off ! number of days to complete leaf offset + real(r8) :: fstor2tran ! fraction of storage to move to transfer for each onset + real(r8) :: crit_onset_fdd ! critical number of freezing days to set gdd counter + real(r8) :: crit_onset_swi ! critical number of days > soilpsi_on for onset + real(r8) :: soilpsi_on ! critical soil water potential for leaf onset + real(r8) :: crit_offset_fdd ! critical number of freezing days to initiate offset + real(r8) :: crit_offset_swi ! critical number of water stress days to initiate offset + real(r8) :: soilpsi_off ! critical soil water potential for leaf offset + real(r8) :: lwtop ! live wood turnover proportion (annual fraction) + end type params_type + + type(params_type) :: params_inst + + real(r8) :: dt ! radiation time step delta t (seconds) + real(r8) :: fracday ! dtime as a fraction of day + real(r8) :: crit_dayl ! critical daylength for offset (seconds) + real(r8) :: ndays_on ! number of days to complete onset + real(r8) :: ndays_off ! number of days to complete offset + real(r8) :: fstor2tran ! fraction of storage to move to transfer on each onset + real(r8) :: crit_onset_fdd ! critical number of freezing days + real(r8) :: crit_onset_swi ! water stress days for offset trigger + real(r8) :: soilpsi_on ! water potential for onset trigger (MPa) + real(r8) :: crit_offset_fdd ! critical number of freezing degree days to trigger offset + real(r8) :: crit_offset_swi ! water stress days for offset trigger + real(r8) :: soilpsi_off ! water potential for offset trigger (MPa) + real(r8) :: lwtop ! live wood turnover proportion (annual fraction) + + ! CropPhenology variables and constants + real(r8) :: p1d, p1v ! photoperiod factor constants for crop vernalization + real(r8) :: hti ! cold hardening index threshold for vernalization + real(r8) :: tbase ! base temperature for vernalization + + integer, parameter :: NOT_Planted = 999 ! If not planted yet in year + integer, parameter :: NOT_Harvested = 999 ! If not harvested yet in year + integer, parameter :: inNH = 1 ! Northern Hemisphere + integer, parameter :: inSH = 2 ! Southern Hemisphere + integer, pointer :: inhemi(:) ! Hemisphere that patch is in + + integer, allocatable :: minplantjday(:,:) ! minimum planting julian day + integer, allocatable :: maxplantjday(:,:) ! maximum planting julian day + integer :: jdayyrstart(inSH) ! julian day of start of year + + real(r8), private :: initial_seed_at_planting = 3._r8 ! Initial seed at planting + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + !----------------------------------------------------------------------- + +contains + + !----------------------------------------------------------------------- + subroutine CNPhenologyReadNML( NLFilename ) + ! + ! !DESCRIPTION: + ! Read the namelist for CNPhenology + ! + ! !USES: + use fileutils , only : getavu, relavu, opnfil + use shr_nl_mod , only : shr_nl_find_group_name + use spmdMod , only : masterproc, mpicom + use shr_mpi_mod , only : shr_mpi_bcast + use clm_varctl , only : iulog + ! + ! !ARGUMENTS: + character(len=*), intent(in) :: NLFilename ! Namelist filename + ! + ! !LOCAL VARIABLES: + integer :: ierr ! error code + integer :: unitn ! unit for namelist file + + character(len=*), parameter :: subname = 'CNPhenologyReadNML' + character(len=*), parameter :: nmlname = 'cnphenology' + !----------------------------------------------------------------------- + namelist /cnphenology/ initial_seed_at_planting + + ! Initialize options to default values, in case they are not specified in + ! the namelist + + if (masterproc) then + unitn = getavu() + write(iulog,*) 'Read in '//nmlname//' namelist' + call opnfil (NLFilename, unitn, 'F') + call shr_nl_find_group_name(unitn, nmlname, status=ierr) + if (ierr == 0) then + read(unitn, nml=cnphenology, iostat=ierr) + if (ierr /= 0) then + call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + end if + else + call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + end if + call relavu( unitn ) + end if + + call shr_mpi_bcast (initial_seed_at_planting, mpicom) + + if (masterproc) then + write(iulog,*) ' ' + write(iulog,*) nmlname//' settings:' + write(iulog,nml=cnphenology) + write(iulog,*) ' ' + end if + + + !----------------------------------------------------------------------- + + end subroutine CNPhenologyReadNML + + !----------------------------------------------------------------------- + subroutine readParams ( ncid ) + ! + ! !DESCRIPTION: + ! + ! !USES: + use ncdio_pio , only: file_desc_t,ncd_io + + ! !ARGUMENTS: + implicit none + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=32) :: subname = 'CNPhenolParamsType' + character(len=100) :: errCode = '-Error reading in parameters file:' + logical :: readv ! has variable been read in or not + real(r8) :: tempr ! temporary to read in parameter + character(len=100) :: tString ! temp. var for reading + !----------------------------------------------------------------------- + + ! + ! read in parameters + ! + tString='crit_dayl' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%crit_dayl=tempr + + tString='ndays_on' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%ndays_on=tempr + + tString='ndays_off' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%ndays_off=tempr + + tString='fstor2tran' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%fstor2tran=tempr + + tString='crit_onset_fdd' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%crit_onset_fdd=tempr + + tString='crit_onset_swi' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%crit_onset_swi=tempr + + tString='soilpsi_on' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%soilpsi_on=tempr + + tString='crit_offset_fdd' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%crit_offset_fdd=tempr + + tString='crit_offset_swi' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%crit_offset_swi=tempr + + tString='soilpsi_off' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%soilpsi_off=tempr + + tString='lwtop_ann' + call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%lwtop=tempr + + end subroutine readParams + + !----------------------------------------------------------------------- + subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & + filter_soilp, num_pcropp, filter_pcropp, & + doalb, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, temperature_inst, atm2lnd_inst, crop_inst, & + canopystate_inst, soilstate_inst, dgvs_inst, & + cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & + cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & + c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & + leaf_prof_patch, froot_prof_patch, phase) + ! !USES: + use CNSharedParamsMod, only: use_fun + ! + ! !DESCRIPTION: + ! Dynamic phenology routine for coupled carbon-nitrogen code (CN) + ! 1. grass phenology + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter + integer , intent(in) :: filter_pcropp(:)! filter for prognostic crop patches + logical , intent(in) :: doalb ! true if time for sfc albedo calc + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(temperature_type) , intent(inout) :: temperature_inst + type(atm2lnd_type) , intent(in) :: atm2lnd_inst + type(crop_type) , intent(inout) :: crop_inst + type(canopystate_type) , intent(in) :: canopystate_inst + type(soilstate_type) , intent(in) :: soilstate_inst + type(dgvs_type) , intent(inout) :: dgvs_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst + type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst + real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) + real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) + integer , intent(in) :: phase + !----------------------------------------------------------------------- + + SHR_ASSERT_ALL_FL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), sourcefile, __LINE__) + + ! each of the following phenology type routines includes a filter + ! to operate only on the relevant patches + + + if ( phase == 1 ) then + call CNPhenologyClimate(num_soilp, filter_soilp, num_pcropp, filter_pcropp, & + temperature_inst, cnveg_state_inst, crop_inst) + + call CNEvergreenPhenology(num_soilp, filter_soilp, & + cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + + call CNSeasonDecidPhenology(num_soilp, filter_soilp, & + temperature_inst, cnveg_state_inst, dgvs_inst, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + + call CNStressDecidPhenology(num_soilp, filter_soilp, & + soilstate_inst, temperature_inst, atm2lnd_inst, wateratm2lndbulk_inst, cnveg_state_inst, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + + if (doalb .and. num_pcropp > 0 ) then + call CropPhenology(num_pcropp, filter_pcropp, & + waterdiagnosticbulk_inst, temperature_inst, crop_inst, canopystate_inst, cnveg_state_inst, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & + c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst) + end if + else if ( phase == 2 ) then + ! the same onset and offset routines are called regardless of + ! phenology type - they depend only on onset_flag, offset_flag, bglfr, and bgtr + + call CNOnsetGrowth(num_soilp, filter_soilp, & + cnveg_state_inst, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + + call CNOffsetLitterfall(num_soilp, filter_soilp, & + cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + + call CNBackgroundLitterfall(num_soilp, filter_soilp, & + cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + + call CNLivewoodTurnover(num_soilp, filter_soilp, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + + call CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & + cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + + ! gather all patch-level litterfall fluxes to the column for litter C and N inputs + + call CNLitterToColumn(bounds, num_soilc, filter_soilc, & + cnveg_state_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & + leaf_prof_patch(bounds%begp:bounds%endp,1:nlevdecomp_full), & + froot_prof_patch(bounds%begp:bounds%endp,1:nlevdecomp_full)) + else + call endrun( 'bad phase' ) + end if + + end subroutine CNPhenology + + !----------------------------------------------------------------------- + subroutine CNPhenologyInit(bounds) + ! + ! !DESCRIPTION: + ! Initialization of CNPhenology. Must be called after time-manager is + ! initialized, and after pftcon file is read in. + ! + ! !USES: + use clm_time_manager, only: get_step_size_real + use clm_varctl , only: use_crop + use clm_varcon , only: secspday + ! + ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds + !------------------------------------------------------------------------ + + ! + ! Get time-step and what fraction of a day it is + ! + dt = get_step_size_real() + fracday = dt/secspday + + ! set constants for CNSeasonDecidPhenology + ! (critical daylength from Biome-BGC, v4.1.2) + crit_dayl=params_inst%crit_dayl + + ! Set constants for CNSeasonDecidPhenology and CNStressDecidPhenology + ndays_on=params_inst%ndays_on + ndays_off=params_inst%ndays_off + + ! set transfer parameters + fstor2tran=params_inst%fstor2tran + + ! ----------------------------------------- + ! Constants for CNStressDecidPhenology + ! ----------------------------------------- + + ! onset parameters + crit_onset_fdd=params_inst%crit_onset_fdd + ! critical onset gdd now being calculated as a function of annual + ! average 2m temp. + ! crit_onset_gdd = 150.0 ! c3 grass value + ! crit_onset_gdd = 1000.0 ! c4 grass value + crit_onset_swi=params_inst%crit_onset_swi + soilpsi_on=params_inst%soilpsi_on + + ! offset parameters + crit_offset_fdd=params_inst%crit_offset_fdd + crit_offset_swi=params_inst%crit_offset_swi + soilpsi_off=params_inst%soilpsi_off + + ! ----------------------------------------- + ! Constants for CNLivewoodTurnover + ! ----------------------------------------- + + ! set the global parameter for livewood turnover rate + ! define as an annual fraction (0.7), and convert to fraction per second + lwtop=params_inst%lwtop/31536000.0_r8 !annual fraction converted to per second + + ! ----------------------------------------- + ! Call any subroutine specific initialization routines + ! ----------------------------------------- + + if ( use_crop ) call CropPhenologyInit(bounds) + + end subroutine CNPhenologyInit + + !----------------------------------------------------------------------- + subroutine CNPhenologyClimate (num_soilp, filter_soilp, num_pcropp, filter_pcropp, & + temperature_inst, cnveg_state_inst, crop_inst) + ! + ! !DESCRIPTION: + ! For coupled carbon-nitrogen code (CN). + ! + ! !USES: + use clm_time_manager , only : get_days_per_year + use clm_time_manager , only : get_curr_date, is_first_step + ! + ! !ARGUMENTS: + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_pcropp ! number of prognostic crops in filter + integer , intent(in) :: filter_pcropp(:)! filter for prognostic crop patches + type(temperature_type) , intent(inout) :: temperature_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(crop_type) , intent(inout) :: crop_inst + ! + ! !LOCAL VARIABLES: + integer :: p ! indices + integer :: fp ! lake filter patch index + real(r8) :: dayspyr ! days per year (days) + integer :: kyr ! current year + integer :: kmo ! month of year (1, ..., 12) + integer :: kda ! day of month (1, ..., 31) + integer :: mcsec ! seconds of day (0, ..., seconds/day) + real(r8), parameter :: yravg = 20.0_r8 ! length of years to average for gdd + real(r8), parameter :: yravgm1 = yravg-1.0_r8 ! minus 1 of above + !----------------------------------------------------------------------- + + associate( & + nyrs_crop_active => crop_inst%nyrs_crop_active_patch, & ! InOut: [integer (:) ] number of years this crop patch has been active + + t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2m air temperature (K) + gdd0 => temperature_inst%gdd0_patch , & ! Output: [real(r8) (:) ] growing deg. days base 0 deg C (ddays) + gdd8 => temperature_inst%gdd8_patch , & ! Output: [real(r8) (:) ] " " " " 8 " " " + gdd10 => temperature_inst%gdd10_patch , & ! Output: [real(r8) (:) ] " " " " 10 " " " + gdd020 => temperature_inst%gdd020_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd0 (ddays) + gdd820 => temperature_inst%gdd820_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd8 (ddays) + gdd1020 => temperature_inst%gdd1020_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd10 (ddays) + + tempavg_t2m => cnveg_state_inst%tempavg_t2m_patch & ! Output: [real(r8) (:) ] temp. avg 2m air temperature (K) + ) + + ! set time steps + + dayspyr = get_days_per_year() + + do fp = 1,num_soilp + p = filter_soilp(fp) + tempavg_t2m(p) = tempavg_t2m(p) + t_ref2m(p) * (fracday/dayspyr) + end do + + ! + ! The following crop related steps are done here rather than CropPhenology + ! so that they will be completed each time-step rather than with doalb. + ! + ! The following lines come from ibis's climate.f + stats.f + ! gdd SUMMATIONS ARE RELATIVE TO THE PLANTING DATE (see subr. updateAccFlds) + + if (num_pcropp > 0) then + ! get time-related info + call get_curr_date(kyr, kmo, kda, mcsec) + end if + + do fp = 1,num_pcropp + p = filter_pcropp(fp) + if (kmo == 1 .and. kda == 1 .and. nyrs_crop_active(p) == 0) then ! YR 1: + gdd020(p) = 0._r8 ! set gdd..20 variables to 0 + gdd820(p) = 0._r8 ! and crops will not be planted + gdd1020(p) = 0._r8 + end if + if (kmo == 1 .and. kda == 1 .and. mcsec == 0) then ! <-- END of EVERY YR: + if (nyrs_crop_active(p) == 1) then ! <-- END of YR 1 + gdd020(p) = gdd0(p) ! <-- END of YR 1 + gdd820(p) = gdd8(p) ! <-- END of YR 1 + gdd1020(p) = gdd10(p) ! <-- END of YR 1 + end if ! <-- END of YR 1 + gdd020(p) = (yravgm1* gdd020(p) + gdd0(p)) / yravg ! gdd..20 must be long term avgs + gdd820(p) = (yravgm1* gdd820(p) + gdd8(p)) / yravg ! so ignore results for yrs 1 & 2 + gdd1020(p) = (yravgm1* gdd1020(p) + gdd10(p)) / yravg + end if + end do + + end associate + + end subroutine CNPhenologyClimate + + !----------------------------------------------------------------------- + subroutine CNEvergreenPhenology (num_soilp, filter_soilp , & + cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + ! cnveg_state_inst) + ! + ! !DESCRIPTION: + ! For coupled carbon-nitrogen code (CN). + ! + ! !USES: + use clm_varcon , only : secspday + use clm_time_manager , only : get_days_per_year + use clm_varctl , only : CN_evergreen_phenology_opt + ! + ! !ARGUMENTS: + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(cnveg_state_type), intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + ! + ! !LOCAL VARIABLES: + real(r8):: dayspyr ! Days per year + integer :: p ! indices + integer :: fp ! lake filter patch index + + real(r8):: tranr + real(r8):: t1 ! temporary variable + !----------------------------------------------------------------------- + + associate( & + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + + evergreen => pftcon%evergreen , & ! Input: binary flag for evergreen leaf habit (0 or 1) + leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) + + woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) + + leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) leaf C storage + frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) fine root C storage + livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live stem C storage + deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) dead stem C storage + livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live coarse root C storage + deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) dead coarse root C storage + gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) growth respiration storage + leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) leaf C transfer + frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) fine root C transfer + livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) live stem C transfer + deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) dead stem C transfer + livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) live coarse root C transfer + deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) dead coarse root C transfer + + leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) leaf N storage + frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) fine root N storage + livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live stem N storage + deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) dead stem N storage + livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live coarse root N storage + deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) dead coarse root N storage + leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) leaf N transfer + frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) fine root N transfer + livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) live stem N transfer + deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) dead stem N transfer + livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) live coarse root N transfer + deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) dead coarse root N transfer + + leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! InOut: [real(r8) (:)] + frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! InOut: [real(r8) (:)] + livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! InOut: [real(r8) (:)] + deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! InOut: [real(r8) (:)] + livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! InOut: [real(r8) (:)] + deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! InOut: [real(r8) (:)] + + leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] + leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! InOut: [real(r8) (:)] + frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! InOut: [real(r8) (:)] + livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! InOut: [real(r8) (:)] + deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! InOut: [real(r8) (:)] + livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! InOut: [real(r8) (:)] + deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! InOut: [real(r8) (:)] + + bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) + bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) + lgsf => cnveg_state_inst%lgsf_patch & ! Output: [real(r8) (:) ] long growing season factor [0-1] + ) + + dayspyr = get_days_per_year() + + do fp = 1,num_soilp + p = filter_soilp(fp) + if (evergreen(ivt(p)) == 1._r8) then + bglfr(p) = 1._r8/(leaf_long(ivt(p)) * dayspyr * secspday) + bgtr(p) = 0._r8 + lgsf(p) = 0._r8 + end if + end do + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + if (CN_evergreen_phenology_opt == 1) then + do fp = 1,num_soilp + p = filter_soilp(fp) + if (evergreen(ivt(p)) == 1._r8) then + + tranr=0.0002_r8 + ! set carbon fluxes for shifting storage pools to transfer pools + leafc_storage_to_xfer(p) = tranr * leafc_storage(p)/dt + frootc_storage_to_xfer(p) = tranr * frootc_storage(p)/dt + if (woody(ivt(p)) == 1.0_r8) then + livestemc_storage_to_xfer(p) = tranr * livestemc_storage(p)/dt + deadstemc_storage_to_xfer(p) = tranr * deadstemc_storage(p)/dt + livecrootc_storage_to_xfer(p) = tranr * livecrootc_storage(p)/dt + deadcrootc_storage_to_xfer(p) = tranr * deadcrootc_storage(p)/dt + gresp_storage_to_xfer(p) = tranr * gresp_storage(p)/dt + end if + + ! set nitrogen fluxes for shifting storage pools to transfer pools + leafn_storage_to_xfer(p) = tranr * leafn_storage(p)/dt + frootn_storage_to_xfer(p) = tranr * frootn_storage(p)/dt + if (woody(ivt(p)) == 1.0_r8) then + livestemn_storage_to_xfer(p) = tranr * livestemn_storage(p)/dt + deadstemn_storage_to_xfer(p) = tranr * deadstemn_storage(p)/dt + livecrootn_storage_to_xfer(p) = tranr * livecrootn_storage(p)/dt + deadcrootn_storage_to_xfer(p) = tranr * deadcrootn_storage(p)/dt + end if + + t1 = 1.0_r8 / dt + + leafc_xfer_to_leafc(p) = t1 * leafc_xfer(p) + frootc_xfer_to_frootc(p) = t1 * frootc_xfer(p) + + leafn_xfer_to_leafn(p) = t1 * leafn_xfer(p) + frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) + if (woody(ivt(p)) == 1.0_r8) then + livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) + deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) + livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) + deadcrootc_xfer_to_deadcrootc(p) = t1 * deadcrootc_xfer(p) + + livestemn_xfer_to_livestemn(p) = t1 * livestemn_xfer(p) + deadstemn_xfer_to_deadstemn(p) = t1 * deadstemn_xfer(p) + livecrootn_xfer_to_livecrootn(p) = t1 * livecrootn_xfer(p) + deadcrootn_xfer_to_deadcrootn(p) = t1 * deadcrootn_xfer(p) + end if + + end if ! end of if (evergreen(ivt(p)) == 1._r8) then + + end do ! end of pft loop + + end if ! end of if (CN_evergreen_phenology_opt == 1) then + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + end associate + + end subroutine CNEvergreenPhenology + + !----------------------------------------------------------------------- + subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & + temperature_inst, cnveg_state_inst, dgvs_inst , & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + ! + ! !DESCRIPTION: + ! For coupled carbon-nitrogen code (CN). + ! This routine handles the seasonal deciduous phenology code (temperate + ! deciduous vegetation that has only one growing season per year). + ! + ! !USES: + use shr_const_mod , only: SHR_CONST_TKFRZ, SHR_CONST_PI + use clm_varcon , only: secspday + use clm_varctl , only: use_cndv + ! + ! !ARGUMENTS: + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(temperature_type) , intent(in) :: temperature_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(dgvs_type) , intent(inout) :: dgvs_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + ! + ! !LOCAL VARIABLES: + integer :: g,c,p !indices + integer :: fp !lake filter patch index + real(r8):: ws_flag !winter-summer solstice flag (0 or 1) + real(r8):: crit_onset_gdd !critical onset growing degree-day sum + real(r8):: soilt + !----------------------------------------------------------------------- + + associate( & + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) + prev_dayl => grc%prev_dayl , & ! Input: [real(r8) (:) ] daylength from previous time step (s) + + woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) + season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) + + t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) + + pftmayexist => dgvs_inst%pftmayexist_patch , & ! Output: [logical (:) ] exclude seasonal decid patches from tropics + + annavg_t2m => cnveg_state_inst%annavg_t2m_patch , & ! Input: [real(r8) (:) ] annual average 2m air temperature (K) + dormant_flag => cnveg_state_inst%dormant_flag_patch , & ! Output: [real(r8) (:) ] dormancy flag + days_active => cnveg_state_inst%days_active_patch , & ! Output: [real(r8) (:) ] number of days since last dormancy + onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag + onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter (seconds) + onset_gddflag => cnveg_state_inst%onset_gddflag_patch , & ! Output: [real(r8) (:) ] onset freeze flag + onset_gdd => cnveg_state_inst%onset_gdd_patch , & ! Output: [real(r8) (:) ] onset growing degree days + offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag + offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter (seconds) + bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) + bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) + lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] + + leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage + frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage + livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage + deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage + livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage + deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage + gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage + leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer + frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer + livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer + deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer + livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer + deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer + + leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage + frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage + livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage + deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage + livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage + deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage + leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer + frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) fine root N transfer + livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live stem N transfer + deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead stem N transfer + livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live coarse root N transfer + deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead coarse root N transfer + + prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) + prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) + leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] + frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] + livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] + deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] + livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] + deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] + leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + + leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] + frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] + livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] + deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] + livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] + deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] + leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] + ) + + ! start patch loop + do fp = 1,num_soilp + p = filter_soilp(fp) + c = patch%column(p) + g = patch%gridcell(p) + + if (season_decid(ivt(p)) == 1._r8) then + + ! set background litterfall rate, background transfer rate, and + ! long growing season factor to 0 for seasonal deciduous types + bglfr(p) = 0._r8 + bgtr(p) = 0._r8 + lgsf(p) = 0._r8 + + ! onset gdd sum from Biome-BGC, v4.1.2 + crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) + + ! set flag for solstice period (winter->summer = 1, summer->winter = 0) + if (dayl(g) >= prev_dayl(g)) then + ws_flag = 1._r8 + else + ws_flag = 0._r8 + end if + + ! update offset_counter and test for the end of the offset period + if (offset_flag(p) == 1.0_r8) then + ! decrement counter for offset period + offset_counter(p) = offset_counter(p) - dt + + ! if this is the end of the offset_period, reset phenology + ! flags and indices + if (offset_counter(p) == 0.0_r8) then + ! this code block was originally handled by call cn_offset_cleanup(p) + ! inlined during vectorization + + offset_flag(p) = 0._r8 + offset_counter(p) = 0._r8 + dormant_flag(p) = 1._r8 + days_active(p) = 0._r8 + if (use_cndv) then + pftmayexist(p) = .true. + end if + + ! reset the previous timestep litterfall flux memory + prev_leafc_to_litter(p) = 0._r8 + prev_frootc_to_litter(p) = 0._r8 + end if + end if + + ! update onset_counter and test for the end of the onset period + if (onset_flag(p) == 1.0_r8) then + ! decrement counter for onset period + onset_counter(p) = onset_counter(p) - dt + + ! if this is the end of the onset period, reset phenology + ! flags and indices + if (onset_counter(p) == 0.0_r8) then + ! this code block was originally handled by call cn_onset_cleanup(p) + ! inlined during vectorization + + onset_flag(p) = 0.0_r8 + onset_counter(p) = 0.0_r8 + ! set all transfer growth rates to 0.0 + leafc_xfer_to_leafc(p) = 0.0_r8 + frootc_xfer_to_frootc(p) = 0.0_r8 + leafn_xfer_to_leafn(p) = 0.0_r8 + frootn_xfer_to_frootn(p) = 0.0_r8 + if (woody(ivt(p)) == 1.0_r8) then + livestemc_xfer_to_livestemc(p) = 0.0_r8 + deadstemc_xfer_to_deadstemc(p) = 0.0_r8 + livecrootc_xfer_to_livecrootc(p) = 0.0_r8 + deadcrootc_xfer_to_deadcrootc(p) = 0.0_r8 + livestemn_xfer_to_livestemn(p) = 0.0_r8 + deadstemn_xfer_to_deadstemn(p) = 0.0_r8 + livecrootn_xfer_to_livecrootn(p) = 0.0_r8 + deadcrootn_xfer_to_deadcrootn(p) = 0.0_r8 + end if + ! set transfer pools to 0.0 + leafc_xfer(p) = 0.0_r8 + leafn_xfer(p) = 0.0_r8 + frootc_xfer(p) = 0.0_r8 + frootn_xfer(p) = 0.0_r8 + if (woody(ivt(p)) == 1.0_r8) then + livestemc_xfer(p) = 0.0_r8 + livestemn_xfer(p) = 0.0_r8 + deadstemc_xfer(p) = 0.0_r8 + deadstemn_xfer(p) = 0.0_r8 + livecrootc_xfer(p) = 0.0_r8 + livecrootn_xfer(p) = 0.0_r8 + deadcrootc_xfer(p) = 0.0_r8 + deadcrootn_xfer(p) = 0.0_r8 + end if + end if + end if + + ! test for switching from dormant period to growth period + if (dormant_flag(p) == 1.0_r8) then + + ! Test to turn on growing degree-day sum, if off. + ! switch on the growing degree day sum on the winter solstice + + if (onset_gddflag(p) == 0._r8 .and. ws_flag == 1._r8) then + onset_gddflag(p) = 1._r8 + onset_gdd(p) = 0._r8 + end if + + ! Test to turn off growing degree-day sum, if on. + ! This test resets the growing degree day sum if it gets past + ! the summer solstice without reaching the threshold value. + ! In that case, it will take until the next winter solstice + ! before the growing degree-day summation starts again. + + if (onset_gddflag(p) == 1._r8 .and. ws_flag == 0._r8) then + onset_gddflag(p) = 0._r8 + onset_gdd(p) = 0._r8 + end if + + ! if the gdd flag is set, and if the soil is above freezing + ! then accumulate growing degree days for onset trigger + + soilt = t_soisno(c,3) + if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then + onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday + end if + + ! set onset_flag if critical growing degree-day sum is exceeded + if (onset_gdd(p) > crit_onset_gdd) then + onset_flag(p) = 1.0_r8 + dormant_flag(p) = 0.0_r8 + onset_gddflag(p) = 0.0_r8 + onset_gdd(p) = 0.0_r8 + onset_counter(p) = ndays_on * secspday + + ! move all the storage pools into transfer pools, + ! where they will be transfered to displayed growth over the onset period. + ! this code was originally handled with call cn_storage_to_xfer(p) + ! inlined during vectorization + + ! set carbon fluxes for shifting storage pools to transfer pools + leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt + frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt + if (woody(ivt(p)) == 1.0_r8) then + livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt + deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt + livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt + deadcrootc_storage_to_xfer(p) = fstor2tran * deadcrootc_storage(p)/dt + gresp_storage_to_xfer(p) = fstor2tran * gresp_storage(p)/dt + end if + + ! set nitrogen fluxes for shifting storage pools to transfer pools + leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt + frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt + if (woody(ivt(p)) == 1.0_r8) then + livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt + deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt + livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt + deadcrootn_storage_to_xfer(p) = fstor2tran * deadcrootn_storage(p)/dt + end if + end if + + ! test for switching from growth period to offset period + else if (offset_flag(p) == 0.0_r8) then + if (use_cndv) then + ! If days_active > 355, then remove patch in + ! CNDVEstablishment at the end of the year. + ! days_active > 355 is a symptom of seasonal decid. patches occurring in + ! gridcells where dayl never drops below crit_dayl. + ! This results in TLAI>1e4 in a few gridcells. + days_active(p) = days_active(p) + fracday + if (days_active(p) > 355._r8) pftmayexist(p) = .false. + end if + + ! only begin to test for offset daylength once past the summer sol + if (ws_flag == 0._r8 .and. dayl(g) < crit_dayl) then + offset_flag(p) = 1._r8 + offset_counter(p) = ndays_off * secspday + prev_leafc_to_litter(p) = 0._r8 + prev_frootc_to_litter(p) = 0._r8 + end if + end if + + end if ! end if seasonal deciduous + + end do ! end of patch loop + + end associate + + end subroutine CNSeasonDecidPhenology + + !----------------------------------------------------------------------- + subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & + soilstate_inst, temperature_inst, atm2lnd_inst, wateratm2lndbulk_inst, cnveg_state_inst, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & + cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + ! + ! !DESCRIPTION: + ! This routine handles phenology for vegetation types, such as grasses and + ! tropical drought deciduous trees, that respond to cold and drought stress + ! signals and that can have multiple growing seasons in a given year. + ! This routine allows for the possibility that leaves might persist year-round + ! in the absence of a suitable stress trigger, by switching to an essentially + ! evergreen habit, but maintaining a deciduous leaf longevity, while waiting + ! for the next stress trigger. This is in contrast to the seasonal deciduous + ! algorithm (for temperate deciduous trees) that forces a single growing season + ! per year. + ! + ! !USES: + use clm_time_manager , only : get_days_per_year + use CNSharedParamsMod, only : use_fun + use clm_varcon , only : secspday + use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_PI + use CNSharedParamsMod, only : CNParamsShareInst + ! + ! !ARGUMENTS: + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(soilstate_type) , intent(in) :: soilstate_inst + type(temperature_type) , intent(in) :: temperature_inst + type(atm2lnd_type) , intent(in) :: atm2lnd_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + ! + ! !LOCAL VARIABLES: + real(r8),parameter :: secspqtrday = secspday / 4 ! seconds per quarter day + integer :: g,c,p ! indices + integer :: fp ! lake filter patch index + real(r8):: dayspyr ! days per year + real(r8):: crit_onset_gdd ! degree days for onset trigger + real(r8):: soilt ! temperature of top soil layer + real(r8):: psi ! water stress of top soil layer + real(r8):: rain_threshold ! rain threshold for leaf on [mm] + logical :: additional_onset_condition ! additional condition for leaf onset + !----------------------------------------------------------------------- + + associate( & + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) + + prec10 => wateratm2lndbulk_inst%prec10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of tot. precipitation + leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) + woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) + stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress-deciduous leaf habit (0 or 1) + + soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) + + t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) + dormant_flag => cnveg_state_inst%dormant_flag_patch , & ! Output: [real(r8) (:) ] dormancy flag + days_active => cnveg_state_inst%days_active_patch , & ! Output: [real(r8) (:) ] number of days since last dormancy + onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag + onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter (seconds) + onset_gddflag => cnveg_state_inst%onset_gddflag_patch , & ! Output: [real(r8) (:) ] onset freeze flag + onset_fdd => cnveg_state_inst%onset_fdd_patch , & ! Output: [real(r8) (:) ] onset freezing degree days counter + onset_gdd => cnveg_state_inst%onset_gdd_patch , & ! Output: [real(r8) (:) ] onset growing degree days + onset_swi => cnveg_state_inst%onset_swi_patch , & ! Output: [real(r8) (:) ] onset soil water index + offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag + offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter (seconds) + offset_fdd => cnveg_state_inst%offset_fdd_patch , & ! Output: [real(r8) (:) ] offset freezing degree days counter + offset_swi => cnveg_state_inst%offset_swi_patch , & ! Output: [real(r8) (:) ] offset soil water index + lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] + bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) + bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) + annavg_t2m => cnveg_state_inst%annavg_t2m_patch , & ! Output: [real(r8) (:) ] annual average 2m air temperature (K) + leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C + + frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C + leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage + frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage + livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage + deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage + livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage + deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage + gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage + leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer + frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer + livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer + deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer + livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer + deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer + leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage + frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage + livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage + deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage + livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage + deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage + leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer + frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) fine root N transfer + livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live stem N transfer + deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead stem N transfer + livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live coarse root N transfer + deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead coarse root N transfer + + prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) + prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) + leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] + frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] + livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] + deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] + livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] + deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] + leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + + leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] + frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] + livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] + deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] + livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] + deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] + leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] + ) + + ! set time steps + dayspyr = get_days_per_year() + + ! specify rain threshold for leaf onset + rain_threshold = 20._r8 + + do fp = 1,num_soilp + p = filter_soilp(fp) + c = patch%column(p) + g = patch%gridcell(p) + + if (stress_decid(ivt(p)) == 1._r8) then + soilt = t_soisno(c,3) + psi = soilpsi(c,3) + + ! onset gdd sum from Biome-BGC, v4.1.2 + crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) + + + ! update offset_counter and test for the end of the offset period + if (offset_flag(p) == 1._r8) then + ! decrement counter for offset period + offset_counter(p) = offset_counter(p) - dt + + ! if this is the end of the offset_period, reset phenology + ! flags and indices + if (offset_counter(p) == 0._r8) then + ! this code block was originally handled by call cn_offset_cleanup(p) + ! inlined during vectorization + offset_flag(p) = 0._r8 + offset_counter(p) = 0._r8 + dormant_flag(p) = 1._r8 + days_active(p) = 0._r8 + + ! reset the previous timestep litterfall flux memory + prev_leafc_to_litter(p) = 0._r8 + prev_frootc_to_litter(p) = 0._r8 + end if + end if + + ! update onset_counter and test for the end of the onset period + if (onset_flag(p) == 1.0_r8) then + ! decrement counter for onset period + onset_counter(p) = onset_counter(p) - dt + + ! if this is the end of the onset period, reset phenology + ! flags and indices + if (onset_counter(p) == 0.0_r8) then + ! this code block was originally handled by call cn_onset_cleanup(p) + ! inlined during vectorization + onset_flag(p) = 0._r8 + onset_counter(p) = 0._r8 + ! set all transfer growth rates to 0.0 + leafc_xfer_to_leafc(p) = 0._r8 + frootc_xfer_to_frootc(p) = 0._r8 + leafn_xfer_to_leafn(p) = 0._r8 + frootn_xfer_to_frootn(p) = 0._r8 + if (woody(ivt(p)) == 1.0_r8) then + livestemc_xfer_to_livestemc(p) = 0._r8 + deadstemc_xfer_to_deadstemc(p) = 0._r8 + livecrootc_xfer_to_livecrootc(p) = 0._r8 + deadcrootc_xfer_to_deadcrootc(p) = 0._r8 + livestemn_xfer_to_livestemn(p) = 0._r8 + deadstemn_xfer_to_deadstemn(p) = 0._r8 + livecrootn_xfer_to_livecrootn(p) = 0._r8 + deadcrootn_xfer_to_deadcrootn(p) = 0._r8 + end if + ! set transfer pools to 0.0 + leafc_xfer(p) = 0._r8 + leafn_xfer(p) = 0._r8 + frootc_xfer(p) = 0._r8 + frootn_xfer(p) = 0._r8 + if (woody(ivt(p)) == 1.0_r8) then + livestemc_xfer(p) = 0._r8 + livestemn_xfer(p) = 0._r8 + deadstemc_xfer(p) = 0._r8 + deadstemn_xfer(p) = 0._r8 + livecrootc_xfer(p) = 0._r8 + livecrootn_xfer(p) = 0._r8 + deadcrootc_xfer(p) = 0._r8 + deadcrootn_xfer(p) = 0._r8 + end if + end if + end if + + ! test for switching from dormant period to growth period + if (dormant_flag(p) == 1._r8) then + + ! keep track of the number of freezing degree days in this + ! dormancy period (only if the freeze flag has not previously been set + ! for this dormancy period + + if (onset_gddflag(p) == 0._r8 .and. soilt < SHR_CONST_TKFRZ) onset_fdd(p) = onset_fdd(p) + fracday + + ! if the number of freezing degree days exceeds a critical value, + ! then onset will require both wet soils and a critical soil + ! temperature sum. If this case is triggered, reset any previously + ! accumulated value in onset_swi, so that onset now depends on + ! the accumulated soil water index following the freeze trigger + + if (onset_fdd(p) > crit_onset_fdd) then + onset_gddflag(p) = 1._r8 + onset_fdd(p) = 0._r8 + onset_swi(p) = 0._r8 + end if + + ! if the freeze flag is set, and if the soil is above freezing + ! then accumulate growing degree days for onset trigger + + if (onset_gddflag(p) == 1._r8 .and. soilt > SHR_CONST_TKFRZ) then + onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday + end if + + ! if soils are wet, accumulate soil water index for onset trigger + additional_onset_condition = .true. + if(CNParamsShareInst%constrain_stress_deciduous_onset) then + ! if additional constraint condition not met, set to false + if ((prec10(p) * (3600.0_r8*10.0_r8*24.0_r8)) < rain_threshold) then + additional_onset_condition = .false. + endif + endif + + if (psi >= soilpsi_on) then + onset_swi(p) = onset_swi(p) + fracday + endif + + ! if critical soil water index is exceeded, set onset_flag, and + ! then test for soil temperature criteria + + ! Adding in Kyla's rainfall trigger when fun on. RF. prec10 (mm/s) needs to be higher than 8mm over 10 days. + + if (onset_swi(p) > crit_onset_swi.and. additional_onset_condition) then + onset_flag(p) = 1._r8 + + ! only check soil temperature criteria if freeze flag set since + ! beginning of last dormancy. If freeze flag set and growing + ! degree day sum (since freeze trigger) is lower than critical + ! value, then override the onset_flag set from soil water. + + if (onset_gddflag(p) == 1._r8 .and. onset_gdd(p) < crit_onset_gdd) onset_flag(p) = 0._r8 + end if + + ! only allow onset if dayl > 6hrs + if (onset_flag(p) == 1._r8 .and. dayl(g) <= secspqtrday) then + onset_flag(p) = 0._r8 + end if + + ! if this is the beginning of the onset period + ! then reset the phenology flags and indices + + if (onset_flag(p) == 1._r8) then + dormant_flag(p) = 0._r8 + days_active(p) = 0._r8 + onset_gddflag(p) = 0._r8 + onset_fdd(p) = 0._r8 + onset_gdd(p) = 0._r8 + onset_swi(p) = 0._r8 + onset_counter(p) = ndays_on * secspday + + ! call subroutine to move all the storage pools into transfer pools, + ! where they will be transfered to displayed growth over the onset period. + ! this code was originally handled with call cn_storage_to_xfer(p) + ! inlined during vectorization + + ! set carbon fluxes for shifting storage pools to transfer pools + leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt + frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt + if (woody(ivt(p)) == 1.0_r8) then + livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt + deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt + livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt + deadcrootc_storage_to_xfer(p) = fstor2tran * deadcrootc_storage(p)/dt + gresp_storage_to_xfer(p) = fstor2tran * gresp_storage(p)/dt + end if + + ! set nitrogen fluxes for shifting storage pools to transfer pools + leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt + frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt + if (woody(ivt(p)) == 1.0_r8) then + livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt + deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt + livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt + deadcrootn_storage_to_xfer(p) = fstor2tran * deadcrootn_storage(p)/dt + end if + end if + + ! test for switching from growth period to offset period + else if (offset_flag(p) == 0._r8) then + + ! if soil water potential lower than critical value, accumulate + ! as stress in offset soil water index + + if (psi <= soilpsi_off) then + offset_swi(p) = offset_swi(p) + fracday + + ! if the offset soil water index exceeds critical value, and + ! if this is not the middle of a previously initiated onset period, + ! then set flag to start the offset period and reset index variables + + if (offset_swi(p) >= crit_offset_swi .and. onset_flag(p) == 0._r8) offset_flag(p) = 1._r8 + + ! if soil water potential higher than critical value, reduce the + ! offset water stress index. By this mechanism, there must be a + ! sustained period of water stress to initiate offset. + + else if (psi >= soilpsi_on) then + offset_swi(p) = offset_swi(p) - fracday + offset_swi(p) = max(offset_swi(p),0._r8) + end if + + ! decrease freezing day accumulator for warm soil + if (offset_fdd(p) > 0._r8 .and. soilt > SHR_CONST_TKFRZ) then + offset_fdd(p) = offset_fdd(p) - fracday + offset_fdd(p) = max(0._r8, offset_fdd(p)) + end if + + ! increase freezing day accumulator for cold soil + if (soilt <= SHR_CONST_TKFRZ) then + offset_fdd(p) = offset_fdd(p) + fracday + + ! if freezing degree day sum is greater than critical value, initiate offset + if (offset_fdd(p) > crit_offset_fdd .and. onset_flag(p) == 0._r8) offset_flag(p) = 1._r8 + end if + + ! force offset if daylength is < 6 hrs + if (dayl(g) <= secspqtrday) then + offset_flag(p) = 1._r8 + end if + + ! if this is the beginning of the offset period + ! then reset flags and indices + if (offset_flag(p) == 1._r8) then + offset_fdd(p) = 0._r8 + offset_swi(p) = 0._r8 + offset_counter(p) = ndays_off * secspday + prev_leafc_to_litter(p) = 0._r8 + prev_frootc_to_litter(p) = 0._r8 + end if + end if + + ! keep track of number of days since last dormancy for control on + ! fraction of new growth to send to storage for next growing season + + if (dormant_flag(p) == 0.0_r8) then + days_active(p) = days_active(p) + fracday + end if + + ! calculate long growing season factor (lgsf) + ! only begin to calculate a lgsf greater than 0.0 once the number + ! of days active exceeds days/year. + lgsf(p) = max(min(3.0_r8*(days_active(p)-leaf_long(ivt(p))*dayspyr )/dayspyr, 1._r8),0._r8) + ! RosieF. 5 Nov 2015. Changed this such that the increase in leaf turnover is faster after + ! trees enter the 'fake evergreen' state. Otherwise, they have a whole year of + ! cheating, with less litterfall than they should have, resulting in very high LAI. + ! Further, the 'fake evergreen' state (where lgsf>0) is entered at the end of a single leaf lifespan + ! and not a whole year. The '3' is arbitrary, given that this entire system is quite abstract. + + + ! set background litterfall rate, when not in the phenological offset period + if (offset_flag(p) == 1._r8) then + bglfr(p) = 0._r8 + else + ! calculate the background litterfall rate (bglfr) + ! in units 1/s, based on leaf longevity (yrs) and correction for long growing season + + bglfr(p) = (1._r8/(leaf_long(ivt(p))*dayspyr*secspday))*lgsf(p) + end if + + ! set background transfer rate when active but not in the phenological onset period + if (onset_flag(p) == 1._r8) then + bgtr(p) = 0._r8 + else + ! the background transfer rate is calculated as the rate that would result + ! in complete turnover of the storage pools in one year at steady state, + ! once lgsf has reached 1.0 (after 730 days active). + + bgtr(p) = (1._r8/(dayspyr*secspday))*lgsf(p) + + ! set carbon fluxes for shifting storage pools to transfer pools + + ! reduced the amount of stored carbon flowing to display pool by only counting the delta + ! between leafc and leafc_store in the flux. RosieF, Nov5 2015. + leafc_storage_to_xfer(p) = max(0.0_r8,(leafc_storage(p)-leafc(p))) * bgtr(p) + frootc_storage_to_xfer(p) = max(0.0_r8,(frootc_storage(p)-frootc(p))) * bgtr(p) + if (woody(ivt(p)) == 1.0_r8) then + livestemc_storage_to_xfer(p) = livestemc_storage(p) * bgtr(p) + deadstemc_storage_to_xfer(p) = deadstemc_storage(p) * bgtr(p) + livecrootc_storage_to_xfer(p) = livecrootc_storage(p) * bgtr(p) + deadcrootc_storage_to_xfer(p) = deadcrootc_storage(p) * bgtr(p) + gresp_storage_to_xfer(p) = gresp_storage(p) * bgtr(p) + end if + + ! set nitrogen fluxes for shifting storage pools to transfer pools + leafn_storage_to_xfer(p) = leafn_storage(p) * bgtr(p) + frootn_storage_to_xfer(p) = frootn_storage(p) * bgtr(p) + if (woody(ivt(p)) == 1.0_r8) then + livestemn_storage_to_xfer(p) = livestemn_storage(p) * bgtr(p) + deadstemn_storage_to_xfer(p) = deadstemn_storage(p) * bgtr(p) + livecrootn_storage_to_xfer(p) = livecrootn_storage(p) * bgtr(p) + deadcrootn_storage_to_xfer(p) = deadcrootn_storage(p) * bgtr(p) + end if + end if + + end if ! end if stress deciduous + + end do ! end of patch loop + + end associate + + end subroutine CNStressDecidPhenology + + !----------------------------------------------------------------------- + subroutine CropPhenology(num_pcropp, filter_pcropp , & + waterdiagnosticbulk_inst, temperature_inst, crop_inst, canopystate_inst, cnveg_state_inst , & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst,& + c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst) + + ! !DESCRIPTION: + ! Code from AgroIBIS to determine crop phenology and code from CN to + ! handle CN fluxes during the phenological onset & offset periods. + + ! !USES: + use clm_time_manager , only : get_curr_date, get_curr_calday, get_days_per_year, get_rad_step_size + use pftconMod , only : ntmp_corn, nswheat, nwwheat, ntmp_soybean + use pftconMod , only : nirrig_tmp_corn, nirrig_swheat, nirrig_wwheat, nirrig_tmp_soybean + use pftconMod , only : ntrp_corn, nsugarcane, ntrp_soybean, ncotton, nrice + use pftconMod , only : nirrig_trp_corn, nirrig_sugarcane, nirrig_trp_soybean + use pftconMod , only : nirrig_cotton, nirrig_rice + + ! Y. Cheng + use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass + + use clm_varcon , only : spval, secspday + use clm_varctl , only : use_fertilizer + use clm_varctl , only : use_c13, use_c14 + use clm_varcon , only : c13ratio, c14ratio + ! + ! !ARGUMENTS: + integer , intent(in) :: num_pcropp ! number of prog crop patches in filter + integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(temperature_type) , intent(in) :: temperature_inst + type(crop_type) , intent(inout) :: crop_inst + type(canopystate_type) , intent(in) :: canopystate_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst + type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst + ! + ! LOCAL VARAIBLES: + integer kyr ! current year + integer kmo ! month of year (1, ..., 12) + integer kda ! day of month (1, ..., 31) + integer mcsec ! seconds of day (0, ..., seconds/day) + integer jday ! julian day of the year + integer fp,p ! patch indices + integer c ! column indices + integer g ! gridcell indices + integer h ! hemisphere indices + integer idpp ! number of days past planting + real(r8) :: dtrad ! radiation time step delta t (seconds) + real(r8) dayspyr ! days per year + real(r8) crmcorn ! comparitive relative maturity for corn + real(r8) ndays_on ! number of days to fertilize + !------------------------------------------------------------------------ + + associate( & + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + + leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) + leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) + manunitro => pftcon%manunitro , & ! Input: max manure to be applied in total (kgN/m2) + mxmat => pftcon%mxmat , & ! Input: + minplanttemp => pftcon%minplanttemp , & ! Input: + planttemp => pftcon%planttemp , & ! Input: + gddmin => pftcon%gddmin , & ! Input: + hybgdd => pftcon%hybgdd , & ! Input: + lfemerg => pftcon%lfemerg , & ! Input: + grnfill => pftcon%grnfill , & ! Input: + + t_ref2m_min => temperature_inst%t_ref2m_min_patch , & ! Input: [real(r8) (:) ] daily minimum of average 2 m height surface air temperature (K) + t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K) + a5tmin => temperature_inst%t_a5min_patch , & ! Input: [real(r8) (:) ] 5-day running mean of min 2-m temperature + a10tmin => temperature_inst%t_a10min_patch , & ! Input: [real(r8) (:) ] 10-day running mean of min 2-m temperature + gdd020 => temperature_inst%gdd020_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd0 + gdd820 => temperature_inst%gdd820_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd8 + gdd1020 => temperature_inst%gdd1020_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd10 + + fertnitro => crop_inst%fertnitro_patch , & ! Input: [real(r8) (:) ] fertilizer nitrogen + hui => crop_inst%gddplant_patch , & ! Input: [real(r8) (:) ] gdd since planting (gddplant) + leafout => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] gdd from top soil layer temperature + harvdate => crop_inst%harvdate_patch , & ! Output: [integer (:) ] harvest date + croplive => crop_inst%croplive_patch , & ! Output: [logical (:) ] Flag, true if planted, not harvested + cropplant => crop_inst%cropplant_patch , & ! Output: [logical (:) ] Flag, true if crop may be planted + vf => crop_inst%vf_patch , & ! Output: [real(r8) (:) ] vernalization factor + peaklai => cnveg_state_inst%peaklai_patch , & ! Output: [integer (:) ] 1: max allowed lai; 0: not at max + tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow + + idop => cnveg_state_inst%idop_patch , & ! Output: [integer (:) ] date of planting + gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Output: [real(r8) (:) ] gdd needed to harvest + huileaf => cnveg_state_inst%huileaf_patch , & ! Output: [real(r8) (:) ] heat unit index needed from planting to leaf emergence + huigrain => cnveg_state_inst%huigrain_patch , & ! Output: [real(r8) (:) ] same to reach vegetative maturity + cumvd => cnveg_state_inst%cumvd_patch , & ! Output: [real(r8) (:) ] cumulative vernalization d?ependence? + hdidx => cnveg_state_inst%hdidx_patch , & ! Output: [real(r8) (:) ] cold hardening index? + bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) + bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) + lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] + onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag + offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag + onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter + offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter + + leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer + + crop_seedc_to_leaf => cnveg_carbonflux_inst%crop_seedc_to_leaf_patch, & ! Output: [real(r8) (:) ] (gC/m2/s) seed source to leaf + + fert_counter => cnveg_nitrogenflux_inst%fert_counter_patch , & ! Output: [real(r8) (:) ] >0 fertilize; <=0 not (seconds) + leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer + crop_seedn_to_leaf => cnveg_nitrogenflux_inst%crop_seedn_to_leaf_patch, & ! Output: [real(r8) (:) ] (gN/m2/s) seed source to leaf + cphase => crop_inst%cphase_patch , & ! Output: [real(r8) (:)] phenology phase + fert => cnveg_nitrogenflux_inst%fert_patch & ! Output: [real(r8) (:) ] (gN/m2/s) fertilizer applied each timestep + ) + + ! get time info + dayspyr = get_days_per_year() + jday = get_curr_calday() + call get_curr_date(kyr, kmo, kda, mcsec) + dtrad = real( get_rad_step_size(), r8 ) + + if (use_fertilizer) then + ndays_on = 20._r8 ! number of days to fertilize + else + ndays_on = 0._r8 ! number of days to fertilize + end if + + do fp = 1, num_pcropp + p = filter_pcropp(fp) + c = patch%column(p) + g = patch%gridcell(p) + h = inhemi(p) + + ! background litterfall and transfer rates; long growing season factor + + bglfr(p) = 0._r8 ! this value changes later in a crop's life cycle + bgtr(p) = 0._r8 + lgsf(p) = 0._r8 + + ! --------------------------------- + ! from AgroIBIS subroutine planting + ! --------------------------------- + + ! in order to allow a crop to be planted only once each year + ! initialize cropplant = .false., but hold it = .true. through the end of the year + + ! initialize other variables that are calculated for crops + ! on an annual basis in cropresidue subroutine + + if ( jday == jdayyrstart(h) .and. mcsec == 0 )then + + ! make sure variables aren't changed at beginning of the year + ! for a crop that is currently planted, such as + ! WINTER TEMPERATE CEREAL = winter (wheat + barley + rye) + ! represented here by the winter wheat pft + + if (.not. croplive(p)) then + cropplant(p) = .false. + idop(p) = NOT_Planted + + ! keep next for continuous, annual winter temperate cereal crop; + ! if we removed elseif, + ! winter cereal grown continuously would amount to a cereal/fallow + ! rotation because cereal would only be planted every other year + + else if (croplive(p) .and. (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat)) then + cropplant(p) = .false. + ! else ! not possible to have croplive and ivt==cornORsoy? (slevis) + end if + + end if + + if ( (.not. croplive(p)) .and. (.not. cropplant(p)) ) then + + ! gdd needed for * chosen crop and a likely hybrid (for that region) * + ! to reach full physiological maturity + + ! based on accumulated seasonal average growing degree days from + ! April 1 - Sept 30 (inclusive) + ! for corn and soybeans in the United States - + ! decided upon by what the typical average growing season length is + ! and the gdd needed to reach maturity in those regions + + ! first choice is used for spring temperate cereal and/or soybeans and maize + + ! slevis: ibis reads xinpdate in io.f from control.crops.nc variable name 'plantdate' + ! According to Chris Kucharik, the dataset of + ! xinpdate was generated from a previous model run at 0.5 deg resolution + + ! winter temperate cereal : use gdd0 as a limit to plant winter cereal + + if (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat) then + + ! add check to only plant winter cereal after other crops (soybean, maize) + ! have been harvested + + ! *** remember order of planting is crucial - in terms of which crops you want + ! to be grown in what order *** + + ! in this case, corn or soybeans are assumed to be planted before + ! cereal would be in any particular year that both patches are allowed + ! to grow in the same grid cell (e.g., double-cropping) + + ! slevis: harvdate below needs cropplant(p) above to be cropplant(p,ivt(p)) + ! where ivt(p) has rotated to winter cereal because + ! cropplant through the end of the year for a harvested crop. + ! Also harvdate(p) should be harvdate(p,ivt(p)) and should be + ! updated on Jan 1st instead of at harvest (slevis) + if (a5tmin(p) /= spval .and. & + a5tmin(p) <= minplanttemp(ivt(p)) .and. & + jday >= minplantjday(ivt(p),h) .and. & + (gdd020(p) /= spval .and. & + gdd020(p) >= gddmin(ivt(p)))) then + + cumvd(p) = 0._r8 + hdidx(p) = 0._r8 + vf(p) = 0._r8 + croplive(p) = .true. + cropplant(p) = .true. + idop(p) = jday + harvdate(p) = NOT_Harvested + gddmaturity(p) = hybgdd(ivt(p)) + leafc_xfer(p) = initial_seed_at_planting + leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset + crop_seedc_to_leaf(p) = leafc_xfer(p)/dt + crop_seedn_to_leaf(p) = leafn_xfer(p)/dt + + ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope + ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise + if (use_c13) then + if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & + c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) + else + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio + endif + endif + if (use_c14) then + if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & + c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) + else + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio + endif + endif + + ! latest possible date to plant winter cereal and after all other + ! crops were harvested for that year + + else if (jday >= maxplantjday(ivt(p),h) .and. & + gdd020(p) /= spval .and. & + gdd020(p) >= gddmin(ivt(p))) then + + cumvd(p) = 0._r8 + hdidx(p) = 0._r8 + vf(p) = 0._r8 + croplive(p) = .true. + cropplant(p) = .true. + idop(p) = jday + harvdate(p) = NOT_Harvested + gddmaturity(p) = hybgdd(ivt(p)) + leafc_xfer(p) = initial_seed_at_planting + leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset + crop_seedc_to_leaf(p) = leafc_xfer(p)/dt + crop_seedn_to_leaf(p) = leafn_xfer(p)/dt + + ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope + ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise + if (use_c13) then + if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & + c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) + else + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio + endif + endif + if (use_c14) then + if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & + c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) + else + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio + endif + endif + else + gddmaturity(p) = 0._r8 + end if + + else ! not winter cereal... slevis: added distinction between NH and SH + ! slevis: The idea is that jday will equal idop sooner or later in the year + ! while the gdd part is either true or false for the year. + if (t10(p) /= spval.and. a10tmin(p) /= spval .and. & + t10(p) > planttemp(ivt(p)) .and. & + a10tmin(p) > minplanttemp(ivt(p)) .and. & + jday >= minplantjday(ivt(p),h) .and. & + jday <= maxplantjday(ivt(p),h) .and. & + t10(p) /= spval .and. a10tmin(p) /= spval .and. & + gdd820(p) /= spval .and. & + gdd820(p) >= gddmin(ivt(p))) then + + ! impose limit on growing season length needed + ! for crop maturity - for cold weather constraints + croplive(p) = .true. + cropplant(p) = .true. + idop(p) = jday + harvdate(p) = NOT_Harvested + + ! go a specified amount of time before/after + ! climatological date + if (ivt(p) == ntmp_soybean .or. ivt(p) == nirrig_tmp_soybean .or. & + ivt(p) == ntrp_soybean .or. ivt(p) == nirrig_trp_soybean) then + gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) + end if + + ! Y. Cheng, add switchgrass and Miscanthus + if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & + ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & + ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & + ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & + ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then + gddmaturity(p) = max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) + gddmaturity(p) = max(950._r8, min(gddmaturity(p)+150._r8, 1850._r8)) + end if + if (ivt(p) == nswheat .or. ivt(p) == nirrig_swheat .or. & + ivt(p) == ncotton .or. ivt(p) == nirrig_cotton .or. & + ivt(p) == nrice .or. ivt(p) == nirrig_rice) then + gddmaturity(p) = min(gdd020(p), hybgdd(ivt(p))) + end if + + leafc_xfer(p) = initial_seed_at_planting + leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset + crop_seedc_to_leaf(p) = leafc_xfer(p)/dt + crop_seedn_to_leaf(p) = leafn_xfer(p)/dt + + ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope + ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise + if (use_c13) then + if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & + c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) + else + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio + endif + endif + if (use_c14) then + if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & + c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) + else + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio + endif + endif + + + ! If hit the max planting julian day -- go ahead and plant + else if (jday == maxplantjday(ivt(p),h) .and. gdd820(p) > 0._r8 .and. & + gdd820(p) /= spval ) then + croplive(p) = .true. + cropplant(p) = .true. + idop(p) = jday + harvdate(p) = NOT_Harvested + + if (ivt(p) == ntmp_soybean .or. ivt(p) == nirrig_tmp_soybean .or. & + ivt(p) == ntrp_soybean .or. ivt(p) == nirrig_trp_soybean) then + gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) + end if + + ! Y. Cheng, add switchgrass and Miscanthus + if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & + ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & + ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & + ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & + ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then + gddmaturity(p) = max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) + end if + if (ivt(p) == nswheat .or. ivt(p) == nirrig_swheat .or. & + ivt(p) == ncotton .or. ivt(p) == nirrig_cotton .or. & + ivt(p) == nrice .or. ivt(p) == nirrig_rice) then + gddmaturity(p) = min(gdd020(p), hybgdd(ivt(p))) + end if + + leafc_xfer(p) = initial_seed_at_planting + leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset + crop_seedc_to_leaf(p) = leafc_xfer(p)/dt + crop_seedn_to_leaf(p) = leafn_xfer(p)/dt + + ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope + ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise + if (use_c13) then + if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & + c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) + else + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio + endif + endif + if (use_c14) then + if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & + c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) + else + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio + endif + endif + + else + gddmaturity(p) = 0._r8 + end if + end if ! crop patch distinction + + ! crop phenology (gdd thresholds) controlled by gdd needed for + ! maturity (physiological) which is based on the average gdd + ! accumulation and hybrids in United States from April 1 - Sept 30 + + ! calculate threshold from phase 1 to phase 2: + ! threshold for attaining leaf emergence (based on fraction of + ! gdd(i) -- climatological average) + ! Hayhoe and Dwyer, 1990, Can. J. Soil Sci 70:493-497 + ! Carlson and Gage, 1989, Agric. For. Met., 45: 313-324 + ! J.T. Ritchie, 1991: Modeling Plant and Soil systems + + huileaf(p) = lfemerg(ivt(p)) * gddmaturity(p) ! 3-7% in cereal + + ! calculate threshhold from phase 2 to phase 3: + ! from leaf emergence to beginning of grain-fill period + ! this hypothetically occurs at the end of tassling, not the beginning + ! tassel initiation typically begins at 0.5-0.55 * gddmaturity + + ! calculate linear relationship between huigrain fraction and relative + ! maturity rating for maize + + ! Y. Cheng, add switchgrass and Miscanthus + if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & + ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & + ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & + ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & + ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then + ! the following estimation of crmcorn from gddmaturity is based on a linear + ! regression using data from Pioneer-brand corn hybrids (Kucharik, 2003, + ! Earth Interactions 7:1-33: fig. 2) + crmcorn = max(73._r8, min(135._r8, (gddmaturity(p)+ 53.683_r8)/13.882_r8)) + + ! the following adjustment of grnfill based on crmcorn is based on a tuning + ! of Agro-IBIS to give reasonable results for max LAI and the seasonal + ! progression of LAI growth (pers. comm. C. Kucharik June 10, 2010) + huigrain(p) = -0.002_r8 * (crmcorn - 73._r8) + grnfill(ivt(p)) + + huigrain(p) = min(max(huigrain(p), grnfill(ivt(p))-0.1_r8), grnfill(ivt(p))) + huigrain(p) = huigrain(p) * gddmaturity(p) ! Cabelguenne et + else + huigrain(p) = grnfill(ivt(p)) * gddmaturity(p) ! al. 1999 + end if + + end if ! crop not live nor planted + + ! ---------------------------------- + ! from AgroIBIS subroutine phenocrop + ! ---------------------------------- + + ! all of the phenology changes are based on the total number of gdd needed + ! to change to the next phase - based on fractions of the total gdd typical + ! for that region based on the April 1 - Sept 30 window of development + + ! crop phenology (gdd thresholds) controlled by gdd needed for + ! maturity (physiological) which is based on the average gdd + ! accumulation and hybrids in United States from April 1 - Sept 30 + + ! Phase 1: Planting to leaf emergence (now in CNAllocation) + ! Phase 2: Leaf emergence to beginning of grain fill (general LAI accumulation) + ! Phase 3: Grain fill to physiological maturity and harvest (LAI decline) + ! Harvest: if gdd past grain fill initiation exceeds limit + ! or number of days past planting reaches a maximum, the crop has + ! reached physiological maturity and plant is harvested; + ! crop could be live or dead at this stage - these limits + ! could lead to reaching physiological maturity or determining + ! a harvest date for a crop killed by an early frost (see next comments) + ! --- --- --- + ! keeping comments without the code (slevis): + ! if minimum temperature, t_ref2m_min <= freeze kill threshold, tkill + ! for 3 consecutive days and lai is above a minimum, + ! plant will be damaged/killed. This function is more for spring freeze events + ! or for early fall freeze events + + ! spring temperate cereal is affected by this, winter cereal kill function + ! is determined in crops.f - is a more elaborate function of + ! cold hardening of the plant + + ! currently simulates too many grid cells killed by freezing temperatures + + ! removed on March 12 2002 - C. Kucharik + ! until it can be a bit more refined, or used at a smaller scale. + ! we really have no way of validating this routine + ! too difficult to implement on 0.5 degree scale grid cells + ! --- --- --- + + onset_flag(p) = 0._r8 ! CN terminology to trigger certain + offset_flag(p) = 0._r8 ! carbon and nitrogen transfers + + if (croplive(p)) then + cphase(p) = 1._r8 + + ! call vernalization if winter temperate cereal planted, living, and the + ! vernalization factor is not 1; + ! vf affects the calculation of gddtsoi & gddplant + + if (t_ref2m_min(p) < 1.e30_r8 .and. vf(p) /= 1._r8 .and. & + (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat)) then + call vernalization(p, & + canopystate_inst, temperature_inst, waterdiagnosticbulk_inst, cnveg_state_inst, & + crop_inst) + end if + + ! days past planting may determine harvest + + if (jday >= idop(p)) then + idpp = jday - idop(p) + else + idpp = int(dayspyr) + jday - idop(p) + end if + + ! onset_counter initialized to zero when .not. croplive + ! offset_counter relevant only at time step of harvest + + onset_counter(p) = onset_counter(p) - dt + + ! enter phase 2 onset for one time step: + ! transfer seed carbon to leaf emergence + + if (peaklai(p) >= 1) then + hui(p) = max(hui(p),huigrain(p)) + endif + + if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat(ivt(p))) then + cphase(p) = 2._r8 + if (abs(onset_counter(p)) > 1.e-6_r8) then + onset_flag(p) = 1._r8 + onset_counter(p) = dt + fert_counter(p) = ndays_on * secspday + if (ndays_on .gt. 0) then + fert(p) = (manunitro(ivt(p)) * 1000._r8 + fertnitro(p))/ fert_counter(p) + else + fert(p) = 0._r8 + end if + else + ! this ensures no re-entry to onset of phase2 + ! b/c onset_counter(p) = onset_counter(p) - dt + ! at every time step + + onset_counter(p) = dt + end if + + ! enter harvest for one time step: + ! - transfer live biomass to litter and to crop yield + ! - send xsmrpool to the atmosphere + ! if onset and harvest needed to last longer than one timestep + ! the onset_counter would change from dt and you'd need to make + ! changes to the offset subroutine below + + else if (hui(p) >= gddmaturity(p) .or. idpp >= mxmat(ivt(p))) then + if (harvdate(p) >= NOT_Harvested) harvdate(p) = jday + croplive(p) = .false. ! no re-entry in greater if-block + cphase(p) = 4._r8 + if (tlai(p) > 0._r8) then ! plant had emerged before harvest + offset_flag(p) = 1._r8 + offset_counter(p) = dt + else ! plant never emerged from the ground + ! Revert planting transfers; this will replenish the crop seed deficit. + ! We subtract from any existing value in crop_seedc_to_leaf / + ! crop_seedn_to_leaf in the unlikely event that we enter this block of + ! code in the same time step where the planting transfer originally + ! occurred. + crop_seedc_to_leaf(p) = crop_seedc_to_leaf(p) - leafc_xfer(p)/dt + crop_seedn_to_leaf(p) = crop_seedn_to_leaf(p) - leafn_xfer(p)/dt + leafc_xfer(p) = 0._r8 + leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) + if (use_c13) then + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 + endif + if (use_c14) then + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 + endif + + end if + + ! enter phase 3 while previous criteria fail and next is true; + ! in terms of order, phase 3 occurs before harvest, but when + ! harvest *can* occur, we want it to have first priority. + ! AgroIBIS uses a complex formula for lai decline. + ! Use CN's simple formula at least as a place holder (slevis) + + else if (hui(p) >= huigrain(p)) then + cphase(p) = 3._r8 + bglfr(p) = 1._r8/(leaf_long(ivt(p))*dayspyr*secspday) + end if + + ! continue fertilizer application while in phase 2; + ! assumes that onset of phase 2 took one time step only + + if (fert_counter(p) <= 0._r8) then + fert(p) = 0._r8 + else ! continue same fert application every timestep + fert_counter(p) = fert_counter(p) - dtrad + end if + + else ! crop not live + ! next 2 lines conserve mass if leaf*_xfer > 0 due to interpinic. + ! We subtract from any existing value in crop_seedc_to_leaf / + ! crop_seedn_to_leaf in the unlikely event that we enter this block of + ! code in the same time step where the planting transfer originally + ! occurred. + crop_seedc_to_leaf(p) = crop_seedc_to_leaf(p) - leafc_xfer(p)/dt + crop_seedn_to_leaf(p) = crop_seedn_to_leaf(p) - leafn_xfer(p)/dt + onset_counter(p) = 0._r8 + leafc_xfer(p) = 0._r8 + leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) + if (use_c13) then + c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 + endif + if (use_c14) then + c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 + endif + end if ! croplive + + end do ! prognostic crops loop + + end associate + + end subroutine CropPhenology + + !----------------------------------------------------------------------- + subroutine CropPhenologyInit(bounds) + ! + ! !DESCRIPTION: + ! Initialization of CropPhenology. Must be called after time-manager is + ! initialized, and after pftcon file is read in. + ! + ! !USES: + use pftconMod , only: npcropmin, npcropmax + use clm_time_manager, only: get_calday + ! + ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds + ! + ! LOCAL VARAIBLES: + integer :: p,g,n,i ! indices + !------------------------------------------------------------------------ + + allocate( inhemi(bounds%begp:bounds%endp) ) + + allocate( minplantjday(0:maxveg,inSH)) ! minimum planting julian day + allocate( maxplantjday(0:maxveg,inSH)) ! minimum planting julian day + + ! Julian day for the start of the year (mid-winter) + jdayyrstart(inNH) = 1 + jdayyrstart(inSH) = 182 + + ! Convert planting dates into julian day + minplantjday(:,:) = huge(1) + maxplantjday(:,:) = huge(1) + do n = npcropmin, npcropmax + if (pftcon%is_pft_known_to_model(n)) then + minplantjday(n, inNH) = int( get_calday( pftcon%mnNHplantdate(n), 0 ) ) + maxplantjday(n, inNH) = int( get_calday( pftcon%mxNHplantdate(n), 0 ) ) + + minplantjday(n, inSH) = int( get_calday( pftcon%mnSHplantdate(n), 0 ) ) + maxplantjday(n, inSH) = int( get_calday( pftcon%mxSHplantdate(n), 0 ) ) + end if + end do + + ! Figure out what hemisphere each PATCH is in + do p = bounds%begp, bounds%endp + g = patch%gridcell(p) + ! Northern hemisphere + if ( grc%latdeg(g) > 0.0_r8 )then + inhemi(p) = inNH + else + inhemi(p) = inSH + end if + end do + + ! + ! Constants for Crop vernalization + ! + ! photoperiod factor calculation + ! genetic constant - can be modified + + p1d = 0.004_r8 ! average for genotypes from Ritchey, 1991. + ! Modeling plant & soil systems: Wheat phasic developmt + p1v = 0.003_r8 ! average for genotypes from Ritchey, 1991. + + hti = 1._r8 + tbase = 0._r8 + + end subroutine CropPhenologyInit + + !----------------------------------------------------------------------- + subroutine vernalization(p, & + canopystate_inst, temperature_inst, waterdiagnosticbulk_inst, cnveg_state_inst, crop_inst) + ! + ! !DESCRIPTION: + ! + ! * * * only call for winter temperate cereal * * * + ! + ! subroutine calculates vernalization and photoperiod effects on + ! gdd accumulation in winter temperate cereal varieties. Thermal time accumulation + ! is reduced in 1st period until plant is fully vernalized. During this + ! time of emergence to spikelet formation, photoperiod can also have a + ! drastic effect on plant development. + ! + ! !ARGUMENTS: + integer , intent(in) :: p ! PATCH index running over + type(canopystate_type) , intent(in) :: canopystate_inst + type(temperature_type) , intent(in) :: temperature_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(crop_type) , intent(inout) :: crop_inst + ! + ! LOCAL VARAIBLES: + real(r8) tcrown ! ? + real(r8) vd, vd1, vd2 ! vernalization dependence + real(r8) tkil ! Freeze kill threshold + integer c,g ! indices + !------------------------------------------------------------------------ + + associate( & + tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow + + t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2 m height surface air temperature (K) + t_ref2m_min => temperature_inst%t_ref2m_min_patch , & ! Input: [real(r8) (:) ] daily minimum of average 2 m height surface air temperature (K) + t_ref2m_max => temperature_inst%t_ref2m_max_patch , & ! Input: [real(r8) (:) ] daily maximum of average 2 m height surface air temperature (K) + + snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) + + hdidx => cnveg_state_inst%hdidx_patch , & ! Output: [real(r8) (:) ] cold hardening index? + cumvd => cnveg_state_inst%cumvd_patch , & ! Output: [real(r8) (:) ] cumulative vernalization d?ependence? + gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Output: [real(r8) (:) ] gdd needed to harvest + huigrain => cnveg_state_inst%huigrain_patch , & ! Output: [real(r8) (:) ] heat unit index needed to reach vegetative maturity + + vf => crop_inst%vf_patch & ! Output: [real(r8) (:) ] vernalization factor for cereal + ) + + c = patch%column(p) + + ! for all equations - temperatures must be in degrees (C) + ! calculate temperature of crown of crop (e.g., 3 cm soil temperature) + ! snow depth in centimeters + + if (t_ref2m(p) < tfrz) then !slevis: t_ref2m inst of td=daily avg (K) + tcrown = 2._r8 + (t_ref2m(p) - tfrz) * (0.4_r8 + 0.0018_r8 * & + (min(snow_depth(c)*100._r8, 15._r8) - 15._r8)**2) + else !slevis: snow_depth inst of adsnod=daily average (m) + tcrown = t_ref2m(p) - tfrz + end if + + ! vernalization factor calculation + ! if vf(p) = 1. then plant is fully vernalized - and thermal time + ! accumulation in phase 1 will be unaffected + ! refers to gddtsoi & gddplant, defined in the accumulation routines (slevis) + ! reset vf, cumvd, and hdidx to 0 at planting of crop (slevis) + + if (t_ref2m_max(p) > tfrz) then + if (t_ref2m_min(p) <= tfrz+15._r8) then + vd1 = 1.4_r8 - 0.0778_r8 * tcrown + vd2 = 0.5_r8 + 13.44_r8 / ((t_ref2m_max(p)-t_ref2m_min(p)+3._r8)**2) * tcrown + vd = max(0._r8, min(1._r8, vd1, vd2)) + cumvd(p) = cumvd(p) + vd + end if + + if (cumvd(p) < 10._r8 .and. t_ref2m_max(p) > tfrz+30._r8) then + cumvd(p) = cumvd(p) - 0.5_r8 * (t_ref2m_max(p) - tfrz - 30._r8) + end if + cumvd(p) = max(0._r8, cumvd(p)) ! must be > 0 + + vf(p) = 1._r8 - p1v * (50._r8 - cumvd(p)) + vf(p) = max(0._r8, min(vf(p), 1._r8)) ! must be between 0 - 1 + end if + + ! calculate cold hardening of plant + ! determines for winter cereal varieties whether the plant has completed + ! a period of cold hardening to protect it from freezing temperatures. If + ! not, then exposure could result in death or killing of plants. + + ! there are two distinct phases of hardening + + if (t_ref2m_min(p) <= tfrz-3._r8 .or. hdidx(p) /= 0._r8) then + if (hdidx(p) >= hti) then ! done with phase 1 + hdidx(p) = hdidx(p) + 0.083_r8 + hdidx(p) = min(hdidx(p), hti*2._r8) + end if + + if (t_ref2m_max(p) >= tbase + tfrz + 10._r8) then + hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) + if (hdidx(p) > hti) hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) + hdidx(p) = max(0._r8, hdidx(p)) + end if + + else if (tcrown >= tbase-1._r8) then + if (tcrown <= tbase+8._r8) then + hdidx(p) = hdidx(p) + 0.1_r8 - (tcrown-tbase+3.5_r8)**2 / 506._r8 + if (hdidx(p) >= hti .and. tcrown <= tbase + 0._r8) then + hdidx(p) = hdidx(p) + 0.083_r8 + hdidx(p) = min(hdidx(p), hti*2._r8) + end if + end if + + if (t_ref2m_max(p) >= tbase + tfrz + 10._r8) then + hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) + if (hdidx(p) > hti) hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) + hdidx(p) = max(0._r8, hdidx(p)) + end if + end if + + ! calculate what the cereal killing temperature + ! there is a linear inverse relationship between + ! hardening of the plant and the killing temperature or + ! threshold that the plant can withstand + ! when plant is fully-hardened (hdidx = 2), the killing threshold is -18 C + + ! will have to develop some type of relationship that reduces LAI and + ! biomass pools in response to cold damaged crop + + if (t_ref2m_min(p) <= tfrz - 6._r8) then + tkil = (tbase - 6._r8) - 6._r8 * hdidx(p) + if (tkil >= tcrown) then + if ((0.95_r8 - 0.02_r8 * (tcrown - tkil)**2) >= 0.02_r8) then + write (iulog,*) 'crop damaged by cold temperatures at p,c =', p,c + else if (tlai(p) > 0._r8) then ! slevis: kill if past phase1 + gddmaturity(p) = 0._r8 ! by forcing through + huigrain(p) = 0._r8 ! harvest + write (iulog,*) '95% of crop killed by cold temperatures at p,c =', p,c + end if + end if + end if + + end associate + + end subroutine vernalization + + !----------------------------------------------------------------------- + subroutine CNOnsetGrowth (num_soilp, filter_soilp, & + cnveg_state_inst, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + ! + ! !DESCRIPTION: + ! Determines the flux of stored C and N from transfer pools to display + ! pools during the phenological onset period. + ! + ! !ARGUMENTS: + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(cnveg_state_type) , intent(in) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + ! + ! !LOCAL VARIABLES: + integer :: p ! indices + integer :: fp ! lake filter patch index + real(r8):: t1 ! temporary variable + !----------------------------------------------------------------------- + + associate( & + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + + woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) + + onset_flag => cnveg_state_inst%onset_flag_patch , & ! Input: [real(r8) (:) ] onset flag + onset_counter => cnveg_state_inst%onset_counter_patch , & ! Input: [real(r8) (:) ] onset days counter + bgtr => cnveg_state_inst%bgtr_patch , & ! Input: [real(r8) (:) ] background transfer growth rate (1/s) + + leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer + frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer + livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C transfer + deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C transfer + livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer + deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer + + leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N transfer + frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N transfer + livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N transfer + deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N transfer + livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N transfer + deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N transfer + + leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] + frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] + livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] + deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] + livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] + deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] + + leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] + frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] + livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] + deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] + livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] + deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch & ! Output: [real(r8) (:) ] + ) + + ! patch loop + do fp = 1,num_soilp + p = filter_soilp(fp) + + ! only calculate these fluxes during onset period + if (onset_flag(p) == 1._r8) then + + ! The transfer rate is a linearly decreasing function of time, + ! going to zero on the last timestep of the onset period + + if (onset_counter(p) == dt) then + t1 = 1.0_r8 / dt + else + t1 = 2.0_r8 / (onset_counter(p)) + end if + leafc_xfer_to_leafc(p) = t1 * leafc_xfer(p) + frootc_xfer_to_frootc(p) = t1 * frootc_xfer(p) + leafn_xfer_to_leafn(p) = t1 * leafn_xfer(p) + frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) + if (woody(ivt(p)) == 1.0_r8) then + livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) + deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) + livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) + deadcrootc_xfer_to_deadcrootc(p) = t1 * deadcrootc_xfer(p) + livestemn_xfer_to_livestemn(p) = t1 * livestemn_xfer(p) + deadstemn_xfer_to_deadstemn(p) = t1 * deadstemn_xfer(p) + livecrootn_xfer_to_livecrootn(p) = t1 * livecrootn_xfer(p) + deadcrootn_xfer_to_deadcrootn(p) = t1 * deadcrootn_xfer(p) + end if + + end if ! end if onset period + + ! calculate the background rate of transfer growth (used for stress + ! deciduous algorithm). In this case, all of the mass in the transfer + ! pools should be moved to displayed growth in each timestep. + + if (bgtr(p) > 0._r8) then + leafc_xfer_to_leafc(p) = leafc_xfer(p) / dt + frootc_xfer_to_frootc(p) = frootc_xfer(p) / dt + leafn_xfer_to_leafn(p) = leafn_xfer(p) / dt + frootn_xfer_to_frootn(p) = frootn_xfer(p) / dt + if (woody(ivt(p)) == 1.0_r8) then + livestemc_xfer_to_livestemc(p) = livestemc_xfer(p) / dt + deadstemc_xfer_to_deadstemc(p) = deadstemc_xfer(p) / dt + livecrootc_xfer_to_livecrootc(p) = livecrootc_xfer(p) / dt + deadcrootc_xfer_to_deadcrootc(p) = deadcrootc_xfer(p) / dt + livestemn_xfer_to_livestemn(p) = livestemn_xfer(p) / dt + deadstemn_xfer_to_deadstemn(p) = deadstemn_xfer(p) / dt + livecrootn_xfer_to_livecrootn(p) = livecrootn_xfer(p) / dt + deadcrootn_xfer_to_deadcrootn(p) = deadcrootn_xfer(p) / dt + end if + end if ! end if bgtr + + end do ! end patch loop + + end associate + + end subroutine CNOnsetGrowth + + !----------------------------------------------------------------------- + subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & + cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + ! + ! !DESCRIPTION: + ! Determines the flux of C and N from displayed pools to litter + ! pools during the phenological offset period. + ! + ! !USES: + use pftconMod , only : npcropmin + ! Y. Cheng + use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass + + use CNSharedParamsMod, only : use_fun + use clm_varctl , only : CNratio_floating + ! + ! !ARGUMENTS: + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type), intent(in) :: cnveg_nitrogenstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + ! + ! !LOCAL VARIABLES: + integer :: p, c ! indices + integer :: fp ! lake filter patch index + real(r8):: t1 ! temporary variable + real(r8):: denom ! temporary variable for divisor + real(r8) :: ntovr_leaf + real(r8) :: fr_leafn_to_litter ! fraction of the nitrogen turnover that goes to litter; remaining fraction is retranslocated + !----------------------------------------------------------------------- + + associate( & + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + + leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) + + ! Y. Cheng, add a new cut fraction for harvest parameter for bioenergy crops (miscanthus and switchgrass) + harvfrac => pftcon%harvfrac , & ! Input: cut fraction for harvest (-) + + lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) + frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) + graincn => pftcon%graincn , & ! Input: grain C:N (gC/gN) + + offset_flag => cnveg_state_inst%offset_flag_patch , & ! Input: [real(r8) (:) ] offset flag + offset_counter => cnveg_state_inst%offset_counter_patch , & ! Input: [real(r8) (:) ] offset days counter + + leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C + frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C + grainc => cnveg_carbonstate_inst%grainc_patch , & ! Input: [real(r8) (:) ] (gC/m2) grain C + cropseedc_deficit => cnveg_carbonstate_inst%cropseedc_deficit_patch , & ! Input: [real(r8) (:) ] (gC/m2) crop seed C deficit + livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) livestem C + cropseedn_deficit => cnveg_nitrogenstate_inst%cropseedn_deficit_patch , & ! Input: [real(r8) (:) ] (gC/m2) crop seed N deficit + livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) livestem N + + cpool_to_grainc => cnveg_carbonflux_inst%cpool_to_grainc_patch , & ! Input: [real(r8) (:) ] allocation to grain C (gC/m2/s) + npool_to_grainn => cnveg_nitrogenflux_inst%npool_to_grainn_patch , & ! Input: [real(r8) (:) ] allocation to grain N (gN/m2/s) + grainn => cnveg_nitrogenstate_inst%grainn_patch , & ! Input: [real(r8) (:) ] (kgN/m2) grain N + cpool_to_livestemc => cnveg_carbonflux_inst%cpool_to_livestemc_patch , & ! Input: [real(r8) (:) ] allocation to live stem C (gC/m2/s) + cpool_to_leafc => cnveg_carbonflux_inst%cpool_to_leafc_patch , & ! Input: [real(r8) (:) ] allocation to leaf C (gC/m2/s) + cpool_to_frootc => cnveg_carbonflux_inst%cpool_to_frootc_patch , & ! Input: [real(r8) (:) ] allocation to fine root C (gC/m2/s) + prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) + prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) + leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) (:) ] leaf C litterfall (gC/m2/s) + frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Output: [real(r8) (:) ] fine root C litterfall (gC/m2/s) + livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Output: [real(r8) (:) ] live stem C litterfall (gC/m2/s) + grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Output: [real(r8) (:) ] grain C to food (gC/m2/s) + + ! Y. Cheng, put the cut fraction during offset period for bioenergy crops to this biofuelc_harvest flux + biofuelc_harvest => cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Output: [real(r8) (:) ] biofuel C that was cutted at harvest (gC/m2/s) + + grainc_to_seed => cnveg_carbonflux_inst%grainc_to_seed_patch , & ! Output: [real(r8) (:) ] grain C to seed (gC/m2/s) + leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N + frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N + + livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Output: [real(r8) (:) ] livestem N to litter (gN/m2/s) + grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Output: [real(r8) (:) ] grain N to food (gN/m2/s) + biofueln_harvest => cnveg_nitrogenflux_inst%biofueln_harvest_patch , & ! Output: [real(r8) (:) ] biofuel N that was cutted (gC/m2/s) + grainn_to_seed => cnveg_nitrogenflux_inst%grainn_to_seed_patch , & ! Output: [real(r8) (:) ] grain N to seed (gN/m2/s) + leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Output: [real(r8) (:) ] leaf N litterfall (gN/m2/s) + leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Input: [real(r8) (:) ] leaf N to retranslocated N pool (gN/m2/s) + free_retransn_to_npool=> cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) + paid_retransn_to_npool=> cnveg_nitrogenflux_inst%retransn_to_npool_patch, & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) + frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Output: [real(r8) (:) ] fine root N litterfall (gN/m2/s) + leafc_to_litter_fun => cnveg_carbonflux_inst%leafc_to_litter_fun_patch , & ! Output: [real(r8) (:) ] leaf C litterfall used by FUN (gC/m2/s) + leafcn_offset => cnveg_state_inst%leafcn_offset_patch & ! Output: [real(r8) (:) ] Leaf C:N used by FUN + ) + + ! The litterfall transfer rate starts at 0.0 and increases linearly + ! over time, with displayed growth going to 0.0 on the last day of litterfall + + do fp = 1,num_soilp + p = filter_soilp(fp) + + ! only calculate fluxes during offset period + if (offset_flag(p) == 1._r8) then + + if (offset_counter(p) == dt) then + t1 = 1.0_r8 / dt + frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) + + ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of leafc for harvest + ! and move this cut fration to the biofuelc_harvest flux, rather than move it to litter + leafc_to_litter(p) = t1 * leafc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_leafc(p) + biofuelc_harvest(p) = t1 * leafc(p) * harvfrac(ivt(p)) + biofueln_harvest(p) = t1 * leafn(p) * harvfrac(ivt(p)) + + ! this assumes that offset_counter == dt for crops + ! if this were ever changed, we'd need to add code to the "else" + if (ivt(p) >= npcropmin) then + ! Replenish the seed deficits from grain, if there is enough + ! available grain. (If there is not enough available grain, the seed + ! deficits will accumulate until there is eventually enough grain to + ! replenish them.) + grainc_to_seed(p) = t1 * min(-cropseedc_deficit(p), grainc(p)) + grainn_to_seed(p) = t1 * min(-cropseedn_deficit(p), grainn(p)) + ! Send the remaining grain to the food product pool + grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) + grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) + + livestemc_to_litter(p) = t1 * livestemc(p) + cpool_to_livestemc(p) + end if + else + t1 = dt * 2.0_r8 / (offset_counter(p) * offset_counter(p)) + leafc_to_litter(p) = prev_leafc_to_litter(p) + t1*(leafc(p) - prev_leafc_to_litter(p)*offset_counter(p)) + frootc_to_litter(p) = prev_frootc_to_litter(p) + t1*(frootc(p) - prev_frootc_to_litter(p)*offset_counter(p)) + + end if + + if ( use_fun ) then + if(leafc_to_litter(p)*dt.gt.leafc(p))then + leafc_to_litter(p) = leafc(p)/dt + cpool_to_leafc(p) + endif + if(frootc_to_litter(p)*dt.gt.frootc(p))then + frootc_to_litter(p) = frootc(p)/dt + cpool_to_frootc(p) + endif + end if + + + if ( use_fun ) then + leafc_to_litter_fun(p) = leafc_to_litter(p) + leafn_to_retransn(p) = paid_retransn_to_npool(p) + free_retransn_to_npool(p) + if (leafn(p).gt.0._r8) then + if (leafn(p)-leafn_to_retransn(p)*dt.gt.0._r8) then + leafcn_offset(p) = leafc(p)/(leafn(p)-leafn_to_retransn(p)*dt) + else + leafcn_offset(p) = leafc(p)/leafn(p) + end if + else + leafcn_offset(p) = leafcn(ivt(p)) + end if + leafn_to_litter(p) = leafc_to_litter(p)/leafcn_offset(p) - leafn_to_retransn(p) + leafn_to_litter(p) = max(leafn_to_litter(p),0._r8) + + denom = ( leafn_to_retransn(p) + leafn_to_litter(p) ) + if ( denom /= 0.0_r8 ) then + fr_leafn_to_litter = leafn_to_litter(p) / ( leafn_to_retransn(p) + leafn_to_litter(p) ) + else if ( leafn_to_litter(p) == 0.0_r8 ) then + fr_leafn_to_litter = 0.0_r8 + else + fr_leafn_to_litter = 1.0_r8 + end if + + else + if (CNratio_floating .eqv. .true.) then + fr_leafn_to_litter = 0.5_r8 ! assuming 50% of nitrogen turnover goes to litter + end if + ! calculate the leaf N litterfall and retranslocation + leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p)) + leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p) + + end if + + ! calculate fine root N litterfall (no retranslocation of fine root N) + frootn_to_litter(p) = frootc_to_litter(p) / frootcn(ivt(p)) + + if (CNratio_floating .eqv. .true.) then + if (leafc(p) == 0.0_r8) then + ntovr_leaf = 0.0_r8 + else + ntovr_leaf = leafc_to_litter(p) * (leafn(p) / leafc(p)) + end if + + leafn_to_litter(p) = fr_leafn_to_litter * ntovr_leaf + leafn_to_retransn(p) = ntovr_leaf - leafn_to_litter(p) + if (frootc(p) == 0.0_r8) then + frootn_to_litter(p) = 0.0_r8 + else + frootn_to_litter(p) = frootc_to_litter(p) * (frootn(p) / frootc(p)) + end if + end if + + if ( use_fun ) then + if(frootn_to_litter(p)*dt.gt.frootn(p))then + frootn_to_litter(p) = frootn(p)/dt + endif + end if + + if (ivt(p) >= npcropmin) then + ! NOTE(slevis, 2014-12) results in -ve livestemn and -ve totpftn + !X! livestemn_to_litter(p) = livestemc_to_litter(p) / livewdcn(ivt(p)) + ! NOTE(slevis, 2014-12) Beth Drewniak suggested this instead + livestemn_to_litter(p) = livestemn(p) / dt + end if + + ! save the current litterfall fluxes + prev_leafc_to_litter(p) = leafc_to_litter(p) + prev_frootc_to_litter(p) = frootc_to_litter(p) + + end if ! end if offset period + + end do ! end patch loop + + end associate + + end subroutine CNOffsetLitterfall + + !----------------------------------------------------------------------- + subroutine CNBackgroundLitterfall (num_soilp, filter_soilp, & + cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + ! + ! !DESCRIPTION: + ! Determines the flux of C and N from displayed pools to litter + ! pools as the result of background litter fall. + ! + ! !USES: + use CNSharedParamsMod , only : use_fun + use clm_varctl , only : CNratio_floating + ! !ARGUMENTS: + implicit none + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type), intent(in) :: cnveg_nitrogenstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + ! + ! !LOCAL VARIABLES: + integer :: p ! indices + integer :: fp ! lake filter patch index + real(r8) :: fr_leafn_to_litter ! fraction of the nitrogen turnover that goes to litter; remaining fraction is retranslocated + real(r8) :: ntovr_leaf + real(r8) :: denom + !----------------------------------------------------------------------- + + associate( & + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + + leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) + lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) + frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) + + bglfr => cnveg_state_inst%bglfr_patch , & ! Input: [real(r8) (:) ] background litterfall rate (1/s) + + leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C + frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C + + leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) (:) ] + frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Output: [real(r8) (:) ] + + leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N + frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N + leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Output: [real(r8) (:) ] + leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Output: [real(r8) (:) ] + frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Output: [real(r8) (:) ] + leafc_to_litter_fun => cnveg_carbonflux_inst%leafc_to_litter_fun_patch, & ! Output: [real(r8) (:) ] leaf C litterfall used by FUN (gC/m2/s) + leafcn_offset => cnveg_state_inst%leafcn_offset_patch , & ! Output: [real(r8) (:) ] Leaf C:N used by FUN + free_retransn_to_npool=> cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) + paid_retransn_to_npool=> cnveg_nitrogenflux_inst%retransn_to_npool_patch & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) + ) + + ! patch loop + do fp = 1,num_soilp + p = filter_soilp(fp) + + ! only calculate these fluxes if the background litterfall rate is non-zero + if (bglfr(p) > 0._r8) then + ! units for bglfr are already 1/s + leafc_to_litter(p) = bglfr(p) * leafc(p) + frootc_to_litter(p) = bglfr(p) * frootc(p) + if ( use_fun ) then + leafc_to_litter_fun(p) = leafc_to_litter(p) + leafn_to_retransn(p) = paid_retransn_to_npool(p) + free_retransn_to_npool(p) + if (leafn(p).gt.0._r8) then + if (leafn(p)-leafn_to_retransn(p)*dt.gt.0._r8) then + leafcn_offset(p) = leafc(p)/(leafn(p)-leafn_to_retransn(p)*dt) + else + leafcn_offset(p) = leafc(p)/leafn(p) + end if + else + leafcn_offset(p) = leafcn(ivt(p)) + end if + leafn_to_litter(p) = leafc_to_litter(p)/leafcn_offset(p) - leafn_to_retransn(p) + leafn_to_litter(p) = max(leafn_to_litter(p),0._r8) + + denom = ( leafn_to_retransn(p) + leafn_to_litter(p) ) + if ( denom /= 0.0_r8 ) then + fr_leafn_to_litter = leafn_to_litter(p) / ( leafn_to_retransn(p) + leafn_to_litter(p) ) + else if ( leafn_to_litter(p) == 0.0_r8 ) then + fr_leafn_to_litter = 0.0_r8 + else + fr_leafn_to_litter = 1.0_r8 + end if + + + else + if (CNratio_floating .eqv. .true.) then + fr_leafn_to_litter = 0.5_r8 ! assuming 50% of nitrogen turnover goes to litter + end if + ! calculate the leaf N litterfall and retranslocation + leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p)) + leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p) + + end if + + ! calculate fine root N litterfall (no retranslocation of fine root N) + frootn_to_litter(p) = frootc_to_litter(p) / frootcn(ivt(p)) + + if (CNratio_floating .eqv. .true.) then + if (leafc(p) == 0.0_r8) then + ntovr_leaf = 0.0_r8 + else + ntovr_leaf = leafc_to_litter(p) * (leafn(p) / leafc(p)) + end if + + leafn_to_litter(p) = fr_leafn_to_litter * ntovr_leaf + leafn_to_retransn(p) = ntovr_leaf - leafn_to_litter(p) + if (frootc(p) == 0.0_r8) then + frootn_to_litter(p) = 0.0_r8 + else + frootn_to_litter(p) = frootc_to_litter(p) * (frootn(p) / frootc(p)) + end if + end if + + if ( use_fun ) then + if(frootn_to_litter(p)*dt.gt.frootn(p))then + frootn_to_litter(p) = frootn(p)/dt + endif + end if + + end if + + end do + + end associate + + end subroutine CNBackgroundLitterfall + + !----------------------------------------------------------------------- + subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + ! + ! !DESCRIPTION: + ! Determines the flux of C and N from live wood to + ! dead wood pools, for stem and coarse root. + ! + use CNSharedParamsMod, only: use_fun + use clm_varctl , only : CNratio_floating + ! !ARGUMENTS: + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + ! + ! !LOCAL VARIABLES: + integer :: p ! indices + integer :: fp ! lake filter patch index + real(r8):: ctovr ! temporary variable for carbon turnover + real(r8):: ntovr ! temporary variable for nitrogen turnover + !----------------------------------------------------------------------- + + associate( & + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + + woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) + livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN) + deadwdcn => pftcon%deadwdcn , & ! Input: dead wood (xylem and heartwood) C:N (gC/gN) + + livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C + livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C + + livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N + livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N + + livestemc_to_deadstemc => cnveg_carbonflux_inst%livestemc_to_deadstemc_patch , & ! Output: [real(r8) (:) ] + livecrootc_to_deadcrootc => cnveg_carbonflux_inst%livecrootc_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] + + livestemn_to_deadstemn => cnveg_nitrogenflux_inst%livestemn_to_deadstemn_patch , & ! Output: [real(r8) (:) ] + livestemn_to_retransn => cnveg_nitrogenflux_inst%livestemn_to_retransn_patch , & ! Output: [real(r8) (:) ] + livecrootn_to_deadcrootn => cnveg_nitrogenflux_inst%livecrootn_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] + livecrootn_to_retransn => cnveg_nitrogenflux_inst%livecrootn_to_retransn_patch & ! Output: [real(r8) (:) ] + ) + + + + ! patch loop + do fp = 1,num_soilp + p = filter_soilp(fp) + + ! only calculate these fluxes for woody types + if (woody(ivt(p)) > 0._r8) then + + ! live stem to dead stem turnover + + ctovr = livestemc(p) * lwtop + ntovr = ctovr / livewdcn(ivt(p)) + livestemc_to_deadstemc(p) = ctovr + livestemn_to_deadstemn(p) = ctovr / deadwdcn(ivt(p)) + + if (CNratio_floating .eqv. .true.) then + if (livestemc(p) == 0.0_r8) then + ntovr = 0.0_r8 + else + ntovr = ctovr * (livestemn(p) / livestemc(p)) + end if + + livestemn_to_deadstemn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn + end if + + livestemn_to_retransn(p) = ntovr - livestemn_to_deadstemn(p) + + ! live coarse root to dead coarse root turnover + + ctovr = livecrootc(p) * lwtop + ntovr = ctovr / livewdcn(ivt(p)) + livecrootc_to_deadcrootc(p) = ctovr + livecrootn_to_deadcrootn(p) = ctovr / deadwdcn(ivt(p)) + + if (CNratio_floating .eqv. .true.) then + if (livecrootc(p) == 0.0_r8) then + ntovr = 0.0_r8 + else + ntovr = ctovr * (livecrootn(p) / livecrootc(p)) + end if + + livecrootn_to_deadcrootn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn + end if + + livecrootn_to_retransn(p) = ntovr - livecrootn_to_deadcrootn(p) + if(use_fun)then + !TURNED OFF FLUXES TO CORRECT N ACCUMULATION ISSUE. RF. Oct 2015. + livecrootn_to_retransn(p) = 0.0_r8 + livestemn_to_retransn(p) = 0.0_r8 + endif + + end if + + end do + + end associate + + end subroutine CNLivewoodTurnover + + !----------------------------------------------------------------------- + subroutine CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & + cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + ! + ! !DESCRIPTION: + ! If using prognostic crop along with use_grainproduct, then move the patch-level + ! grain-to-food fluxes into the column-level grain-to-cropprod fluxes + ! + ! !USES: + use clm_varctl , only : use_crop + use clm_varctl , only : use_grainproduct + use subgridAveMod , only : p2c + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + ! + ! !LOCAL VARIABLES: + integer :: fp, p + + character(len=*), parameter :: subname = 'CNGrainToProductPools' + !----------------------------------------------------------------------- + + ! Explicitly checking use_crop is probably unnecessary here (because presumably + ! use_grainproduct is only true if use_crop is true), but we do it for safety because + ! the grain*_to_food_patch fluxes are not set if use_crop is false. + if (use_crop .and. use_grainproduct) then + do fp = 1, num_soilp + p = filter_soilp(fp) + cnveg_carbonflux_inst%grainc_to_cropprodc_patch(p) = & + cnveg_carbonflux_inst%grainc_to_food_patch(p) + cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(p) = & + cnveg_nitrogenflux_inst%grainn_to_food_patch(p) + end do + + call p2c (bounds, num_soilc, filter_soilc, & + cnveg_carbonflux_inst%grainc_to_cropprodc_patch(bounds%begp:bounds%endp), & + cnveg_carbonflux_inst%grainc_to_cropprodc_col(bounds%begc:bounds%endc)) + + call p2c (bounds, num_soilc, filter_soilc, & + cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(bounds%begp:bounds%endp), & + cnveg_nitrogenflux_inst%grainn_to_cropprodn_col(bounds%begc:bounds%endc)) + end if + + ! No else clause: if use_grainproduct is false, then the grain*_to_cropprod fluxes + ! will remain at their initial value (0). + + end subroutine CNGrainToProductPools + + !----------------------------------------------------------------------- + subroutine CNLitterToColumn (bounds, num_soilc, filter_soilc, & + cnveg_state_inst,cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & + leaf_prof_patch, froot_prof_patch) + ! + ! !DESCRIPTION: + ! called at the end of cn_phenology to gather all patch-level litterfall fluxes + ! to the column level and assign them to the three litter pools + ! + ! !USES: + use clm_varpar , only : max_patch_per_col, nlevdecomp + use pftconMod , only : npcropmin + use clm_varctl , only : use_grainproduct + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + type(cnveg_state_type) , intent(in) :: cnveg_state_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) + real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) + ! + ! !LOCAL VARIABLES: + integer :: fc,c,pi,p,j ! indices + !----------------------------------------------------------------------- + + SHR_ASSERT_ALL_FL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), sourcefile, __LINE__) + + associate( & + leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves + froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots + + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type + wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] weight (relative to column) for this patch (0-1) + + lf_flab => pftcon%lf_flab , & ! Input: leaf litter labile fraction + lf_fcel => pftcon%lf_fcel , & ! Input: leaf litter cellulose fraction + lf_flig => pftcon%lf_flig , & ! Input: leaf litter lignin fraction + fr_flab => pftcon%fr_flab , & ! Input: fine root litter labile fraction + fr_fcel => pftcon%fr_fcel , & ! Input: fine root litter cellulose fraction + fr_flig => pftcon%fr_flig , & ! Input: fine root litter lignin fraction + + leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Input: [real(r8) (:) ] leaf C litterfall (gC/m2/s) + frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) + livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] live stem C litterfall (gC/m2/s) + grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] grain C to food (gC/m2/s) + + biofuelc_harvest => cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Input: [real(r8) (:) ] biofuel C (gC/m2/s) + + phenology_c_to_litr_met_c => cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) + phenology_c_to_litr_cel_c => cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) + phenology_c_to_litr_lig_c => cnveg_carbonflux_inst%phenology_c_to_litr_lig_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter lignin pool (gC/m3/s) + + livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Input: [real(r8) (:) ] livestem N to litter (gN/m2/s) + grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Input: [real(r8) (:) ] grain N to food (gN/m2/s) + biofueln_harvest => cnveg_nitrogenflux_inst%biofueln_harvest_patch , & ! Input: [real(r8) (:) ] biofuel N (gN/m2/s) + leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Input: [real(r8) (:) ] leaf N litterfall (gN/m2/s) + frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) + phenology_n_to_litr_met_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_met_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gN/m3/s) + phenology_n_to_litr_cel_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_cel_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gN/m3/s) + phenology_n_to_litr_lig_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_lig_n_col & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter lignin pool (gN/m3/s) + ) + + do j = 1, nlevdecomp + do pi = 1,max_patch_per_col + do fc = 1,num_soilc + c = filter_soilc(fc) + + if ( pi <= col%npatches(c) ) then + p = col%patchi(c) + pi - 1 + if (patch%active(p)) then + + ! leaf litter carbon fluxes + phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & + + leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) + phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & + + leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) + phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & + + leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + ! leaf litter nitrogen fluxes + phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & + + leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) + phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & + + leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) + phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & + + leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + ! fine root litter carbon fluxes + phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & + + frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) + phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & + + frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) + phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & + + frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) + + ! fine root litter nitrogen fluxes + phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & + + frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) + phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & + + frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) + phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & + + frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) + + ! agroibis puts crop stem litter together with leaf litter + ! so I've used the leaf lf_f* parameters instead of making + ! new ones for now (slevis) + ! also for simplicity I've put "food" into the litter pools + + if (ivt(p) >= npcropmin) then ! add livestemc to litter + ! stem litter carbon fluxes + phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & + + livestemc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) + phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & + + livestemc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) + phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & + + livestemc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + ! stem litter nitrogen fluxes + phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & + + livestemn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) + phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & + + livestemn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) + phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & + + livestemn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + if (.not. use_grainproduct) then + ! grain litter carbon fluxes + phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & + + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & + + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & + + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + + ! grain litter nitrogen fluxes + phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & + + grainn_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofueln_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & + + grainn_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofueln_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & + + grainn_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofueln_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + end if + + + end if + end if + end if + + end do + + end do + end do + + end associate + + end subroutine CNLitterToColumn + +end module CNPhenologyMod From e30e87bd4c44c6e3395c361fc076cabc5941030d Mon Sep 17 00:00:00 2001 From: chen693 Date: Mon, 24 Feb 2020 14:56:04 -0800 Subject: [PATCH 0623/1973] cut a certain fraction of crop leaf biomass during offset period --- src/biogeochem/CNPhenologyMod.F90 | 89 ++++++++++++++----------------- 1 file changed, 41 insertions(+), 48 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index a0c34e7472..3079f12670 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2415,7 +2415,11 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & associate( & ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) + leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) + + ! Y. Cheng, add a new cut fraction for harvest parameter for bioenergy crops (miscanthus and switchgrass) + harvfrac => pftcon%harvfrac , & ! Input: cut fraction for harvest (-) + lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) graincn => pftcon%graincn , & ! Input: grain C:N (gC/gN) @@ -2442,14 +2446,19 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) (:) ] leaf C litterfall (gC/m2/s) frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Output: [real(r8) (:) ] fine root C litterfall (gC/m2/s) livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Output: [real(r8) (:) ] live stem C litterfall (gC/m2/s) - grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Output: [real(r8) (:) ] grain C to food (gC/m2/s) + grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Output: [real(r8) (:) ] grain C to food (gC/m2/s) + + ! Y. Cheng, put the cut fraction during offset period for bioenergy crops to this biofuelc_harvest flux + biofuelc_harvest => cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Output: [real(r8) (:) ] biofuel C that was cutted at harvest (gC/m2/s) + grainc_to_seed => cnveg_carbonflux_inst%grainc_to_seed_patch , & ! Output: [real(r8) (:) ] grain C to seed (gC/m2/s) leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Output: [real(r8) (:) ] livestem N to litter (gN/m2/s) - grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Output: [real(r8) (:) ] grain N to food (gN/m2/s) - grainn_to_seed => cnveg_nitrogenflux_inst%grainn_to_seed_patch , & ! Output: [real(r8) (:) ] grain N to seed (gN/m2/s) + grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Output: [real(r8) (:) ] grain N to food (gN/m2/s) + biofueln_harvest => cnveg_nitrogenflux_inst%biofueln_harvest_patch , & ! Output: [real(r8) (:) ] biofuel N that was cutted (gC/m2/s) + grainn_to_seed => cnveg_nitrogenflux_inst%grainn_to_seed_patch , & ! Output: [real(r8) (:) ] grain N to seed (gN/m2/s) leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Output: [real(r8) (:) ] leaf N litterfall (gN/m2/s) leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Input: [real(r8) (:) ] leaf N to retranslocated N pool (gN/m2/s) free_retransn_to_npool=> cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) @@ -2470,21 +2479,13 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & if (offset_counter(p) == dt) then t1 = 1.0_r8 / dt - !leafc_to_litter(p) = t1 * leafc(p) + cpool_to_leafc(p) frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) - ! Y. Cheng, cut 70% AGB for switchgrass and Miscanthus and move to grainc_to_food - if (ivt(p)==nmiscanthus .or. ivt(p)==nirrig_miscanthus .or. ivt(p)==nswitchgrass .or. ivt(p)==nirrig_switchgrass) then - leafc_to_litter(p) = t1 * leafc(p)*0.3 + cpool_to_leafc(p) - grainc_to_food(p) =grainc_to_food(p)+ t1 * leafc(p) * 0.7 - grainn_to_food(p) =grainn_to_food(p)+ t1 * leafn(p) * 0.7 - -! leafc_to_litter(p) = (t1 * leafc(p) + cpool_to_leafc(p))*0.3 -! grainc_to_food(p) =grainc_to_food(p)+ (t1 * leafc(p) + cpool_to_leafc(p))*0.7 -! grainn_to_food(p) =grainn_to_food(p)+ t1 * leafn(p) * 0.7 - else - leafc_to_litter(p) = t1 * leafc(p) + cpool_to_leafc(p) - end if + ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of leafc for harvest + ! and move this cut fration to the biofuelc_harvest flux, rather than move it to litter + leafc_to_litter(p) = t1 * leafc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_leafc(p) + biofuelc_harvest(p) = t1 * leafc(p) * harvfrac(ivt(p)) + biofueln_harvest(p) = t1 * leafn(p) * harvfrac(ivt(p)) ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" @@ -2496,17 +2497,10 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & grainc_to_seed(p) = t1 * min(-cropseedc_deficit(p), grainc(p)) grainn_to_seed(p) = t1 * min(-cropseedn_deficit(p), grainn(p)) ! Send the remaining grain to the food product pool - - ! Y. Cheng, because I calculated grainc_to_food and grainn_to_food earlier - if (ivt(p)==nmiscanthus .or. ivt(p)==nirrig_miscanthus .or. ivt(p)==nswitchgrass .or. ivt(p)==nirrig_switchgrass) then - grainc_to_food(p) = grainc_to_food(p) + t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) - grainn_to_food(p) = grainn_to_food(p) + t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) - else - grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) - grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) - end if - - livestemc_to_litter(p) = t1 * livestemc(p) + cpool_to_livestemc(p) + grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) + grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) + + livestemc_to_litter(p) = t1 * livestemc(p) + cpool_to_livestemc(p) end if else t1 = dt * 2.0_r8 / (offset_counter(p) * offset_counter(p)) @@ -2594,18 +2588,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & ! save the current litterfall fluxes prev_leafc_to_litter(p) = leafc_to_litter(p) prev_frootc_to_litter(p) = frootc_to_litter(p) - - - ! Y. Cheng, cut 70% AGB for switchgrass and Miscanthus - if (offset_counter(p) == dt) then - if (ivt(p)==nmiscanthus .or. ivt(p)==nirrig_miscanthus .or. ivt(p)==nswitchgrass .or. ivt(p)==nirrig_switchgrass) then - grainc(p) = grainc(p) + leafc(p)*0.7 - leafc(p) = leafc(p) * 0.3 - grainn(p) = grainn(p) + leafn(p)*0.7 - leafn(p) = leafn(p) * 0.3 - end if - end if - + end if ! end if offset period end do ! end patch loop @@ -2955,13 +2938,17 @@ subroutine CNLitterToColumn (bounds, num_soilc, filter_soilc, & leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Input: [real(r8) (:) ] leaf C litterfall (gC/m2/s) frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] live stem C litterfall (gC/m2/s) - grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] grain C to food (gC/m2/s) + grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] grain C to food (gC/m2/s) + + biofuelc_harvest => cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Input: [real(r8) (:) ] biofuel C (gC/m2/s) + phenology_c_to_litr_met_c => cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) phenology_c_to_litr_cel_c => cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) phenology_c_to_litr_lig_c => cnveg_carbonflux_inst%phenology_c_to_litr_lig_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter lignin pool (gC/m3/s) livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Input: [real(r8) (:) ] livestem N to litter (gN/m2/s) - grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Input: [real(r8) (:) ] grain N to food (gN/m2/s) + grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Input: [real(r8) (:) ] grain N to food (gN/m2/s) + biofueln_harvest => cnveg_nitrogenflux_inst%biofueln_harvest_patch , & ! Input: [real(r8) (:) ] biofuel N (gN/m2/s) leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Input: [real(r8) (:) ] leaf N litterfall (gN/m2/s) frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) phenology_n_to_litr_met_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_met_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gN/m3/s) @@ -3035,19 +3022,25 @@ subroutine CNLitterToColumn (bounds, num_soilc, filter_soilc, & if (.not. use_grainproduct) then ! grain litter carbon fluxes phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofuelc_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel ! grain litter nitrogen fluxes phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + grainn_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainn_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofueln_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + grainn_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainn_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofueln_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + grainn_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainn_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & + + biofueln_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel end if From 7c3d10b864c39cdd2e90413d10e02d5c25ea3ee5 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Mon, 24 Feb 2020 14:56:59 -0800 Subject: [PATCH 0624/1973] Delete CNPhenologyMod_cut_newFlux_newCutParam_N.F90 --- ...PhenologyMod_cut_newFlux_newCutParam_N.F90 | 3060 ----------------- 1 file changed, 3060 deletions(-) delete mode 100644 src/biogeochem/CNPhenologyMod_cut_newFlux_newCutParam_N.F90 diff --git a/src/biogeochem/CNPhenologyMod_cut_newFlux_newCutParam_N.F90 b/src/biogeochem/CNPhenologyMod_cut_newFlux_newCutParam_N.F90 deleted file mode 100644 index 3079f12670..0000000000 --- a/src/biogeochem/CNPhenologyMod_cut_newFlux_newCutParam_N.F90 +++ /dev/null @@ -1,3060 +0,0 @@ -module CNPhenologyMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !MODULE: CNPhenologyMod - ! - ! !DESCRIPTION: - ! Module holding routines used in phenology model for coupled carbon - ! nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_sys_mod , only : shr_sys_flush - use decompMod , only : bounds_type - use clm_varpar , only : maxveg, nlevdecomp_full - use clm_varctl , only : iulog, use_cndv - use clm_varcon , only : tfrz - use abortutils , only : endrun - use CanopyStateType , only : canopystate_type - use CNDVType , only : dgvs_type - use CNVegstateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type - use CNVegnitrogenfluxType , only : cnveg_nitrogenflux_type - use CropType , only : crop_type - use pftconMod , only : pftcon - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type - use ColumnType , only : col - use GridcellType , only : grc - use PatchType , only : patch - use atm2lndType , only : atm2lnd_type - use atm2lndType , only : atm2lnd_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams ! Read parameters - public :: CNPhenologyreadNML ! Read namelist - public :: CNPhenologyInit ! Initialization - public :: CNPhenology ! Update - ! - ! !PRIVATE DATA MEMBERS: - type, private :: params_type - real(r8) :: crit_dayl ! critical day length for senescence - real(r8) :: ndays_on ! number of days to complete leaf onset - real(r8) :: ndays_off ! number of days to complete leaf offset - real(r8) :: fstor2tran ! fraction of storage to move to transfer for each onset - real(r8) :: crit_onset_fdd ! critical number of freezing days to set gdd counter - real(r8) :: crit_onset_swi ! critical number of days > soilpsi_on for onset - real(r8) :: soilpsi_on ! critical soil water potential for leaf onset - real(r8) :: crit_offset_fdd ! critical number of freezing days to initiate offset - real(r8) :: crit_offset_swi ! critical number of water stress days to initiate offset - real(r8) :: soilpsi_off ! critical soil water potential for leaf offset - real(r8) :: lwtop ! live wood turnover proportion (annual fraction) - end type params_type - - type(params_type) :: params_inst - - real(r8) :: dt ! radiation time step delta t (seconds) - real(r8) :: fracday ! dtime as a fraction of day - real(r8) :: crit_dayl ! critical daylength for offset (seconds) - real(r8) :: ndays_on ! number of days to complete onset - real(r8) :: ndays_off ! number of days to complete offset - real(r8) :: fstor2tran ! fraction of storage to move to transfer on each onset - real(r8) :: crit_onset_fdd ! critical number of freezing days - real(r8) :: crit_onset_swi ! water stress days for offset trigger - real(r8) :: soilpsi_on ! water potential for onset trigger (MPa) - real(r8) :: crit_offset_fdd ! critical number of freezing degree days to trigger offset - real(r8) :: crit_offset_swi ! water stress days for offset trigger - real(r8) :: soilpsi_off ! water potential for offset trigger (MPa) - real(r8) :: lwtop ! live wood turnover proportion (annual fraction) - - ! CropPhenology variables and constants - real(r8) :: p1d, p1v ! photoperiod factor constants for crop vernalization - real(r8) :: hti ! cold hardening index threshold for vernalization - real(r8) :: tbase ! base temperature for vernalization - - integer, parameter :: NOT_Planted = 999 ! If not planted yet in year - integer, parameter :: NOT_Harvested = 999 ! If not harvested yet in year - integer, parameter :: inNH = 1 ! Northern Hemisphere - integer, parameter :: inSH = 2 ! Southern Hemisphere - integer, pointer :: inhemi(:) ! Hemisphere that patch is in - - integer, allocatable :: minplantjday(:,:) ! minimum planting julian day - integer, allocatable :: maxplantjday(:,:) ! maximum planting julian day - integer :: jdayyrstart(inSH) ! julian day of start of year - - real(r8), private :: initial_seed_at_planting = 3._r8 ! Initial seed at planting - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNPhenologyReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for CNPhenology - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNPhenologyReadNML' - character(len=*), parameter :: nmlname = 'cnphenology' - !----------------------------------------------------------------------- - namelist /cnphenology/ initial_seed_at_planting - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cnphenology, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (initial_seed_at_planting, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cnphenology) - write(iulog,*) ' ' - end if - - - !----------------------------------------------------------------------- - - end subroutine CNPhenologyReadNML - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNPhenolParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! - ! read in parameters - ! - tString='crit_dayl' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_dayl=tempr - - tString='ndays_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_on=tempr - - tString='ndays_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_off=tempr - - tString='fstor2tran' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%fstor2tran=tempr - - tString='crit_onset_fdd' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_onset_fdd=tempr - - tString='crit_onset_swi' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_onset_swi=tempr - - tString='soilpsi_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%soilpsi_on=tempr - - tString='crit_offset_fdd' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_offset_fdd=tempr - - tString='crit_offset_swi' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_offset_swi=tempr - - tString='soilpsi_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%soilpsi_off=tempr - - tString='lwtop_ann' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%lwtop=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & - filter_soilp, num_pcropp, filter_pcropp, & - doalb, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, temperature_inst, atm2lnd_inst, crop_inst, & - canopystate_inst, soilstate_inst, dgvs_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - leaf_prof_patch, froot_prof_patch, phase) - ! !USES: - use CNSharedParamsMod, only: use_fun - ! - ! !DESCRIPTION: - ! Dynamic phenology routine for coupled carbon-nitrogen code (CN) - ! 1. grass phenology - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter - integer , intent(in) :: filter_pcropp(:)! filter for prognostic crop patches - logical , intent(in) :: doalb ! true if time for sfc albedo calc - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(crop_type) , intent(inout) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - integer , intent(in) :: phase - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL_FL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), sourcefile, __LINE__) - - ! each of the following phenology type routines includes a filter - ! to operate only on the relevant patches - - - if ( phase == 1 ) then - call CNPhenologyClimate(num_soilp, filter_soilp, num_pcropp, filter_pcropp, & - temperature_inst, cnveg_state_inst, crop_inst) - - call CNEvergreenPhenology(num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNSeasonDecidPhenology(num_soilp, filter_soilp, & - temperature_inst, cnveg_state_inst, dgvs_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNStressDecidPhenology(num_soilp, filter_soilp, & - soilstate_inst, temperature_inst, atm2lnd_inst, wateratm2lndbulk_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - if (doalb .and. num_pcropp > 0 ) then - call CropPhenology(num_pcropp, filter_pcropp, & - waterdiagnosticbulk_inst, temperature_inst, crop_inst, canopystate_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst) - end if - else if ( phase == 2 ) then - ! the same onset and offset routines are called regardless of - ! phenology type - they depend only on onset_flag, offset_flag, bglfr, and bgtr - - call CNOnsetGrowth(num_soilp, filter_soilp, & - cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNOffsetLitterfall(num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNBackgroundLitterfall(num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNLivewoodTurnover(num_soilp, filter_soilp, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - ! gather all patch-level litterfall fluxes to the column for litter C and N inputs - - call CNLitterToColumn(bounds, num_soilc, filter_soilc, & - cnveg_state_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch(bounds%begp:bounds%endp,1:nlevdecomp_full), & - froot_prof_patch(bounds%begp:bounds%endp,1:nlevdecomp_full)) - else - call endrun( 'bad phase' ) - end if - - end subroutine CNPhenology - - !----------------------------------------------------------------------- - subroutine CNPhenologyInit(bounds) - ! - ! !DESCRIPTION: - ! Initialization of CNPhenology. Must be called after time-manager is - ! initialized, and after pftcon file is read in. - ! - ! !USES: - use clm_time_manager, only: get_step_size_real - use clm_varctl , only: use_crop - use clm_varcon , only: secspday - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - !------------------------------------------------------------------------ - - ! - ! Get time-step and what fraction of a day it is - ! - dt = get_step_size_real() - fracday = dt/secspday - - ! set constants for CNSeasonDecidPhenology - ! (critical daylength from Biome-BGC, v4.1.2) - crit_dayl=params_inst%crit_dayl - - ! Set constants for CNSeasonDecidPhenology and CNStressDecidPhenology - ndays_on=params_inst%ndays_on - ndays_off=params_inst%ndays_off - - ! set transfer parameters - fstor2tran=params_inst%fstor2tran - - ! ----------------------------------------- - ! Constants for CNStressDecidPhenology - ! ----------------------------------------- - - ! onset parameters - crit_onset_fdd=params_inst%crit_onset_fdd - ! critical onset gdd now being calculated as a function of annual - ! average 2m temp. - ! crit_onset_gdd = 150.0 ! c3 grass value - ! crit_onset_gdd = 1000.0 ! c4 grass value - crit_onset_swi=params_inst%crit_onset_swi - soilpsi_on=params_inst%soilpsi_on - - ! offset parameters - crit_offset_fdd=params_inst%crit_offset_fdd - crit_offset_swi=params_inst%crit_offset_swi - soilpsi_off=params_inst%soilpsi_off - - ! ----------------------------------------- - ! Constants for CNLivewoodTurnover - ! ----------------------------------------- - - ! set the global parameter for livewood turnover rate - ! define as an annual fraction (0.7), and convert to fraction per second - lwtop=params_inst%lwtop/31536000.0_r8 !annual fraction converted to per second - - ! ----------------------------------------- - ! Call any subroutine specific initialization routines - ! ----------------------------------------- - - if ( use_crop ) call CropPhenologyInit(bounds) - - end subroutine CNPhenologyInit - - !----------------------------------------------------------------------- - subroutine CNPhenologyClimate (num_soilp, filter_soilp, num_pcropp, filter_pcropp, & - temperature_inst, cnveg_state_inst, crop_inst) - ! - ! !DESCRIPTION: - ! For coupled carbon-nitrogen code (CN). - ! - ! !USES: - use clm_time_manager , only : get_days_per_year - use clm_time_manager , only : get_curr_date, is_first_step - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - integer , intent(in) :: num_pcropp ! number of prognostic crops in filter - integer , intent(in) :: filter_pcropp(:)! filter for prognostic crop patches - type(temperature_type) , intent(inout) :: temperature_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(inout) :: crop_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8) :: dayspyr ! days per year (days) - integer :: kyr ! current year - integer :: kmo ! month of year (1, ..., 12) - integer :: kda ! day of month (1, ..., 31) - integer :: mcsec ! seconds of day (0, ..., seconds/day) - real(r8), parameter :: yravg = 20.0_r8 ! length of years to average for gdd - real(r8), parameter :: yravgm1 = yravg-1.0_r8 ! minus 1 of above - !----------------------------------------------------------------------- - - associate( & - nyrs_crop_active => crop_inst%nyrs_crop_active_patch, & ! InOut: [integer (:) ] number of years this crop patch has been active - - t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2m air temperature (K) - gdd0 => temperature_inst%gdd0_patch , & ! Output: [real(r8) (:) ] growing deg. days base 0 deg C (ddays) - gdd8 => temperature_inst%gdd8_patch , & ! Output: [real(r8) (:) ] " " " " 8 " " " - gdd10 => temperature_inst%gdd10_patch , & ! Output: [real(r8) (:) ] " " " " 10 " " " - gdd020 => temperature_inst%gdd020_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd0 (ddays) - gdd820 => temperature_inst%gdd820_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd8 (ddays) - gdd1020 => temperature_inst%gdd1020_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd10 (ddays) - - tempavg_t2m => cnveg_state_inst%tempavg_t2m_patch & ! Output: [real(r8) (:) ] temp. avg 2m air temperature (K) - ) - - ! set time steps - - dayspyr = get_days_per_year() - - do fp = 1,num_soilp - p = filter_soilp(fp) - tempavg_t2m(p) = tempavg_t2m(p) + t_ref2m(p) * (fracday/dayspyr) - end do - - ! - ! The following crop related steps are done here rather than CropPhenology - ! so that they will be completed each time-step rather than with doalb. - ! - ! The following lines come from ibis's climate.f + stats.f - ! gdd SUMMATIONS ARE RELATIVE TO THE PLANTING DATE (see subr. updateAccFlds) - - if (num_pcropp > 0) then - ! get time-related info - call get_curr_date(kyr, kmo, kda, mcsec) - end if - - do fp = 1,num_pcropp - p = filter_pcropp(fp) - if (kmo == 1 .and. kda == 1 .and. nyrs_crop_active(p) == 0) then ! YR 1: - gdd020(p) = 0._r8 ! set gdd..20 variables to 0 - gdd820(p) = 0._r8 ! and crops will not be planted - gdd1020(p) = 0._r8 - end if - if (kmo == 1 .and. kda == 1 .and. mcsec == 0) then ! <-- END of EVERY YR: - if (nyrs_crop_active(p) == 1) then ! <-- END of YR 1 - gdd020(p) = gdd0(p) ! <-- END of YR 1 - gdd820(p) = gdd8(p) ! <-- END of YR 1 - gdd1020(p) = gdd10(p) ! <-- END of YR 1 - end if ! <-- END of YR 1 - gdd020(p) = (yravgm1* gdd020(p) + gdd0(p)) / yravg ! gdd..20 must be long term avgs - gdd820(p) = (yravgm1* gdd820(p) + gdd8(p)) / yravg ! so ignore results for yrs 1 & 2 - gdd1020(p) = (yravgm1* gdd1020(p) + gdd10(p)) / yravg - end if - end do - - end associate - - end subroutine CNPhenologyClimate - - !----------------------------------------------------------------------- - subroutine CNEvergreenPhenology (num_soilp, filter_soilp , & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! cnveg_state_inst) - ! - ! !DESCRIPTION: - ! For coupled carbon-nitrogen code (CN). - ! - ! !USES: - use clm_varcon , only : secspday - use clm_time_manager , only : get_days_per_year - use clm_varctl , only : CN_evergreen_phenology_opt - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type), intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - real(r8):: dayspyr ! Days per year - integer :: p ! indices - integer :: fp ! lake filter patch index - - real(r8):: tranr - real(r8):: t1 ! temporary variable - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - evergreen => pftcon%evergreen , & ! Input: binary flag for evergreen leaf habit (0 or 1) - leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) leaf C storage - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) fine root C storage - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live stem C storage - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) dead stem C storage - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live coarse root C storage - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) dead coarse root C storage - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) growth respiration storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) dead coarse root C transfer - - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) leaf N storage - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) fine root N storage - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live stem N storage - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) dead stem N storage - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live coarse root N storage - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) dead coarse root N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) dead coarse root N transfer - - leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! InOut: [real(r8) (:)] - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! InOut: [real(r8) (:)] - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! InOut: [real(r8) (:)] - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! InOut: [real(r8) (:)] - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! InOut: [real(r8) (:)] - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! InOut: [real(r8) (:)] - - leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! InOut: [real(r8) (:)] - frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! InOut: [real(r8) (:)] - livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! InOut: [real(r8) (:)] - deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! InOut: [real(r8) (:)] - livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! InOut: [real(r8) (:)] - deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! InOut: [real(r8) (:)] - - bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) - bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) - lgsf => cnveg_state_inst%lgsf_patch & ! Output: [real(r8) (:) ] long growing season factor [0-1] - ) - - dayspyr = get_days_per_year() - - do fp = 1,num_soilp - p = filter_soilp(fp) - if (evergreen(ivt(p)) == 1._r8) then - bglfr(p) = 1._r8/(leaf_long(ivt(p)) * dayspyr * secspday) - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - end if - end do - - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if (CN_evergreen_phenology_opt == 1) then - do fp = 1,num_soilp - p = filter_soilp(fp) - if (evergreen(ivt(p)) == 1._r8) then - - tranr=0.0002_r8 - ! set carbon fluxes for shifting storage pools to transfer pools - leafc_storage_to_xfer(p) = tranr * leafc_storage(p)/dt - frootc_storage_to_xfer(p) = tranr * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = tranr * livestemc_storage(p)/dt - deadstemc_storage_to_xfer(p) = tranr * deadstemc_storage(p)/dt - livecrootc_storage_to_xfer(p) = tranr * livecrootc_storage(p)/dt - deadcrootc_storage_to_xfer(p) = tranr * deadcrootc_storage(p)/dt - gresp_storage_to_xfer(p) = tranr * gresp_storage(p)/dt - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = tranr * leafn_storage(p)/dt - frootn_storage_to_xfer(p) = tranr * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = tranr * livestemn_storage(p)/dt - deadstemn_storage_to_xfer(p) = tranr * deadstemn_storage(p)/dt - livecrootn_storage_to_xfer(p) = tranr * livecrootn_storage(p)/dt - deadcrootn_storage_to_xfer(p) = tranr * deadcrootn_storage(p)/dt - end if - - t1 = 1.0_r8 / dt - - leafc_xfer_to_leafc(p) = t1 * leafc_xfer(p) - frootc_xfer_to_frootc(p) = t1 * frootc_xfer(p) - - leafn_xfer_to_leafn(p) = t1 * leafn_xfer(p) - frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) - deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) - livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) - deadcrootc_xfer_to_deadcrootc(p) = t1 * deadcrootc_xfer(p) - - livestemn_xfer_to_livestemn(p) = t1 * livestemn_xfer(p) - deadstemn_xfer_to_deadstemn(p) = t1 * deadstemn_xfer(p) - livecrootn_xfer_to_livecrootn(p) = t1 * livecrootn_xfer(p) - deadcrootn_xfer_to_deadcrootn(p) = t1 * deadcrootn_xfer(p) - end if - - end if ! end of if (evergreen(ivt(p)) == 1._r8) then - - end do ! end of pft loop - - end if ! end of if (CN_evergreen_phenology_opt == 1) then - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - end associate - - end subroutine CNEvergreenPhenology - - !----------------------------------------------------------------------- - subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & - temperature_inst, cnveg_state_inst, dgvs_inst , & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! For coupled carbon-nitrogen code (CN). - ! This routine handles the seasonal deciduous phenology code (temperate - ! deciduous vegetation that has only one growing season per year). - ! - ! !USES: - use shr_const_mod , only: SHR_CONST_TKFRZ, SHR_CONST_PI - use clm_varcon , only: secspday - use clm_varctl , only: use_cndv - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(temperature_type) , intent(in) :: temperature_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: g,c,p !indices - integer :: fp !lake filter patch index - real(r8):: ws_flag !winter-summer solstice flag (0 or 1) - real(r8):: crit_onset_gdd !critical onset growing degree-day sum - real(r8):: soilt - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) - prev_dayl => grc%prev_dayl , & ! Input: [real(r8) (:) ] daylength from previous time step (s) - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - pftmayexist => dgvs_inst%pftmayexist_patch , & ! Output: [logical (:) ] exclude seasonal decid patches from tropics - - annavg_t2m => cnveg_state_inst%annavg_t2m_patch , & ! Input: [real(r8) (:) ] annual average 2m air temperature (K) - dormant_flag => cnveg_state_inst%dormant_flag_patch , & ! Output: [real(r8) (:) ] dormancy flag - days_active => cnveg_state_inst%days_active_patch , & ! Output: [real(r8) (:) ] number of days since last dormancy - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag - onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter (seconds) - onset_gddflag => cnveg_state_inst%onset_gddflag_patch , & ! Output: [real(r8) (:) ] onset freeze flag - onset_gdd => cnveg_state_inst%onset_gdd_patch , & ! Output: [real(r8) (:) ] onset growing degree days - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag - offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter (seconds) - bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) - bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) - lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] - - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - - prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) - prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - - leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] - frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] - livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] - deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] - deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] - leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] - ) - - ! start patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - g = patch%gridcell(p) - - if (season_decid(ivt(p)) == 1._r8) then - - ! set background litterfall rate, background transfer rate, and - ! long growing season factor to 0 for seasonal deciduous types - bglfr(p) = 0._r8 - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - - ! onset gdd sum from Biome-BGC, v4.1.2 - crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) - - ! set flag for solstice period (winter->summer = 1, summer->winter = 0) - if (dayl(g) >= prev_dayl(g)) then - ws_flag = 1._r8 - else - ws_flag = 0._r8 - end if - - ! update offset_counter and test for the end of the offset period - if (offset_flag(p) == 1.0_r8) then - ! decrement counter for offset period - offset_counter(p) = offset_counter(p) - dt - - ! if this is the end of the offset_period, reset phenology - ! flags and indices - if (offset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_offset_cleanup(p) - ! inlined during vectorization - - offset_flag(p) = 0._r8 - offset_counter(p) = 0._r8 - dormant_flag(p) = 1._r8 - days_active(p) = 0._r8 - if (use_cndv) then - pftmayexist(p) = .true. - end if - - ! reset the previous timestep litterfall flux memory - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! update onset_counter and test for the end of the onset period - if (onset_flag(p) == 1.0_r8) then - ! decrement counter for onset period - onset_counter(p) = onset_counter(p) - dt - - ! if this is the end of the onset period, reset phenology - ! flags and indices - if (onset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_onset_cleanup(p) - ! inlined during vectorization - - onset_flag(p) = 0.0_r8 - onset_counter(p) = 0.0_r8 - ! set all transfer growth rates to 0.0 - leafc_xfer_to_leafc(p) = 0.0_r8 - frootc_xfer_to_frootc(p) = 0.0_r8 - leafn_xfer_to_leafn(p) = 0.0_r8 - frootn_xfer_to_frootn(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = 0.0_r8 - deadstemc_xfer_to_deadstemc(p) = 0.0_r8 - livecrootc_xfer_to_livecrootc(p) = 0.0_r8 - deadcrootc_xfer_to_deadcrootc(p) = 0.0_r8 - livestemn_xfer_to_livestemn(p) = 0.0_r8 - deadstemn_xfer_to_deadstemn(p) = 0.0_r8 - livecrootn_xfer_to_livecrootn(p) = 0.0_r8 - deadcrootn_xfer_to_deadcrootn(p) = 0.0_r8 - end if - ! set transfer pools to 0.0 - leafc_xfer(p) = 0.0_r8 - leafn_xfer(p) = 0.0_r8 - frootc_xfer(p) = 0.0_r8 - frootn_xfer(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer(p) = 0.0_r8 - livestemn_xfer(p) = 0.0_r8 - deadstemc_xfer(p) = 0.0_r8 - deadstemn_xfer(p) = 0.0_r8 - livecrootc_xfer(p) = 0.0_r8 - livecrootn_xfer(p) = 0.0_r8 - deadcrootc_xfer(p) = 0.0_r8 - deadcrootn_xfer(p) = 0.0_r8 - end if - end if - end if - - ! test for switching from dormant period to growth period - if (dormant_flag(p) == 1.0_r8) then - - ! Test to turn on growing degree-day sum, if off. - ! switch on the growing degree day sum on the winter solstice - - if (onset_gddflag(p) == 0._r8 .and. ws_flag == 1._r8) then - onset_gddflag(p) = 1._r8 - onset_gdd(p) = 0._r8 - end if - - ! Test to turn off growing degree-day sum, if on. - ! This test resets the growing degree day sum if it gets past - ! the summer solstice without reaching the threshold value. - ! In that case, it will take until the next winter solstice - ! before the growing degree-day summation starts again. - - if (onset_gddflag(p) == 1._r8 .and. ws_flag == 0._r8) then - onset_gddflag(p) = 0._r8 - onset_gdd(p) = 0._r8 - end if - - ! if the gdd flag is set, and if the soil is above freezing - ! then accumulate growing degree days for onset trigger - - soilt = t_soisno(c,3) - if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then - onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday - end if - - ! set onset_flag if critical growing degree-day sum is exceeded - if (onset_gdd(p) > crit_onset_gdd) then - onset_flag(p) = 1.0_r8 - dormant_flag(p) = 0.0_r8 - onset_gddflag(p) = 0.0_r8 - onset_gdd(p) = 0.0_r8 - onset_counter(p) = ndays_on * secspday - - ! move all the storage pools into transfer pools, - ! where they will be transfered to displayed growth over the onset period. - ! this code was originally handled with call cn_storage_to_xfer(p) - ! inlined during vectorization - - ! set carbon fluxes for shifting storage pools to transfer pools - leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt - frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt - deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt - livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt - deadcrootc_storage_to_xfer(p) = fstor2tran * deadcrootc_storage(p)/dt - gresp_storage_to_xfer(p) = fstor2tran * gresp_storage(p)/dt - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt - frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt - deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt - livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt - deadcrootn_storage_to_xfer(p) = fstor2tran * deadcrootn_storage(p)/dt - end if - end if - - ! test for switching from growth period to offset period - else if (offset_flag(p) == 0.0_r8) then - if (use_cndv) then - ! If days_active > 355, then remove patch in - ! CNDVEstablishment at the end of the year. - ! days_active > 355 is a symptom of seasonal decid. patches occurring in - ! gridcells where dayl never drops below crit_dayl. - ! This results in TLAI>1e4 in a few gridcells. - days_active(p) = days_active(p) + fracday - if (days_active(p) > 355._r8) pftmayexist(p) = .false. - end if - - ! only begin to test for offset daylength once past the summer sol - if (ws_flag == 0._r8 .and. dayl(g) < crit_dayl) then - offset_flag(p) = 1._r8 - offset_counter(p) = ndays_off * secspday - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - end if ! end if seasonal deciduous - - end do ! end of patch loop - - end associate - - end subroutine CNSeasonDecidPhenology - - !----------------------------------------------------------------------- - subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & - soilstate_inst, temperature_inst, atm2lnd_inst, wateratm2lndbulk_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! This routine handles phenology for vegetation types, such as grasses and - ! tropical drought deciduous trees, that respond to cold and drought stress - ! signals and that can have multiple growing seasons in a given year. - ! This routine allows for the possibility that leaves might persist year-round - ! in the absence of a suitable stress trigger, by switching to an essentially - ! evergreen habit, but maintaining a deciduous leaf longevity, while waiting - ! for the next stress trigger. This is in contrast to the seasonal deciduous - ! algorithm (for temperate deciduous trees) that forces a single growing season - ! per year. - ! - ! !USES: - use clm_time_manager , only : get_days_per_year - use CNSharedParamsMod, only : use_fun - use clm_varcon , only : secspday - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_PI - use CNSharedParamsMod, only : CNParamsShareInst - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - real(r8),parameter :: secspqtrday = secspday / 4 ! seconds per quarter day - integer :: g,c,p ! indices - integer :: fp ! lake filter patch index - real(r8):: dayspyr ! days per year - real(r8):: crit_onset_gdd ! degree days for onset trigger - real(r8):: soilt ! temperature of top soil layer - real(r8):: psi ! water stress of top soil layer - real(r8):: rain_threshold ! rain threshold for leaf on [mm] - logical :: additional_onset_condition ! additional condition for leaf onset - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) - - prec10 => wateratm2lndbulk_inst%prec10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of tot. precipitation - leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress-deciduous leaf habit (0 or 1) - - soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - dormant_flag => cnveg_state_inst%dormant_flag_patch , & ! Output: [real(r8) (:) ] dormancy flag - days_active => cnveg_state_inst%days_active_patch , & ! Output: [real(r8) (:) ] number of days since last dormancy - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag - onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter (seconds) - onset_gddflag => cnveg_state_inst%onset_gddflag_patch , & ! Output: [real(r8) (:) ] onset freeze flag - onset_fdd => cnveg_state_inst%onset_fdd_patch , & ! Output: [real(r8) (:) ] onset freezing degree days counter - onset_gdd => cnveg_state_inst%onset_gdd_patch , & ! Output: [real(r8) (:) ] onset growing degree days - onset_swi => cnveg_state_inst%onset_swi_patch , & ! Output: [real(r8) (:) ] onset soil water index - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag - offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter (seconds) - offset_fdd => cnveg_state_inst%offset_fdd_patch , & ! Output: [real(r8) (:) ] offset freezing degree days counter - offset_swi => cnveg_state_inst%offset_swi_patch , & ! Output: [real(r8) (:) ] offset soil water index - lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] - bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) - bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) - annavg_t2m => cnveg_state_inst%annavg_t2m_patch , & ! Output: [real(r8) (:) ] annual average 2m air temperature (K) - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - - prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) - prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - - leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] - frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] - livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] - deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] - deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] - leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] - ) - - ! set time steps - dayspyr = get_days_per_year() - - ! specify rain threshold for leaf onset - rain_threshold = 20._r8 - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - g = patch%gridcell(p) - - if (stress_decid(ivt(p)) == 1._r8) then - soilt = t_soisno(c,3) - psi = soilpsi(c,3) - - ! onset gdd sum from Biome-BGC, v4.1.2 - crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) - - - ! update offset_counter and test for the end of the offset period - if (offset_flag(p) == 1._r8) then - ! decrement counter for offset period - offset_counter(p) = offset_counter(p) - dt - - ! if this is the end of the offset_period, reset phenology - ! flags and indices - if (offset_counter(p) == 0._r8) then - ! this code block was originally handled by call cn_offset_cleanup(p) - ! inlined during vectorization - offset_flag(p) = 0._r8 - offset_counter(p) = 0._r8 - dormant_flag(p) = 1._r8 - days_active(p) = 0._r8 - - ! reset the previous timestep litterfall flux memory - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! update onset_counter and test for the end of the onset period - if (onset_flag(p) == 1.0_r8) then - ! decrement counter for onset period - onset_counter(p) = onset_counter(p) - dt - - ! if this is the end of the onset period, reset phenology - ! flags and indices - if (onset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_onset_cleanup(p) - ! inlined during vectorization - onset_flag(p) = 0._r8 - onset_counter(p) = 0._r8 - ! set all transfer growth rates to 0.0 - leafc_xfer_to_leafc(p) = 0._r8 - frootc_xfer_to_frootc(p) = 0._r8 - leafn_xfer_to_leafn(p) = 0._r8 - frootn_xfer_to_frootn(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = 0._r8 - deadstemc_xfer_to_deadstemc(p) = 0._r8 - livecrootc_xfer_to_livecrootc(p) = 0._r8 - deadcrootc_xfer_to_deadcrootc(p) = 0._r8 - livestemn_xfer_to_livestemn(p) = 0._r8 - deadstemn_xfer_to_deadstemn(p) = 0._r8 - livecrootn_xfer_to_livecrootn(p) = 0._r8 - deadcrootn_xfer_to_deadcrootn(p) = 0._r8 - end if - ! set transfer pools to 0.0 - leafc_xfer(p) = 0._r8 - leafn_xfer(p) = 0._r8 - frootc_xfer(p) = 0._r8 - frootn_xfer(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer(p) = 0._r8 - livestemn_xfer(p) = 0._r8 - deadstemc_xfer(p) = 0._r8 - deadstemn_xfer(p) = 0._r8 - livecrootc_xfer(p) = 0._r8 - livecrootn_xfer(p) = 0._r8 - deadcrootc_xfer(p) = 0._r8 - deadcrootn_xfer(p) = 0._r8 - end if - end if - end if - - ! test for switching from dormant period to growth period - if (dormant_flag(p) == 1._r8) then - - ! keep track of the number of freezing degree days in this - ! dormancy period (only if the freeze flag has not previously been set - ! for this dormancy period - - if (onset_gddflag(p) == 0._r8 .and. soilt < SHR_CONST_TKFRZ) onset_fdd(p) = onset_fdd(p) + fracday - - ! if the number of freezing degree days exceeds a critical value, - ! then onset will require both wet soils and a critical soil - ! temperature sum. If this case is triggered, reset any previously - ! accumulated value in onset_swi, so that onset now depends on - ! the accumulated soil water index following the freeze trigger - - if (onset_fdd(p) > crit_onset_fdd) then - onset_gddflag(p) = 1._r8 - onset_fdd(p) = 0._r8 - onset_swi(p) = 0._r8 - end if - - ! if the freeze flag is set, and if the soil is above freezing - ! then accumulate growing degree days for onset trigger - - if (onset_gddflag(p) == 1._r8 .and. soilt > SHR_CONST_TKFRZ) then - onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday - end if - - ! if soils are wet, accumulate soil water index for onset trigger - additional_onset_condition = .true. - if(CNParamsShareInst%constrain_stress_deciduous_onset) then - ! if additional constraint condition not met, set to false - if ((prec10(p) * (3600.0_r8*10.0_r8*24.0_r8)) < rain_threshold) then - additional_onset_condition = .false. - endif - endif - - if (psi >= soilpsi_on) then - onset_swi(p) = onset_swi(p) + fracday - endif - - ! if critical soil water index is exceeded, set onset_flag, and - ! then test for soil temperature criteria - - ! Adding in Kyla's rainfall trigger when fun on. RF. prec10 (mm/s) needs to be higher than 8mm over 10 days. - - if (onset_swi(p) > crit_onset_swi.and. additional_onset_condition) then - onset_flag(p) = 1._r8 - - ! only check soil temperature criteria if freeze flag set since - ! beginning of last dormancy. If freeze flag set and growing - ! degree day sum (since freeze trigger) is lower than critical - ! value, then override the onset_flag set from soil water. - - if (onset_gddflag(p) == 1._r8 .and. onset_gdd(p) < crit_onset_gdd) onset_flag(p) = 0._r8 - end if - - ! only allow onset if dayl > 6hrs - if (onset_flag(p) == 1._r8 .and. dayl(g) <= secspqtrday) then - onset_flag(p) = 0._r8 - end if - - ! if this is the beginning of the onset period - ! then reset the phenology flags and indices - - if (onset_flag(p) == 1._r8) then - dormant_flag(p) = 0._r8 - days_active(p) = 0._r8 - onset_gddflag(p) = 0._r8 - onset_fdd(p) = 0._r8 - onset_gdd(p) = 0._r8 - onset_swi(p) = 0._r8 - onset_counter(p) = ndays_on * secspday - - ! call subroutine to move all the storage pools into transfer pools, - ! where they will be transfered to displayed growth over the onset period. - ! this code was originally handled with call cn_storage_to_xfer(p) - ! inlined during vectorization - - ! set carbon fluxes for shifting storage pools to transfer pools - leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt - frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt - deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt - livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt - deadcrootc_storage_to_xfer(p) = fstor2tran * deadcrootc_storage(p)/dt - gresp_storage_to_xfer(p) = fstor2tran * gresp_storage(p)/dt - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt - frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt - deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt - livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt - deadcrootn_storage_to_xfer(p) = fstor2tran * deadcrootn_storage(p)/dt - end if - end if - - ! test for switching from growth period to offset period - else if (offset_flag(p) == 0._r8) then - - ! if soil water potential lower than critical value, accumulate - ! as stress in offset soil water index - - if (psi <= soilpsi_off) then - offset_swi(p) = offset_swi(p) + fracday - - ! if the offset soil water index exceeds critical value, and - ! if this is not the middle of a previously initiated onset period, - ! then set flag to start the offset period and reset index variables - - if (offset_swi(p) >= crit_offset_swi .and. onset_flag(p) == 0._r8) offset_flag(p) = 1._r8 - - ! if soil water potential higher than critical value, reduce the - ! offset water stress index. By this mechanism, there must be a - ! sustained period of water stress to initiate offset. - - else if (psi >= soilpsi_on) then - offset_swi(p) = offset_swi(p) - fracday - offset_swi(p) = max(offset_swi(p),0._r8) - end if - - ! decrease freezing day accumulator for warm soil - if (offset_fdd(p) > 0._r8 .and. soilt > SHR_CONST_TKFRZ) then - offset_fdd(p) = offset_fdd(p) - fracday - offset_fdd(p) = max(0._r8, offset_fdd(p)) - end if - - ! increase freezing day accumulator for cold soil - if (soilt <= SHR_CONST_TKFRZ) then - offset_fdd(p) = offset_fdd(p) + fracday - - ! if freezing degree day sum is greater than critical value, initiate offset - if (offset_fdd(p) > crit_offset_fdd .and. onset_flag(p) == 0._r8) offset_flag(p) = 1._r8 - end if - - ! force offset if daylength is < 6 hrs - if (dayl(g) <= secspqtrday) then - offset_flag(p) = 1._r8 - end if - - ! if this is the beginning of the offset period - ! then reset flags and indices - if (offset_flag(p) == 1._r8) then - offset_fdd(p) = 0._r8 - offset_swi(p) = 0._r8 - offset_counter(p) = ndays_off * secspday - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! keep track of number of days since last dormancy for control on - ! fraction of new growth to send to storage for next growing season - - if (dormant_flag(p) == 0.0_r8) then - days_active(p) = days_active(p) + fracday - end if - - ! calculate long growing season factor (lgsf) - ! only begin to calculate a lgsf greater than 0.0 once the number - ! of days active exceeds days/year. - lgsf(p) = max(min(3.0_r8*(days_active(p)-leaf_long(ivt(p))*dayspyr )/dayspyr, 1._r8),0._r8) - ! RosieF. 5 Nov 2015. Changed this such that the increase in leaf turnover is faster after - ! trees enter the 'fake evergreen' state. Otherwise, they have a whole year of - ! cheating, with less litterfall than they should have, resulting in very high LAI. - ! Further, the 'fake evergreen' state (where lgsf>0) is entered at the end of a single leaf lifespan - ! and not a whole year. The '3' is arbitrary, given that this entire system is quite abstract. - - - ! set background litterfall rate, when not in the phenological offset period - if (offset_flag(p) == 1._r8) then - bglfr(p) = 0._r8 - else - ! calculate the background litterfall rate (bglfr) - ! in units 1/s, based on leaf longevity (yrs) and correction for long growing season - - bglfr(p) = (1._r8/(leaf_long(ivt(p))*dayspyr*secspday))*lgsf(p) - end if - - ! set background transfer rate when active but not in the phenological onset period - if (onset_flag(p) == 1._r8) then - bgtr(p) = 0._r8 - else - ! the background transfer rate is calculated as the rate that would result - ! in complete turnover of the storage pools in one year at steady state, - ! once lgsf has reached 1.0 (after 730 days active). - - bgtr(p) = (1._r8/(dayspyr*secspday))*lgsf(p) - - ! set carbon fluxes for shifting storage pools to transfer pools - - ! reduced the amount of stored carbon flowing to display pool by only counting the delta - ! between leafc and leafc_store in the flux. RosieF, Nov5 2015. - leafc_storage_to_xfer(p) = max(0.0_r8,(leafc_storage(p)-leafc(p))) * bgtr(p) - frootc_storage_to_xfer(p) = max(0.0_r8,(frootc_storage(p)-frootc(p))) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = livestemc_storage(p) * bgtr(p) - deadstemc_storage_to_xfer(p) = deadstemc_storage(p) * bgtr(p) - livecrootc_storage_to_xfer(p) = livecrootc_storage(p) * bgtr(p) - deadcrootc_storage_to_xfer(p) = deadcrootc_storage(p) * bgtr(p) - gresp_storage_to_xfer(p) = gresp_storage(p) * bgtr(p) - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = leafn_storage(p) * bgtr(p) - frootn_storage_to_xfer(p) = frootn_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = livestemn_storage(p) * bgtr(p) - deadstemn_storage_to_xfer(p) = deadstemn_storage(p) * bgtr(p) - livecrootn_storage_to_xfer(p) = livecrootn_storage(p) * bgtr(p) - deadcrootn_storage_to_xfer(p) = deadcrootn_storage(p) * bgtr(p) - end if - end if - - end if ! end if stress deciduous - - end do ! end of patch loop - - end associate - - end subroutine CNStressDecidPhenology - - !----------------------------------------------------------------------- - subroutine CropPhenology(num_pcropp, filter_pcropp , & - waterdiagnosticbulk_inst, temperature_inst, crop_inst, canopystate_inst, cnveg_state_inst , & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst,& - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst) - - ! !DESCRIPTION: - ! Code from AgroIBIS to determine crop phenology and code from CN to - ! handle CN fluxes during the phenological onset & offset periods. - - ! !USES: - use clm_time_manager , only : get_curr_date, get_curr_calday, get_days_per_year, get_rad_step_size - use pftconMod , only : ntmp_corn, nswheat, nwwheat, ntmp_soybean - use pftconMod , only : nirrig_tmp_corn, nirrig_swheat, nirrig_wwheat, nirrig_tmp_soybean - use pftconMod , only : ntrp_corn, nsugarcane, ntrp_soybean, ncotton, nrice - use pftconMod , only : nirrig_trp_corn, nirrig_sugarcane, nirrig_trp_soybean - use pftconMod , only : nirrig_cotton, nirrig_rice - - ! Y. Cheng - use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass - - use clm_varcon , only : spval, secspday - use clm_varctl , only : use_fertilizer - use clm_varctl , only : use_c13, use_c14 - use clm_varcon , only : c13ratio, c14ratio - ! - ! !ARGUMENTS: - integer , intent(in) :: num_pcropp ! number of prog crop patches in filter - integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(temperature_type) , intent(in) :: temperature_inst - type(crop_type) , intent(inout) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - ! - ! LOCAL VARAIBLES: - integer kyr ! current year - integer kmo ! month of year (1, ..., 12) - integer kda ! day of month (1, ..., 31) - integer mcsec ! seconds of day (0, ..., seconds/day) - integer jday ! julian day of the year - integer fp,p ! patch indices - integer c ! column indices - integer g ! gridcell indices - integer h ! hemisphere indices - integer idpp ! number of days past planting - real(r8) :: dtrad ! radiation time step delta t (seconds) - real(r8) dayspyr ! days per year - real(r8) crmcorn ! comparitive relative maturity for corn - real(r8) ndays_on ! number of days to fertilize - !------------------------------------------------------------------------ - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - manunitro => pftcon%manunitro , & ! Input: max manure to be applied in total (kgN/m2) - mxmat => pftcon%mxmat , & ! Input: - minplanttemp => pftcon%minplanttemp , & ! Input: - planttemp => pftcon%planttemp , & ! Input: - gddmin => pftcon%gddmin , & ! Input: - hybgdd => pftcon%hybgdd , & ! Input: - lfemerg => pftcon%lfemerg , & ! Input: - grnfill => pftcon%grnfill , & ! Input: - - t_ref2m_min => temperature_inst%t_ref2m_min_patch , & ! Input: [real(r8) (:) ] daily minimum of average 2 m height surface air temperature (K) - t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K) - a5tmin => temperature_inst%t_a5min_patch , & ! Input: [real(r8) (:) ] 5-day running mean of min 2-m temperature - a10tmin => temperature_inst%t_a10min_patch , & ! Input: [real(r8) (:) ] 10-day running mean of min 2-m temperature - gdd020 => temperature_inst%gdd020_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd0 - gdd820 => temperature_inst%gdd820_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd8 - gdd1020 => temperature_inst%gdd1020_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd10 - - fertnitro => crop_inst%fertnitro_patch , & ! Input: [real(r8) (:) ] fertilizer nitrogen - hui => crop_inst%gddplant_patch , & ! Input: [real(r8) (:) ] gdd since planting (gddplant) - leafout => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] gdd from top soil layer temperature - harvdate => crop_inst%harvdate_patch , & ! Output: [integer (:) ] harvest date - croplive => crop_inst%croplive_patch , & ! Output: [logical (:) ] Flag, true if planted, not harvested - cropplant => crop_inst%cropplant_patch , & ! Output: [logical (:) ] Flag, true if crop may be planted - vf => crop_inst%vf_patch , & ! Output: [real(r8) (:) ] vernalization factor - peaklai => cnveg_state_inst%peaklai_patch , & ! Output: [integer (:) ] 1: max allowed lai; 0: not at max - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - - idop => cnveg_state_inst%idop_patch , & ! Output: [integer (:) ] date of planting - gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Output: [real(r8) (:) ] gdd needed to harvest - huileaf => cnveg_state_inst%huileaf_patch , & ! Output: [real(r8) (:) ] heat unit index needed from planting to leaf emergence - huigrain => cnveg_state_inst%huigrain_patch , & ! Output: [real(r8) (:) ] same to reach vegetative maturity - cumvd => cnveg_state_inst%cumvd_patch , & ! Output: [real(r8) (:) ] cumulative vernalization d?ependence? - hdidx => cnveg_state_inst%hdidx_patch , & ! Output: [real(r8) (:) ] cold hardening index? - bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) - bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) - lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag - onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter - offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter - - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer - - crop_seedc_to_leaf => cnveg_carbonflux_inst%crop_seedc_to_leaf_patch, & ! Output: [real(r8) (:) ] (gC/m2/s) seed source to leaf - - fert_counter => cnveg_nitrogenflux_inst%fert_counter_patch , & ! Output: [real(r8) (:) ] >0 fertilize; <=0 not (seconds) - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer - crop_seedn_to_leaf => cnveg_nitrogenflux_inst%crop_seedn_to_leaf_patch, & ! Output: [real(r8) (:) ] (gN/m2/s) seed source to leaf - cphase => crop_inst%cphase_patch , & ! Output: [real(r8) (:)] phenology phase - fert => cnveg_nitrogenflux_inst%fert_patch & ! Output: [real(r8) (:) ] (gN/m2/s) fertilizer applied each timestep - ) - - ! get time info - dayspyr = get_days_per_year() - jday = get_curr_calday() - call get_curr_date(kyr, kmo, kda, mcsec) - dtrad = real( get_rad_step_size(), r8 ) - - if (use_fertilizer) then - ndays_on = 20._r8 ! number of days to fertilize - else - ndays_on = 0._r8 ! number of days to fertilize - end if - - do fp = 1, num_pcropp - p = filter_pcropp(fp) - c = patch%column(p) - g = patch%gridcell(p) - h = inhemi(p) - - ! background litterfall and transfer rates; long growing season factor - - bglfr(p) = 0._r8 ! this value changes later in a crop's life cycle - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - - ! --------------------------------- - ! from AgroIBIS subroutine planting - ! --------------------------------- - - ! in order to allow a crop to be planted only once each year - ! initialize cropplant = .false., but hold it = .true. through the end of the year - - ! initialize other variables that are calculated for crops - ! on an annual basis in cropresidue subroutine - - if ( jday == jdayyrstart(h) .and. mcsec == 0 )then - - ! make sure variables aren't changed at beginning of the year - ! for a crop that is currently planted, such as - ! WINTER TEMPERATE CEREAL = winter (wheat + barley + rye) - ! represented here by the winter wheat pft - - if (.not. croplive(p)) then - cropplant(p) = .false. - idop(p) = NOT_Planted - - ! keep next for continuous, annual winter temperate cereal crop; - ! if we removed elseif, - ! winter cereal grown continuously would amount to a cereal/fallow - ! rotation because cereal would only be planted every other year - - else if (croplive(p) .and. (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat)) then - cropplant(p) = .false. - ! else ! not possible to have croplive and ivt==cornORsoy? (slevis) - end if - - end if - - if ( (.not. croplive(p)) .and. (.not. cropplant(p)) ) then - - ! gdd needed for * chosen crop and a likely hybrid (for that region) * - ! to reach full physiological maturity - - ! based on accumulated seasonal average growing degree days from - ! April 1 - Sept 30 (inclusive) - ! for corn and soybeans in the United States - - ! decided upon by what the typical average growing season length is - ! and the gdd needed to reach maturity in those regions - - ! first choice is used for spring temperate cereal and/or soybeans and maize - - ! slevis: ibis reads xinpdate in io.f from control.crops.nc variable name 'plantdate' - ! According to Chris Kucharik, the dataset of - ! xinpdate was generated from a previous model run at 0.5 deg resolution - - ! winter temperate cereal : use gdd0 as a limit to plant winter cereal - - if (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat) then - - ! add check to only plant winter cereal after other crops (soybean, maize) - ! have been harvested - - ! *** remember order of planting is crucial - in terms of which crops you want - ! to be grown in what order *** - - ! in this case, corn or soybeans are assumed to be planted before - ! cereal would be in any particular year that both patches are allowed - ! to grow in the same grid cell (e.g., double-cropping) - - ! slevis: harvdate below needs cropplant(p) above to be cropplant(p,ivt(p)) - ! where ivt(p) has rotated to winter cereal because - ! cropplant through the end of the year for a harvested crop. - ! Also harvdate(p) should be harvdate(p,ivt(p)) and should be - ! updated on Jan 1st instead of at harvest (slevis) - if (a5tmin(p) /= spval .and. & - a5tmin(p) <= minplanttemp(ivt(p)) .and. & - jday >= minplantjday(ivt(p),h) .and. & - (gdd020(p) /= spval .and. & - gdd020(p) >= gddmin(ivt(p)))) then - - cumvd(p) = 0._r8 - hdidx(p) = 0._r8 - vf(p) = 0._r8 - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - gddmaturity(p) = hybgdd(ivt(p)) - leafc_xfer(p) = initial_seed_at_planting - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - crop_seedc_to_leaf(p) = leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = leafn_xfer(p)/dt - - ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope - ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise - if (use_c13) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio - endif - endif - if (use_c14) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio - endif - endif - - ! latest possible date to plant winter cereal and after all other - ! crops were harvested for that year - - else if (jday >= maxplantjday(ivt(p),h) .and. & - gdd020(p) /= spval .and. & - gdd020(p) >= gddmin(ivt(p))) then - - cumvd(p) = 0._r8 - hdidx(p) = 0._r8 - vf(p) = 0._r8 - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - gddmaturity(p) = hybgdd(ivt(p)) - leafc_xfer(p) = initial_seed_at_planting - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - crop_seedc_to_leaf(p) = leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = leafn_xfer(p)/dt - - ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope - ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise - if (use_c13) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio - endif - endif - if (use_c14) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio - endif - endif - else - gddmaturity(p) = 0._r8 - end if - - else ! not winter cereal... slevis: added distinction between NH and SH - ! slevis: The idea is that jday will equal idop sooner or later in the year - ! while the gdd part is either true or false for the year. - if (t10(p) /= spval.and. a10tmin(p) /= spval .and. & - t10(p) > planttemp(ivt(p)) .and. & - a10tmin(p) > minplanttemp(ivt(p)) .and. & - jday >= minplantjday(ivt(p),h) .and. & - jday <= maxplantjday(ivt(p),h) .and. & - t10(p) /= spval .and. a10tmin(p) /= spval .and. & - gdd820(p) /= spval .and. & - gdd820(p) >= gddmin(ivt(p))) then - - ! impose limit on growing season length needed - ! for crop maturity - for cold weather constraints - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - - ! go a specified amount of time before/after - ! climatological date - if (ivt(p) == ntmp_soybean .or. ivt(p) == nirrig_tmp_soybean .or. & - ivt(p) == ntrp_soybean .or. ivt(p) == nirrig_trp_soybean) then - gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) - end if - - ! Y. Cheng, add switchgrass and Miscanthus - if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & - ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & - ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & - ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then - gddmaturity(p) = max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) - gddmaturity(p) = max(950._r8, min(gddmaturity(p)+150._r8, 1850._r8)) - end if - if (ivt(p) == nswheat .or. ivt(p) == nirrig_swheat .or. & - ivt(p) == ncotton .or. ivt(p) == nirrig_cotton .or. & - ivt(p) == nrice .or. ivt(p) == nirrig_rice) then - gddmaturity(p) = min(gdd020(p), hybgdd(ivt(p))) - end if - - leafc_xfer(p) = initial_seed_at_planting - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - crop_seedc_to_leaf(p) = leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = leafn_xfer(p)/dt - - ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope - ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise - if (use_c13) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio - endif - endif - if (use_c14) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio - endif - endif - - - ! If hit the max planting julian day -- go ahead and plant - else if (jday == maxplantjday(ivt(p),h) .and. gdd820(p) > 0._r8 .and. & - gdd820(p) /= spval ) then - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - - if (ivt(p) == ntmp_soybean .or. ivt(p) == nirrig_tmp_soybean .or. & - ivt(p) == ntrp_soybean .or. ivt(p) == nirrig_trp_soybean) then - gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) - end if - - ! Y. Cheng, add switchgrass and Miscanthus - if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & - ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & - ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & - ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then - gddmaturity(p) = max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) - end if - if (ivt(p) == nswheat .or. ivt(p) == nirrig_swheat .or. & - ivt(p) == ncotton .or. ivt(p) == nirrig_cotton .or. & - ivt(p) == nrice .or. ivt(p) == nirrig_rice) then - gddmaturity(p) = min(gdd020(p), hybgdd(ivt(p))) - end if - - leafc_xfer(p) = initial_seed_at_planting - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - crop_seedc_to_leaf(p) = leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = leafn_xfer(p)/dt - - ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope - ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise - if (use_c13) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio - endif - endif - if (use_c14) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio - endif - endif - - else - gddmaturity(p) = 0._r8 - end if - end if ! crop patch distinction - - ! crop phenology (gdd thresholds) controlled by gdd needed for - ! maturity (physiological) which is based on the average gdd - ! accumulation and hybrids in United States from April 1 - Sept 30 - - ! calculate threshold from phase 1 to phase 2: - ! threshold for attaining leaf emergence (based on fraction of - ! gdd(i) -- climatological average) - ! Hayhoe and Dwyer, 1990, Can. J. Soil Sci 70:493-497 - ! Carlson and Gage, 1989, Agric. For. Met., 45: 313-324 - ! J.T. Ritchie, 1991: Modeling Plant and Soil systems - - huileaf(p) = lfemerg(ivt(p)) * gddmaturity(p) ! 3-7% in cereal - - ! calculate threshhold from phase 2 to phase 3: - ! from leaf emergence to beginning of grain-fill period - ! this hypothetically occurs at the end of tassling, not the beginning - ! tassel initiation typically begins at 0.5-0.55 * gddmaturity - - ! calculate linear relationship between huigrain fraction and relative - ! maturity rating for maize - - ! Y. Cheng, add switchgrass and Miscanthus - if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & - ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & - ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & - ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass) then - ! the following estimation of crmcorn from gddmaturity is based on a linear - ! regression using data from Pioneer-brand corn hybrids (Kucharik, 2003, - ! Earth Interactions 7:1-33: fig. 2) - crmcorn = max(73._r8, min(135._r8, (gddmaturity(p)+ 53.683_r8)/13.882_r8)) - - ! the following adjustment of grnfill based on crmcorn is based on a tuning - ! of Agro-IBIS to give reasonable results for max LAI and the seasonal - ! progression of LAI growth (pers. comm. C. Kucharik June 10, 2010) - huigrain(p) = -0.002_r8 * (crmcorn - 73._r8) + grnfill(ivt(p)) - - huigrain(p) = min(max(huigrain(p), grnfill(ivt(p))-0.1_r8), grnfill(ivt(p))) - huigrain(p) = huigrain(p) * gddmaturity(p) ! Cabelguenne et - else - huigrain(p) = grnfill(ivt(p)) * gddmaturity(p) ! al. 1999 - end if - - end if ! crop not live nor planted - - ! ---------------------------------- - ! from AgroIBIS subroutine phenocrop - ! ---------------------------------- - - ! all of the phenology changes are based on the total number of gdd needed - ! to change to the next phase - based on fractions of the total gdd typical - ! for that region based on the April 1 - Sept 30 window of development - - ! crop phenology (gdd thresholds) controlled by gdd needed for - ! maturity (physiological) which is based on the average gdd - ! accumulation and hybrids in United States from April 1 - Sept 30 - - ! Phase 1: Planting to leaf emergence (now in CNAllocation) - ! Phase 2: Leaf emergence to beginning of grain fill (general LAI accumulation) - ! Phase 3: Grain fill to physiological maturity and harvest (LAI decline) - ! Harvest: if gdd past grain fill initiation exceeds limit - ! or number of days past planting reaches a maximum, the crop has - ! reached physiological maturity and plant is harvested; - ! crop could be live or dead at this stage - these limits - ! could lead to reaching physiological maturity or determining - ! a harvest date for a crop killed by an early frost (see next comments) - ! --- --- --- - ! keeping comments without the code (slevis): - ! if minimum temperature, t_ref2m_min <= freeze kill threshold, tkill - ! for 3 consecutive days and lai is above a minimum, - ! plant will be damaged/killed. This function is more for spring freeze events - ! or for early fall freeze events - - ! spring temperate cereal is affected by this, winter cereal kill function - ! is determined in crops.f - is a more elaborate function of - ! cold hardening of the plant - - ! currently simulates too many grid cells killed by freezing temperatures - - ! removed on March 12 2002 - C. Kucharik - ! until it can be a bit more refined, or used at a smaller scale. - ! we really have no way of validating this routine - ! too difficult to implement on 0.5 degree scale grid cells - ! --- --- --- - - onset_flag(p) = 0._r8 ! CN terminology to trigger certain - offset_flag(p) = 0._r8 ! carbon and nitrogen transfers - - if (croplive(p)) then - cphase(p) = 1._r8 - - ! call vernalization if winter temperate cereal planted, living, and the - ! vernalization factor is not 1; - ! vf affects the calculation of gddtsoi & gddplant - - if (t_ref2m_min(p) < 1.e30_r8 .and. vf(p) /= 1._r8 .and. & - (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat)) then - call vernalization(p, & - canopystate_inst, temperature_inst, waterdiagnosticbulk_inst, cnveg_state_inst, & - crop_inst) - end if - - ! days past planting may determine harvest - - if (jday >= idop(p)) then - idpp = jday - idop(p) - else - idpp = int(dayspyr) + jday - idop(p) - end if - - ! onset_counter initialized to zero when .not. croplive - ! offset_counter relevant only at time step of harvest - - onset_counter(p) = onset_counter(p) - dt - - ! enter phase 2 onset for one time step: - ! transfer seed carbon to leaf emergence - - if (peaklai(p) >= 1) then - hui(p) = max(hui(p),huigrain(p)) - endif - - if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat(ivt(p))) then - cphase(p) = 2._r8 - if (abs(onset_counter(p)) > 1.e-6_r8) then - onset_flag(p) = 1._r8 - onset_counter(p) = dt - fert_counter(p) = ndays_on * secspday - if (ndays_on .gt. 0) then - fert(p) = (manunitro(ivt(p)) * 1000._r8 + fertnitro(p))/ fert_counter(p) - else - fert(p) = 0._r8 - end if - else - ! this ensures no re-entry to onset of phase2 - ! b/c onset_counter(p) = onset_counter(p) - dt - ! at every time step - - onset_counter(p) = dt - end if - - ! enter harvest for one time step: - ! - transfer live biomass to litter and to crop yield - ! - send xsmrpool to the atmosphere - ! if onset and harvest needed to last longer than one timestep - ! the onset_counter would change from dt and you'd need to make - ! changes to the offset subroutine below - - else if (hui(p) >= gddmaturity(p) .or. idpp >= mxmat(ivt(p))) then - if (harvdate(p) >= NOT_Harvested) harvdate(p) = jday - croplive(p) = .false. ! no re-entry in greater if-block - cphase(p) = 4._r8 - if (tlai(p) > 0._r8) then ! plant had emerged before harvest - offset_flag(p) = 1._r8 - offset_counter(p) = dt - else ! plant never emerged from the ground - ! Revert planting transfers; this will replenish the crop seed deficit. - ! We subtract from any existing value in crop_seedc_to_leaf / - ! crop_seedn_to_leaf in the unlikely event that we enter this block of - ! code in the same time step where the planting transfer originally - ! occurred. - crop_seedc_to_leaf(p) = crop_seedc_to_leaf(p) - leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = crop_seedn_to_leaf(p) - leafn_xfer(p)/dt - leafc_xfer(p) = 0._r8 - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) - if (use_c13) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 - endif - if (use_c14) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 - endif - - end if - - ! enter phase 3 while previous criteria fail and next is true; - ! in terms of order, phase 3 occurs before harvest, but when - ! harvest *can* occur, we want it to have first priority. - ! AgroIBIS uses a complex formula for lai decline. - ! Use CN's simple formula at least as a place holder (slevis) - - else if (hui(p) >= huigrain(p)) then - cphase(p) = 3._r8 - bglfr(p) = 1._r8/(leaf_long(ivt(p))*dayspyr*secspday) - end if - - ! continue fertilizer application while in phase 2; - ! assumes that onset of phase 2 took one time step only - - if (fert_counter(p) <= 0._r8) then - fert(p) = 0._r8 - else ! continue same fert application every timestep - fert_counter(p) = fert_counter(p) - dtrad - end if - - else ! crop not live - ! next 2 lines conserve mass if leaf*_xfer > 0 due to interpinic. - ! We subtract from any existing value in crop_seedc_to_leaf / - ! crop_seedn_to_leaf in the unlikely event that we enter this block of - ! code in the same time step where the planting transfer originally - ! occurred. - crop_seedc_to_leaf(p) = crop_seedc_to_leaf(p) - leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = crop_seedn_to_leaf(p) - leafn_xfer(p)/dt - onset_counter(p) = 0._r8 - leafc_xfer(p) = 0._r8 - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) - if (use_c13) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 - endif - if (use_c14) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 - endif - end if ! croplive - - end do ! prognostic crops loop - - end associate - - end subroutine CropPhenology - - !----------------------------------------------------------------------- - subroutine CropPhenologyInit(bounds) - ! - ! !DESCRIPTION: - ! Initialization of CropPhenology. Must be called after time-manager is - ! initialized, and after pftcon file is read in. - ! - ! !USES: - use pftconMod , only: npcropmin, npcropmax - use clm_time_manager, only: get_calday - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! LOCAL VARAIBLES: - integer :: p,g,n,i ! indices - !------------------------------------------------------------------------ - - allocate( inhemi(bounds%begp:bounds%endp) ) - - allocate( minplantjday(0:maxveg,inSH)) ! minimum planting julian day - allocate( maxplantjday(0:maxveg,inSH)) ! minimum planting julian day - - ! Julian day for the start of the year (mid-winter) - jdayyrstart(inNH) = 1 - jdayyrstart(inSH) = 182 - - ! Convert planting dates into julian day - minplantjday(:,:) = huge(1) - maxplantjday(:,:) = huge(1) - do n = npcropmin, npcropmax - if (pftcon%is_pft_known_to_model(n)) then - minplantjday(n, inNH) = int( get_calday( pftcon%mnNHplantdate(n), 0 ) ) - maxplantjday(n, inNH) = int( get_calday( pftcon%mxNHplantdate(n), 0 ) ) - - minplantjday(n, inSH) = int( get_calday( pftcon%mnSHplantdate(n), 0 ) ) - maxplantjday(n, inSH) = int( get_calday( pftcon%mxSHplantdate(n), 0 ) ) - end if - end do - - ! Figure out what hemisphere each PATCH is in - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - ! Northern hemisphere - if ( grc%latdeg(g) > 0.0_r8 )then - inhemi(p) = inNH - else - inhemi(p) = inSH - end if - end do - - ! - ! Constants for Crop vernalization - ! - ! photoperiod factor calculation - ! genetic constant - can be modified - - p1d = 0.004_r8 ! average for genotypes from Ritchey, 1991. - ! Modeling plant & soil systems: Wheat phasic developmt - p1v = 0.003_r8 ! average for genotypes from Ritchey, 1991. - - hti = 1._r8 - tbase = 0._r8 - - end subroutine CropPhenologyInit - - !----------------------------------------------------------------------- - subroutine vernalization(p, & - canopystate_inst, temperature_inst, waterdiagnosticbulk_inst, cnveg_state_inst, crop_inst) - ! - ! !DESCRIPTION: - ! - ! * * * only call for winter temperate cereal * * * - ! - ! subroutine calculates vernalization and photoperiod effects on - ! gdd accumulation in winter temperate cereal varieties. Thermal time accumulation - ! is reduced in 1st period until plant is fully vernalized. During this - ! time of emergence to spikelet formation, photoperiod can also have a - ! drastic effect on plant development. - ! - ! !ARGUMENTS: - integer , intent(in) :: p ! PATCH index running over - type(canopystate_type) , intent(in) :: canopystate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(inout) :: crop_inst - ! - ! LOCAL VARAIBLES: - real(r8) tcrown ! ? - real(r8) vd, vd1, vd2 ! vernalization dependence - real(r8) tkil ! Freeze kill threshold - integer c,g ! indices - !------------------------------------------------------------------------ - - associate( & - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - - t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2 m height surface air temperature (K) - t_ref2m_min => temperature_inst%t_ref2m_min_patch , & ! Input: [real(r8) (:) ] daily minimum of average 2 m height surface air temperature (K) - t_ref2m_max => temperature_inst%t_ref2m_max_patch , & ! Input: [real(r8) (:) ] daily maximum of average 2 m height surface air temperature (K) - - snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - - hdidx => cnveg_state_inst%hdidx_patch , & ! Output: [real(r8) (:) ] cold hardening index? - cumvd => cnveg_state_inst%cumvd_patch , & ! Output: [real(r8) (:) ] cumulative vernalization d?ependence? - gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Output: [real(r8) (:) ] gdd needed to harvest - huigrain => cnveg_state_inst%huigrain_patch , & ! Output: [real(r8) (:) ] heat unit index needed to reach vegetative maturity - - vf => crop_inst%vf_patch & ! Output: [real(r8) (:) ] vernalization factor for cereal - ) - - c = patch%column(p) - - ! for all equations - temperatures must be in degrees (C) - ! calculate temperature of crown of crop (e.g., 3 cm soil temperature) - ! snow depth in centimeters - - if (t_ref2m(p) < tfrz) then !slevis: t_ref2m inst of td=daily avg (K) - tcrown = 2._r8 + (t_ref2m(p) - tfrz) * (0.4_r8 + 0.0018_r8 * & - (min(snow_depth(c)*100._r8, 15._r8) - 15._r8)**2) - else !slevis: snow_depth inst of adsnod=daily average (m) - tcrown = t_ref2m(p) - tfrz - end if - - ! vernalization factor calculation - ! if vf(p) = 1. then plant is fully vernalized - and thermal time - ! accumulation in phase 1 will be unaffected - ! refers to gddtsoi & gddplant, defined in the accumulation routines (slevis) - ! reset vf, cumvd, and hdidx to 0 at planting of crop (slevis) - - if (t_ref2m_max(p) > tfrz) then - if (t_ref2m_min(p) <= tfrz+15._r8) then - vd1 = 1.4_r8 - 0.0778_r8 * tcrown - vd2 = 0.5_r8 + 13.44_r8 / ((t_ref2m_max(p)-t_ref2m_min(p)+3._r8)**2) * tcrown - vd = max(0._r8, min(1._r8, vd1, vd2)) - cumvd(p) = cumvd(p) + vd - end if - - if (cumvd(p) < 10._r8 .and. t_ref2m_max(p) > tfrz+30._r8) then - cumvd(p) = cumvd(p) - 0.5_r8 * (t_ref2m_max(p) - tfrz - 30._r8) - end if - cumvd(p) = max(0._r8, cumvd(p)) ! must be > 0 - - vf(p) = 1._r8 - p1v * (50._r8 - cumvd(p)) - vf(p) = max(0._r8, min(vf(p), 1._r8)) ! must be between 0 - 1 - end if - - ! calculate cold hardening of plant - ! determines for winter cereal varieties whether the plant has completed - ! a period of cold hardening to protect it from freezing temperatures. If - ! not, then exposure could result in death or killing of plants. - - ! there are two distinct phases of hardening - - if (t_ref2m_min(p) <= tfrz-3._r8 .or. hdidx(p) /= 0._r8) then - if (hdidx(p) >= hti) then ! done with phase 1 - hdidx(p) = hdidx(p) + 0.083_r8 - hdidx(p) = min(hdidx(p), hti*2._r8) - end if - - if (t_ref2m_max(p) >= tbase + tfrz + 10._r8) then - hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - if (hdidx(p) > hti) hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - hdidx(p) = max(0._r8, hdidx(p)) - end if - - else if (tcrown >= tbase-1._r8) then - if (tcrown <= tbase+8._r8) then - hdidx(p) = hdidx(p) + 0.1_r8 - (tcrown-tbase+3.5_r8)**2 / 506._r8 - if (hdidx(p) >= hti .and. tcrown <= tbase + 0._r8) then - hdidx(p) = hdidx(p) + 0.083_r8 - hdidx(p) = min(hdidx(p), hti*2._r8) - end if - end if - - if (t_ref2m_max(p) >= tbase + tfrz + 10._r8) then - hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - if (hdidx(p) > hti) hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - hdidx(p) = max(0._r8, hdidx(p)) - end if - end if - - ! calculate what the cereal killing temperature - ! there is a linear inverse relationship between - ! hardening of the plant and the killing temperature or - ! threshold that the plant can withstand - ! when plant is fully-hardened (hdidx = 2), the killing threshold is -18 C - - ! will have to develop some type of relationship that reduces LAI and - ! biomass pools in response to cold damaged crop - - if (t_ref2m_min(p) <= tfrz - 6._r8) then - tkil = (tbase - 6._r8) - 6._r8 * hdidx(p) - if (tkil >= tcrown) then - if ((0.95_r8 - 0.02_r8 * (tcrown - tkil)**2) >= 0.02_r8) then - write (iulog,*) 'crop damaged by cold temperatures at p,c =', p,c - else if (tlai(p) > 0._r8) then ! slevis: kill if past phase1 - gddmaturity(p) = 0._r8 ! by forcing through - huigrain(p) = 0._r8 ! harvest - write (iulog,*) '95% of crop killed by cold temperatures at p,c =', p,c - end if - end if - end if - - end associate - - end subroutine vernalization - - !----------------------------------------------------------------------- - subroutine CNOnsetGrowth (num_soilp, filter_soilp, & - cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Determines the flux of stored C and N from transfer pools to display - ! pools during the phenological onset period. - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(in) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8):: t1 ! temporary variable - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Input: [real(r8) (:) ] onset flag - onset_counter => cnveg_state_inst%onset_counter_patch , & ! Input: [real(r8) (:) ] onset days counter - bgtr => cnveg_state_inst%bgtr_patch , & ! Input: [real(r8) (:) ] background transfer growth rate (1/s) - - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - - leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] - frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] - livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] - deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] - deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch & ! Output: [real(r8) (:) ] - ) - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes during onset period - if (onset_flag(p) == 1._r8) then - - ! The transfer rate is a linearly decreasing function of time, - ! going to zero on the last timestep of the onset period - - if (onset_counter(p) == dt) then - t1 = 1.0_r8 / dt - else - t1 = 2.0_r8 / (onset_counter(p)) - end if - leafc_xfer_to_leafc(p) = t1 * leafc_xfer(p) - frootc_xfer_to_frootc(p) = t1 * frootc_xfer(p) - leafn_xfer_to_leafn(p) = t1 * leafn_xfer(p) - frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) - deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) - livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) - deadcrootc_xfer_to_deadcrootc(p) = t1 * deadcrootc_xfer(p) - livestemn_xfer_to_livestemn(p) = t1 * livestemn_xfer(p) - deadstemn_xfer_to_deadstemn(p) = t1 * deadstemn_xfer(p) - livecrootn_xfer_to_livecrootn(p) = t1 * livecrootn_xfer(p) - deadcrootn_xfer_to_deadcrootn(p) = t1 * deadcrootn_xfer(p) - end if - - end if ! end if onset period - - ! calculate the background rate of transfer growth (used for stress - ! deciduous algorithm). In this case, all of the mass in the transfer - ! pools should be moved to displayed growth in each timestep. - - if (bgtr(p) > 0._r8) then - leafc_xfer_to_leafc(p) = leafc_xfer(p) / dt - frootc_xfer_to_frootc(p) = frootc_xfer(p) / dt - leafn_xfer_to_leafn(p) = leafn_xfer(p) / dt - frootn_xfer_to_frootn(p) = frootn_xfer(p) / dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = livestemc_xfer(p) / dt - deadstemc_xfer_to_deadstemc(p) = deadstemc_xfer(p) / dt - livecrootc_xfer_to_livecrootc(p) = livecrootc_xfer(p) / dt - deadcrootc_xfer_to_deadcrootc(p) = deadcrootc_xfer(p) / dt - livestemn_xfer_to_livestemn(p) = livestemn_xfer(p) / dt - deadstemn_xfer_to_deadstemn(p) = deadstemn_xfer(p) / dt - livecrootn_xfer_to_livecrootn(p) = livecrootn_xfer(p) / dt - deadcrootn_xfer_to_deadcrootn(p) = deadcrootn_xfer(p) / dt - end if - end if ! end if bgtr - - end do ! end patch loop - - end associate - - end subroutine CNOnsetGrowth - - !----------------------------------------------------------------------- - subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Determines the flux of C and N from displayed pools to litter - ! pools during the phenological offset period. - ! - ! !USES: - use pftconMod , only : npcropmin - ! Y. Cheng - use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass - - use CNSharedParamsMod, only : use_fun - use clm_varctl , only : CNratio_floating - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type), intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p, c ! indices - integer :: fp ! lake filter patch index - real(r8):: t1 ! temporary variable - real(r8):: denom ! temporary variable for divisor - real(r8) :: ntovr_leaf - real(r8) :: fr_leafn_to_litter ! fraction of the nitrogen turnover that goes to litter; remaining fraction is retranslocated - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - - ! Y. Cheng, add a new cut fraction for harvest parameter for bioenergy crops (miscanthus and switchgrass) - harvfrac => pftcon%harvfrac , & ! Input: cut fraction for harvest (-) - - lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - graincn => pftcon%graincn , & ! Input: grain C:N (gC/gN) - - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Input: [real(r8) (:) ] offset flag - offset_counter => cnveg_state_inst%offset_counter_patch , & ! Input: [real(r8) (:) ] offset days counter - - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - grainc => cnveg_carbonstate_inst%grainc_patch , & ! Input: [real(r8) (:) ] (gC/m2) grain C - cropseedc_deficit => cnveg_carbonstate_inst%cropseedc_deficit_patch , & ! Input: [real(r8) (:) ] (gC/m2) crop seed C deficit - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) livestem C - cropseedn_deficit => cnveg_nitrogenstate_inst%cropseedn_deficit_patch , & ! Input: [real(r8) (:) ] (gC/m2) crop seed N deficit - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) livestem N - - cpool_to_grainc => cnveg_carbonflux_inst%cpool_to_grainc_patch , & ! Input: [real(r8) (:) ] allocation to grain C (gC/m2/s) - npool_to_grainn => cnveg_nitrogenflux_inst%npool_to_grainn_patch , & ! Input: [real(r8) (:) ] allocation to grain N (gN/m2/s) - grainn => cnveg_nitrogenstate_inst%grainn_patch , & ! Input: [real(r8) (:) ] (kgN/m2) grain N - cpool_to_livestemc => cnveg_carbonflux_inst%cpool_to_livestemc_patch , & ! Input: [real(r8) (:) ] allocation to live stem C (gC/m2/s) - cpool_to_leafc => cnveg_carbonflux_inst%cpool_to_leafc_patch , & ! Input: [real(r8) (:) ] allocation to leaf C (gC/m2/s) - cpool_to_frootc => cnveg_carbonflux_inst%cpool_to_frootc_patch , & ! Input: [real(r8) (:) ] allocation to fine root C (gC/m2/s) - prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) - prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) - leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) (:) ] leaf C litterfall (gC/m2/s) - frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Output: [real(r8) (:) ] fine root C litterfall (gC/m2/s) - livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Output: [real(r8) (:) ] live stem C litterfall (gC/m2/s) - grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Output: [real(r8) (:) ] grain C to food (gC/m2/s) - - ! Y. Cheng, put the cut fraction during offset period for bioenergy crops to this biofuelc_harvest flux - biofuelc_harvest => cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Output: [real(r8) (:) ] biofuel C that was cutted at harvest (gC/m2/s) - - grainc_to_seed => cnveg_carbonflux_inst%grainc_to_seed_patch , & ! Output: [real(r8) (:) ] grain C to seed (gC/m2/s) - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - - livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Output: [real(r8) (:) ] livestem N to litter (gN/m2/s) - grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Output: [real(r8) (:) ] grain N to food (gN/m2/s) - biofueln_harvest => cnveg_nitrogenflux_inst%biofueln_harvest_patch , & ! Output: [real(r8) (:) ] biofuel N that was cutted (gC/m2/s) - grainn_to_seed => cnveg_nitrogenflux_inst%grainn_to_seed_patch , & ! Output: [real(r8) (:) ] grain N to seed (gN/m2/s) - leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Output: [real(r8) (:) ] leaf N litterfall (gN/m2/s) - leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Input: [real(r8) (:) ] leaf N to retranslocated N pool (gN/m2/s) - free_retransn_to_npool=> cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) - paid_retransn_to_npool=> cnveg_nitrogenflux_inst%retransn_to_npool_patch, & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) - frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Output: [real(r8) (:) ] fine root N litterfall (gN/m2/s) - leafc_to_litter_fun => cnveg_carbonflux_inst%leafc_to_litter_fun_patch , & ! Output: [real(r8) (:) ] leaf C litterfall used by FUN (gC/m2/s) - leafcn_offset => cnveg_state_inst%leafcn_offset_patch & ! Output: [real(r8) (:) ] Leaf C:N used by FUN - ) - - ! The litterfall transfer rate starts at 0.0 and increases linearly - ! over time, with displayed growth going to 0.0 on the last day of litterfall - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate fluxes during offset period - if (offset_flag(p) == 1._r8) then - - if (offset_counter(p) == dt) then - t1 = 1.0_r8 / dt - frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) - - ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of leafc for harvest - ! and move this cut fration to the biofuelc_harvest flux, rather than move it to litter - leafc_to_litter(p) = t1 * leafc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_leafc(p) - biofuelc_harvest(p) = t1 * leafc(p) * harvfrac(ivt(p)) - biofueln_harvest(p) = t1 * leafn(p) * harvfrac(ivt(p)) - - ! this assumes that offset_counter == dt for crops - ! if this were ever changed, we'd need to add code to the "else" - if (ivt(p) >= npcropmin) then - ! Replenish the seed deficits from grain, if there is enough - ! available grain. (If there is not enough available grain, the seed - ! deficits will accumulate until there is eventually enough grain to - ! replenish them.) - grainc_to_seed(p) = t1 * min(-cropseedc_deficit(p), grainc(p)) - grainn_to_seed(p) = t1 * min(-cropseedn_deficit(p), grainn(p)) - ! Send the remaining grain to the food product pool - grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) - grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) - - livestemc_to_litter(p) = t1 * livestemc(p) + cpool_to_livestemc(p) - end if - else - t1 = dt * 2.0_r8 / (offset_counter(p) * offset_counter(p)) - leafc_to_litter(p) = prev_leafc_to_litter(p) + t1*(leafc(p) - prev_leafc_to_litter(p)*offset_counter(p)) - frootc_to_litter(p) = prev_frootc_to_litter(p) + t1*(frootc(p) - prev_frootc_to_litter(p)*offset_counter(p)) - - end if - - if ( use_fun ) then - if(leafc_to_litter(p)*dt.gt.leafc(p))then - leafc_to_litter(p) = leafc(p)/dt + cpool_to_leafc(p) - endif - if(frootc_to_litter(p)*dt.gt.frootc(p))then - frootc_to_litter(p) = frootc(p)/dt + cpool_to_frootc(p) - endif - end if - - - if ( use_fun ) then - leafc_to_litter_fun(p) = leafc_to_litter(p) - leafn_to_retransn(p) = paid_retransn_to_npool(p) + free_retransn_to_npool(p) - if (leafn(p).gt.0._r8) then - if (leafn(p)-leafn_to_retransn(p)*dt.gt.0._r8) then - leafcn_offset(p) = leafc(p)/(leafn(p)-leafn_to_retransn(p)*dt) - else - leafcn_offset(p) = leafc(p)/leafn(p) - end if - else - leafcn_offset(p) = leafcn(ivt(p)) - end if - leafn_to_litter(p) = leafc_to_litter(p)/leafcn_offset(p) - leafn_to_retransn(p) - leafn_to_litter(p) = max(leafn_to_litter(p),0._r8) - - denom = ( leafn_to_retransn(p) + leafn_to_litter(p) ) - if ( denom /= 0.0_r8 ) then - fr_leafn_to_litter = leafn_to_litter(p) / ( leafn_to_retransn(p) + leafn_to_litter(p) ) - else if ( leafn_to_litter(p) == 0.0_r8 ) then - fr_leafn_to_litter = 0.0_r8 - else - fr_leafn_to_litter = 1.0_r8 - end if - - else - if (CNratio_floating .eqv. .true.) then - fr_leafn_to_litter = 0.5_r8 ! assuming 50% of nitrogen turnover goes to litter - end if - ! calculate the leaf N litterfall and retranslocation - leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p)) - leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p) - - end if - - ! calculate fine root N litterfall (no retranslocation of fine root N) - frootn_to_litter(p) = frootc_to_litter(p) / frootcn(ivt(p)) - - if (CNratio_floating .eqv. .true.) then - if (leafc(p) == 0.0_r8) then - ntovr_leaf = 0.0_r8 - else - ntovr_leaf = leafc_to_litter(p) * (leafn(p) / leafc(p)) - end if - - leafn_to_litter(p) = fr_leafn_to_litter * ntovr_leaf - leafn_to_retransn(p) = ntovr_leaf - leafn_to_litter(p) - if (frootc(p) == 0.0_r8) then - frootn_to_litter(p) = 0.0_r8 - else - frootn_to_litter(p) = frootc_to_litter(p) * (frootn(p) / frootc(p)) - end if - end if - - if ( use_fun ) then - if(frootn_to_litter(p)*dt.gt.frootn(p))then - frootn_to_litter(p) = frootn(p)/dt - endif - end if - - if (ivt(p) >= npcropmin) then - ! NOTE(slevis, 2014-12) results in -ve livestemn and -ve totpftn - !X! livestemn_to_litter(p) = livestemc_to_litter(p) / livewdcn(ivt(p)) - ! NOTE(slevis, 2014-12) Beth Drewniak suggested this instead - livestemn_to_litter(p) = livestemn(p) / dt - end if - - ! save the current litterfall fluxes - prev_leafc_to_litter(p) = leafc_to_litter(p) - prev_frootc_to_litter(p) = frootc_to_litter(p) - - end if ! end if offset period - - end do ! end patch loop - - end associate - - end subroutine CNOffsetLitterfall - - !----------------------------------------------------------------------- - subroutine CNBackgroundLitterfall (num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Determines the flux of C and N from displayed pools to litter - ! pools as the result of background litter fall. - ! - ! !USES: - use CNSharedParamsMod , only : use_fun - use clm_varctl , only : CNratio_floating - ! !ARGUMENTS: - implicit none - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type), intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8) :: fr_leafn_to_litter ! fraction of the nitrogen turnover that goes to litter; remaining fraction is retranslocated - real(r8) :: ntovr_leaf - real(r8) :: denom - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - - bglfr => cnveg_state_inst%bglfr_patch , & ! Input: [real(r8) (:) ] background litterfall rate (1/s) - - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - - leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) (:) ] - frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Output: [real(r8) (:) ] - - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Output: [real(r8) (:) ] - leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Output: [real(r8) (:) ] - frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Output: [real(r8) (:) ] - leafc_to_litter_fun => cnveg_carbonflux_inst%leafc_to_litter_fun_patch, & ! Output: [real(r8) (:) ] leaf C litterfall used by FUN (gC/m2/s) - leafcn_offset => cnveg_state_inst%leafcn_offset_patch , & ! Output: [real(r8) (:) ] Leaf C:N used by FUN - free_retransn_to_npool=> cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) - paid_retransn_to_npool=> cnveg_nitrogenflux_inst%retransn_to_npool_patch & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) - ) - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes if the background litterfall rate is non-zero - if (bglfr(p) > 0._r8) then - ! units for bglfr are already 1/s - leafc_to_litter(p) = bglfr(p) * leafc(p) - frootc_to_litter(p) = bglfr(p) * frootc(p) - if ( use_fun ) then - leafc_to_litter_fun(p) = leafc_to_litter(p) - leafn_to_retransn(p) = paid_retransn_to_npool(p) + free_retransn_to_npool(p) - if (leafn(p).gt.0._r8) then - if (leafn(p)-leafn_to_retransn(p)*dt.gt.0._r8) then - leafcn_offset(p) = leafc(p)/(leafn(p)-leafn_to_retransn(p)*dt) - else - leafcn_offset(p) = leafc(p)/leafn(p) - end if - else - leafcn_offset(p) = leafcn(ivt(p)) - end if - leafn_to_litter(p) = leafc_to_litter(p)/leafcn_offset(p) - leafn_to_retransn(p) - leafn_to_litter(p) = max(leafn_to_litter(p),0._r8) - - denom = ( leafn_to_retransn(p) + leafn_to_litter(p) ) - if ( denom /= 0.0_r8 ) then - fr_leafn_to_litter = leafn_to_litter(p) / ( leafn_to_retransn(p) + leafn_to_litter(p) ) - else if ( leafn_to_litter(p) == 0.0_r8 ) then - fr_leafn_to_litter = 0.0_r8 - else - fr_leafn_to_litter = 1.0_r8 - end if - - - else - if (CNratio_floating .eqv. .true.) then - fr_leafn_to_litter = 0.5_r8 ! assuming 50% of nitrogen turnover goes to litter - end if - ! calculate the leaf N litterfall and retranslocation - leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p)) - leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p) - - end if - - ! calculate fine root N litterfall (no retranslocation of fine root N) - frootn_to_litter(p) = frootc_to_litter(p) / frootcn(ivt(p)) - - if (CNratio_floating .eqv. .true.) then - if (leafc(p) == 0.0_r8) then - ntovr_leaf = 0.0_r8 - else - ntovr_leaf = leafc_to_litter(p) * (leafn(p) / leafc(p)) - end if - - leafn_to_litter(p) = fr_leafn_to_litter * ntovr_leaf - leafn_to_retransn(p) = ntovr_leaf - leafn_to_litter(p) - if (frootc(p) == 0.0_r8) then - frootn_to_litter(p) = 0.0_r8 - else - frootn_to_litter(p) = frootc_to_litter(p) * (frootn(p) / frootc(p)) - end if - end if - - if ( use_fun ) then - if(frootn_to_litter(p)*dt.gt.frootn(p))then - frootn_to_litter(p) = frootn(p)/dt - endif - end if - - end if - - end do - - end associate - - end subroutine CNBackgroundLitterfall - - !----------------------------------------------------------------------- - subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Determines the flux of C and N from live wood to - ! dead wood pools, for stem and coarse root. - ! - use CNSharedParamsMod, only: use_fun - use clm_varctl , only : CNratio_floating - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8):: ctovr ! temporary variable for carbon turnover - real(r8):: ntovr ! temporary variable for nitrogen turnover - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN) - deadwdcn => pftcon%deadwdcn , & ! Input: dead wood (xylem and heartwood) C:N (gC/gN) - - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C - - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N - - livestemc_to_deadstemc => cnveg_carbonflux_inst%livestemc_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - livecrootc_to_deadcrootc => cnveg_carbonflux_inst%livecrootc_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - - livestemn_to_deadstemn => cnveg_nitrogenflux_inst%livestemn_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - livestemn_to_retransn => cnveg_nitrogenflux_inst%livestemn_to_retransn_patch , & ! Output: [real(r8) (:) ] - livecrootn_to_deadcrootn => cnveg_nitrogenflux_inst%livecrootn_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] - livecrootn_to_retransn => cnveg_nitrogenflux_inst%livecrootn_to_retransn_patch & ! Output: [real(r8) (:) ] - ) - - - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes for woody types - if (woody(ivt(p)) > 0._r8) then - - ! live stem to dead stem turnover - - ctovr = livestemc(p) * lwtop - ntovr = ctovr / livewdcn(ivt(p)) - livestemc_to_deadstemc(p) = ctovr - livestemn_to_deadstemn(p) = ctovr / deadwdcn(ivt(p)) - - if (CNratio_floating .eqv. .true.) then - if (livestemc(p) == 0.0_r8) then - ntovr = 0.0_r8 - else - ntovr = ctovr * (livestemn(p) / livestemc(p)) - end if - - livestemn_to_deadstemn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn - end if - - livestemn_to_retransn(p) = ntovr - livestemn_to_deadstemn(p) - - ! live coarse root to dead coarse root turnover - - ctovr = livecrootc(p) * lwtop - ntovr = ctovr / livewdcn(ivt(p)) - livecrootc_to_deadcrootc(p) = ctovr - livecrootn_to_deadcrootn(p) = ctovr / deadwdcn(ivt(p)) - - if (CNratio_floating .eqv. .true.) then - if (livecrootc(p) == 0.0_r8) then - ntovr = 0.0_r8 - else - ntovr = ctovr * (livecrootn(p) / livecrootc(p)) - end if - - livecrootn_to_deadcrootn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn - end if - - livecrootn_to_retransn(p) = ntovr - livecrootn_to_deadcrootn(p) - if(use_fun)then - !TURNED OFF FLUXES TO CORRECT N ACCUMULATION ISSUE. RF. Oct 2015. - livecrootn_to_retransn(p) = 0.0_r8 - livestemn_to_retransn(p) = 0.0_r8 - endif - - end if - - end do - - end associate - - end subroutine CNLivewoodTurnover - - !----------------------------------------------------------------------- - subroutine CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! If using prognostic crop along with use_grainproduct, then move the patch-level - ! grain-to-food fluxes into the column-level grain-to-cropprod fluxes - ! - ! !USES: - use clm_varctl , only : use_crop - use clm_varctl , only : use_grainproduct - use subgridAveMod , only : p2c - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fp, p - - character(len=*), parameter :: subname = 'CNGrainToProductPools' - !----------------------------------------------------------------------- - - ! Explicitly checking use_crop is probably unnecessary here (because presumably - ! use_grainproduct is only true if use_crop is true), but we do it for safety because - ! the grain*_to_food_patch fluxes are not set if use_crop is false. - if (use_crop .and. use_grainproduct) then - do fp = 1, num_soilp - p = filter_soilp(fp) - cnveg_carbonflux_inst%grainc_to_cropprodc_patch(p) = & - cnveg_carbonflux_inst%grainc_to_food_patch(p) - cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(p) = & - cnveg_nitrogenflux_inst%grainn_to_food_patch(p) - end do - - call p2c (bounds, num_soilc, filter_soilc, & - cnveg_carbonflux_inst%grainc_to_cropprodc_patch(bounds%begp:bounds%endp), & - cnveg_carbonflux_inst%grainc_to_cropprodc_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_soilc, filter_soilc, & - cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(bounds%begp:bounds%endp), & - cnveg_nitrogenflux_inst%grainn_to_cropprodn_col(bounds%begc:bounds%endc)) - end if - - ! No else clause: if use_grainproduct is false, then the grain*_to_cropprod fluxes - ! will remain at their initial value (0). - - end subroutine CNGrainToProductPools - - !----------------------------------------------------------------------- - subroutine CNLitterToColumn (bounds, num_soilc, filter_soilc, & - cnveg_state_inst,cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch, froot_prof_patch) - ! - ! !DESCRIPTION: - ! called at the end of cn_phenology to gather all patch-level litterfall fluxes - ! to the column level and assign them to the three litter pools - ! - ! !USES: - use clm_varpar , only : max_patch_per_col, nlevdecomp - use pftconMod , only : npcropmin - use clm_varctl , only : use_grainproduct - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(cnveg_state_type) , intent(in) :: cnveg_state_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - ! - ! !LOCAL VARIABLES: - integer :: fc,c,pi,p,j ! indices - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL_FL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), sourcefile, __LINE__) - - associate( & - leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] weight (relative to column) for this patch (0-1) - - lf_flab => pftcon%lf_flab , & ! Input: leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: fine root litter cellulose fraction - fr_flig => pftcon%fr_flig , & ! Input: fine root litter lignin fraction - - leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Input: [real(r8) (:) ] leaf C litterfall (gC/m2/s) - frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) - livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] live stem C litterfall (gC/m2/s) - grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] grain C to food (gC/m2/s) - - biofuelc_harvest => cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Input: [real(r8) (:) ] biofuel C (gC/m2/s) - - phenology_c_to_litr_met_c => cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) - phenology_c_to_litr_cel_c => cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) - phenology_c_to_litr_lig_c => cnveg_carbonflux_inst%phenology_c_to_litr_lig_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter lignin pool (gC/m3/s) - - livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Input: [real(r8) (:) ] livestem N to litter (gN/m2/s) - grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Input: [real(r8) (:) ] grain N to food (gN/m2/s) - biofueln_harvest => cnveg_nitrogenflux_inst%biofueln_harvest_patch , & ! Input: [real(r8) (:) ] biofuel N (gN/m2/s) - leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Input: [real(r8) (:) ] leaf N litterfall (gN/m2/s) - frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) - phenology_n_to_litr_met_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_met_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gN/m3/s) - phenology_n_to_litr_cel_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_cel_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gN/m3/s) - phenology_n_to_litr_lig_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_lig_n_col & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter lignin pool (gN/m3/s) - ) - - do j = 1, nlevdecomp - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - - if ( pi <= col%npatches(c) ) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - - ! leaf litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! leaf litter nitrogen fluxes - phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! fine root litter nitrogen fluxes - phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! agroibis puts crop stem litter together with leaf litter - ! so I've used the leaf lf_f* parameters instead of making - ! new ones for now (slevis) - ! also for simplicity I've put "food" into the litter pools - - if (ivt(p) >= npcropmin) then ! add livestemc to litter - ! stem litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + livestemc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + livestemc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + livestemc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! stem litter nitrogen fluxes - phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + livestemn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + livestemn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + livestemn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - if (.not. use_grainproduct) then - ! grain litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel - - ! grain litter nitrogen fluxes - phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + grainn_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofueln_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel - phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + grainn_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofueln_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel - phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + grainn_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofueln_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel - end if - - - end if - end if - end if - - end do - - end do - end do - - end associate - - end subroutine CNLitterToColumn - -end module CNPhenologyMod From bcf43e4fdc3ed962d2b504845bc5c9dde7e24a58 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 24 Feb 2020 16:00:06 -0700 Subject: [PATCH 0625/1973] Fix / generalize lilac build to work on my mac --- cime_config/buildlib | 46 +++++++++++++++++++++------------ lilac/atm_driver/Makefile | 19 ++++++++++---- lilac/atm_driver/atm_driver.F90 | 5 ++-- lilac_config/buildnml | 3 ++- 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index 1cc10f0bc5..3b6be45163 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -30,26 +30,37 @@ def _get_osvar(key, default): return value ############################################################################### -def _write_ctsm_mk(exeroot, debug): +def _write_ctsm_mk(exeroot, libroot, machine): """Writes a ctsm.mk file in exeroot. This file can be included by atmosphere model builds outside of cime. - NOTE: This currently has some hard-coded settings for cheyenne. Also, it assumes that - ESMFMKFILE is set in your environment. + NOTE: This currently only supports the machines cheyenne (intel) and bishorn + (gnu). Also, it assumes that ESMFMKFILE is set in your environment. Arguments: exeroot (str): path to build directory - debug (logical): True if building in debug mode, False otherwise + libroot (str): path to directory containing libclm.a + machine (str): name of machine """ - if debug: - debug_path = 'debug' - else: - debug_path = 'nodebug' - ctsm_mk_path = os.path.join(exeroot, 'ctsm.mk') + ctsm_bld_dir = os.path.abspath(os.path.join(libroot, os.pardir)) + shared_bld_dir = os.path.abspath(os.path.join(ctsm_bld_dir, os.pardir, os.pardir)) esmfmkfile = os.environ['ESMFMKFILE'] + + # Set machine-specific libs for machines we currently support. Note there are a lot of + # hard-coded assumptions here, regarding the compiler, paths to libraries, etc. + # + # ESMF library doesn't need to be included here, because the necessary elements of the + # link line for that are included elsewhere. + if machine == 'cheyenne': + machine_specific_libs = '-mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib' + elif machine == 'bishorn': + machine_specific_libs = '-L/usr/local/lib -lnetcdff -lnetcdf -framework Accelerate' + else: + expect(False, "Unknown machine for LILAC's ctsm.mk file: {}".format(machine)) + with open(ctsm_mk_path, 'w') as ctsm_mk: ctsm_mk.write(""" # ====================================================================== @@ -68,14 +79,14 @@ def _write_ctsm_mk(exeroot, debug): include {esmfmkfile} -SHARED_BLD_DIR = {exeroot}/intel/mpt/{debug_path}/nothreads/nuopc -CTSM_BLD_DIR = $(SHARED_BLD_DIR)/nuopc/esmf +SHARED_BLD_DIR = {shared_bld_dir} +CTSM_BLD_DIR = {ctsm_bld_dir} DEPENDS_LIB = $(SHARED_BLD_DIR)/lib -SHR_LIB = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/lib -SHR_INC = $(SHARED_BLD_DIR)/nuopc/esmf/c1a1l1/csm_share +SHR_LIB = $(CTSM_BLD_DIR)/c1a1l1/lib +SHR_INC = $(CTSM_BLD_DIR)/c1a1l1/csm_share CTSM_INC = $(CTSM_BLD_DIR)/clm/obj -LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu -mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib +LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu {machine_specific_libs} # ====================================================================== # The following settings should be included in an atmosphere model's build. @@ -83,7 +94,8 @@ LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lp CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(SHR_INC) -I$(CTSM_INC) CTSM_LIBS = $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(LIBS) -""".format(esmfmkfile=esmfmkfile, exeroot=exeroot, debug_path=debug_path)) +""".format(esmfmkfile=esmfmkfile, shared_bld_dir=shared_bld_dir, ctsm_bld_dir=ctsm_bld_dir, + machine_specific_libs=machine_specific_libs)) ############################################################################### def _main_func(): @@ -102,8 +114,10 @@ def _main_func(): lilac_mode = _get_osvar('LILAC_MODE', 'off') if lilac_mode == 'on': driver = "lilac" + machine = case.get_value('MACH') _write_ctsm_mk(exeroot=case.get_value("EXEROOT"), - debug=case.get_value("DEBUG")) + libroot=libroot, + machine=machine) #------------------------------------------------------- # create Filepath file diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index e586643f81..8aaea82e93 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -3,12 +3,23 @@ #================================================================================ #================================================================================ -# Note: You must set the environment variable CTSM_MKFILE before running this - e.g. -# export CTSM_MKFILE=/glade/scratch/sacks/test_lilac_1205a/bld/ctsm.mk +# NOTE: Before running this, you must: +# +# (1) Run cime's configure tool in order to generate a Macros.make file +# +# (2) Source the .env_mach_specific.sh file created by the configure +# tool in order to set up the environment correctly. Among other +# things, this should set the environment variable ESMFMKFILE. (See +# notes below about the need for this.) +# +# (3) Set the environment variable CTSM_MKFILE - e.g. +# +# export CTSM_MKFILE=/glade/scratch/sacks/test_lilac_1205a/bld/ctsm.mk # -# ESMFMKFILE must also be set in the environment #================================================================================ +include Macros.make + include $(CTSM_MKFILE) # Most atmosphere model builds shouldn't need this directly, but we use @@ -17,8 +28,6 @@ include $(CTSM_MKFILE) # change later.) include $(ESMFMKFILE) -FFLAGS = -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -qopt-report -xCORE_AVX2 -no-fma -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -DLINUX -DFORTRANUNDERSCORE -DCPRINTEL -DDEBUG -DHAVE_MPI -DPIO1 -DHAVE_SLASHPROC -D_PNETCDF -DESMF_VERSION_MAJOR=7 -DESMF_VERSION_MINOR=1 -free - #================================================================================ # Compiler and linker rules using ESMF_ variables supplied by esmf.mk #================================================================================ diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index ca5594f6bc..e8be46079b 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -15,19 +15,18 @@ program atm_driver ! | | | ! ESMF lilac_atmcap ESMF CTSM cap ESMF river cap (Mizzouroute, Mosart) !---------------------------------------------------------------------------- - + use netcdf , only : nf90_open, nf90_create, nf90_enddef, nf90_close use netcdf , only : nf90_clobber, nf90_write, nf90_nowrite, nf90_noerr, nf90_double use netcdf , only : nf90_def_dim, nf90_def_var, nf90_put_var use netcdf , only : nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_varid, nf90_get_var - use mpi , only : MPI_COMM_WORLD, MPI_COMM_NULL, MPI_Init, MPI_FINALIZE, MPI_SUCCESS - use mpi , only : MPI_GATHER, MPI_INT, MPI_DOUBLE use lilac_mod , only : lilac_init, lilac_run, lilac_final use lilac_atmcap, only : lilac_atmcap_atm2lnd, lilac_atmcap_lnd2atm use shr_cal_mod , only : shr_cal_date2ymd use shr_sys_mod , only : shr_sys_abort implicit none +#include integer :: comp_comm integer :: ierr diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 5ce6010a3c..6ce420d417 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -125,7 +125,8 @@ def buildnml(rundir, bldnmldir): # remove any existing clm.input_data_list file inputdatalist_path = os.path.join(rundir, "clm.input_data_list") - os.remove(inputdatalist_path) + if os.path.exists(inputdatalist_path): + os.remove(inputdatalist_path) # call build-namelist cmd = os.path.abspath(os.path.join(bldnmldir, os.pardir, "bld", "build-namelist")) From 9408f35957c492ce4c6200ece1326c7305b0c0c2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 24 Feb 2020 16:04:09 -0700 Subject: [PATCH 0626/1973] Change a comment --- lilac/atm_driver/atm_driver.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index e8be46079b..d81e09c504 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -243,7 +243,7 @@ program atm_driver end if do nstep = 1,atm_nsteps - ! fill in the dataptr values in atm2lnd type in lilac_atmcap + ! fill in the dataptr in lilac_coupling_fields call atm_driver_to_lilac (atm_lons, atm_lats, nstep, atm_nsteps) if (nstep == atm_nsteps) then From b04af8c5b1d6291999e1955800611e9a6dc2dafb Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 24 Feb 2020 16:15:32 -0700 Subject: [PATCH 0627/1973] Update README for new build process --- README.lilac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.lilac b/README.lilac index edaf916403..c94debf68d 100644 --- a/README.lilac +++ b/README.lilac @@ -35,8 +35,10 @@ library (I), do the following: > export CTSM_MKFILE=$CASEDIR/bld/ctsm.mk > cd $SRCROOT/lilac/atm_driver + > $SRCROOT/cime/tools/configure --comp-interface nuopc --macros-format Makefile --clean > make clean - > source $CASEDIR/.env_mach_specific.sh + > source ./.env_mach_specific.sh + > export DEBUG=TRUE > make atm_driver 2) to generate the input namelists From 9de6805e3d2cf5620151c8aa3ecb9ac8f2cce538 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 25 Feb 2020 16:25:45 -0700 Subject: [PATCH 0628/1973] Remove duplicated QSNOEVAP that came from the release branch, but was already being handled in a more sophisticated way on master --- src/biogeophys/WaterFluxBulkType.F90 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/biogeophys/WaterFluxBulkType.F90 b/src/biogeophys/WaterFluxBulkType.F90 index 1b24275981..9936eec293 100644 --- a/src/biogeophys/WaterFluxBulkType.F90 +++ b/src/biogeophys/WaterFluxBulkType.F90 @@ -179,14 +179,6 @@ subroutine InitBulkHistory(this, bounds) ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, & l2g_scale_type='ice', default='inactive') - call hist_addfld1d ( & - fname=this%info%fname('QSNOEVAP'), & - units='mm/s', & - avgflag='A', & - long_name=this%info%lname('evaporation from snow'), & - ptr_patch=this%qflx_ev_snow_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - call hist_addfld2d ( & fname=this%info%fname('QROOTSINK'), & units='mm/s', type2d='levsoi', & From 73ea0276c93865d6ef732d7b269af29bc418d153 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 27 Feb 2020 16:25:41 -0700 Subject: [PATCH 0629/1973] Major overhaul of how LILAC fields are stored and interacted with Part of the point of this is to clean things up: use integer indices rather than strings, and use the dynamic vector infrastructure. Part of the point is to provide some new functionality, such as the atmosphere dictating which fields should be read from data. --- lilac/atm_driver/atm_driver.F90 | 104 ++-- lilac/src/ctsm_LilacAtm2LndFieldListType.F90 | 493 +++++++++++++++++++ lilac/src/ctsm_LilacCouplingFieldIndices.F90 | 83 ++++ lilac/src/ctsm_LilacCouplingFields.F90 | 295 +++++++++++ lilac/src/ctsm_LilacLnd2AtmFieldListType.F90 | 357 ++++++++++++++ lilac/src/lilac_atmcap.F90 | 250 +--------- lilac/src/lilac_constants.F90 | 2 + lilac/src/lilac_io.F90 | 3 +- lilac/src/lilac_mod.F90 | 57 ++- lilac/src/lilac_time.F90 | 6 +- src/cpl/lilac/lnd_comp_esmf.F90 | 10 +- 11 files changed, 1364 insertions(+), 296 deletions(-) create mode 100644 lilac/src/ctsm_LilacAtm2LndFieldListType.F90 create mode 100644 lilac/src/ctsm_LilacCouplingFieldIndices.F90 create mode 100644 lilac/src/ctsm_LilacCouplingFields.F90 create mode 100644 lilac/src/ctsm_LilacLnd2AtmFieldListType.F90 diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index d81e09c504..65ec080a88 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -20,8 +20,13 @@ program atm_driver use netcdf , only : nf90_clobber, nf90_write, nf90_nowrite, nf90_noerr, nf90_double use netcdf , only : nf90_def_dim, nf90_def_var, nf90_put_var use netcdf , only : nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_varid, nf90_get_var - use lilac_mod , only : lilac_init, lilac_run, lilac_final - use lilac_atmcap, only : lilac_atmcap_atm2lnd, lilac_atmcap_lnd2atm + use lilac_mod , only : lilac_init1, lilac_init2, lilac_run, lilac_final + use ctsm_LilacCouplingFieldIndices + use ctsm_LilacCouplingFields, only : lilac_atm2lnd, lilac_lnd2atm + ! A real atmosphere should not use l2a_fields directly. We use it here just for + ! convenience of writing every lnd -> atm field to a diagnostic output file. + use ctsm_LilacCouplingFields, only : l2a_fields + use shr_cal_mod , only : shr_cal_date2ymd use shr_sys_mod , only : shr_sys_abort @@ -172,10 +177,28 @@ program atm_driver if (masterproc ) then print *, " initializing lilac with start type ",trim(atm_starttype) end if - call lilac_init(comp_comm, atm_global_index, atm_lons, atm_lats, & - atm_global_nx, atm_global_ny, atm_calendar, atm_timestep, & - atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - atm_starttype) + call lilac_init1() + call lilac_init2( & + mpicom = comp_comm, & + atm_global_index = atm_global_index, & + atm_lons = atm_lons, & + atm_lats = atm_lats, & + atm_global_nx = atm_global_nx, & + atm_global_ny = atm_global_ny, & + atm_calendar = atm_calendar, & + atm_timestep = atm_timestep, & + atm_start_year = atm_start_year, & + atm_start_mon = atm_start_mon, & + atm_start_day = atm_start_day, & + atm_start_secs = atm_start_secs, & + starttype_in = atm_starttype, & + fields_needed_from_data = [ & + lilac_a2l_Faxa_bcphidry, lilac_a2l_Faxa_bcphodry, lilac_a2l_Faxa_bcphiwet, & + lilac_a2l_Faxa_ocphidry, lilac_a2l_Faxa_ocphodry, lilac_a2l_Faxa_ocphiwet, & + lilac_a2l_Faxa_dstwet1, lilac_a2l_Faxa_dstdry1, & + lilac_a2l_Faxa_dstwet2, lilac_a2l_Faxa_dstdry2, & + lilac_a2l_Faxa_dstwet3, lilac_a2l_Faxa_dstdry3, & + lilac_a2l_Faxa_dstwet4, lilac_a2l_Faxa_dstdry4]) !------------------------------------------------------------------------ ! Run lilac @@ -386,62 +409,62 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) ! variable doesn't actually impact the running of CTSM, but it is used for ! consistency checking. data(:) = 0.d0 - call lilac_atmcap_atm2lnd('Sa_landfrac', data) + call lilac_atm2lnd(lilac_a2l_Sa_landfrac, data) ! In the following, try to have each field have different values, in order to catch ! mis-matches (e.g., if foo and bar were accidentally swapped in CTSM, we couldn't ! catch that if they both had the same value). data(:) = 30.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Sa_z', data) + call lilac_atm2lnd(lilac_a2l_Sa_z, data) data(:) = 10.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Sa_topo', data) + call lilac_atm2lnd(lilac_a2l_Sa_topo, data) data(:) = 20.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Sa_u', data) + call lilac_atm2lnd(lilac_a2l_Sa_u, data) data(:) = 40.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Sa_v', data) + call lilac_atm2lnd(lilac_a2l_Sa_v, data) data(:) = 280.1d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Sa_ptem', data) + call lilac_atm2lnd(lilac_a2l_Sa_ptem, data) data(:) = 100100.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Sa_pbot', data) + call lilac_atm2lnd(lilac_a2l_Sa_pbot, data) data(:) = 280.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Sa_tbot', data) + call lilac_atm2lnd(lilac_a2l_Sa_tbot, data) data(:) = 0.0004d0 + space_time_perturbation(:)*1.0e-8 - call lilac_atmcap_atm2lnd('Sa_shum', data) + call lilac_atm2lnd(lilac_a2l_Sa_shum, data) data(:) = 200.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Faxa_lwdn', data) + call lilac_atm2lnd(lilac_a2l_Faxa_lwdn, data) data(:) = 1.0d-8 + space_time_perturbation(:)*1.0e-8 - call lilac_atmcap_atm2lnd('Faxa_rainc', data) + call lilac_atm2lnd(lilac_a2l_Faxa_rainc, data) data(:) = 2.0d-8 + space_time_perturbation(:)*1.0e-8 - call lilac_atmcap_atm2lnd('Faxa_rainl', data) + call lilac_atm2lnd(lilac_a2l_Faxa_rainl, data) data(:) = 1.0d-9 + space_time_perturbation(:)*1.0e-9 - call lilac_atmcap_atm2lnd('Faxa_snowc', data) + call lilac_atm2lnd(lilac_a2l_Faxa_snowc, data) data(:) = 2.0d-9 + space_time_perturbation(:)*1.0e-9 - call lilac_atmcap_atm2lnd('Faxa_snowl', data) + call lilac_atm2lnd(lilac_a2l_Faxa_snowl, data) data(:) = 100.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Faxa_swndr', data) + call lilac_atm2lnd(lilac_a2l_Faxa_swndr, data) data(:) = 50.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Faxa_swvdr', data) + call lilac_atm2lnd(lilac_a2l_Faxa_swvdr, data) data(:) = 25.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Faxa_swndf', data) + call lilac_atm2lnd(lilac_a2l_Faxa_swndf, data) data(:) = 45.0d0 + space_time_perturbation(:) - call lilac_atmcap_atm2lnd('Faxa_swvdf', data) + call lilac_atm2lnd(lilac_a2l_Faxa_swvdf, data) end subroutine atm_driver_to_lilac @@ -463,7 +486,7 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, & logical, intent(in) :: masterproc ! local variables - integer, parameter :: field_name_len = 64 + integer :: nfields integer :: ierr integer :: ncid integer :: dimid_x @@ -471,20 +494,23 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, & integer :: nglobal integer :: i integer, allocatable :: varids(:) - character(len=field_name_len) :: field_name + character(len=:), allocatable :: field_name integer, allocatable :: counts(:) integer, allocatable :: displacements(:) real*8, allocatable :: data(:) real*8, allocatable :: data_global(:) real*8, allocatable :: data_2d(:,:) - character(len=field_name_len), parameter :: fields(23) = [character(len=field_name_len) :: & - 'Sl_t', 'Sl_tref', 'Sl_qref', 'Sl_avsdr', 'Sl_anidr', 'Sl_avsdf', 'Sl_anidf', & - 'Sl_snowh', 'Sl_u10', 'Sl_fv', 'Sl_ram1', 'Sl_z0m', & - 'Fall_taux', 'Fall_tauy', 'Fall_lat', 'Fall_sen', 'Fall_lwup', 'Fall_evap', 'Fall_swnet', & - 'Fall_flxdst1', 'Fall_flxdst2', 'Fall_flxdst3', 'Fall_flxdst4'] ! -------------------------------------------- + ! Implementation note: for convenience and ease of maintenance, we directly leverage + ! l2a_fields in this subroutine, and loop through all available indices in that + ! list. A real atmosphere should not use that variable directly; instead, it should + ! use the indices defined in ctsm_LilacCouplingFieldIndices, similarly to what is done + ! above in atm_driver_to_lilac. + + nfields = l2a_fields%num_fields() + ! ------------------------------------------------------------------------ ! Set up output file ! ------------------------------------------------------------------------ @@ -500,9 +526,9 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, & ierr = nf90_def_dim(ncid, 'atm_ny', atm_global_ny, dimid_y) if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_def_dim ny atm driver output file') - allocate(varids(size(fields))) - do i = 1, size(fields) - field_name = fields(i) + allocate(varids(nfields)) + do i = 1, nfields + field_name = l2a_fields%get_fieldname(i) ierr = nf90_def_var(ncid, field_name, nf90_double, [dimid_x, dimid_y], varids(i)) if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_def_var atm driver output file: '//trim(field_name)) end do @@ -545,9 +571,13 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, & ! Retrieve data for each field, gather to master and write to file ! ------------------------------------------------------------------------ - do i = 1, size(fields) - field_name = fields(i) - call lilac_atmcap_lnd2atm(field_name, data) + do i = 1, nfields + field_name = l2a_fields%get_fieldname(i) + ! See implementation note above: typically a host atmosphere should NOT loop + ! through fields, accessing them anonymously by index as is done here. Instead, + ! typically the host atmosphere would access specific fields using the indices + ! defined in ctsm_LilacCouplingFieldIndices. + call lilac_lnd2atm(i, data) ! Because of the way we set up the decomposition, we can use a simple mpi_gatherv ! without needing to worry about any rearrangement, and points will appear in the diff --git a/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 b/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 new file mode 100644 index 0000000000..14ae5f22a4 --- /dev/null +++ b/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 @@ -0,0 +1,493 @@ +module ctsm_LilacAtm2LndFieldListType + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Defines a class and related methods for a list of lilac fields sent from atm -> lnd. + ! + ! (Note: this is very similar to LilacLnd2AtmFieldListType. However, between the fact + ! that (1) they have different sets of supported methods, and (2) the use of the + ! dynamic vector, it seemed to make more sense to have totally separate classes rather + ! than trying to share code between the two.) + ! + ! To set up this list (lilac_atm2lnd_field_list_type): + ! + ! - Initialize it by calling the 'init' method + ! + ! - Add variables with add_var + ! + ! - When done adding variables, call complete_setup + ! - Note that you cannot access or perform any operations on any of the fields until + ! this is done! + ! + ! - Set which fields are needed from data with set_needed_from_data + ! + ! To use this list (after complete_setup has been called), here is the workflow: + ! + ! - Query number of fields with num_fields + ! + ! - Set fields each time step with set_field + ! + ! - After fields are set, check that all required fields have been set by calling check_all_set + ! + ! - At the end of each time step, call reset_provided + ! + ! !USES: + + use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_log_mod , only : OOBMsg => shr_log_OOBMsg + use shr_sys_mod , only : shr_sys_abort + use lilac_constants, only : field_index_unset, logunit + + implicit none + private + + ! !PRIVATE TYPES: + + type, private :: lilac_atm2lnd_field_type + private + + ! Metadata set initially in initialization + character(len=:), allocatable :: fieldname + character(len=:), allocatable :: units + logical :: available_from_data ! whether this field can be obtained from data if not provided by the sending component + + ! Metadata set later in initialization + logical :: needed_from_data ! whether the host atmosphere wants LILAC to read this field from data + logical :: required_by_lnd ! whether this field is actually required by the land + + ! Data set each time step + real(r8), pointer :: dataptr(:) + logical :: provided_this_time ! whether this variable has been set this time step + end type lilac_atm2lnd_field_type + + ! Define a dynamic vector for lilac_atm2lnd_field_type +#define VECTOR_NAME lilac_atm2lnd_field_vector +#define TYPE_NAME type(lilac_atm2lnd_field_type) +#define THROW(string) call shr_sys_abort(string) +#include "dynamic_vector_typedef.inc" + + ! + ! !PUBLIC TYPES: + type, public :: lilac_atm2lnd_field_list_type + private + type(lilac_atm2lnd_field_vector) :: field_vec + type(lilac_atm2lnd_field_type), allocatable :: fields(:) + contains + ! Methods for setting up the list: + procedure, public :: init + procedure, public :: add_var + procedure, public :: complete_setup + + ! Methods to query or set data: + procedure, public :: num_fields ! return the number of fields + procedure, public :: set_needed_from_data ! dictate that the given fields need to be read from data + procedure, public :: is_needed_from_data ! query whether the given field is needed from data + procedure, public :: set_field ! set data for one field + procedure, public :: check_all_set ! check to ensure that all required fields have been set this time + procedure, public :: reset_provided ! reset the provided_this_time variable for all fields + procedure, public :: get_fieldname ! get the field name for a given field + procedure, public :: get_units ! get the units for a given field + procedure, public :: get_dataptr ! get a pointer to the data for a given field (this should be treated as read-only!) + + ! Private methods: + procedure, private :: check_field_index ! check whether a field index is valid + end type lilac_atm2lnd_field_list_type + + interface lilac_atm2lnd_field_type + module procedure new_lilac_atm2lnd_field_type + end interface lilac_atm2lnd_field_type + +contains + + ! Complete the dynamic vector definition. +#include "dynamic_vector_procdef.inc" + + !----------------------------------------------------------------------- + function new_lilac_atm2lnd_field_type(fieldname, units, available_from_data) result(this) + ! + ! !DESCRIPTION: + ! Initialize a new lilac_atm2lnd_field_type object + ! + ! !ARGUMENTS: + type(lilac_atm2lnd_field_type) :: this ! function result + character(len=*), intent(in) :: fieldname + character(len=*), intent(in) :: units + logical, intent(in) :: available_from_data ! whether this field can be obtained from data if not provided by the sending component + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'new_lilac_atm2lnd_field_type' + !----------------------------------------------------------------------- + + this%fieldname = fieldname + this%units = units + this%available_from_data = available_from_data + + ! Assume false until told otherwise + this%needed_from_data = .false. + + ! Assume true until told otherwise + this%required_by_lnd = .true. + + nullify(this%dataptr) + this%provided_this_time = .false. + + end function new_lilac_atm2lnd_field_type + + !----------------------------------------------------------------------- + subroutine init(this) + ! + ! !DESCRIPTION: + ! Initialize a new lilac_atm2lnd_field_list_type object + ! + ! !ARGUMENTS: + class(lilac_atm2lnd_field_list_type), intent(inout) :: this + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'init' + !----------------------------------------------------------------------- + + this%field_vec = lilac_atm2lnd_field_vector() + + end subroutine init + + !----------------------------------------------------------------------- + subroutine add_var(this, fieldname, units, available_from_data, field_index) + ! + ! !DESCRIPTION: + ! Add the given field to this list + ! + ! Also set field_index to be the index of this field in list. For the sake of error + ! checking, field_index should be initialized to field_index_unset before the call to + ! this subroutine. + ! + ! !ARGUMENTS: + class(lilac_atm2lnd_field_list_type), intent(inout) :: this + character(len=*), intent(in) :: fieldname + character(len=*), intent(in) :: units + logical, intent(in) :: available_from_data ! whether this field can be obtained from data if not provided by the sending component + integer, intent(inout) :: field_index + ! + ! !LOCAL VARIABLES: + type(lilac_atm2lnd_field_type) :: one_field + + character(len=*), parameter :: subname = 'add_var' + !----------------------------------------------------------------------- + + if (allocated(this%fields)) then + write(logunit,*) subname//' ERROR: this%fields is already allocated.' + write(logunit,*) 'fieldname = ', trim(fieldname) + write(logunit,*) 'This is likely a sign that you are trying to add a variable' + write(logunit,*) 'after complete_setup has already been called.' + call shr_sys_abort('Attempt to call '//subname//' after complete_setup was called') + end if + + if (field_index /= field_index_unset) then + write(logunit,*) subname//' ERROR: attempt to add var with a field index that has already been set.' + write(logunit,*) 'fieldname, field_index = ', trim(fieldname), field_index + call shr_sys_abort('Attempt to add var with a field index that has already been set') + end if + + one_field = lilac_atm2lnd_field_type( & + fieldname = trim(fieldname), & + units = trim(units), & + available_from_data = available_from_data) + + call this%field_vec%push_back(one_field) + + field_index = this%field_vec%vsize() + end subroutine add_var + + !----------------------------------------------------------------------- + subroutine complete_setup(this, data_size) + ! + ! !DESCRIPTION: + ! Finalize the creation of this field list; this includes allocating the data arrays for each field + ! + ! !ARGUMENTS: + class(lilac_atm2lnd_field_list_type), intent(inout) :: this + integer, intent(in) :: data_size ! number of points in each field (assumed to be the same for all fields) + ! + ! !LOCAL VARIABLES: + integer :: i + + character(len=*), parameter :: subname = 'complete_setup' + !----------------------------------------------------------------------- + + call this%field_vec%move_out(this%fields) + + do i = 1, this%num_fields() + allocate(this%fields(i)%dataptr(data_size)) + end do + + end subroutine complete_setup + + !----------------------------------------------------------------------- + function num_fields(this) + ! + ! !DESCRIPTION: + ! Return the number of fields + ! + ! !ARGUMENTS: + integer :: num_fields ! function result + class(lilac_atm2lnd_field_list_type), intent(in) :: this + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'num_fields' + !----------------------------------------------------------------------- + + if (.not. allocated(this%fields)) then + write(logunit,*) subname//' ERROR: this%fields has not yet been allocated' + write(logunit,*) 'This is likely a sign that you are trying to call num_fields' + write(logunit,*) 'before complete_setup has been called.' + call shr_sys_abort('Attempt to get number of fields before complete_setup was called') + end if + + num_fields = size(this%fields) + + end function num_fields + + !----------------------------------------------------------------------- + subroutine set_needed_from_data(this, fields_needed_from_data) + ! + ! !DESCRIPTION: + ! Dictate that the given fields need to be read from data + ! + ! !ARGUMENTS: + class(lilac_atm2lnd_field_list_type), intent(inout) :: this + integer, intent(in) :: fields_needed_from_data(:) ! vector of field indices that need to be read from data + ! + ! !LOCAL VARIABLES: + integer :: i + integer :: field_index + + character(len=*), parameter :: subname = 'set_needed_from_data' + !----------------------------------------------------------------------- + + do i = 1, size(fields_needed_from_data) + field_index = fields_needed_from_data(i) + call this%check_field_index(field_index, subname) + + if (this%fields(field_index)%needed_from_data) then + call shr_sys_abort(subname//' attempt to set needed_from_data on field for which it has already been set: '//& + this%fields(field_index)%fieldname) + end if + + if (.not. this%fields(field_index)%available_from_data) then + call shr_sys_abort(subname//' attempt to set needed_from_data on field not available from data: '//& + this%fields(field_index)%fieldname) + end if + + this%fields(field_index)%needed_from_data = .true. + end do + + end subroutine set_needed_from_data + + !----------------------------------------------------------------------- + function is_needed_from_data(this, field_index) + ! + ! !DESCRIPTION: + ! Query whether the given field is needed from data + ! + ! !ARGUMENTS: + logical :: is_needed_from_data ! function result + class(lilac_atm2lnd_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'is_needed_from_data' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + is_needed_from_data = this%fields(field_index)%needed_from_data + + end function is_needed_from_data + + !----------------------------------------------------------------------- + subroutine set_field(this, field_index, data) + ! + ! !DESCRIPTION: + ! Set data for the given field + ! + ! It is an error to try to set a field that has already been set this time + ! + ! !ARGUMENTS: + class(lilac_atm2lnd_field_list_type), intent(inout) :: this + integer, intent(in) :: field_index + real(r8), intent(in) :: data(:) + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'set_field' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + if (size(data) /= size(this%fields(field_index)%dataptr)) then + call shr_sys_abort(subname//' field size mismatch for '//trim(this%fields(field_index)%fieldname)) + end if + + if (this%fields(field_index)%provided_this_time) then + ! This can typically happen in one of two ways: + ! - A component tries to re-set a field that has already been set + ! - reset_provided hasn't been called in between times + call shr_sys_abort(subname//' attempt to set an already-set field: '//this%fields(field_index)%fieldname) + end if + + this%fields(field_index)%dataptr(:) = data(:) + this%fields(field_index)%provided_this_time = .true. + + end subroutine set_field + + !----------------------------------------------------------------------- + subroutine check_all_set(this) + ! + ! !DESCRIPTION: + ! Check to ensure that all required fields have been set this time + ! + ! !ARGUMENTS: + class(lilac_atm2lnd_field_list_type), intent(in) :: this + ! + ! !LOCAL VARIABLES: + integer :: i + + character(len=*), parameter :: subname = 'check_all_set' + !----------------------------------------------------------------------- + + do i = 1, this%num_fields() + if (this%fields(i)%required_by_lnd .and. .not. this%fields(i)%provided_this_time) then + call shr_sys_abort(trim(this%fields(i)%fieldname)//' required but not provided') + end if + end do + + end subroutine check_all_set + + !----------------------------------------------------------------------- + subroutine reset_provided(this) + ! + ! !DESCRIPTION: + ! Reset the provided_this_time variable for all fields + ! + ! !ARGUMENTS: + class(lilac_atm2lnd_field_list_type), intent(inout) :: this + ! + ! !LOCAL VARIABLES: + integer :: i + + character(len=*), parameter :: subname = 'reset_provided' + !----------------------------------------------------------------------- + + do i = 1, this%num_fields() + this%fields(i)%provided_this_time = .false. + end do + + end subroutine reset_provided + + !----------------------------------------------------------------------- + function get_fieldname(this, field_index) result(fieldname) + ! + ! !DESCRIPTION: + ! Get the field name for a given field + ! + ! (This will already be trimmed - no further trimming is needed.) + ! + ! !ARGUMENTS: + character(len=:), allocatable :: fieldname ! function result + class(lilac_atm2lnd_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'get_fieldname' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + fieldname = this%fields(field_index)%fieldname + + end function get_fieldname + + !----------------------------------------------------------------------- + function get_units(this, field_index) result(units) + ! + ! !DESCRIPTION: + ! Get the units for a given field + ! + ! (This will already be trimmed - no further trimming is needed.) + ! + ! !ARGUMENTS: + character(len=:), allocatable :: units ! function result + class(lilac_atm2lnd_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'get_units' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + units = this%fields(field_index)%units + + end function get_units + + !----------------------------------------------------------------------- + function get_dataptr(this, field_index) result(dataptr) + ! + ! !DESCRIPTION: + ! Get a pointer to the data for a given field + ! + ! This should be treated as read-only! Setting data should be done via the provided + ! methods in this class. + ! + ! !ARGUMENTS: + real(r8), pointer :: dataptr(:) ! function result + class(lilac_atm2lnd_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'get_dataptr' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + dataptr => this%fields(field_index)%dataptr + + end function get_dataptr + + !----------------------------------------------------------------------- + subroutine check_field_index(this, field_index, caller) + ! + ! !DESCRIPTION: + ! Check the provided field_index for validity. If not valid, aborts. + ! + ! !ARGUMENTS: + class(lilac_atm2lnd_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + character(len=*), intent(in) :: caller ! name of caller, for error messages + ! + ! !LOCAL VARIABLES: + integer :: nfields + + character(len=*), parameter :: subname = 'check_field_index' + !----------------------------------------------------------------------- + + if (field_index == field_index_unset) then + call shr_sys_abort(caller//':'//subname//' attempt to set field for unset field index') + end if + + if (field_index < 1 .or. field_index > this%num_fields()) then + write(logunit,*) caller//':'//subname//' ERROR: field_index out of bounds' + nfields = this%num_fields() + write(logunit,*) 'field_index, num_fields = ', field_index, nfields + call shr_sys_abort(caller//':'//subname//' field_index out of bounds') + end if + + end subroutine check_field_index + +end module ctsm_LilacAtm2LndFieldListType diff --git a/lilac/src/ctsm_LilacCouplingFieldIndices.F90 b/lilac/src/ctsm_LilacCouplingFieldIndices.F90 new file mode 100644 index 0000000000..c28a497a31 --- /dev/null +++ b/lilac/src/ctsm_LilacCouplingFieldIndices.F90 @@ -0,0 +1,83 @@ +module ctsm_LilacCouplingFieldIndices + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Defines all possible coupling field indices for coupling between atmosphere and land + ! + ! !USES: + use lilac_constants, only : field_index_unset + + implicit none + private + ! + ! !PUBLIC DATA: + + ! ------------------------------------------------------------------------ + ! These are the fields that can be passed from atm -> lnd. The host atmosphere model + ! will refer to these indices when setting fields. + ! ------------------------------------------------------------------------ + + integer, public :: lilac_a2l_Sa_landfrac = field_index_unset + integer, public :: lilac_a2l_Sa_z = field_index_unset + integer, public :: lilac_a2l_Sa_topo = field_index_unset + integer, public :: lilac_a2l_Sa_u = field_index_unset + integer, public :: lilac_a2l_Sa_v = field_index_unset + integer, public :: lilac_a2l_Sa_ptem = field_index_unset + integer, public :: lilac_a2l_Sa_pbot = field_index_unset + integer, public :: lilac_a2l_Sa_tbot = field_index_unset + integer, public :: lilac_a2l_Sa_shum = field_index_unset + integer, public :: lilac_a2l_Faxa_lwdn = field_index_unset + integer, public :: lilac_a2l_Faxa_rainc = field_index_unset + integer, public :: lilac_a2l_Faxa_rainl = field_index_unset + integer, public :: lilac_a2l_Faxa_snowc = field_index_unset + integer, public :: lilac_a2l_Faxa_snowl = field_index_unset + integer, public :: lilac_a2l_Faxa_swndr = field_index_unset + integer, public :: lilac_a2l_Faxa_swvdr = field_index_unset + integer, public :: lilac_a2l_Faxa_swndf = field_index_unset + integer, public :: lilac_a2l_Faxa_swvdf = field_index_unset + + integer, public :: lilac_a2l_Faxa_bcphidry = field_index_unset + integer, public :: lilac_a2l_Faxa_bcphodry = field_index_unset + integer, public :: lilac_a2l_Faxa_bcphiwet = field_index_unset + integer, public :: lilac_a2l_Faxa_ocphidry = field_index_unset + integer, public :: lilac_a2l_Faxa_ocphodry = field_index_unset + integer, public :: lilac_a2l_Faxa_ocphiwet = field_index_unset + integer, public :: lilac_a2l_Faxa_dstwet1 = field_index_unset + integer, public :: lilac_a2l_Faxa_dstdry1 = field_index_unset + integer, public :: lilac_a2l_Faxa_dstwet2 = field_index_unset + integer, public :: lilac_a2l_Faxa_dstdry2 = field_index_unset + integer, public :: lilac_a2l_Faxa_dstwet3 = field_index_unset + integer, public :: lilac_a2l_Faxa_dstdry3 = field_index_unset + integer, public :: lilac_a2l_Faxa_dstwet4 = field_index_unset + integer, public :: lilac_a2l_Faxa_dstdry4 = field_index_unset + + ! ------------------------------------------------------------------------ + ! These are the fields that can be passed from lnd -> atm. The host atmosphere model + ! will refer to these indices when retrieving fields. + ! ------------------------------------------------------------------------ + + integer, public :: lilac_l2a_Sl_t = field_index_unset + integer, public :: lilac_l2a_Sl_tref = field_index_unset + integer, public :: lilac_l2a_Sl_qref = field_index_unset + integer, public :: lilac_l2a_Sl_avsdr = field_index_unset + integer, public :: lilac_l2a_Sl_anidr = field_index_unset + integer, public :: lilac_l2a_Sl_avsdf = field_index_unset + integer, public :: lilac_l2a_Sl_anidf = field_index_unset + integer, public :: lilac_l2a_Sl_snowh = field_index_unset + integer, public :: lilac_l2a_Sl_u10 = field_index_unset + integer, public :: lilac_l2a_Sl_fv = field_index_unset + integer, public :: lilac_l2a_Sl_ram1 = field_index_unset + integer, public :: lilac_l2a_Sl_z0m = field_index_unset + integer, public :: lilac_l2a_Fall_taux = field_index_unset + integer, public :: lilac_l2a_Fall_tauy = field_index_unset + integer, public :: lilac_l2a_Fall_lat = field_index_unset + integer, public :: lilac_l2a_Fall_sen = field_index_unset + integer, public :: lilac_l2a_Fall_lwup = field_index_unset + integer, public :: lilac_l2a_Fall_evap = field_index_unset + integer, public :: lilac_l2a_Fall_swnet = field_index_unset + integer, public :: lilac_l2a_Fall_flxdst1 = field_index_unset + integer, public :: lilac_l2a_Fall_flxdst2 = field_index_unset + integer, public :: lilac_l2a_Fall_flxdst3 = field_index_unset + integer, public :: lilac_l2a_Fall_flxdst4 = field_index_unset + +end module ctsm_LilacCouplingFieldIndices diff --git a/lilac/src/ctsm_LilacCouplingFields.F90 b/lilac/src/ctsm_LilacCouplingFields.F90 new file mode 100644 index 0000000000..f93315f74d --- /dev/null +++ b/lilac/src/ctsm_LilacCouplingFields.F90 @@ -0,0 +1,295 @@ +module ctsm_LilacCouplingFields + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Defines the coupling fields between atmosphere and land + ! + ! !USES: + use shr_kind_mod, only : r8 => shr_kind_r8 + use ctsm_LilacCouplingFieldIndices + use ctsm_LilacLnd2AtmFieldListType, only : lilac_lnd2atm_field_list_type + use ctsm_LilacAtm2LndFieldListType, only : lilac_atm2lnd_field_list_type + + implicit none + private + + ! + ! !PUBLIC ROUTINES: + + ! ------------------------------------------------------------------------ + ! Routines that should be called by the host atmosphere to set / get coupling fields + ! ------------------------------------------------------------------------ + + public :: lilac_atm2lnd ! Set a single atm -> lnd field + public :: lilac_lnd2atm ! Get a single lnd -> atm field + + ! ------------------------------------------------------------------------ + ! Routines that should be used internally by LILAC, *not* called directly from the host + ! atmosphere + ! ------------------------------------------------------------------------ + + public :: create_a2l_field_list + public :: create_l2a_field_list + public :: complete_a2l_field_list + public :: complete_l2a_field_list + + ! + ! !PUBLIC DATA: + + ! ------------------------------------------------------------------------ + ! These variables should only be used internally by LILAC. The host atmosphere model + ! should interact with them via the lilac_atm2lnd and lilac_lnd2atm routines. + ! ------------------------------------------------------------------------ + + type(lilac_atm2lnd_field_list_type), public :: a2l_fields + type(lilac_lnd2atm_field_list_type), public :: l2a_fields + +contains + + !----------------------------------------------------------------------- + subroutine lilac_atm2lnd(field_index, data) + ! + ! !DESCRIPTION: + ! Set a single atm -> lnd field + ! + ! field_index should be one of the lilac_a2l_* indices defined in this module + ! + ! !ARGUMENTS: + integer, intent(in) :: field_index + real(r8), intent(in) :: data(:) + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'lilac_atm2lnd' + !----------------------------------------------------------------------- + + call a2l_fields%set_field(field_index, data) + + end subroutine lilac_atm2lnd + + !----------------------------------------------------------------------- + subroutine lilac_lnd2atm(field_index, data) + ! + ! !DESCRIPTION: + ! Get a single lnd -> atm field + ! + ! field_index should be one of the lilac_l2a_* indices defined in this module + ! + ! !ARGUMENTS: + integer, intent(in) :: field_index + real(r8), intent(out) :: data(:) + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'lilac_lnd2atm' + !----------------------------------------------------------------------- + + call l2a_fields%get_field(field_index, data) + + end subroutine lilac_lnd2atm + + !----------------------------------------------------------------------- + subroutine create_a2l_field_list() + ! + ! !DESCRIPTION: + ! Create the list of fields passed from atm -> lnd. + ! + ! All of the lilac_a2l_* indices are valid after this is called. However, note that + ! a2l_fields still isn't fully usable until complete_a2l_field_list is called. + ! + ! !ARGUMENTS: + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'create_a2l_field_list' + !----------------------------------------------------------------------- + + call a2l_fields%init() + + call a2l_fields%add_var(fieldname='Sa_landfrac' , units='fraction', available_from_data=.false., & + field_index=lilac_a2l_Sa_landfrac) + call a2l_fields%add_var(fieldname='Sa_z' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Sa_z) + call a2l_fields%add_var(fieldname='Sa_topo' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Sa_topo) + call a2l_fields%add_var(fieldname='Sa_u' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Sa_u) + call a2l_fields%add_var(fieldname='Sa_v' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Sa_v) + call a2l_fields%add_var(fieldname='Sa_ptem' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Sa_ptem) + call a2l_fields%add_var(fieldname='Sa_pbot' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Sa_pbot) + call a2l_fields%add_var(fieldname='Sa_tbot' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Sa_tbot) + call a2l_fields%add_var(fieldname='Sa_shum' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Sa_shum) + call a2l_fields%add_var(fieldname='Faxa_lwdn' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_lwdn) + call a2l_fields%add_var(fieldname='Faxa_rainc' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_rainc) + call a2l_fields%add_var(fieldname='Faxa_rainl' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_rainl) + call a2l_fields%add_var(fieldname='Faxa_snowc' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_snowc) + call a2l_fields%add_var(fieldname='Faxa_snowl' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_snowl) + call a2l_fields%add_var(fieldname='Faxa_swndr' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_swndr) + call a2l_fields%add_var(fieldname='Faxa_swvdr' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_swvdr) + call a2l_fields%add_var(fieldname='Faxa_swndf' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_swndf) + call a2l_fields%add_var(fieldname='Faxa_swvdf' , units='unknown', available_from_data=.false., & + field_index=lilac_a2l_Faxa_swvdf) + + call a2l_fields%add_var(fieldname='Faxa_bcphidry' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_bcphidry) + call a2l_fields%add_var(fieldname='Faxa_bcphodry' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_bcphodry) + call a2l_fields%add_var(fieldname='Faxa_bcphiwet' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_bcphiwet) + call a2l_fields%add_var(fieldname='Faxa_ocphidry' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_ocphidry) + call a2l_fields%add_var(fieldname='Faxa_ocphodry' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_ocphodry) + call a2l_fields%add_var(fieldname='Faxa_ocphiwet' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_ocphiwet) + call a2l_fields%add_var(fieldname='Faxa_dstwet1' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_dstwet1) + call a2l_fields%add_var(fieldname='Faxa_dstdry1' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_dstdry1) + call a2l_fields%add_var(fieldname='Faxa_dstwet2' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_dstwet2) + call a2l_fields%add_var(fieldname='Faxa_dstdry2' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_dstdry2) + call a2l_fields%add_var(fieldname='Faxa_dstwet3' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_dstwet3) + call a2l_fields%add_var(fieldname='Faxa_dstdry3' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_dstdry3) + call a2l_fields%add_var(fieldname='Faxa_dstwet4' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_dstwet4) + call a2l_fields%add_var(fieldname='Faxa_dstdry4' , units='unknown', available_from_data=.true., & + field_index=lilac_a2l_Faxa_dstdry4) + + end subroutine create_a2l_field_list + + !----------------------------------------------------------------------- + subroutine create_l2a_field_list() + ! + ! !DESCRIPTION: + ! Create the list of fields passed from lnd -> atm. + ! + ! All of the lilac_l2a_* indices are valid after this is called. However, note that + ! l2a_fields still isn't fully usable until complete_l2a_field_list is called. + ! + ! !ARGUMENTS: + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'create_l2a_field_list' + !----------------------------------------------------------------------- + + call l2a_fields%init() + + call l2a_fields%add_var(fieldname='Sl_t' , units='unknown', & + field_index=lilac_l2a_Sl_t) + call l2a_fields%add_var(fieldname='Sl_tref' , units='unknown', & + field_index=lilac_l2a_Sl_tref) + call l2a_fields%add_var(fieldname='Sl_qref' , units='unknown', & + field_index=lilac_l2a_Sl_qref) + call l2a_fields%add_var(fieldname='Sl_avsdr' , units='unknown', & + field_index=lilac_l2a_Sl_avsdr) + call l2a_fields%add_var(fieldname='Sl_anidr' , units='unknown', & + field_index=lilac_l2a_Sl_anidr) + call l2a_fields%add_var(fieldname='Sl_avsdf' , units='unknown', & + field_index=lilac_l2a_Sl_avsdf) + call l2a_fields%add_var(fieldname='Sl_anidf' , units='unknown', & + field_index=lilac_l2a_Sl_anidf) + call l2a_fields%add_var(fieldname='Sl_snowh' , units='unknown', & + field_index=lilac_l2a_Sl_snowh) + call l2a_fields%add_var(fieldname='Sl_u10' , units='unknown', & + field_index=lilac_l2a_Sl_u10) + call l2a_fields%add_var(fieldname='Sl_fv' , units='unknown', & + field_index=lilac_l2a_Sl_fv) + call l2a_fields%add_var(fieldname='Sl_ram1' , units='unknown', & + field_index=lilac_l2a_Sl_ram1) + call l2a_fields%add_var(fieldname='Sl_z0m' , units='m' , & + field_index=lilac_l2a_Sl_z0m) + call l2a_fields%add_var(fieldname='Fall_taux' , units='unknown', & + field_index=lilac_l2a_Fall_taux) + call l2a_fields%add_var(fieldname='Fall_tauy' , units='unknown', & + field_index=lilac_l2a_Fall_tauy) + call l2a_fields%add_var(fieldname='Fall_lat' , units='unknown', & + field_index=lilac_l2a_Fall_lat) + call l2a_fields%add_var(fieldname='Fall_sen' , units='unknown', & + field_index=lilac_l2a_Fall_sen) + call l2a_fields%add_var(fieldname='Fall_lwup' , units='unknown', & + field_index=lilac_l2a_Fall_lwup) + call l2a_fields%add_var(fieldname='Fall_evap' , units='unknown', & + field_index=lilac_l2a_Fall_evap) + call l2a_fields%add_var(fieldname='Fall_swnet' , units='unknown', & + field_index=lilac_l2a_Fall_swnet) + call l2a_fields%add_var(fieldname='Fall_flxdst1' , units='unknown', & + field_index=lilac_l2a_Fall_flxdst1) + call l2a_fields%add_var(fieldname='Fall_flxdst2' , units='unknown', & + field_index=lilac_l2a_Fall_flxdst2) + call l2a_fields%add_var(fieldname='Fall_flxdst3' , units='unknown', & + field_index=lilac_l2a_Fall_flxdst3) + call l2a_fields%add_var(fieldname='Fall_flxdst4' , units='unknown', & + field_index=lilac_l2a_Fall_flxdst4) + + end subroutine create_l2a_field_list + + !----------------------------------------------------------------------- + subroutine complete_a2l_field_list(lsize_atm, fields_needed_from_data) + ! + ! !DESCRIPTION: + ! Complete the setup of a2l_fields. + ! + ! This is separated from create_a2l_field_list because lsize may not be available at + ! the point when that routine is called. Also, note that this sets + ! fields_needed_from_data, which won't be available until later in initialization. + ! + ! !ARGUMENTS: + integer, intent(in) :: lsize_atm ! number of atm points on this proc + + ! List of field indices that need to be read from data, because the host atmosphere + ! isn't going to provide them. These should be indices given in + ! ctsm_LilacCouplingFields (lilac_a2l_Faxa_bcphidry). This can be an empty list if no + ! fields need to be read from data. + integer , intent(in) :: fields_needed_from_data(:) + + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'complete_a2l_field_list' + !----------------------------------------------------------------------- + + call a2l_fields%complete_setup(lsize_atm) + call a2l_fields%set_needed_from_data(fields_needed_from_data) + + end subroutine complete_a2l_field_list + + !----------------------------------------------------------------------- + subroutine complete_l2a_field_list(lsize_atm) + ! + ! !DESCRIPTION: + ! Complete the setup of l2a_fields. + ! + ! This is separated from create_l2a_field_list because lsize may not be available at + ! the point when that routine is called. + ! + ! !ARGUMENTS: + integer, intent(in) :: lsize_atm ! number of atm points on this proc + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'complete_l2a_field_list' + !----------------------------------------------------------------------- + + call l2a_fields%complete_setup(lsize_atm) + + end subroutine complete_l2a_field_list + +end module ctsm_LilacCouplingFields diff --git a/lilac/src/ctsm_LilacLnd2AtmFieldListType.F90 b/lilac/src/ctsm_LilacLnd2AtmFieldListType.F90 new file mode 100644 index 0000000000..dfc1ec9857 --- /dev/null +++ b/lilac/src/ctsm_LilacLnd2AtmFieldListType.F90 @@ -0,0 +1,357 @@ +module ctsm_LilacLnd2AtmFieldListType + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Defines a class and related methods for a list of lilac fields sent from lnd -> atm. + ! + ! (Note: this is very similar to LilacAtm2LndFieldListType. However, between the fact + ! that (1) they have different sets of supported methods, and (2) the use of the + ! dynamic vector, it seemed to make more sense to have totally separate classes rather + ! than trying to share code between the two.) + ! + ! To set up this list (lilac_lnd2atm_field_list_type): + ! + ! - Initialize it by calling the 'init' method + ! + ! - Add variables with add_var + ! + ! - When done adding variables, call complete_setup + ! - Note that you cannot access or perform any operations on any of the fields until + ! this is done! + ! + ! To use this list (after complete_setup has been called): + ! + ! - Query number of fields with num_fields + ! + ! - Extract data from a field with get_field + ! + ! !USES: + + use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_log_mod , only : OOBMsg => shr_log_OOBMsg + use shr_sys_mod , only : shr_sys_abort + use lilac_constants, only : field_index_unset, logunit + + implicit none + private + + ! !PRIVATE TYPES: + + type, private :: lilac_lnd2atm_field_type + private + + ! Metadata set initially in initialization + character(len=:), allocatable :: fieldname + character(len=:), allocatable :: units + + ! Metadata set later in initialization + logical :: required_by_atm ! whether this field is actually required by the atmosphere + + ! Data set each time step + real(r8), pointer :: dataptr(:) + end type lilac_lnd2atm_field_type + + ! Define a dynamic vector for lilac_lnd2atm_field_type +#define VECTOR_NAME lilac_lnd2atm_field_vector +#define TYPE_NAME type(lilac_lnd2atm_field_type) +#define THROW(string) call shr_sys_abort(string) +#include "dynamic_vector_typedef.inc" + + ! + ! !PUBLIC TYPES: + type, public :: lilac_lnd2atm_field_list_type + private + type(lilac_lnd2atm_field_vector) :: field_vec + type(lilac_lnd2atm_field_type), allocatable :: fields(:) + contains + ! Methods for setting up the list: + procedure, public :: init + procedure, public :: add_var + procedure, public :: complete_setup + + ! Methods to query or set data: + procedure, public :: num_fields ! return the number of fields + procedure, public :: get_field ! get data for one field + procedure, public :: get_fieldname ! get the field name for a given field + procedure, public :: get_units ! get the units for a given field + procedure, public :: get_dataptr ! get a pointer to the data for a given field + + ! Private methods: + procedure, private :: check_field_index ! check whether a field index is valid + end type lilac_lnd2atm_field_list_type + + interface lilac_lnd2atm_field_type + module procedure new_lilac_lnd2atm_field_type + end interface lilac_lnd2atm_field_type + +contains + + ! Complete the dynamic vector definition. +#include "dynamic_vector_procdef.inc" + + !----------------------------------------------------------------------- + function new_lilac_lnd2atm_field_type(fieldname, units) result(this) + ! + ! !DESCRIPTION: + ! Initialize a new lilac_lnd2atm_field_type object + ! + ! !ARGUMENTS: + type(lilac_lnd2atm_field_type) :: this ! function result + character(len=*), intent(in) :: fieldname + character(len=*), intent(in) :: units + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'new_lilac_lnd2atm_field_type' + !----------------------------------------------------------------------- + + this%fieldname = fieldname + this%units = units + + ! Assume true until told otherwise + this%required_by_atm = .true. + + nullify(this%dataptr) + + end function new_lilac_lnd2atm_field_type + + !----------------------------------------------------------------------- + subroutine init(this) + ! + ! !DESCRIPTION: + ! Initialize a new lilac_lnd2atm_field_list_type object + ! + ! !ARGUMENTS: + class(lilac_lnd2atm_field_list_type), intent(inout) :: this + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'init' + !----------------------------------------------------------------------- + + this%field_vec = lilac_lnd2atm_field_vector() + + end subroutine init + + !----------------------------------------------------------------------- + subroutine add_var(this, fieldname, units, field_index) + ! + ! !DESCRIPTION: + ! Add the given field to this list + ! + ! Also set field_index to be the index of this field in list. For the sake of error + ! checking, field_index should be initialized to field_index_unset before the call to + ! this subroutine. + ! + ! !ARGUMENTS: + class(lilac_lnd2atm_field_list_type), intent(inout) :: this + character(len=*), intent(in) :: fieldname + character(len=*), intent(in) :: units + integer, intent(inout) :: field_index + ! + ! !LOCAL VARIABLES: + type(lilac_lnd2atm_field_type) :: one_field + + character(len=*), parameter :: subname = 'add_var' + !----------------------------------------------------------------------- + + if (allocated(this%fields)) then + write(logunit,*) subname//' ERROR: this%fields is already allocated.' + write(logunit,*) 'fieldname = ', trim(fieldname) + write(logunit,*) 'This is likely a sign that you are trying to add a variable' + write(logunit,*) 'after complete_setup has already been called.' + call shr_sys_abort('Attempt to call '//subname//' after complete_setup was called') + end if + + if (field_index /= field_index_unset) then + write(logunit,*) subname//' ERROR: attempt to add var with a field index that has already been set.' + write(logunit,*) 'fieldname, field_index = ', trim(fieldname), field_index + call shr_sys_abort('Attempt to add var with a field index that has already been set') + end if + + one_field = lilac_lnd2atm_field_type( & + fieldname = trim(fieldname), & + units = trim(units)) + + call this%field_vec%push_back(one_field) + + field_index = this%field_vec%vsize() + end subroutine add_var + + !----------------------------------------------------------------------- + subroutine complete_setup(this, data_size) + ! + ! !DESCRIPTION: + ! Finalize the creation of this field list; this includes allocating the data arrays for each field + ! + ! !ARGUMENTS: + class(lilac_lnd2atm_field_list_type), intent(inout) :: this + integer, intent(in) :: data_size ! number of points in each field (assumed to be the same for all fields) + ! + ! !LOCAL VARIABLES: + integer :: i + + character(len=*), parameter :: subname = 'complete_setup' + !----------------------------------------------------------------------- + + call this%field_vec%move_out(this%fields) + + do i = 1, this%num_fields() + allocate(this%fields(i)%dataptr(data_size)) + end do + + end subroutine complete_setup + + !----------------------------------------------------------------------- + function num_fields(this) + ! + ! !DESCRIPTION: + ! Return the number of fields + ! + ! !ARGUMENTS: + integer :: num_fields ! function result + class(lilac_lnd2atm_field_list_type), intent(in) :: this + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'num_fields' + !----------------------------------------------------------------------- + + if (.not. allocated(this%fields)) then + write(logunit,*) subname//' ERROR: this%fields has not yet been allocated' + write(logunit,*) 'This is likely a sign that you are trying to call num_fields' + write(logunit,*) 'before complete_setup has been called.' + call shr_sys_abort('Attempt to get number of fields before complete_setup was called') + end if + + num_fields = size(this%fields) + + end function num_fields + + !----------------------------------------------------------------------- + subroutine get_field(this, field_index, data) + ! + ! !DESCRIPTION: + ! Get data for the given field + ! + ! !ARGUMENTS: + class(lilac_lnd2atm_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + real(r8), intent(out) :: data(:) + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'get_field' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + if (size(data) /= size(this%fields(field_index)%dataptr)) then + call shr_sys_abort(subname//' field size mismatch for '//trim(this%fields(field_index)%fieldname)) + end if + + data(:) = this%fields(field_index)%dataptr(:) + + end subroutine get_field + + !----------------------------------------------------------------------- + function get_fieldname(this, field_index) result(fieldname) + ! + ! !DESCRIPTION: + ! Get the field name for a given field + ! + ! (This will already be trimmed - no further trimming is needed.) + ! + ! !ARGUMENTS: + character(len=:), allocatable :: fieldname ! function result + class(lilac_lnd2atm_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'get_fieldname' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + fieldname = this%fields(field_index)%fieldname + + end function get_fieldname + + !----------------------------------------------------------------------- + function get_units(this, field_index) result(units) + ! + ! !DESCRIPTION: + ! Get the units for a given field + ! + ! (This will already be trimmed - no further trimming is needed.) + ! + ! !ARGUMENTS: + character(len=:), allocatable :: units ! function result + class(lilac_lnd2atm_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'get_units' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + units = this%fields(field_index)%units + + end function get_units + + !----------------------------------------------------------------------- + function get_dataptr(this, field_index) result(dataptr) + ! + ! !DESCRIPTION: + ! Get a pointer to the data for a given field + ! + ! !ARGUMENTS: + real(r8), pointer :: dataptr(:) ! function result + class(lilac_lnd2atm_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'get_dataptr' + !----------------------------------------------------------------------- + + call this%check_field_index(field_index, subname) + + dataptr => this%fields(field_index)%dataptr + + end function get_dataptr + + !----------------------------------------------------------------------- + subroutine check_field_index(this, field_index, caller) + ! + ! !DESCRIPTION: + ! Check the provided field_index for validity. If not valid, aborts. + ! + ! !ARGUMENTS: + class(lilac_lnd2atm_field_list_type), intent(in) :: this + integer, intent(in) :: field_index + character(len=*), intent(in) :: caller ! name of caller, for error messages + ! + ! !LOCAL VARIABLES: + integer :: nfields + + character(len=*), parameter :: subname = 'check_field_index' + !----------------------------------------------------------------------- + + if (field_index == field_index_unset) then + call shr_sys_abort(caller//':'//subname//' attempt to set field for unset field index') + end if + + if (field_index < 1 .or. field_index > this%num_fields()) then + write(logunit,*) caller//':'//subname//' ERROR: field_index out of bounds' + nfields = this%num_fields() + write(logunit,*) 'field_index, num_fields = ', field_index, nfields + call shr_sys_abort(caller//':'//subname//' field_index out of bounds') + end if + + end subroutine check_field_index + +end module ctsm_LilacLnd2AtmFieldListType diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index d03ba1e506..96b70e918c 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -18,16 +18,14 @@ module lilac_atmcap use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_cl, CS => shr_kind_cs use shr_sys_mod , only : shr_sys_abort use lilac_methods , only : chkerr + use lilac_constants, only : logunit + use ctsm_LilacCouplingFields, only : a2l_fields, l2a_fields implicit none public :: lilac_atmcap_init - public :: lilac_atmcap_atm2lnd - public :: lilac_atmcap_lnd2atm public :: lilac_atmcap_register - private :: lilac_atmcap_add_fld - ! Time invariant input from host atmosphere integer , public, allocatable :: gindex_atm(:) ! global index space real(r8), public, allocatable :: atm_lons(:) ! local longitudes @@ -38,16 +36,6 @@ module lilac_atmcap ! Time variant input from host atmosphere real(r8) :: nextsw_cday = 1.e36_r8 ! calendar day of the next sw calculation - type :: atmcap_type - character(len=CL) :: fldname - real(r8), pointer :: dataptr(:) - character(len=CS) :: units - logical :: provided_by_atm - logical :: required_fr_atm - end type atmcap_type - type(atmcap_type), pointer, public :: atm2lnd(:) - type(atmcap_type), pointer, public :: lnd2atm(:) - integer :: mytask integer , parameter :: debug = 0 ! internal debug level character(*), parameter :: u_FILE_u = & @@ -82,85 +70,6 @@ subroutine lilac_atmcap_init_vars(atm_gindex_in, atm_lons_in, atm_lats_in, atm_g atm_global_nx = atm_global_nx_in atm_global_ny = atm_global_ny_in - !------------------------------------------------------------------------- - ! Set module arrays atm2lnd and lnd2atm - !------------------------------------------------------------------------- - - ! TODO: how is the atm going to specify which fields are not provided = - ! should it pass an array of character strings or a colon deliminited set of fields - ! to specify the fields it will not provide - and then these are checked against those fields - - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_landfrac' , units='fraction', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_z' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_topo' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_u' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_v' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_ptem' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_pbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_tbot' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_shum' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_lwdn' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_rainc' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_rainl' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_snowc' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_snowl' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_swndr' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_swvdr' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_swndf' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_swvdf' , units='unknown', required_fr_atm=.true. , lsize=lsize) - - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_ocphidry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_ocphodry' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_ocphiwet' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet1' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry1' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet2' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry2' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet3' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry3' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstwet4' , units='unknown', required_fr_atm=.true. , lsize=lsize) - call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_dstdry4' , units='unknown', required_fr_atm=.true. , lsize=lsize) - ! call lilac_atmcap_add_fld (atm2lnd, fldname='Sa_methane' , units='unknown', required_fr_atm=.false. , lsize=lsize) - ! call lilac_atmcap_add_fld (atm2lnd, fldname='Faxa_bcph' , units='unknown', required_fr_atm=.false. , lsize=lsize) - - ! now add dataptr memory for all of the fields and set default values of provided_by_atm to false - do n = 1,size(atm2lnd) - allocate(atm2lnd(n)%dataptr(lsize)) - atm2lnd(n)%provided_by_atm = .false. - end do - - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_t' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_tref' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_qref' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_avsdr' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_anidr' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_avsdf' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_anidf' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_snowh' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_u10' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_fv' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_ram1' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Sl_z0m' , units='m' , lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_taux' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_tauy' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_lat' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_sen' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_lwup' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_evap' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_swnet' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_flxdst1' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_flxdst2' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_flxdst3' , units='unknown', lsize=lsize) - call lilac_atmcap_add_fld (lnd2atm , fldname='Fall_flxdst4' , units='unknown', lsize=lsize) - - ! now add dataptr memory for all of the fields - do n = 1,size(lnd2atm) - allocate(lnd2atm(n)%dataptr(lsize)) - end do - end subroutine lilac_atmcap_init_vars !======================================================================== @@ -292,12 +201,12 @@ subroutine lilac_atmcap_init (comp, lnd2atm_state, atm2lnd_state, clock, rc) mesh_lon = ownedElemCoords(2*n-1) mesh_lat = ownedElemCoords(2*n) if ( abs(mesh_lon - atm_lons(n)) > tolerance) then - write(6,101),n, atm_lons(n), mesh_lon + write(logunit,101),n, atm_lons(n), mesh_lon 101 format('ERROR: lilac_atmcap: n, lon, mesh_lon = ',i6,2(f20.10,2x)) call shr_sys_abort() end if if ( abs(mesh_lat - atm_lats(n)) > tolerance) then - write(6,102),n, atm_lats(n), mesh_lat + write(logunit,102),n, atm_lats(n), mesh_lat 102 format('ERROR: lilac_atmcap: n, lat, mesh_lat = ',i6,2(f20.10,2x)) call shr_sys_abort() end if @@ -313,9 +222,10 @@ subroutine lilac_atmcap_init (comp, lnd2atm_state, atm2lnd_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! create fields and add to field bundle - do n = 1, size(atm2lnd) + do n = 1, a2l_fields%num_fields() field = ESMF_FieldCreate(atm_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & - name=trim(atm2lnd(n)%fldname), farrayPtr=atm2lnd(n)%dataptr, rc=rc) + name=a2l_fields%get_fieldname(n), farrayPtr=a2l_fields%get_dataptr(n), & + rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldBundleAdd(a2c_fb, (/field/), rc=rc) @@ -349,9 +259,10 @@ subroutine lilac_atmcap_init (comp, lnd2atm_state, atm2lnd_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! create fields and add to field bundle - do n = 1, size(lnd2atm) + do n = 1, l2a_fields%num_fields() field = ESMF_FieldCreate(atm_mesh, meshloc=ESMF_MESHLOC_ELEMENT, & - name=trim(lnd2atm(n)%fldname), farrayPtr=lnd2atm(n)%dataptr, rc=rc) + name=l2a_fields%get_fieldname(n), farrayPtr=l2a_fields%get_dataptr(n), & + rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldBundleAdd(c2a_fb, (/field/), rc=rc) @@ -415,145 +326,4 @@ subroutine lilac_atmcap_final(comp, importState, exportState, clock, rc) end subroutine lilac_atmcap_final -!======================================================================== - subroutine lilac_atmcap_atm2lnd(fldname, data) - - ! input/output variables - character(len=*), intent(in) :: fldname - real(r8), intent(in) :: data(:) - - ! local variables - integer :: n - logical :: found - character(len=*), parameter :: subname='(lilac_atmcap_atm2lnd)' - ! -------------------------------------------- - - found = .false. - do n = 1,size(atm2lnd) - if (trim(fldname) == atm2lnd(n)%fldname) then - found = .true. - if (size(data) /= size(atm2lnd(n)%dataptr)) then - call shr_sys_abort(trim(subname) // 'size(data) not equal to size(atm2lnd(n)%dataptr') - else - atm2lnd(n)%dataptr(:) = data(:) - end if - atm2lnd(n)%provided_by_atm = .true. - exit - end if - end do - if (.not. found) then - call shr_sys_abort(trim(subname) // 'atm2lnd field name ' // trim(fldname) //' not found') - end if - - contains - - subroutine lilac_atm2lnd_check() - integer :: n ! if there are fields that the atmosphere does not provide but - ! that are required - then abort - do n = 1,size(atm2lnd) - if (atm2lnd(n)%required_fr_atm .and. (.not. atm2lnd(n)%provided_by_atm)) then - ! call abort or provide default values? - else if (.not. atm2lnd(n)%provided_by_atm) then - ! create default values - end if - end do - end subroutine lilac_atm2lnd_check - - end subroutine lilac_atmcap_atm2lnd - -!======================================================================== - subroutine lilac_atmcap_lnd2atm(fldname, data) - - ! input/output variables - character(len=*) , intent(in) :: fldname - real(r8) , intent(out) :: data(:) - - ! local variables - integer :: n - character(len=*), parameter :: subname='(lilac_atmcap_lnd2atm)' - ! -------------------------------------------- - - do n = 1,size(lnd2atm) - if (trim(fldname) == lnd2atm(n)%fldname) then - if (size(data) /= size(lnd2atm(n)%dataptr)) then - call shr_sys_abort(trim(subname) // 'size(data) not equal to size(lnd2atm(n)%dataptr') - else - data(:) = lnd2atm(n)%dataptr(:) - end if - end if - end do - end subroutine lilac_atmcap_lnd2atm - -!======================================================================== - subroutine lilac_atmcap_add_fld(flds, fldname, units, lsize, required_fr_atm) - - ! ---------------------------------------------- - ! Add an entry to to the flds array - ! Use pointers to create an extensible allocatable array. - ! to allow the size of flds to grow, the process for - ! adding a new field is: - ! 1) allocate newflds to be N (one element larger than flds) - ! 2) copy flds into first N-1 elements of newflds - ! 3) newest flds entry is Nth element of newflds - ! 4) deallocate / nullify flds - ! 5) point flds => newflds - ! ---------------------------------------------- - - type(atmcap_type), pointer :: flds(:) - character(len=*) , intent(in) :: fldname - character(len=*) , intent(in) :: units - integer , intent(in) :: lsize - logical, optional, intent(in) :: required_fr_atm - - ! local variables - integer :: n,oldsize,newsize - type(atmcap_type), pointer :: newflds(:) - character(len=*), parameter :: subname='(lilac_atmcap_atm2lnd_fld)' - ! ---------------------------------------------- - - if (associated(flds)) then - oldsize = size(flds) - else - oldsize = 0 - end if - newsize = oldsize + 1 - - if (oldsize > 0) then - ! 1) allocate newfld to be size (one element larger than input flds) - allocate(newflds(newsize)) - - ! 2) copy flds into first N-1 elements of newflds - do n = 1,oldsize - newflds(n)%fldname = flds(n)%fldname - newflds(n)%units = flds(n)%units - newflds(n)%required_fr_atm = flds(n)%required_fr_atm - end do - - ! 3) deallocate / nullify flds - if (oldsize > 0) then - deallocate(flds) - nullify(flds) - end if - - ! 4) point flds => new_flds - flds => newflds - - ! 5) update flds information for new entry - flds(newsize)%fldname = trim(fldname) - flds(newsize)%units = trim(units) - if (present(required_fr_atm)) then - flds(newsize)%required_fr_atm = required_fr_atm - end if - - else - allocate(flds(newsize)) - flds(newsize)%fldname = trim(fldname) - flds(newsize)%units = trim(units) - if (present(required_fr_atm)) then - flds(newsize)%required_fr_atm = required_fr_atm - end if - end if - - end subroutine lilac_atmcap_add_fld - end module lilac_atmcap diff --git a/lilac/src/lilac_constants.F90 b/lilac/src/lilac_constants.F90 index d564e14420..847fe2cc1d 100644 --- a/lilac/src/lilac_constants.F90 +++ b/lilac/src/lilac_constants.F90 @@ -12,5 +12,7 @@ module lilac_constants integer, parameter :: lilac_constants_ispval_mask = -987987 ! spval for RH mask values integer, parameter :: lilac_constants_SecPerDay = 86400 ! Seconds per day integer :: lilac_constants_dbug_flag = 0 + integer, parameter :: field_index_unset = -1 + integer :: logunit = 6 ! TODO: fix/generalize this end module lilac_constants diff --git a/lilac/src/lilac_io.F90 b/lilac/src/lilac_io.F90 index 431d785e06..159f6d6209 100644 --- a/lilac/src/lilac_io.F90 +++ b/lilac/src/lilac_io.F90 @@ -11,6 +11,7 @@ module lilac_io use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat use shr_sys_mod , only : shr_sys_abort use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag + use lilac_constants , only : logunit use lilac_methods , only : FB_getFieldN => lilac_methods_FB_getFieldN use lilac_methods , only : FB_getFldPtr => lilac_methods_FB_getFldPtr use lilac_methods , only : FB_getNameN => lilac_methods_FB_getNameN @@ -32,8 +33,6 @@ module lilac_io implicit none private - integer :: logunit = 6 ! TODO: fix this - ! public member functions: public :: lilac_io_wopen public :: lilac_io_close diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index d05746c89c..cfc7343329 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -15,7 +15,7 @@ module lilac_mod use shr_sys_mod , only : shr_sys_abort use shr_kind_mod , only : r8 => shr_kind_r8 - ! lilac routines + ! lilac routines and data use lilac_io , only : lilac_io_init use lilac_time , only : lilac_time_clockinit, lilac_time_alarminit use lilac_time , only : lilac_time_restart_write, lilac_time_restart_read @@ -24,6 +24,10 @@ module lilac_mod use lilac_history , only : lilac_history_init use lilac_history , only : lilac_history_write use lilac_methods , only : chkerr + use lilac_constants, only : logunit + use ctsm_LilacCouplingFields, only : create_a2l_field_list, create_l2a_field_list + use ctsm_LilacCouplingFields, only : complete_a2l_field_list, complete_l2a_field_list + use ctsm_LilacCouplingFields, only : a2l_fields ! lilac register phaes use lilac_atmcap , only : lilac_atmcap_register @@ -38,7 +42,8 @@ module lilac_mod implicit none - public :: lilac_init + public :: lilac_init1 + public :: lilac_init2 public :: lilac_run public :: lilac_final @@ -74,19 +79,32 @@ module lilac_mod character(*), parameter :: u_FILE_u = & __FILE__ - integer :: logunit = 6 ! TODO: generalize this - !======================================================================== contains !======================================================================== - subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & + subroutine lilac_init1() + + ! -------------------------------------------------------------------------------- + ! This is called by the host atmosphere. This is phase 1 of the lilac initialization. + ! + ! Indices defined in lilac_coupling_fields (lilac_a2l_* and lilac_l2a_*) are not + ! valid until this is called. + ! -------------------------------------------------------------------------------- + + call create_a2l_field_list() + call create_l2a_field_list() + + end subroutine lilac_init1 + + + subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & atm_global_nx, atm_global_ny, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - starttype_in) + starttype_in, fields_needed_from_data) ! -------------------------------------------------------------------------------- - ! This is called by the host atmosphere + ! This is called by the host atmosphere. This is phase 2 of the lilac initialization. ! -------------------------------------------------------------------------------- ! input/output variables @@ -104,6 +122,12 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & integer , intent(in) :: atm_start_secs character(len=*) , intent(in) :: starttype_in + ! List of field indices that need to be read from data, because the host atmosphere + ! isn't going to provide them. These should be indices given in + ! ctsm_LilacCouplingFields (lilac_a2l_Faxa_bcphidry). This can be an empty list if no + ! fields need to be read from data. + integer , intent(in) :: fields_needed_from_data(:) + ! local variables character(ESMF_MAXSTR) :: caseid type(ESMF_TimeInterval) :: timeStep @@ -141,6 +165,13 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & !------------------------------------------------------------------------- starttype = starttype_in + ! ------------------------------------------------------------------------ + ! Complete setup of field lists started in lilac_init1, now that we know the number + ! of atm points. + ! ------------------------------------------------------------------------ + call complete_a2l_field_list(size(atm_global_index), fields_needed_from_data) + call complete_l2a_field_list(size(atm_global_index)) + !------------------------------------------------------------------------- ! Initialize pio with first initialization ! AFTER call to MPI_init (which is in the host atm driver) and @@ -327,7 +358,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & call lilac_time_clockInit(caseid, starttype, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - logunit, lilac_clock, rc) + lilac_clock, rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing clock") call ESMF_LogWrite(subname//"lilac_clock initialized", ESMF_LOGMSG_INFO) @@ -447,7 +478,7 @@ subroutine lilac_init(mpicom, atm_global_index, atm_lons, atm_lats, & if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in initializing lilac_history_init") call ESMF_LogWrite(subname//"initialized lilac history output ...", ESMF_LOGMSG_INFO) - end subroutine lilac_init + end subroutine lilac_init2 !======================================================================== @@ -512,6 +543,11 @@ subroutine lilac_run(write_restarts_now, stop_now) call lilac_atmaero_interp(atm2cpl_state, lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac_atmaero_interp") + ! Make sure all atm2lnd fields have been set + ! FIXME(wjs, 2020-02-27) Uncomment this once data model functionality has been + ! properly hooked up + ! call a2l_fields%check_all_set() + ! Run cpl_atm2lnd call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) if (mytask == 0) write(logunit,*) "Running coupler component..... cpl_atm2lnd_comp" @@ -594,6 +630,9 @@ subroutine lilac_run(write_restarts_now, stop_now) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if + ! Reset atm2lnd provided flags for next time step + call a2l_fields%reset_provided() + ! Advance the lilac clock at the end of the time step call ESMF_ClockAdvance(lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in advancing time step") diff --git a/lilac/src/lilac_time.F90 b/lilac/src/lilac_time.F90 index 524270f283..31929e8a42 100644 --- a/lilac/src/lilac_time.F90 +++ b/lilac/src/lilac_time.F90 @@ -7,6 +7,7 @@ module lilac_time use lilac_io , only : lilac_io_write, lilac_io_wopen, lilac_io_enddef use lilac_io , only : lilac_io_close, lilac_io_date2yyyymmdd, lilac_io_sec2hms use lilac_methods , only : chkerr + use lilac_constants, only : logunit use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr use netcdf , only : nf90_inq_varid, nf90_get_var, nf90_close @@ -48,7 +49,7 @@ module lilac_time subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep, & atm_start_year, atm_start_mon, atm_start_day, atm_start_secs, & - logunit, lilac_clock, rc) + lilac_clock, rc) ! ------------------------------------------------- ! Initialize the lilac clock @@ -63,7 +64,6 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep integer , intent(in) :: atm_start_mon !(mm) integer , intent(in) :: atm_start_day integer , intent(in) :: atm_start_secs - integer , intent(in) :: logunit type(ESMF_Clock) , intent(inout) :: lilac_clock integer , intent(out) :: rc @@ -179,7 +179,7 @@ subroutine lilac_time_clockInit(caseid_in, starttype, atm_calendar, atm_timestep TimeStep_advance = currtime - clocktime call ESMF_TimeIntervalGet(timestep_advance, s=secs, rc=rc) - if (mytask == 0) write(6,*)'DEBUG: time step advance is ',secs + if (mytask == 0) write(logunit,*)'DEBUG: time step advance is ',secs ! Advance the clock to the current time (in case of a restart) call ESMF_ClockAdvance (lilac_clock, timestep=timestep_advance, rc=rc) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 676d4bf34c..f0591be358 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -11,7 +11,7 @@ module lnd_comp_esmf use perf_mod , only : t_startf, t_stopf, t_barrierf ! lilac code - use lilac_atmcap , only : atm2lnd, lnd2atm + use ctsm_LilacCouplingFields, only : a2l_fields, l2a_fields ! cime share code use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl @@ -407,9 +407,9 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! now add atm import fields on lnd_mesh to this field bundle - do n = 1, size(atm2lnd) + do n = 1, a2l_fields%num_fields() lfield = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT, & - name=trim(atm2lnd(n)%fldname), rc=rc) + name=a2l_fields%get_fieldname(n), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldBundleAdd(c2l_fb_atm, (/lfield/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -443,9 +443,9 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! now add atm export fields on lnd_mesh to this field bundle - do n = 1, size(lnd2atm) + do n = 1, l2a_fields%num_fields() lfield = ESMF_FieldCreate(lnd_mesh, ESMF_TYPEKIND_R8 , meshloc=ESMF_MESHLOC_ELEMENT, & - name=trim(lnd2atm(n)%fldname), rc=rc) + name=l2a_fields%get_fieldname(n), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldBundleAdd(l2c_fb_atm, (/lfield/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From e5ae987359958b79177e0bd97f9788776b8e1e12 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Feb 2020 09:58:41 -0700 Subject: [PATCH 0630/1973] For fields lilac reads from data, set via lilac_atm2lnd interface Rather than directly setting fields in the esmf field bundle, use the same interface that the host atmosphere would use to set these fields. This allows for error checking, ensuring that exactly one of the host atmosphere and the data atmosphere set a given field. --- lilac/src/ctsm_LilacAtm2LndFieldListType.F90 | 6 + lilac/src/lilac_atmaero.F90 | 128 ++++++++++--------- lilac/src/lilac_mod.F90 | 6 +- 3 files changed, 76 insertions(+), 64 deletions(-) diff --git a/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 b/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 index 14ae5f22a4..ce191f4e3c 100644 --- a/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 +++ b/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 @@ -335,6 +335,12 @@ subroutine set_field(this, field_index, data) ! This can typically happen in one of two ways: ! - A component tries to re-set a field that has already been set ! - reset_provided hasn't been called in between times + write(logunit,*) subname//' ERROR: attempt to set an already-set field: ', this%fields(field_index)%fieldname + if (this%fields(field_index)%needed_from_data) then + write(logunit,*) "This field was marked as being needed from data." + write(logunit,*) "A possible cause of this error is that it is being set by both" + write(logunit,*) "the host atmosphere and LILAC's internal data atmosphere." + end if call shr_sys_abort(subname//' attempt to set an already-set field: '//this%fields(field_index)%fieldname) end if diff --git a/lilac/src/lilac_atmaero.F90 b/lilac/src/lilac_atmaero.F90 index 4008c9b942..f9098f4a89 100644 --- a/lilac/src/lilac_atmaero.F90 +++ b/lilac/src/lilac_atmaero.F90 @@ -16,6 +16,7 @@ module lilac_atmaero use shr_mpi_mod , only : shr_mpi_bcast use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance + use shr_string_mod , only : shr_string_listAppend use shr_cal_mod , only : shr_cal_ymd2date use shr_pio_mod , only : shr_pio_getiotype use mct_mod , only : mct_avect_indexra, mct_gsmap, mct_ggrid @@ -31,16 +32,30 @@ module lilac_atmaero use lilac_atmcap , only : gindex_atm use lilac_methods , only : chkerr use lilac_methods , only : lilac_methods_FB_getFieldN + use lilac_constants , only : field_index_unset + use ctsm_LilacCouplingFields, only : a2l_fields, lilac_atm2lnd + use ctsm_LilacCouplingFieldIndices implicit none private + type, private :: field_mapping_type + character(len=:), allocatable :: field_name + integer :: field_index = field_index_unset + end type field_mapping_type + public :: lilac_atmaero_init ! initialize stream data type sdat public :: lilac_atmaero_interp ! interpolates between two years of ndep file data ! module data type(shr_strdata_type) :: sdat ! input data stream + ! The first num_fields_to_read in the fields_to_read list are the fields that this + ! module will read from data. This is set up to have the same ordering as the fields in + ! sdat. + integer :: num_fields_to_read + type(field_mapping_type), allocatable :: fields_to_read(:) + character(*),parameter :: u_file_u = & __FILE__ @@ -65,9 +80,11 @@ subroutine lilac_atmaero_init(atm2cpl_state, rc) type(ESMF_Field) :: lfield type(mct_ggrid) :: ggrid_atm ! domain information type(mct_gsmap) :: gsmap_atm ! decompositoin info + type(field_mapping_type), allocatable :: all_fields(:) ! all fields that can possibly be read from data integer :: mytask ! mpi task number integer :: mpicom ! mpi communicator - integer :: n,i,j ! index + integer :: n ! index + integer :: field_index integer :: lsize ! local size integer :: gsize ! global size integer :: nunit ! namelist input unit @@ -76,7 +93,7 @@ subroutine lilac_atmaero_init(atm2cpl_state, rc) character(len=CL) :: mapalgo = 'bilinear' ! type of 2d mapping character(len=CS) :: taxmode = 'extend' ! time extrapolation character(len=CL) :: fldlistFile ! name of fields in input stream file - character(len=CL) :: fldlistModel ! name of fields in data stream code + character(len=CL) :: fldlistModel ! name of fields in model integer :: stream_year_first ! first year in stream to use integer :: stream_year_last ! last year in stream to use integer :: model_year_align ! align stream_year_first with model year @@ -96,6 +113,40 @@ subroutine lilac_atmaero_init(atm2cpl_state, rc) rc = ESMF_SUCCESS + all_fields = [ & + field_mapping_type('BCDEPWET', lilac_a2l_Faxa_bcphiwet), & + field_mapping_type('BCPHODRY', lilac_a2l_Faxa_bcphodry), & + field_mapping_type('BCPHIDRY', lilac_a2l_Faxa_bcphidry), & + field_mapping_type('OCDEPWET', lilac_a2l_Faxa_ocphiwet), & + field_mapping_type('OCPHIDRY', lilac_a2l_Faxa_ocphidry), & + field_mapping_type('OCPHODRY', lilac_a2l_Faxa_ocphodry), & + field_mapping_type('DSTX01WD', lilac_a2l_Faxa_dstwet1), & + field_mapping_type('DSTX01DD', lilac_a2l_Faxa_dstdry1), & + field_mapping_type('DSTX02WD', lilac_a2l_Faxa_dstwet2), & + field_mapping_type('DSTX02DD', lilac_a2l_Faxa_dstdry2), & + field_mapping_type('DSTX03WD', lilac_a2l_Faxa_dstwet3), & + field_mapping_type('DSTX03DD', lilac_a2l_Faxa_dstdry3), & + field_mapping_type('DSTX04WD', lilac_a2l_Faxa_dstwet4), & + field_mapping_type('DSTX04DD', lilac_a2l_Faxa_dstdry4)] + + num_fields_to_read = 0 + allocate(fields_to_read(size(all_fields))) + fldlistFile = ' ' + fldlistModel = ' ' + do n = 1, size(all_fields) + field_index = all_fields(n)%field_index + if (a2l_fields%is_needed_from_data(field_index)) then + num_fields_to_read = num_fields_to_read + 1 + fields_to_read(num_fields_to_read) = all_fields(n) + call shr_string_listAppend(fldlistFile, fields_to_read(num_fields_to_read)%field_name) + call shr_string_listAppend(fldlistModel, a2l_fields%get_fieldname(field_index)) + end if + end do + + if (num_fields_to_read == 0) then + return + end if + ! default values for namelist stream_year_first = 1 ! first year in stream to use stream_year_last = 1 ! last year in stream to use @@ -137,19 +188,6 @@ subroutine lilac_atmaero_init(atm2cpl_state, rc) print *, ' ' endif - ! ------------------------------ - ! create the field list for these urbantv fields...use in shr_strdata_create - ! ------------------------------ - fldlistFile = 'BCDEPWET:BCPHODRY:BCPHIDRY:' - fldlistFile = trim(fldlistFile) // 'OCDEPWET:OCPHIDRY:OCPHODRY:DSTX01WD:' - fldlistFile = trim(fldlistFile) // 'DSTX01DD:DSTX02WD:DSTX02DD:DSTX03WD:' - fldlistFile = trim(fldlistFile) // 'DSTX03DD:DSTX04WD:DSTX04DD' - - fldlistModel = 'Faxa_bcphiwet:Faxa_bcphodry:Faxa_bcphidry:' - fldlistModel = trim(fldlistModel) // 'Faxa_ocphiwet:Faxa_ocphidry:Faxa_ocphodry:' - fldlistModel = trim(fldlistModel) // 'Faxa_dstwet1:Faxa_dstdry1:Faxa_dstwet2:Faxa_dstdry2:' - fldlistModel = trim(fldlistModel) // 'Faxa_dstwet3:Faxa_dstdry3:Faxa_dstwet4:Faxa_dstdry4' - ! ------------------------------ ! create the mct gsmap ! ------------------------------ @@ -245,10 +283,9 @@ end subroutine lilac_atmaero_init !================================================================ - subroutine lilac_atmaero_interp(atm2cpl_state, clock, rc) + subroutine lilac_atmaero_interp(clock, rc) ! input/output variables - type(ESMF_State) :: atm2cpl_state type(ESMF_Clock) :: clock integer, intent(out) :: rc @@ -259,11 +296,16 @@ subroutine lilac_atmaero_interp(atm2cpl_state, clock, rc) type(ESMF_FieldBundle) :: lfieldbundle type(ESMF_Time) :: currTime integer :: yy, mm, dd, sec, curr_ymd + integer :: n character(len=*), parameter :: subname='lilac_atmaero: [lilac_atmaero_interp]' !----------------------------------------------------------------------- rc = ESMF_SUCCESS + if (num_fields_to_read == 0) then + return + end if + ! get mytask and mpicom call ESMF_VMGetCurrent(vm, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return @@ -281,60 +323,26 @@ subroutine lilac_atmaero_interp(atm2cpl_state, clock, rc) ! advance the streams call shr_strdata_advance(sdat, curr_ymd, sec, mpicom, 'atmaero') - ! set field bundle data - call ESMF_StateGet(atm2cpl_state, "a2c_fb", lfieldbundle, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call set_fieldbundle_data('Faxa_bcphidry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_bcphodry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_bcphiwet' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_ocphidry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_ocphodry' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_ocphiwet' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstwet1' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstdry1' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstwet2' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstdry2' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstwet3' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstdry3' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstwet4' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return - call set_fieldbundle_data('Faxa_dstdry4' , lfieldbundle, rc) ; if (ChkErr(rc,__LINE__,u_FILE_u)) return + do n = 1, num_fields_to_read + call set_field(n) + end do end subroutine lilac_atmaero_interp !============================================================================== - subroutine set_fieldbundle_data(fldname, fieldbundle, rc) + subroutine set_field(fieldnum) ! input/output data - character(len=*) , intent(in) :: fldname - type(ESMF_FieldBundle) , intent(inout) :: fieldbundle - integer , intent(out) :: rc + integer, intent(in) :: fieldnum ! index into fields_to_read and sdat (which are assumed to have the same ordering) ! local data - type(ESMF_field) :: lfield - integer :: nfld, i - real(r8), pointer :: fldptr1d(:) + integer :: field_index ! index in a2l_fields !----------------------------------------------------------------------- - rc = ESMF_SUCCESS - - call ESMF_FieldBundleGet(fieldBundle, fieldName=trim(fldname), field=lfield, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! error check - if (size(fldptr1d) /= size(sdat%avs(1)%rAttr, dim=2)) then - call shr_sys_abort("ERROR: size of fldptr1d and sdat%avs(1)%rattr dim2 are not equal") - end if - - nfld = mct_avect_indexra(sdat%avs(1),trim(fldname)) - do i = 1, size(fldptr1d) - fldptr1d(i)= sdat%avs(1)%rAttr(nfld,i) - end do + field_index = fields_to_read(fieldnum)%field_index + call lilac_atm2lnd(field_index, sdat%avs(1)%rAttr(fieldnum,:)) - end subroutine set_fieldbundle_data + end subroutine set_field end module lilac_atmaero diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index cfc7343329..1900e1281b 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -540,13 +540,11 @@ subroutine lilac_run(write_restarts_now, stop_now) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac atm_cap") ! Update prescribed aerosols atm2cpl_a_state - call lilac_atmaero_interp(atm2cpl_state, lilac_clock, rc=rc) + call lilac_atmaero_interp(lilac_clock, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("lilac error in running lilac_atmaero_interp") ! Make sure all atm2lnd fields have been set - ! FIXME(wjs, 2020-02-27) Uncomment this once data model functionality has been - ! properly hooked up - ! call a2l_fields%check_all_set() + call a2l_fields%check_all_set() ! Run cpl_atm2lnd call ESMF_LogWrite(subname//"running cpl_atm2lnd_comp ", ESMF_LOGMSG_INFO) From 514195483e44a32a50fda47f661599a9742afaab Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Feb 2020 10:31:28 -0700 Subject: [PATCH 0631/1973] Provide bcphidry from the demo driver rather than from data This way we actually test the logic that avoids reading fields from data unless the host atmosphere asks for it. --- lilac/atm_driver/atm_driver.F90 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 65ec080a88..947a92319e 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -193,7 +193,9 @@ program atm_driver atm_start_secs = atm_start_secs, & starttype_in = atm_starttype, & fields_needed_from_data = [ & - lilac_a2l_Faxa_bcphidry, lilac_a2l_Faxa_bcphodry, lilac_a2l_Faxa_bcphiwet, & + ! Deliberately excluding bcphidry to test the logic that says that a field should + ! only be read from data if explicitly requested by the host atmosphere. + lilac_a2l_Faxa_bcphodry, lilac_a2l_Faxa_bcphiwet, & lilac_a2l_Faxa_ocphidry, lilac_a2l_Faxa_ocphodry, lilac_a2l_Faxa_ocphiwet, & lilac_a2l_Faxa_dstwet1, lilac_a2l_Faxa_dstdry1, & lilac_a2l_Faxa_dstwet2, lilac_a2l_Faxa_dstdry2, & @@ -466,6 +468,12 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) data(:) = 45.0d0 + space_time_perturbation(:) call lilac_atm2lnd(lilac_a2l_Faxa_swvdf, data) + ! This field has the potential to be read from data. We're setting it here to provide + ! a test of the logic that says that a field should only be read from data if + ! explicitly requested by the host atmosphere. + data(:) = 1.0d-13 + space_time_perturbation(:)*1.0e-14 + call lilac_atm2lnd(lilac_a2l_Faxa_bcphidry, data) + end subroutine atm_driver_to_lilac !======================================================================== From 498c355db1a9764a74317904a7ec08ff4cab1eae Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Feb 2020 10:38:26 -0700 Subject: [PATCH 0632/1973] Avoid writing garbage units to lilac history file This was not filled in correctly, so the units attribute was garbage. Eventually we should fix this properly. For now I'm commenting out these lines similarly to what's done in other, similar routines in this module. --- lilac/src/lilac_io.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/src/lilac_io.F90 b/lilac/src/lilac_io.F90 index 159f6d6209..276fc23cc6 100644 --- a/lilac/src/lilac_io.F90 +++ b/lilac/src/lilac_io.F90 @@ -591,7 +591,7 @@ subroutine lilac_io_write_FB(filename, iam, FB, whead, wdata, nx, ny, nt, & rcode = pio_put_att(io_file(lfile_ind),varid,"_FillValue",lfillvalue) end if if (chkerr(rc,__LINE__,u_FILE_u)) return - rcode = pio_put_att(io_file(lfile_ind), varid, "units" , trim(cunit)) + ! rcode = pio_put_att(io_file(lfile_ind), varid, "units" , trim(cunit)) rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", trim(name1)) if (present(tavg)) then if (tavg) then @@ -611,7 +611,7 @@ subroutine lilac_io_write_FB(filename, iam, FB, whead, wdata, nx, ny, nt, & rcode = pio_put_att(io_file(lfile_ind), varid, "_FillValue", lfillvalue) end if if (chkerr(rc,__LINE__,u_FILE_u)) return - rcode = pio_put_att(io_file(lfile_ind), varid, "units", trim(cunit)) + ! rcode = pio_put_att(io_file(lfile_ind), varid, "units", trim(cunit)) rcode = pio_put_att(io_file(lfile_ind), varid, "standard_name", trim(name1)) if (present(tavg)) then if (tavg) then From 8cb9f3c028b48a95f5ce45ef090fa90451511b23 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Feb 2020 10:45:30 -0700 Subject: [PATCH 0633/1973] In lilac's demo driver, ensure rain & snow are always positive --- lilac/atm_driver/atm_driver.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 947a92319e..15d29f8568 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -438,22 +438,22 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) data(:) = 280.0d0 + space_time_perturbation(:) call lilac_atm2lnd(lilac_a2l_Sa_tbot, data) - data(:) = 0.0004d0 + space_time_perturbation(:)*1.0e-8 + data(:) = 0.0004d0 + space_time_perturbation(:)*1.0d-8 call lilac_atm2lnd(lilac_a2l_Sa_shum, data) data(:) = 200.0d0 + space_time_perturbation(:) call lilac_atm2lnd(lilac_a2l_Faxa_lwdn, data) - data(:) = 1.0d-8 + space_time_perturbation(:)*1.0e-8 + data(:) = 1.0d-8 + space_time_perturbation(:)*1.0d-9 call lilac_atm2lnd(lilac_a2l_Faxa_rainc, data) - data(:) = 2.0d-8 + space_time_perturbation(:)*1.0e-8 + data(:) = 2.0d-8 + space_time_perturbation(:)*1.0d-9 call lilac_atm2lnd(lilac_a2l_Faxa_rainl, data) - data(:) = 1.0d-9 + space_time_perturbation(:)*1.0e-9 + data(:) = 1.0d-9 + space_time_perturbation(:)*1.0d-10 call lilac_atm2lnd(lilac_a2l_Faxa_snowc, data) - data(:) = 2.0d-9 + space_time_perturbation(:)*1.0e-9 + data(:) = 2.0d-9 + space_time_perturbation(:)*1.0d-10 call lilac_atm2lnd(lilac_a2l_Faxa_snowl, data) data(:) = 100.0d0 + space_time_perturbation(:) @@ -471,7 +471,7 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) ! This field has the potential to be read from data. We're setting it here to provide ! a test of the logic that says that a field should only be read from data if ! explicitly requested by the host atmosphere. - data(:) = 1.0d-13 + space_time_perturbation(:)*1.0e-14 + data(:) = 1.0d-13 + space_time_perturbation(:)*1.0d-14 call lilac_atm2lnd(lilac_a2l_Faxa_bcphidry, data) end subroutine atm_driver_to_lilac From 845c162b5bce8f8de52ddf1e9926eefc9ff9e78a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Feb 2020 12:54:55 -0700 Subject: [PATCH 0634/1973] Delete documentation that is no longer correct This was also out of place after the recent rework --- lilac/src/lilac_atmcap.F90 | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index 96b70e918c..f4b041f3d7 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -2,16 +2,6 @@ module lilac_atmcap !----------------------------------------------------------------------- ! This is an ESMF lilac cap for the host atmosphere - ! - ! THE HOST ATMOSPHERE IS RESPONSIBLE for calling lilac_init() and in turn - ! lilac_init() calls the initialization routines for atm2lnd and lnd2atm - ! - ! the host atm init call will be - ! call lilac_init() - ! the host atm run phase will be - ! call lilac_atm2lnd(fldname, data1d) - ! call lilac_run(write_restarts_now, stop_now) - ! call lilac_lnd2atm(fldname, data1d) !----------------------------------------------------------------------- use ESMF From 36154c5b5853ed75bf6e08f4b8244e53e39e0c06 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Feb 2020 13:22:23 -0700 Subject: [PATCH 0635/1973] Make atm_lons and atm_lats private These didn't need to be public --- lilac/src/lilac_atmcap.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index f4b041f3d7..c34859df49 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -18,8 +18,8 @@ module lilac_atmcap ! Time invariant input from host atmosphere integer , public, allocatable :: gindex_atm(:) ! global index space - real(r8), public, allocatable :: atm_lons(:) ! local longitudes - real(r8), public, allocatable :: atm_lats(:) ! local latitudes + real(r8), private, allocatable :: atm_lons(:) ! local longitudes + real(r8), private, allocatable :: atm_lats(:) ! local latitudes integer , public :: atm_global_nx integer , public :: atm_global_ny From c9a7cb9bb074b20f5f9e6f204245d2076cb3afb3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 09:32:09 -0600 Subject: [PATCH 0636/1973] Fix some comments --- lilac/src/ctsm_LilacCouplingFields.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/src/ctsm_LilacCouplingFields.F90 b/lilac/src/ctsm_LilacCouplingFields.F90 index f93315f74d..7587522b4f 100644 --- a/lilac/src/ctsm_LilacCouplingFields.F90 +++ b/lilac/src/ctsm_LilacCouplingFields.F90 @@ -52,7 +52,7 @@ subroutine lilac_atm2lnd(field_index, data) ! !DESCRIPTION: ! Set a single atm -> lnd field ! - ! field_index should be one of the lilac_a2l_* indices defined in this module + ! field_index should be one of the lilac_a2l_* indices defined in ctsm_LilacCouplingFieldIndices ! ! !ARGUMENTS: integer, intent(in) :: field_index @@ -73,7 +73,7 @@ subroutine lilac_lnd2atm(field_index, data) ! !DESCRIPTION: ! Get a single lnd -> atm field ! - ! field_index should be one of the lilac_l2a_* indices defined in this module + ! field_index should be one of the lilac_l2a_* indices defined in ctsm_LilacCouplingFieldIndices ! ! !ARGUMENTS: integer, intent(in) :: field_index From 47b6cf127e4475d04aa15c6cd09566e734f33d10 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 10:33:43 -0600 Subject: [PATCH 0637/1973] Update cmeps version I started getting errors in preview_namelists with the old version: Traceback (most recent call last): File "/Users/sacks/ctsm/ctsm2/cime/src/drivers/nuopc/cime_config/buildnml", line 509, in _main_func() File "/Users/sacks/ctsm/ctsm2/cime/src/drivers/nuopc/cime_config/buildnml", line 506, in _main_func buildnml(case, caseroot, "drv") File "/Users/sacks/ctsm/ctsm2/cime/src/drivers/nuopc/cime_config/buildnml", line 474, in buildnml _create_drv_namelists(case, infile, confdir, nmlgen, files) File "/Users/sacks/ctsm/ctsm2/cime/src/drivers/nuopc/cime_config/buildnml", line 241, in _create_drv_namelists _create_runseq(case, coupling_times) File "/Users/sacks/ctsm/ctsm2/cime/src/drivers/nuopc/cime_config/buildnml", line 332, in _create_runseq from runseq_I import runseq File "/Users/sacks/ctsm/ctsm2/cime/src/drivers/nuopc/cime_config/../../../../src/drivers/nuopc/cime_config/runseq/runseq_I.py", line 70 print "cism_evolve = ",cism_evolve ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("cism_evolve = ",cism_evolve)? ERROR: /Users/sacks/ctsm/ctsm2/cime/src/drivers/nuopc/cime_config/buildnml /Users/sacks/projects/scratch/test_lilac_0309b FAILED, see above The immediate error was a lack of parentheses in the print function (needed with python3), but the weirder error is that this is in a code block that should only be executed if using cism (not stub glc), but this was in a compset using stub glc. I'm not sure why this started now, but updating to the latest cmeps version seems to fix the issue, so I'm doing that. --- Externals_cime.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index cbede7df52..2ff29da9f9 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,5 +1,5 @@ [cmeps] -hash = 181ff1ed9dfb279e619e8a2173f43baf7bf1dce3 +hash = 36e352b2735a8e3478bde4129ff58214521c7409 protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ From 1989b0572197ec7f274e89bbff3262bb52ea1a82 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 11:42:45 -0600 Subject: [PATCH 0638/1973] Add capability for time-constant fields landfrac, and possibly some other fields, will typically just be provided in the first time step, and don't need to be re-set every time step. Allow that, and change the demo atm driver to exercise this logic for landfrac. --- lilac/atm_driver/atm_driver.F90 | 9 ++- lilac/src/ctsm_LilacAtm2LndFieldListType.F90 | 25 ++++++-- lilac/src/ctsm_LilacCouplingFields.F90 | 64 ++++++++++---------- 3 files changed, 59 insertions(+), 39 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 15d29f8568..578fc1d32b 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -403,6 +403,9 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) time_perturbation = 0.5d0 * (nstep - time_midpoint)/time_midpoint space_time_perturbation(:) = time_perturbation + lat(:)*0.01d0 + lon(:)*0.01d0 + ! Only set landfrac in the first time step, similar to what most real atmospheres + ! will probably do. + ! ! We don't have a good way to set a land mask / fraction in this demo driver. Since it ! is okay for the atmosphere to call a point ocean when CTSM calls it land, but not ! the reverse, here we call all points ocean. In a real atmosphere, the atmosphere @@ -410,8 +413,10 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) ! that CTSM is running over all of the necessary points. Note that this landfrac ! variable doesn't actually impact the running of CTSM, but it is used for ! consistency checking. - data(:) = 0.d0 - call lilac_atm2lnd(lilac_a2l_Sa_landfrac, data) + if (nstep == 1) then + data(:) = 0.d0 + call lilac_atm2lnd(lilac_a2l_Sa_landfrac, data) + end if ! In the following, try to have each field have different values, in order to catch ! mis-matches (e.g., if foo and bar were accidentally swapped in CTSM, we couldn't diff --git a/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 b/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 index ce191f4e3c..b18c376f98 100644 --- a/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 +++ b/lilac/src/ctsm_LilacAtm2LndFieldListType.F90 @@ -50,6 +50,7 @@ module ctsm_LilacAtm2LndFieldListType character(len=:), allocatable :: fieldname character(len=:), allocatable :: units logical :: available_from_data ! whether this field can be obtained from data if not provided by the sending component + logical :: can_be_time_const ! if true, it's okay for this field to be set just once, in the first time step, keeping its same value for the entire run (e.g., a landfrac field that doesn't vary in time) ! Metadata set later in initialization logical :: needed_from_data ! whether the host atmosphere wants LILAC to read this field from data @@ -58,6 +59,7 @@ module ctsm_LilacAtm2LndFieldListType ! Data set each time step real(r8), pointer :: dataptr(:) logical :: provided_this_time ! whether this variable has been set this time step + logical :: provided_ever ! whether this variable has ever been set end type lilac_atm2lnd_field_type ! Define a dynamic vector for lilac_atm2lnd_field_type @@ -103,7 +105,7 @@ module ctsm_LilacAtm2LndFieldListType #include "dynamic_vector_procdef.inc" !----------------------------------------------------------------------- - function new_lilac_atm2lnd_field_type(fieldname, units, available_from_data) result(this) + function new_lilac_atm2lnd_field_type(fieldname, units, available_from_data, can_be_time_const) result(this) ! ! !DESCRIPTION: ! Initialize a new lilac_atm2lnd_field_type object @@ -113,6 +115,7 @@ function new_lilac_atm2lnd_field_type(fieldname, units, available_from_data) res character(len=*), intent(in) :: fieldname character(len=*), intent(in) :: units logical, intent(in) :: available_from_data ! whether this field can be obtained from data if not provided by the sending component + logical, intent(in) :: can_be_time_const ! if true, it's okay for this field to be set just once, in the first time step, keeping its same value for the entire run (e.g., a landfrac field that doesn't vary in time) ! ! !LOCAL VARIABLES: @@ -122,6 +125,7 @@ function new_lilac_atm2lnd_field_type(fieldname, units, available_from_data) res this%fieldname = fieldname this%units = units this%available_from_data = available_from_data + this%can_be_time_const = can_be_time_const ! Assume false until told otherwise this%needed_from_data = .false. @@ -131,6 +135,7 @@ function new_lilac_atm2lnd_field_type(fieldname, units, available_from_data) res nullify(this%dataptr) this%provided_this_time = .false. + this%provided_ever = .false. end function new_lilac_atm2lnd_field_type @@ -153,7 +158,7 @@ subroutine init(this) end subroutine init !----------------------------------------------------------------------- - subroutine add_var(this, fieldname, units, available_from_data, field_index) + subroutine add_var(this, fieldname, units, available_from_data, can_be_time_const, field_index) ! ! !DESCRIPTION: ! Add the given field to this list @@ -167,6 +172,7 @@ subroutine add_var(this, fieldname, units, available_from_data, field_index) character(len=*), intent(in) :: fieldname character(len=*), intent(in) :: units logical, intent(in) :: available_from_data ! whether this field can be obtained from data if not provided by the sending component + logical, intent(in) :: can_be_time_const ! if true, it's okay for this field to be set just once, in the first time step, keeping its same value for the entire run (e.g., a landfrac field that doesn't vary in time) integer, intent(inout) :: field_index ! ! !LOCAL VARIABLES: @@ -192,7 +198,8 @@ subroutine add_var(this, fieldname, units, available_from_data, field_index) one_field = lilac_atm2lnd_field_type( & fieldname = trim(fieldname), & units = trim(units), & - available_from_data = available_from_data) + available_from_data = available_from_data, & + can_be_time_const = can_be_time_const) call this%field_vec%push_back(one_field) @@ -346,6 +353,7 @@ subroutine set_field(this, field_index, data) this%fields(field_index)%dataptr(:) = data(:) this%fields(field_index)%provided_this_time = .true. + this%fields(field_index)%provided_ever = .true. end subroutine set_field @@ -365,8 +373,15 @@ subroutine check_all_set(this) !----------------------------------------------------------------------- do i = 1, this%num_fields() - if (this%fields(i)%required_by_lnd .and. .not. this%fields(i)%provided_this_time) then - call shr_sys_abort(trim(this%fields(i)%fieldname)//' required but not provided') + if (this%fields(i)%required_by_lnd) then + if (.not. this%fields(i)%provided_ever) then + call shr_sys_abort(trim(this%fields(i)%fieldname)//' required but never provided') + end if + if (.not. this%fields(i)%can_be_time_const) then + if (.not. this%fields(i)%provided_this_time) then + call shr_sys_abort(trim(this%fields(i)%fieldname)//' required but not provided this time') + end if + end if end if end do diff --git a/lilac/src/ctsm_LilacCouplingFields.F90 b/lilac/src/ctsm_LilacCouplingFields.F90 index 7587522b4f..29e1f7ae57 100644 --- a/lilac/src/ctsm_LilacCouplingFields.F90 +++ b/lilac/src/ctsm_LilacCouplingFields.F90 @@ -107,70 +107,70 @@ subroutine create_a2l_field_list() call a2l_fields%init() call a2l_fields%add_var(fieldname='Sa_landfrac' , units='fraction', available_from_data=.false., & - field_index=lilac_a2l_Sa_landfrac) + can_be_time_const=.true., field_index=lilac_a2l_Sa_landfrac) call a2l_fields%add_var(fieldname='Sa_z' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Sa_z) + can_be_time_const=.true., field_index=lilac_a2l_Sa_z) call a2l_fields%add_var(fieldname='Sa_topo' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Sa_topo) + can_be_time_const=.true., field_index=lilac_a2l_Sa_topo) call a2l_fields%add_var(fieldname='Sa_u' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Sa_u) + can_be_time_const=.false., field_index=lilac_a2l_Sa_u) call a2l_fields%add_var(fieldname='Sa_v' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Sa_v) + can_be_time_const=.false., field_index=lilac_a2l_Sa_v) call a2l_fields%add_var(fieldname='Sa_ptem' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Sa_ptem) + can_be_time_const=.false., field_index=lilac_a2l_Sa_ptem) call a2l_fields%add_var(fieldname='Sa_pbot' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Sa_pbot) + can_be_time_const=.false., field_index=lilac_a2l_Sa_pbot) call a2l_fields%add_var(fieldname='Sa_tbot' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Sa_tbot) + can_be_time_const=.false., field_index=lilac_a2l_Sa_tbot) call a2l_fields%add_var(fieldname='Sa_shum' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Sa_shum) + can_be_time_const=.false., field_index=lilac_a2l_Sa_shum) call a2l_fields%add_var(fieldname='Faxa_lwdn' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_lwdn) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_lwdn) call a2l_fields%add_var(fieldname='Faxa_rainc' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_rainc) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_rainc) call a2l_fields%add_var(fieldname='Faxa_rainl' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_rainl) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_rainl) call a2l_fields%add_var(fieldname='Faxa_snowc' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_snowc) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_snowc) call a2l_fields%add_var(fieldname='Faxa_snowl' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_snowl) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_snowl) call a2l_fields%add_var(fieldname='Faxa_swndr' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_swndr) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_swndr) call a2l_fields%add_var(fieldname='Faxa_swvdr' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_swvdr) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_swvdr) call a2l_fields%add_var(fieldname='Faxa_swndf' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_swndf) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_swndf) call a2l_fields%add_var(fieldname='Faxa_swvdf' , units='unknown', available_from_data=.false., & - field_index=lilac_a2l_Faxa_swvdf) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_swvdf) call a2l_fields%add_var(fieldname='Faxa_bcphidry' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_bcphidry) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_bcphidry) call a2l_fields%add_var(fieldname='Faxa_bcphodry' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_bcphodry) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_bcphodry) call a2l_fields%add_var(fieldname='Faxa_bcphiwet' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_bcphiwet) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_bcphiwet) call a2l_fields%add_var(fieldname='Faxa_ocphidry' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_ocphidry) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_ocphidry) call a2l_fields%add_var(fieldname='Faxa_ocphodry' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_ocphodry) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_ocphodry) call a2l_fields%add_var(fieldname='Faxa_ocphiwet' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_ocphiwet) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_ocphiwet) call a2l_fields%add_var(fieldname='Faxa_dstwet1' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_dstwet1) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_dstwet1) call a2l_fields%add_var(fieldname='Faxa_dstdry1' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_dstdry1) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_dstdry1) call a2l_fields%add_var(fieldname='Faxa_dstwet2' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_dstwet2) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_dstwet2) call a2l_fields%add_var(fieldname='Faxa_dstdry2' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_dstdry2) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_dstdry2) call a2l_fields%add_var(fieldname='Faxa_dstwet3' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_dstwet3) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_dstwet3) call a2l_fields%add_var(fieldname='Faxa_dstdry3' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_dstdry3) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_dstdry3) call a2l_fields%add_var(fieldname='Faxa_dstwet4' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_dstwet4) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_dstwet4) call a2l_fields%add_var(fieldname='Faxa_dstdry4' , units='unknown', available_from_data=.true., & - field_index=lilac_a2l_Faxa_dstdry4) + can_be_time_const=.false., field_index=lilac_a2l_Faxa_dstdry4) end subroutine create_a2l_field_list From 8b8bf980296055475b0428a76ecd3c15730c0108 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 11:51:47 -0600 Subject: [PATCH 0639/1973] In demo atm driver, calculate space_perturbation separately This will be needed for an upcoming change. This changes answers, but just at the roundoff-level for the atm -> lnd fields (but these roundoff-level changes can grow). --- lilac/atm_driver/atm_driver.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 578fc1d32b..10566cdf6f 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -388,6 +388,7 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) integer :: lsize real*8 :: time_midpoint real*8 :: time_perturbation + real*8, allocatable :: space_perturbation(:) real*8, allocatable :: space_time_perturbation(:) real*8, allocatable :: data(:) integer :: i @@ -395,13 +396,15 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) ! -------------------------------------------------------- lsize = size(lon) + allocate(space_perturbation(lsize)) allocate(space_time_perturbation(lsize)) allocate(data(lsize)) ! The time perturbation will range from about -0.5 to 0.5 time_midpoint = atm_nsteps / 2.d0 time_perturbation = 0.5d0 * (nstep - time_midpoint)/time_midpoint - space_time_perturbation(:) = time_perturbation + lat(:)*0.01d0 + lon(:)*0.01d0 + space_perturbation(:) = lat(:)*0.01d0 + lon(:)*0.01d0 + space_time_perturbation(:) = time_perturbation + space_perturbation(:) ! Only set landfrac in the first time step, similar to what most real atmospheres ! will probably do. From 0f22288e40a025b52126bad433349c3c61315f6f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 12:00:42 -0600 Subject: [PATCH 0640/1973] Use a time-constant topo field This changes answers, and is a preparatory answer-changing commit for an upcoming commit where I want to exercise the infrastructure that allows fields to just be set in the first time step (which hopefully will be bfb with this commit). --- lilac/atm_driver/atm_driver.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 10566cdf6f..9d9df4c139 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -428,7 +428,10 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) data(:) = 30.0d0 + space_time_perturbation(:) call lilac_atm2lnd(lilac_a2l_Sa_z, data) - data(:) = 10.0d0 + space_time_perturbation(:) + ! Use a time-constant topo field (which may be typical of atmospheres), in order to + ! test the infrastructure that allows fields to be just set once, in the first time + ! step. + data(:) = 10.0d0 + space_perturbation(:) call lilac_atm2lnd(lilac_a2l_Sa_topo, data) data(:) = 20.0d0 + space_time_perturbation(:) From c4ef195834c8b1e4d87b5bb8c62c64dd1cf78251 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 12:13:05 -0600 Subject: [PATCH 0641/1973] Only set Sa_topo in the first time step This is so that we test the infrastructure that allows fields to be just set once. (To some extent that was already tested via Sa_landfrac, but this is a field that is actually accessed each time step inside CTSM, so this provides a better test that we're actually sending the correct field across each time step.) This is bit-for-bit with the last commit, as desired. --- lilac/atm_driver/atm_driver.F90 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 9d9df4c139..e466caed34 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -425,14 +425,19 @@ subroutine atm_driver_to_lilac (lon, lat, nstep, atm_nsteps) ! mis-matches (e.g., if foo and bar were accidentally swapped in CTSM, we couldn't ! catch that if they both had the same value). + ! Sa_z is allowed to be time-constant, but we're keeping it time-varying here in + ! order to test the ability to have an allowed-to-be-time-constant field actually be + ! time-varying. data(:) = 30.0d0 + space_time_perturbation(:) call lilac_atm2lnd(lilac_a2l_Sa_z, data) ! Use a time-constant topo field (which may be typical of atmospheres), in order to ! test the infrastructure that allows fields to be just set once, in the first time ! step. - data(:) = 10.0d0 + space_perturbation(:) - call lilac_atm2lnd(lilac_a2l_Sa_topo, data) + if (nstep == 1) then + data(:) = 10.0d0 + space_perturbation(:) + call lilac_atm2lnd(lilac_a2l_Sa_topo, data) + end if data(:) = 20.0d0 + space_time_perturbation(:) call lilac_atm2lnd(lilac_a2l_Sa_u, data) From e0fe64b673d484a77afc8704a49347ec62823b0e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 14:00:36 -0600 Subject: [PATCH 0642/1973] Define _FillValue attribute on atm driver output file This is bit-for-bit with the previous commit. This is in preparation for some more upcoming changes. --- lilac/atm_driver/atm_driver.F90 | 5 ++++- lilac/src/lilac_constants.F90 | 4 ++-- lilac/src/lilac_io.F90 | 2 +- lilac/src/lilac_methods.F90 | 1 - 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index e466caed34..611991de0b 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -18,9 +18,10 @@ program atm_driver use netcdf , only : nf90_open, nf90_create, nf90_enddef, nf90_close use netcdf , only : nf90_clobber, nf90_write, nf90_nowrite, nf90_noerr, nf90_double - use netcdf , only : nf90_def_dim, nf90_def_var, nf90_put_var + use netcdf , only : nf90_def_dim, nf90_def_var, nf90_put_att, nf90_put_var use netcdf , only : nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_varid, nf90_get_var use lilac_mod , only : lilac_init1, lilac_init2, lilac_run, lilac_final + use lilac_constants , only : fillvalue => lilac_constants_fillvalue use ctsm_LilacCouplingFieldIndices use ctsm_LilacCouplingFields, only : lilac_atm2lnd, lilac_lnd2atm ! A real atmosphere should not use l2a_fields directly. We use it here just for @@ -555,6 +556,8 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, & field_name = l2a_fields%get_fieldname(i) ierr = nf90_def_var(ncid, field_name, nf90_double, [dimid_x, dimid_y], varids(i)) if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_def_var atm driver output file: '//trim(field_name)) + ierr = nf90_put_att(ncid, varids(i), '_FillValue', fillvalue) + if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_put_att atm driver output file: '//trim(field_name)) end do ierr = nf90_enddef(ncid) diff --git a/lilac/src/lilac_constants.F90 b/lilac/src/lilac_constants.F90 index 847fe2cc1d..77edbfbe92 100644 --- a/lilac/src/lilac_constants.F90 +++ b/lilac/src/lilac_constants.F90 @@ -1,13 +1,13 @@ module lilac_constants use shr_kind_mod, only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8 + use shr_const_mod, only : SHR_CONST_SPVAL implicit none public logical, parameter :: lilac_constants_statewrite_flag = .false. - real(R8), parameter :: lilac_constants_spval_init = 0.0_R8 ! spval for initialization - real(R8), parameter :: lilac_constants_spval = 0.0_R8 ! spval + real(R8), parameter :: lilac_constants_fillvalue = SHR_CONST_SPVAL real(R8), parameter :: lilac_constants_czero = 0.0_R8 ! spval integer, parameter :: lilac_constants_ispval_mask = -987987 ! spval for RH mask values integer, parameter :: lilac_constants_SecPerDay = 86400 ! Seconds per day diff --git a/lilac/src/lilac_io.F90 b/lilac/src/lilac_io.F90 index 276fc23cc6..f4eec5d485 100644 --- a/lilac/src/lilac_io.F90 +++ b/lilac/src/lilac_io.F90 @@ -7,10 +7,10 @@ module lilac_io use ESMF use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl use shr_kind_mod , only : r4=>shr_kind_r4, i8=>shr_kind_i8, r8=>shr_kind_r8 - use shr_const_mod , only : fillvalue => SHR_CONST_SPVAL use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat use shr_sys_mod , only : shr_sys_abort use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag + use lilac_constants , only : fillvalue => lilac_constants_fillvalue use lilac_constants , only : logunit use lilac_methods , only : FB_getFieldN => lilac_methods_FB_getFieldN use lilac_methods , only : FB_getFldPtr => lilac_methods_FB_getFldPtr diff --git a/lilac/src/lilac_methods.F90 b/lilac/src/lilac_methods.F90 index cdfff14c8b..eb2aa38dab 100644 --- a/lilac/src/lilac_methods.F90 +++ b/lilac/src/lilac_methods.F90 @@ -9,7 +9,6 @@ module lilac_methods use shr_kind_mod , only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8 use lilac_constants , only : dbug_flag => lilac_constants_dbug_flag use lilac_constants , only : czero => lilac_constants_czero - use lilac_constants , only : spval_init => lilac_constants_spval_init implicit none private From fb435bca3c584b75c7124e2eb68ec0cf1ac20fa0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 14:31:36 -0600 Subject: [PATCH 0643/1973] Initialize export fields to fillvalue, not 0, over ocean points I have tested this with the demo atm driver, and found: - cprnc output indicates differences only in fillvalue, not in any actual field values, both for lilac file and demo atm output file - Looked at a field with 'minus' (evap) and without minus (swnet); both look identical between the two, other than the fill value (both on lilac hist file and demo atm hist file) - snowh (which was referenced in the deleted comment) also looks reasonable (both on lilac hist file and demo atm hist file) (note: I think this reference may have been a carry-over from the original nuopc cap implementation) - Also: tried keeping the initialization at 0 rather than fillvalue (reverted two lines); this was bfb with the previous commit, as expected, verifying that the rework of the 'minus' handling here doesn't change answers --- src/cpl/lilac/lnd_import_export.F90 | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index d47069b63a..313d0ce635 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -710,29 +710,27 @@ subroutine state_setexport(state, fb, fldname, bounds, input, minus, ungridded_i if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - ! TODO: if fillvalue = shr_const_spval the snowhl sent to the atm will have the spval over some points - ! rather than 0 - this is very odd and needs to be understood - ! fldptr(:) = fillvalue - ! determine output array if (present(ungridded_index)) then - fldptr2d(ungridded_index,:) = 0._r8 + fldptr2d(ungridded_index,:) = fillvalue do g = bounds%begg, bounds%endg n = g - bounds%begg + 1 - fldptr2d(ungridded_index,n) = input(g) + if (l_minus) then + fldptr2d(ungridded_index,n) = -input(g) + else + fldptr2d(ungridded_index,n) = input(g) + end if end do - if (l_minus) then - fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) - end if else - fldptr1d(:) = 0._r8 + fldptr1d(:) = fillvalue do g = bounds%begg, bounds%endg n = g - bounds%begg + 1 - fldptr1d(n) = input(g) + if (l_minus) then + fldptr1d(n) = -input(g) + else + fldptr1d(n) = input(g) + end if end do - if (l_minus) then - fldptr1d(:) = -fldptr1d(:) - end if end if ! write debug output if appropriate From 041db069629ecc49450531467c8bec4c99cf88ab Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 9 Mar 2020 16:32:44 -0600 Subject: [PATCH 0644/1973] Remove dtime from namelist: always use dtime from driver For LILAC, @mvertens had put in place some code that would ignore dtime from the namelist, instead using LILAC's specified dtime. She pointed out that we should really be doing this for all drivers: Apparently CLM used to support sub-cycling (running multiple land model time steps per coupling interval), but this hasn't been supported for quite a while. Thus, this commit removes dtime from the namelist and, regardless of the coupling cap we are using, we always get CTSM's internal dtime from the driver / coupler. --- bld/CLMBuildNamelist.pm | 26 ------------ bld/namelist_files/namelist_defaults_ctsm.xml | 3 -- .../namelist_definition_ctsm.xml | 5 --- bld/unit_testers/build-namelist_test.pl | 26 ++---------- cime_config/buildnml | 5 +-- .../testmods_dirs/clm/fire_emis/user_nl_clm | 1 - cime_config/user_nl_clm | 1 - .../_includes/output_base/user_nl_clm | 1 - lilac_config/buildnml | 1 - src/cpl/lilac/lnd_comp_esmf.F90 | 25 ++++++----- src/cpl/mct/lnd_comp_mct.F90 | 41 ++++++++++--------- src/cpl/nuopc/lnd_comp_nuopc.F90 | 35 ++++++---------- src/main/clm_initializeMod.F90 | 7 ++-- src/main/controlMod.F90 | 22 +--------- 14 files changed, 58 insertions(+), 141 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 0ccf7ffb0d..06fefdd86f 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -189,7 +189,6 @@ OPTIONS form \$CASEDIR/user_nl_clm/user_nl_clm_????) -inputdata "filepath" Writes out a list containing pathnames for required input datasets in file specified. - -l_ncpl "LND_NCPL" Number of CLM coupling time-steps in a day. -lnd_tuning_mode "value" Use the parameters tuned for the given configuration (CLM version and atmospheric forcing) -mask "landmask" Type of land-mask (default, navy, gx3v5, gx1v5 etc.) "-mask list" to list valid land masks. @@ -254,7 +253,6 @@ sub process_commandline { help => 0, glc_nec => "default", light_res => "default", - l_ncpl => undef, lnd_tuning_mode => "default", lnd_frac => undef, dir => "$cwd", @@ -306,7 +304,6 @@ sub process_commandline { "infile=s" => \$opts{'infile'}, "lnd_frac=s" => \$opts{'lnd_frac'}, "lnd_tuning_mode=s" => \$opts{'lnd_tuning_mode'}, - "l_ncpl=i" => \$opts{'l_ncpl'}, "inputdata=s" => \$opts{'inputdata'}, "mask=s" => \$opts{'mask'}, "namelist=s" => \$opts{'namelist'}, @@ -1491,7 +1488,6 @@ sub process_namelist_inline_logic { setup_logic_co2_type($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_irrigate($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_start_type($opts, $nl_flags, $nl); - setup_logic_delta_time($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_decomp_performance($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_snow($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_glacier($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref); @@ -1851,28 +1847,6 @@ sub setup_logic_start_type { #------------------------------------------------------------------------------- -sub setup_logic_delta_time { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - if ( defined($opts->{'l_ncpl'}) ) { - my $l_ncpl = $opts->{'l_ncpl'}; - if ( $l_ncpl <= 0 ) { - $log->fatal_error("bad value for -l_ncpl option."); - } - my $val = ( 3600 * 24 ) / $l_ncpl; - my $dtime = $nl->get_value('dtime'); - if ( ! defined($dtime) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtime', 'val'=>$val); - } elsif ( $dtime ne $val ) { - $log->fatal_error("can NOT set both -l_ncpl option (via LND_NCPL env variable) AND dtime namelist variable."); - } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtime', 'hgrid'=>$nl_flags->{'res'}); - } -} - -#------------------------------------------------------------------------------- - sub setup_logic_decomp_performance { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index a32c807f16..bb7db629b2 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -19,9 +19,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 2000 - -1800 - 379.0 379.0 diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 83502c5f32..72b30571c1 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -619,11 +619,6 @@ The maximum value to use for zeta under stable conditions baseline proportion of nitrogen allocated for electron transport (J) - -Time step (seconds) - - Toggle to turn on the FATES model diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 77ea34f13c..cd8fb5edd3 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -287,15 +287,15 @@ sub make_config_cache { &make_config_cache($phys); print "\n===============================================================================\n"; -print "Test configuration, structure, irrigate, verbose, clm_demand, rcp, test, sim_year, use_case, l_ncpl\n"; +print "Test configuration, structure, irrigate, verbose, clm_demand, rcp, test, sim_year, use_case\n"; print "=================================================================================\n"; -# configuration, structure, irrigate, verbose, clm_demand, rcp, test, sim_year, use_case, l_ncpl +# configuration, structure, irrigate, verbose, clm_demand, rcp, test, sim_year, use_case my $startfile = "clmrun.clm2.r.1964-05-27-00000.nc"; foreach my $options ( "-configuration nwp", "-structure fast", "-namelist '&a irrigate=.true./'", "-verbose", "-rcp 2.6", "-test", "-sim_year 1850", - "-use_case 1850_control", "-l_ncpl 1", + "-use_case 1850_control", "-clm_start_type startup", "-namelist '&a irrigate=.false./' -crop -bgc bgc", "-envxml_dir . -infile myuser_nl_clm", "-ignore_ic_date -clm_start_type branch -namelist '&a nrevsn=\"thing.nc\"/' -bgc bgc -crop", @@ -308,10 +308,7 @@ sub make_config_cache { $cfiles->checkfilesexist( "$options", $mode ); $cfiles->shownmldiff( "default", $mode ); my $finidat = `grep finidat lnd_in`; - if ( $options eq "-l_ncpl 1" ) { - my $dtime = `grep dtime lnd_in`; - like( $dtime, "/ 86400\$/", "$options" ); - } elsif ( $options =~ /myuser_nl_clm/ ) { + if ( $options =~ /myuser_nl_clm/ ) { my $fsurdat = `grep fsurdat lnd_in`; like( $fsurdat, "/MYDINLOCROOT/lnd/clm2/PTCLMmydatafiles/1x1pt_US-UMB/surfdata_1x1pt_US-UMB_simyr2000_clm4_5_c131122.nc/", "$options" ); } @@ -388,21 +385,6 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, - "l_ncpl is zero" =>{ options=>"-l_ncpl 0 -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - phys=>"clm5_0", - }, - "l_ncpl not integer" =>{ options=>"-l_ncpl 1.0 -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - phys=>"clm5_0", - }, - "both l_ncpl and dtime" =>{ options=>"-l_ncpl 24 -envxml_dir .", - namelst=>"dtime=1800", - GLC_TWO_WAY_COUPLING=>"FALSE", - phys=>"clm5_0", - }, "use_crop without -crop" =>{ options=>" -envxml_dir .", namelst=>"use_crop=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", diff --git a/cime_config/buildnml b/cime_config/buildnml index 9940de97a3..a33fadb864 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -50,7 +50,6 @@ def buildnml(case, caseroot, compname): clm_accelerated_spinup = case.get_value("CLM_ACCELERATED_SPINUP") comp_atm = case.get_value("COMP_ATM") lnd_grid = case.get_value("LND_GRID") - lnd_ncpl = case.get_value("LND_NCPL") lnd_domain_path = case.get_value("LND_DOMAIN_PATH") lnd_domain_file = case.get_value("LND_DOMAIN_FILE") ninst_lnd = case.get_value("NINST_LND") @@ -209,12 +208,12 @@ def buildnml(case, caseroot, compname): cmd = os.path.join(lnd_root,"bld","build-namelist") command = ("%s -cimeroot %s -infile %s -csmdata %s -inputdata %s %s -namelist \"&clm_inparm start_ymd=%s %s/ \" " - "%s %s -res %s %s -clm_start_type %s -envxml_dir %s -l_ncpl %s " + "%s %s -res %s %s -clm_start_type %s -envxml_dir %s " "-configuration %s -structure %s " "-lnd_frac %s -glc_nec %s -co2_ppmv %s -co2_type %s -config %s " "%s %s %s %s" %(cmd, _CIMEROOT, infile, din_loc_root, inputdata_file, ignore, start_ymd, clm_namelist_opts, - nomeg, usecase, lnd_grid, clmusr, start_type, caseroot, lnd_ncpl, + nomeg, usecase, lnd_grid, clmusr, start_type, caseroot, configuration, structure, lndfrac_file, glc_nec, ccsm_co2_ppmv, clm_co2_type, config_cache_file, clm_bldnml_opts, spinup, tuning, gridmask)) diff --git a/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm index 3f5749e61f..410035f89c 100644 --- a/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm @@ -7,7 +7,6 @@ ! ! EXCEPTIONS: ! Set co2_ppmv with CCSM_CO2_PPMV option -! Set dtime with L_NCPL option ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases ! (includes $inst_string for multi-ensemble cases) diff --git a/cime_config/user_nl_clm b/cime_config/user_nl_clm index cfc5c71308..a333f1a603 100644 --- a/cime_config/user_nl_clm +++ b/cime_config/user_nl_clm @@ -9,7 +9,6 @@ ! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting ! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting ! Set co2_ppmv with CCSM_CO2_PPMV option -! Set dtime with L_NCPL option ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases ! (includes $inst_string for multi-ensemble cases) diff --git a/cime_config/usermods_dirs/_includes/output_base/user_nl_clm b/cime_config/usermods_dirs/_includes/output_base/user_nl_clm index d46ce25859..b307b644aa 100644 --- a/cime_config/usermods_dirs/_includes/output_base/user_nl_clm +++ b/cime_config/usermods_dirs/_includes/output_base/user_nl_clm @@ -9,7 +9,6 @@ ! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting ! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting ! Set co2_ppmv with CCSM_CO2_PPMV option -! Set dtime with L_NCPL option ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases ! (includes $inst_string for multi-ensemble cases) diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 6ce420d417..edb72709fc 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -138,7 +138,6 @@ def buildnml(rundir, bldnmldir): '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date '-res', lnd_grid, '-clm_start_type', start_type, - '-l_ncpl', str(1), # this will not be used in lilac - but is needed as input '-configuration', configuration, '-structure', structure, '-lnd_frac', os.path.join(lnd_domain_path, lnd_domain_file), diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index f0591be358..ba5f73c2b7 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -304,13 +304,22 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) end if + call ESMF_TimeIntervalGet(timeStep, s=dtime_lilac, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (masterproc) then + write(iulog,*)'dtime = ',dtime_lilac + end if + ! The following sets the module variables in clm_time_mamanger.F90 - BUT DOES NOT intialize the ! clock. Routine timemgr_init (called by initialize1) initializes the clock using the module variables ! that have been set via calls to set_timemgr_init. + ! Note that we assume that CTSM's internal dtime matches the coupling time step. + ! i.e., we currently do NOT allow sub-cycling within a coupling time step. call set_timemgr_init( & calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod) + ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, dtime_in=dtime_lilac) !---------------------- ! Read namelist, grid and surface data @@ -330,19 +339,9 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Call initialize1 !---------------------- - call ESMF_TimeIntervalGet(timeStep, s=dtime_lilac, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - if (masterproc) then - write(iulog,*)'dtime_lilac= ',dtime_lilac - end if - - ! Note that routine controlMod.F90 will initialze the dtime module - ! variable in clm_time_manager to the dtime_lilac AND NOT the - ! dtime read in from the clm_inparm namelist in this case. Note - ! that the memory for gindex_ocn will be allocated in the following call + ! Note that the memory for gindex_ocn will be allocated in the following call - call initialize1(gindex_ocn=gindex_ocn, dtime_driver=dtime_lilac) + call initialize1(dtime=dtime_lilac, gindex_ocn=gindex_ocn) call ESMF_LogWrite(subname//"ctsm time manager initialized....", ESMF_LOGMSG_INFO) call ESMF_LogWrite(subname//"ctsm initialize1 done...", ESMF_LOGMSG_INFO) diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index eeacdcd89a..b5b46ca97e 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -42,7 +42,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) ! !USES: use shr_kind_mod , only : shr_kind_cl use abortutils , only : endrun - use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday + use clm_time_manager , only : get_nstep, set_timemgr_init, set_nextsw_cday use clm_initializeMod, only : initialize1, initialize2 use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog, noland @@ -82,7 +82,6 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) integer :: lsize ! size of attribute vector integer :: g,i,j ! indices integer :: dtime_sync ! coupling time-step from the input synchronization clock - integer :: dtime_clm ! clm time-step logical :: exists ! true if file exists logical :: atm_aero ! Flag if aerosol data sent from atm model real(r8) :: scmlat ! single-column latitude @@ -166,15 +165,24 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) start_ymd=start_ymd, & start_tod=start_tod, ref_ymd=ref_ymd, & ref_tod=ref_tod, & - calendar=calendar ) + calendar=calendar, & + dtime=dtime_sync) + if (masterproc) then + write(iulog,*)'dtime = ',dtime_sync + end if + call seq_infodata_GetData(infodata, case_name=caseid, & case_desc=ctitle, single_column=single_column, & scmlat=scmlat, scmlon=scmlon, & brnch_retain_casename=brnch_retain_casename, & start_type=starttype, model_version=version, & hostname=hostname, username=username ) + + ! Note that we assume that CTSM's internal dtime matches the coupling time step. + ! i.e., we currently do NOT allow sub-cycling within a coupling time step. call set_timemgr_init( calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod) + ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, dtime_in=dtime_sync) + if ( trim(starttype) == trim(seq_infodata_start_type_start)) then nsrest = nsrStartup else if (trim(starttype) == trim(seq_infodata_start_type_cont) ) then @@ -193,7 +201,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) ! Read namelist, grid and surface data - call initialize1( ) + call initialize1(dtime=dtime_sync) ! If no land then exit out of initialization @@ -229,20 +237,6 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) call initialize2() - ! Check that clm internal dtime aligns with clm coupling interval - - call seq_timemgr_EClockGetData(EClock, dtime=dtime_sync ) - dtime_clm = get_step_size() - if (masterproc) then - write(iulog,*)'dtime_sync= ',dtime_sync,& - ' dtime_clm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) - end if - if (mod(dtime_sync,dtime_clm) /= 0) then - write(iulog,*)'clm dtime ',dtime_clm,' and Eclock dtime ',& - dtime_sync,' never align' - call endrun( sub//' ERROR: time out of sync' ) - end if - ! Create land export state call lnd_export(bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) @@ -416,6 +410,15 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) ! Determine if dosend ! When time is not updated at the beginning of the loop - then return only if ! are in sync with clock before time is updated + ! + ! NOTE(wjs, 2020-03-09) I think the do while (.not. dosend) loop only is important + ! for the first time step (when we run 2 steps). After that, we now assume that we + ! run one time step per coupling interval (based on setting the model's dtime from + ! the driver). (According to Mariana Vertenstein, sub-cycling (running multiple + ! land model time steps per coupling interval) used to be supported, but hasn't + ! been fully supported for a long time.) We may want to rework this logic to make + ! this more explicit, or - ideally - get rid of this extra time step at the start + ! of the run, at which point I think we could do away with this looping entirely. call get_curr_date( yr, mon, day, tod ) ymd = yr*10000 + mon*100 + day diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 4ee197c746..b4e6029588 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -325,7 +325,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: curr_ymd ! Start date (YYYYMMDD) integer :: curr_tod ! Start time of day (sec) integer :: dtime_sync ! coupling time-step from the input synchronization clock - integer :: dtime_clm ! ctsm time-step integer, pointer :: gindex(:) ! global index space for land and ocean points integer, pointer :: gindex_lnd(:) ! global index space for just land points integer, pointer :: gindex_ocn(:) ! global index space for just ocean points @@ -482,16 +481,26 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) end if + call ESMF_TimeIntervalGet( timeStep, s=dtime_sync, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (masterproc) then + write(iulog,*)'dtime = ', dtime_sync + end if + !---------------------- ! Initialize CTSM time manager !---------------------- + ! Note that we assume that CTSM's internal dtime matches the coupling time step. + ! i.e., we currently do NOT allow sub-cycling within a coupling time step. call set_timemgr_init( & calendar_in=calendar, & start_ymd_in=start_ymd, & start_tod_in=start_tod, & ref_ymd_in=ref_ymd, & - ref_tod_in=ref_tod) + ref_tod_in=ref_tod, & + dtime_in=dtime_sync) !---------------------- ! Read namelist, grid and surface data @@ -508,7 +517,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) username_in=username) ! note that the memory for gindex_ocn will be allocated in the following call - call initialize1(gindex_ocn) + call initialize1(dtime=dtime_sync, gindex_ocn=gindex_ocn) ! obtain global index array for just land points which includes mask=0 or ocean points call get_proc_bounds( bounds ) @@ -563,26 +572,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call initialize2() - !-------------------------------- - ! Check that ctsm internal dtime aligns with ctsm coupling interval - !-------------------------------- - - call ESMF_ClockGet( clock, timeStep=timeStep, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeIntervalGet( timeStep, s=dtime_sync, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - dtime_clm = get_step_size() - - if (masterproc) then - write(iulog,*)'dtime_sync= ',dtime_sync,' dtime_ctsm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) - end if - if (mod(dtime_sync,dtime_clm) /= 0) then - write(iulog,*)'ctsm dtime ',dtime_clm,' and clock dtime ',dtime_sync,' never align' - rc = ESMF_FAILURE - return - end if - !-------------------------------- ! Create land export state !-------------------------------- diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 32ff522a91..4064f3e756 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -39,7 +39,7 @@ module clm_initializeMod contains !----------------------------------------------------------------------- - subroutine initialize1(gindex_ocn, dtime_driver) + subroutine initialize1(dtime, gindex_ocn) ! ! !DESCRIPTION: ! CLM initialization first phase @@ -61,13 +61,14 @@ subroutine initialize1(gindex_ocn, dtime_driver) use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp ! ! !ARGUMENTS + integer, intent(in) :: dtime ! model time step (seconds) + ! COMPILER_BUG(wjs, 2020-02-20, intel18.0.3) Although gindex_ocn could be ! intent(out), intel18.0.3 generates a runtime segmentation fault in runs that don't ! have this argument present when this is declared intent(out). (It works fine on ! intel 19.0.2 when declared as intent(out).) See also ! https://github.com/ESCOMP/CTSM/issues/930. integer, pointer, optional, intent(inout) :: gindex_ocn(:) ! If present, this will hold the decomposition of ocean points (which is needed for the nuopc interface); note that this variable is allocated here, and is assumed to start unallocated - integer, intent(in), optional :: dtime_driver ! ! !LOCAL VARIABLES: integer :: ier ! error status @@ -99,7 +100,7 @@ subroutine initialize1(gindex_ocn, dtime_driver) call shr_sys_flush(iulog) endif - call control_init(dtime_driver) + call control_init(dtime) call ncd_pio_init() call surfrd_get_num_patches(fsurdat, actual_maxsoil_patches, actual_numcft) call clm_varpar_init(actual_maxsoil_patches, actual_numcft) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 880d28005c..be3ece7026 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -110,13 +110,12 @@ end subroutine control_setNL !------------------------------------------------------------------------ - subroutine control_init(dtime_driver) + subroutine control_init(dtime) ! ! !DESCRIPTION: ! Initialize CLM run control information ! ! !USES: - use clm_time_manager , only : set_timemgr_init use CNMRespMod , only : CNMRespReadNML use LunaMod , only : LunaReadNML use CNNDynamicsMod , only : CNNDynamicsReadNML @@ -125,13 +124,12 @@ subroutine control_init(dtime_driver) use landunit_varcon , only : max_lunit ! ! ARGUMENTS - integer, intent(in), optional :: dtime_driver + integer, intent(in) :: dtime ! model time step (seconds) ! !LOCAL VARIABLES: integer :: i ! loop indices integer :: ierr ! error code integer :: unitn ! unit for namelist file - integer :: dtime ! Integer time-step logical :: use_init_interp ! Apply initInterp to the file given by finidat !------------------------------------------------------------------------ @@ -139,10 +137,6 @@ subroutine control_init(dtime_driver) ! Namelist Variables ! ---------------------------------------------------------------------- - ! Time step - namelist / clm_inparm/ & - dtime - ! CLM namelist settings namelist /clm_inparm / & @@ -342,18 +336,6 @@ subroutine control_init(dtime_driver) ! Process some namelist variables, and perform consistency checks ! ---------------------------------------------------------------------- - if (present(dtime_driver)) then - ! overwrite dtime with dtime_in - instead of what is being used in the namelist - if (masterproc) then - write(iulog,*) 'WARNING: using dtime from cap rather than what is being read in from namelist' - end if - dtime = dtime_driver - end if - - ! Now initialize the module variable dtime in clm_time_manger - this will be utilized to create the - ! internal clm clock - call set_timemgr_init( dtime_in=dtime ) - ! History and restart files (dependent on settings of dtime) do i = 1, max_tapes if (hist_nhtfrq(i) < 0) then From 205d0cd0c69384f5ecc68103601fdc9e35d17729 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 10 Mar 2020 08:25:29 -0600 Subject: [PATCH 0645/1973] Revert "Update cmeps version" This reverts commit 47b6cf127e4475d04aa15c6cd09566e734f33d10. This seemed to cause problems on cheyenne. I'm trying going back to the older cmeps version. --- Externals_cime.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 2ff29da9f9..cbede7df52 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,5 +1,5 @@ [cmeps] -hash = 36e352b2735a8e3478bde4129ff58214521c7409 +hash = 181ff1ed9dfb279e619e8a2173f43baf7bf1dce3 protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ From 821c6788fa3e74d461b5ca5656bc42cf7e17f27f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 10 Mar 2020 09:13:03 -0600 Subject: [PATCH 0646/1973] Point to a slightly more recent version of cmeps The old version results in an error with python3 during preview_namelists, whereas the latest version results in a runtime error on cheyenne. I'm trying this version that is slightly newer than the previous version and fixes the preview_namelists issue with python3. --- Externals_cime.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index cbede7df52..b6611bd1d2 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,5 +1,5 @@ [cmeps] -hash = 181ff1ed9dfb279e619e8a2173f43baf7bf1dce3 +hash = 5ae44d0c16089bff4f65668138e05255af93428d protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ From 6704bc028e9b457c1fcbb7d3e8929c98ef85e2d9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 10 Mar 2020 09:44:22 -0600 Subject: [PATCH 0647/1973] Update number of expected tests in build-namelist tester --- bld/unit_testers/build-namelist_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index cd8fb5edd3..35dab75497 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 927; +my $ntests = 919; if ( defined($opts{'compare'}) ) { - $ntests += 588; + $ntests += 585; } plan( tests=>$ntests ); From 57ee75b898d1b321968e5260b8c2ef6680dbb66e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 10 Mar 2020 18:43:51 -0600 Subject: [PATCH 0648/1973] merged to ctsm master --- cime_config/testdefs/testlist_clm.xml | 160 +++++++++++------------ src/cpl/mct/lnd_comp_mct.F90 | 7 -- src/main/clm_initializeMod.F90 | 11 +- src/main/histFileMod.F90 | 175 +++++++++++++------------- 4 files changed, 178 insertions(+), 175 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index dac9c9d805..84e0145caf 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -100,7 +100,7 @@ - + @@ -108,7 +108,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -157,7 +157,7 @@ - + @@ -165,7 +165,7 @@ - + @@ -174,7 +174,7 @@ - + @@ -183,7 +183,7 @@ - + @@ -191,7 +191,7 @@ - + @@ -199,7 +199,7 @@ - + @@ -207,7 +207,7 @@ - + @@ -216,7 +216,7 @@ - + @@ -224,7 +224,7 @@ - + @@ -232,7 +232,7 @@ - + @@ -240,7 +240,7 @@ - + @@ -248,7 +248,7 @@ - + @@ -265,7 +265,7 @@ - + @@ -273,7 +273,7 @@ - + @@ -282,7 +282,7 @@ - + @@ -290,7 +290,7 @@ - + @@ -298,7 +298,7 @@ - + @@ -306,7 +306,7 @@ - + @@ -314,7 +314,7 @@ - + @@ -324,7 +324,7 @@ - + @@ -332,7 +332,7 @@ - + @@ -340,7 +340,7 @@ - + @@ -348,7 +348,7 @@ - + @@ -359,7 +359,7 @@ - + @@ -367,7 +367,7 @@ - + @@ -375,7 +375,7 @@ - + @@ -383,7 +383,7 @@ - + @@ -391,7 +391,7 @@ - + @@ -400,7 +400,7 @@ - + @@ -409,7 +409,7 @@ - + @@ -418,7 +418,7 @@ - + @@ -436,7 +436,7 @@ - + @@ -444,7 +444,7 @@ - + @@ -460,7 +460,7 @@ - + @@ -469,7 +469,7 @@ - + @@ -477,7 +477,7 @@ - + @@ -485,7 +485,7 @@ - + @@ -494,7 +494,7 @@ - + @@ -502,7 +502,7 @@ - + @@ -510,7 +510,7 @@ - + @@ -518,7 +518,7 @@ - + @@ -526,7 +526,7 @@ - + @@ -534,7 +534,7 @@ - + @@ -542,7 +542,7 @@ - + @@ -550,7 +550,7 @@ - + @@ -558,7 +558,7 @@ - + @@ -566,7 +566,7 @@ - + @@ -575,7 +575,7 @@ - + @@ -593,7 +593,7 @@ - + @@ -601,7 +601,7 @@ - + @@ -609,7 +609,7 @@ - + @@ -617,7 +617,7 @@ - + @@ -627,7 +627,7 @@ - + @@ -637,7 +637,7 @@ - + @@ -646,7 +646,7 @@ - + @@ -656,7 +656,7 @@ - + @@ -665,7 +665,7 @@ - + @@ -673,7 +673,7 @@ - + @@ -682,7 +682,7 @@ - + @@ -690,7 +690,7 @@ - + @@ -699,7 +699,7 @@ - + @@ -709,7 +709,7 @@ - + @@ -717,7 +717,7 @@ - + @@ -726,7 +726,7 @@ - + @@ -736,7 +736,7 @@ - + @@ -754,7 +754,7 @@ - + @@ -790,7 +790,7 @@ - + @@ -955,7 +955,7 @@ - + @@ -1009,7 +1009,7 @@ - + @@ -1068,7 +1068,7 @@ - + @@ -1172,7 +1172,7 @@ - + @@ -1664,7 +1664,7 @@ - + @@ -1686,7 +1686,7 @@ - + @@ -1722,7 +1722,7 @@ - + @@ -1730,7 +1730,7 @@ - + @@ -1738,7 +1738,7 @@ - + @@ -1746,7 +1746,7 @@ - + diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index f1d385cc30..8a8f86342b 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -156,13 +156,6 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & orb_lambm0=lambm0, orb_obliqr=obliqr ) - if (masterproc) then - write(iulog,*)' orb_eccen = ',eccen - write(iulog,*)' orb_obliqr = ',obliqr - write(iulog,*)' orb_lambm0 = ',lambm0 - write(iulog,*)' orb_mvelpp = ',mvelpp - end if - ! Consistency check on namelist filename call control_setNL("lnd_in"//trim(inst_suffix)) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index c2015113de..b7549eb282 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -270,12 +270,13 @@ subroutine initialize2( ) ! ! !USES: use shr_orb_mod , only : shr_orb_decl + use shr_scam_mod , only : shr_scam_getCloseLatLon use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND use accumulMod , only : print_accum_fields use clm_varpar , only : nlevsno use clm_varcon , only : spval use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat - use clm_varctl , only : use_century_decomp, use_cn, use_fates + use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn, use_fates use clm_varctl , only : use_crop, ndep_from_cpl use clm_varorb , only : eccen, mvelpp, lambm0, obliqr use clm_time_manager , only : get_step_size_real, get_curr_calday @@ -426,6 +427,14 @@ subroutine initialize2( ) avgflag='A', long_name='convective boundary height', & ptr_col=col%zii, default='inactive') + ! If single-column determine closest latitude and longitude + + if (single_column) then + call getfil (fsurdat, locfn, 0) + call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & + closelat, closelon, closelatidx, closelonidx) + end if + ! Initialize instances of all derived types as well as time constant variables call clm_instInit(bounds_proc) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 9245051da8..f0438a8e31 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -13,7 +13,7 @@ module histFileMod use spmdMod , only : masterproc use abortutils , only : endrun use clm_varctl , only : iulog, use_vertsoilc, use_fates - use clm_varcon , only : spval, ispval, dzsoi_decomp + use clm_varcon , only : spval, ispval, dzsoi_decomp use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort use decompMod , only : get_proc_bounds, get_proc_global, bounds_type use GetGlobalValuesMod , only : GetGlobalIndexArray @@ -26,7 +26,7 @@ module histFileMod use FatesInterfaceMod , only : nlevsclass, nlevage use EDTypesMod , only : nfsc, ncwd use FatesInterfaceMod , only : maxveg_fates => numpft - use ncdio_pio + use ncdio_pio ! implicit none @@ -160,7 +160,7 @@ module histFileMod private :: hfields_write ! Write a variable to a history tape private :: hfields_1dinfo ! Define/output 1d subgrid info if appropriate private :: hist_update_hbuf_field_1d ! Updates history buffer for specific field and tape - private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape + private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape private :: hist_set_snow_field_2d ! Set values in history field dimensioned by levsno private :: list_index ! Find index of field in exclude list private :: set_hist_filename ! Determine history dataset filenames @@ -196,7 +196,7 @@ module histFileMod integer :: end1d_out ! on-node 1d hbuf pointer end index integer :: num1d_out ! size of hbuf first dimension (all nodes) integer :: num2d ! size of hbuf second dimension (e.g. number of vertical levels) - integer :: hpindex ! history pointer index + integer :: hpindex ! history pointer index character(len=scale_type_strlen) :: p2c_scale_type ! scale factor when averaging patch to column character(len=scale_type_strlen) :: c2l_scale_type ! scale factor when averaging column to landunit character(len=scale_type_strlen) :: l2g_scale_type ! scale factor when averaging landunit to gridcell @@ -352,7 +352,7 @@ subroutine masterlist_addfld (fname, type1d, type1d_out, & integer :: numl ! total number of landunits across all processors integer :: numc ! total number of columns across all processors integer :: nump ! total number of pfts across all processors - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'masterlist_addfld' !------------------------------------------------------------------------ @@ -673,7 +673,7 @@ subroutine htapes_fieldlist() fexcl(:,8) = hist_fexcl8(:) fexcl(:,9) = hist_fexcl9(:) fexcl(:,10) = hist_fexcl10(:) - + ! First ensure contents of fincl and fexcl are valid names @@ -853,7 +853,7 @@ end subroutine htapes_fieldlist logical function is_mapping_upto_subgrid( type1d, type1d_out ) result ( mapping) ! ! !DESCRIPTION: - ! + ! ! Return true if this field will be mapped into a higher subgrid level ! If false it will be output on it's native grid ! @@ -909,7 +909,7 @@ subroutine htape_addfld (t, f, avgflag) integer :: beg1d_out,end1d_out ! history output per-proc 1d beginning and ending indices integer :: beg1d,end1d ! beginning and ending indices for this field (assume already set) integer :: num1d_out ! history output 1d size - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'htape_addfld' !----------------------------------------------------------------------- @@ -1012,7 +1012,7 @@ subroutine htape_addfld (t, f, avgflag) ! Fields native bounds beg1d = masterlist(f)%field%beg1d end1d = masterlist(f)%field%end1d - + ! Alloccate and initialize history buffer and related info num2d = tape(t)%hlist(n)%field%num2d @@ -1050,7 +1050,7 @@ subroutine hist_update_hbuf(bounds) ! into its history buffer for appropriate tapes. ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -1064,7 +1064,7 @@ subroutine hist_update_hbuf(bounds) !$OMP PARALLEL DO PRIVATE (f, num2d) do f = 1,tape(t)%nflds num2d = tape(t)%hlist(f)%field%num2d - if ( num2d == 1) then + if ( num2d == 1) then call hist_update_hbuf_field_1d (t, f, bounds) else call hist_update_hbuf_field_2d (t, f, bounds, num2d) @@ -1092,7 +1092,7 @@ subroutine hist_update_hbuf_field_1d (t, f, bounds) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: hpindex ! history pointer index @@ -1306,7 +1306,7 @@ subroutine hist_update_hbuf_field_1d (t, f, bounds) if ( end1d .eq. ubound(field,1) ) then k_offset = 0 else - k_offset = 1 - beg1d + k_offset = 1 - beg1d endif do k = beg1d,end1d valid = .true. @@ -1386,7 +1386,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds integer, intent(in) :: num2d ! size of second dimension ! ! !LOCAL VARIABLES: @@ -1409,7 +1409,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) integer , pointer :: nacs(:,:) ! accumulation counter real(r8), pointer :: field(:,:) ! clm 2d pointer field logical :: field_allocated! whether 'field' was allocated here - logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) + logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) !(this refers to a point being active, NOT a history field being active) real(r8), allocatable :: field_gcell(:,:) ! gridcell level field (used if mapping to gridcell is done) character(len=*),parameter :: subname = 'hist_update_hbuf_field_2d' @@ -1709,7 +1709,7 @@ end subroutine hist_update_hbuf_field_2d subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d, beg1d, end1d) ! ! !DESCRIPTION: - ! Set values in history field dimensioned by levsno. + ! Set values in history field dimensioned by levsno. ! ! This routine handles what to do when a given snow layer doesn't exist for a given ! point, based on the no_snow_behavior argument. Options are: @@ -1779,7 +1779,7 @@ subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d num_snow_layers = abs(snl(c)) num_nonexistent_layers = num_levels - num_snow_layers - + ! Fill output field appropriately for each layer ! When only a subset of snow layers exist, it is the LAST num_snow_layers that exist ! Levels are rearranged such that the top snow layer (surface layer) becomes level 1, etc. @@ -1790,7 +1790,7 @@ subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d do level = (num_levels-num_nonexistent_layers), 1, -1 field_out(point, level) = field_in(point, level+num_nonexistent_layers) end do - + end do end associate @@ -1942,7 +1942,7 @@ subroutine htape_create (t, histrest) else lnfid => nfid(t) endif - + ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 ! - 1-d hist files have problems with pnetcdf. A better workaround in terms of @@ -2055,7 +2055,7 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'string_length', hist_dim_name_length, strlen_dimid) call ncd_defdim(lnfid, 'scale_type_string_length', scale_type_strlen, dimid) call ncd_defdim( lnfid, 'levdcmp', nlevdecomp_full, dimid) - + if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) call ncd_defdim(lnfid, 'fates_levscls', nlevsclass, dimid) @@ -2106,7 +2106,7 @@ subroutine htape_add_ltype_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_ltype_metadata' !----------------------------------------------------------------------- - + do ltype = 1, max_lunit attname = att_prefix // landunit_names(ltype) call ncd_putatt(lnfid, ncd_global, attname, ltype) @@ -2157,7 +2157,7 @@ subroutine htape_add_natpft_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_natpft_metadata' !----------------------------------------------------------------------- - + do ptype = natpft_lb, natpft_ub ptype_1_indexing = ptype + (1 - natpft_lb) attname = att_prefix // pftname(ptype) @@ -2187,7 +2187,7 @@ subroutine htape_add_cft_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_cft_metadata' !----------------------------------------------------------------------- - + do ptype = cft_lb, cft_ub ptype_1_indexing = ptype + (1 - cft_lb) attname = att_prefix // pftname(ptype) @@ -2215,11 +2215,11 @@ subroutine htape_timeconst3D(t, & ! ! !ARGUMENTS: integer , intent(in) :: t ! tape index - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) + real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) character(len=*) , intent(in) :: mode ! 'define' or 'write' ! ! !LOCAL VARIABLES: @@ -2435,7 +2435,7 @@ subroutine htape_timeconst3D(t, & l = col%landunit(c) if (lun%lakpoi(l)) then ! Field indices MUST match varnamesl array order above! - if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) + if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) if (ifld ==2) histil(c,lev) = col%dz_lake(c,lev) end if end do @@ -2546,9 +2546,9 @@ subroutine htape_timeconst(t, mode) long_name='coordinate lake levels', units='m', ncid=nfid(t)) call ncd_defvar(varname='levdcmp', xtype=tape(t)%ncprec, dim1name='levdcmp', & long_name='coordinate soil levels', units='m', ncid=nfid(t)) - + if(use_fates)then - + call ncd_defvar(varname='fates_levscls', xtype=tape(t)%ncprec, dim1name='fates_levscls', & long_name='FATES diameter size class lower bound', units='cm', ncid=nfid(t)) call ncd_defvar(varname='fates_scmap_levscag', xtype=ncd_int, dim1name='fates_levscag', & @@ -2632,7 +2632,7 @@ subroutine htape_timeconst(t, mode) dim1id(1) = time_dimid str = 'days since ' // basedate // " " // basesec call ncd_defvar(nfid(t), 'time', tape(t)%ncprec, 1, dim1id, varid, & - long_name='time',units=str) + long_name='time',units=str) cal = get_calendar() if ( trim(cal) == NO_LEAP_C )then caldesc = "noleap" @@ -2653,7 +2653,7 @@ subroutine htape_timeconst(t, mode) else sec_hist_nhtfrq = hist_nhtfrq(t) end if - + dtime = get_step_size() if (sec_hist_nhtfrq == 0) then !month time_period_freq = 'month_1' @@ -3021,7 +3021,7 @@ subroutine hfields_1dinfo(t, mode) integer , pointer :: ilarr(:) ! temporary integer , pointer :: iparr(:) ! temporary type(file_desc_t), pointer :: ncid ! netcdf file - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'hfields_1dinfo' !----------------------------------------------------------------------- @@ -3330,11 +3330,11 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & ! !ARGUMENTS: logical, intent(in) :: rstwr ! true => write restart file this step logical, intent(in) :: nlend ! true => end of run on this step - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) + real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -3518,8 +3518,8 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & endif end do - ! Reset number of time samples to zero if file is full - + ! Reset number of time samples to zero if file is full + do t = 1, ntapes if (.not. history_tape_in_use(t)) then cycle @@ -3529,7 +3529,7 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & tape(t)%ntimes = 0 end if end do - + end subroutine hist_htapes_wrapup !----------------------------------------------------------------------- @@ -3551,7 +3551,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) use pio ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(file_desc_t), intent(inout) :: ncid ! netcdf file character(len=*) , intent(in) :: flag !'read' or 'write' character(len=*) , intent(in), optional :: rdate ! restart file time stamp for name @@ -3681,7 +3681,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ier = PIO_put_att(ncid, vardesc%varid, 'interpinic_flag', iflag_skip) ! max_nflds is the maximum number of fields on any tape - ! max_flds is the maximum number possible number of fields + ! max_flds is the maximum number possible number of fields max_nflds = max_nFields() @@ -3714,7 +3714,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) num2d = tape(t)%hlist(f)%field%num2d nacs => tape(t)%hlist(f)%nacs hbuf => tape(t)%hlist(f)%hbuf - + if (type1d_out == grlnd) then if (ldomain%isgrid2d) then dim1name = 'lon' ; dim2name = 'lat' @@ -3724,10 +3724,10 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) else dim1name = type1d_out ; dim2name = 'undefined' endif - + if (dim2name == 'undefined') then if (num2d == 1) then - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & + call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & dim1name=dim1name, & long_name=trim(long_name), units=trim(units)) call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & @@ -3769,9 +3769,9 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_defdim( ncid_hist(t), 'avgflag_len' , avgflag_strlen, dimid) call ncd_defdim( ncid_hist(t), 'scalar' , 1 , dimid) call ncd_defdim( ncid_hist(t), 'max_chars' , max_chars , dimid) - call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) - call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) - + call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) + call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) + call ncd_defvar(ncid=ncid_hist(t), varname='nhtfrq', xtype=ncd_int, & long_name="Frequency of history writes", & comment="Namelist item", & @@ -3811,7 +3811,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_defvar(ncid=ncid_hist(t), varname='begtime', xtype=ncd_double, & long_name="Beginning time", units="time units", & dim1name='scalar') - + call ncd_defvar(ncid=ncid_hist(t), varname='num2d', xtype=ncd_int, & long_name="Size of second dimension", units="unitless", & dim1name='max_nflds' ) @@ -3853,7 +3853,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_enddef(ncid_hist(t)) - end do ! end of ntapes loop + end do ! end of ntapes loop RETURN @@ -3877,7 +3877,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_io('locfnh', my_locfnh, 'write', ncid, nt=t) call ncd_io('locfnhr', my_locfnhr, 'write', ncid, nt=t) end do - + fincl(:,1) = hist_fincl1(:) fincl(:,2) = hist_fincl2(:) fincl(:,3) = hist_fincl3(:) @@ -3926,7 +3926,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) itemp(:) = 0 do f=1,tape(t)%nflds itemp(f) = tape(t)%hlist(f)%field%num2d - end do + end do call ncd_io(varname='num2d', data=itemp(:), ncid=ncid_hist(t), flag='write') itemp(:) = 0 @@ -3969,7 +3969,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_io('l2g_scale_type', l2g_scale_type, 'write', ncid_hist(t)) deallocate(tname,tlongname,tunits,tmpstr,tavgflag) deallocate(p2c_scale_type, c2l_scale_type, l2g_scale_type) - enddo + enddo deallocate(itemp) ! @@ -4023,7 +4023,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end if ! Determine necessary indices - the following is needed if model decomposition is different on restart - + start(1)=1 if ( is_restart() )then @@ -4038,7 +4038,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) if ( t == 1 )then call ncd_inqdlen(ncid_hist(1),dimid,max_nflds,name='max_nflds') - + allocate(itemp(max_nflds)) end if @@ -4221,7 +4221,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) hist_fexcl10(:) = fexcl(:,10) end if - + if ( allocated(itemp) ) deallocate(itemp) end if @@ -4232,8 +4232,8 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ! so that subsequent time samples are added until the file is full. ! A new history file is used on a branch run. !====================================================================== - - if (flag == 'write') then + + if (flag == 'write') then do t = 1,ntapes if (.not. history_tape_in_use(t)) then @@ -4260,7 +4260,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) write(iulog,*) trim(subname),' ERROR: allocation' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - + hbuf1d(beg1d_out:end1d_out) = hbuf(beg1d_out:end1d_out,1) nacs1d(beg1d_out:end1d_out) = nacs(beg1d_out:end1d_out,1) @@ -4284,9 +4284,9 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_pio_closefile(ncid_hist(t)) - end do ! end of ntapes loop + end do ! end of ntapes loop - else if (flag == 'read') then + else if (flag == 'read') then ! Read history restart information if history files are not full @@ -4307,7 +4307,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end1d_out = tape(t)%hlist(f)%field%end1d_out nacs => tape(t)%hlist(f)%nacs hbuf => tape(t)%hlist(f)%hbuf - + if (num2d == 1) then allocate(hbuf1d(beg1d_out:end1d_out), & nacs1d(beg1d_out:end1d_out), stat=status) @@ -4315,15 +4315,15 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) write(iulog,*) trim(subname),' ERROR: allocation' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - + call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name), & dim1name=type1d_out, data=hbuf1d) call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name_acc), & dim1name=type1d_out, data=nacs1d) - + hbuf(beg1d_out:end1d_out,1) = hbuf1d(beg1d_out:end1d_out) nacs(beg1d_out:end1d_out,1) = nacs1d(beg1d_out:end1d_out) - + deallocate(hbuf1d) deallocate(nacs1d) else @@ -4335,13 +4335,13 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end do end if - + call ncd_pio_closefile(ncid_hist(t)) - + end do - + end if - + end subroutine hist_restart_ncd !----------------------------------------------------------------------- @@ -4363,7 +4363,7 @@ integer function max_nFields() end do return end function max_nFields - + !----------------------------------------------------------------------- character(len=max_namlen) function getname (inname) ! @@ -4560,7 +4560,7 @@ subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds ! boudns + type(bounds_type):: bounds ! boudns character(len=16):: l_default ! local version of 'default' character(len=*),parameter :: subname = 'hist_addfld1d' !------------------------------------------------------------------------ @@ -4786,13 +4786,13 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds + type(bounds_type):: bounds character(len=16):: l_default ! local version of 'default' character(len=*),parameter :: subname = 'hist_addfld2d' !------------------------------------------------------------------------ call get_proc_bounds(bounds) - + ! Error-check no_snow_behavior optional argument: It should be present if and only if ! type2d is 'levsno', and its value should be one of the public no_snow_* parameters ! defined above. @@ -4871,7 +4871,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('levsno') num2d = nlevsno case ('nlevcan') - num2d = nlevcan + num2d = nlevcan case ('nvegwcs') num2d = nvegwcs case default @@ -5172,12 +5172,12 @@ end subroutine hist_add_subscript subroutine strip_null(str) character(len=*), intent(inout) :: str - integer :: i + integer :: i do i=1,len(str) if(ichar(str(i:i))==0) str(i:i)=' ' end do end subroutine strip_null - + !------------------------------------------------------------------------ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rstwr, nlend) ! @@ -5197,7 +5197,7 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, logical, intent(out) :: if_stop !true => last time step of run logical, intent(out) :: if_disphist(ntapes) !true => save and dispose history file logical, intent(in) :: rstwr - logical, intent(in) :: nlend + logical, intent(in) :: nlend ! ! !LOCAL VARIABLES: integer :: t ! history tape index @@ -5207,26 +5207,26 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rest_now = .false. stop_now = .false. - + if (nlend) stop_now = .true. if (rstwr) rest_now = .true. - + if_stop = stop_now - + if (stop_now) then ! End of run - dispose all history files - + if_disphist(1:ntapes) = .true. - + else if (rest_now) then ! Restart - dispose all history files - + do t = 1,ntapes if_disphist(t) = .true. end do else ! Dispose - + if_disphist(1:ntapes) = .false. do t = 1,ntapes if (hist_ntimes(t) == hist_mfilt(t)) then @@ -5234,7 +5234,7 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, endif end do endif - + end subroutine hist_do_disp !----------------------------------------------------------------------- @@ -5274,3 +5274,4 @@ end function avgflag_valid end module histFileMod + From 07add4ed3be92398782c912834e00b190964add8 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 11 Mar 2020 10:28:29 -0600 Subject: [PATCH 0649/1973] added required version of CMEPS for these changes --- Externals_cime.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index cbede7df52..63c73adb96 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,5 +1,5 @@ [cmeps] -hash = 181ff1ed9dfb279e619e8a2173f43baf7bf1dce3 +hash = e0bfc6bdf2e1069e12301380fc1f624f0b33225dhash protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ From b6a1d505aa88304a8ef010d85d76e3a7609642af Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Mar 2020 11:15:23 -0600 Subject: [PATCH 0650/1973] Remove commented-out line and unused local variable --- src/main/ncdio_pio.F90.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 3ccc9f19a4..ff7320bc70 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -218,7 +218,7 @@ contains ! !ARGUMENTS: class(file_desc_t), intent(inout) :: file ! PIO file handle to close !----------------------------------------------------------------------- - integer :: ierr + call pio_closefile(file) end subroutine ncd_pio_closefile @@ -2531,7 +2531,6 @@ contains deallocate(gsmOP) -! call pio_initdecomp(pio_subsystem, baseTYPE, dims(1:ndims), compDOF, iodesc_list(iodnum)%iodesc) call pio_initdecomp(pio_subsystem, xTYPE, dims(1:ndims), compDOF, iodesc_list(iodnum)%iodesc) deallocate(compDOF) From 972a0120e8bf75f15b33ff14a8feba73eb64cfa5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 13 Mar 2020 16:22:52 -0600 Subject: [PATCH 0651/1973] Set use_init_interp=T for finidat files, that had a different fsurdat file than the new ones --- bld/namelist_files/namelist_defaults_ctsm.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index b21c256d11..ebef18c2e9 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -600,21 +600,21 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c190718.nc lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c190718.nc lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc @@ -623,7 +623,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc @@ -631,7 +631,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c190116.nc @@ -639,7 +639,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c190116.nc @@ -647,14 +647,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc From 2392303538298ae1e54421efe094d2d14ac4ce81 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 14 Mar 2020 15:53:18 -0600 Subject: [PATCH 0652/1973] Point to latest version of cime master --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index b15f54e496..f20cf0c66b 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.15_a01 +hash = 4f1880756a66ff12d304937d3c166d451ea50cf9 externals = ../Externals_cime.cfg required = True From 380a62087e83bf15f566282d65354ee4cf78b832 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 15 Mar 2020 17:33:44 -0600 Subject: [PATCH 0653/1973] bug fix for ndep fields from atm --- src/cpl/nuopc/lnd_import_export.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 564348854e..0838b7a00a 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -562,9 +562,9 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! The mediator is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec ! so the following conversion needs to happen - call state_getimport(importState, 'Faxa_nhx', bounds, output=forc_nhx, ungridded_index=1, rc=rc ) + call state_getimport(importState, 'Faxa_ndep', bounds, output=forc_nhx, ungridded_index=1, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_noy', bounds, output=forc_noy, ungridded_index=2, rc=rc ) + call state_getimport(importState, 'Faxa_ndep', bounds, output=forc_noy, ungridded_index=2, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg,endg atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 @@ -1027,7 +1027,7 @@ subroutine fldlist_realize(state, fldList, numflds, flds_scalar_name, flds_scala ESMF_LOGMSG_INFO) ! Create the scalar field call SetScalarField(field, flds_scalar_name, flds_scalar_num, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return else ! Create the field if (fldlist(n)%ungridded_lbound > 0 .and. fldlist(n)%ungridded_ubound > 0) then @@ -1038,7 +1038,7 @@ subroutine fldlist_realize(state, fldList, numflds, flds_scalar_name, flds_scala if (ChkErr(rc,__LINE__,u_FILE_u)) return else field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if call ESMF_LogWrite(trim(subname)//trim(tag)//" Field = "//trim(stdname)//" is connected using mesh", & ESMF_LOGMSG_INFO) @@ -1046,13 +1046,13 @@ subroutine fldlist_realize(state, fldList, numflds, flds_scalar_name, flds_scala ! NOW call NUOPC_Realize call NUOPC_Realize(state, field=field, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return else if (stdname /= trim(flds_scalar_name)) then call ESMF_LogWrite(subname // trim(tag) // " Field = "// trim(stdname) // " is not connected.", & ESMF_LOGMSG_INFO) call ESMF_StateRemove(state, (/stdname/), rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if end if end do From bbe7037fefd8880997a946c6314cf85bb9ed2645 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:18 -0700 Subject: [PATCH 0654/1973] add a new biofuelc_harvest flux to store the cut fraction of crop carbon during offset period --- src/biogeochem/CNVegCarbonFluxType.F90 | 52 +++++++++++++++++--------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 5a5aa3f448..3cf3fe56ba 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -135,9 +135,8 @@ module CNVegCarbonFluxType real(r8), pointer :: livestemc_to_litter_patch (:) ! live stem C litterfall (gC/m2/s) real(r8), pointer :: grainc_to_food_patch (:) ! grain C to food for prognostic crop(gC/m2/s) - ! Y. Cheng - real(r8), pointer :: biofuelc_harvest_patch (:) ! biofuel C for bioenergy crops that are harvested (gC/m2/s) - + real(r8), pointer :: leafc_to_biofuelc_patch (:) ! leaf C to biofuel C (gC/m2/s) + real(r8), pointer :: livestemc_to_biofuelc_patch (:) ! livestem C to biofuel C (gC/m2/s) real(r8), pointer :: grainc_to_seed_patch (:) ! grain C to seed for prognostic crop(gC/m2/s) ! maintenance respiration fluxes @@ -249,6 +248,8 @@ module CNVegCarbonFluxType real(r8), pointer :: harvest_c_to_cwdc_col (:,:) ! C fluxes associated with harvest to CWD pool (gC/m3/s) real(r8), pointer :: grainc_to_cropprodc_patch (:) ! grain C to crop product pool (gC/m2/s) real(r8), pointer :: grainc_to_cropprodc_col (:) ! grain C to crop product pool (gC/m2/s) + real(r8), pointer :: biofuelc_to_cropprodc_patch (:) ! biofuel C to crop product pool (gC/m2/s) + real(r8), pointer :: biofuelc_to_cropprodc_col (:) ! biofuel C to crop product pool (gC/m2/s) ! fire fluxes real(r8), pointer :: m_decomp_cpools_to_fire_vr_col (:,:,:) ! vertically-resolved decomposing C fire loss (gC/m3/s) @@ -600,7 +601,8 @@ subroutine InitAllocate(this, bounds, carbon_type) allocate(this%cpool_to_grainc_storage_patch (begp:endp)) ; this%cpool_to_grainc_storage_patch (:) = nan allocate(this%livestemc_to_litter_patch (begp:endp)) ; this%livestemc_to_litter_patch (:) = nan allocate(this%grainc_to_food_patch (begp:endp)) ; this%grainc_to_food_patch (:) = nan - allocate(this%biofuelc_harvest_patch (begp:endp)) ; this%biofuelc_harvest_patch (:) = nan + allocate(this%leafc_to_biofuelc_patch (begp:endp)) ; this%leafc_to_biofuelc_patch (:) = nan + allocate(this%livestemc_to_biofuelc_patch (begp:endp)) ; this%livestemc_to_biofuelc_patch (:) = nan allocate(this%grainc_to_seed_patch (begp:endp)) ; this%grainc_to_seed_patch (:) = nan allocate(this%grainc_xfer_to_grainc_patch (begp:endp)) ; this%grainc_xfer_to_grainc_patch (:) = nan allocate(this%cpool_grain_gr_patch (begp:endp)) ; this%cpool_grain_gr_patch (:) = nan @@ -664,6 +666,12 @@ subroutine InitAllocate(this, bounds, carbon_type) allocate(this%grainc_to_cropprodc_col(begc:endc)) this%grainc_to_cropprodc_col(:) = nan + + allocate(this%biofuelc_to_cropprodc_patch(begp:endp)) + this%biofuelc_to_cropprodc_patch(:) = nan + + allocate(this%biofuelc_to_cropprodc_col(begc:endc)) + this%biofuelc_to_cropprodc_col(:) = nan allocate(this%m_decomp_cpools_to_fire_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) this%m_decomp_cpools_to_fire_vr_col(:,:,:)= nan @@ -830,12 +838,15 @@ subroutine InitHistory(this, bounds, carbon_type) avgflag='A', long_name='grain C to food', & ptr_patch=this%grainc_to_food_patch) - ! Y. Cheng - this%biofuelc_harvest_patch(begp:endp) = spval - call hist_addfld1d (fname='BIOFUELC_HARVEST', units='gC/m^2/s', & - avgflag='A', long_name='biofuel C harvest', & - ptr_patch=this%biofuelc_harvest_patch) + this%leafc_to_biofuelc_patch(begp:endp) = spval + call hist_addfld1d (fname='LEAFC_TO_BIOFUELC', units='gC/m^2/s', & + avgflag='A', long_name='leaf C to biofuel C', & + ptr_patch=this%leafc_to_biofuelc_patch) + this%livestemc_to_biofuelc_patch(begp:endp) = spval + call hist_addfld1d (fname='LIVESTEMC_TO_BIOFUELC', units='gC/m^2/s', & + avgflag='A', long_name='livestem C to biofuel C', & + ptr_patch=this%livestemc_to_biofuelc_patch) this%grainc_to_seed_patch(begp:endp) = spval call hist_addfld1d (fname='GRAINC_TO_SEED', units='gC/m^2/s', & @@ -3523,14 +3534,17 @@ subroutine RestartBulkOnly ( this, bounds, ncid, flag ) dim1name='pft', & long_name='grain C to food', units='gC/m2/s', & interpinic_flag='interp', readvar=readvar, data=this%grainc_to_food_patch) - - - ! Y. Cheng - call restartvar(ncid=ncid, flag=flag, varname='biofuelc_harvest', xtype=ncd_double, & + + call restartvar(ncid=ncid, flag=flag, varname='leafc_to_biofuelc', xtype=ncd_double, & dim1name='pft', & - long_name='biofuelc harvest', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%biofuelc_harvest_patch) + long_name='leaf C to biofuel C', units='gC/m2/s', & + interpinic_flag='interp', readvar=readvar, data=this%leafc_to_biofuelc_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_to_biofuelc', xtype=ncd_double, & + dim1name='pft', & + long_name='livestem C to biofuel C', units='gC/m2/s', & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_to_biofuelc_patch) + call restartvar(ncid=ncid, flag=flag, varname='cpool_to_grainc', xtype=ncd_double, & dim1name='pft', & long_name='allocation to grain C', units='gC/m2/s', & @@ -3859,6 +3873,7 @@ subroutine SetValues ( this, & this%crop_seedc_to_leaf_patch(i) = value_patch this%grainc_to_cropprodc_patch(i) = value_patch + this%biofuelc_to_cropprodc_patch(i) = value_patch end do if ( use_crop )then @@ -3868,7 +3883,8 @@ subroutine SetValues ( this, & this%livestemc_to_litter_patch(i) = value_patch this%grainc_to_food_patch(i) = value_patch - this%biofuelc_harvest_patch(i) = value_patch + this%leafc_to_biofuelc_patch(i) = value_patch + this%livestemc_to_biofuelc_patch(i) = value_patch this%grainc_to_seed_patch(i) = value_patch this%grainc_xfer_to_grainc_patch(i) = value_patch @@ -3927,6 +3943,7 @@ subroutine SetValues ( this, & i = filter_column(fi) this%grainc_to_cropprodc_col(i) = value_column + this%biofuelc_to_cropprodc_col(i) = value_column this%cwdc_hr_col(i) = value_column this%cwdc_loss_col(i) = value_column this%litterc_loss_col(i) = value_column @@ -4314,8 +4331,7 @@ subroutine Summary_carbonflux(this, & if (.not. use_grainproduct) then this%litfall_patch(p) = & this%litfall_patch(p) + & - this%grainc_to_food_patch(p) + & - this%biofuelc_harvest_patch(p) !Y.Cheng + this%grainc_to_food_patch(p) end if end if From 515ffe3f4b44a6ac39b0c51b35671f0046155a62 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:22 -0700 Subject: [PATCH 0655/1973] add a new biofueln_harvest flux to store the cut fraction of crop nitrogen during offset period --- src/biogeochem/CNVegNitrogenFluxType.F90 | 28 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90 index edfa857998..b79f71986f 100644 --- a/src/biogeochem/CNVegNitrogenFluxType.F90 +++ b/src/biogeochem/CNVegNitrogenFluxType.F90 @@ -63,6 +63,8 @@ module CNVegNitrogenFluxType real(r8), pointer :: hrv_retransn_to_litter_patch (:) ! patch retranslocated N pool harvest mortality (gN/m2/s) real(r8), pointer :: grainn_to_cropprodn_patch (:) ! patch grain N to crop product pool (gN/m2/s) real(r8), pointer :: grainn_to_cropprodn_col (:) ! col grain N to crop product pool (gN/m2/s) + real(r8), pointer :: biofueln_to_cropprodn_patch (:) ! patch biofuel N to crop product pool (gN/m2/s) + real(r8), pointer :: biofueln_to_cropprodn_col (:) ! col biofuel N to crop product pool (gN/m2/s) real(r8), pointer :: m_n_to_litr_met_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter labile N by fire (gN/m3/s) real(r8), pointer :: m_n_to_litr_cel_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter cellulose N by fire (gN/m3/s) real(r8), pointer :: m_n_to_litr_lig_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter lignin N by fire (gN/m3/s) @@ -131,7 +133,8 @@ module CNVegNitrogenFluxType ! litterfall fluxes real(r8), pointer :: livestemn_to_litter_patch (:) ! patch livestem N to litter (gN/m2/s) real(r8), pointer :: grainn_to_food_patch (:) ! patch grain N to food for prognostic crop (gN/m2/s) - real(r8), pointer :: biofueln_harvest_patch (:) ! patch biofuel N for bioenergy crops that are harvested (gN/m2/s) + real(r8), pointer :: leafn_to_biofueln_patch (:) ! patch leaf N to biofuel N (gN/m2/s) + real(r8), pointer :: livestemn_to_biofueln_patch (:) ! patch livestem N to biofuel N (gN/m2/s) real(r8), pointer :: grainn_to_seed_patch (:) ! patch grain N to seed for prognostic crop (gN/m2/s) real(r8), pointer :: leafn_to_litter_patch (:) ! patch leaf N litterfall (gN/m2/s) real(r8), pointer :: leafn_to_retransn_patch (:) ! patch leaf N to retranslocated N pool (gN/m2/s) @@ -414,7 +417,8 @@ subroutine InitAllocate(this, bounds) allocate(this%npool_to_grainn_storage_patch (begp:endp)) ; this%npool_to_grainn_storage_patch (:) = nan allocate(this%livestemn_to_litter_patch (begp:endp)) ; this%livestemn_to_litter_patch (:) = nan allocate(this%grainn_to_food_patch (begp:endp)) ; this%grainn_to_food_patch (:) = nan - allocate(this%biofueln_harvest_patch (begp:endp)) ; this%biofueln_harvest_patch (:) = nan + allocate(this%leafn_to_biofueln_patch (begp:endp)) ; this%leafn_to_biofueln_patch (:) = nan + allocate(this%livestemn_to_biofueln_patch (begp:endp)) ; this%livestemn_to_biofueln_patch (:) = nan allocate(this%grainn_to_seed_patch (begp:endp)) ; this%grainn_to_seed_patch (:) = nan allocate(this%grainn_xfer_to_grainn_patch (begp:endp)) ; this%grainn_xfer_to_grainn_patch (:) = nan allocate(this%grainn_storage_to_xfer_patch (begp:endp)) ; this%grainn_storage_to_xfer_patch (:) = nan @@ -424,6 +428,8 @@ subroutine InitAllocate(this, bounds) allocate(this%grainn_to_cropprodn_patch (begp:endp)) ; this%grainn_to_cropprodn_patch (:) = nan allocate(this%grainn_to_cropprodn_col (begc:endc)) ; this%grainn_to_cropprodn_col (:) = nan + allocate(this%biofueln_to_cropprodn_patch (begp:endp)) ; this%biofueln_to_cropprodn_patch (:) = nan + allocate(this%biofueln_to_cropprodn_col (begc:endc)) ; this%biofueln_to_cropprodn_col (:) = nan allocate(this%fire_nloss_col (begc:endc)) ; this%fire_nloss_col (:) = nan allocate(this%fire_nloss_p2c_col (begc:endc)) ; this%fire_nloss_p2c_col (:) = nan @@ -1374,10 +1380,17 @@ subroutine Restart (this, bounds, ncid, flag ) end if if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='biofueln_harvest', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='leafn_to_biofueln', xtype=ncd_double, & dim1name='pft', & - long_name='biofuel N harvested', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%biofueln_harvest_patch) + long_name='leaf N to biofuel N', units='gN/m2/s', & + interpinic_flag='interp', readvar=readvar, data=this%leafn_to_biofueln_patch) + end if + + if (use_crop) then + call restartvar(ncid=ncid, flag=flag, varname='livestemn_to_biofueln', xtype=ncd_double, & + dim1name='pft', & + long_name='livestem N to biofuel N', units='gN/m2/s', & + interpinic_flag='interp', readvar=readvar, data=this%livestemn_to_biofueln_patch) end if if (use_crop) then @@ -1681,6 +1694,7 @@ subroutine SetValues ( this, & this%crop_seedn_to_leaf_patch(i) = value_patch this%grainn_to_cropprodn_patch(i) = value_patch + this%biofueln_to_cropprodn_patch(i) = value_patch end do if ( use_crop )then @@ -1688,7 +1702,8 @@ subroutine SetValues ( this, & i = filter_patch(fi) this%livestemn_to_litter_patch(i) = value_patch this%grainn_to_food_patch(i) = value_patch - this%biofueln_harvest_patch(i) = value_patch + this%leafn_to_biofueln_patch(i) = value_patch + this%livestemn_to_biofueln_patch(i) = value_patch this%grainn_to_seed_patch(i) = value_patch this%grainn_xfer_to_grainn_patch(i) = value_patch this%npool_to_grainn_patch(i) = value_patch @@ -1732,6 +1747,7 @@ subroutine SetValues ( this, & i = filter_column(fi) this%grainn_to_cropprodn_col(i) = value_column + this%biofueln_to_cropprodn_col(i) = value_column this%fire_nloss_col(i) = value_column ! Zero p2c column fluxes From 0845638aaafeace5db8bf25b6da4a11009de8026 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:25 -0700 Subject: [PATCH 0656/1973] cut a certain fraction of crop aboveground biomass during offset period --- src/biogeochem/CNPhenologyMod.F90 | 71 +++++++++++++++---------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 3079f12670..0439af76d4 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -1436,8 +1436,6 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & use pftconMod , only : ntrp_corn, nsugarcane, ntrp_soybean, ncotton, nrice use pftconMod , only : nirrig_trp_corn, nirrig_sugarcane, nirrig_trp_soybean use pftconMod , only : nirrig_cotton, nirrig_rice - - ! Y. Cheng use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass use clm_varcon , only : spval, secspday @@ -1733,7 +1731,6 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) end if - ! Y. Cheng, add switchgrass and Miscanthus if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & @@ -1786,7 +1783,6 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) end if - ! Y. Cheng, add switchgrass and Miscanthus if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & @@ -1850,7 +1846,6 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! calculate linear relationship between huigrain fraction and relative ! maturity rating for maize - ! Y. Cheng, add switchgrass and Miscanthus if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & @@ -2388,7 +2383,6 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & ! ! !USES: use pftconMod , only : npcropmin - ! Y. Cheng use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass use CNSharedParamsMod, only : use_fun @@ -2446,19 +2440,18 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) (:) ] leaf C litterfall (gC/m2/s) frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Output: [real(r8) (:) ] fine root C litterfall (gC/m2/s) livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Output: [real(r8) (:) ] live stem C litterfall (gC/m2/s) - grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Output: [real(r8) (:) ] grain C to food (gC/m2/s) - - ! Y. Cheng, put the cut fraction during offset period for bioenergy crops to this biofuelc_harvest flux - biofuelc_harvest => cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Output: [real(r8) (:) ] biofuel C that was cutted at harvest (gC/m2/s) - + grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Output: [real(r8) (:) ] grain C to food (gC/m2/s) grainc_to_seed => cnveg_carbonflux_inst%grainc_to_seed_patch , & ! Output: [real(r8) (:) ] grain C to seed (gC/m2/s) + leafc_to_biofuelc => cnveg_carbonflux_inst%leafc_to_biofuelc_patch , & ! Output: [real(r8) (:) ] leaf C to biofuel C (gC/m2/s) + livestemc_to_biofuelc => cnveg_carbonflux_inst%livestemc_to_biofuelc_patch , & ! Output: [real(r8) (:) ] livestem C to biofuel C (gC/m2/s) leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Output: [real(r8) (:) ] livestem N to litter (gN/m2/s) - grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Output: [real(r8) (:) ] grain N to food (gN/m2/s) - biofueln_harvest => cnveg_nitrogenflux_inst%biofueln_harvest_patch , & ! Output: [real(r8) (:) ] biofuel N that was cutted (gC/m2/s) - grainn_to_seed => cnveg_nitrogenflux_inst%grainn_to_seed_patch , & ! Output: [real(r8) (:) ] grain N to seed (gN/m2/s) + grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Output: [real(r8) (:) ] grain N to food (gN/m2/s) + grainn_to_seed => cnveg_nitrogenflux_inst%grainn_to_seed_patch , & ! Output: [real(r8) (:) ] grain N to seed (gN/m2/s) + leafn_to_biofueln => cnveg_nitrogenflux_inst%leafn_to_biofueln_patch , & ! Output: [real(r8) (:) ] leaf N to biofuel N (gN/m2/s) + livestemn_to_biofueln => cnveg_nitrogenflux_inst%livestemn_to_biofueln_patch, & ! Output: [real(r8) (:) ] livestem N to biofuel N (gN/m2/s) leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Output: [real(r8) (:) ] leaf N litterfall (gN/m2/s) leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Input: [real(r8) (:) ] leaf N to retranslocated N pool (gN/m2/s) free_retransn_to_npool=> cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) @@ -2481,11 +2474,11 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & t1 = 1.0_r8 / dt frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) - ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of leafc for harvest - ! and move this cut fration to the biofuelc_harvest flux, rather than move it to litter + ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of leaf C + ! and move this fration of leaf C to biofuel C, rather than move it to litter leafc_to_litter(p) = t1 * leafc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_leafc(p) - biofuelc_harvest(p) = t1 * leafc(p) * harvfrac(ivt(p)) - biofueln_harvest(p) = t1 * leafn(p) * harvfrac(ivt(p)) + leafc_to_biofuelc(p) = t1 * leafc(p) * harvfrac(ivt(p)) + leafn_to_biofueln(p) = t1 * leafn(p) * harvfrac(ivt(p)) ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" @@ -2500,7 +2493,11 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) - livestemc_to_litter(p) = t1 * livestemc(p) + cpool_to_livestemc(p) + ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of livestem C + ! and move this fration of leaf C to biofuel C, rather than move it to litter + livestemc_to_litter(p) = t1 * livestemc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_livestemc(p) + livestemc_to_biofuelc(p) = t1 * livestemc(p) * harvfrac(ivt(p)) + livestemn_to_biofueln(p) = t1 * livestemn(p) * harvfrac(ivt(p)) end if else t1 = dt * 2.0_r8 / (offset_counter(p) * offset_counter(p)) @@ -2874,6 +2871,10 @@ subroutine CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, fil cnveg_carbonflux_inst%grainc_to_food_patch(p) cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(p) = & cnveg_nitrogenflux_inst%grainn_to_food_patch(p) + cnveg_carbonflux_inst%biofuelc_to_cropprodc_patch(p) = & + cnveg_carbonflux_inst%leafc_to_biofuelc_patch(p)+cnveg_carbonflux_inst%livestemc_to_biofuelc_patch(p) + cnveg_nitrogenflux_inst%biofueln_to_cropprodn_patch(p) = & + cnveg_nitrogenflux_inst%leafn_to_biofueln_patch(p)+cnveg_nitrogenflux_inst%livestemn_to_biofueln_patch(p) end do call p2c (bounds, num_soilc, filter_soilc, & @@ -2883,6 +2884,14 @@ subroutine CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, fil call p2c (bounds, num_soilc, filter_soilc, & cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(bounds%begp:bounds%endp), & cnveg_nitrogenflux_inst%grainn_to_cropprodn_col(bounds%begc:bounds%endc)) + + call p2c (bounds, num_soilc, filter_soilc, & + cnveg_carbonflux_inst%biofuelc_to_cropprodc_patch(bounds%begp:bounds%endp), & + cnveg_carbonflux_inst%biofuelc_to_cropprodc_col(bounds%begc:bounds%endc)) + + call p2c (bounds, num_soilc, filter_soilc, & + cnveg_nitrogenflux_inst%biofueln_to_cropprodn_patch(bounds%begp:bounds%endp), & + cnveg_nitrogenflux_inst%biofueln_to_cropprodn_col(bounds%begc:bounds%endc)) end if ! No else clause: if use_grainproduct is false, then the grain*_to_cropprod fluxes @@ -2938,17 +2947,13 @@ subroutine CNLitterToColumn (bounds, num_soilc, filter_soilc, & leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Input: [real(r8) (:) ] leaf C litterfall (gC/m2/s) frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] live stem C litterfall (gC/m2/s) - grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] grain C to food (gC/m2/s) - - biofuelc_harvest => cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Input: [real(r8) (:) ] biofuel C (gC/m2/s) - + grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] grain C to food (gC/m2/s) phenology_c_to_litr_met_c => cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) phenology_c_to_litr_cel_c => cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) phenology_c_to_litr_lig_c => cnveg_carbonflux_inst%phenology_c_to_litr_lig_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter lignin pool (gC/m3/s) livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Input: [real(r8) (:) ] livestem N to litter (gN/m2/s) grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Input: [real(r8) (:) ] grain N to food (gN/m2/s) - biofueln_harvest => cnveg_nitrogenflux_inst%biofueln_harvest_patch , & ! Input: [real(r8) (:) ] biofuel N (gN/m2/s) leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Input: [real(r8) (:) ] leaf N litterfall (gN/m2/s) frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) phenology_n_to_litr_met_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_met_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gN/m3/s) @@ -3022,25 +3027,19 @@ subroutine CNLitterToColumn (bounds, num_soilc, filter_soilc, & if (.not. use_grainproduct) then ! grain litter carbon fluxes phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! grain litter nitrogen fluxes phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + grainn_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofueln_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + + grainn_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + grainn_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofueln_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + + grainn_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + grainn_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofueln_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) ! biofuel + + grainn_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) end if From 6b75fcb7ce6f76ac08d9f7253f78c684ee55f74c Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:29 -0700 Subject: [PATCH 0657/1973] add calculation for the new biofuelc_to_cropprodc flux --- src/biogeochem/CNCIsoFluxMod.F90 | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/biogeochem/CNCIsoFluxMod.F90 b/src/biogeochem/CNCIsoFluxMod.F90 index 8c79e50d33..8461d1ef54 100644 --- a/src/biogeochem/CNCIsoFluxMod.F90 +++ b/src/biogeochem/CNCIsoFluxMod.F90 @@ -404,12 +404,15 @@ subroutine CIsoFlux1(num_soilc, filter_soilc, num_soilp, filter_soilp, & iso_cnveg_cs%grainc_patch , cnveg_cs%grainc_patch, & num_soilp , filter_soilp, 1._r8, 0, isotope) - ! Y. Cheng call CIsoFluxCalc(& - iso_cnveg_cf%biofuelc_harvest_patch , cnveg_cf%biofuelc_harvest_patch, & - iso_cnveg_cs%grainc_patch , cnveg_cs%grainc_patch, & + iso_cnveg_cf%leafc_to_biofuelc_patch , cnveg_cf%leafc_to_biofuelc_patch, & + iso_cnveg_cs%leafc_patch , cnveg_cs%leafc_patch, & num_soilp , filter_soilp, 1._r8, 0, isotope) + call CIsoFluxCalc(& + iso_cnveg_cf%livestemc_to_biofuelc_patch , cnveg_cf%livestemc_to_biofuelc_patch, & + iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & + num_soilp , filter_soilp, 1._r8, 0, isotope) call CIsoFluxCalc(& iso_cnveg_cf%grainc_to_seed_patch , cnveg_cf%grainc_to_seed_patch, & @@ -470,6 +473,7 @@ subroutine CIsoFlux1(num_soilc, filter_soilc, num_soilp, filter_soilp, & do fp = 1,num_soilp p = filter_soilp(fp) iso_cnveg_cf%grainc_to_cropprodc_patch(p) = iso_cnveg_cf%grainc_to_food_patch(p) + iso_cnveg_cf%biofuelc_to_cropprodc_patch(p) = iso_cnveg_cf%leafc_to_biofuelc_patch(p)+iso_cnveg_cf%livestemc_to_biofuelc_patch(p) iso_cnveg_cf%grain_mr_patch(p) = iso_cnveg_cf%grain_xsmr_patch(p) + iso_cnveg_cf%grain_curmr_patch(p) end do endif @@ -1200,9 +1204,8 @@ subroutine CNCIsoLitterToColumn (num_soilc, filter_soilc, & !DML livestemc_to_litter => iso_cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] grainc_to_food => iso_cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] - - ! Y. Cheng - biofuelc_harvest => iso_cnveg_carbonflux_inst%biofuelc_harvest_patch , & ! Input: [real(r8) (:) ] + leafc_to_biofuelc => iso_cnveg_carbonflux_inst%leafc_to_biofuelc_patch , & ! Input: [real(r8) (:) ] + livestemc_to_biofuelc => iso_cnveg_carbonflux_inst%livestemc_to_biofuelc_patch , & ! Input: [real(r8) (:) ] !DML phenology_c_to_litr_met_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) phenology_c_to_litr_cel_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) @@ -1242,18 +1245,15 @@ subroutine CNCIsoLitterToColumn (num_soilc, filter_soilc, & + livestemc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & + livestemc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - ! Y. Cheng + if (.not. use_grainproduct) then ! grain litter carbon fluxes phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) & - + biofuelc_harvest(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) + + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) end if end if From dbad63fee5e109f091586f6aa1b716f6af5d58cf Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:32 -0700 Subject: [PATCH 0658/1973] add calculation for biofuel product --- src/biogeochem/CNDriverMod.F90 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 index abc18cdbfc..bca596477f 100644 --- a/src/biogeochem/CNDriverMod.F90 +++ b/src/biogeochem/CNDriverMod.F90 @@ -712,7 +712,8 @@ subroutine CNDriverNoLeaching(bounds, dwt_wood_product_gain_patch = cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(begp:endp), & wood_harvest_patch = cnveg_carbonflux_inst%wood_harvestc_patch(begp:endp), & dwt_crop_product_gain_patch = cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(begp:endp), & - grain_to_cropprod_patch = cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp)) + grain_to_cropprod_patch = cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp), & + biofuel_to_cropprod_patch = cnveg_carbonflux_inst%biofuelc_to_cropprodc_patch(begp:endp)) call t_stopf('CNWoodProducts') if (use_c13) then @@ -721,7 +722,8 @@ subroutine CNDriverNoLeaching(bounds, dwt_wood_product_gain_patch = c13_cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(begp:endp), & wood_harvest_patch = c13_cnveg_carbonflux_inst%wood_harvestc_patch(begp:endp), & dwt_crop_product_gain_patch = c13_cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(begp:endp), & - grain_to_cropprod_patch = c13_cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp)) + grain_to_cropprod_patch = c13_cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp), & + biofuel_to_cropprod_patch = c13_cnveg_carbonflux_inst%biofuelc_to_cropprodc_patch(begp:endp)) end if if (use_c14) then @@ -730,7 +732,8 @@ subroutine CNDriverNoLeaching(bounds, dwt_wood_product_gain_patch = c14_cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(begp:endp), & wood_harvest_patch = c14_cnveg_carbonflux_inst%wood_harvestc_patch(begp:endp), & dwt_crop_product_gain_patch = c14_cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(begp:endp), & - grain_to_cropprod_patch = c14_cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp)) + grain_to_cropprod_patch = c14_cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp), & + biofuel_to_cropprod_patch = c14_cnveg_carbonflux_inst%biofuelc_to_cropprodc_patch(begp:endp)) end if call n_products_inst%UpdateProducts(bounds, & @@ -738,7 +741,8 @@ subroutine CNDriverNoLeaching(bounds, dwt_wood_product_gain_patch = cnveg_nitrogenflux_inst%dwt_wood_productn_gain_patch(begp:endp), & wood_harvest_patch = cnveg_nitrogenflux_inst%wood_harvestn_patch(begp:endp), & dwt_crop_product_gain_patch = cnveg_nitrogenflux_inst%dwt_crop_productn_gain_patch(begp:endp), & - grain_to_cropprod_patch = cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(begp:endp)) + grain_to_cropprod_patch = cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(begp:endp), & + biofuel_to_cropprod_patch = cnveg_nitrogenflux_inst%biofueln_to_cropprodn_patch(begp:endp)) !-------------------------------------------- ! Calculate fire area and fluxes From 6582a3ebcd9de15fa9842e6c38463cef52cfc640 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:35 -0700 Subject: [PATCH 0659/1973] add calculation for biofuel product --- src/biogeochem/CNProductsMod.F90 | 74 ++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 0661c3b392..8c6134c445 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -34,6 +34,7 @@ module CNProductsMod ! States real(r8), pointer :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan + real(r8), pointer :: biofuelprod1_grc(:) ! (g[C or N]/m2) biofuel product pool, 1-year lifespan real(r8), pointer :: prod10_grc(:) ! (g[C or N]/m2) wood product pool, 10-year lifespan real(r8), pointer :: prod100_grc(:) ! (g[C or N]/m2) wood product pool, 100-year lifespan real(r8), pointer :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool @@ -49,9 +50,12 @@ module CNProductsMod real(r8), pointer :: hrv_deadstem_to_prod100_grc(:) ! (g[C or N]/m2/s) dead stem harvest to 100-year wood product pool real(r8), pointer :: grain_to_cropprod1_patch(:) ! (g[C or N]/m2/s) grain to 1-year crop product pool real(r8), pointer :: grain_to_cropprod1_grc(:) ! (g[C or N]/m2/s) grain to 1-year crop product pool + real(r8), pointer :: biofuel_to_cropprod1_patch(:) ! (g[C or N]/m2/s) biofuel to 1-year crop product pool + real(r8), pointer :: biofuel_to_cropprod1_grc(:) ! (g[C or N]/m2/s) biofuel to 1-year crop product pool ! Fluxes: losses real(r8), pointer :: cropprod1_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 1-yr grain product pool + real(r8), pointer :: biofuelprod1_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 1-yr biofuel product pool real(r8), pointer :: prod10_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 10-yr wood product pool real(r8), pointer :: prod100_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 100-yr wood product pool real(r8), pointer :: tot_woodprod_loss_grc(:) ! (g[C or N]/m2/s) decompomposition loss from all wood product pools @@ -123,6 +127,7 @@ subroutine InitAllocate(this, bounds) endg = bounds%endg allocate(this%cropprod1_grc(begg:endg)) ; this%cropprod1_grc(:) = nan + allocate(this%biofuelprod1_grc(begg:endg)) ; this%biofuelprod1_grc(:) = nan allocate(this%prod10_grc(begg:endg)) ; this%prod10_grc(:) = nan allocate(this%prod100_grc(begg:endg)) ; this%prod100_grc(:) = nan allocate(this%tot_woodprod_grc(begg:endg)) ; this%tot_woodprod_grc(:) = nan @@ -141,8 +146,11 @@ subroutine InitAllocate(this, bounds) allocate(this%grain_to_cropprod1_patch(begp:endp)) ; this%grain_to_cropprod1_patch(:) = nan allocate(this%grain_to_cropprod1_grc(begg:endg)) ; this%grain_to_cropprod1_grc(:) = nan + allocate(this%biofuel_to_cropprod1_patch(begp:endp)) ; this%biofuel_to_cropprod1_patch(:) = nan + allocate(this%biofuel_to_cropprod1_grc(begg:endg)) ; this%biofuel_to_cropprod1_grc(:) = nan allocate(this%cropprod1_loss_grc(begg:endg)) ; this%cropprod1_loss_grc(:) = nan + allocate(this%biofuelprod1_loss_grc(begg:endg)) ; this%biofuelprod1_loss_grc(:) = nan allocate(this%prod10_loss_grc(begg:endg)) ; this%prod10_loss_grc(:) = nan allocate(this%prod100_loss_grc(begg:endg)) ; this%prod100_loss_grc(:) = nan allocate(this%tot_woodprod_loss_grc(begg:endg)) ; this%tot_woodprod_loss_grc(:) = nan @@ -184,6 +192,14 @@ subroutine InitHistory(this, bounds) long_name = '1-yr grain product ' // this%species%get_species(), & ptr_gcell = this%cropprod1_grc, default=active_if_non_isotope) + this%biofuelprod1_grc(begg:endg) = spval + call hist_addfld1d( & + fname = this%species%hist_fname('BIOFUELPROD1'), & + units = 'g' // this%species%get_species() // '/m^2', & + avgflag = 'A', & + long_name = '1-yr biofuel product ' // this%species%get_species(), & + ptr_gcell = this%biofuelprod1_grc, default=active_if_non_isotope) + this%prod10_grc(begg:endg) = spval call hist_addfld1d( & fname = this%species%hist_fname('PROD10'), & @@ -248,6 +264,14 @@ subroutine InitHistory(this, bounds) long_name = 'loss from 1-yr grain product pool', & ptr_gcell = this%cropprod1_loss_grc, default=active_if_non_isotope) + this%biofuelprod1_loss_grc(begg:endg) = spval + call hist_addfld1d( & + fname = this%species%hist_fname('BIOFUELPROD1', suffix='_LOSS'), & + units = 'g' // this%species%get_species() // '/m^2/s', & + avgflag = 'A', & + long_name = 'loss from 1-yr biofuel product pool', & + ptr_gcell = this%biofuelprod1_loss_grc, default=active_if_non_isotope) + this%prod10_loss_grc(begg:endg) = spval call hist_addfld1d( & fname = this%species%hist_fname('PROD10', suffix='_LOSS'), & @@ -288,6 +312,7 @@ subroutine InitCold(this, bounds) do g = bounds%begg, bounds%endg this%cropprod1_grc(g) = 0._r8 + this%biofuelprod1_grc(g) = 0._r8 this%prod10_grc(g) = 0._r8 this%prod100_grc(g) = 0._r8 this%tot_woodprod_grc(g) = 0._r8 @@ -299,6 +324,7 @@ subroutine InitCold(this, bounds) this%hrv_deadstem_to_prod10_patch(p) = 0._r8 this%hrv_deadstem_to_prod100_patch(p) = 0._r8 this%grain_to_cropprod1_patch(p) = 0._r8 + this%biofuel_to_cropprod1_patch(p) = 0._r8 end do end subroutine InitCold @@ -359,6 +385,13 @@ subroutine Restart(this, bounds, ncid, flag, & xtype=ncd_double, dim1name='gridcell', & long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%cropprod1_grc) + + call restartvar(ncid=ncid, flag=flag, & + varname=this%species%rest_fname('biofuelprod1', suffix='_g'), & + xtype=ncd_double, dim1name='gridcell', & + long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%biofuelprod1_grc) + if (flag == 'read' .and. .not. readvar) then ! BACKWARDS_COMPATIBILITY(wjs, 2016-03-31) If the gridcell-level field isn't ! present, try to find a column-level field (which may be present on an older @@ -370,12 +403,23 @@ subroutine Restart(this, bounds, ncid, flag, & data_grc = this%cropprod1_grc, & readvar = readvar) + call set_grc_field_from_col_field( & + bounds = bounds, & + ncid = ncid, & + varname = this%species%rest_fname('biofuelprod1'), & + data_grc = this%biofuelprod1_grc, & + readvar = readvar) + ! If we still haven't found an appropriate field on the restart file, then set ! this field from the template, if provided if (.not. readvar .and. template_provided) then call set_missing_from_template(this%cropprod1_grc, & template_for_missing_fields%cropprod1_grc, & multiplier = template_multiplier) + + call set_missing_from_template(this%biofuelprod1_grc, & + template_for_missing_fields%biofuelprod1_grc, & + multiplier = template_multiplier) end if end if @@ -437,7 +481,8 @@ subroutine UpdateProducts(this, bounds, & dwt_wood_product_gain_patch, & wood_harvest_patch, & dwt_crop_product_gain_patch, & - grain_to_cropprod_patch) + grain_to_cropprod_patch, & + biofuel_to_cropprod_patch) ! ! !DESCRIPTION: ! Update all loss fluxes from wood and grain product pools, and update product pool @@ -462,6 +507,9 @@ subroutine UpdateProducts(this, bounds, & ! grain to crop product pool (g/m2/s) [patch] real(r8), intent(in) :: grain_to_cropprod_patch( bounds%begp: ) + + ! biofuel to crop product pool (g/m2/s) [patch] + real(r8), intent(in) :: biofuel_to_cropprod_patch( bounds%begp: ) ! ! !LOCAL VARIABLES: integer :: g ! indices @@ -475,6 +523,7 @@ subroutine UpdateProducts(this, bounds, & SHR_ASSERT_ALL_FL((ubound(wood_harvest_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dwt_crop_product_gain_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(grain_to_cropprod_patch) == (/bounds%endp/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(biofuel_to_cropprod_patch) == (/bounds%endp/)), sourcefile, __LINE__) call this%PartitionWoodFluxes(bounds, & num_soilp, filter_soilp, & @@ -484,7 +533,8 @@ subroutine UpdateProducts(this, bounds, & call this%PartitionGrainFluxes(bounds, & num_soilp, filter_soilp, & dwt_crop_product_gain_patch(bounds%begp:bounds%endp), & - grain_to_cropprod_patch(bounds%begp:bounds%endp)) + grain_to_cropprod_patch(bounds%begp:bounds%endp), & + biofuel_to_cropprod_patch(bounds%begp:bounds%endp)) ! calculate losses from product pools ! the following (1/s) rate constants result in ~90% loss of initial state over 1, 10 and 100 years, @@ -496,6 +546,7 @@ subroutine UpdateProducts(this, bounds, & do g = bounds%begg, bounds%endg ! calculate fluxes out of product pools (1/sec) this%cropprod1_loss_grc(g) = this%cropprod1_grc(g) * kprod1 + this%biofuelprod1_loss_grc(g) = this%biofuelprod1_grc(g) * kprod1 this%prod10_loss_grc(g) = this%prod10_grc(g) * kprod10 this%prod100_loss_grc(g) = this%prod100_grc(g) * kprod100 end do @@ -513,11 +564,13 @@ subroutine UpdateProducts(this, bounds, & ! fluxes into wood & grain product pools, from harvest this%cropprod1_grc(g) = this%cropprod1_grc(g) + this%grain_to_cropprod1_grc(g)*dt + this%biofuelprod1_grc(g) = this%biofuelprod1_grc(g) + this%biofuel_to_cropprod1_grc(g)*dt this%prod10_grc(g) = this%prod10_grc(g) + this%hrv_deadstem_to_prod10_grc(g)*dt this%prod100_grc(g) = this%prod100_grc(g) + this%hrv_deadstem_to_prod100_grc(g)*dt ! fluxes out of wood & grain product pools, from decomposition this%cropprod1_grc(g) = this%cropprod1_grc(g) - this%cropprod1_loss_grc(g)*dt + this%biofuelprod1_grc(g) = this%biofuelprod1_grc(g) - this%biofuelprod1_loss_grc(g)*dt this%prod10_grc(g) = this%prod10_grc(g) - this%prod10_loss_grc(g)*dt this%prod100_grc(g) = this%prod100_grc(g) - this%prod100_loss_grc(g)*dt @@ -632,7 +685,8 @@ end subroutine PartitionWoodFluxes subroutine PartitionGrainFluxes(this, bounds, & num_soilp, filter_soilp, & dwt_crop_product_gain_patch, & - grain_to_cropprod_patch) + grain_to_cropprod_patch, & + biofuel_to_cropprod_patch) ! ! !DESCRIPTION: ! Partition input grain fluxes into crop product pools @@ -657,6 +711,9 @@ subroutine PartitionGrainFluxes(this, bounds, & ! grain to crop product pool(s) (g/m2/s) [patch] real(r8) , intent(in) :: grain_to_cropprod_patch( bounds%begp: ) + + ! biofuel to crop product pool(s) (g/m2/s) [patch] + real(r8) , intent(in) :: biofuel_to_cropprod_patch( bounds%begp: ) ! ! !LOCAL VARIABLES: integer :: fp @@ -673,6 +730,7 @@ subroutine PartitionGrainFluxes(this, bounds, & ! For now all crop product is put in the 1-year crop product pool this%grain_to_cropprod1_patch(p) = grain_to_cropprod_patch(p) + this%biofuel_to_cropprod1_patch(p) = biofuel_to_cropprod_patch(p) end do call p2g(bounds, & @@ -682,6 +740,13 @@ subroutine PartitionGrainFluxes(this, bounds, & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') + + call p2g(bounds, & + this%biofuel_to_cropprod1_patch(bounds%begp:bounds%endp), & + this%biofuel_to_cropprod1_grc(bounds%begg:bounds%endg), & + p2c_scale_type = 'unity', & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') ! Determine gains from dynamic landcover do g = bounds%begg, bounds%endg @@ -735,7 +800,8 @@ subroutine ComputeSummaryVars(this, bounds) this%product_loss_grc(g) = & this%cropprod1_loss_grc(g) + & this%prod10_loss_grc(g) + & - this%prod100_loss_grc(g) + this%prod100_loss_grc(g) + & + this%biofuelprod1_loss_grc(g) this%dwt_woodprod_gain_grc(g) = & this%dwt_prod100_gain_grc(g) + & From c4996447764b9e3f6ccc44a1b25ca54b9401f118 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:38 -0700 Subject: [PATCH 0660/1973] active pft ID for swithchgrass and miscanthus --- src/biogeochem/CNVegStructUpdateMod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index b3556a367e..6f5b19476e 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -41,7 +41,6 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & use pftconMod , only : ntmp_corn, nirrig_tmp_corn use pftconMod , only : ntrp_corn, nirrig_trp_corn use pftconMod , only : nsugarcane, nirrig_sugarcane - ! Y. Cheng use pftconMod , only : nmiscanthus, nirrig_miscanthus, nswitchgrass, nirrig_switchgrass use pftconMod , only : pftcon @@ -233,7 +232,6 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & if (tlai(p) >= laimx(ivt(p))) peaklai(p) = 1 ! used in CNAllocation - ! Y. Cheng, add switchgrass and Miscanthus if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane .or. & From 6ab17385b0cee0a3cf84e7d9ca28984b2d8749ab Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:41 -0700 Subject: [PATCH 0661/1973] update leaf N and livestem N --- src/biogeochem/CNCStateUpdate1Mod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CNCStateUpdate1Mod.F90 b/src/biogeochem/CNCStateUpdate1Mod.F90 index 0e4eb08fe1..628ad6ac43 100644 --- a/src/biogeochem/CNCStateUpdate1Mod.F90 +++ b/src/biogeochem/CNCStateUpdate1Mod.F90 @@ -171,6 +171,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) + harvfrac => pftcon%harvfrac , & ! Input: cut fraction for harvest (-) cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step @@ -274,10 +275,8 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & ! phenology: litterfall fluxes cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_litter_patch(p)*dt + cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_biofuelc_patch(p)*dt cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) - cf_veg%frootc_to_litter_patch(p)*dt - - - ! livewood turnover fluxes if (woody(ivt(p)) == 1._r8) then @@ -288,6 +287,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & end if if (ivt(p) >= npcropmin) then ! skip 2 generic crops cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_litter_patch(p)*dt + cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_biofuelc_patch(p)*dt cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) & - (cf_veg%grainc_to_food_patch(p) + cf_veg%grainc_to_seed_patch(p))*dt cs_veg%cropseedc_deficit_patch(p) = cs_veg%cropseedc_deficit_patch(p) & From 8e91a2504323286d9aede28348b89983d1dda3c9 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:45 -0700 Subject: [PATCH 0662/1973] update leaf N and livestem N --- src/biogeochem/CNNStateUpdate1Mod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/biogeochem/CNNStateUpdate1Mod.F90 b/src/biogeochem/CNNStateUpdate1Mod.F90 index 996426246a..8c6c0c2968 100644 --- a/src/biogeochem/CNNStateUpdate1Mod.F90 +++ b/src/biogeochem/CNNStateUpdate1Mod.F90 @@ -175,6 +175,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & ! phenology: litterfall and retranslocation fluxes ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_litter_patch(p)*dt + ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_biofueln_patch(p)*dt ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - nf_veg%frootn_to_litter_patch(p)*dt ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_retransn_patch(p)*dt ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%leafn_to_retransn_patch(p)*dt @@ -194,6 +195,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - nf_veg%frootn_to_retransn_patch(p)*dt ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%frootn_to_retransn_patch(p)*dt ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_litter_patch(p)*dt + ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_biofueln_patch(p)*dt ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_retransn_patch(p)*dt ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%livestemn_to_retransn_patch(p)*dt ns_veg%grainn_patch(p) = ns_veg%grainn_patch(p) & From 9825116fe5cc298c64e0e300f30ac099c42cc841 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 20:55:49 -0700 Subject: [PATCH 0663/1973] update CN balance check to include biofuel product pool --- src/biogeochem/CNBalanceCheckMod.F90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index b9a5355d46..4f78fc6ac7 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -142,6 +142,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & col_endcb => this%endcb_col , & ! Output: [real(r8) (:) ] (gC/m2) carbon mass, end of time step wood_harvestc => cnveg_carbonflux_inst%wood_harvestc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) wood harvest (to product pools) grainc_to_cropprodc => cnveg_carbonflux_inst%grainc_to_cropprodc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) grain C to 1-year crop product pool + biofuelc_to_cropprodc => cnveg_carbonflux_inst%biofuelc_to_cropprodc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) biofuel C to 1-year crop product pool gpp => cnveg_carbonflux_inst%gpp_col , & ! Input: [real(r8) (:) ] (gC/m2/s) gross primary production er => cnveg_carbonflux_inst%er_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic col_fire_closs => cnveg_carbonflux_inst%fire_closs_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total column-level fire C loss @@ -176,7 +177,8 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! after the dwt term has already been taken out.) col_coutputs = col_coutputs + & wood_harvestc(c) + & - grainc_to_cropprodc(c) + grainc_to_cropprodc(c) + & + biofuelc_to_cropprodc(c) ! subtract leaching flux col_coutputs = col_coutputs - som_c_leached(c) @@ -213,6 +215,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*)'col_hrv_xsmrpool_to_atm = ',col_hrv_xsmrpool_to_atm(c)*dt write(iulog,*)'wood_harvestc = ',wood_harvestc(c)*dt write(iulog,*)'grainc_to_cropprodc = ',grainc_to_cropprodc(c)*dt + write(iulog,*)'biofuelc_to_cropprodc = ',biofuelc_to_cropprodc(c)*dt write(iulog,*)'-1*som_c_leached = ',som_c_leached(c)*dt call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -269,7 +272,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & col_fire_nloss => cnveg_nitrogenflux_inst%fire_nloss_col , & ! Input: [real(r8) (:) ] (gN/m2/s) total column-level fire N loss wood_harvestn => cnveg_nitrogenflux_inst%wood_harvestn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) wood harvest (to product pools) grainn_to_cropprodn => cnveg_nitrogenflux_inst%grainn_to_cropprodn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) grain N to 1-year crop product pool - + biofueln_to_cropprodn => cnveg_nitrogenflux_inst%biofueln_to_cropprodn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) biofuel N to 1-year crop product pool totcoln => cnveg_nitrogenstate_inst%totn_col & ! Input: [real(r8) (:) ] (gN/m2) total column nitrogen, incl veg ) @@ -304,7 +307,8 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! after the dwt term has already been taken out.) col_noutputs(c) = col_noutputs(c) + & wood_harvestn(c) + & - grainn_to_cropprodn(c) + grainn_to_cropprodn(c) + & + biofueln_to_cropprodn(c) if (.not. use_nitrif_denitrif) then col_noutputs(c) = col_noutputs(c) + sminn_leached(c) From 39bdf9b5820835800e5492fe43dd77a1f481d314 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 23:34:30 -0700 Subject: [PATCH 0664/1973] cut a certain fraction of crop aboveground biomass during offset period --- src/biogeochem/CNPhenologyMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 0439af76d4..1b62a3244a 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2411,7 +2411,6 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - ! Y. Cheng, add a new cut fraction for harvest parameter for bioenergy crops (miscanthus and switchgrass) harvfrac => pftcon%harvfrac , & ! Input: cut fraction for harvest (-) lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) From d2aad1fe43aa7339dc60379d9243cf42f78031df Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 15 Mar 2020 23:42:06 -0700 Subject: [PATCH 0665/1973] add a parameter for cutting a certain fraction of crop aboveground biomass at harvest --- src/main/pftconMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 4e5e60b3bb..a7237531d9 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -661,7 +661,6 @@ subroutine InitRead(this) call ncd_io('leafcn', this%leafcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - ! Y. Cheng, harvest fraction for crops during offset period call ncd_io('harvfrac', this%harvfrac, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) From 5893d31edf080cfdabb108f3c8e159990cf3be42 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 09:11:54 -0600 Subject: [PATCH 0666/1973] Add nuopc test to expected fails list https://github.com/ESCOMP/CTSM/pull/939 should fix this. --- cime_config/testdefs/ExpectedTestFails.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index d12defc385..8272e9d30a 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -44,6 +44,13 @@ + + + PEND + #943 + + + From 3d08f6bdbb3a7d6d81d5c02885df5f3b5cf508b5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 09:18:00 -0600 Subject: [PATCH 0667/1973] Point to cime tag The only difference from the previously pointed to hash is the update to the cime ChangeLog. --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index f20cf0c66b..493f13ad2f 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -hash = 4f1880756a66ff12d304937d3c166d451ea50cf9 +tag = cime5.8.17 externals = ../Externals_cime.cfg required = True From 6391110b1eb151d7efed81a58c101150507a3a2b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 09:24:53 -0600 Subject: [PATCH 0668/1973] Update ChangeLog --- doc/ChangeLog | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 107 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index cf7d461530..de3441808b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,110 @@ =============================================================== +Tag name: ctsm1.0.dev085 +Originator(s): sacks (Bill Sacks) +Date: Mon Mar 16 09:19:57 MDT 2020 +One-line Summary: Update cime + +Purpose of changes +------------------ + +Update to latest version of cime master + +Bugs fixed or introduced +------------------------ + +Known bugs introduced in this tag (include github issue ID): +- https://github.com/ESCOMP/CTSM/issues/943 - NUOPC tests will fail in ctsm1.0.dev085 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- NUOPC cases will fail from a standalone checkout + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + +Two test failures: + + PEND SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default SHAREDLIB_BUILD + I have added this to the expected fails list for now + FAIL SMS_P720x1_Ln6.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart BASELINE ctsm1.0.dev084: ERROR BFAIL baseline directory '/glade/p/cgd/tss/ctsm_baselines/ctsm1.0.dev084/SMS_P720x1_Ln6.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart' does not exist + This test was added in the previous tag, but apparently wasn't run from there + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +cime: branch_tags/cime5.8.15_a01 -> cime5.8.17 + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev084 Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) Date: Wed Feb 19 15:05:03 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index c59c6a2359..0dcf0c484c 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev085 sacks 03/16/2020 Update cime ctsm1.0.dev084 negins 02/19/2020 Bounds assertion for C isotopes when threading is on ctsm1.0.dev083 negins 02/06/2020 Some BFB Fixes: Resolve issues #683, # 874, #878, # 885, # 745, #838 ctsm1.0.dev082 oleson 02/01/2020 Rename variables to avoid confusion; fix QSNOEVAP diagnostic From 7bcd30df8361990f520b97e57a6e6872ab5114b6 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 09:26:03 -0600 Subject: [PATCH 0669/1973] Add a note to ChangeLog --- doc/ChangeLog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index de3441808b..61b4c6ef2d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -80,13 +80,17 @@ CTSM testing: cheyenne ---- ok izumi ------- pass -Two test failures: + Two test failures: PEND SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default SHAREDLIB_BUILD I have added this to the expected fails list for now FAIL SMS_P720x1_Ln6.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart BASELINE ctsm1.0.dev084: ERROR BFAIL baseline directory '/glade/p/cgd/tss/ctsm_baselines/ctsm1.0.dev084/SMS_P720x1_Ln6.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart' does not exist This test was added in the previous tag, but apparently wasn't run from there + Note: I did testing using cime hash + 4f1880756a66ff12d304937d3c166d451ea50cf9, then updated to the tag + (cime5.8.17). The two are identical except for the cime ChangeLog. + If the tag used for baseline comparisons was NOT the previous tag, note that here: From 757bb684857188e3b9779d92e5c58520f3b116fb Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 10:19:09 -0600 Subject: [PATCH 0670/1973] Update cmeps version @mvertens says this is needed along with the recent bug fix --- Externals_cime.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 63c73adb96..4751386a44 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,5 +1,5 @@ [cmeps] -hash = e0bfc6bdf2e1069e12301380fc1f624f0b33225dhash +hash = 253f612acae07b2b1dc73c84f1bb30b8e1b86ddd protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ From 302a2c3e5f394e87b88072e3f79cebe56d46591b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 10:36:48 -0600 Subject: [PATCH 0671/1973] Remove nuopc test from ExpectedFails list We expect this to work now. Moreover, I am going to replace that test with a different test. --- cime_config/testdefs/ExpectedTestFails.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 8272e9d30a..d12defc385 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -44,13 +44,6 @@ - - - PEND - #943 - - - From 9ce8fcb3230102eaba769489e95386ee3499d123 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 10:56:08 -0600 Subject: [PATCH 0672/1973] Remove compsets added on this branch For these reasons (in addition to the duplication of the two blocks): 1. It looks like you don't actually reference them in any tests 2. The IHistClm50SpRsGs alias incorrectly produces a BGC compset 3. If you truly want a RsGs compset, there are others now available --- cime_config/config_compsets.xml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 7ca17cf1cf..50b82db54c 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -53,26 +53,6 @@ 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - IHistClm50BgcRsGs - HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV - - - IHistClm50SpRsGs - HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV - - - - - IHistClm50BgcRsGs - HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV - - - IHistClm50SpRsGs - HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV - - I2000Clm50SpRsGs From a6bc8f8dfb86ec66faecf32238266bdd079da8d5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 10:59:39 -0600 Subject: [PATCH 0673/1973] Change I1Pt compsets to have Rs in their name Since they were changed to use SROF, they should explicitly have this in their names Also fix a typo in testlist_clm_nuopc.xml --- cime_config/config_compsets.xml | 4 ++-- cime_config/testdefs/testlist_clm.xml | 22 ++++++++++----------- cime_config/testdefs/testlist_clm_nuopc.xml | 2 -- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 50b82db54c..bf0cb94221 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -37,12 +37,12 @@ - I1PtClm50SpGs + I1PtClm50SpRsGs 2000_DATM%1PT_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV - I1PtClm45SpGs + I1PtClm45SpRsGs 2000_DATM%1PT_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 84e0145caf..2325e11bcc 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -842,7 +842,7 @@ - + @@ -876,7 +876,7 @@ - + @@ -884,7 +884,7 @@ - + @@ -892,7 +892,7 @@ - + @@ -1125,7 +1125,7 @@ - + @@ -1133,7 +1133,7 @@ - + @@ -1141,7 +1141,7 @@ - + @@ -1234,7 +1234,7 @@ - + @@ -1243,7 +1243,7 @@ - + @@ -1305,7 +1305,7 @@ - + @@ -1886,7 +1886,7 @@ - + diff --git a/cime_config/testdefs/testlist_clm_nuopc.xml b/cime_config/testdefs/testlist_clm_nuopc.xml index 0578ecd5f4..09b1e377c2 100644 --- a/cime_config/testdefs/testlist_clm_nuopc.xml +++ b/cime_config/testdefs/testlist_clm_nuopc.xml @@ -1,5 +1,3 @@ -PET_P36x1_D_Vnuopc.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default - From 24b13b4e0569f6cc7892219b0906c16c48bec73c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 11:10:48 -0600 Subject: [PATCH 0674/1973] Remove I2000Clm50BgcCruRsGs compset that was added on this branch This was just being used in one test in testlist_clm_nuopc, but this test (which used the camdenNJ grid) is one we wanted to drop anyway: see https://github.com/ESCOMP/CTSM/issues/808 --- cime_config/config_compsets.xml | 5 ----- cime_config/testdefs/testlist_clm_nuopc.xml | 8 -------- 2 files changed, 13 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index bf0cb94221..070afa5422 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -160,11 +160,6 @@ 2000_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV - - I2000Clm50BgcCruRsGs - 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV - - I2000Clm50BgcCruGs 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_clm_nuopc.xml b/cime_config/testdefs/testlist_clm_nuopc.xml index 09b1e377c2..fe8f121f4a 100644 --- a/cime_config/testdefs/testlist_clm_nuopc.xml +++ b/cime_config/testdefs/testlist_clm_nuopc.xml @@ -8,14 +8,6 @@ - - - - - - - - From d24c6f6222f089b47882c65deaff4612932a00d5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 11:13:53 -0600 Subject: [PATCH 0675/1973] Fix typo in comment --- cime_config/config_compsets.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 070afa5422..646cb9f7e5 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -331,7 +331,7 @@ 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - + I2000Clm45FatesRsGs 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_SROF_SGLC_SWAV From b2e4b1bdc8aefbfcbab6bedf717611c4bd3f80de Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 11:59:52 -0600 Subject: [PATCH 0676/1973] Change nuopc test to use mosart rather than srof This will work once we point to the new version of mosart that includes a nuopc cap. --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 2325e11bcc..201a9dd5f8 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1896,7 +1896,7 @@ - + From 05e4636cbd19b6aeb556054d5c9e84aca8640442 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 12:22:34 -0600 Subject: [PATCH 0677/1973] Add a compset for RTM testing I'm planning to use this compset in the RTM test suite for the nuopc test of RTM. I want a BGC-CROP test in order to exercise any irrigation-related fluxes. --- cime_config/config_compsets.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 646cb9f7e5..19528a4e9f 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -76,6 +76,12 @@ 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV + + + I2000Clm50BgcCropRtmGs + 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV + + I2000Clm50BgcCrop 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV From 3f496b26a4625d419f9b89615091a81afa776ccf Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 14:17:14 -0600 Subject: [PATCH 0678/1973] Point to updated mosart and rtm For rtm, this includes the NUOPC cap. For mosart, this has fixes to the NUOPC cap. --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 493f13ad2f..8f7908623b 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -16,14 +16,14 @@ required = True local_path = components/rtm protocol = git repo_url = https://github.com/ESCOMP/rtm -tag = rtm1_0_70 +tag = rtm1_0_71 required = True [mosart] local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/mosart -tag = mosart1_0_35 +tag = mosart1_0_36 required = True [cime] From ce983bac0aa20facd01ef77d006086111118cd6e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 15:49:21 -0600 Subject: [PATCH 0679/1973] Fix restart routine for new bioenergy pool --- src/biogeochem/CNProductsMod.F90 | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 8c6134c445..dee95a41eb 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -385,13 +385,6 @@ subroutine Restart(this, bounds, ncid, flag, & xtype=ncd_double, dim1name='gridcell', & long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%cropprod1_grc) - - call restartvar(ncid=ncid, flag=flag, & - varname=this%species%rest_fname('biofuelprod1', suffix='_g'), & - xtype=ncd_double, dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%biofuelprod1_grc) - if (flag == 'read' .and. .not. readvar) then ! BACKWARDS_COMPATIBILITY(wjs, 2016-03-31) If the gridcell-level field isn't ! present, try to find a column-level field (which may be present on an older @@ -403,26 +396,26 @@ subroutine Restart(this, bounds, ncid, flag, & data_grc = this%cropprod1_grc, & readvar = readvar) - call set_grc_field_from_col_field( & - bounds = bounds, & - ncid = ncid, & - varname = this%species%rest_fname('biofuelprod1'), & - data_grc = this%biofuelprod1_grc, & - readvar = readvar) - ! If we still haven't found an appropriate field on the restart file, then set ! this field from the template, if provided if (.not. readvar .and. template_provided) then call set_missing_from_template(this%cropprod1_grc, & template_for_missing_fields%cropprod1_grc, & multiplier = template_multiplier) - - call set_missing_from_template(this%biofuelprod1_grc, & - template_for_missing_fields%biofuelprod1_grc, & - multiplier = template_multiplier) end if end if + call restartvar(ncid=ncid, flag=flag, & + varname=this%species%rest_fname('biofuelprod1', suffix='_g'), & + xtype=ncd_double, dim1name='gridcell', & + long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%biofuelprod1_grc) + if (.not. readvar .and. template_provided) then + call set_missing_from_template(this%biofuelprod1_grc, & + template_for_missing_fields%biofuelprod1_grc, & + multiplier = template_multiplier) + end if + call restartvar(ncid=ncid, flag=flag, & varname=this%species%rest_fname('prod10', suffix='_g'), & xtype=ncd_double, dim1name='gridcell', & From 3b3a330d74ad3344c01ad81cf1fd11b171366821 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 16:06:33 -0600 Subject: [PATCH 0680/1973] Whitespace cleanup --- src/biogeochem/CNProductsMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index dee95a41eb..bcdfd95618 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -192,7 +192,7 @@ subroutine InitHistory(this, bounds) long_name = '1-yr grain product ' // this%species%get_species(), & ptr_gcell = this%cropprod1_grc, default=active_if_non_isotope) - this%biofuelprod1_grc(begg:endg) = spval + this%biofuelprod1_grc(begg:endg) = spval call hist_addfld1d( & fname = this%species%hist_fname('BIOFUELPROD1'), & units = 'g' // this%species%get_species() // '/m^2', & @@ -264,7 +264,7 @@ subroutine InitHistory(this, bounds) long_name = 'loss from 1-yr grain product pool', & ptr_gcell = this%cropprod1_loss_grc, default=active_if_non_isotope) - this%biofuelprod1_loss_grc(begg:endg) = spval + this%biofuelprod1_loss_grc(begg:endg) = spval call hist_addfld1d( & fname = this%species%hist_fname('BIOFUELPROD1', suffix='_LOSS'), & units = 'g' // this%species%get_species() // '/m^2/s', & From c45206ab30a09a5b0e831a6f3617afc1f6462e7d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 16:16:56 -0600 Subject: [PATCH 0681/1973] Remove unnecessary variable from associate --- src/biogeochem/CNCStateUpdate1Mod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/biogeochem/CNCStateUpdate1Mod.F90 b/src/biogeochem/CNCStateUpdate1Mod.F90 index 628ad6ac43..47794240a5 100644 --- a/src/biogeochem/CNCStateUpdate1Mod.F90 +++ b/src/biogeochem/CNCStateUpdate1Mod.F90 @@ -171,7 +171,6 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - harvfrac => pftcon%harvfrac , & ! Input: cut fraction for harvest (-) cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step From 78da215cb2fd55be45b33c36c5843b76aded54d3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 16 Mar 2020 16:31:48 -0600 Subject: [PATCH 0682/1973] Bioenergy fluxes to product pools apply regardless of use_grainproduct --- src/biogeochem/CNCIsoFluxMod.F90 | 11 +++++-- src/biogeochem/CNPhenologyMod.F90 | 53 ++++++++++++++++--------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/biogeochem/CNCIsoFluxMod.F90 b/src/biogeochem/CNCIsoFluxMod.F90 index 8461d1ef54..cfa280f678 100644 --- a/src/biogeochem/CNCIsoFluxMod.F90 +++ b/src/biogeochem/CNCIsoFluxMod.F90 @@ -404,12 +404,12 @@ subroutine CIsoFlux1(num_soilc, filter_soilc, num_soilp, filter_soilp, & iso_cnveg_cs%grainc_patch , cnveg_cs%grainc_patch, & num_soilp , filter_soilp, 1._r8, 0, isotope) - call CIsoFluxCalc(& + call CIsoFluxCalc(& iso_cnveg_cf%leafc_to_biofuelc_patch , cnveg_cf%leafc_to_biofuelc_patch, & iso_cnveg_cs%leafc_patch , cnveg_cs%leafc_patch, & num_soilp , filter_soilp, 1._r8, 0, isotope) - call CIsoFluxCalc(& + call CIsoFluxCalc(& iso_cnveg_cf%livestemc_to_biofuelc_patch , cnveg_cf%livestemc_to_biofuelc_patch, & iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & num_soilp , filter_soilp, 1._r8, 0, isotope) @@ -469,11 +469,16 @@ subroutine CIsoFlux1(num_soilc, filter_soilc, num_soilp, filter_soilp, & iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & num_soilp , filter_soilp, 1._r8, 0, isotope) + do fp = 1,num_soilp + p = filter_soilp(fp) + iso_cnveg_cf%biofuelc_to_cropprodc_patch(p) = iso_cnveg_cf%leafc_to_biofuelc_patch(p) + & + iso_cnveg_cf%livestemc_to_biofuelc_patch(p) + end do + if (use_grainproduct) then do fp = 1,num_soilp p = filter_soilp(fp) iso_cnveg_cf%grainc_to_cropprodc_patch(p) = iso_cnveg_cf%grainc_to_food_patch(p) - iso_cnveg_cf%biofuelc_to_cropprodc_patch(p) = iso_cnveg_cf%leafc_to_biofuelc_patch(p)+iso_cnveg_cf%livestemc_to_biofuelc_patch(p) iso_cnveg_cf%grain_mr_patch(p) = iso_cnveg_cf%grain_xsmr_patch(p) + iso_cnveg_cf%grain_curmr_patch(p) end do endif diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 1b62a3244a..5c9c132d9e 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -328,7 +328,7 @@ subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & call CNLivewoodTurnover(num_soilp, filter_soilp, & cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - call CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & + call CNCropHarvestToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) ! gather all patch-level litterfall fluxes to the column for litter C and N inputs @@ -2833,12 +2833,12 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & end subroutine CNLivewoodTurnover !----------------------------------------------------------------------- - subroutine CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & + subroutine CNCropHarvestToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) ! ! !DESCRIPTION: - ! If using prognostic crop along with use_grainproduct, then move the patch-level - ! grain-to-food fluxes into the column-level grain-to-cropprod fluxes + ! If using prognostic crop, then move any necessary harvested amounts into fluxes + ! destined for the product pools. ! ! !USES: use clm_varctl , only : use_crop @@ -2857,33 +2857,18 @@ subroutine CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, fil ! !LOCAL VARIABLES: integer :: fp, p - character(len=*), parameter :: subname = 'CNGrainToProductPools' + character(len=*), parameter :: subname = 'CNCropHarvestToProductPools' !----------------------------------------------------------------------- - ! Explicitly checking use_crop is probably unnecessary here (because presumably - ! use_grainproduct is only true if use_crop is true), but we do it for safety because - ! the grain*_to_food_patch fluxes are not set if use_crop is false. - if (use_crop .and. use_grainproduct) then + if (use_crop) then do fp = 1, num_soilp p = filter_soilp(fp) - cnveg_carbonflux_inst%grainc_to_cropprodc_patch(p) = & - cnveg_carbonflux_inst%grainc_to_food_patch(p) - cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(p) = & - cnveg_nitrogenflux_inst%grainn_to_food_patch(p) cnveg_carbonflux_inst%biofuelc_to_cropprodc_patch(p) = & cnveg_carbonflux_inst%leafc_to_biofuelc_patch(p)+cnveg_carbonflux_inst%livestemc_to_biofuelc_patch(p) cnveg_nitrogenflux_inst%biofueln_to_cropprodn_patch(p) = & cnveg_nitrogenflux_inst%leafn_to_biofueln_patch(p)+cnveg_nitrogenflux_inst%livestemn_to_biofueln_patch(p) end do - call p2c (bounds, num_soilc, filter_soilc, & - cnveg_carbonflux_inst%grainc_to_cropprodc_patch(bounds%begp:bounds%endp), & - cnveg_carbonflux_inst%grainc_to_cropprodc_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_soilc, filter_soilc, & - cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(bounds%begp:bounds%endp), & - cnveg_nitrogenflux_inst%grainn_to_cropprodn_col(bounds%begc:bounds%endc)) - call p2c (bounds, num_soilc, filter_soilc, & cnveg_carbonflux_inst%biofuelc_to_cropprodc_patch(bounds%begp:bounds%endp), & cnveg_carbonflux_inst%biofuelc_to_cropprodc_col(bounds%begc:bounds%endc)) @@ -2891,12 +2876,30 @@ subroutine CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, fil call p2c (bounds, num_soilc, filter_soilc, & cnveg_nitrogenflux_inst%biofueln_to_cropprodn_patch(bounds%begp:bounds%endp), & cnveg_nitrogenflux_inst%biofueln_to_cropprodn_col(bounds%begc:bounds%endc)) - end if - ! No else clause: if use_grainproduct is false, then the grain*_to_cropprod fluxes - ! will remain at their initial value (0). + if (use_grainproduct) then + do fp = 1, num_soilp + p = filter_soilp(fp) + cnveg_carbonflux_inst%grainc_to_cropprodc_patch(p) = & + cnveg_carbonflux_inst%grainc_to_food_patch(p) + cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(p) = & + cnveg_nitrogenflux_inst%grainn_to_food_patch(p) + end do + + call p2c (bounds, num_soilc, filter_soilc, & + cnveg_carbonflux_inst%grainc_to_cropprodc_patch(bounds%begp:bounds%endp), & + cnveg_carbonflux_inst%grainc_to_cropprodc_col(bounds%begc:bounds%endc)) + + call p2c (bounds, num_soilc, filter_soilc, & + cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(bounds%begp:bounds%endp), & + cnveg_nitrogenflux_inst%grainn_to_cropprodn_col(bounds%begc:bounds%endc)) + end if + ! No else clause: if use_grainproduct is false, then the grain*_to_cropprod fluxes + ! will remain at their initial value (0). + + end if - end subroutine CNGrainToProductPools + end subroutine CNCropHarvestToProductPools !----------------------------------------------------------------------- subroutine CNLitterToColumn (bounds, num_soilc, filter_soilc, & From 5beb9b1cfa7f4a6faad87ece106d4f507bfde475 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 17 Mar 2020 14:30:41 -0600 Subject: [PATCH 0683/1973] Fix some indentation --- src/biogeochem/CNPhenologyMod.F90 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 5c9c132d9e..af0908dce9 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2474,11 +2474,11 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of leaf C - ! and move this fration of leaf C to biofuel C, rather than move it to litter - leafc_to_litter(p) = t1 * leafc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_leafc(p) - leafc_to_biofuelc(p) = t1 * leafc(p) * harvfrac(ivt(p)) - leafn_to_biofueln(p) = t1 * leafn(p) * harvfrac(ivt(p)) - + ! and move this fration of leaf C to biofuel C, rather than move it to litter + leafc_to_litter(p) = t1 * leafc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_leafc(p) + leafc_to_biofuelc(p) = t1 * leafc(p) * harvfrac(ivt(p)) + leafn_to_biofueln(p) = t1 * leafn(p) * harvfrac(ivt(p)) + ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" if (ivt(p) >= npcropmin) then @@ -2489,14 +2489,14 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & grainc_to_seed(p) = t1 * min(-cropseedc_deficit(p), grainc(p)) grainn_to_seed(p) = t1 * min(-cropseedn_deficit(p), grainn(p)) ! Send the remaining grain to the food product pool - grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) + grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) - ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of livestem C - ! and move this fration of leaf C to biofuel C, rather than move it to litter + ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of livestem C + ! and move this fration of leaf C to biofuel C, rather than move it to litter livestemc_to_litter(p) = t1 * livestemc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_livestemc(p) livestemc_to_biofuelc(p) = t1 * livestemc(p) * harvfrac(ivt(p)) - livestemn_to_biofueln(p) = t1 * livestemn(p) * harvfrac(ivt(p)) + livestemn_to_biofueln(p) = t1 * livestemn(p) * harvfrac(ivt(p)) end if else t1 = dt * 2.0_r8 / (offset_counter(p) * offset_counter(p)) From 38d98c3ee1a3ffea0b9fd11c7206c5e54200717c Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 19 Mar 2020 12:20:51 -0600 Subject: [PATCH 0684/1973] Simply inlined SetMatrix_Snow (all variations) into one -- bfb --- src/biogeophys/SoilTemperatureMod.F90 | 130 +++++++++++++++++++++++--- 1 file changed, 119 insertions(+), 11 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 53534d831a..63d41ea518 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -3163,6 +3163,7 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall + use column_varcon , only : icol_road_perv, icol_road_imperv use clm_varpar , only : nlevsno, nlevgrnd, nlevurb ! ! !ARGUMENTS: @@ -3176,6 +3177,12 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) real(r8), intent(out) :: bmatrix_snow(bounds%begc: , 1:, -nlevsno: ) ! matrix enteries + ! + ! !LOCAL VARIABLES: + integer :: j,c,l ! indices + integer :: fc ! lake filtered column indices + real(r8) :: dzm ! used in computing tridiagonal matrix + real(r8) :: dzp ! used in computing tridiagonal matrix !----------------------------------------------------------------------- ! Enforce expected array sizes @@ -3187,23 +3194,124 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & associate(& begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index + endc => bounds%endc , & ! Input: [integer ] ending column index + z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) ) ! Initialize bmatrix_snow(begc:endc, :, :) = 0.0_r8 - call SetMatrix_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow( begc:endc, 1:, -nlevsno: )) + ! call SetMatrix_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & + ! dhsdT( begc:endc ), & + ! tk( begc:endc, -nlevsno+1: ), & + ! fact( begc:endc, -nlevsno+1: ), & + ! bmatrix_snow( begc:endc, 1:, -nlevsno: )) + + ! call SetMatrix_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & + ! dhsdT( begc:endc ), & + ! tk( begc:endc, -nlevsno+1: ), & + ! fact( begc:endc, -nlevsno+1: ), & + ! bmatrix_snow( begc:endc, 1:, -nlevsno: )) + + !SNOW + ! snow non-urban columns + ! call SetMatrix_SnowUrbanNonRoad + ! urban non-road columns --------------------------------------------------------- + ! + do j = -nlevsno+1,0 + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (lun%urbpoi(l)) then + if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof)) then + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + bmatrix_snow(c,4,j-1) = 0._r8 + bmatrix_snow(c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + if ( j /= 0) then + bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + end if + else if (j <= nlevurb-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + if (j /= 0) then + bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + end if + end if + end if + end if + end if + enddo + end do + + ! + ! urban road columns ------------------------------------------------------------- + ! + do j = -nlevsno+1,0 + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (lun%urbpoi(l)) then + if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + bmatrix_snow(c,4,j-1) = 0._r8 + bmatrix_snow(c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + if ( j /= 0) then + bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + end if + else if (j <= nlevgrnd-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + if ( j /= 0) then + bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + end if + end if + end if + end if + end if + enddo + end do + + ! + ! non-urban landunits ------------------------------------------------------------ + ! + do j = -nlevsno+1,0 + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (.not. lun%urbpoi(l)) then + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + bmatrix_snow(c,4,j-1) = 0._r8 + bmatrix_snow(c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + if ( j /= 0) then + bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + end if + else if (j <= nlevgrnd-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + if ( j /= 0) then + bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + end if + end if + end if + end if + enddo + end do + + - call SetMatrix_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow( begc:endc, 1:, -nlevsno: )) end associate From 061cb70262662491e4799d937b62336b98b1de29 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 19 Mar 2020 13:37:52 -0600 Subject: [PATCH 0685/1973] Simply inlined SetMatrix_Snow_soil (all variations) into SetMatrix_Snow -- bfb --- src/biogeophys/SoilTemperatureMod.F90 | 38 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 63d41ea518..99caaa8cc6 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -2975,13 +2975,14 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & tk( begc:endc, -nlevsno+1: ), & fact( begc:endc, -nlevsno+1: ), & frac_sno_eff(begc:endc), & - bmatrix_snow( begc:endc, 1:, -nlevsno: )) - - call SetMatrix_Snow_Soil(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & + bmatrix_snow( begc:endc, 1:, -nlevsno: ), & bmatrix_snow_soil( begc:endc, 1:, -1: )) + !call SetMatrix_Snow_Soil(bounds, num_nolakec, filter_nolakec, nband, & + ! tk( begc:endc, -nlevsno+1: ), & + ! fact( begc:endc, -nlevsno+1: ), & + ! bmatrix_snow_soil( begc:endc, 1:, -1: )) + call SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & dhsdT( begc:endc ), & tk( begc:endc, -nlevsno+1: ), & @@ -3155,7 +3156,7 @@ end subroutine AssembleMatrixFromSubmatrices !----------------------------------------------------------------------- subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, fact, frac_sno_eff, bmatrix_snow) + dhsdT, tk, fact, frac_sno_eff, bmatrix_snow, bmatrix_snow_soil) ! ! !DESCRIPTION: ! Setup the matrix entries corresponding to internal snow layers @@ -3177,6 +3178,7 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) real(r8), intent(out) :: bmatrix_snow(bounds%begc: , 1:, -nlevsno: ) ! matrix enteries + real(r8), intent(out) :: bmatrix_snow_soil(bounds%begc: , 1:,-1: ) ! matrix enteries ! ! !LOCAL VARIABLES: integer :: j,c,l ! indices @@ -3191,7 +3193,7 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(frac_sno_eff) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), sourcefile, __LINE__) - + SHR_ASSERT_ALL_FL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), sourcefile, __LINE__) associate(& begc => bounds%begc , & ! Input: [integer ] beginning column index endc => bounds%endc , & ! Input: [integer ] ending column index @@ -3200,6 +3202,8 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & ! Initialize bmatrix_snow(begc:endc, :, :) = 0.0_r8 + bmatrix_snow_soil(begc:endc, :, :) = 0.0_r8 + ! call SetMatrix_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & ! dhsdT( begc:endc ), & @@ -3230,6 +3234,9 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & dzp = z(c,j+1)-z(c,j) bmatrix_snow(c,4,j-1) = 0._r8 bmatrix_snow(c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + if ( j == 0) then + bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + end if if ( j /= 0) then bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp end if @@ -3238,6 +3245,9 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & dzp = (z(c,j+1)-z(c,j)) bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + if ( j == 0) then + bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + end if if (j /= 0) then bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp end if @@ -3262,6 +3272,9 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & dzp = z(c,j+1)-z(c,j) bmatrix_snow(c,4,j-1) = 0._r8 bmatrix_snow(c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + if ( j == 0) then + bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + end if if ( j /= 0) then bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp end if @@ -3270,6 +3283,9 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & dzp = (z(c,j+1)-z(c,j)) bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + if ( j == 0) then + bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + end if if ( j /= 0) then bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp end if @@ -3293,6 +3309,9 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & dzp = z(c,j+1)-z(c,j) bmatrix_snow(c,4,j-1) = 0._r8 bmatrix_snow(c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + if ( j == 0) then + bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + end if if ( j /= 0) then bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp end if @@ -3301,6 +3320,9 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & dzp = (z(c,j+1)-z(c,j)) bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + if ( j == 0) then + bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + end if if ( j /= 0) then bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp end if @@ -3311,8 +3333,6 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & end do - - end associate end subroutine SetMatrix_Snow From 09568fafe289d22d80d5aa73d41363c6f6c15c0a Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 19 Mar 2020 14:22:06 -0600 Subject: [PATCH 0686/1973] Simply inlined SetMatrix_Soil (all variations) into SetMatrix_Soil -- bfb --- src/biogeophys/SoilTemperatureMod.F90 | 176 +++++++++++++++++++++++--- 1 file changed, 158 insertions(+), 18 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 99caaa8cc6..74ce748f3f 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -3928,6 +3928,7 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall + use column_varcon , only : icol_road_perv, icol_road_imperv use clm_varpar , only : nlevsno, nlevgrnd, nlevurb ! ! !ARGUMENTS: @@ -3964,29 +3965,168 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & associate( & begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index + endc => bounds%endc , & ! Input: [integer ] ending column index + zi => col%zi , & ! Input: [real(r8) (:,:)] interface level below a "z" level (m) + z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) ) - ! Initialize bmatrix_soil(begc:endc, :, :) = 0.0_r8 - call SetMatrix_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil( begc:endc, 1:, 1: )) - call SetMatrix_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil( begc:endc, 1:, 1: )) + !SetMatrix_SoilUrbanNonRoad + + ! + ! urban non-road columns --------------------------------------------------------- + ! + do j = 1,nlevurb + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (lun%urbpoi(l)) then + if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof)) then + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + if (j /= 1) then + bmatrix_soil(c,4,j) = 0._r8 + end if + bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + else if (j <= nlevurb-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + if (j /= 1) then + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + end if + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + else if (j == nlevurb) then + ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across + ! the bottom "soil" layer and the equations are derived assuming a prognostic inner + ! surface temperature. + dzm = ( z(c,j)-z(c,j-1)) + dzp = (zi(c,j)-z(c,j)) + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm) + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm + tk(c,j)/dzp) + bmatrix_soil(c,2,j) = 0._r8 + end if + end if + end if + end if + enddo + enddo + + ! + ! urban road columns ------------------------------------------------------------- + ! + do j = 1,nlevgrnd + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (lun%urbpoi(l)) then + if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + if (j /= 1) then + bmatrix_soil(c,4,j) = 0._r8 + end if + bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + else if (j == 1) then + ! this is the snow/soil interface layer + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + if (j /= 1) then + bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + * tk(c,j-1)/dzm + end if + bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + + frac_sno_eff(c) * tk(c,j-1)/dzm) & + - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + else if (j <= nlevgrnd-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + else if (j == nlevgrnd) then + dzm = (z(c,j)-z(c,j-1)) + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm + bmatrix_soil(c,2,j) = 0._r8 + end if + end if + end if + end if + enddo + end do + + ! + ! non-urban columns -------------------------------------------------------------- + ! + do j = 1,nlevgrnd + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (.not. lun%urbpoi(l)) then + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + if (j /= 1) then + bmatrix_soil(c,4,j) = 0._r8 + end if + bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + else if (j == 1) then + ! this is the snow/soil interface layer + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + if (j /= 1) then + bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + * tk(c,j-1)/dzm + end if + bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + + frac_sno_eff(c) * tk(c,j-1)/dzm) & + - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + else if (j <= nlevgrnd-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + else if (j == nlevgrnd) then + dzm = (z(c,j)-z(c,j-1)) + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm + bmatrix_soil(c,2,j) = 0._r8 + end if + end if + end if + enddo + end do + + + !call SetMatrix_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & + ! dhsdT( begc:endc ), & + ! tk( begc:endc, -nlevsno+1: ), & + ! tk_h2osfc( begc:endc ), & + ! dz_h2osfc( begc:endc ), & + ! fact( begc:endc, -nlevsno+1: ), & + ! frac_sno_eff(begc:endc), & + ! bmatrix_soil( begc:endc, 1:, 1: )) + + !call SetMatrix_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & + ! dhsdT( begc:endc ), & + ! tk( begc:endc, -nlevsno+1: ), & + ! tk_h2osfc( begc:endc ), & + ! dz_h2osfc( begc:endc ), & + ! fact( begc:endc, -nlevsno+1: ), & + ! frac_sno_eff(begc:endc), & + ! bmatrix_soil( begc:endc, 1:, 1: )) ! the solution will be organized as (snow:h2osfc:soil) to minimize ! bandwidth; this requires a 5-element band instead of 3 From 91e3e3eb3091ef42b01fe15c81893a20800fb0ae Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 19 Mar 2020 14:35:27 -0600 Subject: [PATCH 0687/1973] Cleaning up the redundant conditions in SetMatrix_Soil -- SMS bfb -- Issue #323 --- src/biogeophys/SoilTemperatureMod.F90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 74ce748f3f..b976675f30 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -4038,10 +4038,10 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! this is the snow/soil interface layer dzm = (z(c,j)-z(c,j-1)) dzp = (z(c,j+1)-z(c,j)) - if (j /= 1) then - bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm - end if + !if (j /= 1) then + ! bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + ! * tk(c,j-1)/dzm + !end if bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + frac_sno_eff(c) * tk(c,j-1)/dzm) & - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) @@ -4084,10 +4084,10 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! this is the snow/soil interface layer dzm = (z(c,j)-z(c,j-1)) dzp = (z(c,j+1)-z(c,j)) - if (j /= 1) then - bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm - end if + !if (j /= 1) then + ! bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + ! * tk(c,j-1)/dzm + !end if bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + frac_sno_eff(c) * tk(c,j-1)/dzm) & - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) From 61f2b05b69891bbba00aa57a2d046786e3c75067 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 19 Mar 2020 15:22:28 -0600 Subject: [PATCH 0688/1973] Update initial conditions file used in LII test Without this change, LII_D_Ld3.f19_g17_gl4.I2000Clm50BgcCrop.cheyenne_intel.clm-glcMEC_spunup_1way failed because it's pointing to an old initial conditions file that has a certain variable as a double when it is expected to be an int. I guess this worked with the old ncdio_pio code but breaks with the ncdio_pio changes on this branch. I have updated the initial conditions file using the finidat_inter_dest.nc file from this test, as described in the README file. --- .../testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm index c269a24911..c58bc66d21 100644 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm @@ -2,4 +2,4 @@ ! ! Initial condition file at the desired configuration to run, so can verify that interpolating from it gives the same result ! Note that this was generated with GLC_TWO_WAY_COUPLING=FALSE -finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2000-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180306.nc' +finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2000-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c200319.nc' From 4d7c7b7c3e2f694860a1858a0750c57c708a81be Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 19 Mar 2020 16:14:16 -0600 Subject: [PATCH 0689/1973] Update ChangeLog --- doc/ChangeLog | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 152 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 61b4c6ef2d..c497d7b5e7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,155 @@ =============================================================== +Tag name: ctsm1.0.dev086 +Originator(s): mvertens (Mariana Vertenstein) +Date: Thu Mar 19 16:03:26 MDT 2020 +One-line Summary: Updates to NUOPC cap and minor fixes to ncdio_pio + +Purpose of changes +------------------ + +This tag has updates to the NUOPC cap that are needed for the latest +version of CMEPS. + +Now each component NUOPC cap needs to compute possibly time varying +orbital parameters. Before, in cpl7, this was done in the driver and +passed to the components via seq_infodata. However, now the driver is +really just a simple ascii file - so those calculations needed to +migrate to the component caps. + +In addition, this tag contains changes to ncdio_pio.F90 that improve +performance in some situations. + +This also updates MOSART and RTM tags to include fixes for the NUOPC cap +for MOSART and implementation of an initial NUOPC cap for RTM. + +Also, I1Pt compsets now use SROF rather than using an active runoff +model in 'null' mode. This leads to differences in namelists, but not in +results. + +Mariana Vertenstein implemented most of the changes in this tag; Jim +Edwards implemented the ncdio_pio changes; Bill Sacks did final testing +and integration. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#943 (NUOPC tests will fail in ctsm1.0.dev085) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- I1Pt tests and cases now use SROF rather than an active runoff model + with a null grid (only impacts namelists, not results) +- Changed nuopc test to use MOSART rather than SROF +- Changed finidat file used by LII test to solve a problem that was + uncovered with the ncdio_pio changes in this tag + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (just for NUOPC configurations) + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: Just some NUOPC configurations + - what platforms/compilers: + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Not investigated carefully, but likely to be larger than roundoff + / same climate (due to introduction of time-varying orbital parameters) + + Differences are expected in NUOPC configurations using time-varying + orbital parameters. Note that no differences showed up in the test + suite, however, because the only nuopc test in the test suite is + new in this tag (so did not have baselines). + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: N/A + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- mosart: mosart1_0_35 -> mosart1_0_36 +- rtm: rtm1_0_70 -> rtm1_0_71 +- cmeps + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/issues/943 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev085 Originator(s): sacks (Bill Sacks) Date: Mon Mar 16 09:19:57 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 0dcf0c484c..e8eef4d85e 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev086 mvertens 03/19/2020 Updates to NUOPC cap and minor fixes to ncdio_pio ctsm1.0.dev085 sacks 03/16/2020 Update cime ctsm1.0.dev084 negins 02/19/2020 Bounds assertion for C isotopes when threading is on ctsm1.0.dev083 negins 02/06/2020 Some BFB Fixes: Resolve issues #683, # 874, #878, # 885, # 745, #838 From 11e6cc38170301ee7e5d5580abe8cf9c49b6008b Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Fri, 20 Mar 2020 01:21:05 -0600 Subject: [PATCH 0690/1973] Simply inlined SetMatrix_ssw (all variations) into one -- merging SetMatrix_SnowUrbanRoad and SetMatrix_SnowNonUrban -- bfb --- src/biogeophys/SoilTemperatureMod.F90 | 152 ++++++++++++++++++-------- 1 file changed, 107 insertions(+), 45 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index b976675f30..04957c52c1 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -2991,14 +2991,15 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & fact( begc:endc, -nlevsno+1: ), & frac_h2osfc(begc:endc), & frac_sno_eff(begc:endc), & - bmatrix_soil( begc:endc, 1:, 1: )) - - call SetMatrix_Soil_Snow(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & + bmatrix_soil( begc:endc, 1:, 1: ), & bmatrix_soil_snow( begc:endc, 1:, 1: )) + !call SetMatrix_Soil_Snow(bounds, num_nolakec, filter_nolakec, nband, & + ! tk( begc:endc, -nlevsno+1: ), & + ! fact( begc:endc, -nlevsno+1: ), & + ! frac_sno_eff(begc:endc), & + ! bmatrix_soil_snow( begc:endc, 1:, 1: )) + call SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, dtime, nband, & dhsdT( begc:endc ), & tk( begc:endc, -nlevsno+1: ), & @@ -3006,7 +3007,10 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & fact( begc:endc, -nlevsno+1: ), & c_h2osfc( begc:endc ), & dz_h2osfc( begc:endc ), & - bmatrix_ssw( begc:endc, 1:, 0: )) + frac_h2osfc(begc:endc), & + bmatrix_ssw( begc:endc, 1:, 0: ), & + bmatrix_ssw_soil( begc:endc, 1:, 0: ), & + bmatrix_soil_ssw( begc:endc, 1:, 1: )) call SetMatrix_StandingSurfaceWater_Soil(bounds, num_nolakec, filter_nolakec, dtime, nband, & tk( begc:endc, -nlevsno+1: ), & @@ -3265,8 +3269,10 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then + !if (lun%urbpoi(l)) then + if ((col%itype(c) == icol_road_imperv & + .or. col%itype(c) == icol_road_perv) & + .or. (.not. lun%urbpoi(l))) then if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then dzp = z(c,j+1)-z(c,j) @@ -3292,45 +3298,45 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & end if end if end if - end if + !end if enddo end do ! ! non-urban landunits ------------------------------------------------------------ ! - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_snow(c,4,j-1) = 0._r8 - bmatrix_snow(c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - if ( j == 0) then - bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - end if - if ( j /= 0) then - bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - end if - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - if ( j == 0) then - bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if - if ( j /= 0) then - bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if - end if - end if - end if - enddo - end do + !do j = -nlevsno+1,0 + ! do fc = 1,num_nolakec + ! c = filter_nolakec(fc) + ! l = col%landunit(c) + ! if (.not. lun%urbpoi(l)) then + ! if (j >= col%snl(c)+1) then + ! if (j == col%snl(c)+1) then + ! dzp = z(c,j+1)-z(c,j) + ! bmatrix_snow(c,4,j-1) = 0._r8 + ! bmatrix_snow(c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + ! if ( j == 0) then + ! bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + ! end if + ! if ( j /= 0) then + ! bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + ! end if + ! else if (j <= nlevgrnd-1) then + ! dzm = (z(c,j)-z(c,j-1)) + ! dzp = (z(c,j+1)-z(c,j)) + ! bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + ! bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + ! if ( j == 0) then + ! bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + ! end if + ! if ( j /= 0) then + ! bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + ! end if + ! end if + ! end if + ! end if + ! enddo + !end do end associate @@ -3920,7 +3926,7 @@ end subroutine SetMatrix_Snow_SoilNonUrban !----------------------------------------------------------------------- subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, tk_h2osfc, dz_h2osfc, fact, frac_h2osfc, frac_sno_eff, bmatrix_soil) + dhsdT, tk, tk_h2osfc, dz_h2osfc, fact, frac_h2osfc, frac_sno_eff, bmatrix_soil, bmatrix_soil_snow) ! ! !DESCRIPTION: ! Setup the matrix entries corresponding to internal soil layers. @@ -3945,6 +3951,7 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & real(r8), intent(in) :: frac_h2osfc(bounds%begc: ) ! fractional area with surface water greater than zero real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) real(r8), intent(out) :: bmatrix_soil(bounds%begc: , 1:, 1: ) ! matrix enteries + real(r8), intent(out) :: bmatrix_soil_snow(bounds%begc: , 1: ,1: ) ! matrix enteries ! ! !LOCAL VARIABLES: integer :: j,c,l ! indices @@ -3971,7 +3978,7 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ) ! Initialize bmatrix_soil(begc:endc, :, :) = 0.0_r8 - + bmatrix_soil_snow(begc:endc, :, :) = 0.0_r8 !SetMatrix_SoilUrbanNonRoad @@ -3993,6 +4000,10 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & end if bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + if (j == 1) then + bmatrix_soil_snow(c,5,j) = 0._r8 + end if + else if (j <= nlevurb-1) then dzm = (z(c,j)-z(c,j-1)) dzp = (z(c,j+1)-z(c,j)) @@ -4001,6 +4012,9 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & end if bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + if (j == 1) then + bmatrix_soil_snow(c,5,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + end if else if (j == nlevurb) then ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across ! the bottom "soil" layer and the equations are derived assuming a prognostic inner @@ -4034,6 +4048,9 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & end if bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + if ( j== 1) then + bmatrix_soil_snow(c,5,j) = 0._r8 + end if else if (j == 1) then ! this is the snow/soil interface layer dzm = (z(c,j)-z(c,j-1)) @@ -4042,6 +4059,8 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & ! * tk(c,j-1)/dzm !end if + bmatrix_soil_snow(c,5,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + * tk(c,j-1)/dzm bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + frac_sno_eff(c) * tk(c,j-1)/dzm) & - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) @@ -4078,6 +4097,7 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & if (j /= 1) then bmatrix_soil(c,4,j) = 0._r8 end if + bmatrix_soil_snow(c,5,j) = 0._r8 bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp else if (j == 1) then @@ -4092,6 +4112,8 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & + frac_sno_eff(c) * tk(c,j-1)/dzm) & - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + bmatrix_soil_snow(c,5,j) = -frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + * tk(c,j-1)/dzm else if (j <= nlevgrnd-1) then dzm = (z(c,j)-z(c,j-1)) dzp = (z(c,j+1)-z(c,j)) @@ -4812,7 +4834,7 @@ end subroutine SetMatrix_Soil_SnowNonUrban !----------------------------------------------------------------------- subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, dtime, nband, & - dhsdT, tk, tk_h2osfc, fact, c_h2osfc, dz_h2osfc, bmatrix_ssw) + dhsdT, tk, tk_h2osfc, fact, c_h2osfc, dz_h2osfc, frac_h2osfc, bmatrix_ssw , bmatrix_ssw_soil, bmatrix_soil_ssw) ! ! !DESCRIPTION: ! Setup the matrix entries corresponding to internal standing water layer @@ -4835,7 +4857,10 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] + real(r8), intent(in) :: frac_h2osfc(bounds%begc: ) ! fractional area with surface water greater than zero real(r8), intent(out) :: bmatrix_ssw(bounds%begc: , 1:, 0: ) ! matrix enteries + real(r8), intent(out) :: bmatrix_ssw_soil(bounds%begc: , 1: ,0: ) ! matrix enteries + real(r8), intent(out) :: bmatrix_soil_ssw(bounds%begc: , 1:, 1: ) ! matrix enteries ! ! !LOCAL VARIABLES: integer :: c ! indices @@ -4850,10 +4875,16 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dz_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(frac_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_ssw) == (/bounds%endc, nband, 0/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(bmatrix_ssw_soil) == (/bounds%endc, nband, 0/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(bmatrix_soil_ssw) == (/bounds%endc, nband, 1/)), sourcefile, __LINE__) + !----------------------------------------------------------------------- ! Initialize bmatrix_ssw(bounds%begc:bounds%endc, :, :) = 0.0_r8 + bmatrix_ssw_soil(bounds%begc:bounds%endc, :, :) = 0.0_r8 + bmatrix_soil_ssw(bounds%begc:bounds%endc, :, :) = 0.0_r8 do fc = 1,num_nolakec c = filter_nolakec(fc) @@ -4866,6 +4897,37 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d enddo + + ! Initialize + bmatrix_ssw_soil(bounds%begc:bounds%endc, :, :) = 0.0_r8 + + do fc = 1,num_nolakec + c = filter_nolakec(fc) + + ! surface water layer has two coefficients + dzm=(0.5*dz_h2osfc(c)+col%z(c,1)) + + bmatrix_ssw_soil(c,2,0)= -(1._r8-cnfac)*(dtime/c_h2osfc(c))*tk_h2osfc(c)/dzm !flux to top soil layer + + enddo + + ! Initialize + bmatrix_soil_ssw(bounds%begc:bounds%endc, :, :) = 0.0_r8 + + do fc = 1,num_nolakec + c = filter_nolakec(fc) + + ! surface water layer has two coefficients + dzm=(0.5*dz_h2osfc(c)+col%z(c,1)) + + ! top soil layer has sub coef shifted to 2nd super diagonal + if ( frac_h2osfc(c) /= 0.0_r8 )then + bmatrix_soil_ssw(c,4,1)= - frac_h2osfc(c) * (1._r8-cnfac) * fact(c,1) & + * tk_h2osfc(c)/dzm !flux from h2osfc + end if + enddo + + end subroutine SetMatrix_StandingSurfaceWater !----------------------------------------------------------------------- From 87ca70ec2bbadfa6d6b70a3e08dae5b9f9333ef4 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Fri, 20 Mar 2020 02:11:23 -0600 Subject: [PATCH 0691/1973] merging SetMatrix_SoilUrbanRoad and SetMatrix_SoilNonUrban + cleanups... -- bfb --- src/biogeophys/SoilTemperatureMod.F90 | 128 +++++++++++++------------- 1 file changed, 65 insertions(+), 63 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 04957c52c1..60520adbe4 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -3012,20 +3012,20 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & bmatrix_ssw_soil( begc:endc, 1:, 0: ), & bmatrix_soil_ssw( begc:endc, 1:, 1: )) - call SetMatrix_StandingSurfaceWater_Soil(bounds, num_nolakec, filter_nolakec, dtime, nband, & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - c_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - bmatrix_ssw_soil( begc:endc, 1:, 0: )) - - call SetMatrix_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, nband, & - tk_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - dz_h2osfc( begc:endc ), & - frac_h2osfc(begc:endc), & - bmatrix_soil_ssw( begc:endc, 1:, 1: )) + !call SetMatrix_StandingSurfaceWater_Soil(bounds, num_nolakec, filter_nolakec, dtime, nband, & + ! tk( begc:endc, -nlevsno+1: ), & + ! tk_h2osfc( begc:endc ), & + ! fact( begc:endc, -nlevsno+1: ), & + ! c_h2osfc( begc:endc ), & + ! dz_h2osfc( begc:endc ), & + ! bmatrix_ssw_soil( begc:endc, 1:, 0: )) + + !call SetMatrix_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, nband, & + ! tk_h2osfc( begc:endc ), & + ! fact( begc:endc, -nlevsno+1: ), & + ! dz_h2osfc( begc:endc ), & + ! frac_h2osfc(begc:endc), & + ! bmatrix_soil_ssw( begc:endc, 1:, 1: )) call AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nband, & bmatrix_snow( begc:endc, 1:, -nlevsno: ), & @@ -4038,8 +4038,10 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then + !if (lun%urbpoi(l)) then + if ((col%itype(c) == icol_road_imperv) .or. & + (col%itype(c) == icol_road_perv) .or. & + (.not. lun%urbpoi(l))) then if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then dzp = z(c,j+1)-z(c,j) @@ -4059,12 +4061,12 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & ! * tk(c,j-1)/dzm !end if - bmatrix_soil_snow(c,5,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + frac_sno_eff(c) * tk(c,j-1)/dzm) & - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + bmatrix_soil_snow(c,5,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + * tk(c,j-1)/dzm else if (j <= nlevgrnd-1) then dzm = (z(c,j)-z(c,j-1)) dzp = (z(c,j+1)-z(c,j)) @@ -4079,57 +4081,57 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & end if end if end if - end if + !end if enddo end do ! ! non-urban columns -------------------------------------------------------------- ! - do j = 1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - if (j /= 1) then - bmatrix_soil(c,4,j) = 0._r8 - end if - bmatrix_soil_snow(c,5,j) = 0._r8 - bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j == 1) then - ! this is the snow/soil interface layer - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - !if (j /= 1) then - ! bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - ! * tk(c,j-1)/dzm - !end if - bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & - + frac_sno_eff(c) * tk(c,j-1)/dzm) & - - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - bmatrix_soil_snow(c,5,j) = -frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - else if (j == nlevgrnd) then - dzm = (z(c,j)-z(c,j-1)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - bmatrix_soil(c,2,j) = 0._r8 - end if - end if - end if - enddo - end do + !do j = 1,nlevgrnd + ! do fc = 1,num_nolakec + ! c = filter_nolakec(fc) + ! l = col%landunit(c) + ! if (.not. lun%urbpoi(l)) then + ! if (j >= col%snl(c)+1) then + ! if (j == col%snl(c)+1) then + ! dzp = z(c,j+1)-z(c,j) + ! if (j /= 1) then + ! bmatrix_soil(c,4,j) = 0._r8 + ! end if + ! bmatrix_soil_snow(c,5,j) = 0._r8 + ! bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + ! bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + ! else if (j == 1) then + ! ! this is the snow/soil interface layer + ! dzm = (z(c,j)-z(c,j-1)) + ! dzp = (z(c,j+1)-z(c,j)) + ! !if (j /= 1) then + ! ! bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + ! ! * tk(c,j-1)/dzm + ! !end if + ! bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + ! + frac_sno_eff(c) * tk(c,j-1)/dzm) & + ! - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) + ! bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + ! bmatrix_soil_snow(c,5,j) = -frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + ! * tk(c,j-1)/dzm + ! else if (j <= nlevgrnd-1) then + ! dzm = (z(c,j)-z(c,j-1)) + ! dzp = (z(c,j+1)-z(c,j)) + ! bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + ! bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + ! bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + ! else if (j == nlevgrnd) then + ! dzm = (z(c,j)-z(c,j-1)) + ! bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm + ! bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm + ! bmatrix_soil(c,2,j) = 0._r8 + ! end if + ! end if + ! end if + ! enddo + !end do !call SetMatrix_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & From 64aa4d99ba744eeeacae84ed53756db93d144e46 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Sat, 21 Mar 2020 11:24:39 -0400 Subject: [PATCH 0692/1973] Add files via upload --- src/biogeophys/LunaMod.F90 | 36 +++--- src/biogeophys/PhotosynthesisMod.F90 | 31 ++++-- src/biogeophys/TemperatureType.F90 | 52 ++++++--- src/biogeophys/WaterDiagnosticBulkType.F90 | 122 +++++++++++++++++++++ 4 files changed, 203 insertions(+), 38 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 35a38701ec..3ff3fade55 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -306,7 +306,9 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & vcmx25_z => photosyns_inst%vcmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 (umol/m2 leaf/s) for canopy layer jmx25_z => photosyns_inst%jmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 (umol electron/m**2/s) for canopy layer pnlc_z => photosyns_inst%pnlc_z_patch , & ! Output: [real(r8) (:,:) ] patch proportion of leaf nitrogen allocated for light capture for canopy layer - enzs_z => photosyns_inst%enzs_z_patch & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress + enzs_z => photosyns_inst%enzs_z_patch , & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress + vcmx_prevyr => photosyns_inst%vcmx_prevyr , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 from previous year avg + jmx_prevyr => photosyns_inst%jmx_prevyr & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 from previous year avg ) !---------------------------------------------------------------------------------------------------------------------------------------------------------- !set timestep @@ -332,7 +334,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & hourpd = dayl(g) / 3600._r8 tleafd10 = t_veg10_day(p) - tfrz tleafn10 = t_veg10_night(p) - tfrz - tleaf10 = (dayl(g)*tleafd10 +(86400._r8-dayl(g)) * tleafd10)/86400._r8 + tleaf10 = (dayl(g)*tleafd10 +(86400._r8-dayl(g)) * tleafn10)/86400._r8 tair10 = t10(p)- tfrz relh10 = min(1.0_r8, rh10_p(p)) rb10v = rb10_p(p) @@ -409,11 +411,15 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & chg = vcmx25_opt-vcmx25_z(p, z) chg_constrn = min(abs(chg),vcmx25_z(p, z)*max_daily_pchg) + vcmx_prevyr(p,z) = vcmx25_z(p,z) vcmx25_z(p, z) = vcmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - + vcmx_prevyr(p,z) = (vcmx_prevyr(p,z)+vcmx25_z(p,z))/2.0_r8 + chg = jmx25_opt-jmx25_z(p, z) chg_constrn = min(abs(chg),jmx25_z(p, z)*max_daily_pchg) + jmx_prevyr(p,z) = jmx25_z(p,z) jmx25_z(p, z) = jmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn + jmx_prevyr(p,z) = (jmx_prevyr(p,z)+jmx25_z(p,z))/2.0_r8 PNlc_z(p, z)= PNlcopt @@ -472,8 +478,8 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & endif !if not C3 plants else do z = 1 , nrad(p) - jmx25_z(p, z) = 85._r8 - vcmx25_z(p, z) = 50._r8 + jmx25_z(p, z) = jmx_prevyr(p,z) + vcmx25_z(p, z) = vcmx_prevyr(p,z) end do endif !checking for LAI and LNC endif !the first daycheck @@ -792,7 +798,7 @@ end subroutine Clear24_Climate_LUNA subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PARimx10,rb10, hourpd, tair10, tleafd10, tleafn10, & Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp,& PNlcold, PNetold, PNrespold, PNcbold, & - PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) + PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt, dayl_factor) implicit none real(r8), intent (in) :: FNCa !Area based functional nitrogen content (g N/m2 leaf) real(r8), intent (in) :: forc_pbot10 !10-day mean air pressure (Pa) @@ -819,7 +825,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR real(r8), intent (out):: PNetopt !optimal proportion of nitrogen for electron transport real(r8), intent (out):: PNrespopt !optimal proportion of nitrogen for respiration real(r8), intent (out):: PNcbopt !optial proportion of nitrogen for carboxyaltion - + real(r8), intent(in) :: dayl_factor !lbirch: added to scaled light: !------------------------------------------------------------------------------------------------------------------------------- !intermediate variables real(r8) :: Carboncost1 !absolute amount of carbon cost associated with maintenance respiration due to deccrease in light capture nitrogen(g dry mass per day) @@ -897,11 +903,11 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR tleafd10c = min(max(tleafd10, Trange1), Trange2) !constrain the physiological range tleafn10c = min(max(tleafn10, Trange1), Trange2) !constrain the physiological range ci = 0.7_r8 * CO2a10 - JmaxCoef = Jmaxb1 * ((hourpd / 12.0_r8)**2.0_r8) * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & + JmaxCoef = Jmaxb1 * dayl_factor * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & (1.0_r8 - minrelh))) do while (PNlcoldi .NE. PNlc .and. jj < 100) - Fc = VcmxTKattge(tair10, tleafd10c) * Fc25 - Fj = JmxTKattge(tair10, tleafd10c) * Fj25 + Fc = VcmxTLeuning(tair10, tleafd10c) * Fc25 + Fj = JmxTLeuning(tair10, tleafd10c) * Fj25 NUEr = Cv * NUEr25 * (RespTBernacchi(tleafd10c) * hourpd + RespTBernacchi(tleafn10c) * (24.0_r8 - hourpd)) !nitrogen use efficiency for respiration (g biomass/m2/day/g N) !**************************************************** !Nitrogen Allocation Scheme: store the initial value @@ -1054,7 +1060,7 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & A = (1.0_r8 - theta_cj) * max(Wc, Wj) + theta_cj * min(Wc, Wj) endif PSN = Cv * A * hourpd - Vcmaxnight = VcmxTKattge(tair10, tleafn10) / VcmxTKattge(tair10, tleafd10) * Vcmax + Vcmaxnight = VcmxTLeuning(tair10, tleafn10) / VcmxTLeuning(tair10, tleafd10) * Vcmax RESP = Cv * leaf_mr_vcm * (Vcmax * hourpd + Vcmaxnight * (24.0_r8 - hourpd)) Net = Jmax / Fj Ncb = Vcmax / Fc @@ -1209,8 +1215,8 @@ subroutine NUEref(NUEjref,NUEcref,Kj2Kcref) tgrow = 25.0_r8 tleaf = 25.0_r8 - Fc = VcmxTKattge(tgrow, tleaf) * Fc25 - Fj = JmxTKattge(tgrow, tleaf) * Fj25 + Fc = VcmxTLeuning(tgrow, tleaf) * Fc25 + Fj = JmxTLeuning(tgrow, tleaf) * Fj25 CO2c = co2ref * forc_pbot_ref * 1.0e-6_r8 !pa O2c = O2ref * forc_pbot_ref * 1.0e-6_r8 !pa k_c = params_inst%kc25_coef * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) @@ -1250,8 +1256,8 @@ subroutine NUE(O2a, ci, tgrow, tleaf, NUEj,NUEc,Kj2Kc) real(r8) :: awc !second deminator term for rubsico limited carboxylation rate based on Farquhar model real(r8) :: c_p !CO2 compenstation point (Pa) - Fc = VcmxTKattge(tgrow, tleaf) * Fc25 - Fj = JmxTKattge(tgrow, tleaf) * Fj25 + Fc = VcmxTLenuning(tgrow, tleaf) * Fc25 + Fj = JmxTLeuning(tgrow, tleaf) * Fj25 k_c = params_inst%kc25_coef * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) k_o = params_inst%ko25_coef * exp((36380.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) c_p = params_inst%cp25_yr2000 * exp((37830.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index a111cab156..11249d534c 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -183,6 +183,8 @@ module PhotosynthesisMod ! LUNA specific variables real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer + real(r8), pointer, public :: vcmx_prevyr (:,:) ! patch leaf Vc,max25 previous year avg + real(r8), pointer, public :: jmx2_prevyr (:,:) ! patch leaf Jmax25 previous year avg real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) @@ -328,6 +330,8 @@ subroutine InitAllocate(this, bounds) ! statements. allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 + allocate(this%vcmx_prevyr (begp:endp,1:nlevcan)) ; this%vcmx_prevyr (:,:) = 30._r8 + allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 60._r8 allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8 @@ -833,6 +837,14 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) + call restartvar(ncid=ncid, flag=flag, varname='vcmx_prevyr', xtype=ncd_double, & + dim1name='pft', dim2name='levcan', switchdim=.true., & + long_name='avg carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + interpinic_flag='interp', readvar=readvar, data=this%vcmx_prevyr) + call restartvar(ncid=ncid, flag=flag, varname='jmx_prevyr', xtype=ncd_double, & + dim1name='pft', dim2name='levcan', switchdim=.true., & + long_name='avg carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + interpinic_flag='interp', readvar=readvar, data=this%jmx_prevyr) call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='proportion of leaf nitrogen allocated for light capture', units='unitless', & @@ -2791,18 +2803,18 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & kcha = 79430._r8 koha = 36380._r8 cpha = 37830._r8 - vcmaxha = 72000._r8 - jmaxha = 50000._r8 - tpuha = 72000._r8 + vcmaxha = 73637._r8 + jmaxha = 50300._r8 + tpuha = 73637._r8 lmrha = 46390._r8 ! High temperature deactivation, from: ! Leuning (2002) Plant, Cell and Environment 25:1205-1210 ! The factor "c" scales the deactivation to a value of 1.0 at 25C - vcmaxhd = 200000._r8 - jmaxhd = 200000._r8 - tpuhd = 200000._r8 + vcmaxhd = 149252._r8 + jmaxhd = 152044._r8 + tpuhd = 149252._r8 lmrhd = 150650._r8 lmrse = 490._r8 lmrc = fth25 (lmrhd, lmrse) @@ -3162,9 +3174,10 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & kp25_sha = kp25top * nscaler_sha ! Adjust for temperature - - vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) - jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) + vcmaxse = 486.0_r8 + jmaxse = 495.0_r8 + !vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) + !jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) tpuse = vcmaxse vcmaxc = fth25 (vcmaxhd, vcmaxse) jmaxc = fth25 (jmaxhd, jmaxse) diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 5c69733f8a..4949c5f24b 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -453,13 +453,17 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) call hist_addfld1d (fname='T10', units='K', & avgflag='A', long_name='10-day running mean of 2-m temperature', & ptr_patch=this%t_a10_patch, default='inactive') - - if (use_cn .and. use_crop )then - this%t_a5min_patch(begp:endp) = spval - call hist_addfld1d (fname='A5TMIN', units='K', & - avgflag='A', long_name='5-day running mean of min 2-m temperature', & - ptr_patch=this%t_a5min_patch, default='inactive') - end if + + this%soila10_patch(begp:endp) = spval + call hist_addfld1d (fname='SOIL10', units='K', & + avgflag='A', long_name='10-day running mean of 3rd layer soil', & + ptr_patch=this%soila10_patch, default='inactive') + !if (use_cn .and. use_crop )then + this%t_a5min_patch(begp:endp) = spval + call hist_addfld1d (fname='A5TMIN', units='K', & + avgflag='A', long_name='5-day running mean of min 2-m temperature', & + ptr_patch=this%t_a5min_patch, default='inactive') + !end if if (use_cn .and. use_crop )then this%t_a10min_patch(begp:endp) = spval @@ -1163,6 +1167,12 @@ subroutine InitAccBuffer (this, bounds) call init_accum_field (name='T10', units='K', & desc='10-day running mean of 2-m temperature', accum_type='runmean', accum_period=-10, & subgrid_type='pft', numlev=1,init_value=SHR_CONST_TKFRZ+20._r8) + call init_accum_field (name='SOIL10', units='K', & + desc='10-day running mean of 3rd layer soil temp.', accum_type='runmean', accum_period=-10, & + subgrid_type='pft', numlev=1,init_value=SHR_CONST_TKFRZ) + call init_accum_field (name='TDM5', units='K', & + desc='5-day running mean of min 2-m temperature', accum_type='runmean', accum_period=-5, & + subgrid_type='pft', numlev=1, init_value=SHR_CONST_TKFRZ) if ( use_crop )then call init_accum_field (name='TDM10', units='K', & @@ -1248,7 +1258,12 @@ subroutine InitAccVars(this, bounds) call extract_accum_field ('T10', rbufslp, nstep) this%t_a10_patch(begp:endp) = rbufslp(begp:endp) + + call extract_accum_field ('SOIL10', rbufslp, nstep) + this%t_a10_patch(begp:endp) = rbufslp(begp:endp) + call extract_accum_field ('TDM5', rbufslp, nstep) + this%t_a5min_patch(begp:endp) = rbufslp(begp:endp) if (use_crop) then call extract_accum_field ('TDM10', rbufslp, nstep) this%t_a10min_patch(begp:endp)= rbufslp(begp:endp) @@ -1432,6 +1447,22 @@ subroutine UpdateAccVars (this, bounds) call update_accum_field ('T10', this%t_ref2m_patch, nstep) call extract_accum_field ('T10', this%t_a10_patch, nstep) + + do p = begp,endp + c = patch%column(p) + rbufslp(p) = this%t_soisno_col(c,3) + end do + call update_accum_field ('SOIL10', rbufslp, nstep) + call extract_accum_field ('SOIL10', this%soila10_patch, nstep) + + ! Accumulate and extract TDM5 + + do p = begp,endp + rbufslp(p) = min(this%t_ref2m_min_patch(p),this%t_ref2m_min_inst_patch(p)) !slevis: ok choice? + if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& + end do !'min_inst' not initialized? + call update_accum_field ('TDM5', rbufslp, nstep) + call extract_accum_field ('TDM5', this%t_a5min_patch, nstep) if ( use_crop )then ! Accumulate and extract TDM10 @@ -1443,14 +1474,7 @@ subroutine UpdateAccVars (this, bounds) call update_accum_field ('TDM10', rbufslp, nstep) call extract_accum_field ('TDM10', this%t_a10min_patch, nstep) - ! Accumulate and extract TDM5 - do p = begp,endp - rbufslp(p) = min(this%t_ref2m_min_patch(p),this%t_ref2m_min_inst_patch(p)) !slevis: ok choice? - if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& - end do !'min_inst' not initialized? - call update_accum_field ('TDM5', rbufslp, nstep) - call extract_accum_field ('TDM5', this%t_a5min_patch, nstep) ! Accumulate and extract GDD0 diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index 21cc9d283b..9b07ceb847 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -38,6 +38,7 @@ module WaterDiagnosticBulkType real(r8), pointer :: h2osno_total_col (:) ! col total snow water (mm H2O) real(r8), pointer :: snow_depth_col (:) ! col snow height of snow covered area (m) + real(r8), pointer :: snow_10day (:) ! col snow height 10 day avg real(r8), pointer :: snowdp_col (:) ! col area-averaged snow height (m) real(r8), pointer :: snow_layer_unity_col (:,:) ! value 1 for each snow layer, used for history diagnostics real(r8), pointer :: bw_col (:,:) ! col partial density of water in the snow pack (ice + liquid) [kg/m3] @@ -86,6 +87,9 @@ module WaterDiagnosticBulkType procedure, private :: InitBulkAllocate procedure, private :: InitBulkHistory procedure, private :: InitBulkCold + procedure, private :: InitAccBuffer + procedure, private :: InitAccVars + procedure, private :: UpdateAccVars procedure, private :: RestartBackcompatIssue783 end type waterdiagnosticbulk_type @@ -176,6 +180,7 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%h2osno_total_col (begc:endc)) ; this%h2osno_total_col (:) = nan allocate(this%snow_depth_col (begc:endc)) ; this%snow_depth_col (:) = nan + allocate(this%snow_10day (begc:endc)) ; this%snow_10day (:) = nan allocate(this%snowdp_col (begc:endc)) ; this%snowdp_col (:) = nan allocate(this%snow_layer_unity_col (begc:endc,-nlevsno+1:0)) ; this%snow_layer_unity_col (:,:) = nan allocate(this%bw_col (begc:endc,-nlevsno+1:0)) ; this%bw_col (:,:) = nan @@ -400,6 +405,14 @@ subroutine InitBulkHistory(this, bounds) avgflag='A', & long_name=this%info%lname('snow height of snow covered area'), & ptr_col=this%snow_depth_col, c2l_scale_type='urbanf') + !lbirch: added lagged snow depth variable + this%snow_10day(begc:endc) = spval + call hist_addfld1d ( & + fname=this%info%fname('SNOW_10D'), & + units='m', & + avgflag='A', & + long_name=this%info%lname('10day snow avg'), & + ptr_col=this%snow_10day, c2l_scale_type='urbanf') call hist_addfld1d ( & fname=this%info%fname('SNOW_DEPTH_ICE'), & @@ -507,8 +520,109 @@ subroutine InitBulkHistory(this, bounds) ptr_patch=this%qflx_prec_intr_patch, set_lake=0._r8) end subroutine InitBulkHistory + + !----------------------------------------------------------------------- + subroutine InitAccBuffer (this, bounds) + ! + ! !DESCRIPTION: + ! Initialize accumulation buffer for all required module accumulated fields + ! This routine set defaults values that are then overwritten by the + ! restart file for restart or branch runs + ! + ! !USES + use clm_varcon , only : spval + use accumulMod , only : init_accum_field + ! + ! !ARGUMENTS: + class(waterdiagnosticbulk_type) :: this + type(bounds_type), intent(in) :: bounds + !--------------------------------------------------------------------- + + !lbirch added 10day avg + call init_accum_field (name='SNOW_10D', units='m', & + desc='10-day running mean of snowdepth', accum_type='runmean', accum_period=-5, & + subgrid_type='column', numlev=1, init_value=0._r8) + + + end subroutine InitAccBuffer !----------------------------------------------------------------------- + subroutine InitAccVars (this, bounds) + ! !DESCRIPTION: + ! Initialize module variables that are associated with + ! time accumulated fields. This routine is called for both an initial run + ! and a restart run (and must therefore must be called after the restart file + ! is read in and the accumulation buffer is obtained) + ! + ! !USES + use accumulMod , only : extract_accum_field + use clm_time_manager , only : get_nstep + ! + ! !ARGUMENTS: + class(waterdiagnosticbulk_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: begc, endc + integer :: nstep + integer :: ier + real(r8), pointer :: rbufslp(:) ! temporary + !--------------------------------------------------------------------- + begc = bounds%begc; endc = bounds%endc + + ! Allocate needed dynamic memory for single level patch field + allocate(rbufslp(begc:endc), stat=ier) + + ! Determine time step + nstep = get_nstep() + !lbirch added + call extract_accum_field ('SNOW_10D', rbufslp, nstep) + this%snow_10day(begc:endc) = rbufslp(begc:endc) + + deallocate(rbufslp) + + end subroutine InitAccVars + +!----------------------------------------------------------------------- + subroutine UpdateAccVars (this, bounds) + ! + ! USES + use clm_time_manager, only : get_nstep + use accumulMod , only : update_accum_field, extract_accum_field + ! + ! !ARGUMENTS: + class(waterdiagnosticbulk_type) :: this + type(bounds_type) , intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: c ! indices + integer :: dtime ! timestep size [seconds] + integer :: nstep ! timestep number + integer :: ier ! error status + integer :: begc, endc + real(r8), pointer :: rbufslp(:) ! temporary single level - patch level + !--------------------------------------------------------------------- + !added by lbirch for snow + begc = bounds%begc; endc = bounds%endc + + nstep = get_nstep() + + ! Allocate needed dynamic memory for single level patch field + + allocate(rbufslp(begc:endc), stat=ier) + + ! Accumulate and extract snow 10 day + call update_accum_field ('SNOW_10D', this%snow_depth_col, nstep) + call extract_accum_field ('SNOW_10D', this%snow_10day, nstep) + + + deallocate(rbufslp) + + end subroutine UpdateAccVars + + + !----------------------------------------------------------------------- + subroutine InitBulkCold(this, bounds, & snow_depth_input_col, h2osno_input_col) ! @@ -656,6 +770,14 @@ subroutine RestartBulk(this, bounds, ncid, flag, writing_finidat_interp_dest_fil long_name=this%info%lname('snow depth'), & units='m', & interpinic_flag='interp', readvar=readvar, data=this%snow_depth_col) + !lbirch added 10 day snow + call restartvar(ncid=ncid, flag=flag, & + varname=this%info%fname('SNOW_10D'), & + xtype=ncd_double, & + dim1name='column', & + long_name=this%info%lname('10 day snow height'), & + units='m', & + interpinic_flag='interp', readvar=readvar, data=this%snow_10day) call restartvar(ncid=ncid, flag=flag, & varname=this%info%fname('frac_sno_eff'), & From d91b2eea3c4ff1f30a2e94657c9cc9a5a3601dd7 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Sat, 21 Mar 2020 11:25:30 -0400 Subject: [PATCH 0693/1973] Add files via upload --- src/biogeochem/CNPhenologyMod.F90 | 33 +++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 400d46e11a..d32a3fc137 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -299,7 +299,7 @@ subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & call CNSeasonDecidPhenology(num_soilp, filter_soilp, & temperature_inst, cnveg_state_inst, dgvs_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, waterstatebulk_inst) call CNStressDecidPhenology(num_soilp, filter_soilp, & soilstate_inst, temperature_inst, atm2lnd_inst, wateratm2lndbulk_inst, cnveg_state_inst, & @@ -670,7 +670,8 @@ end subroutine CNEvergreenPhenology !----------------------------------------------------------------------- subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & temperature_inst, cnveg_state_inst, dgvs_inst , & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & + waterstatebulk_inst) ! ! !DESCRIPTION: ! For coupled carbon-nitrogen code (CN). @@ -692,12 +693,15 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst ! ! !LOCAL VARIABLES: integer :: g,c,p !indices integer :: fp !lake filter patch index real(r8):: ws_flag !winter-summer solstice flag (0 or 1) real(r8):: crit_onset_gdd !critical onset growing degree-day sum + real(r8):: crit_daylbirch !latitudinal gradient in arctic-boreal + real(r8):: onset_thresh !lbirch: flag onset threshold real(r8):: soilt !----------------------------------------------------------------------- @@ -780,7 +784,10 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] + deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] + t10 => temperature_inst%soila10_patch , & ! Output: [real(r8) (:) ] + tmin10 => temperature_inst%t_a10min_patch , & ! Output: [real(r8) (:) ] + snow_depth => waterstate_inst%snow_10day & ! Output: [real(r8) (:) ] ) ! start patch loop @@ -907,13 +914,21 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday end if + !seperate into Arctic boreal and lower latitudes + if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then + onset_thresh=1.0_r8 + else if (onset_gddflag(p) == 1.0_r8 .and. t10(p) > SHR_CONST_TKFRZ .and. tmin10(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_depth(c)<0.1_r8) then + onset_thresh=1.0_r8 + end if + ! set onset_flag if critical growing degree-day sum is exceeded - if (onset_gdd(p) > crit_onset_gdd) then + if (onset_thresh == 1.0_r8) then onset_flag(p) = 1.0_r8 dormant_flag(p) = 0.0_r8 onset_gddflag(p) = 0.0_r8 onset_gdd(p) = 0.0_r8 + onset_thresh = 0.0_r8 onset_counter(p) = ndays_on * secspday ! move all the storage pools into transfer pools, @@ -954,9 +969,15 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & days_active(p) = days_active(p) + fracday if (days_active(p) > 355._r8) pftmayexist(p) = .false. end if - + ! use 15 hr max to ~11hours in temperate regions ! only begin to test for offset daylength once past the summer sol - if (ws_flag == 0._r8 .and. dayl(g) < crit_dayl) then + crit_daylbirch=54000-360*(65-grc%latdeg(g)) + if (crit_daylbirch < crit_dayl) then + crit_daylbirch = crit_dayl + end if + + !print*,'lbirch',crit_daylbirch + if (ws_flag == 0._r8 .and. dayl(g) < crit_daylbirch) then offset_flag(p) = 1._r8 offset_counter(p) = ndays_off * secspday prev_leafc_to_litter(p) = 0._r8 From 8a5252e784590c25460b7415da199a00ee39824b Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Sat, 21 Mar 2020 11:36:02 -0400 Subject: [PATCH 0694/1973] Add files via upload --- src/biogeochem/CNPhenologyMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index d32a3fc137..0b7239b8c4 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -786,7 +786,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] t10 => temperature_inst%soila10_patch , & ! Output: [real(r8) (:) ] - tmin10 => temperature_inst%t_a10min_patch , & ! Output: [real(r8) (:) ] + tmin5 => temperature_inst%t_a5min_patch , & ! Output: [real(r8) (:) ] snow_depth => waterstate_inst%snow_10day & ! Output: [real(r8) (:) ] ) @@ -917,7 +917,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & !seperate into Arctic boreal and lower latitudes if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then onset_thresh=1.0_r8 - else if (onset_gddflag(p) == 1.0_r8 .and. t10(p) > SHR_CONST_TKFRZ .and. tmin10(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_depth(c)<0.1_r8) then + else if (onset_gddflag(p) == 1.0_r8 .and. t10(p) > SHR_CONST_TKFRZ .and. tmin5(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_depth(c)<0.1_r8) then onset_thresh=1.0_r8 end if From 81b1e24e559c401f6c6d371295647b43a653db3f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 21 Mar 2020 15:32:20 -0600 Subject: [PATCH 0695/1973] Remove the hcru_hcru test --- cime_config/testdefs/testlist_clm.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index a817003911..e52a529149 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -254,15 +254,6 @@ - - - - - - - - - From 54194c8597df792fcd2a5dbe9c2d8f75bdd9caf7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 21 Mar 2020 17:17:42 -0600 Subject: [PATCH 0696/1973] Rename so can add in coldStart --- .../clm/ignor_warn_cropMonthOutputColdStart/include_user_mods | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutputColdStart/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutputColdStart/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutputColdStart/include_user_mods new file mode 100644 index 0000000000..6aed6a8eea --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutputColdStart/include_user_mods @@ -0,0 +1,2 @@ +../_includes/ignore_warnings +../cropMonthOutput From 8908246e97e5aad8993f39607c8c7cbfab642b82 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 21 Mar 2020 17:19:04 -0600 Subject: [PATCH 0697/1973] Add coldStart also --- .../clm/ignor_warn_cropMonthOutputColdStart/include_user_mods | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutputColdStart/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutputColdStart/include_user_mods index 6aed6a8eea..5c73adaa4a 100644 --- a/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutputColdStart/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutputColdStart/include_user_mods @@ -1,2 +1,3 @@ ../_includes/ignore_warnings +../coldStart ../cropMonthOutput From 41b4e065e72b07e7e1cf6b087b889742baa8c471 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 22 Mar 2020 14:40:24 -0600 Subject: [PATCH 0698/1973] Add external for documentation images --- .gitignore | 1 + Externals_CLM.cfg | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 4a5672d970..c4e9ffb366 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ manage_externals.log /tools/PTCLM/ /cime/ /components/ +/doc/source/images/ # ignore svn directories **/.svn/** diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 84b7d5ec33..1ca392b31f 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -12,6 +12,13 @@ repo_url = https://github.com/ESCOMP/ptclm tag = PTCLM2_180611 required = True +[doc-images] +local_path = doc/source/images +protocol = git +repo_url = https://github.com/ESCOMP/CTSM-doc-images.git +hash = 0f039e7a043fabfce91ddf4f41186a3014603aac +required = False + [externals_description] schema_version = 1.0.0 From c80bf40a75c36afc06f400b825c33add37ce6f7a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 22 Mar 2020 15:35:34 -0600 Subject: [PATCH 0699/1973] Move documentation images up a level Having this under doc rather than doc/source seems to make more sense. In addition, I think this will prevent the documentation build from looking in here for files to build (otherwise, I think I would need to add this directory to the exclude list in conf.py). --- .gitignore | 2 +- Externals_CLM.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c4e9ffb366..2c7a551197 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ manage_externals.log /tools/PTCLM/ /cime/ /components/ -/doc/source/images/ +/doc/images/ # ignore svn directories **/.svn/** diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 1ca392b31f..f01e14ebb2 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -13,7 +13,7 @@ tag = PTCLM2_180611 required = True [doc-images] -local_path = doc/source/images +local_path = doc/images protocol = git repo_url = https://github.com/ESCOMP/CTSM-doc-images.git hash = 0f039e7a043fabfce91ddf4f41186a3014603aac From fc67ffa5998488430eed83629c2f0e2cdc34819f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 22 Mar 2020 16:58:57 -0600 Subject: [PATCH 0700/1973] Update paths etc. to allow documentation build from here I tested the build with: make BUILDDIR=../../../ctsm-docs/doc/build clean make BUILDDIR=../../../ctsm-docs/doc/build html A few warnings were generated in the build, but I'm pretty sure I got exactly those same warnings when building from the gh-pages branch. I compared against a previous documentation build I had done from the gh-pages branch - i.e., before moving the documentation source into this repository. The differences seemed minor / trivial: - Differences in a bunch of generated math svg files - at a glance, from spot-checking a few, it looks like some lines got moved around - Differences in `html/_sources`, as expected (changes reflecting the changes I made in paths) (I didn't look super closely, but this looked like all it was, from a quick glance) - Differences in `html/searchindex.js` (not surprising) - Some minor changes in some `users_guide` files, that (at a glance) look to all originate from the fact that it was pulling in README files from the current branch (based on master) rather than the release branch (which is what I used when building from the gh-pages branch). So it seems like I have faithfully reproduced the documentation build from before. --- doc/source/conf.py | 5 +---- .../tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 2 +- .../Decomposition/CLM50_Tech_Note_Decomposition.rst | 4 ++-- .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 2 +- .../CLM50_Tech_Note_External_Nitrogen_Cycle.rst | 2 +- .../tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst | 4 ++-- .../Hydrology/CLM50_Tech_Note_Hydrology.rst | 4 ++-- .../Introduction/CLM50_Tech_Note_Introduction.rst | 2 +- .../tech_note/MOSART/CLM50_Tech_Note_MOSART.rst | 2 +- .../tech_note/Methane/CLM50_Tech_Note_Methane.rst | 2 +- .../CLM50_Tech_Note_Plant_Hydraulics.rst | 4 ++-- .../CLM50_Tech_Note_Radiative_Fluxes.rst | 2 +- .../CLM50_Tech_Note_Snow_Hydrology.rst | 2 +- .../CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 2 +- .../CLM50_Tech_Note_Transient_Landcover.rst | 6 +++--- .../tech_note/Urban/CLM50_Tech_Note_Urban.rst | 6 +++--- ...LM50_Tech_Note_Vegetation_Phenology_Turnover.rst | 2 +- doc/source/tech_note/conf.py | 4 +--- doc/source/users_guide/conf.py | 13 +------------ doc/source/users_guide/overview/introduction.rst | 2 +- doc/source/users_guide/overview/quickstart.rst | 2 +- .../users_guide/overview/scientific_validation.rst | 2 +- .../running-PTCLM/introduction-to-ptclm.rst | 2 +- ...p-the-Satellite-Phenology-Model-CLMSP-spinup.rst | 4 ++-- .../Spinning-up-the-biogeochemistry-BGC-spinup.rst | 8 ++++---- doc/source/users_guide/testing/testing.rst | 8 ++++---- .../using-clm-tools/building-the-clm-tools.rst | 2 +- .../using-clm-tools/creating-domain-files.rst | 4 ++-- ...reating-input-for-surface-dataset-generation.rst | 2 +- .../using-clm-tools/creating-surface-datasets.rst | 6 +++--- 30 files changed, 48 insertions(+), 64 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index a561207501..30259e17b3 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -73,10 +73,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [ - "clm5.0", - "**/README_EXTERNALS.rst" -] +exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst index 9bddee21ca..63024c7e0e 100644 --- a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -35,7 +35,7 @@ variables for vegetation carbon, and 22 for vegetation nitrogen. .. _Figure Vegetation fluxes and pools: -.. figure:: CLMCN_pool_structure_v2_lores.png +.. figure:: ../../../images/tech_note/CN_Pools/CLMCN_pool_structure_v2_lores.png :width: 753px :height: 513px diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index 0d2ad98687..baeb744dcb 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -20,7 +20,7 @@ calculations (see Section :numref:`Soil Layers` for soil layering). .. _Figure Schematic of decomposition model in CLM: -.. figure:: CLM4_vertsoil_soilstruct_drawing.png +.. figure:: ../../../images/tech_note/Decomposition/CLM4_vertsoil_soilstruct_drawing.png Schematic of decomposition model in CLM. @@ -65,7 +65,7 @@ structures is in :ref:`Koven et al. (2013) `. .. _Figure Pool structure: -.. figure:: soil_C_pools_CN_century.png +.. figure:: ../../../images/tech_note/Decomposition/soil_C_pools_CN_century.png Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index d90c8cab40..2fbbaeff9a 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -53,7 +53,7 @@ classes. .. _Figure CLM subgrid hierarchy: -.. Figure:: image1.png +.. Figure:: ../../../images/tech_note/Ecosystem/image1.png Configuration of the CLM subgrid hierarchy. Box in upper right shows hypothetical subgrid distribution for a single grid cell. Note that the Crop land unit is only used when the model is run with the crop model active. Abbreviations: TBD – Tall Building District; HD – High Density; MD – Medium Density, G – Glacier, L – Lake, U – Urban, C – Crop, V – Vegetated, PFT – Plant Functional Type, Irr – Irrigated, UIrr – Unirrigated. Red arrows indicate allowed land unit transitions. Purple arrows indicate allowed patch-level transitions. diff --git a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst index ca7a4a9d2c..8d1016380d 100644 --- a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst +++ b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst @@ -118,7 +118,7 @@ Where :math:`{NF}_{nfix,sminn}` (gN m\ :sup:`-2` s\ :sup:`-1`) is the rate of fr .. _Figure Biological nitrogen fixation: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/External_Nitrogen_Cycle/image1.png Free-living nitrogen fixation as a function of annual evapotranspiration. Results here show annual N inputs from free-living N fixations, but the model actually calculates inputs on a per second basis. diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index d967cd5ff0..a0b7e04ac3 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -961,14 +961,14 @@ height :math:`z_{0h} ^{{'} }` and the canopy air at height .. _Figure Schematic diagram of sensible heat fluxes: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/Fluxes/image1.png Figure Schematic diagram of sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. .. _Figure Schematic diagram of latent heat fluxes: -.. figure:: image2.png +.. figure:: ../../../images/tech_note/Fluxes/image2.png Figure Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index c4e0824ea7..6e0b593d29 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -38,7 +38,7 @@ al. 2008) ` and :math:`\Delta t` is the time step (s). .. _Figure Hydrologic processes: -.. Figure:: hydrologic.processes.png +.. Figure:: ../../../images/tech_note/Hydrology/hydrologic.processes.png Hydrologic processes represented in CLM. @@ -798,7 +798,7 @@ the effective root fraction :math:`r_{e,\, i}` .. _Figure Water flux schematic: -.. Figure:: image2.png +.. Figure:: ../../../images/tech_note/Hydrology/image2.png Schematic diagram of numerical scheme used to solve for soil water fluxes. diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 7240dfa8d9..df3201827e 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -627,6 +627,6 @@ processes simulated include (:numref:`Figure Land processes`): .. _Figure Land processes: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/Introduction/image1.png Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from :ref:`Lawrence et al. (2011)` for CLM5.0). diff --git a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst index 439de8a7a1..dbd07703ee 100644 --- a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst +++ b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst @@ -47,7 +47,7 @@ and discharges the water to its downstream spatial unit or the ocean. .. _Figure MOSART conceptual diagram: -.. figure:: mosart_diagram.png +.. figure:: ../../../images/tech_note/MOSART/mosart_diagram.png :width: 800px :height: 400px diff --git a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst index 7c89f857e3..8c92a24556 100644 --- a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst +++ b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst @@ -89,7 +89,7 @@ into the inundated concentration when the inundated fraction increases. .. _Figure Methane Schematic: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/Methane/image1.png Schematic representation of biological and physical processes integrated in CLM that affect the net CH\ :sub:`4` diff --git a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index b2afa06646..e1ecb07118 100644 --- a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -159,7 +159,7 @@ on leaf water potential. .. _Figure Plant hydraulic circuit: -.. figure:: circuit.jpg +.. figure:: ../../../images/tech_note/Plant_Hydraulics/circuit.jpg Circuit diagram of plant hydraulics scheme @@ -714,6 +714,6 @@ The outermost level of iteration works towards convergence of leaf temperature, .. _Figure PHS Flow Diagram: -.. figure:: flow.png +.. figure:: ../../../images/tech_note/Plant_Hydraulics/flow.png Flow diagram of leaf flux calculations diff --git a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst index 5e368456ba..a687d5bc2d 100644 --- a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst +++ b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst @@ -37,7 +37,7 @@ depth of direct beam per unit leaf and stem area (section :numref:`Canopy Radiat .. _Figure Radiation Schematic: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/Radiative_Fluxes/image1.png Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index 8d22a19bc9..2d58d36795 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -18,7 +18,7 @@ snow pack. .. _Figure three layer snow pack: -.. Figure:: image1.png +.. Figure:: ../../../images/tech_note/Snow_Hydrology/image1.png Example of three layer snow pack (:math:`snl=-3`). diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst index 56b6adff3f..efbb382f45 100644 --- a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst @@ -223,7 +223,7 @@ interface of two layers .. _Figure Soil Temperature Schematic: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/Soil_Snow_Temperatures/image1.png Schematic diagram of numerical scheme used to solve for soil temperature. diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index de7ef86173..637dd28d05 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -347,18 +347,18 @@ data files in the mksurfdata_map tool. .. _Figure Schematic of land cover change: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/Transient_Landcover/image1.png Schematic of land cover change impacts on CLM carbon pools and fluxes. .. _Figure Schematic of translation of annual LUH2 land units: -.. figure:: image2.png +.. figure:: ../../../images/tech_note/Transient_Landcover/image2.png Schematic of translation of annual LUH2 land units to CLM5 plant and crop functional types. .. _Figure Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool: -.. figure:: image3.png +.. figure:: ../../../images/tech_note/Transient_Landcover/image3.png Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index e9d9261b0d..c63e8a37b1 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -128,7 +128,7 @@ interior building temperature at yearly time resolution. .. _Figure schematic representation of the urban landunit: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/Urban/image1.png Schematic representation of the urban land unit. See the text for description of notation. Incident, reflected, and net solar and longwave radiation are calculated for each individual surface but are not shown for clarity. @@ -136,7 +136,7 @@ interior building temperature at yearly time resolution. .. _Figure schematic of urban and atmospheric model coupling: -.. Figure:: image2.png +.. Figure:: ../../../images/tech_note/Urban/image2.png Schematic of urban and atmospheric model coupling. The urban model is forced by the atmospheric model wind (:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar (:math:`S_{atm} \, \downarrow` ) and longwave (:math:`L_{atm} \, \downarrow` ) radiation at reference height :math:`z'_{atm}` (section :numref:`Atmospheric Coupling`). Fluxes from the urban landunit to the atmosphere are turbulent sensible (:math:`H`) and latent heat (:math:`\lambda E`), momentum (:math:`\tau` ), albedo (:math:`I\uparrow` ), emitted longwave (:math:`L\uparrow` ), and absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature (:math:`T_{ac}` ), specific humidity (:math:`q_{ac}` ), and wind speed (:math:`u_{c}` ) within the urban canopy layer are diagnosed by the urban model. :math:`H` is the average building height. @@ -144,7 +144,7 @@ interior building temperature at yearly time resolution. .. _Figure schematic of THESIS urban properties tool: -.. Figure:: image3.gif +.. Figure:: ../../../images/tech_note/Urban/image3.gif Schematic of THESIS urban properties tool. Executable scripts are in orange, input files are blue, and output files are green. Items within the black box outline are either read in as input, executed, or output by the driver script (urban_prop.csh). diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index 7ede3405e0..ffa2a5c96d 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -33,7 +33,7 @@ storage over the course of a single growing season. .. _Figure annual phenology cycle: -.. figure:: image1.png +.. figure:: ../../../images/tech_note/Vegetation_Phenology_Turnover/image1.png Example of annual phenology cycle for seasonal deciduous. diff --git a/doc/source/tech_note/conf.py b/doc/source/tech_note/conf.py index 69d97bf9eb..5c5b1d86ad 100644 --- a/doc/source/tech_note/conf.py +++ b/doc/source/tech_note/conf.py @@ -73,9 +73,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [ - "clm5.0/*" -] +exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py index 687732893a..ab8a299b9f 100644 --- a/doc/source/users_guide/conf.py +++ b/doc/source/users_guide/conf.py @@ -76,18 +76,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [ - "clm5.0/manage_externals", - "clm5.0/components", - "clm5.0/cime/scripts", - "clm5.0/cime/doc", - "clm5.0/cime/config", - "clm5.0/cime/tools/statistical_ensemble_test", - "clm5.0/cime/src", - "clm5.0/cime/utils", - "**/README_EXTERNALS.rst", - "clm5.0/README.rst" -] +exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' diff --git a/doc/source/users_guide/overview/introduction.rst b/doc/source/users_guide/overview/introduction.rst index c3d29ab83b..a7a9ef434c 100644 --- a/doc/source/users_guide/overview/introduction.rst +++ b/doc/source/users_guide/overview/introduction.rst @@ -153,7 +153,7 @@ README file describing |version| The README (which can be found in ``$CTSMROOT/doc``) is repeated here. -.. include:: ../../clm5.0/README +.. include:: ../../../../README :literal: .. _best-practices-for-usage: diff --git a/doc/source/users_guide/overview/quickstart.rst b/doc/source/users_guide/overview/quickstart.rst index 9160666051..65398200e9 100644 --- a/doc/source/users_guide/overview/quickstart.rst +++ b/doc/source/users_guide/overview/quickstart.rst @@ -31,5 +31,5 @@ Note other directories have README files that explain different components and t The Quickstart.GUIDE (which can be found in ``$CTSMROOT/doc``) is repeated here. -.. include:: ../../clm5.0/doc/Quickstart.GUIDE +.. include:: ../../../Quickstart.GUIDE :literal: diff --git a/doc/source/users_guide/overview/scientific_validation.rst b/doc/source/users_guide/overview/scientific_validation.rst index 9b38be4808..d05497a645 100644 --- a/doc/source/users_guide/overview/scientific_validation.rst +++ b/doc/source/users_guide/overview/scientific_validation.rst @@ -27,5 +27,5 @@ The IMPORTANT_NODES file goes into more details on this. The IMPORTANT_NOTES (which can be found in ``$CTSMROOT/doc``) is repeated here. -.. include:: ../../clm5.0/doc/IMPORTANT_NOTES +.. include:: ../../../IMPORTANT_NOTES :literal: diff --git a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst index 1eaf471739..04fad02db2 100644 --- a/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst +++ b/doc/source/users_guide/running-PTCLM/introduction-to-ptclm.rst @@ -135,5 +135,5 @@ Example 6-1. Example of running PTCLMmkdata for US-UMB on cheyenne PTCLMmkdata includes a README file that gives some extra details and a simple example. -.. include:: ../../clm5.0/tools/PTCLM/README +.. include:: ../../../../tools/PTCLM/README :literal: diff --git a/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst b/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst index d6b6c74d91..a93610f9fa 100644 --- a/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst +++ b/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst @@ -19,7 +19,7 @@ a specified equilibrium state (denoted by the dotted lines) due to the different .. _Figure SP spinup plot for 1850: -.. figure:: image1.png +.. figure:: ../../../images/users_guide/running-special-cases/image1.png SP spinup plot for year 1850. Variables examined are FSH (sensible heat flux), EFLX_LH_TOT (latent heat flux), GPP (photosynthesis), TWS (total water storage), H2OSOI (volumetric soil water in layer 8) and TSOI (soil temperature in layer 10). Generated using .../tools/contrib/SpinupStability_SP.ncl. @@ -28,6 +28,6 @@ Again, it takes about 10 years to reach equilibrium. .. _Figure SP spinup plot for 2000 CO2: -.. figure:: image2.png +.. figure:: ../../../images/users_guide/running-special-cases/image2.png SP spinup plot for year 2000 CO2. Variables examined are FSH (sensible heat flux), EFLX_LH_TOT (latent heat flux), GPP (photosynthesis), TWS (total water storage), H2OSOI (volumetric soil water in layer 8) and TSOI (soil temperature in layer 10). Generated using .../tools/contrib/SpinupStability_SP.ncl. diff --git a/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst b/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst index 9808ceb05b..3ad4bdb5a5 100644 --- a/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst +++ b/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst @@ -12,7 +12,7 @@ total ecosystem carbon disequilibrium takes the longest to satisfy due to slow s .. _Figure BGC AD spinup plot for 1850 GSWP3: -.. figure:: image3.png +.. figure:: ../../../images/users_guide/running-special-cases/image3.png BGC AD spinup plot for a year 1850 case with GSWP3 atmospheric forcing. Variables examined are TOTECOSYSC (total ecosystem carbon), TOTSOMC (total soil organic matter carbon), TOTVEGC (total vegetation carbon), TLAI (total leaf area index), GPP (gross primary production) and TWS (total water storage). Generated using .../tools/contrib/SpinupStability.ncl. @@ -24,7 +24,7 @@ criteria depending on their application. .. _Figure BGC pAD spinup plot for 1850 GSWP3: -.. figure:: image4.png +.. figure:: ../../../images/users_guide/running-special-cases/image4.png BGC pAD spinup plot for a year 1850 case with GSWP3 atmospheric forcing and initialization from the end of the BGC AD spinup case. Variables examined are TOTECOSYSC (total ecosystem carbon), TOTSOMC (total soil organic matter carbon), TOTVEGC (total vegetation carbon), TLAI (total leaf area index), GPP (gross primary production) and TWS (total water storage). Generated using .../tools/contrib/SpinupStability.ncl. @@ -35,7 +35,7 @@ such as TLAI (total leaf area index), GPP (gross primary production), and TWS (t .. _Figure BGC initialized spinup plot for 1850: -.. figure:: image5.png +.. figure:: ../../../images/users_guide/running-special-cases/image5.png BGC initialized spinup plot for year 1850. Variables examined are TOTECOSYSC (total ecosystem carbon), TOTSOMC (total soil organic matter carbon), TOTVEGC (total vegetation carbon), TLAI (total leaf area index), GPP (gross primary production) and TWS (total water storage). Generated using .../tools/contrib/SpinupStability.ncl. @@ -44,7 +44,7 @@ Again, it takes about 10 years to reach equilibrium for TLAI, GPP, and TWS. .. _Figure BGC initialized spinup plot for 2000 CO2: -.. figure:: image6.png +.. figure:: ../../../images/users_guide/running-special-cases/image6.png BGC initialized spinup plot for year 2000 CO2. Variables examined are TOTECOSYSC (total ecosystem carbon), TOTSOMC (total soil organic matter carbon), TOTVEGC (total vegetation carbon), TLAI (total leaf area index), GPP (gross primary production) and TWS (total water storage). Generated using .../tools/contrib/SpinupStability.ncl. diff --git a/doc/source/users_guide/testing/testing.rst b/doc/source/users_guide/testing/testing.rst index 04f90fc3d3..a01630c293 100644 --- a/doc/source/users_guide/testing/testing.rst +++ b/doc/source/users_guide/testing/testing.rst @@ -29,13 +29,13 @@ see the `CTSM Wiki on Testing Date: Sun, 22 Mar 2020 20:16:44 -0700 Subject: [PATCH 0701/1973] fix indentation and remove unnecessary restart variables --- src/biogeochem/CNVegCarbonFluxType.F90 | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 3cf3fe56ba..33f7fdb412 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -838,12 +838,12 @@ subroutine InitHistory(this, bounds, carbon_type) avgflag='A', long_name='grain C to food', & ptr_patch=this%grainc_to_food_patch) - this%leafc_to_biofuelc_patch(begp:endp) = spval + this%leafc_to_biofuelc_patch(begp:endp) = spval call hist_addfld1d (fname='LEAFC_TO_BIOFUELC', units='gC/m^2/s', & avgflag='A', long_name='leaf C to biofuel C', & ptr_patch=this%leafc_to_biofuelc_patch) - this%livestemc_to_biofuelc_patch(begp:endp) = spval + this%livestemc_to_biofuelc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMC_TO_BIOFUELC', units='gC/m^2/s', & avgflag='A', long_name='livestem C to biofuel C', & ptr_patch=this%livestemc_to_biofuelc_patch) @@ -3534,16 +3534,6 @@ subroutine RestartBulkOnly ( this, bounds, ncid, flag ) dim1name='pft', & long_name='grain C to food', units='gC/m2/s', & interpinic_flag='interp', readvar=readvar, data=this%grainc_to_food_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafc_to_biofuelc', xtype=ncd_double, & - dim1name='pft', & - long_name='leaf C to biofuel C', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_to_biofuelc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_to_biofuelc', xtype=ncd_double, & - dim1name='pft', & - long_name='livestem C to biofuel C', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_to_biofuelc_patch) call restartvar(ncid=ncid, flag=flag, varname='cpool_to_grainc', xtype=ncd_double, & dim1name='pft', & From cd591c2688dd60154563d7209fbabf337e40f60d Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 22 Mar 2020 20:17:36 -0700 Subject: [PATCH 0702/1973] fix indentation --- src/biogeochem/CNVegNitrogenFluxType.F90 | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90 index b79f71986f..a287d5dc0f 100644 --- a/src/biogeochem/CNVegNitrogenFluxType.F90 +++ b/src/biogeochem/CNVegNitrogenFluxType.F90 @@ -1379,20 +1379,6 @@ subroutine Restart (this, bounds, ncid, flag ) interpinic_flag='interp', readvar=readvar, data=this%grainn_to_food_patch) end if - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='leafn_to_biofueln', xtype=ncd_double, & - dim1name='pft', & - long_name='leaf N to biofuel N', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_to_biofueln_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='livestemn_to_biofueln', xtype=ncd_double, & - dim1name='pft', & - long_name='livestem N to biofuel N', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_to_biofueln_patch) - end if - if (use_crop) then call restartvar(ncid=ncid, flag=flag, varname='npool_to_grainn', xtype=ncd_double, & dim1name='pft', & From c6f037aff98dcf50fabe39710c3390507731654c Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 22 Mar 2020 20:21:11 -0700 Subject: [PATCH 0703/1973] move calculation of leafc_to_biofuelc to only for prognostic crops, change to longer growing season for bioenergy crops --- src/biogeochem/CNPhenologyMod.F90 | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index af0908dce9..272747e61e 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -1972,7 +1972,11 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! the onset_counter would change from dt and you'd need to make ! changes to the offset subroutine below - else if (hui(p) >= gddmaturity(p) .or. idpp >= mxmat(ivt(p))) then + else if ((idpp >= mxmat(ivt(p)) .and. (ivt(p) == nmiscanthus .or. ivt(p) == nirrig_miscanthus .or. & + ivt(p) == nswitchgrass .or. ivt(p) == nirrig_switchgrass)) .or. & + ((hui(p) >= gddmaturity(p) .or. idpp >= mxmat(ivt(p))) .and. & + (ivt(p) /= nmiscanthus .and. ivt(p) /= nirrig_miscanthus .and. & + ivt(p) /= nswitchgrass .and. ivt(p) /= nirrig_switchgrass))) then if (harvdate(p) >= NOT_Harvested) harvdate(p) = jday croplive(p) = .false. ! no re-entry in greater if-block cphase(p) = 4._r8 @@ -2473,11 +2477,8 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & t1 = 1.0_r8 / dt frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) - ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of leaf C - ! and move this fration of leaf C to biofuel C, rather than move it to litter + ! harvfrac is only non-zero for prognostic crops. leafc_to_litter(p) = t1 * leafc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_leafc(p) - leafc_to_biofuelc(p) = t1 * leafc(p) * harvfrac(ivt(p)) - leafn_to_biofueln(p) = t1 * leafn(p) * harvfrac(ivt(p)) ! this assumes that offset_counter == dt for crops ! if this were ever changed, we'd need to add code to the "else" @@ -2491,12 +2492,17 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & ! Send the remaining grain to the food product pool grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) + + ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of leaf C + ! and move this fration of leaf C to biofuel C, rather than move it to litter + leafc_to_biofuelc(p) = t1 * leafc(p) * harvfrac(ivt(p)) + leafn_to_biofueln(p) = t1 * leafn(p) * harvfrac(ivt(p)) ! Cut a certain fraction (i.e., harvfrac(ivt(p))) (e.g., harvfrac(ivt(p)=70% for bioenergy crops) of livestem C ! and move this fration of leaf C to biofuel C, rather than move it to litter - livestemc_to_litter(p) = t1 * livestemc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_livestemc(p) + livestemc_to_litter(p) = t1 * livestemc(p)*(1._r8-harvfrac(ivt(p))) + cpool_to_livestemc(p) livestemc_to_biofuelc(p) = t1 * livestemc(p) * harvfrac(ivt(p)) - livestemn_to_biofueln(p) = t1 * livestemn(p) * harvfrac(ivt(p)) + livestemn_to_biofueln(p) = t1 * livestemn(p) * harvfrac(ivt(p)) end if else t1 = dt * 2.0_r8 / (offset_counter(p) * offset_counter(p)) @@ -2578,7 +2584,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & ! NOTE(slevis, 2014-12) results in -ve livestemn and -ve totpftn !X! livestemn_to_litter(p) = livestemc_to_litter(p) / livewdcn(ivt(p)) ! NOTE(slevis, 2014-12) Beth Drewniak suggested this instead - livestemn_to_litter(p) = livestemn(p) / dt + livestemn_to_litter(p) = livestemn(p) / dt * (1 - harvfrac(ivt(p))) end if ! save the current litterfall fluxes From 39fcf0747e422f73d869abd8f7d40de52e741241 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 22 Mar 2020 21:01:12 -0700 Subject: [PATCH 0704/1973] remove unnecessary lines --- src/biogeochem/CNCIsoFluxMod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/biogeochem/CNCIsoFluxMod.F90 b/src/biogeochem/CNCIsoFluxMod.F90 index cfa280f678..eeb6ebe435 100644 --- a/src/biogeochem/CNCIsoFluxMod.F90 +++ b/src/biogeochem/CNCIsoFluxMod.F90 @@ -1209,8 +1209,6 @@ subroutine CNCIsoLitterToColumn (num_soilc, filter_soilc, & !DML livestemc_to_litter => iso_cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] grainc_to_food => iso_cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] - leafc_to_biofuelc => iso_cnveg_carbonflux_inst%leafc_to_biofuelc_patch , & ! Input: [real(r8) (:) ] - livestemc_to_biofuelc => iso_cnveg_carbonflux_inst%livestemc_to_biofuelc_patch , & ! Input: [real(r8) (:) ] !DML phenology_c_to_litr_met_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) phenology_c_to_litr_cel_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) From 38ca1b37f4fa2e281e221af91039a7fd992bb49d Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 22 Mar 2020 21:01:59 -0700 Subject: [PATCH 0705/1973] fix indentation --- src/biogeochem/CNCStateUpdate1Mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNCStateUpdate1Mod.F90 b/src/biogeochem/CNCStateUpdate1Mod.F90 index 47794240a5..7063c92214 100644 --- a/src/biogeochem/CNCStateUpdate1Mod.F90 +++ b/src/biogeochem/CNCStateUpdate1Mod.F90 @@ -274,7 +274,6 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & ! phenology: litterfall fluxes cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_litter_patch(p)*dt - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_biofuelc_patch(p)*dt cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) - cf_veg%frootc_to_litter_patch(p)*dt ! livewood turnover fluxes @@ -287,6 +286,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & if (ivt(p) >= npcropmin) then ! skip 2 generic crops cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_litter_patch(p)*dt cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_biofuelc_patch(p)*dt + cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_biofuelc_patch(p)*dt cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) & - (cf_veg%grainc_to_food_patch(p) + cf_veg%grainc_to_seed_patch(p))*dt cs_veg%cropseedc_deficit_patch(p) = cs_veg%cropseedc_deficit_patch(p) & From 8e141ad97043de3155426204b05de36bbd7554b5 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 22 Mar 2020 21:02:18 -0700 Subject: [PATCH 0706/1973] fix indentation --- src/biogeochem/CNNStateUpdate1Mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNNStateUpdate1Mod.F90 b/src/biogeochem/CNNStateUpdate1Mod.F90 index 8c6c0c2968..e04e9dd831 100644 --- a/src/biogeochem/CNNStateUpdate1Mod.F90 +++ b/src/biogeochem/CNNStateUpdate1Mod.F90 @@ -175,7 +175,6 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & ! phenology: litterfall and retranslocation fluxes ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_litter_patch(p)*dt - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_biofueln_patch(p)*dt ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - nf_veg%frootn_to_litter_patch(p)*dt ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_retransn_patch(p)*dt ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%leafn_to_retransn_patch(p)*dt @@ -196,6 +195,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%frootn_to_retransn_patch(p)*dt ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_litter_patch(p)*dt ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_biofueln_patch(p)*dt + ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_biofueln_patch(p)*dt ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_retransn_patch(p)*dt ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%livestemn_to_retransn_patch(p)*dt ns_veg%grainn_patch(p) = ns_veg%grainn_patch(p) & From 0ec0288b3c342dd26799a7eb5a3d0b3d1179f391 Mon Sep 17 00:00:00 2001 From: chen693 Date: Sun, 22 Mar 2020 21:02:34 -0700 Subject: [PATCH 0707/1973] fix indentation --- src/biogeochem/CNBalanceCheckMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index 4f78fc6ac7..e780e4a804 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -272,7 +272,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & col_fire_nloss => cnveg_nitrogenflux_inst%fire_nloss_col , & ! Input: [real(r8) (:) ] (gN/m2/s) total column-level fire N loss wood_harvestn => cnveg_nitrogenflux_inst%wood_harvestn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) wood harvest (to product pools) grainn_to_cropprodn => cnveg_nitrogenflux_inst%grainn_to_cropprodn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) grain N to 1-year crop product pool - biofueln_to_cropprodn => cnveg_nitrogenflux_inst%biofueln_to_cropprodn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) biofuel N to 1-year crop product pool + biofueln_to_cropprodn => cnveg_nitrogenflux_inst%biofueln_to_cropprodn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) biofuel N to 1-year crop product pool totcoln => cnveg_nitrogenstate_inst%totn_col & ! Input: [real(r8) (:) ] (gN/m2) total column nitrogen, incl veg ) From b9d1ddf79f65a9c568bacb5b14e120966836bc07 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 23 Mar 2020 13:08:20 -0600 Subject: [PATCH 0708/1973] changes for nuopc threading --- src/biogeochem/CNVegetationFacade.F90 | 54 ++++++++++++++------------- src/main/initSubgridMod.F90 | 45 +++++++++++----------- 2 files changed, 49 insertions(+), 50 deletions(-) diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 4327a4e7ce..0dda6c6727 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -68,7 +68,7 @@ module CNVegetationFacade use WaterFluxBulkType , only : waterfluxbulk_type use Wateratm2lndBulkType , only : wateratm2lndbulk_type use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type + use TemperatureType , only : temperature_type use CropType , only : crop_type use ch4Mod , only : ch4_type use CNDVType , only : dgvs_type @@ -148,7 +148,7 @@ module CNVegetationFacade ! - vocemis_inst ! - fireemis_inst ! - drydepvel_inst - + contains procedure, public :: Init procedure, public :: InitAccBuffer @@ -219,7 +219,7 @@ subroutine Init(this, bounds, NLFilename, nskip_steps) ! Note - always initialize the memory for cnveg_state_inst (used in biogeophys/) call this%cnveg_state_inst%Init(bounds) - + skip_steps = nskip_steps if (use_cn) then @@ -249,7 +249,7 @@ subroutine Init(this, bounds, NLFilename, nskip_steps) this%cnveg_carbonstate_inst%frootc_patch(begp:endp), & this%cnveg_carbonstate_inst%frootc_storage_patch(begp:endp), & this%cnveg_carbonstate_inst%deadstemc_patch(begp:endp) ) - call this%cnveg_nitrogenflux_inst%Init(bounds) + call this%cnveg_nitrogenflux_inst%Init(bounds) call this%c_products_inst%Init(bounds, species_non_isotope_type('C')) if (use_c13) then @@ -338,7 +338,7 @@ end subroutine CNReadNML subroutine InitAccBuffer(this, bounds) ! ! !DESCRIPTION: - ! Initialize accumulation buffer for types contained here + ! Initialize accumulation buffer for types contained here ! ! !USES: ! @@ -430,9 +430,9 @@ subroutine Restart(this, bounds, ncid, flag) ! ! !ARGUMENTS: class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag + type(bounds_type), intent(in) :: bounds + type(file_desc_t), intent(inout) :: ncid + character(len=*) , intent(in) :: flag integer :: reseed_patch(bounds%endp-bounds%begp+1) integer :: num_reseed_patch ! @@ -645,7 +645,7 @@ subroutine DynamicAreaConservation(this, bounds, clump_index, & ! ! !ARGUMENTS: class(cn_vegetation_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds ! Index of clump on which we're currently operating. Note that this implies that this ! routine must be called from within a clump loop. @@ -743,7 +743,7 @@ subroutine InitColumnBalance(this, bounds, num_allc, filter_allc, & ! ! !ARGUMENTS: class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_allc ! number of columns in allc filter integer , intent(in) :: filter_allc(:) ! filter for all active columns integer , intent(in) :: num_soilc ! number of soil columns in filter @@ -807,7 +807,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & ! ! !ARGUMENTS: class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilc ! number of soil columns in filter integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter @@ -870,7 +870,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & this%dgvs_inst, photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, this%cnfire_method) - ! fire carbon emissions + ! fire carbon emissions call CNFireEmisUpdate(bounds, num_soilp, filter_soilp, & this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, fireemis_inst ) @@ -899,7 +899,7 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & ! ! !ARGUMENTS: class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_allc ! number of columns in allc filter integer , intent(in) :: filter_allc(:) ! filter for all active columns integer , intent(in) :: num_soilc ! number of soil columns in filter @@ -927,9 +927,9 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & character(len=*), parameter :: subname = 'EcosystemDynamicsPostDrainage' !----------------------------------------------------------------------- - ! Update the nitrogen leaching rate as a function of soluble mineral N + ! Update the nitrogen leaching rate as a function of soluble mineral N ! and total soil water outflow. - + call CNDriverLeaching(bounds, & num_soilc, filter_soilc, & num_soilp, filter_soilp, & @@ -937,7 +937,7 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & this%cnveg_nitrogenflux_inst, this%cnveg_nitrogenstate_inst, & soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - ! Set controls on very low values in critical state variables + ! Set controls on very low values in critical state variables call t_startf('CNPrecisionControl') call CNPrecisionControl(bounds, num_soilp, filter_soilp, & @@ -982,7 +982,7 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & ! On the radiation time step, use C state variables to calculate ! vegetation structure (LAI, SAI, height) - if (doalb) then + if (doalb) then call CNVegStructUpdate(num_soilp, filter_soilp, & waterdiagnosticbulk_inst, frictionvel_inst, this%dgvs_inst, this%cnveg_state_inst, & crop_inst, this%cnveg_carbonstate_inst, canopystate_inst) @@ -1004,7 +1004,7 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & ! ! !ARGUMENTS: class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilc ! number of soil columns in filter integer , intent(in) :: filter_soilc(:) ! filter for soil columns type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst @@ -1019,7 +1019,9 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & DA_nstep = get_nstep_since_startup_or_lastDA_restart_or_pause() if (DA_nstep <= skip_steps )then if (masterproc) then +!$OMP MASTER write(iulog,*) '--WARNING-- skipping CN balance check for first timesteps after startup or data assimilation' +!$OMP END MASTER end if else @@ -1050,7 +1052,7 @@ subroutine EndOfTimeStepVegDynamics(this, bounds, num_natvegp, filter_natvegp, & ! ! !ARGUMENTS: class(cn_vegetation_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(inout) :: num_natvegp ! number of naturally-vegetated patches in filter integer , intent(inout) :: filter_natvegp(:) ! filter for naturally-vegetated patches type(atm2lnd_type) , intent(inout) :: atm2lnd_inst @@ -1116,7 +1118,7 @@ subroutine WriteHistory(this, bounds) ! ! !ARGUMENTS: class(cn_vegetation_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds ! ! !LOCAL VARIABLES: @@ -1359,12 +1361,12 @@ function get_froot_carbon_patch(this, bounds, tlai) result(froot_carbon_patch) else ! To get leaf biomass: ! bleaf = LAI / slatop -! g/m2 = m2/m2 / m2/g -! To get root biomass: +! g/m2 = m2/m2 / m2/g +! To get root biomass: ! broot = bleaf * froot_leaf(ivt(p)) ! g/m2 = g/m2 * g/g do p=bounds%begp, bounds%endp - if (pftcon%slatop(patch%itype(p)) > 0._r8) then + if (pftcon%slatop(patch%itype(p)) > 0._r8) then froot_carbon_patch(p) = tlai(p) & / pftcon%slatop(patch%itype(p)) & *pftcon%froot_leaf(patch%itype(p)) @@ -1404,12 +1406,12 @@ function get_croot_carbon_patch(this, bounds, tlai) result(croot_carbon_patch) else ! To get leaf biomass: ! bleaf = LAI / slatop -! g/m2 = m2/m2 / m2/g -! To get root biomass: +! g/m2 = m2/m2 / m2/g +! To get root biomass: ! broot = bleaf * froot_leaf(ivt(p)) ! g/m2 = g/m2 * g/g do p=bounds%begp, bounds%endp - if (pftcon%slatop(patch%itype(p)) > 0._r8) then + if (pftcon%slatop(patch%itype(p)) > 0._r8) then croot_carbon_patch(p) = tlai(p) & / pftcon%slatop(patch%itype(p)) & *pftcon%stem_leaf(patch%itype(p)) & diff --git a/src/main/initSubgridMod.F90 b/src/main/initSubgridMod.F90 index 43851c337b..7cabcdbbda 100644 --- a/src/main/initSubgridMod.F90 +++ b/src/main/initSubgridMod.F90 @@ -13,10 +13,10 @@ module initSubgridMod use clm_varctl , only : iulog, use_fates use clm_varcon , only : namep, namec, namel use decompMod , only : bounds_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch + use GridcellType , only : grc + use LandunitType , only : lun + use ColumnType , only : col + use PatchType , only : patch use column_varcon , only : is_hydrologically_active ! ! !PUBLIC TYPES: @@ -37,27 +37,27 @@ module initSubgridMod !----------------------------------------------------------------------- contains - + !------------------------------------------------------------------------------ subroutine clm_ptrs_compdown(bounds) ! ! !DESCRIPTION: - ! Assumes the part of the subgrid pointing up has been set. Fills + ! Assumes the part of the subgrid pointing up has been set. Fills ! in the data pointing down. Up is p_c, p_l, p_g, c_l, c_g, and l_g. ! ! This algorithm assumes all indices besides grid cell are monotonically ! increasing. (Note that grid cell index is NOT monotonically increasing, - ! hence we cannot set initial & final indices at the grid cell level - + ! hence we cannot set initial & final indices at the grid cell level - ! grc%luni, grc%lunf, etc.) ! ! Algorithm works as follows. The p, c, and l loops march through ! the full arrays (nump, numc, and numl) checking the "up" indexes. - ! As soon as the "up" index of the current (p,c,l) cell changes relative - ! to the previous (p,c,l) cell, the *i array will be set to point down + ! As soon as the "up" index of the current (p,c,l) cell changes relative + ! to the previous (p,c,l) cell, the *i array will be set to point down ! to that cell. The *f array follows the same logic, so it's always the ! last "up" index from the previous cell when an "up" index changes. ! - ! For example, a case where p_c(1:4) = 1 and p_c(5:12) = 2. This + ! For example, a case where p_c(1:4) = 1 and p_c(5:12) = 2. This ! subroutine will set c_pi(1) = 1, c_pf(1) = 4, c_pi(2) = 5, c_pf(2) = 12. ! ! !USES @@ -79,7 +79,7 @@ subroutine clm_ptrs_compdown(bounds) !--- Loop p through full local begp:endp length !--- Separately check the p_c, p_l, and p_g indexes for a change in !--- the "up" index. - !--- If there is a change, verify that the current c,l,g is within the + !--- If there is a change, verify that the current c,l,g is within the !--- valid range, and set c_pi, l_pi, or g_pi to that current c,l,g !--- Constantly update the c_pf, l_pf, and g_pf array. When the !--- g, l, c index changes, the *_pf array will be set correctly @@ -167,7 +167,7 @@ subroutine clm_ptrs_check(bounds) integer :: ltype ! landunit type logical :: error ! error flag !------------------------------------------------------------------------------ - +!$OMP CRITICAL associate( & begg => bounds%begg, & endg => bounds%endg, & @@ -178,10 +178,8 @@ subroutine clm_ptrs_check(bounds) begp => bounds%begp, & endp => bounds%endp & ) - if (masterproc) write(iulog,*) ' ' if (masterproc) write(iulog,*) '---clm_ptrs_check:' - !--- check index ranges --- error = .false. do g = begg, endg @@ -192,12 +190,12 @@ subroutine clm_ptrs_check(bounds) end if end do end do + if (error) then write(iulog,*) ' clm_ptrs_check: g index ranges - ERROR' call endrun(msg=errMsg(sourcefile, __LINE__)) end if if (masterproc) write(iulog,*) ' clm_ptrs_check: g index ranges - OK' - error = .false. if (minval(lun%gridcell(begl:endl)) < begg .or. maxval(lun%gridcell(begl:endl)) > endg) error=.true. if (minval(lun%coli(begl:endl)) < begc .or. maxval(lun%coli(begl:endl)) > endc) error=.true. @@ -286,7 +284,6 @@ subroutine clm_ptrs_check(bounds) endif enddo if (masterproc) write(iulog,*) ' clm_ptrs_check: p mono increasing - OK' - !--- check that the tree is internally consistent --- error = .false. do g = begg, endg @@ -323,9 +320,9 @@ subroutine clm_ptrs_check(bounds) enddo ! g if (masterproc) write(iulog,*) ' clm_ptrs_check: tree consistent - OK' if (masterproc) write(iulog,*) ' ' - end associate - +!$OMP END CRITICAL + end subroutine clm_ptrs_check !----------------------------------------------------------------------- @@ -346,10 +343,10 @@ subroutine add_landunit(li, gi, ltype, wtgcell) real(r8) , intent(in) :: wtgcell ! weight of the landunit relative to the grid cell ! ! !LOCAL VARIABLES: - + character(len=*), parameter :: subname = 'add_landunit' !----------------------------------------------------------------------- - + li = li + 1 lun%gridcell(li) = gi @@ -442,10 +439,10 @@ subroutine add_patch(pi, ci, ptype, wtcol) ! !LOCAL VARIABLES: integer :: li ! landunit index integer :: lb_offset ! offset between natpft_lb and 1 - + character(len=*), parameter :: subname = 'add_patch' !----------------------------------------------------------------------- - + pi = pi + 1 patch%column(pi) = ci @@ -456,7 +453,7 @@ subroutine add_patch(pi, ci, ptype, wtcol) patch%wtcol(pi) = wtcol ! TODO (MV, 10-17-14): The following must be commented out because - ! currently patch%itype is used in CanopyTemperatureMod to calculate + ! currently patch%itype is used in CanopyTemperatureMod to calculate ! z0m(p) and displa(p) - and is still called even when fates is on !if (.not. use_fates) then @@ -469,7 +466,7 @@ subroutine add_patch(pi, ci, ptype, wtcol) else patch%mxy(pi) = ispval end if - + end subroutine add_patch From 6bcaafec6715b5f44e177d4617d96908f8d197b2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 23 Mar 2020 13:18:19 -0600 Subject: [PATCH 0709/1973] Change CMEPS to my branch --- Externals_cime.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 4751386a44..3eeafa11f6 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,7 +1,7 @@ [cmeps] -hash = 253f612acae07b2b1dc73c84f1bb30b8e1b86ddd +branch = mizuroute protocol = git -repo_url = https://github.com/ESCOMP/CMEPS.git +repo_url = https://github.com/ekluzek/CMEPS.git local_path = src/drivers/nuopc/ required = True From 7d036aafbf9f8d38bfa23223eb54008b8e0402f6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 23 Mar 2020 11:51:55 -0600 Subject: [PATCH 0710/1973] fixed bug --- src/cpl/nuopc/lnd_import_export.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 0838b7a00a..ad99008be8 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -20,7 +20,7 @@ module lnd_import_export use glc2lndMod , only : glc2lnd_type use domainMod , only : ldomain use spmdMod , only : masterproc - use seq_drydep_mod , only : seq_drydep_readnl, n_drydep, seq_drydep_init + use seq_drydep_mod , only : seq_drydep_readnl, n_drydep use shr_megan_mod , only : shr_megan_readnl, shr_megan_mechcomps_n use shr_fire_emis_mod , only : shr_fire_emis_readnl use shr_carma_mod , only : shr_carma_readnl @@ -187,7 +187,6 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r if (drydep_nflds > 0) then call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_ddvel', ungridded_lbound=1, ungridded_ubound=drydep_nflds) end if - call seq_drydep_init( ) ! MEGAN VOC emissions fluxes from land call shr_megan_readnl('drv_flds_in', megan_nflds) From 455f4bfdf39a4a54c39058da404a2638cc9b8014 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 23 Mar 2020 16:47:30 -0600 Subject: [PATCH 0711/1973] Fixes for pdf - Change urban figure from gif to png (gif doesn't work with pdf output) - Remove some broken latex coding from the References section; it doesn't seem like this was accomplishing anything before (based on looking at an old version of the pdf, generated Feb 2019) --- Externals_CLM.cfg | 2 +- .../References/CLM50_Tech_Note_References.rst | 786 ------------------ .../tech_note/Urban/CLM50_Tech_Note_Urban.rst | 2 +- 3 files changed, 2 insertions(+), 788 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index f01e14ebb2..05fe44c0ae 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -16,7 +16,7 @@ required = True local_path = doc/images protocol = git repo_url = https://github.com/ESCOMP/CTSM-doc-images.git -hash = 0f039e7a043fabfce91ddf4f41186a3014603aac +hash = 9e12e5531d8cd3f2e9c6a0154dba8289ffd32c7f required = False [externals_description] diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index c0fe7cc556..f5ffc26b95 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -3,14 +3,8 @@ References ============== -.. |br| raw:: latex - - \\ - .. _Aberetal1990: -|br| - Aber, J.D., Melillo, J.M. and McClaugherty, C.A., 1990. Predicting long-term patterns of mass loss, nitrogen dynamics, and soil organic matter formation from initial fime litter chemistry in temperate forest @@ -18,8 +12,6 @@ ecosystems. Canadian Journal of Botany, 68: 2201-2208. .. _Aberetal2003: -|br| - Aber, J.D., Goodale, C.L., Ollinger, S.V., Smith, M.-L., Magill, A.H., Martin, M.E., Hallett, R.A., and Stoddard, J.L. 2003. Is nitrogen deposition altering the nitrogen status of northeastern forests? @@ -27,32 +19,24 @@ BioScience 53:375-389. .. _Alietal2016: -|br| - Ali, A. A., C. Xu, A. Rogers, R. A. Fisher, S. D. Wullschleger, E. Massoud, J. A. Vrugt, J. D. Muss, N. McDowell, and J. Fisher, 2016: A global scale mechanistic model of photosynthetic capacity (LUNA V1. 0). Geosci. Mod. Dev., 9:587-606. .. _Allenetal2005: -|br| - Allen, C.B., Will, R.E., and Jacobson, M.A. 2005. Production efficiency and radiation use efficiency of four tree species receiving irrigation and fertilization. Forest Science 51:556-569. .. _Anderson1976: -|br| - Anderson, E.A. 1976. A point energy and mass balance model of a snow cover. NOAA Technical Report NWS 19, Office of Hydrology, National Weather Service, Silver Spring, MD. .. _Andréetal1986: -|br| - André, J.-C., Goutorbe, J.-P., and Perrier, A. 1986. HAPEX-MOBILHY: A hydrologic atmosphere experiment for the study of water budget and evaporation flux at the climatic scale. Bull. Amer. Meteor. Soc. @@ -60,53 +44,39 @@ evaporation flux at the climatic scale. Bull. Amer. Meteor. Soc. .. _AndrénPaustian1987: -|br| - Andrén, O. and Paustian, K., 1987. Barley straw decomposition in the field: a comparison of models. Ecology 68:1190-1200. .. _ArahStephen1998: -|br| - Arah, J.R.M. and Stephen, K.D., 1998. A model of the processes leading to methane emission from peatland. Atmos. Environ. 32:3257-3264. .. _ArahVinten1995: -|br| - Arah, J. and Vinten, A., 1995. Simplified models of anoxia and denitrification in aggregated and simple-structured soils. European Journal of Soil Science 46:507-517. .. _Arendtetal2012: -|br| - Arendt, A., et al. 2012. Randolph Glacier Inventory: A Dataset of Global Glacier Outlines Version: 1.0, Global Land Ice Measurements from Space, Boulder Colorado, USA. Digital Media. .. _AroraBoer2005: -|br| - Arora, V.K. and Boer, G.J. 2005. Fire as an interactive component of dynamic vegetation models. J. Geophys. Res. 110:G02008. DOI:10.1029/2005JG000042. .. _Arya2001: -|br| - Arya, S.P. 2001. Introduction to Meteorology. Academic Press, San Diego, CA. .. _Asneretal1998: -|br| - Asner, G.P., Wessman, C.A., Schimel, D.S., and Archer, S. 1998. Variability in leaf and litter optical properties: implications for BRDF model inversions using AVHRR, MODIS, and MISR. Remote Sens. Environ. @@ -114,76 +84,56 @@ model inversions using AVHRR, MODIS, and MISR. Remote Sens. Environ. .. _AxelssonAxelsson1986: -|br| - Axelsson, E., and Axelsson, B. 1986. Changes in carbon allocation patterns in spruce and pine trees following irrigation and fertilization. Tree Phys. 2:189-204. .. _Atkin2016: -|br| - Atkin OK, Bloomfield KJ, Reich PB, Tjoelker MG, Asner GP, Bonal D et al (2015) Global variability in leaf respiration in relation to climate, plant functional types and leaf traits. New Phytologist 206:614–636 .. _Atkin2017: -|br| - Leaf Respiration in Terrestrial Biosphere Models. In Plant Respiration: Metabolic Fluxes and Carbon Balance, Advances in Photosynthesis and Respiration 43, G. Tcherkez, J. Ghashghaie (eds.) Springer International Publishing AG 2017 .. _BadgerandDirmeyer2015: -|br| - Badger, A.M., and Dirmeyer, P.A., 2015. Climate response to Amazon forest replacement by heterogeneous crop cover. Hydrol. Earth. Syst. Sci. 19:4547- 4557. .. _Bairdetal2004: -|br| - Baird, A.J., Beckwith, C.W., Waldron, S. and Waddington, J.M., 2004. Ebullition of methane-containing gas bubbles from near-surface Sphagnum peat. Geophys. Res. Lett. 31. DOI:10.1029/2004GL021157. .. _Baldocchietal2001: -|br| - Baldocchi, D., et al. 2001. FLUXNET: A new tool to study the temporal and spatial variability of ecosystem-scale carbon dioxide, water vapor, and energy flux densities. Bull. Amer. Meteor. Soc. 82:2415-2433. .. _Barbottinetal2005: -|br| - Barbottin, A., Lecomte, C., Bouchard, C., and Jeuffroy, M.-H. 2005. Nitrogen remobilization during grain filling in wheat: Genotypic and environmental effects. Crop Sci. 45:1141-1150. .. _Batjes2006: -|br| - Batjes, N.H., 2006. ISRIC-WISE derived soil properties on a 5 by 5 arc-minutes global grid. Report 2006/02 (available through : http://www.isric.org) .. _Berger1978a: -|br| - Berger, A.L. 1978a. Long-term variations of daily insolation and quaternary climatic changes. J. Atmos. Sci. 35:2362-2367. .. _Berger1978b: -|br| - Berger, A.L. 1978b. A simple algorithm to compute long-term variations of daily or monthly insolation. Contribution de l’Institut d’Astronomie et de Géophysique, Université Catholique de Louvain, Louvain-la-Neuve, @@ -191,37 +141,27 @@ No. 18. .. _Bergeretal1993: -|br| - Berger, A., Loutre, M.-F., and Tricot, C. 1993. Insolation and Earth’s orbital periods. J. Geophys. Res. 98:10341-10362. .. _BerkowitzBalberg1992: -|br| - Berkowitz, B., and Balberg, I. 1992. Percolation approach to the problem of hydraulic conductivity in porous media. Transport in Porous Media 9:275–286. .. _BevenKirkby1979: -|br| - Beven, K.J., and Kirkby, M.J. 1979. A physically based variable contributing area model of basin hydrology. Hydrol. Sci. Bull. 24:43-69. .. _BohrenHuffman1983: -|br| - Bohren, C. F., and Huffman, D. R. 1983. Absorption and scattering of light by small particles. John Wiley & Sons, New York, NY. .. _Bonan1996: -|br| - Bonan, G.B. 1996. A land surface model (LSM version 1.0) for ecological, hydrological, and atmospheric studies: Technical description and user’s guide. NCAR Technical Note NCAR/TN-417+STR, National Center for @@ -229,23 +169,17 @@ Atmospheric Research, Boulder, CO, 150 pp. .. _Bonan1998: -|br| - Bonan, G.B. 1998. The land surface climatology of the NCAR Land Surface Model coupled to the NCAR Community Climate Model. J. Climate 11:1307-1326. .. _Bonan2002: -|br| - Bonan, G.B. 2002. Ecological Climatology: Concepts and Applications. Cambridge University Press. .. _Bonanetal2002a: -|br| - Bonan, G.B., Oleson, K.W., Vertenstein, M., Levis, S., Zeng, X., Dai, Y., Dickinson, R.E., and Yang, Z.-L. 2002a. The land surface climatology of the Community Land Model coupled to the NCAR Community Climate Model. @@ -253,24 +187,18 @@ J. Climate 15: 3123-3149. .. _Bonanetal2002b: -|br| - Bonan, G.B., Levis, S., Kergoat, L., and Oleson, K.W. 2002b. Landscapes as patches of plant functional types: An integrating concept for climate and ecosystem models. Global Biogeochem. Cycles 16: 5.1-5.23. .. _BonanLevis2006: -|br| - Bonan, G.B., and Levis, S. 2006. Evaluating aspects of the Community Land and Atmosphere Models (CLM3 and CAM3) using a dynamic global vegetation model. J. Climate 19:2290-2301. .. _Bonanetal2011: -|br| - Bonan, G.B., Lawrence P.J., Oleson K.W., Levis S., Jung M., Reichstein M., Lawrence, D.M., and Swenson, S.C. 2011. Improving canopy processes in the Community Land Model (CLM4) using global flux fields empirically @@ -279,8 +207,6 @@ DOI:10.1029/2010JG001593. .. _Bonanetal2012: -|br| - Bonan, G. B., Oleson, K.W., Fisher, R.A., Lasslop, G., and Reichstein, M. 2012. Reconciling leaf physiological traits and canopy flux data: Use of the TRY and FLUXNET databases in the Community Land Model version 4, @@ -288,8 +214,6 @@ J. Geophys. Res., 117, G02026. DOI:10.1029/2011JG001913. .. _Bonanetal2014: -|br| - Bonan, G.B., Williams, M., Fisher, R.A., and Oleson, K.W. 2014. Modeling stomatal conductance in the earth system: linking leaf water-use efficiency and water transport along the soil–plant–atmosphere continuum, @@ -297,68 +221,48 @@ Geosci. Model Dev., 7, 2193-2222, doi:10.5194/gmd-7-2193-2014. .. _botta2000: -|br| - Botta, A et al., 2000. A global prognostic scheme of leaf onset using satellite data. Global Change Biology 6.7, pp. 709-725. .. _Brun1989: -|br| - Brun, E. 1989. Investigation of wet-snow metamorphism in respect of liquid water content. Ann. Glaciol. 13:22-26. .. _Brunkeetal2016: -|br| - Brunke, M. A., P. Broxton, J. Pelletier, D. Gochis, P. Hazenberg, D. M. Lawrence, L. R. Leung, G.-Y. Niu, P. A. Troch, and X. Zeng, 2016: Implementing and Evaluating Variable Soil Thickness in the Community Land Model, Version 4.5 (CLM4.5). J. Clim. 29:3441-3461. .. _Brzosteketal2014: -|br| - Brzostek, E. R., J. B. Fisher, and R. P. Phillips, 2014. Modeling the carbon cost of plant nitrogen acquisition: Mycorrhizal trade-offs and multipath resistance uptake improve predictions of retranslocation. J. Geophys. Res. Biogeosci., 119, 1684–1697, doi:10.1002/2014JG002660. .. _BugmannSolomon2000: -|br| - Bugmann, H., and Solomon, A.M. 2000. Explaining forest composition and biomass across multiple biogeographical regions. Ecol. Appl. 10:95-114. .. _Busing2005: -|br| - Busing, R.T. 2005. Tree mortality, canopy turnover, and woody detritus in old cove forests of the southern Appalachians. Ecology 86:73-84. .. _Buzanetal2015: -|br| - Buzan, J.R., Oleson, K., and Huber, M. 2015: Implementation and comparison of a suite of heat stress metrics within the Community Land Model version 4.5, Geosci. Model Dev., 8, 151-170, doi:10.5194/gmd-8-151-2015. .. _byram1959: -|br| - Byram, G.M., 1959. Combustion of forest fuels. In Forest fire: control and use.(Ed. KP Davis) pp. 61-89. .. _CampbellNorman1998: -|br| - Campbell, G.S., and Norman, J.M. 1998. An Introduction to Environmental Biophysics (2:math:`{}^{nd}` edition). Springer-Verlag, New York. .. _Castilloetal2012: -|br| - Castillo, G., Kendra, C., Levis, S., and Thornton, P. 2012. Evaluation of the new CNDV option of the Community Land Model: effects of dynamic vegetation and interactive nitrogen on CLM4 means and variability. J. @@ -366,16 +270,12 @@ Climate 25:3702–3714. .. _Caoetal1996: -|br| - Cao, M., Marshall, S. and Gregson, K., 1996. Global carbon exchange and methane emissions from natural wetlands: Application of a process-based model. J. Geophys. Res. 101(D9):14,399-14,414. .. _Chuangetal2006: -|br| - Chuang Y.L., Oren R., Bertozzi A.L, Phillips N., Katul G.G. 2006. The porous media model for the hydraulic system of a conifer tree: Linking sap flux data to transpiration rate, Ecological Modelling, 191, 447-468, @@ -383,16 +283,12 @@ doi:10.1016/j.ecolmodel.2005.03.027. .. _Churkinaetal2003: -|br| - Churkina, G. et al., 2003. Analyzing the ecosystem carbon dynamics of four European coniferous forests using a biogeochemistry model. Ecosystems, 6: 168-184. .. _CIESIN2005: -|br| - CIESIN: Gridded population of the world version 3 (GPWv3), 2005. Population density grids, Technical report, Socioeconomic Data and Applications Center (SEDAC), Columbia University, Palisades, New York, @@ -400,23 +296,17 @@ USA. .. _ClappHornberger1978: -|br| - Clapp, R.B., and Hornberger, G.M. 1978. Empirical equations for some soil hydraulic properties. Water Resour. Res. 14:601-604. .. _ClauserHuenges1995: -|br| - Clauser, C., and Huenges, E. 1995. Thermal conductivity of rocks and minerals. pp. 105-126. In: T. J. Ahrens (editor) Rock Physics and Phase Relations: A Handbook of Physical Constants. Washington, D.C. .. _Clevelandetal1999: -|br| - Cleveland, C.C., Townsend, A.R., Schimel, D.S., Fisher, H., Howarth, R.W., Hedin, L.O., Perakis, S.S., Latty, E.F., Von Fischer, J.C., Elseroad, A., and Wasson, M.F. 1999. Global patterns of terrestrial @@ -425,8 +315,6 @@ Biogeochem. Cycles 13:623-645. .. _Collatzetal1991: -|br| - Collatz, G.J., Ball, J.T., Grivet, C., and Berry, J.A. 1991. Physiological and environmental regulation of stomatal conductance, photosynthesis, and transpiration: A model that includes a laminar @@ -434,31 +322,23 @@ boundary layer. Agric. For. Meteor. 54:107-136. .. _Collatzetal1992: -|br| - Collatz, G.J., Ribas-Carbo, M., and Berry, J.A. 1992. Coupled photosynthesis-stomatal conductance model for leaves of C\ :math:`{}_{4}` plants. Aust. J. Plant Physiol. 19:519-538. .. _Colmer2003: -|br| - Colmer, T.D., 2003. Long-distance transport of gases in plants: a perspective on internal aeration and radial oxygen loss from roots. Plant Cell and Environment 26:17-36. .. _Conwayetal1996: -|br| - Conway, H., Gades, A., and Raymond, C.F. 1996. Albedo of dirty snow during conditions of melt. Water Resour. Res. 32:1713-1718. .. _Cosbyetal1984: -|br| - Cosby, B.J., Hornberger, G.M., Clapp, R.B., and Ginn, T.R. 1984. A statistical exploration of the relationships of soil moisture characteristics to the physical properties of soils. Water Resour. Res. @@ -466,38 +346,28 @@ characteristics to the physical properties of soils. Water Resour. Res. .. _Crawfordetal1982: -|br| - Crawford, T. W., Rendig, V. V., and Broadent, F. E. 1982. Sources, fluxes, and sinks of nitrogen during early reproductive growth of maize (Zea mays L.). Plant Physiol. 70:1645-1660. .. _Dahlinetal2015: -|br| - Dahlin, K., R. Fisher, and P. Lawrence, 2015: Environmental drivers of drought deciduous phenology in the Community Land Model. Biogeosciences, 12:5061-5074. .. _DaiZeng1997: -|br| - Dai, Y., and Zeng, Q. 1997. A land surface model (IAP94) for climate studies. Part I: formulation and validation in off-line experiments. Adv. Atmos. Sci. 14:433-460. .. _Daietal2001: -|br| - Dai, Y., et al. 2001. Common Land Model: Technical documentation and user’s guide [Available online at http://climate.eas.gatech.edu/dai/clmdoc.pdf]. .. _Daietal2003: -|br| - Dai, Y., Zeng, X., Dickinson, R.E., Baker, I., Bonan, G.B., Bosilovich, M.G., Denning, A.S., Dirmeyer, P.A., Houser, P.R., Niu, G., Oleson, K.W., Schlosser, C.A., and Yang, Z.-L. 2003. The Common Land Model. @@ -505,32 +375,24 @@ Bull. Amer. Meteor. Soc. 84:1013-1023. .. _Daietal2004: -|br| - Dai, Y., Dickinson, R.E., and Wang, Y.-P. 2004. A two-big-leaf model for canopy temperature, photosynthesis, and stomatal conductance. J. Climate 17:2281-2299. .. _DaiTrenberth2002: -|br| - Dai, A., and Trenberth, K.E. 2002. Estimates of freshwater discharge from continents: Latitudinal and seasonal variations. J. Hydrometeor. 3:660-687. .. _DeFriesetal2000: -|br| - DeFries, R.S., Hansen, M.C., Townshend, J.R.G., Janetos, A.C., and Loveland, T.R. 2000. A new global 1-km dataset of percentage tree cover derived from remote sensing. Global Change Biol. 6:247-254. .. _DegensSparling1996: -|br| - Degens, B. and Sparling, G., 1996. Changes in aggregation do not correspond with changes in labile organic C fractions in soil amended with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): @@ -538,8 +400,6 @@ with :math:`{}^{14}`\ C-glucose. Soil Biology and Biochemistry, 28(4/5): .. _deKauwe2015: -|br| - de Kauwe, D.A., Kala, J., Lin, Y.-S., Pitman, A.J., Medlyn, B.E., Duursma, R.A., Abramowitz, G., Wang, Y.-P., Miralles, D.G. 2015. A test of an optimal stomatal conductance scheme within the CABLE land surface model. Geosci. Model Dev. @@ -547,22 +407,16 @@ conductance scheme within the CABLE land surface model. Geosci. Model Dev. .. _deVries1963: -|br| - de Vries, D.A. 1963. Thermal Properties of Soils. In: W.R. van Wijk (editor) Physics of the Plant Environment. North-Holland, Amsterdam. .. _Dickinson1983: -|br| - Dickinson, R.E. 1983. Land surface processes and climate-surface albedos and energy balance. Adv. Geophys. 25:305-353. .. _Dickinsonetal1993: -|br| - Dickinson, R.E., Henderson-Sellers, A., and Kennedy, P.J. 1993. Biosphere-Atmosphere Transfer Scheme (BATS) version 1e as coupled to the NCAR Community Climate Model. NCAR Technical Note NCAR/TN-387+STR. @@ -570,8 +424,6 @@ National Center for Atmospheric Research, Boulder, CO. .. _Dickinsonetal2006: -|br| - Dickinson, R.E., Oleson, K.W., Bonan, G., Hoffman, F., Thornton, P., Vertenstein, M., Yang, Z.-L., and Zeng, X. 2006. The Community Land Model and its climate statistics as a component of the Community Climate @@ -579,30 +431,22 @@ System Model. J. Climate 19:2302-2324. .. _Dingman2002: -|br| - Dingman, S.L. 2002. Physical Hydrology. Second Edition. Prentice Hall, NJ. .. _Dirmeyeretal1999: -|br| - Dirmeyer, P.A., Dolman, A.J., and Sato, N. 1999. The pilot phase of the Global Soil Wetness Project. Bull. Amer. Meteor. Soc. 80:851-878. .. _Dobsonetal2000: -|br| - Dobson, J.E., Bright, E.A., Coleman, P.R., Durfee, R.C., and Worley, B.A. 2000. LandScan: A global population database for estimating populations at risk. Photogramm. Eng. Rem. Sens. 66:849-857. .. _DormanSellers1989: -|br| - Dorman, J.L., and Sellers, P.J. 1989. A global climatology of albedo, roughness length and stomatal resistance for atmospheric general circulation models as represented by the simple biosphere model (SiB). @@ -610,63 +454,47 @@ J. Appl. Meteor. 28:833-855. .. _Doughertyetal1994: -|br| - Dougherty, R.L., Bradford, J.A., Coyne, P.I., and Sims, P.L. 1994. Applying an empirical model of stomatal conductance to three C4 grasses. Agric. For. Meteor. 67:269-290. .. _Drewniaketal2013: -|br| - Drewniak, B., Song, J., Prell, J., Kotamarthi, V.R., and Jacob, R. 2013. Modeling agriculture in the Community Land Model. Geosci. Model Dev. 6:495-515. DOI:10.5194/gmd-6-495-2013. .. _Dunfieldetal1993: -|br| - Dunfield, P., Knowles, R., Dumont, R. and Moore, T.R., 1993. Methane Production and Consumption in Temperate and Sub-Arctic Peat Soils - Response to Temperature and Ph. Soil Biology & Biochemistry 25:321-326. .. _EntekhabiEagleson1989: -|br| - Entekhabi, D., and Eagleson, P.S. 1989. Land surface hydrology parameterization for atmospheric general circulation models including subgrid scale spatial variability. J. Climate 2:816-831. .. _FangStefan1996: -|br| - Fang, X. and Stefan, H.G., 1996. Long-term lake water temperature and ice cover simulations/measurements. Cold Regions Science and Technology 24:289-304. .. _Farouki1981: -|br| - Farouki, O.T. 1981. The thermal properties of soils in cold regions. Cold Regions Sci. and Tech. 5:67-75. .. _Farquharetal1980: -|br| - Farquhar, G.D., von Caemmerer, S., and Berry, J.A. 1980. A biochemical model of photosynthetic CO\ :sub:`2` assimilation in leaves of C\ :math:`{}_{3}` species. Planta 149:78-90. .. _FarquharvonCaemmerer1982: -|br| - Farquhar, G.D., and von Caemmerer, S. 1982. Modeling of photosynthetic response to environmental conditions. pp. 549-587. In: O.L. Lange, P.S. Nobel, C.B. Osmond, and H. Zeigler (editors) Encyclopedia of Plant @@ -675,86 +503,62 @@ and Carbon Assimilation. Springer-Verlag, New York. .. _FeddemaKauffman2016: -|br| - Feddema, J., Kauffman, B. 2016. Urban Properties Tool (Version 1.2). NCAR THESIS Tools Library. Retrieved from: https://svn-iam-thesis-release.cgd.ucar.edu/urban_properties/. doi:10.5065/D6R78CMT. .. _Ferrari1999: -|br| - Ferrari, J.B., 1999. Fine-scale patterns of leaf litterfall and nitrogen cycling in an old-growth forest. Canadian Journal of Forest Research, 29: 291-302. .. _FirestoneDavidson1989: -|br| - Firestone, M.K. and Davidson, E.A. 1989. Exchange of Trace Gases between Terrestrial Ecosystems and the Atmosphere. In: M.O. Andreae and D.S. Schimel (Editors). John Wiley and Sons, pp. 7-21. .. _Fisheretal2010: -|br| - Fisher, J. B., S. Sitch, Y. Malhi, R. A. Fisher, C. Huntingford, and S.-Y. Tan, 2010. Carbon cost of plant nitrogen acquisition: A mechanistic, globally applicable model of plant nitrogen uptake, retranslocation, and fixation. Global Biogeochem. Cycles, 24, GB1014, doi:10.1029/2009GB003621. .. _Fisheretal2015: -|br| - Fisher, R. A., S. Muszala, M. Verteinstein, P. Lawrence, C. Xu, N. G. McDowell, R. G. Knox, C. Koven, J. Holm, B. M. Rogers, A. Spessa, D. Lawrence, and G. Bonan, 2015: Taking off the training wheels: the properties of a dynamic vegetation model without climate envelopes, CLM4.5(ED). Geosci. Model Dev., 8: 3593-3619, doi:10.5194/gmd-8-3593-2015. .. _Fisheretal2018: -|br| - Fisher, R.A., C.D. Koven, W.R.L. Anderegg, et al., 2018: Vegetation demographics in Earth System Models: A review of progress and priorities. Glob Change Biol. 2018;24:35–54. https://doi.org/10.1111/gcb.13910 .. _FlannerZender2005: -|br| - Flanner, M.G., and Zender. C.S. 2005. Snowpack radiative heating: Influence on Tibetan Plateau climate. Geophys. Res. Lett. 32:L06501. DOI:10.1029/2004GL022076. .. _FlannerZender2006: -|br| - Flanner, M.G., and Zender, C.S. 2006. Linking snowpack microphysics and albedo evolution. J. Geophys. Res. 111:D12208. DOI:10.1029/2005JD006834. .. _Flanneretal2007: -|br| - Flanner, M.G., Zender, C.S., Randerson, J.T., and Rasch, P.J. 2007. Present day climate forcing and response from black carbon in snow. J. Geophys. Res. 112:D11202. DOI:10.1029/2006JD008003. .. _Flatauetal1992: -|br| - Flatau, P.J., Walko, R.L., and Cotton, W.R. 1992. Polynomial fits to saturation vapor pressure. J. Appl. Meteor. 31:1507-1513. .. _foley1996: -|br| - Foley, J.A. et al., 1996. An integrated biosphere model of land surface processes, terrestrial carbon balance, and vegetation dynamics. Global Biogeochemical Cycles 10.4, pp. 603-628. .. _Friedl,etal2002: -|br| - Friedl, M.A., McIver, D.K., Hodges, J.C.F., Zhang, X.Y., Muchoney, D., Strahler, A.H., Woodcock, C.E., Gopal, S., Schneider, A., Cooper, A., Baccini, A., Gao, F., and Schaaf, C. 2002. Global land cover mapping @@ -763,29 +567,21 @@ from MODIS: algorithms and early results. Remote Sens. Environ. .. _Frolkingetal2001: -|br| - Frolking, S., et al. 2001. Modeling Northern Peatland Decomposition and Peat Accumulation. Ecosystems. 4:479-498. .. _fyllas2014: -|br| - Fyllas, N.M. et al., 2014. Analysing Amazonian forest productivity using a new individual and trait- based model (TFS v. 1). Geoscientific Model Development 7.4, pp. 1251-1269. .. _Gallaisetal2006: -|br| - Gallais, A., Coque, M. Quillere, I., Prioul, J., and Hirel, B. 2006. Modeling postsilking nitrogen fluxes in maize (Zea mays) using 15N-labeling field experiments. New Phytologist 172:696-707. .. _Gallaisetal2007: -|br| - Gallais, A., Coque, M., Gouis, J. L., Prioul, J. L., Hirel, B., and Quillere, I. 2007. Estimating the proportion of nitrogen remobilization and of postsilking nitrogen uptake allocated to maize kernels by @@ -793,15 +589,11 @@ Nitrogen-15 labeling. Crop Sci. 47:685-693. .. _Gallowayetal2004: -|br| - Galloway, J.N., et al. 2004. Nitrogen cycles: past, present, and future. Biogeochem. 70:153-226. .. _Garciaetal1988: -|br| - Garcia, R.L., Kanemasu, E.T., Blad, B.L., Bauer, A., Hatfield, J.L., Major, D.A., Reginato, R.J., and Hubbard, K.G. 1988. Interception and use efficiency of light in winter wheat under different nitrogen @@ -809,15 +601,11 @@ regimes. Agric. For. Meteor. 44:175-186. .. _Gardner1960: -|br| - Gardner, W. R. 1960. Dynamic aspects of water availability to plants, Soil Sci., 89, 63–73. .. _Gashetal1996: -|br| - Gash, J.H.C., Nobre, C.A., Roberts, J.M., and Victoria, R.L. 1996. An overview of ABRACOS. pp. 1-14. In: J.H.C. Gash, C.A. Nobre, J.M. Roberts, and R.L. Victoria (editors) Amazonian Deforestation and @@ -825,22 +613,16 @@ Climate. John Wiley and Sons, Chichester, England. .. _Getiranaetal2012: -|br| - Getirana, A. C. V., A. Boone, D. Yamazaki, B. Decharme, F. Papa, and N. Mognard. 2012. The hydrological modeling and analysis platform (HyMAP): Evaluation in the Amazon basin, J. Hydrometeorol., 13, 1641-1665. .. _Ghimireetal2016: -|br| - Ghimire, B., W. J. Riley, C. D. Koven, M. Mu, and J. T. Randerson, 2016: Representing leaf and root physiological traits in CLM improves global carbon and nitrogen cycling predictions. J. Adv. Mod. Earth Sys. 8: 598-613. .. _Gholzetal1985: -|br| - Gholz, H.L., Perry, C.S., Cropper, W.P., Jr. and Hendry, L.C., 1985. Litterfall, decomposition, and nitrogen and phosphorous dynamics in a chronosequence of slash pine (*Pinus elliottii*) plantations. Forest @@ -848,8 +630,6 @@ Science, 31: 463-478. .. _Giglioetal2006: -|br| - Giglio, L., Csiszar, I., and Justice, C.O. 2006. Global distribution and seasonality of active fires as observed with the Terra and Aqua Moderate Resolution Imaging Spectroradiometer (MODIS) sensors. J. Geophys. Res. @@ -857,32 +637,24 @@ Resolution Imaging Spectroradiometer (MODIS) sensors. J. Geophys. Res. .. _GlobalSoilDataTask2000: -|br| - Global Soil Data Task 2000. Global soil data products CD-ROM (IGBP-DIS). International Geosphere-Biosphere Programme-Data and Information Available Services [Available online at http://www.daac.ornl.gov]. .. _Gomesetal2003: -|br| - Gomes, E.P.C., Mantovani, W., and Kageyama, P.Y. 2003. Mortality and recruitment of trees in a secondary montane rain forest in southeastern Brazil. Brazilian Journal of Biology 63:47-60. .. _Goszetal1973: -|br| - Gosz, J.R., Likens, G.E., and Bormann, F.H. 1973. Nutrient release from decomposing leaf and branch litter in the Hubbard Brook Forest, New Hampshire. Ecological Monographs 43:173-191. .. _GotangcoCastilloetal2012: -|br| - Gotangco Castillo C., Levis S., and Thornton P. 2012. Evaluation of the new CNDV option of the Community Land Model: Effects of dynamic vegetation and interactive nitrogen on CLM4 means and variability. J. @@ -890,8 +662,6 @@ Climate 25:3702-3714. DOI:10.1175/JCLID-11-00372.1. .. _Grahametal1999: -|br| - Graham, S.T., Famiglietti, J.S., and Maidment, D.R. 1999. Five-minute, 1/2º, and 1º data sets of continental watersheds and river networks for use in regional and global hydrologic and climate system modeling @@ -899,30 +669,22 @@ studies. Water Resour. Res. 35:583-587. .. _Gravenetal2017: -|br| - Graven, H., C. E. Allison, D. M. Etheridge, S. Hammer, R. F. Keeling, I. Levin, H. A. J. Meijer, M. Rubino, P. P. Tans, C. M. Trudinger, B. H. Vaughn and J. W. C. White, 2017. Compiled records of carbon isotopes in atmospheric CO2 for historical simulations in CMIP6, Geoscientific Model Development, in review. doi: 10.5194/gmd-2017-166. .. _GrenfellWarren1999: -|br| - Grenfell, T.C., and Warren, S.G. 1999. Representation of a nonspherical ice particle by a collection of independent spheres for scattering and absorption of radiation. J. Geophys. Res. 104(D24):37697-37709. .. _delGrossoetal2000: -|br| - del Grosso, S.J., et al. 2000. General model for N2O and N2 gas emissions from soils due to dentrification. Global Biogeochem. Cycles 14:1045-1060. .. _Guentheretal1995: -|br| - Guenther, A., Hewitt, C.N., Erickson, D., Fall, R., Geron, C., Graedel, T., Harley, P., Klinger, L., Lerdau, M., McKay, W.A., Pierce, T., Scholes, B., Steinbrecher, R., Tallamraju, R., Taylor, J., and @@ -931,8 +693,6 @@ emissions. J. Geophys. Res. 100:8873-8892. .. _Guentheretal2006: -|br| - Guenther, A., Karl, T., Harley, P., Wiedinmyer, C., Palmer. P.I., and Geron, C. 2006. Estimates of global terrestrial isoprene emissions using MEGAN (Model of Emissions of Gases and Aerosols from Nature). Atmos. @@ -940,8 +700,6 @@ Chem. Phys. 6:3181–3210. .. _Guentheretal2012: -|br| - Guenther, A. B., Jiang, X., Heald, C. L., Sakulyanontvittaya, T., Duhl, T., Emmons, L. K., & Wang, X., 2012. The Model of Emissions of Gases and Aerosols from Nature version 2.1 (MEGAN2.1): an extended and updated @@ -950,8 +708,6 @@ framework for modeling biogenic emissions, Geosci. Model Dev., 5, .. _Hacketal2006: -|br| - Hack, J.J., Caron, J.M., Yeager, S.G., Oleson, K.W., Holland, M.M., Truesdale, J.E., and Rasch, P.J. 2006. Simulation of the global hydrological cycle in the CCSM Community Atmosphere Model version 3 @@ -959,8 +715,6 @@ hydrological cycle in the CCSM Community Atmosphere Model version 3 .. _Hansenetal2003: -|br| - Hansen, M., DeFries, R.S., Townshend, J.R.G., Carroll, M., Dimiceli, C., and Sohlberg, R.A. 2003. Global percent tree cover at a spatial resolution of 500 meters: first results of the MODIS vegetation @@ -968,8 +722,6 @@ continuous fields algorithm. Earth Interactions 7:1-15. .. _Hastingsetal1999: -|br| - Hastings, D.A., Dunbar, P.K., Elphingstone, G.M., Bootz, M., Murakami, H., Maruyama, H., Masaharu, H., Holland, P., Payne, J., Bryant, N.A., Logan, T.L., Muller, J.-P., Schreier, G., and MacDonald, J.S., eds., @@ -980,8 +732,6 @@ Colorado 80305-3328, U.S.A. .. _Healdetal2008: -|br| - Heald, C.L., Henze, D.K., Horowitz, L.W., Feddema, J., Lamarque, J.-F., Guenther, A., Hess, P.G., Vitt, F., Seinfeld, J.H., Goldstein, A.H., and Fung, I. 2008. Predicted change in global secondary organic aerosol @@ -990,8 +740,6 @@ change. J. Geophys. Res. 113:D05211. DOI:10.1029/2007JD009092. .. _Healdetal2009: -|br| - Heald, C.L., Wilkinson, M.J., Monson, R.K., Alo, C.A., Wang, G.L., and Guenther, A. 2009. Response of isoprene emission to ambient CO\ :sub:`2` changes and implications for global budgets. Global @@ -999,54 +747,40 @@ Change Biol. 15:1127-1140. DOI:10.1111/j.1365-2486.2008.01802.x .. _Henderson-Sellers1985: -|br| - Henderson-Sellers, B. 1985. New formulation of eddy diffusion thermocline models. Appl. Math. Modelling 9:441-446. .. _Henderson-Sellers1986: -|br| - Henderson-Sellers, B. 1986. Calculating the surface energy balance for lake and reservoir modeling: A review. Rev. Geophys. 24:625-649. .. _Henderson-Sellersetal1993: -|br| - Henderson-Sellers, A., Yang, Z.-L., and Dickinson, R.E. 1993. The project for intercomparison of land-surface parameterization schemes. Bull. Amer. Meteor. Soc. 74: 1335-1349. .. _HostetlerBartlein1990: -|br| - Hostetler, S.W., and Bartlein, P.J. 1990. Simulation of lake evaporation with application to modeling lake level variations of Harney-Malheur Lake, Oregon. Water Resour. Res. 26:2603-2612. .. _Hostetleretal1993: -|br| - Hostetler, S.W., Bates, G.T., and Giorgi, F. 1993. Interactive coupling of a lake thermal model with a regional climate model. J. Geophys. Res. 98:5045-5057. .. _Hostetleretal1994: -|br| - Hostetler, S.W., Giorgi, F., Bates, G.T., and Bartlein, P.J. 1994. Lake-atmosphere feedbacks associated with paleolakes Bonneville and Lahontan. Science 263:665-668. .. _Houetal2012: -|br| - Hou, Z., Huang, M., Leung, L.R., Lin, G., and Ricciuto, D.M. 2012. Sensitivity of surface flux simulations to hydrologic parameters based on an uncertainty quantification framework applied to the Community Land @@ -1054,14 +788,10 @@ Model. J. Geophys. Res. 117:D15108. .. _Houltonetal2008: -|br| - Houlton, B.Z., Wang, Y.P., Vitousek, P.M. and Field, C.B., 2008. A unifying framework for dinitrogen fixation in the terrestrial biosphere. Nature, 454(7202), p.327. .. _HuangLiang2006: -|br| - Huang, M., and Liang, X. 2006. On the assessment of the impact of reducing parameters and identification of parameter uncertainties for a hydrologic model with applications to ungauged basins. J. Hydrol. @@ -1069,8 +799,6 @@ hydrologic model with applications to ungauged basins. J. Hydrol. .. _Hugeliusetal2012: -|br| - Hugelius, G., C. Tarnocai, G. Broll, J.G. Canadell, P. Kuhry, adn D.K. Swanson, 2012. The Northern Circumpolar Soil Carbon Database: spatially distributed datasets of soil coverage and soil carbon storage in the @@ -1079,24 +807,18 @@ northern permafrost regions. Earth Syst. Sci. Data Discuss., 5, 707-733 .. _Huntetal1988: -|br| - Hunt, H.W., Ingham, E.R., Coleman, D.C., Elliott, E.T., and Reid, C.P.P. 1988. Nitrogen limitation of production and decomposition in prairie, mountain meadow, and pine forest. Ecology 69:1009-1016. .. _HuntRunning1992: -|br| - Hunt, E.R., Jr. and Running, S.W., 1992. Simulated dry matter yields for aspen and spruce stands in the north american boreal forest. Canadian Journal of Remote Sensing, 18: 126-133. .. _Huntetal1996: -|br| - Hunt, E.R., Jr. et al., 1996. Global net carbon exchange and intra-annual atmospheric CO\ :sub:`2` concentrations predicted by an ecosystem process model and three-dimensional atmospheric transport @@ -1104,8 +826,6 @@ model. Global Biogeochemical Cycles, 10: 431-456. .. _Hurttetal2006: -|br| - Hurtt, G.C., Frolking, S., Fearon, M.G., Moore, B., Shevliakova, E., Malyshev, S., Pacala, S.W., and Houghton, R.A. 2006. The underpinnings of land-use history: three centuries of global gridded land-use @@ -1114,8 +834,6 @@ Global Change Biol. 12:1208-1229. .. _Hurttetal2011: -|br| - Hurtt, G.C., et al. 2011. Harmonization of land-use scenarios for the period 1500-2100: 600 years of global gridded annual land-use transitions, wood harvest, and resulting secondary lands. Climatic @@ -1123,31 +841,23 @@ Change 109:117-161. DOI:10.1007/s10584-011-0153-2. .. _Idso1981: -|br| - Idso, S.B. 1981. A set of equations for full spectrum and 8- to 14-\ :math:`\mu` \ m and 10.5- to 12.5-\ :math:`\mu` \ m thermal radiation from cloudless skies. Water Resour. Res. 17:295-304. .. _IiyamaHasegawa2005: -|br| - Iiyama, I. and Hasegawa, S., 2005. Gas diffusion coefficient of undisturbed peat soils. Soil Science and Plant Nutrition 51:431-435. .. _Jacksonetal1996: -|br| - Jacksonetal1996: E., and Schulze, E. D. 1996. A global analysis of root distributions for terrestrial biomes Oecologia 108:389–411. DOI:10.1007/BF00333714. .. _Jacksonetal2010: -|br| - Jackson, T.L., Feddema, J.J., Oleson, K.W., Bonan, G.B., and Bauer, J.T. 2010. Parameterization of urban characteristics for global climate modeling. Annals of the Association of American Geographers. @@ -1155,32 +865,24 @@ modeling. Annals of the Association of American Geographers. .. _JenkinsonColeman2008: -|br| - Jenkinson, D. and Coleman, K. 2008. The turnover of organic carbon in subsoils. Part 2. Modelling carbon turnover. European Journal of Soil Science 59:400-413. .. _Jordan1991: -|br| - Jordan, R. 1991. A One-dimensional Temperature Model for a Snow Cover: Technical Documentation for SNTHERM.89. U.S. Army Cold Regions Research and Engineering Laboratory, Special Report 91-16. .. _KattgeKnorr2007: -|br| - Kattge, J., and Knorr, W. 2007. Temperature acclimation in a biochemical model of photosynthesis: a reanalysis of data from 36 species. Plant Cell Environ. 30:1176-1190. DOI:10.1111/j.1365-3040.2007.01690.x. .. _Kattgeetal2009: -|br| - Kattge, J., Knorr, W., Raddatz, T., and Wirth C. 2009: Quantifying photosynthetic capacity and its relationship to leaf nitrogen content for global–scale terrestrial biosphere models. Global Change Biol. @@ -1188,24 +890,18 @@ for global–scale terrestrial biosphere models. Global Change Biol. .. _Kavetskietal2002: -|br| - Kavetski, D., Binning, P. and Sloan, S.W., 2002. Noniterative time stepping schemes with adaptive truncation error control for the solution of Richards equation. Water Resources Research, 38(10). .. _Kelleretal2004: -|br| - Keller, M., Palace, M., Asner, G.P., Pereira, R., Jr. and Silva, J.N.M., 2004. Coarse woody debris in undisturbed and logged forests in the eastern Brazilian Amazon. Global Change Biology, 10: 784-795. .. _Kellneretal2006: -|br| - Kellner, E., Baird, A.J., Oosterwoud, M., Harrison, K. and Waddington, J.M., 2006. Effect of temperature and atmospheric pressure on methane (CH4) ebullition from near-surface peats. Geophys. Res. Lett. 33. @@ -1213,24 +909,18 @@ DOI:10.1029/2006GL027509. .. _Kimballetal1997: -|br| - Kimball, J.S., Thornton, P.E., White, M.A. and Running, S.W. 1997. Simulating forest productivity and surface-atmosphere exchange in the BOREAS study region. Tree Physiology 17:589-599. .. _Kohyamaetal2001: -|br| - Kohyama, T., Suzuki, E., Partomihardjo, T., and Yamada, T. 2001. Dynamic steady state of patch-mosaic tree size structure of a mixed diptocarp forest regulated by local crowding. Ecological Research 16:85-98. .. _Kourzeneva2009: -|br| - Kourzeneva, E., 2009. Global dataset for the parameterization of lakes in Numerical Weather Prediction and Climate modeling. ALADIN Newsletter, No 37, July-December, 2009, F. Bouttier and C. Fischer, Eds., @@ -1238,48 +928,36 @@ Meteo-France, Toulouse, France, 46-53. .. _Kourzeneva2010: -|br| - Kourzeneva, E., 2010: External data for lake parameterization in Numerical Weather Prediction and climate modeling. Boreal Environment Research, 15, 165-177. .. _Kourzenevaetal2012: -|br| - Kourzeneva, E., Asensio, H., Martin, E. and Faroux, S., 2012. Global gridded dataset of lake coverage and lake depth for use in numerical weather prediction and climate modelling. Tellus A 64. .. _Kovenetal2009: -|br| - Koven, C., et al. 2009. On the formation of high-latitude soil carbon stocks: The effects of cryoturbation and insulation by organic matter in a land surface model. Geophys. Res. Lett. 36: L21501. .. _Kovenetal2011: -|br| - Koven, C.D., et al. 2011. Permafrost carbon-climate feedbacks accelerate global warming. Proceedings of the National Academy of Sciences 108:14769-14774. .. _Kovenetal2013: -|br| - Koven, C.D. et al. 2013. The effect of vertically-resolved soil biogeochemistry and alternate soil C and N models on C dynamics of CLM4. Biogeosciences Discussions 10:7201-7256. .. _Kovenetal2015: -|br| - Koven, C.D. et al. 2015. Permafrost carbon-climate feedback is sensitive to deep soil carbon decomposability but not deep soil nitrogen dynamics. Proceedings of the National Academies of Science, @@ -1287,20 +965,14 @@ nitrogen dynamics. Proceedings of the National Academies of Science, .. _Kovenetal2017: -|br| - Koven, C.D., G. Hugelius, D.M. Lawrence, and W.R. Wieder, 2017: Higher climatological temperature sensitivity of soil carbon in cold than warm climates. Nature Clim. Change, 7, doi:10.1038/nclimate3421. .. _kucharik1998: -|br| - Kucharik, C.J., J.M. Norman, and S.T. Gower, 1998. Measurements of branch area and adjusting leaf area index indirect measurements. Agricultural and Forest Meteorology 91.1, pp. 69-88. .. _Kuchariketal2000: -|br| - Kucharik, C.J., Foley, J.A., Delire, C., Fisher, V.A., Coe, M.T., Lenters, J.D., Young-Molling, C., and Ramankutty, N. 2000. Testing the performance of a dynamic global ecosystem model: water balance, carbon @@ -1309,8 +981,6 @@ balance, and vegetation structure. Global Biogeochem. Cycles 14: .. _KucharikBrye2003: -|br| - Kucharik, C.J., and Brye, K.R. 2003. Integrated BIosphere Simulator (IBIS) yield and nitrate loss predictions for Wisconsin maize receiving varied amounts of nitrogen fertilizer. Journal of Environmental Quality @@ -1318,8 +988,6 @@ varied amounts of nitrogen fertilizer. Journal of Environmental Quality .. _Laddetal2992: -|br| - Ladd, J.N., Jocteur-Monrozier, L. and Amato, M., 1992. Carbon turnover and nitrogen transformations in an alfisol and vertisol amended with [U-:math:`{}^{14}`\ C] glucose and [:math:`{}^{15}`\ N] ammonium @@ -1327,8 +995,6 @@ sulfate. Soil Biology and Biochemistry, 24: 359-371. .. _Lamarqueetal2010: -|br| - Lamarque, J.-F., et al. 2010. Historical (1850-2000) gridded anthropogenic and biomass burning emissions of reactive gases and aerosols: methodology and application. Atmos. Chem. Phys. Discuss. @@ -1336,31 +1002,23 @@ aerosols: methodology and application. Atmos. Chem. Phys. Discuss. .. _Larcher1995: -|br| - Larcher, W. 1995. Physiological Plant Ecology, Springer-Verlag, Berlin Heidelberg. .. _LavigneRyan1997: -|br| - Lavigne, M.B., and Ryan, M.G. 1997. Growth and maintenance respiration rates of aspen, black spruce, and jack pine stems at northern and southern BOREAS sites. Tree Phys. 17:543-551. .. _Lawetal2003: -|br| - Law, B.E., Sun, O.J., Campbell, J., Van Tuyl, S. and Thornton, P.E. 2003. Changes in carbon storage and fluxes in a chronosequence of ponderosa pine. Global Change Biology, 9: 510-514. .. _Lawrenceetal2007: -|br| - Lawrence, D.M., Thornton, P.E., Oleson, K.W., and Bonan, G.B. 2007. The partitioning of evapotranspiration into transpiration, soil evaporation, and canopy evaporation in a GCM: Impacts on land-atmosphere interaction. @@ -1368,15 +1026,11 @@ J. Hydrometeor. 8:862-880. .. _LawrenceSlater2008: -|br| - Lawrence, D.M., and Slater, A.G. 2008. Incorporating organic soil into a global climate model. Clim. Dyn. 30. DOI:10.1007/s00382-007-0278-1. .. _Lawrenceetal2008: -|br| - Lawrence, D.M., Slater, A.G., Romanovsky, V.E., and Nicolsky, D.J. 2008. The sensitivity of a model projection of near-surface permafrost degradation to soil column depth and inclusion of soil organic matter. @@ -1384,8 +1038,6 @@ J. Geophys. Res. 113:F02011. DOI:10.1029/2007JF000883. .. _Lawrenceetal2011: -|br| - Lawrence, D.M., K.W. Oleson, M.G. Flanner, P.E. Thornton, S.C. Swenson, P.J. Lawrence, X. Zeng, Z.-L. Yang, S. Levis, K. Sakaguchi, G.B. Bonan, and A.G. Slater, 2011. Parameterization improvements and functional and @@ -1394,8 +1046,6 @@ Model. Earth Sys. 3. DOI:10.1029/2011MS000045. .. _Lawrenceetal2016: -|br| - Lawrence, D.M., Hurtt, G.C., Arneth, A., Brovkin, V., Calvin, K.V., Jones, A.D., Jones, C.D., Lawrence, P.J., de Noblet-Ducoudré, N., Pongratz, J., Seneviratne, S.I., and Shevliakova, E. 2016. The Land Use Model @@ -1405,24 +1055,18 @@ DOI:10.5194/gmd-9-2973-2016. .. _LawrenceChase2007: -|br| - Lawrence, P.J., and Chase, T.N. 2007. Representing a MODIS consistent land surface in the Community Land Model (CLM 3.0). J. Geophys. Res. 112:G01023. DOI:10.1029/2006JG000168. .. _LawrenceChase2010: -|br| - Lawrence, P.J., and Chase, T.N. 2010. Investigating the climate impacts of global land cover change in the Community Climate System Model. Int. J. Climatol. 30:2066-2087. DOI:10.1002/joc.2061. .. _Lawrenceetal2012: -|br| - Lawrence, P.J., et al. 2012. Simulating the biogeochemical and biogeophysical impacts of transient land cover change and wood harvest in the Community Climate System Model (CCSM4) from 1850 to 2100. J. @@ -1430,22 +1074,16 @@ Climate 25:3071-3095. DOI:10.1175/JCLI-D-11-00256.1. .. _LehnerDoll2004: -|br| - Lehner, B. and Döll, P., 2004. Development and validation of a global database of lakes, reservoirs and wetlands, J. Hydrol., 296, 1–22. .. _Lehneretal2008: -|br| - Lehner, B., Verdin, K. and Jarvis, A., 2008. New global hydrograhy derived from spaceborne elevation data. Eos Trans., AGU, 89, 93 – 94. .. _LePageetal2010: -|br| - Le Page, Y., van der Werf, G.R., Morton, D.C., and Pereira, J.M.C. 2010. Modeling fire-driven deforestation potential in Amazonia under current and projected climate conditions. J. Geophys. Res. 115:G03012. @@ -1453,23 +1091,17 @@ DOI:10.1029/2009JG001190. .. _Lerman1979: -|br| - Lerman, A., 1979. Geochemical processes: Water and sediment environments. John Wiley and Sons, New York, N.Y. .. _Lettsetal2000: -|br| - Letts, M.G., Roulet, N.T., Comer, N.T., Skarupa, M.R., and Verseghy, D.L. 2000. Parametrization of peatland hydraulic properties for the Canadian Land Surface Scheme. Atmos.-Ocean 38:141-160. .. _Levisetal2003: -|br| - Levis, S., Wiedinmyer, C., Bonan, G.B., and Guenther, A. 2003. Simulating biogenic volatile organic compound emissions in the Community Climate System Model. J. Geophys. Res. 108:4659. @@ -1477,8 +1109,6 @@ DOI:10.1029/2002JD003203. .. _Levisetal2004: -|br| - Levis, S., Bonan, G.B., Vertenstein, M., and Oleson, K.W. 2004. The community land model’s dynamic global vegetation model (CLM-DGVM): technical description and user’s guide. NCAR Technical Note @@ -1487,16 +1117,12 @@ Colorado. 50 pp. .. _Levisetal2009: -|br| - Levis, S., Thornton, P., Bonan, G., and Kucharik, C. 2009. Modeling land use and land management with the Community Land Model. iLeaps newsletter, No. 7. .. _Levisetal2012: -|br| - Levis, S., Bonan, G., Kluzek, E., Thornton, P., Jones, A., Sacks, W., and Kucharik, C 2012. Interactive crop management in the Community Earth System Model (CESM1): Seasonal influences on land-atmosphere fluxes. J. @@ -1504,32 +1130,24 @@ Climate 25: 4839-4859. DOI:10.1175/JCLI-D-11-00446.1. .. _Levisetal2016: -|br| - Levis, S., Badger, A., Drewniak, B., Nevison, C., Ren, X. 2016. CLMcrop yields and water requirements: avoided impacts by choosing RCP 4.5 over 8.5. Climatic Change. DOI:10.1007/s10584-016-1654-9. .. _Lietal2000: -|br| - Li, C., Aber, J., Stange, F., Butterbach-Bahl, K. and Papen, H. 2000. A process-oriented model of N2O and NO emissions from forest soils: 1. Model development. J. Geophys. Res. 105(D4):4369-4384. .. _Lietal2012a: -|br| - Li, F., Zeng, X.-D., and Levis, S. 2012a. A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model. Biogeosciences 9:2761-2780. .. _Lietal2012b: -|br| - Li, F., Zeng, X. D., and Levis, S. 2012b. Corrigendum to “A process-based fire parameterization of intermediate complexity in a Dynamic Global Vegetation Model” published in Biogeosciences, 9, @@ -1537,24 +1155,18 @@ Dynamic Global Vegetation Model” published in Biogeosciences, 9, .. _Lietal2013a: -|br| - Li, F., Levis, S., and Ward, D. S. 2013a. Quantifying the role of fire in the Earth system – Part 1: Improved global fire modeling in the Community Earth System Model (CESM1). Biogeosciences 10:2293-2314. .. _LiLawrence2017: -|br| - Li, F., and Lawrence, D. 2017. Role of fire in the global land water budget during the 20th century through changing ecosystems. J. Clim. 30: 1894-1908. .. _Lietal2013b: -|br| - Li, H.-Y., Huang, M., Tesfa, T., Ke, Y., Sun, Y., Liu, Y., and Leung, L. R. 2013b. A subbasin-based framework to represent land surface processes in an Earth System Model, Geosci. Model Dev. Discuss. 6:2699-2730. @@ -1562,8 +1174,6 @@ DOI:10.5194/gmdd-6-2699-2013. .. _Lietal2011: -|br| - Li, H., Huang, M., Wigmosta, M.S., Ke, Y., Coleman, A.M., Leung, L.R., Wang, A., and Ricciuto, D.M. 2011. Evaluating runoff simulations from the Community Land Model 4.0 using observations from flux towers and a @@ -1572,8 +1182,6 @@ DOI:10.1029/2011JD016276. .. _Lietal2015a: -|br| - Li, H., L. Leung, A. Getirana, M. Huang, H. Wu, Y. Xu, J. Guo and N. Voisin. 2015a. Evaluating global streamflow simulations by a physically-based routing model coupled with the Community Land Model, @@ -1581,8 +1189,6 @@ J. of Hydromet., 16(2):948-971, doi: 10.1175/JHM-D-14-0079.1 .. _Lietal2015b: -|br| - Li, H., L. Leung, T. Tesfa, N. Voisin, M. Hejazi, L. Liu, Y. Liu, J. Rice, H. Wu, and X. Yang. 2015. Modeling stream temperature in the Anthropocene: An earth system modeling approach, J. Adv. Model. @@ -1590,68 +1196,50 @@ Earth Syst., 7, doi:10.1002/2015MS000471. .. _Liangetal1994: -|br| - Liang, X., Lettenmaier, D.P., Wood, E.F., and Burges, S.J. 1994. A simple hydrologically based model of land surface water and energy fluxes for GSMs. J. Geophys. Res. 99(D7):14,415–14,428. .. _lichstein2011: -|br| - Lichstein, J.W. and S.W. Pacala, 2011. Local diversity in heterogeneous landscapes: quantitative assessment with a height-structured forest metacommunity model`. Theoretical Ecology 4.2, pp. 269-281. .. _LipscombSacks2012: -|br| - Lipscomb, W., and Sacks, W. 2012. The CESM land ice model documentation and user’s guide. 46 pp. [Available online at http://www.cesm.ucar.edu/models/cesm1.1/cism/]. .. _lischke2006: -|br| - Lischke, H. et al., 2006. TreeMig: a forest-landscape model for simulating spatio-temporal patterns from stand to landscape scale. Ecological Modelling 199.4, pp. 409-420. 41 .. _LloydTaylor1994: -|br| - Lloyd, J. and Taylor, J.A., 1994. On the temperature dependence of soil respiration. Functional Ecology, 8: 315-323. .. _Lloydetal2010: -|br| - Lloyd, J., et al. 2010. Optimisation of photosynthetic carbon gain and within-canopy gradients of associated foliar traits for Amazon forest trees. Biogeosci. 7:1833-1859. DOI:10.5194/bg-7-1833-2010. .. _Lobelletal2006: -|br| - Lobell, D.B., Bala, G., and Duffy, P.B. 2006. Biogeophysical impacts of cropland management changes on climate. Geophys. Res. Lett. 33:L06708. DOI:10.1029/2005GL025492. .. _Lombardozzietal2015: -|br| - Lombardozzi, D.L., Bonan, G.B., Smith, N.G., Dukes, J.S. 2015. Temperature acclimation of photosynthesis and respiration: A key uncertainty in the carbon cycle-climate feedback. Geophys. Res. Lett. 42:8624-8631. .. _Lovelandetal2000: -|br| - Loveland, T.R., Reed, B.C., Brown, J.F., Ohlen, D.O., Zhu, Z., Yang, L., and Merchant, J.W. 2000. Development of a global land cover characteristics database and IGBP DISCover from 1 km AVHRR data. Int. J. @@ -1659,31 +1247,23 @@ Remote Sens. 21:1303-1330. .. _Lowe1977: -|br| - Lowe, P.R. 1977. An approximating polynomial for the computation of saturation vapor pressure. J. Appl. Meteor. 16:100-103. .. _Luoetal2006: -|br| - Luo, Y., Hui, D., and Zhang, D. 2006. Elevated CO2 stimulates net accumulations of carbon and nitrogen in land ecosystems: a meta-analysis. Ecology 87:53-63. .. _Magilletal1997: -|br| - Magill, A.H. et al., 1997. Biogeochemical response of forest ecosystems to simulated chronic nitrogen deposition. Ecological Applications, 7: 402-415. .. _Mahowaldetal2006: -|br| - Mahowald, N.M., Muhs, D.R., Levis, S., Rasch, P.J., Yoshioka, M., Zender, C.S., and Luo, C. 2006. Change in atmospheric mineral aerosols in response to climate: last glacial period, pre-industrial, modern and @@ -1692,23 +1272,17 @@ DOI:10.1029/2005JD006653. .. _Makela2002: -|br| - Makela, A. 2002. Derivation of stem taper from the pipe model theory in a carbon balance framework. Tree Phys. 22:891-905. .. _Maoetal2012: -|br| - Mao, J., Thornton, P.E., Shi, X., Zhao, M., and Post, W.M. 2012. Remote sensing evaluation of CLM4 GPP for the period 2000 to 2009. J. Climate 25:5327-5342. .. _Maoetal2013: -|br| - Mao, J., Shi, X., Thornton, P.E., Hoffman, F.M., Zhu, Z., and Ranga B. Myneni, R.B. 2013. Global latitudinal-asymmetric vegetation growth trends and their driving mechanisms: 1982-2009. Remote Sensing @@ -1716,30 +1290,22 @@ trends and their driving mechanisms: 1982-2009. Remote Sensing .. _Martinetal1980: -|br| - Martin, J.P., Haider, K. and Kassim, G., 1980. Biodegradation and stabilization after 2 years of specific crop, lignin, and polysaccharide carbons in soils. Soil Science Society of America Journal 44:1250-1255. .. _Maryetal1993: -|br| - Mary, B., Fresneau, C., Morel, J.L. and Mariotti, A., 1993. C and N cycling during decomposition of root mucilage, roots and glucose in soil. Soil Biology and Biochemistry 25:1005-1014. .. _Mcdowelletal2013: -|br| - McDowell, N.G. et al., 2013. Evaluating theories of drought-induced vegetation mortality using a multimodel experiment framework. New Phytologist 200.2, pp. 304-321. .. _McGuireetal1992: -|br| - McGuire, A.D., Melillo, J.M., Joyce, L.A., Kicklighter, D.W., Grace, A.L., Moore III, B., and Vorosmarty, C.J. 1992. Interactions between carbon and nitrogen dynamics in estimating net primary productivity for @@ -1748,8 +1314,6 @@ potential vegetation in North America. Global Biogeochem. Cycles .. _Medlynetal2011: -|br| - Medlyn, B.E., Duursma, R.A., Eamus, D., Ellsworth, D.S., Prentice, I.C., Barton, C.V.M., Crous, K.Y., De Angelis, P., Freeman, M., and Wingate, L., 2011. Reconciling the optimal and empirical approaches to @@ -1758,67 +1322,49 @@ doi:10.1111/j.1365-2486.2010.02375.x .. _MelzerOLeary1987: -|br| - Melzer, E., and O’Leary, M.H. 1987. Anapleurotic CO2 Fixation by Phosphoenolpyruvate Carboxylase in C3 Plants. Plant. Physiol. 84:58. .. _Milleretal1994: -|br| - Miller, J.R., Russell, G.L., and Caliri, G. 1994. Continental-scale river flow in climate models. J. Climate 7:914-928. .. _MillingtonQuirk1961: -|br| - Millington, R. and Quirk, J.P., 1961. Permeability of Porous Solids. Transactions of the Faraday Society 57:1200-1207. .. _Mironovetal2010: -|br| - Mironov, D. et al., 2010. Implementation of the lake parameterisation scheme FLake into the numerical weather prediction model COSMO. Boreal Environment Research 15:218-230. .. _MitchellJones2005: -|br| - Mitchell, T.D., and Jones, P.D. 2005. An improved method of constructing a database of monthly climate observations and associated high-resolution grids. Int. J. Climatol. 25:693-712. .. _Moldrupetal2003: -|br| - Moldrup, P. et al. 2003. Modeling diffusion and reaction in soils: X. A unifying model for solute and gas diffusivity in unsaturated soil. Soil Science 168:321-337. .. _mc_2001: -|br| - Moorcroft, P.R., G.C. Hurtt, and S.W. Pacala, 2001. A method for scaling vegetation dynamics: the ecosystem demography model ED. Ecological monographs 71.4, pp. 557-586. .. _Mynenietal2002: -|br| - Myneni, R.B., et al. 2002. Global products of vegetation leaf area and fraction absorbed PAR from year one of MODIS data. Remote Sens. Environ. 83:214-231. .. _Neffetal2005: -|br| - Neff, J.C., Harden, J.W. and Gleixner, G. 2005. Fire effects on soil organic matter content, composition, and nutrients in boreal interior Alaska. Canadian Journal of Forest Research-Revue Canadienne De @@ -1826,8 +1372,6 @@ Recherche Forestiere 35:2178-2187. .. _Neitschetal2005: -|br| - Neitsch, S.L., Arnold, J.G., Kiniry, J.R., and Williams J.R. 2005. Soil and Water Assessment Tool, Theoretical Documentation: Version 2005. Temple, TX. USDA Agricultural Research Service and Texas A&M Blackland @@ -1835,23 +1379,17 @@ Research Center. .. _NegronJuarezetal2015: -|br| - Negron-Juarez, R. Koven, C.D., Riley, W.J., Knox, R.G., Chambers, J.Q. 2015. Environmental Research Letters 10:064017. DOI:10.1088/1748-9326/10/6/064017. .. _NemaniRunning1996: -|br| - Nemani, R.R., and Running, S.W. 1996. Implementation of a hierarchical global vegetation classification in ecosystem function models. J. Veg. Sci. 7:337-346. .. _Niinemetstal1998: -|br| - Niinemets, U., Kull, O., and Tenhunen, J.D. 1998. An analysis of light effects on foliar morphology, physiology, and light interception in temperate deciduous woody species of contrasting shade tolerance. Tree @@ -1859,16 +1397,12 @@ Phys. 18:681-696. .. _Niuetal2005: -|br| - Niu, G.-Y., Yang, Z.-L., Dickinson, R.E., and Gulden, L.E. 2005. A simple TOPMODEL-based runoff parameterization (SIMTOP) for use in global climate models. J. Geophys. Res. 110:D21106. DOI:10.1029/2005JD006111. .. _NiuYang2006: -|br| - Niu, G.-Y., and Yang, Z.-L. 2006. Effects of frozen soil on snowmelt runoff and soil water storage at a continental scale. J. Hydrometeor. 7:937-952. @@ -1884,29 +1418,21 @@ basins. J. Geophys. Res. 112:D21101. DOI:10.1029/2007JD008674. .. _norman1979: -|br| - Norman, J.M., 1979. Modeling the complete crop canopy. Modification of the Aerial Environment of Crops, pp. 249-280. .. _Oikawaetal2005: -|br| - Oikawa, S., Hikosaka, K. and Hirose, T., 2005. Dynamics of leaf area and nitrogen in the canopy of an annual herb, Xanthium canadense. Oecologia, 143: 517-526. .. _Oke1987: -|br| - Oke, T. 1987. Boundary Layer Climates (2:math:`{}^{nd}` edition). Routledge, London and New York. .. _OlesonBonan2000: -|br| - Oleson, K.W., and Bonan, G.B. 2000. The effects of remotely-sensed plant functional type and leaf area index on simulations of boreal forest surface fluxes by the NCAR land surface model. J. Hydrometeor. @@ -1914,8 +1440,6 @@ surface fluxes by the NCAR land surface model. J. Hydrometeor. .. _Olesonetal2004: -|br| - Oleson, K.W., Dai, Y., Bonan, G., Bosilovich, M., Dickinson, R., Dirmeyer, P., Hoffman, F., Houser, P., Levis, S., Niu, G.-Y., Thornton, P., Vertenstein, M., Yang, Z.-L., and Zeng. X. 2004. Technical @@ -1925,8 +1449,6 @@ Colorado. 173 pp. .. _Olesonetal2008a: -|br| - Oleson, K.W., Niu, G.-Y., Yang, Z.-L., Lawrence, D.M., Thornton, P.E., Lawrence, P.J., Stöckli, R., Dickinson, R.E., Bonan, G.B., Levis, S., Dai, A., and Qian, T. 2008a. Improvements to the Community Land Model @@ -1935,8 +1457,6 @@ DOI:10.1029/2007JG000563. .. _Olesonetal2008b: -|br| - Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Grimmond, C.S.B. 2008b. An urban parameterization for a global climate model. 1. Formulation and evaluation for two cities. J. Appl. Meteor. Clim. @@ -1944,8 +1464,6 @@ Formulation and evaluation for two cities. J. Appl. Meteor. Clim. .. _Olesonetal2008c: -|br| - Oleson, K.W., Bonan, G.B., Feddema, J., and Vertenstein, M. 2008c. An urban parameterization for a global climate model. 2. Sensitivity to input parameters and the simulated urban heat island in offline @@ -1953,16 +1471,12 @@ simulations. J. Appl. Meteor. Clim. 47:1061-1076. .. _Olesonetal2010a: -|br| - Oleson, K.W., et al. 2010a. Technical description of version 4.0 of the Community Land model (CLM). NCAR Technical Note NCAR/TN-478+STR, National Center for Atmospheric Research, Boulder, CO, 257 pp. .. _Olesonetal2010b: -|br| - Oleson, K.W., Bonan, G.B., Feddema, J., Vertenstein, M., and Kluzek, E. 2010b. Technical description of an urban parameterization for the Community Land Model (CLMU). NCAR Technical Note NCAR/TN-480+STR, @@ -1970,31 +1484,23 @@ National Center for Atmospheric Research, Boulder, CO, 169 pp. .. _Olesonetal2013: -|br| - Oleson, K.W., et al. 2013. Technical description of version 4.5 of the Community Land Model (CLM). NCAR Technical Note NCAR/TN-503+STR, National Center for Atmospheric Research, Boulder, CO, 420 pp. .. _OlesonFeddema2018: -|br| - Oleson, K.W., and Feddema, J. 2018. Parameterization and surface data improvements and new capabilities for the Community Land Model Urban (CLMU). JAMES, submitted. .. _Olson1963: -|br| - Olson, J.S., 1963. Energy storage and the balance of producers and decomposers in ecological systems. Ecology 44:322-331. .. _Olsonetal2001: -|br| - Olson, D.M., Dinerstein, E., Wikramanayake, E.D., Burgess, N.D., Powell, G.V.N., Underwood, E.C., D’Amico, J.A., Itoua, I., Strand, H. E., Morrison, J. C., Loucks, C. J., Allnutt, T. F., Ricketts, T. H., Kura, @@ -2004,23 +1510,17 @@ Bioscience, 51, 933–938. .. _OrchardCook1983: -|br| - Orchard, V.A. and Cook, F.J., 1983. Relationship between soil respiration and soil moisture. Soil Biology and Biochemistry, 15: 447-453. .. _Owen1964: -|br| - Owen, P.R. 1964. Saltation of uniform grains in air. J. Fluid Mech\ *.* 20:225-242. .. _Ozdoganetal2010: -|br| - Ozdogan, M., Rodell, M., Beaudoing, H.K., and Toll, D.L. 2010. Simulating the effects of irrigation over the United States in a land surface model based on satellite-derived agricultural data. Journal of @@ -2028,122 +1528,88 @@ Hydrometeorology 11:171-184. .. _Pageetal2002: -|br| - Page, S.E., Siegert, F., Rieley, J.O., Boehm, H-D.V., Jaya, A., and Limin, S. 2002. The amount of carbon released from peat and forest fires in Indonesia in 1997. Nature 420:61-65. .. _PanofskyDutton1984: -|br| - Panofsky, H.A., and Dutton, J.A. 1984. Atmospheric Turbulence: Models and Methods for Engineering Applications. John Wiley and Sons, New York. .. _Partonetal1988: -|br| - Parton, W., Stewart, J. and Cole, C., 1988. Dynamics of C, N, P And S in Grassland Soils - A Model. Biogeochemistry 5:109-131. .. _Partonetal1993: -|br| - Parton, W.J., et al. 1993. Observations and modeling of biomass and soil organic matter dynamics for the grassland biome worlwide. Global Biogeochemical Cycles 7:785-809. .. _Partonetal1996: -|br| - Parton, W. et al. 1996. Generalized model for N2 and N2O production from nitrification and denitrification. Global Biogeochemical Cycles 10:401-412. .. _Partonetal2001: -|br| - Parton, W.J. et al. 2001. Generalized model for NOx and N2O emissions from soils. J. Geophys. Res. 106(D15):17403-17419. .. _Paterson1994: -|br| - Paterson, W.S.B., 1994. The Physics of Glaciers. Elsevier Science Inc., New York, 480 pp. .. _Pelletieretal2016: -|br| - Pelletier, J. D., P. D. Broxton, P. Hazenberg, X. Zeng, P. A. Troch, G. Y. Niu, Z. Williams, M. A. Brunke, and D. Gochis, 2016: A gridded global data set of soil, intact regolith, and sedimentary deposit thicknesses for regional and global land surface modeling. J. Adv. Mod. Earth Sys. 8:41-65. .. _peterson1986: -|br| - Peterson, D.L. and K.C. Ryan, 1986. Modeling postfire conifer mortality for long-range planning. Environmental Management 10.6, pp. 797-808. .. _Petrescuetal2010: -|br| - Petrescu, A.M.R. et al. 2010. Modeling regional to global CH4 emissions of boreal and arctic wetlands. Global Biogeochemical Cycles, 24(GB4009). .. _pfeiffer2013: -|br| - Pfeiffer, M., A. Spessa, and J.O. Kaplan, 2013. A model for global biomass burning in preindustrial time: LPJ-LMfire (v1. 0). Geoscientific Model Development 6.3, pp. 643-685. .. _Philip1957: -|br| - Philip, J.R. 1957. Evaporation, and moisture and heat fields in the soil. J. Meteor. 14:354-366. .. _Piaoetal2012: -|br| - Piao, S.L., et al. 2012. The carbon budget of terrestrial ecosystems in East Asia over the last two decades. Biogeosciences 9:3571-3586. .. _Pivovarov1972: -|br| - Pivovarov, A.A., 1972. Thermal Conditions in Freezing Lakes and Reservoirs. John Wiley, New York. .. _Pollmeretal1979: -|br| - Pollmer, W.G., Eberhard, D., Klein, D., and Dhillon, B.S. 1979. Genetic control of nitrogen uptake and translocation in maize. Crop Sci. 19:82-86. .. _Pomeroyetal1998: -|br| - Pomeroy, J. W., D. M. Gray, K. R. Shook, B. Toth, R. L. H. Essery, A. Pietroniro, and N. Hedstrom. 1998. An evaluation of snow accumulation and ablation processes for land surface modelling. Hydrol. Process. 12:2339–2367. .. _Portmannetal2010: -|br| - Portmann, F.T., Siebert, S., and Döll, P. 2010. MIRCA2000 - Global monthly irrigated and rainfed crop areas around the year 2000: A new high-resolution data set for agricultural and hydrological modeling. @@ -2151,24 +1617,18 @@ Global Biogeochem. Cycles. 24, GB1011. DOI:10.1029/2008GB003435. .. _Pressetal1992: -|br| - Press, W.H., Teukolsky, S.A., Vetterling, W.T., and Flannery, B.P. 1992. Numerical Recipes in FORTRAN: The Art of Scientific Computing. Cambridge University Press, New York. .. _Prigentetal2007: -|br| - Prigent, C., Papa, F., Aires, F., Rossow, W.B. and Matthews, E. 2007. Global inundation dynamics inferred from multiple satellite observations, 1993-2000. J. Geophys. Res. 112(D12). .. _Pritchardetal2008: -|br| - Pritchard, M.S., Bush, A.B.G., and Marshall, S.J. 2008. Neglecting ice-atmosphere interactions underestimates ice sheet melt in millennial-scale deglaciation simulations. Geophys. Res. Lett. ** @@ -2176,28 +1636,20 @@ millennial-scale deglaciation simulations. Geophys. Res. Lett. ** .. _purves2008: -|br| - Purves, D.W. et al., 2008. Predicting and understanding forest dynamics using a simple tractable model. Proceedings of the National Academy of Sciences 105.44, pp. 17018-17022. .. _Qianetal2006: -|br| - Qian, T et al., 2006. Simulation of global land surface conditions from 1948 to 2004: Part I: Forcing data and evaluations. J. Hydrometeorology 7, pp. 953-975. .. _RamankuttyFoley1998: -|br| - Ramankutty, N., and Foley, J. A., 1998. Characterizing patterns of global land use: An analysis of global croplands data. Global Biogeochemical Cycles, 12, 667-685. .. _Ramankuttyetal2008: -|br| - Ramankutty, N., Evan, A., Monfreda, C., and Foley, J.A. 2008. Farming the Planet. Part 1: The Geographic Distribution of Global Agricultural Lands in the Year 2000. Global Biogeochem. Cycles. 22:GB1003. @@ -2205,8 +1657,6 @@ DOI:10.1029/2007GB002952. .. _Randlettetal1996: -|br| - Randlett, D.L., Zak, D.R., Pregitzer, K.S., and Curtis, P.S. 1996. Elevated atmospheric carbon dioxide and leaf litter chemistry: Influences on microbial respiration and net nitrogen mineralization. @@ -2214,8 +1664,6 @@ Soil Sci. Soc. Am. J. 60:1571-1577. .. _Rastetteretal1991: -|br| - Rastetter, E.B., Ryan, M.G., Shaver, G.R., Melillo, J.M., Nadelhoffer, K.J., Hobbie, J.E., and Aber, J.D. 1991. A general biogeochemical model describing the responses of the C and N cycles in terrestrial ecosystems @@ -2223,16 +1671,12 @@ to changes in CO2, climate and N deposition. Tree Phys. 9:101-126. .. _Rastneretal2012: -|br| - Rastner, P., Bolch, T., Mölg, N., Machguth, H., and Paul, F., 2012. The first complete glacier inventory for the whole of Greenland, The Cryosphere Discuss., 6, 2399-2436, 10.5194/tcd-6-2399-2012. .. _Rileyetal2011a: -|br| - Riley, W. J., Z. M. Subin, D. M. Lawrence, S. C. Swenson, M. S. Torn, L. Meng, N. Mahowald, and P. Hess, 2011a. Barriers to predicting global terrestrial methane fluxes: Analyses using a methane biogeochemistry @@ -2241,42 +1685,30 @@ DOI:10.5194/bg-8-1925-2011. .. _Rileyetal2011b: -|br| - Riley, W.J. et al. 2011b. CLM4Me, a Methane Biogeochemistry Model Integrated in CESM, Land and Biogeochemistry Model Working Group Meeting, Boulder, CO. .. _Roeschetal2001: -|br| - Roesch, A., M. Wild, H. Gilgen, and A. Ohmura. 2001. A new snow cover fraction parametrization for the ECHAM4 GCM, Clim. Dyn., 17:933–946. .. _Rogers2014: -|br| - Rogers, A., 2014: The use and misuse of Vcmax in Earth system models. Photosynt. Res., 119:1-15. .. _Rogersetal2017: -|br| - Rogers, A., B. E. Medlyn, J. S. Dukes, G. Bonan, S. Caemmerer, M. C. Dietze, J. Kattge, A. D. Leakey, L. M. Mercado, and U. Niinemets, 2017: A roadmap for improving the representation of photosynthesis in Earth system models. New Phytologist, 213:22-42. .. _Ryan1991: -|br| - Ryan, M. G. 1991. A simple method for estimating gross carbon budgets for vegetation in forest ecosystems. Tree Phys. 9:255-266. .. _RunningCoughlan1988: -|br| - Running, S.W. and Coughlan, J.C., 1988. A general model of forest ecosystem processes for regional applications. I. Hydrological balance, canopy gas exchange and primary production processes. Ecological @@ -2284,24 +1716,18 @@ Modelling, 42: 125-154. .. _Runningetal1989: -|br| - Running, S.W. et al., 1989. Mapping regional forest evapotranspiration and photosynthesis by coupling satellite data with ecosystem simlation. Ecology, 70: 1090-1101. .. _RunningGower1991: -|br| - Running, S.W. and Gower, S.T., 1991. FOREST BGC, A general model of forest ecosystem processes for regional applications. II. Dynamic carbon allocation and nitrogen budgets. Tree Physiology, 9: 147-160. .. _RunningHunt1993: -|br| - Running, S.W. and Hunt, E.R., Jr., 1993. Generalization of a forest ecosystem process model for other biomes, BIOME-BGC, and an applicationfor global-scale models. In: J.R. Ehleringer and C. Field @@ -2310,16 +1736,12 @@ Press, San Diego, CA, pp. 141-158. .. _Sacksetal2009: -|br| - Sacks, W. J., Cook, B. I., Buenning, N., Levis, S., and Helkowski, J. H. 2009. Effects of global irrigation on the near-surface climate. Climate Dyn., 33, 159–175. DOI:10.1007/s00382-008-0445-z. .. _Saggaretal1994: -|br| - Saggar, S., Tate, K.R., Feltham, C.W., Childs, C.W. and Parshotam, A., 1994. Carbon turnover in a range of allophanic soils amended with :math:`{}^{14}`\ C-labelled glucose. Soil Biology and Biochemistry, 26: @@ -2327,8 +1749,6 @@ Saggar, S., Tate, K.R., Feltham, C.W., Childs, C.W. and Parshotam, A., .. _Sakaguchietal2009: -|br| - Sakaguchi, K., and Zeng, X. 2009. Effects of soil wetness, plant litter, and under-canopy atmospheric stability on ground evaporation in the Community Land Model (CLM3.5). J. Geophys. Res. 114:D01107. @@ -2336,14 +1756,10 @@ DOI:10.1029/2008JD010834. .. _sato2007: -|br| - Sato, H., A. Itoh, and T. Kohyama, 2007. SEIB-DGVM: A new Dynamic Global Vegetation Model using a spatially explicit individual-based approach. Ecological Modelling 200.3, pp. 2793307. .. _Schaafetal2002: -|br| - Schaaf, C.B., Gao, F., Strahler, A.H., Lucht, W., Li, X., Tsang, T., Strugnell, N.C., Zhang, X., Jin, Y., and Muller, J.-P. 2002. First operational BRDF, albedo nadir reflectance products from MODIS. Remote @@ -2351,54 +1767,40 @@ Sens. Environ. 83:135-148. .. _Schlesinger1997: -|br| - Schlesinger, W.H., 1997. Biogeochemistry: an analysis of global change. Academic Press, London, 588 pp. .. _SchnellKing1996: -|br| - Schnell, S. and King, G.M., 1996. Responses of methanotrophic activity in soils and cultures to water stress. Applied and Environmental Microbiology 62:3203-3209. .. _Segers1998: -|br| - Segers, R., 1998. Methane production and methane consumption: a review of processes underlying wetland methane fluxes. Biogeochemistry 41:23-51. .. _Sellers1985: -|br| - Sellers, P.J. 1985. Canopy reflectance, photosynthesis and transpiration. Int. J. Remote Sens. 6:1335-1372. .. _Sellersetal1986: -|br| - Sellers, P.J., Mintz, Y., Sud, Y.C., and Dalcher, A. 1986. A simple biosphere model (SiB) for use within general circulation models. J. Atmos. Sci. 43:505-531. .. _Sellersetal1988: -|br| - Sellers, P.J., Hall, F.G., Asrar, G., Strebel, D.E., and Murphy, R.E. 1988. The First ISLSCP Field Experiment (FIFE). Bull. Amer. Meteor. Soc. 69:22-27. .. _Sellersetal1992: -|br| - Sellers, P.J., Berry, J.A., Collatz, G.J., Field, C.B., and Hall, F.G. 1992. Canopy reflectance, photosynthesis, and transpiration. III. A reanalysis using improved leaf models and a new canopy integration @@ -2406,16 +1808,12 @@ scheme. Remote Sens. Environ. 42:187-216. .. _Sellersetal1995: -|br| - Sellers, P.J., et al. 1995. The Boreal Ecosystem-Atmosphere Study (BOREAS): An overview and early results from the 1994 field year. Bull. Amer. Meteor. Soc. 76:1549-1577. .. _Sellersetal1996: -|br| - Sellers, P.J., Randall, D.A., Collatz, G.J., Berry, J.A., Field, C.B., Dazlich, D.A., Zhang, C., Collelo, G.D., and Bounoua, L. 1996. A revised land surface parameterization (SiB2) for atmospheric GCMs. Part I: Model @@ -2423,14 +1821,10 @@ formulation. J. Climate 9:676-705. .. _sellers1996: -|br| - Sellers, Piers J et al. (1996). A revised land surface parameterization (SiB2) for atmospheric GCMs. Part II: The generation of global fields of terrestrial biophysical parameters from satellite data. Journal of climate 9.4, pp. 706-737. .. _Shietal2013: -|br| - Shi, X., Mao, J., Thornton, P.E., and Huang, M. 2013. Spatiotemporal patterns of evapotranspiration in response to multiple environmental factors simulated by the Community Land Model. Environ. Res. Lett. @@ -2438,65 +1832,47 @@ factors simulated by the Community Land Model. Environ. Res. Lett. .. _Shietal2016: -|br| - Shi, M., J. B. Fisher, E. R. Brzostek, and R. P. Phillips, 2016: Carbon cost of plant nitrogen acquisition: global carbon cycle impact from an improved plant nitrogen cycle in the Community Land Model. Glob. Change Biol., 22:1299-1314. .. _Shiklomanov2000: -|br| - Shiklomanov, I.A. 2000. Appraisal and assessment of world water resources. Water International 25:11-32. .. _Siebertetal2005: -|br| - Siebert, S., Döll, P., Hoogeveen, J., Faures, J.M., Frenken, K., Feick, S., 2005. Development and validation of the global map of irrigation areas. Hydrol Earth Syst Sc 9:535–547 .. _Simardetal2011: -|br| - Simard, M., Pinto, N., Fisher, J.B., and Baccini, A. (2011), Mapping forest canopy height globally with spaceborne lidar. J. Geophys. Res., 116, G04021, doi:10.1029/2011JG001708. .. _Simpsonetal1983: -|br| - Simpson, R.J., Lambers, H., and Dalling, M.J. 1983. Nitrogen redistribution during grain growth in wheat (Triticum avestivum L.). Plant Physiol. 71:7-14. .. _sitch2003: -|br| - Sitch, S et al. (2003). Evaluation of ecosystem dynamics, plant geography and terrestrial carbon cycling in the LPJ dynamic global vegetation model. Global Change Biology 9.2, pp. 161-185. .. _Sivak2013: -|br| - Sivak, M. 2013. Air conditioning versus heating: climate control is more energy demanding in Minneapolis than in Miami. Environ. Res. Lett., 8, doi:10.1088/1748-9326/8/1/014050. .. _smith2001: -|br| - Smith, B., I.C. Prentice, and M.T. Sykes, 2001. Representation of vegetation dynamics in the modelling of terrestrial ecosystems: comparing two contrasting approaches within European climate space. Global Ecology and Biogeography 10.6, pp. 621-637. .. _Smithetal2005: -|br| - Smith, A.M.S., Wooster, M.J., Drake, N.A., Dipotso, F.M. and Perry, G.L.W., 2005. Fire in African savanna: Testing the impact of incomplete combustion on pyrogenic emissions estimates. Ecological Applications, @@ -2504,38 +1880,28 @@ combustion on pyrogenic emissions estimates. Ecological Applications, .. _smith2007: -|br| - Smith, A.M. and M. Stitt, 2007. Coordination of carbon supply and plant growth. Plant, cell & environment 30.9, pp. 1126-1149. .. _Sollins1982: -|br| - Sollins, P., 1982. Input and decay of coarse woody debris in coniferous stands in western Oregon and Washington. Canadian Journal of Forest Research, 12: 18-28. .. _SonGower1991: -|br| - Son, Y. and Gower, S.T., 1991. Aboveground nitrogen and phosphorus use by five plantation-grown trees with different leaf longevities. Biogeochemistry, 14: 167-191. .. _Sorensen1981: -|br| - Sørensen, L.H., 1981. Carbon-nitrogen relationships during the humification of cellulose in soils containing different amounts of clay. Soil Biology and Biochemistry, 13: 313-321. .. _Sperryetal1998: -|br| - Sperry, J.S., Adler, F.R., Campbell, G.S. and Comstock, J.P. 1998. Limitation of plant water use by rhizosphere and xylem conductance: results from a model. Plant, Cell & Environment, 21: 347–359. @@ -2543,16 +1909,12 @@ doi:10.1046/j.1365-3040.1998.00287.x .. _SperryandLove2015: -|br| - Sperry, J.S. and Love, D.M. 2015. What plant hydraulics can tell us about responses to climate-change droughts. New Phytol, 207: 14–27. doi:10.1111/nph.13354 .. _Sprugeletal1995: -|br| - Sprugel, D.G., Ryan, M.G., Brooks, J.R., Vogt, K.A., and Martin, T.A. 1995. Respiration from the organ level to stand level. pp. 255-299. In: W. K. Smith and T. M. Hinkley (editors) Resource Physiology of Conifers. @@ -2560,23 +1922,17 @@ Academic Press, San Diego,CA. .. _StaufferAharony1994: -|br| - Stauffer, D., and Aharony, A. 1994. Introduction to Percolation Theory. Taylor and Francis, London. .. _Stilletal2003: -|br| - Still, C.J., Berry, J.A., Collatz, G.J., and DeFries, R.S. 2003. Global distribution of C3 and C4 vegetation: carbon cycle implications. Global Biogeochem. Cycles 17:1006. DOI:10.1029/2001GB001807. .. _Stocklietal2008: -|br| - Stöckli, R., Lawrence, D.M., Niu, G.-Y., Oleson, K.W., Thornton, P.E., Yang, Z.-L., Bonan, G.B., Denning, A.S., and Running, S.W. 2008. Use of FLUXNET in the Community Land Model development. J. Geophys. Res. @@ -2584,39 +1940,29 @@ FLUXNET in the Community Land Model development. J. Geophys. Res. .. _Stracketal2006: -|br| - Strack, M., Kellner, E. and Waddington, J.M., 2006. Effect of entrapped gas on peatland surface level fluctuations. Hydrological Processes 20:3611-3622. .. _Strahleretal1999: -|br| - Strahler, A.H., Muchoney, D., Borak, J., Friedl, M., Gopal, S., Lambin, E., and Moody. A. 1999. MODIS Land Cover Product: Algorithm Theoretical Basis Document (Version 5.0). Boston University, Boston. .. _Stull1988: -|br| - Stull, R.B. 1988. An Introduction to Boundary Layer Meteorology. Kluwer Academic Publishers, Dordrecht. .. _Subinetal2012a: -|br| - Subin, Z.M., Riley, W.J. and Mironov, D. 2012a. Improved lake model for climate simulations, J. Adv. Model. Earth Syst., 4, M02001. DOI:10.1029/2011MS000072. .. _Subinetal2012b: -|br| - Subin, Z.M., Murphy, L.N., Li, F., Bonfils, C. and Riley, W.J., 2012b. Boreal lakes moderate seasonal and diurnal temperature variation and perturb atmospheric circulation: analyses in the Community Earth System @@ -2624,32 +1970,24 @@ Model 1 (CESM1). Tellus A, North America, 64. .. _Sunetal2012: -|br| - Sun, Y., Gu, L., and Dickinson, R. E. 2012. A numerical issue in calculating the coupled carbon and water fluxes in a climate model, J. Geophys. Res., 117, D22103. DOI:10.1029/2012JD018059. .. _Swensonetal2012: -|br| - Swenson, S.C., Lawrence, D.M., and Lee, H. 2012. Improved Simulation of the Terrestrial Hydrological Cycle in Permafrost Regions by the Community Land Model. JAMES, 4, M08002. DOI:10.1029/2012MS000165. .. _SwensonLawrence2012: -|br| - Swenson, S.C. and Lawrence, D.M. 2012. A New Fractional Snow Covered Area Parameterization for the Community Land Model and its Effect on the Surface Energy Balance. JGR, 117, D21107. DOI:10.1029/2012JD018178. .. _SwensonLawrence2014: -|br| - Swenson, S.C., and D. M. Lawrence. 2014. Assessing a dry surface layer-based soil resistance parameterization for the Community Land Model using GRACE and FLUXNET-MTE data. JGR, 119, 10, 299–10,312, @@ -2657,23 +1995,17 @@ DOI:10.1002/2014JD022314. .. _SwensonLawrence2015: -|br| - Swenson, S.C., and D. M. Lawrence. 2015. A GRACE-based assessment of interannual groundwater dynamics in the Community Land Model. WRR, 51, doi:10.1002/2015WR017582. .. _TaWeiland1992: -|br| - Ta, C.T. and Weiland, R.T. 1992. Nitrogen partitioning in maize during ear development. Crop Sci. 32:443-451. .. _TangRiley2013: -|br| - Tang, J.Y. and Riley, W.J. 2013. A new top boundary condition for modeling surface diffusive exchange of a generic volatile tracer: Theoretical analysis and application to soil evaporation. Hydrol. Earth @@ -2681,30 +2013,22 @@ Syst. Sci. 17:873-893. .. _Tarnocaietal2011: -|br| - Tarnocai, C., Kettles, I. M., and Lacelle, B., 2011. Peatlands of Canada, Geological Survey of Canada, Open File 6561, CD-ROM. DOI:10.495/288786. .. _Tayloretal1989: -|br| - Taylor, B.R., Parkinson, D. and Parsons, W.F.J., 1989. Nitrogen and lignin content as predictors of litter decay rates: A microcosm test. Ecology, 70: 97-104. .. _Thomasetal2015: -|br| - Thomas R.Q., Brookshire E.N., Gerber S. 2015. Nitrogen limitation on land: how can it occur in Earth system models? Global Change Biology, 21, 1777-1793, doi:10.1111/gcb.12813. .. _Thonickeetal2001: -|br| - Thonicke, K., Venevsky, S., Sitch, S., and Cramer, W. 2001. The role of fire disturbance for global vegetation dynamics: coupling fire into a Dynamic Global Vegetation Model. Global Ecology and Biogeography @@ -2712,15 +2036,11 @@ Dynamic Global Vegetation Model. Global Ecology and Biogeography .. _thonickeetal2010: -|br| - Thonicke, K. et al., 2010. The influence of vegetation, fire spread and fire behaviour on biomass burning and trace gas emissions: results from a process-based model. Biogeosciences 7.6, pp. 1991-2011. .. _Thornton1998: -|br| - Thornton, P.E., 1998. Regional ecosystem simulation: combining surface- and satellite-based observations to study linkages between terrestrial energy and mass budgets. Ph.D. Thesis, The University of Montana, @@ -2728,8 +2048,6 @@ Missoula, 280 pp. .. _Thorntonetal2002: -|br| - Thornton, P.E., Law, B.E., Gholz, H.L., Clark, K.L., Falge, E., Ellsworth, D.S., Goldstein, A.H., Monson, R.K., Hollinger, D., Falk, M., Chen, J., and Sparks, J.P. 2002. Modeling and measuring the effects of @@ -2738,24 +2056,18 @@ needleleaf forests. Agric. For. Meteor. 113:185-222. .. _ThorntonRosenbloom2005: -|br| - Thornton, P.E., and Rosenbloom, N.A. 2005. Ecosystem model spin-up: estimating steady state conditions in a coupled terrestrial carbon and nitrogen cycle model. Ecological Modelling 189:25-48. .. _ThorntonZimmermann2007: -|br| - Thornton, P.E., and Zimmermann, N.E. 2007. An improved canopy integration scheme for a land surface model with prognostic canopy structure. J. Climate 20:3902-3923. .. _Thorntonetal2007: -|br| - Thornton, P.E., Lamarque, J.-F., Rosenbloom, N.A., and Mahowald, N.M. 2007. Influence of carbon-nitrogen cycle coupling on land model response to CO\ :sub:`2` fertilization and climate variability. Global @@ -2763,8 +2075,6 @@ Biogeochem. Cycles 21:GB4018. .. _Thorntonetal2009: -|br| - Thornton, P.E., Doney, S.C., Lindsay, K., Moore, J.K., Mahowald, N., Randerson, J.T., Fung, I., Lamarque, J.F., Feddema, J.J., and Lee, Y.H. 2009. Carbon-nitrogen interactions regulate climate-carbon cycle @@ -2773,8 +2083,6 @@ Biogeosci. 6:2099-2120. .. _Tianetal2010: -|br| - Tian, H. et al. 2010. Spatial and temporal patterns of CH4 and N2O fluxes in terrestrial ecosystems of North America during 1979-2008: application of a global biogeochemistry model. Biogeosciences @@ -2782,8 +2090,6 @@ application of a global biogeochemistry model. Biogeosciences .. _Toonetal1989: -|br| - Toon, O.B., McKay, C.P., Ackerman, T.P., and Santhanam, K. 1989. Rapid calculation of radiative heating rates and photodissociation rates in inhomogeneous multiple scattering atmospheres. J. Geophys. Res. @@ -2791,16 +2097,12 @@ inhomogeneous multiple scattering atmospheres. J. Geophys. Res. .. _Turetskyetal2002: -|br| - Turetsky, M.R., Wieder, R.K., Halsey, L.A., and Vitt, D.H. 2002. Current disturbance and the diminishing peatland carbon sink. Geophys. Res. Lett. 29:1526. DOI:10.1029/2001GL014000. .. _Turetskyetal2004: -|br| - Turetsky, M.R., Amiro, B.D., Bosch, E., and Bhatti, J.S. 2004. Historical burn area in western Canadian peatlands and its relationship to fire weather indices. Global Biogeochem. Cycles 18:GB4014. @@ -2808,37 +2110,27 @@ DOI:10.1029/2004GB002222. .. _Tyeetal2005: -|br| - Tye, A.M., et al. 2005. The fate of N-15 added to high Arctic tundra to mimic increased inputs of atmospheric nitrogen released from a melting snowpack. Global Change Biology 11:1640-1654. .. _Unlandetal1996: -|br| - Unland, H.E., Houser, P.R., Shuttleworth, W.J., and Yang, Z.-L. 1996. Surface flux measurement and modeling at a semi-arid Sonoran Desert site. Agric. For. Meteor. 82:119-153. .. _UNSTAT2005: -|br| - UNSTAT, 2005. National Accounts Main Aggregates Database, United Nations Statistics Division. .. _uriarte2009: -|br| - Uriarte, M. et al., 2009. Natural disturbance and human land use as determinants of tropical forest dynamics: results from a forest simulator. Ecological Monographs 79.3, pp. 423-443. .. _VallanoSparks2007: -|br| - Vallano, D.M. and Sparks, J.P. 2007. Quantifying foliar uptake of gaseous itrogen dioxide using enriched foliar :math:`\delta^{15}`\ N values. New Phytologist @@ -2846,8 +2138,6 @@ gaseous itrogen dioxide using enriched foliar .. _vanderWerfetal2010: -|br| - van der Werf, G.R., Randerson, J.T., Giglio, L., Collatz, G.J., Mu, M., Kasibhatla, S.P., Morton, D.C., DeFries, R.S., Jin, Y., van Leeuwen, T.T. 2010. Global fire emissions and the contribution of deforestation, @@ -2856,16 +2146,12 @@ Phys. 10:11707-11735. .. _van Veenetal1984: -|br| - van Veen, J.A., Ladd, J.N. and Frissel, M.J., 1984. Modelling C and N turnover through the microbial biomass in soil. Plant and Soil, 76: 257-274. .. _vanKampenhoutetal2017: -|br| - van Kampenhout, L., J.T.M. Lenaerts, W.H. Lipscomb, W.J. Sacks, D.M. Lawrence, A.G. Slater, and M.R. van den Broeke, 2017. Improving the Representation of Polar Snow and Firn in the @@ -2873,8 +2159,6 @@ Community Earth System Model. Journal of Advances in Modeling Earth Systems 9, n .. _VanTrichtetal2016: -|br| - Van Tricht, K., Lhermitte, S., Gorodetskaya, I.V. and van Lipzig, N.P.M., 2016. Improving satellite-retrieved surface radiative fluxes in polar regions using a smart sampling approach. The Cryosphere @@ -2882,8 +2166,6 @@ polar regions using a smart sampling approach. The Cryosphere .. _VanVuurenetal2006: -|br| - Van Vuuren, D.P., Lucas, P.S., and Hilderink, H.B.M., 2006. Downscaling drivers of global environmental change: enabling use of global SRES scenarios at the national and grid levels, Report 550025001, Netherlands @@ -2891,22 +2173,16 @@ Environmental Assessment Agency, 45 pp. .. _VanninenMakela2005: -|br| - Vanninen, P., and Makela, A. 2005. Carbon budget for Scots pine trees: effects of size, competition and site fertility on growth allocation and production. Tree Phys. 25:17-30. .. _venevsky2002: -|br| - Venevsky, S. et al., 2002. Simulating fire regimes in human-dominated ecosystems: Iberian Peninsula case study. Global Change Biology 8.10, pp. 984-998. .. _VerdinGreenlee1996: -|br| - Verdin, K. L., and S. K. Greenlee, 1996. Development of continental scale digital elevation models and extraction of hydrographic features, paper presented at the Third International Conference/Workshop on @@ -2915,16 +2191,12 @@ January, Natl. Cent. for Geogr. Inf. and Anal., Santa Barbara, Calif. .. _Vionnetetal2012: -|br| - Vionnet, V., E. Brun, S. Morin, A. Boone, S. Faroux, P. Le Moigne, E. Martin, and J.-M. Willemet. The Detailed Snowpack Scheme Crocus and Its Implementation in SURFEX v7.2. GMD 5, no. 3 (May 24, 2012): 773-91. https://doi.org/10.5194/gmd-5-773-2012. .. _Viovy2011: -|br| - Viovy, N. 2011. CRUNCEP dataset. [Description available at http://dods.extra.cea.fr/data/p529viov/cruncep/readme.htm. Data available at @@ -2932,23 +2204,17 @@ http://dods.extra.cea.fr/store/p529viov/cruncep/V4\_1901\_2011/]. .. _VitousekHowarth1991: -|br| - Vitousek, P.M., and Howarth, R.W. 1991. Nitrogen limitation on land and in the sea: How can it occur? Biogeochem. 13:87-115. .. _Walteretal2001: -|br| - Walter, B.P., Heimann, M. and Matthews, E., 2001. Modeling modern methane emissions from natural wetlands 1. Model description and results. J. Geophys. Res. 106(D24):34189-34206. .. _Waniaetal2009: -|br| - Wania, R., Ross, I. and Prentice, I.C. 2009. Integrating peatlands and permafrost into a dynamic global vegetation model: 2. Evaluation and sensitivity of vegetation and carbon cycle processes. Global Biogeochem. @@ -2956,8 +2222,6 @@ Cycles 23. .. _Waniaetal2010: -|br| - Wania, R., Ross, I. and Prentice, I.C. 2010. Implementation and evaluation of a new methane model within a dynamic global vegetation model LPJ-WHyMe v1.3. Geoscientific Model Development Discussions @@ -2965,30 +2229,22 @@ model LPJ-WHyMe v1.3. Geoscientific Model Development Discussions .. _WangZeng2009: -|br| - Wang, A., and Zeng, X. 2009. Improving the treatment of vertical snow burial fraction over short vegetation in the NCAR CLM3. Adv. Atmos. Sci. 26:877-886. DOI:10.1007/s00376-009-8098-3. .. _weng2014: -|br| - Weng, E.S. et al., 2014. Scaling from individuals to ecosystems in an Earth System Model using a mathematically tractable model of height-structured competition for light. Biogeosciences Discussions 11.12, pp. 17757-17860. .. _Whiteetal1997: -|br| - White, M.A., Thornton, P.E., and Running, S.W. 1997. A continental phenology model for monitoring vegetation responses to interannual climatic variability. Global Biogeochem. Cycles 11:217-234. .. _Whiteetal2000: -|br| - White, M.A., Thornton, P.E., Running, S.W., and Nemani, R.R. 2000. Parameterization and sensitivity analysis of the Biome-BGC terrestrial ecosystem model: net primary production controls. Earth Interactions @@ -2996,8 +2252,6 @@ ecosystem model: net primary production controls. Earth Interactions .. _Wiederetal2015: -|br| - Wieder, W. R., Cleveland, C. C., Lawrence, D. M., and Bonan, G. B. 2015. Effects of model structural uncertainty on carbon cycle projections: biological nitrogen fixation as a case study. Environmental Research @@ -3005,8 +2259,6 @@ Letters, 10(4), 044016. .. _Williamsetal1996: -|br| - Williams, M., Rastetter, E.B., Fernandes, D.N., Goulden, M.L., Wofsy, S.C., Shaver, G.R., Melillo, J.M., Munger, J.W., Fan, S.M. and Nadelhoffer, K.J. 1996. Modelling the soil-plant-atmosphere @@ -3017,15 +2269,11 @@ doi:10.1111/j.1365-3040.1996.tb00456.x .. _WiscombeWarren1980: -|br| - Wiscombe, W.J., and Warren, S.G. 1980. A model for the spectral albedo of snow. I. Pure snow. J. Atmos. Sci. 37:2712-2733. .. _Woodetal1992: -|br| - Wood, E.F., Lettenmaier, D.P., and Zartarian, V.G. 1992. A land-surface hydrology parameterization with subgrid variability for general circulation models. J. Geophys. Res. 97(D3):2717–2728. @@ -3033,96 +2281,70 @@ DOI:10.1029/91JD01786. .. _WorldBank2004: -|br| - World Bank, 2004. World development indicators 2004, Oxford University Press, New York, 416 pp. .. _Wuetal2011: -|br| - Wu, H., J. S. Kimball, N. Mantua, and J. Stanford, 2011: Automated upscaling of river networks for macroscale hydrological modeling. Water Resour. Res., 47, W03517, doi:10.1029/2009WR008871. .. _Wuetal2012: -|br| - Wu, H., J. S. Kimball, H. Li, M. Huang, L. R. Leung, and R. F. Adler, 2012. A New Global River Network Database for Macroscale Hydrologic modeling, Water Resour. Res., 48, W09701, doi:10.1029/2012WR012313. .. _xiaodong2005: -|br| - Xiaodong, Y. and H.H. Shugart, 2005. FAREAST: a forest gap model to simulate dynamics and patterns of eastern Eurasian forests. Journal of Biogeography 32.9, pp. 1641-1658. .. _Xuetal2012: -|br| - Xu, C., R. Fisher, S. D. Wullschleger, C. J. Wilson, M. Cai, and N. G. McDowell, 2012: Toward a mechanistic modeling of nitrogen limitation on vegetation dynamics. PloS one, 7:e37914. .. _Yang1998: -|br| - Yang, Z.-L. 1998. Technical note of a 10-layer soil moisture and temperature model. Unpublished manuscript. .. _Zenderetal2003: -|br| - Zender, C.S., Bian, H., and Newman, D. 2003. Mineral dust entrainment and deposition (DEAD) model: Description and 1990s dust climatology. ** J. Geophys. Res\ *.* 108(D14):4416. DOI:10.1029/2002JD002775. .. _ZengDickinson1998: -|br| - Zeng, X., and Dickinson, R.E. 1998. Effect of surface sublayer on surface skin temperature and fluxes. J.Climate 11:537-550. .. _Zengetal1998: -|br| - Zeng, X., Zhao, M., and Dickinson, R.E. 1998. Intercomparison of bulk aerodynamic algorithms for the computation of sea surface fluxes using the TOGA COARE and TAO data. J. Climate 11:2628-2644. .. _Zeng2001: -|br| - Zeng, X. 2001. Global vegetation root distribution for land modeling. J. Hydrometeor. 2:525-530. .. _Zengetal2002: -|br| - Zeng, X., Shaikh, M., Dai, Y., Dickinson, R.E., and Myneni, R. 2002. Coupling of the Common Land Model to the NCAR Community Climate Model. J. Climate 15:1832-1854. .. _Zengetal2005: -|br| - Zeng, X., Dickinson, R.E., Barlage, M., Dai, Y., Wang, G., and Oleson, K. 2005. Treatment of under-canopy turbulence in land models. J. Climate 18:5086-5094. .. _ZengWang2007: -|br| - Zeng, X., and Wang, A. 2007. Consistent parameterization of roughness length and displacement height for sparse and dense canopies in land models. J. Hydrometeor. 8:730-737. @@ -3133,8 +2355,6 @@ water table. J. Hydrometeor. 10:308-319. .. _Zengetal2008: -|br| - Zeng, X., Zeng, X., and Barlage, M. 2008. Growing temperate shrubs over arid and semiarid regions in the Community Land Model - Dynamic Global Vegetation Model. Global Biogeochem. Cycles 22:GB3003. @@ -3142,8 +2362,6 @@ DOI:10.1029/2007GB003014. .. _Zhangetal2002: -|br| - Zhang, Y., Li, C.S., Trettin, C.C., Li, H. and Sun, G., 2002. An integrated model of soil, hydrology, and vegetation for carbon dynamics in wetland ecosystems. Global Biogeochemical Cycles 16. @@ -3151,8 +2369,6 @@ DOI:10.1029/2001GB001838. .. _Zhuangetal2004: -|br| - Zhuang, Q., et al. 2004. Methane fluxes between terrestrial ecosystems and the atmosphere at northern high latitudes during the past century: A retrospective analysis with a process-based biogeochemistry model. @@ -3160,8 +2376,6 @@ Global Biogeochemical Cycles 18. DOI:10.1029/2004GB002239. .. _Zilitinkevich1970: -|br| - Zilitinkevich, S.S. 1970. Dynamics of the Atmospheric Boundary Layer. Leningrad Gidrometeor. diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index c63e8a37b1..7b74bdf4ab 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -144,7 +144,7 @@ interior building temperature at yearly time resolution. .. _Figure schematic of THESIS urban properties tool: -.. Figure:: ../../../images/tech_note/Urban/image3.gif +.. Figure:: ../../../images/tech_note/Urban/image3.png Schematic of THESIS urban properties tool. Executable scripts are in orange, input files are blue, and output files are green. Items within the black box outline are either read in as input, executed, or output by the driver script (urban_prop.csh). From 6432dd2bffd01ee8c75eceb505435ef4fd182653 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Tue, 24 Mar 2020 13:20:41 -0400 Subject: [PATCH 0712/1973] Add files via upload --- src/biogeophys/LunaMod.F90 | 4 +-- src/biogeophys/PhotosynthesisMod.F90 | 2 -- src/biogeophys/TemperatureType.F90 | 3 +- src/biogeophys/WaterDiagnosticBulkType.F90 | 35 ++++++++++------------ 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 3ff3fade55..f451327f0d 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -820,12 +820,12 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR real(r8), intent (in) :: PNetold !old value of the proportion of nitrogen allocated to electron transport (unitless) real(r8), intent (in) :: PNrespold !old value of the proportion of nitrogen allocated to respiration (unitless) real(r8), intent (in) :: PNcbold !old value of the proportion of nitrogen allocated to carboxylation (unitless) + real(r8), intent (in) :: dayl_factor !daylight scale factor real(r8), intent (out):: PNstoreopt !optimal proportion of nitrogen for storage real(r8), intent (out):: PNlcopt !optimal proportion of nitrogen for light capture real(r8), intent (out):: PNetopt !optimal proportion of nitrogen for electron transport real(r8), intent (out):: PNrespopt !optimal proportion of nitrogen for respiration real(r8), intent (out):: PNcbopt !optial proportion of nitrogen for carboxyaltion - real(r8), intent(in) :: dayl_factor !lbirch: added to scaled light: !------------------------------------------------------------------------------------------------------------------------------- !intermediate variables real(r8) :: Carboncost1 !absolute amount of carbon cost associated with maintenance respiration due to deccrease in light capture nitrogen(g dry mass per day) @@ -1256,7 +1256,7 @@ subroutine NUE(O2a, ci, tgrow, tleaf, NUEj,NUEc,Kj2Kc) real(r8) :: awc !second deminator term for rubsico limited carboxylation rate based on Farquhar model real(r8) :: c_p !CO2 compenstation point (Pa) - Fc = VcmxTLenuning(tgrow, tleaf) * Fc25 + Fc = VcmxTLeuning(tgrow, tleaf) * Fc25 Fj = JmxTLeuning(tgrow, tleaf) * Fj25 k_c = params_inst%kc25_coef * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) k_o = params_inst%ko25_coef * exp((36380.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 11249d534c..b1a3205be8 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -3176,8 +3176,6 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & ! Adjust for temperature vcmaxse = 486.0_r8 jmaxse = 495.0_r8 - !vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) - !jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) tpuse = vcmaxse vcmaxc = fth25 (vcmaxhd, vcmaxse) jmaxc = fth25 (jmaxhd, jmaxse) diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 4949c5f24b..4b52472fb4 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -55,6 +55,7 @@ module TemperatureType real(r8), pointer :: thv_col (:) ! col virtual potential temperature (kelvin) real(r8), pointer :: thm_patch (:) ! patch intermediate variable (forc_t+0.0098*forc_hgt_t_patch) real(r8), pointer :: t_a10_patch (:) ! patch 10-day running mean of the 2 m temperature (K) + real(r8), pointer :: soila10_patch (:) ! patch 10-day running mean of the soil layer 3 temperature (K) real(r8), pointer :: t_a10min_patch (:) ! patch 10-day running mean of min 2-m temperature real(r8), pointer :: t_a5min_patch (:) ! patch 5-day running mean of min 2-m temperature @@ -1260,7 +1261,7 @@ subroutine InitAccVars(this, bounds) this%t_a10_patch(begp:endp) = rbufslp(begp:endp) call extract_accum_field ('SOIL10', rbufslp, nstep) - this%t_a10_patch(begp:endp) = rbufslp(begp:endp) + this%soila10_patch(begp:endp) = rbufslp(begp:endp) call extract_accum_field ('TDM5', rbufslp, nstep) this%t_a5min_patch(begp:endp) = rbufslp(begp:endp) diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index 9b07ceb847..b746e689cf 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -38,7 +38,7 @@ module WaterDiagnosticBulkType real(r8), pointer :: h2osno_total_col (:) ! col total snow water (mm H2O) real(r8), pointer :: snow_depth_col (:) ! col snow height of snow covered area (m) - real(r8), pointer :: snow_10day (:) ! col snow height 10 day avg + real(r8), pointer :: snow_5day (:) ! col snow height 5 day avg real(r8), pointer :: snowdp_col (:) ! col area-averaged snow height (m) real(r8), pointer :: snow_layer_unity_col (:,:) ! value 1 for each snow layer, used for history diagnostics real(r8), pointer :: bw_col (:,:) ! col partial density of water in the snow pack (ice + liquid) [kg/m3] @@ -180,7 +180,7 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%h2osno_total_col (begc:endc)) ; this%h2osno_total_col (:) = nan allocate(this%snow_depth_col (begc:endc)) ; this%snow_depth_col (:) = nan - allocate(this%snow_10day (begc:endc)) ; this%snow_10day (:) = nan + allocate(this%snow_5day (begc:endc)) ; this%snow_5day (:) = nan allocate(this%snowdp_col (begc:endc)) ; this%snowdp_col (:) = nan allocate(this%snow_layer_unity_col (begc:endc,-nlevsno+1:0)) ; this%snow_layer_unity_col (:,:) = nan allocate(this%bw_col (begc:endc,-nlevsno+1:0)) ; this%bw_col (:,:) = nan @@ -405,14 +405,13 @@ subroutine InitBulkHistory(this, bounds) avgflag='A', & long_name=this%info%lname('snow height of snow covered area'), & ptr_col=this%snow_depth_col, c2l_scale_type='urbanf') - !lbirch: added lagged snow depth variable - this%snow_10day(begc:endc) = spval + this%snow_5day(begc:endc) = spval call hist_addfld1d ( & - fname=this%info%fname('SNOW_10D'), & + fname=this%info%fname('SNOW_5D'), & units='m', & avgflag='A', & - long_name=this%info%lname('10day snow avg'), & - ptr_col=this%snow_10day, c2l_scale_type='urbanf') + long_name=this%info%lname('5day snow avg'), & + ptr_col=this%snow_5day, c2l_scale_type='urbanf') call hist_addfld1d ( & fname=this%info%fname('SNOW_DEPTH_ICE'), & @@ -538,9 +537,8 @@ subroutine InitAccBuffer (this, bounds) type(bounds_type), intent(in) :: bounds !--------------------------------------------------------------------- - !lbirch added 10day avg - call init_accum_field (name='SNOW_10D', units='m', & - desc='10-day running mean of snowdepth', accum_type='runmean', accum_period=-5, & + call init_accum_field (name='SNOW_5D', units='m', & + desc='5-day running mean of snowdepth', accum_type='runmean', accum_period=-5, & subgrid_type='column', numlev=1, init_value=0._r8) @@ -575,9 +573,8 @@ subroutine InitAccVars (this, bounds) ! Determine time step nstep = get_nstep() - !lbirch added - call extract_accum_field ('SNOW_10D', rbufslp, nstep) - this%snow_10day(begc:endc) = rbufslp(begc:endc) + call extract_accum_field ('SNOW_5D', rbufslp, nstep) + this%snow_5day(begc:endc) = rbufslp(begc:endc) deallocate(rbufslp) @@ -602,7 +599,6 @@ subroutine UpdateAccVars (this, bounds) integer :: begc, endc real(r8), pointer :: rbufslp(:) ! temporary single level - patch level !--------------------------------------------------------------------- - !added by lbirch for snow begc = bounds%begc; endc = bounds%endc nstep = get_nstep() @@ -612,8 +608,8 @@ subroutine UpdateAccVars (this, bounds) allocate(rbufslp(begc:endc), stat=ier) ! Accumulate and extract snow 10 day - call update_accum_field ('SNOW_10D', this%snow_depth_col, nstep) - call extract_accum_field ('SNOW_10D', this%snow_10day, nstep) + call update_accum_field ('SNOW_5D', this%snow_depth_col, nstep) + call extract_accum_field ('SNOW_5D', this%snow_5day, nstep) deallocate(rbufslp) @@ -770,14 +766,13 @@ subroutine RestartBulk(this, bounds, ncid, flag, writing_finidat_interp_dest_fil long_name=this%info%lname('snow depth'), & units='m', & interpinic_flag='interp', readvar=readvar, data=this%snow_depth_col) - !lbirch added 10 day snow call restartvar(ncid=ncid, flag=flag, & - varname=this%info%fname('SNOW_10D'), & + varname=this%info%fname('SNOW_5D'), & xtype=ncd_double, & dim1name='column', & - long_name=this%info%lname('10 day snow height'), & + long_name=this%info%lname('5 day snow height'), & units='m', & - interpinic_flag='interp', readvar=readvar, data=this%snow_10day) + interpinic_flag='interp', readvar=readvar, data=this%snow_5day) call restartvar(ncid=ncid, flag=flag, & varname=this%info%fname('frac_sno_eff'), & From 35b709863fbf80b91176ca89545fff859b8b7106 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Tue, 24 Mar 2020 13:21:10 -0400 Subject: [PATCH 0713/1973] Add files via upload --- src/biogeochem/CNPhenologyMod.F90 | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 0b7239b8c4..c6d2ce7498 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -700,8 +700,8 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & integer :: fp !lake filter patch index real(r8):: ws_flag !winter-summer solstice flag (0 or 1) real(r8):: crit_onset_gdd !critical onset growing degree-day sum - real(r8):: crit_daylbirch !latitudinal gradient in arctic-boreal - real(r8):: onset_thresh !lbirch: flag onset threshold + real(r8):: crit_daylat !latitudinal light gradient in arctic-boreal + real(r8):: onset_thresh !flag onset threshold real(r8):: soilt !----------------------------------------------------------------------- @@ -714,6 +714,9 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) + t10 => temperature_inst%soila10_patch , & ! Input: [real(r8) (:) ] + tmin10 => temperature_inst%t_a10min_patch , & ! input: [real(r8) (:) ] + snow5d => waterdiagnosticbulk_inst%snow_5day , & ! input: [real(r8) (:) ] pftmayexist => dgvs_inst%pftmayexist_patch , & ! Output: [logical (:) ] exclude seasonal decid patches from tropics @@ -784,10 +787,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - t10 => temperature_inst%soila10_patch , & ! Output: [real(r8) (:) ] - tmin5 => temperature_inst%t_a5min_patch , & ! Output: [real(r8) (:) ] - snow_depth => waterstate_inst%snow_10day & ! Output: [real(r8) (:) ] + deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] ) ! start patch loop @@ -914,10 +914,12 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday end if - !seperate into Arctic boreal and lower latitudes + !separate into Arctic boreal and lower latitudes if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then onset_thresh=1.0_r8 - else if (onset_gddflag(p) == 1.0_r8 .and. t10(p) > SHR_CONST_TKFRZ .and. tmin5(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_depth(c)<0.1_r8) then + else if (onset_gddflag(p) == 1.0_r8 .and. t10(p) > SHR_CONST_TKFRZ & + .and. tmin10(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 & + .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow5d(c)<0.1_r8) then onset_thresh=1.0_r8 end if @@ -971,13 +973,12 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & end if ! use 15 hr max to ~11hours in temperate regions ! only begin to test for offset daylength once past the summer sol - crit_daylbirch=54000-360*(65-grc%latdeg(g)) - if (crit_daylbirch < crit_dayl) then - crit_daylbirch = crit_dayl + crit_daylat=54000-360*(65-grc%latdeg(g)) + if (crit_daylat < crit_dayl) then + crit_daylat = crit_dayl end if - !print*,'lbirch',crit_daylbirch - if (ws_flag == 0._r8 .and. dayl(g) < crit_daylbirch) then + if (ws_flag == 0._r8 .and. dayl(g) < crit_daylat) then offset_flag(p) = 1._r8 offset_counter(p) = ndays_off * secspday prev_leafc_to_litter(p) = 0._r8 From 2e37f0bd10f7a25a46e0a510d1f45570db08e1e9 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Wed, 25 Mar 2020 11:42:28 -0600 Subject: [PATCH 0714/1973] PR request to rebuild surfdata, add SSP5-8.5 and fv3 script grid files --- bld/namelist_files/namelist_defaults_ctsm.xml | 135 ++++++++++-------- .../namelist_defaults_ctsm_tools.xml | 7 + 2 files changed, 82 insertions(+), 60 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 5c911cb4ad..f01143dd4d 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -618,16 +618,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). - -lnd/clm2/surfdata_map/surfdata_C24_16pfts_Irrig_CMIP6_simyr2000_c181018.nc - -lnd/clm2/surfdata_map/surfdata_C48_16pfts_Irrig_CMIP6_simyr2000_c181018.nc - -lnd/clm2/surfdata_map/surfdata_C96_16pfts_Irrig_CMIP6_simyr2000_c181018.nc - -lnd/clm2/surfdata_map/surfdata_C192_16pfts_Irrig_CMIP6_simyr2000_c181018.nc - -lnd/clm2/surfdata_map/surfdata_C384_16pfts_Irrig_CMIP6_simyr2000_c181018.nc lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr2000_c170824.nc @@ -665,15 +655,15 @@ lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr2000_c171214.n -lnd/clm2/surfdata_map/surfdata_C384_78pfts_CMIP6_simyr2000_c181018.nc +lnd/clm2/surfdata_map/surfdata_C384_78pfts_CMIP6_simyr2000_c200317.nc -lnd/clm2/surfdata_map/surfdata_C192_78pfts_CMIP6_simyr2000_c181018.nc +lnd/clm2/surfdata_map/surfdata_C192_78pfts_CMIP6_simyr2000_c200317.nc
    -lnd/clm2/surfdata_map/surfdata_C96_78pfts_CMIP6_simyr2000_c181018.nc +lnd/clm2/surfdata_map/surfdata_C96_78pfts_CMIP6_simyr2000_c200317.nc -lnd/clm2/surfdata_map/surfdata_C48_78pfts_CMIP6_simyr2000_c181018.nc +lnd/clm2/surfdata_map/surfdata_C48_78pfts_CMIP6_simyr2000_c200317.nc -lnd/clm2/surfdata_map/surfdata_C24_78pfts_CMIP6_simyr2000_c181018.nc +lnd/clm2/surfdata_map/surfdata_C24_78pfts_CMIP6_simyr2000_c200317.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc @@ -714,16 +704,6 @@ lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr1850_c170824.n lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_C384_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc - -lnd/clm2/surfdata_map/surfdata_C192_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc - -lnd/clm2/surfdata_map/surfdata_C96_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc - -lnd/clm2/surfdata_map/surfdata_C48_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc - -lnd/clm2/surfdata_map/surfdata_C24_hist_16pfts_Irrig_CMIP6_simyr1850_c181018.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr1850_c170919.nc @@ -751,15 +731,15 @@ lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc -lnd/clm2/surfdata_map/surfdata_C384_hist_78pfts_CMIP6_simyr1850_c181018.nc +lnd/clm2/surfdata_map/surfdata_C384_hist_78pfts_CMIP6_simyr1850_c200317.nc -lnd/clm2/surfdata_map/surfdata_C192_hist_78pfts_CMIP6_simyr1850_c181018.nc +lnd/clm2/surfdata_map/surfdata_C192_hist_78pfts_CMIP6_simyr1850_c200317.nc -lnd/clm2/surfdata_map/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c181018.nc +lnd/clm2/surfdata_map/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c200317.nc -lnd/clm2/surfdata_map/surfdata_C48_hist_78pfts_CMIP6_simyr1850_c181018.nc +lnd/clm2/surfdata_map/surfdata_C48_hist_78pfts_CMIP6_simyr1850_c200317.nc -lnd/clm2/surfdata_map/surfdata_C24_hist_78pfts_CMIP6_simyr1850_c181018.nc +lnd/clm2/surfdata_map/surfdata_C24_hist_78pfts_CMIP6_simyr1850_c200317.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc @@ -783,6 +763,19 @@ lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr1850_c170824.nc lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc + + + +lnd/clm2/surfdata_map/surfdata_C384_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc + +lnd/clm2/surfdata_map/surfdata_C192_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc + +lnd/clm2/surfdata_map/surfdata_C96_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc + +lnd/clm2/surfdata_map/surfdata_C48_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc + +lnd/clm2/surfdata_map/surfdata_C24_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc + -lnd/clm2/mappingdata/maps/C24/map_0.5x0.5_MODIS_to_C24_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C24/map_0.25x0.25_MODIS_to_C24_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C24/map_0.5x0.5_AVHRR_to_C24_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C24/map_10x10min_nomask_to_C24_nomask_aave_da_c181018.nc @@ -2179,11 +2194,11 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nclnd/clm2/mappingdata/maps/C24/map_3x3min_GLOBE-Gardner_to_C24_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C24/map_3x3min_GLOBE-Gardner-mergeGIS_to_C24_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C24/map_0.9x1.25_GRDC_to_C24_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C24/map_360x720cru_cruncep_to_C24_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C24/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C24_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C24/map_C24_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc @@ -2191,11 +2206,11 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc -lnd/clm2/mappingdata/maps/C48/map_0.5x0.5_MODIS_to_C48_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C48/map_0.25x0.25_MODIS_to_C48_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C48/map_0.5x0.5_AVHRR_to_C48_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C48/map_10x10min_nomask_to_C48_nomask_aave_da_c181018.nc @@ -2217,22 +2232,22 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nclnd/clm2/mappingdata/maps/C48/map_3x3min_GLOBE-Gardner_to_C48_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C48/map_3x3min_GLOBE-Gardner-mergeGIS_to_C48_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C48/map_0.9x1.25_GRDC_to_C48_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C48/map_360x720cru_cruncep_to_C48_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C48/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C48_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C48/map_C48_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C96/map_0.5x0.5_MODIS_to_C96_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C96/map_0.25x0.25_MODIS_to_C96_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C96/map_0.5x0.5_AVHRR_to_C96_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C96/map_10x10min_nomask_to_C96_nomask_aave_da_c181018.nc @@ -2254,22 +2269,22 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nclnd/clm2/mappingdata/maps/C96/map_3x3min_GLOBE-Gardner_to_C96_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C96/map_3x3min_GLOBE-Gardner-mergeGIS_to_C96_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C96/map_0.9x1.25_GRDC_to_C96_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C96/map_360x720cru_cruncep_to_C96_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C96/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C96_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C96/map_C96_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C192/map_0.5x0.5_MODIS_to_C192_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C192/map_0.25x0.25_MODIS_to_C192_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C192/map_0.5x0.5_AVHRR_to_C192_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C192/map_10x10min_nomask_to_C192_nomask_aave_da_c181018.nc @@ -2291,22 +2306,22 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nclnd/clm2/mappingdata/maps/C192/map_3x3min_GLOBE-Gardner_to_C192_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C192/map_3x3min_GLOBE-Gardner-mergeGIS_to_C192_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C192/map_0.9x1.25_GRDC_to_C192_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C192/map_360x720cru_cruncep_to_C192_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C192/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C192_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C192/map_C192_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C384/map_0.5x0.5_MODIS_to_C384_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C384/map_0.25x0.25_MODIS_to_C384_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C384/map_0.5x0.5_AVHRR_to_C384_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C384/map_10x10min_nomask_to_C384_nomask_aave_da_c181018.nc @@ -2328,11 +2343,11 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nclnd/clm2/mappingdata/maps/C384/map_3x3min_GLOBE-Gardner_to_C384_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C384/map_3x3min_GLOBE-Gardner-mergeGIS_to_C384_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C384/map_0.9x1.25_GRDC_to_C384_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C384/map_360x720cru_cruncep_to_C384_nomask_aave_da_c181018.nc -lnd/clm2/mappingdata/maps/C384/map_1km-merge-10min_HYDRO1K-merge-nomask_to_C384_nomask_aave_da_c181018.nc lnd/clm2/mappingdata/maps/C384/map_C384_nomask_to_0.5x0.5_nomask_aave_da_c181018.nc diff --git a/bld/namelist_files/namelist_defaults_ctsm_tools.xml b/bld/namelist_files/namelist_defaults_ctsm_tools.xml index 9fa7b11d33..e52b682541 100644 --- a/bld/namelist_files/namelist_defaults_ctsm_tools.xml +++ b/bld/namelist_files/namelist_defaults_ctsm_tools.xml @@ -38,6 +38,13 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/mappingdata/grids/SCRIPgrid_32x64_nomask_c110308.nc lnd/clm2/mappingdata/grids/SCRIPgrid_8x16_nomask_c110308.nc + +atm/cam/coords/C384_SCRIP_desc.181018.nc +atm/cam/coords/C192_SCRIP_desc.181018.nc +atm/cam/coords/C96_SCRIP_desc.181018.nc +atm/cam/coords/C48_SCRIP_desc.181018.nc +atm/cam/coords/C24_SCRIP_desc.181018.nc + lnd/clm2/mappingdata/grids/SCRIPgrid_ne240np4_nomask_c091227.nc lnd/clm2/mappingdata/grids/SCRIPgrid_ne120np4_nomask_c101123.nc From bab0ab1660f71519b8d9e581776012be58367b18 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 26 Mar 2020 13:54:32 -0600 Subject: [PATCH 0715/1973] Turn setting that use_init_interp is NOT required since this is a newly interpolated dataset --- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index ebef18c2e9..b442b627c7 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -631,8 +631,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c190116.nc + lnd_tuning_mode="clm5_0_GSWP3v1" +>lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200321.nc From 6633a2911738deece4cb0d5a2dd90b249a7d18ef Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 26 Mar 2020 13:55:10 -0600 Subject: [PATCH 0716/1973] This is an expected fail, slightly changed test --- cime_config/testdefs/ExpectedTestFails.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 3209505820..4b9b0ca8b0 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -30,7 +30,7 @@ - + FAIL #158 From c9963572e8f464ac660c4d0554aa80d7488d51b1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 26 Mar 2020 13:55:57 -0600 Subject: [PATCH 0717/1973] Rename Fates test to use a ColdStart --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index e52a529149..5e65d9efce 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1467,7 +1467,7 @@ - + From 338be7b6262f0e2a8396dabe601892a1a9d8e8f5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 26 Mar 2020 13:56:25 -0600 Subject: [PATCH 0718/1973] Turn off the 2D variables in the Fates tests so that they work --- .../testmods_dirs/clm/Fates/user_nl_clm | 18 ++++++++++++------ .../testmods_dirs/clm/FatesColdDef/user_nl_clm | 16 +++++++++++----- .../clm/FatesShortList/user_nl_clm | 11 ++++++++--- .../include_user_mods | 2 -- 4 files changed, 31 insertions(+), 16 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutput/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm index e7f1e272d1..9a1fb1e6e3 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm @@ -3,11 +3,17 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .true. use_fates_spitfire= .true. -hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN_ELEM','LITTER_OUT_ELEM', +!hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN_ELEM','LITTER_OUT_ELEM', +! 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', +! 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', +! 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', +! 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', +! 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN', +! 'LITTER_FINES_AG_ELEM','LITTER_FINES_BG_ELEM','LITTER_CWD_AG_ELEM','LITTER_CWD_BG_ELEM', +! 'SEED_BANK' +hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', - 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', - 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN', - 'LITTER_FINES_AG_ELEM','LITTER_FINES_BG_ELEM','LITTER_CWD_AG_ELEM','LITTER_CWD_BG_ELEM', + 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX' + 'FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', + 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR' 'SEED_BANK' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm index 25c9d2a116..47173dcae3 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm @@ -1,6 +1,12 @@ -hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', +!hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', +! 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', +! 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', +! 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', +! 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', +! 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' +hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', - 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', - 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' + 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX' + 'FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', + 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR' + 'SEED_BANK' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm index fc057c0be3..446698db2c 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm @@ -1,5 +1,10 @@ -hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', +!hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', +! 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', +! 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', +! 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', +! 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR' +hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', - 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', + 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX' + 'FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR' diff --git a/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutput/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutput/include_user_mods deleted file mode 100644 index 6aed6a8eea..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ignor_warn_cropMonthOutput/include_user_mods +++ /dev/null @@ -1,2 +0,0 @@ -../_includes/ignore_warnings -../cropMonthOutput From 477bcb413a41b1f0ae839b0d0e11dc5268b799fb Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 26 Mar 2020 15:59:12 -0600 Subject: [PATCH 0719/1973] Point to a rewritten version of the images repo This contains a svg image in place of the original flow.png for PHS --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 05fe44c0ae..162fae65b1 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -16,7 +16,7 @@ required = True local_path = doc/images protocol = git repo_url = https://github.com/ESCOMP/CTSM-doc-images.git -hash = 9e12e5531d8cd3f2e9c6a0154dba8289ffd32c7f +hash = 476c694359e76c5054958e1397b8fa18aa0ff3e0 required = False [externals_description] From 2cbde17c625d78de20d068d2f95d596b9b6d01b8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 26 Mar 2020 16:00:30 -0600 Subject: [PATCH 0720/1973] Update plant hydraulics to point to new svg version of the image --- .../Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index e1ecb07118..c2ea4ec1bd 100644 --- a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -714,6 +714,6 @@ The outermost level of iteration works towards convergence of leaf temperature, .. _Figure PHS Flow Diagram: -.. figure:: ../../../images/tech_note/Plant_Hydraulics/flow.png +.. figure:: ../../../images/tech_note/Plant_Hydraulics/phs_iteration_schematic.svg Flow diagram of leaf flux calculations From 1a879b42020f28f87fcdcc9698d72b6c498ed5f9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 26 Mar 2020 17:12:45 -0600 Subject: [PATCH 0721/1973] Remove old UsersGuide, no longer used --- doc/UsersGuide/Makefile | 193 --- doc/UsersGuide/addco2_datm.buildnml.diff | 59 - doc/UsersGuide/adding_files.xml | 357 ---- doc/UsersGuide/addxhtmlhead.pl | 78 - doc/UsersGuide/appendix.xml | 305 ---- doc/UsersGuide/badpergro.jpg | Bin 40077 -> 0 bytes doc/UsersGuide/clm_stylesheet.dsl | 154 -- doc/UsersGuide/clm_ug.xml | 191 --- doc/UsersGuide/co2_streams.txt | 50 - doc/UsersGuide/custom.xml | 1615 ------------------- doc/UsersGuide/get_Icaselist.pl | 136 -- doc/UsersGuide/limitLineLen.pl | 104 -- doc/UsersGuide/modelnl/Makefile | 85 - doc/UsersGuide/modelnl/index.cpp | 45 - doc/UsersGuide/modelnl/showinfo.js | 193 --- doc/UsersGuide/modelnl/xmldef2html_compsets | 162 -- doc/UsersGuide/pergro.jpg | Bin 35642 -> 0 bytes doc/UsersGuide/preface.xml | 1419 ---------------- doc/UsersGuide/ptclm.xml | 992 ------------ doc/UsersGuide/single_point.xml | 930 ----------- doc/UsersGuide/special_cases.xml | 916 ----------- doc/UsersGuide/stylesheethtml2docbook.xsl | 579 ------- doc/UsersGuide/tools.xml | 1396 ---------------- doc/UsersGuide/trouble_shooting.xml | 545 ------- 24 files changed, 10504 deletions(-) delete mode 100644 doc/UsersGuide/Makefile delete mode 100644 doc/UsersGuide/addco2_datm.buildnml.diff delete mode 100644 doc/UsersGuide/adding_files.xml delete mode 100755 doc/UsersGuide/addxhtmlhead.pl delete mode 100644 doc/UsersGuide/appendix.xml delete mode 100644 doc/UsersGuide/badpergro.jpg delete mode 100644 doc/UsersGuide/clm_stylesheet.dsl delete mode 100644 doc/UsersGuide/clm_ug.xml delete mode 100644 doc/UsersGuide/co2_streams.txt delete mode 100644 doc/UsersGuide/custom.xml delete mode 100755 doc/UsersGuide/get_Icaselist.pl delete mode 100755 doc/UsersGuide/limitLineLen.pl delete mode 100644 doc/UsersGuide/modelnl/Makefile delete mode 100644 doc/UsersGuide/modelnl/index.cpp delete mode 100644 doc/UsersGuide/modelnl/showinfo.js delete mode 100755 doc/UsersGuide/modelnl/xmldef2html_compsets delete mode 100644 doc/UsersGuide/pergro.jpg delete mode 100644 doc/UsersGuide/preface.xml delete mode 100644 doc/UsersGuide/ptclm.xml delete mode 100644 doc/UsersGuide/single_point.xml delete mode 100644 doc/UsersGuide/special_cases.xml delete mode 100644 doc/UsersGuide/stylesheethtml2docbook.xsl delete mode 100644 doc/UsersGuide/tools.xml delete mode 100644 doc/UsersGuide/trouble_shooting.xml diff --git a/doc/UsersGuide/Makefile b/doc/UsersGuide/Makefile deleted file mode 100644 index 1c76bc75bd..0000000000 --- a/doc/UsersGuide/Makefile +++ /dev/null @@ -1,193 +0,0 @@ -# -# Makefile to convert DocBook CLM Users-Guide into html and/or pdf -# (rtf, txt, ps, tex, man, dvi, and texi are also valid docbook formats) -# -VPATH := ../../tools/cprnc . .. ../../bld ../../tools/ncl_scripts \ - ../../tools/mksurfdata ../../test/system ../../bld/namelist_files \ - ../../bld/config_files ../../tools ../../../../../scripts/ccsm_utils/Tools \ - ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM/ ../../src/main - -PDFUG := clm_ug.pdf -HTMLUG := book1.html -DOCBKUG := clm_ug.xml -CFGLOG := config_help -CPRLOG := cprnc_readme -BNMLOG := buildnml_help -BSTLOG := build_streams_help -RESLOG := buildnml_resolutions -USCLOG := buildnml_usecases -QCKLOG := quickstart_guide -COPLOG := filecopies -MKSLOG := mksurfdata.pl -USRLOG := quickstart_usrdat -PTCLOG := ptclm_help -PTCLST := ptclm_list -TDRLOG := test_driver.sh -GETREG := getregional_datasets -CO2DIF := addco2_datm.buildnml -DATLOG := build_date -NMLDFTBL := namelist_definition_table -NMLDLTBL := namelist_defaults_clm_table -HSFLDTBL := history_fields_table -CFGDFTBL := config_definition_table -COMPLIST := compsets_list_ofIcases.xml -SOURCES := $(DOCBKUG) $(COMPLIST) $(CFGLOG).xml $(PTCLOG).xml $(BNMLOG).xml \ - $(RESLOG).xml $(USCLOG).xml $(QCKLOG).xml $(COPLOG).xml $(PTCLST).xml \ - $(USRLOG).xml $(GETREG).xml preface.xml custom.xml special_cases.xml \ - tools.xml adding_files.xml single_point.xml addco2_datm.buildnml.xml \ - appendix.xml trouble_shooting.xml ptclm.xml $(BSTLOG).xml \ - $(MKSLOG).xml $(TDRLOG).xml $(DATLOG).xml $(CPRLOG).xml \ - $(NMLDFTBL).xml $(NMLDLTBL).xml $(CFGDFTBL).xml $(HSFLDTBL).xml - -CONVAMP := sed 's/\&/\&/g' -CONVSIGNS := sed 's/>/\>/g' | sed 's/ tmpFile.txt - addxhtmlhead.pl tmpFile.txt > $@ - $(RM) tmpFile.txt - -$(NMLDLTBL).xhtml: namelist_defaults_clm.xml namelist_defaults.xsl - xsltproc ../../bld/namelist_files/namelist_defaults.xsl $< > tmpFile.txt - addxhtmlhead.pl tmpFile.txt > $@ - $(RM) tmpFile.txt - -$(CFGDFTBL).xhtml: config_definition.xml config_definition.xsl - xsltproc ../../bld/config_files/config_definition.xsl $< > tmpFile.txt - addxhtmlhead.pl tmpFile.txt > $@ - $(RM) tmpFile.txt - -history_fields.xml: findHistFields.pl - cd ../../src/main; ./findHistFields.pl >& tmpFile.txt - $(RM) tmpFile.txt - -$(HSFLDTBL).xhtml: history_fields.xml history_fields.xsl - xsltproc ../../bld/namelist_files/history_fields.xsl $< > tmpFile.txt - addxhtmlhead.pl tmpFile.txt > $@ - $(RM) tmpFile.txt - -.xhtml.xml: - xsltproc stylesheethtml2docbook.xsl $< > $@ - -.tlog.xml: - $(CONVAMP) $< | $(CONVSIGNS) > tempFile.txt - limitLineLen.pl tempFile.txt > $@ - $(RM) tempFile.txt - -.diff.xml: - $(CONVAMP) $< | $(CONVSIGNS) > $@ - -debug: - @echo "SOURCES: $(SOURCES)" - @echo "CONVAMP: $(CONVAMP)" - @echo "CONVSIGNS: $(CONVSIGNS)" - -$(COMPLIST): - ./get_Icaselist.pl > $@ - -$(HTMLUG): $(SOURCES) - docbook2html --dsl clm_stylesheet.dsl#html $< - -$(PDFUG): $(SOURCES) - docbook2pdf --dsl clm_stylesheet.dsl#print $< - -$(BNMLOG).tlog: build-namelist - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../bld/build-namelist -help >& $@ - -$(BSTLOG).tlog: build_streams - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../../../../scripts/ccsm_utils/Tools/build_streams --help >& $@ - -$(DATLOG).tlog: - @echo "Get current build date" - date +%b-%d-%Y >& $@ - -$(RESLOG).tlog: build-namelist - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../bld/build-namelist -res list >& $@ - -$(USCLOG).tlog: build-namelist - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../bld/build-namelist -use_case list >& $@ - -$(CFGLOG).tlog: configure - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../bld/configure -help >& $@ - -$(PTCLOG).tlog: PTCLM.py - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM/PTCLM.py --help >& $@ - -$(PTCLST).tlog: PTCLM.py - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - cd ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM; \ - PTCLM.py --list >& $(CURDIR)/$@ - -$(MKSLOG).tlog: mksurfdata.pl - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../tools/mksurfdata/mksurfdata.pl -help >& $@ - -$(TDRLOG).tlog: test_driver.sh - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../test/system/test_driver.sh -help >& $@ - -$(QCKLOG).tlog: Quickstart.GUIDE - cp $< $@ - -$(COPLOG).tlog: README.filecopies - cp $< $@ - -$(CPRLOG).tlog: README - cp $< $@ - -$(USRLOG).tlog: Quickstart.userdatasets - cp $< $@ - -$(GETREG).tlog: getregional_datasets.pl - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $(GETREG) is good and redo your make" - ../../tools/ncl_scripts/getregional_datasets.pl -help >& $@ - -clean: - $(RM) -f $(HTMLUG) $(PDFUG) *.tlog $(DATLOG).xml *.xhtml *.tex - -realclean: clean - $(RM) -f f*.html c*.html x*.html a*.html i*.html $(COMPLIST) $(CFGLOG).xml \ - $(BNMLOG).xml $(BSTLOG).xml $(PTCLOG).xml $(PTCLST).xml \ - $(RESLOG).xml $(USCLOG).xml $(USRLOG).xml $(GETREG).xml $(QCKLOG).xml \ - $(CO2DIF).xml *.tlog $(MKSLOG).xml $(TDRLOG).xml $(DATLOG).xml \ - $(NMLDFTBL).xml $(NMLDLTBL).xml $(CFGDFTBL).xml $(CPRLOG).xml \ - $(COPLOG).xml diff --git a/doc/UsersGuide/addco2_datm.buildnml.diff b/doc/UsersGuide/addco2_datm.buildnml.diff deleted file mode 100644 index b8fbf34e36..0000000000 --- a/doc/UsersGuide/addco2_datm.buildnml.diff +++ /dev/null @@ -1,59 +0,0 @@ -*** datm.buildnml.csh.orig 2010-06-11 10:59:29.246523532 -0600 ---- datm.buildnml.csh 2010-06-11 11:06:30.710784206 -0600 -*************** -*** 34,48 **** - streams = 'clm_qian.T62.stream.Solar.txt 1895 1948 1972 ', - 'clm_qian.T62.stream.Precip.txt 1895 1948 1972 ', - 'clm_qian.T62.stream.TPQW.txt 1895 1948 1972 ', -! 'presaero.stream.txt 1849 1849 2006' - vectors = 'null' - mapmask = 'nomask', - 'nomask', - 'nomask', - 'nomask' - tintalgo = 'coszen', - 'nearest', - 'linear', - 'linear' - / - EOF1 ---- 34,56 ---- - streams = 'clm_qian.T62.stream.Solar.txt 1895 1948 1972 ', - 'clm_qian.T62.stream.Precip.txt 1895 1948 1972 ', - 'clm_qian.T62.stream.TPQW.txt 1895 1948 1972 ', -! 'presaero.stream.txt 1849 1849 2006', -! 'datm.global1val.stream.CO2.txt 1766 1766 2005 ' - vectors = 'null' - mapmask = 'nomask', - 'nomask', - 'nomask', -+ 'nomask', - 'nomask' -+ mapalgo = 'bilinear', -+ 'bilinear', -+ 'bilinear', -+ 'bilinear', -+ 'nn' - tintalgo = 'coszen', - 'nearest', - 'linear', -+ 'linear', - 'linear' - / - EOF1 -*************** -*** 1112,1121 **** ---- 1120,1132 ---- - - EOF1 - -+ cp $CASEBUILD/co2_streams.txt datm.global1val.stream.CO2.txt -+ - - $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.Solar.txt >> $CASEBUILD/datm.input_data_list - $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.Precip.txt >> $CASEBUILD/datm.input_data_list - $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.TPQW.txt >> $CASEBUILD/datm.input_data_list -+ $CASETOOLS/listfilesin_streams -input_data_list -t datm.global1val.stream.CO2.txt >> $CASEBUILD/datm.input_data_list - - cat >! presaero.stream.txt << EOF1 - diff --git a/doc/UsersGuide/adding_files.xml b/doc/UsersGuide/adding_files.xml deleted file mode 100644 index 18c034cbbb..0000000000 --- a/doc/UsersGuide/adding_files.xml +++ /dev/null @@ -1,357 +0,0 @@ - - -Adding New Resolutions or New Files to the build-namelist Database - -In the last chapter we gave the details on how to create new files for input into -CLM. These files could be either global resolutions, regional-grids or even a single -grid point. If you want to easily have these files available for continued use in your -development you will then want to include them in the build-namelist database so -that build-namelist can easily find them for you. You can deal with them, just by -editing your namelist by hand (or using a &usernlclm; namelist file), or by using -&CLMUSRDAT;. Another way to deal with them is to enter them into -the database for build-namelist, so that build-namelist can find them for you. -This keeps one central database for all your files, rather than having multiple locations -to keep track of files. If you have a LOT of files to keep track of it also might -be easier than keeping track by hand, especially if you have to periodically update -your files. If you just have a few quick experiments to try, for a short time period -you might be best off using the other methods mentioned above. - - -There are two parts to adding files to the build-namelist database. The first part -is adding new resolution names which is done in the -models/lnd/clm/bld/namelist_files/namelist_definition.xml file -(and in the -models/lnd/clm/bld/config_files/config_definition.xml file -when adding supported single-point datasets). -The second part is actually adding the new filenames which is done in the -models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml file -(models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml -file for CLM tools). -If you aren't adding any new resolutions, and you are just changing the files for existing -resolutions, you don't need to edit the namelist_definition file. - - - -Managing Your Own Data-files - -If you are running on a supported machine (such as bluefire or jaguar) the standard -input datasets will already be available and you won't have to check them out of the -subversion inputdata server. However, you also will NOT be able to add your own datafiles -to these standard inputdata directories -- because most likely you won't have permissions -to do so. In order to add files to the XML database or to use &CLMUSRDAT; you need -to put data in the standard locations so that they can be found. The recommended -way to do this is to use the link_dirtree tool in the &cesm; scripts. -Some information on link_dirtree is available in the -&cesmrel; Scripts User's Guide. We also have -some examples of it's use here and in other sections of this User's Guide. - - -Using link_dirtree is quite simple, you give the directory where -data exists and then the directory that you want to create where datasets will point -to the original source files. In the example below we use "$HOME/inputdata", but -MYCSMDATA could be any directory you have access to where you want to -put your data. - -> cd scripts -# First make sure you have a inputdata location that you can write to -# You only need to do this step once, so you won't need to do this in the future -# (except to bring in any updated files in the original $CSMDATA location). -> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data -> ./link_dirtree $CSMDATA $MYCSMDATA - -Then when you create a case you will change DIN_LOC_ROOT_CSMDATA to -point to the location you linked to rather than the default location. - -> ./xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA - - - -In order to list the files that you have created you merely need to use the UNIX -command find to find the files that are NOT softlinks. So for -example executing the following command: - -> find $MYCSMDATA -type f -print - -for me gives the following list of &CLMUSRDAT; files that I have created. - -/blhome/erik/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_monthly_1849-2006_1x1pt_US-Ha1.nc -/blhome/erik/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_monthly_1849-2006_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_rcp8.5_monthly_1850-2100_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_rcp4.5_monthly_1850-2100_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/atm/datm7/domain.clm/domain.lnd.1x1pt_US-Ha1_USGS.nc -/blhome/erik/inputdata/atm/datm7/domain.clm/domain.lnd.13x12pt_f19_alaskaUSA_gx1v6.nc -/blhome/erik/inputdata/lnd/clm2/griddata/fracdata_13x12pt_f19_alaskaUSA_gx1v6.nc -/blhome/erik/inputdata/lnd/clm2/griddata/fracdata_1x1pt_US-Ha1_USGS.nc -/blhome/erik/inputdata/lnd/clm2/griddata/topodata_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/lnd/clm2/griddata/griddata_1x1pt_US-Ha1.nc -/blhome/erik/inputdata/lnd/clm2/griddata/griddata_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata_13x12pt_f19_alaskaUSA_simyr1850.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata_1x1pt_US-Ha1_simyr2000.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_rcp4.5_13x12pt_f19_alaskaUSA_simyr1850-2100.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata_1x1pt_US-Ha1_simyr1850.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata_13x12pt_f19_alaskaUSA_simyr2000.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_1x1pt_US-Ha1_simyr1849-2006.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_13x12pt_f19_alaskaUSA_simyr1850-2100.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_rcp8.5_13x12pt_f19_alaskaUSA_simyr1850-2100.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_13x12pt_f19_alaskaUSA_simyr1849-2006.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_1x1pt_US-Ha1_simyr1850-2100.nc - -You can also use find to list files that have a particular pattern -in the name as well (using the -name option with wildcards). Also you can always rerun the -link_dirtree command if any new files are added that you need to be -linked into your directory tree. Since, the files are soft-links -- it doesn't take up -much space other than the files that you add there. This way all of the files are kept -in one place, they are organized by usage according to &cesm; standards, and you can -easily find your own files, and &clm; can find them as well. - - - - -Adding Resolution Names - -If you are adding files for new resolutions which aren't covered in the -namelist_definition file -- you'll need to add them in. The list of valid resolutions -is in the id="res" entry in the -models/lnd/clm/bld/namelist_files/namelist_definition.xml file. -You need to choose a name for your new resolution and simply add it to the comma -delimited -list of valid_values for the id="res" entry. The convention for global Gaussian grids -is number_of_latitudes x number_of_longitudes. The convention for global finite -volume grids is latitude_grid_size x longitude_grid_size where latitude and longitude -is measured in degrees. For regional or single-point datasets the names have a grid size -number_of_latitudes x number_of_longitudes followed by an underscore and then a -descriptive name such as a City name followed by an abbreviation for the Country in caps. -The only hard requirement is that names be unique for different grid files. -Here's what the entry for resolutions looks like in the file: - -<entry id="res" type="char*30" category="default_settings" - group="default_settings" - valid_values= -"128x256,64x128,48x96,32x64,8x16,94x192,0.23x0.31,0.47x0.63, -0.9x1.25,1.9x2.5,2.65x3.33,4x5,10x15,5x5_amazon, -1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ, -1x1_brazil,1x1_urbanc_alpha,0.5x0.5"> -Horizontal resolutions -</entry> - -As you can see you just add your new resolution names to the end of the valid_values -list. - - -When using &ptclm; and adding supported single-point resolutions, you'll also want to -add these resolutions to the -models/lnd/clm/bld/config_files/config_definition.xml under -the sitespf_pt name. The entry in that file looks like: - -<entry id="sitespf_pt" -valid_values="none,1x1_brazil,5x5_amazon, -1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ, -1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA" -value="none" category="physics"> -Flag to turn on site specific special configuration flags for supported single -point resolutions. -Currently the only special settings are for MEXICOCITY and VANCOUVER, which make -changes to urban parameters. -</entry> - -&ptclm; assumes that any supported single-point resolutions are valid settings for -sitespf_pt. - - - - -Adding or Changing Default Filenames - -To add or change the default filenames you edit the -models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -and either change an existing filename or add a new one. Most entries in the -default namelist files, include different attributes that describe the different -properties that describe the differences in the datasets. Attributes include -the: resolution, year to simulation, range of years to simulate for transient -datafiles, the land-mask, the representative concentration pathway (rcp) for future -scenarios, and the type of biogeochemistry (bgc) model used. For example the -fatmgrid for the 1.9x2.5 resolution is as follows: - -<fatmgrid hgrid="1.9x2.5" >lnd/clm2/griddata/griddata_1.9x2.5_060404.nc -</fatmgrid> - -Other fatmgrid files are distinguished from this one by -their resolution (hgrid) attribute. - - -To add or change the default filenames for &clm; tools edit the -models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml -and either change an existing filename or add a new one. Editing this file is -similar to the namelist_defaults_clm.xml talked about above. - - -What are the required files? - -Different types of simulations and different types of configurations for &clm; require -different lists of files. The Carbon Nitrogen (cn) Biogeochemistry model for example -requires stream_fldfilename_ndep files, which are NOT required by -other bgc modes. Transient simulations also require transient datasets, and the names -of these datasets are sometimes different from the static versions (sometimes both are -required as in the dynamic PFT cases). - - -In the following table we list the different files used by CLM, they are listed -in order of importance, dependencies, and customizing. So the required files -are all near the top, and the files used only under different conditions are listed -later, and files with the fewest dependencies are near the top, as are the files -that are least likely to be customized. - - -Required Files for Different Configurations and Simulation Types - - - - - - - Filename - Config. type - Simulation type - Resol. Dependent? - Other Dependencies? - - - Notes - - - - - - fpftcon - ALL - ALL - No - No - - - Not usually customized, as describes plant function -type properties. &ptclm; copies the file for you so that you can customize it if you -like, see . - - - fsnowoptics - ALL - ALL - No - No - - - Not usually customized as describes global snow optical properties. - - - fsnowaging - ALL - ALL - No - No - - - Not usually customized as describes global snow aging properties. - - - fatmgrid - ALL - ALL - Yes - No - - - Creating, using mkgriddata -usually gives you the amount of customization -you need, as it just describes the grid and grid extents. - - - fatmlndfrc - ALL - ALL - Yes - land-mask - - - Describes the land-mask for points with active land, as well as the fraction -of each grid-cell covered by land. You might customize it to make sure the land-fraction -of your grid-cell matches the expected values for your site. But, usually you will just -use what mkgriddata gives you. - - - fsurdat - ALL - ALL - Yes - simulation-year - - - Describes percentages of different land-units, columns and -vegetation types within each grid-cell. To customize for a specific point -or region you may want to use custom input datasets to mksurfdata when -creating the file. mksurfdata also allows you to customize the PFT, -and soil types to it see . &ptclm; takes -advantage of this to create customized datasets as well, see the chapter on &ptclm; -at . - - - flanduse_timeseries - ALL - transient land-use land-cover change - Yes - Simulation year range, and representative concentration pathway (rcp) - - - See notes on fsurdat files. - - - frivinp_rtm - RTM only - ALL - No - No - - - We only provide a half-degree global river routing file. If you want -to model river flow for a smaller scale, or a basin regional scale, you would -need to create your own custom file to do that. Normally, we turn river-routing -OFF for regional or single point simulations. - - - finidat - ALL - RUN_TYPE="startup", CLM_FORCE_COLDSTART="off" - Yes - mask, maxpft, bgc, simulation-year, start-date - - - Used for starting the model from a spun-up state. -Create these files by running the model -for multiple years and saving the restart file from the end of a spin-up -simulation. - - - - stream_fldfilename_ndep - bgc=cn/cndv - Yes - No - simulation-year - - - -You may customize this file to get the Nitrogen deposition characteristics -of your site if available. This file will be interpolated while the model is -running from it's resolution to the resolution that &clm; is running at. - - - - - -
    -
    - -
    - -
    - diff --git a/doc/UsersGuide/addxhtmlhead.pl b/doc/UsersGuide/addxhtmlhead.pl deleted file mode 100755 index d5f9615c58..0000000000 --- a/doc/UsersGuide/addxhtmlhead.pl +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env perl -# -use strict; -use Cwd; -use English; -use IO::File; -use Getopt::Long; -use IO::Handle; -#----------------------------------------------------------------------------------------------- - -# Get the directory name and filename of this script. If the command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume -# the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script - # is in - # the user's PATH -my $nm = "$ProgName::"; # name to use if script dies -my $scrdir; -if ($ProgDir) { - $scrdir = $ProgDir; -} else { - $scrdir = getcwd() -} - -sub usage { - my $msg = shift; - - print "ERROR:: $msg\n"; - die < -OPTIONS - NONE -EOF -} - -my %opts = ( ); - -GetOptions( -) or usage(); - -if ( $#ARGV != 0 ) { - &usage( "Wrong number of command line arguments" ); -} - -my $inputFile = $ARGV[0]; - -if ( ! -f $inputFile ) { - &usage( "Input file does NOT exist : $inputFile" ); -} - -my $fh = IO::File->new($inputFile, '<') or die "** $nm - can't open input file: -$inputFile\n"; - -# -# Add in XML XHTML headers -# -print <<"EOF"; - - - -EOF -while (my $line = <$fh>) { - if ( $line =~ /^$/ ) { - print "
    \n"; - } elsif ( $line =~ /^'."\n"; - } else { - print $line; - } -} -$fh->close(); diff --git a/doc/UsersGuide/appendix.xml b/doc/UsersGuide/appendix.xml deleted file mode 100644 index 058e67d577..0000000000 --- a/doc/UsersGuide/appendix.xml +++ /dev/null @@ -1,305 +0,0 @@ - -Editing Template Files Before Configure - -The last kind of customization that you can do for a case, before configure is run -is to edit the templates. The &clm; template is in -models/lnd/clm/bld/clm.cpl7.template, the &datm; template is -in models/atm/datm/bld/datm.cpl7.template, and the driver templates -are in the models/drv/bld directory and are named: -ccsm.template and cpl.template. When a case is -created they are also copied to the Tools/Templates directory -underneath your case. If you want to make changes that will impact all your cases, you -should edit the template files under the models directory, but -if you want to make a change ONLY for a particular case you should edit the template -under that specific case. - - - -Editing the template files is NOT for the faint of heart! We recommend this ONLY for -experts! It's difficult to do because the template is a script that actually creates -another script. So part of the script is echoing the script to be created and part of -it is a script that is run when "configure -case" is run. As a result any variables -in the part of the script that is being echoed have to be escaped like this: - -\$VARIABLE - -But, in other parts of the script that is run, you can NOT escape variables. So you -need to understand if you are in a part of the script that is echoing the script to -be created, or in the part of the script that is actually run. - - - -If you can customize your case using: compsets, env_*.xml variables, -or a user namelist, as outlined in you should do so. -The main reason to actually edit the template files, is if you are in a situation where -the template aborts when you try it run it when "configure -case" is run. The other -reason to edit the template is if you are &clm; developer and need to make adjustments -to the template because of code or script updates. An example of modifying the &datm; -template is in where sed is used to modify the path -for &CPLHIST; data. - - -Outline of the &clm; template - -The outline of the &clm; template is as follows: - -# set up options for clm configure and then run clm configure -$CODEROOT/lnd/clm*/bld/configure <options> -# set up options for clm build-namelist and then run clm build-namelist -$CODEROOT/lnd/clm*/bld/build-namelist <options> -# echo the $CASEBUILD/clm.buildnml.csh script out -cat >! $CASEBUILD/clm.buildnml.csh << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -# Remove temporary namelist files - -# echo the $CASEBUILD/clm.buildexe.csh script out -cat > $CASEBUILD/clm.buildexe.csh <<EOF2 -# NOTE: variables in this section must be escaped -EOF2 -# Remove temporary configure files - - - - - -Outline of the &datm; template - -The outline of the &datm; template is as follows: - -# Check $GRID to set the $DOMAINFILE and $DOMAINPATH - -# Check DATM_PRESAERO to set the prescribed aerosol option -# If &CLMUSRDAT; is set and $DOMAINFILE is NOT -- set it by &CLMUSRDAT; -# Ensure $DOMAINFILE is set or else abort - -#============================================================================== -# Create resolved prestage data script -#============================================================================== -cat >! $CASEBUILD/datm.buildnml.csh << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -# Major if blocks look at DATM_MODE: -# the if blocks setup streams and run Tools/build_streams to create stream files -#----- CLM_QIAN mode ---------------------------------------------------------- -else if ($DATM_MODE == "&CLMQIAN;" ) then -. - # Customize &CLMQIAN; options here - - # A.) Setup datm_atm_in namelist -cat >! $CASEBUILD/datm.buildnml.csh << EOF -cat >! datm_atm_in << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -EOF - - # B.) Setup options to build_streams -. -. -. -#----- CLM1PT mode ---------------------------------------------------------- -else if ($DATM_MODE == "CLM1PT" ) then -. - # Customize CLM1PT options here - - # A.) Setup datm_atm_in namelist -cat >! $CASEBUILD/datm.buildnml.csh << EOF -cat >! datm_atm_in << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -EOF - - # B.) Setup options to build_streams -. -. -. -. -#----- CPLHIST 3-hourly time-averaging mode ----------------------------------------------------------- -else if ($DATM_MODE == "&CPLHIST;" ) then -. - # Customize &CPLHIST; options here - - # A.) Setup datm_atm_in namelist -cat >! $CASEBUILD/datm.buildnml.csh << EOF -cat >! datm_atm_in << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -EOF - - # B.) Setup options to build_streams -. -. -. -. - -#----- INVALID mode -----------------------------------------------------------else - echo "ERROR: unrecognized DATM_MODE = \$DATM_MODE " - exit -1 -endif - -#============================================================================== -# Create prescribed aero streams if appropriate -#============================================================================== -. -. -. -#============================================================================== -# Create remaining resolved namelist -#============================================================================== - -cat >! $CASEBUILD/datm.buildnml.csh << EOF -cat >! datm_in << EOF1 -# NOTE: variables in this section must be escaped -. -. -. -EOF1 - -EOF - -#============================================================================== -# Create script to build executable -#============================================================================== - -cat > $CASEBUILD/datm.buildexe.csh <<EOF -#! /bin/csh -f -# NOTE: variables in this section must be escaped -EOF - -#============================================================================== -# end of script -#============================================================================== - - - - - -Adding a new DATM_MODE to the &datm; template - - The steps to adding a new DATM_MODE - -Add a new "if" block to the &datm; template - -As you can see from above -there are major "if" blocks for the different DATM_MODE's. So adding a new -DATM_MODE means adding a new "if" block. The two major parts of each DATM_MODE -block are: - -Setup datm_atm_in namelist -Setup options to build_streams - - - - -In the "if" block create the <filename>datm_atm_in</filename> namelist - -See for some notes about the -&datm; namelist and streams files. That and the - -&datm; User's Guide should give you guidance on how to -setup the namelist for your case. - - - -In the "if" block create options to and call <command>build_streams</command> - -The next part of the "if" block in the &datm; template file to work with is the -call to build_streams. You may need to add additional options -to it. You may also need to call it multiple times for multiple streams. You will -also likely need to add a new source option to it with the "-s" option. For more -information on build_streams do the following. - -Getting help with <command>build_streams</command> for &datm; - -> scripts/ccsm_utils/Tools/build_streams -help - - -The output of the above command is: - - -&build_streams_help; - - - - - -Add new streams templates to the &datm; -<filename>datm.template.streams.xml</filename> file - -As part of modifying the behavior of build_streams you will also -have to edit the models/atm/datm7/bld/datm.template.streams.xml -file as well (or the local version in your -$CASENAME/Tools/Templates directory for a particular case). -The template is an XML file much like the output streams file, but there are attributes -to distinguish which fields will be used based on things like: RESOLUTION or datasource. -And there are filename indicators (starting with a "%") that get translated into various -things such as: - -%c = Case (from above -case command line option) -%do = Use domain file -%y = Year (through range given from begyear to endyear) -%ym = Year-Month (all 12 months through year range) -%6ym = Like %ym but 6 digit year (ie. %YYYYYY-MM). (can replace the 6 with any digit 1-9) - - - - -Add a new valid_value to the <filename>config_definition.xml</filename> file in -scripts. - -Adding a new DATM_MODE also requires adding a new valid_value to -scripts/ccsm_utils/Case.template/config_definition.xml. This -enables the scripts to recognize the new value as a valid option to DATM_MODE -in the &envconf; file. - - - - - - - -Building the Users-Guide Documentation for &clm; - -All of the documentation for &clm; can be built using GNU Makefiles that are -available in the appropriate directories. The Makefiles require the following -utilities: docbook2html, docbook2pdf, -protex, and latex2html. - - -To build the Users Guide for &clm; (requires docbook). - -> cd models/lnd/clm/doc/UsersGuide -> gmake - -Note, that when the Users-Guide is built it will get output from other &clm; -utilities that by nature abort, and hence stop the make from continuing. However, -this is expected so you should simply run gmake again until -it either completes or comes upon a legitimate issue. Here is what a sample -warning looks like when gmake is run. - -The following line will fail in the make as it calls die -- but that is expected -Check that the output config_help.tlog is good and redo your make -../../bld/configure -help >&` config_help.tlog -make: *** [config_help.tlog] Error 255 - -To build the Code Reference Guide for &clm; (requires protex and -latex2html). The make here uses a Filepath -file that points to the list of directories that you want protex -to run over. You should examine this file and make sure it is appropriate for what -you need to do, before running the make. - -> cd models/lnd/clm/doc/CodeReference -> gmake - -To build the table of tests for the &clm; test suite. The make here runs a UNIX -shell script to create a html table of the list of tests run on the different machines -from the &clm; test suite. - -> cd models/lnd/clm/test/system -> gmake - - - - - diff --git a/doc/UsersGuide/badpergro.jpg b/doc/UsersGuide/badpergro.jpg deleted file mode 100644 index 4a378cf52d71870efb21201d0bd38a9d364ebc2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40077 zcmce;cUV*1*ESfc0)l`Pk=~?(pmaovQW9yQ6N-SKlmtSr3J542LhlNM-b)g?(u;u7 zNkVVZr8mKk=eypSd44nRT-Q7Q%sRPp_Q}cFYoE2V_E~$~_s-wxzY73rpqi!{fPjDi zpmDPS{^9_t03yPF-H@|3NiozArUcvg!C2- z?d^M3ex6HhlXzW@!7` z-6P~fQr=Cq4{o&mqxJt#d9x=XCLtgsy*Z~q10eiIC*h5ah;EVm^OYN&G@Qh=;v~v? zT-Nt)>gSgDQbS6w0=7vUrQ><58uIP8zT3~m{l8ei9U_98nmL4J5=~#jt<1QXjz@zQPBd=dE1;K0uHUeA9s|cvD!; z(;a(8%R78u?;cZFdp`8k&qe~|1jRM~pka;Q%+?P#iT(W9fI6wkC=Yw0-RVZM2P}2B z%-erS{udBoDmLAw%RH0@_wtSDa7NCMIbpa2!en@m$FR`Q6t9&fWo|pVOJTF)h@rYQ z=@!&a{|@d2$G?Ei$i6g(0*U$8@_0}=W?7prn2ol!O5p4r&jH~85*%YL4BRW2o6HMo)D9cLg&=goNi)FbtpGbeQM#bu0x7xdM)gO^U+ zUfKrVk){R8v0dTo8rE%2kvIqMHjC*ZD0Xq(?Q>Fb0fk&L`506$qIm6)@lcA^68krmC}$UO?JQfFSj{ZElF-cP%oo8avdYnU zsxV-Jz@%;OdUpWz@)xHipMoC@7J|)Po|Qv6uf`6xK@5F`_zJ2ENRH^Tuv*Kv6q)26 z-=Z8t=j3z<&t!Q2GJJ{Ldm?98Xmo1-gtQ+F`_nZ zf>R+$W@^3AIhW(R$1^(2s+7};1I&!;Bd-PW(IuJ^t0@*%e^|__L$;M(&b5JEsKa>I9=zE3@*}P(gLa^Kqa;1q=E=c3gIVvAz&Iu(CJaBU9{PX z78j@PZu$#gYWCL`t$gx8WudkK3BV}O7Z=AhsPBA!vMMBgRNqVmY&HJ6uaM(qTfk6O zz;A-=(3-$SnHy7*r&B#SmMP*Jo{%1ZICv!&Kbax6tTJ8q~tG{y;%Qi_JUTwMqYnr9Rl7|~!Hmpzq?dKJl^~}P6-7K9BP3O z8m!M_tO>VGa(sYc8IVZCi2)ja%w0(JtB0w;FT$>El{W38XY#vhjfNM!O!i=gqbidF zRS5>#(WGymicYPZbGQny9jdchZ;@TgOizAc*2kh!<=CDn8fZAB)7*Jv9$1+4V^;aq zZdFhKa7jw?{pdf2e;gibUe!cIy8p$rk|G6EJF^aYPun)VeJH9|$2Q4iR z*nuEUVy?<$DxSpMW0}EY!tN|A{ykUDRnv@rw&;$OWHu*7>?o6JRhWoE zmdC7c=K$^BH^Nk+iOT`o;jm$t84rP198fzISCa< z7@w;GpR0cL`US2s%xUhk-MJKJ(p(J`B-Q9zIenF4w}bOYbG?#J;8FWD7FYk1@=MQT zk^sxB2Y*4vkE750R|M6o=%-5Kvrc{ckQ|}A@`+Ay4z>8CB+yF}n(?W!_yO_{qAf-A zzmw^`u&?=fVoE<_ezE1Lc6$a#1%7e#r@~~0XFLg~Gw}I-VW;^Te%9E8%HPetewZY^ zLWNUIBBmhi6g8S{cW&3aAX`d!@G=T^}*Q$mkU%CSEm zv<|i;x7Zp4=ieI+e?Q{iw~T6r)GwXFbbU1`T*fNKf6FIdy7-R;HyB)H zYM4fhcO3|gp}iW`-x1(aeY-}7`((6%r-HD?E>)51l8?x#+xOJALMD8DA7-1Izv$U} zV23iiq)BBhN_(zmX6mrFp|^={31sfJwYF`A zw!E;E#vXk~0ToQDt|m}f(hnT8vV?AIq>qXE{>Lvc!OdXtxxgRd&?gL^v3Q{7Z6PJ# z*}Z;FB_TV)TW0^W0m(pZDy!9XA}duZ8K&}}dU+Cpwfjh>Uz+=HWgt@k_ljDipJUg1 zmz~H(B3!85a+pndt*uk&wr&14MQ z*x@XQwc8oS2bdi?3UWZi*)0Xo_UxcBy3(RaPo1l*(W-f4_KvZCm47fa2;Kxef#5~V z^8E`DIf$^tQEGEp3m&ZFd&-J)0Uhi@uj%o}+4_G0Z=RH$PW1k+C#eADyF2k2G^WVy z1bbzRd}2+Yzupv+rl*;S$KjwG?*d!fdzy3VO5bmW?r>7}jB}!fw!eTt@277J{sLx(1h0((cbiwV{LZ`Y6SI^y@SGRR|zY0@A5_n|`pC8Bc8Z2r?r|d|RU44~Oh4L|T!^+|sknZ_xeI4<=hl=j2C40=iH`#<&jq!V za+k^uVtr#&+iPIYCxCr5mrM>YI^x1*uLuHd7{Ng>fBD^XCFYpZ;`V>_M=`3vCL8R? zAWz$|S_WLYjlN_(#E3D{yGd;om@YE=S#70#VgA$TqGWaSA3xlw5HTiV>+w%tBKR2&0l^oW!dMz-65twJoDj^Z&Q5_xNo#{-2s}(bajXNAxy6KC(>iW0Y@c z&e>|g>wg2Y3hl(LwRz23pZs7%K5y`s@qbyLD>bhK({A z091*Tnzuz=PcZ!3pBm^VqTiHKs*i5BYZu@=3g_lbZL+N;+A=UXBW2dkBtbUk92hC~ z$JL*KXD_a)7T8hk4F(a}`oX=2?!bV%*SH%8`%h;pF&#bioEjX?v#mDdQ=e|N-Rq0b zbQznXa-*m*S5{AJGe{D{fTeY{yMk^@ax&%WZS|RVr`K$_qZzm^dVfp|Z`MDWTi}sd z`1p;&=n_dBR!l;DTa&xD>tn7QkBjck0*y6R-?z#VO3xiUTiWi&Y<~#!^h)0h9 z@K?X3uKTCW5h<4<)T!i52D+^seagg?DJt5%-S9_FyUqC8a>QOt|EN&iY3BpmpXsf5 z!(XFg{I7W-FV5&H<@b#SPWKn4=uM;$PJE4TJ$0jt1l@oNi_55hH%z;^AJj)nqAU%^ zht@0xgzvb3QbgPWxreVF!zoL4Ie{uV$TQ3Vffa{0+d}Zq|FH6oB(H~YiM9t4* zSW3!F;;S}Q!*=2tUa-9qM0|dkBx!f-W5+j~t2*Y;IN9U(e?O@vARUps$KUzJ3u-2w zvZ|}kINs{kFjA);-J9&Da^>-B7Zx9%r$R2JdlrEw?^QnL&DPsw)EC>ft=;aA`)EUb zNeeTYDb;(4yJ!rx1P|V)J4}UV<%ryO}DRepRUw~<1sa-CF(EWIN*T_trszC-~1BpJ<+QtcK?qs z+Cb&BEW;(vF1}hGWev6EZmcijz%g9t9_7*ZqC)a$%>{o`8_?-gSLsC~14~avejt(s zlaZ(l=q2ri;hPI}2XZ%ae+F;<9nFFJo?EtCu?vw~F(MjXayhsUE}y?BYZZs_L1Vju zoa;*j=Ocrsx4jg5ng!iLw1HCtr|P9xN9-HNAMo=s_{WQdrIl3w0)P71KPn2$$TjTT zM(B1(P!XZZB}jmr9~`f&y?oJs&bl@Krm3S1Yi+qxd1|8*i%(&^Mli$|Dt_dfJ~HDP`gcc9IcV!?7WX(AoAY~}Tqcf4=8qwdnSDgN=^Z%17V?V0p! zd_g?AWRrItZNB;oAnC8)h$?tHBiVCn^maQWmGc{~Xg-W}RnwzsP!!rHLl_~>j-6GbYqpHiKji%_ zi$#ndPlg{fUxinFX_XX7MiPjbpeje+H^EZLz~IC?$~dH1a#(qIwhz%4VmC zoLmb6|1g`iH$H4NOrWpGR$93udf{i;j~J9*gKcZ3$E#X@(n}+AnCyKT1k6-jsrouQ zTEz`rH^QkKYA-Ue?taTP6-6^QU?s=sWBfz7?tAU&7O}+e*M1nmj6gY@>9WUVKh&^2 zn_0hw%8zu31ACi$LB(X9SS-IE7yl9s#cB=@wPGkE7eQE1as4 z!#z)J!#JUMGx#%;!GpP3=UtV6&oc1^NOMhkT&)9J`}DqW1SVTWTu7iDpN}_d8tGb! z(-?gKa*8#B4pYnuD3PDAXm>6>OdPv72{5UAyy@e;hnlju!Zde8%CU;($Zr~j<}w_c zg51^y#r1|JDt}km>*UpxGWcj=Lvim^#i#JT#+oHB)iU0^j{oV9&}ht6@Hu#qjKmTA zv3Dyq?HbxZHIq=s6?g&xd15A`oVHZI3iT<=7r;q4UpQ$TkS)=X7@s{Po8T=ILXV7i zuCuq9n3zTP(d^qVH}mom6MrN;RT~hHkGX1%30&TY)77zIEaSzMfXlvbl()i~JG*Qo zUa4y;Oz+UsHIBgd@Ab?3@cAwORLiV)s+`APzaI;5&qba+9Z$(A*s(Ogu5N>4aP4Og zG~Jfz>0uJu2NYVDVhy;RjRe6?TD`j#@)CpYnM%{haQxeNgyEtS@DFi(j(H>BDLYwo z=)8HdXV&)M0c~d;#L8Y(_)8n*mxg>8FHgm*xGl_0Ks#-GUopaoK{gq(cdl+AD+(gz z4s*fI)^){x{|r{ArwdWSe^?%gBle#veWrshf(z{m_-|6^uQ88L+M(UzJRNza1)LMH z);-uW-PRKmoDE=_Z}=)DP8;cMsQB0+pc&aQGIi^t1vu_ok)`0X#pvdK=>Z*vsKEhH zN<>AY?1{WRqPZ*lpb<)%-vQ&M?1cXyBUvAB2qh7U7g_)i5Pu=gkvw`?J~#L(*R!eH z=G@&BxP%k=M2T$R4-NlNS?s2S7tj`pxN;-K>k55mM`p6oBts4s%Pwl(B|=>>c>hU* zm9$}6M0S=lC#UU5&A$0`6K5XO?b~NqT&x?t?kj}ELp{go5+EExA*Jf)J-qvePOpJu&vEQIoZhAlxu{@>rJ#*}-)zo_CVd?{df+2eP zLV>*UQb9&-LgX{N&#B|ROOGWjxG3KVBbkMZ(aefFB{E3o!ud7^py#s)IVjm~kwrcJ zP1BS7x3hDXODmr%>{~S@2S7aGQzdeGfgl;-E5BYBw0}Vm-hKyt!ZqX?6A4j@{N?^W z^pd7+#ownAFfo@dA``9?-#0!f#=vYF4cQaZX!_p#sT2+bX$2u=YWg*ex{3O=FaL16 zOmgO@sTwm>`2`|<6h-b$2zRtYD)hRCP|UoOsR(htc!TZ48#V0e5KZ{q?(or*m+BxOcR_-#gU{^t!zNPA2&>T;gM z^N)UE@~WETHHE{RIF4b@zxbQ9Jpzu1#htd14}zK!HZr*ext1Tmk6KEmRxgYyDQZSU z+N%XA)9-S}D*?9YRP;}cM@PypR0&7k5B)CmWOyzNw$&{%<1{Oh;c3}S3MI{N%l?FC zJ)IMa=b18#S3^}5@pS0jWPxI%hT{qkm7)e2b|r2F9*|mJ67^k;O{TFNY;5$ z+73A%AuA{ax*G+kyclRh3G+ZDiU7sqT?=)j;AYaRQQi5#LC2Vby#}|o?0&vK#`%8f z;8}TKM)9g(ME5s&3p8C08~f3rTiICKXY2Xe+tbXTkmgo}!xP1}BE^HFL;W~QpEAcVsEhOrB$-*D%kFNPV;d+QqQR7Kb=va znLm^ct*EuDg#V0ldKn%J7XUYk^aj9p&r}G!pM7fZbP~|}fptLo0wMZwXK0|7WT&1JO(b^jZO?~k&yH?3k3ev6(9Dh| zz-;G!9r&(YM?=MWw&&QsKsSH!84p5JKC!jIyqP!sQqUsisH?w5Q>O@K_95yO<*AN4 z48(?W=T&uaKiD)x8W|$8K7alTXfPX??rwh9=KR|%rxMksqi4zdM$}mL(7$;;v!!`< zW|m0^Df(GV;t7!!+}TN0VmtChCPi(puh-zUM5QtY%H4>ym=Kdfs0VGmHJP{L<#UxZ zEPS0AQ^|6kQexCdYXV(=HJ}gl6C95RX)~mt1`s;5x($4;UV6+AhO;TO>iT}NkSee$ z!47%L*#_8Ah1gC~vZD$@#1b}i=&89t``zVc?~b$PgFs#KrIK-QtAix*eF{#)P!^$skd z-XalhO%oq4>Sx61=M~6Un5k|y*6>kG_Aymm#z4qK|H^cBbt?}&cBsy+ANt6GQ*{5B zbsQNubfPh7`j9(mu2Ri2-_VVM*bS@yYf%L)_k(-Zyg&`^pL>ehUmz!H^yw3p+0x7H z6LS@b8A|DHlUUPK6?msVc-th@hs7ol1OyMXvq_rg} zM3dV1wP(^ep8TwHilzl*2@}vMC0BvAUsnyHc%y$;!r~>nf z>M9yDm)o7w{7q(dkZi$wwf8VE&|6dO0d{H@O=1^}yq0@5uxZhot~09Oyb#3FL(3>P zoJJ~dX+Tc*8t9;`#OMBdr}ks6t56`_NX9rUuR-)=SkkK|{Lyz6v7$y<8dz}z`q-UR zXpcK$9i2=9OI)CgAX54-C_vTogMqN$%3LV zOS)PKK}hkn$17Zqe?duv$XACnnOV`&Pcl4>96g_Ly{nuatUax@yCO|C$|x~>$6|)x zbGEB*#cEGJQOsRu(9-PKKA)4_e9?4FFOl{#1*H9%okU3UM3>_OYPmN=t*3xKdsl8I z%ws)!?c~aNvd7BtO1ydZsRKM+tp5WIG)W+#n?yhvjwI%xChf|OjPd>ba!dCj5#-%M zA>Cq~)>_AN9A$vx*2wj)Pr*WNzea$=4K{iB(lx;ez3=Tv1UGn@1hC`twBBgOhMiO# zMegm|ix;M9eqkF0<)=?4>rnS_DVb=N43+$Jwt`pp1BWMWfI@l6(!~H@@tqppAt)M& zK@tP7WV2SZ2x%f{AG=&x?ObB{`JASEtDWD^vU?(ESy2tcU?y?<=}{x^9o_;C>goB{ zv5??H#p7q)M^?b_SC2+jsc8KI~E7d)G5lI@a+7G>l0m3}zaYzICRnwV*<$c)z9tFP3I{tIyS zq4LsizboM6Ce0DUvi!YX$#a~eY+69cMUO&cM^+IQm0f85(RqK{T9a2)3OnZqM5x4n zR;*!5Rtk~jOSlEy8q)sq`=nDFC11(hjQ08qxGElsy;*}IrU8dIaEga@gWcS?R(M6iUMLxJ-dNlTa;6flz2I6KS$AxAeR z?~#cty3?~a$t0%Z+|{DgXICGp?BV9#lq}~Tbpz872RAiJ76X6gMgIf0sXOVq1v6KR$Ys`h@81rlVXbelA5K@(-$PGsRfo+Y6h$LrG5;w+CX%+Qvo2@T6U& zpJtCh`Hp{9W385&=*TaVP(mqgSEozEa-uR5%EDEylP%L`nobo8xZX_KXT#coYg($# z;Z8)v`PAH4xrjyL)6fMbXWz*)UBI#&Y@>MqaMVZ%*kfvKB=owch(onoM20pm@r0gNn zEk;yWLB&?nI65UhAZU6zrnj%?F90uu^ZjXG8&$s1sOFh49L9SrH`Lhpw0OG!p(1lm z4Dh;nRZ&z-PJA0Fawt+beAW@QF64%v8hAS5QlK|Fq;6FlE#CE>rs_?@j?Q&uSKE2U zlFVqc_aDS8!N@z@C~fNPzX0!dR==x=%<_vWaaxN^p3Ogz`}bRle1bM~IC2#OgP$#0 zee@{O;W5{mg9(toZjizO-E_s=fYj94qqSfiy5KfkcFWWYAI1Bt7%Y8+=@prKi|uU@ z(#uTf$R}+)YQMd0g8SNAFwtp|f8FsIz2m)M^(1xtcY9(Fjm}b|t@{yj&n_1^|08Uv z=`?2LTu>N@?nkSourQn-BvFqya0d7kZS$?J&-b?BW{w~9*Kbh`3dc-~PHHR(yFQ0? zr~+e7QTi9{Vr;!G9OKe_wVT=`F<)asRuc-8L#88Zyp_E`l})D%m|~s}HDj_{^S(%5QdoI|DjSM!c#mn2hw171-bp&e7*jc4ZmK8W!@7LF!G3(8_YkI+0oU%Zqp%5PYknHVKKmdGaQ^?eAH6 zdD!yy3u^`!XMFJTJ=TEt;?OTmt;gwNIX)^ghmie_&yK|fY{Ek~t{(?On1XFl)gKX~ zkawoe-UaN;C61>DYL_n6=j4%jo7pz4(jp2DV9n-nM=*YS`K=Jo(v+`n@14Gi(F+T8 zvSa3nEaoG%d8$plI(LLtvrw5T<6u)=6FNiQs zJG^-Ay339KBY(z5z&sIV#pJrAW3Bh*g*`~<%6?YK%%v3et$Sfsu=`qmN zbUS56j6J8{>mjo0=kOzB>6p4R+~+A`X?`iLef1)Fi-{`M+s=Ob^-p6q=90j*F-}M8 z5>Xh@Z1DCbiaV9{&%M3I;?{gQl$C_$udaK1oG2`7V!ZeR1?dNn+7v>6^VEf)A`4d- z!8|mWtHK9k$xaeM^Th@g&XfW!!oluof{=V32L$r05j-wC7WO9gk2US(`5o#3w4pq_ z9Cu#NXKr~5we1?ASD`WkJ3fyEkLDLAyg@orW-Y+2R!c)z-p~~4JhA0KYVpv($=u(LH;UYOO7rn0?sHEscUe;~z$( zwCfOIE(MuG5BOX-*pEK(5LNFtlmY9+7W*6>^ z{RP|w0fjolj|UvuKdpOZbP6?J=Q@gX=u2#0v`XD_d@Nj&@1pW!`I8d4>-J{?J(B0n zUh^){vfne4Svu^9qh!cqf&Qdbs@8s|9DF&AIB0-|TDw4crVP^4} zZHAf+IhXdUcf5|WEnxLu9vGI4Wf@j4((U6s4D52wxnvYS3q4AZm=~jOnc;(sA};mQ zW{9(UzqW7r-dd4ndjTo|j{h93P>T%DE9ydAm+{Z{Fv#qWguZbs)vGWZ4wX{x#-X!X zuC7;^e^%N$w|T50Q8Fo)%VIcJ5G|{l9pbggmO#jWj>9Pgq(j-WfI<=~#PnvglnER) zRDrP@>o3JGEhFEYrb2xzQsm7hbD8Z0}#dSdN*=hDt#Egs?A0tGDZfo8td%E^So|9oxSN&8DL!kUhJ*hOV~AfG zphoU22q@8#Uc!{*13zL*XNkW_5)p@`D35U37QZ-s*tnvX?AZ8B%vwriR$ug%Z37wr zCJg`6a;7~8b<|}7@@Z!)zk98=G4M_&v=JHavfUQ7Cm`6~*Na6&Xf#yvy;TF@M@=L? zbn|A%+1?Cl4*#3#b3=e298wraW_zrdKDRtdo&03fhjqNZ?3)IghN9Fhzmcc1Wh_Q* zoA92;cbs^l&htMVroIYe6ZVkZ62qYis*yb9R6Gdp8O?J7GdY8lFFk&?e=eP+iWt8& zh?s+=<#{_Wy6y2*cy;vCFuy^MPoOov*TmZqw^csPs4fw? zz}ptKNoIitV&G$@at6A$s52`~tIAkX5!BIMa}*y8i0jk9zxUlgNzk{b_%c?1FurN` zRz3HUrxDu1Q#(iVMm@ixs)|)H+YSvO_`&WPnWWavHlU(`LIQtAXzAqA~ad} zDgvksZvSdPu)SK1sDQqenxJy~aoN@xTBMLRz&o{v*qh34x{zY@C)>L!DE7 zL7lg(OtXb)agVgQtm56`qP)=~tX}Z~Qh;}}wEeEEzk$VUOLNhTuob$jv9Ne$vbjjR zx}qlcyUTP-W2%7BB#W?W(7^;NIWPsBv(#1%pMP&7IPf#-g!lDWfcHHIs_8_V=%KLU zDc!W;rWLRF#4i3nug~~gZgLXd^>u*vT5wYF^z`h%0KueG^Mr>R{z+Exhm~v~-1~90 zzkt%TKrBjgMmSTNS+rSsmT#@!u%(;(=SR7IrVESPG?*$ zLDNsrY*>@G*)R5N_9524_UwgVD@eIGa?}usBG=jr+uaM;POLNMsm!pzDf+fa+V;T* zTl^89JIx1Qe|n~=I6!C1*(IRRDC9yWxQgab+&9l%6=M95rrO1AzO&cBHHWOWX=1hV zZ6KK8WDWvK3*2%M;NC7C8dQRpy~y!{+gD0F{0_xr7p(`7S?h2&R?FYLO|GbUvcK+# zs0rOD%mvk(i=1_e^9Y)JcmT2nnz8uM#X5q~x;${=y&7E{bTgx3vJ5C{urX>f>pS4n zPX05pwQ8_OmN!f>^#MDjVK!tBM}NO(#BuOg6MKS|u0yx@nw1pKs0^C*M>N-9QI?3ClO`cs^TnT-MUL z2dw{Xx)+?xByu1NWY>kp>#~y*CNI#lBBaj~%x}wmVDQ`>yZ7r@@@=2U(D(XTx(gqm zPe_CM;%*q}fDzdHW3Qzc|mQ>rK`9n#|;^0S7JI3 z90k@7L7{W@b6{f#*a7B57JmgA4Ir1Ik=T(E?swbAG5-oh+hfd49E8jWn78wXApQYg zPq3|0tc;D;DNgmyLQ?52=}(0jDEg=xST&~0;fi-9-Of;WB2@42^_0lDwkbmF;YU{8 zpRb$MqsS$PkdIQooSY3?g(kCEjOtw(iV8uflikbMT2;^7k>jOXJt3hLcKjE1PBODV zsQ_#HtvjiPlTG1?T9iUnZF?Sx^@w-r{Fr{pkEt_g{@>YKQQDv~BmPsVLj}pqTIjxN z4RQugqHo+Uu<+m+BNus+1^|#)Eg!jWnowqXd?JFq{@PX37fW(=|F+xn#Y5HRxZB*W z%0%C;!0$L6!L9GPvhbY7hG2u`>5oCrT4HCKU3`p;}!=@{q4!H#PEh#73)n63SG$qLh1oRBBcyn)a@01>@ zAKJSQ=QjxM_Q(g;@n#9#jW%g{PLrc|ua?9esFK`tS0s2I&t6+Oh`sMN_>?v$d`vL% z7rejXBli~ts?~8sd;!75*96Rb-)Z^In1`?%Y3ruDO!pyCQ@2bC7qT@Riw!0d^&33d zfI!=Ri*C~b8wtU>Qp_-=pNEA#sE!19#xIzHQPN@Avk4WomA`=a(!74(4rAKI@f7>z z6ODw$ira?$M|8(j-wfXmuf7hjLpN z4#;1u%OCTt-F%p7F3GT3NbP(}R}@iMn1A?UhcVCgbD|^>!6{FWL^ze6;zkgsftCmZg zkv_1$MF?#-V{v9ehxFZ*zHO973riK?kE3N43OqIP0znICk?a_Nmdb2xpDm+QKE2m~ zw{QZYxm2Ug4B7uuX3EJ+;ukak94Z2TC{tA*#^*JHuT{i0NJNplf#fRMio4-ry(xo> zEX^*D4%na&m^4eK_A(rU*Jr@YR-VY5f`%|k31XRjk;)Vf$^0odSopB(a-Tm5Own+% zbiBAs6Ya_U#%jE%Ek>qW%|P7qjaNmE@Ilq=n?0sME-}#_8)<9bh=esA)WDw9rU7<| z3nGdsC}vHfcx#07-xWf>?Q!vkVrveKndt^|A*mel8v0<}6efyrLY--ImI1fM!UN3KQVj*_R2aO4D9TQ`pKX z-UCS#WbkRkUME;Zr|zzBnxG;=L{4Lx}d&l!_VolePf4 zoSec^IWyR<-mE7S)rx5MIv6$Xve=30bL#YKeom1oWg6>`v zya->8J)^Am z`YW#ljOvd#3kyqB!%p8p4(3Hp?S@1%au7*x#})%|yYne?klh0Tph0)=f5V}dn13m^ z-Q8RyB3vhpd=U54^-&p*=QHvyR=YWBQ=KP5jr$xs7?tsV2FB6Fq}zB$zT^r~WEZi=QW{UsN$yK1XWm z-z=IaK-`x1;Z*W^OCoT?`P4o)%3DE53Nj#HKdP)NXUadpgxuljiKFHJKsjDLeb5kE zv3^&Y4q1$NM^j5n@(tKawd!}C@HX6T!ZY7wSC_59ywW?9;o)rQqq=Js>}u1@M_wUo zaF!Q{W)|*7yJVCs7dr}0f?Fmx)?}>;*ZA4&jqm8;kF6< zMP}Ylv-JF(K?8C1pd)-#ZGnTbf7<_Su0%_?AMRXM@>CPEB$4rs*+-jgU>ryO_7?GW zP(m#tal7CgTjX0=KK&a~W)zk3I0J9t8QMoR1DB5(3PK?HBD13helY$y{03p zj#4GjZvr(OwdQdDgo%&CtoH|vn}y44S5>@}Dm5K})D7Hr0ESz%D&dzOs%hTk-GH;8 zCx?2H5AD7+`oh5a(KbWf;E);GNhYYsF6nS6y;v{WIeUcLcrtUz@!OM2<_>(?3R>8! zxSHi=9y@-3a}WUcD+a{toQiEBbDr~mH%b*C`wb=T|is=6gnvT&i4{mQ#XEm>}jwuR_3(09E#A3hGP4rT_gg# zg}%LO#nqJYc5*ehn0;`H-0l|wl1G|Bd4ZhV{qjT$zRv`Ydjm^eO7n(=NgWV<(mgMT z`Bu2G2Bj zg+@u3iobwMG_5*Mf`#yzrM=A*v!XO>Z>2ZsOQ~_(&=)=M$uEh!l6S)Z$v(5{v0v{k zwWr=8?NmIpYolxV9>qsj&urCk_!ijt)|K5gS-6A`&-!Ou0iKdqK+!1 z2)`hQG`%tfsqll1$pVRTyoX;&V>9 zWhibk*>8OBt-WhH#?jL{8GB^% z4mp#n6)lN&AcDkyi0OT58S(h7n7Vv%EERIER+ddCVVA_e@R%k)0V?}+?cv*@#b_y8 zuS=YlNfmznqX3LybTlJ6th_8ufP-hJW*!=2->D2KF-$7ehtc>OIB#S9Ax`b3`n-=||&F95xM?$S?f*C}R zeQibJ8NPD7K{oPrX%l~#ncFR_qn_d&(=1vXjQxa#3|e=>&%Kh54p%J26|Q=fn^7^R zw~3x4%{^$!Bo43GMimHX+O6ZsC>2%S=joD@Xp#dmVs$1N_vGHqo~Y|!v&9+ZBkJXC z+-7JRcRuI82QM)S@PpVztpm`w-r*M2&qf7Bf;!{tZPK-M4rR}Nw;TQukhlLH{*+ZW z##A@AVrV?(EXr|M?7PM4dvfg=%|xf7!>rv-M!Z^>oMYQ6;h^SUz@yE-fWC1=sl0zv z1$4-5I{uNs)a}VkF4LYp#MbO}|e#kKC_YWg_*=XCi(pCHu=}PWZ00 zf1=l?BJw~WcP&xHz7BmwE#fm7E~TeHPf|zQ-f~#aj@7YJ+Y>aTn_=J4)2 zqsQ|SYh^*`LoRco2<`-V;=cfs$n(MREbROBuy(4S&4;JLQ0QZr#Q}(6FmPu=IPAjv zo99<7tt@>>Jk}PV&ZjPLegMnhzHhMJ~$Bt)}ZYbR%R=%IlKm#k^)U>RaC=I_NX_v*6#u zsg|hYBd7+TD;1NGqqT*Yg6-Cju`ZV(YYTPpntw?8HPJRubrrzv35`XKBit*ReYY^WF;kJM>`Vy)0N6hixA$C8n zDS&Gl(POsW21W(|T@|2SH+NiO{_QHm7YD|HRZDaDgIsIxg{&#IjkF~xaaZZAys=xq z(qQIqBJM$)yCQ@8U7E`ctsks5#ipHhwn?53`#0^a`;UFuLPu) zDNd-pxBRsdvyn=hc)`0gJKsLYGSAZA7gs4KDH3gO5NOcN^5%(e-`Q5kZZC6PvFj7m zGMkn8=Osi)(ylLcu6qMe#Fr%eWV=Tgjk!0AZYdt4VF0okcn5Q!7Bm&;ZgUiD2Ryi9 zW=+ZyvLB&{rgx9b)s9Is#>TOeUG_}Sw*T@Do8GZ%q`m>UFM5XN7frtvtAImOzq} zEVTt6U{U6Ftw$tNe&TsBiporsjxv|8_u`cppJa{?NA|eM{{oKE(JpHPP?OTrNF{#O zZ-B^yyZ@EiHnN~HoK?iFu`#J~-t>#X-#rw)DZ*L#rKeA-ot5 z-qD490p!SMs+Gmaf5$g%Y8NcnpY6=FSO(leG}NKLJm$Xjl50T&6h`v&hqNG&2SvXe zd-4=e`axyCRjKDdL^U!MOc`j*AjF!CB1{%gTOIeNgso+eBe~JhVqJ4J5PEY`WK?m0U z{#WB}hs~Xjl|Tn^W(UW33tW&hp@Ct0%*|?@YeThPSIatkf$EM16*8&z2~ai0Pg0u| z%GG@V+I{4~i_59BaqZCJyNv30Drh{D*B^lCuB%>0&1y~;!}|UL7MxTKJ@cy8_Pz}! zXW6CrAATCF{Di8+9%?`QU$nhtRGZN8JnLC&&bj7dZV`_E zq3Z*EW#q7m4@9Xi;E>q#lo@Q_s>mY#0>1bWw8|ItOsSgiyq)uTJ-cEx0UNW640o-2 z>l){tPCmIVgk0IN5KBqzCziqkCg%$tlPJVoRJC!t1$*{X%z(HAzES=z;Zkr7DXD(c zQE#XC@LA2VUuo@+Gr984HIJ^k(jN|9g|tozIFCkc3f7x?!%E9n zM8X|2HXSlrVOmA>a**?8U_p3#AfSJanI81{Qp!O3i_;XR1x`reMe)+pzDCiBPMU|1Tz8fC{w{7JQB9?>6(A!t0UlF% z;<*x2n`|})*Kc?va(A%E$rQu09|wt<{$+)75Zs(Jp?ddwZvE(C37uV>Xw*jU)L(!J z=QI07#MR9a-}L0~jOI77iv`%IlT(RR>JK@NqBcxgZI6Uv=MP*C-G>O9n0t2$IDC5< z@}3TXNr;1X1DqWZ?07h`djPWWDyrXdX58%_`@eiPEW(+s4w~o9&F3D;ajFWi7nsjH zvv;QJwtB~56V(uIRyVI@@^NcHEkOLdGH)`v?n_Cz!B`=s`F^X_wZ2d!?|h`a^kgC= zYIQ-+?KO!YSVkdi4X(;=U$zS!=N+P*xif5l1e9Gholt^+ZgGk>Htnz5EQ{n=s+9u!Np z>E=K<2nj_xH042HyT|Qptj5oVmO({*;6@4=Jael_ze*r-MqUIqb#L`~? z~f;x>c70MXSo^18g6q~i*UPCE_; z65{XszVCJ0KhTE5?smRI!}Rc<@P&0w>f|N|HbpKZp?>6K`Bt1?>J-DiqvY+y+)*p@ zj|NoNlTepQ#!)}Vz-2Nj_}YjjCGVV%tmy(LNp@4)O*R=S%pw9AE}+R7A~inSxd9|Q zP&@Gt#%PAKi=oFnRd``zF1Phfb#b9g!p|ZfjytQXXYJT0sy8n$z)hKk*gYR>^__No z+`ssb;m_e@-8kj-$#65eG|u4y2uBx<=fN?JqSfp`-T#YqjTKJ_?~r(v+#g5*g(Hqq zW{AGlWevJnh)!82+0Q&{RL$oBoIrr(5UoZ7stL-*#aQCm+(IkX9d zE3~6tLm1z7@odQ7=dgXG4(C6AW%T8?`L_K=4hHTmdqOMbJRP>=-Iv;I+0<@NWWVhB zW>pK>IT%DJWH;48J9QjQQ_V3n6G<%uw{`C*Tt~)?dRc!bQpn!`~;=L zBT}qba5Zr#d8ZK$YeqIuvhLb1Gfy2h^MyjXpgZZ&7?YvBGvfeXt88PblZ{*7B!YWJ z3nCU3yYdig1;AZe%KuSh{C10Za05E>j$x_c2RcbYb9!sVJFDxiF3d<8_gC#bouJtH z!qJiK&wmj$(k@0Hx~d7vbbP~D^!CEjltW6V!WR$9|8RgMU(0;nHH8!$1m)%mGTBK9 z+$U}cQcLd0fE|QSgbKfY!=Nw8Jji#*qQ=O%2a$xz&?3^T6p1&9i5`H1M4TD-4}YfERpNFm31x}yr4p;3R#4SE2=`T(P|DJ=wa3s@ z=|RN)yj}k*#_kQOs2}i(??E~EK$0y1d%?2fQER06d72It(<4(zMGZQV6+8di)Zy3|xb z3dsdc3Il3fS}8Rp8}{{8e*rl)!{$yIh-T*?&?_&fS6$|)zYhi{r&s?skCR)88{Twh z*>Lp<6{dL4$M_HzQ8feJzV_PTFe)yavuqn+-e`I4g4sey$e|$mNl_Gw zQQ~!ekpsa#6TA5*lqL4P+l%nT1xDr@z zm3QG8Ae{b=T=E~b4aKk=oKc2OTa&8^L+j*dJf-(^8$MjKKYW{szf3FGr{fH@_8N{5 zT$k{wxhX;=uU4z)HO}LhydIAb8tGJFI>&OZEw&!RDdjmW@|Uz1GOzjfFd7Fx`{rUB zf11?}{n=B>M+OB^tutA&$_Ofn0udOWtw z0|LXkNpJ-aFd^ZYGDFdBCM9LBA41Fp15tY)gUI7^$tOxcF=b{#(&KQZ1Kfwt^k?#X zwRQZ6zdJmV;16`{*ek_HwbMIK4Kf0+PaA4Oa!?Vp6sV~2x_|PP9BBO|Dm& zE8q!^BfEjav~1PAupf{lMUa_{TJI)O{f6snlC5xqLxzYjeN5w2pc7ha9ZHqg2rFLJkg{Xqs6+>K>BUd!C2?H%2+9jh`W$ed*!vpP*s zH#^UyFt0_(iI|7mGdN%L3W@amw!t&BK@p2n@>PjcF%E`-9ykc6;9pR~pJM z(<*(Bzlp}^Fu+>qek^8Y30zjc+n*%*Gay(spS|vjv4^QLPcD`~eto!1^kNZ<5T>l~ ztiT)2DLsO!7EysVE4{seBl8oTv<-LUR@Jklc!<^Fk_?9|ZcU>0sVj;Y9c>Rz1_nJ4 zZtTw8tDp$=K>j|!v+t){_+`YfCW!nf-=s{kSwqhYA!3kO0i2Ym)7#spSM~}AQR*jJ9PK}9$o9SRTwxrcdBW4r)(y*M>ku)u%e^U5h>n@ z+3|y6$Y5RbUk6V6hwWJn7=1FM;Ixs*1p2GHa?=S56Do~F9qr!e42E!krPhalYE9ZJ zS+_o3WF}B@m&l#R8rN{IuEIu^=fXO)ls%Qt$0A%+`$-ij)I(_r)ZztC4p)A@q6sY* zym6<RQAsqZ=*Ih&<8fCxrhT$PjfxQOv zSy-m=vYA%(*9)ek)vrx24&2X~os9ELDkyBjCoUwr&g*NDNu)}8(0cL!HU5~+z{|it zRngu_JbwY)w^J=v*vge+dXHcOQxCM}oP5oZS+U>Cf(Jzpt0ggXf_KdnM^pVKddR)k zucq(Ou#!lYyxVyRTkEh1xl!eezwi*$L)5N*&JyWW;a3-OtiK4H^+`GrxIu6<#$xJN z1iMVoe_8E4Yn5WYb#k{z8a$(qw(8o%G)^|(t9U%U)Uu`WEu-uEGsmd`|IFb11$ePB zZ$}?7LVb5tcPVTs=FV?^_X@RHeg< z{jyV^4Be6Ez4ncs2h7$zU$UElM$)V;G~DbydGXJyVKsMJ*o}DSuOg@j1NOo2Z_=US z{A3)w8c}-Yl1nb~2gn z4p4QJo1JEYSJMYv#=ebChP74GY~Gxl4Efzohm|)^P-utku**hfK13aXN z4;6~+Y%;bwWu+2VCD#QNYL+ebEZh{>D2o~=pVU&=MP({w9DislMe+aJe$aOnzn|5+apI1iwK|gibcBaC47-NT9@3kD;Gp9#Q7nQ=mp(qC~a(fY|g|5;J9jQJYy@ z`uve7x`hJ|PPrtmYt^SeSG%0!*G9w{-uZ%vswY$RHSsK^dIa%xdwi41D^f1cGwncH zvPWjm3Hz-5BBZ4iZUI%=|L|PH9&(LcZ?lU4S224BDuMCC z&|(QS7gE+NhAE?r_8oJ@HmM`TQdXBXjflZk%Y6)cb%^e)aRq>IOdyR?+4;)C;}1$U zJ7E-fb`^Y@bPvX?3r+|&)?(3z?J=m**YXt^wl+I&!C$v6UfFY(=o!zs3Vh=3 zlB8OcmtIG>%b!Fa-Xe3wvYs%@$lI&3Gg0vEuC~Pe1(4_c1$0*au<@(i*_dB*K(UDQ z^vpWb%wqmH6~C6^1)!k7;XX#Lj{3*d0v>2Gv%YZ6L&!E|6iqsqzK5s!Xrh^pFvQevuC>$CYSG^JIT-cetdm&g*9K3X<#(kVCNrUIQe*x3n-Q2Nd=5k(odoFM` z#Rx9U|9U&3WQwA)Y+1eKH2V0u2901>r~Egq(7lhBz+LHu&Rd^shP2M-;{BCUUv8J! z7p<|lkpr}U0dI%n4wm;yjTB5kg-}Fk)s?yJoq>s^PdonJ$WE(jxWc#^q@=BX{`>-J zvR>tW!}%=}@vW9%NwNgBx;qeK$M;Loc&m}dr^JiVrH${J!g+)K&Ey!P6Ztn z(OZq)Wi#UEn1|F_|5R~IO$rgik?5St-R74%rfAGQqF$)xh4x3wE;CdS39= z->9;O9XKKQ-}@&2T`K(F?mSuhxyk5RYi*ppRHVNmALG=q7j1gZhj;SIm4lH3$7xy7 zGNxnMDiUzZ*kipjn)TekHJdzOyJdlAG3srCVn?~v@qSGM29*CH2)vVWSYvH$6#EOP zXuG$S`e%uQ)jQA`tcxB(T4c5P1PuZuX&bZDE4`fW*#dO$Q%gw%SF2`u%RB+C5N zlpa`b`=fRsts1##x=@ii>rgv!ezom_98WZso>$j%v#THgCL)&%)OPI|^e)s4;MPe# zenzqzTm)GInwr~dGR)ugp|2Je;~xyz9in1_e3M$SM8=J{TvS$#ww8_u8g(=hho2v& z4%i8HB7~D4&BKt8OG-=RcrtxW+maFoIP&dI75|Vb-)CC7e*1KCzxNz+ixJ#?-p&x2 zVRE0_4v;m_GkeEfLM^yGCRES$U+at5cT2x6Rjrb}?__Uv%sQP#*jFxXa}dJ8p{RqV zeTa~`CDeV%nF5_QpVUDtoDOc;WZBw2>3-ogWJ8h?yb8N5CI(zKl+doo8KdNllk8Gy zL@n)`x+0`y;eG4*iGYJ#GSt@f_QRqDFEVLs?XauZGs2Sis`HJ`_!c2zH|{FVtay@O z!F#N;=j!3l)@jSIBhc}p#e0w6=Qmuii@yipmbGOTPTiw?<-ClZ|z#ENU+h@rHqAM@RMO zyCiioY4J^v+Usbzk$^Wm|cA+!#3 z1v4&U{VN80x;~C62`)w%77cq|>vefz9*@yyDS_u#H!(g=Ex@tQ9FXbhDC(R!KCxS7 z75xw|Ng5*NLkg6YcV+4h{MCpe5fU9 z?%bBwx5T8j-98xs%aQ%x+YJ3DXz}kBzm%GYR=@2b((N^6x}njUXxNejg++{`;@s26 z33$1yhV-I|q(nEjyXpq^$ld))>Vq-f5=Z+dLLB^IvA^9A1?&V$H@I|v0Wlv(!g*W5 zrt-Xf+#2V<#NpdNwb1$qPhYSP{AtFQE6YxZh{zT@f&%gGr2fS0D*S^Az$`&5i0x*C z-q|kR$LGz43mB!sf?kV3Q6Uvcw|;pjg22!V7xFqcuaCHJK?#Rb)XrVKir4Sqj{E?_ z?cugA!|QPmUDgNF^e~Usfx?6Zb?{@D0t)r;0H7#(pgL2jWRdC@N0_ENheY(`yfmAk zgm|D~A1Xp`2g$QKX5&O@=}5m^z&pl$Msk-^6Wr=OY793Q;?d+(@_yvlj#AJ928@?! z{wpTuBNW4msJ#cB{1CE=V%V8RB>g0N%1{Zr;Hv%oCTse_8QR1hpggSUs49JraoRfI zAw1u}D~*`@)RGlWAsT8J)@5nWhUYtNrWDE`cABS=1-16%+Dn{!$mwzpYXxIe?VUAC z1p+MOcrUSuDMC#T8q(}fq&!FZv6v2gkMRBiLe*Sat;e|Ef8niAp0ZDzM#q~hew!RLDOjjF7Cp`AS}PQ`N+@yumf`J~CYwq- zoEaDk6#YVA5xixVlQQ|xCqJ|0=96lZInm4U1n>ST<^J`o0ZX0*BTSv8scwN=a66Mn0Ktt<=hr9zi9j|&#xs|{qg+q)1%tdG=cJzSmYo@7I&0W?b0kyZ`LWzV{(WbeiE*^s^fXInR$2}Z?wza>JR~k4pBn@2DpIvl;_e3sClhPERa3su za~tZGR+Zdl+P~LAIOM;%W{Hgv1{vY(RPB6X*5-5_7HZ+Np%oVePO zsvkc%P8v>SpalF`5HB4_7lfND?)twRe;?%S=oh2xbZNR?Q`*k%hja9QojBoASDPPz@SP}~RU!3;hkJ&>&4lty;&TR`; zqiB*2k6V$j4x$T%e%sL=1uvC;jp%zgD;He7Bc@ztT{m=;X3Zy{u`##ui&cP={w z`{M1Cppu&lS-(C~r5ASY&cidms4UkX$6#JbwEfES$Uso%hOHc{aoM`ybB_2=YS0up zgEbQ4#p9y?WJ7PV#ji>SJ;V4?Oo^Bo&gRYR0!<~UCmMjNa>j#6;ZOs0vOd*}PoCq8 z&${2(#V86zyS4CaQu(%o413vlogzM-B~m+mpvC?m2=FYUNzQ%GAx#d}2`Mf(R$cRp zn}0vju7$wbXc9b`9)KxeM4WcQDdXrKI2mbHfZm-@eGCDajA+4d=l=$vM+Y6+1b)LYle;UqNq^dVQ`AY|ol%D$0|;a&EMUBD|F9vfxw8 zJO9|YlK?X>$9nzlrtWC~75tv}(9pm4~lxt`r#L)Oi4k)!$ia=WdBF8)Yj z0Ng*7G3+|*nlUdp9Di}XPUO}=yd+%%;t#SjA7gasoO5*l6+`}&1OAH#_;0DhN1AZ1 zt5?(n6LT{VzqvF%M<4pAz492BbjKGl&(NR251ml)SfWqEHw;9I+hX1bJStgOY@Hr@96^USUi2TM>W&vl4=l`tl^ikf%f|6S?_E;M2h6v4rO7w8h;NJB3 z*;J1ga#gzw%h&(fm$T|1`h|yY_7a@7XQb?}NgPsSQE;SXS&ntbFs;^&0agE%YdzF_ zJqhFNrO^@3-tt5s<`M?skB(eFcV?UVCMvaDEusGW%nVW-!5 zNkL{925~q?W!q1;tpA0iKOmv9Had+vWAY-q+l7)2U5E7dGU#H0`cW2+tWncYj~ z{w}S$)ggf;nvus()8)}8Fr!W1XxWG^d`-~3Xqj2ppGcl>x!kEe$cBr{1gp7hp-mv0 z8kjwfqm{B#Q~hijThaL7MQ<{3E!jLzX8CIFQxsjc= z8Pf8~`{A52g!p@GcnbWSv6Ct zTG-~C0X+Bg(6QMSZhL`X*Lbn|AMh84Q2bwj@Su~m@m(Wd(X$H%KJ;He=Gr|OBRDY` z&K3YzNIE9dg$}RY#cxC=eF7$%8!TlKj%NkskGd5Z&@ROfCfxPk?9!InbestKNUt1i+Bi!5p?U!94QU1R-3lZi%huhf+Qbvj!9+gkshK0GqmrWM+b z!~01nkWTS>{N|AiD}F7?!>u{AjcbOMc%Fwv3ZH=Uz+Q`DE9K^@Le!x_vRN|DwO%!j zkF+=b){A!$6eBhsz-~aED4i(vkl3AW+WdFiL#eSRkA8jXI(WoY&N8_6)QC2a<84cR zofjV(dVp#Wjs3Ok@OapUT;E1iF^;-`e*%gtO&p($ptA#D&te_tzW?WWhn%U9?W|iP zjDD|i)ORr3GrbZG`%#FUI3F>e;WpWJOdJZBg|I0wJ1J^LTn5g*yrG`<&*Gl7D~FJF z^08f>Z9FXnIr4f%%C=oAy7dT$I2%kqO?^j3i>#!UpCXhPS9Y~DNP>T_o}a#E;6FuV zE&EByan*$cp$zFc>2YynnH6Ax<&8d5U!IFJ4Z!ofU8lvJ-Flc83fB_qBj4zvI(KHJ zqbD?v=Xw>7E(pIjia2K$XuuQAyx#>V^;GCwFsj9)e=bKZ`>S~*2EPUw= z(IuBOv!>U9YaYUB1RBqr;Qoz@QDumZ&GGBpZbH85>}Qj6eB@f$yMb-A_>=KG^V(jq zJ6WS*6Q4~qPEVc~Z3-&kH5R^|AJui)YJ#&$^FD`UVrlYNP zNveK@ondy|ja#}%xL~y$9HwUn zxB`;1ygtTM72Z7#-};+H#!r`D#A`b@4>dHATUy9;)qZh;st(ZNsw;}d3o&Kp&<|9X zeQ+L5UU#>ahdkur->%>{ghC2#In|k2EeY?}v?|jfj?JpgJIya;Xgc+TY1rz79GvR= zv_^H~1IX3g7Xp@Ua$seXPE6jxbx9IN_@gNC+_bF5GEdn{XQH&&^&? z>eHOtU+66Zp3;$=3RFV_tj)@1v5Cg;ET2F(+O6SD+890oB6nVIv6?g$?@~#1tuLx> zM@4xNc*e4y4*Fd6<0iw%#<8rbMA&ifs?9+6+d);=>NFCALWK(s;s#yiQ#%liQ5&=_V%`Wg)0;L)n2-n2xCbFM~0@dJA;fo%4LDL*6`6*><+~WR7&m zH#)X!*yactjDv<}X)4Ez2F!y2e*|ebj?2+wx2?~*y?rJ`3kcd6ZCX`3xq{YLzH~V> z9Ohesi0mt_To&T}-M*SD#R$IDr0<8F(@Gmcr&CD7iRFJOF?Kwp?jU_U{U7IpuE;)o zWmb@yif8x;6bmeK8_3D4AfE-M^TCEExl__j<0TCyQw?b;@c<>VF(~36GWw@TgV%4| zFxc6)_|EqqP?rxI>;Yl$m(tT=G*%Fh=2K=6%zBP<9UjX}m(c#HSahvnU}EUj*I+xo zo!|{{9yLD?8&G9Kvlh8`MN4~N$>v0OE-%kcrW;FsMjPO5P`x?+;LKHUjsR`~OAUa-Oq(dDQ1 zmD~+=Aw)m1`z7whQMK0iZ>ih6e9CwG zNH{WK)7quoc48MP!O_oQrpfMBPwep!AsJj#WyD5g_r-xa)0!MFg}~*!4uMOY6*d1g zBsVAl%^3SVKq2m-E-*Ql;VLEPmzO4qJ;e`}DbI#{hB?y<*qBLj{DUa)d;wD~jcju0 zEme+$PBeu?L_FdKo+!(uh*ln)-8!??f1N0yee}K9LkNH2XbnQ7 zQyhOH4#dn$Os$H+hE;e>@TGv>t!;_*e!G4v(fI|7Z?`pF^u9FyVu3_YZ^Uf0t|pDu;%p_Lj)=&<-VSHTyH&5eNt(MC#DW3aR=mJ&%R9fNlBHT#oTNEk~_%Ix%F)- zbEKY8`ld;{fzy_m2tv;KB-ZTfR943V<@;w!mu=#^`kkRfi-ggBZH&BTy)droF76P) z2`CjayW*dC003(Rzu;P++jLF@(~Uks;j^A!n&;*K|XR0gUCK99KkPdvj`4qjbWA8!RbEJG@LjP+x594%^ ziM{)a-Qmu`gX!V1L9#+fQSV>CNm-7%Yc$BEgW)0#8um89C_SY3Xk(;CCW{+a5u6w{ zMUPKIiXbh>7A-zJuzmmA{?)cj&MbCOZDEHP$ zx&8(}^a5R2-q$dT+pT{^p7)Iz-FaPOq*at@|5J7F&r+JBVkhx+cL=yXlK1#ElL=JinKFbx#rf7ckP0 zv0owrDVTLFn~Ia%zbGq(phRDCPLu0db`SccT*Ch_akIO|XG`eB2Wd7k%J@64W$s^f zz?T04rcju#x1<}pg{@4Z4&Q~T*w;zN%o8ebM9} z+2q?CSRdV0!E!|UMvtq*jSUnP6>lt2vd*40__J`V+OeGO+%33@lPKLN4cWE*TJ0dV zM&g3RM`JS-5TRUMkle6N-XQWM0Hx0co`+GDMd;GkrB024`oGEdlT}^PjvY@U=R8f! zvq6&96{0xyqyaZTJw{h%Q{b$a*=5{1z`q1=*h zNKp^KT6IV%6$iw+;G@+-pVT35bIv%5&&dyI3_bTM&QBKPmmT=;@*7b%BiRf4&-do! zW~ftb)0pPBda`eb6g(eIn#Asq1GUe5ukvKhyzB*+0y+fmTTe^Zd@`;@zL#x|C17hkQsHWTPhXCPNnRXEjy1#9m6hlG$FP8xZ-k?LAiLNrd?R^Tjx$)r1ap z#HlEl7S&;8%WLA9M_{nznyOQ%2V=H>M1xuJ^=zim+p-sgeji+1IvoH674dLiXcN#cCrk(D$GkG3fXp7fac7G?*=%f|;z(1qj` z(bsuBChJ#pa10U@T`i?HY=l$^wGubav-V~^aCeZEvwF(_#hi!3iPf8>;34d^o9?}Kj+Z>UY}gFy8In`uk46GCIS>w%+3Ko zNFLzc$eF7~pHhHcU%v}pI3c7!F8E>mh2xn_9MKe}TNIS}hR{t2A2r89wi=Br_0-XG z2+5osat_n4ac=8tO-xrCF=o~a<>u>B#E3nmNgjZc1O73h6hQj8@V{g`|G>@Q#vfjO z@AWHgT*9HHXhLg-a4f|^-m%*mK1puLM`kW(sArFKfbh23nSv5YKTxKE=R+TCXM-mE zaD8}s>IOlM#{`Lo`yHv=>viZ8Dx@q|IZ(@r8VFx>7B=Y2v@4JKO^5>w6E9)05;q;J zUZ7*AGendGtD1thZ@iN zQ*>}Q#DPrf)u4!?70o?AGgA4L;t;O=9v{*`xAAY`V2tr3e0u~MZZ^9>uukC9NF7Ph zT*}+%@-p?M)+Dk)d1+ANb16=z@%7IG2^+U zNf#Iy%}?3^W$)rq`9qOWuX>>csG&|w??R%#tWU6hG+lKW$hhn%2{8x5hvmXMg~vCdZ|{GV8I)$135g5YNc5RsHDfO11S;M2v%M{oWK!oGXFO1pQvl6PdT`ec^;ItM7UaRj6UfwGXa@Iuxz> ztAbNuKtON}wd=~uoj0>cZMR2*Rr^MMkc;+V+}!sBu}eu47s9Nom(97yS1?0yyD^x- z6qTS+99kfYd{^!gB3HS5`c|cM63HUxwdJSCp}ApgxAYN*$%%Co5v3N18 zF}zrO1Mcd4!CZu3SE*5i|__w*o51$k_n7&J=_E$edYYv_v@s&XuF>Iy;3 z9O@t_mYAo-u=w7hQ}>@8s0TRZ*!V8RTPg-Ofg)m-t;W8H#QlcF`@7^0p-tLm(>e+ zb?obsjwWzBw`Us~Nq2vwcEY{)Ldyik?hXfGi?5=iykOD61^di9F3PV4EZiu{-G5x& zteQ4c&o16;P+M|ZAVW&npxh~#_lhtMNVIF!pjXr5c8*TiHOyiAP;FnAD&$h{z~trJ zOO=l9cg(#RHAciitMSPNSpj!i1sDs;Bi&YQkwr{E^A`9ED97|mA3!P$CUL07kX&|m z@1U@?lf*00nUxe~Z~erZgtbFVVmvM!OXu^HwJ)mWAETU})arR-GU)wQ4^57(AiY#N zrRJf;{(qnxuv8;W7~#KAj{hig{?t!%bIYuc`wvU_B2hysIyR&M&MiSI9Y_`T z*d}2k&6qiBz9)&lw*ocfZ3My$7~`Y07LJ$J?vae?-7>$Ju}OZ6e-vcug@Z&}wXLR< zg;2fyfia{_dPXGlY+8PpyDp)YH1HRb7cIxZc=AJRuq#BVo=|O_5}C1faZ_i_5l3S< zB=eSuzU~;T9#C^+hhPgitYNyVPpSE=Iu)by!Zflr7(3er0*!GTilhU@c zg^p;eaSe4Q2fI?PRQ~uC#XP&?R!{$0pfA%Rrja$C(dj_wp{`mbL@VHJ3uwijG& znT`H&24*_>h*uILN~|uMRNCfR9;#F=^+jpT`qUZJ`Fqh^Ort0n7H9SH#2%tj7)yr=^{UOo`uTQ+vaykh7(+5eF#`)7Snnq7*SytiD8iO-_1|09zB zw+p!}A6fdb=%7=7;!snPw{ntaeYyg)YOaIZDZl1H9*st;?{SL943)j4mQH*1^$2;H zxD|q<82c6J$V%Ao)vL#{Oo>3sk4~swu2*~?)K}?9{Ng-u<2EoQpoYx`0CfV(W;_qV*g|j|y>R-heMH9y>=Hb5uWBeqolXTa{a_por zYPrGPg5468cT**w=XxnYIag5hkc#gQUf0`vYJJ`?$bowsW-d(AQ2kq{gJ|sy$LvD_ zvv?{4gVj*hDG(9!3~|Vjb$GJ0`t8!_mHY{(-|An0{Ul9RttYSJ6-H#b^b7wq6=AaX`n?(#fw=@GD<$;7#rgiG*8pHrWnv>u|d5$+i!+b@(}luu=z10HI+4T>VR* z{8XBo{6vUXwJI%yn0wx{;oP6O_H$Dlzy%nFScXFC)8CBRPKgRjeA|8jBmDZQLdx3Z zSp9eW_)h{HVESr%GA)9ubcNv)dyU-~buhW1PsN5rESh;ny>l^a0g*k9P*5&LoO?Oj zwg}xR_&BGxTDpFO$c)lmo@22Q#^JCtPOayL9jUnNtxfg3k|*(_ z2~XOoieI-;DilH}tbu7dm0psb4(WCEC5as_CLS;zWRsc$0o6?Cce;w~H1wjJxpiwX z%{dYsZrF1R#7RDqGXD!&R(2@f$P2*bJLmHwLP}s z7Pa5w9xXeVHqxkX=>C_y69I@x+qNpQz=mqE}X`q!sL6Q zOjm!T9{NNL%qPWmcW$|{^xDOH?f)=XfOQE7<=?5W7E2LarbB z?5M^<+q{d8UsX}q{Bn-QQRbx!UjP$l0~HDR>rw^5k*i`^=a1*Vxu=+u9Q}wh;r0|{ zr`dP<9tlzucr0^%Ai$huj zZZdSG@JB+o2i$B7Mp&)a5!3?`F%<&>qLnoG(V3p|Vv7f3|HmYj4C2OW*Y@3dW1aMkQuE>YA-Yn~ zr8vX3L=f*quWkOzJZI#PvuG8cBRX2n#&lh5X&1(>)6x4A=rJcrT1=Wqcm&)?*d9?! zG1JVwqbO0~He$EQNclku!44aWhnF%KSmqAG7Z%|X{$e-(5qAu2*SMXKhm9^fC>Xa3rj%#*b{K z0H)zpxkEdvf6PSl2jc+j0s4MHo?O(>dL>douS!&? z=JDmfw45PD%eYkI0wrl4$B}vIu>2m9ah-WRcFUrw9aZ|tg{V%Ede3>wPR&UpgIOtM zZKFiuejh=1Uk#ux`)B}jpmOH2u3E6<_N) z<+RvGuF1V55VzpaY=ha+3pk%^8gqo2$1A6{C)^g?t8o5Y1Olh^LQx;Alic%7B7eDN zQ(urW7)qm`-QP*qla<(N<@_Ah#fN3UP{-6ZUjW)8x`JZcF|;c75|=ZphT7S4FCt>-?H`NSY`A!qNp# zAIaq1z-ir@9TIKbKr;%cFR_)BG&l#UuNf<~pQ6~`jij5stF7d%d`wr3J}5NQi7A+uRHsyUAFIWeSQZr;FccWp*Q-+r^@%>OGP{^I!|m`3ArN32AV9A`?ymyT7TAS z;i_z~cqzt7es2+T8f*yNtoInc0g-%$CQY8Yzmu|r@X!4T5Sqo>6Vu+nbOZiVi~JAC zj>hGIl9=e+O{qa2ZP6(@5x&zpL)LKm7_OvABAcOWS7 zcurE=k9O8UZ&~@;&#s^D|0wOcquKuZeXJraRa>npYE&pcqh^bmAqcfqjnGtLRurYE zQMJ$*_$JiZo~gk&Qqrd?pt zav|WrnbkryANsCCJYCa<_8&>ITDghvd$%r~yF|HF>!Ey%!D1vN*@{>Jf49XFY*7H< z=h3Lx)mHTw8ryiq2xNFCFvm?X-OV$EpY0P68o$*O(ZJQ3)@9xIRdDkJsrt%THMX6U z8tUbY$Q|u|Q)>dE%f7*o-|Ov)Zl`dzlp_XIO%qKm&Zh%0kiu%ud%pdA5>K;?nu_?s z^Q5usfiao=Q}3~d$*P8jfH-ivF2nsw&BrxUz`f7zqYBf3Z>ixQme#*3!ud8^ym#97 zc7lDNQ6)7USpSFF8**O20ZAAAQE+Ng?p!l=a07IjGwRcOM0j}G({|J^fFbDoQI_0K zwT?*ns@s;_DER2e83mExWNn9QPDL3!=B=xKVM}LE6K{yX&a4zJh-kkZoNK#Z!kZB} zh`ld3e}&JsQ5snG8zHn8?Q0kEduUuIyRw7i%}ZC}m%j*Dz0_8aP(QD{A&z*S^=$ca zu}yT%Igt)hj8}lAh^-U$)j@;zIycZcQ(7r({I_|dCow3~I719aO zF?w3x^aq>pyOCMSyM}70w3ITLG!*LOS`=+Be4ck1OFC;cXC=tAqoezidL!2x{M~t$ zC?3Ka*d&RMAN}6r7d{PPOucqr^Dv|$62oNu`+slTj*Nk?JXRYOgjEf-Je)oOyD%Gw z@XC5j6E72aVPeXvln8li=oVh)@d??{^`O)z2i3Eg)qmiVKQWicS-U>i;v@vcoPx_H ze}-LF)#P+Qe^=E^$&*69I`{8oUX?Gm$hMNzV#fnxcMv)5V@^(<+wU*q6y8716llyZ z%~mx@Ol{CD!(NQ}KxAFJQBl@X)@h&wXJzi%sYkc1Mi+mC*zyXQND-%vNkNygue9a2se8WDPke(9#u?N>fJumMa1jE=Ir!vIsP?@=NEn4qWYu-V26F;r%elm*QJE)%jjcwyqru2m0 zS+L~L>hR`lUmf2zZ9uqD=X204xO)4>V^BP&FmT55xK2sO(oC!`(5=MNrg(k z0A~3b>&TC#Te2@G;+{P=KVhJ-_i)QprEN^0>(zO80kB-NZd4fUJ z!Ucf4hB2K1IUjYX+x~ib*8ROeY<-O&;ad42+B|e8&$mCp1664x&{WJ;+|Qa6+#$=2 zmwY%>s7k(Bj@E->Qu?KOAG>J$y^r=!3wrF)pT@LUEp&$=n)DGyNJwk_CPu>7;wzm4 zS&$Y4^`?IHB`nXVun(6xbgx(3F%gA;Hilcd@u;mae3x0|JMcDd3o)VJO`*v2;?jco z$E>Ll^TfH@njO#Cs?nPX%&nSLGD01Zl%~pHQR)10Z8i9FGsR1%iZ6r!KO|GtC2I#Y zrVOIn^xu09Dj~I2{6t3)drXjXPYg*joOZXyCEw9j;%?8GcUp`jTo{i_*-| zgbQu+aHlHc39?I-Uq40ZW1uN!$pUWhvI1xiZN`iT+@e*}@_9%0HnSjH-zKA$>uQ=R zRm1DNdRyl#sURaWxE6i-;E0KLu*Rru-^JAjok5pLAieL*svajt6xlB`t-h9-+~q90 zfp~jbHJYv`7lD2A#BoB%G0IBFdim^#>OEd(B=g{XwAT6UpGvYcO9hNp3-4ojk?&G#S+*C zL~@C>&AMe0_e?|alFl{>P7dNRXe-+zuQpq_H;sXCk4t)t9I4-;2GN4nQ&jb4xkhJo;r^F<# zJ1Y-f4ar^)Z3qcRK3}x!Vz~F^`8jwY$?Sgl4{Nn4xt)W%b$CrCJa&!8spc-lhHRYFxIaCZtXZW#{HvSn*-@i`n+x{-8~0N99&ub7?9#wJ7XoL zcoZ>U+FUo9Zz+cJ1!6z&`0Mdj%aT1ryH)&@63S~ED(o*Ex}bN0>a-&oDTqnQVd9{# z#*=GA;4D1LDHN|W6D2L<wL-`dybXoDd9*jGtDEcJ#5q|q77UZJ_AAweTR?F6?HzA8hh2; zm$3c-j{LwqsjAAWiAn=WdhQbELQr=u5F1%E6*c~H)srFyosyj;aV_%J-P=@lLaOx)jQDP}EuH*f*b~(A z%Gm!j=|+{r72IB3bXmM@Ftb{a`G_KL*(LShYK~ZXECeLM@`EMRg148EDNgDM@U~A` z82$-_bTS@&n<(R5@A)3d=2~Q2N6F7UL1luV@}S_#1}a4PBex8Y*}p+rR8pq&xk)b{ zZb}DU@?G~{?P8ckc|djL)$5t7IOi>~ERVq!qlZq%ZR2}S@9-2UXgD~Itlyv&+?~~%bf~#fS$e^)KF*6MXe>V`D%jh&je?bz<1A@AJ-~ z@KcV)rQPi;%wRfxIb;kT+jVOlDQk6Cc~RDSRJ>5i4_5w-oS3w)fOZ6_N2Xl}+QyOh zysFWM0r__nIj-it4~DU7NpTQ(t=NGCfBU&Rqf&!lO+~W&G<&+Hx0b&RXG$N;r_NeQc`szqW&(UTA$He!sQ=j z8bWxNNEn9Rhq5B5J?9r!?Drkni#=LHs=j-B^okC*UE{M$J7;J%Mv)UghhxlJ#cPsVrg$m`3{ zn`SEBwwBQv#aPXV&Tqpm+#(^5?+37>-wYZNvAg zjiG~;m)DoDOEKz_nhLMxgPe!OL+o5UO!iM4`#-yl1{MF|jdKZ=!UrDxZkO+c|pV&Uh`T$rV6KB0~%w1hnl>Sy=Gvf7oInz z3--RVs}&+XeAmJzUnj}>c%RP-bN~s7<)P4H-3>l`@4zn

    @F*Eyla3FNGkD>-QC0 z8*VerCdm!!H`IO3DV`b|^nds)`+Aq*z9uTX+m*%dsnR{Vc9VLcG0rhcpqFdjGU|{A z3ov=C5xx$?ev=jh5R3*e_~T%47cUK9J!dKW%*KhG^n*($<2)}YT}{^0&=LJZ%>kv1 zo%T;BUo+k*!2AOE1QskF z@4z+DwLB*s#mdOgT<%5Kh*x3O`%Bw&?8N}vYugIXT3|%W`5+|3%$@3{%jy^+lwQoO zDwt}+)MT0jPrca_^uS^F!t&+4w_V=jpa5*|Ug``uR}yZKdTsM6_26vUOHzDXPY0!T zvQc#?#};mW+|3|lm3YEB2~@1P8?~vtZqK?^<>riuGTeYHI4GAFcs!d4FPjt$ey-Y2 zbtq^HVN?O@y&H@p<^{vIcee1lL}xqBLSx;jvp*KYn##_`1vF0w2-OK~;0wiqww|4I zN7yLr^Dc+zxtQ`CUB~R$^*y0?F^zL=%r&b`!c`dj0?4JYPRW{H(4a!T-+E*Tr29sv zT^h+FY4l{Q#!~90fvH?mF2n$y5LrX=u-_ zM9b`W%^X9t`gHec&G`M2z?x%#?s3>XEBT>ph&$iv3em-9ji-E~*E# z;2Exq@8}$;8(PWyv zQ0#2Wpm4j@St}<5e;=sGD54KSW?24qI2<;e#H)3uGfkj0Tkr1iW@SmbD>oT>=7Z@> z-FVH^&P{+LVS-M+0^6zscJCqwdt4(C& zM0S6iPg75Vu;?=q3O&Ph)Nc&1D~%d*OuNFILo(Qv7p~fCcnRIQdxW>+88Nd%Op-$b z-Ak0Irz@yVrZy?0IOQe%2ky9!O(UK1JGpmCDtrxl6$y4557g;Jv*KSgAwz{eg1fE7 zzM!U>aj`O5m~@(u5GllJjBAUyQF2~;gb|KpVv3)K%S&7&M_^dyk877T4wVM2X7o=f z$Il?eSpHs^m9Bb>{{RYQ@-;{l3+QJQIe8rt0F3zQ1x&P@kE+`hlj{Y82$LK@0e>wN zTV))YoGWoK*?Z;Ij|hd_QF54CM({}mKE>L7j}|Zf@n`SGM@~(%fjCPZo|j#gnG{ms zX2jq2&mS9_SW5JZW@uY;Qxxr344oT;8wGT3;}KfrM`gp2=G9Za^xMeyW(!lErkiDL zWXAM@a6cl=F6Cf1a)v&dCNLDjl~T0rDxuY8kgF8s{McVF&yj<~_qF3E)gKDYBzUrG znWk}|jgl_*`ENmJZQxA2ofB+#Csrjm13L=>--dz?2$v?}#Y{pOV`aWEH3|9!7Vr{xKR8Mv$AqNs4eA1`Osc}WEd0PGqffa76^41GX z$UBsUcJ5I70~9oz;l3*UzMNC`0kx$KE?t_q?C=zKlkU+9IXyW-aIdwmFz!gtb_v=j zDf*1nSOS3Jk - -]> - - - - - - - - - -;;Default extension for filenames -(define %html-ext% ".html") -;;What font would you like for the body? -(define %body-font-family% - "Arial") - -(element emphasis -(if (equal? (normalize "bold") (attribute-string (normalize "role"))) - ($bold-seq$) - ($italic-seq$))) - -(element tgroup - (let* ((wrapper (parent (current-node))) - (frameattr (attribute-string (normalize "frame") wrapper)) - (pgwide (attribute-string (normalize "pgwide") wrapper)) - (footnotes (select-elements (descendants (current-node)) - (normalize "footnote"))) - (border (if (equal? frameattr (normalize "none")) - '(("BORDER" "0")) - '(("BORDER" "1")))) - (bgcolor '(("BGCOLOR" "#E0E0E0"))) - (width (if (equal? pgwide "1") - (list (list "WIDTH" ($table-width$))) - '())) - (head (select-elements (children (current-node)) (normalize "thead"))) - (body (select-elements (children (current-node)) (normalize "tbody"))) - (feet (select-elements (children (current-node)) (normalize "tfoot")))) - (make element gi: "TABLE" - attributes: (append - border - width - bgcolor - '(("CELLSPACING" "0")) - '(("CELLPADDING" "4")) - (if %cals-table-class% - (list (list "CLASS" %cals-table-class%)) - '())) - (process-node-list head) - (process-node-list body) - (process-node-list feet) - (make-table-endnotes)))) - - -;;Should verbatim items be 'shaded' with a table? -(define %shade-verbatim% - #t) - -;;Define shade-verbatim attributes -(define ($shade-verbatim-attr$) - (list - (list "BORDER" "0") - (list "BGCOLOR" "#E0E0E0") - (list "WIDTH" ($table-width$)))) - -;;Index -(define (generate-index) - ("1")) - -;;======================== -;;Title Pages for Books -;;======================= - -(define (book-titlepage-recto-elements) - (list (normalize "title") - (normalize "subtitle") - (normalize "authorgroup") - (normalize "author") - (normalize "date") - (normalize "releaseinfo") - (normalize "orgname") - (normalize "graphic") - (normalize "copyright") - (normalize "legalnotice"))) - - - - - - - - - -;;Index -(define ($insert.xref.page.number$) - ("yes")) - -;;Index -(define ($generate-index$) - ("1")) - -;;Tex Backend off -(define tex-backend - #f) - -;;What elements should have a LOT? -(define ($generate-book-lot-list$) - (list (normalize "example") - (normalize "table") - (normalize "figure") - (normalize "equation"))) - -;;======================== -;;Title Pages for Books -;;======================= - -(define (book-titlepage-recto-elements) - (list (normalize "title") - (normalize "subtitle") - (normalize "authorgroup") - (normalize "author") - (normalize "date") - (normalize "orgname") - (normalize "graphic") - (normalize "copyright") - (normalize "legalnotice") - (normalize "releaseinfo"))) - -(define %show-ulinks% - ;; Display URLs after ULinks? - #t) - -(define %indent-screen-lines% - ;; Indent lines in a 'Screen'? - " ") - - - - - - - - diff --git a/doc/UsersGuide/clm_ug.xml b/doc/UsersGuide/clm_ug.xml deleted file mode 100644 index 68aa69b1d6..0000000000 --- a/doc/UsersGuide/clm_ug.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - build-namelist"> - configure"> - NCAR"> - CCSM"> - CCSM4.0"> - CESM"> - CESM1.0"> - CESM1.0.1"> - CESM1.0.2"> - CESM1.0.3"> - - PTCLM"> - PTCLM1"> - PTCLM1.110504"> - CLM"> - CLMCN"> - CLMSP"> - CLMU"> - CLM3.0"> - CLM3.5"> - CLM4"> - CLM4.0.00"> - - - - - - - - DATM"> - models/lnd/clm/doc/KnownBugs"> - NetCDF"> - FORTRAN"> - FORTRAN-90"> - MPI"> - PIO"> - OpenMP"> - NCL"> - Perl"> - XML"> - xmlchange"> - 2"> - - - - env_run.xml"> - env_build.xml"> - env_conf.xml"> - user_nl_clm"> - - - PTS_MODE"> - CSMDATA"> - CLM_FORCE_COLDSTART"> - CLM_CONFIG_OPTS"> - CLM_BLDNML_OPTS"> - CLM_NML_USE_CASE"> - CLM_NAMELIST_OPTS"> - CLM_PT1_NAME"> - CLM_QIAN"> - CPLHIST3HrWx"> - CLM_USRDAT_NAME"> - CLM_CO2_TYPE"> - DIN_LOC_ROOT"> - - - CLM_QIAN"> - - - - %ISOamsa; - ]]> - - - - %ISOgrk1; - ]]> - -]> - - - - -&cesm; Research Tools: &clmrel; User's Guide Documentation - - - CESM - CLM - community earth system model - climate - climate model - earth system model - land surface model - hydrology - biogeochemistry - urban model - documentation - - - - - - Erik - Kluzek - - NCAR - - - - - - - -The user's guide to &clmrel; which is the active land surface model component of &cesmrel;. -The purpose of this guide is to instruct both the novice and experienced user, as well as -&clm; developers in the use of &clm4; for land-surface climate modeling. - - - -$URL$ - -&build_date; - - - - - -Dedicated to the Land Model Working Group, winners of the 2008 &ccsm; Distinguished Achievement Award. -May you continue to collaborate together well, and continue to drive -the science of land surface modeling forward with your diligent and persistent efforts. - - - - -&preface; -&custom; -&tools; -&adding_files; -&special_cases; -&single_point; -&ptclmdoc; -&trouble; -&testing; -&appendix; - - diff --git a/doc/UsersGuide/co2_streams.txt b/doc/UsersGuide/co2_streams.txt deleted file mode 100644 index 4d38c6d06e..0000000000 --- a/doc/UsersGuide/co2_streams.txt +++ /dev/null @@ -1,50 +0,0 @@ - - - This is a streams file to pass historical CO2 from datm8 to the other - surface models. It reads in a historical dataset derived from data used - by CAM. The getco2_historical.ncl script in components/clm/tools/ncl_scripts - was used to convert the CAM file to a streams compatible format (adding domain - information and making CO2 have latitude/longitude even if only for a single - point. - - - - Input stream description file for historical CO2 reconstruction data - - 04 March 2010: Converted to form that can be used by datm8 by Erik Kluzek - 18 December 2009: Prepared by B. Eaton using data provided by - Jean-Francois Lamarque. All variables except f11 are directly from - PRE2005_MIDYR_CONC.DAT. Data from 1765 to 2007 with 2006/2007 just - a repeat of 2005. - - - CLMNCEP - - - - time time - lonc lon - latc lat - area area - mask mask - - - /fis/cgd/cseg/csm/inputdata/atm/datm7/CO2 - - - fco2_datm_1765-2007_c100614.nc - - - - - CO2 co2diag - - - /fis/cgd/cseg/csm/inputdata/atm/datm7/CO2 - - - fco2_datm_1765-2007_c100614.nc - - - - diff --git a/doc/UsersGuide/custom.xml b/doc/UsersGuide/custom.xml deleted file mode 100644 index d6a60a28f7..0000000000 --- a/doc/UsersGuide/custom.xml +++ /dev/null @@ -1,1615 +0,0 @@ - - - - - - - component set - compset - "I" compsets - "B" compsets - "E" compsets - "F" compsets - &CLMCONFIG; - &CLMNAMELIST; - &CLMFORCECOLD; - &CLMUSECASE; - &CLM1PT; - &CLMUSRDAT; - &CLMCO2; - - -How to customize the configuration for a case with &clm; - - -The -&cesm; User's Guide gives you the details on how to setup, &configure;, build, and run -a case. That is the document to give you the details on using the &cesm; scripts. The purpose -of this document is to give you the details when using &cesm; with &clm; on how to customize -and use advanced features in &clm;. You should be familiar with the &cesm; User's Guide and -how to setup cases with &cesmrel; before referring to this document. - - -In this chapter we deal with three different ways of customizing a case: Choosing a compset, -Customizing Configuration options, and customizing the &clm; Namelist. There are many different -compsets that use &clm; and many are setup to enable special features of &clm; from the start. So -the first thing you want to be familiar with are the different options in the compsets. The -next section shows the different options for customizing the configuration options for -&clm;. -Here we introduce the &clm; &configure; and &buildnml; scripts and how using the options in -&envconf; you can customize the configuration and the initial -namelist. The final section tells you about the &clm; namelist and how you can customize the -namelist once you have run "&configure; -case" and have an initial namelist in -BuildConf/clm.buildnml.csh. You can also -use &envconf; options to change your namelist as well, before "&configure; -case" is -run. - - - -Choosing a compset using &clm; - - -When setting up a new case one of the first choices to make is which "component -set" (or compset) to use. The -compset refers to which component models are used as well as specific settings for them. We label the different -types of compsets with a different letter of the alphabet from "A" (for all data model) to "X" (for all dead model). -The compsets of interest when working with &clm; are the "I" compsets (which contain -&clm; with a data atmosphere model -and a stub ocean, and stub sea-ice models), "E" and "F" compsets (which contain &clm; -with the active atmosphere model (CAM), -prescribed sea-ice model, and a data ocean model), and "B" compsets which have all active components. Below we -go into details on the "I" compsets which emphasize &clm; as the only active model, and just mention the two other categories. - - -When working with &clm; you usually want to start with a relevant "I" compset before moving to the more -complex cases that involve other active model components. The "I" compsets can exercise -&clm; in a way that -is similar to the coupled modes, but with much lower computational cost and faster turnaround times. - - -Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) -&compsets_list; - - - - Compsets coupled to active atmosphere with data ocean - - CAM compsets are compsets that start with "E" or "F" in the name. They are - described more fully in the scripts documentation or the CAM documentation. "E" compsets have -a slab ocean model while "F" compsets have a data ocean model. - - - - -Fully coupled compsets with fully active ocean, sea-ice, and atmosphere - - Fully coupled compsets are compsets that start with "B" in the name. They are - described more fully in the scripts documentation. - - - - -Conclusion to choosing a compset - -We've introduced the basic type of compsets that use &clm; and given some further details -for the "standalone &clm;" (or "I" compsets). The - -config_compsets.xml lists all of the compsets and gives a full description -of each of them. In the next section we look into customizing the &configure; time options -for compsets using &clm;. - - - - - - - -Customizing the &clm; configuration - -The "Creating a Case" section of the -&cesm1; Scripts -User's-Guide -gives instructions on creating a case. What is of interest here is how to customize your -use of &clm; -for the case that you created. In this section we discuss how to customize your case before the first -step -- the "&configure; -case" step is done. In the next section we will discuss how to customize your -&clm; namelist after "&configure; -case" has already been done. - - -For &clm; when "&configure; -case" is called there are two steps that take place: - - -The &clm; "&configure;" script is called to setup the build-time -configuration for &clm; (more information on &configure; is given in -). -The &clm; "&buildnml;" script is called to generate the initial -run-time namelist for &clm; (more information on &buildnml; is given below in -. - - -When customizing your case at the &configure; step you are able to modify the process by effecting either one -or both of these steps. The &clm; "&configure;" and "&buildnml;" scripts are both available in the "models/lnd/clm/bld" -directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what -types of options you can give either of them. - - -There are five different types of customization for the configuration that we will -discuss: &cesm1; &clm; configuration items, Configure time User Namelist, -other noteworthy &cesm; configuration items, the &clm; &configure; script options, and -the &clm; &buildnml; script options. - - -Information on all of the script, configuration, build and run items is found under -scripts/ccsm_utils/Case.template -in the -config_definition.xml - file. - - - -&clm; Script configuration items - -Below we list each of the &cesm; configuration items that are specific to &clm;. All -of these are available in your: &envconf; file. - - - - &CLMCONFIG; - &CLMBLDNML; - &CLMNAMELIST; - &CLMFORCECOLD; - &CLMUSECASE; - &CLM1PT; - &CLMUSRDAT; - &CLMCO2; - -For the precedence of the different options to &buildnml; see the section on -precedence below. - - -The first item &CLMCONFIG; has to do with customizing the &clm; configuration options for your case, the rest -all have to do with generating the initial namelist. - - - -&CLMCONFIG; - - -The option &CLMCONFIG; is all about passing command line arguments to the &clm; &configure; script. It is important -to note that some compsets, may already put a value into the &CLMCONFIG; variable. You can still add more -options to your &CLMCONFIG; but make sure you add to what is already there rather than replacing it. Hence, -we recommend using the "-append" option to the xmlchange script. In - -below we will go into more details on options that can be customized in the &clm; "&configure;" script. It's -also important to note that the &clm; template may already invoke certain &clm; &configure; options and as such those -command line options are NOT going to be available to change at this step (nor would you want to change them). -The options to &configure; are given with the "-help" option which is given in -. - - - - - -&CLMUSECASE; - - -&CLMUSECASE; is used to set a particular set of conditions that set multiple namelist items, all centering around -a particular usage of the model. -To list the valid options do the following: - - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -use_case list - - -The output of the above command is: - - -&usecases_list; - - - -See the section for the precedence of this -option relative to the others. - - - - - - -&CLMBLDNML; - - -The option &CLMBLDNML; is for passing options to the &clm; "&buildnml;" script. As with the "&configure;" -script the &clm; template may already invoke certain options and as such those options will NOT be available to be -set here. The best way to see what options can be sent to the "&buildnml;" script is to do - - -> cd models/lnd/clm/bld -> ./&buildnml; -help - - -Here is the output from the above. - - -./&buildnml_help; - - -The &clm; template already sets the resolution and mask as well as the &configure; file, -the start-type, the co2_ppmv, rtm_tstep, and rtm_res, and defines an input -namelist and namelist input file, and it normally sets either "-ignore_ic_year" or -"-ignore_ic_date". Also many -of the options are designed solely for &clm; stand-alone testing and hence should NOT -be used (any of the options starting -with a "datm_" or "drv_" prefix. Hence there are then only five different options that could be set: - - - --lnd_res --sim_year --rcp --clm_demand --verbose - - - -"-lnd_res" is used to run &clm; in fine-mesh mode at a higher resolution than the atmospheric model. This can -be useful to get higher resolution from the land model, but saving computer time -by running the more expensive atmospheric model at a lower resolution. -To get a list of valid resolutions to run at do the following: - - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -lnd_res list - - - -The fine-mesh mode is considered experimental, and you may run into problems when you use -it. Another option is to use the CESM level "tri-grid" capability to run the land model -on a different grid than the atmospheric model. Read the CESM User's-Guide to learn how -to do this. - - - - - -See the section for the precedence of this -option relative to the others. - - - - -"-clm_demand" asks the &buildnml; step to require that the list of variables -entered be set. Typically, this is used to require that optional filenames be used and ensure -they are set before continuing. For example, you may want to require that -flanduse_timeseries be set to get dynamically changing vegetation types. To do this -you would do the following. - -> ./xmlchange -file env_conf.xml -id &CLMBLDNML; -val "-clm_demand flanduse_timeseries" - -To see a list of valid variables that you could set do this: - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -clm_demand list - - - - -Using a 20th-Century transient compset or the 20thC_transient use-case -using &CLMUSECASE; would set this as well, but would also use -dynamic nitrogen and aerosol deposition files, so using -clm_demand would be a way -to get just dynamic vegetation types and NOT the other files as well. - - - -"-sim_year" is used to set the simulation year you want the data-sets to simulate conditions for in the input -datasets. The simulation "year" can also be a range of years in order to do simulations -with changes in the dataset values as the simulation progresses. To list the valid -options do the following: - - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -sim_year list - - -"-rcp" is used to set the representative concentration pathway for the future scenarios -you want the data-sets to simulate conditions for, in the input -datasets. To list the valid options do the following: - - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -rcp list - - - - - -&CLMNAMELIST; - - -The option &CLMNAMELIST; is for passing namelist items into the "clm_inparm" namelist. -Any items that are set in &CLMNAMELIST; will be set in your namelist after "&configure; --case" is done. - - - -For character namelist items you need to use "&apos;" as quotes for strings so that the -scripts don't get confused with other quotes they use. - - - -Example, you want to set hist_dov2xy to .false. -so that you get vector output to your history files. To do so edit -&envconf; and add a setting for hist_dov2xy. -So do the following: - -> ./xmlchange -file env_conf.xml -id &CLMNAMELIST; -val hist_dov2xy=.false. - - - -Example, you want to set hist_fincl1 to add the variable 'HK' -to your history files. To do so edit -&envconf; and add a setting for hist_fincl1. -So do the following: - -> ./xmlchange -file env_conf.xml -id &CLMNAMELIST; -val "hist_fincl1=&apos;HK&apos;" - -For a list of the history fields available see -&clm; History Fields. - - - -See the section for the precedence of this -option relative to the others. - - - - - - -&CLMCO2; - - -&CLMCO2; sets the type of input &CO2; for either "constant", "diagnostic" or prognostic". -If "constant" the value from CCSM_CO2_PPMV will be used. If "diagnostic" -or "prognostic" the values MUST be sent from the atmosphere model. For more information on how -to send &CO2; from the data atmosphere model see . - - - - - -&CLMFORCECOLD; - - -&CLMFORCECOLD; when set to on, requires that -your simulation do a cold start from arbitrary initial conditions. If this is NOT set, it -will use an initial condition file if it can find an appropriate one, and otherwise do a cold -start. &CLMFORCECOLD; is a good way to ensure that you are doing a cold -start if that is what you want to do. - - - - - -&CLM1PT; - - -&CLM1PT; is used ONLY for a pt1_pt1 -resolution simulation to set the name of the single-point files to use. -To see a list of the valid resolutions do this: - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -res list - - - -The output of the above command is: - - -&res_list; - - -the valid resolutions that can be used with &CLM1PT; are the ones that -have city or nation names such as: 5x5_amazon, 1x1_vancouverCAN 1x1_mexicocityMEX, or -1x1_brazil. The "1x1_" prefix means the file is for a single-point, while "5x5_" prefix means -it's for a region of five points in latitude by five points in longitude. Both regional -and single point datasets can be used for &CLM1PT;. If you create your own datasets -you can also use &CLM1PT; along with &CLMUSRDAT; (documented below), setting &CLM1PT; to -the value in &CLMUSRDAT; so that your datasets are used rather than the standard ones.o - - - - - -&CLMUSRDAT; - - -&CLMUSRDAT; provides a way to enter your own datasets into the initial -namelist setup at "&configure; -case". The files you create must be named with -specific naming conventions outlined in: . -To see what the expected names of the files are, use the -queryDefaultNamelist.pl to see -what the names will need to be. For example if your &CLMUSRDAT; will -be "1x1_boulderCO", with a "navy" land-mask, constant simulation year range, for 1850, -the following will list what your filenames should be: - -> cd models/lnd/clm/bld -> queryDefaultNamelist.pl -usrname "1x1_boulderCO" -options \ -mask=navy,sim_year=1850,sim_year_range="constant" -csmdata $CSMDATA - -An example of using &CLMUSRDAT; for a simulation is given in -. - - - -See the section for the precedence of this -option relative to the others. - - - - - - - - - -Configure time User Namelist - -&CLMNAMELIST; as described above allows you to set any -extra namelist items you would like to appear in your namelist after first &configure;d. -However, it only allows you a single line to enter namelist items, and strings must -be quoted with &apos; which is a bit awkward. If you have a long list of namelist -items you want to set (such as a long list of history fields) a convenient way to do it -is to create a &usernlclm; that contains just the list of namelist -variables you want to add to your initial namelist. The &usernlclm; -will only be used when &configure; is run, so if you change it after &configure; -- it won't -change anything. The file needs to be in valid FORTRAN namelist format, and the &configure; -step will abort if there are syntax errors. It merely needs to be named correctly -&usernlclm; and placed in your case directory (where your other -env_*.xml files are). The namelist name actually doesn't have to be -valid, but all the variable names must be. Here's an example &usernlclm; -namelist that sets a bunch of history file related items, to create output history files -monthly, daily, every six and 1 hours. - -Example &usernlclm; namelist file - -&clmexp - hist_fincl2 = 'TG','TBOT','FIRE','FIRA','FLDS','FSDS', - 'FSR','FSA','FGEV','FSH','FGR','TSOI', - 'ERRSOI','BUILDHEAT','SABV','SABG', - 'FSDSVD','FSDSND','FSDSVI','FSDSNI', - 'FSRVD','FSRND','FSRVI','FSRNI', - 'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI', - 'H2OSNO','SOILLIQ','SOILICE', - 'TSA_U', 'TSA_R', - 'TREFMNAV_U', 'TREFMNAV_R', - 'TREFMXAV_U', 'TREFMXAV_R', - 'TG_U', 'TG_R', - 'RH2M_U', 'RH2M_R', - 'QRUNOFF_U', 'QRUNOFF_R', - 'SoilAlpha_U', - 'Qanth', 'SWup', 'LWup', 'URBAN_AC', 'URBAN_HEAT' - hist_fincl3 = 'TG:I', 'FSA:I', 'SWup:I', 'URBAN_AC:I', 'URBAN_HEAT:I', - 'TG_U:I', 'TG_R:I', - hist_fincl4 = 'TG', 'FSA', 'SWup', 'URBAN_AC', 'URBAN_HEAT' - hist_mfilt = 1, 30, 28, 24 - hist_nhtfrq = 0, -24, -6, -1 -/ - - - - -See the section for the precedence of this -option relative to the others. - - - - -In the above example we use an invalid namelist name &clmexp -- but it works anyway -because the &clm; &buildnml; knows the namelist that specific variable names belong to, and -it puts them there. - - -Obviously, all of this would be difficult to put in the &CLMNAMELIST; -variable, especially having to put &apos; around all the character strings. For -more information on the namelist variables being set here and what they mean, see -the section on &clm; namelists below, as well as the namelist definition that gives -details on each variable. - - - - -Precedence of Options - -Note: The precedence for setting the values of namelist variables with the -different env_conf options is (highest to lowest): - -Namelist values set by specific command-line options, like, -d, -sim_year -(i.e. &CLMBLDNML; env_conf variable) -Values set on the command-line using the -namelist option, -(i.e. &CLMNAMELIST; env_conf variable) -Values read from the file specified by -infile, -(i.e. &usernlclm; file) -Datasets from the -clm_usr_name option, -(i.e. &CLMUSRDAT; env_conf variable) -Values set from a use-case scenario, e.g., -use_case -(i.e. &CLMUSECASE;env_conf variable) -Values from the namelist defaults file. - -Thus a setting in &CLMBLDNML; will override a setting for the same thing given in -a use case with &CLMUSECASE;. Likewise, a setting in &CLMNAMELIST; will override a -setting in &usernlclm;. - - - - -Setting Your Initial Conditions File - -Especially with &clmcn; starting from initial conditions is very important. Even -with &clmsp; it takes many simulation years to get the model fully spunup. There -are a couple different ways to provide an initial condition file. - - - - - - - - -Your initial condition file MUST agree with the surface dataset you are using -to run the simulation. If the two files do NOT agree you will get a -run-time about a mis-match in PFT weights, or in the number of PFT's or -columns. To get around this you'll need to use -to interpolate your initial condition dataset. - - - - - -Doing a hybrid simulation to provide initial conditions - -The first option is to setup a hybrid simulation and give a -RUN_REFCASE and RUN_REFDATE to specify the -reference case simulation name to use. -When you setup most cases, at the standard resolutions of "f09" or "f19" it -will already do this for you. For example, if you run an "I2000CN" compset -at "f09_g16" resolution the following settings will already be done for you. - -./xmlchange -file env_conf.xml -id RUN_TYPE -val hybrid -./xmlchange -file env_conf.xml -id RUN_REFCASE -val I2000CN_f09_g16_c100503 -./xmlchange -file env_conf.xml -id RUN_REFDATE -val 0001-01-01 -./xmlchange -file env_conf.xml -id GET_REFCASE -val TRUE - -Setting the GET_REFCASE option to TRUE means it -will copy the files from the: -$DIN_LOC_ROOT/ccsm4_init/I2000CN_f09_g16_c100503/0001-01-01 -directory. Note, that the RUN_REFCASE and -RUN_REFDATE variables are expanded to get the directory name -above. If you do NOT set GET_REFCASE to TRUE then -you will need to have placed the file in your run directory yourself. In either -case, the file is expected to be named: -$RUN_REFCASE.clm2.r.$RUN_REFDATE-00000.nc with the variables -expanded of course. - - - - -Doing a branch simulation to provide initial conditions - -The setup for running a branch simulation is essentially the same as for a hybrid. -With the exception of setting RUN_TYPE to branch -rather than hybrid. A branch simulation runs the case essentially -as restarting from it's place before to exactly reproduce it. While a hybrid simulation -allows you to change namelist items, and use a different code base that may have -fewer fields on it than a full restart file. The GET_REFCASE works -similarily for a branch case as for a hybrid. - - - - -Providing a finidat file in your &usernlclm; file - -Setting up a branch or hybrid simulation requires the initial condition file -to follow a standard naming convention, and a standard input directory if you -use the GET_REFCASE option. If you want to name your file willy -nilly and place it anywhere, you can set it in your &usernlclm; file as in this -example. - -&clm_inparm - finidat = '/glade/home/$USER/myinitdata/clmi_I1850CN_f09_g16_0182-01-01.c120329.nc' -/ - -Note, if you provide an initial condition file -- you can NOT set &CLMFORCECOLD; to -TRUE. - - - - -Adding a finidat file to the XML database - -Like other datasets, if you want to use a given initial condition file to -be used for all (or most of) your cases you'll want to put it in the XML -database so it will be used by default. The initial condition files, are -resolution dependent, and dependent on the number of PFT's and other variables -such as GLC_NEC or if irrigation is on or off. -See for more information on this. - - - - - -Other noteworthy configuration items - -For running "I" cases there are several other noteworthy configuration items that -you may want to work with. Most of these involve settings for the &datm;, but one -CCSM_CO2_PPMV applies to all models. If you are running an B, E, -or F case that doesn't use the &datm; obviously the DATM_* settings will not be used. -All of the settings below are in your &envconf; file - - CCSM_CO2_PPMV - CCSM_VOC - DATM_MODE - DATM_PRESAERO - DATM_CLMNCEP_YR_ALIGN - DATM_CLMNCEP_YR_START - DATM_CLMNCEP_YR_END - DATM_CPL_CASE - DATM_CPL_YR_ALIGN - DATM_CPL_YR_START - DATM_CPL_YR_END - - - - - -CCSM_CO2_PPMV - -CCSM_CO2_PPMV sets the mixing ratio of &CO2; in -parts per million by volume for ALL &cesm; components to use. Note that most compsets -already set this value to something reasonable. Also note that some compsets may -tell the atmosphere model to override this value with either historic or ramped -values. If the CCSM_BGC variable is set to something other than "none" -the atmosphere model will determine &CO2;, and &clm; will listen -and use what the atmosphere sends it. On the &clm; side the namelist item -co2_type tells &clm; to use the value sent from the atmosphere rather than -a value set on it's own namelist. - - - - -CCSM_VOC - -CCSM_VOC enables passing of the Volatile Organic Compounds (VOC) from -&clm; to the atmospheric model. This of course is only important if the atmosphere -model is a fully active model that can use these fields in it's chemistry calculations. - - - - -DATM_MODE - -DATM_MODE sets the mode that the &datm; model should run in this determines -how data is handled as well as what the source of the data will be. Many of the modes -are setup specifically to be used for ocean and/or sea-ice modeling. The modes -that are designed for use by &clm; are: - -&CLMQIAN; -CLM1PT -&CPLHIST; - - - -&CLMQIAN; is for the standard mode of using global atmospheric data -that was developed by Qian et. al. for &clm; using NCEP data from 1948 to 2004. -See for more information on -the &datm; settings for &CLMQIAN; mode. -CLM1PT is for the special cases where we have single-point tower -data for particular sites. Right now we only have data for three urban locations: -MexicoCity Mexico, Vancouver Canada, and the urban-c alpha site. -See for more information on -the &datm; settings for CLM1PT mode. -&CPLHIST; is for running with atmospheric forcing from a previous &cesm; simulation. -See for more information on -the &datm; settings for &CPLHIST; mode. - - -There is a problem with running simulations for the CLM1PT mode -that are greater than one data cycle, where the atm forcing will be held constant. -This will result in useless -results as all atmosphere forcing fields will be held constant at the last value. -See bug 1377 in the &KnownBugs; file on how to fix this problem. - - - - - - - -DATM_PRESAERO - -DATM_PRESAERO sets the prescribed aerosol mode for the data atmosphere -model. The list of valid options include: - -clim_1850 = constant year 1850 conditions -clim_2000 = constant year 2000 conditions -trans_1850-2000 = transient 1850 to year 2000 conditions -rcp2.6 = transient conditions for the rcp=2.6 -W/m2 future -scenario -rcp4.5 = transient conditions for the rcp=4.5 -W/m2 future -scenario -rcp6.0 = transient conditions for the rcp=6.0 -W/m2 future -scenario -rcp8.5 = transient conditions for the rcp=8.5 -W/m2 future -scenario -pt1_pt1 = read in single-point or regional datasets - - - - - -DATM_CLMNCEP_YR_START - -DATM_CLMNCEP_YR_START sets the beginning year to cycle the atmospheric -data over for the &CLMQIAN; mode. - - - - -DATM_CLMNCEP_YR_END - -DATM_CLMNCEP_YR_END sets the ending year to cycle the atmospheric -data over for the &CLMQIAN; mode. - - - - -DATM_CLMNCEP_YR_ALIGN - -DATM_CLMNCEP_YR_START and DATM_CLMNCEP_YR_END determine -the range of years to cycle the atmospheric data over, and DATM_CLMNCEP_YR_ALIGN -determines which year in that range of years the simulation will start with. - - - - -DATM_CPL_CASE - -DATM_CPL_CASE sets the casename to use for the &CPLHIST; mode. - - - - -DATM_CPL_YR_START - -DATM_CPL_YR_START sets the beginning year to cycle the atmospheric -data over for the &CPLHIST; mode. - - - - -DATM_CPL_YR_END - -DATM_CPL_YR_END sets the ending year to cycle the atmospheric -data over for the &CPLHIST; mode. - - - - -DATM_CPL_YR_ALIGN - -DATM_CPL_YR_START and DATM_CPL_YR_END determine -the range of years to cycle the atmospheric data over, and DATM_CPL_YR_ALIGN -determines which year in that range of years the simulation will start with. - - - - - - - - -Downloading DATM Forcing Data - -In Chapter One of the -&cesm; User's Guide -there is a section on "Downloading input data". The normal process of setting up -cases will use the "scripts/ccsm_utils/Tools/check_input_data" script to retrieve -data from the &cesm; subversion inputdata repository. However, the DATM forcing data -is unique -- because it is large compared to the rest of the input data (56 Gbytes). Most of the -data is stored in the directory set by the &envrun; variable -DIN_LOC_ROOT_CSMDATA. The &CLMQIAN; forcing data is in a (possibly) -separate directory using the &envrun; variable DIN_LOC_ROOT_CLMQIAN. -In most cases this directory will be in the directory: -atm/datm7/atm_forcing.datm7.Qian.T62.c080727 under -DIN_LOC_ROOT_CSMDATA. On bluefire there is a separate path for -the &CLMQIAN; forcing data. We have the full set of data available on a few of -the machines we use: bluefire, jaguarpf, and edinburgh. As of October, 18th, 2011 -we've uploaded the entire set of forcing data into the input data repository so -now it can be treated like other input datasets and the check_input_data script -can retreive it for you. Previously only two years of data was available. -You can also download the data from the -Earth System Grid for other machines. See the -Model Forcing Data -link under the -&clm; Documentation Page - - - - -Customizing via the template files - -The final thing that the user may wish to do before &configure; is run is to edit -the template files which determine the configuration and initial namelist. The -variables in &envconf; typically mean you will NOT have -to edit the template. But, there are rare instances where it is useful to do so. - gives the details on how to do this. -The template files are copied to your case directory and are available under -Tools/Templates. -The list of template files you might wish to edit are: - - clm.cpl7.template - datm.cpl7.template - cpl.template - - - - - - -More information on the &clm; &configure; script - -The &configure; script defines the details of a clm configuration and summarizes it into a -config_cache.xml file. The config_cache.xml -will be placed in your case directory under Buildconf/clmconf. -The config_definition.xml -in models/lnd/clm/bld/config_files -gives a definition of each &clm; configuration item, it is viewable in a web-browser. -Many of these items are things that you would NOT change, but looking through the -list gives you the valid options, and a good description of each. Below we repeat -the config_definition.xml files contents: - - - - - -Help on &clm; &configure; - -Coupling this with looking at the options to &configure; with -"-help" as below will enable you to understand how to set the different options. - -> cd models/lnd/clm/bld -> &configure; -help - - - -The output to the above command is as follows: - - -&config_help; - - -We've given details on how to use the options in &envconf; to -interact with the &clm; "&configure;" and "&buildnml;" scripts, as well as giving a good -understanding of how these scripts work and the options to them. In the next section we -give further details on the &clm; namelist. You could customize the namelist for these -options after "&configure; -case" is run. - - - - - - - - - - Customizing the &clm; namelist - -Once a case is &configure;d, we can then customize the case further, by editing the -run-time namelist for &clm;. First let's list the definition of each namelist -item and their valid values, and then we'll list the default values for them. -Next for some of the most used or tricky namelist items we'll give examples of their -use, and give you example namelists that highlight these features. - - - - -Definition of Namelist items and their default values - -Here we point to you where you can find the definition of each namelist item and -separately the default values for them. The default values may change depending on -the resolution, land-mask, simulation-year and other attributes. Both of these -files are viewable in your web browser. Below we provide the link for them, and -then expand each in turn. - - - -Definition of each Namelist Item - - -Default values of each -&clm; Namelist Item - - - -One set of the namelist items allows you to add fields to the output history files: -hist_fincl1, hist_fincl2, -hist_fincl3, hist_fincl4, -hist_fincl5, and hist_fincl6. The link -&clm; History Fields -documents all of the history fields available and gives the long-name and units -for each. - - - - - -&hisfldtbl; - - - - - - - -Examples of using different namelist features - -Below we will give examples of user namelists that activate different commonly used -namelist features. We will discuss the namelist features in different examples and then -show a user namelist that includes an example of the use of these features. First we -will show the default namelist that doesn't activate any user options. - - - -The default namelist - -Here we give the default namelist as it would be created for a I1850CN compset at 0.9x1.25 -resolution with a gx1v6 land-mask. To edit the namelist you would edit the -BuildConf/clm.buildnml.csh under your case (or before &configure; -include a user namelist with just the items you want to change). For simplicity we will -just show the namelist and NOT the entire file. In the sections below, for simplicity - we will just show the user namelist (&usernlclm;) that will add (or modify existing) -namelist items to the namelist. Again, just adding the &usernlclm; file to your case -directory, before "&configure; -case" is invoked will cause the given namelist items to -appear in your &clm; namelist. - -Default &clm; Namelist - -&clm_inparm - co2_ppmv = 284.7 - co2_type = 'constant' - create_crop_landunit = .false. - dtime = 1800 - fatmgrid = '$DIN_LOC_ROOT/lnd/clm2/griddata/griddata_0.9x1.25_070212.nc' - fatmlndfrc = -'$DIN_LOC_ROOT/lnd/clm2/griddata/fracdata_0.9x1.25_gx1v6_c090317.nc' - finidat = 'I1850CN_f09_g16_c100503.clm2.r.0001-01-01-00000.nc' - fpftcon = '$DIN_LOC_ROOT/lnd/clm2/pftdata/pft-physiology.c110425.nc' - frivinp_rtm = '$DIN_LOC_ROOT/lnd/clm2/rtmdata/rdirc_0.5x0.5_simyr2000_slpmxvl_c120717.nc' - fsnowaging = -'$DIN_LOC_ROOT/lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc' - fsnowoptics = -'$DIN_LOC_ROOT/lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc' - fsurdat = -'$DIN_LOC_ROOT/lnd/clm2/surfdata/surfdata_0.9x1.25_simyr1850_c091006.nc' - ice_runoff = .true. - outnc_large_files = .true. - rtm_nsteps = 6 - urban_hac = 'ON_WASTEHEAT' - urban_traffic = .false. -/ -&ndepdyn_nml - stream_fldfilename_ndep = -'$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc' - stream_year_first_ndep = 1850 - stream_year_last_ndep = 1850 -/ - - -Note that the namelist introduces some of the history namelist options that will be -talked about in further detail below (hist_mfilt and -hist_nhtfrq). - - - - -Adding/removing fields on your primary history file - -The primary history files are output monthly, and contain an extensive list of -fieldnames, but the list of fieldnames can be added to using hist_fincl1 -or removed from by adding fieldnames to hist_fexcl1. -A sample user namelist &usernlclm; adding few new fields -(cosine of solar zenith angle, and solar declination) and excluding a few -standard fields is (ground temperature, vegetation temperature, soil temperature and soil water).: - -Example &usernlclm; namelist adding and removing fields on primary history file - -&clm_inparm - hist_fincl1 = 'COSZEN', 'DECL' - hist_fexcl1 = 'TG', 'TV', 'TSOI', 'H2OSOI' -/ - - - - - - -Adding auxiliary history files and changing output -frequency - -The hist_fincl2 through hist_fincl6 set of -namelist variables add given history fieldnames to auxiliary history file "streams", and -hist_fexcl2 through hist_fexcl6 set of -namelist variables remove given history fieldnames from history file auxiliary "streams". -A history "stream" is a set of history files that are produced at a given frequency. -By default there is only one stream of monthly data files. To add more streams you -add history fieldnames to hist_fincl2 through -hist_fincl6. The output frequency and the way averaging is done -can be different for each history file stream. By default the primary history files -are monthly and any others are daily. You can have up to six active history streams, but you need -to activate them in order. So if you activate stream "6" by setting -hist_fincl6, but if any of hist_fincl2 through -hist_fincl5 are unset, only the history streams up to the first blank one -will be activated. - - -The frequency of the history file streams is given by the namelist variable -hist_nhtfrq which is an array of rank six for each history stream. -The values of the array hist_nhtfrq must be integers, where the -following values have the given meaning: - -Positive value means the output frequency is the number of -model steps between output. - -Negative value means the output frequency is the absolute -value in hours given (i.e -1 would mean an hour and -24 would mean a full day). Daily -(-24) is the default value for all auxiliary files. - -Zero means the output frequency is monthly. This is the -default for the primary history files. - - - - -The number of samples on each history file stream is given by the namelist variable -hist_mfilt which is an array of rank six for each history stream. -The values of the array hist_mfilt must be positive integers. By -default the primary history file stream has one time sample on it (i.e. output is -to separate monthly files), and all other streams have thirty time samples on them. - - -A sample user namelist &usernlclm; turning on four extra file -streams for output: daily, six-hourly, hourly, and every time-step, -leaving the primary history files as monthly, and changing the number -of samples on the streams to: yearly (12), thirty, weekly (28), daily (24), and daily -(48) is: - -Example &usernlclm; namelist adding auxiliary history files and changing output frequency - -&clm_inparm - hist_fincl2 = 'TG', 'TV' - hist_fincl3 = 'TG', 'TV' - hist_fincl4 = 'TG', 'TV' - hist_fincl5 = 'TG', 'TV' - hist_nhtfrq = 0, -24, -6, -1, 1 - hist_mfilt = 12, 30, 28, 24, 48 -/ - - - - - - -Removing all history fields - -Sometimes for various reasons you want to remove all the history fields either -because you want to do testing without any output, or you only want a very small -custom list of output fields rather than the default extensive list of fields. -By default only the primary history files are active, so technically using -hist_fexcl1 explained in the first example, you could list -ALL of the history fields that are output in -hist_fexcl1 and then you wouldn't get any output. However, as -the list is very extensive this would be a cumbersome thing to do. So to facilitate -this hist_empty_htapes allows you to turn off all default output. -You can still use hist_fincl1 to turn your own list of fields -on, but you then start from a clean slate. -A sample user namelist &usernlclm; turning off all history -fields and then activating just a few selected fields (ground and vegetation temperatures -and absorbed solar radiation) is: - -Example &usernlclm; namelist removing all history fields - -&clm_inparm - hist_empty_htapes = .true. - hist_fincl1 = 'TG', 'TV', 'FSA' -/ - - -Note, you could also build adding the "-noio" option to &CLMCONFIG;. But, this would -build the model without history output and you wouldn't be able to add that in later. - - - - -Various ways to change history output averaging flags - -There are two ways to change the averaging of output history fields. The first is using -hist_avgflag_pertape which gives a default value for each history -stream, the second is when you add fields using hist_fincl*, you add -an averaging flag to the end of the field name after a colon (for example 'TSOI:X', would -output the maximum of TSOI). -The types of averaging that can be done are: - -A Average, over the output interval. -I Instantaneous, output the value at the output interval. -X Maximum, over the output interval. -M Minimum, over the output interval. - - -The default averaging depends on the specific fields, but for most fields is an average. -A sample user namelist &usernlclm; making the monthly output -fields all averages (except TSOI for the first two streams and FIRE for the 5th stream), -and adding auxiliary file streams for instantaneous (6-hourly), -maximum (daily), minimum (daily), and average (daily). For some of the fields we -diverge from the per-tape value given and customize to some different type of -optimization. - -Example &usernlclm; namelist with various ways to average history fields - -&clm_inparm - hist_empty_htapes = .true. - hist_fincl1 = 'TSOI:X', 'TG', 'TV', 'FIRE', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_fincl2 = 'TSOI:X', 'TG', 'TV', 'FIRE', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_fincl3 = 'TSOI', 'TG:I', 'TV', 'FIRE', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_fincl4 = 'TSOI', 'TG', 'TV:I', 'FIRE', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_fincl5 = 'TSOI', 'TG', 'TV', 'FIRE:I', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_avgflag_pertape = 'A', 'I', 'X', 'M', 'A' - hist_nhtfrq = 0, -6, -24, -24, -24 -/ - - - - - -In the example we put the same list of fields on each of the tapes: soil-temperature, -ground temperature, vegetation temperature, emitted longwave radiation, reflected -solar radiation, sensible heat, total latent-heat, and total water storage. We also -modify the soil-temperature for the primary and secondary auxiliary tapes by outputting -them for a maximum instead of the prescribed per-tape of average and instantaneous -respectively. For the tertiary auxiliary tape we output ground temperature instantaneous -instead of as a maximum, and for the fourth auxiliary tape we output vegetation -temperature instantaneous instead of as a minimum. Finally, for the fifth auxiliary -tapes we output FIRE instantaneously instead of as an average. - - - - -We also use hist_empty_htapes as in the previous example, -so we can list ONLY the fields that we want on the primary history tapes. - - - - - -Outputting history files as a vector in order to analyze -the plant function types within gridcells - -By default the output to history files are the grid-cell average of all land-units, and -vegetation types within that grid-cell, and output is on the -full 2D latitude/longitude grid with ocean masked out. Sometimes it's important to -understand how different land-units or vegetation types are acting within a grid-cell. -The way to do this is to output history files as a 1D-vector of all land-units and vegetation -types. In order to display this, you'll need to do extensive post-processing to make sense -of the output. Often you may only be interested in a few points, so once you figure out the -1D indices for the grid-cells of interest, you can easily view that data. 1D vector output -can also be useful for single point datasets, since it's then obvious that all data is for the -same grid cell. - - -To do this you use hist_dov2xy which is an array of rank six for -each history stream. Set it to -.false. if you want one of the history streams to be a 1D vector. -You can also use hist_type1d_pertape if you want to average over all the: -Plant-Function-Types, columns, land-units, or grid-cells. -A sample user namelist &usernlclm; leaving the primary monthly -files as 2D, and then doing grid-cell (GRID), column (COLS), -and no averaging over auxiliary tapes output daily for a single field -(ground temperature) is: - -Example &usernlclm; namelist outputting some files in 1D Vector format - -&clm_inparm - hist_fincl2 = 'TG' - hist_fincl3 = 'TG' - hist_fincl4 = 'TG' - hist_fincl5 = 'TG' - hist_fincl6 = 'TG' - hist_dov2xy = .true., .false., .false., .false. - hist_type2d_pertape = ' ', 'GRID', 'COLS', ' ' - hist_nhtfrq = 0, -24, -24, -24 -/ - - - - -LAND and COLS are also options to the pertape averaging, but currently there is a bug -with them and they fail to work. - - - - - -Technically the default for hist_nhtfrq is for primary files -output monthly and the other auxiliary tapes for daily, so we don't actually have -to include hist_nhtfrq, we could use the default for it. Here -we specify it for clarity. - - - - -Visualizing global 1D vector files will take effort. You'll probably want -to do some post-processing and possibly just extract out single points of interest -to see what is going on. Since, the output is a 1D vector, of only land-points -traditional plots won't be helpful. The number of points per grid-cell will also -vary for anything, but grid-cell averaging. You'll need to use the output fields -pfts1d_ixy, and pfts1d_jxy, to get the mapping -of the fields to the global 2D array. pfts1d_itype_veg gives you -the PFT number for each PFT. Most likely you'll want to do this analysis in a -data processing tool (such as NCL, Matlab, Mathmatica, IDL, etcetera that is able -to read and process &netcdf; data files). - - - - - -Outputting multi-layer snow history fields - -A number of history fields provide information about individual snow layers: -SNO_ABS, SNO_T, SNO_GS, -SNO_Z, SNO_LIQH2O, -SNO_ICE, SNO_TK, and -SNO_BW; there is also an auxiliary field to aid -interpretation: SNO_EXISTENCE (described below). These fields -are inactive by default, but can be enabled like other history fields. If the -maximum number of snow layers is 5 (for example), then the layers of these -fields are arranged on the history file so that layer 1 is at the top of the -snow pack, and layer 5 only exists if the snow is deep enough to support all -layers. - - -Because snow layers can come into and out of existence, these fields can be -challenging to interpret. It is easiest to analyze these fields if you do output -every time step, and do not average to the grid cell (i.e., dov2xy = -.false.). Otherwise, a few principles should be kept in mind when -working with these fields: - -Temporal averages are taken only over times when a given snow layer exists -Grid cell averages are taken only over columns in which a given snow layer exists -SNO_EXISTENCE gives the fraction of the averaging -period in which a given snow layer existed. For grid cell averages, this gives -the weighted spatial fraction of the columns in which a snow layer existed for -this averaging period. This is most useful for subsetting grid cells for -analysis. For example, grid cells that have SNO_EXISTENCE = 1 -for all snow layers can be analyzed most easily. - - - -Here is a simple example illustrating this averaging; this considers a given -snow layer, L: - - -Assume a grid cell with 2 columns, with averaging done over 4 time steps. Column -#1 has subgrid weight 0.2, and no snow in layer L in any time -step. Column #2 has subgrid weight 0.8, and has snow in layer -L in time steps 3 and 4; the snow field of interest has -values 1.0 and 2.0 in these two time steps, for this layer. - - -SNO_EXISTENCE is then 0.8*(2/4) = 0.4. The snow field's value -would be 1.5 (note that times and columns with no snow in this layer are simply -ignored). - - -Finally, note that the SNOABS field is not computed for urban -columns, so it will have a missing value if snow only exists over urban columns -for a given snow layer. - - - - -Conclusion to namelist examples - -We've given various examples of namelists that feature the use of different namelist options -to customize a case for particular uses. Most the examples revolve around how to customize the -output history fields. This should give you a good basis for setting up your own &clm; namelist. - - - - - - - - - -Customizing the &datm; Namelist and Streams files - -When running "I" compsets with &clm; you use the &datm; model to give atmospheric -forcing data to &clm;. There are four ways to customize &datm;: - - -&datm; Main Namelist (datm_in) - - -&datm; Stream Namelist (datm_atm_in) - - -&datm; stream files - - -&datm; template file -(Tools/Templates.datm.cpl7.template) - - -The -Data Model Documentation gives the details of all the options for the data -models and for &datm; specifically. It goes into detail on all namelist items both for -&datm; -and for &datm; streams. It shows examples of stream files and talks about their use. In - we talk about editing the CLM and &datm; -template files. So here we won't talk about the &datm; template file, and we won't list -ALL of the &datm; namelist options, nor go into great details about stream files. But, -we will talk about a few of the different options that are relevant for running with -&clm;. All of the options for changing the namelists or stream files is done by editing -the Buildconf/datm.buildnml.csh file. - - -Because, they aren't useful for work with &clm; we will NOT discuss any of the options -for the main &datm; namelist. Use the &datm; Users Guide at the link above to find -details of that. For the streams namelist we will discuss three items: - - -mapalgo - - -taxmode - - -tintalgo - - -And for the streams file itself we will discuss: - - offset - -Again everything else (and including the above items) are discussed in the Data Model -User's Guide. Of the above the last three: offset, taxmode and tintalgo are all closely -related and have to do with the time interpolation of the &datm; data. - - - - -mapalgo - -mapalgo sets the spatial interpolation method to go from the -&datm; input data to the output &datm; model grid. The default is -bilinear. For CLM1PT we set it to nn to just -select the nearest neighbor. This saves time and we also had problems running the -interpolation for single-point mode. - - - - -taxmode - -taxmode is the time axis mode. For &clm; we usually have it -set to cycle which means that once the end of the data is reached -it will start over at the beginning. The extend modes is used -have it use the last time-step of the forcing data once it reaches the end of forcing -data (or use the first time-step before it reaches where the forcing data starts). -See the warning below about the extend mode. - - -THE extend OPTION NEEDS TO BE USED WITH CAUTION! -It is only invoked by default for the CLM1PT mode and is only intended for the -supported urban datasets to extend the data for a single time-step. If you have the -model run extensively through periods in this mode you will effectively -be repeating that last time-step over that entire period. This means the -output of your simulation will be worthless. See bug 1377 in the &KnownBugs; file for -more information on this issue. - - - - - - -offset (in the stream file) - -offset is the time offset in seconds to give to each stream -of data. Normally it is NOT used because the time-stamps for data is set correctly -for each stream of data. Note, the offset may NEED to be -adjusted depending on the taxmode described above, or it may -need to be adjusted to account for data that is time-stamped at the END of an -interval rather than the middle or beginning of interval. The -offset can is set in the stream file rather than on the -stream namelist. For data with a taxmode method of -coszen the time-stamp needs to be for the beginning of the interval, -while for other data it should be the midpoint. The offset can be -used to adjust the time-stamps to get the data to line up correctly. - - - - -tintalgo - -tintalgo is the time interpolation algorithm. For &clm; we usually -use one of three modes: coszen, nearest, or -linear. We use coszen for solar data, -nearest for precipitation data, and linear -for everything else. If your data is half-hourly or hourly, nearest -will work fine for everything. The coszen scaling is useful for -longer periods (three hours or more) to try to get the solar to match the cosine of -the solar zenith angle over that longer period of time. If you use -linear for longer intervals, the solar will cut out at night-time -anyway, and the straight line will be a poor approximation of the cosine of the -solar zenith angle of actual solar data. nearest likewise would -be bad for longer periods where it would be much higher than the actual values. - - -For coszen the time-stamps of the data should correspond to the -beginning of the interval the data is measured for. Either make sure the time-stamps -on the datafiles is set this way, or use the offset described above -to set it. - - - - -For nearest and linear the time-stamps of the -data should correspond to the middle of the interval the data is measured for. Either -make sure the time-stamps on the datafiles is set this way, or use the -offset described above to set it. - - - - - - -In the sections below we go over each of the relevant DATM_MODE -options and what the above &datm; settings are for each. This gives you examples -of actual usage for the settings. We also describe in what ways you might want -to customize them for your own case. - - - -&CLMQIAN; mode and it's &datm; settings - -In &CLMQIAN; mode the Qian dataset is used which has 6-hourly -solar and precipitation data, and 3-hourly for everything else. -The dataset is divided into those three data streams: solar, precipitation, -and everything else (temperature, pressure, humidity and wind). The time-stamps -of the data were also adjusted so that they are the beginning of the interval -for solar, and the middle for the other two. Because, of this the -offset is set to zero, and the tintalgo -is: coszen, nearest, and -linear for the solar, precipitation and other data -respectively. taxmode is set to cycle -and mapalgo is set to bilinear so that -the data is spatially interpolated from the input T62 grid to the grid the atmosphere -model is being run at. - - -Normally you wouldn't customize the &CLMQIAN; settings, but you might replicate -it's use for your own global data that had similar temporal characteristics. - - - - -CLM1PT mode and it's &datm; settings - -In CLM1PT mode the model is assumed to have half-hourly or hourly data -for a single-point. For the supported datasets that is exactly what it has. -But, if you add your own data you may need to make adjustments accordingly. -Using the &CLMUSRDAT; option you can easily extend this mode for your own -datasets that may be regional or even global and could be at different temporal -frequencies. If you do so you'll need to make adjustments to your &datm; settings. -The dataset has all data in a single stream file. The time-stamps -of the data were also adjusted so that they are at the middle of the interval. -Because, of this the offset is set to zero, and the -tintalgo is set to nearest. -taxmode is set to extend -and mapalgo is set to nn so that -simply the nearest point is used. - - -If you are using your own data for this mode and it's not at least hourly -you'll want to adjust the &datm; settings for it. If the data is three or -six hourly, you'll need to divide it up into separate streams like in -&CLMQIAN; mode which will require fairly extensive changes to the &datm; -namelist and streams files. For an example of doing this see -. - - - - -&CPLHIST; mode and it's &datm; settings - -In &CPLHIST; mode the model is assumed to have 3-hourly for a global grid from -a previous &cesm; simulation. Like &CLMQIAN; mode the data is divided into -three streams: one for precipitation, one for solar, and one for everything else. -The time-stamps for Coupler history files for &cesm; is at the end of the interval, -so the offset needs to be set in order to adjust the time-stamps to what it needs -to be for the tintalgo settings. For precipitation -taxmode is set to nearest so the -offset is set to -5400 seconds so that -the ending time-step is adjusted by an hour and half to the middle of the interval. -For solar taxmode is set to coszen so the -offset is set to -10800 seconds so that -the ending time-step is adjust by three hours to the beginning of the interval. -For everything else taxmode is set to -linear so the offset is set to --5400 seconds so that the ending time-step is adjusted by an -hour and half to the middle of the interval. - - -Normally you wouldn't modify the &datm; settings for this mode. However, if you -had data at a different frequency than 3-hours you would need to modify the -offset and possibly the taxmode. The other -two things that you might modify would be the path to the data (which you can -change in the &datm; template see ) or -the domain file for the resolution (which is currently hardwired to f09). For -data at a different input resolution you would need to change the domain file -in the streams file to use a domain file to the resolution that the data comes in -on. - - - - - - - -Conclusion to customizing chapter - -We've given extensive details on customizing cases with &clm;, by choosing compsets, by changing -&configure; options and interacting with the &clm; "&configure;" and "&buildnml;" scripts, -we've given details on all of the &clm; namelist items, and finally given some -instruction in customizing the &datm; namelist and streams files. In the next chapter we talk -about further ways to customize cases with &clm; by creating your own datasets using the tools -provided in &clm;. - - - - diff --git a/doc/UsersGuide/get_Icaselist.pl b/doc/UsersGuide/get_Icaselist.pl deleted file mode 100755 index 6aefc26159..0000000000 --- a/doc/UsersGuide/get_Icaselist.pl +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env perl -#----------------------------------------------------------------------------------------------- -# -# get_Icaselist.pl -# -# This utility gets a list of the I cases from the CCSM compset database. -# -#----------------------------------------------------------------------------------------------- - -use strict; -use Cwd; -use English; -use Getopt::Long; -use IO::File; -use IO::Handle; -#----------------------------------------------------------------------------------------------- - -sub usage { - die <autoflush(); - -#----------------------------------------------------------------------------------------------- -my $cwd = getcwd(); # current working directory -my $cfgdir; # absolute pathname of directory that contains this script -$cfgdir = $cwd; - -#----------------------------------------------------------------------------------------------- -# Parse command-line options. -my %opts = ( - ); -GetOptions( - "h|help" => \$opts{'help'}, -) or usage(); - -# Give usage message. -usage() if $opts{'help'}; - -# Check for unparsed argumentss -if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); -} - -# Check for manditory case input if not just listing valid values - -my %cfg = (); # build configuration - -#----------------------------------------------------------------------------------------------- - -# Check for the configuration definition file. -my $config_def_file = "config_definition.xml"; -my $case_def_dir = "$cfgdir/../../../../../scripts/ccsm_utils/Case.template"; -(-f "$case_def_dir/$config_def_file") or die <<"EOF"; -** Cannot find configuration definition file \"$config_def_file\" in directory - \"$case_def_dir\" ** -EOF - -# Compset definition file. -my $compset_file = 'config_compsets.xml'; -(-f "$case_def_dir/$compset_file") or die <<"EOF"; -** Cannot find compset parameters file \"$compset_file\" in directory - \"$case_def_dir\" ** -EOF - -my $xml_dir = "$cfgdir/../../../../../scripts/ccsm_utils/Tools/perl5lib"; -# The XML::Lite module is required to parse the XML configuration files. -(-f "$xml_dir/XML/Lite.pm") or die <<"EOF"; -** Cannot find perl module \"XML/Lite.pm\" in directory - \"$xml_dir\" ** -EOF - - -#----------------------------------------------------------------------------------------------- -my @dirs = ( $cfgdir, $xml_dir, $case_def_dir ); -unshift @INC, @dirs; -require XML::Lite; -require ConfigCase; - -#----------------------------------------------------------------------------------------------- -my $cfg_ref = ConfigCase->new("$case_def_dir/$config_def_file"); -print_compsets( "$case_def_dir/$compset_file" ); - -#----------------------------------------------------------------------------------------------- -# FINNISHED #################################################################################### -#----------------------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- - -sub print_compsets -{ - # Print all currently supported valid compsets - - my ($compset_file) = @_; - my $xml = XML::Lite->new( $compset_file ); - my $root = $xml->root_element(); - - # Check for valid root node - my $name = $root->get_name(); - $name eq "config_compset" or die - "file $compset_file is not a compset parameters file\n"; - - # Read the compset parameters from $compset_file. - my @e = $xml->elements_by_name( "compset" ); - my %a = (); - my %data; - while ( my $e = shift @e ) { - %a = $e->get_attributes(); - my $sname = $a{'SHORTNAME'}; - if ($a{GRID_MATCH} && exists($data{$sname}) && defined($data{$sname}{'DESC'} && defined($a{'DESC'}) ) ) { - if ( $data{$sname}{'DESC'} =~ /^INVALID:/ ) { - $data{$sname}{'DESC'} = $a{'DESC'}; - } - } elsif ( $a{'SHORTNAME'} =~ /^I/ ) { - $data{$sname}{'NAME'} = $a{'NAME'}; - $data{$sname}{'DESC'} = $a{'DESC'}; - } - } - print "\n"; - foreach my $sname ( sort(keys(%data)) ) { - print "$data{$sname}{'NAME'}" . - "($sname)\n"; - print "$data{$sname}{'DESC'}\n"; - } - print "\n"; -} - diff --git a/doc/UsersGuide/limitLineLen.pl b/doc/UsersGuide/limitLineLen.pl deleted file mode 100755 index 25f1216d06..0000000000 --- a/doc/UsersGuide/limitLineLen.pl +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env perl -# -# Limit the line length for output designed to go into the document. -# -use strict; -use Cwd; -use English; -use IO::File; -use Getopt::Long; -use IO::Handle; -#----------------------------------------------------------------------------------------------- - -# Get the directory name and filename of this script. If the command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script - # is in - # the user's PATH -my $nm = "$ProgName::"; # name to use if script dies -my $scrdir; -if ($ProgDir) { - $scrdir = $ProgDir; -} else { - $scrdir = getcwd() -} -my $limitLen = 99; - -sub usage { - my $msg = shift; - - print "ERROR:: $msg\n"; - die < -OPTIONS - -l = Limit line length to this value (default $limitLen) -EOF -} - -sub LengthofwhiteSpaceNearLength { - my $line = shift; - my $leng = shift; - - my $l = $leng; - while( substr( $line, $l, 1 ) !~ /\s|:|,|\// ) { - # First search for white-space before desired length -- and then after - if ( $l <= $leng ) { - $l--; - } else { - $l++; - } - # Once reach beginning of line, go to the desired length+1 and increment - if ( $l < 0 ) { $l = $leng+1; } - # Once reach the very end of the line die as couldn't break it - if ( $l >= length($line) ) { - die "ERROR : went through entire line and did NOT find a place to break it\n"; - } - } - return( $l ); -} - -my %opts = ( limitLen => $limitLen ); - -GetOptions( - "l=s" => \$opts{'limitLen'}, -) or usage(); - -if ( $#ARGV != 0 ) { - &usage( "Wrong number of command line arguments" ); -} - -$limitLen = $opts{'limitLen'}; - -my $inputFile = $ARGV[0]; - -if ( ! -f $inputFile ) { - &usage( "Input file does NOT exist : $inputFile" ); -} - -my $fh = IO::File->new($inputFile, '<') or die "** $nm - can't open input file: $inputFile\n"; - -while (my $line = <$fh>) { - - while( length($line) > $limitLen ) { - print STDERR "Line length over $limitLen\n"; - my $lenlim = &LengthofwhiteSpaceNearLength( $line, $limitLen ); - if ( ($lenlim == length($line)) || $lenlim < 0 ) { - print "Can NOT truncate long line: $line\n"; - die "ERROR : Having trouble breaking a long line\n"; - } - my $substring = substr( $line, 0, $lenlim+1 ); - print "$substring \\ \n"; - my $newline = " " . substr( $line, $lenlim+1, length($line) ); - $line = $newline; - } - print $line; - -} -$fh->close; - - diff --git a/doc/UsersGuide/modelnl/Makefile b/doc/UsersGuide/modelnl/Makefile deleted file mode 100644 index 595a1b3a3e..0000000000 --- a/doc/UsersGuide/modelnl/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -# -# Makefile to create HTML documentation of namelists -# -SCRNLDIR := ../../../../../../scripts/doc/modelnl -VPATH := . $(SCRNLDIR) ../../../../../drv/bld/namelist_files ../../../../../glc/cism/bld/namelist_files \ - ../../../../../atm/datm/bld/namelist_files ../../../../../../scripts/ccsm_utils/Case.template \ - ../../../../../../scripts/ccsm_utils/Machines ../../../../../rof/rtm/bld/namelist_files \ - ../../../bld/namelist_files ../.. -SOURCES := namelist_definition_drv.xml namelist_definition_cism.xml namelist_definition.xml \ - namelist_definition_rtm.xm namelist_definition_datm.xml config_definition.xml \ - config_grid.xml config_machines.xml config_compsets.xml ChangeSum -TAGFILE := clmtag.txt - -CWD := $(shell pwd ) -ALLOUT := $(CWD)/clm_nl_drv.html $(CWD)/clm_nl_cism.html $(CWD)/clm_nl_clm.html $(CWD)/clm_nl_rtm.html \ - $(CWD)/clm_nl_datm.html $(CWD)/clm_env_case.html $(CWD)/clm_env_build.html $(CWD)/clm_env_pesetup.html \ - $(CWD)/clm_env_run.html $(CWD)/clm_grid.html $(CWD)/clm_machines.html $(CWD)/clm_compsets.html \ - $(TAGFILE) $(CWD)/index.html - -all: $(ALLOUT) - -debug: - @echo "SOURCES = $(SOURCES)" - @echo "VPATH = $(VPATH)" - @echo "ALLOUT = $(ALLOUT)" - @echo "SCRNLDIR = $(SCRNLDIR)" - @echo "CWD = $(CWD)" - @echo "TAGFILE = $(TAGFILE)" - -.SUFFIXES: -.SUFFIXES: .xml .html .txt - -RM := /bin/rm - -CTAGNAME = $(shell cat $(TAGFILE) ) - - -$(TAGFILE): ChangeSum - head -3 $< | tail -1 | awk '{print $$1}' > $@ - -$(CWD)/index.html: $(TAGFILE) index.cpp - sed 's/CLMTAGNAME/$(CTAGNAME)/' index.cpp > $@ - -$(CWD)/clm_nl_drv.html: namelist_definition_drv.xml - cd $(SCRNLDIR) ; ./nldef2html_drv > $@ - -$(CWD)/clm_nl_cism.html: namelist_definition_cism.xml - cd $(SCRNLDIR) ; ./nldef2html_cism > $@ - -$(CWD)/clm_nl_clm.html: namelist_definition.xml - cd $(SCRNLDIR) ; ./nldef2html_clm > $@ - -$(CWD)/clm_nl_rtm.html: namelist_definition_rtm.xml - cd $(SCRNLDIR) ; ./nldef2html_rtm > $@ - -$(CWD)/clm_nl_datm.html: namelist_definition_datm.xml - cd $(SCRNLDIR) ; ./nldef2html_datm > $@ - -$(CWD)/clm_env_case.html: config_definition.xml - cd $(SCRNLDIR) ; ./xmldef2html_env_case > $@ - -$(CWD)/clm_env_build.html: config_definition.xml - cd $(SCRNLDIR) ; ./xmldef2html_env_build > $@ - -$(CWD)/clm_env_pesetup.html: config_definition.xml - cd $(SCRNLDIR) ; ./xmldef2html_env_pesetup > $@ - -$(CWD)/clm_env_run.html: config_definition.xml - cd $(SCRNLDIR) ; ./xmldef2html_env_run > $@ - -$(CWD)/clm_grid.html: config_grid.xml - cd $(SCRNLDIR) ; ./xmldef2html_grid > $@ - -$(CWD)/clm_machines.html: config_machines.xml - cd $(SCRNLDIR) ; ./xmldef2html_machines > $@ - -$(CWD)/clm_compsets.html: config_compsets.xml - cd $(SCRNLDIR) ; ./xmldef2html_compsets > $@ - -clean: - $(RM) -f $(ALLOUT) - -realclean: clean - $(RM) -f $(TAGFILE) - diff --git a/doc/UsersGuide/modelnl/index.cpp b/doc/UsersGuide/modelnl/index.cpp deleted file mode 100644 index c55aa64159..0000000000 --- a/doc/UsersGuide/modelnl/index.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - - - - -CLM Namelist Definitions (CLMTAGNAME) - - - - - - -


    - - -

    CLM Tag: CLMTAGNAME

    - -

    Component Namelist Definitions

    -
    - -

    create_newcase files (supported machines, grids, compsets)

    - - -

    $CASEROOT xml files

    - - - - - - diff --git a/doc/UsersGuide/modelnl/showinfo.js b/doc/UsersGuide/modelnl/showinfo.js deleted file mode 100644 index fd8a608472..0000000000 --- a/doc/UsersGuide/modelnl/showinfo.js +++ /dev/null @@ -1,193 +0,0 @@ - function applyFilter(filter_text) { - - // applying a filter hides all standard names not matching filter_text - // if filter_text contains no spaces, it is treated as a regexp - // otherwise, all substrings must occur somewhere - - var is_match = false; - var search_type = 'regexp'; - var search_help_text = false; - var num_matches = 0; - var is_boolean_and = true; - - search_help_text = (document.getElementById('search_help_text').checked); - is_boolean_and = (document.getElementById('logical_operator_and').checked); - - if (filter_text.indexOf(' ') == -1) { - search_type = 'regexp'; - var re = new RegExp(filter_text, 'i') - } - else { - search_type = 'string'; - var string_parts = filter_text.split(' '); - } - - allTRs = document.getElementsByTagName('tr'); - - for (var i = 0; i < allTRs.length; i++) { - curTR = allTRs[i]; - - if (curTR.id != '') { - - if (search_type == 'regexp') { - - is_match = curTR.id.substring(0, curTR.id.length - 3).match(re); - - if (search_help_text) { - - var helpText = document.getElementById(curTR.id.substring(0,curTR.id.length - 3) + '_help').innerHTML; - is_match = is_match || helpText.match(re); - } - } - else { - - if (is_boolean_and) { - var is_name_match = true; - for (var j = 0; j < string_parts.length && is_name_match; j++) { - - if (!curTR.id.match(new RegExp(string_parts[j], 'i'))) { - is_name_match = false; - } - } - } - else { - - var is_name_match = false; - for (var j = 0; j < string_parts.length && !is_name_match; j++) { - - if (curTR.id.substring(0, curTR.id.length - 3).match(new RegExp(string_parts[j], 'i'))) { - is_name_match = true; - } - } - } - - is_match = is_name_match; - - if (search_help_text) { - var helpText = document.getElementById(curTR.id.substring(0,curTR.id.length - 3) + '_help').innerHTML; - - if (is_boolean_and) { - var is_help_match = true; - - for (var j = 0; j < string_parts.length && is_help_match; j++) { - - if (!helpText.match(new RegExp(string_parts[j], 'i'))) { - is_help_match = false; - } - } - } - else { - - var is_help_match = false; - - for (var j = 0; j < string_parts.length && !is_help_match; j++) { - - if (helpText.match(new RegExp(string_parts[j], 'i'))) { - is_help_match = true; - } - } - } - - is_match = is_match || is_help_match; - - } - } - - if (!is_match) { - curTR.style.display = 'none'; - } - else { - num_matches++; - curTR.style.display = ''; - if (search_help_text) { - showHelp(curTR.id.substring(0,curTR.id.length - 3)); - } - else { - hideHelp(curTR.id.substring(0,curTR.id.length - 3)); - } - } - } - } - - var filter_matches = document.getElementById('filter_matches'); - var filter_matches_num = document.getElementById('filter_matches_num'); - var filter_matches_query = document.getElementById('filter_matches_query'); - - if (filter_text != '') { - filter_matches.style.visibility = 'visible'; - filter_matches_num.innerHTML = num_matches; - filter_matches_query.innerHTML = filter_text; - } - else { - filter_matches.style.visibility = 'hidden'; - } - - } // end function applyFilter() - - function clearFilter() { - - allTRs = document.getElementsByTagName('tr'); - - for (var i = 0; i < allTRs.length; i++) { - curTR = allTRs[i]; - if (curTR.id != '') { - curTR.style.display = ''; - hideHelp(curTR.id.substring(0,curTR.id.length - 3)); - - } - } - - var filter_matches = document.getElementById('filter_matches'); - filter_matches.style.visibility = 'hidden'; - - document.getElementById('filter_text').value = ''; - } - - function toggleHelp(standard_name) { - - // check for the existence of the help "tr" object for this standard_name - - var helpDiv = document.getElementById(standard_name + '_help'); - - if (helpDiv) { - - if (helpDiv.style.display != 'none') { - - helpDiv.style.display = 'none'; - - curArrow = document.getElementById(standard_name + '_arrow'); - curArrow.src = "./images/arrow_right.gif"; - } - else { - helpDiv.style.display = ''; - - curArrow = document.getElementById(standard_name + '_arrow'); - curArrow.src = "./images/arrow_down.gif"; - } - } - } - - - function showHelp(standard_name) { - - var helpDiv = document.getElementById(standard_name + '_help'); - - if (helpDiv) { - - helpDiv.style.display = ''; - curArrow = document.getElementById(standard_name + '_arrow'); - curArrow.src = "./images/arrow_down.gif"; - } - } - - function hideHelp(standard_name) { - - var helpDiv = document.getElementById(standard_name + '_help'); - - if (helpDiv) { - helpDiv.style.display = 'none'; - curArrow = document.getElementById(standard_name + '_arrow'); - curArrow.src = "./images/arrow_right.gif"; - } - } - diff --git a/doc/UsersGuide/modelnl/xmldef2html_compsets b/doc/UsersGuide/modelnl/xmldef2html_compsets deleted file mode 100755 index 2659beed17..0000000000 --- a/doc/UsersGuide/modelnl/xmldef2html_compsets +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/env perl - -use strict; - -if ( $#ARGV != 0 ) { - die "Wrong number of input arguments -- should just enter one filename\n"; -} -my $infilename = $ARGV[0]; -if ( ! -f $infilename ) { - die "Input file: $infilename does NOT exist\n"; -} - -my @dirs = ('../../../../../../scripts/ccsm_utils/Tools/per5lib', '../../../../../../scripts//ccsm_utils/Tools/perl5lib/Build'); -unshift @INC, @dirs; -require XML::Lite; -use lib "../../../../../../scripts/ccsm_utils/Tools/perl5lib"; - -my $image_dir = "./images"; - -print <<"END_of_Start"; - - - - - - - CESM Component Models Namelist Definitions - - - - - - -

    Search or Browse supported component sets

    -

    -This page contains the complete list of config_grid.xml variables available. They are grouped -by categories designed to aid browsing. Clicking on the name of a variable will display descriptive -information. If search terms are entered in the text box below, the list will be condensed to contain -only matched variables. -

    - -
    - - - - - - -
    - - - -
    - - - (separate search terms with spaces) -
    - -
    -
    - - - -END_of_Start - -my $xml = XML::Lite->new( $infilename ); -my $root = $xml->root_element(); - -# Check for valid root node -my $name = $root->get_name(); -$name eq "config_compset" or die - "file $infilename is not a compset definition file\n"; - -# Print table -print_start_table("config_compsets.xml variables"); -my @e = $xml->elements_by_name( "compset" ); -my %a = (); -while ( my $e = shift @e ) { - %a = $e->get_attributes(); - - if ($a{'NAME'} =~ /I_/ ) { - my $var = $a{'NAME'}; - my $doc = "Description: $a{DESC} \n"; - my $grp = "$a{SHORTNAME}"; - print_row($var, $doc, $grp); - } -} -print_end_table(); - -# Finish -print <<"END_of_html"; - - -END_of_html - -#-------------------------------------------------------------------------------------------- - -sub print_start_table { - my $hdr = shift; - -print <<"START_table"; -

    $hdr

    - - - -START_table -} - -#-------------------------------------------------------------------------------------------- - -sub print_row { - - my $name = shift; - my $doc = shift; - my $grp = shift; - -print <<"END_of_row"; - - - - -END_of_row -} - -#-------------------------------------------------------------------------------------------- - -sub print_end_table { - -print <<"END_table"; -
    Compset NameShort Name
    - - - $name - - - $grp
    -END_table -} - -#-------------------------------------------------------------------------------------------- - diff --git a/doc/UsersGuide/pergro.jpg b/doc/UsersGuide/pergro.jpg deleted file mode 100644 index a0cb81e046e802b41c5bfde3073bfb5e1903ccf3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35642 zcmc$_cUY6bx-S}<3P_PEARq!lsDkufg#@L9CJ9C9Eg-!kB1Jlc03sm8gd)8qp)0*h z@4ZSFq}R*Z_nv#!T6^Df_WA2ho+tUfB;U+C&%ABk-*0XvZWaKP;1{4506aWAfcotV za5D{11`y!?qy6KZ;IGzLlLUnKZXcv1B__T7_W!Wm`~W<-hc}M5On~yhO%CoC+us-ZNo(FC+@EF4x=0hnj_S{nm9MwR>XXP=Sr0SRufDwx0PyP- ztkWFa0VU5qk9H8mPMOdADcmv$r-ui$Rh=_`pfi62e24#WOq+2E1CVAK$aZvwF`aJ) zT@N*df&hr@?1i(^9RNB|yGkM+GnRz9BGLR=x&cv`)CMp+zxO4$02@$?^_I^`x9s_> z!DN&wmIqjCv=Rn2_{+LU#*`o=NcTik5J(C@WqW^?hs=3(Puul$!Hub&-^#xKP}C%? zouxsl?}}~@uF2`J-BHGg^mzItQV9eU^kn?r!Lr(CgS+!QLzEfUx8mt-Xek`t(&eab zMIM6gBVX_uFbF$pAR%~*evd~Oe{bSE@|rfA2TW5H${V04r*)A}G0J@a0z$eFewEV&|BO@ydSbHa8z_Sn#!~?Fo(@PEJg%D%2P$s>ZJ+Kk{{gv^)^YOGi7>`Q%=jNNqm4c zZ(g6Nt%iEU)2+>*QKMx)P%iE1I$7$r5xPJ1ffiTU2?G`WBQPC=jxs0s>#QF@JWJp( zU-V=IwSFbDJeOToZx{Ll*W|2np+D(ht^7n~ExUHeAV|$~7TRG>qW7SD;iKUfJn$vj z4yqKNl@%Dm963}rr@`R-c>R=Xp;>T6rt?7{?^3|8=+n>euASlhhN?v^|uk^Xw}u;I*fGKC}Hp>}zzy0x-nqoJUneMjg@iTk$%BEr{^DCYvvwHrnaW~_=CP4`fr{Np=zn9Xc{Z;bgC1xmI3ZY z68!2;Ntch87*E>g+UYgE0dOvW!rz%Y>ft(5PW{{%fh2_7D4Fiy>VqQhgD;uqzK4H5 znn=74bxZ#cZfWHSdzE`Buv7FDlCED>^||r7p|wqkb(2w1NsmeEjpA#40}7)3wz`L% z<@d_=GQ(FZdZ)W*x}2Oek~iR(*i`|=03d(G6qsrOgs1Rv5;jqm&da*oYfa7?St%6t zsvK4RAk~nVnx+Q?;H;`)b1+j0!q=S!-FloX$qvfJA};%BdW9 zFN}JY#tV7RFa5)MLZe*3f{oNJfb>604{e1EUZY9PaQ|T=HkmvadIQ2i2b3 zvv2;)QU3UA2Dv=4>vH)mEQHaN+4kdM0<&E@9G}n}wpAcQ_;(8Jpmj9)1$LV`poTZb zf*p?>+;L|64jhTTbz;-hrSux8y5eq)SJ&ShQiR6MAk4PJPGQ3a~eORuClx2jT+z7O5yM$Pfg;35 zQw?j92eHf-o)oHblacbR-g*13x8M9n8pdpA+lV$^^(2o+n(8e&(;HbEHZ#coal~U# ziZCue()SxqW965!m;ct|wjxIpYiQP7G5l_H`y&6k5kJ2`F{(ho&k322mXqejSDehx z8|olPrReO0~Xbtr`l^5DbHZ}?4 ze$5Hfx#wZwz%yykKl)8UZ=8Ged+hWMdM&7xDUcdRHUqD)2tH38YB9{>nDorc z0&;FshA+t$G`I+}!wB^&?E$#~tTkec3>cNO%T5r4wYv)Rwf544$-)?WI;THjCmtODCI z=g`y_zbX1oZU6}a@>e>0H-HZ%ZVTHK$b(YN*X~Rd;@~#6-s%^`CYUzbE|*DCqSmUd zt06j6D2o48VQIjJGTxlMF?C7KulkW|1rbrAO?Jan4udRPO`G-I155IANd(1l*+r&! z9TV7x7B9^oTG|a33xW8Ac-DDbEN#j2jZ+>$b(Wj)HijWJ{bpT#8e>0sLMk zi(K)O4YQV};xT!LTMBAW=5c9b9fOYORrBtmsZUDH@@+Tze6XKz&ipu8Cc-XVU))S~ zHSi_r%IPa%Tp2TjCMh}CIQ~3s-cU9q6#f`BF3B48r{Adj8&iMw%u|^5h3kE9tX(_= z%LFwDu4EYNJ})NLCgC9BpcE4~OK*xSdwD@_LD*Z=Z?Yq#%=z)Dd#Hw0dsvze)y1Wf z8NvHp^1EW7oeB{Ca|)U^oYtr&Tg1DgT+XoJPO+%b9$-f?`o5ylQjW02Od<_=F%C`H zj2uufdt*2e0ZB-tkyPn3cJ+YbHRaXjIB8vE^IxG^Bx7*DsXUe20&y0L_Wf% zcb4kw1QXKd_pz2HT*}t-@4y1WUm{$iyOFuD)CX8XA3H^tfPl5}tem?azZ1L%BT%6n z!S^QEf2+Q?`#(t|48wl;S6K=@%Cx|BWH1y!-tv#p(I7ix&nE&Z)Q;k}G})B5Q4fww zJ>0bJx!nNnFTO6mc-VbLHRxE|{L9VxQ{+Vmf8&{Gm)*qpEDz`g;F2W;O#)tS21wrk z{0vz4^{@3m_6L~$sZOM-nRN+N>(~{4-Fp&63wBW)-S!?*;A+1P3#x&jSj_10BR?kLyMr$h^>wc3CIGbkl%JhQFSsQH1JvFJ*$Mt&B*llB^t)2T})$MpL8dz4m1!~0Pe zu07rN{dvPpC)ICn0JLVSx`DtWwx7wpTd7ZHB!zoh=pE-oItBRK@Yp`Y8l?(wb;L7U zjW{1?>)qA*SE1|2wG18+(M<}xWYH^=<;;Bq<4>XSE8;-rDFpO~;+dgU%i|1Y7~I;6 z#hKQ*UbD@h72lpEG>^siY{EHP0gCKk4qJr3f!5!G!@aAW*YDd5&$Man^~AZ3{F=um z>7H);$HnzJd5q$)M6?p6;gL`eu)714&Cbzr+kYP1ALt>MaRX>5q&WS41K`0gHl=e; zj-apco~D1eRjU}q;{G|}wLm5FQGJ*(Bruy-&#PH$rmAW3-zM*Hw}AY<#Ymt>ylhvp zCCqwJ0wr;v5qUflkb1IOJ0W!dNxh$Vk*>9qB^CIutE~6WORh%*O(JXl$EvS0TQ4TM z%E>$9_|Mdh-3wYnvZ)>^gNHuIKetnAY#O`z$}4#`a_)6~TqM6#c$rU9&BK)D+py>$ zCUw-pu;L%M_)d90{?n#zB#F{IoSYW~xGXNPKfeJOUel)k+mQ8wX8aHKT!gT@LWAxZ zbSl3GY08*=rAe(QB#>8N?SlJ6tmPi8nA{t{Kj~NQ_zeK^=-~|@|C0W(O(I_prn%V_ z=gJXIyMwtH-sZKd@K`7inqxl^E1gtuzv9vTCus}*>H0q;kN$_`=}~{Z`qerXv3Ist zV7|fWTCJ*NBB)wV@-ApP6C-F0qJOK2W^dHX|-E0X$Ll?U;yOZx&*0(sxOt>h23w>N5#U4oBhWDnFtoh8gst2P` zV{Fl$;DgK;J5GNMMyqR(H^LOID?YxIxm9<#+RneNc%Z?px~Ir&g{@7W3HM&mrO&St?v!2B`R)QFt7Bgn)D<$PQ$^6%>YZ*$1T{JOPKE`dg<^?{sRUoMTerUH^?K@hiI zx5t4H@jZ0@eW%W6_TOz34SxU6M*HTE^KCDFt;H$E-xBsOJjOI+S5?93>UMr|BE<>I zX1WT-g)QEVP@&(SGW~HK9~mZfvf0MRsFKv<&mX=m(>hAtD$Zu#MSnOcXj<3Zn7^1R zy8%R&9u(XF#Q)wpuQgn8_`^0yszJBfzF+S$!y{Wliu+SVtL+EICxJRQfOogf>wi~x zP^$3@!R?ARIvI4^8Bv3X`T;X#&BfIf}_siIs=IA?m~Np~l8&i)!i*Puku# zFFURp`Pmv-9fJ|V(x2{5$D?K9E=meCDRLqV`V0;<0?t?Ar;cuHuaa$WN&b-RT=h-4 zg5NoJGg-Wj3$SQUtB$3Jgk5Ttu2BDt$2pyB0>euf( zu`|W5FU7AJ#&Vv8Exqzi;*+XaLMR#zR$&j%nr)Vc)OP>=LYRC5zTi!jt#6b*Kq5|a zwiE}~3xkoUp%wQOeut{NX*r_h&+h zm56l}X+*KH!R1;aT(Hy^5ESCx)e^2$+}KIs2izvTvTn_Or~mqBY%qEX-lrDDOorKl zi^{4Gx=IfuFHPW;{g$h-C#!?Ta^)EP5*!W?^e~wW#dH9$|N(~j@A*P`r{0NS3 z^lqz-Z|Zy_I*nU*k8Ndi+xN5EyV{0?f3@R&yL8NbT80<2NezHu8;uzV#Yxd$MT>O2 z7G5&r$T?@SkM7j`Zq&$nH0IK_w1`$I8aAB~qP_V=&1zeul+A9`P^ua32{hyj>>pEn z`+-CRX41bO-*zf3JE7r%NmCX?Wx6@|V0u(pN9Pgb$9BFQy1rJ)jAVOou{yEMK}dJ6>~&s_6Q z@`Ln3+f#SS=|nu0nwj_rJKk4>AxZQ!e++r?d5t!|5eiJ`er?<%!pot4Fq!#)$H$QJ zU>H?N37_Q@U{m#b98~R1U~}Ysh{P^W%vK$c^`Vx>=-|IAJnRbHH)68zFAB*D+OJ0O zWn*RO22iB^9j!R?>H@_ENXaB zxf<3^8JzkXWi8C1&Zvdg)@pd1G@Qd*`VMe!x%UqC4)s8InXjxT| zI;V-O?w;4{glNhxY8j$S-j$7Y5@E z`s$<1TA(eeWAAT#uEF`aOAR@uK6!QfP9Qm8;kMBYKu+#KtvR+n@1E}oQrwnU`Q;Cc zR8qh97F^^J@#DNV`S~0Ge@}LO(RCKR)$Ld(U?67p1#bjQpMaABcGba(I5+XC2Sq7e zm31@e0zE3P-Yps=jKj3<|4BJls5IVV7&8+)VpzRof*^l5IaEMl_IfJ~6Ne`NZe0_w z`o(WN*fIUaIDM4=)t&X^b5p*PpDBzEmdqet z;B_j@8aPf?Rwu&nj7@C07rg@51bdC^s<(Ii@fvQ+B( z7hXot-l6{jLby}c`6x7O-aFDpjGy zfpG3uOh{1Xnj}iBjl0%9~fG$L! z-H>eqUoL_D%jqGZ-{X0svR$ks$uYHHMK7$07yr@u)k*2RuBk@7LcMR^LXUvFOWf0C zayqpD99wwsNR;p*XGpOEksX#(lKy*yx{l@Vujr>I3d%z7b;bP0M}(G&JmCp5E@}K- zgKomXUo+gJgrAdI%O#CZtJNOpm!bJ>r8bf9o(wyZ#d^vEe^X=C%IPL$tSsCSLzOIx zHPI;H%i`(@wN>0}xNO>++fy*F(2#9EgP$^)8oGC6o=`PKW3aT&w$8RA$)?U~dk4-P z!930z=FbOkIhK;*#ME;Z;(cFSjYBXgmOx3_UV1tvur^JOm=YCoI|CrX`=Dpy$$p`K z?+>>?Rh!eA>Ek`g&Po`=2@Tp0UiYW}Xnc@+)1RU=^4wR*$m_!soD9|YtET6-Xjb%S^XtO#rucXK#s60IU3X7g^6#Ztvrma1*+{kUpf%!9lskwJ z5u6;@WHtn3k<0rn^JOyXQKe<9#0i}9=y}Ioggxmm!bv0A4)&uTQ6`zsoJ=aITB)fP zt>I2bQBPs9Qh6!GVg}l+mcJ1SP|fi9(S(T|hOxKtE0T?`3nbQf-@Wwy!>AR2ta{`_ zBsHYFXa~Vo?i5-QeuNrQxLAdgFHFDs-koGrnO=^Is97;IbE%<^a5YGo12dl`FDc$5 z)&Wo|%v%Y3ml>YOSwpPk0JWdVp}IvPyw0SA0Fu4i#CvHw3}gOTzb5&VzD!^j@Jy z1O6J3(UBxe;84@Wzmj0Ouh9K!{`yA4_7zJT+E*i(RgW0I?;9ZJ&PHh%ss^=JDU|F4 zY%boN6=?5~)ihbDg6p86vv0+IpaGP$lZxP}h;4NM=VP*9tqQN)9s%9NwSMbns{Qm} z6|Ukk$HF8>WT%oe_+|KKAGsw{zjdIx=4Fy6S6fNa^W4L9St-|a3nuqbRUW&p-QBA_ zpF(|&(4YMcPIXW1*7{Prx_RWjZhD#A#;S1x2L|Vd``5lZ5i`H2u%?=#BF1pL&*QjH zLrOG33yNoY3OeI&6tuzNy~qS))3U^|KBI^XqKAB~RWjQ6p_8s+Yc*$RIHSkoE1FOg zWnim;W|G^EO*6K`$agr?m*(;nT)Zn4eJP7XtmL~z^ydcT}NkRj}`Jd}DVmh}w%u3cO} zY3EKf(CA@gf^S~*;T(53xoES>-ORo}$!RIf`~?%623n4It#_$Vv>X{hRRz)nZ(<@# zM&!p_dyI*JKi%x7bdtDV=iOVZKe1Jbg!vXoS_@gqd(-Ocyw zX45a&qh7l#Mi}j1_-k;(+nXqyq*PqPiFrZJChCS(jt*+p6^B_O+jqkyG9za**<-xt zncA6a{mdBRBfX=qaxO4*w)V*+O~CPT5fv-+z9H1Ez1lC4^Y>Wm0^B# zI{3)BTI+-=@QFu_8+7AD3lsiDT2AI<|AOpQ120y#g!}X8kgl-xH}Sqiwqqkc%+@!q znqvrzM@I=XNz9`I*s|GDFf90QfYl|BTA3TqV`@PwyO6#-(`Q>^E-t3bAEThq7?)!c z-)wJ@zW2c2pMNd6_(v zLb=pX?e{pjc?ADt;Hv%+TX4hAz?9;L-wg5gF@-V_@(-Tfn?{_cdwYQ+$iD7=7|CRP zwVNxew!QP{Z!U6bIbCko%UE)JD z`6wYuqUYHx)*`_S@hL_Ev5!Deb`t<)kE$MjEcx~wqpDLh)(YL(|3-t>66=O}%=$pX z5umG09{GJy@x@rtMvDp#YoE}*Gi+4)i!Z}_^u~59#3V*@zd|Sq2DJ9}4N5d}-gJG@ z-IQEd?pG?4J0FjEMt zKEBV=r{IzNjW2HgT#L~m`Blu9c^LOyDn;NNHisPhy;LuJRM~BI=@T5f`kc}JuRo{I zybt0pT*}qYMju#)N+|9B#z#5^*L8o5 zpluc|uC|^7{YJjnS*{Zu;m6Y{#3h+;cZ%0FJ2GW2uYVdr|JQ(S?D|BW*z~pVNwgc; zxvq1Mj`=WEpEW3U2&t~_35L*6iin{-<(vBaWgiCuuR{_~r+-PiT$c7W@^`c-w#lAp zxbEsPaAxHc?@h~!pEru?v8Yz$Ud4VU{o&{nbTZJ?;w-@SpdWkwsyI*W?eSUQdS@}| z&`X`WVJY{FmY^#BJ0Dy7=KzrVO2pDuN~vT2!0XtM-EAp{J*Y)@ZRO+w&m2o zbi53U&k6DflWn-B)`?J0MPQnMqma%NVu zO$g&uAK`B;woSl8kqICOGMZhXK=8gko|pQ|+UE}DrSV7O&+D*`6;sfYH4PV%*Kj6c zRvtV^1P6eMm?H>J^x+Y4SH+j|i5&y!pirr$@%CCIn!Fh0nAh<}w+w~LKxWo3Y7^Rj z%{r@OSuv$)6-tNFB5nZki4_`7Vn?}a=-`g?=9XRlDj@H$vnmAt=SKMiEkK<9n+IQj zMgGc=`Kx9U^6?~2=O)tFd8UdU<>4d7QmcIAd$)uU=o=OrM*^x_XF=fHIq1B z!yRxG((Xsw#0s^xwdd9mx0`Etg59xoeB^Dm@f!+SqxY0z>j}Ub)MwYrywhDJ&s<() z@HaRs-($Y2km8m+*)1+qVQIK`71rP*Gl^lsHAhEaw^lc$mZ#In{dskgDJvUe;;BMV z6(VvCdRk-H5}uZnk8h5*?k9gy89{6I@Mj!*fH}@CepB9-fG5BAXBTBo!5!TrncPoH zo*T^KhIHT@4O_1ED_;Vc=_rg+SZE77bnNmi0_HkvfFPiNfJ3-p&v)yw;a6ot40d?j za5kX&Ip9uE=`7IXiGDM8UF3g3$jQeR-T>O<2M|q!K5HfNNvF=u5VjIq~p2nUx|D^4!z?n{3r?@8EIiY3>G&UNf*;}FzHhCw0 zAIDMO>z;gd5+BUCi{^H>8_hX0o^?G$Behm+ocazNxp8jkaiobVbVZ=c*P2#A;cWhP z?pZHf+NX^mQ1V0F=p>r_@3k+2+AL$O_+ftLlsgb7mZd-qWXeOEyo|4X+4l3p%B7d~ z@C_5)(Kc#Y4<~6iP3JTQ?$~O6)IY-VE+rbEm$9c3q(1iJ+;CkgZBw3EuctcmakJI* z{pu$iFP_y!Z{%BnWo3UkEyU+gXQ2sE&i!FWrtj5-OA@_bzHA5~jXDdn+%Ef67@g^3 z#NS!^vKS0gE|-6T%*o8=h#8>!uk`qTR8AWOdLw&wR6P#a#t~?-V0S(0lGgWi7S|rp zc@KFLOHUTx>vnL`!V~2zSJfrVi;o3ca%WH`R@Fqf1QEpFeoD&lM;v#)FeCD4G!IcI ze0}W>Z|78>#_$ z@L%<;WNO(3bx=?3I9QD(V*~`nvKSBUnpq{G_}?U8Nx3J_5=|uEw!)9?NNPJhrjr&| z+yhs+k3AGJkXZqY&b~vG`2G|HfAwSqA65U_JO3>DbXFCEh+K4vOEKK7i;*3z*&ld2 zIk4}f_qXrGE8KLlsoKdxT@g>(TZAijiHE{_|Pd?-H`&-Zf`PeIJ?edKx`X zER?`zuMGA&_&Pbj4BMLK(4icEsRSIbvVs|k zsR-qCiv8gq0RcA#1$!yz?PG<*;n_z18paOc9`IYdQSO)4=GT5UlKF9qVk>*a;Jzc~ z`0un+f8*Z@!Goc?!tAG3?e|A3lE@dEToB`u*x(7?ybJIEG-tM5lYg zExgD0w?xdEk)!$Dxx(lM`IW$oVv44(FS{1nd{097`&BX%`i`AQ>&w}yG*r9D<8w3N z_RxSVWC#(5SbXr89r}6e=K`SkO-4IZ60SOf6G&j0cnr{EqHV?1rE&dQV_HW~i+6}1 zHQP(+(=6GAkC@v%hgbOgqWM8!k(3}P1ask`4bi@H@xw4GS+NCIyt#3jYTRkM?J+Y{ z)$7RyZDi9HcqHqo#%HG+Y^@++tG(MnVW>y5x(7BM3uq zq4-H;89)xlG3%g~)ro_OUi-zEsM+QL0ls8=tNOLt;d5Xy}YtwH27jgbS{No=Jr~TqFBPcQtac}a^HAugJXWsO9(ka?Y!o!$zfg*fpy!-$1Zl@WcNRasD&OIe)w`EbV=mb`Rz(abV3Vj8liLmNDV+qvUDKv=J2FpfpE+ zmXU*{>pY5IJwQ*MN1R3_@eXk+XVE+{Oz2~TV|{tzG>OinDRpIb<$_bttoPib*AItY zM?}t-uU(x`{4~vbY8>zHKeuElCzV-tBIEFz*RIGw+@)cbKj*f1^2h{X1Vxya=(^rh zKj*D`FPJ&`Z#x)*WibxF5b*^KMHm%SR{+J0LUL2SX#eylFl)DFsKxOpyj`Nm>1k_u zJw0E9ZFC(x>RJ6fO3eiqBR=*duSJ6dw#Px3-6r;XZ+K>I4DvMsCwKXp%IZa=Wql8? z3r2C!Ly;q7PYos~7rte@(Q-;Jc0kW)Q6GWu{az2wOomM~N~Ce-5*SPrAf}98dS_t_ za?`-U_%k}t^CVtX69qa=j^)L+bT^Bi^nn@v365`HnDpCse@){br`Zl4t?)hZ=%Aq_ zN8D5YLj*rU|Ji-++H!g@8#^a#X-WM={#l(XxcT~ViEbfbJYX9?SPw9u{WyTv{h!FW zaqBWEw@R98Y_@cXXYgXR;8P`s&GR&$weC0!x?(hA9u8I~L;>G&S(Kk=%AFoatLoQuwKi_sd8}$(oxAm-6dD(_ct)QkYrYMXgjJe)py&e_pt>Ki| zlb8_d(ChrPioLQ^_0@g5ilfSr-`qi-jZd8Yu`kW{aAcNaS{p8SA(+`xbMjs@kSpHk zxg;N{TW}38IH$(>cTLIO&-(H&Fhh?{_%E4Gx;q1Z(E|7-U*|oxo!grN8>{>HTs^wi ze;Copzwdl#p!j5g#Kc;#DrmSuqk$?I?fgm%m2|t!%ODvE=UXmbxy!8vZR4c>$j?H}nE&v_ zK3_j2pLX?z@Rcann(8|87eLHw^8&Jzx|@EFrE;oJYT+Jj`fjjiZ;RRDj*@9(nPPFh zbdYXi_u!>NnF196NyLFWU{a3A{fafGLy-&E&@cY5kzX<2MbHCw63D|l`>N!n@3_v- zI1T2f5r0;9_@S%aUh5$l@Kg4AFr=0}_J7SfSG_Ww<(N3tp37E?d7|3%ti?)XBxS5e zfS-ZCT9Ma<42R-~$AiF(2rN0(epcz(j5dE!yN`BmdS_L&Ch-=AIZob2aUCR2R||)5 zYUqC4M51{(p#bWopo@k2q`tH7*~ZZ2`$S^mR_F*f_VwrKKFQ7DIF#^CMyU%3#KBRF zr>0yHn9~HsGBpri+6gGsSUvx8GQ+Y9x}yS0+h4$3yb>(kmKE{;{bkDbU(zp%kTK>& z5*2HX@6shzRctFU$s>w*3V{RuRJCgV zf;?1n&?nH~2sW^61eZ--Ny4fIMkC^mVGGD7oXKj3dWR1cQmF88A>RMN;rTe#{&@a1 z=i>Bg%7gy>3ye^*#b;@Zbl9`LSlzz@h6b#TwQTWoc^9iZ9u%A^e1f$j6y|`f62WE* zmoW<%VP;4EmX*D&hG zuuARjnX0mVAG&sfrLk6lbLOb~1sD(jA11Z`Jx80wps?F1Ut%kgPmd?^u|~TQT4^Dl zdaGtq49=@ITS`I^i)>1lh*)Qpv_@bXzVh?-EfBYxt$G?liVSoTg@H zYxOE{>Kb!7@NgqA%iEXYv1r>trFY+omZoYk-vtF7;ZcRDiYWNrF*WBa{Hn4%f)Lw~ zjF^GKFu}kSNqd_DJ4wHX^^2yggeETyn-q zJe79IdX|t8=h^F3>^{w;09JRGvnd=?#^Tq1?SzUWFxA|=1)hv>E-GDXe4lb}ccrr1 z>S}7xoy3`6s(ChGra`7ZilwT6MepBV1#@Vb$30BX^-I`qD;zaa)ZC& zBkv*w>wjB)yiGxm^22pXSQ##obq23~UUO~rVzC+(-L=GWy7O8&*jYN8q(KKfstS}< zK3MSC+wabgTEfXH`UXUetwcR)G{G8J@rSOfgK)k!Xp&<%Bej(i72T&Bz#-?GQ%Jlg zq%?oq|E$y+XyL}xk!@u5In`NB@dU+LYAdsZ)T<8hG&Ctt*(x8q&aD_7v2~X?{4BJD z-fb7EH3a!MG>L6hz{g#~zk8%lb>Z5zoHnX^a#5#?2L*x$i_*@22bo(k?!FPBEtR@T zI!E*Py!bCb<$pb~hB7T!O?ywH{PjsE(!%;wW3JWR%VVxaw(L;JQ|wzYUK7VHeq%G* zHe+!qoVFjfQV#EZ*JUm3EIgEPd;qhrC91Cy3HB)I=fB4^g-oabLWJn zIqlV2WWvMS>f1lqjfMXn`?vxmgqs!Fx|v4|ppR$I(1?`*wNKUe8RrLR3P4ybvXImqAs)sZt*l}Ah8k4TZ{%v}z7 z7dEwvnH~|D;eQTIVbE|X+X8PRa>r17&c~sgAo+U6qcL>r=~uQ8mz}gnKdf>zrCKz6 zCpK9$@^vXB@)8H_{-7w_K=MZl2Z7a?fror+vwrpF^bRj>1MVlyXj~sdA(R2{Jx_Ne z6&jyX@5P6|#is>FaiIcU@~^lLZvdV2+#rYx%Hl-;3iw8B#=UAL1ii8~L!xd5A@Kwp zi0f}^Q>JT0)byXFF8T;cy513#dkRP`45enq$aE|}&j5e6c5gl(-=TQ{X;K*Ls9zf2 zr3uM0DfkaM_V5`*KZk|Kv|$ai4Ha({laurJWO2Y|uoo_TvpK%<_bz4~qE5(IRM?jO zCeFRp`ud>H$>irpiVGG6AeCJb4JqV}J1UY4!dje>*v6Lr2(QlBc{@ z0z_L>7_G>JJfl=sdlxk--x{j3>O z>$xRsqOqGN4qb(-zB8e0uY(sb16IG?(^TlaUxZb=h8OTnb9ZyioUT9kGEDWk{>Ou! z?UaGv_lpI@C`r_HJX-Nq&eZ>Seb2s7D+w`!^C5LzxCZP>X>gJJ_qYb$}+i08i+3@LIccNKW$%6I|W{}hhA>{y_6 zHB}V>PB;U{<}?&B0sY;89k8AK__XijPI(G;{2&i)vVO{wyupdT<;@&_2QwPwnm))d%Two&#tmhA7e(T(ok)ZDAiZx{{s7Q9 zz?Q5oiWBHTLts-|MGMSz&NrukoAW_W31R>u4>Qv%20mXZ&P zUj<)^e-kV_zl`JL8P6=K{`ZYrpUWqk=~YFIEz2$|_}vHRo!ba$iaGJxHZmI^GG${K`+J>t73VS>tEl^$x4S5f7dKxEN(nGBKm-#bLiYK9-I z`a5&By7)CJ20yn-k0>wt)drr#ZJ4}lU*YE*qd`oi=}PH3#8%}W`gLs4t@nd#Ea;-5 z=QStOQ>n7l0@gnptB5U)Oo5RhDV|gy4uTZ|1?PI+7|YLb^so7he9gsu?LwO*KiTud zF^p%xa-~(SU=B0KL+>}U4ECUTbgSbpx9)`|&J}f6^&&4ZGa(J0mZF?v2wF6^=jH^L zN=)LnVuSJjd4d>Eq|R+j-nRB-wd{uj<8U^)6%SeJyETn1p(H>ac&jj^irEp!5iFt> z+2#wuReLW<(py_-#Lmo&i^hjpb-*Yv^ohnJRLdH8uZo;ic>o{FUbMk43*JN_mU5^0 zqxILW*|1V82`@kSFNyBb!%u|EpP zLO$-XVdzLi0^792b7YP+3!iV8kHgd23@&4Y&5a)jZwUKyO=!d5TP~iV_=>VHZLZ@2 z{Z0+89nb_JdmhCrtaX3uk)*(QN7YBQ;~X}y7w&Jb~k|V zxR^+?MxyeMbkig+HDt|w?+Qq*IXoIKJ}`)utMXR`=`HnFQN`aLiFOQ$_{bw?Q#mL|Aw_W9eA27-~V z+z8!wo>Dzgw?fwdK%ZQ{hrbayeRxUhR;7x}zplT3qShs7Ycf6pd(*)if>+y=wg z6tcycjkIq8gF=G{@sq@85P0X5_bxstKycrr-XqGSJ?)-$Jndio*#&%N86(qC&DI`l zOz=kV)#VQ=JPyY#53E6EYw8_+#r(da=c2m z74~Gd8ss`3H}h1u7o?86Sdj)MXTaCBFbwbb?G)7Xa9L7ANd=bRRTsC{tzTM4oi@LQ zEv>|#!2PF>e`;b63$PL(Y{x1&d4m5}Om17}yvJB7;xt-%8dW{}ieONA779t?=Rg$! z6b<7AMoLH;jNpScQ!86I^pYB1LqEo6Kmb$??E2IuMUB#rzN#2h>lrSoJ=!mJXtNSD{f1*4c1<;Jbmh+|c*h|i@_9EDF`cgiMg&5{ z?ma30nz-xPGfvs$UD4&F+UV)v316A^G8Ka`V=F)KRY5J9Rxc{qm|E6YiZN#p+ z5*3SH3M5o&NPQdK=7Glv+?1_89^@{G|87?K<e-ekLiZp{;p(cB~x)O_483)Dw4;PXyWbW2?|7G6N6aI=`P0)A_aR)EwnepoA(yV8 z`wN8q)ACb{U+7R%N}kE_&N6I1vRuz^G_-%xYKcyezJR|2`}5Wj3D3QQlT}22nLrnq z;W(&lNyr~?;U!s+@7JAPj5&L};c3s+XPVug?vdwm&b>Y=)9dcq6#r0i!tKdK|73D5 zRZfZhMeM+9f!b<9H2W%nWjs&X{|sRNa4hO)x`L}|VQ~18=|l5TCtMT2)Y*uCNeb0g zttgP32LJpUsxg!SHU3SLH3b>!#vY)y{(8@k=JM0h*Bg$&o1SNqp=l?D9ifjTyl6fC zBs`&1E=Q{WDV9j6tjZ*`uG|${b65v9rMNV4!=6o$FaO#3^<7gg>ibIlNUEkSrOhe&=3f&L4tIn4Z#`-t_?IA zT!I953r=v?#v#F-;L=ENhu}_bzjyC*&VKhjweR=+Tvbn1cdh4{bIm#C7-OL&h(`TE zn@IFY%K}iEr!vP>g83}3c$$Ul1@70OdC~fTbgV3HfiWu}SXUWl)YJ0b&(LT6I3a}B z^5JLxgI4z3eUE#wD0ZXe9?Nd?$$p(^FedJQlOcdu)AqbNtsutVd}w-L#tP{#?A+iio|X)t$J`8N-75<*s#Fj7iK+$YZ> zBWATfu#+{IE0Ft^Jke~Ttk^LQM2b4@aTJ2z!B??n8Y+p~r^V!pgXF_ztM}|y$e+=K zebEKCEjJ+^49|omo*sIi^PN?oGnRxh>HOk7kO@xR9O91b)`Q9@JA!2T8MYs-r~mx7 zK~0c*PJ3Z*=hZH|n{`ZrUcAN{NDh{~&wyU=h`!-6GaOxFY1D4_!${*OJ?w68nvzWz zB2{TW_>5eMu9pW1(e=921xehS;}Bv?qd7&#I#)G_LI{|`*oj?jLA;~K{ZgIE5i`p_ zU}Nf}Rc5Jqm>cJzb@vwAY^F`X93;`i<91sfCW^=b@!f1}Y`H&Z(ImThtTvF)yxHRT zwAA?KDiEYqg|J{v{ygG-IDlCyJ2-pC&mWL{PzQW$71!&ZnAbt`t@Zg5WDz$c@ z=XzJ3Jl3{CmC~5t3Sz0cQR~HsxBMMiZd9Qjd@UKX33w+@0>CdI?rW02oE) zeQbEVKbUmw7=0SBq796D+3~w1w5rcm)SMriKkShy_(|2qI#ls$k$5KFlAHwKb^@dYJ)g? z4OyyvW3fJaa4O;QJ#W(y2Sq<@ok+|qo#Aorz8eL#wbohkR6-<`a~iBcah_u6RQkL0 zb3byf9z_SdAb&BH$X54%95-&t;m008Az{RtRFMI zFm55;`bdjYHipFR*TpYZ_QHHVz2sW0#N-{XoV3_=Apv@CUv_J0-W$=+6B|>Htp8Tv zmVZ3k;^S}|p$zLg#&Tf@3!h$VBAErUH+)enrJ2oNi4}*F=xyCa?uEng!JIVlUuIHN z()?`PloIcYIMD+Hh@<6L<{W!7WAm4Ss+ixj(ea_>gH>|#1uw?R$1yCSgL4#gV8@R% z1(|v3d*`og8h>xQKAgIz8Vr&RpY9yNDq?&lj@Kv77Gw6vEx;E~yQyA+ zAZ4NdnX~sduNHO3sZ`c&eI~8oEViQ|52KnniU_-FI|y=)1u6EY<&bd*A2^ zU&cuX`vW@^J==JDX!Ju$Goo{_W z#40H~6Y0)N90bT(G$a_P9V{d4ts} zWtA0JPoqO6i< z;iYtexiq|6yx|gPGPNEXNNwD%j~^6Z{oYQDxw_;9Y9Bh-WFqnLhrv5CjfHu z-u%V+k~p6RL+xGKeTV11O{7?0Cr0n<)=odaQo6yf|s{SM^jia$f2q$c7x#Rw4$mp@_9z!Hfl*I>SMuXshNsa*%l1^Q5mg>=_qbtLSD^#&2c1}+Hl zI_VcJX1&#GmS<>dk2Srx9Bgrn8c-mglm5`J*4A&vw+>)k`l4b(-L$;?A-MIVM~d{A zdo=P`Ny=HBKfWUu_&A7EV#cJR*iZiE^P2H6453Ry(3|e?K8eDQaEp=yFv%@^ae8mO z?xpPO#IHRNdUg*MF{mBN9{nw|=(%P25HGKNMrMLAa$LL0)4ltq=$)@@Vv^R$F>IS) zv9{-=Jx=A!J(p^aqu}y`isU3dZkEK0Po^!ydbQS zjX=3`s99ATGexUxQuZ7SV`};j+7a!J)cwuOe(AZD!&T>V2dC!Y>Uki)rD}S_@lRrH zc)Ptt87(!6lXYP2(^h%G!7~I*VyRfTHam9o?NATwf=9=m$kBrw8^z&UduuWn7*FpH7Gv`=Ga*sSWPlzKwdKw&rBU~3;J+;yfX1a-*8k<^;3}x z#HK#I6*qbskhze9XM8l*&Y1e`VnHfw1{hC=YvnmtWLl3Ni+zpX5)o65oIMenx;FP-2 z%$RM$+|WZIcX+~WJJ~NmDK5IS%{}UcA*{&T3dVEde5qpQUc|hv9H!m-v?hg#Q9dsY zwTmR_U)1#Yu$8F+?F}b<9V4~<~ zzIP*!t8;$aY~fY%Z?%)O+vpcgkqGaXl)-5g0zrh-vy&fmvWBJkOor6TZ_DNEG0Wa% zD=@NLx*uSkWA0y9DJx$*kX3;ij9Q|elGRIv7HlfZpyXvi6w0OoXMy~4@*uV9yuxjQ zGVjKxp#rDLZaWRS^~Qm*+HeIUcI1bQog1h-(_kF1AXkt|cHV8&O4w3DM_I8nih(fa zxShb<^`*m-Xvj#tCpes|)E`#fYf=@@v~3Jz@7ryT+vue*trJ;OW{p1l%n~d8=4f#W|w@^0)ekP|V)A8pykc5aL%qtbl zh~00h*PJhgTA5e%lgr|k{-A+a+&EDdtZHB)#wjw{Vfac4$jH9oJf*HFS+e$L>hPfv??QLlje8Nw^gczjf3zlbbGRAMMThHU%-ra|8tY4h6BSE@M)4c1OuMpI z#HGLeoAph8N|1u}>mq}(x(7w#sK9}^oBC9v;QJCslq@(Im2Gx2rZvQ`@AC{E2!H%R zyTvmtQf*s_aEbqehN6x&n`Jh2b|&p6-6Ur;YN7PLI?8|0oPPa5yNlpWh!QPhzO)?s zgI50s?ONMP?U1cU{vls%zrB}psLPt&Ao3!y{lM9I*r(HS`EF<5REavQ0ZEQ=vmIKO z;Pbr{6D1d$){nmpH&{(ueo*vD@R7JQxg9V_eVDX#lTizVHyzY_zaJ(KEorIM&Jq+a zrhp!K{>Wtn{5&|gW?kOB=H)yOOlj}d68RVQEWQ?C{&1Vo~w9B)S)A?DO z3&>BCfJA4X`c?2!Jj6OLoq)^nLX26ssd^4B(^j{CNkLus;6$o=Qs3s~K$USD^KcLSR)sj_lw=sQ$zcuE;+%PzTza?m9`oZLA= z3dTC0v`RVK#Of6&|;7da!UMAf8fJ^;Ib-p3e~y8*svKQWHhzn**2Ne03~Cn=m{jCxE( zbxadGo(DX1<$l7rpSmpWUr*E)i95VD!BhH>%2WLw0;@au9S8t*{ro>fg#LOg_+}*V z)yDVOveQ=_Rcx$Xo!uIqlKP8uD#m_876K=lsmjt4id9rbwp>*BBqJ5mL zsVl%bKrNlMp*b@GZ52`p0VzilV+oyLWpRl}eHRf~Y{OS67q2fqLU(O{Wjs5X`gT}g z-ak5<>YOAp7oFrx+%8WKHR_o!pZ2f_cJI$y&J8S*(ak3_HD%t;D9y(D`3KEq@82@5 z;%U3Gh1Ff>aE5GNaAQUY7acZ?Zx`CF92vxLM? z2GkO8y_u=J$btKU%@a=o@ut$+EZ!yYAMBKtArc*MvoxzITTainV1U@XuCr}CeinWa z8!g@^G%w|^v;P=z{-ZN`rXg?aLx*^vp`mM_Epa zF+!Onbo*bB(4Zu~+ziA?`T$fN*);I(u`CpY+h?LzQMPtpP%yUH>SxFgmMIUVFZxjR zX*SqXZ~#CouxBDt#t+3r(a}$Wd`Sj%!MjF~s=1{&c#pyRUi$Q8WZ8Ax%X+;lkJ9F; zMO8>Wm8C6Ok%meGMR zM~23*iz;ZYZIS6cml+eNiOv#?>Q~~HrOt|!emw1srdt~?J1+Gg7%0Uti zFq>`Z8*o^al6YK@?4^kMPO@3v!QZoKN*C$1gwD=%%u(av%fM~hOd*b8J-{o`K^7NE zx5J{Y7AkP{fu$zm=I881bpG@T7L}apcz8?f&RCrf{`k4>GHda5{`H**sZY(Dfq3rx zWs>8&TX%SK50ZT=>FWE^LGmDZcm9XfQ)~Vb=QeiVyA*p#Tz@GTe;oh^BrlJ#Iks1$ zRbpP~{j$+`Iy`&i9b!Jqz?@?aZ3$EsDa`d09Cgr-S1LddnQLc)vW*eZSl;Cr?7OIQ zFyJ)S#3jZ8xdn5Tx|Xfc!X}H@t8XRh7!&7Jb$X@B?p-(Jx=u7POs`*3X~8+P&aqR3 zZM=V<%m@zJIEfTSW>+pYffW)wDp=^gBUj!_^t#_#?Z=0EWhw_C)(1+$EbBFW`cF{F z0NLl{(N6}l&X~+SY8{_1D?T_bzoRJE-kt7$@p!1_nVD!JgN@bUR3hF4eM@aOV*eV_ z+VLa!n4pjm8#0b70hWJEulHrTQFe-|r#FEfBLa|GGo!1O&DZjXt=Yt)MPy!GPg3`t z72C6H33;{QBI`?{3L8w85BgKRB2qmX$;mxjo$OfH@YFE5Koi(+Q@+>$p*prcFTfwP z9`?_tG^qn6tXtH`Ls!}A+xHoK^zLnZK}U{jQc+i>iK;8lQn2^quQ05rB7Ly|v@Dw0^kKUwtGaIKPcbSKmbqR;F@Ml%Gv}3K zJ-?o-+cdSz9eJ$G;MP->Z2X!i+|{m@nw6O5?dAX)WEhBR&N*}gK#`jNxm3+d8}=O0 z>bp9{`*D(gJj2~Q)DXv<>fuNlq+Jh+C5jh3@z)r5B(7&$?EG@8O zk0bF^4Ie3u6nM%l4F%~bAE0Nz!hZ#~iL;V<_P z(()Z&jyCA|Rhf^Jh{Ori#n!0jW~vpl`(h0}OyA&Y8PPZN66oRDa~O1J`f{jn#mCM! zzJvN!KH*(ke4b;YVU5L!mBS3VZ@%I9)Ycn?JWg{=e4DCHVG}rFig<-!YpEwB7TODh z6YJurOA8R?NU9Ug6vAG&k<*;%{z}?+x&LULQX^o|-f%nqdTssX6!2AbI&U*}1CV4%CQ46+fzqE`SZ1ksk zpI5?0G=aZ(^d($2a>z{Aapk`E)w|F+HLvl6OMB1OphB{zIVDOI1f0D_8=APHIR}P; zp-_XGmf6hT*a3qt7@F$I09I-b6N<1(cYb`K*sSVGv^n5so)#qY63n|2R{c>YBfe`6 zI19`xJd`=51wzNYs&dM%(EL4L4S)Y}ow)ZzbYyPVVlbF1SDadkthE)^GX5Q+kwAbW zkNI5IAI~wIV7stuWdVL&?%1Y_V2=QsYHXGzUj5bxkq0|qz*8-FmYX_q`Klq+?eJ=) zR2Bn6xGnzHEBLf<@1Y41r!jSXjjgTYu~v8ig{7zphU(8CR4>bj4N_YHC=EnTz8k;V z-07RnFzgpt<{cS}?+l61sem)EP7X1XJ4hD|HGDq!1aT&*=3ghWzTVAwy>%=tz>@O% zRW6E7CMoR@y~l{^*jy!4Xj$xxKSucdn#q~?gBB?E;SXBs?bC|W_DifogYS}2+e!?z0){urntJVh31;P1P^pfwud$X>sllp z%8`;UvM-LcbpnqGUe4O_T?zU(GIKPwRvT#0G@|+ zhq`AdXzxGvP`*_v%PV^P&PCZ}5%E=&gRdpsgfK_C#W_a#MdmQpBVTh*EqYp?{)xbQmK-GzevFXGVYtH zyNX0*^&Z=tqX&W#<^<=LV^2%%0GvZbnq8%5nXcIr)K6R3jetJ6JK9-k0zo{vhCp@MnAc`yPwRASx}CWE;4cJwu5FwsnEAn&e5aLWt{FNHmR25^v8(=8cUTv8snq z=TqpL3FZwN^)pqB(J1kz#;_Zauc*>F$w9LM+$h(0QZ9qr>P{!8kdsxL^-0!LX!Xle zgEwWf2Wx#TJaPB(f6(k0?n&hhBXwg|3X6TH#vV}4h|C(&A*7fZAAf{Tei};!vsaI! ztIQMe#OKj}M;UIDT;#DS8{xv5jpFkN{zkz54+}|AP+g{I5}ZxfkhPbBNka;L_0kU3 z)F3bZdFWEKt5$M!`_`{w&v`jwYAO36`^3pGrJc}ZuyUzF{&Tc${KvU$R^8ra?fe48 z+DtZj#OOX+W}SKHWm)m!1$O|VA5`9|+(U1BUOcUA<0#N~6}X3PlC=OubTnXtjD6l% zlm-OuZGTwv(Yt3G^9kJTJfV+{U0g%JL@Gz7^kNn zM)>Kh9dg+ngUeQH;>V;wB4`5GBRT#Jk6CX4N7*;K>b&UGtzfh!^k9zD;7F0Epg4YU zKlEUp4Ta%t{ellCF5fdImTG;^v>x7CG!r@V_#Azx@erLOG*z~_5Lpx(nnX(swlrbM z#*LxnudNN8wQn>S=MQL((Vg$*E{$*m`@e7l)b-(sHr#&+9sYqO@%wTlL~PIx3j4B% zqxS>(2Q61KGcE!*{gU$g%3xz*jU70#k>!dzAI1%hVXRelB7NpI9*UzU@0478|I(E9 z_CS2xxbGrW1Dv+m;uWcTjPz*hE-S%Fd*`-Fjb+(iA>!5kntS0gr`IcJ5m_}chdCWR zjM(Ti7zf)_2^3OVk~&|ko)^_H-kR_r%c`JBydfM|2fCyuna;15PGVzMiN-VNv$5qy zPJ-U=nISup_N||E9&w+NyHV`~E|E!VrkgDTZokwQqrYUVOdMbRnA@-#-*CKyd$9l^ znbGeO&ohX6t6QW|Vv9vPdvMV#+HvmExIAb4dt*4=?n`AZV;!H4p(d@yiZcV*VV;HE z2J5Akcy13ec|kK` z>Zr3!LSbHV``xmt~Ay$Xfe@AKYpvbW7{NBIDIisr3dDQwN0GFgJC3?@sUfb z{632Mm1X)lj)I9~(}gY?n&Dk-&}=~<=dhb)!@|c=6*UvYy31nFcd3w>;OGwjqun!lW|9C0)(L%{L@`E1_!3yghT4jZLf6cG(Mol(q?@ds*aXr5aC{&o}NJvK@

    vM359>@vt8j)}t0wqdGq z4zNe3lB_eRGWf0IK7fDW1=54(u~@B5MX1q+XH>`u_!@TctW=cy1rDa_ixsM?fODV4 zOEPFd6FS7bAsy2{qrl{dCyVjMso#^ z_UGzPcQAbSj19Q!HBlg21>;Ifl9`d2yy-bfT4l%!Y^!-6Cc5tM`AIn#fqb1nPJ9F- zoi(J7T3xAs<{sOaV=WEn3LQb59BMCVGBhQ;$rDg@jiW3w6NXjGbB!iOC!UuV$&J4+ z5vX4{bb0$~B5dvQ@_wD|*HNr`7Yy$}FSfI{@)keS@vp%UJK)Wy#MOm9E;^CYJ)R>{ zia_{Up@}Ods_6q^!x$MD&XjthRL?4CKASMDk-rz)yDhj6Qv`s{rvEPhnD~>X*bL~( z2NvHaQqFVY_rXHNQ%oCu`=AZ)mr;PAB}+HFNdP_rfR)By>E`pVnb;-|j||~*;RJ&( ze-Ttr@LMTc@27U1eT|Tr!SIYK;8=R%H4Mku5HYTv6HiORvQ5QE8+V5G_3lB@ICJjS z4%I!_-IdTp8#V;?bUM^804oi<6Yw?-Vv#^T1Qdb=8Lv)f$R&~xds445Syw+~e3SW* z>kO1l?mhL{mIvxL-g7UOIUEt5rVPJ*4p7Rwb6-V<()Gc714#K+G*{omM@L*p{gAQ* z4ZyY9i!0u@l=Ta2tj@*FZJ4rLrOF65_Nlu=0T1OE%C8`We@5VwBk@jUeI`2-h zoS)f^@#m6F^YrvM)(;mW0mu@c$38*i;k!m1A#`g8^)sU#Jared_$}YEYcU@fQT>p4 zp6BiALCstCjGG%ff3LOtcOA=L^CyYd<%?li1)xL^0hF!s47SP>8GlK$STHqx(v40d z*e4Z!JRnZLO4kgm!GO_d=GsQec6HywbXBB) zkYt!xEEiENWrb;J;w=1%w|ur$!JY#gp*+OCP+%BiRxj)b>(6{KRUg>e?qVEsS@8vi zcyL(L8=L84s@?LUw-*^|=jtQ6s}=5d*;>&B9&c1m*h;}0h83lqv#aQUEl9$jyHa`B zzoB?V(kWhXH=LsU-QKfE?Jc^6T%!{|h+bO{B(64Fzca*ENQzFOqzLcHWUlCJY}WkG z#|2pJbJgvtFFgw=8|uU++}1?QR?wl$u)fIsy<#Ms`2xTyPt!2dISu%l@yuCc@N*^8 zvwD244W2c;vS4uluvHh7DLE%EKlZo_hyjJD^AUUwu55OtJe6)C8uM&g`Z(LrN%5K5 zYg#LgL&~B-&tHAbmw{zZs^cB1nnS}Gx~Vk1rhM1+sgiEQZD9ge3T{@KBfKlfTlr*B zMY2yaDv&z#C-a85iLY9J{1=Vw-xwDE z1uDv=@j_}2dx-!emNPKqQ-G`=o6tB&}c;ntg?S<3N}q(Im3m!2C1xooQNx5)T}euNsaD2 zM%LUh(X^*8ETBXf!{WHVmkR`eeT_FX@MXKr<^Ds#nVm(Q{dcwh%isJDWv{$oV6e$a zCZ4RB@ff883bX|on9!D0+c-X$1m?-l-tW*~ez2{xxeT|@Pz*z7vb1opf;lMkfz6DM z^$b_%Q(3{`KwJu`FnNkG9N_}T$(_0AIxXA8Ya{8F@l!{;BIPPTp{1Sq5h7UqWZ_T2AO=VC+v@=m=)He*fO zd?a+EO{((XbS?Ld7zOefAf+#QfS;zmv*?oCqDaDbTw|4FA~W?Vo==rsd$+6IrsZ{| z{md=t?VYB}gINuIw6JE@gK|J(8Bwdm;D?+Qrs?L}n1yB(H-m^WWgc}yjQ!>F{$K&F zsZl5Nabh%V>@uZ;ZRN=!>%~OIipeEqXNCRHHRmRSjV1G%D=1@^Kxc%6Er{F&6m{v)aRI!%DnGaz7U#o%^#{#p*(daHdFbc!L&h`hp*zRHM0|yo)8Tf; zJM_tB8+GMiCodbGhW?MerUbgA^^u(XpDne za`9qUlEe6Ti(J|Xu|6ftyCGCB4WX3jcySyRaDWZA+Bq8j9MnErzr5O9f68+=D`0&e z=JkM5<-dKWa1Vs*-3Bz08jvg>T_8KEMue+6LRc}GztO3xIW^zvMW2qcwHvTr-}t-d zTGD=HF7~q*QGKrSf$FUf@ONeqH+q=F@_>iA(uxqH@bvi>bPD!~nE<}^YJuaWr`W)q z<&2DW1cyRud{Jb>1PHG9tu~kx5??ff9~3lc4LbKcn2UVDIg4Ko+a$AEp$WXooCr^x zhu#x3%ru@_uU}FeoE@g4{63CrH?R?YNsZQeolOW>A)Ni}p&}UjAJ%EnAFI4%mq>7q zW45j)Sy&QdIOf>UT-fVVK*9FGgsyIQ3CxCUbUI=nrCRGV^#4_KbMpGY%3-}(*i|4j z1L?iH8XT(+67lS&*nb+crE|hUpa;;&*X-9iq>4BCdPZ!n%B%2T3#t>Ew=@FQ+6dLtJ3?3o9n`aXlf95 z_jnfGF|*S8DS}G-}IK-}T$R<55olumbM&0-rno$}CfNkZ+{KwQCQX z%~{;M4WYqfa{CgQ>FnWGFA_y9bbVikN_G1)S2@NrED_y_n|7(JQh2S0*#-E@j{5-> z@`sORad!F3w!Qurc^9h0{y)!GB;@Dz9gOw^M$MLbV+3Xb##a7;c{uU-VA$iVJODsm zb9cWGrC{{38b-P8;SU>!(zU|AEEK^uuRz}_*Otbq>`g943L$6ZzUk=Y1<<9a@xQDn z=3Y%iFfr&-%P`G)b$e6ZC1z?d8;F~w!Nq*cVOKXee-SZ<`U;Rz*Y87t`L50wuXs*@ zk7!Ii0ugtab2GgMrDcDkvi-GS8?_I)3c!BzEQRoaF`?#2)<71D5;oBpOsOpWxP8tx zWMF8f@f+*F2da7l z_+^HgW9Arq1}DwgYF8L&1(}p*Wr($UUC!5OKPp3}EUs1h{14i=t~{yDoEv8+L3iF_ zx!SklU%|OgT4%)QxTzv*iMMm}M2Vh9XOynu15>+Qn(K0uOxb9Sb{vyj7Lsi$wY|ZI zBEP9;Ddg3B(Y*aIcIBDeEYEzb5lo#Sq63X4BfLGFnen7)fXQwJvrK8f*X-sD+1Yfn z@QnF+L$J_(v%|w#M>fPsE_R&Uickwy^Ogox#F0q5(CU-Yh>@$_1Fo#9z&iwyfE# z&!E@g`DHiI+KnzuwYB5dP8<{!q=LVwjH4{yWRITsCVDgOX5PN+Ht4#fSqEGt75nTP zkode<@QE(2W5EjS6+Y*M4Y1FCn`I_rRon@&t6p`m4whyTuU}xhm-P_ab6dDGY^#19^(v@(MzjZNHCw8wUyLS~QP$YjN;jXPSNJlaqAG#%11o$7D+ z;#lEZj9m?5uUqLLli4K+p3DBATn#cSUa+csY5gV1nsM>OV!JLTYt4Zk4un4V3RQavMm$J&`)ttc&l(N)P+ z#@bz=`t*cSd=dp{fMiiL=%(Z%YS#1X{ZFF5KV%&(NIyCBAkzl#{PdD6-!yd4s^gr&8oa;64EbhVC7BO8kN|v_0fd9960Q?QMOqQXzaMC4A1GGON=EykaKf z?i`i-NVos>7bz}hSpv;-xiK}9C~--)w}0E5R7IWvQ3MohftgYCih|j^_jd2{oiz8| z(c}`jp(|~}$Fz^9&swScgB+~=v^m9sAf7)kB$UuS?;rj9S7lo}(Fbgq*Oj0>SDBp^ zrWRi|XhK)}*B>i$@L_OI@#~uw6L3UdBT;CZv#m$ylk;}YOQ{(64u+^+QC+AuAY}Yr zNg`x@?RfL`>_bkkqh7ANZ1gIyk-qh=7U^jAC>Iv`P_#Ln`D!=D)``vBLx+bT{ZaXU zjFTY2^qa5!2CcHe{_xMBs)ZSA&&D`io_ZprEeW%V@?Zf(WP6{6B;{YX_k$uH&zLr> zHmjk0cb9k0KrwUP6X*UXVOkXMTs*>fMj_G+uY07*D(G%TWl7QgFqg-_`b7hpO+dQM zOb#;I{aYh4XCbBIQx$N~kRY42|4{gmJPz9K)0tsS(g2}AzEz@HcH$yd3QU^9*X>0h z2xi_b8F^(JZ z8+$+ZYPt^jIkaa5?)pH7$`m1SPf9QwvT{7WWd!wcH-&acrmT154HO!^G! z@?@)40}k2SxP{@S46H=5l1B(q*V?Q?-yC#h6^)cZ0qF;cZo^q%^;(ZRpM2y}eEqF6 z5PI}{OUN%v*_5B$QW;qt)JMVdgnGjMoT0gt#{f>vYc^kid_fr!qYOWLJL{@up-!9! z#-2kfqD@Daoi1|v|G5tM)8VCulDJihce~zeC@gXN5R}4aykq)hh>j5q?nj={JeVaUb9*bA>n=v)?9F=5LDG|44j~$OC@vhEQ4SpPSdIZL3tQ=XQD*5E zILDn`xN&`h4XF3X(=QZxRN5z}#v!3M7TE`9g-Ax{1&vGW6W9SXcQecN2l~YceC}O;uL7Yn@pkcU&&=G7A8xoO& zB+)~{B--5w)0|l$&mkGR*bqo7JAOvzsfcVeeAdkcHx9~;%kVo-rU7dDTH4jUFi(O_ zf;PSgg;}WNMmtH6q!fxjdLLo2MWCVqCN|TmW@bU?y1$7|oN!FAj9g!SB<-qtk*2*H ztG>fr#W1z{&x#e#oM(MRY%Tt~;F7s{73=PC)T74npA&JEul5sFl+Cd)iHPun5O35xtX|iDkjaY72y7>>MmW9@$@w;?+fj%yLWiJ}|B^ zJ&FtioaNz2U2`h?`^mb7x-yV3Dq^$7;W+D@TlTHTJefDnfkrH|Ios5%Us$*Ci??lX7u$b^G>t#F=O>8-f zK3C}Wy!`%ZUA3eHExNL=q8U5+<6yQLslH>61>ElZUq8JWwuw|Xdzh3w#rFCg98yx**{X1yEsU_Bezeh>&Cjc!4DTd- znZDMoH?2iupFWgrrQQh z&bS$|G7H-(#FH!b=)?zzx(muwxC*e{#TX8OVw{1Nx|x$?DXx!-uL`kvmD=$SHCXgXs9So z7(@KzKLZiPWJN!{(7;Gr*LLxWhK~xaO{cEa%k4^=*~FClFCnxHYkQM5vVP%8NypRH z=HBk1EWPB=s}dYY@je@E@eWlZKg4zs&D}|Q=Dz8_)=A4NuzWiO0l4X_ITW~{}x65FWN~AgHd~S*|=khMC|lA@@B2WgC{7B zG)Va)G3xSK3pzO+jrcM)c^pt|0)zjfGP@`NX6&`nAQ^K~#gqGZ`P!Z;LGM1>$OZEU z8p(bj6DAA+z+3obci7xE z&Xp#={bB_Cb$!Ud|9kDjV^$LWDPdKkx6bBY9JUS|t7qN}I*l>S#}79!8LgrRr09*$ zr(1pm7z$x*V&7;CT5mCo)|sC$9QUY^9`%MwGHXM=oR|)=eObtVpqO>GurI>L^qZyr z9-%_xdFlJR^pe?{@53NtFZZM8$UNQSlF2aR(-q=UtP@<;N0Ye?d3-sdJqf3LxkRp4 z={udl8^^$kKzgI)pfys)s@Ef_P6ftb#E@yno|;yC;L{iuA@voHdS@V*mG!V}oW99K z7Irci@$&i0g9e^j8#`%&hTEBO-=7VGf%fIBnK1@71|hnf*G{zxZTg3&njD_ze6c|) z^&ieGbEzW`(eZS`Kj#>ZYX4agO*>M*tNL|{D&#hbtQ}cf_>BX!V5}e$U;(APqlx7! zODSV>lTXuq7@g_IN}?GHSqAG16)x6O)eMD%wu#oEtMby8VsmaeGUK@k+~dI}u?e)q zF*WUPJxRI&t2=kx53jpgWOgTpb?HEEGf7;^Y|W7^HF^S>^r-je%=DTR@&bIN3Oqx zdDn=pwrKQbPIRt0e%d`+t==_D9%1O;*VPSKf&+`4C}5fJ_>0M zdVeR@{q|J@2gc78C&_23GnUZDK!j*r-aBH32o?+|Kh5z4u!pRZERqg;`!~7s4z79# zhkVRysS!YLrrVZ!0TtXDbvtB{bga)uG@Ji21;u#(xr>jCGMg=NzRd);RpCoA0nhqD zx4L>!H{WR8jGjt;8pLz|#ktVbr&BSU?zjAhk>$6ES~1@60!}VQ!RR@T&<6a*NYS;kxP?mN)%te`ki=d;Zm>p4+%`(7Yrh;2idd zmJvYGIR1Zu2mVj~@x6(ynma~5eF!4& zAu3czgV;U!`x_JAGJObrSQ6&jw{__acf*$t#_Q-vtbM3dmX4so#G@gJ-o$6{Nqp6t zqGT!75$=8JftfD`Hc>??5 zUbBHYQP-MGK0mqmyf!-D(z0y09?6^D%dbn5THU4C??~Yd^te-1-IPth(V@n5M&KGY zoKOI8VK7F(el(?2h)~%dH11!nr}{MY_Gb?gja4|Wau|2QJED%{t=RgUgZcmfIeE)U zkW&tki;H}PIm7RbiCDu`cExq;_@~EgY1ZR3QRv*^jr-^n&Xy1?IjTg^i!2ZCT@0n> zw@JrQh5DRTI)e1Cn`YkzRj6{h3?loI6Ix%9MRz5VLP)3#iR*$#3K5B3?p@INNrqz`$%;x@Yl^*&7!MQ7``4%onpw zk>Fs5=c62?TfghX)&;^lBN2;g2Y{r3f$<7bUdQfbMI=Oruv&Wxc*p297@zJY1MbM6bUS( zBC8VM-V2CS1I-62YfzYNQO|g_@^3d zi|{p@p{Z{W81PBX#^0+uSZzga^wfo)>6~I>Z>F@z^LoT&x-Yhzv?La31P!h4V~d}u z&%J;kP}VL^o)(|VraO1W_r4e>J>w+UdN#6X*f^BVJ56o02-x0DqU&9jcGV4+l4G30 z%+1sD{x&jfLw@wsSUaCE(hzZ*-b<-Z!G||U(FnaSFhQDh$xDHhyXd+~NhcB037_Y1 zwPu&L@f@d^>CALLblK0Z#W89#Nx0RmCiV}6ri@6tK>Mv%)sf|V!KCpQv}J~(1E6LG z;&e?4zoFzFsDFKE*G5V1OWShUA*x~K`Q?b$7^N*WEFMY;Z%&nO^$4l3BqS&O{n2rq zZribE9hStKe+i!7T*l;I0{O{bVsp1P5^iKGmIWI<`7W(8FlVWlSL;ihF>sg%1Q}6k z#?8?nnv)!rjFXr~*22Cl{2(IITmBdby5iHhN?^p<%XfkZW zXcg$#<$$}-^ZB7|DAP!^t9Lsoj8pbHK7bBnDbH*rT*}zG+=gi6<}waj0AFD~PhepUgq_WO=~-*JeB5H - - -$Id$ - -Acknowledgments - -I want to acknowledge all of the people that helped review or edit the model -documentation: David Lawrence, Samuel Levis, Keith Oleson, and Sean Swenson. -Thank you for your help in catching errors, and making the document more -understandable and readable. Our readers thank you as well, as now it is much -easier for them to digest. Any mistakes, or errors are all mine. If you run -across one of those errors, please let us know, by following -. -I also want to thank Sheri -Mickelson, for her work in doing perturbation analysis on bluefire and intrepid, -which was used in our initial versions of this User's Guide. We also want to -thank the original authors of &ptclm;: Daniel M. Ricciuto, Dali Wang, Peter E. Thornton, -Wilfred M. Post, and R. Quinn Thomas for providing a nice addition to the &cesm; -effort. We also want to thank the folks at University of Michigan Biological Stations -(US-UMB) who allowed us to use their Fluxnet station data and import it into our -inputdata repository, especially Gil Bohrer the PI on record for this site -(see for permission information on using this -data). - - - - -Introduction - - -The Community Land Model (&clmrel;) is the latest in a series of -global land models developed by the &cesm; Land Model Working Group -(LMWG) and maintained at the National Center for -Atmospheric Research (&ncar;). This guide is intended to instruct both -the novice and experienced user on running &clm;. This guide pertains to the -latest version &clmrel; available for download from the public release -subversion repository as a part of &cesmrel;. Documentation may be different if you are using an -older version, you should either update to the latest version, or use the -documentation inside your own source tree. There is information in the -ChangeLog file and in the -regarding the changes from previous versions of &cesm;. - - - -The novice user should read - in detail before beginning work, while the -expert user should read and - chapters, and then use the more detailed -chapters as reference. Before novice users go onto more technical problems covered -in , , , or they -should know the material covered in and be able -to replicate some of the examples given there. - - -All users should read the - -and sections to understand the document conventions -and the various ways of getting help on using &clm4;. Users should also read -the section to see if their planned use of the -model is something that has been scientifically validated and well tested. Users -that are NOT using &ncar; machines or our list of well tested machines should also -read the section to make sure they have -all the required UNIX utilities on the system they want to do their work. - - - - - -Introduction to the &clm4; User's Guide -What is in here anyway? - - -Here in the introduction we first give a simple guide to understand the document -conventions in . The next section -describes the differences between &clmrel; and &clm40; (for each &cesm; release version -up to &cesmrel;) as well as between -&clm40; and &clm35;, both from a scientific -as well as a software engineering point of view. It also talks about differences in the -configuration, namelist, and history fields. The next section -is for users that are already experts in using &clm; and gives a quickstart guide to the -bare details on how to use &clm4;. The next tells -you about what has been extensively tested and scientifically validated (and maybe more -importantly) what has NOT. lists the UNIX utilities -required to use &clm4; and is important if you are running on non-&ncar; machines, generic -local machines, or machines NOT as well tested by us at &ncar;. Next we -have to detail some of the best practices for using -&clm4; for science. The last introductory section is which lists -different resources for getting help with &cesm1; and &clm4;. - - - - goes into detail on how to setup and run simulations with -&clm4; and especially how to customize cases. Details of &configure; -modes and &buildnml; options as well as namelist options are given in this chapter. - - - - gives instructions on the &clm4; tools for creating input datasets -for use by &clm;, for the expert user. There's an overview of what each tool does, and some general notes on how to build -the FORTRAN tools. Then each tool is described in detail along with different ways in -which the tool might be used. -A final section -on how to customize datasets for observational sites for very savvy expert users is given as the last section of this chapter. - - - -As a followup to the tools chapter, tells how to add files to the -XML database for &buildnml; to use. This is important if you want to use the XML database to automatically select -user-created input files that you have created when you setup new cases with &clm;. - - - -In , again for the expert user, we give details on how to do some particularly -difficult special cases. For example, we give the protocol for spinning up both the &clmcn; model and &clm; with dynamic -vegetation active (CNDV). We give instructions to do a spinup case -from a previous case with Coupler history output for atmospheric forcing. We also give -instructions on running the prognostic crop model and its irrigation option. We also review -how to validate a port to a new machine using the Perturbation error -growth technique. Lastly we tell the user how to use the DATM model to send historical &CO2; data to &clm;. - - - - outlines how to do single-point or -regional simulations using &clm4;. -This is useful to either compare &clm; simulations with point observational stations, -such as tower sites (which might include your own atmospheric forcing), or -to do quick simulations with &clm; for example to test a new parameterization. There are -several different ways given on how to perform -single-point simulations which range from simple &PTSMODE; to more complex where you create all your own datasets, tying into - and also to add the -files into the &buildnml; XML database. After this chapter - chapter outlines how to use the &ptclm; python script to -help you run single-point simulations. - - - -Finally, gives some guidance on trouble-shooting -problems when using &clm4;. It doesn't cover all possible problems with &clm;, but gives -you some guidelines for things that can be done for some common problems. - - - -In the appendices we talk about some issues that are useful for advanced users and -developers of &clm;. -In we give some basic background to the &clm; -developer on how to edit the models/lnd/clm/bld/clm.cpl7.template. -This is a very difficult exercise and we don't recommend it for any, but the most -advanced users of &clm; who are also experts in UNIX and UNIX scripting. - - -In we go over how to run the script -runinit_ibm.csh" that will interpolate standard resolution -initial condition dataset to several other resolutions at once. It also runs &clm; -to create template files as well as doing the interpolation using -interpinic. In general this is only something that a developer -would want to do. Most users will only want to interpolate for a few specific -resolutions. - - -In we go over the automated testing scripts for -validating that the &clm; is working correctly. The test scripts run many different -configurations and options with &clm; making sure that they work, as well as doing -automated testing to verify restarts are working correctly, and testing at many -different resolutions. In general this is an activity important only for a developer -of &clm;, but could also be used by users who are doing extensive code modifications -and want to ensure that the model continues to work correctly. - - -Finally in we give instructions on how to build -the documentation associated with &clm; (i.e. how to build this document). This -document is included in every &clm; distribution and can be built so that you can -view a local copy rather than having to go to the &cesm; website. This also could -be useful for developers who need to update the documentation due to changes they -have made. - - - - - - - - - -Important Notes and Best Practices for Usage of &clm4; - - - -When running with CN, it is critical to begin with initial conditions -hat are provided with the release or to spin the model up following the CN spinup -procedure before conducting scientific runs (see . -Simulations without a proper spinup will effectively be starting from an unvegetated -world. See for information on how to -provide initial conditions for your simulation. - - -Initial condition files are provided for fully coupled BCN and offline -ICN cases for 1850 and 2000 at 1deg, 2deg, and T31 resolutions. There's also an -initial condition file for ICN with the prognostic crop model for 2000 at 2deg -resolution, and one with &clmsp; for 2000 at 2deg resolution. We also have initial -conditions for offline CNDV for 1850. And there are interpolated datasets for 4x5 and -10x15 resolution for 1850. The 1850 initial condition -files are in 'reasonable' equilibrium. The 2000 initial condition files represent -the model state for the year 2000, and have been taken from transient simulations. -Therefore, by design the year 2000 initial condition files do not represent an -equilibrium state. Note also that spinning the 2000 initial conditions out to -equilibrium will not reflect the best estimate of the real carbon/nitrogen state -for the year 2000. - - -Users can generate initial condition files at different resolutions by -using the &clm; tool interpinic to interpolate from one of the -provided resolutions to the resolution of interest. Interpolated initial condition -files may no longer be in 'reasonable' equilibrium. - - -Aerosol deposition is a required field to &clm4; sent from the -atmosphere model. Simulations without aerosol deposition will exhibit unreasonably -high snow albedos. The model sends aerosol deposition from the atmospheric model (either -CAM or &datm;). When running with prescribed aerosol the atmosphere -model will interpolate the aerosols from 2-degree resolution to the resolution the -atmosphere model is running at. - - - - - - - - - - - - - $EDITOR - - - -How to Use This Document -Conventions used in the document for code and commands - - -This section provides the details in using &clm; with the &cesm; modeling -system. Links to descriptions and definitions have been provided in the code below. -We use the same conventions used in the &cesm; documentation as outlined below. - - - -Throughout the document this style is used to indicate shell -commands and options, fragments of code, namelist variables, etc. -Where examples from an interactive shell session are presented, lines -starting with > indicate the shell prompt. A backslash "\" at the end -of a line means the line continues onto the next one (as it does in -standard UNIX shell). Note that $EDITOR" is used to refer to the -text editor of your choice. $EDITOR is a standard UNIX environment -variable and should be set on most UNIX systems. Comment lines are -signaled with a "#" sign, which is the standard UNIX comment sign as well. -$CSMDATA is used to denote the path to the inputdata directory for -your &cesm; data. - -> This is a shell prompt with commands \ -that continues to the following line. -> $EDITOR filename # means you are using a text editor to edit "filename" -# This is a comment line - - - - - - - - - - - &clmcn; - &clmsp; - - -What is new with &clmrel; since previous public releases? - -In this section we list the updates that have occurred to &clm4; since previous -public releases. In the first sections we describe changes in &clmrel; since the &ccsm4; release, -and in the last one we describe changes from &clm35; to &clm40; release. Note, that -the changes in the last section do NOT include the more recent changes given in the -first section, but only list the changes from &clm35; to the &clm40; release that -was part of the &ccsm4; public release. We will describe both the -changes in the science in the model as the software engineering changes. Software -engineering changes includes the configure and namelist changes, as well as the new -history fields. - - -What is new with &clmrel; since the December 8th, 2010 &cesm102; release? - - - -What is new with &clmrel; Science since &clmcesm102;? - -A prognostic crop model option was added in (based on Agro-IBIS) from work by -Samuel Levis. The crop model adds in four new vegetation types for: soybean, -winter and spring temperate cereals, and corn on their own separate columns. Winter -cereal was added as a PFT type, but doesn't exist in the input datasets, only -spring cereal is used. Winter cereal also has NOT been scientifically validated -or tested. The model manages these by modeling both planting and harvesting. See for an example of running with it. - - -An irrigation model was added from work by Samuel Levis and Bill Sacks. This -model takes water from runoff and adds it to the crop pfts for areas equipped -for irrigation. See for an example of running with it. -Please note that the irrigation model only works with the crop model active. - - - - -What is new with &clmrel; Software since &clmcesm102;? - -Since &clmcesm102; all Input/Output uses &pio; (Parallel Input/Output package). -Restart history files are now &netcdf;. Input and output files can be read/written -in parallel using PIO. We removed a list of old CPP defines and removed the -old misc/preproc.h files. Also a new tool for working with single-point sites was -added into the &cesm; scripts the Python tool &ptclm;. We have a complete chapter on it's use. - - -New configuration options: - --crop --noio - - - -Configuration options removed: - --dust --progsslt - - - -New build-namelist options: - --co2_ppmv --rtm_res --rtm_tstep - - - -New precedence for build-namelist options is... - -Values set on the command-line using the -namelist option -(&CLMNAMELIST;). -Values read from the file specified by -infile (&usernlclm; file). -Datasets from the -clm_usr_name option (&CLMUSRDAT;). -Values set from a use-case scenario, e.g., -use_case (&CLMUSECASE;). -Values from the namelist defaults file. - - - -Namelist options renamed: - -carbon_only => suplnitro (can be set to NONE or ALL) - - - -namelist options removed: - -carbon_only => suplnitro -scaled_harvest -hist_crtinic -hist_pioflag -ncd_lowmem2d -ncd_pio_def -ncd_pio_UseRearranger -ncd_pio_UseBoxRearr -ncd_pio_SerialCDF -ncd_pio_IODOF_rootonly -ncd_pio_DebugLevel -ncd_pio_num_iotasks - - - -New history fields: - -A5TMIN 5-day running mean of min 2-m temperature -(K) -A10TMIN 10-day running mean of min 2-m temperature -(K) -GDD0 Growing degree days base 0C from planting -(ddays) -GDD8 Growing degree days base 8C from planting -(ddays) -GDD10 Growing degree days base 10C from planting -(ddays) -GDD020 Twenty year average of growing degree days base 0C from planting -(ddays) -GDD820 Twenty year average of growing degree days base 8C from planting -(ddays) -GDD1020 Twenty year average of growing degree days base 10C from planting -(ddays) -GDDPLANT Accumulated growing degree days past planting date for crop -(ddays) -GDDHARV Growing degree days (gdd) needed to harvest -(ddays) -GDDTSOI Growing degree-days from planting (top two soil layers) -(ddays) -QIRRIG water added through irrigation -(mm/s) - - - -SNOWLIQ and SNOWICE changed from average to instantaneous output. - - - - -What was new with &clm4014; (in &cesm102;) since the September 17th, 2010 &cesm101; release? - -Since, &clm4010; in the &cesm101; release there were several developments made -to &clmrel;. Several new namelist items were added -a few new history fields. There were also some updates for -running the model with single-point mode. - - -Configuration options that were renamed: - -prog_seasalt => progsslt - - - -Namelist items removed: - -prog_seasalt => progsslt - - - -What was new with &clm4014; Science since &clm4010;? - -A long simulation at the course resolution of T31 (typically used for Paleo-climate -studies) was done and an spun-up initial condition file was provided for this -resolution (also by default the namelist variable ice_runoff was -turned off for T31). Also a new surface dataset and transient land-cover dataset was -provided for half-degree resolution. - - - -What was new with &clm4014; Software since &clm4010;? - -New configuration options - -sitespf_pt - - - -sitespf_pt is used for single-point/regional mode and is set to the site-name -that will be used (see the config_definition.xml for the -list of valid options). - - -Configuration options that were renamed: - -prog_seasalt => progsslt - - - -Namelist items removed: - -faerdep -fndepdat -fndepdyn -use_ndepstream - - - -Nitrogen deposition datasets are now only entered through the -ndepdyn_nml namelist (removing fndepdat, fndepdyn, and -use_ndepstream). Aerosol deposition is now a required input from -the atmosphere model, hence faerdep is removed. - - -New history fields: - -U10 10-m wind (m/s) -U10_DUST 10-m wind for dust model (m/s) -VA atmospheric wind speed plus convective velocity (m/s) -VOLR RTM storage: LIQ (m3) -VOLR_ICE RTM storage: ICE (m3) - - - - - - -What was new with &clm4010; (in &cesm101;) since the April 1st, 2010 &ccsm4; release? - -From, &clm40; in the &ccsm4; release to &clm4010; there were several developments made -to &clm;. A glacier multiple elevation class option was added that allows the -use of &clm4; with a glacier land ice model the Community Ice Sheet Model (CISM). -A bug-fix for the snow hydrology was added. Several new namelist items were added -a few new history fields. Also the capability of reading aerosol and nitrogen -deposition from stream files at one resolution and regridded on the fly rather than -with datasets at the model resolution was added in. This was important for higher -resolutions so that large datasets do not have to be created before running the model, -nor are datasets for every resolution required. - - -What was new with &clm4010; Science since &ccsm4;? - -In general, snow layers should not be thinner than - -dzmin = wice/rhoice + wliq/rholiq - -If dz < dzmin, then the value of "void" computed in subroutine -SnowCompaction is negative, which is unphysical. This doesn't cause -problems with the compaction itself, but results in unrealistic values -of vol_ice, vol_liq, and eff_porosity in subroutine SnowWater. We can -have vol_ice = 1 and vol_liq = 0 even when liquid is present, which cuts -off the runoff (qout) from the lowest snow layer. Liquid water then -accumulates in the snow column without draining, which leads to further -problems and eventually a code crash. - - -The solution to this problem was to adjust layer thickness dz for any water+ice content -changes in excess of previous layer thickness, e.g., - -dz(c,j) = max(dz(c,j),h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice) - -at appropriate steps in the snow hydrology subroutines. - - - -Snow hydrology bug fix. -Add multiple elevation class option for glaciers so can interact with -the land ice sheet model. - - - - -What was new with &clm4010; Software since &ccsm4;? - -New configuration options - -glc_nec - - - -glc_nec can be 1,3,5, or 10 and MUST match the number on the input surface dataset -the elevation classes themselves are read from the surface dataset - - -New namelist items: - -carbon_only -create_glacier_mec_landunit -glc_dyntopo -ice_runoff -ndepmapalgo -scaled_harvest - - - -carbon_only = If true, and CLMCN carbon-nitrogen model is on, Nitrogen is unlimited - rather than prognosed and vegetation will be over-productive (replaces the supplemental Nitrogen #ifdef) - - - create_glacier_mec_landunit (= T when these landunits are created; F by default) - - - glc_dyntopo (= T if &clm; topography changes dynamically; currently F) - (NOT fully implemented yet) - - -ice_runoff = If true, river runoff will be split up into liquid and ice streams, - otherwise ice runoff will be zero and all runoff directed to liquid stream - - - ndepmapalgo = Mapping method from Nitrogen deposition input file to the model - resolution (can be bilinear,nn,nnoni,nnonj,spval,copy, bilinear by default) - - -scaled_harvest = If true, harvesting will be scaled according to coefficients - determined by Johann Feddema, 2009 - - -New history fields: - -aais_area Antarctic ice area (km^2) -aais_mask Antarctic mask (unitless) -gris_area Greenland ice area (km^2) -gris_mask Greenland mask (unitless) -QICE ice growth/melt (mm/s) -QICEYR ice growth/melt (mm/s) -QTOPSOIL water input to surface (mm/s) -VOLR RTM storage: LIQ (m3) -VOLR_ICE RTM storage: ICE (m3) - - - - - - - -What was new with &clm40; since &clm35;? - - -From &clm35; to &clm40; there were advances in both the science and the software infrastructure. -There were also new configure and namelist options as well as new history fields. In this -section we will describe each of these changes in turn. - - - -What was new with &clm40; Science? - -The following aspects are changes to the science in &clm40; since &clm35;. - - -Biogeophysics and Hydrology - -Changes to &clm40; beyond &clm35; (Oleson et al., 2008a; Stockli et al., 2008) include -updates throughout the model. The hydrology scheme has been modified with a revised -numerical solution of the Richards equation (Zeng and Decker, 2009; Decker and Zeng, -2009); a revised soil evaporation parameterization that removes the soil resistance term -introduced in &clm35; and replaces it with a so-called &Bgr; formulation, as well as accounts for the role of litter and within- -canopy stability (Sakaguchi and Zeng, 2009). -&clm4; also includes a representation of the thermal and hydraulic properties of organic -soil that operates in conjunction with the mineral soil properties (Lawrence and Slater, -2008). The ground column has been extended to ~50-m depth by adding five additional -hydrologically inactive ground layers (making a total of 15 ground layers, 10 soil -layers and 5 bedrock layers; Lawrence et al., 2008). An urban landunit and associated -urban canyon model (&clmu;) has been added which permits the study of urban climate -and urban heat island effects (Oleson et al., 2008b). - - - - -Snow Model - -The snow model is significantly modified via incorporation of SNICAR (SNow and Ice Aerosol Radiation) which represents the effect of aerosol deposition (e.g. black and organic carbon and dust) on albedo, introduces a grain-size dependent snow aging parameterization, and permits vertically resolved snowpack heating (Flanner and Zender, 2005; Flanner and Zender, 2006; Flanner et al., 2007). The new snow model also includes a new density-dependent snow cover fraction parameterization (Niu and Yang, 2007), a revised snow burial fraction over short vegetation (Wang and Zeng, 2009) and corrections to snow compaction (Lawrence and Slater, 2009). - - - - -Surface Datasets - -The PFT distribution is as in Lawrence and -Chase (2007) except that a new cropping dataset is used (Ramankutty et al., 2008) and -a grass PFT restriction has been put in place to reduce a high grass PFT bias in -forested regions by replacing the herbaceous fraction with low trees rather than grass. -Grass and crop PFT optical properties have been adjusted according to values presented -in Asner et al. (1998), resulting in significantly reduced albedo biases. Soil colors -have been re-derived according to the new PFT distribution. - - - - -Biogeochemistry - -The model is extended with a carbon-nitrogen biogeochemical model (Thornton et al., 2007; -Thornton et al., 2009; Randerson et al., 2009) which is referred to as &clmcn;. CN is -based on the terrestrial biogeochemistry Biome-BGC model with prognostic carbon and -nitrogen cycle (Thornton et al., 2002; Thornton and Rosenbloom, 2005). &clmcn; is -prognostic with respect to carbon and nitrogen state variables in the vegetation, litter, -and soil organic matter. Vegetation phenology and canopy heights are also prognostic. A -detailed description of the biogeochemical component can be found in Thornton et al. -(2007). Note that &clm40; can be run with either prescribed satellite phenology -(&clmsp;) or with prognostic phenology provided by the carbon- nitrogen cycle model -(&clmcn;). Additionally, a transient land cover and land use change, including wood harvest, -capability has been introduced that enables the evaluation of the impact of historic and -future land cover and land use change on energy, water, and momentum fluxes as well as -carbon and nitrogen fluxes. The dynamic global vegetation model in &clm3; has been -revised such that the carbon dynamics (e.g. productivity, decomposition, phenology, -allocation, etc.) are controlled by CN and only the dynamic vegetation biogeography -(competition) aspect of the &clm3; DGVM is retained. -The biogenic volatile organic compounds model (BVOC) that was available in &clm3; has -been replaced with the MEGAN BVOC model (Heald et al. 2008). - - - - -Miscellaneous Changes - -Several other minor changes have been incorporated including a change to the atmospheric reference height so that it is the height above zo+d for all surface types. The convergence of -canopy roughness length zo and displacement height d to bare soil values as the -above-ground biomass, or the sum of leaf and stem area indices, goes to zero is ensured -(Zeng and Wang, 2007). Several corrections have been made to the way the offline forcing -data is interpreted. The main change is a vastly improved and smooth diurnal cycle of -incoming solar radiation that conserves the total incoming solar radiation from the -forcing dataset. Additionally, in offline mode rather than partitioning incoming solar -radiation into a constant 70%/30% direct vs diffuse split, it is partitioned according to -empirical equations that are a function of total solar radiation. Finally, to improve -global energy conservation in fully coupled simulations, runoff is split into separate -liquid and ice water streams that are passed separately to the ocean. Input to the ice -water comes from excess snowfall in snow-capped regions. - - - - -Summary of Science Changes - -Taken together, these augmentations to &clm35; in &clm40; result in improved soil moisture dynamics -that lead to higher soil moisture variability and drier soils. Excessively wet and -unvarying soil moisture was recognized as a deficiency in &clm35; (Oleson et al. 2008a, -Decker and Zeng, 2009). The revised model also simulates, on average, higher snow cover, -cooler soil temperatures in organic-rich soils, greater global river discharge, lower -albedos over forests and grasslands, and higher transition-season albedos in snow covered -regions, all of which are improvements compared to &clm35;. - - - - - -What is new with &clm40; Software Infrastructure? - -The following aspects are changes to the software infrastructure in &clm40; since &clm35;. - - - - Update to cpl7 and scripts. - Remove offline and cpl6 modes. - Remove support for CASA model. - Update to datm8 atmospheric data model. - Add gx3v7 land mask for T31 and fv-4x5 horizontal resolutions. - Add gx1v6 land mask for f05, f09, and f19 horizontal resolutions. - Add tx1v1 land mask and 1.9x2.5_tx1v1 horizontal resolution. - Add in 2.5x3.33 horizontal resolution. - Add in T62 horizontal resolution so can run at same resolution as input &datm; -data. - Allow first history tape to be 1D. - Add ability to use own version of input datasets with &CLMUSRDAT; -variable. - Add a script to extract out regional datasets. - New &buildnml; system with XML file describing all namelist -items. - Add glacier_mec use-case and stub glacier model. - Make default of maxpatch_pft=numpft+1 instead of 4. - Only output static 3D fields on first h0 history file to save space. - Add new fields for VOC (Volatile Organic Compounds) on surface datasets, - needed for the new MEGAN VOC model. - Add multiple elevation class option for glaciers in mksurfdata tool (NOT used -in &clm; yet). - Add ascale field to land model in support of model running on it's own -grid. - - - - - -What are The New Configuration Options in &clm40;? - -Describe any changes made to build system: - - - -Change directory structure to match &ccsm;. -Add BGP target. -Add choice between ESMF and MCT frameworks. -Start removing #ifdef and directives that supported Cray-X1 Phoenix as now -decommissioned. -Make default of maxpatch_pft=numpft+1 instead of 4 for all -configurations. -By default turn on CLAMP when either CN or CASA is enabled -New SNICAR_FRC, CARBON_AERO, and C13 CPP ifdef tokens. - - - - -New options added to &configure;: -More information on options to &clm; &configure; are given in . - - - - -OptionDescription --comp_intf <name>Component interface to use (ESMF or MCT) (default -MCT) --nofireTurn off wildfires for bgc setting of CN (default includes -fire for CN) --pio <name>Switch enables building with Parallel I/O library. [on -| off] (default is on) --snicar_frc <name>Turn on SNICAR radiative forcing calculation. [on | -off] (default is off) - -More information on options to &clm; &configure; are given in . - - - - -What are The New Namelist Options in &clm40;? - -&buildnml; now checks the validity of your namelist you generate by looking at data in -the namelist_definition.xml file. In order to add new namelist items you need to -change the code and also edit this file (e.g. a namelist option required for your -research project that is not currently an option in &clm40;). To view information -on the namelist view the -file: models/lnd/clm/bld/namelist_files/namelist_definition.xml -in a browser and you'll see the names, type, description and valid_values for all -namelist variables. - - -Changes to &buildnml;: - -Allow simulation year entered to include ranges of years (i.e. 1850-2000) -Remove cam_hist_case option. -Make sure options ONLY used for stand-alone testing have a "drv_" or "datm_" - prefix in them and list these options all together and last when asking for - help from &buildnml;. - - - - New option to &buildnml;: - - -clm_usr_name "name" Dataset resolution/descriptor for personal datasets. - Default: not used - Example: 1x1pt_boulderCO_c090722 to describe location, - number of pts, and date files created - - - - New list options to &buildnml; - - cd models/lnd/clm/bld - ./&buildnml; -res list # List valid resolutions - ./&buildnml; -mask list # List valid land-masks - ./&buildnml; -sim_year list # List valid simulation years and simulation year ranges - ./&buildnml; -clm_demand list # List namelist variables including those you could - # demand to be set. - ./&buildnml; -use_case list # List valid use-cases - - - - -New use-cases for &buildnml;: - - 1850_control = Conditions to simulate 1850 land-use - 2000_control = Conditions to simulate 2000 land-use -20thC_transient = Simulate transient land-use, aerosol and Nitrogen deposition - from 1850 to 2005 - - - - - New namelist items: - - urban_hac = OFF, ON or ON_WASTEHEAT (default OFF) Flag for urban Heating - and Air-Conditioning - OFF = Building internal temperature is un-regulated. - ON = Building internal temperature is bounded to reasonable range. - ON_WASTEHEAT = Building internal temperature is bounded and resultant waste - heat is given off. - urban_traffic = .true. or .false. Flag to include additional multiplicative - factor of urban traffic to sensible heat flux. - (default .false.) - fsnowoptics = filename file for snow/aerosol optical properties (required) - fsnowaging = filename file for snow aging parameters (required) - -More information on the &buildnml; options are given in -. -and in -&CLMBLDNML;. - - -More information on the &buildnml; options are given in in . - - - - -What are The New History Fields? - -New history variables: (note watt vs. W in units, 26 vs. 76) - - - - -NameLong-nameUnitsActive/Inactive -BCDEPtotal BC deposition (dry+wet) from -atmospherekg/m^2/s -BIOGENCObiogenic CO -fluxuGC/M2/H -C13_PRODUCT_CLOSSC13 total carbon loss from wood product -poolsgC13/m^2/s -DSTDEPtotal dust deposition (dry+wet) from -atmospherekg/m^2/s -EFLX_DYNBALdynamic land cover change conversion energy -fluxW/m^2 -FGR12heat flux between soil layers 1 and -2watt/m^2 -FSATfractional area with water table at -surfaceunitless -FSH_NODYNLNDUSEsensible heat flux not including correction for land use change - watt/m^2 -GC_HEAT1initial gridcell total heat -contentJ/m^2 -GC_HEAT2post land cover change total heat -contentJ/m^2inactive -GC_ICE1initial gridcell total ice -contentmm/s -GC_ICE2post land cover change total ice -contentmm/sinactive -GC_LIQ1initial gridcell total liq -contentmm -GC_LIQ2initial gridcell total liq content -mminactive -H2OSNO_TOPmass of snow in top snow -layerkg - HEAT_FROM_ACsensible heat flux put into canyon due to heat -removed from air conditioningwatt/m^2 -HKhydraulic -conductivitymm/sinactive -ISOPRENEisoprene fluxuGC/M2/H -LAND_USE_FLUXtotal C emitted from land cover conversion and -wood product poolsgC/m^2/s -LAND_UPTAKENEE minus LAND_USE_FLUX, negative for -updategC/m^2/s -LWupupwelling longwave -radiationwatt/m^2inactive -MONOTERPmonoterpene -fluxuGC/M2/H -NBPnet biome production, includes fire, landuse, and harvest -flux, positive for sinkgC/m^2/s -OCDEPtotal OC deposition (dry+wet) from -atmospherekg/m^2/s -OVOCother VOC fluxuGC/M2/H -ORVOCother reactive VOC -fluxuGC/M2/H -PBOTatmospheric pressurePa -PCO2atmospheric partial pressure of -&CO2;Pa -PRODUCT_CLOSStotal carbon loss from wood product -poolsgC/m^2/s -PRODUCT_NLOSStotal N loss from wood product -poolsgN/m^2/s -Qairatmospheric specific -humiditykg/kginactive -Qanthanthropogenic heat -fluxwatt/m^2inactive -Qtaumomentum fluxkg/m/s^2 -QFLX_LIQ_DYNBALliq dynamic land cover change conversion -runoff fluxmm/s -QFLX_ICE_DYNBALice dynamic land cover change conversion -runoff fluxmm/s -QRUNOFF_NODYNLNDUSEtotal liquid runoff not including correction for land use change (does not include QSNWCPICE) -mm/s -QSNWCPICEexcess snowfall due to snow -cappingmm/s -QSNWCPICE_NODYNLNDUSEexcess snowfall due to snow capping not including correction for land use change -mm/s -QSNWCPLIQexcess rainfall due to snow -cappingmm/sinactive -SMPsoil matric -potentialmminactive -SNOAERFRC2Lsurface forcing of all aerosols in snow, averaged only when snow is present (land) -watt/m^2 -SNOAERFRCLsurface forcing of all aerosols in snow -(land)watt/m^2 -SNOBCFRCLsurface forcing of BC in snow -(land)watt/m^2 -SNOBCMCLmass of BC in snow -columnkg/m2 -SNOBCMSLmass of BC in top snow -layerkg/m2 -SNOdTdzLtop snow layer temperature gradient -(land)K/m -SNODSTFRC2Lsurface forcing of dust in snow, averaged only when snow is present (land) -watt/m^2 -SNODSTFRCLsurface forcing of dust in snow -(land)watt/m^2 -SNODSTMCLmass of dust in snow -columnkg/m2 -SNODSTMSLmass of dust in top snow -layerkg/m2 -SNOFSRNDdirect nir reflected solar radiation from -snowwatt/m^2inactive -SNOFSRNIdiffuse nir reflected solar radiation from -snowwatt/m^2inactive -SNOFSRVDdirect vis reflected solar radiation from -snowwatt/m^2inactive -SNOFSRVIdiffuse vis reflected solar radiation from -snowwatt/m^2inactive -SNOFSDSNDdirect nir incident solar radiation on -snowwatt/m^2inactive -SNOFSDSNIdiffuse nir incident solar radiation on -snowwatt/m^2inactive -SNOFSDSVDdirect vis incident solar radiation on -snowwatt/m^2inactive -SNOFSDSVIdiffuse vis incident solar radiation on -snowwatt/m^2inactive -SNOLIQFLtop snow layer liquid water fraction -(land)fractioninactive -SNOOCMCLmass of OC in snow -columnkg/m2 -SNOOCMSLmass of OC in top snow -layerKg/m2 -SNOOCFRC2Lsurface forcing of OC in snow, averaged only when snow is present (land) -watt/m^2 -SNOOCFRCLsurface forcing of OC in snow -(land)watt/m^2 -SNORDSLtop snow layer effective grain -radiusm^-6inactive -SNOTTOPLsnow temperature (top -layer)K/minactive -SWupupwelling shortwave -radiationwatt/m^2inactive -TSOI_10CMsoil temperature in top 10cm of -soilK -URBAN_ACurban air conditioning -fluxwatt/m^2 -URBAN_HEATurban heating -fluxwatt/m^2 -VOCFLXTtotal VOC flux into -atmosphereuGC/M2/H -Windatmospheric wind velocity -magnitudem/sinactive -WOOD_HARVESTCwood harvest (to product -pools)gC/m^2/s -WOOD_HARVESTwood harvest (to product -pools)gN/m^2/s - - - - - History field name changes: - - -OldNew -ANNSUM_PLANT_NDEMAND= -ANNSUM_POTENTIAL_GPP -ANNSUM_RETRANSN= ANNMAX_RETRANSN -C13_DWT_PROD10C_LOSS= C13_PROD10C_LOSS -C13_DWT_PROD100C_LOSS= C13_PROD100C_LOSS -C13_DWT_PROD10N_LOSS= C13_PROD10N_LOSS -C13_DWT_PROD100C_LOSS= C13_PROD100C_LOSS -DWT_PROD100N_LOSS= PROD10N_LOSS -DWT_PROD100N_LOSS= PROD100N_LOSS -DWT_PROD100C_LOSS= PROD10C_LOSS -DWT_PROD100C_LOSS= PROD100C_LOSS -HCSOISNO= HC -TEMPSUM_PLANT_NDEMAND= -TEMPSUM_POTENTIAL_GPP -TEMPSUM_RETRANSN= TEMPMAX_RETRANSN - - - -History field names deleted include: SNOWAGE, TSNOW, FMICR, FCO2, DMI, QFLX_SNOWCAP - - - -Add new urban oriented _U, and _R (Urban and Rural) for the following history variables: -EFLX_LH_TOT, FGR, FIRA, FSH, FSM, Q2M, QRUNOFF, RH2M, SoilAlpha, TG, TREFMNAV, -TREFMXAV, and TSA (missing _R for SoilAlpha as the regular SoilAlpha is only defined -for rural areas anyway) - - - -We are missing the Rural soil-alpha variable: SoilAlpha_R on purpose. -SoilAlpha_U is only defined over pervious road, and missing everywhere else. -SoilAlpha is defined only for rural areas. - - - - - - - - - - - -Quickstart to using &clm4; - -Before working with &clm4; read the QuickStart Guide in the -&cesmrel; -Scripts User's Guide. Once you are familiar with how to setup cases for -any type of simulation with &cesm; you will want to direct your attention to the specifics -of using &clm;. - - -For some of the details of setting up cases for &clm4; read the README and text files available -from the "models/lnd/clm/doc" directory (see the "&clm; Web pages" section for a link to the list -of these files). Here are the important ones that you should be familiar with. - -README file describing the directory structure. -Quickstart.userdatasets file describing how to -use your own datasets in the model (also see ). -&KnownBugs; file describing known -problems in &clm4; (that we expect to eventually fix). -KnownLimitations file -describing known limitations in &clm4; and workarounds that we do NOT expect to -fix. - - -The IMPORTANT_NOTES file is given in the next chapter on what -is functional/validated in &clm4;? - -The ChangeLog/ChangeSum files are largely explained in the previous chapter on "What is new with -&clm4;?" - -Note other directories have README files that explain different components and tools used -when running &clm; and are useful in -understanding how those parts of the model work and should be consulted when using tools in those directories. -For more details on configuring and customizing a case with &clm; see . - -The Quickstart.GUIDE (which can be found in -models/lnd/clm/doc) is repeated here. - -&quickstart_guide; - - - - -What is scientifically validated and functional in &clm4;? - -In this section we go over what has been extensively tested and scientifically validated -with &clm4;, and maybe more importantly what has NOT been tested and may NOT be -scientifically validated. You can use all features of &clm;, but need to realize that -some things haven't been tested extensively or validated scientifically. When you use -these features you may run into trouble doing so, and will need to do your own work to -make sure the science is reasonable. - - - -Standard Configuration and Namelist Options that are Validated - -The standard version of the model is &clmcn; at 1-degree horizontal resolution (0.9x1.25). This version has been scientifically -validated with long simulations for: fully coupled simulations ("B" cases), coupled to -atmosphere model CAM ("F" cases), and stand-alone &clm; -cases ("I" cases). We've also done both long simulations for 1850 conditions, and transient 20th century simulations from 1850 to 2005 (with -transient land-use, Nitrogen and Aerosol deposition). There have also been transient -future scenario simulations done for fully coupled cases for different "representative -concentration pathway" (RCP) scenarios (RCP2.6, RCP4.5, RCP6.0, and RCP8.5). -To a lesser extent there have also -been simulations done at T31 and 2-degree horizontal -resolution (1.9x2.5), and with &clmsp; for these resolutions. As such we have provided -appropriate 1-degree, 2-degree, and T31 initial condition -datasets for these configurations. The irrigation and prognostic crop models were both -validated at 2-degree resolution. The irrigation model for &clmsp; for present day -conditions for an "I" compset, and the prognostic crop model for present day conditions -for a case coupled to the active land model, but using a data ocean model (an "F" -compset). Other resolutions, configurations, and namelist options are less well tested or scientifically validated. -The further you get away from the standard configurations and resolutions, the more likely you are to run into trouble, and/or need to -scientifically validate your work. - - -In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You -are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even -with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case -you will need to go through more extensive work to validate these options from a scientific standpoint. - - - - -Configure Modes NOT scientifically validated, documented, supported or, in some -cases, even advised to be used: - - - - - C13(-c13) -The C13 mode for bgc=cn is NOT scientifically validated or documented and is NOT -recommended for use. - - - - - - CASA(-bgc casa) -The bgc=casa mode is NOT scientifically validated or documented and is NOT -recommended for use. - - - - - - SNICAR_FRC(-snicar_frc) - This mode is tested and functional, but is NOT constantly scientifically validated, and should be - considered experimental. - - - - - - - -Namelist options that should NOT be exercised: - -Build-Namelist options that should NOT be exercised: - - --irrig with -bgc cn -We have only run the irrigation model with &clmsp; (i.e. without the CN model). We -recommend that if you want to run the irrigation model with CN, that you do a spinup. -But, more than that you may need to make adjustments to -irrig_factor in -models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90. See the -notes on this in the description of the irrigation model in the - -Technical Descriptions of the Interactive Crop Management and Interactive -Irrigation Models. - - --irrig with -crop on -Irrigation doesn't work with the prognostic crop model. Irrigation is only applied to -generic crop currently, which negates it's practical usage. We also have a known -problem when both are on (see bug 1326 in the &KnownBugs; file). -If you try to run in this mode, the &clm; &buildnml; will return with an error. - - --lnd_res: Fine-mesh mode, functional, but experimental - --rcp: Representative Concentration Pathway (RCP) -for future scenarios, functional for limited resolutions, but experimental - --datm_*: All options that start with "datm_" they are -only used for &clm; stand-alone testing. - --drv_*: All options that start with "drv_" they are -only used for &clm; stand-alone testing. - - - - - - -Namelist items that should NOT be exercised: - - -casa namelist options: lnpp, lalloc, q10, spunup, and fcpool - - CASA has NOT been scientifically validated in &clm4;. - - - - suplnitro='ALL' - The suplnitro namelist option to the CN Biogeochemistry model supplies -unlimited nitrogen and therefore vegetation is over-productive in this mode. - - - -urban_traffic: Not currently functional - - - - - - - - - -What are the UNIX utilities required to use &clm;? - -Running the &clm; requires a suite of UNIX utilities and programs and you should -make sure you have all of these available before trying to go forward with using -it. If you are missing one of these you should contact the systems administrator -for the machine you wish to run on and make sure they are installed. - -&FORTRAN90; compiler -"C" compiler -GNU make -UNIX csh and tcsh shells -UNIX sh shell -UNIX bash shell -UNIX awk -UNIX sed -&netcdf; library -MPI Library -"C" pre-processor -&perl; -Autoconf -m4 macro processor -Parallel &netcdf; (optional) -&ncl; (for some of the offline tools for creating/modifying &clm; input -datasets see for more information on &ncl;) -Python (optional, needed for &ptclm;) -xsltproc, docbook and docbook utilities (optional, needed to build the Users-Guide) -protex and latex2html (optional, needed to build the Code-Reference Guide) - - - - - - - - - &cesm; Online Bulletin Board - &cesmrel; Scripts User's Guide - - -Other resources to get help from - - -In addition to this users-guide there are several other resources that are available -to help you use &clm4;. The first one is the &cesm; User's-Guide, which documents the entire -process of creating cases with &cesm;. The next is the &cesm; bulletin board which is -a web-site for exchanging information between users of &cesm;. There are also &clm; -web-pages specific for &clm;, and finally there is an email address to report bugs that -you find in &cesm1;. - - - -The &cesm; User's-Guide - -&clmrel; is always run from within the standard &cesmrel; build and run scripts. Therefore, the -user of &clm4; -should familiarize themselves with the &cesmrel; scripts and understand how to work with them. -User's-Guide documentation on the &cesmrel; scripts are available from the following web-page. The purpose -of this &clmrel; User's Guide is to give the &clm4; user more complete details on how to work -with &clm; and the set of tools that support &clm;, as well as to give examples that are unique to the use -of &clm;. However, the &cesmrel; Scripts User's-Guide remains the primary source to get detailed -information on how to build and run the &cesm; system. - -&cesm1; Scripts -User's-Guide - - - - - -The &cesm; Bulletin Board - -There is a rich and diverse set of people that use the &cesm;, and often it is useful to be in contact with -others to get help in solving problems or trying something new. To facilitate this we have an online -Bulletin Board for questions on the &cesm;. There are also different sections in the Bulletin Board for -the different component models or for different topics. - -&cesm; Online Bulletin Board - - - - - -The &clm; web pages - -The main &clm; web page contains information on the &clm;, it's history, developers, as well as -downloads for previous model versions. There are also documentation text files in the -models/lnd/clm/doc directory that give some quick information on using &clm;. - -&clm; web page -&clm; Documentation Text Files - -Also note that several of the XML database files can be viewed in a web browser to get -a nice table of namelist options, namelist defaults, or compsets. Simply view them -as a local file and bring up one of the following files: - -models/lnd/clm/bld/namelist_files/namelist_definition.xml --- definition of &clm; namelist items. -models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml --- default values for &clm; namelist items. -scripts/ccsm_utils/Case.template/config_definition.xml --- definition of all env_*.xml items. -scripts/ccsm_utils/Case.template/config_compsets.xml --- definition of all the compsets. -models/lnd/clm/bld/namelist_files/history_fields.xml --- definition of &clm; history fields. - - - - - -Reporting bugs in &clm4; - -If you have any problems, additional questions, bug reports, or any other feedback, please send an email to -cesmhelp@cgd.ucar.edu. If you find bad, wrong, or misleading information - in this users guide send an email to erik@ucar.edu. The current list of -known issues for &clmrel; is in the &KnownBugs; file, and the list of issues for -&cesmrel; is at... - -&cesmwebmodelrel;/tags/cesm1_0_3/#PROBLEMS -. - - - - - - - - diff --git a/doc/UsersGuide/ptclm.xml b/doc/UsersGuide/ptclm.xml deleted file mode 100644 index 6c0ef2aec8..0000000000 --- a/doc/UsersGuide/ptclm.xml +++ /dev/null @@ -1,992 +0,0 @@ - - -How to run &ptclm; - -&ptclm; (pronounced point clime) is a Python script to help you set up PoinT CLM -simulations. It runs the &clm; tools for you to get datasets set up, and copies them -to a location you can use them according to the &CLMUSRDAT; naming convention. Then -it runs create_newcase for you and modifies the env settings and -namelist appropriately. &ptclm; has a simple ASCII text file for storing basic -information for your sites. We also have complete lists for AmeriFlux and Fluxnet-Canada -sites, although we only have the meteorology data for one site. For other sites you -will need to obtain the meteorology data and translate it to a format that the &cesm; -datm model can use. But, even without meteorology data &ptclm; is useful to setup -datasets to run with standard &CLMQIAN; data. - - - -The original authors of &ptclm; are: Daniel M. Ricciuto, Dali Wang, Peter E. Thornton, -Wilfred M. Post all at Environmental Sciences Division, Oak Ridge National Laboratory -(ORNL) and R. Quinn Thomas at Cornell University. It was then modified -fairly extensively by Erik Kluzek at &ncar;. We want to thank all of these individuals -for this contribution to the &cesm; effort. We also want to thank the folks at -University of Michigan Biological Stations (US-UMB) who allowed us to use their Fluxnet -station data and import it into our inputdata repository, especially Gil Bohrer the -PI on record for this site. - - - -Introduction to PTCLM - -To get help on &ptclm; use the "--help" option as follows. - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -> ./PTCLM.py --help - - - -The output to the above command is as follows: - - - -&ptclm_help; - - - - -Here we give a simple example of using &ptclm; for a straightforward case of running -at the US-UMB Fluxnet site on bluefire where we already have the meteorology data on -the machine. Note, see for permission information -to use this data. - -Example of running &ptclm; for US-UMB on bluefire - -setenv CSMDATA /fis/cgd/cseg/csm/inputdata -setenv MYCSMDATA $HOME/inputdata -setenv SITE US-UMB -setenv MYMACH bluefire -setenv MYCASE testPTCLM - -# First link the standard input files to a location you have write access -cd scripts -./link_dirtree $CSMDATA $MYCSMDATA - -# Next build all of the clm tools you will need -cd ../models/lnd/clm/tools/mksurfdata -gmake -gmake clean -cd ../mkdatadomain -gmake -gmake clean -cd ../mkgriddata -gmake -gmake clean -# next run PTCLM (NOTE -- MAKE SURE python IS IN YOUR PATH) -cd ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM -./PTCLM.py -m $MYMACH --case=$MYCASE --site=$SITE --csmdata=$MYCSMDATA \ - --aerdepgrid --ndepgrid -# NOTE: we use --aerdepgrid --ndepgrid so that you use the global -# aerosol and Nitrogen deposition files rather than site-specific ones. -cd ../../../../../$MYCASE -# Finally configure, build, and run the case as normal - - - - - - -Guide to the options of &ptclm; - -There are three types of options to &ptclm;: required, configure/run-time, and -dataset generation options. The three required options are the three settings that -MUST be specified for &ptclm; to work at all. The other settings have default -values that will default to something useful. The configure/run-time options control -how the simulation will be setup and run. The dataset generation options control -the generation of datasets needed when &ptclm; is run. Most options use a double -dash "--" "longname" such as "--list", but the most common options also have a short-name -with a single dash (such as -m instead of --machine). - - -The required options to &ptclm; are: inputdata directory (-d), machine (-m) and -site-name (-s). Inputdata directory is the directory where you have the &cesm; -inputdata files, you need to have write access to this directory, so if you are -running on a machine that you do NOT have write access to the standard inputdata -location (such as &ncar; bluefire or ORNL jaguar) you need -to link the standard files to a location you do have control over. We recommend -using the scripts/link_dirtree tool to do that. "machine" is -the scripts name for the machine/compiler you will be using for your case. And -finally site-name is the name of the site that you want to run for. Site-name -can either be a valid &CLM1PT; supported dataset name or a Fluxnet site name -from the list of sites you are running on (see the --sitegroupname for more information -about the site lists). - - -After &ptclm; is run a case directory where you can then configure, build and run -your &cesm; case as normal. It also creates a README.PTCLM -in that directory that documents the commandline options to &ptclm; that were used -to create it. - - -After "help" the "list" option is one of the most useful options for getting -help on using &ptclm;. This option gives you information about some of the other -options to &ptclm;. To get a list of the machine, sites, and compsets that can be -used for &ptclm; use the "--list" option as follows. - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -> ./PTCLM.py --list - - - -The output to the above command is as follows: - - - -&ptclm_list; - - - - -Overview on using &ptclm; - -Steps in running &ptclm; - -Setup Inputdata directory with write access (use -<command>link_dirtree</command> script) - -You need to setup an inputdata directory where you have write access to it. -Normally, for &ncar; machines the data is on an inputdata where the user -does NOT have write access to it. A way that you can get around this is -to use the link_dirtree script to create softlinks from -the normal location to a location you have write access to. So for example -on bluefire: - -> setenv CSMDATA /fs/cgd/csm/inputdata -> setenv MYCSMDATA $HOME/inputdata -> mkdir $MYCSMDATA -> cd scripts -> ./link_dirtree $CSMDATA $MYCSMDATA - -See for more information on this. - - - -Build the &clm; tools - -Next you need to make sure all the &clm; &FORTRAN; tools are built. - -> cd models/lnd/clm/tools/mkgriddata -> gmake -> gmake clean -> cd ../mkdatadomain -> gmake -> gmake clean -> cd ../mksurfdata -> gmake -> gmake clean - - - - -Run &ptclm; - -Next you actually run &ptclm; which does the different things listed below: - - - -&ptclm; names your case based on your input - -&ptclm; names you case based on the input you give to it. - -[Prefix_]SiteCode_Compset[_QIAN][_spinuptype] -Where: - Prefix is from the caseidprefix option (or blank if not used). - SiteCode is the site name you entered with the -s option. - Compset is the compset name you entered with the -c option. - _QIAN is part of the name only if the useQIAN is used. - _spinuptype is part of the name if one of: ad_spinup, exit_spinup, or - final_spinup is used, and the exact spinup name chosen is used. - -For example, the casename for the following will be: - -> cd scripts -> ./PTCLM.py -m bluefire -s US-UMB -d $MYCSMDATA -c I_2000_CN --ad_spinup --useQIAN - -"US-UMB_I_2000_CN_QIAN_ad_spinup". - - - -&ptclm; creates datasets for you - -It will populate $MYCSMDATA with new datasets it creates using the -&clm; tools. - - - -If a transient compset and &ptclm; finds a <filename>_dynpftdata.txt</filename> -file - -If you are running a transient compset (such as the "I_1850-2000_CN" compset) -AND you there is a file in the PTCLM_sitedata directory under -the &ptclm; directory called $SITE_dynpftdata.txt it will use -this file for the land-use changes. Otherwise it will leave land-use constant, unless -you use the pftgrid option so it uses the global dataset for landuse changes. -See for more information on this. There -is a sample transient dataset called US-Ha1_dynpftdata.txt. -Transient compsets, are compsets that create transient land-use change and -forcing conditions such as: -'I_1850-2000', 'I_1850-2000_CN', 'I_RCP8.5_CN', 'I_RCP6.0_CN', 'I_RCP4.5_CN', -or 'I_RCP2.6_CN'. - - - -&ptclm; creates a <filename>pft-physiology</filename> for you - -&ptclm; will create a local copy of the pft-physiology -specific for your site that you could then customize with changes specific -for that site. - - - -&ptclm; creates a <filename>README.PTCLM</filename> for you - -&ptclm; will create a simple text file with the command line for it in a file -called README.PTCLM in the case directory it creates for you. - - - - - - -Customize, configure, build and run case as normal - -You then customize your case as you would normally. See the chapter for more information on doing this. - - - - - - - -Details on the options of &ptclm; - -Next we discuss the configure and run-time options, dividing them up into -configure, spinup, and run-time options. - - -Configure options include: - --c MYCOMPSET, --compset=MYCOMPSET ---caseidprefix=MYCASEID ---cesm_root=BASE_CESM ---namelist=NAMELIST ---rmold ---scratchroot=SCRATCHROOT ---sitegroupname=SITEGROUP ---QIAN_tower_yrs ---useQIAN - - - - - ---compset - -The "-c" option is the most commonly used option after the required options, as it -specifies the &cesm; scripts component set to use with &ptclm;. The default compset -is the "ICN" compset with CN on for present day conditions. - - - - - ---caseidprefix - -This option gives a prefix to include in the casename when the case is created, in -case you want to customize your casenames a bit. By default, casenames are figured -out based on the other options. The argument to this option can either be a name to -prefix casenames with and/or a pathname to include. Hence, if you want cases to -appear in a specific directory you can give the pathname to that directory with this -option. - - - - - ---cesm_root - -This option is for running &ptclm; with a different root directory to &cesm; than the -version &ptclm; exists in. Normally you do NOT need to use this option. - - - - - ---namelist - -This option adds any items given into the &clm; &usernlclm; namelist. This allows you to -add customizations to the namelist before the clm.buildnml.csh file -is created for the case. - - - - - ---rmold - -This option will remove an old case directory of the same name if one exists. Otherwise, -if an old case directory already exists and you try to run &ptclm; it will return with -an error. - - - - - ---scratchroot - -This option is ONLY valid when using one of the generic machines (the -m option). -This passed onto create_newcase and gives the location where cases -will be built and run. - - - - - ---sitegroupname - -In the &ptclm; directory there is a subdirectory "PTCLM_sitedata" that contains -files with the site, PFT and soil data information for groups of sites. These site groups -are all separate ASCII files with the same prefix followed by a "_*data.txt" name. -See for more information on these files. -By default we have provided three different valid group names: - -EXAMPLE -AmeriFlux -Fluxnet-Canada - -The EXAMPLE is the group used by default and ONLY includes the US-UMB site as that -is the only site we have data provided for. The other two site groups include the -site information for all of both the AmeriFlux and Fluxnet-Canada sites. You can use -the "sitegroupname" option to use one of the other lists, or you can create your own -lists using the EXAMPLE file as an example. Your list of sites could be real world -locations or could be theoretical "virtual" sites given to exercise &clm; on -differing biomes for example. Note, see with -permission information to use the US-UMB data. - - - - - ---useQIAN - -This option says to use the standard &clm; global Qian T62 atmospheric forcing rather -than any tower site forcing data available. Otherwise, &ptclm; will try to find tower -forcing data for the specific site entered. - - - - - ---QIAN_tower_yrs - -This option is used with the "useQIAN" option to set the years to cycle over for -the Qian data. In this case Qian atmospheric forcing will be used, but the -simulation will run over the same years that tower site is available for this site. - - - - - - -Spinup options include: - ---coldstart ---ad_spinup ---exit_spinup ---final_spinup ---finidat=FINIDAT - - - - -The spinup options enable the different CN spinup modes, but also set the run -length. The coldstart option says to startup with OUT an initial condition file, while -the finidat option explicitly gives the initial condition file to use. Obviously, -the different spinup options can NOT be used together, nor can the coldstart and -finidat options be either. - - ---coldstart - -This option ensures that a cold-start will be done with arbitrary initial conditions. - - - - - ---ad_spinup - -This option enables the accelerated decomposition mode when a CN compset is used. It -also sets the run-length as given in the example for running exit spinup in -. - - - - - ---exit_spinup - -This option enables the exit spinup mode when a CN compset is used. It also sets the -run-length to a year just as given in the example for running exit spinup in -. - - - - - ---final_spinup - -This option sets the run length as given in the example for a final spinup in -. This option can be used for any compset. - - -There is a bug in the final_spinup mode for setting the run length. Because of the -bug, final_spinup mode only runs for a very short time, you'll need to edit -the run length by hand to be 50 years. See bug 1367 in the &KnownBugs; file. - - - - - - - ---finidat - -This option sets the initial condition file to startup the simulation from. - - - - - - - - - -Run-time options include: - ---debug ---run_n=MYRUN_N ---run_units=MYRUN_UNITS ---stdurbpt - - - - - - - ---debug - -This option tells &ptclm; to echo what it would do if it were run, but NOT actually -run anything. So it will show you the dataset creation commands it would use. -It does however, run create_newcase, but then it only displays -the xmlchange commands and changes that it would do. Also note -that if you give the "--rmold" option it won't delete the case directory beforehand. -Primarily this is intended for debugging the operation of &ptclm;. - - - - - ---run_n - -This option along with run_units is used to set the length for the simulation. "run_n" -is the number of units to use. -The default run length depends on the site, compset, -and configuration and for example if a "spinup" option is selected. - - - - - ---run_units - -This option is the units of time to use for the length of the simulation. It is used -along with "run_n" to set the length of the simulation. -The default run length depends on the site, compset, -and configuration and for example if a "spinup" option is selected. - - - - - ---stdurbpt - -This option turns on the "stdurbpt_pd" use-case for &CLMUSECASE;. This option -can NOT be used for compsets that set the use-case to something besides present-day. - - - - - - - - -Lastly we discuss the dataset generation options. The dataset generation options are: - ---aerdepgrid ---ndepgrid ---pftgrid ---soilgrid ---nopointdata ---owritesrfaer - - - - -The options that with a "grid" suffix all mean to create datasets using the global -gridded information rather than using the site specific point data. By default the -site specific point data is used. The "nopointdata" and "owritesrfaer" options have to -do with file creation. - - -Because supported single-point datasets already have the data created for them, you -MUST use the "nopointdata" and "ndepgrid" options when you are using a supported -single-point site. You must use "ndepgrid" even for a compset without CN. You also -can NOT use the options: "soilgrid", "pftgrid", "aerdepgrid", or "owritesrfaer". - - - - - ---aerdepgrid - -This option says to use the aerosol deposition files from the global dataset rather -than creating an interpolated version. - - -This option must NOT be used when you you are using a site that -is a supported single point dataset. - - - - - ---ndepgrid - -This option says to use the Nitrogen deposition files from the global dataset rather -than creating an interpolated version. This is only needed for compsets with CN. - - - -This option is required when you you are using a site that -is a supported single point dataset. This is true even when you are NOT using a -compset with CN. - - - - - - ---pftgrid - -This option says to use the PFT values provided on the global dataset rather than -using the specific site based values from the -PTCLM_sitedata/*_pftdata.txt file when creating the surface dataset. - - -This option must NOT be used when you you are using a site that -is a supported single point dataset. - - - - - ---soilgrid - -This option says to use the soil values provided on the global dataset rather than -using the specific site based values from the -PTCLM_sitedata/*_soildata.txt file when creating the surface dataset. - - -This option must NOT be used when you you are using a site that -is a supported single point dataset. - - - - - ---nopointdata - -This option says to NOT create any input datasets -- assume this step has already been -done. If datasets weren't already created, your case will fail when you try to run it. -In general the first time you run &ptclm; for a new site you want it to generate new -datasets, but the next time and future times you want to use this option so that it -doesn't waste a lot of time rebuilding datasets over again. - - - -This option is required when you you are using a site that -is a supported single point dataset. - - - - - - ---owritesrfaer - -This option says to overwrite any surface and/or aerosol deposition datasets that -were already created. Otherwise, the creation of these files will be skipped if a file -is already found (but it WILL create files if they don't exist). - - -This option must NOT be used when you you are using a site that -is a supported single point dataset. - - - - - - - - -Note on the aerosol and Nitrogen deposition files. When the "aerdepgrid" and "ndepgrid" -options are NOT used -- aerosol and Nitrogen deposition files will be created by -interpolating from the global datasets. However, after these interpolated files -are created you could customize them for your site with data that you provide. You -could then write protect the files and use the "nopointdata" option so that &ptclm; -doesn't try to overwrite them in the future. - - - - - - -Examples using &ptclm; - -Now let's give a few more complex examples using some of the options we have -discussed above. - - -In this first example, we'll demonstrate using a supported single point dataset, -which then requires using the "nopointdata" and "ndepgrid" options. We'll also -demonstrate the compset option, "stdurbpt" and "caseidprefix" options. - -Example of running &ptclm; for the Mexicocity supported single point -dataset - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -> ./PTCLM.py -m bluefire -s 1x1_mexicocityMEX -d $CSMDATA --nopointdata --ndepgrid \ ---stdurbpt -c I --caseidprefix `pwd`/myPTCLMcases/site -> cd myPTCLMcases/site_1x1_mexicocityMEX_I -> ./configure -case -# Now build and run normally -> ./site_1x1_mexicocityMEX_I.bluefire.build -# Here we show running interactively -> ./site_1x1_mexicocityMEX_I.bluefire.run - - - - - -Now, let's demonstrate using a different group list, doing a spinup, running with Qian -global forcing data, but using tower years to set the years to run over. This uses -the options: sitegroupname, ad_spinup, useQIAN, and QIANtower_years. - -Example of running &ptclm; for a spinup simulation with Qian data for tower years. - - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -> ./PTCLM.py -m bluefire -s US-Ha1 -d $CSMDATA --sitegroupname AmeriFlux \ ---ad_spinup --useQIAN --QIAN_tower_yrs -> cd ../../../../../US-Ha1_ICN_QIAN_ad_spinup -> ./configure -case -# Now build and run normally -> ./US-Ha1_ICN_QIAN_ad_spinup.bluefire.build -# Here we show running interactively -> ./US-Ha1_ICN_QIAN_ad_spinup.bluefire.run - - - - - -Finally, let's demonstrate using a generic machine (which then requires the scratchroot -option), using the global grid for PFT and soil types, and setting the run length -to two months. - -Example of running &ptclm; on a generic machine with global PFT and soil types -dataset - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -# Note, see the with permission information -# to use the US-UMB data. -> ./PTCLM.py -m generic_darwin_intel -s US-UMB -d $CSMDATA --pftgrid --soilgrid \ ---scratchroot $HOME --run_n 2 --run_units nmonths -> cd ../../../../../US-UMB_ICN -> ./configure -case -# Now build -> ./US-UMB_ICN.generic_darwin_intel.build -# To get the files from the svn server... -# First list the files from the streams text file -> ../ccsm_utils/Tools/listfilesin_streams \ --t $HOME/US-UMB_ICN/run/clm1PT.1x1pt_US-UMB.stream.txt -l \ -> Buildconf/datm.input_data_list -# And now run the script to export data to your machine -> ../ccsm_utils/Tools/check_input_data -export -# Here we show running interactively -> ./US-UMB_ICN.generic_darwin_intel.run - - - - -Because of Bug 1364, when running this case as above we get a floating point -error after reaching time-step 124 for the example exactly as above. Other -machines or compilers probably won't have this problem. See the &KnownBugs; file -for more information on this problem. - - - - -As documented in Bug 1368, spinning up the US-UMB site for a I2000CN compset gives -zero Gross Primary Production (GPP). If the user wishes to use this site for &clmcn;, -they'll need to address this issue. -See the &KnownBugs; file for more information on this problem. - - - - - - -Adding data for use by &ptclm; - -&ptclm; Group Site Lists - -The "sitegroupname" option to &ptclm; looks for groups of sites in the -files in the PTCLM_sitedata directory under the &ptclm; directory. -You can add new names available for this option including your own lists of sites, by -adding more files in this directory. There are three files for each "sitegroupname": -$SITEGROUP_sitedata.txt, -$SITEGROUP_soildata.txt -and $SITEGROUP_pftdata.txt (where $SITEGROUP is the name that would -be entered as "sitegroupname" to &ptclm;). Each file needs to have the same list of sites, -but gives different information: site data, PFT data, and soil data respectively. -Although the site codes need to be the same between the three files, the files do NOT -have to be in the same order. Each file has a one-line header that lists the contents -of each column which are separated by commas. The first column for each of the files -is the "site_code" which must be consistent between the three files. The site code -can be any unique character string, but in general we use the AmeriFlux site code. - - -Site data file: $SITEGROUP_sitedata.txt): The header for -this file is: - -site_code,name,state,lon,lat,elev,startyear,endyear,alignyear - -The columns: name, state, and elevation are informational only. Name is a longer -descriptive name of the site, and state is the state for U.S. sites or country -for non U.S. sites. The columns: lon and lat are the longitude and latitude of -the location in decimal degrees. The last three columns are the start and ending -year for the data and the align year for an 1850 case for the data. The align year -is currently unused. - - -Soil data file: $SITEGROUP_soildata.txt): The header for this -file is: - -site_code,soil_depth,n_layers,layer_depth,layer_sand%,layer_clay% - -The first three fields after "site_code" are currently unused. The only two that -are used are the percent sand and clay columns to set the soil texture. - - -PFT data file: $SITEGROUP_pftdata.txt): The header for this -file is: - -site_code,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5 - -This file gives the vegetation coverage for the different vegetation types for the site. -The file only supports up to five PFT's at the same time. The columns with "pft_f" are -the fractions for each PFT, and the columns with "pft_c" is the integer index of the -given PFT. Look at the pft-physiology file to see what the PFT index for each PFT type -is. - - - - -Dynamic Land-Use Change Files for use by &ptclm; - -There is a mechanism for giving site-specific land-use change in &ptclm;. Adding -site specific files to the PTCLM_sitedata directory under -&ptclm; allows you to specify the change in vegetation and change in harvesting -(for the CN model) for that site. Files are named: -$SITE_dynpftdata.txt. There is a sample file for the US-Ha1 -site called: US-Ha1_dynpftdata.txt. The file has a one-line -header with the information that the file has, and then one-line for each year -with a transition. The header line is as follows: - -trans_year,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5,har_vh1,har_vh2,har_sh1,har_sh2,har_sh3,graze,hold_harv,hold_graze - -This file only requires a line for each year where a transition or harvest happens. As -in the "pftdata" file above "pft_f" refers to the fraction and "pft_c" refers to the -PFT index, and only up to five vegetation types are allowed to co-exist. The last -eight columns have to do with harvesting and grazing. The last two columns are whether -to hold harvesting and/or grazing constant until the next transition year and will -just be either 1 or 0. This file will be converted by the -PTCLM_sitedata/cnvrt_trnsyrs2_landuse_timeseries_txtfile.pl script in the &ptclm; -directory to a format that mksurfdata can read that has an entry -for each year for the range of years valid for the compset in question. - - - - -Converting AmeriFlux Data for use by &ptclm; - -AmeriFlux data comes in comma separated format and is available from: - -http://public.ornl.gov/ameriflux/dataproducts.shtml. Before you -download the data you need to agree to the usage terms. - - -Here is a copy of the usage terms from the web-site on June/13/2011. - - -"The AmeriFlux data provided on this site are freely available and were furnished by -individual AmeriFlux scientists who encourage their use. Please kindly inform the -appropriate AmeriFlux scientist(s) of how you are using the data and of any publication -plans. Please acknowledge the data source as a citation or in the acknowledgments if the -data are not yet published. If the AmeriFlux Principal Investigators (PIs) feel that they -should be acknowledged or offered participation as authors, they will let you know and we -assume that an agreement on such matters will be reached before publishing and/or use of -the data for publication. If your work directly competes with the PI's analysis they may -ask that they have the opportunity to submit a manuscript before you submit one that uses -unpublished data. In addition, when publishing, please acknowledge the agency that -supported the research. Lastly, we kindly request that those publishing papers using -AmeriFlux data provide preprints to the PIs providing the data and to the data archive at -the Carbon Dioxide Information Analysis Center (CDIAC)." - - -The above agreement applies to the "US-UMB" dataset imported into our repository as -well, and Gil Bohrer is the PI on record for that dataset. - - -The &cesm; can NOT handle missing data, so we recommend using the "Level 4" Gap filled -datasets. -The fields will also need to be renamed. The "WS" column becomes "WIND", "PREC" becomes -"PRECmms", "RH" stays as "RH", "TA" becomes "TBOT", "Rg" becomes "FSDS", "Rgl" becomes -"FLDS", "PRESS" becomes "PSRF". "ZBOT" can just be set to the constant of "30" (m). -The units of Temperature need to be converted from "Celsius" to "Kelvin" (use the -value in SHR_CONST_TKFRZ in the file -models/csm_share/shr/shr_const.F90 of 273.15. -The units of Pressure also need to be converted from "kPa" to "Pa". LATIXY, and -LONGXY should also be set to the latitude and longitude of the site. - - - -&ptclm; transient example over a shorter time period - - -Example of running &ptclm; for transient land-use 1991-2006 for US-Ha1 on bluefire - -This is an example of using &ptclm; for Harvard Forest (AmeriFlux site code US-Ha1). In -order to do this we would've needed to have converted the AmeriFlux data into &netcdf; -format as show in the section above. Also note -that this site has a site-specific dynamic land-use change file for it -PTCLM_sitedata/US-Ha1_dynpftdata.txt in the &ptclm; directory -and this file will be used for land-use change and harvesting rather than the -global dataset. - - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -# We are going to use forcing data over 1991 to 2006, but we need to start with -# a transient compset to do so, so we use the 20th Century transient: 1850-2000 -# Note: When creating the flanduse_timeseries dataset for this site it will use the -# PTCLM_sitedata/US-Ha1_dynpftdata.txt -# file for land-use change and harvesting -> ./PTCLM.py -m bluefire -s US-Ha1 -d $MYCSMDATA --sitegroupname AmeriFlux \ --c I_1850-2000_CN -> mkdir $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 -> cd $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 -# Copy data in &netcdf; format to this directory, filenames should be YYYY-MM.nc -# The fieldnames on the file should be: -# FLDS,FSDS,LATIXY, LONGXY, PRECTmms,PSRF,RH,TBOT,WIND,ZBOT -# With units -# W/m2,W/m2,degrees_N,degrees_E,mm/s, Pa, %, K, m/s, m -# The time coordinate units should be: days since YYYY-MM-DD 00:00:00 -> cd ../../../../../US-Ha1_I_1850-2000_CN -# We need to turn cold-start on, so it doesn't expect an initial condition file -# preferably, you would generate your own initial condition file and then use -# the --finidat option to &ptclm; to enter it -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -# Now we need to set the start date to 1991, and have it cycle forcing data -# over 1991 to 2006 -> ./xmlchange -file env_conf.xml -id RUN_STARTDATE -val 1991-01-01 -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_ALIGN -val 1991 -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_END -val 2006 -> ./xmlchange -file env_conf.xml -id CLM_NAMELIST_OPTS -val \ -# Similarly for Nitrogen deposition data we cycle over: 1991 to 2006 -"model_year_align_ndep=1991,stream_year_first_ndep=1991,stream_year_last_ndep=2006" -# Now configure the case, and we'll edit the datm namelist for prescribed aerosols -> ./configure -case -# We also need to change the datm to run with aerosols over the 1991-2006 period -cat << EOF > patch.diff -*** datm.buildnml.csh.orig 2011-06-14 09:28:20.000000000 -0600 ---- datm.buildnml.csh 2011-06-14 09:28:57.000000000 -0600 -*************** -*** 32,38 **** - dataMode = 'CLMNCEP' - domainFile = '$DOMAINFILE' - streams = 'clm1PT.1x1pt_US-Ha1.stream.txt 1991 1991 2006 ', -! 'presaero.stream.txt 1849 1849 2006' - vectors = 'null','null' - mapmask = 'nomask','nomask' - mapalgo = 'nn','nn' ---- 32,38 ---- - dataMode = 'CLMNCEP' - domainFile = '$DOMAINFILE' - streams = 'clm1PT.1x1pt_US-Ha1.stream.txt 1991 1991 2006 ', -! 'presaero.stream.txt 1991 1991 2006' - vectors = 'null','null' - mapmask = 'nomask','nomask' - mapalgo = 'nn','nn' -EOF -# Apply the above patch to the datm build namelist file -> patch Buildconf/datm.buildnml.csh patch.diff - - - - - - -Because of bug 1361, this won't work out of the box. You'll need to add the change -to PTCLM.py given in the KnownBugs file on this issue. - - - - - - - - -A bit about the structure of &ptclm;, what it does, and how it works - -A large part of &ptclm; just sets up the different options and does error checking -on the options given. &ptclm; then uses the options provided to use -create_newcase to create a new case. It then queries both the -case directory and/or the XML database (using -queryDefaultNamelist.pl in models/lnd/clm/bld -and does other settings for the case. It then runs the different &clm; tools in turn to -create the necessary datasets and points to them in the case with the &CLMUSRDAT; option. -It runs mkgriddata, mksurfdata.pl, and -mkdatadomain as well as the aerdepregrid.ncl and -ndepregrid.ncl &ncl; scripts. mkgriddata and -mkdatadomain have template namelist files in the -scripts/ccsm_utils/Tools/lnd/clm/PTCLM/usr_files directory. -When running mksurfdata.pl if it finds a -$SITE_dynpftdata.txt in the -scripts/ccsm_utils/Tools/lnd/clm/PTCLM/PTCLM_sitedata directory -it will use that file for transient landuse changes (there's a sample file for -"US-Ha1" called US-Ha1_dynpftdata.txt). -It modifies the different env*.xml using -xmlchange and creates an initial &usernlclm; filename. After -&ptclm; is run you can then make changes to the case by hand, and configure, build -and run as normal. - - -There is a simple test script to test &ptclm;. See -for more information on using it. - - - - - diff --git a/doc/UsersGuide/single_point.xml b/doc/UsersGuide/single_point.xml deleted file mode 100644 index b07f76ecb6..0000000000 --- a/doc/UsersGuide/single_point.xml +++ /dev/null @@ -1,930 +0,0 @@ - - - -How to run Single-Point/Regional cases - -The &clm; also allows you to set up and run cases with a single-point or a local region as well -as global resolutions. This is often useful for running quick cases for testing, evaluating -specific vegetation types, or land-units, or running with observed data for a specific site. -There are four different ways to do this: &PTSMODE;, -&CLM1PT;, &CLMUSRDAT;, and with &ptclm;. - -&PTSMODE; -- to run for a single point -using global datasets. -&CLM1PT; -- to run for a supported single-point -or regional dataset. -&CLMUSRDAT; -- to run using your own datasets (single-point -or regional). -&ptclm; -- to easily setup simulations to run for -tower sites.. - - - - -&PTSMODE; and &ptclm; only work for a single point, while the other two options can -also work for regional datasets as well. - - - -Which Single Point Option Should I choose? - -In general is the quick and dirty method -that gets you started without having to create datasets -- but has limitations. It's -good for an initial attempt at seeing results for a point of interest, but since you -can NOT restart with it, it's usage is limited. It is the quickest method as you can -create a case for it directly from create_newcase. Although you -can't restart, running a single point is very fast, and you can run for long -simulation times even without restarts. If you need restarts a good solution is to use -getregional_datasets.pl and &CLMUSRDAT; -which can get you running almost as quickly as well as -&PTSMODE;. Like -&PTSMODE; - only runs for points that exist within -a global dataset. - - -Running &CLM1PT; is a great solution, if one of the supported -single-point/regional datasets, is your region of interest (see -). All the datasets are -created for you, and you can easily select one and run, pretty much, out of the box -with it. The problem is that there is a very limited set of supported datasets. You -can also use this method for your own datasets, but you have to create the datasets, -and add them to the XML database and to the &datm;. This is worthwhile if you want to -repeat many multiple cases for a given point or region. - - -Next, &CLMUSRDAT; is the best way to setup cases quickly -where you have to create your own datasets (see -). With this method you don't have to -change &datm; or add files to the XML database -- but you have to follow a strict -naming convention for files. However, once the files are named and in the proper -location, you can easily setup new cases that use these datasets. This is good -for treating all the required datasets as a "group" and for a particular -model version. For advanced &clm; developers who need to track dataset changes with -different model versions you would be best off adding these datasets as supported -datasets with the &CLM1PT; method. - - -Lastly &ptclm; is a great way to easily create datasets, -setup simulations and run simulations for tower sites. It takes advantage of both -&CLM1PT; and &CLMUSRDAT; internally. A big advantage to it, is that it's one-stop -shopping, it runs tools to create datasets, and runs create_newcase -and sets the appropriate env variables for you. So you only have to learn how to run -one tool, rather than work with many different ones. &ptclm; is described in the next -chapter . - - -Finally, if you also have meteorology data that you want to force your &clm; simulations -with you'll need to setup cases as described in . -You'll need to create &clm; datasets either according to &CLM1PT; -or &CLMUSRDAT;, but you'll also need to modify &datm; to use -your forcing data. And you'll need to change your forcing data to be in a format that -&datm; can use. In the &ptclm; chapter the -section tells you how to use AmeriFlux data for atmospheric forcing. - - - - -Running &PTSMODE; configurations - -&PTSMODE; enables you to run the model using global datasets, but just picking a -single point from those datasets and operating on it. It can be a very quick way to do fast -simulations and get a quick turnaround. - - -To setup a &PTSMODE; simulation you use the "-pts_lat" and "-pts_lon" -arguments to create_newcase to give the latitude and longitude of the point you want to -simulate for (the code will pick the point on the global grid nearest to the point you -give. Here's an example to setup a simulation for the nearest point at 2-degree resolution -to Boulder Colorado. - -> cd scripts -> ./create_newcase -case testPTS_MODE -res f19_g16 -compset I -mach bluefire \ --pts_lat 40.0 -pts_lon -105 -> cd testPTS_MODE -# We make sure the model will start up cold rather than using initial conditions -> ./xmlchange -file env_conf.xml -id &CLMFORCECOLD; -val on -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup - -Then configure, build and run as normal. We make sure initial conditions are NOT used -since &PTSMODE; currently CAN NOT run with initial conditions. - - - -By default it sets up to run with -USE_MPISERIAL (in the env_build.xml file) turned on, -which allows you to run the model interactively. On some machines this mode is NOT -supported and you may need to change it to FALSE before you are able to build. - - - - -&PTSMODE; currently does NOT restart nor -is it able to startup from global initial condition files. See bugs "1017 and 1025" -in the KnownLimitations file. - - - - -You can change the point you are simulating for at run-time by changing the values of -PTS_LAT and PTS_LON in the env_run.xml file. - - - - -Note, that when running with &PTSMODE; the number of processors -is automatically set to one. When running a single grid point you can only use a single -processor. You might also want to set the "env_conf" variable: USE_MPISERIAL to -TRUE so that you can also run interactively without having to use -&mpi; to start up your job. - - - - -Warning about Running with a Single-Processor on a Batch Machine - -This problem always comes up when running for a single point, because you can only use -a single-processor, but may come up in other instances when you are running with -one processor. This applies to all the different ways of running in single-point mode. - - - -A warning for submitting single-point simulations to the batch que when only using -one processor. On many machines this will mean using up at least an entire node, and -being charged for all the CPU's on that node even if you aren't using them. For example, -on the &ncar; machine bluefire, there are 32 processors for each node -and the batch scripts are setup to have exclusive use of that node (and hence be charged -for all 32 processors). There are similar issues on other machines, below we show you -what to do when running on bluefire. - - -To change this on bluefire -- change the following: - -#BSUB -q regular -#BSUB -N -#BSUB -x - -to... - -#BSUB -q share -#BSUB -N - -so remove the "#BSUB -x" which gives you the entire node exclusively, and change to the -share que. One other machines you may have to do something similar, but the particulars -depend on the given machine, hence you will need to consult with the system -administrators for the given machine you are running on. - - - - -Another similar problem on many machines is that some batch ques have a minimum number -of nodes or processors that can be used. On these machine you may have to change the -queue (in some way similar to the above for bluefire) and possibly the time-limits of -the job, to get it to run in the batch que. - - - -Another way to get around this problem is to run the job interactively using -USE_MPISERIAL so that you don't submit the job to the batch que. -For single point mode you also may want to consider using a smaller workstation or -cluster, rather than a super-computer, because you can't take advantage of the -multi-processing power of the super-computer anyway. - - - - -Running Supported Single-point/Regional Datasets - -In addition to &PTSMODE; the &clm; supports running using single-point or -regional datasets that are customized to a particular region. In the section below we -tell the user how to create their own dataset, but we also support a small number of -single-point and regional datasets that are ready to setup and run in the CESM modeling -system. - - -To get the list of supported dataset resolutions see the methodgiven in the -section on use of &CLM1PT;, which results in the following: - -&res_list; - -The resolution names that have an underscore in them ("_") are all single-point or -regional resolutions. -To run with the supported single-point and regional datasets, you setup a simulation for the -"pt1_pt1" resolution and give the short-name for the file to use in the -env_conf.xml file. - - -To run for the Brazil test site -do the following: - -Example of running &clm; over a single-point test site in Brazil -with the default Qian atmosphere data forcing. - - -> cd scripts -> ./create_newcase -case testSPDATASET -res pt1_pt1 -compset I \ --mach bluefire -> cd testSPDATASET -# Configure to run for the test site -> set SITE=1x1_brazil -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-sitespf_pt $SITE" -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val $SITE - - - - -Then configure, build and run normally. - - -Then to run for the urban Mexico City Mexico test site that also has atmosphere -forcing data, but to run it with the Qian forcing data, but over the period for -which it's own forcing data is provided do the following: - -Example of running &clm; over the single-point of Mexicocity Mexico -with the default Qian atmosphere data forcing. - - -> cd scripts -> ./create_newcase -case testSPDATASET -res pt1_pt1 -compset I \ --mach bluefire -> cd testSPDATASET -# Set a variable to the site you want to use (as it's used several times below) -> set SITE=1x1_mexicocityMEX -# Configure to run for the urban test site -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-sitespf_pt $SITE" -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val $SITE -# Set &datm; prescribed aerosols to single-point dataset -# Will then use the dataset with just the point for this $SITE -> ./xmlchange -file env_conf.xml -id DATM_PRESAERO -val pt1_pt1 -# -# Set some of the settings that are particular to this site, by values contained -# in the XML database. For some sites, or for new sites this information won't be -# stored. And the queryDefaultNamelist.pl command will abort. -# -# Set &datm; start and end range (optional just to run over the same years that -# atmospheric forcing data is available for this site) -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_START -val \ -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var datm_cycle_beg_year -justvalue` -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_END -val \ -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var datm_cycle_end_year -justvalue` - - - - -Then configure, build and run normally. - - - -Just like &PTSMODE; above, By default it sets up to run with -USE_MPISERIAL (in the env_build.xml file) turned on, -which allows you to run the model interactively. On some machines this mode is NOT -supported and you may need to change it to FALSE before you are able to build. - - - - -See for a warning about running single-point jobs -on batch machines. - - - - -Note, that when running a pt1_pt1 resolution the number of processors -is automatically set to one. When running a single grid point you can only use a single -processor. You might also want to set the "env_conf" variable: USE_MPISERIAL to -TRUE so that you can also run interactively without having to use -mpi to start up your job. - - - -Running Supported Single-point Datasets that have their own Atmospheric Forcing - -Of the supported single-point datasets we have three that also have atmospheric forcing data -that go with them: Mexico City (Mexico), Vancouver, (Canada, British Columbia), and -urbanc_alpha (test data for an Urban inter-comparison project). Mexico city and Vancouver -also have "#ifdef" in the source code for them to work with modified urban data -parameters that are particular to these locations. They can be turned on by using -the &CLMCONFIG; &envconf; variable to set the "-sitespf_pt" option in the &clm; -&configure;. To turn on the atmospheric forcing for these datasets, you set the -&envconf; DATM_MODE variable to "CLM1PT", and then the atmospheric -forcing datasets will be used for the point picked. - - -When running with datasets that have their own atmospheric forcing you need to be careful -to run over the period that data is available. If you have at least one year of forcing -it will cycle over the available data over and over again no matter how long of a simulation -you run. However, if you have less than a years worth of data (or if the start date doesn't -start at the beginning of the year, or the end date doesn't end at the end of the year) then -you won't be able to run over anything but the data extent. In this case you will need to -carefully set the RUN_STARTDATE, START_TOD and -STOP_N/STOP_OPTION variables for your case to run over the entire time extent -of your data. For the supported data points, these values are in the XML database -and you can use the queryDefaultNamelist.pl script to query the values -and set them for your case (they are set for the three urban test cases: Mexicocity, Vancouver, and -urbanc_alpha). - - -In the example below we will show how to do this for the Vancouver, Canada point. - - -Example of running &clm; over the single-point of Vancouver Canada with -supplied atmospheric forcing data for Vancouver. - - -> cd scripts -# Create a case at the single-point resolutions -> ./create_newcase -case testSPDATASETnAtmForcing -res pt1_pt1 -compset I \ --mach bluefire -> cd testSPDATASETnAtmForcing -# Set a variable to the site you want to use (as it's used several times below) -> set SITE=1x1_vancouverCAN -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-sitespf_pt $SITE" -# Now set the CLM single-point variable to the site name -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val $SITE -# Set the aerosols to use the single-point dataset for 2000 conditions -# You could also use the default global dataset, but running would be a bit slower -> ./xmlchange -file env_conf.xml -id DATM_MODE -val CLM1PT -# Set the coupling frequency to once an hour -> ./xmlchange -file env_conf.xml -id ATM_NCPL -val 24 -# Set the standard namelist options for an urban test site -> ./xmlchange -file env_conf.xml -id CLM_NML_USE_CASE -val stdurbpt -# Set many of the settings that are particular to this site, by values contained -# in the XML database. For some sites, or for new sites this information won't be -# stored. And the queryDefaultNamelist.pl command will abort. -# -# Set the start date -> setenv RUN_STARTDATE \ -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var run_startdate -justvalue` -> setenv STARTDATE `echo $RUN_STARTDATE | sed s/-//g` -> @ START_YEAR = $STARTDATE / 10000 -> ./xmlchange -file env_conf.xml -id RUN_STARTDATE -val $RUN_STARTDATE -# Set the run length and start time of day -> ./xmlchange -file env_run.xml -id STOP_OPTION \ --val `../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist seq_timemgr_inparm -silent -var stop_option -justvalue` -> setenv STOP_N \ -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist seq_timemgr_inparm -silent -var stop_n -justvalue` -> ./xmlchange -file env_run.xml -id STOP_N -val $STOP_N -> ./xmlchange -file env_run.xml -id START_TOD \ --val `../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist seq_timemgr_inparm -silent -var start_tod -justvalue` -# Set &datm; start and end range... -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_START -val -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var datm_cycle_beg_year -justvalue` -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_END -val -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var datm_cycle_end_year -justvalue` -# Set the User namelist to set the output frequencies of the history files -# Setting the stdurbpt use-case option create three history file streams -# The frequencies and number of time-samples needs to be set -> cat << EOF > &usernlclm; -&clm_inparm - hist_mfilt = $STOP_N,$STOP_N,$STOP_N - hist_nhtfrq = -1,-1,-1 -/ -EOF -# Set align year to start year as defined above -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_ALIGN -val $START_YEAR -# Set &datm; prescribed aerosols to single-point dataset -# Will then use the dataset with just the point for this site -> ./xmlchange -file env_conf.xml -id DATM_PRESAERO -val pt1_pt1 -> ./configure -case - - - - -If you don't set the start-year and run-length carefully as shown above the -model will abort with a "dtlimit error" in the atmosphere model (see bug 1110 in -the KnownLimitations file for documentation on this). Since, the forcing data for -this site (and the MexicoCity site) is less than a year, the model won't be able to -run for a full year. The 1x1_urbanc_alpha site has data for more -than a full year, but neither year is complete hence, it has the same problem (see the -problem for this site above). - - - - -Just like &PTSMODE; above, By default it sets up to run with -USE_MPISERIAL (in the env_build.xml file) turned on, -which allows you to run the model interactively. On some machines this mode is NOT -supported and you may need to change it to FALSE before you are able to build. - - - - -See for a warning about running single-point jobs -on batch machines. - - - - -Note, that when running a pt1_pt1 resolution the number of processors -is automatically set to one. When running a single grid point you can only use a single -processor. You might also want to set the "env_conf" variable: USE_MPISERIAL to -TRUE so that you can also run interactively without having to use -mpi to start up your job. - - - - - - -Creating your own single-point/regional surface datasets - -The file: -Quickstart.userdatasets in the -models/lnd/clm/doc directory gives guidelines on how to create and run -with your own single-point or regional datasets. Below we reprint the above guide. - -&quickstart_userdata; - - - - -Using getregional_datasets.pl to get a complete suite of single-point/regional -surface datasets from global ones - -Use the regional extraction script to get regional datasets from the global ones -The getregional_datasets.pl script to extract out regional datasets of interest. -Note, the script works on all files other than the "finidat" file as it's a 1D vector file. -The script will extract out a block of gridpoints from all the input global datasets, -and create the full suite of input datasets to run over that block. The input datasets -will be named according to the input "id" you give them and the id can then be used -as input to &CLMUSRDAT; to create a case that uses it. See -the section on &clm; Script Configuration Items for -more information on setting &CLMUSRDAT; (in ). The list of files extracted by -their name used in the namelists are: -fatmgrid, fatmlndfrc, -fsurdat, flanduse_timeseries, -stream_fldfilename_ndep, and the &datm; files -domainfile, and faerdep. -For more information on these files see the Table on required files. - - -The alternatives to using this script are to use &PTSMODE;, -discussed earlier, to use &ptclm; discussed in the next chapter, or creating the files -individually using the different file creation tools (given in the -Tools Chapter). Creating -all the files individually takes quite a bit of effort and time. &PTSMODE; -has some limitations as discussed earlier, but also as it uses global files, is -a bit slower when running simulations than using files that just have the set -of points you want to run over. Another advantage is that once you've created the -files using this script you can customize them if you have data on this specific -location that you can replace with what's already in these files. - - -The script requires the use of both "Perl" and "NCL". See the NCL Script section in the Tools Chapter -on getting and using NCL and NCL scripts. The main script to use is a &perl; script -which will then in turn call the NCL script that actually creates the output files. -The ncl script gets it's settings from environment variables set by the perl script. -To get help with the script use "-help" as follows: - -> cd models/lnd/clm/tools/ncl_scripts -> ./getregional_datasets.pl -help - -The output of the above is: - -&getreg_datasets; - - - -The required options are: -id, --ne, and -se, for the output identifier -name to use in the filenames, latitude and longitude of the Northeast corner, and -latitude and longitude of the SouthEast corner (in degrees). Options that specify -which files will be used are: -mask, -res, --rcp, -sim_year, and -sim_yr_rng -for the land-mask to use, global resolution name, representative concentration pathway -for future scenarios, simulation year, and simulation year range. The location of the -input and output files will be determined by the option -mycsmdata -(can also be set by using the environment variable $CSMDATA). If -you are running on a machine like at &ncar; where you do NOT have write permission -to the CESM inputdata files, you should use the scripts/link_dirtree -script to create soft-links of the original files to a location that you can write -to. This way you can use both your new files you created as well as the original -files and use them from the same location. - - -The remaining options to the script are -debug, -and -verbose. -debug is used to show what -would happen if the script was run, without creating the actual files. --verbose adds extra log output while creating the files so you -can more easily see what the script is doing. - - -For example, Run the extraction for data from 52-73 North latitude, 190-220 longitude -that creates 13x12 gridcell region from the f19 (1.9x2.5) global resolution over Alaska. - -Example of running <command>getregional_datasets.pl</command> to get -datasets for a specific region over Alaska - -> cd scripts -# First make sure you have a inputdata location that you can write to -# You only need to do this step once, so you won't need to do this in the future -> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data -> ./link_dirtree $CSMDATA $MYCSMDATA -> cd ../models/lnd/clm/tools/ncl_scripts -> ./getregional_datasets.pl -sw 52,190 -ne 73,220 -id 13x12pt_f19_alaskaUSA -mycsmdata $MYCSMDATA - - -Repeat this process if you need files for multiple sim_year, resolutions, land-masks, -and sim_year_range values. - - - -See for a warning about running single-point jobs -on batch machines. - - - - -See for notes about managing your data -when using link_dirtree. - - - -Now to run a simulation with the datasets created above, you create a single-point -case, and set &CLMUSRDAT; to the identifier used above. Note that in the example below -we set the number of processors to use to one (-pecount 1). For a single point, you -should only use a single processor, but for a regional grid, such as the example below -you could use up to the number of grid points (12x13=156 processors. - - -Example of using &CLMUSRDAT; to run a simulation using user datasets for a -specific region over Alaska - -> cd scripts -# Create the case and set it to only use one processor -> ./create_newcase -case my_userdataset_test -res pt1_pt1 -compset I1850 \ --mach bluefire -> cd my_userdataset_test/ -> ./xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA -> ./xmlchange -file env_conf.xml -id &CLMUSRDAT; -val 13x12pt_f19_alaskaUSA -> ./xmlchange -file env_conf.xml -id &CLMBLDNML; -val '-mask gx1v6' -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val 13x12pt_f19_alaskaUSA -> ./configure -case - - - - - - - -Running with your own atmosphere forcing - -Here we want to run with our own customized datasets for &clm; as well as -running with our own supplied atmosphere forcing datasets. Thus we effectively -combine the information from with -. First we need to follow -the procedures in to come up with &clm; -datasets that are customized for our point or region in question. This includes -running link_dirtree to create a directory location where you -can add your own files to it. Next, set -DATM_MODE to "CLM1PT" and &CLM1PT; and &CLMUSRDAT; to the -id of the data you created. To see a list of what the filenames need to be -see the section on setting &CLMUSRDAT;. - - -Next we need to setup the atmosphere forcing data in &netcdf; format that can be -read by &datm;. There is a list of eight variables that are expected to be on the input -files with the names and units on the following table (in the table TDEW and SHUM -are optional fields that can be used in place of RH). In the table we also list -which of the fields are required and if not required what the code will do to -replace them. If the names of the fields are different or the list is changed -from the standard list of eight fields: FLDS, FSDS, PRECTmms, -PSRF, RH, TBOT, WIND, and ZBOT, the resulting streams file will need to be modified -to take this into account (see an example streams file for this in below). - -Atmosphere Forcing Fields - - - - Short-name - Description - Units - Required? - If NOT required how replaced - - - - - FLDSincident longwave -(FLDS)W/m2No -calculates based on Temperature, Pressure and Humidity - - - FSDSincident solar -(FSDS)W/m2Yes- - - - FSDSdifincident solar (FSDS) -diffuseW/m2Nobased on FSDS - - - FSDSdirincident solar (FSDS) -directW/m2Nobased on FSDS - - - PRECTmmsprecipitation -(PRECTmms)mm/sYes- - - - PSRFpressure at the lowest atm level -(PSRF)PaNoassumes standard-pressure - - - RHrelative humidity at the lowest atm level -(RH)%Nocan be replaced with SHUM or TDEW - - - SHUMspecific humidity at the lowest atm level -kg/kgOptional in place of RHcan be replaced with RH or TDEW - - - TBOTtemperature at the lowest atm level -(TBOT)K (or can be C)Yes- - - - TDEWdew point temperature -K (or can be C)Optional in place of RHcan be replaced with RH or SHUM - - - WINDwind at the lowest atm level -(WIND)m/sYes- - - - ZBOTobservational heightmNo -assumes 30 meters - - - -
    -All of the variables should be dimensioned: time, lat, lon, with time being the unlimited -dimension. The coordinate variable "time" is also required with CF-compliant units in -days, hours, minutes, or seconds. It can also have a calendar attribute that can -be "noleap" or "gregorian". Normally the files will be placed in the: -$MYCSMDATA/atm/datm7/CLM1PT_data/$MYUSRDAT directory with separate files per -month called YYYY-MM.nc where YYYY-MM corresponds to the four -digit year and two digit month with a dash in-between. You also need a domain file that -gives the coordinate information for the data that should be placed in: -$MYCSMDATA/atm/datm7/domain.lnd.$MYUSRDAT_USGS.nc. - -Example of setting up a case with your own atmosphere forcing - -> cd scripts -# First make sure you have a inputdata location that you can write to -# You only need to do this step once, so you won't need to do this in the future -> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data -> ./link_dirtree $CSMDATA $MYCSMDATA -# Next create and move all your datasets into $MYCSMDATA with id $MYUSRDAT -# See above for naming conventions - -# Now create a single-point case -> ./create_newcase -case my_atmforc_test -res pt1_pt1 -compset I1850 \ --mach bluefire -> cd my_atmforc_test -# Set the data root to your inputdata directory, and set &CLM1PT; and &CLMUSRDAT; -# to the user id you created for your datasets above -> ./xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val $MYUSRDAT -> ./xmlchange -file env_conf.xml -id &CLMUSRDAT; -val $MYUSRDAT -# Set the land-mask to USGS, so both clm and &datm; can find files -> ./xmlchange -file env_conf.xml -id &CLMBLDNML; -val '-mask USGS' -# Then set DATM_MODE to single-point mode so &datm; will use your forcing datasets -# Put your forcing datasets into $MYCSMDATA/atm/datm7/CLM1PT_data/$MYUSRDAT -> ./xmlchange -file env_conf.xml -id DATM_MODE -val CLM1PT -> ./configure -case -# If the list of fields, or filenames, filepaths, or fieldnames are different -# you'll need to edit the &datm; namelist streams file to make it consistent -> $EDITOR Buildconf/datm.buildnml.csh - - -
    - - -See for a warning about running single-point jobs -on batch machines. - - - - -See for notes about managing your data -when using link_dirtree. - - - - -Now, we'll show an example of what the &datm; streams file might look like for a case -with your own forcing data with 3-hourly forcing. In this example, we'll leave off the -fields: ZBOT, and FLDS so they'll be calculated as given in the - table above. We'll also include: -FSDSdif and FSDSdir which aren't required, and we'll use TDEW in place of RH. In this -example the datafiles are in &netcdf; format and contain the fields: TA, Tdew, WS, -PREC, Rg, Rgdir, Rgdif, and PRESS which are translated into the &datm; internal names -in this streams file. There is also a domain file that has the position information -for this location. The normal assumption for CLM1PT mode in the &datm; is that data is -hourly or half-hourly and as such is often enough that using the data on the nearest -time-stamp is reasonable and as such the data is in a single streams file (see - for more information on -the default settings for &datm; and how to change them. If the data is less often three to six hours -- see -below, where you will need to modify the time-interpolation method as well as the -time stamp offsets. In the example below we also have to divide the single -stream file into three files to manage the time-stamps and time interpolation -algorithm for the different types of data differently. - -Example of &datm; streams files with your own forcing for 3-hourly data - -Precipitation streams file -(clm1PT.1x1pt_lapazMEX.precip.stream.txt file) . - - -<streamstemplate> -<stream> - <dataSource> - CLMNCEP - </dataSource> - <domainInfo> - <variableNames> - time time - xc lon - yc lat - area area - mask mask - </variableNames> - <filePath> - $DIN_LOC_ROOT/atm/datm7/domain.clm - </filePath> - <fileNames> - domain.lnd.1x1pt_lapazMEX_navy.nc - </fileNames> - </domainInfo> - <fieldInfo> - <variableNames> - PRECTmms PREC - </variableNames> - <offset> - -5400 - </offset> - <filePath> - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/1x1pt_lapazMEX - </filePath> - <fileNames> - 2004-01.nc - 2004-02.nc - 2004-03.nc -. -. -. - 2009-12.nc - </fileNames> - </fieldInfo> -</stream> -</streamstemplate> - - -Solar streams file (clm1PT.1x1pt_lapazMEX.solar.stream.txt file). - - -<streamstemplate> -<stream> - <dataSource> - CLMNCEP - </dataSource> - <domainInfo> - <variableNames> - time time - xc lon - yc lat - area area - mask mask - </variableNames> - <filePath> - $DIN_LOC_ROOT/atm/datm7/domain.clm - </filePath> - <fileNames> - domain.lnd.1x1pt_lapazMEX_navy.nc - </fileNames> - </domainInfo> - <fieldInfo> - <variableNames> - FSDS Rg - FSDSdir Rgdir - FSDSdif Rgdif - </variableNames> - <offset> - -10800 - </offset> - <filePath> - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/1x1pt_lapazMEX - </filePath> - <fileNames> - 2004-01.nc - 2004-02.nc - 2004-03.nc -. -. -. - 2009-12.nc - </fileNames> - </fieldInfo> -</stream> -</streamstemplate> - - -Other fields streams file. -(clm1PT.1x1pt_lapazMEX.other.stream.txt file) . - - -<streamstemplate> -<stream> - <dataSource> - CLMNCEP - </dataSource> - <domainInfo> - <variableNames> - time time - xc lon - yc lat - area area - mask mask - </variableNames> - <filePath> - $DIN_LOC_ROOT/atm/datm7/domain.clm - </filePath> - <fileNames> - domain.lnd.1x1pt_lapazMEX_navy.nc - </fileNames> - </domainInfo> - <fieldInfo> - <variableNames> - TBOT TA - TDEW Tdew - WIND WS - PSRF PRESS - </variableNames> - <offset> - -5400 - </offset> - <filePath> - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/1x1pt_lapazMEX - </filePath> - <fileNames> - 2004-01.nc - 2004-02.nc - 2004-03.nc -. -. -. - 2009-12.nc - </fileNames> - </fieldInfo> -</stream> -</streamstemplate> - - -Example streams namelist for the above streams files: - - - &shr_strdata_nml - dataMode = 'CLMNCEP' - domainFile = '$DOMAINFILE' - streams = 'clm1PT.1x1pt_lapazMEX.solar.stream.txt 1 2004 2009 ', - 'clm1PT.1x1pt_lapazMEX.precip.stream.txt 1 2004 2009 ', - 'clm1PT.1x1pt_lapazMEX.other.stream.txt 1 2004 2009 ', - 'presaero.stream.txt 1 2000 2000' - vectors = 'null','null','null','null' - mapmask = 'nomask','nomask','nomask','nomask' - mapalgo = 'nn','nn','nn','nn' - tintalgo = 'coszen','nearest','linear','linear' - taxmode = 'cycle','cycle','cycle','cycle' - / - - - - - -The example above shows the resolved namelist and streams file after &configure; -has been run. In order to save this configuration for future use, you would need -to edit the &datm; template adding new DATM_MODE see - for more information on how to do this. - - - - -We've outlined and given a few examples of using your own atmosphere -forcing. In the next chapter we go into the details of using &ptclm;. - - -
    - -
    - diff --git a/doc/UsersGuide/special_cases.xml b/doc/UsersGuide/special_cases.xml deleted file mode 100644 index ac5c7fef3b..0000000000 --- a/doc/UsersGuide/special_cases.xml +++ /dev/null @@ -1,916 +0,0 @@ - - -How to run some special cases - -In this chapter we describe how to run some special cases that take more than one step -to do. The straightforward cases have compsets and/or build-namelist use-cases setup for -them or require simple editing of a single-case. All of the cases here require you -to do at least two simulations with different configurations, or require more complex -editing of the case (changing the streams files). - - -The nine cases we will describe are: - - - -Running with the prognostic crop model on - - - - -Running with the irrigation model on - - - - -Spinning up the Satellite Phenology Model (&clmsp; spinup) - - - - -Spinning up the biogeochemistry Carbon-Nitrogen Model (CN spinup) - - - - -Spinning up the Carbon-Nitrogen Dynamic Global Vegetation Model (CNDV spinup) - - - - -Running with MOAR data as atmospheric forcing to spinup the model - - - - -Running with your own previous simulation as atmospheric forcing to spinup the model - - - - -Doing perturbation error growth tests - - - - -Running stand-alone &clm; with transient historical &CO2; -concentration - - - - - - -The cases in this chapter are more sophisticated and require more technical knowledge -and skill than cases in previous chapters. The user should be very familiar with doing -simple cases before moving onto the cases described here. - - - -Running with the prognostic crop model on - - -In &clmcesm103; a prognostic crop model was added to &clm4;. The prognostic crop -model is setup to work with CN for present day conditions and we have surface -and initial condition datasets at f19 resolution. In order to use the initial condition -file, we need to set the RUN_TYPE to startup rather -than hybrid since the compset for f19 sets up to use an initial -condition file without crop active. To activate the crop model we simply add "-crop on" -to &CLMCONFIG;. - -Example Crop Simulation - -> cd scripts -> ./create_newcase -case CROP -res f19_g16 -compset ICN -mach bluefire -> cd CROP -# Append "-crop on" to &CLMCONFIG; in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-crop on" -append -# Change to startup type so uses spunup initial conditions file for crop if it exists -# By default the model will do a hybrid startup with an initial condition file -# incompatible with the crop surface dataset. -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -> ./configure -case -# Now build and run normally -> ./CROP.bluefire.build -> ./CROP.bluefire.submit - - - - - - -Running with the irrigation model on - - -In &clmcesm103; an irrigation model for generic crop was added to &clm4;. Currently, -irrigation and crop can NOT be used together see bug number 1326 in the -&KnownBugs; file. -The irrigation model is tuned to work only with &clmsp; see the caution below for -for more information on this. To turn on -irrigation we simply add "-irrig on" to &CLMBLDNML;. Just as in the crop example we -also change RUN_TYPE to startup so that we don't use -an initial condition file that is incompatible with irrigation. - -Example Irrigation Simulation - -> cd scripts -# Note here we do a &clmsp; simulation as that is what has been validated -> ./create_newcase -case IRRIG -res f19_g16 -compset I -mach bluefire -> cd IRRIG -# Append "-irrig on" to &CLMBLDNML; in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id &CLMBLDNML; -val "-irrig" -append -# Change to startup type so uses spunup initial conditions file for irrigation if it exists -# By default the model will do a hybrid startup with an initial condition file -# incompatible with the irrigation surface dataset. -> xmlchange -file env_conf.xml -id RUN_TYPE -val startup -> ./configure -case -# Now build and run normally -> ./IRRIG.bluefire.build -> ./IRRIG.bluefire.submit - - - - -We have only run the irrigation model with &clmsp; (i.e. without the CN model). We -recommend that if you want to run the irrigation model with CN, that you do a spinup -as outlined in the examples below. But, more than that you may need to make -the adjustments we discuss in . - - - - - - -Spinning up the Satellite Phenology Model (&clmsp; spinup) - - -To spin-up the &clmsp; model you merely need to run &clmsp; for 50 simulation -years starting from arbitrary initial conditions. You then use the final -restart file for initial conditions in other simulations. -Because, this is a straight forward operation we will NOT give -the details on how to do that here, but leave it as an exercise for the reader. -See the as an example of doing this -as the last step for &clmcn;. - - - - -Spinning up the biogeochemistry Carbon-Nitrogen Model (CN spinup) - -To get the &clmcn; model to a steady state, you first run it from arbitrary initial conditions -using the "accelerated decomposition spinup" (-ad_spinup in configure) mode for 600 simulation years. After -this you branch from this mode in the "exit spinup" (-exit_spinup in configure), run -for a simulation year, and then save a restart from that and use it as initial conditions -for further spinup of CN (at least 50 simulation years). - - -Spinup of &clmcn; - -AD_SPINUP - -For the first step of running 600 years in "-ad_spinup" mode, you will setup -a case, and then edit the values in env_conf.xml and -env_run.xml so that the right configuration is turned on and -the simulation is setup to run for the required length of simulation time. -So do the following: - -Example AD_SPINUP Simulation - -> cd scripts -> ./create_newcase -case CN_spinup -res f19_g16 -compset ICN -mach bluefire -> cd CN_spinup -# Append "-ad_spinup on" to &CLMCONFIG; in env_conf.xml -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-ad_spinup on" -append -# The following sets &CLMFORCECOLD; to "on" in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id &CLMFORCECOLD; -val on -# Make the output history files only annual, by adding the following to the &usernlclm; namelist -> echo '&clm_inparm hist_nhtfrq = -8760 /' > &usernlclm; -# Now configure -> ./configure -case -> ./xmlchange -file env_run.xml -id STOP_DATE -val 6010101 -# Now build -> ./CN_spinup.bluefire.build -# The following sets RESUBMIT to 30 times in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id RESUBMIT -val 30 -# The following sets STOP_OPTION to "nyears" in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -# The following sets STOP_N to 20 years in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_N -val 20 -# The following sets STOP_DATE to Jan/1 of year 601 in env_run.xml (you could also use an editor) -# Now run normally -> ./CN_spinup.bluefire.submit - - -Afterwards save the last restart file from this simulation to use in the next step. - - - - -EXIT_SPINIP - - -Example EXIT_SPINUP Simulation - -> cd scripts -> ./create_newcase -case CN_exitspinup -res f19_g16 -compset ICN -mach bluefire -> cd CN_exitspinup -# Append "-exit_spinup on" to &CLMCONFIG; in env_conf.xml -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-exit_spinup on" -append -# Change run type to branch and branch from the last year of the last simulation -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val branch -> ./xmlchange -file env_conf.xml -id RUN_REFCASE -val CN_spinup -> ./xmlchange -file env_conf.xml -id RUN_REFDATE -val 0601-01-01 -> ./xmlchange -file env_conf.xml -id GET_REFCASE -val FALSE -> ./configure -case -# Go ahead and build, so that the run directory is created -> ./CN_exitspinup.bluefire.build -# Now, Copy the last restart files from the earlier case into your run directory -> cp /ptmp/$LOGIN/archive/CN_spinup/rest/CN_spinup.*.r*.0601-01-01-00000* /ptmp/$LOGIN/CN_exitspinup -# And copy the rpointer files for datm and drv from the earlier case -> cp /ptmp/$LOGIN/archive/CN_spinup/rest/rpointer.atm /ptmp/$LOGIN/CN_exitspinup -> cp /ptmp/$LOGIN/archive/CN_spinup/rest/rpointer.drv /ptmp/$LOGIN/CN_exitspinup -# The following sets STOP_OPTION to "nyears" in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -> ./xmlchange -file env_run.xml -id STOP_N -val 1 -# Now run normally -> ./CN_exitspinup.bluefire.submit - - - - - - -Final spinup - -Next save the last restart file from this step and use it as the "finidat" file to -use for one more spinup for at least 50 years in normal mode. -So do the following: - -Example Final CN Spinup Simulation - -> cd scripts -> ./create_newcase -case CN_finalspinup -res f19_g16 -compset ICN -mach bluefire -> cd CN_finalspinup -# The following sets &CLMFORCECOLD; to "on" in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id &CLMFORCECOLD; -val on -# Now, Copy the last &clm; restart file from the earlier case into your run directory -> cp /ptmp/$LOGIN/archive/CN_exitspinup/rest/CN_exitspinup.clm*.r*.0602-01-01-00000.nc \ -/ptmp/$LOGIN/CN_finalspinup -# And copy the rpointer files for datm and drv from the earlier case -> cp /ptmp/$LOGIN/archive/CN_exitspinup/rest/rpointer.atm /ptmp/$LOGIN/CN_finalspinup -> cp /ptmp/$LOGIN/archive/CN_exitspinup/rest/rpointer.drv /ptmp/$LOGIN/CN_finalspinup -# Set the finidat file to the last restart file saved in previous step -> echo '&clm_inparm finidat = "CN_exitspinup.clm2.r.0602-01-01-00000.nc" /' > &usernlclm; -# Now configure -> ./configure -case -> $EDITOR Buildconf/clm.buildnml.csh -> Now build -> .CN_finalspinup.bluefire.build -# The following sets RESUBMIT to 5 times in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id RESUBMIT -val 5 -# The following sets STOP_OPTION to "nyears" in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -# The following sets STOP_N to 10 years in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_N -val 10 -> Now run as normal -> .CN_finalspinup.bluefire.submit - - - - -To assess if the model is spunup plot trends of CN variables of interest. If you see -a trend, you may need to run the simulation longer. -Finally save the restart file from the end of this simulation to use as an "finidat" file for future -simulations. - - - - - - -Spinning up the Carbon-Nitrogen Dynamic Global Vegetation Model (CNDV spinup) - -To spinup the &clm; CNDV model -- you first follow the procedures above to spinup the CN model. -Then you take the CN initial state file you created for the spinup with just CN, and -run CNDV for 200 more years. -We've provided such spunup files for two resolutions (f09 and f19) and two time-periods -(1850 and 2000), so in this example we will use the files provided to start from. -We've also provided a spinup file at f19 resolution for CNDV, hence the following is -NOT required when running at f19. -If you were to start from your own &clmcn; spunup files -- the procedure would require -some modification. -There are no compsets using CNDV, so in -env_conf.xml change CLM_CONFIG_OPTS to --bgc cndv. - -Example CNDV Spinup Simulation - -> cd scripts -> ./create_newcase -case CNDV_spinup -res f09_g16 -compset ICN -mach bluefire -> cd CNDV_spinup -# Set run type to startup and do a cold start -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -# The following sets CLM_CONFIG_OPTS to "-bgc cndv" in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id CLM_CONFIG_OPTS -val "-bgc cndv" -# Make the default primary history file annual and add an annual 1D vector auxiliary file -# By putting the following in a &usernlclm; file. -> cat << EOF > &usernlclm; -&clm_inparm - hist_nhtfrq = -8760, -8760 - hist_mfilt = 1, 1 - hist_fincl2 = 'TLAI', 'TSAI', 'HTOP', 'HBOT', 'NPP' - hist_dov2xy = .true., .false. -/ -> ./configure -case -# NOTE: If you were using your own CN spinup files you would edit the namelist to use it -# $EDITOR Buildconf/clm.buildnml.csh -# -# Now build and run as normal -> ./CNDV_spinup.bluefire.build -# The following sets RESUBMIT to 10 times in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id RESUBMIT -val 10 -# The following sets STOP_OPTION to "nyears" in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -# The following sets STOP_N to 20 years in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_N -val 20 -# Make sure you turn archiving on, so you save your files to long term archival -> ./xmlchange -file env_run.xml -id DOUT_L_MS -val TRUE -> ./CNDV_spinup.bluefire.submit - - - - - -There is a build bug with &clmcesm103; see bug 1370 in the &KnownBugs; on -how to address this. - - - - - -In a data analysis tool you should examine the auxiliary file and examine the -pfts1d_wtgcell to see where and what types of vegetation have -been established. See the caution in for more -information on visualizing and analyzing 1D vector fields. - - - -CNDV also writes out two vector fields to "hv" auxiliary files, on an annual basis by -default. - - - - -We've provided a spinup file for CNDV at f19 resolution, you could also use -interpinic to interpolate this file to other resolutions. - - - - - -Running with MOAR data as atmospheric forcing to spinup the model - -Because it takes so long to spinup the CN model (as we just saw previously), if you -are doing fully coupled simulations with active atmosphere and ocean, you will want -to do the spinup portion of this "offline". So instead of doing expensive fully -coupled simulations for the spinup duration, you run &clm; in a very cheap "I" -compset using atmospheric forcing from a shorter fully coupled simulation -(or a simulation run previously by someone else). - - -In this example we will use the I1850SPINUPCN compset to setup -&clm; to run with atmospheric forcing from a previous fully coupled simulation with -data that is already stored on disk on bluefire. There are several simulations that -have high frequency data for which we can do this. You can also do this on a machine -other than bluefire, but would need to download the data from the Earth System Grid and -change the datapath similar to . -This compset is designed for constant -1850 conditions, but unfortunately (because of bug 1354 see the &KnownBugs; file) by -default it points to a transient simulation instead of an 1850 simulation. Here we -point to an 1850 simulation and setup the forcing years to run over. - -Example Simulation with MOAR Data on bluefire - -> cd scripts -> ./create_newcase -case MOARforce1850 -res f19_g16 -compset I1850SPINUPCN -mach bluefire -> cd MOARforce1850 -# The following sets the casename to point to for atm forcing (you could also use an editor) -> ./xmlchange -file env_conf.xml -id DATM_CPL_CASE -val b40.1850.track1.1deg.006a -# The following sets the align year and years to run over for atm forcing -# (you could also use an editor) -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_ALIGN -val 1 -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_START -val 960 -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_END -val 1030 -> ./configure -case -# Now build and run as normal -> ./MOARforce1850.bluefire.build -> ./MOARforce1850.bluefire.submit - - - - -Because of bug 1339 (see the &KnownBugs; file on this) -you can't run with 83 or more years of forcing. If you do need to run with more years of -forcing, you'll need to address the issue as outlined in the &KnownBugs; file. - - - - - - -Running with your own previous simulation as atmospheric forcing to spinup the model - -Another way that you might want to spinup the model is to run your own simulation -for a relatively short period (either a B, E, or F compset) and then use it as forcing -for your "I" case later. By only running 20 to 50 years for the fully coupled case, -you'll save a substantial amount of computer time rather than running the entire spinup -period with a fully coupled model. - - -The first thing we need to do is to run a fully coupled case and save the atmospheric -coupling fields on a three hourly basis. In this example, we will run on bluefire -and archive the data to a local disk that we can then use in the next simulation. - -Example Fully Coupled Simulation to Create Data to Force Next Example Simulation - -> cd scripts -> ./create_newcase -case myBCN1850 -res f09_g16 -compset B1850CN -mach bluefire -> cd myBCN1850 -> ./configure -case -# Set histaux_a2x3hr to .true. in cpl.buildnml.csh so output from the atmosphere model -# will be saved 3 hourly -$EDITOR BuildConf/cpl.buildnml.csh -# Now build -> ./myBCN1850.bluefire.build -# The following sets the archival disk space (you could also use an editor) -> ./xmlchange -file env_run.xml -id DOUT_S_ROOT -val '/glade/home/$USER/$CASE' -# Make sure files are archived to disk, but NOT to long term storage -# (you could also use an editor) -> ./xmlchange -file env_run.xml -id DOUT_S -val TRUE -> ./xmlchange -file env_run.xml -id DOUT_L_MS -val FALSE -# Set the run length to run a total of 20 years (you could also use an editor) -> ./xmlchange -file env_run.xml -id RESUBMIT -val 9 -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -> ./xmlchange -file env_run.xml -id STOP_N -val 2 -# Now run as normal -> ./myBCN1850.bluefire.submit - - - - -Now we run an I compset forced with the data from the previous simulation using -the &CPLHIST; option to DATM_MODE. See - for more information on the -&datm; settings for &CPLHIST; mode. - -Example Simulation Forced with Data from the Previous Simulation - -> cd scripts -> ./create_newcase -case frcwmyBCN1850 -res f09_g16 -compset I1850SPINUPCN -mach bluefire -> cd frcWmyBCN1850 -# The following sets the casename to point to for atm forcing (you could also use an editor) -> ./xmlchange -file env_conf.xml -id DATM_CPL_CASE -val "myBCN1850" -# The following sets the align year and years to run over for atm forcing -# (you could also use an editor) -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_ALIGN -val "1" -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_START -val "1" -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_END -val "20" -# Set the datapath in the template to the archival path from the case above -> sed -E 's#set datapath = ".+"#set datapath = "/glade/home/$USER/%c/cpl/hist"#' \ - Tools/Templates/datm.cpl7.template > new.datm.cpl7.template -> mv -f new.datm.cpl7.template Tools/Templates/datm.cpl7.template -> chmod +x Tools/Templates/datm.cpl7.template -> ./configure -case -# Now build and run as normal -> ./frcwmyBCN1850.bluefire.build -> ./frcwmyBCN1850.bluefire.submit - - - - -In order to accomplish this we needed to edit the &datm; template file. See - for more information on doing this. -If your input case was at a resolution besides f09 you would have to edit -the &datm; template file even further to use a domain file at the input resolution. - - - - - - -Doing perturbation error growth tests - -Doing perturbation error growth tests is a way to validate a port of -the model to a new machine or to verify that changes are only roundoff. -The steps are the same in either case, but in the discussion below I will -assume you are doing a port validation to a new machine (but in parentheses -I will put a reminder that it could also be for code-mods). -The basic idea is to run a case on the trusted machine (trusted code) and -another with initial conditions perturbed by roundoff and compare the results of -the two. The difference between these two simulations (the error) will grow over time -and describe a curve that we compare with the error growth on the new machine (code -changes). The error growth on the new machine is the difference between the non-perturbed -state on the trusted machine and the non-perturbed state on the new machine (code -changes). If the new machine (code changes) are well-behaved -the plot of this error growth compared to the error growth curve on the trusted machine -should be similar. If the -changes are NOT well-behaved the changes from the new machine (code changes) will be -larger than the perturbation changes. In summary the simulations and steps that need to be performed are: - - -Run a simulation with the trusted code on the trusted machine. -(optionally you can use a dataset from inputdata repository). - - - -Run a simulation with the trusted code on the trusted machine with initial conditions -perturbed by roundoff (using a namelist item to do so). -(this is optional is you are using inputdata repository datasets) - - - -Run a simulation with the new code on the non-trusted machine (code changes). - - -Do a plot of the RMS difference of history variables between simulation 1 and simulation 2. - - -Do a plot of the RMS difference of history variables between simulation 1 and simulation 3. - - -Compare the two plots in steps 4 and 5. - - -If the plots compare well the new machine (code changes) is running as well as the trusted machine. - - -If the plots do NOTcompare well the new machine is -NOTrunning as well as the trusted machine. Typically the -recommendation here is to lower the optimization level on the new machine and try -again (or in the case of code changes, modify or simplify the code changes to get -something that should be closer). - -The history variables we have used to do this is either 'TSOI', and/or 'TSA'. 'TSOI' are -the 3D snow and soil temperatures for vegetated land-units. If there is a change in -soil physics it should show up in this field (and it should show up even for something -that is at a pretty deep soil depth). However, as 'TSOI' is only for vegetated -land-units, changes in lake or urban land-units -- will NOT show up. 'TSA' by contrast is -the 2m surface temperature across all land-units, so changes in urban or lake land-units -will show up. However, changes in deep soil physics will only show up as it propagates -to the surface. So one field may show something that the other doesn't. In the examples, -we use 'TSOI', but 'TSA' can be used as well. And in most cases you should check both. - - - -Now we will give a detailed description of the procedure with examples and the -exact steps to perform. - - -Using Perturbation Error Growth Analysis to Verify a Port to a New Machine - -Running non-perturbed on trusted machine - -The first step is to run a non-perturbed case on the trusted machine. You need to run -all of the steps with the same compset and same resolution. For these examples we will -use 2-degree resolution with the ICN compset for 2000 conditions. You need to run for -three days with a cold-start. - - - -As we describe below, This is optional if you will be using datasets from the -inputdata repository to take place of this step. - - - - -Example non-perturbed error growth simulation - -> cd scripts -> ./create_newcase -case trustedMachinePergro0 -compset ICN -res f19_g16 \ --mach bluefire -> cd trustedMachinePergro0 -# Set the non-perturbed PERGRO use-case -> ./xmlchange -file env_conf.xml -id CLM_NML_USE_CASE -val pergro0_pd -# Set coldstart on so arbitrary initial conditions will be used -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -# Set PERGRO on in the configure -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-pergro on" -append -# Now configure and build -> ./configure -case -> ./trustedMachinePergro0.bluefire.build -# Set it to run for three days and turn archiving off -> ./xmlchange -file env_run.xml -id STOP_N -val 3 -> ./xmlchange -file env_run.xml -id DOUT_S -val FALSE -# Run the case and then you will save the history file output for later use -> ./trustedMachinePergro0.bluefire.submit - - - - - -If you aren't able to do this step, as you don't have access to a trusted machine, you -can use datasets that are available from the svn inputdata repository to take place of -running it yourself. The disadvantage is that this is only done for certain model -versions and for exactly the configuration/namelist given here. You won't be able to -test it for your own custom code or configurations. - - - - -Running perturbed on the trusted machine - -The next step is to run a perturbed case on the trusted machine. - -Example perturbed error growth simulation - -> cd scripts -> ./create_newcase -case trustedMachinePergroRnd -compset ICN -res f19_g16 \ --mach bluefire -> cd trustedMachinePergroRnd -# Set the perturbed PERGRO use-case -> ./xmlchange -file env_conf.xml -id CLM_NML_USE_CASE -val pergro_pd -# Set coldstart on so arbitrary initial conditions will be used -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -# Set PERGRO on in the configure -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-pergro on" -append -# Now configure and build -> ./configure -case -> ./trustedMachinePergroRnd.bluefire.build -# Set it to run for three days and turn archiving off -> ./xmlchange -file env_run.xml -id STOP_N -val 3 -> ./xmlchange -file env_run.xml -id DOUT_S -val FALSE -# Run the case and then you will save the history file output for later use -> ./trustedMachinePergroRnd.bluefire.submit - - - - - -If you aren't able to do this step, as you don't have access to a trusted machine, you -can use datasets that are available from the svn inputdata repository to take place of -running it yourself. The disadvantage is that this is only done for certain model -versions and for exactly the configuration/namelist given here. You won't be able to -test it for your own custom code or configurations. - - - - -Running non-perturbed on the new machine - -The next step is to run a non-perturbed case on the new machine. Here -we will demonstrate using the machine intrepid. For the previous two steps -you have the option of using datasets provided in the subversion inputdata -repository to take their place -- however this step is required. - -> cd scripts -> ./create_newcase -case newMachinePergro0 -compset ICN -res f19_g16 \ --mach intrepid -> cd newMachinePergro0 -# Set the non-perturbed PERGRO use-case -> ./xmlchange -file env_conf.xml -id CLM_NML_USE_CASE -val pergro0_pd -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -# Set PERGRO on in the configure -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-pergro on" -append -# Now configure and build -> ./configure -case -> ./newMachinePergro0.intrepid.build -# Set it to run for three days and turn archiving off -> ./xmlchange -file env_run.xml -id STOP_N -val 3 -> ./xmlchange -file env_run.xml -id DOUT_S -val FALSE -# Run the case and then you will save the history file output for later use -> ./newMachinePergro0.intrepid.submit - - - - - -Plotting the differences - -You can use the cprnc program to compute root mean square differences -between the relevant history files. See for more information -on it and how to build it. On many platforms you will need to set some environment -variables in order to complete the build (see for -more information on building the tools). - -# Build the cprnc program -> cd models/lnd/clm/tools/cprnc -> gmake -# Now go to your case directory and run cprnc on the trusted-machine with and without -# perturbation -> cd ../../../../../scripts/trustedMachinePergro0 -> ../../models/lnd/clm/tools/cprnc/cprnc trustedMachinePergro0.clm2.h0.001-01-01.00000.nc \ -../trustedMachinePergroRnd/trustedMachinePergroRnd.clm2.h0.001-01-01.00000.nc > trustedPergro.log -# Copy the history file from the new machine to here -# -# And now run cprnc on the trusted-machine and the new machine both without perturbation -> ../../models/lnd/clm/tools/cprnc/cprnc trustedMachinePergro0.clm2.h0.001-01-01.00000.nc \ -../newMachinePergro0/newMachinePergro0.clm2.h0.001-01-01.00000.nc > newPergro.log -# Now extract out the RMS differences of TSOI for both -# You may want to extract out the RMS differences for TSA as well -# Changes in urban or lake land-units won't be detected with TSOI -> grep "RMS TSOI" trustedPergro.log | awk '{print $3}' > RMStrusted.dat -> grep "RMS TSOI" newPergro.log | awk '{print $3}' > RMSnewmachine.dat -# And plot the two curves up to your screen -> env TYPE=x11 RMSDAT=RMSnewmachine.dat RMSDAT2=RMStrusted.dat ncl \ -../../models/lnd/clm/tools/ncl_scripts/pergroPlot.ncl - -Here is a sample plot for several trusted machines: bluefire, intrepid, jaguar, -and edinburgh (with both the lahey and intel compilers). -The green line is the error growth for bluefire, the red is the error growth -for intrepid, the dashed navy is for jaguar, the dashed maroon is for the intel -compiler on edinburgh, and the thick dashed goldenrod line is for edinburgh with the -lahey compiler. Note, the data for this plot is in -models/lnd/clm/tools/ncl_scripts the files are named: -according to the legend. Note, that the lines tend to cluster together and follow -quite closely to the bluefire line which is our main trusted machine. -

    -Sample Good Perturbation Error Growth Curves (within roundoff) - - - -
    - - - -When you do NOT have access to a trusted machine you can use the trusted file from -bluefire that is available on the inputdata repository. - -# Build the cprnc program -> cd models/lnd/clm/tools/cprnc -> gmake -# Get the unperturbed file from the subversion repository -> cd ../../../../../scripts/newMachinePergro0 -> set dir = "lnd/clm2/pergrodata" -> set file = bluefirePergro0.ICN.0001-01-01_1.9x2.5_gx1v6_simyr2000_clm4-cesm1_0_3.c110617.nc -> echo "trustedfile = DIN_LOC_ROOT/$dir/$file" > clm.input_data_list -> ../ccsm_utils/Tools/check_input_data -datalistdir . -export -inputdata $DIN_LOC_ROOT -# And now run cprnc on the bluefire file and the new machine both without perturbation -> ../../models/lnd/clm/tools/cprnc/cprnc $file \ -../newMachinePergro0/newMachinePergro0.clm2.h0.001-01-01.00000.nc > newPergro.log -# Now extract out the RMS difference -# You may want to extract out the RMS differences for TSA as well -# Changes in urban or lake land-units won't be detected with TSOI -> grep "RMS TSOI" newPergro.log | awk '{print $3}' > RMSnewmachine.dat -# And plot the new curve versus the trusted curve up to your screen -> env TYPE=x11 RMSDAT=RMSnewmachine.dat \ -RMSDAT2=../../models/lnd/clm/tools/ncl_scripts/RMSbluefire.dat \ -../../models/lnd/clm/tools/ncl_scripts/pergroPlot.ncl - - - -In the figure below we now show example of curves for changes that are larger than -roundoff. Once again the green curve is the trusted error growth from bluefire. The -other curves are for changes that may be fairly small, but are larger than roundoff. The -goldenrod curve is for using the 1850, and the navy is for using the 1999 Nitrogen -deposition files rather than for year 2000. The red is for using the 1850 aerosol -dataset rather than 2000, and the maroon is for adding the snow combination bug in. The -differences in changes that are greater than roundoff is that the curves climb very -steeply to the 10-6 value and then level off, while the -curve for bluefire climbs much more slowly and gradually. The curves also don't mimic -each other in any way, like the trusted machine plots do. -
    -Sample Bad Perturbation Error Growth Curves (changes greater than roundoff) - - - -
    - -
    - - - - - -Running stand-alone &clm; with transient historical &CO2; -concentration - -In this case you want to run a simulation with stand-alone &clm; responding -to changes in &CO2; for a historical period. -For this example, we will start with the "I_1850-2000_CN" compset that -has transient: land-use, Nitrogen and Aerosol deposition already. You could -also use another compset if you didn't want these other features to be transient. -In order to get &CO2; to be transient we need to edit the -&datm; template so that we add an extra streams file to describe how -&CO2; varies over the historical period. You also need -a &netcdf; datafile that datm can read that gives the variation. You could -supply your own file, but we have a standard file that is used by CAM for this -and our example will make use of this file. - - - -Most everything here has to do with changing datm rather than &clm; -to allow this to happen. As such the user that wishes to do this should -first become more familiar with datm and read the -&cesm; Data -Model User's Guide especially as it pertains to the datm. Note, also -that in this example we show how to edit the datm "buildnml" file for your -case, but you could do something similar by editing the datm template. - - - - -This section documents the process for doing something that is non-standard. -There may be errors with the documentation and process, and you may have to do -some work before all of this works for you. If that is the case, we recommend -that you do further research into understanding the process and the files, as -well as understanding the datm and how it works. You may have to read documentation -found in the code for datm as well as "csm_share". - - - -The datm has "streams" files that have rough XML-like syntax and specify the -location and file to get data from, as well as information on the variable names -and the data locations of the grid points. The datm expects specific variable names -and the datm "maps" the expected variable names from the file to the names expected -by datm. The file we are working with here is a file with a single-point, that covers -the entire globe (so the vertices go from -90 to 90 degrees in latitude and 0 to 360 -degrees in longitude). Since it's a single point it's a little easier to work with -than datasets that may be at a given horizontal resolution. The datm also expects -that variables will be in certain units, and only expects a limited number of -variables so arbitrary fields can NOT be exchanged this way. However, the process -would be similar for datasets that do contain more than one point. - - -The three things that are needed: a domain file, a data file, and a streams text file. -The domain file is a CF-compliant &netcdf; file that has information -on the grid points (latitudes and longitudes for cell-centers and vertices, mask -, fraction, and areas). The datafile is a CF-compliant &netcdf; file with the data that -will be mapped. The streams text file is the XML-like file that tells datm how to find -the files and how to map the variables datm knows about to the variable names on the -&netcdf; files. Note, that in our case the domain file and the data file are the same -file. In other cases, the domain file may be separate from the data file. - - -First we are going to create a case, and we will edit -the Buildconf/datm.buildnml.csh so that we add a -&CO2; data stream in. There is a streams text file -available in models/lnd/clm/doc/UsersGuide/co2_streams.txt, -that includes file with a &CO2; time-series from 1765 to 2007. - -Example Transient Simulation with Historical &CO2; - -> cd scripts -> ./create_newcase -case DATM_CO2_TSERIES -res f19_g16 -compset I_1850-2000_CN \ --mach bluefire -> cd DATM_CO2_TSERIES -# Set CCSM_BGC to CO2A so that CO2 will be passed from atmosphere to land -> ./xmlchange -file env_conf.xml -id CCSM_BGC -val CO2A -# Set CLM_CO2_TYPE to diagnostic so that the land will use the value sent from the atmosphere -> ./xmlchange -file env_conf.xml -id CLM_CO2_TYPE -val diagnostic -> ./configure -case -> cd Buildconf -# Copy the sample streams file over -> cp ../../../models/lnd/clm/doc/UsersGuide/co2_streams.txt . - - -The first thing we will do is to edit the datm buildnml script to add -a CO2 file stream in. To do this we will apply a patch with the differences -needed. The patch file addco2_datm.buildnml.diff is -in models/lnd/clm/doc/UsersGuide and looks like this... - -&co2streams_diff; - -So to apply the patch you do this... - -> cd scripts/DATM_CO2_TSERIES/Buildconf -> patch < ../../../models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - -Once, you've done that you can build and run your case normally. - - - -The patch assumes you are using a I_1850-2000_CN compset out of the box, with -DATM_PRESAERO equal to trans_1850-2000. So it assumes standard -Qian atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes -anything here the patch will fail, and you will need to put the changes in by hand. - - - - - -If the patch fails, you will have to add the changes to the -datm.buildnml.csh found in the above -patch file by hand. Basically, it adds an extra streams file for &CO2; to the end of the streams variable, -and other arrays associated with streams (adding mapalgo as a new array with bilinear for everything, but -the &CO2; file which should be "nn" for nearest neighbor). - - - - - -The streams file above is hard-coded for the path of the file on &ncar; computers. To use it on an outside -machine you'll need to edit the filepath in the streams file to point to the location where you have the file. - - - - -After going through these steps, you will have a case where you have datm reading -in an extra streams text file that points to a data file with &CO2; -data on it that will send that data to the &clm;. - - - - diff --git a/doc/UsersGuide/stylesheethtml2docbook.xsl b/doc/UsersGuide/stylesheethtml2docbook.xsl deleted file mode 100644 index 13c30ff71d..0000000000 --- a/doc/UsersGuide/stylesheethtml2docbook.xsl +++ /dev/null @@ -1,579 +0,0 @@ - - - - - -wb -file:///epicuser/AISolutions/graphics/AIWorkbench/ - - - - - - - - - - <xsl:value-of select=".//html:h1[1] - |.//html:h2[1] - |.//html:h3[1]"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - inlinemediaobject - - mediaobject - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Matched -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No template for - - - - - - No template for - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    -
    - - - - - - - _ - - - - - - - - - - - - - - _ - - - - - - - - - - - - - - - - - - - - - - - - - <xsl:value-of select=".//html:caption"/> - - - - - - - - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Attempting to count columns on a non-table element - - - Row parameter is not a valid row - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - diff --git a/doc/UsersGuide/tools.xml b/doc/UsersGuide/tools.xml deleted file mode 100644 index f5fd8beac4..0000000000 --- a/doc/UsersGuide/tools.xml +++ /dev/null @@ -1,1396 +0,0 @@ - - -Using the &clm; tools to create your own input datasets - -There are several tools provided with &clm; that allow you to create your own input -datasets at resolutions you choose, or to interpolate initial conditions to a different -resolution, or used to compare &clm; history files between different cases. The tools are -all available in the models/lnd/clm/tools directory. Most of the tools -are &FORTRAN; stand-alone programs in their own directory, but there is also a suite of -&ncl; -scripts in the ncl_scripts directory. Some of the &ncl; scripts are -very specialized and not meant for general use, and we won't document them here. They -still contain documentation in the script itself and the README file in the tools -directory. But, the list of generally important scripts and programs are: - - - cprnc to compare &netcdf; files with a time axis. - - - interpinic to interpolate initial condition files. - - - mkgriddata to create grid datasets. - - - mkdatadomain to create domain files from grid datasets -used by &datm; or docn. - - - mksurfdata to create surface datasets from grid datasets. - - - ncl_scripts/getregional_datasets.pl script to extract a -region or a single-point from global input datasets. See the single-point chapter -for more information on this. - - - ncl_scripts/npdepregrid.ncl interpolate the Nitrogen -deposition datasets to a new resolution. - - - ncl_scripts/aerdepregrid.ncl interpolate the Aerosol -deposition datasets to a new resolution. - - - - - -In the sections to come we will go into detailed description of how to use each of -these tools in turn. First, however we will discuss the common environment variables -and options that are used by all of the &FORTRAN; tools. Second, we go over the outline -of the entire file creation process for all input files needed by &clm; for a new -resolution, then we turn to each tool. In the last section we will -discuss how to customize files for particular observational sites. - - - -Common environment variables and options used in building the &FORTRAN; -tools - -The &FORTRAN; tools all have similar makefiles, and similar options for building. -All of the Makefiles use GNU Make extensions and thus require that you use GNU make -to use them. They also auto detect the type of platform you are on, using "uname -s" -and set the compiler, compiler flags and such accordingly. There are also environment -variables that can be set to set things that must be customized. All the tools use -&netcdf; and hence require the path to the &netcdf; libraries and include files. -On some platforms (such as Linux) multiple compilers can be used, and hence there -are env variables that can be set to change the &FORTRAN; and/or "C" compilers used. -The tools other than cprnc also allow finer control, by also -allowing the user to add compiler flags they choose, for both &FORTRAN; and "C", as -well as picking the compiler, linker and and add linker options. Finally the tools -other than cprnc allow you to turn -optimization on (which is off by default but on for the mksurfdata and -interpinic -programs) with the OPT flag so that the -tool will run faster. To get even faster performance, the interpinic, -mksurfdata, and -mkgriddata programs allow you to also use the SMP to -turn on multiple shared memory processors. -When SMP=TRUE you set the number of threads used by the program with -the OMP_NUM_THREADS environment variable. - - -Options used by all: cprnc, interpinic, -mkdatadomain, mkgriddata, and -mksurfdata - -LIB_NETCDF -- sets the location of the &netcdf; library. -INC_NETCDF -- sets the location of the &netcdf; include files. -USER_FC -- sets the name of the &FORTRAN; compiler. - -Options used by: interpinic, mkdatadomain, -mkgriddata, and mksurfdata - -MOD_NETCDF -- sets the location of the &netcdf; &FORTRAN; module. -USER_LINKER -- sets the name of the linker to use. -USER_CPPDEFS -- adds any CPP defines to use. -USER_CFLAGS -- add any "C" compiler flags to use. -USER_FFLAGS -- add any &FORTRAN; compiler flags to use. -USER_LDFLAGS -- add any linker flags to use. -USER_CC -- sets the name of the "C" compiler to use. -OPT -- set to TRUE to compile the code optimized (TRUE or FALSE) - -Options used by: interpinic, mkgriddata, and mksurfdata: - -SMP -- set to TRUE to turn on shared memory parallelism (i.e. -&omp;) (TRUE or FALSE) -Filepath -- list of directories to build source code from. -Srcfiles -- list of source code filenames to build executable from. - -Options used only by cprnc: - -EXEDIR -- sets the location where the executable will be built. -VPATH -- colon delimited path list to find the source files. - -More details on each environment variable. - - -LIB_NETCDF - -This variable sets the path to the &netcdf; library file -(libnetcdf.a). If not -set it defaults to /usr/local/lib. In order to use the tools -you need to build the &netcdf; library and be able to link to it. In order to build -the model with a particular compiler you may have to compile the &netcdf; library with -the same compiler (or at least a compatible one). - - - - - -INC_NETCDF - -This variable sets the path to the &netcdf; include directory (in order to find -the include file netcdf.inc). -if not set it defaults to /usr/local/include. - - - - - -MOD_NETCDF - -This variable sets the path to the &netcdf; module directory (in order to find -the &netcdf; &FORTRAN90; module file when &netcdf; is used with a &FORTRAN90; -use statement. When not set it defaults to the -LIB_NETCDF value. - - - - - -USER_FC - -This variable sets the command name to the &FORTRAN90; compiler to use when -compiling the tool. The default compiler to use depends on the platform. And -for example, on the AIX platform this variable is NOT used - - - - - -USER_LINKER - -This variable sets the command name to the linker to use when linking the object -files from the compiler together to build the executable. By default this is set to -the value of the &FORTRAN90; compiler used to compile the source code. - - - - - -USER_CPPDEFS - -This variable adds additional optional values to define for the C preprocessor. -Normally, there is no reason to do this as there are very few CPP tokens in the CLM -tools. However, if you modify the tools there may be a reason to define new CPP -tokens. - - - - - -USER_CC - -This variable sets the command name to the "C" compiler to use when -compiling the tool. The default compiler to use depends on the platform. And -for example, on the AIX platform this variable is NOT used - - - - - -USER_CFLAGS - -This variable adds additional compiler options for the "C" compiler to use -when compiling the tool. By default the compiler options are picked according -to the platform and compiler that will be used. - - - - - -USER_FFLAGS - -This variable adds additional compiler options for the &FORTRAN90; compiler to use -when compiling the tool. By default the compiler options are picked according -to the platform and compiler that will be used. - - - - - -USER_LDFLAGS - -This variable adds additional options to the linker that will be used when linking -the object files into the executable. By default the linker options are picked according -to the platform and compiler that is used. - - - - - -SMP - -This variable flags if shared memory parallelism (using i&omp;) should be used when -compiling the tool. It can be set to either TRUE or -FALSE, by default it is set to FALSE, so -shared memory parallelism is NOT used. When set to TRUE you can -set the number of threads by using the OMP_NUM_THREADS environment -variable. Normally, the most you would set this to would be to the number of on-node -CPU processors. Turning this on should make the tool run much faster. - - - -Note, that depending on the compiler answers may be different when SMP -is activated. - - - - - - -OPT - -This variable flags if compiler optimization should be used when -compiling the tool. It can be set to either TRUE or -FALSE, by default it is set to FALSE for -mkdatadomain and TRUE for -mksurfdata and interpinic. -Turning this on should make the tool run much faster. - - - -Note, you should expect that answers will be different when OPT -is activated. - - - - - - -Filepath - -All of the tools are stand-alone and don't need any outside code to operate. The -Filepath is the list of directories needed to compile -and hence is always simply "." the current directory. Several tools use -copies of code outside their directory that is in the &cesm; -distribution (either csm_share code or &clm; source code). - - - - - -Srcfiles - -The Srcfiles lists the filenames of the source code to use -when building the tool. - - - - - -EXEDIR - -The cprnc tool uses this variable to set the location of where the executable -will be built. The default is the current directory. - - - - - -VPATH - -The cprnc tool uses this variable to set the colon delimited pathnames of where -the source code exists. The default is the current directory. - - - - - - - - - -There are several files that are copies of the original files from either -models/lnd/clm/src/main, -models/csm_share/shr, or copies from other tool -directories. By having copies the tools can all be made stand-alone, but -any changes to the originals will have to be put into the tool directories -as well. - - - -The README.filecopies (which can be found in -models/lnd/clm/tools) is repeated here. - -&filecopies; - - - - - -General information on running the &FORTRAN; tools - -The tools run either one of two ways, with a namelist to provide options, or -with command line arguments (and NOT both). interpinic and -cprnc run with command line arguments, and the other tools -run with namelists. - - -Running &FORTRAN; tools with namelists - -mkgridata, mksurfdata and -mkdatadomain run with namelists that are read from -standard input. Hence, you create a namelist and then run them by -redirecting the namelist file into standard input as follows: - -./program < namelist - -For programs with namelists there is at least one sample namelist with the -name "program".namelist (i.e. mksurfdata.namelist -for the mksurfdata program). There may also be other sample -namelists that end in a different name besides "namelist". Namelists that you create -should be similar to the example namelist. The namelist values are also documented -along with the other namelists in the: - -models/lnd/clm/bld/namelist_files/namelist_definition.xml -file and default values in the: - -models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml -file. - - - -Running &FORTRAN; tools with command line options - -interpinic and cprnc run with command line -arguments. The detailed sections below will give you more information on the command -line arguments specific to each tool. Also running the tool without any arguments -will give you a general synopsis on how to run the tool. For example to get help -on running interpinic do the following. - -cd models/lnd/clm/tools/interpinic -gmake -./interpinic - - - - -Running &FORTRAN; tools built with SMP=TRUE - -When you enable SMP=TRUE on your build of one of the tools that -make use of it, you are using &omp; for shared memory parallelism (SMP). In -SMP loops are run in parallel with different threads run on different processors -all of which access the same memory (called on-node). Thus you can only usefully -run up to the number of processors that are available on a single-node of the machine -you are running on. For example, on the &ncar; machine bluefire there are 32 processors -per node, but the SMT hardware on the machine allows you to submit twice as many -threads or 64 threads. So to run the mksurfdata on bluefire -optimized, with 64 threads you would do the following: - -cd models/lnd/clm/tools/mksurfdata -gmake OPT=TRUE SMP=TRUE -setenv OMP_NUM_THREADS 64 -./mksurfdata < mksurfdata.namelist - - - - - - -The File Creation Process - - -When just creating a replacement file for an existing one, the relevant tool should -be used directly to create the file. When you are creating a set of files for a new -resolution there are some dependencies between the tools that you need to keep in mind -when creating them. The main dependency is that the mkgriddata MUST -be done first as the grid dataset is then input into the other tools. Also look at -. - - - -Creating a complete set of files for input to &clm; - -Create grid and fraction datasets - -First use mkgriddata to create grid and fraction datasets. -See for more information on this. - - - - -Create domain dataset (if NOT already done) - -Next use mkdatadomain to create a domain file for use by -&datm; from the grid and fraction datasets just created. This is required, unless -a domain file already created was input into mkgriddata on -the previous step. -See for more information on this. - - - - -Create surface datasets - -Next use mksurfdata to create a surface dataset, using the grid -dataset as input. -See for more information on this. - - - - -Interpolate aerosol deposition datasets (optional) - -By default the atmosphere model will interpolate -these datasets on the fly, so you don't normally need to do this step. -A reason you might want to do this is to make the read and interpolation faster, -by reducing the amount of data read in and removing the need for the interpolation. -So, if you do, you can use aerdepregrid.ncl to regrid aerosol -deposition datasets to your new resolution using the grid dataset as input. -See for more information on this. - - - - -Interpolate Nitrogen deposition datasets (optional, but only needed if running &clmcn;) - -By default Nitrogen deposition is read in from stream -files at 2-degree resolution and interpolated to the resolution you are running at, -so you don't need to do this step. As with aerosol deposition datasets a reason -you might want to do this is to make the read and interpolation faster, -by reducing the amount of data read in and removing the need for the interpolation. -So, if you do you can use ndepregrid.ncl -to regrid Nitrogen deposition datasets to your new resolution using the grid dataset -as input. -See for more information on this. - - - - -Create some sort of initial condition dataset - - -You then need to do one of the following three options to have an initial dataset -to start from. - - - - - -Use spinup-procedures to create initial condition datasets - -The first option is to do the spinup procedures from arbitrary initial conditions -to get good initial datasets. This is the most robust method to use. -See , , or - for more information on this. - - - - -Use <command>interpinic</command> to interpolate existing initial -condition datasets - -The next option is to interpolate from spunup datasets at a different resolution, using -interpinic. -See for more information on this. - - - - -Start up from arbitrary initial conditions - -The last alternative is to run from arbitrary initial conditions without using any -spun-up datasets. This is inappropriate when using &clmcn; (bgc=cn or cndv) as it -takes a long time to spinup Carbon pools. - - -This is NOT recommended as many fields in &clm; take a long time to equilibrate. - - - - - - - - - - -Enter the new datasets into the &buildnml; XML database - -The last optional thing to do is to enter the new datasets into the &buildnml; -XML database. See for more information on -doing this. This is optional because the user may enter these files into their -namelists manually. The advantage of entering them into the database is so that -they automatically come up when you create new cases. - - - - - - - - -Using the <command>cprnc</command> tool to compare two history files - -cprnc is a tool shared by both CAM and &clm; to compare two -&netcdf; history files. -It differences every field that has a time-axis that is also shared on both files, -and reports a summary of the difference. The summary includes the three largest -differences, as well as the root mean square (RMS) difference. It also gives some -summary information on the field as well. You have to enter at least one file, and up to -two files. With one file it gives you summary information on the file, and with two it -gives you information on the differences between the two. At the end it will give you a -summary of the fields compared and how many fields were different and how many were -identical. - - -Options: - --m = do NOT align time-stamps before comparing --v = verbose output --ipr --jpr --kpr - -See the cprnc -README file for more details which is -repeated here: - -&cprnc_readme; - - - -To compare files with OUT a time axis you can use the cprnc.ncl -&ncl; script in models/lnd/clm/tools/ncl_scripts. It won't give -you the details on the differences but will report if the files are identical or -different. - - - - - - -Using <command>interpinic</command> to interpolate initial conditions to different -resolutions - -"interpinic" is used to interpolate initial conditions from one resolution to another. -In order to do the interpolation you must first run &clm; to create a restart file to -use as the "template" to interpolate into. Running from arbitrary initial conditions -(i.e. finidat = ' ') for a single time-step is sufficient to do this. Make sure the -model produces a restart file. You also need to make sure that you setup the same -configuration that you want to run the model with, when you create the template file. - - -Command line options to interpinic: - --i = Input filename to interpolate from --o = Output interpolated file, and starting template file - - - -There is a sample template file in the models/lnd/clm/tools/interpinic -directory and can be used to run interpolate to. -However, this file was created with an older version of &clm; and hence -we actually recommend that you would do a short run with &clm; to create a template file -to use. - - - - -Example of running &clm; to create a template file for -<command>interpinic</command> to interpolate to - -> cd scripts -> ./create_newcase -case cr_f10_TmpltI1850CN -res f10_f10 -compset I1850CN \ --mach bluefire -> cd cr_f10_TmpltI1850CN -# Set starting date to end of year -> ./xmlchange -file env_conf.xml -id RUN_STARTDATE -val 1948-12-31 -# Set year align to starting year -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_ALIGN -val 1948 -# Set to run a cold start -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -# Set to run only a single day, so a restart file will be created on Jan/1/1949 -> ./xmlchange -file env_run.xml -id STOP_N -val 1 -# Then configure, build and run as normal -> ./configure -case -> ./cr_f10_TmpltI1850CN.bluefire.build -> ./cr_f10_TmpltI1850CN.bluefire.submit -# And copy the resulting restart file to your interpinic directory -> cd ../models/lnd/clm/tools/interpinic -> cp /ptmp/$LOGIN/cr_f10_TmpltI1850CN/run/cr_f10_TmpltI1850CN.clm2.r.1949-01-01-00000.nc . - - - - -In the next example we build interpinic optimized with shared -memory on for 64 threads so that it runs as fast as possible, to interpolate one of -the standard 1-degree datasets to the above 10x15 template file that we created. - - -Example of building and running <command>interpinic</command> to -interpolate a 1-degree <filename>finidat</filename> dataset to 10x15 - -> cd models/lnd/clm/tools/interpinic -> gmake OPT=TRUE SMP=TRUE -> env OMP_NUM_THREADS=64 ./interpinic -o cr_f10_TmpltI1850CN.clm2.r.1949-01-01-00000.nc / --i /fs/cgd/csm/inputdata/ccsm4_init/b40.1850.track1.1deg.006/0863-01-01/b40.1850.track1.1deg.006.clm2.r.0863-01-01-00000.nc - - - - -Running interpinic at high resolution can take a long time, so we -recommend that you always build it optimized and with shared memory processing on, to -cut down the run time as much as possible. - - - - -interpinic does NOT work for CNDV (bgc=cndv). - - - - - - -In we give a simpler way to run -interpinic for several standard resolutions at once, with a script -to loop over several resolutions. This is useful for &clm; developers who need to -create many finidat files at once. - - - - - -Using <command>mkgriddata</command> to create grid datasets - -mkgriddata is used to create grid, fraction, and topography -datasets to run &clm; at a new resolution. It is typically the first step in creating -datasets needed to run &clm; at a new resolution (followed by -mksurfdata, and -then the interpolation programs, aerdepregrid.ncl, and -ndepregrid.ncl when running with CN). - - - -mkgriddata namelist - -mkgriddata is controlled by a namelist. There are ten different -namelist items, and you need to use enough of them so that files will be output. -The different types of input datasets contain different input data types, that -correspond to the three different types of output files: grid, fraction, and topography. -Output files for each of these will only be output if there is input data that -correspond to these. If you only have input data for grid locations -- you will only -get an output grid file. If you have both grid and fraction data you will get grid and -fraction data files. If you also have topography data you will also get topo files. - - -Namelist options to mkgriddata include: - -mksrf_fnavyoro -- Navy orography file to use for land fraction -and surface heights. -mksrf_frawtopo -- Raw topography file with just surface -heights. -mksrf_fcamfile -- CAM initial conditions file with -land-fractions and topography -mksrf_fclmgrid -- &clm; grid file -mksrf_fccsmdom -- &cesm; domain file -mksrf_fcamtopo -- CAM topography file -mksrf_lsmlon -- number of longitude for regional grid -mksrf_lsmlatnumber of latitudes for regional grid -mksrf_edgen -- Northern edge for regional grid -mksrf_edgee -- Southern edge for regional grid -mksrf_edges -- Eastern edge for regional grid -mksrf_edgew -- Western edge for regional grid - - - -You need to enter one of the following four options: - - mksrf_fnavyoro - high resolution topo dataset (topo data) - mksrf_lsmlon - number of longitudes - mksrf_lsmlat - number of latitudes - mksrf_edgen - northern edge of grid (degrees) - mksrf_edgee - eastern edge of grid (degrees) - mksrf_edges - southern edge of grid (degrees) - mksrf_edgew - western edge of grid (degrees) - -or - - mksrf_fcamfile - CAM topo file (grid and possibly fraction data) - -or - - mksrf_fccsmdom - &cesm; domain file (both grid, and fraction data) - -or - - mksrf_fclmgrid - &clm; grid or surface dataset file (grid data) - -Note, you can provide more than one of the needed datasets, and the output -data will be determined by the datasets according to an order of precedence. -The order of precedence for data is as follows: - -mksrf_fcamfile -mksrf_fclmgrid -mksrf_fnavyoro -mksrf_fccsmdom - -Grid data then will be established by the file with the highest precedence. -&cesm; domain files sometimes have latitudes and longitudes that are "off" from -the standard by a small amount. By establishing an order of precedence you can ensure -that grid locations exactly match a given standard file, even if the values in the domain -file are off from that. - - - -There are three different major modes for using "mkgriddata" to create grid files -for &clm;: - -mksrf_fnavyoro -- Navy orography file to use for land fraction -and surface heights. -mksrf_frawtopo -- Raw topography file with just surface -heights. -mksrf_fcamfile -- CAM initial conditions file with -land-fractions and topography -mksrf_fclmgrid -- &clm; grid file -mksrf_fccsmdom -- &cesm; domain file -mksrf_fcamtopo -- CAM topography file -mksrf_lsmlon -- number of longitude for regional grid -mksrf_lsmlat -- number of latitudes for regional grid -mksrf_edgen -- Northern edge for regional grid -mksrf_edgee -- Southern edge for regional grid -mksrf_edges -- Eastern edge for regional grid -mksrf_edgew -- Western edge for regional grid - - - -You need to enter one of the following four options: - - mksrf_fnavyoro - high resolution topo dataset (topo data) - mksrf_lsmlon - number of longitudes - mksrf_lsmlat - number of latitudes - mksrf_edgen - northern edge of grid (degrees) - mksrf_edgee - eastern edge of grid (degrees) - mksrf_edges - southern edge of grid (degrees) - mksrf_edgew - western edge of grid (degrees) - -or - - mksrf_fcamfile - CAM topo file (grid and possibly fraction data) - -or - - mksrf_fccsmdom - &cesm; domain file (both grid, and fraction data) - -or - - mksrf_fclmgrid - &clm; grid or surface dataset file (grid data) - -Note, you can provide more than one of the needed datasets, and the output -data will be determined by the datasets according to an order of precedence. -The order of precedence for data is as follows: - -mksrf_fcamfile -mksrf_fclmgrid -mksrf_fnavyoro -mksrf_fccsmdom - -Grid data then will be established by the file with the highest precedence. -&cesm; domain files sometimes have latitudes and longitudes that are "off" from -the standard by a small amount. By establishing an order of precedence you can ensure -that grid locations exactly match a given standard file, even if the values in the domain -file are off from that. - - - -There are three different major modes for using mkgriddata to -create grid files for &clm;: - -Convert &cesm; domain files to &clm; grid files -Create single point or regional area grid files -Convert CAM files to &clm; grid files - - - - - -Convert &cesm; domain files to &clm; grid files - -&cesm; domain files such as used for &datm;, include all the information -needed to create &clm; grid and fraction files. - -Example <command>mkgriddata</command> namelist to convert &cesm; 4x5 domain files to &clm; grid files - -&clmexp - mksrf_fccsmdom= -'/fs/cgd/csm/inputdata/lnd/dlnd7/domain.lnd.4x5_gx3v5.060404.nc' - mksrf_fclmgrid= -'/fs/cgd/csm/inputdata/lnd/clm2/griddata/griddata_4x5_060404.nc' -/ - - - - -Notice that in the above example, a &clm; grid file is included as well, even though -it's not required. The reason for this is to ensure that the latitude and longitudes -on the output files exactly match a standard grid file. - - - - - - -Create single point or regional area grid files - -The process to create single-point or regional area &clm; grid files is the same. -You enter the number of latitudes and longitudes you want on your output file and -the extent of the grid: North, East, South and West. You also tell -mkgriddata that -you are entering a "regional" grid and you also enter the standard Navy orography -dataset (or your own orography file if desired). For a single point you simply -enter "1" for the number of latitudes and longitudes, but you still enter the -grid extent (of the single grid cell). Here is a sample regional namelist to create -a 5x5 regional grid over the Amazon: - -Example <command>mkgriddata</command> namelist to create regional grid over Amazon - -&clmexp - mksrf_fnavyoro= -"/fs/cgd/csm/inputdata/lnd/clm2/rawdata/mksrf_navyoro_20min.c010129.nc" - mksrf_lsmlon = 5 - mksrf_lsmlat = 5 - mksrf_edgee = 303.75 - mksrf_edgew = 286.25 - mksrf_edges = -15. - mksrf_edgen = -4. -/ - - - - - -Currently you can NOT have regional grids that straddle both -sides of the Greenwich (longitude = zero) line. - - - - -You should enter longitudes with values from 0 to 360 East. - - - - - -Convert <acronym>CAM</acronym> files to &clm; grid files (deprecated) - -Older CAM initial files included all the information needed to create &clm; -grid files. Newer CAM files no longer include land fraction data. Hence you -can use CAM files to give you the grid coordinates, but you need other data -to give you the land-mask and topography. Since, CAM files no longer -contain the needed information, this option is now deprecated. In most cases you should -use one of the other two options. - - - - - - - -Using <command>mkdatadomain</command> to create domain datasets for &datm; or docn from &clm; grid datasets - -"mkdatadomain" is used to convert &clm; grid and fraction datasets into domain datasets -that can be used by either the "datm" or "docn" models. Most often &clm; users will want -to convert the grid datasets they just created using mkgriddata into -domain datasets to be used by &datm; for an "I" case. mkdatadomain is -controlled by a namelist, and has a very straight forward operation with only four -namelist items all of which are required. You specify which output mode you want "datm" -or "docn", and then set the input &clm; grid and frac datasets, and the output domain file. - - -Example <command>mkdatadomain</command> namelist to create a domain file from -&clm; frac and grid data files - -&domain_nl - dtype = "datm" - f_fracdata = -'/fs/cgd/csm/inputdata/lnd/clm2/griddata/fracdata_4x5_USGS_070110.nc' - f_griddata = -'/fs/cgd/csm/inputdata/lnd/clm2/griddata/griddata_4x5_060404.nc' - f_domain = -'domain.lnd.fv4x5_USGS.090117.nc' -/ - - - - - -Using mksurfdata to create surface datasets from grid datasets - -mksurfdata is used to create surface-datasets from grid datasets and raw datafiles -at half-degree resolution to produce files that describe the surface characteristics -needed by &clm; (fraction of grid cell covered by different land-unit types, and fraction -for different vegetation types, as well as things like soil color, and soil texture, -etc.). To run mksurfdata you can either use the -mksurfdata.pl script which will create namelists for you using the &buildnml; -XML database, or you can run it by hand using a namelist that you provide (possibly -modeled after an example provided in the -models/lnd/clm/tools/mksurfdata directory). The namelist for -mksurfdata is sufficiently complex that we recommend using the -mksurfdata.pl tool to build them. In the next section -we describe how to use the mksurfdata.pl script and the following -section gives more details on running mksurfdata by hand and the -various namelist input variables to it. - - -Running <command>mksurfdata.pl</command> - -The script mksurfdata.pl can be used to run the -mksurfdata program for several configurations, resolutions, -simulation-years and simulation year ranges. It will create the needed namelists for -you and move the files -over to your inputdata directory location (and create a list of the files created, and -for developers this file is also a script to import the files into the svn inputdata -repository). It will also use the &buildnml; XML database -to determine the correct input files to use, and for transient cases it will create -the appropriate mksrf_fdynuse file with the list of files for each -year needed for this case. And in the case of urban single-point -datasets (where surface datasets are actually input into mksurfdata) -it will do the additional processing required so that the output dataset -can be used once again by mksurfdata. Because, it figures out -namelist and input files for you, it is recommended that you use this script for creation -of standard surface datasets. If you need to create surface datasets for customized -cases, you might need to run mksurfdata on it's own. But you -could use mksurfdata.pl with the "-debug" option to give you -a namelist to start from. -For help on mksurfdata.pl you can use the "-help" option as below: - -> cd models/lnd/clm/tools/mksurfdata -> mksurdata.pl -help - -The output of the above command is: - -&mksurfdatapl; - - - -To run the script with optimized mksurfdata for a 4x5 degree grid -for 1850 conditions, on bluefire you would do the following: - -Example of running <command>mksurfdata.pl</command> to create a 4x5 resolution -<filename>fsurdat</filename> for a 1850 simulation year - -> cd models/lnd/clm/tools/mksurfdata -> gmake -> mksurfdata.pl -y 1850 -r 4x5 - - - - - - -Running <command>mksurfdata</command> by Hand - -In the above section we show how to run mksurfdata through -the mksurfdata.pl using input datasets that are in the &buildnml; -XML database. When you are running with input datasets that are NOT available in -the XML database you either need to add them as outlined in -, or you need to run mksurfdata -by hand, as we will outline here. - - - -Preparing your <command>mksurfdata</command> namelist - -When running mksurfdata by hand you will need to prepare your -own input namelist. There are sample namelists that are setup for running on the -&ncar; machine bluefire. You will need to change the filepaths to -run on a different machine. The list of sample namelists include - -mksurfdata.namelist -- standard sample namelist. -mksurfdata.regional -- sample namelist to -build for a regional grid dataset (5x5_amazon) -mksurfdata.singlept -- sample namelist to -build for a single point grid dataset (1x1_brazil) - -Note, that one of the inputs mksrf_fdynuse is a filename that -includes the filepaths to other files. The filepaths in this file will have to -be changed as well. You also need to make sure that the line lengths remain the same -as the read is a formatted read, so the placement of the year in the file, must remain -the same, even with the new filenames. One advantage of the mksurfdata.pl -script is that it will create the mksrf_fdynuse file for you. - - -We list the namelist items below. Most of the namelist items are filepaths to give to -the input half degree resolution datasets that you will use to scale from to the -resolution of your grid dataset. -You must first specify the input grid dataset for the resolution to output for: - -mksrf_fgrid Grid dataset - -Then you must specify settings for input high resolution datafiles - -mksrf_ffrac land fraction and land mask dataset -mksrf_fglacier Glacier dataset -mksrf_fglacierregion Glacier region ID dataset -mksrf_flai Leaf Area Index dataset -mksrf_flanwat Land water dataset -mksrf_forganic Organic soil carbon dataset -mksrf_fmax Max fractional saturated area dataset -mksrf_fsoicol Soil color dataset -mksrf_fsoitex Soil texture dataset -mksrf_ftopo Topography dataset (this is used to limit -the extent of urban regions and is used for glacier multiple elevation classes) - -mksrf_furban Urban dataset -mksrf_fvegtyp PFT vegetation type dataset -mksrf_fvocef Volatile Organic Compound Emission Factor -dataset -mksrf_fgdp GDP dataset -mksrf_fpeat Peatland dataset -mksrf_fabm Agricultural fire peak month dataset -mksrf_ftopostats Topography statistics dataset -mksrf_fvic VIC parameters dataset -mksrf_fch4 Inversion-derived CH4 parameters dataset - -You specify the ASCII text file with the land-use files. - -mksrf_fdynuse "dynamic land use" for transient -land-use/land-cover changes. This is an ASCII text file that lists the filepaths -to files for each year and then the year it represents (note: you MUST change the -filepaths inside the file when running on a machine NOT at &ncar;). -We always use this file, even for creating datasets of a fixed year. Also note -that when using the "pft_" settings this file will be an XML-like file with settings -for PFT's rather than filepaths (see below). - - - -And optionally you can specify settings for: - -all_urban If entire area is urban (typically used for -single-point urban datasets, that you want to be exclusively urban) -no_inlandwet If TRUE, set wetland to 0% over land -(renormalizing other landcover types as needed); wetland will only be used for ocean -points. (Only applies to CLM4.5 version of mksurfdata_map, for which the default is -TRUE.) -mksrf_firrig Irrigation dataset, if you want -activate the irrigation model over generic cropland -(experimental mode, normally NOT used) -mksrf_gridnm Name of output grid resolution (if not -set the files will be named according to the number of longitudes by latitudes) -mksrf_gridtype Type of grid (default is 'global') -nglcec number of glacier multiple elevation classes. -Can be 0, 1, 3, 5, or 10. When using the resulting dataset with &clm; you can then run -with glc_nec of either 0 or this value. - (experimental normally use the default of 0, when running with the land-ice -model in practice only 10 has been used) -numpft number of Plant Function Types (PFT) -in the input vegetation mksrf_fvegtyp dataset. You change -this to 20, if you want to create a dataset with prognostic crop activated. The -vegetation dataset also needs to have prognostic crop types on it as well. - (experimental normally not changed from the default of 16) -outnc_large_files If output should be in &netcdf; large file -format -outnc_double If output should be in double -precision (normally we turn this on) -pft_frc array of fractions to override PFT -data with for all gridpoints (experimental mode, normally NOT used). -pft_idx array of PFT indices to override PFT -data with for all gridpoints (experimental mode, normally NOT used). -soil_clay percent clay soil to override -all gridpoints with (experimental mode, normally NOT used). -soil_color Soil color to override -all gridpoints with (experimental mode, normally NOT used). -soil_fmax Soil maximum fraction to override -all gridpoints with (experimental mode, normally NOT used). -soil_sand percent sandy soil to -override all gridpoints with (experimental mode, normally NOT used). - - - -After creating your namelist, -when running on a non &ncar; machine you will need to get the files -from the inputdata repository. -In order to retrieve the files needed for mksurfdata you can do the following on your -namelist to get the files from the inputdata repository, using the -check_input_data script which also allows you to export data to -your local disk. - -Getting the raw datasets for <command>mksurfdata</command> to your local -machine using the <command>check_input_data</command> script - -> cd models/lnd/clm/tools/mksurfdata -# First remove any quotes and copy into a filename that can be read by the -# check_input_data script -> sed "s/'//g" namelist > clm.input_data_list -# Run the script with -export and give the location of your inputdata with $CSMDATA -> ../../../../../scripts/ccsm_utils/Tools/check_input_data -datalistdir . \ --inputdata $CSMDATA -check -export -# You must then do the same with the flanduse_timeseries file referred to in the namelist -# in this case we add a file = to the beginning of each line -> awk '{print "file = "$1}' landuse_timeseries_hist_simyr2000-2000.txt > clm.input_data_list -# Run the script with -export and give the location of your inputdata with $CSMDATA -> ../../../../../scripts/ccsm_utils/Tools/check_input_data -datalistdir . \ --inputdata $CSMDATA -check -export - - - - -Experimental options to <command>mksurfdata</command> - -The options: pft_frc, pft_idx, soil_clay, soil_color, soil_fmax, and soil_sand are also -new and considered experimental. They provide a way to override the PFT and soil -values for all grid points to the given values that you set. This is useful for -running with single-point tower sites where the soil type and vegetation is known. -Note that when you use pft_frc, all other landunits will be zeroed out, and the -sum of your pft_frc array MUST equal 100.0. Also note that when using the "pft_" -options the mksrf_fdynuse file instead of having filepath's -will be an XML-like file with PFT settings. Unlike the file of file-paths, you will -have to create this file by hand, mksurfdata.pl will NOT be able -to create it for you (other than the first year which will be set to the values -entered on the command line). Note, that when &ptclm; is run, it CAN create these -files for you from a simpler format (see ). -Instead of a filepath you have a list of XML elements that give information on the PFT's -and harvesting for example: - -<pft_f>100</pft_f><pft_i>1</pft_i><harv>0,0,0,0,0</harv><graz>0</graz> - -So the <pft_f> tags give the PFT fractions and the <pft_i> tags give the -index for that fraction. Harvest is an array of five elements, and grazing is a single -value. Like the usual file each list of XML elements goes with a year, and there is -limit on the number of characters that can be used. - - - - - -Standard Practices when using <command>mksurfdata</command> - -In this section we give the recommendations for how to use mksurfdata -to give similar results to the files that we created when using it. - - -If you look at the standard surface datasets that we have created and provided for use, -there are three practices that we have consistently done in each (you also see these in -the sample namelists and in the mksurfdata.pl script). The first is -that we always output data in double precision (hence outnc_double -is set to .true.). The next is that we always use the procedure -for creating transient datasets (using mksrf_fdynuse) even when -creating datasets for a fixed simulation year. This is to ensure that the fixed year -datasets will be consistent with the transient datasets. When this is done a -"landuse_timeseries" dataset will be created -- but will NOT be used in &clm;. If you look -at the sample namelist mksurfdata.namelist you note that it -sets mksrf_fdynuse to the file -landuse_timeseries_hist_simyr2000.txt, where the single file entered is -the same PFT file used in the rest of the namelist (as mksrf_fvegtyp). -The last practice that we always do is to always set mksrf_ftopo, -even if glacier elevation classes are NOT active. This is -important in limiting urban areas based on topographic height, and hence is important -to use all the time. The glacier multiple elevation classes will be used as well if -you are running a compset with the active glacier model. - - -There are two other important practices for creating urban single point datasets. The -first is that you often will want to set all_urban to -.true. so that the dataset will have 100% of the gridcell output -as urban rather than some mix of: urban, vegetation types, and other landunits. The -next practice is that most of our specialized urban datasets have custom values for -the urban parameters, hence we do NOT want to use the global urban dataset to get -urban parameters -- we use a previous version of the surface dataset for the urban -parameters. However, in order to do this, we need to append onto the previous surface -dataset the grid and land mask/land fraction information from the grid and fraction -datasets. This is done in mksurfdata.pl using the NCO -program ncks. An example of doing this for the Mexico City, Mexico -urban surface dataset is as follows: - -> ncks -A $CSMDATA/lnd/clm2/griddata/griddata_1x1pt_mexicocityMEX_c090715.nc \ -$CSMDATA/lnd/clm2/surfdata/surfdata_1x1_mexicocityMEX_simyr2000_c100407.nc -> ncks -A $CSMDATA/lnd/clm2/griddata/fracdata_1x1pt_mexicocityMEX_navy_c090715.nc \ -$CSMDATA/lnd/clm2/surfdata/surfdata_1x1_mexicocityMEX_simyr2000_c100407.nc - -Note, if you look at the current single point urban surface datasets you will note -that the above has already been done. - - -The final issue is how to build mksurfdata. When NOT optimized -mksurfdata is very slow, and can take many hours to days to -even run for medium resolutions such as one or two degree. So usually you will want -to run it optimized. Possibly you also want to use shared memory parallelism using -&omp; with the SMP option. The problem with running optimized is that -answers will be different when running optimized versus non-optimized for most -compilers. So if you want answers to be the same as a previous surface dataset, you -will need to run it on the same platform and optimization level. Likewise, running -with or without &omp; may also change answers (for most compilers it will NOT, however -it does for the IBM compiler). However, answers should be the same regardless of the -number of threads used when &omp; is enabled. Note, that the output surface datasets -will have attributes that describe whether the file was written out optimized or not, -with threading or not and the number of threads used, to enable the user to more -easily try to match datasets created previously. For more information on the different -compiler options for the &clm4; tools see . - - - - - - - -Using &ncl; scripts <command>ndepregrid.ncl</command> and -<command>aerdepregrid.ncl</command> to interpolate aerosol deposition datasets - -Unlike the other tools, these are &ncar; Command Language (&ncl;) scripts -and you will need to get a copy of &ncl; in order to use them. You also won't have to -build an executable in order to use them, hence no Makefile is provided. &ncl; is provided -for free download as either binaries or source code from: -http://www.ncl.ucar.edu/. The &ncl; -web-site also contains documentation on &ncl; and it's use. - - -By default at this point neither of these scripts HAS to be used, -as the model is now constructed to read aerosol and Nitrogen deposition from 2-degree -datasets and interpolate to the model resolution on the fly. The main reason you might -want to do this now, is for better performance for single-point simulations. - - -Both the ndepregrid.ncl and aerdepregrid.ncl -scripts have similar interfaces and you customize the output resolution and -characteristics based on the settings of environment variables that you set (if you -don't set any of the variables, the script has defaults that it will use). -The list of environment variables that can be set are: - -RES -- output resolution name -RCP -- representative concentration pathway for future scenarios -(example 2.6, 4.5, 6, or 8.5) -SIM_YR -- simulation year (example 1850 or 2000) -SIM_YR_RNG -- simulation year range (example 1850-2000 or -1850-2100) -GRDFIL -- full pathname of grid file to use -(in place of getting the default grid file based on the RES value) -CSMDATA -- &cesm; inputdata directory -CLM_ROOT -- root directory for &clm; (models/lnd/clm directory) - - - - -You MUST provide either RES or both -GRDFIL AND RES. If you -just give RES the default namelist database in -models/lnd/clm/bld will be used to find the default grid -file based on the resolution name RES. If you provide -GRDFIL the input pathname of the gridfile provided will be used, -and the output filename will include RES as part of it's name -to designate it as an output file at that resolution. - - - -Both scripts assume that you will be interpolating from a native resolution of 1.9x2.5 -and using the default files found in the namelist database to interpolate from. If you -want to interpolate from another resolution or use other files, you would need to edit -the scripts to do so. Both scripts also use a bilinear interpolation to do the -regridding. The environment variables: RCP, SIM_YR, -and SIM_YR_RNG will be used to query the namelist database to -determine which native dataset to interpolate from. If you don't provide valid -values for these variables, it won't be able to find a dataset to interpolate from. -You can use the build-namelist script to query what the valid values for these can -be. Likewise, when you use RES to determine the grid file to interpolate -to, it needs to be a valid value from the namelist database. - - -The scripts can be used to interpolate from (and create output) constant or -transient datasets. -Constant datasets specify the SIM_YR and set SIM_YR_RNG -to constant (which is also the default). Transient datasets need -to specify both SIM_YR and SIM_YR_RNG, where -SIM_YR is set to the first year in the interval (typically 1850). - - -The default for CSMDATA works for &ncar; computers, but will need to -be set to the top level directory location of your &cesm; input data on other computers. -If you set this as a default for your shell when you login (for example with your -$HOME/.cshrc if you use csh) you won't have to set it each time -you run the script. CLM_ROOT will default to the proper location -when you run it in the models/lnd/clm/tools/ncl_script -directory. It is only useful if you want to run the script out of a different -directory. - - -Using <command>ndepregrid.ncl</command> to interpolate Nitrogen deposition datasets - -ndepregrid.ncl interpolates the Nitrogen deposition datasets from one resolution -to another. - - - -Interpolating Nitrogen deposition files is no longer needed, because the model can -read Nitrogen deposition files at one resolution and interpolate to the resolution the -model is running at on the fly. Interpolating to another -resolution is only useful for very course resolutions, if you want to save some computing -resources in reading larger datasets. For example, this may be useful in obtaining -single-point datasets. - - - -For example, to interpolate to an output resolution of 0.9x1.25, for a constant -simulation-year of 1850, you would do the following: - -> env RES=0.9x1.25 SIM_YR=1850 ncl ndepregrid.ncl - - - - - -Using <command>aerdepregrid.ncl</command> to interpolate Aerosol deposition datasets - -aerdepregrid.ncl interpolates the Aerosol deposition datasets from one resolution. -It can be used to interpolate either constant datasets (for example: -aerosoldep_monthly_2000_0.9x1.25_c090828.nc) or transient datasets (for example: -aerosoldep_monthly_1849-2006_0.9x1.25_c090830.nc). - - - -Interpolating aerosol deposition files is no longer needed, because the &datm; model can -read aerosol deposition files at one resolution and interpolate to the resolution the -model is running at on the fly. Interpolating to another -resolution is only useful for very course resolutions, if you want to save some computing -resources in reading larger datasets. For example, this may be useful in obtaining -single-point datasets. - - - -For example, to interpolate to an output resolution of 4x5, for a transient -simulation-year range of 1850 to 2100 and the rcp of 8.5, you would do the following: - -> env RES=4x5 SIM_YR=1850 SIM_YR_RNG=1850-2100 RCP=8.5 ncl ndepregrid.ncl - - - - - - -How to Customize Datasets for particular Observational Sites - -There are two ways to customize datasets for a particular observational site. The first -is to customize the input to the tools that create the dataset, and the second is to -over-write the default data after you've created a given dataset. Depending on the tool -it might be easier to do it one way or the other. In we list the files that are most likely to be -customized and the way they might be customized. Of those files, the ones you are most -likely to customize are: fatmlndfrc, fsurdat, faerdep (for &datm;), and -stream_fldfilename_ndep. Note mksurfdata as documented previously -has options to overwrite the vegetation and soil types. For more information on this also see - and &ptclm; uses these methods to -customize datasets see . - - -Another aspect of customizing your input datasets is customizing the input atmospheric -forcing datasets. See the for more -information on this. Also the chapter on &ptclm; in -has information on using the AmeriFlux tower site data as atmospheric forcing. - - - - -Conclusion of tools description - -We've given a description of how to use the different tools with &clm; to create -customized datasets. In the next chapter we will talk about how to make these -files available for build-namelist so that you can easily create simulations -that include them. In the chapter on single-point and regional datasets we also -give an alternative way to enter new datasets without having to edit files. - - - - - diff --git a/doc/UsersGuide/trouble_shooting.xml b/doc/UsersGuide/trouble_shooting.xml deleted file mode 100644 index 418cfabaae..0000000000 --- a/doc/UsersGuide/trouble_shooting.xml +++ /dev/null @@ -1,545 +0,0 @@ - - -Trouble Shooting Problems - -In this chapter we give some guidance on what to do when you encounter some of the -most common problems. We can't cover all the problems that a user could potentially -have, but we will try to help you recognize some of the most common situations. -And we'll give you some suggestions on how to approach the problem to come up with -a solution. - - -In general you will run into one of three type of problems: - -configure-time -build-time -run-time - -You may also run into problems with create_newcase itself, or -with the archiving scripts -- for those problems you should consult the -&cesmrel; Scripts User's Guide. - - - -Trouble with Configuration - -The first type of problem happens when you invoke the configure -case -command. This indicates there is something wrong with your template files, or input -datasets, or the details of what you are trying to configure the model to do. -There's also a trouble-shooting chapter in the &cesmrel; -Scripts User's Guide. Many of the problems with configuration can be resolved -with the guidelines given there. Here we will restrict ourselves to problems from the -&clm; or &datm; templates or input files. - -Example of configure problem with missing datasets - -> ./create_newcase -case T31rcp6 -res T31_g37 -compset IRCP60CN \ --mach bluefire -> ./configure -case - -The following is what is displayed to the screen. - -Generating resolved namelist, prestage, and build scripts -configure done. -adding use_case 1850-2100_rcp6_transient defaults for var clm_demand with val flanduse_timeseries -adding use_case 1850-2100_rcp6_transient defaults for var clm_start_type with val startup -adding use_case 1850-2100_rcp6_transient defaults for var model_year_align_ndep with val -1850 -adding use_case 1850-2100_rcp6_transient defaults for var rcp with val 6 -adding use_case 1850-2100_rcp6_transient defaults for var sim_year with val 1850 -adding use_case 1850-2100_rcp6_transient defaults for var sim_year_range with val -1850-2100 -adding use_case 1850-2100_rcp6_transient defaults for var stream_year_first_ndep with val -1850 -adding use_case 1850-2100_rcp6_transient defaults for var stream_year_last_ndep with val -2100 -adding use_case 1850-2100_rcp6_transient defaults for var use_case_desc with val Simulate -transient land-use, aerosol and Nitrogen deposition changes with historical data from -1850 to 2005 and then with the RCP6 scenario from AIM - -build-namelist - No default value found for flanduse_timeseries. - Are defaults provided for this resolution and land mask? -ERROR: generate_resolved.csh error for lnd template -configure error: configure generated error in attempting to created resolved scripts - - -The important thing to note here is the line: - -ERROR: generate_resolved.csh error for lnd template - -which tells us that the problem is in the land template. It may also indicate problems -in one of the other templates (atm, ccsm, cpl, glc, ice, or ocn), in which case you -should consult the appropriate model user's guide, and examine the given template file -in Tools/Templates. For more information on working with template -files see . - - -In the example above, it's obvious that the problem is coming from the &clm; &buildnml;, -in other situations it might not be so obvious where the problem is occurring. In such -cases it might be useful to add a "set echo" command to the top of the template file so -that each command in the template will be echoed to the screen and you can see what -is happening and where the error is occurring. - -set echo - - - -In the example, the error is that the &clm; XML database does NOT have a -flanduse_timeseries for the given resolution, rcp scenario and ocean mask. -That means you will need to create the file and then supply the file into your case. See - for more information on creating files, and see - for more information on adding files to the -XML database. Alternatively, you can provide the file to your case by creating -a user namelist as shown in . - - - -The two most common problems from your &clm; template will be errors from the &clm; -&configure; or &buildnml;. For more information on these scripts see: - and -the section on &CLMBLDNML;. - - - - - -Trouble with Building - -Here's an example of running the build for a case and having it fail in the land model -build. As you can see it lists which model component is being built and the build log -for that component. - - CCSM BUILDEXE SCRIPT STARTING - - Build Libraries: mct pio csm_share -Sat Jun 19 21:21:19 MDT 2010 /ptmp/erik/test_build/mct/mct.bldlog.100619-212107 -Sat Jun 19 21:22:18 MDT 2010 /ptmp/erik/test_build/pio/pio.bldlog.100619-212107 -Sat Jun 19 21:23:18 MDT 2010 -/ptmp/erik/test_build/csm_share/csm_share.bldlog.100619-212107 -Sat Jun 19 21:24:00 MDT 2010 /ptmp/erik/test_build/run/cpl.bldlog.100619-212107 -Sat Jun 19 21:24:00 MDT 2010 /ptmp/erik/test_build/run/atm.bldlog.100619-212107 -Sat Jun 19 21:24:06 MDT 2010 /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 -ERROR: clm.buildexe.csh failed, see /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 -ERROR: cat /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 - -You can then examine the build log that failed and see what went wrong. Most compilers -will give the full filepath and line number for the file that filed to compile. - - - - -Trouble with Running - -Tracking down problems while the model is running is much more difficult to do -than configure or build problems. In this section we will give some suggestions -on how to find run time problems. Below we show the log file results of a job -that aborted while running. - - CCSM PRESTAGE SCRIPT HAS FINISHED SUCCESSFULLY -Sun Jun 20 18:24:06 MDT 2010 -- CSM EXECUTION BEGINS HERE -Sun Jun 20 18:24:35 MDT 2010 -- CSM EXECUTION HAS FINISHED -Model did not complete - see /ptmp/erik/test_run/run/cpl.log.100620-182358 - -In the next section we will talk about using the different log files to track -down problems, and find out where the problem is coming from. In the section -after that we give some general advice on debugging problems and some suggestions -on ideas that may be helpful to track the problem down. Some of the examples -below are from the &KnownBugs; file. - - -Tracking Problems by Querying Log Files - -The first thing to do when tracking down problems is to query the different log -files to see if you can discover where the problem occurs, and any error messages about -it. It's important to figure out if the problem comes in at initialization or in the -run phase of the model, and in which model component the problem happens. There -are different log files for the different major components, and they all end -with the date and time in YYMMDD-HHMMSS format (2-digit: year, month, day, hour -minute and second). When the model runs to completion the log files will be copied -to the logs directory in the script directory, but when the -model fails they will remain in the run directory. Here's an example list of -log files from an "I" case where the model dies in the land model initialization. -For "I" cases the sea-ice and ocean components are just stubs and don't create -log files (and unless running with the active land-ice model "glc" log files won't -be created either). - -atm.log.100620-182358 -ccsm.log.100620-182358 -cpl.log.100620-182358 -lnd.log.100620-182358 - - - - -The coupler log file - -The first log file to check is the coupler log file so that you can see where -the model dies and which model component it fails in. When the model dies at -initialization the last model component listed is the component that failed. - - -Example of a case that fails in the &clm; land model initialization. - -(seq_timemgr_clockPrint) Prev Time = 00001201 00000 -(seq_timemgr_clockPrint) Next Time = 99991201 00000 -(seq_timemgr_clockPrint) Intervl yms = 9999 0 0 - -(seq_mct_drv) : Initialize each component: atm, lnd, ocn, and ice -(seq_mct_drv) : Initialize atm component -(seq_mct_drv) : Initialize lnd component - - - - - -The ccsm log file - -The ccsm log files are to some extent the "garbage collection" of log output. The -&clm; sends it's output from it's master processor, but sends other output and possibly -errors to the ccsm log file. Because, of this, often error messages are somewhere in the -ccsm log file. However, since there is so much other output it may be difficult to find. -For example, here is some output from an older version of &cesm; (&cesm102;) where the -RTM river routing file (before it was converted to &netcdf;) was not provided and -the error on the open statement for the file was embedded near the end of the ccsm log -file. - -NODE# NAME -( 0) be1105en.ucar.edu -"/gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/lnd/clm/src/riverroute/RtmMod.F90", line -239: 1525-155 The file name provided in the OPEN statement for unit 1 has zero length or -contains all blanks. The program will recover by ignoring the OPEN statement. -"/gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/lnd/clm/src/riverroute/RtmMod.F90", line -241: 1525-001 The READ statement on the file fort.1 cannot be completed because the end -of the file was reached. The program will stop. - -Running: ./ccsm.exe -Please wait... - -Memory usage for ./ccsm.exe (task # 0) is: 51696 KB. Exit status: 1. Signal: 0 - -Although the example is from an earlier version of the model it still serves to -illustrate finding problems from the ccsm log file. - - -When working with the ccsm log file, for a run-time problem, you will need to be able -to separate it's output into three categories: pre-crash, crash, and post-crash. The -pre-crash section is everything that is normal output for good operation of the model. -The crash section is the section where the model dies and reports on the actual problem. -the post-crash section is the cleanup and finalization after the model dies. The most -important part of this of course is the crash section. The tricky part is distinguishing -it from the other sections. Also because the ccsm log file most likely has duplicated -output from multiple processors it is even more difficult to distinguish the different -sections and to some extent the sections may be intertwined, as different processors -reach the different sections at different times. Because, of this reducing the number of -processors for your simulation may help you sort out the output in the file (see -). Also much of the output from the ccsm log file are -system level information having to do with &mpi; multiprocessing. Usually you can ignore -this information, but it makes it more difficult to trudge through. - - -Sometimes the ccsm log file is the ONLY file available, because the model terminates -early in initialization. In this case understanding the output in the ccsm log file -becomes even more important. This also indicates the model did NOT advance far enough -to reach the initialization of the individual model components. This may mean that the -initialization of the multiprocessing for &mpi; and/or &omp; failed, or that the -reading of the driver namelist file "drv_in" failed. - - -Here we show those three sections for a ccsm log file where a two task job failed on -reading the namelist file. For a typical job with many tasks similar sections of this -will be repeated not just twice but for each task and hence make it harder to read. - - -Pre-crash section of the ccsm log file - -ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. -ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. -ATTENTION: 0031-378 MP_EUIDEVICE setting ignored when LoadLeveler is not being used. -ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. - 0:INFO: 0031-724 Executing program: </usr/local/lsf/7.0/aix5-64/bin/lsnrt_run> - 1:INFO: 0031-724 Executing program: </usr/local/lsf/7.0/aix5-64/bin/lsnrt_run> - 0:/contrib/bin/ccsm_launch: process 401894 bound to logical CPU 0 on host be0310en.ucar.edu ... - 1:/contrib/bin/ccsm_launch: process 439264 bound to logical CPU 1 on host be0310en.ucar.edu ... - 0:INFO: 0031-619 64bit(us, Packet striping on) ppe_rmas MPCI_MSG: MPI/MPCI library was compiled on Wed Aug 5 13:36:06 2009 - 0: - 1:LAPI version #14.26 2008/11/23 11:02:30 1.296 src/rsct/lapi/lapi.c, lapi, rsct_rpt53, rpt53s004a 09/04/29 64bit(us) library compiled on Wed Apr 29 15:30:42 2009 - 1:. - 1:LAPI is using lightweight lock. - 0:LAPI version #14.26 2008/11/23 11:02:30 1.296 src/rsct/lapi/lapi.c, lapi, rsct_rpt53, rpt53s004a 09/04/29 64bit(us) library compiled on Wed Apr 29 15:30:42 2009 - 0:. - 0:LAPI is using lightweight lock. - 0:Use health ping for failover/recovery - 1:Use health ping for failover/recovery - 0:Initial communication over instance 2. - 1:Initial communication over instance 0. - 1:IB RDMA initialization completed successfully - 1:The MPI shared memory protocol is used for the job - 0:IB RDMA initialization completed successfully - 0:LAPI job ID for this job is: 1684890719 - 0:The MPI shared memory protocol is used for the job - 0:(seq_comm_setcomm) initialize ID ( 7 GLOBAL ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 2 ATM ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 1 LND ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 4 ICE ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 5 GLC ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 3 OCN ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 6 CPL ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 8 CPLATM ) join IDs = 6 2 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 9 CPLLND ) join IDs = 6 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 10 CPLICE ) join IDs = 6 4 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 11 CPLOCN ) join IDs = 6 3 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 12 CPLGLC ) join IDs = 6 5 ( npes = 2) ( nthreads = 1) - 0: - 0: (seq_comm_printcomms) ID layout : global pes vs local pe for each ID - 0: gpe LND ATM OCN ICE GLC CPL GLOBAL CPLATM CPLLND CPLICE CPLOCN CPLGLC nthrds - 0: --- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ - 0: 0 : 0 0 0 0 0 0 0 0 0 0 0 0 1 - 1: 1 : 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1: - 0: (t_initf) Read in prof_inparm namelist from: drv_in - 1: (seq_io_init) cpl_io_stride, iotasks or root out of bounds - resetting to defaults 4 0 1 - 0: piolib_mod.f90 1353 1 2 1 2 - 1: piolib_mod.f90 1353 1 2 1 2 - 0: pio_support::pio_die:: myrank= 0 : ERROR: piolib_mod.f90: 1354 : not enough procs for the stride - 1: pio_support::pio_die:: myrank= 1 : ERROR: piolib_mod.f90: 1354 : not enough procs for the stride - - - -Crash section of the ccsm log file - - 0: - 0: Traceback: - 1: - 1: Traceback: - 0: Offset 0x00000c4c in procedure __pio_support_NMOD_piodie, near line 88 in file pio_support.F90.in - 1: Offset 0x00000c4c in procedure __pio_support_NMOD_piodie, near line 88 in file pio_support.F90.in - 0: Offset 0x00000fd0 in procedure __piolib_mod_NMOD_init, near line 1354 in file piolib_mod.F90 - 1: Offset 0x00000fd0 in procedure __piolib_mod_NMOD_init, near line 1354 in file piolib_mod.F90 - 1: Offset 0x00000398 in procedure __seq_io_mod_NMOD_seq_io_init, near line 247 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/shr/seq_io_mod.F90 - 0: Offset 0x00000398 in procedure __seq_io_mod_NMOD_seq_io_init, near line 247 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/shr/seq_io_mod.F90 - 0: Offset 0x0001aa88 in procedure ccsm_driver, near line 465 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/driver/ccsm_driver.F90 - 0: --- End of call chain --- - 1: Offset 0x0001aa88 in procedure ccsm_driver, near line 465 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/driver/ccsm_driver.F90 - 1: --- End of call chain --- - - - -Post-crash section of the ccsm log file - - 1:Communication statistics of task 1 is associated with task key: 1684890719_1 - 0:Communication statistics of task 0 is associated with task key: 1684890719_0 - 0: - 0:Running: ./ccsm.exe - 0:Please wait... - 0: - 0:Memory usage for ./ccsm.exe (task # 0) is: 198892 KB. Exit status: 134. Signal: 0 - 1: - 1:Running: ./ccsm.exe - 1:Please wait... - 1: - 1:Memory usage for ./ccsm.exe (task # 0) is: 198572 KB. Exit status: 134. Signal: 0 -INFO: 0031-656 I/O file STDOUT closed by task 0 -INFO: 0031-656 I/O file STDERR closed by task 0 -ERROR: 0031-250 task 0: IOT/Abort trap -INFO: 0031-656 I/O file STDOUT closed by task 1 -INFO: 0031-656 I/O file STDERR closed by task 1 -ERROR: 0031-250 task 1: IOT/Abort trap -INFO: 0031-639 Exit status from pm_respond = 0 -ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. -Job /usr/local/lsf/7.0/aix5-64/bin/poejob /contrib/bin/ccsm_launch /contrib/bin/job_memusage.exe ./ccsm.exe - -TID HOST_NAME COMMAND_LINE STATUS TERMINATION_TIME -===== ========== ================ ======================= =================== -00000 be0310en /contrib/bin/ccs Exit (134) 08/31/2010 12:32:57 -00001 be0310en /contrib/bin/ccs Exit (134) 08/31/2010 12:32:57 - - - - - -The &clm; log file - -Of course when you are working with and making changes to &clm;, most of your focus -will be on the &clm; log file and the errors it shows. As already pointed out -if you don't see errors in the lnd.log.* file you should look -in the ccsm.log.* to see if any errors showed up there. - - -Here's an example of the lnd.log.* file when running -&PTSMODE; with initial conditions (this is bug 1025 in the &KnownBugs; file). - - Successfully initialized variables for accumulation - - reading restart file I2000CN_f09_g16_c100503.clm2.r.0001-01-01-00000.nc - Reading restart dataset - ERROR - setlatlon.F:Cant get variable dim for lat or lsmlat - ENDRUN: called without a message string - - - - - -The &datm; log file - -When working with "I cases" the second most common problems after &clm; problems are -problems with the data atmosphere model. So examining the atm.log.* -is important. - - -Here's an example of a problem that occurs when the wrong prescribed aerosol file -is given to a pt1_pt1 simulation. - -(datm_comp_init) atm mode = CLMNCEP -(shr_strdata_init) calling shr_dmodel_mapSet for fill -(shr_strdata_init) calling shr_dmodel_mapSet for remap - ('shr_map_getWts') ERROR: yd outside bounds 19.5000000000000000 -(shr_sys_abort) ERROR: ('shr_map_getWts') ERROR yd outside 90 degree bounds -(shr_sys_abort) WARNING: calling shr_mpi_abort() and stopping - - - - - -The batch log files - -The names of the batch log files will depend on the batch system of the machine -that is being used. They will normally be in the script directory. Usually, they -don't contain important information, but they are a last resort place to look for -error messages. On the &ncar; IBM system "bluefire" the batch files are called -with names that start with "poe" and then either "stderr" or "stdout", with the -job number at the end. - - - - - - -General Advice on Debugging Run time Problems - -Here are some suggestions on how to track down a problem while running. In general -if the problem still occurs for a simpler case, it will be easier to track down. - -Run in DEBUG mode -Run with a smaller set of processors -Run in serial mode with a single processor -Run at a lower resolution -Run a simpler case -Run with a debugger - - - - -Run in DEBUG mode - -The first thing to try is to run in DEBUG mode so that float point trapping will be -triggered as well as array bounds checking and other things the compiler can turn -on to help you find problems. To do this edit the &envbuild; file and set DEBUG - to TRUE as follows: - -> ./xmlchange -file env_build.xml -id DEBUG -val TRUE - - - - - -Run with a smaller set of processors - -Another way to simplify the system is to run with a smaller set of processors. You -will need to clean the configure and edit the env_mach_pes.xml. -For example, to run with four processors: - -> ./configure -cleanall -> ./xmlchange -file env_mach_pes.xml -id NTASKS_ATM -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_LND -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_ICE -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_OCN -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_CPL -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_GLC -val 4 -> ./configure -case - -Another recommended simplification is to run without threading, so set the -NTHRDS for each component to "1" if it isn't already. Sometimes, -multiprocessing problems require a certain number of processors before they occur -so you may not be able to debug the problem without enough processors. But, it's always -good to reduce it to as low a number as possible to make it simpler. For threading -problems you may have to have threading enabled to find the problem, but you can run -with 1, 2, or 3 threads to see what happens. - - - - -Run in serial mode with a single processor - -Simplifying to one processor removes all multi-processing problems and makes -the case as simple as possible. If you can enable USE_MPI_SERIAL -you will also be able to run interactively rather than having to submit to a job -queue, which sometimes makes it easier to run and debug. If you can use -USE_MPI_SERIAL you can also use threading, but still run interactively -in order to use more processors to make it faster if needed. - -> ./configure -cleanall -# Set tasks and threads for each component to 1 -# You could also set threads to something > 1 for speed, but still -# run interactively if threading isn't an issue. -> ./xmlchange -file env_mach_pes.xml -id NTASKS_ATM -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_ATM -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_LND -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_LND -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_ICE -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_ICE -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_OCN -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_OCN -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_CPL -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_CPL -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_GLC -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_GLC -val 1 -# If mpi-serial capability is available on the machine you are using -# set USE_MPI_SERIAL to true so that you can run interactively -> ./xmlchange -file env_conf.xml -id USE_MPI_SERIAL -val TRUE -> ./configure -case -# Then build your case -# And finally run, by running the *.run script interactively -# (If you were able to set USE_MPI_SERIAL to true) - - - - - -Run at a lower resolution - -If you can create a new case running at a lower resolution and replicate the problem -it may be easier to solve. This of course requires creating a whole new case, and trying -out different lower resolutions. - - - - -Run a simpler case - -Along the same lines, you might try running a simpler case, trying another compset -with a simpler setup and see if you can replicate the problem and then debug from that -simpler case. Again, of course you will need to create new cases to do this. - - - - -Run with a debugger - -Another suggestion is to run the model with a debugger such as: dbx, -gdb, or totalview. Often to run with a debugger -you will need to reduce the number of processors as outlined above. Some debuggers such -as dbx will only work with one processor, while more advanced -debuggers such as totalview can work with both &mpi; tasks and OMP -threads. Even simple debuggers though can be used to query core files, to see where -the code was at when it died (for example using the where in -dbx for a core file can be very helpful. For help in running -with a debugger you will need to contact your system administrators for the machine -you are running on. - - - - - - - - From dd76d2a66cae1151980ac1430956fde2be5337e4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 26 Mar 2020 17:13:37 -0600 Subject: [PATCH 0722/1973] Use git LFS to track image files --- .gitattributes | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..4ef52ab007 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +*.svg filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.jpeg filter=lfs diff=lfs merge=lfs -text +*.gif filter=lfs diff=lfs merge=lfs -text From 13a3883b3c629c6b72de951568e31db46e51b423 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 26 Mar 2020 16:25:45 -0600 Subject: [PATCH 0723/1973] By default, don't fetch files stored in LFS Based on https://github.com/git-lfs/git-lfs/issues/2717 The purpose of this is two-fold: (1) It keeps clones and fetches lighter-weight (2) It keeps our LFS bandwidth down, so we're less likely to need to upgrade our account (though that may be free for our educational account). --- .lfsconfig | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .lfsconfig diff --git a/.lfsconfig b/.lfsconfig new file mode 100644 index 0000000000..3d2778fad3 --- /dev/null +++ b/.lfsconfig @@ -0,0 +1,2 @@ +[lfs] + fetchexclude = * From eb196da132251be798dde444130603dbdd722d5f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 26 Mar 2020 17:25:59 -0600 Subject: [PATCH 0724/1973] Store images directly in repository, managed by git LFS Get rid of the images external. Instead, put the images directly in the users guide / tech note source. These images will be managed by git LFS. --- .gitignore | 1 - Externals_CLM.cfg | 7 ------- .../tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 2 +- .../tech_note/CN_Pools/CLMCN_pool_structure_v2_lores.png | 3 +++ .../Decomposition/CLM4_vertsoil_soilstruct_drawing.png | 3 +++ .../Decomposition/CLM50_Tech_Note_Decomposition.rst | 4 ++-- .../tech_note/Decomposition/soil_C_pools_CN_century.png | 3 +++ .../tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 2 +- doc/source/tech_note/Ecosystem/image1.png | 3 +++ .../CLM50_Tech_Note_External_Nitrogen_Cycle.rst | 2 +- doc/source/tech_note/External_Nitrogen_Cycle/image1.png | 3 +++ doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst | 4 ++-- doc/source/tech_note/Fluxes/image1.png | 3 +++ doc/source/tech_note/Fluxes/image2.png | 3 +++ .../tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst | 4 ++-- doc/source/tech_note/Hydrology/hydrologic.processes.png | 3 +++ doc/source/tech_note/Hydrology/image1.png | 3 +++ doc/source/tech_note/Hydrology/image2.png | 3 +++ .../Introduction/CLM50_Tech_Note_Introduction.rst | 2 +- doc/source/tech_note/Introduction/image1.png | 3 +++ doc/source/tech_note/Isotopes/image1.png | 3 +++ doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst | 2 +- doc/source/tech_note/MOSART/mosart_diagram.png | 3 +++ doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst | 2 +- doc/source/tech_note/Methane/image1.png | 3 +++ .../Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst | 4 ++-- doc/source/tech_note/Plant_Hydraulics/circuit.jpg | 3 +++ .../Plant_Hydraulics/phs_iteration_schematic.svg | 3 +++ doc/source/tech_note/Plant_Respiration/image1.png | 3 +++ doc/source/tech_note/Plant_Respiration/image2.png | 3 +++ .../Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst | 2 +- doc/source/tech_note/Radiative_Fluxes/image1.png | 3 +++ .../Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst | 2 +- doc/source/tech_note/Snow_Hydrology/image1.png | 3 +++ .../CLM50_Tech_Note_Soil_Snow_Temperatures.rst | 2 +- doc/source/tech_note/Soil_Snow_Temperatures/image1.png | 3 +++ .../CLM50_Tech_Note_Transient_Landcover.rst | 6 +++--- doc/source/tech_note/Transient_Landcover/image1.png | 3 +++ doc/source/tech_note/Transient_Landcover/image2.png | 3 +++ doc/source/tech_note/Transient_Landcover/image3.png | 3 +++ doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst | 6 +++--- doc/source/tech_note/Urban/image1.png | 3 +++ doc/source/tech_note/Urban/image2.png | 3 +++ doc/source/tech_note/Urban/image3.png | 3 +++ .../CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst | 2 +- .../tech_note/Vegetation_Phenology_Turnover/image1.png | 3 +++ ...ning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst | 4 ++-- .../Spinning-up-the-biogeochemistry-BGC-spinup.rst | 8 ++++---- doc/source/users_guide/running-special-cases/image1.png | 3 +++ doc/source/users_guide/running-special-cases/image2.png | 3 +++ doc/source/users_guide/running-special-cases/image3.png | 3 +++ doc/source/users_guide/running-special-cases/image4.png | 3 +++ doc/source/users_guide/running-special-cases/image5.png | 3 +++ doc/source/users_guide/running-special-cases/image6.png | 3 +++ doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg | 3 +++ .../using-clm-tools/LegendCLMToolDataFlow.jpeg | 3 +++ .../users_guide/using-clm-tools/creating-domain-files.rst | 4 ++-- .../creating-input-for-surface-dataset-generation.rst | 2 +- .../using-clm-tools/creating-surface-datasets.rst | 4 ++-- .../users_guide/using-clm-tools/mkmapdata_details.jpeg | 3 +++ .../users_guide/using-clm-tools/mkmapdata_mksurfdata.jpeg | 3 +++ doc/source/users_guide/using-clm-tools/mknoocnmap.jpeg | 3 +++ .../users_guide/using-clm-tools/mksurfdata_details.jpeg | 3 +++ 63 files changed, 155 insertions(+), 43 deletions(-) create mode 100644 doc/source/tech_note/CN_Pools/CLMCN_pool_structure_v2_lores.png create mode 100644 doc/source/tech_note/Decomposition/CLM4_vertsoil_soilstruct_drawing.png create mode 100644 doc/source/tech_note/Decomposition/soil_C_pools_CN_century.png create mode 100755 doc/source/tech_note/Ecosystem/image1.png create mode 100755 doc/source/tech_note/External_Nitrogen_Cycle/image1.png create mode 100755 doc/source/tech_note/Fluxes/image1.png create mode 100755 doc/source/tech_note/Fluxes/image2.png create mode 100644 doc/source/tech_note/Hydrology/hydrologic.processes.png create mode 100755 doc/source/tech_note/Hydrology/image1.png create mode 100755 doc/source/tech_note/Hydrology/image2.png create mode 100755 doc/source/tech_note/Introduction/image1.png create mode 100755 doc/source/tech_note/Isotopes/image1.png create mode 100644 doc/source/tech_note/MOSART/mosart_diagram.png create mode 100755 doc/source/tech_note/Methane/image1.png create mode 100644 doc/source/tech_note/Plant_Hydraulics/circuit.jpg create mode 100644 doc/source/tech_note/Plant_Hydraulics/phs_iteration_schematic.svg create mode 100755 doc/source/tech_note/Plant_Respiration/image1.png create mode 100755 doc/source/tech_note/Plant_Respiration/image2.png create mode 100755 doc/source/tech_note/Radiative_Fluxes/image1.png create mode 100755 doc/source/tech_note/Snow_Hydrology/image1.png create mode 100755 doc/source/tech_note/Soil_Snow_Temperatures/image1.png create mode 100755 doc/source/tech_note/Transient_Landcover/image1.png create mode 100755 doc/source/tech_note/Transient_Landcover/image2.png create mode 100755 doc/source/tech_note/Transient_Landcover/image3.png create mode 100755 doc/source/tech_note/Urban/image1.png create mode 100755 doc/source/tech_note/Urban/image2.png create mode 100644 doc/source/tech_note/Urban/image3.png create mode 100755 doc/source/tech_note/Vegetation_Phenology_Turnover/image1.png create mode 100644 doc/source/users_guide/running-special-cases/image1.png create mode 100644 doc/source/users_guide/running-special-cases/image2.png create mode 100644 doc/source/users_guide/running-special-cases/image3.png create mode 100644 doc/source/users_guide/running-special-cases/image4.png create mode 100644 doc/source/users_guide/running-special-cases/image5.png create mode 100644 doc/source/users_guide/running-special-cases/image6.png create mode 100644 doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg create mode 100644 doc/source/users_guide/using-clm-tools/LegendCLMToolDataFlow.jpeg create mode 100644 doc/source/users_guide/using-clm-tools/mkmapdata_details.jpeg create mode 100644 doc/source/users_guide/using-clm-tools/mkmapdata_mksurfdata.jpeg create mode 100644 doc/source/users_guide/using-clm-tools/mknoocnmap.jpeg create mode 100644 doc/source/users_guide/using-clm-tools/mksurfdata_details.jpeg diff --git a/.gitignore b/.gitignore index 2c7a551197..4a5672d970 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ manage_externals.log /tools/PTCLM/ /cime/ /components/ -/doc/images/ # ignore svn directories **/.svn/** diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 162fae65b1..84b7d5ec33 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -12,13 +12,6 @@ repo_url = https://github.com/ESCOMP/ptclm tag = PTCLM2_180611 required = True -[doc-images] -local_path = doc/images -protocol = git -repo_url = https://github.com/ESCOMP/CTSM-doc-images.git -hash = 476c694359e76c5054958e1397b8fa18aa0ff3e0 -required = False - [externals_description] schema_version = 1.0.0 diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst index 63024c7e0e..9bddee21ca 100644 --- a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -35,7 +35,7 @@ variables for vegetation carbon, and 22 for vegetation nitrogen. .. _Figure Vegetation fluxes and pools: -.. figure:: ../../../images/tech_note/CN_Pools/CLMCN_pool_structure_v2_lores.png +.. figure:: CLMCN_pool_structure_v2_lores.png :width: 753px :height: 513px diff --git a/doc/source/tech_note/CN_Pools/CLMCN_pool_structure_v2_lores.png b/doc/source/tech_note/CN_Pools/CLMCN_pool_structure_v2_lores.png new file mode 100644 index 0000000000..71a6c288a7 --- /dev/null +++ b/doc/source/tech_note/CN_Pools/CLMCN_pool_structure_v2_lores.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f275a1988475be5dae7979e94e5425342797f4db34fdafee1024915164f4257f +size 38450 diff --git a/doc/source/tech_note/Decomposition/CLM4_vertsoil_soilstruct_drawing.png b/doc/source/tech_note/Decomposition/CLM4_vertsoil_soilstruct_drawing.png new file mode 100644 index 0000000000..5bbd835f60 --- /dev/null +++ b/doc/source/tech_note/Decomposition/CLM4_vertsoil_soilstruct_drawing.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60e79931915921514486ee7c42f7944b05ec7f3c86885bb9aedc55c0c70732a6 +size 141651 diff --git a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst index baeb744dcb..0d2ad98687 100644 --- a/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst +++ b/doc/source/tech_note/Decomposition/CLM50_Tech_Note_Decomposition.rst @@ -20,7 +20,7 @@ calculations (see Section :numref:`Soil Layers` for soil layering). .. _Figure Schematic of decomposition model in CLM: -.. figure:: ../../../images/tech_note/Decomposition/CLM4_vertsoil_soilstruct_drawing.png +.. figure:: CLM4_vertsoil_soilstruct_drawing.png Schematic of decomposition model in CLM. @@ -65,7 +65,7 @@ structures is in :ref:`Koven et al. (2013) `. .. _Figure Pool structure: -.. figure:: ../../../images/tech_note/Decomposition/soil_C_pools_CN_century.png +.. figure:: soil_C_pools_CN_century.png Pool structure, transitions, respired fractions (numbers at end of arrows), and turnover times (numbers in boxes) for the 2 diff --git a/doc/source/tech_note/Decomposition/soil_C_pools_CN_century.png b/doc/source/tech_note/Decomposition/soil_C_pools_CN_century.png new file mode 100644 index 0000000000..abc02ec15a --- /dev/null +++ b/doc/source/tech_note/Decomposition/soil_C_pools_CN_century.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47635548f549ccf6cd70a57dbcdcdb22d12d306a3aa32b6a708c07baa174ffb8 +size 53905 diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index 2fbbaeff9a..d90c8cab40 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -53,7 +53,7 @@ classes. .. _Figure CLM subgrid hierarchy: -.. Figure:: ../../../images/tech_note/Ecosystem/image1.png +.. Figure:: image1.png Configuration of the CLM subgrid hierarchy. Box in upper right shows hypothetical subgrid distribution for a single grid cell. Note that the Crop land unit is only used when the model is run with the crop model active. Abbreviations: TBD – Tall Building District; HD – High Density; MD – Medium Density, G – Glacier, L – Lake, U – Urban, C – Crop, V – Vegetated, PFT – Plant Functional Type, Irr – Irrigated, UIrr – Unirrigated. Red arrows indicate allowed land unit transitions. Purple arrows indicate allowed patch-level transitions. diff --git a/doc/source/tech_note/Ecosystem/image1.png b/doc/source/tech_note/Ecosystem/image1.png new file mode 100755 index 0000000000..4745f3f419 --- /dev/null +++ b/doc/source/tech_note/Ecosystem/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e40ab5a4c6076f1f9990e727ed9823ed2b387fff8b4bc99e4f2cf647a52569d +size 254797 diff --git a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst index 8d1016380d..ca7a4a9d2c 100644 --- a/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst +++ b/doc/source/tech_note/External_Nitrogen_Cycle/CLM50_Tech_Note_External_Nitrogen_Cycle.rst @@ -118,7 +118,7 @@ Where :math:`{NF}_{nfix,sminn}` (gN m\ :sup:`-2` s\ :sup:`-1`) is the rate of fr .. _Figure Biological nitrogen fixation: -.. figure:: ../../../images/tech_note/External_Nitrogen_Cycle/image1.png +.. figure:: image1.png Free-living nitrogen fixation as a function of annual evapotranspiration. Results here show annual N inputs from free-living N fixations, but the model actually calculates inputs on a per second basis. diff --git a/doc/source/tech_note/External_Nitrogen_Cycle/image1.png b/doc/source/tech_note/External_Nitrogen_Cycle/image1.png new file mode 100755 index 0000000000..b28b5d1894 --- /dev/null +++ b/doc/source/tech_note/External_Nitrogen_Cycle/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3acfbbb90ad0c44ff7179a257c44f59d4b0b5a0da348825b02aa5034bee1640 +size 29009 diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index a0b7e04ac3..d967cd5ff0 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -961,14 +961,14 @@ height :math:`z_{0h} ^{{'} }` and the canopy air at height .. _Figure Schematic diagram of sensible heat fluxes: -.. figure:: ../../../images/tech_note/Fluxes/image1.png +.. figure:: image1.png Figure Schematic diagram of sensible heat fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. .. _Figure Schematic diagram of latent heat fluxes: -.. figure:: ../../../images/tech_note/Fluxes/image2.png +.. figure:: image2.png Figure Schematic diagram of water vapor fluxes for (a) non-vegetated surfaces and (b) vegetated surfaces. diff --git a/doc/source/tech_note/Fluxes/image1.png b/doc/source/tech_note/Fluxes/image1.png new file mode 100755 index 0000000000..b74d0a0c92 --- /dev/null +++ b/doc/source/tech_note/Fluxes/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e1c868e187fac803a6b051b0148936909d3994bc2e89de2d58bf2c96bcfaef7 +size 9847 diff --git a/doc/source/tech_note/Fluxes/image2.png b/doc/source/tech_note/Fluxes/image2.png new file mode 100755 index 0000000000..b1698d8a95 --- /dev/null +++ b/doc/source/tech_note/Fluxes/image2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c195ab48a35ca413acd9fc3509643369b1359be005770b31d511d5cee89cbeb1 +size 15100 diff --git a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst index 6e0b593d29..c4e0824ea7 100644 --- a/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst +++ b/doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst @@ -38,7 +38,7 @@ al. 2008) ` and :math:`\Delta t` is the time step (s). .. _Figure Hydrologic processes: -.. Figure:: ../../../images/tech_note/Hydrology/hydrologic.processes.png +.. Figure:: hydrologic.processes.png Hydrologic processes represented in CLM. @@ -798,7 +798,7 @@ the effective root fraction :math:`r_{e,\, i}` .. _Figure Water flux schematic: -.. Figure:: ../../../images/tech_note/Hydrology/image2.png +.. Figure:: image2.png Schematic diagram of numerical scheme used to solve for soil water fluxes. diff --git a/doc/source/tech_note/Hydrology/hydrologic.processes.png b/doc/source/tech_note/Hydrology/hydrologic.processes.png new file mode 100644 index 0000000000..4617f7394a --- /dev/null +++ b/doc/source/tech_note/Hydrology/hydrologic.processes.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:328caf5897f168486357c782c99936183a55931fcdd1727015ca1778c816b6bc +size 93244 diff --git a/doc/source/tech_note/Hydrology/image1.png b/doc/source/tech_note/Hydrology/image1.png new file mode 100755 index 0000000000..f18bfd3617 --- /dev/null +++ b/doc/source/tech_note/Hydrology/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21f039196cb89474168e1b93c55b506a7cf802205b09bbc43b40b7c8655605d4 +size 41171 diff --git a/doc/source/tech_note/Hydrology/image2.png b/doc/source/tech_note/Hydrology/image2.png new file mode 100755 index 0000000000..8f10f2f87e --- /dev/null +++ b/doc/source/tech_note/Hydrology/image2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5833196770f045373914ae7b4cbcd8bfad4f1259fc03c48969930103107e7e2 +size 9152 diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index df3201827e..7240dfa8d9 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -627,6 +627,6 @@ processes simulated include (:numref:`Figure Land processes`): .. _Figure Land processes: -.. figure:: ../../../images/tech_note/Introduction/image1.png +.. figure:: image1.png Land biogeophysical, biogeochemical, and landscape processes simulated by CLM (adapted from :ref:`Lawrence et al. (2011)` for CLM5.0). diff --git a/doc/source/tech_note/Introduction/image1.png b/doc/source/tech_note/Introduction/image1.png new file mode 100755 index 0000000000..9b2971a1b2 --- /dev/null +++ b/doc/source/tech_note/Introduction/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2ee10ffecdda7bd8994490508186da98ea538f5868ec90ef9d633ba0cc3811a +size 171166 diff --git a/doc/source/tech_note/Isotopes/image1.png b/doc/source/tech_note/Isotopes/image1.png new file mode 100755 index 0000000000..53a4e3bade --- /dev/null +++ b/doc/source/tech_note/Isotopes/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1f7d7602d156eb1ea23f50089e16c2809c02e61facf21dc3289ac76af30588b +size 8538 diff --git a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst index dbd07703ee..439de8a7a1 100644 --- a/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst +++ b/doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst @@ -47,7 +47,7 @@ and discharges the water to its downstream spatial unit or the ocean. .. _Figure MOSART conceptual diagram: -.. figure:: ../../../images/tech_note/MOSART/mosart_diagram.png +.. figure:: mosart_diagram.png :width: 800px :height: 400px diff --git a/doc/source/tech_note/MOSART/mosart_diagram.png b/doc/source/tech_note/MOSART/mosart_diagram.png new file mode 100644 index 0000000000..ac33eee692 --- /dev/null +++ b/doc/source/tech_note/MOSART/mosart_diagram.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:438d5d1165d0bce83ee713444ac3d79f81205cb7040ee230e2713b166062d78d +size 212280 diff --git a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst index 8c92a24556..7c89f857e3 100644 --- a/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst +++ b/doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst @@ -89,7 +89,7 @@ into the inundated concentration when the inundated fraction increases. .. _Figure Methane Schematic: -.. figure:: ../../../images/tech_note/Methane/image1.png +.. figure:: image1.png Schematic representation of biological and physical processes integrated in CLM that affect the net CH\ :sub:`4` diff --git a/doc/source/tech_note/Methane/image1.png b/doc/source/tech_note/Methane/image1.png new file mode 100755 index 0000000000..73fdbba723 --- /dev/null +++ b/doc/source/tech_note/Methane/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a25dc959f42d9b3b8eaa8e30867f36bf6d002282d4aa199f48818e9f7a7cc051 +size 151331 diff --git a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index c2ea4ec1bd..6c56e7b904 100644 --- a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -159,7 +159,7 @@ on leaf water potential. .. _Figure Plant hydraulic circuit: -.. figure:: ../../../images/tech_note/Plant_Hydraulics/circuit.jpg +.. figure:: circuit.jpg Circuit diagram of plant hydraulics scheme @@ -714,6 +714,6 @@ The outermost level of iteration works towards convergence of leaf temperature, .. _Figure PHS Flow Diagram: -.. figure:: ../../../images/tech_note/Plant_Hydraulics/phs_iteration_schematic.svg +.. figure:: phs_iteration_schematic.svg Flow diagram of leaf flux calculations diff --git a/doc/source/tech_note/Plant_Hydraulics/circuit.jpg b/doc/source/tech_note/Plant_Hydraulics/circuit.jpg new file mode 100644 index 0000000000..aa53b48d4b --- /dev/null +++ b/doc/source/tech_note/Plant_Hydraulics/circuit.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82acf5e36c7676057f37d760d7cfa1bf6923ec513a86f8d2190c8b8028229b39 +size 52862 diff --git a/doc/source/tech_note/Plant_Hydraulics/phs_iteration_schematic.svg b/doc/source/tech_note/Plant_Hydraulics/phs_iteration_schematic.svg new file mode 100644 index 0000000000..f88c0a1492 --- /dev/null +++ b/doc/source/tech_note/Plant_Hydraulics/phs_iteration_schematic.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c95178fd7b6fcfd8858babab319669684b8d490fbbff6f4f31a35132f7049b59 +size 276151 diff --git a/doc/source/tech_note/Plant_Respiration/image1.png b/doc/source/tech_note/Plant_Respiration/image1.png new file mode 100755 index 0000000000..cf2e4ed9cc --- /dev/null +++ b/doc/source/tech_note/Plant_Respiration/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4cb87e15bbaa818c2c8fc34cd75f247a85057a19d0ca143ce3f3270102773785 +size 7125 diff --git a/doc/source/tech_note/Plant_Respiration/image2.png b/doc/source/tech_note/Plant_Respiration/image2.png new file mode 100755 index 0000000000..cee74c0178 --- /dev/null +++ b/doc/source/tech_note/Plant_Respiration/image2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54aec7a404e377c6f87b68377c6117060f0ee4b531235fa69fa9f4cb804db396 +size 47589 diff --git a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst index a687d5bc2d..5e368456ba 100644 --- a/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst +++ b/doc/source/tech_note/Radiative_Fluxes/CLM50_Tech_Note_Radiative_Fluxes.rst @@ -37,7 +37,7 @@ depth of direct beam per unit leaf and stem area (section :numref:`Canopy Radiat .. _Figure Radiation Schematic: -.. figure:: ../../../images/tech_note/Radiative_Fluxes/image1.png +.. figure:: image1.png Schematic diagram of (a) direct beam radiation, (b) diffuse solar radiation, and (c) longwave radiation absorbed, transmitted, and diff --git a/doc/source/tech_note/Radiative_Fluxes/image1.png b/doc/source/tech_note/Radiative_Fluxes/image1.png new file mode 100755 index 0000000000..a1c66d96b9 --- /dev/null +++ b/doc/source/tech_note/Radiative_Fluxes/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c567ff0794cf34fbd41b31656d0ee02461d3cf3c140e836973280faa2d8ba6dd +size 11143 diff --git a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst index 2d58d36795..8d22a19bc9 100644 --- a/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst +++ b/doc/source/tech_note/Snow_Hydrology/CLM50_Tech_Note_Snow_Hydrology.rst @@ -18,7 +18,7 @@ snow pack. .. _Figure three layer snow pack: -.. Figure:: ../../../images/tech_note/Snow_Hydrology/image1.png +.. Figure:: image1.png Example of three layer snow pack (:math:`snl=-3`). diff --git a/doc/source/tech_note/Snow_Hydrology/image1.png b/doc/source/tech_note/Snow_Hydrology/image1.png new file mode 100755 index 0000000000..655911ecca --- /dev/null +++ b/doc/source/tech_note/Snow_Hydrology/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9283f5c65c099c866251e63916fcf1495add87bff685abe8cc191115ee6298a +size 8599 diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst index efbb382f45..56b6adff3f 100644 --- a/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst +++ b/doc/source/tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.rst @@ -223,7 +223,7 @@ interface of two layers .. _Figure Soil Temperature Schematic: -.. figure:: ../../../images/tech_note/Soil_Snow_Temperatures/image1.png +.. figure:: image1.png Schematic diagram of numerical scheme used to solve for soil temperature. diff --git a/doc/source/tech_note/Soil_Snow_Temperatures/image1.png b/doc/source/tech_note/Soil_Snow_Temperatures/image1.png new file mode 100755 index 0000000000..adfbc2bf08 --- /dev/null +++ b/doc/source/tech_note/Soil_Snow_Temperatures/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50f5744a0542e005e22057e9f9b70ba0f676eba143d8e8b25dc12284d898a9f5 +size 8725 diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index 637dd28d05..de7ef86173 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -347,18 +347,18 @@ data files in the mksurfdata_map tool. .. _Figure Schematic of land cover change: -.. figure:: ../../../images/tech_note/Transient_Landcover/image1.png +.. figure:: image1.png Schematic of land cover change impacts on CLM carbon pools and fluxes. .. _Figure Schematic of translation of annual LUH2 land units: -.. figure:: ../../../images/tech_note/Transient_Landcover/image2.png +.. figure:: image2.png Schematic of translation of annual LUH2 land units to CLM5 plant and crop functional types. .. _Figure Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool: -.. figure:: ../../../images/tech_note/Transient_Landcover/image3.png +.. figure:: image3.png Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool diff --git a/doc/source/tech_note/Transient_Landcover/image1.png b/doc/source/tech_note/Transient_Landcover/image1.png new file mode 100755 index 0000000000..bdb419ffbf --- /dev/null +++ b/doc/source/tech_note/Transient_Landcover/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69d48a8706cd8bbcc8b3157070f06e55d6955ea15826eddea261cb2c6a86dd09 +size 44693 diff --git a/doc/source/tech_note/Transient_Landcover/image2.png b/doc/source/tech_note/Transient_Landcover/image2.png new file mode 100755 index 0000000000..cb88aa7b4c --- /dev/null +++ b/doc/source/tech_note/Transient_Landcover/image2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7695d3b33bd6c1a8ea0fd1e4cac2bb1ee9f33776e6e2f9f08359dea402d461f3 +size 35882 diff --git a/doc/source/tech_note/Transient_Landcover/image3.png b/doc/source/tech_note/Transient_Landcover/image3.png new file mode 100755 index 0000000000..f06f71b6c5 --- /dev/null +++ b/doc/source/tech_note/Transient_Landcover/image3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:749cd9858eb4d55af4eb72ca900c180e8bb69aa6483ce0cfd05b40a338b24c7a +size 64824 diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index 7b74bdf4ab..e5f4ac33e5 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -128,7 +128,7 @@ interior building temperature at yearly time resolution. .. _Figure schematic representation of the urban landunit: -.. figure:: ../../../images/tech_note/Urban/image1.png +.. figure:: image1.png Schematic representation of the urban land unit. See the text for description of notation. Incident, reflected, and net solar and longwave radiation are calculated for each individual surface but are not shown for clarity. @@ -136,7 +136,7 @@ interior building temperature at yearly time resolution. .. _Figure schematic of urban and atmospheric model coupling: -.. Figure:: ../../../images/tech_note/Urban/image2.png +.. Figure:: image2.png Schematic of urban and atmospheric model coupling. The urban model is forced by the atmospheric model wind (:math:`u_{atm}` ), temperature (:math:`T_{atm}` ), specific humidity (:math:`q_{atm}` ), precipitation (:math:`P_{atm}` ), solar (:math:`S_{atm} \, \downarrow` ) and longwave (:math:`L_{atm} \, \downarrow` ) radiation at reference height :math:`z'_{atm}` (section :numref:`Atmospheric Coupling`). Fluxes from the urban landunit to the atmosphere are turbulent sensible (:math:`H`) and latent heat (:math:`\lambda E`), momentum (:math:`\tau` ), albedo (:math:`I\uparrow` ), emitted longwave (:math:`L\uparrow` ), and absorbed shortwave (:math:`\vec{S}`) radiation. Air temperature (:math:`T_{ac}` ), specific humidity (:math:`q_{ac}` ), and wind speed (:math:`u_{c}` ) within the urban canopy layer are diagnosed by the urban model. :math:`H` is the average building height. @@ -144,7 +144,7 @@ interior building temperature at yearly time resolution. .. _Figure schematic of THESIS urban properties tool: -.. Figure:: ../../../images/tech_note/Urban/image3.png +.. Figure:: image3.png Schematic of THESIS urban properties tool. Executable scripts are in orange, input files are blue, and output files are green. Items within the black box outline are either read in as input, executed, or output by the driver script (urban_prop.csh). diff --git a/doc/source/tech_note/Urban/image1.png b/doc/source/tech_note/Urban/image1.png new file mode 100755 index 0000000000..64feb80128 --- /dev/null +++ b/doc/source/tech_note/Urban/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ff37606b73060c4cfb71b1b4f2a86f8cf2f043f3bbe0996bffece953e598aed +size 18462 diff --git a/doc/source/tech_note/Urban/image2.png b/doc/source/tech_note/Urban/image2.png new file mode 100755 index 0000000000..c8e4ecafc2 --- /dev/null +++ b/doc/source/tech_note/Urban/image2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75441a9fd1b237b7c9d20ed24f5a0605e964174d1061e1304ab03edaf86b9060 +size 17235 diff --git a/doc/source/tech_note/Urban/image3.png b/doc/source/tech_note/Urban/image3.png new file mode 100644 index 0000000000..2f73f14961 --- /dev/null +++ b/doc/source/tech_note/Urban/image3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99da4f166c41855656434081e91da268266108d43a96e0f0e53d888df7fa71c1 +size 243653 diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index ffa2a5c96d..7ede3405e0 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -33,7 +33,7 @@ storage over the course of a single growing season. .. _Figure annual phenology cycle: -.. figure:: ../../../images/tech_note/Vegetation_Phenology_Turnover/image1.png +.. figure:: image1.png Example of annual phenology cycle for seasonal deciduous. diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/image1.png b/doc/source/tech_note/Vegetation_Phenology_Turnover/image1.png new file mode 100755 index 0000000000..c10923a819 --- /dev/null +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b2b957eea477e79313ec8d3731e28a4c04a7f4204a8fbc89a53bcc37b494565 +size 9363 diff --git a/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst b/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst index a93610f9fa..d6b6c74d91 100644 --- a/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst +++ b/doc/source/users_guide/running-special-cases/Spinning-up-the-Satellite-Phenology-Model-CLMSP-spinup.rst @@ -19,7 +19,7 @@ a specified equilibrium state (denoted by the dotted lines) due to the different .. _Figure SP spinup plot for 1850: -.. figure:: ../../../images/users_guide/running-special-cases/image1.png +.. figure:: image1.png SP spinup plot for year 1850. Variables examined are FSH (sensible heat flux), EFLX_LH_TOT (latent heat flux), GPP (photosynthesis), TWS (total water storage), H2OSOI (volumetric soil water in layer 8) and TSOI (soil temperature in layer 10). Generated using .../tools/contrib/SpinupStability_SP.ncl. @@ -28,6 +28,6 @@ Again, it takes about 10 years to reach equilibrium. .. _Figure SP spinup plot for 2000 CO2: -.. figure:: ../../../images/users_guide/running-special-cases/image2.png +.. figure:: image2.png SP spinup plot for year 2000 CO2. Variables examined are FSH (sensible heat flux), EFLX_LH_TOT (latent heat flux), GPP (photosynthesis), TWS (total water storage), H2OSOI (volumetric soil water in layer 8) and TSOI (soil temperature in layer 10). Generated using .../tools/contrib/SpinupStability_SP.ncl. diff --git a/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst b/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst index 3ad4bdb5a5..9808ceb05b 100644 --- a/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst +++ b/doc/source/users_guide/running-special-cases/Spinning-up-the-biogeochemistry-BGC-spinup.rst @@ -12,7 +12,7 @@ total ecosystem carbon disequilibrium takes the longest to satisfy due to slow s .. _Figure BGC AD spinup plot for 1850 GSWP3: -.. figure:: ../../../images/users_guide/running-special-cases/image3.png +.. figure:: image3.png BGC AD spinup plot for a year 1850 case with GSWP3 atmospheric forcing. Variables examined are TOTECOSYSC (total ecosystem carbon), TOTSOMC (total soil organic matter carbon), TOTVEGC (total vegetation carbon), TLAI (total leaf area index), GPP (gross primary production) and TWS (total water storage). Generated using .../tools/contrib/SpinupStability.ncl. @@ -24,7 +24,7 @@ criteria depending on their application. .. _Figure BGC pAD spinup plot for 1850 GSWP3: -.. figure:: ../../../images/users_guide/running-special-cases/image4.png +.. figure:: image4.png BGC pAD spinup plot for a year 1850 case with GSWP3 atmospheric forcing and initialization from the end of the BGC AD spinup case. Variables examined are TOTECOSYSC (total ecosystem carbon), TOTSOMC (total soil organic matter carbon), TOTVEGC (total vegetation carbon), TLAI (total leaf area index), GPP (gross primary production) and TWS (total water storage). Generated using .../tools/contrib/SpinupStability.ncl. @@ -35,7 +35,7 @@ such as TLAI (total leaf area index), GPP (gross primary production), and TWS (t .. _Figure BGC initialized spinup plot for 1850: -.. figure:: ../../../images/users_guide/running-special-cases/image5.png +.. figure:: image5.png BGC initialized spinup plot for year 1850. Variables examined are TOTECOSYSC (total ecosystem carbon), TOTSOMC (total soil organic matter carbon), TOTVEGC (total vegetation carbon), TLAI (total leaf area index), GPP (gross primary production) and TWS (total water storage). Generated using .../tools/contrib/SpinupStability.ncl. @@ -44,7 +44,7 @@ Again, it takes about 10 years to reach equilibrium for TLAI, GPP, and TWS. .. _Figure BGC initialized spinup plot for 2000 CO2: -.. figure:: ../../../images/users_guide/running-special-cases/image6.png +.. figure:: image6.png BGC initialized spinup plot for year 2000 CO2. Variables examined are TOTECOSYSC (total ecosystem carbon), TOTSOMC (total soil organic matter carbon), TOTVEGC (total vegetation carbon), TLAI (total leaf area index), GPP (gross primary production) and TWS (total water storage). Generated using .../tools/contrib/SpinupStability.ncl. diff --git a/doc/source/users_guide/running-special-cases/image1.png b/doc/source/users_guide/running-special-cases/image1.png new file mode 100644 index 0000000000..fba40ddfa1 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/image1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d17c1ff7945bfa5d86958f8cc90b96fbd58bbeb81003aaf2cdcc2e6104788da +size 318875 diff --git a/doc/source/users_guide/running-special-cases/image2.png b/doc/source/users_guide/running-special-cases/image2.png new file mode 100644 index 0000000000..79cc812929 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/image2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf3d0b888e7c442838f1fa4290987b29c4a54f82a49aac7d5070db5e3e5abfe1 +size 320601 diff --git a/doc/source/users_guide/running-special-cases/image3.png b/doc/source/users_guide/running-special-cases/image3.png new file mode 100644 index 0000000000..0c11688829 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/image3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:347a4e32e072c6b5d9f87ae7fd36ee3621c8436910691b18f63d9365f853d8de +size 280086 diff --git a/doc/source/users_guide/running-special-cases/image4.png b/doc/source/users_guide/running-special-cases/image4.png new file mode 100644 index 0000000000..09456b93af --- /dev/null +++ b/doc/source/users_guide/running-special-cases/image4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4587fe62aa8c34906e56d13c99749b69d2600f4c770c50781d81faf2480b8842 +size 287344 diff --git a/doc/source/users_guide/running-special-cases/image5.png b/doc/source/users_guide/running-special-cases/image5.png new file mode 100644 index 0000000000..f0d073565f --- /dev/null +++ b/doc/source/users_guide/running-special-cases/image5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:991c6fa7d321f0a0e50f38c82f951eb978ba3ae62efe184bc941fcacaf4352c5 +size 316593 diff --git a/doc/source/users_guide/running-special-cases/image6.png b/doc/source/users_guide/running-special-cases/image6.png new file mode 100644 index 0000000000..949acde48d --- /dev/null +++ b/doc/source/users_guide/running-special-cases/image6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65a5121d47597ae3d508a8bda8989708c928e3f0b9e183009dfc4bcd661ad4b6 +size 311278 diff --git a/doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg b/doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg new file mode 100644 index 0000000000..7e2df5ad90 --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9000cdb3c7761a9838e9af059f36dfcc204c7a02bdab6d5206da0de1bf3051ac +size 38541 diff --git a/doc/source/users_guide/using-clm-tools/LegendCLMToolDataFlow.jpeg b/doc/source/users_guide/using-clm-tools/LegendCLMToolDataFlow.jpeg new file mode 100644 index 0000000000..e0f1559cbd --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/LegendCLMToolDataFlow.jpeg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d71ecdf638e4582f66f1c2b101b6548bd9d47fe2cb3de0f58386048f6ce6cfbc +size 15711 diff --git a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst index 2feef0b554..972967da0c 100644 --- a/doc/source/users_guide/using-clm-tools/creating-domain-files.rst +++ b/doc/source/users_guide/using-clm-tools/creating-domain-files.rst @@ -16,7 +16,7 @@ Global Domain file creation .. _Figure Global-Domain: -.. figure:: ../../../images/users_guide/using-clm-tools/GlobalDomain.jpeg +.. figure:: GlobalDomain.jpeg Global Domain file creation @@ -29,7 +29,7 @@ Domain file creation using mknoocnmap.pl .. _Figure mknoocnmap.pl: -.. figure:: ../../../images/users_guide/using-clm-tools/mknoocnmap.jpeg +.. figure:: mknoocnmap.jpeg Domain file creation using mknoocnmap.pl diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index 229d077514..6048baa98c 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -107,7 +107,7 @@ mkmapdata.sh has a help option with the following .. _Figure mkmapdata.sh: -.. figure:: ../../../images/users_guide/using-clm-tools/mkmapdata_details.jpeg +.. figure:: mkmapdata_details.jpeg Details of running mkmapdata.sh diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index ebd200b8f5..c974b9c886 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -10,7 +10,7 @@ When just creating a replacement file for an existing one, the relevant tool sho .. _Figure Data_Flow: -.. figure:: ../../../images/users_guide/using-clm-tools/mkmapdata_mksurfdata.jpeg +.. figure:: mkmapdata_mksurfdata.jpeg Data Flow for Creation of Surface Datasets from Raw SCRIP Grid Files @@ -20,7 +20,7 @@ Starting from a SCRIP grid file that describes the grid you will run the model o .. _Figure Data_Flow_Legend: -.. figure:: ../../../images/users_guide/using-clm-tools/LegendCLMToolDataFlow.jpeg +.. figure:: LegendCLMToolDataFlow.jpeg Legend for Data Flow Figures diff --git a/doc/source/users_guide/using-clm-tools/mkmapdata_details.jpeg b/doc/source/users_guide/using-clm-tools/mkmapdata_details.jpeg new file mode 100644 index 0000000000..b8d33578b8 --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/mkmapdata_details.jpeg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56399b80b49aa4705b27a0e98758b120f78c4eb62d993f85944db2c1d2122d0f +size 51018 diff --git a/doc/source/users_guide/using-clm-tools/mkmapdata_mksurfdata.jpeg b/doc/source/users_guide/using-clm-tools/mkmapdata_mksurfdata.jpeg new file mode 100644 index 0000000000..7e59cee7f3 --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/mkmapdata_mksurfdata.jpeg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d85feb3d5c6aba70963f51b10406cd45ff334c60f2daf965ccb9b1abbc158985 +size 41951 diff --git a/doc/source/users_guide/using-clm-tools/mknoocnmap.jpeg b/doc/source/users_guide/using-clm-tools/mknoocnmap.jpeg new file mode 100644 index 0000000000..308fde0e1c --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/mknoocnmap.jpeg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c4d6c677d6e68761f9c6677be4bc94d93cd75c26989c834cd3e022db432359d +size 33914 diff --git a/doc/source/users_guide/using-clm-tools/mksurfdata_details.jpeg b/doc/source/users_guide/using-clm-tools/mksurfdata_details.jpeg new file mode 100644 index 0000000000..9d6e829891 --- /dev/null +++ b/doc/source/users_guide/using-clm-tools/mksurfdata_details.jpeg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32104479195bd2612b09df1322b97c5b2db220d8d0115e32e6020e17ade597e0 +size 41837 From 50e7e62f2bf58245baee54c4b53b83feca9566c5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 27 Mar 2020 11:20:32 -0600 Subject: [PATCH 0725/1973] Before building html or pdf, automatically obtain all of the images This is needed because we have configured this repository (via an .lfsconfig file at the top level) to NOT automatically fetch any of the large files when cloning / fetching. --- doc/Makefile | 11 ++++++++++- doc/Makefile.tech_note | 11 ++++++++++- doc/Makefile.users_guide | 11 ++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 6e8d96d485..65aa7572bf 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -12,7 +12,16 @@ BUILDDIR = build help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile +# Before building html or pdf, obtain all of the images. This is needed +# because we have configured this repository (via an .lfsconfig file at +# the top level) to NOT automatically fetch any of the large files when +# cloning / fetching. +html: fetch-images +latexpdf: fetch-images +fetch-images: + git lfs pull --exclude="" + +.PHONY: help fetch-images Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). diff --git a/doc/Makefile.tech_note b/doc/Makefile.tech_note index 3ba843c70e..e19b31e182 100644 --- a/doc/Makefile.tech_note +++ b/doc/Makefile.tech_note @@ -12,7 +12,16 @@ BUILDDIR = build/tech_note help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile +# Before building html or pdf, obtain all of the images. This is needed +# because we have configured this repository (via an .lfsconfig file at +# the top level) to NOT automatically fetch any of the large files when +# cloning / fetching. +html: fetch-images +latexpdf: fetch-images +fetch-images: + git lfs pull --exclude="" + +.PHONY: help fetch-images Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). diff --git a/doc/Makefile.users_guide b/doc/Makefile.users_guide index babfffa52c..2fa8bb453f 100644 --- a/doc/Makefile.users_guide +++ b/doc/Makefile.users_guide @@ -12,7 +12,16 @@ BUILDDIR = build/users_guide help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile +# Before building html or pdf, obtain all of the images. This is needed +# because we have configured this repository (via an .lfsconfig file at +# the top level) to NOT automatically fetch any of the large files when +# cloning / fetching. +html: fetch-images +latexpdf: fetch-images +fetch-images: + git lfs pull --exclude="" + +.PHONY: help fetch-images Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). From 89602f80ec9e4bf1e9f304b23d3e2b1fa40ba855 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 27 Mar 2020 11:53:58 -0600 Subject: [PATCH 0726/1973] Use git lfs to track pdf files I'm going to add a pdf image file, so this is needed for that purpose. --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 4ef52ab007..e9f0bd7694 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ *.jpg filter=lfs diff=lfs merge=lfs -text *.jpeg filter=lfs diff=lfs merge=lfs -text *.gif filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text From ade8e8963ba540447e73f3d14987b4fcb133c3b9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 27 Mar 2020 12:02:45 -0600 Subject: [PATCH 0727/1973] Add a pdf version of phs_iteration_schematic This is needed for the pdf build: latexpdf cannot read svg files. I converted this using Inkscape (simply using "save as" and saving it as a pdf). --- .../CLM50_Tech_Note_Plant_Hydraulics.rst | 2 +- .../README.phs_iteration_schematic | 9 +++++++++ .../Plant_Hydraulics/phs_iteration_schematic.pdf | Bin 0 -> 131 bytes 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 doc/source/tech_note/Plant_Hydraulics/README.phs_iteration_schematic create mode 100644 doc/source/tech_note/Plant_Hydraulics/phs_iteration_schematic.pdf diff --git a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index 6c56e7b904..88d09d18a5 100644 --- a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -714,6 +714,6 @@ The outermost level of iteration works towards convergence of leaf temperature, .. _Figure PHS Flow Diagram: -.. figure:: phs_iteration_schematic.svg +.. figure:: phs_iteration_schematic.* Flow diagram of leaf flux calculations diff --git a/doc/source/tech_note/Plant_Hydraulics/README.phs_iteration_schematic b/doc/source/tech_note/Plant_Hydraulics/README.phs_iteration_schematic new file mode 100644 index 0000000000..c04c25d117 --- /dev/null +++ b/doc/source/tech_note/Plant_Hydraulics/README.phs_iteration_schematic @@ -0,0 +1,9 @@ +Daniel Kennedy provided the original file, +phs_iteration_schematic.svg. This can be used to generate the html +documentation. Bill Sacks then converted it to pdf using Inkscape +(simply using "save as" and saving it as a pdf); the pdf is needed when +generating a pdf (since latexpdf cannot use svg files). + +Note that the figure is referenced in the rst as +phs_iteration_schematic.*; each builder then uses the appropriate file +(svg or pdf as needed). diff --git a/doc/source/tech_note/Plant_Hydraulics/phs_iteration_schematic.pdf b/doc/source/tech_note/Plant_Hydraulics/phs_iteration_schematic.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8505f8df531f6ceadc5df6ebf70c1f4c09f14793 GIT binary patch literal 131 zcmWN_OAf*y5CG6Ur{DsX?*R5T!#D_uO5?O$czU~f$vgQgV}5ks_f1w~o@2kgnk<+7 zs0+=vk&VfmPR;Sq($Pa&3t$0nLuRUgKG>S>luL6^m?$#?x|A`LgehhhTcY41QlSXV NT2eB8tX;6zsy_j+Ctd&m literal 0 HcmV?d00001 From eda91cc6e8af42a776e3f2c6c2240478ba80db6e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 27 Mar 2020 13:20:12 -0600 Subject: [PATCH 0728/1973] Bring in fix for #921 --- src/utils/clmfates_paraminterfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_paraminterfaceMod.F90 b/src/utils/clmfates_paraminterfaceMod.F90 index 95fef7640c..474ba12394 100644 --- a/src/utils/clmfates_paraminterfaceMod.F90 +++ b/src/utils/clmfates_paraminterfaceMod.F90 @@ -2,6 +2,7 @@ module CLMFatesParamInterfaceMod ! NOTE(bja, 2017-01) this code can not go into the main clm-fates ! interface module because of circular dependancies with pftvarcon. + use shr_kind_mod, only : r8 => shr_kind_r8 use FatesGlobals, only : fates_log implicit none @@ -172,7 +173,6 @@ end subroutine GetUsedDimensionSizes !----------------------------------------------------------------------- subroutine ParametersFromNetCDF(filename, is_host_file, fates_params) - use shr_kind_mod , only : r8 => shr_kind_r8 use abortutils , only : endrun use fileutils , only : getfil use ncdio_pio , only : file_desc_t , ncd_pio_closefile , ncd_pio_openfile From fb4e647ea8b95bec413669fdb99bb917c839b8ff Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 28 Mar 2020 14:39:38 -0600 Subject: [PATCH 0729/1973] Remove near-duplicated Makefiles and conf.py files Previously, we had been (sort of) supporting builds of just the User's Guide or just the Tech Note via near-duplicated copies of the Makefile and conf.py file. However, these didn't really seem to work right for an html build (the files ended up in the wrong directory structure), and this was going to be harder to support and maintain moving forward, because of the duplication. Erik Kluzek and Keith Oleson have confirmed that they don't actually need support for an html build of just part of the documentation. I have made changes to the main Makefile to support just building a pdf of the tech note (not including the User's Guide), which IS needed. --- doc/Makefile | 13 +++ doc/Makefile.tech_note | 29 ------ doc/Makefile.users_guide | 29 ------ doc/source/tech_note/conf.py | 171 -------------------------------- doc/source/users_guide/conf.py | 174 --------------------------------- 5 files changed, 13 insertions(+), 403 deletions(-) delete mode 100644 doc/Makefile.tech_note delete mode 100644 doc/Makefile.users_guide delete mode 100644 doc/source/tech_note/conf.py delete mode 100644 doc/source/users_guide/conf.py diff --git a/doc/Makefile b/doc/Makefile index 65aa7572bf..47304542de 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -23,6 +23,19 @@ fetch-images: .PHONY: help fetch-images Makefile +# For the pdf, we only build the tech note, but use the conf.py file in +# the top-level source directory (the -c option says where to find +# conf.py). Note that we also override the setting of +# numfig_secnum_depth in order to have figure numbering as desired in +# the pdf, given that the pdf just contains the tech note, so doesn't +# have the top-level numbering present in the web documentation (where +# top-level section 1 is the User's Guide and section 2 is the Tech +# Note). +# +# The use of $(0) is as in the catch-all target. +latexpdf: + $(SPHINXBUILD) -M $@ "$(SOURCEDIR)/tech_note" "$(BUILDDIR)" -c "$(SOURCEDIR)" -D numfig_secnum_depth=1 $(SPHINXOPTS) $(O) + # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile diff --git a/doc/Makefile.tech_note b/doc/Makefile.tech_note deleted file mode 100644 index e19b31e182..0000000000 --- a/doc/Makefile.tech_note +++ /dev/null @@ -1,29 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -SPHINXPROJ = clmdoc -SOURCEDIR = source/tech_note -BUILDDIR = build/tech_note - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -# Before building html or pdf, obtain all of the images. This is needed -# because we have configured this repository (via an .lfsconfig file at -# the top level) to NOT automatically fetch any of the large files when -# cloning / fetching. -html: fetch-images -latexpdf: fetch-images -fetch-images: - git lfs pull --exclude="" - -.PHONY: help fetch-images Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile.tech_note - $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/Makefile.users_guide b/doc/Makefile.users_guide deleted file mode 100644 index 2fa8bb453f..0000000000 --- a/doc/Makefile.users_guide +++ /dev/null @@ -1,29 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -SPHINXPROJ = clmdoc -SOURCEDIR = source/users_guide -BUILDDIR = build/users_guide - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -# Before building html or pdf, obtain all of the images. This is needed -# because we have configured this repository (via an .lfsconfig file at -# the top level) to NOT automatically fetch any of the large files when -# cloning / fetching. -html: fetch-images -latexpdf: fetch-images -fetch-images: - git lfs pull --exclude="" - -.PHONY: help fetch-images Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile.users_guide - $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/source/tech_note/conf.py b/doc/source/tech_note/conf.py deleted file mode 100644 index 5c5b1d86ad..0000000000 --- a/doc/source/tech_note/conf.py +++ /dev/null @@ -1,171 +0,0 @@ -# -*- coding: utf-8 -*- -# -# clmdoc documentation build configuration file, created by -# sphinx-quickstart on Thu Feb 23 17:14:30 2017. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['sphinx.ext.intersphinx', - 'sphinx.ext.autodoc', - 'sphinx.ext.todo', - 'sphinx.ext.coverage', - 'sphinx.ext.imgmath', - 'sphinx.ext.githubpages'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'clmdoc' -copyright = u'2017, Erik Kluzek, Bill Sacks, Ben Andre' -author = u'Erik Kluzek, Bill Sacks, Ben Andre' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = u'' -# The full version, including alpha/beta/rc tags. -release = u'' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - -imgmath_image_format = 'svg' - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'bizstyle' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - - -# -- Options for HTMLHelp output ------------------------------------------ - -# Output file base name for HTML help builder. -htmlhelp_basename = 'clmdocdoc' - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - 'preamble': '\\usepackage{hyperref}', - - 'fncychap': '\\usepackage[Conny]{fncychap}', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [(master_doc, 'clmdoc.tex', u'CLM5 Documentation', '', 'manual'),] - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'clmdoc', u'clmdoc Documentation', - [author], 1) -] - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'clmdoc', u'clmdoc Documentation', - author, 'clmdoc', 'One line description of project.', - 'Miscellaneous'), -] - - - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} - -numfig = True -numfig_format = {'figure': 'Figure %s', - 'table': 'Table %s', - 'code-block': 'Code %s', - 'section': '%s', - } diff --git a/doc/source/users_guide/conf.py b/doc/source/users_guide/conf.py deleted file mode 100644 index ab8a299b9f..0000000000 --- a/doc/source/users_guide/conf.py +++ /dev/null @@ -1,174 +0,0 @@ -# -*- coding: utf-8 -*- -# -# clmdoc documentation build configuration file, created by -# sphinx-quickstart on Thu Feb 23 17:14:30 2017. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['sphinx.ext.intersphinx', - 'sphinx.ext.autodoc', - 'sphinx.ext.todo', - 'sphinx.ext.coverage', - 'sphinx.ext.imgmath', - 'sphinx.ext.githubpages'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'clmdoc' -copyright = u'2018, Erik Kluzek, Bill Sacks, Ben Andre, Alice Bertini' -author = u'Erik Kluzek, Bill Sacks, Ben Andre, Alice Bertini' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = u'clm5.0' -# The full version, including alpha/beta/rc tags. -release = u'release-clm5.0.01' - -# The format to print out today in -today_fmt = u'%Y-%m-%D %H:%M' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - -imgmath_image_format = 'svg' - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'bizstyle' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - - -# -- Options for HTMLHelp output ------------------------------------------ - -# Output file base name for HTML help builder. -htmlhelp_basename = 'clmdocdoc' - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - 'preamble': '\\usepackage{hyperref}', - - 'fncychap': '\\usepackage[Conny]{fncychap}', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [(master_doc, 'clmdoc.tex', u'CLM5 Documentation', '', 'manual'),] - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'clmdoc', u'clmdoc Documentation', - [author], 1) -] - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'clmdoc', u'clmdoc Documentation', - author, 'clmdoc', 'One line description of project.', - 'Miscellaneous'), -] - - - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} - -numfig = True -numfig_format = {'figure': 'Figure %s', - 'table': 'Table %s', - 'code-block': 'Code %s', - 'section': '%s', - } From 885a37e38fb83e9dd10b96bdbb7835d0fb88e222 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 28 Mar 2020 14:44:36 -0600 Subject: [PATCH 0730/1973] Change copyright, version, and other metadata --- doc/source/conf.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 30259e17b3..32b583fbba 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -50,18 +50,18 @@ master_doc = 'index' # General information about the project. -project = u'clmdoc' -copyright = u'2018, Erik Kluzek, Bill Sacks, Ben Andre' -author = u'Erik Kluzek, Bill Sacks, Ben Andre' +project = u'ctsm' +copyright = u'2020, UCAR' +author = u'' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'clm5.0' +version = u'master' # The full version, including alpha/beta/rc tags. -release = u'release-clm5.0.01' +release = u'master' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From d1ea77c6cb1b70fbaa6504bceef9e97fa0ec7581 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 28 Mar 2020 15:55:23 -0600 Subject: [PATCH 0731/1973] Change html build to make versioned documentation with a dropdown menu This changes the documentation theme to use the readthedocs theme, with some JavaScript that provides capabilities for a dropdown menu allowing you to select between different versions. This mimics the changes in https://github.com/ESMCI/cime/pull/3439, which in turn was based on ESCOMP/CISM-wrapper#23. --- doc/source/_static/pop_ver.js | 37 +++++++++++++++++++++++++++++++ doc/source/_templates/footer.html | 5 +++++ doc/source/_templates/layout.html | 3 +++ doc/source/conf.py | 18 +++++++++++---- 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 doc/source/_static/pop_ver.js create mode 100644 doc/source/_templates/footer.html create mode 100644 doc/source/_templates/layout.html diff --git a/doc/source/_static/pop_ver.js b/doc/source/_static/pop_ver.js new file mode 100644 index 0000000000..b8c58658a8 --- /dev/null +++ b/doc/source/_static/pop_ver.js @@ -0,0 +1,37 @@ +$(document).ready(function() { + /* For a URL that looks like + https://blah.github.io/versions/VERSIONFOO/html/bar/index.html, set cur_version_dir to + 'VERSIONFOO' (i.e., the portion of the path following 'versions'). + */ + var proj_end = document.baseURI.indexOf("versions") + 9; + var end = document.baseURI.indexOf("/", proj_end); + var cur_version_dir = document.baseURI.substring(proj_end, end); + var mylist = $("#version-list"); + mylist.empty(); + $.getJSON(version_json_loc, function(data) { + if (data.hasOwnProperty(cur_version_dir)) { + /* First add the current version so that it appears first in the drop-down + menu and starts as the selected element of the menu. If you click on the + current version, you should stay at the current page. + + The conditional around this block should generally be true, but we check it + just in case the current version is missing from the versions.json file for + some reason. + */ + cur_version_name = data[cur_version_dir]; + mylist.append($("
    lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne120np4.pg3_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190816.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne0CONUSne30x8_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190815.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c191023.nc + lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c191209.nc +lnd/clm2/surfdata_map/landuse_timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc @@ -840,6 +903,16 @@ lnd/clm2/surfdata_map/surfdata_C24_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nclnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne120np4.pg3_hist_78pfts_CMIP6_simyr1850-2015_c190816.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne0CONUSne30x8_hist_78pfts_CMIP6_simyr1850-2015_c190815.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850-2015_c191023.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c191212.nc + + lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 15c3b25138..2fe44866b9 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1849,7 +1849,7 @@ CLM run type. +"512x1024,360x720cru,128x256,64x128,48x96,32x64,8x16,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4.pg2,ne30pg3,ne30np4,ne60np4,ne120np4,ne120np4.pg2,ne120np4.pg3,ne0np4CONUS.ne30x8,ne0np4.ARCTIC.ne30x4,ne0np4.ARCTICGRIS.ne30x8,ne240np4,1km-merge-10min,C24,C48,C96,C192,C384"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools @@ -1871,7 +1871,7 @@ hist means do NOT use a future scenario, just use historical data. + valid_values="USGS,gx3v7,gx1v6,gx1v7,navy,test,tx0.1v2,tx0.1v3,tx1v1,T62,cruncep,nldas2"> Land mask description From 1d748690c91bc254cc550387600b94c5ca5ee90f Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 10 Apr 2020 14:24:07 -0600 Subject: [PATCH 0775/1973] updates for Eric PR request plus latest se grid updates --- bld/namelist_files/namelist_defaults_ctsm.xml | 44 +++---- cime_config/config_pes.xml | 111 ++++++++++++++++++ 2 files changed, 127 insertions(+), 28 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index c459385c65..ab7912d3a5 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -669,15 +669,15 @@ lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr2000_c171214.n -lnd/clm2/surfdata_map/surfdata_C384_78pfts_CMIP6_simyr2000_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C384_hist_78pfts_CMIP6_simyr2000_c200317.nc -lnd/clm2/surfdata_map/surfdata_C192_78pfts_CMIP6_simyr2000_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C192_hist_78pfts_CMIP6_simyr2000_c200317.nc -lnd/clm2/surfdata_map/surfdata_C96_78pfts_CMIP6_simyr2000_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr2000_c200317.nc -lnd/clm2/surfdata_map/surfdata_C48_78pfts_CMIP6_simyr2000_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C48_hist_78pfts_CMIP6_simyr2000_c200317.nc -lnd/clm2/surfdata_map/surfdata_C24_78pfts_CMIP6_simyr2000_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C24_hist_78pfts_CMIP6_simyr2000_c200317.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc @@ -772,15 +772,15 @@ lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc -lnd/clm2/surfdata_map/surfdata_C384_hist_78pfts_CMIP6_simyr1850_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C384_hist_78pfts_CMIP6_simyr1850_c200317.nc -lnd/clm2/surfdata_map/surfdata_C192_hist_78pfts_CMIP6_simyr1850_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C192_hist_78pfts_CMIP6_simyr1850_c200317.nc -lnd/clm2/surfdata_map/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c200317.nc -lnd/clm2/surfdata_map/surfdata_C48_hist_78pfts_CMIP6_simyr1850_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C48_hist_78pfts_CMIP6_simyr1850_c200317.nc -lnd/clm2/surfdata_map/surfdata_C24_hist_78pfts_CMIP6_simyr1850_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C24_hist_78pfts_CMIP6_simyr1850_c200317.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc @@ -890,16 +890,10 @@ lnd/clm2/surfdata_map/surfdata_C24_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nclnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C384_hist_78pfts_CMIP6_simyr1850-2015_c200317.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C192_hist_78pfts_CMIP6_simyr1850-2015_c200317.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_hist_78pfts_CMIP6_simyr1850-2015_c200317.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C48_hist_78pfts_CMIP6_simyr1850-2015_c200317.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_hist_78pfts_CMIP6_simyr1850-2015_c200317.nc + use_crop=".true." >lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc @@ -1011,19 +1005,13 @@ lnd/clm2/surfdata_map/surfdata_C24_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nclnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C48_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C192_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C384_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index 9467994e62..db9410ad12 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -483,6 +483,117 @@ + + + + none + + 1152 + 864 + 864 + 288 + 256 + 1152 + 32 + 1152 + + + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + + + 0 + 0 + 0 + 864 + 1152 + 0 + 1408 + 0 + + + + + + + + none + + 1152 + 864 + 864 + 288 + 256 + 1152 + 32 + 1152 + + + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + + + 0 + 0 + 0 + 864 + 1152 + 0 + 1408 + 0 + + + + + + + + none + + 3456 + 3456 + 3456 + 3456 + 3456 + 3456 + 3456 + 3456 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + From f5de7e42e92cb134b09b4a2edeceb6d43d3c8db8 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 10 Apr 2020 14:39:42 -0600 Subject: [PATCH 0776/1973] This should be LND not inst_name --- src/biogeochem/CNFireBaseMod.F90 | 6 +-- src/biogeochem/SatellitePhenologyMod.F90 | 59 +++++++++++----------- src/biogeochem/ch4FInundatedStreamType.F90 | 32 ++++++------ src/biogeophys/UrbanTimeVarType.F90 | 15 +++--- src/main/ncdio_pio.F90.in | 7 ++- src/main/ndepStreamMod.F90 | 3 +- 6 files changed, 57 insertions(+), 65 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 56acf2a57d..b45004fa59 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -963,7 +963,6 @@ subroutine hdm_init( this, bounds, NLFilename ) ! Initialize data stream information for population density. ! ! !USES: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -1039,7 +1038,7 @@ subroutine hdm_init( this, bounds, NLFilename ) endif call shr_strdata_create(this%sdat_hdm,name="clmhdm", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -1118,7 +1117,6 @@ subroutine lnfm_init( this, bounds, NLFilename ) ! Initialize data stream information for Lightning. ! ! !USES: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -1194,7 +1192,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) endif call shr_strdata_create(this%sdat_lnfm,name="clmlnfm", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 9b287a85b2..5d20d03d4f 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -2,8 +2,8 @@ module SatellitePhenologyMod !----------------------------------------------------------------------- ! !DESCRIPTION: - ! CLM Satelitte Phenology model (SP) ecosystem dynamics (phenology, vegetation). - ! Allow some subroutines to be used by the CLM Carbon Nitrogen model (CLMCN) + ! CLM Satelitte Phenology model (SP) ecosystem dynamics (phenology, vegetation). + ! Allow some subroutines to be used by the CLM Carbon Nitrogen model (CLMCN) ! so that DryDeposition code can get estimates of LAI differences between months. ! ! !USES: @@ -22,14 +22,14 @@ module SatellitePhenologyMod use decompMod , only : gsmap_lnd_gdc2glo use domainMod , only : ldomain use fileutils , only : getavu, relavu - use PatchType , only : patch + use PatchType , only : patch use CanopyStateType , only : canopystate_type use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use perf_mod , only : t_startf, t_stopf use spmdMod , only : masterproc use spmdMod , only : mpicom, comp_id use mct_mod - use ncdio_pio + use ncdio_pio ! ! !PUBLIC TYPES: implicit none @@ -62,7 +62,7 @@ module SatellitePhenologyMod !----------------------------------------------------------------------- contains - + !----------------------------------------------------------------------- ! ! lai_init @@ -74,7 +74,6 @@ subroutine lai_init(bounds) ! ! ! !USES: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -92,10 +91,10 @@ subroutine lai_init(bounds) integer :: i ! index integer :: stream_year_first_lai ! first year in Lai stream to use integer :: stream_year_last_lai ! last year in Lai stream to use - integer :: model_year_align_lai ! align stream_year_first_lai with + integer :: model_year_align_lai ! align stream_year_first_lai with integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_lai ! lai stream filename to read character(len=CL) :: lai_mapalgo = 'bilinear' ! Mapping alogrithm @@ -147,9 +146,9 @@ subroutine lai_init(bounds) write(iulog,*) ' ' write(iulog,*) 'lai_stream settings:' - write(iulog,*) ' stream_year_first_lai = ',stream_year_first_lai - write(iulog,*) ' stream_year_last_lai = ',stream_year_last_lai - write(iulog,*) ' model_year_align_lai = ',model_year_align_lai + write(iulog,*) ' stream_year_first_lai = ',stream_year_first_lai + write(iulog,*) ' stream_year_last_lai = ',stream_year_last_lai + write(iulog,*) ' model_year_align_lai = ',model_year_align_lai write(iulog,*) ' stream_fldFileName_lai = ',trim(stream_fldFileName_lai) endif @@ -162,8 +161,8 @@ subroutine lai_init(bounds) fldList = shr_string_listCreateField( numLaiFields, laiString ) call shr_strdata_create(sdat_lai,name="laidyn", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -175,7 +174,7 @@ subroutine lai_init(bounds) domFileName=trim(stream_fldFileName_lai), & domTvarName='time', & domXvarName='lon' , & - domYvarName='lat' , & + domYvarName='lat' , & domAreaName='area', & domMaskName='mask', & filePath='', & @@ -208,7 +207,7 @@ subroutine lai_interp(bounds, canopystate_inst) ! ! !ARGUMENTS: implicit none - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds type(canopystate_type) , intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: @@ -266,7 +265,7 @@ subroutine SatellitePhenologyInit (bounds) use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: ier ! error code @@ -309,7 +308,7 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & use pftconMod, only : noveg, nbrdlf_dcd_brl_shrub ! ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter integer , intent(in) :: filter_nolakep(bounds%endp-bounds%begp+1) ! patch filter for non-lake points type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst @@ -322,14 +321,14 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & !----------------------------------------------------------------------- associate( & - frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow + frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) + snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) + tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow - htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) - hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) + htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) + hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch & ! Output: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] ) @@ -370,7 +369,7 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & ! problems associated with very small lai and sai. ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. + ! Wang and Zeng, 2007. if (patch%itype(p) > noveg .and. patch%itype(p) <= nbrdlf_dcd_brl_shrub ) then ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) @@ -412,7 +411,7 @@ subroutine interpMonthlyVeg (bounds, canopystate_inst) use clm_time_manager, only : get_curr_date, get_step_size_real, get_nstep ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(canopystate_type), intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: @@ -470,12 +469,12 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) use shr_scam_mod, only : shr_scam_getCloseLatLon ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(canopystate_type), intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: type(file_desc_t) :: ncid ! netcdf id - real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set + real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set real(r8), pointer :: mlai(:,:) ! lai read from input files real(r8):: closelat,closelon ! single column vars integer :: ier ! error code @@ -492,13 +491,13 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) character(len=32) :: subname = 'readAnnualVegetation' !----------------------------------------------------------------------- - annlai => canopystate_inst%annlai_patch + annlai => canopystate_inst%annlai_patch ! Determine necessary indices allocate(mlai(bounds%begg:bounds%endg,0:maxveg), stat=ier) if (ier /= 0) then - write(iulog,*)subname, 'allocation error ' + write(iulog,*)subname, 'allocation error ' call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -544,7 +543,7 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) else !! non-vegetated pft annlai(k,p) = 0._r8 end if - end do ! end of loop over patches + end do ! end of loop over patches enddo ! months loop @@ -571,7 +570,7 @@ subroutine readMonthlyVegetation (bounds, & use netcdf ! ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds character(len=*) , intent(in) :: fveg ! file with monthly vegetation data integer , intent(in) :: months(2) ! months to be interpolated (1 to 12) type(canopystate_type), intent(inout) :: canopystate_inst diff --git a/src/biogeochem/ch4FInundatedStreamType.F90 b/src/biogeochem/ch4FInundatedStreamType.F90 index a0f9dec105..bdbc7cc647 100644 --- a/src/biogeochem/ch4FInundatedStreamType.F90 +++ b/src/biogeochem/ch4FInundatedStreamType.F90 @@ -3,8 +3,8 @@ module ch4FInundatedStreamType #include "shr_assert.h" - !----------------------------------------------------------------------- - ! !DESCRIPTION: + !----------------------------------------------------------------------- + ! !DESCRIPTION: ! Contains methods for reading in finundated streams file for methane code. ! ! !USES @@ -60,11 +60,10 @@ module ch4FInundatedStreamType !============================================================================== subroutine Init(this, bounds, NLFilename) - ! + ! ! Initialize the ch4 finundated stream object ! ! Uses: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar, get_curr_date use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -83,12 +82,12 @@ subroutine Init(this, bounds, NLFilename) ! arguments implicit none class(ch4finundatedstream_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! local variables integer :: ig, g ! Indices - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information type(shr_strdata_type) :: sdat ! input data stream integer :: index_ZWT0 = 0 ! Index of ZWT0 field integer :: index_F0 = 0 ! Index of F0 field @@ -111,8 +110,8 @@ subroutine Init(this, bounds, NLFilename) call clm_domain_mct (bounds, dom_clm) call shr_strdata_create(sdat,name=stream_name,& - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -124,7 +123,7 @@ subroutine Init(this, bounds, NLFilename) domFileName=trim(control%stream_fldFileName_ch4finundated), & domTvarName='time', & domXvarName='LONGXY' , & - domYvarName='LATIXY' , & + domYvarName='LATIXY' , & domAreaName='AREA', & domMaskName='LANDMASK', & filePath='', & @@ -191,7 +190,7 @@ end subroutine Init logical function UseStreams(this) ! ! !DESCRIPTION: - ! Return true if + ! Return true if ! ! !USES: ! @@ -201,9 +200,9 @@ logical function UseStreams(this) ! ! !LOCAL VARIABLES: if ( trim(control%stream_fldFileName_ch4finundated) == '' )then - UseStreams = .false. + UseStreams = .false. else - UseStreams = .true. + UseStreams = .true. end if end function UseStreams @@ -246,7 +245,7 @@ subroutine CalcFinundated(this, bounds, num_soilc, filter_soilc, soilhydrology_i waterdiagnosticbulk_inst, qflx_surf_lag_col, finundated ) ! ! !DESCRIPTION: - ! + ! ! Calculate finundated according to the appropriate methodology ! ! !USES: @@ -312,11 +311,10 @@ end subroutine CalcFinundated !============================================================================== subroutine ReadNML(this, bounds, NLFilename) - ! - ! Read the namelist data stream information. + ! + ! Read the namelist data stream information. ! ! Uses: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -329,7 +327,7 @@ subroutine ReadNML(this, bounds, NLFilename) ! arguments implicit none class(streamcontrol_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! local variables diff --git a/src/biogeophys/UrbanTimeVarType.F90 b/src/biogeophys/UrbanTimeVarType.F90 index c23b5ff050..bbc5b67567 100644 --- a/src/biogeophys/UrbanTimeVarType.F90 +++ b/src/biogeophys/UrbanTimeVarType.F90 @@ -12,7 +12,7 @@ module UrbanTimeVarType use clm_varctl , only : iulog use landunit_varcon , only : isturb_MIN, isturb_MAX use clm_varcon , only : spval - use LandunitType , only : lun + use LandunitType , only : lun use GridcellType , only : grc use mct_mod use shr_strdata_mod , only : shr_strdata_type @@ -34,10 +34,10 @@ module UrbanTimeVarType procedure, public :: Init ! Allocate and initialize urbantv procedure, public :: urbantv_init ! Initialize urban time varying stream procedure, public :: urbantv_interp ! Interpolate urban time varying stream - + end type urbantv_type - !----------------------------------------------------------------------- + !----------------------------------------------------------------------- character(15), private :: stream_var_name(isturb_MIN:isturb_MAX) character(len=*), parameter, private :: sourcefile = & @@ -56,7 +56,7 @@ subroutine Init(this, bounds, NLFilename) ! ! !ARGUMENTS: class(urbantv_type) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds character(len=*) , intent(in) :: NLFilename ! Namelist filename ! ! !LOCAL VARIABLES: @@ -90,7 +90,6 @@ subroutine urbantv_init(this, bounds, NLFilename) ! Initialize data stream information for urban time varying data ! ! !USES: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -117,11 +116,11 @@ subroutine urbantv_init(this, bounds, NLFilename) integer :: ifield ! field index integer :: stream_year_first_urbantv ! first year in urban tv stream to use integer :: stream_year_last_urbantv ! last year in urban tv stream to use - integer :: model_year_align_urbantv ! align stream_year_first_urbantv + integer :: model_year_align_urbantv ! align stream_year_first_urbantv ! with this model year integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_urbantv ! urban tv streams filename character(len=CL) :: urbantvmapalgo = 'nn' ! mapping alogrithm for urban ac character(len=CL) :: fldList ! field string @@ -189,7 +188,7 @@ subroutine urbantv_init(this, bounds, NLFilename) call shr_strdata_create(this%sdat_urbantv,name="clmurbantv", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 3ccc9f19a4..c9cbc54c8c 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -176,12 +176,11 @@ contains ! ! !USES: use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat - use clm_varctl , only : inst_name !----------------------------------------------------------------------- - PIO_subsystem => shr_pio_getiosys(inst_name) - io_type = shr_pio_getiotype(inst_name) - io_netcdf_format = shr_pio_getioformat(inst_name) + PIO_subsystem => shr_pio_getiosys('LND') + io_type = shr_pio_getiotype('LND') + io_netcdf_format = shr_pio_getioformat('LND') end subroutine ncd_pio_init !----------------------------------------------------------------------- diff --git a/src/main/ndepStreamMod.F90 b/src/main/ndepStreamMod.F90 index ac8548a8c1..3c8ef90c5b 100644 --- a/src/main/ndepStreamMod.F90 +++ b/src/main/ndepStreamMod.F90 @@ -51,7 +51,6 @@ subroutine ndep_init(bounds, NLFilename) ! ! Uses: use shr_kind_mod , only : CS => shr_kind_cs - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -134,7 +133,7 @@ subroutine ndep_init(bounds, NLFilename) call shr_strdata_create(sdat,name="clmndep", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & From b1d5a4eadedd7397334f37f5743c819549461a40 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 10 Apr 2020 15:03:00 -0600 Subject: [PATCH 0777/1973] get rid of se mods accidentally commited --- bld/namelist_files/namelist_defaults_ctsm.xml | 87 +++---------------- 1 file changed, 14 insertions(+), 73 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index ab7912d3a5..9eae5e3e07 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -634,26 +634,12 @@ lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr2000_c170824.nc + +lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc + +lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc lnd/clm2/surfdata_map/surfdata_ne16np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_hist_16pfts_Irrig_CMIP6_simyr2000_c190228.nc - -lnd/clm2/surfdata_map/surfdata_ne30pg2_hist_16pfts_Irrig_CMIP6_simyr2000_c191009.nc - -lnd/clm2/surfdata_map/surfdata_ne30pg3_hist_16pfts_Irrig_CMIP6_simyr2000_c190228.nc - -lnd/clm2/surfdata_map/surfdata_ne0CONUSne30x8_hist_16pfts_Irrig_CMIP6_simyr2000_c190814.nc - -lnd/clm2/surfdata_map/surfdata_ne0np4.ARCTIC.ne30x4_hist_16pfts_Irrig_CMIP6_simyr2000_c191023.nc - -lnd/clm2/surfdata_map/surfdata_ne0np4.ARCTICGRIS.ne30x8_hist_16pfts_Irrig_CMIP6_simyr2000_c191209.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4_hist_16pfts_Irrig_CMIP6_simyr2000_c190814.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4.pg2_hist_16pfts_Irrig_CMIP6_simyr2000_c200108.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4.pg3_hist_16pfts_Irrig_CMIP6_simyr2000_c190814.nc lnd/clm2/surfdata_map/surfdata_0.125nldas2_hist_16pfts_Irrig_CMIP6_simyr2005_c190412.nc @@ -695,26 +681,12 @@ lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr2000_c171214.nc lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr2000_c171214.nc + +lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr2000_c170824.nc + +lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr2000_c170824.nc lnd/clm2/surfdata_map/surfdata_ne16np4_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c190301.nc - -lnd/clm2/surfdata_map/surfdata_ne30pg2_hist_78pfts_CMIP6_simyr2000_c191009.nc - -lnd/clm2/surfdata_map/surfdata_ne30pg3_hist_78pfts_CMIP6_simyr2000_c190301.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4_hist_78pfts_CMIP6_simyr2000_c190715.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4.pg2_hist_78pfts_CMIP6_simyr2000_c200109.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4.pg3_hist_78pfts_CMIP6_simyr2000_c190715.nc - -lnd/clm2/surfdata_map/surfdata_ne0CONUSne30x8_hist_78pfts_CMIP6_simyr2000_c190711.nc - -lnd/clm2/surfdata_map/surfdata_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr2000_c191023.nc - -lnd/clm2/surfdata_map/surfdata_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr2000_c191212.nc @@ -746,24 +718,11 @@ lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr1850_c171214.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850_c190228.nc - -lnd/clm2/surfdata_map/surfdata_ne30pg2_hist_16pfts_Irrig_CMIP6_simyr1850_c191009.nc - -lnd/clm2/surfdata_map/surfdata_ne30pg3_hist_16pfts_Irrig_CMIP6_simyr1850_c190228.nc - -lnd/clm2/surfdata_map/surfdata_ne0CONUSne30x8_hist_16pfts_Irrig_CMIP6_simyr1850_c190814.nc - -lnd/clm2/surfdata_map/surfdata_ne0np4.ARCTIC.ne30x4_hist_16pfts_Irrig_CMIP6_simyr1850_c191023.nc - -lnd/clm2/surfdata_map/surfdata_ne0np4.ARCTICGRIS.ne30x8_hist_16pfts_Irrig_CMIP6_simyr1850_c191209.nc + -lnd/clm2/surfdata_map/surfdata_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850_c190814.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4.pg2_hist_16pfts_Irrig_CMIP6_simyr1850_c200108.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4.pg3_hist_16pfts_Irrig_CMIP6_simyr1850_c190814.nc +lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc + +lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc @@ -857,16 +816,8 @@ lnd/clm2/surfdata_map/surfdata_C24_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nclnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4.pg3_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190816.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne0CONUSne30x8_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190815.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c191023.nc - lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c191209.nc -lnd/clm2/surfdata_map/landuse_timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc @@ -897,16 +848,6 @@ lnd/clm2/surfdata_map/surfdata_C24_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nclnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4.pg3_hist_78pfts_CMIP6_simyr1850-2015_c190816.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne0CONUSne30x8_hist_78pfts_CMIP6_simyr1850-2015_c190815.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850-2015_c191023.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c191212.nc - - lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc From 177537d7c7e9e3e08a344de7512839f1a7df90aa Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 10 Apr 2020 15:05:58 -0600 Subject: [PATCH 0778/1973] get rid of se mods accidentally commited --- bld/namelist_files/namelist_defaults_ctsm.xml | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 9eae5e3e07..bc8d365283 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -759,36 +759,9 @@ lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr1850_c170917.nc -lnd/clm2/surfdata_map/surfdata_ne30np4_hist_78pfts_CMIP6_simyr1850_c190301.nc - -lnd/clm2/surfdata_map/surfdata_ne30pg2_hist_78pfts_CMIP6_simyr1850_c191009.nc - -lnd/clm2/surfdata_map/surfdata_ne30pg3_hist_78pfts_CMIP6_simyr1850_c190301.nc +lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr1850_c170824.nc -lnd/clm2/surfdata_map/surfdata_ne120np4_hist_78pfts_CMIP6_simyr1850_c190715.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4.pg2_hist_78pfts_CMIP6_simyr1850_c200109.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4.pg3_hist_78pfts_CMIP6_simyr1850_c190715.nc - -lnd/clm2/surfdata_map/surfdata_ne0CONUSne30x8_hist_78pfts_CMIP6_simyr1850_c190711.nc - -lnd/clm2/surfdata_map/surfdata_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850_c191023.nc - -lnd/clm2/surfdata_map/surfdata_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850_c191212.nc - - - - -lnd/clm2/surfdata_map/surfdata_C384_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc - -lnd/clm2/surfdata_map/surfdata_C192_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc - -lnd/clm2/surfdata_map/surfdata_C96_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc - -lnd/clm2/surfdata_map/surfdata_C48_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc - -lnd/clm2/surfdata_map/surfdata_C24_SSP5-8.5_78pfts_CMIP6_simyr1850_c200317.nc +lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc From 16d4e611a74dad4fe0f0db97b1c65f6851198551 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Fri, 10 Apr 2020 15:22:58 -0600 Subject: [PATCH 0779/1973] removing the unnecessary if lun%urbpoi(l) after confirming with olyson. --- src/biogeophys/SoilTemperatureMod.F90 | 141 ++++++++++++-------------- 1 file changed, 67 insertions(+), 74 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 50a3c7b63b..353c009d94 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -1962,10 +1962,9 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & hs_top_lev(c) = hs_top_snow(c) ! urban road columns - if (lun%urbpoi(l) .and. & - (col%itype(c) == icol_sunwall .or. & + if (col%itype(c) == icol_sunwall .or. & col%itype(c) == icol_shadewall .or. & - col%itype(c) == icol_roof)) then + col%itype(c) == icol_roof) then hs_top_lev(c) = hs_top(c) @@ -2128,11 +2127,10 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if ((lun%urbpoi(l)) & - .and. & - (col%itype(c) == icol_sunwall & - .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then + if (col%itype(c) == icol_sunwall .or. & + col%itype(c) == icol_shadewall .or. & + col%itype(c) == icol_roof) then + if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then ! changed hs to hs_top @@ -2164,29 +2162,29 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if ((.not. lun%urbpoi(l)) .or. & - (col%itype(c) == icol_road_imperv .or. & - col%itype(c) == icol_road_perv)) then - - if (j == col%snl(c)+1) then - rt(c,j) = t_soisno(c,j) + fact(c,j)*( hs_top_snow(c) & - - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - else if (j == 1) then - ! this is the snow/soil interface layer - rt(c,j) = t_soisno(c,j) + fact(c,j) & - *((1._r8-frac_sno_eff(c))*(hs_soil(c) - dhsdT(c)*t_soisno(c,j)) & - + cnfac*(fn(c,j) - frac_sno_eff(c) * fn(c,j-1))) + if ((.not. lun%urbpoi(l)) .or. & + (col%itype(c) == icol_road_imperv .or. & + col%itype(c) == icol_road_perv)) then - rt(c,j) = rt(c,j) + frac_sno_eff(c)*fact(c,j)*sabg_lyr_col(c,j) + if (j == col%snl(c)+1) then + rt(c,j) = t_soisno(c,j) + fact(c,j)*( hs_top_snow(c) & + - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) + else if (j == 1) then + ! this is the snow/soil interface layer + rt(c,j) = t_soisno(c,j) + fact(c,j) & + *((1._r8-frac_sno_eff(c))*(hs_soil(c) - dhsdT(c)*t_soisno(c,j)) & + + cnfac*(fn(c,j) - frac_sno_eff(c) * fn(c,j-1))) - else if (j <= nlevgrnd-1) then - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) + rt(c,j) = rt(c,j) + frac_sno_eff(c)*fact(c,j)*sabg_lyr_col(c,j) - else if (j == nlevgrnd) then - rt(c,j) = t_soisno(c,j) - cnfac*fact(c,j)*fn(c,j-1) + fact(c,j)*fn(c,j) - end if + else if (j <= nlevgrnd-1) then + rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) + else if (j == nlevgrnd) then + rt(c,j) = t_soisno(c,j) - cnfac*fact(c,j)*fn(c,j-1) + fact(c,j)*fn(c,j) end if + + end if end do end do @@ -2501,11 +2499,9 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & nlev_thresh(fc) = nlevgrnd ! urban road columns - if ((lun%urbpoi(l)) & - .and. & - (col%itype(c) == icol_sunwall & - .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then + if (col%itype(c) == icol_sunwall .or. & + col%itype(c) == icol_shadewall.or. & + col%itype(c) == icol_roof) then nlev_thresh(fc) = nlevurb @@ -2614,41 +2610,41 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if (lun%urbpoi(l)) then - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - if (j /= 1) then - bmatrix_soil(c,4,j) = 0._r8 - else !if (j == 1) - bmatrix_soil_snow(c,5,j) = 0._r8 - end if - bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j <= nlevurb-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - if (j /= 1) then - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - else !if (j == 1) then - bmatrix_soil_snow(c,5,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - end if - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - else if (j == nlevurb) then - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prognostic inner - ! surface temperature. - dzm = ( z(c,j)-z(c,j-1)) - dzp = (zi(c,j)-z(c,j)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm) - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm + tk(c,j)/dzp) - bmatrix_soil(c,2,j) = 0._r8 - end if - end if - end if + if ( col%itype(c) == icol_sunwall .or. & + col%itype(c) == icol_shadewall .or. & + col%itype(c) == icol_roof) then + + if (j >= col%snl(c)+1) then + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + if (j /= 1) then + bmatrix_soil(c,4,j) = 0._r8 + else + bmatrix_soil_snow(c,5,j) = 0._r8 + end if + bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + else if (j <= nlevurb-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + if (j /= 1) then + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + else + bmatrix_soil_snow(c,5,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + end if + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + else if (j == nlevurb) then + ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across + ! the bottom "soil" layer and the equations are derived assuming a prognostic inner + ! surface temperature. + dzm = ( z(c,j)-z(c,j-1)) + dzp = (zi(c,j)-z(c,j)) + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm) + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm + tk(c,j)/dzp) + bmatrix_soil(c,2,j) = 0._r8 + end if + end if end if enddo enddo @@ -2660,15 +2656,16 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if ((col%itype(c) == icol_road_imperv) .or. & - (col%itype(c) == icol_road_perv) .or. & + if ((col%itype(c) == icol_road_imperv) .or. & + (col%itype(c) == icol_road_perv) .or. & (.not. lun%urbpoi(l))) then + if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then dzp = z(c,j+1)-z(c,j) if (j /= 1) then bmatrix_soil(c,4,j) = 0._r8 - else !if ( j== 1) + else bmatrix_soil_snow(c,5,j) = 0._r8 end if bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) @@ -2677,10 +2674,6 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! this is the snow/soil interface layer dzm = (z(c,j)-z(c,j-1)) dzp = (z(c,j+1)-z(c,j)) - !if (j /= 1) then - ! bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - ! * tk(c,j-1)/dzm - !end if bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + frac_sno_eff(c) * tk(c,j-1)/dzm) & @@ -2740,7 +2733,7 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d type(bounds_type), intent(in) :: bounds ! bounds integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: dtime ! land model time step (sec) + real(r8), intent(in) :: dtime ! land model time step [sec] integer , intent(in) :: nband ! number of bands of the tridigonal matrix real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] From 0b55f2c8dbc894a3d48d8923c8261808657f379a Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Sat, 11 Apr 2020 12:39:13 -0600 Subject: [PATCH 0780/1973] remove crop irrigation filters for FV3 srfdata files, add missing map file for each fv3 resolution, add aux_clm test --- bld/namelist_files/namelist_defaults_ctsm.xml | 30 ++++++++++++------- cime_config/testdefs/testlist_clm.xml | 8 +++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index bc8d365283..8650fd16c7 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -654,15 +654,15 @@ lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr2000_c171214.n >lnd/clm2/surfdata_map/surfdata_64x128_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C384_hist_78pfts_CMIP6_simyr2000_c200317.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C192_hist_78pfts_CMIP6_simyr2000_c200317.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr2000_c200317.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C48_hist_78pfts_CMIP6_simyr2000_c200317.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C24_hist_78pfts_CMIP6_simyr2000_c200317.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc @@ -730,15 +730,15 @@ lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc lnd/clm2/surfdata_map/surfdata_48x96_78pfts_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C384_hist_78pfts_CMIP6_simyr1850_c200317.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C192_hist_78pfts_CMIP6_simyr1850_c200317.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c200317.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C48_hist_78pfts_CMIP6_simyr1850_c200317.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C24_hist_78pfts_CMIP6_simyr1850_c200317.nc lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc @@ -2143,6 +2143,8 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc +lnd/clm2/mappingdata/maps/C24/map_0.5x0.5_TO_C24_aave.181018.nc lnd/clm2/mappingdata/maps/C24/map_0.5x0.5_MODIS_to_C24_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C48/map_0.5x0.5_TO_C48_aave.181018.nc lnd/clm2/mappingdata/maps/C48/map_0.5x0.5_MODIS_to_C48_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C96/map_0.5x0.5_TO_C96_aave.181018.nc lnd/clm2/mappingdata/maps/C96/map_0.5x0.5_MODIS_to_C96_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C192/map_0.5x0.5_TO_C192_aave.181018.nc lnd/clm2/mappingdata/maps/C192/map_0.5x0.5_MODIS_to_C192_nomask_aave_da_c181018.nc +lnd/clm2/mappingdata/maps/C384/map_0.5x0.5_TO_C384_aave.181018.nc lnd/clm2/mappingdata/maps/C384/map_0.5x0.5_MODIS_to_C384_nomask_aave_da_c181018.nc 00:20:00
    + + + + + + + + From 2093b5de73030287cb7a3b802c72896c4a64827a Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Mon, 13 Apr 2020 00:15:53 -0400 Subject: [PATCH 0781/1973] Add files via upload --- src/biogeochem/CNPhenologyMod.F90 | 130 +++++++++++------------------- 1 file changed, 45 insertions(+), 85 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 866285cc13..8b3e305a47 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -29,13 +29,13 @@ module CNPhenologyMod use pftconMod , only : pftcon use SoilStateType , only : soilstate_type use TemperatureType , only : temperature_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type - use ColumnType , only : col + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use initVerticalMod , only : find_soil_layer_containing_depth + use ColumnType , only : col use GridcellType , only : grc use PatchType , only : patch use atm2lndType , only : atm2lnd_type - use atm2lndType , only : atm2lnd_type ! implicit none private @@ -59,6 +59,7 @@ module CNPhenologyMod real(r8) :: crit_offset_swi ! critical number of water stress days to initiate offset real(r8) :: soilpsi_off ! critical soil water potential for leaf offset real(r8) :: lwtop ! live wood turnover proportion (annual fraction) + real(r8) :: phenology_soil_depth ! soil depth used for measuring states for phenology triggers end type params_type type(params_type) :: params_inst @@ -76,6 +77,7 @@ module CNPhenologyMod real(r8) :: crit_offset_swi ! water stress days for offset trigger real(r8) :: soilpsi_off ! water potential for offset trigger (MPa) real(r8) :: lwtop ! live wood turnover proportion (annual fraction) + integer :: phenology_soil_layer ! soil layer used for measuring states for phenology triggers ! CropPhenology variables and constants real(r8) :: p1d, p1v ! photoperiod factor constants for crop vernalization @@ -164,77 +166,29 @@ subroutine readParams ( ncid ) ! !DESCRIPTION: ! ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io + use ncdio_pio , only: file_desc_t + use paramUtilMod , only : readNcdioScalar ! !ARGUMENTS: implicit none type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id ! ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNPhenolParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading + character(len=*), parameter :: subname = 'readParams_CNPhenology' !----------------------------------------------------------------------- - ! - ! read in parameters - ! - tString='crit_dayl' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_dayl=tempr - - tString='ndays_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_on=tempr - - tString='ndays_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_off=tempr - - tString='fstor2tran' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%fstor2tran=tempr - - tString='crit_onset_fdd' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_onset_fdd=tempr - - tString='crit_onset_swi' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_onset_swi=tempr - - tString='soilpsi_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%soilpsi_on=tempr - - tString='crit_offset_fdd' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_offset_fdd=tempr - - tString='crit_offset_swi' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_offset_swi=tempr - - tString='soilpsi_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%soilpsi_off=tempr - - tString='lwtop_ann' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%lwtop=tempr + call readNcdioScalar(ncid, 'crit_dayl', subname, params_inst%crit_dayl) + call readNcdioScalar(ncid, 'ndays_on', subname, params_inst%ndays_on) + call readNcdioScalar(ncid, 'ndays_off', subname, params_inst%ndays_off) + call readNcdioScalar(ncid, 'fstor2tran', subname, params_inst%fstor2tran) + call readNcdioScalar(ncid, 'crit_onset_fdd', subname, params_inst%crit_onset_fdd) + call readNcdioScalar(ncid, 'crit_onset_swi', subname, params_inst%crit_onset_swi) + call readNcdioScalar(ncid, 'soilpsi_on', subname, params_inst%soilpsi_on) + call readNcdioScalar(ncid, 'crit_offset_fdd', subname, params_inst%crit_offset_fdd) + call readNcdioScalar(ncid, 'crit_offset_swi', subname, params_inst%crit_offset_swi) + call readNcdioScalar(ncid, 'soilpsi_off', subname, params_inst%soilpsi_off) + call readNcdioScalar(ncid, 'lwtop_ann', subname, params_inst%lwtop) + call readNcdioScalar(ncid, 'phenology_soil_depth', subname, params_inst%phenology_soil_depth) end subroutine readParams @@ -298,7 +252,7 @@ subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) call CNSeasonDecidPhenology(num_soilp, filter_soilp, & - temperature_inst, waterstatebulk_inst, cnveg_state_inst, dgvs_inst, & + temperature_inst, waterdiagnosticbulk_inst, cnveg_state_inst, dgvs_inst, & cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) call CNStressDecidPhenology(num_soilp, filter_soilp, & @@ -376,6 +330,10 @@ subroutine CNPhenologyInit(bounds) ! set transfer parameters fstor2tran=params_inst%fstor2tran + call find_soil_layer_containing_depth( & + depth = params_inst%phenology_soil_depth, & + layer = phenology_soil_layer) + ! ----------------------------------------- ! Constants for CNStressDecidPhenology ! ----------------------------------------- @@ -669,7 +627,7 @@ end subroutine CNEvergreenPhenology !----------------------------------------------------------------------- subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & - temperature_inst, waterstatebulk_inst, cnveg_state_inst, dgvs_inst , & + temperature_inst, waterdiagnosticbulk_inst, cnveg_state_inst, dgvs_inst , & cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) ! ! !DESCRIPTION: @@ -686,7 +644,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches type(temperature_type) , intent(in) :: temperature_inst - type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(dgvs_type) , intent(inout) :: dgvs_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst @@ -699,7 +657,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & integer :: fp !lake filter patch index real(r8):: ws_flag !winter-summer solstice flag (0 or 1) real(r8):: crit_onset_gdd !critical onset growing degree-day sum - real(r8):: crit_daylat !latitudinal light gradient in arctic-boreal + real(r8):: crit_daylat !latitudinal light gradient in arctic-boreal real(r8):: onset_thresh !flag onset threshold real(r8):: soilt !----------------------------------------------------------------------- @@ -714,9 +672,9 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) soila10 => temperature_inst%soila10_patch , & ! Input: [real(r8) (:) ] - t_a10min => temperature_inst%t_a10min_patch , & ! input: [real(r8) (:) ] - snow_5day => waterdiagnosticbulk_inst%snow_5day , & ! input: [real(r8) (:) ] - + t_a5min => temperature_inst%t_a5min_patch , & ! input: [real(r8) (:) ] + snow_5day => waterdiagnosticbulk_inst%snow_5day_col , & ! input: [real(r8) (:) ] + pftmayexist => dgvs_inst%pftmayexist_patch , & ! Output: [logical (:) ] exclude seasonal decid patches from tropics annavg_t2m => cnveg_state_inst%annavg_t2m_patch , & ! Input: [real(r8) (:) ] annual average 2m air temperature (K) @@ -790,6 +748,8 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ) ! start patch loop + + do fp = 1,num_soilp p = filter_soilp(fp) c = patch%column(p) @@ -886,7 +846,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! test for switching from dormant period to growth period if (dormant_flag(p) == 1.0_r8) then - + onset_thresh = 0.0_r8 ! Test to turn on growing degree-day sum, if off. ! switch on the growing degree day sum on the winter solstice @@ -909,20 +869,18 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! if the gdd flag is set, and if the soil is above freezing ! then accumulate growing degree days for onset trigger - soilt = t_soisno(c,3) + soilt = t_soisno(c, phenology_soil_layer) if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday end if !separate into Arctic boreal and lower latitudes if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then onset_thresh=1.0_r8 - else if (onset_gddflag(p) == 1.0_r8 .and. soila10(p) > SHR_CONST_TKFRZ & - .and. t_a10min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 & - .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then + else if (onset_gddflag(p) == 1.0_r8 .and. soila10(p) > SHR_CONST_TKFRZ .and. & + t_a5min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. & + dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then onset_thresh=1.0_r8 - end if - - + end if ! set onset_flag if critical growing degree-day sum is exceeded if (onset_thresh == 1.0_r8) then onset_flag(p) = 1.0_r8 @@ -970,12 +928,14 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & days_active(p) = days_active(p) + fracday if (days_active(p) > 355._r8) pftmayexist(p) = .false. end if + ! use 15 hr at 65N from eitel 2019, to ~11hours in temperate regions crit_daylat=54000-720*(65-abs(grc%latdeg(g))) if (crit_daylat < crit_dayl) then crit_daylat = crit_dayl end if - ! only begin to test for offset daylength once past the summer sol + + ! only begin to test for offset daylength once past the summer sol if (ws_flag == 0._r8 .and. dayl(g) < crit_daylat) then offset_flag(p) = 1._r8 offset_counter(p) = ndays_off * secspday @@ -1140,8 +1100,8 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & g = patch%gridcell(p) if (stress_decid(ivt(p)) == 1._r8) then - soilt = t_soisno(c,3) - psi = soilpsi(c,3) + soilt = t_soisno(c, phenology_soil_layer) + psi = soilpsi(c, phenology_soil_layer) ! onset gdd sum from Biome-BGC, v4.1.2 crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) From 2369a1e5b5104589fc836a855c0787ccd70d17f8 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Mon, 13 Apr 2020 00:16:57 -0400 Subject: [PATCH 0782/1973] Add files via upload --- src/biogeophys/LunaMod.F90 | 12 ++++------ src/biogeophys/PhotosynthesisMod.F90 | 12 +++++----- src/biogeophys/TemperatureType.F90 | 2 ++ src/biogeophys/WaterDiagnosticBulkType.F90 | 27 ++++++++++++++-------- src/biogeophys/WaterType.F90 | 3 +++ 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 1c9234514b..488544d22e 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -404,22 +404,20 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & PNcbold = 0.0_r8 call NitrogenAllocation(FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, hourpd, & tair10, tleafd10, tleafn10, & - Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp, PNlcold, PNetold, PNrespold, dayl_factor(p),& - PNcbold, PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) + Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp, PNlcold, PNetold, PNrespold, PNcbold, & + dayl_factor(p), PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) vcmx25_opt= PNcbopt * FNCa * Fc25 jmx25_opt= PNetopt * FNCa * Fj25 chg = vcmx25_opt-vcmx25_z(p, z) chg_constrn = min(abs(chg),vcmx25_z(p, z)*max_daily_pchg) - vcmx_prevyr(p,z) = vcmx25_z(p,z) vcmx25_z(p, z) = vcmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - vcmx_prevyr(p,z) = (vcmx_prevyr(p,z)+vcmx25_z(p,z))/2.0_r8 + vcmx_prevyr(p,z) = vcmx25_z(p,z) chg = jmx25_opt-jmx25_z(p, z) chg_constrn = min(abs(chg),jmx25_z(p, z)*max_daily_pchg) - jmx_prevyr(p,z) = jmx25_z(p,z) jmx25_z(p, z) = jmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - jmx_prevyr(p,z) = (jmx_prevyr(p,z)+jmx25_z(p,z))/2.0_r8 + jmx_prevyr(p,z) = jmx25_z(p,z) PNlc_z(p, z)= PNlcopt @@ -902,7 +900,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR jj = 1 tleafd10c = min(max(tleafd10, Trange1), Trange2) !constrain the physiological range tleafn10c = min(max(tleafn10, Trange1), Trange2) !constrain the physiological range - ci = 0.7_r8 * CO2a10 + ci = 0.7_r8 * CO2a10 JmaxCoef = Jmaxb1 * dayl_factor * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & (1.0_r8 - minrelh))) do while (PNlcoldi .NE. PNlc .and. jj < 100) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index c94069ce6c..88ad4e142e 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -183,8 +183,8 @@ module PhotosynthesisMod ! LUNA specific variables real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer - real(r8), pointer, public :: vcmx_prevyr (:,:) ! patch leaf Vc,max25 previous year avg - real(r8), pointer, public :: jmx2_prevyr (:,:) ! patch leaf Jmax25 previous year avg + real(r8), pointer, public :: vcmx_prevyr (:,:) ! patch leaf Vc,max25 previous year running avg + real(r8), pointer, public :: jmx_prevyr (:,:) ! patch leaf Jmax25 previous year running avg real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) @@ -831,19 +831,19 @@ subroutine Restart(this, bounds, ncid, flag) if(use_luna) then call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='Maximum carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_patch) call restartvar(ncid=ncid, flag=flag, varname='jmx25_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='Maximum carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) call restartvar(ncid=ncid, flag=flag, varname='vcmx_prevyr', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='avg carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%vcmx_prevyr) call restartvar(ncid=ncid, flag=flag, varname='jmx_prevyr', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='avg carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx_prevyr) call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index b54c24af9a..0648dd5854 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -229,6 +229,7 @@ subroutine InitAllocate(this, bounds) allocate(this%thv_col (begc:endc)) ; this%thv_col (:) = nan allocate(this%thm_patch (begp:endp)) ; this%thm_patch (:) = nan allocate(this%t_a10_patch (begp:endp)) ; this%t_a10_patch (:) = nan + allocate(this%soila10_patch (begp:endp)) ; this%soila10_patch (:) = nan allocate(this%t_a10min_patch (begp:endp)) ; this%t_a10min_patch (:) = nan allocate(this%t_a5min_patch (begp:endp)) ; this%t_a5min_patch (:) = nan @@ -1261,6 +1262,7 @@ subroutine InitAccVars(this, bounds) call extract_accum_field ('TDM5', rbufslp, nstep) this%t_a5min_patch(begp:endp) = rbufslp(begp:endp) + if (use_crop) then call extract_accum_field ('TDM10', rbufslp, nstep) this%t_a10min_patch(begp:endp)= rbufslp(begp:endp) diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index d0c297633d..68d0b70b04 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -87,9 +87,9 @@ module WaterDiagnosticBulkType procedure, private :: InitBulkAllocate procedure, private :: InitBulkHistory procedure, private :: InitBulkCold - procedure, private :: InitAccBuffer - procedure, private :: InitAccVars - procedure, private :: UpdateAccVars + procedure, public :: InitAccBuffer + procedure, public :: InitAccVars + procedure, public :: UpdateAccVars procedure, private :: RestartBackcompatIssue783 end type waterdiagnosticbulk_type @@ -180,7 +180,7 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%h2osno_total_col (begc:endc)) ; this%h2osno_total_col (:) = nan allocate(this%snow_depth_col (begc:endc)) ; this%snow_depth_col (:) = nan - allocate(this%snow_5day_col (begc:endc)) ; this%snow_5day (:) = nan + allocate(this%snow_5day_col (begc:endc)) ; this%snow_5day_col (:) = nan allocate(this%snowdp_col (begc:endc)) ; this%snowdp_col (:) = nan allocate(this%snow_layer_unity_col (begc:endc,-nlevsno+1:0)) ; this%snow_layer_unity_col (:,:) = nan allocate(this%bw_col (begc:endc,-nlevsno+1:0)) ; this%bw_col (:,:) = nan @@ -405,13 +405,13 @@ subroutine InitBulkHistory(this, bounds) avgflag='A', & long_name=this%info%lname('snow height of snow covered area'), & ptr_col=this%snow_depth_col, c2l_scale_type='urbanf') - this%snow_5day(begc:endc) = spval + this%snow_5day_col(begc:endc) = spval call hist_addfld1d ( & fname=this%info%fname('SNOW_5D'), & units='m', & avgflag='A', & long_name=this%info%lname('5day snow avg'), & - ptr_col=this%snow_5day, c2l_scale_type='urbanf') + ptr_col=this%snow_5day_col, c2l_scale_type='urbanf') call hist_addfld1d ( & fname=this%info%fname('SNOW_DEPTH_ICE'), & @@ -533,10 +533,11 @@ subroutine InitAccBuffer (this, bounds) use accumulMod , only : init_accum_field ! ! !ARGUMENTS: - class(waterdiagnosticbulk_type) :: this + class(waterdiagnosticbulk_type) :: this type(bounds_type), intent(in) :: bounds !--------------------------------------------------------------------- + this%snow_5day_col(bounds%begc:bounds%endc) = spval call init_accum_field (name='SNOW_5D', units='m', & desc='5-day running mean of snowdepth', accum_type='runmean', accum_period=-5, & subgrid_type='column', numlev=1, init_value=0._r8) @@ -561,16 +562,22 @@ subroutine InitAccVars (this, bounds) type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: + integer :: begc, endc integer :: nstep integer :: ier + real(r8), pointer :: rbufslp(:) ! temporary !--------------------------------------------------------------------- + begc = bounds%begc; endc = bounds%endc ! Allocate needed dynamic memory for single level patch field + allocate(rbufslp(begc:endc), stat=ier) ! Determine time step nstep = get_nstep() - call extract_accum_field ('SNOW_5D', this%snow_5day_col, nstep) + call extract_accum_field ('SNOW_5D', rbufslp, nstep) + this%snow_5day_col(begc:endc) = rbufslp(begc:endc) + deallocate(rbufslp) end subroutine InitAccVars @@ -582,8 +589,8 @@ subroutine UpdateAccVars (this, bounds) use accumulMod , only : update_accum_field, extract_accum_field ! ! !ARGUMENTS: - class(waterdiagnosticbulk_type) :: this - type(bounds_type) , intent(in) :: bounds + class(waterdiagnosticbulk_type) :: this + type(bounds_type) , intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: c ! indices diff --git a/src/biogeophys/WaterType.F90 b/src/biogeophys/WaterType.F90 index 4744b63085..0bc831987a 100644 --- a/src/biogeophys/WaterType.F90 +++ b/src/biogeophys/WaterType.F90 @@ -665,6 +665,7 @@ subroutine InitAccBuffer(this, bounds) call this%waterfluxbulk_inst%InitAccBuffer(bounds) call this%wateratm2lndbulk_inst%InitAccBuffer(bounds) + call this%waterdiagnosticbulk_inst%InitAccBuffer(bounds) end subroutine InitAccBuffer @@ -685,6 +686,7 @@ subroutine InitAccVars(this, bounds) call this%waterfluxbulk_inst%initAccVars(bounds) call this%wateratm2lndbulk_inst%initAccVars(bounds) + call this%waterdiagnosticbulk_inst%initAccVars(bounds) end subroutine InitAccVars @@ -707,6 +709,7 @@ subroutine UpdateAccVars(this, bounds) call this%waterfluxbulk_inst%UpdateAccVars(bounds) call this%wateratm2lndbulk_inst%UpdateAccVars(bounds) + call this%waterdiagnosticbulk_inst%UpdateAccVars(bounds) end subroutine UpdateAccVars From aa247514823297645e5c97d87904257d23ce0652 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 13 Apr 2020 12:00:57 -0600 Subject: [PATCH 0783/1973] removing the unnecessary l = col%landunit(c) --- src/biogeophys/SoilTemperatureMod.F90 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 353c009d94..54c689ee79 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -1957,7 +1957,6 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & do j = -nlevsno+1,0 do fc = 1,num_nolakec c = filter_nolakec(fc) - l = col%landunit(c) ! urban non-road and non-urban columns hs_top_lev(c) = hs_top_snow(c) @@ -1976,7 +1975,6 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & do j = -nlevsno+1,0 do fc = 1,num_nolakec c = filter_nolakec(fc) - l = col%landunit(c) if (j == col%snl(c)+1) then dzp = z(c,j+1)-z(c,j) rt(c,j-1) = t_soisno(c,j) + fact(c,j)*( hs_top_lev(c) & @@ -2126,7 +2124,6 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & do j = 1,nlevurb do fc = 1,num_nolakec c = filter_nolakec(fc) - l = col%landunit(c) if (col%itype(c) == icol_sunwall .or. & col%itype(c) == icol_shadewall .or. & col%itype(c) == icol_roof) then @@ -2494,7 +2491,6 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & do j = -nlevsno+1,0 do fc = 1,num_nolakec c = filter_nolakec(fc) - l = col%landunit(c) ! urban non-road and non-urban columns nlev_thresh(fc) = nlevgrnd @@ -2513,7 +2509,6 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & do j = -nlevsno+1,0 do fc = 1,num_nolakec c = filter_nolakec(fc) - l = col%landunit(c) if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then dzp = z(c,j+1)-z(c,j) @@ -2609,7 +2604,6 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & do j = 1,nlevurb do fc = 1,num_nolakec c = filter_nolakec(fc) - l = col%landunit(c) if ( col%itype(c) == icol_sunwall .or. & col%itype(c) == icol_shadewall .or. & col%itype(c) == icol_roof) then From d50584e29c701c2a0714f133bbf6773d2f797c6b Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 13 Apr 2020 12:31:51 -0600 Subject: [PATCH 0784/1973] Simplifying SetMatrix_Snow logic --- src/biogeophys/SoilTemperatureMod.F90 | 28 +++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 54c689ee79..1d55d82f88 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -2510,25 +2510,19 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & do fc = 1,num_nolakec c = filter_nolakec(fc) if (j >= col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_snow (c,4,j-1) = 0._r8 ! at - bmatrix_snow (c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) ! bt - if ( j /= 0) then - bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp !ct - else !if ( j == 0) then - bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - end if - else if (j <= nlev_thresh(fc)-1) then + bmatrix_snow (c,4,j-1) = 0._r8 + bmatrix_snow (c,3,j-1) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + else dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm !at - bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) !bt - if (j /= 0) then - bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp !ct - else !if ( j == 0) - bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if + bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + end if + if (j /= 0) then + bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp !ct + else !if ( j == 0) + bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp end if end if enddo From 557047aac568274de8753e2981e3ba49e562ef26 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Mon, 13 Apr 2020 18:24:13 -0400 Subject: [PATCH 0785/1973] Add files via upload --- src/biogeochem/CNPhenologyMod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 8b3e305a47..9f95f492e9 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -929,10 +929,11 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & if (days_active(p) > 355._r8) pftmayexist(p) = .false. end if - ! use 15 hr at 65N from eitel 2019, to ~11hours in temperate regions + ! use 15 hr (54000 min) at ~65N from eitel 2019, to ~11hours in temperate regions + ! 15hr-11hr/(65N-45N)=linear slope = 720 min/latitude crit_daylat=54000-720*(65-abs(grc%latdeg(g))) if (crit_daylat < crit_dayl) then - crit_daylat = crit_dayl + crit_daylat = crit_dayl !maintain previous offset from White 2001 as minimum end if ! only begin to test for offset daylength once past the summer sol From 82de28b9ddb95e7b564883fb4dd6811f18235cbc Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Mon, 13 Apr 2020 19:59:50 -0400 Subject: [PATCH 0786/1973] Add files via upload From 32d085461dedce486371a91f9b7932c6573da974 Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Mon, 13 Apr 2020 20:00:34 -0400 Subject: [PATCH 0787/1973] Add files via upload From 11446f14d713bb23470da8697329cdb6848e7ea8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 14 Apr 2020 14:31:20 -0600 Subject: [PATCH 0788/1973] Changes for the initialization bug in luna so that the last value from the previous year is normally used, unless it's a restart rather than hard-coded values addresses #981 --- src/biogeophys/LunaMod.F90 | 10 +++++++--- src/biogeophys/PhotosynthesisMod.F90 | 12 ++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 9087d1e14f..6bf6010db3 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -306,7 +306,9 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & vcmx25_z => photosyns_inst%vcmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 (umol/m2 leaf/s) for canopy layer jmx25_z => photosyns_inst%jmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 (umol electron/m**2/s) for canopy layer pnlc_z => photosyns_inst%pnlc_z_patch , & ! Output: [real(r8) (:,:) ] patch proportion of leaf nitrogen allocated for light capture for canopy layer - enzs_z => photosyns_inst%enzs_z_patch & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress + enzs_z => photosyns_inst%enzs_z_patch , & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress + vcmx_prevyr => photosyns_inst%vcmx_prevyr , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 from previous year avg + jmx_prevyr => photosyns_inst%jmx_prevyr & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 from previous year avg ) !---------------------------------------------------------------------------------------------------------------------------------------------------------- !set timestep @@ -410,10 +412,12 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & chg = vcmx25_opt-vcmx25_z(p, z) chg_constrn = min(abs(chg),vcmx25_z(p, z)*max_daily_pchg) vcmx25_z(p, z) = vcmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn + vcmx_prevyr(p,z) = vcmx25_z(p,z) chg = jmx25_opt-jmx25_z(p, z) chg_constrn = min(abs(chg),jmx25_z(p, z)*max_daily_pchg) jmx25_z(p, z) = jmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn + jmx_prevyr(p,z) = jmx25_z(p,z) PNlc_z(p, z)= PNlcopt @@ -472,8 +476,8 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & endif !if not C3 plants else do z = 1 , nrad(p) - jmx25_z(p, z) = 85._r8 - vcmx25_z(p, z) = 50._r8 + jmx25_z(p, z) = jmx_prevyr(p,z) + vcmx25_z(p, z) = vcmx_prevyr(p,z) end do endif !checking for LAI and LNC endif !the first daycheck diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index a111cab156..a0710358fc 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -183,6 +183,8 @@ module PhotosynthesisMod ! LUNA specific variables real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer + real(r8), pointer, public :: vcmx_prevyr (:,:) ! patch leaf Vc,max25 previous year running avg + real(r8), pointer, public :: jmx_prevyr (:,:) ! patch leaf Jmax25 previous year running avg real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) @@ -328,6 +330,8 @@ subroutine InitAllocate(this, bounds) ! statements. allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 + allocate(this%vcmx_prevyr (begp:endp,1:nlevcan)) ; this%vcmx_prevyr (:,:) = 85._r8 + allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 50._r8 allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8 @@ -833,6 +837,14 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) + call restartvar(ncid=ncid, flag=flag, varname='vcmx_prevyr', xtype=ncd_double, & + dim1name='pft', dim2name='levcan', switchdim=.true., & + long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & + interpinic_flag='interp', readvar=readvar, data=this%vcmx_prevyr) + call restartvar(ncid=ncid, flag=flag, varname='jmx_prevyr', xtype=ncd_double, & + dim1name='pft', dim2name='levcan', switchdim=.true., & + long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & + interpinic_flag='interp', readvar=readvar, data=this%jmx_prevyr) call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='proportion of leaf nitrogen allocated for light capture', units='unitless', & From f79ff356dbb39451c8874be1754a2bec49cb1840 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 15 Apr 2020 13:24:22 -0600 Subject: [PATCH 0789/1973] cleanly separate use_biomass_heat_storage cases --- src/biogeophys/BalanceCheckMod.F90 | 5 +- src/biogeophys/BareGroundFluxesMod.F90 | 6 +- src/biogeophys/CanopyFluxesMod.F90 | 30 +++++---- src/biogeophys/EnergyFluxType.F90 | 12 ++-- src/biogeophys/PhotosynthesisMod.F90 | 2 +- src/main/initGridCellsMod.F90 | 84 +++----------------------- src/main/pftconMod.F90 | 5 +- src/main/subgridMod.F90 | 9 ++- 8 files changed, 40 insertions(+), 113 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 02d53ced69..65620589fe 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -335,7 +335,7 @@ subroutine BalanceCheck( bounds, & qflx_sfc_irrig => waterflux_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s) qflx_glcice_dyn_water_flux => waterflux_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) - hs_canopy => energyflux_inst%hs_canopy_patch , & ! Input: [real(r8) (:) ] change in heat content of stem (W/m**2) [+ to atm] + dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Input: [real(r8) (:) ] change in heat content of canopy (W/m**2) [+ to atm] eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Input: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Input: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] @@ -612,7 +612,7 @@ subroutine BalanceCheck( bounds, & if (.not. lun%urbpoi(l)) then errseb(p) = sabv(p) + sabg_chk(p) + forc_lwrad(c) - eflx_lwrad_out(p) & - - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) - hs_canopy(p) + - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) - dhsdt_canopy(p) else errseb(p) = sabv(p) + sabg(p) & - eflx_lwrad_net(p) & @@ -698,6 +698,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'eflx_sh_tot = ' ,eflx_sh_tot(indexp) write(iulog,*)'eflx_lh_tot = ' ,eflx_lh_tot(indexp) write(iulog,*)'eflx_soil_grnd = ' ,eflx_soil_grnd(indexp) + write(iulog,*)'dhsdt_canopy = ' ,dhsdt_canopy(indexp) write(iulog,*)'fsa fsr = ' ,fsa(indexp), fsr(indexp) write(iulog,*)'fabd fabi = ' ,fabd(indexp,:), fabi(indexp,:) write(iulog,*)'albd albi = ' ,albd(indexp,:), albi(indexp,:) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index 197897a917..1d62815948 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -144,8 +144,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & real(r8) :: www ! surface soil wetness [-] !------------------------------------------------------------------------------ - associate( & - hs_canopy => energyflux_inst%hs_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] + associate( & + dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:,:) ] evaporative soil resistance (s/m) snl => col%snl , & ! Input: [integer (:) ] number of snow layers @@ -288,7 +288,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & displa(p) = 0._r8 dlrad(p) = 0._r8 ulrad(p) = 0._r8 - hs_canopy(p) = 0._r8 + dhsdt_canopy(p) = 0._r8 eflx_sh_stem(p) = 0._r8 ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 90f96f94af..06e9b4c3cc 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -433,19 +433,18 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, SHR_ASSERT_ALL_FL((ubound(downreg_patch) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(leafn_patch) == (/bounds%endp/)), sourcefile, __LINE__) - associate( & + associate( & t_stem => temperature_inst%t_stem_patch , & ! Output: [real(r8) (:) ] stem temperature (Kelvin) - hs_canopy => energyflux_inst%hs_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] - soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:) ] soil evaporative resistance - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) - max_dayl => grc%max_dayl , & ! Input: [real(r8) (:) ] maximum daylength for this grid cell (s) - + dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] + soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:) ] soil evaporative resistance + snl => col%snl , & ! Input: [integer (:) ] number of snow layers + dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) + max_dayl => grc%max_dayl , & ! Input: [real(r8) (:) ] maximum daylength for this grid cell (s) dleaf => pftcon%dleaf , & ! Input: characteristic leaf dimension (m) dbh_param => pftcon%dbh , & ! Input: diameter at brest height (m) fbw => pftcon%fbw , & ! Input: fraction of biomass that is water nstem => pftcon%nstem , & ! Input: stem number density (#ind/m2) - rstem => pftcon%rstem , & ! Input: stem restistance per stem diameter (s/m**2) + rstem => pftcon%rstem , & ! Input: stem resistance per stem diameter (s/m**2) wood_density => pftcon%wood_density , & ! Input: dry wood density (kg/m3) forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) @@ -579,7 +578,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ulrad => energyflux_inst%ulrad_patch , & ! Output: [real(r8) (:) ] upward longwave radiation above the canopy [W/m2] cgrnd => energyflux_inst%cgrnd_patch , & ! Output: [real(r8) (:) ] deriv. of soil energy flux wrt to soil temp [w/m2/k] eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Output: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] - eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] + eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from surface water (W/m**2) [+ to atm] eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] eflx_sh_veg => energyflux_inst%eflx_sh_veg_patch , & ! Output: [real(r8) (:) ] sensible heat flux from leaves (W/m**2) [+ to atm] @@ -676,7 +675,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, obuold(p) = 0._r8 btran(p) = btran0 btran2(p) = btran0 - hs_canopy(p) = 0._r8 + dhsdt_canopy(p) = 0._r8 eflx_sh_stem(p) = 0._r8 end do @@ -998,7 +997,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, !! Sakaguchi changes for stability formulation ends here - if (use_undercanopy_stability) then + if (use_biomass_heat_storage) then ! use uuc for ground fluxes (keep uaf for canopy terms) rah(p,2) = 1._r8/(csoilcn*uuc(p)) else @@ -1116,8 +1115,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, canopy_cond(p) = (laisun(p)/(rb(p)+rssun(p)) + laisha(p)/(rb(p)+rssha(p)))/max(elai(p), 0.01_r8) end if -! should be the same expression used in Photosynthesis/getqflx - efpot = forc_rho(c)*elai(p)/rb(p)*(qsatl(p)-qaf(p)) + efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p)*(qsatl(p)-qaf(p)) h2ocan = liqcan(p) + snocan(p) ! When the hydraulic stress parameterization is active calculate rpp @@ -1159,7 +1157,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Moved the original subroutine in-line... wtaq = frac_veg_nosno(p)/raw(p,1) ! air - wtlq = frac_veg_nosno(p)*elai(p)/rb(p) * rpp ! leaf + wtlq = frac_veg_nosno(p)*(elai(p)+esai(p))/rb(p) * rpp ! leaf !Litter layer resistance. Added by K.Sakaguchi snow_depth_c = params_inst%z_dl ! critical depth for 100% litter burial by snow (=litter thickness) @@ -1239,7 +1237,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! result in an imbalance in "hvap*qflx_evap_veg" and ! "efe + dc2*wtgaq*qsatdt_veg" - efpot = forc_rho(c)*elai(p)/rb(p) & + efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p) & *(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) qflx_evap_veg(p) = rpp*efpot @@ -1381,7 +1379,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, dt_stem(p) = 0._r8 endif - hs_canopy(p) = dt_stem(p)*cp_stem(p)/dtime & + dhsdt_canopy(p) = dt_stem(p)*cp_stem(p)/dtime & +(t_veg(p)-tl_ini(p))*cp_veg(p)/dtime t_stem(p) = t_stem(p) + dt_stem(p) diff --git a/src/biogeophys/EnergyFluxType.F90 b/src/biogeophys/EnergyFluxType.F90 index 5d95b2e5a1..d58418ccac 100644 --- a/src/biogeophys/EnergyFluxType.F90 +++ b/src/biogeophys/EnergyFluxType.F90 @@ -103,7 +103,7 @@ module EnergyFluxType real(r8), pointer :: htvp_col (:) ! latent heat of vapor of water (or sublimation) [j/kg] ! Canopy heat - real(r8), pointer :: hs_canopy_patch (:) ! patch change in heat content of canopy (leaf+stem) (W/m**2) [+ to atm] + real(r8), pointer :: dhsdt_canopy_patch (:) ! patch change in heat content of canopy (leaf+stem) (W/m**2) [+ to atm] ! Balance Checks real(r8), pointer :: errsoi_patch (:) ! soil/lake energy conservation error (W/m**2) @@ -251,7 +251,7 @@ subroutine InitAllocate(this, bounds) allocate( this%htvp_col (begc:endc)) ; this%htvp_col (:) = nan - allocate( this%hs_canopy_patch (begp:endp)) ; this%hs_canopy_patch (:) = nan + allocate( this%dhsdt_canopy_patch (begp:endp)) ; this%dhsdt_canopy_patch (:) = nan allocate(this%rresis_patch (begp:endp,1:nlevgrnd)) ; this%rresis_patch (:,:) = nan allocate(this%btran_patch (begp:endp)) ; this%btran_patch (:) = nan @@ -445,10 +445,10 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp) avgflag='A', long_name='sensible heat from stem', & ptr_patch=this%eflx_sh_stem_patch, c2l_scale_type='urbanf',default = 'inactive') - this%hs_canopy_patch(begp:endp) = spval - call hist_addfld1d (fname='HS_CANOPY', units='W/m^2', & - avgflag='A', long_name='heat change of stem', & - ptr_patch=this%hs_canopy_patch, set_lake=0._r8, c2l_scale_type='urbanf',default='inactive') + this%dhsdt_canopy_patch(begp:endp) = spval + call hist_addfld1d (fname='DHSDT_CANOPY', units='W/m^2', & + avgflag='A', long_name='change in canopy heat storage', & + ptr_patch=this%dhsdt_canopy_patch, set_lake=0._r8, c2l_scale_type='urbanf',default='inactive') this%eflx_sh_grnd_patch(begp:endp) = spval call hist_addfld1d (fname='FSH_G', units='W/m^2', & diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 032ed9d5bc..a111cab156 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -4814,7 +4814,7 @@ subroutine getqflx(p,c,gb_mol,gs_mol_sun,gs_mol_sha,qflx_sun,qflx_sha,qsatl,qaf, cf = forc_pbot(c)/(rgas*1.e-3_r8*tgcm(p))*1.e6_r8 ! gb->gbmol conversion factor - wtl = elai(p)*gb_mol + wtl = (elai(p)+esai(p))*gb_mol efpot = forc_rho(c)*wtl*(qsatl-qaf) if (havegs) then diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 index c1c13bcf95..d60e620a68 100644 --- a/src/main/initGridCellsMod.F90 +++ b/src/main/initGridCellsMod.F90 @@ -35,8 +35,7 @@ module initGridCellsMod public initGridcells ! initialize sub-grid gridcell mapping ! ! !PRIVATE MEMBER FUNCTIONS: - private set_landunit_veg_compete - private set_landunit_veg_noncompete + private set_landunit_veg private set_landunit_wet_lake private set_landunit_ice_mec private set_landunit_crop_noncompete @@ -136,13 +135,8 @@ subroutine initGridcells(glc_behavior) ! Determine naturally vegetated landunit do gdc = bounds_clump%begg,bounds_clump%endg - if(use_individual_pft_soil_column) then - call set_landunit_veg_noncompete( & - ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) - else - call set_landunit_veg_compete( & - ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) - end if + call set_landunit_veg( & + ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) end do ! Determine crop landunit @@ -221,10 +215,10 @@ subroutine initGridcells(glc_behavior) end subroutine initGridcells !------------------------------------------------------------------------ - subroutine set_landunit_veg_compete (ltype, gi, li, ci, pi) + subroutine set_landunit_veg (ltype, gi, li, ci, pi) ! ! !DESCRIPTION: - ! Initialize vegetated landunit with competition + ! Initialize vegetated landunit ! ! !USES use clm_instur, only : wt_lunit, wt_nat_patch @@ -252,7 +246,7 @@ subroutine set_landunit_veg_compete (ltype, gi, li, ci, pi) ! Set decomposition properties call subgrid_get_info_natveg(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits, sesc=.FALSE.) + npatches=npatches, ncols=ncols, nlunits=nlunits) wtlunit2gcell = wt_lunit(gi, ltype) nlunits_added = 0 @@ -279,71 +273,7 @@ subroutine set_landunit_veg_compete (ltype, gi, li, ci, pi) SHR_ASSERT_FL(ncols_added == ncols, sourcefile, __LINE__) SHR_ASSERT_FL(npatches_added == npatches, sourcefile, __LINE__) - end subroutine set_landunit_veg_compete - - !------------------------------------------------------------------------ - subroutine set_landunit_veg_noncompete (ltype, gi, li, ci, pi) - ! - ! !DESCRIPTION: - ! Initialize vegetated landunit without competition (called if sesc switch - ! is true) - ! - ! !USES - use clm_instur, only : wt_lunit, wt_nat_patch - use subgridMod, only : subgrid_get_info_natveg, natveg_patch_exists - use clm_varpar, only : maxpatch_pft, natpft_lb, natpft_ub - ! - ! !ARGUMENTS: - integer , intent(in) :: ltype ! landunit type - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! patch index - ! - ! !LOCAL VARIABLES: - integer :: m ! index - integer :: npatches ! number of patches in landunit - integer :: ncols - integer :: nlunits - integer :: npatches_added ! number of patches actually added - integer :: ncols_added ! number of columns actually added - integer :: nlunits_added ! number of landunits actually added - real(r8) :: wtlunit2gcell ! landunit weight in gridcell - !------------------------------------------------------------------------ - - ! Set decomposition properties - - call subgrid_get_info_natveg(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits, sesc=.TRUE.) - wtlunit2gcell = wt_lunit(gi, ltype) - - nlunits_added = 0 - ncols_added = 0 - npatches_added = 0 - - if (nlunits > 0) then - call add_landunit(li=li, gi=gi, ltype=ltype, wtgcell=wtlunit2gcell) - nlunits_added = nlunits_added + 1 - - - do m = natpft_lb,natpft_ub - if (natveg_patch_exists(gi, m)) then - ! Assume one column for each vegetation patch - call add_column(ci=ci, li=li, ctype=1, wtlunit=wt_nat_patch(gi,m)) - ncols_added = ncols_added + 1 - - call add_patch(pi=pi, ci=ci, ptype=m, wtcol=1.0_r8) - npatches_added = npatches_added + 1 - end if - end do - end if - - SHR_ASSERT(nlunits_added == nlunits, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(ncols_added == ncols, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(npatches_added == npatches, errMsg(sourcefile, __LINE__)) - - end subroutine set_landunit_veg_noncompete - + end subroutine set_landunit_veg !------------------------------------------------------------------------ subroutine set_landunit_wet_lake (ltype, gi, li, ci, pi) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index a9347e122e..b59d683627 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -149,7 +149,7 @@ module pftconMod real(r8), allocatable :: dbh (:) ! diameter at breast height (m) real(r8), allocatable :: fbw (:) ! fraction of biomass that is water real(r8), allocatable :: nstem (:) ! stem density (#/m2) - real(r8), allocatable :: rstem (:) ! stem resistance (s/m) + real(r8), allocatable :: rstem (:) ! stem resistance per dbh (s/m/m) real(r8), allocatable :: wood_density (:) ! wood density (kg/m3) ! crop @@ -1032,8 +1032,7 @@ subroutine InitRead(this) else this%dbh = 0.0 this%fbw = 0.0 - call ncd_io('nstem',this%nstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + this%nstem = 0.1 this%rstem = 0.0 this%wood_density = 0.0 end if diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index 94b6068d19..f49ededca0 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -81,7 +81,7 @@ subroutine subgrid_get_gcellinfo (gi, glc_behavior, & nlunits = 0 ncohorts = 0 - call subgrid_get_info_natveg(gi, npatches_temp, ncols_temp, nlunits_temp, use_individual_pft_soil_column) + call subgrid_get_info_natveg(gi, npatches_temp, ncols_temp, nlunits_temp) call accumulate_counters() call subgrid_get_info_urban_tbd(gi, npatches_temp, ncols_temp, nlunits_temp) @@ -123,18 +123,17 @@ end subroutine accumulate_counters end subroutine subgrid_get_gcellinfo !----------------------------------------------------------------------- - subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits, sesc) + subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits) ! ! !DESCRIPTION: ! Obtain properties for natural vegetated landunit in this grid cell ! ! !USES use clm_varpar, only : natpft_lb, natpft_ub + use clm_varctl, only : use_individual_pft_soil_column ! ! !ARGUMENTS: integer, intent(in) :: gi ! grid cell index - logical, intent(in) :: sesc ! switch for separated soil columns of natural vegetation - integer, intent(out) :: npatches ! number of nat veg patches in this grid cell integer, intent(out) :: ncols ! number of nat veg columns in this grid cell integer, intent(out) :: nlunits ! number of nat veg landunits in this grid cell @@ -154,7 +153,7 @@ subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits, sesc) end do if (npatches > 0) then - if(sesc) then + if(use_individual_pft_soil_column) then ! Assume one soil column for each patch ncols = npatches else From aa0f31f860cfa3590e99d43b32bae2434b550fea Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Mon, 13 Apr 2020 00:16:57 -0400 Subject: [PATCH 0790/1973] Add files via upload --- src/biogeophys/LunaMod.F90 | 12 ++++------ src/biogeophys/PhotosynthesisMod.F90 | 12 +++++----- src/biogeophys/TemperatureType.F90 | 2 ++ src/biogeophys/WaterDiagnosticBulkType.F90 | 27 ++++++++++++++-------- src/biogeophys/WaterType.F90 | 3 +++ 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 1c9234514b..488544d22e 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -404,22 +404,20 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & PNcbold = 0.0_r8 call NitrogenAllocation(FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, hourpd, & tair10, tleafd10, tleafn10, & - Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp, PNlcold, PNetold, PNrespold, dayl_factor(p),& - PNcbold, PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) + Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp, PNlcold, PNetold, PNrespold, PNcbold, & + dayl_factor(p), PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) vcmx25_opt= PNcbopt * FNCa * Fc25 jmx25_opt= PNetopt * FNCa * Fj25 chg = vcmx25_opt-vcmx25_z(p, z) chg_constrn = min(abs(chg),vcmx25_z(p, z)*max_daily_pchg) - vcmx_prevyr(p,z) = vcmx25_z(p,z) vcmx25_z(p, z) = vcmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - vcmx_prevyr(p,z) = (vcmx_prevyr(p,z)+vcmx25_z(p,z))/2.0_r8 + vcmx_prevyr(p,z) = vcmx25_z(p,z) chg = jmx25_opt-jmx25_z(p, z) chg_constrn = min(abs(chg),jmx25_z(p, z)*max_daily_pchg) - jmx_prevyr(p,z) = jmx25_z(p,z) jmx25_z(p, z) = jmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - jmx_prevyr(p,z) = (jmx_prevyr(p,z)+jmx25_z(p,z))/2.0_r8 + jmx_prevyr(p,z) = jmx25_z(p,z) PNlc_z(p, z)= PNlcopt @@ -902,7 +900,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR jj = 1 tleafd10c = min(max(tleafd10, Trange1), Trange2) !constrain the physiological range tleafn10c = min(max(tleafn10, Trange1), Trange2) !constrain the physiological range - ci = 0.7_r8 * CO2a10 + ci = 0.7_r8 * CO2a10 JmaxCoef = Jmaxb1 * dayl_factor * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & (1.0_r8 - minrelh))) do while (PNlcoldi .NE. PNlc .and. jj < 100) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index c94069ce6c..88ad4e142e 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -183,8 +183,8 @@ module PhotosynthesisMod ! LUNA specific variables real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer - real(r8), pointer, public :: vcmx_prevyr (:,:) ! patch leaf Vc,max25 previous year avg - real(r8), pointer, public :: jmx2_prevyr (:,:) ! patch leaf Jmax25 previous year avg + real(r8), pointer, public :: vcmx_prevyr (:,:) ! patch leaf Vc,max25 previous year running avg + real(r8), pointer, public :: jmx_prevyr (:,:) ! patch leaf Jmax25 previous year running avg real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) @@ -831,19 +831,19 @@ subroutine Restart(this, bounds, ncid, flag) if(use_luna) then call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='Maximum carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_patch) call restartvar(ncid=ncid, flag=flag, varname='jmx25_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='Maximum carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) call restartvar(ncid=ncid, flag=flag, varname='vcmx_prevyr', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='avg carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%vcmx_prevyr) call restartvar(ncid=ncid, flag=flag, varname='jmx_prevyr', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='avg carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx_prevyr) call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index b54c24af9a..0648dd5854 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -229,6 +229,7 @@ subroutine InitAllocate(this, bounds) allocate(this%thv_col (begc:endc)) ; this%thv_col (:) = nan allocate(this%thm_patch (begp:endp)) ; this%thm_patch (:) = nan allocate(this%t_a10_patch (begp:endp)) ; this%t_a10_patch (:) = nan + allocate(this%soila10_patch (begp:endp)) ; this%soila10_patch (:) = nan allocate(this%t_a10min_patch (begp:endp)) ; this%t_a10min_patch (:) = nan allocate(this%t_a5min_patch (begp:endp)) ; this%t_a5min_patch (:) = nan @@ -1261,6 +1262,7 @@ subroutine InitAccVars(this, bounds) call extract_accum_field ('TDM5', rbufslp, nstep) this%t_a5min_patch(begp:endp) = rbufslp(begp:endp) + if (use_crop) then call extract_accum_field ('TDM10', rbufslp, nstep) this%t_a10min_patch(begp:endp)= rbufslp(begp:endp) diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index d0c297633d..68d0b70b04 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -87,9 +87,9 @@ module WaterDiagnosticBulkType procedure, private :: InitBulkAllocate procedure, private :: InitBulkHistory procedure, private :: InitBulkCold - procedure, private :: InitAccBuffer - procedure, private :: InitAccVars - procedure, private :: UpdateAccVars + procedure, public :: InitAccBuffer + procedure, public :: InitAccVars + procedure, public :: UpdateAccVars procedure, private :: RestartBackcompatIssue783 end type waterdiagnosticbulk_type @@ -180,7 +180,7 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%h2osno_total_col (begc:endc)) ; this%h2osno_total_col (:) = nan allocate(this%snow_depth_col (begc:endc)) ; this%snow_depth_col (:) = nan - allocate(this%snow_5day_col (begc:endc)) ; this%snow_5day (:) = nan + allocate(this%snow_5day_col (begc:endc)) ; this%snow_5day_col (:) = nan allocate(this%snowdp_col (begc:endc)) ; this%snowdp_col (:) = nan allocate(this%snow_layer_unity_col (begc:endc,-nlevsno+1:0)) ; this%snow_layer_unity_col (:,:) = nan allocate(this%bw_col (begc:endc,-nlevsno+1:0)) ; this%bw_col (:,:) = nan @@ -405,13 +405,13 @@ subroutine InitBulkHistory(this, bounds) avgflag='A', & long_name=this%info%lname('snow height of snow covered area'), & ptr_col=this%snow_depth_col, c2l_scale_type='urbanf') - this%snow_5day(begc:endc) = spval + this%snow_5day_col(begc:endc) = spval call hist_addfld1d ( & fname=this%info%fname('SNOW_5D'), & units='m', & avgflag='A', & long_name=this%info%lname('5day snow avg'), & - ptr_col=this%snow_5day, c2l_scale_type='urbanf') + ptr_col=this%snow_5day_col, c2l_scale_type='urbanf') call hist_addfld1d ( & fname=this%info%fname('SNOW_DEPTH_ICE'), & @@ -533,10 +533,11 @@ subroutine InitAccBuffer (this, bounds) use accumulMod , only : init_accum_field ! ! !ARGUMENTS: - class(waterdiagnosticbulk_type) :: this + class(waterdiagnosticbulk_type) :: this type(bounds_type), intent(in) :: bounds !--------------------------------------------------------------------- + this%snow_5day_col(bounds%begc:bounds%endc) = spval call init_accum_field (name='SNOW_5D', units='m', & desc='5-day running mean of snowdepth', accum_type='runmean', accum_period=-5, & subgrid_type='column', numlev=1, init_value=0._r8) @@ -561,16 +562,22 @@ subroutine InitAccVars (this, bounds) type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: + integer :: begc, endc integer :: nstep integer :: ier + real(r8), pointer :: rbufslp(:) ! temporary !--------------------------------------------------------------------- + begc = bounds%begc; endc = bounds%endc ! Allocate needed dynamic memory for single level patch field + allocate(rbufslp(begc:endc), stat=ier) ! Determine time step nstep = get_nstep() - call extract_accum_field ('SNOW_5D', this%snow_5day_col, nstep) + call extract_accum_field ('SNOW_5D', rbufslp, nstep) + this%snow_5day_col(begc:endc) = rbufslp(begc:endc) + deallocate(rbufslp) end subroutine InitAccVars @@ -582,8 +589,8 @@ subroutine UpdateAccVars (this, bounds) use accumulMod , only : update_accum_field, extract_accum_field ! ! !ARGUMENTS: - class(waterdiagnosticbulk_type) :: this - type(bounds_type) , intent(in) :: bounds + class(waterdiagnosticbulk_type) :: this + type(bounds_type) , intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: c ! indices diff --git a/src/biogeophys/WaterType.F90 b/src/biogeophys/WaterType.F90 index 4744b63085..0bc831987a 100644 --- a/src/biogeophys/WaterType.F90 +++ b/src/biogeophys/WaterType.F90 @@ -665,6 +665,7 @@ subroutine InitAccBuffer(this, bounds) call this%waterfluxbulk_inst%InitAccBuffer(bounds) call this%wateratm2lndbulk_inst%InitAccBuffer(bounds) + call this%waterdiagnosticbulk_inst%InitAccBuffer(bounds) end subroutine InitAccBuffer @@ -685,6 +686,7 @@ subroutine InitAccVars(this, bounds) call this%waterfluxbulk_inst%initAccVars(bounds) call this%wateratm2lndbulk_inst%initAccVars(bounds) + call this%waterdiagnosticbulk_inst%initAccVars(bounds) end subroutine InitAccVars @@ -707,6 +709,7 @@ subroutine UpdateAccVars(this, bounds) call this%waterfluxbulk_inst%UpdateAccVars(bounds) call this%wateratm2lndbulk_inst%UpdateAccVars(bounds) + call this%waterdiagnosticbulk_inst%UpdateAccVars(bounds) end subroutine UpdateAccVars From dd0cbecd1607bfdedbd4ddda480c1ac7d8fd2d6f Mon Sep 17 00:00:00 2001 From: lmbirch89 <35340409+lmbirch89@users.noreply.github.com> Date: Wed, 15 Apr 2020 14:12:52 -0600 Subject: [PATCH 0791/1973] Add files via upload --- src/biogeochem/CNPhenologyMod.F90 | 37 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 343809307c..9f95f492e9 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -252,7 +252,7 @@ subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) call CNSeasonDecidPhenology(num_soilp, filter_soilp, & - temperature_inst, waterstatebulk_inst, cnveg_state_inst, dgvs_inst, & + temperature_inst, waterdiagnosticbulk_inst, cnveg_state_inst, dgvs_inst, & cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) call CNStressDecidPhenology(num_soilp, filter_soilp, & @@ -627,7 +627,7 @@ end subroutine CNEvergreenPhenology !----------------------------------------------------------------------- subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & - temperature_inst, waterstatebulk_inst, cnveg_state_inst, dgvs_inst , & + temperature_inst, waterdiagnosticbulk_inst, cnveg_state_inst, dgvs_inst , & cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) ! ! !DESCRIPTION: @@ -644,7 +644,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches type(temperature_type) , intent(in) :: temperature_inst - type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(dgvs_type) , intent(inout) :: dgvs_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst @@ -657,7 +657,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & integer :: fp !lake filter patch index real(r8):: ws_flag !winter-summer solstice flag (0 or 1) real(r8):: crit_onset_gdd !critical onset growing degree-day sum - real(r8):: crit_daylat !latitudinal light gradient in arctic-boreal + real(r8):: crit_daylat !latitudinal light gradient in arctic-boreal real(r8):: onset_thresh !flag onset threshold real(r8):: soilt !----------------------------------------------------------------------- @@ -672,9 +672,9 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) soila10 => temperature_inst%soila10_patch , & ! Input: [real(r8) (:) ] - t_a10min => temperature_inst%t_a10min_patch , & ! input: [real(r8) (:) ] - snow_5day => waterdiagnosticbulk_inst%snow_5day , & ! input: [real(r8) (:) ] - + t_a5min => temperature_inst%t_a5min_patch , & ! input: [real(r8) (:) ] + snow_5day => waterdiagnosticbulk_inst%snow_5day_col , & ! input: [real(r8) (:) ] + pftmayexist => dgvs_inst%pftmayexist_patch , & ! Output: [logical (:) ] exclude seasonal decid patches from tropics annavg_t2m => cnveg_state_inst%annavg_t2m_patch , & ! Input: [real(r8) (:) ] annual average 2m air temperature (K) @@ -748,6 +748,8 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ) ! start patch loop + + do fp = 1,num_soilp p = filter_soilp(fp) c = patch%column(p) @@ -844,7 +846,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! test for switching from dormant period to growth period if (dormant_flag(p) == 1.0_r8) then - + onset_thresh = 0.0_r8 ! Test to turn on growing degree-day sum, if off. ! switch on the growing degree day sum on the winter solstice @@ -874,13 +876,11 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & !separate into Arctic boreal and lower latitudes if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then onset_thresh=1.0_r8 - else if (onset_gddflag(p) == 1.0_r8 .and. soila10(p) > SHR_CONST_TKFRZ & - .and. t_a10min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 & - .and. dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then + else if (onset_gddflag(p) == 1.0_r8 .and. soila10(p) > SHR_CONST_TKFRZ .and. & + t_a5min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. & + dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then onset_thresh=1.0_r8 - end if - - + end if ! set onset_flag if critical growing degree-day sum is exceeded if (onset_thresh == 1.0_r8) then onset_flag(p) = 1.0_r8 @@ -928,12 +928,15 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & days_active(p) = days_active(p) + fracday if (days_active(p) > 355._r8) pftmayexist(p) = .false. end if - ! use 15 hr at 65N from eitel 2019, to ~11hours in temperate regions + + ! use 15 hr (54000 min) at ~65N from eitel 2019, to ~11hours in temperate regions + ! 15hr-11hr/(65N-45N)=linear slope = 720 min/latitude crit_daylat=54000-720*(65-abs(grc%latdeg(g))) if (crit_daylat < crit_dayl) then - crit_daylat = crit_dayl + crit_daylat = crit_dayl !maintain previous offset from White 2001 as minimum end if - ! only begin to test for offset daylength once past the summer sol + + ! only begin to test for offset daylength once past the summer sol if (ws_flag == 0._r8 .and. dayl(g) < crit_daylat) then offset_flag(p) = 1._r8 offset_counter(p) = ndays_off * secspday From 03bf03da402e9ef47aa3ee0157c8850d2e4ec3b3 Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Wed, 15 Apr 2020 20:01:30 -0700 Subject: [PATCH 0792/1973] add documents for changes relevant to bioenergy crops --- .../CLM50_Tech_Note_CN_Allocation.rst | 10 +- .../CN_Pools/CLM50_Tech_Note_CN_Pools.rst | 5 +- .../CLM50_Tech_Note_Crop_Irrigation.rst | 233 +++++++++++++----- .../Fluxes/CLM50_Tech_Note_Fluxes.rst | 10 +- .../CLM50_Tech_Note_Introduction.rst | 16 +- .../CLM50_Tech_Note_Photosynthesis.rst | 6 +- ...LM50_Tech_Note_Photosynthetic_Capacity.rst | 4 + .../CLM50_Tech_Note_Plant_Hydraulics.rst | 8 + .../References/CLM50_Tech_Note_References.rst | 8 + .../CLM50_Tech_Note_Surface_Albedos.rst | 4 + ...ech_Note_Vegetation_Phenology_Turnover.rst | 24 +- 11 files changed, 249 insertions(+), 79 deletions(-) diff --git a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst index 25b2215e81..e85a59439f 100644 --- a/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst +++ b/doc/source/tech_note/CN_Allocation/CLM50_Tech_Note_CN_Allocation.rst @@ -186,7 +186,15 @@ favorable growth environments (Allen et al., 2005; Vanninen and Makela, +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ | Soybean I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ - + | Miscanthus R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Miscanthus I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Switchgrass R | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + | Switchgrass I | 2 | 0 | 0 | 1 | 25 | 42 | 50 | 500 | + +----------------------------------+-----------------------+-----------------------+-----------------------+-----------------------+---------------------------+-------------------------+-------------------------+-------------------------+ + Carbon to nitrogen ratios are defined for different tissue types as follows: diff --git a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst index 9bddee21ca..77bd7af415 100644 --- a/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst +++ b/doc/source/tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.rst @@ -116,5 +116,8 @@ stoichiometry are described in Chapter :numref:`rst_CN Allocation`. +----------------------------------+-------------------+ | Tropical Soybean | 20.00 | +----------------------------------+-------------------+ - + | Miscanthus | 25.00 | + +----------------------------------+-------------------+ + | Switchgrass | 25.00 | + +----------------------------------+-------------------+ diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 3b8f07f44c..a82f871e6d 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -42,7 +42,7 @@ These updates appear in detail in the sections below. Many also appear in .. _The crop model: -The crop model +The crop model: stable and bioenergy crops ------------------- Introduction @@ -102,18 +102,26 @@ Intercomparison Project (LUMIP), which is part of CMIP6 Land use timeseries (:ref:`Lawrence et al. 2016 `). For more details about how crop distributions are determined, see Chapter :numref:`rst_Transient Landcover Change`. -CLM5 includes eight actively managed crop types +CLM5 includes ten actively managed crop types (temperate soybean, tropical soybean, temperate corn, tropical -corn, spring wheat, cotton, rice, and sugarcane) that are chosen +corn, spring wheat, cotton, rice, sugarcane, miscanthus, and switchgrass) that are chosen based on the availability of corresponding algorithms in AgroIBIS and as developed by :ref:`Badger and Dirmeyer (2015)` and -described by :ref:`Levis et al. (2016)`. The representations of -sugarcane, rice, cotton, tropical corn, and tropical soy are new in CLM5. +described by :ref:`Levis et al. (2016)` and :ref:`Cheng et al. (2019)`. +The representations of sugarcane, rice, cotton, tropical corn, tropical soy, miscanthus, and switchgrass are new in CLM5. Sugarcane and tropical corn are both C4 plants and are therefore represented using the temperate corn functional form. Tropical soybean uses the temperate soybean functional form, while rice and cotton use the wheat functional form. In tropical regions, parameter values were developed for the Amazon Basin, and planting date window is shifted by six months relative to the Northern Hemisphere. +Plantation areas of bioenergy crops are projected to expand throughout the 21st century as a major energy source to +replace fossil fuels and mitigate climate changes. Miscanthus and switchgrass are perennial bioenergy crops and +have quite different physiological traits and land management practices than annual crops, +such as longer growing seasons, higher productivity, and less demands for nutrients and water. +About 70% of their aboveground biomass (leaf & livestem) is removed at harvest for biofuels. Parameter values were developed by using +observation data collected at the University of Illinois Energy Farm +located in Central Midwestern United States (:ref:`Cheng et al., 2019`). + In addition, CLM’s default list of plant functional types (pfts) includes an irrigated and unirrigated unmanaged C3 crop (:numref:`Table Crop plant functional types`) treated as a second C3 grass. @@ -197,10 +205,10 @@ managed crop types that are using the same parameter set. 68 irrigated sugarcane active irrigated sugarcane 69 rainfed sunflower inactive rainfed spring wheat 70 irrigated sunflower inactive irrigated spring wheat - 71 rainfed miscanthus inactive rainfed tropical corn - 72 irrigated miscanthus inactive irrigated tropical corn - 73 rainfed switchgrass inactive rainfed tropical corn - 74 irrigated switchgrass inactive irrigated tropical corn + 71 rainfed miscanthus active rainfed miscanthus + 72 irrigated miscanthus active irrigated miscanthus + 73 rainfed switchgrass active rainfed switchgrass + 74 irrigated switchgrass active irrigated switchgrass 75 rainfed tropical corn active rainfed tropical corn 76 irrigated tropical corn active irrigated tropical corn 77 rainfed tropical soybean active rainfed tropical soybean @@ -347,27 +355,27 @@ Harvest occurs in one time step using the BGC leaf offset algorithm. .. table:: Crop phenology and morphology parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. - =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== - \ temperate corn spring wheat temperatue soybean cotton rice sugarcane tropical corn tropical soybean - =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== - IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 - :math:`Date_{planting}^{min}` April 1 April 1 May 1 April 1 Janurary 1 Janurary 1 March 20 April 15 - :math:`Date_{planting}^{max}` June 15 June 15 June 15 May 31 Feburary 28 March 31 April 15 June 31 - :math:`T_{p}`\(K) 283.15 280.15 286.15 294.15 294.15 294.15 294.15 294.15 - :math:`T_{p}^{ min }`\(K) 279.15 272.15 279.15 283.15 283.15 283.15 283.15 283.15 - :math:`{GDD}_{min}`\(ºdays) 50 50 50 50 50 50 50 50 - base temperature for GDD (ºC) 8 0 10 10 10 10 10 10 - :math:`{GDD}_{mat}`\(ºdays) 950-1850 :math:`\mathrm{\le}`\ 1700 :math:`\mathrm{\le}`\ 1900 :math:`\mathrm{\le}`\ 1700 :math:`\mathrm{\le}`\ 2100 950-1850 950-1850 :math:`\mathrm{\le}`\ 2100 - Phase 2 % :math:`{GDD}_{mat}` 0.03 0.05 0.03 0.03 0.01 0.03 0.03 0.03 - Phase 3 % :math:`{GDD}_{mat}` 0.65 0.6 0.5 0.5 0.4 0.65 0.5 0.5 - Harvest: days past planting :math:`\mathrm{\le}`\ 165 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 160 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 300 :math:`\mathrm{\le}`\ 160 :math:`\mathrm{\le}`\ 150 - :math:`z_{top}^{\max }` (m) 2.5 1.2 0.75 1.5 1.8 4 2.5 1 - SLA (m :sup:`2` leaf g :sup:`-1` C) 0.05 0.035 0.035 0.035 0.035 0.05 0.05 0.035 - :math:`\chi _{L}` index -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 - grperc 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 - flnr 0.293 0.41 0.41 0.41 0.41 0.293 0.293 0.41 - fcur 1 1 1 1 1 1 1 1 - =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== + =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== ========================== ========================== + \ temperate corn spring wheat temperatue soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass + =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== ========================== ========================== + IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 71, 72 73, 74 + :math:`Date_{planting}^{min}` April 1 April 1 May 1 April 1 Janurary 1 Janurary 1 March 20 April 15 April 1 April 1 + :math:`Date_{planting}^{max}` June 15 June 15 June 15 May 31 Feburary 28 March 31 April 15 June 31 June 15 June 15 + :math:`T_{p}`\(K) 283.15 280.15 286.15 294.15 294.15 294.15 294.15 294.15 283.15 283.15 + :math:`T_{p}^{ min }`\(K) 279.15 272.15 279.15 283.15 283.15 283.15 283.15 283.15 279.15 279.15 + :math:`{GDD}_{min}`\(ºdays) 50 50 50 50 50 50 50 50 50 50 + base temperature for GDD (ºC) 8 0 10 10 10 10 10 10 8 8 + :math:`{GDD}_{mat}`\(ºdays) 950-1850 :math:`\mathrm{\le}`\ 1700 :math:`\mathrm{\le}`\ 1900 :math:`\mathrm{\le}`\ 1700 :math:`\mathrm{\le}`\ 2100 950-1850 950-1850 :math:`\mathrm{\le}`\ 2100 950-1850 950-1850 + Phase 2 % :math:`{GDD}_{mat}` 0.03 0.05 0.03 0.03 0.01 0.03 0.03 0.03 0.03 0.03 + Phase 3 % :math:`{GDD}_{mat}` 0.65 0.6 0.5 0.5 0.4 0.65 0.5 0.5 0.4 0.4 + Harvest: days past planting :math:`\mathrm{\le}`\ 165 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 160 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 300 :math:`\mathrm{\le}`\ 160 :math:`\mathrm{\le}`\ 150 :math:`\mathrm{\le}`\ 210 :math:`\mathrm{\le}`\ 210 + :math:`z_{top}^{\max }` (m) 2.5 1.2 0.75 1.5 1.8 4 2.5 1 2.5 2.5 + SLA (m :sup:`2` leaf g :sup:`-1` C) 0.05 0.035 0.035 0.035 0.035 0.05 0.05 0.035 0.057 0.049 + :math:`\chi _{L}` index -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 + grperc 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 0.11 + flnr 0.293 0.41 0.41 0.41 0.41 0.293 0.293 0.41 0.293 0.293 + fcur 1 1 1 1 1 1 1 1 1 1 + =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== ========================== ========================== Notes: :math:`Date_{planting}^{min}` and :math:`Date_{planting}^{max}` are the minimum and maximum planting date in the Northern Hemisphere, the corresponding dates @@ -535,24 +543,125 @@ fulfill plant nitrogen demands. Harvest '''''''''''''''''''''''''''''' -Variables track the flow of grain C and -N to food and of all other plant pools, including live stem C and N, to litter. Putting live -stem C and N into the litter pool is in contrast to the approach for unmanaged PFTs which -puts live stem C and N into dead stem pools first. Leaf and root C and N pools -are routed to the litter pools in the same manner as natural vegetation. Whereas food C and N -was formerly transferred to the litter pool, CLM5 routes food C and N +Variables track the flow of grain C and N to food and of all other plant pools, including live stem C and N, to litter, and to biofuel feedstock. +A fraction (determined by :math:`biofuel\_harvfrac`) of leaf/livestem C and N from bioenergy crops is removed at harvest for biofuels +(Equations :eq:`25.9`, :eq:`25.10`, :eq:`25.12`, and :eq:`25.13`), +with the remaining portions go to the litter pools (Equations :eq:`20.14)`, :eq:`25.11`, and :eq:`25.14`). +Putting live stem C and N into the litter and biofuel pools is in contrast to the approach for unmanaged PFTs which +puts live stem C and N into dead stem pools first. +Leaf C and N pools are routed to the little and biofuel pools, contrast to that of unmanaged PFTs which put leaf C and N to litter pools only. +Root C and N pools are routed to the litter pools in the same manner as natural vegetation. + +.. math:: + :label: 25.9 + + CF_{leaf,biofuel} = \left({CS_{leaf} \mathord{\left/ {\vphantom {CS_{leaf} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + \right) * biofuel\_harvfrac + +.. math:: + :label: 25.10 + + CF_{livestem,biofuel} = \left({CS_{livestem} \mathord{\left/ {\vphantom {CS_{leaf} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + \right) * biofuel\_harvfrac + +.. math:: + :label: 25.11 + + CF_{livestem,litter} = \left({CS_{livestem} \mathord{\left/ {\vphantom {CS_{livestem} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + \right) * \left( 1-biofuel\_harvfrac \right) +CF_{alloc,livestem} + +with corresponding nitrogen fluxes: + +.. math:: + :label: 25.12 + + NF_{leaf,biofuel} = \left({NS_{leaf} \mathord{\left/ {\vphantom {NS_{leaf} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + \right) * biofuel\_harvfrac + +.. math:: + :label: 25.13 + + NF_{livestem,biofuel} = \left({NS_{livestem} \mathord{\left/ {\vphantom {NS_{livestem} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + \right) * biofuel\_harvfrac + +.. math:: + :label: 25.14 + + NF_{livestem,litter} = \left({NS_{livestem} \mathord{\left/ {\vphantom {NS_{livestem} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} + \right) * \left( 1-biofuel\_harvfrac \right) + +where :math:`biofuel\_harvfrac` is the harvested fraction of leaf/livestem for biofuel feedstocks. + +.. _Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy crops: + +.. table:: Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy crops. + + +----------------------------------+----------------------------+ + | PFT | :math:`biofuel\_harvfrac` | + +==================================+============================+ + | NET Temperate | 0.00 | + +----------------------------------+----------------------------+ + | NET Boreal | 0.00 | + +----------------------------------+----------------------------+ + | NDT Boreal | 0.00 | + +----------------------------------+----------------------------+ + | BET Tropical | 0.00 | + +----------------------------------+----------------------------+ + | BET temperate | 0.00 | + +----------------------------------+----------------------------+ + | BDT tropical | 0.00 | + +----------------------------------+----------------------------+ + | BDT temperate | 0.00 | + +----------------------------------+----------------------------+ + | BDT boreal | 0.00 | + +----------------------------------+----------------------------+ + | BES temperate | 0.00 | + +----------------------------------+----------------------------+ + | BDS temperate | 0.00 | + +----------------------------------+----------------------------+ + | BDS boreal | 0.00 | + +----------------------------------+----------------------------+ + | C\ :sub:`3` arctic grass | 0.00 | + +----------------------------------+----------------------------+ + | C\ :sub:`3` grass | 0.00 | + +----------------------------------+----------------------------+ + | C\ :sub:`4` grass | 0.00 | + +----------------------------------+----------------------------+ + | Temperate Corn | 0.00 | + +----------------------------------+----------------------------+ + | Spring Wheat | 0.00 | + +----------------------------------+----------------------------+ + | Temperate Soybean | 0.00 | + +----------------------------------+----------------------------+ + | Cotton | 0.00 | + +----------------------------------+----------------------------+ + | Rice | 0.00 | + +----------------------------------+----------------------------+ + | Sugarcane | 0.00 | + +----------------------------------+----------------------------+ + | Tropical Corn | 0.00 | + +----------------------------------+----------------------------+ + | Tropical Soybean | 0.00 | + +----------------------------------+----------------------------+ + | Miscanthus | 0.70 | + +----------------------------------+----------------------------+ + | Switchgrass | 0.70 | + +----------------------------------+----------------------------+ + +Whereas food C and N was formerly transferred to the litter pool, CLM5 routes food C and N to a grain product pool where the C and N decay to the atmosphere over one year, similar in structure to the wood product pools. +The biofuel C and N is also routed to the grain product pool and decay to the atmosphere over one year. Additionally, CLM5 accounts for the C and N required for crop seeding by removing the seed C and N from the grain product pool during harvest. The crop seed pool is then used to seed crops in the subsequent year. -Calcuating the crop yields (Equation :eq:`25.9`) requires that you sum the GRAINC_TO_FOOD variable +Calcuating the crop yields (Equation :eq:`25.15`) requires that you sum the GRAINC_TO_FOOD variable for each year, and must account for the proportion of C in the dry crop weight. Here, we assume that grain C is 45% of the total dry weight. Additionally, harvest is not typically 100% efficient, so analysis needs to assume that harvest efficiency is less. We assume a harvest efficiency of 85%. .. math:: - :label: 25.9 + :label: 25.15 Grain\ yield(g.m^{-2})=\frac{\sum(GRAINC\_ TO\_ FOOD)*0.85}{0.45} @@ -561,27 +670,27 @@ efficiency of 85%. .. table:: Crop allocation parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. - =========================================== ============== ============ ================== ====== ====== ========= ============= ================ - \ temperate corn spring wheat temperatue soybean cotton rice sugarcane tropical corn tropical soybean - =========================================== ============== ============ ================== ====== ====== ========= ============= ================ - IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 - :math:`a_{leaf}^{i}` 0.6 0.9 0.85 0.85 0.75 0.6 0.6 0.85 - :math:`{L}_{max}` (m :sup:`2` m :sup:`-2`) 5 7 6 6 7 5 5 6 - :math:`a_{froot}^{i}` 0.1 0.05 0.2 0.2 0.1 0.1 0.1 0.2 - :math:`a_{froot}^{f}` 0.05 0 0.2 0.2 0 0.05 0.05 0.2 - :math:`a_{leaf}^{f}` 0 0 0 0 0 0 0 0 - :math:`a_{livestem}^{f}` 0 0.05 0.3 0.3 0.05 0 0 0.3 - :math:`d_{L}` 1.05 1.05 1.05 1.05 1.05 1.05 1.05 1.05 - :math:`d_{alloc}^{stem}` 2 1 5 5 1 2 2 5 - :math:`d_{alloc}^{leaf}` 5 3 2 2 3 5 5 2 - :math:`{CN}_{leaf}` 25 20 20 20 20 25 25 20 - :math:`{CN}_{stem}` 50 50 50 50 50 50 50 50 - :math:`{CN}_{froot}` 42 42 42 42 42 42 42 42 - :math:`CN^f_{leaf}` 65 65 65 65 65 65 65 65 - :math:`CN^f_{stem}` 120 100 130 130 100 120 120 130 - :math:`CN^f_{froot}` 0 40 0 0 40 0 0 0 - :math:`{CN}_{grain}` 50 50 50 50 50 50 50 50 - =========================================== ============== ============ ================== ====== ====== ========= ============= ================ + =========================================== ============== ============ ================== ====== ====== ========= ============= ================ ================ ================ + \ temperate corn spring wheat temperatue soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass + =========================================== ============== ============ ================== ====== ====== ========= ============= ================ ================ ================ + IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 71, 72 73, 74 + :math:`a_{leaf}^{i}` 0.6 0.9 0.85 0.85 0.75 0.6 0.6 0.85 0.9 0.7 + :math:`{L}_{max}` (m :sup:`2` m :sup:`-2`) 5 7 6 6 7 5 5 6 10 6.5 + :math:`a_{froot}^{i}` 0.1 0.05 0.2 0.2 0.1 0.1 0.1 0.2 0.11 0.14 + :math:`a_{froot}^{f}` 0.05 0 0.2 0.2 0 0.05 0.05 0.2 0.09 0.09 + :math:`a_{leaf}^{f}` 0 0 0 0 0 0 0 0 0 0 + :math:`a_{livestem}^{f}` 0 0.05 0.3 0.3 0.05 0 0 0.3 0 0 + :math:`d_{L}` 1.05 1.05 1.05 1.05 1.05 1.05 1.05 1.05 1.05 1.05 + :math:`d_{alloc}^{stem}` 2 1 5 5 1 2 2 5 2 2 + :math:`d_{alloc}^{leaf}` 5 3 2 2 3 5 5 2 5 5 + :math:`{CN}_{leaf}` 25 20 20 20 20 25 25 20 25 25 + :math:`{CN}_{stem}` 50 50 50 50 50 50 50 50 50 50 + :math:`{CN}_{froot}` 42 42 42 42 42 42 42 42 42 42 + :math:`CN^f_{leaf}` 65 65 65 65 65 65 65 65 65 65 + :math:`CN^f_{stem}` 120 100 130 130 100 120 120 130 120 120 + :math:`CN^f_{froot}` 0 40 0 0 40 0 0 0 0 0 + :math:`{CN}_{grain}` 50 50 50 50 50 50 50 50 50 50 + =========================================== ============== ============ ================== ====== ====== ========= ============= ================ ================ ================ Notes: Crop growth phases and corresponding variables are described throughout the text. :math:`{CN}_{leaf}`, :math:`{CN}_{stem}`, and :math:`{CN}_{froot}` are @@ -609,7 +718,7 @@ and :math:`{z}_{bot}` (m), come from the AgroIBIS formulation: .. math:: - :label: 25.10 + :label: 25.16 \begin{array}{l} {z_{top} =z_{top}^{\max } \left(\frac{L}{L_{\max } -1} \right)^{2} \ge 0.05{\rm \; where\; }\frac{L}{L_{\max } -1} \le 1} \\ @@ -651,7 +760,7 @@ counter in seconds, *f*, is set as soon as the leaf emergence phase for crops initiates: .. math:: - :label: 25.11 + :label: 25.17 f = n \times 86400 @@ -682,7 +791,7 @@ the for both rainfed and irrigated spring wheat and sugarcane, the calculation o :math:`GDD_{T_{{\rm 2m}} }` allows for latitudinal variation: .. math:: - :label: 25.12 + :label: 25.18 latitudinal\ variation\ in\ base\ T = \left\{ \begin{array}{lr} diff --git a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst index d967cd5ff0..047d4e6723 100644 --- a/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst +++ b/doc/source/tech_note/Fluxes/CLM50_Tech_Note_Fluxes.rst @@ -1351,7 +1351,15 @@ plus stem area for which :math:`z_{0m}` reaches its maximum. +----------------------------------+--------------------+------------------+-------------------------+ | Soybean I | 0.120 | 0.68 | 0.04 | +----------------------------------+--------------------+------------------+-------------------------+ - + | Miscanthus R | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Miscanthus I | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Switchgrass R | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + | Switchgrass I | 0.120 | 0.68 | 0.04 | + +----------------------------------+--------------------+------------------+-------------------------+ + .. _Numerical Implementation: Numerical Implementation diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 7240dfa8d9..5969e4a2d1 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -13,7 +13,7 @@ ***Contributing Authors*** -**Ashehad Ali, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathan Buzan, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Jan Lenaerts, Sam Levis, +**Ashehad Ali, Andrew Badger, Gautam Bisht, Patrick Broxton, Michael Brunke, Jonathan Buzan, Yanyan Cheng, Martyn Clark, Tony Craig, Kyla Dahlin, Beth Drewniak, Louisa Emmons, Josh Fisher, Mark Flanner, Pierre Gentine, Maoyi Huang, Jan Lenaerts, Sam Levis, L. Ruby Leung, William Lipscomb, Jon Pelletier, Daniel M. Ricciuto, Ben Sanderson, Jacquelyn Shuman, Andrew Slater, Zachary Subin, Jinyun Tang, Ahmed Tawfik, Quinn Thomas, Simone Tilmes, Francis Vitt, Xubin Zeng** @@ -524,11 +524,17 @@ light capture, carboxylation, and respiration are co-limiting. CLM5 applies a fixed allocation scheme for woody vegetation. The decision to use a fixed allocation scheme in CLM5, rather than a dynamic NPP-based allocation scheme, as was used in CLM4 and CLM4.5, was driven by the fact that observations indicate that biomass saturates with increasing productivity, in contrast to the behavior in CLM4 and CLM4.5 where biomass continuously increases with increasing productivity (:ref:`Negron-Juarez et al., 2015`). Soil carbon decomposition processes are unchanged in CLM5, but a new metric for apparent soil carbon turnover times (:ref:`Koven et al., 2017 `) suggested parameter changes that produce a weak intrinsic depth limitation on soil carbon turnover rates (rather than the strong depth limitaiton in CLM4.5) and that the thresholds for soil moisture limitation on soil carbon turnover rates in dry soils should be set at a wetter soil moisture level than that used in CLM4.5. -Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. The CLM4.5 crop model is extended to operate globally through the addition of rice and sugarcane as well as tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016)`. These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. -Fertilization rates and irrigation equipped area updated annually based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that +Representation of human management of the land (agriculture, wood harvest) is augmented in several ways. +The CLM4.5 crop model is extended to operate globally through the addition of rice, sugarcane, +tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016)`, +and perennial bioenergy crops :ref:`(Cheng et al., 2019)`. +These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. +Fertilization rates and irrigation equipped area updated annually based on crop type and geographic region through an input dataset. +The irrigation trigger is updated. Additional minor changes include crop phenological triggers that vary by latitude for selected crop types, grain C and N is now removed at harvest to a 1-year product pool with -the carbon for the next season's crop seed removed from the grain carbon at harvest. Through the introduction of -the capability to dynamically adjust landunit weights during a simulation, the crop model can now be run coincidentally +the carbon for the next season's crop seed removed from the grain carbon at harvest. +A fraction of leaf/livestem C and N from bioenergy crops is removed at harvest to the biofuel feedstock pools and added to the 1-year product pool. +Through the introduction of the capability to dynamically adjust landunit weights during a simulation, the crop model can now be run coincidentally with prescribed land use, which significantly expands the capabilities of the model. Mass-based rather than area-based wood harvest is applied. Several heat stress indices for both urban and rural areas are calculated and output by default :ref:`(Buzan et al., 2015)`. A more sophisticated and realistic building space heating and air conditioning submodel that prognoses interior building air temperature and includes more realistic space heating and air conditioning wasteheat factors is incorporated. diff --git a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst index f7171f1a10..3f0c4849ae 100644 --- a/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst +++ b/doc/source/tech_note/Photosynthesis/CLM50_Tech_Note_Photosynthesis.rst @@ -136,7 +136,11 @@ atmospheric potential temperature (K). +----------------------------------+-------------------+ | Tropical Soybean | 5.79 | +----------------------------------+-------------------+ - + | Miscanthus | 1.79 | + +----------------------------------+-------------------+ + | Switchgrass | 1.79 | + +----------------------------------+-------------------+ + .. _Photosynthesis: Photosynthesis diff --git a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst index c4dd5b03f9..c42d7971a8 100755 --- a/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst +++ b/doc/source/tech_note/Photosynthetic_Capacity/CLM50_Tech_Note_Photosynthetic_Capacity.rst @@ -136,6 +136,10 @@ and :math:`\text{LMA}` is the inverse of specific leaf area at the canopy top (: +----------------------------------+--------------------------+--------------------------+ | Tropical Soybean | 0.0350 | 0.4102 | +----------------------------------+--------------------------+--------------------------+ + | Miscanthus | 0.0570 | 0.2930 | + +----------------------------------+--------------------------+--------------------------+ + | Switchgrass | 0.0490 | 0.2930 | + +----------------------------------+--------------------------+--------------------------+ Notes: :math:`SLA_{\text{0}}` is the specific leaf area at the canopy top (m :sup:`2` leaf/g biomass), and :math:`N_{\text{cb}}` is the fraction of leaf nitrogen in Rubisco (g N in Rubisco g :sup:`-1` N) diff --git a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst index 88d09d18a5..f33a6d96b5 100644 --- a/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst +++ b/doc/source/tech_note/Plant_Hydraulics/CLM50_Tech_Note_Plant_Hydraulics.rst @@ -93,6 +93,14 @@ distribution parameter adopted from :ref:`Jackson et al. (1996) +----------------------------------+------------------+ | Soybean I | 0.943 | +----------------------------------+------------------+ + | Miscanthus R | 0.943 | + +----------------------------------+------------------+ + | Miscanthus I | 0.943 | + +----------------------------------+------------------+ + | Switchgrass R | 0.943 | + +----------------------------------+------------------+ + | Switchgrass I | 0.943 | + +----------------------------------+------------------+ .. _Root Spacing: diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index f5ffc26b95..387d2e0a0d 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -274,6 +274,14 @@ Cao, M., Marshall, S. and Gregson, K., 1996. Global carbon exchange and methane emissions from natural wetlands: Application of a process-based model. J. Geophys. Res. 101(D9):14,399-14,414. +.. _Chengetal2019: + +Cheng, Y., Huang, M., et al., 2019. Parameterizing perennial bioenergy +crops in Version 5 of the Community Land Model Based on Site‐Level +Observations in the Central Midwestern United States. +Journal of Advances in Modeling Earth Systems, +2(2013), 1–24. https://doi.org/10.1029/2019MS001719 + .. _Chuangetal2006: Chuang Y.L., Oren R., Bertozzi A.L, Phillips N., Katul G.G. 2006. The diff --git a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst index 2770917358..36bebbe56f 100644 --- a/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst +++ b/doc/source/tech_note/Surface_Albedos/CLM50_Tech_Note_Surface_Albedos.rst @@ -485,6 +485,10 @@ intercepted snow (:numref:`Table Intercepted snow optical properties`) are from +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ | Tropical Soybean | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Miscanthus | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ + | Switchgrass | -0.50 | 0.11 | 0.35 | 0.31 | 0.53 | 0.05 | 0.34 | 0.120 | 0.250 | + +----------------------------------+----------------------+---------------------------------+---------------------------------+---------------------------------+---------------------------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+ .. _Table Intercepted snow optical properties: diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index 7ede3405e0..775494c300 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -5,8 +5,8 @@ Vegetation Phenology and Turnover The CLM phenology model consists of several algorithms controlling the transfer of stored carbon and nitrogen out of storage pools for the -display of new growth and into litter pools for losses of displayed -growth. PFTs are classified into three distinct phenological types that +display of new growth, into litter pools for losses of displayed +growth, and into biofuel pools for bioenergy. PFTs are classified into three distinct phenological types that are represented by separate algorithms: an evergreen type, for which some fraction of annual leaf growth persists in the displayed pool for longer than one year; a seasonal-deciduous type with a single growing @@ -132,12 +132,16 @@ periods as: .. math:: :label: 20.14) - CF_{leaf,litter}^{n} =\left\{\begin{array}{l} {CF_{leaf,litter}^{n-1} +r_{xfer\_ off} \left(CS_{leaf} -CF_{leaf,litter}^{n-1} {\kern 1pt} t_{offset} \right)\qquad {\rm for\; }t_{offset} \ne \Delta t} \\ {\left({CS_{leaf} \mathord{\left/ {\vphantom {CS_{leaf} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right)+CF_{alloc,leaf} \qquad \qquad \qquad \qquad {\rm for\; }t_{offset} =\Delta t} \end{array}\right. + CF_{leaf,litter}^{n} =\left\{\begin{array}{l} {CF_{leaf,litter}^{n-1} + r_{xfer\_ off} \left(CS_{leaf} -CF_{leaf,litter}^{n-1} {\kern 1pt} t_{offset} \right)\qquad {\rm for\; }t_{offset} \ne \Delta t} + \\ {\left({CS_{leaf} \mathord{\left/ {\vphantom {CS_{leaf} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right) + \left( 1-biofuel\_harvfrac \right) + +CF_{alloc,leaf} \qquad {\rm for\; }t_{offset} =\Delta t} \end{array}\right. .. math:: :label: 20.15) - CF_{froot,litter}^{n} =\left\{\begin{array}{l} {CF_{froot,litter}^{n-1} +r_{xfer\_ off} \left(CS_{froot} -CF_{froot,litter}^{n-1} {\kern 1pt} t_{offset} \right)\qquad {\rm for\; }t_{offset} \ne \Delta t} \\ {\left({CS_{froot} \mathord{\left/ {\vphantom {CS_{froot} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right)+CF_{alloc,\, froot} \qquad \qquad \qquad {\rm for\; }t_{offset} =\Delta t} \end{array}\right. + CF_{froot,litter}^{n} =\left\{\begin{array}{l} {CF_{froot,litter}^{n-1} + + r_{xfer\_ off} \left(CS_{froot} -CF_{froot,litter}^{n-1} {\kern 1pt} t_{offset} \right)\qquad {\rm for\; }t_{offset} \ne \Delta t} \\ {\left({CS_{froot} \mathord{\left/ {\vphantom {CS_{froot} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right)+CF_{alloc,\, froot} \qquad \qquad \qquad {\rm for\; }t_{offset} =\Delta t} \end{array}\right. .. math:: :label: 20.16) @@ -146,10 +150,14 @@ periods as: where superscripts *n* and *n-1* refer to fluxes on the current and previous timesteps, respectively. The rate coefficient :math:`{r}_{xfer\_off}` varies with time to produce a linearly -increasing litterfall rate throughout the offset period, and the special -case for fluxes in the final litterfall timestep -(:math:`{t}_{offset}` = :math:`\Delta t`\ ) ensures that all of the -displayed growth is sent to the litter pools for deciduous plant types. +increasing litterfall rate throughout the offset period. +The :math:`biofuel\_harvfrac` (:numref:`Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy crops`) +is the harvested fraction of aboveground biomass (leaf & livestem) for bioenergy crops. It is only non-zero for prognostic crops. +The special case for fluxes in the final litterfall timestep +(:math:`{t}_{offset}` = :math:`\Delta t`\ ) ensures that a fraction (:math:`1-biofuel\_harvfrac`) of the +displayed growth is sent to the litter pools for deciduous plant types, while the remaining fraction (:math:`biofuel\_harvfrac`) +of leaf biomass goes to the biofuel feedstock pools (Equation :eq:`25.9`). Modifications on livestem carbon pools can be found +in section :numref:`Harvest to food and seed` in Equations :eq:`25.9`-:eq:`25.14`. Corresponding nitrogen fluxes during litterfall take into account retranslocation of nitrogen out of the displayed leaf pool prior to litterfall (:math:`{NF}_{leaf,retrans}`, gN m\ :sup:`-2` s\ :sup:`-1`). Retranslocation of nitrogen out of fine roots is From e5591e81699d61285addaf969a09cefeddab623b Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Wed, 15 Apr 2020 20:05:29 -0700 Subject: [PATCH 0793/1973] add documents for changes relevant to bioenergy crops --- .../CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index 775494c300..110883ff48 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -6,7 +6,7 @@ Vegetation Phenology and Turnover The CLM phenology model consists of several algorithms controlling the transfer of stored carbon and nitrogen out of storage pools for the display of new growth, into litter pools for losses of displayed -growth, and into biofuel pools for bioenergy. PFTs are classified into three distinct phenological types that +growth, and into biofuel feedstock pools for bioenergy. PFTs are classified into three distinct phenological types that are represented by separate algorithms: an evergreen type, for which some fraction of annual leaf growth persists in the displayed pool for longer than one year; a seasonal-deciduous type with a single growing From 52bd548aea0252308e08f56c5d05181538797be1 Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Wed, 15 Apr 2020 20:07:24 -0700 Subject: [PATCH 0794/1973] add documents for changes relevant to bioenergy crops --- .../CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index 110883ff48..0d6576d0c7 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -156,8 +156,8 @@ is the harvested fraction of aboveground biomass (leaf & livestem) for bioenergy The special case for fluxes in the final litterfall timestep (:math:`{t}_{offset}` = :math:`\Delta t`\ ) ensures that a fraction (:math:`1-biofuel\_harvfrac`) of the displayed growth is sent to the litter pools for deciduous plant types, while the remaining fraction (:math:`biofuel\_harvfrac`) -of leaf biomass goes to the biofuel feedstock pools (Equation :eq:`25.9`). Modifications on livestem carbon pools can be found -in section :numref:`Harvest to food and seed` in Equations :eq:`25.9`-:eq:`25.14`. +of leaf biomass goes to the biofuel feedstock pools (Equation :eq:`25.9`). Modifications on livestem carbon pools for prognostic crops +can be found in section :numref:`Harvest to food and seed` in Equations :eq:`25.9`-:eq:`25.14`. Corresponding nitrogen fluxes during litterfall take into account retranslocation of nitrogen out of the displayed leaf pool prior to litterfall (:math:`{NF}_{leaf,retrans}`, gN m\ :sup:`-2` s\ :sup:`-1`). Retranslocation of nitrogen out of fine roots is From 6ba026c04ad1a15b5a5a3675c9059995e218a7c8 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sun, 19 Apr 2020 19:48:39 -0600 Subject: [PATCH 0795/1973] Gridcell-level error check for carbon Initial mods to get things set up --- src/biogeochem/CNBalanceCheckMod.F90 | 110 +++++++++++++++++++--- src/biogeochem/CNVegCarbonStateType.F90 | 3 + src/biogeochem/CNVegNitrogenStateType.F90 | 6 +- src/biogeochem/CNVegetationFacade.F90 | 75 +++++++++++++++ src/main/clm_driver.F90 | 22 +++++ 5 files changed, 201 insertions(+), 15 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index b9a5355d46..a9dfc8b6bc 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -29,10 +29,14 @@ module CNBalanceCheckMod ! !PUBLIC TYPES: type, public :: cn_balance_type private - real(r8), pointer :: begcb_col(:) ! (gC/m2) carbon mass, beginning of time step - real(r8), pointer :: endcb_col(:) ! (gC/m2) carbon mass, end of time step - real(r8), pointer :: begnb_col(:) ! (gN/m2) nitrogen mass, beginning of time step - real(r8), pointer :: endnb_col(:) ! (gN/m2) nitrogen mass, end of time step + real(r8), pointer :: begcb_col(:) ! (gC/m2) column carbon mass, beginning of time step + real(r8), pointer :: endcb_col(:) ! (gC/m2) column carbon mass, end of time step + real(r8), pointer :: begnb_col(:) ! (gN/m2) column nitrogen mass, beginning of time step + real(r8), pointer :: endnb_col(:) ! (gN/m2) column nitrogen mass, end of time step + real(r8), pointer :: begcb_grc(:) ! (gC/m2) gridcell carbon mass, beginning of time step + real(r8), pointer :: endcb_grc(:) ! (gC/m2) gridcell carbon mass, end of time step + real(r8), pointer :: begnb_grc(:) ! (gN/m2) gridcell nitrogen mass, beginning of time step + real(r8), pointer :: endnb_grc(:) ! (gN/m2) gridcell nitrogen mass, end of time step contains procedure , public :: Init procedure , public :: BeginCNBalance @@ -62,6 +66,14 @@ subroutine InitAllocate(this, bounds) type(bounds_type) , intent(in) :: bounds integer :: begc, endc + integer :: begg, endg + + begg = bounds%begg; endg = bounds%endg + + allocate(this%begcb_grc(begg:endg)) ; this%begcb_grc(:) = nan + allocate(this%endcb_grc(begg:endg)) ; this%endcb_grc(:) = nan + allocate(this%begnb_grc(begg:endg)) ; this%begnb_grc(:) = nan + allocate(this%endnb_grc(begg:endg)) ; this%endnb_grc(:) = nan begc = bounds%begc; endc= bounds%endc @@ -76,9 +88,15 @@ subroutine BeginCNBalance(this, bounds, num_soilc, filter_soilc, & cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) ! ! !DESCRIPTION: - ! Calculate beginning column-level carbon/nitrogen balance, for mass conservation check + ! Calculate beginning gridcell and column-level carbon/nitrogen balance + ! for mass conservation check ! - ! Should be called after the CN state summaries have been computed for this time step + ! Gridcell level: + ! Should be called after CN state summaries have been computed + ! and before the dynamic landunit area updates + ! + ! Column level: + ! Should be called after CN state summaries have been recomputed for this time step ! (which should be after the dynamic landunit area updates and the associated filter ! updates - i.e., using the new version of the filters) ! @@ -92,11 +110,17 @@ subroutine BeginCNBalance(this, bounds, num_soilc, filter_soilc, & ! ! !LOCAL VARIABLES: integer :: fc,c + integer :: g + integer :: begg, endg !----------------------------------------------------------------------- associate( & - col_begcb => this%begcb_col , & ! Output: [real(r8) (:)] (gC/m2) carbon mass, beginning of time step - col_begnb => this%begnb_col , & ! Output: [real(r8) (:)] (gN/m2) nitrogen mass, beginning of time step + grc_begcb => this%begcb_grc , & ! Output: [real(r8) (:)] (gC/m2) gridcell carbon mass, beginning of time step + grc_begnb => this%begnb_grc , & ! Output: [real(r8) (:)] (gN/m2) gridcell nitrogen mass, beginning of time step +! totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool +! totgrcn => cnveg_nitrogenstate_inst%totn_grc, & ! Input: [real(r8) (:)] (gN/m2) total gridcell nitrogen, incl veg + col_begcb => this%begcb_col , & ! Output: [real(r8) (:)] (gC/m2) column carbon mass, beginning of time step + col_begnb => this%begnb_col , & ! Output: [real(r8) (:)] (gN/m2) column nitrogen mass, beginning of time step totcolc => cnveg_carbonstate_inst%totc_col , & ! Input: [real(r8) (:)] (gC/m2) total column carbon, incl veg and cpool totcoln => cnveg_nitrogenstate_inst%totn_col & ! Input: [real(r8) (:)] (gN/m2) total column nitrogen, incl veg ) @@ -107,6 +131,13 @@ subroutine BeginCNBalance(this, bounds, num_soilc, filter_soilc, & col_begnb(c) = totcoln(c) end do + begg = bounds%begg; endg = bounds%endg + + do g = begg, endg + grc_begcb(g) = 0._r8 ! TODO Add gridcell terms not accted at col level + grc_begnb(g) = 0._r8 ! TODO Add gridcell terms not accted at col level + end do + end associate end subroutine BeginCNBalance @@ -115,6 +146,9 @@ end subroutine BeginCNBalance subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & soilbiogeochem_carbonflux_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst) ! + ! !USES: + use subgridAveMod, only: c2g + ! ! !DESCRIPTION: ! Perform carbon mass conservation check for column and patch ! @@ -128,16 +162,20 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst ! ! !LOCAL VARIABLES: - integer :: c,err_index ! indices + integer :: c, g, err_index ! indices integer :: fc ! lake filter indices logical :: err_found ! error flag real(r8) :: dt ! radiation time step (seconds) - real(r8) :: col_cinputs - real(r8) :: col_coutputs + real(r8) :: col_cinputs, grc_cinputs + real(r8) :: col_coutputs, grc_coutputs real(r8) :: col_errcb(bounds%begc:bounds%endc) + real(r8) :: grc_errcb(bounds%begg:bounds%endg) !----------------------------------------------------------------------- associate( & + grc_begcb => this%begcb_grc , & ! Input: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, beginning of time step + grc_endcb => this%endcb_grc , & ! Output: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, end of time step +! totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool col_begcb => this%begcb_col , & ! Input: [real(r8) (:) ] (gC/m2) carbon mass, beginning of time step col_endcb => this%endcb_col , & ! Output: [real(r8) (:) ] (gC/m2) carbon mass, end of time step wood_harvestc => cnveg_carbonflux_inst%wood_harvestc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) wood harvest (to product pools) @@ -191,7 +229,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & err_index = c end if if (abs(col_errcb(c)) > 1e-8_r8) then - write(iulog,*) 'cbalance warning',c,col_errcb(c),col_endcb(c) + write(iulog,*) 'cbalance warning at c =', c, col_errcb(c), col_endcb(c) end if @@ -217,6 +255,54 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & call endrun(msg=errMsg(sourcefile, __LINE__)) end if + ! Repeat error check at the gridcell level + ! The column-level error gets added to the gridcel-level error below + call c2g( bounds = bounds, & + carr = col_errcb(bounds%begc:bounds%endc), & + garr = grc_errcb(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + + err_found = .false. + do g = bounds%begg, bounds%endg + ! calculate gridcell-level carbon storage for mass conservation check + grc_endcb(g) = 0._r8 ! TODO Add gridcell terms not accted at col level + + ! calculate total gridcell-level inputs + grc_cinputs = 0._r8 ! TODO Add gridcell terms not accted at col level + + ! calculate total gridcell-level outputs + grc_coutputs = 0._r8 ! TODO Add gridcell terms not accted at col level + + ! calculate the total gridcell-level carbon balance error + ! for this time step + grc_errcb(g) = (grc_cinputs - grc_coutputs) * dt - & + (grc_endcb(g) - grc_begcb(g)) + grc_errcb(g) + + ! check for significant errors + if (abs(grc_errcb(g)) > 1e-7_r8) then + err_found = .true. + err_index = g + end if + if (abs(grc_errcb(g)) > 1e-8_r8) then + write(iulog,*) 'cbalance warning at g =', g, grc_errcb(g), grc_endcb(g) + end if + end do ! end of gridcell loop + + if (err_found) then + g = err_index + write(iulog,*)'gridcell cbalance error =', grc_errcb(g), g + write(iulog,*)'latdeg, londeg =', grc%latdeg(g), grc%londeg(g) + write(iulog,*)'begcb =', grc_begcb(g) + write(iulog,*)'endcb =', grc_endcb(g) + write(iulog,*)'delta store =', grc_endcb(g) - grc_begcb(g) + write(iulog,*)'--- Inputs ---' + write(iulog,*)'??? =', 0 + write(iulog,*)'--- Outputs ---' + write(iulog,*)'??? =', 0 + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + end associate end subroutine CBalanceCheck diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index 133f4c17fe..0963be20c8 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -82,6 +82,7 @@ module CNVegCarbonStateType real(r8), pointer :: totc_p2c_col (:) ! (gC/m2) totc_patch averaged to col real(r8), pointer :: totc_col (:) ! (gC/m2) total column carbon, incl veg and cpool real(r8), pointer :: totecosysc_col (:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool +! real(r8), pointer :: totc_grc (:) ! (gC/m2) total gridcell carbon contains @@ -263,6 +264,7 @@ subroutine InitAllocate(this, bounds) allocate(this%totc_p2c_col (begc:endc)) ; this%totc_p2c_col (:) = nan allocate(this%totc_col (begc:endc)) ; this%totc_col (:) = nan allocate(this%totecosysc_col (begc:endc)) ; this%totecosysc_col (:) = nan +! allocate(this%totc_grc (begg:endg)) ; this%totc_grc (:) = nan end subroutine InitAllocate @@ -998,6 +1000,7 @@ subroutine InitCold(this, bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst do g = bounds%begg, bounds%endg this%seedc_grc(g) = 0._r8 +! this%totc_grc(g) = 0._r8 end do ! initialize fields for special filters diff --git a/src/biogeochem/CNVegNitrogenStateType.F90 b/src/biogeochem/CNVegNitrogenStateType.F90 index 216d1c0d5d..455a72ffb7 100644 --- a/src/biogeochem/CNVegNitrogenStateType.F90 +++ b/src/biogeochem/CNVegNitrogenStateType.F90 @@ -71,6 +71,7 @@ module CNVegNitrogenStateType real(r8), pointer :: totn_p2c_col (:) ! (gN/m2) totn_patch averaged to col real(r8), pointer :: totn_col (:) ! (gN/m2) total column nitrogen, incl veg real(r8), pointer :: totecosysn_col (:) ! (gN/m2) total ecosystem nitrogen, incl veg +! real(r8), pointer :: totn_grc (:) ! (gN/m2) total gridcell nitrogen contains @@ -166,6 +167,7 @@ subroutine InitAllocate(this, bounds) allocate(this%totn_p2c_col (begc:endc)) ; this%totn_p2c_col (:) = nan allocate(this%totn_col (begc:endc)) ; this%totn_col (:) = nan allocate(this%totecosysn_col (begc:endc)) ; this%totecosysn_col (:) = nan +! allocate(this%totn_grc (begg:endg)) ; this%totn_grc (:) = nan end subroutine InitAllocate @@ -510,6 +512,7 @@ subroutine InitCold(this, bounds, & do g = bounds%begg, bounds%endg this%seedn_grc(g) = 0._r8 +! this%totn_grc(g) = 0._r8 end do ! now loop through special filters and explicitly set the variables that @@ -1051,9 +1054,6 @@ subroutine Summary_nitrogenstate(this, bounds, num_allc, filter_allc, & soilbiogeochem_nitrogenstate_inst%ntrunc_col(c) end do - - - end subroutine Summary_nitrogenstate diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 4327a4e7ce..60727f68f8 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -162,6 +162,7 @@ module CNVegetationFacade procedure, public :: UpdateSubgridWeights ! Update subgrid weights if running with prognostic patch weights procedure, public :: DynamicAreaConservation ! Conserve C & N with updates in subgrid weights procedure, public :: InitColumnBalance ! Set the starting point for col-level balance checks + procedure, public :: InitGridcellBalance ! Set the starting point for gridcell-level balance checks procedure, public :: EcosystemDynamicsPreDrainage ! Do the main science that needs to be done before hydrology-drainage procedure, public :: EcosystemDynamicsPostDrainage ! Do the main science that needs to be done after hydrology-drainage procedure, public :: BalanceCheck ! Check the carbon and nitrogen balance @@ -780,6 +781,80 @@ subroutine InitColumnBalance(this, bounds, num_allc, filter_allc, & end subroutine InitColumnBalance + !----------------------------------------------------------------------- + subroutine InitGridcellBalance(this, bounds, num_allc, filter_allc, & + num_soilc, filter_soilc, num_soilp, filter_soilp, & + soilbiogeochem_carbonstate_inst, & + c13_soilbiogeochem_carbonstate_inst, & + c14_soilbiogeochem_carbonstate_inst, & + soilbiogeochem_nitrogenstate_inst) + ! + ! !DESCRIPTION: + ! Set the starting point for gridcell-level balance checks. + ! + ! Gridcell level: + ! Called before DynamicAreaConservation. + ! + ! !USES: + use subgridAveMod, only : c2g + ! + ! !ARGUMENTS: + class(cn_vegetation_type) , intent(inout) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_allc ! number of columns in allc filter + integer , intent(in) :: filter_allc(:) ! filter for all active columns + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst + type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst + type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst + type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'InitGridcellBalance' + !----------------------------------------------------------------------- + + call CNDriverSummarizeStates(bounds, & + num_allc, filter_allc, & + num_soilc, filter_soilc, & + num_soilp, filter_soilp, & + this%cnveg_carbonstate_inst, & + this%c13_cnveg_carbonstate_inst, & + this%c14_cnveg_carbonstate_inst, & + this%cnveg_nitrogenstate_inst, & + soilbiogeochem_carbonstate_inst, & + c13_soilbiogeochem_carbonstate_inst, & + c14_soilbiogeochem_carbonstate_inst, & + soilbiogeochem_nitrogenstate_inst) + +! ! total gridcell carbon (TOTGRIDCELLC) +! call c2g( bounds = bounds, & +! carr = this%cnveg_carbonstate_inst%totc_col(bounds%begc:bounds%endc), & +! garr = this%cnveg_carbonstate_inst%totc_grc(bounds%begg:bounds%endg), & +! c2l_scale_type = 'unity', & +! l2g_scale_type = 'unity') +! ! total gridcell nitrogen (TOTGRIDCELLN) +! call c2g( bounds = bounds, & +! carr = this%cnveg_nitrogenstate_inst%totn_col(bounds%begc:bounds%endc), & +! garr = this%cnveg_nitrogenstate_inst%totn_grc(bounds%begg:bounds%endg), & +! c2l_scale_type = 'unity', & +! l2g_scale_type = 'unity') + + ! TODO In next call, + ! add to totc_grc & totn_grc the gridcell terms not accted at col level + ! OR add them to zero and start from the column-level error in CBalanceCheck + ! If the latter, then prob. need BeginCNGridcellBalance separate from Column + + call this%cn_balance_inst%BeginCNBalance( & + bounds, num_soilc, filter_soilc, & + this%cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst) + + end subroutine InitGridcellBalance + + !----------------------------------------------------------------------- subroutine EcosystemDynamicsPreDrainage(this, bounds, & num_soilc, filter_soilc, & diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index f931d3ee40..54d4b77f6c 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -298,6 +298,27 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro !$OMP END PARALLEL DO end if + !$OMP PARALLEL DO PRIVATE (nc,bounds_clump) + do nc = 1,nclumps + call get_clump_bounds(nc, bounds_clump) + + call t_startf('begcnbal_grc') + if (use_cn) then + ! Initialize gridcell-level balance check + call bgc_vegetation_inst%InitGridcellBalance(bounds_clump, & + filter(nc)%num_allc, filter(nc)%allc, & + filter(nc)%num_soilc, filter(nc)%soilc, & + filter(nc)%num_soilp, filter(nc)%soilp, & + soilbiogeochem_carbonstate_inst, & + c13_soilbiogeochem_carbonstate_inst, & + c14_soilbiogeochem_carbonstate_inst, & + soilbiogeochem_nitrogenstate_inst) + end if + call t_stopf('begcnbal_grc') + + end do + !$OMP END PARALLEL DO + ! ============================================================================ ! Update subgrid weights with dynamic landcover (prescribed transient patches, ! CNDV, and or dynamic landunits), and do related adjustments. Note that this @@ -345,6 +366,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_startf('begcnbal_col') if (use_cn) then + ! Initialize column-level balance check call bgc_vegetation_inst%InitColumnBalance(bounds_clump, & filter(nc)%num_allc, filter(nc)%allc, & filter(nc)%num_soilc, filter(nc)%soilc, & From 017759d00377f423d8cd99770e08563c1f3d92db Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 21 Apr 2020 09:43:24 -0600 Subject: [PATCH 0796/1973] separate use_biomass_heat_storage case --- src/biogeophys/CanopyFluxesMod.F90 | 178 +++++++++++++++-------------- 1 file changed, 93 insertions(+), 85 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 06e9b4c3cc..99fa862d6b 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -407,6 +407,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: dbh(bounds%begp:bounds%endp) !diameter at breast height of vegetation real(r8) :: cp_veg(bounds%begp:bounds%endp) !heat capacity of veg real(r8) :: cp_stem(bounds%begp:bounds%endp) !heat capacity of stems + real(r8) :: rstema(bounds%begp:bounds%endp) !stem resistance to heat transfer real(r8) :: dt_stem(bounds%begp:bounds%endp) !change in stem temperature real(r8) :: fstem(bounds%begp:bounds%endp) !fraction of stem real(r8) :: lw_stem(bounds%begp:bounds%endp) !internal longwave stem @@ -417,7 +418,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed real(r8) :: cp_wood real(r8) :: carea_stem - real(r8) :: rstema + ! biomass parameters real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume @@ -578,7 +579,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ulrad => energyflux_inst%ulrad_patch , & ! Output: [real(r8) (:) ] upward longwave radiation above the canopy [W/m2] cgrnd => energyflux_inst%cgrnd_patch , & ! Output: [real(r8) (:) ] deriv. of soil energy flux wrt to soil temp [w/m2/k] eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Output: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] - eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from surface water (W/m**2) [+ to atm] + eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] eflx_sh_veg => energyflux_inst%eflx_sh_veg_patch , & ! Output: [real(r8) (:) ] sensible heat flux from leaves (W/m**2) [+ to atm] @@ -683,77 +684,82 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, do f = 1, fn p = filterp(f) - ! fraction of stem receiving incoming radiation - fstem(p) = (esai(p))/(elai(p)+esai(p)) - ! when elai = 0, do not multiply by k_vert (i.e. fstem = 1) - if(elai(p) > 0._r8) fstem(p) = k_vert * fstem(p) + if(use_biomass_heat_storage) then - ! if using Satellite Phenology mode, use values in parameter file - ! otherwise calculate dbh from stem biomass - if(.not. use_cn .or. .not. use_biomass_heat_storage) then - dbh(p) = dbh_param(patch%itype(p)) - else - dbh(p) = 2._r8 * sqrt(stem_biomass(p) * (1._r8 - fbw(patch%itype(p))) / ( shr_const_pi * htop(p) * k_cyl_vol & - * nstem(patch%itype(p)) * wood_density(patch%itype(p)))) - endif + ! fraction of stem receiving incoming radiation + fstem(p) = (esai(p))/(elai(p)+esai(p)) - ! leaf and stem surface area - sa_leaf(p) = elai(p) -! double in spirit of full surface area for sensible heat - sa_leaf(p) = 2.*sa_leaf(p) + ! when elai = 0, do not multiply by k_vert (i.e. fstem = 1) + if(elai(p) > 0._r8) fstem(p) = k_vert * fstem(p) - sa_stem(p) = nstem(patch%itype(p))*(htop(p)*shr_const_pi*dbh(p)) -! adjust for departure of cylindrical stem model - sa_stem(p) = k_cyl_area * sa_stem(p) + ! if using Satellite Phenology mode, use values in parameter file + ! otherwise calculate dbh from stem biomass + if(use_cn) then + dbh(p) = 2._r8 * sqrt(stem_biomass(p) * (1._r8 - fbw(patch%itype(p))) & + / ( shr_const_pi * htop(p) * k_cyl_vol & + * nstem(patch%itype(p)) * wood_density(patch%itype(p)))) + else + dbh(p) = dbh_param(patch%itype(p)) + endif - ! do not calculate separate leaf/stem heat capacity for grasses - if(patch%itype(p) > 11 .or. dbh(p) < min_stem_diameter) then - fstem(p) = 0.0 - sa_stem(p) = 0.0 - endif + ! leaf and stem surface area + sa_leaf(p) = elai(p) + ! double in spirit of full surface area for sensible heat + sa_leaf(p) = 2.*sa_leaf(p) + + sa_stem(p) = nstem(patch%itype(p))*(htop(p)*shr_const_pi*dbh(p)) + ! adjust for departure of cylindrical stem model + sa_stem(p) = k_cyl_area * sa_stem(p) - if(.not.use_biomass_heat_storage) then - fstem(p) = 0._r8 + ! do not calculate separate leaf/stem heat capacity for grasses + ! or other pfts if dbh is below minimum value + if(patch%itype(p) > 11 .or. dbh(p) < min_stem_diameter) then + fstem(p) = 0.0 + sa_stem(p) = 0.0 + endif + + ! cross-sectional area of stems + carea_stem = shr_const_pi * (dbh(p)*0.5)**2 + + ! if using Satellite Phenology mode, calculate leaf and stem biomass + if(.not. use_cn) then + ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) + leaf_biomass(p) = 0.25_r8 * max(0.01_r8, sa_leaf(p)) & + / (1.-fbw(patch%itype(p))) + stem_biomass(p) = carea_stem * htop(p) * k_cyl_vol & + * nstem(patch%itype(p)) * wood_density(patch%itype(p)) & + /(1.-fbw(patch%itype(p))) + endif + + ! internal longwave fluxes between leaf and stem + ! (use same area of interaction i.e. ignore leaf <-> leaf) + sa_internal(p) = min(sa_leaf(p),sa_stem(p)) + sa_internal(p) = k_internal * sa_internal(p) + + ! calculate specify heat capacity of vegetation + ! as weighted averaged of dry biomass and water + ! lma_dry has units of kg dry mass/m2 here (table 2 of bonan 2017) + ! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K + cp_veg(p) = leaf_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) + + ! cp-stem will have units J/k/ground_area + cp_stem(p) = stem_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) + ! adjust for departure from cylindrical stem model + cp_stem(p) = k_cyl_vol * cp_stem(p) + + ! resistance between internal stem temperature and canopy air + rstema(p) = rstem(patch%itype(p))*dbh(p) + else + ! use_biomass_heat_storage .false. + fstem(p) = 0._r8 sa_stem(p) = 0._r8 sa_leaf(p) = (elai(p)+esai(p)) - endif - - ! cross-sectional area of stems - carea_stem = shr_const_pi * (dbh(p)*0.5)**2 - - ! if using Satellite Phenology mode, calculate leaf and stem - ! biomass - if(.not. use_cn) then - ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) - leaf_biomass(p) = 0.25_r8 * max(0.01_r8, sa_leaf(p)) & - / (1.-fbw(patch%itype(p))) - stem_biomass(p) = carea_stem * htop(p) * k_cyl_vol & - * nstem(patch%itype(p)) * wood_density(patch%itype(p)) & - /(1.-fbw(patch%itype(p))) - endif - -! internal longwave fluxes between leaf and stem -! surface area term must be equal, remainder cancels -! (use same area of interaction i.e. ignore leaf <-> leaf) - sa_internal(p) = min(sa_leaf(p),sa_stem(p)) - sa_internal(p) = k_internal * sa_internal(p) - -! calculate specify heat capacity of vegetation -! as weighted averaged of dry biomass and water -! lma_dry has units of kg dry mass /m2 here (table 2 of bonan 2017) -! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K - cp_veg(p) = leaf_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) - -! use non-zero, but small, heat capacity - if(.not.use_biomass_heat_storage) then + sa_internal(p) = 0._r8 cp_veg(p) = 0._r8 + cp_stem(p) = 0._r8 + rstema(p) = 0._r8 endif - -! cp-stem will have units J/k/ground_area - cp_stem(p) = stem_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) - -! adjust for departure from cylindrical stem model - cp_stem(p) = k_cyl_vol * cp_stem(p) + enddo ! calculate daylength control for Vcmax @@ -984,20 +990,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ri = ( grav*htop(p) * (taf(p) - t_grnd(c)) ) / (taf(p) * uaf(p) **2.00_r8) - !! modify csoilc value (0.004) if the under-canopy is in stable condition - - if (use_undercanopy_stability .and. (taf(p) - t_grnd(c) ) > 0._r8) then - ! decrease the value of csoilc by dividing it with (1+gamma*min(S, 10.0)) - ! ria ("gmanna" in Sakaguchi&Zeng, 2008) is a constant (=0.5) - ricsoilc = params_inst%csoilc / (1.00_r8 + ria*min( ri, 10.0_r8) ) - csoilcn = csoilb*w + ricsoilc*(1._r8-w) - else - csoilcn = csoilb*w + params_inst%csoilc*(1._r8-w) - end if + csoilcn = csoilb*w + params_inst%csoilc*(1._r8-w) !! Sakaguchi changes for stability formulation ends here - if (use_biomass_heat_storage) then + if (use_undercanopy_stability) then ! use uuc for ground fluxes (keep uaf for canopy terms) rah(p,2) = 1._r8/(csoilcn*uuc(p)) else @@ -1079,14 +1076,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Sensible heat conductance for air, leaf and ground ! Moved the original subroutine in-line... - wta = 1._r8/rah(p,1) ! air + wta = 1._r8/rah(p,1) ! air wtl = sa_leaf(p)/rb(p) ! leaf - wtg(p) = 1._r8/rah(p,2) ! ground - ! wtstem = sa_stem(p)/rb(p) ! stem - ! add resistance between internal stem temperature and canopy air - rstema = rstem(patch%itype(p))*dbh(p) - - wtstem = sa_stem(p)/(rstema + rb(p)) ! stem + wtg(p) = 1._r8/rah(p,2) ! ground + wtstem = sa_stem(p)/(rstema(p) + rb(p)) ! stem wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) @@ -1099,9 +1092,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, wtal(p) = wta0(p)+wtl0(p)+wtstem0(p) ! air + leaf + stem ! internal longwave fluxes between leaf and stem - lw_stem(p) = sa_internal(p) * emv(p) * sb*t_stem(p)**4 - lw_leaf(p) = sa_internal(p) * emv(p) * sb*t_veg(p)**4 - + lw_stem(p) = sa_internal(p) * emv(p) * sb * t_stem(p)**4 + lw_leaf(p) = sa_internal(p) * emv(p) * sb * t_veg(p)**4 + ! Fraction of potential evaporation from leaf if (fdry(p) > 0._r8) then @@ -1115,6 +1108,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, canopy_cond(p) = (laisun(p)/(rb(p)+rssun(p)) + laisha(p)/(rb(p)+rssha(p)))/max(elai(p), 0.01_r8) end if +! should be the same expression used in Photosynthesis/getqflx +!scs efpot = forc_rho(c)*elai(p)/rb(p)*(qsatl(p)-qaf(p)) efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p)*(qsatl(p)-qaf(p)) h2ocan = liqcan(p) + snocan(p) @@ -1157,6 +1152,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Moved the original subroutine in-line... wtaq = frac_veg_nosno(p)/raw(p,1) ! air +!scs wtlq = frac_veg_nosno(p)*elai(p)/rb(p) * rpp ! leaf wtlq = frac_veg_nosno(p)*(elai(p)+esai(p))/rb(p) * rpp ! leaf !Litter layer resistance. Added by K.Sakaguchi @@ -1237,6 +1233,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! result in an imbalance in "hvap*qflx_evap_veg" and ! "efe + dc2*wtgaq*qsatdt_veg" +!scs efpot = forc_rho(c)*elai(p)/rb(p) & efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p) & *(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) @@ -1366,6 +1363,17 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, - lw_leaf(p) + lw_stem(p) - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) & - ((t_veg(p)-tl_ini(p))*cp_veg(p)/dtime) + !scs +! if (abs(err(p)) > 1e6) then +! write(iulog,*) 'canerrchk: ', lw_leaf(p), lw_stem(p), dt_veg(p) +! write(iulog,*) 'canerrchk: ', (1.-fstem(p))*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & +! *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd), & +! lw_leaf(p),lw_stem(p),eflx_sh_veg(p),hvap*qflx_evap_veg(p), & +! t_veg(p),tl_ini(p),dt_veg(p),cp_veg(p),cp_stem(p) +! endif + + + ! Update stem temperature; adjust outgoing longwave ! does not account for changes in SH or internal LW, ! as that would change result for t_veg above From 8b55f69f53fe6321d831e559caa0d37caf47a454 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 21 Apr 2020 11:19:23 -0600 Subject: [PATCH 0797/1973] Allow a custom tolerance for truncate_small_values This is the first step towards addressing ESCOMP/ctsm#988 --- src/utils/NumericsMod.F90 | 32 +++++++-- .../test_truncate_small_values.pf | 66 +++++++++++++++++++ 2 files changed, 94 insertions(+), 4 deletions(-) diff --git a/src/utils/NumericsMod.F90 b/src/utils/NumericsMod.F90 index 872ae75ebe..5f5caf9ad3 100644 --- a/src/utils/NumericsMod.F90 +++ b/src/utils/NumericsMod.F90 @@ -47,7 +47,8 @@ module NumericsMod contains !----------------------------------------------------------------------- - subroutine truncate_small_values(num_f, filter_f, lb, ub, data_baseline, data) + subroutine truncate_small_values(num_f, filter_f, lb, ub, data_baseline, data, & + custom_rel_epsilon) ! ! !DESCRIPTION: ! Truncate relatively small values to 0, within the given filter. @@ -66,10 +67,15 @@ subroutine truncate_small_values(num_f, filter_f, lb, ub, data_baseline, data) integer , intent(in) :: ub ! upper bound of data real(r8) , intent(in) :: data_baseline(lb:) ! baseline version of data, used to define "relatively close to 0" real(r8) , intent(inout) :: data(lb:) ! data to operate on + + ! If provided, custom_rel_epsilon overrides the module-level default rel_epsilon + ! value for the sake of determining if a value is "small". + real(r8), intent(in), optional :: custom_rel_epsilon ! ! !LOCAL VARIABLES: integer :: fn ! index into filter integer :: n ! index into data + real(r8) :: my_rel_epsilon character(len=*), parameter :: subname = 'truncate_small_values' !----------------------------------------------------------------------- @@ -77,9 +83,15 @@ subroutine truncate_small_values(num_f, filter_f, lb, ub, data_baseline, data) SHR_ASSERT_ALL_FL((ubound(data_baseline) == (/ub/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(data) == (/ub/)), sourcefile, __LINE__) + if (present(custom_rel_epsilon)) then + my_rel_epsilon = custom_rel_epsilon + else + my_rel_epsilon = rel_epsilon + end if + do fn = 1, num_f n = filter_f(fn) - if (abs(data(n)) < rel_epsilon * abs(data_baseline(n))) then + if (abs(data(n)) < my_rel_epsilon * abs(data_baseline(n))) then data(n) = 0._r8 end if end do @@ -87,7 +99,8 @@ subroutine truncate_small_values(num_f, filter_f, lb, ub, data_baseline, data) end subroutine truncate_small_values !----------------------------------------------------------------------- - subroutine truncate_small_values_one_lev(num_f, filter_f, lb, ub, lev_lb, lev, data_baseline, data) + subroutine truncate_small_values_one_lev(num_f, filter_f, lb, ub, lev_lb, lev, data_baseline, data, & + custom_rel_epsilon) ! ! !DESCRIPTION: ! Truncate relatively small values to 0, for one level of a multi-level field, within @@ -113,10 +126,15 @@ subroutine truncate_small_values_one_lev(num_f, filter_f, lb, ub, lev_lb, lev, d integer , intent(in) :: lev(lb:) ! for each point, which level to work on real(r8) , intent(in) :: data_baseline(lb:) ! baseline version of data, used to define "relatively close to 0" (note that this is only 1-d, giving baselines for the appropriate level for each point) real(r8) , intent(inout) :: data(lb:, lev_lb:) ! data to operate on + + ! If provided, custom_rel_epsilon overrides the module-level default rel_epsilon + ! value for the sake of determining if a value is "small". + real(r8), intent(in), optional :: custom_rel_epsilon ! ! !LOCAL VARIABLES: integer :: fn ! index into filter integer :: n ! index into data + real(r8) :: my_rel_epsilon character(len=*), parameter :: subname = 'truncate_small_values_one_lev' !----------------------------------------------------------------------- @@ -125,9 +143,15 @@ subroutine truncate_small_values_one_lev(num_f, filter_f, lb, ub, lev_lb, lev, d SHR_ASSERT_FL((ubound(data_baseline, 1) == ub), sourcefile, __LINE__) SHR_ASSERT_FL((ubound(data, 1) == ub), sourcefile, __LINE__) + if (present(custom_rel_epsilon)) then + my_rel_epsilon = custom_rel_epsilon + else + my_rel_epsilon = rel_epsilon + end if + do fn = 1, num_f n = filter_f(fn) - if (abs(data(n, lev(n))) < rel_epsilon * abs(data_baseline(n))) then + if (abs(data(n, lev(n))) < my_rel_epsilon * abs(data_baseline(n))) then data(n, lev(n)) = 0._r8 end if end do diff --git a/src/utils/test/numerics_test/test_truncate_small_values.pf b/src/utils/test/numerics_test/test_truncate_small_values.pf index 072bd62c59..e4673d5388 100644 --- a/src/utils/test/numerics_test/test_truncate_small_values.pf +++ b/src/utils/test/numerics_test/test_truncate_small_values.pf @@ -67,6 +67,38 @@ contains end subroutine tsv_truncates_correct_points + @Test + subroutine tsv_custom_tolerance_truncates_correct_points(this) + class(TestTSV), intent(inout) :: this + real(r8) :: data_baseline(3) + real(r8) :: data(3) + real(r8) :: data_saved(3) + integer :: num_f + integer, allocatable :: filter_f(:) + + call setup_n_veg_patches(pwtcol = [0.1_r8, 0.8_r8, 0.1_r8], pft_types = [1, 2, 3]) + call filter_from_range(bounds%begp, bounds%endp, num_f, filter_f) + + ! point 2 should be truncated, others should not be truncated + data_baseline = [1._r8, 1._r8, 1._r8] + data = [5.e-12_r8, 5.e-13_r8, 5.e-12_r8] + data_saved = data + + call truncate_small_values( & + num_f = num_f, & + filter_f = filter_f, & + lb = bounds%begp, & + ub = bounds%endp, & + data_baseline = data_baseline, & + data = data, & + custom_rel_epsilon = 1.e-12_r8) + + @assertEqual(data_saved(1), data(1)) + @assertEqual(data_saved(3), data(3)) + @assertEqual(0._r8, data(2)) + + end subroutine tsv_custom_tolerance_truncates_correct_points + @Test subroutine tsv_truncates_large_magnitude(this) ! Make sure we're just relying on relative rather than absolute magnitudes by @@ -159,6 +191,40 @@ contains end subroutine tsvol_truncates_correct_points + @Test + subroutine tsvol_custom_tolerance_truncates_correct_points(this) + class(TestTSV), intent(inout) :: this + real(r8) :: data_baseline(3) + real(r8) :: data(3,1) + real(r8) :: data_saved(3,1) + integer :: num_f + integer, allocatable :: filter_f(:) + + call setup_n_veg_patches(pwtcol = [0.1_r8, 0.8_r8, 0.1_r8], pft_types = [1, 2, 3]) + call filter_from_range(bounds%begp, bounds%endp, num_f, filter_f) + + ! point 2 should be truncated, others should not be truncated + data_baseline(:) = [1._r8, 1._r8, 1._r8] + data(:,1) = [5.e-12_r8, 5.e-13_r8, 5.e-12_r8] + data_saved = data + + call truncate_small_values_one_lev( & + num_f = num_f, & + filter_f = filter_f, & + lb = bounds%begp, & + ub = bounds%endp, & + lev_lb = 1, & + lev = [1,1,1], & + data_baseline = data_baseline, & + data = data, & + custom_rel_epsilon = 1.e-12_r8) + + @assertEqual(data_saved(1,1), data(1,1)) + @assertEqual(data_saved(3,1), data(3,1)) + @assertEqual(0._r8, data(2,1)) + + end subroutine tsvol_custom_tolerance_truncates_correct_points + @Test subroutine tsvol_truncates_large_magnitude(this) ! Make sure we're just relying on relative rather than absolute magnitudes by From eb01c70f93d635d535bebb056b67fa004101b5c7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 21 Apr 2020 11:22:12 -0600 Subject: [PATCH 0798/1973] Increase tolerance on near-zero truncation in UpdateState_TopLayerFluxes The tolerance of 1.e-13 was occasionally exceeded. Although I haven't done a careful analysis, it seems okay to me to increase this tolerance slightly. See ESCOMP/ctsm#988 for details. Resolves ESCOMP/ctsm#988 --- src/biogeophys/SnowHydrologyMod.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/SnowHydrologyMod.F90 b/src/biogeophys/SnowHydrologyMod.F90 index 8266c170bd..f02c5c7b0c 100644 --- a/src/biogeophys/SnowHydrologyMod.F90 +++ b/src/biogeophys/SnowHydrologyMod.F90 @@ -1163,7 +1163,8 @@ subroutine UpdateState_TopLayerFluxes(bounds, num_snowc, filter_snowc, & lev_lb = -nlevsno+1, & lev = lev_top(bounds%begc:bounds%endc), & data_baseline = h2osoi_ice_top_orig(bounds%begc:bounds%endc), & - data = h2osoi_ice(bounds%begc:bounds%endc, :)) + data = h2osoi_ice(bounds%begc:bounds%endc, :), & + custom_rel_epsilon = 1.e-12_r8) call truncate_small_values_one_lev( & num_f = num_snowc, & filter_f = filter_snowc, & @@ -1172,7 +1173,8 @@ subroutine UpdateState_TopLayerFluxes(bounds, num_snowc, filter_snowc, & lev_lb = -nlevsno+1, & lev = lev_top(bounds%begc:bounds%endc), & data_baseline = h2osoi_liq_top_orig(bounds%begc:bounds%endc), & - data = h2osoi_liq(bounds%begc:bounds%endc, :)) + data = h2osoi_liq(bounds%begc:bounds%endc, :), & + custom_rel_epsilon = 1.e-12_r8) ! Make sure that we don't have any negative residuals - i.e., that we didn't try to ! remove more ice or liquid than was initially present. From e664058a4db833dace5ca15fff748a541110089a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 21 Apr 2020 22:51:46 -0600 Subject: [PATCH 0799/1973] Make the resolution list to just be the resolutions added in this PR --- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 2fe44866b9..d9571b06b4 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1849,7 +1849,7 @@ CLM run type. +"512x1024,360x720cru,128x256,64x128,48x96,32x64,8x16,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4,ne60np4,ne120np4,ne240np4,1km-merge-10min,C24,C48,C96,C192,C384"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools From 8ae8063757f367dc67b591c3a6399abd3a2802f1 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 22 Apr 2020 09:03:10 -0600 Subject: [PATCH 0800/1973] change variable names --- src/biogeophys/CanopyFluxesMod.F90 | 65 ++++++++++++++---------------- src/main/pftconMod.F90 | 10 ++--- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 99fa862d6b..43f8a3d3d0 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -405,19 +405,18 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, logical :: is_end_day ! is end of current day real(r8) :: dbh(bounds%begp:bounds%endp) !diameter at breast height of vegetation - real(r8) :: cp_veg(bounds%begp:bounds%endp) !heat capacity of veg + real(r8) :: cp_leaf(bounds%begp:bounds%endp) !heat capacity of leaves real(r8) :: cp_stem(bounds%begp:bounds%endp) !heat capacity of stems - real(r8) :: rstema(bounds%begp:bounds%endp) !stem resistance to heat transfer + real(r8) :: rstem(bounds%begp:bounds%endp) !stem resistance to heat transfer real(r8) :: dt_stem(bounds%begp:bounds%endp) !change in stem temperature - real(r8) :: fstem(bounds%begp:bounds%endp) !fraction of stem + real(r8) :: frac_rad_abs_by_stem(bounds%begp:bounds%endp) !fraction of incoming radiation absorbed by stems real(r8) :: lw_stem(bounds%begp:bounds%endp) !internal longwave stem real(r8) :: lw_leaf(bounds%begp:bounds%endp) !internal longwave leaf real(r8) :: sa_stem(bounds%begp:bounds%endp) !surface area stem m2/m2_ground real(r8) :: sa_leaf(bounds%begp:bounds%endp) !surface area leaf m2/m2_ground real(r8) :: sa_internal(bounds%begp:bounds%endp) !min(sa_stem,sa_leaf) real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed - real(r8) :: cp_wood - real(r8) :: carea_stem + real(r8) :: carea_stem !cross-sectional area of stem ! biomass parameters real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem @@ -425,8 +424,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8), parameter :: k_cyl_area = 1.0 !departure from cylindrical area real(r8), parameter :: k_internal = 0.0 !self-absorbtion of leaf/stem longwave real(r8), parameter :: min_stem_diameter = 0.01!minimum stem diameter for which to calculate stem interactions - - integer :: dummy_to_make_pgi_happy !------------------------------------------------------------------------------ @@ -445,11 +442,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, dbh_param => pftcon%dbh , & ! Input: diameter at brest height (m) fbw => pftcon%fbw , & ! Input: fraction of biomass that is water nstem => pftcon%nstem , & ! Input: stem number density (#ind/m2) - rstem => pftcon%rstem , & ! Input: stem resistance per stem diameter (s/m**2) + rstem_per_dbh => pftcon%rstem_per_dbh , & ! Input: stem resistance per stem diameter (s/m**2) wood_density => pftcon%wood_density , & ! Input: dry wood density (kg/m3) forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - forc_q => wateratm2lndbulk_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) + forc_q => wateratm2lndbulk_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) forc_th => atm2lnd_inst%forc_th_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric potential temperature (Kelvin) forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] density (kg/m**3) @@ -687,10 +684,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, if(use_biomass_heat_storage) then ! fraction of stem receiving incoming radiation - fstem(p) = (esai(p))/(elai(p)+esai(p)) + frac_rad_abs_by_stem(p) = (esai(p))/(elai(p)+esai(p)) - ! when elai = 0, do not multiply by k_vert (i.e. fstem = 1) - if(elai(p) > 0._r8) fstem(p) = k_vert * fstem(p) + ! when elai = 0, do not multiply by k_vert (i.e. frac_rad_abs_by_stem = 1) + if(elai(p) > 0._r8) frac_rad_abs_by_stem(p) = k_vert * frac_rad_abs_by_stem(p) ! if using Satellite Phenology mode, use values in parameter file ! otherwise calculate dbh from stem biomass @@ -714,7 +711,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! do not calculate separate leaf/stem heat capacity for grasses ! or other pfts if dbh is below minimum value if(patch%itype(p) > 11 .or. dbh(p) < min_stem_diameter) then - fstem(p) = 0.0 + frac_rad_abs_by_stem(p) = 0.0 sa_stem(p) = 0.0 endif @@ -740,7 +737,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! as weighted averaged of dry biomass and water ! lma_dry has units of kg dry mass/m2 here (table 2 of bonan 2017) ! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K - cp_veg(p) = leaf_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) + cp_leaf(p) = leaf_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) ! cp-stem will have units J/k/ground_area cp_stem(p) = stem_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) @@ -748,16 +745,16 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, cp_stem(p) = k_cyl_vol * cp_stem(p) ! resistance between internal stem temperature and canopy air - rstema(p) = rstem(patch%itype(p))*dbh(p) + rstem(p) = rstem_per_dbh(patch%itype(p))*dbh(p) else ! use_biomass_heat_storage .false. - fstem(p) = 0._r8 + frac_rad_abs_by_stem(p) = 0._r8 sa_stem(p) = 0._r8 sa_leaf(p) = (elai(p)+esai(p)) sa_internal(p) = 0._r8 - cp_veg(p) = 0._r8 + cp_leaf(p) = 0._r8 cp_stem(p) = 0._r8 - rstema(p) = 0._r8 + rstem(p) = 0._r8 endif enddo @@ -1079,7 +1076,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, wta = 1._r8/rah(p,1) ! air wtl = sa_leaf(p)/rb(p) ! leaf wtg(p) = 1._r8/rah(p,2) ! ground - wtstem = sa_stem(p)/(rstema(p) + rb(p)) ! stem + wtstem = sa_stem(p)/(rstem(p) + rb(p)) ! stem wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) @@ -1202,13 +1199,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - dt_veg(p) = ((1.-fstem(p))*(sabv(p) + air(p) & + dt_veg(p) = ((1.-frac_rad_abs_by_stem(p))*(sabv(p) + air(p) & + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & - efsh - efe(p) - lw_leaf(p) + lw_stem(p) & - - (cp_veg(p)/dtime)*(t_veg(p) - tl_ini(p))) & - / ((1.-fstem(p))*(- 4._r8*bir(p)*t_veg(p)**3) & + - (cp_leaf(p)/dtime)*(t_veg(p) - tl_ini(p))) & + / ((1.-frac_rad_abs_by_stem(p))*(- 4._r8*bir(p)*t_veg(p)**3) & + 4._r8*sa_internal(p)*emv(p)*sb*t_veg(p)**3 & - +dc1*wtga(p) +dc2*wtgaq*qsatldT(p) + cp_veg(p)/dtime) + +dc1*wtga(p) +dc2*wtgaq*qsatldT(p) + cp_leaf(p)/dtime) t_veg(p) = tlbef(p) + dt_veg(p) @@ -1218,14 +1215,14 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, if (del(p) > delmax) then dt_veg(p) = delmax*dels/del(p) t_veg(p) = tlbef(p) + dt_veg(p) - err(p) = (1.-fstem(p))*(sabv(p) + air(p) & + err(p) = (1.-frac_rad_abs_by_stem(p))*(sabv(p) + air(p) & + bir(p)*tlbef(p)**3*(tlbef(p) + & 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & -sa_internal(p)*emv(p)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & + lw_stem(p) & - (efsh + dc1*wtga(p)*dt_veg(p)) - (efe(p) + & dc2*wtgaq*qsatldT(p)*dt_veg(p)) & - - (cp_veg(p)/dtime)*(t_veg(p) - tl_ini(p)) + - (cp_leaf(p)/dtime)*(t_veg(p) - tl_ini(p)) end if ! Fluxes from leaves to canopy space @@ -1358,18 +1355,18 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - err(p) = (1.-fstem(p))*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & + err(p) = (1.-frac_rad_abs_by_stem(p))*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & - lw_leaf(p) + lw_stem(p) - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) & - - ((t_veg(p)-tl_ini(p))*cp_veg(p)/dtime) + - ((t_veg(p)-tl_ini(p))*cp_leaf(p)/dtime) !scs ! if (abs(err(p)) > 1e6) then ! write(iulog,*) 'canerrchk: ', lw_leaf(p), lw_stem(p), dt_veg(p) -! write(iulog,*) 'canerrchk: ', (1.-fstem(p))*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & +! write(iulog,*) 'canerrchk: ', (1.-frac_rad_abs_by_stem(p))*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & ! *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd), & ! lw_leaf(p),lw_stem(p),eflx_sh_veg(p),hvap*qflx_evap_veg(p), & -! t_veg(p),tl_ini(p),dt_veg(p),cp_veg(p),cp_stem(p) +! t_veg(p),tl_ini(p),dt_veg(p),cp_leaf(p),cp_stem(p) ! endif @@ -1379,16 +1376,16 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! as that would change result for t_veg above if (use_biomass_heat_storage) then if (stem_biomass(p) > 0._r8) then - dt_stem(p) = (fstem(p)*(sabv(p) + air(p) + bir(p)*ts_ini(p)**4 & + dt_stem(p) = (frac_rad_abs_by_stem(p)*(sabv(p) + air(p) + bir(p)*ts_ini(p)**4 & + cir(p)*lw_grnd) - eflx_sh_stem(p) & + lw_leaf(p)- lw_stem(p))/(cp_stem(p)/dtime & - - fstem(p)*bir(p)*4.*ts_ini(p)**3) + - frac_rad_abs_by_stem(p)*bir(p)*4.*ts_ini(p)**3) else dt_stem(p) = 0._r8 endif dhsdt_canopy(p) = dt_stem(p)*cp_stem(p)/dtime & - +(t_veg(p)-tl_ini(p))*cp_veg(p)/dtime + +(t_veg(p)-tl_ini(p))*cp_leaf(p)/dtime t_stem(p) = t_stem(p) + dt_stem(p) else @@ -1477,12 +1474,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & - emv(p)*emg(c)*sb*(tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1.-fstem(p))+ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p))*fstem(p)) + emv(p)*emg(c)*sb*(tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1.-frac_rad_abs_by_stem(p))+ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p))*frac_rad_abs_by_stem(p)) ! Upward longwave radiation above the canopy ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-fstem(p))*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+fstem(p)*ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-frac_rad_abs_by_stem(p))*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+frac_rad_abs_by_stem(p)*ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index b59d683627..e5b3d5c564 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -149,7 +149,7 @@ module pftconMod real(r8), allocatable :: dbh (:) ! diameter at breast height (m) real(r8), allocatable :: fbw (:) ! fraction of biomass that is water real(r8), allocatable :: nstem (:) ! stem density (#/m2) - real(r8), allocatable :: rstem (:) ! stem resistance per dbh (s/m/m) + real(r8), allocatable :: rstem_per_dbh (:) ! stem resistance per dbh (s/m/m) real(r8), allocatable :: wood_density (:) ! wood density (kg/m3) ! crop @@ -470,7 +470,7 @@ subroutine InitAllocate (this) allocate( this%dbh (0:mxpft) ) allocate( this%fbw (0:mxpft) ) allocate( this%nstem (0:mxpft) ) - allocate( this%rstem (0:mxpft) ) + allocate( this%rstem_per_dbh (0:mxpft) ) allocate( this%wood_density (0:mxpft) ) end subroutine InitAllocate @@ -1025,7 +1025,7 @@ subroutine InitRead(this) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('nstem',this%nstem, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - call ncd_io('rstem',this%rstem, 'read', ncid, readvar=readv) + call ncd_io('rstem',this%rstem_per_dbh, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('wood_density',this%wood_density, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) @@ -1033,7 +1033,7 @@ subroutine InitRead(this) this%dbh = 0.0 this%fbw = 0.0 this%nstem = 0.1 - this%rstem = 0.0 + this%rstem_per_dbh = 0.0 this%wood_density = 0.0 end if @@ -1422,7 +1422,7 @@ subroutine Clean(this) deallocate( this%dbh) deallocate( this%fbw) deallocate( this%nstem) - deallocate( this%rstem) + deallocate( this%rstem_per_dbh) deallocate( this%wood_density) end subroutine Clean From 1120fe5d477e761367e500f61e372d446635c045 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 22 Apr 2020 09:03:19 -0600 Subject: [PATCH 0801/1973] Change C96 test to a test that will run, needs to be one without CISM or ROF add tx0.061 mask to list --- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- cime_config/testdefs/testlist_clm.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index d9571b06b4..0bee4c4ee6 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1871,7 +1871,7 @@ hist means do NOT use a future scenario, just use historical data. + valid_values="USGS,gx3v7,gx1v6,gx1v7,navy,test,tx0.1v2,tx0.66v1,tx0.1v3,tx1v1,T62,cruncep,nldas2"> Land mask description diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 9e15f54350..4f620f1ef2 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -34,7 +34,7 @@ - + From c29369e8ab585a41ff8556f38b1a1a03d142cebb Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 22 Apr 2020 10:55:41 -0600 Subject: [PATCH 0802/1973] comment about SetRHSVec and removing unnecessary if (j >= col%snl(c)+1) --- src/biogeophys/SoilTemperatureMod.F90 | 190 +++++++++++++------------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 1d55d82f88..fb27951471 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -1845,6 +1845,12 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & ! Initialize rvector(begc:endc, :) = nan + !SetRHSVec_ subroutines must be called in the correct order: + ! 1) SetRHSVec_Snow + ! 2) SetRHSVec_StandingSurfaceWater + ! 3) SetRHSVec_Soil + ! + ! Set entries in RHS vector for snow layers call SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & hs_top_snow( begc:endc ), & @@ -1957,10 +1963,10 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & do j = -nlevsno+1,0 do fc = 1,num_nolakec c = filter_nolakec(fc) - ! urban non-road and non-urban columns + ! urban road and non-urban columns hs_top_lev(c) = hs_top_snow(c) - ! urban road columns + ! urban non-road columns if (col%itype(c) == icol_sunwall .or. & col%itype(c) == icol_shadewall .or. & col%itype(c) == icol_roof) then @@ -2128,29 +2134,27 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & col%itype(c) == icol_shadewall .or. & col%itype(c) == icol_roof) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - ! changed hs to hs_top - rt(c,j) = t_soisno(c,j) + fact(c,j)*( hs_top(c) - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - else if (j <= nlevurb-1) then - ! if this is a snow layer or the top soil layer, - ! add absorbed solar flux to factor 'rt' - if (j == 1) then - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - rt(c,j) = rt(c,j) + (fact(c,j)*sabg_lyr_col(c,j)) - else - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - endif - - else if (j == nlevurb) then - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - rt(c,j) = t_soisno(c,j) + fact(c,j)*( fn(c,j) - cnfac*fn(c,j-1) ) - end if - end if + if (j == col%snl(c)+1) then + ! changed hs to hs_top + rt(c,j) = t_soisno(c,j) + fact(c,j)*( hs_top(c) - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) + else if (j <= nlevurb-1) then + ! if this is a snow layer or the top soil layer, + ! add absorbed solar flux to factor 'rt' + if (j == 1) then + rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) + rt(c,j) = rt(c,j) + (fact(c,j)*sabg_lyr_col(c,j)) + else + rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) + endif + + else if (j == nlevurb) then + ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across + ! the bottom "soil" layer and the equations are derived assuming a prescribed internal + ! building temperature. (See Oleson urban notes of 6/18/03). + rt(c,j) = t_soisno(c,j) + fact(c,j)*( fn(c,j) - cnfac*fn(c,j-1) ) + end if end if - enddo + end do end do @@ -2491,10 +2495,10 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & do j = -nlevsno+1,0 do fc = 1,num_nolakec c = filter_nolakec(fc) - ! urban non-road and non-urban columns + ! urban road and non-urban columns nlev_thresh(fc) = nlevgrnd - ! urban road columns + ! urban non-road columns if (col%itype(c) == icol_sunwall .or. & col%itype(c) == icol_shadewall.or. & col%itype(c) == icol_roof) then @@ -2598,41 +2602,39 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & do j = 1,nlevurb do fc = 1,num_nolakec c = filter_nolakec(fc) - if ( col%itype(c) == icol_sunwall .or. & - col%itype(c) == icol_shadewall .or. & - col%itype(c) == icol_roof) then - - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - if (j /= 1) then - bmatrix_soil(c,4,j) = 0._r8 - else - bmatrix_soil_snow(c,5,j) = 0._r8 - end if - bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j <= nlevurb-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - if (j /= 1) then - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - else - bmatrix_soil_snow(c,5,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - end if - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - else if (j == nlevurb) then - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prognostic inner - ! surface temperature. - dzm = ( z(c,j)-z(c,j-1)) - dzp = (zi(c,j)-z(c,j)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm) - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm + tk(c,j)/dzp) - bmatrix_soil(c,2,j) = 0._r8 - end if - end if + if (col%itype(c) == icol_sunwall .or. & + col%itype(c) == icol_shadewall .or. & + col%itype(c) == icol_roof) then + + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + if (j /= 1) then + bmatrix_soil(c,4,j) = 0._r8 + else + bmatrix_soil_snow(c,5,j) = 0._r8 + end if + bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + else if (j <= nlevurb-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + if (j /= 1) then + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + else + bmatrix_soil_snow(c,5,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + end if + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + else if (j == nlevurb) then + ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across + ! the bottom "soil" layer and the equations are derived assuming a prognostic inner + ! surface temperature. + dzm = ( z(c,j)-z(c,j-1)) + dzp = (zi(c,j)-z(c,j)) + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm) + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm + tk(c,j)/dzp) + bmatrix_soil(c,2,j) = 0._r8 + end if end if enddo enddo @@ -2648,41 +2650,39 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & (col%itype(c) == icol_road_perv) .or. & (.not. lun%urbpoi(l))) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - if (j /= 1) then - bmatrix_soil(c,4,j) = 0._r8 - else - bmatrix_soil_snow(c,5,j) = 0._r8 - end if - bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j == 1) then - ! this is the snow/soil interface layer - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & - + frac_sno_eff(c) * tk(c,j-1)/dzm) & - - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) - bmatrix_soil_snow(c,5,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - else if (j == nlevgrnd) then - dzm = (z(c,j)-z(c,j-1)) - bmatrix_soil(c,2,j) = 0._r8 - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - end if - end if + if (j == col%snl(c)+1) then + dzp = z(c,j+1)-z(c,j) + if (j /= 1) then + bmatrix_soil(c,4,j) = 0._r8 + else + bmatrix_soil_snow(c,5,j) = 0._r8 + end if + bmatrix_soil(c,3,j) = 1._r8+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) + bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + else if (j == 1) then + ! this is the snow/soil interface layer + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp + bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & + + frac_sno_eff(c) * tk(c,j-1)/dzm) & + - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) + bmatrix_soil_snow(c,5,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & + * tk(c,j-1)/dzm + else if (j <= nlevgrnd-1) then + dzm = (z(c,j)-z(c,j-1)) + dzp = (z(c,j+1)-z(c,j)) + bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm + else if (j == nlevgrnd) then + dzm = (z(c,j)-z(c,j-1)) + bmatrix_soil(c,2,j) = 0._r8 + bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm + bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm + end if end if - enddo + end do end do do fc = 1,num_nolakec From cb7cc80fd56e82eba29901d64ab3d7e1a31b77b8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 23 Apr 2020 12:30:35 -0600 Subject: [PATCH 0803/1973] Set vxmax/jmax to same as lunadaylbugs branch --- src/biogeophys/PhotosynthesisMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 88ad4e142e..beccb7ddbf 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -330,8 +330,8 @@ subroutine InitAllocate(this, bounds) ! statements. allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 - allocate(this%vcmx_prevyr (begp:endp,1:nlevcan)) ; this%vcmx_prevyr (:,:) = 30._r8 - allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 60._r8 + allocate(this%vcmx_prevyr (begp:endp,1:nlevcan)) ; this%vcmx_prevyr (:,:) = 85._r8 + allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 50._r8 allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8 From 824b765274bf27d849924680e5a0396e4e477c09 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 23 Apr 2020 13:51:39 -0600 Subject: [PATCH 0804/1973] Use Kattge instead of Leuning in Luna --- src/biogeophys/LunaMod.F90 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 56cae57f6f..7d082435ad 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -904,8 +904,8 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR JmaxCoef = Jmaxb1 * dayl_factor * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & (1.0_r8 - minrelh))) do while (PNlcoldi .NE. PNlc .and. jj < 100) - Fc = VcmxTLeuning(tair10, tleafd10c) * Fc25 - Fj = JmxTLeuning(tair10, tleafd10c) * Fj25 + Fc = VcmxTKattge(tair10, tleafd10c) * Fc25 + Fj = JmxTKattge(tair10, tleafd10c) * Fj25 NUEr = Cv * NUEr25 * (RespTBernacchi(tleafd10c) * hourpd + RespTBernacchi(tleafn10c) * (24.0_r8 - hourpd)) !nitrogen use efficiency for respiration (g biomass/m2/day/g N) !**************************************************** !Nitrogen Allocation Scheme: store the initial value @@ -1058,7 +1058,7 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & A = (1.0_r8 - theta_cj) * max(Wc, Wj) + theta_cj * min(Wc, Wj) endif PSN = Cv * A * hourpd - Vcmaxnight = VcmxTLeuning(tair10, tleafn10) / VcmxTLeuning(tair10, tleafd10) * Vcmax + Vcmaxnight = VcmxTKattge(tair10, tleafn10) / VcmxTKattge(tair10, tleafd10) * Vcmax RESP = Cv * leaf_mr_vcm * (Vcmax * hourpd + Vcmaxnight * (24.0_r8 - hourpd)) Net = Jmax / Fj Ncb = Vcmax / Fc @@ -1213,8 +1213,8 @@ subroutine NUEref(NUEjref,NUEcref,Kj2Kcref) tgrow = 25.0_r8 tleaf = 25.0_r8 - Fc = VcmxTLeuning(tgrow, tleaf) * Fc25 - Fj = JmxTLeuning(tgrow, tleaf) * Fj25 + Fc = VcmxTKattge(tgrow, tleaf) * Fc25 + Fj = JmxTKattge(tgrow, tleaf) * Fj25 CO2c = co2ref * forc_pbot_ref * 1.0e-6_r8 !pa O2c = O2ref * forc_pbot_ref * 1.0e-6_r8 !pa k_c = params_inst%kc25_coef * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) @@ -1254,8 +1254,8 @@ subroutine NUE(O2a, ci, tgrow, tleaf, NUEj,NUEc,Kj2Kc) real(r8) :: awc !second deminator term for rubsico limited carboxylation rate based on Farquhar model real(r8) :: c_p !CO2 compenstation point (Pa) - Fc = VcmxTLeuning(tgrow, tleaf) * Fc25 - Fj = JmxTLeuning(tgrow, tleaf) * Fj25 + Fc = VcmxTKattge(tgrow, tleaf) * Fc25 + Fj = JmxTKattge(tgrow, tleaf) * Fj25 k_c = params_inst%kc25_coef * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) k_o = params_inst%ko25_coef * exp((36380.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) c_p = params_inst%cp25_yr2000 * exp((37830.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) From 92d4ac41cbacf9c0ad839cc1ccc07c8385e92efb Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 23 Apr 2020 14:30:10 -0600 Subject: [PATCH 0805/1973] Documenting the changes for this PR: Updating ChangeLog and ChangeSum. --- doc/ChangeLog | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 107 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 74436ab4da..3a3d2d89d6 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,110 @@ =============================================================== +Tag name: ctsm1.0.dev090 +Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) +Date: Thu Apr 23 09:21:18 MDT 2020 +One-line Summary: Refactoring banded diagonal matrix and solve system in SoilTemperature module + +Purpose of changes +------------------ + +Previously, the SoilTemperature module has a high level of nested subroutine +calls, which hurt its performance and readability. There were many +redundancies, logical issues, and nested conditionals in the modular code +as discussed in issue #323. In this PR, SoilTemperature module is optimized +and rewritten for better readability and performance while maintaining bfb +compatibility. + + +This PR addresses issue ESCOMP/ctsm#323 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + -ESCOMP/ctsm#323 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: The revised code improved the +performance of the previous code by ~1.5-2x. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks + + +CTSM testing: + + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/CTSM/pull/979) + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev089 Originator(s): sacks (Bill Sacks) Date: Tue Apr 7 12:01:59 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 6b4b456a5c..3353c1e2cb 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev090 negins 04/23/2020 Refactoring banded diagonal matrix code in SoilTemperature module ctsm1.0.dev089 sacks 04/07/2020 Bring documentation source to master ctsm1.0.dev088 sacks 04/07/2020 Fix bug in snow aerosol numerics (causes occasional HUGE aerosol values) ctsm1.0.dev087 sacks 04/06/2020 Change hard-coded soil layers in phenology to use a target depth From f208e9215efc2bfd2991e1d08f13f390b77b82cd Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 23 Apr 2020 14:49:47 -0600 Subject: [PATCH 0806/1973] Documenting the changes for this PR: Updating ChangeLog and ChangeSum. --- doc/ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 3a3d2d89d6..d998352415 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -87,6 +87,16 @@ CTSM testing: cheyenne ---- OK izumi ------- PASS +Externals used for the testing: + [cism] + tag = cism2_1_68 + [rtm] + tag = rtm1_0_70 + [mosart] + tag = mosart1_0_35 + [cime] + tag = branch_tags/cime5.8.15_a01 + If the tag used for baseline comparisons was NOT the previous tag, note that here: From 90c56c5c5e99ac711e8fffe3d53c6a1174cd04fb Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 24 Apr 2020 09:41:30 -0600 Subject: [PATCH 0807/1973] Update ChangeLog --- doc/ChangeLog | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 139 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index d998352415..ee39758499 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,142 @@ =============================================================== +Tag name: ctsm1.0.dev091 +Originator(s): sacks (Bill Sacks) +Date: Fri Apr 24 07:43:46 MDT 2020 +One-line Summary: Increase tolerance on near-zero truncation for a snow state update + +Purpose of changes +------------------ + +In UpdateState_TopLayerFluxes, the tolerance of 1.e-13 was occasionally +exceeded. Although I haven't done a careful analysis, it seems okay to +me to increase this tolerance slightly. Here I increase it to 1.e-12. + +Previously, if top-layer h2osoi_ice or h2osoi_liq were reduced to less +than 1e-13 times the original value (in an absolute value sense), these +masses were set to 0; now we set these masses to 0 if they are reduced +to less than 1e-12 times the original. So we can now occasionally set a +value to exactly 0 when before it was left at slightly different from +zero. If the previous code led to a small positive value, between 1e-13 +and 1e-12 times the original, this tag will change answers slightly. If +the previous code led to a small negative number, it would cause the +model to abort, leading to the issue reported in ESCOMP/CTSM#988; this +change should fix those occasional aborts. + +This tag also introduces the general ability to set tolerances to a +custom value in calls to truncate_small_values. + +See ESCOMP/CTSM#988 for details. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#988 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none expected (not checked) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, in theory (but none in test suite) + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: potentially all, but very rarely + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Roundoff + + Potentially changes answers by roundoff (see notes above), but no + changes were observed in any test in the test suite + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: N/A + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/989 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev090 Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) Date: Thu Apr 23 09:21:18 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 3353c1e2cb..c682b9dbf3 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev091 sacks 04/24/2020 Increase tolerance on near-zero truncation for a snow state update ctsm1.0.dev090 negins 04/23/2020 Refactoring banded diagonal matrix code in SoilTemperature module ctsm1.0.dev089 sacks 04/07/2020 Bring documentation source to master ctsm1.0.dev088 sacks 04/07/2020 Fix bug in snow aerosol numerics (causes occasional HUGE aerosol values) From 9cb8fcf84e83ac4f21aa055b032f018017098863 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 24 Apr 2020 13:56:18 -0600 Subject: [PATCH 0808/1973] @wweider and @lmbirch89 pointed out that some constants need to change as well for the Kattge vs. Leuning switch --- src/biogeophys/PhotosynthesisMod.F90 | 31 +++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index beccb7ddbf..5a9edb22d3 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -2802,18 +2802,29 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & kcha = 79430._r8 koha = 36380._r8 cpha = 37830._r8 - vcmaxha = 73637._r8 - jmaxha = 50300._r8 - tpuha = 73637._r8 lmrha = 46390._r8 + ! Values to use for Leuning + !vcmaxha = 73637._r8 + !jmaxha = 50300._r8 + !tpuha = 73637._r8 + ! Values to use for Kattge + vcmaxha = 72000._r8 + jmaxha = 50000._r8 + tpuha = 72000._r8 ! High temperature deactivation, from: ! Leuning (2002) Plant, Cell and Environment 25:1205-1210 ! The factor "c" scales the deactivation to a value of 1.0 at 25C - vcmaxhd = 149252._r8 - jmaxhd = 152044._r8 - tpuhd = 149252._r8 + ! Values to use for Leuning + !vcmaxhd = 149252._r8 + !jmaxhd = 152044._r8 + !tpuhd = 149252._r8 + ! Values to use for Kattge + vcmaxhd = 200000._r8 + jmaxhd = 200000._r8 + tpuhd = 200000._r8 + lmrhd = 150650._r8 lmrse = 490._r8 lmrc = fth25 (lmrhd, lmrse) @@ -3173,8 +3184,12 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & kp25_sha = kp25top * nscaler_sha ! Adjust for temperature - vcmaxse = 486.0_r8 - jmaxse = 495.0_r8 + ! Acclimation is done for Kattge + vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) + jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) + ! These values are used for Leuning + !vcmaxse = 486.0_r8 + !jmaxse = 495.0_r8 tpuse = vcmaxse vcmaxc = fth25 (vcmaxhd, vcmaxse) jmaxc = fth25 (jmaxhd, jmaxse) From 34b6dcc107f40c4ca826a1f24c2ffc8e954c781f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 24 Apr 2020 16:50:28 -0600 Subject: [PATCH 0809/1973] Updated params file with updated stem_leaf and froot_leaf from Leah --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 825db0fc30..6f6a14572e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -372,7 +372,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200402.nc +lnd/clm2/paramdata/clm5_params.c200424.nc lnd/clm2/paramdata/clm_params.c200402.nc From 9cc3609a3be1914655dce4f09fd53f0348ffc256 Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Fri, 24 Apr 2020 23:40:34 -0700 Subject: [PATCH 0810/1973] update tech note --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 38 +++++++++++++------ .../References/CLM50_Tech_Note_References.rst | 2 +- ...ech_Note_Vegetation_Phenology_Turnover.rst | 4 +- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index a82f871e6d..9ddcd76f57 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -40,9 +40,17 @@ refers to the interactive crop management model and is included as an option wit These updates appear in detail in the sections below. Many also appear in :ref:`Levis et al. (2016) `. + +Available new features since the CLM5 release +^^^^^^^^^^^^^^^^^^^ +- Addition of bioenergy crops + + + + .. _The crop model: -The crop model: stable and bioenergy crops +The crop model: cash and bioenergy crops ------------------- Introduction @@ -107,18 +115,20 @@ CLM5 includes ten actively managed crop types corn, spring wheat, cotton, rice, sugarcane, miscanthus, and switchgrass) that are chosen based on the availability of corresponding algorithms in AgroIBIS and as developed by :ref:`Badger and Dirmeyer (2015)` and -described by :ref:`Levis et al. (2016)` and :ref:`Cheng et al. (2019)`. -The representations of sugarcane, rice, cotton, tropical corn, tropical soy, miscanthus, and switchgrass are new in CLM5. +described by :ref:`Levis et al. (2016)`, or from available observations +as described by :ref:`Cheng et al. (2019)`. +The representations of sugarcane, rice, cotton, tropical corn, and tropical soy are new in CLM5. +Miscanthus and switchgrass are added after the CLM5 release. Sugarcane and tropical corn are both C4 plants and are therefore represented using the temperate corn functional form. Tropical soybean uses the temperate soybean functional form, while rice and cotton use the wheat functional form. In tropical regions, parameter values were developed for the Amazon Basin, and planting date window is shifted by six months relative to the Northern Hemisphere. Plantation areas of bioenergy crops are projected to expand throughout the 21st century as a major energy source to -replace fossil fuels and mitigate climate changes. Miscanthus and switchgrass are perennial bioenergy crops and +replace fossil fuels and mitigate climate change. Miscanthus and switchgrass are perennial bioenergy crops and have quite different physiological traits and land management practices than annual crops, -such as longer growing seasons, higher productivity, and less demands for nutrients and water. -About 70% of their aboveground biomass (leaf & livestem) is removed at harvest for biofuels. Parameter values were developed by using +such as longer growing seasons, higher productivity, and lower demands for nutrients and water. +About 70% of biofuel aboveground biomass (leaf & livestem) is removed at harvest for biofuels. Parameter values were developed by using observation data collected at the University of Illinois Energy Farm located in Central Midwestern United States (:ref:`Cheng et al., 2019`). @@ -129,7 +139,7 @@ The unmanaged C3 crop is only used when the crop model is not active and has grid cell coverage assigned from satellite data, and the unmanaged C3 irrigated crop type is currently not used since irrigation requires the crop model to be active. -The default list of pfts also includes twenty-three inactive crop pfts +The default list of pfts also includes twenty-one inactive crop pfts that do not yet have associated parameters required for active management. Each of the inactive crop types is simulated using the parameters of the spatially closest associated crop type that is most similar to the functional type (e.g., C3 or C4), @@ -546,7 +556,7 @@ Harvest Variables track the flow of grain C and N to food and of all other plant pools, including live stem C and N, to litter, and to biofuel feedstock. A fraction (determined by :math:`biofuel\_harvfrac`) of leaf/livestem C and N from bioenergy crops is removed at harvest for biofuels (Equations :eq:`25.9`, :eq:`25.10`, :eq:`25.12`, and :eq:`25.13`), -with the remaining portions go to the litter pools (Equations :eq:`20.14)`, :eq:`25.11`, and :eq:`25.14`). +with the remaining portions going to the litter pools (Equations :eq:`20.14)`, :eq:`25.11`, and :eq:`25.14`). Putting live stem C and N into the litter and biofuel pools is in contrast to the approach for unmanaged PFTs which puts live stem C and N into dead stem pools first. Leaf C and N pools are routed to the little and biofuel pools, contrast to that of unmanaged PFTs which put leaf C and N to litter pools only. @@ -590,11 +600,12 @@ with corresponding nitrogen fluxes: NF_{livestem,litter} = \left({NS_{livestem} \mathord{\left/ {\vphantom {NS_{livestem} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right) * \left( 1-biofuel\_harvfrac \right) -where :math:`biofuel\_harvfrac` is the harvested fraction of leaf/livestem for biofuel feedstocks. +where CF is the carbon flux, CS is stored carbon, NF is the nitrogen flux, NS is stored nitrogen, and + :math:`biofuel\_harvfrac` is the harvested fraction of leaf/livestem for biofuel feedstocks. -.. _Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy crops: +.. _Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy production: -.. table:: Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy crops. +.. table:: Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy production. +----------------------------------+----------------------------+ | PFT | :math:`biofuel\_harvfrac` | @@ -745,7 +756,10 @@ In transient simulations, annual fertilizer application is specified on the land file by the field FERTNITRO_CFT, which is also in g N/m\ :sup:`2`/yr. The values for both of these fields come from the LUMIP time series for each year. In addition to the industrial fertilizer, background manure fertilizer is specified -on the parameter file by the field 'manunitro'. For the current CLM5BGCCROP, +on the parameter file by the field 'manunitro'. For perennial bioenergy crops, +little fertilizer (56kg/ha/yr) is applied to switchgrass, no fertilizer is applied to Miscanthus. +Note this set up is only based on local land management practice at the University of Illinois Energy Farm +located in Central Midwestern United States :ref:`(Cheng et al., 2019)`. For the current CLM5BGCCROP, manure N is applied at a rate of 0.002 kg N/m\ :sup:`2`/yr. Because previous versions of CLM (e.g., CLM4) had rapid denitrification rates, fertilizer is applied slowly to minimize N loss (primarily through denitrification) and maximize plant uptake. diff --git a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst index 387d2e0a0d..4bd7a2cf9b 100644 --- a/doc/source/tech_note/References/CLM50_Tech_Note_References.rst +++ b/doc/source/tech_note/References/CLM50_Tech_Note_References.rst @@ -276,7 +276,7 @@ model. J. Geophys. Res. 101(D9):14,399-14,414. .. _Chengetal2019: -Cheng, Y., Huang, M., et al., 2019. Parameterizing perennial bioenergy +Cheng, Y. et al., 2019. Parameterizing perennial bioenergy crops in Version 5 of the Community Land Model Based on Site‐Level Observations in the Central Midwestern United States. Journal of Advances in Modeling Earth Systems, diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index 0d6576d0c7..023344cbe6 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -5,8 +5,8 @@ Vegetation Phenology and Turnover The CLM phenology model consists of several algorithms controlling the transfer of stored carbon and nitrogen out of storage pools for the -display of new growth, into litter pools for losses of displayed -growth, and into biofuel feedstock pools for bioenergy. PFTs are classified into three distinct phenological types that +display of new growth and into litter pools for losses of displayed +growth. PFTs are classified into three distinct phenological types that are represented by separate algorithms: an evergreen type, for which some fraction of annual leaf growth persists in the displayed pool for longer than one year; a seasonal-deciduous type with a single growing From d666d831f8b9699be0052d58e0a2487a603d0cc4 Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Fri, 24 Apr 2020 23:44:00 -0700 Subject: [PATCH 0811/1973] update tech note --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 9ddcd76f57..e4ec4e1ab2 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -600,8 +600,8 @@ with corresponding nitrogen fluxes: NF_{livestem,litter} = \left({NS_{livestem} \mathord{\left/ {\vphantom {NS_{livestem} \Delta t}} \right. \kern-\nulldelimiterspace} \Delta t} \right) * \left( 1-biofuel\_harvfrac \right) -where CF is the carbon flux, CS is stored carbon, NF is the nitrogen flux, NS is stored nitrogen, and - :math:`biofuel\_harvfrac` is the harvested fraction of leaf/livestem for biofuel feedstocks. +where CF is the carbon flux, CS is stored carbon, NF is the nitrogen flux, +NS is stored nitrogen, and :math:`biofuel\_harvfrac` is the harvested fraction of leaf/livestem for biofuel feedstocks. .. _Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy production: From 159d3b039eba2dab7663db10ae27b8b754557d11 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 25 Apr 2020 16:35:07 -0600 Subject: [PATCH 0812/1973] Point to a new paramsfile the same as @lmbirch89 latest that only changes froot_leaf and stem_leaf for arctic plants. So the file is identical to /glade/work/lbirch/devclm4gitfinal/clm5_params_abz_lbirch_update.nc --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 6f6a14572e..9c57870814 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -372,7 +372,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200424.nc +lnd/clm2/paramdata/clm5_params.c200425.nc lnd/clm2/paramdata/clm_params.c200402.nc From 9ba7b5891bf33327688170e0c91b36bfa4897ca6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 25 Apr 2020 22:50:51 -0600 Subject: [PATCH 0813/1973] Update cime version to version in latest cesm2.2 beta tag, uppercase repos --- Externals.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 8f7908623b..0a0f4d24e9 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -7,7 +7,7 @@ required = True [cism] local_path = components/cism protocol = git -repo_url = https://github.com/ESCOMP/cism-wrapper +repo_url = https://github.com/ESCOMP/CISM-wrapper tag = cism2_1_68 externals = Externals_CISM.cfg required = True @@ -15,14 +15,14 @@ required = True [rtm] local_path = components/rtm protocol = git -repo_url = https://github.com/ESCOMP/rtm +repo_url = https://github.com/ESCOMP/RTM tag = rtm1_0_71 required = True [mosart] local_path = components/mosart protocol = git -repo_url = https://github.com/ESCOMP/mosart +repo_url = https://github.com/ESCOMP/MOSART tag = mosart1_0_36 required = True @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.17 +tag = cime5.8.19 externals = ../Externals_cime.cfg required = True From 10f068e8e7d09a05312acde101e510d01484c86f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 25 Apr 2020 22:51:00 -0600 Subject: [PATCH 0814/1973] Squashed 'manage_externals/' changes from fc5acdab..fde04e4d fde04e4d Merge pull request #138 from billsacks/add_python38_tests 37e4c4a5 Do not update dictionary in-place in loop 7e8474bb Remove testing on mac os 7f41c563 Fix pylint issue 3065b0d6 Add travis-ci tests with python3.7 and python3.8 34fbf556 Add support for git sparse checkout 6c6ef9fe Fix pylint errors 6a659ad3 Added test for sparse checkout and updated documentation 14432439 Support for git sparsecheckout via read-tree. a48558d8 Merge pull request #119 from gold2718/submodules f72ffe7f Do not try git submodule update if no .gitmodules file (git bug) 804e0afb Fix a pylint error 45aef95e Addressed review concerns 7da50314 New capability to use git submodule information to checkout externals 1926530f Merge pull request #118 from mnlevy1981/svn_switch b1b028d9 Updates after testing 9ea73e66 Add --svn-ignore-ancestry argument git-subtree-dir: manage_externals git-subtree-split: fde04e4d9a758b3aa277aa5fa44a59f5153f2958 --- .travis.yml | 17 +- README.md | 17 +- manic/checkout.py | 24 +- manic/externals_description.py | 359 ++++++++++++++-- manic/repository.py | 20 +- manic/repository_factory.py | 4 +- manic/repository_git.py | 124 +++++- manic/repository_svn.py | 25 +- manic/sourcetree.py | 86 +++- .../14/2711fdbbcb8034d7cad6bae6801887b12fe61d | Bin 0 -> 83 bytes .../60/7ec299c17dd285c029edc41a0109e49d441380 | Bin 0 -> 168 bytes .../b7/692b6d391899680da7b9b6fd8af4c413f06fe7 | Bin 0 -> 137 bytes .../d1/163870d19c3dee34fada3a76b785cfa2a8424b | Bin 0 -> 130 bytes .../d8/ed2f33179d751937f8fde2e33921e4827babf4 | Bin 0 -> 60 bytes test/repos/simple-ext.git/refs/heads/master | 2 +- test/repos/simple-ext.git/refs/tags/tag2 | 1 + test/test_sys_checkout.py | 393 +++++++++++++++++- test/test_unit_externals_description.py | 12 +- test/test_unit_repository.py | 25 +- test/test_unit_repository_git.py | 3 +- 20 files changed, 972 insertions(+), 140 deletions(-) create mode 100644 test/repos/simple-ext.git/objects/14/2711fdbbcb8034d7cad6bae6801887b12fe61d create mode 100644 test/repos/simple-ext.git/objects/60/7ec299c17dd285c029edc41a0109e49d441380 create mode 100644 test/repos/simple-ext.git/objects/b7/692b6d391899680da7b9b6fd8af4c413f06fe7 create mode 100644 test/repos/simple-ext.git/objects/d1/163870d19c3dee34fada3a76b785cfa2a8424b create mode 100644 test/repos/simple-ext.git/objects/d8/ed2f33179d751937f8fde2e33921e4827babf4 create mode 100644 test/repos/simple-ext.git/refs/tags/tag2 diff --git a/.travis.yml b/.travis.yml index b32f81bd28..1990cb9604 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,3 @@ -# NOTE(bja, 2017-11) travis-ci dosen't support python language builds -# on mac os. As a work around, we use built-in python on linux, and -# declare osx a 'generic' language, and create our own python env. - language: python os: linux python: @@ -9,17 +5,8 @@ python: - "3.4" - "3.5" - "3.6" -matrix: - include: - - os: osx - language: generic - before_install: - # NOTE(bja, 2017-11) update is slow, 2.7.12 installed by default, good enough! - # - brew update - # - brew outdated python2 || brew upgrade python2 - - pip install virtualenv - - virtualenv env -p python2 - - source env/bin/activate + - "3.7" + - "3.8" install: - pip install -r test/requirements.txt before_script: diff --git a/README.md b/README.md index 15e45ffb71..c931c8e213 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ The root of the source tree will be referred to as `${SRC_ROOT}` below. description file: $ cd ${SRC_ROOT} - $ ./manage_externals/checkout_externals --excernals my-externals.cfg + $ ./manage_externals/checkout_externals --externals my-externals.cfg * Status summary of the repositories managed by checkout_externals: @@ -202,6 +202,21 @@ The root of the source tree will be referred to as `${SRC_ROOT}` below. Then the main 'externals' field in the top level repo should point to 'sub-externals.cfg'. + * from_submodule (True / False) : used to pull the repo_url, local_path, + and hash properties for this external from the .gitmodules file in + this repository. Note that the section name (the entry in square + brackets) must match the name in the .gitmodules file. + If from_submodule is True, the protocol must be git and no repo_url, + local_path, hash, branch, or tag entries are allowed. + Default: False + + * sparse (string) : used to control a sparse checkout. This optional + entry should point to a filename (path relative to local_path) that + contains instructions on which repository paths to include (or + exclude) from the working tree. + See the "SPARSE CHECKOUT" section of https://git-scm.com/docs/git-read-tree + Default: sparse checkout is disabled + * Lines begining with '#' or ';' are comments and will be ignored. # Obtaining this tool, reporting issues, etc. diff --git a/manic/checkout.py b/manic/checkout.py index c5bbaf5f43..edc5655954 100755 --- a/manic/checkout.py +++ b/manic/checkout.py @@ -227,6 +227,21 @@ def commandline_arguments(args=None): Now, %(prog)s will process Externals.cfg and also process Externals_LIBX.cfg as if it was a sub-external. + * from_submodule (True / False) : used to pull the repo_url, local_path, + and hash properties for this external from the .gitmodules file in + this repository. Note that the section name (the entry in square + brackets) must match the name in the .gitmodules file. + If from_submodule is True, the protocol must be git and no repo_url, + local_path, hash, branch, or tag entries are allowed. + Default: False + + * sparse (string) : used to control a sparse checkout. This optional + entry should point to a filename (path relative to local_path) that + contains instructions on which repository paths to include (or + exclude) from the working tree. + See the "SPARSE CHECKOUT" section of https://git-scm.com/docs/git-read-tree + Default: sparse checkout is disabled + * Lines beginning with '#' or ';' are comments and will be ignored. # Obtaining this tool, reporting issues, etc. @@ -280,6 +295,13 @@ def commandline_arguments(args=None): 'used up to two times, increasing the ' 'verbosity level each time.') + parser.add_argument('--svn-ignore-ancestry', action='store_true', default=False, + help='By default, subversion will abort if a component is ' + 'already checked out and there is no common ancestry with ' + 'the new URL. This flag passes the "--ignore-ancestry" flag ' + 'to the svn switch call. (This is not recommended unless ' + 'you are sure about what you are doing.)') + # # developer options # @@ -348,7 +370,7 @@ def main(args): "No component {} found in {}".format( comp, args.externals)) - source_tree = SourceTree(root_dir, external) + source_tree = SourceTree(root_dir, external, svn_ignore_ancestry=args.svn_ignore_ancestry) printlog('Checking status of externals: ', end='') tree_status = source_tree.status() printlog('') diff --git a/manic/externals_description.py b/manic/externals_description.py index b32d37cfc6..b0c4f736a7 100644 --- a/manic/externals_description.py +++ b/manic/externals_description.py @@ -22,15 +22,17 @@ import os.path import re -# ConfigParser was renamed in python2 to configparser. In python2, -# ConfigParser returns byte strings, str, instead of unicode. We need -# unicode to be compatible with xml and json parser and python3. +# ConfigParser in python2 was renamed to configparser in python3. +# In python2, ConfigParser returns byte strings, str, instead of unicode. +# We need unicode to be compatible with xml and json parser and python3. try: # python2 from ConfigParser import SafeConfigParser as config_parser from ConfigParser import MissingSectionHeaderError from ConfigParser import NoSectionError, NoOptionError + USE_PYTHON2 = True + def config_string_cleaner(text): """convert strings into unicode """ @@ -41,6 +43,8 @@ def config_string_cleaner(text): from configparser import MissingSectionHeaderError from configparser import NoSectionError, NoOptionError + USE_PYTHON2 = False + def config_string_cleaner(text): """Python3 already uses unicode strings, so just return the string without modification. @@ -49,6 +53,7 @@ def config_string_cleaner(text): return text from .utils import printlog, fatal_error, str_to_bool, expand_local_url +from .utils import execute_subprocess from .global_constants import EMPTY_STR, PPRINTER, VERSION_SEPERATOR # @@ -59,8 +64,8 @@ def config_string_cleaner(text): def read_externals_description_file(root_dir, file_name): - """Given a file name containing a externals description, determine the - format and read it into it's internal representation. + """Read a file containing an externals description and + create its internal representation. """ root_dir = os.path.abspath(root_dir) @@ -70,29 +75,193 @@ def read_externals_description_file(root_dir, file_name): file_path = os.path.join(root_dir, file_name) if not os.path.exists(file_name): - msg = ('ERROR: Model description file, "{0}", does not ' - 'exist at path:\n {1}\nDid you run from the root of ' - 'the source tree?'.format(file_name, file_path)) + if file_name.lower() == "none": + msg = ('INTERNAL ERROR: Attempt to read externals file ' + 'from {0} when not configured'.format(file_path)) + else: + msg = ('ERROR: Model description file, "{0}", does not ' + 'exist at path:\n {1}\nDid you run from the root of ' + 'the source tree?'.format(file_name, file_path)) + fatal_error(msg) + externals_description = None + if file_name == ExternalsDescription.GIT_SUBMODULES_FILENAME: + externals_description = read_gitmodules_file(root_dir, file_name) + else: + try: + config = config_parser() + config.read(file_path) + externals_description = config + except MissingSectionHeaderError: + # not a cfg file + pass + + if externals_description is None: + msg = 'Unknown file format!' + fatal_error(msg) + + return externals_description + +class LstripReader(object): + "LstripReader formats .gitmodules files to be acceptable for configparser" + def __init__(self, filename): + with open(filename, 'r') as infile: + lines = infile.readlines() + self._lines = list() + self._num_lines = len(lines) + self._index = 0 + for line in lines: + self._lines.append(line.lstrip()) + + def readlines(self): + """Return all the lines from this object's file""" + return self._lines + + def readline(self, size=-1): + """Format and return the next line or raise StopIteration""" + try: + line = self.next() + except StopIteration: + line = '' + + if (size > 0) and (len(line) < size): + return line[0:size] + + return line + + def __iter__(self): + """Begin an iteration""" + self._index = 0 + return self + + def next(self): + """Return the next line or raise StopIteration""" + if self._index >= self._num_lines: + raise StopIteration + + self._index = self._index + 1 + return self._lines[self._index - 1] + + def __next__(self): + return self.next() + +def git_submodule_status(repo_dir): + """Run the git submodule status command to obtain submodule hashes. + """ + # This function is here instead of GitRepository to avoid a dependency loop + cwd = os.getcwd() + os.chdir(repo_dir) + cmd = ['git', 'submodule', 'status'] + git_output = execute_subprocess(cmd, output_to_caller=True) + submodules = {} + submods = git_output.split('\n') + for submod in submods: + if submod: + status = submod[0] + items = submod[1:].split(' ') + if len(items) > 2: + tag = items[2] + else: + tag = None + + submodules[items[1]] = {'hash':items[0], 'status':status, 'tag':tag} + + os.chdir(cwd) + return submodules + +def parse_submodules_desc_section(section_items, file_path): + """Find the path and url for this submodule description""" + path = None + url = None + for item in section_items: + name = item[0].strip().lower() + if name == 'path': + path = item[1].strip() + elif name == 'url': + url = item[1].strip() + else: + msg = 'WARNING: Ignoring unknown {} property, in {}' + msg = msg.format(item[0], file_path) # fool pylint + logging.warning(msg) + + return path, url + +def read_gitmodules_file(root_dir, file_name): + # pylint: disable=deprecated-method + # Disabling this check because the method is only used for python2 + """Read a .gitmodules file and convert it to be compatible with an + externals description. + """ + root_dir = os.path.abspath(root_dir) + msg = 'In directory : {0}'.format(root_dir) + logging.info(msg) + printlog('Processing submodules description file : {0}'.format(file_name)) + + file_path = os.path.join(root_dir, file_name) + if not os.path.exists(file_name): + msg = ('ERROR: submodules description file, "{0}", does not ' + 'exist at path:\n {1}'.format(file_name, file_path)) + fatal_error(msg) + + submodules_description = None externals_description = None try: config = config_parser() - config.read(file_path) - externals_description = config + if USE_PYTHON2: + config.readfp(LstripReader(file_path), filename=file_name) + else: + config.read_file(LstripReader(file_path), source=file_name) + + submodules_description = config except MissingSectionHeaderError: # not a cfg file pass - if externals_description is None: + if submodules_description is None: msg = 'Unknown file format!' fatal_error(msg) + else: + # Convert the submodules description to an externals description + externals_description = config_parser() + # We need to grab all the commit hashes for this repo + submods = git_submodule_status(root_dir) + for section in submodules_description.sections(): + if section[0:9] == 'submodule': + sec_name = section[9:].strip(' "') + externals_description.add_section(sec_name) + section_items = submodules_description.items(section) + path, url = parse_submodules_desc_section(section_items, + file_path) + + if path is None: + msg = 'Submodule {} missing path'.format(sec_name) + fatal_error(msg) - return externals_description + if url is None: + msg = 'Submodule {} missing url'.format(sec_name) + fatal_error(msg) + externals_description.set(sec_name, + ExternalsDescription.PATH, path) + externals_description.set(sec_name, + ExternalsDescription.PROTOCOL, 'git') + externals_description.set(sec_name, + ExternalsDescription.REPO_URL, url) + externals_description.set(sec_name, + ExternalsDescription.REQUIRED, 'True') + git_hash = submods[sec_name]['hash'] + externals_description.set(sec_name, + ExternalsDescription.HASH, git_hash) + + # Required items + externals_description.add_section(DESCRIPTION_SECTION) + externals_description.set(DESCRIPTION_SECTION, VERSION_ITEM, '1.0.0') + + return externals_description def create_externals_description( - model_data, model_format='cfg', components=None): + model_data, model_format='cfg', components=None, parent_repo=None): """Create the a externals description object from the provided data """ externals_description = None @@ -103,7 +272,7 @@ def create_externals_description( major, _, _ = get_cfg_schema_version(model_data) if major == 1: externals_description = ExternalsDescriptionConfigV1( - model_data, components=components) + model_data, components=components, parent_repo=parent_repo) else: msg = ('Externals description file has unsupported schema ' 'version "{0}".'.format(major)) @@ -173,18 +342,21 @@ class ExternalsDescription(dict): # keywords defining the interface into the externals description data EXTERNALS = 'externals' BRANCH = 'branch' - REPO = 'repo' - REQUIRED = 'required' - TAG = 'tag' + SUBMODULE = 'from_submodule' + HASH = 'hash' + NAME = 'name' PATH = 'local_path' PROTOCOL = 'protocol' + REPO = 'repo' REPO_URL = 'repo_url' - HASH = 'hash' - NAME = 'name' + REQUIRED = 'required' + TAG = 'tag' + SPARSE = 'sparse' PROTOCOL_EXTERNALS_ONLY = 'externals_only' PROTOCOL_GIT = 'git' PROTOCOL_SVN = 'svn' + GIT_SUBMODULES_FILENAME = '.gitmodules' KNOWN_PRROTOCOLS = [PROTOCOL_GIT, PROTOCOL_SVN, PROTOCOL_EXTERNALS_ONLY] # v1 xml keywords @@ -197,15 +369,17 @@ class ExternalsDescription(dict): _source_schema = {REQUIRED: True, PATH: 'string', EXTERNALS: 'string', + SUBMODULE : True, REPO: {PROTOCOL: 'string', REPO_URL: 'string', TAG: 'string', BRANCH: 'string', HASH: 'string', - } - } + SPARSE: 'string', + } + } - def __init__(self): + def __init__(self, parent_repo=None): """Convert the xml into a standardized dict that can be used to construct the source objects @@ -218,6 +392,7 @@ def __init__(self): self._input_major = None self._input_minor = None self._input_patch = None + self._parent_repo = parent_repo def _verify_schema_version(self): """Use semantic versioning rules to verify we can process this schema. @@ -265,6 +440,7 @@ def _check_user_input(self): self._validate() def _check_data(self): + # pylint: disable=too-many-branches,too-many-statements """Check user supplied data is valid where possible. """ for ext_name in self.keys(): @@ -282,6 +458,13 @@ def _check_data(self): ext_name)) fatal_error(msg) + if ((self[ext_name][self.REPO][self.PROTOCOL] != self.PROTOCOL_GIT) + and (self.SUBMODULE in self[ext_name])): + msg = ('self.SUBMODULE is only supported with {0} protocol, ' + '"{1}" is defined as an {2} repository') + fatal_error(msg.format(self.PROTOCOL_GIT, ext_name, + self[ext_name][self.REPO][self.PROTOCOL])) + if (self[ext_name][self.REPO][self.PROTOCOL] != self.PROTOCOL_EXTERNALS_ONLY): ref_count = 0 @@ -301,11 +484,23 @@ def _check_data(self): found_refs = '"{0} = {1}", {2}'.format( self.HASH, self[ext_name][self.REPO][self.HASH], found_refs) + if (self.SUBMODULE in self[ext_name] and + self[ext_name][self.SUBMODULE]): + ref_count += 1 + found_refs = '"{0} = {1}", {2}'.format( + self.SUBMODULE, + self[ext_name][self.SUBMODULE], found_refs) if ref_count > 1: - msg = ('Model description is over specified! Only one of ' - '"tag", "branch", or "hash" may be specified for ' - 'repo description of "{0}".'.format(ext_name)) + msg = 'Model description is over specified! ' + if self.SUBMODULE in self[ext_name]: + msg += ('from_submodule is not compatible with ' + '"tag", "branch", or "hash" ') + else: + msg += (' Only one of "tag", "branch", or "hash" ' + 'may be specified ') + + msg += 'for repo description of "{0}".'.format(ext_name) msg = '{0}\nFound: {1}'.format(msg, found_refs) fatal_error(msg) elif ref_count < 1: @@ -314,17 +509,39 @@ def _check_data(self): 'repo description of "{0}"'.format(ext_name)) fatal_error(msg) - if self.REPO_URL not in self[ext_name][self.REPO]: + if (self.REPO_URL not in self[ext_name][self.REPO] and + (self.SUBMODULE not in self[ext_name] or + not self[ext_name][self.SUBMODULE])): msg = ('Model description is under specified! Must have ' '"repo_url" in repo ' 'description for "{0}"'.format(ext_name)) fatal_error(msg) - url = expand_local_url( - self[ext_name][self.REPO][self.REPO_URL], ext_name) - self[ext_name][self.REPO][self.REPO_URL] = url + if (self.SUBMODULE in self[ext_name] and + self[ext_name][self.SUBMODULE]): + if self.REPO_URL in self[ext_name][self.REPO]: + msg = ('Model description is over specified! ' + 'from_submodule keyword is not compatible ' + 'with {0} keyword for'.format(self.REPO_URL)) + msg = '{0} repo description of "{1}"'.format(msg, + ext_name) + fatal_error(msg) + + if self.PATH in self[ext_name]: + msg = ('Model description is over specified! ' + 'from_submodule keyword is not compatible with ' + '{0} keyword for'.format(self.PATH)) + msg = '{0} repo description of "{1}"'.format(msg, + ext_name) + fatal_error(msg) + + if self.REPO_URL in self[ext_name][self.REPO]: + url = expand_local_url( + self[ext_name][self.REPO][self.REPO_URL], ext_name) + self[ext_name][self.REPO][self.REPO_URL] = url def _check_optional(self): + # pylint: disable=too-many-branches """Some fields like externals, repo:tag repo:branch are (conditionally) optional. We don't want the user to be required to enter them in every externals description file, but @@ -332,6 +549,7 @@ def _check_optional(self): default values if appropriate. """ + submod_desc = None # Only load submodules info once for field in self: # truely optional if self.EXTERNALS not in self[field]: @@ -346,6 +564,72 @@ def _check_optional(self): self[field][self.REPO][self.HASH] = EMPTY_STR if self.REPO_URL not in self[field][self.REPO]: self[field][self.REPO][self.REPO_URL] = EMPTY_STR + if self.SPARSE not in self[field][self.REPO]: + self[field][self.REPO][self.SPARSE] = EMPTY_STR + + # from_submodule has a complex relationship with other fields + if self.SUBMODULE in self[field]: + # User wants to use submodule information, is it available? + if self._parent_repo is None: + # No parent == no submodule information + PPRINTER.pprint(self[field]) + msg = 'No parent submodule for "{0}"'.format(field) + fatal_error(msg) + elif self._parent_repo.protocol() != self.PROTOCOL_GIT: + PPRINTER.pprint(self[field]) + msg = 'Parent protocol, "{0}", does not support submodules' + fatal_error(msg.format(self._parent_repo.protocol())) + else: + args = self._repo_config_from_submodule(field, submod_desc) + repo_url, repo_path, ref_hash, submod_desc = args + + if repo_url is None: + msg = ('Cannot checkout "{0}" as a submodule, ' + 'repo not found in {1} file') + fatal_error(msg.format(field, + self.GIT_SUBMODULES_FILENAME)) + # Fill in submodule fields + self[field][self.REPO][self.REPO_URL] = repo_url + self[field][self.REPO][self.HASH] = ref_hash + self[field][self.PATH] = repo_path + + if self[field][self.SUBMODULE]: + # We should get everything from the parent submodule + # configuration. + pass + # No else (from _submodule = False is the default) + else: + # Add the default value (not using submodule information) + self[field][self.SUBMODULE] = False + + def _repo_config_from_submodule(self, field, submod_desc): + """Find the external config information for a repository from + its submodule configuration information. + """ + if submod_desc is None: + repo_path = os.getcwd() # Is this always correct? + submod_file = self._parent_repo.submodules_file(repo_path=repo_path) + if submod_file is None: + msg = ('Cannot checkout "{0}" from submodule information\n' + ' Parent repo, "{1}" does not have submodules') + fatal_error(msg.format(field, self._parent_repo.name())) + + submod_file = read_gitmodules_file(repo_path, submod_file) + submod_desc = create_externals_description(submod_file) + + # Can we find our external? + repo_url = None + repo_path = None + ref_hash = None + for ext_field in submod_desc: + if field == ext_field: + ext = submod_desc[ext_field] + repo_url = ext[self.REPO][self.REPO_URL] + repo_path = ext[self.PATH] + ref_hash = ext[self.REPO][self.HASH] + break + + return repo_url, repo_path, ref_hash, submod_desc def _validate(self): """Validate that the parsed externals description contains all necessary @@ -383,11 +667,12 @@ def validate_data_struct(schema, data): if isinstance(schema, dict) and isinstance(data, dict): # Both are dicts, recursively verify that all fields # in schema are present in the data. - for k in schema: - in_ref = in_ref and (k in data) + for key in schema: + in_ref = in_ref and (key in data) if in_ref: valid = valid and ( - validate_data_struct(schema[k], data[k])) + validate_data_struct(schema[key], data[key])) + is_valid = in_ref and valid else: # non-recursive structure. verify data and schema have @@ -434,9 +719,9 @@ def __init__(self, model_data, components=None): self._input_patch = 0 self._verify_schema_version() if components: - for k in model_data.items(): - if k not in components: - del model_data[k] + for key in model_data.items(): + if key not in components: + del model_data[key] self.update(model_data) self._check_user_input() @@ -448,12 +733,12 @@ class ExternalsDescriptionConfigV1(ExternalsDescription): """ - def __init__(self, model_data, components=None): + def __init__(self, model_data, components=None, parent_repo=None): """Convert the config data into a standardized dict that can be used to construct the source objects """ - ExternalsDescription.__init__(self) + ExternalsDescription.__init__(self, parent_repo=parent_repo) self._schema_major = 1 self._schema_minor = 1 self._schema_patch = 0 diff --git a/manic/repository.py b/manic/repository.py index d01849d37a..ea4230fb7b 100644 --- a/manic/repository.py +++ b/manic/repository.py @@ -21,6 +21,7 @@ def __init__(self, component_name, repo): self._branch = repo[ExternalsDescription.BRANCH] self._hash = repo[ExternalsDescription.HASH] self._url = repo[ExternalsDescription.REPO_URL] + self._sparse = repo[ExternalsDescription.SPARSE] if self._url is EMPTY_STR: fatal_error('repo must have a URL') @@ -40,12 +41,14 @@ def __init__(self, component_name, repo): fatal_error('repo {0} must have exactly one of ' 'tag, branch or hash.'.format(self._name)) - def checkout(self, base_dir_path, repo_dir_name, verbosity): # pylint: disable=unused-argument + def checkout(self, base_dir_path, repo_dir_name, verbosity, recursive): # pylint: disable=unused-argument """ If the repo destination directory exists, ensure it is correct (from correct URL, correct branch or tag), and possibly update the source. If the repo destination directory does not exist, checkout the correce branch or tag. + NB: is include as an argument for compatibility with + git functionality (repository_git.py) """ msg = ('DEV_ERROR: checkout method must be implemented in all ' 'repository classes! {0}'.format(self.__class__.__name__)) @@ -59,6 +62,11 @@ def status(self, stat, repo_dir_path): # pylint: disable=unused-argument 'repository classes! {0}'.format(self.__class__.__name__)) fatal_error(msg) + def submodules_file(self, repo_path=None): + # pylint: disable=no-self-use,unused-argument + """Stub for use by non-git VC systems""" + return None + def url(self): """Public access of repo url. """ @@ -78,3 +86,13 @@ def hash(self): """Public access of repo hash. """ return self._hash + + def name(self): + """Public access of repo name. + """ + return self._name + + def protocol(self): + """Public access of repo protocol. + """ + return self._protocol diff --git a/manic/repository_factory.py b/manic/repository_factory.py index c95e7a509b..80a92a9d8a 100644 --- a/manic/repository_factory.py +++ b/manic/repository_factory.py @@ -11,7 +11,7 @@ from .utils import fatal_error -def create_repository(component_name, repo_info): +def create_repository(component_name, repo_info, svn_ignore_ancestry=False): """Determine what type of repository we have, i.e. git or svn, and create the appropriate object. @@ -20,7 +20,7 @@ def create_repository(component_name, repo_info): if protocol == 'git': repo = GitRepository(component_name, repo_info) elif protocol == 'svn': - repo = SvnRepository(component_name, repo_info) + repo = SvnRepository(component_name, repo_info, ignore_ancestry=svn_ignore_ancestry) elif protocol == 'externals_only': repo = None else: diff --git a/manic/repository_git.py b/manic/repository_git.py index efb775d0bc..f986051001 100644 --- a/manic/repository_git.py +++ b/manic/repository_git.py @@ -12,6 +12,7 @@ from .global_constants import VERBOSITY_VERBOSE from .repository import Repository from .externals_status import ExternalStatus +from .externals_description import ExternalsDescription, git_submodule_status from .utils import expand_local_url, split_remote_url, is_remote_url from .utils import fatal_error, printlog from .utils import execute_subprocess @@ -41,17 +42,19 @@ def __init__(self, component_name, repo): Parse repo (a XML element). """ Repository.__init__(self, component_name, repo) + self._gitmodules = None + self._submods = None # ---------------------------------------------------------------- # # Public API, defined by Repository # # ---------------------------------------------------------------- - def checkout(self, base_dir_path, repo_dir_name, verbosity): + def checkout(self, base_dir_path, repo_dir_name, verbosity, recursive): """ If the repo destination directory exists, ensure it is correct (from correct URL, correct branch or tag), and possibly update the source. - If the repo destination directory does not exist, checkout the correce + If the repo destination directory does not exist, checkout the correct branch or tag. """ repo_dir_path = os.path.join(base_dir_path, repo_dir_name) @@ -59,7 +62,15 @@ def checkout(self, base_dir_path, repo_dir_name, verbosity): if (repo_dir_exists and not os.listdir( repo_dir_path)) or not repo_dir_exists: self._clone_repo(base_dir_path, repo_dir_name, verbosity) - self._checkout_ref(repo_dir_path, verbosity) + self._checkout_ref(repo_dir_path, verbosity, recursive) + gmpath = os.path.join(repo_dir_path, + ExternalsDescription.GIT_SUBMODULES_FILENAME) + if os.path.exists(gmpath): + self._gitmodules = gmpath + self._submods = git_submodule_status(repo_dir_path) + else: + self._gitmodules = None + self._submods = None def status(self, stat, repo_dir_path): """ @@ -72,6 +83,16 @@ def status(self, stat, repo_dir_path): if os.path.exists(repo_dir_path): self._status_summary(stat, repo_dir_path) + def submodules_file(self, repo_path=None): + if repo_path is not None: + gmpath = os.path.join(repo_path, + ExternalsDescription.GIT_SUBMODULES_FILENAME) + if os.path.exists(gmpath): + self._gitmodules = gmpath + self._submods = git_submodule_status(repo_path) + + return self._gitmodules + # ---------------------------------------------------------------- # # Internal work functions @@ -282,23 +303,30 @@ def _create_remote_name(self): remote_name = "{0}_{1}".format(base_name, repo_name) return remote_name - def _checkout_ref(self, repo_dir, verbosity): + def _checkout_ref(self, repo_dir, verbosity, submodules): """Checkout the user supplied reference + if is True, recursively initialize and update + the repo's submodules """ # import pdb; pdb.set_trace() cwd = os.getcwd() os.chdir(repo_dir) if self._url.strip() == LOCAL_PATH_INDICATOR: - self._checkout_local_ref(verbosity) + self._checkout_local_ref(verbosity, submodules) else: - self._checkout_external_ref(verbosity) + self._checkout_external_ref(verbosity, submodules) + + if self._sparse: + self._sparse_checkout(repo_dir, verbosity) os.chdir(cwd) - def _checkout_local_ref(self, verbosity): + + def _checkout_local_ref(self, verbosity, submodules): """Checkout the reference considering the local repo only. Do not fetch any additional remotes or specify the remote when checkout out the ref. - + if is True, recursively initialize and update + the repo's submodules """ if self._tag: ref = self._tag @@ -308,10 +336,12 @@ def _checkout_local_ref(self, verbosity): ref = self._hash self._check_for_valid_ref(ref) - self._git_checkout_ref(ref, verbosity) + self._git_checkout_ref(ref, verbosity, submodules) - def _checkout_external_ref(self, verbosity): + def _checkout_external_ref(self, verbosity, submodules): """Checkout the reference from a remote repository + if is True, recursively initialize and update + the repo's submodules """ if self._tag: ref = self._tag @@ -326,14 +356,28 @@ def _checkout_external_ref(self, verbosity): self._git_remote_add(remote_name, self._url) self._git_fetch(remote_name) - # NOTE(bja, 2018-03) we need to send seperate ref and remote + # NOTE(bja, 2018-03) we need to send separate ref and remote # name to check_for_vaild_ref, but the combined name to # checkout_ref! self._check_for_valid_ref(ref, remote_name) if self._branch: ref = '{0}/{1}'.format(remote_name, ref) - self._git_checkout_ref(ref, verbosity) + self._git_checkout_ref(ref, verbosity, submodules) + + def _sparse_checkout(self, repo_dir, verbosity): + """Use git read-tree to thin the working tree.""" + cwd = os.getcwd() + + cmd = ['cp', self._sparse, os.path.join(repo_dir, + '.git/info/sparse-checkout')] + if verbosity >= VERBOSITY_VERBOSE: + printlog(' {0}'.format(' '.join(cmd))) + execute_subprocess(cmd) + os.chdir(repo_dir) + self._git_sparse_checkout(verbosity) + + os.chdir(cwd) def _check_for_valid_ref(self, ref, remote_name=None): """Try some basic sanity checks on the user supplied reference so we @@ -687,6 +731,19 @@ def _git_remote_verbose(): git_output = execute_subprocess(cmd, output_to_caller=True) return git_output + @staticmethod + def has_submodules(repo_dir_path=None): + """Return True iff the repository at (or the current + directory if is None) has a '.gitmodules' file + """ + if repo_dir_path is None: + fname = ExternalsDescription.GIT_SUBMODULES_FILENAME + else: + fname = os.path.join(repo_dir_path, + ExternalsDescription.GIT_SUBMODULES_FILENAME) + + return os.path.exists(fname) + # ---------------------------------------------------------------- # # system call to git for sideffects modifying the working tree @@ -696,28 +753,34 @@ def _git_remote_verbose(): def _git_clone(url, repo_dir_name, verbosity): """Run git clone for the side effect of creating a repository. """ - cmd = ['git', 'clone', '--quiet', url, repo_dir_name] + cmd = ['git', 'clone', '--quiet'] + subcmd = None + + cmd.extend([url, repo_dir_name]) if verbosity >= VERBOSITY_VERBOSE: printlog(' {0}'.format(' '.join(cmd))) execute_subprocess(cmd) + if subcmd is not None: + os.chdir(repo_dir_name) + execute_subprocess(subcmd) @staticmethod def _git_remote_add(name, url): - """Run the git remote command to for the side effect of adding a remote + """Run the git remote command for the side effect of adding a remote """ cmd = ['git', 'remote', 'add', name, url] execute_subprocess(cmd) @staticmethod def _git_fetch(remote_name): - """Run the git fetch command to for the side effect of updating the repo + """Run the git fetch command for the side effect of updating the repo """ cmd = ['git', 'fetch', '--quiet', '--tags', remote_name] execute_subprocess(cmd) @staticmethod - def _git_checkout_ref(ref, verbosity): - """Run the git checkout command to for the side effect of updating the repo + def _git_checkout_ref(ref, verbosity, submodules): + """Run the git checkout command for the side effect of updating the repo Param: ref is a reference to a local or remote object in the form 'origin/my_feature', or 'tag1'. @@ -727,3 +790,30 @@ def _git_checkout_ref(ref, verbosity): if verbosity >= VERBOSITY_VERBOSE: printlog(' {0}'.format(' '.join(cmd))) execute_subprocess(cmd) + if submodules: + GitRepository._git_update_submodules(verbosity) + + @staticmethod + def _git_sparse_checkout(verbosity): + """Configure repo via read-tree.""" + cmd = ['git', 'config', 'core.sparsecheckout', 'true'] + if verbosity >= VERBOSITY_VERBOSE: + printlog(' {0}'.format(' '.join(cmd))) + execute_subprocess(cmd) + cmd = ['git', 'read-tree', '-mu', 'HEAD'] + if verbosity >= VERBOSITY_VERBOSE: + printlog(' {0}'.format(' '.join(cmd))) + execute_subprocess(cmd) + + @staticmethod + def _git_update_submodules(verbosity): + """Run git submodule update for the side effect of updating this + repo's submodules. + """ + # First, verify that we have a .gitmodules file + if os.path.exists(ExternalsDescription.GIT_SUBMODULES_FILENAME): + cmd = ['git', 'submodule', 'update', '--init', '--recursive'] + if verbosity >= VERBOSITY_VERBOSE: + printlog(' {0}'.format(' '.join(cmd))) + + execute_subprocess(cmd) diff --git a/manic/repository_svn.py b/manic/repository_svn.py index bef6f81414..408ed84676 100644 --- a/manic/repository_svn.py +++ b/manic/repository_svn.py @@ -37,11 +37,12 @@ class SvnRepository(Repository): """ RE_URLLINE = re.compile(r'^URL:') - def __init__(self, component_name, repo): + def __init__(self, component_name, repo, ignore_ancestry=False): """ Parse repo (a XML element). """ Repository.__init__(self, component_name, repo) + self._ignore_ancestry = ignore_ancestry if self._branch: self._url = os.path.join(self._url, self._branch) elif self._tag: @@ -55,7 +56,7 @@ def __init__(self, component_name, repo): # Public API, defined by Repository # # ---------------------------------------------------------------- - def checkout(self, base_dir_path, repo_dir_name, verbosity): + def checkout(self, base_dir_path, repo_dir_name, verbosity, recursive): # pylint: disable=unused-argument """Checkout or update the working copy If the repo destination directory exists, switch the sandbox to @@ -63,13 +64,15 @@ def checkout(self, base_dir_path, repo_dir_name, verbosity): If the repo destination directory does not exist, checkout the correct branch or tag. + NB: is include as an argument for compatibility with + git functionality (repository_git.py) """ repo_dir_path = os.path.join(base_dir_path, repo_dir_name) if os.path.exists(repo_dir_path): cwd = os.getcwd() os.chdir(repo_dir_path) - self._svn_switch(self._url, verbosity) + self._svn_switch(self._url, self._ignore_ancestry, verbosity) # svn switch can lead to a conflict state, but it gives a # return code of 0. So now we need to make sure that we're # in a clean (non-conflict) state. @@ -137,9 +140,7 @@ def _abort_if_dirty(self, repo_dir_path, message): To recover: Clean up the above directory (resolving conflicts, etc.), then rerun checkout_externals. -""".format(cwd=repo_dir_path, - message=message, - status=status) +""".format(cwd=repo_dir_path, message=message, status=status) fatal_error(errmsg) @@ -219,9 +220,8 @@ def xml_status_is_dirty(svn_output): continue if item == SVN_UNVERSIONED: continue - else: - is_dirty = True - break + is_dirty = True + break return is_dirty # ---------------------------------------------------------------- @@ -270,11 +270,14 @@ def _svn_checkout(url, repo_dir_path, verbosity): execute_subprocess(cmd) @staticmethod - def _svn_switch(url, verbosity): + def _svn_switch(url, ignore_ancestry, verbosity): """ Switch branches for in an svn sandbox """ - cmd = ['svn', 'switch', '--quiet', url] + cmd = ['svn', 'switch', '--quiet'] + if ignore_ancestry: + cmd.append('--ignore-ancestry') + cmd.append(url) if verbosity >= VERBOSITY_VERBOSE: printlog(' {0}'.format(' '.join(cmd))) execute_subprocess(cmd) diff --git a/manic/sourcetree.py b/manic/sourcetree.py index dff91dc1af..b9c9c21082 100644 --- a/manic/sourcetree.py +++ b/manic/sourcetree.py @@ -11,12 +11,12 @@ from .externals_description import read_externals_description_file from .externals_description import create_externals_description from .repository_factory import create_repository +from .repository_git import GitRepository from .externals_status import ExternalStatus from .utils import fatal_error, printlog from .global_constants import EMPTY_STR, LOCAL_PATH_INDICATOR from .global_constants import VERBOSITY_VERBOSE - class _External(object): """ _External represents an external object inside a SourceTree @@ -24,7 +24,7 @@ class _External(object): # pylint: disable=R0902 - def __init__(self, root_dir, name, ext_description): + def __init__(self, root_dir, name, ext_description, svn_ignore_ancestry): """Parse an external description file into a dictionary of externals. Input: @@ -37,12 +37,15 @@ def __init__(self, root_dir, name, ext_description): ext_description : dict - source ExternalsDescription object + svn_ignore_ancestry : bool - use --ignore-externals with svn switch + """ self._name = name self._repo = None self._externals = EMPTY_STR self._externals_sourcetree = None self._stat = ExternalStatus() + self._sparse = None # Parse the sub-elements # _path : local path relative to the containing source tree @@ -59,13 +62,20 @@ def __init__(self, root_dir, name, ext_description): self._required = ext_description[ExternalsDescription.REQUIRED] self._externals = ext_description[ExternalsDescription.EXTERNALS] - if self._externals: - self._create_externals_sourcetree() + # Treat a .gitmodules file as a backup externals config + if not self._externals: + if GitRepository.has_submodules(self._repo_dir_path): + self._externals = ExternalsDescription.GIT_SUBMODULES_FILENAME + repo = create_repository( - name, ext_description[ExternalsDescription.REPO]) + name, ext_description[ExternalsDescription.REPO], + svn_ignore_ancestry=svn_ignore_ancestry) if repo: self._repo = repo + if self._externals and (self._externals.lower() != 'none'): + self._create_externals_sourcetree() + def get_name(self): """ Return the external object's name @@ -122,7 +132,7 @@ def status(self): if self._externals and self._externals_sourcetree: # we expect externals and they exist cwd = os.getcwd() - # SourceTree expecteds to be called from the correct + # SourceTree expects to be called from the correct # root directory. os.chdir(self._repo_dir_path) ext_stats = self._externals_sourcetree.status(self._local_path) @@ -145,7 +155,7 @@ def checkout(self, verbosity, load_all): """ If the repo destination directory exists, ensure it is correct (from correct URL, correct branch or tag), and possibly update the external. - If the repo destination directory does not exist, checkout the correce + If the repo destination directory does not exist, checkout the correct branch or tag. If load_all is True, also load all of the the externals sub-externals. """ @@ -180,13 +190,14 @@ def checkout(self, verbosity, load_all): checkout_verbosity = verbosity - 1 else: checkout_verbosity = verbosity - self._repo.checkout(self._base_dir_path, - self._repo_dir_name, checkout_verbosity) + + self._repo.checkout(self._base_dir_path, self._repo_dir_name, + checkout_verbosity, self.clone_recursive()) def checkout_externals(self, verbosity, load_all): """Checkout the sub-externals for this object """ - if self._externals: + if self.load_externals(): if self._externals_sourcetree: # NOTE(bja, 2018-02): the subtree externals objects # were created during initial status check. Updating @@ -198,6 +209,24 @@ def checkout_externals(self, verbosity, load_all): self._create_externals_sourcetree() self._externals_sourcetree.checkout(verbosity, load_all) + def load_externals(self): + 'Return True iff an externals file should be loaded' + load_ex = False + if os.path.exists(self._repo_dir_path): + if self._externals: + if self._externals.lower() != 'none': + load_ex = os.path.exists(os.path.join(self._repo_dir_path, + self._externals)) + + return load_ex + + def clone_recursive(self): + 'Return True iff any .gitmodules files should be processed' + # Try recursive unless there is an externals entry + recursive = not self._externals + + return recursive + def _create_externals_sourcetree(self): """ """ @@ -210,6 +239,15 @@ def _create_externals_sourcetree(self): cwd = os.getcwd() os.chdir(self._repo_dir_path) + if self._externals.lower() == 'none': + msg = ('Internal: Attempt to create source tree for ' + 'externals = none in {}'.format(self._repo_dir_path)) + fatal_error(msg) + + if not os.path.exists(self._externals): + if GitRepository.has_submodules(): + self._externals = ExternalsDescription.GIT_SUBMODULES_FILENAME + if not os.path.exists(self._externals): # NOTE(bja, 2017-10) this check is redundent with the one # in read_externals_description_file! @@ -221,17 +259,17 @@ def _create_externals_sourcetree(self): externals_root = self._repo_dir_path model_data = read_externals_description_file(externals_root, self._externals) - externals = create_externals_description(model_data) + externals = create_externals_description(model_data, + parent_repo=self._repo) self._externals_sourcetree = SourceTree(externals_root, externals) os.chdir(cwd) - class SourceTree(object): """ SourceTree represents a group of managed externals """ - def __init__(self, root_dir, model): + def __init__(self, root_dir, model, svn_ignore_ancestry=False): """ Build a SourceTree object from a model description """ @@ -239,7 +277,7 @@ def __init__(self, root_dir, model): self._all_components = {} self._required_compnames = [] for comp in model: - src = _External(self._root_dir, comp, model[comp]) + src = _External(self._root_dir, comp, model[comp], svn_ignore_ancestry) self._all_components[comp] = src if model[comp][ExternalsDescription.REQUIRED]: self._required_compnames.append(comp) @@ -261,18 +299,20 @@ def status(self, relative_path_base=LOCAL_PATH_INDICATOR): for comp in load_comps: printlog('{0}, '.format(comp), end='') stat = self._all_components[comp].status() + stat_final = {} for name in stat.keys(): # check if we need to append the relative_path_base to # the path so it will be sorted in the correct order. - if not stat[name].path.startswith(relative_path_base): - stat[name].path = os.path.join(relative_path_base, - stat[name].path) - # store under key = updated path, and delete the - # old key. - comp_stat = stat[name] - del stat[name] - stat[comp_stat.path] = comp_stat - summary.update(stat) + if stat[name].path.startswith(relative_path_base): + # use as is, without any changes to path + stat_final[name] = stat[name] + else: + # append relative_path_base to path and store under key = updated path + modified_path = os.path.join(relative_path_base, + stat[name].path) + stat_final[modified_path] = stat[name] + stat_final[modified_path].path = modified_path + summary.update(stat_final) return summary diff --git a/test/repos/simple-ext.git/objects/14/2711fdbbcb8034d7cad6bae6801887b12fe61d b/test/repos/simple-ext.git/objects/14/2711fdbbcb8034d7cad6bae6801887b12fe61d new file mode 100644 index 0000000000000000000000000000000000000000..acaf7889b47c54ee0dea121c73d505ca14ad369b GIT binary patch literal 83 zcmV-Z0IdIb0ZYosPg1ZjWC+Q~ELKR%%t=)!&d4v#Nl{3x$Sf{V$jnnnRLILO%1z8s pNX|%2&dx6_QAh$}pz8eG%#xDS6o{JQg2bZYRJa;FE&z4gA7ySEC>H<# literal 0 HcmV?d00001 diff --git a/test/repos/simple-ext.git/objects/60/7ec299c17dd285c029edc41a0109e49d441380 b/test/repos/simple-ext.git/objects/60/7ec299c17dd285c029edc41a0109e49d441380 new file mode 100644 index 0000000000000000000000000000000000000000..3f6959cc54afd45fa4f64be25ccb3bb8580183c9 GIT binary patch literal 168 zcmV;Z09XHb0hNwR4#F@D1zG15z5poBzY;=l6vuV}(Nff=3vN&02JB|>MsIi;$9n_k z!>-M$Ac)DAYy~^^qUu9WLY{J}xkT>CQ3)XSx>0V^p=O;s>7G-EI{FfcPQQP4}zEXhpI%P&f0aFl&|Gw+GS!K3kZ)1Ezh zejs~i1S3>cQEFmJZmM2MMG3KlvCEtNF?@%PbVOT{Nm)vLb%0Bl_``r7C@umAu6 literal 0 HcmV?d00001 diff --git a/test/repos/simple-ext.git/objects/d8/ed2f33179d751937f8fde2e33921e4827babf4 b/test/repos/simple-ext.git/objects/d8/ed2f33179d751937f8fde2e33921e4827babf4 new file mode 100644 index 0000000000000000000000000000000000000000..f08ae820c9c89927f9898c5646134f7c519a6b04 GIT binary patch literal 60 zcmV-C0K@-y0V^p=O;s>4W-v4`Ff%bxC@xJ($t;Rb%gjmDE2$`95K$NWyZdy5$@Np$ Sc0Fs5Xy2&+OcnsW_!K#a0~pW% literal 0 HcmV?d00001 diff --git a/test/repos/simple-ext.git/refs/heads/master b/test/repos/simple-ext.git/refs/heads/master index 5c67504966..adf1ccb002 100644 --- a/test/repos/simple-ext.git/refs/heads/master +++ b/test/repos/simple-ext.git/refs/heads/master @@ -1 +1 @@ -9b75494003deca69527bb64bcaa352e801611dd2 +607ec299c17dd285c029edc41a0109e49d441380 diff --git a/test/repos/simple-ext.git/refs/tags/tag2 b/test/repos/simple-ext.git/refs/tags/tag2 new file mode 100644 index 0000000000..4160b6c494 --- /dev/null +++ b/test/repos/simple-ext.git/refs/tags/tag2 @@ -0,0 +1 @@ +b7692b6d391899680da7b9b6fd8af4c413f06fe7 diff --git a/test/test_sys_checkout.py b/test/test_sys_checkout.py index 9ebfb0aeee..df726f2b70 100644 --- a/test/test_sys_checkout.py +++ b/test/test_sys_checkout.py @@ -42,6 +42,7 @@ from manic.externals_description import ExternalsDescription from manic.externals_description import DESCRIPTION_SECTION, VERSION_ITEM +from manic.externals_description import git_submodule_status from manic.externals_status import ExternalStatus from manic.repository_git import GitRepository from manic.utils import printlog, execute_subprocess @@ -87,6 +88,8 @@ SVN_TEST_REPO = 'https://github.com/escomp/cesm' +# Disable too-many-public-methods error +# pylint: disable=R0904 def setUpModule(): # pylint: disable=C0103 """Setup for all tests in this module. It is called once per module! @@ -139,7 +142,7 @@ def container_full(self, dest_dir): self.create_section(MIXED_REPO_NAME, 'mixed_req', branch='master', externals=CFG_SUB_NAME) - self._write_config(dest_dir) + self.write_config(dest_dir) def container_simple_required(self, dest_dir): """Create a container externals file with only simple externals. @@ -155,7 +158,7 @@ def container_simple_required(self, dest_dir): self.create_section(SIMPLE_REPO_NAME, 'simp_hash', ref_hash='60b1cc1a38d63') - self._write_config(dest_dir) + self.write_config(dest_dir) def container_simple_optional(self, dest_dir): """Create a container externals file with optional simple externals @@ -168,7 +171,7 @@ def container_simple_optional(self, dest_dir): self.create_section(SIMPLE_REPO_NAME, 'simp_opt', tag='tag1', required=False) - self._write_config(dest_dir) + self.write_config(dest_dir) def container_simple_svn(self, dest_dir): """Create a container externals file with only simple externals. @@ -180,7 +183,26 @@ def container_simple_svn(self, dest_dir): self.create_svn_external('svn_branch', branch='trunk') self.create_svn_external('svn_tag', tag='tags/cesm2.0.beta07') - self._write_config(dest_dir) + self.write_config(dest_dir) + + def container_sparse(self, dest_dir): + """Create a container with a full external and a sparse external + + """ + # Create a file for a sparse pattern match + sparse_filename = 'sparse_checkout' + with open(os.path.join(dest_dir, sparse_filename), 'w') as sfile: + sfile.write('readme.txt') + + self.create_config() + self.create_section(SIMPLE_REPO_NAME, 'simp_tag', + tag='tag2') + + sparse_relpath = '../../{}'.format(sparse_filename) + self.create_section(SIMPLE_REPO_NAME, 'simp_sparse', + tag='tag2', sparse=sparse_relpath) + + self.write_config(dest_dir) def mixed_simple_base(self, dest_dir): """Create a mixed-use base externals file with only simple externals. @@ -197,7 +219,7 @@ def mixed_simple_base(self, dest_dir): self.create_section(SIMPLE_REPO_NAME, 'simp_hash', ref_hash='60b1cc1a38d63') - self._write_config(dest_dir) + self.write_config(dest_dir) def mixed_simple_sub(self, dest_dir): """Create a mixed-use sub externals file with only simple externals. @@ -211,9 +233,9 @@ def mixed_simple_sub(self, dest_dir): branch=REMOTE_BRANCH_FEATURE2, path=SUB_EXTERNALS_PATH) - self._write_config(dest_dir, filename=CFG_SUB_NAME) + self.write_config(dest_dir, filename=CFG_SUB_NAME) - def _write_config(self, dest_dir, filename=CFG_NAME): + def write_config(self, dest_dir, filename=CFG_NAME): """Write the configuration file to disk """ @@ -237,22 +259,41 @@ def create_metadata(self): self._schema_version) def create_section(self, repo_type, name, tag='', branch='', - ref_hash='', - required=True, path=EXTERNALS_NAME, externals=''): + ref_hash='', required=True, path=EXTERNALS_NAME, + externals='', repo_path=None, from_submodule=False, + sparse=''): + # pylint: disable=too-many-branches """Create a config section with autofilling some items and handling optional items. """ # pylint: disable=R0913 self._config.add_section(name) - self._config.set(name, ExternalsDescription.PATH, - os.path.join(path, name)) + if not from_submodule: + self._config.set(name, ExternalsDescription.PATH, + os.path.join(path, name)) self._config.set(name, ExternalsDescription.PROTOCOL, ExternalsDescription.PROTOCOL_GIT) - repo_url = os.path.join('${MANIC_TEST_BARE_REPO_ROOT}', repo_type) - self._config.set(name, ExternalsDescription.REPO_URL, repo_url) + # from_submodules is incompatible with some other options, turn them off + if (from_submodule and + ((repo_path is not None) or tag or ref_hash or branch)): + printlog('create_section: "from_submodule" is incompatible with ' + '"repo_url", "tag", "hash", and "branch" options;\n' + 'Ignoring those options for {}'.format(name)) + repo_url = None + tag = '' + ref_hash = '' + branch = '' + + if repo_path is not None: + repo_url = repo_path + else: + repo_url = os.path.join('${MANIC_TEST_BARE_REPO_ROOT}', repo_type) + + if not from_submodule: + self._config.set(name, ExternalsDescription.REPO_URL, repo_url) self._config.set(name, ExternalsDescription.REQUIRED, str(required)) @@ -268,6 +309,12 @@ def create_section(self, repo_type, name, tag='', branch='', if externals: self._config.set(name, ExternalsDescription.EXTERNALS, externals) + if sparse: + self._config.set(name, ExternalsDescription.SPARSE, sparse) + + if from_submodule: + self._config.set(name, ExternalsDescription.SUBMODULE, "True") + def create_section_ext_only(self, name, required=True, externals=CFG_SUB_NAME): """Create a config section with autofilling some items and handling @@ -377,7 +424,7 @@ def update_branch(self, dest_dir, name, branch, repo_type=None, except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_svn_branch(self, dest_dir, name, branch, filename=CFG_NAME): """Update a repository branch, and potentially the remote. @@ -391,7 +438,7 @@ def update_svn_branch(self, dest_dir, name, branch, filename=CFG_NAME): except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_tag(self, dest_dir, name, tag, repo_type=None, filename=CFG_NAME, remove_branch=True): @@ -416,7 +463,7 @@ def update_tag(self, dest_dir, name, tag, repo_type=None, except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_underspecify_branch_tag(self, dest_dir, name, filename=CFG_NAME): @@ -435,7 +482,7 @@ def update_underspecify_branch_tag(self, dest_dir, name, except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_underspecify_remove_url(self, dest_dir, name, filename=CFG_NAME): @@ -448,7 +495,7 @@ def update_underspecify_remove_url(self, dest_dir, name, except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_protocol(self, dest_dir, name, protocol, repo_type=None, filename=CFG_NAME): @@ -461,7 +508,7 @@ def update_protocol(self, dest_dir, name, protocol, repo_type=None, repo_url = os.path.join('${MANIC_TEST_BARE_REPO_ROOT}', repo_type) self._config.set(name, ExternalsDescription.REPO_URL, repo_url) - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) class BaseTestSysCheckout(unittest.TestCase): @@ -513,7 +560,7 @@ def tearDown(self): # return to our common starting point os.chdir(self._return_dir) - def setup_test_repo(self, parent_repo_name): + def setup_test_repo(self, parent_repo_name, dest_dir_in=None): """Setup the paths and clone the base test repo """ @@ -522,8 +569,12 @@ def setup_test_repo(self, parent_repo_name): print("Test repository name: {0}".format(test_dir_name)) parent_repo_dir = os.path.join(self._bare_root, parent_repo_name) - dest_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT], - test_dir_name) + if dest_dir_in is None: + dest_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT], + test_dir_name) + else: + dest_dir = dest_dir_in + # pylint: disable=W0212 GitRepository._git_clone(parent_repo_dir, dest_dir, VERBOSITY_DEFAULT) return dest_dir @@ -684,6 +735,14 @@ def _check_mixed_ext_branch_modified(self, tree, directory=EXTERNALS_NAME): name = './{0}/mixed_req'.format(directory) self._check_generic_modified_ok_required(tree, name) + def _check_simple_sparse_empty(self, tree, directory=EXTERNALS_NAME): + name = './{0}/simp_sparse'.format(directory) + self._check_generic_empty_default_required(tree, name) + + def _check_simple_sparse_ok(self, tree, directory=EXTERNALS_NAME): + name = './{0}/simp_sparse'.format(directory) + self._check_generic_ok_clean_required(tree, name) + # ---------------------------------------------------------------- # # Check results for groups of externals under specific conditions @@ -844,6 +903,23 @@ def _check_mixed_cont_simple_required_post_checkout(self, overall, tree): self._check_simple_branch_ok(tree, directory=EXTERNALS_NAME) self._check_simple_branch_ok(tree, directory=SUB_EXTERNALS_PATH) + def _check_container_sparse_pre_checkout(self, overall, tree): + self.assertEqual(overall, 0) + self._check_simple_tag_empty(tree) + self._check_simple_sparse_empty(tree) + + def _check_container_sparse_post_checkout(self, overall, tree): + self.assertEqual(overall, 0) + self._check_simple_tag_ok(tree) + self._check_simple_sparse_ok(tree) + + def _check_file_exists(self, repo_dir, pathname): + "Check that exists in " + self.assertTrue(os.path.exists(os.path.join(repo_dir, pathname))) + + def _check_file_absent(self, repo_dir, pathname): + "Check that does not exist in " + self.assertFalse(os.path.exists(os.path.join(repo_dir, pathname))) class TestSysCheckout(BaseTestSysCheckout): """Run systems level tests of checkout_externals @@ -1208,6 +1284,14 @@ def test_container_full(self): self.status_args) self._check_container_full_post_checkout(overall, tree) + # Check existance of some files + subrepo_path = os.path.join('externals', 'simp_tag') + self._check_file_exists(under_test_dir, + os.path.join(subrepo_path, 'readme.txt')) + self._check_file_absent(under_test_dir, os.path.join(subrepo_path, + 'simple_subdir', + 'subdir_file.txt')) + # update the mixed-use repo to point to different branch self._generator.update_branch(under_test_dir, 'mixed_req', 'new-feature', MIXED_REPO_NAME) @@ -1288,6 +1372,40 @@ def test_mixed_simple(self): self.status_args) self._check_mixed_cont_simple_required_post_checkout(overall, tree) + def test_container_sparse(self): + """Verify that 'full' container with simple subrepo + can run a sparse checkout and generate the correct initial status. + + """ + # create the test repository + under_test_dir = self.setup_test_repo(CONTAINER_REPO_NAME) + + # create the top level externals file + self._generator.container_sparse(under_test_dir) + + # inital checkout + overall, tree = self.execute_cmd_in_dir(under_test_dir, + self.checkout_args) + self._check_container_sparse_pre_checkout(overall, tree) + + overall, tree = self.execute_cmd_in_dir(under_test_dir, + self.status_args) + self._check_container_sparse_post_checkout(overall, tree) + + # Check existance of some files + subrepo_path = os.path.join('externals', 'simp_tag') + self._check_file_exists(under_test_dir, + os.path.join(subrepo_path, 'readme.txt')) + self._check_file_exists(under_test_dir, os.path.join(subrepo_path, + 'simple_subdir', + 'subdir_file.txt')) + subrepo_path = os.path.join('externals', 'simp_sparse') + self._check_file_exists(under_test_dir, + os.path.join(subrepo_path, 'readme.txt')) + self._check_file_absent(under_test_dir, os.path.join(subrepo_path, + 'simple_subdir', + 'subdir_file.txt')) + class TestSysCheckoutSVN(BaseTestSysCheckout): """Run systems level tests of checkout_externals accessing svn repositories @@ -1434,6 +1552,237 @@ def test_container_simple_svn(self): self.verbose_args) self._check_container_simple_svn_post_checkout(overall, tree) +class TestSubrepoCheckout(BaseTestSysCheckout): + # Need to store information at setUp time for checking + # pylint: disable=too-many-instance-attributes + """Run tests to ensure proper handling of repos with submodules. + + By default, submodules in git repositories are checked out. A git + repository checked out as a submodule is treated as if it was + listed in an external with the same properties as in the source + .gitmodules file. + """ + + def setUp(self): + """Setup for all submodule checkout tests + Create a repo with two submodule repositories. + """ + + # Run the basic setup + super(TestSubrepoCheckout, self).setUp() + # create test repo + # We need to do this here (rather than have a static repo) because + # git submodules do not allow for variables in .gitmodules files + self._test_repo_name = 'test_repo_with_submodules' + self._bare_branch_name = 'subrepo_branch' + self._config_branch_name = 'subrepo_config_branch' + self._container_extern_name = 'externals_container.cfg' + self._my_test_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT], + self._test_id) + self._repo_dir = os.path.join(self._my_test_dir, self._test_repo_name) + self._checkout_dir = 'repo_with_submodules' + check_dir = self.setup_test_repo(CONTAINER_REPO_NAME, + dest_dir_in=self._repo_dir) + self.assertTrue(self._repo_dir == check_dir) + # Add the submodules + cwd = os.getcwd() + fork_repo_dir = os.path.join(self._bare_root, SIMPLE_FORK_NAME) + simple_repo_dir = os.path.join(self._bare_root, SIMPLE_REPO_NAME) + self._simple_ext_fork_name = SIMPLE_FORK_NAME.split('.')[0] + self._simple_ext_name = SIMPLE_REPO_NAME.split('.')[0] + os.chdir(self._repo_dir) + # Add a branch with a subrepo + cmd = ['git', 'branch', self._bare_branch_name, 'master'] + execute_subprocess(cmd) + cmd = ['git', 'checkout', self._bare_branch_name] + execute_subprocess(cmd) + cmd = ['git', 'submodule', 'add', fork_repo_dir] + execute_subprocess(cmd) + cmd = ['git', 'commit', '-am', "'Added simple-ext-fork as a submodule'"] + execute_subprocess(cmd) + # Save the fork repo hash for comparison + os.chdir(self._simple_ext_fork_name) + self._fork_hash_check = self.get_git_hash() + os.chdir(self._repo_dir) + # Now, create a branch to test from_sbmodule + cmd = ['git', 'branch', + self._config_branch_name, self._bare_branch_name] + execute_subprocess(cmd) + cmd = ['git', 'checkout', self._config_branch_name] + execute_subprocess(cmd) + cmd = ['git', 'submodule', 'add', simple_repo_dir] + execute_subprocess(cmd) + # Checkout feature2 + os.chdir(self._simple_ext_name) + cmd = ['git', 'branch', 'feature2', 'origin/feature2'] + execute_subprocess(cmd) + cmd = ['git', 'checkout', 'feature2'] + execute_subprocess(cmd) + # Save the fork repo hash for comparison + self._simple_hash_check = self.get_git_hash() + os.chdir(self._repo_dir) + self.create_externals_file(filename=self._container_extern_name, + dest_dir=self._repo_dir, from_submodule=True) + cmd = ['git', 'add', self._container_extern_name] + execute_subprocess(cmd) + cmd = ['git', 'commit', '-am', "'Added simple-ext as a submodule'"] + execute_subprocess(cmd) + # Reset to master + cmd = ['git', 'checkout', 'master'] + execute_subprocess(cmd) + os.chdir(cwd) + + @staticmethod + def get_git_hash(revision="HEAD"): + """Return the hash for """ + cmd = ['git', 'rev-parse', revision] + git_out = execute_subprocess(cmd, output_to_caller=True) + return git_out.strip() + + def create_externals_file(self, name='', filename=CFG_NAME, dest_dir=None, + branch_name=None, sub_externals=None, + from_submodule=False): + # pylint: disable=too-many-arguments + """Create a container externals file with only simple externals. + + """ + self._generator.create_config() + + if dest_dir is None: + dest_dir = self._my_test_dir + + if from_submodule: + self._generator.create_section(SIMPLE_FORK_NAME, + self._simple_ext_fork_name, + from_submodule=True) + self._generator.create_section(SIMPLE_REPO_NAME, + self._simple_ext_name, + branch='feature3', path='', + from_submodule=False) + else: + if branch_name is None: + branch_name = 'master' + + self._generator.create_section(self._test_repo_name, + self._checkout_dir, + branch=branch_name, + path=name, externals=sub_externals, + repo_path=self._repo_dir) + + self._generator.write_config(dest_dir, filename=filename) + + def idempotence_check(self, checkout_dir): + """Verify that calling checkout_externals and + checkout_externals --status does not cause errors""" + cwd = os.getcwd() + os.chdir(checkout_dir) + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.checkout_args) + self.assertTrue(overall == 0) + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.status_args) + self.assertTrue(overall == 0) + os.chdir(cwd) + + def test_submodule_checkout_bare(self): + """Verify that a git repo with submodule is properly checked out + This test if for where there is no 'externals' keyword in the + parent repo. + Correct behavior is that the submodule is checked out using + normal git submodule behavior. + """ + simple_ext_fork_tag = "(tag1)" + simple_ext_fork_status = " " + self.create_externals_file(branch_name=self._bare_branch_name) + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.checkout_args) + self.assertTrue(overall == 0) + cwd = os.getcwd() + checkout_dir = os.path.join(self._my_test_dir, self._checkout_dir) + fork_file = os.path.join(checkout_dir, + self._simple_ext_fork_name, "readme.txt") + self.assertTrue(os.path.exists(fork_file)) + os.chdir(checkout_dir) + submods = git_submodule_status(checkout_dir) + self.assertEqual(len(submods.keys()), 1) + self.assertTrue(self._simple_ext_fork_name in submods) + submod = submods[self._simple_ext_fork_name] + self.assertTrue('hash' in submod) + self.assertEqual(submod['hash'], self._fork_hash_check) + self.assertTrue('status' in submod) + self.assertEqual(submod['status'], simple_ext_fork_status) + self.assertTrue('tag' in submod) + self.assertEqual(submod['tag'], simple_ext_fork_tag) + os.chdir(cwd) + self.idempotence_check(checkout_dir) + + def test_submodule_checkout_none(self): + """Verify that a git repo with submodule is properly checked out + This test is for when 'externals=None' is in parent repo's + externals cfg file. + Correct behavior is the submodle is not checked out. + """ + self.create_externals_file(branch_name=self._bare_branch_name, + sub_externals="none") + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.checkout_args) + self.assertTrue(overall == 0) + cwd = os.getcwd() + checkout_dir = os.path.join(self._my_test_dir, self._checkout_dir) + fork_file = os.path.join(checkout_dir, + self._simple_ext_fork_name, "readme.txt") + self.assertFalse(os.path.exists(fork_file)) + os.chdir(cwd) + self.idempotence_check(checkout_dir) + + def test_submodule_checkout_config(self): # pylint: disable=too-many-locals + """Verify that a git repo with submodule is properly checked out + This test if for when the 'from_submodule' keyword is used in the + parent repo. + Correct behavior is that the submodule is checked out using + normal git submodule behavior. + """ + tag_check = None # Not checked out as submodule + status_check = "-" # Not checked out as submodule + self.create_externals_file(branch_name=self._config_branch_name, + sub_externals=self._container_extern_name) + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.checkout_args) + self.assertTrue(overall == 0) + cwd = os.getcwd() + checkout_dir = os.path.join(self._my_test_dir, self._checkout_dir) + fork_file = os.path.join(checkout_dir, + self._simple_ext_fork_name, "readme.txt") + self.assertTrue(os.path.exists(fork_file)) + os.chdir(checkout_dir) + # Check submodule status + submods = git_submodule_status(checkout_dir) + self.assertEqual(len(submods.keys()), 2) + self.assertTrue(self._simple_ext_fork_name in submods) + submod = submods[self._simple_ext_fork_name] + self.assertTrue('hash' in submod) + self.assertEqual(submod['hash'], self._fork_hash_check) + self.assertTrue('status' in submod) + self.assertEqual(submod['status'], status_check) + self.assertTrue('tag' in submod) + self.assertEqual(submod['tag'], tag_check) + self.assertTrue(self._simple_ext_name in submods) + submod = submods[self._simple_ext_name] + self.assertTrue('hash' in submod) + self.assertEqual(submod['hash'], self._simple_hash_check) + self.assertTrue('status' in submod) + self.assertEqual(submod['status'], status_check) + self.assertTrue('tag' in submod) + self.assertEqual(submod['tag'], tag_check) + # Check fork repo status + os.chdir(self._simple_ext_fork_name) + self.assertEqual(self.get_git_hash(), self._fork_hash_check) + os.chdir(checkout_dir) + os.chdir(self._simple_ext_name) + hash_check = self.get_git_hash('origin/feature3') + self.assertEqual(self.get_git_hash(), hash_check) + os.chdir(cwd) + self.idempotence_check(checkout_dir) class TestSysCheckoutErrors(BaseTestSysCheckout): """Run systems level tests of error conditions in checkout_externals diff --git a/test/test_unit_externals_description.py b/test/test_unit_externals_description.py index 5de60e4f35..637f760ee5 100644 --- a/test/test_unit_externals_description.py +++ b/test/test_unit_externals_description.py @@ -316,11 +316,13 @@ def setUp(self): """Create config object used as basis for all tests """ self._config = config_parser() + self._gmconfig = config_parser() self.setup_config() def setup_config(self): """Boiler plate construction of xml string for componet 1 """ + # Create a standard externals config with a single external name = 'test' self._config.add_section(name) self._config.set(name, ExternalsDescription.PATH, 'externals') @@ -332,6 +334,14 @@ def setup_config(self): self._config.add_section(DESCRIPTION_SECTION) self._config.set(DESCRIPTION_SECTION, VERSION_ITEM, '1.0.0') + # Create a .gitmodules test + name = 'submodule "gitmodules_test"' + self._gmconfig.add_section(name) + self._gmconfig.set(name, "path", 'externals/test') + self._gmconfig.set(name, "url", '/path/to/repo') + # NOTE(goldy, 2019-03) Should test other possible keywords such as + # fetchRecurseSubmodules, ignore, and shallow + def test_cfg_v1_ok(self): """Test that a correct cfg v1 object is created by create_externals_description @@ -356,7 +366,7 @@ def test_dict(self): rdata = {ExternalsDescription.PROTOCOL: 'git', ExternalsDescription.REPO_URL: '/path/to/repo', ExternalsDescription.TAG: 'tagv1', - } + } desc = { 'test': { diff --git a/test/test_unit_repository.py b/test/test_unit_repository.py index 2152503c2d..5b9c242fd3 100644 --- a/test/test_unit_repository.py +++ b/test/test_unit_repository.py @@ -36,7 +36,8 @@ def setUp(self): ExternalsDescription.REPO_URL: 'junk_root', ExternalsDescription.TAG: 'junk_tag', ExternalsDescription.BRANCH: EMPTY_STR, - ExternalsDescription.HASH: EMPTY_STR, } + ExternalsDescription.HASH: EMPTY_STR, + ExternalsDescription.SPARSE: EMPTY_STR, } def test_create_repo_git(self): """Verify that several possible names for the 'git' protocol @@ -95,7 +96,8 @@ def test_tag(self): ExternalsDescription.REPO_URL: url, ExternalsDescription.TAG: tag, ExternalsDescription.BRANCH: EMPTY_STR, - ExternalsDescription.HASH: EMPTY_STR, } + ExternalsDescription.HASH: EMPTY_STR, + ExternalsDescription.SPARSE: EMPTY_STR, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.tag(), tag) @@ -112,7 +114,8 @@ def test_branch(self): ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: EMPTY_STR, - ExternalsDescription.HASH: EMPTY_STR, } + ExternalsDescription.HASH: EMPTY_STR, + ExternalsDescription.SPARSE: EMPTY_STR, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.branch(), branch) @@ -125,11 +128,13 @@ def test_hash(self): protocol = 'test_protocol' url = 'test_url' ref = 'deadc0de' + sparse = EMPTY_STR repo_info = {ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: EMPTY_STR, ExternalsDescription.TAG: EMPTY_STR, - ExternalsDescription.HASH: ref, } + ExternalsDescription.HASH: ref, + ExternalsDescription.SPARSE: sparse, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.hash(), ref) @@ -146,11 +151,13 @@ def test_tag_branch(self): branch = 'test_branch' tag = 'test_tag' ref = EMPTY_STR + sparse = EMPTY_STR repo_info = {ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, - ExternalsDescription.HASH: ref, } + ExternalsDescription.HASH: ref, + ExternalsDescription.SPARSE: sparse, } with self.assertRaises(RuntimeError): Repository(name, repo_info) @@ -165,11 +172,13 @@ def test_tag_branch_hash(self): branch = 'test_branch' tag = 'test_tag' ref = 'deadc0de' + sparse = EMPTY_STR repo_info = {ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, - ExternalsDescription.HASH: ref, } + ExternalsDescription.HASH: ref, + ExternalsDescription.SPARSE: sparse, } with self.assertRaises(RuntimeError): Repository(name, repo_info) @@ -184,11 +193,13 @@ def test_no_tag_no_branch(self): branch = EMPTY_STR tag = EMPTY_STR ref = EMPTY_STR + sparse = EMPTY_STR repo_info = {ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, - ExternalsDescription.HASH: ref, } + ExternalsDescription.HASH: ref, + ExternalsDescription.SPARSE: sparse, } with self.assertRaises(RuntimeError): Repository(name, repo_info) diff --git a/test/test_unit_repository_git.py b/test/test_unit_repository_git.py index b025fbd429..4a0a334bb1 100644 --- a/test/test_unit_repository_git.py +++ b/test/test_unit_repository_git.py @@ -547,7 +547,8 @@ def setUp(self): ExternalsDescription.TAG: 'very_useful_tag', ExternalsDescription.BRANCH: EMPTY_STR, - ExternalsDescription.HASH: EMPTY_STR, } + ExternalsDescription.HASH: EMPTY_STR, + ExternalsDescription.SPARSE: EMPTY_STR, } self._repo = GitRepository('test', self._rdata) def test_remote_git_proto(self): From 83c1c4df473bdf40efcdb6270cd6d44e19f80f36 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 26 Apr 2020 00:24:28 -0600 Subject: [PATCH 0815/1973] Fixes for #966 that went into release-clm5.0.33 --- src/biogeochem/CNVegStateType.F90 | 6 +++--- src/biogeophys/PhotosynthesisMod.F90 | 8 ++++---- src/biogeophys/WaterFluxType.F90 | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/biogeochem/CNVegStateType.F90 b/src/biogeochem/CNVegStateType.F90 index 85d18431c9..afdfa190aa 100644 --- a/src/biogeochem/CNVegStateType.F90 +++ b/src/biogeochem/CNVegStateType.F90 @@ -321,17 +321,17 @@ subroutine InitHistory(this, bounds) ptr_col=this%nfire_col) this%farea_burned_col(begc:endc) = spval - call hist_addfld1d (fname='FAREA_BURNED', units='proportion/sec', & + call hist_addfld1d (fname='FAREA_BURNED', units='s-1', & avgflag='A', long_name='timestep fractional area burned', & ptr_col=this%farea_burned_col) this%baf_crop_col(begc:endc) = spval - call hist_addfld1d (fname='BAF_CROP', units='proportion/sec', & + call hist_addfld1d (fname='BAF_CROP', units='s-1', & avgflag='A', long_name='fractional area burned for crop', & ptr_col=this%baf_crop_col) this%baf_peatf_col(begc:endc) = spval - call hist_addfld1d (fname='BAF_PEATF', units='proportion/sec', & + call hist_addfld1d (fname='BAF_PEATF', units='s-1', & avgflag='A', long_name='fractional area burned in peatland', & ptr_col=this%baf_peatf_col) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index a111cab156..cd09625a87 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -364,14 +364,14 @@ subroutine InitHistory(this, bounds) ! Don't output photosynthesis variables when FATES is on as they aren't calculated if (.not. use_fates) then this%fpsn_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN', units='umol/m2s', & + call hist_addfld1d (fname='FPSN', units='umol m-2 s-1', & avgflag='A', long_name='photosynthesis', & ptr_patch=this%fpsn_patch, set_lake=0._r8, set_urb=0._r8) ! Don't by default output this rate limiting step as only makes sense if you are outputing ! the others each time-step this%fpsn_wc_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WC', units='umol/m2s', & + call hist_addfld1d (fname='FPSN_WC', units='umol m-2 s-1', & avgflag='I', long_name='Rubisco-limited photosynthesis', & ptr_patch=this%fpsn_wc_patch, set_lake=0._r8, set_urb=0._r8, & default='inactive') @@ -379,7 +379,7 @@ subroutine InitHistory(this, bounds) ! Don't by default output this rate limiting step as only makes sense if you are outputing ! the others each time-step this%fpsn_wj_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WJ', units='umol/m2s', & + call hist_addfld1d (fname='FPSN_WJ', units='umol m-2 s-1', & avgflag='I', long_name='RuBP-limited photosynthesis', & ptr_patch=this%fpsn_wj_patch, set_lake=0._r8, set_urb=0._r8, & default='inactive') @@ -387,7 +387,7 @@ subroutine InitHistory(this, bounds) ! Don't by default output this rate limiting step as only makes sense if you are outputing ! the others each time-step this%fpsn_wp_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WP', units='umol/m2s', & + call hist_addfld1d (fname='FPSN_WP', units='umol m-2 s-1', & avgflag='I', long_name='Product-limited photosynthesis', & ptr_patch=this%fpsn_wp_patch, set_lake=0._r8, set_urb=0._r8, & default='inactive') diff --git a/src/biogeophys/WaterFluxType.F90 b/src/biogeophys/WaterFluxType.F90 index a5485c1839..a2d57c1e51 100644 --- a/src/biogeophys/WaterFluxType.F90 +++ b/src/biogeophys/WaterFluxType.F90 @@ -706,7 +706,7 @@ subroutine InitHistory(this, bounds) this%qflx_evap_tot_patch(begp:endp) = spval call hist_addfld1d ( & fname=this%info%fname('QFLX_EVAP_TOT'), & - units='mm H2O/s', & + units='kg m-2 s-1', & avgflag='A', & long_name=this%info%lname('qflx_evap_soi + qflx_evap_can + qflx_tran_veg'), & ptr_patch=this%qflx_evap_tot_patch, c2l_scale_type='urbanf') From 1f5afc67889076961fe52eb71b23d6c35e76123b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 26 Apr 2020 00:27:57 -0600 Subject: [PATCH 0816/1973] Fix for #974 that went into release-clm5.0.34 --- cime_config/SystemTests/ssp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/SystemTests/ssp.py b/cime_config/SystemTests/ssp.py index 4aad37274a..892128ba5e 100644 --- a/cime_config/SystemTests/ssp.py +++ b/cime_config/SystemTests/ssp.py @@ -45,7 +45,7 @@ def run_phase(self): # determine run lengths needed below stop_nf = self._case.get_value("STOP_N") - stop_n1 = stop_nf / 2 + stop_n1 = int(stop_nf / 2) stop_n2 = stop_nf - stop_n1 #------------------------------------------------------------------- From 77e923b0d64e7c41b7ce1cd47dbe381aa92c0975 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 27 Apr 2020 11:04:29 -0600 Subject: [PATCH 0817/1973] Update change files --- doc/ChangeLog | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 115 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index ee39758499..3560e6f620 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,118 @@ =============================================================== +Tag name: ctsm1.0.dev092 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Mon Apr 27 11:04:13 MDT 2020 +One-line Summary: Update cime to version in cesm2_2_beta04 + +Purpose of changes +------------------ + +Update cime to latest in cesm2.2 beta tag (cesm2_2_beta04) +Fix two small issues that had gone on the release-clm5.0 branch. +Update manage_externals (to manic-v1.1.8) + +cime updates + +some cleanup from the last maint-5.6 update +Add ne5np4.pg4 grid. +case.setup: Add --keep option +Add omip as option to DATM_CO2_TSERIES + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #974 #966 + Fixes #974 -- python 3 problem in ssp test + Fixes #966 -- a few history fields need to be made CF compliant +CIME Issues fixed (include issue #): 3459 3466 + 3459 -- case.setup refuses to fix corrupted env_mach_specfic.xml + 3466 -- fix for aquap + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + ./case.setup now has a --keep option + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + + +Answer changes +-------------- + +Changes answers relative to baseline: None bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime + cime to cime5.8.19 + (NOTE: CMEPS is pointing to a newer hash than used in the beta tag) + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + #996 -- Update cime to latest cesm2.2 beta tag + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev091 Originator(s): sacks (Bill Sacks) Date: Fri Apr 24 07:43:46 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index c682b9dbf3..544d229ed0 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev092 erik 04/27/2020 Update cime to version in cesm2_2_beta04 ctsm1.0.dev091 sacks 04/24/2020 Increase tolerance on near-zero truncation for a snow state update ctsm1.0.dev090 negins 04/23/2020 Refactoring banded diagonal matrix code in SoilTemperature module ctsm1.0.dev089 sacks 04/07/2020 Bring documentation source to master From 54321bf2d15bcf137ba445970309d7499fd312aa Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 27 Apr 2020 11:35:08 -0600 Subject: [PATCH 0818/1973] Update changelog --- doc/ChangeLog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 3560e6f620..37a3a136b8 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev092 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Mon Apr 27 11:04:13 MDT 2020 +Date: Mon Apr 27 11:34:54 MDT 2020 One-line Summary: Update cime to version in cesm2_2_beta04 Purpose of changes @@ -77,11 +77,11 @@ CTSM testing: regular tools-tests (test/tools): - cheyenne - + cheyenne - OK PTCLM testing (tools/shared/PTCLM/test): - cheyenne - + cheyenne - OK python testing (see instructions in python/README.md; document testing done): From 9c18e5db826d25f3b48bf5a6e9421b279b464022 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 27 Apr 2020 14:55:39 -0600 Subject: [PATCH 0819/1973] Update ChangeLog --- doc/ChangeLog | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 37a3a136b8..e97957cb5a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev092 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Mon Apr 27 11:34:54 MDT 2020 +Date: Mon Apr 27 14:51:21 MDT 2020 One-line Summary: Update cime to version in cesm2_2_beta04 Purpose of changes @@ -11,7 +11,15 @@ Update cime to latest in cesm2.2 beta tag (cesm2_2_beta04) Fix two small issues that had gone on the release-clm5.0 branch. Update manage_externals (to manic-v1.1.8) -cime updates +NOTE: Part of the reason for updating cime, was because of some problems +Mike Mills was having on cheyenne with inputdata files being deleted out +from under him before setting up his cases. We think system issues were +interacting with issues with cime putting in place zero length +missing files for the version of cime he was using. Those issues went +away with a cime update, so we hope updating to a newer cime version here +will help prevent those issues for CTSM users. + +cime updates: some cleanup from the last maint-5.6 update Add ne5np4.pg4 grid. From 8b2ce62df1a01a44f463e656497a261b5e7757a8 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 27 Apr 2020 15:39:13 -0600 Subject: [PATCH 0820/1973] Initial mods to get things set up (take 2) Based on 4/21/2020 conversation with @billsacks. --- src/biogeochem/CNBalanceCheckMod.F90 | 112 ++++++++++++++++------ src/biogeochem/CNProductsMod.F90 | 4 +- src/biogeochem/CNVegCarbonStateType.F90 | 6 +- src/biogeochem/CNVegNitrogenStateType.F90 | 6 +- src/biogeochem/CNVegetationFacade.F90 | 37 ++++--- 5 files changed, 108 insertions(+), 57 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index a9dfc8b6bc..a4241be27c 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -39,7 +39,8 @@ module CNBalanceCheckMod real(r8), pointer :: endnb_grc(:) ! (gN/m2) gridcell nitrogen mass, end of time step contains procedure , public :: Init - procedure , public :: BeginCNBalance + procedure , public :: BeginCNGridcellBalance + procedure , public :: BeginCNColumnBalance procedure , public :: CBalanceCheck procedure , public :: NBalanceCheck procedure , private :: InitAllocate @@ -84,17 +85,58 @@ subroutine InitAllocate(this, bounds) end subroutine InitAllocate !----------------------------------------------------------------------- - subroutine BeginCNBalance(this, bounds, num_soilc, filter_soilc, & + subroutine BeginCNGridcellBalance(this, bounds, & cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) ! ! !DESCRIPTION: - ! Calculate beginning gridcell and column-level carbon/nitrogen balance + ! Calculate beginning gridcell-level carbon/nitrogen balance ! for mass conservation check ! - ! Gridcell level: ! Should be called after CN state summaries have been computed ! and before the dynamic landunit area updates ! + ! !USES: + use CNProductsMod, only: cn_products_type + ! + ! !ARGUMENTS: + class(cn_balance_type) , intent(inout) :: this + type(bounds_type) , intent(in) :: bounds + type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst + type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst + type(cn_products_type) :: c_products_inst ! slevis: pass as argument? + ! + ! !LOCAL VARIABLES: + integer :: g + integer :: begg, endg + !----------------------------------------------------------------------- + + associate( & + grc_begcb => this%begcb_grc , & ! Output: [real(r8) (:)] (gC/m2) gridcell carbon mass, beginning of time step + grc_begnb => this%begnb_grc , & ! Output: [real(r8) (:)] (gN/m2) gridcell nitrogen mass, beginning of time step + totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool + totgrcn => cnveg_nitrogenstate_inst%totn_grc, & ! Input: [real(r8) (:)] (gN/m2) total gridcell nitrogen, incl veg + seedc_grc => cnveg_carbonstate_inst%seedc_grc, & ! Input: [real(r8) (:)] (gC/m2) seed carbon + tot_woodprod_grc => c_products_inst%tot_woodprod_grc & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products + ) + + begg = bounds%begg; endg = bounds%endg + + do g = begg, endg ! slevis: tot_woodprod_grc causes core dump here + grc_begcb(g) = totgrcc(g) + seedc_grc(g) ! + tot_woodprod_grc(g) + grc_begnb(g) = totgrcn(g) + end do + + end associate + + end subroutine BeginCNGridcellBalance + + !----------------------------------------------------------------------- + subroutine BeginCNColumnBalance(this, bounds, num_soilc, filter_soilc, & + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) + ! + ! !DESCRIPTION: + ! Calculate beginning column-level carbon/nitrogen balance, for mass conservation check + ! ! Column level: ! Should be called after CN state summaries have been recomputed for this time step ! (which should be after the dynamic landunit area updates and the associated filter @@ -110,15 +152,9 @@ subroutine BeginCNBalance(this, bounds, num_soilc, filter_soilc, & ! ! !LOCAL VARIABLES: integer :: fc,c - integer :: g - integer :: begg, endg !----------------------------------------------------------------------- associate( & - grc_begcb => this%begcb_grc , & ! Output: [real(r8) (:)] (gC/m2) gridcell carbon mass, beginning of time step - grc_begnb => this%begnb_grc , & ! Output: [real(r8) (:)] (gN/m2) gridcell nitrogen mass, beginning of time step -! totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool -! totgrcn => cnveg_nitrogenstate_inst%totn_grc, & ! Input: [real(r8) (:)] (gN/m2) total gridcell nitrogen, incl veg col_begcb => this%begcb_col , & ! Output: [real(r8) (:)] (gC/m2) column carbon mass, beginning of time step col_begnb => this%begnb_col , & ! Output: [real(r8) (:)] (gN/m2) column nitrogen mass, beginning of time step totcolc => cnveg_carbonstate_inst%totc_col , & ! Input: [real(r8) (:)] (gC/m2) total column carbon, incl veg and cpool @@ -131,16 +167,9 @@ subroutine BeginCNBalance(this, bounds, num_soilc, filter_soilc, & col_begnb(c) = totcoln(c) end do - begg = bounds%begg; endg = bounds%endg - - do g = begg, endg - grc_begcb(g) = 0._r8 ! TODO Add gridcell terms not accted at col level - grc_begnb(g) = 0._r8 ! TODO Add gridcell terms not accted at col level - end do - end associate - end subroutine BeginCNBalance + end subroutine BeginCNColumnBalance !----------------------------------------------------------------------- subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & @@ -148,6 +177,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! ! !USES: use subgridAveMod, only: c2g + use CNProductsMod, only: cn_products_type ! ! !DESCRIPTION: ! Perform carbon mass conservation check for column and patch @@ -160,6 +190,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + type(cn_products_type) :: c_products_inst ! slevis: pass as argument? ! ! !LOCAL VARIABLES: integer :: c, g, err_index ! indices @@ -175,7 +206,15 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & associate( & grc_begcb => this%begcb_grc , & ! Input: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, beginning of time step grc_endcb => this%endcb_grc , & ! Output: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, end of time step -! totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool + totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool + nbp_grc => cnveg_carbonflux_inst%nbp_grc , & ! Input: [real(r8) (:) ] (gC/m2/s) net biome production (positive for sink) + tot_woodprod_grc => c_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products + dwt_woodprod_gain_grc => c_products_inst%dwt_woodprod_gain_grc , & ! Input: [real(r8) (:)] (gC/m2/s) dynamic landcover addition to wood product pools + dwt_seedc_to_leaf_grc => cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to leaf + dwt_seedc_to_deadstem_grc => cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to deadstem + dwt_conv_cflux_grc => cnveg_carbonflux_inst%dwt_conv_cflux_grc , & ! Input: [real(r8) (:)] (gC/m2/s) conversion C flux (immediate loss to atm) + dwt_slash_cflux_grc => cnveg_carbonflux_inst%dwt_slash_cflux_grc , & ! Input: [real(r8) (:)] (gC/m2/s) conversion slash flux due to landcover change + seedc_grc => cnveg_carbonstate_inst%seedc_grc , & ! Input: [real(r8) (:)] (gC/m2) seed carbon col_begcb => this%begcb_col , & ! Input: [real(r8) (:) ] (gC/m2) carbon mass, beginning of time step col_endcb => this%endcb_col , & ! Output: [real(r8) (:) ] (gC/m2) carbon mass, end of time step wood_harvestc => cnveg_carbonflux_inst%wood_harvestc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) wood harvest (to product pools) @@ -256,28 +295,40 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & end if ! Repeat error check at the gridcell level - ! The column-level error gets added to the gridcel-level error below call c2g( bounds = bounds, & - carr = col_errcb(bounds%begc:bounds%endc), & - garr = grc_errcb(bounds%begg:bounds%endg), & + carr = totcolc(bounds%begc:bounds%endc), & + garr = totgrcc(bounds%begg:bounds%endg), & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') err_found = .false. do g = bounds%begg, bounds%endg ! calculate gridcell-level carbon storage for mass conservation check - grc_endcb(g) = 0._r8 ! TODO Add gridcell terms not accted at col level + ! slevis notes: + ! totgrcc = totcolc = totc_p2c_col(c) + soilbiogeochem_cwdc_col(c) + soilbiogeochem_totlitc_col(c) + soilbiogeochem_totsomc_col(c) + soilbiogeochem_ctrunc_col(c) + ! totc_p2c_col = totc_patch = totvegc_patch(p) + xsmrpool_patch(p) + ctrunc_patch(p) + cropseedc_deficit_patch(p) + ! slevis: tot_woodprod_grc and dwt_woodprod_gain_grc give error + ! "Index '241' of dimension 1 of + ! array 'tot_woodprod_grc' above upper bound of 1" + ! I need to work w these vars differently; pass c_products_inst + ! as argument? + grc_endcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) ! calculate total gridcell-level inputs - grc_cinputs = 0._r8 ! TODO Add gridcell terms not accted at col level + ! slevis notes: + ! nbp_grc = nep_grc - fire_closs_grc - hrv_xsmrpool_to_atm_dribbled_grc - dwt_conv_cflux_dribbled_grc - product_closs_grc + grc_cinputs = nbp_grc(g) + dwt_woodprod_gain_grc(g) + & + dwt_seedc_to_leaf_grc(g) + & + dwt_seedc_to_deadstem_grc(g) + & + dwt_conv_cflux_grc(g) + dwt_slash_cflux_grc(g) ! calculate total gridcell-level outputs - grc_coutputs = 0._r8 ! TODO Add gridcell terms not accted at col level + grc_coutputs = 0._r8 ! calculate the total gridcell-level carbon balance error ! for this time step grc_errcb(g) = (grc_cinputs - grc_coutputs) * dt - & - (grc_endcb(g) - grc_begcb(g)) + grc_errcb(g) + (grc_endcb(g) - grc_begcb(g)) ! check for significant errors if (abs(grc_errcb(g)) > 1e-7_r8) then @@ -297,9 +348,14 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*)'endcb =', grc_endcb(g) write(iulog,*)'delta store =', grc_endcb(g) - grc_begcb(g) write(iulog,*)'--- Inputs ---' - write(iulog,*)'??? =', 0 + write(iulog,*)'nbp =', nbp_grc(g) * dt + write(iulog,*)'dwt_woodprod_gain_grc =', dwt_woodprod_gain_grc(g) * dt + write(iulog,*)'dwt_seedc_to_leaf_grc =', dwt_seedc_to_leaf_grc(g) * dt + write(iulog,*)'dwt_seedc_to_deadstem_grc =', dwt_seedc_to_deadstem_grc(g) * dt + write(iulog,*)'dwt_conv_cflux_grc =', dwt_conv_cflux_grc(g) * dt + write(iulog,*)'dwt_slash_cflux_grc =', dwt_slash_cflux_grc(g) * dt write(iulog,*)'--- Outputs ---' - write(iulog,*)'??? =', 0 + write(iulog,*)'NONE =', 0 call endrun(msg=errMsg(sourcefile, __LINE__)) end if diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 0661c3b392..e491eee9ad 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -36,12 +36,12 @@ module CNProductsMod real(r8), pointer :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan real(r8), pointer :: prod10_grc(:) ! (g[C or N]/m2) wood product pool, 10-year lifespan real(r8), pointer :: prod100_grc(:) ! (g[C or N]/m2) wood product pool, 100-year lifespan - real(r8), pointer :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool + real(r8), pointer, public :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool ! Fluxes: gains real(r8), pointer :: dwt_prod10_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 10-year wood product pool real(r8), pointer :: dwt_prod100_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 100-year wood product pool - real(r8), pointer :: dwt_woodprod_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to wood product pools + real(r8), pointer, public :: dwt_woodprod_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to wood product pools real(r8), pointer :: dwt_cropprod1_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 1-year crop product pool real(r8), pointer :: hrv_deadstem_to_prod10_patch(:) ! (g[C or N]/m2/s) dead stem harvest to 10-year wood product pool real(r8), pointer :: hrv_deadstem_to_prod10_grc(:) ! (g[C or N]/m2/s) dead stem harvest to 10-year wood product pool diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index 0963be20c8..34b61e23aa 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -82,7 +82,7 @@ module CNVegCarbonStateType real(r8), pointer :: totc_p2c_col (:) ! (gC/m2) totc_patch averaged to col real(r8), pointer :: totc_col (:) ! (gC/m2) total column carbon, incl veg and cpool real(r8), pointer :: totecosysc_col (:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool -! real(r8), pointer :: totc_grc (:) ! (gC/m2) total gridcell carbon + real(r8), pointer :: totc_grc (:) ! (gC/m2) total gridcell carbon contains @@ -264,7 +264,7 @@ subroutine InitAllocate(this, bounds) allocate(this%totc_p2c_col (begc:endc)) ; this%totc_p2c_col (:) = nan allocate(this%totc_col (begc:endc)) ; this%totc_col (:) = nan allocate(this%totecosysc_col (begc:endc)) ; this%totecosysc_col (:) = nan -! allocate(this%totc_grc (begg:endg)) ; this%totc_grc (:) = nan + allocate(this%totc_grc (begg:endg)) ; this%totc_grc (:) = nan end subroutine InitAllocate @@ -1000,7 +1000,7 @@ subroutine InitCold(this, bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst do g = bounds%begg, bounds%endg this%seedc_grc(g) = 0._r8 -! this%totc_grc(g) = 0._r8 + this%totc_grc(g) = 0._r8 end do ! initialize fields for special filters diff --git a/src/biogeochem/CNVegNitrogenStateType.F90 b/src/biogeochem/CNVegNitrogenStateType.F90 index 455a72ffb7..1b06cd3fc3 100644 --- a/src/biogeochem/CNVegNitrogenStateType.F90 +++ b/src/biogeochem/CNVegNitrogenStateType.F90 @@ -71,7 +71,7 @@ module CNVegNitrogenStateType real(r8), pointer :: totn_p2c_col (:) ! (gN/m2) totn_patch averaged to col real(r8), pointer :: totn_col (:) ! (gN/m2) total column nitrogen, incl veg real(r8), pointer :: totecosysn_col (:) ! (gN/m2) total ecosystem nitrogen, incl veg -! real(r8), pointer :: totn_grc (:) ! (gN/m2) total gridcell nitrogen + real(r8), pointer :: totn_grc (:) ! (gN/m2) total gridcell nitrogen contains @@ -167,7 +167,7 @@ subroutine InitAllocate(this, bounds) allocate(this%totn_p2c_col (begc:endc)) ; this%totn_p2c_col (:) = nan allocate(this%totn_col (begc:endc)) ; this%totn_col (:) = nan allocate(this%totecosysn_col (begc:endc)) ; this%totecosysn_col (:) = nan -! allocate(this%totn_grc (begg:endg)) ; this%totn_grc (:) = nan + allocate(this%totn_grc (begg:endg)) ; this%totn_grc (:) = nan end subroutine InitAllocate @@ -512,7 +512,7 @@ subroutine InitCold(this, bounds, & do g = bounds%begg, bounds%endg this%seedn_grc(g) = 0._r8 -! this%totn_grc(g) = 0._r8 + this%totn_grc(g) = 0._r8 end do ! now loop through special filters and explicitly set the variables that diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 60727f68f8..4711c8ed10 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -774,7 +774,7 @@ subroutine InitColumnBalance(this, bounds, num_allc, filter_allc, & c14_soilbiogeochem_carbonstate_inst, & soilbiogeochem_nitrogenstate_inst) - call this%cn_balance_inst%BeginCNBalance( & + call this%cn_balance_inst%BeginCNColumnBalance( & bounds, num_soilc, filter_soilc, & this%cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst) @@ -830,26 +830,21 @@ subroutine InitGridcellBalance(this, bounds, num_allc, filter_allc, & c14_soilbiogeochem_carbonstate_inst, & soilbiogeochem_nitrogenstate_inst) -! ! total gridcell carbon (TOTGRIDCELLC) -! call c2g( bounds = bounds, & -! carr = this%cnveg_carbonstate_inst%totc_col(bounds%begc:bounds%endc), & -! garr = this%cnveg_carbonstate_inst%totc_grc(bounds%begg:bounds%endg), & -! c2l_scale_type = 'unity', & -! l2g_scale_type = 'unity') -! ! total gridcell nitrogen (TOTGRIDCELLN) -! call c2g( bounds = bounds, & -! carr = this%cnveg_nitrogenstate_inst%totn_col(bounds%begc:bounds%endc), & -! garr = this%cnveg_nitrogenstate_inst%totn_grc(bounds%begg:bounds%endg), & -! c2l_scale_type = 'unity', & -! l2g_scale_type = 'unity') - - ! TODO In next call, - ! add to totc_grc & totn_grc the gridcell terms not accted at col level - ! OR add them to zero and start from the column-level error in CBalanceCheck - ! If the latter, then prob. need BeginCNGridcellBalance separate from Column - - call this%cn_balance_inst%BeginCNBalance( & - bounds, num_soilc, filter_soilc, & + ! total gridcell carbon (TOTGRIDCELLC) + call c2g( bounds = bounds, & + carr = this%cnveg_carbonstate_inst%totc_col(bounds%begc:bounds%endc), & + garr = this%cnveg_carbonstate_inst%totc_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + ! total gridcell nitrogen (TOTGRIDCELLN) + call c2g( bounds = bounds, & + carr = this%cnveg_nitrogenstate_inst%totn_col(bounds%begc:bounds%endc), & + garr = this%cnveg_nitrogenstate_inst%totn_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + + call this%cn_balance_inst%BeginCNGridcellBalance( & + bounds, & this%cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst) end subroutine InitGridcellBalance From bd5adec51f49be839863f86047b5a7847c704882 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 27 Apr 2020 17:18:05 -0600 Subject: [PATCH 0821/1973] Corrections to get past core dump and array index errors Now just getting C balance error. --- src/biogeochem/CNBalanceCheckMod.F90 | 21 ++++++++------------- src/biogeochem/CNVegetationFacade.F90 | 9 +++++---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index a4241be27c..f91bfc46e6 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -18,6 +18,7 @@ module CNBalanceCheckMod use CNVegCarbonStateType , only : cnveg_carbonstate_type use SoilBiogeochemNitrogenfluxType , only : soilbiogeochem_nitrogenflux_type use SoilBiogeochemCarbonfluxType , only : soilbiogeochem_carbonflux_type + use CNProductsMod , only : cn_products_type use ColumnType , only : col use GridcellType , only : grc use CNSharedParamsMod , only : use_fun @@ -86,7 +87,7 @@ end subroutine InitAllocate !----------------------------------------------------------------------- subroutine BeginCNGridcellBalance(this, bounds, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, c_products_inst) ! ! !DESCRIPTION: ! Calculate beginning gridcell-level carbon/nitrogen balance @@ -96,14 +97,13 @@ subroutine BeginCNGridcellBalance(this, bounds, & ! and before the dynamic landunit area updates ! ! !USES: - use CNProductsMod, only: cn_products_type ! ! !ARGUMENTS: class(cn_balance_type) , intent(inout) :: this type(bounds_type) , intent(in) :: bounds type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cn_products_type) :: c_products_inst ! slevis: pass as argument? + type(cn_products_type) , intent(in) :: c_products_inst ! ! !LOCAL VARIABLES: integer :: g @@ -121,8 +121,8 @@ subroutine BeginCNGridcellBalance(this, bounds, & begg = bounds%begg; endg = bounds%endg - do g = begg, endg ! slevis: tot_woodprod_grc causes core dump here - grc_begcb(g) = totgrcc(g) + seedc_grc(g) ! + tot_woodprod_grc(g) + do g = begg, endg + grc_begcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) grc_begnb(g) = totgrcn(g) end do @@ -173,11 +173,11 @@ end subroutine BeginCNColumnBalance !----------------------------------------------------------------------- subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & - soilbiogeochem_carbonflux_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst) + soilbiogeochem_carbonflux_inst, cnveg_carbonflux_inst, & + cnveg_carbonstate_inst, c_products_inst) ! ! !USES: use subgridAveMod, only: c2g - use CNProductsMod, only: cn_products_type ! ! !DESCRIPTION: ! Perform carbon mass conservation check for column and patch @@ -190,7 +190,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cn_products_type) :: c_products_inst ! slevis: pass as argument? + type(cn_products_type) , intent(in) :: c_products_inst ! ! !LOCAL VARIABLES: integer :: c, g, err_index ! indices @@ -307,11 +307,6 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! slevis notes: ! totgrcc = totcolc = totc_p2c_col(c) + soilbiogeochem_cwdc_col(c) + soilbiogeochem_totlitc_col(c) + soilbiogeochem_totsomc_col(c) + soilbiogeochem_ctrunc_col(c) ! totc_p2c_col = totc_patch = totvegc_patch(p) + xsmrpool_patch(p) + ctrunc_patch(p) + cropseedc_deficit_patch(p) - ! slevis: tot_woodprod_grc and dwt_woodprod_gain_grc give error - ! "Index '241' of dimension 1 of - ! array 'tot_woodprod_grc' above upper bound of 1" - ! I need to work w these vars differently; pass c_products_inst - ! as argument? grc_endcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) ! calculate total gridcell-level inputs diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 4711c8ed10..6b99d6a489 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -843,9 +843,9 @@ subroutine InitGridcellBalance(this, bounds, num_allc, filter_allc, & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') - call this%cn_balance_inst%BeginCNGridcellBalance( & - bounds, & - this%cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst) + call this%cn_balance_inst%BeginCNGridcellBalance( bounds, & + this%cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst, & + this%c_products_inst) end subroutine InitGridcellBalance @@ -1096,7 +1096,8 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & call this%cn_balance_inst%CBalanceCheck( & bounds, num_soilc, filter_soilc, & soilbiogeochem_carbonflux_inst, & - this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst) + this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, & + this%c_products_inst) call this%cn_balance_inst%NBalanceCheck( & bounds, num_soilc, filter_soilc, & From df6009c016ff5ab11bdb002d965a00f69d4823cc Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 27 Apr 2020 19:32:38 -0600 Subject: [PATCH 0822/1973] Corrections to get past C balance error This test PASSes: ERI_D_Ld9.f10_f10_musgs.I1850Clm50Bgc.cheyenne_gnu.clm-default Seems too good to be true, so now I am interested in a complete review of my changes. --- src/biogeochem/CNBalanceCheckMod.F90 | 8 +++++--- src/biogeochem/CNProductsMod.F90 | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index f91bfc46e6..5eb90fdc14 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -116,13 +116,14 @@ subroutine BeginCNGridcellBalance(this, bounds, & totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool totgrcn => cnveg_nitrogenstate_inst%totn_grc, & ! Input: [real(r8) (:)] (gN/m2) total gridcell nitrogen, incl veg seedc_grc => cnveg_carbonstate_inst%seedc_grc, & ! Input: [real(r8) (:)] (gC/m2) seed carbon + cropprod1_grc => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products tot_woodprod_grc => c_products_inst%tot_woodprod_grc & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products ) begg = bounds%begg; endg = bounds%endg do g = begg, endg - grc_begcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) + grc_begcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) grc_begnb(g) = totgrcn(g) end do @@ -208,6 +209,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & grc_endcb => this%endcb_grc , & ! Output: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, end of time step totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool nbp_grc => cnveg_carbonflux_inst%nbp_grc , & ! Input: [real(r8) (:) ] (gC/m2/s) net biome production (positive for sink) + cropprod1_grc => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products tot_woodprod_grc => c_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products dwt_woodprod_gain_grc => c_products_inst%dwt_woodprod_gain_grc , & ! Input: [real(r8) (:)] (gC/m2/s) dynamic landcover addition to wood product pools dwt_seedc_to_leaf_grc => cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to leaf @@ -307,7 +309,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! slevis notes: ! totgrcc = totcolc = totc_p2c_col(c) + soilbiogeochem_cwdc_col(c) + soilbiogeochem_totlitc_col(c) + soilbiogeochem_totsomc_col(c) + soilbiogeochem_ctrunc_col(c) ! totc_p2c_col = totc_patch = totvegc_patch(p) + xsmrpool_patch(p) + ctrunc_patch(p) + cropseedc_deficit_patch(p) - grc_endcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) + grc_endcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) ! calculate total gridcell-level inputs ! slevis notes: @@ -343,7 +345,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*)'endcb =', grc_endcb(g) write(iulog,*)'delta store =', grc_endcb(g) - grc_begcb(g) write(iulog,*)'--- Inputs ---' - write(iulog,*)'nbp =', nbp_grc(g) * dt + write(iulog,*)'nbp_grc =', nbp_grc(g) * dt write(iulog,*)'dwt_woodprod_gain_grc =', dwt_woodprod_gain_grc(g) * dt write(iulog,*)'dwt_seedc_to_leaf_grc =', dwt_seedc_to_leaf_grc(g) * dt write(iulog,*)'dwt_seedc_to_deadstem_grc =', dwt_seedc_to_deadstem_grc(g) * dt diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index e491eee9ad..928fb22116 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -33,7 +33,7 @@ module CNProductsMod class(species_base_type), allocatable :: species ! C, N, C13, C14, etc. ! States - real(r8), pointer :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan + real(r8), pointer, public :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan real(r8), pointer :: prod10_grc(:) ! (g[C or N]/m2) wood product pool, 10-year lifespan real(r8), pointer :: prod100_grc(:) ! (g[C or N]/m2) wood product pool, 100-year lifespan real(r8), pointer, public :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool From 5a8a1a8baf4f62a27f6052085514f5399ebec89d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 28 Apr 2020 11:49:43 -0600 Subject: [PATCH 0823/1973] Remove Copyright file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Discussion from https://github.com/ESCOMP/CTSM/issues/997: I noticed that we have an old "Copyright" file at the top level of the repository, that is both out of date and incorrect – critically, using the legally incorrect term, "public domain". I recently updated this file in CESM: ESCOMP/CESM#141 However, I'd suggest that we simply remove this file from CTSM. It's not clear to me that we really need to maintain this file, since other code isn't included in our repository but rather downloaded separately via manage_externals, and I think it's confusing to have separate LICENSE and COPYRIGHT files. However, we may want to have a note in the LICENSE file saying that this license only applies to the code in this repository, and that externals obtained via manage_externals have their own licenses. --- Copyright | 75 ------------------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 Copyright diff --git a/Copyright b/Copyright deleted file mode 100644 index 21b9688874..0000000000 --- a/Copyright +++ /dev/null @@ -1,75 +0,0 @@ -CESM1.5: Copyright Notice and Disclaimer - -The Community Earth System Model (CESM was developed in cooperation with -the National Science Foundation, the Department of Energy, -the National Aeronautics and Space Administration, and -the University Corporation for Atmospheric Research National Center for Atmospheric Research. - -Except for the segregable components listed below, CESM is public domain software. -There may be other third party tools and libraries that are embedded, and -they may have their own copyright notices and terms. - -The following components are copyrighted and may only be used, modified, -or redistributed under the terms indicated below. - -Code Institution Copyright Terms of Use/Disclaimer ----- ----------- --------- ----------------------- -ESMF University of Copyright University of Illinois/NCSA Open Source License - Illinois/NCSA 2002-2009, - University of - Illinois/NCSA - Open Source - License - -POP,SCRIP,CICE Los Alamos National Copyright 2008 Los Alamos National Security, LLC - Laboratory Los Alamos - National - Security, LLC - -CISM NCAR/LANL/ORNL/SNL/ Copyright GNU Lesser General Public License v. 3 - LBNL/NYU/U. Bristol/ 2004-2018, CISM is free software: you can redistribute it - U. Edinburgh/ GNU Lesser and/or modify it under the terms of the GNU - U. Montana/U. Swansea General Public Lesser General Public License as published by the - License v. 3 Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - -AER RRTMG Atmospheric Copyright AER RRTMG Copyright - and 2002-2010, - Environmental Atmospheric - Research, Inc. and - Environmental - Research, Inc. - -MCT Argonne Copyright 2000, MCT Copyright - National 2010, - Laboratory University of - Chicago. - -ICSSP N/A Copyright 2003, ISCCP Simulator Software - 2010, Steve - Klein and Mark - Webb - -XML/Lite Wadsack-Allen Copyright 2001, The documentation for the Perl XML-Lite - Digital Group 2010 module is no longer available on-line. - Wadsack-Allen - Digital Group - -Inf_NaN Lahey Copyright(c) Copies of this source code, or standalone compiled -_Detection Computer 2003, Lahey files derived from this source may not be sold -module Systems, Inc. Computer without permission from Lahey Computers Systems. - Systems, Inc. All or part of this module may be freely incorporated - into executable programs which are offered for sale. - Otherwise, distribution of all or part of this file is - permitted, provided this copyright notice and header - are included. - - -THIS SOFTWARE IS PROVIDED BY UCAR AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL UCAR OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - From 8a837c0656fe878c91561b06827dad782f88e73c Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 28 Apr 2020 15:16:38 -0600 Subject: [PATCH 0824/1973] Modifications for gridcell-level N balance check Followed my template that worked for the gridcell-level C balance check. This test PASSes ERI_D_Ld9.f10_f10_musgs.I1850Clm50Bgc.cheyenne_gnu.clm-default Next must correct C balance check for transient simulations. --- src/biogeochem/CNBalanceCheckMod.F90 | 236 +++++++++++++++++++++++--- src/biogeochem/CNProductsMod.F90 | 2 +- src/biogeochem/CNVegetationFacade.F90 | 14 +- src/main/clm_driver.F90 | 3 +- 4 files changed, 230 insertions(+), 25 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index 5eb90fdc14..ec504cdf17 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -87,7 +87,8 @@ end subroutine InitAllocate !----------------------------------------------------------------------- subroutine BeginCNGridcellBalance(this, bounds, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, c_products_inst) + cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & + c_products_inst, n_products_inst) ! ! !DESCRIPTION: ! Calculate beginning gridcell-level carbon/nitrogen balance @@ -104,6 +105,7 @@ subroutine BeginCNGridcellBalance(this, bounds, & type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst type(cn_products_type) , intent(in) :: c_products_inst + type(cn_products_type) , intent(in) :: n_products_inst ! ! !LOCAL VARIABLES: integer :: g @@ -116,15 +118,18 @@ subroutine BeginCNGridcellBalance(this, bounds, & totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool totgrcn => cnveg_nitrogenstate_inst%totn_grc, & ! Input: [real(r8) (:)] (gN/m2) total gridcell nitrogen, incl veg seedc_grc => cnveg_carbonstate_inst%seedc_grc, & ! Input: [real(r8) (:)] (gC/m2) seed carbon - cropprod1_grc => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products - tot_woodprod_grc => c_products_inst%tot_woodprod_grc & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products + seedn_grc => cnveg_nitrogenstate_inst%seedn_grc, & ! Input: [real(r8) (:)] (gC/m2) seed nitrogen + cropprod1c_grc => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products + cropprod1n_grc => n_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) nitrogen in crop products + tot_woodprodc_grc => c_products_inst%tot_woodprod_grc, & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products + tot_woodprodn_grc => n_products_inst%tot_woodprod_grc & ! Input: [real(r8) (:)] (gC/m2) total nitrogen in wood products ) begg = bounds%begg; endg = bounds%endg do g = begg, endg - grc_begcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) - grc_begnb(g) = totgrcn(g) + grc_begcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprodc_grc(g) + cropprod1c_grc(g) + grc_begnb(g) = totgrcn(g) + seedn_grc(g) + tot_woodprodn_grc(g) + cropprod1n_grc(g) end do end associate @@ -211,11 +216,8 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & nbp_grc => cnveg_carbonflux_inst%nbp_grc , & ! Input: [real(r8) (:) ] (gC/m2/s) net biome production (positive for sink) cropprod1_grc => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products tot_woodprod_grc => c_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products - dwt_woodprod_gain_grc => c_products_inst%dwt_woodprod_gain_grc , & ! Input: [real(r8) (:)] (gC/m2/s) dynamic landcover addition to wood product pools dwt_seedc_to_leaf_grc => cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to leaf dwt_seedc_to_deadstem_grc => cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to deadstem - dwt_conv_cflux_grc => cnveg_carbonflux_inst%dwt_conv_cflux_grc , & ! Input: [real(r8) (:)] (gC/m2/s) conversion C flux (immediate loss to atm) - dwt_slash_cflux_grc => cnveg_carbonflux_inst%dwt_slash_cflux_grc , & ! Input: [real(r8) (:)] (gC/m2/s) conversion slash flux due to landcover change seedc_grc => cnveg_carbonstate_inst%seedc_grc , & ! Input: [real(r8) (:)] (gC/m2) seed carbon col_begcb => this%begcb_col , & ! Input: [real(r8) (:) ] (gC/m2) carbon mass, beginning of time step col_endcb => this%endcb_col , & ! Output: [real(r8) (:) ] (gC/m2) carbon mass, end of time step @@ -314,10 +316,8 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! calculate total gridcell-level inputs ! slevis notes: ! nbp_grc = nep_grc - fire_closs_grc - hrv_xsmrpool_to_atm_dribbled_grc - dwt_conv_cflux_dribbled_grc - product_closs_grc - grc_cinputs = nbp_grc(g) + dwt_woodprod_gain_grc(g) + & - dwt_seedc_to_leaf_grc(g) + & - dwt_seedc_to_deadstem_grc(g) + & - dwt_conv_cflux_grc(g) + dwt_slash_cflux_grc(g) + grc_cinputs = nbp_grc(g) + dwt_seedc_to_leaf_grc(g) + & + dwt_seedc_to_deadstem_grc(g) ! calculate total gridcell-level outputs grc_coutputs = 0._r8 @@ -346,11 +346,8 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*)'delta store =', grc_endcb(g) - grc_begcb(g) write(iulog,*)'--- Inputs ---' write(iulog,*)'nbp_grc =', nbp_grc(g) * dt - write(iulog,*)'dwt_woodprod_gain_grc =', dwt_woodprod_gain_grc(g) * dt write(iulog,*)'dwt_seedc_to_leaf_grc =', dwt_seedc_to_leaf_grc(g) * dt write(iulog,*)'dwt_seedc_to_deadstem_grc =', dwt_seedc_to_deadstem_grc(g) * dt - write(iulog,*)'dwt_conv_cflux_grc =', dwt_conv_cflux_grc(g) * dt - write(iulog,*)'dwt_slash_cflux_grc =', dwt_slash_cflux_grc(g) * dt write(iulog,*)'--- Outputs ---' write(iulog,*)'NONE =', 0 call endrun(msg=errMsg(sourcefile, __LINE__)) @@ -362,13 +359,16 @@ end subroutine CBalanceCheck !----------------------------------------------------------------------- subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & - soilbiogeochem_nitrogenflux_inst, cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst) + soilbiogeochem_nitrogenflux_inst, cnveg_nitrogenflux_inst, & + cnveg_nitrogenstate_inst, n_products_inst, atm2lnd_inst) ! ! !DESCRIPTION: ! Perform nitrogen mass conservation check ! ! !USES: use clm_varctl, only : use_crop + use subgridAveMod, only: c2g + use atm2lndType, only: atm2lnd_type ! ! !ARGUMENTS: class(cn_balance_type) , intent(inout) :: this @@ -378,20 +378,49 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & type(soilbiogeochem_nitrogenflux_type) , intent(in) :: soilbiogeochem_nitrogenflux_inst type(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst + type(cn_products_type) , intent(in) :: n_products_inst + type(atm2lnd_type) , intent(in) :: atm2lnd_inst ! ! !LOCAL VARIABLES: integer :: c,err_index,j ! indices + integer :: g ! gridcell index integer :: fc ! lake filter indices logical :: err_found ! error flag real(r8):: dt ! radiation time step (seconds) real(r8):: col_ninputs(bounds%begc:bounds%endc) real(r8):: col_noutputs(bounds%begc:bounds%endc) real(r8):: col_errnb(bounds%begc:bounds%endc) + real(r8):: grc_ninputs(bounds%begg:bounds%endg) + real(r8):: grc_noutputs(bounds%begg:bounds%endg) + real(r8):: grc_errnb(bounds%begg:bounds%endg) + real(r8):: nfix_to_sminn_grc(bounds%begg:bounds%endg) + real(r8):: supplement_to_sminn_grc(bounds%begg:bounds%endg) + real(r8):: ffix_to_sminn_grc(bounds%begg:bounds%endg) + real(r8):: fert_to_sminn_grc(bounds%begg:bounds%endg) + real(r8):: soyfixn_to_sminn_grc(bounds%begg:bounds%endg) + real(r8):: denit_grc(bounds%begg:bounds%endg) + real(r8):: grc_fire_nloss(bounds%begg:bounds%endg) + real(r8):: wood_harvestn_grc(bounds%begg:bounds%endg) + real(r8):: grainn_to_cropprodn_grc(bounds%begg:bounds%endg) + real(r8):: som_n_leached_grc(bounds%begg:bounds%endg) + real(r8):: sminn_leached_grc(bounds%begg:bounds%endg) + real(r8):: f_n2o_nit_grc(bounds%begg:bounds%endg) + real(r8):: smin_no3_leached_grc(bounds%begg:bounds%endg) + real(r8):: smin_no3_runoff_grc(bounds%begg:bounds%endg) !----------------------------------------------------------------------- associate( & - col_begnb => this%begnb_col , & ! Input: [real(r8) (:) ] (gN/m2) nitrogen mass, beginning of time step - col_endnb => this%endnb_col , & ! Output: [real(r8) (:) ] (gN/m2) nitrogen mass, end of time step + grc_begnb => this%begnb_grc , & ! Input: [real(r8) (:) ] (gN/m2) gridcell nitrogen mass, beginning of time step + grc_endnb => this%endnb_grc , & ! Output: [real(r8) (:) ] (gN/m2) gridcell nitrogen mass, end of time step + totgrcn => cnveg_nitrogenstate_inst%totn_grc , & ! Input: [real(r8) (:) ] (gN/m2) total gridcell nitrogen, incl veg + forc_ndep => atm2lnd_inst%forc_ndep_grc , & ! Input: [real(r8) (:)] nitrogen deposition rate (gN/m2/s) + cropprod1_grc => n_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gN/m2) nitrogen in crop products + tot_woodprod_grc => n_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gN/m2) total nitrogen in wood products + dwt_seedn_to_leaf_grc => cnveg_nitrogenflux_inst%dwt_seedn_to_leaf_grc , & ! Input: [real(r8) (:)] (gN/m2/s) seed source sent to leaf + dwt_seedn_to_deadstem_grc => cnveg_nitrogenflux_inst%dwt_seedn_to_deadstem_grc , & ! Input: [real(r8) (:)] (gN/m2/s) seed source sent to deadstem + seedn_grc => cnveg_nitrogenstate_inst%seedn_grc , & ! Input: [real(r8) (:)] (gN/m2) seed nitrogen + col_begnb => this%begnb_col , & ! Input: [real(r8) (:) ] (gN/m2) column nitrogen mass, beginning of time step + col_endnb => this%endnb_col , & ! Output: [real(r8) (:) ] (gN/m2) column nitrogen mass, end of time step ndep_to_sminn => soilbiogeochem_nitrogenflux_inst%ndep_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) atmospheric N deposition to soil mineral N nfix_to_sminn => soilbiogeochem_nitrogenflux_inst%nfix_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) symbiotic/asymbiotic N fixation to soil mineral N ffix_to_sminn => soilbiogeochem_nitrogenflux_inst%ffix_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) free living N fixation to soil mineral N @@ -465,7 +494,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & end if if (abs(col_errnb(c)) > 1e-7_r8) then - write(iulog,*) 'nbalance warning',c,col_errnb(c),col_endnb(c) + write(iulog,*) 'nbalance warning at c =', c, col_errnb(c), col_endnb(c) write(iulog,*)'inputs,ffix,nfix,ndep = ',ffix_to_sminn(c)*dt,nfix_to_sminn(c)*dt,ndep_to_sminn(c)*dt write(iulog,*)'outputs,lch,roff,dnit = ',smin_no3_leached(c)*dt, smin_no3_runoff(c)*dt,f_n2o_nit(c)*dt end if @@ -487,6 +516,175 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + + ! Repeat error check at the gridcell level + call c2g( bounds = bounds, & + carr = totcoln(bounds%begc:bounds%endc), & + garr = totgrcn(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = nfix_to_sminn(bounds%begc:bounds%endc), & + garr = nfix_to_sminn_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = supplement_to_sminn(bounds%begc:bounds%endc), & + garr = supplement_to_sminn_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + if (use_fun) then + call c2g( bounds = bounds, & + carr = ffix_to_sminn(bounds%begc:bounds%endc), & + garr = ffix_to_sminn_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + end if + if (use_crop) then + call c2g( bounds = bounds, & + carr = fert_to_sminn(bounds%begc:bounds%endc), & + garr = fert_to_sminn_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = soyfixn_to_sminn(bounds%begc:bounds%endc), & + garr = soyfixn_to_sminn_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + end if + call c2g( bounds = bounds, & + carr = denit(bounds%begc:bounds%endc), & + garr = denit_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = col_fire_nloss(bounds%begc:bounds%endc), & + garr = grc_fire_nloss(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = wood_harvestn(bounds%begc:bounds%endc), & + garr = wood_harvestn_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = grainn_to_cropprodn(bounds%begc:bounds%endc), & + garr = grainn_to_cropprodn_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = som_n_leached(bounds%begc:bounds%endc), & + garr = som_n_leached_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + if (.not. use_nitrif_denitrif) then + call c2g( bounds = bounds, & + carr = sminn_leached(bounds%begc:bounds%endc), & + garr = sminn_leached_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + else + call c2g( bounds = bounds, & + carr = f_n2o_nit(bounds%begc:bounds%endc), & + garr = f_n2o_nit_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = smin_no3_leached(bounds%begc:bounds%endc), & + garr = smin_no3_leached_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = smin_no3_runoff(bounds%begc:bounds%endc), & + garr = smin_no3_runoff_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + end if + + err_found = .false. + do g = bounds%begg, bounds%endg + ! calculate the total gridcell-level nitrogen storage, for mass conservation check + grc_endnb(g) = totgrcn(g) + seedn_grc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) + + ! calculate total gridcell-level inputs + grc_ninputs(g) = forc_ndep(g) + nfix_to_sminn_grc(g) + & + supplement_to_sminn_grc(g) + & + dwt_seedn_to_leaf_grc(g) + & + dwt_seedn_to_deadstem_grc(g) + + if (use_fun) then + grc_ninputs(g) = grc_ninputs(g) + ffix_to_sminn_grc(g) + endif + + if (use_crop) then + grc_ninputs(g) = grc_ninputs(g) + fert_to_sminn_grc(g) + soyfixn_to_sminn_grc(g) + end if + + ! calculate total gridcell-level outputs + grc_noutputs(g) = denit_grc(g) + grc_fire_nloss(g) + & + wood_harvestn_grc(g) + grainn_to_cropprodn_grc(g) - & + som_n_leached_grc(g) + + if (.not. use_nitrif_denitrif) then + grc_noutputs(g) = grc_noutputs(g) + sminn_leached_grc(g) + else + grc_noutputs(g) = grc_noutputs(g) + f_n2o_nit_grc(g) + & + smin_no3_leached_grc(g) + smin_no3_runoff_grc(g) + end if + + ! calculate the total gridcell-level nitrogen balance error for this time step + grc_errnb(g) = (grc_ninputs(g) - grc_noutputs(g)) * dt - & + (grc_endnb(g) - grc_begnb(g)) + + if (abs(grc_errnb(g)) > 1e-3_r8) then + err_found = .true. + err_index = g + end if + + if (abs(grc_errnb(g)) > 1e-7_r8) then + write(iulog,*) 'nbalance warning at g =', g, grc_errnb(g), grc_endnb(g) + end if + end do + + if (err_found) then + g = err_index + write(iulog,*) 'gridcell nbalance error =', grc_errnb(g), g + write(iulog,*) 'latdeg, londeg =', grc%latdeg(g), grc%londeg(g) + write(iulog,*) 'begnb =', grc_begnb(g) + write(iulog,*) 'endnb =', grc_endnb(g) + write(iulog,*) 'delta store =', grc_endnb(g) - grc_begnb(g) + write(iulog,*) 'input mass =', grc_ninputs(g) * dt + write(iulog,*) 'output mass =', grc_noutputs(g) * dt + write(iulog,*) 'net flux =', (grc_ninputs(g) - grc_noutputs(g)) * dt + write(iulog,*) '--- Inputs ---' + write(iulog,*) 'forc_ndep =', forc_ndep(g) * dt + write(iulog,*) 'nfix_to_sminn_grc =', nfix_to_sminn_grc(g) * dt + write(iulog,*) 'supplement_to_sminn_grc =', supplement_to_sminn_grc(g) * dt + write(iulog,*) 'dwt_seedn_to_leaf_grc =', dwt_seedn_to_leaf_grc(g) * dt + write(iulog,*) 'dwt_seedn_to_deadstem_grc =', dwt_seedn_to_deadstem_grc(g) * dt + if (use_fun) then + write(iulog,*) 'ffix_to_sminn_grc =', ffix_to_sminn_grc(g) * dt + end if + if (use_crop) then + write(iulog,*) 'fert_to_sminn_grc =', fert_to_sminn_grc(g) * dt + write(iulog,*) 'soyfixn_to_sminn_grc =', soyfixn_to_sminn_grc(g) * dt + end if + write(iulog,*) '--- Outputs ---' + write(iulog,*) 'denit_grc =', denit_grc(g) * dt + write(iulog,*) 'grc_fire_nloss =', grc_fire_nloss(g) * dt + write(iulog,*) 'wood_harvestn_grc =', wood_harvestn_grc(g) * dt + write(iulog,*) 'grainn_to_cropprodn_grc =', grainn_to_cropprodn_grc(g) * dt + write(iulog,*) 'minus som_n_leached_grc =', - som_n_leached_grc(g) * dt + if (.not. use_nitrif_denitrif) then + write(iulog,*) 'sminn_leached_grc =', sminn_leached_grc(g) * dt + else + write(iulog,*) 'f_n2o_nit_grc =', f_n2o_nit_grc(g) * dt + write(iulog,*) 'smin_no3_leached_grc =', smin_no3_leached_grc(g) * dt + write(iulog,*) 'smin_no3_runoff_grc =', smin_no3_runoff_grc(g) * dt + end if + call endrun(msg=errMsg(sourcefile, __LINE__)) end if diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 928fb22116..55b48c66ac 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -41,7 +41,7 @@ module CNProductsMod ! Fluxes: gains real(r8), pointer :: dwt_prod10_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 10-year wood product pool real(r8), pointer :: dwt_prod100_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 100-year wood product pool - real(r8), pointer, public :: dwt_woodprod_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to wood product pools + real(r8), pointer :: dwt_woodprod_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to wood product pools real(r8), pointer :: dwt_cropprod1_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 1-year crop product pool real(r8), pointer :: hrv_deadstem_to_prod10_patch(:) ! (g[C or N]/m2/s) dead stem harvest to 10-year wood product pool real(r8), pointer :: hrv_deadstem_to_prod10_grc(:) ! (g[C or N]/m2/s) dead stem harvest to 10-year wood product pool diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 6b99d6a489..b56532a96c 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -845,7 +845,7 @@ subroutine InitGridcellBalance(this, bounds, num_allc, filter_allc, & call this%cn_balance_inst%BeginCNGridcellBalance( bounds, & this%cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst, & - this%c_products_inst) + this%c_products_inst, this%n_products_inst) end subroutine InitGridcellBalance @@ -1062,7 +1062,8 @@ end subroutine EcosystemDynamicsPostDrainage !----------------------------------------------------------------------- subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenflux_inst) + soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenflux_inst, & + atm2lnd_inst) ! ! !DESCRIPTION: ! Check the carbon and nitrogen balance @@ -1079,6 +1080,7 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & integer , intent(in) :: filter_soilc(:) ! filter for soil columns type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst + type(atm2lnd_type) , intent(in) :: atm2lnd_inst ! ! !LOCAL VARIABLES: integer :: DA_nstep ! time step number @@ -1096,13 +1098,17 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & call this%cn_balance_inst%CBalanceCheck( & bounds, num_soilc, filter_soilc, & soilbiogeochem_carbonflux_inst, & - this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, & + this%cnveg_carbonflux_inst, & + this%cnveg_carbonstate_inst, & this%c_products_inst) call this%cn_balance_inst%NBalanceCheck( & bounds, num_soilc, filter_soilc, & soilbiogeochem_nitrogenflux_inst, & - this%cnveg_nitrogenflux_inst, this%cnveg_nitrogenstate_inst) + this%cnveg_nitrogenflux_inst, & + this%cnveg_nitrogenstate_inst, & + this%n_products_inst, & + atm2lnd_inst) end if diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 6dea9d4d3a..ea47492f53 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1068,7 +1068,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_startf('cnbalchk') call bgc_vegetation_inst%BalanceCheck( & bounds_clump, filter(nc)%num_soilc, filter(nc)%soilc, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenflux_inst) + soilbiogeochem_carbonflux_inst, & + soilbiogeochem_nitrogenflux_inst, atm2lnd_inst ) call t_stopf('cnbalchk') end if From 604b28e5361cf356c63f215b45ea104fa38fd5b9 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 28 Apr 2020 17:07:02 -0600 Subject: [PATCH 0825/1973] Adding a term to the gridcell-level C balance error check ...though still getting a C balance error. Removed a line that was repeating in CNVegCarbonFluxType.F90 --- src/biogeochem/CNBalanceCheckMod.F90 | 12 +++++++++--- src/biogeochem/CNVegCarbonFluxType.F90 | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index ec504cdf17..89f00d34d7 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -207,6 +207,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8) :: col_coutputs, grc_coutputs real(r8) :: col_errcb(bounds%begc:bounds%endc) real(r8) :: grc_errcb(bounds%begg:bounds%endg) + real(r8) :: som_c_leached_grc(bounds%begg:bounds%endg) !----------------------------------------------------------------------- associate( & @@ -304,6 +305,11 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & garr = totgrcc(bounds%begg:bounds%endg), & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') + call c2g( bounds = bounds, & + carr = som_c_leached(bounds%begc:bounds%endc), & + garr = som_c_leached_grc(bounds%begg:bounds%endg), & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') err_found = .false. do g = bounds%begg, bounds%endg @@ -320,7 +326,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & dwt_seedc_to_deadstem_grc(g) ! calculate total gridcell-level outputs - grc_coutputs = 0._r8 + grc_coutputs = - som_c_leached_grc(g) ! calculate the total gridcell-level carbon balance error ! for this time step @@ -349,7 +355,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*)'dwt_seedc_to_leaf_grc =', dwt_seedc_to_leaf_grc(g) * dt write(iulog,*)'dwt_seedc_to_deadstem_grc =', dwt_seedc_to_deadstem_grc(g) * dt write(iulog,*)'--- Outputs ---' - write(iulog,*)'NONE =', 0 + write(iulog,*)'-1*som_c_leached_grc = ', som_c_leached_grc(g) * dt call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -676,7 +682,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*) 'grc_fire_nloss =', grc_fire_nloss(g) * dt write(iulog,*) 'wood_harvestn_grc =', wood_harvestn_grc(g) * dt write(iulog,*) 'grainn_to_cropprodn_grc =', grainn_to_cropprodn_grc(g) * dt - write(iulog,*) 'minus som_n_leached_grc =', - som_n_leached_grc(g) * dt + write(iulog,*) '-1*som_n_leached_grc = ', som_n_leached_grc(g) * dt if (.not. use_nitrif_denitrif) then write(iulog,*) 'sminn_leached_grc =', sminn_leached_grc(g) * dt else diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 5729a1a9f2..b9f512329a 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -3956,7 +3956,6 @@ subroutine SetValues ( this, & this%litfire_col(i) = value_column this%somfire_col(i) = value_column this%totfire_col(i) = value_column - this%fire_closs_col(i) = value_column ! Zero p2c column fluxes this%rr_col(i) = value_column From a6132a3000aad675a52af5939df0c515ff93b63f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 28 Apr 2020 22:24:11 -0600 Subject: [PATCH 0826/1973] finidat files that get the last tests to pass --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- .../testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index b1b2f05092..2752f17214 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -632,7 +632,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="18500101" use_nitrif_denitrif=".true." use_vertsoilc=".true." sim_year="1850" ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".false." lnd_tuning_mode="clm5_0_GSWP3v1" ->lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200321.nc +>lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm index c58bc66d21..44014d43e0 100644 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm @@ -2,4 +2,4 @@ ! ! Initial condition file at the desired configuration to run, so can verify that interpolating from it gives the same result ! Note that this was generated with GLC_TWO_WAY_COUPLING=FALSE -finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2000-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c200319.nc' +finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2000-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c200428.nc' From 6965442e6c528684bf2de1a20c31036e2bb5507c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 29 Apr 2020 10:56:55 -0600 Subject: [PATCH 0827/1973] Remove note about not being able to use hires option for nldas grid as now can, fix a difference that didn't get in from the release branch that wasn't allowing the code to compile in mkglcmecMod --- tools/mksurfdata_map/Makefile.data | 3 - .../mksurfdata_map/src/mkCH4inversionMod.F90 | 172 ------------------ tools/mksurfdata_map/src/mkglcmecMod.F90 | 2 +- 3 files changed, 1 insertion(+), 176 deletions(-) delete mode 100644 tools/mksurfdata_map/src/mkCH4inversionMod.F90 diff --git a/tools/mksurfdata_map/Makefile.data b/tools/mksurfdata_map/Makefile.data index b3fdcffd2e..a19eac423a 100644 --- a/tools/mksurfdata_map/Makefile.data +++ b/tools/mksurfdata_map/Makefile.data @@ -133,9 +133,6 @@ global-present-ne16np4 : FORCE global-present-ne120np4 : FORCE $(MKSURFDATA) -no-crop -glc_nec 10 -y 2000 -res ne120np4 $(BACKGROUND) -# BUG(wjs, 2019-04-10, ESCOMP/ctsm#262) This -hirespft won't work until issue 262 is resolved -# For now, I'm using: -# -no-crop -glc_nec 10 -y 2005 -res 0.125nldas2 global-present-nldas : FORCE $(MKSURFDATA) -no-crop -hirespft -glc_nec 10 -y 2005 -res 0.125nldas2 $(BACKGROUND) diff --git a/tools/mksurfdata_map/src/mkCH4inversionMod.F90 b/tools/mksurfdata_map/src/mkCH4inversionMod.F90 deleted file mode 100644 index d5124408cb..0000000000 --- a/tools/mksurfdata_map/src/mkCH4inversionMod.F90 +++ /dev/null @@ -1,172 +0,0 @@ -module mkCH4inversionMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: mkCH4inversionMod -! -! !DESCRIPTION: -! make inversion-derived parameters for CH4 -! -! !REVISION HISTORY: -! Author: Bill Sacks -! -!----------------------------------------------------------------------- -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use mkdomainMod , only : domain_checksame - - implicit none - - private - -! !PUBLIC MEMBER FUNCTIONS: - public mkCH4inversion ! make inversion-derived parameters for CH4 -! -!EOP -!=============================================================== -contains -!=============================================================== - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: mkCH4inversion -! -! !INTERFACE: -subroutine mkCH4inversion(ldomain, mapfname, datfname, ndiag, & - f0_o, p3_o, zwt0_o) -! -! !DESCRIPTION: -! make inversion-derived parameters for CH4 -! -! !USES: - use mkdomainMod, only : domain_type, domain_clean, domain_read - use mkgridmapMod - use mkncdio - use mkdiagnosticsMod, only : output_diagnostics_continuous - use mkchecksMod, only : min_bad, max_bad -! -! !ARGUMENTS: - - implicit none - type(domain_type) , intent(in) :: ldomain - character(len=*) , intent(in) :: mapfname ! input mapping file name - character(len=*) , intent(in) :: datfname ! input data file name - integer , intent(in) :: ndiag ! unit number for diag out - real(r8) , intent(out):: f0_o(:) ! output grid: maximum gridcell fractional inundated area (unitless) - real(r8) , intent(out):: p3_o(:) ! output grid: coefficient for qflx_surf_lag for finundated (s/mm) - real(r8) , intent(out):: zwt0_o(:) ! output grid: decay factor for finundated (m) -! -! !CALLED FROM: -! subroutine mksrfdat in module mksrfdatMod -! -! !REVISION HISTORY: -! Author: Bill Sacks -! -! -! !LOCAL VARIABLES: -!EOP - type(gridmap_type) :: tgridmap - type(domain_type) :: tdomain ! local domain - real(r8), allocatable :: data_i(:) ! data on input grid - integer :: ncid,varid ! input netCDF id's - integer :: ier ! error status - - real(r8), parameter :: min_valid_f0 = 0._r8 - real(r8), parameter :: max_valid_f0 = 1._r8 + 1.0e-14_r8 - real(r8), parameter :: min_valid_p3 = 0._r8 - real(r8), parameter :: min_valid_zwt0 = 0._r8 - - character(len=32) :: subname = 'mkCH4inversion' -!----------------------------------------------------------------------- - - write (6,*) 'Attempting to make inversion-derived CH4 parameters.....' - call shr_sys_flush(6) - - ! ----------------------------------------------------------------- - ! Read domain and mapping information, check for consistency - ! ----------------------------------------------------------------- - - call domain_read(tdomain,datfname) - - call gridmap_mapread(tgridmap, mapfname ) - call gridmap_check( tgridmap, subname ) - - call domain_checksame( tdomain, ldomain, tgridmap ) - - ! ----------------------------------------------------------------- - ! Open input file, allocate memory for input data - ! ----------------------------------------------------------------- - - write(6,*)'Open CH4 parameter file: ', trim(datfname) - call check_ret(nf_open(datfname, 0, ncid), subname) - - allocate(data_i(tdomain%ns), stat=ier) - if (ier/=0) call abort() - - ! ----------------------------------------------------------------- - ! Regrid f0 - ! ----------------------------------------------------------------- - - call check_ret(nf_inq_varid (ncid, 'F0', varid), subname) - call check_ret(nf_get_var_double (ncid, varid, data_i), subname) - call gridmap_areaave(tgridmap, data_i, f0_o, nodata=0.01_r8) - - ! Check validity of output data - if (min_bad(f0_o, min_valid_f0, 'f0') .or. & - max_bad(f0_o, max_valid_f0, 'f0')) then - stop - end if - - call output_diagnostics_continuous(data_i, f0_o, tgridmap, "F0: max inundated area", "unitless", ndiag) - - ! ----------------------------------------------------------------- - ! Regrid p3 - ! ----------------------------------------------------------------- - - call check_ret(nf_inq_varid (ncid, 'P3', varid), subname) - call check_ret(nf_get_var_double (ncid, varid, data_i), subname) - call gridmap_areaave(tgridmap, data_i, p3_o, nodata=10._r8) - - ! Check validity of output data - if (min_bad(p3_o, min_valid_p3, 'p3')) then - stop - end if - - call output_diagnostics_continuous(data_i, p3_o, tgridmap, "P3: finundated coeff", "s/mm", ndiag) - - ! ----------------------------------------------------------------- - ! Regrid zwt0 - ! ----------------------------------------------------------------- - - call check_ret(nf_inq_varid (ncid, 'ZWT0', varid), subname) - call check_ret(nf_get_var_double (ncid, varid, data_i), subname) - call gridmap_areaave(tgridmap, data_i, zwt0_o, nodata=0.01_r8) - - ! Check validity of output data - if (min_bad(zwt0_o, min_valid_zwt0, 'zwt0')) then - stop - end if - - call output_diagnostics_continuous(data_i, zwt0_o, tgridmap, "ZWT0: finundated decay factor", "m", ndiag) - - ! ----------------------------------------------------------------- - ! Close files and deallocate dynamic memory - ! ----------------------------------------------------------------- - - call check_ret(nf_close(ncid), subname) - call domain_clean(tdomain) - call gridmap_clean(tgridmap) - deallocate (data_i) - - write (6,*) 'Successfully made inversion-derived CH4 parameters' - write (6,*) - call shr_sys_flush(6) - -end subroutine mkCH4inversion - - -end module mkCH4inversionMod diff --git a/tools/mksurfdata_map/src/mkglcmecMod.F90 b/tools/mksurfdata_map/src/mkglcmecMod.F90 index 4adbb91df6..6ff0754950 100644 --- a/tools/mksurfdata_map/src/mkglcmecMod.F90 +++ b/tools/mksurfdata_map/src/mkglcmecMod.F90 @@ -213,7 +213,7 @@ subroutine mkglcmec(ldomain, mapfname, & topoglcmec_o(:,:) = 0. if ( outnc_3dglc )then if ( (.not. present(pctglcmec_gic_o)) .or. (.not. present(pctglcmec_icesheet_o)) .or. & - (.not. present(pctglc_gic_o) .or. (.not. present(pctglc_icesheet_o) )then + (.not. present(pctglc_gic_o) ) .or. (.not. present(pctglc_icesheet_o) ) )then call shr_sys_abort( subname//' ERROR: 3D glacier fields were NOT sent in and they are required' ) end if pctglcmec_gic_o(:,:) = 0. From 668b782d773b26922152314d1b64f84be475b8c2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 29 Apr 2020 11:10:41 -0600 Subject: [PATCH 0828/1973] Bring in the 5x5_amazon test from release-clm5.0.30 as it tests -hires and was missing off of master --- test/tools/README.testnames | 1 + test/tools/input_tests_master | 3 +++ test/tools/nl_files/mksrfdt_5x5_amazon_hirespft_2005 | 1 + test/tools/tests_pretag_cheyenne_nompi | 1 + 4 files changed, 6 insertions(+) create mode 100644 test/tools/nl_files/mksrfdt_5x5_amazon_hirespft_2005 diff --git a/test/tools/README.testnames b/test/tools/README.testnames index 5cb5de027a..2795a14f0a 100644 --- a/test/tools/README.testnames +++ b/test/tools/README.testnames @@ -36,6 +36,7 @@ m is the resolution 1 -- 48x96 5 -- 10x15 +6 -- 5x5_amazon 7 -- 1x1 brazil 8 -- US-UMB 9 -- 4x5 diff --git a/test/tools/input_tests_master b/test/tools/input_tests_master index eef1daf901..4050873b42 100644 --- a/test/tools/input_tests_master +++ b/test/tools/input_tests_master @@ -23,6 +23,9 @@ bli57 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__ smi58 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_crp_1850-2000^tools__do bli58 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_crp_1850-2000^tools__do +smi64 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_5x5_amazon_hirespft_2005^tools__ds +bli64 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_5x5_amazon_hirespft_2005^tools__ds + smi74 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds bli74 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds smi78 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds diff --git a/test/tools/nl_files/mksrfdt_5x5_amazon_hirespft_2005 b/test/tools/nl_files/mksrfdt_5x5_amazon_hirespft_2005 new file mode 100644 index 0000000000..47a5391c84 --- /dev/null +++ b/test/tools/nl_files/mksrfdt_5x5_amazon_hirespft_2005 @@ -0,0 +1 @@ +-l CSMDATA -r 5x5_amazon -y 2005 -hirespft -exedir EXEDIR diff --git a/test/tools/tests_pretag_cheyenne_nompi b/test/tools/tests_pretag_cheyenne_nompi index c3a2325cea..1f35731f8d 100644 --- a/test/tools/tests_pretag_cheyenne_nompi +++ b/test/tools/tests_pretag_cheyenne_nompi @@ -4,6 +4,7 @@ sme@4 ble@4 smg54 blg54 smi24 bli24 smi53 bli53 +smi64 bli64 smi54 bli54 smi57 bli57 smi58 bli58 From 3ad3f7a013bbbfaf8f4626468442094d7df3ebf6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 29 Apr 2020 11:57:50 -0600 Subject: [PATCH 0829/1973] Variable names can't start with numbers so change 3dglc back to glc --- tools/mksurfdata_map/mksurfdata.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/mksurfdata_map/mksurfdata.pl b/tools/mksurfdata_map/mksurfdata.pl index a1815ecbd9..a636624fca 100755 --- a/tools/mksurfdata_map/mksurfdata.pl +++ b/tools/mksurfdata_map/mksurfdata.pl @@ -52,7 +52,7 @@ my %opts = ( hgrid=>"all", vic=>0, - 3dglc=>0, + glc=>0, ssp_rcp=>"hist", debug=>0, exedir=>undef, @@ -147,7 +147,7 @@ sub usage { -usrname "clm_usrdat_name" CLM user data name to find grid file with. -vic Add the fields required for the VIC model - -3dglc Add the optional 3D glacier fields for verification of the glacier model + -glc Add the optional 3D glacier fields for verification of the glacier model NOTE: years, res, and ssp_rcp can be comma delimited lists. @@ -372,7 +372,7 @@ sub write_namelist_file { outnc_3dglc = .true. EOF } - if ( $opts{'3dglc'} ) { + if ( $opts{'glc'} ) { print $fh <<"EOF"; outnc_3dglc = .true. EOF @@ -470,7 +470,7 @@ sub write_namelist_file { "pft_idx=s" => \$opts{'pft_idx'}, "ssp_rcp=s" => \$opts{'ssp_rcp'}, "vic!" => \$opts{'vic'}, - "3dglc!" => \$opts{'3dglc'}, + "glc!" => \$opts{'glc'}, "rundir=s" => \$opts{'rundir'}, "soil_col=i" => \$opts{'soil_col'}, "soil_fmx=f" => \$opts{'soil_fmx'}, From 056e899110031c02b54296b713b983f7d689fadf Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 29 Apr 2020 13:07:08 -0600 Subject: [PATCH 0830/1973] Fix ssp_rcp setting that needed quotes --- tools/mksurfdata_map/mksurfdata.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mksurfdata_map/mksurfdata.pl b/tools/mksurfdata_map/mksurfdata.pl index a636624fca..2106a16e32 100755 --- a/tools/mksurfdata_map/mksurfdata.pl +++ b/tools/mksurfdata_map/mksurfdata.pl @@ -552,7 +552,7 @@ sub write_namelist_file { my @rcpaths = split( ",", $opts{'ssp_rcp'} ); # Check that ssp_rcp is valid foreach my $ssp_rcp ( @rcpaths ) { - if ( ! $definition->is_valid_value( "ssp_rcp", $ssp_rcp ) ) { + if ( ! $definition->is_valid_value( "ssp_rcp", "'$ssp_rcp'" ) ) { print "** Invalid ssp_rcp: $ssp_rcp\n"; usage(); } From 0227704dedcc101ed5a656fafa5ff224c1230e4a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 29 Apr 2020 16:38:02 -0600 Subject: [PATCH 0831/1973] Bring in the updates on the release branch for new SSP, and pre-millenial as well as PtVg and high resolution PFT raw datasets --- .../namelist_defaults_ctsm_tools.xml | 6747 ++++++++++++++++- 1 file changed, 6580 insertions(+), 167 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm_tools.xml b/bld/namelist_files/namelist_defaults_ctsm_tools.xml index f563e5e7f5..ad82dd7bf6 100644 --- a/bld/namelist_files/namelist_defaults_ctsm_tools.xml +++ b/bld/namelist_files/namelist_defaults_ctsm_tools.xml @@ -46,6 +46,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/mappingdata/grids/SCRIPgrid_ne16np4_nomask_c110512.nc lnd/clm2/mappingdata/grids/SCRIPgrid_ne4np4_nomask_c110808.nc + +lnd/clm2/mappingdata/grids/SCRIPgrid_conus_30_x8_nomask_c170111.nc + lnd/clm2/mappingdata/grids/SCRIPgrid_0.125x0.125_nomask_c140702.nc @@ -162,11 +165,13 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.5x0.5 0.5x0.5 0.25x0.25 +3x3min 0.25x0.25 3x3min 0.25x0.25 3x3min 0.25x0.25 +3x3min 5x5min 3x3min 10x10min @@ -209,6 +214,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/rawdata/mksrf_navyoro_20min.c010129.nc + lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190116/mksrf_lai_histclm52deg005_earthstatmirca_2005.c190119.nc @@ -310,340 +316,6747 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >lnd/clm2/rawdata/pftcftdynharv.0.05x0.05.LUH2.histsimyr2005.c190116/mksrf_landuse_clm52deg005_histLUH2_2005.c190119.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1850.c170629.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_850.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1851.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_851.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1852.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_852.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1853.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_853.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1854.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_854.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1855.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_855.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1856.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_856.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1857.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_857.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1858.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_858.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1859.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_859.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1860.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_860.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1861.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_861.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1862.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_862.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1863.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_863.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1864.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_864.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1865.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_865.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1866.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_866.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1867.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_867.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1868.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_868.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1869.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_869.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1870.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_870.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1871.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_871.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1872.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_872.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1873.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_873.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1874.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_874.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1875.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_875.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1876.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_876.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1877.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_877.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1878.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_878.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1879.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_879.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1880.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_880.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1881.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_881.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1882.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_882.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1883.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_883.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1884.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_884.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1885.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_885.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1886.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_886.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1887.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_887.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1888.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_888.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1889.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_889.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1890.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_890.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1891.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_891.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1892.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_892.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1893.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_893.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1894.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_894.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1895.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_895.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1896.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_896.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1897.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_897.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1898.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_898.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1899.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_899.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1900.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_900.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1901.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_901.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1902.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_902.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1903.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_903.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1904.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_904.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1905.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_905.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1906.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_906.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1907.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_907.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1908.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_908.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1909.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_909.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1910.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_910.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1911.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_911.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1912.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_912.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1913.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_913.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1914.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_914.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1915.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_915.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1916.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_916.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1917.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_917.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1918.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_918.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1919.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_919.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1920.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_920.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1921.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_921.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1922.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_922.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1923.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_923.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1924.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_924.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1925.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_925.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1926.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_926.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1927.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_927.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1928.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_928.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1929.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_929.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1930.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_930.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1931.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_931.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1932.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_932.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1933.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_933.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1934.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_934.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1935.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_935.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1936.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_936.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1937.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_937.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1938.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_938.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1939.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_939.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1940.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_940.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1941.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_941.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1942.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_942.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1943.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_943.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1944.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_944.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1945.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_945.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1946.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_946.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1947.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_947.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1948.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_948.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1949.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_949.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1950.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_950.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1951.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_951.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1952.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_952.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1953.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_953.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1954.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_954.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1955.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_955.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1956.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_956.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1957.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_957.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1958.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_958.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1959.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_959.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1960.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_960.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1961.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_961.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1962.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_962.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1963.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_963.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1964.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_964.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1965.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_965.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1966.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_966.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1967.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_967.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1968.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_968.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1969.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_969.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1970.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_970.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1971.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_971.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1972.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_972.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1973.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_973.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1974.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_974.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1975.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_975.c171012.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1976.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_976.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_977.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_978.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_979.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_980.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_981.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_982.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_983.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_984.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_985.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_986.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_987.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_988.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_989.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_990.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_991.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_992.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_993.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_994.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_995.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_996.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_997.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_998.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_999.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1000.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1001.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1002.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1003.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1004.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1005.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1006.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1007.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1008.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1009.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1010.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1011.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1012.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1013.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1014.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1015.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1016.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1017.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1018.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1019.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1020.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1021.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1022.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1023.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1024.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1025.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1026.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1027.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1028.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1029.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1030.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1031.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1032.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1033.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1034.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1035.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1036.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1037.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1038.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1039.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1040.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1041.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1042.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1043.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1044.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1045.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1046.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1047.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1048.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1049.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1050.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1051.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1052.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1053.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1054.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1055.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1056.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1057.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1058.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1059.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1060.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1061.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1062.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1063.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1064.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1065.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1066.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1067.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1068.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1069.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1070.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1071.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1072.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1073.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1074.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1075.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1076.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1077.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1078.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1079.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1080.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1081.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1082.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1083.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1084.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1085.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1086.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1087.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1088.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1089.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1090.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1091.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1092.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1093.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1094.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1095.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1096.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1097.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1098.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1099.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1100.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1101.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1102.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1103.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1104.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1105.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1106.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1107.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1108.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1109.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1110.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1111.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1112.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1113.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1114.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1115.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1116.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1117.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1118.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1119.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1120.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1121.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1122.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1123.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1124.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1125.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1126.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1127.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1128.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1129.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1130.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1131.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1132.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1133.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1134.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1135.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1136.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1137.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1138.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1139.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1140.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1141.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1142.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1143.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1144.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1145.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1146.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1147.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1148.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1149.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1150.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1151.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1152.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1153.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1154.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1155.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1156.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1157.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1158.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1159.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1160.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1161.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1162.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1163.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1164.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1165.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1166.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1167.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1168.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1169.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1170.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1171.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1172.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1173.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1174.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1175.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1176.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1177.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1178.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1179.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1180.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1181.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1182.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1183.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1184.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1185.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1186.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1187.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1188.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1189.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1190.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1191.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1192.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1193.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1194.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1195.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1196.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1197.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1198.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1199.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1200.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1201.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1202.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1203.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1204.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1205.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1206.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1207.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1208.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1209.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1210.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1211.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1212.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1213.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1214.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1215.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1216.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1217.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1218.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1219.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1220.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1221.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1222.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1223.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1224.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1225.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1226.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1227.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1228.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1229.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1230.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1231.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1232.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1233.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1234.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1235.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1236.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1237.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1238.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1239.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1240.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1241.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1242.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1243.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1244.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1245.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1246.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1247.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1248.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1249.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1250.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1251.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1252.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1253.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1254.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1255.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1256.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1257.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1258.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1259.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1260.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1261.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1262.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1263.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1264.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1265.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1266.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1267.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1268.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1269.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1270.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1271.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1272.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1273.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1274.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1275.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1276.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1277.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1278.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1279.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1280.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1281.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1282.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1283.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1284.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1285.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1286.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1287.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1288.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1289.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1290.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1291.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1292.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1293.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1294.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1295.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1296.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1297.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1298.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1299.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1300.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1301.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1302.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1303.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1304.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1305.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1306.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1307.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1308.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1309.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1310.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1311.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1312.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1313.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1314.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1315.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1316.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1317.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1318.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1319.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1320.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1321.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1322.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1323.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1324.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1325.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1326.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1327.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1328.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1329.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1330.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1331.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1332.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1333.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1334.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1335.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1336.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1337.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1338.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1339.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1340.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1341.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1342.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1343.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1344.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1345.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1346.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1347.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1348.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1349.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1350.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1351.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1352.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1353.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1354.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1355.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1356.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1357.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1358.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1359.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1360.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1361.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1362.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1363.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1364.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1365.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1366.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1367.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1368.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1369.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1370.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1371.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1372.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1373.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1374.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1375.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1376.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1377.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1378.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1379.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1380.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1381.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1382.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1383.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1384.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1385.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1386.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1387.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1388.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1389.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1390.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1391.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1392.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1393.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1394.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1395.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1396.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1397.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1398.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1399.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1400.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1401.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1402.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1403.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1404.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1405.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1406.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1407.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1408.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1409.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1410.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1411.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1412.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1413.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1414.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1415.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1416.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1417.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1418.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1419.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1420.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1421.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1422.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1423.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1424.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1425.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1426.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1427.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1428.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1429.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1430.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1431.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1432.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1433.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1434.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1435.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1436.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1437.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1438.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1439.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1440.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1441.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1442.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1443.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1444.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1445.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1446.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1447.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1448.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1449.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1450.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1451.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1452.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1453.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1454.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1455.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1456.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1457.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1458.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1459.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1460.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1461.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1462.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1463.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1464.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1465.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1466.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1467.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1468.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1469.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1470.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1471.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1472.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1473.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1474.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1475.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1476.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1477.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1478.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1479.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1480.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1481.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1482.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1483.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1484.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1485.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1486.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1487.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1488.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1489.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1490.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1491.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1492.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1493.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1494.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1495.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1496.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1497.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1498.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1499.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1500.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1501.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1502.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1503.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1504.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1505.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1506.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1507.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1508.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1509.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1510.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1511.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1512.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1513.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1514.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1515.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1516.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1517.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1518.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1519.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1520.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1521.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1522.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1523.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1524.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1525.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1526.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1527.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1528.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1529.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1530.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1531.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1532.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1533.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1534.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1535.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1536.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1537.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1538.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1539.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1540.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1541.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1542.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1543.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1544.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1545.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1546.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1547.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1548.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1549.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1550.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1551.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1552.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1553.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1554.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1555.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1556.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1557.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1558.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1559.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1560.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1561.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1562.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1563.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1564.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1565.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1566.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1567.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1568.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1569.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1570.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1571.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1572.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1573.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1574.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1575.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1576.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1577.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1578.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1579.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1580.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1581.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1582.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1583.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1584.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1585.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1586.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1587.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1588.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1589.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1590.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1591.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1592.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1593.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1594.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1595.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1596.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1597.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1598.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1599.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1600.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1601.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1602.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1603.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1604.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1605.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1606.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1607.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1608.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1609.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1610.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1611.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1612.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1613.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1614.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1615.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1616.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1617.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1618.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1619.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1620.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1621.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1622.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1623.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1624.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1625.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1626.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1627.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1628.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1629.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1630.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1631.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1632.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1633.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1634.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1635.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1636.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1637.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1638.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1639.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1640.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1641.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1642.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1643.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1644.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1645.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1646.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1647.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1648.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1649.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1650.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1651.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1652.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1653.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1654.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1655.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1656.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1657.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1658.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1659.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1660.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1661.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1662.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1663.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1664.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1665.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1666.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1667.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1668.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1669.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1670.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1671.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1672.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1673.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1674.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1675.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1676.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1677.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1678.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1679.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1680.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1681.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1682.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1683.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1684.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1685.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1686.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1687.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1688.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1689.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1690.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1691.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1692.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1693.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1694.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1695.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1696.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1697.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1698.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1699.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1700.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1701.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1702.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1703.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1704.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1705.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1706.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1707.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1708.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1709.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1710.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1711.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1712.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1713.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1714.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1715.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1716.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1717.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1718.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1719.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1720.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1721.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1722.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1723.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1724.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1725.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1726.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1727.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1728.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1729.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1730.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1731.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1732.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1733.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1734.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1735.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1736.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1737.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1738.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1739.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1740.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1741.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1742.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1743.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1744.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1745.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1746.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1747.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1748.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1749.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1750.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1751.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1752.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1753.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1754.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1755.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1756.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1757.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1758.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1759.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1760.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1761.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1762.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1763.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1764.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1765.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1766.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1767.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1768.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1769.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1770.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1771.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1772.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1773.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1774.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1775.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1776.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1777.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1778.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1779.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1780.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1781.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1782.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1783.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1784.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1785.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1786.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1787.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1788.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1789.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1790.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1791.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1792.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1793.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1794.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1795.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1796.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1797.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1798.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1799.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1800.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1801.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1802.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1803.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1804.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1805.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1806.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1807.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1808.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1809.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1810.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1811.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1812.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1813.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1814.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1815.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1816.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1817.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1818.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1819.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1820.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1821.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1822.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1823.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1824.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1825.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1826.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1827.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1828.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1829.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1830.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1831.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1832.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1833.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1834.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1835.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1836.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1837.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1838.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1839.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1840.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1841.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1842.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1843.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1844.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1845.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1846.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1847.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1848.c171012.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr0850-1849.c171012/mksrf_landuse_histclm50_LUH2_1849.c171012.nc + + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1850.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1851.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1852.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1853.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1854.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1855.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1856.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1857.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1858.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1859.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1860.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1861.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1862.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1863.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1864.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1865.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1866.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1867.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1868.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1869.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1870.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1871.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1872.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1873.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1874.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1875.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1876.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1877.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1878.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1879.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1880.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1881.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1882.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1883.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1884.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1885.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1886.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1887.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1888.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1889.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1890.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1891.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1892.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1893.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1894.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1895.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1896.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1897.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1898.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1899.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1900.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1901.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1902.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1903.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1904.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1905.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1906.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1907.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1908.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1909.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1910.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1911.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1912.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1913.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1914.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1915.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1916.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1917.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1918.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1919.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1920.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1921.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1922.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1923.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1924.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1925.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1926.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1927.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1928.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1929.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1930.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1931.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1932.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1933.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1934.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1935.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1936.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1937.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1938.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1939.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1940.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1941.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1942.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1943.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1944.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1945.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1946.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1947.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1948.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1949.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1950.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1951.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1952.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1953.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1954.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1955.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1956.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1957.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1958.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1959.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1960.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1961.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1962.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1963.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1964.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1965.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1966.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1967.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1968.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1969.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1970.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1971.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1972.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1973.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1974.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1975.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1976.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1977.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1978.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1979.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1980.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1981.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1982.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1983.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1984.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1985.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1986.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1987.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1988.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1989.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1990.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1991.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1992.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1993.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1994.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1995.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1996.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1997.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1998.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1999.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2000.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2001.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2002.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2003.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2004.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2005.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2006.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2007.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2008.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2009.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2010.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2011.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2012.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2013.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2014.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2015.c170629.nc + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.simyrPtVg.c181106/mksrf_landuse_potvegclm50_LUH2.c181106.nc + + + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2016.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2017.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2018.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2019.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2020.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2021.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2022.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2023.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2024.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2025.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2026.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2027.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2028.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2029.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2030.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2031.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2032.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2033.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2034.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2035.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2036.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2037.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2038.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2039.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2040.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2041.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2042.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2043.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2044.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2045.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2046.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2047.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2048.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2049.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2050.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2051.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2052.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2053.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2054.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2055.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2056.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2057.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2058.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2059.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2060.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2061.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2062.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2063.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2064.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2065.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2066.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2067.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2068.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2069.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2070.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2071.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2072.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2073.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2074.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2075.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2076.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2077.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2078.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2079.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2080.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2081.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2082.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2083.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2084.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2085.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2086.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2087.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2088.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2089.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2090.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2091.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2092.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2093.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2094.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2095.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2096.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2097.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2098.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2099.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-2.6.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP26_clm5_2100.c181217.nc + + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2016.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2017.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2018.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2019.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2020.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2021.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2022.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2023.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2024.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2025.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2026.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2027.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2028.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2029.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2030.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2031.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2032.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2033.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2034.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2035.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2036.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2037.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2038.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2039.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2040.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2041.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2042.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2043.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2044.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2045.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2046.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2047.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2048.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2049.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2050.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2051.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2052.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2053.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2054.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2055.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2056.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2057.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2058.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2059.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2060.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2061.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2062.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2063.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2064.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2065.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2066.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2067.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2068.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2069.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2070.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2071.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2072.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2073.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2074.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2075.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2076.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2077.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2078.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2079.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2080.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2081.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2082.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2083.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2084.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2085.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2086.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2087.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2088.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2089.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2090.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2091.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2092.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2093.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2094.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2095.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2096.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2097.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2098.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2099.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP3-7.0.simyr2016-2100.c181217/mksrf_landuse_SSP3RCP70_clm5_2100.c181217.nc + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2016.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2017.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2018.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2019.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2020.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2021.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2022.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2023.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2024.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2025.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2026.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2027.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2028.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2029.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2030.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2031.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2032.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2033.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2034.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2035.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2036.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2037.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2038.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2039.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2040.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2041.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2042.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2043.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2044.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2045.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2046.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2047.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2048.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2049.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2050.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2051.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2052.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2053.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2054.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2055.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2056.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2057.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2058.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2059.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2060.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2061.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2062.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2063.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2064.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2065.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2066.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2067.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2068.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2069.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2070.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2071.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2072.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2073.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2074.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2075.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2076.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2077.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2078.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2079.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2080.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2081.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2082.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2083.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2084.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2085.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2086.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2087.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2088.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2089.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2090.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2091.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2092.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2093.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2094.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2095.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2096.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2097.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2098.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2099.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP5RCP34_clm5_2100.c181217.nc + + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2016.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2017.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2018.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2019.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2020.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2021.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2022.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2023.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2024.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2025.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2026.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2027.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2028.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2029.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2030.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2031.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2032.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2033.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2034.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2035.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2036.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2037.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2038.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2039.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2040.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2041.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2042.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2043.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2044.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2045.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2046.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2047.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2048.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2049.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2050.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2051.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2052.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2053.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2054.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2055.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2056.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2057.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2058.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2059.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2060.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2061.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2062.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2063.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2064.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2065.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2066.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2067.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2068.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2069.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2070.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2071.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2072.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2073.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2074.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2075.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2076.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2077.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2078.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2079.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2080.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2081.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2082.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2083.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2084.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2085.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2086.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2087.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2088.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2089.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2090.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2091.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2092.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2093.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2094.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2095.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2096.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2097.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2098.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2099.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP2-4.5.simyr2016-2100.c181217/mksrf_landuse_SSP2RCP45_clm5_2100.c181217.nc + + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2016.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2017.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2018.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2019.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2020.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2021.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2022.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2023.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2024.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2025.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2026.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2027.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2028.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2029.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2030.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2031.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2032.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2033.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2034.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2035.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2036.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2037.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2038.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2039.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2040.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2041.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2042.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2043.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2044.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2045.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2046.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2047.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2048.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2049.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2050.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2051.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2052.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2053.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2054.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2055.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2056.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2057.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2058.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2059.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2060.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2061.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2062.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2063.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2064.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2065.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2066.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2067.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2068.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2069.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2070.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2071.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2072.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2073.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2074.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2075.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2076.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2077.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2078.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2079.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2080.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2081.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2082.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2083.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2084.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2085.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2086.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2087.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2088.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2089.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2090.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2091.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2092.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2093.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2094.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2095.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2096.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2097.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2098.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2099.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP1-1.9.simyr2016-2100.c181217/mksrf_landuse_SSP1RCP19_clm5_2100.c181217.nc + + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2016.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2017.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2018.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2019.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2020.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2021.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2022.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2023.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2024.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2025.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2026.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2027.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2028.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2029.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2030.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2031.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2032.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2033.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2034.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2035.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2036.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2037.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2038.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2039.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2040.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2041.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2042.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2043.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2044.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2045.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2046.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2047.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2048.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2049.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2050.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2051.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2052.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2053.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2054.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2055.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2056.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2057.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2058.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2059.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1977.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2060.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1978.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2061.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1979.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2062.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1980.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2063.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1981.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2064.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1982.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2065.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1983.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2066.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1984.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2067.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1985.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2068.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1986.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2069.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1987.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2070.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1988.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2071.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1989.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2072.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1990.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2073.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1991.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2074.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1992.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2075.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1993.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2076.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1994.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2077.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1995.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2078.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1996.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2079.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1997.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2080.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1998.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2081.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1999.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2082.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2000.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2083.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2001.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2084.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2002.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2085.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2003.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2086.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2004.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2087.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2005.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2088.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2006.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2089.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2007.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2090.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2008.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2091.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2009.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2092.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2010.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2093.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2011.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2094.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2012.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2095.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2013.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2096.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2014.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2097.c181217.nc -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2015.c170629.nc + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2098.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2099.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-3.4.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP34_clm5_2100.c181217.nc + + + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2016.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2017.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2018.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2019.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2020.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2021.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2022.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2023.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2024.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2025.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2026.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2027.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2028.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2029.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2030.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2031.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2032.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2033.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2034.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2035.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2036.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2037.c181217.nc +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2038.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2039.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2040.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2041.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2042.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2043.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2044.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2045.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2046.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2047.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2048.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2049.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2050.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2051.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2052.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2053.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2054.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2055.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2056.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2057.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2058.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2059.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2060.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2061.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2062.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2063.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2064.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2065.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2066.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2067.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2068.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2069.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2070.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2071.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2072.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2073.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2074.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2075.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2076.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2077.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2078.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2079.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2080.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2081.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2082.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2083.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2084.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2085.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2086.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2087.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2088.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2089.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2090.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2091.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2092.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2093.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2094.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2095.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2096.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2097.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2098.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2099.c181217.nc + + +lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP4-6.0.simyr2016-2100.c181217/mksrf_landuse_SSP4RCP60_clm5_2100.c181217.nc + + + + + lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.SSP5-8.5.simyr2016-2100.c171005/mksrf_landuse_SSP5RCP85_clm5_2016.c171005.nc From 682b8ca9e649cbed420de7de3200cdc2548cb133 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 29 Apr 2020 16:50:42 -0600 Subject: [PATCH 0832/1973] Fix a holdover from the release update conopts was used rather than phys --- bld/unit_testers/build-namelist_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index fa456ef89f..faac947342 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -434,7 +434,7 @@ sub make_config_cache { "dribble_crphrv w/o crop" =>{ options=>" -envxml_dir . -bgc cn -no-crop", namelst=>"dribble_crophrv_xsmrpool_2atm=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", + phys=>"clm5_0", }, "CNDV with flanduse_timeseries - clm4_5"=>{ options=>"-bgc bgc -dynamic_vegetation -envxml_dir . -ignore_warnings", namelst=>"flanduse_timeseries='my_flanduse_timeseries_file.nc'", From 2091c68ce4679e5848195adaa878faaeaf807ff0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 30 Apr 2020 00:26:11 -0600 Subject: [PATCH 0833/1973] Change name of file --- .../{mksrfdt_1x1_numaIA_mp24_2000 => mksrfdt_1x1_numaIA_crp_2000} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/tools/nl_files/{mksrfdt_1x1_numaIA_mp24_2000 => mksrfdt_1x1_numaIA_crp_2000} (100%) diff --git a/test/tools/nl_files/mksrfdt_1x1_numaIA_mp24_2000 b/test/tools/nl_files/mksrfdt_1x1_numaIA_crp_2000 similarity index 100% rename from test/tools/nl_files/mksrfdt_1x1_numaIA_mp24_2000 rename to test/tools/nl_files/mksrfdt_1x1_numaIA_crp_2000 From 552c207f7461ae8c54157576bd5d4313ae244fb2 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 30 Apr 2020 13:15:26 -0600 Subject: [PATCH 0834/1973] Corrections to get past C-balance error in transient case This test now PASSes ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive --- src/biogeochem/CNBalanceCheckMod.F90 | 18 ++++++++++++++---- src/biogeochem/CNProductsMod.F90 | 13 +++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index 89f00d34d7..79619c0ae3 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -183,7 +183,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & cnveg_carbonstate_inst, c_products_inst) ! ! !USES: - use subgridAveMod, only: c2g + use subgridAveMod, only: c2g, p2g ! ! !DESCRIPTION: ! Perform carbon mass conservation check for column and patch @@ -208,15 +208,17 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8) :: col_errcb(bounds%begc:bounds%endc) real(r8) :: grc_errcb(bounds%begg:bounds%endg) real(r8) :: som_c_leached_grc(bounds%begg:bounds%endg) + real(r8) :: crop_seedc_to_leaf_grc(bounds%begg:bounds%endg) !----------------------------------------------------------------------- associate( & + crop_seedc_to_leaf => cnveg_carbonflux_inst%crop_seedc_to_leaf_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) seed source to leaf grc_begcb => this%begcb_grc , & ! Input: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, beginning of time step grc_endcb => this%endcb_grc , & ! Output: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, end of time step totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool nbp_grc => cnveg_carbonflux_inst%nbp_grc , & ! Input: [real(r8) (:) ] (gC/m2/s) net biome production (positive for sink) cropprod1_grc => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products - tot_woodprod_grc => c_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products + tot_woodprod_grc => c_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products dwt_seedc_to_leaf_grc => cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to leaf dwt_seedc_to_deadstem_grc => cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to deadstem seedc_grc => cnveg_carbonstate_inst%seedc_grc , & ! Input: [real(r8) (:)] (gC/m2) seed carbon @@ -310,6 +312,13 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & garr = som_c_leached_grc(bounds%begg:bounds%endg), & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') + call p2g(bounds, & + crop_seedc_to_leaf(bounds%begp:bounds%endp), & + crop_seedc_to_leaf_grc(bounds%begg:bounds%endg), & + p2c_scale_type = 'unity', & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') + err_found = .false. do g = bounds%begg, bounds%endg @@ -322,8 +331,8 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! calculate total gridcell-level inputs ! slevis notes: ! nbp_grc = nep_grc - fire_closs_grc - hrv_xsmrpool_to_atm_dribbled_grc - dwt_conv_cflux_dribbled_grc - product_closs_grc - grc_cinputs = nbp_grc(g) + dwt_seedc_to_leaf_grc(g) + & - dwt_seedc_to_deadstem_grc(g) + grc_cinputs = nbp_grc(g) + crop_seedc_to_leaf_grc(g) + & + dwt_seedc_to_leaf_grc(g) + dwt_seedc_to_deadstem_grc(g) ! calculate total gridcell-level outputs grc_coutputs = - som_c_leached_grc(g) @@ -352,6 +361,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*)'delta store =', grc_endcb(g) - grc_begcb(g) write(iulog,*)'--- Inputs ---' write(iulog,*)'nbp_grc =', nbp_grc(g) * dt + write(iulog,*)'crop_seedc_to_leaf_grc =', crop_seedc_to_leaf_grc(g) * dt write(iulog,*)'dwt_seedc_to_leaf_grc =', dwt_seedc_to_leaf_grc(g) * dt write(iulog,*)'dwt_seedc_to_deadstem_grc =', dwt_seedc_to_deadstem_grc(g) * dt write(iulog,*)'--- Outputs ---' diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 55b48c66ac..9eca38bdbe 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -354,6 +354,19 @@ subroutine Restart(this, bounds, ncid, flag, & ! distinguish these gridcell-level restart fields from the obsolete column-level ! restart fields that are present on old restart files. + call restartvar(ncid=ncid, flag=flag, & + varname=this%species%rest_fname('tot_woodprod', suffix='_g'), & + xtype=ncd_double, dim1name='gridcell', & + long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%tot_woodprod_grc) + ! Backwards compatibility mentioned below is not applicable for this var. + ! If field not found in restart, then set from template if provided + if (flag == 'read' .and. .not. readvar .and. template_provided) then + call set_missing_from_template(this%tot_woodprod_grc, & + template_for_missing_fields%tot_woodprod_grc, & + multiplier = template_multiplier) + end if + call restartvar(ncid=ncid, flag=flag, & varname=this%species%rest_fname('cropprod1', suffix='_g'), & xtype=ncd_double, dim1name='gridcell', & From d3c17fb4d85e83d24ba65e34ab29a31689197b6b Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 30 Apr 2020 15:01:28 -0600 Subject: [PATCH 0835/1973] Added a term to the N balance check Test continues to PASS as in last commit. --- src/biogeochem/CNBalanceCheckMod.F90 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index 79619c0ae3..126afdf80d 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -319,7 +319,6 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') - err_found = .false. do g = bounds%begg, bounds%endg ! calculate gridcell-level carbon storage for mass conservation check @@ -383,7 +382,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! ! !USES: use clm_varctl, only : use_crop - use subgridAveMod, only: c2g + use subgridAveMod, only: c2g, p2g use atm2lndType, only: atm2lnd_type ! ! !ARGUMENTS: @@ -411,6 +410,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8):: grc_errnb(bounds%begg:bounds%endg) real(r8):: nfix_to_sminn_grc(bounds%begg:bounds%endg) real(r8):: supplement_to_sminn_grc(bounds%begg:bounds%endg) + real(r8):: crop_seedn_to_leaf_grc(bounds%begg:bounds%endg) real(r8):: ffix_to_sminn_grc(bounds%begg:bounds%endg) real(r8):: fert_to_sminn_grc(bounds%begg:bounds%endg) real(r8):: soyfixn_to_sminn_grc(bounds%begg:bounds%endg) @@ -426,6 +426,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & !----------------------------------------------------------------------- associate( & + crop_seedn_to_leaf => cnveg_nitrogenflux_inst%crop_seedn_to_leaf_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) seed source to leaf grc_begnb => this%begnb_grc , & ! Input: [real(r8) (:) ] (gN/m2) gridcell nitrogen mass, beginning of time step grc_endnb => this%endnb_grc , & ! Output: [real(r8) (:) ] (gN/m2) gridcell nitrogen mass, end of time step totgrcn => cnveg_nitrogenstate_inst%totn_grc , & ! Input: [real(r8) (:) ] (gN/m2) total gridcell nitrogen, incl veg @@ -618,6 +619,12 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') end if + call p2g(bounds, & + crop_seedn_to_leaf(bounds%begp:bounds%endp), & + crop_seedn_to_leaf_grc(bounds%begg:bounds%endg), & + p2c_scale_type = 'unity', & + c2l_scale_type = 'unity', & + l2g_scale_type = 'unity') err_found = .false. do g = bounds%begg, bounds%endg @@ -627,6 +634,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! calculate total gridcell-level inputs grc_ninputs(g) = forc_ndep(g) + nfix_to_sminn_grc(g) + & supplement_to_sminn_grc(g) + & + crop_seedn_to_leaf_grc(g) + & dwt_seedn_to_leaf_grc(g) + & dwt_seedn_to_deadstem_grc(g) @@ -678,6 +686,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*) 'forc_ndep =', forc_ndep(g) * dt write(iulog,*) 'nfix_to_sminn_grc =', nfix_to_sminn_grc(g) * dt write(iulog,*) 'supplement_to_sminn_grc =', supplement_to_sminn_grc(g) * dt + write(iulog,*) 'crop_seedn_to_leaf_grc =', crop_seedn_to_leaf_grc(g) * dt write(iulog,*) 'dwt_seedn_to_leaf_grc =', dwt_seedn_to_leaf_grc(g) * dt write(iulog,*) 'dwt_seedn_to_deadstem_grc =', dwt_seedn_to_deadstem_grc(g) * dt if (use_fun) then From 9fadf59c025458e887e8d404b3b5f40a134a4040 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 10:17:50 -0600 Subject: [PATCH 0836/1973] Update 02_support_needed.md Update the link --- .github/ISSUE_TEMPLATE/02_support_needed.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/02_support_needed.md b/.github/ISSUE_TEMPLATE/02_support_needed.md index a199e5217d..0d0afce809 100644 --- a/.github/ISSUE_TEMPLATE/02_support_needed.md +++ b/.github/ISSUE_TEMPLATE/02_support_needed.md @@ -8,7 +8,7 @@ about: Ask for help with using CTSM We have limited staff and ability to provide support. Here are some resources that might provide help: - User's Guide: https://escomp.github.io/ctsm-docs/doc/build/html/users_guide/index.html -- CESM's land modeling forum: https://xenforo.cgd.ucar.edu/cesm/land-river-runoff.134/ +- CESM's land modeling forum: https://xenforo.cgd.ucar.edu/cesm/ctsm-clm-mosart-rtm.134/ - README files amongst the source code - GitHub CTSM issues: https://github.com/escomp/ctsm/issues/ - Also make sure this issue is unique to CTSM and not really an issue with CESM or CIME From 026259b2023a816d3ea8c924f978edd5a97d4eca Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 10:19:37 -0600 Subject: [PATCH 0837/1973] Update 02_support_needed.md --- .github/ISSUE_TEMPLATE/02_support_needed.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/02_support_needed.md b/.github/ISSUE_TEMPLATE/02_support_needed.md index 0d0afce809..700f5252b9 100644 --- a/.github/ISSUE_TEMPLATE/02_support_needed.md +++ b/.github/ISSUE_TEMPLATE/02_support_needed.md @@ -8,7 +8,7 @@ about: Ask for help with using CTSM We have limited staff and ability to provide support. Here are some resources that might provide help: - User's Guide: https://escomp.github.io/ctsm-docs/doc/build/html/users_guide/index.html -- CESM's land modeling forum: https://xenforo.cgd.ucar.edu/cesm/ctsm-clm-mosart-rtm.134/ +- CESM's land modeling forum: https://xenforo.cgd.ucar.edu/cesm/forums/ctsm-clm-mosart-rtm.134/ - README files amongst the source code - GitHub CTSM issues: https://github.com/escomp/ctsm/issues/ - Also make sure this issue is unique to CTSM and not really an issue with CESM or CIME From 81aa3cf40868ff3f7da7ffa0ada46523de705a30 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 10:57:58 -0600 Subject: [PATCH 0838/1973] Start working on change files --- doc/ChangeLog | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 126 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index e97957cb5a..20fa4e1134 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,129 @@ =============================================================== +Tag name: ctsm1.0.dev093 +Originator(s): erik (Erik Kluzek) +Date: Fri May 1 10:12:22 MDT 2020 +One-line Summary: Bring in changes from release-clm5.0 branch to master + +Purpose of changes +------------------ + +Move changes from release-clm5.0.12.13/14/16/17/18/20/21/22/23/24/25/26/27/28/29/30 to master +(note excludes release-clm5.0.15, release-clm5.0.19) + +Answer changing! +Updates fates + + + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #746, #741, #873 + #746 -- + #741 -- + #873 -- + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + +Changes made to namelist defaults (e.g., changed parameter values): + +Changes to the datasets (e.g., parameter, surface or initial files): + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: + +Code reviewed by: self + + +CTSM testing: regular, tools + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (345 are different than baseline) + + tools-tests (test/tools): + + cheyenne - OK + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - OK + + python testing (see instructions in python/README.md; document testing done): + + cheyennne -- PASS (when ncar_pylib run) + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes + + Updates in all fsurdat files leads to changes in answers + Also there are updated finidat files as they had to be interpolated + to work with the new fsurdat files + + Summarize any changes to answers, i.e., + - what code configurations: + - what platforms/compilers: + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): fates, PTCLM + + fates to sci.1.30.0_api.8.0.0 + PTCLM to PTCLM2_20200121 + + FATES now points to the NGEET repository rather than the NCAR fates-release + +Pull Requests that document the changes (include PR ids): #883 +(https://github.com/ESCOMP/ctsm/pull) + #998 -- Remove Copyright file + #883 -- Bring changes on release-clm5.0 branch to master PR status: ready priority: high type: enhancement + #849 -- Fix link to new forums + #567 -- Ignore patterns for vim + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev092 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Mon Apr 27 14:51:21 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index b970d4d793..6285bf6bc9 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev093 erik 05/01/2020 Bring in changes from release-clm5.0 branch to master release-clm5.0.30 erik 01/21/2020 Update FATES to sci.1.30.0_api.8.0.0 release-clm5.0.29 erik 11/19/2019 Some answer changes needed for prescribed soil-moisture and clm4_5 defaults (1850-ndep, and urbantv settings) release-clm5.0.28 erik 11/14/2019 Several bit-for-bit fixes especially around soil-moisture streams From b3b9099f96126b5ea71cc8f919de1da72f7cbe47 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 11:12:57 -0600 Subject: [PATCH 0839/1973] Update README.developers update filenames --- tools/mksurfdata_map/README.developers | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/mksurfdata_map/README.developers b/tools/mksurfdata_map/README.developers index eaeb992ac7..9e3744b25f 100644 --- a/tools/mksurfdata_map/README.developers +++ b/tools/mksurfdata_map/README.developers @@ -74,7 +74,7 @@ in a separate section of this document. for dynlanduse = false and/or true, as appropriate - add a deallocation statement for each new output variable -- Add your new file in $CTSMROOT/bld/namelist_files/namelist_definition_clm4_5.xml; +- Add your new file in $CTSMROOT/bld/namelist_files/namelist_definition_ctsm.xml; e.g. (replace xxx with your new field): - Add your new mksrf_fxxx variable to the list of valid_values for - mksrf_filename in $CTSMROOT/bld/namelist_files/namelist_definition_clm4_5.xml + mksrf_filename in $CTSMROOT/bld/namelist_files/namelist_definition_ctsm.xml -- Add defaults in $CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5_tools.xml; +- Add defaults in $CTSMROOT/bld/namelist_files/namelist_defaults_ctsm_tools.xml; note that the "type" attribute is a short code that can be used in mksurfdata.pl, and doesn't have to match the "xxx" that is used elsewhere - lmask @@ -122,10 +122,10 @@ laid out here. to the inputdata directory - Add a scripgriddata entry for the new scrip grid file in - $CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5_tools.xml + $CTSMROOT/bld/namelist_files/namelist_defaults_ctsm_tools.xml - If necessary, add other entries in - $CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5_tools.xml giving information about your + $CTSMROOT/bld/namelist_files/namelist_defaults_ctsm_tools.xml giving information about your scrip grid file: - If this is a high resolution grid (e.g., 3min or higher), add a scripgriddata_lrgfile_needed entry, saying we need 64bit_offset @@ -137,7 +137,7 @@ laid out here. grid file is in SCRIP format and you can ignore this. - If necessary, add new grid and/or landmask to lists of valid values for - hgrid, res and lmask in $CTSMROOT/bld/namelist_files/namelist_definition_clm4_5.xml + hgrid, res and lmask in $CTSMROOT/bld/namelist_files/namelist_definition_ctsm.xml - Note that a new resolution currently needs to be added to both the hgrid and res lists of valid values, although in the future this should probably be changed so that these raw data grids just @@ -168,7 +168,7 @@ laid out here. $CTSMROOT/tools/shared/mkmapdata (usage: just run the script with no arguments) - Cut and paste the xml entries from mapping_entries.txt (created by - createXMLEntries.pl) into $CTSMROOT/bld/namelist_files/namelist_defaults_clm4_5.xml, + createXMLEntries.pl) into $CTSMROOT/bld/namelist_files/namelist_defaults_ctsm.xml, in the correct locations - Move mapping files to correct location, either using mv_cmds.sh created by @@ -177,6 +177,7 @@ laid out here. don't use that, you'll need to add the files to the inputdata directory yourself + ============================================================================ III. Checks that should be done when making new surface datasets ============================================================================ From ac7b3709a337819131a460aeb9f2ddbf7d8afd48 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 11:24:39 -0600 Subject: [PATCH 0840/1973] Add to list of PR's --- doc/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 20fa4e1134..6c3fc67248 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -115,12 +115,13 @@ List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): f FATES now points to the NGEET repository rather than the NCAR fates-release -Pull Requests that document the changes (include PR ids): #883 +Pull Requests that document the changes (include PR ids): #998, #883, #849, #567, #561 (https://github.com/ESCOMP/ctsm/pull) #998 -- Remove Copyright file #883 -- Bring changes on release-clm5.0 branch to master PR status: ready priority: high type: enhancement #849 -- Fix link to new forums #567 -- Ignore patterns for vim + #561 -- Add list of checks that should be done when making new surface datasets =============================================================== =============================================================== From 73e8b317b17a82511ca98001030f9c7c85f5b180 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 1 May 2020 15:23:26 -0600 Subject: [PATCH 0841/1973] update namelist_defaults to allow files to be used for both use_crop=.true. and false. --- bld/namelist_files/namelist_defaults_ctsm.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index d39570dd86..ac0a6295d8 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -815,9 +815,9 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nclnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc + >lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc + >lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc @@ -923,9 +923,9 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nclnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc + >lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc + >lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc From d37c0a04d79fe1172ed5351ad453aa7ca46c5dc9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 16:03:31 -0600 Subject: [PATCH 0842/1973] Change fix for #673 according to how we suggested it should be changed on master --- tools/mksurfdata_map/src/mksurfdat.F90 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index acba4e8719..694015f97b 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -710,11 +710,10 @@ program mksurfdat if (pctlnd_pft(n) < 1.e-6_r8) then pftdata_mask(n) = 0 soicol(n) = 15 - if (pctgla(n) < 1.e-6_r8) then - pctwet(n) = 100._r8 - pctlak(n) - pctgla(n) = 0._r8 - else - pctwet(n) = max(100._r8 - pctgla(n) - pctlak(n), 0.0_r8) + if (pctgla(n) < 1.e-6_r8 .and. pctlak(n) < 1.e-6_r8) then + pctgla(n) = 0._r8 + pctlak(n) = 0._r8 + pctwet(n) = 100._r8 end if pcturb(n) = 0._r8 call pctnatpft(n)%set_pct_l2g(0._r8) From b711ab3375398643272b728008adf221cd79382a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 16:03:59 -0600 Subject: [PATCH 0843/1973] Update ChangeLog some more with more description --- doc/ChangeLog | 70 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 6c3fc67248..7ad42b27da 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -11,18 +11,43 @@ Move changes from release-clm5.0.12.13/14/16/17/18/20/21/22/23/24/25/26/27/28/29 (note excludes release-clm5.0.15, release-clm5.0.19) Answer changing! -Updates fates +Updates FATES with PARTEH option. +Remove CRUNCEP half degree, ne120np4, f05 surface datasets +Landuse-timeseries files for just: f09, f19, f10, ne30np4, 1x1_numaIA, 1x1_smallvilleIA, 1x1_brazil +Add datasets needed for SSP scenarios (only Tier I for ndep). Add ZWT_inversion dataset for methane. +Add new ability to use prescribed soil moisture data (from streams files based on an earlier CTSM simulation). + +Add new MODISv2 mapping files for mksurfdata_map. Remove T5 and T21 mapping files. Add conus_30_x8 mapping files, +and T62 mapping files Bugs fixed or introduced ------------------------ -Issues fixed (include CTSM Issue #): #746, #741, #873 - #746 -- - #741 -- - #873 -- +Issues fixed (include CTSM Issue #): #873, #871, #836, #831, #817, #809, #804, #791, #786, #746, #741, #734, #629, #621, #557, #544, #533, #276, #175, #150 + 13 issues.... + #873 -- Release clm5.0.12 changes + #871 -- don't check for valid resolution for CESM cases by default + #836 -- add izumi as a place that can run tools tests + #831 -- add namelist tint_algo settings for input streams + #817 -- Have clm4_5 use the same ndep file as clm5_0 for 1850 + #809 -- mkmapdata using an old version of intel + #804 -- mksurfdata option + #791 -- fix threading for prescribed LAI and soil-moisture + #786 -- allow use_init_interp for a branch + #746 -- Some CLM45 configurations use CLM50 initial conditions files + #741 -- C13_HR, C13_NBP, FPI values result in numeric conversion not representable error + #734 -- Isotope historical files off of NetCDF-4 + #629 -- Remove unused fields from surface datasets + #621 -- Fully remove rcp in place of only ssp_rcp + #557 -- no-anthro compset and options + #544 -- Transient cases are matching wrong IC file + #533 -- Add -no-anthro option to mksurfdata + #276 -- Tests for pre_alpha/pre_beta + #175 -- Set stream_year_first_urbantv/last for CLM4.5 + #150 -- mksurfdata code cleanup Significant changes to scientifically-supported configurations -------------------------------------------------------------- @@ -43,11 +68,27 @@ Notes of particular relevance for users Caveats for users (e.g., need to interpolate initial conditions): -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - -Changes made to namelist defaults (e.g., changed parameter values): +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Add 2010 compset option + New namelist items: ndep_tintalgo, lai_tintalgo, lightng_tintalgo, urbantv_tintalgo, dribble_crophrv_xsmrpool_2atm + New soil moisture namelist items: use_soil_moisture_streams, stream_year_first_soilm, stream_year_last_soilm, model_year_align_soilm, + model_year_align_soilm, soilm_tintalgo, soilm_offset, soilm_ignore_data_if_missing + New namelist items for FATES: fates_parteh_mode + New 2010, no-anthro, SSP use cases + New compsets: I2010Clm50Sp, I2000Clm50BgcCropQianGs, I1850Clm50BgcNoAnthro, I1850Clm50SpNoAnthro, IHistClm50SpCru, IHistClm50SpCru, + IHistClm45SpGs, IHistClm45SpGs + New SSP compsets: ISSP585Clm50BgcCrop, ISSP126Clm50BgcCrop, ISSP126Clm50BgcCrop, ISSP245Clm50BgcCrop, ISSP370Clm50BgcCrop, + ISSP434Clm50BgcCrop, ISSP460Clm50BgcCrop, ISSP460Clm50BgcCrop + LAI streams options don't show up in the namelist unless you ask for them + finundation comes from streams files, no longer from the surface dataset + FATES adds a list of new history variables and dimension types + +Changes made to namelist defaults (e.g., changed parameter values): New fsurdat files, SSP C13/C14 files + Add PtVg surface dataset + most finidat files now need to be interpolated, a few added in + New ndep datasets Changes to the datasets (e.g., parameter, surface or initial files): + New fsurdat files, finidat files need to be interpolated from now Substantial timing or memory changes: None @@ -56,6 +97,9 @@ Notes of particular relevance for developers: (including Code reviews and testin NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Threshold to reseed dead vegetation increased from zero to 1.0 as a hard coded parameter. + Reseeding also happens for generic crop types and not just natural vegetation now. + The ability to read in 3D streams was added (input files have to be at the same resolution as the model) Changes to tests or testing: @@ -100,10 +144,11 @@ Changes answers relative to baseline: Yes to work with the new fsurdat files Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): + - what code configurations: all global + - what platforms/compilers: all + - nature of change: Main change is around Antarctica + CMIP6 simulations and release branch simulations were run with these surface datasets Detailed list of changes ------------------------ @@ -115,12 +160,13 @@ List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): f FATES now points to the NGEET repository rather than the NCAR fates-release -Pull Requests that document the changes (include PR ids): #998, #883, #849, #567, #561 +Pull Requests that document the changes (include PR ids): #998, #883, #849, #567, #564, #561 (https://github.com/ESCOMP/ctsm/pull) #998 -- Remove Copyright file #883 -- Bring changes on release-clm5.0 branch to master PR status: ready priority: high type: enhancement #849 -- Fix link to new forums #567 -- Ignore patterns for vim + #564 -- Update mksurfdata_map to include glaciers outside of pft landmask #561 -- Add list of checks that should be done when making new surface datasets =============================================================== From 284aff122ee3b51dc7d0e48dad72d8dfa8065fc0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 16:50:13 -0600 Subject: [PATCH 0844/1973] Needed this adjustment for the conus high resolution surface dataset to work --- tools/mksurfdata_map/src/mksurfdat.F90 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index 694015f97b..ed7de9673c 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -714,13 +714,20 @@ program mksurfdat pctgla(n) = 0._r8 pctlak(n) = 0._r8 pctwet(n) = 100._r8 + else + if (pctgla(n) < 1.e-6_r8 )then + pctgla(n) = 0._r8 + else if (pctlak(n) < 1.e-6_r8 )then + pctlak(n) = 0._r8 + end if + pctwet(n) = max(100._r8 - pctgla(n) - pctlak(n), 0.0_r8) end if - pcturb(n) = 0._r8 + pcturb(n) = 0._r8 call pctnatpft(n)%set_pct_l2g(0._r8) call pctcft(n)%set_pct_l2g(0._r8) - pctsand(n,:) = 43._r8 - pctclay(n,:) = 18._r8 - organic(n,:) = 0._r8 + pctsand(n,:) = 43._r8 + pctclay(n,:) = 18._r8 + organic(n,:) = 0._r8 else pftdata_mask(n) = 1 end if From 162c35a47b287958befe3722048babc8b48b99bd Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 18:11:43 -0600 Subject: [PATCH 0845/1973] Revert back to version of mksurfdat.F90 on release branch as the fix proposed in #673 for master didn't work --- tools/mksurfdata_map/src/mksurfdat.F90 | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index ed7de9673c..acba4e8719 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -710,24 +710,18 @@ program mksurfdat if (pctlnd_pft(n) < 1.e-6_r8) then pftdata_mask(n) = 0 soicol(n) = 15 - if (pctgla(n) < 1.e-6_r8 .and. pctlak(n) < 1.e-6_r8) then - pctgla(n) = 0._r8 - pctlak(n) = 0._r8 - pctwet(n) = 100._r8 + if (pctgla(n) < 1.e-6_r8) then + pctwet(n) = 100._r8 - pctlak(n) + pctgla(n) = 0._r8 else - if (pctgla(n) < 1.e-6_r8 )then - pctgla(n) = 0._r8 - else if (pctlak(n) < 1.e-6_r8 )then - pctlak(n) = 0._r8 - end if - pctwet(n) = max(100._r8 - pctgla(n) - pctlak(n), 0.0_r8) + pctwet(n) = max(100._r8 - pctgla(n) - pctlak(n), 0.0_r8) end if - pcturb(n) = 0._r8 + pcturb(n) = 0._r8 call pctnatpft(n)%set_pct_l2g(0._r8) call pctcft(n)%set_pct_l2g(0._r8) - pctsand(n,:) = 43._r8 - pctclay(n,:) = 18._r8 - organic(n,:) = 0._r8 + pctsand(n,:) = 43._r8 + pctclay(n,:) = 18._r8 + organic(n,:) = 0._r8 else pftdata_mask(n) = 1 end if From 8ea9b612268410f2e088c5fab565a5bb7a261007 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 21:25:22 -0600 Subject: [PATCH 0846/1973] Change file update --- doc/ChangeLog | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7ad42b27da..48b0e89234 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev093 Originator(s): erik (Erik Kluzek) -Date: Fri May 1 10:12:22 MDT 2020 +Date: Fri May 1 21:25:07 MDT 2020 One-line Summary: Bring in changes from release-clm5.0 branch to master Purpose of changes @@ -22,12 +22,13 @@ Add new ability to use prescribed soil moisture data (from streams files based o Add new MODISv2 mapping files for mksurfdata_map. Remove T5 and T21 mapping files. Add conus_30_x8 mapping files, and T62 mapping files +Add contrib directory to tools with contributed tools and scripts. + Bugs fixed or introduced ------------------------ -Issues fixed (include CTSM Issue #): #873, #871, #836, #831, #817, #809, #804, #791, #786, #746, #741, #734, #629, #621, #557, #544, #533, #276, #175, #150 - 13 issues.... +Issues fixed (include CTSM Issue #): 31 issues.... #873 -- Release clm5.0.12 changes #871 -- don't check for valid resolution for CESM cases by default #836 -- add izumi as a place that can run tools tests @@ -38,14 +39,25 @@ Issues fixed (include CTSM Issue #): #873, #871, #836, #831, #817, #809, #804, # #791 -- fix threading for prescribed LAI and soil-moisture #786 -- allow use_init_interp for a branch #746 -- Some CLM45 configurations use CLM50 initial conditions files - #741 -- C13_HR, C13_NBP, FPI values result in numeric conversion not representable error + #741 -- C13_HR, C13_NBP, FPI values result in numeric conversion not representable error (changes answers) #734 -- Isotope historical files off of NetCDF-4 + #716 -- 2 degree CMIP6WACCMDECK needs Carbon isotopes off + #707 -- Missing mapping files for hirespft + #673 -- Ice shelf wetland fix in mksurfdata_map can lead to glacier+lake > 100% on surface datasets (changes surface dataset creation) + #653 -- To save disk on fsurdat files use zwt0 on finindated file #629 -- Remove unused fields from surface datasets + #624 -- QSNOEVAP history output incorrect #621 -- Fully remove rcp in place of only ssp_rcp + #608 -- Odd (blocky) spatial patterns in generic crop leafc for BGC simulation when initialized from BGC-Crop (changes answers) + #589 -- Existence of content in the lai_streams namelist makes it confusing to users #557 -- no-anthro compset and options + #553 -- More robust mksurfdata_map logic for determining where to put wetlands + #547 -- Add conus_30_x8 grid as valid option for CTSM and mksurfdata_map + #545 -- Antarctica ice shelves are being treated as wetlands rather than glaciers #544 -- Transient cases are matching wrong IC file #533 -- Add -no-anthro option to mksurfdata #276 -- Tests for pre_alpha/pre_beta + #262 -- hirespft option to mksurfdata.pl #175 -- Set stream_year_first_urbantv/last for CLM4.5 #150 -- mksurfdata code cleanup @@ -66,7 +78,8 @@ Does this tag change answers significantly for any of the following physics conf Notes of particular relevance for users --------------------------------------- -Caveats for users (e.g., need to interpolate initial conditions): +Caveats for users (e.g., need to interpolate initial conditions): New surface datasets do mean initial conditions + will need to be interpolated Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Add 2010 compset option New namelist items: ndep_tintalgo, lai_tintalgo, lightng_tintalgo, urbantv_tintalgo, dribble_crophrv_xsmrpool_2atm @@ -84,7 +97,7 @@ Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Changes made to namelist defaults (e.g., changed parameter values): New fsurdat files, SSP C13/C14 files Add PtVg surface dataset - most finidat files now need to be interpolated, a few added in + most finidat files now need to be interpolated, a few added in to get testing to work New ndep datasets Changes to the datasets (e.g., parameter, surface or initial files): @@ -142,6 +155,8 @@ Changes answers relative to baseline: Yes Updates in all fsurdat files leads to changes in answers Also there are updated finidat files as they had to be interpolated to work with the new fsurdat files + Reseeding change can effect answers on startup if activated + Extra call to SoilBiogeochemPrecisionControl can cause a small answer change Summarize any changes to answers, i.e., - what code configurations: all global From 48ec25c6913e372142d4dcefab513644d97a1080 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 May 2020 22:27:33 -0600 Subject: [PATCH 0847/1973] Update changes to testing --- doc/ChangeLog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 48b0e89234..983563f718 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev093 Originator(s): erik (Erik Kluzek) -Date: Fri May 1 21:25:07 MDT 2020 +Date: Fri May 1 22:27:16 MDT 2020 One-line Summary: Bring in changes from release-clm5.0 branch to master Purpose of changes @@ -115,6 +115,12 @@ Caveats for developers (e.g., code that is duplicated that requires double maint The ability to read in 3D streams was added (input files have to be at the same resolution as the model) Changes to tests or testing: + Add no-anthro, 2010, f19 waccm and SSP tests + Make sure prealpha/prebeta tests are also run by aux_clm + Add prescribed soil moisture test + Lengthen waccm_offline test + Remove hcru_hcru and edison tests + Add some aux_cime_baseline tests Code reviewed by: self From 79893a3bfc0b7b9aef29e324fcb81300768b4bb2 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sun, 3 May 2020 21:40:58 -0600 Subject: [PATCH 0848/1973] Corrections for failing test to PASS This test now PASSes: ERS_Lm40_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianGs.cheyenne_gnu.clm-monthly --- src/biogeochem/CNBalanceCheckMod.F90 | 31 ++-------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index 126afdf80d..cc794362d5 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -208,11 +208,9 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8) :: col_errcb(bounds%begc:bounds%endc) real(r8) :: grc_errcb(bounds%begg:bounds%endg) real(r8) :: som_c_leached_grc(bounds%begg:bounds%endg) - real(r8) :: crop_seedc_to_leaf_grc(bounds%begg:bounds%endg) !----------------------------------------------------------------------- associate( & - crop_seedc_to_leaf => cnveg_carbonflux_inst%crop_seedc_to_leaf_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) seed source to leaf grc_begcb => this%begcb_grc , & ! Input: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, beginning of time step grc_endcb => this%endcb_grc , & ! Output: [real(r8) (:) ] (gC/m2) gridcell-level carbon mass, end of time step totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool @@ -312,12 +310,6 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & garr = som_c_leached_grc(bounds%begg:bounds%endg), & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') - call p2g(bounds, & - crop_seedc_to_leaf(bounds%begp:bounds%endp), & - crop_seedc_to_leaf_grc(bounds%begg:bounds%endg), & - p2c_scale_type = 'unity', & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') err_found = .false. do g = bounds%begg, bounds%endg @@ -330,7 +322,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! calculate total gridcell-level inputs ! slevis notes: ! nbp_grc = nep_grc - fire_closs_grc - hrv_xsmrpool_to_atm_dribbled_grc - dwt_conv_cflux_dribbled_grc - product_closs_grc - grc_cinputs = nbp_grc(g) + crop_seedc_to_leaf_grc(g) + & + grc_cinputs = nbp_grc(g) + & dwt_seedc_to_leaf_grc(g) + dwt_seedc_to_deadstem_grc(g) ! calculate total gridcell-level outputs @@ -360,7 +352,6 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*)'delta store =', grc_endcb(g) - grc_begcb(g) write(iulog,*)'--- Inputs ---' write(iulog,*)'nbp_grc =', nbp_grc(g) * dt - write(iulog,*)'crop_seedc_to_leaf_grc =', crop_seedc_to_leaf_grc(g) * dt write(iulog,*)'dwt_seedc_to_leaf_grc =', dwt_seedc_to_leaf_grc(g) * dt write(iulog,*)'dwt_seedc_to_deadstem_grc =', dwt_seedc_to_deadstem_grc(g) * dt write(iulog,*)'--- Outputs ---' @@ -410,14 +401,12 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8):: grc_errnb(bounds%begg:bounds%endg) real(r8):: nfix_to_sminn_grc(bounds%begg:bounds%endg) real(r8):: supplement_to_sminn_grc(bounds%begg:bounds%endg) - real(r8):: crop_seedn_to_leaf_grc(bounds%begg:bounds%endg) real(r8):: ffix_to_sminn_grc(bounds%begg:bounds%endg) real(r8):: fert_to_sminn_grc(bounds%begg:bounds%endg) real(r8):: soyfixn_to_sminn_grc(bounds%begg:bounds%endg) real(r8):: denit_grc(bounds%begg:bounds%endg) real(r8):: grc_fire_nloss(bounds%begg:bounds%endg) real(r8):: wood_harvestn_grc(bounds%begg:bounds%endg) - real(r8):: grainn_to_cropprodn_grc(bounds%begg:bounds%endg) real(r8):: som_n_leached_grc(bounds%begg:bounds%endg) real(r8):: sminn_leached_grc(bounds%begg:bounds%endg) real(r8):: f_n2o_nit_grc(bounds%begg:bounds%endg) @@ -426,7 +415,6 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & !----------------------------------------------------------------------- associate( & - crop_seedn_to_leaf => cnveg_nitrogenflux_inst%crop_seedn_to_leaf_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) seed source to leaf grc_begnb => this%begnb_grc , & ! Input: [real(r8) (:) ] (gN/m2) gridcell nitrogen mass, beginning of time step grc_endnb => this%endnb_grc , & ! Output: [real(r8) (:) ] (gN/m2) gridcell nitrogen mass, end of time step totgrcn => cnveg_nitrogenstate_inst%totn_grc , & ! Input: [real(r8) (:) ] (gN/m2) total gridcell nitrogen, incl veg @@ -586,11 +574,6 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & garr = wood_harvestn_grc(bounds%begg:bounds%endg), & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') - call c2g( bounds = bounds, & - carr = grainn_to_cropprodn(bounds%begc:bounds%endc), & - garr = grainn_to_cropprodn_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') call c2g( bounds = bounds, & carr = som_n_leached(bounds%begc:bounds%endc), & garr = som_n_leached_grc(bounds%begg:bounds%endg), & @@ -619,12 +602,6 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') end if - call p2g(bounds, & - crop_seedn_to_leaf(bounds%begp:bounds%endp), & - crop_seedn_to_leaf_grc(bounds%begg:bounds%endg), & - p2c_scale_type = 'unity', & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') err_found = .false. do g = bounds%begg, bounds%endg @@ -634,7 +611,6 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! calculate total gridcell-level inputs grc_ninputs(g) = forc_ndep(g) + nfix_to_sminn_grc(g) + & supplement_to_sminn_grc(g) + & - crop_seedn_to_leaf_grc(g) + & dwt_seedn_to_leaf_grc(g) + & dwt_seedn_to_deadstem_grc(g) @@ -648,8 +624,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! calculate total gridcell-level outputs grc_noutputs(g) = denit_grc(g) + grc_fire_nloss(g) + & - wood_harvestn_grc(g) + grainn_to_cropprodn_grc(g) - & - som_n_leached_grc(g) + wood_harvestn_grc(g) - som_n_leached_grc(g) if (.not. use_nitrif_denitrif) then grc_noutputs(g) = grc_noutputs(g) + sminn_leached_grc(g) @@ -686,7 +661,6 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*) 'forc_ndep =', forc_ndep(g) * dt write(iulog,*) 'nfix_to_sminn_grc =', nfix_to_sminn_grc(g) * dt write(iulog,*) 'supplement_to_sminn_grc =', supplement_to_sminn_grc(g) * dt - write(iulog,*) 'crop_seedn_to_leaf_grc =', crop_seedn_to_leaf_grc(g) * dt write(iulog,*) 'dwt_seedn_to_leaf_grc =', dwt_seedn_to_leaf_grc(g) * dt write(iulog,*) 'dwt_seedn_to_deadstem_grc =', dwt_seedn_to_deadstem_grc(g) * dt if (use_fun) then @@ -700,7 +674,6 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*) 'denit_grc =', denit_grc(g) * dt write(iulog,*) 'grc_fire_nloss =', grc_fire_nloss(g) * dt write(iulog,*) 'wood_harvestn_grc =', wood_harvestn_grc(g) * dt - write(iulog,*) 'grainn_to_cropprodn_grc =', grainn_to_cropprodn_grc(g) * dt write(iulog,*) '-1*som_n_leached_grc = ', som_n_leached_grc(g) * dt if (.not. use_nitrif_denitrif) then write(iulog,*) 'sminn_leached_grc =', sminn_leached_grc(g) * dt From 0066745f1a728ba8d52297ee19997553d3357bd5 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 4 May 2020 12:01:47 -0600 Subject: [PATCH 0849/1973] First round of moving parameters to param file. BFB according to following tests: ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput Parameters moved: fnps theta_psii theta_ip theta_cj theta_cj vcmaxha jmaxha tpuha lmrha kcha koha cpha vcmaxhd jmaxhd tpuhd lmrhd lmrse denitrif_nitrateconc_coefficient denitrif_nitrateconc_exponent denitrif_respiration_coefficient denitrif_respiration_exponent k_nitr_max_perday (renamed from k_nitr_max) --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- src/biogeophys/LunaMod.F90 | 19 +- src/biogeophys/PhotosynthesisMod.F90 | 237 ++++++++---------- src/main/controlMod.F90 | 3 +- .../SoilBiogeochemNitrifDenitrifMod.F90 | 110 +++----- 5 files changed, 140 insertions(+), 231 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 825db0fc30..71e8720ee9 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -372,7 +372,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200402.nc +/glade/p/cgd/tss/people/oleson/modify_param/clm5_params.c200402_kwo.c200422.nc lnd/clm2/paramdata/clm_params.c200402.nc diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 35a38701ec..a64aae0505 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -43,9 +43,10 @@ module LunaMod type, private :: params_type ! cp25, kc25, ko25: Bernacchi et al (2001) Plant, Cell & Environment 24:253-259 - real(r8) :: cp25_yr2000 ! CO2 compensation point at 25°C at present day O2 (mol/mol) - real(r8) :: kc25_coef ! Michaelis-Menten const. at 25°C for CO2 (unitless) - real(r8) :: ko25_coef ! Michaelis-Menten const. at 25°C for O2 (unitless) + real(r8) :: cp25_yr2000 ! CO2 compensation point at 25°C at present day O2 (mol/mol) + real(r8) :: kc25_coef ! Michaelis-Menten const. at 25°C for CO2 (unitless) + real(r8) :: ko25_coef ! Michaelis-Menten const. at 25°C for O2 (unitless) + real(r8) :: luna_theta_cj ! LUNA empirical curvature parameter for ac, aj photosynthesis co-limitation (unitless) end type params_type type(params_type), private :: params_inst @@ -174,6 +175,8 @@ subroutine readParams( ncid ) ! Michaelis-Menten constant at 25°C for CO2 (unitless) call readNcdioScalar(ncid, 'kc25_coef', subname, params_inst%kc25_coef) params_inst%kc25_coef = params_inst%kc25_coef * 1.e5_r8 ! from mol/mol to Luna units + ! LUNA empirical curvature parameter for ac, aj photosynthesis co-limitation + call readNcdioScalar(ncid, 'luna_theta_cj', subname, params_inst%luna_theta_cj) end subroutine readParams @@ -872,7 +875,6 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR real(r8) :: chg_per_step !the nitrogen change per interation real(r8) :: Vcmaxnight !Vcmax during night (umol/m2/s) real(r8) :: ci !inter-cellular CO2 concentration (Pa) - real(r8) :: theta_cj !interpolation coefficient real(r8) :: tleafd10c !10-day mean daytime leaf temperature, contrained for physiological range (oC) real(r8) :: tleafn10c !10-day mean leaf temperature for night, constrained for physiological range (oC) real(r8) :: Vcmax !the maximum carboxyaltion rate (umol/m2/s) @@ -881,7 +883,6 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR integer :: increase_flag !whether to increase or decrease call NUEref(NUEjref, NUEcref, Kj2Kcref) - theta_cj = 0.95_r8 Nlc = PNlcold * FNCa !proportion of light capturing nitrogen in functional nitrogen Net = PNetold * FNCa !proportion of light harvesting (electron transport) nitrogen in functional nitrogen Nresp = PNrespold * FNCa !proportion of respirational nitrogen in functional nitrogen @@ -1027,7 +1028,6 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & real(r8) :: Wc2Wj !ratio: Wc/Wj real(r8) :: ELTRNabsorb !absorbed electron rate, umol electron/m2 leaf /s real(r8) :: Jmaxb0act !base value of Jmax (umol/m2/s) - real(r8) :: theta_cj !interpolation coefficient real(r8) :: theta !light absorption rate (0-1) real(r8) :: Vcmaxnight !Vcmax during night (umol/m2/s) real(r8) :: Wc !rubisco-limited photosynthetic rate (umol/m2/s) @@ -1035,7 +1035,6 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & real(r8) :: NUECHG !the nitrogen use efficiency change under current conidtions compared to reference climate conditions (25oC and 385 ppm ) real(r8), parameter :: leaf_mr_vcm = 0.015_r8 !Scalar constant of leaf respiration with Vcmax (should use parameter in CanopyStateMod) - theta_cj = 0.95_r8 theta = 0.292_r8 / (1.0_r8 + 0.076_r8 / (Nlc * Cb)) ELTRNabsorb = theta * PARi10 Jmaxb0act = Jmaxb0 * FNCa * Fj @@ -1051,7 +1050,7 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & else Wc = Kc * Vcmax Wj = Kj * JmeanL - A = (1.0_r8 - theta_cj) * max(Wc, Wj) + theta_cj * min(Wc, Wj) + A = (1.0_r8 - params_inst%luna_theta_cj) * max(Wc, Wj) + params_inst%luna_theta_cj * min(Wc, Wj) endif PSN = Cv * A * hourpd Vcmaxnight = VcmxTKattge(tair10, tleafn10) / VcmxTKattge(tair10, tleafd10) * Vcmax @@ -1113,11 +1112,9 @@ subroutine Photosynthesis_luna(forc_pbot, tleafd, relh, CO2a,O2a, rb, Vcmax, Jme real(r8) :: rsmax0 !maximum stomata conductance (s/m) real(r8) :: tleaf !daytime leaf temperature (oC) real(r8) :: tleafk !the temperature of the leaf in Kelvin - real(r8) :: theta_cj !the interpolation coefficient for Wj and Wc real(r8) :: relhc !constrained relative humidity (unitless) integer :: i !index record the number of iterations - theta_cj = 0.95_r8 rsmax0 = 2.0_r8 * 1.0e4_r8 bp = 2000.0_r8 tleaf = tleafd @@ -1175,7 +1172,7 @@ subroutine Photosynthesis_luna(forc_pbot, tleafd, relh, CO2a,O2a, rb, Vcmax, Jme Wc = Kc * Vcmax Wj = Kj * JmeanL end if - A = (1.0_r8 - theta_cj) * max(Wc, Wj) + theta_cj * min(Wc, Wj) !use this instead of the quadratic to avoid values not in the range of wc and wj + A = (1.0_r8 - params_inst%luna_theta_cj) * max(Wc, Wj) + params_inst%luna_theta_cj * min(Wc, Wj) !use this instead of the quadratic to avoid values not in the range of wc and wj rs = cf / gs_mol rs = min(rsmax0, rs) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index a111cab156..ef61d098b6 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -85,11 +85,27 @@ module PhotosynthesisMod real(r8) :: cp25_yr2000 ! CO2 compensation point at 25°C at present day O2 (mol/mol) real(r8) :: kc25_coef ! Michaelis-Menten const. at 25°C for CO2 (unitless) real(r8) :: ko25_coef ! Michaelis-Menten const. at 25°C for O2 (unitless) + real(r8) :: fnps ! Fraction of light absorbed by non-photosynthetic pigment (unitless) + real(r8) :: theta_psii ! Empirical curvature parameter for electron transport rate (unitless) + real(r8) :: theta_ip ! Empirical curvature parameter for ap photosynthesis co-limitation (unitless) + real(r8) :: vcmaxha ! Activation energy for vcmax (J/mol) + real(r8) :: jmaxha ! Activation energy for jmax (J/mol) + real(r8) :: tpuha ! Activation energy for tpu (J/mol) + real(r8) :: lmrha ! Activation energy for lmr (J/mol) + real(r8) :: kcha ! Activation energy for kc (J/mol) + real(r8) :: koha ! Activation energy for ko (J/mol) + real(r8) :: cpha ! Activation energy for cp (J/mol) + real(r8) :: vcmaxhd ! Deactivation energy for vcmax (J/mol) + real(r8) :: jmaxhd ! Deactivation energy for jmax (J/mol) + real(r8) :: tpuhd ! Deactivation energy for tpu (J/mol) + real(r8) :: lmrhd ! Deactivation energy for lmr (J/mol) + real(r8) :: lmrse ! Entropy term for lmr (J/mol/K) real(r8), allocatable, public :: krmax (:) real(r8), allocatable, private :: kmax (:,:) real(r8), allocatable, private :: psi50 (:,:) real(r8), allocatable, private :: ck (:,:) real(r8), allocatable, private :: lmr_intercept_atkin(:) + real(r8), allocatable, private :: theta_cj (:) ! Empirical curvature parameter for ac, aj photosynthesis co-limitation (unitless) contains procedure, private :: allocParams end type photo_params_type @@ -125,7 +141,6 @@ module PhotosynthesisMod real(r8), pointer, private :: qe_patch (:) ! patch quantum efficiency, used only for C4 (mol CO2 / mol photons) real(r8), pointer, private :: tpu_z_patch (:,:) ! patch triose phosphate utilization rate (umol CO2/m**2/s) real(r8), pointer, private :: kp_z_patch (:,:) ! patch initial slope of CO2 response curve (C4 plants) - real(r8), pointer, private :: theta_cj_patch (:) ! patch empirical curvature parameter for ac, aj photosynthesis co-limitation real(r8), pointer, private :: bbb_patch (:) ! patch Ball-Berry minimum leaf conductance (umol H2O/m**2/s) real(r8), pointer, private :: mbb_patch (:) ! patch Ball-Berry slope of conductance-photosynthesis relationship real(r8), pointer, private :: gs_mol_patch (:,:) ! patch leaf stomatal conductance (umol H2O/m**2/s) @@ -270,7 +285,6 @@ subroutine InitAllocate(this, bounds) allocate(this%kc_patch (begp:endp)) ; this%kc_patch (:) = nan allocate(this%ko_patch (begp:endp)) ; this%ko_patch (:) = nan allocate(this%qe_patch (begp:endp)) ; this%qe_patch (:) = nan - allocate(this%theta_cj_patch (begp:endp)) ; this%theta_cj_patch (:) = nan allocate(this%bbb_patch (begp:endp)) ; this%bbb_patch (:) = nan allocate(this%mbb_patch (begp:endp)) ; this%mbb_patch (:) = nan allocate(this%gb_mol_patch (begp:endp)) ; this%gb_mol_patch (:) = nan @@ -614,6 +628,7 @@ subroutine allocParams ( this ) ! allocate parameters allocate( this%krmax (0:mxpft) ) ; this%krmax(:) = nan + allocate( this%theta_cj (0:mxpft) ) ; this%theta_cj(:) = nan allocate( this%kmax (0:mxpft,nvegwcs) ) ; this%kmax(:,:) = nan allocate( this%psi50 (0:mxpft,nvegwcs) ) ; this%psi50(:,:) = nan allocate( this%ck (0:mxpft,nvegwcs) ) ; this%ck(:,:) = nan @@ -659,6 +674,10 @@ subroutine readParams ( this, ncid ) call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) params_inst%lmr_intercept_atkin=temp1d + tString = "theta_cj" + call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%theta_cj=temp1d tString = "kmax" call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv) if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) @@ -684,6 +703,36 @@ subroutine readParams ( this, ncid ) call readNcdioScalar(ncid, 'act25', subname, params_inst%act25) ! Mass ratio of total Rubisco molecular mass to nitrogen in Rubisco (gRubisco/gN(Rubisco)) call readNcdioScalar(ncid, 'fnr', subname, params_inst%fnr) + ! Fraction of light absorbed by non-photosynthetic pigment (unitless) + call readNcdioScalar(ncid, 'fnps', subname, params_inst%fnps) + ! Empirical curvature parameter for electron transport rate (unitless) + call readNcdioScalar(ncid, 'theta_psii', subname, params_inst%theta_psii) + ! Empirical curvature parameter for ap photosynthesis co-limitation (unitless) + call readNcdioScalar(ncid, 'theta_ip', subname, params_inst%theta_ip) + ! Activation energy for vcmax (J/mol) + call readNcdioScalar(ncid, 'vcmaxha', subname, params_inst%vcmaxha) + ! Activation energy for jmax (J/mol) + call readNcdioScalar(ncid, 'jmaxha', subname, params_inst%jmaxha) + ! Activation energy for tpu (J/mol) + call readNcdioScalar(ncid, 'tpuha', subname, params_inst%tpuha) + ! Activation energy for lmr (J/mol) + call readNcdioScalar(ncid, 'lmrha', subname, params_inst%lmrha) + ! Activation energy for kc (J/mol) + call readNcdioScalar(ncid, 'kcha', subname, params_inst%kcha) + ! Activation energy for ko (J/mol) + call readNcdioScalar(ncid, 'koha', subname, params_inst%koha) + ! Activation energy for cp (J/mol) + call readNcdioScalar(ncid, 'cpha', subname, params_inst%cpha) + ! Deactivation energy for vcmax (J/mol) + call readNcdioScalar(ncid, 'vcmaxhd', subname, params_inst%vcmaxhd) + ! Deactivation energy for jmax (J/mol) + call readNcdioScalar(ncid, 'jmaxhd', subname, params_inst%jmaxhd) + ! Deactivation energy for tpu (J/mol) + call readNcdioScalar(ncid, 'tpuhd', subname, params_inst%tpuhd) + ! Deactivation energy for lmr (J/mol) + call readNcdioScalar(ncid, 'lmrhd', subname, params_inst%lmrhd) + ! Entropy term for lmr (J/mol/K) + call readNcdioScalar(ncid, 'lmrse', subname, params_inst%lmrse) end subroutine readParams @@ -1020,34 +1069,15 @@ subroutine Photosynthesis ( bounds, fn, filterp, & real(r8) :: ko25 ! Michaelis-Menten constant for O2 at 25C (Pa) real(r8) :: cp25 ! CO2 compensation point at 25C (Pa) - real(r8) :: vcmaxha ! activation energy for vcmax (J/mol) - real(r8) :: jmaxha ! activation energy for jmax (J/mol) - real(r8) :: tpuha ! activation energy for tpu (J/mol) - real(r8) :: lmrha ! activation energy for lmr (J/mol) - real(r8) :: kcha ! activation energy for kc (J/mol) - real(r8) :: koha ! activation energy for ko (J/mol) - real(r8) :: cpha ! activation energy for cp (J/mol) - - real(r8) :: vcmaxhd ! deactivation energy for vcmax (J/mol) - real(r8) :: jmaxhd ! deactivation energy for jmax (J/mol) - real(r8) :: tpuhd ! deactivation energy for tpu (J/mol) - real(r8) :: lmrhd ! deactivation energy for lmr (J/mol) - real(r8) :: vcmaxse ! entropy term for vcmax (J/mol/K) real(r8) :: jmaxse ! entropy term for jmax (J/mol/K) real(r8) :: tpuse ! entropy term for tpu (J/mol/K) - real(r8) :: lmrse ! entropy term for lmr (J/mol/K) real(r8) :: vcmaxc ! scaling factor for high temperature inhibition (25 C = 1.0) real(r8) :: jmaxc ! scaling factor for high temperature inhibition (25 C = 1.0) real(r8) :: tpuc ! scaling factor for high temperature inhibition (25 C = 1.0) real(r8) :: lmrc ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real(r8) :: theta_psii ! empirical curvature parameter for electron transport rate - - real(r8) :: theta_ip ! empirical curvature parameter for ap photosynthesis co-limitation - ! Other integer :: f,p,c,iv ! indices real(r8) :: cf ! s m**2/umol -> s/m @@ -1173,7 +1203,6 @@ subroutine Photosynthesis ( bounds, fn, filterp, & qe => photosyns_inst%qe_patch , & ! Output: [real(r8) (:) ] quantum efficiency, used only for C4 (mol CO2 / mol photons) tpu_z => photosyns_inst%tpu_z_patch , & ! Output: [real(r8) (:,:) ] triose phosphate utilization rate (umol CO2/m**2/s) kp_z => photosyns_inst%kp_z_patch , & ! Output: [real(r8) (:,:) ] initial slope of CO2 response curve (C4 plants) - theta_cj => photosyns_inst%theta_cj_patch , & ! Output: [real(r8) (:) ] empirical curvature parameter for ac, aj photosynthesis co-limitation bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) mbb => photosyns_inst%mbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship rh_leaf => photosyns_inst%rh_leaf_patch , & ! Output: [real(r8) (:) ] fractional humidity at leaf surface (dimensionless) @@ -1234,31 +1263,14 @@ subroutine Photosynthesis ( bounds, fn, filterp, & ! Bernacchi et al (2003) Plant, Cell and Environment 26:1419-1430 ! except TPU from: Harley et al (1992) Plant, Cell and Environment 15:271-282 - kcha = 79430._r8 - koha = 36380._r8 - cpha = 37830._r8 - vcmaxha = 72000._r8 - jmaxha = 50000._r8 - tpuha = 72000._r8 - lmrha = 46390._r8 - ! High temperature deactivation, from: ! Leuning (2002) Plant, Cell and Environment 25:1205-1210 ! The factor "c" scales the deactivation to a value of 1.0 at 25C - vcmaxhd = 200000._r8 - jmaxhd = 200000._r8 - tpuhd = 200000._r8 - lmrhd = 150650._r8 - lmrse = 490._r8 - lmrc = fth25 (lmrhd, lmrse) + lmrc = fth25 (params_inst%lmrhd, params_inst%lmrse) ! Miscellaneous parameters, from Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - fnps = 0.15_r8 - theta_psii = 0.7_r8 - theta_ip = 0.95_r8 - do f = 1, fn p = filterp(f) c = patch%column(p) @@ -1275,11 +1287,9 @@ subroutine Photosynthesis ( bounds, fn, filterp, & if (c3flag(p)) then qe(p) = 0._r8 - theta_cj(p) = 0.98_r8 bbbopt(p) = 10000._r8 else qe(p) = 0.05_r8 - theta_cj(p) = 0.80_r8 bbbopt(p) = 40000._r8 end if @@ -1303,9 +1313,9 @@ subroutine Photosynthesis ( bounds, fn, filterp, & sco = 0.5_r8 * 0.209_r8 / params_inst%cp25_yr2000 cp25 = 0.5_r8 * oair(p) / sco - kc(p) = kc25 * ft(t_veg(p), kcha) - ko(p) = ko25 * ft(t_veg(p), koha) - cp(p) = cp25 * ft(t_veg(p), cpha) + kc(p) = kc25 * ft(t_veg(p), params_inst%kcha) + ko(p) = ko25 * ft(t_veg(p), params_inst%koha) + cp(p) = cp25 * ft(t_veg(p), params_inst%cpha) end do @@ -1496,7 +1506,8 @@ subroutine Photosynthesis ( bounds, fn, filterp, & endif if (c3flag(p)) then - lmr_z(p,iv) = lmr25 * ft(t_veg(p), lmrha) * fth(t_veg(p), lmrhd, lmrse, lmrc) + lmr_z(p,iv) = lmr25 * ft(t_veg(p), params_inst%lmrha) * fth(t_veg(p), params_inst%lmrhd, & + params_inst%lmrse, lmrc) else lmr_z(p,iv) = lmr25 * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) lmr_z(p,iv) = lmr_z(p,iv) / (1._r8 + exp( 1.3_r8*(t_veg(p)-(tfrz+55._r8)) )) @@ -1538,12 +1549,14 @@ subroutine Photosynthesis ( bounds, fn, filterp, & vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) tpuse = vcmaxse - vcmaxc = fth25 (vcmaxhd, vcmaxse) - jmaxc = fth25 (jmaxhd, jmaxse) - tpuc = fth25 (tpuhd, tpuse) - vcmax_z(p,iv) = vcmax25 * ft(t_veg(p), vcmaxha) * fth(t_veg(p), vcmaxhd, vcmaxse, vcmaxc) - jmax_z(p,iv) = jmax25 * ft(t_veg(p), jmaxha) * fth(t_veg(p), jmaxhd, jmaxse, jmaxc) - tpu_z(p,iv) = tpu25 * ft(t_veg(p), tpuha) * fth(t_veg(p), tpuhd, tpuse, tpuc) + vcmaxc = fth25 (params_inst%vcmaxhd, vcmaxse) + jmaxc = fth25 (params_inst%jmaxhd, jmaxse) + tpuc = fth25 (params_inst%tpuhd, tpuse) + vcmax_z(p,iv) = vcmax25 * ft(t_veg(p), params_inst%vcmaxha) * fth(t_veg(p), & + params_inst%vcmaxhd, vcmaxse, vcmaxc) + jmax_z(p,iv) = jmax25 * ft(t_veg(p), params_inst%jmaxha) * fth(t_veg(p), & + params_inst%jmaxhd, jmaxse, jmaxc) + tpu_z(p,iv) = tpu25 * ft(t_veg(p), params_inst%tpuha) * fth(t_veg(p), params_inst%tpuhd, tpuse, tpuc) if (.not. c3flag(p)) then vcmax_z(p,iv) = vcmax25 * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) @@ -1620,8 +1633,8 @@ subroutine Photosynthesis ( bounds, fn, filterp, & ! Electron transport rate for C3 plants. Convert par from W/m2 to ! umol photons/m**2/s using the factor 4.6 - qabs = 0.5_r8 * (1._r8 - fnps) * par_z(p,iv) * 4.6_r8 - aquad = theta_psii + qabs = 0.5_r8 * (1._r8 - params_inst%fnps) * par_z(p,iv) * 4.6_r8 + aquad = params_inst%theta_psii bquad = -(qabs + jmax_z(p,iv)) cquad = qabs * jmax_z(p,iv) call quadratic (aquad, bquad, cquad, r1, r2) @@ -2325,14 +2338,12 @@ subroutine ci_func(ci, fval, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& real(r8) :: aquad, bquad, cquad ! terms for quadratic equations real(r8) :: r1, r2 ! roots of quadratic equation - real(r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real(r8) :: theta_psii ! empirical curvature parameter for electron transport rate - real(r8) :: theta_ip ! empirical curvature parameter for ap photosynthesis co-limitation !------------------------------------------------------------------------------ associate(& forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Output: [real(r8) (:) ] atmospheric pressure (Pa) c3flag => photosyns_inst%c3flag_patch , & ! Output: [logical (:) ] true if C3 and false if C4 + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type ac => photosyns_inst%ac_patch , & ! Output: [real(r8) (:,:) ] Rubisco-limited gross photosynthesis (umol CO2/m**2/s) aj => photosyns_inst%aj_patch , & ! Output: [real(r8) (:,:) ] RuBP-limited gross photosynthesis (umol CO2/m**2/s) ap => photosyns_inst%ap_patch , & ! Output: [real(r8) (:,:) ] product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) @@ -2345,16 +2356,10 @@ subroutine ci_func(ci, fval, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& qe => photosyns_inst%qe_patch , & ! Output: [real(r8) (:) ] quantum efficiency, used only for C4 (mol CO2 / mol photons) tpu_z => photosyns_inst%tpu_z_patch , & ! Output: [real(r8) (:,:) ] triose phosphate utilization rate (umol CO2/m**2/s) kp_z => photosyns_inst%kp_z_patch , & ! Output: [real(r8) (:,:) ] initial slope of CO2 response curve (C4 plants) - theta_cj => photosyns_inst%theta_cj_patch , & ! Output: [real(r8) (:) ] empirical curvature parameter for ac, aj photosynthesis co-limitation bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) mbb => photosyns_inst%mbb_patch & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship ) - ! Miscellaneous parameters, from Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - fnps = 0.15_r8 - theta_psii = 0.7_r8 - theta_ip = 0.95_r8 - if (c3flag(p)) then ! C3: Rubisco-limited photosynthesis ac(p,iv) = vcmax_z(p,iv) * max(ci-cp(p), 0._r8) / (ci+kc(p)*(1._r8+oair/ko(p))) @@ -2380,13 +2385,13 @@ subroutine ci_func(ci, fval, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& ! Gross photosynthesis. First co-limit ac and aj. Then co-limit ap - aquad = theta_cj(p) + aquad = params_inst%theta_cj(ivt(p)) bquad = -(ac(p,iv) + aj(p,iv)) cquad = ac(p,iv) * aj(p,iv) call quadratic (aquad, bquad, cquad, r1, r2) ai = min(r1,r2) - aquad = theta_ip + aquad = params_inst%theta_ip bquad = -(ai + ap(p,iv)) cquad = ai * ap(p,iv) call quadratic (aquad, bquad, cquad, r1, r2) @@ -2502,34 +2507,15 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & real(r8) :: ko25 ! Michaelis-Menten constant for O2 at 25C (Pa) real(r8) :: cp25 ! CO2 compensation point at 25C (Pa) - real(r8) :: vcmaxha ! activation energy for vcmax (J/mol) - real(r8) :: jmaxha ! activation energy for jmax (J/mol) - real(r8) :: tpuha ! activation energy for tpu (J/mol) - real(r8) :: lmrha ! activation energy for lmr (J/mol) - real(r8) :: kcha ! activation energy for kc (J/mol) - real(r8) :: koha ! activation energy for ko (J/mol) - real(r8) :: cpha ! activation energy for cp (J/mol) - - real(r8) :: vcmaxhd ! deactivation energy for vcmax (J/mol) - real(r8) :: jmaxhd ! deactivation energy for jmax (J/mol) - real(r8) :: tpuhd ! deactivation energy for tpu (J/mol) - real(r8) :: lmrhd ! deactivation energy for lmr (J/mol) - real(r8) :: vcmaxse ! entropy term for vcmax (J/mol/K) real(r8) :: jmaxse ! entropy term for jmax (J/mol/K) real(r8) :: tpuse ! entropy term for tpu (J/mol/K) - real(r8) :: lmrse ! entropy term for lmr (J/mol/K) real(r8) :: vcmaxc ! scaling factor for high temperature inhibition (25 C = 1.0) real(r8) :: jmaxc ! scaling factor for high temperature inhibition (25 C = 1.0) real(r8) :: tpuc ! scaling factor for high temperature inhibition (25 C = 1.0) real(r8) :: lmrc ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real(r8) :: theta_psii ! empirical curvature parameter for electron transport rate - - real(r8) :: theta_ip ! empirical curvature parameter for ap photosynthesis co-limitation - ! Other integer :: f,p,c,iv ! indices real(r8) :: cf ! s m**2/umol -> s/m @@ -2723,7 +2709,6 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & kc => photosyns_inst%kc_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for CO2 (Pa) ko => photosyns_inst%ko_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for O2 (Pa) qe => photosyns_inst%qe_patch , & ! Output: [real(r8) (:) ] quantum efficiency, used only for C4 (mol CO2 / mol photons) - theta_cj => photosyns_inst%theta_cj_patch , & ! Output: [real(r8) (:) ] empirical curvature parameter for ac, aj photosynthesis co-limitation bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) mbb => photosyns_inst%mbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship rh_leaf => photosyns_inst%rh_leaf_patch , & ! Output: [real(r8) (:) ] fractional humidity at leaf surface (dimensionless) @@ -2788,24 +2773,11 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & ! Bernacchi et al (2003) Plant, Cell and Environment 26:1419-1430 ! except TPU from: Harley et al (1992) Plant, Cell and Environment 15:271-282 - kcha = 79430._r8 - koha = 36380._r8 - cpha = 37830._r8 - vcmaxha = 72000._r8 - jmaxha = 50000._r8 - tpuha = 72000._r8 - lmrha = 46390._r8 - ! High temperature deactivation, from: ! Leuning (2002) Plant, Cell and Environment 25:1205-1210 ! The factor "c" scales the deactivation to a value of 1.0 at 25C - vcmaxhd = 200000._r8 - jmaxhd = 200000._r8 - tpuhd = 200000._r8 - lmrhd = 150650._r8 - lmrse = 490._r8 - lmrc = fth25 (lmrhd, lmrse) + lmrc = fth25 (params_inst%lmrhd, params_inst%lmrse) ! calculate root-soil interface conductance do f = 1, fn @@ -2863,10 +2835,6 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & ! Miscellaneous parameters, from Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - fnps = 0.15_r8 - theta_psii = 0.7_r8 - theta_ip = 0.95_r8 - do f = 1, fn p = filterp(f) c = patch%column(p) @@ -2883,11 +2851,9 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & if (c3flag(p)) then qe(p) = 0._r8 - theta_cj(p) = 0.98_r8 bbbopt(p) = 10000._r8 else qe(p) = 0.05_r8 - theta_cj(p) = 0.80_r8 bbbopt(p) = 40000._r8 end if @@ -2911,9 +2877,9 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & sco = 0.5_r8 * 0.209_r8 / params_inst%cp25_yr2000 cp25 = 0.5_r8 * oair(p) / sco - kc(p) = kc25 * ft(t_veg(p), kcha) - ko(p) = ko25 * ft(t_veg(p), koha) - cp(p) = cp25 * ft(t_veg(p), cpha) + kc(p) = kc25 * ft(t_veg(p), params_inst%kcha) + ko(p) = ko25 * ft(t_veg(p), params_inst%koha) + cp(p) = cp25 * ft(t_veg(p), params_inst%cpha) end do @@ -3106,8 +3072,10 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & endif if (c3flag(p)) then - lmr_z_sun(p,iv) = lmr25_sun * ft(t_veg(p), lmrha) * fth(t_veg(p), lmrhd, lmrse, lmrc) - lmr_z_sha(p,iv) = lmr25_sha * ft(t_veg(p), lmrha) * fth(t_veg(p), lmrhd, lmrse, lmrc) + lmr_z_sun(p,iv) = lmr25_sun * ft(t_veg(p), params_inst%lmrha) * fth(t_veg(p), params_inst%lmrhd, & + params_inst%lmrse, lmrc) + lmr_z_sha(p,iv) = lmr25_sha * ft(t_veg(p), params_inst%lmrha) * fth(t_veg(p), params_inst%lmrhd, & + params_inst%lmrse, lmrc) else lmr_z_sun(p,iv) = lmr25_sun * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) lmr_z_sun(p,iv) = lmr_z_sun(p,iv) / (1._r8 + exp( 1.3_r8*(t_veg(p)-(tfrz+55._r8)) )) @@ -3166,15 +3134,21 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) tpuse = vcmaxse - vcmaxc = fth25 (vcmaxhd, vcmaxse) - jmaxc = fth25 (jmaxhd, jmaxse) - tpuc = fth25 (tpuhd, tpuse) - vcmax_z(p,sun,iv) = vcmax25_sun * ft(t_veg(p), vcmaxha) * fth(t_veg(p), vcmaxhd, vcmaxse, vcmaxc) - jmax_z(p,sun,iv) = jmax25_sun * ft(t_veg(p), jmaxha) * fth(t_veg(p), jmaxhd, jmaxse, jmaxc) - tpu_z(p,sun,iv) = tpu25_sun * ft(t_veg(p), tpuha) * fth(t_veg(p), tpuhd, tpuse, tpuc) - vcmax_z(p,sha,iv) = vcmax25_sha * ft(t_veg(p), vcmaxha) * fth(t_veg(p), vcmaxhd, vcmaxse, vcmaxc) - jmax_z(p,sha,iv) = jmax25_sha * ft(t_veg(p), jmaxha) * fth(t_veg(p), jmaxhd, jmaxse, jmaxc) - tpu_z(p,sha,iv) = tpu25_sha * ft(t_veg(p), tpuha) * fth(t_veg(p), tpuhd, tpuse, tpuc) + vcmaxc = fth25 (params_inst%vcmaxhd, vcmaxse) + jmaxc = fth25 (params_inst%jmaxhd, jmaxse) + tpuc = fth25 (params_inst%tpuhd, tpuse) + vcmax_z(p,sun,iv) = vcmax25_sun * ft(t_veg(p), params_inst%vcmaxha) * fth(t_veg(p), & + params_inst%vcmaxhd, vcmaxse, vcmaxc) + jmax_z(p,sun,iv) = jmax25_sun * ft(t_veg(p), params_inst%jmaxha) * fth(t_veg(p), & + params_inst%jmaxhd, jmaxse, jmaxc) + tpu_z(p,sun,iv) = tpu25_sun * ft(t_veg(p), params_inst%tpuha) * fth(t_veg(p), & + params_inst%tpuhd, tpuse, tpuc) + vcmax_z(p,sha,iv) = vcmax25_sha * ft(t_veg(p), params_inst%vcmaxha) * fth(t_veg(p), & + params_inst%vcmaxhd, vcmaxse, vcmaxc) + jmax_z(p,sha,iv) = jmax25_sha * ft(t_veg(p), params_inst%jmaxha) * fth(t_veg(p), & + params_inst%jmaxhd, jmaxse, jmaxc) + tpu_z(p,sha,iv) = tpu25_sha * ft(t_veg(p), params_inst%tpuha) * fth(t_veg(p), & + params_inst%tpuhd, tpuse, tpuc) if (.not. c3flag(p)) then vcmax_z(p,sun,iv) = vcmax25_sun * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) @@ -3292,16 +3266,16 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & ! umol photons/m**2/s using the factor 4.6 ! sun - qabs = 0.5_r8 * (1._r8 - fnps) * par_z_sun(p,iv) * 4.6_r8 - aquad = theta_psii + qabs = 0.5_r8 * (1._r8 - params_inst%fnps) * par_z_sun(p,iv) * 4.6_r8 + aquad = params_inst%theta_psii bquad = -(qabs + jmax_z(p,sun,iv)) cquad = qabs * jmax_z(p,sun,iv) call quadratic (aquad, bquad, cquad, r1, r2) je_sun = min(r1,r2) ! sha - qabs = 0.5_r8 * (1._r8 - fnps) * par_z_sha(p,iv) * 4.6_r8 - aquad = theta_psii + qabs = 0.5_r8 * (1._r8 - params_inst%fnps) * par_z_sha(p,iv) * 4.6_r8 + aquad = params_inst%theta_psii bquad = -(qabs + jmax_z(p,sha,iv)) cquad = qabs * jmax_z(p,sha,iv) call quadratic (aquad, bquad, cquad, r1, r2) @@ -3989,9 +3963,6 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b real(r8) :: cs_sun,cs_sha ! CO2 partial pressure at leaf surface (Pa) real(r8) :: aquad, bquad, cquad ! terms for quadratic equations real(r8) :: r1, r2 ! roots of quadratic equation - real(r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real(r8) :: theta_psii ! empirical curvature parameter for electron transport rate - real(r8) :: theta_ip ! empirical curvature parameter for ap photosynthesis co-limitation real(r8) :: term ! intermediate in Medlyn stomatal model ! !------------------------------------------------------------------------------ @@ -3999,6 +3970,7 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b associate( & forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) c3flag => photosyns_inst%c3flag_patch , & ! Input: [logical (:) ] true if C3 and false if C4 + ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type medlynslope=> pftcon%medlynslope , & ! Input: [real(r8) (:) ] Slope for Medlyn stomatal conductance model method medlynintercept=> pftcon%medlynintercept , & ! Input: [real(r8) (:) ] Intercept for Medlyn stomatal conductance model method stomatalcond_mtd=> photosyns_inst%stomatalcond_mtd , & ! Input: [integer ] method type to use for stomatal conductance.GC.fnlprmsn15_r22845 @@ -4013,7 +3985,6 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b qe => photosyns_inst%qe_patch , & ! Output: [real(r8) (:) ] quantum efficiency, used only for C4 (mol CO2 / mol photons) tpu_z => photosyns_inst%tpu_z_phs_patch , & ! Output: [real(r8) (:,:,:) ] triose phosphate utilization rate (umol CO2/m**2/s) kp_z => photosyns_inst%kp_z_phs_patch , & ! Output: [real(r8) (:,:,:) ] initial slope of CO2 response curve (C4 plants) - theta_cj => photosyns_inst%theta_cj_patch , & ! Output: [real(r8) (:) ] empirical curvature parameter for ac, aj photosynthesis co-limitation bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) mbb => photosyns_inst%mbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship an_sun => photosyns_inst%an_sun_patch , & ! Output: [real(r8) (:,:) ] net sunlit leaf photosynthesis (umol CO2/m**2/s) @@ -4021,10 +3992,6 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b ) !------------------------------------------------------------------------------ - ! Miscellaneous parameters, from Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - fnps = 0.15_r8 - theta_psii = 0.7_r8 - theta_ip = 0.95_r8 if (bflag) then !zqz what if bsun==0 ... doesn't break... but follow up @@ -4064,26 +4031,26 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b ! Gross photosynthesis. First co-limit ac and aj. Then co-limit ap ! Sunlit - aquad = theta_cj(p) + aquad = params_inst%theta_cj(ivt(p)) bquad = -(ac(p,sun,iv) + aj(p,sun,iv)) cquad = ac(p,sun,iv) * aj(p,sun,iv) call quadratic (aquad, bquad, cquad, r1, r2) ai = min(r1,r2) - aquad = theta_ip + aquad = params_inst%theta_ip bquad = -(ai + ap(p,sun,iv)) cquad = ai * ap(p,sun,iv) call quadratic (aquad, bquad, cquad, r1, r2) ag(p,sun,iv) = max(0._r8,min(r1,r2)) ! Shaded - aquad = theta_cj(p) + aquad = params_inst%theta_cj(ivt(p)) bquad = -(ac(p,sha,iv) + aj(p,sha,iv)) cquad = ac(p,sha,iv) * aj(p,sha,iv) call quadratic (aquad, bquad, cquad, r1, r2) ai = min(r1,r2) - aquad = theta_ip + aquad = params_inst%theta_ip bquad = -(ai + ap(p,sha,iv)) cquad = ai * ap(p,sha,iv) call quadratic (aquad, bquad, cquad, r1, r2) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 2839f9cc9a..0cdc80cfcf 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -44,7 +44,7 @@ module controlMod use SoilBiogeochemCompetitionMod , only: suplnitro, suplnNon use SoilBiogeochemLittVertTranspMod , only: som_adv_flux, max_depth_cryoturb use SoilBiogeochemVerticalProfileMod , only: surfprof_exp - use SoilBiogeochemNitrifDenitrifMod , only: no_frozen_nitrif_denitrif, nitrifReadNML + use SoilBiogeochemNitrifDenitrifMod , only: no_frozen_nitrif_denitrif use SoilHydrologyMod , only: soilHydReadNML use CNFireFactoryMod , only: CNFireReadNML use CanopyFluxesMod , only: CanopyFluxesReadNML @@ -534,7 +534,6 @@ subroutine control_init( ) call soilHydReadNML( NLFilename ) if ( use_cn ) then - call nitrifReadNML( NLFilename ) call CNFireReadNML( NLFilename ) call CNPrecisionControlReadNML( NLFilename ) call CNNDynamicsReadNML ( NLFilename ) diff --git a/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 b/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 index 67e52d405b..784b90719b 100644 --- a/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 @@ -28,11 +28,10 @@ module SoilBiogeochemNitrifDenitrifMod private ! public :: readParams ! Read in parameters from params file - public :: nitrifReadNML ! Read in namelist public :: SoilBiogeochemNitrifDenitrif ! Calculate nitrification and ! type, private :: params_type - real(r8) :: k_nitr_max ! maximum nitrification rate constant (1/s) + real(r8) :: k_nitr_max_perday ! maximum nitrification rate constant (1/day) real(r8) :: surface_tension_water ! surface tension of water(J/m^2), Arah an and Vinten 1995 real(r8) :: rij_kro_a ! Arah and Vinten 1995) real(r8) :: rij_kro_alpha ! parameter to calculate anoxic fraction of soil (Arah and Vinten 1995) @@ -104,85 +103,32 @@ subroutine readParams ( ncid ) if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) params_inst%rij_kro_delta=tempr - end subroutine readParams + tString='k_nitr_max_perday' + call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%k_nitr_max_perday=tempr - !----------------------------------------------------------------------- - subroutine nitrifReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for nitrification/denitrification - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file + tString='denitrif_nitrateconc_coefficient' + call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%denitrif_nitrateconc_coefficient=tempr - character(len=*), parameter :: subname = 'ReadNML' - character(len=*), parameter :: nmlname = 'nitrif_inparm' - !----------------------------------------------------------------------- - real(r8) :: k_nitr_max_perday, denitrif_respiration_coefficient, & - denitrif_respiration_exponent, denitrif_nitrateconc_coefficient, & - denitrif_nitrateconc_exponent - - namelist /nitrif_inparm/ k_nitr_max_perday, denitrif_respiration_coefficient, & - denitrif_respiration_exponent, denitrif_nitrateconc_coefficient, & - denitrif_nitrateconc_exponent - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - - denitrif_respiration_coefficient = 0.1_r8 - denitrif_respiration_exponent = 1.3_r8 - denitrif_nitrateconc_coefficient = 1.15_r8 - denitrif_nitrateconc_exponent = 0.57_r8 - - k_nitr_max_perday = 0.1_r8 - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=nitrif_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (k_nitr_max_perday , mpicom) - call shr_mpi_bcast (denitrif_respiration_coefficient , mpicom) - call shr_mpi_bcast (denitrif_respiration_exponent , mpicom) - call shr_mpi_bcast (denitrif_nitrateconc_coefficient , mpicom) - call shr_mpi_bcast (denitrif_nitrateconc_exponent , mpicom) - - params_inst%k_nitr_max = k_nitr_max_perday / secspday ! Change units to per second - params_inst%denitrif_respiration_coefficient = denitrif_respiration_coefficient - params_inst%denitrif_respiration_exponent = denitrif_respiration_exponent - params_inst%denitrif_nitrateconc_coefficient = denitrif_nitrateconc_coefficient - params_inst%denitrif_nitrateconc_exponent = denitrif_nitrateconc_exponent - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=nitrif_inparm) - write(iulog,*) ' ' - end if - - end subroutine nitrifReadNML + tString='denitrif_nitrateconc_exponent' + call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%denitrif_nitrateconc_exponent=tempr + + tString='denitrif_respiration_coefficient' + call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%denitrif_respiration_coefficient=tempr + + tString='denitrif_respiration_exponent' + call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) + params_inst%denitrif_respiration_exponent=tempr + + end subroutine readParams !----------------------------------------------------------------------- subroutine SoilBiogeochemNitrifDenitrif(bounds, num_soilc, filter_soilc, & @@ -267,8 +213,7 @@ subroutine SoilBiogeochemNitrifDenitrif(bounds, num_soilc, filter_soilc, & denit_resp_exp => params_inst%denitrif_respiration_exponent , & ! Input: [real(r8) ] exponent for max denitrification rate based on respiration denit_nitrate_coef => params_inst%denitrif_nitrateconc_coefficient , & ! Input: [real(r8) ] coefficient for max denitrification rate based on nitrate concentration denit_nitrate_exp => params_inst%denitrif_nitrateconc_exponent , & ! Input: [real(r8) ] exponent for max denitrification rate based on nitrate concentration - k_nitr_max => params_inst%k_nitr_max , & ! Input: - + k_nitr_max_perday => params_inst%k_nitr_max_perday , & ! Input: [real(r8) ] maximum nitrification rate constant (1/day) r_psi => soilbiogeochem_nitrogenflux_inst%r_psi_col , & ! Output: [real(r8) (:,:) ] anaerobic_frac => soilbiogeochem_nitrogenflux_inst%anaerobic_frac_col , & ! Output: [real(r8) (:,:) ] ! ! subsets of the n flux calcs (for diagnostic/debugging purposes) @@ -372,7 +317,8 @@ subroutine SoilBiogeochemNitrifDenitrif(bounds, num_soilc, filter_soilc, & k_nitr_h2o_vr(c,j) = w_scalar(c,j) ! nitrification constant is a set scalar * temp, moisture, and ph scalars - k_nitr_vr(c,j) = k_nitr_max * k_nitr_t_vr(c,j) * k_nitr_h2o_vr(c,j) * k_nitr_ph_vr(c,j) + ! note that k_nitr_max_perday is converted from 1/day to 1/s + k_nitr_vr(c,j) = k_nitr_max_perday/secspday * k_nitr_t_vr(c,j) * k_nitr_h2o_vr(c,j) * k_nitr_ph_vr(c,j) ! first-order decay of ammonium pool with scalar defined above pot_f_nit_vr(c,j) = max(smin_nh4_vr(c,j) * k_nitr_vr(c,j), 0._r8) From ed69a150b30f37fe311cccde10f837cedae2df73 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 5 May 2020 13:36:30 -0600 Subject: [PATCH 0850/1973] Add initial version of config_machines_template.xml This was copied directly from cime master (ESMCI/cime@ebb9dd6c9). --- .../config_machines_template.xml | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 lilac_config/build_templates/config_machines_template.xml diff --git a/lilac_config/build_templates/config_machines_template.xml b/lilac_config/build_templates/config_machines_template.xml new file mode 100644 index 0000000000..99c2bc7258 --- /dev/null +++ b/lilac_config/build_templates/config_machines_template.xml @@ -0,0 +1,163 @@ + + + + + + + + SITE VENDOR platform, os is ---, xx pes/node, batch system is --- + + + .*.cheyenne.ucar.edu + + + LINUX + + + https://howto.get.out + + + intel,gnu + + + mpt,openmpi,impi + + + couldbethis + + + couldbethis + + + + + + + + + /glade/scratch/$USER + + + $ENV{CESMDATAROOT}/inputdata + + + $ENV{CESMDATAROOT}/lmwg + + + $CIME_OUTPUT_ROOT/archive/$CASE + + + $ENV{CESMDATAROOT}/cesm_baselines + + + $ENV{CESMDATAROOT}/tools/cime/tools/cprnc/cprnc.cheyenne + + + gmake + + + 8 + + + none + + + cseg + + + 36 + + + 36 + + + TRUE + + + + + mpiexec_mpt + + + -p "%g:" + omplace + + + + + + + + /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/perl + /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/env_modules_python.py + /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/csh + /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/sh + /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/libexec/lmod perl + /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/libexec/lmod python + module + module + + + ncarenv/1.0 + + + intel/16.0.3 + mkl + + + gnu/6.3.0 + + + mpt/2.15 + ncarcompilers/0.3.5 + + + netcdf/4.4.1 + + + netcdf/4.4.1 + + pnetcdf/1.8.0 + + + + + 256M + 16 + + + + -1 + + + From fc06813a00d133653b1c72b94b41b258baa4fc53 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 5 May 2020 17:40:38 -0600 Subject: [PATCH 0851/1973] Updates for the entire test suite to PASS This commit includes an answer-changing modification in CNVegCarbonFluxType's subroutine Summary_carbonflux: For carbon and nitrogen to balance at the gridcell level, we must account for the terms hrv_xsmrpool_to_atm_grc and dwt_conv_[c,n]flux_grc in a single timestep rather then by dribbling over the course of a year, unless allows_non_annual_delta = .true. The modification affects the corresponding dribbled terms, which in turn affect nee_grc, landuseflux_grc, nbp_grc, and fco2, all of which are diagnostic in the land model. As a result, all other variables in history output appear unchanged from their baseline values. --- src/biogeochem/CNBalanceCheckMod.F90 | 38 +++++++++++++++----------- src/biogeochem/CNVegCarbonFluxType.F90 | 11 +++++++- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index cc794362d5..89bcf84f0c 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -117,8 +117,6 @@ subroutine BeginCNGridcellBalance(this, bounds, & grc_begnb => this%begnb_grc , & ! Output: [real(r8) (:)] (gN/m2) gridcell nitrogen mass, beginning of time step totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool totgrcn => cnveg_nitrogenstate_inst%totn_grc, & ! Input: [real(r8) (:)] (gN/m2) total gridcell nitrogen, incl veg - seedc_grc => cnveg_carbonstate_inst%seedc_grc, & ! Input: [real(r8) (:)] (gC/m2) seed carbon - seedn_grc => cnveg_nitrogenstate_inst%seedn_grc, & ! Input: [real(r8) (:)] (gC/m2) seed nitrogen cropprod1c_grc => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products cropprod1n_grc => n_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) nitrogen in crop products tot_woodprodc_grc => c_products_inst%tot_woodprod_grc, & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products @@ -128,8 +126,8 @@ subroutine BeginCNGridcellBalance(this, bounds, & begg = bounds%begg; endg = bounds%endg do g = begg, endg - grc_begcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprodc_grc(g) + cropprod1c_grc(g) - grc_begnb(g) = totgrcn(g) + seedn_grc(g) + tot_woodprodn_grc(g) + cropprod1n_grc(g) + grc_begcb(g) = totgrcc(g) + tot_woodprodc_grc(g) + cropprod1c_grc(g) + grc_begnb(g) = totgrcn(g) + tot_woodprodn_grc(g) + cropprod1n_grc(g) end do end associate @@ -219,7 +217,6 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & tot_woodprod_grc => c_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products dwt_seedc_to_leaf_grc => cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to leaf dwt_seedc_to_deadstem_grc => cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc , & ! Input: [real(r8) (:)] (gC/m2/s) seed source sent to deadstem - seedc_grc => cnveg_carbonstate_inst%seedc_grc , & ! Input: [real(r8) (:)] (gC/m2) seed carbon col_begcb => this%begcb_col , & ! Input: [real(r8) (:) ] (gC/m2) carbon mass, beginning of time step col_endcb => this%endcb_col , & ! Output: [real(r8) (:) ] (gC/m2) carbon mass, end of time step wood_harvestc => cnveg_carbonflux_inst%wood_harvestc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) wood harvest (to product pools) @@ -317,7 +314,13 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! slevis notes: ! totgrcc = totcolc = totc_p2c_col(c) + soilbiogeochem_cwdc_col(c) + soilbiogeochem_totlitc_col(c) + soilbiogeochem_totsomc_col(c) + soilbiogeochem_ctrunc_col(c) ! totc_p2c_col = totc_patch = totvegc_patch(p) + xsmrpool_patch(p) + ctrunc_patch(p) + cropseedc_deficit_patch(p) - grc_endcb(g) = totgrcc(g) + seedc_grc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) + ! slevis: Not including seedc_grc in grc_begcb and grc_endcb because + ! seedc_grc equals + ! -1 * (dwt_seedc_to_leaf_grc(g) + dwt_seedc_to_deadstem_grc(g)) + ! and we account for the latter fluxes as inputs below; the same + ! fluxes have entered the pools earlier in the timestep. For true + ! conservation we would need to add a flux out of npp into seed. + grc_endcb(g) = totgrcc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) ! calculate total gridcell-level inputs ! slevis notes: @@ -406,7 +409,6 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8):: soyfixn_to_sminn_grc(bounds%begg:bounds%endg) real(r8):: denit_grc(bounds%begg:bounds%endg) real(r8):: grc_fire_nloss(bounds%begg:bounds%endg) - real(r8):: wood_harvestn_grc(bounds%begg:bounds%endg) real(r8):: som_n_leached_grc(bounds%begg:bounds%endg) real(r8):: sminn_leached_grc(bounds%begg:bounds%endg) real(r8):: f_n2o_nit_grc(bounds%begg:bounds%endg) @@ -420,10 +422,11 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & totgrcn => cnveg_nitrogenstate_inst%totn_grc , & ! Input: [real(r8) (:) ] (gN/m2) total gridcell nitrogen, incl veg forc_ndep => atm2lnd_inst%forc_ndep_grc , & ! Input: [real(r8) (:)] nitrogen deposition rate (gN/m2/s) cropprod1_grc => n_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gN/m2) nitrogen in crop products + product_loss_grc => n_products_inst%product_loss_grc , & ! Input: [real(r8) (:)] (gN/m2) losses from wood & crop products tot_woodprod_grc => n_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gN/m2) total nitrogen in wood products dwt_seedn_to_leaf_grc => cnveg_nitrogenflux_inst%dwt_seedn_to_leaf_grc , & ! Input: [real(r8) (:)] (gN/m2/s) seed source sent to leaf dwt_seedn_to_deadstem_grc => cnveg_nitrogenflux_inst%dwt_seedn_to_deadstem_grc , & ! Input: [real(r8) (:)] (gN/m2/s) seed source sent to deadstem - seedn_grc => cnveg_nitrogenstate_inst%seedn_grc , & ! Input: [real(r8) (:)] (gN/m2) seed nitrogen + dwt_conv_nflux_grc => cnveg_nitrogenflux_inst%dwt_conv_nflux_grc , & ! Input: [real(r8) (:)] (gN/m2/s) dwt_conv_nflux_patch summed to the gridcell-level col_begnb => this%begnb_col , & ! Input: [real(r8) (:) ] (gN/m2) column nitrogen mass, beginning of time step col_endnb => this%endnb_col , & ! Output: [real(r8) (:) ] (gN/m2) column nitrogen mass, end of time step ndep_to_sminn => soilbiogeochem_nitrogenflux_inst%ndep_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) atmospheric N deposition to soil mineral N @@ -569,11 +572,6 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & garr = grc_fire_nloss(bounds%begg:bounds%endg), & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') - call c2g( bounds = bounds, & - carr = wood_harvestn(bounds%begc:bounds%endc), & - garr = wood_harvestn_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') call c2g( bounds = bounds, & carr = som_n_leached(bounds%begc:bounds%endc), & garr = som_n_leached_grc(bounds%begg:bounds%endg), & @@ -606,7 +604,13 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & err_found = .false. do g = bounds%begg, bounds%endg ! calculate the total gridcell-level nitrogen storage, for mass conservation check - grc_endnb(g) = totgrcn(g) + seedn_grc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) + ! slevis: Not including seedn_grc in grc_begnb and grc_endnb because + ! seedn_grc equals + ! -1 * (dwt_seedn_to_leaf_grc(g) + dwt_seedn_to_deadstem_grc(g)) + ! and we account for the latter fluxes as inputs below; the same + ! fluxes have entered the pools earlier in the timestep. For true + ! conservation we would need to add a flux out of nfix into seed. + grc_endnb(g) = totgrcn(g) + tot_woodprod_grc(g) + cropprod1_grc(g) ! calculate total gridcell-level inputs grc_ninputs(g) = forc_ndep(g) + nfix_to_sminn_grc(g) + & @@ -624,7 +628,8 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! calculate total gridcell-level outputs grc_noutputs(g) = denit_grc(g) + grc_fire_nloss(g) + & - wood_harvestn_grc(g) - som_n_leached_grc(g) + dwt_conv_nflux_grc(g) + product_loss_grc(g) - & + som_n_leached_grc(g) if (.not. use_nitrif_denitrif) then grc_noutputs(g) = grc_noutputs(g) + sminn_leached_grc(g) @@ -673,7 +678,8 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*) '--- Outputs ---' write(iulog,*) 'denit_grc =', denit_grc(g) * dt write(iulog,*) 'grc_fire_nloss =', grc_fire_nloss(g) * dt - write(iulog,*) 'wood_harvestn_grc =', wood_harvestn_grc(g) * dt + write(iulog,*) 'dwt_conv_nflux_grc =', dwt_conv_nflux_grc(g) * dt + write(iulog,*) 'product_loss_grc =', product_loss_grc(g) * dt write(iulog,*) '-1*som_n_leached_grc = ', som_n_leached_grc(g) * dt if (.not. use_nitrif_denitrif) then write(iulog,*) 'sminn_leached_grc =', sminn_leached_grc(g) * dt diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index b9f512329a..3a73e32d45 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -770,7 +770,6 @@ subroutine InitAllocate(this, bounds, carbon_type) name = 'hrv_xsmrpool_to_atm_' // carbon_type_suffix, & units = 'gC/m^2', & allows_non_annual_delta = .false.) - end subroutine InitAllocate !------------------------------------------------------------------------ @@ -4553,6 +4552,16 @@ subroutine Summary_carbonflux(this, & call this%dwt_conv_cflux_dribbler%get_curr_flux(bounds, & this%dwt_conv_cflux_dribbled_grc(bounds%begg:bounds%endg)) + if (get_for_testing_allow_non_annual_changes() .or. use_cndv) then + hrv_xsmrpool_to_atm_dribbled_grc = hrv_xsmrpool_to_atm_dribbled_grc + this%dwt_conv_cflux_dribbled_grc = this%dwt_conv_cflux_dribbled_grc + else + ! In this case overwrite the dribbled array with the non-dribbled array + ! so as to conserve carbon and nitrogen at every timestep + hrv_xsmrpool_to_atm_dribbled_grc = hrv_xsmrpool_to_atm_grc + this%dwt_conv_cflux_dribbled_grc = this%dwt_conv_cflux_grc + end if + do g = bounds%begg, bounds%endg ! net ecosystem exchange of carbon, includes fire flux and hrv_xsmrpool flux, ! positive for source (NEE) From 7db2458241e59c51bcd2a1def5f92b626efbcba4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 6 May 2020 18:02:54 -0600 Subject: [PATCH 0852/1973] Turn config_machines_template.xml into a template Then we can transform it into an actual config_machines.xml file with python code like this: with open('/Users/sacks/ctsm/ctsm3/lilac_config/build_templates/config_machines_template.xml') as f: contents = f.read() config_machines_template = string.Template(contents) config_machines = config_machines_template.substitute(OS='Darwin', COMPILER='gnu', MPILIB='mpich', CIME_OUTPUT_ROOT='/path/to/build', GMAKE='gmake', GMAKE_J=4) with open('/Users/sacks/temporary/config_machines.xml', 'w') as f: f.write(config_machines) --- .../config_machines_template.xml | 176 ++++++------------ 1 file changed, 62 insertions(+), 114 deletions(-) diff --git a/lilac_config/build_templates/config_machines_template.xml b/lilac_config/build_templates/config_machines_template.xml index 99c2bc7258..d1b2ea5354 100644 --- a/lilac_config/build_templates/config_machines_template.xml +++ b/lilac_config/build_templates/config_machines_template.xml @@ -1,163 +1,111 @@ - - - - - - - SITE VENDOR platform, os is ---, xx pes/node, batch system is --- - - - .*.cheyenne.ucar.edu - - LINUX + - https://howto.get.out - + If you are looking at the template file: Variable names prefixed + with a dollar sign will be replaced with machine-specific values. A + double dollar sign gets replaced with a single dollar sign, so + something like $$MYVAR refers to the MYVAR cime variable. + --> - intel,gnu - - - mpt,openmpi,impi + + - - couldbethis + + Temporary build information for a CTSM build - - couldbethis + + $OS - - + + $COMPILER - - + + $MPILIB - /glade/scratch/$USER + $CIME_OUTPUT_ROOT - $ENV{CESMDATAROOT}/inputdata + long as the user has write access to this directory. --> + $$CIME_OUTPUT_ROOT/inputdata - $ENV{CESMDATAROOT}/lmwg + $$CIME_OUTPUT_ROOT/inputdata_clmforc - $CIME_OUTPUT_ROOT/archive/$CASE - - - $ENV{CESMDATAROOT}/cesm_baselines - - - $ENV{CESMDATAROOT}/tools/cime/tools/cprnc/cprnc.cheyenne + $$CIME_OUTPUT_ROOT/archive/$$CASE - gmake + $GMAKE - 8 + $GMAKE_J + supported values are: none, cobalt, lsf, pbs, slurm. + + This is irrelevant for this build-only port. + --> none - cseg + CTSM - - 36 + - 36 + This is irrelevant for this build-only port. + --> + 1 - - TRUE + + 1 + are values listed in MPILIBS above, default and mpi-serial. + + This is irrelevant for this build-only port. + --> - mpiexec_mpt + mpirun - -p "%g:" - omplace + -np $$TOTALPES + -prepend-rank - - - + - - /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/perl - /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/env_modules_python.py - /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/csh - /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/sh - /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/libexec/lmod perl - /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/libexec/lmod python - module - module - - - ncarenv/1.0 - - - intel/16.0.3 - mkl - - - gnu/6.3.0 - - - mpt/2.15 - ncarcompilers/0.3.5 - - - netcdf/4.4.1 - - - netcdf/4.4.1 - - pnetcdf/1.8.0 - - - - - 256M - 16 - - - - -1 - + + From f0ebc40e1e370ddb52ec75f8d539a440116c4f1c Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 6 May 2020 23:03:39 -0600 Subject: [PATCH 0853/1973] Revisions in response to @billsacks' review (part 1) --- src/biogeochem/CNProductsMod.F90 | 21 ++++++--------------- src/biogeochem/CNVegCarbonFluxType.F90 | 6 ++---- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 9eca38bdbe..509d186db3 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -25,6 +25,8 @@ module CNProductsMod ! ------------------------------------------------------------------------ real(r8), pointer, public :: product_loss_grc(:) ! (g[C or N]/m2/s) total decomposition loss from ALL product pools + real(r8), pointer, public :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan + real(r8), pointer, public :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool ! ------------------------------------------------------------------------ ! Private instance variables @@ -33,10 +35,8 @@ module CNProductsMod class(species_base_type), allocatable :: species ! C, N, C13, C14, etc. ! States - real(r8), pointer, public :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan real(r8), pointer :: prod10_grc(:) ! (g[C or N]/m2) wood product pool, 10-year lifespan real(r8), pointer :: prod100_grc(:) ! (g[C or N]/m2) wood product pool, 100-year lifespan - real(r8), pointer, public :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool ! Fluxes: gains real(r8), pointer :: dwt_prod10_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 10-year wood product pool @@ -354,19 +354,6 @@ subroutine Restart(this, bounds, ncid, flag, & ! distinguish these gridcell-level restart fields from the obsolete column-level ! restart fields that are present on old restart files. - call restartvar(ncid=ncid, flag=flag, & - varname=this%species%rest_fname('tot_woodprod', suffix='_g'), & - xtype=ncd_double, dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tot_woodprod_grc) - ! Backwards compatibility mentioned below is not applicable for this var. - ! If field not found in restart, then set from template if provided - if (flag == 'read' .and. .not. readvar .and. template_provided) then - call set_missing_from_template(this%tot_woodprod_grc, & - template_for_missing_fields%tot_woodprod_grc, & - multiplier = template_multiplier) - end if - call restartvar(ncid=ncid, flag=flag, & varname=this%species%rest_fname('cropprod1', suffix='_g'), & xtype=ncd_double, dim1name='gridcell', & @@ -442,6 +429,10 @@ subroutine Restart(this, bounds, ncid, flag, & end if end if + if (flag == 'read') then + call this%ComputeSummaryVars(bounds) + end if + end subroutine Restart !----------------------------------------------------------------------- diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 3a73e32d45..463127e306 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -770,6 +770,7 @@ subroutine InitAllocate(this, bounds, carbon_type) name = 'hrv_xsmrpool_to_atm_' // carbon_type_suffix, & units = 'gC/m^2', & allows_non_annual_delta = .false.) + end subroutine InitAllocate !------------------------------------------------------------------------ @@ -4552,10 +4553,7 @@ subroutine Summary_carbonflux(this, & call this%dwt_conv_cflux_dribbler%get_curr_flux(bounds, & this%dwt_conv_cflux_dribbled_grc(bounds%begg:bounds%endg)) - if (get_for_testing_allow_non_annual_changes() .or. use_cndv) then - hrv_xsmrpool_to_atm_dribbled_grc = hrv_xsmrpool_to_atm_dribbled_grc - this%dwt_conv_cflux_dribbled_grc = this%dwt_conv_cflux_dribbled_grc - else + if (.not. get_for_testing_allow_non_annual_changes() .and. .not. use_cndv) then ! In this case overwrite the dribbled array with the non-dribbled array ! so as to conserve carbon and nitrogen at every timestep hrv_xsmrpool_to_atm_dribbled_grc = hrv_xsmrpool_to_atm_grc From c595bd18592d8eaaedfaf5b6a006913479a6e2f3 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 6 May 2020 23:25:20 -0600 Subject: [PATCH 0854/1973] Revisions (part 2) --- src/biogeochem/CNBalanceCheckMod.F90 | 35 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index 89bcf84f0c..27d4cf354e 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -112,22 +112,22 @@ subroutine BeginCNGridcellBalance(this, bounds, & integer :: begg, endg !----------------------------------------------------------------------- - associate( & - grc_begcb => this%begcb_grc , & ! Output: [real(r8) (:)] (gC/m2) gridcell carbon mass, beginning of time step - grc_begnb => this%begnb_grc , & ! Output: [real(r8) (:)] (gN/m2) gridcell nitrogen mass, beginning of time step - totgrcc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool - totgrcn => cnveg_nitrogenstate_inst%totn_grc, & ! Input: [real(r8) (:)] (gN/m2) total gridcell nitrogen, incl veg - cropprod1c_grc => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products - cropprod1n_grc => n_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) nitrogen in crop products - tot_woodprodc_grc => c_products_inst%tot_woodprod_grc, & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products - tot_woodprodn_grc => n_products_inst%tot_woodprod_grc & ! Input: [real(r8) (:)] (gC/m2) total nitrogen in wood products + associate( & + begcb => this%begcb_grc , & ! Output: [real(r8) (:)] (gC/m2) gridcell carbon mass, beginning of time step + begnb => this%begnb_grc , & ! Output: [real(r8) (:)] (gN/m2) gridcell nitrogen mass, beginning of time step + totc => cnveg_carbonstate_inst%totc_grc , & ! Input: [real(r8) (:)] (gC/m2) total gridcell carbon, incl veg and cpool + totn => cnveg_nitrogenstate_inst%totn_grc, & ! Input: [real(r8) (:)] (gN/m2) total gridcell nitrogen, incl veg + c_cropprod1 => c_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) carbon in crop products + n_cropprod1 => n_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gC/m2) nitrogen in crop products + c_tot_woodprod => c_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gC/m2) total carbon in wood products + n_tot_woodprod => n_products_inst%tot_woodprod_grc & ! Input: [real(r8) (:)] (gC/m2) total nitrogen in wood products ) begg = bounds%begg; endg = bounds%endg do g = begg, endg - grc_begcb(g) = totgrcc(g) + tot_woodprodc_grc(g) + cropprod1c_grc(g) - grc_begnb(g) = totgrcn(g) + tot_woodprodn_grc(g) + cropprod1n_grc(g) + begcb(g) = totc(g) + c_tot_woodprod(g) + c_cropprod1(g) + begnb(g) = totn(g) + n_tot_woodprod(g) + n_cropprod1(g) end do end associate @@ -141,7 +141,6 @@ subroutine BeginCNColumnBalance(this, bounds, num_soilc, filter_soilc, & ! !DESCRIPTION: ! Calculate beginning column-level carbon/nitrogen balance, for mass conservation check ! - ! Column level: ! Should be called after CN state summaries have been recomputed for this time step ! (which should be after the dynamic landunit area updates and the associated filter ! updates - i.e., using the new version of the filters) @@ -181,7 +180,7 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & cnveg_carbonstate_inst, c_products_inst) ! ! !USES: - use subgridAveMod, only: c2g, p2g + use subgridAveMod, only: c2g ! ! !DESCRIPTION: ! Perform carbon mass conservation check for column and patch @@ -315,9 +314,9 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! totgrcc = totcolc = totc_p2c_col(c) + soilbiogeochem_cwdc_col(c) + soilbiogeochem_totlitc_col(c) + soilbiogeochem_totsomc_col(c) + soilbiogeochem_ctrunc_col(c) ! totc_p2c_col = totc_patch = totvegc_patch(p) + xsmrpool_patch(p) + ctrunc_patch(p) + cropseedc_deficit_patch(p) ! slevis: Not including seedc_grc in grc_begcb and grc_endcb because - ! seedc_grc equals + ! seedc_grc forms out of thin air, for now, and equals ! -1 * (dwt_seedc_to_leaf_grc(g) + dwt_seedc_to_deadstem_grc(g)) - ! and we account for the latter fluxes as inputs below; the same + ! We account for the latter fluxes as inputs below; the same ! fluxes have entered the pools earlier in the timestep. For true ! conservation we would need to add a flux out of npp into seed. grc_endcb(g) = totgrcc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) @@ -376,7 +375,7 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! ! !USES: use clm_varctl, only : use_crop - use subgridAveMod, only: c2g, p2g + use subgridAveMod, only: c2g use atm2lndType, only: atm2lnd_type ! ! !ARGUMENTS: @@ -605,9 +604,9 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & do g = bounds%begg, bounds%endg ! calculate the total gridcell-level nitrogen storage, for mass conservation check ! slevis: Not including seedn_grc in grc_begnb and grc_endnb because - ! seedn_grc equals + ! seedn_grc forms out of thin air, for now, and equals ! -1 * (dwt_seedn_to_leaf_grc(g) + dwt_seedn_to_deadstem_grc(g)) - ! and we account for the latter fluxes as inputs below; the same + ! We account for the latter fluxes as inputs below; the same ! fluxes have entered the pools earlier in the timestep. For true ! conservation we would need to add a flux out of nfix into seed. grc_endnb(g) = totgrcn(g) + tot_woodprod_grc(g) + cropprod1_grc(g) From 510a0a105a092de652c71316be982d92368629c2 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 7 May 2020 11:55:50 -0600 Subject: [PATCH 0855/1973] Revisions (part 3) --- src/biogeochem/CNBalanceCheckMod.F90 | 126 +++++---------------------- 1 file changed, 24 insertions(+), 102 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index 27d4cf354e..78e9c1325e 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -398,6 +398,10 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8):: col_ninputs(bounds%begc:bounds%endc) real(r8):: col_noutputs(bounds%begc:bounds%endc) real(r8):: col_errnb(bounds%begc:bounds%endc) + real(r8):: col_ninputs_partial(bounds%begc:bounds%endc) + real(r8):: col_noutputs_partial(bounds%begc:bounds%endc) + real(r8):: grc_ninputs_partial(bounds%begg:bounds%endg) + real(r8):: grc_noutputs_partial(bounds%begg:bounds%endg) real(r8):: grc_ninputs(bounds%begg:bounds%endg) real(r8):: grc_noutputs(bounds%begg:bounds%endg) real(r8):: grc_errnb(bounds%begg:bounds%endg) @@ -451,6 +455,10 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & ! set time steps dt = get_step_size_real() + ! initialize local arrays + col_ninputs_partial(:) = 0._r8 + col_noutputs_partial(:) = 0._r8 + err_found = .false. do fc = 1,num_soilc c=filter_soilc(fc) @@ -469,6 +477,8 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & col_ninputs(c) = col_ninputs(c) + fert_to_sminn(c) + soyfixn_to_sminn(c) end if + col_ninputs_partial(c) = col_ninputs(c) + ! calculate total column-level outputs col_noutputs(c) = denit(c) + col_fire_nloss(c) @@ -491,6 +501,10 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & col_noutputs(c) = col_noutputs(c) - som_n_leached(c) + col_noutputs_partial(c) = col_noutputs(c) - & + wood_harvestn(c) - & + grainn_to_cropprodn(c) + ! calculate the total column-level nitrogen balance error for this time step col_errnb(c) = (col_ninputs(c) - col_noutputs(c))*dt - & (col_endnb(c) - col_begnb(c)) @@ -533,72 +547,15 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') call c2g( bounds = bounds, & - carr = nfix_to_sminn(bounds%begc:bounds%endc), & - garr = nfix_to_sminn_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - call c2g( bounds = bounds, & - carr = supplement_to_sminn(bounds%begc:bounds%endc), & - garr = supplement_to_sminn_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - if (use_fun) then - call c2g( bounds = bounds, & - carr = ffix_to_sminn(bounds%begc:bounds%endc), & - garr = ffix_to_sminn_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - end if - if (use_crop) then - call c2g( bounds = bounds, & - carr = fert_to_sminn(bounds%begc:bounds%endc), & - garr = fert_to_sminn_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - call c2g( bounds = bounds, & - carr = soyfixn_to_sminn(bounds%begc:bounds%endc), & - garr = soyfixn_to_sminn_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - end if - call c2g( bounds = bounds, & - carr = denit(bounds%begc:bounds%endc), & - garr = denit_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - call c2g( bounds = bounds, & - carr = col_fire_nloss(bounds%begc:bounds%endc), & - garr = grc_fire_nloss(bounds%begg:bounds%endg), & + carr = col_ninputs_partial(bounds%begc:bounds%endc), & + garr = grc_ninputs_partial(bounds%begg:bounds%endg), & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') call c2g( bounds = bounds, & - carr = som_n_leached(bounds%begc:bounds%endc), & - garr = som_n_leached_grc(bounds%begg:bounds%endg), & + carr = col_noutputs_partial(bounds%begc:bounds%endc), & + garr = grc_noutputs_partial(bounds%begg:bounds%endg), & c2l_scale_type = 'unity', & l2g_scale_type = 'unity') - if (.not. use_nitrif_denitrif) then - call c2g( bounds = bounds, & - carr = sminn_leached(bounds%begc:bounds%endc), & - garr = sminn_leached_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - else - call c2g( bounds = bounds, & - carr = f_n2o_nit(bounds%begc:bounds%endc), & - garr = f_n2o_nit_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - call c2g( bounds = bounds, & - carr = smin_no3_leached(bounds%begc:bounds%endc), & - garr = smin_no3_leached_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - call c2g( bounds = bounds, & - carr = smin_no3_runoff(bounds%begc:bounds%endc), & - garr = smin_no3_runoff_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - end if err_found = .false. do g = bounds%begg, bounds%endg @@ -612,30 +569,14 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & grc_endnb(g) = totgrcn(g) + tot_woodprod_grc(g) + cropprod1_grc(g) ! calculate total gridcell-level inputs - grc_ninputs(g) = forc_ndep(g) + nfix_to_sminn_grc(g) + & - supplement_to_sminn_grc(g) + & + grc_ninputs(g) = grc_ninputs_partial(g) + & dwt_seedn_to_leaf_grc(g) + & dwt_seedn_to_deadstem_grc(g) - if (use_fun) then - grc_ninputs(g) = grc_ninputs(g) + ffix_to_sminn_grc(g) - endif - - if (use_crop) then - grc_ninputs(g) = grc_ninputs(g) + fert_to_sminn_grc(g) + soyfixn_to_sminn_grc(g) - end if - ! calculate total gridcell-level outputs - grc_noutputs(g) = denit_grc(g) + grc_fire_nloss(g) + & - dwt_conv_nflux_grc(g) + product_loss_grc(g) - & - som_n_leached_grc(g) - - if (.not. use_nitrif_denitrif) then - grc_noutputs(g) = grc_noutputs(g) + sminn_leached_grc(g) - else - grc_noutputs(g) = grc_noutputs(g) + f_n2o_nit_grc(g) + & - smin_no3_leached_grc(g) + smin_no3_runoff_grc(g) - end if + grc_noutputs(g) = grc_noutputs_partial(g) + & + dwt_conv_nflux_grc(g) + & + product_loss_grc(g) ! calculate the total gridcell-level nitrogen balance error for this time step grc_errnb(g) = (grc_ninputs(g) - grc_noutputs(g)) * dt - & @@ -662,32 +603,13 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & write(iulog,*) 'output mass =', grc_noutputs(g) * dt write(iulog,*) 'net flux =', (grc_ninputs(g) - grc_noutputs(g)) * dt write(iulog,*) '--- Inputs ---' - write(iulog,*) 'forc_ndep =', forc_ndep(g) * dt - write(iulog,*) 'nfix_to_sminn_grc =', nfix_to_sminn_grc(g) * dt - write(iulog,*) 'supplement_to_sminn_grc =', supplement_to_sminn_grc(g) * dt + write(iulog,*) 'grc_ninputs_partial =', grc_ninputs_partial(g) * dt write(iulog,*) 'dwt_seedn_to_leaf_grc =', dwt_seedn_to_leaf_grc(g) * dt write(iulog,*) 'dwt_seedn_to_deadstem_grc =', dwt_seedn_to_deadstem_grc(g) * dt - if (use_fun) then - write(iulog,*) 'ffix_to_sminn_grc =', ffix_to_sminn_grc(g) * dt - end if - if (use_crop) then - write(iulog,*) 'fert_to_sminn_grc =', fert_to_sminn_grc(g) * dt - write(iulog,*) 'soyfixn_to_sminn_grc =', soyfixn_to_sminn_grc(g) * dt - end if write(iulog,*) '--- Outputs ---' - write(iulog,*) 'denit_grc =', denit_grc(g) * dt - write(iulog,*) 'grc_fire_nloss =', grc_fire_nloss(g) * dt + write(iulog,*) 'grc_noutputs_partial =', grc_noutputs_partial(g) * dt write(iulog,*) 'dwt_conv_nflux_grc =', dwt_conv_nflux_grc(g) * dt write(iulog,*) 'product_loss_grc =', product_loss_grc(g) * dt - write(iulog,*) '-1*som_n_leached_grc = ', som_n_leached_grc(g) * dt - if (.not. use_nitrif_denitrif) then - write(iulog,*) 'sminn_leached_grc =', sminn_leached_grc(g) * dt - else - write(iulog,*) 'f_n2o_nit_grc =', f_n2o_nit_grc(g) * dt - write(iulog,*) 'smin_no3_leached_grc =', smin_no3_leached_grc(g) * dt - write(iulog,*) 'smin_no3_runoff_grc =', smin_no3_runoff_grc(g) * dt - end if - call endrun(msg=errMsg(sourcefile, __LINE__)) end if From c35bf3210ca67bb0e575fbe3362ea24687b327bd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 7 May 2020 13:04:47 -0600 Subject: [PATCH 0856/1973] Add .zenodo.json file This tells Zenodo to document the authorship simply as "CTSM Development Team", rather than trying to harvest authorship information from the list of git contributors. --- .zenodo.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .zenodo.json diff --git a/.zenodo.json b/.zenodo.json new file mode 100644 index 0000000000..1982ce4917 --- /dev/null +++ b/.zenodo.json @@ -0,0 +1,7 @@ +{ + "creators": [ + { + "name": "CTSM Development Team" + } + ] +} From 9372387107a0d8d8f23356cc460902c3cb0dd369 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 7 May 2020 13:12:06 -0600 Subject: [PATCH 0857/1973] Change README to markdown --- README.rst => README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) rename README.rst => README.md (86%) diff --git a/README.rst b/README.md similarity index 86% rename from README.rst rename to README.md index 193d806898..aaf2ba01e7 100644 --- a/README.rst +++ b/README.md @@ -1,9 +1,8 @@ -==== -CTSM -==== +# CTSM -.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3739617.svg - :target: https://doi.org/10.5281/zenodo.3739617 +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3739617.svg)](https://doi.org/10.5281/zenodo.3739617) + +## Overview and Resources The Community Terrestrial Systems Model. From b9864cdfefac082d80dfeecdef4cf33067becd39 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 7 May 2020 13:15:22 -0600 Subject: [PATCH 0858/1973] Fix a link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aaf2ba01e7..6a865850d4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ https://escomp.github.io/ctsm-docs/ For help with how to work with CTSM in git, see -https://github.com/ESCOMP/ctsm/wiki/Getting-started-with-CTSM-in-git +https://github.com/ESCOMP/CTSM/wiki/Quick-start-to-CTSM-development-with-git and From a349ef6fa593e648d374964d5b61fdd8b7dfffc2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 7 May 2020 13:46:57 -0600 Subject: [PATCH 0859/1973] Add names in core CTSM code management team --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a865850d4..766705ee69 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3739617.svg)](https://doi.org/10.5281/zenodo.3739617) -## Overview and Resources +## Overview and resources The Community Terrestrial Systems Model. @@ -36,3 +36,23 @@ join our low traffic email list: https://groups.google.com/a/ucar.edu/forum/#!forum/ctsm-dev (Send email to ctsm-software@ucar.edu if you have problems with any of this) + +## CTSM code management team + +CTSM code management is provided primarily by: + +Software engineering team: +- [Erik Kluzek](https://github.com/ekluzek) +- [Bill Sacks](https://github.com/billsacks) +- [Mariana Vertenstein](https://github.com/mvertens) +- [Negin Sobhani](https://github.com/negin513) +- [Sam Levis](https://github.com/slevisconsulting) + +Science team: +- [Dave Lawrence](https://github.com/dlawrenncar) +- [Will Wieder](https://github.com/wwieder) +- [Danica Lombardozzi](https://github.com/danicalombardozzi) +- [Keith Oleson](https://github.com/olyson) +- [Sean Swenson](https://github.com/swensosc) +- [Mike Barlage](https://github.com/barlage) +- [Rosie Fisher](https://github.com/rosiealice) From ae9f4032344818222ee4d4036423ad7d8dfb15da Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Thu, 7 May 2020 16:05:36 -0600 Subject: [PATCH 0860/1973] Second round of moving parameters to param file. BFB according to following tests: ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput Parameters moved: jmaxb0 wc2wjb0 enzyme_turnover_daily --- src/biogeophys/LunaMod.F90 | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index a64aae0505..2d84e7e097 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -47,6 +47,9 @@ module LunaMod real(r8) :: kc25_coef ! Michaelis-Menten const. at 25°C for CO2 (unitless) real(r8) :: ko25_coef ! Michaelis-Menten const. at 25°C for O2 (unitless) real(r8) :: luna_theta_cj ! LUNA empirical curvature parameter for ac, aj photosynthesis co-limitation (unitless) + real(r8) :: jmaxb0 ! The baseline proportion of nitrogen allocated for electron transport (J) + real(r8) :: wc2wjb0 ! The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (unitless) + real(r8) :: enzyme_turnover_daily ! The daily turnover rate for photosynthetic enzyme at 25oC in view of ~7 days of half-life time for Rubisco (Suzuki et al. 2001) (unitless) end type params_type type(params_type), private :: params_inst @@ -73,11 +76,8 @@ module LunaMod real(r8), parameter :: CO2ref = 380.0_r8 ! reference CO2 concentration for calculation of reference NUE. real(r8), parameter :: forc_pbot_ref = 101325.0_r8 ! reference air pressure for calculation of reference NUE real(r8), parameter :: Q10Enz = 2.0_r8 ! Q10 value for enzyme decay rate - real(r8), parameter :: Jmaxb0 = 0.0311_r8 ! the baseline proportion of nitrogen allocated for electron transport (J) real(r8) :: Jmaxb1 = 0.1_r8 ! the baseline proportion of nitrogen allocated for electron transport (J) - real(r8), parameter :: Wc2Wjb0 = 0.8054_r8 ! the baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) real(r8), parameter :: relhExp = 6.0999_r8 ! electron transport parameters related to relative humidity - real(r8), parameter :: Enzyme_turnover_daily = 0.1_r8 ! the daily turnover rate for photosynthetic enzyme at 25oC in view of ~7 days of half-life time for Rubisco (Suzuki et al. 2001) real(r8), parameter :: NMCp25 = 0.715_r8 ! estimated by assuming 80% maintenance respiration is used for photosynthesis enzyme maintenance real(r8), parameter :: Trange1 = 5.0_r8 ! lower temperature limit (oC) for nitrogen optimization real(r8), parameter :: Trange2 = 42.0_r8 ! upper temperature limit (oC) for nitrogen optimization @@ -177,6 +177,12 @@ subroutine readParams( ncid ) params_inst%kc25_coef = params_inst%kc25_coef * 1.e5_r8 ! from mol/mol to Luna units ! LUNA empirical curvature parameter for ac, aj photosynthesis co-limitation call readNcdioScalar(ncid, 'luna_theta_cj', subname, params_inst%luna_theta_cj) + ! The baseline proportion of nitrogen allocated for electron transport (J) + call readNcdioScalar(ncid, 'jmaxb0', subname, params_inst%jmaxb0) + ! The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (unitless) + call readNcdioScalar(ncid, 'wc2wjb0', subname, params_inst%wc2wjb0) + ! The daily turnover rate for photosynthetic enzyme at 25oC in view of ~7 days of half-life time for Rubisco (Suzuki et al. 2001) (unitless) + call readNcdioScalar(ncid, 'enzyme_turnover_daily', subname, params_inst%enzyme_turnover_daily) end subroutine readParams @@ -342,7 +348,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & !-------------------------------------------------------------------- !calculate the enzyme ternover rate EnzTurnoverTFactor = Q10Enz**(0.1_r8*(min(40.0_r8, tleaf10) - 25.0_r8)) - max_daily_pchg = EnzTurnoverTFactor * Enzyme_turnover_daily + max_daily_pchg = EnzTurnoverTFactor * params_inst%enzyme_turnover_daily !----------------------------------------------------------------- rabsorb = 1.0_r8-rhol(ft,1)-taul(ft,1) !Implemented the nitrogen allocation model @@ -405,7 +411,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & PNcbold = 0.0_r8 call NitrogenAllocation(FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, hourpd, & tair10, tleafd10, tleafn10, & - Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp, PNlcold, PNetold, PNrespold, & + Jmaxb1, relhExp, PNlcold, PNetold, PNrespold, & PNcbold, PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) vcmx25_opt= PNcbopt * FNCa * Fc25 jmx25_opt= PNetopt * FNCa * Fj25 @@ -793,7 +799,7 @@ end subroutine Clear24_Climate_LUNA !************************************************************************************************************************************************ !Use the LUNA model to calculate the Nitrogen partioning subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PARimx10,rb10, hourpd, tair10, tleafd10, tleafn10, & - Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp,& + Jmaxb1, relhExp,& PNlcold, PNetold, PNrespold, PNcbold, & PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) implicit none @@ -809,9 +815,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR real(r8), intent (in) :: tair10 !10-day running mean of the 2m temperature (oC) real(r8), intent (in) :: tleafd10 !10-day running mean of daytime leaf temperature (oC) real(r8), intent (in) :: tleafn10 !10-day running mean of nighttime leaf temperature (oC) - real(r8), intent (in) :: Jmaxb0 !baseline proportion of nitrogen allocated for electron transport rate (unitless) real(r8), intent (in) :: Jmaxb1 !coefficient determining the response of electron transport rate to light availability (unitless) - real(r8), intent (in) :: Wc2Wjb0 !the baseline ratio of rubisco-limited rate vs light-limited photosynthetic rate (Wc:Wj) real(r8), intent (in) :: relhExp !specifies the impact of relative humidity on electron transport rate (unitless) real(r8), intent (in) :: PNlcold !old value of the proportion of nitrogen allocated to light capture (unitless) real(r8), intent (in) :: PNetold !old value of the proportion of nitrogen allocated to electron transport (unitless) @@ -911,7 +915,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR call NUE(O2a10, ci, tair10, tleafd10c, NUEj, NUEc, Kj2Kc) call Nitrogen_investments (KcKjFlag,FNCa, Nlc, forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, tair10, & tleafd10c,tleafn10c, & - Kj2Kc, Wc2Wjb0, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref, NUEr, Kc, Kj, ci, & + Kj2Kc, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref, NUEr, Kc, Kj, ci, & Vcmax, Jmax,JmeanL,JmaxL, Net, Ncb, Nresp, PSN, RESP) Npsntarget = Nlc + Ncb + Net !target nitrogen allocated to photosynthesis, which may be lower or higher than Npsn_avail @@ -925,7 +929,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR KcKjFlag = 1 call Nitrogen_investments (KcKjFlag,FNCa, Nlc2, forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, & tair10, tleafd10c,tleafn10c, & - Kj2Kc, Wc2Wjb0, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref,NUEr, Kc, Kj, ci, & + Kj2Kc, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref,NUEr, Kc, Kj, ci, & Vcmax, Jmax,JmeanL,JmaxL, Net2, Ncb2, Nresp2, PSN2, RESP2) Npsntarget2 = Nlc2 + Ncb2 + Net2 @@ -953,7 +957,7 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR KcKjFlag = 1 call Nitrogen_investments (KcKjFlag,FNCa, Nlc1,forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, & tair10, tleafd10c,tleafn10c, & - Kj2Kc, Wc2Wjb0, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref,NUEr, Kc, Kj, ci,& + Kj2Kc, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref,NUEr, Kc, Kj, ci,& Vcmax, Jmax,JmeanL,JmaxL, Net1, Ncb1, Nresp1, PSN1, RESP1) Npsntarget1 = Nlc1 + Ncb1 + Net1 Carboncost1 = (Npsntarget - Npsntarget1) * NMCp25 * Cv * (RespTBernacchi(tleafd10c) * hourpd + & @@ -983,7 +987,7 @@ end subroutine NitrogenAllocation subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & CO2a10, O2a10, PARi10, PARimx10, rb10, hourpd, tair10, tleafd10, tleafn10, & - Kj2Kc, Wc2Wjb0, JmaxCoef, Fc, Fj, NUEc, NUEj, NUEcref, NUEjref, NUEr, Kc, & + Kj2Kc, JmaxCoef, Fc, Fj, NUEc, NUEj, NUEcref, NUEjref, NUEr, Kc, & Kj, ci, Vcmax, Jmax, JmeanL, JmaxL, Net, Ncb, Nresp, PSN, RESP) implicit none integer, intent (in) :: KcKjFlag !flag to indicate whether to update the Kc and Kj using the photosynthesis subroutine; 0--Kc and Kj need to be calculated; 1--Kc and Kj is prescribed. @@ -1001,7 +1005,6 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & real(r8), intent (in) :: tleafd10 !10-day mean daytime leaf temperature (oC) real(r8), intent (in) :: tleafn10 !10-day mean nighttime leaf temperature (oC) real(r8), intent (in) :: Kj2Kc !ratio: Kj / Kc - real(r8), intent (in) :: Wc2Wjb0 !the baseline ratio of rubisco-limited rate vs light-limited photosynthetic rate (Wc:Wj) real(r8), intent (in) :: JmaxCoef !coefficient determining the response of electron transport rate to light availability (unitless) and humidity real(r8), intent (in) :: Fc !the temperature adjustment factor for Vcmax real(r8), intent (in) :: Fj !the temperature adjustment factor for Jmax @@ -1037,11 +1040,11 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & theta = 0.292_r8 / (1.0_r8 + 0.076_r8 / (Nlc * Cb)) ELTRNabsorb = theta * PARi10 - Jmaxb0act = Jmaxb0 * FNCa * Fj + Jmaxb0act = params_inst%jmaxb0 * FNCa * Fj Jmax = Jmaxb0act + JmaxCoef * ELTRNabsorb JmaxL = theta * PARimx10 / (sqrt(1.0_r8 + (theta * PARimx10 / Jmax)**2.0_r8)) NUEchg = (NUEc / NUEcref) * (NUEjref / NUEj) - Wc2Wj = Wc2Wjb0 * (NUEchg**0.5_r8) + Wc2Wj = params_inst%wc2wjb0 * (NUEchg**0.5_r8) Wc2Wj = min(1.0_r8, Wc2Wj) Vcmax = Wc2Wj * JmaxL * Kj2Kc JmeanL = theta * PARi10 / (sqrt(1.0_r8 + (ELTRNabsorb / Jmax)**2.0_r8)) From 49c3b7914aa59e2beb1060a2beb97e794035d477 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Thu, 7 May 2020 16:57:15 -0600 Subject: [PATCH 0861/1973] try again correct conflicts with ctsm master --- bld/namelist_files/namelist_definition_ctsm.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index f98678562d..482680603c 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1953,8 +1953,7 @@ CLM run type. + valid_values="conus_30_x8,512x1024,360x720cru,128x256,64x128,48x96,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4,ne60np4,ne120np4,ne240np4,1km-merge-10min,C24,C48,C96,C192,C384"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min, 1km-merge-10min and 0.33x0.33 are only used for CLM toolsI From 411cd3f086de400693ab88caff9530ebea6fd16a Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Thu, 7 May 2020 17:07:08 -0600 Subject: [PATCH 0862/1973] cleanup for PR, remove duplicates and extraneous grids --- bld/namelist_files/namelist_defaults_ctsm.xml | 5 ----- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 58aabf712a..d49e4436b9 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -906,11 +906,6 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc - lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c179824.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 482680603c..5d142e4626 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1970,7 +1970,7 @@ hist means do NOT use a future scenario, just use historical data. + valid_values="USGS,gx3v7,gx1v6,gx1v7,navy,test,tx0.1v2,tx1v1,T62,cruncep,nldas2"> Land mask description From 0ffc79cc7b5f84ada1b514867fb46b6651370821 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 8 May 2020 17:31:41 -0600 Subject: [PATCH 0863/1973] Point to list of common problems in PR template --- .github/PULL_REQUEST_TEMPLATE.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 306ee7b1f3..4c8f6ca499 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,5 +16,7 @@ Testing performed, if any: (Documentation on system testing is here: https://github.com/ESCOMP/ctsm/wiki/System-Testing-Guide) (aux_clm on cheyenne for intel/gnu and izumi for intel/gnu/nag/pgi is the standard for tags on master) -**NOTE: Be sure to check your Coding style against the standard:** -https://github.com/ESCOMP/ctsm/wiki/CTSM-coding-guidelines +**NOTE: Be sure to check your coding style against the standard +(https://github.com/ESCOMP/ctsm/wiki/CTSM-coding-guidelines) and review +the list of common problems to watch out for +(https://github.com/ESCOMP/CTSM/wiki/List-of-common-problems).** From 1ebabc4e20843e71c8f65d749934e496cf92b757 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:53:01 -0700 Subject: [PATCH 0864/1973] Update doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst Co-authored-by: Danica Lombardozzi --- .../CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index 023344cbe6..0b06295c43 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -154,9 +154,8 @@ increasing litterfall rate throughout the offset period. The :math:`biofuel\_harvfrac` (:numref:`Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy crops`) is the harvested fraction of aboveground biomass (leaf & livestem) for bioenergy crops. It is only non-zero for prognostic crops. The special case for fluxes in the final litterfall timestep -(:math:`{t}_{offset}` = :math:`\Delta t`\ ) ensures that a fraction (:math:`1-biofuel\_harvfrac`) of the -displayed growth is sent to the litter pools for deciduous plant types, while the remaining fraction (:math:`biofuel\_harvfrac`) -of leaf biomass goes to the biofuel feedstock pools (Equation :eq:`25.9`). Modifications on livestem carbon pools for prognostic crops +(:math:`{t}_{offset}` = :math:`\Delta t`\ ) ensures that all of the displayed growth is sent to the litter pools or biofuel feedstock pools. The fraction (:math:`biofuel\_harvfrac`) of leaf biomass going to the biofuel feedstock pools (Equation :eq:`25.9`) is defined in Table 26.3 and is only non-zero for prognostic crops. The remaining fraction of leaf biomass (:math:`1-biofuel\_harvfrac`) for deciduous plant types is sent to the litter pools. +Similar modifications made for livestem carbon pools for prognostic crops can be found in section :numref:`Harvest to food and seed` in Equations :eq:`25.9`-:eq:`25.14`. Corresponding nitrogen fluxes during litterfall take into account retranslocation of nitrogen out of the displayed leaf pool prior to @@ -873,4 +872,3 @@ fractions used for carbon fluxes: :label: 20.97) NF_{froot,lit3} =\sum _{p=0}^{npfts}NF_{froot,litter} f_{lig\_ froot,p} wcol_{p} . - From 9f73dfb180fff874238996cb069aaeff0c90ca8a Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:55:24 -0700 Subject: [PATCH 0865/1973] Update doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst Co-authored-by: Danica Lombardozzi --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index e4ec4e1ab2..ce3679f4b3 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -128,7 +128,7 @@ Plantation areas of bioenergy crops are projected to expand throughout the 21st replace fossil fuels and mitigate climate change. Miscanthus and switchgrass are perennial bioenergy crops and have quite different physiological traits and land management practices than annual crops, such as longer growing seasons, higher productivity, and lower demands for nutrients and water. -About 70% of biofuel aboveground biomass (leaf & livestem) is removed at harvest for biofuels. Parameter values were developed by using +About 70% of biofuel aboveground biomass (leaf & livestem) is removed at harvest. Parameter values were developed by using observation data collected at the University of Illinois Energy Farm located in Central Midwestern United States (:ref:`Cheng et al., 2019`). @@ -945,4 +945,3 @@ river water storage is maintained above a specified threshold. temperate cereals (wheat, barley, and rye) (:ref:`Portmann et al. 2010 `), available online from *ftp://ftp.rz.uni-frankfurt.de/pub/uni-frankfurt/physische\_geographie/hydrologie/public/data/MIRCA2000/harvested\_area\_grids.* - From 4f40771108b0fff1e76762abf357b50dcc6b55e7 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:55:56 -0700 Subject: [PATCH 0866/1973] Update doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst Co-authored-by: Danica Lombardozzi --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index ce3679f4b3..10c51d31a6 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -366,7 +366,7 @@ Harvest occurs in one time step using the BGC leaf offset algorithm. .. table:: Crop phenology and morphology parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== ========================== ========================== - \ temperate corn spring wheat temperatue soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass + \ temperate corn spring wheat temperate soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== ========================== ========================== IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 71, 72 73, 74 :math:`Date_{planting}^{min}` April 1 April 1 May 1 April 1 Janurary 1 Janurary 1 March 20 April 15 April 1 April 1 From 7e31b643fe7ac8ce300e2ac19fbe5bc875539796 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:56:31 -0700 Subject: [PATCH 0867/1973] Update doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst Co-authored-by: Danica Lombardozzi --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 10c51d31a6..9809f9ec82 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -559,7 +559,7 @@ A fraction (determined by :math:`biofuel\_harvfrac`) of leaf/livestem C and N fr with the remaining portions going to the litter pools (Equations :eq:`20.14)`, :eq:`25.11`, and :eq:`25.14`). Putting live stem C and N into the litter and biofuel pools is in contrast to the approach for unmanaged PFTs which puts live stem C and N into dead stem pools first. -Leaf C and N pools are routed to the little and biofuel pools, contrast to that of unmanaged PFTs which put leaf C and N to litter pools only. +Leaf C and N pools are routed to the litter and biofuel pools, in contrast to that of unmanaged PFTs and non-biofuel crops, which put leaf C and N into litter pools only. Root C and N pools are routed to the litter pools in the same manner as natural vegetation. .. math:: From 9977b0a3ccd2608fc9daafede0b0137d18da19d6 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:56:57 -0700 Subject: [PATCH 0868/1973] Update doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst Co-authored-by: Danica Lombardozzi --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 9809f9ec82..6b6e8c8b33 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -554,7 +554,7 @@ Harvest '''''''''''''''''''''''''''''' Variables track the flow of grain C and N to food and of all other plant pools, including live stem C and N, to litter, and to biofuel feedstock. -A fraction (determined by :math:`biofuel\_harvfrac`) of leaf/livestem C and N from bioenergy crops is removed at harvest for biofuels +A fraction (determined by the :math:`biofuel\_harvfrac`, defined in Table 26.3) of leaf/livestem C and N from bioenergy crops is removed at harvest for biofuels (Equations :eq:`25.9`, :eq:`25.10`, :eq:`25.12`, and :eq:`25.13`), with the remaining portions going to the litter pools (Equations :eq:`20.14)`, :eq:`25.11`, and :eq:`25.14`). Putting live stem C and N into the litter and biofuel pools is in contrast to the approach for unmanaged PFTs which From 5d2106f4ecbda23fb529d0687ffee00d306b8f61 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:57:33 -0700 Subject: [PATCH 0869/1973] Update doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst Co-authored-by: Danica Lombardozzi --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 6b6e8c8b33..e214a6e8a6 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -662,7 +662,7 @@ NS is stored nitrogen, and :math:`biofuel\_harvfrac` is the harvested fraction o Whereas food C and N was formerly transferred to the litter pool, CLM5 routes food C and N to a grain product pool where the C and N decay to the atmosphere over one year, similar in structure to the wood product pools. -The biofuel C and N is also routed to the grain product pool and decay to the atmosphere over one year. +The biofuel C and N is also routed to the grain product pool and decays to the atmosphere over one year. Additionally, CLM5 accounts for the C and N required for crop seeding by removing the seed C and N from the grain product pool during harvest. The crop seed pool is then used to seed crops in the subsequent year. Calcuating the crop yields (Equation :eq:`25.15`) requires that you sum the GRAINC_TO_FOOD variable From 26293d117b146f22630392b569aad3283c77ba75 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:57:51 -0700 Subject: [PATCH 0870/1973] Update doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst Co-authored-by: Danica Lombardozzi --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index e214a6e8a6..6a476e72f9 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -682,7 +682,7 @@ efficiency of 85%. .. table:: Crop allocation parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. =========================================== ============== ============ ================== ====== ====== ========= ============= ================ ================ ================ - \ temperate corn spring wheat temperatue soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass + \ temperate corn spring wheat temperate soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass =========================================== ============== ============ ================== ====== ====== ========= ============= ================ ================ ================ IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 71, 72 73, 74 :math:`a_{leaf}^{i}` 0.6 0.9 0.85 0.85 0.75 0.6 0.6 0.85 0.9 0.7 From ed0489c8c0e8097518de945cb2ba5d4c61dc49d8 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:58:11 -0700 Subject: [PATCH 0871/1973] Update doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst Co-authored-by: Danica Lombardozzi --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 6a476e72f9..2d9f4c4679 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -758,8 +758,8 @@ The values for both of these fields come from the LUMIP time series for each yea In addition to the industrial fertilizer, background manure fertilizer is specified on the parameter file by the field 'manunitro'. For perennial bioenergy crops, little fertilizer (56kg/ha/yr) is applied to switchgrass, no fertilizer is applied to Miscanthus. -Note this set up is only based on local land management practice at the University of Illinois Energy Farm -located in Central Midwestern United States :ref:`(Cheng et al., 2019)`. For the current CLM5BGCCROP, +Note these rates only based on local land management practice at the University of Illinois Energy Farm +located in Central Midwestern United States :ref:`(Cheng et al., 2019)` rather than the LUMIP timeseries. For the current CLM5BGCCROP, manure N is applied at a rate of 0.002 kg N/m\ :sup:`2`/yr. Because previous versions of CLM (e.g., CLM4) had rapid denitrification rates, fertilizer is applied slowly to minimize N loss (primarily through denitrification) and maximize plant uptake. From d30cb5d49d159b714b8fcf8fa835fb6643991768 Mon Sep 17 00:00:00 2001 From: YanyanCheng <40185802+yanyanchengHydro@users.noreply.github.com> Date: Sat, 9 May 2020 16:58:29 -0700 Subject: [PATCH 0872/1973] Update doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst Co-authored-by: Danica Lombardozzi --- .../tech_note/Introduction/CLM50_Tech_Note_Introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst index 5969e4a2d1..face74629b 100644 --- a/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst +++ b/doc/source/tech_note/Introduction/CLM50_Tech_Note_Introduction.rst @@ -528,7 +528,7 @@ Representation of human management of the land (agriculture, wood harvest) is au The CLM4.5 crop model is extended to operate globally through the addition of rice, sugarcane, tropical varieties of corn and soybean :ref:`(Badger and Dirmeyer, 2015` and :ref:`Levis et al., 2016)`, and perennial bioenergy crops :ref:`(Cheng et al., 2019)`. -These crop types are added to the existing temperate corn, temperature soybean, spring wheat, and cotton crop types. +These crop types are added to the existing temperate corn, temperate soybean, spring wheat, and cotton crop types. Fertilization rates and irrigation equipped area updated annually based on crop type and geographic region through an input dataset. The irrigation trigger is updated. Additional minor changes include crop phenological triggers that vary by latitude for selected crop types, grain C and N is now removed at harvest to a 1-year product pool with From 7c315ad9e0636005b067bf7acc7270764e0fef74 Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Sat, 9 May 2020 16:59:30 -0700 Subject: [PATCH 0873/1973] modify Vegetation_Phenology_Turnover --- .../CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst index 023344cbe6..4480dbec6e 100644 --- a/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst +++ b/doc/source/tech_note/Vegetation_Phenology_Turnover/CLM50_Tech_Note_Vegetation_Phenology_Turnover.rst @@ -151,8 +151,8 @@ periods as: where superscripts *n* and *n-1* refer to fluxes on the current and previous timesteps, respectively. The rate coefficient :math:`{r}_{xfer\_off}` varies with time to produce a linearly increasing litterfall rate throughout the offset period. -The :math:`biofuel\_harvfrac` (:numref:`Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy crops`) -is the harvested fraction of aboveground biomass (leaf & livestem) for bioenergy crops. It is only non-zero for prognostic crops. +The :math:`biofuel\_harvfrac` (:numref:`Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy production`) +is the harvested fraction of aboveground biomass (leaf & livestem) for bioenergy crops. The special case for fluxes in the final litterfall timestep (:math:`{t}_{offset}` = :math:`\Delta t`\ ) ensures that a fraction (:math:`1-biofuel\_harvfrac`) of the displayed growth is sent to the litter pools for deciduous plant types, while the remaining fraction (:math:`biofuel\_harvfrac`) From 1df2dd5dcfc3882cc481225136fc535283343b8b Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Sat, 9 May 2020 18:26:14 -0700 Subject: [PATCH 0874/1973] update tech note --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 2d9f4c4679..6b6a40b259 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -366,7 +366,7 @@ Harvest occurs in one time step using the BGC leaf offset algorithm. .. table:: Crop phenology and morphology parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== ========================== ========================== - \ temperate corn spring wheat temperate soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass + \ temperate corn spring wheat temperate soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass =================================== ========================= ========================== ========================== ========================== ========================== ========================= ========================= ========================== ========================== ========================== IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 71, 72 73, 74 :math:`Date_{planting}^{min}` April 1 April 1 May 1 April 1 Janurary 1 Janurary 1 March 20 April 15 April 1 April 1 @@ -554,7 +554,8 @@ Harvest '''''''''''''''''''''''''''''' Variables track the flow of grain C and N to food and of all other plant pools, including live stem C and N, to litter, and to biofuel feedstock. -A fraction (determined by the :math:`biofuel\_harvfrac`, defined in Table 26.3) of leaf/livestem C and N from bioenergy crops is removed at harvest for biofuels +A fraction (determined by the :math:`biofuel\_harvfrac`, defined in +:numref:`Table Plant functional type (PFT) parameters for harvested fraction of leaf/livestem for bioenergy production`) of leaf/livestem C and N from bioenergy crops is removed at harvest for biofuels (Equations :eq:`25.9`, :eq:`25.10`, :eq:`25.12`, and :eq:`25.13`), with the remaining portions going to the litter pools (Equations :eq:`20.14)`, :eq:`25.11`, and :eq:`25.14`). Putting live stem C and N into the litter and biofuel pools is in contrast to the approach for unmanaged PFTs which @@ -682,7 +683,7 @@ efficiency of 85%. .. table:: Crop allocation parameters for the active crop plant functional types (pfts) in CLM5BGCCROP. Numbers in the first row correspond to the list of pfts in :numref:`Table Crop plant functional types`. =========================================== ============== ============ ================== ====== ====== ========= ============= ================ ================ ================ - \ temperate corn spring wheat temperate soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass + \ temperate corn spring wheat temperate soybean cotton rice sugarcane tropical corn tropical soybean miscanthus switchgrass =========================================== ============== ============ ================== ====== ====== ========= ============= ================ ================ ================ IVT 17, 18 19, 20 23, 24 41, 42 61, 62 67, 68 75, 76 77, 78 71, 72 73, 74 :math:`a_{leaf}^{i}` 0.6 0.9 0.85 0.85 0.75 0.6 0.6 0.85 0.9 0.7 @@ -719,7 +720,7 @@ Physical Crop Characteristics '''''''''''''''''''''''''''''' Leaf area index (*L*) is calculated as a function of specific leaf area (SLA, :numref:`Table Crop phenology parameters`) and leaf C. -Stem area index (*S*) is equal to 0.1\ *L* for temperate and tropical corn and sugarcane and 0.2\ *L* for +Stem area index (*S*) is equal to 0.1\ *L* for temperate and tropical corn, sugarcane, and perennial bioenergy crops and 0.2\ *L* for other crops, as in AgroIBIS. All live C and N pools go to 0 after crop harvest, but the *S* is kept at 0.25 to simulate a post-harvest “stubble” on the ground. From 6100ac1f7124b832a774346922d578a1a0bf90cd Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Mon, 11 May 2020 11:00:07 -0700 Subject: [PATCH 0875/1973] update tech note --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 6b6a40b259..c6d55a2fc0 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -720,7 +720,7 @@ Physical Crop Characteristics '''''''''''''''''''''''''''''' Leaf area index (*L*) is calculated as a function of specific leaf area (SLA, :numref:`Table Crop phenology parameters`) and leaf C. -Stem area index (*S*) is equal to 0.1\ *L* for temperate and tropical corn, sugarcane, and perennial bioenergy crops and 0.2\ *L* for +Stem area index (*S*) is equal to 0.1\ *L* for temperate and tropical corn, sugarcane, switchgrass, and miscanthus and 0.2\ *L* for other crops, as in AgroIBIS. All live C and N pools go to 0 after crop harvest, but the *S* is kept at 0.25 to simulate a post-harvest “stubble” on the ground. From 41e859f969f35d9f134702ffa1d386907360dacd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 11 May 2020 16:49:24 -0600 Subject: [PATCH 0876/1973] Add a template file for config_compilers.xml --- .../config_compilers_template.xml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 lilac_config/build_templates/config_compilers_template.xml diff --git a/lilac_config/build_templates/config_compilers_template.xml b/lilac_config/build_templates/config_compilers_template.xml new file mode 100644 index 0000000000..9fc3358408 --- /dev/null +++ b/lilac_config/build_templates/config_compilers_template.xml @@ -0,0 +1,44 @@ + + + + + + + + + + $GPTL_CPPDEFS + + + $NETCDF_PATH + + + $PIO_FILESYSTEM_HINTS + + + $PNETCDF_PATH + + $ESMF_LIBDIR + + + $EXTRA_CFLAGS + + + + $EXTRA_FFLAGS + + + + + From b446473a19624e4705a4a7e8b1a6372fa26a047d Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 13 May 2020 10:14:29 -0600 Subject: [PATCH 0877/1973] Third round of moving parameters to param file. BFB according to following tests: ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput Parameters moved: relhExp minrelh wimp ssi drift_gs eta0_anderson (was eta0 in OverburdenCompactionAnderson1976) eta0_vionnet (was eta0 in OverburdenCompactionVionnet2012) n_baseflow perched_baseflow_scalar (was hardcoded 1.e-5 in SoilHydrologyMod) tkd_sand (was hardcoded 8.8 in SoilStateInitTimeConstMod) tkd_clay (was hardcoded 2.92 in SoilStateInitTimeConstMod) tkd_om (was om_tkd in SoilStateInitTimeConstMod) tkm_om (was om_tkm in SoilStateInitTimeConstMod) pd (was hardcoded 2.7e3 in SoilStateInitTimeConstMod) csol_om (was om_csol in SoilStateInitTimeConstMod) csol_sand (was hardcoded 2.128 in SoilStateInitTimeConstMod) csol_clay (was hardcoded 2.385 in SoilStateInitTimeConstMod) e_ice --- src/biogeophys/HydrologyDrainageMod.F90 | 2 +- src/biogeophys/HydrologyNoDrainageMod.F90 | 2 +- .../InfiltrationExcessRunoffMod.F90 | 31 +++++++- src/biogeophys/LunaMod.F90 | 24 +++--- src/biogeophys/SnowHydrologyMod.F90 | 56 +++++++++++--- src/biogeophys/SoilHydrologyMod.F90 | 30 +++++--- src/biogeophys/SoilStateInitTimeConstMod.F90 | 73 +++++++++++++++---- src/biogeophys/SoilWaterMovementMod.F90 | 49 ++++++++++--- src/biogeophys/SurfaceWaterMod.F90 | 2 +- src/main/clm_varcon.F90 | 3 - src/main/readParamsMod.F90 | 8 ++ 11 files changed, 214 insertions(+), 66 deletions(-) diff --git a/src/biogeophys/HydrologyDrainageMod.F90 b/src/biogeophys/HydrologyDrainageMod.F90 index 8c85cccdd4..93d77cebf6 100644 --- a/src/biogeophys/HydrologyDrainageMod.F90 +++ b/src/biogeophys/HydrologyDrainageMod.F90 @@ -8,7 +8,7 @@ module HydrologyDrainageMod use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use clm_varctl , only : iulog, use_vichydro - use clm_varcon , only : e_ice, denh2o, denice, rpi, spval + use clm_varcon , only : denh2o, denice, rpi, spval use atm2lndType , only : atm2lnd_type use glc2lndMod , only : glc2lnd_type use SoilHydrologyType , only : soilhydrology_type diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index 8e1105ece0..2596f7e5b0 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -8,7 +8,7 @@ Module HydrologyNoDrainageMod use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use clm_varctl , only : iulog, use_vichydro, use_fates - use clm_varcon , only : e_ice, denh2o, denice, rpi, spval + use clm_varcon , only : denh2o, denice, rpi, spval use CLMFatesInterfaceMod, only : hlm_fates_interface_type use atm2lndType , only : atm2lnd_type use AerosolMod , only : aerosol_type diff --git a/src/biogeophys/InfiltrationExcessRunoffMod.F90 b/src/biogeophys/InfiltrationExcessRunoffMod.F90 index 11cf5b5bcc..fff6a799ab 100644 --- a/src/biogeophys/InfiltrationExcessRunoffMod.F90 +++ b/src/biogeophys/InfiltrationExcessRunoffMod.F90 @@ -11,7 +11,7 @@ module InfiltrationExcessRunoffMod use decompMod , only : bounds_type use abortutils , only : endrun use clm_varctl , only : iulog, use_vichydro - use clm_varcon , only : spval, e_ice + use clm_varcon , only : spval use SoilHydrologyType, only : soilhydrology_type use SoilStateType , only : soilstate_type use SaturatedExcessRunoffMod, only : saturated_excess_runoff_type @@ -24,6 +24,13 @@ module InfiltrationExcessRunoffMod ! !PUBLIC TYPES: + public :: readParams + + type, private :: params_type + real(r8) :: e_ice ! Soil ice impedance factor (unitless) + end type params_type + type(params_type), private :: params_inst + type, public :: infiltration_excess_runoff_type private ! Public data members @@ -70,6 +77,26 @@ module InfiltrationExcessRunoffMod ! Infrastructure routines ! ======================================================================== + !----------------------------------------------------------------------- + subroutine readParams( ncid ) + ! + ! !USES: + use ncdio_pio, only: file_desc_t + use paramUtilMod, only: readNcdioScalar + ! + ! !ARGUMENTS: + implicit none + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=*), parameter :: subname = 'readParams_InfiltrationExcessRunoff' + !-------------------------------------------------------------------- + + ! Soil ice impedance factor (unitless) + call readNcdioScalar(ncid, 'e_ice', subname, params_inst%e_ice) + + end subroutine readParams + !----------------------------------------------------------------------- subroutine Init(this, bounds) ! @@ -269,7 +296,7 @@ subroutine ComputeQinmaxHksat(bounds, num_hydrologyc, filter_hydrologyc, & do fc = 1, num_hydrologyc c = filter_hydrologyc(fc) - qinmax_on_unsaturated_area(c) = minval(10._r8**(-e_ice*(icefrac(c,1:3)))*hksat(c,1:3)) + qinmax_on_unsaturated_area(c) = minval(10._r8**(-params_inst%e_ice*(icefrac(c,1:3)))*hksat(c,1:3)) end do end associate diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 2d84e7e097..c234ef86fe 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -39,10 +39,10 @@ module LunaMod public :: Acc24_Climate_LUNA !subroutine to accumulate 24 hr climates public :: Acc240_Climate_LUNA !subroutine to accumulate 10 day climates public :: Clear24_Climate_LUNA !subroutine to clear 24 hr climates - public :: readParams + public :: readParams ! Read in parameters on parameter file type, private :: params_type -! cp25, kc25, ko25: Bernacchi et al (2001) Plant, Cell & Environment 24:253-259 + ! cp25, kc25, ko25: Bernacchi et al (2001) Plant, Cell & Environment 24:253-259 real(r8) :: cp25_yr2000 ! CO2 compensation point at 25°C at present day O2 (mol/mol) real(r8) :: kc25_coef ! Michaelis-Menten const. at 25°C for CO2 (unitless) real(r8) :: ko25_coef ! Michaelis-Menten const. at 25°C for O2 (unitless) @@ -50,6 +50,8 @@ module LunaMod real(r8) :: jmaxb0 ! The baseline proportion of nitrogen allocated for electron transport (J) real(r8) :: wc2wjb0 ! The baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) (unitless) real(r8) :: enzyme_turnover_daily ! The daily turnover rate for photosynthetic enzyme at 25oC in view of ~7 days of half-life time for Rubisco (Suzuki et al. 2001) (unitless) + real(r8) :: relhExp ! Specifies the impact of relative humidity on electron transport rate (unitless) + real(r8) :: minrelh ! Minimum relative humidity for nitrogen optimization (fraction) end type params_type type(params_type), private :: params_inst @@ -77,14 +79,12 @@ module LunaMod real(r8), parameter :: forc_pbot_ref = 101325.0_r8 ! reference air pressure for calculation of reference NUE real(r8), parameter :: Q10Enz = 2.0_r8 ! Q10 value for enzyme decay rate real(r8) :: Jmaxb1 = 0.1_r8 ! the baseline proportion of nitrogen allocated for electron transport (J) - real(r8), parameter :: relhExp = 6.0999_r8 ! electron transport parameters related to relative humidity real(r8), parameter :: NMCp25 = 0.715_r8 ! estimated by assuming 80% maintenance respiration is used for photosynthesis enzyme maintenance real(r8), parameter :: Trange1 = 5.0_r8 ! lower temperature limit (oC) for nitrogen optimization real(r8), parameter :: Trange2 = 42.0_r8 ! upper temperature limit (oC) for nitrogen optimization real(r8), parameter :: SNC = 0.004_r8 ! structural nitrogen concentration (g N g-1 dry mass carbon) real(r8), parameter :: mp = 9.0_r8 ! slope of stomatal conductance; this is used to estimate model parameter, but may need to be updated from the physiology file, real(r8), parameter :: PARLowLim = 200.0_r8 ! minimum photosynthetically active radiation for nitrogen optimization - real(r8), parameter :: minrelh = 0.25_r8 ! minimum relative humdity for nitrogen optimization character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -183,6 +183,10 @@ subroutine readParams( ncid ) call readNcdioScalar(ncid, 'wc2wjb0', subname, params_inst%wc2wjb0) ! The daily turnover rate for photosynthetic enzyme at 25oC in view of ~7 days of half-life time for Rubisco (Suzuki et al. 2001) (unitless) call readNcdioScalar(ncid, 'enzyme_turnover_daily', subname, params_inst%enzyme_turnover_daily) + ! Specifies the impact of relative humidity on electron transport rate (unitless) + call readNcdioScalar(ncid, 'relhExp', subname, params_inst%relhExp) + ! Minimum relative humidity for nitrogen optimization (fraction) + call readNcdioScalar(ncid, 'minrelh', subname, params_inst%minrelh) end subroutine readParams @@ -411,7 +415,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & PNcbold = 0.0_r8 call NitrogenAllocation(FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, hourpd, & tair10, tleafd10, tleafn10, & - Jmaxb1, relhExp, PNlcold, PNetold, PNrespold, & + Jmaxb1, PNlcold, PNetold, PNrespold, & PNcbold, PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) vcmx25_opt= PNcbopt * FNCa * Fc25 jmx25_opt= PNetopt * FNCa * Fj25 @@ -799,8 +803,7 @@ end subroutine Clear24_Climate_LUNA !************************************************************************************************************************************************ !Use the LUNA model to calculate the Nitrogen partioning subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PARimx10,rb10, hourpd, tair10, tleafd10, tleafn10, & - Jmaxb1, relhExp,& - PNlcold, PNetold, PNrespold, PNcbold, & + Jmaxb1, PNlcold, PNetold, PNrespold, PNcbold, & PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) implicit none real(r8), intent (in) :: FNCa !Area based functional nitrogen content (g N/m2 leaf) @@ -816,7 +819,6 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR real(r8), intent (in) :: tleafd10 !10-day running mean of daytime leaf temperature (oC) real(r8), intent (in) :: tleafn10 !10-day running mean of nighttime leaf temperature (oC) real(r8), intent (in) :: Jmaxb1 !coefficient determining the response of electron transport rate to light availability (unitless) - real(r8), intent (in) :: relhExp !specifies the impact of relative humidity on electron transport rate (unitless) real(r8), intent (in) :: PNlcold !old value of the proportion of nitrogen allocated to light capture (unitless) real(r8), intent (in) :: PNetold !old value of the proportion of nitrogen allocated to electron transport (unitless) real(r8), intent (in) :: PNrespold !old value of the proportion of nitrogen allocated to respiration (unitless) @@ -902,8 +904,8 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR tleafd10c = min(max(tleafd10, Trange1), Trange2) !constrain the physiological range tleafn10c = min(max(tleafn10, Trange1), Trange2) !constrain the physiological range ci = 0.7_r8 * CO2a10 - JmaxCoef = Jmaxb1 * ((hourpd / 12.0_r8)**2.0_r8) * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & - (1.0_r8 - minrelh))) + JmaxCoef = Jmaxb1 * ((hourpd / 12.0_r8)**2.0_r8) * (1.0_r8 - exp(-params_inst%relhExp * max(relh10 - & + params_inst%minrelh, 0.0_r8) / (1.0_r8 - params_inst%minrelh))) do while (PNlcoldi .NE. PNlc .and. jj < 100) Fc = VcmxTKattge(tair10, tleafd10c) * Fc25 Fj = JmxTKattge(tair10, tleafd10c) * Fj25 @@ -1123,7 +1125,7 @@ subroutine Photosynthesis_luna(forc_pbot, tleafd, relh, CO2a,O2a, rb, Vcmax, Jme tleaf = tleafd tleafk = tleaf + tfrz aquad = 1.0_r8 - relhc = max(minrelh, relh) + relhc = max(params_inst%minrelh, relh) bbb = 1.0_r8 / bp mbb = mp CO2c = CO2a diff --git a/src/biogeophys/SnowHydrologyMod.F90 b/src/biogeophys/SnowHydrologyMod.F90 index 8266c170bd..1f65728da8 100644 --- a/src/biogeophys/SnowHydrologyMod.F90 +++ b/src/biogeophys/SnowHydrologyMod.F90 @@ -23,7 +23,7 @@ module SnowHydrologyMod use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use clm_varpar , only : nlevsno, nlevsoi, nlevgrnd use clm_varctl , only : iulog, use_subgrid_fluxes - use clm_varcon , only : namec, h2osno_max, hfus, denh2o, denice, rpi, spval, tfrz, wimp, ssi + use clm_varcon , only : namec, h2osno_max, hfus, denh2o, denice, rpi, spval, tfrz use clm_varcon , only : cpice, cpliq use atm2lndType , only : atm2lnd_type use AerosolMod , only : aerosol_type, AerosolFluxes @@ -63,10 +63,21 @@ module SnowHydrologyMod public :: BuildSnowFilter ! Construct snow/no-snow filters public :: SnowCapping ! Remove snow mass for capped columns public :: NewSnowBulkDensity ! Compute bulk density of any newly-fallen snow + public :: readParams ! Read in parameters on parameter file ! The following are public just for the sake of unit testing: public :: SnowCappingExcess ! Determine the excess snow that needs to be capped public :: SnowHydrologySetControlForTesting ! Set some of the control settings + + type, private :: params_type + real(r8) :: wimp ! Water impremeable if porosity less than wimp (unitless) + real(r8) :: ssi ! Irreducible water saturation of snow (unitless) + real(r8) :: drift_gs ! Wind drift compaction / grain size (fixed value for now) (unitless) + real(r8) :: eta0_anderson ! Viscosity coefficent from Anderson1976 (kg*s/m2) + real(r8) :: eta0_vionnet ! Viscosity coefficent from Vionnet2012 (kg*s/m2) + end type params_type + type(params_type), private :: params_inst + ! ! !PRIVATE MEMBER FUNCTIONS: private :: BulkDiag_NewSnowDiagnostics ! Update various snow-related diagnostic quantities to account for new snow @@ -269,6 +280,34 @@ subroutine SnowHydrology_readnl( NLFilename) end subroutine SnowHydrology_readnl + !---------------------------------------------------------------------------- + subroutine readParams( ncid ) + ! + ! !USES: + use ncdio_pio, only: file_desc_t + use paramUtilMod, only: readNcdioScalar + ! + ! !ARGUMENTS: + implicit none + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=*), parameter :: subname = 'readParams_SnowHydrology' + !-------------------------------------------------------------------- + + ! Water impremeable if porosity less than wimp (unitless) + call readNcdioScalar(ncid, 'wimp', subname, params_inst%wimp) + ! Irreducible water saturation of snow (unitless) + call readNcdioScalar(ncid, 'ssi', subname, params_inst%ssi) + ! Wind drift compaction / grain size (fixed value for now) (unitless) + call readNcdioScalar(ncid, 'drift_gs', subname, params_inst%drift_gs) + ! Viscosity coefficent from Anderson1976 (kg*s/m2) + call readNcdioScalar(ncid, 'eta0_anderson', subname, params_inst%eta0_anderson) + ! Viscosity coefficent from Vionnet2012 (kg*s/m2) + call readNcdioScalar(ncid, 'eta0_vionnet', subname, params_inst%eta0_vionnet) + + end subroutine readParams + !----------------------------------------------------------------------- subroutine UpdateQuantitiesForNewSnow(bounds, num_c, filter_c, & scf_method, atm2lnd_inst, water_inst) @@ -1280,18 +1319,18 @@ subroutine BulkFlux_SnowPercolation(bounds, num_snowc, filter_snowc, & if (j >= snl(c)+1) then if (j <= -1) then ! No runoff over snow surface, just ponding on surface - if (eff_porosity(c,j) < wimp .OR. eff_porosity(c,j+1) < wimp) then + if (eff_porosity(c,j) < params_inst%wimp .OR. eff_porosity(c,j+1) < params_inst%wimp) then qflx_snow_percolation(c,j) = 0._r8 else ! dz must be scaled by frac_sno to obtain gridcell average value qflx_snow_percolation(c,j) = max(0._r8,(vol_liq(c,j) & - - ssi*eff_porosity(c,j))*dz(c,j)*frac_sno_eff(c)) + - params_inst%ssi*eff_porosity(c,j))*dz(c,j)*frac_sno_eff(c)) qflx_snow_percolation(c,j) = min(qflx_snow_percolation(c,j),(1._r8-vol_ice(c,j+1) & - vol_liq(c,j+1))*dz(c,j+1)*frac_sno_eff(c)) end if else qflx_snow_percolation(c,j) = max(0._r8,(vol_liq(c,j) & - - ssi*eff_porosity(c,j))*dz(c,j)*frac_sno_eff(c)) + - params_inst%ssi*eff_porosity(c,j))*dz(c,j)*frac_sno_eff(c)) end if qflx_snow_percolation(c,j) = (qflx_snow_percolation(c,j)*1000._r8)/dtime end if @@ -3686,12 +3725,11 @@ pure function OverburdenCompactionAnderson1976(burden, wx, td, bi) & ! ! !LOCAL VARIABLES: real(r8), parameter :: c2 = 23.e-3_r8 ! [m3/kg] - real(r8), parameter :: eta0 = 9.e+5_r8 ! The Viscosity Coefficient Eta0 [kg-s/m2] character(len=*), parameter :: subname = 'OverburdenCompactionAnderson1976' !----------------------------------------------------------------------- - compaction_rate = -(burden+wx/2._r8)*exp(-overburden_compress_Tfactor*td - c2*bi)/eta0 + compaction_rate = -(burden+wx/2._r8)*exp(-overburden_compress_Tfactor*td - c2*bi)/params_inst%eta0_anderson end function OverburdenCompactionAnderson1976 @@ -3726,14 +3764,13 @@ function OverburdenCompactionVionnet2012(h2osoi_liq, dz, burden, wx, td, bi) & real(r8), parameter :: ceta = 450._r8 ! overburden compaction constant [kg/m3] real(r8), parameter :: aeta = 0.1_r8 ! overburden compaction constant [1/K] real(r8), parameter :: beta = 0.023_r8 ! overburden compaction constant [m3/kg] - real(r8), parameter :: eta0 = 7.62237e6_r8 ! The Viscosity Coefficient Eta0 [kg-s/m2] character(len=*), parameter :: subname = 'OverburdenCompactionVionnet2012' !----------------------------------------------------------------------- f1 = 1._r8 / (1._r8 + 60._r8 * h2osoi_liq / (denh2o * dz)) f2 = 4.0_r8 ! currently fixed to maximum value, holds in absence of angular grains - eta = f1*f2*(bi/ceta)*exp(aeta*td + beta*bi)*eta0 + eta = f1*f2*(bi/ceta)*exp(aeta*td + beta*bi)*params_inst%eta0_vionnet compaction_rate = -(burden+wx/2._r8) / eta end function OverburdenCompactionVionnet2012 @@ -3773,7 +3810,6 @@ subroutine WindDriftCompaction(bi, forc_wind, dz, & real(r8), parameter :: rho_min = 50._r8 ! wind drift compaction / minimum density [kg/m3] real(r8), parameter :: rho_max = 350._r8 ! wind drift compaction / maximum density [kg/m3] - real(r8), parameter :: drift_gs = 0.35e-3_r8 ! wind drift compaction / grain size (fixed value for now) real(r8), parameter :: drift_sph = 1.0_r8 ! wind drift compaction / sphericity real(r8), parameter :: tau_ref = 48._r8 * 3600._r8 ! wind drift compaction / reference time [s] @@ -3783,7 +3819,7 @@ subroutine WindDriftCompaction(bi, forc_wind, dz, & if (mobile) then Frho = 1.25_r8 - 0.0042_r8*(max(rho_min, bi)-rho_min) ! assuming dendricity = 0, sphericity = 1, grain size = 0.35 mm Non-dendritic snow - MO = 0.34_r8 * (-0.583_r8*drift_gs - 0.833_r8*drift_sph + 0.833_r8) + 0.66_r8*Frho + MO = 0.34_r8 * (-0.583_r8*params_inst%drift_gs - 0.833_r8*drift_sph + 0.833_r8) + 0.66_r8*Frho SI = -2.868_r8 * exp(-0.085_r8*forc_wind) + 1._r8 + MO if (SI > 0.0_r8) then diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 index 9db9ada7be..436b35e1cf 100644 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ b/src/biogeophys/SoilHydrologyMod.F90 @@ -10,7 +10,7 @@ module SoilHydrologyMod use abortutils , only : endrun use decompMod , only : bounds_type use clm_varctl , only : iulog, use_vichydro - use clm_varcon , only : e_ice, denh2o, denice, rpi + use clm_varcon , only : denh2o, denice, rpi use clm_varcon , only : pondmx_urban use clm_varpar , only : nlevsoi, nlevgrnd, nlayer, nlayert use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall @@ -57,7 +57,10 @@ module SoilHydrologyMod public :: readParams type, private :: params_type - real(r8) :: aq_sp_yield_min ! Minimum aquifer specific yield (unitless) + real(r8) :: aq_sp_yield_min ! Minimum aquifer specific yield (unitless) + real(r8) :: n_baseflow ! Drainage power law exponent (unitless) + real(r8) :: perched_baseflow_scalar ! Scalar multiplier for perched base flow rate (kg/m2/s) + real(r8) :: e_ice ! Soil ice impedance factor (unitless) end type params_type type(params_type), private :: params_inst @@ -86,6 +89,12 @@ subroutine readParams( ncid ) ! Minimum aquifer specific yield (unitless) call readNcdioScalar(ncid, 'aq_sp_yield_min', subname, params_inst%aq_sp_yield_min) + ! Drainage power law exponent (unitless) + call readNcdioScalar(ncid, 'n_baseflow', subname, params_inst%n_baseflow) + ! Scalar multiplier for perched base flow rate (kg/m2/s) + call readNcdioScalar(ncid, 'perched_baseflow_scalar', subname, params_inst%perched_baseflow_scalar) + ! Soil ice impedance factor (unitless) + call readNcdioScalar(ncid, 'e_ice', subname, params_inst%e_ice) end subroutine readParams @@ -1050,7 +1059,7 @@ subroutine Drainage(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filte c = filter_hydrologyc(fc) ! specify maximum drainage rate - q_perch_max = 1.e-5_r8 * sin(col%topo_slope(c) * (rpi/180._r8)) + q_perch_max = params_inst%perched_baseflow_scalar * sin(col%topo_slope(c) * (rpi/180._r8)) ! if layer containing water table is frozen, compute the following: ! frost table, perched water table, and drainage from perched saturated layer @@ -1084,7 +1093,7 @@ subroutine Drainage(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filte wtsub = 0._r8 q_perch = 0._r8 do k = jwt(c)+1, k_frz - imped=10._r8**(-e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) + imped=10._r8**(-params_inst%e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) q_perch = q_perch + imped*hksat(c,k)*dzmm(c,k) wtsub = wtsub + dzmm(c,k) end do @@ -1160,7 +1169,7 @@ subroutine Drainage(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filte wtsub = 0._r8 q_perch = 0._r8 do k = k_perch, k_frz - imped=10._r8**(-e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) + imped=10._r8**(-params_inst%e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) q_perch = q_perch + imped*hksat(c,k)*dzmm(c,k) wtsub = wtsub + dzmm(c,k) end do @@ -1218,11 +1227,11 @@ subroutine Drainage(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filte end if else if (use_vichydro) then - imped=10._r8**(-e_ice*min(1.0_r8,ice(c,nlayer)/max_moist(c,nlayer))) + imped=10._r8**(-params_inst%e_ice*min(1.0_r8,ice(c,nlayer)/max_moist(c,nlayer))) dsmax_tmp(c) = Dsmax(c) * dtime/ secspday !mm/day->mm/dtime rsub_top_max = dsmax_tmp(c) else - imped=10._r8**(-e_ice*(icefracsum/dzsum)) + imped=10._r8**(-params_inst%e_ice*(icefracsum/dzsum)) rsub_top_max = 10._r8 * sin((rpi/180.) * col%topo_slope(c)) end if endif @@ -1787,7 +1796,7 @@ subroutine PerchedLateralFlow(bounds, num_hydrologyc, filter_hydrologyc, & wtsub = 0._r8 q_perch = 0._r8 do k = k_perch, k_frz - imped=10._r8**(-e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) + imped=10._r8**(-params_inst%e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) q_perch = q_perch + imped*hksat(c,k)*dzmm(c,k) wtsub = wtsub + dzmm(c,k) end do @@ -1994,7 +2003,6 @@ subroutine LateralFlowPowerLaw(bounds, num_hydrologyc, filter_hydrologyc, & real(r8) :: rel_moist ! relative moisture, temporary variable real(r8) :: wtsub_vic ! summation of hk*dzmm for layers in the third VIC layer integer :: g - real(r8), parameter :: n_baseflow = 1 !drainage power law exponent !----------------------------------------------------------------------- associate( & @@ -2091,12 +2099,12 @@ subroutine LateralFlowPowerLaw(bounds, num_hydrologyc, filter_hydrologyc, & dzsum = dzsum + dzmm(c,j) icefracsum = icefracsum + icefrac(c,j) * dzmm(c,j) end do - imped=10._r8**(-e_ice*(icefracsum/dzsum)) + imped=10._r8**(-params_inst%e_ice*(icefracsum/dzsum)) !@@ ! baseflow is power law expression relative to bedrock layer if(zwt(c) <= zi(c,nbedrock(c))) then rsub_top(c) = imped * baseflow_scalar * tan(rpi/180._r8*col%topo_slope(c))* & - (zi(c,nbedrock(c)) - zwt(c))**(n_baseflow) + (zi(c,nbedrock(c)) - zwt(c))**(params_inst%n_baseflow) else rsub_top(c) = 0._r8 endif diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 index 5d2c0cd011..5993d0f62b 100644 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ b/src/biogeophys/SoilStateInitTimeConstMod.F90 @@ -16,6 +16,7 @@ module SoilStateInitTimeConstMod ! ! !PUBLIC MEMBER FUNCTIONS: public :: SoilStateInitTimeConst + public :: readParams ! ! !PRIVATE MEMBER FUNCTIONS: private :: ReadNL @@ -24,6 +25,17 @@ module SoilStateInitTimeConstMod real(r8), public :: organic_max ! organic matter (kg/m3) where soil is assumed to act like peat ! !PRIVATE DATA: + type, private :: params_type + real(r8) :: tkd_sand ! Thermal conductivity of sand (W/m/K) + real(r8) :: tkd_clay ! Thermal conductivity of clay (W/m/K) + real(r8) :: tkd_om ! Thermal conductivity of dry organic matter (Farouki, 1981) (W/m/K) + real(r8) :: tkm_om ! Thermal conductivity of organic matter (Farouki, 1986) (W/m/K) + real(r8) :: pd ! Particle density of soil (kg/m3) + real(r8) :: csol_clay ! Heat capacity of clay *10^6 (J/K/m3) + real(r8) :: csol_om ! Heat capacity of peat soil *10^6 (Farouki, 1986) (J/K/m3) + real(r8) :: csol_sand ! Heat capacity of sand *10^6 (J/K/m3) + end type params_type + type(params_type), private :: params_inst ! Control variables (from namelist) logical, private :: organic_frac_squared ! If organic fraction should be squared (as in CLM4.5) @@ -88,6 +100,40 @@ subroutine ReadNL( nlfilename ) end subroutine ReadNL + !----------------------------------------------------------------------- + subroutine readParams( ncid ) + ! + ! !USES: + use ncdio_pio, only: file_desc_t + use paramUtilMod, only: readNcdioScalar + ! + ! !ARGUMENTS: + implicit none + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=*), parameter :: subname = 'readParams_SoilStateInitTimeConst' + !-------------------------------------------------------------------- + + ! Thermal conductivity of sand (W/m/K) + call readNcdioScalar(ncid, 'tkd_sand', subname, params_inst%tkd_sand) + ! Thermal conductivity of clay (W/m/K) + call readNcdioScalar(ncid, 'tkd_clay', subname, params_inst%tkd_clay) + ! Thermal conductivity of dry organic matter (Farouki, 1981) (W/m/K) + call readNcdioScalar(ncid, 'tkd_om', subname, params_inst%tkd_om) + ! Thermal conductivity of organic matter (Farouki, 1986) (W/m/K) + call readNcdioScalar(ncid, 'tkm_om', subname, params_inst%tkm_om) + ! Particle density of soil (kg/m3) + call readNcdioScalar(ncid, 'pd', subname, params_inst%pd) + ! Heat capacity of clay *10^6 (J/K/m3) + call readNcdioScalar(ncid, 'csol_clay', subname, params_inst%csol_clay) + ! Heat capacity of peat soil *10^6 (Farouki, 1986) (J/K/m3) + call readNcdioScalar(ncid, 'csol_om', subname, params_inst%csol_om) + ! Heat capacity of sand *10^6 (J/K/m3) + call readNcdioScalar(ncid, 'csol_sand', subname, params_inst%csol_sand) + + end subroutine readParams + !----------------------------------------------------------------------- subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) ! @@ -121,7 +167,6 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) ! !LOCAL VARIABLES: integer :: p, lev, c, l, g, j ! indices real(r8) :: om_frac ! organic matter fraction - real(r8) :: om_tkm = 0.25_r8 ! thermal conductivity of organic soil (Farouki, 1986) [W/m/K] real(r8) :: om_watsat_lake = 0.9_r8 ! porosity of organic soil real(r8) :: om_hksat_lake = 0.1_r8 ! saturated hydraulic conductivity of organic soil [mm/s] real(r8) :: om_sucsat_lake = 10.3_r8 ! saturated suction for organic matter (Letts, 2000) @@ -129,8 +174,6 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) real(r8) :: om_watsat ! porosity of organic soil real(r8) :: om_hksat ! saturated hydraulic conductivity of organic soil [mm/s] real(r8) :: om_sucsat ! saturated suction for organic matter (mm)(Letts, 2000) - real(r8) :: om_csol = 2.5_r8 ! heat capacity of peat soil *10^6 (J/K m3) (Farouki, 1986) - real(r8) :: om_tkd = 0.05_r8 ! thermal conductivity of dry organic soil (Farouki, 1981) real(r8) :: om_b ! Clapp Hornberger paramater for oragnic soil (Letts, 2000) real(r8) :: zsapric = 0.5_r8 ! depth (m) that organic matter takes on characteristics of sapric peat real(r8) :: pcalpha = 0.5_r8 ! percolation threshold @@ -444,9 +487,10 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) om_sucsat = min(10.3_r8 - 0.2_r8 *(zsoi(lev)/zsapric), 10.1_r8) om_hksat = max(0.28_r8 - 0.2799_r8*(zsoi(lev)/zsapric), xksat) - soilstate_inst%bd_col(c,lev) = (1._r8 - soilstate_inst%watsat_col(c,lev))*2.7e3_r8 + soilstate_inst%bd_col(c,lev) = (1._r8 - soilstate_inst%watsat_col(c,lev))*params_inst%pd soilstate_inst%watsat_col(c,lev) = (1._r8 - om_frac) * soilstate_inst%watsat_col(c,lev) + om_watsat*om_frac - tkm = (1._r8-om_frac) * (8.80_r8*sand+2.92_r8*clay)/(sand+clay)+om_tkm*om_frac ! W/(m K) + tkm = (1._r8-om_frac) * (params_inst%tkd_sand*sand+params_inst%tkd_clay*clay)/ & + (sand+clay)+params_inst%tkm_om*om_frac ! W/(m K) soilstate_inst%bsw_col(c,lev) = (1._r8-om_frac) * (2.91_r8 + 0.159_r8*clay) + om_frac*om_b soilstate_inst%sucsat_col(c,lev) = (1._r8-om_frac) * soilstate_inst%sucsat_col(c,lev) + om_sucsat*om_frac soilstate_inst%hksat_min_col(c,lev) = xksat @@ -476,10 +520,10 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) soilstate_inst%tksatu_col(c,lev) = soilstate_inst%tkmg_col(c,lev)*0.57_r8**soilstate_inst%watsat_col(c,lev) soilstate_inst%tkdry_col(c,lev) = ((0.135_r8*soilstate_inst%bd_col(c,lev) + 64.7_r8) / & - (2.7e3_r8 - 0.947_r8*soilstate_inst%bd_col(c,lev)))*(1._r8-om_frac) + om_tkd*om_frac + (params_inst%pd - 0.947_r8*soilstate_inst%bd_col(c,lev)))*(1._r8-om_frac) + params_inst%tkd_om*om_frac - soilstate_inst%csol_col(c,lev) = ((1._r8-om_frac)*(2.128_r8*sand+2.385_r8*clay) / (sand+clay) + & - om_csol*om_frac)*1.e6_r8 ! J/(m3 K) + soilstate_inst%csol_col(c,lev) = ((1._r8-om_frac)*(params_inst%csol_sand*sand+ & + params_inst%csol_clay*clay) / (sand+clay) + params_inst%csol_om*om_frac)*1.e6_r8 ! J/(m3 K) soilstate_inst%watdry_col(c,lev) = soilstate_inst%watsat_col(c,lev) * & (316230._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) @@ -539,11 +583,12 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) soilstate_inst%sucsat_col(c,lev) = 10._r8 * ( 10._r8**(1.88_r8-0.0131_r8*sand) ) - bd = (1._r8-soilstate_inst%watsat_col(c,lev))*2.7e3_r8 + bd = (1._r8-soilstate_inst%watsat_col(c,lev))*params_inst%pd soilstate_inst%watsat_col(c,lev) = (1._r8 - om_frac)*soilstate_inst%watsat_col(c,lev) + om_watsat_lake * om_frac - tkm = (1._r8-om_frac)*(8.80_r8*sand+2.92_r8*clay)/(sand+clay) + om_tkm * om_frac ! W/(m K) + tkm = (1._r8-om_frac)*(params_inst%tkd_sand*sand+params_inst%tkd_clay*clay)/(sand+clay) + & + params_inst%tkm_om * om_frac ! W/(m K) soilstate_inst%bsw_col(c,lev) = (1._r8-om_frac)*(2.91_r8 + 0.159_r8*clay) + om_frac * om_b_lake @@ -573,10 +618,10 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) soilstate_inst%hksat_col(c,lev) = uncon_frac*uncon_hksat + (perc_frac*om_frac)*om_hksat_lake soilstate_inst%tkmg_col(c,lev) = tkm ** (1._r8- soilstate_inst%watsat_col(c,lev)) soilstate_inst%tksatu_col(c,lev) = soilstate_inst%tkmg_col(c,lev)*0.57_r8**soilstate_inst%watsat_col(c,lev) - soilstate_inst%tkdry_col(c,lev) = ((0.135_r8*bd + 64.7_r8) / (2.7e3_r8 - 0.947_r8*bd))*(1._r8-om_frac) + & - om_tkd * om_frac - soilstate_inst%csol_col(c,lev) = ((1._r8-om_frac)*(2.128_r8*sand+2.385_r8*clay) / (sand+clay) + & - om_csol * om_frac)*1.e6_r8 ! J/(m3 K) + soilstate_inst%tkdry_col(c,lev) = ((0.135_r8*bd + 64.7_r8) / (params_inst%pd - 0.947_r8*bd))*(1._r8-om_frac) + & + params_inst%tkd_om * om_frac + soilstate_inst%csol_col(c,lev) = ((1._r8-om_frac)*(params_inst%csol_sand*sand+ & + params_inst%csol_clay*clay) / (sand+clay) + params_inst%csol_om * om_frac)*1.e6_r8 ! J/(m3 K) soilstate_inst%watdry_col(c,lev) = soilstate_inst%watsat_col(c,lev) & * (316230._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) soilstate_inst%watopt_col(c,lev) = soilstate_inst%watsat_col(c,lev) & diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 index 8c408c9659..14538aa377 100644 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ b/src/biogeophys/SoilWaterMovementMod.F90 @@ -8,7 +8,7 @@ module SoilWaterMovementMod ! ! created by Jinyun Tang, Mar 12, 2014 use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush + use shr_sys_mod , only : shr_sys_flush ! implicit none @@ -17,6 +17,7 @@ module SoilWaterMovementMod ! !PUBLIC MEMBER FUNCTIONS: public :: SoilWater ! Calculate soil hydrology public :: init_soilwater_movement + public :: readParams private :: soilwater_zengdecker2009 private :: soilwater_moisture_form ! private :: soilwater_mixed_form @@ -28,6 +29,11 @@ module SoilWaterMovementMod private :: compute_qcharge private :: IceImpedance private :: TridiagonalCol + + type, private :: params_type + real(r8) :: e_ice ! Soil ice impedance factor (unitless) + end type params_type + type(params_type), private :: params_inst ! ! The following is only public for the sake of unit testing; it should not be called ! directly by CLM code outside this module @@ -79,6 +85,27 @@ module SoilWaterMovementMod contains !#1 + !----------------------------------------------------------------------- + subroutine readParams( ncid ) + ! + ! !USES: + use ncdio_pio, only: file_desc_t + use paramUtilMod, only: readNcdioScalar + ! + ! !ARGUMENTS: + implicit none + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=*), parameter :: subname = 'readParams_SoilWaterMovement' + !-------------------------------------------------------------------- + + ! Soil ice impedance factor (unitless) + call readNcdioScalar(ncid, 'e_ice', subname, params_inst%e_ice) + + end subroutine readParams + +!#2 !----------------------------------------------------------------------- subroutine init_soilwater_movement() ! @@ -189,7 +216,7 @@ subroutine init_soilwater_movement() end subroutine init_soilwater_movement -!#2 +!#3 !------------------------------------------------------------------------------ function use_aquifer_layer() result(lres) ! @@ -208,7 +235,7 @@ function use_aquifer_layer() result(lres) end function use_aquifer_layer -!#3 +!#4 !----------------------------------------------------------------------- subroutine SoilWater(bounds, num_hydrologyc, filter_hydrologyc, & num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & @@ -455,8 +482,8 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & use shr_kind_mod , only : r8 => shr_kind_r8 use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G use decompMod , only : bounds_type - use clm_varcon , only : wimp,grav,hfus,tfrz - use clm_varcon , only : e_ice,denh2o, denice + use clm_varcon , only : grav,hfus,tfrz + use clm_varcon , only : denh2o, denice use clm_varpar , only : nlevsoi, max_patch_per_col, nlevgrnd use clm_time_manager , only : get_step_size_real, get_nstep use column_varcon , only : icol_roof, icol_road_imperv @@ -706,7 +733,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & if (origflag == 1) then imped(c,j)=(1._r8-0.5_r8*(fracice(c,j)+fracice(c,min(nlevsoi, j+1)))) else - imped(c,j)=10._r8**(-e_ice*(0.5_r8*(icefrac(c,j)+icefrac(c,min(nlevsoi, j+1))))) + imped(c,j)=10._r8**(-params_inst%e_ice*(0.5_r8*(icefrac(c,j)+icefrac(c,min(nlevsoi, j+1))))) endif hk(c,j) = imped(c,j)*s1*s2 dhkdw(c,j) = imped(c,j)*(2._r8*bsw(c,j)+3._r8)*s2* & @@ -1433,7 +1460,6 @@ subroutine compute_hydraulic_properties(c, nlayers, & use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G use abortutils , only : endrun use decompMod , only : bounds_type - use clm_varcon , only : e_ice use clm_varpar , only : nlevsoi use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type use SoilStateType , only : soilstate_type @@ -1497,10 +1523,10 @@ subroutine compute_hydraulic_properties(c, nlayers, & ! s1 is interface value, s2 is node value if(j==nlayers)then s1 = s2(j) - call IceImpedance(icefrac(c,j), e_ice, imped(j) ) + call IceImpedance(icefrac(c,j), imped(j) ) else s1 = 0.5_r8 * (s2(j) + s2(j+1)) - call IceImpedance(0.5_r8*(icefrac(c,j) + icefrac(c,j+1)), e_ice, imped(j) ) + call IceImpedance(0.5_r8*(icefrac(c,j) + icefrac(c,j+1)), imped(j) ) endif ! impose constraints on relative saturation at the layer interface @@ -2117,7 +2143,7 @@ end subroutine compute_qcharge !#13 !----------------------------------------------------------------------- - subroutine IceImpedance(icefrac, e_ice, imped) + subroutine IceImpedance(icefrac, imped) ! !DESCRIPTION ! compute soil suction potential @@ -2129,7 +2155,6 @@ subroutine IceImpedance(icefrac, e_ice, imped) ! !ARGUMENTS: implicit none real(r8), intent(in) :: icefrac !fraction of pore space filled with ice - real(r8), intent(in) :: e_ice !shape parameter real(r8), intent(out) :: imped !hydraulic conductivity reduction due to the presence of ice in pore space ! @@ -2137,7 +2162,7 @@ subroutine IceImpedance(icefrac, e_ice, imped) character(len=32) :: subname = 'IceImpedance' ! subroutine name !------------------------------------------------------------------------------ - imped = 10._r8**(-e_ice*icefrac) + imped = 10._r8**(-params_inst%e_ice*icefrac) end subroutine IceImpedance diff --git a/src/biogeophys/SurfaceWaterMod.F90 b/src/biogeophys/SurfaceWaterMod.F90 index a6b8fede17..069e14d393 100644 --- a/src/biogeophys/SurfaceWaterMod.F90 +++ b/src/biogeophys/SurfaceWaterMod.F90 @@ -9,7 +9,7 @@ module SurfaceWaterMod use shr_kind_mod , only : r8 => shr_kind_r8 use shr_const_mod , only : shr_const_pi use shr_spfn_mod , only : erf => shr_spfn_erf - use clm_varcon , only : denh2o, denice, roverg, wimp, tfrz, pc, mu, rpi + use clm_varcon , only : denh2o, denice, roverg, tfrz, pc, mu, rpi use clm_varpar , only : nlevsno, nlevgrnd use clm_time_manager , only : get_step_size_real use column_varcon , only : icol_roof, icol_road_imperv, icol_sunwall, icol_shadewall, icol_road_perv diff --git a/src/main/clm_varcon.F90 b/src/main/clm_varcon.F90 index da4f2c114c..bf4beaec7d 100644 --- a/src/main/clm_varcon.F90 +++ b/src/main/clm_varcon.F90 @@ -44,7 +44,6 @@ module clm_varcon ! Initialize physical constants !------------------------------------------------------------------ - real(r8), public, parameter :: e_ice=6.0 ! soil ice impedance factor real(r8), public, parameter :: pc = 0.4 ! threshold probability real(r8), public, parameter :: mu = 0.13889 ! connectivity exponent real(r8), public, parameter :: secsphr = 3600._r8 ! Seconds in an hour @@ -113,8 +112,6 @@ module clm_varcon real(r8), public :: capr = 0.34_r8 ! Tuning factor to turn first layer T into surface T real(r8), public :: cnfac = 0.5_r8 ! Crank Nicholson factor between 0 and 1 - real(r8), public :: ssi = 0.033_r8 ! Irreducible water saturation of snow - real(r8), public :: wimp = 0.05_r8 ! Water impremeable if porosity less than wimp real(r8), public :: pondmx = 0.0_r8 ! Ponding depth (mm) real(r8), public :: pondmx_urban = 1.0_r8 ! Ponding depth for urban roof and impervious road (mm) diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index 06cb48ffdc..ab31aa403c 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -46,9 +46,13 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) use CanopyFluxesMod , only : readParams_CanopyFluxes => readParams use CanopyHydrologyMod , only : readParams_CanopyHydrology => readParams use SoilHydrologyMod , only : readParams_SoilHydrology => readParams + use SoilStateInitTimeConstMod , only : readParams_SoilStateInitTimeConst => readParams + use SoilWaterMovementMod , only : readParams_SoilWaterMovement => readParams use SaturatedExcessRunoffMod , only : readParams_SaturatedExcessRunoff => readParams + use InfiltrationExcessRunoffMod , only : readParams_InfiltrationExcessRunoff => readParams use SurfaceResistanceMod , only : readParams_SurfaceResistance => readParams use WaterDiagnosticBulkType , only : readParams_WaterDiagnosticBulk => readParams + use SnowHydrologyMod , only : readParams_SnowHydrology => readParams use NutrientCompetitionMethodMod , only : nutrient_competition_method_type use clm_varctl, only : NLFilename_in use PhotosynthesisMod , only : photosyns_type @@ -112,9 +116,13 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) call readParams_CanopyFluxes ( ncid ) call readParams_CanopyHydrology ( ncid ) call readParams_SoilHydrology ( ncid ) + call readParams_SoilStateInitTimeConst ( ncid ) call readParams_SaturatedExcessRunoff ( ncid ) + call readParams_SoilWaterMovement ( ncid ) + call readParams_InfiltrationExcessRunoff ( ncid ) call readParams_SurfaceResistance ( ncid ) call readParams_WaterDiagnosticBulk ( ncid ) + call readParams_SnowHydrology (ncid) ! call ncd_pio_closefile(ncid) From 328f38cd17a9a3f7193e1c1d0998e5704c41ad53 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 13 May 2020 13:00:16 -0600 Subject: [PATCH 0878/1973] No longer need 'from __future__ import print_function' --- run_sys_tests | 2 -- 1 file changed, 2 deletions(-) diff --git a/run_sys_tests b/run_sys_tests index 6963e99d8a..bccf6f00e1 100755 --- a/run_sys_tests +++ b/run_sys_tests @@ -1,8 +1,6 @@ #!/usr/bin/env python """Driver for running CTSM system tests""" -from __future__ import print_function - import os import sys From d86e6699a0df504037790dc8d5d6f699b5384578 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 13 May 2020 16:27:34 -0600 Subject: [PATCH 0879/1973] Refactor conditional to avoid divide by 0 Addresses ESCOMP/ctsm#1013 (but I'm not sure if it is a fix for every problem related to that issue) --- src/biogeochem/ch4Mod.F90 | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/biogeochem/ch4Mod.F90 b/src/biogeochem/ch4Mod.F90 index 97ebc98778..8e90f730d4 100644 --- a/src/biogeochem/ch4Mod.F90 +++ b/src/biogeochem/ch4Mod.F90 @@ -3550,17 +3550,18 @@ subroutine ch4_tran (bounds, & end if ! Now add new h2osfc form - if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8 .and. t_h2osfc(c) >= tfrz) then - t_soisno_c = t_h2osfc(c) - tfrz - ponddiff = (d_con_w(s,1) + d_con_w(s,2)*t_soisno_c + d_con_w(s,3)*t_soisno_c**2) * 1.e-9_r8 & - * scale_factor_liqdiff - pondz = h2osfc(c) / 1000._r8 / frac_h2osfc(c) ! Assume all h2osfc corresponds to sat area - ! mm / mm/m - pondres = pondres + pondz / ponddiff - else if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8 .and. & - h2osfc(c)/frac_h2osfc(c) > capthick) then ! Assuming short-circuit logic will avoid FPE here. - ! assume surface ice is impermeable - pondres = 1/smallnumber + if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8) then + if (t_h2osfc(c) >= tfrz) then + t_soisno_c = t_h2osfc(c) - tfrz + ponddiff = (d_con_w(s,1) + d_con_w(s,2)*t_soisno_c + d_con_w(s,3)*t_soisno_c**2) * 1.e-9_r8 & + * scale_factor_liqdiff + pondz = h2osfc(c) / 1000._r8 / frac_h2osfc(c) ! Assume all h2osfc corresponds to sat area + ! mm / mm/m + pondres = pondres + pondz / ponddiff + else if (h2osfc(c)/frac_h2osfc(c) > capthick) then + ! assume surface ice is impermeable + pondres = 1/smallnumber + end if end if spec_grnd_cond(c,s) = 1._r8/(1._r8/grnd_ch4_cond(c) + snowres(c) + pondres) From 636f18bf43bc750b0da3f371d2bb6d47f3020017 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 14 May 2020 10:11:49 -0600 Subject: [PATCH 0880/1973] Remove some FATES coordinate variables that were writing garbage Some of the FATES coordinate variables written to history files were trying to write unallocated arrays, causing some crashes with the latest cime. This has been fixed more robustly on fates_next_api, but for now I'm just removing these garbage coordinate variables. This is a temporary workaround for ESCOMP/ctsm#1014 --- src/main/histFileMod.F90 | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index f403b1c663..5737ebfc3a 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2624,20 +2624,6 @@ subroutine htape_timeconst(t, mode) long_name='FATES pft map into patch age x pft', units='-', ncid=nfid(t)) call ncd_defvar(varname='fates_agmap_levagepft', xtype=ncd_int, dim1name='fates_levagepft', & long_name='FATES age-class map into patch age x pft', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_levelem',xtype=ncd_int, dim1name='fates_levelem', & - long_name='FATES element (C,N,P,...) identifier', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_elmap_levelpft', xtype=ncd_int, dim1name='fates_levelpft', & - long_name='FATES element map into element x pft ', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_pftmap_levelpft', xtype=ncd_int, dim1name='fates_levelpft', & - long_name='FATES pft map into element x pft', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_elmap_levelcwd', xtype=ncd_int, dim1name='fates_levelcwd', & - long_name='FATES element map into element x cwd', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_cwdmap_levelcwd', xtype=ncd_int, dim1name='fates_levelcwd', & - long_name='FATES cwd map into element x cwd', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_elmap_levelage', xtype=ncd_int, dim1name='fates_levelage', & - long_name='FATES element map into age x pft', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_agemap_levelage', xtype=ncd_int, dim1name='fates_levelage', & - long_name='FATES element map into age x pft', units='-', ncid=nfid(t)) end if @@ -2674,13 +2660,6 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='fates_pftmap_levscagpft',data=fates_hdim_pftmap_levscagpft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levagepft',data=fates_hdim_pftmap_levagepft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_agmap_levagepft',data=fates_hdim_agmap_levagepft, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_levelem',data=fates_hdim_levelem, ncid=nfid(t),flag='write') - call ncd_io(varname='fates_elmap_levelpft',data=fates_hdim_elmap_levelpft, ncid=nfid(t),flag='write') - call ncd_io(varname='fates_pftmap_levelpft',data=fates_hdim_pftmap_levelpft, ncid=nfid(t),flag='write') - call ncd_io(varname='fates_elmap_levelcwd',data=fates_hdim_elmap_levelcwd, ncid=nfid(t),flag='write') - call ncd_io(varname='fates_cwdmap_levelcwd',data=fates_hdim_cwdmap_levelcwd, ncid=nfid(t),flag='write') - call ncd_io(varname='fates_elmap_levelage',data=fates_hdim_elmap_levelage, ncid=nfid(t),flag='write') - call ncd_io(varname='fates_agemap_levelage',data=fates_hdim_agemap_levelage, ncid=nfid(t),flag='write') end if endif From 4b69e7b430a3f03096fee2dd3f81268f7e9b0c01 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 14 May 2020 10:19:07 -0600 Subject: [PATCH 0881/1973] Squashed 'manage_externals/' changes from fde04e4d..c33a3bd2 c33a3bd2 Merge pull request #139 from jedwards4b/ignore_branch_prop b124a9af ignore this silently, we use a hash so it does not matter git-subtree-dir: manage_externals git-subtree-split: c33a3bd2a856dec33febf7f3fda30a4b0b9af608 --- manic/externals_description.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manic/externals_description.py b/manic/externals_description.py index b0c4f736a7..bd644c9814 100644 --- a/manic/externals_description.py +++ b/manic/externals_description.py @@ -180,6 +180,9 @@ def parse_submodules_desc_section(section_items, file_path): path = item[1].strip() elif name == 'url': url = item[1].strip() + elif name == 'branch': + # We do not care about branch since we have a hash - silently ignore + pass else: msg = 'WARNING: Ignoring unknown {} property, in {}' msg = msg.format(item[0], file_path) # fool pylint From 4cf7dddf849ce55cab1dec31f60b74d542f88fd1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 14 May 2020 11:00:49 -0600 Subject: [PATCH 0882/1973] Update cime to cesm2_2_beta05 version --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 0a0f4d24e9..993d5c505d 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.19 +tag = cime5.8.23 externals = ../Externals_cime.cfg required = True From e55f7451187539b529cd80ec851a251fb592ada1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 14 May 2020 13:29:31 -0600 Subject: [PATCH 0883/1973] Point to latest version of cmeps Mariana says that, in order to run with threads, some component changes are needed. However, she thinks that those aren't needed for running single-threaded. --- Externals_cime.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 4751386a44..46cd24b7d2 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,5 +1,5 @@ [cmeps] -hash = 253f612acae07b2b1dc73c84f1bb30b8e1b86ddd +hash = 386e1631a6a1e1900700c3a04d693df8692c9420 protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ From 99f1b6e10b60f89875b8240d0829485b3413015d Mon Sep 17 00:00:00 2001 From: yanyanchengHydro Date: Thu, 14 May 2020 14:37:08 -0700 Subject: [PATCH 0884/1973] update tech note --- .../Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index c6d55a2fc0..6fb9da4c55 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -560,7 +560,7 @@ A fraction (determined by the :math:`biofuel\_harvfrac`, defined in with the remaining portions going to the litter pools (Equations :eq:`20.14)`, :eq:`25.11`, and :eq:`25.14`). Putting live stem C and N into the litter and biofuel pools is in contrast to the approach for unmanaged PFTs which puts live stem C and N into dead stem pools first. -Leaf C and N pools are routed to the litter and biofuel pools, in contrast to that of unmanaged PFTs and non-biofuel crops, which put leaf C and N into litter pools only. +Biofuel crop leaf C and N pools are routed to the litter and biofuel pools, in contrast to that of unmanaged PFTs and non-biofuel crops, which put leaf C and N into litter pools only. Root C and N pools are routed to the litter pools in the same manner as natural vegetation. .. math:: @@ -759,7 +759,7 @@ The values for both of these fields come from the LUMIP time series for each yea In addition to the industrial fertilizer, background manure fertilizer is specified on the parameter file by the field 'manunitro'. For perennial bioenergy crops, little fertilizer (56kg/ha/yr) is applied to switchgrass, no fertilizer is applied to Miscanthus. -Note these rates only based on local land management practice at the University of Illinois Energy Farm +Note these rates are only based on local land management practices at the University of Illinois Energy Farm located in Central Midwestern United States :ref:`(Cheng et al., 2019)` rather than the LUMIP timeseries. For the current CLM5BGCCROP, manure N is applied at a rate of 0.002 kg N/m\ :sup:`2`/yr. Because previous versions of CLM (e.g., CLM4) had rapid denitrification rates, fertilizer is applied slowly From d03e25c10485e7e87ff24dcecdb3d83dd0403d8a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 15 May 2020 13:50:32 -0600 Subject: [PATCH 0885/1973] Update ChangeLog --- doc/ChangeLog | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 107 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 983563f718..1371d6bd48 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,110 @@ =============================================================== +Tag name: ctsm1.0.dev094 +Originator(s): sacks (Bill Sacks) +Date: Fri May 15 13:41:01 MDT 2020 +One-line Summary: Minor bug fixes needed for latest cime + +Purpose of changes +------------------ + +(1) Refactor a conditional to avoid divide by 0 (ESCOMP/CTSM#1013) + +(2) Remove some FATES coordinate variables that were writing garbage + (temporary workaround for ESCOMP/CTSM#1014) + +(3) Minor update to manage_externals + +(4) Document authorship in README.md and .zenodo.json + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1013 +- Workaround for ESCOMP/CTSM#1014, but doesn't properly resolve that issue + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not checked; none expected + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/1006 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev093 Originator(s): erik (Erik Kluzek) Date: Fri May 1 22:27:16 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 6285bf6bc9..e9a72423ec 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev094 sacks 05/15/2020 Minor bug fixes needed for latest cime ctsm1.0.dev093 erik 05/01/2020 Bring in changes from release-clm5.0 branch to master release-clm5.0.30 erik 01/21/2020 Update FATES to sci.1.30.0_api.8.0.0 release-clm5.0.29 erik 11/19/2019 Some answer changes needed for prescribed soil-moisture and clm4_5 defaults (1850-ndep, and urbantv settings) From dcaad375d62ee8b853d12ca062025439f69093aa Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 15 May 2020 15:02:14 -0600 Subject: [PATCH 0886/1973] Point to a cime branch This reverts to using pio1 in all cases, rather than using pio2 for mpi-serial cases. --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 993d5c505d..27b3ae710f 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.23 +tag = branch_tags/cime5.8.23_a01 externals = ../Externals_cime.cfg required = True From 285359ac4f312f76fb99f4b80f6c7574968eb687 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 18 May 2020 13:59:40 -0600 Subject: [PATCH 0887/1973] Revisions (part 4) --- src/biogeochem/CNBalanceCheckMod.F90 | 44 +++++++++++++++----------- src/biogeochem/CNVegCarbonFluxType.F90 | 7 ---- src/biogeochem/CNVegetationFacade.F90 | 1 + 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 index 78e9c1325e..ec3588d295 100644 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ b/src/biogeochem/CNBalanceCheckMod.F90 @@ -86,7 +86,7 @@ subroutine InitAllocate(this, bounds) end subroutine InitAllocate !----------------------------------------------------------------------- - subroutine BeginCNGridcellBalance(this, bounds, & + subroutine BeginCNGridcellBalance(this, bounds, cnveg_carbonflux_inst, & cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & c_products_inst, n_products_inst) ! @@ -102,6 +102,7 @@ subroutine BeginCNGridcellBalance(this, bounds, & ! !ARGUMENTS: class(cn_balance_type) , intent(inout) :: this type(bounds_type) , intent(in) :: bounds + type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst type(cn_products_type) , intent(in) :: c_products_inst @@ -110,6 +111,8 @@ subroutine BeginCNGridcellBalance(this, bounds, & ! !LOCAL VARIABLES: integer :: g integer :: begg, endg + real(r8) :: hrv_xsmrpool_amount_left_to_dribble(bounds%begg:bounds%endg) + real(r8) :: dwt_conv_cflux_amount_left_to_dribble(bounds%begg:bounds%endg) !----------------------------------------------------------------------- associate( & @@ -125,8 +128,15 @@ subroutine BeginCNGridcellBalance(this, bounds, & begg = bounds%begg; endg = bounds%endg + call cnveg_carbonflux_inst%hrv_xsmrpool_to_atm_dribbler%get_amount_left_to_dribble_beg( & + bounds, hrv_xsmrpool_amount_left_to_dribble(bounds%begg:bounds%endg)) + call cnveg_carbonflux_inst%dwt_conv_cflux_dribbler%get_amount_left_to_dribble_beg( & + bounds, dwt_conv_cflux_amount_left_to_dribble(bounds%begg:bounds%endg)) + do g = begg, endg - begcb(g) = totc(g) + c_tot_woodprod(g) + c_cropprod1(g) + begcb(g) = totc(g) + c_tot_woodprod(g) + c_cropprod1(g) + & + hrv_xsmrpool_amount_left_to_dribble(g) + & + dwt_conv_cflux_amount_left_to_dribble(g) begnb(g) = totn(g) + n_tot_woodprod(g) + n_cropprod1(g) end do @@ -205,6 +215,8 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8) :: col_errcb(bounds%begc:bounds%endc) real(r8) :: grc_errcb(bounds%begg:bounds%endg) real(r8) :: som_c_leached_grc(bounds%begg:bounds%endg) + real(r8) :: hrv_xsmrpool_amount_left_to_dribble(bounds%begg:bounds%endg) + real(r8) :: dwt_conv_cflux_amount_left_to_dribble(bounds%begg:bounds%endg) !----------------------------------------------------------------------- associate( & @@ -310,16 +322,22 @@ subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & err_found = .false. do g = bounds%begg, bounds%endg ! calculate gridcell-level carbon storage for mass conservation check - ! slevis notes: + ! Notes: ! totgrcc = totcolc = totc_p2c_col(c) + soilbiogeochem_cwdc_col(c) + soilbiogeochem_totlitc_col(c) + soilbiogeochem_totsomc_col(c) + soilbiogeochem_ctrunc_col(c) ! totc_p2c_col = totc_patch = totvegc_patch(p) + xsmrpool_patch(p) + ctrunc_patch(p) + cropseedc_deficit_patch(p) - ! slevis: Not including seedc_grc in grc_begcb and grc_endcb because + ! Not including seedc_grc in grc_begcb and grc_endcb because ! seedc_grc forms out of thin air, for now, and equals ! -1 * (dwt_seedc_to_leaf_grc(g) + dwt_seedc_to_deadstem_grc(g)) ! We account for the latter fluxes as inputs below; the same ! fluxes have entered the pools earlier in the timestep. For true ! conservation we would need to add a flux out of npp into seed. - grc_endcb(g) = totgrcc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) + call cnveg_carbonflux_inst%hrv_xsmrpool_to_atm_dribbler%get_amount_left_to_dribble_end( & + bounds, hrv_xsmrpool_amount_left_to_dribble(bounds%begg:bounds%endg)) + call cnveg_carbonflux_inst%dwt_conv_cflux_dribbler%get_amount_left_to_dribble_end( & + bounds, dwt_conv_cflux_amount_left_to_dribble(bounds%begg:bounds%endg)) + grc_endcb(g) = totgrcc(g) + tot_woodprod_grc(g) + cropprod1_grc(g) + & + hrv_xsmrpool_amount_left_to_dribble(g) + & + dwt_conv_cflux_amount_left_to_dribble(g) ! calculate total gridcell-level inputs ! slevis notes: @@ -405,25 +423,12 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & real(r8):: grc_ninputs(bounds%begg:bounds%endg) real(r8):: grc_noutputs(bounds%begg:bounds%endg) real(r8):: grc_errnb(bounds%begg:bounds%endg) - real(r8):: nfix_to_sminn_grc(bounds%begg:bounds%endg) - real(r8):: supplement_to_sminn_grc(bounds%begg:bounds%endg) - real(r8):: ffix_to_sminn_grc(bounds%begg:bounds%endg) - real(r8):: fert_to_sminn_grc(bounds%begg:bounds%endg) - real(r8):: soyfixn_to_sminn_grc(bounds%begg:bounds%endg) - real(r8):: denit_grc(bounds%begg:bounds%endg) - real(r8):: grc_fire_nloss(bounds%begg:bounds%endg) - real(r8):: som_n_leached_grc(bounds%begg:bounds%endg) - real(r8):: sminn_leached_grc(bounds%begg:bounds%endg) - real(r8):: f_n2o_nit_grc(bounds%begg:bounds%endg) - real(r8):: smin_no3_leached_grc(bounds%begg:bounds%endg) - real(r8):: smin_no3_runoff_grc(bounds%begg:bounds%endg) !----------------------------------------------------------------------- associate( & grc_begnb => this%begnb_grc , & ! Input: [real(r8) (:) ] (gN/m2) gridcell nitrogen mass, beginning of time step grc_endnb => this%endnb_grc , & ! Output: [real(r8) (:) ] (gN/m2) gridcell nitrogen mass, end of time step totgrcn => cnveg_nitrogenstate_inst%totn_grc , & ! Input: [real(r8) (:) ] (gN/m2) total gridcell nitrogen, incl veg - forc_ndep => atm2lnd_inst%forc_ndep_grc , & ! Input: [real(r8) (:)] nitrogen deposition rate (gN/m2/s) cropprod1_grc => n_products_inst%cropprod1_grc , & ! Input: [real(r8) (:)] (gN/m2) nitrogen in crop products product_loss_grc => n_products_inst%product_loss_grc , & ! Input: [real(r8) (:)] (gN/m2) losses from wood & crop products tot_woodprod_grc => n_products_inst%tot_woodprod_grc , & ! Input: [real(r8) (:)] (gN/m2) total nitrogen in wood products @@ -560,7 +565,8 @@ subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & err_found = .false. do g = bounds%begg, bounds%endg ! calculate the total gridcell-level nitrogen storage, for mass conservation check - ! slevis: Not including seedn_grc in grc_begnb and grc_endnb because + ! Notes: + ! Not including seedn_grc in grc_begnb and grc_endnb because ! seedn_grc forms out of thin air, for now, and equals ! -1 * (dwt_seedn_to_leaf_grc(g) + dwt_seedn_to_deadstem_grc(g)) ! We account for the latter fluxes as inputs below; the same diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 463127e306..b9f512329a 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -4553,13 +4553,6 @@ subroutine Summary_carbonflux(this, & call this%dwt_conv_cflux_dribbler%get_curr_flux(bounds, & this%dwt_conv_cflux_dribbled_grc(bounds%begg:bounds%endg)) - if (.not. get_for_testing_allow_non_annual_changes() .and. .not. use_cndv) then - ! In this case overwrite the dribbled array with the non-dribbled array - ! so as to conserve carbon and nitrogen at every timestep - hrv_xsmrpool_to_atm_dribbled_grc = hrv_xsmrpool_to_atm_grc - this%dwt_conv_cflux_dribbled_grc = this%dwt_conv_cflux_grc - end if - do g = bounds%begg, bounds%endg ! net ecosystem exchange of carbon, includes fire flux and hrv_xsmrpool flux, ! positive for source (NEE) diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index b56532a96c..31f354da6b 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -844,6 +844,7 @@ subroutine InitGridcellBalance(this, bounds, num_allc, filter_allc, & l2g_scale_type = 'unity') call this%cn_balance_inst%BeginCNGridcellBalance( bounds, & + this%cnveg_carbonflux_inst, & this%cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst, & this%c_products_inst, this%n_products_inst) From 7562b5e1f8690328197ec81caea81cc49805ec00 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 18 May 2020 16:31:20 -0600 Subject: [PATCH 0888/1973] Fix indentation --- src/biogeochem/CNCStateUpdate1Mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNCStateUpdate1Mod.F90 b/src/biogeochem/CNCStateUpdate1Mod.F90 index 047233a9d2..c5a717f2bc 100644 --- a/src/biogeochem/CNCStateUpdate1Mod.F90 +++ b/src/biogeochem/CNCStateUpdate1Mod.F90 @@ -287,8 +287,8 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & end if if (ivt(p) >= npcropmin) then ! skip 2 generic crops cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_litter_patch(p)*dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_biofuelc_patch(p)*dt - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_biofuelc_patch(p)*dt + cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_biofuelc_patch(p)*dt + cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_biofuelc_patch(p)*dt cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) & - (cf_veg%grainc_to_food_patch(p) + cf_veg%grainc_to_seed_patch(p))*dt cs_veg%cropseedc_deficit_patch(p) = cs_veg%cropseedc_deficit_patch(p) & From 46960d2fcb753da10e5c8fd4ff2fd34fe1814720 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Mon, 18 May 2020 23:05:28 -0600 Subject: [PATCH 0889/1973] mods to add 2 test compsets for FV3 IHistClm50Sp IHistClm50BgcCrop --- Externals.cfg | 2 +- cime_config/testdefs/testlist_clm.xml | 18 +++++++++++++++ .../README | 22 +++++++++++++++++++ .../include_user_mods | 1 + .../user_nl_clm | 2 ++ 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/README create mode 100644 cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/user_nl_clm diff --git a/Externals.cfg b/Externals.cfg index 8f7908623b..5db2b6b456 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.17 +tag = cime5.8.20 externals = ../Externals_cime.cfg required = True diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 775f2507cf..72f112d5cc 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -215,6 +215,15 @@ + + + + + + + + + @@ -771,6 +780,15 @@ + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/README b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/README new file mode 100644 index 0000000000..e23dbdeeff --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/README @@ -0,0 +1,22 @@ +This test reads 78-pft datasets (glcMEC_decrease happens to be similar but +reads 16-pft datasets). In this way, it tests the +new combination do_transient_crops = .true. and use_crop = .false. while +exercising the collapse2gencrop branch ability to collapse the full crop data +to clm's generic crops. + +According to the file +/glade/work/slevis/git/collapse_pfts/bld/namelist_files/namelist_defaults_clm4_5.xml +the following two files used in this test +are default files for the following options: + +fsurdat = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c200317.nc' +hgrid="C96" sim_year="1850" use_crop=".true." + +flanduse_timeseries = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc' +hgrid="C96" rcp="8.5" sim_year_range="1850-2100" use_crop=".true." + +This test includes the settings of the decStart test so as to also test the +end-of-year transition since it's an IHist case and transient vegetation gets +updated every new year. + +NB: This test is testing the C96 (1-degree) resolution only. diff --git a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/include_user_mods new file mode 100644 index 0000000000..acdaa462fc --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/include_user_mods @@ -0,0 +1 @@ +../decStart diff --git a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/user_nl_clm new file mode 100644 index 0000000000..fd851cc727 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/user_nl_clm @@ -0,0 +1,2 @@ +fsurdat = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c200317.nc' +flanduse_timeseries = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc' From c914399561fbb24c2fb89d3b552f4dd7c7848b3b Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Mon, 18 May 2020 23:37:24 -0600 Subject: [PATCH 0890/1973] resolve conflict in testlist --- cime_config/testdefs/testlist_clm.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index cdd8f436c0..7ba47ce714 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -212,7 +212,6 @@ -<<<<<<< HEAD @@ -230,8 +229,6 @@ -======= ->>>>>>> 411cd3f086de400693ab88caff9530ebea6fd16a From 2f917951bed314aade94752d0ada650f92fe95df Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 19 May 2020 09:38:11 -0600 Subject: [PATCH 0891/1973] Remove test from expected fails that is no longer in the test suite --- cime_config/testdefs/ExpectedTestFails.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 4b9b0ca8b0..7b7e4e060e 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -37,13 +37,6 @@ - - - FAIL - #550 - - - From 970dba14ff7df4115731c2826ef3ef6a70018bb3 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 19 May 2020 13:22:33 -0600 Subject: [PATCH 0892/1973] Fourth round of moving parameters to param file. I ran the CLM test suite (aux_clm) on the entire set of changes up to this point (all commits). All pass as expected and are BFB with the baseline (ctsm1.0.dev089). This includes CLM4.5 tests as well. I've created a new CLM4.5 parameter file that produces BFB results and included it in namelist_defaults_ctsm.xml Parameters moved: tau_l1 (now expressed as 1/year) tau_l2_l3 (now expressed as 1/year) tau_s1 (now expressed as 1/year) tau_s2 (now expressed as 1/year) tau_s3 (now expressed as 1/year) tau_cwd (now expressed as 1/year) cryoturb_diffusion_k som_diffus --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- .../SoilBiogeochemDecompCascadeBGCMod.F90 | 54 +++++-------------- .../SoilBiogeochemLittVertTranspMod.F90 | 10 +--- 3 files changed, 15 insertions(+), 51 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 71e8720ee9..29ea819b37 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -373,7 +373,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). for the CLM2 data in the CESM distribution --> /glade/p/cgd/tss/people/oleson/modify_param/clm5_params.c200402_kwo.c200422.nc -lnd/clm2/paramdata/clm_params.c200402.nc +/glade/p/cgd/tss/people/oleson/modify_param/clm_params.c200402_kwo.c200422.nc diff --git a/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 index a81b133fa4..56f6748761 100644 --- a/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 @@ -68,12 +68,12 @@ module SoilBiogeochemDecompCascadeBGCMod real(r8):: rf_cwdl2_bgc real(r8):: rf_cwdl3_bgc - real(r8):: tau_l1_bgc ! turnover time of litter 1 (yr) - real(r8):: tau_l2_l3_bgc ! turnover time of litter 2 and litter 3 (yr) - real(r8):: tau_s1_bgc ! turnover time of SOM 1 (yr) - real(r8):: tau_s2_bgc ! turnover time of SOM 2 (yr) - real(r8):: tau_s3_bgc ! turnover time of SOM 3 (yr) - real(r8):: tau_cwd_bgc ! corrected fragmentation rate constant CWD + real(r8):: tau_l1_bgc ! 1/turnover time of litter 1 from Century (l/18.5) (1/yr) + real(r8):: tau_l2_l3_bgc ! 1/turnover time of litter 2 and litter 3 from Century (1/4.9) (1/yr) + real(r8):: tau_s1_bgc ! 1/turnover time of SOM 1 from Century (1/7.3) (1/yr) + real(r8):: tau_s2_bgc ! 1/turnover time of SOM 2 from Century (1/0.2) (1/yr) + real(r8):: tau_s3_bgc ! 1/turnover time of SOM 3 from Century (1/0.0045) (1/yr) + real(r8):: tau_cwd_bgc ! corrected fragmentation rate constant CWD, century leaves wood decomposition rates open, within range of 0 - 0.5 yr^-1 (1/0.3) (1/yr) real(r8) :: cwd_fcel_bgc !cellulose fraction for CWD real(r8) :: cwd_flig_bgc ! @@ -668,13 +668,6 @@ subroutine decomp_rate_constants_bgc(bounds, num_soilc, filter_soilc, & real(r8):: k_s2 ! decomposition rate constant SOM 2 (1/sec) real(r8):: k_s3 ! decomposition rate constant SOM 3 (1/sec) real(r8):: k_frag ! fragmentation rate constant CWD (1/sec) - real(r8):: tau_l1 ! turnover time of litter 1 (yr) - real(r8):: tau_l2_l3 ! turnover time of litter 2 and litter 3 (yr) - real(r8):: tau_l3 ! turnover time of litter 3 (yr) - real(r8):: tau_s1 ! turnover time of SOM 1 (yr) - real(r8):: tau_s2 ! turnover time of SOM 2 (yr) - real(r8):: tau_s3 ! turnover time of SOM 3 (yr) - real(r8):: tau_cwd ! corrected fragmentation rate constant CWD real(r8):: cwdc_loss ! fragmentation rate for CWD carbon (gC/m2/s) real(r8):: cwdn_loss ! fragmentation rate for CWD nitrogen (gN/m2/s) real(r8):: Q10 ! temperature dependence @@ -727,29 +720,6 @@ subroutine decomp_rate_constants_bgc(bounds, num_soilc, filter_soilc, & days_per_year = get_days_per_year() - ! the belowground parameters from century - tau_l1 = 1./18.5 - tau_l2_l3 = 1./4.9 - tau_s1 = 1./7.3 - tau_s2 = 1./0.2 - tau_s3 = 1./.0045 - - ! century leaves wood decomposition rates open, within range of 0 - 0.5 yr^-1 - tau_cwd = 1./0.3 - - ! Todo: FIX(SPM,032414) - the explicit divide gives different results than when that - ! value is placed in the parameters netcdf file. To get bfb, keep the - ! divide in source. - - !tau_l1 = params_inst%tau_l1_bgc - !tau_l2_l3 = params_inst%tau_l2_l3_bgc - !tau_s1 = params_inst%tau_s1_bgc - !tau_s2 = params_inst%tau_s2_bgc - !tau_s3 = params_inst%tau_s3_bgc - - !set turnover rate of coarse woody debris - !tau_cwd = params_inst%tau_cwd_bgc - ! set "Q10" parameter Q10 = CNParamsShareInst%Q10 @@ -760,12 +730,12 @@ subroutine decomp_rate_constants_bgc(bounds, num_soilc, filter_soilc, & decomp_depth_efolding = CNParamsShareInst%decomp_depth_efolding ! translate to per-second time constant - k_l1 = 1._r8 / (secspday * days_per_year * tau_l1) - k_l2_l3 = 1._r8 / (secspday * days_per_year * tau_l2_l3) - k_s1 = 1._r8 / (secspday * days_per_year * tau_s1) - k_s2 = 1._r8 / (secspday * days_per_year * tau_s2) - k_s3 = 1._r8 / (secspday * days_per_year * tau_s3) - k_frag = 1._r8 / (secspday * days_per_year * tau_cwd) + k_l1 = 1._r8 / (secspday * days_per_year * params_inst%tau_l1_bgc) + k_l2_l3 = 1._r8 / (secspday * days_per_year * params_inst%tau_l2_l3_bgc) + k_s1 = 1._r8 / (secspday * days_per_year * params_inst%tau_s1_bgc) + k_s2 = 1._r8 / (secspday * days_per_year * params_inst%tau_s2_bgc) + k_s3 = 1._r8 / (secspday * days_per_year * params_inst%tau_s3_bgc) + k_frag = 1._r8 / (secspday * days_per_year * params_inst%tau_cwd_bgc) ! calc ref rate catanf_30 = catanf(30._r8) diff --git a/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 b/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 index b48bef59aa..0e3b3b69e7 100644 --- a/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 @@ -66,18 +66,12 @@ subroutine readParams ( ncid ) tString='som_diffus' call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - !soilbiogeochem_litt_verttransp_params_inst%som_diffus=tempr - ! FIX(SPM,032414) - can't be pulled out since division makes things not bfb - params_inst%som_diffus = 1e-4_r8 / (secspday * 365._r8) + params_inst%som_diffus=tempr tString='cryoturb_diffusion_k' call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - !soilbiogeochem_litt_verttransp_params_inst%cryoturb_diffusion_k=tempr - !FIX(SPM,032414) Todo. This constant cannot be on file since the divide makes things - !SPM Todo. This constant cannot be on file since the divide makes things - !not bfb - params_inst%cryoturb_diffusion_k = 5e-4_r8 / (secspday * 365._r8) ! [m^2/sec] = 5 cm^2 / yr = 1m^2 / 200 yr + params_inst%cryoturb_diffusion_k=tempr tString='max_altdepth_cryoturbation' call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) From 6f3537e4f770cbb66b1e9c0e398525163a26847f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 19 May 2020 14:56:23 -0600 Subject: [PATCH 0893/1973] Point to new parameter files For clm5.0, this new file adds a biofuel_harvfrac variable and adds parameters for crop types switchgrass and miscanthus. For clm4.5, this just adds a biofuel_harvfrac variable: switchgrass and miscanthus are not enabled for clm4.5. --- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 2752f17214..26be99134e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -393,8 +393,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200402.nc -lnd/clm2/paramdata/clm_params.c200402.nc +lnd/clm2/paramdata/clm5_params.c200519.nc +lnd/clm2/paramdata/clm_params.c200519.nc From c134c4c6bbf9798c3754ab7206e164f2a4ae7e76 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 20 May 2020 11:37:03 -0600 Subject: [PATCH 0894/1973] Fix for #938, get CCW order for single point corners, and use NCL to calculate corners for other cases --- tools/mkmapgrids/mkscripgrid.ncl | 34 ++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/tools/mkmapgrids/mkscripgrid.ncl b/tools/mkmapgrids/mkscripgrid.ncl index 65b9306f2d..16f4018dac 100644 --- a/tools/mkmapgrids/mkscripgrid.ncl +++ b/tools/mkmapgrids/mkscripgrid.ncl @@ -119,21 +119,27 @@ end latCenters = fspan1up( (latS + delY/2.d0), (latN - delY/2.d0), ny) lon = new( (/ny, nx/), "double" ); lat = new( (/ny, nx/), "double" ); - lonCorners = new( (/ny, nx, 4/), "double" ); - latCorners = new( (/ny, nx, 4/), "double" ); + if ( (nx == 1) .or. (ny == 1) )then + lonCorners = new( (/ny, nx, 4/), "double" ); + latCorners = new( (/ny, nx, 4/), "double" ); + end if do i = 0, nx-1 lat(:,i) = latCenters; - latCorners(:,i,0) = latCenters - delY/2.d0; - latCorners(:,i,1) = latCenters + delY/2.d0; - latCorners(:,i,2) = latCenters + delY/2.d0; - latCorners(:,i,3) = latCenters - delY/2.d0; + if ( (nx == 1) .or. (ny == 1) )then + latCorners(:,i,0) = latCenters - delY/2.d0; + latCorners(:,i,1) = latCenters - delY/2.d0; + latCorners(:,i,2) = latCenters + delY/2.d0; + latCorners(:,i,3) = latCenters + delY/2.d0; + end if end do do j = 0, ny-1 lon(j,:) = lonCenters; - lonCorners(j,:,0) = lonCenters - delX/2.d0; - lonCorners(j,:,1) = lonCenters - delX/2.d0; - lonCorners(j,:,2) = lonCenters + delX/2.d0; - lonCorners(j,:,3) = lonCenters + delX/2.d0; + if ( (nx == 1) .or. (ny == 1) )then + lonCorners(j,:,0) = lonCenters - delX/2.d0; + lonCorners(j,:,1) = lonCenters + delX/2.d0; + lonCorners(j,:,2) = lonCenters + delX/2.d0; + lonCorners(j,:,3) = lonCenters - delX/2.d0; + end if end do ; for some reason, "No_FillValue" isn't working in the case where imask=1 @@ -147,8 +153,10 @@ end Opt = True Opt@Mask2D = Mask2D - Opt@GridCornerLat = latCorners - Opt@GridCornerLon = lonCorners + if ( (nx == 1) .or. (ny == 1) )then + Opt@GridCornerLat = latCorners + Opt@GridCornerLon = lonCorners + end if Opt@Title = "SCRIP grid file for "+name if (printn) then Opt@Debug = True @@ -161,7 +169,7 @@ end nc = addfile( outfilename, "w" ); nc@history = ldate+": create using mkscripgrid.ncl"; - nc@comment = "Ocean is assumed to non-existant at this point"; + nc@comment = "Ocean is assumed to be non-existant in this region"; nc@Version = gitdescribe; if ( printn )then print( "================================================================================================" ); From 08e2b0c21bf0ad8da6046bd377c6cf5335d5cb5b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 20 May 2020 11:40:42 -0600 Subject: [PATCH 0895/1973] Fix == for .eq. in NCL --- tools/mkmapgrids/mkscripgrid.ncl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/mkmapgrids/mkscripgrid.ncl b/tools/mkmapgrids/mkscripgrid.ncl index 16f4018dac..0ff4b52134 100644 --- a/tools/mkmapgrids/mkscripgrid.ncl +++ b/tools/mkmapgrids/mkscripgrid.ncl @@ -119,13 +119,13 @@ end latCenters = fspan1up( (latS + delY/2.d0), (latN - delY/2.d0), ny) lon = new( (/ny, nx/), "double" ); lat = new( (/ny, nx/), "double" ); - if ( (nx == 1) .or. (ny == 1) )then + if ( (nx .eq. 1) .or. (ny .eq. 1) )then lonCorners = new( (/ny, nx, 4/), "double" ); latCorners = new( (/ny, nx, 4/), "double" ); end if do i = 0, nx-1 lat(:,i) = latCenters; - if ( (nx == 1) .or. (ny == 1) )then + if ( (nx .eq. 1) .or. (ny .eq. 1) )then latCorners(:,i,0) = latCenters - delY/2.d0; latCorners(:,i,1) = latCenters - delY/2.d0; latCorners(:,i,2) = latCenters + delY/2.d0; @@ -134,7 +134,7 @@ end end do do j = 0, ny-1 lon(j,:) = lonCenters; - if ( (nx == 1) .or. (ny == 1) )then + if ( (nx .eq. 1) .or. (ny .eq. 1) )then lonCorners(j,:,0) = lonCenters - delX/2.d0; lonCorners(j,:,1) = lonCenters + delX/2.d0; lonCorners(j,:,2) = lonCenters + delX/2.d0; @@ -153,7 +153,7 @@ end Opt = True Opt@Mask2D = Mask2D - if ( (nx == 1) .or. (ny == 1) )then + if ( (nx .eq. 1) .or. (ny .eq. 1) )then Opt@GridCornerLat = latCorners Opt@GridCornerLon = lonCorners end if From 8838dc9486c340a336e69913c128bc0e803ba31b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 20 May 2020 11:46:05 -0600 Subject: [PATCH 0896/1973] If verbose print comment about if corners are being calculated or not --- tools/mkmapgrids/mkscripgrid.ncl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/mkmapgrids/mkscripgrid.ncl b/tools/mkmapgrids/mkscripgrid.ncl index 0ff4b52134..0cbd1a8960 100644 --- a/tools/mkmapgrids/mkscripgrid.ncl +++ b/tools/mkmapgrids/mkscripgrid.ncl @@ -120,8 +120,15 @@ end lon = new( (/ny, nx/), "double" ); lat = new( (/ny, nx/), "double" ); if ( (nx .eq. 1) .or. (ny .eq. 1) )then + if ( printn )then + print( "Calculate corners" ) + end if lonCorners = new( (/ny, nx, 4/), "double" ); latCorners = new( (/ny, nx, 4/), "double" ); + else + if ( printn )then + print( "Have NCL calculate corners" ) + end if end if do i = 0, nx-1 lat(:,i) = latCenters; From 59d1dd4a7267ed3cb681bef939b305dce113be8f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 20 May 2020 12:11:07 -0600 Subject: [PATCH 0897/1973] Rework initialization of CNFire object With gnu9.1 on cheyenne, these tests were dying with a seg fault: SMS_Ld1_Mmpi-serial.f45_f45_mg37.I2000Clm50SpGs.cheyenne_gnu.clm-ptsRLA SMS_Ld1_Mmpi-serial.f45_f45_mg37.I2000Clm50SpGs.cheyenne_gnu.clm-ptsRLB By running one in gdb, it looks like the death occurred around the initialization of the CNFire object. Jim Edwards also recently ran into problems at this point in some work he was doing in CMEPS. I'm hopeful that this refactor will solve both problems. My hypothesis is that the problems are arising from the memory transfer that happens in the 'allocate(x, source=y())' statements; note that we had two levels of these. This rework gets rid of these by (1) changing 'allocate(var, source=type())' to 'allocate(type :: var)' and (2) changing create_cnfire_method to a subroutine rather than a function. Note that I have also made need_lightning_and_popdens a function rather than a variable to avoid the need for a constructor: I wanted to get rid of the constructor so that I could use allocate(type :: var) rather than allocate(var, source=type())... it's possible that we could have still used a constructor with the former, but I'm not sure how off-hand. --- src/biogeochem/CNFireBaseMod.F90 | 27 ++++++++++++++++--- src/biogeochem/CNFireFactoryMod.F90 | 12 ++++----- src/biogeochem/CNFireLi2014Mod.F90 | 38 ++++++++++++--------------- src/biogeochem/CNFireLi2016Mod.F90 | 35 +++++++++++------------- src/biogeochem/CNFireMethodMod.F90 | 1 - src/biogeochem/CNFireNoFireMod.F90 | 34 +++++++++++------------- src/biogeochem/CNVegetationFacade.F90 | 3 +-- 7 files changed, 77 insertions(+), 73 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 91a60d5f0c..bb4f6612cf 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -74,7 +74,7 @@ module CNFireBaseMod end type ! - type, extends(cnfire_method_type) :: cnfire_base_type + type, abstract, extends(cnfire_method_type) :: cnfire_base_type private ! !PRIVATE MEMBER DATA: @@ -93,6 +93,8 @@ module CNFireBaseMod procedure, public :: CNFireInterp ! Interpolate fire data procedure, public :: CNFireArea ! Calculate fire area procedure, public :: CNFireFluxes ! Calculate fire fluxes + procedure(need_lightning_and_popdens_interface), public, deferred :: & + need_lightning_and_popdens ! Returns true if need lightning & popdens ! ! !PRIVATE MEMBER FUNCTIONS: procedure, private :: hdm_init ! position datasets for dynamic human population density @@ -102,6 +104,23 @@ module CNFireBaseMod end type cnfire_base_type !----------------------------------------------------------------------- + abstract interface + !----------------------------------------------------------------------- + function need_lightning_and_popdens_interface(this) result(need_lightning_and_popdens) + ! + ! !DESCRIPTION: + ! Returns true if need lightning and popdens, false otherwise + ! + ! USES + import :: cnfire_base_type + ! + ! !ARGUMENTS: + class(cnfire_base_type), intent(in) :: this + logical :: need_lightning_and_popdens ! function result + !----------------------------------------------------------------------- + end function need_lightning_and_popdens_interface + end interface + type(cnfire_const_type), public, protected :: cnfire_const ! Fire constants shared by Li versons character(len=*), parameter, private :: sourcefile = & @@ -123,7 +142,7 @@ subroutine CNFireInit( this, bounds, NLFilename ) character(len=*), intent(in) :: NLFilename !----------------------------------------------------------------------- - if ( this%need_lightning_and_popdens ) then + if ( this%need_lightning_and_popdens() ) then ! Allocate lightning forcing data allocate( this%forc_lnfm(bounds%begg:bounds%endg) ) this%forc_lnfm(bounds%begg:) = nan @@ -173,7 +192,7 @@ subroutine CNFireReadNML( this, NLFilename ) rh_low, rh_hgh, bt_min, bt_max, occur_hi_gdp_tree, & lfuel, ufuel, cmb_cmplt_fact - if ( this%need_lightning_and_popdens ) then + if ( this%need_lightning_and_popdens() ) then cli_scale = cnfire_const%cli_scale boreal_peatfire_c = cnfire_const%boreal_peatfire_c non_boreal_peatfire_c = cnfire_const%non_boreal_peatfire_c @@ -255,7 +274,7 @@ subroutine CNFireInterp(this,bounds) type(bounds_type), intent(in) :: bounds !----------------------------------------------------------------------- - if ( this%need_lightning_and_popdens ) then + if ( this%need_lightning_and_popdens() ) then call this%hdm_interp(bounds) call this%lnfm_interp(bounds) end if diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index 71376116b9..d1ad7f9452 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -82,7 +82,7 @@ end subroutine CNFireReadNML !----------------------------------------------------------------------- !----------------------------------------------------------------------- - function create_cnfire_method( NLFilename ) result(cnfire_method) + subroutine create_cnfire_method( NLFilename, cnfire_method ) ! ! !DESCRIPTION: ! Create and return an object of cnfire_method_type. The particular type @@ -98,7 +98,7 @@ function create_cnfire_method( NLFilename ) result(cnfire_method) ! ! !ARGUMENTS: character(len=*), intent(in) :: NLFilename ! Namelist filename - class(cnfire_method_type), allocatable :: cnfire_method ! function result + class(cnfire_method_type), allocatable, intent(inout) :: cnfire_method ! ! !LOCAL VARIABLES: character(len=*), parameter :: subname = 'create_cnfire_method' @@ -107,11 +107,11 @@ function create_cnfire_method( NLFilename ) result(cnfire_method) select case (trim(fire_method)) case ("nofire") - allocate(cnfire_method, source=cnfire_nofire_type()) + allocate(cnfire_nofire_type :: cnfire_method) case ("li2014qianfrc") - allocate(cnfire_method, source=cnfire_li2014_type()) + allocate(cnfire_li2014_type :: cnfire_method) case ("li2016crufrc") - allocate(cnfire_method, source=cnfire_li2016_type()) + allocate(cnfire_li2016_type :: cnfire_method) case default write(iulog,*) subname//' ERROR: unknown method: ', fire_method @@ -120,6 +120,6 @@ function create_cnfire_method( NLFilename ) result(cnfire_method) end select call cnfire_method%CNFireReadNML( NLFilename ) - end function create_cnfire_method + end subroutine create_cnfire_method end module CNFireFactoryMod diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index dd74d6bc83..68d2d52a0e 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -51,35 +51,31 @@ module CNFireLi2014Mod type, extends(cnfire_base_type) :: cnfire_li2014_type private contains - ! - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: CNFireArea ! Calculate fire area - procedure, public :: CNFireFluxes + ! + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: need_lightning_and_popdens + procedure, public :: CNFireArea ! Calculate fire area + procedure, public :: CNFireFluxes end type cnfire_li2014_type - ! - ! !PRIVATE MEMBER DATA: - !----------------------------------------------------------------------- - - interface cnfire_li2014_type - ! initialize a new cnfire_base object - module procedure constructor - end interface cnfire_li2014_type - !----------------------------------------------------------------------- - character(len=*), parameter, private :: sourcefile = & __FILE__ contains - !------------------------------------------------------------------------ - type(cnfire_li2014_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type cnfire_base_type. + !----------------------------------------------------------------------- + function need_lightning_and_popdens(this) ! !ARGUMENTS: - constructor%need_lightning_and_popdens = .true. - end function constructor + class(cnfire_li2014_type), intent(in) :: this + logical :: need_lightning_and_popdens ! function result + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'need_lightning_and_popdens' + !----------------------------------------------------------------------- + + need_lightning_and_popdens = .true. + end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index cc1108eaa4..7649c7d1aa 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -52,35 +52,30 @@ module CNFireLi2016Mod type, extends(cnfire_base_type) :: cnfire_li2016_type private contains - ! - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: CNFireArea ! Calculate fire area + ! + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: need_lightning_and_popdens + procedure, public :: CNFireArea ! Calculate fire area end type cnfire_li2016_type - ! - ! !PRIVATE MEMBER DATA: - !----------------------------------------------------------------------- - - interface cnfire_li2016_type - ! initialize a new cnfire_base object - module procedure constructor - end interface cnfire_li2016_type - !----------------------------------------------------------------------- - character(len=*), parameter, private :: sourcefile = & __FILE__ contains - !------------------------------------------------------------------------ - type(cnfire_li2016_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type cnfire_base_type. + !----------------------------------------------------------------------- + function need_lightning_and_popdens(this) ! !ARGUMENTS: + class(cnfire_li2016_type), intent(in) :: this + logical :: need_lightning_and_popdens ! function result + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'need_lightning_and_popdens' + !----------------------------------------------------------------------- - constructor%need_lightning_and_popdens = .true. - end function constructor + need_lightning_and_popdens = .true. + end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & diff --git a/src/biogeochem/CNFireMethodMod.F90 b/src/biogeochem/CNFireMethodMod.F90 index b4fd7bed66..76af46a334 100644 --- a/src/biogeochem/CNFireMethodMod.F90 +++ b/src/biogeochem/CNFireMethodMod.F90 @@ -13,7 +13,6 @@ module CNFireMethodMod public :: cnfire_method_type type, abstract :: cnfire_method_type - logical, public :: need_lightning_and_popdens = .true. ! If need lightning and population density contains ! Initialize the fire datasets diff --git a/src/biogeochem/CNFireNoFireMod.F90 b/src/biogeochem/CNFireNoFireMod.F90 index 1e6d09345a..4adc36b04c 100644 --- a/src/biogeochem/CNFireNoFireMod.F90 +++ b/src/biogeochem/CNFireNoFireMod.F90 @@ -31,31 +31,27 @@ module CNFireNoFireMod type, extends(cnfire_base_type) :: cnfire_nofire_type private contains - ! - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: CNFireArea ! Calculate fire area + ! + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: need_lightning_and_popdens + procedure, public :: CNFireArea ! Calculate fire area end type cnfire_nofire_type - ! - ! !PRIVATE MEMBER DATA: - !----------------------------------------------------------------------- +contains - interface cnfire_nofire_type - ! initialize a new cnfire_base object - module procedure constructor - end interface cnfire_nofire_type !----------------------------------------------------------------------- + function need_lightning_and_popdens(this) + ! !ARGUMENTS: + class(cnfire_nofire_type), intent(in) :: this + logical :: need_lightning_and_popdens ! function result + ! + ! !LOCAL VARIABLES: -contains + character(len=*), parameter :: subname = 'need_lightning_and_popdens' + !----------------------------------------------------------------------- - !------------------------------------------------------------------------ - type(cnfire_nofire_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type cnfire_base_type. - ! !ARGUMENTS: - constructor%need_lightning_and_popdens = .false. - end function constructor + need_lightning_and_popdens = .false. + end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 5215db838d..30bd4c0049 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -272,8 +272,7 @@ subroutine Init(this, bounds, NLFilename, nskip_steps) call this%dgvs_inst%Init(bounds) end if - allocate(this%cnfire_method, & - source=create_cnfire_method(NLFilename)) + call create_cnfire_method(NLFilename, this%cnfire_method) end subroutine Init From 3d3cb0e5948d577b7e8331f29790c3bcc7aec987 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 20 May 2020 14:01:32 -0600 Subject: [PATCH 0898/1973] Reword a comment --- src/main/pftconMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 1fe80a9d31..86b6846031 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -134,7 +134,7 @@ module pftconMod real(r8), allocatable :: slatop (:) ! SLA at top of canopy [m^2/gC] real(r8), allocatable :: dsladlai (:) ! dSLA/dLAI [m^2/gC] real(r8), allocatable :: leafcn (:) ! leaf C:N [gC/gN] - real(r8), allocatable :: biofuel_harvfrac (:) ! cut a fraction of stem/leaf for biofuel [-] + real(r8), allocatable :: biofuel_harvfrac (:) ! fraction of stem and leaf cut for harvest, sent to biofuels [unitless] real(r8), allocatable :: flnr (:) ! fraction of leaf N in Rubisco [no units] real(r8), allocatable :: woody (:) ! woody lifeform flag (0 or 1) real(r8), allocatable :: lflitcn (:) ! leaf litter C:N (gC/gN) From 4ca0f3164132bc65e496c0746d40b358ec7d667c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 20 May 2020 14:08:10 -0600 Subject: [PATCH 0899/1973] Change some references to 'grain' to also mention 'biofuel' --- src/biogeochem/CNProductsMod.F90 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 0661c3b392..dc216b0529 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -33,7 +33,7 @@ module CNProductsMod class(species_base_type), allocatable :: species ! C, N, C13, C14, etc. ! States - real(r8), pointer :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan + real(r8), pointer :: cropprod1_grc(:) ! (g[C or N]/m2) crop product pool (grain + biofuel), 1-year lifespan real(r8), pointer :: prod10_grc(:) ! (g[C or N]/m2) wood product pool, 10-year lifespan real(r8), pointer :: prod100_grc(:) ! (g[C or N]/m2) wood product pool, 100-year lifespan real(r8), pointer :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool @@ -51,7 +51,7 @@ module CNProductsMod real(r8), pointer :: grain_to_cropprod1_grc(:) ! (g[C or N]/m2/s) grain to 1-year crop product pool ! Fluxes: losses - real(r8), pointer :: cropprod1_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 1-yr grain product pool + real(r8), pointer :: cropprod1_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 1-yr crop product pool real(r8), pointer :: prod10_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 10-yr wood product pool real(r8), pointer :: prod100_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 100-yr wood product pool real(r8), pointer :: tot_woodprod_loss_grc(:) ! (g[C or N]/m2/s) decompomposition loss from all wood product pools @@ -181,7 +181,7 @@ subroutine InitHistory(this, bounds) fname = this%species%hist_fname('CROPPROD1'), & units = 'g' // this%species%get_species() // '/m^2', & avgflag = 'A', & - long_name = '1-yr grain product ' // this%species%get_species(), & + long_name = '1-yr crop product (grain+biofuel) ' // this%species%get_species(), & ptr_gcell = this%cropprod1_grc, default=active_if_non_isotope) this%prod10_grc(begg:endg) = spval @@ -245,7 +245,7 @@ subroutine InitHistory(this, bounds) fname = this%species%hist_fname('CROPPROD1', suffix='_LOSS'), & units = 'g' // this%species%get_species() // '/m^2/s', & avgflag = 'A', & - long_name = 'loss from 1-yr grain product pool', & + long_name = 'loss from 1-yr crop product pool', & ptr_gcell = this%cropprod1_loss_grc, default=active_if_non_isotope) this%prod10_loss_grc(begg:endg) = spval @@ -506,17 +506,17 @@ subroutine UpdateProducts(this, bounds, & ! update product state variables do g = bounds%begg, bounds%endg - ! fluxes into wood & grain product pools, from landcover change + ! fluxes into wood & crop product pools, from landcover change this%cropprod1_grc(g) = this%cropprod1_grc(g) + this%dwt_cropprod1_gain_grc(g)*dt this%prod10_grc(g) = this%prod10_grc(g) + this%dwt_prod10_gain_grc(g)*dt this%prod100_grc(g) = this%prod100_grc(g) + this%dwt_prod100_gain_grc(g)*dt - ! fluxes into wood & grain product pools, from harvest + ! fluxes into wood & crop product pools, from harvest this%cropprod1_grc(g) = this%cropprod1_grc(g) + this%grain_to_cropprod1_grc(g)*dt this%prod10_grc(g) = this%prod10_grc(g) + this%hrv_deadstem_to_prod10_grc(g)*dt this%prod100_grc(g) = this%prod100_grc(g) + this%hrv_deadstem_to_prod100_grc(g)*dt - ! fluxes out of wood & grain product pools, from decomposition + ! fluxes out of wood & crop product pools, from decomposition this%cropprod1_grc(g) = this%cropprod1_grc(g) - this%cropprod1_loss_grc(g)*dt this%prod10_grc(g) = this%prod10_grc(g) - this%prod10_loss_grc(g)*dt this%prod100_grc(g) = this%prod100_grc(g) - this%prod100_loss_grc(g)*dt From 40927b6c0d3c9cdf280633f6619d26c0cf239f91 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 20 May 2020 14:17:35 -0600 Subject: [PATCH 0900/1973] Ensure that biofuel_harvfrac is only > 0 for prognostic crops --- src/main/pftconMod.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 86b6846031..9b7eefa51b 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -1177,6 +1177,10 @@ subroutine InitRead(this) if ( this%pprodharv10(i) > 1.0_r8 .or. this%pprodharv10(i) < 0.0_r8 )then call endrun(msg=' ERROR: pprodharv10 outside of range.'//errMsg(sourcefile, __LINE__)) end if + if (i < npcropmin .and. this%biofuel_harvfrac(i) /= 0._r8) then + call endrun(msg=' ERROR: biofuel_harvfrac non-zero for a non-prognostic crop PFT.'//& + errMsg(sourcefile, __LINE__)) + end if end do end if From bb3f8e82927bc156fbb0e9ffcc6d65ee533fc4fa Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 20 May 2020 17:02:43 -0600 Subject: [PATCH 0901/1973] Change issue associated with smallville test failure I think it's really ESCOMP/CTSM#203 that's causing this failure, not ESCOMP/CTSM#158. --- cime_config/testdefs/ExpectedTestFails.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 4b9b0ca8b0..a51b26d31c 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -33,7 +33,7 @@ FAIL - #158 + #203 From 633be0ebb88e649218f0d6fd15b9dc380334048c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 20 May 2020 17:09:29 -0600 Subject: [PATCH 0902/1973] Initialize harvest variables to 0 when using all_veg I'm hopeful that this will address ESCOMP/CTSM#203 --- tools/mksurfdata_map/src/mksurfdat.F90 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index acba4e8719..236740282c 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -93,6 +93,7 @@ program mksurfdat type(pct_pft_type), allocatable :: pctnatpft_max(:) ! % of grid cell maximum PFTs of the time series type(pct_pft_type), allocatable :: pctcft(:) ! % of grid cell that is crop, and breakdown into CFTs type(pct_pft_type), allocatable :: pctcft_max(:) ! % of grid cell maximum CFTs of the time series + real(r8) :: harvest_initval ! initial value for harvest variables real(r8), pointer :: harvest1D(:) ! harvest 1D data: normalized harvesting real(r8), pointer :: harvest2D(:,:) ! harvest 1D data: normalized harvesting real(r8), allocatable :: pctgla(:) ! percent of grid cell that is glacier @@ -568,7 +569,14 @@ program mksurfdat ndiag=ndiag, pctlnd_o=pctlnd_pft, pctnatpft_o=pctnatpft, pctcft_o=pctcft) ! Create harvesting data at model resolution - call mkharvest_init( ns_o, spval, harvdata, mksrf_fhrvtyp ) + if (all_veg) then + ! In this case, we don't call mkharvest, so we want the harvest variables to be + ! initialized reasonably. + harvest_initval = 0._r8 + else + harvest_initval = spval + end if + call mkharvest_init( ns_o, harvest_initval, harvdata, mksrf_fhrvtyp ) if ( .not. all_veg )then call mkharvest( ldomain, mapfname=map_fharvest, datfname=mksrf_fhrvtyp, & From 98cf4c63137a868feefed71da7239d12b8e5a298 Mon Sep 17 00:00:00 2001 From: wwieder Date: Thu, 21 May 2020 05:44:52 -0600 Subject: [PATCH 0903/1973] increases resorbtion from live to dead wood --- src/biogeochem/CNNStateUpdate1Mod.F90 | 9 +- src/biogeochem/CNPhenologyMod.F90 | 18 ++-- src/biogeochem/CNVegCarbonFluxType.F90 | 84 +++++++++------- src/biogeochem/CNVegNitrogenFluxType.F90 | 71 +++++++++---- .../NutrientCompetitionFlexibleCNMod.F90 | 99 ++++++++++++++++--- 5 files changed, 201 insertions(+), 80 deletions(-) diff --git a/src/biogeochem/CNNStateUpdate1Mod.F90 b/src/biogeochem/CNNStateUpdate1Mod.F90 index 996426246a..56e6ddbd55 100644 --- a/src/biogeochem/CNNStateUpdate1Mod.F90 +++ b/src/biogeochem/CNNStateUpdate1Mod.F90 @@ -6,7 +6,7 @@ module CNNStateUpdate1Mod ! ! !USES: use shr_kind_mod , only: r8 => shr_kind_r8 - use clm_time_manager , only : get_step_size_real + use clm_time_manager , only : get_step_size, get_step_size_real use clm_varpar , only : nlevdecomp, ndecomp_pools, ndecomp_cascade_transitions use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd use clm_varctl , only : iulog, use_nitrif_denitrif @@ -119,7 +119,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & ) ! set time steps - dt = get_step_size_real() + dt = real( get_step_size(), r8 ) ! soilbiogeochemistry fluxes TODO - this should be moved elsewhere @@ -189,6 +189,11 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & ns_veg%deadcrootn_patch(p) = ns_veg%deadcrootn_patch(p) + nf_veg%livecrootn_to_deadcrootn_patch(p)*dt ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) - nf_veg%livecrootn_to_retransn_patch(p)*dt ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%livecrootn_to_retransn_patch(p)*dt + ! WW change logic so livestem_retrans goes to npool (via free_retrans flux) + ! this should likely be done more cleanly if it works, i.e. not update fluxes w/ states + ! additional considerations for crop? + nf_veg%free_retransn_to_npool_patch(p) = nf_veg%free_retransn_to_npool_patch(p) + nf_veg%livestemn_to_retransn_patch(p) + nf_veg%free_retransn_to_npool_patch(p) = nf_veg%free_retransn_to_npool_patch(p) + nf_veg%livecrootn_to_retransn_patch(p) end if if (ivt(p) >= npcropmin) then ! Beth adds retrans from froot ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - nf_veg%frootn_to_retransn_patch(p)*dt diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 6f9b004c04..674c27dda5 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2720,8 +2720,10 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & if (CNratio_floating .eqv. .true.) then if (livestemc(p) == 0.0_r8) then ntovr = 0.0_r8 + livestemn_to_deadstemn(p) = 0.0_r8 else ntovr = ctovr * (livestemn(p) / livestemc(p)) + livestemn_to_deadstemn(p) = ctovr / deadwdcn(ivt(p)) end if livestemn_to_deadstemn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn @@ -2739,19 +2741,23 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & if (CNratio_floating .eqv. .true.) then if (livecrootc(p) == 0.0_r8) then ntovr = 0.0_r8 + livecrootn_to_deadcrootn(p) = 0.0_r8 else ntovr = ctovr * (livecrootn(p) / livecrootc(p)) + livecrootn_to_deadcrootn(p) = ctovr / deadwdcn(ivt(p)) end if - livecrootn_to_deadcrootn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn +! livecrootn_to_deadcrootn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn end if livecrootn_to_retransn(p) = ntovr - livecrootn_to_deadcrootn(p) - if(use_fun)then - !TURNED OFF FLUXES TO CORRECT N ACCUMULATION ISSUE. RF. Oct 2015. - livecrootn_to_retransn(p) = 0.0_r8 - livestemn_to_retransn(p) = 0.0_r8 - endif + +! Allow resorbtion with FUN +! if(use_fun)then +! !TURNED OFF FLUXES TO CORRECT N ACCUMULATION ISSUE. RF. Oct 2015. +! livecrootn_to_retransn(p) = 0.0_r8 +! livestemn_to_retransn(p) = 0.0_r8 +! endif end if diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 2c1d8ff4b7..8a5bb32abe 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -838,6 +838,16 @@ subroutine InitHistory(this, bounds, carbon_type) ptr_patch=this%grainc_to_seed_patch) end if + this%hrv_livestemc_to_litter_patch(begp:endp) = spval + call hist_addfld1d (fname='HRV_LIVESTEMC_TO_LITTER', units='gC/m^2/s', & + avgflag='A', long_name='harvest livestem C mortality', & + ptr_patch=this%hrv_livestemc_to_litter_patch, default='active') + + this%livestemc_to_litter_patch(begp:endp) = spval + call hist_addfld1d (fname='LIVESTEMC_TO_LITTER', units='gC/m^2/s', & + avgflag='A', long_name='livestem C mortality', & + ptr_patch=this%hrv_livestemc_to_litter_patch, default='active') + this%litterc_loss_col(begc:endc) = spval call hist_addfld1d (fname='LITTERC_LOSS', units='gC/m^2/s', & avgflag='A', long_name='litter C loss', & @@ -896,12 +906,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & avgflag='A', long_name='live stem C storage mortality', & - ptr_patch=this%m_livestemc_storage_to_litter_patch, default='inactive') + ptr_patch=this%m_livestemc_storage_to_litter_patch, default='active') this%m_deadstemc_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & avgflag='A', long_name='dead stem C storage mortality', & - ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='inactive') + ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='active') this%m_livecrootc_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & @@ -926,7 +936,7 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_xfer_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER', units='gC/m^2/s', & avgflag='A', long_name='live stem C transfer mortality', & - ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='inactive') + ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='active') this%m_deadstemc_xfer_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_LITTER', units='gC/m^2/s', & @@ -946,7 +956,7 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER', units='gC/m^2/s', & avgflag='A', long_name='live stem C mortality', & - ptr_patch=this%m_livestemc_to_litter_patch, default='inactive') + ptr_patch=this%m_livestemc_to_litter_patch, default='active') this%m_deadstemc_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER', units='gC/m^2/s', & @@ -991,17 +1001,17 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_TO_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C fire loss', & - ptr_patch=this%m_livestemc_to_fire_patch, default='inactive') + ptr_patch=this%m_livestemc_to_fire_patch, default='active') this%m_livestemc_storage_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C storage fire loss', & - ptr_patch=this%m_livestemc_storage_to_fire_patch, default='inactive') + ptr_patch=this%m_livestemc_storage_to_fire_patch, default='active') this%m_livestemc_xfer_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C transfer fire loss', & - ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='inactive') + ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='active') this%m_deadstemc_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_TO_FIRE', units='gC/m^2/s', & @@ -1092,22 +1102,22 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_to_litter_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C fire mortality to litter', & - ptr_patch=this%m_livestemc_to_litter_fire_patch, default='inactive') + ptr_patch=this%m_livestemc_to_litter_fire_patch, default='active') this%m_livestemc_storage_to_litter_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C storage fire mortality to litter', & - ptr_patch=this%m_livestemc_storage_to_litter_fire_patch, default='inactive') + ptr_patch=this%m_livestemc_storage_to_litter_fire_patch, default='active') this%m_livestemc_xfer_to_litter_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C transfer fire mortality to litter', & - ptr_patch=this%m_livestemc_xfer_to_litter_fire_patch, default='inactive') + ptr_patch=this%m_livestemc_xfer_to_litter_fire_patch, default='active') this%m_livestemc_to_deadstemc_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_TO_DEADSTEMC_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C fire mortality to dead stem C', & - ptr_patch=this%m_livestemc_to_deadstemc_fire_patch, default='inactive') + ptr_patch=this%m_livestemc_to_deadstemc_fire_patch, default='active') this%m_deadstemc_to_litter_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & @@ -1198,7 +1208,7 @@ subroutine InitHistory(this, bounds, carbon_type) this%leafc_xfer_to_leafc_patch(begp:endp) = spval call hist_addfld1d (fname='LEAFC_XFER_TO_LEAFC', units='gC/m^2/s', & avgflag='A', long_name='leaf C growth from storage', & - ptr_patch=this%leafc_xfer_to_leafc_patch, default='inactive') + ptr_patch=this%leafc_xfer_to_leafc_patch, default='active') this%frootc_xfer_to_frootc_patch(begp:endp) = spval call hist_addfld1d (fname='FROOTC_XFER_TO_FROOTC', units='gC/m^2/s', & @@ -1208,12 +1218,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%livestemc_xfer_to_livestemc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMC_XFER_TO_LIVESTEMC', units='gC/m^2/s', & avgflag='A', long_name='live stem C growth from storage', & - ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='inactive') + ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='active') this%deadstemc_xfer_to_deadstemc_patch(begp:endp) = spval call hist_addfld1d (fname='DEADSTEMC_XFER_TO_DEADSTEMC', units='gC/m^2/s', & avgflag='A', long_name='dead stem C growth from storage', & - ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='inactive') + ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='active') this%livecrootc_xfer_to_livecrootc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOTC_XFER_TO_LIVECROOTC', units='gC/m^2/s', & @@ -1245,7 +1255,7 @@ subroutine InitHistory(this, bounds, carbon_type) this%cpool_to_resp_patch(begp:endp) = spval call hist_addfld1d (fname='EXCESSC_MR', units='gC/m^2/s', & avgflag='A', long_name='excess C maintenance respiration', & - ptr_patch=this%cpool_to_resp_patch, default='inactive') + ptr_patch=this%cpool_to_resp_patch, default='active') this%leaf_mr_patch(begp:endp) = spval call hist_addfld1d (fname='LEAF_MR', units='gC/m^2/s', & avgflag='A', long_name='leaf maintenance respiration', & @@ -1259,12 +1269,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%livestem_mr_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEM_MR', units='gC/m^2/s', & avgflag='A', long_name='live stem maintenance respiration', & - ptr_patch=this%livestem_mr_patch, default='inactive') + ptr_patch=this%livestem_mr_patch, default='active') this%livecroot_mr_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOT_MR', units='gC/m^2/s', & avgflag='A', long_name='live coarse root maintenance respiration', & - ptr_patch=this%livecroot_mr_patch, default='inactive') + ptr_patch=this%livecroot_mr_patch, default='active') this%psnsun_to_cpool_patch(begp:endp) = spval call hist_addfld1d (fname='PSNSUN_TO_CPOOL', units='gC/m^2/s', & @@ -1299,42 +1309,42 @@ subroutine InitHistory(this, bounds, carbon_type) this%cpool_to_livestemc_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC', units='gC/m^2/s', & avgflag='A', long_name='allocation to live stem C', & - ptr_patch=this%cpool_to_livestemc_patch, default='inactive') + ptr_patch=this%cpool_to_livestemc_patch, default='active') this%cpool_to_livestemc_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC_STORAGE', units='gC/m^2/s', & avgflag='A', long_name='allocation to live stem C storage', & - ptr_patch=this%cpool_to_livestemc_storage_patch, default='inactive') + ptr_patch=this%cpool_to_livestemc_storage_patch, default='active') this%cpool_to_deadstemc_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC', units='gC/m^2/s', & avgflag='A', long_name='allocation to dead stem C', & - ptr_patch=this%cpool_to_deadstemc_patch, default='inactive') + ptr_patch=this%cpool_to_deadstemc_patch, default='active') this%cpool_to_deadstemc_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC_STORAGE', units='gC/m^2/s', & avgflag='A', long_name='allocation to dead stem C storage', & - ptr_patch=this%cpool_to_deadstemc_storage_patch, default='inactive') + ptr_patch=this%cpool_to_deadstemc_storage_patch, default='active') this%cpool_to_livecrootc_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC', units='gC/m^2/s', & avgflag='A', long_name='allocation to live coarse root C', & - ptr_patch=this%cpool_to_livecrootc_patch, default='inactive') + ptr_patch=this%cpool_to_livecrootc_patch, default='active') this%cpool_to_livecrootc_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC_STORAGE', units='gC/m^2/s', & avgflag='A', long_name='allocation to live coarse root C storage', & - ptr_patch=this%cpool_to_livecrootc_storage_patch, default='inactive') + ptr_patch=this%cpool_to_livecrootc_storage_patch, default='active') this%cpool_to_deadcrootc_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC', units='gC/m^2/s', & avgflag='A', long_name='allocation to dead coarse root C', & - ptr_patch=this%cpool_to_deadcrootc_patch, default='inactive') + ptr_patch=this%cpool_to_deadcrootc_patch, default='active') this%cpool_to_deadcrootc_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC_STORAGE', units='gC/m^2/s', & avgflag='A', long_name='allocation to dead coarse root C storage', & - ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='inactive') + ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='active') this%cpool_to_gresp_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_GRESP_STORAGE', units='gC/m^2/s', & @@ -1374,42 +1384,42 @@ subroutine InitHistory(this, bounds, carbon_type) this%cpool_livestem_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_LIVESTEM_GR', units='gC/m^2/s', & avgflag='A', long_name='live stem growth respiration', & - ptr_patch=this%cpool_livestem_gr_patch, default='inactive') + ptr_patch=this%cpool_livestem_gr_patch, default='active') this%cpool_livestem_storage_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_LIVESTEM_STORAGE_GR', units='gC/m^2/s', & avgflag='A', long_name='live stem growth respiration to storage', & - ptr_patch=this%cpool_livestem_storage_gr_patch, default='inactive') + ptr_patch=this%cpool_livestem_storage_gr_patch, default='active') this%transfer_livestem_gr_patch(begp:endp) = spval call hist_addfld1d (fname='TRANSFER_LIVESTEM_GR', units='gC/m^2/s', & avgflag='A', long_name='live stem growth respiration from storage', & - ptr_patch=this%transfer_livestem_gr_patch, default='inactive') + ptr_patch=this%transfer_livestem_gr_patch, default='active') this%cpool_deadstem_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_DEADSTEM_GR', units='gC/m^2/s', & avgflag='A', long_name='dead stem growth respiration', & - ptr_patch=this%cpool_deadstem_gr_patch, default='inactive') + ptr_patch=this%cpool_deadstem_gr_patch, default='active') this%cpool_deadstem_storage_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_DEADSTEM_STORAGE_GR', units='gC/m^2/s', & avgflag='A', long_name='dead stem growth respiration to storage', & - ptr_patch=this%cpool_deadstem_storage_gr_patch, default='inactive') + ptr_patch=this%cpool_deadstem_storage_gr_patch, default='active') this%transfer_deadstem_gr_patch(begp:endp) = spval call hist_addfld1d (fname='TRANSFER_DEADSTEM_GR', units='gC/m^2/s', & avgflag='A', long_name='dead stem growth respiration from storage', & - ptr_patch=this%transfer_deadstem_gr_patch, default='inactive') + ptr_patch=this%transfer_deadstem_gr_patch, default='active') this%cpool_livecroot_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_LIVECROOT_GR', units='gC/m^2/s', & avgflag='A', long_name='live coarse root growth respiration', & - ptr_patch=this%cpool_livecroot_gr_patch, default='inactive') + ptr_patch=this%cpool_livecroot_gr_patch, default='active') this%cpool_livecroot_storage_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_LIVECROOT_STORAGE_GR', units='gC/m^2/s', & avgflag='A', long_name='live coarse root growth respiration to storage', & - ptr_patch=this%cpool_livecroot_storage_gr_patch, default='inactive') + ptr_patch=this%cpool_livecroot_storage_gr_patch, default='active') this%transfer_livecroot_gr_patch(begp:endp) = spval call hist_addfld1d (fname='TRANSFER_LIVECROOT_GR', units='gC/m^2/s', & @@ -1444,12 +1454,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%livestemc_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & avgflag='A', long_name='live stem C shift storage to transfer', & - ptr_patch=this%livestemc_storage_to_xfer_patch, default='inactive') + ptr_patch=this%livestemc_storage_to_xfer_patch, default='active') this%deadstemc_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='DEADSTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & avgflag='A', long_name='dead stem C shift storage to transfer', & - ptr_patch=this%deadstemc_storage_to_xfer_patch, default='inactive') + ptr_patch=this%deadstemc_storage_to_xfer_patch, default='active') this%livecrootc_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & @@ -1469,12 +1479,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%livestemc_to_deadstemc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMC_TO_DEADSTEMC', units='gC/m^2/s', & avgflag='A', long_name='live stem C turnover', & - ptr_patch=this%livestemc_to_deadstemc_patch, default='inactive') + ptr_patch=this%livestemc_to_deadstemc_patch, default='active') this%livecrootc_to_deadcrootc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOTC_TO_DEADCROOTC', units='gC/m^2/s', & avgflag='A', long_name='live coarse root C turnover', & - ptr_patch=this%livecrootc_to_deadcrootc_patch, default='inactive') + ptr_patch=this%livecrootc_to_deadcrootc_patch, default='active') this%gpp_before_downreg_patch(begp:endp) = spval call hist_addfld1d (fname='INIT_GPP', units='gC/m^2/s', & diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90 index f9f2b37215..212333155c 100644 --- a/src/biogeochem/CNVegNitrogenFluxType.F90 +++ b/src/biogeochem/CNVegNitrogenFluxType.F90 @@ -557,7 +557,29 @@ subroutine InitHistory(this, bounds) else vr_suffix = "" endif - +! WW added these two fields + ! This may just be a crop variable + this%livestemn_to_litter_patch(begp:endp) = spval + call hist_addfld1d (fname='LIVESTEMN_TO_LITTER', units='gN/m^2/s', & + avgflag='A', long_name='livestem N mortality', & + ptr_patch=this%livestemn_to_litter_patch, default='active') + + this%hrv_livestemn_to_litter_patch(begp:endp) = spval + call hist_addfld1d (fname='HRV_LIVESTEMN_TO_LITTER', units='gN/m^2/s', & + avgflag='A', long_name='harvest livestem N mortality', & + ptr_patch=this%hrv_livestemn_to_litter_patch, default='active') + + this%m_livestemn_to_litter_fire_patch(begp:endp) = spval + call hist_addfld1d (fname='M_LIVESTEMN_TO_LITTER_FIRE', units='gN/m^2/s', & + avgflag='A', long_name='live stem N fire mortality to litter', & + ptr_patch=this%m_livestemn_to_litter_fire_patch, default='active') + + this%m_livestemn_to_deadstemn_fire_patch(begp:endp) = spval + call hist_addfld1d (fname='M_LIVESTEMN_TO_DEADSTEMN_FIRE', units='gN/m^2/s', & + avgflag='A', long_name='live stem N fire mortality to dead stem N', & + ptr_patch=this%m_livestemn_to_deadstemn_fire_patch, default='active') +! end WW additions + this%m_leafn_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LEAFN_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='leaf N mortality', & @@ -581,7 +603,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='live stem N storage mortality', & - ptr_patch=this%m_livestemn_storage_to_litter_patch, default='inactive') + ptr_patch=this%m_livestemn_storage_to_litter_patch, default='active') this%m_deadstemn_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & @@ -611,7 +633,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_xfer_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='live stem N transfer mortality', & - ptr_patch=this%m_livestemn_xfer_to_litter_patch, default='inactive') + ptr_patch=this%m_livestemn_xfer_to_litter_patch, default='active') this%m_deadstemn_xfer_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_LITTER', units='gN/m^2/s', & @@ -631,7 +653,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='live stem N mortality', & - ptr_patch=this%m_livestemn_to_litter_patch, default='inactive') + ptr_patch=this%m_livestemn_to_litter_patch, default='active') this%m_deadstemn_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_TO_LITTER', units='gN/m^2/s', & @@ -676,7 +698,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_storage_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & avgflag='A', long_name='live stem N storage fire loss', & - ptr_patch=this%m_livestemn_storage_to_fire_patch, default='inactive') + ptr_patch=this%m_livestemn_storage_to_fire_patch, default='active') this%m_deadstemn_storage_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & @@ -706,7 +728,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_xfer_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_FIRE', units='gN/m^2/s', & avgflag='A', long_name='live stem N transfer fire loss', & - ptr_patch=this%m_livestemn_xfer_to_fire_patch, default='inactive') + ptr_patch=this%m_livestemn_xfer_to_fire_patch, default='active') this%m_deadstemn_xfer_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_FIRE', units='gN/m^2/s', & @@ -726,7 +748,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_TO_FIRE', units='gN/m^2/s', & avgflag='A', long_name='live stem N fire loss', & - ptr_patch=this%m_livestemn_to_fire_patch, default='inactive') + ptr_patch=this%m_livestemn_to_fire_patch, default='active') this%m_deadstemn_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_TO_FIRE', units='gN/m^2/s', & @@ -761,7 +783,7 @@ subroutine InitHistory(this, bounds) this%leafn_xfer_to_leafn_patch(begp:endp) = spval call hist_addfld1d (fname='LEAFN_XFER_TO_LEAFN', units='gN/m^2/s', & avgflag='A', long_name='leaf N growth from storage', & - ptr_patch=this%leafn_xfer_to_leafn_patch, default='inactive') + ptr_patch=this%leafn_xfer_to_leafn_patch, default='active') this%frootn_xfer_to_frootn_patch(begp:endp) = spval call hist_addfld1d (fname='FROOTN_XFER_TO_FROOTN', units='gN/m^2/s', & @@ -771,7 +793,7 @@ subroutine InitHistory(this, bounds) this%livestemn_xfer_to_livestemn_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMN_XFER_TO_LIVESTEMN', units='gN/m^2/s', & avgflag='A', long_name='live stem N growth from storage', & - ptr_patch=this%livestemn_xfer_to_livestemn_patch, default='inactive') + ptr_patch=this%livestemn_xfer_to_livestemn_patch, default='active') this%deadstemn_xfer_to_deadstemn_patch(begp:endp) = spval call hist_addfld1d (fname='DEADSTEMN_XFER_TO_DEADSTEMN', units='gN/m^2/s', & @@ -796,12 +818,12 @@ subroutine InitHistory(this, bounds) this%leafn_to_retransn_patch(begp:endp) = spval call hist_addfld1d (fname='LEAFN_TO_RETRANSN', units='gN/m^2/s', & avgflag='A', long_name='leaf N to retranslocated N pool', & - ptr_patch=this%leafn_to_retransn_patch, default='inactive') + ptr_patch=this%leafn_to_retransn_patch, default='active') this%frootn_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='FROOTN_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='fine root N litterfall', & - ptr_patch=this%frootn_to_litter_patch, default='inactive') + ptr_patch=this%frootn_to_litter_patch, default='active') this%retransn_to_npool_patch(begp:endp) = spval call hist_addfld1d (fname='RETRANSN_TO_NPOOL', units='gN/m^2/s', & @@ -841,22 +863,22 @@ subroutine InitHistory(this, bounds) this%npool_to_livestemn_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN', units='gN/m^2/s', & avgflag='A', long_name='allocation to live stem N', & - ptr_patch=this%npool_to_livestemn_patch, default='inactive') + ptr_patch=this%npool_to_livestemn_patch, default='active') this%npool_to_livestemn_storage_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN_STORAGE', units='gN/m^2/s', & avgflag='A', long_name='allocation to live stem N storage', & - ptr_patch=this%npool_to_livestemn_storage_patch, default='inactive') + ptr_patch=this%npool_to_livestemn_storage_patch, default='active') this%npool_to_deadstemn_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN', units='gN/m^2/s', & avgflag='A', long_name='allocation to dead stem N', & - ptr_patch=this%npool_to_deadstemn_patch, default='inactive') + ptr_patch=this%npool_to_deadstemn_patch, default='active') this%npool_to_deadstemn_storage_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN_STORAGE', units='gN/m^2/s', & avgflag='A', long_name='allocation to dead stem N storage', & - ptr_patch=this%npool_to_deadstemn_storage_patch, default='inactive') + ptr_patch=this%npool_to_deadstemn_storage_patch, default='active') this%npool_to_livecrootn_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_LIVECROOTN', units='gN/m^2/s', & @@ -891,7 +913,7 @@ subroutine InitHistory(this, bounds) this%livestemn_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & avgflag='A', long_name='live stem N shift storage to transfer', & - ptr_patch=this%livestemn_storage_to_xfer_patch, default='inactive') + ptr_patch=this%livestemn_storage_to_xfer_patch, default='active') this%deadstemn_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='DEADSTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & @@ -911,12 +933,12 @@ subroutine InitHistory(this, bounds) this%livestemn_to_deadstemn_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMN_TO_DEADSTEMN', units='gN/m^2/s', & avgflag='A', long_name='live stem N turnover', & - ptr_patch=this%livestemn_to_deadstemn_patch, default='inactive') + ptr_patch=this%livestemn_to_deadstemn_patch, default='active') this%livestemn_to_retransn_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMN_TO_RETRANSN', units='gN/m^2/s', & avgflag='A', long_name='live stem N to retranslocated N pool', & - ptr_patch=this%livestemn_to_retransn_patch, default='inactive') + ptr_patch=this%livestemn_to_retransn_patch, default='active') this%livecrootn_to_deadcrootn_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOTN_TO_DEADCROOTN', units='gN/m^2/s', & @@ -950,7 +972,7 @@ subroutine InitHistory(this, bounds) ptr_patch=this%fert_patch) end if - if (use_crop .and. .not. use_fun) then + if (use_crop) then this%soyfixn_patch(begp:endp) = spval call hist_addfld1d (fname='SOYFIXN', units='gN/m^2/s', & avgflag='A', long_name='soybean fixation', & @@ -1402,6 +1424,11 @@ subroutine Restart (this, bounds, ncid, flag ) long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%avail_retransn_patch) + call restartvar(ncid=ncid, flag=flag, varname='plant_nalloc', xtype=ncd_double, & + dim1name='pft', & + long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%plant_nalloc_patch) + if ( use_fun ) then ! set_missing_vals_to_constant for BACKWARDS_COMPATIBILITY(wrw, 2018-06-28) re. issue #426 ! special land units previously set to spval, not 0 @@ -1521,6 +1548,12 @@ subroutine Restart (this, bounds, ncid, flag ) long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%Nuptake_patch) call set_missing_vals_to_constant(this%Nuptake_patch, 0._r8) + + call restartvar(ncid=ncid, flag=flag, varname='sminn_to_plant_fun', xtype=ncd_double, & + dim1name='pft', & + long_name='Total soil N uptake of FUN', units='gN/m2/s', & + interpinic_flag='interp', readvar=readvar, data=this%sminn_to_plant_fun_patch) + call set_missing_vals_to_constant(this%sminn_to_plant_fun_patch, 0._r8) end if ! End BACKWARDS_COMPATIBILITY(wrw, 2018-06-28) re. issue #426 diff --git a/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 b/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 index b69c666ea4..81e33315c0 100644 --- a/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 +++ b/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 @@ -18,6 +18,7 @@ module NutrientCompetitionFlexibleCNMod ! ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use LandunitType , only : lun use ColumnType , only : col @@ -36,6 +37,10 @@ module NutrientCompetitionFlexibleCNMod private real(r8), pointer :: actual_leafcn(:) ! leaf CN ratio used by flexible CN real(r8), pointer :: actual_storage_leafcn(:) ! storage leaf CN ratio used by flexible CN + real(r8), pointer :: actual_livestemcn(:) ! live wood CN ratio used by flexible CN + real(r8), pointer :: actual_livestemcn_storage(:) ! storage live wood CN ratio used by flexible CN + real(r8), pointer :: npool_to_livestemn(:) ! npool to live stem n + real(r8), pointer :: npool_to_livestemn_storage(:) ! npool to live stem storage n contains ! public methocs procedure, public :: Init ! Initialization @@ -97,6 +102,10 @@ subroutine InitAllocate(this, bounds) allocate(this%actual_leafcn(bounds%begp:bounds%endp)) ; this%actual_leafcn(:) = nan allocate(this%actual_storage_leafcn(bounds%begp:bounds%endp)) ; this%actual_storage_leafcn(:) = nan + allocate(this%actual_livestemcn(bounds%begp:bounds%endp)) ; this%actual_livestemcn(:) = nan + allocate(this%actual_livestemcn_storage(bounds%begp:bounds%endp)) ; this%actual_livestemcn_storage(:) = nan + allocate(this%npool_to_livestemn(bounds%begp:bounds%endp)) ; this%npool_to_livestemn(:) = nan + allocate(this%npool_to_livestemn_storage(bounds%begp:bounds%endp)) ; this%npool_to_livestemn_storage(:) = nan end subroutine InitAllocate @@ -127,7 +136,25 @@ subroutine InitHistory(this, bounds) this%actual_storage_leafcn(begp:endp) = spval call hist_addfld1d (fname='LEAFCN_STORAGE', units='gC/gN', & avgflag='A', long_name='Storage Leaf CN ratio used for flexible CN', & - ptr_patch=this%actual_storage_leafcn, default='inactive') + ptr_patch=this%actual_storage_leafcn, default='active') + + this%actual_livestemcn(begp:endp) = spval + call hist_addfld1d (fname='LIVESTEMCN', units='gC/gN', & + avgflag='A', long_name='Live wood CN ratio used for flexible CN', & + ptr_patch=this%actual_livestemcn ) + this%actual_livestemcn_storage(begp:endp) = spval + call hist_addfld1d (fname='LIVESTEMCN_STORAGE', units='gC/gN', & + avgflag='A', long_name='Storage Live wood CN ratio used for flexible CN', & + ptr_patch=this%actual_livestemcn_storage, default='active') + + this%npool_to_livestemn(begp:endp) = spval + call hist_addfld1d (fname='NPOOL_TO_LIVESTEM', units='gN m^-1 s^-1', & + avgflag='A', long_name='NPOOL to live stem N', & + ptr_patch=this%npool_to_livestemn ) + this%npool_to_livestemn_storage(begp:endp) = spval + call hist_addfld1d (fname='NPOOL_TO_LIVESTEM_STORAGE', units='gN m^-1 s^-1', & + avgflag='A', long_name='NPOOL to live stem N storage', & + ptr_patch=this%npool_to_livestemn_storage ) end subroutine InitHistory @@ -195,7 +222,7 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & use clm_varctl , only : downreg_opt use clm_varctl , only : CN_residual_opt use clm_varctl , only : CN_partition_opt - use clm_time_manager , only : get_step_size_real + use clm_time_manager , only : get_step_size use CNVegStateType , only : cnveg_state_type use CropType , only : crop_type use CanopyStateType , only : canopystate_type @@ -297,11 +324,11 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & ! ----------------------------------------------------------------------- - SHR_ASSERT_ALL_FL((ubound(aroot) == (/bounds%endp/)) , sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(arepr) == (/bounds%endp/)) , sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fpg_col) == (/bounds%endc/)) , sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(this%actual_storage_leafcn) >= (/bounds%endp/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((lbound(this%actual_storage_leafcn) <= (/bounds%begp/)), sourcefile, __LINE__) + SHR_ASSERT_ALL((ubound(aroot) == (/bounds%endp/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(arepr) == (/bounds%endp/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fpg_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(this%actual_storage_leafcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((lbound(this%actual_storage_leafcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) associate( & fpg => fpg_col , & ! Input: [real(r8) (:) ] fraction of potential gpp (no units) @@ -400,7 +427,7 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & ) ! set time steps - dt = get_step_size_real() + dt = real( get_step_size(), r8 ) ! patch loop to distribute the available N between the competing patches ! on the basis of relative demand, and allocate C and N to new growth and storage @@ -766,6 +793,9 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (downreg_opt .eqv. .false. .AND. CN_partition_opt == 1) then + ! WW this is where demand could also be modified based on actual leaf and live wood C:N + ! allocation from npool to storage would also have to be modified? + ! computing nitrogen demand for different pools based on carbon allocated and CN ratio npool_to_leafn_demand(p) = (nlc / cnl) * fcur npool_to_leafn_storage_demand(p) = (nlc / cnl) * (1._r8 - fcur) @@ -943,7 +973,9 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & / cnveg_nitrogenstate_inst%leafn_storage_patch(p) end if end if - + + !! WW none of this is done in CLM5 w/ FUN because carbon_resp_opt = 0 by default !! + !! WW remove this redundant code? if (carbon_resp_opt == 1 .AND. laisun(p)+laisha(p) > 0.0_r8) then ! computing carbon to nitrogen ratio of different plant parts @@ -1192,7 +1224,7 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & use clm_varctl , only : use_c13, use_c14 use clm_varctl , only : nscalar_opt, plant_ndemand_opt, substrate_term_opt, temp_scalar_opt use clm_varpar , only : nlevdecomp - use clm_time_manager , only : get_step_size_real + use clm_time_manager , only : get_step_size use CanopyStateType , only : canopystate_type use PhotosynthesisMod , only : photosyns_type use CropType , only : crop_type @@ -1256,10 +1288,16 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & ! ----------------------------------------------------------------------- - SHR_ASSERT_ALL_FL((ubound(aroot) == (/bounds%endp/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(arepr) == (/bounds%endp/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(this%actual_leafcn) >= (/bounds%endp/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((lbound(this%actual_leafcn) <= (/bounds%begp/)), sourcefile, __LINE__) + SHR_ASSERT_ALL((ubound(aroot) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(arepr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(this%actual_leafcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((lbound(this%actual_leafcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(this%actual_storage_leafcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((lbound(this%actual_storage_leafcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(this%actual_livestemcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((lbound(this%actual_livestemcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(this%actual_livestemcn_storage) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((lbound(this%actual_livestemcn_storage) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) associate( & ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type @@ -1322,8 +1360,10 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & xsmrpool => cnveg_carbonstate_inst%xsmrpool_patch , & ! Input: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] + leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] + livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N @@ -1351,6 +1391,7 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & cpool_to_xsmrpool => cnveg_carbonflux_inst%cpool_to_xsmrpool_patch , & ! Output: [real(r8) (:) ] leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N + leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Output: [real(r8) (:) ] N flux required to support initial GPP (gN/m2/s) avail_retransn => cnveg_nitrogenflux_inst%avail_retransn_patch , & ! Output: [real(r8) (:) ] N flux available from retranslocation pool (gN/m2/s) retransn_to_npool => cnveg_nitrogenflux_inst%retransn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of retranslocated N (gN/m2/s) @@ -1359,6 +1400,7 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & frootn_to_retransn => cnveg_nitrogenflux_inst%frootn_to_retransn_patch , & ! Output: [real(r8) (:) ] livestemn_to_retransn => cnveg_nitrogenflux_inst%livestemn_to_retransn_patch,& ! Output: [real(r8) (:) ] livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) livestem N + livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) livestem N frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral N btran => energyflux_inst%btran_patch , & ! Input: [real(r8) (:) ] transpiration wetness factor (0 to 1) @@ -1367,7 +1409,7 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & ) ! set time steps - dt = get_step_size_real() + dt = real( get_step_size(), r8 ) ! set number of days to recover negative cpool dayscrecover = params_inst%dayscrecover ! loop over patches to assess the total plant N demand @@ -1652,7 +1694,32 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & ! leaf CN ratio this%actual_leafcn(p) = leafc(p) / leafn(p) end if - + ! WW added here to simplify diagnostics + if (leafn_storage(p) < n_min ) then + this%actual_storage_leafcn(p) = spval + else + this%actual_storage_leafcn(p) = leafc_storage(p) / leafn_storage(p) + end if + + + ! when we have "if (livestemn(p) == 0.0_r8)" below then we + ! have floating overflow (out of floating point range) + ! error in "actual_livestemcn(p) = livestemc(p) / livestemn(p)" + if (woody(ivt(p)) == 1.0_r8) then + if (livestemn(p) < n_min ) then + ! to avoid division by zero, and to set livestemcn to missing value for history files + this%actual_livestemcn(p) = spval + else + ! livestem CN ratio + this%actual_livestemcn(p) = livestemc(p) / livestemn(p) + end if + + if (livestemn_storage(p) < n_min ) then + this%actual_livestemcn_storage(p) = spval + else + this%actual_livestemcn_storage(p) = livestemc(p) / livestemn_storage(p) + end if + end if if (nscalar_opt) then From 375e230db7c255f6d596955ce95355089a157db2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 21 May 2020 10:37:55 -0600 Subject: [PATCH 0904/1973] Update ChangeLog --- doc/ChangeLog | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 133 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 1371d6bd48..b86e9f5a75 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,136 @@ =============================================================== +Tag name: ctsm1.0.dev095 +Originator(s): sacks (Bill Sacks) +Date: Thu May 21 10:25:16 MDT 2020 +One-line Summary: Update cime and cmeps externals; rework initialization of CNFire object + +Purpose of changes +------------------ + +Main change is to update cime and cmeps externals. cime is now +essentially at the version used in cesm2_2_beta05 (but with one change +backed out); cmeps is at latest master. + +Also, reworks initialization of CNFire object to avoid occasional +segmentation faults. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1018 (Occasional seg faults when initializing + CNFire object) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none +- Note: Because of a change in cime, datm now uses netcdf rather than + pnetcdf, but it doesn't seem that that impacts performance + significantly + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + + cheyenne tests pass; some answer changes as expected (as noted below) + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: + - cheyenne_gnu - due to compiler version update + - nuopc - presumably due to the major cmeps update + - what platforms/compilers: see above + - nature of change (roundoff; larger than roundoff/same climate; new climate): + - Not investigated + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: N/A + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: cime5.8.19 -> branch_tags/cime5.8.23_a01 + (same as cime5.8.23, but reverts to using pio1 for mpi-serial cases, + since some mpi-serial cases failed with pio2) +- cmeps + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev094 Originator(s): sacks (Bill Sacks) Date: Fri May 15 13:41:01 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index e9a72423ec..235aa8afc5 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev095 sacks 05/21/2020 Update cime and cmeps externals; rework initialization of CNFire object ctsm1.0.dev094 sacks 05/15/2020 Minor bug fixes needed for latest cime ctsm1.0.dev093 erik 05/01/2020 Bring in changes from release-clm5.0 branch to master release-clm5.0.30 erik 01/21/2020 Update FATES to sci.1.30.0_api.8.0.0 From 998e565d983af6e29ff4edb530384f216a5ddf3d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 21 May 2020 10:38:44 -0600 Subject: [PATCH 0905/1973] Add note to changelog --- doc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index b86e9f5a75..7af6f51ad6 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -108,6 +108,10 @@ Changes answers relative to baseline: YES - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated + I have verified that gnu tests in 59d1dd4a are identical to those + in dcaad375 - i.e., the rework of the initialization logic for fire + didn't change answers + If bitwise differences were observed, how did you show they were no worse than roundoff? N/A From d4cf60f7780bac1e18d68f4d4f6480786ac695d4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 21 May 2020 11:47:42 -0600 Subject: [PATCH 0906/1973] Point to new smallville year-2000 surface dataset Generated from this branch by running: make -f Makefile.data crop-smallville after first building mksurfdata_map using an environment loaded from a recent cheyenne_intel case. --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 2752f17214..08101357f3 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -781,7 +781,7 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_4x5_hist_78pfts_CMIP6_simyr2000 lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_simyr2000_c190214.nc -lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_smallvilleIA_hist_78pfts_CMIP6_simyr2000_c190214.nc +lnd/clm2/surfdata_map/ctsm1.0.dev094-2-g633be0eb/surfdata_1x1_smallvilleIA_hist_78pfts_CMIP6_simyr2000_c200521.nc lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c190303.nc From d112f2e89f42d6309c6eb1a343d8413a49e88085 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 21 May 2020 12:09:37 -0600 Subject: [PATCH 0907/1973] Remove the cropColdStart testmods dir It was identical to coldStart --- cime_config/testdefs/testlist_clm.xml | 2 +- .../testdefs/testmods_dirs/clm/cropColdStart/include_user_mods | 1 - .../testdefs/testmods_dirs/clm/cropColdStart/shell_commands | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index d8e5bf02ff..8c8b8ad69c 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -348,7 +348,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands b/cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands deleted file mode 100755 index 2a9f09bd75..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange CLM_FORCE_COLDSTART="on" From 8368f222ca6ac6d68494935fd22f8850c132f9bc Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 21 May 2020 13:01:44 -0600 Subject: [PATCH 0908/1973] Change smallville ERS_Lm20 test to be cold start This was the intent when I first created the test: The point of this test is to test crop restart shortly after cold start. It later accidentally turned into a test that used spun-up initial conditions (when we changed just about everything to use spun-up initial conditions); this commit restores it to being cold start. --- cime_config/testdefs/testlist_clm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 8c8b8ad69c..4ea50c52e2 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -905,13 +905,13 @@ - + - + From a83bddfb4e7d91f4141c7a59162afe243fece50e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 21 May 2020 13:12:55 -0600 Subject: [PATCH 0909/1973] Add a test covering switchgrass & miscanthus I particularly want isotopes to be on for this test --- cime_config/testdefs/testlist_clm.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 4ea50c52e2..58a7e4344c 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -914,6 +914,15 @@ + + + + + + + + + From 28dad0479297309b9ebeabbcb8e5be10a52c3013 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 20 Feb 2020 16:01:19 -0700 Subject: [PATCH 0910/1973] Make gindex_ocn intent(inout) rather than intent(out) Although gindex_ocn could be intent(out), intel18.0.3 generates a runtime segmentation fault in runs that don't have this argument present when this is declared intent(out). (It works fine on intel 19.0.2 when declared as intent(out).) Resolves ESCOMP/ctsm#930 --- src/main/clm_initializeMod.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index dc5e8f8d40..442a77c36b 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -63,7 +63,12 @@ subroutine initialize1(gindex_ocn) use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp ! ! !ARGUMENTS - integer, pointer, optional, intent(out) :: gindex_ocn(:) ! If present, this will hold the decomposition of ocean points (which is needed for the nuopc interface); note that this variable is allocated here, and is assumed to start unallocated + ! COMPILER_BUG(wjs, 2020-02-20, intel18.0.3) Although gindex_ocn could be + ! intent(out), intel18.0.3 generates a runtime segmentation fault in runs that don't + ! have this argument present when this is declared intent(out). (It works fine on + ! intel 19.0.2 when declared as intent(out).) See also + ! https://github.com/ESCOMP/CTSM/issues/930. + integer, pointer, optional, intent(inout) :: gindex_ocn(:) ! If present, this will hold the decomposition of ocean points (which is needed for the nuopc interface); note that this variable is allocated here, and is assumed to start unallocated ! ! !LOCAL VARIABLES: integer :: ier ! error status From 260c0f6d77eec583922859878cfcd4c445f83053 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 21 May 2020 17:23:44 -0600 Subject: [PATCH 0911/1973] First draft of ChangeLog --- doc/ChangeLog | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 114 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7af6f51ad6..e767968b3d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,117 @@ =============================================================== +Tag name: ctsm1.0.dev096 +Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) +Date: Thu May 21 15:00:03 MDT 2020 +One-line Summary: Gridcell-level balance checks for carbon and nitrogen + +Purpose of changes +------------------ + + Bracket the model's time-step loop to calculate balance checks at the + gridcell level because there are terms in the carbon and nitrogen + cycles not accounted for at the column level. Balance checks at the + column level remain unchanged for now. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #314 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: + @billsacks + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- + izumi ------- + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: + - what platforms/compilers: + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/CTSM/pull/984 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev095 Originator(s): sacks (Bill Sacks) Date: Thu May 21 10:25:16 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 235aa8afc5..d5d77f901d 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev096 slevis 05/21/2020 Gridcell-level balance checks for carbon and nitrogen ctsm1.0.dev095 sacks 05/21/2020 Update cime and cmeps externals; rework initialization of CNFire object ctsm1.0.dev094 sacks 05/15/2020 Minor bug fixes needed for latest cime ctsm1.0.dev093 erik 05/01/2020 Bring in changes from release-clm5.0 branch to master From 74b560715f378cfd20e09d52a828c6a5c90b5cd4 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 21 May 2020 19:20:14 -0600 Subject: [PATCH 0912/1973] Second draft of ChangeLog --- doc/ChangeLog | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index e767968b3d..469769ba28 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev096 Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) -Date: Thu May 21 15:00:03 MDT 2020 +Date: Thu May 21 19:18:24 MDT 2020 One-line Summary: Gridcell-level balance checks for carbon and nitrogen Purpose of changes @@ -79,8 +79,8 @@ CTSM testing: regular tests (aux_clm): - cheyenne ---- - izumi ------- + cheyenne ---- OK + izumi ------- PASS If the tag used for baseline comparisons was NOT the previous tag, note that here: @@ -88,18 +88,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? +Changes answers relative to baseline: No Detailed list of changes From e00a604d1b34b9e1bc0e0236427fa1282b47ae88 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 22 May 2020 09:50:45 -0600 Subject: [PATCH 0913/1973] back out one column per patch changes --- bld/CLMBuildNamelist.pm | 9 --------- bld/namelist_files/namelist_defaults_ctsm.xml | 3 --- bld/namelist_files/namelist_definition_ctsm.xml | 5 ----- src/main/clm_varctl.F90 | 6 ------ src/main/controlMod.F90 | 4 ---- src/main/initGridCellsMod.F90 | 12 ++++++------ src/main/lnd2glcMod.F90 | 4 +--- src/main/subgridMod.F90 | 12 +++--------- 8 files changed, 10 insertions(+), 45 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index e2909f1b14..bf0e094f15 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1504,7 +1504,6 @@ sub process_namelist_inline_logic { setup_logic_subgrid($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_fertilizer($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_grainproduct($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_pftsoilcolumn($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_soilstate($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_demand($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_surface_dataset($opts, $nl_flags, $definition, $defaults, $nl); @@ -2078,14 +2077,6 @@ sub error_if_set { } } - -#------------------------------------------------------------------------------- -sub setup_logic_pftsoilcolumn { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_individual_pft_soil_column'); -} - #------------------------------------------------------------------------------- sub setup_logic_soilstate { diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 58648de067..4a9cc3f25b 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -134,9 +134,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .true. .false. - -.false. - 1 0 diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index f46c56c464..dd98f7e4f3 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -144,11 +144,6 @@ specify spatially variable soil thickness. If not present, use bottom of soil column (nlevsoi). - -If TRUE, each pft exists on a separate soil column. - - Index of rooting profile for water diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 1fd0335fe3..f65a6b96e9 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -268,12 +268,6 @@ module clm_varctl logical, public :: use_biomass_heat_storage = .false. ! true => include biomass heat storage in canopy energy budget - !---------------------------------------------------------- - ! each pft has individual soil column switch - !---------------------------------------------------------- - - logical, public :: use_individual_pft_soil_column = .false. ! true => each pft exists on its own soil column - !---------------------------------------------------------- ! bedrock / soil depth switch !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index e2773ffe93..f787726b38 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -242,8 +242,6 @@ subroutine control_init( ) namelist /clm_inparm/ use_biomass_heat_storage - namelist /clm_inparm/ use_individual_pft_soil_column - namelist /clm_inparm/ use_hydrstress namelist /clm_inparm/ use_dynroot @@ -747,8 +745,6 @@ subroutine control_spmd() call mpi_bcast (use_biomass_heat_storage, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_individual_pft_soil_column, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_hydrstress, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_dynroot, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 index d60e620a68..6fd96ed188 100644 --- a/src/main/initGridCellsMod.F90 +++ b/src/main/initGridCellsMod.F90 @@ -35,7 +35,7 @@ module initGridCellsMod public initGridcells ! initialize sub-grid gridcell mapping ! ! !PRIVATE MEMBER FUNCTIONS: - private set_landunit_veg + private set_landunit_veg_compete private set_landunit_wet_lake private set_landunit_ice_mec private set_landunit_crop_noncompete @@ -60,7 +60,7 @@ subroutine initGridcells(glc_behavior) use subgridWeightsMod , only : compute_higher_order_weights use landunit_varcon , only : istsoil, istwet, istdlak, istice_mec use landunit_varcon , only : isturb_tbd, isturb_hd, isturb_md, istcrop - use clm_varctl , only : use_fates,use_individual_pft_soil_column + use clm_varctl , only : use_fates use shr_const_mod , only : SHR_CONST_PI ! ! !ARGUMENTS: @@ -135,7 +135,7 @@ subroutine initGridcells(glc_behavior) ! Determine naturally vegetated landunit do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_veg( & + call set_landunit_veg_compete( & ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) end do @@ -215,10 +215,10 @@ subroutine initGridcells(glc_behavior) end subroutine initGridcells !------------------------------------------------------------------------ - subroutine set_landunit_veg (ltype, gi, li, ci, pi) + subroutine set_landunit_veg_compete (ltype, gi, li, ci, pi) ! ! !DESCRIPTION: - ! Initialize vegetated landunit + ! Initialize vegetated landunit with competition ! ! !USES use clm_instur, only : wt_lunit, wt_nat_patch @@ -273,7 +273,7 @@ subroutine set_landunit_veg (ltype, gi, li, ci, pi) SHR_ASSERT_FL(ncols_added == ncols, sourcefile, __LINE__) SHR_ASSERT_FL(npatches_added == npatches, sourcefile, __LINE__) - end subroutine set_landunit_veg + end subroutine set_landunit_veg_compete !------------------------------------------------------------------------ subroutine set_landunit_wet_lake (ltype, gi, li, ci, pi) diff --git a/src/main/lnd2glcMod.F90 b/src/main/lnd2glcMod.F90 index b2a60dcfb1..f48b3ef8b2 100644 --- a/src/main/lnd2glcMod.F90 +++ b/src/main/lnd2glcMod.F90 @@ -204,9 +204,7 @@ subroutine update_lnd2glc(this, bounds, num_do_smb_c, filter_do_smb_c, & ! Make sure we haven't already assigned the coupling fields for this point ! (this could happen, for example, if there were multiple columns in the ! istsoil landunit, which we aren't prepared to handle) -!FIXTHIS!!! if (fields_assigned(g,n)) then -! This is commented out so that multiple soil columns can be enabled - if (1==2) then + if (fields_assigned(g,n)) then write(iulog,*) subname//' ERROR: attempt to assign coupling fields twice for the same index.' write(iulog,*) 'One possible cause is having multiple columns in the istsoil landunit,' write(iulog,*) 'which this routine cannot handle.' diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index f49ededca0..31d9dd585b 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -13,7 +13,7 @@ module subgridMod use shr_kind_mod , only : r8 => shr_kind_r8 use spmdMod , only : masterproc use abortutils , only : endrun - use clm_varctl , only : iulog,use_individual_pft_soil_column + use clm_varctl , only : iulog use clm_instur , only : wt_lunit, wt_nat_patch, urban_valid, wt_cft use landunit_varcon, only : istcrop, istdlak, istwet, isturb_tbd, isturb_hd, isturb_md use glcBehaviorMod , only : glc_behavior_type @@ -130,7 +130,6 @@ subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits) ! ! !USES use clm_varpar, only : natpft_lb, natpft_ub - use clm_varctl, only : use_individual_pft_soil_column ! ! !ARGUMENTS: integer, intent(in) :: gi ! grid cell index @@ -153,13 +152,8 @@ subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits) end do if (npatches > 0) then - if(use_individual_pft_soil_column) then - ! Assume one soil column for each patch - ncols = npatches - else - ! Assume that the vegetated landunit has one column - ncols = 1 - end if + ! Assume that the vegetated landunit has one column + ncols = 1 nlunits = 1 else From 67285ba9f0b4d5210e691c2f7045ea8859de3e46 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 22 May 2020 15:29:52 -0600 Subject: [PATCH 0914/1973] Fifth round of moving parameters to param file. BFB according to the following tests: ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive ERS_D_Ld6.f10_f10_musgs.I1850Clm45BgcCrop.cheyenne_intel.clm-clm50CMIP6frc clm_short test suite Parameters moved: prh30 (was hardcoded as 0.7 in CNFireLi2016Mod) ignition_efficiency (was hardcoded as 0.22 in CNFireLi2016Mod) tpu25ratio (was hardcoded as 0.167 in PhotosynthesisMod) kp25ratio (was hardcoded as 20000 in PhotosynthesisMod) bsw_adjustfactor (set to 1.0, did not previously exist in SoilStateInitTimeConstMod) hksat_adjustfactor (set to 1.0, did not previously exist in SoilStateInitTimeConstMod) sucsat_adjustfactor (set to 1.0, did not previously exist in SoilStateInitTimeConstMod) watsat_adjustfactor (set to 1.0, did not previously exist in SoilStateInitTimeConstMod) --- src/biogeochem/CNFireLi2016Mod.F90 | 35 +++++++++++++++-- src/biogeophys/PhotosynthesisMod.F90 | 20 ++++++---- src/biogeophys/SoilStateInitTimeConstMod.F90 | 40 ++++++++++++++------ src/main/readParamsMod.F90 | 2 + 4 files changed, 75 insertions(+), 22 deletions(-) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index cc1108eaa4..3a5518328c 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -48,6 +48,7 @@ module CNFireLi2016Mod ! ! !PUBLIC TYPES: public :: cnfire_li2016_type + public :: readParams ! type, extends(cnfire_base_type) :: cnfire_li2016_type private @@ -67,6 +68,12 @@ module CNFireLi2016Mod end interface cnfire_li2016_type !----------------------------------------------------------------------- + type, private :: params_type + real(r8) :: prh30 ! Factor related to dependence of fuel combustibility on 30-day running mean of relative humidity (unitless) + real(r8) :: ignition_efficiency ! Ignition efficiency of cloud-to-ground lightning (unitless) + end type params_type + type(params_type), private :: params_inst + character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -82,6 +89,28 @@ type(cnfire_li2016_type) function constructor() constructor%need_lightning_and_popdens = .true. end function constructor + !----------------------------------------------------------------------- + subroutine readParams( ncid ) + ! + ! !USES: + use ncdio_pio, only: file_desc_t + use paramUtilMod, only: readNcdioScalar + ! + ! !ARGUMENTS: + implicit none + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=*), parameter :: subname = 'readCNFireLi2016Params' + !-------------------------------------------------------------------- + + ! Factor related to dependence of fuel combustibility on 30-day running mean of relative humidity (unitless) + call readNcdioScalar(ncid, 'prh30', subname, params_inst%prh30) + ! Ignition efficiency of cloud-to-ground lightning (unitless) + call readNcdioScalar(ncid, 'ignition_efficiency', subname, params_inst%ignition_efficiency) + + end subroutine readParams + !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & @@ -598,7 +627,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ if (trotr1_col(c)+trotr2_col(c)<=0.6_r8) then afuel =min(1._r8,max(0._r8,(fuelc(c)-2500._r8)/(5000._r8-2500._r8))) arh=1._r8-max(0._r8, min(1._r8,(forc_rh(g)-rh_low)/(rh_hgh-rh_low))) - arh30=1._r8-max(0.7_r8, min(1._r8,rh30_col(c)/90._r8)) + arh30=1._r8-max(params_inst%prh30, min(1._r8,rh30_col(c)/90._r8)) if (forc_rh(g) < rh_hgh.and. wtlf(c) > 0._r8 .and. tsoi17(c)> SHR_CONST_TKFRZ)then fire_m = ((afuel*arh30+(1._r8-afuel)*arh)**1.5_r8)*((1._r8 -max(0._r8,& min(1._r8,(btran_col(c)/wtlf(c)-bt_min)/(bt_max-bt_min))))**0.5_r8) @@ -607,8 +636,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if lh = pot_hmn_ign_counts_alpha*6.8_r8*hdmlf**(0.43_r8)/30._r8/24._r8 fs = 1._r8-(0.01_r8+0.98_r8*exp(-0.025_r8*hdmlf)) - ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(SHR_CONST_PI/180._r8*3*min(60._r8,abs(grc%latdeg(g)))))*0.22_r8) & - *(1._r8-fs)*(1._r8-cropf_col(c)) + ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(SHR_CONST_PI/180._r8*3*min(60._r8,abs(grc%latdeg(g)))))* & + params_inst%ignition_efficiency)*(1._r8-fs)*(1._r8-cropf_col(c)) nfire(c) = ig/secsphr*fb*fire_m*lgdp_col(c) !fire counts/km2/sec Lb_lf = 1._r8+10._r8*(1._r8-EXP(-0.06_r8*forc_wind(g))) spread_m = fire_m**0.5_r8 diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index ef61d098b6..fb86bcde28 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -100,6 +100,8 @@ module PhotosynthesisMod real(r8) :: tpuhd ! Deactivation energy for tpu (J/mol) real(r8) :: lmrhd ! Deactivation energy for lmr (J/mol) real(r8) :: lmrse ! Entropy term for lmr (J/mol/K) + real(r8) :: tpu25ratio ! Ratio of tpu25top to vcmax25top (unitless) + real(r8) :: kp25ratio ! Ratio of kp25top to vcmax25top (unitless) real(r8), allocatable, public :: krmax (:) real(r8), allocatable, private :: kmax (:,:) real(r8), allocatable, private :: psi50 (:,:) @@ -733,6 +735,10 @@ subroutine readParams ( this, ncid ) call readNcdioScalar(ncid, 'lmrhd', subname, params_inst%lmrhd) ! Entropy term for lmr (J/mol/K) call readNcdioScalar(ncid, 'lmrse', subname, params_inst%lmrse) + ! Ratio of tpu25top to vcmax25top (unitless) + call readNcdioScalar(ncid, 'tpu25ratio', subname, params_inst%tpu25ratio) + ! Ratio of kp25top to vcmax25top (unitless) + call readNcdioScalar(ncid, 'kp25ratio', subname, params_inst%kp25ratio) end subroutine readParams @@ -1416,8 +1422,8 @@ subroutine Photosynthesis ( bounds, fn, filterp, & ! used jmax25 = 1.97 vcmax25, from Wullschleger (1993) Journal of Experimental Botany 44:907-920. jmax25top = (2.59_r8 - 0.035_r8*min(max((t10(p)-tfrz),11._r8),35._r8)) * vcmax25top - tpu25top = 0.167_r8 * vcmax25top - kp25top = 20000._r8 * vcmax25top + tpu25top = params_inst%tpu25ratio * vcmax25top + kp25top = params_inst%kp25ratio * vcmax25top ! Nitrogen scaling factor. Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 used ! kn = 0.11. Here, derive kn from vcmax25 as in Lloyd et al (2010) Biogeosciences, 7, 1833-1859 @@ -1529,7 +1535,7 @@ subroutine Photosynthesis ( bounds, fn, filterp, & if(use_luna.and.c3flag(p).and.crop(patch%itype(p))== 0)then vcmax25 = photosyns_inst%vcmx25_z_patch(p,iv) jmax25 = photosyns_inst%jmx25_z_patch(p,iv) - tpu25 = 0.167_r8 * vcmax25 + tpu25 = params_inst%tpu25ratio * vcmax25 !Implement scaling of Vcmax25 from sunlit average to shaded canopy average value. RF & GBB. 1 July 2016 if(phase == 'sha'.and.surfalb_inst%vcmaxcintsun_patch(p).gt.0._r8.and.nlevcan==1) then vcmax25 = vcmax25 * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) @@ -2975,8 +2981,8 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & ! used jmax25 = 1.97 vcmax25, from Wullschleger (1993) Journal of Experimental Botany 44:907-920. jmax25top = (2.59_r8 - 0.035_r8*min(max((t10(p)-tfrz),11._r8),35._r8)) * vcmax25top - tpu25top = 0.167_r8 * vcmax25top - kp25top = 20000._r8 * vcmax25top + tpu25top = params_inst%tpu25ratio * vcmax25top + kp25top = params_inst%kp25ratio * vcmax25top luvcmax25top(p) = vcmax25top lujmax25top(p) = jmax25top lutpu25top(p)=tpu25top @@ -3111,8 +3117,8 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & vcmax25_sha = photosyns_inst%vcmx25_z_patch(p,iv) jmax25_sun = photosyns_inst%jmx25_z_patch(p,iv) jmax25_sha = photosyns_inst%jmx25_z_patch(p,iv) - tpu25_sun = 0.167_r8 * vcmax25_sun - tpu25_sha = 0.167_r8 * vcmax25_sha + tpu25_sun = params_inst%tpu25ratio * vcmax25_sun + tpu25_sha = params_inst%tpu25ratio * vcmax25_sha if(surfalb_inst%vcmaxcintsun_patch(p).gt.0._r8.and.nlevcan==1) then vcmax25_sha = vcmax25_sun * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) jmax25_sha = jmax25_sun * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 index 5993d0f62b..1da04f21ec 100644 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ b/src/biogeophys/SoilStateInitTimeConstMod.F90 @@ -26,14 +26,18 @@ module SoilStateInitTimeConstMod ! !PRIVATE DATA: type, private :: params_type - real(r8) :: tkd_sand ! Thermal conductivity of sand (W/m/K) - real(r8) :: tkd_clay ! Thermal conductivity of clay (W/m/K) - real(r8) :: tkd_om ! Thermal conductivity of dry organic matter (Farouki, 1981) (W/m/K) - real(r8) :: tkm_om ! Thermal conductivity of organic matter (Farouki, 1986) (W/m/K) - real(r8) :: pd ! Particle density of soil (kg/m3) - real(r8) :: csol_clay ! Heat capacity of clay *10^6 (J/K/m3) - real(r8) :: csol_om ! Heat capacity of peat soil *10^6 (Farouki, 1986) (J/K/m3) - real(r8) :: csol_sand ! Heat capacity of sand *10^6 (J/K/m3) + real(r8) :: tkd_sand ! Thermal conductivity of sand (W/m/K) + real(r8) :: tkd_clay ! Thermal conductivity of clay (W/m/K) + real(r8) :: tkd_om ! Thermal conductivity of dry organic matter (Farouki, 1981) (W/m/K) + real(r8) :: tkm_om ! Thermal conductivity of organic matter (Farouki, 1986) (W/m/K) + real(r8) :: pd ! Particle density of soil (kg/m3) + real(r8) :: csol_clay ! Heat capacity of clay *10^6 (J/K/m3) + real(r8) :: csol_om ! Heat capacity of peat soil *10^6 (Farouki, 1986) (J/K/m3) + real(r8) :: csol_sand ! Heat capacity of sand *10^6 (J/K/m3) + real(r8) :: bsw_adjustfactor ! Adjustment factor for bsw (unitless) + real(r8) :: hksat_adjustfactor ! Adjustment factor for hksat (unitless) + real(r8) :: sucsat_adjustfactor ! Adjustment factor for sucsat (unitless) + real(r8) :: watsat_adjustfactor ! Adjustment factor for watsat (unitless) end type params_type type(params_type), private :: params_inst @@ -131,6 +135,14 @@ subroutine readParams( ncid ) call readNcdioScalar(ncid, 'csol_om', subname, params_inst%csol_om) ! Heat capacity of sand *10^6 (J/K/m3) call readNcdioScalar(ncid, 'csol_sand', subname, params_inst%csol_sand) + ! Adjustment factor for bsw (unitless) + call readNcdioScalar(ncid, 'bsw_adjustfactor', subname, params_inst%bsw_adjustfactor) + ! Adjustment factor for hksat (unitless) + call readNcdioScalar(ncid, 'hksat_adjustfactor', subname, params_inst%hksat_adjustfactor) + ! Adjustment factor for sucsat (unitless) + call readNcdioScalar(ncid, 'sucsat_adjustfactor', subname, params_inst%sucsat_adjustfactor) + ! Adjustment factor for watsat (unitless) + call readNcdioScalar(ncid, 'watsat_adjustfactor', subname, params_inst%watsat_adjustfactor) end subroutine readParams @@ -488,11 +500,14 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) om_hksat = max(0.28_r8 - 0.2799_r8*(zsoi(lev)/zsapric), xksat) soilstate_inst%bd_col(c,lev) = (1._r8 - soilstate_inst%watsat_col(c,lev))*params_inst%pd - soilstate_inst%watsat_col(c,lev) = (1._r8 - om_frac) * soilstate_inst%watsat_col(c,lev) + om_watsat*om_frac + soilstate_inst%watsat_col(c,lev) = params_inst%watsat_adjustfactor * ( (1._r8 - om_frac) * & + soilstate_inst%watsat_col(c,lev) + om_watsat*om_frac ) tkm = (1._r8-om_frac) * (params_inst%tkd_sand*sand+params_inst%tkd_clay*clay)/ & (sand+clay)+params_inst%tkm_om*om_frac ! W/(m K) - soilstate_inst%bsw_col(c,lev) = (1._r8-om_frac) * (2.91_r8 + 0.159_r8*clay) + om_frac*om_b - soilstate_inst%sucsat_col(c,lev) = (1._r8-om_frac) * soilstate_inst%sucsat_col(c,lev) + om_sucsat*om_frac + soilstate_inst%bsw_col(c,lev) = params_inst%bsw_adjustfactor * ( (1._r8-om_frac) * & + (2.91_r8 + 0.159_r8*clay) + om_frac*om_b ) + soilstate_inst%sucsat_col(c,lev) = params_inst%sucsat_adjustfactor * ( (1._r8-om_frac) * & + soilstate_inst%sucsat_col(c,lev) + om_sucsat*om_frac ) soilstate_inst%hksat_min_col(c,lev) = xksat ! perc_frac is zero unless perf_frac greater than percolation threshold @@ -513,7 +528,8 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) else uncon_hksat = 0._r8 end if - soilstate_inst%hksat_col(c,lev) = uncon_frac*uncon_hksat + (perc_frac*om_frac)*om_hksat + soilstate_inst%hksat_col(c,lev) = params_inst%hksat_adjustfactor * ( uncon_frac*uncon_hksat + & + (perc_frac*om_frac)*om_hksat ) soilstate_inst%tkmg_col(c,lev) = tkm ** (1._r8- soilstate_inst%watsat_col(c,lev)) diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index ab31aa403c..74a7c14d16 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -31,6 +31,7 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) use CNMRespMod , only : readCNMRespParams => readParams use CNFUNMod , only : readCNFUNParams => readParams use CNPhenologyMod , only : readCNPhenolParams => readParams + use CNFireLi2016Mod , only : readCNFireLi2016Params => readParams use SoilBiogeochemCompetitionMod , only : readSoilBiogeochemCompetitionParams => readParams use SoilBiogeochemNLeachingMod , only : readSoilBiogeochemNLeachingParams => readParams use SoilBiogeochemNitrifDenitrifMod , only : readSoilBiogeochemNitrifDenitrifParams => readParams @@ -87,6 +88,7 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) call readCNMRespParams(ncid) call readCNFUNParams(ncid) call readCNPhenolParams(ncid) + call readCNFireLi2016Params(ncid) end if ! From 4665c9ce138402076362133986823c5cb2e8928c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 24 May 2020 15:58:24 -0600 Subject: [PATCH 0915/1973] SSP test: only do symlink if needed Resolves ESCOMP/CTSM#1021 (at least, I think it will: I'm about to test it) --- cime_config/SystemTests/ssp.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cime_config/SystemTests/ssp.py b/cime_config/SystemTests/ssp.py index 892128ba5e..26337d323d 100644 --- a/cime_config/SystemTests/ssp.py +++ b/cime_config/SystemTests/ssp.py @@ -83,7 +83,14 @@ def run_phase(self): rest_path = os.path.join(dout_sr, "rest", "{}-{}".format(refdate, refsec)) for item in glob.glob("{}/*{}*".format(rest_path, refdate)): - os.symlink(item, os.path.join(rundir, os.path.basename(item))) + link_name = os.path.join(rundir, os.path.basename(item)) + if os.path.islink(link_name) and os.readlink(link_name) == item: + # Link is already set up correctly: do nothing + # (os.symlink raises an exception if you try to replace an + # existing file) + pass + else: + os.symlink(item, link_name) for item in glob.glob("{}/*rpointer*".format(rest_path)): shutil.copy(item, rundir) From 0e3aa2b4c50d2b5e1754d517aa946c47d37cd9c1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 25 May 2020 15:44:37 -0600 Subject: [PATCH 0916/1973] Update ChangeLog --- doc/ChangeLog | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 190 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 469769ba28..ef1b03e5c9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,193 @@ =============================================================== +Tag name: ctsm1.0.dev097 +Originator(s): ycheng (Yanyan Cheng) +Date: Mon May 25 15:14:56 MDT 2020 +One-line Summary: Add two bioenergy crops (switchgrass and miscanthus) + +Purpose of changes +------------------ + +Main change is from Yanyan Cheng: adding parameters and code for two +bioenergy crops, switchgrass and miscanthus. Along with this, there is a +new potential flux from crop leaves and stems to the crop product pool +at harvest, representing biofuel products; a new pft-specific parameter +controls this flux (biofuel_harvfrac). Currently, the out-of-the-box +surface datasets do not specify any area for these crops, but the new +parameter file will allow them to be present if specified on the surface +dataset or landuse_timeseries file. Note that this is only an option for +CLM5.0, NOT for CLM4.5. (See https://github.com/ESCOMP/CTSM/pull/884 for +details.) + +Also, some minor fixes from Bill Sacks: See notes under "bugs fixed" +below. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#203 - Fixes creation of harvest-related variables + on surface datasets created with the all_veg option - smallville, + PTCLM, etc. (documented in https://github.com/ESCOMP/CTSM/pull/1019) +- Resolves ESCOMP/CTSM#930 - Makes gindex_ocn intent(inout) rather than + intent(out) +- Resolves ESCOMP/CTSM#1021 - Changes SSP test to only do symlink if + needed + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- For transient crop cases, now more crops in memory. This creates a + need for interpolation of initial conditions for initial conditions + generated from a transient case. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): +- Changed parameter values for switchgrass and miscanthus (only for clm5.0) +- New pft-specific parameter, biofuel_harvfrac (for both clm4.5 and clm5.0) + +Changes to the datasets (e.g., parameter, surface or initial files): +- New parameter files with the above changes + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Changed smallville ERS_Lm20 test to be cold start (see comment in + commit 8368f222 for details) +- Added a multi-year smallville test that includes these new crops + +Code reviewed by: Bill Sacks, Danica Lombardozzi + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - ok + + Pass except for expected baseline failures + + Ran on 633be0eb, with comparison against ctsm1.0.dev095; tests pass + except these expected baseline failures: + + 030 blf84 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools ....................\c + rc=7 FAIL + + 032 blfc4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools ..............\c + rc=7 FAIL + + Diffs for these are just in the harvest-related fields on the surface dataset, as expected. + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + + For cheyenne testing: a few tests had baseline failures. The + differences just arise in the h1 (vector) files, due to differences + in dimension sizes. These differences are expected. See below for + details. + + Ran most testing on 8309c213. Reran two SSP tests on 4665c9ce + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but diagnostic only due to +change in dimension sizes - does not change answers in any meaningful +way + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: Transient CLM50 cases with crops; just + changes dimensions on vector (h1) history files + - what platforms/compilers: All + - nature of change (roundoff; larger than roundoff/same climate; new climate): + diagnostic change only + + Differences were observed in the following tests: + + ERS_Ly3_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropQianGs.cheyenne_gnu.clm-cropMonthOutput + SMS_Ld5.f10_f10_musgs.ISSP245Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start + SMS_Ld5.f10_f10_musgs.ISSP370Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start + ERP_D_Ld10_P36x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_decStart + ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive + ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput + ERS_D_Ld7_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_intel.clm-decStart1851_noinitial + ERS_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput + ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput + ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropQianGs.cheyenne_intel.clm-cropMonthOutput + LCISO_Lm13.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_monthly + SMS_Ld5.f10_f10_musgs.ISSP585Clm50BgcCrop.cheyenne_intel.clm-ciso_dec2050Start + + The differences just arise in the h1 files, due to differences in + dimension sizes. I reran these tests with a paramfile where I + reverted the mergeToPft variable; then they were all bfb with + master. + + Other than this, there were FIELDLIST differences, as expected. + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: N/A + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/CTSM/pull/884 +- https://github.com/ESCOMP/CTSM/pull/1019 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev096 Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) Date: Thu May 21 19:18:24 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index d5d77f901d..70151ec457 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev097 ycheng 05/25/2020 Add two bioenergy crops (switchgrass and miscanthus) ctsm1.0.dev096 slevis 05/21/2020 Gridcell-level balance checks for carbon and nitrogen ctsm1.0.dev095 sacks 05/21/2020 Update cime and cmeps externals; rework initialization of CNFire object ctsm1.0.dev094 sacks 05/15/2020 Minor bug fixes needed for latest cime From e28ea2851523008468e94a26f2b56b99fd3d2742 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 25 May 2020 22:43:57 -0600 Subject: [PATCH 0917/1973] Gricell-level error check for methane (CH4) --- src/biogeochem/ch4Mod.F90 | 156 ++++++++++++++++++++++++++++++-------- src/main/clm_driver.F90 | 10 ++- 2 files changed, 131 insertions(+), 35 deletions(-) diff --git a/src/biogeochem/ch4Mod.F90 b/src/biogeochem/ch4Mod.F90 index 8e90f730d4..b833ec4c76 100644 --- a/src/biogeochem/ch4Mod.F90 +++ b/src/biogeochem/ch4Mod.F90 @@ -49,7 +49,8 @@ module ch4Mod ! !PUBLIC MEMBER FUNCTIONS: public :: readParams - public :: ch4_init_balance_check + public :: ch4_init_column_balance_check + public :: ch4_init_gridcell_balance_check public :: ch4 ! !PRIVATE MEMBER FUNCTIONS: @@ -155,7 +156,9 @@ module ch4Mod real(r8), pointer, private :: zwt_ch4_unsat_col (:) ! col depth of water table for unsaturated fraction (m) real(r8), pointer, private :: lake_soilc_col (:,:) ! col total soil organic matter found in level (g C / m^3) (nlevsoi) real(r8), pointer, private :: totcolch4_col (:) ! col total methane found in soil col (g C / m^2) + real(r8), pointer, private :: totcolch4_grc (:) ! grc total methane found in soil col (g C / m^2) real(r8), pointer, private :: totcolch4_bef_col (:) ! col total methane found in soil col, start of timestep (g C / m^2) + real(r8), pointer, private :: totcolch4_bef_grc (:) ! grc total methane found in soil col, start of timestep (g C / m^2) real(r8), pointer, private :: annsum_counter_col (:) ! col seconds since last annual accumulator turnover real(r8), pointer, private :: tempavg_somhr_col (:) ! col temporary average SOM heterotrophic resp. (gC/m2/s) real(r8), pointer, private :: annavg_somhr_col (:) ! col annual average SOM heterotrophic resp. (gC/m2/s) @@ -198,6 +201,7 @@ module ch4Mod real(r8), pointer, public :: o2_decomp_depth_sat_col (:,:) ! col O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) real(r8), pointer, public :: o2_decomp_depth_unsat_col (:,:) ! col O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) real(r8), pointer, public :: ch4_surf_flux_tot_col (:) ! col CH4 surface flux (to atm) (kg C/m**2/s) + real(r8), pointer, public :: ch4_surf_flux_tot_grc (:) ! grc CH4 surface flux (to atm) (kg C/m**2/s) real(r8), pointer, public :: grnd_ch4_cond_patch (:) ! patch tracer conductance for boundary layer [m/s] real(r8), pointer, public :: grnd_ch4_cond_col (:) ! col tracer conductance for boundary layer [m/s] @@ -302,7 +306,9 @@ subroutine InitAllocate(this, bounds) allocate(this%zwt_ch4_unsat_col (begc:endc)) ; this%zwt_ch4_unsat_col (:) = nan allocate(this%lake_soilc_col (begc:endc,1:nlevgrnd)) ; this%lake_soilc_col (:,:) = spval !first time-step allocate(this%totcolch4_col (begc:endc)) ; this%totcolch4_col (:) = nan + allocate(this%totcolch4_grc (begg:endg)) ; this%totcolch4_grc (:) = nan allocate(this%totcolch4_bef_col (begc:endc)) ; this%totcolch4_bef_col (:) = nan + allocate(this%totcolch4_bef_grc (begg:endg)) ; this%totcolch4_bef_grc (:) = nan allocate(this%annsum_counter_col (begc:endc)) ; this%annsum_counter_col (:) = nan allocate(this%tempavg_somhr_col (begc:endc)) ; this%tempavg_somhr_col (:) = nan allocate(this%annavg_somhr_col (begc:endc)) ; this%annavg_somhr_col (:) = nan @@ -316,6 +322,7 @@ subroutine InitAllocate(this, bounds) allocate(this%layer_sat_lag_col (begc:endc,1:nlevgrnd)) ; this%layer_sat_lag_col (:,:) = nan allocate(this%pH_col (begc:endc)) ; this%pH_col (:) = nan allocate(this%ch4_surf_flux_tot_col (begc:endc)) ; this%ch4_surf_flux_tot_col (:) = nan + allocate(this%ch4_surf_flux_tot_grc (begg:endg)) ; this%ch4_surf_flux_tot_grc (:) = nan allocate(this%dyn_ch4bal_adjustments_col (begc:endc)) ; this%dyn_ch4bal_adjustments_col (:) = nan allocate(this%c_atm_grc (begg:endg,1:ngases)) ; this%c_atm_grc (:,:) = nan @@ -337,7 +344,6 @@ subroutine InitAllocate(this, bounds) allocate(this%conc_o2_unsat_col (begc:endc,1:nlevgrnd)) ; this%conc_o2_unsat_col (:,:) = nan allocate(this%o2_decomp_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%o2_decomp_depth_sat_col (:,:) = nan allocate(this%o2_decomp_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%o2_decomp_depth_unsat_col (:,:) = nan - allocate(this%ch4_surf_flux_tot_col (begc:endc)) ; this%ch4_surf_flux_tot_col (:) = nan allocate(this%grnd_ch4_cond_patch (begp:endp)) ; this%grnd_ch4_cond_patch (:) = nan allocate(this%grnd_ch4_cond_col (begc:endc)) ; this%grnd_ch4_cond_col (:) = nan @@ -1554,13 +1560,61 @@ subroutine readParams ( ncid ) end subroutine readParams !----------------------------------------------------------------------- - subroutine ch4_init_balance_check(bounds, num_nolakec, filter_nolakec, num_lakec, filter_lakec, & + subroutine ch4_init_gridcell_balance_check(bounds, num_nolakec, & + filter_nolakec, num_lakec, filter_lakec, ch4_inst) + ! + ! !DESCRIPTION: + ! Calculate beginning gridcell-level ch4 balance for mass conservation + ! check + ! + ! This sets ch4_inst%totcolch4_bef_grc + ! + ! Called before the weight updates done for dynamic landunits and the + ! associated filter updates + ! + ! !USES: + use subgridAveMod, only: c2g + ! + ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds + integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter + integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points + integer , intent(in) :: num_lakec ! number of column lake points in column filter + integer , intent(in) :: filter_lakec(:) ! column filter for lake points + type(ch4_type) , intent(inout) :: ch4_inst + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'ch4_init_gridcell_balance_check' + !----------------------------------------------------------------------- + + ! Initialize to zero for columns outside the filters because will + ! average up to gridcell + ch4_inst%totcolch4_bef_col(bounds%begc:bounds%endc) = 0._r8 + + ! This is only really needed for soilc and lakec, but we use nolakec rather + ! than just soilc for consistency with the other call to ch4_totcolch4 + ! (which computes ch4_inst%totcolch4 over all columns for diagnostic + ! purposes). + call ch4_totcolch4(bounds, num_nolakec, filter_nolakec, num_lakec, & + filter_lakec, ch4_inst, & + ch4_inst%totcolch4_bef_col(bounds%begc:bounds%endc)) + + call c2g( bounds, & + ch4_inst%totcolch4_bef_col(bounds%begc:bounds%endc), & + ch4_inst%totcolch4_bef_grc(bounds%begg:bounds%endg), & + c2l_scale_type= 'unity', l2g_scale_type='unity' ) + + end subroutine ch4_init_gridcell_balance_check + + !----------------------------------------------------------------------- + subroutine ch4_init_column_balance_check(bounds, num_nolakec, filter_nolakec, num_lakec, filter_lakec, & ch4_inst) ! ! !DESCRIPTION: ! Calculate beginning column-level ch4 balance, for mass conservation check ! - ! This sets ch4_inst%totcolch4_bef + ! This sets ch4_inst%totcolch4_bef_col ! ! This should be called after the weight updates due to dynamic landunits, and the ! associated filter updates - i.e., using the new version of the filters. @@ -1576,9 +1630,8 @@ subroutine ch4_init_balance_check(bounds, num_nolakec, filter_nolakec, num_lakec type(ch4_type) , intent(inout) :: ch4_inst ! ! !LOCAL VARIABLES: - integer :: fc, c - character(len=*), parameter :: subname = 'ch4_init_balance_check' + character(len=*), parameter :: subname = 'ch4_init_column_balance_check' !----------------------------------------------------------------------- ! This is only really needed for soilc and lakec, but we use nolakec rather than just @@ -1587,7 +1640,7 @@ subroutine ch4_init_balance_check(bounds, num_nolakec, filter_nolakec, num_lakec call ch4_totcolch4(bounds, num_nolakec, filter_nolakec, num_lakec, filter_lakec, & ch4_inst, ch4_inst%totcolch4_bef_col(bounds%begc:bounds%endc)) - end subroutine ch4_init_balance_check + end subroutine ch4_init_column_balance_check !----------------------------------------------------------------------- @@ -1698,7 +1751,8 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & qflx_surf => waterfluxbulk_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] total surface runoff (mm H2O /s) conc_o2_sat => ch4_inst%conc_o2_sat_col , & ! Input: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - totcolch4_bef => ch4_inst%totcolch4_bef_col , & ! Input: [real(r8) (:) ] total methane in soil column, start of timestep (g C / m^2) + totcolch4_bef_col => ch4_inst%totcolch4_bef_col , & ! Input: [real(r8) (:) ] column-level total methane in soil column, start of timestep (g C / m^2) + totcolch4_bef_grc => ch4_inst%totcolch4_bef_grc , & ! Input: [real(r8) (:) ] gridcell-level total methane in soil column, start of timestep (g C / m^2) grnd_ch4_cond_patch => ch4_inst%grnd_ch4_cond_patch , & ! Input: [real(r8) (:) ] tracer conductance for boundary layer [m/s] grnd_ch4_cond_col => ch4_inst%grnd_ch4_cond_col , & ! Output: [real(r8) (:) ] tracer conductance for boundary layer [m/s] (p2c) @@ -1724,17 +1778,19 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & conc_o2_lake => ch4_inst%conc_o2_lake_col , & ! Output: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) ch4_dfsat_flux => ch4_inst%ch4_dfsat_flux_col , & ! Output: [real(r8) (:) ] CH4 flux to atm due to decreasing finundated (kg C/m^2/s) [+] zwt_ch4_unsat => ch4_inst%zwt_ch4_unsat_col , & ! Output: [real(r8) (:) ] depth of water table for unsaturated fraction (m) - totcolch4 => ch4_inst%totcolch4_col , & ! Output: [real(r8) (:) ] total methane in soil column (g C / m^2) + totcolch4_col => ch4_inst%totcolch4_col , & ! Output: [real(r8) (:) ] column-level total methane in soil column (g C / m^2) + totcolch4_grc => ch4_inst%totcolch4_grc , & ! Output: [real(r8) (:) ] gridcell-level total methane in soil column (g C / m^2) finundated => ch4_inst%finundated_col , & ! Output: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) finundated_pre_snow => ch4_inst%finundated_pre_snow_col , & ! Output: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) before snow - ch4_first_time => ch4_inst%ch4_first_time_col , & ! Output: [logical (:) ] whether this is the first time step that includes ch4 + ch4_first_time_col => ch4_inst%ch4_first_time_col , & ! Output: [logical (:) ] col whether this is the first time step that includes ch4 qflx_surf_lag => ch4_inst%qflx_surf_lag_col , & ! Output: [real(r8) (:) ] time-lagged surface runoff (mm H2O /s) finundated_lag => ch4_inst%finundated_lag_col , & ! Output: [real(r8) (:) ] time-lagged fractional inundated area layer_sat_lag => ch4_inst%layer_sat_lag_col , & ! Output: [real(r8) (:,:) ] Lagged saturation status of soil layer in the unsaturated zone (1 = sat) c_atm => ch4_inst%c_atm_grc , & ! Output: [real(r8) (:,:) ] CH4, O2, CO2 atmospheric conc (mol/m3) ch4co2f => ch4_inst%ch4co2f_grc , & ! Output: [real(r8) (:) ] gridcell CO2 production from CH4 oxidation (g C/m**2/s) ch4prodg => ch4_inst%ch4prodg_grc , & ! Output: [real(r8) (:) ] gridcell average CH4 production (g C/m^2/s) - ch4_surf_flux_tot => ch4_inst%ch4_surf_flux_tot_col , & ! Output: [real(r8) (:) ] col CH4 flux to atm. (kg C/m**2/s) + ch4_surf_flux_tot_col => ch4_inst%ch4_surf_flux_tot_col , & ! Output: [real(r8) (:) ] col CH4 flux to atm. (kg C/m**2/s) + ch4_surf_flux_tot_grc => ch4_inst%ch4_surf_flux_tot_grc , & ! Output: [real(r8) (:) ] grc CH4 flux to atm. (kg C/m**2/s) nem_grc => lnd2atm_inst%nem_grc , & ! Output: [real(r8) (:) ] gridcell average net methane correction to CO2 flux (g C/m^2/s) @@ -1762,7 +1818,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & jwt(begc:endc) = huge(1) ! Initialize local fluxes to zero: necessary for columns outside the filters because averaging up to gridcell will be done - ch4_surf_flux_tot(begc:endc) = 0._r8 + ch4_surf_flux_tot_col(begc:endc) = 0._r8 ch4_prod_tot(begc:endc) = 0._r8 ch4_oxid_tot(begc:endc) = 0._r8 rootfraction(begp:endp,:) = spval @@ -1770,6 +1826,10 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & ! Adjustment to NEE for methane production - oxidation nem_col(begc:endc) = 0._r8 + ! Initialize to zero for columns outside the filters because will + ! average up to gridcell + totcolch4_col(begc:endc) = 0._r8 + do g= begg, endg if (ch4offline) then forc_pch4(g) = atmch4*forc_pbot(g) @@ -1848,7 +1908,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & ch4_dfsat_flux(c) = 0._r8 end if - if (.not. ch4_first_time(c)) then + if (.not. ch4_first_time_col(c)) then if (finundated(c) > fsat_bef(c)) then !Reduce conc_ch4_sat dfsat = finundated(c) - fsat_bef(c) conc_ch4_sat(c,j) = (fsat_bef(c)*conc_ch4_sat(c,j) + dfsat*conc_ch4_unsat(c,j)) / finundated(c) @@ -2060,7 +2120,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & if (j == 1) then totalsat = ch4_surf_diff_sat(c) + ch4_surf_aere_sat(c) + ch4_surf_ebul_sat(c) totalunsat = ch4_surf_diff_unsat(c) + ch4_surf_aere_unsat(c) + ch4_surf_ebul_unsat(c) - ch4_surf_flux_tot(c) = (finundated(c)*totalsat + (1._r8 - finundated(c))*totalunsat) * & + ch4_surf_flux_tot_col(c) = (finundated(c)*totalsat + (1._r8 - finundated(c))*totalunsat) * & catomw / 1000._r8 !Convert from mol to kg C ! ch4_oxid_tot and ch4_prod_tot are initialized to zero above @@ -2086,7 +2146,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & do fc = 1, num_soilc c = filter_soilc(fc) - ch4_surf_flux_tot(c) = ch4_surf_flux_tot(c) + ch4_dfsat_flux(c) + ch4_surf_flux_tot_col(c) = ch4_surf_flux_tot_col(c) + ch4_dfsat_flux(c) end do if (allowlakeprod) then @@ -2097,7 +2157,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & if (j == 1) then ! ch4_oxid_tot and ch4_prod_tot are initialized to zero above totalsat = ch4_surf_diff_sat(c) + ch4_surf_aere_sat(c) + ch4_surf_ebul_sat(c) - ch4_surf_flux_tot(c) = totalsat*catomw / 1000._r8 + ch4_surf_flux_tot_col(c) = totalsat*catomw / 1000._r8 end if ch4_oxid_tot(c) = ch4_oxid_tot(c) + ch4_oxid_depth_sat(c,j)*dz(c,j)*catomw @@ -2144,27 +2204,29 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & ! Finalize CH4 balance and check for errors call ch4_totcolch4(bounds, num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - ch4_inst, totcolch4(bounds%begc:bounds%endc)) + ch4_inst, totcolch4_col(bounds%begc:bounds%endc)) + + ! Column level balance do fc = 1, num_soilc c = filter_soilc(fc) - if (.not. ch4_first_time(c)) then + if (.not. ch4_first_time_col(c)) then ! Check balance - errch4 = totcolch4(c) - totcolch4_bef(c) & + errch4 = totcolch4_col(c) - totcolch4_bef_col(c) & - dtime*(ch4_prod_tot(c) - ch4_oxid_tot(c) & - - ch4_surf_flux_tot(c)*1000._r8) ! kg C --> g C + - ch4_surf_flux_tot_col(c)*1000._r8) ! kg C --> g C if (abs(errch4) > 1.e-7_r8) then ! g C / m^2 / timestep - write(iulog,*)'CH4 Conservation Error in CH4Mod driver, nstep, c, errch4 (gC /m^2.timestep)', & + write(iulog,*)'Column-level CH4 Conservation Error in CH4Mod driver, nstep, c, errch4 (gC /m^2.timestep)', & nstep,c,errch4 g = col%gridcell(c) write(iulog,*)'Latdeg,Londeg,col%itype=',grc%latdeg(g),grc%londeg(g),col%itype(c) - write(iulog,*)'totcolch4 = ', totcolch4(c) - write(iulog,*)'totcolch4_bef = ', totcolch4_bef(c) + write(iulog,*)'totcolch4_col = ', totcolch4_col(c) + write(iulog,*)'totcolch4_bef_col = ', totcolch4_bef_col(c) write(iulog,*)'dtime*ch4_prod_tot = ', dtime*ch4_prod_tot(c) write(iulog,*)'dtime*ch4_oxid_tot = ', dtime*ch4_oxid_tot(c) write(iulog,*)'dtime*ch4_surf_flux_tot*1000 = ', dtime*& - ch4_surf_flux_tot(c)*1000._r8 + ch4_surf_flux_tot_col(c)*1000._r8 call endrun(msg=' ERROR: Methane conservation error'//errMsg(sourcefile, __LINE__)) end if end if @@ -2174,22 +2236,22 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & do fc = 1, num_lakec c = filter_lakec(fc) - if (.not. ch4_first_time(c)) then + if (.not. ch4_first_time_col(c)) then ! Check balance - errch4 = totcolch4(c) - totcolch4_bef(c) & + errch4 = totcolch4_col(c) - totcolch4_bef_col(c) & - dtime*(ch4_prod_tot(c) - ch4_oxid_tot(c) & - - ch4_surf_flux_tot(c)*1000._r8) ! kg C --> g C + - ch4_surf_flux_tot_col(c)*1000._r8) ! kg C --> g C if (abs(errch4) > 1.e-7_r8) then ! g C / m^2 / timestep - write(iulog,*)'CH4 Conservation Error in CH4Mod driver for lake column, nstep, c, errch4 (gC/m^2.timestep)', & + write(iulog,*)'Column-level CH4 Conservation Error in CH4Mod driver for lake column, nstep, c, errch4 (gC/m^2.timestep)', & nstep,c,errch4 g = col%gridcell(c) write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) - write(iulog,*)'totcolch4 = ', totcolch4(c) - write(iulog,*)'totcolch4_bef = ', totcolch4_bef(c) + write(iulog,*)'totcolch4_col = ', totcolch4_col(c) + write(iulog,*)'totcolch4_bef_col = ', totcolch4_bef_col(c) write(iulog,*)'dtime*ch4_prod_tot = ', dtime*ch4_prod_tot(c) write(iulog,*)'dtime*ch4_oxid_tot = ', dtime*ch4_oxid_tot(c) write(iulog,*)'dtime*ch4_surf_flux_tot*1000 = ', dtime*& - ch4_surf_flux_tot(c)*1000._r8 + ch4_surf_flux_tot_col(c)*1000._r8 call endrun(msg=' ERROR: Methane conservation error, allowlakeprod'//& errMsg(sourcefile, __LINE__)) end if @@ -2198,7 +2260,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & end do end if - ! Now average up to gridcell for fluxes + ! Now average up to gridcell for fluxes and totcolch4 call c2g( bounds, & ch4_oxid_tot(begc:endc), ch4co2f(begg:endg), & c2l_scale_type= 'unity', l2g_scale_type='unity' ) @@ -2211,7 +2273,35 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & nem_col(begc:endc), nem_grc(begg:endg), & c2l_scale_type= 'unity', l2g_scale_type='unity' ) - ch4_first_time(begc:endc) = .false. + call c2g( bounds, & + ch4_surf_flux_tot_col(begc:endc), ch4_surf_flux_tot_grc(begg:endg), & + c2l_scale_type= 'unity', l2g_scale_type='unity' ) + + call c2g( bounds, & + ch4_inst%totcolch4_col(begc:endc), & + ch4_inst%totcolch4_grc(begg:endg), & + c2l_scale_type= 'unity', l2g_scale_type='unity' ) + + ! Gricell level balance + + do g = begg, endg + ! Check balance + errch4 = totcolch4_grc(g) - totcolch4_bef_grc(g) + dtime * & + (nem_grc(g) + ch4_surf_flux_tot_grc(g) * 1000._r8) ! kg C --> g C + + if (abs(errch4) > 1.e-7_r8) then ! g C / m^2 / timestep + write(iulog,*)'Gridcell-level CH4 Conservation Error in CH4Mod driver, nstep, g, errch4 (gC /m^2.timestep)', & + nstep, g, errch4 + write(iulog,*)'latdeg, londeg =', grc%latdeg(g), grc%londeg(g) + write(iulog,*)'totcolch4_grc =', totcolch4_grc(g) + write(iulog,*)'totcolch4_bef_grc =', totcolch4_bef_grc(g) + write(iulog,*)'dtime * nem_grc =', dtime * nem_grc(g) + write(iulog,*)'dtime * ch4_surf_flux_tot * 1000 =', dtime * ch4_surf_flux_tot_grc(g) * 1000._r8 + call endrun(msg=' ERROR: Methane conservation error'//errMsg(sourcefile, __LINE__)) + end if + end do + + ch4_first_time_col(begc:endc) = .false. end associate diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 92c2372a52..4c117abc35 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -58,7 +58,7 @@ module clm_driver use SoilBiogeochemVerticalProfileMod , only : SoilBiogeochemVerticalProfile use SatellitePhenologyMod , only : SatellitePhenology, interpMonthlyVeg use ndepStreamMod , only : ndep_interp - use ch4Mod , only : ch4, ch4_init_balance_check + use ch4Mod , only : ch4, ch4_init_gridcell_balance_check, ch4_init_column_balance_check use DUSTMod , only : DustDryDep, DustEmission use VOCEmissionMod , only : VOCEmission ! @@ -318,6 +318,12 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro c14_soilbiogeochem_carbonstate_inst, & soilbiogeochem_nitrogenstate_inst) end if + if (use_lch4) then + call ch4_init_gridcell_balance_check(bounds_clump, & + filter(nc)%num_nolakec, filter(nc)%nolakec, & + filter(nc)%num_lakec, filter(nc)%lakec, & + ch4_inst) + end if call t_stopf('begcnbal_grc') end do @@ -397,7 +403,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro end if if (use_lch4) then - call ch4_init_balance_check(bounds_clump, & + call ch4_init_column_balance_check(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & ch4_inst) From 89ee7368f99fbd5136459b36cb91d1022b4607a2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 26 May 2020 13:36:30 -0600 Subject: [PATCH 0918/1973] Start work on build_ctsm script At this point, it parses arguments and fills out the machine template files, then stops. --- build_ctsm | 17 + .../config_machines_template.xml | 10 +- python/ctsm/build_ctsm.py | 355 ++++++++++++++++++ python/ctsm/test/test_build_ctsm.py | 101 +++++ 4 files changed, 481 insertions(+), 2 deletions(-) create mode 100755 build_ctsm create mode 100644 python/ctsm/build_ctsm.py create mode 100644 python/ctsm/test/test_build_ctsm.py diff --git a/build_ctsm b/build_ctsm new file mode 100755 index 0000000000..04c184c355 --- /dev/null +++ b/build_ctsm @@ -0,0 +1,17 @@ +#!/usr/bin/env python +"""Script to build CTSM library and its dependencies using cime's build system""" + +import os +import sys + +_CTSM_PYTHON = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'python') +sys.path.insert(1, _CTSM_PYTHON) + +from ctsm.path_utils import add_cime_lib_to_path + +cime_path = add_cime_lib_to_path() + +from ctsm.build_ctsm import main + +if __name__ == "__main__": + main(cime_path=cime_path) diff --git a/lilac_config/build_templates/config_machines_template.xml b/lilac_config/build_templates/config_machines_template.xml index d1b2ea5354..fd99561e06 100644 --- a/lilac_config/build_templates/config_machines_template.xml +++ b/lilac_config/build_templates/config_machines_template.xml @@ -25,8 +25,14 @@ $COMPILER - $MPILIB + first is default, mpi-serial is assumed and not required in + this list. + + It appears that the particular value is not important here: all + that matters is that we're self-consistent. (See + https://github.com/ESMCI/cime/issues/3537) + --> + mpich diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py new file mode 100644 index 0000000000..43c9ed1f7d --- /dev/null +++ b/python/ctsm/build_ctsm.py @@ -0,0 +1,355 @@ +"""Functions implementing build_ctsm command""" + +import argparse +import logging +import sys +import os +import string + +from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args +from ctsm.path_utils import path_to_ctsm_root + +logger = logging.getLogger(__name__) + +_MACHINE_CONFIG_DIRNAME = 'machine_configuration' +_INPUTDATA_DIRNAME = 'inputdata' +_GPTL_NANOTIMERS_CPPDEFS = '-DHAVE_NANOTIME -DBIT64 -DHAVE_VPRINTF -DHAVE_BACKTRACE -DHAVE_SLASHPROC -DHAVE_COMM_F2C -DHAVE_TIMES -DHAVE_GETTIMEOFDAY' # pylint: disable=line-too-long + +# ======================================================================== +# Public functions +# ======================================================================== + +def main(cime_path): + """Main function called when build_ctsm is run from the command-line + + Args: + cime_path (str): path to the cime that we're using (this is passed in explicitly + rather than relying on calling path_to_cime so that we can be absolutely sure that + the scripts called here are coming from the same cime as the cime library we're + using). + """ + setup_logging_pre_config() + args = _commandline_args() + process_logging_args(args) + + if not args.rebuild: + build_ctsm(cime_path=cime_path, + build_dir=args.build_dir, + os_type=args.os, + compiler=args.compiler, + netcdf_path=args.netcdf_path, + esmf_lib_path=args.esmf_lib_path, + gmake=args.gmake, + gmake_j=args.gmake_j, + pnetcdf_path=args.pnetcdf_path, + pio_filesystem_hints=args.pio_filesystem_hints, + gptl_nano_timers=args.gptl_nano_timers, + extra_fflags=args.extra_fflags, + extra_cflags=args.extra_cflags) + +def build_ctsm(cime_path, + build_dir, + os_type, + compiler, + netcdf_path, + esmf_lib_path, + gmake, + gmake_j, + pnetcdf_path=None, + pio_filesystem_hints=None, + gptl_nano_timers=False, + extra_fflags='', + extra_cflags=''): + """Implementation of build_ctsm command + + Args: + cime_path (str): path to root of cime + build_dir (str): path to build directory + os_type (str): operating system type; one of linux, aix, darwin or cnl + compiler (str): compiler type + netcdf_path (str): path to NetCDF installation + esmf_lib_path (str): path to ESMF library directory + gmake (str): name of GNU make tool + gmake_j (int): number of threads to use when building + pnetcdf_path (str): path to PNetCDF installation, if present (or None) + pio_filesystem_hints (str): if present (not None), enable filesystem hints for the + given filesystem type + gptl_nano_timers (bool): if True, enable timers in build of the GPTL timing library + extra_fflags (str): any extra flags to include when compiling Fortran files + extra_cflags (str): any extra flags to include when compiling C files + """ + + os_type = _check_and_transform_os(os_type) + _create_build_dir(build_dir) + _fill_out_machine_files(build_dir=build_dir, + os_type=os_type, + compiler=compiler, + netcdf_path=netcdf_path, + esmf_lib_path=esmf_lib_path, + gmake=gmake, + gmake_j=gmake_j, + pnetcdf_path=pnetcdf_path, + pio_filesystem_hints=pio_filesystem_hints, + gptl_nano_timers=gptl_nano_timers, + extra_fflags=extra_fflags, + extra_cflags=extra_cflags) + +# ======================================================================== +# Private functions +# ======================================================================== + +def _commandline_args(args_to_parse=None): + """Parse and return command-line arguments + + Args: + args_to_parse: list of strings or None: Generally only used for unit testing; if None, + reads args from sys.argv + """ + + description = """ +Script to build CTSM library and its dependencies + +Typical usage: + + For a fresh build: + + build_ctsm /path/to/nonexistent/directory --os OS --compiler COMPILER --netcdf-path NETCDF_PATH --esmf-lib-path ESMF_LIB_PATH + + (Other optional arguments are also allowed in this usage.) + + For rebuilding: + + build_ctsm /path/to/existing/directory --rebuild + + (No other arguments are allowed in this usage.) +""" + + parser = argparse.ArgumentParser( + description=description, + formatter_class=argparse.RawTextHelpFormatter) + + parser.add_argument('build_dir', + help='Path to build directory\n' + 'If --rebuild is given, this should be the path to an existing build,\n' + 'otherwise this directory must not already exist.') + + parser.add_argument('--rebuild', action='store_true', + help='Rebuild in an existing build directory\n' + 'If given, none of the build-related optional arguments should be given.\n') + + non_rebuild_required = parser.add_argument_group( + title='required arguments without --rebuild; not allowed with --rebuild') + non_rebuild_required_list = [] + + non_rebuild_required.add_argument('--os', type=str.lower, + choices=['linux', 'aix', 'darwin', 'cnl'], + help='Operating system type') + non_rebuild_required_list.append('os') + + # For now, only support the compilers that we regularly test with, even though cime + # supports many other options + non_rebuild_required.add_argument('--compiler', type=str.lower, + choices=['gnu', 'intel', 'nag', 'pgi'], + help='Compiler type') + non_rebuild_required_list.append('compiler') + + non_rebuild_required.add_argument('--netcdf-path', + help='Path to NetCDF installation\n' + '(path to top-level directory, containing subdirectories\n' + 'named lib, include, etc.)') + non_rebuild_required_list.append('netcdf-path') + + non_rebuild_required.add_argument('--esmf-lib-path', + help='Path to ESMF library directory\n' + 'This directory should include an esmf.mk file') + non_rebuild_required_list.append('esmf-lib-path') + + non_rebuild_optional = parser.add_argument_group( + title='optional arguments without --rebuild; not allowed with --rebuild') + non_rebuild_optional_list = [] + + non_rebuild_optional.add_argument('--gmake', default='gmake', + help='Name of GNU Make tool on your system\n' + 'Default: gmake') + non_rebuild_optional_list.append('gmake') + + non_rebuild_optional.add_argument('--gmake-j', default=8, type=int, + help='Number of threads to use when building\n' + 'Default: 8') + non_rebuild_optional_list.append('gmake-j') + + non_rebuild_optional.add_argument('--pnetcdf-path', + help='Path to PNetCDF installation, if present\n') + non_rebuild_optional_list.append('pnetcdf-path') + + non_rebuild_optional.add_argument('--pio-filesystem-hints', type=str.lower, + choices=['gpfs', 'lustre'], + help='Enable filesystem hints for the given filesystem type\n' + 'when building the Parallel IO library') + non_rebuild_optional_list.append('pio-filesystem-hints') + + non_rebuild_optional.add_argument('--gptl-nano-timers', action='store_true', + help='Enable nano timers in build of the GPTL timing library') + non_rebuild_optional_list.append('gptl-nano-timers') + + non_rebuild_optional.add_argument('--extra-fflags', default='', + help='Any extra, non-standard flags to include\n' + 'when compiling Fortran files\n' + 'Tip: to allow a dash at the start of these flags,\n' + 'use a quoted string with an initial space, as in:\n' + ' --extra-fflags " -flag1 -flag2"') + non_rebuild_optional_list.append('extra-fflags') + + non_rebuild_optional.add_argument('--extra-cflags', default='', + help='Any extra, non-standard flags to include\n' + 'when compiling C files\n' + 'Tip: to allow a dash at the start of these flags,\n' + 'use a quoted string with an initial space, as in:\n' + ' --extra-cflags " -flag1 -flag2"') + non_rebuild_optional_list.append('extra-cflags') + + add_logging_args(parser) + + args = parser.parse_args(args_to_parse) + if args.rebuild: + _check_args_rebuild(parser, args, non_rebuild_required_list+non_rebuild_optional_list) + else: + _check_args_non_rebuild(parser, args, non_rebuild_required_list) + + return args + +def _check_args_rebuild(parser, args, args_not_allowed_in_rebuild): + """Checks if any arguments not allowed with --rebuild are set + + Calls parser.error if there are problems + + Args: + parser: ArgumentParser + args: list of parsed arguments + args_not_allowed_in_rebuild: list of strings - argument names in this category + """ + for arg in args_not_allowed_in_rebuild: + arg_no_dashes = arg.replace('-', '_') + # To determine whether the user specified an argument, we look at whether it's + # value differs from its default value. This won't catch the case where the user + # explicitly set an argument to its default value, but it's not a big deal if we + # miss printing an error in that case. + if vars(args)[arg_no_dashes] != parser.get_default(arg_no_dashes): + parser.error('--{} cannot be provided if --rebuild is set'.format(arg)) + +def _check_args_non_rebuild(parser, args, non_rebuild_required_list): + """Checks if any arguments required without --rebuild are absent + + Calls parser.error if there are problems + + Args: + parser: ArgumentParser + args: list of parsed arguments + non_rebuild_required_list: list of strings - argument names in this category + """ + for arg in non_rebuild_required_list: + arg_no_dashes = arg.replace('-', '_') + if vars(args)[arg_no_dashes] is None: + parser.error('--{} must be provided if --rebuild is not set'.format(arg)) + +def _check_and_transform_os(os_type): + """Check validity of os_type argument and transform it to proper case + + os_type should be a lowercase string; returns a transformed string + """ + transforms = {'linux': 'LINUX', + 'aix': 'AIX', + 'darwin': 'Darwin', + 'cnl': 'CNL'} + try: + os_type_transformed = transforms[os_type] + except KeyError: + raise ValueError("Unknown OS: {}".format(os_type)) + return os_type_transformed + +def _create_build_dir(build_dir): + """Create the given build directory and any necessary sub-directories + + Args: + build_dir (str): path to build directory; this directory shouldn't exist yet! + """ + if os.path.exists(build_dir): + sys.exit('ERROR: When running without --rebuild, the build directory must not exist yet\n' + '(<{}> already exists)'.format(build_dir)) + os.makedirs(build_dir) + os.makedirs(os.path.join(build_dir, _INPUTDATA_DIRNAME)) + os.makedirs(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME)) + +def _fill_out_machine_files(build_dir, + os_type, + compiler, + netcdf_path, + esmf_lib_path, + gmake, + gmake_j, + pnetcdf_path=None, + pio_filesystem_hints=None, + gptl_nano_timers=False, + extra_fflags='', + extra_cflags=''): + """Fill out the machine porting templates for this machine / compiler + + For documentation of args, see the documentation in the build_ctsm function + """ + path_to_templates = os.path.join(path_to_ctsm_root(), + 'lilac_config', + 'build_templates') + + # ------------------------------------------------------------------------ + # Fill in config_machines.xml + # ------------------------------------------------------------------------ + + with open(os.path.join(path_to_templates, 'config_machines_template.xml')) as cm_template_file: + cm_template_file_contents = cm_template_file.read() + config_machines_template = string.Template(cm_template_file_contents) + config_machines = config_machines_template.substitute( + OS=os_type, + COMPILER=compiler, + CIME_OUTPUT_ROOT=build_dir, + GMAKE=gmake, + GMAKE_J=gmake_j) + with open(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME, 'config_machines.xml'), + 'w') as cm_file: + cm_file.write(config_machines) + + # ------------------------------------------------------------------------ + # Fill in config_compilers.xml + # ------------------------------------------------------------------------ + + if gptl_nano_timers: + gptl_cppdefs = _GPTL_NANOTIMERS_CPPDEFS + else: + gptl_cppdefs = '' + + if pio_filesystem_hints: + pio_filesystem_hints_tag = '{}'.format( + pio_filesystem_hints) + else: + pio_filesystem_hints_tag = '' + + if pnetcdf_path: + pnetcdf_path_tag = '{}'.format( + pnetcdf_path) + else: + pnetcdf_path_tag = '' + + with open(os.path.join(path_to_templates, 'config_compilers_template.xml')) as cc_template_file: + cc_template_file_contents = cc_template_file.read() + config_compilers_template = string.Template(cc_template_file_contents) + config_compilers = config_compilers_template.substitute( + COMPILER=compiler, + GPTL_CPPDEFS=gptl_cppdefs, + NETCDF_PATH=netcdf_path, + PIO_FILESYSTEM_HINTS=pio_filesystem_hints_tag, + PNETCDF_PATH=pnetcdf_path_tag, + ESMF_LIBDIR=esmf_lib_path, + EXTRA_CFLAGS=extra_cflags, + EXTRA_FFLAGS=extra_fflags) + with open(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME, 'config_compilers.xml'), + 'w') as cc_file: + cc_file.write(config_compilers) diff --git a/python/ctsm/test/test_build_ctsm.py b/python/ctsm/test/test_build_ctsm.py new file mode 100644 index 0000000000..ccd1ea678e --- /dev/null +++ b/python/ctsm/test/test_build_ctsm.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python + +"""Unit tests for build_ctsm +""" + +import unittest +from unittest.mock import patch +from io import StringIO + +from ctsm import unit_testing +from ctsm.build_ctsm import _commandline_args, _check_and_transform_os + +# Allow names that pylint doesn't like, because otherwise I find it hard +# to make readable unit test names +# pylint: disable=invalid-name + +class TestBuildCtsm(unittest.TestCase): + """Tests of build_ctsm""" + + def test_commandlineArgs_rebuild_valid(self): + """Test _commandline_args with --rebuild, with a valid argument list (no disallowed args)""" + # pylint: disable=no-self-use + _ = _commandline_args(args_to_parse=['build/directory', '--rebuild']) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_rebuild_invalid1(self, mock_stderr): + """Test _commandline_args with --rebuild, with an argument that is invalid with this option + + This tests an argument that is required for non-rebuilds, without a dash + """ + expected_re = r"--compiler cannot be provided if --rebuild is set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--rebuild', + '--compiler', 'intel']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_rebuild_invalid2(self, mock_stderr): + """Test _commandline_args with --rebuild, with an argument that is invalid with this option + + This tests an argument that is required for non-rebuilds, with a dash + """ + expected_re = r"--netcdf-path cannot be provided if --rebuild is set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--rebuild', + '--netcdf-path', '/path/to/netcdf']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_rebuild_invalid3(self, mock_stderr): + """Test _commandline_args with --rebuild, with an argument that is invalid with this option + + This tests an argument that is optional for non-rebuilds, which also has a default + that isn't None + """ + expected_re = r"--gmake cannot be provided if --rebuild is set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--rebuild', + '--gmake', 'mymake']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + def test_commandlineArgs_noRebuild_valid(self): + """Test _commandline_args without --rebuild, with a valid argument list + + (all required things present) + """ + # pylint: disable=no-self-use + _ = _commandline_args(args_to_parse=['build/directory', + '--os', 'linux', + '--compiler', 'intel', + '--netcdf-path', '/path/to/netcdf', + '--esmf-lib-path', '/path/to/esmf/lib']) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_noRebuild_invalid(self, mock_stderr): + """Test _commandline_args without --rebuild, with a missing required argument""" + expected_re = r"--compiler must be provided if --rebuild is not set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--os', 'linux', + '--netcdf-path', '/path/to/netcdf', + '--esmf-lib-path', '/path/to/esmf/lib']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + + def test_checkAndTransformOs_valid(self): + """Test _check_and_transform_os with valid input""" + os = _check_and_transform_os('linux') + self.assertEqual(os, 'LINUX') + + def test_checkAndTransformOs_invalid(self): + """Test _check_and_transform_os with invalid input""" + with self.assertRaises(ValueError): + _ = _check_and_transform_os('bad_os') + +if __name__ == '__main__': + unit_testing.setup_for_tests() + unittest.main() From 0f9d2f1788bfe0dc340ba43034866aca1cf18f99 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 26 May 2020 13:49:59 -0600 Subject: [PATCH 0919/1973] Point to the SSP5-8.5 landuse timeseries file for 1850-2000 historical for C24 and C96, also just use a generic decStart test and remove the special C96 test for running a Sp case fo rC96 --- bld/namelist_files/namelist_defaults_ctsm.xml | 5 +++++ cime_config/testdefs/testlist_clm.xml | 2 +- .../README | 22 ------------------- .../include_user_mods | 1 - .../user_nl_clm | 2 -- 5 files changed, 6 insertions(+), 26 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/user_nl_clm diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index d49e4436b9..a0ace431d9 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -908,6 +908,11 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c179824.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc + diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 7ba47ce714..7d53b823a7 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -798,7 +798,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/README b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/README deleted file mode 100644 index e23dbdeeff..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/README +++ /dev/null @@ -1,22 +0,0 @@ -This test reads 78-pft datasets (glcMEC_decrease happens to be similar but -reads 16-pft datasets). In this way, it tests the -new combination do_transient_crops = .true. and use_crop = .false. while -exercising the collapse2gencrop branch ability to collapse the full crop data -to clm's generic crops. - -According to the file -/glade/work/slevis/git/collapse_pfts/bld/namelist_files/namelist_defaults_clm4_5.xml -the following two files used in this test -are default files for the following options: - -fsurdat = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c200317.nc' -hgrid="C96" sim_year="1850" use_crop=".true." - -flanduse_timeseries = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc' -hgrid="C96" rcp="8.5" sim_year_range="1850-2100" use_crop=".true." - -This test includes the settings of the decStart test so as to also test the -end-of-year transition since it's an IHist case and transient vegetation gets -updated every new year. - -NB: This test is testing the C96 (1-degree) resolution only. diff --git a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/include_user_mods deleted file mode 100644 index acdaa462fc..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../decStart diff --git a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/user_nl_clm deleted file mode 100644 index fd851cc727..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/collapse_pfts_78_to_16_decStart_C96/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ -fsurdat = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr1850_c200317.nc' -flanduse_timeseries = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc' From 1b13d4246a5e39a01b76168f5d1ac9b2d64cb8e2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 26 May 2020 13:51:32 -0600 Subject: [PATCH 0920/1973] Give an error message for now if try to specify --rebuild --- python/ctsm/build_ctsm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 43c9ed1f7d..4b4b657111 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -32,7 +32,9 @@ def main(cime_path): args = _commandline_args() process_logging_args(args) - if not args.rebuild: + if args.rebuild: + sys.exit('ERROR: --rebuild not yet implemented') + else: build_ctsm(cime_path=cime_path, build_dir=args.build_dir, os_type=args.os, From 9036d4ee583bd5744c5f63e7028a615c190f3873 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 26 May 2020 14:00:20 -0600 Subject: [PATCH 0921/1973] Get list of tests correct --- bld/unit_testers/build-namelist_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 72cd414a3f..c833f44d3d 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 947; +my $ntests = 842; if ( defined($opts{'compare'}) ) { - $ntests += 603; + $ntests += 510; } plan( tests=>$ntests ); From 551ba268a5f527893dff29afa857feb46448a90e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 26 May 2020 16:35:24 -0600 Subject: [PATCH 0922/1973] Make LILAC_MODE an xml variable rather than an environment variable This will be helpful for the lilac build script. I have not yet tested this thoroughly! --- README.lilac | 4 ++-- cime_config/buildlib | 11 +---------- cime_config/config_component.xml | 9 +++++++++ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.lilac b/README.lilac index c94debf68d..7f8a36c200 100644 --- a/README.lilac +++ b/README.lilac @@ -8,10 +8,9 @@ I. Building a CTSM / LILAC library for inclusion in an atmosphere model > git checkout lilac_cap > ./manage_externals/checkout_externals -v -2) set the following environment variables (***LILAC_MODE IS CRITICAL to have the lilac code built as part of ctsm) +2) set the following environment variables SRCROOT is where ctsm is checked out - > export LILAC_MODE='on' > export SRCROOT=`pwd` > export CASEDIR=/glade/scratch/$USER/test_lilac @@ -20,6 +19,7 @@ I. Building a CTSM / LILAC library for inclusion in an atmosphere model > cd $SRCROOT/cime/scripts > ./create_newcase --case $CASEDIR --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver nuopc > cd $CASEDIR + > ./xmlchange LILAC_MODE=on > ./xmlchange DEBUG=TRUE > ./case.setup > ./case.build --sharedlib-only diff --git a/cime_config/buildlib b/cime_config/buildlib index 32dbd2feda..9b6656166f 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -20,15 +20,6 @@ from CIME.utils import run_cmd, expect logger = logging.getLogger(__name__) -############################################################################### -def _get_osvar(key, default): -############################################################################### - if key in os.environ: - value = os.environ[key] - else: - value = default - return value - ############################################################################### def _write_ctsm_mk(exeroot, libroot, machine): """Writes a ctsm.mk file in exeroot. @@ -110,8 +101,8 @@ def _main_func(): gmake_j = case.get_value("GMAKE_J") gmake = case.get_value("GMAKE") driver = case.get_value("COMP_INTERFACE").lower() + lilac_mode = case.get_value("LILAC_MODE") - lilac_mode = _get_osvar('LILAC_MODE', 'off') if lilac_mode == 'on': driver = "lilac" machine = case.get_value('MACH') diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 388fcd88ee..545c17d9c4 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -46,6 +46,15 @@ Name of land component + + char + on,off + off + build_component_clm + env_build.xml + Flag to enable building the LILAC cap and coupling code + + char run_component_clm From 68a16708953aaa8f2379f6761008953a7cc3a143 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 27 May 2020 15:03:54 -0600 Subject: [PATCH 0923/1973] Work on build script This isn't yet fully working, but it's close --- .../config_machines_template.xml | 10 +++- python/ctsm/build_ctsm.py | 55 ++++++++++++++++++- python/ctsm/machine_utils.py | 13 ----- python/ctsm/os_utils.py | 40 ++++++++++++++ python/ctsm/run_sys_tests.py | 3 +- 5 files changed, 105 insertions(+), 16 deletions(-) create mode 100644 python/ctsm/os_utils.py diff --git a/lilac_config/build_templates/config_machines_template.xml b/lilac_config/build_templates/config_machines_template.xml index fd99561e06..114d1a419d 100644 --- a/lilac_config/build_templates/config_machines_template.xml +++ b/lilac_config/build_templates/config_machines_template.xml @@ -45,7 +45,7 @@ - $$CIME_OUTPUT_ROOT/inputdata_clmforc + $$CIME_OUTPUT_ROOT/inputdata + + $$CIME_OUTPUT_ROOT/bld + diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 4b4b657111..13c59e47d9 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -2,15 +2,29 @@ import argparse import logging -import sys import os import string +import subprocess +import sys from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args +from ctsm.os_utils import run_cmd_output_on_error from ctsm.path_utils import path_to_ctsm_root logger = logging.getLogger(__name__) +# ======================================================================== +# Define some constants +# ======================================================================== + +# this matches the machine name in config_machines_template.xml +_MACH_NAME = 'ctsm_build' + +# these are arbitrary, since we only use the case for its build, not any of the runtime +# settings; they just need to be valid +_COMPSET = 'I2000Ctsm50NwpSpNldasRsGs' +_RES = 'nldas2_rnldas2_mnldas2' + _MACHINE_CONFIG_DIRNAME = 'machine_configuration' _INPUTDATA_DIRNAME = 'inputdata' _GPTL_NANOTIMERS_CPPDEFS = '-DHAVE_NANOTIME -DBIT64 -DHAVE_VPRINTF -DHAVE_BACKTRACE -DHAVE_SLASHPROC -DHAVE_COMM_F2C -DHAVE_TIMES -DHAVE_GETTIMEOFDAY' # pylint: disable=line-too-long @@ -95,6 +109,8 @@ def build_ctsm(cime_path, gptl_nano_timers=gptl_nano_timers, extra_fflags=extra_fflags, extra_cflags=extra_cflags) + _create_and_build_case(cime_path=cime_path, + build_dir=build_dir) # ======================================================================== # Private functions @@ -355,3 +371,40 @@ def _fill_out_machine_files(build_dir, with open(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME, 'config_compilers.xml'), 'w') as cc_file: cc_file.write(config_compilers) + +def _create_and_build_case(cime_path, build_dir): + """Create a case and build the CTSM library and its dependencies + + Args: + cime_path (str): path to root of cime + build_dir (str): path to build directory + """ + casedir = os.path.join(build_dir, 'case') + + # Note that, for some commands, we want to suppress output, only showing the output if + # the command fails; for these we use run_cmd_output_on_error. For other commands, we + # want to always show output (or there should be no output in general); for these, we + # directly use subprocess.check_call or similar. + + run_cmd_output_on_error( + ['create_newcase', + '--case', casedir, + '--compset', _COMPSET, + '--res', _RES, + '--machine', _MACH_NAME, + '--driver', 'nuopc', + '--extra-machines-dir', os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME), + '--run-unsupported'], + errmsg='Problem creating CTSM case directory', + cwd=os.path.join(cime_path, 'scripts')) + + run_cmd_output_on_error(['case.setup'], + errmsg='Problem setting up CTSM case directory', + cwd=casedir) + + subprocess.check_call(['xmlchange', 'LILAC_MODE=on'], cwd=casedir) + + try: + subprocess.check_call(['case.build'], cwd=casedir) + except subprocess.CalledProcessError: + sys.exit('ERROR building CTSM or its dependencies - see above for details') diff --git a/python/ctsm/machine_utils.py b/python/ctsm/machine_utils.py index 78f6ea85bf..41459ce3de 100644 --- a/python/ctsm/machine_utils.py +++ b/python/ctsm/machine_utils.py @@ -6,7 +6,6 @@ import getpass import socket import re -import os # ======================================================================== # Public functions @@ -22,18 +21,6 @@ def get_machine_name(): hostname = full_hostname.split('.')[0] return _machine_from_hostname(hostname) -def make_link(src, dst): - """Makes a link pointing to src named dst - - Does nothing if link is already set up correctly - """ - if os.path.islink(dst) and os.readlink(dst) == src: - # Link is already set up correctly: do nothing (os.symlink raises an exception if - # you try to replace an existing file) - pass - else: - os.symlink(src, dst) - # ======================================================================== # Private functions # ======================================================================== diff --git a/python/ctsm/os_utils.py b/python/ctsm/os_utils.py new file mode 100644 index 0000000000..574320e9ec --- /dev/null +++ b/python/ctsm/os_utils.py @@ -0,0 +1,40 @@ +"""Various OS-related utility functions +""" + +import os +import subprocess +import sys + +def run_cmd_output_on_error(cmd, errmsg, cwd=None): + """Run the given command; suppress output but print it if there is an error + + If there is an error running the command, print the output from the command and abort + with the given errmsg. + + Args: + cmd: list of strings - command and its arguments + errmsg: string - error message to print if the command returns an error code + cwd: string or None - path from which the command should be run + """ + try: + _ = subprocess.check_output(cmd, + stderr=subprocess.STDOUT, + universal_newlines=True, + cwd=cwd) + except subprocess.CalledProcessError as error: + print('ERROR:\n') + print(error.output) + print('') + sys.exit('ERROR: {}'.format(errmsg)) + +def make_link(src, dst): + """Makes a link pointing to src named dst + + Does nothing if link is already set up correctly + """ + if os.path.islink(dst) and os.readlink(dst) == src: + # Link is already set up correctly: do nothing (os.symlink raises an exception if + # you try to replace an existing file) + pass + else: + os.symlink(src, dst) diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index 7792db6918..c769817b01 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -8,9 +8,10 @@ from datetime import datetime from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args -from ctsm.machine_utils import get_machine_name, make_link +from ctsm.machine_utils import get_machine_name from ctsm.machine import create_machine, get_possibly_overridden_baseline_dir from ctsm.machine_defaults import MACHINE_DEFAULTS +from ctsm.os_utils import make_link from ctsm.path_utils import path_to_ctsm_root from ctsm.joblauncher.job_launcher_factory import JOB_LAUNCHER_NOBATCH From 3e887211278b82c2ff3456bc207036700735d6f8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 27 May 2020 16:31:13 -0600 Subject: [PATCH 0924/1973] Stop writing ctsm.mk file for now This was giving an error because ESMFMKFILE is no longer defined in the environment on bishorn. Rather than fixing it, I'm stopping writing this for now. My plan is to rework how this is written, writing it from the top-level build_ctsm script instead of from within buildlib. --- cime_config/buildlib | 3 --- 1 file changed, 3 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index 9b6656166f..f19e6b55bd 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -106,9 +106,6 @@ def _main_func(): if lilac_mode == 'on': driver = "lilac" machine = case.get_value('MACH') - _write_ctsm_mk(exeroot=case.get_value("EXEROOT"), - libroot=libroot, - machine=machine) #------------------------------------------------------- # create Filepath file From 3e03968a5ccd58b28ed4fd28f02344fd9b1b8139 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 27 May 2020 16:41:32 -0600 Subject: [PATCH 0925/1973] Build sharedlib-only Now the build passes on bishorn, with: ./build_ctsm ~/temporary/test_lilac_bishorn_0527b --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default --- python/ctsm/build_ctsm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 13c59e47d9..c6fedef3b7 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -405,6 +405,9 @@ def _create_and_build_case(cime_path, build_dir): subprocess.check_call(['xmlchange', 'LILAC_MODE=on'], cwd=casedir) try: - subprocess.check_call(['case.build'], cwd=casedir) + subprocess.check_call( + ['case.build', + '--sharedlib-only'], + cwd=casedir) except subprocess.CalledProcessError: sys.exit('ERROR building CTSM or its dependencies - see above for details') From ff50e92e6c4a1c160728505a68c2b49ebea835b1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 27 May 2020 17:31:16 -0600 Subject: [PATCH 0926/1973] Replace calls to sys.exit with our own abort function This borrows from cime's "expect": it enables pdb if debugging is set --- python/ctsm/build_ctsm.py | 10 +++++----- python/ctsm/os_utils.py | 8 +++++--- python/ctsm/utils.py | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 python/ctsm/utils.py diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index c6fedef3b7..0f2384a026 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -5,11 +5,11 @@ import os import string import subprocess -import sys from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args from ctsm.os_utils import run_cmd_output_on_error from ctsm.path_utils import path_to_ctsm_root +from ctsm.utils import abort logger = logging.getLogger(__name__) @@ -47,7 +47,7 @@ def main(cime_path): process_logging_args(args) if args.rebuild: - sys.exit('ERROR: --rebuild not yet implemented') + abort('ERROR: --rebuild not yet implemented') else: build_ctsm(cime_path=cime_path, build_dir=args.build_dir, @@ -292,8 +292,8 @@ def _create_build_dir(build_dir): build_dir (str): path to build directory; this directory shouldn't exist yet! """ if os.path.exists(build_dir): - sys.exit('ERROR: When running without --rebuild, the build directory must not exist yet\n' - '(<{}> already exists)'.format(build_dir)) + abort('ERROR: When running without --rebuild, the build directory must not exist yet\n' + '(<{}> already exists)'.format(build_dir)) os.makedirs(build_dir) os.makedirs(os.path.join(build_dir, _INPUTDATA_DIRNAME)) os.makedirs(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME)) @@ -410,4 +410,4 @@ def _create_and_build_case(cime_path, build_dir): '--sharedlib-only'], cwd=casedir) except subprocess.CalledProcessError: - sys.exit('ERROR building CTSM or its dependencies - see above for details') + abort('ERROR building CTSM or its dependencies - see above for details') diff --git a/python/ctsm/os_utils.py b/python/ctsm/os_utils.py index 574320e9ec..28dcbb15ad 100644 --- a/python/ctsm/os_utils.py +++ b/python/ctsm/os_utils.py @@ -3,7 +3,7 @@ import os import subprocess -import sys +from ctsm.utils import abort def run_cmd_output_on_error(cmd, errmsg, cwd=None): """Run the given command; suppress output but print it if there is an error @@ -22,10 +22,12 @@ def run_cmd_output_on_error(cmd, errmsg, cwd=None): universal_newlines=True, cwd=cwd) except subprocess.CalledProcessError as error: - print('ERROR:\n') + print('ERROR while running:') + print(' '.join(cmd)) + print('') print(error.output) print('') - sys.exit('ERROR: {}'.format(errmsg)) + abort(errmsg) def make_link(src, dst): """Makes a link pointing to src named dst diff --git a/python/ctsm/utils.py b/python/ctsm/utils.py new file mode 100644 index 0000000000..c75214f711 --- /dev/null +++ b/python/ctsm/utils.py @@ -0,0 +1,17 @@ +"""General-purpose utility functions""" + +import logging +import sys + +logger = logging.getLogger(__name__) + +def abort(errmsg): + """Abort the program with the given error message + + No traceback is given, but if the logging level is DEBUG, then we'll enter pdb + """ + if logger.isEnabledFor(logging.DEBUG): + import pdb + pdb.set_trace() + + sys.exit('ERROR: {}'.format(errmsg)) From 8e27e72076023101bf6dbf5e6d6215ff36df1d83 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 27 May 2020 17:34:41 -0600 Subject: [PATCH 0927/1973] Catch other errors when trying to execute a subprocess I was getting an OSError: OSError: [Errno 2] No such file or directory I want to see some additional information, so I'm catching it (and any other exceptions) and re-raising it --- python/ctsm/os_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/ctsm/os_utils.py b/python/ctsm/os_utils.py index 28dcbb15ad..c51d84e003 100644 --- a/python/ctsm/os_utils.py +++ b/python/ctsm/os_utils.py @@ -28,6 +28,10 @@ def run_cmd_output_on_error(cmd, errmsg, cwd=None): print(error.output) print('') abort(errmsg) + except: + print('ERROR trying to run:') + print(' '.join(cmd)) + raise def make_link(src, dst): """Makes a link pointing to src named dst From 97976e71486e66f80010b759c24717da6d4bc445 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 27 May 2020 17:37:17 -0600 Subject: [PATCH 0928/1973] Also print cwd if error running cmd --- python/ctsm/os_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/ctsm/os_utils.py b/python/ctsm/os_utils.py index c51d84e003..aac5680057 100644 --- a/python/ctsm/os_utils.py +++ b/python/ctsm/os_utils.py @@ -24,6 +24,8 @@ def run_cmd_output_on_error(cmd, errmsg, cwd=None): except subprocess.CalledProcessError as error: print('ERROR while running:') print(' '.join(cmd)) + if cwd is not None: + print('From {}'.format(cwd)) print('') print(error.output) print('') @@ -31,6 +33,8 @@ def run_cmd_output_on_error(cmd, errmsg, cwd=None): except: print('ERROR trying to run:') print(' '.join(cmd)) + if cwd is not None: + print('From {}'.format(cwd)) raise def make_link(src, dst): From 1eb22adfdcd5c71fef4647c28079184eab12f1a1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 11:22:10 -0600 Subject: [PATCH 0929/1973] Specify path to commands Now, for commands executed from the case directory, we specify the path to the case directory both in the command itself and in the cwd argument. We do the former in case dot isn't in the user's path; we do the latter in case the commands require you to be in the case directory when you execute them. --- python/ctsm/build_ctsm.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 0f2384a026..95c9a64ab8 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -386,8 +386,13 @@ def _create_and_build_case(cime_path, build_dir): # want to always show output (or there should be no output in general); for these, we # directly use subprocess.check_call or similar. + # Also note that, for commands executed from the case directory, we specify the path + # to the case directory both in the command itself and in the cwd argument. We do the + # former in case dot isn't in the user's path; we do the latter in case the commands + # require you to be in the case directory when you execute them. + run_cmd_output_on_error( - ['create_newcase', + [os.path.join(cime_path, 'scripts', 'create_newcase'), '--case', casedir, '--compset', _COMPSET, '--res', _RES, @@ -395,18 +400,17 @@ def _create_and_build_case(cime_path, build_dir): '--driver', 'nuopc', '--extra-machines-dir', os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME), '--run-unsupported'], - errmsg='Problem creating CTSM case directory', - cwd=os.path.join(cime_path, 'scripts')) + errmsg='Problem creating CTSM case directory') - run_cmd_output_on_error(['case.setup'], + run_cmd_output_on_error([os.path.join(casedir, 'case.setup')], errmsg='Problem setting up CTSM case directory', cwd=casedir) - subprocess.check_call(['xmlchange', 'LILAC_MODE=on'], cwd=casedir) + subprocess.check_call([os.path.join(casedir, 'xmlchange'), 'LILAC_MODE=on'], cwd=casedir) try: subprocess.check_call( - ['case.build', + [os.path.join(casedir, 'case.build'), '--sharedlib-only'], cwd=casedir) except subprocess.CalledProcessError: From 9a90db36628f7ec49d70f69b1e537661d44511ff Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 28 May 2020 11:50:16 -0600 Subject: [PATCH 0930/1973] Oet rid of most of the -no-crop cases Get rid of most of the no-crop cases since now we can use crop files for no-crop as well. Also remove default creation of T31 and hcru resolutions. Keep -no-crop cases for f09,f19,f10 with vic and T42 for SCAM and nldas for NWP. Setup the historical now runs SSP5-8.5 so it can be used for both future, and historical for beyond 2015. Fixes: #1025 By default only create crop version of surface/landuse.timeseries datasets --- tools/mksurfdata_map/Makefile.data | 104 +++-------------------------- 1 file changed, 9 insertions(+), 95 deletions(-) diff --git a/tools/mksurfdata_map/Makefile.data b/tools/mksurfdata_map/Makefile.data index a19eac423a..f7cad8415e 100644 --- a/tools/mksurfdata_map/Makefile.data +++ b/tools/mksurfdata_map/Makefile.data @@ -55,32 +55,22 @@ endif MKSURFDATA = $(BATCHJOBS) $(PWD)/mksurfdata.pl # f19 and f09 are standard resolutions, f10 is used for testing, f45 is used for FATES -# ne30np4 is standard resolution for SE dycore in CAM, T31 is for paleo, 360x720cru is for same resolution as forcing data -STANDARD_RES = 360x720cru,48x96,0.9x1.25,1.9x2.5,10x15,4x5,ne30np4 +# ne30np4 is standard resolution for SE dycore in CAM, C96 is standard for fv3 dycore +STANDARD_RES_NO_CROP = 0.9x1.25,1.9x2.5,10x15 +STANDARD_RES = 0.9x1.25,1.9x2.5,10x15,4x5,ne30np4,C96 FUTURE_RES = 0.9x1.25,1.9x2.5,10x15 # ne120np4 is for high resolution SE dycore, ne16 is for testing SE dycore # T42 is for SCAM # f05 is needed for running full chemistry model +# nldas is for NWP working with WRF STANDARD = \ global-present \ - global-present-f05 \ - global-present-ne16np4 \ - global-present-ne120np4 \ global-present-nldas \ - global-present-T42 \ - global-historical \ - global-historical-ne120np4 \ - global-transient-f05 \ - global-transient \ - global-future \ - global-transient-ne120np4 + global-present-T42 TROPICS = \ - tropics-present \ - tropics-historical \ - tropics-transient \ crop-tropics-present \ crop-tropics-historical \ crop-tropics-transient @@ -115,94 +105,20 @@ DEBUG: standard : $(STANDARD) global-present : FORCE - $(MKSURFDATA) -no-crop -vic -glc_nec 10 -y 2000 -res $(STANDARD_RES) $(BACKGROUND) - -global-present-f05 : FORCE - $(MKSURFDATA) -no-crop -glc_nec 10 -y 1850,2000 -res 0.47x0.63 $(BACKGROUND) + $(MKSURFDATA) -no-crop -vic -glc_nec 10 -y 2000 -res $(STANDARD_RES_NO_CROP) $(BACKGROUND) # T42 is needed for SCAM global-present-T42 : FORCE $(MKSURFDATA) -no-crop -glc_nec 10 -y 2000 -res 64x128 $(BACKGROUND) -global-present-0.125 : FORCE - $(MKSURFDATA) -no-crop -hirespft -glc_nec 10 -y 2000 -res 0.125x0.125 $(BACKGROUND) - -global-present-ne16np4 : FORCE - $(MKSURFDATA) -no-crop -glc_nec 10 -y 2000 -res ne16np4 $(BACKGROUND) - -global-present-ne120np4 : FORCE - $(MKSURFDATA) -no-crop -glc_nec 10 -y 2000 -res ne120np4 $(BACKGROUND) - global-present-nldas : FORCE $(MKSURFDATA) -no-crop -hirespft -glc_nec 10 -y 2005 -res 0.125nldas2 $(BACKGROUND) -global-historical : FORCE - $(MKSURFDATA) -no-crop -glc_nec 10 -y 1850 -res $(STANDARD_RES) $(BACKGROUND) - -global-historical-ne120np4 : FORCE - $(MKSURFDATA) -no-crop -glc_nec 10 -y 1850 -res ne120np4 $(BACKGROUND) - -global-transient : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2000 -res $(STANDARD_RES) $(BACKGROUND) - -global-transient-ne120np4 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2000 -res ne120np4 $(BACKGROUND) - -global-transient-f05 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2000 -res 0.47x0.63 $(BACKGROUND) - -# -# global with future scenarios -# -global-future : global-SSP1-2.6 global-SSP3-7.0 global-SSP5-3.4 global-SSP2-4.5 \ - global-SSP1-1.9 global-SSP4-3.4 global-SSP4-6.0 global-SSP5-8.5 - -global-SSP1-2.6 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ - -ssp_rcp SSP1-2.6 -res $(FUTURE_RES) $(BACKGROUND) - -global-SSP3-7.0 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ - -ssp_rcp SSP3-7.0 -res $(FUTURE_RES) $(BACKGROUND) - -global-SSP5-3.4 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ - -ssp_rcp SSP5-3.4 -res $(FUTURE_RES) $(BACKGROUND) - -global-SSP2-4.5 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ - -ssp_rcp SSP2-4.5 -res $(FUTURE_RES) $(BACKGROUND) - -global-SSP1-1.9 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ - -ssp_rcp SSP1-1.9 -res $(FUTURE_RES) $(BACKGROUND) - -global-SSP4-3.4 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ - -ssp_rcp SSP4-3.4 -res $(FUTURE_RES) $(BACKGROUND) - -global-SSP4-6.0 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ - -ssp_rcp SSP4-6.0 -res $(FUTURE_RES) $(BACKGROUND) - -global-SSP5-8.5 : FORCE - $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2100 \ - -ssp_rcp SSP5-8.5 -res $(FUTURE_RES) $(BACKGROUND) - # # tropics # tropics : $(TROPICS) -tropics-present : FORCE - $(MKSURFDATA) -glc_nec 10 -no-crop -y 2000 -res 5x5_amazon,1x1_brazil $(BACKGROUND) - -tropics-historical : FORCE - $(MKSURFDATA) -glc_nec 10 -no-crop -y 1850 -res 1x1_brazil $(BACKGROUND) - -tropics-transient : FORCE - $(MKSURFDATA) -glc_nec 10 -no-crop -no_surfdata -y 1850-2000 -res 1x1_brazil $(BACKGROUND) - crop-tropics-present : FORCE $(MKSURFDATA) -glc_nec 10 -y 2000 -res 5x5_amazon,1x1_brazil $(BACKGROUND) @@ -251,8 +167,9 @@ crop-global-present-ne120np4 : FORCE crop-smallville-historical : FORCE $(MKSURFDATA) -glc_nec 10 -y 1850 -r 1x1_smallvilleIA -pft_idx 13 -pft_frc 100 $(BACKGROUND) +# Setup the historical case for SSP5-8.5 so that historical can be used to go into the future. crop-global-historical : FORCE - $(MKSURFDATA) -glc_nec 10 -y 1850 -res $(STANDARD_RES) $(BACKGROUND) + $(MKSURFDATA) -glc_nec 10 -y 1850 -ssp_rcp SSP5-8.5 -res $(STANDARD_RES) $(BACKGROUND) crop-global-historical-f05 : FORCE $(MKSURFDATA) -glc_nec 10 -y 1850 -r 0.47x0.63 $(BACKGROUND) @@ -324,10 +241,7 @@ urban-alpha : FORCE # # landuse timeseries # -landuse-timeseries : landuse-timeseries-f10 landuse-timeseries-smallville - -landuse-timeseries-f10 : FORCE - $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2000 -r 10x15 $(BACKGROUND) +landuse-timeseries : landuse-timeseries-smallville landuse-timeseries-smallville : FORCE $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-1855 -r 1x1_smallvilleIA \ From 1b82ac3e60834b9647c27cfa0862fe8f14647e05 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 28 May 2020 12:44:30 -0600 Subject: [PATCH 0931/1973] Update change files --- doc/ChangeLog | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 103 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index ef1b03e5c9..e7595f6fd3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,106 @@ =============================================================== +Tag name: ctsm1.0.dev098 +Originator(s): John Truesdale,UCAR/AMP,303-497-1386 +Date: Thu May 28 12:26:34 MDT 2020 +One-line Summary: Bring in GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 + +Purpose of changes +------------------ + +Add support for new GFDL fv3 curbed sphere grids. Low resolution C24, and C48 +Moderate resolution C96, and high resolution C192 and C384. Add in mapping files +so all can be created. Make C96 a default resolution created with new surface +datasets. For all of these only the crop versions of surface and landuse.timeseries +are in place, as non-crop can run in CLM without needing different datasets. Also for +historical landuse.timeseries we use the SSP5-8.5 timeseries files, so that it can be +used for future, historical and beyond 2015 present day. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #1025 + Fixes #1025 -- By default only create crop version of surface/landuse.timeseries datasets + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): New surface and landuse.timeseries files + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: Add C96 tests + +Code reviewed by: @ekluzek + + +CTSM testing: regular, tools + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (15 new tests for new resolutions) + + tools-tests (test/tools): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - PASS (cheyenne) + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #891 +(https://github.com/ESCOMP/ctsm/pull) + + #891 -- add definitions/defaults for GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev097 Originator(s): ycheng (Yanyan Cheng) Date: Mon May 25 15:14:56 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 70151ec457..117d556a9d 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev098 jet/erik 05/28/2020 Bring in GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 ctsm1.0.dev097 ycheng 05/25/2020 Add two bioenergy crops (switchgrass and miscanthus) ctsm1.0.dev096 slevis 05/21/2020 Gridcell-level balance checks for carbon and nitrogen ctsm1.0.dev095 sacks 05/21/2020 Update cime and cmeps externals; rework initialization of CNFire object From 2a029ea13d14d03710d58703a3ad2a69f3e80a15 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 13:31:26 -0600 Subject: [PATCH 0932/1973] Allow use of a predefined machine Can give the --machine argument, with the name of a machine known to cime, as an alternative to creating a machine port on the fly. --- python/ctsm/build_ctsm.py | 242 ++++++++++++++++++---------- python/ctsm/test/test_build_ctsm.py | 89 +++++++++- 2 files changed, 238 insertions(+), 93 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 95c9a64ab8..e36b62c732 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -51,8 +51,9 @@ def main(cime_path): else: build_ctsm(cime_path=cime_path, build_dir=args.build_dir, - os_type=args.os, compiler=args.compiler, + machine=args.machine, + os_type=args.os, netcdf_path=args.netcdf_path, esmf_lib_path=args.esmf_lib_path, gmake=args.gmake, @@ -65,12 +66,13 @@ def main(cime_path): def build_ctsm(cime_path, build_dir, - os_type, compiler, - netcdf_path, - esmf_lib_path, - gmake, - gmake_j, + machine=None, + os_type=None, + netcdf_path=None, + esmf_lib_path=None, + gmake=None, + gmake_j=None, pnetcdf_path=None, pio_filesystem_hints=None, gptl_nano_timers=False, @@ -81,36 +83,55 @@ def build_ctsm(cime_path, Args: cime_path (str): path to root of cime build_dir (str): path to build directory - os_type (str): operating system type; one of linux, aix, darwin or cnl compiler (str): compiler type - netcdf_path (str): path to NetCDF installation - esmf_lib_path (str): path to ESMF library directory - gmake (str): name of GNU make tool - gmake_j (int): number of threads to use when building - pnetcdf_path (str): path to PNetCDF installation, if present (or None) - pio_filesystem_hints (str): if present (not None), enable filesystem hints for the + machine (str or None): machine name (a machine known to cime) + os_type (str or None): operating system type; one of linux, aix, darwin or cnl + Must be given if machine isn't given; ignored if machine is given + netcdf_path (str or None): path to NetCDF installation + Must be given if machine isn't given; ignored if machine is given + esmf_lib_path (str or None): path to ESMF library directory + Must be given if machine isn't given; ignored if machine is given + gmake (str or None): name of GNU make tool + Ignored if machine is given + gmake_j (int or None): number of threads to use when building + Ignored if machine is given + pnetcdf_path (str or None): path to PNetCDF installation, if present (or None) + Ignored if machine is given + pio_filesystem_hints (str or None): if present (not None), enable filesystem hints for the given filesystem type + Ignored if machine is given gptl_nano_timers (bool): if True, enable timers in build of the GPTL timing library + Ignored if machine is given extra_fflags (str): any extra flags to include when compiling Fortran files + Ignored if machine is given extra_cflags (str): any extra flags to include when compiling C files + Ignored if machine is given """ - os_type = _check_and_transform_os(os_type) - _create_build_dir(build_dir) - _fill_out_machine_files(build_dir=build_dir, - os_type=os_type, - compiler=compiler, - netcdf_path=netcdf_path, - esmf_lib_path=esmf_lib_path, - gmake=gmake, - gmake_j=gmake_j, - pnetcdf_path=pnetcdf_path, - pio_filesystem_hints=pio_filesystem_hints, - gptl_nano_timers=gptl_nano_timers, - extra_fflags=extra_fflags, - extra_cflags=extra_cflags) + _create_build_dir(build_dir=build_dir, + existing_machine=(machine is not None)) + + if machine is None: + assert os_type is not None, 'with machine absent, os_type must be given' + assert netcdf_path is not None, 'with machine absent, netcdf_path must be given' + assert esmf_lib_path is not None, 'with machine absent, esmf_lib_path must be given' + os_type = _check_and_transform_os(os_type) + _fill_out_machine_files(build_dir=build_dir, + os_type=os_type, + compiler=compiler, + netcdf_path=netcdf_path, + esmf_lib_path=esmf_lib_path, + gmake=gmake, + gmake_j=gmake_j, + pnetcdf_path=pnetcdf_path, + pio_filesystem_hints=pio_filesystem_hints, + gptl_nano_timers=gptl_nano_timers, + extra_fflags=extra_fflags, + extra_cflags=extra_cflags) + _create_and_build_case(cime_path=cime_path, - build_dir=build_dir) + build_dir=build_dir, + machine=machine) # ======================================================================== # Private functions @@ -123,15 +144,23 @@ def _commandline_args(args_to_parse=None): args_to_parse: list of strings or None: Generally only used for unit testing; if None, reads args from sys.argv """ + # pylint: disable=line-too-long description = """ Script to build CTSM library and its dependencies Typical usage: - For a fresh build: + For a fresh build with a machine that has been ported to cime + (http://esmci.github.io/cime/versions/master/html/users_guide/porting-cime.html): + + build_ctsm /path/to/nonexistent/directory --machine MACHINE --compiler COMPILER + + (Some other optional arguments are also allowed in this usage, but many are not.) - build_ctsm /path/to/nonexistent/directory --os OS --compiler COMPILER --netcdf-path NETCDF_PATH --esmf-lib-path ESMF_LIB_PATH + For a fresh build with a machine that has NOT been ported to cime: + + build_ctsm /path/to/nonexistent/directory --compiler COMPILER --os OS --netcdf-path NETCDF_PATH --esmf-lib-path ESMF_LIB_PATH (Other optional arguments are also allowed in this usage.) @@ -139,7 +168,7 @@ def _commandline_args(args_to_parse=None): build_ctsm /path/to/existing/directory --rebuild - (No other arguments are allowed in this usage.) + (Most other arguments are NOT allowed in this usage.) """ parser = argparse.ArgumentParser( @@ -151,19 +180,24 @@ def _commandline_args(args_to_parse=None): 'If --rebuild is given, this should be the path to an existing build,\n' 'otherwise this directory must not already exist.') - parser.add_argument('--rebuild', action='store_true', - help='Rebuild in an existing build directory\n' - 'If given, none of the build-related optional arguments should be given.\n') + main_opts = parser.add_mutually_exclusive_group() + + main_opts.add_argument('--machine', + help='Name of machine; this must be a machine that has been ported to cime\n' + '(http://esmci.github.io/cime/versions/master/html/users_guide/porting-cime.html)\n' + 'If given, then none of the machine-definition optional arguments should be given.\n') + + main_opts.add_argument('--rebuild', action='store_true', + help='Rebuild in an existing build directory\n' + 'If given, none of the machine-definition or build-related optional arguments\n' + 'should be given.\n') non_rebuild_required = parser.add_argument_group( - title='required arguments without --rebuild; not allowed with --rebuild') + title='required arguments when not rebuilding', + description='These arguments are required if --rebuild is not given; ' + 'they are not allowed with --rebuild:') non_rebuild_required_list = [] - non_rebuild_required.add_argument('--os', type=str.lower, - choices=['linux', 'aix', 'darwin', 'cnl'], - help='Operating system type') - non_rebuild_required_list.append('os') - # For now, only support the compilers that we regularly test with, even though cime # supports many other options non_rebuild_required.add_argument('--compiler', type=str.lower, @@ -171,104 +205,127 @@ def _commandline_args(args_to_parse=None): help='Compiler type') non_rebuild_required_list.append('compiler') - non_rebuild_required.add_argument('--netcdf-path', + new_machine_required = parser.add_argument_group( + title='required arguments for a user-defined machine', + description='These arguments are required if neither --machine nor --rebuild are given; ' + 'they are not allowed with either of those arguments:') + new_machine_required_list = [] + + new_machine_required.add_argument('--os', type=str.lower, + choices=['linux', 'aix', 'darwin', 'cnl'], + help='Operating system type') + new_machine_required_list.append('os') + + new_machine_required.add_argument('--netcdf-path', help='Path to NetCDF installation\n' '(path to top-level directory, containing subdirectories\n' 'named lib, include, etc.)') - non_rebuild_required_list.append('netcdf-path') + new_machine_required_list.append('netcdf-path') - non_rebuild_required.add_argument('--esmf-lib-path', + new_machine_required.add_argument('--esmf-lib-path', help='Path to ESMF library directory\n' 'This directory should include an esmf.mk file') - non_rebuild_required_list.append('esmf-lib-path') + new_machine_required_list.append('esmf-lib-path') - non_rebuild_optional = parser.add_argument_group( - title='optional arguments without --rebuild; not allowed with --rebuild') - non_rebuild_optional_list = [] + new_machine_optional = parser.add_argument_group( + title='optional arguments for a user-defined machine', + description='These arguments are optional if neither --machine nor --rebuild are given; ' + 'they are not allowed with either of those arguments:') + new_machine_optional_list = [] - non_rebuild_optional.add_argument('--gmake', default='gmake', + new_machine_optional.add_argument('--gmake', default='gmake', help='Name of GNU Make tool on your system\n' 'Default: gmake') - non_rebuild_optional_list.append('gmake') + new_machine_optional_list.append('gmake') - non_rebuild_optional.add_argument('--gmake-j', default=8, type=int, + new_machine_optional.add_argument('--gmake-j', default=8, type=int, help='Number of threads to use when building\n' 'Default: 8') - non_rebuild_optional_list.append('gmake-j') + new_machine_optional_list.append('gmake-j') - non_rebuild_optional.add_argument('--pnetcdf-path', + new_machine_optional.add_argument('--pnetcdf-path', help='Path to PNetCDF installation, if present\n') - non_rebuild_optional_list.append('pnetcdf-path') + new_machine_optional_list.append('pnetcdf-path') - non_rebuild_optional.add_argument('--pio-filesystem-hints', type=str.lower, + new_machine_optional.add_argument('--pio-filesystem-hints', type=str.lower, choices=['gpfs', 'lustre'], help='Enable filesystem hints for the given filesystem type\n' 'when building the Parallel IO library') - non_rebuild_optional_list.append('pio-filesystem-hints') + new_machine_optional_list.append('pio-filesystem-hints') - non_rebuild_optional.add_argument('--gptl-nano-timers', action='store_true', + new_machine_optional.add_argument('--gptl-nano-timers', action='store_true', help='Enable nano timers in build of the GPTL timing library') - non_rebuild_optional_list.append('gptl-nano-timers') + new_machine_optional_list.append('gptl-nano-timers') - non_rebuild_optional.add_argument('--extra-fflags', default='', + new_machine_optional.add_argument('--extra-fflags', default='', help='Any extra, non-standard flags to include\n' 'when compiling Fortran files\n' 'Tip: to allow a dash at the start of these flags,\n' 'use a quoted string with an initial space, as in:\n' ' --extra-fflags " -flag1 -flag2"') - non_rebuild_optional_list.append('extra-fflags') + new_machine_optional_list.append('extra-fflags') - non_rebuild_optional.add_argument('--extra-cflags', default='', + new_machine_optional.add_argument('--extra-cflags', default='', help='Any extra, non-standard flags to include\n' 'when compiling C files\n' 'Tip: to allow a dash at the start of these flags,\n' 'use a quoted string with an initial space, as in:\n' ' --extra-cflags " -flag1 -flag2"') - non_rebuild_optional_list.append('extra-cflags') + new_machine_optional_list.append('extra-cflags') add_logging_args(parser) args = parser.parse_args(args_to_parse) if args.rebuild: - _check_args_rebuild(parser, args, non_rebuild_required_list+non_rebuild_optional_list) + _confirm_args_absent(parser, args, "cannot be provided if --rebuild is set", + non_rebuild_required_list + new_machine_required_list + new_machine_optional_list) else: - _check_args_non_rebuild(parser, args, non_rebuild_required_list) + _confirm_args_present(parser, args, "must be provided if --rebuild is not set", + non_rebuild_required_list) + if args.machine: + _confirm_args_absent(parser, args, "cannot be provided if --machine is set", + new_machine_required_list + new_machine_optional_list) + else: + _confirm_args_present(parser, args, "must be provided if neither --machine nor --rebuild are set", + new_machine_required_list) return args -def _check_args_rebuild(parser, args, args_not_allowed_in_rebuild): - """Checks if any arguments not allowed with --rebuild are set +def _confirm_args_absent(parser, args, errmsg, args_not_allowed): + """Confirms that all args not allowed in this usage are absent Calls parser.error if there are problems Args: parser: ArgumentParser args: list of parsed arguments - args_not_allowed_in_rebuild: list of strings - argument names in this category + errmsg: string - message printed if there is a problem + args_not_allowed: list of strings - argument names in this category """ - for arg in args_not_allowed_in_rebuild: + for arg in args_not_allowed: arg_no_dashes = arg.replace('-', '_') # To determine whether the user specified an argument, we look at whether it's # value differs from its default value. This won't catch the case where the user # explicitly set an argument to its default value, but it's not a big deal if we # miss printing an error in that case. if vars(args)[arg_no_dashes] != parser.get_default(arg_no_dashes): - parser.error('--{} cannot be provided if --rebuild is set'.format(arg)) + parser.error('--{} {}'.format(arg, errmsg)) -def _check_args_non_rebuild(parser, args, non_rebuild_required_list): - """Checks if any arguments required without --rebuild are absent +def _confirm_args_present(parser, args, errmsg, args_required): + """Confirms that all args required in this usage are present Calls parser.error if there are problems Args: parser: ArgumentParser args: list of parsed arguments - non_rebuild_required_list: list of strings - argument names in this category + errmsg: string - message printed if there is a problem + args_required: list of strings - argument names in this category """ - for arg in non_rebuild_required_list: + for arg in args_required: arg_no_dashes = arg.replace('-', '_') if vars(args)[arg_no_dashes] is None: - parser.error('--{} must be provided if --rebuild is not set'.format(arg)) + parser.error('--{} {}'.format(arg, errmsg)) def _check_and_transform_os(os_type): """Check validity of os_type argument and transform it to proper case @@ -285,18 +342,20 @@ def _check_and_transform_os(os_type): raise ValueError("Unknown OS: {}".format(os_type)) return os_type_transformed -def _create_build_dir(build_dir): +def _create_build_dir(build_dir, existing_machine): """Create the given build directory and any necessary sub-directories Args: build_dir (str): path to build directory; this directory shouldn't exist yet! + existing_machine (bool): whether this build is for a machine known to cime + (as opposed to an on-the-fly machine port) """ if os.path.exists(build_dir): abort('ERROR: When running without --rebuild, the build directory must not exist yet\n' '(<{}> already exists)'.format(build_dir)) os.makedirs(build_dir) - os.makedirs(os.path.join(build_dir, _INPUTDATA_DIRNAME)) - os.makedirs(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME)) + if not existing_machine: + os.makedirs(os.path.join(build_dir, _INPUTDATA_DIRNAME)) def _fill_out_machine_files(build_dir, os_type, @@ -317,6 +376,7 @@ def _fill_out_machine_files(build_dir, path_to_templates = os.path.join(path_to_ctsm_root(), 'lilac_config', 'build_templates') + os.makedirs(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME)) # ------------------------------------------------------------------------ # Fill in config_machines.xml @@ -372,12 +432,15 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_and_build_case(cime_path, build_dir): +def _create_and_build_case(cime_path, build_dir, machine=None): """Create a case and build the CTSM library and its dependencies Args: cime_path (str): path to root of cime build_dir (str): path to build directory + machine (str or None): name of machine or None + If None, we assume we're using an on-the-fly machine port + Otherwise, machine should be the name of a machine known to cime """ casedir = os.path.join(build_dir, 'case') @@ -391,16 +454,21 @@ def _create_and_build_case(cime_path, build_dir): # former in case dot isn't in the user's path; we do the latter in case the commands # require you to be in the case directory when you execute them. - run_cmd_output_on_error( - [os.path.join(cime_path, 'scripts', 'create_newcase'), - '--case', casedir, - '--compset', _COMPSET, - '--res', _RES, - '--machine', _MACH_NAME, - '--driver', 'nuopc', - '--extra-machines-dir', os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME), - '--run-unsupported'], - errmsg='Problem creating CTSM case directory') + if machine is None: + machine_args = ['--machine', _MACH_NAME, + '--extra-machines-dir', os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME)] + else: + machine_args = ['--machine', machine] + + create_newcase_cmd = [os.path.join(cime_path, 'scripts', 'create_newcase'), + '--case', casedir, + '--compset', _COMPSET, + '--res', _RES, + '--driver', 'nuopc', + '--run-unsupported'] + create_newcase_cmd.extend(machine_args) + run_cmd_output_on_error(create_newcase_cmd, + errmsg='Problem creating CTSM case directory') run_cmd_output_on_error([os.path.join(casedir, 'case.setup')], errmsg='Problem setting up CTSM case directory', diff --git a/python/ctsm/test/test_build_ctsm.py b/python/ctsm/test/test_build_ctsm.py index ccd1ea678e..f30bd03fbf 100644 --- a/python/ctsm/test/test_build_ctsm.py +++ b/python/ctsm/test/test_build_ctsm.py @@ -39,7 +39,20 @@ def test_commandlineArgs_rebuild_invalid1(self, mock_stderr): def test_commandlineArgs_rebuild_invalid2(self, mock_stderr): """Test _commandline_args with --rebuild, with an argument that is invalid with this option - This tests an argument that is required for non-rebuilds, with a dash + This tests an argument that is required for new machines, without a dash + """ + expected_re = r"--os cannot be provided if --rebuild is set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--rebuild', + '--os', 'linux']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_rebuild_invalid3(self, mock_stderr): + """Test _commandline_args with --rebuild, with an argument that is invalid with this option + + This tests an argument that is required for new machines, with a dash """ expected_re = r"--netcdf-path cannot be provided if --rebuild is set" with self.assertRaises(SystemExit): @@ -49,10 +62,10 @@ def test_commandlineArgs_rebuild_invalid2(self, mock_stderr): self.assertRegex(mock_stderr.getvalue(), expected_re) @patch('sys.stderr', new_callable=StringIO) - def test_commandlineArgs_rebuild_invalid3(self, mock_stderr): + def test_commandlineArgs_rebuild_invalid4(self, mock_stderr): """Test _commandline_args with --rebuild, with an argument that is invalid with this option - This tests an argument that is optional for non-rebuilds, which also has a default + This tests an argument that is optional for new machines, which also has a default that isn't None """ expected_re = r"--gmake cannot be provided if --rebuild is set" @@ -63,7 +76,7 @@ def test_commandlineArgs_rebuild_invalid3(self, mock_stderr): self.assertRegex(mock_stderr.getvalue(), expected_re) def test_commandlineArgs_noRebuild_valid(self): - """Test _commandline_args without --rebuild, with a valid argument list + """Test _commandline_args without --rebuild or --machine, with a valid argument list (all required things present) """ @@ -75,8 +88,11 @@ def test_commandlineArgs_noRebuild_valid(self): '--esmf-lib-path', '/path/to/esmf/lib']) @patch('sys.stderr', new_callable=StringIO) - def test_commandlineArgs_noRebuild_invalid(self, mock_stderr): - """Test _commandline_args without --rebuild, with a missing required argument""" + def test_commandlineArgs_noRebuild_invalid1(self, mock_stderr): + """Test _commandline_args without --rebuild or --machine, with a missing required argument + + This tests an argument in the non-rebuild-required list + """ expected_re = r"--compiler must be provided if --rebuild is not set" with self.assertRaises(SystemExit): _ = _commandline_args(args_to_parse=['build/directory', @@ -85,6 +101,67 @@ def test_commandlineArgs_noRebuild_invalid(self, mock_stderr): '--esmf-lib-path', '/path/to/esmf/lib']) self.assertRegex(mock_stderr.getvalue(), expected_re) + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_noRebuild_invalid2(self, mock_stderr): + """Test _commandline_args without --rebuild or --machine, with a missing required argument + + This tests an argument in the new-machine-required list + """ + expected_re = r"--os must be provided if neither --machine nor --rebuild are set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--compiler', 'intel', + '--netcdf-path', '/path/to/netcdf', + '--esmf-lib-path', '/path/to/esmf/lib']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + def test_commandlineArgs_machine_valid(self): + """Test _commandline_args with --machine, with a valid argument list + + (all required things present) + """ + # pylint: disable=no-self-use + _ = _commandline_args(args_to_parse=['build/directory', + '--machine', 'mymachine', + '--compiler', 'intel']) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_machine_missingRequired(self, mock_stderr): + """Test _commandline_args with --machine, with a missing required argument + """ + expected_re = r"--compiler must be provided if --rebuild is not set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--machine', 'mymachine']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_machine_illegalArg1(self, mock_stderr): + """Test _commandline_args with --rebuild, with an argument that is illegal with this option + + This tests an argument that is required for new machines + """ + expected_re = r"--os cannot be provided if --machine is set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--machine', 'mymachine', + '--compiler', 'intel', + '--os', 'linux']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_machine_illegalArg2(self, mock_stderr): + """Test _commandline_args with --rebuild, with an argument that is illegal with this option + + This tests an argument that is optional for new machines + """ + expected_re = r"--gmake cannot be provided if --machine is set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--machine', 'mymachine', + '--compiler', 'intel', + '--gmake', 'mymake']) + self.assertRegex(mock_stderr.getvalue(), expected_re) def test_checkAndTransformOs_valid(self): """Test _check_and_transform_os with valid input""" From 1ca7debd01df815eccfd0bce729441473677823e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 13:36:06 -0600 Subject: [PATCH 0933/1973] Put the bld directory back under the case I'm going to use a symlink instead, for consistency between the user-defined machine and a predefined machine --- lilac_config/build_templates/config_machines_template.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lilac_config/build_templates/config_machines_template.xml b/lilac_config/build_templates/config_machines_template.xml index 114d1a419d..e6e102fa53 100644 --- a/lilac_config/build_templates/config_machines_template.xml +++ b/lilac_config/build_templates/config_machines_template.xml @@ -113,13 +113,5 @@ --> - - $$CIME_OUTPUT_ROOT/bld - From 82b5db089f1855b8de5c470ebce09bb1b41c4e62 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 13:46:17 -0600 Subject: [PATCH 0934/1973] Add a --skip-build argument This is useful for testing (manual testing for now, but I think it will also be useful for automated testing). It could also be useful for experts - so you can change some things in between the set up of the directories and the actual build. --- python/ctsm/build_ctsm.py | 38 +++++++++++++++++++++-------- python/ctsm/test/test_build_ctsm.py | 14 +++++++++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index e36b62c732..d9398e6221 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -52,6 +52,7 @@ def main(cime_path): build_ctsm(cime_path=cime_path, build_dir=args.build_dir, compiler=args.compiler, + skip_build=args.skip_build, machine=args.machine, os_type=args.os, netcdf_path=args.netcdf_path, @@ -67,6 +68,7 @@ def main(cime_path): def build_ctsm(cime_path, build_dir, compiler, + skip_build=False, machine=None, os_type=None, netcdf_path=None, @@ -84,6 +86,7 @@ def build_ctsm(cime_path, cime_path (str): path to root of cime build_dir (str): path to build directory compiler (str): compiler type + skip_build (bool): If True, set things up, but skip doing the actual build machine (str or None): machine name (a machine known to cime) os_type (str or None): operating system type; one of linux, aix, darwin or cnl Must be given if machine isn't given; ignored if machine is given @@ -131,7 +134,8 @@ def build_ctsm(cime_path, _create_and_build_case(cime_path=cime_path, build_dir=build_dir, - machine=machine) + machine=machine, + skip_build=skip_build) # ======================================================================== # Private functions @@ -205,6 +209,17 @@ def _commandline_args(args_to_parse=None): help='Compiler type') non_rebuild_required_list.append('compiler') + non_rebuild_optional = parser.add_argument_group( + title='optional arguments when not rebuilding', + description='These arguments are optional if --rebuild is not given; ' + 'they are not allowed with --rebuild:') + non_rebuild_optional_list = [] + + non_rebuild_optional.add_argument('--skip-build', action='store_true', + help='Do the pre-build setup, but do not actually build CTSM\n' + '(This is useful for testing, or for expert use.)') + non_rebuild_optional_list.append('skip-build') + new_machine_required = parser.add_argument_group( title='required arguments for a user-defined machine', description='These arguments are required if neither --machine nor --rebuild are given; ' @@ -278,7 +293,8 @@ def _commandline_args(args_to_parse=None): args = parser.parse_args(args_to_parse) if args.rebuild: _confirm_args_absent(parser, args, "cannot be provided if --rebuild is set", - non_rebuild_required_list + new_machine_required_list + new_machine_optional_list) + (non_rebuild_required_list + non_rebuild_optional_list + + new_machine_required_list + new_machine_optional_list)) else: _confirm_args_present(parser, args, "must be provided if --rebuild is not set", non_rebuild_required_list) @@ -432,7 +448,7 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_and_build_case(cime_path, build_dir, machine=None): +def _create_and_build_case(cime_path, build_dir, machine=None, skip_build=False): """Create a case and build the CTSM library and its dependencies Args: @@ -441,6 +457,7 @@ def _create_and_build_case(cime_path, build_dir, machine=None): machine (str or None): name of machine or None If None, we assume we're using an on-the-fly machine port Otherwise, machine should be the name of a machine known to cime + skip_build (bool): If True, set things up, but skip doing the actual build """ casedir = os.path.join(build_dir, 'case') @@ -476,10 +493,11 @@ def _create_and_build_case(cime_path, build_dir, machine=None): subprocess.check_call([os.path.join(casedir, 'xmlchange'), 'LILAC_MODE=on'], cwd=casedir) - try: - subprocess.check_call( - [os.path.join(casedir, 'case.build'), - '--sharedlib-only'], - cwd=casedir) - except subprocess.CalledProcessError: - abort('ERROR building CTSM or its dependencies - see above for details') + if not skip_build: + try: + subprocess.check_call( + [os.path.join(casedir, 'case.build'), + '--sharedlib-only'], + cwd=casedir) + except subprocess.CalledProcessError: + abort('ERROR building CTSM or its dependencies - see above for details') diff --git a/python/ctsm/test/test_build_ctsm.py b/python/ctsm/test/test_build_ctsm.py index f30bd03fbf..9ec08349bf 100644 --- a/python/ctsm/test/test_build_ctsm.py +++ b/python/ctsm/test/test_build_ctsm.py @@ -65,6 +65,20 @@ def test_commandlineArgs_rebuild_invalid3(self, mock_stderr): def test_commandlineArgs_rebuild_invalid4(self, mock_stderr): """Test _commandline_args with --rebuild, with an argument that is invalid with this option + This tests an argument that is optional for new non-rebuild + that isn't None + """ + expected_re = r"--skip-build cannot be provided if --rebuild is set" + with self.assertRaises(SystemExit): + _ = _commandline_args(args_to_parse=['build/directory', + '--rebuild', + '--skip-build']) + self.assertRegex(mock_stderr.getvalue(), expected_re) + + @patch('sys.stderr', new_callable=StringIO) + def test_commandlineArgs_rebuild_invalid5(self, mock_stderr): + """Test _commandline_args with --rebuild, with an argument that is invalid with this option + This tests an argument that is optional for new machines, which also has a default that isn't None """ From b29ab308b7c13c989319495f9d56b125e8b3cd54 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 13:50:47 -0600 Subject: [PATCH 0935/1973] Make a sym link to the bld directory at the top level --- python/ctsm/build_ctsm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index d9398e6221..0af77b482a 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -7,7 +7,7 @@ import subprocess from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args -from ctsm.os_utils import run_cmd_output_on_error +from ctsm.os_utils import run_cmd_output_on_error, make_link from ctsm.path_utils import path_to_ctsm_root from ctsm.utils import abort @@ -47,7 +47,7 @@ def main(cime_path): process_logging_args(args) if args.rebuild: - abort('ERROR: --rebuild not yet implemented') + abort('--rebuild not yet implemented') else: build_ctsm(cime_path=cime_path, build_dir=args.build_dir, @@ -367,7 +367,7 @@ def _create_build_dir(build_dir, existing_machine): (as opposed to an on-the-fly machine port) """ if os.path.exists(build_dir): - abort('ERROR: When running without --rebuild, the build directory must not exist yet\n' + abort('When running without --rebuild, the build directory must not exist yet\n' '(<{}> already exists)'.format(build_dir)) os.makedirs(build_dir) if not existing_machine: @@ -493,6 +493,9 @@ def _create_and_build_case(cime_path, build_dir, machine=None, skip_build=False) subprocess.check_call([os.path.join(casedir, 'xmlchange'), 'LILAC_MODE=on'], cwd=casedir) + make_link(os.path.join(casedir, 'bld'), + os.path.join(build_dir, 'bld')) + if not skip_build: try: subprocess.check_call( From 99430b4112027a2132a5dd0ffdd9b9a0e9983360 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 28 May 2020 14:22:32 -0600 Subject: [PATCH 0936/1973] Remove the f05 files that shouldn't have been here --- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 5403852e58..266e3178b9 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -778,8 +778,6 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr2000 lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C48_hist_78pfts_CMIP6_simyr2000_c200317.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C24_hist_78pfts_CMIP6_simyr2000_c200317.nc - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_0.9x1.25_hist_78pfts_CMIP6_simyr2000_c190214.nc @@ -844,8 +842,6 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C96_hist_78pfts_CMIP6_simyr1850 lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C48_hist_78pfts_CMIP6_simyr1850_c200317.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_C24_hist_78pfts_CMIP6_simyr1850_c200317.nc - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_0.9x1.25_hist_78pfts_CMIP6_simyr1850_c190214.nc From cf341f7ce9506bb1e9fdbcc0564ea9d7d2dafb84 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 28 May 2020 14:39:35 -0600 Subject: [PATCH 0937/1973] Update change files --- doc/ChangeLog | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index e7595f6fd3..5a1937d9b7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev098 Originator(s): John Truesdale,UCAR/AMP,303-497-1386 -Date: Thu May 28 12:26:34 MDT 2020 +Date: Thu May 28 14:39:27 MDT 2020 One-line Summary: Bring in GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 Purpose of changes @@ -53,13 +53,12 @@ Notes of particular relevance for developers: (including Code reviews and testin --------------------------------------------- NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide -Caveats for developers (e.g., code that is duplicated that requires double maintenance): +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None Changes to tests or testing: Add C96 tests Code reviewed by: @ekluzek - CTSM testing: regular, tools [PASS means all tests PASS and OK means tests PASS other than expected fails.] @@ -70,7 +69,7 @@ CTSM testing: regular, tools tools-tests (test/tools): - cheyenne - + cheyenne - OK python testing (see instructions in python/README.md; document testing done): From 5d22d66e8d275bb0d16854768e8a2791104a18a9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 15:33:47 -0600 Subject: [PATCH 0938/1973] Use abspath for build_dir --- python/ctsm/build_ctsm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 0af77b482a..8064ec89d9 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -45,12 +45,13 @@ def main(cime_path): setup_logging_pre_config() args = _commandline_args() process_logging_args(args) + build_dir = os.path.abspath(args.build_dir) if args.rebuild: abort('--rebuild not yet implemented') else: build_ctsm(cime_path=cime_path, - build_dir=args.build_dir, + build_dir=build_dir, compiler=args.compiler, skip_build=args.skip_build, machine=args.machine, From 0806364a47d20f67ed0ed059bdbe0dea21582c03 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 15:38:42 -0600 Subject: [PATCH 0939/1973] Fixes for predefined machine --- python/ctsm/build_ctsm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 8064ec89d9..290afa41c8 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -135,6 +135,7 @@ def build_ctsm(cime_path, _create_and_build_case(cime_path=cime_path, build_dir=build_dir, + compiler=compiler, machine=machine, skip_build=skip_build) @@ -449,12 +450,13 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_and_build_case(cime_path, build_dir, machine=None, skip_build=False): +def _create_and_build_case(cime_path, build_dir, compiler, machine=None, skip_build=False): """Create a case and build the CTSM library and its dependencies Args: cime_path (str): path to root of cime build_dir (str): path to build directory + compiler (str): compiler to use machine (str or None): name of machine or None If None, we assume we're using an on-the-fly machine port Otherwise, machine should be the name of a machine known to cime @@ -479,9 +481,11 @@ def _create_and_build_case(cime_path, build_dir, machine=None, skip_build=False) machine_args = ['--machine', machine] create_newcase_cmd = [os.path.join(cime_path, 'scripts', 'create_newcase'), + '--output-root', build_dir, '--case', casedir, '--compset', _COMPSET, '--res', _RES, + '--compiler', compiler, '--driver', 'nuopc', '--run-unsupported'] create_newcase_cmd.extend(machine_args) From a3c4f46d911e3a072a523aca57f32cad695951e7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 15:51:29 -0600 Subject: [PATCH 0940/1973] Make links to .env_mach_specific files with more intuitive names --- python/ctsm/build_ctsm.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 290afa41c8..165eabcc77 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -500,6 +500,12 @@ def _create_and_build_case(cime_path, build_dir, compiler, machine=None, skip_bu make_link(os.path.join(casedir, 'bld'), os.path.join(build_dir, 'bld')) + if machine is not None: + # For a pre-existing machine, the .env_mach_specific files are likely useful to + # the user. Make sym links to these with more intuitive names. + for extension in ('sh', 'csh'): + make_link(os.path.join(casedir, '.env_mach_specific.{}'.format(extension)), + os.path.join(build_dir, 'ctsm_build_environment.{}'.format(extension))) if not skip_build: try: From be2c78d7e966ffe8b32c9dc1443af2d866f119a9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 15:53:32 -0600 Subject: [PATCH 0941/1973] Rename --skip-build to --no-build --- python/ctsm/build_ctsm.py | 18 +++++++++--------- python/ctsm/test/test_build_ctsm.py | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 165eabcc77..47ef2d32f6 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -53,7 +53,7 @@ def main(cime_path): build_ctsm(cime_path=cime_path, build_dir=build_dir, compiler=args.compiler, - skip_build=args.skip_build, + no_build=args.no_build, machine=args.machine, os_type=args.os, netcdf_path=args.netcdf_path, @@ -69,7 +69,7 @@ def main(cime_path): def build_ctsm(cime_path, build_dir, compiler, - skip_build=False, + no_build=False, machine=None, os_type=None, netcdf_path=None, @@ -87,7 +87,7 @@ def build_ctsm(cime_path, cime_path (str): path to root of cime build_dir (str): path to build directory compiler (str): compiler type - skip_build (bool): If True, set things up, but skip doing the actual build + no_build (bool): If True, set things up, but skip doing the actual build machine (str or None): machine name (a machine known to cime) os_type (str or None): operating system type; one of linux, aix, darwin or cnl Must be given if machine isn't given; ignored if machine is given @@ -137,7 +137,7 @@ def build_ctsm(cime_path, build_dir=build_dir, compiler=compiler, machine=machine, - skip_build=skip_build) + no_build=no_build) # ======================================================================== # Private functions @@ -217,10 +217,10 @@ def _commandline_args(args_to_parse=None): 'they are not allowed with --rebuild:') non_rebuild_optional_list = [] - non_rebuild_optional.add_argument('--skip-build', action='store_true', + non_rebuild_optional.add_argument('--no-build', action='store_true', help='Do the pre-build setup, but do not actually build CTSM\n' '(This is useful for testing, or for expert use.)') - non_rebuild_optional_list.append('skip-build') + non_rebuild_optional_list.append('no-build') new_machine_required = parser.add_argument_group( title='required arguments for a user-defined machine', @@ -450,7 +450,7 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_and_build_case(cime_path, build_dir, compiler, machine=None, skip_build=False): +def _create_and_build_case(cime_path, build_dir, compiler, machine=None, no_build=False): """Create a case and build the CTSM library and its dependencies Args: @@ -460,7 +460,7 @@ def _create_and_build_case(cime_path, build_dir, compiler, machine=None, skip_bu machine (str or None): name of machine or None If None, we assume we're using an on-the-fly machine port Otherwise, machine should be the name of a machine known to cime - skip_build (bool): If True, set things up, but skip doing the actual build + no_build (bool): If True, set things up, but skip doing the actual build """ casedir = os.path.join(build_dir, 'case') @@ -507,7 +507,7 @@ def _create_and_build_case(cime_path, build_dir, compiler, machine=None, skip_bu make_link(os.path.join(casedir, '.env_mach_specific.{}'.format(extension)), os.path.join(build_dir, 'ctsm_build_environment.{}'.format(extension))) - if not skip_build: + if not no_build: try: subprocess.check_call( [os.path.join(casedir, 'case.build'), diff --git a/python/ctsm/test/test_build_ctsm.py b/python/ctsm/test/test_build_ctsm.py index 9ec08349bf..24f00ab358 100644 --- a/python/ctsm/test/test_build_ctsm.py +++ b/python/ctsm/test/test_build_ctsm.py @@ -68,11 +68,11 @@ def test_commandlineArgs_rebuild_invalid4(self, mock_stderr): This tests an argument that is optional for new non-rebuild that isn't None """ - expected_re = r"--skip-build cannot be provided if --rebuild is set" + expected_re = r"--no-build cannot be provided if --rebuild is set" with self.assertRaises(SystemExit): _ = _commandline_args(args_to_parse=['build/directory', '--rebuild', - '--skip-build']) + '--no-build']) self.assertRegex(mock_stderr.getvalue(), expected_re) @patch('sys.stderr', new_callable=StringIO) From 33e459ba5a9c204f99c8f5c127c69f927654c5c7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 28 May 2020 16:48:46 -0600 Subject: [PATCH 0942/1973] Allow running unit & system tests separately --- python/Makefile | 17 +++++++++---- python/README.md | 19 ++++++++++---- python/ctsm/run_ctsm_py_tests.py | 25 ++++++++++++++++--- ....py => test_unit_job_launcher_no_batch.py} | 0 ..._build_ctsm.py => test_unit_build_ctsm.py} | 0 .../{test_machine.py => test_unit_machine.py} | 0 ..._path_utils.py => test_unit_path_utils.py} | 0 ...ys_tests.py => test_unit_run_sys_tests.py} | 0 8 files changed, 47 insertions(+), 14 deletions(-) rename python/ctsm/test/joblauncher/{test_job_launcher_no_batch.py => test_unit_job_launcher_no_batch.py} (100%) rename python/ctsm/test/{test_build_ctsm.py => test_unit_build_ctsm.py} (100%) rename python/ctsm/test/{test_machine.py => test_unit_machine.py} (100%) rename python/ctsm/test/{test_path_utils.py => test_unit_path_utils.py} (100%) rename python/ctsm/test/{test_run_sys_tests.py => test_unit_run_sys_tests.py} (100%) diff --git a/python/Makefile b/python/Makefile index e4e39d2b5b..470d32b9d4 100644 --- a/python/Makefile +++ b/python/Makefile @@ -6,9 +6,9 @@ verbose = not-set debug = not-set ifneq ($(python), not-set) -PYTHON=$(python) + PYTHON=$(python) else -PYTHON=python + PYTHON=python endif ifneq ($(debug), not-set) @@ -23,9 +23,16 @@ PYLINT_ARGS=-j 4 --rcfile=ctsm/.pylintrc PYLINT_SRC = \ ctsm -.PHONY: test -test: FORCE - $(PYTHON) ./run_ctsm_py_tests $(TEST_ARGS) +all: test lint +test: utest stest + +.PHONY: utest +utest: FORCE + $(PYTHON) ./run_ctsm_py_tests $(TEST_ARGS) --unit + +.PHONY: stest +stest: FORCE + $(PYTHON) ./run_ctsm_py_tests $(TEST_ARGS) --sys .PHONY: lint lint: FORCE diff --git a/python/README.md b/python/README.md index 8b265d3290..c1cd00e4aa 100644 --- a/python/README.md +++ b/python/README.md @@ -1,9 +1,14 @@ # Testing the code here -## Unit tests +## Running everything -Unit tests can be run in one of two ways; these do the same thing, but -support different options: +To run all tests (unit tests, system tests and pylint), simply run `make +all` from this directory. + +## Unit and system tests + +Unit and system tests can be run in one of two ways; these do the same +thing, but support different options: 1. via `make test` @@ -12,12 +17,16 @@ support different options: - python version: `make python=python3 test` - verbose: `make verbose=true test` - debug: `make debug=true test` - + + Note that unit tests and system tests can be run separately with + `make utest` or `make stest`, or they can all be run with `make + test`. + 2. via `./run_ctsm_py_tests` You can specify various arguments to this; run `./run_ctsm_py_tests -h` for details - + ## pylint You can run pylint on everything in the ctsm package with `make lint`. diff --git a/python/ctsm/run_ctsm_py_tests.py b/python/ctsm/run_ctsm_py_tests.py index 469940581a..f0171a1940 100644 --- a/python/ctsm/run_ctsm_py_tests.py +++ b/python/ctsm/run_ctsm_py_tests.py @@ -21,6 +21,15 @@ def main(description): args = _commandline_args(description) verbosity = _get_verbosity_level(args) + if args.pattern is not None: + pattern = args.pattern + elif args.unit: + pattern = 'test_unit*.py' + elif args.sys: + pattern = 'test_sys*.py' + else: + pattern = 'test*.py' + # This setup_for_tests call is the main motivation for having this wrapper script to # run the tests rather than just using 'python -m unittest discover' unit_testing.setup_for_tests(enable_critical_logs=args.debug) @@ -28,7 +37,7 @@ def main(description): mydir = os.path.dirname(os.path.abspath(__file__)) testsuite = unittest.defaultTestLoader.discover( start_dir=mydir, - pattern=args.pattern) + pattern=pattern) # NOTE(wjs, 2018-08-29) We may want to change the meaning of '--debug' # vs. '--verbose': I could imagine having --verbose set buffer=False, and --debug # additionally sets the logging level to much higher - e.g., debug level. @@ -51,9 +60,17 @@ def _commandline_args(description): output_level.add_argument('-d', '--debug', action='store_true', help='Run tests with even more verbosity') - parser.add_argument('-p', '--pattern', default='test*.py', - help='File name pattern to match\n' - 'Default is test*.py') + test_subset = parser.add_mutually_exclusive_group() + + test_subset.add_argument('-u', '--unit', action='store_true', + help='Only run unit tests') + + test_subset.add_argument('-s', '--sys', action='store_true', + help='Only run system tests') + + test_subset.add_argument('-p', '--pattern', + help='File name pattern to match\n' + 'Default is test*.py') args = parser.parse_args() diff --git a/python/ctsm/test/joblauncher/test_job_launcher_no_batch.py b/python/ctsm/test/joblauncher/test_unit_job_launcher_no_batch.py similarity index 100% rename from python/ctsm/test/joblauncher/test_job_launcher_no_batch.py rename to python/ctsm/test/joblauncher/test_unit_job_launcher_no_batch.py diff --git a/python/ctsm/test/test_build_ctsm.py b/python/ctsm/test/test_unit_build_ctsm.py similarity index 100% rename from python/ctsm/test/test_build_ctsm.py rename to python/ctsm/test/test_unit_build_ctsm.py diff --git a/python/ctsm/test/test_machine.py b/python/ctsm/test/test_unit_machine.py similarity index 100% rename from python/ctsm/test/test_machine.py rename to python/ctsm/test/test_unit_machine.py diff --git a/python/ctsm/test/test_path_utils.py b/python/ctsm/test/test_unit_path_utils.py similarity index 100% rename from python/ctsm/test/test_path_utils.py rename to python/ctsm/test/test_unit_path_utils.py diff --git a/python/ctsm/test/test_run_sys_tests.py b/python/ctsm/test/test_unit_run_sys_tests.py similarity index 100% rename from python/ctsm/test/test_run_sys_tests.py rename to python/ctsm/test/test_unit_run_sys_tests.py From a9ac792fe6a88b9413a9a72c92c8d113218b37f1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 May 2020 00:12:47 -0600 Subject: [PATCH 0943/1973] Start moving CNFireMethodMod to a more generic FireMethodType that could be used for FATES --- src/biogeochem/CNDriverMod.F90 | 10 ++-- src/biogeochem/CNFireBaseMod.F90 | 24 ++++---- src/biogeochem/CNFireFactoryMod.F90 | 12 ++-- src/biogeochem/CNFireLi2014Mod.F90 | 2 +- src/biogeochem/CNFireLi2016Mod.F90 | 2 +- src/biogeochem/CNFireNoFireMod.F90 | 2 +- src/biogeochem/CNVegetationFacade.F90 | 6 +- .../FireMethodType.F90} | 57 ++++++++++--------- 8 files changed, 58 insertions(+), 57 deletions(-) rename src/{biogeochem/CNFireMethodMod.F90 => main/FireMethodType.F90} (87%) diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 index aee1e804e7..f9f4b4532c 100644 --- a/src/biogeochem/CNDriverMod.F90 +++ b/src/biogeochem/CNDriverMod.F90 @@ -64,17 +64,17 @@ subroutine CNDriverInit(bounds, NLFilename, cnfire_method) ! !USES: use CNSharedParamsMod , only : use_fun use CNPhenologyMod , only : CNPhenologyInit - use CNFireMethodMod , only : cnfire_method_type + use FireMethodType , only : fire_method_type use SoilBiogeochemCompetitionMod, only : SoilBiogeochemCompetitionInit ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds character(len=*) , intent(in) :: NLFilename ! Namelist filename - class(cnfire_method_type) , intent(inout) :: cnfire_method + class(fire_method_type) , intent(inout) :: cnfire_method !----------------------------------------------------------------------- call SoilBiogeochemCompetitionInit(bounds) call CNPhenologyInit(bounds) - call cnfire_method%CNFireInit(bounds, NLFilename) + call cnfire_method%FireInit(bounds, NLFilename) end subroutine CNDriverInit @@ -114,7 +114,7 @@ subroutine CNDriverNoLeaching(bounds, use CNFUNMod , only: CNFUNInit !, CNFUN use CNPhenologyMod , only: CNPhenology use CNGRespMod , only: CNGResp - use CNFireMethodMod , only: cnfire_method_type + use FireMethodType , only: fire_method_type use CNCIsoFluxMod , only: CIsoFlux1, CIsoFlux2, CIsoFlux2h, CIsoFlux3 use CNC14DecayMod , only: C14Decay use CNCStateUpdate1Mod , only: CStateUpdate1,CStateUpdate0 @@ -185,7 +185,7 @@ subroutine CNDriverNoLeaching(bounds, type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst type(energyflux_type) , intent(in) :: energyflux_inst class(nutrient_competition_method_type) , intent(inout) :: nutrient_competition_method - class(cnfire_method_type) , intent(inout) :: cnfire_method + class(fire_method_type) , intent(inout) :: cnfire_method logical , intent(in) :: dribble_crophrv_xsmrpool_2atm ! ! !LOCAL VARIABLES: diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index bb4f6612cf..d0641c7145 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -42,7 +42,7 @@ module CNFireBaseMod use ColumnType , only : col use PatchType , only : patch use mct_mod - use CNFireMethodMod , only : cnfire_method_type + use FireMethodType , only : fire_method_type ! implicit none private @@ -74,7 +74,7 @@ module CNFireBaseMod end type ! - type, abstract, extends(cnfire_method_type) :: cnfire_base_type + type, abstract, extends(fire_method_type) :: cnfire_base_type private ! !PRIVATE MEMBER DATA: @@ -88,9 +88,9 @@ module CNFireBaseMod contains ! ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: CNFireInit ! Initialization of CNFire - procedure, public :: CNFireReadNML ! Read in namelist for CNFire - procedure, public :: CNFireInterp ! Interpolate fire data + procedure, public :: FireInit ! Initialization of CNFire + procedure, public :: FireReadNML ! Read in namelist for CNFire + procedure, public :: FireInterp ! Interpolate fire data procedure, public :: CNFireArea ! Calculate fire area procedure, public :: CNFireFluxes ! Calculate fire fluxes procedure(need_lightning_and_popdens_interface), public, deferred :: & @@ -129,7 +129,7 @@ end function need_lightning_and_popdens_interface contains !----------------------------------------------------------------------- - subroutine CNFireInit( this, bounds, NLFilename ) + subroutine FireInit( this, bounds, NLFilename ) ! ! !DESCRIPTION: ! Initialize CN Fire module @@ -156,10 +156,10 @@ subroutine CNFireInit( this, bounds, NLFilename ) call this%lnfm_interp(bounds) end if - end subroutine CNFireInit + end subroutine FireInit !----------------------------------------------------------------------- - subroutine CNFireReadNML( this, NLFilename ) + subroutine FireReadNML( this, NLFilename ) ! ! !DESCRIPTION: ! Read the namelist for CNFire @@ -179,7 +179,7 @@ subroutine CNFireReadNML( this, NLFilename ) integer :: ierr ! error code integer :: unitn ! unit for namelist file - character(len=*), parameter :: subname = 'CNFireReadNML' + character(len=*), parameter :: subname = 'FireReadNML' character(len=*), parameter :: nmlname = 'lifire_inparm' !----------------------------------------------------------------------- real(r8) :: cli_scale, boreal_peatfire_c, pot_hmn_ign_counts_alpha @@ -261,10 +261,10 @@ subroutine CNFireReadNML( this, NLFilename ) end if end if - end subroutine CNFireReadNML + end subroutine FireReadNML !----------------------------------------------------------------------- - subroutine CNFireInterp(this,bounds) + subroutine FireInterp(this,bounds) ! ! !DESCRIPTION: ! Interpolate CN Fire datasets @@ -279,7 +279,7 @@ subroutine CNFireInterp(this,bounds) call this%lnfm_interp(bounds) end if - end subroutine CNFireInterp + end subroutine FireInterp !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index d1ad7f9452..d224348cdf 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -2,7 +2,7 @@ module CNFireFactoryMod !--------------------------------------------------------------------------- ! !DESCRIPTION: - ! Factory to create an instance of cnfire_method_type. This module figures + ! Factory to create an instance of fire_method_type. This module figures ! out the particular type to return. ! ! !USES: @@ -16,7 +16,7 @@ module CNFireFactoryMod ! ! !PUBLIC ROUTINES: public :: CNFireReadNML ! read the fire namelist - public :: create_cnfire_method ! create an object of class cnfire_method_type + public :: create_cnfire_method ! create an object of class fire_method_type ! !PRIVATE DATA MEMBERS: character(len=80), private :: fire_method = "li2014qianfrc" @@ -85,12 +85,12 @@ end subroutine CNFireReadNML subroutine create_cnfire_method( NLFilename, cnfire_method ) ! ! !DESCRIPTION: - ! Create and return an object of cnfire_method_type. The particular type + ! Create and return an object of fire_method_type. The particular type ! is determined based on a namelist parameter. ! ! !USES: use shr_kind_mod , only : SHR_KIND_CL - use CNFireMethodMod , only : cnfire_method_type + use FireMethodType , only : fire_method_type use CNFireNoFireMod , only : cnfire_nofire_type use CNFireLi2014Mod , only : cnfire_li2014_type use CNFireLi2016Mod , only : cnfire_li2016_type @@ -98,7 +98,7 @@ subroutine create_cnfire_method( NLFilename, cnfire_method ) ! ! !ARGUMENTS: character(len=*), intent(in) :: NLFilename ! Namelist filename - class(cnfire_method_type), allocatable, intent(inout) :: cnfire_method + class(fire_method_type), allocatable, intent(inout) :: cnfire_method ! ! !LOCAL VARIABLES: character(len=*), parameter :: subname = 'create_cnfire_method' @@ -118,7 +118,7 @@ subroutine create_cnfire_method( NLFilename, cnfire_method ) call endrun(msg=errMsg(sourcefile, __LINE__)) end select - call cnfire_method%CNFireReadNML( NLFilename ) + call cnfire_method%FireReadNML( NLFilename ) end subroutine create_cnfire_method diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 68d2d52a0e..0118cf748a 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -39,7 +39,7 @@ module CNFireLi2014Mod use GridcellType , only : grc use ColumnType , only : col use PatchType , only : patch - use CNFireMethodMod , only : cnfire_method_type + use FireMethodType , only : fire_method_type use CNFireBaseMod , only : cnfire_base_type, cnfire_const ! implicit none diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index 7649c7d1aa..6a6a73e453 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -40,7 +40,7 @@ module CNFireLi2016Mod use ColumnType , only : col use PatchType , only : patch use SoilBiogeochemStateType , only : get_spinup_latitude_term - use CNFireMethodMod , only : cnfire_method_type + use FireMethodType , only : fire_method_type use CNFireBaseMod , only : cnfire_base_type, cnfire_const ! implicit none diff --git a/src/biogeochem/CNFireNoFireMod.F90 b/src/biogeochem/CNFireNoFireMod.F90 index 4adc36b04c..025d45cbd8 100644 --- a/src/biogeochem/CNFireNoFireMod.F90 +++ b/src/biogeochem/CNFireNoFireMod.F90 @@ -19,7 +19,7 @@ module CNFireNoFireMod use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use Wateratm2lndBulkType , only : wateratm2lndbulk_type - use CNFireMethodMod , only : cnfire_method_type + use FireMethodType , only : fire_method_type use CNFireBaseMod , only : cnfire_base_type ! implicit none diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index b79869aa6e..d69f4a81ef 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -55,7 +55,7 @@ module CNVegetationFacade use CNVegCarbonStateType , only : cnveg_carbonstate_type use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNFireMethodMod , only : cnfire_method_type + use FireMethodType , only : fire_method_type use CNProductsMod , only : cn_products_type use NutrientCompetitionMethodMod , only : nutrient_competition_method_type use SpeciesIsotopeType , only : species_isotope_type @@ -123,7 +123,7 @@ module CNVegetationFacade type(cn_products_type) :: n_products_inst type(cn_balance_type) :: cn_balance_inst - class(cnfire_method_type), allocatable :: cnfire_method + class(fire_method_type), allocatable :: cnfire_method type(dgvs_type) :: dgvs_inst ! Control variables @@ -602,7 +602,7 @@ subroutine InterpFileInputs(this, bounds) character(len=*), parameter :: subname = 'InterpFileInputs' !----------------------------------------------------------------------- - call this%cnfire_method%CNFireInterp(bounds) + call this%cnfire_method%FireInterp(bounds) end subroutine InterpFileInputs diff --git a/src/biogeochem/CNFireMethodMod.F90 b/src/main/FireMethodType.F90 similarity index 87% rename from src/biogeochem/CNFireMethodMod.F90 rename to src/main/FireMethodType.F90 index 76af46a334..c4606e4e52 100644 --- a/src/biogeochem/CNFireMethodMod.F90 +++ b/src/main/FireMethodType.F90 @@ -1,8 +1,9 @@ -module CNFireMethodMod +module FireMethodType !--------------------------------------------------------------------------- ! !DESCRIPTION: - ! Abstract base class for functions to implement CN and BGC fire model + ! Abstract base class for functions to implement fire model and fire data for + ! both FATES and BGC. ! ! Created by Erik Kluzek, following Bill Sack's implementation of polymorphism ! !USES: @@ -10,19 +11,19 @@ module CNFireMethodMod private ! ! !PUBLIC TYPES: - public :: cnfire_method_type + public :: fire_method_type - type, abstract :: cnfire_method_type + type, abstract :: fire_method_type contains ! Initialize the fire datasets - procedure(CNFireInit_interface) , public, deferred :: CNFireInit + procedure(FireInit_interface) , public, deferred :: FireInit ! Read namelist for the fire datasets - procedure(CNFireReadNML_interface), public, deferred :: CNFireReadNML + procedure(FireReadNML_interface), public, deferred :: FireReadNML ! Interpolate the fire datasets - procedure(CNFireInterp_interface) , public, deferred :: CNFireInterp + procedure(FireInterp_interface) , public, deferred :: FireInterp ! Figure out the fire area procedure(CNFireArea_interface) , public, deferred :: CNFireArea @@ -30,7 +31,7 @@ module CNFireMethodMod ! Figure out the fire fluxes procedure(CNFireFluxes_interface) , public, deferred :: CNFireFluxes - end type cnfire_method_type + end type fire_method_type abstract interface @@ -48,50 +49,50 @@ module CNFireMethodMod ! consistent between different implementations. ! !--------------------------------------------------------------------------- - subroutine CNFireInit_interface(this, bounds, NLFilename ) + subroutine FireInit_interface(this, bounds, NLFilename ) ! ! !DESCRIPTION: - ! Initialize CN Fire datasets + ! Initialize Fire datasets ! ! USES use decompMod , only : bounds_type - import :: cnfire_method_type + import :: fire_method_type ! !ARGUMENTS: - class(cnfire_method_type) :: this + class(fire_method_type) :: this type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename !----------------------------------------------------------------------- - end subroutine CNFireInit_interface + end subroutine FireInit_interface - subroutine CNFireReadNML_interface(this, NLFilename ) + subroutine FireReadNML_interface(this, NLFilename ) ! ! !DESCRIPTION: ! Read general fire namelist ! ! USES - import :: cnfire_method_type + import :: fire_method_type ! !ARGUMENTS: - class(cnfire_method_type) :: this + class(fire_method_type) :: this character(len=*), intent(in) :: NLFilename !----------------------------------------------------------------------- - end subroutine CNFireReadNML_interface + end subroutine FireReadNML_interface - subroutine CNFireInterp_interface(this, bounds) + subroutine FireInterp_interface(this, bounds) ! ! !DESCRIPTION: - ! Interpolate CN Fire datasets + ! Interpolate Fire datasets ! ! USES use decompMod , only : bounds_type - import :: cnfire_method_type + import :: fire_method_type ! !ARGUMENTS: - class(cnfire_method_type) :: this + class(fire_method_type) :: this type(bounds_type), intent(in) :: bounds !----------------------------------------------------------------------- - end subroutine CNFireInterp_interface + end subroutine FireInterp_interface !----------------------------------------------------------------------- subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & @@ -112,10 +113,10 @@ subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soil use Wateratm2lndBulkType , only : wateratm2lndbulk_type use CNVegStateType , only : cnveg_state_type use CNVegCarbonStateType , only : cnveg_carbonstate_type - import :: cnfire_method_type + import :: fire_method_type ! ! !ARGUMENTS: - class(cnfire_method_type) :: this + class(fire_method_type) :: this type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilc ! number of soil columns in filter integer , intent(in) :: filter_soilc(:) ! filter for soil columns @@ -143,7 +144,7 @@ subroutine CNFireFluxes_interface (this, bounds, num_soilc, filter_soilc, num_so ! ! !DESCRIPTION: ! Fire effects routine for coupled carbon-nitrogen code (CN). - ! Relies primarily on estimate of fractional area burned, from CNFireArea(). + ! Relies primarily on estimate of fractional area burned, from FireArea(). ! ! Total fire carbon emissions (g C/m2 land area/yr) ! =avg(COL_FIRE_CLOSS)*seconds_per_year + avg(SOMC_FIRE)*seconds_per_year + @@ -160,10 +161,10 @@ subroutine CNFireFluxes_interface (this, bounds, num_soilc, filter_soilc, num_so use CNVegCarbonFluxType , only : cnveg_carbonflux_type use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - import :: cnfire_method_type + import :: fire_method_type ! ! !ARGUMENTS: - class(cnfire_method_type) :: this + class(fire_method_type) :: this type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilc ! number of soil columns in filter integer , intent(in) :: filter_soilc(:) ! filter for soil columns @@ -190,4 +191,4 @@ end subroutine CNFireFluxes_interface end interface -end module CNFireMethodMod +end module FireMethodType From aca2996cdc6844bc0190f13bf88eaadaaa897069 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 May 2020 01:02:07 -0600 Subject: [PATCH 0944/1973] Create a new level FireDataBaseType for reading of data --- src/biogeochem/CNFireBaseMod.F90 | 391 +------------------------- src/main/FireDataBaseType.F90 | 455 +++++++++++++++++++++++++++++++ 2 files changed, 459 insertions(+), 387 deletions(-) create mode 100644 src/main/FireDataBaseType.F90 diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index d0641c7145..e30dc7270c 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -15,14 +15,8 @@ module CNFireBaseMod ! ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL - use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create, shr_strdata_print - use shr_strdata_mod , only : shr_strdata_advance use shr_log_mod , only : errMsg => shr_log_errMsg use clm_varctl , only : iulog - use spmdMod , only : masterproc, mpicom, comp_id - use fileutils , only : getavu, relavu - use decompMod , only : gsmap_lnd_gdc2glo - use domainMod , only : ldomain use pftconMod , only : noveg, pftcon use abortutils , only : endrun use decompMod , only : bounds_type @@ -36,13 +30,13 @@ module CNFireBaseMod use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type use GridcellType , only : grc use ColumnType , only : col use PatchType , only : patch - use mct_mod use FireMethodType , only : fire_method_type + use FireDataBaseType , only : fire_base_type ! implicit none private @@ -74,33 +68,17 @@ module CNFireBaseMod end type ! - type, abstract, extends(fire_method_type) :: cnfire_base_type + type, abstract, extends(fire_base_type) :: cnfire_base_type private ! !PRIVATE MEMBER DATA: - real(r8), public, pointer :: forc_lnfm(:) ! Lightning frequency - real(r8), public, pointer :: forc_hdm(:) ! Human population density - - type(shr_strdata_type) :: sdat_hdm ! Human population density input data stream - type(shr_strdata_type) :: sdat_lnfm ! Lightning input data stream - - contains ! ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: FireInit ! Initialization of CNFire procedure, public :: FireReadNML ! Read in namelist for CNFire - procedure, public :: FireInterp ! Interpolate fire data procedure, public :: CNFireArea ! Calculate fire area procedure, public :: CNFireFluxes ! Calculate fire fluxes - procedure(need_lightning_and_popdens_interface), public, deferred :: & - need_lightning_and_popdens ! Returns true if need lightning & popdens ! - ! !PRIVATE MEMBER FUNCTIONS: - procedure, private :: hdm_init ! position datasets for dynamic human population density - procedure, private :: hdm_interp ! interpolates between two years of human pop. density file data - procedure, private :: lnfm_init ! position datasets for Lightning - procedure, private :: lnfm_interp ! interpolates between two years of Lightning file data end type cnfire_base_type !----------------------------------------------------------------------- @@ -128,36 +106,6 @@ end function need_lightning_and_popdens_interface contains - !----------------------------------------------------------------------- - subroutine FireInit( this, bounds, NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize CN Fire module - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename - !----------------------------------------------------------------------- - - if ( this%need_lightning_and_popdens() ) then - ! Allocate lightning forcing data - allocate( this%forc_lnfm(bounds%begg:bounds%endg) ) - this%forc_lnfm(bounds%begg:) = nan - ! Allocate pop dens forcing data - allocate( this%forc_hdm(bounds%begg:bounds%endg) ) - this%forc_hdm(bounds%begg:) = nan - - call this%hdm_init(bounds, NLFilename) - call this%hdm_interp(bounds) - call this%lnfm_init(bounds, NLFilename) - call this%lnfm_interp(bounds) - end if - - end subroutine FireInit - !----------------------------------------------------------------------- subroutine FireReadNML( this, NLFilename ) ! @@ -263,24 +211,6 @@ subroutine FireReadNML( this, NLFilename ) end subroutine FireReadNML - !----------------------------------------------------------------------- - subroutine FireInterp(this,bounds) - ! - ! !DESCRIPTION: - ! Interpolate CN Fire datasets - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - !----------------------------------------------------------------------- - - if ( this%need_lightning_and_popdens() ) then - call this%hdm_interp(bounds) - call this%lnfm_interp(bounds) - end if - - end subroutine FireInterp - !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & @@ -975,317 +905,4 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte end subroutine CNFireFluxes - !----------------------------------------------------------------------- - subroutine hdm_init( this, bounds, NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize data stream information for population density. - ! - ! !USES: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use clm_nlUtilsMod , only : find_nlgroup_name - use ndepStreamMod , only : clm_domain_mct - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - implicit none - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: stream_year_first_popdens ! first year in pop. dens. stream to use - integer :: stream_year_last_popdens ! last year in pop. dens. stream to use - integer :: model_year_align_popdens ! align stream_year_first_hdm with - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_popdens ! population density streams filename - character(len=CL) :: popdensmapalgo = 'bilinear' ! mapping alogrithm for population density - character(len=CL) :: popdens_tintalgo = 'nearest'! time interpolation alogrithm for population density - character(*), parameter :: subName = "('hdmdyn_init')" - character(*), parameter :: F00 = "('(hdmdyn_init) ',4a)" - !----------------------------------------------------------------------- - - namelist /popd_streams/ & - stream_year_first_popdens, & - stream_year_last_popdens, & - model_year_align_popdens, & - popdensmapalgo, & - stream_fldFileName_popdens, & - popdens_tintalgo - - ! Default values for namelist - stream_year_first_popdens = 1 ! first year in stream to use - stream_year_last_popdens = 1 ! last year in stream to use - model_year_align_popdens = 1 ! align stream_year_first_popdens with this model year - stream_fldFileName_popdens = ' ' - - ! Read popd_streams namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'popd_streams', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=popd_streams,iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading popd_streams namelist'//errMsg(sourcefile, __LINE__)) - end if - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_popdens, mpicom) - call shr_mpi_bcast(stream_year_last_popdens, mpicom) - call shr_mpi_bcast(model_year_align_popdens, mpicom) - call shr_mpi_bcast(stream_fldFileName_popdens, mpicom) - call shr_mpi_bcast(popdens_tintalgo, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'popdens_streams settings:' - write(iulog,*) ' stream_year_first_popdens = ',stream_year_first_popdens - write(iulog,*) ' stream_year_last_popdens = ',stream_year_last_popdens - write(iulog,*) ' model_year_align_popdens = ',model_year_align_popdens - write(iulog,*) ' stream_fldFileName_popdens = ',stream_fldFileName_popdens - write(iulog,*) ' popdens_tintalgo = ',popdens_tintalgo - write(iulog,*) ' ' - endif - - call clm_domain_mct (bounds, dom_clm) - - call shr_strdata_create(this%sdat_hdm,name="clmhdm", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_popdens, & - yearLast=stream_year_last_popdens, & - yearAlign=model_year_align_popdens, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_popdens), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='mask', & - filePath='', & - filename=(/trim(stream_fldFileName_popdens)/) , & - fldListFile='hdm', & - fldListModel='hdm', & - fillalgo='none', & - mapalgo=popdensmapalgo, & - calendar=get_calendar(), & - tintalgo=popdens_tintalgo, & - taxmode='extend' ) - - if (masterproc) then - call shr_strdata_print(this%sdat_hdm,'population density data') - endif - - ! Add history fields - call hist_addfld1d (fname='HDM', units='counts/km^2', & - avgflag='A', long_name='human population density', & - ptr_lnd=this%forc_hdm, default='inactive') - - end subroutine hdm_init - - !----------------------------------------------------------------------- - subroutine hdm_interp( this, bounds) - ! - ! !DESCRIPTION: - ! Interpolate data stream information for population density. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g, ig - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(this%sdat_hdm, mcdate, sec, mpicom, 'hdmdyn') - - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - this%forc_hdm(g) = this%sdat_hdm%avs(1)%rAttr(1,ig) - end do - - end subroutine hdm_interp - - !----------------------------------------------------------------------- - subroutine lnfm_init( this, bounds, NLFilename ) - ! - ! !DESCRIPTION: - ! - ! Initialize data stream information for Lightning. - ! - ! !USES: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use clm_nlUtilsMod , only : find_nlgroup_name - use ndepStreamMod , only : clm_domain_mct - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - implicit none - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename - ! - ! !LOCAL VARIABLES: - integer :: stream_year_first_lightng ! first year in Lightning stream to use - integer :: stream_year_last_lightng ! last year in Lightning stream to use - integer :: model_year_align_lightng ! align stream_year_first_lnfm with - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_lightng ! lightning stream filename to read - character(len=CL) :: lightng_tintalgo = 'linear'! time interpolation alogrithm - character(len=CL) :: lightngmapalgo = 'bilinear'! Mapping alogrithm - character(*), parameter :: subName = "('lnfmdyn_init')" - character(*), parameter :: F00 = "('(lnfmdyn_init) ',4a)" - !----------------------------------------------------------------------- - - namelist /light_streams/ & - stream_year_first_lightng, & - stream_year_last_lightng, & - model_year_align_lightng, & - lightngmapalgo, & - stream_fldFileName_lightng, & - lightng_tintalgo - - ! Default values for namelist - stream_year_first_lightng = 1 ! first year in stream to use - stream_year_last_lightng = 1 ! last year in stream to use - model_year_align_lightng = 1 ! align stream_year_first_lnfm with this model year - stream_fldFileName_lightng = ' ' - - ! Read light_streams namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'light_streams', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=light_streams,iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading light_streams namelist'//errMsg(sourcefile, __LINE__)) - end if - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_lightng, mpicom) - call shr_mpi_bcast(stream_year_last_lightng, mpicom) - call shr_mpi_bcast(model_year_align_lightng, mpicom) - call shr_mpi_bcast(stream_fldFileName_lightng, mpicom) - call shr_mpi_bcast(lightng_tintalgo, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'light_stream settings:' - write(iulog,*) ' stream_year_first_lightng = ',stream_year_first_lightng - write(iulog,*) ' stream_year_last_lightng = ',stream_year_last_lightng - write(iulog,*) ' model_year_align_lightng = ',model_year_align_lightng - write(iulog,*) ' stream_fldFileName_lightng = ',stream_fldFileName_lightng - write(iulog,*) ' lightng_tintalgo = ',lightng_tintalgo - write(iulog,*) ' ' - endif - - call clm_domain_mct (bounds, dom_clm) - - call shr_strdata_create(this%sdat_lnfm,name="clmlnfm", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_lightng, & - yearLast=stream_year_last_lightng, & - yearAlign=model_year_align_lightng, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_lightng), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='mask', & - filePath='', & - filename=(/trim(stream_fldFileName_lightng)/),& - fldListFile='lnfm', & - fldListModel='lnfm', & - fillalgo='none', & - tintalgo=lightng_tintalgo, & - mapalgo=lightngmapalgo, & - calendar=get_calendar(), & - taxmode='cycle' ) - - if (masterproc) then - call shr_strdata_print(this%sdat_lnfm,'Lightning data') - endif - - ! Add history fields - call hist_addfld1d (fname='LNFM', units='counts/km^2/hr', & - avgflag='A', long_name='Lightning frequency', & - ptr_lnd=this%forc_lnfm, default='inactive') - - end subroutine lnfm_init - - !----------------------------------------------------------------------- - subroutine lnfm_interp(this, bounds ) - ! - ! !DESCRIPTION: - ! Interpolate data stream information for Lightning. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g, ig - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(this%sdat_lnfm, mcdate, sec, mpicom, 'lnfmdyn') - - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - this%forc_lnfm(g) = this%sdat_lnfm%avs(1)%rAttr(1,ig) - end do - - end subroutine lnfm_interp - end module CNFireBaseMod diff --git a/src/main/FireDataBaseType.F90 b/src/main/FireDataBaseType.F90 new file mode 100644 index 0000000000..be9325d798 --- /dev/null +++ b/src/main/FireDataBaseType.F90 @@ -0,0 +1,455 @@ +module FireDataBaseType + +#include "shr_assert.h" + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! module for handling of fire data + ! + ! !USES: + use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL + use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create, shr_strdata_print + use shr_strdata_mod , only : shr_strdata_advance + use shr_log_mod , only : errMsg => shr_log_errMsg + use clm_varctl , only : iulog + use spmdMod , only : masterproc, mpicom, comp_id + use fileutils , only : getavu, relavu + use decompMod , only : gsmap_lnd_gdc2glo + use domainMod , only : ldomain + use abortutils , only : endrun + use decompMod , only : bounds_type + use mct_mod + use FireMethodType , only : fire_method_type + ! + implicit none + private + ! + ! !PUBLIC TYPES: + public :: fire_base_type + + ! + type, abstract, extends(fire_method_type) :: fire_base_type + private + ! !PRIVATE MEMBER DATA: + + real(r8), public, pointer :: forc_lnfm(:) ! Lightning frequency + real(r8), public, pointer :: forc_hdm(:) ! Human population density + + type(shr_strdata_type) :: sdat_hdm ! Human population density input data stream + type(shr_strdata_type) :: sdat_lnfm ! Lightning input data stream + + + contains + ! + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: FireInit ! Initialization of Fire + procedure(FireReadNML_interface), public, deferred :: FireReadNML ! Read in namelist for Fire + procedure, public :: FireInterp ! Interpolate fire data + procedure(need_lightning_and_popdens_interface), public, deferred :: & + need_lightning_and_popdens ! Returns true if need lightning & popdens + ! + ! !PRIVATE MEMBER FUNCTIONS: + procedure, private :: hdm_init ! position datasets for dynamic human population density + procedure, private :: hdm_interp ! interpolates between two years of human pop. density file data + procedure, private :: lnfm_init ! position datasets for Lightning + procedure, private :: lnfm_interp ! interpolates between two years of Lightning file data + end type fire_base_type + !----------------------------------------------------------------------- + + abstract interface + !----------------------------------------------------------------------- + function need_lightning_and_popdens_interface(this) result(need_lightning_and_popdens) + ! + ! !DESCRIPTION: + ! Returns true if need lightning and popdens, false otherwise + ! + ! USES + import :: fire_base_type + ! + ! !ARGUMENTS: + class(fire_base_type), intent(in) :: this + logical :: need_lightning_and_popdens ! function result + !----------------------------------------------------------------------- + end function need_lightning_and_popdens_interface + end interface + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + +contains + + !----------------------------------------------------------------------- + subroutine FireReadNML_interface( this, NLFilename ) + ! + ! !DESCRIPTION: + ! Read the namelist for Fire + ! + ! !USES: + ! + ! !ARGUMENTS: + class(fire_base_type) :: this + character(len=*), intent(in) :: NLFilename ! Namelist filename + end subroutine FireReadNML_interface + + !----------------------------------------------------------------------- + subroutine FireInit( this, bounds, NLFilename ) + ! + ! !DESCRIPTION: + ! Initialize CN Fire module + ! !USES: + use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) + ! + ! !ARGUMENTS: + class(fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + character(len=*), intent(in) :: NLFilename + !----------------------------------------------------------------------- + + if ( this%need_lightning_and_popdens() ) then + ! Allocate lightning forcing data + allocate( this%forc_lnfm(bounds%begg:bounds%endg) ) + this%forc_lnfm(bounds%begg:) = nan + ! Allocate pop dens forcing data + allocate( this%forc_hdm(bounds%begg:bounds%endg) ) + this%forc_hdm(bounds%begg:) = nan + + call this%hdm_init(bounds, NLFilename) + call this%hdm_interp(bounds) + call this%lnfm_init(bounds, NLFilename) + call this%lnfm_interp(bounds) + end if + + end subroutine FireInit + + !----------------------------------------------------------------------- + subroutine FireInterp(this,bounds) + ! + ! !DESCRIPTION: + ! Interpolate CN Fire datasets + ! + ! !ARGUMENTS: + class(fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + !----------------------------------------------------------------------- + + if ( this%need_lightning_and_popdens() ) then + call this%hdm_interp(bounds) + call this%lnfm_interp(bounds) + end if + + end subroutine FireInterp + + !----------------------------------------------------------------------- + subroutine hdm_init( this, bounds, NLFilename ) + ! + ! !DESCRIPTION: + ! Initialize data stream information for population density. + ! + ! !USES: + use clm_varctl , only : inst_name + use clm_time_manager , only : get_calendar + use ncdio_pio , only : pio_subsystem + use shr_pio_mod , only : shr_pio_getiotype + use clm_nlUtilsMod , only : find_nlgroup_name + use ndepStreamMod , only : clm_domain_mct + use histFileMod , only : hist_addfld1d + ! + ! !ARGUMENTS: + implicit none + class(fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + character(len=*), intent(in) :: NLFilename ! Namelist filename + ! + ! !LOCAL VARIABLES: + integer :: stream_year_first_popdens ! first year in pop. dens. stream to use + integer :: stream_year_last_popdens ! last year in pop. dens. stream to use + integer :: model_year_align_popdens ! align stream_year_first_hdm with + integer :: nu_nml ! unit for namelist file + integer :: nml_error ! namelist i/o error flag + type(mct_ggrid) :: dom_clm ! domain information + character(len=CL) :: stream_fldFileName_popdens ! population density streams filename + character(len=CL) :: popdensmapalgo = 'bilinear' ! mapping alogrithm for population density + character(len=CL) :: popdens_tintalgo = 'nearest'! time interpolation alogrithm for population density + character(*), parameter :: subName = "('hdmdyn_init')" + character(*), parameter :: F00 = "('(hdmdyn_init) ',4a)" + !----------------------------------------------------------------------- + + namelist /popd_streams/ & + stream_year_first_popdens, & + stream_year_last_popdens, & + model_year_align_popdens, & + popdensmapalgo, & + stream_fldFileName_popdens, & + popdens_tintalgo + + ! Default values for namelist + stream_year_first_popdens = 1 ! first year in stream to use + stream_year_last_popdens = 1 ! last year in stream to use + model_year_align_popdens = 1 ! align stream_year_first_popdens with this model year + stream_fldFileName_popdens = ' ' + + ! Read popd_streams namelist + if (masterproc) then + nu_nml = getavu() + open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) + call find_nlgroup_name(nu_nml, 'popd_streams', status=nml_error) + if (nml_error == 0) then + read(nu_nml, nml=popd_streams,iostat=nml_error) + if (nml_error /= 0) then + call endrun(msg='ERROR reading popd_streams namelist'//errMsg(sourcefile, __LINE__)) + end if + end if + close(nu_nml) + call relavu( nu_nml ) + endif + + call shr_mpi_bcast(stream_year_first_popdens, mpicom) + call shr_mpi_bcast(stream_year_last_popdens, mpicom) + call shr_mpi_bcast(model_year_align_popdens, mpicom) + call shr_mpi_bcast(stream_fldFileName_popdens, mpicom) + call shr_mpi_bcast(popdens_tintalgo, mpicom) + + if (masterproc) then + write(iulog,*) ' ' + write(iulog,*) 'popdens_streams settings:' + write(iulog,*) ' stream_year_first_popdens = ',stream_year_first_popdens + write(iulog,*) ' stream_year_last_popdens = ',stream_year_last_popdens + write(iulog,*) ' model_year_align_popdens = ',model_year_align_popdens + write(iulog,*) ' stream_fldFileName_popdens = ',stream_fldFileName_popdens + write(iulog,*) ' popdens_tintalgo = ',popdens_tintalgo + write(iulog,*) ' ' + endif + + call clm_domain_mct (bounds, dom_clm) + + call shr_strdata_create(this%sdat_hdm,name="clmhdm", & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype(inst_name), & + mpicom=mpicom, compid=comp_id, & + gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & + nxg=ldomain%ni, nyg=ldomain%nj, & + yearFirst=stream_year_first_popdens, & + yearLast=stream_year_last_popdens, & + yearAlign=model_year_align_popdens, & + offset=0, & + domFilePath='', & + domFileName=trim(stream_fldFileName_popdens), & + domTvarName='time', & + domXvarName='lon' , & + domYvarName='lat' , & + domAreaName='area', & + domMaskName='mask', & + filePath='', & + filename=(/trim(stream_fldFileName_popdens)/) , & + fldListFile='hdm', & + fldListModel='hdm', & + fillalgo='none', & + mapalgo=popdensmapalgo, & + calendar=get_calendar(), & + tintalgo=popdens_tintalgo, & + taxmode='extend' ) + + if (masterproc) then + call shr_strdata_print(this%sdat_hdm,'population density data') + endif + + ! Add history fields + call hist_addfld1d (fname='HDM', units='counts/km^2', & + avgflag='A', long_name='human population density', & + ptr_lnd=this%forc_hdm, default='inactive') + + end subroutine hdm_init + + !----------------------------------------------------------------------- + subroutine hdm_interp( this, bounds) + ! + ! !DESCRIPTION: + ! Interpolate data stream information for population density. + ! + ! !USES: + use clm_time_manager, only : get_curr_date + ! + ! !ARGUMENTS: + class(fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: g, ig + integer :: year ! year (0, ...) for nstep+1 + integer :: mon ! month (1, ..., 12) for nstep+1 + integer :: day ! day of month (1, ..., 31) for nstep+1 + integer :: sec ! seconds into current date for nstep+1 + integer :: mcdate ! Current model date (yyyymmdd) + !----------------------------------------------------------------------- + + call get_curr_date(year, mon, day, sec) + mcdate = year*10000 + mon*100 + day + + call shr_strdata_advance(this%sdat_hdm, mcdate, sec, mpicom, 'hdmdyn') + + ig = 0 + do g = bounds%begg,bounds%endg + ig = ig+1 + this%forc_hdm(g) = this%sdat_hdm%avs(1)%rAttr(1,ig) + end do + + end subroutine hdm_interp + + !----------------------------------------------------------------------- + subroutine lnfm_init( this, bounds, NLFilename ) + ! + ! !DESCRIPTION: + ! + ! Initialize data stream information for Lightning. + ! + ! !USES: + use clm_varctl , only : inst_name + use clm_time_manager , only : get_calendar + use ncdio_pio , only : pio_subsystem + use shr_pio_mod , only : shr_pio_getiotype + use clm_nlUtilsMod , only : find_nlgroup_name + use ndepStreamMod , only : clm_domain_mct + use histFileMod , only : hist_addfld1d + ! + ! !ARGUMENTS: + implicit none + class(fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + character(len=*), intent(in) :: NLFilename + ! + ! !LOCAL VARIABLES: + integer :: stream_year_first_lightng ! first year in Lightning stream to use + integer :: stream_year_last_lightng ! last year in Lightning stream to use + integer :: model_year_align_lightng ! align stream_year_first_lnfm with + integer :: nu_nml ! unit for namelist file + integer :: nml_error ! namelist i/o error flag + type(mct_ggrid) :: dom_clm ! domain information + character(len=CL) :: stream_fldFileName_lightng ! lightning stream filename to read + character(len=CL) :: lightng_tintalgo = 'linear'! time interpolation alogrithm + character(len=CL) :: lightngmapalgo = 'bilinear'! Mapping alogrithm + character(*), parameter :: subName = "('lnfmdyn_init')" + character(*), parameter :: F00 = "('(lnfmdyn_init) ',4a)" + !----------------------------------------------------------------------- + + namelist /light_streams/ & + stream_year_first_lightng, & + stream_year_last_lightng, & + model_year_align_lightng, & + lightngmapalgo, & + stream_fldFileName_lightng, & + lightng_tintalgo + + ! Default values for namelist + stream_year_first_lightng = 1 ! first year in stream to use + stream_year_last_lightng = 1 ! last year in stream to use + model_year_align_lightng = 1 ! align stream_year_first_lnfm with this model year + stream_fldFileName_lightng = ' ' + + ! Read light_streams namelist + if (masterproc) then + nu_nml = getavu() + open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) + call find_nlgroup_name(nu_nml, 'light_streams', status=nml_error) + if (nml_error == 0) then + read(nu_nml, nml=light_streams,iostat=nml_error) + if (nml_error /= 0) then + call endrun(msg='ERROR reading light_streams namelist'//errMsg(sourcefile, __LINE__)) + end if + end if + close(nu_nml) + call relavu( nu_nml ) + endif + + call shr_mpi_bcast(stream_year_first_lightng, mpicom) + call shr_mpi_bcast(stream_year_last_lightng, mpicom) + call shr_mpi_bcast(model_year_align_lightng, mpicom) + call shr_mpi_bcast(stream_fldFileName_lightng, mpicom) + call shr_mpi_bcast(lightng_tintalgo, mpicom) + + if (masterproc) then + write(iulog,*) ' ' + write(iulog,*) 'light_stream settings:' + write(iulog,*) ' stream_year_first_lightng = ',stream_year_first_lightng + write(iulog,*) ' stream_year_last_lightng = ',stream_year_last_lightng + write(iulog,*) ' model_year_align_lightng = ',model_year_align_lightng + write(iulog,*) ' stream_fldFileName_lightng = ',stream_fldFileName_lightng + write(iulog,*) ' lightng_tintalgo = ',lightng_tintalgo + write(iulog,*) ' ' + endif + + call clm_domain_mct (bounds, dom_clm) + + call shr_strdata_create(this%sdat_lnfm,name="clmlnfm", & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype(inst_name), & + mpicom=mpicom, compid=comp_id, & + gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & + nxg=ldomain%ni, nyg=ldomain%nj, & + yearFirst=stream_year_first_lightng, & + yearLast=stream_year_last_lightng, & + yearAlign=model_year_align_lightng, & + offset=0, & + domFilePath='', & + domFileName=trim(stream_fldFileName_lightng), & + domTvarName='time', & + domXvarName='lon' , & + domYvarName='lat' , & + domAreaName='area', & + domMaskName='mask', & + filePath='', & + filename=(/trim(stream_fldFileName_lightng)/),& + fldListFile='lnfm', & + fldListModel='lnfm', & + fillalgo='none', & + tintalgo=lightng_tintalgo, & + mapalgo=lightngmapalgo, & + calendar=get_calendar(), & + taxmode='cycle' ) + + if (masterproc) then + call shr_strdata_print(this%sdat_lnfm,'Lightning data') + endif + + ! Add history fields + call hist_addfld1d (fname='LNFM', units='counts/km^2/hr', & + avgflag='A', long_name='Lightning frequency', & + ptr_lnd=this%forc_lnfm, default='inactive') + + end subroutine lnfm_init + + !----------------------------------------------------------------------- + subroutine lnfm_interp(this, bounds ) + ! + ! !DESCRIPTION: + ! Interpolate data stream information for Lightning. + ! + ! !USES: + use clm_time_manager, only : get_curr_date + ! + ! !ARGUMENTS: + class(fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: g, ig + integer :: year ! year (0, ...) for nstep+1 + integer :: mon ! month (1, ..., 12) for nstep+1 + integer :: day ! day of month (1, ..., 31) for nstep+1 + integer :: sec ! seconds into current date for nstep+1 + integer :: mcdate ! Current model date (yyyymmdd) + !----------------------------------------------------------------------- + + call get_curr_date(year, mon, day, sec) + mcdate = year*10000 + mon*100 + day + + call shr_strdata_advance(this%sdat_lnfm, mcdate, sec, mpicom, 'lnfmdyn') + + ig = 0 + do g = bounds%begg,bounds%endg + ig = ig+1 + this%forc_lnfm(g) = this%sdat_lnfm%avs(1)%rAttr(1,ig) + end do + + end subroutine lnfm_interp + +end module FireDataBaseType From e123aa6636d93825fa452acdebbd1d72c1de0626 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 29 May 2020 15:53:55 -0600 Subject: [PATCH 0945/1973] Rework writing of ctsm.mk to use information from cime This makes us no longer tied to specific machines (previously we had hard-coded information for cheyenne and bishorn). This depends on cime changes currently on a branch. --- cime_config/buildlib | 80 ++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index f19e6b55bd..569ef99914 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -21,37 +21,23 @@ from CIME.utils import run_cmd, expect logger = logging.getLogger(__name__) ############################################################################### -def _write_ctsm_mk(exeroot, libroot, machine): +def _write_ctsm_mk(gmake, gmake_opts, makefile, exeroot, libroot): """Writes a ctsm.mk file in exeroot. This file can be included by atmosphere model builds outside of cime. - - NOTE: This currently only supports the machines cheyenne (intel) and bishorn - (gnu). Also, it assumes that ESMFMKFILE is set in your environment. - - Arguments: - exeroot (str): path to build directory - libroot (str): path to directory containing libclm.a - machine (str): name of machine """ - ctsm_mk_path = os.path.join(exeroot, 'ctsm.mk') - ctsm_bld_dir = os.path.abspath(os.path.join(libroot, os.pardir)) - shared_bld_dir = os.path.abspath(os.path.join(ctsm_bld_dir, os.pardir, os.pardir)) - esmfmkfile = os.environ['ESMFMKFILE'] - - # Set machine-specific libs for machines we currently support. Note there are a lot of - # hard-coded assumptions here, regarding the compiler, paths to libraries, etc. - # - # ESMF library doesn't need to be included here, because the necessary elements of the - # link line for that are included elsewhere. - if machine == 'cheyenne': - machine_specific_libs = '-mkl=cluster -L/glade/u/apps/ch/opt/pnetcdf/1.11.0/mpt/2.19/intel/19.0.2//lib -lpnetcdf -L/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -Wl,-rpath,/glade/u/apps/ch/opt/netcdf-mpi/4.6.1/mpt/2.19/intel/19.0.2/lib -cxxlib -lrt -ldl -lnetcdff -lnetcdf -cxxlib' - elif machine == 'bishorn': - machine_specific_libs = '-L/usr/local/lib -lnetcdff -lnetcdf -framework Accelerate' - else: - expect(False, "Unknown machine for LILAC's ctsm.mk file: {}".format(machine)) + cime_output_file = os.path.join(exeroot, 'cime_variables.mk') + # Set MODEL=driver because some link flags are set differently when MODEL=driver, and + # those are the ones we want here. + cmd = ("{gmake} write_include_and_link_flags OUTPUT_FILE={cime_output_file} " + "MODEL=driver {gmake_opts} -f {makefile} ").format( + gmake=gmake, cime_output_file=cime_output_file, gmake_opts=gmake_opts, makefile=makefile) + rc, out, err = run_cmd(cmd) + logger.info("%s: \n\n output:\n %s \n\n err:\n\n%s\n"%(cmd,out,err)) + expect(rc == 0, "Command %s failed with rc=%s" % (cmd, rc)) + ctsm_mk_path = os.path.join(exeroot, 'ctsm.mk') with open(ctsm_mk_path, 'w') as ctsm_mk: ctsm_mk.write(""" # ====================================================================== @@ -64,29 +50,32 @@ def _write_ctsm_mk(exeroot, libroot, machine): # ====================================================================== # ====================================================================== -# The following settings are meant for internal use, and generally +# The following CIME variables are meant for internal use, and generally # should not be included directly in an atmosphere model's build. # ====================================================================== -include {esmfmkfile} +""") + with open(cime_output_file) as infile: + ctsm_mk.write(infile.read()) + + ctsm_bld_dir = os.path.abspath(os.path.join(libroot, os.pardir)) + with open(ctsm_mk_path, 'a') as ctsm_mk: + ctsm_mk.write(""" +# ====================================================================== +# The following settings are meant for internal use, and generally +# should not be included directly in an atmosphere model's build. +# ====================================================================== -SHARED_BLD_DIR = {shared_bld_dir} CTSM_BLD_DIR = {ctsm_bld_dir} -DEPENDS_LIB = $(SHARED_BLD_DIR)/lib -SHR_LIB = $(CTSM_BLD_DIR)/c1a1l1/lib -SHR_INC = $(CTSM_BLD_DIR)/c1a1l1/csm_share CTSM_INC = $(CTSM_BLD_DIR)/clm/obj -LIBS = -L$(CTSM_BLD_DIR)/lib -lclm -L$(SHR_LIB) -lcsm_share -L$(DEPENDS_LIB) -lpiof -lpioc -lgptl -lmct -lmpeu {machine_specific_libs} - # ====================================================================== # The following settings should be included in an atmosphere model's build. # ====================================================================== -CTSM_INCLUDES = $(ESMF_F90COMPILEPATHS) -I$(SHR_INC) -I$(CTSM_INC) -CTSM_LIBS = $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(LIBS) -""".format(esmfmkfile=esmfmkfile, shared_bld_dir=shared_bld_dir, ctsm_bld_dir=ctsm_bld_dir, - machine_specific_libs=machine_specific_libs)) +CTSM_INCLUDES = $(CIME_ESMF_F90COMPILEPATHS) -I$(CIME_CSM_SHR_INCLUDE) -I$(CTSM_INC) +CTSM_LIBS = -L$(CTSM_BLD_DIR)/lib -lclm $(CIME_ULIBS) $(CIME_SLIBS) $(CIME_MLIBS) $(CIME_F90_LDFLAGS) +""".format(ctsm_bld_dir=ctsm_bld_dir)) ############################################################################### def _main_func(): @@ -97,15 +86,16 @@ def _main_func(): with Case(caseroot) as case: casetools = case.get_value("CASETOOLS") + makefile = os.path.join(casetools, "Makefile") lnd_root = case.get_value("COMP_ROOT_DIR_LND") gmake_j = case.get_value("GMAKE_J") gmake = case.get_value("GMAKE") + gmake_opts = get_standard_makefile_args(case) driver = case.get_value("COMP_INTERFACE").lower() lilac_mode = case.get_value("LILAC_MODE") if lilac_mode == 'on': driver = "lilac" - machine = case.get_value('MACH') #------------------------------------------------------- # create Filepath file @@ -146,15 +136,25 @@ def _main_func(): #------------------------------------------------------- complib = os.path.join(libroot,"libclm.a") - makefile = os.path.join(casetools, "Makefile") cmd = "{} complib -j {} MODEL=clm COMPLIB={} -f {} {}" \ - .format(gmake, gmake_j, complib, makefile, get_standard_makefile_args(case)) + .format(gmake, gmake_j, complib, makefile, gmake_opts) rc, out, err = run_cmd(cmd) logger.info("%s: \n\n output:\n %s \n\n err:\n\n%s\n"%(cmd,out,err)) expect(rc == 0, "Command %s failed with rc=%s" % (cmd, rc)) + # ------------------------------------------------------------------------ + # for lilac usage, we need a file containing some Makefile variables (for the atmosphere model's build) + # ------------------------------------------------------------------------ + + if lilac_mode == 'on': + _write_ctsm_mk(gmake=gmake, + gmake_opts=gmake_opts, + makefile=makefile, + exeroot=case.get_value("EXEROOT"), + libroot=libroot) + ############################################################################### if __name__ == "__main__": From 608fb5da06285bf8ab366fcd77215c790ea84d18 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 30 May 2020 14:05:00 -0600 Subject: [PATCH 0946/1973] No longer require ESMFMKFILE when building the lilac driver --- README.lilac | 2 +- lilac/atm_driver/Makefile | 20 ++++---------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/README.lilac b/README.lilac index 7f8a36c200..6a4414e6ae 100644 --- a/README.lilac +++ b/README.lilac @@ -39,7 +39,7 @@ library (I), do the following: > make clean > source ./.env_mach_specific.sh > export DEBUG=TRUE - > make atm_driver + > make COMPILER=intel atm_driver 2) to generate the input namelists diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index 8aaea82e93..a3a594189b 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -8,9 +8,7 @@ # (1) Run cime's configure tool in order to generate a Macros.make file # # (2) Source the .env_mach_specific.sh file created by the configure -# tool in order to set up the environment correctly. Among other -# things, this should set the environment variable ESMFMKFILE. (See -# notes below about the need for this.) +# tool in order to set up the environment correctly. # # (3) Set the environment variable CTSM_MKFILE - e.g. # @@ -22,26 +20,16 @@ include Macros.make include $(CTSM_MKFILE) -# Most atmosphere model builds shouldn't need this directly, but we use -# it here in order to easily get a f90 compiler and f90 compile opts for -# building atm_driver.o. (This is a bit of a kludge that we should -# change later.) -include $(ESMFMKFILE) - -#================================================================================ -# Compiler and linker rules using ESMF_ variables supplied by esmf.mk -#================================================================================ - .SUFFIXES: .F90 %.o : %.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(CTSM_INCLUDES) $(FFLAGS) $< + $(MPIFC) -c $(CTSM_INCLUDES) $(FFLAGS) $< atm_driver.o : $(CURDIR)/atm_driver.F90 - $(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(CTSM_INCLUDES) $(FFLAGS) $< + $(MPIFC) -c $(CTSM_INCLUDES) $(FFLAGS) $< atm_driver: atm_driver.o - $(ESMF_F90LINKER) $(ESMF_F90LINKOPTS) -o $@ $^ $(CTSM_LIBS) + $(MPIFC) -o $@ $^ $(CTSM_LIBS) mv atm_driver atm_driver.exe # module dependencies: From 29cd8963d6886417259803e5320aebeff7e04a59 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 30 May 2020 14:38:06 -0600 Subject: [PATCH 0947/1973] Point to cime branch --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 948e0cfbd7..90e4e35c39 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -29,8 +29,8 @@ required = True [cime] local_path = cime protocol = git -repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.23_a01 +repo_url = https://github.com/billsacks/cime +branch = changes_for_lilac externals = ../Externals_cime.cfg required = True From f346b65eb0402522c625e2f07759162e4282fde5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 30 May 2020 19:56:44 -0600 Subject: [PATCH 0948/1973] Put a link to ctsm.mk at the top level of the build directory --- python/ctsm/build_ctsm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 47ef2d32f6..86bed1ef89 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -515,3 +515,6 @@ def _create_and_build_case(cime_path, build_dir, compiler, machine=None, no_buil cwd=casedir) except subprocess.CalledProcessError: abort('ERROR building CTSM or its dependencies - see above for details') + + make_link(os.path.join(casedir, 'bld', 'ctsm.mk'), + os.path.join(build_dir, 'ctsm.mk')) From ff78f7ac96975e23c9a558ff6e89b5baaf7b8a80 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 1 Jun 2020 15:57:30 -0600 Subject: [PATCH 0949/1973] Point to cime and CMEPS versions that have mizuRoute changes incorporated into them as well as mvertens versions for RTM and MOSART that have her latest nuopc changes in them --- Externals.cfg | 12 ++++++------ Externals_cime.cfg | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 9d7f7fa6eb..6a0c1fc0c3 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -15,15 +15,15 @@ required = True [rtm] local_path = components/rtm protocol = git -repo_url = https://github.com/ESCOMP/rtm -tag = rtm1_0_71 +repo_url = https://github.com/mvertens/rtm +hash = 03a804eaa002805d87c9340f6ca3d542ff4598d5 required = True [mosart] local_path = components/mosart protocol = git -repo_url = https://github.com/ESCOMP/mosart -tag = mosart1_0_36 +repo_url = https://github.com/mvertens/mosart +hash = e441da118009eb00e3a8e4136058bf0a3f717ea0 required = True [mizuRoute] @@ -36,8 +36,8 @@ required = True [cime] local_path = cime protocol = git -repo_url = https://github.com/ekluzek/cime -branch = mizuRoute +repo_url = https://github.com/ESMCI/cime +hash = 1b049969f7271cf01ac7e2133a83c9b23c7f963d externals = ../Externals_cime.cfg required = True diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 3eeafa11f6..0203691221 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,7 +1,7 @@ [cmeps] -branch = mizuroute +hash = 7ba0be9d94c8ea54b081b3804cbbffcfe7a25e08 protocol = git -repo_url = https://github.com/ekluzek/CMEPS.git +repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ required = True From 3bba38e4af64cccad9d888008fe8015119fc3070 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 1 Jun 2020 16:27:22 -0600 Subject: [PATCH 0950/1973] Point to a cime tag rather than branch --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 90e4e35c39..1322caa387 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -29,8 +29,8 @@ required = True [cime] local_path = cime protocol = git -repo_url = https://github.com/billsacks/cime -branch = changes_for_lilac +repo_url = https://github.com/ESMCI/cime +tag = branch_tags/cime5.8.23_a02 externals = ../Externals_cime.cfg required = True From aec2b52f6545ac64843b61afe9c2f9bc444f82b5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 3 Jun 2020 15:11:21 -0600 Subject: [PATCH 0951/1973] Begin lilac documentation --- doc/source/index.rst | 5 +- .../api-init-details.rst | 11 ++ .../calling-ctsm-from-atm/api-overview.rst | 11 ++ .../calling-ctsm-from-atm/api-run-details.rst | 11 ++ .../lilac/calling-ctsm-from-atm/index.rst | 12 ++ doc/source/lilac/index.rst | 13 ++ .../lilac/introduction-and-overview/index.rst | 11 ++ .../organization-of-documentation.rst | 28 ++++ .../overview-of-lilac.rst | 11 ++ .../obtaining-building-and-running/index.rst | 11 ++ .../obtaining-and-building-ctsm.rst | 130 ++++++++++++++++++ .../setting-ctsm-runtime-options.rst | 11 ++ .../lilac/specific-atm-models/index.rst | 10 ++ doc/source/lilac/specific-atm-models/wrf.rst | 9 ++ 14 files changed, 282 insertions(+), 2 deletions(-) create mode 100644 doc/source/lilac/calling-ctsm-from-atm/api-init-details.rst create mode 100644 doc/source/lilac/calling-ctsm-from-atm/api-overview.rst create mode 100644 doc/source/lilac/calling-ctsm-from-atm/api-run-details.rst create mode 100644 doc/source/lilac/calling-ctsm-from-atm/index.rst create mode 100644 doc/source/lilac/index.rst create mode 100644 doc/source/lilac/introduction-and-overview/index.rst create mode 100644 doc/source/lilac/introduction-and-overview/organization-of-documentation.rst create mode 100644 doc/source/lilac/introduction-and-overview/overview-of-lilac.rst create mode 100644 doc/source/lilac/obtaining-building-and-running/index.rst create mode 100644 doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst create mode 100644 doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst create mode 100644 doc/source/lilac/specific-atm-models/index.rst create mode 100644 doc/source/lilac/specific-atm-models/wrf.rst diff --git a/doc/source/index.rst b/doc/source/index.rst index f7f35abeda..9a9d8016ef 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -3,10 +3,10 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to the CLM documentation +Welcome to the CTSM documentation ================================== -This document has two major sections. +This document has three major sections. .. toctree:: :maxdepth: 2 @@ -14,6 +14,7 @@ This document has two major sections. users_guide/index.rst tech_note/index.rst + lilac/index.rst Indices and tables ================== diff --git a/doc/source/lilac/calling-ctsm-from-atm/api-init-details.rst b/doc/source/lilac/calling-ctsm-from-atm/api-init-details.rst new file mode 100644 index 0000000000..9a9073d188 --- /dev/null +++ b/doc/source/lilac/calling-ctsm-from-atm/api-init-details.rst @@ -0,0 +1,11 @@ +.. _api-init-details: + +.. highlight:: shell + +================================================ + Details on the CTSM-LILAC initialization phase +================================================ + +.. todo:: + + TODO: write this section diff --git a/doc/source/lilac/calling-ctsm-from-atm/api-overview.rst b/doc/source/lilac/calling-ctsm-from-atm/api-overview.rst new file mode 100644 index 0000000000..286d175758 --- /dev/null +++ b/doc/source/lilac/calling-ctsm-from-atm/api-overview.rst @@ -0,0 +1,11 @@ +.. _api-overview: + +.. highlight:: shell + +================================ + Overview of the CTSM-LILAC API +================================ + +.. todo:: + + TODO: write this section diff --git a/doc/source/lilac/calling-ctsm-from-atm/api-run-details.rst b/doc/source/lilac/calling-ctsm-from-atm/api-run-details.rst new file mode 100644 index 0000000000..61575427b9 --- /dev/null +++ b/doc/source/lilac/calling-ctsm-from-atm/api-run-details.rst @@ -0,0 +1,11 @@ +.. _api-run-details: + +.. highlight:: shell + +===================================== + Details on the CTSM-LILAC run phase +===================================== + +.. todo:: + + TODO: write this section diff --git a/doc/source/lilac/calling-ctsm-from-atm/index.rst b/doc/source/lilac/calling-ctsm-from-atm/index.rst new file mode 100644 index 0000000000..4c42740df3 --- /dev/null +++ b/doc/source/lilac/calling-ctsm-from-atm/index.rst @@ -0,0 +1,12 @@ +.. _calling-ctsm-from-atm: + +======================================= + Calling CTSM from an atmosphere model +======================================= + +.. toctree:: + :maxdepth: 2 + + api-overview.rst + api-init-details.rst + api-run-details.rst diff --git a/doc/source/lilac/index.rst b/doc/source/lilac/index.rst new file mode 100644 index 0000000000..3aac77f9ef --- /dev/null +++ b/doc/source/lilac/index.rst @@ -0,0 +1,13 @@ +.. _lilac-users-guide: + +####################### +CTSM-LILAC User's Guide +####################### + +.. toctree:: + :maxdepth: 2 + + introduction-and-overview/index.rst + obtaining-building-and-running/index.rst + calling-ctsm-from-atm/index.rst + specific-atm-models/index.rst diff --git a/doc/source/lilac/introduction-and-overview/index.rst b/doc/source/lilac/introduction-and-overview/index.rst new file mode 100644 index 0000000000..4c2878797e --- /dev/null +++ b/doc/source/lilac/introduction-and-overview/index.rst @@ -0,0 +1,11 @@ +.. _introduction-and-overview: + +==================================== + Introduction and overview of LILAC +==================================== + +.. toctree:: + :maxdepth: 2 + + overview-of-lilac.rst + organization-of-documentation.rst diff --git a/doc/source/lilac/introduction-and-overview/organization-of-documentation.rst b/doc/source/lilac/introduction-and-overview/organization-of-documentation.rst new file mode 100644 index 0000000000..7a91c6ee54 --- /dev/null +++ b/doc/source/lilac/introduction-and-overview/organization-of-documentation.rst @@ -0,0 +1,28 @@ +.. _organization-of-documentation: + +.. highlight:: shell + +=================================== + Organization of the documentation +=================================== + +This documentation is organized into the following high-level sections: + +- :numref:`{number}. {name} `: This section gives a general + introduction to LILAC and describes the organization of this documentation (you're + reading this now!) + +- :numref:`{number}. {name} `: This section provides + instructions for building and running CTSM within an atmosphere model that has been set + up to run with CTSM (e.g., WRF). If you are starting to use CTSM with an atmosphere + model that does not yet have any calls to CTSM-LILAC, then you should start with section + :numref:`{number}. {name} `. + +- :numref:`{number}. {name} `: This section provides details on the + Fortran code that needs to be added to an atmosphere model in order to call CTSM via + LILAC as its land surface scheme. (In practice, this step comes before + :numref:`{number}. {name} `, but it is included later in + the documentation because it is of interest to fewer people.) + +- :numref:`{number}. {name} `: This section provides notes on running + CTSM within specific atmosphere models. diff --git a/doc/source/lilac/introduction-and-overview/overview-of-lilac.rst b/doc/source/lilac/introduction-and-overview/overview-of-lilac.rst new file mode 100644 index 0000000000..545386ee93 --- /dev/null +++ b/doc/source/lilac/introduction-and-overview/overview-of-lilac.rst @@ -0,0 +1,11 @@ +.. _overview-of-lilac: + +.. highlight:: shell + +=================== + Overview of LILAC +=================== + +.. todo:: + + TODO: write this section diff --git a/doc/source/lilac/obtaining-building-and-running/index.rst b/doc/source/lilac/obtaining-building-and-running/index.rst new file mode 100644 index 0000000000..a1386fe909 --- /dev/null +++ b/doc/source/lilac/obtaining-building-and-running/index.rst @@ -0,0 +1,11 @@ +.. _obtaining-building-and-running: + +====================================== + Obtaining, building and running CTSM +====================================== + +.. toctree:: + :maxdepth: 2 + + obtaining-and-building-ctsm.rst + setting-ctsm-runtime-options.rst diff --git a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst new file mode 100644 index 0000000000..4b8e093b39 --- /dev/null +++ b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst @@ -0,0 +1,130 @@ +.. _obtaining-and-building-ctsm: + +.. highlight:: shell + +======================================= + Obtaining and building CTSM and LILAC +======================================= + +This section describes the process for obtaining and building the CTSM library and its +dependencies, and linking to these libraries in an atmosphere model's build. + +Quick start example +=================== + +The basic process for obtaining and building CTSM is the following: + +Obtain CTSM by running:: + + git clone https://github.com/ESCOMP/CTSM.git + cd CTSM + ./manage_externals/checkout_externals + +Then build CTSM and its dependencies. On a machine that has been ported to CIME, the +command will look like this (example given for NCAR's ``cheyenne`` machine):: + + ./build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne + +On a machine that has *not* been ported to CIME, you will need to provide some additional +information. Run ``build_ctsm -h`` for details, but the basic command will look like +this:: + + ./build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default + +.. _building-ctsm-and-lilac-prerequisites: + +Prerequisites +============= + +Building CTSM requires: + +- a Unix-like operating system (Linux, AIX, OS X, etc.) + +- git version 1.8 or newer + +- python3 + + - The default version of python (when you run python without specifying 2 vs. 3) should + be python3 + +- perl version 5 + +- a GNU version of the make tool (gmake) + +- CMake + +- Fortran and C compilers + + - See https://github.com/escomp/cesm#details-on-fortran-compiler-versions for + information on compiler versions known to work with CESM, and thus CTSM. + +- LAPACK and BLAS libraries + +- a NetCDF library version 4.3 or newer built with the same compiler you will use for CTSM + + - a PnetCDF library is optional + +- a functioning MPI environment + + - typically, this includes compiler wrappers like ``mpif90`` and ``mpicc`` + +Obtaining CTSM +============== + +CTSM and its dependencies (excluding the :ref:`prerequisites noted +above`) can be obtained with:: + + git clone https://github.com/ESCOMP/CTSM.git + cd CTSM + ./manage_externals/checkout_externals + +By default, this will put you on the ``master`` branch of CTSM, which is the main +development branch. You can checkout a different branch or tag using ``git checkout``; +**be sure to rerun** ``./manage_externals/checkout_externals`` **after doing so.** + +For more details, see +https://github.com/ESCOMP/CTSM/wiki/Quick-start-to-CTSM-development-with-git + +Building CTSM and its dependencies, and including CTSM in the atmosphere model's build +====================================================================================== + +Overview +-------- + +CTSM provides a build script, ``build_ctsm`` for building CTSM and its dependencies. (The +dependencies built with this build script include various libraries that are packaged with +CIME_. This does *not* build the :ref:`prerequisites noted +above`: it is assumed that those are already built +on your machine.) + +There are two possible workflows for building CTSM and its dependencies. The first works +if you are using a machine that has been ported to CIME_; the second works if you are +using a machine that has *not* been ported to CIME_. Both workflows are described +below. If you are using a machine that has not been ported to CIME, it is possible to do a +complete CIME port and then use the first workflow (by following the `CIME porting guide +`_), but +it is generally simpler to use the second workflow below. + +There is a third usage where you simply want to rebuild after making some source code +changes to CTSM. This is also documented below. + +All of these workflows use CIME's build system behind the scenes. Typically, you will not +need to be aware of any of those details, but if problems arise, you may want to consult +the `CIME documentation `_. + +Building on a CIME-supported machine +------------------------------------ + + + +Rebuilding after changing CTSM source code +------------------------------------------ + +To rebuild after changing CTSM source code, you should follow one of the above workflows, +but the ``build_ctsm`` command will simply be:: + + ./build_ctsm /PATH/TO/CTSM/BUILD --rebuild + +where ``/PATH/TO/CTSM/BUILD`` should point to the same directory you originally used. + +.. _CIME: https://github.com/esmci/cime diff --git a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst new file mode 100644 index 0000000000..1ef397db97 --- /dev/null +++ b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst @@ -0,0 +1,11 @@ +.. _setting-ctsm-runtime-options: + +.. highlight:: shell + +============================== + Setting CTSM runtime options +============================== + +.. todo:: + + TODO: write this section diff --git a/doc/source/lilac/specific-atm-models/index.rst b/doc/source/lilac/specific-atm-models/index.rst new file mode 100644 index 0000000000..04a1976253 --- /dev/null +++ b/doc/source/lilac/specific-atm-models/index.rst @@ -0,0 +1,10 @@ +.. _specific-atm-models: + +===================================== + Notes on specific atmosphere models +===================================== + +.. toctree:: + :maxdepth: 2 + + wrf.rst diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst new file mode 100644 index 0000000000..0a5813a659 --- /dev/null +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -0,0 +1,9 @@ +.. _wrf: + +===================== + Using CTSM with WRF +===================== + +.. todo:: + + TODO: write this section From 915a9e6e599263c324ccbe0b5b3a497174de7ea7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 3 Jun 2020 16:55:49 -0600 Subject: [PATCH 0952/1973] Fix section underline lengths --- .../CLM50_Tech_Note_Crop_Irrigation.rst | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst index 6fb9da4c55..a0a0778e45 100644 --- a/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst +++ b/doc/source/tech_note/Crop_Irrigation/CLM50_Tech_Note_Crop_Irrigation.rst @@ -1,12 +1,12 @@ .. _rst_Crops and Irrigation: Crops and Irrigation -======================== +==================== .. _Summary of CLM5.0 updates relative to the CLM4.5: Summary of CLM5.0 updates relative to the CLM4.5 ------------------------------------------------------ +------------------------------------------------ We describe here the complete crop and irrigation parameterizations that appear in CLM5.0. Corresponding information for CLM4.5 appeared in the @@ -42,7 +42,7 @@ These updates appear in detail in the sections below. Many also appear in Available new features since the CLM5 release -^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Addition of bioenergy crops @@ -51,10 +51,10 @@ Available new features since the CLM5 release .. _The crop model: The crop model: cash and bioenergy crops -------------------- +---------------------------------------- Introduction -^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^ Groups developing Earth System Models generally account for the human footprint on the landscape in simulations of historical and future @@ -93,7 +93,7 @@ phenology, and allocation, as well as fertilizer and irrigation management. .. _Crop plant functional types: Crop plant functional types -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^ To allow crops to coexist with natural vegetation in a grid cell, the vegetated land unit is separated into a naturally vegetated land unit and @@ -230,7 +230,7 @@ managed crop types that are using the same parameter set. .. _Phenology: Phenology -^^^^^^^^^^^^^^^^ +^^^^^^^^^ CLM5-BGC includes evergreen, seasonally deciduous (responding to changes in day length), and stress deciduous (responding to changes in @@ -246,7 +246,7 @@ maturity and harvest. .. _Planting: Planting -''''''''''''''''' +'''''''' All crops must meet the following requirements between the minimum planting date and the maximum planting date (for the northern hemisphere) in :numref:`Table Crop phenology parameters`: @@ -318,7 +318,7 @@ the range for that day. :math:`{T}_{f}` is the freezing temperature of water and .. _Leaf emergence: Leaf emergence -''''''''''''''''''''''' +'''''''''''''' According to AgroIBIS, leaves may emerge when the growing degree-days of soil temperature to 0.05 m depth (:math:`GDD_{T_{soi} }` ), which is tracked since planting, @@ -335,7 +335,7 @@ the carbon allocation algorithm in section :numref:`Leaf emergence to grain fill .. _Grain fill: Grain fill -''''''''''''''''''' +'''''''''' The grain fill phase (phase 3) begins in one of two ways. The first potential trigger is based on temperature, similar to phase 2. A variable tracked since planting, similar to :math:`GDD_{T_{soi} }` but for 2-m air temperature, @@ -352,7 +352,7 @@ leaf longevity for the pft as done in the BGC part of the model. .. _Harvest: Harvest -'''''''''''''''' +''''''' Harvest is assumed to occur as soon as the crop reaches maturity. When :math:`GDD_{T_{{\rm 2m}} }` reaches 100% of :math:`{GDD}_{mat}` or @@ -407,7 +407,7 @@ fcur is the fraction of allocation that goes to currently displayed growth. .. _Allocation: Allocation -^^^^^^^^^^^^^^^^^ +^^^^^^^^^^ Allocation changes based on the crop phenology phases phenology (section :numref:`Phenology`). Simulated C assimilation begins every year upon leaf emergence in phase @@ -447,8 +447,8 @@ respiration had not taken place. .. _Leaf emergence to grain fill: -Leaf emergence -''''''''''''''''''''''''''''''''''''' +Leaf emergence +'''''''''''''' During phase 2, the allocation coefficients (fraction of available C) to each C pool are defined as: @@ -467,8 +467,8 @@ exclusively to the fine roots. .. _Grain fill to harvest: -Grain fill -'''''''''''''''''''''''''''''' +Grain fill +'''''''''' The calculation of :math:`a_{froot}` remains the same from phase 2 to phase 3. During grain fill (phase 3), other allocation coefficients change to: @@ -497,7 +497,7 @@ coefficients (:numref:`Table Crop allocation parameters`). .. _Nitrogen retranslocation for crops: Nitrogen retranslocation for crops -'''''''''''''''''''''''''''''''''''''' +'''''''''''''''''''''''''''''''''' Nitrogen retranslocation in crops occurs when nitrogen that was used for tissue growth of leaves, stems, and fine roots during the early growth @@ -551,7 +551,7 @@ fulfill plant nitrogen demands. .. _Harvest to food and seed: Harvest -'''''''''''''''''''''''''''''' +''''''' Variables track the flow of grain C and N to food and of all other plant pools, including live stem C and N, to litter, and to biofuel feedstock. A fraction (determined by the :math:`biofuel\_harvfrac`, defined in @@ -712,12 +712,12 @@ the target C:N ratios used during the leaf emergence phase (phase 2). .. _Other Features: Other Features -^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^ .. _Physical Crop Characteristics: Physical Crop Characteristics -'''''''''''''''''''''''''''''' +''''''''''''''''''''''''''''' Leaf area index (*L*) is calculated as a function of specific leaf area (SLA, :numref:`Table Crop phenology parameters`) and leaf C. Stem area index (*S*) is equal to 0.1\ *L* for temperate and tropical corn, sugarcane, switchgrass, and miscanthus and 0.2\ *L* for @@ -742,8 +742,8 @@ and :math:`L_{\max }` is the maximum leaf area index (:numref:`Table Crop alloca .. _Interactive fertilization: -Interactive Fertilization -'''''''''''''''''''''''''''''' +Interactive Fertilization +''''''''''''''''''''''''' CLM simulates fertilization by adding nitrogen directly to the soil mineral nitrogen pool to meet crop nitrogen demands using both industrial fertilizer and manure application. CLM’s separate crop land unit ensures that natural vegetation will not access the fertilizer applied to crops. @@ -790,7 +790,7 @@ the counter is reached. .. _Biological nitrogen fixation for soybeans: Biological nitrogen fixation for soybeans -'''''''''''''''''''''''''''''''''''''''''' +''''''''''''''''''''''''''''''''''''''''' Biological N fixation for soybeans is calculated by the fixation and uptake of nitrogen module (Chapter :numref:`rst_FUN`) and is the same as N fixation in natural vegetation. Unlike natural vegetation, where a fraction of each pft are N fixers, all soybeans @@ -798,8 +798,8 @@ are treated as N fixers. .. _Latitude vary base tempereature for growing degree days: -Latitudinal variation in base growth tempereature -'''''''''''''''''''''''''''''''''''''''''''''''''''''''' +Latitudinal variation in base growth tempereature +''''''''''''''''''''''''''''''''''''''''''''''''' For most crops, :math:`GDD_{T_{{\rm 2m}} }` (growing degree days since planting) is the same in all locations. However, the for both rainfed and irrigated spring wheat and sugarcane, the calculation of @@ -822,7 +822,7 @@ and sugarcane. .. _Separate reproductive pool: Separate reproductive pool -'''''''''''''''''''''''''''''' +'''''''''''''''''''''''''' One notable difference between natural vegetation and crops is the presence of reproductive carbon and nitrogen pools. Accounting for the reproductive pools helps determine whether crops are performing @@ -839,7 +839,7 @@ nitrogen are available for grain development. .. _The irrigation model: The irrigation model -------------------------- +-------------------- The CLM includes the option to irrigate cropland areas that are equipped for irrigation. The application of irrigation responds dynamically to From e4cc5a03b5843b2e068e51bfef2fa901cfc8e18f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 4 Jun 2020 00:54:22 -0600 Subject: [PATCH 0953/1973] Set jmaxb1 to 0.17 and set paramfile with leaf changes for arctic plants to compensate for LUNA bugs #953 and #958 --- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 825db0fc30..195b8946fd 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -372,7 +372,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200402.nc +lnd/clm2/paramdata/clm5_params.c200604.nc lnd/clm2/paramdata/clm_params.c200402.nc @@ -421,7 +421,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .true. .true. -0.093563 +0.17 .false. .false. From 9f3bf0a907cff999acf0a72a1e2cb66dbfae8853 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 4 Jun 2020 12:56:53 -0600 Subject: [PATCH 0954/1973] Update params file so it contains the c200519 update as well as the needed updates from @olyon --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 4634a5f028..57a1fd5743 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -393,7 +393,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200604a.nc +lnd/clm2/paramdata/clm5_params.c200604b.nc lnd/clm2/paramdata/clm_params.c200519.nc From b3908c33402d16579ec3ddf1e38826bae598bd6e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 4 Jun 2020 14:58:41 -0600 Subject: [PATCH 0955/1973] Update the mosart hash as it couldn't build with the previous version --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 6a0c1fc0c3..0e35c60288 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -23,7 +23,7 @@ required = True local_path = components/mosart protocol = git repo_url = https://github.com/mvertens/mosart -hash = e441da118009eb00e3a8e4136058bf0a3f717ea0 +hash = 2b30936 required = True [mizuRoute] From 67ff176028963eb88a2d3117d3080798df27bac5 Mon Sep 17 00:00:00 2001 From: Chris Fischer Date: Fri, 5 Jun 2020 12:50:36 -0600 Subject: [PATCH 0956/1973] Add new SE grids --- bld/namelist_files/namelist_defaults_ctsm.xml | 65 +++++++++++++++++-- .../namelist_definition_ctsm.xml | 4 +- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 266e3178b9..c9f287e04c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -793,10 +793,26 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/ctsm1.0.dev094-2-g633be0eb/surfdata_1x1_smallvilleIA_hist_78pfts_CMIP6_simyr2000_c200521.nc - -lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c190303.nc lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne16np4_hist_78pfts_CMIP6_simyr2000_c190214.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr2000_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_simyr2000_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4_hist_78pfts_CMIP6_simyr2000_c200427.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4.pg2_hist_78pfts_CMIP6_simyr2000_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4.pg3_hist_78pfts_CMIP6_simyr2000_c200427.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr2000_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr2000_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr2000_c200426.nc @@ -824,7 +840,6 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_4x5_hist_16pfts_Irrig_CMIP6_sim lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850_c190214.nc - lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850_c190303.nc @@ -859,7 +874,23 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_78pfts_CMIP6_simyr1850_c190214.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4_hist_78pfts_CMIP6_simyr1850_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4_hist_78pfts_CMIP6_simyr1850_c200427.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4.pg2_hist_78pfts_CMIP6_simyr1850_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4.pg3_hist_78pfts_CMIP6_simyr1850_c200427.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr1850_c200426.nc lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c179824.nc + use_crop=".true." >lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc + lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_SSP1-2.6_78pfts_CMIP6_simyr1850-2100_c190214.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 5d142e4626..1da18f3722 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1953,7 +1953,7 @@ CLM run type. + valid_values="conus_30_x8,512x1024,360x720cru,128x256,64x128,48x96,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4.pg2,ne30pg3,ne30np4,ne60np4,ne120np4,ne120np4.pg2,ne120np4.pg3,ne0np4CONUS.ne30x8,ne0np4.ARCTIC.ne30x4,ne0np4.ARCTICGRIS.ne30x8,ne240np4,1km-merge-10min,C24,C48,C96,C192,C384"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min, 1km-merge-10min and 0.33x0.33 are only used for CLM toolsI @@ -1970,7 +1970,7 @@ hist means do NOT use a future scenario, just use historical data. + valid_values="USGS,gx3v7,gx1v6,gx1v7,navy,test,tx0.1v2,tx0.1v3,tx1v1,T62,cruncep,nldas2"> Land mask description From d7706ed32d3964264fd84d35b25457609b232f6a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 7 Jun 2020 14:12:06 -0600 Subject: [PATCH 0957/1973] Deallocate some memory in init_interp This doesn't yet cover the multilevel stuff, but should cover all other pointers that need deallocation. I'm not sure if the nullification of sgridindex and multilevel_interpolator accomplish anything. Erik had this, and it seems like it doesn't hurt, so I'm keeping this in place. --- src/init_interp/initInterp.F90 | 24 +++++++++--------- src/init_interp/initInterpMindist.F90 | 36 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index 220c45933d..0c30591a91 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -210,15 +210,15 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) integer :: npftsi, ncolsi, nlunsi, ngrcsi integer :: npftso, ncolso, nlunso, ngrcso logical :: glc_elevclasses_same - integer , pointer :: pftindx(:) - integer , pointer :: colindx(:) - integer , pointer :: lunindx(:) - integer , pointer :: grcindx(:) - logical , pointer :: pft_activei(:), pft_activeo(:) - logical , pointer :: col_activei(:), col_activeo(:) - logical , pointer :: lun_activei(:), lun_activeo(:) - logical , pointer :: grc_activei(:), grc_activeo(:) - integer , pointer :: sgridindex(:) + integer , allocatable, target :: pftindx(:) + integer , allocatable, target :: colindx(:) + integer , allocatable, target :: lunindx(:) + integer , allocatable, target :: grcindx(:) + logical , allocatable :: pft_activei(:), pft_activeo(:) + logical , allocatable :: col_activei(:), col_activeo(:) + logical , allocatable :: lun_activei(:), lun_activeo(:) + logical , allocatable :: grc_activei(:), grc_activeo(:) + integer , pointer :: sgridindex(:) type(subgrid_special_indices_type) :: subgrid_special_indices type(interp_multilevel_container_type) :: interp_multilevel_container type(interp_2dvar_type) :: var2d_i, var2d_o ! holds metadata for 2-d variables @@ -698,6 +698,8 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) write (iulog,*) ' Successfully created initial condition file mapped from input IC file' end if + sgridindex => null() + end subroutine initInterp !----------------------------------------------------------------------- @@ -823,9 +825,6 @@ subroutine findMinDist( dimname, begi, endi, bego, endo, ncidi, ncido, & call endrun('Unhandled interp_method'//errMsg(sourcefile, __LINE__)) end select - deallocate(subgridi%lat, subgridi%lon, subgridi%coslat) - deallocate(subgrido%lat, subgrido%lon, subgrido%coslat) - end subroutine findMinDist !======================================================================= @@ -1158,6 +1157,7 @@ subroutine interp_2d_double (var2di, var2do, & call var2do%writevar_double(rbuf2do) deallocate(rbuf2do, rbuf2do_levelsi) + multilevel_interpolator => null() end subroutine interp_2d_double diff --git a/src/init_interp/initInterpMindist.F90 b/src/init_interp/initInterpMindist.F90 index 7e7a6890f1..44a20d548e 100644 --- a/src/init_interp/initInterpMindist.F90 +++ b/src/init_interp/initInterpMindist.F90 @@ -50,6 +50,7 @@ module initInterpMindist real(r8), pointer :: coslat(:) contains procedure :: print_point ! print info about one point + final :: destroy_subgrid_type end type subgrid_type ! Private methods @@ -98,6 +99,41 @@ subroutine print_point(this, index, unit) end subroutine print_point + !----------------------------------------------------------------------- + subroutine destroy_subgrid_type(this) + ! + ! !DESCRIPTION: + ! Finalize routine for subgrid_type + ! + ! !ARGUMENTS: + type(subgrid_type) :: this + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'destroy_subgrid_type' + !----------------------------------------------------------------------- + + if (associated(this%ptype)) then + deallocate(this%ptype) + end if + + if (associated(this%ctype)) then + deallocate(this%ctype) + end if + + if (associated(this%ltype)) then + deallocate(this%ltype) + end if + + if (associated(this%topoglc)) then + deallocate(this%topoglc) + end if + + deallocate(this%lat) + deallocate(this%lon) + deallocate(this%coslat) + + end subroutine destroy_subgrid_type !======================================================================= From 419e59a58572113625101408ebb683b924aca01d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 7 Jun 2020 16:37:11 -0600 Subject: [PATCH 0958/1973] Add explicit deallocates of allocatables I don't think these are needed, but I'm adding them to be safe. One particular motivation was the targets: I'm not sure if the compiler is always smart enough to know when these are safe to deallocate. --- src/init_interp/initInterp.F90 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index 0c30591a91..90c80a1761 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -699,6 +699,18 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) end if sgridindex => null() + deallocate(pftindx) + deallocate(colindx) + deallocate(lunindx) + deallocate(grcindx) + deallocate(pft_activei) + deallocate(col_activei) + deallocate(lun_activei) + deallocate(grc_activei) + deallocate(pft_activeo) + deallocate(col_activeo) + deallocate(lun_activeo) + deallocate(grc_activeo) end subroutine initInterp From 8f5ec00b24770e3134bc98e20908284978748a1a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 7 Jun 2020 16:53:15 -0600 Subject: [PATCH 0959/1973] Init interp_multilevel_container_type using subroutine, not function I'm not sure if the use of a constructor function contributed in any way to the memory issues, but we've had problems using constructor functions elsewhere, so to be safe, I'm changing this to an init subroutine (as we want to do in general moving forward anyway). --- src/init_interp/initInterp.F90 | 2 +- .../initInterpMultilevelContainer.F90 | 26 ++++++------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index 90c80a1761..f9272ba339 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -400,7 +400,7 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) if (masterproc) then write(iulog,*)'setting up interpolators for multi-level variables' end if - interp_multilevel_container = interp_multilevel_container_type( & + call interp_multilevel_container%init( & ncid_source = ncidi, ncid_dest = ncido, & bounds_source = bounds_i, bounds_dest = bounds_o, & pftindex = pftindx, colindex = colindx) diff --git a/src/init_interp/initInterpMultilevelContainer.F90 b/src/init_interp/initInterpMultilevelContainer.F90 index 684cfe68b9..327db36982 100644 --- a/src/init_interp/initInterpMultilevelContainer.F90 +++ b/src/init_interp/initInterpMultilevelContainer.F90 @@ -51,13 +51,10 @@ module initInterpMultilevelContainer type(interp_multilevel_snow_type), pointer :: interp_multilevel_levsno1 type(interp_multilevel_split_type), pointer :: interp_multilevel_levtot_col contains + procedure :: init procedure :: find_interpolator end type interp_multilevel_container_type - interface interp_multilevel_container_type - module procedure constructor - end interface interp_multilevel_container_type - ! Private routines private :: create_interp_multilevel_levgrnd @@ -70,21 +67,18 @@ module initInterpMultilevelContainer contains ! ======================================================================== - ! Constructors + ! Public methods ! ======================================================================== !----------------------------------------------------------------------- - function constructor(ncid_source, ncid_dest, bounds_source, bounds_dest, & - pftindex, colindex) result(this) + subroutine init(this, ncid_source, ncid_dest, bounds_source, bounds_dest, & + pftindex, colindex) ! ! !DESCRIPTION: - ! Create an interp_multilevel_container_type instance. + ! Initialize this interp_multilevel_container_type instance ! - ! !USES: - use ncdio_pio, only : file_desc_t - ! ! !ARGUMENTS: - type(interp_multilevel_container_type) :: this ! function result + class(interp_multilevel_container_type), intent(inout) :: this type(file_desc_t), target, intent(inout) :: ncid_source ! netcdf ID for source file type(file_desc_t), target, intent(inout) :: ncid_dest ! netcdf ID for dest file type(interp_bounds_type), intent(in) :: bounds_source @@ -97,7 +91,7 @@ function constructor(ncid_source, ncid_dest, bounds_source, bounds_dest, & ! ! !LOCAL VARIABLES: - character(len=*), parameter :: subname = 'constructor' + character(len=*), parameter :: subname = 'init' !----------------------------------------------------------------------- allocate(this%interp_multilevel_copy) @@ -141,11 +135,7 @@ function constructor(ncid_source, ncid_dest, bounds_source, bounds_dest, & num_second_levels_source = this%interp_multilevel_levgrnd_col%get_nlev_source(), & num_second_levels_dest = this%interp_multilevel_levgrnd_col%get_nlev_dest()) - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== + end subroutine init !----------------------------------------------------------------------- function find_interpolator(this, lev_dimname, vec_dimname) result(interpolator) From fa8aa9b4d6eaa98ae93a80e31d75164931e21aa7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 7 Jun 2020 17:01:59 -0600 Subject: [PATCH 0960/1973] Add a finalizer for interp_multilevel_container_type I'm hopeful that this will solve a lot of the memory issues --- .../initInterpMultilevelContainer.F90 | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/init_interp/initInterpMultilevelContainer.F90 b/src/init_interp/initInterpMultilevelContainer.F90 index 327db36982..56facfc52d 100644 --- a/src/init_interp/initInterpMultilevelContainer.F90 +++ b/src/init_interp/initInterpMultilevelContainer.F90 @@ -53,6 +53,7 @@ module initInterpMultilevelContainer contains procedure :: init procedure :: find_interpolator + final :: destroy_interp_multilevel_container_type end type interp_multilevel_container_type ! Private routines @@ -480,5 +481,32 @@ subroutine create_snow_interpolators(interp_multilevel_levsno, interp_multilevel end subroutine create_snow_interpolators + ! ======================================================================== + ! Finalizers + ! ======================================================================== + + !----------------------------------------------------------------------- + subroutine destroy_interp_multilevel_container_type(this) + ! + ! !DESCRIPTION: + ! Finalize routine for interp_multilevel_container_type + ! + ! !ARGUMENTS: + type(interp_multilevel_container_type) :: this + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'destroy_interp_multilevel_container_type' + !----------------------------------------------------------------------- + + deallocate(this%interp_multilevel_copy) + deallocate(this%interp_multilevel_levgrnd_col) + deallocate(this%interp_multilevel_levgrnd_pft) + deallocate(this%interp_multilevel_levsno) + deallocate(this%interp_multilevel_levsno1) + deallocate(this%interp_multilevel_levtot_col) + + end subroutine destroy_interp_multilevel_container_type + end module initInterpMultilevelContainer From 266eacef3b459012deef8e3c76bcf9ffc03a858f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 7 Jun 2020 20:22:37 -0600 Subject: [PATCH 0961/1973] Remove some duplicate compset definitions --- cime_config/config_compsets.xml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index d559c8192b..6c552f8dc8 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -171,15 +171,6 @@ 2000_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV - - - I2000Clm50BgcCropQianGs - 2000_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - - I2000Clm50BgcCruGs 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV @@ -319,15 +310,6 @@ HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - - - IHistClm50BgcCropQianGs - HIST_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - - I2000Clm50BgcDvCrop From c5b732de30c97d89f01e5cf16385bafecb8d4ab0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 7 Jun 2020 20:22:44 -0600 Subject: [PATCH 0962/1973] Change izumi PEM test to use SGLC After the recent izumi machine update, this test is failing on izumi, here: ``` forrtl: severe (174): SIGSEGV, segmentation fault occurred Image PC Routine Line Source cesm.exe 000000000152273A Unknown Unknown Unknown libpthread-2.17.s 00007F76297F85F0 Unknown Unknown Unknown cesm.exe 0000000000F0CD5A glissade_velo_hig 997 glissade_velo_higher.F90 cesm.exe 0000000000F0B504 glissade_velo_mp_ 95 glissade_velo.F90 cesm.exe 0000000000E45F63 glissade_mp_gliss 2548 glissade.F90 cesm.exe 000000000110338B glad_initialise_m 149 glad_initialise.F90 cesm.exe 0000000000E2F92F glad_main_mp_glad 286 glad_main.F90 cesm.exe 0000000000DB9C48 glc_initmod_mp_gl 305 glc_InitMod.F90 cesm.exe 0000000000DA1F5A glc_comp_mct_mp_g 188 glc_comp_mct.F90 cesm.exe 000000000043B8A4 component_mod_mp_ 257 component_mod.F90 cesm.exe 000000000042A0EC cime_comp_mod_mp_ 1374 cime_comp_mod.F90 cesm.exe 00000000004387E9 MAIN__ 122 cime_driver.F90 cesm.exe 0000000000418662 Unknown Unknown Unknown libc-2.17.so 00007F762943D505 __libc_start_main Unknown Unknown cesm.exe 0000000000418569 Unknown Unknown Unknown ``` At first I was going to simply remove it, but it seems like there is some value in having a couple of PEM tests in the test suite (this is one of only two PEM tests). So I'm going to change it to use SGLC (`PEM_Ld1.f10_f10_musgs.I2000Clm50BgcCropGs.izumi_intel.clm-crop`). (See also https://github.com/ESCOMP/CTSM/issues/840.) --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index fd2b6cbc3c..e03cbc2b3b 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1103,7 +1103,7 @@ - + From fb57453bf868424dc19fa21ee04357a0a4162b94 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 7 Jun 2020 20:27:52 -0600 Subject: [PATCH 0963/1973] Update cime Point to a cime branch tag that is equivalent to cime5.8.24 but uses pio1 rather than pio2, even for mpi-serial cases (the changes in branch_tags/cime5.8.24_a01 relative to cime5.8.24 are equivalent to the changes in branch_tags/cime5.8.23_a01 relative to cime5.8.23). --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 27b3ae710f..43e4b64988 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.23_a01 +tag = branch_tags/cime5.8.24_a01 externals = ../Externals_cime.cfg required = True From ceb56235efc9eda4c8629ae968c9219b427379b3 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Mon, 8 Jun 2020 07:56:28 -0600 Subject: [PATCH 0964/1973] Building energy fix (issue #803). Performance verified through spreadsheet CTSM98_BUILDENERGY_Analysis_Pub --- src/biogeophys/UrbBuildTempOleson2015Mod.F90 | 60 +++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 b/src/biogeophys/UrbBuildTempOleson2015Mod.F90 index 462101d540..2b2e326c87 100644 --- a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 +++ b/src/biogeophys/UrbBuildTempOleson2015Mod.F90 @@ -229,6 +229,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, integer, parameter :: neq = 5 ! number of equation/unknowns integer :: fc,fl,c,l ! indices real(r8) :: dtime ! land model time step (s) + real(r8) :: building_hwr(bounds%begl:bounds%endl) ! building height to building width ratio (-) real(r8) :: t_roof_inner_bef(bounds%begl:bounds%endl) ! roof inside surface temperature at previous time step (K) real(r8) :: t_sunw_inner_bef(bounds%begl:bounds%endl) ! sunwall inside surface temperature at previous time step (K) real(r8) :: t_shdw_inner_bef(bounds%begl:bounds%endl) ! shadewall inside surface temperature at previous time step (K) @@ -341,6 +342,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, ! See clm_varcon.F90 ! 3. Set inner surface emissivities (Bueno et al. 2012, GMD). ! 4. Set concrete floor properties (Salamanca et al. 2010, TAC). + ! 5. Calculate building height to building width ratio do fl = 1,num_urbanl l = filter_urbanl(fl) if (urbpoi(l)) then @@ -373,13 +375,15 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, cv_floori(l) = (dz_floori(l) * cp_floori(l)) / dtime ! Density of dry air at standard pressure and t_building (kg m-3) rho_dair(l) = pstd / (rair*t_building_bef(l)) + ! Building height to building width ratio + building_hwr(l) = canyon_hwr(l)*(1._r8-wtlunit_roof(l))/wtlunit_roof(l) end if end do ! Get terms from soil temperature equations to compute conduction flux ! Negative is toward surface - heat added ! Note that the conduction flux here is in W m-2 wall area but for purposes of solving the set of - ! simultaneous equations this must be converted to W m-2 ground area. This is done below when + ! simultaneous equations this must be converted to W m-2 floor area. This is done below when ! setting up the equation coefficients. do fc = 1,num_nolakec @@ -413,14 +417,14 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, l = filter_urbanl(fl) if (urbpoi(l)) then - vf_rf(l) = sqrt(1._r8 + canyon_hwr(l)**2._r8) - canyon_hwr(l) + vf_rf(l) = sqrt(1._r8 + building_hwr(l)**2._r8) - building_hwr(l) vf_fr(l) = vf_rf(l) ! This view factor implicitly converts from per unit wall area to per unit floor area vf_wf(l) = 0.5_r8*(1._r8 - vf_rf(l)) ! This view factor implicitly converts from per unit floor area to per unit wall area - vf_fw(l) = vf_wf(l) / canyon_hwr(l) + vf_fw(l) = vf_wf(l) / building_hwr(l) ! This view factor implicitly converts from per unit roof area to per unit wall area vf_rw(l) = vf_fw(l) @@ -515,8 +519,8 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) - a(2,2) = 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) & - + 0.5_r8*tk_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*canyon_hwr(l) & + a(2,2) = 0.5_r8*hcv_sunwi(l)*building_hwr(l) & + + 0.5_r8*tk_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*building_hwr(l) & + 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8 & - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l) & @@ -529,11 +533,11 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, a(2,4) = - 4._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l) & - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) - a(2,5) = - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) + a(2,5) = - 0.5_r8*hcv_sunwi(l)*building_hwr(l) - result(2) = 0.5_r8*tk_sunw_innerl(l)*t_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*canyon_hwr(l) & + result(2) = 0.5_r8*tk_sunw_innerl(l)*t_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*building_hwr(l) & - 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner_bef(l)-t_sunw_innerl_bef(l))/(zi_sunw_innerl(l) & - - z_sunw_innerl(l))*canyon_hwr(l) & + - z_sunw_innerl(l))*building_hwr(l) & - 3._r8*em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - 3._r8*em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l) & - 3._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & @@ -547,7 +551,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) + - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*building_hwr(l) ! SHADEWALL a(3,1) = - 4._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l) & @@ -558,8 +562,8 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) - a(3,3) = 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) & - + 0.5_r8*tk_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*canyon_hwr(l) & + a(3,3) = 0.5_r8*hcv_shdwi(l)*building_hwr(l) & + + 0.5_r8*tk_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*building_hwr(l) & + 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8 & - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l) & @@ -569,11 +573,11 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) - a(3,5) = - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) + a(3,5) = - 0.5_r8*hcv_shdwi(l)*building_hwr(l) - result(3) = 0.5_r8*tk_shdw_innerl(l)*t_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*canyon_hwr(l) & + result(3) = 0.5_r8*tk_shdw_innerl(l)*t_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*building_hwr(l) & - 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner_bef(l)-t_shdw_innerl_bef(l))/(zi_shdw_innerl(l) & - - z_shdw_innerl(l))*canyon_hwr(l) & + - z_shdw_innerl(l))*building_hwr(l) & - 3._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - 3._r8*em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l) & - 3._r8*em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & @@ -587,7 +591,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) + - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*building_hwr(l) ! FLOOR a(4,1) = - 4._r8*em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l) & @@ -628,24 +632,24 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, ! Building air temperature a(5,1) = - 0.5_r8*hcv_roofi(l) - a(5,2) = - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) + a(5,2) = - 0.5_r8*hcv_sunwi(l)*building_hwr(l) - a(5,3) = - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) + a(5,3) = - 0.5_r8*hcv_shdwi(l)*building_hwr(l) a(5,4) = - 0.5_r8*hcv_floori(l) a(5,5) = ((ht_roof(l)*rho_dair(l)*cpair)/dtime) + & ((ht_roof(l)*vent_ach)/3600._r8)*rho_dair(l)*cpair + & 0.5_r8*hcv_roofi(l) + & - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) + & - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) + & + 0.5_r8*hcv_sunwi(l)*building_hwr(l) + & + 0.5_r8*hcv_shdwi(l)*building_hwr(l) + & 0.5_r8*hcv_floori(l) result(5) = (ht_roof(l)*rho_dair(l)*cpair/dtime)*t_building_bef(l) & + ((ht_roof(l)*vent_ach)/3600._r8)*rho_dair(l)*cpair*taf(l) & + 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) & - + 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - + 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & + + 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*building_hwr(l) & + + 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*building_hwr(l) & + 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l)) ! Solve equations @@ -826,7 +830,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, + em_floori(l)*sb*t_floor_bef(l)**4._r8 & + 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*(t_floor(l) - t_floor_bef(l)) - qrd_building(l) = qrd_roof(l) + canyon_hwr(l)*(qrd_sunw(l) + qrd_shdw(l)) + qrd_floor(l) + qrd_building(l) = qrd_roof(l) + building_hwr(l)*(qrd_sunw(l) + qrd_shdw(l)) + qrd_floor(l) if (abs(qrd_building(l)) > .10_r8 ) then write (iulog,*) 'urban inside building net longwave radiation balance error ',qrd_building(l) @@ -851,7 +855,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, qcd_sunw(l) = 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner(l) - t_sunw_innerl(l))/(zi_sunw_innerl(l) - z_sunw_innerl(l)) & + 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner_bef(l) - t_sunw_innerl_bef(l))/(zi_sunw_innerl(l) & - z_sunw_innerl(l)) - enrgy_bal_sunw(l) = qrd_sunw(l) + qcv_sunw(l)*canyon_hwr(l) + qcd_sunw(l)*canyon_hwr(l) + enrgy_bal_sunw(l) = qrd_sunw(l) + qcv_sunw(l)*building_hwr(l) + qcd_sunw(l)*building_hwr(l) if (abs(enrgy_bal_sunw(l)) > .10_r8 ) then write (iulog,*) 'urban inside sunwall energy balance error ',enrgy_bal_sunw(l) write (iulog,*) 'clm model is stopping' @@ -863,7 +867,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, qcd_shdw(l) = 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner(l) - t_shdw_innerl(l))/(zi_shdw_innerl(l) - z_shdw_innerl(l)) & + 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner_bef(l) - t_shdw_innerl_bef(l))/(zi_shdw_innerl(l) & - z_shdw_innerl(l)) - enrgy_bal_shdw(l) = qrd_shdw(l) + qcv_shdw(l)*canyon_hwr(l) + qcd_shdw(l)*canyon_hwr(l) + enrgy_bal_shdw(l) = qrd_shdw(l) + qcv_shdw(l)*building_hwr(l) + qcd_shdw(l)*building_hwr(l) if (abs(enrgy_bal_shdw(l)) > .10_r8 ) then write (iulog,*) 'urban inside shadewall energy balance error ',enrgy_bal_shdw(l) write (iulog,*) 'clm model is stopping' @@ -884,10 +888,10 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, - ht_roof(l)*(vent_ach/3600._r8)*rho_dair(l)*cpair*(taf(l) - t_building(l)) & - 0.5_r8*hcv_roofi(l)*(t_roof_inner(l) - t_building(l)) & - 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner(l) - t_building(l))*canyon_hwr(l) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner(l) - t_building(l))*canyon_hwr(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & + - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner(l) - t_building(l))*building_hwr(l) & + - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*building_hwr(l) & + - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner(l) - t_building(l))*building_hwr(l) & + - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*building_hwr(l) & - 0.5_r8*hcv_floori(l)*(t_floor(l) - t_building(l)) & - 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l)) if (abs(enrgy_bal_buildair(l)) > .10_r8 ) then From bb7b68b92a73af9d67fb7155fa3fbda369030e92 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Jun 2020 09:35:33 -0600 Subject: [PATCH 0965/1973] Update ChangeLog --- doc/ChangeLog | 130 +++++++++++++++++++++++++++++++++++++++++++++++++- doc/ChangeSum | 1 + 2 files changed, 130 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 5a1937d9b7..b88ecc5d3b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,132 @@ =============================================================== +Tag name: ctsm1.0.dev099 +Originator(s): sacks (Bill Sacks) +Date: Mon Jun 8 09:29:38 MDT 2020 +One-line Summary: Update cime, needed for izumi machine updates + +Purpose of changes +------------------ + +Update cime. The most important change here is an update for izumi, +which is needed for the recent izumi machine updates. + +Also: Change izumi PEM test to use SGLC (after the machine updates, the +PEM test was failing; see also +https://github.com/ESCOMP/CTSM/issues/840). + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not investigated; none expected + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Changed izumi PEM test to use SGLC (after the machine updates, the PEM +test was failing; see also https://github.com/ESCOMP/CTSM/issues/840). + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- ok + + izumi: tests pass, some baselines fail as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, just on izumi due to machine updates + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: some izumi tests + - what platforms/compilers: izumi gnu & pgi + - nature of change (roundoff; larger than roundoff/same climate; new climate): + not investigated; expected to be roundoff + + Answer changes were observed in these tests: + - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop + - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + - SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: N/A + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: branch_tags/cime5.8.23_a01 -> branch_tags/cime5.8.24_a01 + Point to a cime branch tag that is equivalent to cime5.8.24 but uses + pio1 rather than pio2, even for mpi-serial cases (the changes in + branch_tags/cime5.8.24_a01 relative to cime5.8.24 are equivalent to the + changes in branch_tags/cime5.8.23_a01 relative to cime5.8.23). + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev098 Originator(s): John Truesdale,UCAR/AMP,303-497-1386 Date: Thu May 28 14:39:27 MDT 2020 @@ -101,7 +229,7 @@ Pull Requests that document the changes (include PR ids): #891 =============================================================== =============================================================== Tag name: ctsm1.0.dev097 -Originator(s): ycheng (Yanyan Cheng) +Originator(s): ycheng (Yanyan Cheng); final changes & testing by Bill Sacks Date: Mon May 25 15:14:56 MDT 2020 One-line Summary: Add two bioenergy crops (switchgrass and miscanthus) diff --git a/doc/ChangeSum b/doc/ChangeSum index 117d556a9d..65632bf579 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev099 sacks 06/08/2020 Update cime, needed for izumi machine updates ctsm1.0.dev098 jet/erik 05/28/2020 Bring in GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 ctsm1.0.dev097 ycheng 05/25/2020 Add two bioenergy crops (switchgrass and miscanthus) ctsm1.0.dev096 slevis 05/21/2020 Gridcell-level balance checks for carbon and nitrogen From c786571581d6ac6334fdbdd9679df8902417f29b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Jun 2020 09:41:05 -0600 Subject: [PATCH 0966/1973] Update ChangeLog --- doc/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index b88ecc5d3b..37442caf03 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -81,6 +81,12 @@ CTSM testing: izumi: tests pass, some baselines fail as expected + ERP_D_Ld3.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-prescribed + showed differences from the stored baselines, but it appears that + the stored baselines were incorrect: when I reran this test from + master, the master version differed from the stored baselines and + was identical to this branch. + If the tag used for baseline comparisons was NOT the previous tag, note that here: From 71972d9c48e75b45eefaf392c3ebb3369e0fca55 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Jun 2020 10:03:38 -0600 Subject: [PATCH 0967/1973] In run_sys_tests: print more information on the current hash --- python/ctsm/run_sys_tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index 7792db6918..aa74d0e389 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -399,7 +399,8 @@ def _record_git_status(testroot, dry_run): output = '' ctsm_root = path_to_ctsm_root() - current_hash = subprocess.check_output(['git', 'show', '--no-patch', '--oneline', 'HEAD'], + current_hash = subprocess.check_output(['git', 'show', '--no-patch', + '--format=format:"%h (%ad) %s - %an"', 'HEAD'], cwd=ctsm_root, universal_newlines=True) output += "Current hash: {}".format(current_hash) From 6c350f93ab592f5f56759009084ae6e18bffa21a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Jun 2020 10:07:47 -0600 Subject: [PATCH 0968/1973] Fix formatting --- python/ctsm/run_sys_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index aa74d0e389..9feeba990e 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -400,7 +400,7 @@ def _record_git_status(testroot, dry_run): ctsm_root = path_to_ctsm_root() current_hash = subprocess.check_output(['git', 'show', '--no-patch', - '--format=format:"%h (%ad) %s - %an"', 'HEAD'], + '--format=format:%h (%ad) %s - %an\n', 'HEAD'], cwd=ctsm_root, universal_newlines=True) output += "Current hash: {}".format(current_hash) From a0c5d805e05ba2cace766cf185b5a05d65d388e2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Jun 2020 10:10:01 -0600 Subject: [PATCH 0969/1973] Improve hash output formatting in run_sys_test output --- python/ctsm/run_sys_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index 9feeba990e..e177dcd0e8 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -400,7 +400,7 @@ def _record_git_status(testroot, dry_run): ctsm_root = path_to_ctsm_root() current_hash = subprocess.check_output(['git', 'show', '--no-patch', - '--format=format:%h (%ad) %s - %an\n', 'HEAD'], + '--format=format:%h (%an, %ad) %s\n', 'HEAD'], cwd=ctsm_root, universal_newlines=True) output += "Current hash: {}".format(current_hash) From 1a3f43291f0908bf00477958699495e633cef0f0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Jun 2020 13:18:52 -0600 Subject: [PATCH 0970/1973] Work on documentation of lilac build --- .../obtaining-and-building-ctsm.rst | 63 +++++++++++++++++-- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst index 4b8e093b39..774b6a0ac9 100644 --- a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst +++ b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst @@ -31,6 +31,8 @@ this:: ./build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default +Further details on these commands are given below. + .. _building-ctsm-and-lilac-prerequisites: Prerequisites @@ -85,13 +87,13 @@ development branch. You can checkout a different branch or tag using ``git check For more details, see https://github.com/ESCOMP/CTSM/wiki/Quick-start-to-CTSM-development-with-git -Building CTSM and its dependencies, and including CTSM in the atmosphere model's build -====================================================================================== +Building CTSM and its dependencies +================================== Overview -------- -CTSM provides a build script, ``build_ctsm`` for building CTSM and its dependencies. (The +CTSM provides a build script, ``build_ctsm``, for building CTSM and its dependencies. (The dependencies built with this build script include various libraries that are packaged with CIME_. This does *not* build the :ref:`prerequisites noted above`: it is assumed that those are already built @@ -103,19 +105,58 @@ using a machine that has *not* been ported to CIME_. Both workflows are describe below. If you are using a machine that has not been ported to CIME, it is possible to do a complete CIME port and then use the first workflow (by following the `CIME porting guide `_), but -it is generally simpler to use the second workflow below. +unless you need to do so for other reasons (such as running CESM, or running CTSM in a +land-only configuration forced by a data atmosphere, using the CIME_ scripting +infrastructure), it is generally simpler to use the second workflow below: A full CIME +port requires many settings that are not needed for just building CTSM. There is a third usage where you simply want to rebuild after making some source code changes to CTSM. This is also documented below. All of these workflows use CIME's build system behind the scenes. Typically, you will not need to be aware of any of those details, but if problems arise, you may want to consult -the `CIME documentation `_. +the `CIME documentation`_. Building on a CIME-supported machine ------------------------------------ +If you are using a machine that has been ported to CIME_ (for example, NCAR's ``cheyenne`` +machine), then you do not need to specify much information to ``build_ctsm``. In addition, +in this case, CIME will load the appropriate modules and set the appropriate environment +variables at build time, so you do not need to do anything to set up your environment +ahead of time. + +To build CTSM and its dependencies in this case, run:: + + ./build_ctsm /PATH/TO/CTSM/BUILD --machine MACHINE --compiler COMPILER + +where you should fill in the capitalized arguments with appropriate values for your +machine. + +.. note:: + + The given directory (``/PATH/TO/CTSM/BUILD``) must *not* exist. This directory is + created for you by the build script. + +Some other options to ``build_ctsm`` are supported in this case (but many are not, since +they are only applicable to the non-CIME-supported machine workflow); run ``build_ctsm +-h`` for details. +Besides the build files themselves, there are two key files that are needed for the build +of the atmosphere model: + +1. ``/PATH/TO/CTSM/BUILD/ctsm.mk``: This Makefile-formatted file gives variables that + should be set in the atmosphere model's build. :ref:`See below for information on how + to use this file`. + +2. ``/PATH/TO/CTSM/BUILD/ctsm_build_environment.sh`` or + ``/PATH/TO/CTSM/BUILD/ctsm_build_environment.csh``: These files specify the build + environment that CIME used to build CTSM and its dependencies. **Before building the + atmosphere model, you should source the appropriate file** (based on your shell - use + the ``.sh`` file for bash and similar shells, and the ``.csh`` file for tcsh and + similar shells). **This will ensure that the atmosphere model is built with the same + compiler and library versions as CTSM.** For example, with bash: ``source + /PATH/TO/CTSM/BUILD/ctsm_build_environment.sh``. Rebuilding after changing CTSM source code ------------------------------------------ @@ -127,4 +168,14 @@ but the ``build_ctsm`` command will simply be:: where ``/PATH/TO/CTSM/BUILD`` should point to the same directory you originally used. -.. _CIME: https://github.com/esmci/cime +.. _including-ctsm-in-the-atmosphere-model-build: + +Including CTSM in the atmosphere model's build +============================================== + +.. todo:: + + TODO: Fill this section in + +.. _CIME: http://esmci.github.io/cime +.. _CIME documentation: http://esmci.github.io/cime From 8b64635e9b5c3f6507e9607139a81e22d46f866f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Jun 2020 16:50:18 -0600 Subject: [PATCH 0971/1973] Add information on build --- .../obtaining-and-building-ctsm.rst | 107 +++++++++++++++++- 1 file changed, 101 insertions(+), 6 deletions(-) diff --git a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst index 774b6a0ac9..e6254bb643 100644 --- a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst +++ b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst @@ -70,6 +70,10 @@ Building CTSM requires: - typically, this includes compiler wrappers like ``mpif90`` and ``mpicc`` +- ESMF version 8 or later + + - **ESMF is not needed in general for CTSM, but is needed for LILAC** + Obtaining CTSM ============== @@ -117,6 +121,8 @@ All of these workflows use CIME's build system behind the scenes. Typically, you need to be aware of any of those details, but if problems arise, you may want to consult the `CIME documentation`_. +.. _building-on-a-cime-supported-machine: + Building on a CIME-supported machine ------------------------------------ @@ -124,7 +130,10 @@ If you are using a machine that has been ported to CIME_ (for example, NCAR's `` machine), then you do not need to specify much information to ``build_ctsm``. In addition, in this case, CIME will load the appropriate modules and set the appropriate environment variables at build time, so you do not need to do anything to set up your environment -ahead of time. +ahead of time. **Building CTSM with LILAC requires ESMF. ESMF is currently an optional +CIME dependency, so many CIME-ported machines do not provide information on an ESMF +installation. NCAR's cheyenne machine DOES provide ESMF, but for other machines, you may +need to add this to your CIME port.** To build CTSM and its dependencies in this case, run:: @@ -139,11 +148,11 @@ machine. created for you by the build script. Some other options to ``build_ctsm`` are supported in this case (but many are not, since -they are only applicable to the non-CIME-supported machine workflow); run ``build_ctsm +they are only applicable to the non-CIME-supported machine workflow); run ``./build_ctsm -h`` for details. -Besides the build files themselves, there are two key files that are needed for the build -of the atmosphere model: +Besides the build files themselves, ``build_ctsm`` creates the following important files +that are needed for the build of the atmosphere model: 1. ``/PATH/TO/CTSM/BUILD/ctsm.mk``: This Makefile-formatted file gives variables that should be set in the atmosphere model's build. :ref:`See below for information on how @@ -158,6 +167,55 @@ of the atmosphere model: compiler and library versions as CTSM.** For example, with bash: ``source /PATH/TO/CTSM/BUILD/ctsm_build_environment.sh``. +Building on a machine that has not been ported to CIME +------------------------------------------------------ + +If you are using a machine thata has not been ported to CIME_, then you need to specify +additional information to ``build_ctsm`` that is needed by the build system. Before +building CTSM, you should load any modules required by the atmosphere model or CTSM +builds, including all of the :ref:`prerequisites noted +above`. + +The minimal amount of information needed is given by the following:: + + ./build_ctsm /PATH/TO/CTSM/BUILD --compiler COMPILER --os OS --netcdf-path NETCDF_PATH --esmf-lib-path ESMF_LIB_PATH + +where you should fill in the capitalized arguments with appropriate values for your +machine. Run ``./build_ctsm -h`` for details on these arguments, as well as documentation +of additional, optional arguments. Some of these optional arguments may be needed for +successful compilation, while others (such as ``--pnetcdf-path``) may be needed for good +model performance. + +.. note:: + + The given directory (``/PATH/TO/CTSM/BUILD``) must *not* exist. This directory is + created for you by the build script. + +Example usage for a Mac (a simple case) is:: + + ./build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default + +Example usage for NCAR's ``cheyenne`` machine (a more complex case) is:: + + module purge + module load ncarenv/1.3 intel/19.0.5 esmf_libs mkl + module use /glade/work/himanshu/PROGS/modulefiles/esmfpkgs/intel/19.0.5 + module load esmf-8.1.0b14-ncdfio-mpt-O mpt/2.21 netcdf/4.7.3 pnetcdf/1.12.1 ncarcompilers/0.5.0 + module load python + + ./build_ctsm /glade/scratch/$USER/ctsm_build_dir --os linux --compiler intel --netcdf-path '$ENV{NETCDF}' --pio-filesystem-hints gpfs --pnetcdf-path '$ENV{PNETCDF}' --esmf-lib-path '$ENV{ESMF_LIBDIR}' --extra-cflags '-xCORE_AVX2 -no-fma' --extra-fflags '-xCORE_AVX2 -no-fma' + +(It's better to use the :ref:`alternative process for a CIME-supported +machine` in this case, but the above illustrates +what would be needed for a machine similar to this that has not been ported to CIME.) + +Besides the build files themselves, ``build_ctsm`` creates an important file that is +needed for the build of the atmosphere model: ``/PATH/TO/CTSM/BUILD/ctsm.mk``. This +Makefile-formatted file gives variables that should be set in the atmosphere model's +build. :ref:`See below for information on how to use this +file`. + + Rebuilding after changing CTSM source code ------------------------------------------ @@ -173,9 +231,46 @@ where ``/PATH/TO/CTSM/BUILD`` should point to the same directory you originally Including CTSM in the atmosphere model's build ============================================== -.. todo:: +Once you have successfully built CTSM and its dependencies, you will need to add various +paths to the compilation and link lines when building your atmosphere model. For a +Makefile-based build system, we facilitate this by producing a file, +``/PATH/TO/CTSM/BUILD/ctsm.mk``, which you can include in your own build script. (We do +not yet produce an equivalent for CMake or other build systems.) + +There are two important variables defined in this file: + +- ``CTSM_INCLUDES``: This variable should be included in the compilation line for the + atmosphere model's source files. It lists all paths that need to be included in these + compilations so that the compiler can find the appropriate Fortran module files. + +- ``CTSM_LIBS``: This variable should be included in the link line when creating the final + executable. It lists paths and library names that need to be included in the link + step. **Note: This may not include all of the libraries that are** + :ref:`prerequisites`, **such as LAPACK, BLAS and + NetCDF. If your atmosphere doesn't already require these, you may need to add + appropriate information to your atmosphere model's link line.** However, it should + already include all required link information for ESMF. + +Other variables in this file do not need to be included directly in the atmosphere model's +build (they are just intermediate variables used to create ``CTSM_INCLUDES`` and +``CTSM_LIBS``). + +For example, for the WRF build, we do the following: If building with CTSM, then we +expect that the user has set an environment variable:: + + export WRF_CTSM_MKFILE=/PATH/TO/CTSM/BUILD/ctsm.mk + +If that environment variable exists, then the ``configure`` script adds the following to +the Makefile-based build: + +- Adds an include line (like ``include ${WRF_CTSM_MKFILE}``) + +- Adds a CPP definition, ``-DWRF_USE_CTSM``, which is used to do conditional compilation + of the CTSM-LILAC interface code + +- Adds ``$(CTSM_INCLUDES)`` to its variable ``INCLUDE_MODULES`` - TODO: Fill this section in +- Adds ``$(CTSM_LIBS)`` to its variable ``LIB`` .. _CIME: http://esmci.github.io/cime .. _CIME documentation: http://esmci.github.io/cime From d418f969caac53dae6c61a08c333baaeb3a4c934 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Jun 2020 17:04:12 -0600 Subject: [PATCH 0972/1973] Add to build documentation --- .../obtaining-and-building-ctsm.rst | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst index e6254bb643..f19857e510 100644 --- a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst +++ b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst @@ -9,8 +9,8 @@ This section describes the process for obtaining and building the CTSM library and its dependencies, and linking to these libraries in an atmosphere model's build. -Quick start example -=================== +Quick start example / overview +============================== The basic process for obtaining and building CTSM is the following: @@ -25,13 +25,23 @@ command will look like this (example given for NCAR's ``cheyenne`` machine):: ./build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne +and then, before building the atmosphere model:: + + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh + On a machine that has *not* been ported to CIME, you will need to provide some additional information. Run ``build_ctsm -h`` for details, but the basic command will look like this:: ./build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default -Further details on these commands are given below. +In both cases, you will then need to include the necessary information in the include and +link lines of the atmosphere model's build. For a Makefile-based build, this can be done +by including the file ``/PATH/TO/CTSM/BUILD/ctsm.mk`` in the atmosphere model's build +scripts, then adding ``CTSM_INCLUDES`` to the include line and ``CTSM_LIBS`` to the link +line. + +Further details on these steps are given below. .. _building-ctsm-and-lilac-prerequisites: @@ -172,8 +182,8 @@ Building on a machine that has not been ported to CIME If you are using a machine thata has not been ported to CIME_, then you need to specify additional information to ``build_ctsm`` that is needed by the build system. Before -building CTSM, you should load any modules required by the atmosphere model or CTSM -builds, including all of the :ref:`prerequisites noted +building CTSM, you should load any modules and/or set any environment variables required +by the atmosphere model or CTSM builds, including all of the :ref:`prerequisites noted above`. The minimal amount of information needed is given by the following:: @@ -263,7 +273,7 @@ expect that the user has set an environment variable:: If that environment variable exists, then the ``configure`` script adds the following to the Makefile-based build: -- Adds an include line (like ``include ${WRF_CTSM_MKFILE}``) +- Includes the ``ctsm.mk`` file (like ``include ${WRF_CTSM_MKFILE}``) - Adds a CPP definition, ``-DWRF_USE_CTSM``, which is used to do conditional compilation of the CTSM-LILAC interface code From 3be13efb5cd9d1be1060775ddec6980c61d1b72e Mon Sep 17 00:00:00 2001 From: Chris Fischer Date: Mon, 8 Jun 2020 18:47:14 -0600 Subject: [PATCH 0973/1973] Add var-res grids needed for CAM. --- bld/namelist_files/namelist_defaults_ctsm.xml | 64 +++++----- cime_config/config_pes.xml | 111 ++++++++++++++++++ cime_config/testdefs/testlist_clm.xml | 45 +++++++ 3 files changed, 188 insertions(+), 32 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index c9f287e04c..e8a3e4175c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -793,25 +793,25 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/ctsm1.0.dev094-2-g633be0eb/surfdata_1x1_smallvilleIA_hist_78pfts_CMIP6_simyr2000_c200521.nc - + lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne16np4_hist_78pfts_CMIP6_simyr2000_c190214.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr2000_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_simyr2000_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4_hist_78pfts_CMIP6_simyr2000_c200427.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4.pg2_hist_78pfts_CMIP6_simyr2000_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4.pg3_hist_78pfts_CMIP6_simyr2000_c200427.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr2000_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr2000_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr2000_c200426.nc @@ -873,23 +873,23 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_78pfts_CMIP6_simyr1850_c190214.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4_hist_78pfts_CMIP6_simyr1850_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4_hist_78pfts_CMIP6_simyr1850_c200427.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4.pg2_hist_78pfts_CMIP6_simyr1850_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4.pg3_hist_78pfts_CMIP6_simyr1850_c200427.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr1850_c200426.nc @@ -933,18 +933,18 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc + +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc @@ -979,7 +979,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts use_crop=".true." >lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index db9410ad12..0d1559791d 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -409,6 +409,117 @@ + + + + none + + -8 + -8 + -8 + -8 + -8 + -8 + -8 + -8 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + none + + -8 + -8 + -8 + -8 + -8 + -8 + -8 + -8 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + none + + -8 + -8 + -8 + -8 + -8 + -8 + -8 + -8 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index fd2b6cbc3c..26860d84a8 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1140,6 +1140,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e2dd40404439ff45975fdbf3ad388a1bd0d50866 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 05:31:49 -0600 Subject: [PATCH 0974/1973] Only deallocate some pointers if they are associated This is needed for the unit tests --- src/init_interp/initInterpMindist.F90 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/init_interp/initInterpMindist.F90 b/src/init_interp/initInterpMindist.F90 index 44a20d548e..baef369ea5 100644 --- a/src/init_interp/initInterpMindist.F90 +++ b/src/init_interp/initInterpMindist.F90 @@ -129,9 +129,17 @@ subroutine destroy_subgrid_type(this) deallocate(this%topoglc) end if - deallocate(this%lat) - deallocate(this%lon) - deallocate(this%coslat) + if (associated(this%lat)) then + deallocate(this%lat) + end if + + if (associated(this%lon)) then + deallocate(this%lon) + end if + + if (associated(this%coslat)) then + deallocate(this%coslat) + end if end subroutine destroy_subgrid_type From 999d08b28df2b7781a7a60c091f54babe0e4dc02 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 05:52:49 -0600 Subject: [PATCH 0975/1973] Change unit testing create_subgrid_info to subroutine The unit tests are failing on cheyenne-intel. I'm hopeful that changing this initialization from a function to a subroutine will solve the problem. --- .../initInterpMindistTestUtils.pf | 10 +-- .../test_set_mindist.pf | 66 ++++++++++++------- .../test_set_single_match.pf | 36 ++++++---- 3 files changed, 73 insertions(+), 39 deletions(-) diff --git a/src/init_interp/test/initInterpMindist_test/initInterpMindistTestUtils.pf b/src/init_interp/test/initInterpMindist_test/initInterpMindistTestUtils.pf index 009f4438bc..0da4e8099d 100644 --- a/src/init_interp/test/initInterpMindist_test/initInterpMindistTestUtils.pf +++ b/src/init_interp/test/initInterpMindist_test/initInterpMindistTestUtils.pf @@ -30,12 +30,12 @@ module initInterpMindistTestUtils contains !----------------------------------------------------------------------- - function create_subgrid_info(npts, name, lat, lon, & - beg, ptype, ctype, ltype, topoglc) & - result(subgrid_info) + subroutine create_subgrid_info(subgrid_info, & + npts, name, lat, lon, & + beg, ptype, ctype, ltype, topoglc) ! ! !ARGUMENTS: - type(subgrid_type) :: subgrid_info ! function result + type(subgrid_type), intent(inout) :: subgrid_info ! subroutine result integer, intent(in) :: npts character(len=*), intent(in) :: name real(r8), intent(in) :: lat(:) @@ -104,7 +104,7 @@ contains subgrid_info%topoglc = topoglc end if - end function create_subgrid_info + end subroutine create_subgrid_info !----------------------------------------------------------------------- function create_glc_behavior(collapse_to_atm_topo) result(glc_behavior) diff --git a/src/init_interp/test/initInterpMindist_test/test_set_mindist.pf b/src/init_interp/test/initInterpMindist_test/test_set_mindist.pf index 9b291a8994..4ae1171c47 100644 --- a/src/init_interp/test/initInterpMindist_test/test_set_mindist.pf +++ b/src/init_interp/test/initInterpMindist_test/test_set_mindist.pf @@ -192,7 +192,8 @@ contains cweights=[1._r8], & ptype=ptype_o) - subgrido_c = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido_c, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -201,7 +202,8 @@ contains lat = [my_lat], & lon = [my_lon], & topoglc = [topoglc_o]) - subgrido_p = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido_p, & npts = 1, & beg = bounds%begp, & name = 'pft', & @@ -223,7 +225,8 @@ contains lat_i(:) = my_lat lon_i(:) = my_lon - subgridi_c = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi_c, & npts = num_i, & name = 'column', & ctype = ctype_i, & @@ -231,7 +234,8 @@ contains lat = lat_i, & lon = lon_i, & topoglc = topoglc_i) - subgridi_p = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi_p, & npts = num_i, & name = 'pft', & ptype = ptype_i, & @@ -278,7 +282,8 @@ contains ctypes=[my_ctype], & cweights=[1._r8]) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -288,7 +293,8 @@ contains lon = [my_lon]) ! Input points differ in either column type or landunit type - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 5, & name = 'column', & ctype = [my_ctype-1, my_ctype, my_ctype, my_ctype, my_ctype + 1], & @@ -462,7 +468,8 @@ contains ctypes=[my_ctype], & cweights=[1._r8]) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -472,7 +479,8 @@ contains lon = [my_lon], & topoglc = [my_topo]) - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'column', & ctype = [my_ctype, my_ctype, my_ctype], & @@ -516,7 +524,8 @@ contains cweights=[1._r8], & ptype=my_ptype) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begp, & name = 'pft', & @@ -528,7 +537,8 @@ contains ! Input point #2 has the same ptype, but a different ctype and ltype. This one should ! be chosen. Other input points differ in ptype. - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'pft', & ptype = [my_ptype - 1, my_ptype, my_ptype + 1], & @@ -569,7 +579,8 @@ contains cweights=[1._r8], & ptype=my_ptype) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begp, & name = 'pft', & @@ -583,7 +594,8 @@ contains ! Input point #2 has the same ptype, but a different ctype and ltype. This one should ! be chosen. Other input points differ in ptype. - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'pft', & ptype = [my_ptype - 1, my_ptype, my_ptype + 1], & @@ -623,7 +635,8 @@ contains ctypes=[my_ctype], & cweights=[1._r8]) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -632,7 +645,8 @@ contains lat = [my_lat], & lon = [my_lon]) - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'column', & ctype = [icol_natveg - 2, icol_natveg, icol_natveg - 1], & @@ -678,7 +692,8 @@ contains cweights=[1._r8], & ptype=my_ptype) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begp, & name = 'pft', & @@ -688,7 +703,8 @@ contains lat = [my_lat], & lon = [my_lon]) - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'pft', & ptype = [ipft_bare + 1, ipft_bare, ipft_bare + 2], & @@ -731,7 +747,8 @@ contains cweights=[1._r8], & ptype=ipft_bare) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begp, & name = 'pft', & @@ -744,7 +761,8 @@ contains ! In the inputs, we use icol_veg even for special landunits, to make sure that even a ! patch whose pft and column type indicate natural veg is ignored if its landunit ! type is wrong. - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'pft', & ptype = [ipft_bare, ipft_bare, ipft_bare], & @@ -787,7 +805,8 @@ contains cweights=[1._r8], & ptype=my_ptype) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begp, & name = 'pft', & @@ -800,7 +819,8 @@ contains ! None of the input points match the output (in ptype, ctype or ltype). The 2nd point ! is a bare ground point, though, and so should be used as the template if we specify ! fill_missing_with_natveg. - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'pft', & ptype = [ipft_bare, ipft_bare, ipft_bare], & @@ -828,14 +848,16 @@ contains call setup_single_veg_patch(pft_type=1) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begg, & name = 'gridcell', & lat = [my_lat], & lon = [my_lon]) - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'gridcell', & lat = [my_lat - 10._r8, my_lat - 1._r8, my_lat + 10._r8], & diff --git a/src/init_interp/test/initInterpMindist_test/test_set_single_match.pf b/src/init_interp/test/initInterpMindist_test/test_set_single_match.pf index f951a49432..64e66a8d3c 100644 --- a/src/init_interp/test/initInterpMindist_test/test_set_single_match.pf +++ b/src/init_interp/test/initInterpMindist_test/test_set_single_match.pf @@ -110,7 +110,8 @@ contains call setup_single_veg_patch(pft_type=1) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -122,7 +123,8 @@ contains ! The target point is point 3. Both before and after the target point there are ! points with (1) same type but different location, and (2) same location but ! different type. - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 5, & name = 'column', & ctype = [my_ctype-1, my_ctype, my_ctype, my_ctype, my_ctype+1], & @@ -150,7 +152,8 @@ contains call setup_single_veg_patch(pft_type=1) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -159,7 +162,8 @@ contains lat = [my_lat], & lon = [my_lon]) - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'column', & ctype = [my_ctype-1, my_ctype, my_ctype+1], & @@ -186,7 +190,8 @@ contains call setup_single_veg_patch(pft_type=1) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -195,7 +200,8 @@ contains lat = [my_lat], & lon = [my_lon]) - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 1, & name = 'column', & ctype = [my_ctype+1], & @@ -224,7 +230,8 @@ contains call setup_single_veg_patch(pft_type=1) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -233,7 +240,8 @@ contains lat = [my_lat], & lon = [my_lon]) - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 2, & name = 'column', & ctype = [(my_ctype, i=1,2)], & @@ -266,7 +274,8 @@ contains call setup_single_veg_patch(pft_type=1) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begc, & name = 'column', & @@ -276,7 +285,8 @@ contains lon = [my_lon]) ! One point differs in lat, one point differs in lon, one point differs in ctype - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'column', & ctype = [my_ctype, my_ctype, my_ctype+1], & @@ -325,7 +335,8 @@ contains cweights=[1._r8], & ptype=my_ptype) - subgrido = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgrido, & npts = 1, & beg = bounds%begp, & name = 'pft', & @@ -338,7 +349,8 @@ contains ! Input point #2 has the same ptype, but a different ctype and ltype. Other input ! points differ in ptype. With set_mindist, we would choose #2, but with ! set_single_match we should abort. - subgridi = create_subgrid_info( & + call create_subgrid_info( & + subgrid_info = subgridi, & npts = 3, & name = 'pft', & ptype = [my_ptype - 1, my_ptype, my_ptype + 1], & From 17096423ee5648af7f8cb966391c32ceca8cb270 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 06:24:48 -0600 Subject: [PATCH 0976/1973] Update ChangeLog --- doc/ChangeLog | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 129 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 37442caf03..909b5e0442 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,132 @@ =============================================================== +Tag name: ctsm1.0.dev100 +Originator(s): sacks (Bill Sacks) +Date: Tue Jun 9 06:15:15 MDT 2020 +One-line Summary: Deallocate memory after running init_interp + +Purpose of changes +------------------ + +Many of the pointer arrays in init_interp were not being deallocated +when init_interp finished. This was a particular problem because some of +these arrays were allocated for the full global source grid on each +processor, so the memory use was significant. This tag fixes this issue. + +This issue is documented in https://github.com/ESCOMP/CTSM/issues/1010 +and https://github.com/ESCOMP/CTSM/issues/1032. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1032 (Memory isn't deallocated in some of the + init_interp code) + +Known bugs found since the previous tag (include github issue ID): +- This does NOT resolve ESCOMP/CTSM#1010 (WACCMX test fails with + ctsm1.0.dev093 in cesm2_2_alpha05c), even though that was the original + hope. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none +- The initial run of the PFS test showed a very long time taken in + initialization. However, it appears that this was a system issue: + rerunning twice showed times back to normal. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - pass (on my mac) + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + + Most testing was done on f332fafc. After that, I made a minor change + that was needed for the unit tests to pass. I then reran (1) + clm_short on cheyenne, and (2) this subset of the test list on + izumi: + + SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop + SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop + PEM_Ld1.f10_f10_musgs.I2000Clm50BgcCropGs.izumi_intel.clm-crop + SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_intel.clm-crop + SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-monthly + ERP_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-default + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev099 Originator(s): sacks (Bill Sacks) Date: Mon Jun 8 09:29:38 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 65632bf579..ce0b4cbe4a 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev100 sacks 06/09/2020 Deallocate memory after running init_interp ctsm1.0.dev099 sacks 06/08/2020 Update cime, needed for izumi machine updates ctsm1.0.dev098 jet/erik 05/28/2020 Bring in GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 ctsm1.0.dev097 ycheng 05/25/2020 Add two bioenergy crops (switchgrass and miscanthus) From 6801e5255a5bc57efa11554ab82e99f5c662a634 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 07:32:20 -0600 Subject: [PATCH 0977/1973] Move build_ctsm into lilac subdirectory, and tweak documentation People were concerned that having build_ctsm at the top level would be confusing to people who are using this without lilac. --- .../obtaining-building-and-running/index.rst | 6 ++-- .../obtaining-and-building-ctsm.rst | 34 ++++++++++++------- build_ctsm => lilac/build_ctsm | 0 3 files changed, 24 insertions(+), 16 deletions(-) rename build_ctsm => lilac/build_ctsm (100%) diff --git a/doc/source/lilac/obtaining-building-and-running/index.rst b/doc/source/lilac/obtaining-building-and-running/index.rst index a1386fe909..7f18c180f7 100644 --- a/doc/source/lilac/obtaining-building-and-running/index.rst +++ b/doc/source/lilac/obtaining-building-and-running/index.rst @@ -1,8 +1,8 @@ .. _obtaining-building-and-running: -====================================== - Obtaining, building and running CTSM -====================================== +================================================= + Obtaining, building and running CTSM with LILAC +================================================= .. toctree:: :maxdepth: 2 diff --git a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst index f19857e510..04ae3b6236 100644 --- a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst +++ b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst @@ -9,6 +9,14 @@ This section describes the process for obtaining and building the CTSM library and its dependencies, and linking to these libraries in an atmosphere model's build. +.. important:: + + This documentation only applies to the process where you are building CTSM with LILAC + for use in an atmosphere model that has *not* been integrated with CESM or CIME. If you + are using CTSM within CESM, or running CTSM in land-only mode with a data atmosphere, + then you should refer to the :ref:`general CTSM user's guide` as well as + the `CIME documentation`_. + Quick start example / overview ============================== @@ -23,17 +31,17 @@ Obtain CTSM by running:: Then build CTSM and its dependencies. On a machine that has been ported to CIME, the command will look like this (example given for NCAR's ``cheyenne`` machine):: - ./build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne + ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne and then, before building the atmosphere model:: source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh On a machine that has *not* been ported to CIME, you will need to provide some additional -information. Run ``build_ctsm -h`` for details, but the basic command will look like -this:: +information. Run ``./lilac/build_ctsm -h`` for details, but the basic command will look +like this:: - ./build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default + ./lilac/build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default In both cases, you will then need to include the necessary information in the include and link lines of the atmosphere model's build. For a Makefile-based build, this can be done @@ -107,7 +115,7 @@ Building CTSM and its dependencies Overview -------- -CTSM provides a build script, ``build_ctsm``, for building CTSM and its dependencies. (The +CTSM provides a build script, ``lilac/build_ctsm``, for building CTSM and its dependencies. (The dependencies built with this build script include various libraries that are packaged with CIME_. This does *not* build the :ref:`prerequisites noted above`: it is assumed that those are already built @@ -147,7 +155,7 @@ need to add this to your CIME port.** To build CTSM and its dependencies in this case, run:: - ./build_ctsm /PATH/TO/CTSM/BUILD --machine MACHINE --compiler COMPILER + ./lilac/build_ctsm /PATH/TO/CTSM/BUILD --machine MACHINE --compiler COMPILER where you should fill in the capitalized arguments with appropriate values for your machine. @@ -158,8 +166,8 @@ machine. created for you by the build script. Some other options to ``build_ctsm`` are supported in this case (but many are not, since -they are only applicable to the non-CIME-supported machine workflow); run ``./build_ctsm --h`` for details. +they are only applicable to the non-CIME-supported machine workflow); run +``./lilac/build_ctsm -h`` for details. Besides the build files themselves, ``build_ctsm`` creates the following important files that are needed for the build of the atmosphere model: @@ -188,10 +196,10 @@ above`. The minimal amount of information needed is given by the following:: - ./build_ctsm /PATH/TO/CTSM/BUILD --compiler COMPILER --os OS --netcdf-path NETCDF_PATH --esmf-lib-path ESMF_LIB_PATH + ./lilac/build_ctsm /PATH/TO/CTSM/BUILD --compiler COMPILER --os OS --netcdf-path NETCDF_PATH --esmf-lib-path ESMF_LIB_PATH where you should fill in the capitalized arguments with appropriate values for your -machine. Run ``./build_ctsm -h`` for details on these arguments, as well as documentation +machine. Run ``./lilac/build_ctsm -h`` for details on these arguments, as well as documentation of additional, optional arguments. Some of these optional arguments may be needed for successful compilation, while others (such as ``--pnetcdf-path``) may be needed for good model performance. @@ -203,7 +211,7 @@ model performance. Example usage for a Mac (a simple case) is:: - ./build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default + ./lilac/build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default Example usage for NCAR's ``cheyenne`` machine (a more complex case) is:: @@ -213,7 +221,7 @@ Example usage for NCAR's ``cheyenne`` machine (a more complex case) is:: module load esmf-8.1.0b14-ncdfio-mpt-O mpt/2.21 netcdf/4.7.3 pnetcdf/1.12.1 ncarcompilers/0.5.0 module load python - ./build_ctsm /glade/scratch/$USER/ctsm_build_dir --os linux --compiler intel --netcdf-path '$ENV{NETCDF}' --pio-filesystem-hints gpfs --pnetcdf-path '$ENV{PNETCDF}' --esmf-lib-path '$ENV{ESMF_LIBDIR}' --extra-cflags '-xCORE_AVX2 -no-fma' --extra-fflags '-xCORE_AVX2 -no-fma' + ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --os linux --compiler intel --netcdf-path '$ENV{NETCDF}' --pio-filesystem-hints gpfs --pnetcdf-path '$ENV{PNETCDF}' --esmf-lib-path '$ENV{ESMF_LIBDIR}' --extra-cflags '-xCORE_AVX2 -no-fma' --extra-fflags '-xCORE_AVX2 -no-fma' (It's better to use the :ref:`alternative process for a CIME-supported machine` in this case, but the above illustrates @@ -232,7 +240,7 @@ Rebuilding after changing CTSM source code To rebuild after changing CTSM source code, you should follow one of the above workflows, but the ``build_ctsm`` command will simply be:: - ./build_ctsm /PATH/TO/CTSM/BUILD --rebuild + ./lilac/build_ctsm /PATH/TO/CTSM/BUILD --rebuild where ``/PATH/TO/CTSM/BUILD`` should point to the same directory you originally used. diff --git a/build_ctsm b/lilac/build_ctsm similarity index 100% rename from build_ctsm rename to lilac/build_ctsm From 42f0494adf7e8b8104bcdb2eab4666862e0082f5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 13:18:21 -0600 Subject: [PATCH 0978/1973] Fix build_ctsm for new location --- lilac/build_ctsm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lilac/build_ctsm b/lilac/build_ctsm index 04c184c355..cc3fd19f7e 100755 --- a/lilac/build_ctsm +++ b/lilac/build_ctsm @@ -4,7 +4,9 @@ import os import sys -_CTSM_PYTHON = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'python') +_CTSM_PYTHON = os.path.join(os.path.dirname(os.path.abspath(__file__)), + os.pardir, + 'python') sys.path.insert(1, _CTSM_PYTHON) from ctsm.path_utils import add_cime_lib_to_path From f1a2442cfdfae4076e02789eba9a774fe21fedff Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 16:12:47 -0600 Subject: [PATCH 0979/1973] add a system test of build_ctsm --- python/ctsm/build_ctsm.py | 4 +- python/ctsm/test/test_sys_build_ctsm.py | 78 +++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 python/ctsm/test/test_sys_build_ctsm.py diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 86bed1ef89..884afe04c2 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -96,9 +96,9 @@ def build_ctsm(cime_path, esmf_lib_path (str or None): path to ESMF library directory Must be given if machine isn't given; ignored if machine is given gmake (str or None): name of GNU make tool - Ignored if machine is given + Must be given if machine isn't given; ignored if machine is given gmake_j (int or None): number of threads to use when building - Ignored if machine is given + Must be given if machine isn't given; ignored if machine is given pnetcdf_path (str or None): path to PNetCDF installation, if present (or None) Ignored if machine is given pio_filesystem_hints (str or None): if present (not None), enable filesystem hints for the diff --git a/python/ctsm/test/test_sys_build_ctsm.py b/python/ctsm/test/test_sys_build_ctsm.py new file mode 100644 index 0000000000..6141c4a103 --- /dev/null +++ b/python/ctsm/test/test_sys_build_ctsm.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +"""System tests for build_ctsm + +These tests do a lot of work (interacting with cime, etc.), and thus take relatively long +to run. +""" + +import unittest +import tempfile +import shutil +import os + +from ctsm.path_utils import add_cime_lib_to_path +from ctsm import unit_testing +from ctsm.build_ctsm import build_ctsm + +_CIME_PATH = add_cime_lib_to_path(standalone_only=True) + +# Allow names that pylint doesn't like, because otherwise I find it hard +# to make readable unit test names +# pylint: disable=invalid-name + +class TestSysBuildCtsm(unittest.TestCase): + """System tests for build_ctsm""" + + def setUp(self): + self._tempdir = tempfile.mkdtemp() + + def tearDown(self): + shutil.rmtree(self._tempdir, ignore_errors=True) + + def test_buildSetup_userDefinedMachine_minimalInfo(self): + """Get through the case.setup phase with a user-defined machine + + This tests that the xml files are created successfully and that they are + compatible with cime's xml schemas. It also ensures that the creation of + various directories goes smoothly. + + This version specifies a minimal amount of information + """ + build_ctsm(cime_path=_CIME_PATH, + build_dir=os.path.join(self._tempdir, 'ctsm_build'), + compiler='gnu', + no_build=True, + os_type='linux', + netcdf_path='/path/to/netcdf', + esmf_lib_path='/path/to/esmf/lib', + gmake='gmake', + gmake_j=8) + + def test_buildSetup_userDefinedMachine_allInfo(self): + """Get through the case.setup phase with a user-defined machine + + This tests that the xml files are created successfully and that they are + compatible with cime's xml schemas. It also ensures that the creation of + various directories goes smoothly. + + This version specifies all possible information + """ + build_ctsm(cime_path=_CIME_PATH, + build_dir=os.path.join(self._tempdir, 'ctsm_build'), + compiler='gnu', + no_build=True, + os_type='linux', + netcdf_path='/path/to/netcdf', + esmf_lib_path='/path/to/esmf/lib', + gmake='gmake', + gmake_j=8, + pnetcdf_path='/path/to/pnetcdf', + pio_filesystem_hints='gpfs', + gptl_nano_timers=True, + extra_fflags='-foo', + extra_cflags='-bar') + +if __name__ == '__main__': + unit_testing.setup_for_tests() + unittest.main() From 3e8085750b7d3c28ce7ff283de5fb2edabe3452d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 16:26:51 -0600 Subject: [PATCH 0980/1973] Minor refactoring --- python/ctsm/build_ctsm.py | 25 +++++++++++++------------ python/ctsm/test/test_sys_build_ctsm.py | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 884afe04c2..8be2196e6d 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -133,8 +133,10 @@ def build_ctsm(cime_path, extra_fflags=extra_fflags, extra_cflags=extra_cflags) + case_dir = os.path.join(build_dir, 'case') _create_and_build_case(cime_path=cime_path, build_dir=build_dir, + case_dir=case_dir, compiler=compiler, machine=machine, no_build=no_build) @@ -450,20 +452,19 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_and_build_case(cime_path, build_dir, compiler, machine=None, no_build=False): +def _create_and_build_case(cime_path, build_dir, case_dir, compiler, machine=None, no_build=False): """Create a case and build the CTSM library and its dependencies Args: cime_path (str): path to root of cime build_dir (str): path to build directory + case_dir (str): path to case directory compiler (str): compiler to use machine (str or None): name of machine or None If None, we assume we're using an on-the-fly machine port Otherwise, machine should be the name of a machine known to cime no_build (bool): If True, set things up, but skip doing the actual build """ - casedir = os.path.join(build_dir, 'case') - # Note that, for some commands, we want to suppress output, only showing the output if # the command fails; for these we use run_cmd_output_on_error. For other commands, we # want to always show output (or there should be no output in general); for these, we @@ -482,7 +483,7 @@ def _create_and_build_case(cime_path, build_dir, compiler, machine=None, no_buil create_newcase_cmd = [os.path.join(cime_path, 'scripts', 'create_newcase'), '--output-root', build_dir, - '--case', casedir, + '--case', case_dir, '--compset', _COMPSET, '--res', _RES, '--compiler', compiler, @@ -492,29 +493,29 @@ def _create_and_build_case(cime_path, build_dir, compiler, machine=None, no_buil run_cmd_output_on_error(create_newcase_cmd, errmsg='Problem creating CTSM case directory') - run_cmd_output_on_error([os.path.join(casedir, 'case.setup')], + run_cmd_output_on_error([os.path.join(case_dir, 'case.setup')], errmsg='Problem setting up CTSM case directory', - cwd=casedir) + cwd=case_dir) - subprocess.check_call([os.path.join(casedir, 'xmlchange'), 'LILAC_MODE=on'], cwd=casedir) + subprocess.check_call([os.path.join(case_dir, 'xmlchange'), 'LILAC_MODE=on'], cwd=case_dir) - make_link(os.path.join(casedir, 'bld'), + make_link(os.path.join(case_dir, 'bld'), os.path.join(build_dir, 'bld')) if machine is not None: # For a pre-existing machine, the .env_mach_specific files are likely useful to # the user. Make sym links to these with more intuitive names. for extension in ('sh', 'csh'): - make_link(os.path.join(casedir, '.env_mach_specific.{}'.format(extension)), + make_link(os.path.join(case_dir, '.env_mach_specific.{}'.format(extension)), os.path.join(build_dir, 'ctsm_build_environment.{}'.format(extension))) if not no_build: try: subprocess.check_call( - [os.path.join(casedir, 'case.build'), + [os.path.join(case_dir, 'case.build'), '--sharedlib-only'], - cwd=casedir) + cwd=case_dir) except subprocess.CalledProcessError: abort('ERROR building CTSM or its dependencies - see above for details') - make_link(os.path.join(casedir, 'bld', 'ctsm.mk'), + make_link(os.path.join(case_dir, 'bld', 'ctsm.mk'), os.path.join(build_dir, 'ctsm.mk')) diff --git a/python/ctsm/test/test_sys_build_ctsm.py b/python/ctsm/test/test_sys_build_ctsm.py index 6141c4a103..a0b62eae18 100644 --- a/python/ctsm/test/test_sys_build_ctsm.py +++ b/python/ctsm/test/test_sys_build_ctsm.py @@ -48,6 +48,7 @@ def test_buildSetup_userDefinedMachine_minimalInfo(self): esmf_lib_path='/path/to/esmf/lib', gmake='gmake', gmake_j=8) + # no assertions: test passes as long as the command doesn't generate any errors def test_buildSetup_userDefinedMachine_allInfo(self): """Get through the case.setup phase with a user-defined machine @@ -72,6 +73,7 @@ def test_buildSetup_userDefinedMachine_allInfo(self): gptl_nano_timers=True, extra_fflags='-foo', extra_cflags='-bar') + # no assertions: test passes as long as the command doesn't generate any errors if __name__ == '__main__': unit_testing.setup_for_tests() From 76f2f957481d6f167f02d3d9dabf461453813f2b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 16:27:58 -0600 Subject: [PATCH 0981/1973] Make unit test modules executable This way, we can run individual sets of tests like: ./ctsm/test/test_unit_build_ctsm.py --- python/ctsm/test/test_sys_build_ctsm.py | 0 python/ctsm/test/test_unit_build_ctsm.py | 0 python/ctsm/test/test_unit_machine.py | 0 python/ctsm/test/test_unit_path_utils.py | 0 python/ctsm/test/test_unit_run_sys_tests.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 python/ctsm/test/test_sys_build_ctsm.py mode change 100644 => 100755 python/ctsm/test/test_unit_build_ctsm.py mode change 100644 => 100755 python/ctsm/test/test_unit_machine.py mode change 100644 => 100755 python/ctsm/test/test_unit_path_utils.py mode change 100644 => 100755 python/ctsm/test/test_unit_run_sys_tests.py diff --git a/python/ctsm/test/test_sys_build_ctsm.py b/python/ctsm/test/test_sys_build_ctsm.py old mode 100644 new mode 100755 diff --git a/python/ctsm/test/test_unit_build_ctsm.py b/python/ctsm/test/test_unit_build_ctsm.py old mode 100644 new mode 100755 diff --git a/python/ctsm/test/test_unit_machine.py b/python/ctsm/test/test_unit_machine.py old mode 100644 new mode 100755 diff --git a/python/ctsm/test/test_unit_path_utils.py b/python/ctsm/test/test_unit_path_utils.py old mode 100644 new mode 100755 diff --git a/python/ctsm/test/test_unit_run_sys_tests.py b/python/ctsm/test/test_unit_run_sys_tests.py old mode 100644 new mode 100755 From a869cc396704c910a6fef12c86577a7f39dc656a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 17:14:01 -0600 Subject: [PATCH 0982/1973] Refactor --- python/ctsm/build_ctsm.py | 58 +++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 8be2196e6d..809919d336 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -134,12 +134,14 @@ def build_ctsm(cime_path, extra_cflags=extra_cflags) case_dir = os.path.join(build_dir, 'case') - _create_and_build_case(cime_path=cime_path, - build_dir=build_dir, - case_dir=case_dir, - compiler=compiler, - machine=machine, - no_build=no_build) + _create_case(cime_path=cime_path, + build_dir=build_dir, + case_dir=case_dir, + compiler=compiler, + machine=machine) + if not no_build: + _build_case(build_dir=build_dir, + case_dir=case_dir) # ======================================================================== # Private functions @@ -452,8 +454,8 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_and_build_case(cime_path, build_dir, case_dir, compiler, machine=None, no_build=False): - """Create a case and build the CTSM library and its dependencies +def _create_case(cime_path, build_dir, case_dir, compiler, machine=None): + """Create a case that can later be used to build the CTSM library and its dependencies Args: cime_path (str): path to root of cime @@ -463,12 +465,11 @@ def _create_and_build_case(cime_path, build_dir, case_dir, compiler, machine=Non machine (str or None): name of machine or None If None, we assume we're using an on-the-fly machine port Otherwise, machine should be the name of a machine known to cime - no_build (bool): If True, set things up, but skip doing the actual build """ # Note that, for some commands, we want to suppress output, only showing the output if - # the command fails; for these we use run_cmd_output_on_error. For other commands, we - # want to always show output (or there should be no output in general); for these, we - # directly use subprocess.check_call or similar. + # the command fails; for these we use run_cmd_output_on_error. For other commands, + # there should be no output in general; for these, we directly use + # subprocess.check_call or similar. # Also note that, for commands executed from the case directory, we specify the path # to the case directory both in the command itself and in the cwd argument. We do the @@ -508,14 +509,25 @@ def _create_and_build_case(cime_path, build_dir, case_dir, compiler, machine=Non make_link(os.path.join(case_dir, '.env_mach_specific.{}'.format(extension)), os.path.join(build_dir, 'ctsm_build_environment.{}'.format(extension))) - if not no_build: - try: - subprocess.check_call( - [os.path.join(case_dir, 'case.build'), - '--sharedlib-only'], - cwd=case_dir) - except subprocess.CalledProcessError: - abort('ERROR building CTSM or its dependencies - see above for details') - - make_link(os.path.join(case_dir, 'bld', 'ctsm.mk'), - os.path.join(build_dir, 'ctsm.mk')) +def _build_case(build_dir, case_dir): + """Build the CTSM library and its dependencies + + Args: + build_dir (str): path to build directory + case_dir (str): path to case directory + """ + # We want user to see output from the build command, so we use subprocess.check_call + # rather than run_cmd_output_on_error. + + # See comment in _create_case for why we use case_dir in both the path to the command + # and in the cwd argument to check_call. + try: + subprocess.check_call( + [os.path.join(case_dir, 'case.build'), + '--sharedlib-only'], + cwd=case_dir) + except subprocess.CalledProcessError: + abort('ERROR building CTSM or its dependencies - see above for details') + + make_link(os.path.join(case_dir, 'bld', 'ctsm.mk'), + os.path.join(build_dir, 'ctsm.mk')) From 9b17958db31a108b1b1945e9e6dae9228301d3c8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Jun 2020 17:23:44 -0600 Subject: [PATCH 0983/1973] Implement rebuild method --- python/ctsm/build_ctsm.py | 47 +++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 809919d336..df9d9edd81 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -48,7 +48,7 @@ def main(cime_path): build_dir = os.path.abspath(args.build_dir) if args.rebuild: - abort('--rebuild not yet implemented') + rebuild_ctsm(build_dir=build_dir) else: build_ctsm(cime_path=cime_path, build_dir=build_dir, @@ -133,15 +133,39 @@ def build_ctsm(cime_path, extra_fflags=extra_fflags, extra_cflags=extra_cflags) - case_dir = os.path.join(build_dir, 'case') _create_case(cime_path=cime_path, build_dir=build_dir, - case_dir=case_dir, compiler=compiler, machine=machine) if not no_build: - _build_case(build_dir=build_dir, - case_dir=case_dir) + _build_case(build_dir=build_dir) + +def rebuild_ctsm(build_dir): + """Re-run the build in an existing directory + + Args: + build_dir (str): path to build directory + """ + if not os.path.exists(build_dir): + abort('When running with --rebuild, the build directory must already exist\n' + '(<{}> does not exist)'.format(build_dir)) + + case_dir = _get_case_dir(build_dir) + if not os.path.exists(case_dir): + abort('It appears there was a problem setting up the initial build in\n' + '<{}>\n' + 'You should start over with a fresh build directory.'.format(build_dir)) + + try: + subprocess.check_call( + [os.path.join(case_dir, 'case.build'), + '--clean-depends', + 'lnd'], + cwd=case_dir) + except subprocess.CalledProcessError: + abort('ERROR resetting build for CTSM in order to rebuild - see above for details') + + _build_case(build_dir) # ======================================================================== # Private functions @@ -364,6 +388,10 @@ def _check_and_transform_os(os_type): raise ValueError("Unknown OS: {}".format(os_type)) return os_type_transformed +def _get_case_dir(build_dir): + """Given the path to build_dir, return the path to the case directory""" + return os.path.join(build_dir, 'case') + def _create_build_dir(build_dir, existing_machine): """Create the given build directory and any necessary sub-directories @@ -454,13 +482,12 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_case(cime_path, build_dir, case_dir, compiler, machine=None): +def _create_case(cime_path, build_dir, compiler, machine=None): """Create a case that can later be used to build the CTSM library and its dependencies Args: cime_path (str): path to root of cime build_dir (str): path to build directory - case_dir (str): path to case directory compiler (str): compiler to use machine (str or None): name of machine or None If None, we assume we're using an on-the-fly machine port @@ -476,6 +503,8 @@ def _create_case(cime_path, build_dir, case_dir, compiler, machine=None): # former in case dot isn't in the user's path; we do the latter in case the commands # require you to be in the case directory when you execute them. + case_dir = _get_case_dir(build_dir) + if machine is None: machine_args = ['--machine', _MACH_NAME, '--extra-machines-dir', os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME)] @@ -509,18 +538,18 @@ def _create_case(cime_path, build_dir, case_dir, compiler, machine=None): make_link(os.path.join(case_dir, '.env_mach_specific.{}'.format(extension)), os.path.join(build_dir, 'ctsm_build_environment.{}'.format(extension))) -def _build_case(build_dir, case_dir): +def _build_case(build_dir): """Build the CTSM library and its dependencies Args: build_dir (str): path to build directory - case_dir (str): path to case directory """ # We want user to see output from the build command, so we use subprocess.check_call # rather than run_cmd_output_on_error. # See comment in _create_case for why we use case_dir in both the path to the command # and in the cwd argument to check_call. + case_dir = _get_case_dir(build_dir) try: subprocess.check_call( [os.path.join(case_dir, 'case.build'), From 05c5d6a734e33a8e21ae26cfd0e0b4b147763639 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 9 Jun 2020 20:04:46 -0600 Subject: [PATCH 0984/1973] Documentation on how to run WRF-CTSM --- doc/source/lilac/specific-atm-models/wrf.rst | 275 ++++++++++++++++++- 1 file changed, 274 insertions(+), 1 deletion(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 0a5813a659..0cc1f01b67 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -1,9 +1,282 @@ .. _wrf: +.. highlight:: shell + ===================== Using CTSM with WRF ===================== +This section describes the procedure for building and running the CTSM +library and its dependencies, and linking to these libraries in the WRF +model's build via LILAC. As such this section repeats some information +from earlier sections but in recipe form and with minimal detail. + +.. important:: + + This section assumes use of a machine that has been ported to CIME. + In this example we assume NCAR’s cheyenne computer in particular. + +Preparing the CTSM +================== + +Decide where you will work, for example:: + + cd /glade/scratch/$USER + mkdir git_wrf_ctsm + cd git_wrf_ctsm + +.. note:: + + Discs other than /glade/scratch may provide insufficient space for + output from simulations longer than one or two months. + +Obtain CTSM by running:: + + git clone https://github.com/ESCOMP/ctsm.git + cd ctsm + git checkout lilac_cap + ./manage_externals/checkout_externals -v + +Build CTSM and its dependencies:: + + ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne + +Run:: + + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh + +.. note:: + + If the previous command fails due to your environment settings, + try this one instead: + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh + +.. note:: + + For additional details on preparing the CTSM, including how to + recompile when making code changes to the CTSM, read section + _obtaining-and-building-ctsm. <-- CREATED LINK TO THE CORRECT SECTION? + +Preparing the WRF model +======================= + +Obtain WRF by running:: + + cd /glade/scratch/$USER/git_wrf_ctsm + git clone git@github.com:billsacks/WRF.git + cd WRF + git checkout lilac_dev + +.. note:: + + If the git clone command fails for you as written, then try it this way: + git clone https://github.com/billsacks/WRF.git + +Build WRF + +.. note:: + + 1) If the export commands below fail due to your environment settings, + try replacing them with setenv commands like this: + + setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + setenv MPI_USE_ARRAY None + +.. note:: + + 2) The ./clean -a command is unnecessary the first time you build WRF. + All five lines below become necessary when you modify the WRF code and + need to rebuild. + +.. note:: + + 3) The ./configure step will request two inputs while it runs. + Respond with 15 to the first request and with 1 to the second. + +.. note:: + + 4) The ./compile step takes more than 15 minutes to complete. + +Now that you have read notes 1 to 4, proceed with building WRF:: + + export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + export MPI_USE_ARRAY=None + ./clean -a + ./configure + ./compile em_real > compile.log & + +.. note:: + + Check the bottom of your log file for a successful compilation message + or search the file for the string "Error" with a capital E. + Optional: One may use tmux or nohup for configuring and compiling. + Try "man nohup" for more information. + +.. todo:: + I have not heard of tmux on cheyenne. Is it available? + +Create input namelists for CTSM and LILAC +========================================= + +Introduce the following diffs to ./git_wrf_ctsm/ctsm/lilac/atm_driver/ +by replacing the entries preceded by minus signs with the entries +preceded by plus signs. + +diff ./lilac/atm_driver/atm_driver_in ./lilac/atm_driver/atm_driver_in:: + - atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + - atm_global_nx = 72 + - atm_global_ny = 46 + + atm_mesh_file = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + + atm_global_nx = 199 + + atm_global_ny = 139 + +diff ./lilac/atm_driver/ctsm.cfg ./lilac/atm_driver/ctsm.cfg:: + -configuration = clm + -structure = standard + -clm_bldnml_opts = -bgc sp + -gridmask = gx3v7 + -lnd_grid = 4x5 + -lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc + -lnd_domain_path = /glade/p/cesmdata/cseg/inputdata/share/domains + -clm_namelist_opts = hist_nhtfrq=-24 hist_mfilt=1 hist_ndens=1 + +configuration = nwp + +structure = fast + +clm_bldnml_opts = -bgc sp -clm_usr_name wrf2ctsm + +gridmask = null + +lnd_grid = wrf2ctsm + +lnd_domain_file = domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc + +lnd_domain_path = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files + +clm_namelist_opts = hist_nhtfrq=1 hist_mfilt=1 hist_ndens=1 fsurdat="/glade/work/barlage/ctsm/conus/surfdata_conus/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc" finidat="/glade/scratch/sacks/wrf_code/WRF/test/em_real/nldas_nwp_0109a.clm2.r.2000-04-01-64800.nc" use_init_interp=.true. + +diff ./lilac/atm_driver/lilac_in ./lilac/atm_driver/lilac_in:: + - atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + + atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + + - lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + + lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + +Generate the lnd_in file by running the following from +./git_wrf_ctsm/ctsm/lilac/atm_driver:: + + ../../lilac_config/buildnml + +Copy lilac_in, lnd_in, and lnd_modelio.nml to the WRF/run directory. + .. todo:: - TODO: write this section + Sam skipped starting here + + +Compile and run the WRF Preprocessing System (WPS) +================================================== + +The WRF Preprocessing System (WPS) is a set of programs to prepare input +to the real program for real-data simulations. + +.. todo:: + + Negin, pls explain how to "follow WRF instructions" and what you mean + by "similar way we did" in the next paragraph. + +To compile WPS using your WRF build, follow WRF instructions. +In summary, configure and compile WPS similar way we did. + +Run WPS tools + +.. todo:: + + First reference to the WRF namelist in the next line. We should + specify where that is. + +Edit namelist.wps for your domain of interest, which should be the same +domain as used in your WRF namelist. + +Define the domain and interpolate static geographical data to the grids:: + + ./geogrid.exe >& log.geogrid + +Link in the input GFS data files:: + + ./link_grib.csh path_where_you_placed_GFS_files + +Extract meteorological fields from GRIB-formatted files:: + + ./ungrib.exe + +Horizontally interpolate the metrological fields extracted by ungrib to +the model grids defined in geogrid:: + + ./metgrid.exe >& log.metgrid + +You should now have met_em.d01* files. + +Run real.exe to generate initial and boundary conditions + +Follow WRF instructions for creating initial and boundary +conditions. In summary, complete the following steps: + +Move or link WPS output files (met_em.d01* files) to your WRF/run directory. + +Edit namelist.input for your WRF domain and desirable configurations. +This should be the same domain as in the namelist used in WPS. +To run WRF-CTSM, change land-surface option to 51:: + + sf_surface_physics = 51 + +.. note:: + + sf_surface_physics values for running WRF-Noah and WRF-NoahMP are + 2 and 4, respectively. + +Run real.exe (if compiled parallel submit a batch job) to generate +wrfinput and wrfbdy files. + +.. todo:: + + Sam skipped up to here + +Run WRF +======= + +Place the following in a script that you may name run_wrf_ctsm.csh:: + + #!/bin/tcsh + #PBS -N job_name + #PBS -A + #PBS -l walltime=01:00:00 + #PBS -q regular + #PBS -k eod + + #PBS -l select=2:ncpus=4:mpiprocs=8 + + ml + + ### Set TMPDIR as recommended + setenv TMPDIR /glade/scratch/$USER/temp + mkdir -p $TMPDIR + + + echo "hello" + ### Run the executable + set MPI_SHEPHERD=true + + ln -sf .../WRF/test/em_real/namelist.input.ctsm_test.2013.d01 namelist.input + ln -sf .../WRF/test/em_real/wrfinput_d01.noseaice wrfinput_d01 + ln -sf .../WRF/test/em_real/wrfbdy_d01.6month wrfbdy_d01 + + mpiexec_mpt ./wrf.exe + +where "..." is the path to your WRF directory. + +.. note:: + + 1) Replace + #PBS -l select=2:ncpus=4:mpiprocs=8 + with + #PBS -l select=4:ncpus=36:mpiprocs=36 + to use more processors and run faster. + +Run:: + + qsub run_wrf_ctsm.csh + From e4a29871ae277dcdcd57a178504fa20b7061583b Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 10 Jun 2020 13:46:48 -0600 Subject: [PATCH 0985/1973] add back undercanopy_stability --- src/biogeophys/CanopyFluxesMod.F90 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 43f8a3d3d0..779490fe80 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -987,11 +987,19 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ri = ( grav*htop(p) * (taf(p) - t_grnd(c)) ) / (taf(p) * uaf(p) **2.00_r8) - csoilcn = csoilb*w + params_inst%csoilc*(1._r8-w) - + ! modify csoilc value (0.004) if the under-canopy is in stable condition + if (use_undercanopy_stability .and. (taf(p) - t_grnd(c) ) > 0._r8) then + ! decrease the value of csoilc by dividing it with (1+gamma*min(S, 10.0)) + ! ria ("gmanna" in Sakaguchi&Zeng, 2008) is a constant (=0.5) + ricsoilc = params_inst%csoilc / (1.00_r8 + ria*min( ri, 10.0_r8) ) + csoilcn = csoilb*w + ricsoilc*(1._r8-w) + else + csoilcn = csoilb*w + params_inst%csoilc*(1._r8-w) + end if + !! Sakaguchi changes for stability formulation ends here - if (use_undercanopy_stability) then + if (use_biomass_heat_storage) then ! use uuc for ground fluxes (keep uaf for canopy terms) rah(p,2) = 1._r8/(csoilcn*uuc(p)) else From 3b8da8077b762ed45d1491b74564ef0bbbde3b74 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 10 Jun 2020 14:06:29 -0600 Subject: [PATCH 0986/1973] remove comment --- src/biogeophys/CanopyFluxesMod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 779490fe80..0b43950a11 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1113,8 +1113,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, canopy_cond(p) = (laisun(p)/(rb(p)+rssun(p)) + laisha(p)/(rb(p)+rssha(p)))/max(elai(p), 0.01_r8) end if -! should be the same expression used in Photosynthesis/getqflx -!scs efpot = forc_rho(c)*elai(p)/rb(p)*(qsatl(p)-qaf(p)) efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p)*(qsatl(p)-qaf(p)) h2ocan = liqcan(p) + snocan(p) From d70d7a80a64684f36174372788b667f2e28b9059 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 10 Jun 2020 14:08:28 -0600 Subject: [PATCH 0987/1973] remove more comments --- src/biogeophys/CanopyFluxesMod.F90 | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 0b43950a11..5f3cacf169 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1155,7 +1155,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Moved the original subroutine in-line... wtaq = frac_veg_nosno(p)/raw(p,1) ! air -!scs wtlq = frac_veg_nosno(p)*elai(p)/rb(p) * rpp ! leaf wtlq = frac_veg_nosno(p)*(elai(p)+esai(p))/rb(p) * rpp ! leaf !Litter layer resistance. Added by K.Sakaguchi @@ -1236,7 +1235,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! result in an imbalance in "hvap*qflx_evap_veg" and ! "efe + dc2*wtgaq*qsatdt_veg" -!scs efpot = forc_rho(c)*elai(p)/rb(p) & efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p) & *(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) @@ -1366,17 +1364,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, - lw_leaf(p) + lw_stem(p) - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) & - ((t_veg(p)-tl_ini(p))*cp_leaf(p)/dtime) - !scs -! if (abs(err(p)) > 1e6) then -! write(iulog,*) 'canerrchk: ', lw_leaf(p), lw_stem(p), dt_veg(p) -! write(iulog,*) 'canerrchk: ', (1.-frac_rad_abs_by_stem(p))*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & -! *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd), & -! lw_leaf(p),lw_stem(p),eflx_sh_veg(p),hvap*qflx_evap_veg(p), & -! t_veg(p),tl_ini(p),dt_veg(p),cp_leaf(p),cp_stem(p) -! endif - - - ! Update stem temperature; adjust outgoing longwave ! does not account for changes in SH or internal LW, ! as that would change result for t_veg above From d468d384e0be1f80e733a58f6ae73ceeb1eddcf5 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 10 Jun 2020 14:15:51 -0600 Subject: [PATCH 0988/1973] shift comment --- src/biogeophys/CanopyFluxesMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 5f3cacf169..dce160007d 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1017,7 +1017,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, svpts(p) = el(p) ! pa eah(p) = forc_pbot(c) * qaf(p) / 0.622_r8 ! pa rhaf(p) = eah(p)/svpts(p) -! add history fields + ! variables for history fields rah1(p) = rah(p,1) raw1(p) = raw(p,1) rah2(p) = rah(p,2) From 6e547057ba320360207bb68de7817e06de1f218e Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 10 Jun 2020 14:18:48 -0600 Subject: [PATCH 0989/1973] remove blank lines --- src/main/initGridCellsMod.F90 | 1 - src/main/subgridMod.F90 | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 index 6fd96ed188..565a03e245 100644 --- a/src/main/initGridCellsMod.F90 +++ b/src/main/initGridCellsMod.F90 @@ -71,7 +71,6 @@ subroutine initGridcells(glc_behavior) integer :: nclumps ! number of clumps on this processor type(bounds_type) :: bounds_proc type(bounds_type) :: bounds_clump - !------------------------------------------------------------------------ ! Notes about how this routine is arranged, and its implications for the arrangement diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index 31d9dd585b..8307c440ff 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -73,7 +73,6 @@ subroutine subgrid_get_gcellinfo (gi, glc_behavior, & ! atm_topo is arbitrary for the sake of getting these counts. We don't have a true ! atm_topo value at the point of this call, so use 0. real(r8), parameter :: atm_topo = 0._r8 - !------------------------------------------------------------------------------ npatches = 0 From dd7989623f675b2c994a58560591746601bc5772 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 10 Jun 2020 14:21:27 -0600 Subject: [PATCH 0990/1973] wrap long line --- src/biogeophys/CanopyFluxesMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index dce160007d..b5c183e355 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1472,7 +1472,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Upward longwave radiation above the canopy ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-frac_rad_abs_by_stem(p))*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+frac_rad_abs_by_stem(p)*ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-frac_rad_abs_by_stem(p)) & + *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+frac_rad_abs_by_stem(p)*ts_ini(p)**3*(ts_ini(p) & + + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction From c99427e012eff3b43d05def514b76d837cb8be5a Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 10 Jun 2020 14:30:06 -0600 Subject: [PATCH 0991/1973] activate history fields --- src/biogeophys/EnergyFluxType.F90 | 11 +++++++---- src/biogeophys/TemperatureType.F90 | 12 +++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/biogeophys/EnergyFluxType.F90 b/src/biogeophys/EnergyFluxType.F90 index d58418ccac..07829cc199 100644 --- a/src/biogeophys/EnergyFluxType.F90 +++ b/src/biogeophys/EnergyFluxType.F90 @@ -8,6 +8,7 @@ module EnergyFluxType use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use clm_varcon , only : spval + use clm_varctl , only : use_biomass_heat_storage use decompMod , only : bounds_type use LandunitType , only : lun use ColumnType , only : col @@ -445,10 +446,12 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp) avgflag='A', long_name='sensible heat from stem', & ptr_patch=this%eflx_sh_stem_patch, c2l_scale_type='urbanf',default = 'inactive') - this%dhsdt_canopy_patch(begp:endp) = spval - call hist_addfld1d (fname='DHSDT_CANOPY', units='W/m^2', & - avgflag='A', long_name='change in canopy heat storage', & - ptr_patch=this%dhsdt_canopy_patch, set_lake=0._r8, c2l_scale_type='urbanf',default='inactive') + if (use_biomass_heat_storage) then + this%dhsdt_canopy_patch(begp:endp) = spval + call hist_addfld1d (fname='DHSDT_CANOPY', units='W/m^2', & + avgflag='A', long_name='change in canopy heat storage', & + ptr_patch=this%dhsdt_canopy_patch, set_lake=0._r8, c2l_scale_type='urbanf',default='active') + endif this%eflx_sh_grnd_patch(begp:endp) = spval call hist_addfld1d (fname='FSH_G', units='W/m^2', & diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index de85a68452..bbb028576a 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -7,7 +7,7 @@ module TemperatureType use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use abortutils , only : endrun - use clm_varctl , only : use_cndv, iulog, use_luna, use_crop + use clm_varctl , only : use_cndv, iulog, use_luna, use_crop, use_biomass_heat_storage use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevlak, nlevurb use clm_varcon , only : spval, ispval use GridcellType , only : grc @@ -390,10 +390,12 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) avgflag='A', long_name='Urban daily maximum of average 2-m temperature', & ptr_patch=this%t_ref2m_max_u_patch, set_nourb=spval, default='inactive') - this%t_stem_patch(begp:endp) = spval - call hist_addfld1d (fname='TSTEM', units='K', & - avgflag='A', long_name='stem temperature', & - ptr_patch=this%t_stem_patch, default='inactive') + if (use_biomass_heat_storage) then + this%t_stem_patch(begp:endp) = spval + call hist_addfld1d (fname='TSTEM', units='K', & + avgflag='A', long_name='stem temperature', & + ptr_patch=this%t_stem_patch, default='active') + endif this%t_veg_patch(begp:endp) = spval call hist_addfld1d (fname='TV', units='K', & From 473f1417253348926b94a264c8a852a0b379f779 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 10 Jun 2020 17:33:43 -0600 Subject: [PATCH 0992/1973] Start work on a lilac smoke test The build phase of this works so far. I have tested this by running the test LILACSMOKE_P4x1.f10_f10_musgs.I2000Clm50BgcCropQianRsGs.bishorn_gnu, and also rerunning ./case.build after the initial build completed. --- cime_config/SystemTests/lilacsmoke.py | 70 +++++++++++++++++++++++++++ cime_config/config_tests.xml | 32 +++++++----- 2 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 cime_config/SystemTests/lilacsmoke.py diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py new file mode 100644 index 0000000000..c7b3b3d23b --- /dev/null +++ b/cime_config/SystemTests/lilacsmoke.py @@ -0,0 +1,70 @@ +""" +Implementation of the CIME LILACSMOKE (LILAC smoke) test. + +This is a CTSM-specific test. It tests the building and running of CTSM via LILAC. Grid +and compset are ignored. +""" + +import os + +from CIME.SystemTests.system_tests_common import SystemTestsCommon +from CIME.utils import run_cmd_no_fail, append_testlog +from CIME.build import post_build +from CIME.test_status import GENERATE_PHASE, BASELINE_PHASE, TEST_PASS_STATUS +from CIME.XML.standard_module_setup import * + +logger = logging.getLogger(__name__) + +class LILACSMOKE(SystemTestsCommon): + + def __init__(self, case): + SystemTestsCommon.__init__(self, case) + + def build_phase(self, sharedlib_only=False, model_only=False): + if not sharedlib_only: + caseroot = self._case.get_value('CASEROOT') + lndroot = self._case.get_value('COMP_ROOT_DIR_LND') + exeroot = self._case.get_value('EXEROOT') + build_dir = os.path.join(caseroot, 'lilac_build') + script_path = os.path.abspath(os.path.join(lndroot, 'lilac', 'build_ctsm')) + logs = [] + + # We only run the initial build command if the build_dir doesn't exist + # yet. This is to support rebuilding the test case. (The first time through, + # the build_dir won't exist yet; subsequent times, it will already exist, so + # we skip to the rebuild command.) + if not os.path.isdir(build_dir): + machine = self._case.get_value('MACH') + compiler = self._case.get_value('COMPILER') + # TODO(wjs, 2020-06-10) Add --build-debug if the test is a debug test + cmd = '{script_path} {build_dir} --machine {machine} --compiler {compiler}'.format( + script_path=script_path, + build_dir=build_dir, + machine=machine, + compiler=compiler) + append_testlog(cmd) + run_cmd_no_fail(cmd, arg_stdout='build_ctsm.bldlog', combine_output=True, from_dir=exeroot) + logfile = os.path.join(exeroot, 'build_ctsm.bldlog') + logs.append(logfile) + with open(logfile) as lf: + append_testlog(lf.read()) + + # We call the build script with --rebuild even for an initial build. This is + # so we make sure to test the code path for --rebuild. (This is also needed if + # the user rebuilds the test case, in which case this will be the only command + # run, since the build_dir will already exist.) + cmd = '{script_path} {build_dir} --rebuild'.format( + script_path=script_path, + build_dir=build_dir) + append_testlog(cmd) + run_cmd_no_fail(cmd, arg_stdout='rebuild_ctsm.bldlog', combine_output=True, from_dir=exeroot) + logfile = os.path.join(exeroot, 'rebuild_ctsm.bldlog') + logs.append(logfile) + with open(logfile) as lf: + append_testlog(lf.read()) + + post_build(self._case, logs, build_complete=True) + + def run_phase(self): + # TODO(wjs, 2020-06-10) Fill this in + pass diff --git a/cime_config/config_tests.xml b/cime_config/config_tests.xml index 8a40ea9183..8a933581cf 100644 --- a/cime_config/config_tests.xml +++ b/cime_config/config_tests.xml @@ -1,19 +1,7 @@ @@ -47,6 +35,16 @@ SSP smoke CLM spinup test (only valid for CLM compsets with CLM45) $STOP_N + + CTSM test: Smoke test of building and running CTSM via LILAC. Grid and compset (and most case settings) are ignored. + + 1 + ndays + 11 + FALSE + FALSE + + CLM test: Verify that adding virtual glacier columns doesn't change answers 1 @@ -85,6 +83,14 @@ SSP smoke CLM spinup test (only valid for CLM compsets with CLM45) $STOP_N + + smoke CLM spinup test 1 From b41beb2eda09d3a9ae5947e6d461e334db02915d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 10 Jun 2020 18:33:50 -0600 Subject: [PATCH 0993/1973] Add --build-debug option --- cime_config/SystemTests/lilacsmoke.py | 6 ++++-- python/ctsm/build_ctsm.py | 20 ++++++++++++++++---- python/ctsm/test/test_sys_build_ctsm.py | 3 ++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index c7b3b3d23b..15f9eb908b 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -36,12 +36,14 @@ def build_phase(self, sharedlib_only=False, model_only=False): if not os.path.isdir(build_dir): machine = self._case.get_value('MACH') compiler = self._case.get_value('COMPILER') - # TODO(wjs, 2020-06-10) Add --build-debug if the test is a debug test + debug = self._case.get_value('DEBUG') cmd = '{script_path} {build_dir} --machine {machine} --compiler {compiler}'.format( script_path=script_path, build_dir=build_dir, machine=machine, compiler=compiler) + if debug: + cmd += ' --build-debug' append_testlog(cmd) run_cmd_no_fail(cmd, arg_stdout='build_ctsm.bldlog', combine_output=True, from_dir=exeroot) logfile = os.path.join(exeroot, 'build_ctsm.bldlog') @@ -66,5 +68,5 @@ def build_phase(self, sharedlib_only=False, model_only=False): post_build(self._case, logs, build_complete=True) def run_phase(self): - # TODO(wjs, 2020-06-10) Fill this in + # FIXME(wjs, 2020-06-10) Fill this in pass diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index df9d9edd81..1a5864c4a2 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -64,7 +64,8 @@ def main(cime_path): pio_filesystem_hints=args.pio_filesystem_hints, gptl_nano_timers=args.gptl_nano_timers, extra_fflags=args.extra_fflags, - extra_cflags=args.extra_cflags) + extra_cflags=args.extra_cflags, + build_debug=args.build_debug) def build_ctsm(cime_path, build_dir, @@ -80,7 +81,8 @@ def build_ctsm(cime_path, pio_filesystem_hints=None, gptl_nano_timers=False, extra_fflags='', - extra_cflags=''): + extra_cflags='', + build_debug=False): """Implementation of build_ctsm command Args: @@ -110,6 +112,7 @@ def build_ctsm(cime_path, Ignored if machine is given extra_cflags (str): any extra flags to include when compiling C files Ignored if machine is given + build_debug (bool): if True, build with flags for debugging """ _create_build_dir(build_dir=build_dir, @@ -136,7 +139,8 @@ def build_ctsm(cime_path, _create_case(cime_path=cime_path, build_dir=build_dir, compiler=compiler, - machine=machine) + machine=machine, + build_debug=build_debug) if not no_build: _build_case(build_dir=build_dir) @@ -179,6 +183,7 @@ def _commandline_args(args_to_parse=None): reads args from sys.argv """ # pylint: disable=line-too-long + # pylint: disable=too-many-statements description = """ Script to build CTSM library and its dependencies @@ -245,6 +250,10 @@ def _commandline_args(args_to_parse=None): 'they are not allowed with --rebuild:') non_rebuild_optional_list = [] + non_rebuild_optional.add_argument('--build-debug', action='store_true', + help='Build with flags for debugging rather than production runs') + non_rebuild_optional_list.append('build-debug') + non_rebuild_optional.add_argument('--no-build', action='store_true', help='Do the pre-build setup, but do not actually build CTSM\n' '(This is useful for testing, or for expert use.)') @@ -482,7 +491,7 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_case(cime_path, build_dir, compiler, machine=None): +def _create_case(cime_path, build_dir, compiler, machine=None, build_debug=False): """Create a case that can later be used to build the CTSM library and its dependencies Args: @@ -492,6 +501,7 @@ def _create_case(cime_path, build_dir, compiler, machine=None): machine (str or None): name of machine or None If None, we assume we're using an on-the-fly machine port Otherwise, machine should be the name of a machine known to cime + build_debug (bool): if True, build with flags for debugging """ # Note that, for some commands, we want to suppress output, only showing the output if # the command fails; for these we use run_cmd_output_on_error. For other commands, @@ -528,6 +538,8 @@ def _create_case(cime_path, build_dir, compiler, machine=None): cwd=case_dir) subprocess.check_call([os.path.join(case_dir, 'xmlchange'), 'LILAC_MODE=on'], cwd=case_dir) + if build_debug: + subprocess.check_call([os.path.join(case_dir, 'xmlchange'), 'DEBUG=TRUE'], cwd=case_dir) make_link(os.path.join(case_dir, 'bld'), os.path.join(build_dir, 'bld')) diff --git a/python/ctsm/test/test_sys_build_ctsm.py b/python/ctsm/test/test_sys_build_ctsm.py index a0b62eae18..cfae22cd87 100755 --- a/python/ctsm/test/test_sys_build_ctsm.py +++ b/python/ctsm/test/test_sys_build_ctsm.py @@ -72,7 +72,8 @@ def test_buildSetup_userDefinedMachine_allInfo(self): pio_filesystem_hints='gpfs', gptl_nano_timers=True, extra_fflags='-foo', - extra_cflags='-bar') + extra_cflags='-bar', + build_debug=True) # no assertions: test passes as long as the command doesn't generate any errors if __name__ == '__main__': From e71b8d621d7e574c8033eb7885e2c47337213a38 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 10 Jun 2020 18:49:27 -0600 Subject: [PATCH 0994/1973] Build with threading support by default, but allow turning it off --- python/ctsm/build_ctsm.py | 27 +++++++++++++++++++------ python/ctsm/test/test_sys_build_ctsm.py | 3 ++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 1a5864c4a2..84aeb888fa 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -65,7 +65,8 @@ def main(cime_path): gptl_nano_timers=args.gptl_nano_timers, extra_fflags=args.extra_fflags, extra_cflags=args.extra_cflags, - build_debug=args.build_debug) + build_debug=args.build_debug, + build_without_openmp=args.build_without_openmp) def build_ctsm(cime_path, build_dir, @@ -82,7 +83,8 @@ def build_ctsm(cime_path, gptl_nano_timers=False, extra_fflags='', extra_cflags='', - build_debug=False): + build_debug=False, + build_without_openmp=False): """Implementation of build_ctsm command Args: @@ -113,6 +115,7 @@ def build_ctsm(cime_path, extra_cflags (str): any extra flags to include when compiling C files Ignored if machine is given build_debug (bool): if True, build with flags for debugging + build_without_openmp (bool): if True, build without OpenMP support """ _create_build_dir(build_dir=build_dir, @@ -140,7 +143,8 @@ def build_ctsm(cime_path, build_dir=build_dir, compiler=compiler, machine=machine, - build_debug=build_debug) + build_debug=build_debug, + build_without_openmp=build_without_openmp) if not no_build: _build_case(build_dir=build_dir) @@ -254,6 +258,12 @@ def _commandline_args(args_to_parse=None): help='Build with flags for debugging rather than production runs') non_rebuild_optional_list.append('build-debug') + non_rebuild_optional.add_argument('--build-without-openmp', action='store_true', + help='By default, CTSM is built with support for OpenMP threading;\n' + 'if this flag is set, then CTSM is built without this support.\n' + 'This is mainly useful if your machine/compiler does not support OpenMP.') + non_rebuild_optional_list.append('build-without-openmp') + non_rebuild_optional.add_argument('--no-build', action='store_true', help='Do the pre-build setup, but do not actually build CTSM\n' '(This is useful for testing, or for expert use.)') @@ -491,7 +501,8 @@ def _fill_out_machine_files(build_dir, 'w') as cc_file: cc_file.write(config_compilers) -def _create_case(cime_path, build_dir, compiler, machine=None, build_debug=False): +def _create_case(cime_path, build_dir, compiler, + machine=None, build_debug=False, build_without_openmp=False): """Create a case that can later be used to build the CTSM library and its dependencies Args: @@ -502,6 +513,7 @@ def _create_case(cime_path, build_dir, compiler, machine=None, build_debug=False If None, we assume we're using an on-the-fly machine port Otherwise, machine should be the name of a machine known to cime build_debug (bool): if True, build with flags for debugging + build_without_openmp (bool): if True, build without OpenMP support """ # Note that, for some commands, we want to suppress output, only showing the output if # the command fails; for these we use run_cmd_output_on_error. For other commands, @@ -514,6 +526,7 @@ def _create_case(cime_path, build_dir, compiler, machine=None, build_debug=False # require you to be in the case directory when you execute them. case_dir = _get_case_dir(build_dir) + xmlchange = os.path.join(case_dir, 'xmlchange') if machine is None: machine_args = ['--machine', _MACH_NAME, @@ -537,9 +550,11 @@ def _create_case(cime_path, build_dir, compiler, machine=None, build_debug=False errmsg='Problem setting up CTSM case directory', cwd=case_dir) - subprocess.check_call([os.path.join(case_dir, 'xmlchange'), 'LILAC_MODE=on'], cwd=case_dir) + subprocess.check_call([xmlchange, 'LILAC_MODE=on'], cwd=case_dir) if build_debug: - subprocess.check_call([os.path.join(case_dir, 'xmlchange'), 'DEBUG=TRUE'], cwd=case_dir) + subprocess.check_call([xmlchange, 'DEBUG=TRUE'], cwd=case_dir) + if not build_without_openmp: + subprocess.check_call([xmlchange, 'FORCE_BUILD_SMP=TRUE'], cwd=case_dir) make_link(os.path.join(case_dir, 'bld'), os.path.join(build_dir, 'bld')) diff --git a/python/ctsm/test/test_sys_build_ctsm.py b/python/ctsm/test/test_sys_build_ctsm.py index cfae22cd87..f0bc42f0ef 100755 --- a/python/ctsm/test/test_sys_build_ctsm.py +++ b/python/ctsm/test/test_sys_build_ctsm.py @@ -73,7 +73,8 @@ def test_buildSetup_userDefinedMachine_allInfo(self): gptl_nano_timers=True, extra_fflags='-foo', extra_cflags='-bar', - build_debug=True) + build_debug=True, + build_without_openmp=True) # no assertions: test passes as long as the command doesn't generate any errors if __name__ == '__main__': From a7103b795b7b43c056721d0751d0a969731b0b4f Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 11 Jun 2020 00:02:03 -0600 Subject: [PATCH 0995/1973] Change to wrf.rst recommended by @billsacks --- doc/source/lilac/specific-atm-models/wrf.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 0cc1f01b67..f6fb328f60 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -122,7 +122,10 @@ Introduce the following diffs to ./git_wrf_ctsm/ctsm/lilac/atm_driver/ by replacing the entries preceded by minus signs with the entries preceded by plus signs. -diff ./lilac/atm_driver/atm_driver_in ./lilac/atm_driver/atm_driver_in:: +diff ./lilac/atm_driver/atm_driver_in ./lilac/atm_driver/atm_driver_in: + +.. code-block:: diff + - atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - atm_global_nx = 72 - atm_global_ny = 46 @@ -130,7 +133,10 @@ diff ./lilac/atm_driver/atm_driver_in ./lilac/atm_driver/atm_driver_in:: + atm_global_nx = 199 + atm_global_ny = 139 -diff ./lilac/atm_driver/ctsm.cfg ./lilac/atm_driver/ctsm.cfg:: +diff ./lilac/atm_driver/ctsm.cfg ./lilac/atm_driver/ctsm.cfg: + +.. code-block:: diff + -configuration = clm -structure = standard -clm_bldnml_opts = -bgc sp @@ -148,7 +154,10 @@ diff ./lilac/atm_driver/ctsm.cfg ./lilac/atm_driver/ctsm.cfg:: +lnd_domain_path = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files +clm_namelist_opts = hist_nhtfrq=1 hist_mfilt=1 hist_ndens=1 fsurdat="/glade/work/barlage/ctsm/conus/surfdata_conus/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc" finidat="/glade/scratch/sacks/wrf_code/WRF/test/em_real/nldas_nwp_0109a.clm2.r.2000-04-01-64800.nc" use_init_interp=.true. -diff ./lilac/atm_driver/lilac_in ./lilac/atm_driver/lilac_in:: +diff ./lilac/atm_driver/lilac_in ./lilac/atm_driver/lilac_in: + +.. code-block:: diff + - atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' From ce5661c3c9b02c81da11ad63a3062999ca5ea717 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 11 Jun 2020 03:12:49 -0600 Subject: [PATCH 0996/1973] Adding instructions for running WRF with CTSM up to WPS --- doc/source/lilac/specific-atm-models/wrf.rst | 119 +++++++++++++++---- 1 file changed, 94 insertions(+), 25 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index f6fb328f60..8d8b1da338 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -19,6 +19,15 @@ from earlier sections but in recipe form and with minimal detail. Preparing the CTSM ================== +.. todo:: + + I think we don't need some of the following since too much instructions + are usually more confusing... + I tried removing incorrect or redundant information. + + For example, people who do not use cheyenne might get confused by the + following commands on scratch. + Decide where you will work, for example:: cd /glade/scratch/$USER @@ -30,6 +39,7 @@ Decide where you will work, for example:: Discs other than /glade/scratch may provide insufficient space for output from simulations longer than one or two months. + Obtain CTSM by running:: git clone https://github.com/ESCOMP/ctsm.git @@ -37,20 +47,20 @@ Obtain CTSM by running:: git checkout lilac_cap ./manage_externals/checkout_externals -v -Build CTSM and its dependencies:: +Build CTSM and its dependencies, for example for cheyenne:: ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne -Run:: + +Set environment similar to environments used for your CTSM build for bash:: source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh -.. note:: +or Cshell:: - If the previous command fails due to your environment settings, - try this one instead: source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh + .. note:: For additional details on preparing the CTSM, including how to @@ -59,10 +69,12 @@ Run:: Preparing the WRF model ======================= +.. todo:: + + update the git address to WRF feature branch... Obtain WRF by running:: - cd /glade/scratch/$USER/git_wrf_ctsm git clone git@github.com:billsacks/WRF.git cd WRF git checkout lilac_dev @@ -72,8 +84,21 @@ Obtain WRF by running:: If the git clone command fails for you as written, then try it this way: git clone https://github.com/billsacks/WRF.git +.. todo:: + + Sam, I think comments like the above are too trivial and make things more confusing... + + Build WRF + +.. todo:: + + Sam, while I think some of the notes below are useful such as number (4), + I believe some of the notes mentioned below such as number (1) is too trivial + and make our instructions less professional. + I tried integrating this into our instructions for example for bash vs. Cshell. + .. note:: 1) If the export commands below fail due to your environment settings, @@ -95,26 +120,50 @@ Build WRF .. note:: - 4) The ./compile step takes more than 15 minutes to complete. + 4) The ./compile step might take more than 30 minutes to complete. -Now that you have read notes 1 to 4, proceed with building WRF:: + + +For building WRF using CTSM, we should set makefile variables needed for WRF build by:: export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + +or:: + + setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + + +The following is needed in order to undo an undesired setting in that env_mach_specific file:: + export MPI_USE_ARRAY=None + +or:: + + setenv MPI_USE_ARRAY None + + +Then configure and build WRF for your machine and intended compiler by:: + ./clean -a ./configure - ./compile em_real > compile.log & + +Choose one of the options, similar to the compiler used for building CTSM. + +Next, choose one of the options for nesting. Currently nesting is not available for WRF-CTSM, +therefore we should use 1:: + + ./compile em_real >& compile.log .. note:: Check the bottom of your log file for a successful compilation message or search the file for the string "Error" with a capital E. + +.. note:: + Optional: One may use tmux or nohup for configuring and compiling. Try "man nohup" for more information. -.. todo:: - I have not heard of tmux on cheyenne. Is it available? - Create input namelists for CTSM and LILAC ========================================= @@ -171,31 +220,51 @@ Generate the lnd_in file by running the following from Copy lilac_in, lnd_in, and lnd_modelio.nml to the WRF/run directory. -.. todo:: - - Sam skipped starting here -Compile and run the WRF Preprocessing System (WPS) +Compile WRF Preprocessing System (WPS) ================================================== -The WRF Preprocessing System (WPS) is a set of programs to prepare input -to the real program for real-data simulations. +The WRF Preprocessing System (WPS) is a set of programs to prepare +input to the real program for WRF real-data simulations. -.. todo:: +.. note:: + Building WPS requires that WRF be already built successfully. + + +Get WPS zipped tar file from: +http://www2.mmm.ucar.edu/wrf/users/download/get_source.html + +Untar WPS tar file:: + + gzip -cd WPSV4.0.TAR.gz | tar -xf - + + +Then we should compile WPS similar to the way we build WRF. In summary:: - Negin, pls explain how to "follow WRF instructions" and what you mean - by "similar way we did" in the next paragraph. + cd WPS + ./configure + +Here choose one option, for your intended compiler, similar to your WRF build. +After configuring, you can check configure.wps for making sure all the libs and paths +are set correctly. + + +Then, compile WPS:: + ./compile >& compile.log + +.. note:: + If wps build is succsfully you should see geogrid.exe, ungrib.exe, and metgrid.exe. + +Run WRF Preprocessing System (WPS) Steps +================================================== -To compile WPS using your WRF build, follow WRF instructions. -In summary, configure and compile WPS similar way we did. -Run WPS tools .. todo:: First reference to the WRF namelist in the next line. We should - specify where that is. + specify where that is. Edit namelist.wps for your domain of interest, which should be the same domain as used in your WRF namelist. From caabffbb0110d357f190ff38bba45cc4fab53564 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Thu, 11 Jun 2020 12:21:38 -0600 Subject: [PATCH 0997/1973] Sixth round of moving parameters to param file. BFB according to the following tests: ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive ERS_D_Ld6.f10_f10_musgs.I1850Clm45BgcCrop.cheyenne_intel.clm-clm50CMIP6frc clm_short test suite Parameters moved: wind_min (was hardcoded as 1.0 in CanopyFluxesMod.F90, LakeFluxesMod.F90, BareGroundFluxesMod.F90, UrbanFluxesMod.F90) bsw_adjustfactor, hksat_adjustfactor, sucsat_adjustfactor, watsat_adjustfactor are now also applied to soil beneath lakes --- src/biogeophys/BareGroundFluxesMod.F90 | 9 ++++--- src/biogeophys/CanopyFluxesMod.F90 | 17 +++++++----- src/biogeophys/LakeFluxesMod.F90 | 11 +++++--- src/biogeophys/SoilStateInitTimeConstMod.F90 | 12 ++++++--- src/biogeophys/UrbanFluxesMod.F90 | 28 +++++++++++++++++++- src/main/readParamsMod.F90 | 2 ++ 6 files changed, 60 insertions(+), 19 deletions(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index 2fe427efdf..faf6e425b7 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -33,8 +33,9 @@ module BareGroundFluxesMod public :: readParams type, private :: params_type - real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless) - real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless) + real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless) + real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless) + real(r8) :: wind_min ! Minimum wind speed at the atmospheric forcing height (m/s) end type params_type type(params_type), private :: params_inst !------------------------------------------------------------------------------ @@ -60,6 +61,8 @@ subroutine readParams( ncid ) call readNcdioScalar(ncid, 'a_coef', subname, params_inst%a_coef) ! Drag exponent under less dense canopy (unitless) call readNcdioScalar(ncid, 'a_exp', subname, params_inst%a_exp) + ! Minimum wind speed at the atmospheric forcing height (m/s) + call readNcdioScalar(ncid, 'wind_min', subname, params_inst%wind_min) end subroutine readParams @@ -287,7 +290,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & dlrad(p) = 0._r8 ulrad(p) = 0._r8 - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) + ur(p) = max(params_inst%wind_min,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) dth(p) = thm(p)-t_grnd(c) dqh(p) = forc_q(c) - qg(c) dthv = dth(p)*(1._r8+0.61_r8*forc_q(c))+0.61_r8*forc_th(c)*dqh(p) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 25125eb071..7233683c89 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -59,12 +59,13 @@ module CanopyFluxesMod public :: readParams type, private :: params_type - real(r8) :: lai_dl ! Plant litter area index (m2/m2) - real(r8) :: z_dl ! Litter layer thickness (m) - real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless) - real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless) - real(r8) :: csoilc ! Soil drag coefficient under dense canopy (unitless) - real(r8) :: cv ! Turbulent transfer coeff. between canopy surface and canopy air (m/s^(1/2)) + real(r8) :: lai_dl ! Plant litter area index (m2/m2) + real(r8) :: z_dl ! Litter layer thickness (m) + real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless) + real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless) + real(r8) :: csoilc ! Soil drag coefficient under dense canopy (unitless) + real(r8) :: cv ! Turbulent transfer coeff. between canopy surface and canopy air (m/s^(1/2)) + real(r8) :: wind_min ! Minimum wind speed at the atmospheric forcing height (m/s) end type params_type type(params_type), private :: params_inst ! @@ -177,6 +178,8 @@ subroutine readParams( ncid ) call readNcdioScalar(ncid, 'csoilc', subname, params_inst%csoilc) ! Turbulent transfer coeff between canopy surface and canopy air (m/s^(1/2)) call readNcdioScalar(ncid, 'cv', subname, params_inst%cv) + ! Minimum wind speed at the atmospheric forcing height (m/s) + call readNcdioScalar(ncid, 'wind_min', subname, params_inst%wind_min) end subroutine readParams @@ -756,7 +759,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, taf(p) = (t_grnd(c) + thm(p))/2._r8 qaf(p) = (forc_q(c)+qg(c))/2._r8 - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) + ur(p) = max(params_inst%wind_min,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) dth(p) = thm(p)-taf(p) dqh(p) = forc_q(c)-qaf(p) delq(p) = qg(c) - qaf(p) diff --git a/src/biogeophys/LakeFluxesMod.F90 b/src/biogeophys/LakeFluxesMod.F90 index db83ec9286..63633fe93c 100644 --- a/src/biogeophys/LakeFluxesMod.F90 +++ b/src/biogeophys/LakeFluxesMod.F90 @@ -34,9 +34,10 @@ module LakeFluxesMod public :: readParams type, private :: params_type - real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless) - real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless) - real(r8) :: zsno ! Momentum roughness length for snow (m) + real(r8) :: a_coef ! Drag coefficient under less dense canopy (unitless) + real(r8) :: a_exp ! Drag exponent under less dense canopy (unitless) + real(r8) :: zsno ! Momentum roughness length for snow (m) + real(r8) :: wind_min ! Minimum wind speed at the atmospheric forcing height (m/s) end type params_type type(params_type), private :: params_inst !----------------------------------------------------------------------- @@ -63,6 +64,8 @@ subroutine readParams( ncid ) call readNcdioScalar(ncid, 'a_exp', subname, params_inst%a_exp) ! Momentum roughness length for snow (m) call readNcdioScalar(ncid, 'zsno', subname, params_inst%zsno) + ! Minimum wind speed at the atmospheric forcing height (m/s) + call readNcdioScalar(ncid, 'wind_min', subname, params_inst%wind_min) end subroutine readParams @@ -392,7 +395,7 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, ! Initialize stability variables - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) + ur(p) = max(params_inst%wind_min,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) dth(p) = thm(p)-t_grnd(c) dqh(p) = forc_q(c)-qsatg(c) dthv = dth(p)*(1._r8+0.61_r8*forc_q(c))+0.61_r8*forc_th(c)*dqh(p) diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 index 1da04f21ec..414a8b6f16 100644 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ b/src/biogeophys/SoilStateInitTimeConstMod.F90 @@ -601,14 +601,17 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) bd = (1._r8-soilstate_inst%watsat_col(c,lev))*params_inst%pd - soilstate_inst%watsat_col(c,lev) = (1._r8 - om_frac)*soilstate_inst%watsat_col(c,lev) + om_watsat_lake * om_frac + soilstate_inst%watsat_col(c,lev) = params_inst%watsat_adjustfactor * ( (1._r8 - om_frac) * & + soilstate_inst%watsat_col(c,lev) + om_watsat_lake * om_frac ) tkm = (1._r8-om_frac)*(params_inst%tkd_sand*sand+params_inst%tkd_clay*clay)/(sand+clay) + & params_inst%tkm_om * om_frac ! W/(m K) - soilstate_inst%bsw_col(c,lev) = (1._r8-om_frac)*(2.91_r8 + 0.159_r8*clay) + om_frac * om_b_lake + soilstate_inst%bsw_col(c,lev) = params_inst%bsw_adjustfactor * ( (1._r8-om_frac) * & + (2.91_r8 + 0.159_r8*clay) + om_frac * om_b_lake ) - soilstate_inst%sucsat_col(c,lev) = (1._r8-om_frac)*soilstate_inst%sucsat_col(c,lev) + om_sucsat_lake * om_frac + soilstate_inst%sucsat_col(c,lev) = params_inst%sucsat_adjustfactor * ( (1._r8-om_frac) * & + soilstate_inst%sucsat_col(c,lev) + om_sucsat_lake * om_frac ) xksat = 0.0070556 *( 10.**(-0.884+0.0153*sand) ) ! mm/s @@ -631,7 +634,8 @@ subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) uncon_hksat = 0._r8 end if - soilstate_inst%hksat_col(c,lev) = uncon_frac*uncon_hksat + (perc_frac*om_frac)*om_hksat_lake + soilstate_inst%hksat_col(c,lev) = params_inst%hksat_adjustfactor * ( uncon_frac*uncon_hksat + & + (perc_frac*om_frac)*om_hksat_lake ) soilstate_inst%tkmg_col(c,lev) = tkm ** (1._r8- soilstate_inst%watsat_col(c,lev)) soilstate_inst%tksatu_col(c,lev) = soilstate_inst%tkmg_col(c,lev)*0.57_r8**soilstate_inst%watsat_col(c,lev) soilstate_inst%tkdry_col(c,lev) = ((0.135_r8*bd + 64.7_r8) / (params_inst%pd - 0.947_r8*bd))*(1._r8-om_frac) + & diff --git a/src/biogeophys/UrbanFluxesMod.F90 b/src/biogeophys/UrbanFluxesMod.F90 index 5bbe89eece..23a687c158 100644 --- a/src/biogeophys/UrbanFluxesMod.F90 +++ b/src/biogeophys/UrbanFluxesMod.F90 @@ -38,6 +38,7 @@ module UrbanFluxesMod ! ! !PUBLIC MEMBER FUNCTIONS: public :: UrbanFluxes ! Urban physics - turbulent fluxes + public :: readParams !----------------------------------------------------------------------- ! !PRIVATE FUNCTIONS: @@ -45,11 +46,36 @@ module UrbanFluxesMod private :: simple_wasteheatfromac ! Calculate waste heat from air-conditioning with the simpler method (CLM4.5) private :: calc_simple_internal_building_temp ! Calculate internal building temperature by simpler method (CLM4.5) + type, private :: params_type + real(r8) :: wind_min ! Minimum wind speed at the atmospheric forcing height (m/s) + end type params_type + type(params_type), private :: params_inst + character(len=*), parameter, private :: sourcefile = & __FILE__ contains + !------------------------------------------------------------------------------ + subroutine readParams( ncid ) + ! + ! !USES: + use ncdio_pio, only: file_desc_t + use paramUtilMod, only: readNcdioScalar + ! + ! !ARGUMENTS: + implicit none + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=*), parameter :: subname = 'readParams_UrbanFluxes' + !-------------------------------------------------------------------- + + ! Minimum wind speed at the atmospheric forcing height (m/s) + call readNcdioScalar(ncid, 'wind_min', subname, params_inst%wind_min) + + end subroutine readParams + !----------------------------------------------------------------------- subroutine UrbanFluxes (bounds, num_nourbanl, filter_nourbanl, & num_urbanl, filter_urbanl, num_urbanc, filter_urbanc, num_urbanp, filter_urbanp, & @@ -348,7 +374,7 @@ subroutine UrbanFluxes (bounds, num_nourbanl, filter_nourbanl, ! Magnitude of atmospheric wind - ur(l) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) + ur(l) = max(params_inst%wind_min,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) ! Canyon top wind diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index 74a7c14d16..ae1b089ea0 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -45,6 +45,7 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) use BareGroundFluxesMod , only : readParams_BareGroundFluxes => readParams use LakeFluxesMod , only : readParams_LakeFluxes => readParams use CanopyFluxesMod , only : readParams_CanopyFluxes => readParams + use UrbanFluxesMod , only : readParams_UrbanFluxes => readParams use CanopyHydrologyMod , only : readParams_CanopyHydrology => readParams use SoilHydrologyMod , only : readParams_SoilHydrology => readParams use SoilStateInitTimeConstMod , only : readParams_SoilStateInitTimeConst => readParams @@ -116,6 +117,7 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) call readParams_BareGroundFluxes ( ncid ) call readParams_LakeFluxes ( ncid ) call readParams_CanopyFluxes ( ncid ) + call readParams_UrbanFluxes ( ncid ) call readParams_CanopyHydrology ( ncid ) call readParams_SoilHydrology ( ncid ) call readParams_SoilStateInitTimeConst ( ncid ) From c797df33cd64c792a86d1edca31ac6e991222419 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 11 Jun 2020 13:14:41 -0600 Subject: [PATCH 0998/1973] Minor rework of lilacsmoke test Get it passing on my mac (needs --build-without-openmp) and a bit of refactoring --- cime_config/SystemTests/lilacsmoke.py | 43 ++++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index 15f9eb908b..946b439707 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -27,7 +27,6 @@ def build_phase(self, sharedlib_only=False, model_only=False): exeroot = self._case.get_value('EXEROOT') build_dir = os.path.join(caseroot, 'lilac_build') script_path = os.path.abspath(os.path.join(lndroot, 'lilac', 'build_ctsm')) - logs = [] # We only run the initial build command if the build_dir doesn't exist # yet. This is to support rebuilding the test case. (The first time through, @@ -37,6 +36,10 @@ def build_phase(self, sharedlib_only=False, model_only=False): machine = self._case.get_value('MACH') compiler = self._case.get_value('COMPILER') debug = self._case.get_value('DEBUG') + # It would be possible to do this testing via the python interface rather + # than through a separate subprocess. However, we do it through a + # subprocess in order to test the full build_ctsm script, including + # command-line parsing. cmd = '{script_path} {build_dir} --machine {machine} --compiler {compiler}'.format( script_path=script_path, build_dir=build_dir, @@ -44,12 +47,11 @@ def build_phase(self, sharedlib_only=False, model_only=False): compiler=compiler) if debug: cmd += ' --build-debug' - append_testlog(cmd) - run_cmd_no_fail(cmd, arg_stdout='build_ctsm.bldlog', combine_output=True, from_dir=exeroot) - logfile = os.path.join(exeroot, 'build_ctsm.bldlog') - logs.append(logfile) - with open(logfile) as lf: - append_testlog(lf.read()) + # For now, always build this test without threads: it doesn't need + # threads, and building unthreaded ensures that it works on a wider range + # of machines/compilers + cmd += ' --build-without-openmp' + self._run_build_cmd(cmd, exeroot, 'build_ctsm.bldlog') # We call the build script with --rebuild even for an initial build. This is # so we make sure to test the code path for --rebuild. (This is also needed if @@ -58,15 +60,28 @@ def build_phase(self, sharedlib_only=False, model_only=False): cmd = '{script_path} {build_dir} --rebuild'.format( script_path=script_path, build_dir=build_dir) - append_testlog(cmd) - run_cmd_no_fail(cmd, arg_stdout='rebuild_ctsm.bldlog', combine_output=True, from_dir=exeroot) - logfile = os.path.join(exeroot, 'rebuild_ctsm.bldlog') - logs.append(logfile) - with open(logfile) as lf: - append_testlog(lf.read()) + self._run_build_cmd(cmd, exeroot, 'rebuild_ctsm.bldlog') - post_build(self._case, logs, build_complete=True) + # Setting logs=[] implies that we don't bother gzipping any of the build log + # files; that seems fine for these purposes (and it keeps the above code + # simpler). + post_build(self._case, logs=[], build_complete=True) def run_phase(self): # FIXME(wjs, 2020-06-10) Fill this in pass + + @staticmethod + def _run_build_cmd(cmd, exeroot, logfile): + """ + Runs the given build command, with output to the given logfile + + Args: + cmd: str (command to run) + exeroot: str (path to exeroot) + logfile: str (path to logfile) + """ + append_testlog(cmd) + run_cmd_no_fail(cmd, arg_stdout=logfile, combine_output=True, from_dir=exeroot) + with open(os.path.join(exeroot, logfile)) as lf: + append_testlog(lf.read()) From 5866c989f9de00162da52521f9138ef206cd50a4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 11 Jun 2020 13:51:35 -0600 Subject: [PATCH 0999/1973] Move build templates I'm going to put other templates in here as well. This feels like a more appropriate location than lilac_config: it keeps files closer to the scripts / code that need them. --- .../bld_templates}/config_compilers_template.xml | 0 .../bld_templates}/config_machines_template.xml | 0 python/ctsm/build_ctsm.py | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename {lilac_config/build_templates => lilac/bld_templates}/config_compilers_template.xml (100%) rename {lilac_config/build_templates => lilac/bld_templates}/config_machines_template.xml (100%) diff --git a/lilac_config/build_templates/config_compilers_template.xml b/lilac/bld_templates/config_compilers_template.xml similarity index 100% rename from lilac_config/build_templates/config_compilers_template.xml rename to lilac/bld_templates/config_compilers_template.xml diff --git a/lilac_config/build_templates/config_machines_template.xml b/lilac/bld_templates/config_machines_template.xml similarity index 100% rename from lilac_config/build_templates/config_machines_template.xml rename to lilac/bld_templates/config_machines_template.xml diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 84aeb888fa..48b0c13c6d 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -443,8 +443,8 @@ def _fill_out_machine_files(build_dir, For documentation of args, see the documentation in the build_ctsm function """ path_to_templates = os.path.join(path_to_ctsm_root(), - 'lilac_config', - 'build_templates') + 'lilac', + 'bld_templates') os.makedirs(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME)) # ------------------------------------------------------------------------ From 0f3b19b78e1142b36820d0734175568ae764889b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 11 Jun 2020 14:17:43 -0600 Subject: [PATCH 1000/1973] Move lilac namelist files I want to keep all of these in bld_templates. --- lilac/{atm_driver => bld_templates}/atm_driver_in | 0 lilac/{atm_driver => bld_templates}/ctsm.cfg | 0 lilac/{atm_driver => bld_templates}/lilac_in | 0 lilac/{atm_driver => bld_templates}/lnd_modelio.nml | 0 lilac/{atm_driver => bld_templates}/mosart_in | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename lilac/{atm_driver => bld_templates}/atm_driver_in (100%) rename lilac/{atm_driver => bld_templates}/ctsm.cfg (100%) rename lilac/{atm_driver => bld_templates}/lilac_in (100%) rename lilac/{atm_driver => bld_templates}/lnd_modelio.nml (100%) rename lilac/{atm_driver => bld_templates}/mosart_in (100%) diff --git a/lilac/atm_driver/atm_driver_in b/lilac/bld_templates/atm_driver_in similarity index 100% rename from lilac/atm_driver/atm_driver_in rename to lilac/bld_templates/atm_driver_in diff --git a/lilac/atm_driver/ctsm.cfg b/lilac/bld_templates/ctsm.cfg similarity index 100% rename from lilac/atm_driver/ctsm.cfg rename to lilac/bld_templates/ctsm.cfg diff --git a/lilac/atm_driver/lilac_in b/lilac/bld_templates/lilac_in similarity index 100% rename from lilac/atm_driver/lilac_in rename to lilac/bld_templates/lilac_in diff --git a/lilac/atm_driver/lnd_modelio.nml b/lilac/bld_templates/lnd_modelio.nml similarity index 100% rename from lilac/atm_driver/lnd_modelio.nml rename to lilac/bld_templates/lnd_modelio.nml diff --git a/lilac/atm_driver/mosart_in b/lilac/bld_templates/mosart_in similarity index 100% rename from lilac/atm_driver/mosart_in rename to lilac/bld_templates/mosart_in From 3013af3e9fde1d6aa5c08eb1a8d934345fe5fc7d Mon Sep 17 00:00:00 2001 From: Chris Fischer Date: Thu, 11 Jun 2020 17:14:57 -0600 Subject: [PATCH 1001/1973] Rename aux_clm1 back to aux_clm --- cime_config/testdefs/testlist_clm.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 26860d84a8..70aa5c6af2 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1142,7 +1142,7 @@ - + @@ -1151,7 +1151,7 @@ - + @@ -1160,7 +1160,7 @@ - + @@ -1169,7 +1169,7 @@ - + @@ -1178,7 +1178,7 @@ - + From 8d0bf1b06d30224ef7b909590c8cf40e1da1d8ca Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 11 Jun 2020 18:12:41 -0600 Subject: [PATCH 1002/1973] Start work on staging runtime inputs --- lilac/bld_templates/ctsm.cfg | 22 ------ lilac/bld_templates/ctsm_template.cfg | 17 +++++ python/ctsm/build_ctsm.py | 103 +++++++++++++++++--------- python/ctsm/test/test_unit_utils.py | 57 ++++++++++++++ python/ctsm/utils.py | 18 +++++ 5 files changed, 162 insertions(+), 55 deletions(-) delete mode 100644 lilac/bld_templates/ctsm.cfg create mode 100644 lilac/bld_templates/ctsm_template.cfg create mode 100755 python/ctsm/test/test_unit_utils.py diff --git a/lilac/bld_templates/ctsm.cfg b/lilac/bld_templates/ctsm.cfg deleted file mode 100644 index 3bea08674f..0000000000 --- a/lilac/bld_templates/ctsm.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[buildnml_input] -clm_phys = clm5_0 -start_type = default -start_ymd = 20000101 -configuration = clm -structure = standard -ccsm_co2_ppmv = 367.0 -clm_co2_type = constant -clm_bldnml_opts = -bgc sp -use_case = 2000_control -lnd_tuning_mode = clm5_0_GSWP3v1 -spinup = off -gridmask = gx3v7 -lnd_grid = 4x5 -lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc -lnd_domain_path = /glade/p/cesmdata/cseg/inputdata/share/domains -din_loc_root = /glade/p/cesmdata/cseg/inputdata -# clm_namelist_opts can contain space-separated settings of individual namelist variables; -# this should NOT be enclosed in quotes; example: -# clm_namelist_opts = foo=1 bar=2 -# The current setting is useful for testing (giving double-precision output every day) -clm_namelist_opts = hist_nhtfrq=-24 hist_mfilt=1 hist_ndens=1 diff --git a/lilac/bld_templates/ctsm_template.cfg b/lilac/bld_templates/ctsm_template.cfg new file mode 100644 index 0000000000..5e9d9379cd --- /dev/null +++ b/lilac/bld_templates/ctsm_template.cfg @@ -0,0 +1,17 @@ +[buildnml_input] +clm_phys = clm5_0 +start_type = default +start_ymd = 20000101 +configuration = nwp +structure = fast +ccsm_co2_ppmv = 367.0 +clm_co2_type = constant +clm_bldnml_opts = -clm_usr_name lilac -bgc sp +use_case = 2000_control +lnd_tuning_mode = clm5_0_GSWP3v1 +spinup = off +gridmask = null +lnd_grid = lilac +lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc +lnd_domain_path = $INPUTDATA/share/domains +din_loc_root = $INPUTDATA diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 48b0c13c6d..6d77374149 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -3,13 +3,12 @@ import argparse import logging import os -import string import subprocess from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args from ctsm.os_utils import run_cmd_output_on_error, make_link from ctsm.path_utils import path_to_ctsm_root -from ctsm.utils import abort +from ctsm.utils import abort, fill_template_file logger = logging.getLogger(__name__) @@ -25,8 +24,14 @@ _COMPSET = 'I2000Ctsm50NwpSpNldasRsGs' _RES = 'nldas2_rnldas2_mnldas2' +_PATH_TO_TEMPLATES = os.path.join(path_to_ctsm_root(), + 'lilac', + 'bld_templates') + _MACHINE_CONFIG_DIRNAME = 'machine_configuration' _INPUTDATA_DIRNAME = 'inputdata' +_RUNTIME_INPUTS_DIRNAME = 'runtime_inputs' + _GPTL_NANOTIMERS_CPPDEFS = '-DHAVE_NANOTIME -DBIT64 -DHAVE_VPRINTF -DHAVE_BACKTRACE -DHAVE_SLASHPROC -DHAVE_COMM_F2C -DHAVE_TIMES -DHAVE_GETTIMEOFDAY' # pylint: disable=line-too-long # ======================================================================== @@ -118,8 +123,9 @@ def build_ctsm(cime_path, build_without_openmp (bool): if True, build without OpenMP support """ + existing_machine = machine is not None _create_build_dir(build_dir=build_dir, - existing_machine=(machine is not None)) + existing_machine=existing_machine) if machine is None: assert os_type is not None, 'with machine absent, os_type must be given' @@ -145,6 +151,18 @@ def build_ctsm(cime_path, machine=machine, build_debug=build_debug, build_without_openmp=build_without_openmp) + + if existing_machine: + # For a user-defined machine, we create an inputdata directory for this case. For + # an existing cime-ported machine, we still want an inputdata directory alongside + # the other directories, but now it will just be a link to the real inputdata + # space on that machine. (Note that, for a user-defined machine, it's important + # that we have created this directory before creating the case, whereas for an + # existing machine, we need to wait until after we have created the case to know + # where to make the sym link point to.) + _link_to_inputdata(build_dir=build_dir) + + _stage_runtime_inputs(build_dir=build_dir) if not no_build: _build_case(build_dir=build_dir) @@ -442,27 +460,20 @@ def _fill_out_machine_files(build_dir, For documentation of args, see the documentation in the build_ctsm function """ - path_to_templates = os.path.join(path_to_ctsm_root(), - 'lilac', - 'bld_templates') os.makedirs(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME)) # ------------------------------------------------------------------------ # Fill in config_machines.xml # ------------------------------------------------------------------------ - with open(os.path.join(path_to_templates, 'config_machines_template.xml')) as cm_template_file: - cm_template_file_contents = cm_template_file.read() - config_machines_template = string.Template(cm_template_file_contents) - config_machines = config_machines_template.substitute( - OS=os_type, - COMPILER=compiler, - CIME_OUTPUT_ROOT=build_dir, - GMAKE=gmake, - GMAKE_J=gmake_j) - with open(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME, 'config_machines.xml'), - 'w') as cm_file: - cm_file.write(config_machines) + fill_template_file( + path_to_template=os.path.join(_PATH_TO_TEMPLATES, 'config_machines_template.xml'), + path_to_final=os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME, 'config_machines.xml'), + substitutions={'OS':os_type, + 'COMPILER':compiler, + 'CIME_OUTPUT_ROOT':build_dir, + 'GMAKE':gmake, + 'GMAKE_J':gmake_j}) # ------------------------------------------------------------------------ # Fill in config_compilers.xml @@ -485,21 +496,19 @@ def _fill_out_machine_files(build_dir, else: pnetcdf_path_tag = '' - with open(os.path.join(path_to_templates, 'config_compilers_template.xml')) as cc_template_file: - cc_template_file_contents = cc_template_file.read() - config_compilers_template = string.Template(cc_template_file_contents) - config_compilers = config_compilers_template.substitute( - COMPILER=compiler, - GPTL_CPPDEFS=gptl_cppdefs, - NETCDF_PATH=netcdf_path, - PIO_FILESYSTEM_HINTS=pio_filesystem_hints_tag, - PNETCDF_PATH=pnetcdf_path_tag, - ESMF_LIBDIR=esmf_lib_path, - EXTRA_CFLAGS=extra_cflags, - EXTRA_FFLAGS=extra_fflags) - with open(os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME, 'config_compilers.xml'), - 'w') as cc_file: - cc_file.write(config_compilers) + fill_template_file( + path_to_template=os.path.join(_PATH_TO_TEMPLATES, + 'config_compilers_template.xml'), + path_to_final=os.path.join(build_dir, _MACHINE_CONFIG_DIRNAME, 'config_compilers.xml'), + substitutions={'COMPILER':compiler, + 'GPTL_CPPDEFS':gptl_cppdefs, + 'NETCDF_PATH':netcdf_path, + 'PIO_FILESYSTEM_HINTS':pio_filesystem_hints_tag, + 'PNETCDF_PATH':pnetcdf_path_tag, + 'ESMF_LIBDIR':esmf_lib_path, + 'EXTRA_CFLAGS':extra_cflags, + 'EXTRA_FFLAGS':extra_fflags}) + def _create_case(cime_path, build_dir, compiler, machine=None, build_debug=False, build_without_openmp=False): @@ -565,6 +574,34 @@ def _create_case(cime_path, build_dir, compiler, make_link(os.path.join(case_dir, '.env_mach_specific.{}'.format(extension)), os.path.join(build_dir, 'ctsm_build_environment.{}'.format(extension))) +def _link_to_inputdata(build_dir): + """For an existing machine, make a sym link to the inputdata directory + + Args: + build_dir (str): path to build directory + """ + case_dir = _get_case_dir(build_dir) + xmlquery = os.path.join(case_dir, 'xmlquery') + + inputdata_dir = subprocess.check_output([xmlquery, '--value', 'DIN_LOC_ROOT'], + cwd=case_dir, + universal_newlines=True) + make_link(inputdata_dir, + os.path.join(build_dir, _INPUTDATA_DIRNAME)) + +def _stage_runtime_inputs(build_dir): + """Stage CTSM and LILAC runtime inputs + + Args: + build_dir (str): path to build directory + """ + os.makedirs(os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME)) + + fill_template_file( + path_to_template=os.path.join(_PATH_TO_TEMPLATES, 'ctsm_template.cfg'), + path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'ctsm.cfg'), + substitutions={'INPUTDATA':os.path.join(build_dir, _INPUTDATA_DIRNAME)}) + def _build_case(build_dir): """Build the CTSM library and its dependencies diff --git a/python/ctsm/test/test_unit_utils.py b/python/ctsm/test/test_unit_utils.py new file mode 100755 index 0000000000..34449aa93c --- /dev/null +++ b/python/ctsm/test/test_unit_utils.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +"""Unit tests for utils +""" + +import tempfile +import shutil +import unittest +import os + +from ctsm import unit_testing +from ctsm.utils import fill_template_file + +# Allow names that pylint doesn't like, because otherwise I find it hard +# to make readable unit test names +# pylint: disable=invalid-name + +class TestUtilsFillTemplateFile(unittest.TestCase): + """Tests of utils: fill_template_file""" + + def setUp(self): + self._testdir = tempfile.mkdtemp() + + def tearDown(self): + shutil.rmtree(self._testdir, ignore_errors=True) + + def test_fillTemplateFile_basic(self): + """Basic test of fill_template_file""" + template_path = os.path.join(self._testdir, 'template.txt') + final_path = os.path.join(self._testdir, 'final.txt') + template_contents = """\ +Hello +$foo +Goodbye +$bar +""" + with open(template_path, 'w') as f: + f.write(template_contents) + + fillins = {'foo':'aardvark', + 'bar':'zyzzyva'} + fill_template_file(template_path, final_path, fillins) + + expected_final_text = """\ +Hello +aardvark +Goodbye +zyzzyva +""" + with open(final_path) as f: + final_contents = f.read() + + self.assertEqual(final_contents, expected_final_text) + +if __name__ == '__main__': + unit_testing.setup_for_tests() + unittest.main() diff --git a/python/ctsm/utils.py b/python/ctsm/utils.py index c75214f711..09a08ff9af 100644 --- a/python/ctsm/utils.py +++ b/python/ctsm/utils.py @@ -2,6 +2,7 @@ import logging import sys +import string logger = logging.getLogger(__name__) @@ -15,3 +16,20 @@ def abort(errmsg): pdb.set_trace() sys.exit('ERROR: {}'.format(errmsg)) + +def fill_template_file(path_to_template, path_to_final, substitutions): + """Given a template file (based on python's template strings), write a copy of the + file with template values filled in. + + Args: + path_to_template (str): path to the existing template file + path_to_final (str): path to where the final version will be written + substitutions (dict): key-value pairs for the template string substitutions + """ + + with open(path_to_template) as template_file: + template_file_contents = template_file.read() + template = string.Template(template_file_contents) + final_file_contents = template.substitute(substitutions) + with open(path_to_final, 'w') as final_file: + final_file.write(final_file_contents) From a28bf5e0f978058ae97a8454660114feaccfe5f2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 11 Jun 2020 18:28:50 -0600 Subject: [PATCH 1003/1973] Stage lilac_in file Also, make default lilac history output never --- .../bld_templates/{lilac_in => lilac_in_template} | 14 +++++++------- python/ctsm/build_ctsm.py | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) rename lilac/bld_templates/{lilac_in => lilac_in_template} (67%) diff --git a/lilac/bld_templates/lilac_in b/lilac/bld_templates/lilac_in_template similarity index 67% rename from lilac/bld_templates/lilac_in rename to lilac/bld_templates/lilac_in_template index 0849c35816..a10baa472b 100644 --- a/lilac/bld_templates/lilac_in +++ b/lilac/bld_templates/lilac_in_template @@ -1,21 +1,21 @@ &lilac_run_input - caseid = 'test_lilac' + caseid = 'ctsm_lilac' / &lilac_history_input - lilac_histfreq_option = 'nsteps' - lilac_histfreq_n = 4 + lilac_histfreq_option = 'never' + lilac_histfreq_n = 1 / &lilac_atmcap_input - atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + atm_mesh_filename = '$INPUTDATA/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' / &lilac_lnd_input - lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + lnd_mesh_filename = '$INPUTDATA/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' / &lilac_rof_input - rof_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/r05_nomask_c110308_ESMFmesh.nc' + rof_mesh_filename = '$INPUTDATA/share/meshes/r05_nomask_c110308_ESMFmesh.nc' / &atmaero_stream - stream_fldfilename='/glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc' + stream_fldfilename='$INPUTDATA/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc' stream_year_first = 2000 stream_year_last = 2000 / diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 6d77374149..2aedabcf50 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -602,6 +602,11 @@ def _stage_runtime_inputs(build_dir): path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'ctsm.cfg'), substitutions={'INPUTDATA':os.path.join(build_dir, _INPUTDATA_DIRNAME)}) + fill_template_file( + path_to_template=os.path.join(_PATH_TO_TEMPLATES, 'lilac_in_template'), + path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'lilac_in'), + substitutions={'INPUTDATA':os.path.join(build_dir, _INPUTDATA_DIRNAME)}) + def _build_case(build_dir): """Build the CTSM library and its dependencies From b4a9c7d8928c736da8861eed6b75cdbab384bd87 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 12 Jun 2020 14:18:44 -0600 Subject: [PATCH 1004/1973] adding more instructions for building and running WRF with CTSMM --- doc/source/lilac/specific-atm-models/wrf.rst | 263 +++++++++---------- 1 file changed, 119 insertions(+), 144 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 8d8b1da338..d6ccbf1cab 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -67,158 +67,92 @@ or Cshell:: recompile when making code changes to the CTSM, read section _obtaining-and-building-ctsm. <-- CREATED LINK TO THE CORRECT SECTION? -Preparing the WRF model +Building the WRF model with CTSM ======================= .. todo:: update the git address to WRF feature branch... -Obtain WRF by running:: +Clone WRF CTSM branch into your directory:: git clone git@github.com:billsacks/WRF.git cd WRF git checkout lilac_dev -.. note:: - - If the git clone command fails for you as written, then try it this way: - git clone https://github.com/billsacks/WRF.git -.. todo:: - - Sam, I think comments like the above are too trivial and make things more confusing... +For building WRF using CTSM, we should set makefile variables from CTSM needed for +WRF build by (BASH):: + export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk -Build WRF +or:: + setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk .. todo:: + Bill and Sam do we need the following still:? - Sam, while I think some of the notes below are useful such as number (4), - I believe some of the notes mentioned below such as number (1) is too trivial - and make our instructions less professional. - I tried integrating this into our instructions for example for bash vs. Cshell. +The following is needed in order to undo an undesired setting in that env_mach_specific file:: -.. note:: + export MPI_USE_ARRAY=None - 1) If the export commands below fail due to your environment settings, - try replacing them with setenv commands like this: +or:: - setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk setenv MPI_USE_ARRAY None -.. note:: +There are also few other environmental setting that should be set for building WRF. +Some of these are not required, but might help if you face any compilation errors. - 2) The ./clean -a command is unnecessary the first time you build WRF. - All five lines below become necessary when you modify the WRF code and - need to rebuild. - -.. note:: +Explicitly define which model core to build by:: - 3) The ./configure step will request two inputs while it runs. - Respond with 15 to the first request and with 1 to the second. + export WRF_EM_CORE=1 -.. note:: - - 4) The ./compile step might take more than 30 minutes to complete. +or:: + setenv WRF_EM_CORE 1 +Explicilty turn off data assimilation by:: -For building WRF using CTSM, we should set makefile variables needed for WRF build by:: - - export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + export WRF_DA_CORE=0 or:: - setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + setenv WRF_DA_CORE 0 -The following is needed in order to undo an undesired setting in that env_mach_specific file:: - - export MPI_USE_ARRAY=None - -or:: - - setenv MPI_USE_ARRAY None +Make sure you set NETCDF environment variable by:: + setenv NETCDF /usr/local/netcdf/ (or wherever you have netcdf compiled.) Then configure and build WRF for your machine and intended compiler by:: - ./clean -a - ./configure + ./clean -a + ./configure Choose one of the options, similar to the compiler used for building CTSM. Next, choose one of the options for nesting. Currently nesting is not available for WRF-CTSM, -therefore we should use 1:: +therefore we should use 1. - ./compile em_real >& compile.log +Then compile em_real and save the log:: -.. note:: + ./compile em_real >& compile.log - Check the bottom of your log file for a successful compilation message - or search the file for the string "Error" with a capital E. .. note:: - Optional: One may use tmux or nohup for configuring and compiling. - Try "man nohup" for more information. - -Create input namelists for CTSM and LILAC -========================================= - -Introduce the following diffs to ./git_wrf_ctsm/ctsm/lilac/atm_driver/ -by replacing the entries preceded by minus signs with the entries -preceded by plus signs. - -diff ./lilac/atm_driver/atm_driver_in ./lilac/atm_driver/atm_driver_in: + The ./compile step might take more than 30 minutes to complete. -.. code-block:: diff - - - atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - - atm_global_nx = 72 - - atm_global_ny = 46 - + atm_mesh_file = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' - + atm_global_nx = 199 - + atm_global_ny = 139 - -diff ./lilac/atm_driver/ctsm.cfg ./lilac/atm_driver/ctsm.cfg: - -.. code-block:: diff - - -configuration = clm - -structure = standard - -clm_bldnml_opts = -bgc sp - -gridmask = gx3v7 - -lnd_grid = 4x5 - -lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc - -lnd_domain_path = /glade/p/cesmdata/cseg/inputdata/share/domains - -clm_namelist_opts = hist_nhtfrq=-24 hist_mfilt=1 hist_ndens=1 - +configuration = nwp - +structure = fast - +clm_bldnml_opts = -bgc sp -clm_usr_name wrf2ctsm - +gridmask = null - +lnd_grid = wrf2ctsm - +lnd_domain_file = domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc - +lnd_domain_path = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files - +clm_namelist_opts = hist_nhtfrq=1 hist_mfilt=1 hist_ndens=1 fsurdat="/glade/work/barlage/ctsm/conus/surfdata_conus/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc" finidat="/glade/scratch/sacks/wrf_code/WRF/test/em_real/nldas_nwp_0109a.clm2.r.2000-04-01-64800.nc" use_init_interp=.true. - -diff ./lilac/atm_driver/lilac_in ./lilac/atm_driver/lilac_in: - -.. code-block:: diff - - - atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - + atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' - - lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - + lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' +.. note:: -Generate the lnd_in file by running the following from -./git_wrf_ctsm/ctsm/lilac/atm_driver:: + Check the bottom of your log file for a successful compilation message + or search the file for the string "Error" with a capital E. - ../../lilac_config/buildnml +.. note:: -Copy lilac_in, lnd_in, and lnd_modelio.nml to the WRF/run directory. + Optional: One may use tmux or nohup for configuring and compiling. + Try "man nohup" for more information. @@ -249,25 +183,19 @@ Here choose one option, for your intended compiler, similar to your WRF build. After configuring, you can check configure.wps for making sure all the libs and paths are set correctly. - Then, compile WPS:: ./compile >& compile.log .. note:: - If wps build is succsfully you should see geogrid.exe, ungrib.exe, and metgrid.exe. + If wps build is succsfully you should see geogrid.exe, ungrib.exe, and metgrid.exe. + Alternatively, you can check the log for successful build message. + Run WRF Preprocessing System (WPS) Steps ================================================== - - -.. todo:: - - First reference to the WRF namelist in the next line. We should - specify where that is. - Edit namelist.wps for your domain of interest, which should be the same -domain as used in your WRF namelist. +domain as used in your WRF namelist. Define the domain and interpolate static geographical data to the grids:: @@ -275,7 +203,7 @@ Define the domain and interpolate static geographical data to the grids:: Link in the input GFS data files:: - ./link_grib.csh path_where_you_placed_GFS_files + ./link_grib.csh $path_where_you_placed_GFS_files Extract meteorological fields from GRIB-formatted files:: @@ -288,7 +216,10 @@ the model grids defined in geogrid:: You should now have met_em.d01* files. -Run real.exe to generate initial and boundary conditions + +Run Real program +================================================== +Run real.exe to generate initial and boundary conditions. Follow WRF instructions for creating initial and boundary conditions. In summary, complete the following steps: @@ -309,52 +240,96 @@ To run WRF-CTSM, change land-surface option to 51:: Run real.exe (if compiled parallel submit a batch job) to generate wrfinput and wrfbdy files. -.. todo:: - Sam skipped up to here +Create input namelists for CTSM and LILAC +========================================= -Run WRF -======= +Introduce the following diffs to ./git_wrf_ctsm/ctsm/lilac/atm_driver/ +by replacing the entries preceded by minus signs with the entries +preceded by plus signs. + +diff ./lilac/atm_driver/atm_driver_in ./lilac/atm_driver/atm_driver_in: + +.. code-block:: diff + + - atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + - atm_global_nx = 72 + - atm_global_ny = 46 + + atm_mesh_file = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + + atm_global_nx = 199 + + atm_global_ny = 139 + +diff ./lilac/atm_driver/ctsm.cfg ./lilac/atm_driver/ctsm.cfg: -Place the following in a script that you may name run_wrf_ctsm.csh:: +.. code-block:: diff - #!/bin/tcsh - #PBS -N job_name - #PBS -A - #PBS -l walltime=01:00:00 - #PBS -q regular - #PBS -k eod + -configuration = clm + -structure = standard + -clm_bldnml_opts = -bgc sp + -gridmask = gx3v7 + -lnd_grid = 4x5 + -lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc + -lnd_domain_path = /glade/p/cesmdata/cseg/inputdata/share/domains + -clm_namelist_opts = hist_nhtfrq=-24 hist_mfilt=1 hist_ndens=1 + +configuration = nwp + +structure = fast + +clm_bldnml_opts = -bgc sp -clm_usr_name wrf2ctsm + +gridmask = null + +lnd_grid = wrf2ctsm + +lnd_domain_file = domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc + +lnd_domain_path = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files + +clm_namelist_opts = hist_nhtfrq=1 hist_mfilt=1 hist_ndens=1 fsurdat="/glade/work/barlage/ctsm/conus/surfdata_conus/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc" finidat="/glade/scratch/sacks/wrf_code/WRF/test/em_real/nldas_nwp_0109a.clm2.r.2000-04-01-64800.nc" use_init_interp=.true. - #PBS -l select=2:ncpus=4:mpiprocs=8 +diff ./lilac/atm_driver/lilac_in ./lilac/atm_driver/lilac_in: - ml +.. code-block:: diff + + - atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + + atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + + - lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + + lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + +Generate the lnd_in file by running the following from +./git_wrf_ctsm/ctsm/lilac/atm_driver:: - ### Set TMPDIR as recommended - setenv TMPDIR /glade/scratch/$USER/temp - mkdir -p $TMPDIR + ../../lilac_config/buildnml +Copy lilac_in, lnd_in, and lnd_modelio.nml to the WRF/run directory. - echo "hello" - ### Run the executable - set MPI_SHEPHERD=true - ln -sf .../WRF/test/em_real/namelist.input.ctsm_test.2013.d01 namelist.input - ln -sf .../WRF/test/em_real/wrfinput_d01.noseaice wrfinput_d01 - ln -sf .../WRF/test/em_real/wrfbdy_d01.6month wrfbdy_d01 - mpiexec_mpt ./wrf.exe -where "..." is the path to your WRF directory. +Run WRF +================= -.. note:: +If real program is completed successfully, we should see wrfinput and wrfbdy files +in our directory. + +Next, we should run WRF via batch job. +For Cheyenne, we should submit a batch job to PBS (Pro workload management system). +For more instructions on running a batch job on Cheyenne, please check: +https://www2.cisl.ucar.edu/resources/computational-systems/cheyenne/running-jobs/submitting-jobs-pbs + + +A sample of basic PBS job for Cheyenne:: + + #!/bin/tcsh + #PBS -N job_name + #PBS -A project_code + #PBS -l walltime=01:00:00 + #PBS -q queue_name + #PBS -j oe + #PBS -k eod + #PBS -m abe + #PBS -M your_email_address + #PBS -l select=2:ncpus=36:mpiprocs=36 - 1) Replace - #PBS -l select=2:ncpus=4:mpiprocs=8 - with - #PBS -l select=4:ncpus=36:mpiprocs=36 - to use more processors and run faster. + ### Set TMPDIR as recommended + setenv TMPDIR /glade/scratch/$USER/temp + mkdir -p $TMPDIR -Run:: + ### Run the executable + mpiexec_mpt ./wrf.exe - qsub run_wrf_ctsm.csh From 1843d4ac23054730d5db6535efd6b31be1ebaef8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 12 Jun 2020 16:54:55 -0600 Subject: [PATCH 1005/1973] Improve user-friendliness of ctsm.cfg --- lilac/bld_templates/ctsm_template.cfg | 60 ++++++++++--- lilac_config/buildnml | 122 +++++++++++++++++++------- python/ctsm/build_ctsm.py | 7 ++ 3 files changed, 145 insertions(+), 44 deletions(-) diff --git a/lilac/bld_templates/ctsm_template.cfg b/lilac/bld_templates/ctsm_template.cfg index 5e9d9379cd..9d697fb4e6 100644 --- a/lilac/bld_templates/ctsm_template.cfg +++ b/lilac/bld_templates/ctsm_template.cfg @@ -1,17 +1,55 @@ [buildnml_input] -clm_phys = clm5_0 -start_type = default -start_ymd = 20000101 + +# ------------------------------------------------------------------------ +# Paths to resolution-dependent files +# +# Note that some other files also need to be set in lilac_in: +# atm_mesh_filename and lnd_mesh_filename +# ------------------------------------------------------------------------ + +lnd_domain_file = FILL_THIS_IN +fsurdat = FILL_THIS_IN +finidat = FILL_THIS_IN + +# ------------------------------------------------------------------------ +# High-level configuration options +# ------------------------------------------------------------------------ + +# ctsm_phys: 'clm4_5' or 'clm5_0' +ctsm_phys = clm5_0 + +# configuration: 'nwp' or 'clm' configuration = nwp + +# structure: 'fast' or 'standard' structure = fast -ccsm_co2_ppmv = 367.0 -clm_co2_type = constant -clm_bldnml_opts = -clm_usr_name lilac -bgc sp + +# bgc_mode: +# - 'sp' (satellite phenology - no biogeochemistry) +# - 'bgc' (full biogeochemistry) +# - 'cn' (CLM4-style biogeochemistry) +# - 'fates' (Functionally Assembled Terrestrial Ecosystem Simulator) +bgc_mode = sp + +# crop: 'off' or 'on' ('on' only allowed for bgc_mode = 'bgc' or 'cn') +crop = off + +# vichydro: 'off' or 'on' ('on' only allowed for bgc_mode = 'sp') +vichydro = off + +# ------------------------------------------------------------------------ +# Specific configuration options +# ------------------------------------------------------------------------ + +co2_ppmv = 367.0 use_case = 2000_control lnd_tuning_mode = clm5_0_GSWP3v1 + +# spinup: whether to do accelerated spinup: 'off' or 'on' spinup = off -gridmask = null -lnd_grid = lilac -lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc -lnd_domain_path = $INPUTDATA/share/domains -din_loc_root = $INPUTDATA + +# ------------------------------------------------------------------------ +# Inputdata location (filled in automatically for your given build directory, but can be changed if desired) +# ------------------------------------------------------------------------ + +inputdata_path = $INPUTDATA diff --git a/lilac_config/buildnml b/lilac_config/buildnml index edb72709fc..004961da9c 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -38,6 +38,10 @@ _ENV_LILAC_TEMPLATE = """ """ +# This string is used in the out-of-the-box ctsm.cfg file to denote a value that needs to +# be filled in +_PLACEHOLDER = 'FILL_THIS_IN' + ############################################################################### def parse_command_line(args, description): ############################################################################### @@ -59,24 +63,55 @@ def parse_command_line(args, description): return arguments.rundir ############################################################################### -def get_config_value(config, section, item, file_path): +def get_config_value(config, section, item, file_path, allowed_values=None): """Get a given item from a given section of the config object Give a helpful error message if we can't find the given section or item Note that the file_path argument is only used for the sake of the error message + + If allowed_values is present, it should be a list of strings giving allowed values """ try: val = config.get(section, item) except NoSectionError: - print("ERROR: Config file {} must contain section '{}'\n".format(file_path, section)) - raise + sys.exit("ERROR: Config file {} must contain section '{}'".format(file_path, section)) except NoOptionError: - print("ERROR: Config file {} must contain item '{}' in section '{}'\n".format( + sys.exit("ERROR: Config file {} must contain item '{}' in section '{}'".format( file_path, item, section)) - raise + + if val == _PLACEHOLDER: + sys.exit("Error: {} needs to be specified in config file {}".format(item, file_path)) + + if allowed_values is not None: + if val not in allowed_values: + sys.exit("Error: {} is not an allowed value for {} in config file {}\n" + "Allowed values: {}".format(val, item, file_path, allowed_values)) + return val +############################################################################### +def determine_bldnml_opts(bgc_mode, crop, vichydro): +############################################################################### + """Return a string giving bldnml options, given some other inputs""" + bldnml_opts = '' + bldnml_opts += ' -bgc {}'.format(bgc_mode) + if bgc_mode == 'fates': + # BUG(wjs, 2020-06-12, ESCOMP/CTSM#115) For now, FATES is incompatible with MEGAN + bldnml_opts += ' -no-megan' + + if crop == 'on': + if bgc_mode not in ['bgc', 'cn']: + sys.exit("Error: setting crop to 'on' is only compatible with bgc_mode of 'bgc' or 'cn'") + bldnml_opts += ' -crop' + + if vichydro == 'on': + if bgc_mode != 'sp': + sys.exit("Error: setting vichydro to 'on' is only compatible with bgc_mode of 'sp'") + bldnml_opts += ' -vichydro' + + return bldnml_opts + ############################################################################### def buildnml(rundir, bldnmldir): ############################################################################### @@ -91,29 +126,40 @@ def buildnml(rundir, bldnmldir): config = ConfigParser() config.read(file_path) - clm_phys = get_config_value(config, 'buildnml_input', 'clm_phys', file_path) - start_type = get_config_value(config, 'buildnml_input', 'start_type', file_path) - start_ymd = get_config_value(config, 'buildnml_input', 'start_ymd', file_path) - configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path) - structure = get_config_value(config, 'buildnml_input', 'structure', file_path) - ccsm_co2_ppmv = get_config_value(config, 'buildnml_input', 'ccsm_co2_ppmv', file_path) - clm_co2_type = get_config_value(config, 'buildnml_input', 'clm_co2_type', file_path) - clm_bldnml_opts = get_config_value(config, 'buildnml_input', 'clm_bldnml_opts', file_path) + lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) + fsurdat = get_config_value(config, 'buildnml_input', 'fsurdat', file_path) + finidat = get_config_value(config, 'buildnml_input', 'finidat', file_path) + + ctsm_phys = get_config_value(config, 'buildnml_input', 'ctsm_phys', file_path, + allowed_values=['clm4_5', 'clm5_0']) + configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path, + allowed_values=['nwp', 'clm']) + structure = get_config_value(config, 'buildnml_input', 'structure', file_path, + allowed_values=['fast', 'standard']) + bgc_mode = get_config_value(config, 'buildnml_input', 'bgc_mode', file_path, + allowed_values=['sp', 'bgc', 'cn', 'fates']) + crop = get_config_value(config, 'buildnml_input', 'crop', file_path, + allowed_values=['off', 'on']) + vichydro = get_config_value(config, 'buildnml_input', 'vichydro', file_path, + allowed_values=['off', 'on']) + + bldnml_opts = determine_bldnml_opts(bgc_mode=bgc_mode, + crop=crop, + vichydro=vichydro) + + co2_ppmv = get_config_value(config, 'buildnml_input', 'co2_ppmv', file_path) use_case = get_config_value(config, 'buildnml_input', 'use_case', file_path) lnd_tuning_mode = get_config_value(config, 'buildnml_input', 'lnd_tuning_mode', file_path) - spinup = get_config_value(config, 'buildnml_input', 'spinup', file_path) - gridmask = get_config_value(config, 'buildnml_input', 'gridmask', file_path) - lnd_grid = get_config_value(config, 'buildnml_input', 'lnd_grid', file_path) - lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) - lnd_domain_path = get_config_value(config, 'buildnml_input', 'lnd_domain_path', file_path) - din_loc_root = get_config_value(config, 'buildnml_input', 'din_loc_root', file_path) - clm_namelist_opts = get_config_value(config, 'buildnml_input', 'clm_namelist_opts', file_path) + spinup = get_config_value(config, 'buildnml_input', 'spinup', file_path, + allowed_values=['off', 'on']) + + inputdata_path = get_config_value(config, 'buildnml_input', 'inputdata_path', file_path) # create config_cache.xml file # Note that build-namelist utilizes the contents of the config_cache.xml file in # the namelist_defaults.xml file to obtain namelist variables config_cache = os.path.join(rundir, "config_cache.xml") - config_cache_text = _CONFIG_CACHE_TEMPLATE.format(clm_phys=clm_phys) + config_cache_text = _CONFIG_CACHE_TEMPLATE.format(clm_phys=ctsm_phys) with open(config_cache, 'w') as tempfile: tempfile.write(config_cache_text) @@ -128,30 +174,40 @@ def buildnml(rundir, bldnmldir): if os.path.exists(inputdatalist_path): os.remove(inputdatalist_path) + # determine if fsurdat and/or finidat should appear in the -namelist option + extra_namelist_opts = '' + if fsurdat != 'UNSET': + extra_namelist_opts = extra_namelist_opts + " fsurdat = '{}' ".format(fsurdat) + if finidat != 'UNSET': + extra_namelist_opts = extra_namelist_opts + " finidat = '{}' ".format(finidat) + # call build-namelist cmd = os.path.abspath(os.path.join(bldnmldir, os.pardir, "bld", "build-namelist")) command = [cmd, - '-csmdata', din_loc_root, + '-csmdata', inputdata_path, '-inputdata', inputdatalist_path, - '-namelist', '&clm_inparm start_ymd={} {}/'.format(start_ymd, clm_namelist_opts), + # Hard-code start_ymd of year-2000. This is used to set the run type (for + # which a setting of 2000 gives 'startup', which is what we want) and pick + # the initial conditions file (which is pretty much irrelevant when running + # with lilac). + '-namelist', '&clm_inparm start_ymd=20000101 {} /'.format(extra_namelist_opts), '-use_case', use_case, '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date - '-res', lnd_grid, - '-clm_start_type', start_type, + '-res', 'lilac', + '-clm_start_type', 'default', # seems unimportant (see discussion in https://github.com/ESCOMP/CTSM/issues/876) '-configuration', configuration, '-structure', structure, - '-lnd_frac', os.path.join(lnd_domain_path, lnd_domain_file), + '-lnd_frac', lnd_domain_file, '-glc_nec', str(10), - '-co2_ppmv', ccsm_co2_ppmv, - '-co2_type', clm_co2_type, + '-co2_ppmv', co2_ppmv, + '-co2_type', 'constant', '-clm_accelerated_spinup', spinup, '-lnd_tuning_mode', lnd_tuning_mode, '-no-megan', # Eventually make this dynamic (see https://github.com/ESCOMP/CTSM/issues/926) '-config', os.path.join(rundir, "config_cache.xml"), - '-envxml_dir', rundir] - command.extend(clm_bldnml_opts.split()) - if gridmask not in ('null', 'UNSET'): - command.extend(['-mask', gridmask]) + '-envxml_dir', rundir, + '-clm_usr_name', 'lilac'] + command.extend(bldnml_opts.split()) subprocess.check_call(command, universal_newlines=True) @@ -166,7 +222,7 @@ def main(): """Main function""" rundir = parse_command_line(sys.argv[1:], __doc__) - bldnmldir = os.path.dirname(os.path.abspath(__file__)) + bldnmldir = os.path.dirname(os.path.realpath(__file__)) buildnml(rundir, bldnmldir) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index 2aedabcf50..e19a19a850 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -28,6 +28,10 @@ 'lilac', 'bld_templates') +_PATH_TO_BUILDNML = os.path.join(path_to_ctsm_root(), + 'lilac_config', + 'buildnml') + _MACHINE_CONFIG_DIRNAME = 'machine_configuration' _INPUTDATA_DIRNAME = 'inputdata' _RUNTIME_INPUTS_DIRNAME = 'runtime_inputs' @@ -607,6 +611,9 @@ def _stage_runtime_inputs(build_dir): path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'lilac_in'), substitutions={'INPUTDATA':os.path.join(build_dir, _INPUTDATA_DIRNAME)}) + make_link(_PATH_TO_BUILDNML, + os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'buildnml')) + def _build_case(build_dir): """Build the CTSM library and its dependencies From 0ce36157681051204ba6091ee3785b22785db081 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 12 Jun 2020 17:34:37 -0600 Subject: [PATCH 1006/1973] Remove a warning message According to @ekluzek, this is an out-dated message that we should just ignore --- bld/CLMBuildNamelist.pm | 3 --- 1 file changed, 3 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 985f886c9f..db6fc6cb55 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1391,9 +1391,6 @@ sub process_namelist_commandline_clm_usr_name { $nvars++; } } - if ( $nvars == 0 ) { - $log->message("setting clm_usr_name -- but did NOT find any user datasets: $opts->{'clm_usr_name'}", $opts); - } # Go through all variables and expand any XML env settings in them expand_xml_variables_in_namelist( $nl_usrfile, $envxml_ref ); # Merge input values into namelist. Previously specified values have higher precedence From 63567cec0db691b8e00c405386c169ca062e025b Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Sat, 13 Jun 2020 10:19:45 -0600 Subject: [PATCH 1007/1973] add is_tree,is_shruyb,is_grass --- src/biogeochem/CNDVLightMod.F90 | 13 +++++---- src/biogeochem/CNDVType.F90 | 4 +-- src/biogeophys/CanopyFluxesMod.F90 | 9 ++++-- src/main/pftconMod.F90 | 44 +++++++++++++++++++++++------- 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/src/biogeochem/CNDVLightMod.F90 b/src/biogeochem/CNDVLightMod.F90 index 3c498742b9..aa429890ba 100644 --- a/src/biogeochem/CNDVLightMod.F90 +++ b/src/biogeochem/CNDVLightMod.F90 @@ -72,8 +72,9 @@ subroutine Light(bounds, num_natvegp, filter_natvegp, & slatop => pftcon%slatop , & ! Input: specific leaf area at top of canopy, projected area basis (m2/gC) dsladlai => pftcon%dsladlai , & ! Input: dSLA/dLAI, projected area basis (m2/gC) woody => pftcon%woody , & ! Input: woody patch or not - tree => pftcon%tree , & ! Input: tree patch or not - + is_tree => pftcon%is_tree , & ! Input: tree patch or not + is_shrub => pftcon%is_shrub , & ! Input: shrub patch or not + deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C leafcmax => cnveg_carbonstate_inst%leafcmax_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage @@ -132,11 +133,11 @@ subroutine Light(bounds, num_natvegp, filter_natvegp, & fpc_inc(p) = max(0._r8, fpcgrid(p) - fpcgrid_old) if (woody(ivt(p)) == 1._r8) then - if (tree(ivt(p)) == 1) then + if (is_tree(ivt(p))) then numtrees(g) = numtrees(g) + 1 fpc_tree_total(g) = fpc_tree_total(g) + fpcgrid(p) fpc_inc_tree(g) = fpc_inc_tree(g) + fpc_inc(p) - else ! if shrubs + else if (is_shrub(ivt(p))) then fpc_shrub_total(g) = fpc_shrub_total(g) + fpcgrid(p) end if else ! if grass @@ -162,7 +163,7 @@ subroutine Light(bounds, num_natvegp, filter_natvegp, & ! light competition - if (woody(ivt(p))==1._r8 .and. tree(ivt(p))==1._r8) then + if (woody(ivt(p))==1._r8 .and. is_tree(ivt(p))) then if (fpc_tree_total(g) > fpc_tree_max) then @@ -200,7 +201,7 @@ subroutine Light(bounds, num_natvegp, filter_natvegp, & end if - else if (woody(ivt(p))==1._r8 .and. tree(ivt(p))==0._r8) then ! shrub + else if (woody(ivt(p))==1._r8 .and. is_shrub(ivt(p))) then ! shrub if (fpc_shrub_total(g) > fpc_shrub_max(g)) then diff --git a/src/biogeochem/CNDVType.F90 b/src/biogeochem/CNDVType.F90 index 6bc87d8f4b..065e972a15 100644 --- a/src/biogeochem/CNDVType.F90 +++ b/src/biogeochem/CNDVType.F90 @@ -97,7 +97,7 @@ subroutine InitAllocate(this, bounds) use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) use clm_varpar , only : maxveg use pftconMod , only : allom1s, allom2s, allom1, allom2, allom3, reinickerp - use pftconMod , only : ntree, nbrdlf_dcd_brl_shrub + use pftconMod , only : nbrdlf_dcd_brl_shrub use pftconMod , only : pftcon ! ! !ARGUMENTS: @@ -148,7 +148,7 @@ subroutine InitAllocate(this, bounds) dgv_ecophyscon%allom2(m) = allom2 dgv_ecophyscon%allom3(m) = allom3 ! modification for shrubs by X.D.Z - if (m > ntree .and. m <= nbrdlf_dcd_brl_shrub ) then + if (pftcon%is_shrub(m)) then dgv_ecophyscon%allom1(m) = allom1s dgv_ecophyscon%allom2(m) = allom2s end if diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index b5c183e355..4740e4c263 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -438,6 +438,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, snl => col%snl , & ! Input: [integer (:) ] number of snow layers dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) max_dayl => grc%max_dayl , & ! Input: [real(r8) (:) ] maximum daylength for this grid cell (s) + is_tree => pftcon%is_tree , & ! Input: tree patch or not + is_shrub => pftcon%is_shrub , & ! Input: shrub patch or not dleaf => pftcon%dleaf , & ! Input: characteristic leaf dimension (m) dbh_param => pftcon%dbh , & ! Input: diameter at brest height (m) fbw => pftcon%fbw , & ! Input: fraction of biomass that is water @@ -708,9 +710,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! adjust for departure of cylindrical stem model sa_stem(p) = k_cyl_area * sa_stem(p) - ! do not calculate separate leaf/stem heat capacity for grasses - ! or other pfts if dbh is below minimum value - if(patch%itype(p) > 11 .or. dbh(p) < min_stem_diameter) then + ! only calculate separate leaf/stem heat capacity for trees + ! and shrubs if dbh is greater than some minimum value + if(.not.(is_tree(patch%itype(p)) .or. is_shrub(patch%itype(p))) & + .or. dbh(p) < min_stem_diameter) then frac_rad_abs_by_stem(p) = 0.0 sa_stem(p) = 0.0 endif diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index e5b3d5c564..1c1c1bf9c6 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -110,7 +110,9 @@ module pftconMod type, public :: pftcon_type integer , allocatable :: noveg (:) ! value for not vegetated - integer , allocatable :: tree (:) ! tree or not? + logical , allocatable :: is_tree (:) ! tree or not? + logical , allocatable :: is_shrub (:) ! shrub or not? + logical , allocatable :: is_grass (:) ! grass or not? real(r8), allocatable :: dleaf (:) ! characteristic leaf dimension (m) real(r8), allocatable :: c3psn (:) ! photosynthetic pathway: 0. = c4, 1. = c3 @@ -339,8 +341,10 @@ subroutine InitAllocate (this) class(pftcon_type) :: this !----------------------------------------------------------------------- - allocate( this%noveg (0:mxpft)); this%noveg (:) =huge(1) - allocate( this%tree (0:mxpft)); this%tree (:) =huge(1) + allocate( this%noveg (0:mxpft)); this%noveg (:) = huge(1) + allocate( this%is_tree (0:mxpft)); this%is_tree (:) = .false. + allocate( this%is_shrub (0:mxpft)); this%is_shrub (:) = .false. + allocate( this%is_grass (0:mxpft)); this%is_grass (:) = .false. allocate( this%dleaf (0:mxpft) ) allocate( this%c3psn (0:mxpft) ) @@ -983,13 +987,8 @@ subroutine InitRead(this) this%dwood(m) = dwood this%root_radius(m) = root_radius this%root_density(m) = root_density - - if (m <= ntree) then - this%tree(m) = 1 - else - this%tree(m) = 0 - end if end do + ! ! clm 5 nitrogen variables ! @@ -1138,6 +1137,29 @@ subroutine InitRead(this) call this%set_is_pft_known_to_model() call this%set_num_cfts_known_to_model() + ! Set vegetation family identifier (tree/shrub/grass) + do m = 0,mxpft + if (m == ndllf_evr_tmp_tree .or. m == ndllf_evr_brl_tree & + .or. m == ndllf_dcd_brl_tree .or. m == nbrdlf_evr_trp_tree & + .or. m == nbrdlf_evr_tmp_tree .or. m == nbrdlf_dcd_trp_tree & + .or. m == nbrdlf_dcd_tmp_tree .or. m == nbrdlf_dcd_brl_tree) then + this%is_tree(m) = .true. + else + this%is_tree(m) = .false. + endif + if(m == nbrdlf_evr_shrub .or. m == nbrdlf_dcd_tmp_shrub .or. m == nbrdlf_dcd_brl_shrub) then + this%is_shrub(m) = .true. + else + this%is_shrub(m) = .false. + endif + if(m == nc3_arctic_grass .or. m == nc3_nonarctic_grass .or. m == nc4_grass) then + this%is_grass(m) = .true. + else + this%is_grass(m) = .false. + endif + + end do + if (use_cndv) then this%fcur(:) = this%fcurdv(:) end if @@ -1292,7 +1314,9 @@ subroutine Clean(this) !----------------------------------------------------------------------- deallocate( this%noveg) - deallocate( this%tree) + deallocate( this%is_tree) + deallocate( this%is_shrub) + deallocate( this%is_grass) deallocate( this%dleaf) deallocate( this%c3psn) From 7cbcc906b81804bc867aff8b48b0834ca9ff9f06 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 14 Jun 2020 16:20:11 -0600 Subject: [PATCH 1008/1973] Switch theta_cj for miscanthus and switchgrass from C3 value to C4 value of 0.8, this is needed because of the update to get these two biofuels working --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 1fd97876eb..eae0a45b6b 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -393,7 +393,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200612b.nc +lnd/clm2/paramdata/clm5_params.c200614.nc lnd/clm2/paramdata/clm45_params.c200613b.nc From 2abb3f4a0f477cd0243f032fc625434af8907189 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 15 Jun 2020 17:17:48 -0600 Subject: [PATCH 1009/1973] Mention generation and use of alternate finidat in wrf.rst --- doc/source/lilac/specific-atm-models/wrf.rst | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index d6ccbf1cab..4f4cf4e81f 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -68,7 +68,7 @@ or Cshell:: _obtaining-and-building-ctsm. <-- CREATED LINK TO THE CORRECT SECTION? Building the WRF model with CTSM -======================= +================================ .. todo:: update the git address to WRF feature branch... @@ -290,6 +290,20 @@ diff ./lilac/atm_driver/lilac_in ./lilac/atm_driver/lilac_in: - lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' +Before you generate the lnd_in file, you may modify user_nl_clm in +/glade/scratch/$USER/ctsm_build_dir/case/. For example you may wish to +point to an alternate CTSM initial condition file. To merge WRF initial +conditions from a wrfinput file into a CTSM initial condition file, type:: + + module load ncl/6.6.2 + ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="finidat_interp_dest.nc"' 'wrfinput="./git_wrf_ctsm/WRF/test/em_real/wrfinput_d01.noseaice"' 'merged="finidat_interp_dest_wrfinit_snow.nc"' + +.. todo:: + + Need to make the above ncl script available. I assume that the finidat + and the wrfinput files need to be consistent for this to work. If so, + we should prob. explain how to generate a consistent finidat file. + Generate the lnd_in file by running the following from ./git_wrf_ctsm/ctsm/lilac/atm_driver:: @@ -301,7 +315,7 @@ Copy lilac_in, lnd_in, and lnd_modelio.nml to the WRF/run directory. Run WRF -================= +======= If real program is completed successfully, we should see wrfinput and wrfbdy files in our directory. From 78b3f58610f677c0a9521cd328a1288d9b1804cd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 16 Jun 2020 17:12:14 -0600 Subject: [PATCH 1010/1973] Allow use of an existing resolution/mask in lilac's buildnml This restores some of the previous flexibility that I had recently deleted. --- lilac/bld_templates/ctsm_template.cfg | 20 ++++++- lilac_config/buildnml | 75 +++++++++++++++++++++------ 2 files changed, 79 insertions(+), 16 deletions(-) diff --git a/lilac/bld_templates/ctsm_template.cfg b/lilac/bld_templates/ctsm_template.cfg index 9d697fb4e6..be485c9708 100644 --- a/lilac/bld_templates/ctsm_template.cfg +++ b/lilac/bld_templates/ctsm_template.cfg @@ -3,13 +3,31 @@ # ------------------------------------------------------------------------ # Paths to resolution-dependent files # +# Values with FILL_THIS_IN generally *must* be specified (however, see +# note below about fsurdat when using --existing-res). Values with UNSET +# should generally be specified explicitly, but it's also acceptable to +# leave these as UNSET and use the out-of-the-box defaults. +# # Note that some other files also need to be set in lilac_in: # atm_mesh_filename and lnd_mesh_filename # ------------------------------------------------------------------------ +# lnd_domain_file always needs to be specified, whether you're using an +# existing grid or a user-defined grid lnd_domain_file = FILL_THIS_IN + +# The fsurdat (surface dataset) file defined here is only used for a +# user-defined grid (i.e., without the --existing-res argument to +# lilac's buildnml script). For an existing grid (i.e., with the +# --existing-res argument), this is ignored; however, it's still +# possible to override the default, out-of-the-box setting in the +# user_nl_ctsm file. fsurdat = FILL_THIS_IN -finidat = FILL_THIS_IN + +# The finidat (initial conditions) file does not absolutely need to be +# specified, but in most cases, you should specify your own finidat file +# rather than using one of the out-of-the-box ones. +finidat = UNSET # ------------------------------------------------------------------------ # High-level configuration options diff --git a/lilac_config/buildnml b/lilac_config/buildnml index 004961da9c..7d48d82bc6 100755 --- a/lilac_config/buildnml +++ b/lilac_config/buildnml @@ -42,25 +42,49 @@ _ENV_LILAC_TEMPLATE = """ # be filled in _PLACEHOLDER = 'FILL_THIS_IN' +# This string is used in the out-of-the-box ctsm.cfg file to denote a value that can be +# filled in, but doesn't absolutely need to be +_UNSET = 'UNSET' + ############################################################################### def parse_command_line(args, description): ############################################################################### - """Parse the command line, return rundir""" + """Parse the command line, return object holding arguments""" parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=description) parser.add_argument("--rundir", type=str, default=os.getcwd(), - help="specify the full path of the run directory") + help="Full path of the run directory") + + parser.add_argument("--existing-res", + help="Use the given out-of-the-box resolution (e.g., '4x5').\n" + "This argument should NOT be provided for a user-defined resolution.\n" + "If this argument is provided, then --existing-mask must also be provided.") + + parser.add_argument("--existing-mask", + help="Use the given out-of-the-box mask (e.g., 'gx3v7').\n" + "This argument should NOT be provided for a user-defined resolution.\n" + "If this argument is provided, then --existing-res must also be provided.") arguments = parser.parse_args(args) - # check if rundir exists + # Perform some error checking on arguments, and set derived values + if not os.path.isdir(arguments.rundir): - raise RuntimeError("rundir {} does not exist".format(arguments.rundir)) + sys.exit("rundir {} does not exist".format(arguments.rundir)) - return arguments.rundir + if arguments.existing_res and arguments.existing_mask: + arguments.use_existing_res_and_mask = True + elif arguments.existing_res and not arguments.existing_mask: + sys.exit("If --existing-res is given, then --existing-mask must also be given") + elif arguments.existing_mask and not arguments.existing_res: + sys.exit("If --existing-mask is given, then --existing-res must also be given") + else: + arguments.use_existing_res_and_mask = False + + return arguments ############################################################################### def get_config_value(config, section, item, file_path, allowed_values=None): @@ -113,10 +137,14 @@ def determine_bldnml_opts(bgc_mode, crop, vichydro): return bldnml_opts ############################################################################### -def buildnml(rundir, bldnmldir): +def buildnml(rundir, bldnmldir, use_existing_res_and_mask, existing_res=None, existing_mask=None): ############################################################################### - """Build the ctsm namelist""" + """Build the ctsm namelist + + If use_existing_res_and_mask is True, then existing_res and existing_mask should be + specified; otherwise, they are ignored. + """ # pylint: disable=too-many-locals @@ -127,7 +155,12 @@ def buildnml(rundir, bldnmldir): config.read(file_path) lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) - fsurdat = get_config_value(config, 'buildnml_input', 'fsurdat', file_path) + if use_existing_res_and_mask: + fsurdat = _UNSET + else: + # If we're not using an out-of-the-box grid, then require the user to explicitly + # specify the surface dataset. + fsurdat = get_config_value(config, 'buildnml_input', 'fsurdat', file_path) finidat = get_config_value(config, 'buildnml_input', 'finidat', file_path) ctsm_phys = get_config_value(config, 'buildnml_input', 'ctsm_phys', file_path, @@ -176,9 +209,9 @@ def buildnml(rundir, bldnmldir): # determine if fsurdat and/or finidat should appear in the -namelist option extra_namelist_opts = '' - if fsurdat != 'UNSET': + if fsurdat != _UNSET: extra_namelist_opts = extra_namelist_opts + " fsurdat = '{}' ".format(fsurdat) - if finidat != 'UNSET': + if finidat != _UNSET: extra_namelist_opts = extra_namelist_opts + " finidat = '{}' ".format(finidat) # call build-namelist @@ -193,7 +226,6 @@ def buildnml(rundir, bldnmldir): '-namelist', '&clm_inparm start_ymd=20000101 {} /'.format(extra_namelist_opts), '-use_case', use_case, '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date - '-res', 'lilac', '-clm_start_type', 'default', # seems unimportant (see discussion in https://github.com/ESCOMP/CTSM/issues/876) '-configuration', configuration, '-structure', structure, @@ -205,8 +237,16 @@ def buildnml(rundir, bldnmldir): '-lnd_tuning_mode', lnd_tuning_mode, '-no-megan', # Eventually make this dynamic (see https://github.com/ESCOMP/CTSM/issues/926) '-config', os.path.join(rundir, "config_cache.xml"), - '-envxml_dir', rundir, - '-clm_usr_name', 'lilac'] + '-envxml_dir', rundir] + if use_existing_res_and_mask: + command.extend(['-res', existing_res, + '-mask', existing_mask]) + else: + # NOTE(wjs, 2020-06-16) Note that we do NOT use the -mask argument in this case; + # it's possible that we should be using it in some circumstances (I haven't looked + # into how it's used). + command.extend(['-res', 'lilac', + '-clm_usr_name', 'lilac']) command.extend(bldnml_opts.split()) subprocess.check_call(command, @@ -221,9 +261,14 @@ def buildnml(rundir, bldnmldir): def main(): """Main function""" - rundir = parse_command_line(sys.argv[1:], __doc__) + args = parse_command_line(sys.argv[1:], __doc__) bldnmldir = os.path.dirname(os.path.realpath(__file__)) - buildnml(rundir, bldnmldir) + buildnml( + rundir=args.rundir, + bldnmldir=bldnmldir, + use_existing_res_and_mask=args.use_existing_res_and_mask, + existing_res=args.existing_res, + existing_mask=args.existing_mask) ############################################################################### From ae900fa41a93c572a256595f157f1e5655a209e7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 16 Jun 2020 23:45:42 -0600 Subject: [PATCH 1011/1973] Move readParameters from CNFireLi2016Mod into the base class so it can be used by all versions, and use ignition_efficiency in CNFireLi2014Mod as well --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- src/biogeochem/CNFireBaseMod.F90 | 31 ++++++++++++++++ src/biogeochem/CNFireLi2014Mod.F90 | 5 +-- src/biogeochem/CNFireLi2016Mod.F90 | 35 ++----------------- src/biogeochem/CNFireMethodMod.F90 | 18 ++++++++++ src/biogeochem/CNVegetationFacade.F90 | 5 ++- src/main/clm_instMod.F90 | 2 +- src/main/readParamsMod.F90 | 2 -- 8 files changed, 61 insertions(+), 39 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index eae0a45b6b..e9dae4e762 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -394,7 +394,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). for the CLM2 data in the CESM distribution --> lnd/clm2/paramdata/clm5_params.c200614.nc -lnd/clm2/paramdata/clm45_params.c200613b.nc +lnd/clm2/paramdata/clm45_params.c200614.nc diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index bb4f6612cf..9914ae90c8 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -73,6 +73,11 @@ module CNFireBaseMod real(r8) :: cmb_cmplt_fact(num_fp) = (/ 0.5_r8, 0.25_r8 /) ! combustion completion factor (unitless) end type + type, public :: params_type + real(r8) :: prh30 ! Factor related to dependence of fuel combustibility on 30-day running mean of relative humidity (unitless) + real(r8) :: ignition_efficiency ! Ignition efficiency of cloud-to-ground lightning (unitless) + end type params_type + ! type, abstract, extends(cnfire_method_type) :: cnfire_base_type private @@ -89,6 +94,7 @@ module CNFireBaseMod ! ! !PUBLIC MEMBER FUNCTIONS: procedure, public :: CNFireInit ! Initialization of CNFire + procedure, public :: CNFireReadParams ! Read in constant parameters from the paramsfile procedure, public :: CNFireReadNML ! Read in namelist for CNFire procedure, public :: CNFireInterp ! Interpolate fire data procedure, public :: CNFireArea ! Calculate fire area @@ -122,6 +128,7 @@ end function need_lightning_and_popdens_interface end interface type(cnfire_const_type), public, protected :: cnfire_const ! Fire constants shared by Li versons + type(params_type) , public, protected :: cnfire_params ! Fire parameters shared by Li versions character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -975,6 +982,30 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte end subroutine CNFireFluxes + !----------------------------------------------------------------------- + subroutine CNFireReadParams( this, ncid ) + ! + ! Read in the constant parameters from the input NetCDF parameter file + ! !USES: + use ncdio_pio , only: file_desc_t + use paramUtilMod, only: readNcdioScalar + ! + ! !ARGUMENTS: + implicit none + class(cnfire_base_type) :: this + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + ! !LOCAL VARIABLES: + character(len=*), parameter :: subname = 'CNFireReadParams' + !-------------------------------------------------------------------- + + ! Factor related to dependence of fuel combustibility on 30-day running mean of relative humidity (unitless) + call readNcdioScalar(ncid, 'prh30', subname, cnfire_params%prh30) + ! Ignition efficiency of cloud-to-ground lightning (unitless) + call readNcdioScalar(ncid, 'ignition_efficiency', subname, cnfire_params%ignition_efficiency) + + end subroutine CNFireReadParams + !----------------------------------------------------------------------- subroutine hdm_init( this, bounds, NLFilename ) ! diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 68d2d52a0e..d40609a7cb 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -40,7 +40,7 @@ module CNFireLi2014Mod use ColumnType , only : col use PatchType , only : patch use CNFireMethodMod , only : cnfire_method_type - use CNFireBaseMod , only : cnfire_base_type, cnfire_const + use CNFireBaseMod , only : cnfire_base_type, cnfire_const, cnfire_params ! implicit none private @@ -570,7 +570,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ min(1._r8,exp(SHR_CONST_PI*(forc_t(c)-SHR_CONST_TKFRZ)/10._r8)) lh = pot_hmn_ign_counts_alpha*6.8_r8*hdmlf**(0.43_r8)/30._r8/24._r8 fs = 1._r8-(0.01_r8+0.98_r8*exp(-0.025_r8*hdmlf)) - ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(3._r8*grc%lat(g)))*0.25_r8)*(1._r8-fs)*(1._r8-cropf_col(c)) + ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(3._r8*grc%lat(g)))* & + cnfire_params%ignition_efficiency)*(1._r8-fs)*(1._r8-cropf_col(c)) nfire(c) = ig/secsphr*fb*fire_m*lgdp_col(c) !fire counts/km2/sec Lb_lf = 1._r8+10.0_r8*(1._r8-EXP(-0.06_r8*forc_wind(g))) if ( wtlf(c) > 0.0_r8 )then diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index 4c3beb9887..9052077b51 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -41,14 +41,13 @@ module CNFireLi2016Mod use PatchType , only : patch use SoilBiogeochemStateType , only : get_spinup_latitude_term use CNFireMethodMod , only : cnfire_method_type - use CNFireBaseMod , only : cnfire_base_type, cnfire_const + use CNFireBaseMod , only : cnfire_base_type, cnfire_const, cnfire_params ! implicit none private ! ! !PUBLIC TYPES: public :: cnfire_li2016_type - public :: readParams ! type, extends(cnfire_base_type) :: cnfire_li2016_type private @@ -63,12 +62,6 @@ module CNFireLi2016Mod ! !PRIVATE MEMBER DATA: !----------------------------------------------------------------------- - type, private :: params_type - real(r8) :: prh30 ! Factor related to dependence of fuel combustibility on 30-day running mean of relative humidity (unitless) - real(r8) :: ignition_efficiency ! Ignition efficiency of cloud-to-ground lightning (unitless) - end type params_type - type(params_type), private :: params_inst - character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -88,28 +81,6 @@ function need_lightning_and_popdens(this) need_lightning_and_popdens = .true. end function need_lightning_and_popdens - !----------------------------------------------------------------------- - subroutine readParams( ncid ) - ! - ! !USES: - use ncdio_pio, only: file_desc_t - use paramUtilMod, only: readNcdioScalar - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=*), parameter :: subname = 'readCNFireLi2016Params' - !-------------------------------------------------------------------- - - ! Factor related to dependence of fuel combustibility on 30-day running mean of relative humidity (unitless) - call readNcdioScalar(ncid, 'prh30', subname, params_inst%prh30) - ! Ignition efficiency of cloud-to-ground lightning (unitless) - call readNcdioScalar(ncid, 'ignition_efficiency', subname, params_inst%ignition_efficiency) - - end subroutine readParams - !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & @@ -626,7 +597,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ if (trotr1_col(c)+trotr2_col(c)<=0.6_r8) then afuel =min(1._r8,max(0._r8,(fuelc(c)-2500._r8)/(5000._r8-2500._r8))) arh=1._r8-max(0._r8, min(1._r8,(forc_rh(g)-rh_low)/(rh_hgh-rh_low))) - arh30=1._r8-max(params_inst%prh30, min(1._r8,rh30_col(c)/90._r8)) + arh30=1._r8-max(cnfire_params%prh30, min(1._r8,rh30_col(c)/90._r8)) if (forc_rh(g) < rh_hgh.and. wtlf(c) > 0._r8 .and. tsoi17(c)> SHR_CONST_TKFRZ)then fire_m = ((afuel*arh30+(1._r8-afuel)*arh)**1.5_r8)*((1._r8 -max(0._r8,& min(1._r8,(btran_col(c)/wtlf(c)-bt_min)/(bt_max-bt_min))))**0.5_r8) @@ -636,7 +607,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ lh = pot_hmn_ign_counts_alpha*6.8_r8*hdmlf**(0.43_r8)/30._r8/24._r8 fs = 1._r8-(0.01_r8+0.98_r8*exp(-0.025_r8*hdmlf)) ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(SHR_CONST_PI/180._r8*3*min(60._r8,abs(grc%latdeg(g)))))* & - params_inst%ignition_efficiency)*(1._r8-fs)*(1._r8-cropf_col(c)) + cnfire_params%ignition_efficiency)*(1._r8-fs)*(1._r8-cropf_col(c)) nfire(c) = ig/secsphr*fb*fire_m*lgdp_col(c) !fire counts/km2/sec Lb_lf = 1._r8+10._r8*(1._r8-EXP(-0.06_r8*forc_wind(g))) spread_m = fire_m**0.5_r8 diff --git a/src/biogeochem/CNFireMethodMod.F90 b/src/biogeochem/CNFireMethodMod.F90 index 76af46a334..1b1dcea1d9 100644 --- a/src/biogeochem/CNFireMethodMod.F90 +++ b/src/biogeochem/CNFireMethodMod.F90 @@ -21,6 +21,9 @@ module CNFireMethodMod ! Read namelist for the fire datasets procedure(CNFireReadNML_interface), public, deferred :: CNFireReadNML + ! Read parameters for the fire datasets + procedure(CNFireReadParams_interface), public, deferred :: CNFireReadParams + ! Interpolate the fire datasets procedure(CNFireInterp_interface) , public, deferred :: CNFireInterp @@ -78,6 +81,21 @@ subroutine CNFireReadNML_interface(this, NLFilename ) end subroutine CNFireReadNML_interface + subroutine CNFireReadParams_interface( this, ncid ) + ! + ! !DESCRIPTION: + ! Read parameters from parameter file + ! + ! USES + use ncdio_pio , only: file_desc_t + import :: cnfire_method_type + ! !ARGUMENTS: + implicit none + class(cnfire_method_type) :: this + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + + end subroutine CNFireReadParams_interface + subroutine CNFireInterp_interface(this, bounds) ! ! !DESCRIPTION: diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index b79869aa6e..efd45634a6 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -193,7 +193,7 @@ module CNVegetationFacade contains !----------------------------------------------------------------------- - subroutine Init(this, bounds, NLFilename, nskip_steps) + subroutine Init(this, bounds, NLFilename, nskip_steps, params_ncid) ! ! !DESCRIPTION: ! Initialize a CNVeg object. @@ -203,12 +203,14 @@ subroutine Init(this, bounds, NLFilename, nskip_steps) ! !USES: use CNFireFactoryMod , only : create_cnfire_method use clm_varcon , only : c13ratio, c14ratio + use ncdio_pio , only : file_desc_t ! ! !ARGUMENTS: class(cn_vegetation_type), intent(inout) :: this type(bounds_type), intent(in) :: bounds character(len=*) , intent(in) :: NLFilename ! namelist filename integer , intent(in) :: nskip_steps ! Number of steps to skip at startup + type(file_desc_t), intent(inout) :: params_ncid ! NetCDF handle to parameter file ! ! !LOCAL VARIABLES: integer :: begp, endp @@ -274,6 +276,7 @@ subroutine Init(this, bounds, NLFilename, nskip_steps) end if call create_cnfire_method(NLFilename, this%cnfire_method) + call this%cnfire_method%CNFireReadParams( params_ncid ) end subroutine Init diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index aab218ed62..6ccee6bebc 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -421,7 +421,7 @@ subroutine clm_instInit(bounds) end if ! end of if use_cn ! Note - always call Init for bgc_vegetation_inst: some pieces need to be initialized always - call bgc_vegetation_inst%Init(bounds, nlfilename, GetBalanceCheckSkipSteps() ) + call bgc_vegetation_inst%Init(bounds, nlfilename, GetBalanceCheckSkipSteps(), params_ncid ) if (use_cn .or. use_fates) then call crop_inst%Init(bounds) diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index ae1b089ea0..38d412414e 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -31,7 +31,6 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) use CNMRespMod , only : readCNMRespParams => readParams use CNFUNMod , only : readCNFUNParams => readParams use CNPhenologyMod , only : readCNPhenolParams => readParams - use CNFireLi2016Mod , only : readCNFireLi2016Params => readParams use SoilBiogeochemCompetitionMod , only : readSoilBiogeochemCompetitionParams => readParams use SoilBiogeochemNLeachingMod , only : readSoilBiogeochemNLeachingParams => readParams use SoilBiogeochemNitrifDenitrifMod , only : readSoilBiogeochemNitrifDenitrifParams => readParams @@ -89,7 +88,6 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) call readCNMRespParams(ncid) call readCNFUNParams(ncid) call readCNPhenolParams(ncid) - call readCNFireLi2016Params(ncid) end if ! From 92314eca77bd892ddfb45e7a1b37b8579ba7f704 Mon Sep 17 00:00:00 2001 From: Chris Fischer Date: Wed, 17 Jun 2020 12:05:00 -0600 Subject: [PATCH 1012/1973] Add mapping files for ARCTIC, ARCTICGRIS, ne30np4.pg2, ne30pg3, ne120np4.pg2, ne120np4.pg3 --- bld/namelist_files/namelist_defaults_ctsm.xml | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index e8a3e4175c..2cba23063c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2958,6 +2958,258 @@ lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_h >lnd/clm2/mappingdata/maps/94x192/map_3x3min_MODISv2_to_94x192_nomask_aave_da_c190521.nc + + + + +lnd/clm2/mappingdata/maps/ARCTIC/map_3x3min_USGS_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_0.9x1.25_GRDC_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_360x720cru_cruncep_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_5x5min_ISRIC-WISE_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_0.5x0.5_AVHRR_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_3x3min_GLOBE-Gardner_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_5x5min_nomask_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_5x5min_IGBP-GSDP_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_0.5x0.5_MODIS_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_3x3min_MODISv2_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_0.25x0.25_MODIS_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_3x3min_MODIS-wCsp_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_10x10min_nomask_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_5x5min_ORNL-Soil_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_3x3min_LandScan2004_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTIC/map_10x10min_IGBPmergeICESatGIS_to_ne0np4.ARCTIC.ne30x4_nomask_aave_da_c200426.nc + + + + + + +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_5x5min_nomask_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_0.5x0.5_MODIS_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_3x3min_MODISv2_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_5x5min_ORNL-Soil_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_3x3min_MODIS-wCsp_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_0.5x0.5_AVHRR_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_3x3min_GLOBE-Gardner_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_10x10min_nomask_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_5x5min_ISRIC-WISE_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_360x720cru_cruncep_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_10x10min_IGBPmergeICESatGIS_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_5x5min_IGBP-GSDP_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_0.25x0.25_MODIS_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_3x3min_USGS_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_0.9x1.25_GRDC_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ARCTICGRIS/map_3x3min_LandScan2004_to_ne0np4.ARCTICGRIS.ne30x8_nomask_aave_da_c200426.nc + + + + + + +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_5x5min_nomask_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_3x3min_MODIS-wCsp_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_5x5min_IGBP-GSDP_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_3x3min_LandScan2004_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_360x720cru_cruncep_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_3x3min_USGS_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_0.9x1.25_GRDC_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_0.5x0.5_AVHRR_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_10x10min_IGBPmergeICESatGIS_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_0.5x0.5_MODIS_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_5x5min_ISRIC-WISE_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_3x3min_MODISv2_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_3x3min_GLOBE-Gardner_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_5x5min_ORNL-Soil_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_10x10min_nomask_to_ne30np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30np4.pg2/map_0.25x0.25_MODIS_to_ne30np4.pg2_nomask_aave_da_c200426.nc + + + + + + +lnd/clm2/mappingdata/maps/ne30pg3/map_3x3min_USGS_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_0.25x0.25_MODIS_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_5x5min_ORNL-Soil_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_3x3min_LandScan2004_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_5x5min_nomask_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_0.9x1.25_GRDC_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_3x3min_MODISv2_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_5x5min_ISRIC-WISE_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_5x5min_IGBP-GSDP_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_3x3min_MODIS-wCsp_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_3x3min_GLOBE-Gardner_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_10x10min_IGBPmergeICESatGIS_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_360x720cru_cruncep_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_10x10min_nomask_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_0.5x0.5_MODIS_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne30np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne30pg3/map_0.5x0.5_AVHRR_to_ne30np4.pg3_nomask_aave_da_c200426.nc + + + + + + +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_10x10min_nomask_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_5x5min_ISRIC-WISE_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_360x720cru_cruncep_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_5x5min_IGBP-GSDP_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_0.25x0.25_MODIS_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_5x5min_nomask_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_3x3min_USGS_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_3x3min_LandScan2004_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_0.5x0.5_MODIS_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_3x3min_MODISv2_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_10x10min_IGBPmergeICESatGIS_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_0.9x1.25_GRDC_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_0.5x0.5_AVHRR_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_5x5min_ORNL-Soil_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_3x3min_MODIS-wCsp_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_3x3min_GLOBE-Gardner_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne120np4.pg2_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg2/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne120np4.pg2_nomask_aave_da_c200426.nc + + + + + + +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_0.5x0.5_MODIS_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_5x5min_ORNL-Soil_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_10x10min_IGBPmergeICESatGIS_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_0.25x0.25_MODIS_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_10x10min_nomask_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_3x3min_MODIS-wCsp_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_360x720cru_cruncep_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_3x3min_LandScan2004_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_0.5x0.5_AVHRR_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_3x3min_USGS_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_3x3min_GLOBE-Gardner_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_0.9x1.25_GRDC_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_5x5min_IGBP-GSDP_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_5x5min_ISRIC-WISE_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_5x5min_nomask_to_ne120np4.pg3_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne120np4.pg3/map_3x3min_MODISv2_to_ne120np4.pg3_nomask_aave_da_c200426.nc + + From 15876365f075d62df3243d5bfe5af50b9621e369 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 17 Jun 2020 23:32:36 -0600 Subject: [PATCH 1013/1973] Update change files --- doc/ChangeLog | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++- doc/ChangeSum | 1 + 2 files changed, 98 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 909b5e0442..48d93e1b74 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,9 +1,105 @@ =============================================================== +Tag name: ctsm1.0.dev101 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326), oleson (Keith Oleson) +Date: Wed Jun 17 23:12:09 MDT 2020 +One-line Summary: Changes from Keith to bring a list of variables to the parameter file + +Purpose of changes +------------------ + +Change some hardcoded parameters to go on the parameter files. This is needed in preparation +of running the Perturbed Parameter Ensemble. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #995 #138, #206 + +Fixes #995 -- Soil turnover times are on paramfile and hardcoded +Fixes #138 -- use tau_ values on paramfile +Fixes #206 -- add prh30 to paramfile +Some work on #290 -- LUNA refactoring + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): paramfile for both clm4_5 and clm5_0 + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: self, oleson + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #1039 +(https://github.com/ESCOMP/ctsm/pull) + #1039 -- move hardcoded parameters to paramfile + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev100 Originator(s): sacks (Bill Sacks) Date: Tue Jun 9 06:15:15 MDT 2020 One-line Summary: Deallocate memory after running init_interp - + Purpose of changes ------------------ diff --git a/doc/ChangeSum b/doc/ChangeSum index ce0b4cbe4a..23793cf1c4 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev101 ole/erik 06/17/2020 Changes from Keith to bring a list of variables to the parameter file ctsm1.0.dev100 sacks 06/09/2020 Deallocate memory after running init_interp ctsm1.0.dev099 sacks 06/08/2020 Update cime, needed for izumi machine updates ctsm1.0.dev098 jet/erik 05/28/2020 Bring in GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 From f2a5664ccf0c1eb3774fff3960c7ef16b495eadc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 17 Jun 2020 23:51:35 -0600 Subject: [PATCH 1014/1973] Update to changelog file --- doc/ChangeLog | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 48d93e1b74..0326609823 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev101 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326), oleson (Keith Oleson) -Date: Wed Jun 17 23:12:09 MDT 2020 +Date: Wed Jun 17 23:51:22 MDT 2020 One-line Summary: Changes from Keith to bring a list of variables to the parameter file Purpose of changes @@ -45,6 +45,15 @@ Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Changes made to namelist defaults (e.g., changed parameter values): None Changes to the datasets (e.g., parameter, surface or initial files): paramfile for both clm4_5 and clm5_0 + Add 51 new parameters to the paramsfile: + bsw_adjustfactor,cpha,csol_clay,csol_om,csol_sand,denitrif_nitrateconc_coefficient,denitrif_nitrateconc_exponent, + denitrif_respiration_coefficient,denitrif_respiration_exponent,drift_gs,e_ice,enzyme_turnover_daily,eta0_anderson, + eta0_vionnet,fnps,hksat_adjustfactor,ignition_efficiency,jmaxb0,jmaxha,jmaxhd,kcha,koha,kp25ratio,lmrha,lmrhd, + lmrse,luna_theta_cj,minrelh,n_baseflow,pd,perched_baseflow_scalar,prh30,relhExp,ssi,sucsat_adjustfactor,theta_cj, + theta_ip,theta_psii,tpuha,tpuhd,tkd_clay,tkd_om,tkd_sand,tkm_om,tpu25ratio,vcmaxha,vcmaxhd,watsat_adjustfactor, + wc2wjb0,wimp,wind_min + k_nitr_max removed and replaced with k_nitr_max_perday + meta-data for the tau_* variables changed, and a roundoff difference in the clm4_5 paramfile Substantial timing or memory changes: None @@ -52,7 +61,9 @@ Notes of particular relevance for developers: (including Code reviews and testin --------------------------------------------- NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None +Caveats for developers (e.g., code that is duplicated that requires double maintenance): prh30 not used for clm4_5 + prh30 was added in but won't be used for the CNFireLi2014 formulation. + It's only used for the clm5_0 and following formulations Changes to tests or testing: None @@ -65,11 +76,11 @@ CTSM testing: regular build-namelist tests: - cheyenne - + cheyenne - PASS (170 tests differ from baseline because of new paramfiles) python testing (see instructions in python/README.md; document testing done): - (any machine) - + cheyenne - PASS regular tests (aux_clm): From 7219faf7dfde251d9d6e3bdd8d2d24117db73d3a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 18 Jun 2020 13:30:22 -0600 Subject: [PATCH 1015/1973] Update standard list of resolutions to make Update the standard list of resolutions to make when surface datasets are created. Add a new list of SE and variable mesh grids. Remove the f05 which we don't think we need. --- tools/mksurfdata_map/Makefile.data | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/mksurfdata_map/Makefile.data b/tools/mksurfdata_map/Makefile.data index f7cad8415e..373ff6e63d 100644 --- a/tools/mksurfdata_map/Makefile.data +++ b/tools/mksurfdata_map/Makefile.data @@ -56,10 +56,15 @@ MKSURFDATA = $(BATCHJOBS) $(PWD)/mksurfdata.pl # f19 and f09 are standard resolutions, f10 is used for testing, f45 is used for FATES # ne30np4 is standard resolution for SE dycore in CAM, C96 is standard for fv3 dycore +# The ne30np4 series (including pg2, pg3, pg4) are standard for SE dycore +# The variable resolution grids for ARCTIC, ARCTICGRIS and CONUS are also standard STANDARD_RES_NO_CROP = 0.9x1.25,1.9x2.5,10x15 -STANDARD_RES = 0.9x1.25,1.9x2.5,10x15,4x5,ne30np4,C96 +STANDARD_RES = 0.9x1.25,1.9x2.5,10x15,4x5,ne30np4,C96,ne30pg2,ne30pg3,ne30pg4,ne120np4pg3,ne0np4ARCTICGRISne30x8,ne0np4ARCTICne30x4,ne0np4CONUSne30x8 +# For future CMIP6 scenarios: SSP-RCP's FUTURE_RES = 0.9x1.25,1.9x2.5,10x15 +# For historical transient cases (TRY TO KEEP THIS LIST AS SHORT AS POSSIBLE) +TRANS_RES = 0.9x1.25,1.9x2.5,10x15,ne30np4,ne0np4ARCTICGRISne30x8,ne0np4ARCTICne30x4,ne0np4CONUSne30x8 # ne120np4 is for high resolution SE dycore, ne16 is for testing SE dycore # T42 is for SCAM @@ -77,7 +82,6 @@ TROPICS = \ CROP = \ crop-global-present \ - crop-global-present-f05 \ crop-global-present-ne16np4 \ crop-global-present-ne120np4 \ crop-numa-present \ @@ -85,12 +89,8 @@ CROP = \ crop-smallville \ crop-smallville-historical \ crop-global-historical \ - crop-global-historical-f05 \ - crop-global-historical-ne120np4 \ - crop-global-transient-f05 \ crop-global-transient \ - crop-global-future \ - crop-global-transient-ne120np4 + crop-global-future all : standard tropics crop urban landuse-timeseries @@ -178,7 +178,7 @@ crop-global-historical-ne120np4 : FORCE $(MKSURFDATA) -glc_nec 10 -y 1850 -res ne120np4 $(BACKGROUND) crop-global-transient: FORCE - $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2000 -res $(STANDARD_RES) $(BACKGROUND) + $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2000 -res $(TRANS_RES) $(BACKGROUND) crop-global-transient-ne120np4 : FORCE $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2000 -res ne120np4 $(BACKGROUND) From c9f122e8f21b8c90dc8c19a7dafb1ef0cdfb4fc9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 19 Jun 2020 11:44:26 -0600 Subject: [PATCH 1016/1973] Update externals according to latest nuopc_dev branch --- Externals.cfg | 10 +++++----- Externals_cime.cfg | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 0e35c60288..87bb0dd71f 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -15,15 +15,15 @@ required = True [rtm] local_path = components/rtm protocol = git -repo_url = https://github.com/mvertens/rtm -hash = 03a804eaa002805d87c9340f6ca3d542ff4598d5 +repo_url = https://github.com/ekluzek/rtm +branch = upnuopc required = True [mosart] local_path = components/mosart protocol = git -repo_url = https://github.com/mvertens/mosart -hash = 2b30936 +repo_url = https://github.com/ekluzek/mosart +branch = upnupopc required = True [mizuRoute] @@ -37,7 +37,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -hash = 1b049969f7271cf01ac7e2133a83c9b23c7f963d +hash = 4427dd05147c42f19f5283793676867572138ed7 externals = ../Externals_cime.cfg required = True diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 0203691221..43ff73b3ee 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,9 +1,23 @@ [cmeps] -hash = 7ba0be9d94c8ea54b081b3804cbbffcfe7a25e08 +hash = 70b5daa protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ required = True +[fox] +hash = 0ed59c1 +protocol = git +repo_url = https://github.com/ESMCI/fox.git +local_path = src/externals/fox +required = True + +[cdeps] +hash = 5b29c3e +protocol = git +repo_url = https://github.com/ESCOMP/CDEPS.git +local_path = src/components/cdeps +required = True + [externals_description] schema_version = 1.0.0 From f344e65ac517cba013798ca57dda66c7f8d9f52c Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 19 Jun 2020 12:09:10 -0600 Subject: [PATCH 1017/1973] Working on the documentations and adding some corrections. --- doc/source/lilac/specific-atm-models/wrf.rst | 129 ++++++++++--------- 1 file changed, 70 insertions(+), 59 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 4f4cf4e81f..0354992863 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -16,50 +16,38 @@ from earlier sections but in recipe form and with minimal detail. This section assumes use of a machine that has been ported to CIME. In this example we assume NCAR’s cheyenne computer in particular. -Preparing the CTSM -================== - -.. todo:: - - I think we don't need some of the following since too much instructions - are usually more confusing... - I tried removing incorrect or redundant information. - - For example, people who do not use cheyenne might get confused by the - following commands on scratch. +Clone CTSM Repository +------------------------- Decide where you will work, for example:: - cd /glade/scratch/$USER - mkdir git_wrf_ctsm - cd git_wrf_ctsm - -.. note:: - - Discs other than /glade/scratch may provide insufficient space for - output from simulations longer than one or two months. + mkdir git_wrf_ctsm + cd git_wrf_ctsm -Obtain CTSM by running:: +Clone CTSM repository and checkout lilac_cap branch:: - git clone https://github.com/ESCOMP/ctsm.git - cd ctsm - git checkout lilac_cap - ./manage_externals/checkout_externals -v + git clone https://github.com/ESCOMP/ctsm.git + cd ctsm + git checkout lilac_cap + ./manage_externals/checkout_externals -Build CTSM and its dependencies, for example for cheyenne:: +Build CTSM and its dependencies based on instructions from previous sections, +for example for cheyenne:: - ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne + ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne -Set environment similar to environments used for your CTSM build for bash:: +Set environment similar to environments used for your CTSM build using +ctsm_build_environment.sh for bash:: - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh + source /ctsm_build_dir/ctsm_build_environment.sh -or Cshell:: +or ctsm_build_environment.csh for Cshell: - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh +.. code-block:: Tcsh + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh .. note:: @@ -68,35 +56,41 @@ or Cshell:: _obtaining-and-building-ctsm. <-- CREATED LINK TO THE CORRECT SECTION? Building the WRF model with CTSM -================================ +-------------------------------- + .. todo:: - update the git address to WRF feature branch... + update the git address to WRF feature branch... Clone WRF CTSM branch into your directory:: - git clone git@github.com:billsacks/WRF.git - cd WRF - git checkout lilac_dev + git clone git@github.com:billsacks/WRF.git + cd WRF + git checkout lilac_dev -For building WRF using CTSM, we should set makefile variables from CTSM needed for +For building WRF using CTSM, we should set makefile variables from CTSM needed for WRF build by (BASH):: - export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + +or (Cshell): -or:: +.. code-block:: Tcsh - setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk .. todo:: + Bill and Sam do we need the following still:? The following is needed in order to undo an undesired setting in that env_mach_specific file:: export MPI_USE_ARRAY=None -or:: +or (Cshell): + +.. code-block:: Tcsh setenv MPI_USE_ARRAY None @@ -107,7 +101,9 @@ Explicitly define which model core to build by:: export WRF_EM_CORE=1 -or:: +or (Cshell): + +.. code-block:: Tcsh setenv WRF_EM_CORE 1 @@ -115,7 +111,9 @@ Explicilty turn off data assimilation by:: export WRF_DA_CORE=0 -or:: +or (Cshell): + +.. code-block:: Tcsh setenv WRF_DA_CORE 0 @@ -157,16 +155,18 @@ Then compile em_real and save the log:: Compile WRF Preprocessing System (WPS) -================================================== +-------------------------------------- The WRF Preprocessing System (WPS) is a set of programs to prepare input to the real program for WRF real-data simulations. .. note:: + Building WPS requires that WRF be already built successfully. -Get WPS zipped tar file from: +Get WPS zipped tar file from: + http://www2.mmm.ucar.edu/wrf/users/download/get_source.html Untar WPS tar file:: @@ -174,7 +174,7 @@ Untar WPS tar file:: gzip -cd WPSV4.0.TAR.gz | tar -xf - -Then we should compile WPS similar to the way we build WRF. In summary:: +Then compile WPS similar to the way WRF was built. In summary:: cd WPS ./configure @@ -184,41 +184,45 @@ After configuring, you can check configure.wps for making sure all the libs and are set correctly. Then, compile WPS:: + ./compile >& compile.log .. note:: + If wps build is succsfully you should see geogrid.exe, ungrib.exe, and metgrid.exe. Alternatively, you can check the log for successful build message. Run WRF Preprocessing System (WPS) Steps -================================================== +----------------------------------------- Edit namelist.wps for your domain of interest, which should be the same domain as used in your WRF namelist. -Define the domain and interpolate static geographical data to the grids:: +First, use geogrid.exe to define the domain and interpolate static geographical data +to the grids:: + + ./geogrid.exe >& log.geogrid - ./geogrid.exe >& log.geogrid -Link in the input GFS data files:: +Check the geogrid log file for successful ****** +Link the GRIB data files that are going to be used:: - ./link_grib.csh $path_where_you_placed_GFS_files + ./link_grib.csh $your_GRIB_data_path Extract meteorological fields from GRIB-formatted files:: - ./ungrib.exe + ./ungrib.exe -Horizontally interpolate the metrological fields extracted by ungrib to +Horizontally interpolate the meteorological fields extracted by ungrib to the model grids defined in geogrid:: - ./metgrid.exe >& log.metgrid + ./metgrid.exe >& log.metgrid -You should now have met_em.d01* files. -Run Real program -================================================== +Run real program +---------------- Run real.exe to generate initial and boundary conditions. Follow WRF instructions for creating initial and boundary @@ -227,7 +231,9 @@ conditions. In summary, complete the following steps: Move or link WPS output files (met_em.d01* files) to your WRF/run directory. Edit namelist.input for your WRF domain and desirable configurations. -This should be the same domain as in the namelist used in WPS. +This should be the same domain as in the namelist used in WPS. + + To run WRF-CTSM, change land-surface option to 51:: sf_surface_physics = 51 @@ -237,6 +243,10 @@ To run WRF-CTSM, change land-surface option to 51:: sf_surface_physics values for running WRF-Noah and WRF-NoahMP are 2 and 4, respectively. +.. todo:: + + add the link and adding some note that nested run is not possible.... + Run real.exe (if compiled parallel submit a batch job) to generate wrfinput and wrfbdy files. @@ -315,12 +325,13 @@ Copy lilac_in, lnd_in, and lnd_modelio.nml to the WRF/run directory. Run WRF -======= +------- If real program is completed successfully, we should see wrfinput and wrfbdy files in our directory. -Next, we should run WRF via batch job. +Next, we should run WRF. + For Cheyenne, we should submit a batch job to PBS (Pro workload management system). For more instructions on running a batch job on Cheyenne, please check: https://www2.cisl.ucar.edu/resources/computational-systems/cheyenne/running-jobs/submitting-jobs-pbs From 91433578398cb2b05dd3679bf96c947f00cf5a55 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 19 Jun 2020 14:06:12 -0600 Subject: [PATCH 1018/1973] Adding details on completion of WPS --- doc/source/lilac/specific-atm-models/wrf.rst | 25 ++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 0354992863..52329c6e00 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -204,6 +204,13 @@ to the grids:: ./geogrid.exe >& log.geogrid +If the geogrid step is finished successfully, you should see the following message in +the log file:: + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Successful completion of geogrid. ! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + Check the geogrid log file for successful ****** Link the GRIB data files that are going to be used:: @@ -212,7 +219,18 @@ Link the GRIB data files that are going to be used:: Extract meteorological fields from GRIB-formatted files:: - ./ungrib.exe + ./ungrib.exe >& log.ungrib + +Check ungrib log for the following message showing successful completion of ungrib step:: + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Successful completion of ungrib. ! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + + + + Horizontally interpolate the meteorological fields extracted by ungrib to the model grids defined in geogrid:: @@ -221,6 +239,7 @@ the model grids defined in geogrid:: + Run real program ---------------- Run real.exe to generate initial and boundary conditions. @@ -337,7 +356,9 @@ For more instructions on running a batch job on Cheyenne, please check: https://www2.cisl.ucar.edu/resources/computational-systems/cheyenne/running-jobs/submitting-jobs-pbs -A sample of basic PBS job for Cheyenne:: +A sample of basic PBS job for Cheyenne: + +.. code-block:: Tcsh #!/bin/tcsh #PBS -N job_name From 2fa8a63df9b237c3c3c9683e5c881525e609262f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 19 Jun 2020 14:55:48 -0600 Subject: [PATCH 1019/1973] Rename buildnml to make_runtime_inputs This is per Mariana's suggestion. Also move it to sit with the other lilac stuff, rather than having a lilac_config directory that only contains this one file. --- lilac_config/buildnml => lilac/make_runtime_inputs | 0 python/ctsm/build_ctsm.py | 10 +++++----- 2 files changed, 5 insertions(+), 5 deletions(-) rename lilac_config/buildnml => lilac/make_runtime_inputs (100%) diff --git a/lilac_config/buildnml b/lilac/make_runtime_inputs similarity index 100% rename from lilac_config/buildnml rename to lilac/make_runtime_inputs diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/build_ctsm.py index e19a19a850..3727ef29d3 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/build_ctsm.py @@ -28,9 +28,9 @@ 'lilac', 'bld_templates') -_PATH_TO_BUILDNML = os.path.join(path_to_ctsm_root(), - 'lilac_config', - 'buildnml') +_PATH_TO_MAKE_RUNTIME_INPUTS = os.path.join(path_to_ctsm_root(), + 'lilac', + 'make_runtime_inputs') _MACHINE_CONFIG_DIRNAME = 'machine_configuration' _INPUTDATA_DIRNAME = 'inputdata' @@ -611,8 +611,8 @@ def _stage_runtime_inputs(build_dir): path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'lilac_in'), substitutions={'INPUTDATA':os.path.join(build_dir, _INPUTDATA_DIRNAME)}) - make_link(_PATH_TO_BUILDNML, - os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'buildnml')) + make_link(_PATH_TO_MAKE_RUNTIME_INPUTS, + os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'make_runtime_inputs')) def _build_case(build_dir): """Build the CTSM library and its dependencies From 5f727c46f8011a7c59357cc3fa4dfc091e201f00 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 19 Jun 2020 15:07:42 -0600 Subject: [PATCH 1020/1973] Rename build_ctsm.py to lilac_build_ctsm.py --- lilac/build_ctsm | 2 +- python/ctsm/{build_ctsm.py => lilac_build_ctsm.py} | 2 +- ...{test_sys_build_ctsm.py => test_sys_lilac_build_ctsm.py} | 6 +++--- ...est_unit_build_ctsm.py => test_unit_lilac_build_ctsm.py} | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) rename python/ctsm/{build_ctsm.py => lilac_build_ctsm.py} (99%) rename python/ctsm/test/{test_sys_build_ctsm.py => test_sys_lilac_build_ctsm.py} (95%) rename python/ctsm/test/{test_unit_build_ctsm.py => test_unit_lilac_build_ctsm.py} (98%) diff --git a/lilac/build_ctsm b/lilac/build_ctsm index cc3fd19f7e..62c330118d 100755 --- a/lilac/build_ctsm +++ b/lilac/build_ctsm @@ -13,7 +13,7 @@ from ctsm.path_utils import add_cime_lib_to_path cime_path = add_cime_lib_to_path() -from ctsm.build_ctsm import main +from ctsm.lilac_build_ctsm import main if __name__ == "__main__": main(cime_path=cime_path) diff --git a/python/ctsm/build_ctsm.py b/python/ctsm/lilac_build_ctsm.py similarity index 99% rename from python/ctsm/build_ctsm.py rename to python/ctsm/lilac_build_ctsm.py index 3727ef29d3..3079f8cfdf 100644 --- a/python/ctsm/build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -1,4 +1,4 @@ -"""Functions implementing build_ctsm command""" +"""Functions implementing LILAC's build_ctsm command""" import argparse import logging diff --git a/python/ctsm/test/test_sys_build_ctsm.py b/python/ctsm/test/test_sys_lilac_build_ctsm.py similarity index 95% rename from python/ctsm/test/test_sys_build_ctsm.py rename to python/ctsm/test/test_sys_lilac_build_ctsm.py index f0bc42f0ef..3730b8fed7 100755 --- a/python/ctsm/test/test_sys_build_ctsm.py +++ b/python/ctsm/test/test_sys_lilac_build_ctsm.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -"""System tests for build_ctsm +"""System tests for lilac_build_ctsm These tests do a lot of work (interacting with cime, etc.), and thus take relatively long to run. @@ -13,7 +13,7 @@ from ctsm.path_utils import add_cime_lib_to_path from ctsm import unit_testing -from ctsm.build_ctsm import build_ctsm +from ctsm.lilac_build_ctsm import build_ctsm _CIME_PATH = add_cime_lib_to_path(standalone_only=True) @@ -22,7 +22,7 @@ # pylint: disable=invalid-name class TestSysBuildCtsm(unittest.TestCase): - """System tests for build_ctsm""" + """System tests for lilac_build_ctsm""" def setUp(self): self._tempdir = tempfile.mkdtemp() diff --git a/python/ctsm/test/test_unit_build_ctsm.py b/python/ctsm/test/test_unit_lilac_build_ctsm.py similarity index 98% rename from python/ctsm/test/test_unit_build_ctsm.py rename to python/ctsm/test/test_unit_lilac_build_ctsm.py index 24f00ab358..c97c9a4c41 100755 --- a/python/ctsm/test/test_unit_build_ctsm.py +++ b/python/ctsm/test/test_unit_lilac_build_ctsm.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -"""Unit tests for build_ctsm +"""Unit tests for lilac_build_ctsm """ import unittest @@ -8,14 +8,14 @@ from io import StringIO from ctsm import unit_testing -from ctsm.build_ctsm import _commandline_args, _check_and_transform_os +from ctsm.lilac_build_ctsm import _commandline_args, _check_and_transform_os # Allow names that pylint doesn't like, because otherwise I find it hard # to make readable unit test names # pylint: disable=invalid-name class TestBuildCtsm(unittest.TestCase): - """Tests of build_ctsm""" + """Tests of lilac_build_ctsm""" def test_commandlineArgs_rebuild_valid(self): """Test _commandline_args with --rebuild, with a valid argument list (no disallowed args)""" From 2118a7fc7155f2f7b1277c60d69ae4adcf88c523 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 19 Jun 2020 23:14:03 -0600 Subject: [PATCH 1021/1973] adding more details on *.exe logs. --- doc/source/lilac/specific-atm-models/wrf.rst | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 52329c6e00..5e39437cd9 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -207,10 +207,9 @@ to the grids:: If the geogrid step is finished successfully, you should see the following message in the log file:: - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! Successful completion of geogrid. ! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Successful completion of geogrid. ! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Check the geogrid log file for successful ****** Link the GRIB data files that are going to be used:: @@ -239,6 +238,14 @@ the model grids defined in geogrid:: +Check the metgrid log for the following message showing successful completion of +metgrid step:: + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Successful completion of metgrid. ! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + Run real program ---------------- @@ -270,6 +277,10 @@ Run real.exe (if compiled parallel submit a batch job) to generate wrfinput and wrfbdy files. +Check the last line of the real log file for the following message:: + + SUCCESS COMPLETE REAL_EM INIT + Create input namelists for CTSM and LILAC ========================================= From f80b00fca1c54cb1b9d27e5844414961adc467b8 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 31 Jan 2020 13:31:03 -0800 Subject: [PATCH 1022/1973] Removing calls to retired machine edison. Adding a SMS test to the gnu test suite. Changing highest res grid test to clm5. --- cime_config/testdefs/testlist_clm.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index d8e5bf02ff..6e510e731d 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1782,7 +1782,7 @@ - + @@ -1794,6 +1794,7 @@ + @@ -1802,6 +1803,8 @@ + + @@ -1827,6 +1830,7 @@ + @@ -1844,6 +1848,7 @@ + @@ -1860,6 +1865,8 @@ + + From daca97b5c55c119224327c7f1ed0610c7931bfe7 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 31 Jan 2020 16:33:29 -0800 Subject: [PATCH 1023/1973] reinstating edison tests to prebeta --- cime_config/testdefs/testlist_clm.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 6e510e731d..e475620633 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1304,6 +1304,7 @@ + From 728d9d79ac753a9a36563552afd32400df431c39 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 20 Sep 2019 10:34:51 -0700 Subject: [PATCH 1024/1973] Initialize soil moisture to a higher value for cold-starts when fates hydro is active. --- src/biogeophys/WaterStateType.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index 398f528ebf..668317546a 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -14,6 +14,7 @@ module WaterStateType use decompMod , only : bounds_type use decompMod , only : BOUNDS_SUBGRID_PATCH, BOUNDS_SUBGRID_COLUMN, BOUNDS_SUBGRID_GRIDCELL use clm_varctl , only : use_bedrock, iulog + use clm_varctl , only : use_fates_planthydro use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb, nlevsno use clm_varcon , only : spval, namec use LandunitType , only : lun @@ -346,7 +347,11 @@ subroutine InitCold(this, bounds, & if (j > nbedrock) then this%h2osoi_vol_col(c,j) = 0.0_r8 else - this%h2osoi_vol_col(c,j) = 0.15_r8 * ratio + if(use_fates_planthydro) then + this%h2osoi_vol_col(c,j) = 0.75_r8*watsat_col(c,j) + else + this%h2osoi_vol_col(c,j) = 0.15_r8 + end if endif end do else if (lun%urbpoi(l)) then From b7f1b4ce86387367c911f6989430b052d58d4a98 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 10 Jan 2020 16:53:47 -0800 Subject: [PATCH 1025/1973] Added surface runoff modifier to the fates interface to account for super-saturation during plant hydraulics. --- src/utils/clmfates_interfaceMod.F90 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 76bcb900ea..538b7258b2 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2196,7 +2196,21 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + + ! This is the water removed from the soil layers by roots (or added) waterfluxbulk_inst%qflx_rootsoi_col(c,1:nlevsoil) = this%fates(nc)%bc_out(s)%qflx_soil2root_sisl(1:nlevsoil) + + ! This is the total amount of water transferred to surface runoff + ! (this is generated potentially from supersaturating soils, or from water lost + ! during mortality and litter fall) + ! This array is set in HydrologyNoDrainage()->Infiltration() + ! This subroutine (ComputeRootSoilFlux()) is (conveniently) called right + ! after that in HydrologyNoDrainage() + + waterfluxbulk_inst%qflx_h2osfc_surf_col(c) = waterfluxbulk_inst%qflx_h2osfc_surf_col(c) + & + this%fates(nc)%bc_out(s)%qflx_surf_ro_si + + end do end subroutine ComputeRootSoilFlux From 2fab1860b79fde95285ea425aa23b608332a5b9d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 22 Jun 2020 17:28:49 -0600 Subject: [PATCH 1026/1973] Move implementation of make_runtime_inputs into python directory This will facilitate unit testing, pylint, and using some of my general-purpose functions. --- lilac/make_runtime_inputs | 278 +---------------------- python/ctsm/lilac_make_runtime_inputs.py | 270 ++++++++++++++++++++++ 2 files changed, 278 insertions(+), 270 deletions(-) create mode 100644 python/ctsm/lilac_make_runtime_inputs.py diff --git a/lilac/make_runtime_inputs b/lilac/make_runtime_inputs index 7d48d82bc6..76082a5fec 100755 --- a/lilac/make_runtime_inputs +++ b/lilac/make_runtime_inputs @@ -1,277 +1,15 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python +"""CTSM namelist creator""" -""" -CTSM namelist creator -""" - -import sys import os -import subprocess -import argparse - -from configparser import ConfigParser -from configparser import NoSectionError, NoOptionError - -_CONFIG_CACHE_TEMPLATE = """ - - - -Specifies clm physics - -""" - -# Note the following is needed in env_lilac.xml otherwise the following error appears in -# the call to build_namelist - -#err=ERROR : CLM build-namelist::CLMBuildNamelist::logical_to_fortran() : -# Unexpected value in logical_to_fortran: - -_ENV_LILAC_TEMPLATE = """ - - - - - logical - TRUE,FALSE - - - -""" - -# This string is used in the out-of-the-box ctsm.cfg file to denote a value that needs to -# be filled in -_PLACEHOLDER = 'FILL_THIS_IN' - -# This string is used in the out-of-the-box ctsm.cfg file to denote a value that can be -# filled in, but doesn't absolutely need to be -_UNSET = 'UNSET' - -############################################################################### -def parse_command_line(args, description): -############################################################################### - - """Parse the command line, return object holding arguments""" - - parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, - description=description) - - parser.add_argument("--rundir", type=str, default=os.getcwd(), - help="Full path of the run directory") - - parser.add_argument("--existing-res", - help="Use the given out-of-the-box resolution (e.g., '4x5').\n" - "This argument should NOT be provided for a user-defined resolution.\n" - "If this argument is provided, then --existing-mask must also be provided.") - - parser.add_argument("--existing-mask", - help="Use the given out-of-the-box mask (e.g., 'gx3v7').\n" - "This argument should NOT be provided for a user-defined resolution.\n" - "If this argument is provided, then --existing-res must also be provided.") - - arguments = parser.parse_args(args) - - # Perform some error checking on arguments, and set derived values - - if not os.path.isdir(arguments.rundir): - sys.exit("rundir {} does not exist".format(arguments.rundir)) - - if arguments.existing_res and arguments.existing_mask: - arguments.use_existing_res_and_mask = True - elif arguments.existing_res and not arguments.existing_mask: - sys.exit("If --existing-res is given, then --existing-mask must also be given") - elif arguments.existing_mask and not arguments.existing_res: - sys.exit("If --existing-mask is given, then --existing-res must also be given") - else: - arguments.use_existing_res_and_mask = False - - return arguments - -############################################################################### -def get_config_value(config, section, item, file_path, allowed_values=None): - """Get a given item from a given section of the config object - - Give a helpful error message if we can't find the given section or item - - Note that the file_path argument is only used for the sake of the error message - - If allowed_values is present, it should be a list of strings giving allowed values - """ - try: - val = config.get(section, item) - except NoSectionError: - sys.exit("ERROR: Config file {} must contain section '{}'".format(file_path, section)) - except NoOptionError: - sys.exit("ERROR: Config file {} must contain item '{}' in section '{}'".format( - file_path, item, section)) - - if val == _PLACEHOLDER: - sys.exit("Error: {} needs to be specified in config file {}".format(item, file_path)) - - if allowed_values is not None: - if val not in allowed_values: - sys.exit("Error: {} is not an allowed value for {} in config file {}\n" - "Allowed values: {}".format(val, item, file_path, allowed_values)) - - return val - -############################################################################### -def determine_bldnml_opts(bgc_mode, crop, vichydro): -############################################################################### - """Return a string giving bldnml options, given some other inputs""" - bldnml_opts = '' - bldnml_opts += ' -bgc {}'.format(bgc_mode) - if bgc_mode == 'fates': - # BUG(wjs, 2020-06-12, ESCOMP/CTSM#115) For now, FATES is incompatible with MEGAN - bldnml_opts += ' -no-megan' - - if crop == 'on': - if bgc_mode not in ['bgc', 'cn']: - sys.exit("Error: setting crop to 'on' is only compatible with bgc_mode of 'bgc' or 'cn'") - bldnml_opts += ' -crop' - - if vichydro == 'on': - if bgc_mode != 'sp': - sys.exit("Error: setting vichydro to 'on' is only compatible with bgc_mode of 'sp'") - bldnml_opts += ' -vichydro' - - return bldnml_opts - -############################################################################### -def buildnml(rundir, bldnmldir, use_existing_res_and_mask, existing_res=None, existing_mask=None): -############################################################################### - - """Build the ctsm namelist - - If use_existing_res_and_mask is True, then existing_res and existing_mask should be - specified; otherwise, they are ignored. - """ - - # pylint: disable=too-many-locals - - file_path = os.path.join(rundir, 'ctsm.cfg') - - # read the config file - config = ConfigParser() - config.read(file_path) - - lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) - if use_existing_res_and_mask: - fsurdat = _UNSET - else: - # If we're not using an out-of-the-box grid, then require the user to explicitly - # specify the surface dataset. - fsurdat = get_config_value(config, 'buildnml_input', 'fsurdat', file_path) - finidat = get_config_value(config, 'buildnml_input', 'finidat', file_path) - - ctsm_phys = get_config_value(config, 'buildnml_input', 'ctsm_phys', file_path, - allowed_values=['clm4_5', 'clm5_0']) - configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path, - allowed_values=['nwp', 'clm']) - structure = get_config_value(config, 'buildnml_input', 'structure', file_path, - allowed_values=['fast', 'standard']) - bgc_mode = get_config_value(config, 'buildnml_input', 'bgc_mode', file_path, - allowed_values=['sp', 'bgc', 'cn', 'fates']) - crop = get_config_value(config, 'buildnml_input', 'crop', file_path, - allowed_values=['off', 'on']) - vichydro = get_config_value(config, 'buildnml_input', 'vichydro', file_path, - allowed_values=['off', 'on']) - - bldnml_opts = determine_bldnml_opts(bgc_mode=bgc_mode, - crop=crop, - vichydro=vichydro) - - co2_ppmv = get_config_value(config, 'buildnml_input', 'co2_ppmv', file_path) - use_case = get_config_value(config, 'buildnml_input', 'use_case', file_path) - lnd_tuning_mode = get_config_value(config, 'buildnml_input', 'lnd_tuning_mode', file_path) - spinup = get_config_value(config, 'buildnml_input', 'spinup', file_path, - allowed_values=['off', 'on']) - - inputdata_path = get_config_value(config, 'buildnml_input', 'inputdata_path', file_path) - - # create config_cache.xml file - # Note that build-namelist utilizes the contents of the config_cache.xml file in - # the namelist_defaults.xml file to obtain namelist variables - config_cache = os.path.join(rundir, "config_cache.xml") - config_cache_text = _CONFIG_CACHE_TEMPLATE.format(clm_phys=ctsm_phys) - with open(config_cache, 'w') as tempfile: - tempfile.write(config_cache_text) - - # create temporary env_lilac.xml - env_lilac = os.path.join(rundir, "env_lilac.xml") - env_lilac_text = _ENV_LILAC_TEMPLATE.format() - with open(env_lilac, 'w') as tempfile: - tempfile.write(env_lilac_text) - - # remove any existing clm.input_data_list file - inputdatalist_path = os.path.join(rundir, "clm.input_data_list") - if os.path.exists(inputdatalist_path): - os.remove(inputdatalist_path) - - # determine if fsurdat and/or finidat should appear in the -namelist option - extra_namelist_opts = '' - if fsurdat != _UNSET: - extra_namelist_opts = extra_namelist_opts + " fsurdat = '{}' ".format(fsurdat) - if finidat != _UNSET: - extra_namelist_opts = extra_namelist_opts + " finidat = '{}' ".format(finidat) - - # call build-namelist - cmd = os.path.abspath(os.path.join(bldnmldir, os.pardir, "bld", "build-namelist")) - command = [cmd, - '-csmdata', inputdata_path, - '-inputdata', inputdatalist_path, - # Hard-code start_ymd of year-2000. This is used to set the run type (for - # which a setting of 2000 gives 'startup', which is what we want) and pick - # the initial conditions file (which is pretty much irrelevant when running - # with lilac). - '-namelist', '&clm_inparm start_ymd=20000101 {} /'.format(extra_namelist_opts), - '-use_case', use_case, - '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date - '-clm_start_type', 'default', # seems unimportant (see discussion in https://github.com/ESCOMP/CTSM/issues/876) - '-configuration', configuration, - '-structure', structure, - '-lnd_frac', lnd_domain_file, - '-glc_nec', str(10), - '-co2_ppmv', co2_ppmv, - '-co2_type', 'constant', - '-clm_accelerated_spinup', spinup, - '-lnd_tuning_mode', lnd_tuning_mode, - '-no-megan', # Eventually make this dynamic (see https://github.com/ESCOMP/CTSM/issues/926) - '-config', os.path.join(rundir, "config_cache.xml"), - '-envxml_dir', rundir] - if use_existing_res_and_mask: - command.extend(['-res', existing_res, - '-mask', existing_mask]) - else: - # NOTE(wjs, 2020-06-16) Note that we do NOT use the -mask argument in this case; - # it's possible that we should be using it in some circumstances (I haven't looked - # into how it's used). - command.extend(['-res', 'lilac', - '-clm_usr_name', 'lilac']) - command.extend(bldnml_opts.split()) - - subprocess.check_call(command, - universal_newlines=True) - - # remove temporary files in rundir - os.remove(os.path.join(rundir, "config_cache.xml")) - os.remove(os.path.join(rundir, "env_lilac.xml")) - os.remove(os.path.join(rundir, "drv_flds_in")) - -############################################################################### -def main(): - """Main function""" - - args = parse_command_line(sys.argv[1:], __doc__) - bldnmldir = os.path.dirname(os.path.realpath(__file__)) - buildnml( - rundir=args.rundir, - bldnmldir=bldnmldir, - use_existing_res_and_mask=args.use_existing_res_and_mask, - existing_res=args.existing_res, - existing_mask=args.existing_mask) +import sys +_CTSM_PYTHON = os.path.join(os.path.dirname(os.path.realpath(__file__)), + os.pardir, + 'python') +sys.path.insert(1, _CTSM_PYTHON) -############################################################################### +from ctsm.lilac_make_runtime_inputs import main if __name__ == "__main__": main() diff --git a/python/ctsm/lilac_make_runtime_inputs.py b/python/ctsm/lilac_make_runtime_inputs.py new file mode 100644 index 0000000000..9313cdb45a --- /dev/null +++ b/python/ctsm/lilac_make_runtime_inputs.py @@ -0,0 +1,270 @@ +"""Functions implementing LILAC's make_runtime_inputs command""" + +import sys +import os +import subprocess +import argparse + +from configparser import ConfigParser +from configparser import NoSectionError, NoOptionError + +from ctsm.path_utils import path_to_ctsm_root + +_CONFIG_CACHE_TEMPLATE = """ + + + +Specifies clm physics + +""" + +# Note the following is needed in env_lilac.xml otherwise the following error appears in +# the call to build_namelist + +#err=ERROR : CLM build-namelist::CLMBuildNamelist::logical_to_fortran() : +# Unexpected value in logical_to_fortran: + +_ENV_LILAC_TEMPLATE = """ + + + + + logical + TRUE,FALSE + + + +""" + +# This string is used in the out-of-the-box ctsm.cfg file to denote a value that needs to +# be filled in +_PLACEHOLDER = 'FILL_THIS_IN' + +# This string is used in the out-of-the-box ctsm.cfg file to denote a value that can be +# filled in, but doesn't absolutely need to be +_UNSET = 'UNSET' + +############################################################################### +def parse_command_line(args, description): +############################################################################### + + """Parse the command line, return object holding arguments""" + + parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, + description=description) + + parser.add_argument("--rundir", type=str, default=os.getcwd(), + help="Full path of the run directory") + + parser.add_argument("--existing-res", + help="Use the given out-of-the-box resolution (e.g., '4x5').\n" + "This argument should NOT be provided for a user-defined resolution.\n" + "If this argument is provided, then --existing-mask must also be provided.") + + parser.add_argument("--existing-mask", + help="Use the given out-of-the-box mask (e.g., 'gx3v7').\n" + "This argument should NOT be provided for a user-defined resolution.\n" + "If this argument is provided, then --existing-res must also be provided.") + + arguments = parser.parse_args(args) + + # Perform some error checking on arguments, and set derived values + + if not os.path.isdir(arguments.rundir): + sys.exit("rundir {} does not exist".format(arguments.rundir)) + + if arguments.existing_res and arguments.existing_mask: + arguments.use_existing_res_and_mask = True + elif arguments.existing_res and not arguments.existing_mask: + sys.exit("If --existing-res is given, then --existing-mask must also be given") + elif arguments.existing_mask and not arguments.existing_res: + sys.exit("If --existing-mask is given, then --existing-res must also be given") + else: + arguments.use_existing_res_and_mask = False + + return arguments + +############################################################################### +def get_config_value(config, section, item, file_path, allowed_values=None): + """Get a given item from a given section of the config object + + Give a helpful error message if we can't find the given section or item + + Note that the file_path argument is only used for the sake of the error message + + If allowed_values is present, it should be a list of strings giving allowed values + """ + try: + val = config.get(section, item) + except NoSectionError: + sys.exit("ERROR: Config file {} must contain section '{}'".format(file_path, section)) + except NoOptionError: + sys.exit("ERROR: Config file {} must contain item '{}' in section '{}'".format( + file_path, item, section)) + + if val == _PLACEHOLDER: + sys.exit("Error: {} needs to be specified in config file {}".format(item, file_path)) + + if allowed_values is not None: + if val not in allowed_values: + sys.exit("Error: {} is not an allowed value for {} in config file {}\n" + "Allowed values: {}".format(val, item, file_path, allowed_values)) + + return val + +############################################################################### +def determine_bldnml_opts(bgc_mode, crop, vichydro): +############################################################################### + """Return a string giving bldnml options, given some other inputs""" + bldnml_opts = '' + bldnml_opts += ' -bgc {}'.format(bgc_mode) + if bgc_mode == 'fates': + # BUG(wjs, 2020-06-12, ESCOMP/CTSM#115) For now, FATES is incompatible with MEGAN + bldnml_opts += ' -no-megan' + + if crop == 'on': + if bgc_mode not in ['bgc', 'cn']: + sys.exit("Error: setting crop to 'on' is only compatible with bgc_mode of 'bgc' or 'cn'") + bldnml_opts += ' -crop' + + if vichydro == 'on': + if bgc_mode != 'sp': + sys.exit("Error: setting vichydro to 'on' is only compatible with bgc_mode of 'sp'") + bldnml_opts += ' -vichydro' + + return bldnml_opts + +############################################################################### +def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask=None): +############################################################################### + + """Build the ctsm namelist + + If use_existing_res_and_mask is True, then existing_res and existing_mask should be + specified; otherwise, they are ignored. + """ + + # pylint: disable=too-many-locals + + file_path = os.path.join(rundir, 'ctsm.cfg') + + # read the config file + config = ConfigParser() + config.read(file_path) + + lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) + if use_existing_res_and_mask: + fsurdat = _UNSET + else: + # If we're not using an out-of-the-box grid, then require the user to explicitly + # specify the surface dataset. + fsurdat = get_config_value(config, 'buildnml_input', 'fsurdat', file_path) + finidat = get_config_value(config, 'buildnml_input', 'finidat', file_path) + + ctsm_phys = get_config_value(config, 'buildnml_input', 'ctsm_phys', file_path, + allowed_values=['clm4_5', 'clm5_0']) + configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path, + allowed_values=['nwp', 'clm']) + structure = get_config_value(config, 'buildnml_input', 'structure', file_path, + allowed_values=['fast', 'standard']) + bgc_mode = get_config_value(config, 'buildnml_input', 'bgc_mode', file_path, + allowed_values=['sp', 'bgc', 'cn', 'fates']) + crop = get_config_value(config, 'buildnml_input', 'crop', file_path, + allowed_values=['off', 'on']) + vichydro = get_config_value(config, 'buildnml_input', 'vichydro', file_path, + allowed_values=['off', 'on']) + + bldnml_opts = determine_bldnml_opts(bgc_mode=bgc_mode, + crop=crop, + vichydro=vichydro) + + co2_ppmv = get_config_value(config, 'buildnml_input', 'co2_ppmv', file_path) + use_case = get_config_value(config, 'buildnml_input', 'use_case', file_path) + lnd_tuning_mode = get_config_value(config, 'buildnml_input', 'lnd_tuning_mode', file_path) + spinup = get_config_value(config, 'buildnml_input', 'spinup', file_path, + allowed_values=['off', 'on']) + + inputdata_path = get_config_value(config, 'buildnml_input', 'inputdata_path', file_path) + + # create config_cache.xml file + # Note that build-namelist utilizes the contents of the config_cache.xml file in + # the namelist_defaults.xml file to obtain namelist variables + config_cache = os.path.join(rundir, "config_cache.xml") + config_cache_text = _CONFIG_CACHE_TEMPLATE.format(clm_phys=ctsm_phys) + with open(config_cache, 'w') as tempfile: + tempfile.write(config_cache_text) + + # create temporary env_lilac.xml + env_lilac = os.path.join(rundir, "env_lilac.xml") + env_lilac_text = _ENV_LILAC_TEMPLATE.format() + with open(env_lilac, 'w') as tempfile: + tempfile.write(env_lilac_text) + + # remove any existing clm.input_data_list file + inputdatalist_path = os.path.join(rundir, "clm.input_data_list") + if os.path.exists(inputdatalist_path): + os.remove(inputdatalist_path) + + # determine if fsurdat and/or finidat should appear in the -namelist option + extra_namelist_opts = '' + if fsurdat != _UNSET: + extra_namelist_opts = extra_namelist_opts + " fsurdat = '{}' ".format(fsurdat) + if finidat != _UNSET: + extra_namelist_opts = extra_namelist_opts + " finidat = '{}' ".format(finidat) + + # call build-namelist + cmd = os.path.abspath(os.path.join(path_to_ctsm_root(), "bld", "build-namelist")) + command = [cmd, + '-csmdata', inputdata_path, + '-inputdata', inputdatalist_path, + # Hard-code start_ymd of year-2000. This is used to set the run type (for + # which a setting of 2000 gives 'startup', which is what we want) and pick + # the initial conditions file (which is pretty much irrelevant when running + # with lilac). + '-namelist', '&clm_inparm start_ymd=20000101 {} /'.format(extra_namelist_opts), + '-use_case', use_case, + '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date + '-clm_start_type', 'default', # seems unimportant (see discussion in https://github.com/ESCOMP/CTSM/issues/876) + '-configuration', configuration, + '-structure', structure, + '-lnd_frac', lnd_domain_file, + '-glc_nec', str(10), + '-co2_ppmv', co2_ppmv, + '-co2_type', 'constant', + '-clm_accelerated_spinup', spinup, + '-lnd_tuning_mode', lnd_tuning_mode, + '-no-megan', # Eventually make this dynamic (see https://github.com/ESCOMP/CTSM/issues/926) + '-config', os.path.join(rundir, "config_cache.xml"), + '-envxml_dir', rundir] + if use_existing_res_and_mask: + command.extend(['-res', existing_res, + '-mask', existing_mask]) + else: + # NOTE(wjs, 2020-06-16) Note that we do NOT use the -mask argument in this case; + # it's possible that we should be using it in some circumstances (I haven't looked + # into how it's used). + command.extend(['-res', 'lilac', + '-clm_usr_name', 'lilac']) + command.extend(bldnml_opts.split()) + + subprocess.check_call(command, + universal_newlines=True) + + # remove temporary files in rundir + os.remove(os.path.join(rundir, "config_cache.xml")) + os.remove(os.path.join(rundir, "env_lilac.xml")) + os.remove(os.path.join(rundir, "drv_flds_in")) + +############################################################################### +def main(): + """Main function""" + + args = parse_command_line(sys.argv[1:], __doc__) + buildnml( + rundir=args.rundir, + use_existing_res_and_mask=args.use_existing_res_and_mask, + existing_res=args.existing_res, + existing_mask=args.existing_mask) + + +############################################################################### From b827ac749db75a76f4b0862e1bb55dd3df104951 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 30 Jan 2020 14:03:36 -0800 Subject: [PATCH 1027/1973] Condition the zeroing of qflx bc_in upon having hydro on. --- src/utils/clmfates_interfaceMod.F90 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 538b7258b2..747a8beca8 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1421,6 +1421,13 @@ subroutine prep_canopyfluxes(this, nc, fn, filterp, photosyns_inst) do s = 1, this%fates(nc)%nsites ! filter flag == 1 means that this patch has not been called for photosynthesis this%fates(nc)%bc_in(s)%filter_photo_pa(:) = 1 + + ! set transpiration input boundary condition to zero. The exposed + ! vegetation filter may not even call every patch. + if (use_fates_planthydro) then + this%fates(nc)%bc_in(s)%qflx_transp_pa(:) = 0._r8 + end if + end do end subroutine prep_canopyfluxes From 6a124a1174a002f82c95687603147e97cb11bd9c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 22 Jun 2020 17:46:21 -0600 Subject: [PATCH 1028/1973] Add some standard things (logging, etc.) in lilac_make_runtime_inputs.py --- python/ctsm/lilac_make_runtime_inputs.py | 55 ++++++++++++++++-------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/python/ctsm/lilac_make_runtime_inputs.py b/python/ctsm/lilac_make_runtime_inputs.py index 9313cdb45a..6a4a1997c8 100644 --- a/python/ctsm/lilac_make_runtime_inputs.py +++ b/python/ctsm/lilac_make_runtime_inputs.py @@ -1,14 +1,22 @@ """Functions implementing LILAC's make_runtime_inputs command""" -import sys import os import subprocess import argparse +import logging from configparser import ConfigParser from configparser import NoSectionError, NoOptionError +from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args from ctsm.path_utils import path_to_ctsm_root +from ctsm.utils import abort + +logger = logging.getLogger(__name__) + +# ======================================================================== +# Define some constants +# ======================================================================== _CONFIG_CACHE_TEMPLATE = """ @@ -45,11 +53,15 @@ _UNSET = 'UNSET' ############################################################################### -def parse_command_line(args, description): +def parse_command_line(): ############################################################################### """Parse the command line, return object holding arguments""" + description = """ +Script to create runtime inputs when running CTSM via LILAC +""" + parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=description) @@ -66,19 +78,21 @@ def parse_command_line(args, description): "This argument should NOT be provided for a user-defined resolution.\n" "If this argument is provided, then --existing-res must also be provided.") - arguments = parser.parse_args(args) + add_logging_args(parser) + + arguments = parser.parse_args() # Perform some error checking on arguments, and set derived values if not os.path.isdir(arguments.rundir): - sys.exit("rundir {} does not exist".format(arguments.rundir)) + abort("rundir {} does not exist".format(arguments.rundir)) if arguments.existing_res and arguments.existing_mask: arguments.use_existing_res_and_mask = True elif arguments.existing_res and not arguments.existing_mask: - sys.exit("If --existing-res is given, then --existing-mask must also be given") + abort("If --existing-res is given, then --existing-mask must also be given") elif arguments.existing_mask and not arguments.existing_res: - sys.exit("If --existing-mask is given, then --existing-res must also be given") + abort("If --existing-mask is given, then --existing-res must also be given") else: arguments.use_existing_res_and_mask = False @@ -97,18 +111,18 @@ def get_config_value(config, section, item, file_path, allowed_values=None): try: val = config.get(section, item) except NoSectionError: - sys.exit("ERROR: Config file {} must contain section '{}'".format(file_path, section)) + abort("ERROR: Config file {} must contain section '{}'".format(file_path, section)) except NoOptionError: - sys.exit("ERROR: Config file {} must contain item '{}' in section '{}'".format( + abort("ERROR: Config file {} must contain item '{}' in section '{}'".format( file_path, item, section)) if val == _PLACEHOLDER: - sys.exit("Error: {} needs to be specified in config file {}".format(item, file_path)) + abort("Error: {} needs to be specified in config file {}".format(item, file_path)) if allowed_values is not None: if val not in allowed_values: - sys.exit("Error: {} is not an allowed value for {} in config file {}\n" - "Allowed values: {}".format(val, item, file_path, allowed_values)) + abort("Error: {} is not an allowed value for {} in config file {}\n" + "Allowed values: {}".format(val, item, file_path, allowed_values)) return val @@ -124,12 +138,12 @@ def determine_bldnml_opts(bgc_mode, crop, vichydro): if crop == 'on': if bgc_mode not in ['bgc', 'cn']: - sys.exit("Error: setting crop to 'on' is only compatible with bgc_mode of 'bgc' or 'cn'") + abort("Error: setting crop to 'on' is only compatible with bgc_mode of 'bgc' or 'cn'") bldnml_opts += ' -crop' if vichydro == 'on': if bgc_mode != 'sp': - sys.exit("Error: setting vichydro to 'on' is only compatible with bgc_mode of 'sp'") + abort("Error: setting vichydro to 'on' is only compatible with bgc_mode of 'sp'") bldnml_opts += ' -vichydro' return bldnml_opts @@ -223,8 +237,11 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask # with lilac). '-namelist', '&clm_inparm start_ymd=20000101 {} /'.format(extra_namelist_opts), '-use_case', use_case, - '-ignore_ic_year', # For now, we assume ignore_ic_year, not ignore_ic_date - '-clm_start_type', 'default', # seems unimportant (see discussion in https://github.com/ESCOMP/CTSM/issues/876) + # For now, we assume ignore_ic_year, not ignore_ic_date + '-ignore_ic_year', + # -clm_start_type seems unimportant (see discussion in + # https://github.com/ESCOMP/CTSM/issues/876) + '-clm_start_type', 'default', '-configuration', configuration, '-structure', structure, '-lnd_frac', lnd_domain_file, @@ -233,7 +250,9 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask '-co2_type', 'constant', '-clm_accelerated_spinup', spinup, '-lnd_tuning_mode', lnd_tuning_mode, - '-no-megan', # Eventually make this dynamic (see https://github.com/ESCOMP/CTSM/issues/926) + # Eventually make -no-megan dynamic (see + # https://github.com/ESCOMP/CTSM/issues/926) + '-no-megan', '-config', os.path.join(rundir, "config_cache.xml"), '-envxml_dir', rundir] if use_existing_res_and_mask: @@ -258,8 +277,10 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask ############################################################################### def main(): """Main function""" + setup_logging_pre_config() + args = parse_command_line() + process_logging_args(args) - args = parse_command_line(sys.argv[1:], __doc__) buildnml( rundir=args.rundir, use_existing_res_and_mask=args.use_existing_res_and_mask, From 812112a8e5f482f185ef52f9d53ee5bcbd5ff6db Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 5 Feb 2020 10:46:10 -0800 Subject: [PATCH 1029/1973] Update fates interface to use a call to fatesglobals instead of just prtglobals --- src/utils/clmfates_interfaceMod.F90 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 747a8beca8..01f13bd4e2 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -105,7 +105,7 @@ module CLMFatesInterfaceMod use FatesInterfaceMod , only : allocate_bcout use FatesInterfaceMod , only : SetFatesTime use FatesInterfaceMod , only : set_fates_ctrlparms - use FatesInterfaceMod , only : InitPARTEHGlobals + use FatesHistoryInterfaceMod, only : fates_history_interface_type use FatesRestartInterfaceMod, only : fates_restart_interface_type @@ -119,6 +119,7 @@ module CLMFatesInterfaceMod use EDInitMod , only : init_site_vars use EDInitMod , only : init_patches use EDInitMod , only : set_site_properties + use EDInitMod , only : InitFatesGlobals use EDPftVarcon , only : EDpftvarcon_inst use EDSurfaceRadiationMod , only : ED_SunShadeFracs, ED_Norman_Radiation use EDBtranMod , only : btran_ed, & @@ -500,13 +501,11 @@ subroutine init(this, bounds_proc ) end do !$OMP END PARALLEL DO - ! This will initialize all globals associated with the chosen - ! Plant Allocation and Reactive Transport hypothesis. This includes - ! mapping tables and global variables. These will be read-only - ! and only required once per machine instance (thus no requirements - ! to have it instanced on each thread + ! This will initialize all FATES globals, + ! particular PARTEH and HYDRO globals + + call InitFatesGlobals(masterproc) - call InitPARTEHGlobals() call this%init_history_io(bounds_proc) From 97f2471bf612248c84afbef9e5c4e9540a2f5deb Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 5 Feb 2020 12:46:41 -0800 Subject: [PATCH 1030/1973] Updating fates tag and default parameter file match api 8.1 --- Externals_CLM.cfg | 2 +- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index f38a229b9f..1307d05c14 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.30.0_api.8.0.0 +tag = sci.1.33.0_api.8.1.0 required = True [PTCLM] diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 2752f17214..0e6458b6d9 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -400,7 +400,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.8.0.0_12pft_c191216.nc +lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c200103.nc From d18d552556dc86750571bff53fb3e03b2b37b20c Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 13 Feb 2020 10:26:35 -0800 Subject: [PATCH 1031/1973] Provisions for fates-hydro, supersaturating soils. --- src/biogeophys/SoilWaterMovementMod.F90 | 18 ++++++++++-------- src/utils/clmfates_interfaceMod.F90 | 11 +++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 index 8c408c9659..b543f5d1b9 100644 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ b/src/biogeophys/SoilWaterMovementMod.F90 @@ -572,6 +572,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & qflx_infl => waterfluxbulk_inst%qflx_infl_col , & ! Input: [real(r8) (:) ] infiltration (mm H2O /s) qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:,:) ] vegetation/soil water exchange (mm H2O/s) (+ = to atm) + qflx_drain_vr_col => waterfluxbulk_inst%qflx_drain_vr_col , & ! Input: [real(r8) (:,:) ] drainage from soil layers due to plant induced t_soisno => temperature_inst%t_soisno_col & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) ) @@ -774,7 +775,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & qout(c,j) = -hk(c,j)*num/den dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den dqodw2(c,j) = -( hk(c,j)*dsmpdw(c,j+1) + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) + rmx(c,j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j) + qflx_drain_vr_col(c,j)) amx(c,j) = 0._r8 bmx(c,j) = dzmm(c,j)*(sdamp+1._r8/dtime) + dqodw1(c,j) cmx(c,j) = dqodw2(c,j) @@ -798,7 +799,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & qout(c,j) = -hk(c,j)*num/den dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den dqodw2(c,j) = -( hk(c,j)*dsmpdw(c,j+1) + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) + rmx(c,j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j)+qflx_drain_vr_col(c,j)) amx(c,j) = -dqidw0(c,j) bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) cmx(c,j) = dqodw2(c,j) @@ -820,7 +821,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & dqidw1(c,j) = -( hk(c,j-1)*dsmpdw(c,j) + num*dhkdw(c,j-1))/den qout(c,j) = 0._r8 dqodw1(c,j) = 0._r8 - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) + rmx(c,j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j)+qflx_drain_vr_col(c,j)) amx(c,j) = -dqidw0(c,j) bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) cmx(c,j) = 0._r8 @@ -863,7 +864,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den dqodw2(c,j) = -( hk(c,j)*dsmpdw1 + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) + rmx(c,j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j)+qflx_drain_vr_col(c,j)) amx(c,j) = -dqidw0(c,j) bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) cmx(c,j) = dqodw2(c,j) @@ -1153,7 +1154,8 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice water (kg/m2) h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col & + qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col , & + qflx_drain_vr_col => waterfluxbulk_inst%qflx_drain_vr_col & ) ! end associate statement ! Get time step @@ -1220,7 +1222,7 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & ! RHS of system of equations call compute_RHS_moisture_form(c, nlayers, & - qflx_rootsoi_col(c,1:nlayers), & + (qflx_rootsoi_col(c,1:nlayers) + qflx_drain_vr_col(c,1:nlayers)), & vwc_liq(c,1:nlayers), & qin(c,1:nlayers), & qout(c,1:nlayers), & @@ -1313,7 +1315,7 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & endif ! compute the net flux - fluxNet0(j) = qin_test - qout_test - qflx_rootsoi_col(c,j) + fluxNet0(j) = qin_test - qout_test - (qflx_rootsoi_col(c,j) + qflx_drain_vr_col(c,j)) ! flux calculation is inexpensive else @@ -1324,7 +1326,7 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & endif ! switch between the expensive and inexpensive fluxcalculations ! compute the net flux at the start of the sub-step - fluxNet1(j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) + fluxNet1(j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j)+qflx_drain_vr_col(c,j)) end do ! looping through layers diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 01f13bd4e2..47211cc9d7 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2207,15 +2207,10 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & waterfluxbulk_inst%qflx_rootsoi_col(c,1:nlevsoil) = this%fates(nc)%bc_out(s)%qflx_soil2root_sisl(1:nlevsoil) ! This is the total amount of water transferred to surface runoff - ! (this is generated potentially from supersaturating soils, or from water lost - ! during mortality and litter fall) - ! This array is set in HydrologyNoDrainage()->Infiltration() - ! This subroutine (ComputeRootSoilFlux()) is (conveniently) called right - ! after that in HydrologyNoDrainage() - - waterfluxbulk_inst%qflx_h2osfc_surf_col(c) = waterfluxbulk_inst%qflx_h2osfc_surf_col(c) + & - this%fates(nc)%bc_out(s)%qflx_surf_ro_si + ! (this is generated potentially from supersaturating soils + waterflux_inst%qflx_drain_vr_col(c,1:nlevsoil) = this%fates(nc)%bc_out(s)%qflx_ro_sisl(1:nlevsoil) + end do From f49862a305137a5b2c95378286205ca0ab33c9a1 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 13 Feb 2020 13:22:22 -0800 Subject: [PATCH 1032/1973] Allowing soilpsi_col diagnostic with fates --- src/biogeophys/SoilStateType.F90 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/biogeophys/SoilStateType.F90 b/src/biogeophys/SoilStateType.F90 index 8d36a8095d..f7bddbb92b 100644 --- a/src/biogeophys/SoilStateType.F90 +++ b/src/biogeophys/SoilStateType.F90 @@ -214,15 +214,15 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='soil matric potential (natural vegetated and crop landunits only)', & ptr_col=this%smp_l_col, set_spec=spval, l2g_scale_type='veg') - this%root_conductance_patch(begp:endp,:) = spval - call hist_addfld2d (fname='KROOT', units='1/s', type2d='levsoi', & - avgflag='A', long_name='root conductance each soil layer', & - ptr_patch=this%root_conductance_patch, default='inactive') - - this%soil_conductance_patch(begp:endp,:) = spval - call hist_addfld2d (fname='KSOIL', units='1/s', type2d='levsoi', & - avgflag='A', long_name='soil conductance in each soil layer', & - ptr_patch=this%soil_conductance_patch, default='inactive') + this%root_conductance_patch(begp:endp,:) = spval + call hist_addfld2d (fname='KROOT', units='1/s', type2d='levsoi', & + avgflag='A', long_name='root conductance each soil layer', & + ptr_patch=this%root_conductance_patch, default='inactive') + + this%soil_conductance_patch(begp:endp,:) = spval + call hist_addfld2d (fname='KSOIL', units='1/s', type2d='levsoi', & + avgflag='A', long_name='soil conductance in each soil layer', & + ptr_patch=this%soil_conductance_patch, default='inactive') if (use_cn) then this%bsw_col(begc:endc,:) = spval @@ -263,7 +263,7 @@ subroutine InitHistory(this, bounds) end if - if (use_cn) then + if (use_cn .or. use_fates) then this%soilpsi_col(begc:endc,:) = spval call hist_addfld2d (fname='SOILPSI', units='MPa', type2d='levgrnd', & avgflag='A', long_name='soil water potential in each soil layer', & From 41a61b2eaefa2405f40048b8d6f1ad72ca3e30e7 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 13 Feb 2020 13:22:58 -0800 Subject: [PATCH 1033/1973] Allowing soilpsi_col diagnostic with fates --- src/biogeophys/SoilStateType.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeophys/SoilStateType.F90 b/src/biogeophys/SoilStateType.F90 index f7bddbb92b..6500166bd9 100644 --- a/src/biogeophys/SoilStateType.F90 +++ b/src/biogeophys/SoilStateType.F90 @@ -9,7 +9,7 @@ module SoilStateType use abortutils , only : endrun use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlayer, nlevsno use clm_varcon , only : spval - use clm_varctl , only : use_hydrstress, use_cn, use_lch4, use_dynroot + use clm_varctl , only : use_hydrstress, use_cn, use_lch4, use_dynroot, use_fates use clm_varctl , only : iulog, hist_wrtch4diag use LandunitType , only : lun use ColumnType , only : col From e906294f288385e86ee54e6075418a345a9293ef Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 13 Feb 2020 21:05:24 -0800 Subject: [PATCH 1034/1973] fates-hydro: changed subroutine arguments --- src/utils/clmfates_interfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 47211cc9d7..c457fd8983 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -475,7 +475,7 @@ subroutine init(this, bounds_proc ) call this%init_soil_depths(nc) if (use_fates_planthydro) then - call InitHydrSites(this%fates(nc)%sites,this%fates(nc)%bc_in,maxveg_ed) + call InitHydrSites(this%fates(nc)%sites,this%fates(nc)%bc_in) end if From cde5c258a2013b9746bafa7430b85e8a6bbe08c1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 22 Jun 2020 18:19:05 -0600 Subject: [PATCH 1035/1973] Add unit tests of determine_bldnml_opts --- .../test_unit_lilac_make_runtime_inputs.py | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 python/ctsm/test/test_unit_lilac_make_runtime_inputs.py diff --git a/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py b/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py new file mode 100755 index 0000000000..bf28e6e265 --- /dev/null +++ b/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +"""Unit tests for lilac_make_runtime_inputs +""" + +import unittest + +from ctsm import unit_testing +from ctsm.lilac_make_runtime_inputs import determine_bldnml_opts + +# Allow names that pylint doesn't like, because otherwise I find it hard +# to make readable unit test names +# pylint: disable=invalid-name + +class TestMakeRuntimeInputs(unittest.TestCase): + """Tests of lilac_make_runtime_inputs""" + + def test_buildnmlOpts_bgc(self): + """Test determine_buildnml_opts with bgc_mode='bgc'""" + bldnml_opts = determine_bldnml_opts(bgc_mode='bgc', crop='off', vichydro='off') + self.assertRegex(bldnml_opts, r'^ *-bgc bgc *$') + + def test_buildnmlOpts_fates(self): + """Test determine_buildnml_opts with bgc_mode='fates'""" + bldnml_opts = determine_bldnml_opts(bgc_mode='fates', crop='off', vichydro='off') + self.assertRegex(bldnml_opts, r'^ *-bgc fates +-no-megan *$') + + def test_buildnmlOpts_bgcCrop(self): + """Test determine_buildnml_opts with bgc_mode='bgc' and crop on""" + bldnml_opts = determine_bldnml_opts(bgc_mode='bgc', crop='on', vichydro='off') + self.assertRegex(bldnml_opts, r'^ *-bgc bgc +-crop *$') + + def test_buildnmlOpts_spCrop_fails(self): + """Test determine_buildnml_opts with bgc_mode='sp' and crop on: should fail""" + with self.assertRaisesRegex(SystemExit, "setting crop to 'on' is only compatible with bgc_mode"): + _ = determine_bldnml_opts(bgc_mode='sp', crop='on', vichydro='off') + + def test_buildnmlOpts_spVic(self): + """Test determine_buildnml_opts with bgc_mode='sp' and vic on""" + bldnml_opts = determine_bldnml_opts(bgc_mode='sp', crop='off', vichydro='on') + self.assertRegex(bldnml_opts, r'^ *-bgc sp +-vichydro *$') + + def test_buildnmlOpts_bgcVic(self): + """Test determine_buildnml_opts with bgc_mode='bgc' and vic on: should fail""" + with self.assertRaisesRegex( + SystemExit, + "setting vichydro to 'on' is only compatible with bgc_mode of 'sp'"): + _ = determine_bldnml_opts(bgc_mode='bgc', crop='off', vichydro='on') + +if __name__ == '__main__': + unit_testing.setup_for_tests() + unittest.main() From a4733bbc2c1f2b32362d4c523d3a2773208301ba Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Jun 2020 08:43:57 -0600 Subject: [PATCH 1036/1973] Support a user_nl_ctsm file in the lilac runtime input workflow --- lilac/make_runtime_inputs | 1 + python/ctsm/lilac_make_runtime_inputs.py | 60 +++++++++++++++++------- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/lilac/make_runtime_inputs b/lilac/make_runtime_inputs index 76082a5fec..6d8db14985 100755 --- a/lilac/make_runtime_inputs +++ b/lilac/make_runtime_inputs @@ -8,6 +8,7 @@ _CTSM_PYTHON = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, 'python') sys.path.insert(1, _CTSM_PYTHON) +from ctsm import add_cime_to_path from ctsm.lilac_make_runtime_inputs import main diff --git a/python/ctsm/lilac_make_runtime_inputs.py b/python/ctsm/lilac_make_runtime_inputs.py index 6a4a1997c8..a2cb94ec68 100644 --- a/python/ctsm/lilac_make_runtime_inputs.py +++ b/python/ctsm/lilac_make_runtime_inputs.py @@ -12,6 +12,8 @@ from ctsm.path_utils import path_to_ctsm_root from ctsm.utils import abort +from CIME.buildnml import create_namelist_infile + logger = logging.getLogger(__name__) # ======================================================================== @@ -52,6 +54,22 @@ # filled in, but doesn't absolutely need to be _UNSET = 'UNSET' +# ======================================================================== +# Fake case object that can be used to satisfy the interface of CIME functions that need a +# case object +# ======================================================================== + +class CaseFake: + def __init__(self): + pass + + def get_resolved_value(self, value): + """Make sure get_resolved_value doesn't get called + + (since we don't have a real case object to resolve values with) + """ + abort("Cannot resolve value with a '$' variable: {}".format(value)) + ############################################################################### def parse_command_line(): ############################################################################### @@ -66,7 +84,7 @@ def parse_command_line(): description=description) parser.add_argument("--rundir", type=str, default=os.getcwd(), - help="Full path of the run directory") + help="Full path of the run directory (containing ctsm.cfg & user_nl_ctsm)") parser.add_argument("--existing-res", help="Use the given out-of-the-box resolution (e.g., '4x5').\n" @@ -160,45 +178,51 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask # pylint: disable=too-many-locals - file_path = os.path.join(rundir, 'ctsm.cfg') + ctsm_cfg_path = os.path.join(rundir, 'ctsm.cfg') # read the config file config = ConfigParser() - config.read(file_path) + config.read(ctsm_cfg_path) - lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', file_path) + lnd_domain_file = get_config_value(config, 'buildnml_input', 'lnd_domain_file', ctsm_cfg_path) if use_existing_res_and_mask: fsurdat = _UNSET else: # If we're not using an out-of-the-box grid, then require the user to explicitly # specify the surface dataset. - fsurdat = get_config_value(config, 'buildnml_input', 'fsurdat', file_path) - finidat = get_config_value(config, 'buildnml_input', 'finidat', file_path) + fsurdat = get_config_value(config, 'buildnml_input', 'fsurdat', ctsm_cfg_path) + finidat = get_config_value(config, 'buildnml_input', 'finidat', ctsm_cfg_path) - ctsm_phys = get_config_value(config, 'buildnml_input', 'ctsm_phys', file_path, + ctsm_phys = get_config_value(config, 'buildnml_input', 'ctsm_phys', ctsm_cfg_path, allowed_values=['clm4_5', 'clm5_0']) - configuration = get_config_value(config, 'buildnml_input', 'configuration', file_path, + configuration = get_config_value(config, 'buildnml_input', 'configuration', ctsm_cfg_path, allowed_values=['nwp', 'clm']) - structure = get_config_value(config, 'buildnml_input', 'structure', file_path, + structure = get_config_value(config, 'buildnml_input', 'structure', ctsm_cfg_path, allowed_values=['fast', 'standard']) - bgc_mode = get_config_value(config, 'buildnml_input', 'bgc_mode', file_path, + bgc_mode = get_config_value(config, 'buildnml_input', 'bgc_mode', ctsm_cfg_path, allowed_values=['sp', 'bgc', 'cn', 'fates']) - crop = get_config_value(config, 'buildnml_input', 'crop', file_path, + crop = get_config_value(config, 'buildnml_input', 'crop', ctsm_cfg_path, allowed_values=['off', 'on']) - vichydro = get_config_value(config, 'buildnml_input', 'vichydro', file_path, + vichydro = get_config_value(config, 'buildnml_input', 'vichydro', ctsm_cfg_path, allowed_values=['off', 'on']) bldnml_opts = determine_bldnml_opts(bgc_mode=bgc_mode, crop=crop, vichydro=vichydro) - co2_ppmv = get_config_value(config, 'buildnml_input', 'co2_ppmv', file_path) - use_case = get_config_value(config, 'buildnml_input', 'use_case', file_path) - lnd_tuning_mode = get_config_value(config, 'buildnml_input', 'lnd_tuning_mode', file_path) - spinup = get_config_value(config, 'buildnml_input', 'spinup', file_path, + co2_ppmv = get_config_value(config, 'buildnml_input', 'co2_ppmv', ctsm_cfg_path) + use_case = get_config_value(config, 'buildnml_input', 'use_case', ctsm_cfg_path) + lnd_tuning_mode = get_config_value(config, 'buildnml_input', 'lnd_tuning_mode', ctsm_cfg_path) + spinup = get_config_value(config, 'buildnml_input', 'spinup', ctsm_cfg_path, allowed_values=['off', 'on']) - inputdata_path = get_config_value(config, 'buildnml_input', 'inputdata_path', file_path) + inputdata_path = get_config_value(config, 'buildnml_input', 'inputdata_path', ctsm_cfg_path) + + # Parse the user_nl_ctsm file + infile = os.path.join(rundir, '.namelist') + create_namelist_infile(case=CaseFake(), + user_nl_file=os.path.join(rundir, 'user_nl_ctsm'), + namelist_infile=infile) # create config_cache.xml file # Note that build-namelist utilizes the contents of the config_cache.xml file in @@ -229,6 +253,7 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask # call build-namelist cmd = os.path.abspath(os.path.join(path_to_ctsm_root(), "bld", "build-namelist")) command = [cmd, + '-infile', infile, '-csmdata', inputdata_path, '-inputdata', inputdatalist_path, # Hard-code start_ymd of year-2000. This is used to set the run type (for @@ -273,6 +298,7 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask os.remove(os.path.join(rundir, "config_cache.xml")) os.remove(os.path.join(rundir, "env_lilac.xml")) os.remove(os.path.join(rundir, "drv_flds_in")) + os.remove(infile) ############################################################################### def main(): From f4971ed89c13776cd74d3613c4776ae42199a2f8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Jun 2020 08:53:02 -0600 Subject: [PATCH 1037/1973] Stage a user_nl_ctsm file as part of build_ctsm --- lilac/bld_templates/user_nl_ctsm | 7 +++++++ python/ctsm/lilac_build_ctsm.py | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 lilac/bld_templates/user_nl_ctsm diff --git a/lilac/bld_templates/user_nl_ctsm b/lilac/bld_templates/user_nl_ctsm new file mode 100644 index 0000000000..0835ca134d --- /dev/null +++ b/lilac/bld_templates/user_nl_ctsm @@ -0,0 +1,7 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! (Exceptions are settings that are set in ctsm.cfg.) +!---------------------------------------------------------------------------------- + diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 3079f8cfdf..0f5bdf31e7 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -3,6 +3,7 @@ import argparse import logging import os +import shutil import subprocess from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args @@ -611,6 +612,10 @@ def _stage_runtime_inputs(build_dir): path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'lilac_in'), substitutions={'INPUTDATA':os.path.join(build_dir, _INPUTDATA_DIRNAME)}) + shutil.copyfile( + src=os.path.join(_PATH_TO_TEMPLATES, 'user_nl_ctsm'), + dst=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'user_nl_ctsm')) + make_link(_PATH_TO_MAKE_RUNTIME_INPUTS, os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'make_runtime_inputs')) From 83c3c4d3bee52e7cc7e009c7fdf2e7ed794b2402 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Jun 2020 08:58:05 -0600 Subject: [PATCH 1038/1973] Fix some pylint issues --- python/ctsm/lilac_make_runtime_inputs.py | 11 ++++++++--- .../ctsm/test/test_unit_lilac_make_runtime_inputs.py | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/python/ctsm/lilac_make_runtime_inputs.py b/python/ctsm/lilac_make_runtime_inputs.py index a2cb94ec68..14c327d062 100644 --- a/python/ctsm/lilac_make_runtime_inputs.py +++ b/python/ctsm/lilac_make_runtime_inputs.py @@ -12,7 +12,7 @@ from ctsm.path_utils import path_to_ctsm_root from ctsm.utils import abort -from CIME.buildnml import create_namelist_infile +from CIME.buildnml import create_namelist_infile # pylint: disable=import-error logger = logging.getLogger(__name__) @@ -55,15 +55,19 @@ _UNSET = 'UNSET' # ======================================================================== -# Fake case object that can be used to satisfy the interface of CIME functions that need a +# Fake case class that can be used to satisfy the interface of CIME functions that need a # case object # ======================================================================== class CaseFake: + """Fake case class to satisfy interface of CIME functions that need a case object""" + # pylint: disable=too-few-public-methods + def __init__(self): pass - def get_resolved_value(self, value): + @staticmethod + def get_resolved_value(value): """Make sure get_resolved_value doesn't get called (since we don't have a real case object to resolve values with) @@ -177,6 +181,7 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask """ # pylint: disable=too-many-locals + # pylint: disable=too-many-statements ctsm_cfg_path = os.path.join(rundir, 'ctsm.cfg') diff --git a/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py b/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py index bf28e6e265..7c94089269 100755 --- a/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py +++ b/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py @@ -32,7 +32,9 @@ def test_buildnmlOpts_bgcCrop(self): def test_buildnmlOpts_spCrop_fails(self): """Test determine_buildnml_opts with bgc_mode='sp' and crop on: should fail""" - with self.assertRaisesRegex(SystemExit, "setting crop to 'on' is only compatible with bgc_mode"): + with self.assertRaisesRegex( + SystemExit, + "setting crop to 'on' is only compatible with bgc_mode"): _ = determine_bldnml_opts(bgc_mode='sp', crop='on', vichydro='off') def test_buildnmlOpts_spVic(self): From 5e36fdeba9d2d3b63820b949ea002bd3ed6dc67c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Jun 2020 09:02:35 -0600 Subject: [PATCH 1039/1973] Ensure we're using a consistent cime version in make_runtime_inputs --- lilac/make_runtime_inputs | 7 +++++-- python/ctsm/lilac_make_runtime_inputs.py | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lilac/make_runtime_inputs b/lilac/make_runtime_inputs index 6d8db14985..93f218a9d0 100755 --- a/lilac/make_runtime_inputs +++ b/lilac/make_runtime_inputs @@ -8,9 +8,12 @@ _CTSM_PYTHON = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, 'python') sys.path.insert(1, _CTSM_PYTHON) -from ctsm import add_cime_to_path + +from ctsm.path_utils import add_cime_lib_to_path + +cime_path = add_cime_lib_to_path() from ctsm.lilac_make_runtime_inputs import main if __name__ == "__main__": - main() + main(cime_path=cime_path) diff --git a/python/ctsm/lilac_make_runtime_inputs.py b/python/ctsm/lilac_make_runtime_inputs.py index 14c327d062..7d651b9dd6 100644 --- a/python/ctsm/lilac_make_runtime_inputs.py +++ b/python/ctsm/lilac_make_runtime_inputs.py @@ -171,7 +171,8 @@ def determine_bldnml_opts(bgc_mode, crop, vichydro): return bldnml_opts ############################################################################### -def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask=None): +def buildnml(cime_path, rundir, use_existing_res_and_mask, + existing_res=None, existing_mask=None): ############################################################################### """Build the ctsm namelist @@ -258,6 +259,7 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask # call build-namelist cmd = os.path.abspath(os.path.join(path_to_ctsm_root(), "bld", "build-namelist")) command = [cmd, + '-cimeroot', cime_path, '-infile', infile, '-csmdata', inputdata_path, '-inputdata', inputdatalist_path, @@ -306,13 +308,21 @@ def buildnml(rundir, use_existing_res_and_mask, existing_res=None, existing_mask os.remove(infile) ############################################################################### -def main(): - """Main function""" +def main(cime_path): + """Main function + + Args: + cime_path (str): path to the cime that we're using (this is passed in explicitly + rather than relying on calling path_to_cime so that we can be absolutely sure that + the scripts called here are coming from the same cime as the cime library we're + using). + """ setup_logging_pre_config() args = parse_command_line() process_logging_args(args) buildnml( + cime_path=cime_path, rundir=args.rundir, use_existing_res_and_mask=args.use_existing_res_and_mask, existing_res=args.existing_res, From 78b5ae72183e98fb99a1d3fe9cb44294103364bf Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Jun 2020 09:51:02 -0600 Subject: [PATCH 1040/1973] Remove lilac_rof_input section from lilac_in This section (with variable rof_mesh_filename) appears to be unused currently. Removing it to avoid confusion. --- lilac/bld_templates/lilac_in_template | 3 --- 1 file changed, 3 deletions(-) diff --git a/lilac/bld_templates/lilac_in_template b/lilac/bld_templates/lilac_in_template index a10baa472b..6fa6be8967 100644 --- a/lilac/bld_templates/lilac_in_template +++ b/lilac/bld_templates/lilac_in_template @@ -11,9 +11,6 @@ &lilac_lnd_input lnd_mesh_filename = '$INPUTDATA/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' / -&lilac_rof_input - rof_mesh_filename = '$INPUTDATA/share/meshes/r05_nomask_c110308_ESMFmesh.nc' -/ &atmaero_stream stream_fldfilename='$INPUTDATA/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc' stream_year_first = 2000 From 1c201ccd19e3ec4ff6233c5dc44e0d99914447c0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Jun 2020 09:52:40 -0600 Subject: [PATCH 1041/1973] In lilac_in: set mesh filenames to 'FILL_THIS_IN' This should indicate to users that they need to replace these values --- lilac/bld_templates/lilac_in_template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lilac/bld_templates/lilac_in_template b/lilac/bld_templates/lilac_in_template index 6fa6be8967..304191ee09 100644 --- a/lilac/bld_templates/lilac_in_template +++ b/lilac/bld_templates/lilac_in_template @@ -6,10 +6,10 @@ lilac_histfreq_n = 1 / &lilac_atmcap_input - atm_mesh_filename = '$INPUTDATA/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + atm_mesh_filename = 'FILL_THIS_IN' / &lilac_lnd_input - lnd_mesh_filename = '$INPUTDATA/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + lnd_mesh_filename = 'FILL_THIS_IN' / &atmaero_stream stream_fldfilename='$INPUTDATA/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_WACCM.ensmean_monthly_hist_1849-2015_0.9x1.25_CMIP6_c180926.nc' From 27087dbe78575c4f5ee1f141a14606eec2cad84f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Jun 2020 10:29:35 -0600 Subject: [PATCH 1042/1973] Set up default history output in user_nl_ctsm --- lilac/bld_templates/user_nl_ctsm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lilac/bld_templates/user_nl_ctsm b/lilac/bld_templates/user_nl_ctsm index 0835ca134d..5ff40dbff8 100644 --- a/lilac/bld_templates/user_nl_ctsm +++ b/lilac/bld_templates/user_nl_ctsm @@ -5,3 +5,13 @@ ! (Exceptions are settings that are set in ctsm.cfg.) !---------------------------------------------------------------------------------- +! The following hist options set up three output streams from CTSM. The first (h0 files) +! is monthly and contains all of CTSM's default output variables. The second (h1 files) is +! daily, with a small list of fields given by hist_fincl2. The third (h2 files) is hourly, +! with a small list of fields given by hist_fincl3. You can change these settings however +! you'd like. +hist_mfilt = 1,1,24 +hist_nhtfrq = 0,-24,-1 +hist_fincl2 = 'SNO_LIQH2O','SNO_ICE','SNOTTOPL','SNOW_DEPTH','TSA','RAIN','SNOW','Q2M','RH2M','FSH','FCTR','FCEV','FGEV','FSDS','FSR','FIRA','BTRAN','SOILWATER_10CM','TSOI_10CM','H2OSOI','TSOI' +hist_fincl3 = 'SNO_LIQH2O','SNO_ICE','SNOTTOPL','SNOW_DEPTH','TSA','RAIN','SNOW','Q2M','RH2M','FSH','FCTR','FCEV','FGEV','FSDS','FSR','FIRA','BTRAN','SOILWATER_10CM','TSOI_10CM','H2OSOI','TSOI' + From fe509cc2c50907240f750e7fb4fd39b716b2e943 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 23 Jun 2020 11:05:47 -0600 Subject: [PATCH 1043/1973] Update cime to latest tag that has updated grid names, and uses PIO1 --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 43e4b64988..b160ff1ebd 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.24_a01 +tag = cime5.8.27 externals = ../Externals_cime.cfg required = True From b2ea3fe02e1c30573e5da11e53c1ace19b772d89 Mon Sep 17 00:00:00 2001 From: Chris Fischer Date: Tue, 23 Jun 2020 11:28:43 -0600 Subject: [PATCH 1044/1973] Rename ne30pg3 to ne30np4.pg3 --- bld/namelist_files/namelist_defaults_ctsm.xml | 8 ++++---- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f578be0db0..05beb167bb 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -799,7 +799,7 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne16np4_hist_78pfts_CMIP6_simyr lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr2000_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_simyr2000_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4_hist_78pfts_CMIP6_simyr2000_c200427.nc @@ -877,7 +877,7 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4_hist_78pfts_CMIP6_simyr1850_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4_hist_78pfts_CMIP6_simyr1850_c200427.nc @@ -937,7 +937,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc @@ -975,7 +975,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_h use_crop=".true." >lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 1da18f3722..1922748956 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1953,7 +1953,7 @@ CLM run type. + valid_values="conus_30_x8,512x1024,360x720cru,128x256,64x128,48x96,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4.pg2,ne30np4.pg3,ne30np4,ne60np4,ne120np4,ne120np4.pg2,ne120np4.pg3,ne0np4CONUS.ne30x8,ne0np4.ARCTIC.ne30x4,ne0np4.ARCTICGRIS.ne30x8,ne240np4,1km-merge-10min,C24,C48,C96,C192,C384"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min, 1km-merge-10min and 0.33x0.33 are only used for CLM toolsI From b949e523ff243e79c3f8ec8ac4d921063dd56d67 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Jun 2020 11:41:19 -0600 Subject: [PATCH 1045/1973] Set pio_stride intelligently --- .../config_machines_template.xml | 6 +-- ...d_modelio.nml => lnd_modelio_template.nml} | 4 +- python/ctsm/lilac_build_ctsm.py | 40 +++++++++++++++---- python/ctsm/test/test_sys_lilac_build_ctsm.py | 2 + .../ctsm/test/test_unit_lilac_build_ctsm.py | 9 +++-- 5 files changed, 45 insertions(+), 16 deletions(-) rename lilac/bld_templates/{lnd_modelio.nml => lnd_modelio_template.nml} (64%) diff --git a/lilac/bld_templates/config_machines_template.xml b/lilac/bld_templates/config_machines_template.xml index e6e102fa53..29e2bf79f2 100644 --- a/lilac/bld_templates/config_machines_template.xml +++ b/lilac/bld_templates/config_machines_template.xml @@ -75,15 +75,13 @@ This is irrelevant for this build-only port. --> - 1 + $MAX_MPITASKS_PER_NODE - 1 + $MAX_MPITASKS_PER_NODE -lnd/clm2/paramdata/clm5_params.c200623.nc -lnd/clm2/paramdata/clm45_params.c200614.nc +lnd/clm2/paramdata/clm5_params.c200624.nc +lnd/clm2/paramdata/clm45_params.c200624.nc From 9497f008d4b80071538787e5f30796939c768657 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 24 Jun 2020 10:48:21 -0600 Subject: [PATCH 1052/1973] Update totvegcthresh from .1 to 1. fixing #738 --- src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 b/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 index 2bd92d2d41..3740700ab1 100644 --- a/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 @@ -43,7 +43,7 @@ subroutine SoilBiogeochemPrecisionControlInit( soilbiogeochem_carbonstate_inst, type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst ! ! !LOCAL VARIABLES: - real(r8), parameter :: totvegcthresh = 0.1_r8 ! Total vegetation carbon threshold to zero out decomposition pools + real(r8), parameter :: totvegcthresh = 1.0_r8 ! Total vegetation carbon threshold to zero out decomposition pools !----------------------------------------------------------------------- ccrit = 1.e-8_r8 ! critical carbon state value for truncation (gC/m2) ncrit = 1.e-8_r8 ! critical nitrogen state value for truncation (gN/m2) From 11aa4069dba703e0cabf01a98370ba808fe45576 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 24 Jun 2020 12:13:15 -0600 Subject: [PATCH 1053/1973] few modifications and removing the unnecessary environments... --- doc/source/lilac/specific-atm-models/wrf.rst | 56 ++++++++------------ 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 5e39437cd9..32aea2d4e0 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -24,7 +24,6 @@ Decide where you will work, for example:: mkdir git_wrf_ctsm cd git_wrf_ctsm - Clone CTSM repository and checkout lilac_cap branch:: git clone https://github.com/ESCOMP/ctsm.git @@ -80,19 +79,6 @@ or (Cshell): setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk -.. todo:: - - Bill and Sam do we need the following still:? - -The following is needed in order to undo an undesired setting in that env_mach_specific file:: - - export MPI_USE_ARRAY=None - -or (Cshell): - -.. code-block:: Tcsh - - setenv MPI_USE_ARRAY None There are also few other environmental setting that should be set for building WRF. Some of these are not required, but might help if you face any compilation errors. @@ -118,10 +104,6 @@ or (Cshell): setenv WRF_DA_CORE 0 -Make sure you set NETCDF environment variable by:: - - setenv NETCDF /usr/local/netcdf/ (or wherever you have netcdf compiled.) - Then configure and build WRF for your machine and intended compiler by:: ./clean -a @@ -153,7 +135,6 @@ Then compile em_real and save the log:: Try "man nohup" for more information. - Compile WRF Preprocessing System (WPS) -------------------------------------- @@ -165,14 +146,11 @@ input to the real program for WRF real-data simulations. Building WPS requires that WRF be already built successfully. -Get WPS zipped tar file from: - -http://www2.mmm.ucar.edu/wrf/users/download/get_source.html +Get WPS from: -Untar WPS tar file:: - - gzip -cd WPSV4.0.TAR.gz | tar -xf - +https://www2.mmm.ucar.edu/wrf/users/download/wrf-regist_or_download.php +Please note that new users must register a form in this step. Then compile WPS similar to the way WRF was built. In summary:: @@ -208,14 +186,19 @@ If the geogrid step is finished successfully, you should see the following messa the log file:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! Successful completion of geogrid. ! + ! Successful completion of geogrid. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -Check the geogrid log file for successful ****** -Link the GRIB data files that are going to be used:: + +Next, we should run ungrib to get gribbed data into usable f ormat to be ingested by WRF. + +For running ungrib.exe, firt link the GRIB data files that are going to be used:: ./link_grib.csh $your_GRIB_data_path +Based on your GRIB data type, link or copy the appropriate VTable to your WPS directory. +WRF has some prepared VTable under /ungrib/Variable_tables/ folder. + Extract meteorological fields from GRIB-formatted files:: ./ungrib.exe >& log.ungrib @@ -227,9 +210,7 @@ Check ungrib log for the following message showing successful completion of ungr !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - - +At this point, you should see ungrib output (intermediate files) in your WPS directory. Horizontally interpolate the meteorological fields extracted by ungrib to the model grids defined in geogrid:: @@ -237,7 +218,6 @@ the model grids defined in geogrid:: ./metgrid.exe >& log.metgrid - Check the metgrid log for the following message showing successful completion of metgrid step:: @@ -249,10 +229,11 @@ metgrid step:: Run real program ---------------- -Run real.exe to generate initial and boundary conditions. -Follow WRF instructions for creating initial and boundary -conditions. In summary, complete the following steps: +Run real.exe to generate initial and boundary conditions. + +Follow WRF instructions for creating initial and boundary conditions. +In summary, complete the following steps: Move or link WPS output files (met_em.d01* files) to your WRF/run directory. @@ -260,6 +241,11 @@ Edit namelist.input for your WRF domain and desirable configurations. This should be the same domain as in the namelist used in WPS. +.. todo:: + + update the option number of wrf namelist. + + To run WRF-CTSM, change land-surface option to 51:: sf_surface_physics = 51 From b65030e0eb4f4c3c817167580976d198e1e36905 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 24 Jun 2020 13:55:34 -0600 Subject: [PATCH 1054/1973] Point to mizuRoute cime branch again --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 87bb0dd71f..106a9e04cc 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -36,8 +36,8 @@ required = True [cime] local_path = cime protocol = git -repo_url = https://github.com/ESMCI/cime -hash = 4427dd05147c42f19f5283793676867572138ed7 +repo_url = https://github.com/ekluzek/cime +branch = mizuRoute externals = ../Externals_cime.cfg required = True From 370c311bb238e2c156b5d04c4ab1a9f23fddbc99 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 24 Jun 2020 16:25:26 -0600 Subject: [PATCH 1055/1973] Add script to download input data for lilac --- lilac/download_input_data | 17 +++++ python/ctsm/lilac_build_ctsm.py | 7 ++ python/ctsm/lilac_download_input_data.py | 85 ++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100755 lilac/download_input_data create mode 100644 python/ctsm/lilac_download_input_data.py diff --git a/lilac/download_input_data b/lilac/download_input_data new file mode 100755 index 0000000000..70daf01a3c --- /dev/null +++ b/lilac/download_input_data @@ -0,0 +1,17 @@ +#!/usr/bin/env python +"""Download input data for running CTSM via LILAC""" + +import os +import sys + +_CTSM_PYTHON = os.path.join(os.path.dirname(os.path.realpath(__file__)), + os.pardir, + 'python') +sys.path.insert(1, _CTSM_PYTHON) + +from ctsm import add_cime_to_path + +from ctsm.lilac_download_input_data import main + +if __name__ == "__main__": + main() diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 9672f1a275..40c176e319 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -33,6 +33,10 @@ 'lilac', 'make_runtime_inputs') +_PATH_TO_DOWNLOAD_INPUT_DATA = os.path.join(path_to_ctsm_root(), + 'lilac', + 'download_input_data') + _MACHINE_CONFIG_DIRNAME = 'machine_configuration' _INPUTDATA_DIRNAME = 'inputdata' _RUNTIME_INPUTS_DIRNAME = 'runtime_inputs' @@ -663,6 +667,9 @@ def _stage_runtime_inputs(build_dir, no_pnetcdf): make_link(_PATH_TO_MAKE_RUNTIME_INPUTS, os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'make_runtime_inputs')) + make_link(_PATH_TO_DOWNLOAD_INPUT_DATA, + os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'download_input_data')) + def _build_case(build_dir): """Build the CTSM library and its dependencies diff --git a/python/ctsm/lilac_download_input_data.py b/python/ctsm/lilac_download_input_data.py new file mode 100644 index 0000000000..be91ca1c83 --- /dev/null +++ b/python/ctsm/lilac_download_input_data.py @@ -0,0 +1,85 @@ +"""Functions implementing LILAC's download_input_data command""" + +import argparse +import logging +import os +import re + +from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args + +from CIME.case import Case + +logger = logging.getLogger(__name__) + +# ======================================================================== +# Define some constants +# ======================================================================== + +# In lilac_in, file names match this pattern: The variable name ends with 'filename', so +# that is the last thing before the equals sign on the line. +_LILAC_FILENAME = r"filename *=" + +# ======================================================================== +# Public functions +# ======================================================================== + +def main(): + """Main function called when download_input_data is run from the command-line + """ + setup_logging_pre_config() + args = _commandline_args() + process_logging_args(args) + + download_input_data(rundir=args.rundir) + +def download_input_data(rundir): + """Implementation of the download_input_data command + + Args: + rundir: str - path to directory containing input_data_list files + """ + _create_lilac_input_data_list(rundir) + case = Case(os.path.realpath(os.path.join(rundir, os.pardir, 'case'))) + case.check_all_input_data( + input_data_root=os.path.realpath(os.path.join(rundir, os.pardir, 'inputdata')), + data_list_dir=rundir, + download=True, + chksum=False) + +# ======================================================================== +# Private functions +# ======================================================================== + +def _commandline_args(): + """Parse and return command-line arguments + """ + + description = """ +Script to download any missing input data for CTSM and LILAC +""" + + parser = argparse.ArgumentParser( + description=description, + formatter_class=argparse.RawTextHelpFormatter) + + parser.add_argument("--rundir", default=os.getcwd(), + help="Full path of the run directory\n" + "(This directory should contain clm.input_data_list and lilac_in, among other files.)\n" + "(Note: it is assumed that this directory exists alongside the other directories\n" + "created by build_ctsm: 'case' and 'inputdata'.)") + + add_logging_args(parser) + + args = parser.parse_args() + + return args + +def _create_lilac_input_data_list(rundir): + with open(os.path.join(rundir, 'lilac_in')) as lilac_in: + with open(os.path.join(rundir, 'lilac.input_data_list'), 'w') as input_data_list: + for line in lilac_in: + if re.search(_LILAC_FILENAME, line): + # Remove quotes from filename, then output this line + line = line.replace('"', '') + line = line.replace("'", "") + input_data_list.write(line) From 83c6b2acc7dd078c76c83fe2714f81da81561071 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 24 Jun 2020 16:28:22 -0600 Subject: [PATCH 1056/1973] Do xmlchange commands before case.setup This is important for FORCE_BUILD_SMP due to https://github.com/ESMCI/cime/issues/3590. For the others, it shouldn't hurt to do the xmlchange commands earlier. --- python/ctsm/lilac_build_ctsm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 40c176e319..c7e47bebaf 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -600,16 +600,16 @@ def _create_case(cime_path, build_dir, compiler, run_cmd_output_on_error(create_newcase_cmd, errmsg='Problem creating CTSM case directory') - run_cmd_output_on_error([os.path.join(case_dir, 'case.setup')], - errmsg='Problem setting up CTSM case directory', - cwd=case_dir) - subprocess.check_call([xmlchange, 'LILAC_MODE=on'], cwd=case_dir) if build_debug: subprocess.check_call([xmlchange, 'DEBUG=TRUE'], cwd=case_dir) if not build_without_openmp: subprocess.check_call([xmlchange, 'FORCE_BUILD_SMP=TRUE'], cwd=case_dir) + run_cmd_output_on_error([os.path.join(case_dir, 'case.setup')], + errmsg='Problem setting up CTSM case directory', + cwd=case_dir) + make_link(os.path.join(case_dir, 'bld'), os.path.join(build_dir, 'bld')) if machine is not None: From 8f71f5d91b05111f819c529849a17bf646936bbb Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 24 Jun 2020 17:01:04 -0600 Subject: [PATCH 1057/1973] Overall cleanup in wrf.rst File contains these TODOs: - Remove "git checkout lilac_cap" when ready - Remove "--build-without-openmp" when ready - If the relative link works, remove the absolute link to Section 3.2 - Update git address to WRF feature branch & rm "git checkout lilac_dev" - Does "similar to" mean "same as" (<-- this one's for Negin) - Make ncl script available and, if the finidat and wrfinput files need to be consistent for this to work, we should explain how to generate a consistent finidat file. --- doc/source/lilac/specific-atm-models/wrf.rst | 157 ++++++++++--------- 1 file changed, 83 insertions(+), 74 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 32aea2d4e0..8cae475d42 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -16,33 +16,40 @@ from earlier sections but in recipe form and with minimal detail. This section assumes use of a machine that has been ported to CIME. In this example we assume NCAR’s cheyenne computer in particular. -Clone CTSM Repository -------------------------- +Clone CTSM Repository and Build CTSM +------------------------------------ -Decide where you will work, for example:: +Decide where you will work. This is also where the model will write +output, so on cheyenne you may benefit from starting in +/glade/scratch/$USER due to the larger disk space there. - mkdir git_wrf_ctsm - cd git_wrf_ctsm +Clone the CTSM repository:: -Clone CTSM repository and checkout lilac_cap branch:: - - git clone https://github.com/ESCOMP/ctsm.git - cd ctsm + mkdir your_directory_name + cd your_directory_name + git clone https://github.com/ESCOMP/CTSM.git + cd CTSM git checkout lilac_cap ./manage_externals/checkout_externals +.. todo:: + + Remove "git checkout lilac_cap" from the above when ready + Build CTSM and its dependencies based on instructions from previous sections, for example for cheyenne:: - ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne + ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne --build-without-openmp +.. todo:: + + Remove "--build-without-openmp" from the above when ready -Set environment similar to environments used for your CTSM build using -ctsm_build_environment.sh for bash:: +Source ctsm_build_environment.sh (bash environment):: - source /ctsm_build_dir/ctsm_build_environment.sh + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh -or ctsm_build_environment.csh for Cshell: +or ctsm_build_environment.csh (Cshell environment): .. code-block:: Tcsh @@ -51,8 +58,13 @@ or ctsm_build_environment.csh for Cshell: .. note:: For additional details on preparing the CTSM, including how to - recompile when making code changes to the CTSM, read section - _obtaining-and-building-ctsm. <-- CREATED LINK TO THE CORRECT SECTION? + recompile when making code changes to the CTSM, read Section 3.2: + https://escomp.github.io/ctsm-docs/versions/master/html/lilac/obtaining-building-and-running/index.html + https:../obtaining-building-and-running/index.html + +.. todo:: + + If the second (relative) link works, remove the first (absolute) link Building the WRF model with CTSM -------------------------------- @@ -60,61 +72,57 @@ Building the WRF model with CTSM .. todo:: update the git address to WRF feature branch... + and remove "git checkout lilac_dev" below -Clone WRF CTSM branch into your directory:: +Clone the WRF CTSM branch into your_directory_name:: + cd .. git clone git@github.com:billsacks/WRF.git cd WRF git checkout lilac_dev -For building WRF using CTSM, we should set makefile variables from CTSM needed for -WRF build by (BASH):: +Set makefile variables from CTSM needed for the WRF build, for bash:: export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk -or (Cshell): +or for Cshell use the setenv command and remove the "=" (here and in +subsequent cases): .. code-block:: Tcsh setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk - -There are also few other environmental setting that should be set for building WRF. -Some of these are not required, but might help if you face any compilation errors. +The next two environment settings for building WRF may help if you +encounter compilation errors, but should be unnecessary for completing +the current example on cheyenne. Explicitly define which model core to build by:: export WRF_EM_CORE=1 -or (Cshell): - -.. code-block:: Tcsh - - setenv WRF_EM_CORE 1 - Explicilty turn off data assimilation by:: export WRF_DA_CORE=0 -or (Cshell): - -.. code-block:: Tcsh - - setenv WRF_DA_CORE 0 - - -Then configure and build WRF for your machine and intended compiler by:: +Now configure and build WRF for your machine and intended compiler. +The ./clean command is necessary after any modification of WRF code:: ./clean -a ./configure -Choose one of the options, similar to the compiler used for building CTSM. +At the prompt choose one of the options, similar to the compiler used +for building CTSM. The specific example has been tested successfuly by +choosing 15 here. + +.. todo:: + + Negin, by "similar to" do you mean "same as" in the above? -Next, choose one of the options for nesting. Currently nesting is not available for WRF-CTSM, -therefore we should use 1. +The next prompt requests an option for nesting. Currently nesting is not +available for WRF-CTSM so enter 1. -Then compile em_real and save the log:: +Now compile em_real and save the log:: ./compile em_real >& compile.log @@ -139,7 +147,7 @@ Compile WRF Preprocessing System (WPS) -------------------------------------- The WRF Preprocessing System (WPS) is a set of programs to prepare -input to the real program for WRF real-data simulations. +inputs to the real program executable (real.exe) for WRF real-data simulations. .. note:: @@ -150,29 +158,33 @@ Get WPS from: https://www2.mmm.ucar.edu/wrf/users/download/wrf-regist_or_download.php -Please note that new users must register a form in this step. +New users must complete a registration form in this step. Then compile WPS similar to the way WRF was built. In summary:: cd WPS ./configure -Here choose one option, for your intended compiler, similar to your WRF build. -After configuring, you can check configure.wps for making sure all the libs and paths +At the prompt choose your intended compiler, similar to your WRF build. +After configuring, check configure.wps to make sure all the libs and paths are set correctly. +.. todo:: + + Negin, by "similar to" do you mean "same as" in the above? + Then, compile WPS:: ./compile >& compile.log .. note:: - If wps build is succsfully you should see geogrid.exe, ungrib.exe, and metgrid.exe. + If wps builds succesfully you should see geogrid.exe, ungrib.exe, and metgrid.exe. Alternatively, you can check the log for successful build message. -Run WRF Preprocessing System (WPS) Steps ------------------------------------------ +Run WRF Preprocessing System (WPS) +---------------------------------- Edit namelist.wps for your domain of interest, which should be the same domain as used in your WRF namelist. @@ -182,17 +194,16 @@ to the grids:: ./geogrid.exe >& log.geogrid -If the geogrid step is finished successfully, you should see the following message in -the log file:: +If the geogrid step finishes successfully, you should see the following message in the log file:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Successful completion of geogrid. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -Next, we should run ungrib to get gribbed data into usable f ormat to be ingested by WRF. +Next, run ungrib to get gribbed data into usable format to be ingested by WRF. -For running ungrib.exe, firt link the GRIB data files that are going to be used:: +To run ungrib.exe, first link the GRIB data files that are going to be used:: ./link_grib.csh $your_GRIB_data_path @@ -227,8 +238,8 @@ metgrid step:: -Run real program ----------------- +Run real.exe +------------ Run real.exe to generate initial and boundary conditions. @@ -270,8 +281,10 @@ Check the last line of the real log file for the following message:: Create input namelists for CTSM and LILAC ========================================= -Introduce the following diffs to ./git_wrf_ctsm/ctsm/lilac/atm_driver/ -by replacing the entries preceded by minus signs with the entries +Introduce the following diffs to +./your_directory_name/ctsm/lilac/atm_driver/ +where is atm_driver_in, ctsm.cfg, and lilac_in. +In particular, replace the entries preceded by minus signs with the entries preceded by plus signs. diff ./lilac/atm_driver/atm_driver_in ./lilac/atm_driver/atm_driver_in: @@ -321,48 +334,42 @@ Before you generate the lnd_in file, you may modify user_nl_clm in point to an alternate CTSM initial condition file. To merge WRF initial conditions from a wrfinput file into a CTSM initial condition file, type:: - module load ncl/6.6.2 - ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="finidat_interp_dest.nc"' 'wrfinput="./git_wrf_ctsm/WRF/test/em_real/wrfinput_d01.noseaice"' 'merged="finidat_interp_dest_wrfinit_snow.nc"' + module load ncl + ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="finidat_interp_dest.nc"' 'wrfinput="./your_directory_name/WRF/test/em_real/wrfinput_d01.noseaice"' 'merged="finidat_interp_dest_wrfinit_snow.nc"' .. todo:: - Need to make the above ncl script available. I assume that the finidat - and the wrfinput files need to be consistent for this to work. If so, - we should prob. explain how to generate a consistent finidat file. + Make the above ncl script available. If the finidat and wrfinput files + need to be consistent for this to work, we should explain how to + generate a consistent finidat file. Generate the lnd_in file by running the following from -./git_wrf_ctsm/ctsm/lilac/atm_driver:: +./your_directory_name/ctsm/lilac/atm_driver:: ../../lilac_config/buildnml Copy lilac_in, lnd_in, and lnd_modelio.nml to the WRF/run directory. - - Run WRF ------- -If real program is completed successfully, we should see wrfinput and wrfbdy files +If real program completed successfully, we should see wrfinput and wrfbdy files in our directory. -Next, we should run WRF. - -For Cheyenne, we should submit a batch job to PBS (Pro workload management system). -For more instructions on running a batch job on Cheyenne, please check: +Now run WRF-CTSM. On Cheyenne this means submitting a batch job to PBS (Pro workload management system). +For detailed instructions on running a batch job on Cheyenne, please check: https://www2.cisl.ucar.edu/resources/computational-systems/cheyenne/running-jobs/submitting-jobs-pbs - -A sample of basic PBS job for Cheyenne: +A simple PBS script to run WRF-CTSM on Cheyenne looks like this: .. code-block:: Tcsh #!/bin/tcsh - #PBS -N job_name - #PBS -A project_code + #PBS -N your_job_name + #PBS -A your_project_code #PBS -l walltime=01:00:00 #PBS -q queue_name - #PBS -j oe #PBS -k eod #PBS -m abe #PBS -M your_email_address @@ -375,4 +382,6 @@ A sample of basic PBS job for Cheyenne: ### Run the executable mpiexec_mpt ./wrf.exe +If you named this script run_wrf_ctsm.csh, then you type next:: + qsub run_wrf_ctsm.csh From cab9c2ef15a80ebdabc14049ae6cce4b952dbdfa Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 24 Jun 2020 18:59:02 -0600 Subject: [PATCH 1058/1973] Support an --inputdata-path argument --- python/ctsm/lilac_build_ctsm.py | 61 +++++++++++++------ python/ctsm/test/test_sys_lilac_build_ctsm.py | 26 ++++++-- 2 files changed, 63 insertions(+), 24 deletions(-) diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index c7e47bebaf..819168c12d 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -82,7 +82,8 @@ def main(cime_path): extra_cflags=args.extra_cflags, no_pnetcdf=args.no_pnetcdf, build_debug=args.build_debug, - build_without_openmp=args.build_without_openmp) + build_without_openmp=args.build_without_openmp, + inputdata_path=args.inputdata_path) def build_ctsm(cime_path, build_dir, @@ -102,7 +103,8 @@ def build_ctsm(cime_path, extra_cflags='', no_pnetcdf=False, build_debug=False, - build_without_openmp=False): + build_without_openmp=False, + inputdata_path=None): """Implementation of build_ctsm command Args: @@ -137,11 +139,16 @@ def build_ctsm(cime_path, no_pnetcdf (bool): if True, use netcdf rather than pnetcdf build_debug (bool): if True, build with flags for debugging build_without_openmp (bool): if True, build without OpenMP support + inputdata_path (str or None): path to existing inputdata directory on this machine + If None, an inputdata directory will be created for this build + (If machine is given, then we use the machine's inputdata directory by default; + but if inputdata_path is given, it overrides the machine's inputdata directory.) """ existing_machine = machine is not None + existing_inputdata = existing_machine or inputdata_path is not None _create_build_dir(build_dir=build_dir, - existing_machine=existing_machine) + existing_inputdata=existing_inputdata) if machine is None: assert os_type is not None, 'with machine absent, os_type must be given' @@ -169,16 +176,18 @@ def build_ctsm(cime_path, compiler=compiler, machine=machine, build_debug=build_debug, - build_without_openmp=build_without_openmp) - - if existing_machine: - # For a user-defined machine, we create an inputdata directory for this case. For - # an existing cime-ported machine, we still want an inputdata directory alongside - # the other directories, but now it will just be a link to the real inputdata - # space on that machine. (Note that, for a user-defined machine, it's important - # that we have created this directory before creating the case, whereas for an - # existing machine, we need to wait until after we have created the case to know - # where to make the sym link point to.) + build_without_openmp=build_without_openmp, + inputdata_path=inputdata_path) + + if existing_inputdata: + # For a user-defined machine without inputdata_path specified, we create an + # inputdata directory for this case above. For an existing cime-ported machine, or + # one where inputdata_path is specified, we still want an inputdata directory + # alongside the other directories, but now it will just be a link to the real + # inputdata space on that machine. (Note that, for a user-defined machine, it's + # important that we have created this directory before creating the case, whereas + # for an existing machine, we need to wait until after we have created the case to + # know where to make the sym link point to.) _link_to_inputdata(build_dir=build_dir) _stage_runtime_inputs(build_dir=build_dir, no_pnetcdf=no_pnetcdf) @@ -315,6 +324,16 @@ def _commandline_args(args_to_parse=None): 'This is mainly useful if your machine/compiler does not support OpenMP.') non_rebuild_optional_list.append('build-without-openmp') + non_rebuild_optional.add_argument('--inputdata-path', + help='Path to directory containing CTSM\'s NetCDF inputs.\n' + 'For a machine that has been ported to cime, the default is to\n' + 'use this machine\'s standard inputdata location; this argument\n' + 'can be used to override this default.\n' + 'For a user-defined machine, the default is to create an inputdata\n' + 'directory in the build directory; again, this argument can be\n' + 'used to override this default.') + non_rebuild_optional_list.append('inputdata-path') + non_rebuild_optional.add_argument('--no-build', action='store_true', help='Do the pre-build setup, but do not actually build CTSM\n' '(This is useful for testing, or for expert use.)') @@ -472,19 +491,18 @@ def _get_case_dir(build_dir): """Given the path to build_dir, return the path to the case directory""" return os.path.join(build_dir, 'case') -def _create_build_dir(build_dir, existing_machine): +def _create_build_dir(build_dir, existing_inputdata): """Create the given build directory and any necessary sub-directories Args: build_dir (str): path to build directory; this directory shouldn't exist yet! - existing_machine (bool): whether this build is for a machine known to cime - (as opposed to an on-the-fly machine port) + existing_inputdata (bool): whether the inputdata directory already exists on this machine """ if os.path.exists(build_dir): abort('When running without --rebuild, the build directory must not exist yet\n' '(<{}> already exists)'.format(build_dir)) os.makedirs(build_dir) - if not existing_machine: + if not existing_inputdata: os.makedirs(os.path.join(build_dir, _INPUTDATA_DIRNAME)) def _fill_out_machine_files(build_dir, @@ -556,7 +574,8 @@ def _fill_out_machine_files(build_dir, def _create_case(cime_path, build_dir, compiler, - machine=None, build_debug=False, build_without_openmp=False): + machine=None, build_debug=False, build_without_openmp=False, + inputdata_path=None): """Create a case that can later be used to build the CTSM library and its dependencies Args: @@ -568,6 +587,8 @@ def _create_case(cime_path, build_dir, compiler, Otherwise, machine should be the name of a machine known to cime build_debug (bool): if True, build with flags for debugging build_without_openmp (bool): if True, build without OpenMP support + inputdata_path (str or None): path to existing inputdata directory on this machine + If None, we use the machine's default DIN_LOC_ROOT """ # Note that, for some commands, we want to suppress output, only showing the output if # the command fails; for these we use run_cmd_output_on_error. For other commands, @@ -597,6 +618,8 @@ def _create_case(cime_path, build_dir, compiler, '--driver', 'nuopc', '--run-unsupported'] create_newcase_cmd.extend(machine_args) + if inputdata_path: + create_newcase_cmd.extend(['--input-dir', inputdata_path]) run_cmd_output_on_error(create_newcase_cmd, errmsg='Problem creating CTSM case directory') @@ -620,7 +643,7 @@ def _create_case(cime_path, build_dir, compiler, os.path.join(build_dir, 'ctsm_build_environment.{}'.format(extension))) def _link_to_inputdata(build_dir): - """For an existing machine, make a sym link to the inputdata directory + """Make a sym link to an existing inputdata directory Args: build_dir (str): path to build directory diff --git a/python/ctsm/test/test_sys_lilac_build_ctsm.py b/python/ctsm/test/test_sys_lilac_build_ctsm.py index ed9db29c1b..f8b0447fc7 100755 --- a/python/ctsm/test/test_sys_lilac_build_ctsm.py +++ b/python/ctsm/test/test_sys_lilac_build_ctsm.py @@ -39,8 +39,9 @@ def test_buildSetup_userDefinedMachine_minimalInfo(self): This version specifies a minimal amount of information """ + build_dir = os.path.join(self._tempdir, 'ctsm_build') build_ctsm(cime_path=_CIME_PATH, - build_dir=os.path.join(self._tempdir, 'ctsm_build'), + build_dir=build_dir, compiler='gnu', no_build=True, os_type='linux', @@ -50,7 +51,13 @@ def test_buildSetup_userDefinedMachine_minimalInfo(self): gmake='gmake', gmake_j=8, no_pnetcdf=True) - # no assertions: test passes as long as the command doesn't generate any errors + # the critical piece of this test is that the above command doesn't generate any + # errors; however we also do some assertions below + + # ensure that inputdata directory was created and is NOT a sym link + inputdata = os.path.join(build_dir, 'inputdata') + self.assertTrue(os.path.isdir(inputdata)) + self.assertFalse(os.path.islink(inputdata)) def test_buildSetup_userDefinedMachine_allInfo(self): """Get through the case.setup phase with a user-defined machine @@ -61,8 +68,11 @@ def test_buildSetup_userDefinedMachine_allInfo(self): This version specifies all possible information """ + build_dir = os.path.join(self._tempdir, 'ctsm_build') + inputdata_path = os.path.realpath(os.path.join(self._tempdir, 'my_inputdata')) + os.makedirs(inputdata_path) build_ctsm(cime_path=_CIME_PATH, - build_dir=os.path.join(self._tempdir, 'ctsm_build'), + build_dir=build_dir, compiler='gnu', no_build=True, os_type='linux', @@ -77,8 +87,14 @@ def test_buildSetup_userDefinedMachine_allInfo(self): extra_fflags='-foo', extra_cflags='-bar', build_debug=True, - build_without_openmp=True) - # no assertions: test passes as long as the command doesn't generate any errors + build_without_openmp=True, + inputdata_path=os.path.join(self._tempdir, 'my_inputdata')) + # the critical piece of this test is that the above command doesn't generate any + # errors; however we also do some assertions below + + # ensure that inputdata directory is a symlink pointing to the correct location + inputdata = os.path.join(build_dir, 'inputdata') + self.assertEqual(os.path.realpath(inputdata), inputdata_path) if __name__ == '__main__': unit_testing.setup_for_tests() From a3a113ec3416f253bc6e57b7a56bfee42867ce5e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 24 Jun 2020 19:00:51 -0600 Subject: [PATCH 1059/1973] Fix pylint issues --- python/ctsm/lilac_download_input_data.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/ctsm/lilac_download_input_data.py b/python/ctsm/lilac_download_input_data.py index be91ca1c83..feed9e8b2c 100644 --- a/python/ctsm/lilac_download_input_data.py +++ b/python/ctsm/lilac_download_input_data.py @@ -7,7 +7,7 @@ from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args -from CIME.case import Case +from CIME.case import Case # pylint: disable=import-error logger = logging.getLogger(__name__) @@ -64,9 +64,10 @@ def _commandline_args(): parser.add_argument("--rundir", default=os.getcwd(), help="Full path of the run directory\n" - "(This directory should contain clm.input_data_list and lilac_in, among other files.)\n" - "(Note: it is assumed that this directory exists alongside the other directories\n" - "created by build_ctsm: 'case' and 'inputdata'.)") + "(This directory should contain clm.input_data_list and lilac_in,\n" + "among other files.)\n" + "(Note: it is assumed that this directory exists alongside the other\n" + "directories created by build_ctsm: 'case' and 'inputdata'.)") add_logging_args(parser) From c34340a401abdb2a626a24f8f4915baa180c6e5e Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 24 Jun 2020 19:48:11 -0600 Subject: [PATCH 1060/1973] Revisions addressing @billsacks review --- src/biogeochem/ch4Mod.F90 | 50 ++++++++++++++++------------- src/cpl/mct/lnd_import_export.F90 | 2 +- src/cpl/nuopc/lnd_import_export.F90 | 2 +- src/main/lnd2atmMod.F90 | 9 ------ src/main/lnd2atmType.F90 | 8 ++--- 5 files changed, 33 insertions(+), 38 deletions(-) diff --git a/src/biogeochem/ch4Mod.F90 b/src/biogeochem/ch4Mod.F90 index b833ec4c76..2432b85cf4 100644 --- a/src/biogeochem/ch4Mod.F90 +++ b/src/biogeochem/ch4Mod.F90 @@ -190,7 +190,7 @@ module ch4Mod ! false. This could be a scalar, but scalars cause problems with threading, so we use ! a column-level array (column-level for convenience, because it is referenced in ! column-level loops). - logical , pointer, private :: ch4_first_time_col (:) ! col whether this is the first time step that includes ch4 + logical , pointer, private :: ch4_first_time_grc (:) ! grc whether this is the first time step that includes ch4 ! real(r8), pointer, public :: finundated_col (:) ! col fractional inundated area (excluding dedicated wetland cols) real(r8), pointer, public :: finundated_pre_snow_col (:) ! col fractional inundated area (excluding dedicated wetland cols) before snow @@ -201,7 +201,6 @@ module ch4Mod real(r8), pointer, public :: o2_decomp_depth_sat_col (:,:) ! col O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) real(r8), pointer, public :: o2_decomp_depth_unsat_col (:,:) ! col O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) real(r8), pointer, public :: ch4_surf_flux_tot_col (:) ! col CH4 surface flux (to atm) (kg C/m**2/s) - real(r8), pointer, public :: ch4_surf_flux_tot_grc (:) ! grc CH4 surface flux (to atm) (kg C/m**2/s) real(r8), pointer, public :: grnd_ch4_cond_patch (:) ! patch tracer conductance for boundary layer [m/s] real(r8), pointer, public :: grnd_ch4_cond_col (:) ! col tracer conductance for boundary layer [m/s] @@ -322,7 +321,6 @@ subroutine InitAllocate(this, bounds) allocate(this%layer_sat_lag_col (begc:endc,1:nlevgrnd)) ; this%layer_sat_lag_col (:,:) = nan allocate(this%pH_col (begc:endc)) ; this%pH_col (:) = nan allocate(this%ch4_surf_flux_tot_col (begc:endc)) ; this%ch4_surf_flux_tot_col (:) = nan - allocate(this%ch4_surf_flux_tot_grc (begg:endg)) ; this%ch4_surf_flux_tot_grc (:) = nan allocate(this%dyn_ch4bal_adjustments_col (begc:endc)) ; this%dyn_ch4bal_adjustments_col (:) = nan allocate(this%c_atm_grc (begg:endg,1:ngases)) ; this%c_atm_grc (:,:) = nan @@ -334,7 +332,7 @@ subroutine InitAllocate(this, bounds) allocate(this%annavg_agnpp_patch (begp:endp)) ; this%annavg_agnpp_patch (:) = spval ! To detect first year allocate(this%annavg_bgnpp_patch (begp:endp)) ; this%annavg_bgnpp_patch (:) = spval ! To detect first year - allocate(this%ch4_first_time_col (begc:endc)) ; this%ch4_first_time_col (:) = .true. + allocate(this%ch4_first_time_grc (begg:endg)) ; this%ch4_first_time_grc (:) = .true. allocate(this%finundated_col (begc:endc)) ; this%finundated_col (:) = nan allocate(this%finundated_pre_snow_col (begc:endc)) ; this%finundated_pre_snow_col (:) = nan @@ -1150,7 +1148,7 @@ subroutine Restart( this, bounds, ncid, flag ) ! restart file based on whether FINUNDATED is present on the restart file. We ! could use any methane variable, but FINUNDATED is a good choice because this ! "first time" variable is used in connection with FINUNDATED. - this%ch4_first_time_col(bounds%begc:bounds%endc) = .false. + this%ch4_first_time_grc(bounds%begg:bounds%endg) = .false. ! BACKWARDS_COMPATIBILITY(wjs, 2016-02-11) The following is needed for backwards ! compatibility with restart files generated from older versions of the code, where @@ -1585,12 +1583,17 @@ subroutine ch4_init_gridcell_balance_check(bounds, num_nolakec, & ! ! !LOCAL VARIABLES: + integer :: begc, endc, begg, endg + real(r8), allocatable :: totcolch4_bef_col(:) ! col total methane found in soil col, start of timestep (g C / m^2) NB: this variable appears with the same name in ch4_type but the one here is local and for temporary use character(len=*), parameter :: subname = 'ch4_init_gridcell_balance_check' !----------------------------------------------------------------------- - ! Initialize to zero for columns outside the filters because will - ! average up to gridcell - ch4_inst%totcolch4_bef_col(bounds%begc:bounds%endc) = 0._r8 + begc = bounds%begc + endc = bounds%endc + begg = bounds%begg + endg = bounds%endg + + allocate(totcolch4_bef_col(begc:endc)) ! This is only really needed for soilc and lakec, but we use nolakec rather ! than just soilc for consistency with the other call to ch4_totcolch4 @@ -1598,13 +1601,15 @@ subroutine ch4_init_gridcell_balance_check(bounds, num_nolakec, & ! purposes). call ch4_totcolch4(bounds, num_nolakec, filter_nolakec, num_lakec, & filter_lakec, ch4_inst, & - ch4_inst%totcolch4_bef_col(bounds%begc:bounds%endc)) + totcolch4_bef_col(begc:endc)) call c2g( bounds, & - ch4_inst%totcolch4_bef_col(bounds%begc:bounds%endc), & - ch4_inst%totcolch4_bef_grc(bounds%begg:bounds%endg), & + totcolch4_bef_col(begc:endc), & + ch4_inst%totcolch4_bef_grc(begg:endg), & c2l_scale_type= 'unity', l2g_scale_type='unity' ) + deallocate(totcolch4_bef_col) + end subroutine ch4_init_gridcell_balance_check !----------------------------------------------------------------------- @@ -1782,7 +1787,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & totcolch4_grc => ch4_inst%totcolch4_grc , & ! Output: [real(r8) (:) ] gridcell-level total methane in soil column (g C / m^2) finundated => ch4_inst%finundated_col , & ! Output: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) finundated_pre_snow => ch4_inst%finundated_pre_snow_col , & ! Output: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) before snow - ch4_first_time_col => ch4_inst%ch4_first_time_col , & ! Output: [logical (:) ] col whether this is the first time step that includes ch4 + ch4_first_time_grc => ch4_inst%ch4_first_time_grc , & ! Output: [logical (:) ] grc whether this is the first time step that includes ch4 qflx_surf_lag => ch4_inst%qflx_surf_lag_col , & ! Output: [real(r8) (:) ] time-lagged surface runoff (mm H2O /s) finundated_lag => ch4_inst%finundated_lag_col , & ! Output: [real(r8) (:) ] time-lagged fractional inundated area layer_sat_lag => ch4_inst%layer_sat_lag_col , & ! Output: [real(r8) (:,:) ] Lagged saturation status of soil layer in the unsaturated zone (1 = sat) @@ -1790,7 +1795,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & ch4co2f => ch4_inst%ch4co2f_grc , & ! Output: [real(r8) (:) ] gridcell CO2 production from CH4 oxidation (g C/m**2/s) ch4prodg => ch4_inst%ch4prodg_grc , & ! Output: [real(r8) (:) ] gridcell average CH4 production (g C/m^2/s) ch4_surf_flux_tot_col => ch4_inst%ch4_surf_flux_tot_col , & ! Output: [real(r8) (:) ] col CH4 flux to atm. (kg C/m**2/s) - ch4_surf_flux_tot_grc => ch4_inst%ch4_surf_flux_tot_grc , & ! Output: [real(r8) (:) ] grc CH4 flux to atm. (kg C/m**2/s) + ch4_surf_flux_tot_grc => lnd2atm_inst%ch4_surf_flux_tot_grc , & ! Output: [real(r8) (:) ] grc CH4 flux to atm. (kg C/m**2/s) nem_grc => lnd2atm_inst%nem_grc , & ! Output: [real(r8) (:) ] gridcell average net methane correction to CO2 flux (g C/m^2/s) @@ -1826,10 +1831,6 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & ! Adjustment to NEE for methane production - oxidation nem_col(begc:endc) = 0._r8 - ! Initialize to zero for columns outside the filters because will - ! average up to gridcell - totcolch4_col(begc:endc) = 0._r8 - do g= begg, endg if (ch4offline) then forc_pch4(g) = atmch4*forc_pbot(g) @@ -1908,7 +1909,8 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & ch4_dfsat_flux(c) = 0._r8 end if - if (.not. ch4_first_time_col(c)) then + g = col%gridcell(c) + if (.not. ch4_first_time_grc(g)) then if (finundated(c) > fsat_bef(c)) then !Reduce conc_ch4_sat dfsat = finundated(c) - fsat_bef(c) conc_ch4_sat(c,j) = (fsat_bef(c)*conc_ch4_sat(c,j) + dfsat*conc_ch4_unsat(c,j)) / finundated(c) @@ -2210,8 +2212,9 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & do fc = 1, num_soilc c = filter_soilc(fc) + g = col%gridcell(c) - if (.not. ch4_first_time_col(c)) then + if (.not. ch4_first_time_grc(g)) then ! Check balance errch4 = totcolch4_col(c) - totcolch4_bef_col(c) & - dtime*(ch4_prod_tot(c) - ch4_oxid_tot(c) & @@ -2219,7 +2222,6 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & if (abs(errch4) > 1.e-7_r8) then ! g C / m^2 / timestep write(iulog,*)'Column-level CH4 Conservation Error in CH4Mod driver, nstep, c, errch4 (gC /m^2.timestep)', & nstep,c,errch4 - g = col%gridcell(c) write(iulog,*)'Latdeg,Londeg,col%itype=',grc%latdeg(g),grc%londeg(g),col%itype(c) write(iulog,*)'totcolch4_col = ', totcolch4_col(c) write(iulog,*)'totcolch4_bef_col = ', totcolch4_bef_col(c) @@ -2235,8 +2237,9 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & if (allowlakeprod) then do fc = 1, num_lakec c = filter_lakec(fc) + g = col%gridcell(c) - if (.not. ch4_first_time_col(c)) then + if (.not. ch4_first_time_grc(g)) then ! Check balance errch4 = totcolch4_col(c) - totcolch4_bef_col(c) & - dtime*(ch4_prod_tot(c) - ch4_oxid_tot(c) & @@ -2244,7 +2247,6 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & if (abs(errch4) > 1.e-7_r8) then ! g C / m^2 / timestep write(iulog,*)'Column-level CH4 Conservation Error in CH4Mod driver for lake column, nstep, c, errch4 (gC/m^2.timestep)', & nstep,c,errch4 - g = col%gridcell(c) write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) write(iulog,*)'totcolch4_col = ', totcolch4_col(c) write(iulog,*)'totcolch4_bef_col = ', totcolch4_bef_col(c) @@ -2285,6 +2287,7 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & ! Gricell level balance do g = begg, endg + if (.not. ch4_first_time_grc(g)) then ! Check balance errch4 = totcolch4_grc(g) - totcolch4_bef_grc(g) + dtime * & (nem_grc(g) + ch4_surf_flux_tot_grc(g) * 1000._r8) ! kg C --> g C @@ -2299,9 +2302,10 @@ subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & write(iulog,*)'dtime * ch4_surf_flux_tot * 1000 =', dtime * ch4_surf_flux_tot_grc(g) * 1000._r8 call endrun(msg=' ERROR: Methane conservation error'//errMsg(sourcefile, __LINE__)) end if + end if end do - ch4_first_time_col(begc:endc) = .false. + ch4_first_time_grc(begg:endg) = .false. end associate diff --git a/src/cpl/mct/lnd_import_export.F90 b/src/cpl/mct/lnd_import_export.F90 index a3e1010730..b93379979a 100644 --- a/src/cpl/mct/lnd_import_export.F90 +++ b/src/cpl/mct/lnd_import_export.F90 @@ -378,7 +378,7 @@ subroutine lnd_export( bounds, waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst end if if (index_l2x_Fall_methane /= 0) then - l2x(index_l2x_Fall_methane,i) = -lnd2atm_inst%flux_ch4_grc(g) + l2x(index_l2x_Fall_methane,i) = -lnd2atm_inst%ch4_surf_flux_tot_grc(g) endif ! sign convention is positive downward with diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 0838b7a00a..396ecaf344 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -859,7 +859,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & minus=.true., ungridded_index=4, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_methane', bounds, input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) + call state_setexport(exportState, 'Fall_methane', bounds, input=lnd2atm_inst%ch4_surf_flux_tot_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_setexport(exportState, 'Sl_ram1', bounds, input=lnd2atm_inst%ram1_grc, rc=rc) diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index acb0f5cfff..2fbea9433a 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -328,15 +328,6 @@ subroutine lnd2atm(bounds, & lnd2atm_inst%flxdst_grc (bounds%begg:bounds%endg, :), & p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - ! ch4 flux - if (use_lch4) then - call c2g( bounds, & - ch4_inst%ch4_surf_flux_tot_col (bounds%begc:bounds%endc), & - lnd2atm_inst%flux_ch4_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'unity', l2g_scale_type='unity' ) - end if - !---------------------------------------------------- ! lnd -> rof !---------------------------------------------------- diff --git a/src/main/lnd2atmType.F90 b/src/main/lnd2atmType.F90 index 509a8afaf2..a0e8623018 100644 --- a/src/main/lnd2atmType.F90 +++ b/src/main/lnd2atmType.F90 @@ -56,7 +56,7 @@ module lnd2atmType real(r8), pointer :: flxvoc_grc (:,:) => null() ! VOC flux (size bins) real(r8), pointer :: fireflx_grc (:,:) => null() ! Wild Fire Emissions real(r8), pointer :: fireztop_grc (:) => null() ! Wild Fire Emissions vertical distribution top - real(r8), pointer :: flux_ch4_grc (:) => null() ! net CH4 flux (kg C/m**2/s) [+ to atm] + real(r8), pointer :: ch4_surf_flux_tot_grc(:) => null() ! net CH4 flux (kg C/m**2/s) [+ to atm] ! lnd->rof contains @@ -150,7 +150,7 @@ subroutine InitAllocate(this, bounds) allocate(this%ram1_grc (begg:endg)) ; this%ram1_grc (:) =ival allocate(this%fv_grc (begg:endg)) ; this%fv_grc (:) =ival allocate(this%flxdst_grc (begg:endg,1:ndst)) ; this%flxdst_grc (:,:) =ival - allocate(this%flux_ch4_grc (begg:endg)) ; this%flux_ch4_grc (:) =ival + allocate(this%ch4_surf_flux_tot_grc(begg:endg)) ; this%ch4_surf_flux_tot_grc(:) =ival if (shr_megan_mechcomps_n>0) then allocate(this%flxvoc_grc(begg:endg,1:shr_megan_mechcomps_n)); this%flxvoc_grc(:,:)=ival @@ -269,10 +269,10 @@ subroutine InitHistory(this, bounds) default='inactive') if (use_lch4) then - this%flux_ch4_grc(begg:endg) = 0._r8 + this%ch4_surf_flux_tot_grc(begg:endg) = 0._r8 call hist_addfld1d (fname='FCH4', units='kgC/m2/s', & avgflag='A', long_name='Gridcell surface CH4 flux to atmosphere (+ to atm)', & - ptr_lnd=this%flux_ch4_grc) + ptr_lnd=this%ch4_surf_flux_tot_grc) this%nem_grc(begg:endg) = spval call hist_addfld1d (fname='NEM', units='gC/m2/s', & From 4e54ff2484f5d4c99ee3987c5b6fbd466a9f8f8d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 25 Jun 2020 11:41:41 -0600 Subject: [PATCH 1061/1973] Document high-level overview of workflow for lilac runtime inputs --- .../ctsm_lilac_runtime_file_workflow.svg | 3 ++ .../obtaining-and-building-ctsm.rst | 4 +- .../setting-ctsm-runtime-options.rst | 47 ++++++++++++++++--- python/ctsm/lilac_download_input_data.py | 2 + 4 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg diff --git a/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg b/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg new file mode 100644 index 0000000000..8cf2328574 --- /dev/null +++ b/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2f85366f00add2d836424009cec66fb5174a5ee90b49acd4cded0a846fb8583 +size 17178 diff --git a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst index 9d12c91cb7..d627ddab1e 100644 --- a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst +++ b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst @@ -1,7 +1,7 @@ -.. _obtaining-and-building-ctsm: - .. highlight:: shell +.. _obtaining-and-building-ctsm: + ======================================= Obtaining and building CTSM and LILAC ======================================= diff --git a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst index 6d5967f625..a663b58773 100644 --- a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst +++ b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst @@ -1,13 +1,13 @@ -.. _setting-ctsm-runtime-options: - .. highlight:: shell +.. _setting-ctsm-runtime-options: + ============================== Setting CTSM runtime options ============================== -Overview -======== +Overview and quick start +======================== This section describes the process for creating the runtime input text files for CTSM and LILAC. These files, which are in Fortran namelist format, have hard-coded file @@ -22,7 +22,42 @@ model is run: .. note:: - There are a number of other runtime input files to both CTSM and LILAC, in NetCDF - format. The paths to these other files are specified in either ``lnd_in`` or + There are a number of other required runtime input files to both CTSM and LILAC, in + NetCDF format. The paths to these other files are specified in either ``lnd_in`` or ``lilac_in``. +The basic process for creating the necessary input files is the following; this process is +also illustrated in :numref:`Figure ctsm_lilac_runtime_file_workflow`: + +#. Run the ``build_ctsm`` script described in section + :numref:`obtaining-and-building-ctsm`. In addition to building CTSM, this also stages + the necessary files in the ``runtime_inputs`` subdirectory of your specified build + directory. Then ``cd`` to this ``runtime_inputs`` subdirectory to do the following + steps (it is fine to do these steps even while CTSM is still building). + +#. Modify the ``ctsm.cfg`` file to set high-level options to CTSM. (A few options need to + be set; most can be left at their default values or changed if desired.) Optionally, + also set specific namelist values in ``user_nl_ctsm``. + +#. Run the script, ``make_runtime_inputs``. (This creates the files ``lnd_in`` and + ``clm.input_data_list``.) + +#. Modify ``lilac_in`` as needed. (Typically you will only need to set values for + ``atm_mesh_filename`` and ``lnd_mesh_filename``; other variables can typically be kept + at their default values.) + +#. Run the script, ``download_input_data`` to download any of CTSM's standard input files + that are needed based on settings in ``lnd_in`` and ``lilac_in``. (This step may be + unnecessary if all of the needed input data already exists. However, it doesn't hurt to + run it in this case.) + +#. Copy ``lnd_in``, ``lnd_modelio.nml`` and ``lilac_in`` to the directory from which you + will be running the model. + +.. _Figure ctsm_lilac_runtime_file_workflow: + +.. figure:: ctsm_lilac_runtime_file_workflow.* + + CTSM/LILAC runtime file workflow. Files in black can be (and in some cases must be) + edited before running the next step. Files in blue should **not** be edited directly. + diff --git a/python/ctsm/lilac_download_input_data.py b/python/ctsm/lilac_download_input_data.py index feed9e8b2c..8d7482d6c6 100644 --- a/python/ctsm/lilac_download_input_data.py +++ b/python/ctsm/lilac_download_input_data.py @@ -84,3 +84,5 @@ def _create_lilac_input_data_list(rundir): line = line.replace('"', '') line = line.replace("'", "") input_data_list.write(line) + + os.remove(os.path.join(rundir, 'lilac.input_data_list')) From 87b36b53177893008b119e0d91dd6c35f2f8d046 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 11 Jun 2020 13:14:41 -0600 Subject: [PATCH 1062/1973] Minor rework of lilacsmoke test Get it passing on my mac (needs --build-without-openmp) and a bit of refactoring --- cime_config/SystemTests/lilacsmoke.py | 43 ++++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index 15f9eb908b..946b439707 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -27,7 +27,6 @@ def build_phase(self, sharedlib_only=False, model_only=False): exeroot = self._case.get_value('EXEROOT') build_dir = os.path.join(caseroot, 'lilac_build') script_path = os.path.abspath(os.path.join(lndroot, 'lilac', 'build_ctsm')) - logs = [] # We only run the initial build command if the build_dir doesn't exist # yet. This is to support rebuilding the test case. (The first time through, @@ -37,6 +36,10 @@ def build_phase(self, sharedlib_only=False, model_only=False): machine = self._case.get_value('MACH') compiler = self._case.get_value('COMPILER') debug = self._case.get_value('DEBUG') + # It would be possible to do this testing via the python interface rather + # than through a separate subprocess. However, we do it through a + # subprocess in order to test the full build_ctsm script, including + # command-line parsing. cmd = '{script_path} {build_dir} --machine {machine} --compiler {compiler}'.format( script_path=script_path, build_dir=build_dir, @@ -44,12 +47,11 @@ def build_phase(self, sharedlib_only=False, model_only=False): compiler=compiler) if debug: cmd += ' --build-debug' - append_testlog(cmd) - run_cmd_no_fail(cmd, arg_stdout='build_ctsm.bldlog', combine_output=True, from_dir=exeroot) - logfile = os.path.join(exeroot, 'build_ctsm.bldlog') - logs.append(logfile) - with open(logfile) as lf: - append_testlog(lf.read()) + # For now, always build this test without threads: it doesn't need + # threads, and building unthreaded ensures that it works on a wider range + # of machines/compilers + cmd += ' --build-without-openmp' + self._run_build_cmd(cmd, exeroot, 'build_ctsm.bldlog') # We call the build script with --rebuild even for an initial build. This is # so we make sure to test the code path for --rebuild. (This is also needed if @@ -58,15 +60,28 @@ def build_phase(self, sharedlib_only=False, model_only=False): cmd = '{script_path} {build_dir} --rebuild'.format( script_path=script_path, build_dir=build_dir) - append_testlog(cmd) - run_cmd_no_fail(cmd, arg_stdout='rebuild_ctsm.bldlog', combine_output=True, from_dir=exeroot) - logfile = os.path.join(exeroot, 'rebuild_ctsm.bldlog') - logs.append(logfile) - with open(logfile) as lf: - append_testlog(lf.read()) + self._run_build_cmd(cmd, exeroot, 'rebuild_ctsm.bldlog') - post_build(self._case, logs, build_complete=True) + # Setting logs=[] implies that we don't bother gzipping any of the build log + # files; that seems fine for these purposes (and it keeps the above code + # simpler). + post_build(self._case, logs=[], build_complete=True) def run_phase(self): # FIXME(wjs, 2020-06-10) Fill this in pass + + @staticmethod + def _run_build_cmd(cmd, exeroot, logfile): + """ + Runs the given build command, with output to the given logfile + + Args: + cmd: str (command to run) + exeroot: str (path to exeroot) + logfile: str (path to logfile) + """ + append_testlog(cmd) + run_cmd_no_fail(cmd, arg_stdout=logfile, combine_output=True, from_dir=exeroot) + with open(os.path.join(exeroot, logfile)) as lf: + append_testlog(lf.read()) From 0528b5fd11990a7c73898cdb3be90fe082dd3a84 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 25 Jun 2020 12:10:21 -0600 Subject: [PATCH 1063/1973] Minor image tweaks --- .../ctsm_lilac_runtime_file_workflow.svg | 4 ++-- .../setting-ctsm-runtime-options.rst | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg b/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg index 8cf2328574..a0d2cf6d07 100644 --- a/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg +++ b/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b2f85366f00add2d836424009cec66fb5174a5ee90b49acd4cded0a846fb8583 -size 17178 +oid sha256:3d86cfb661a03c99574ec626db8be97d8875884f1c3879db9cab935bd0dee7a7 +size 17275 diff --git a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst index a663b58773..d2b3a683d0 100644 --- a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst +++ b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst @@ -58,6 +58,7 @@ also illustrated in :numref:`Figure ctsm_lilac_runtime_file_workflow`: .. figure:: ctsm_lilac_runtime_file_workflow.* - CTSM/LILAC runtime file workflow. Files in black can be (and in some cases must be) - edited before running the next step. Files in blue should **not** be edited directly. + CTSM/LILAC runtime file workflow. Files in blue can be (and in some cases must be) + edited before running the next step. Files in purple (with italicized names) should + **not** be edited directly. From 3b1e861c2a580ae6fc145339f61ff36971137dba Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 26 Jun 2020 01:32:18 -0600 Subject: [PATCH 1064/1973] Update change files --- doc/ChangeLog | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 133 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 0326609823..6f3183ed94 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,136 @@ =============================================================== +Tag name: ctsm1.0.dev102 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Fri Jun 26 01:32:04 MDT 2020 +One-line Summary: Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 + +Purpose of changes +------------------ + +Fix some important issues that were found in LUNA for the arctic. These changes were large enough +that we had to re-tune the clm5_0 parameters to give a similar simulation. Leah Birch noticed +that the formulations in the code disagreed with the paper. Correcting this caused arctic plants +to be less productive. In order to compensate parameters for leafcn, and slatop were adjusted for +broadleaf_deciduous_boreal_shrub and c3_arctic_grass for clm5_0. + +The total vegetation carbon threshold on exit_spinup (from accelerated decomposition (AD) mode) was +increased from 0.1 to 1.0. Without this change some PFT's can die out in exit spinup even when +they have significant carbon stores from the AD spinup mode. + +There is an implicit assumption in the urban building energy model that building width equals +street width. However, this assumption can/should be relaxed and building width can be derived +from the morphology dataset. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #738 #803 #953 #958 #1056 + Fixes #1056 -- Remove allpfts dimension + Fixes #953 -- Incorrect formula in LUNA uses day time rather than average of day/night + Fixes #958 -- LUNA day length factor missing + Fixes #738 -- Totvegc threshold increased from 0.1 to 1. + Fixes #803 -- No longer assume building width + +Known bugs introduced in this tag (include github issue ID): #1060 + #1060 -- Some code cleanup of luna bug fixes + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[x] clm5_0 + +[x] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): clm5_0 climate adjusted for arctic plants + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): + +Changes to the datasets (e.g., parameter, surface or initial files): New parameter files + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): We + chose some bad names for variables, so we'll clean this up in a seperate step (see #1060) + +Changes to tests or testing: None + +Code reviewed by: self, olyson, bill-sacks, wweider + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (266 compare differently because of update in paramsfile and jmaxb1) + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes for clm5_0 + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: clm5_0 when Luna on as well as smaller changes for urban + - what platforms/compilers: all + - nature of change: climate changing, but tuned to respond similar to clm5.0 + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + luna changes: oleson case clm50_ctsm10d089_2deg_GSWP3V1_luna3_jmaxb1-0.17_slatopA_leafcnA_hist + + URL for LMWG diagnostics output used to validate new climate: + + urban changes: + + +http://webext.cgd.ucar.edu/I2000/clm50_ctsm10d098_1deg_GSWP3V1_CON_FIXBUILDENERGY_2000/lnd/clm50_ctsm10d098_1deg_GSWP3V1_CON_FIXBUILDENERGY_2000.1991_2010-clm50_ctsm10d098_1deg_GSWP3V1_CON_2000.1991_2010/setsIndex.html + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #1034 and #962 +(https://github.com/ESCOMP/ctsm/pull) + #1034 -- Building energy fix + #962 --- Fixes for the LUNA dayl bugs + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev101 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326), oleson (Keith Oleson) Date: Wed Jun 17 23:51:22 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 23793cf1c4..655832d263 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev102 erik/ole 06/26/2020 Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 ctsm1.0.dev101 ole/erik 06/17/2020 Changes from Keith to bring a list of variables to the parameter file ctsm1.0.dev100 sacks 06/09/2020 Deallocate memory after running init_interp ctsm1.0.dev099 sacks 06/08/2020 Update cime, needed for izumi machine updates From cf05a2c9554ff4adf7624634c43f5495e1d40bd1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 26 Jun 2020 05:32:31 -0600 Subject: [PATCH 1065/1973] work on documentation --- .../setting-ctsm-runtime-options.rst | 164 ++++++++++++++++++ doc/source/lilac/specific-atm-models/wrf.rst | 2 + lilac/bld_templates/ctsm_template.cfg | 16 ++ 3 files changed, 182 insertions(+) diff --git a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst index d2b3a683d0..a053976e3e 100644 --- a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst +++ b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst @@ -62,3 +62,167 @@ also illustrated in :numref:`Figure ctsm_lilac_runtime_file_workflow`: edited before running the next step. Files in purple (with italicized names) should **not** be edited directly. +More details on these steps are given in the following subsections. + +Creating initial runtime inputs with build_ctsm +=============================================== + +The ``build_ctsm`` script, which is described in detail in section +:numref:`obtaining-and-building-ctsm`, creates initial runtime input files in addition to +building the model. This script creates a number of files in the ``runtime_inputs`` +subdirectory of the specified build directory. For a few variables in these runtime input +files, ``build_ctsm`` sets initial values based on options provided to this +script. Important options for these runtime inputs include ``--no-pnetcdf``, +``--inputdata-path`` and ``--max-mpitasks-per-node``. (Run ``build_ctsm`` with the ``-h`` +or ``--help`` option for more information.) + +Once this script creates and populates the ``runtime_inputs`` subdirectory, it is safe to +proceed with the following steps, even if CTSM has not finished building. + +For the following steps, you should ``cd`` to this ``runtime_inputs`` subdirectory. + +Modifying ctsm.cfg and user_nl_ctsm +=================================== + +CTSM has hundreds of runtime parameters. Most of these parameters can be set individually, +but in many cases it makes more sense to think in terms of high-level options. These +high-level options set groups of parameters, creating configurations that the core CTSM +developers feel are useful - and these standard configurations are generally tested both +from a scientific and software perspective. + +The two text files, ``ctsm.cfg`` and ``user_nl_ctsm``, together with CTSM's scripting +infrastructure and XML database controlled by the ``make_runtime_inputs`` script, work +together to allow you to configure CTSM's runtime parameters at both a high level and +individually. + +ctsm.cfg +-------- + +``ctsm.cfg`` controls high-level options that, in many cases, set the default values for +multiple individual runtime parameters. All of the available high-level options appear in +this file; you can change the values of variables, but cannot add or remove any variables +in this file. + +The first set of options in this file specifies key file names: + +- ``lnd_domain_file`` must be specified. This file specifies CTSM's grid and land + mask. The general process for creating this file is described in section + :numref:`creating-domain-files`. + +- ``fsurdat`` also must be specified. This file specifies a variety of spatially-varying + properties. This file is grid-specific, but can be created from grid-independent files + using CTSM's toolchain described in section :numref:`creating-surface-datasets`. + +- ``finidat`` should generally be specified, although it's not absolutely essential. This + file specifies CTSM's initial conditions. If this isn't specified, the model will use a + standard set of initial conditions, interpolated to your grid. However, particularly for + NWP / prediction applications, you will typically want a customized initial condition + file. The process for generating this file will depend on your atmosphere model and + workflow, but an example for WRF is given in section + :numref:`wrf-create-input-namelists-for-ctsm-and-lilac`. + +The remainder of this file specifies a variety of high-level options, each of which sets +the default values for a number of CTSM's runtime parameters. The default values should be +reasonable starting points, but you may want to configure these. Details on these options +and allowed values are given in comments in ``ctsm.cfg``. + +user_nl_ctsm +------------ + +This file allows you to override individual CTSM namelist variables. This includes +variables whose default values are set based on settings in ``ctsm.cfg`` and others. The +file is initially populated with some settings controlling CTSM's diagnostic (history) +file output. These pre-populated settings can be changed, and additional settings can be +added to this file. + +There is some documentation of these settings in section :numref:`customizing-a-case`, and +in the `CESM release documentation +`_, but note that +the latter is slightly out of date with respect to the latest version of CTSM. An easy way +to see the list of available variables is to run ``make_runtime_inputs`` in order to +generate an initial ``lnd_in`` file; most of the variables given in that file can be +specified in ``user_nl_ctsm``, and then ``make_runtime_inputs`` can be rerun. **As noted +below, it is better NOT to edit the** ``lnd_in`` **file directly, instead using the +workflow documented here.** + +Running make_runtime_inputs +=========================== + +Once you have made the modifications you want to ``ctsm.cfg`` and ``user_nl_ctsm``, run +the script ``make_runtime_inputs`` from the ``runtime_inputs`` directory. This takes +``ctsm.cfg`` and ``user_nl_ctsm`` as inputs, and generates two output files: ``lnd_in`` +and ``clm.input_data_list``. ``lnd_in`` will be read by CTSM. ``clm.input_data_list`` is +an automatic extraction of a subset of ``lnd_in`` specifying the paths of various other +input files that will be needed by CTSM; this is used by the ``download_input_data`` +script to automatically download the relevant files. + +It is safe to rerun ``make_runtime_inputs`` as often as you want, incrementally changing +``ctsm.cfg`` and/or ``user_nl_ctsm``. + +.. important:: + + We recommend that you do NOT modify ``lnd_in`` directly. Instead, to make changes to + the ``lnd_in`` file, you should modify ``user_nl_ctsm`` and rerun + ``make_runtime_inputs``. There are a few reasons for following this workflow: + + - Hand edits to ``lnd_in`` will be lost if you later rerun ``make_runtime_inputs``, + whereas edits to ``user_nl_ctsm`` will be maintained. + + - ``make_runtime_inputs`` performs various validations of the contents of + ``user_nl_ctsm``; these validations would be bypassed if you edited ``lnd_in`` + directly. + + - If you change any file paths, ``make_runtime_inputs`` will ensure that + ``clm.input_data_list`` remains in sync with ``lnd_in``. + +Modifying lilac_in +================== + +Unlike ``lnd_in``, the ``lilac_in`` file can be hand-edited. Most of the settings in this +file can be left at their default values, but there are two variables whose values you +must set (as indicated by their default values, ``FILL_THIS_IN``): + +- ``atm_mesh_filename``: This should specify the path to an ESMF mesh file describing the + atmosphere model's grid. + +- ``lnd_mesh_filename``: This should specify the path to an ESMF mesh file describing the + land model's grid. If the land model is running on the same grid as the atmosphere + model (which is typical), this can be the same file as ``atm_mesh_filename``. + +Other settings you may want to change are: + +- Settings in ``lilac_history_input``: ``lilac_histfreq_option`` and + ``lilac_histfreq_n``. Together, these specify the output frequency from LILAC + itself. Note that this is separate from CTSM's output: LILAC's output contains + instantaneous snapshots of the fields passed from the atmosphere to CTSM and vice + versa, whereas CTSM's output is much more extensive. For many purposes, it's fine to + leave LILAC's output turned off (as is the default). Allowable options for + ``lilac_histfreq_option`` are ``never``, ``nsteps``, ``nseconds``, ``nminutes``, + ``nhours``, ``ndays``, ``nmonths`` and ``nyears``. + +- Settings in ``atmaero_stream``: These specify a dataset containing atmospheric aerosols, + for the (typical) case where the atmosphere model is not sending these aerosols itself. + +Running download_input_data +=========================== + +CTSM requires a variety of runtime input files in NetCDF format. These files are listed in +the ``lnd_in`` file, and are consolidated in the file ``clm.input_data_list`` (which is +produced by ``make_runtime_inputs``). In addition, a few other NetCDF files are listed in +``lilac_in``, of which the file listed in ``atmaero_stream`` is typically a standard input +file (as opposed to one that you, the user, has provided). + +**Idea of inputdata directory... this can be a symlink, or it can be an actual directory, +depending on how build_ctsm was run.** + +**As a convenience, can run download_input_data.** + +**There will likely be errors about some files not being able to be obtained, particularly +for user-provided files.** + +Copying the necessary files to the model's run directory +======================================================== + +.. todo:: + + TODO: Fill this section in diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 8cae475d42..460c017f36 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -278,6 +278,8 @@ Check the last line of the real log file for the following message:: SUCCESS COMPLETE REAL_EM INIT +.. _wrf-create-input-namelists-for-ctsm-and-lilac: + Create input namelists for CTSM and LILAC ========================================= diff --git a/lilac/bld_templates/ctsm_template.cfg b/lilac/bld_templates/ctsm_template.cfg index be485c9708..dfe57e24f6 100644 --- a/lilac/bld_templates/ctsm_template.cfg +++ b/lilac/bld_templates/ctsm_template.cfg @@ -37,9 +37,25 @@ finidat = UNSET ctsm_phys = clm5_0 # configuration: 'nwp' or 'clm' +# +# This controls a number of physics options that differ between the +# standard numerical weather prediction (nwp) and climate (clm) +# configurations of CTSM. These are typically options that are +# computationally expensive. These include plant hydraulic stress and +# the MEGAN chemistry model (both of which are on by default for clm but +# off by default for nwp). configuration = nwp # structure: 'fast' or 'standard' +# +# This controls various aspects of CTSM's subgrid and vertical layer +# structure. Typically, 'fast' is used for high-resolution NWP +# applications and 'standard' is used for lower-resolution climate +# applications. Parameters changed by this variable include number of +# soil and snow layers and how much subgrid variability is allowed in +# each grid cell. This also controls the maximum number of iterations in +# some iterative solution schemes - again, trading off speed for +# accuracy. structure = fast # bgc_mode: From 86ebca65ab2c4cee9e819cd1bc874a2d04efc19c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 26 Jun 2020 05:57:25 -0600 Subject: [PATCH 1066/1973] Change some shebang lines to python3 Some of the lilac-related scripts may not work with python2. It's hard to find a definitive guide on how to write the shebang line, but the recommendation seems to be to use python3 in this case. --- .../obtaining-and-building-ctsm.rst | 5 +++-- lilac/build_ctsm | 2 +- lilac/download_input_data | 2 +- lilac/make_runtime_inputs | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst index d627ddab1e..4798808308 100644 --- a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst +++ b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst @@ -64,8 +64,9 @@ Building CTSM requires: - python3 - - The default version of python (when you run python without specifying 2 vs. 3) should - be python3 + - Note that some scripts in the workflow look for 'python3' and others look for + 'python'. So python should be available under both of these names (although it is okay + for ``python`` to refer to version 2.7.x). - perl version 5 diff --git a/lilac/build_ctsm b/lilac/build_ctsm index 62c330118d..b460f9b011 100755 --- a/lilac/build_ctsm +++ b/lilac/build_ctsm @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Script to build CTSM library and its dependencies using cime's build system""" import os diff --git a/lilac/download_input_data b/lilac/download_input_data index 70daf01a3c..056467bce8 100755 --- a/lilac/download_input_data +++ b/lilac/download_input_data @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Download input data for running CTSM via LILAC""" import os diff --git a/lilac/make_runtime_inputs b/lilac/make_runtime_inputs index 93f218a9d0..61e06f6adc 100755 --- a/lilac/make_runtime_inputs +++ b/lilac/make_runtime_inputs @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """CTSM namelist creator""" import os From 513299850a4721443f689f0edba5f60dce8c47e9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 26 Jun 2020 11:27:25 -0600 Subject: [PATCH 1067/1973] Finish first draft of documentation on setting ctsm-lilac runtime options --- .../setting-ctsm-runtime-options.rst | 51 +++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst index a053976e3e..a338324e07 100644 --- a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst +++ b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst @@ -212,17 +212,50 @@ produced by ``make_runtime_inputs``). In addition, a few other NetCDF files are ``lilac_in``, of which the file listed in ``atmaero_stream`` is typically a standard input file (as opposed to one that you, the user, has provided). -**Idea of inputdata directory... this can be a symlink, or it can be an actual directory, -depending on how build_ctsm was run.** - -**As a convenience, can run download_input_data.** - -**There will likely be errors about some files not being able to be obtained, particularly -for user-provided files.** +CTSM's standard input files are expected to be in subdirectories of an ``inputdata`` +directory. With the ``build_ctsm`` workflow, this ``inputdata`` directory can be found +under the specified build directory. Depending on the options used for ``build_ctsm``, +this may be a new directory or it may be a symbolic link to an existing directory. These +standard input files are stored on a number of publicly available servers, such as +https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata/. + +As a convenience, we provide a tool to obtain all of the needed standard input files for +your configuration: **To download these files to their expected locations, simply run** +``download_input_data`` **from the** ``runtime_inputs`` **directory.** This script reads +the file names from ``clm.input_data_list`` and ``lilac_in`` to determine which files need +to be downloaded. + +You will likely get some messages like, "Cannot download file since it lives outside of +the input_data_root", possibly followed by a final message, "Could not find all inputdata +on any server". As long as these messages just refer to your custom, resolution-specific +files (and not to CTSM's standard input files), then this is nothing to worry about. Copying the necessary files to the model's run directory ======================================================== -.. todo:: +Finally, copy the following files to the directory from which you will run the model: + +- ``lnd_in``: This is the main namelist input file for CTSM + +- ``lnd_modelio.nml``: This sets CTSM's PIO (parallel i/o library) configuration settings + +- ``lilac_in``: This namelist controls the operation of LILAC + +.. note:: - TODO: Fill this section in + We have not discussed ``lnd_modelio.nml`` above. This is because, if you have run + ``build_ctsm`` with appropriate options, then you shouldn't need to make any changes to + this file. However, you may want to confirm that two settings, in particular, are set + correctly for your machine; these can be important for I/O performance: + + - ``pio_stride``: this should generally be set to the number of physical processors per + shared-memory node on your machine. This is set from the ``--max-mpitasks-per-node`` + argument for a user-defined machine; it should be set automatically for a machine + that has been ported to CIME. + + - ``pio_typename``: this should generally be set to either ``pnetcdf`` or + ``netcdf``. Using PNetCDF (Parallel NetCDF) can result in significantly better I/O + performance, but this is only possible if you have the PNetCDF library on your + machine. The default for this variable is controlled by the ``--no-pnetcdf`` argument + to ``build_ctsm``, but you can change it here if you mistakenly set or didn't set + ``--no-pnetcdf`` when running ``build_ctsm``. From 5f3c439c46ea18d9361eed11995fdcee62da654f Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 18 Feb 2020 21:19:42 -0700 Subject: [PATCH 1068/1973] Fixed hydro restart bug (needed to initialize bcs prior to initializing wrfs). --- .../testmods_dirs/clm/FatesHydro/user_nl_clm | 2 +- src/biogeophys/CanopyFluxesMod.F90 | 3 +- src/utils/clmfates_interfaceMod.F90 | 38 +++++++++++++++++-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm index 2435b5bc7e..c7d24f7ab1 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm @@ -1,5 +1,5 @@ hist_empty_htapes = .true. use_fates_planthydro= .true. -hist_fincl1 = 'FATES_ERRH2O_SCPF','FATES_TRAN_SCPF','FATES_ROOTUPTAKE_SCPF','FATES_ROOTUPTAKE01_SCPF', +hist_fincl1 = 'FATES_ERRH2O_SCPF','FATES_TRAN_SCPF', 'FATES_SAPFLOW_COL_SCPF','FATES_ITERH1_COL_SCPF','FATES_ATH_COL_SCPF','FATES_TTH_COL_SCPF', 'FATES_STH_COL_SCPF','FATES_LTH_COL_SCPF','FATES_AWP_COL_SCPF','FATES_BTRAN_COL_SCPF' diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index cb68d92aec..9a15c8b7cc 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1311,7 +1311,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, call clm_fates%wrap_accumulatefluxes(nc,fn,filterp(1:fn)) call clm_fates%wrap_hydraulics_drive(bounds,nc,soilstate_inst, & - waterstatebulk_inst,waterdiagnosticbulk_inst,waterfluxbulk_inst,solarabs_inst,energyflux_inst) + waterstatebulk_inst,waterdiagnosticbulk_inst,waterfluxbulk_inst, & + fn, filterp, solarabs_inst,energyflux_inst) else diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index c457fd8983..571df8449e 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1155,8 +1155,24 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoil) = & soilstate_inst%hksat_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoil) = & + soilstate_inst%watsat_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoil) = & + soilstate_inst%watres_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoil) = & + soilstate_inst%sucsat_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoil) = & + soilstate_inst%bsw_col(c,1:nlevsoil) + + this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoil) = & + waterdiagnosticbulk_inst%waterstate_inst%h2osoi_liq_col(c,1:nlevsoil) end do + call RestartHydrStates(this%fates(nc)%sites, & this%fates(nc)%nsites, & this%fates(nc)%bc_in, & @@ -2209,7 +2225,7 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & ! This is the total amount of water transferred to surface runoff ! (this is generated potentially from supersaturating soils - waterflux_inst%qflx_drain_vr_col(c,1:nlevsoil) = this%fates(nc)%bc_out(s)%qflx_ro_sisl(1:nlevsoil) + waterfluxbulk_inst%qflx_drain_vr_col(c,1:nlevsoil) = this%fates(nc)%bc_out(s)%qflx_ro_sisl(1:nlevsoil) end do @@ -2249,13 +2265,15 @@ end subroutine ComputeRootSoilFlux subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & soilstate_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & - solarabs_inst, energyflux_inst) + fn, filterp, solarabs_inst, energyflux_inst) implicit none class(hlm_fates_interface_type), intent(inout) :: this type(bounds_type),intent(in) :: bounds_clump integer,intent(in) :: nc + integer, intent(in) :: fn + integer, intent(in) :: filterp(fn) type(soilstate_type) , intent(inout) :: soilstate_inst type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst @@ -2269,7 +2287,8 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & integer :: j integer :: ifp integer :: p - integer :: nlevsoil + integer :: f + integer :: nlevsoil real(r8) :: dtime @@ -2306,10 +2325,21 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & p = ifp+col%patchi(c) this%fates(nc)%bc_in(s)%swrad_net_pa(ifp) = solarabs_inst%fsa_patch(p) this%fates(nc)%bc_in(s)%lwrad_net_pa(ifp) = energyflux_inst%eflx_lwrad_net_patch(p) - this%fates(nc)%bc_in(s)%qflx_transp_pa(ifp) = waterfluxbulk_inst%qflx_tran_veg_patch(p) end do end do + ! The exposed vegetation filter "filterp" dictates which patches + ! had their transpiration updated during canopy_fluxes(). Patches + ! not in the filter had been zero'd during prep_canopyfluxes(). + + do f = 1,fn + p = filterp(f) + c = patch%column(p) + s = this%f2hmap(nc)%hsites(c) + ifp = p - col%patchi(c) + this%fates(nc)%bc_in(s)%qflx_transp_pa(ifp) = waterfluxbulk_inst%qflx_tran_veg_patch(p) + end do + ! Call Fates Hydraulics ! ------------------------------------------------------------------------------------ From 5e6fdab3b3fafc7a919304cacf2a2fb7e95f301f Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 18 Feb 2020 21:27:40 -0700 Subject: [PATCH 1069/1973] fates-hydro: removed dependence on qflx_drain_vr_col --- src/biogeophys/BalanceCheckMod.F90 | 9 +-------- src/biogeophys/SoilWaterMovementMod.F90 | 17 ++++++++--------- src/utils/clmfates_interfaceMod.F90 | 4 ++-- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index c2d58f711e..d46fd31626 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -38,19 +38,11 @@ module BalanceCheckMod ! !PUBLIC TYPES: implicit none save - private ! ! !PUBLIC MEMBER FUNCTIONS: - public :: BalanceCheckInit ! Initialization of Water and energy balance check public :: BeginWaterBalance ! Initialize water balance check public :: BalanceCheck ! Water and energy balance check - public :: GetBalanceCheckSkipSteps ! Get the number of steps to skip for the balance check - public :: BalanceCheckClean ! Clean up for BalanceCheck - - ! !PRIVATE MEMBER DATA: - real(r8), private, parameter :: skip_size = 3600.0_r8 ! Time steps to skip the balance check at startup (sec) - integer, private :: skip_steps = -999 ! Number of time steps to skip the balance check for ! ! !PRIVATE MEMBER FUNCTIONS: @@ -250,6 +242,7 @@ subroutine BalanceCheck( bounds, & use clm_varcon , only : spval use clm_time_manager , only : get_step_size_real, get_nstep use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause + use clm_instMod , only : surfalb_inst use CanopyStateType , only : canopystate_type use subgridAveMod ! diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 index b543f5d1b9..352a93e82d 100644 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ b/src/biogeophys/SoilWaterMovementMod.F90 @@ -775,7 +775,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & qout(c,j) = -hk(c,j)*num/den dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den dqodw2(c,j) = -( hk(c,j)*dsmpdw(c,j+1) + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j) + qflx_drain_vr_col(c,j)) + rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) amx(c,j) = 0._r8 bmx(c,j) = dzmm(c,j)*(sdamp+1._r8/dtime) + dqodw1(c,j) cmx(c,j) = dqodw2(c,j) @@ -799,7 +799,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & qout(c,j) = -hk(c,j)*num/den dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den dqodw2(c,j) = -( hk(c,j)*dsmpdw(c,j+1) + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j)+qflx_drain_vr_col(c,j)) + rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) amx(c,j) = -dqidw0(c,j) bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) cmx(c,j) = dqodw2(c,j) @@ -821,7 +821,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & dqidw1(c,j) = -( hk(c,j-1)*dsmpdw(c,j) + num*dhkdw(c,j-1))/den qout(c,j) = 0._r8 dqodw1(c,j) = 0._r8 - rmx(c,j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j)+qflx_drain_vr_col(c,j)) + rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) amx(c,j) = -dqidw0(c,j) bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) cmx(c,j) = 0._r8 @@ -864,7 +864,7 @@ subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den dqodw2(c,j) = -( hk(c,j)*dsmpdw1 + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j)+qflx_drain_vr_col(c,j)) + rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) amx(c,j) = -dqidw0(c,j) bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) cmx(c,j) = dqodw2(c,j) @@ -1154,8 +1154,7 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice water (kg/m2) h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col , & - qflx_drain_vr_col => waterfluxbulk_inst%qflx_drain_vr_col & + qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col ) ! end associate statement ! Get time step @@ -1222,7 +1221,7 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & ! RHS of system of equations call compute_RHS_moisture_form(c, nlayers, & - (qflx_rootsoi_col(c,1:nlayers) + qflx_drain_vr_col(c,1:nlayers)), & + qflx_rootsoi_col(c,1:nlayers), & vwc_liq(c,1:nlayers), & qin(c,1:nlayers), & qout(c,1:nlayers), & @@ -1315,7 +1314,7 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & endif ! compute the net flux - fluxNet0(j) = qin_test - qout_test - (qflx_rootsoi_col(c,j) + qflx_drain_vr_col(c,j)) + fluxNet0(j) = qin_test - qout_test - qflx_rootsoi_col(c,j) ! flux calculation is inexpensive else @@ -1326,7 +1325,7 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & endif ! switch between the expensive and inexpensive fluxcalculations ! compute the net flux at the start of the sub-step - fluxNet1(j) = qin(c,j) - qout(c,j) - (qflx_rootsoi_col(c,j)+qflx_drain_vr_col(c,j)) + fluxNet1(j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) end do ! looping through layers diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 571df8449e..7ecf2d317e 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2224,8 +2224,8 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & ! This is the total amount of water transferred to surface runoff ! (this is generated potentially from supersaturating soils - - waterfluxbulk_inst%qflx_drain_vr_col(c,1:nlevsoil) = this%fates(nc)%bc_out(s)%qflx_ro_sisl(1:nlevsoil) + ! (currently this is unnecessary) + ! waterflux_inst%qflx_drain_vr_col(c,1:nlevsoil) = this%fates(nc)%bc_out(s)%qflx_ro_sisl(1:nlevsoil) end do From 0ff4da58d67eaf66f766a2ee2b25dc6014de216d Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 26 Jun 2020 15:36:38 -0600 Subject: [PATCH 1070/1973] Clarifications and modifications in wrf.rst --- doc/source/lilac/specific-atm-models/wrf.rst | 175 ++++++++----------- 1 file changed, 76 insertions(+), 99 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 460c017f36..29277ac898 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -9,7 +9,7 @@ This section describes the procedure for building and running the CTSM library and its dependencies, and linking to these libraries in the WRF model's build via LILAC. As such this section repeats some information -from earlier sections but in recipe form and with minimal detail. +from earlier sections but in recipe form and with minimal explanation. .. important:: @@ -35,15 +35,17 @@ Clone the CTSM repository:: .. todo:: Remove "git checkout lilac_cap" from the above when ready + Also the clone has been giving me: + git-lfs filter-process: git-lfs: command not found + fatal: The remote end hung up unexpectedly + warning: Clone succeeded, but checkout failed. + ...until I type module load git; git lfs install + ...do we need to warn users in case they happen to be contributing to doc? -Build CTSM and its dependencies based on instructions from previous sections, -for example for cheyenne:: +Build CTSM and its dependencies. Again, this example assumes that you are +working on cheyenne:: - ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne --build-without-openmp - -.. todo:: - - Remove "--build-without-openmp" from the above when ready + ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne Source ctsm_build_environment.sh (bash environment):: @@ -57,14 +59,11 @@ or ctsm_build_environment.csh (Cshell environment): .. note:: - For additional details on preparing the CTSM, including how to + For further detail on preparing the CTSM, including how to recompile when making code changes to the CTSM, read Section 3.2: - https://escomp.github.io/ctsm-docs/versions/master/html/lilac/obtaining-building-and-running/index.html https:../obtaining-building-and-running/index.html - -.. todo:: - - If the second (relative) link works, remove the first (absolute) link + By the way, do not let Section 3.2.2 confuse you. We address that step + right after compiling the WRF model (next). Building the WRF model with CTSM -------------------------------- @@ -77,7 +76,7 @@ Building the WRF model with CTSM Clone the WRF CTSM branch into your_directory_name:: cd .. - git clone git@github.com:billsacks/WRF.git + git clone https://github.com/billsacks/WRF.git cd WRF git checkout lilac_dev @@ -112,7 +111,7 @@ The ./clean command is necessary after any modification of WRF code:: ./configure At the prompt choose one of the options, similar to the compiler used -for building CTSM. The specific example has been tested successfuly by +for building CTSM. The specific example has been tested successfully by choosing 15 here. .. todo:: @@ -129,8 +128,8 @@ Now compile em_real and save the log:: .. note:: - The ./compile step might take more than 30 minutes to complete. - + Optional: One may use tmux or nohup for configuring and compiling. + Try "man nohup" for more information. .. note:: @@ -139,15 +138,48 @@ Now compile em_real and save the log:: .. note:: - Optional: One may use tmux or nohup for configuring and compiling. - Try "man nohup" for more information. + The ./compile step may take more than 30 minutes to complete. + While you wait, follow the instructions in Section 3.2.2 (next) + +Now follow the instructions in this Section:: + + https:../obtaining-building-and-running/setting-ctsm-runtime-options.html + +In step 3 of that Section we used for this example:: + + lnd_domain_file = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files/domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc + fsurdat = /glade/work/slevis/git_wrf/ctsm_surf/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc + finidat = /glade/work/slevis/git_wrf/ctsm_init/finidat_interp_dest_wrfinit_snow_ERAI_12month.nc +In step 4 of that Section we used for this example:: + + atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + +In step 6 of that Section you will copy some files to your WRF/run +directory. Then you will be ready to continue. + +.. note:: + + If you wish to merge your WRF initial conditions from a wrfinput file + into the existing CTSM initial condition file, complete the following step. + +Type:: + + module load ncl + ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="the_existing_finidat_file.nc"' 'wrfinput="your_wrfinput_file"' 'merged="the_merged_finidat_file.nc"' + +.. todo:: + + Make the above ncl script available. Compile WRF Preprocessing System (WPS) -------------------------------------- The WRF Preprocessing System (WPS) is a set of programs to prepare inputs to the real program executable (real.exe) for WRF real-data simulations. +If you wish to complete the offered example with preexisting inputs, then +skip to the next section, which is titled "Run WRF." .. note:: @@ -183,8 +215,8 @@ Then, compile WPS:: Alternatively, you can check the log for successful build message. -Run WRF Preprocessing System (WPS) ----------------------------------- +Run WPS +------- Edit namelist.wps for your domain of interest, which should be the same domain as used in your WRF namelist. @@ -278,86 +310,17 @@ Check the last line of the real log file for the following message:: SUCCESS COMPLETE REAL_EM INIT -.. _wrf-create-input-namelists-for-ctsm-and-lilac: - -Create input namelists for CTSM and LILAC -========================================= - -Introduce the following diffs to -./your_directory_name/ctsm/lilac/atm_driver/ -where is atm_driver_in, ctsm.cfg, and lilac_in. -In particular, replace the entries preceded by minus signs with the entries -preceded by plus signs. - -diff ./lilac/atm_driver/atm_driver_in ./lilac/atm_driver/atm_driver_in: - -.. code-block:: diff - - - atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - - atm_global_nx = 72 - - atm_global_ny = 46 - + atm_mesh_file = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' - + atm_global_nx = 199 - + atm_global_ny = 139 - -diff ./lilac/atm_driver/ctsm.cfg ./lilac/atm_driver/ctsm.cfg: - -.. code-block:: diff - - -configuration = clm - -structure = standard - -clm_bldnml_opts = -bgc sp - -gridmask = gx3v7 - -lnd_grid = 4x5 - -lnd_domain_file = domain.lnd.fv4x5_gx3v7.091218.nc - -lnd_domain_path = /glade/p/cesmdata/cseg/inputdata/share/domains - -clm_namelist_opts = hist_nhtfrq=-24 hist_mfilt=1 hist_ndens=1 - +configuration = nwp - +structure = fast - +clm_bldnml_opts = -bgc sp -clm_usr_name wrf2ctsm - +gridmask = null - +lnd_grid = wrf2ctsm - +lnd_domain_file = domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc - +lnd_domain_path = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files - +clm_namelist_opts = hist_nhtfrq=1 hist_mfilt=1 hist_ndens=1 fsurdat="/glade/work/barlage/ctsm/conus/surfdata_conus/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc" finidat="/glade/scratch/sacks/wrf_code/WRF/test/em_real/nldas_nwp_0109a.clm2.r.2000-04-01-64800.nc" use_init_interp=.true. - -diff ./lilac/atm_driver/lilac_in ./lilac/atm_driver/lilac_in: - -.. code-block:: diff - - - atm_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - + atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' - - - lnd_mesh_filename = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' - + lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' - -Before you generate the lnd_in file, you may modify user_nl_clm in -/glade/scratch/$USER/ctsm_build_dir/case/. For example you may wish to -point to an alternate CTSM initial condition file. To merge WRF initial -conditions from a wrfinput file into a CTSM initial condition file, type:: - - module load ncl - ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="finidat_interp_dest.nc"' 'wrfinput="./your_directory_name/WRF/test/em_real/wrfinput_d01.noseaice"' 'merged="finidat_interp_dest_wrfinit_snow.nc"' - -.. todo:: - - Make the above ncl script available. If the finidat and wrfinput files - need to be consistent for this to work, we should explain how to - generate a consistent finidat file. - -Generate the lnd_in file by running the following from -./your_directory_name/ctsm/lilac/atm_driver:: - - ../../lilac_config/buildnml - -Copy lilac_in, lnd_in, and lnd_modelio.nml to the WRF/run directory. - Run WRF ------- -If real program completed successfully, we should see wrfinput and wrfbdy files -in our directory. +If real.exe completed successfully, we should have wrfinput and wrfbdy files +in our directory. If you plan to use this example's preexisting files, copy +the following files to your WRF/run directory:: + + /glade/work/slevis/git_wrf/WRF/test/em_real/namelist.input.ctsm.2013.d01.12month + /glade/work/slevis/git_wrf/WRF/test/em_real/wrfinput_d01.ERAI.12month + /glade/work/slevis/git_wrf/WRF/test/em_real/wrfbdy_d01.ERAI.12month Now run WRF-CTSM. On Cheyenne this means submitting a batch job to PBS (Pro workload management system). For detailed instructions on running a batch job on Cheyenne, please check: @@ -372,6 +335,7 @@ A simple PBS script to run WRF-CTSM on Cheyenne looks like this: #PBS -A your_project_code #PBS -l walltime=01:00:00 #PBS -q queue_name + #PBS -j oe #PBS -k eod #PBS -m abe #PBS -M your_email_address @@ -384,6 +348,19 @@ A simple PBS script to run WRF-CTSM on Cheyenne looks like this: ### Run the executable mpiexec_mpt ./wrf.exe -If you named this script run_wrf_ctsm.csh, then you type next:: +If you named this script run_wrf_ctsm.csh, submit the job like this:: qsub run_wrf_ctsm.csh + +If your terminal windows have logged off, repeat +source ctsm_build_environment.sh (bash environment) before submitting +the job:: + + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh + +or ctsm_build_environment.csh (Cshell environment): + +.. code-block:: Tcsh + + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh + From 120deab626412a474c450341fafe2a71265a4416 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 26 Jun 2020 11:40:34 -0600 Subject: [PATCH 1071/1973] LILAC: Change setting for pio_rearr_comm_max_pend_req_comp2io See discussion in https://github.com/ESMCI/cime/pull/3594 for rationale: basically, 0 has meant something different for the last few months. --- lilac/bld_templates/lilac_in_template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/bld_templates/lilac_in_template b/lilac/bld_templates/lilac_in_template index 304191ee09..6295929e23 100644 --- a/lilac/bld_templates/lilac_in_template +++ b/lilac/bld_templates/lilac_in_template @@ -26,7 +26,7 @@ pio_rearr_comm_enable_isend_comp2io = .false. pio_rearr_comm_enable_isend_io2comp = .true. pio_rearr_comm_fcd = "2denable" - pio_rearr_comm_max_pend_req_comp2io = 0 + pio_rearr_comm_max_pend_req_comp2io = -2 pio_rearr_comm_max_pend_req_io2comp = 64 pio_rearr_comm_type = "p2p" / From f76d039d121472b43f4587b380d22d33fadb1b06 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 18 Feb 2020 21:30:43 -0700 Subject: [PATCH 1072/1973] fixed reverting files to the wrong version of fates_next_api --- src/biogeophys/BalanceCheckMod.F90 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index d46fd31626..480eff0298 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -38,11 +38,19 @@ module BalanceCheckMod ! !PUBLIC TYPES: implicit none save + private ! ! !PUBLIC MEMBER FUNCTIONS: + public :: BalanceCheckInit ! Initialization of Water and energy balance check public :: BeginWaterBalance ! Initialize water balance check public :: BalanceCheck ! Water and energy balance check + public :: GetBalanceCheckSkipSteps ! Get the number of steps to skip for the balance check + public :: BalanceCheckClean ! Clean up for BalanceCheck + + ! !PRIVATE MEMBER DATA: + real(r8), private, parameter :: skip_size = 3600.0_r8 ! Time steps to skip the balance check at startup (sec) + integer, private :: skip_steps = -999 ! Number of time steps to skip the balance check for ! ! !PRIVATE MEMBER FUNCTIONS: @@ -244,6 +252,7 @@ subroutine BalanceCheck( bounds, & use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause use clm_instMod , only : surfalb_inst use CanopyStateType , only : canopystate_type + use SurfaceAlbedoType , only : surfalb_type use subgridAveMod ! ! !ARGUMENTS: From a5f4e8b3f14cadfb8d9fbb52aa021ecec9cc2040 Mon Sep 17 00:00:00 2001 From: Jessica Needham Date: Thu, 2 Jan 2020 10:00:54 -0800 Subject: [PATCH 1073/1973] Add a new fates dimension to track cohort age. Add variables that track size and age dependent mortality. Add coage dimension to clmfates_interfaceMod.F90 and histFileMod.F90. This allows cohort age to be tracked. Also add variables that allow size and age dependent mortality to be tracked. These mortality functions have been added to the fates code. --- src/main/histFileMod.F90 | 33 +++++++++++++++++++++++++++-- src/utils/clmfates_interfaceMod.F90 | 21 +++++++++++++++--- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index f403b1c663..ee6483256b 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -23,7 +23,7 @@ module histFileMod use PatchType , only : patch use EDTypesMod , only : nclmax use EDTypesMod , only : nlevleaf - use FatesInterfaceMod , only : nlevsclass, nlevage + use FatesInterfaceMod , only : nlevsclass, nlevage, nlevcoage use FatesInterfaceMod , only : nlevheight use EDTypesMod , only : nfsc use FatesLitterMod , only : ncwd @@ -914,6 +914,7 @@ subroutine htape_addfld (t, f, avgflag) integer :: numc ! total number of columns across all processors integer :: nump ! total number of pfts across all processors integer :: num2d ! size of second dimension (e.g. .number of vertical levels) + character(len=hist_dim_name_length) :: type2d integer :: beg1d_out,end1d_out ! history output per-proc 1d beginning and ending indices integer :: beg1d,end1d ! beginning and ending indices for this field (assume already set) integer :: num1d_out ! history output 1d size @@ -1048,6 +1049,9 @@ subroutine htape_addfld (t, f, avgflag) tape(t)%hlist(n)%avgflag = avgflag end if + type2d = tape(t)%hlist(n)%field%type2d + + end subroutine htape_addfld !----------------------------------------------------------------------- @@ -1072,6 +1076,7 @@ subroutine hist_update_hbuf(bounds) do t = 1,ntapes !$OMP PARALLEL DO PRIVATE (f, num2d, numdims) do f = 1,tape(t)%nflds + numdims = tape(t)%hlist(f)%field%numdims if ( numdims == 1) then @@ -1393,6 +1398,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) ! !USES: use subgridAveMod , only : p2g, c2g, l2g, p2l, c2l, p2c use decompMod , only : BOUNDS_LEVEL_PROC + use clm_varctl , only : iulog ! ! !ARGUMENTS: integer, intent(in) :: t ! tape index @@ -1443,6 +1449,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) no_snow_behavior = tape(t)%hlist(f)%field%no_snow_behavior hpindex = tape(t)%hlist(f)%field%hpindex + if (no_snow_behavior /= no_snow_unset) then ! For multi-layer snow fields, build a special output variable that handles ! missing snow layers appropriately @@ -1462,6 +1469,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) call hist_set_snow_field_2d(field, clmptr_ra(hpindex)%ptr, no_snow_behavior, type1d, & beg1d, end1d) else + field => clmptr_ra(hpindex)%ptr(:,1:num2d) field_allocated = .false. end if @@ -2067,17 +2075,20 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'scale_type_string_length', scale_type_strlen, dimid) call ncd_defdim( lnfid, 'levdcmp', nlevdecomp_full, dimid) + if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * maxveg_fates, dimid) call ncd_defdim(lnfid, 'fates_levagepft', nlevage * maxveg_fates, dimid) call ncd_defdim(lnfid, 'fates_levscls', nlevsclass, dimid) + call ncd_defdim(lnfid, 'fates_levcacls', nlevcoage, dimid) call ncd_defdim(lnfid, 'fates_levpft', maxveg_fates, dimid) call ncd_defdim(lnfid, 'fates_levage', nlevage, dimid) call ncd_defdim(lnfid, 'fates_levheight', nlevheight, dimid) call ncd_defdim(lnfid, 'fates_levfuel', nfsc, dimid) call ncd_defdim(lnfid, 'fates_levcwdsc', ncwd, dimid) call ncd_defdim(lnfid, 'fates_levscpf', nlevsclass*maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levcapf', nlevcoage*maxveg_fates, dimid) call ncd_defdim(lnfid, 'fates_levcan', nclmax, dimid) call ncd_defdim(lnfid, 'fates_levcnlf', nlevleaf * nclmax, dimid) call ncd_defdim(lnfid, 'fates_levcnlfpf', nlevleaf * nclmax * maxveg_fates, dimid) @@ -2501,6 +2512,9 @@ subroutine htape_timeconst(t, mode) use FatesInterfaceMod, only : fates_hdim_levsclass use FatesInterfaceMod, only : fates_hdim_pfmap_levscpf use FatesInterfaceMod, only : fates_hdim_scmap_levscpf + use FatesInterfaceMod, only : fates_hdim_levcoage + use FatesInterfaceMod, only : fates_hdim_pfmap_levcapf + use FatesInterfaceMod, only : fates_hdim_camap_levcapf use FatesInterfaceMod, only : fates_hdim_levage use FatesInterfaceMod, only : fates_hdim_levheight use FatesInterfaceMod, only : fates_hdim_levpft @@ -2592,6 +2606,12 @@ subroutine htape_timeconst(t, mode) long_name='FATES pft index of the combined pft-size class dimension', units='-', ncid=nfid(t)) call ncd_defvar(varname='fates_scmap_levscpf',xtype=ncd_int, dim1name='fates_levscpf', & long_name='FATES size index of the combined pft-size class dimension', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_levcacls', xtype=tape(t)%ncprec, dim1name='fates_levcacls', & + long_name='FATES cohort age class lower bound', units='years', ncid=nfid(t)) + call ncd_defvar(varname='fates_pftmap_levcapf',xtype=ncd_int, dim1name='fates_levcapf', & + long_name='FATES pft index of the combined pft-cohort age class dimension', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_camap_levcapf',xtype=ncd_int, dim1name='fates_levcapf', & + long_name='FATES cohort age index of the combined pft-cohort age dimension', units='-', ncid=nfid(t)) call ncd_defvar(varname='fates_levage',xtype=tape(t)%ncprec, dim1name='fates_levage', & long_name='FATES patch age (yr)', ncid=nfid(t)) call ncd_defvar(varname='fates_levheight',xtype=tape(t)%ncprec, dim1name='fates_levheight', & @@ -2656,8 +2676,11 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='fates_scmap_levscag',data=fates_hdim_scmap_levscag, ncid=nfid(t), flag='write') call ncd_io(varname='fates_agmap_levscag',data=fates_hdim_agmap_levscag, ncid=nfid(t), flag='write') call ncd_io(varname='fates_levscls',data=fates_hdim_levsclass, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_levcacls',data=fates_hdim_levcoage, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levscpf',data=fates_hdim_pfmap_levscpf, ncid=nfid(t), flag='write') call ncd_io(varname='fates_scmap_levscpf',data=fates_hdim_scmap_levscpf, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_pftmap_levcapf',data=fates_hdim_pfmap_levcapf, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_camap_levcapf',data=fates_hdim_camap_levcapf, ncid=nfid(t), flag='write') call ncd_io(varname='fates_levage',data=fates_hdim_levage, ncid=nfid(t), flag='write') call ncd_io(varname='fates_levheight',data=fates_hdim_levheight, ncid=nfid(t), flag='write') call ncd_io(varname='fates_levpft',data=fates_hdim_levpft, ncid=nfid(t), flag='write') @@ -4908,6 +4931,8 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, num2d = nlevdecomp_full case ('fates_levscls') num2d = nlevsclass + case('fates_levcacls') + num2d = nlevcoage case ('fates_levpft') num2d = maxveg_fates case ('fates_levage') @@ -4920,6 +4945,8 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, num2d = ncwd case ('fates_levscpf') num2d = nlevsclass*maxveg_fates + case ('fates_levcapf') + num2d = nlevcoage*maxveg_fates case ('fates_levscag') num2d = nlevsclass*nlevage case ('fates_levscagpf') @@ -4972,8 +4999,8 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, end select ! History buffer pointer - hpindex = pointer_index() + if (present(ptr_lnd)) then l_type1d = grlnd @@ -4989,6 +5016,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, l_type1d = namel l_type1d_out = namel clmptr_ra(hpindex)%ptr => ptr_lunit + if (present(set_lake)) then do l = bounds%begl,bounds%endl if (lun%lakpoi(l)) ptr_lunit(l,:) = set_lake @@ -5054,6 +5082,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, l_type1d = namep l_type1d_out = namep clmptr_ra(hpindex)%ptr => ptr_patch + if (present(set_lake)) then do p = bounds%begp,bounds%endp l =patch%landunit(p) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 7ecf2d317e..d9b84c82c6 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1962,6 +1962,7 @@ subroutine init_history_io(this,bounds_proc) use FatesIOVariableKindMod, only : patch_r8, patch_ground_r8, patch_size_pft_r8 use FatesIOVariableKindMod, only : site_r8, site_ground_r8, site_size_pft_r8 use FatesIOVariableKindMod, only : site_size_r8, site_pft_r8, site_age_r8 + use FatesIOVariableKindMod, only : site_coage_r8, site_coage_pft_r8 use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8 use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 @@ -2072,6 +2073,9 @@ subroutine init_history_io(this,bounds_proc) dk_index = this%fates_hist%hvars(ivar)%dim_kinds_index ioname = trim(this%fates_hist%dim_kinds(dk_index)%name) + write(iulog,*) 'attempt ioname: ', ioname + write(iulog,*) 'dk_index: ', dk_index + select case(trim(ioname)) case(patch_r8) call hist_addfld1d(fname=trim(vname),units=trim(vunits), & @@ -2097,12 +2101,15 @@ subroutine init_history_io(this,bounds_proc) ptr_patch=this%fates_hist%hvars(ivar)%r82d, & default=trim(vdefault)) + case(site_ground_r8, site_size_pft_r8, site_size_r8, site_pft_r8, & - site_age_r8, site_height_r8, site_fuel_r8, site_cwdsc_r8, & - site_can_r8,site_cnlf_r8, site_cnlfpft_r8, site_scag_r8, & + site_age_r8, site_height_r8, site_coage_r8,site_coage_pft_r8, & + site_fuel_r8, site_cwdsc_r8, & + site_can_r8,site_cnlf_r8, site_cnlfpft_r8, site_scag_r8, & site_scagpft_r8, site_agepft_r8, site_elem_r8, site_elpft_r8, & site_elcwd_r8, site_elage_r8) + d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index dim2name = this%fates_hist%dim_bounds(d_index)%name call hist_addfld2d(fname=trim(vname),units=trim(vunits), & @@ -2119,6 +2126,8 @@ subroutine init_history_io(this,bounds_proc) end select end associate + write(iulog,*)'success: ', ioname + end do end subroutine init_history_io @@ -2376,7 +2385,7 @@ end subroutine wrap_hydraulics_drive subroutine hlm_bounds_to_fates_bounds(hlm, fates) use FatesIODimensionsMod, only : fates_bounds_type - use FatesInterfaceMod, only : nlevsclass, nlevage + use FatesInterfaceMod, only : nlevsclass, nlevage, nlevcoage use FatesInterfaceMod, only : nlevheight use EDtypesMod, only : nfsc use FatesLitterMod, only : ncwd @@ -2407,6 +2416,12 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%size_class_begin = 1 fates%size_class_end = nlevsclass + fates%coagepf_class_begin = 1 + fates%coagepf_class_end = nlevcoage * numpft_fates + + fates%coage_class_begin = 1 + fates%coage_class_end = nlevcoage + fates%pft_class_begin = 1 fates%pft_class_end = maxveg_ed From f37d7ba8ad819b0103016efce5ae30c4f39ded9d Mon Sep 17 00:00:00 2001 From: JessicaNeedham Date: Thu, 12 Mar 2020 09:30:20 -0700 Subject: [PATCH 1074/1973] [ Add a new hlm_use flag for turning on cohort age tracking ] [Cohort age tracking is now a flag like spitfire or hydro that can be turned on with the flag hlm_use_cohort_age_tracking. These changes add this flag to ctsm code. This is for use when FATES is running.] Fixes: [NGT-ED Github issue #] User interface changes?: [No - only on the FATES side of things] Code review: [Names] Test suite: [suite name, machine, compilers] Test baseline: Test namelist changes: Test answer changes: [bit for bit, roundoff, climate changing] Test summary: No testing. --- bld/CLMBuildNamelist.pm | 5 +++-- bld/namelist_files/namelist_defaults_ctsm.xml | 1 + bld/namelist_files/namelist_definition_ctsm.xml | 11 ++++++++--- src/main/clm_varctl.F90 | 1 + src/main/controlMod.F90 | 5 ++++- src/utils/clmfates_interfaceMod.F90 | 9 +++++++++ 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 4ee6a65eda..d435226610 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -768,7 +768,8 @@ sub setup_cmdl_fates_mode { } } else { # dis-allow fates specific namelist items with non-fates runs - my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", + my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", + "use_fates_cohort_age_tracking", "use_fates_inventory_init", "fates_inventory_ctrl_filename","use_fates_logging","fates_parteh_mode" ); foreach my $var ( @list ) { if ( defined($nl->get_value($var)) ) { @@ -3775,7 +3776,7 @@ sub setup_logic_fates { if (&value_is_true( $nl_flags->{'use_fates'}) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'}); my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", - "use_fates_inventory_init", "use_fates_logging","fates_parteh_mode" ); + "use_fates_inventory_init", "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking" ); foreach my $var ( @list ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'} ); } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 0e6458b6d9..aa8964931c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2728,6 +2728,7 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 .false. .false. +.false. .false. .false. .false. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 3dafa5591c..a0642c8199 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -646,9 +646,14 @@ Toggle to turn on the logging module (only relevant if FATES is being used). -Toggle to turn on plant hydraulics (only relevant if FATES is on). -(use_fates_planthydro=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) + group="clm_inparm" valid_values="" value=".false."> + Toggle to turn on plant hydraulics (only relevant if FATES is on). + (use_fates_planthydro=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) + + + + Toggle to turn on cohort age tracking (only relevant if FATES is on). use spitfire model logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro + logical, public :: use_fates_cohort_age_tracking = .false. ! true => turn on cohort age tracking logical, public :: use_fates_ed_st3 = .false. ! true => static stand structure logical, public :: use_fates_ed_prescribed_phys = .false. ! true => prescribed physiology logical, public :: use_fates_inventory_init = .false. ! true => initialize fates from inventory diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index e2f75958cd..d24eea2a15 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -223,11 +223,12 @@ subroutine control_init( ) namelist /clm_inparm/ fates_paramfile, use_fates, & use_fates_spitfire, use_fates_logging, & use_fates_planthydro, use_fates_ed_st3, & + use_fates_cohort_age_tracking, & use_fates_ed_prescribed_phys, & use_fates_inventory_init, & fates_inventory_ctrl_filename, & fates_parteh_mode - + ! CLM 5.0 nitrogen flags namelist /clm_inparm/ use_flexibleCN, use_luna @@ -714,6 +715,7 @@ subroutine control_spmd() call mpi_bcast (use_fates_spitfire, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_logging, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_planthydro, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_fates_cohort_age_tracking, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_ed_st3, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_ed_prescribed_phys, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_inventory_init, 1, MPI_LOGICAL, 0, mpicom, ier) @@ -1065,6 +1067,7 @@ subroutine control_print () write(iulog, *) ' fates_paramfile = ', fates_paramfile write(iulog, *) ' fates_parteh_mode = ', fates_parteh_mode write(iulog, *) ' use_fates_planthydro = ', use_fates_planthydro + write(iulog, *) ' use_fates_cohort_age_tracking = ', use_fates_cohort_age_tracking write(iulog, *) ' use_fates_ed_st3 = ',use_fates_ed_st3 write(iulog, *) ' use_fates_ed_prescribed_phys = ',use_fates_ed_prescribed_phys write(iulog, *) ' use_fates_inventory_init = ',use_fates_inventory_init diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index d9b84c82c6..b86e01f5e4 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -51,6 +51,7 @@ module CLMFatesInterfaceMod use clm_varctl , only : fates_parteh_mode use clm_varctl , only : use_fates_spitfire use clm_varctl , only : use_fates_planthydro + use clm_varctl , only : use_fates_cohort_age_tracking use clm_varctl , only : use_fates_ed_st3 use clm_varctl , only : use_fates_ed_prescribed_phys use clm_varctl , only : use_fates_logging @@ -248,6 +249,7 @@ subroutine init(this, bounds_proc ) integer :: pass_ed_prescribed_phys integer :: pass_logging integer :: pass_planthydro + integer :: pass_cohort_age_tracking integer :: pass_inventory_init integer :: pass_is_restart integer :: nc ! thread index @@ -342,6 +344,13 @@ subroutine init(this, bounds_proc ) end if call set_fates_ctrlparms('use_planthydro',ival=pass_planthydro) + if(use_fates_cohort_age_tracking) then + pass_cohort_age_tracking = 1 + else + pass_cohort_age_tracking = 0 + end if + call set_fates_ctrlparms('use_cohort_age_tracking',ival=pass_cohort_age_tracking) + if(use_fates_logging) then pass_logging = 1 else From d81ca0e73fd97e904ac211a95a4bc91850c6e4f5 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 12 Mar 2020 15:15:06 -0700 Subject: [PATCH 1075/1973] Added FATESSizeAge test protocol --- cime_config/testdefs/testlist_clm.xml | 10 ++++++++++ .../clm/FatesSizeAgeMort/include_user_mods | 1 + .../testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm | 3 +++ 3 files changed, 14 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index e475620633..321287c716 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1889,6 +1889,16 @@ + + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/include_user_mods new file mode 100644 index 0000000000..1f2c03aebe --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/include_user_mods @@ -0,0 +1 @@ +../FatesColdDef diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm new file mode 100644 index 0000000000..2cd2755ab3 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm @@ -0,0 +1,3 @@ +hist_empty_htapes = .true. +use_fates_cohort_age_tracking=.true. +hist_fincl1 = 'M9_SCPF','M10_SCPF','M10_CAPF','NPLANT_CACLS','M9_SCLS','M10_SCLS','M10_CACLS' From b5e96371a28c7eca11b85e3bf2a6aaf65f2719bb Mon Sep 17 00:00:00 2001 From: JessicaNeedham Date: Tue, 24 Mar 2020 11:36:18 -0700 Subject: [PATCH 1076/1973] [Add NPLANT_CAPF to user_nl_clm ] [ Add NPLANT_CAPF to user_nl_clm - number of plants by cohort age class and pft. ] Fixes: [NGT-ED Github issue #] User interface changes?: [No] Code review: [Names] Test suite: [suite name, machine, compilers] Test baseline: Test namelist changes: Test answer changes: [bit for bit, roundoff, climate changing] Test summary:No testing. --- .../testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm index 2cd2755ab3..cb7cc262fe 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesSizeAgeMort/user_nl_clm @@ -1,3 +1,3 @@ hist_empty_htapes = .true. use_fates_cohort_age_tracking=.true. -hist_fincl1 = 'M9_SCPF','M10_SCPF','M10_CAPF','NPLANT_CACLS','M9_SCLS','M10_SCLS','M10_CACLS' +hist_fincl1 = 'M9_SCPF','M10_SCPF','M10_CAPF','NPLANT_CACLS','NPLANT_CAPF', 'M9_SCLS','M10_SCLS','M10_CACLS' From 4bed4f94fea58a1a203d664c8e282ae97b61933a Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 24 Mar 2020 18:34:36 -0600 Subject: [PATCH 1077/1973] Fixed fates size-age-mortality test length to be splitable --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 321287c716..52f12543de 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1889,7 +1889,7 @@ - + From f1b579a2d2203309d9f3d681116e30a8b1d41f30 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 26 Mar 2020 14:49:50 -0700 Subject: [PATCH 1078/1973] update manage externals config file to pull correect fates tag --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 1307d05c14..9f352ca8dd 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.33.0_api.8.1.0 +tag = sci.1.34.0_api.9.0.0 required = True [PTCLM] From 9eda517a949e84f8681dbc3dbe39329971bd6675 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 26 Mar 2020 15:03:35 -0700 Subject: [PATCH 1079/1973] remove temp writes to iulog in clmfates_interface --- src/utils/clmfates_interfaceMod.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index b86e01f5e4..c7b62491b0 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2082,9 +2082,6 @@ subroutine init_history_io(this,bounds_proc) dk_index = this%fates_hist%hvars(ivar)%dim_kinds_index ioname = trim(this%fates_hist%dim_kinds(dk_index)%name) - write(iulog,*) 'attempt ioname: ', ioname - write(iulog,*) 'dk_index: ', dk_index - select case(trim(ioname)) case(patch_r8) call hist_addfld1d(fname=trim(vname),units=trim(vunits), & @@ -2135,7 +2132,6 @@ subroutine init_history_io(this,bounds_proc) end select end associate - write(iulog,*)'success: ', ioname end do end subroutine init_history_io From 415f89fefc6c9ac921ea1b4dd98d72ee71f1f1d7 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 26 Mar 2020 15:32:13 -0700 Subject: [PATCH 1080/1973] removing remnant of old code from htape_addfld --- src/main/histFileMod.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index ee6483256b..49a6cc940d 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -914,7 +914,6 @@ subroutine htape_addfld (t, f, avgflag) integer :: numc ! total number of columns across all processors integer :: nump ! total number of pfts across all processors integer :: num2d ! size of second dimension (e.g. .number of vertical levels) - character(len=hist_dim_name_length) :: type2d integer :: beg1d_out,end1d_out ! history output per-proc 1d beginning and ending indices integer :: beg1d,end1d ! beginning and ending indices for this field (assume already set) integer :: num1d_out ! history output 1d size @@ -1049,9 +1048,6 @@ subroutine htape_addfld (t, f, avgflag) tape(t)%hlist(n)%avgflag = avgflag end if - type2d = tape(t)%hlist(n)%field%type2d - - end subroutine htape_addfld !----------------------------------------------------------------------- From 683d14e4ecb7a35a3aad906e2c676e3e109c12f1 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 20 Apr 2020 12:02:00 -0700 Subject: [PATCH 1081/1973] fates-hydro, api update for hydro refactors, bug fix --- src/utils/clmfates_interfaceMod.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index c7b62491b0..d77cd4ab37 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2379,6 +2379,7 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & call this%fates_hist%update_history_hydraulics(nc, & this%fates(nc)%nsites, & this%fates(nc)%sites, & + this%fates(nc)%bc_in, & dtime) From df9e930ed0760c2b9747a1c51d7cb881e3be7141 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 21 Apr 2020 14:56:41 -0700 Subject: [PATCH 1082/1973] added time-step argument to fix nep calculations --- src/utils/clmfates_interfaceMod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index d77cd4ab37..900204708f 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1911,13 +1911,14 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & this%fates(nc)%bc_in(s)%tot_litc = totlitc(c) end do - + dtime = get_step_size() ! Update history variables that track these variables call this%fates_hist%update_history_cbal(nc, & this%fates(nc)%nsites, & this%fates(nc)%sites, & - this%fates(nc)%bc_in) + this%fates(nc)%bc_in, & + dtime) end associate end subroutine wrap_bgc_summary From 6a7d5b5a092bbda43961dc44a0724a1d6abe74e3 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 20 Apr 2020 15:01:09 -0600 Subject: [PATCH 1083/1973] fates-hydro: updated test user_nl_clm --- .../testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm index c7d24f7ab1..9b6cebc7a5 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm @@ -1,5 +1,9 @@ hist_empty_htapes = .true. use_fates_planthydro= .true. hist_fincl1 = 'FATES_ERRH2O_SCPF','FATES_TRAN_SCPF', -'FATES_SAPFLOW_COL_SCPF','FATES_ITERH1_COL_SCPF','FATES_ATH_COL_SCPF','FATES_TTH_COL_SCPF', -'FATES_STH_COL_SCPF','FATES_LTH_COL_SCPF','FATES_AWP_COL_SCPF','FATES_BTRAN_COL_SCPF' +'FATES_SAPFLOW_SCPF','FATES_ITERH1_SCPF','FATES_ATH_SCPF','FATES_TTH_SCPF', +'FATES_STH_SCPF','FATES_LTH_SCPF','FATES_AWP_SCPF','FATES_BTRAN_SCPF', +'FATES_ROOTWGT_SOILVWC_SI','FATES_ROOTWGT_SOILVWCSAT_SI', +'FATES_ROOTWGT_SOILMATPOT_SI','FATES_SOILMATPOT_SL','FATES_SOILVWC_SL','FATES_SOILVWCSAT_SL', +'FATES_ROOTUPTAKE_SI','FATES_ROOTUPTAKE_SL','FATES_ROOTUPTAKE0_SCPF','FATES_ROOTUPTAKE10_SCPF', +'FATES_ROOTUPTAKE50_SCPF','FATES_ROOTUPTAKE100_SCPF' From c669928d77f8c0c24658bb8c5184120d1097f3c2 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 20 Apr 2020 13:18:45 -0600 Subject: [PATCH 1084/1973] updated fates parameter file, backwards compatible --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index aa8964931c..22f078eff1 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -400,7 +400,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.8.1.0_12pft_c200103.nc +lnd/clm2/paramdata/fates_params_api.10.0.0_12pft_c200420.nc From 5f71fafe90dbdc3357c7fb6dcbe71910db9755db Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 22 Apr 2020 14:57:51 -0600 Subject: [PATCH 1085/1973] Updating fates tag in the externals pointer --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 9f352ca8dd..6474d99ce2 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.34.0_api.9.0.0 +tag = sci.1.35.0_api.10.0.0 required = True [PTCLM] From 31a59ef3abfb391a066f558638a69efeedc609c1 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 5 May 2020 15:14:05 -0700 Subject: [PATCH 1086/1973] no for real this time, fixing merge conflicts --- cime_config/testdefs/testlist_clm.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 52f12543de..93c93569c8 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1786,6 +1786,8 @@ + + @@ -1814,6 +1816,18 @@ +<<<<<<< HEAD +||||||| constructed merge base +<<<<<<< HEAD + +======= + +>>>>>>> fates_next_api + +======= + + +>>>>>>> no for real this time, fixing merge conflicts From 77a21d4983194c7ce3713135fef5d36a83ddd400 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 7 May 2020 16:04:53 -0700 Subject: [PATCH 1087/1973] fates interface refactor. this interface refactor is intended to consolidate the initialization sequence, and also reduce fates side circular dependencies. This also fixes a bug where some parteh structures were not being passed to this history dimensions properly. --- src/main/clm_initializeMod.F90 | 5 +- src/main/decompInitMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 297 +++++++++++++++------------- 3 files changed, 168 insertions(+), 136 deletions(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index dc5e8f8d40..9a734b2b8d 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -24,8 +24,8 @@ module clm_initializeMod use PatchType , only : patch ! instance use reweightMod , only : reweight_wrapup use filterMod , only : allocFilters, filter, filter_inactive_and_active - use FatesInterfaceMod, only : set_fates_global_elements use dynSubgridControlMod, only: dynSubgridControl_init, get_reset_dynbal_baselines + use CLMFatesInterfaceMod, only : CLMFatesGlobals use clm_instMod use SoilMoistureStreamMod, only : PrescribedSoilMoistureInit @@ -197,9 +197,10 @@ subroutine initialize1(gindex_ocn) ! ! (Note: fates_maxELementsPerSite is the critical variable used by CLM ! to allocate space) + ! This also sets up various global constants in FATES ! ------------------------------------------------------------------------ - call set_fates_global_elements(use_fates) + call CLMFatesGlobals() ! ------------------------------------------------------------------------ ! Determine decomposition of subgrid scale landunits, columns, patches diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 540dd3cde9..c114e5968f 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -20,7 +20,7 @@ module decompInitMod use glcBehaviorMod , only : glc_behavior_type use decompMod use mct_mod , only : mct_gsMap_init, mct_gsMap_ngseg, mct_gsMap_nlseg, mct_gsmap_gsize - use FatesInterfaceMod, only : fates_maxElementsPerSite + use FatesInterfaceTypesMod, only : fates_maxElementsPerSite ! ! !PUBLIC TYPES: implicit none diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 900204708f..25b4d31d55 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -49,6 +49,7 @@ module CLMFatesInterfaceMod use clm_varctl , only : iulog use clm_varctl , only : use_vertsoilc use clm_varctl , only : fates_parteh_mode + use clm_varctl , only : use_fates use clm_varctl , only : use_fates_spitfire use clm_varctl , only : use_fates_planthydro use clm_varctl , only : use_fates_cohort_age_tracking @@ -101,9 +102,12 @@ module CLMFatesInterfaceMod ! use SoilWaterPlantSinkMod, only : Compute_EffecRootFrac_And_VertTranSink_Default ! Used FATES Modules - use FatesInterfaceMod , only : fates_interface_type + use FatesInterfaceTypesMod , only : fates_interface_type + use FatesInterfaceMod, only : FatesInterfaceInit, FatesReportParameters + use FatesInterfaceMod, only : SetFatesGlobalElements use FatesInterfaceMod , only : allocate_bcin use FatesInterfaceMod , only : allocate_bcout + use FatesInterfaceMod , only : zero_bcs use FatesInterfaceMod , only : SetFatesTime use FatesInterfaceMod , only : set_fates_ctrlparms @@ -113,14 +117,13 @@ module CLMFatesInterfaceMod use EDTypesMod , only : ed_patch_type use EDTypesMod , only : num_elements - use FatesInterfaceMod , only : hlm_numlevgrnd + use FatesInterfaceTypesMod , only : hlm_numlevgrnd use EDMainMod , only : ed_ecosystem_dynamics use EDMainMod , only : ed_update_site use EDInitMod , only : zero_site use EDInitMod , only : init_site_vars use EDInitMod , only : init_patches use EDInitMod , only : set_site_properties - use EDInitMod , only : InitFatesGlobals use EDPftVarcon , only : EDpftvarcon_inst use EDSurfaceRadiationMod , only : ED_SunShadeFracs, ED_Norman_Radiation use EDBtranMod , only : btran_ed, & @@ -132,7 +135,6 @@ module CLMFatesInterfaceMod use FatesPlantHydraulicsMod, only : hydraulics_drive use FatesPlantHydraulicsMod, only : HydrSiteColdStart use FatesPlantHydraulicsMod, only : InitHydrSites - use FatesPlantHydraulicsMod, only : UpdateH2OVeg use FatesPlantHydraulicsMod, only : RestartHydrStates implicit none @@ -206,9 +208,151 @@ module CLMFatesInterfaceMod character(len=*), parameter, private :: sourcefile = & __FILE__ - -contains + public :: CLMFatesGlobals + + contains + + + subroutine CLMFatesGlobals() + + ! -------------------------------------------------------------------------------- + ! This is one of the first calls to fates + ! Used for setting dimensions. This MUST + ! be called after NL variables are specified and + ! after the FATES parameter file has been read in + ! Aside from setting global dimension info, which + ! is used in the history file, we also transfer + ! over the NL variables to FATES global settings. + ! -------------------------------------------------------------------------------- + + logical :: verbose_output + integer :: pass_masterproc + integer :: pass_vertsoilc + integer :: pass_spitfire + integer :: pass_ed_st3 + integer :: pass_logging + integer :: pass_ed_prescribed_phys + integer :: pass_planthydro + integer :: pass_inventory_init + integer :: pass_is_restart + integer :: pass_cohort_age_tracking + + if (use_fates) then + + verbose_output = .false. + call FatesInterfaceInit(iulog, verbose_output) + + ! Force FATES parameters that are recieve type, to the unset value + call set_fates_ctrlparms('flush_to_unset') + + ! Send parameters individually + call set_fates_ctrlparms('num_sw_bbands',ival=numrad) + call set_fates_ctrlparms('vis_sw_index',ival=ivis) + call set_fates_ctrlparms('nir_sw_index',ival=inir) + + call set_fates_ctrlparms('num_lev_ground',ival=nlevgrnd) + call set_fates_ctrlparms('hlm_name',cval='CLM') + call set_fates_ctrlparms('hio_ignore_val',rval=spval) + call set_fates_ctrlparms('soilwater_ipedof',ival=get_ipedof(0)) + call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) + + call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) + + if(is_restart()) then + pass_is_restart = 1 + else + pass_is_restart = 0 + end if + call set_fates_ctrlparms('is_restart',ival=pass_is_restart) + + if(use_vertsoilc) then + pass_vertsoilc = 1 + else + pass_vertsoilc = 0 + end if + call set_fates_ctrlparms('use_vertsoilc',ival=pass_vertsoilc) + + if(use_fates_spitfire) then + pass_spitfire = 1 + else + pass_spitfire = 0 + end if + call set_fates_ctrlparms('use_spitfire',ival=pass_spitfire) + + if(use_fates_ed_st3) then + pass_ed_st3 = 1 + else + pass_ed_st3 = 0 + end if + call set_fates_ctrlparms('use_ed_st3',ival=pass_ed_st3) + + if(use_fates_logging) then + pass_logging = 1 + else + pass_logging = 0 + end if + call set_fates_ctrlparms('use_logging',ival=pass_logging) + + if(use_fates_ed_prescribed_phys) then + pass_ed_prescribed_phys = 1 + else + pass_ed_prescribed_phys = 0 + end if + call set_fates_ctrlparms('use_ed_prescribed_phys',ival=pass_ed_prescribed_phys) + + if(use_fates_planthydro) then + pass_planthydro = 1 + else + pass_planthydro = 0 + end if + call set_fates_ctrlparms('use_planthydro',ival=pass_planthydro) + + if(use_fates_cohort_age_tracking) then + pass_cohort_age_tracking = 1 + else + pass_cohort_age_tracking = 0 + end if + call set_fates_ctrlparms('use_cohort_age_tracking',ival=pass_cohort_age_tracking) + + if(use_fates_inventory_init) then + pass_inventory_init = 1 + else + pass_inventory_init = 0 + end if + call set_fates_ctrlparms('use_inventory_init',ival=pass_inventory_init) + + call set_fates_ctrlparms('inventory_ctrl_file',cval=fates_inventory_ctrl_filename) + + if(masterproc)then + pass_masterproc = 1 + else + pass_masterproc = 0 + end if + call set_fates_ctrlparms('masterproc',ival=pass_masterproc) + + ! Check through FATES parameters to see if all have been set + call set_fates_ctrlparms('check_allset') + + end if + + ! This determines the total amount of space it requires in its largest + ! dimension. We are currently calling that the "cohort" dimension, but + ! it is really a utility dimension that captures the models largest + ! size need. + ! Sets: + ! fates_maxElementsPerPatch + ! num_elements + ! fates_maxElementsPerSite (where a site is roughly equivalent to a column) + ! (Note: this needs to be called when use_fates=.false. as well, becuase + ! it will return some nominal dimension sizes of 1 + + call SetFatesGlobalElements(use_fates) + + return + end subroutine CLMFatesGlobals + + ! ==================================================================================== subroutine init(this, bounds_proc ) @@ -229,8 +373,7 @@ subroutine init(this, bounds_proc ) ! is not turned on ! --------------------------------------------------------------------------------- - use FatesInterfaceMod, only : FatesInterfaceInit, FatesReportParameters - use FatesInterfaceMod, only : maxveg_ed => numpft + use FatesInterfaceTypesMod, only : numpft_fates => numpft use FatesParameterDerivedMod, only : param_derived implicit none @@ -241,7 +384,7 @@ subroutine init(this, bounds_proc ) ! local variables integer :: nclumps ! Number of threads - logical :: verbose_output + integer :: pass_masterproc integer :: pass_vertsoilc integer :: pass_spitfire @@ -270,113 +413,12 @@ subroutine init(this, bounds_proc ) ! Parameter Routines - call param_derived%Init( maxveg_ed ) - - - verbose_output = .false. - call FatesInterfaceInit(iulog, verbose_output) + call param_derived%Init( numpft_fates ) nclumps = get_proc_clumps() allocate(this%fates(nclumps)) allocate(this%f2hmap(nclumps)) - ! --------------------------------------------------------------------------------- - ! Send dimensions and other model controling parameters to FATES. These - ! are obviously only those parameters that are dictated by the host - ! --------------------------------------------------------------------------------- - - ! Force FATES parameters that are recieve type, to the unset value - call set_fates_ctrlparms('flush_to_unset') - - ! Send parameters individually - call set_fates_ctrlparms('num_sw_bbands',ival=numrad) - call set_fates_ctrlparms('vis_sw_index',ival=ivis) - call set_fates_ctrlparms('nir_sw_index',ival=inir) - - call set_fates_ctrlparms('num_lev_ground',ival=nlevgrnd) - call set_fates_ctrlparms('hlm_name',cval='CLM') - call set_fates_ctrlparms('hio_ignore_val',rval=spval) - call set_fates_ctrlparms('soilwater_ipedof',ival=get_ipedof(0)) - call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) ! RGK: FATES IGNORES - ! AND DOESNT TOUCH - ! THE BARE SOIL PATCH - call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) - - if(is_restart()) then - pass_is_restart = 1 - else - pass_is_restart = 0 - end if - call set_fates_ctrlparms('is_restart',ival=pass_is_restart) - - if(use_vertsoilc) then - pass_vertsoilc = 1 - else - pass_vertsoilc = 0 - end if - call set_fates_ctrlparms('use_vertsoilc',ival=pass_vertsoilc) - - if(use_fates_spitfire) then - pass_spitfire = 1 - else - pass_spitfire = 0 - end if - call set_fates_ctrlparms('use_spitfire',ival=pass_spitfire) - - if(use_fates_ed_st3) then - pass_ed_st3 = 1 - else - pass_ed_st3 = 0 - end if - call set_fates_ctrlparms('use_ed_st3',ival=pass_ed_st3) - - if(use_fates_ed_prescribed_phys) then - pass_ed_prescribed_phys = 1 - else - pass_ed_prescribed_phys = 0 - end if - call set_fates_ctrlparms('use_ed_prescribed_phys',ival=pass_ed_prescribed_phys) - - if(use_fates_planthydro) then - pass_planthydro = 1 - else - pass_planthydro = 0 - end if - call set_fates_ctrlparms('use_planthydro',ival=pass_planthydro) - - if(use_fates_cohort_age_tracking) then - pass_cohort_age_tracking = 1 - else - pass_cohort_age_tracking = 0 - end if - call set_fates_ctrlparms('use_cohort_age_tracking',ival=pass_cohort_age_tracking) - - if(use_fates_logging) then - pass_logging = 1 - else - pass_logging = 0 - end if - call set_fates_ctrlparms('use_logging',ival=pass_logging) - - if(use_fates_inventory_init) then - pass_inventory_init = 1 - else - pass_inventory_init = 0 - end if - call set_fates_ctrlparms('use_inventory_init',ival=pass_inventory_init) - - call set_fates_ctrlparms('inventory_ctrl_file',cval=fates_inventory_ctrl_filename) - - - if(masterproc)then - pass_masterproc = 1 - else - pass_masterproc = 0 - end if - call set_fates_ctrlparms('masterproc',ival=pass_masterproc) - - ! Check through FATES parameters to see if all have been set - call set_fates_ctrlparms('check_allset') if(debug)then write(iulog,*) 'clm_fates%init(): allocating for ',nclumps,' threads' @@ -466,7 +508,7 @@ subroutine init(this, bounds_proc ) call allocate_bcin(this%fates(nc)%bc_in(s),col%nbedrock(c),ndecomp) call allocate_bcout(this%fates(nc)%bc_out(s),col%nbedrock(c),ndecomp) - call this%fates(nc)%zero_bcs(s) + call zero_bcs(this%fates(nc),s) ! Pass any grid-cell derived attributes to the site ! --------------------------------------------------------------------------- @@ -510,13 +552,7 @@ subroutine init(this, bounds_proc ) end do !$OMP END PARALLEL DO - ! This will initialize all FATES globals, - ! particular PARTEH and HYDRO globals - - call InitFatesGlobals(masterproc) - - call this%init_history_io(bounds_proc) ! Report Fates Parameters (debug flag in lower level routines) @@ -822,10 +858,6 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & ! ! This updates the internal value and the bc_out value. ! ! If hydraulics is off, it returns 0 storage if ( use_fates_planthydro ) then - ! call UpdateH2OVeg(this%fates(nc)%nsites, & - ! this%fates(nc)%sites, & - ! this%fates(nc)%bc_out) - ! do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) waterdiagnosticbulk_inst%total_plant_stored_h2o_col(c) = & @@ -942,8 +974,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & use FatesIODimensionsMod, only: fates_bounds_type use FatesIOVariableKindMod, only : site_r8, site_int, cohort_r8, cohort_int use EDMainMod, only : ed_update_site - use FatesInterfaceMod, only: fates_maxElementsPerSite - use FatesPlantHydraulicsMod, only : RestartHydrStates + use FatesInterfaceTypesMod, only: fates_maxElementsPerSite implicit none @@ -2392,12 +2423,12 @@ end subroutine wrap_hydraulics_drive subroutine hlm_bounds_to_fates_bounds(hlm, fates) use FatesIODimensionsMod, only : fates_bounds_type - use FatesInterfaceMod, only : nlevsclass, nlevage, nlevcoage - use FatesInterfaceMod, only : nlevheight + use FatesInterfaceTypesMod, only : nlevsclass, nlevage, nlevcoage + use FatesInterfaceTypesMod, only : nlevheight use EDtypesMod, only : nfsc use FatesLitterMod, only : ncwd use EDtypesMod, only : nlevleaf, nclmax - use FatesInterfaceMod, only : maxveg_ed => numpft + use FatesInterfaceTypesMod, only : numpft_fates => numpft use clm_varpar, only : nlevgrnd implicit none @@ -2418,7 +2449,7 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%ground_end = nlevgrnd fates%sizepft_class_begin = 1 - fates%sizepft_class_end = nlevsclass * maxveg_ed + fates%sizepft_class_end = nlevsclass * numpft_fates fates%size_class_begin = 1 fates%size_class_end = nlevsclass @@ -2430,7 +2461,7 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%coage_class_end = nlevcoage fates%pft_class_begin = 1 - fates%pft_class_end = maxveg_ed + fates%pft_class_end = numpft_fates fates%age_class_begin = 1 fates%age_class_end = nlevage @@ -2442,10 +2473,10 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%sizeage_class_end = nlevsclass * nlevage fates%agepft_class_begin = 1 - fates%agepft_class_end = nlevage * maxveg_ed + fates%agepft_class_end = nlevage * numpft_fates fates%sizeagepft_class_begin = 1 - fates%sizeagepft_class_end = nlevsclass * nlevage * maxveg_ed + fates%sizeagepft_class_end = nlevsclass * nlevage * numpft_fates fates%fuel_begin = 1 fates%fuel_end = nfsc @@ -2460,13 +2491,13 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%cnlf_end = nlevleaf * nclmax fates%cnlfpft_begin = 1 - fates%cnlfpft_end = nlevleaf * nclmax * maxveg_ed + fates%cnlfpft_end = nlevleaf * nclmax * numpft_fates fates%elem_begin = 1 fates%elem_end = num_elements fates%elpft_begin = 1 - fates%elpft_end = num_elements * maxveg_ed + fates%elpft_end = num_elements * numpft_fates fates%elcwd_begin = 1 fates%elcwd_end = num_elements * ncwd From 93b03e1d96f63308c13aee1bb09d4494dad3175a Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 7 May 2020 17:52:32 -0600 Subject: [PATCH 1088/1973] Removed site level veg24 since it was meaningless --- src/utils/clmfates_interfaceMod.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 25b4d31d55..b1127d21f4 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -681,11 +681,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & this%fates(nc)%bc_in(s)%h2o_liqvol_sl(1:nlevsoil) = & waterstatebulk_inst%h2osoi_vol_col(c,1:nlevsoil) - ! TO-DO: SHOULD THIS BE LIQVOL OR IS VOL OK? (RGK-02-2017) - - this%fates(nc)%bc_in(s)%t_veg24_si = & - temperature_inst%t_veg24_patch(col%patchi(c)) - this%fates(nc)%bc_in(s)%max_rooting_depth_index_col = & min(nlevsoil, active_layer_inst%altmax_lastyear_indx_col(c)) From 423cbeaebfaace0d6dbc2239d426322dc065959b Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 8 May 2020 11:40:29 -0700 Subject: [PATCH 1089/1973] fates interface - fixed module use calls --- src/main/histFileMod.F90 | 96 ++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 49a6cc940d..0d46348a38 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -23,12 +23,12 @@ module histFileMod use PatchType , only : patch use EDTypesMod , only : nclmax use EDTypesMod , only : nlevleaf - use FatesInterfaceMod , only : nlevsclass, nlevage, nlevcoage - use FatesInterfaceMod , only : nlevheight + use FatesInterfaceTypesMod , only : nlevsclass, nlevage, nlevcoage + use FatesInterfaceTypesMod , only : nlevheight use EDTypesMod , only : nfsc use FatesLitterMod , only : ncwd use EDTypesMod , only : num_elements_fates => num_elements - use FatesInterfaceMod , only : maxveg_fates => numpft + use FatesInterfaceTypesMod , only : numpft_fates => numpft use ncdio_pio ! @@ -2074,22 +2074,22 @@ subroutine htape_create (t, histrest) if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) - call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * maxveg_fates, dimid) - call ncd_defdim(lnfid, 'fates_levagepft', nlevage * maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * numpft_fates, dimid) + call ncd_defdim(lnfid, 'fates_levagepft', nlevage * numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levscls', nlevsclass, dimid) call ncd_defdim(lnfid, 'fates_levcacls', nlevcoage, dimid) - call ncd_defdim(lnfid, 'fates_levpft', maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levpft', numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levage', nlevage, dimid) call ncd_defdim(lnfid, 'fates_levheight', nlevheight, dimid) call ncd_defdim(lnfid, 'fates_levfuel', nfsc, dimid) call ncd_defdim(lnfid, 'fates_levcwdsc', ncwd, dimid) - call ncd_defdim(lnfid, 'fates_levscpf', nlevsclass*maxveg_fates, dimid) - call ncd_defdim(lnfid, 'fates_levcapf', nlevcoage*maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levscpf', nlevsclass*numpft_fates, dimid) + call ncd_defdim(lnfid, 'fates_levcapf', nlevcoage*numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levcan', nclmax, dimid) call ncd_defdim(lnfid, 'fates_levcnlf', nlevleaf * nclmax, dimid) - call ncd_defdim(lnfid, 'fates_levcnlfpf', nlevleaf * nclmax * maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levcnlfpf', nlevleaf * nclmax * numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levelem', num_elements_fates, dimid) - call ncd_defdim(lnfid, 'fates_levelpft', num_elements_fates * maxveg_fates, dimid) + call ncd_defdim(lnfid, 'fates_levelpft', num_elements_fates * numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levelcwd', num_elements_fates * ncwd, dimid) call ncd_defdim(lnfid, 'fates_levelage', num_elements_fates * nlevage, dimid) end if @@ -2505,37 +2505,37 @@ subroutine htape_timeconst(t, mode) use domainMod , only : ldomain, lon1d, lat1d use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time use clm_time_manager, only : get_ref_date, get_calendar, NO_LEAP_C, GREGORIAN_C - use FatesInterfaceMod, only : fates_hdim_levsclass - use FatesInterfaceMod, only : fates_hdim_pfmap_levscpf - use FatesInterfaceMod, only : fates_hdim_scmap_levscpf - use FatesInterfaceMod, only : fates_hdim_levcoage - use FatesInterfaceMod, only : fates_hdim_pfmap_levcapf - use FatesInterfaceMod, only : fates_hdim_camap_levcapf - use FatesInterfaceMod, only : fates_hdim_levage - use FatesInterfaceMod, only : fates_hdim_levheight - use FatesInterfaceMod, only : fates_hdim_levpft - use FatesInterfaceMod, only : fates_hdim_scmap_levscag - use FatesInterfaceMod, only : fates_hdim_agmap_levscag - use FatesInterfaceMod, only : fates_hdim_scmap_levscagpft - use FatesInterfaceMod, only : fates_hdim_agmap_levscagpft - use FatesInterfaceMod, only : fates_hdim_pftmap_levscagpft - use FatesInterfaceMod, only : fates_hdim_agmap_levagepft - use FatesInterfaceMod, only : fates_hdim_pftmap_levagepft - use FatesInterfaceMod, only : fates_hdim_levfuel - use FatesInterfaceMod, only : fates_hdim_levcwdsc - use FatesInterfaceMod, only : fates_hdim_levcan - use FatesInterfaceMod, only : fates_hdim_canmap_levcnlf - use FatesInterfaceMod, only : fates_hdim_lfmap_levcnlf - use FatesInterfaceMod, only : fates_hdim_canmap_levcnlfpf - use FatesInterfaceMod, only : fates_hdim_lfmap_levcnlfpf - use FatesInterfaceMod, only : fates_hdim_pftmap_levcnlfpf - use FatesInterfaceMod, only : fates_hdim_levelem - use FatesInterfaceMod, only : fates_hdim_elmap_levelpft - use FatesInterfaceMod, only : fates_hdim_pftmap_levelpft - use FatesInterfaceMod, only : fates_hdim_elmap_levelcwd - use FatesInterfaceMod, only : fates_hdim_cwdmap_levelcwd - use FatesInterfaceMod, only : fates_hdim_elmap_levelage - use FatesInterfaceMod, only : fates_hdim_agemap_levelage + use FatesInterfaceTypesMod, only : fates_hdim_levsclass + use FatesInterfaceTypesMod, only : fates_hdim_pfmap_levscpf + use FatesInterfaceTypesMod, only : fates_hdim_scmap_levscpf + use FatesInterfaceTypesMod, only : fates_hdim_levcoage + use FatesInterfaceTypesMod, only : fates_hdim_pfmap_levcapf + use FatesInterfaceTypesMod, only : fates_hdim_camap_levcapf + use FatesInterfaceTypesMod, only : fates_hdim_levage + use FatesInterfaceTypesMod, only : fates_hdim_levheight + use FatesInterfaceTypesMod, only : fates_hdim_levpft + use FatesInterfaceTypesMod, only : fates_hdim_scmap_levscag + use FatesInterfaceTypesMod, only : fates_hdim_agmap_levscag + use FatesInterfaceTypesMod, only : fates_hdim_scmap_levscagpft + use FatesInterfaceTypesMod, only : fates_hdim_agmap_levscagpft + use FatesInterfaceTypesMod, only : fates_hdim_pftmap_levscagpft + use FatesInterfaceTypesMod, only : fates_hdim_agmap_levagepft + use FatesInterfaceTypesMod, only : fates_hdim_pftmap_levagepft + use FatesInterfaceTypesMod, only : fates_hdim_levfuel + use FatesInterfaceTypesMod, only : fates_hdim_levcwdsc + use FatesInterfaceTypesMod, only : fates_hdim_levcan + use FatesInterfaceTypesMod, only : fates_hdim_canmap_levcnlf + use FatesInterfaceTypesMod, only : fates_hdim_lfmap_levcnlf + use FatesInterfaceTypesMod, only : fates_hdim_canmap_levcnlfpf + use FatesInterfaceTypesMod, only : fates_hdim_lfmap_levcnlfpf + use FatesInterfaceTypesMod, only : fates_hdim_pftmap_levcnlfpf + use FatesInterfaceTypesMod, only : fates_hdim_levelem + use FatesInterfaceTypesMod, only : fates_hdim_elmap_levelpft + use FatesInterfaceTypesMod, only : fates_hdim_pftmap_levelpft + use FatesInterfaceTypesMod, only : fates_hdim_elmap_levelcwd + use FatesInterfaceTypesMod, only : fates_hdim_cwdmap_levelcwd + use FatesInterfaceTypesMod, only : fates_hdim_elmap_levelage + use FatesInterfaceTypesMod, only : fates_hdim_agemap_levelage ! @@ -4930,7 +4930,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case('fates_levcacls') num2d = nlevcoage case ('fates_levpft') - num2d = maxveg_fates + num2d = numpft_fates case ('fates_levage') num2d = nlevage case ('fates_levheight') @@ -4940,21 +4940,21 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('fates_levcwdsc') num2d = ncwd case ('fates_levscpf') - num2d = nlevsclass*maxveg_fates + num2d = nlevsclass*numpft_fates case ('fates_levcapf') - num2d = nlevcoage*maxveg_fates + num2d = nlevcoage*numpft_fates case ('fates_levscag') num2d = nlevsclass*nlevage case ('fates_levscagpf') - num2d = nlevsclass*nlevage*maxveg_fates + num2d = nlevsclass*nlevage*numpft_fates case ('fates_levagepft') - num2d = nlevage*maxveg_fates + num2d = nlevage*numpft_fates case ('fates_levcan') num2d = nclmax case ('fates_levcnlf') num2d = nlevleaf * nclmax case ('fates_levcnlfpf') - num2d = nlevleaf * nclmax * maxveg_fates + num2d = nlevleaf * nclmax * numpft_fates case ('ltype') num2d = max_lunit case ('natpft') @@ -4962,7 +4962,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('fates_levelem') num2d = num_elements_fates case ('fates_levelpft') - num2d = num_elements_fates*maxveg_fates + num2d = num_elements_fates*numpft_fates case ('fates_levelcwd') num2d = num_elements_fates*ncwd case ('fates_levelage') From 38809a7ad2cdc8977568f2d691aa32b801d604b7 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 8 May 2020 16:14:30 -0600 Subject: [PATCH 1090/1973] updated module use statement in subgridMod for fates globals --- src/main/subgridMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index 3f34acda69..c0dbbc3dba 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -17,7 +17,7 @@ module subgridMod use clm_instur , only : wt_lunit, wt_nat_patch, urban_valid, wt_cft use landunit_varcon, only : istcrop, istdlak, istwet, isturb_tbd, isturb_hd, isturb_md use glcBehaviorMod , only : glc_behavior_type - use FatesInterfaceMod, only : fates_maxElementsPerSite + use FatesInterfaceTypesMod, only : fates_maxElementsPerSite implicit none private From 496e48b77f8a2f2d2590792fa76b2c7c2170c9a5 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 12 May 2020 22:42:41 -0600 Subject: [PATCH 1091/1973] Updating fates tag to api 11 --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 6474d99ce2..903f276ead 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.35.0_api.10.0.0 +tag = sci.1.35.4_api.11.0.0 required = True [PTCLM] From d44323d32c2f62041fc594788c0006670f39cea4 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 12 May 2020 11:31:52 -0700 Subject: [PATCH 1092/1973] changed fire variables to uppercase per PR640 --- cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm | 4 ++-- .../testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm | 4 ++-- .../testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm index e7f1e272d1..f39d85411c 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm @@ -4,8 +4,8 @@ hist_nhtfrq = -24 hist_empty_htapes = .true. use_fates_spitfire= .true. hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN_ELEM','LITTER_OUT_ELEM', - 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', + 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','FIRE_FUEL_MEF', + 'FIRE_FUEL_BULKD','FIRE_FUEL_SAV','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm index 25c9d2a116..967a48e89c 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm @@ -1,6 +1,6 @@ hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', - 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', + 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','FIRE_FUEL_MEF', + 'FIRE_FUEL_BULKD','FIRE_FUEL_SAV','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR','NPLANT_SCAG','NPLANT_SCPF', 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm index fc057c0be3..1790bb86c8 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm @@ -1,5 +1,5 @@ hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', - 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', + 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','FIRE_FUEL_MEF', + 'FIRE_FUEL_BULKD','FIRE_FUEL_SAV','FIRE_NESTEROV_INDEX','PFTbiomass', 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', 'TOTSOMC','TOTLITC','T_SCALAR','NEP','HR' From e599635d46711a99da14ee2d6dec4340c4ce94aa Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 29 May 2020 13:53:37 -0600 Subject: [PATCH 1093/1973] Updating FATES default parameter file to api 11.1 --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 22f078eff1..9027edb115 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -400,7 +400,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.10.0.0_12pft_c200420.nc +lnd/clm2/paramdata/fates_params_api.11.1.0_12pft_c200529.nc From d2af2b4aaf303d02f7d9621cfc4fb69dbc02e583 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 3 Jun 2020 13:19:56 -0700 Subject: [PATCH 1094/1973] updateing externals_clm.cfg to point to the associated fates tag --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 903f276ead..aa937723c3 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.35.4_api.11.0.0 +tag = sci.1.35.5_api.11.1.0 required = True [PTCLM] From 41e5989331bba80585b141461365ca2689a99a56 Mon Sep 17 00:00:00 2001 From: rosiealice Date: Thu, 9 Apr 2020 10:00:47 -0600 Subject: [PATCH 1095/1973] added BC_IN to call to set_site_properties --- src/utils/clmfates_interfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index b1127d21f4..43553ec504 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1285,7 +1285,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & end do call set_site_properties(this%fates(nc)%nsites, & - this%fates(nc)%sites) + this%fates(nc)%sites,this%fates(nc)%bc_in) ! ---------------------------------------------------------------------------- ! Initialize Hydraulics Code if turned on From ecb65e7a8962a8ca2addb424f8be8621843f357c Mon Sep 17 00:00:00 2001 From: rosiealice Date: Mon, 13 Apr 2020 05:54:45 -0600 Subject: [PATCH 1096/1973] transmit wt_nat_patch to fates interface --- src/utils/clmfates_interfaceMod.F90 | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 43553ec504..118ed8a829 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -64,7 +64,7 @@ module CLMFatesInterfaceMod use clm_varcon , only : denice use clm_varcon , only : ispval - use clm_varpar , only : natpft_size + use clm_varpar , only : natpft_size, natpft_ub, natpft_lb use clm_varpar , only : numrad use clm_varpar , only : ivis use clm_varpar , only : inir @@ -375,7 +375,8 @@ subroutine init(this, bounds_proc ) use FatesInterfaceTypesMod, only : numpft_fates => numpft use FatesParameterDerivedMod, only : param_derived - + use subgridMod, only : natveg_patch_exists + use clm_instur , only : wt_nat_patch implicit none ! Input Arguments @@ -400,6 +401,8 @@ subroutine init(this, bounds_proc ) integer :: c ! HLM column index integer :: l ! HLM LU index integer :: g ! HLM grid index + integer :: m ! HLM PFT index + integer :: ft ! FATES PFT index integer :: pi,pf integer, allocatable :: collist (:) type(bounds_type) :: bounds_clump @@ -517,12 +520,22 @@ subroutine init(this, bounds_proc ) this%fates(nc)%sites(s)%lat = grc%latdeg(g) this%fates(nc)%sites(s)%lon = grc%londeg(g) - end do + ! initialize static layers for reduced complexity FATES versions from HLM + ! maybe make this into a subroutine of it's own later. + do m = natpft_lb,natpft_ub + ft = m-natpft_lb+1 + if (natveg_patch_exists(g, m)) then + this%fates(nc)%bc_in(s)%pft_areafrac(ft)=wt_nat_patch(g,m) + else + this%fates(nc)%bc_in(s)%pft_areafrac(ft)=0._r8 + end if + end do - ! Initialize site-level static quantities dictated by the HLM - ! currently ground layering depth + end do !site + ! Initialize site-level static quantities dictated by the HLM + ! currently ground layering depth call this%init_soil_depths(nc) if (use_fates_planthydro) then From 3e140762f5adce5c153540f615fe7a185e44a14c Mon Sep 17 00:00:00 2001 From: rosiealice Date: Tue, 14 Apr 2020 13:51:53 -0600 Subject: [PATCH 1097/1973] behold, a new namelist variable! --- bld/CLMBuildNamelist.pm | 4 ++-- bld/namelist_files/namelist_defaults_ctsm.xml | 1 + bld/namelist_files/namelist_definition_ctsm.xml | 5 +++++ src/main/clm_varctl.F90 | 1 + src/main/controlMod.F90 | 3 +++ src/utils/clmfates_interfaceMod.F90 | 2 ++ 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index d435226610..32f2bdd255 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -770,7 +770,7 @@ sub setup_cmdl_fates_mode { # dis-allow fates specific namelist items with non-fates runs my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", "use_fates_cohort_age_tracking", - "use_fates_inventory_init", "fates_inventory_ctrl_filename","use_fates_logging","fates_parteh_mode" ); + "use_fates_inventory_init","use_fates_fixed_biogeog", "fates_inventory_ctrl_filename","use_fates_logging","fates_parteh_mode" ); foreach my $var ( @list ) { if ( defined($nl->get_value($var)) ) { $log->fatal_error("$var is being set, but can ONLY be set when -bgc fates option is used.\n"); @@ -3776,7 +3776,7 @@ sub setup_logic_fates { if (&value_is_true( $nl_flags->{'use_fates'}) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'}); my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", - "use_fates_inventory_init", "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking" ); + "use_fates_inventory_init","use_fates_fixed_biogeog", "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking" ); foreach my $var ( @list ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'} ); } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 9027edb115..2474b64dd3 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2733,6 +2733,7 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 .false. .false. .false. +.false. 1 diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index a0642c8199..75734bb3e2 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -640,6 +640,11 @@ Switch deciding which nutrient model to use in FATES. Toggle to turn on spitfire module for modeling fire (only relevant if FATES is being used). + +Toggle to turn on fixed biogeography mode (only relevant if FATES is being used). + + Toggle to turn on the logging module (only relevant if FATES is being used). diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index ac08a93407..68752767f9 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -232,6 +232,7 @@ module clm_varctl logical, public :: use_fates_ed_st3 = .false. ! true => static stand structure logical, public :: use_fates_ed_prescribed_phys = .false. ! true => prescribed physiology logical, public :: use_fates_inventory_init = .false. ! true => initialize fates from inventory + logical, public :: use_fates_fixed_biogeog = .false. ! true => use fixed biogeography mode character(len=256), public :: fates_inventory_ctrl_filename = '' ! filename for inventory control !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index d24eea2a15..1ee2fda0da 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -226,6 +226,7 @@ subroutine control_init( ) use_fates_cohort_age_tracking, & use_fates_ed_prescribed_phys, & use_fates_inventory_init, & + use_fates_fixed_biogeog, & fates_inventory_ctrl_filename, & fates_parteh_mode @@ -719,6 +720,7 @@ subroutine control_spmd() call mpi_bcast (use_fates_ed_st3, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_ed_prescribed_phys, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_inventory_init, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_fates_fixed_biogeog, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (fates_inventory_ctrl_filename, len(fates_inventory_ctrl_filename), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fates_paramfile, len(fates_paramfile) , MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fates_parteh_mode, 1, MPI_INTEGER, 0, mpicom, ier) @@ -1071,6 +1073,7 @@ subroutine control_print () write(iulog, *) ' use_fates_ed_st3 = ',use_fates_ed_st3 write(iulog, *) ' use_fates_ed_prescribed_phys = ',use_fates_ed_prescribed_phys write(iulog, *) ' use_fates_inventory_init = ',use_fates_inventory_init + write(iulog, *) ' use_fates_fixed_biogeog = ', use_fates_fixed_biogeog write(iulog, *) ' fates_inventory_ctrl_filename = ',fates_inventory_ctrl_filename end if end subroutine control_print diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 118ed8a829..411140141e 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -57,6 +57,7 @@ module CLMFatesInterfaceMod use clm_varctl , only : use_fates_ed_prescribed_phys use clm_varctl , only : use_fates_logging use clm_varctl , only : use_fates_inventory_init + use clm_varctl , only : use_fates_fixed_biogeog use clm_varctl , only : fates_inventory_ctrl_filename use clm_varcon , only : tfrz @@ -396,6 +397,7 @@ subroutine init(this, bounds_proc ) integer :: pass_cohort_age_tracking integer :: pass_inventory_init integer :: pass_is_restart + integer :: pass_biogeog integer :: nc ! thread index integer :: s ! FATES site index integer :: c ! HLM column index From f90c8be1764237d89d21e5b97ba554130ce3c7dc Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 11 May 2020 18:35:56 -0700 Subject: [PATCH 1098/1973] adding files for fates fixed biogeo testing --- cime_config/testdefs/testlist_clm.xml | 32 +++++++++++-------- .../FatesFixedBiogeo/include_user_mods | 1 + .../FatesFixedBiogeo/user_nl_clm | 1 + 3 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 93c93569c8..18710a3a06 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1816,18 +1816,6 @@ -<<<<<<< HEAD -||||||| constructed merge base -<<<<<<< HEAD - -======= - ->>>>>>> fates_next_api - -======= - - ->>>>>>> no for real this time, fixing merge conflicts @@ -1836,6 +1824,7 @@ + @@ -1895,7 +1884,16 @@ - + + + + + + + + + + @@ -1903,6 +1901,14 @@ + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods new file mode 100644 index 0000000000..1f2c03aebe --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods @@ -0,0 +1 @@ +../FatesColdDef diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm new file mode 100644 index 0000000000..0d9456c4e6 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm @@ -0,0 +1 @@ +use_fates_cohort_age_tracking=.true. \ No newline at end of file From fc04937a66fcc5a4d95bc0ed3a0edad1b6e0be32 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 13 May 2020 14:29:42 -0700 Subject: [PATCH 1099/1973] update user_nl_clm to use_fates_fixed_biogeog --- cime_config/testdefs/testlist_clm.xml | 2 ++ .../clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 18710a3a06..f957ff6079 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1896,6 +1896,8 @@ + + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm index 0d9456c4e6..d3349780e0 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm @@ -1 +1 @@ -use_fates_cohort_age_tracking=.true. \ No newline at end of file +use_fates_fixed_biogeog=.true. \ No newline at end of file From 5e6ab826c5534acaf3184a669460f942bfc0e57c Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 13 May 2020 16:40:15 -0700 Subject: [PATCH 1100/1973] fixing typo in testmod --- cime_config/testdefs/testlist_clm.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index f957ff6079..81afc534f6 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1893,16 +1893,6 @@ - - - - - - - - - - From b51dcd66eb26afa195f0d4d0d14807561133c386 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 27 Jun 2020 12:52:07 -0600 Subject: [PATCH 1101/1973] Loosen tolerance on lat/lon consistency check The old tolerance could be violated by single-precision roundoff-level differences that we want to ignore. --- lilac/src/lilac_atmcap.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/src/lilac_atmcap.F90 b/lilac/src/lilac_atmcap.F90 index c34859df49..911bb7b55f 100644 --- a/lilac/src/lilac_atmcap.F90 +++ b/lilac/src/lilac_atmcap.F90 @@ -123,7 +123,7 @@ subroutine lilac_atmcap_init (comp, lnd2atm_state, atm2lnd_state, clock, rc) integer :: numOwnedElements real(r8), pointer :: ownedElemCoords(:) real(r8) :: mesh_lon, mesh_lat - real(r8) :: tolerance = 1.e-5_r8 + real(r8), parameter :: tolerance = 1.e-4_r8 character(len=*), parameter :: subname='(lilac_atmcap_init): ' !------------------------------------------------------------------------- From 25f7417023f1b2f40dea01c8db4e5c15926bb39f Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 13 May 2020 16:46:38 -0700 Subject: [PATCH 1102/1973] moved fixed biogeo directory up on directory to reduce complex directory structure. Also renamed --- cime_config/testdefs/testlist_clm.xml | 2 +- .../clm/FatesReducedCompFixedBiogeo/include_user_mods | 1 + .../user_nl_clm | 0 .../clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods | 1 - 4 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/include_user_mods rename cime_config/testdefs/testmods_dirs/clm/{FatesReducedComplex/FatesFixedBiogeo => FatesReducedCompFixedBiogeo}/user_nl_clm (100%) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 81afc534f6..124b6a2930 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1884,7 +1884,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/include_user_mods new file mode 100644 index 0000000000..7ad63508b8 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/include_user_mods @@ -0,0 +1 @@ +../../FatesColdDef diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/user_nl_clm similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/user_nl_clm rename to cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/user_nl_clm diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods deleted file mode 100644 index 1f2c03aebe..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplex/FatesFixedBiogeo/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../FatesColdDef From 485c1fcd843793666150aaf38b0cf40555b11fd0 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 13 May 2020 16:50:09 -0700 Subject: [PATCH 1103/1973] fixing typos again --- cime_config/testdefs/testlist_clm.xml | 2 +- .../include_user_mods | 0 .../user_nl_clm | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename cime_config/testdefs/testmods_dirs/clm/{FatesReducedCompFixedBiogeo => FatesReducedComplexFixedBiogeo}/include_user_mods (100%) rename cime_config/testdefs/testmods_dirs/clm/{FatesReducedCompFixedBiogeo => FatesReducedComplexFixedBiogeo}/user_nl_clm (100%) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 124b6a2930..865e862a11 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1884,7 +1884,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplexFixedBiogeo/include_user_mods similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/include_user_mods rename to cime_config/testdefs/testmods_dirs/clm/FatesReducedComplexFixedBiogeo/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplexFixedBiogeo/user_nl_clm similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/FatesReducedCompFixedBiogeo/user_nl_clm rename to cime_config/testdefs/testmods_dirs/clm/FatesReducedComplexFixedBiogeo/user_nl_clm From cd5be0c94dac8ecdaa0ffe0bc94a038a9570a2a7 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 13 May 2020 17:55:05 -0600 Subject: [PATCH 1104/1973] fixing call to FatesColdDef --- .../clm/FatesReducedComplexFixedBiogeo/include_user_mods | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplexFixedBiogeo/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplexFixedBiogeo/include_user_mods index 7ad63508b8..1f2c03aebe 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplexFixedBiogeo/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/clm/FatesReducedComplexFixedBiogeo/include_user_mods @@ -1 +1 @@ -../../FatesColdDef +../FatesColdDef From c54f625ffe1faac9b2ac873b5145f06753e9049d Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 19 May 2020 11:16:08 -0700 Subject: [PATCH 1105/1973] removing dead code --- src/utils/clmfates_interfaceMod.F90 | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 411140141e..c35bdf9592 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -386,18 +386,6 @@ subroutine init(this, bounds_proc ) ! local variables integer :: nclumps ! Number of threads - - integer :: pass_masterproc - integer :: pass_vertsoilc - integer :: pass_spitfire - integer :: pass_ed_st3 - integer :: pass_ed_prescribed_phys - integer :: pass_logging - integer :: pass_planthydro - integer :: pass_cohort_age_tracking - integer :: pass_inventory_init - integer :: pass_is_restart - integer :: pass_biogeog integer :: nc ! thread index integer :: s ! FATES site index integer :: c ! HLM column index From 8b90363b87316a906db3718564c108917a57623b Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 22 May 2020 09:20:25 -0600 Subject: [PATCH 1106/1973] adding fix for pft indexing bounds --- src/utils/clmfates_interfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index c35bdf9592..149b65294d 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -513,7 +513,7 @@ subroutine init(this, bounds_proc ) ! initialize static layers for reduced complexity FATES versions from HLM ! maybe make this into a subroutine of it's own later. - do m = natpft_lb,natpft_ub + do m = natpft_lb,natpft_ub-1 ft = m-natpft_lb+1 if (natveg_patch_exists(g, m)) then this%fates(nc)%bc_in(s)%pft_areafrac(ft)=wt_nat_patch(g,m) From 8de0d356dc224bf72fe42f06c8a20f0510e93628 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 5 Jun 2020 13:09:08 -0700 Subject: [PATCH 1107/1973] updating pointer to correct fates tag for recently merged biogeog fates_next_api PR --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index aa937723c3..71cbe69a29 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.35.5_api.11.1.0 +tag = sci.1.36.0_api.11.2.0 required = True [PTCLM] From 6bd45143889d962283f4c7a3011bb0a35d991b71 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 29 Jun 2020 16:00:13 -0700 Subject: [PATCH 1108/1973] cleaning up build errors that came up due to rebase --- src/biogeophys/SoilWaterMovementMod.F90 | 6 +++--- src/main/clm_instMod.F90 | 1 + src/utils/clmfates_interfaceMod.F90 | 12 +++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 index 352a93e82d..885aefa004 100644 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ b/src/biogeophys/SoilWaterMovementMod.F90 @@ -1152,9 +1152,9 @@ subroutine soilwater_moisture_form(bounds, num_hydrologyc, & smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) - h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice water (kg/m2) - h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col + h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice water (kg/m2) + h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) + qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col & ) ! end associate statement ! Get time step diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index aab218ed62..74bc921b1e 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -575,6 +575,7 @@ subroutine clm_instRest(bounds, ncid, flag, writing_finidat_interp_dest_file) call clm_fates%restart(bounds, ncid, flag=flag, & waterdiagnosticbulk_inst=water_inst%waterdiagnosticbulk_inst, & + waterstatebulk_inst=water_inst%waterstatebulk_inst, & canopystate_inst=canopystate_inst, & soilstate_inst=soilstate_inst) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 149b65294d..112b5424c3 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -950,7 +950,7 @@ end subroutine wrap_update_hlmfates_dyn ! ==================================================================================== subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & - canopystate_inst, soilstate_inst ) + waterstatebulk_inst, canopystate_inst, soilstate_inst ) ! --------------------------------------------------------------------------------- ! The ability to restart the model is handled through three different types of calls @@ -982,7 +982,8 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & type(bounds_type) , intent(in) :: bounds_proc type(file_desc_t) , intent(inout) :: ncid ! netcdf id character(len=*) , intent(in) :: flag - type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst + type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst + type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst type(canopystate_type) , intent(inout) :: canopystate_inst type(soilstate_type) , intent(inout) :: soilstate_inst @@ -1207,7 +1208,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & soilstate_inst%bsw_col(c,1:nlevsoil) this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoil) = & - waterdiagnosticbulk_inst%waterstate_inst%h2osoi_liq_col(c,1:nlevsoil) + waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoil) end do @@ -1925,7 +1926,8 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & type(soilbiogeochem_carbonstate_type), intent(in) :: soilbiogeochem_carbonstate_inst ! locals - integer :: s,c + real(r8) :: dtime + integer :: s,c associate(& hr => soilbiogeochem_carbonflux_inst%hr_col, & ! (gC/m2/s) total heterotrophic respiration @@ -1940,7 +1942,7 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & this%fates(nc)%bc_in(s)%tot_litc = totlitc(c) end do - dtime = get_step_size() + dtime = get_step_size_real() ! Update history variables that track these variables call this%fates_hist%update_history_cbal(nc, & From bed6890aa03f467212bcff714c0f42f6253f5247 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 29 Jun 2020 17:17:31 -0600 Subject: [PATCH 1109/1973] Updated ChangeLog and ChangeSum --- doc/ChangeLog | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 117 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 6f3183ed94..045c26ec2f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,120 @@ =============================================================== +Tag name: ctsm1.0.dev103 +Originator(s): slevis (Samuel Levis, SLevis Consulting LLC,303-665-1310) +Date: Mon Jun 29 17:16:29 MDT 2020 +One-line Summary: Gridcell-level balance-check for methane (CH4) + +Purpose of changes +------------------ + + Bracket the model time-step loop to calculate balance checks at the + gridcell level, as detailed in issue #315. The column-level check + remains unchanged. + + Subroutine ch4_init_balance_check is replaced with + ch4_init_column_balance_check. Subroutine + ch4_init_gridcell_balance_check is added. + + The implementation is similar to the one for carbon and nitrogen (see + tag ctsm1.0.dev096). + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #315 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + None + +Changes made to namelist defaults (e.g., changed parameter values): + None + +Changes to the datasets (e.g., parameter, surface or initial files): + None + +Substantial timing or memory changes: + No + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + None + +Changes to tests or testing: + None + +Code reviewed by: + @billsacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + No + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + None + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/CTSM/pull/1022 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev102 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Fri Jun 26 01:32:04 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 655832d263..9af125f5b9 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev103 slevis 06/29/2020 Gridcell-level error-check for methane (CH4) ctsm1.0.dev102 erik/ole 06/26/2020 Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 ctsm1.0.dev101 ole/erik 06/17/2020 Changes from Keith to bring a list of variables to the parameter file ctsm1.0.dev100 sacks 06/09/2020 Deallocate memory after running init_interp From d6c80e8b10814532e559354e7819a2e2b8a4af63 Mon Sep 17 00:00:00 2001 From: wwieder Date: Tue, 30 Jun 2020 11:53:26 -0600 Subject: [PATCH 1110/1973] Revert extra output used for testing --- src/biogeochem/CNVegCarbonFluxType.F90 | 84 ++++++++++++-------------- 1 file changed, 37 insertions(+), 47 deletions(-) diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 index 8a5bb32abe..2c1d8ff4b7 100644 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ b/src/biogeochem/CNVegCarbonFluxType.F90 @@ -838,16 +838,6 @@ subroutine InitHistory(this, bounds, carbon_type) ptr_patch=this%grainc_to_seed_patch) end if - this%hrv_livestemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='HRV_LIVESTEMC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='harvest livestem C mortality', & - ptr_patch=this%hrv_livestemc_to_litter_patch, default='active') - - this%livestemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='livestem C mortality', & - ptr_patch=this%hrv_livestemc_to_litter_patch, default='active') - this%litterc_loss_col(begc:endc) = spval call hist_addfld1d (fname='LITTERC_LOSS', units='gC/m^2/s', & avgflag='A', long_name='litter C loss', & @@ -906,12 +896,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & avgflag='A', long_name='live stem C storage mortality', & - ptr_patch=this%m_livestemc_storage_to_litter_patch, default='active') + ptr_patch=this%m_livestemc_storage_to_litter_patch, default='inactive') this%m_deadstemc_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & avgflag='A', long_name='dead stem C storage mortality', & - ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='active') + ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='inactive') this%m_livecrootc_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & @@ -936,7 +926,7 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_xfer_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER', units='gC/m^2/s', & avgflag='A', long_name='live stem C transfer mortality', & - ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='active') + ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='inactive') this%m_deadstemc_xfer_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_LITTER', units='gC/m^2/s', & @@ -956,7 +946,7 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER', units='gC/m^2/s', & avgflag='A', long_name='live stem C mortality', & - ptr_patch=this%m_livestemc_to_litter_patch, default='active') + ptr_patch=this%m_livestemc_to_litter_patch, default='inactive') this%m_deadstemc_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER', units='gC/m^2/s', & @@ -1001,17 +991,17 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_TO_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C fire loss', & - ptr_patch=this%m_livestemc_to_fire_patch, default='active') + ptr_patch=this%m_livestemc_to_fire_patch, default='inactive') this%m_livestemc_storage_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C storage fire loss', & - ptr_patch=this%m_livestemc_storage_to_fire_patch, default='active') + ptr_patch=this%m_livestemc_storage_to_fire_patch, default='inactive') this%m_livestemc_xfer_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C transfer fire loss', & - ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='active') + ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='inactive') this%m_deadstemc_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_TO_FIRE', units='gC/m^2/s', & @@ -1102,22 +1092,22 @@ subroutine InitHistory(this, bounds, carbon_type) this%m_livestemc_to_litter_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C fire mortality to litter', & - ptr_patch=this%m_livestemc_to_litter_fire_patch, default='active') + ptr_patch=this%m_livestemc_to_litter_fire_patch, default='inactive') this%m_livestemc_storage_to_litter_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C storage fire mortality to litter', & - ptr_patch=this%m_livestemc_storage_to_litter_fire_patch, default='active') + ptr_patch=this%m_livestemc_storage_to_litter_fire_patch, default='inactive') this%m_livestemc_xfer_to_litter_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C transfer fire mortality to litter', & - ptr_patch=this%m_livestemc_xfer_to_litter_fire_patch, default='active') + ptr_patch=this%m_livestemc_xfer_to_litter_fire_patch, default='inactive') this%m_livestemc_to_deadstemc_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMC_TO_DEADSTEMC_FIRE', units='gC/m^2/s', & avgflag='A', long_name='live stem C fire mortality to dead stem C', & - ptr_patch=this%m_livestemc_to_deadstemc_fire_patch, default='active') + ptr_patch=this%m_livestemc_to_deadstemc_fire_patch, default='inactive') this%m_deadstemc_to_litter_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & @@ -1208,7 +1198,7 @@ subroutine InitHistory(this, bounds, carbon_type) this%leafc_xfer_to_leafc_patch(begp:endp) = spval call hist_addfld1d (fname='LEAFC_XFER_TO_LEAFC', units='gC/m^2/s', & avgflag='A', long_name='leaf C growth from storage', & - ptr_patch=this%leafc_xfer_to_leafc_patch, default='active') + ptr_patch=this%leafc_xfer_to_leafc_patch, default='inactive') this%frootc_xfer_to_frootc_patch(begp:endp) = spval call hist_addfld1d (fname='FROOTC_XFER_TO_FROOTC', units='gC/m^2/s', & @@ -1218,12 +1208,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%livestemc_xfer_to_livestemc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMC_XFER_TO_LIVESTEMC', units='gC/m^2/s', & avgflag='A', long_name='live stem C growth from storage', & - ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='active') + ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='inactive') this%deadstemc_xfer_to_deadstemc_patch(begp:endp) = spval call hist_addfld1d (fname='DEADSTEMC_XFER_TO_DEADSTEMC', units='gC/m^2/s', & avgflag='A', long_name='dead stem C growth from storage', & - ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='active') + ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='inactive') this%livecrootc_xfer_to_livecrootc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOTC_XFER_TO_LIVECROOTC', units='gC/m^2/s', & @@ -1255,7 +1245,7 @@ subroutine InitHistory(this, bounds, carbon_type) this%cpool_to_resp_patch(begp:endp) = spval call hist_addfld1d (fname='EXCESSC_MR', units='gC/m^2/s', & avgflag='A', long_name='excess C maintenance respiration', & - ptr_patch=this%cpool_to_resp_patch, default='active') + ptr_patch=this%cpool_to_resp_patch, default='inactive') this%leaf_mr_patch(begp:endp) = spval call hist_addfld1d (fname='LEAF_MR', units='gC/m^2/s', & avgflag='A', long_name='leaf maintenance respiration', & @@ -1269,12 +1259,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%livestem_mr_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEM_MR', units='gC/m^2/s', & avgflag='A', long_name='live stem maintenance respiration', & - ptr_patch=this%livestem_mr_patch, default='active') + ptr_patch=this%livestem_mr_patch, default='inactive') this%livecroot_mr_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOT_MR', units='gC/m^2/s', & avgflag='A', long_name='live coarse root maintenance respiration', & - ptr_patch=this%livecroot_mr_patch, default='active') + ptr_patch=this%livecroot_mr_patch, default='inactive') this%psnsun_to_cpool_patch(begp:endp) = spval call hist_addfld1d (fname='PSNSUN_TO_CPOOL', units='gC/m^2/s', & @@ -1309,42 +1299,42 @@ subroutine InitHistory(this, bounds, carbon_type) this%cpool_to_livestemc_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC', units='gC/m^2/s', & avgflag='A', long_name='allocation to live stem C', & - ptr_patch=this%cpool_to_livestemc_patch, default='active') + ptr_patch=this%cpool_to_livestemc_patch, default='inactive') this%cpool_to_livestemc_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC_STORAGE', units='gC/m^2/s', & avgflag='A', long_name='allocation to live stem C storage', & - ptr_patch=this%cpool_to_livestemc_storage_patch, default='active') + ptr_patch=this%cpool_to_livestemc_storage_patch, default='inactive') this%cpool_to_deadstemc_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC', units='gC/m^2/s', & avgflag='A', long_name='allocation to dead stem C', & - ptr_patch=this%cpool_to_deadstemc_patch, default='active') + ptr_patch=this%cpool_to_deadstemc_patch, default='inactive') this%cpool_to_deadstemc_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC_STORAGE', units='gC/m^2/s', & avgflag='A', long_name='allocation to dead stem C storage', & - ptr_patch=this%cpool_to_deadstemc_storage_patch, default='active') + ptr_patch=this%cpool_to_deadstemc_storage_patch, default='inactive') this%cpool_to_livecrootc_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC', units='gC/m^2/s', & avgflag='A', long_name='allocation to live coarse root C', & - ptr_patch=this%cpool_to_livecrootc_patch, default='active') + ptr_patch=this%cpool_to_livecrootc_patch, default='inactive') this%cpool_to_livecrootc_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC_STORAGE', units='gC/m^2/s', & avgflag='A', long_name='allocation to live coarse root C storage', & - ptr_patch=this%cpool_to_livecrootc_storage_patch, default='active') + ptr_patch=this%cpool_to_livecrootc_storage_patch, default='inactive') this%cpool_to_deadcrootc_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC', units='gC/m^2/s', & avgflag='A', long_name='allocation to dead coarse root C', & - ptr_patch=this%cpool_to_deadcrootc_patch, default='active') + ptr_patch=this%cpool_to_deadcrootc_patch, default='inactive') this%cpool_to_deadcrootc_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC_STORAGE', units='gC/m^2/s', & avgflag='A', long_name='allocation to dead coarse root C storage', & - ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='active') + ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='inactive') this%cpool_to_gresp_storage_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_TO_GRESP_STORAGE', units='gC/m^2/s', & @@ -1384,42 +1374,42 @@ subroutine InitHistory(this, bounds, carbon_type) this%cpool_livestem_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_LIVESTEM_GR', units='gC/m^2/s', & avgflag='A', long_name='live stem growth respiration', & - ptr_patch=this%cpool_livestem_gr_patch, default='active') + ptr_patch=this%cpool_livestem_gr_patch, default='inactive') this%cpool_livestem_storage_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_LIVESTEM_STORAGE_GR', units='gC/m^2/s', & avgflag='A', long_name='live stem growth respiration to storage', & - ptr_patch=this%cpool_livestem_storage_gr_patch, default='active') + ptr_patch=this%cpool_livestem_storage_gr_patch, default='inactive') this%transfer_livestem_gr_patch(begp:endp) = spval call hist_addfld1d (fname='TRANSFER_LIVESTEM_GR', units='gC/m^2/s', & avgflag='A', long_name='live stem growth respiration from storage', & - ptr_patch=this%transfer_livestem_gr_patch, default='active') + ptr_patch=this%transfer_livestem_gr_patch, default='inactive') this%cpool_deadstem_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_DEADSTEM_GR', units='gC/m^2/s', & avgflag='A', long_name='dead stem growth respiration', & - ptr_patch=this%cpool_deadstem_gr_patch, default='active') + ptr_patch=this%cpool_deadstem_gr_patch, default='inactive') this%cpool_deadstem_storage_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_DEADSTEM_STORAGE_GR', units='gC/m^2/s', & avgflag='A', long_name='dead stem growth respiration to storage', & - ptr_patch=this%cpool_deadstem_storage_gr_patch, default='active') + ptr_patch=this%cpool_deadstem_storage_gr_patch, default='inactive') this%transfer_deadstem_gr_patch(begp:endp) = spval call hist_addfld1d (fname='TRANSFER_DEADSTEM_GR', units='gC/m^2/s', & avgflag='A', long_name='dead stem growth respiration from storage', & - ptr_patch=this%transfer_deadstem_gr_patch, default='active') + ptr_patch=this%transfer_deadstem_gr_patch, default='inactive') this%cpool_livecroot_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_LIVECROOT_GR', units='gC/m^2/s', & avgflag='A', long_name='live coarse root growth respiration', & - ptr_patch=this%cpool_livecroot_gr_patch, default='active') + ptr_patch=this%cpool_livecroot_gr_patch, default='inactive') this%cpool_livecroot_storage_gr_patch(begp:endp) = spval call hist_addfld1d (fname='CPOOL_LIVECROOT_STORAGE_GR', units='gC/m^2/s', & avgflag='A', long_name='live coarse root growth respiration to storage', & - ptr_patch=this%cpool_livecroot_storage_gr_patch, default='active') + ptr_patch=this%cpool_livecroot_storage_gr_patch, default='inactive') this%transfer_livecroot_gr_patch(begp:endp) = spval call hist_addfld1d (fname='TRANSFER_LIVECROOT_GR', units='gC/m^2/s', & @@ -1454,12 +1444,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%livestemc_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & avgflag='A', long_name='live stem C shift storage to transfer', & - ptr_patch=this%livestemc_storage_to_xfer_patch, default='active') + ptr_patch=this%livestemc_storage_to_xfer_patch, default='inactive') this%deadstemc_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='DEADSTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & avgflag='A', long_name='dead stem C shift storage to transfer', & - ptr_patch=this%deadstemc_storage_to_xfer_patch, default='active') + ptr_patch=this%deadstemc_storage_to_xfer_patch, default='inactive') this%livecrootc_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & @@ -1479,12 +1469,12 @@ subroutine InitHistory(this, bounds, carbon_type) this%livestemc_to_deadstemc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMC_TO_DEADSTEMC', units='gC/m^2/s', & avgflag='A', long_name='live stem C turnover', & - ptr_patch=this%livestemc_to_deadstemc_patch, default='active') + ptr_patch=this%livestemc_to_deadstemc_patch, default='inactive') this%livecrootc_to_deadcrootc_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOTC_TO_DEADCROOTC', units='gC/m^2/s', & avgflag='A', long_name='live coarse root C turnover', & - ptr_patch=this%livecrootc_to_deadcrootc_patch, default='active') + ptr_patch=this%livecrootc_to_deadcrootc_patch, default='inactive') this%gpp_before_downreg_patch(begp:endp) = spval call hist_addfld1d (fname='INIT_GPP', units='gC/m^2/s', & From 19f801307bdbc08889bc1400455ecc2e697b48a2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 30 Jun 2020 11:54:41 -0600 Subject: [PATCH 1111/1973] LILAC build: make default withOUT OpenMP support I found that on cheyenne, if you don't explicitly specify OMP_NUM_THREADS in your job, you get 36 threads per node. This is a huge problem for performance, and is something that could easily happen to a user who wasn't planning to run threaded anyway. So it feels like the safest thing to do is to build without threading by default. --- cime_config/SystemTests/lilacsmoke.py | 4 --- .../obtaining-and-building-ctsm.rst | 10 ++++++-- python/ctsm/lilac_build_ctsm.py | 25 ++++++++++--------- python/ctsm/test/test_sys_lilac_build_ctsm.py | 2 +- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index 946b439707..1dce6bb175 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -47,10 +47,6 @@ def build_phase(self, sharedlib_only=False, model_only=False): compiler=compiler) if debug: cmd += ' --build-debug' - # For now, always build this test without threads: it doesn't need - # threads, and building unthreaded ensures that it works on a wider range - # of machines/compilers - cmd += ' --build-without-openmp' self._run_build_cmd(cmd, exeroot, 'build_ctsm.bldlog') # We call the build script with --rebuild even for an initial build. This is diff --git a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst index 4798808308..a51dcfcf25 100644 --- a/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst +++ b/doc/source/lilac/obtaining-building-and-running/obtaining-and-building-ctsm.rst @@ -170,11 +170,14 @@ Some other options to ``build_ctsm`` are supported in this case (but many are no they are only applicable to the non-CIME-supported machine workflow); run ``./lilac/build_ctsm -h`` for details. -.. note:: +.. important:: If PNetCDF (parallel NetCDF) is not available on this machine, you will need to add the option ``--no-pnetcdf``. + If you plan to run with OpenMP threading-based parallelization, or hybrid MPI/OpenMP, + then it is important to add ``--build-with-openmp``. + Besides the build files themselves, ``build_ctsm`` creates the following important files that are needed for the build of the atmosphere model: @@ -215,12 +218,15 @@ model performance. The given directory (``/PATH/TO/CTSM/BUILD``) must *not* exist. This directory is created for you by the build script. -.. note:: +.. important:: If PNetCDF (parallel NetCDF) is not available on your machine/compiler, you should use the option ``--no-pnetcdf`` instead of ``--pnetcdf-path``. You must specify exactly one of those two options. + If you plan to run with OpenMP threading-based parallelization, or hybrid MPI/OpenMP, + then it is important to add ``--build-with-openmp``. + Example usage for a Mac (a simple case) is:: ./lilac/build_ctsm ~/ctsm_build_dir --os Darwin --compiler gnu --netcdf-path /usr/local --esmf-lib-path /Users/sacks/ESMF/esmf8.0.0/lib/libO/Darwin.gfortranclang.64.mpich3.default --max-mpitasks-per-node 4 --no-pnetcdf diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 819168c12d..34306af6f6 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -82,7 +82,7 @@ def main(cime_path): extra_cflags=args.extra_cflags, no_pnetcdf=args.no_pnetcdf, build_debug=args.build_debug, - build_without_openmp=args.build_without_openmp, + build_with_openmp=args.build_with_openmp, inputdata_path=args.inputdata_path) def build_ctsm(cime_path, @@ -103,7 +103,7 @@ def build_ctsm(cime_path, extra_cflags='', no_pnetcdf=False, build_debug=False, - build_without_openmp=False, + build_with_openmp=False, inputdata_path=None): """Implementation of build_ctsm command @@ -138,7 +138,7 @@ def build_ctsm(cime_path, Ignored if machine is given no_pnetcdf (bool): if True, use netcdf rather than pnetcdf build_debug (bool): if True, build with flags for debugging - build_without_openmp (bool): if True, build without OpenMP support + build_with_openmp (bool): if True, build with OpenMP support inputdata_path (str or None): path to existing inputdata directory on this machine If None, an inputdata directory will be created for this build (If machine is given, then we use the machine's inputdata directory by default; @@ -176,7 +176,7 @@ def build_ctsm(cime_path, compiler=compiler, machine=machine, build_debug=build_debug, - build_without_openmp=build_without_openmp, + build_with_openmp=build_with_openmp, inputdata_path=inputdata_path) if existing_inputdata: @@ -318,11 +318,12 @@ def _commandline_args(args_to_parse=None): help='Build with flags for debugging rather than production runs') non_rebuild_optional_list.append('build-debug') - non_rebuild_optional.add_argument('--build-without-openmp', action='store_true', - help='By default, CTSM is built with support for OpenMP threading;\n' - 'if this flag is set, then CTSM is built without this support.\n' - 'This is mainly useful if your machine/compiler does not support OpenMP.') - non_rebuild_optional_list.append('build-without-openmp') + non_rebuild_optional.add_argument('--build-with-openmp', action='store_true', + help='By default, CTSM is built WITHOUT support for OpenMP threading;\n' + 'if this flag is set, then CTSM is built WITH this support.\n' + 'This is important for performance if you will be running with\n' + 'OpenMP threading-based parallelization, or hybrid MPI/OpenMP.') + non_rebuild_optional_list.append('build-with-openmp') non_rebuild_optional.add_argument('--inputdata-path', help='Path to directory containing CTSM\'s NetCDF inputs.\n' @@ -574,7 +575,7 @@ def _fill_out_machine_files(build_dir, def _create_case(cime_path, build_dir, compiler, - machine=None, build_debug=False, build_without_openmp=False, + machine=None, build_debug=False, build_with_openmp=False, inputdata_path=None): """Create a case that can later be used to build the CTSM library and its dependencies @@ -586,7 +587,7 @@ def _create_case(cime_path, build_dir, compiler, If None, we assume we're using an on-the-fly machine port Otherwise, machine should be the name of a machine known to cime build_debug (bool): if True, build with flags for debugging - build_without_openmp (bool): if True, build without OpenMP support + build_with_openmp (bool): if True, build with OpenMP support inputdata_path (str or None): path to existing inputdata directory on this machine If None, we use the machine's default DIN_LOC_ROOT """ @@ -626,7 +627,7 @@ def _create_case(cime_path, build_dir, compiler, subprocess.check_call([xmlchange, 'LILAC_MODE=on'], cwd=case_dir) if build_debug: subprocess.check_call([xmlchange, 'DEBUG=TRUE'], cwd=case_dir) - if not build_without_openmp: + if build_with_openmp: subprocess.check_call([xmlchange, 'FORCE_BUILD_SMP=TRUE'], cwd=case_dir) run_cmd_output_on_error([os.path.join(case_dir, 'case.setup')], diff --git a/python/ctsm/test/test_sys_lilac_build_ctsm.py b/python/ctsm/test/test_sys_lilac_build_ctsm.py index f8b0447fc7..46158db6d3 100755 --- a/python/ctsm/test/test_sys_lilac_build_ctsm.py +++ b/python/ctsm/test/test_sys_lilac_build_ctsm.py @@ -87,7 +87,7 @@ def test_buildSetup_userDefinedMachine_allInfo(self): extra_fflags='-foo', extra_cflags='-bar', build_debug=True, - build_without_openmp=True, + build_with_openmp=True, inputdata_path=os.path.join(self._tempdir, 'my_inputdata')) # the critical piece of this test is that the above command doesn't generate any # errors; however we also do some assertions below From 9b2656ee3790e5aeb571816a296efd7adfd79440 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 30 Jun 2020 10:56:45 -0700 Subject: [PATCH 1112/1973] Fix circular dependency --- src/biogeophys/BalanceCheckMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 480eff0298..7d839e2242 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -250,7 +250,6 @@ subroutine BalanceCheck( bounds, & use clm_varcon , only : spval use clm_time_manager , only : get_step_size_real, get_nstep use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause - use clm_instMod , only : surfalb_inst use CanopyStateType , only : canopystate_type use SurfaceAlbedoType , only : surfalb_type use subgridAveMod From 7734dcb3e696c7beca62ae3e872f48ec7cc8ba06 Mon Sep 17 00:00:00 2001 From: wwieder Date: Tue, 30 Jun 2020 11:57:22 -0600 Subject: [PATCH 1113/1973] Remove extra VegN output used in testing --- src/biogeochem/CNVegNitrogenFluxType.F90 | 71 +++++++----------------- 1 file changed, 19 insertions(+), 52 deletions(-) diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90 index 212333155c..f9f2b37215 100644 --- a/src/biogeochem/CNVegNitrogenFluxType.F90 +++ b/src/biogeochem/CNVegNitrogenFluxType.F90 @@ -557,29 +557,7 @@ subroutine InitHistory(this, bounds) else vr_suffix = "" endif -! WW added these two fields - ! This may just be a crop variable - this%livestemn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='livestem N mortality', & - ptr_patch=this%livestemn_to_litter_patch, default='active') - - this%hrv_livestemn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='HRV_LIVESTEMN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='harvest livestem N mortality', & - ptr_patch=this%hrv_livestemn_to_litter_patch, default='active') - - this%m_livestemn_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_TO_LITTER_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N fire mortality to litter', & - ptr_patch=this%m_livestemn_to_litter_fire_patch, default='active') - - this%m_livestemn_to_deadstemn_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_TO_DEADSTEMN_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N fire mortality to dead stem N', & - ptr_patch=this%m_livestemn_to_deadstemn_fire_patch, default='active') -! end WW additions - + this%m_leafn_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LEAFN_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='leaf N mortality', & @@ -603,7 +581,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='live stem N storage mortality', & - ptr_patch=this%m_livestemn_storage_to_litter_patch, default='active') + ptr_patch=this%m_livestemn_storage_to_litter_patch, default='inactive') this%m_deadstemn_storage_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & @@ -633,7 +611,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_xfer_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='live stem N transfer mortality', & - ptr_patch=this%m_livestemn_xfer_to_litter_patch, default='active') + ptr_patch=this%m_livestemn_xfer_to_litter_patch, default='inactive') this%m_deadstemn_xfer_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_LITTER', units='gN/m^2/s', & @@ -653,7 +631,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='live stem N mortality', & - ptr_patch=this%m_livestemn_to_litter_patch, default='active') + ptr_patch=this%m_livestemn_to_litter_patch, default='inactive') this%m_deadstemn_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_TO_LITTER', units='gN/m^2/s', & @@ -698,7 +676,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_storage_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & avgflag='A', long_name='live stem N storage fire loss', & - ptr_patch=this%m_livestemn_storage_to_fire_patch, default='active') + ptr_patch=this%m_livestemn_storage_to_fire_patch, default='inactive') this%m_deadstemn_storage_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & @@ -728,7 +706,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_xfer_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_FIRE', units='gN/m^2/s', & avgflag='A', long_name='live stem N transfer fire loss', & - ptr_patch=this%m_livestemn_xfer_to_fire_patch, default='active') + ptr_patch=this%m_livestemn_xfer_to_fire_patch, default='inactive') this%m_deadstemn_xfer_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_FIRE', units='gN/m^2/s', & @@ -748,7 +726,7 @@ subroutine InitHistory(this, bounds) this%m_livestemn_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_LIVESTEMN_TO_FIRE', units='gN/m^2/s', & avgflag='A', long_name='live stem N fire loss', & - ptr_patch=this%m_livestemn_to_fire_patch, default='active') + ptr_patch=this%m_livestemn_to_fire_patch, default='inactive') this%m_deadstemn_to_fire_patch(begp:endp) = spval call hist_addfld1d (fname='M_DEADSTEMN_TO_FIRE', units='gN/m^2/s', & @@ -783,7 +761,7 @@ subroutine InitHistory(this, bounds) this%leafn_xfer_to_leafn_patch(begp:endp) = spval call hist_addfld1d (fname='LEAFN_XFER_TO_LEAFN', units='gN/m^2/s', & avgflag='A', long_name='leaf N growth from storage', & - ptr_patch=this%leafn_xfer_to_leafn_patch, default='active') + ptr_patch=this%leafn_xfer_to_leafn_patch, default='inactive') this%frootn_xfer_to_frootn_patch(begp:endp) = spval call hist_addfld1d (fname='FROOTN_XFER_TO_FROOTN', units='gN/m^2/s', & @@ -793,7 +771,7 @@ subroutine InitHistory(this, bounds) this%livestemn_xfer_to_livestemn_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMN_XFER_TO_LIVESTEMN', units='gN/m^2/s', & avgflag='A', long_name='live stem N growth from storage', & - ptr_patch=this%livestemn_xfer_to_livestemn_patch, default='active') + ptr_patch=this%livestemn_xfer_to_livestemn_patch, default='inactive') this%deadstemn_xfer_to_deadstemn_patch(begp:endp) = spval call hist_addfld1d (fname='DEADSTEMN_XFER_TO_DEADSTEMN', units='gN/m^2/s', & @@ -818,12 +796,12 @@ subroutine InitHistory(this, bounds) this%leafn_to_retransn_patch(begp:endp) = spval call hist_addfld1d (fname='LEAFN_TO_RETRANSN', units='gN/m^2/s', & avgflag='A', long_name='leaf N to retranslocated N pool', & - ptr_patch=this%leafn_to_retransn_patch, default='active') + ptr_patch=this%leafn_to_retransn_patch, default='inactive') this%frootn_to_litter_patch(begp:endp) = spval call hist_addfld1d (fname='FROOTN_TO_LITTER', units='gN/m^2/s', & avgflag='A', long_name='fine root N litterfall', & - ptr_patch=this%frootn_to_litter_patch, default='active') + ptr_patch=this%frootn_to_litter_patch, default='inactive') this%retransn_to_npool_patch(begp:endp) = spval call hist_addfld1d (fname='RETRANSN_TO_NPOOL', units='gN/m^2/s', & @@ -863,22 +841,22 @@ subroutine InitHistory(this, bounds) this%npool_to_livestemn_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN', units='gN/m^2/s', & avgflag='A', long_name='allocation to live stem N', & - ptr_patch=this%npool_to_livestemn_patch, default='active') + ptr_patch=this%npool_to_livestemn_patch, default='inactive') this%npool_to_livestemn_storage_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN_STORAGE', units='gN/m^2/s', & avgflag='A', long_name='allocation to live stem N storage', & - ptr_patch=this%npool_to_livestemn_storage_patch, default='active') + ptr_patch=this%npool_to_livestemn_storage_patch, default='inactive') this%npool_to_deadstemn_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN', units='gN/m^2/s', & avgflag='A', long_name='allocation to dead stem N', & - ptr_patch=this%npool_to_deadstemn_patch, default='active') + ptr_patch=this%npool_to_deadstemn_patch, default='inactive') this%npool_to_deadstemn_storage_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN_STORAGE', units='gN/m^2/s', & avgflag='A', long_name='allocation to dead stem N storage', & - ptr_patch=this%npool_to_deadstemn_storage_patch, default='active') + ptr_patch=this%npool_to_deadstemn_storage_patch, default='inactive') this%npool_to_livecrootn_patch(begp:endp) = spval call hist_addfld1d (fname='NPOOL_TO_LIVECROOTN', units='gN/m^2/s', & @@ -913,7 +891,7 @@ subroutine InitHistory(this, bounds) this%livestemn_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & avgflag='A', long_name='live stem N shift storage to transfer', & - ptr_patch=this%livestemn_storage_to_xfer_patch, default='active') + ptr_patch=this%livestemn_storage_to_xfer_patch, default='inactive') this%deadstemn_storage_to_xfer_patch(begp:endp) = spval call hist_addfld1d (fname='DEADSTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & @@ -933,12 +911,12 @@ subroutine InitHistory(this, bounds) this%livestemn_to_deadstemn_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMN_TO_DEADSTEMN', units='gN/m^2/s', & avgflag='A', long_name='live stem N turnover', & - ptr_patch=this%livestemn_to_deadstemn_patch, default='active') + ptr_patch=this%livestemn_to_deadstemn_patch, default='inactive') this%livestemn_to_retransn_patch(begp:endp) = spval call hist_addfld1d (fname='LIVESTEMN_TO_RETRANSN', units='gN/m^2/s', & avgflag='A', long_name='live stem N to retranslocated N pool', & - ptr_patch=this%livestemn_to_retransn_patch, default='active') + ptr_patch=this%livestemn_to_retransn_patch, default='inactive') this%livecrootn_to_deadcrootn_patch(begp:endp) = spval call hist_addfld1d (fname='LIVECROOTN_TO_DEADCROOTN', units='gN/m^2/s', & @@ -972,7 +950,7 @@ subroutine InitHistory(this, bounds) ptr_patch=this%fert_patch) end if - if (use_crop) then + if (use_crop .and. .not. use_fun) then this%soyfixn_patch(begp:endp) = spval call hist_addfld1d (fname='SOYFIXN', units='gN/m^2/s', & avgflag='A', long_name='soybean fixation', & @@ -1424,11 +1402,6 @@ subroutine Restart (this, bounds, ncid, flag ) long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%avail_retransn_patch) - call restartvar(ncid=ncid, flag=flag, varname='plant_nalloc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plant_nalloc_patch) - if ( use_fun ) then ! set_missing_vals_to_constant for BACKWARDS_COMPATIBILITY(wrw, 2018-06-28) re. issue #426 ! special land units previously set to spval, not 0 @@ -1548,12 +1521,6 @@ subroutine Restart (this, bounds, ncid, flag ) long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%Nuptake_patch) call set_missing_vals_to_constant(this%Nuptake_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='sminn_to_plant_fun', xtype=ncd_double, & - dim1name='pft', & - long_name='Total soil N uptake of FUN', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%sminn_to_plant_fun_patch) - call set_missing_vals_to_constant(this%sminn_to_plant_fun_patch, 0._r8) end if ! End BACKWARDS_COMPATIBILITY(wrw, 2018-06-28) re. issue #426 From 1dd0850cd92fe4820591858195df87e65a288145 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 30 Jun 2020 10:58:20 -0700 Subject: [PATCH 1114/1973] fix missing biogeog setting --- src/utils/clmfates_interfaceMod.F90 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 112b5424c3..6601d00001 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -238,7 +238,8 @@ subroutine CLMFatesGlobals() integer :: pass_inventory_init integer :: pass_is_restart integer :: pass_cohort_age_tracking - + integer :: pass_biogeog + if (use_fates) then verbose_output = .false. @@ -281,6 +282,13 @@ subroutine CLMFatesGlobals() end if call set_fates_ctrlparms('use_spitfire',ival=pass_spitfire) + if(use_fates_fixed_biogeog)then + pass_biogeog = 1 + else + pass_biogeog = 0 + end if + call set_fates_ctrlparms('use_fixed_biogeog',ival=pass_biogeog) + if(use_fates_ed_st3) then pass_ed_st3 = 1 else From cd835cb69fa375466b466da0f7e4466928e38a56 Mon Sep 17 00:00:00 2001 From: wwieder Date: Tue, 30 Jun 2020 12:04:22 -0600 Subject: [PATCH 1115/1973] Reverts changes used for testing purposes --- .../NutrientCompetitionFlexibleCNMod.F90 | 99 +++---------------- 1 file changed, 16 insertions(+), 83 deletions(-) diff --git a/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 b/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 index 81e33315c0..b69c666ea4 100644 --- a/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 +++ b/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 @@ -18,7 +18,6 @@ module NutrientCompetitionFlexibleCNMod ! ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use LandunitType , only : lun use ColumnType , only : col @@ -37,10 +36,6 @@ module NutrientCompetitionFlexibleCNMod private real(r8), pointer :: actual_leafcn(:) ! leaf CN ratio used by flexible CN real(r8), pointer :: actual_storage_leafcn(:) ! storage leaf CN ratio used by flexible CN - real(r8), pointer :: actual_livestemcn(:) ! live wood CN ratio used by flexible CN - real(r8), pointer :: actual_livestemcn_storage(:) ! storage live wood CN ratio used by flexible CN - real(r8), pointer :: npool_to_livestemn(:) ! npool to live stem n - real(r8), pointer :: npool_to_livestemn_storage(:) ! npool to live stem storage n contains ! public methocs procedure, public :: Init ! Initialization @@ -102,10 +97,6 @@ subroutine InitAllocate(this, bounds) allocate(this%actual_leafcn(bounds%begp:bounds%endp)) ; this%actual_leafcn(:) = nan allocate(this%actual_storage_leafcn(bounds%begp:bounds%endp)) ; this%actual_storage_leafcn(:) = nan - allocate(this%actual_livestemcn(bounds%begp:bounds%endp)) ; this%actual_livestemcn(:) = nan - allocate(this%actual_livestemcn_storage(bounds%begp:bounds%endp)) ; this%actual_livestemcn_storage(:) = nan - allocate(this%npool_to_livestemn(bounds%begp:bounds%endp)) ; this%npool_to_livestemn(:) = nan - allocate(this%npool_to_livestemn_storage(bounds%begp:bounds%endp)) ; this%npool_to_livestemn_storage(:) = nan end subroutine InitAllocate @@ -136,25 +127,7 @@ subroutine InitHistory(this, bounds) this%actual_storage_leafcn(begp:endp) = spval call hist_addfld1d (fname='LEAFCN_STORAGE', units='gC/gN', & avgflag='A', long_name='Storage Leaf CN ratio used for flexible CN', & - ptr_patch=this%actual_storage_leafcn, default='active') - - this%actual_livestemcn(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMCN', units='gC/gN', & - avgflag='A', long_name='Live wood CN ratio used for flexible CN', & - ptr_patch=this%actual_livestemcn ) - this%actual_livestemcn_storage(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMCN_STORAGE', units='gC/gN', & - avgflag='A', long_name='Storage Live wood CN ratio used for flexible CN', & - ptr_patch=this%actual_livestemcn_storage, default='active') - - this%npool_to_livestemn(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVESTEM', units='gN m^-1 s^-1', & - avgflag='A', long_name='NPOOL to live stem N', & - ptr_patch=this%npool_to_livestemn ) - this%npool_to_livestemn_storage(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVESTEM_STORAGE', units='gN m^-1 s^-1', & - avgflag='A', long_name='NPOOL to live stem N storage', & - ptr_patch=this%npool_to_livestemn_storage ) + ptr_patch=this%actual_storage_leafcn, default='inactive') end subroutine InitHistory @@ -222,7 +195,7 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & use clm_varctl , only : downreg_opt use clm_varctl , only : CN_residual_opt use clm_varctl , only : CN_partition_opt - use clm_time_manager , only : get_step_size + use clm_time_manager , only : get_step_size_real use CNVegStateType , only : cnveg_state_type use CropType , only : crop_type use CanopyStateType , only : canopystate_type @@ -324,11 +297,11 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & ! ----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(aroot) == (/bounds%endp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(arepr) == (/bounds%endp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fpg_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(this%actual_storage_leafcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((lbound(this%actual_storage_leafcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL_FL((ubound(aroot) == (/bounds%endp/)) , sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(arepr) == (/bounds%endp/)) , sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fpg_col) == (/bounds%endc/)) , sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(this%actual_storage_leafcn) >= (/bounds%endp/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((lbound(this%actual_storage_leafcn) <= (/bounds%begp/)), sourcefile, __LINE__) associate( & fpg => fpg_col , & ! Input: [real(r8) (:) ] fraction of potential gpp (no units) @@ -427,7 +400,7 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & ) ! set time steps - dt = real( get_step_size(), r8 ) + dt = get_step_size_real() ! patch loop to distribute the available N between the competing patches ! on the basis of relative demand, and allocate C and N to new growth and storage @@ -793,9 +766,6 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (downreg_opt .eqv. .false. .AND. CN_partition_opt == 1) then - ! WW this is where demand could also be modified based on actual leaf and live wood C:N - ! allocation from npool to storage would also have to be modified? - ! computing nitrogen demand for different pools based on carbon allocated and CN ratio npool_to_leafn_demand(p) = (nlc / cnl) * fcur npool_to_leafn_storage_demand(p) = (nlc / cnl) * (1._r8 - fcur) @@ -973,9 +943,7 @@ subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & / cnveg_nitrogenstate_inst%leafn_storage_patch(p) end if end if - - !! WW none of this is done in CLM5 w/ FUN because carbon_resp_opt = 0 by default !! - !! WW remove this redundant code? + if (carbon_resp_opt == 1 .AND. laisun(p)+laisha(p) > 0.0_r8) then ! computing carbon to nitrogen ratio of different plant parts @@ -1224,7 +1192,7 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & use clm_varctl , only : use_c13, use_c14 use clm_varctl , only : nscalar_opt, plant_ndemand_opt, substrate_term_opt, temp_scalar_opt use clm_varpar , only : nlevdecomp - use clm_time_manager , only : get_step_size + use clm_time_manager , only : get_step_size_real use CanopyStateType , only : canopystate_type use PhotosynthesisMod , only : photosyns_type use CropType , only : crop_type @@ -1288,16 +1256,10 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & ! ----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(aroot) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(arepr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(this%actual_leafcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((lbound(this%actual_leafcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(this%actual_storage_leafcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((lbound(this%actual_storage_leafcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(this%actual_livestemcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((lbound(this%actual_livestemcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(this%actual_livestemcn_storage) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((lbound(this%actual_livestemcn_storage) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL_FL((ubound(aroot) == (/bounds%endp/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(arepr) == (/bounds%endp/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(this%actual_leafcn) >= (/bounds%endp/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((lbound(this%actual_leafcn) <= (/bounds%begp/)), sourcefile, __LINE__) associate( & ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type @@ -1360,10 +1322,8 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & xsmrpool => cnveg_carbonstate_inst%xsmrpool_patch , & ! Input: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N @@ -1391,7 +1351,6 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & cpool_to_xsmrpool => cnveg_carbonflux_inst%cpool_to_xsmrpool_patch , & ! Output: [real(r8) (:) ] leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Output: [real(r8) (:) ] N flux required to support initial GPP (gN/m2/s) avail_retransn => cnveg_nitrogenflux_inst%avail_retransn_patch , & ! Output: [real(r8) (:) ] N flux available from retranslocation pool (gN/m2/s) retransn_to_npool => cnveg_nitrogenflux_inst%retransn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of retranslocated N (gN/m2/s) @@ -1400,7 +1359,6 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & frootn_to_retransn => cnveg_nitrogenflux_inst%frootn_to_retransn_patch , & ! Output: [real(r8) (:) ] livestemn_to_retransn => cnveg_nitrogenflux_inst%livestemn_to_retransn_patch,& ! Output: [real(r8) (:) ] livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) livestem N - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) livestem N frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral N btran => energyflux_inst%btran_patch , & ! Input: [real(r8) (:) ] transpiration wetness factor (0 to 1) @@ -1409,7 +1367,7 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & ) ! set time steps - dt = real( get_step_size(), r8 ) + dt = get_step_size_real() ! set number of days to recover negative cpool dayscrecover = params_inst%dayscrecover ! loop over patches to assess the total plant N demand @@ -1694,32 +1652,7 @@ subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & ! leaf CN ratio this%actual_leafcn(p) = leafc(p) / leafn(p) end if - ! WW added here to simplify diagnostics - if (leafn_storage(p) < n_min ) then - this%actual_storage_leafcn(p) = spval - else - this%actual_storage_leafcn(p) = leafc_storage(p) / leafn_storage(p) - end if - - - ! when we have "if (livestemn(p) == 0.0_r8)" below then we - ! have floating overflow (out of floating point range) - ! error in "actual_livestemcn(p) = livestemc(p) / livestemn(p)" - if (woody(ivt(p)) == 1.0_r8) then - if (livestemn(p) < n_min ) then - ! to avoid division by zero, and to set livestemcn to missing value for history files - this%actual_livestemcn(p) = spval - else - ! livestem CN ratio - this%actual_livestemcn(p) = livestemc(p) / livestemn(p) - end if - - if (livestemn_storage(p) < n_min ) then - this%actual_livestemcn_storage(p) = spval - else - this%actual_livestemcn_storage(p) = livestemc(p) / livestemn_storage(p) - end if - end if + if (nscalar_opt) then From 10c6a26c092f693b45648f5f6368a606c8767296 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 30 Jun 2020 16:52:41 -0600 Subject: [PATCH 1116/1973] Work on LILACSMOKE test Steps up through running make_runtime_inputs are working Note that I needed to replace tabs with spaces in a few template files --- cime_config/SystemTests/lilacsmoke.py | 98 ++++++++++++++++++- lilac/bld_templates/atm_driver_in | 22 ++--- .../config_machines_template.xml | 18 ++-- lilac/bld_templates/ctsm_template.cfg | 4 +- 4 files changed, 119 insertions(+), 23 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index 1dce6bb175..0fabc838df 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -6,9 +6,10 @@ """ import os +import shutil from CIME.SystemTests.system_tests_common import SystemTestsCommon -from CIME.utils import run_cmd_no_fail, append_testlog +from CIME.utils import run_cmd_no_fail, append_testlog, symlink_force from CIME.build import post_build from CIME.test_status import GENERATE_PHASE, BASELINE_PHASE, TEST_PASS_STATUS from CIME.XML.standard_module_setup import * @@ -58,11 +59,106 @@ def build_phase(self, sharedlib_only=False, model_only=False): build_dir=build_dir) self._run_build_cmd(cmd, exeroot, 'rebuild_ctsm.bldlog') + self._build_atm_driver() + + self._create_runtime_inputs() + # Setting logs=[] implies that we don't bother gzipping any of the build log # files; that seems fine for these purposes (and it keeps the above code # simpler). post_build(self._case, logs=[], build_complete=True) + def _build_atm_driver(self): + caseroot = self._case.get_value('CASEROOT') + lndroot = self._case.get_value('COMP_ROOT_DIR_LND') + blddir = os.path.join(caseroot, 'lilac_atm_driver', 'bld') + + if not os.path.exists(blddir): + os.makedirs(blddir) + symlink_force(os.path.join(lndroot, 'lilac', 'atm_driver', 'Makefile'), + os.path.join(blddir, 'Makefile')) + symlink_force(os.path.join(lndroot, 'lilac', 'atm_driver', 'atm_driver.F90'), + os.path.join(blddir, 'atm_driver.F90')) + symlink_force(os.path.join(caseroot, 'Macros.make'), + os.path.join(blddir, 'Macros.make')) + + makevars = 'COMPILER={compiler} DEBUG={debug} CTSM_MKFILE={ctsm_mkfile}'.format( + compiler=self._case.get_value('COMPILER'), + debug=str(self._case.get_value('DEBUG')).upper(), + ctsm_mkfile=os.path.join(caseroot, 'lilac_build', 'ctsm.mk')) + makecmd = 'make {makevars} atm_driver'.format(makevars=makevars) + self._run_build_cmd(makecmd, blddir, 'atm_driver.bldlog') + + def _create_runtime_inputs(self): + caseroot = self._case.get_value('CASEROOT') + lnd_domain_file = os.path.join(self._case.get_value('LND_DOMAIN_PATH'), + self._case.get_value('LND_DOMAIN_FILE')) + + # Cheat a bit here: Get the fsurdat file from the already-generated lnd_in file in + # the host test case - i.e., from the standard cime-based preview_namelists. But + # this isn't really a morally-objectionable cheat, because in the real workflow, + # we expect the user to identify fsurdat manually; in this testing situation, we + # need to come up with some way to replace this manual identification, so cheating + # feels acceptable. + self._case.create_namelists(component='lnd') + fsurdat = self._extract_var_from_namelist( + nl_filename=os.path.join(caseroot, 'CaseDocs', 'lnd_in'), + varname='fsurdat') + + self._fill_in_ctsm_cfg(lnd_domain_file=lnd_domain_file, + fsurdat=fsurdat) + + self._run_build_cmd('make_runtime_inputs --rundir {}'.format(self._runtime_inputs_dir()), + self._runtime_inputs_dir(), + 'make_runtime_inputs.log') + + def _extract_var_from_namelist(self, nl_filename, varname): + """Tries to find a variable named varname in the given file; returns its value + + If not found, aborts + """ + with open(nl_filename) as nl_file: + for line in nl_file: + match = re.search(r'^ *{} *= *[\'"]([^\'"]+)'.format(varname), line) + if match: + return match.group(1) + expect(False, '{} not found in {}'.format(varname, nl_filename)) + + def _fill_in_ctsm_cfg(self, lnd_domain_file, fsurdat): + caseroot = self._case.get_value('CASEROOT') + runtime_inputs = self._runtime_inputs_dir() + if not os.path.exists(os.path.join(runtime_inputs, 'ctsm.cfg.orig')): + shutil.copyfile(src=os.path.join(runtime_inputs, 'ctsm.cfg'), + dst=os.path.join(runtime_inputs, 'ctsm.cfg.orig')) + os.remove(os.path.join(runtime_inputs, 'ctsm.cfg')) + + with open(os.path.join(runtime_inputs, 'ctsm.cfg.orig')) as ctsm_cfg_orig: + with open(os.path.join(runtime_inputs, 'ctsm.cfg'), 'w') as ctsm_cfg: + for line_orig in ctsm_cfg_orig: + line = line_orig + line = self._fill_in_variable(line=line, + varname='lnd_domain_file', + value=lnd_domain_file) + line = self._fill_in_variable(line=line, + varname='fsurdat', + value=fsurdat) + ctsm_cfg.write(line) + + def _fill_in_variable(self, line, varname, value): + """Fill in a FILL_THIS_IN variable in a config or namelist file + + Returns the line with FILL_THIS_IN replaced with the given value if this line is + for varname; otherwise returns line unchanged. + """ + if re.search(r'^ *{} *='.format(varname), line): + newline = line.replace('FILL_THIS_IN', value) + else: + newline = line + return newline + + def _runtime_inputs_dir(self): + return os.path.join(self._case.get_value('CASEROOT'), 'lilac_build', 'runtime_inputs') + def run_phase(self): # FIXME(wjs, 2020-06-10) Fill this in pass diff --git a/lilac/bld_templates/atm_driver_in b/lilac/bld_templates/atm_driver_in index de8b9a6bd3..5289d930a9 100644 --- a/lilac/bld_templates/atm_driver_in +++ b/lilac/bld_templates/atm_driver_in @@ -1,18 +1,18 @@ &atm_driver_input caseid = 'test_lilac' - atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' + atm_mesh_file = '/glade/p/cesmdata/cseg/inputdata/share/meshes/fv4x5_050615_polemod_ESMFmesh.nc' atm_global_nx = 72 atm_global_ny = 46 - atm_timestep = 1800 - atm_calendar = 'NOLEAP' - atm_start_year = 2000 - atm_stop_year = 2000 - atm_start_mon = 1 - atm_stop_mon = 1 - atm_start_secs = 0 - atm_stop_secs = 0 - atm_start_day = 1 - atm_stop_day = 3 + atm_timestep = 1800 + atm_calendar = 'NOLEAP' + atm_start_year = 2000 + atm_stop_year = 2000 + atm_start_mon = 1 + atm_stop_mon = 1 + atm_start_secs = 0 + atm_stop_secs = 0 + atm_start_day = 1 + atm_stop_day = 3 atm_starttype = 'startup' atm_ndays_all_segs = 2 / diff --git a/lilac/bld_templates/config_machines_template.xml b/lilac/bld_templates/config_machines_template.xml index 29e2bf79f2..a197e02dfa 100644 --- a/lilac/bld_templates/config_machines_template.xml +++ b/lilac/bld_templates/config_machines_template.xml @@ -18,14 +18,14 @@ Temporary build information for a CTSM build + compiled programs as -DVALUE recognized are LINUX, AIX, Darwin, CNL --> $OS $COMPILER + the case/bld and case/run directories are written below here --> $CIME_OUTPUT_ROOT + inputdata is downloaded automatically on a case by case basis as + long as the user has write access to this directory. --> $$CIME_OUTPUT_ROOT/inputdata + forcing data --> $$CIME_OUTPUT_ROOT/inputdata @@ -99,8 +99,8 @@ 379.0 +336.6 +340.6 379.0 388.8 397.5 @@ -503,13 +505,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). --> -75 +61 -1850,2000,2010 +1850,1982,2000,2010 .true. +.true. .true. .true. .true. @@ -580,6 +583,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=ne0np4.ARCTIC.ne30x4 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + + +hgrid=ne120np4.pg3 maxpft=79 mask=tx0.1v3 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc + +/glade/work/aherring/grids/var-res/ne0np4.ARCTIC.ne30x4/inic/FHIST_ARCTIC_ne30x4_mt12_1979bc-mg3.clm2.r.1982-01-01-00000_c200424.nc + + + +/glade/work/aherring/grids/uniform-res/ne120np4.pg3/inic/F2000climoBgcCrop_ne120pg3_ne120pg3_mt13_7680pes.clm2.r.06-01-00000_c200506.nc + + lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850-2015_c191023.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 1922748956..87bdc98c60 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1990,7 +1990,7 @@ If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) +"PtVg,1000,850,1100,1350,1600,1850,1855,1865,1875,1885,1895,1905,1915,1925,1935,1945,1955,1965,1975,1979,1980,1982,1985,1995,2000,2005,2010,2015,2025,2035,2045,2055,2065,2075,2085,2095,2105"> Year to simulate and to provide datasets for (such as surface datasets, initial conditions, aerosol-deposition, Nitrogen deposition rates etc.) A sim_year of 1000 corresponds to data used for testing only, NOT corresponding to any real datasets. A sim_year greater than 2015 corresponds to ssp_rcp scenario data @@ -2028,8 +2028,8 @@ Attributes to use when looking for an initial condition file (finidat) if interp How close in years to use when looking for an initial condition file (finidat) if interpolation is turned on (use_init_interp is .true.) - + Simulation years you can look for in initial condition files (finidat) if interpolation is turned on (use_init_interp is .true.) From e3f0d5acd1de6d859888cf4cb3fd8992b6b1d109 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 1 Jul 2020 13:19:38 -0600 Subject: [PATCH 1128/1973] Increase number of tests because of increase in number of grids --- bld/unit_testers/build-namelist_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index c833f44d3d..ce7fb1621d 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 842; +my $ntests = 870; if ( defined($opts{'compare'}) ) { - $ntests += 510; + $ntests += 531; } plan( tests=>$ntests ); From 8e8d557327aa5b0d943174669ba49571a4cd3fcd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 1 Jul 2020 14:26:11 -0600 Subject: [PATCH 1129/1973] atm_driver Makefile: add LDFLAGS This is needed when building with a user-defined machine on my mac --- lilac/atm_driver/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/atm_driver/Makefile b/lilac/atm_driver/Makefile index a3a594189b..8a50eedb0b 100644 --- a/lilac/atm_driver/Makefile +++ b/lilac/atm_driver/Makefile @@ -29,7 +29,7 @@ atm_driver.o : $(CURDIR)/atm_driver.F90 $(MPIFC) -c $(CTSM_INCLUDES) $(FFLAGS) $< atm_driver: atm_driver.o - $(MPIFC) -o $@ $^ $(CTSM_LIBS) + $(MPIFC) -o $@ $^ $(LDFLAGS) $(CTSM_LIBS) mv atm_driver atm_driver.exe # module dependencies: From a5f0f1cb78992801d626b2e6b5c6b043523c4e67 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 1 Jul 2020 16:48:03 -0600 Subject: [PATCH 1130/1973] Add documentation on lilac restarts --- .../obtaining-building-and-running/index.rst | 1 + .../restarting.rst | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 doc/source/lilac/obtaining-building-and-running/restarting.rst diff --git a/doc/source/lilac/obtaining-building-and-running/index.rst b/doc/source/lilac/obtaining-building-and-running/index.rst index 7f18c180f7..14dc6f40be 100644 --- a/doc/source/lilac/obtaining-building-and-running/index.rst +++ b/doc/source/lilac/obtaining-building-and-running/index.rst @@ -9,3 +9,4 @@ obtaining-and-building-ctsm.rst setting-ctsm-runtime-options.rst + restarting.rst diff --git a/doc/source/lilac/obtaining-building-and-running/restarting.rst b/doc/source/lilac/obtaining-building-and-running/restarting.rst new file mode 100644 index 0000000000..e5e6c4ae1b --- /dev/null +++ b/doc/source/lilac/obtaining-building-and-running/restarting.rst @@ -0,0 +1,30 @@ +.. highlight:: shell + +.. _restarting: + +===================================== + Continuing a run from restart files +===================================== + +All of the information that CTSM and LILAC need to continue a run from restart files is +given in the restart files themselves. No namelist changes need to be made (other than +whatever is needed in the host atmosphere model), but the ``starttype_in`` argument to the +``lilac_init2`` subroutine call from the atmosphere model will need to be changed to +"continue" rather than "startup". + +CTSM and LILAC use ``rpointer`` files to indicate the specific restart files that should +be read. These files, ``rpointer.lnd`` and ``rpointer.lilac``, are one-line text files +that simply specify the name of the respective restart files. When restart files are +written (according to the ``write_restarts_now`` argument to the ``lilac_run`` +subroutine), these ``rpointer`` files are updated to point to the latest set of restarts. + +If you want to restart from the latest set of restart files, the ``rpointer`` files should +already be set up to facilitate this. However, if you want to restart from an earlier set +of restarts, you can simply edit ``rpointer.lnd`` and ``rpointer.lilac`` to point to the +appropriate restart files. + +.. important:: + + Be sure that the ``rpointer.lnd`` and ``rpointer.lilac`` files point to restart files + from the same time as each other, and from the same time as the atmosphere model's + restart time. From 4cf744e769f739ed41b53ce9d81991c31a0a7caa Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 1 Jul 2020 17:44:31 -0600 Subject: [PATCH 1131/1973] Point back to a master tag of mosart I'm not ready to bring the mosart branch in, and it's not needed yet because we're not yet running LILAC with MOSART. I have opened a PR for it to bring in later: https://github.com/ESCOMP/MOSART/pull/32 --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 70a5819f5c..43e4b64988 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -23,7 +23,7 @@ required = True local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/MOSART -hash = a108912c6b2fb2294abbfb720ad151cde76f9845 +tag = mosart1_0_36 required = True [cime] From a1b038683c0c0038a03372c81c4a2ca62c04bfd9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 2 Jul 2020 12:08:59 -0600 Subject: [PATCH 1132/1973] Use a stub rof rather than mosart with lilac This change is important in the short-term, at least, because I'm not ready to bring the mosart lilac_cap branch to master, so we're pointing to a version of mosart that doesn't have the necessary changes - see https://github.com/ESCOMP/MOSART/pull/32. Once those MOSART changes are on MOSART's master branch, then we should change buildlib back to using the MOSART source code rather than stub rof. We may want to do this conditionally, depending on whether rof coupling is actually wanted in the given run. (I at first thought that we could let the cime build build mosart for us, but then realized that the current mechanism is needed because lilac depends on the mosart code; also, mosart is not built during the --sharedlib build phase.) Note: I have NOT given careful thought to the changes in lilac_mod.F90: It seems right to put this rof-related code inside a conditional, but I haven't done a careful analysis to determine if that's correct. --- cime_config/buildlib | 6 +-- lilac/src/lilac_mod.F90 | 90 ++++++++++++++++++-------------- lilac/stub_rof/rof_comp_esmf.F90 | 30 +++++++++++ 3 files changed, 83 insertions(+), 43 deletions(-) create mode 100644 lilac/stub_rof/rof_comp_esmf.F90 diff --git a/cime_config/buildlib b/cime_config/buildlib index 569ef99914..9e87bad732 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -123,9 +123,9 @@ def _main_func(): if lilac_mode == 'on': paths.append(os.path.join(lnd_root,"lilac","src")) - mosart_src = os.path.join(lnd_root,"components","mosart","src") - paths.append(os.path.join(mosart_src,"riverroute")) - paths.append(os.path.join(mosart_src,"cpl","lilac")) + # If we want to build with a real river model (e.g., MOSART), we'll need + # to use its directories in place of stub_rof + paths.append(os.path.join(lnd_root,"lilac","stub_rof")) with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index 1900e1281b..b233896424 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -245,12 +245,14 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & write(logunit,*) trim(subname) // " ctsm gridded component created" end if - cname = " MOSART " - rof_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac mosart initialization') - call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) - if (mytask == 0) then - write(logunit,*) trim(subname) // " mosart gridded component created" + if (couple_to_river) then + cname = " MOSART " + rof_gcomp = ESMF_GridCompCreate(name=cname, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac mosart initialization') + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + write(logunit,*) trim(subname) // " mosart gridded component created" + end if end if cname = "Coupler from atmosphere to land" @@ -269,20 +271,22 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & write(logunit,*) trim(subname) // " coupler component (land to atmosphere) created" end if - cname = "Coupler from river to land" - cpl_rof2lnd_comp = ESMF_CplCompCreate(name=cname, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_r2l initialization') - call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) - if (mytask == 0) then - write(logunit,*) trim(subname) // " coupler component (atmosphere to land) created" - end if + if (couple_to_river) then + cname = "Coupler from river to land" + cpl_rof2lnd_comp = ESMF_CplCompCreate(name=cname, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_r2l initialization') + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + write(logunit,*) trim(subname) // " coupler component (river to land) created" + end if - cname = "Coupler from land to river" - cpl_lnd2rof_comp = ESMF_CplCompCreate(name=cname, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_l2r initialization') - call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) - if (mytask == 0) then - write(logunit,*) trim(subname) // " coupler component (land to atmosphere) created" + cname = "Coupler from land to river" + cpl_lnd2rof_comp = ESMF_CplCompCreate(name=cname, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('error lilac cpl_l2r initialization') + call ESMF_LogWrite(subname//"Created "//trim(cname)//" component", ESMF_LOGMSG_INFO) + if (mytask == 0) then + write(logunit,*) trim(subname) // " coupler component (land to river) created" + end if end if !------------------------------------------------------------------------- @@ -307,13 +311,15 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & write(logunit,*) trim(subname) // " CTSM setservices finished" end if - ! Register section -- set services -- mosart - call ESMF_GridCompSetServices(rof_gcomp, userRoutine=rof_register, userRc=user_rc, rc=rc) - if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') - call ESMF_LogWrite(subname//"MOSART SetServices finished!", ESMF_LOGMSG_INFO) - if (mytask == 0) then - write(logunit,*) trim(subname) // " CTSM setservices finished" + if (couple_to_river) then + ! Register section -- set services -- mosart + call ESMF_GridCompSetServices(rof_gcomp, userRoutine=rof_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('rof_gcomp register failure') + call ESMF_LogWrite(subname//"MOSART SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + write(logunit,*) trim(subname) // " CTSM setservices finished" + end if end if ! Register section -- set services -- coupler atmosphere to land @@ -325,13 +331,15 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & write(logunit,*) trim(subname) // " coupler from atmosphere to land setservices finished" end if - ! Register section -- set services -- river to land - call ESMF_CplCompSetServices(cpl_rof2lnd_comp, userRoutine=cpl_rof2lnd_register, userRc=user_rc, rc=rc) - if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') - call ESMF_LogWrite(subname//"Coupler from river to land SetServices finished!", ESMF_LOGMSG_INFO) - if (mytask == 0) then - write(logunit,*) trim(subname) // " coupler from river to land setservices finished" + if (couple_to_river) then + ! Register section -- set services -- river to land + call ESMF_CplCompSetServices(cpl_rof2lnd_comp, userRoutine=cpl_rof2lnd_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_rof2lnd_comp register failure') + call ESMF_LogWrite(subname//"Coupler from river to land SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + write(logunit,*) trim(subname) // " coupler from river to land setservices finished" + end if end if ! Register section -- set services -- coupler land to atmosphere @@ -343,13 +351,15 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & write(logunit,*) trim(subname) // " coupler from land to atmosphere setservices finished" end if - ! Register section -- set services -- coupler land to river - call ESMF_CplCompSetServices(cpl_lnd2rof_comp, userRoutine=cpl_lnd2rof_register, userRc=user_rc, rc=rc) - if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') - if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') - call ESMF_LogWrite(subname//"Coupler from land to river SetServices finished!", ESMF_LOGMSG_INFO) - if (mytask == 0) then - write(logunit,*) trim(subname) // " coupler from land to river setservices finished" + if (couple_to_river) then + ! Register section -- set services -- coupler land to river + call ESMF_CplCompSetServices(cpl_lnd2rof_comp, userRoutine=cpl_lnd2rof_register, userRc=user_rc, rc=rc) + if (chkerr(user_rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') + if (chkerr(rc,__LINE__,u_FILE_u)) call shr_sys_abort('cpl_lnd2rof_comp register failure') + call ESMF_LogWrite(subname//"Coupler from land to river SetServices finished!", ESMF_LOGMSG_INFO) + if (mytask == 0) then + write(logunit,*) trim(subname) // " coupler from land to river setservices finished" + end if end if !------------------------------------------------------------------------- diff --git a/lilac/stub_rof/rof_comp_esmf.F90 b/lilac/stub_rof/rof_comp_esmf.F90 new file mode 100644 index 0000000000..d708818e0d --- /dev/null +++ b/lilac/stub_rof/rof_comp_esmf.F90 @@ -0,0 +1,30 @@ +module rof_comp_esmf + + ! ------------------------------------------------------------------------ + ! This is a stub version of rof_comp_esmf that can be used when we don't have a true + ! rof component, just to satisfy the necessary interfaces in LILAC. + ! ------------------------------------------------------------------------ + + use ESMF + + implicit none + private + + public :: rof_register + +!=============================================================================== +contains +!=============================================================================== + + subroutine rof_register(comp, rc) + + ! Stub rof_register routine - shouldn't ever be called! + + ! input/output argumenents + type(ESMF_GridComp) :: comp ! ROF grid component + integer, intent(out) :: rc ! return status + + rc = ESMF_RC_NOT_IMPL + end subroutine rof_register + +end module rof_comp_esmf From bfbb37b5844029ca0f0265003910aca074db5f1c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 2 Jul 2020 14:58:20 -0600 Subject: [PATCH 1133/1973] Use PIO1 with LILAC for now PIO2 is the default when using the nuopc driver, which we use when building a lilac case. However, we are seeing deaths in pio sometimes (see https://github.com/ESCOMP/CTSM/issues/876#issuecomment-653189406 and following comments in that issue). So let's try PIO1 for now. --- python/ctsm/lilac_build_ctsm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 184dd614fe..90f147428d 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -624,6 +624,11 @@ def _create_case(cime_path, build_dir, compiler, run_cmd_output_on_error(create_newcase_cmd, errmsg='Problem creating CTSM case directory') + # PIO2 sometimes causes errors: see + # https://github.com/ESCOMP/CTSM/issues/876#issuecomment-653189406 and following + # comments in that issue. So use PIO1 for now. + subprocess.check_call([xmlchange, 'PIO_VERSION=1'], cwd=case_dir) + subprocess.check_call([xmlchange, 'LILAC_MODE=on'], cwd=case_dir) if build_debug: subprocess.check_call([xmlchange, 'DEBUG=TRUE'], cwd=case_dir) From 72ac4268851d6ed6e430204a8a0865dfe32e9e1a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 2 Jul 2020 16:38:16 -0600 Subject: [PATCH 1134/1973] Get Fortran unit tests passing Needed to remove some arguments to the time manager that no longer exist --- src/unit_test_shr/unittestTimeManagerMod.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/unit_test_shr/unittestTimeManagerMod.F90 b/src/unit_test_shr/unittestTimeManagerMod.F90 index 72ff57b9b9..b22cea2e65 100644 --- a/src/unit_test_shr/unittestTimeManagerMod.F90 +++ b/src/unit_test_shr/unittestTimeManagerMod.F90 @@ -63,7 +63,6 @@ subroutine unittest_timemgr_setup(dtime) ! Set ymd values to be year N, month 1, day 1 integer, parameter :: start_ymd = 10101 integer, parameter :: ref_ymd = start_ymd - integer, parameter :: stop_ymd = 20101 integer, parameter :: perpetual_ymd = start_ymd ! Set current time to be at the start of year 1 @@ -92,11 +91,8 @@ subroutine unittest_timemgr_setup(dtime) start_tod_in = 0, & ref_ymd_in = ref_ymd, & ref_tod_in = 0, & - stop_ymd_in = stop_ymd, & - stop_tod_in = 0, & perpetual_run_in = .false., & perpetual_ymd_in = perpetual_ymd, & - nelapse_in = 1, & dtime_in = l_dtime) call timemgr_init() From d018f7d9f5e14bb57829efcff0aa098439a1bfd5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 2 Jul 2020 20:44:24 -0600 Subject: [PATCH 1135/1973] Link runtime input files into lilac atm run directory --- cime_config/SystemTests/lilacsmoke.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index e05450360e..855ddb0ffc 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -150,6 +150,7 @@ def _create_runtime_inputs(self): 'download_input_data.log') def _setup_atm_driver_rundir(self): + """Set up the directory from which we will actually do the run""" caseroot = self._case.get_value('CASEROOT') lndroot = self._case.get_value('COMP_ROOT_DIR_LND') rundir = os.path.join(caseroot, 'lilac_atm_driver', 'run') @@ -159,7 +160,7 @@ def _setup_atm_driver_rundir(self): shutil.copyfile(src=os.path.join(lndroot, 'lilac', 'atm_driver', 'atm_driver_in'), dst=os.path.join(rundir, 'atm_driver_in')) - # As above: assume the land variables also apply to the atmosphere + # As elsewhere: assume the land variables also apply to the atmosphere lnd_mesh = self._case.get_value('LND_DOMAIN_MESH') lnd_nx = self._case.get_value('LND_NX') lnd_ny = self._case.get_value('LND_NY') @@ -174,6 +175,10 @@ def _setup_atm_driver_rundir(self): 'atm_stop_day':str(stop_n+1), 'atm_ndays_all_segs':str(stop_n)}) + for file_to_link in ['lnd_in', 'lnd_modelio.nml', 'lilac_in']: + symlink_force(os.path.join(self._runtime_inputs_dir(), file_to_link), + os.path.join(rundir, file_to_link)) + def _extract_var_from_namelist(self, nl_filename, varname): """Tries to find a variable named varname in the given file; returns its value From 60cc7a45c30738746b4375df10135be5938cb4d3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 2 Jul 2020 21:39:03 -0600 Subject: [PATCH 1136/1973] Use a compset with SATM for testing LILAC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the test used compset `I2000Clm50SpRsGs`, it was dying on my mac in `case.submit` because the necessary datm data were not available, and it seems that `DIN_LOC_ROOT_CLMFORC` isn't set on my mac... and I wouldn't want it to try to download all of these data anyway. It doesn't look like there's a way to bypass the downloading of input data in the test case. So I'm switching to a test compset that uses SATM: `LILACSMOKE_Vnuopc_P4x1_D.f10_f10_musgs.I2000Ctsm50NwpSpAsRsGs.bishorn_gnu.clm-lilac`. It seems best to keep the `build_ctsm` compset consistent with this – though I don't think it's actually necessary – so I'm making the change there, too. I compared the namelists (`atm_driver_in`, `lnd_in`, `lnd_modelio.nml` and `lilac_in`) between this test case and `LILACSMOKE_Vnuopc_P4x1_D.f10_f10_musgs.I2000Clm50SpRsGs.bishorn_gnu.clm-lilac`. They are identical other than differences in inputdata paths (as expected): GOOD. (This confirms, among other things, that I have set up the tuning mode correctly, and that nothing else depends on using DATM vs. SATM.) --- cime_config/config_component.xml | 4 ++++ cime_config/config_compsets.xml | 12 ++++++++++++ python/ctsm/lilac_build_ctsm.py | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 545c17d9c4..c09daffb8d 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -68,10 +68,14 @@ clm4_5_CRUv7 clm4_5_GSWP3v1 clm4_5_cam6.0 + + clm4_5_GSWP3v1 clm5_0_CRUv7 clm5_0_CRUv7 clm5_0_GSWP3v1 clm5_0_cam6.0 + + clm5_0_GSWP3v1 diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 6c552f8dc8..87349d0c24 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -499,6 +499,18 @@ HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV + + + I2000Ctsm50NwpSpAsRsGs + 2000_SATM_CLM50%NWP-SP_SICE_SOCN_SROF_SGLC_SWAV + + diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 90f147428d..1824256705 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -22,8 +22,8 @@ # these are arbitrary, since we only use the case for its build, not any of the runtime # settings; they just need to be valid -_COMPSET = 'I2000Ctsm50NwpSpNldasRsGs' -_RES = 'nldas2_rnldas2_mnldas2' +_COMPSET = 'I2000Ctsm50NwpSpAsRsGs' +_RES = 'f10_f10_musgs' _PATH_TO_TEMPLATES = os.path.join(path_to_ctsm_root(), 'lilac', From 7c42be99713380b9681bda94f9e055d4fbc4f189 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 2 Jul 2020 22:41:24 -0600 Subject: [PATCH 1137/1973] lilacsmoke: get the run off the ground It's currently failing due to a too-long filename. I'll need to fix that next. --- cime_config/SystemTests/lilacsmoke.py | 33 ++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index 855ddb0ffc..370e17262b 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -12,7 +12,7 @@ import shutil from CIME.SystemTests.system_tests_common import SystemTestsCommon -from CIME.utils import run_cmd_no_fail, append_testlog, symlink_force +from CIME.utils import run_cmd_no_fail, append_testlog, symlink_force, new_lid from CIME.build import post_build from CIME.test_status import GENERATE_PHASE, BASELINE_PHASE, TEST_PASS_STATUS from CIME.XML.standard_module_setup import * @@ -49,6 +49,9 @@ def build_phase(self, sharedlib_only=False, model_only=False): build_dir=build_dir, machine=machine, compiler=compiler) + # It isn't straightforward to determine if pnetcdf is available on a + # machine. To keep things simple, always run without pnetcdf. + cmd += ' --no-pnetcdf' if debug: cmd += ' --build-debug' self._run_build_cmd(cmd, exeroot, 'build_ctsm.bldlog') @@ -64,6 +67,8 @@ def build_phase(self, sharedlib_only=False, model_only=False): self._build_atm_driver() + self._create_link_to_atm_driver() + self._create_runtime_inputs() self._setup_atm_driver_rundir() @@ -94,6 +99,15 @@ def _build_atm_driver(self): makecmd = 'make {makevars} atm_driver'.format(makevars=makevars) self._run_build_cmd(makecmd, blddir, 'atm_driver.bldlog') + def _create_link_to_atm_driver(self): + caseroot = self._case.get_value('CASEROOT') + run_exe = (self._case.get_value('run_exe')).strip() + + # Make a symlink to the atm_driver executable so that the case's run command finds + # it in the expected location + symlink_force(os.path.join(caseroot, 'lilac_atm_driver', 'bld', 'atm_driver.exe'), + run_exe) + def _create_runtime_inputs(self): caseroot = self._case.get_value('CASEROOT') runtime_inputs = self._runtime_inputs_dir() @@ -151,9 +165,8 @@ def _create_runtime_inputs(self): def _setup_atm_driver_rundir(self): """Set up the directory from which we will actually do the run""" - caseroot = self._case.get_value('CASEROOT') lndroot = self._case.get_value('COMP_ROOT_DIR_LND') - rundir = os.path.join(caseroot, 'lilac_atm_driver', 'run') + rundir = self._atm_driver_rundir() if not os.path.exists(rundir): os.makedirs(rundir) @@ -261,6 +274,9 @@ def _verify_inputdata_link(self): def _runtime_inputs_dir(self): return os.path.join(self._case.get_value('CASEROOT'), 'lilac_build', 'runtime_inputs') + def _atm_driver_rundir(self): + return os.path.join(self._case.get_value('CASEROOT'), 'lilac_atm_driver', 'run') + @staticmethod def _run_build_cmd(cmd, exeroot, logfile): """ @@ -277,6 +293,11 @@ def _run_build_cmd(cmd, exeroot, logfile): append_testlog(lf.read()) def run_phase(self): - # FIXME(wjs, 2020-06-10) Fill this in - pass - + # This mimics a bit of what's done in the typical case.run. Note that + # case.get_mpirun_cmd creates a command that runs the executable given by + # case.run_exe. So it's important that (elsewhere in this test script) we create a + # link pointing from that to the atm_driver.exe executable. + lid = new_lid() + os.environ["OMP_NUM_THREADS"] = str(self._case.thread_count) + cmd = self._case.get_mpirun_cmd(allow_unresolved_envvars=False) + run_cmd_no_fail(cmd, from_dir=self._atm_driver_rundir()) From 1bab80b90cda23f596761d6525ab630e8cb8f329 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 2 Jul 2020 23:24:06 -0600 Subject: [PATCH 1138/1973] LILAC build_ctsm: Stop making sym link to existing inputdata directory The initial motivation for this change was that the LILAC system test was failing because the full path to the aerosol deposition file was too long (longer than 256 characters), because the path to the inputdata sym link was very long. I thought about allowing a longer name, but this would involve changes in CIME's stream code, and I didn't want to go there. So I decided to stop using this sym link and instead just use the true path to the inputdata directory. After making this change, I started feeling like this is an improvement even without the motivation of the system test: sym links can be confusing, and it seems more intuitive to just point to files in their "real" location. --- cime_config/SystemTests/lilacsmoke.py | 18 +------------ python/ctsm/lilac_build_ctsm.py | 27 +++---------------- python/ctsm/lilac_download_input_data.py | 3 --- python/ctsm/test/test_sys_lilac_build_ctsm.py | 7 +++-- 4 files changed, 7 insertions(+), 48 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index 370e17262b..fe05cb7045 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -149,16 +149,7 @@ def _create_runtime_inputs(self): placeholders={'lilac_histfreq_option':'never'}) # We run download_input_data partly because it may be needed and partly to test - # this script. Note, though, that some files (the surface dataset, land domain - # file, and land/atm mesh file) will not be downloaded automatically: Because of - # the way this test fills in these file paths, they end up pointing to the true - # inputdata directory on this machine rather than the sym linked one in - # lilac_build_dir (which kind of makes sense, because this simulates files that - # the user would provide themselves). Thus, these files live outside of the - # inputdata root considered by download_input_data. So if these files are missing, - # they will need to be downloaded manually (e.g., using check_input_data from the - # test case). - self._verify_inputdata_link() + # this script. self._run_build_cmd('download_input_data --rundir {}'.format(runtime_inputs), runtime_inputs, 'download_input_data.log') @@ -264,13 +255,6 @@ def _fill_in_variable(self, line, varname, value, placeholder): replacement_done = False return (newline, replacement_done) - def _verify_inputdata_link(self): - """Verify that the inputdata link has been set up correctly""" - din_loc_root = self._case.get_value('DIN_LOC_ROOT') - inputdata = os.path.join(self._case.get_value('CASEROOT'), 'lilac_build', 'inputdata') - expect(os.path.realpath(inputdata) == os.path.realpath(din_loc_root), - 'inputdata not set up with the correct link') - def _runtime_inputs_dir(self): return os.path.join(self._case.get_value('CASEROOT'), 'lilac_build', 'runtime_inputs') diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 1824256705..967542f356 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -179,17 +179,6 @@ def build_ctsm(cime_path, build_with_openmp=build_with_openmp, inputdata_path=inputdata_path) - if existing_inputdata: - # For a user-defined machine without inputdata_path specified, we create an - # inputdata directory for this case above. For an existing cime-ported machine, or - # one where inputdata_path is specified, we still want an inputdata directory - # alongside the other directories, but now it will just be a link to the real - # inputdata space on that machine. (Note that, for a user-defined machine, it's - # important that we have created this directory before creating the case, whereas - # for an existing machine, we need to wait until after we have created the case to - # know where to make the sym link point to.) - _link_to_inputdata(build_dir=build_dir) - _stage_runtime_inputs(build_dir=build_dir, no_pnetcdf=no_pnetcdf) print('Initial setup complete; it is now safe to work with the runtime inputs in\n' @@ -648,17 +637,6 @@ def _create_case(cime_path, build_dir, compiler, make_link(os.path.join(case_dir, '.env_mach_specific.{}'.format(extension)), os.path.join(build_dir, 'ctsm_build_environment.{}'.format(extension))) -def _link_to_inputdata(build_dir): - """Make a sym link to an existing inputdata directory - - Args: - build_dir (str): path to build directory - """ - inputdata_dir = _xmlquery('DIN_LOC_ROOT', build_dir) - - make_link(inputdata_dir, - os.path.join(build_dir, _INPUTDATA_DIRNAME)) - def _stage_runtime_inputs(build_dir, no_pnetcdf): """Stage CTSM and LILAC runtime inputs @@ -668,15 +646,16 @@ def _stage_runtime_inputs(build_dir, no_pnetcdf): """ os.makedirs(os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME)) + inputdata_dir = _xmlquery('DIN_LOC_ROOT', build_dir) fill_template_file( path_to_template=os.path.join(_PATH_TO_TEMPLATES, 'ctsm_template.cfg'), path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'ctsm.cfg'), - substitutions={'INPUTDATA':os.path.join(build_dir, _INPUTDATA_DIRNAME)}) + substitutions={'INPUTDATA':inputdata_dir}) fill_template_file( path_to_template=os.path.join(_PATH_TO_TEMPLATES, 'lilac_in_template'), path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'lilac_in'), - substitutions={'INPUTDATA':os.path.join(build_dir, _INPUTDATA_DIRNAME)}) + substitutions={'INPUTDATA':inputdata_dir}) pio_stride = _xmlquery('MAX_MPITASKS_PER_NODE', build_dir) if no_pnetcdf: diff --git a/python/ctsm/lilac_download_input_data.py b/python/ctsm/lilac_download_input_data.py index cb64595d1b..1e0c240d25 100644 --- a/python/ctsm/lilac_download_input_data.py +++ b/python/ctsm/lilac_download_input_data.py @@ -41,9 +41,6 @@ def download_input_data(rundir): _create_lilac_input_data_list(rundir) case = Case(os.path.realpath(os.path.join(rundir, os.pardir, 'case'))) case.check_all_input_data( - # We deliberately do NOT use realpath in the following, since file names in - # namelists will use the inputdata symbolic link - input_data_root=os.path.abspath(os.path.join(rundir, os.pardir, 'inputdata')), data_list_dir=rundir, download=True, chksum=False) diff --git a/python/ctsm/test/test_sys_lilac_build_ctsm.py b/python/ctsm/test/test_sys_lilac_build_ctsm.py index 46158db6d3..74121ba90d 100755 --- a/python/ctsm/test/test_sys_lilac_build_ctsm.py +++ b/python/ctsm/test/test_sys_lilac_build_ctsm.py @@ -54,10 +54,9 @@ def test_buildSetup_userDefinedMachine_minimalInfo(self): # the critical piece of this test is that the above command doesn't generate any # errors; however we also do some assertions below - # ensure that inputdata directory was created and is NOT a sym link + # ensure that inputdata directory was created inputdata = os.path.join(build_dir, 'inputdata') self.assertTrue(os.path.isdir(inputdata)) - self.assertFalse(os.path.islink(inputdata)) def test_buildSetup_userDefinedMachine_allInfo(self): """Get through the case.setup phase with a user-defined machine @@ -92,9 +91,9 @@ def test_buildSetup_userDefinedMachine_allInfo(self): # the critical piece of this test is that the above command doesn't generate any # errors; however we also do some assertions below - # ensure that inputdata directory is a symlink pointing to the correct location + # ensure that inputdata directory is NOT created inputdata = os.path.join(build_dir, 'inputdata') - self.assertEqual(os.path.realpath(inputdata), inputdata_path) + self.assertFalse(os.path.exists(inputdata)) if __name__ == '__main__': unit_testing.setup_for_tests() From 8d24182dba844ad6d3e59edc361bf1e5a6530637 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 3 Jul 2020 00:08:54 -0600 Subject: [PATCH 1139/1973] some modifications and corrections... --- doc/source/lilac/specific-atm-models/wrf.rst | 236 ++++++++++--------- 1 file changed, 127 insertions(+), 109 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index e598d1e69d..559e4dcd2f 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -6,18 +6,28 @@ Using CTSM with WRF ===================== -This section describes the procedure for building and running the CTSM -library and its dependencies, and linking to these libraries in the WRF -model's build via LILAC. As such this section repeats some information -from earlier sections but in recipe form and with minimal explanation. +This section includes instructions on how to use WRF with CTSM using LILAC. +The procedure for building and running the CTSM library and its dependencies +repeats some information from earlier sections but with minimal explanation. .. important:: This section assumes use of a machine that has been ported to CIME. In this example we assume NCAR’s cheyenne computer in particular. -Clone CTSM Repository and Build CTSM ------------------------------------- + +Clone WRF and CTSM Repositories +------------------------------- + +Clone the WRF CTSM feature branch:: + + git clone https://github.com/billsacks/WRF.git + cd WRF + git checkout lilac_dev + +.. todo:: + + update the git address to WRF feature branch... Clone the CTSM repository:: @@ -30,133 +40,123 @@ Clone the CTSM repository:: Remove "git checkout lilac_cap" from the above when ready -Build CTSM and its dependencies based on the instructions from previous sections, -for example on Cheyenne:: - ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne +Build CTSM and its dependencies +------------------------------- -Source ctsm_build_environment.sh (bash environment):: +Build CTSM and its dependencies based on the instructions from previous sections :: - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh + ./lilac/build_ctsm /PATH/TO/CTSM/BUILD --machine MACHINE --compiler COMPILER -or ctsm_build_environment.csh (Cshell environment): +For example on `Cheyenne:` for `Intel` compiler:: -.. code-block:: Tcsh + ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh .. note:: - For further detail on preparing the CTSM, including how to - recompile when making code changes to the CTSM, read Section 3.2: - https:../obtaining-building-and-running/index.html - By the way, do not let Section 3.2.2 confuse you. We address that step - right after compiling the WRF model (next). + Run ./lilac/build_ctsm -h to see all options available, + for example if you would like to run with threading support you can use `--build-with-openmp` + +.. warning:: + + The directory you provided for the build script (``/PATH/TO/CTSM/BUILD``) must *not* exist. + Alternatively, you can use ``--rebuild`` option. Building WRF with CTSM ---------------------- -.. todo:: +First, load the same modules and set the same environments as used for CTSM build by +sourcing ctsm_build_environment.sh for Bash:: - update the git address to WRF feature branch... + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh -Clone the WRF CTSM feature branch:: +or sourcing ctsm_build_environment.csh for Cshell: - git clone https://github.com/billsacks/WRF.git - cd WRF - git checkout lilac_dev +.. code-block:: Tcsh + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh Set makefile variables from CTSM needed for the WRF build by setting the following environment. For example for Bash:: export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk +or for Cshell: .. code-block:: Tcsh setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk -The next two environment settings for building WRF may help if you -encounter compilation errors, but should be unnecessary for completing -the current example on cheyenne. -Explicitly define which model core to build by:: +There are also few other environmental setting that should be set for building WRF. +Some of these are not required, but might help if you face any compilation errors. +For more information check WRF Users' Guide. - export WRF_EM_CORE=1 -Explicilty turn off data assimilation by:: +Explicitly define which model core to build by (Bash):: - export WRF_DA_CORE=0 + export WRF_EM_CORE=1 -Now configure and build WRF for your machine and intended compiler. -The ./clean command is necessary after any modification of WRF code:: +or (Cshell): - ./clean -a - ./configure +.. code-block:: Tcsh -At the prompt choose one of the options, similar to the compiler used -for building CTSM. The specific example has been tested successfully by -choosing 15 here. + setenv WRF_EM_CORE 1 -.. todo:: - Negin, by "similar to" do you mean "same as" in the above? +Explicilty turn off data assimilation by:: -The next prompt requests an option for nesting. Currently nesting is not -available for WRF-CTSM so enter 1. + export WRF_DA_CORE=0 -Now compile em_real and save the log:: +or (Cshell): - ./compile em_real >& compile.log +.. code-block:: Tcsh + setenv WRF_DA_CORE 0 -.. note:: +Now configure and build WRF for your machine and intended compiler:: - Optional: One may use tmux or nohup for configuring and compiling. - Try "man nohup" for more information. + ./clean -a + ./configure -.. note:: - Check the bottom of your log file for a successful compilation message - or search the file for the string "Error" with a capital E. +At the prompt choose one of the options, based on the compiler used +for building CTSM. Then you should choose if you'd like to build serially or +in parallel. -.. note:: +.. tip:: - The ./compile step may take more than 30 minutes to complete. - While you wait, follow the instructions in Section 3.2.2 (next) + dmpar or distributed memory parallelization is the most highly tested and + recommended for compiling WRF. -Now follow the instructions in this Section:: +The next prompt requests an option for nesting. Currently nesting is not +available for WRF-CTSM so enter 1. - https:../obtaining-building-and-running/setting-ctsm-runtime-options.html -In step 3 of that Section we used for this example:: +Now compile em_real and save the log:: - lnd_domain_file = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files/domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc - fsurdat = /glade/work/slevis/git_wrf/ctsm_surf/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc - finidat = /glade/work/slevis/git_wrf/ctsm_init/finidat_interp_dest_wrfinit_snow_ERAI_12month.nc + ./compile em_real >& compile.log -In step 4 of that Section we used for this example:: - atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' - lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' - -In step 6 of that Section you will copy some files to your WRF/run -directory. Then you will be ready to continue. +Check the bottom of your log file for a successful compilation message +or search the file for the string "Error" with a capital E. .. note:: - If you wish to merge your WRF initial conditions from a wrfinput file - into the existing CTSM initial condition file, complete the following step. + The ./compile step may take more than 30 minutes to complete. + While you wait, follow the instructions in Section 3.2.2 (next) -Type:: +.. tip:: - module load ncl - ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="the_existing_finidat_file.nc"' 'wrfinput="your_wrfinput_file"' 'merged="the_merged_finidat_file.nc"' + Optional: One may use ``tmux`` or ``nohup`` for configuring and compiling. + Try ``man nohup`` for more information. -.. todo:: +.. seealso:: - Make the above ncl script available. + For further detail on preparing the CTSM, including how to + recompile when making code changes to the CTSM, read `Section 3.2. + `__ Compile WRF Preprocessing System (WPS) -------------------------------------- @@ -166,14 +166,14 @@ inputs to the real program executable (real.exe) for WRF real-data simulations. If you wish to complete the offered example with preexisting inputs, then skip to the next section, which is titled "Run WRF." -.. note:: +.. warning:: Building WPS requires that WRF be already built successfully. -Get WPS from: +Get WPS from this website:: -https://www2.mmm.ucar.edu/wrf/users/download/wrf-regist_or_download.php + https://www2.mmm.ucar.edu/wrf/users/download/wrf-regist_or_download.php New users must complete a registration form in this step. @@ -182,13 +182,8 @@ Then compile WPS similar to the way WRF was built. In summary:: cd WPS ./configure -At the prompt choose your intended compiler, similar to your WRF build. -After configuring, check configure.wps to make sure all the libs and paths -are set correctly. - -.. todo:: - - Negin, by "similar to" do you mean "same as" in the above? +At the prompt choose your intended compiler and parallelization method, +similar to the steps in your WRF build. Then, compile WPS:: @@ -197,13 +192,13 @@ Then, compile WPS:: .. note:: If wps builds succesfully you should see geogrid.exe, ungrib.exe, and metgrid.exe. - Alternatively, you can check the log for successful build message. + Alternatively, you can check the log for successful build messages. -Run WPS -------- +Run WPS Programs +---------------- -Edit namelist.wps for your domain of interest, which should be the same +Edit ``namelist.wps`` for your domain of interest, which should be the same domain as used in your WRF namelist. First, use geogrid.exe to define the domain and interpolate static geographical data @@ -255,18 +250,19 @@ metgrid step:: + Run real.exe ------------ -Run real.exe to generate initial and boundary conditions. +Run ``real.exe`` to generate initial and boundary conditions. Follow WRF instructions for creating initial and boundary conditions. In summary, complete the following steps: -Move or link WPS output files (met_em.d01* files) to your WRF/run directory. +Move or link WPS output files (met_em.d01* files) to your WRF test directory. Edit namelist.input for your WRF domain and desirable configurations. -This should be the same domain as in the namelist used in WPS. +This should be the same domain as WPS namelist. .. todo:: @@ -274,21 +270,17 @@ This should be the same domain as in the namelist used in WPS. update the option number of wrf namelist. -To run WRF-CTSM, change land-surface option to 51:: +To run WRF-CTSM, in your namelist change land-surface option to 51:: - sf_surface_physics = 51 + sf_surface_physics = 51 -.. note:: - - sf_surface_physics values for running WRF-Noah and WRF-NoahMP are - 2 and 4, respectively. .. todo:: add the link and adding some note that nested run is not possible.... Run real.exe (if compiled parallel submit a batch job) to generate -wrfinput and wrfbdy files. +``wrfinput`` and ``wrfbdy`` files. Check the last line of the real log file for the following message:: @@ -296,11 +288,47 @@ Check the last line of the real log file for the following message:: SUCCESS COMPLETE REAL_EM INIT +Now follow the instructions in this Section:: + + https:../obtaining-building-and-running/setting-ctsm-runtime-options.html + +In step 3 of that Section we used for this example:: + + lnd_domain_file = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files/domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc + fsurdat = /glade/work/slevis/git_wrf/ctsm_surf/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc + finidat = /glade/work/slevis/git_wrf/ctsm_init/finidat_interp_dest_wrfinit_snow_ERAI_12month.nc + +In step 4 of that Section we used for this example:: + + atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + +In step 6 of that Section you will copy some files to your WRF/run +directory. Then you will be ready to continue. + +.. note:: + + If you wish to merge your WRF initial conditions from a wrfinput file + into the existing CTSM initial condition file, complete the following step. + +Type:: + + module load ncl + ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="the_existing_finidat_file.nc"' 'wrfinput="your_wrfinput_file"' 'merged="the_merged_finidat_file.nc"' + +.. todo:: + + Make the above ncl script available. + + + Run WRF ------- If real.exe completed successfully, we should have wrfinput and wrfbdy files -in our directory. If you plan to use this example's preexisting files, copy +in our directory. + +If you plan to use this example's preexisting files, copy the following files to your WRF/run directory:: /glade/work/slevis/git_wrf/WRF/test/em_real/namelist.input.ctsm.2013.d01.12month @@ -329,6 +357,7 @@ A simple PBS script to run WRF-CTSM on Cheyenne looks like this: ### Set TMPDIR as recommended setenv TMPDIR /glade/scratch/$USER/temp mkdir -p $TMPDIR + source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh ### Run the executable mpiexec_mpt ./wrf.exe @@ -337,15 +366,4 @@ If you named this script run_wrf_ctsm.csh, submit the job like this:: qsub run_wrf_ctsm.csh -If your terminal windows have logged off, repeat -source ctsm_build_environment.sh (bash environment) before submitting -the job:: - - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh - -or ctsm_build_environment.csh (Cshell environment): - -.. code-block:: Tcsh - - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh From 8ce2e09cc96e1cb6f979fd21258620bda7940ab0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Jul 2020 00:16:39 -0600 Subject: [PATCH 1140/1973] lilacsmoke: Use full paths to some scripts This (or something like it) is needed if dot isn't in your path. --- cime_config/SystemTests/lilacsmoke.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index fe05cb7045..5e68838a8a 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -135,7 +135,8 @@ def _create_runtime_inputs(self): shutil.copyfile(src=os.path.join(caseroot, 'user_nl_ctsm'), dst=os.path.join(runtime_inputs, 'user_nl_ctsm')) - self._run_build_cmd('make_runtime_inputs --rundir {}'.format(runtime_inputs), + script_to_run = os.path.join(runtime_inputs, 'make_runtime_inputs') + self._run_build_cmd('{} --rundir {}'.format(script_to_run, runtime_inputs), runtime_inputs, 'make_runtime_inputs.log') @@ -150,7 +151,8 @@ def _create_runtime_inputs(self): # We run download_input_data partly because it may be needed and partly to test # this script. - self._run_build_cmd('download_input_data --rundir {}'.format(runtime_inputs), + script_to_run = os.path.join(runtime_inputs, 'download_input_data') + self._run_build_cmd('{} --rundir {}'.format(script_to_run, runtime_inputs), runtime_inputs, 'download_input_data.log') From 36c726701b2cb1377f725ca620614541024fdda8 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 3 Jul 2020 00:45:06 -0600 Subject: [PATCH 1141/1973] some clean-ups... --- doc/source/lilac/specific-atm-models/wrf.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 559e4dcd2f..cb590f24fc 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -220,7 +220,7 @@ To run ungrib.exe, first link the GRIB data files that are going to be used:: ./link_grib.csh $your_GRIB_data_path Based on your GRIB data type, link or copy the appropriate VTable to your WPS directory. -WRF has some prepared VTable under /ungrib/Variable_tables/ folder. +WRF has some prepared VTable under ``/ungrib/Variable_tables/`` folder. Extract meteorological fields from GRIB-formatted files:: @@ -259,7 +259,7 @@ Run ``real.exe`` to generate initial and boundary conditions. Follow WRF instructions for creating initial and boundary conditions. In summary, complete the following steps: -Move or link WPS output files (met_em.d01* files) to your WRF test directory. +Move or link WPS output files (``met_em.d01*`` files) to your WRF test directory. Edit namelist.input for your WRF domain and desirable configurations. This should be the same domain as WPS namelist. @@ -287,6 +287,8 @@ Check the last line of the real log file for the following message:: SUCCESS COMPLETE REAL_EM INIT +Set CTSM runtime options +------------------------ Now follow the instructions in this Section:: @@ -322,10 +324,10 @@ Type:: -Run WRF -------- +Run wrf.exe +----------- -If real.exe completed successfully, we should have wrfinput and wrfbdy files +If real.exe completed successfully, we should have ``wrfinput`` and ``wrfbdy`` files in our directory. If you plan to use this example's preexisting files, copy From 2401a38c8a975b713182da36a6be294d4f23bb82 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Jul 2020 05:59:39 -0600 Subject: [PATCH 1142/1973] Add a comment --- cime_config/config_component.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index c09daffb8d..2840d72354 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -68,13 +68,19 @@ clm4_5_CRUv7 clm4_5_GSWP3v1 clm4_5_cam6.0 - + clm4_5_GSWP3v1 clm5_0_CRUv7 clm5_0_CRUv7 clm5_0_GSWP3v1 clm5_0_cam6.0 - + clm5_0_GSWP3v1 From fd614ba8c807d23524a3d757c86b017452d72607 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Jul 2020 14:34:44 -0600 Subject: [PATCH 1143/1973] lilacsmoke test: get baseline generation/comparison working This required some changes to the file naming convention of lilac's history files: I think cime assumes that the component name ('clm') appears in the output file. --- cime_config/SystemTests/lilacsmoke.py | 42 +++++++++++++++++++++++++-- cime_config/config_archive.xml | 4 +++ lilac/atm_driver/atm_driver.F90 | 2 +- lilac/atm_driver/atm_driver_in | 2 +- lilac/src/lilac_history.F90 | 2 +- 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index 5e68838a8a..ed57258339 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -6,8 +6,14 @@ driver, both for the sake of the build and for extracting some runtime settings. This test should also use the lilac testmod (or a testmod that derives from it) in order to establish the user_nl_ctsm file correctly. + +Important directories under CASEROOT are: +- lilac_build: this contains the build and the runtime inputs for the lilac run +- lilac_atm_driver: this contains the build of the test driver as well as the run + directory in which the test is actually run """ +import glob import os import shutil @@ -143,11 +149,14 @@ def _create_runtime_inputs(self): # In lilac_in, we intentionally use the land mesh file for both atm_mesh_filename # and lnd_mesh_filename lnd_mesh = self._case.get_value('LND_DOMAIN_MESH') + casename = self._case.get_value('CASE') self._fill_in_variables_in_file(filepath=os.path.join(runtime_inputs, 'lilac_in'), - replacements={'atm_mesh_filename':lnd_mesh, + replacements={'caseid':casename, + 'atm_mesh_filename':lnd_mesh, 'lnd_mesh_filename':lnd_mesh, 'lilac_histfreq_option':'ndays'}, - placeholders={'lilac_histfreq_option':'never'}) + placeholders={'caseid':'ctsm_lilac', + 'lilac_histfreq_option':'never'}) # We run download_input_data partly because it may be needed and partly to test # this script. @@ -174,8 +183,10 @@ def _setup_atm_driver_rundir(self): 'LILAC testing currently assumes STOP_OPTION of ndays, not {}'.format( self._case.get_value('STOP_OPTION'))) stop_n = self._case.get_value('STOP_N') + casename = self._case.get_value('CASE') self._fill_in_variables_in_file(filepath=os.path.join(rundir, 'atm_driver_in'), - replacements={'atm_mesh_file':lnd_mesh, + replacements={'caseid':casename, + 'atm_mesh_file':lnd_mesh, 'atm_global_nx':str(lnd_nx), 'atm_global_ny':str(lnd_ny), 'atm_stop_day':str(stop_n+1), @@ -287,3 +298,28 @@ def run_phase(self): os.environ["OMP_NUM_THREADS"] = str(self._case.thread_count) cmd = self._case.get_mpirun_cmd(allow_unresolved_envvars=False) run_cmd_no_fail(cmd, from_dir=self._atm_driver_rundir()) + + self._link_to_output_files() + + def _link_to_output_files(self): + """Make links to the output files so that they appear in the directory expected by the test case + + Note: We do the run from a different directory in order to ensure that the run + isn't using any of the files that are staged by the test case in the standard run + directory. But then we need to create these links afterwards for the sake of + baseline generation / comparison. + """ + casename = self._case.get_value('CASE') + rundir = self._case.get_value('RUNDIR') + pattern = '{}*.nc'.format(casename) + + # First remove any old files from the run directory + old_files = glob.glob(os.path.join(rundir, pattern)) + for one_file in old_files: + os.remove(one_file) + + # Now link to new files + output_files = glob.glob(os.path.join(self._atm_driver_rundir(), pattern)) + for one_file in output_files: + file_basename = os.path.basename(one_file) + symlink_force(one_file, os.path.join(rundir, file_basename)) diff --git a/cime_config/config_archive.xml b/cime_config/config_archive.xml index 4c2412a0e3..bc9f1d6c0a 100644 --- a/cime_config/config_archive.xml +++ b/cime_config/config_archive.xml @@ -3,6 +3,8 @@ r rh\d? h\d*.*\.nc$ + lilac_hi.*\.nc$ + lilac_atm_driver_h\d*.*\.nc$ e locfnh @@ -15,6 +17,8 @@ casename.clm2.r.1976-01-01-00000.nc casename.clm2.rh4.1976-01-01-00000.nc casename.clm2.h0.1976-01-01-00000.nc + casename.clm2.lilac_hi.1976-01-01-00000.nc + casename.clm2.lilac_atm_driver_h0.0001-01.nc casename.clm2.h0.1976-01-01-00000.nc.base casename.clm2_0002.e.postassim.1976-01-01-00000.nc casename.clm2_0002.e.preassim.1976-01-01-00000.nc diff --git a/lilac/atm_driver/atm_driver.F90 b/lilac/atm_driver/atm_driver.F90 index 19112f7837..a1dcfad487 100644 --- a/lilac/atm_driver/atm_driver.F90 +++ b/lilac/atm_driver/atm_driver.F90 @@ -564,7 +564,7 @@ subroutine write_lilac_to_atm_driver_fields(caseid, nlocal, atm_global_nx, & if (masterproc) then ! Use an arbitrary time rather than trying to figure out the correct time stamp. This ! works because this subroutine is only called once, at the end of the run - ierr = nf90_create(trim(caseid)//'.atm.h0.0001-01.nc', nf90_clobber, ncid) + ierr = nf90_create(trim(caseid)//'.clm2.lilac_atm_driver_h0.0001-01.nc', nf90_clobber, ncid) if (ierr /= nf90_NoErr) call shr_sys_abort(' ERROR: nf90_create atm driver output file') ierr = nf90_def_dim(ncid, 'atm_nx', atm_global_nx, dimid_x) diff --git a/lilac/atm_driver/atm_driver_in b/lilac/atm_driver/atm_driver_in index 51e8b23fa2..8391f41a34 100644 --- a/lilac/atm_driver/atm_driver_in +++ b/lilac/atm_driver/atm_driver_in @@ -1,5 +1,5 @@ &atm_driver_input - caseid = 'test_lilac' + caseid = 'FILL_THIS_IN' atm_mesh_file = 'FILL_THIS_IN' atm_global_nx = FILL_THIS_IN atm_global_ny = FILL_THIS_IN diff --git a/lilac/src/lilac_history.F90 b/lilac/src/lilac_history.F90 index d6215b2cb1..bc4967630d 100644 --- a/lilac/src/lilac_history.F90 +++ b/lilac/src/lilac_history.F90 @@ -68,7 +68,7 @@ subroutine lilac_history_init(clock, caseid, rc) end if close(fileunit) - write(histfile_prefix,"(2a)") trim(caseid),'.lilac.hi.' + write(histfile_prefix,"(2a)") trim(caseid),'.clm2.lilac_hi.' !--------------------------------------- ! Get the clock info From 58e282599e9bb5bae872d16e7270473540e24049 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Jul 2020 16:18:48 -0600 Subject: [PATCH 1144/1973] lilacsmoke test: get namelist comparison & generation working Now namelist comparison & generation correctly use the namelists used in the atm_driver-lilac-ctsm run, rather than in the meaningless test case. --- cime_config/SystemTests/lilacsmoke.py | 51 +++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index ed57258339..cf46af06d7 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -18,13 +18,15 @@ import shutil from CIME.SystemTests.system_tests_common import SystemTestsCommon -from CIME.utils import run_cmd_no_fail, append_testlog, symlink_force, new_lid +from CIME.utils import run_cmd, run_cmd_no_fail, symlink_force, new_lid, safe_copy, append_testlog from CIME.build import post_build -from CIME.test_status import GENERATE_PHASE, BASELINE_PHASE, TEST_PASS_STATUS +from CIME.test_status import NAMELIST_PHASE, GENERATE_PHASE, BASELINE_PHASE, TEST_PASS_STATUS, TEST_FAIL_STATUS from CIME.XML.standard_module_setup import * logger = logging.getLogger(__name__) +_LILAC_RUNTIME_FILES = ['lnd_in', 'lnd_modelio.nml', 'lilac_in'] + class LILACSMOKE(SystemTestsCommon): def __init__(self, case): @@ -79,6 +81,8 @@ def build_phase(self, sharedlib_only=False, model_only=False): self._setup_atm_driver_rundir() + self._cmpgen_namelists() + # Setting logs=[] implies that we don't bother gzipping any of the build log # files; that seems fine for these purposes (and it keeps the above code # simpler). @@ -192,10 +196,51 @@ def _setup_atm_driver_rundir(self): 'atm_stop_day':str(stop_n+1), 'atm_ndays_all_segs':str(stop_n)}) - for file_to_link in ['lnd_in', 'lnd_modelio.nml', 'lilac_in']: + for file_to_link in _LILAC_RUNTIME_FILES: symlink_force(os.path.join(self._runtime_inputs_dir(), file_to_link), os.path.join(rundir, file_to_link)) + def _cmpgen_namelists(self): + """Redoes the namelist comparison & generation with appropriate namelists + + The standard namelist comparison & generation is done with the CaseDocs directory + from the test case. That isn't appropriate here, because those namelists aren't + actually used in this test. Instead, we want to compare & generate the namelists + used by the atm_driver-lilac-ctsm execution. Here, we do some file copies and then + re-call the namelist comparison & generation script in order to accomplish + this. This will overwrite the namelists generated earlier in the test, and will + also replace the results of the NLCOMP phase. + + Note that we expect a failure in the NLCOMP phase that is run earlier in the test, + because that one will have compared the test's standard CaseDocs with the files + generated from here - and those two sets of namelists can be quite different. + """ + caseroot = self._case.get_value('CASEROOT') + casedocs = os.path.join(caseroot, 'CaseDocs') + if os.path.exists(casedocs): + shutil.rmtree(casedocs) + os.makedirs(casedocs) + + # case_cmpgen_namelists uses the existence of drv_in to decide whether namelists + # need to be regenerated. We do NOT want it to regenerate namelists, so we give it + # the file it wants. + with open(os.path.join(casedocs, 'drv_in'), 'a') as drv_in: + pass + + for onefile in _LILAC_RUNTIME_FILES + ['atm_driver_in']: + safe_copy(os.path.join(self._atm_driver_rundir(), onefile), + os.path.join(casedocs, onefile)) + + success = self._case.case_cmpgen_namelists() + # The setting of the NLCOMP phase status in case_cmpgen_namelists doesn't work + # here (probably because the test object has a saved version of the test status + # and so, when it goes to write the status of the build phase, it ends up + # overwriting whatever was set by case_cmpgen_namelists). So we need to set it + # here. + with self._test_status: + self._test_status.set_status(NAMELIST_PHASE, TEST_PASS_STATUS if success else TEST_FAIL_STATUS, + comments="(used lilac namelists)") + def _extract_var_from_namelist(self, nl_filename, varname): """Tries to find a variable named varname in the given file; returns its value From cecc60142f25ae7536114997eedeb955a92eb0ed Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Jul 2020 16:52:22 -0600 Subject: [PATCH 1145/1973] Add a comment --- cime_config/SystemTests/lilacsmoke.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index cf46af06d7..ed4624ff57 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -11,6 +11,10 @@ - lilac_build: this contains the build and the runtime inputs for the lilac run - lilac_atm_driver: this contains the build of the test driver as well as the run directory in which the test is actually run + +Note that namelists for this test are generated in the build phase; they are NOT +regenerated when the test is submitted / run. This means that, if you have made any +changes that will impact namelists, you will need to rebuild this test. """ import glob From d972d9de2d184cf7c8120ef2ce3401d0ccf09b5b Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 3 Jul 2020 16:56:34 -0600 Subject: [PATCH 1146/1973] fixing missed usage of ratio that cause CompareBulkToTracer runtime error --- src/biogeophys/WaterStateType.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index 668317546a..4f59b78c63 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -348,9 +348,9 @@ subroutine InitCold(this, bounds, & this%h2osoi_vol_col(c,j) = 0.0_r8 else if(use_fates_planthydro) then - this%h2osoi_vol_col(c,j) = 0.75_r8*watsat_col(c,j) + this%h2osoi_vol_col(c,j) = 0.75_r8*watsat_col(c,j)*ratio else - this%h2osoi_vol_col(c,j) = 0.15_r8 + this%h2osoi_vol_col(c,j) = 0.15_r8*ratio end if endif end do From 8edcb24a234056402e351827cb3d27f1edaa0757 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 3 Jul 2020 20:10:17 -0600 Subject: [PATCH 1147/1973] LILAC: implement alarms other than nsteps Code is from @mvertens. I have just tested ndays for LILAC history output so far. This has an off-by-one issue, but I suspect it's due to a different part of the code. I'll open an issue for this. --- lilac/src/lilac_time.F90 | 52 +++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/lilac/src/lilac_time.F90 b/lilac/src/lilac_time.F90 index 31929e8a42..e372c7dcff 100644 --- a/lilac/src/lilac_time.F90 +++ b/lilac/src/lilac_time.F90 @@ -21,7 +21,7 @@ module lilac_time ! Clock and alarm options character(len=*), private, parameter :: & - optNONE = "none" , & + optNone = "none" , & optNever = "never" , & optNSteps = "nsteps" , & optNSeconds = "nseconds" , & @@ -265,30 +265,66 @@ subroutine lilac_time_alarmInit( clock, alarm, alarmname, option, opt_n, rc) call ESMF_ClockGet(clock, calendar=cal) ! Determine inputs for call to create alarm - if (trim(option) == optNone .or. trim(option) == optNever) then + if (trim(option) /= optNone .and. trim(option) /= optNever) then + if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n - must be > 0') + end if + select case (trim(option)) + case (optNone, optNever) call ESMF_TimeIntervalSet(AlarmInterval, yy=really_big_year, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeSet( NextAlarm, yy=really_big_year, mm=12, dd=1, s=0, calendar=cal, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return update_nextalarm = .false. - else if ( trim(option) == optNSteps .or. trim(option) == optNSeconds .or. & - trim(option) == optNMinutes .or. trim(option) == optNHours .or. trim(option) == optNDays) then - - if (opt_n <= 0) call shr_sys_abort(subname//trim(option)//' invalid opt_n') + case (optNSteps) call ESMF_ClockGet(clock, TimeStep=AlarmInterval, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return AlarmInterval = AlarmInterval * opt_n update_nextalarm = .true. - else + case (optNSeconds) + call ESMF_TimeIntervalSet(AlarmInterval, s=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMinutes) + call ESMF_TimeIntervalSet(AlarmInterval, s=60, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNHours) + call ESMF_TimeIntervalSet(AlarmInterval, s=3600, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + case (optNDays) + call ESMF_TimeIntervalSet(AlarmInterval, d=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNMonths) + call ESMF_TimeIntervalSet(AlarmInterval, mm=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case (optNYears) + call ESMF_TimeIntervalSet(AlarmInterval, yy=1, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + AlarmInterval = AlarmInterval * opt_n + update_nextalarm = .true. + + case default call ESMF_LogWrite(subname//'unknown option '//trim(option), ESMF_LOGMSG_INFO) rc = ESMF_FAILURE return - end if + end select ! ------------------------------------------------- ! AlarmInterval and NextAlarm should be set From e41545a3d786ac64196ce8fc5979d38f6bd1cf93 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 5 Jul 2020 14:49:04 -0600 Subject: [PATCH 1148/1973] LILAC: Disable ESMF's PET files by default Disabling these because they contain a lot of unnecessary output. Add a namelist flag that allows turning these back on. --- lilac/bld_templates/lilac_in_template | 1 + lilac/src/lilac_mod.F90 | 35 +++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lilac/bld_templates/lilac_in_template b/lilac/bld_templates/lilac_in_template index 6295929e23..78a8ab75cf 100644 --- a/lilac/bld_templates/lilac_in_template +++ b/lilac/bld_templates/lilac_in_template @@ -1,5 +1,6 @@ &lilac_run_input caseid = 'ctsm_lilac' + create_esmf_pet_files = .false. / &lilac_history_input lilac_histfreq_option = 'never' diff --git a/lilac/src/lilac_mod.F90 b/lilac/src/lilac_mod.F90 index b233896424..d98e3e080c 100644 --- a/lilac/src/lilac_mod.F90 +++ b/lilac/src/lilac_mod.F90 @@ -130,6 +130,8 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & ! local variables character(ESMF_MAXSTR) :: caseid + logical :: create_esmf_pet_files + type(ESMF_LogKind_Flag) :: logkindflag type(ESMF_TimeInterval) :: timeStep type(ESMF_Time) :: startTime integer :: yy,mm,dd,sec @@ -155,7 +157,7 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & logical :: comp_iamin(1) = (/.true./) ! for pio init2 !------------------------------------------------------------------------ - namelist /lilac_run_input/ caseid + namelist /lilac_run_input/ caseid, create_esmf_pet_files ! Initialize return code rc = ESMF_SUCCESS @@ -165,6 +167,27 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & !------------------------------------------------------------------------- starttype = starttype_in + ! ------------------------------------------------------------------------ + ! Read main namelist + ! ------------------------------------------------------------------------ + + ! Initialize variables in case not set in namelist (but we expect them to be set) + caseid = 'UNSET' + create_esmf_pet_files = .false. + + open(newunit=fileunit, status="old", file="lilac_in") + read(fileunit, lilac_run_input, iostat=ierr) + if (ierr > 0) then + call shr_sys_abort(trim(subname) // 'error reading in lilac_run_input') + end if + close(fileunit) + + if (create_esmf_pet_files) then + logkindflag = ESMF_LOGKIND_MULTI + else + logkindflag = ESMF_LOGKIND_MULTI_ON_ERROR + end if + ! ------------------------------------------------------------------------ ! Complete setup of field lists started in lilac_init1, now that we know the number ! of atm points. @@ -186,7 +209,7 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & ! NOTE: the default calendar is set to GREGORIAN and is reset below in the initialization of ! the lilac clock call ESMF_Initialize(mpiCommunicator=mpicom, defaultCalKind=ESMF_CALKIND_GREGORIAN, & - logappendflag=.false., rc=rc) + logkindflag=logkindflag, logappendflag=.false., rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_LogSet(flush=.true.) @@ -212,14 +235,6 @@ subroutine lilac_init2(mpicom, atm_global_index, atm_lons, atm_lats, & call shr_pio_init2(compids, compLabels, comp_iamin, (/mpicom/), (/mytask/)) call ESMF_LogWrite(subname//"initialized shr_pio_init2 ...", ESMF_LOGMSG_INFO) - ! read in caseid - open(newunit=fileunit, status="old", file="lilac_in") - read(fileunit, lilac_run_input, iostat=ierr) - if (ierr > 0) then - call shr_sys_abort(trim(subname) // 'error reading in lilac_run_input') - end if - close(fileunit) - !------------------------------------------------------------------------- ! Initial lilac atmosphere cap module variables !------------------------------------------------------------------------- From 75c11419f7e5b440e6cc30e1d01594ab9df5dd52 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 5 Jul 2020 21:09:18 -0600 Subject: [PATCH 1149/1973] Remove unnecessary LND_TUNING_MODE setting This config_component setting isn't actually necessary for LILAC, because LILAC takes its settings from ctsm.cfg rather than xml variables. I have confirmed that LILACSMOKE_Vnuopc_P4x1_D_Ld2.f10_f10_musgs.I2000Ctsm50NwpSpAsRsGs.bishorn_gnu.clm-lilac is bfb (and lnd_in file is identical) before and after this change. --- cime_config/config_component.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 2840d72354..545c17d9c4 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -68,20 +68,10 @@ clm4_5_CRUv7 clm4_5_GSWP3v1 clm4_5_cam6.0 - - clm4_5_GSWP3v1 clm5_0_CRUv7 clm5_0_CRUv7 clm5_0_GSWP3v1 clm5_0_cam6.0 - - clm5_0_GSWP3v1 From 9c715da288a5fce3493574c0f2f5b9cf97a672a2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 6 Jul 2020 09:33:33 -0600 Subject: [PATCH 1150/1973] Add a LILAC test to the test suite --- cime_config/testdefs/testlist_clm.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index e03cbc2b3b..d1d395c2b0 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -2013,6 +2013,18 @@ + + + + + + + + + + + + From cb94fb4c2a0729e9ca03f9890bbf7a3d2e321932 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 6 Jul 2020 10:13:21 -0600 Subject: [PATCH 1151/1973] Update ChangeLog --- doc/ChangeLog | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 136 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 045c26ec2f..c08274e32e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,139 @@ =============================================================== +Tag name: ctsm1.0.dev104 +Originator(s): sacks (Bill Sacks) +Date: Mon Jul 6 09:58:15 MDT 2020 +One-line Summary: Add LILAC + +Purpose of changes +------------------ + +Add LILAC: The Lightweight Infrastructure for Land-Atmosphere +Coupling. This infrastructure consists of two major pieces: + +(1) A lightweight coupling infrastructure built on top of ESMF that + makes it easier for atmosphere models to call CTSM directly, rather + than using the hub-and-spoke architecture that is used by CESM. + +(2) A set of python-based tools for building CTSM and creating its + runtime inputs when running in an atmosphere model via + LILAC. Although these tools are built on top of cime, details of the + create_newcase / case.setup / case.build process are hidden from the + user, because many of the aspects of this workflow don't make sense + in the LILAC context. + +So far we have used LILAC to couple CTSM to WRF. There are plans to use +the same infrastructure to couple CTSM to other regional atmosphere +models. + +Documentation of LILAC is provided in +https://escomp.github.io/ctsm-docs/versions/master/html/lilac/index.html +(though there are still some missing sections), as well as in various +presentations on the wiki +(https://github.com/ESCOMP/CTSM/wiki/Presentations). + +There have been many contributors besides myself to the development, +testing and documentation of LILAC; chief among them being Mariana +Vertenstein, Negin Sobhani, Joe Hamman, Sam Levis, Mike Barlage and Dave +Lawrence. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- See issues in the Done column of https://github.com/ESCOMP/CTSM/projects/23 + +Known bugs introduced in this tag (include github issue ID): +- Although LILAC is working to first order, there is still some work to +do. See outstanding issues in https://github.com/ESCOMP/CTSM/projects/23 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- dtime no longer specified on the namelist: just obtained from driver + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Added LILACSMOKE test + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - ok + + Baseline comparisons fail as expected. One test failed, but it also + failed for me on master (https://github.com/ESCOMP/CTSM/issues/1074) + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - pass on my mac + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1068 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev103 Originator(s): slevis (Samuel Levis, SLevis Consulting LLC,303-665-1310) Date: Mon Jun 29 17:16:29 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 9af125f5b9..c773cf9101 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev104 sacks 07/06/2020 Add LILAC ctsm1.0.dev103 slevis 06/29/2020 Gridcell-level error-check for methane (CH4) ctsm1.0.dev102 erik/ole 06/26/2020 Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 ctsm1.0.dev101 ole/erik 06/17/2020 Changes from Keith to bring a list of variables to the parameter file From 279ec1db6f662af66879d065300cddce73063879 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 6 Jul 2020 13:55:21 -0600 Subject: [PATCH 1152/1973] Remove README.lilac This file is no longer relevant, and has been superseded by: - The documentation here: https://escomp.github.io/ctsm-docs/versions/master/html/lilac/index.html - The LILACSMOKE system test, for testing via the atm_driver --- README.lilac | 110 --------------------------------------------------- 1 file changed, 110 deletions(-) delete mode 100644 README.lilac diff --git a/README.lilac b/README.lilac deleted file mode 100644 index 6a4414e6ae..0000000000 --- a/README.lilac +++ /dev/null @@ -1,110 +0,0 @@ -======================================================================== -I. Building a CTSM / LILAC library for inclusion in an atmosphere model -======================================================================== - -1) check out the code (ctsm and lilac are now bundled together) and built as one library - - > git clone https://github.com/ESCOMP/ctsm.git - > git checkout lilac_cap - > ./manage_externals/checkout_externals -v - -2) set the following environment variables - SRCROOT is where ctsm is checked out - - > export SRCROOT=`pwd` - > export CASEDIR=/glade/scratch/$USER/test_lilac - -3) build the ctsm/lilac library using a CIME case - - > cd $SRCROOT/cime/scripts - > ./create_newcase --case $CASEDIR --compset I2000Clm50SpRsGs --res f45_f45_mg37 --run-unsupported --driver nuopc - > cd $CASEDIR - > ./xmlchange LILAC_MODE=on - > ./xmlchange DEBUG=TRUE - > ./case.setup - > ./case.build --sharedlib-only - -======================================================================== -II. Building and running the test atmosphere driver -======================================================================== - -After following the above instructions for building a CTSM / LILAC -library (I), do the following: - -1) To build the atm_driver executable on cheyenne (***CTSM_MKFILE IS CRITICAL for the operation of the atm_driver makefile) - - > export CTSM_MKFILE=$CASEDIR/bld/ctsm.mk - > cd $SRCROOT/lilac/atm_driver - > $SRCROOT/cime/tools/configure --comp-interface nuopc --macros-format Makefile --clean - > make clean - > source ./.env_mach_specific.sh - > export DEBUG=TRUE - > make COMPILER=intel atm_driver - -2) to generate the input namelists - - - to customize the generated namelist - edit the file ctsm.cfg (in this directory) - - to create the ctsm namelist FROM THIS DIRECTORY: - - > $SRCROOT/lilac_config/buildnml - - - this will now create the files lnd_in and clm.input_data_list in this directory - THIS ONLY NEEDS TO BE DONE ONCE - to futher customize the lnd_in (say to adjust the ctsm history output) edit the generated lnd_in in this directory - -3) run the atm_driver on cheyenne - - > qsub cheyenne.sub - -4) compare with latest baselines - - use something like this to compare the last clm and last cpl hist files: - - > basedir=/glade/p/cgd/tss/ctsm_baselines/lilac_20191202 - > cprnc test_lilac.clm2.h0.2000-01-03-00000.nc $basedir/test_lilac.clm2.h0.2000-01-03-00000.nc | tail -30 - > cprnc test_lilac.lilac.hi.2000-01-02-81000.nc $basedir/test_lilac.lilac.hi.2000-01-02-81000.nc | tail -30 - > cprnc -m test_lilac.atm.h0.0001-01.nc $basedir/test_lilac.atm.h0.0001-01.nc | tail -30 - -5) if there are differences, and those are intentional, then create new - baselines - - copy all *.nc files, plus ctsm.cfg, lilac_in and lnd_in to the - baseline directory - -======================================================================== -III. Linking the CTSM / LILAC library into another atmosphere model -======================================================================== - -After following the above instructions for building a CTSM / LILAC -library (I), you should do the following, assuming that the atmosphere -model is built using a makefile: - -1) Set some environment variable (e.g., CTSM_MKFILE) to point to the - ctsm.mk file generated in CTSM's bld directory. - -2) Modify the atmosphere model's makefile to include the file given by - the environment variable $CTSM_MAKEFILE. - -3) In the compilation line for the atmosphere model, add - $(CTSM_INCLUDES) - -4) In the link line for the atmosphere model, add $(CTSM_LIBS) - -======================================================================== -IV. Running CTSM / LILAC from another atmosphere model -======================================================================== - -After (III), the following steps are needed to stage the inputs needed -for running the atmosphere model - -1) Generate the input namelists following the instructions given in part - (II). - -2) Copy the following files from $SRCROOT/lilac/atm_driver into the - directory from which the atmosphere model will be run: - - - lilac_in - - lnd_in - - lnd_modelio.nml - -3) Run the atmosphere model From 88e065097c414e5e70ad78b26b25038d70e7c4e6 Mon Sep 17 00:00:00 2001 From: wwieder Date: Tue, 7 Jul 2020 11:13:46 -0600 Subject: [PATCH 1153/1973] removed unused code & made requested corrections --- src/biogeochem/CNNStateUpdate1Mod.F90 | 4 ++-- src/biogeochem/CNPhenologyMod.F90 | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/biogeochem/CNNStateUpdate1Mod.F90 b/src/biogeochem/CNNStateUpdate1Mod.F90 index 56e6ddbd55..7657450680 100644 --- a/src/biogeochem/CNNStateUpdate1Mod.F90 +++ b/src/biogeochem/CNNStateUpdate1Mod.F90 @@ -6,7 +6,7 @@ module CNNStateUpdate1Mod ! ! !USES: use shr_kind_mod , only: r8 => shr_kind_r8 - use clm_time_manager , only : get_step_size, get_step_size_real + use clm_time_manager , only : get_step_size_real use clm_varpar , only : nlevdecomp, ndecomp_pools, ndecomp_cascade_transitions use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd use clm_varctl , only : iulog, use_nitrif_denitrif @@ -119,7 +119,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & ) ! set time steps - dt = real( get_step_size(), r8 ) + dt = get_step_size_real() ! soilbiogeochemistry fluxes TODO - this should be moved elsewhere diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 674c27dda5..4e60ca9eb2 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2726,7 +2726,6 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & livestemn_to_deadstemn(p) = ctovr / deadwdcn(ivt(p)) end if - livestemn_to_deadstemn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn end if livestemn_to_retransn(p) = ntovr - livestemn_to_deadstemn(p) @@ -2747,18 +2746,10 @@ subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & livecrootn_to_deadcrootn(p) = ctovr / deadwdcn(ivt(p)) end if -! livecrootn_to_deadcrootn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn end if livecrootn_to_retransn(p) = ntovr - livecrootn_to_deadcrootn(p) -! Allow resorbtion with FUN -! if(use_fun)then -! !TURNED OFF FLUXES TO CORRECT N ACCUMULATION ISSUE. RF. Oct 2015. -! livecrootn_to_retransn(p) = 0.0_r8 -! livestemn_to_retransn(p) = 0.0_r8 -! endif - end if end do From f1dc3f793d3abd028573b17d22ba314cc90cf4bd Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 7 Jul 2020 12:11:19 -0600 Subject: [PATCH 1154/1973] Changes to replicate @olyson's case clm50_ctsm10d089_2deg_GSWP3V1_lmbirch_wkattge_jmaxb1-0.17_slatopA_leafcnA_stemleafA_frtlfA_sdt_hist, bring in source mod changes and paramsfile --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- src/biogeochem/CNPhenologyMod.F90 | 22 ++++++++++++++++--- src/main/pftconMod.F90 | 14 ++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 9c57870814..f73bbbc5e2 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -372,7 +372,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200425.nc +/glade/p/cgd/tss/people/oleson/modify_param/clm5_params.c200425.slatopA_leafcnA_stemleafA_frtlfA_sdt_kwo.c200618.nc lnd/clm2/paramdata/clm_params.c200402.nc diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 9f95f492e9..5277a1c1a9 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -669,6 +669,9 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) +!KO + season_decid_temperate => pftcon%season_decid_temperate , & ! Input: binary flag for seasonal-deciduous temperate leaf habit (0 or 1) +!KO t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) soila10 => temperature_inst%soila10_patch , & ! Input: [real(r8) (:) ] @@ -873,14 +876,27 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday end if - !separate into Arctic boreal and lower latitudes - if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then +!KO !separate into Arctic boreal and lower latitudes +!KO if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then +!KO onset_thresh=1.0_r8 +!KO else if (onset_gddflag(p) == 1.0_r8 .and. soila10(p) > SHR_CONST_TKFRZ .and. & +!KO t_a5min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. & +!KO dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then +!KO onset_thresh=1.0_r8 +!KO end if +!KO + ! separate into non-arctic seasonally deciduous pfts (temperate broadleaf deciduous + ! tree) and arctic/boreal seasonally deciduous pfts (boreal needleleaf deciduous tree, + ! boreal broadleaf deciduous tree, boreal broadleaf deciduous shrub, C3 arctic grass) + if (onset_gdd(p) > crit_onset_gdd .and. season_decid_temperate(ivt(p)) == 1) then onset_thresh=1.0_r8 - else if (onset_gddflag(p) == 1.0_r8 .and. soila10(p) > SHR_CONST_TKFRZ .and. & + else if (season_decid_temperate(ivt(p)) == 0 .and. onset_gddflag(p) == 1.0_r8 .and. & + soila10(p) > SHR_CONST_TKFRZ .and. & t_a5min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. & dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then onset_thresh=1.0_r8 end if +!KO ! set onset_flag if critical growing degree-day sum is exceeded if (onset_thresh == 1.0_r8) then onset_flag(p) = 1.0_r8 diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 27a61403bc..40e1d6c08d 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -201,6 +201,9 @@ module pftconMod real(r8), allocatable :: evergreen (:) ! binary flag for evergreen leaf habit (0 or 1) real(r8), allocatable :: stress_decid (:) ! binary flag for stress-deciduous leaf habit (0 or 1) real(r8), allocatable :: season_decid (:) ! binary flag for seasonal-deciduous leaf habit (0 or 1) +!KO + real(r8), allocatable :: season_decid_temperate(:) ! binary flag for seasonal-deciduous temperate leaf habit (0 or 1) +!KO real(r8), allocatable :: pconv (:) ! proportion of deadstem to conversion flux real(r8), allocatable :: pprod10 (:) ! proportion of deadstem to 10-yr product pool real(r8), allocatable :: pprod100 (:) ! proportion of deadstem to 100-yr product pool @@ -410,6 +413,9 @@ subroutine InitAllocate (this) allocate( this%evergreen (0:mxpft) ) allocate( this%stress_decid (0:mxpft) ) allocate( this%season_decid (0:mxpft) ) +!KO + allocate( this%season_decid_temperate (0:mxpft) ) +!KO allocate( this%dwood (0:mxpft) ) allocate( this%root_density (0:mxpft) ) allocate( this%root_radius (0:mxpft) ) @@ -740,6 +746,11 @@ subroutine InitRead(this) call ncd_io('season_decid', this%season_decid, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) +!KO + call ncd_io('season_decid_temperate', this%season_decid_temperate, 'read', ncid, readvar=readv, posNOTonfile=.true.) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) +!KO + call ncd_io('pftpar20', this%pftpar20, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) @@ -1335,6 +1346,9 @@ subroutine Clean(this) deallocate( this%evergreen) deallocate( this%stress_decid) deallocate( this%season_decid) +!KO + deallocate( this%season_decid_temperate) +!KO deallocate( this%dwood) deallocate( this%root_density) deallocate( this%root_radius) From 82ed3c1e93cd25aba0d5cd1acae62a7851df107a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 7 Jul 2020 12:19:28 -0600 Subject: [PATCH 1155/1973] New tuned jmaxb1 value used in the clm50_ctsm10d089_2deg_GSWP3V1_lmbirch_wkattge_jmaxb1-0.17_slatopA_leafcnA_stemleafA_frtlfA_sdt_hist simulation, this changes it for clm5_0, but we should change it so that these changes only apply to ctsm5_1 --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f73bbbc5e2..ebed9726fe 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -421,7 +421,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .true. .true. -0.093563 +0.17 .false. .false. From 52b6566941b948b28936efded524ff727bc81f1b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 8 Jul 2020 10:15:12 -0600 Subject: [PATCH 1156/1973] Add in/out to type as it's now being used for output --- src/biogeochem/CNNStateUpdate1Mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNNStateUpdate1Mod.F90 b/src/biogeochem/CNNStateUpdate1Mod.F90 index 7657450680..bedb4d3dc1 100644 --- a/src/biogeochem/CNNStateUpdate1Mod.F90 +++ b/src/biogeochem/CNNStateUpdate1Mod.F90 @@ -98,7 +98,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst ! From 9381a6b4551fdecd9c3c3f5f5fabd974a0dff9a0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 9 Jul 2020 15:15:22 -0600 Subject: [PATCH 1157/1973] Get build-namelist working when multiple finidat files could match Get the build-namelist finding of finidat files working when there are more possible sim_years and more than one could match. The previous mechanism relied on the fact that only one could match. Also note that the previous mechanism used st_year to pick finidat files while it should have done that only for transient cases, rather than control cases with a fixed simulation year. This changes that. This also adds a return code for add_default, so that if you set no_fail on, you can query the return code to assess if it failed. Also make sure the namelist defaults are set up correctly for use_init_interp, init_interp_attributes and finidat. All of those need to be carefully coordinated together, otherwise the process won't work correctly. build-namelist unit test passes. A few compare differently to ctsm1.0.dev101, so looking into that. --- bld/CLMBuildNamelist.pm | 71 +++++++++++-------- bld/namelist_files/namelist_defaults_ctsm.xml | 26 +++++-- 2 files changed, 62 insertions(+), 35 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 4ee6a65eda..5be369da58 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2305,47 +2305,61 @@ sub setup_logic_initial_conditions { #} add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_sim_years" ); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_how_close" ); + # + # Figure out which sim_year has a usable finidat file that is closest to the desired one + # my $close = $nl->get_value("init_interp_how_close"); - foreach my $sim_yr ( split( /,/, $nl->get_value("init_interp_sim_years") )) { + my @sim_years = split( /,/, $nl->get_value("init_interp_sim_years") ); +SIMYR: foreach my $sim_yr ( @sim_years ) { my $how_close = undef; if ( $nl_flags->{'sim_year'} eq "PtVg" ) { $how_close = abs(1850 - $sim_yr); + } elsif ( $nl_flags->{'flanduse_timeseries'} == "null" ) { + $how_close = abs($nl_flags->{'sim_year'} - $sim_yr); } else { $how_close = abs($st_year - $sim_yr); } - if ( ($how_close < $nl->get_value("init_interp_how_close")) && ($how_close < $close) ) { - $close = $how_close; - $settings{'sim_year'} = $sim_yr; + if ( ($sim_yr == $sim_years[-1]) || (($how_close < $nl->get_value("init_interp_how_close")) && ($how_close < $close)) ) { + my $group = $definition->get_group_name($useinitvar); + my $val = $nl->set_variable_value($group, $useinitvar, $use_init_interp_default ); + $settings{$useinitvar} = $defaults->get_value($useinitvar, \%settings); + if ( ! defined($settings{$useinitvar}) ) { + $settings{$useinitvar} = ".false."; + } + if ( &value_is_true($nl->get_value($useinitvar) ) ) { + + if ( ($how_close < $nl->get_value("init_interp_how_close")) && ($how_close < $close) ) { + $close = $how_close; + $settings{'sim_year'} = $sim_yr; + } + } } - } + } # SIMYR: add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $useinitvar, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'phys'=>$physv->as_string(), - 'sim_year'=>$settings{'sim_year'}, 'nofail'=>1, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, - 'use_fates'=>$nl_flags->{'use_fates'} ); - $settings{$useinitvar} = $nl->get_value($useinitvar); - if ( $try > 1 ) { - my $group = $definition->get_group_name($useinitvar); - $nl->set_variable_value($group, $useinitvar, $use_init_interp_default ); - } - if ( &value_is_true($nl->get_value($useinitvar) ) ) { - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_attributes", - 'sim_year'=>$settings{'sim_year'}, 'use_cndv'=>$nl_flags->{'use_cndv'}, - 'glc_nec'=>$nl_flags->{'glc_nec'}, 'use_fates'=>$nl_flags->{'use_fates'}, - 'use_cn'=>$nl_flags->{'use_cn'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'},'nofail'=>1 ); - my $attributes_string = remove_leading_and_trailing_quotes($nl->get_value("init_interp_attributes")); + 'use_cndv'=>$nl_flags->{'use_cndv'}, 'phys'=>$physv->as_string(), + 'sim_year'=>$settings{'sim_year'}, 'nofail'=>1, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, + 'use_fates'=>$nl_flags->{'use_fates'} ); + if ( ! &value_is_true($nl->get_value($useinitvar) ) ) { + if ( $nl_flags->{'clm_start_type'} =~ /startup/ ) { + $log->fatal_error("clm_start_type is startup so an initial conditions ($var) file is required, but can't find one without $useinitvar being set to true"); + } + } else { + my $stat = add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_attributes", + 'sim_year'=>$settings{'sim_year'}, 'use_cndv'=>$nl_flags->{'use_cndv'}, + 'glc_nec'=>$nl_flags->{'glc_nec'}, 'use_fates'=>$nl_flags->{'use_fates'}, + 'use_cn'=>$nl_flags->{'use_cn'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, 'nofail'=>1 ); + if ( $stat ) { + $log->fatal_error("$useinitvar is NOT synchronized with init_interp_attributes"); + } + my $attributes = $nl->get_value("init_interp_attributes"); + my $attributes_string = remove_leading_and_trailing_quotes($attributes); foreach my $pair ( split( /\s/, $attributes_string) ) { - if ( $pair =~ /^([a-z_]+)=([a-z._0-9]+)$/ ) { + if ( $pair =~ /^([a-z_]+)=([a-zA-Z._0-9]+)$/ ) { $settings{$1} = $2; } else { - $log->fatal_error("Problem interpreting init_interp_attributes"); + $log->fatal_error("Problem interpreting init_interp_attributes: $pair"); } } - } else { - if ( $nl_flags->{'clm_start_type'} =~ /startup/ ) { - $log->fatal_error("clm_start_type is startup so an initial conditions ($var) file is required, but can't find one without $useinitvar being set to true"); - } - $try = $done; } } else { $try = $done @@ -3974,7 +3988,7 @@ sub add_default { } } else { - return; + return( 1 ); } } @@ -4009,6 +4023,7 @@ sub add_default { # set the value in the namelist $nl->set_variable_value($group, $var, $val); } + return( 0 ); } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 27883ff55b..55e4c51872 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -510,13 +510,25 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 1850,1982,2000,2010 - -.true. -.true. -.true. -.true. -.true. -.false. + + + + +.true. +.true. +.true. +.true. +.false. + .true. .true. + maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4.ARCTIC.ne30x4" >.true. +.true. .true. .true. .false. @@ -593,9 +595,15 @@ attributes from the config_cache.xml file (with keys converted to upper-case). hgrid=ne0np4.ARCTIC.ne30x4 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 +hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + + hgrid=ne120np4.pg3 maxpft=79 mask=tx0.1v3 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 @@ -724,6 +732,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >/glade/work/aherring/grids/var-res/ne0np4.ARCTIC.ne30x4/inic/FHIST_ARCTIC_ne30x4_mt12_1979bc-mg3.clm2.r.1982-01-01-00000_c200424.nc + +/glade/work/aherring/grids/var-res/ne0np4.ARCTICGRIS.ne30x8/inic/FHIST_ARCTICGRIS_ne30x8_mt12_1979bc-mg3.clm2.r.1982-01-01-00000_c200428.nc + + lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc Date: Sat, 11 Jul 2020 23:43:48 -0600 Subject: [PATCH 1161/1973] Make sure finidat files for clm5_cam6 get matched For lower resolutions match the previous f09 file. For higher resolution (or single point or regional) use the new finidat files. Also change the build-namelist test so that transient tests set the start_ymd so that it should find the correct file. --- bld/namelist_files/namelist_defaults_ctsm.xml | 72 ++++++++++++++++++- bld/unit_testers/build-namelist_test.pl | 31 ++++++-- 2 files changed, 93 insertions(+), 10 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 8bd496059a..8998fb97ce 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -517,10 +517,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .true. + .true. + maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4.ARCTIC.ne30x4" >.true. .true. + +.true. .true. .true. .false. @@ -590,10 +594,70 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + + + +hgrid=ne120np4.pg3 maxpft=79 mask=tx0.1v3 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + + + hgrid=ne0np4.ARCTIC.ne30x4 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 @@ -604,8 +668,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 -hgrid=ne120np4.pg3 maxpft=79 mask=tx0.1v3 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + +hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 1ed3b88618..9c88a179a0 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,7 +138,7 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 872; +my $ntests = 862; if ( defined($opts{'compare'}) ) { $ntests += 528; } @@ -335,7 +335,7 @@ sub make_config_cache { "-bgc bgc -use_case 1850-2100_SSP3-7.0_transient -namelist '&a start_ymd=20701029/'", "-bgc fates -use_case 2000_control -no-megan", "-bgc sp -use_case 2000_control -res 0.9x1.25 -namelist '&a use_soil_moisture_streams = T/'", - "-bgc cn -use_case 1850-2100_SSP5-8.5_transient -namelist '&a start_ymd=19201023/'", + "-bgc cn -use_case 1850-2100_SSP5-8.5_transient -namelist '&a start_ymd=19101023/'", "-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop", "-res 0.9x1.25 -bgc bgc -use_case 1850_noanthro_control -drydep -fire_emis -light_res 360x720", ) { @@ -1223,7 +1223,17 @@ sub make_config_cache { ); foreach my $res ( @glc_res ) { foreach my $usecase ( @usecases ) { - $options = "-bgc bgc -res $res -use_case $usecase -envxml_dir . "; + my $startymd = undef; + if ( ($usecase eq "1850_control") || ($usecase eq "20thC_transient") ) { + $startymd = 18500101; + } elsif ( $usecase eq "2000_control") { + $startymd = 20000101; + } elsif ( $usecase eq "2010_control") { + $startymd = 20100101; + } else { + $startymd = 20150101; + } + $options = "-bgc bgc -res $res -use_case $usecase -envxml_dir . -namelist '&a start_ymd=$startymd/'"; &make_env_run(); eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; is( $@, '', "$options" ); @@ -1247,7 +1257,7 @@ sub make_config_cache { my $usecase = "20thC_transient"; my $GLC_NEC = 10; foreach my $res ( @tran_res ) { - $options = "-res $res -use_case $usecase -envxml_dir . "; + $options = "-res $res -use_case $usecase -envxml_dir . -namelist '&a start_ymd=18500101/'"; &make_env_run(); eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; is( $@, '', "$options" ); @@ -1270,8 +1280,14 @@ sub make_config_cache { my @tran_res = ( "0.9x1.25", "1.9x2.5", "10x15" ); foreach my $usecase ( "1850_control", "1850-2100_SSP5-8.5_transient", "1850-2100_SSP1-2.6_transient", "1850-2100_SSP3-7.0_transient", "1850-2100_SSP2-4.5_transient" ) { + my $startymd = undef; + if ( $usecase eq "1850_control") { + $startymd = 18500101; + } else { + $startymd = 20150101; + } foreach my $res ( @tran_res ) { - $options = "-res $res -bgc bgc -crop -use_case $usecase -envxml_dir . "; + $options = "-res $res -bgc bgc -crop -use_case $usecase -envxml_dir . -namelist '&a start_ymd=$startymd/'"; &make_env_run(); eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; is( $@, '', "$options" ); @@ -1292,7 +1308,7 @@ sub make_config_cache { my $res = "0.9x1.25"; foreach my $usecase ( "1850-2100_SSP4-3.4_transient", "1850-2100_SSP5-3.4_transient", "1850-2100_SSP1-1.9_transient", "1850-2100_SSP4-6.0_transient" ) { - $options = "-res $res -bgc bgc -crop -use_case $usecase -envxml_dir . "; + $options = "-res $res -bgc bgc -crop -use_case $usecase -envxml_dir . -namelist '&a start_ymd=20150101/'"; &make_env_run(); eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; isnt( $?, 0, $usecase ); @@ -1307,7 +1323,8 @@ sub make_config_cache { my $mode = "-phys $phys"; &make_config_cache($phys); my @clmoptions = ( "-bgc bgc -envxml_dir .", "-bgc bgc -envxml_dir . -clm_accelerated_spinup=on", "-bgc bgc -envxml_dir . -light_res 360x720", - "-bgc sp -envxml_dir . -vichydro", "-bgc bgc -dynamic_vegetation -ignore_warnings", "-bgc bgc -clm_demand flanduse_timeseries -sim_year 1850-2000", + "-bgc sp -envxml_dir . -vichydro", "-bgc bgc -dynamic_vegetation -ignore_warnings", + "-bgc bgc -clm_demand flanduse_timeseries -sim_year 1850-2000 -namelist '&a start_ymd=18500101/'", "-bgc bgc -envxml_dir . -namelist '&a use_c13=.true.,use_c14=.true.,use_c14_bombspike=.true./'" ); foreach my $clmopts ( @clmoptions ) { my @clmres = ( "10x15", "0.9x1.25", "1.9x2.5" ); From 602657aa54789303ac82d3a5c5986e544bda4b1f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 12 Jul 2020 14:11:34 -0600 Subject: [PATCH 1162/1973] Rename the new finidat files, and add some build-namelist tests for these specific CAM cases --- bld/namelist_files/namelist_defaults_ctsm.xml | 6 ++-- bld/unit_testers/build-namelist_test.pl | 34 +++++++++++++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 8998fb97ce..e7e0b67688 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -795,7 +795,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="19820101" use_nitrif_denitrif=".false." use_vertsoilc=".false." sim_year="1982" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm5_0_cam6.0" use_init_interp=".true." ->/glade/work/aherring/grids/var-res/ne0np4.ARCTIC.ne30x4/inic/FHIST_ARCTIC_ne30x4_mt12_1979bc-mg3.clm2.r.1982-01-01-00000_c200424.nc +>lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTIC_ne30x4_mt12_simyr1982_c200425.nc @@ -803,7 +803,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="19820101" use_nitrif_denitrif=".false." use_vertsoilc=".false." sim_year="1982" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm5_0_cam6.0" use_init_interp=".true." ->/glade/work/aherring/grids/var-res/ne0np4.ARCTICGRIS.ne30x8/inic/FHIST_ARCTICGRIS_ne30x8_mt12_1979bc-mg3.clm2.r.1982-01-01-00000_c200428.nc +>lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTICGRIS_ne30x8_mt12_simyr1982_c200428.nc @@ -811,7 +811,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="60101" use_nitrif_denitrif=".true." use_vertsoilc=".true." sim_year="2000" ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".true." lnd_tuning_mode="clm5_0_cam6.0" use_init_interp=".true." ->/glade/work/aherring/grids/uniform-res/ne120np4.pg3/inic/F2000climoBgcCrop_ne120pg3_ne120pg3_mt13_7680pes.clm2.r.06-01-00000_c200506.nc +>lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200506.nc diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 9c88a179a0..2e881ea856 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 862; +my $ntests = 878; if ( defined($opts{'compare'}) ) { - $ntests += 528; + $ntests += 540; } plan( tests=>$ntests ); @@ -323,6 +323,36 @@ sub make_config_cache { } &cleanup(); } + +print "\n===============================================================================\n"; +print "Test some CAM specific setups for special grids \n"; +print "=================================================================================\n"; +$phys = "clm5_0"; +$mode = "-phys $phys"; +&make_config_cache($phys); +foreach my $options ( + "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res ne0np4CONUS.ne30x8 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", + ) { + &make_env_run(); + eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; + is( $@, '', "options: $options" ); + $cfiles->checkfilesexist( "$options", $mode ); + $cfiles->shownmldiff( "default", $mode ); + if ( defined($opts{'compare'}) ) { + $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); + $cfiles->dodiffonfile( "lnd_in", "$options", $mode ); + $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); + $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); + } + if ( defined($opts{'generate'}) ) { + $cfiles->copyfiles( "$options", $mode ); + } + &cleanup(); +} + print "\n==============================================================\n"; print "Test several use_cases and specific configurations for clm5_0\n"; print "==============================================================\n"; From 7d2ee8e2cad6861ccaf83038e4b88efccac2add6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 12 Jul 2020 15:29:53 -0600 Subject: [PATCH 1163/1973] Add some tests for the new grids --- cime_config/testdefs/testlist_clm.xml | 54 +++++++++++++++++++ .../include_user_mods | 1 + .../shell_commands | 1 + .../include_user_mods | 1 + .../shell_commands | 1 + 5 files changed, 58 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_1979Start/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_1979Start/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_2013Start/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_2013Start/shell_commands diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 3420b41fce..7499b5f555 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1193,6 +1193,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_1979Start/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_1979Start/include_user_mods new file mode 100644 index 0000000000..1c3eece35d --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_1979Start/include_user_mods @@ -0,0 +1 @@ +../clm50cam6LndTuningMode diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_1979Start/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_1979Start/shell_commands new file mode 100644 index 0000000000..2aafcc1186 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_1979Start/shell_commands @@ -0,0 +1 @@ +./xmlchange RUN_STARTDATE=1979-01-01 diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_2013Start/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_2013Start/include_user_mods new file mode 100644 index 0000000000..1c3eece35d --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_2013Start/include_user_mods @@ -0,0 +1 @@ +../clm50cam6LndTuningMode diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_2013Start/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_2013Start/shell_commands new file mode 100644 index 0000000000..035842f982 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode_2013Start/shell_commands @@ -0,0 +1 @@ +./xmlchange RUN_STARTDATE=2013-01-01 From 8c731f21134d4e3086601ac42ea7a56de21af17a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 12 Jul 2020 18:57:22 -0600 Subject: [PATCH 1164/1973] Add 2013 IC file for CONUS --- bld/namelist_files/namelist_defaults_ctsm.xml | 16 +++++++++++++++- bld/namelist_files/namelist_definition_ctsm.xml | 6 +++--- bld/unit_testers/build-namelist_test.pl | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index e7e0b67688..1484c6fa14 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -505,7 +505,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 61 -1850,1982,2000,2010 +1850,1982,2000,2010,2013 +hgrid=ne0np4CONUS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + +lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200705.nc + + diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index e08bb3dfbc..2acbda143e 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1985,7 +1985,7 @@ If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) +"PtVg,1000,850,1100,1350,1600,1850,1855,1865,1875,1885,1895,1905,1915,1925,1935,1945,1955,1965,1975,1979,1980,1982,1985,1995,2000,2005,2010,2013,2015,2025,2035,2045,2055,2065,2075,2085,2095,2105"> Year to simulate and to provide datasets for (such as surface datasets, initial conditions, aerosol-deposition, Nitrogen deposition rates etc.) A sim_year of 1000 corresponds to data used for testing only, NOT corresponding to any real datasets. A sim_year greater than 2015 corresponds to ssp_rcp scenario data @@ -2023,8 +2023,8 @@ Attributes to use when looking for an initial condition file (finidat) if interp How close in years to use when looking for an initial condition file (finidat) if interpolation is turned on (use_init_interp is .true.) - + Simulation years you can look for in initial condition files (finidat) if interpolation is turned on (use_init_interp is .true.) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 2e881ea856..411200f652 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -334,7 +334,7 @@ sub make_config_cache { "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res ne0np4CONUS.ne30x8 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", ) { &make_env_run(); eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; From e732fc1a7968cece94feaeb686b3254ce1038d11 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 12 Jul 2020 19:08:22 -0600 Subject: [PATCH 1165/1973] Use rcp landuse timeseries files for historical as well (for new SE grids), fix the SSP landuse timeseries as well they had use_crop on and the wrong sim_year range --- bld/namelist_files/namelist_defaults_ctsm.xml | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 1484c6fa14..f5f24e97ea 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1067,18 +1067,18 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc - -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc - -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_hist_78pfts_CMIP6_simyr1850-2015_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C24_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc @@ -1105,18 +1105,18 @@ lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_h lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_C96_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200317.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg3_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTICGRIS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.ARCTIC.ne30x4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc +lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne0np4.CONUS.ne30x8_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc Date: Mon, 13 Jul 2020 01:35:13 -0600 Subject: [PATCH 1166/1973] Fix test list, remove previous new grid tests use the new ones, but also correct the grid names --- cime_config/testdefs/testlist_clm.xml | 55 +++------------------------ 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 7499b5f555..09525e2902 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1140,51 +1140,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1193,7 +1148,7 @@ - + @@ -1202,7 +1157,7 @@ - + @@ -1211,7 +1166,7 @@ - + @@ -1229,7 +1184,7 @@ - + @@ -1238,7 +1193,7 @@ - + From 74f137f99cb0082bd5098f33bac9bd9f8a7d2328 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 13 Jul 2020 14:42:00 -0600 Subject: [PATCH 1167/1973] Update change files --- doc/ChangeLog | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 127 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index c08274e32e..6d4e5f42c2 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,130 @@ =============================================================== +Tag name: ctsm1.0.dev105 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) / Chris Fischer +Date: Mon Jul 13 14:41:40 MDT 2020 +One-line Summary: Bring in some new SE grids for CAM as well as initial condition files for them + +Purpose of changes +------------------ + Add new SE (Spectral Element) grids: ne30np4.pg2, ne30np4.pg3, ne30np4, ne60np4, ne120np4, ne120np4.pg2, ne120np4.pg3, + ne0np4CONUS.ne30x8, ne0np4.ARCTIC.ne30x4, ne0np4.ARCTICGRIS.ne30x8 + Add new datasets for them, some new tests, and add support for their creation. + + Also add some new initial condition (IC) files for 1979, 2000, and 2013 for use when coupled to CAM + + The process for picking initial condition files was improved so that there can be more than one year that matches + and it will do the best to pick the best match. Also added the possibility for 1982 and 2013 simulation years. + + Also update cime to a newer version that supports these new grids. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #992 #994 + Fixes #992 -- New initial conditions for 1979, 2000 + Fixes #994 -- New CAM SE grids + Fixes #888 -- Add support for various "physics grids" needed by CAM +CIME Issues fixed (include issue #): #3593, #3569, #3564 + cime/#3593 -- Fix mapping files for new grids + cime/#3569 -- Fix cime regression testing + cime/#3564 -- Change alias for arctic grids + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + Initial conditions (IC) for 1979 start date is technically 1982 + New initial condition files are ONLY for when coupled to CAM (B and F compsets) + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Allow for new grids + User updates to cime: + - Allow a user supplied config_grids.xml file. + - Improved error message for incorrect setting of cime model. + +Changes made to namelist defaults (e.g., changed parameter values): Add IC files for 1982 and 2013 years + +Changes to the datasets (e.g., parameter, surface or initial files): New SE grid datasets + Remove conus_30_x8 grid (previous name for new ne0np4CONUS.ne30x8 grid + Add new grids: ne30np4.pg2, ne30np4.pg3, ne30np4, ne60np4, ne120np4, ne120np4.pg2, ne120np4.pg3, + ne0np4CONUS.ne30x8, ne0np4.ARCTIC.ne30x4, ne0np4.ARCTICGRIS.ne30x8 + Add new mask: tx0.1v3 + New IC files: 1982 for ARCTIC and ARCTICGRIS, ne120np4 for 2000 and 2013 for CONUS all when coupled to CAM + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Initial condition picking will pick the file it finds with the closet simulation year to the request + for the lnd_tuning_mode desired. It will pick based on year over an exact match in resolution. + You can get around this by setting use_init_interp to be specific for a resolution + +Changes to tests or testing: Added tests for new grids + +Code reviewed by: self, fischer-ncar, adamrher + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + izumi - OK (121 tests fail comparison to previous verison due to new IC files) + + tools-tests (test/tools): + + izumi - + + PTCLM testing (tools/shared/PTCLM/test): + + izumi - OK + + python testing (see instructions in python/README.md; document testing done): + + izumi -- PASS + + regular tests (aux_clm): + + cheyenne ---- + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime + cime updated to cime5.8.28 (from branch_tags/cime5.8.24_a01) + +Pull Requests that document the changes (include PR ids): #1038 +(https://github.com/ESCOMP/ctsm/pull) + #1038 -- New fsufdat and landuse time series files for ne grids + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev104 Originator(s): sacks (Bill Sacks) Date: Mon Jul 6 09:58:15 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index c773cf9101..e698eadba8 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev105 erik/fis 07/13/2020 Bring in some new SE grids for CAM as well as initial condition files for them ctsm1.0.dev104 sacks 07/06/2020 Add LILAC ctsm1.0.dev103 slevis 06/29/2020 Gridcell-level error-check for methane (CH4) ctsm1.0.dev102 erik/ole 06/26/2020 Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 From a0f1a46fb5b8a200ffffc0360acccdb0d9885686 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 13 Jul 2020 15:14:24 -0600 Subject: [PATCH 1168/1973] Remove conus_30_x8 in light of new name ne0np4CONUS.ne30x8 --- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 2acbda143e..e540540813 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1948,7 +1948,7 @@ CLM run type. + valid_values="512x1024,360x720cru,128x256,64x128,48x96,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,0.125nldas2,5x5_amazon,1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ,1x1_brazil,1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4.pg2,ne30np4.pg3,ne30np4,ne60np4,ne120np4,ne120np4.pg2,ne120np4.pg3,ne0np4CONUS.ne30x8,ne0np4.ARCTIC.ne30x4,ne0np4.ARCTICGRIS.ne30x8,ne240np4,1km-merge-10min,C24,C48,C96,C192,C384"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min, 1km-merge-10min and 0.33x0.33 are only used for CLM toolsI From 88a733325a87d78e58099ad15a7f8d28cc493f83 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 13 Jul 2020 15:45:59 -0600 Subject: [PATCH 1169/1973] Change name for conus grid mapping files to ne0np4CONUS.ne30x8 and add new SCRIP grid files for all the new grids --- bld/namelist_files/namelist_defaults_ctsm.xml | 40 +++++++++---------- .../namelist_defaults_ctsm_tools.xml | 20 ++++++---- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f5f24e97ea..abd0e6f083 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -3003,47 +3003,47 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts - + -lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_nomask_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_GLOBE-Gardner_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_LandScan2004_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_10x10min_nomask_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_0.5x0.5_MODIS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_ORNL-Soil_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_0.5x0.5_AVHRR_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_MODIS-wCsp_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_1km-merge-10min_HYDRO1K-merge-nomask_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_360x720cru_cruncep_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_10x10min_IGBPmergeICESatGIS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_GLOBE-Gardner-mergeGIS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_0.9x1.25_GRDC_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_ISRIC-WISE_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_USGS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_0.25x0.25_MODIS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_MODISv2_to_conus_30_x8_nomask_aave_da_c190505.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_IGBP-GSDP_to_conus_30_x8_nomask_aave_da_c181003.nc - + diff --git a/bld/namelist_files/namelist_defaults_ctsm_tools.xml b/bld/namelist_files/namelist_defaults_ctsm_tools.xml index de68cfca89..32b8f9bbc7 100644 --- a/bld/namelist_files/namelist_defaults_ctsm_tools.xml +++ b/bld/namelist_files/namelist_defaults_ctsm_tools.xml @@ -46,15 +46,21 @@ attributes from the config_cache.xml file (with keys converted to upper-case). atm/cam/coords/C24_SCRIP_desc.181018.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne240np4_nomask_c091227.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne120np4_nomask_c101123.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne60np4_nomask_c100408.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne30np4_nomask_c101123.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne16np4_nomask_c110512.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne4np4_nomask_c110808.nc +lnd/clm2/mappingdata/grids/SCRIPgrid_ne240np4_nomask_c091227.nc +lnd/clm2/mappingdata/grids/SCRIPgrid_ne120np4_nomask_c101123.nc +lnd/clm2/mappingdata/grids/SCRIPgrid_ne60np4_nomask_c100408.nc +lnd/clm2/mappingdata/grids/SCRIPgrid_ne30np4_nomask_c101123.nc +lnd/clm2/mappingdata/grids/SCRIPgrid_ne16np4_nomask_c110512.nc + +atm/cam/coords/ne30pg2_scrip_c170608.nc +atm/cam/coords/ne30pg3_scrip_170604.nc +atm/cam/coords/ne120pg2_scrip_c170629.nc +atm/cam/coords/ne120pg3_scrip_c170628.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_conus_30_x8_nomask_c170111.nc +atm/cam/coords/ne0CONUSne30x8_scrip_c200107.nc +atm/cam/coords/ne0ARCTICGRISne30x8_scrip_c191209.nc +atm/cam/coords/ne0ARCTICne30x4_scrip_c191212.nc Date: Mon, 13 Jul 2020 15:51:40 -0600 Subject: [PATCH 1170/1973] Update on testing --- doc/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 6d4e5f42c2..61f3cc2e47 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev105 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) / Chris Fischer -Date: Mon Jul 13 14:41:40 MDT 2020 +Date: Mon Jul 13 15:51:21 MDT 2020 One-line Summary: Bring in some new SE grids for CAM as well as initial condition files for them Purpose of changes @@ -90,7 +90,7 @@ CTSM testing: regular tools-tests (test/tools): - izumi - + izumi - OK PTCLM testing (tools/shared/PTCLM/test): From 9652d126c83a8701a1ccafee2e27bfb5d5c5c551 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 14 Jul 2020 13:55:30 -0600 Subject: [PATCH 1171/1973] Bring in changes from release-clm5.0.31-34 Bring in changes from release-clm5.0.31-releas-clm5.0.34 except for the documentation updates, SSP 2100-2300 extension, manage_externals update, and externals update. Changes were brought in using patch, and removing the changes that were unneeded. --- bld/CLMBuildNamelist.pm | 15 +- .../namelist_defaults_ctsm_tools.xml | 10 +- bld/unit_testers/build-namelist_test.pl | 15 +- .../cmip6_waccm_deck/shell_commands | 3 + doc/ChangeSum | 4 + test/tools/README.testnames | 15 +- test/tools/input_tests_master | 3 + test/tools/nl_files/mksrfdt_f09_PtVg | 1 + test/tools/tests_pretag_cheyenne_nompi | 1 + tools/contrib/README | 6 + tools/contrib/singlept | 6 +- tools/contrib/ssp_anomaly_forcing_smooth | 343 ++++++++++++++++++ tools/mksurfdata_map/README | 3 + tools/mksurfdata_map/mksurfdata.pl | 56 ++- 14 files changed, 442 insertions(+), 39 deletions(-) create mode 100755 cime_config/usermods_dirs/cmip6_waccm_deck/shell_commands create mode 100644 test/tools/nl_files/mksrfdt_f09_PtVg create mode 100755 tools/contrib/ssp_anomaly_forcing_smooth diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index db6fc6cb55..f460538aed 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1807,7 +1807,8 @@ sub setup_logic_co2_type { my $group = $definition->get_group_name($var); $nl->set_variable_value($group, $var, $opts->{$var}); } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'sim_year'=>$nl_flags->{'sim_year'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'sim_year'=>$nl_flags->{'sim_year'}, + 'ssp_rcp'=>$nl_flags->{'ssp_rcp'} ); } } } @@ -2177,7 +2178,7 @@ sub setup_logic_surface_dataset { $log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with ecosystem dynamics (use_fates=.true)." ); } add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsurdat', - 'hgrid'=>$nl_flags->{'res'}, + 'hgrid'=>$nl_flags->{'res'}, 'ssp_rcp'=>$nl_flags->{'ssp_rcp'}, 'sim_year'=>$nl_flags->{'sim_year'}, 'irrigate'=>$nl_flags->{'irrigate'}, 'use_crop'=>$nl_flags->{'use_crop'}, 'glc_nec'=>$nl_flags->{'glc_nec'}); } @@ -3097,9 +3098,17 @@ sub setup_logic_nitrogen_deposition { 'use_cn'=>$nl_flags->{'use_cn'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, 'hgrid'=>"0.9x1.25", 'ssp_rcp'=>$nl_flags->{'ssp_rcp'}, 'nofail'=>1 ); if ( ! defined($nl->get_value('stream_fldfilename_ndep') ) ) { + # Also check at f19 resolution add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_ndep', 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, - 'hgrid'=>"1.9x2.5", 'ssp_rcp'=>$nl_flags->{'ssp_rcp'} ); + 'hgrid'=>"1.9x2.5", 'ssp_rcp'=>$nl_flags->{'ssp_rcp'}, 'nofail'=>1 ); + # If not found report an error + if ( ! defined($nl->get_value('stream_fldfilename_ndep') ) ) { + $log->warning("Did NOT find the Nitrogen-deposition forcing file (stream_fldfilename_ndep) for this ssp_rcp\n" . + "One way to get around this is to point to a file for another existing ssp_rcp in your user_nl_clm file.\n" . + "If you are running with CAM and WACCM chemistry Nitrogen deposition will come through the coupler.\n" . + "This file won't be used, so it doesn't matter what it points to -- but it's required to point to something.\n" ) + } } } else { # If bgc is NOT CN/CNDV then make sure none of the ndep settings are set! diff --git a/bld/namelist_files/namelist_defaults_ctsm_tools.xml b/bld/namelist_files/namelist_defaults_ctsm_tools.xml index de68cfca89..1ce6bbdc3c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm_tools.xml +++ b/bld/namelist_files/namelist_defaults_ctsm_tools.xml @@ -265,6 +265,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/rawdata/mksrf_urban_0.05x0.05_simyr2000.c120621.nc +lnd/clm2/rawdata/mksrf_urban_0.05x0.05_zerourbanpct.c181014.nc + lnd/clm2/rawdata/mksrf_gdp_0.5x0.5_AVHRR_simyr2000.c130228.nc +lnd/clm2/rawdata/mksrf_gdp_0.5x0_zerogdp.c200413.nc lnd/clm2/rawdata/mksrf_peatf_0.5x0.5_AVHRR_simyr2000.c130228.nc @@ -303,6 +308,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/rawdata/mksrf_abm_0.5x0.5_AVHRR_simyr2000.c130201.nc +lnd/clm2/rawdata/mksrf_abm_0.5x0.5_missingabm.c200413.nc + lnd/clm2/rawdata/mksrf_topostats_1km-merge-10min_HYDRO1K-merge-nomask_simyr2000.c130402.nc @@ -4666,7 +4674,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index b8b7157703..70ca68e131 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 834; +my $ntests = 897; if ( defined($opts{'compare'}) ) { - $ntests += 507; + $ntests += 552; } plan( tests=>$ntests ); @@ -1010,6 +1010,11 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, + "missing_ndep_file" =>{ options=>"-envxml_dir . -bgc bgc -ssp_rcp SSP5-3.4", + namelst=>"", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_0", + }, "bad_megan_spec" =>{ options=>"-envxml_dir . -bgc bgc -megan", namelst=>"megan_specifier='ZZTOP=zztop'", GLC_TWO_WAY_COUPLING=>"FALSE", @@ -1211,7 +1216,7 @@ sub make_config_cache { $phys = "clm4_5"; $mode = "-phys $phys"; &make_config_cache($phys); -my @glc_res = ( "48x96", "0.9x1.25", "1.9x2.5" ); +my @glc_res = ( "0.9x1.25", "1.9x2.5" ); my @use_cases = ( "1850-2100_SSP1-2.6_transient", "1850-2100_SSP2-4.5_transient", "1850-2100_SSP3-7.0_transient", @@ -1222,7 +1227,7 @@ sub make_config_cache { "20thC_transient", ); foreach my $res ( @glc_res ) { - foreach my $usecase ( @usecases ) { + foreach my $usecase ( @use_cases ) { $options = "-bgc bgc -res $res -use_case $usecase -envxml_dir . "; &make_env_run(); eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; @@ -1243,7 +1248,7 @@ sub make_config_cache { $phys = "clm5_0"; $mode = "-phys $phys"; &make_config_cache($phys); -my @tran_res = ( "48x96", "0.9x1.25", "1.9x2.5", "ne30np4", "10x15" ); +my @tran_res = ( "0.9x1.25", "1.9x2.5", "ne30np4", "10x15" ); my $usecase = "20thC_transient"; my $GLC_NEC = 10; foreach my $res ( @tran_res ) { diff --git a/cime_config/usermods_dirs/cmip6_waccm_deck/shell_commands b/cime_config/usermods_dirs/cmip6_waccm_deck/shell_commands new file mode 100755 index 0000000000..5b872fb7bc --- /dev/null +++ b/cime_config/usermods_dirs/cmip6_waccm_deck/shell_commands @@ -0,0 +1,3 @@ +#!/bin/bash +# Turn ignore-warnings on, so won't abort on missing ndep file, as WACCM should provide it +./xmlchange --append CLM_BLDNML_OPTS="--ignore_warnings" diff --git a/doc/ChangeSum b/doc/ChangeSum index c773cf9101..097542e220 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,9 @@ Tag Who Date Summary ============================================================================================================================ +release-clm5.0.34 erik 04/20/2020 Update doc for release-clm5.0 (SKIPPED), and fix issues with no-anthro surface dataset creation +release-clm5.0.33 erik 04/07/2020 SKIPPED ON MASTER -- Turn irrigation on for 2300 SSP extensions +release-clm5.0.32 erik 04/02/2020 SKIPPED ON MASTER -- Extensions to 2300 for SSP5-8.5,SSP5-3.4, and SSP1-2.6 +release-clm5.0.31 erik 03/29/2020 Bring raw 2100-2300 extension (SKIPPED), some other misc. changes ctsm1.0.dev104 sacks 07/06/2020 Add LILAC ctsm1.0.dev103 slevis 06/29/2020 Gridcell-level error-check for methane (CH4) ctsm1.0.dev102 erik/ole 06/26/2020 Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 diff --git a/test/tools/README.testnames b/test/tools/README.testnames index 2795a14f0a..eb6d50f38c 100644 --- a/test/tools/README.testnames +++ b/test/tools/README.testnames @@ -24,16 +24,17 @@ n is the configuration type: 0 -- unused a -- unused b -- unused -c -- mkprocdata_map clm4.5 -d -- mkmapgrids clm4.5 -e -- gen_domain clm4.5 -f -- PTCLM clm4.5 -g -- mksurfdata_map clm4.5 -h -- interpinic clm4.5 -i -- tools scripts clm4.5 +c -- mkprocdata_map clm5.0 +d -- mkmapgrids clm5.0 +e -- gen_domain clm5.0 +f -- PTCLM clm5.0 +g -- mksurfdata_map clm5.0 +h -- interpinic clm5.0 +i -- tools scripts clm5.0 m is the resolution +0 -- 0.9x1.25 1 -- 48x96 5 -- 10x15 6 -- 5x5_amazon diff --git a/test/tools/input_tests_master b/test/tools/input_tests_master index 4050873b42..be6cf8f454 100644 --- a/test/tools/input_tests_master +++ b/test/tools/input_tests_master @@ -14,6 +14,9 @@ blg54 TBLtools.sh mksurfdata_map tools__s namelist smi24 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_T31_crpglc_2000^tools__ds bli24 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_T31_crpglc_2000^tools__ds +smi04 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_f09_PtVg^tools__ds +bli04 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_f09_PtVg^tools__ds + smi53 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__o bli53 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__o smi54 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__ds diff --git a/test/tools/nl_files/mksrfdt_f09_PtVg b/test/tools/nl_files/mksrfdt_f09_PtVg new file mode 100644 index 0000000000..61c2d8325e --- /dev/null +++ b/test/tools/nl_files/mksrfdt_f09_PtVg @@ -0,0 +1 @@ +-l CSMDATA -r 0.9x1.25 -no-crop -y PtVg -exedir EXEDIR diff --git a/test/tools/tests_pretag_cheyenne_nompi b/test/tools/tests_pretag_cheyenne_nompi index 1f35731f8d..b80d9a78c1 100644 --- a/test/tools/tests_pretag_cheyenne_nompi +++ b/test/tools/tests_pretag_cheyenne_nompi @@ -2,6 +2,7 @@ smc#4 blc#4 sme14 ble14 sme@4 ble@4 smg54 blg54 +smi04 bli04 smi24 bli24 smi53 bli53 smi64 bli64 diff --git a/tools/contrib/README b/tools/contrib/README index c8338a1a8e..bae1b51ca9 100644 --- a/tools/contrib/README +++ b/tools/contrib/README @@ -38,5 +38,11 @@ run_clmtowers It's based on having created surface datasets with PTCLM. v1 - Keith Oleson, 8/2015 +ssp_anomaly_forcing_smooth + This script creates anomaly forcing for CMIP6 SSP scenarios that + can be used to run CTSM in CESM with datm. + v0 -- Sean Swenson + v1 - Peter Lawrence 3/2020 + diff --git a/tools/contrib/singlept b/tools/contrib/singlept index d8c344f53e..076e67453b 100755 --- a/tools/contrib/singlept +++ b/tools/contrib/singlept @@ -116,7 +116,7 @@ datm_eyr=2014 #-- Modify landunit structure overwrite_single_pft = True dominant_pft = 7 #BETr -zero_nonveg_pfts = True +zero_nonveg_landunits= True uniform_snowpack = True no_saturation_excess = True @@ -204,7 +204,7 @@ if create_surfdata: if overwrite_single_pft: f3['PCT_NAT_PFT'][:,:,:] = 0 f3['PCT_NAT_PFT'][:,:,dominant_pft] = 100 - if zero_nonveg_pfts: + if zero_nonveg_landunits: f3['PCT_NATVEG'][:,:] = 100 f3['PCT_CROP'][:,:] = 0 f3['PCT_LAKE'][:,:] = 0. @@ -233,7 +233,7 @@ if create_surfdata: f1.to_netcdf(path='~/junk.nc', mode='w') #f1.to_netcdf(path=fsurf2, mode='w') f1.close() - if zero_nonveg_pfts: + if zero_nonveg_landunits: #f1 = xr.open_dataset(fsurf2) f1 = xr.open_dataset('~/junk.nc') f1['PCT_NATVEG'] = 100 diff --git a/tools/contrib/ssp_anomaly_forcing_smooth b/tools/contrib/ssp_anomaly_forcing_smooth new file mode 100755 index 0000000000..fa2350bcb9 --- /dev/null +++ b/tools/contrib/ssp_anomaly_forcing_smooth @@ -0,0 +1,343 @@ +#! /usr/bin/env python +# +# ssp_anomaly_forcing_smooth +# +# Create anomoly forcing datasets for SSP scenarios that can be used by CESM datm model +# +import sys +import os +import string +import subprocess +import datetime +import numpy as np +import matplotlib.pyplot as plt +import netCDF4 as netcdf4 +from scipy import interpolate + +# load proper modules first, i.e. +# cheyenne +''' +module load python/2.7.16 +ncar_pylib +#module load numpy/1.12.0 +#module load matplotlib/2.0.0 +#module load scipy/0.18.1 +#module load intel/16.0.3 +#module load ncarcompilers/0.3.5 +#module load netcdf/4.4.1.1 +#module load netcdf4-python/1.2.7 +''' + +# caldera / geyser + +''' +module load python/2.7.7 +module load numpy/1.11.0 +module load pyside/1.1.2 +module load matplotlib/1.5.1 +module load scipy/0.18.1 +module load netcdf4python/1.2.4 +''' + +#------------------------------------------------------- +""" + +This script creates CLM anomaly forcing data + +""" +#------------------------------------------------------- + +#-- end of function definitions --------------------------------- +#0 + +print( "Create anomoly forcing data that can be used by CTSM in CESM" ) +# Input and output directories make sure they exist +datapath = "/glade/p/cgd/tss/historyfiles/" # Path on cheyenne +spath = './' +if ( os.path.exists(datapath) ): + print( "Input data directory:"+datapath ) +else: + sys.exit( "Could not find input directory: "+datapath ) +if ( os.path.exists(spath) ): + print( "Output data directory:"+spath ) +else: + sys.exit( "Could not find output directory: "+spath ) + +# Settings to run with +today = datetime.date.today() +creationdate = "_c"+today.strftime( "%Y%m%d" ) +historydate = today.strftime( "%a %b %d %Y" ) +sspnum = 4 +smoothsize = 5 + +hist_case = 'b.e21.BHIST.f09_g17.CMIP6-historical.010' + +if sspnum == 1: + # SSP1-26 + ssptag = 'SSP1-2.6' + fut_case = 'b.e21.BSSP126cmip6.f09_g17.CMIP6-SSP1-2.6.001' +elif sspnum == 2: + # SSP3-70 + ssptag = 'SSP3-7.0' + fut_case = 'b.e21.BSSP370cmip6.f09_g17.CMIP6-SSP3-7.0.001' +elif sspnum == 3: + # SSP5-85 + ssptag = 'SSP5-8.5' + fut_case = 'b.e21.BSSP585cmip6.f09_g17.CMIP6-SSP5-8.5.001' +elif sspnum == 4: + # SSP2-45 + ssptag = 'SSP2-4.5' + fut_case = 'b.e21.BSSP245cmip6.f09_g17.CMIP6-SSP2-4.5.001' +else: + sys.exit( "sspnum is out of range: "+sspnum ) + +sspoutdir = 'anomaly_forcing/CMIP6-'+ssptag + +outdir = spath + sspoutdir +if ( not os.path.exists(outdir) ): + os.makedirs( outdir ) + +print( "Output specific data directory :"+outdir ) + + +hist_yrstart = 2000 +hist_yrend = 2014 +hist_nyrs = hist_yrend - hist_yrstart + 1 + +fut1_yrstart = 2015 +fut1_yrend = 2064 +fut1_nyrs = fut1_yrend - fut1_yrstart + 1 + +fut2_yrstart = 2065 +fut2_yrend = 2100 +fut2_nyrs = fut2_yrend - fut2_yrstart + 1 + +fut_yrstart = 2015 +fut_yrend = 2100 +fut_nyrs = fut_yrend - fut_yrstart + 1 + +tot_yrstart = 2000 +tot_yrend = 2100 +tot_nyrs = tot_yrend - tot_yrstart + 1 + +nmo = 12 +histnm = nmo*hist_nyrs +futnm = nmo*fut_nyrs +totnm = nmo*tot_nyrs +outnm = nmo*fut_nyrs + +dpath = datapath +dfile = '/lnd/proc/tseries/month_1/' +hdir = dpath+hist_case+dfile +fdir = dpath+fut_case+dfile + +# Check that directories exist +if ( os.path.exists(hdir) ): + print( "Data file directory:"+hdir ) +else: + sys.exit( "Could not find directory: "+hdir ) +if ( os.path.exists(fdir) ): + print( "Data file directory:"+fdir ) +else: + sys.exit( "Could not find directory: "+fdir ) + +print( "\n\n\n" ) + +# needed to use QBOT and U10, not using V and U(for sfcwind) +field_in = [ 'TBOT', 'RAIN', 'SNOW', 'FSDS', 'FLDS', 'QBOT', 'PBOT'] +field_combine = [ 0, 1, 1, 0, 0, 0, 0] +field_out = [ 'tas', 'pr', 'pr', 'rsds', 'rlds', 'huss', 'ps'] +units = [ 'K', ' ', ' ', ' ', ' ', 'kg/kg', 'Pa'] +units_disp = [ 'K', 'mm/s', 'mm/s', 'W m!U-2!N', 'W m!U-2!N', 'kg/kg', 'Pa'] +anomsf = ['anomaly','scale factor','scale factor','scale factor','scale factor','anomaly','anomaly'] + +nfields = len(field_in) + +#-- Read coordinates +landfile = hdir+hist_case+'.clm2.h0.TBOT.'+str(hist_yrstart)+'01-'+str(hist_yrend)+'12.nc' +if ( os.path.exists(landfile) ): + print( "Land File: "+landfile ) +else: + sys.exit( "Could not find land file: "+landfile ) + +f1 = netcdf4.Dataset(landfile, 'r') +landfrac=np.asfarray(f1.variables['landfrac'][:,:],np.float64) +landmask=np.asfarray(f1.variables['landmask'][:,:],np.float64) +area=np.asfarray(f1.variables['area'][:,:],np.float64) +lon = np.asfarray(f1.variables['lon'][:],np.float64) +lat = np.asfarray(f1.variables['lat'][:],np.float64) +nlat = lat.size +nlon = lon.size +f1.close() +ind=np.where(landfrac > 1.e10) +landfrac[ind]=0 + +#-- Loop over forcing fields ------------------------------------ +fieldskip = 0 +for f in range(nfields): + # read in last ten years of historical data ------------------ + + infieldname1 = field_in[f] + infieldcombine1 = field_combine[f] + if ((infieldcombine1 == 1 and fieldskip == 0) or (infieldcombine1 == 0 and fieldskip == 0)): + hvarfile1 = hdir+hist_case+'.clm2.h0.'+infieldname1+'.'+str(hist_yrstart)+'01-'+str(hist_yrend)+'12.nc' + fvarfile1 = fdir+fut_case+'.clm2.h0.'+infieldname1+'.'+str(fut1_yrstart)+'01-'+str(fut1_yrend)+'12.nc' + fvarfile2 = fdir+fut_case+'.clm2.h0.'+infieldname1+'.'+str(fut2_yrstart)+'01-'+str(fut2_yrend)+'12.nc' + hf1 = netcdf4.Dataset(hvarfile1, 'r') + ff1 = netcdf4.Dataset(fvarfile1, 'r') + ff2 = netcdf4.Dataset(fvarfile2, 'r') + hvarvalues1 = np.asfarray(hf1.variables[infieldname1][:],np.float64) + htime1 = np.asfarray(hf1.variables['time'][:],np.float64) + print( 'Reading: ' + hvarfile1 ) + fvarvalues1 = np.asfarray(ff1.variables[infieldname1][:],np.float64) + ftime1 = np.asfarray(ff1.variables['time'][:],np.float64) + long_name = ff1.variables[field_in[f]].long_name + print( 'Reading: ' + fvarfile1 ) + fvarvalues2 = np.asfarray(ff2.variables[infieldname1][:],np.float64) + ftime2 = np.asfarray(ff2.variables['time'][:],np.float64) + print( 'Reading: ' + fvarfile2 ) + hf1.close() + ff1.close() + ff2.close() + if (infieldcombine1 == 1): + infieldname2 = field_in[f+1] + infieldcombine2 = field_combine[f+1] + hvarfile2 = hdir+hist_case+'.clm2.h0.'+infieldname2+'.'+str(hist_yrstart)+'01-'+str(hist_yrend)+'12.nc' + fvarfile3 = fdir+fut_case+'.clm2.h0.'+infieldname2+'.'+str(fut1_yrstart)+'01-'+str(fut1_yrend)+'12.nc' + fvarfile4 = fdir+fut_case+'.clm2.h0.'+infieldname2+'.'+str(fut2_yrstart)+'01-'+str(fut2_yrend)+'12.nc' + hf2 = netcdf4.Dataset(hvarfile2, 'r') + ff3 = netcdf4.Dataset(fvarfile3, 'r') + ff4 = netcdf4.Dataset(fvarfile4, 'r') + hvarvalues1 = hvarvalues1 + np.asfarray(hf2.variables[infieldname2][:],np.float64) + print( 'Reading: ' + hvarfile2 ) + fvarvalues1 = fvarvalues1 + np.asfarray(ff3.variables[infieldname2][:],np.float64) + print( 'Reading: ' + fvarfile3 ) + fvarvalues2 = fvarvalues2 + np.asfarray(ff4.variables[infieldname2][:],np.float64) + print( 'Reading: ' + fvarfile4 ) + hf2.close() + ff3.close() + ff4.close() + fieldskip = 1 + + allvarvalues = np.concatenate((hvarvalues1,fvarvalues1,fvarvalues2),axis=0) + alltime = np.concatenate((htime1,ftime1,ftime2),axis=0) + ftime = np.concatenate((ftime1,ftime2),axis=0) + outtime = ftime - 16 + histavgvalues = np.zeros((nmo,nlat,nlon)) + histavgcount = np.zeros((nmo)) + runningavgvalues = np.zeros((nlat,nlon)) + runningavgcount = 0.0 + outputvarvalues = np.zeros((outnm,nlat,nlon)) + + for hmonthindex in range(histnm): + havgmonthnum = (hmonthindex) % 12 + 1 + havgmonthindex = havgmonthnum - 1 + histavgvalues[havgmonthindex,:,:] = histavgvalues[havgmonthindex,:,:] * histavgcount[havgmonthindex] + histavgvalues[havgmonthindex,:,:] = histavgvalues[havgmonthindex,:,:] + allvarvalues[hmonthindex,:,:] + histavgcount[havgmonthindex] = histavgcount[havgmonthindex] + 1.0 + histavgvalues[havgmonthindex,:,:] = histavgvalues[havgmonthindex,:,:] / histavgcount[havgmonthindex] + + for fmonthindex in range(futnm): + allmonthindex = fmonthindex + histnm + allyearindex = int(allmonthindex / nmo) + favgmonthnum = (allmonthindex) % 12 + 1 + favgmonthindex = favgmonthnum - 1 + + firstmonthindex = allmonthindex - nmo * smoothsize + if allyearindex <= (tot_nyrs - smoothsize): + lastmonthindex = allmonthindex + nmo * smoothsize + else: + lastmonthindex = allmonthindex + nmo * (tot_nyrs - allyearindex) + + runningavgvalues = 0.0 + runningavgcount = 0.0 + for smonthindex in range(firstmonthindex,lastmonthindex,nmo): + runningavgvalues = runningavgvalues * runningavgcount + runningavgvalues = runningavgvalues + allvarvalues[smonthindex,:,:] + runningavgcount = runningavgcount + 1.0 + runningavgvalues = runningavgvalues / runningavgcount + + climoavgvalues = histavgvalues[favgmonthindex,:,:] + if anomsf[f] == 'anomaly': + anomvalues = runningavgvalues - climoavgvalues + + if anomsf[f] == 'scale factor': + anomvalues = np.ones((nlat,nlon),dtype=np.float64) + + nonzeroindex = np.where(climoavgvalues != 0.0) + anomvalues[nonzeroindex] = runningavgvalues[nonzeroindex]/climoavgvalues[nonzeroindex] + + max_scale_factor = 5. + if field_in[f] == 'FSDS': + max_scale_factor = 2. + overmaxindex=np.where(anomvalues > max_scale_factor) + anomvalues[overmaxindex] = max_scale_factor + + outputvarvalues[fmonthindex,:,:] = anomvalues + + # create netcdf file --------------------------------- + + outfilename = outdir + '/'+'af.'+field_out[f]+'.cesm2.'+ssptag+'.'+str(fut_yrstart)+'-'+str(fut_yrend)+creationdate+'.nc' + print( 'Creating: ' + outfilename ) + outfile = netcdf4.Dataset(outfilename, 'w') + + outfile.source_file1 = hvarfile1 + outfile.source_file2 = fvarfile1 + outfile.source_file3 = fvarfile2 + outfile.title = 'anomaly forcing data' + outfile.note1 = 'Anomaly/scale factors calculated relative to ' \ + +str(hist_yrstart)+'-'+str(hist_yrend) \ + +' climatology from CESM2 historical simulation (case name: '+hist_case+')' + outfile.note2 = ssptag+' '+str(fut_yrstart)+'-'+str(fut_yrend) \ + +' from CESM simulations (case names: '+fut_case[0]+' and '+fut_case[1]+')' + outfile.smoothsize = str(smoothsize) + outfile.history = historydate + ": created by "+sys.argv[0] + stdout = os.popen( "git describe" ) + outfile.gitdescribe = stdout.read().rstrip() + + outfile.createDimension('lat', size=int(nlat)) + outfile.createDimension('lon', size=int(nlon)) + outfile.createDimension('time', size=None) + + wtime = outfile.createVariable('time',np.float64,('time',)) + wlat = outfile.createVariable('lat',np.float64,('lat',)) + wlon = outfile.createVariable('lon',np.float64,('lon',)) + wmask = outfile.createVariable('landmask',np.int32,('lat','lon')) + warea = outfile.createVariable('area',np.float64,('lat','lon')) + wfrac = outfile.createVariable('landfrac',np.float64,('lat','lon')) + wvar = outfile.createVariable(field_out[f],np.float64,('time','lat','lon'),fill_value=np.float64(1.e36)) + + wtime.units = 'days since ' + str(fut_yrstart) + '-01-01 00:00:00' + wlon.units = 'degrees' + wlat.units = 'degrees' + wvar.units = units[f] + warea.units = 'km2' + wfrac.units = 'unitless' + wmask.units = 'unitless' + + #wtime.long_name = 'Months since January '+str(fut_yrstart) + wtime.long_name = 'days since ' + str(fut_yrstart) + '-01-01 00:00:00' + wlon.long_name = 'Longitude' + wlat.long_name = 'Latitude' + wvar.long_name = str(long_name)+' '+anomsf[f] + warea.long_name = 'Grid cell area' + wfrac.long_name = 'Grid cell land fraction' + wmask.long_name = 'Grid cell land mask' + + wtime.calendar = 'noleap' + + # write to file -------------------------------------------- + #wtime[:] = month + wtime[:] = outtime + wlon[:] = lon + wlat[:] = lat + wmask[:,:] = landmask + wfrac[:,:] = landfrac + warea[:,:] = area + wvar[:,:,:] = outputvarvalues + + else: + fieldskip = 0 + + +print( "\n\nSuccessfully made anomoly forcing datasets\n" ) diff --git a/tools/mksurfdata_map/README b/tools/mksurfdata_map/README index 5d3a98fe08..bd324580bb 100644 --- a/tools/mksurfdata_map/README +++ b/tools/mksurfdata_map/README @@ -52,6 +52,9 @@ and generate the surface dataset: For supported model resolution () > mksurfdata.pl -res [options] + For supported model resolutions for SSP scenarios + > mksurfdata.pl -res -ssp_rcp -years 1850-2100 + For unsupported, user specified model resolutions > mksurfdata.pl -res usrspec -usr_gname -usr_gdate diff --git a/tools/mksurfdata_map/mksurfdata.pl b/tools/mksurfdata_map/mksurfdata.pl index 2106a16e32..7f4a50efaf 100755 --- a/tools/mksurfdata_map/mksurfdata.pl +++ b/tools/mksurfdata_map/mksurfdata.pl @@ -109,17 +109,20 @@ sub usage { Default: $opts{'usr_mapdir'} OPTIONS + NOTE: The three critical options are (-years, -glc_nec, and -ssp_rcp) they are marked as such. + -allownofile Allow the script to run even if one of the input files does NOT exist. -dinlc [or -l] Enter the directory location for inputdata (default $opts{'csmdata'}) -debug [or -d] Do not actually run -- just print out what would happen if ran. - -dynpft "filename" Dynamic PFT/harvesting file to use - (rather than create it on the fly) - (must be consistent with first year) + -dynpft "filename" Dynamic PFT/harvesting file to use if you have a manual list you want to use + (rather than create it on the fly, must be consistent with first year) + (Normally NOT used) -fast_maps Toggle fast mode which doesn't use the large mapping files -glc_nec "number" Number of glacier elevation classes to use (by default $opts{'glc_nec'}) + (CRITICAL OPTION) -merge_gis If you want to use the glacier dataset that merges in the Greenland Ice Sheet data that CISM uses (typically used only if consistency with CISM is important) @@ -134,7 +137,8 @@ sub usage { -no_surfdata Do not output a surface dataset This is useful if you only want a landuse_timeseries file -years [or -y] "years" Simulation year(s) to run over (by default $opts{'years'}) - (can also be a simulation year range: i.e. 1850-2000) + (can also be a simulation year range: i.e. 1850-2000 or 1850-2100 for ssp_rcp future scenarios) + (CRITICAL OPTION) -help [or -h] Display this help. -rundir "directory" Directory to run in @@ -143,6 +147,8 @@ sub usage { -ssp_rcp "scenario-name" Shared Socioeconomic Pathway and Representative Concentration Pathway Scenario name(s). "hist" for historical, otherwise in form of SSPn-m.m where n is the SSP number and m.m is the radiative forcing in W/m^2 at the peak or 2100. + (normally use thiw with -years 1850-2100) + (CRITICAL OPTION) -usrname "clm_usrdat_name" CLM user data name to find grid file with. @@ -603,7 +609,7 @@ sub write_namelist_file { my $mkcrop_on = ",crop='on'"; # - # Loop over all resolutions listed + # Loop over all resolutions and sim-years listed # foreach my $res ( @hresols ) { # @@ -627,7 +633,7 @@ sub write_namelist_file { # # Mapping files # - my %map; my %hgrd; my %lmsk; my %datfil; + my %map; my %hgrd; my %lmsk; my %datfil; my %filnm; my $hirespft = "off"; if ( defined($opts{'hirespft'}) ) { $hirespft = "on"; @@ -658,8 +664,9 @@ sub write_namelist_file { $hgrid = trim($hgrid); my $filnm = `$scrdir/../../bld/queryDefaultNamelist.pl $mopts -options type=$typ -var mksrf_filename`; $filnm = trim($filnm); - $hgrd{$typ} = $hgrid; - $lmsk{$typ} = $lmask; + $filnm{$typ} = $filnm; + $hgrd{$typ} = $hgrid; + $lmsk{$typ} = $lmask; if ( $opts{'hgrid'} eq "usrspec" ) { $map{$typ} = $opts{'usr_mapdir'}."/map_${hgrid}_${lmask}_to_${res}_nomask_aave_da_c${mapdate}\.nc"; } else { @@ -671,15 +678,6 @@ sub write_namelist_file { } if ( ! defined($opts{'allownofile'}) && ! -f $map{$typ} ) { die "ERROR: mapping file for this resolution does NOT exist ($map{$typ}).\n"; - } - my $typ_cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $mkopts -options hgrid=$hgrid,lmask=$lmask,mergeGIS=$merge_gis$mkcrop -var $filnm"; - $datfil{$typ} = `$typ_cmd`; - $datfil{$typ} = trim($datfil{$typ}); - if ( $datfil{$typ} !~ /[^ ]+/ ) { - die "ERROR: could NOT find a $filnm data file for this resolution: $hgrid and type: $typ and $lmask.\n$typ_cmd\n\n"; - } - if ( ! defined($opts{'allownofile'}) && ! -f $datfil{$typ} ) { - die "ERROR: data file for this resolution does NOT exist ($datfil{$typ}).\n"; } } # @@ -711,7 +709,7 @@ sub write_namelist_file { # my $double = ".true."; # - # Loop over each sim_year + # Loop over each SSP-RCP scenario # RCP: foreach my $ssp_rcp ( @rcpaths ) { # @@ -744,16 +742,34 @@ sub write_namelist_file { $sim_yrn = $2; $transient = 1; } + # + # Find the file for each of the types + # + foreach my $typ ( @typlist ) { + my $hgrid = $hgrd{$typ}; + my $lmask = $lmsk{$typ}; + my $filnm = $filnm{$typ}; + my $typ_cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $mkopts -options " . + "hgrid=$hgrid,lmask=$lmask,mergeGIS=$merge_gis$mkcrop,sim_year=$sim_yr0 -var $filnm"; + $datfil{$typ} = `$typ_cmd`; + $datfil{$typ} = trim($datfil{$typ}); + if ( $datfil{$typ} !~ /[^ ]+/ ) { + die "ERROR: could NOT find a $filnm data file for this resolution: $hgrid and type: $typ and $lmask.\n$typ_cmd\n\n"; + } + if ( ! defined($opts{'allownofile'}) && ! -f $datfil{$typ} ) { + die "ERROR: data file for this resolution does NOT exist ($datfil{$typ}).\n"; + } + } # determine simulation year to use for the surface dataset: my $sim_yr_surfdat = "$sim_yr0"; - my $cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resol -options sim_year='${sim_yr_surfdat}'$mkcrop -var mksrf_fvegtyp -namelist clmexp"; + my $cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resol -options sim_year='${sim_yr_surfdat}'$mkcrop,ssp_rcp=${ssp_rcp}${mkcrop} -var mksrf_fvegtyp -namelist clmexp"; my $vegtyp = `$cmd`; chomp( $vegtyp ); if ( $vegtyp eq "" ) { die "** trouble getting vegtyp file with: $cmd\n"; } - my $cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resolhrv -options sim_year='${sim_yr_surfdat}'$mkcrop -var mksrf_fvegtyp -namelist clmexp"; + my $cmd = "$scrdir/../../bld/queryDefaultNamelist.pl $queryfilopts $resolhrv -options sim_year='${sim_yr_surfdat}'$mkcrop,ssp_rcp=${ssp_rcp}${mkcrop} -var mksrf_fvegtyp -namelist clmexp"; my $hrvtyp = `$cmd`; chomp( $hrvtyp ); if ( $hrvtyp eq "" ) { From 38c19d16f8a6a80665b28510b6c459d6529ceff4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 14 Jul 2020 15:03:59 -0600 Subject: [PATCH 1172/1973] Add deffered interface needed --- src/main/FireMethodType.F90 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/FireMethodType.F90 b/src/main/FireMethodType.F90 index cb4528c55d..314ee1ceca 100644 --- a/src/main/FireMethodType.F90 +++ b/src/main/FireMethodType.F90 @@ -97,6 +97,22 @@ subroutine FireInterp_interface(this, bounds) end subroutine FireInterp_interface + !----------------------------------------------------------------------- + subroutine CNFireReadParams_interface( this, ncid ) + ! + ! Read in the constant parameters from the input NetCDF parameter file + ! !USES: + use ncdio_pio , only: file_desc_t + import :: fire_method_type + ! + ! !ARGUMENTS: + implicit none + class(fire_method_type) :: this + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + !-------------------------------------------------------------------- + + end subroutine CNFireReadParams_interface + !----------------------------------------------------------------------- subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & From 173287d0a5c1353063f12b04ab7b5bceaa667e3c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 14 Jul 2020 15:13:59 -0600 Subject: [PATCH 1173/1973] Fix for #1004 --- bld/namelist_files/use_cases/20thC_transient.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/use_cases/20thC_transient.xml b/bld/namelist_files/use_cases/20thC_transient.xml index ff56232b8e..824f63cdc4 100644 --- a/bld/namelist_files/use_cases/20thC_transient.xml +++ b/bld/namelist_files/use_cases/20thC_transient.xml @@ -19,11 +19,11 @@ .false. 1850 -2005 +2015 1850 1850 -2005 +2015 1850 1850 From 39a99549957dc6e1db6e5c86b1fc163a86f6c7ee Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 14 Jul 2020 15:37:21 -0600 Subject: [PATCH 1174/1973] Fix for #1010 #1074 and make sure use_crop is set for older datasets ne30np4 and ne16np4 --- bld/namelist_files/namelist_defaults_ctsm.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f5f24e97ea..e2d968234c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -925,13 +925,13 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/ctsm1.0.dev094-2-g633be0eb/surfdata_1x1_smallvilleIA_hist_78pfts_CMIP6_simyr2000_c200521.nc - + lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_ne16np4_hist_78pfts_CMIP6_simyr2000_c190214.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4_hist_78pfts_CMIP6_simyr2000_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr2000_c200426.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg3_hist_78pfts_CMIP6_simyr2000_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne120np4_hist_78pfts_CMIP6_simyr2000_c200427.nc @@ -1005,7 +1005,7 @@ lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_numaIA_hist_78pfts_CMIP6_si lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_1x1_brazil_hist_78pfts_CMIP6_simyr1850_c190214.nc - + lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4_hist_78pfts_CMIP6_simyr1850_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne30np4.pg2_hist_78pfts_CMIP6_simyr1850_c200426.nc @@ -1039,7 +1039,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + use_crop=".false." >lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190214.nc lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc @@ -1067,7 +1067,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc -lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc lnd/clm2/surfdata_map/release-clm5.0.30/landuse.timeseries_ne30np4.pg2_SSP5-8.5_78pfts_CMIP6_simyr1850-2100_c200426.nc From 5335ad5cb752ac4c09311e628139d1d568fb7b9b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 15 Jul 2020 11:22:39 -0600 Subject: [PATCH 1175/1973] Remove line that limits range of WcWj fixing #1055 --- src/biogeophys/LunaMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 468f6b5aaf..71c6c77c3b 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -1052,7 +1052,6 @@ subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & JmaxL = theta * PARimx10 / (sqrt(1.0_r8 + (theta * PARimx10 / Jmax)**2.0_r8)) NUEchg = (NUEc / NUEcref) * (NUEjref / NUEj) Wc2Wj = params_inst%wc2wjb0 * (NUEchg**0.5_r8) - Wc2Wj = min(1.0_r8, Wc2Wj) Vcmax = Wc2Wj * JmaxL * Kj2Kc JmeanL = theta * PARi10 / (sqrt(1.0_r8 + (ELTRNabsorb / Jmax)**2.0_r8)) if(KcKjFlag.eq.0)then !update the Kc,Kj, anc ci information From f7882107b154c2919cbf355bfaed3ba87a8cf081 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 15 Jul 2020 11:51:45 -0600 Subject: [PATCH 1176/1973] Change back #1004 with wrong ending year of ndep, since it has an apparant change to answers even for cases that dont' run past 2005 --- bld/namelist_files/use_cases/20thC_transient.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/use_cases/20thC_transient.xml b/bld/namelist_files/use_cases/20thC_transient.xml index 824f63cdc4..ff56232b8e 100644 --- a/bld/namelist_files/use_cases/20thC_transient.xml +++ b/bld/namelist_files/use_cases/20thC_transient.xml @@ -19,11 +19,11 @@ .false. 1850 -2015 +2005 1850 1850 -2015 +2005 1850 1850 From 4e85121b6f9448d008cd226c64a3c500bf807266 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 15 Jul 2020 13:59:16 -0600 Subject: [PATCH 1177/1973] Correct grid names for new tests --- cime_config/testdefs/testlist_clm.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 09525e2902..6f348c3f8a 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1175,7 +1175,7 @@ - + @@ -1184,7 +1184,7 @@ - + @@ -1193,7 +1193,7 @@ - + From 50217492420d1ea1e04772dcf19a1a67f649dc26 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 15 Jul 2020 15:02:58 -0600 Subject: [PATCH 1178/1973] Add freelivfix_* namelist items to default namelist, add namelist checking for it --- bld/CLMBuildNamelist.pm | 29 +++++++++++++++++++ bld/namelist_files/namelist_defaults_ctsm.xml | 3 ++ bld/unit_testers/build-namelist_test.pl | 7 ++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index f460538aed..82073dc5df 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1560,6 +1560,11 @@ sub process_namelist_inline_logic { ################################# setup_logic_nitrif_params( $nl_flags, $definition, $defaults, $nl ); + ############################################# + # namelist group: mineral_nitrogen_dynamics # + ############################################# + setup_logic_mineral_nitrogen_dynamics( $opts, $nl_flags, $definition, $defaults, $nl ); + #################################### # namelist group: photosyns_inparm # #################################### @@ -2722,6 +2727,30 @@ sub setup_logic_nitrif_params { } } +#------------------------------------------------------------------------------- + +sub setup_logic_mineral_nitrogen_dynamics { + # + # Logic for mineral_nitrogen_dynamics + # + my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + + my @vars = ( "freelivfix_slope_wet", "freelivfix_intercept" ); + if ( &value_is_true($nl_flags->{'use_cn'}) && &value_is_true($nl->get_value('use_fun')) ) { + foreach my $var ( @vars ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, + 'use_cn'=>$nl_flags->{'use_cn'}, 'use_fun'=>$nl->get_value('use_fun') ); + } + } else { + foreach my $var ( @vars ) { + if ( defined($nl->get_value( $var ) ) ) { + $log->fatal_error("$var is only used when use_cn and use_fun are both turned on"); + } + } + } +} + + #------------------------------------------------------------------------------- sub setup_logic_hydrology_switches { diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f5504aafc7..84e55eab9b 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1052,6 +1052,9 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 .true. .false. +0.0117d00 +0.0006d00 + 0.83d-06 diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 70ca68e131..ef76c7a2f0 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,7 +138,7 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 897; +my $ntests = 898; if ( defined($opts{'compare'}) ) { $ntests += 552; } @@ -599,6 +599,11 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm4_5", }, + "freeliv wo fun" =>{ options=>"-bgc bgc -envxml_dir .", + namelst=>"freelivfix_intercept=9.", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm4_5", + }, "use_cn=false bgc=cn" =>{ options=>"-bgc cn -envxml_dir .", namelst=>"use_cn=.false.", GLC_TWO_WAY_COUPLING=>"FALSE", From 6837e117c3b2c09e170c4bd76c51adcc573b9760 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 15 Jul 2020 16:05:15 -0600 Subject: [PATCH 1179/1973] Split cmb_cmplt_fact array into two (_litter and _cwd suffixes) fixing #1053 --- bld/CLMBuildNamelist.pm | 3 +- bld/namelist_files/namelist_defaults_ctsm.xml | 6 ++-- .../namelist_definition_ctsm.xml | 9 ++++-- src/biogeochem/CNFireBaseMod.F90 | 30 ++++++++++--------- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 82073dc5df..9604a6090e 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1973,7 +1973,8 @@ sub setup_logic_cnfire { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; my @fire_consts = ( "rh_low", "rh_hgh", "bt_min", "bt_max", "cli_scale", "boreal_peatfire_c", "non_boreal_peatfire_c", - "pot_hmn_ign_counts_alpha", "cropfire_a1", "occur_hi_gdp_tree", "lfuel", "ufuel", "cmb_cmplt_fact" ); + "pot_hmn_ign_counts_alpha", "cropfire_a1", "occur_hi_gdp_tree", "lfuel", "ufuel", + "cmb_cmplt_fact_litter", "cmb_cmplt_fact_cwd" ); if ( &value_is_true($nl->get_value('use_cn')) ) { foreach my $item ( @fire_consts ) { if ( ! &value_is_true($nl_flags->{'cnfireson'} ) ) { diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 84e55eab9b..6d935449e8 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -222,7 +222,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.39d00 75.d00 1050.d00 -0.5d00, 0.25d00 +0.5d00 +0.25d00 30.0d00 @@ -246,7 +247,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.33d00 105.d00 1050.d00 -0.5d00, 0.28d00 +0.5d00 +0.28d00 .false. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index e7bb4b3f60..db12391b93 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -266,9 +266,14 @@ Global constant for deforestation fires (/day) Fire occurance for high GDP areas that are tree dominated (fraction) - -Combustion completeness factor (for litter and CWD[Course Woody Debris]) (unitless) +Combustion completeness factor for litter (unitless) + + + +Combustion completeness factor for CWD[Course Woody Debris] (unitless) pftcon%fr_fcel , & ! Input: fr_flig => pftcon%fr_flig , & ! Input: - cmb_cmplt_fact => cnfire_const%cmb_cmplt_fact , & ! Input: [real(r8) (:) ] Combustion completion factor (unitless) + cmb_cmplt_fact_litter => cnfire_const%cmb_cmplt_fact_litter , & ! Input: [real(r8) (:) ] Combustion completion factor for litter (unitless) + cmb_cmplt_fact_cwd => cnfire_const%cmb_cmplt_fact_cwd , & ! Input: [real(r8) (:) ] Combustion completion factor for CWD (unitless) nind => dgvs_inst%nind_patch , & ! Input: [real(r8) (:) ] number of individuals (#/m2) @@ -847,11 +849,11 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte do l = 1, ndecomp_pools if ( is_litter(l) ) then m_decomp_cpools_to_fire_vr(c,j,l) = decomp_cpools_vr(c,j,l) * f * & - cmb_cmplt_fact(lit_fp) + cmb_cmplt_fact_litter end if if ( is_cwd(l) ) then m_decomp_cpools_to_fire_vr(c,j,l) = decomp_cpools_vr(c,j,l) * & - (f-baf_crop(c)) * cmb_cmplt_fact(cwd_fp) + (f-baf_crop(c)) * cmb_cmplt_fact_cwd end if end do @@ -859,11 +861,11 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte do l = 1, ndecomp_pools if ( is_litter(l) ) then m_decomp_npools_to_fire_vr(c,j,l) = decomp_npools_vr(c,j,l) * f * & - cmb_cmplt_fact(lit_fp) + cmb_cmplt_fact_litter end if if ( is_cwd(l) ) then m_decomp_npools_to_fire_vr(c,j,l) = decomp_npools_vr(c,j,l) * & - (f-baf_crop(c)) * cmb_cmplt_fact(cwd_fp) + (f-baf_crop(c)) * cmb_cmplt_fact_cwd end if end do From 337295e3fde4c0a9f5a3707b4ae2c58f09f6fccb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 15 Jul 2020 18:10:26 -0600 Subject: [PATCH 1180/1973] Add a use_fun if around the setting of free_retransn_to_npool_patch, so that clm4_5 answers can be the same --- src/biogeochem/CNNStateUpdate1Mod.F90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNNStateUpdate1Mod.F90 b/src/biogeochem/CNNStateUpdate1Mod.F90 index 74be1bb69a..bee931e7fc 100644 --- a/src/biogeochem/CNNStateUpdate1Mod.F90 +++ b/src/biogeochem/CNNStateUpdate1Mod.F90 @@ -88,6 +88,7 @@ end subroutine NStateUpdateDynPatch !----------------------------------------------------------------------- subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) + use CNSharedParamsMod , only : use_fun ! ! !DESCRIPTION: ! On the radiation time step, update all the prognostic nitrogen state @@ -192,8 +193,10 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & ! WW change logic so livestem_retrans goes to npool (via free_retrans flux) ! this should likely be done more cleanly if it works, i.e. not update fluxes w/ states ! additional considerations for crop? - nf_veg%free_retransn_to_npool_patch(p) = nf_veg%free_retransn_to_npool_patch(p) + nf_veg%livestemn_to_retransn_patch(p) - nf_veg%free_retransn_to_npool_patch(p) = nf_veg%free_retransn_to_npool_patch(p) + nf_veg%livecrootn_to_retransn_patch(p) + if (use_fun ) then + nf_veg%free_retransn_to_npool_patch(p) = nf_veg%free_retransn_to_npool_patch(p) + nf_veg%livestemn_to_retransn_patch(p) + nf_veg%free_retransn_to_npool_patch(p) = nf_veg%free_retransn_to_npool_patch(p) + nf_veg%livecrootn_to_retransn_patch(p) + end if end if if (ivt(p) >= npcropmin) then ! Beth adds retrans from froot ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - nf_veg%frootn_to_retransn_patch(p)*dt From 83e839115710e4d0e1f73222743fae427353266e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 16 Jul 2020 23:32:20 -0600 Subject: [PATCH 1181/1973] Point to file that also has new field on it season_decid_temperate --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index bc3dd0bdd0..cc2b895194 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -390,7 +390,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c200707.nc +lnd/clm2/paramdata/ctsm51_params.c200716.nc lnd/clm2/paramdata/clm45_params.c200624.nc From 97e5202137656f507c7a9b25487a2b8057d88b7d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 16 Jul 2020 23:42:15 -0600 Subject: [PATCH 1182/1973] Add in new namelist items for cnphenology control: onset_thresh_depends_on_veg, and min_crtical_dayl_depends_on_lat --- bld/namelist_files/namelist_definition_ctsm.xml | 12 ++++++++++++ src/biogeochem/CNPhenologyMod.F90 | 11 ++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index e7bb4b3f60..bb0b0e2761 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1053,6 +1053,18 @@ Initial seed Carbon to use at planting (only used when CN is on as well as crop) + +Phenology onset depends on the vegetation type +(only used when CN is on) + + + +The minimum critical day length for onset depends on latitude +(only used when CN is on) + + Toggle to turn on ozone stress diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index c4b371b16d..c6298c24f4 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -94,7 +94,9 @@ module CNPhenologyMod integer, allocatable :: maxplantjday(:,:) ! maximum planting julian day integer :: jdayyrstart(inSH) ! julian day of start of year - real(r8), private :: initial_seed_at_planting = 3._r8 ! Initial seed at planting + real(r8), private :: initial_seed_at_planting = 3._r8 ! Initial seed at planting + logical, private :: min_crtical_dayl_depends_on_lat = .false. ! If critical day-length for onset depends on latitude + logical, private :: onset_thresh_depends_on_veg = .false. ! If onset threshold depends on vegetation type character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -125,7 +127,8 @@ subroutine CNPhenologyReadNML( NLFilename ) character(len=*), parameter :: subname = 'CNPhenologyReadNML' character(len=*), parameter :: nmlname = 'cnphenology' !----------------------------------------------------------------------- - namelist /cnphenology/ initial_seed_at_planting + namelist /cnphenology/ initial_seed_at_planting, onset_thresh_depends_on_veg, & + min_crtical_dayl_depends_on_lat ! Initialize options to default values, in case they are not specified in ! the namelist @@ -146,7 +149,9 @@ subroutine CNPhenologyReadNML( NLFilename ) call relavu( unitn ) end if - call shr_mpi_bcast (initial_seed_at_planting, mpicom) + call shr_mpi_bcast (initial_seed_at_planting, mpicom) + call shr_mpi_bcast (onset_thresh_depends_on_veg, mpicom) + call shr_mpi_bcast (min_crtical_dayl_depends_on_lat, mpicom) if (masterproc) then write(iulog,*) ' ' From 4ceab4df8fff45e1883a43f6999431bc3c316686 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 17 Jul 2020 14:26:22 -0600 Subject: [PATCH 1183/1973] Enable the namelist items, so that clm50 results can be identical to before --- src/biogeochem/CNPhenologyMod.F90 | 43 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index c6298c24f4..5da465cdb7 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -890,19 +890,24 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & !KO onset_thresh=1.0_r8 !KO end if !KO - ! separate into non-arctic seasonally deciduous pfts (temperate broadleaf deciduous - ! tree) and arctic/boreal seasonally deciduous pfts (boreal needleleaf deciduous tree, - ! boreal broadleaf deciduous tree, boreal broadleaf deciduous shrub, C3 arctic grass) - if (onset_gdd(p) > crit_onset_gdd .and. season_decid_temperate(ivt(p)) == 1) then - onset_thresh=1.0_r8 - else if (season_decid_temperate(ivt(p)) == 0 .and. onset_gddflag(p) == 1.0_r8 .and. & - soila10(p) > SHR_CONST_TKFRZ .and. & - t_a5min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. & - dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then - onset_thresh=1.0_r8 - end if + if ( onset_thresh_depends_on_veg ) then + ! separate into non-arctic seasonally deciduous pfts (temperate broadleaf deciduous + ! tree) and arctic/boreal seasonally deciduous pfts (boreal needleleaf deciduous tree, + ! boreal broadleaf deciduous tree, boreal broadleaf deciduous shrub, C3 arctic grass) + if (onset_gdd(p) > crit_onset_gdd .and. season_decid_temperate(ivt(p)) == 1) then + onset_thresh=1.0_r8 + else if (season_decid_temperate(ivt(p)) == 0 .and. onset_gddflag(p) == 1.0_r8 .and. & + soila10(p) > SHR_CONST_TKFRZ .and. & + t_a5min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. & + dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then + onset_thresh=1.0_r8 + end if + else + ! set onset_flag if critical growing degree-day sum is exceeded + if (onset_gdd(p) > crit_onset_gdd) onset_thresh = 1.0_r8 + end if !KO - ! set onset_flag if critical growing degree-day sum is exceeded + ! If onset is being triggered if (onset_thresh == 1.0_r8) then onset_flag(p) = 1.0_r8 dormant_flag(p) = 0.0_r8 @@ -950,11 +955,15 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & if (days_active(p) > 355._r8) pftmayexist(p) = .false. end if - ! use 15 hr (54000 min) at ~65N from eitel 2019, to ~11hours in temperate regions - ! 15hr-11hr/(65N-45N)=linear slope = 720 min/latitude - crit_daylat=54000-720*(65-abs(grc%latdeg(g))) - if (crit_daylat < crit_dayl) then - crit_daylat = crit_dayl !maintain previous offset from White 2001 as minimum + if ( min_crtical_dayl_depends_on_lat )then + ! use 15 hr (54000 min) at ~65N from eitel 2019, to ~11hours in temperate regions + ! 15hr-11hr/(65N-45N)=linear slope = 720 min/latitude + crit_daylat=54000-720*(65-abs(grc%latdeg(g))) + if (crit_daylat < crit_dayl) then + crit_daylat = crit_dayl !maintain previous offset from White 2001 as minimum + end if + else + crit_daylat = crit_dayl end if ! only begin to test for offset daylength once past the summer sol From 401b7979186e52919a48b073cfdcebf735882bab Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 17 Jul 2020 14:30:00 -0600 Subject: [PATCH 1184/1973] Use clm45 and clm50 paramfile that just has the addition of seas_decid_temperate, so we can make sure clm45 and clm50 results are identical --- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index cc2b895194..d474ffb887 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -390,8 +390,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c200716.nc -lnd/clm2/paramdata/clm45_params.c200624.nc +lnd/clm2/paramdata/clm5_params.c200717.nc +lnd/clm2/paramdata/clm45_params.c200717.nc From 0f4536da6aae91d33ebba6cf04a11382714bcf65 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 17 Jul 2020 15:41:30 -0600 Subject: [PATCH 1185/1973] Make 5 day snow default inactive so that history file field list will be the same as before --- src/biogeophys/WaterDiagnosticBulkType.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index 68d0b70b04..8cbce707ae 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -411,7 +411,7 @@ subroutine InitBulkHistory(this, bounds) units='m', & avgflag='A', & long_name=this%info%lname('5day snow avg'), & - ptr_col=this%snow_5day_col, c2l_scale_type='urbanf') + ptr_col=this%snow_5day_col, c2l_scale_type='urbanf', default='inactive') call hist_addfld1d ( & fname=this%info%fname('SNOW_DEPTH_ICE'), & From fa3d7bc7638004e993fd5738b935cef6e0be21c1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 19 Jul 2020 18:46:58 -0600 Subject: [PATCH 1186/1973] fixed problem in previous merge --- cime_config/buildlib | 1 + src/biogeochem/CNFireBaseMod.F90 | 484 ++++++++++----------- src/biogeochem/CNVegetationFacade.F90 | 54 ++- src/biogeochem/SatellitePhenologyMod.F90 | 122 ++++-- src/biogeochem/ch4FInundatedStreamType.F90 | 31 +- src/biogeophys/SoilMoistureStreamMod.F90 | 3 +- src/biogeophys/UrbanTimeVarType.F90 | 14 +- 7 files changed, 369 insertions(+), 340 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index e67960a5c3..95fd0b14c3 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -92,6 +92,7 @@ def _main_func(): gmake = case.get_value("GMAKE") gmake_opts = get_standard_makefile_args(case) driver = case.get_value("COMP_INTERFACE").lower() + cimeroot = case.get_value("CIMEROOT") lilac_mode = case.get_value("LILAC_MODE") if lilac_mode == 'on': diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 8677fc4b23..e99d5c6e3b 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -4,12 +4,12 @@ module CNFireBaseMod !----------------------------------------------------------------------- ! !DESCRIPTION: - ! module for fire dynamics + ! module for fire dynamics ! created in Nov, 2012 and revised in Apr, 2013 by F. Li and S. Levis ! based on Li et al. (2012a,b; 2013) ! revised in Apr, 2014 according Li et al.(2014) - ! Fire-related parameters were calibrated or tuned in Apr, 2013 based on the - ! 20th Century transient simulations at f19_g16 with (newfire05_clm45sci15_clm4_0_58) + ! Fire-related parameters were calibrated or tuned in Apr, 2013 based on the + ! 20th Century transient simulations at f19_g16 with (newfire05_clm45sci15_clm4_0_58) ! a CLM4.5 version, Qian et al. (2006) atmospheric forcing, and ! climatological lightning data. ! @@ -57,7 +57,7 @@ module CNFireBaseMod ! !PRIVATE MEMBER DATA: real(r8) :: borealat = 40._r8 ! Latitude for boreal peat fires real(r8) :: lfuel=75._r8 ! lower threshold of fuel mass (gC/m2) for ignition, Li et al.(2014) - real(r8) :: ufuel=650._r8 ! upper threshold of fuel mass(gC/m2) for ignition + real(r8) :: ufuel=650._r8 ! upper threshold of fuel mass(gC/m2) for ignition real(r8) :: g0=0.05_r8 ! g(W) when W=0 m/s real(r8) :: rh_low=30.0_r8 ! Relative humidty low (%) real(r8) :: rh_hgh=80.0_r8 ! Relative humidty high (%) @@ -86,8 +86,8 @@ module CNFireBaseMod real(r8), public, pointer :: forc_lnfm(:) ! Lightning frequency real(r8), public, pointer :: forc_hdm(:) ! Human population density - type(shr_strdata_type), pointer :: sdat_hdm ! Human population density input data stream - type(shr_strdata_type), pointer :: sdat_lnfm ! Lightning input data stream + type(shr_strdata_type) :: sdat_hdm ! Human population density input data stream + type(shr_strdata_type) :: sdat_lnfm ! Lightning input data stream contains @@ -145,7 +145,7 @@ subroutine CNFireInit( this, bounds, NLFilename ) ! ! !ARGUMENTS: class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename !----------------------------------------------------------------------- @@ -278,7 +278,7 @@ subroutine CNFireInterp(this,bounds) ! ! !ARGUMENTS: class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds !----------------------------------------------------------------------- if ( this%need_lightning_and_popdens() ) then @@ -295,13 +295,13 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: - ! Computes column-level burned area + ! Computes column-level burned area ! ! !USES: ! ! !ARGUMENTS: class(cnfire_base_type) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilc ! number of soil columns in filter integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter @@ -333,8 +333,8 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! Fire effects routine for coupled carbon-nitrogen code (CN). ! Relies primarily on estimate of fractional area burned, from CNFireArea(). ! - ! Total fire carbon emissions (g C/m2 land area/yr) - ! =avg(COL_FIRE_CLOSS)*seconds_per_year + avg(SOMC_FIRE)*seconds_per_year + + ! Total fire carbon emissions (g C/m2 land area/yr) + ! =avg(COL_FIRE_CLOSS)*seconds_per_year + avg(SOMC_FIRE)*seconds_per_year + ! avg(LF_CONV_CFLUX)*seconds_per_year*min(1.0,avg(LFC2)*seconds_per_year)*0.8 ! where avg means the temporal average in a year ! seconds_per_year is the number of seconds in a year. @@ -350,7 +350,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! ! !ARGUMENTS: class(cnfire_base_type) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilc ! number of soil columns in filter integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter @@ -401,188 +401,188 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! emis. = emissions ! decomp. = decomposing - associate( & - croot_prof => croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves + associate( & + croot_prof => croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots + stem_prof => stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems + froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots + leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves totsomc => totsomc_col , & ! Input: [real(r8) (:) ] (gC/m2) total soil organic matter C decomp_cpools_vr => decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) decomp_npools_vr => decomp_npools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) somc_fire => somc_fire_col , & ! Output: [real(r8) (:) ] (gC/m2/s) fire C emissions due to peat burning - - is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool - is_litter => decomp_cascade_con%is_litter , & ! Input: [logical (:) ] TRUE => pool is a litter pool - - woody => pftcon%woody , & ! Input: woody lifeform (1=woody, 0=not woody) - cc_leaf => pftcon%cc_leaf , & ! Input: - cc_lstem => pftcon%cc_lstem , & ! Input: - cc_dstem => pftcon%cc_dstem , & ! Input: - cc_other => pftcon%cc_other , & ! Input: - fm_leaf => pftcon%fm_leaf , & ! Input: - fm_lstem => pftcon%fm_lstem , & ! Input: - fm_other => pftcon%fm_other , & ! Input: - fm_root => pftcon%fm_root , & ! Input: - fm_lroot => pftcon%fm_lroot , & ! Input: - fm_droot => pftcon%fm_droot , & ! Input: - lf_flab => pftcon%lf_flab , & ! Input: - lf_fcel => pftcon%lf_fcel , & ! Input: - lf_flig => pftcon%lf_flig , & ! Input: - fr_flab => pftcon%fr_flab , & ! Input: - fr_fcel => pftcon%fr_fcel , & ! Input: - fr_flig => pftcon%fr_flig , & ! Input: + + is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool + is_litter => decomp_cascade_con%is_litter , & ! Input: [logical (:) ] TRUE => pool is a litter pool + + woody => pftcon%woody , & ! Input: woody lifeform (1=woody, 0=not woody) + cc_leaf => pftcon%cc_leaf , & ! Input: + cc_lstem => pftcon%cc_lstem , & ! Input: + cc_dstem => pftcon%cc_dstem , & ! Input: + cc_other => pftcon%cc_other , & ! Input: + fm_leaf => pftcon%fm_leaf , & ! Input: + fm_lstem => pftcon%fm_lstem , & ! Input: + fm_other => pftcon%fm_other , & ! Input: + fm_root => pftcon%fm_root , & ! Input: + fm_lroot => pftcon%fm_lroot , & ! Input: + fm_droot => pftcon%fm_droot , & ! Input: + lf_flab => pftcon%lf_flab , & ! Input: + lf_fcel => pftcon%lf_fcel , & ! Input: + lf_flig => pftcon%lf_flig , & ! Input: + fr_flab => pftcon%fr_flab , & ! Input: + fr_fcel => pftcon%fr_fcel , & ! Input: + fr_flig => pftcon%fr_flig , & ! Input: cmb_cmplt_fact => cnfire_const%cmb_cmplt_fact , & ! Input: [real(r8) (:) ] Combustion completion factor (unitless) - - nind => dgvs_inst%nind_patch , & ! Input: [real(r8) (:) ] number of individuals (#/m2) - - cropf_col => cnveg_state_inst%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column + + nind => dgvs_inst%nind_patch , & ! Input: [real(r8) (:) ] number of individuals (#/m2) + + cropf_col => cnveg_state_inst%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column farea_burned => cnveg_state_inst%farea_burned_col , & ! Input: [real(r8) (:) ] fractional area burned (/sec) - fbac1 => cnveg_state_inst%fbac1_col , & ! Input: [real(r8) (:) ] burned area out of conv. region due to LU fire + fbac1 => cnveg_state_inst%fbac1_col , & ! Input: [real(r8) (:) ] burned area out of conv. region due to LU fire fbac => cnveg_state_inst%fbac_col , & ! Input: [real(r8) (:) ] total burned area out of conversion (/sec) - baf_crop => cnveg_state_inst%baf_crop_col , & ! Input: [real(r8) (:) ] BAF for cropland - baf_peatf => cnveg_state_inst%baf_peatf_col , & ! Input: [real(r8) (:) ] BAF for peatlabd - trotr1_col => cnveg_state_inst%trotr1_col , & ! Input: [real(r8) (:) ] patch weight of BET on the column (0-1) - trotr2_col => cnveg_state_inst%trotr2_col , & ! Input: [real(r8) (:) ] patch weight of BDT on the column (0-1) + baf_crop => cnveg_state_inst%baf_crop_col , & ! Input: [real(r8) (:) ] BAF for cropland + baf_peatf => cnveg_state_inst%baf_peatf_col , & ! Input: [real(r8) (:) ] BAF for peatlabd + trotr1_col => cnveg_state_inst%trotr1_col , & ! Input: [real(r8) (:) ] patch weight of BET on the column (0-1) + trotr2_col => cnveg_state_inst%trotr2_col , & ! Input: [real(r8) (:) ] patch weight of BDT on the column (0-1) dtrotr_col => cnveg_state_inst%dtrotr_col , & ! Input: [real(r8) (:) ] ann. decreased frac. coverage of BET+BDT (0-1) on GC lfc => cnveg_state_inst%lfc_col , & ! Input: [real(r8) (:) ] conv. area frac. of BET+BDT that haven't burned before lfc2 => cnveg_state_inst%lfc2_col , & ! Output: [real(r8) (:) ] conv. area frac. of BET+BDT burned this dt (/sec) - - leafcmax => cnveg_carbonstate_inst%leafcmax_patch , & ! Output: [real(r8) (:) ] (gC/m2) ann max leaf C - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C transfer - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc => cnveg_carbonstate_inst%deadcrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage - gresp_xfer => cnveg_carbonstate_inst%gresp_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration transfer - - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N transfer - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn => cnveg_nitrogenstate_inst%deadstemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N transfer - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N transfer - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn => cnveg_nitrogenstate_inst%deadcrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N - + + leafcmax => cnveg_carbonstate_inst%leafcmax_patch , & ! Output: [real(r8) (:) ] (gC/m2) ann max leaf C + leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C + leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage + leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer + livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C + livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage + livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C transfer + deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C + deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage + deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C transfer + frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C + frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage + frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer + livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C + livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage + livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer + deadcrootc => cnveg_carbonstate_inst%deadcrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C + deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage + deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer + gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage + gresp_xfer => cnveg_carbonstate_inst%gresp_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration transfer + + leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N + leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage + leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N transfer + livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N + livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage + livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N transfer + deadstemn => cnveg_nitrogenstate_inst%deadstemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N + deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage + deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N transfer + frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N + frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage + frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N transfer + livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N + livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage + livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N transfer + deadcrootn => cnveg_nitrogenstate_inst%deadcrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N + deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage + deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N transfer + retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N + fire_mortality_c_to_cwdc => cnveg_carbonflux_inst%fire_mortality_c_to_cwdc_col , & ! Input: [real(r8) (:,:) ] C flux fire mortality to CWD (gC/m3/s) - m_leafc_to_fire => cnveg_carbonflux_inst%m_leafc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc - m_leafc_storage_to_fire => cnveg_carbonflux_inst%m_leafc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc_storage - m_leafc_xfer_to_fire => cnveg_carbonflux_inst%m_leafc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc_xfer - m_livestemc_to_fire => cnveg_carbonflux_inst%m_livestemc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from livestemc - m_livestemc_storage_to_fire => cnveg_carbonflux_inst%m_livestemc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livestemc_storage - m_livestemc_xfer_to_fire => cnveg_carbonflux_inst%m_livestemc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livestemc_xfer - m_deadstemc_to_fire => cnveg_carbonflux_inst%m_deadstemc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_xfer - m_deadstemc_storage_to_fire => cnveg_carbonflux_inst%m_deadstemc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_storage - m_deadstemc_xfer_to_fire => cnveg_carbonflux_inst%m_deadstemc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_xfer - m_frootc_to_fire => cnveg_carbonflux_inst%m_frootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc - m_frootc_storage_to_fire => cnveg_carbonflux_inst%m_frootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc_storage - m_frootc_xfer_to_fire => cnveg_carbonflux_inst%m_frootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc_xfer - m_livecrootc_to_fire => cnveg_carbonflux_inst%m_livecrootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc - m_livecrootc_storage_to_fire => cnveg_carbonflux_inst%m_livecrootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc_storage - m_livecrootc_xfer_to_fire => cnveg_carbonflux_inst%m_livecrootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc_xfer - m_deadcrootc_to_fire => cnveg_carbonflux_inst%m_deadcrootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc - m_deadcrootc_storage_to_fire => cnveg_carbonflux_inst%m_deadcrootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc_storage - m_deadcrootc_xfer_to_fire => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc_xfer - m_gresp_storage_to_fire => cnveg_carbonflux_inst%m_gresp_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. gresp_storage - m_gresp_xfer_to_fire => cnveg_carbonflux_inst%m_gresp_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. gresp_xfer - m_leafc_to_litter_fire => cnveg_carbonflux_inst%m_leafc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafc_storage_to_litter_fire => cnveg_carbonflux_inst%m_leafc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_leafc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_storage_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_to_deadstemc_fire => cnveg_carbonflux_inst%m_livestemc_to_deadstemc_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_storage_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_to_litter_fire => cnveg_carbonflux_inst%m_frootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_frootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_frootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_to_deadcrootc_fire => cnveg_carbonflux_inst%m_livecrootc_to_deadcrootc_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_gresp_storage_to_litter_fire => cnveg_carbonflux_inst%m_gresp_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_gresp_xfer_to_litter_fire => cnveg_carbonflux_inst%m_gresp_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_leafc_to_fire => cnveg_carbonflux_inst%m_leafc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc + m_leafc_storage_to_fire => cnveg_carbonflux_inst%m_leafc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc_storage + m_leafc_xfer_to_fire => cnveg_carbonflux_inst%m_leafc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc_xfer + m_livestemc_to_fire => cnveg_carbonflux_inst%m_livestemc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from livestemc + m_livestemc_storage_to_fire => cnveg_carbonflux_inst%m_livestemc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livestemc_storage + m_livestemc_xfer_to_fire => cnveg_carbonflux_inst%m_livestemc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livestemc_xfer + m_deadstemc_to_fire => cnveg_carbonflux_inst%m_deadstemc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_xfer + m_deadstemc_storage_to_fire => cnveg_carbonflux_inst%m_deadstemc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_storage + m_deadstemc_xfer_to_fire => cnveg_carbonflux_inst%m_deadstemc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_xfer + m_frootc_to_fire => cnveg_carbonflux_inst%m_frootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc + m_frootc_storage_to_fire => cnveg_carbonflux_inst%m_frootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc_storage + m_frootc_xfer_to_fire => cnveg_carbonflux_inst%m_frootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc_xfer + m_livecrootc_to_fire => cnveg_carbonflux_inst%m_livecrootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc + m_livecrootc_storage_to_fire => cnveg_carbonflux_inst%m_livecrootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc_storage + m_livecrootc_xfer_to_fire => cnveg_carbonflux_inst%m_livecrootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc_xfer + m_deadcrootc_to_fire => cnveg_carbonflux_inst%m_deadcrootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc + m_deadcrootc_storage_to_fire => cnveg_carbonflux_inst%m_deadcrootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc_storage + m_deadcrootc_xfer_to_fire => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc_xfer + m_gresp_storage_to_fire => cnveg_carbonflux_inst%m_gresp_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. gresp_storage + m_gresp_xfer_to_fire => cnveg_carbonflux_inst%m_gresp_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. gresp_xfer + m_leafc_to_litter_fire => cnveg_carbonflux_inst%m_leafc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_leafc_storage_to_litter_fire => cnveg_carbonflux_inst%m_leafc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_leafc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_leafc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livestemc_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livestemc_storage_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livestemc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livestemc_to_deadstemc_fire => cnveg_carbonflux_inst%m_livestemc_to_deadstemc_fire_patch , & ! Output: [real(r8) (:) ] + m_deadstemc_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_deadstemc_storage_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_deadstemc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_frootc_to_litter_fire => cnveg_carbonflux_inst%m_frootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_frootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_frootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_frootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_frootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livecrootc_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livecrootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livecrootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livecrootc_to_deadcrootc_fire => cnveg_carbonflux_inst%m_livecrootc_to_deadcrootc_fire_patch , & ! Output: [real(r8) (:) ] + m_deadcrootc_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_deadcrootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_deadcrootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_gresp_storage_to_litter_fire => cnveg_carbonflux_inst%m_gresp_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_gresp_xfer_to_litter_fire => cnveg_carbonflux_inst%m_gresp_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] m_decomp_cpools_to_fire_vr => cnveg_carbonflux_inst%m_decomp_cpools_to_fire_vr_col , & ! Output: [real(r8) (:,:,:) ] (gC/m3/s) VR decomp. C fire loss - m_c_to_litr_met_fire => cnveg_carbonflux_inst%m_c_to_litr_met_fire_col , & ! Output: [real(r8) (:,:) ] - m_c_to_litr_cel_fire => cnveg_carbonflux_inst%m_c_to_litr_cel_fire_col , & ! Output: [real(r8) (:,:) ] - m_c_to_litr_lig_fire => cnveg_carbonflux_inst%m_c_to_litr_lig_fire_col , & ! Output: [real(r8) (:,:) ] - + m_c_to_litr_met_fire => cnveg_carbonflux_inst%m_c_to_litr_met_fire_col , & ! Output: [real(r8) (:,:) ] + m_c_to_litr_cel_fire => cnveg_carbonflux_inst%m_c_to_litr_cel_fire_col , & ! Output: [real(r8) (:,:) ] + m_c_to_litr_lig_fire => cnveg_carbonflux_inst%m_c_to_litr_lig_fire_col , & ! Output: [real(r8) (:,:) ] + fire_mortality_n_to_cwdn => cnveg_nitrogenflux_inst%fire_mortality_n_to_cwdn_col , & ! Input: [real(r8) (:,:) ] N flux fire mortality to CWD (gN/m3/s) - m_leafn_to_fire => cnveg_nitrogenflux_inst%m_leafn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn - m_leafn_storage_to_fire => cnveg_nitrogenflux_inst%m_leafn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn_storage - m_leafn_xfer_to_fire => cnveg_nitrogenflux_inst%m_leafn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn_xfer - m_livestemn_to_fire => cnveg_nitrogenflux_inst%m_livestemn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn - m_livestemn_storage_to_fire => cnveg_nitrogenflux_inst%m_livestemn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn_s - m_livestemn_xfer_to_fire => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn_xfer - m_deadstemn_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn - m_deadstemn_storage_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn_storage - m_deadstemn_xfer_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn_xfer - m_frootn_to_fire => cnveg_nitrogenflux_inst%m_frootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn - m_frootn_storage_to_fire => cnveg_nitrogenflux_inst%m_frootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn_storage - m_frootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_frootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn_xfer - m_livecrootn_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. m_livecrootn_to_fire - m_livecrootn_storage_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livecrootn_storage - m_livecrootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livecrootn_xfer - m_deadcrootn_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn - m_deadcrootn_storage_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn_storage - m_deadcrootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn_xfer - m_retransn_to_fire => cnveg_nitrogenflux_inst%m_retransn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. retransn - m_leafn_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_to_deadstemn_fire => cnveg_nitrogenflux_inst%m_livestemn_to_deadstemn_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_to_deadcrootn_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_deadcrootn_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_retransn_to_litter_fire => cnveg_nitrogenflux_inst%m_retransn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_leafn_to_fire => cnveg_nitrogenflux_inst%m_leafn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn + m_leafn_storage_to_fire => cnveg_nitrogenflux_inst%m_leafn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn_storage + m_leafn_xfer_to_fire => cnveg_nitrogenflux_inst%m_leafn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn_xfer + m_livestemn_to_fire => cnveg_nitrogenflux_inst%m_livestemn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn + m_livestemn_storage_to_fire => cnveg_nitrogenflux_inst%m_livestemn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn_s + m_livestemn_xfer_to_fire => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn_xfer + m_deadstemn_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn + m_deadstemn_storage_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn_storage + m_deadstemn_xfer_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn_xfer + m_frootn_to_fire => cnveg_nitrogenflux_inst%m_frootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn + m_frootn_storage_to_fire => cnveg_nitrogenflux_inst%m_frootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn_storage + m_frootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_frootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn_xfer + m_livecrootn_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. m_livecrootn_to_fire + m_livecrootn_storage_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livecrootn_storage + m_livecrootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livecrootn_xfer + m_deadcrootn_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn + m_deadcrootn_storage_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn_storage + m_deadcrootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn_xfer + m_retransn_to_fire => cnveg_nitrogenflux_inst%m_retransn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. retransn + m_leafn_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_leafn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_leafn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livestemn_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livestemn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livestemn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livestemn_to_deadstemn_fire => cnveg_nitrogenflux_inst%m_livestemn_to_deadstemn_fire_patch , & ! Output: [real(r8) (:) ] + m_deadstemn_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_deadstemn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_deadstemn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_frootn_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_frootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_frootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livecrootn_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livecrootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livecrootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_livecrootn_to_deadcrootn_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_deadcrootn_fire_patch , & ! Output: [real(r8) (:) ] + m_deadcrootn_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_deadcrootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_deadcrootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] + m_retransn_to_litter_fire => cnveg_nitrogenflux_inst%m_retransn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] m_decomp_npools_to_fire_vr => cnveg_nitrogenflux_inst%m_decomp_npools_to_fire_vr_col , & ! Output: [real(r8) (:,:,:) ] VR decomp. N fire loss (gN/m3/s) - m_n_to_litr_met_fire => cnveg_nitrogenflux_inst%m_n_to_litr_met_fire_col , & ! Output: [real(r8) (:,:) ] - m_n_to_litr_cel_fire => cnveg_nitrogenflux_inst%m_n_to_litr_cel_fire_col , & ! Output: [real(r8) (:,:) ] - m_n_to_litr_lig_fire => cnveg_nitrogenflux_inst%m_n_to_litr_lig_fire_col & ! Output: [real(r8) (:,:) ] + m_n_to_litr_met_fire => cnveg_nitrogenflux_inst%m_n_to_litr_met_fire_col , & ! Output: [real(r8) (:,:) ] + m_n_to_litr_cel_fire => cnveg_nitrogenflux_inst%m_n_to_litr_cel_fire_col , & ! Output: [real(r8) (:,:) ] + m_n_to_litr_lig_fire => cnveg_nitrogenflux_inst%m_n_to_litr_lig_fire_col & ! Output: [real(r8) (:,:) ] ) transient_landcover = run_has_transient_landcover() @@ -633,14 +633,14 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte m_deadstemc_storage_to_fire(p) = deadstemc_storage(p) * f * cc_other(patch%itype(p)) m_deadstemc_xfer_to_fire(p) = deadstemc_xfer(p) * f * cc_other(patch%itype(p)) m_frootc_to_fire(p) = frootc(p) * f * 0._r8 - m_frootc_storage_to_fire(p) = frootc_storage(p) * f * cc_other(patch%itype(p)) + m_frootc_storage_to_fire(p) = frootc_storage(p) * f * cc_other(patch%itype(p)) m_frootc_xfer_to_fire(p) = frootc_xfer(p) * f * cc_other(patch%itype(p)) m_livecrootc_to_fire(p) = livecrootc(p) * f * 0._r8 - m_livecrootc_storage_to_fire(p) = livecrootc_storage(p) * f * cc_other(patch%itype(p)) - m_livecrootc_xfer_to_fire(p) = livecrootc_xfer(p) * f * cc_other(patch%itype(p)) + m_livecrootc_storage_to_fire(p) = livecrootc_storage(p) * f * cc_other(patch%itype(p)) + m_livecrootc_xfer_to_fire(p) = livecrootc_xfer(p) * f * cc_other(patch%itype(p)) m_deadcrootc_to_fire(p) = deadcrootc(p) * f * 0._r8 - m_deadcrootc_storage_to_fire(p) = deadcrootc_storage(p) * f* cc_other(patch%itype(p)) - m_deadcrootc_xfer_to_fire(p) = deadcrootc_xfer(p) * f * cc_other(patch%itype(p)) + m_deadcrootc_storage_to_fire(p) = deadcrootc_storage(p) * f* cc_other(patch%itype(p)) + m_deadcrootc_xfer_to_fire(p) = deadcrootc_xfer(p) * f * cc_other(patch%itype(p)) m_gresp_storage_to_fire(p) = gresp_storage(p) * f * cc_other(patch%itype(p)) m_gresp_xfer_to_fire(p) = gresp_xfer(p) * f * cc_other(patch%itype(p)) @@ -658,11 +658,11 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte m_frootn_to_fire(p) = frootn(p) * f * 0._r8 m_frootn_storage_to_fire(p) = frootn_storage(p) * f * cc_other(patch%itype(p)) m_frootn_xfer_to_fire(p) = frootn_xfer(p) * f * cc_other(patch%itype(p)) - m_livecrootn_to_fire(p) = livecrootn(p) * f * 0._r8 - m_livecrootn_storage_to_fire(p) = livecrootn_storage(p) * f * cc_other(patch%itype(p)) + m_livecrootn_to_fire(p) = livecrootn(p) * f * 0._r8 + m_livecrootn_storage_to_fire(p) = livecrootn_storage(p) * f * cc_other(patch%itype(p)) m_livecrootn_xfer_to_fire(p) = livecrootn_xfer(p) * f * cc_other(patch%itype(p)) m_deadcrootn_to_fire(p) = deadcrootn(p) * f * 0._r8 - m_deadcrootn_xfer_to_fire(p) = deadcrootn_xfer(p) * f * cc_other(patch%itype(p)) + m_deadcrootn_xfer_to_fire(p) = deadcrootn_xfer(p) * f * cc_other(patch%itype(p)) m_deadcrootn_storage_to_fire(p) = deadcrootn_storage(p) * f * cc_other(patch%itype(p)) m_retransn_to_fire(p) = retransn(p) * f * cc_other(patch%itype(p)) @@ -681,13 +681,13 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) m_livestemc_to_litter_fire(p) = livestemc(p) * f * & (1._r8 - cc_lstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) + fm_droot(patch%itype(p)) m_livestemc_storage_to_litter_fire(p) = livestemc_storage(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & fm_other(patch%itype(p)) m_livestemc_xfer_to_litter_fire(p) = livestemc_xfer(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent the fraction of plant-tissue mortality for deadstem/deadcroot ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 m_livestemc_to_deadstemc_fire(p) = livestemc(p) * f * & @@ -697,7 +697,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) m_deadstemc_to_litter_fire(p) = deadstemc(p) * f * m * & (1._r8 - cc_dstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) + fm_droot(patch%itype(p)) m_deadstemc_storage_to_litter_fire(p) = deadstemc_storage(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & fm_other(patch%itype(p)) @@ -718,10 +718,10 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte fm_droot(patch%itype(p)) m_livecrootc_storage_to_litter_fire(p) = livecrootc_storage(p) * f * & (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) m_livecrootc_xfer_to_litter_fire(p) = livecrootc_xfer(p) * f * & (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) m_livecrootc_to_deadcrootc_fire(p) = livecrootc(p) * f * & (fm_lroot(patch%itype(p))-fm_droot(patch%itype(p))) m_deadcrootc_to_litter_fire(p) = deadcrootc(p) * f * m * & @@ -731,22 +731,22 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte fm_other(patch%itype(p)) m_deadcrootc_xfer_to_litter_fire(p) = deadcrootc_xfer(p) * f * & (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) m_gresp_storage_to_litter_fire(p) = gresp_storage(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) m_gresp_xfer_to_litter_fire(p) = gresp_xfer(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) - ! nitrogen pools + ! nitrogen pools m_leafn_to_litter_fire(p) = leafn(p) * f * & (1._r8 - cc_leaf(patch%itype(p))) * & fm_leaf(patch%itype(p)) m_leafn_storage_to_litter_fire(p) = leafn_storage(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) m_leafn_xfer_to_litter_fire(p) = leafn_xfer(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & fm_other(patch%itype(p)) @@ -757,7 +757,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte fm_droot(patch%itype(p)) m_livestemn_storage_to_litter_fire(p) = livestemn_storage(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) m_livestemn_xfer_to_litter_fire(p) = livestemn_xfer(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & fm_other(patch%itype(p)) @@ -770,7 +770,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) m_deadstemn_to_litter_fire(p) = deadstemn(p) * f * m * & (1._r8 - cc_dstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) + fm_droot(patch%itype(p)) m_deadstemn_storage_to_litter_fire(p) = deadstemn_storage(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & fm_other(patch%itype(p)) @@ -794,7 +794,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte fm_other(patch%itype(p)) m_livecrootn_xfer_to_litter_fire(p) = livecrootn_xfer(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) m_livecrootn_to_deadcrootn_fire(p) = livecrootn(p) * f * & (fm_lroot(patch%itype(p))-fm_droot(patch%itype(p))) m_deadcrootn_to_litter_fire(p) = deadcrootn(p) * f * m * & @@ -807,12 +807,12 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte fm_other(patch%itype(p)) m_retransn_to_litter_fire(p) = retransn(p) * f * & (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) + fm_other(patch%itype(p)) if (use_cndv) then if ( woody(patch%itype(p)) == 1._r8 )then if ( livestemc(p)+deadstemc(p) > 0._r8 )then - nind(p) = nind(p)*(1._r8-1._r8*fm_droot(patch%itype(p))*f) + nind(p) = nind(p)*(1._r8-1._r8*fm_droot(patch%itype(p))*f) else nind(p) = 0._r8 end if @@ -821,7 +821,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte if (patch%itype(p) == noveg) leafcmax(p) = 0._r8 end if - end do ! end of patches loop + end do ! end of patches loop ! fire-induced transfer of carbon and nitrogen pools to litter and cwd @@ -869,13 +869,13 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte +(m_livecrootc_storage_to_litter_fire(p) + & m_livecrootc_xfer_to_litter_fire(p) & +m_deadcrootc_storage_to_litter_fire(p) + & - m_deadcrootc_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) + m_deadcrootc_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) m_c_to_litr_cel_fire(c,j)=m_c_to_litr_cel_fire(c,j) + & (m_leafc_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + m_frootc_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) m_c_to_litr_lig_fire(c,j)=m_c_to_litr_lig_fire(c,j) + & (m_leafc_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + m_frootc_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) m_n_to_litr_met_fire(c,j)=m_n_to_litr_met_fire(c,j) + & ((m_leafn_to_litter_fire(p)*lf_flab(patch%itype(p)) & @@ -891,26 +891,26 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte +(m_livecrootn_storage_to_litter_fire(p) + & m_livecrootn_xfer_to_litter_fire(p) & +m_deadcrootn_storage_to_litter_fire(p) + & - m_deadcrootn_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) + m_deadcrootn_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) m_n_to_litr_cel_fire(c,j)=m_n_to_litr_cel_fire(c,j) + & (m_leafn_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + m_frootn_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) m_n_to_litr_lig_fire(c,j)=m_n_to_litr_lig_fire(c,j) + & (m_leafn_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + m_frootn_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) end if end if end do end do end do ! - ! vertically-resolved decomposing C/N fire loss + ! vertically-resolved decomposing C/N fire loss ! column loop ! do fc = 1,num_soilc c = filter_soilc(fc) - f = farea_burned(c) + f = farea_burned(c) do j = 1, nlevdecomp ! carbon fluxes @@ -978,7 +978,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! They will be added here in proportion to the carbon emission ! Emission factors differ for various fire types - end associate + end associate end subroutine CNFireFluxes @@ -1023,16 +1023,16 @@ subroutine hdm_init( this, bounds, NLFilename ) ! !ARGUMENTS: implicit none class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! !LOCAL VARIABLES: integer :: stream_year_first_popdens ! first year in pop. dens. stream to use integer :: stream_year_last_popdens ! last year in pop. dens. stream to use - integer :: model_year_align_popdens ! align stream_year_first_hdm with + integer :: model_year_align_popdens ! align stream_year_first_hdm with integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_popdens ! population density streams filename character(len=CL) :: popdensmapalgo = 'bilinear' ! mapping alogrithm for population density character(len=CL) :: popdens_tintalgo = 'nearest'! time interpolation alogrithm for population density @@ -1078,21 +1078,19 @@ subroutine hdm_init( this, bounds, NLFilename ) if (masterproc) then write(iulog,*) ' ' write(iulog,*) 'popdens_streams settings:' - write(iulog,*) ' stream_year_first_popdens = ',stream_year_first_popdens - write(iulog,*) ' stream_year_last_popdens = ',stream_year_last_popdens - write(iulog,*) ' model_year_align_popdens = ',model_year_align_popdens + write(iulog,*) ' stream_year_first_popdens = ',stream_year_first_popdens + write(iulog,*) ' stream_year_last_popdens = ',stream_year_last_popdens + write(iulog,*) ' model_year_align_popdens = ',model_year_align_popdens write(iulog,*) ' stream_fldFileName_popdens = ',stream_fldFileName_popdens write(iulog,*) ' popdens_tintalgo = ',popdens_tintalgo write(iulog,*) ' ' endif call clm_domain_mct (bounds, dom_clm) - if (.not. associated(this%sdat_hdm)) then - allocate(this%sdat_hdm) - endif + call shr_strdata_create(this%sdat_hdm,name="clmhdm", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -1104,11 +1102,11 @@ subroutine hdm_init( this, bounds, NLFilename ) domFileName=trim(stream_fldFileName_popdens), & domTvarName='time', & domXvarName='lon' , & - domYvarName='lat' , & + domYvarName='lat' , & domAreaName='area', & domMaskName='mask', & filePath='', & - filename=(/trim(stream_fldFileName_popdens)/) , & + filename=(/trim(stream_fldFileName_popdens)/), & fldListFile='hdm', & fldListModel='hdm', & fillalgo='none', & @@ -1127,7 +1125,7 @@ subroutine hdm_init( this, bounds, NLFilename ) ptr_lnd=this%forc_hdm, default='inactive') end subroutine hdm_init - + !----------------------------------------------------------------------- subroutine hdm_interp( this, bounds) ! @@ -1139,7 +1137,7 @@ subroutine hdm_interp( this, bounds) ! ! !ARGUMENTS: class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: g, ig @@ -1160,7 +1158,7 @@ subroutine hdm_interp( this, bounds) ig = ig+1 this%forc_hdm(g) = this%sdat_hdm%avs(1)%rAttr(1,ig) end do - + end subroutine hdm_interp !----------------------------------------------------------------------- @@ -1181,16 +1179,16 @@ subroutine lnfm_init( this, bounds, NLFilename ) ! !ARGUMENTS: implicit none class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! ! !LOCAL VARIABLES: integer :: stream_year_first_lightng ! first year in Lightning stream to use integer :: stream_year_last_lightng ! last year in Lightning stream to use - integer :: model_year_align_lightng ! align stream_year_first_lnfm with + integer :: model_year_align_lightng ! align stream_year_first_lnfm with integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_lightng ! lightning stream filename to read character(len=CL) :: lightng_tintalgo = 'linear'! time interpolation alogrithm character(len=CL) :: lightngmapalgo = 'bilinear'! Mapping alogrithm @@ -1236,21 +1234,19 @@ subroutine lnfm_init( this, bounds, NLFilename ) if (masterproc) then write(iulog,*) ' ' write(iulog,*) 'light_stream settings:' - write(iulog,*) ' stream_year_first_lightng = ',stream_year_first_lightng - write(iulog,*) ' stream_year_last_lightng = ',stream_year_last_lightng - write(iulog,*) ' model_year_align_lightng = ',model_year_align_lightng + write(iulog,*) ' stream_year_first_lightng = ',stream_year_first_lightng + write(iulog,*) ' stream_year_last_lightng = ',stream_year_last_lightng + write(iulog,*) ' model_year_align_lightng = ',model_year_align_lightng write(iulog,*) ' stream_fldFileName_lightng = ',stream_fldFileName_lightng write(iulog,*) ' lightng_tintalgo = ',lightng_tintalgo write(iulog,*) ' ' endif call clm_domain_mct (bounds, dom_clm) - if (.not. associated(this%sdat_lnfm)) then - allocate(this%sdat_lnfm) - endif + call shr_strdata_create(this%sdat_lnfm,name="clmlnfm", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -1262,7 +1258,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) domFileName=trim(stream_fldFileName_lightng), & domTvarName='time', & domXvarName='lon' , & - domYvarName='lat' , & + domYvarName='lat' , & domAreaName='area', & domMaskName='mask', & filePath='', & @@ -1285,7 +1281,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) ptr_lnd=this%forc_lnfm, default='inactive') end subroutine lnfm_init - + !----------------------------------------------------------------------- subroutine lnfm_interp(this, bounds ) ! @@ -1297,7 +1293,7 @@ subroutine lnfm_interp(this, bounds ) ! ! !ARGUMENTS: class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: g, ig @@ -1318,7 +1314,7 @@ subroutine lnfm_interp(this, bounds ) ig = ig+1 this%forc_lnfm(g) = this%sdat_lnfm%avs(1)%rAttr(1,ig) end do - + end subroutine lnfm_interp end module CNFireBaseMod diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 536526bdba..efd45634a6 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -68,7 +68,7 @@ module CNVegetationFacade use WaterFluxBulkType , only : waterfluxbulk_type use Wateratm2lndBulkType , only : wateratm2lndbulk_type use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type + use TemperatureType , only : temperature_type use CropType , only : crop_type use ch4Mod , only : ch4_type use CNDVType , only : dgvs_type @@ -149,7 +149,7 @@ module CNVegetationFacade ! - vocemis_inst ! - fireemis_inst ! - drydepvel_inst - + contains procedure, public :: Init procedure, public :: InitAccBuffer @@ -223,7 +223,7 @@ subroutine Init(this, bounds, NLFilename, nskip_steps, params_ncid) ! Note - always initialize the memory for cnveg_state_inst (used in biogeophys/) call this%cnveg_state_inst%Init(bounds) - + skip_steps = nskip_steps if (use_cn) then @@ -256,7 +256,7 @@ subroutine Init(this, bounds, NLFilename, nskip_steps, params_ncid) this%cnveg_carbonstate_inst%frootc_patch(begp:endp), & this%cnveg_carbonstate_inst%frootc_storage_patch(begp:endp), & this%cnveg_carbonstate_inst%deadstemc_patch(begp:endp) ) - call this%cnveg_nitrogenflux_inst%Init(bounds) + call this%cnveg_nitrogenflux_inst%Init(bounds) call this%c_products_inst%Init(bounds, species_non_isotope_type('C')) if (use_c13) then @@ -349,7 +349,7 @@ end subroutine CNReadNML subroutine InitAccBuffer(this, bounds) ! ! !DESCRIPTION: - ! Initialize accumulation buffer for types contained here + ! Initialize accumulation buffer for types contained here ! ! !USES: ! @@ -441,9 +441,9 @@ subroutine Restart(this, bounds, ncid, flag) ! ! !ARGUMENTS: class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag + type(bounds_type), intent(in) :: bounds + type(file_desc_t), intent(inout) :: ncid + character(len=*) , intent(in) :: flag integer :: reseed_patch(bounds%endp-bounds%begp+1) integer :: num_reseed_patch ! @@ -656,7 +656,7 @@ subroutine DynamicAreaConservation(this, bounds, clump_index, & ! ! !ARGUMENTS: class(cn_vegetation_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds ! Index of clump on which we're currently operating. Note that this implies that this ! routine must be called from within a clump loop. @@ -761,7 +761,7 @@ subroutine InitColumnBalance(this, bounds, num_allc, filter_allc, & ! ! !ARGUMENTS: class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_allc ! number of columns in allc filter integer , intent(in) :: filter_allc(:) ! filter for all active columns integer , intent(in) :: num_soilc ! number of soil columns in filter @@ -895,7 +895,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & ! ! !ARGUMENTS: class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilc ! number of soil columns in filter integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter @@ -958,7 +958,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & this%dgvs_inst, photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, this%cnfire_method, this%dribble_crophrv_xsmrpool_2atm) - ! fire carbon emissions + ! fire carbon emissions call CNFireEmisUpdate(bounds, num_soilp, filter_soilp, & this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, fireemis_inst ) @@ -987,7 +987,7 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & ! ! !ARGUMENTS: class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_allc ! number of columns in allc filter integer , intent(in) :: filter_allc(:) ! filter for all active columns integer , intent(in) :: num_soilc ! number of soil columns in filter @@ -1015,9 +1015,9 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & character(len=*), parameter :: subname = 'EcosystemDynamicsPostDrainage' !----------------------------------------------------------------------- - ! Update the nitrogen leaching rate as a function of soluble mineral N + ! Update the nitrogen leaching rate as a function of soluble mineral N ! and total soil water outflow. - + call CNDriverLeaching(bounds, & num_soilc, filter_soilc, & num_soilp, filter_soilp, & @@ -1025,7 +1025,7 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & this%cnveg_nitrogenflux_inst, this%cnveg_nitrogenstate_inst, & soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - ! Set controls on very low values in critical state variables + ! Set controls on very low values in critical state variables call t_startf('CNPrecisionControl') call CNPrecisionControl(bounds, num_soilp, filter_soilp, & @@ -1070,7 +1070,7 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & ! On the radiation time step, use C state variables to calculate ! vegetation structure (LAI, SAI, height) - if (doalb) then + if (doalb) then call CNVegStructUpdate(num_soilp, filter_soilp, & waterdiagnosticbulk_inst, frictionvel_inst, this%dgvs_inst, this%cnveg_state_inst, & crop_inst, this%cnveg_carbonstate_inst, canopystate_inst) @@ -1093,7 +1093,7 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & ! ! !ARGUMENTS: class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilc ! number of soil columns in filter integer , intent(in) :: filter_soilc(:) ! filter for soil columns type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst @@ -1109,9 +1109,7 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & DA_nstep = get_nstep_since_startup_or_lastDA_restart_or_pause() if (DA_nstep <= skip_steps )then if (masterproc) then -!$OMP MASTER write(iulog,*) '--WARNING-- skipping CN balance check for first timesteps after startup or data assimilation' -!$OMP END MASTER end if else @@ -1147,7 +1145,7 @@ subroutine EndOfTimeStepVegDynamics(this, bounds, num_natvegp, filter_natvegp, & ! ! !ARGUMENTS: class(cn_vegetation_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(inout) :: num_natvegp ! number of naturally-vegetated patches in filter integer , intent(inout) :: filter_natvegp(:) ! filter for naturally-vegetated patches type(atm2lnd_type) , intent(inout) :: atm2lnd_inst @@ -1213,7 +1211,7 @@ subroutine WriteHistory(this, bounds) ! ! !ARGUMENTS: class(cn_vegetation_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds ! ! !LOCAL VARIABLES: @@ -1456,12 +1454,12 @@ function get_froot_carbon_patch(this, bounds, tlai) result(froot_carbon_patch) else ! To get leaf biomass: ! bleaf = LAI / slatop -! g/m2 = m2/m2 / m2/g -! To get root biomass: +! g/m2 = m2/m2 / m2/g +! To get root biomass: ! broot = bleaf * froot_leaf(ivt(p)) ! g/m2 = g/m2 * g/g do p=bounds%begp, bounds%endp - if (pftcon%slatop(patch%itype(p)) > 0._r8) then + if (pftcon%slatop(patch%itype(p)) > 0._r8) then froot_carbon_patch(p) = tlai(p) & / pftcon%slatop(patch%itype(p)) & *pftcon%froot_leaf(patch%itype(p)) @@ -1501,12 +1499,12 @@ function get_croot_carbon_patch(this, bounds, tlai) result(croot_carbon_patch) else ! To get leaf biomass: ! bleaf = LAI / slatop -! g/m2 = m2/m2 / m2/g -! To get root biomass: +! g/m2 = m2/m2 / m2/g +! To get root biomass: ! broot = bleaf * froot_leaf(ivt(p)) ! g/m2 = g/m2 * g/g do p=bounds%begp, bounds%endp - if (pftcon%slatop(patch%itype(p)) > 0._r8) then + if (pftcon%slatop(patch%itype(p)) > 0._r8) then croot_carbon_patch(p) = tlai(p) & / pftcon%slatop(patch%itype(p)) & *pftcon%stem_leaf(patch%itype(p)) & diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 78b2cf0e24..82b53fb862 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -1,5 +1,7 @@ module SatellitePhenologyMod +#include "shr_assert.h" + !----------------------------------------------------------------------- ! !DESCRIPTION: ! CLM Satelitte Phenology model (SP) ecosystem dynamics (phenology, vegetation). @@ -11,6 +13,7 @@ module SatellitePhenologyMod use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance use shr_kind_mod , only : r8 => shr_kind_r8 use shr_kind_mod , only : CL => shr_kind_CL + use shr_kind_mod , only : CXX => shr_kind_CXX use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use abortutils , only : endrun @@ -23,7 +26,7 @@ module SatellitePhenologyMod use fileutils , only : getavu, relavu use PatchType , only : patch use CanopyStateType , only : canopystate_type - use WaterstateType , only : waterstate_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use perf_mod , only : t_startf, t_stopf use spmdMod , only : masterproc use spmdMod , only : mpicom, comp_id @@ -39,16 +42,18 @@ module SatellitePhenologyMod public :: SatellitePhenologyInit ! Dynamically allocate memory public :: interpMonthlyVeg ! interpolate monthly vegetation data public :: readAnnualVegetation ! Read in annual vegetation (needed for Dry-deposition) + public :: lai_advance ! Advance the LAI streams (outside of a Open-MP threading loop) ! ! !PRIVATE MEMBER FUNCTIONS: private :: readMonthlyVegetation ! read monthly vegetation data for two months - private :: lai_init ! position datasets for LAI - private :: lai_interp ! interpolates between two years of LAI data + private :: lai_init ! position datasets for LAI + private :: lai_interp ! interpolates between two years of LAI data (when LAI streams are being used) ! !PRIVATE MEMBER DATA: type(shr_strdata_type) :: sdat_lai ! LAI input data stream ! ! !PRIVATE TYPES: + integer, allocatable :: g_to_ig(:) ! Array matching gridcell index to data index integer , private :: InterpMonths1 ! saved month index real(r8), private :: timwt(2) ! time weights for month 1 and month 2 real(r8), private, allocatable :: mlai2t(:,:) ! lai for interpolation (2 months) @@ -73,7 +78,6 @@ subroutine lai_init(bounds) ! ! ! !USES: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -97,12 +101,13 @@ subroutine lai_init(bounds) type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_lai ! lai stream filename to read character(len=CL) :: lai_mapalgo = 'bilinear' ! Mapping alogrithm + character(len=CL) :: lai_tintalgo = 'linear' ! Time interpolation alogrithm character(*), parameter :: subName = "('laidyn_init')" character(*), parameter :: F00 = "('(laidyn_init) ',4a)" character(*), parameter :: laiString = "LAI" ! base string for field string integer , parameter :: numLaiFields = 16 ! number of fields to build field string - character(SHR_KIND_CXX) :: fldList ! field string + character(len=CXX) :: fldList ! field string !----------------------------------------------------------------------- ! ! deal with namelist variables here in init @@ -112,7 +117,8 @@ subroutine lai_init(bounds) stream_year_last_lai, & model_year_align_lai, & lai_mapalgo, & - stream_fldFileName_lai + stream_fldFileName_lai, & + lai_tintalgo ! Default values for namelist stream_year_first_lai = 1 ! first year in stream to use @@ -141,6 +147,7 @@ subroutine lai_init(bounds) call shr_mpi_bcast(stream_year_last_lai, mpicom) call shr_mpi_bcast(model_year_align_lai, mpicom) call shr_mpi_bcast(stream_fldFileName_lai, mpicom) + call shr_mpi_bcast(lai_tintalgo, mpicom) if (masterproc) then @@ -150,6 +157,7 @@ subroutine lai_init(bounds) write(iulog,*) ' stream_year_last_lai = ',stream_year_last_lai write(iulog,*) ' model_year_align_lai = ',model_year_align_lai write(iulog,*) ' stream_fldFileName_lai = ',trim(stream_fldFileName_lai) + write(iulog,*) ' lai_tintalgo = ',trim(lai_tintalgo) endif @@ -162,7 +170,7 @@ subroutine lai_init(bounds) call shr_strdata_create(sdat_lai,name="laidyn", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -171,7 +179,7 @@ subroutine lai_init(bounds) yearAlign=model_year_align_lai, & offset=0, & domFilePath='', & - domFileName=trim(stream_fldFileName_lai), & + domFileName=trim(stream_fldFileName_lai), & domTvarName='time', & domXvarName='lon' , & domYvarName='lat' , & @@ -183,6 +191,7 @@ subroutine lai_init(bounds) fldListModel=fldList, & fillalgo='none', & mapalgo=lai_mapalgo, & + tintalgo=lai_tintalgo, & calendar=get_calendar(), & taxmode='cycle' ) @@ -194,37 +203,71 @@ end subroutine lai_init !----------------------------------------------------------------------- ! - ! lai_interp + ! lai_advance ! !----------------------------------------------------------------------- - subroutine lai_interp(bounds, canopystate_inst) + subroutine lai_advance( bounds ) ! - ! Interpolate data stream information for Lai. + ! Advance LAI streams ! ! !USES: use clm_time_manager, only : get_curr_date - use pftconMod , only : noveg ! ! !ARGUMENTS: implicit none type(bounds_type) , intent(in) :: bounds - type(canopystate_type) , intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: - integer :: ivt, p, g, ip, ig, gpft + integer :: g, ig ! Indices integer :: year ! year (0, ...) for nstep+1 integer :: mon ! month (1, ..., 12) for nstep+1 integer :: day ! day of month (1, ..., 31) for nstep+1 integer :: sec ! seconds into current date for nstep+1 integer :: mcdate ! Current model date (yyyymmdd) - character(len=CL) :: stream_var_name !----------------------------------------------------------------------- call get_curr_date(year, mon, day, sec) mcdate = year*10000 + mon*100 + day call shr_strdata_advance(sdat_lai, mcdate, sec, mpicom, 'laidyn') + if ( .not. allocated(g_to_ig) )then + allocate (g_to_ig(bounds%begg:bounds%endg) ) + + ig = 0 + do g = bounds%begg,bounds%endg + ig = ig+1 + g_to_ig(g) = ig + end do + end if + + end subroutine lai_advance + + !----------------------------------------------------------------------- + ! + ! lai_interp + ! + !----------------------------------------------------------------------- + subroutine lai_interp(bounds, canopystate_inst) + ! + ! Interpolate data stream information for Lai. + ! + ! !USES: + use pftconMod , only : noveg + ! + ! !ARGUMENTS: + implicit none + type(bounds_type) , intent(in) :: bounds + type(canopystate_type) , intent(inout) :: canopystate_inst + ! + ! !LOCAL VARIABLES: + integer :: ivt, p, ip, ig + character(len=CL) :: stream_var_name + !----------------------------------------------------------------------- + SHR_ASSERT_FL( (lbound(g_to_ig,1) <= bounds%begg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(g_to_ig,1) >= bounds%endg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(sdat_lai%avs(1)%rAttr,2) <= g_to_ig(bounds%begg) ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(sdat_lai%avs(1)%rAttr,2) >= g_to_ig(bounds%endg) ), sourcefile, __LINE__) do p = bounds%begp, bounds%endp ivt = patch%itype(p) if (ivt /= noveg) then ! vegetated pft @@ -232,17 +275,7 @@ subroutine lai_interp(bounds, canopystate_inst) stream_var_name = 'LAI_'//trim(adjustl(stream_var_name)) ip = mct_aVect_indexRA(sdat_lai%avs(1),trim(stream_var_name)) endif - gpft = patch%gridcell(p) - - ! - ! Determine vector index corresponding to gpft - ! - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if (g == gpft) exit - end do - + ig = g_to_ig(patch%gridcell(p)) ! ! Set lai for each gridcell/patch combination ! @@ -298,7 +331,7 @@ end subroutine SatellitePhenologyInit !----------------------------------------------------------------------- subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & - waterstate_inst, canopystate_inst) + waterdiagnosticbulk_inst, canopystate_inst) ! ! !DESCRIPTION: ! Ecosystem dynamics: phenology, vegetation @@ -311,7 +344,7 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter integer , intent(in) :: filter_nolakep(bounds%endp-bounds%begp+1) ! patch filter for non-lake points - type(waterstate_type) , intent(in) :: waterstate_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst type(canopystate_type) , intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: @@ -321,8 +354,8 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & !----------------------------------------------------------------------- associate( & - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) + frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) + snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow @@ -336,6 +369,7 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & call lai_interp(bounds, canopystate_inst) endif + do fp = 1, num_nolakep p = filter_nolakep(fp) c = patch%column(p) @@ -408,7 +442,7 @@ subroutine interpMonthlyVeg (bounds, canopystate_inst) ! ! !USES: use clm_varctl , only : fsurdat - use clm_time_manager, only : get_curr_date, get_step_size, get_nstep + use clm_time_manager, only : get_curr_date, get_step_size_real, get_nstep ! ! !ARGUMENTS: type(bounds_type), intent(in) :: bounds @@ -427,7 +461,7 @@ subroutine interpMonthlyVeg (bounds, canopystate_inst) (/31,28,31,30,31,30,31,31,30,31,30,31/) !days per month !----------------------------------------------------------------------- - dtime = get_step_size() + dtime = get_step_size_real() call get_curr_date(kyr, kmo, kda, ksec, offset=int(dtime)) @@ -461,7 +495,7 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) ! read 12 months of veg data for dry deposition ! ! !USES: - use clm_varpar , only : numpft + use clm_varpar , only : maxveg, maxsoil_patches use pftconMod , only : noveg use domainMod , only : ldomain use fileutils , only : getfil @@ -495,7 +529,7 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) ! Determine necessary indices - allocate(mlai(bounds%begg:bounds%endg,0:numpft), stat=ier) + allocate(mlai(bounds%begg:bounds%endg,0:maxveg), stat=ier) if (ier /= 0) then write(iulog,*)subname, 'allocation error ' call endrun(msg=errMsg(sourcefile, __LINE__)) @@ -516,7 +550,7 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns call endrun(msg=errMsg(sourcefile, __LINE__)) end if - call check_dim(ncid, 'lsmpft', numpft+1) + call check_dim(ncid, 'lsmpft', maxsoil_patches) if (single_column) then call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & @@ -529,13 +563,13 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) dim1name=grlnd, nt=k) !! only vegetated patches have nonzero values - !! Assign lai/sai/hgtt/hgtb to the top [maxpatch_pft] patches + !! Assign lai/sai/hgtt/hgtb to the top [maxsoil_patches] patches !! as determined in subroutine surfrd do p = bounds%begp,bounds%endp g =patch%gridcell(p) if (patch%itype(p) /= noveg) then !! vegetated pft - do l = 0, numpft + do l = 0, maxveg if (l == patch%itype(p)) then annlai(k,p) = mlai(g,l) end if @@ -561,7 +595,7 @@ subroutine readMonthlyVegetation (bounds, & ! Read monthly vegetation data for two consec. months. ! ! !USES: - use clm_varpar , only : numpft + use clm_varpar , only : maxveg use pftconMod , only : noveg use fileutils , only : getfil use spmdMod , only : masterproc, mpicom, MPI_REAL8, MPI_INTEGER @@ -598,10 +632,10 @@ subroutine readMonthlyVegetation (bounds, & ! Determine necessary indices allocate(& - mlai(bounds%begg:bounds%endg,0:numpft), & - msai(bounds%begg:bounds%endg,0:numpft), & - mhgtt(bounds%begg:bounds%endg,0:numpft), & - mhgtb(bounds%begg:bounds%endg,0:numpft), & + mlai(bounds%begg:bounds%endg,0:maxveg), & + msai(bounds%begg:bounds%endg,0:maxveg), & + mhgtt(bounds%begg:bounds%endg,0:maxveg), & + mhgtb(bounds%begg:bounds%endg,0:maxveg), & stat=ier) if (ier /= 0) then write(iulog,*)subname, 'allocation big error ' @@ -640,13 +674,13 @@ subroutine readMonthlyVegetation (bounds, & if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_HEIGHT_TOP NOT on fveg file'//errMsg(sourcefile, __LINE__)) ! Only vegetated patches have nonzero values - ! Assign lai/sai/hgtt/hgtb to the top [maxpatch_pft] patches + ! Assign lai/sai/hgtt/hgtb to the top [maxsoil_patches] patches ! as determined in subroutine surfrd do p = bounds%begp,bounds%endp g =patch%gridcell(p) if (patch%itype(p) /= noveg) then ! vegetated pft - do l = 0, numpft + do l = 0, maxveg if (l == patch%itype(p)) then mlai2t(p,k) = mlai(g,l) msai2t(p,k) = msai(g,l) diff --git a/src/biogeochem/ch4FInundatedStreamType.F90 b/src/biogeochem/ch4FInundatedStreamType.F90 index bdbc7cc647..57498cc032 100644 --- a/src/biogeochem/ch4FInundatedStreamType.F90 +++ b/src/biogeochem/ch4FInundatedStreamType.F90 @@ -3,8 +3,8 @@ module ch4FInundatedStreamType #include "shr_assert.h" - !----------------------------------------------------------------------- - ! !DESCRIPTION: + !----------------------------------------------------------------------- + ! !DESCRIPTION: ! Contains methods for reading in finundated streams file for methane code. ! ! !USES @@ -60,7 +60,7 @@ module ch4FInundatedStreamType !============================================================================== subroutine Init(this, bounds, NLFilename) - ! + ! ! Initialize the ch4 finundated stream object ! ! Uses: @@ -82,12 +82,12 @@ subroutine Init(this, bounds, NLFilename) ! arguments implicit none class(ch4finundatedstream_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! local variables integer :: ig, g ! Indices - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information type(shr_strdata_type) :: sdat ! input data stream integer :: index_ZWT0 = 0 ! Index of ZWT0 field integer :: index_F0 = 0 ! Index of F0 field @@ -110,8 +110,8 @@ subroutine Init(this, bounds, NLFilename) call clm_domain_mct (bounds, dom_clm) call shr_strdata_create(sdat,name=stream_name,& - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -123,7 +123,7 @@ subroutine Init(this, bounds, NLFilename) domFileName=trim(control%stream_fldFileName_ch4finundated), & domTvarName='time', & domXvarName='LONGXY' , & - domYvarName='LATIXY' , & + domYvarName='LATIXY' , & domAreaName='AREA', & domMaskName='LANDMASK', & filePath='', & @@ -190,7 +190,7 @@ end subroutine Init logical function UseStreams(this) ! ! !DESCRIPTION: - ! Return true if + ! Return true if ! ! !USES: ! @@ -200,9 +200,9 @@ logical function UseStreams(this) ! ! !LOCAL VARIABLES: if ( trim(control%stream_fldFileName_ch4finundated) == '' )then - UseStreams = .false. + UseStreams = .false. else - UseStreams = .true. + UseStreams = .true. end if end function UseStreams @@ -245,7 +245,7 @@ subroutine CalcFinundated(this, bounds, num_soilc, filter_soilc, soilhydrology_i waterdiagnosticbulk_inst, qflx_surf_lag_col, finundated ) ! ! !DESCRIPTION: - ! + ! ! Calculate finundated according to the appropriate methodology ! ! !USES: @@ -311,10 +311,11 @@ end subroutine CalcFinundated !============================================================================== subroutine ReadNML(this, bounds, NLFilename) - ! - ! Read the namelist data stream information. + ! + ! Read the namelist data stream information. ! ! Uses: + use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -327,7 +328,7 @@ subroutine ReadNML(this, bounds, NLFilename) ! arguments implicit none class(streamcontrol_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! local variables diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 3b1e22f9a5..c276f7f826 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -67,7 +67,6 @@ subroutine PrescribedSoilMoistureInit(bounds) ! ! ! !USES: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -172,7 +171,7 @@ subroutine PrescribedSoilMoistureInit(bounds) call shr_strdata_create(sdat_soilm,name="soil_moisture", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsMap_lnd2Dsoi_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & diff --git a/src/biogeophys/UrbanTimeVarType.F90 b/src/biogeophys/UrbanTimeVarType.F90 index f18afa01ce..c2d4aac3f3 100644 --- a/src/biogeophys/UrbanTimeVarType.F90 +++ b/src/biogeophys/UrbanTimeVarType.F90 @@ -12,7 +12,7 @@ module UrbanTimeVarType use clm_varctl , only : iulog use landunit_varcon , only : isturb_MIN, isturb_MAX use clm_varcon , only : spval - use LandunitType , only : lun + use LandunitType , only : lun use GridcellType , only : grc use mct_mod use shr_strdata_mod , only : shr_strdata_type @@ -34,10 +34,10 @@ module UrbanTimeVarType procedure, public :: Init ! Allocate and initialize urbantv procedure, public :: urbantv_init ! Initialize urban time varying stream procedure, public :: urbantv_interp ! Interpolate urban time varying stream - + end type urbantv_type - !----------------------------------------------------------------------- + !----------------------------------------------------------------------- character(15), private :: stream_var_name(isturb_MIN:isturb_MAX) character(len=*), parameter, private :: sourcefile = & @@ -56,7 +56,7 @@ subroutine Init(this, bounds, NLFilename) ! ! !ARGUMENTS: class(urbantv_type) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds character(len=*) , intent(in) :: NLFilename ! Namelist filename ! ! !LOCAL VARIABLES: @@ -116,11 +116,11 @@ subroutine urbantv_init(this, bounds, NLFilename) integer :: ifield ! field index integer :: stream_year_first_urbantv ! first year in urban tv stream to use integer :: stream_year_last_urbantv ! last year in urban tv stream to use - integer :: model_year_align_urbantv ! align stream_year_first_urbantv + integer :: model_year_align_urbantv ! align stream_year_first_urbantv ! with this model year integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_urbantv ! urban tv streams filename character(len=CL) :: urbantvmapalgo = 'nn' ! mapping alogrithm for urban ac character(len=CL) :: urbantv_tintalgo = 'linear' ! time interpolation alogrithm @@ -192,7 +192,7 @@ subroutine urbantv_init(this, bounds, NLFilename) call shr_strdata_create(this%sdat_urbantv,name="clmurbantv", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & From dc08bfd7a573620e9699c65f9c42ae09108a5ae4 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 19 Jul 2020 18:48:57 -0600 Subject: [PATCH 1187/1973] fixed more problems in previous merge --- src/biogeochem/ch4FInundatedStreamType.F90 | 1 - src/cpl/nuopc/lnd_comp_nuopc.F90 | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/biogeochem/ch4FInundatedStreamType.F90 b/src/biogeochem/ch4FInundatedStreamType.F90 index 57498cc032..12db0528f8 100644 --- a/src/biogeochem/ch4FInundatedStreamType.F90 +++ b/src/biogeochem/ch4FInundatedStreamType.F90 @@ -315,7 +315,6 @@ subroutine ReadNML(this, bounds, NLFilename) ! Read the namelist data stream information. ! ! Uses: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 0102413c61..06382d8cb2 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -24,7 +24,7 @@ module lnd_comp_nuopc use domainMod , only : ldomain use controlMod , only : control_setNL use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use clm_varctl , only : inst_index, inst_suffix, inst_name + use clm_varctl , only : inst_index, inst_suffix use clm_varctl , only : single_column, clm_varctl_set, iulog use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch use clm_varcon , only : re @@ -217,8 +217,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call get_component_instance(gcomp, inst_suffix, inst_index, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - inst_name = "LND"//trim(inst_suffix) - !---------------------------------------------------------------------------- ! reset shr logging to my log file !---------------------------------------------------------------------------- From bd9e44a600a9c7391116c6cd638fec4d82db4bcc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 20 Jul 2020 14:16:14 -0600 Subject: [PATCH 1188/1973] CONUS finidat file needs to be interpolated (since we are using the crop version of fsurdat now), and remove the old conus_30x8 mapping files (will replace them with the new ones) --- bld/namelist_files/namelist_defaults_ctsm.xml | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index abd0e6f083..9a0bc3e691 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -855,7 +855,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200705.nc @@ -3003,47 +3003,6 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts - - - -lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_nomask_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_GLOBE-Gardner_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_LandScan2004_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_10x10min_nomask_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_0.5x0.5_MODIS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_ORNL-Soil_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_0.5x0.5_AVHRR_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_MODIS-wCsp_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_1km-merge-10min_HYDRO1K-merge-nomask_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_360x720cru_cruncep_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_10x10min_IGBPmergeICESatGIS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_GLOBE-Gardner-mergeGIS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_0.9x1.25_GRDC_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_ISRIC-WISE_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_USGS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_0.25x0.25_MODIS_to_conus_30_x8_nomask_aave_da_c181003.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_3x3min_MODISv2_to_conus_30_x8_nomask_aave_da_c190505.nc -lnd/clm2/mappingdata/maps/conus_30_x8/map_5x5min_IGBP-GSDP_to_conus_30_x8_nomask_aave_da_c181003.nc - - From efc3fdd8cdb765bfdcc37d0dfba2782632f4f2de Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 20 Jul 2020 17:17:23 -0600 Subject: [PATCH 1189/1973] bug fixes needed for compilation --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 06382d8cb2..61eee73fc2 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -357,6 +357,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: curr_ymd ! Start date (YYYYMMDD) integer :: curr_tod ! Start time of day (sec) integer :: dtime_sync ! coupling time-step from the input synchronization clock + integer :: localPet + integer :: localpecount integer, pointer :: gindex(:) ! global index space for land and ocean points integer, pointer :: gindex_lnd(:) ! global index space for just land points integer, pointer :: gindex_ocn(:) ! global index space for just ocean points From 95437abd2f82cf07ed9100641fba97336ebe14a1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 20 Jul 2020 23:13:41 -0600 Subject: [PATCH 1190/1973] Fix the 48x96 landuse.timeseries file fix #1074 --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 9a0bc3e691..95b1f06a95 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1039,7 +1039,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + use_crop=".false." >lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190214.nc lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc From ebb841df700a861153dbddd39587d6ed505809fe Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 20 Jul 2020 23:51:18 -0600 Subject: [PATCH 1191/1973] Do the match based on start-year rather than sim_year, so that will match the previous 2010 case --- bld/CLMBuildNamelist.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 4834bfc854..6d7c845ca8 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2286,8 +2286,10 @@ SIMYR: foreach my $sim_yr ( @sim_years ) { my $how_close = undef; if ( $nl_flags->{'sim_year'} eq "PtVg" ) { $how_close = abs(1850 - $sim_yr); - } elsif ( $nl_flags->{'flanduse_timeseries'} eq "null" ) { - $how_close = abs($nl_flags->{'sim_year'} - $sim_yr); + # EBK 07/20/2020 -- This makes sure the sim_year matched is based on the sim-year + # rather than the start year. + #} elsif ( $nl_flags->{'flanduse_timeseries'} eq "null" ) { + # $how_close = abs($nl_flags->{'sim_year'} - $sim_yr); } else { $how_close = abs($st_year - $sim_yr); } From e4085c738b2265d20d1ccc909cbc4b765666b5f1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 21 Jul 2020 01:26:06 -0600 Subject: [PATCH 1192/1973] Add in the ne0np4CONUS.ne30x8 mapping files --- bld/namelist_files/namelist_defaults_ctsm.xml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 95b1f06a95..8a0237c1e1 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2883,6 +2883,49 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts + + + + +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_5x5min_ORNL-Soil_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_3x3min_MODIS-wCsp_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_5x5min_ISRIC-WISE_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_0.9x1.25_GRDC_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_5x5min_nomask_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_3x3min_GLOBE-Gardner_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_3x3min_LandScan2004_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_360x720cru_cruncep_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_5x5min_IGBP-GSDP_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_3x3min_USGS_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_10x10min_nomask_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_3x3min_MODISv2_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_0.5x0.5_AVHRR_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_0.25x0.25_MODIS_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_0.5x0.5_MODIS_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc +lnd/clm2/mappingdata/maps/ne0np4CONUS.ne30x8/map_10x10min_IGBPmergeICESatGIS_to_ne0np4CONUS.ne30x8_nomask_aave_da_c200426.nc + + + lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_MODIS_to_5x5_amazon_nomask_aave_da_c110920.nc Date: Tue, 21 Jul 2020 13:28:28 -0600 Subject: [PATCH 1193/1973] Set st_year and ic_date if not set, so it can use reasonable assumptions --- bld/CLMBuildNamelist.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 6d7c845ca8..9d7c6ebfa9 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1193,7 +1193,16 @@ sub setup_cmdl_run_type { my $val; my $var = "clm_start_type"; my $ic_date = $nl->get_value('start_ymd'); - my $st_year = int( $ic_date / 10000); + my $st_year; + if ( defined($ic_date) ) { + $st_year = int( $ic_date / 10000); + } else { + $st_year = $nl_flags->{'sim_year'}; + $ic_date = $st_year *10000 + 101; + my $date = 'start_ymd'; + my $group = $definition->get_group_name($date); + $nl->set_variable_value($group, $date, $ic_date ); + } if (defined $opts->{$var}) { if ($opts->{$var} eq "default" ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, @@ -1209,6 +1218,7 @@ sub setup_cmdl_run_type { 'sim_year'=>$st_year ); } $nl_flags->{'clm_start_type'} = $nl->get_value($var); + $nl_flags->{'st_year'} = $st_year; } #------------------------------------------------------------------------------- @@ -2218,7 +2228,7 @@ sub setup_logic_initial_conditions { if (not defined $finidat ) { my $ic_date = $nl->get_value('start_ymd'); - my $st_year = int( $ic_date / 10000); + my $st_year = $nl_flags->{'st_year'}; my $nofail = 1; my %settings; $settings{'hgrid'} = $nl_flags->{'res'}; From 93366651f63f54eab9b2ec79157ca81e19a9e785 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 22 Jul 2020 17:53:34 -0600 Subject: [PATCH 1194/1973] Get the build-namelist unit tests working correctly, namelist_defaults settings had to be set more carefully, and there is a dependence between two namelist_defaults files that I ran into --- bld/namelist_files/namelist_defaults_ctsm.xml | 68 +++++++++++++------ .../namelist_defaults_overall.xml | 18 +++-- bld/unit_testers/build-namelist_test.pl | 7 +- 3 files changed, 67 insertions(+), 26 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index fef2fbd60b..ec8d3ffe5d 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -512,23 +512,36 @@ attributes from the config_cache.xml file (with keys converted to upper-case). Find Initial condition files: The settings use_init_interp, init_interp_attributes and finidat MUST all be coordinated together! + NOTE: And they need to be coordinated with clm_start_type that's in namelist_defaults_overall.xml + --> .true. + .true. -.true. - + maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4.ARCTIC.ne30x4" >.true. .true. -.true. -.true. + maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4.ARCTICGRIS.ne30x8">.true. .true. + maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4CONUS.ne30x8" >.true. +.true. +.true. +.true. +.true. +.true. +.true. + +.true. + .false. + hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 @@ -653,7 +666,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). - + hgrid=ne120np4.pg3 maxpft=79 mask=tx0.1v3 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 @@ -670,25 +683,41 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - -hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + + hgrid=ne0np4CONUS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 @@ -812,15 +841,15 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTICGRIS_ne30x8_mt12_simyr1982_c200428.nc - + lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200506.nc - + lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc - - + + +arb_ic +arb_ic +arb_ic +arb_ic startup startup startup startup arb_ic arb_ic -arb_ic -arb_ic -arb_ic arb_ic cold diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 411200f652..c2c1689097 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 878; +my $ntests = 890; if ( defined($opts{'compare'}) ) { - $ntests += 540; + $ntests += 549; } plan( tests=>$ntests ); @@ -335,6 +335,9 @@ sub make_config_cache { "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode clm5_0_cam6.0", "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res C192 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", ) { &make_env_run(); eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; From 8d8a61b93a2eb9486c22bd9ec8388f293258ecd8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 22 Jul 2020 18:21:59 -0600 Subject: [PATCH 1195/1973] Ignore the standard run system test log file --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 7948b49eed..af193fa4ce 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ manage_externals.log /cime/ /components/ +# run system test log file +run_sys_test.log + # ignore svn directories **/.svn/** .svn/ From abacd3a7ee2076fa49486d0171d63937e42150a6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 22 Jul 2020 18:22:44 -0600 Subject: [PATCH 1196/1973] Revert "Ignore the standard run system test log file" This reverts commit 8d8a61b93a2eb9486c22bd9ec8388f293258ecd8. --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index af193fa4ce..7948b49eed 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,6 @@ manage_externals.log /cime/ /components/ -# run system test log file -run_sys_test.log - # ignore svn directories **/.svn/** .svn/ From 8f3dd976c99125fbe1e6705ba418e5f8b6e205fe Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 22 Jul 2020 18:53:07 -0600 Subject: [PATCH 1197/1973] Update ChangeLog file --- doc/ChangeLog | 15 ++++++++++----- doc/ChangeSum | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 61f3cc2e47..da6d7d7670 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev105 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) / Chris Fischer -Date: Mon Jul 13 15:51:21 MDT 2020 +Date: Wed Jul 22 18:47:37 MDT 2020 One-line Summary: Bring in some new SE grids for CAM as well as initial condition files for them Purpose of changes @@ -13,7 +13,8 @@ Purpose of changes Also add some new initial condition (IC) files for 1979, 2000, and 2013 for use when coupled to CAM The process for picking initial condition files was improved so that there can be more than one year that matches - and it will do the best to pick the best match. Also added the possibility for 1982 and 2013 simulation years. + and it will do the best to pick the best match. Also added the possibility for 1982 and 2013 simulation years for + specific grid matches. Also update cime to a newer version that supports these new grids. @@ -75,6 +76,10 @@ Caveats for developers (e.g., code that is duplicated that requires double maint for the lnd_tuning_mode desired. It will pick based on year over an exact match in resolution. You can get around this by setting use_init_interp to be specific for a resolution + Also realized that there is a dependence between the namelist_defaults_ctsm.xml file and namelist_defaults_overall.xml + for the clm_start_type item. It must be coordinated with use_init_interp, init_interp_attributes and finidat + to work properly. I added a comment about this. We should probably just move them into the same file. + Changes to tests or testing: Added tests for new grids Code reviewed by: self, fischer-ncar, adamrher @@ -86,7 +91,7 @@ CTSM testing: regular build-namelist tests: - izumi - OK (121 tests fail comparison to previous verison due to new IC files) + cheyenne - OK (130 tests fail comparison to previous verison due to new IC files) tools-tests (test/tools): @@ -102,7 +107,7 @@ CTSM testing: regular regular tests (aux_clm): - cheyenne ---- + cheyenne ---- OK izumi ------- PASS If the tag used for baseline comparisons was NOT the previous tag, note that here: @@ -111,7 +116,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: No bit-for-bit +Changes answers relative to baseline: No bit-for-bit (unless running with CAM because of new finidat files) Detailed list of changes ------------------------ diff --git a/doc/ChangeSum b/doc/ChangeSum index e698eadba8..db92d89ea4 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm1.0.dev105 erik/fis 07/13/2020 Bring in some new SE grids for CAM as well as initial condition files for them + ctsm1.0.dev105 erik/fis 07/22/2020 Bring in some new SE grids for CAM as well as initial condition files for them ctsm1.0.dev104 sacks 07/06/2020 Add LILAC ctsm1.0.dev103 slevis 06/29/2020 Gridcell-level error-check for methane (CH4) ctsm1.0.dev102 erik/ole 06/26/2020 Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 From 1a54edef64eae7eb5035c6bbc7be7446a3e810e9 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 23 Jul 2020 00:40:15 -0600 Subject: [PATCH 1198/1973] minor changes and updates... --- doc/source/lilac/specific-atm-models/wrf.rst | 61 +++++++++----------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index cb590f24fc..19f307f1ab 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -13,7 +13,7 @@ repeats some information from earlier sections but with minimal explanation. .. important:: This section assumes use of a machine that has been ported to CIME. - In this example we assume NCAR’s cheyenne computer in particular. + In this example we assume NCAR’s Cheyenne HPC system in particular. Clone WRF and CTSM Repositories @@ -21,25 +21,20 @@ Clone WRF and CTSM Repositories Clone the WRF CTSM feature branch:: - git clone https://github.com/billsacks/WRF.git - cd WRF + git clone git@github.com:negin513/WRF-1.git + cd WRF-1 git checkout lilac_dev .. todo:: - update the git address to WRF feature branch... + update the git address to WRF repository and feature branch... Clone the CTSM repository:: git clone https://github.com/ESCOMP/CTSM.git cd CTSM - git checkout lilac_cap ./manage_externals/checkout_externals -.. todo:: - - Remove "git checkout lilac_cap" from the above when ready - Build CTSM and its dependencies ------------------------------- @@ -48,15 +43,15 @@ Build CTSM and its dependencies based on the instructions from previous sections ./lilac/build_ctsm /PATH/TO/CTSM/BUILD --machine MACHINE --compiler COMPILER -For example on `Cheyenne:` for `Intel` compiler:: +For example on ``Cheyenne`` and for ``Intel`` compiler:: ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne .. note:: - Run ./lilac/build_ctsm -h to see all options available, - for example if you would like to run with threading support you can use `--build-with-openmp` + Run ``./lilac/build_ctsm -h`` to see all options available. + For example if you would like to run with threading support you can use ``--build-with-openmp``. .. warning:: @@ -67,11 +62,11 @@ Building WRF with CTSM ---------------------- First, load the same modules and set the same environments as used for CTSM build by -sourcing ctsm_build_environment.sh for Bash:: +sourcing ``ctsm_build_environment.sh`` for Bash:: source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh -or sourcing ctsm_build_environment.csh for Cshell: +or sourcing ``ctsm_build_environment.csh`` for Cshell: .. code-block:: Tcsh @@ -127,7 +122,7 @@ in parallel. .. tip:: - dmpar or distributed memory parallelization is the most highly tested and + ``dmpar`` or distributed memory parallelization is the most highly tested and recommended for compiling WRF. The next prompt requests an option for nesting. Currently nesting is not @@ -144,8 +139,7 @@ or search the file for the string "Error" with a capital E. .. note:: - The ./compile step may take more than 30 minutes to complete. - While you wait, follow the instructions in Section 3.2.2 (next) + The ``./compile`` step may take more than 30 minutes to complete. .. tip:: @@ -155,8 +149,8 @@ or search the file for the string "Error" with a capital E. .. seealso:: For further detail on preparing the CTSM, including how to - recompile when making code changes to the CTSM, read `Section 3.2. - `__ + recompile when making code changes to the CTSM, read + section :numref:`obtaining-building-and-running` . Compile WRF Preprocessing System (WPS) -------------------------------------- @@ -191,7 +185,7 @@ Then, compile WPS:: .. note:: - If wps builds succesfully you should see geogrid.exe, ungrib.exe, and metgrid.exe. + If wps builds succesfully you should see ``geogrid.exe``, ``ungrib.exe``, and ``metgrid.exe``. Alternatively, you can check the log for successful build messages. @@ -250,7 +244,6 @@ metgrid step:: - Run real.exe ------------ @@ -275,10 +268,6 @@ To run WRF-CTSM, in your namelist change land-surface option to 51:: sf_surface_physics = 51 -.. todo:: - - add the link and adding some note that nested run is not possible.... - Run real.exe (if compiled parallel submit a batch job) to generate ``wrfinput`` and ``wrfbdy`` files. @@ -290,9 +279,13 @@ Check the last line of the real log file for the following message:: Set CTSM runtime options ------------------------ -Now follow the instructions in this Section:: +.. todo:: + + Sam, can you please clarify this section. + +Now follow the instructions in section :numref:`setting-ctsm-runtime-options` +for setting CTSM runtime options. - https:../obtaining-building-and-running/setting-ctsm-runtime-options.html In step 3 of that Section we used for this example:: @@ -331,17 +324,17 @@ If real.exe completed successfully, we should have ``wrfinput`` and ``wrfbdy`` f in our directory. If you plan to use this example's preexisting files, copy -the following files to your WRF/run directory:: +the following files to your WRF run directory:: - /glade/work/slevis/git_wrf/WRF/test/em_real/namelist.input.ctsm.2013.d01.12month - /glade/work/slevis/git_wrf/WRF/test/em_real/wrfinput_d01.ERAI.12month - /glade/work/slevis/git_wrf/WRF/test/em_real/wrfbdy_d01.ERAI.12month + ln -sf /glade/work/slevis/git_wrf/WRF/test/em_real/namelist.input.ctsm.2013.d01.12month namelist.input + ln -sf /glade/work/slevis/git_wrf/WRF/test/em_real/wrfinput_d01.ERAI.12month wrfinput_d01 + ln -sf /glade/work/slevis/git_wrf/WRF/test/em_real/wrfbdy_d01.ERAI.12month wrfbdy_d01 Now run WRF-CTSM. On Cheyenne this means submitting a batch job to PBS (Pro workload management system). For detailed instructions on running a batch job on Cheyenne, please check: https://www2.cisl.ucar.edu/resources/computational-systems/cheyenne/running-jobs/submitting-jobs-pbs -A simple PBS script to run WRF-CTSM on Cheyenne looks like this: +A simple PBS script to run WRF-CTSM on ``Cheyenne`` looks like this: .. code-block:: Tcsh @@ -364,7 +357,9 @@ A simple PBS script to run WRF-CTSM on Cheyenne looks like this: ### Run the executable mpiexec_mpt ./wrf.exe -If you named this script run_wrf_ctsm.csh, submit the job like this:: +To submit a batch job to the ``Cheyenne`` queues, use ``qsub`` command followed +by the PBS script name. +For example, if you named this script ``run_wrf_ctsm.csh``, submit the job like this:: qsub run_wrf_ctsm.csh From 5b2d01b59f1186096c2e40958bf1e72093d978b0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 23 Jul 2020 06:42:45 -0600 Subject: [PATCH 1199/1973] Fix link --- .../setting-ctsm-runtime-options.rst | 2 +- doc/source/lilac/specific-atm-models/wrf.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst index a338324e07..bcdb709dbf 100644 --- a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst +++ b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst @@ -119,7 +119,7 @@ The first set of options in this file specifies key file names: NWP / prediction applications, you will typically want a customized initial condition file. The process for generating this file will depend on your atmosphere model and workflow, but an example for WRF is given in section - :numref:`wrf-create-input-namelists-for-ctsm-and-lilac`. + :numref:`wrf-set-ctsm-runtime-options`. The remainder of this file specifies a variety of high-level options, each of which sets the default values for a number of CTSM's runtime parameters. The default values should be diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 19f307f1ab..b29ce6e2d5 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -276,6 +276,8 @@ Check the last line of the real log file for the following message:: SUCCESS COMPLETE REAL_EM INIT +.. _wrf-set-ctsm-runtime-options: + Set CTSM runtime options ------------------------ From b75ad2a15df6e3df7cf84792aa24876dedca3f81 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 23 Jul 2020 09:11:08 -0600 Subject: [PATCH 1200/1973] Update externals for CMEPS to hashes from nuopc_dev branch so will run, add notes about answer changes to change files, update time for one test that ran over --- Externals_cime.cfg | 16 +++++++++++++++- cime_config/testdefs/testlist_clm.xml | 2 +- doc/ChangeLog | 15 +++++++++++---- doc/ChangeSum | 2 +- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 46cd24b7d2..94b569d479 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,9 +1,23 @@ [cmeps] -hash = 386e1631a6a1e1900700c3a04d693df8692c9420 +hash = 9376b87 protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ required = True +[fox] +hash = 0ed59c1 +protocol = git +repo_url = https://github.com/ESMCI/fox.git +local_path = src/externals/fox +required = True + +[cdeps] +hash = 8e77759 +protocol = git +repo_url = https://github.com/ESCOMP/CDEPS.git +local_path = src/components/cdeps +required = True + [externals_description] schema_version = 1.0.0 diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 6f348c3f8a..413cdc4216 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1162,7 +1162,7 @@ - + diff --git a/doc/ChangeLog b/doc/ChangeLog index da6d7d7670..8c46437257 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev105 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) / Chris Fischer -Date: Wed Jul 22 18:47:37 MDT 2020 +Date: Thu Jul 23 08:59:37 MDT 2020 One-line Summary: Bring in some new SE grids for CAM as well as initial condition files for them Purpose of changes @@ -16,7 +16,9 @@ Purpose of changes and it will do the best to pick the best match. Also added the possibility for 1982 and 2013 simulation years for specific grid matches. - Also update cime to a newer version that supports these new grids. + Also update cime to a newer version that supports these new grids. And update CMEPS (and hence add in fox, CDEPS) + to latest used on the nuopc_dev branch. Testing with nuopc wouldn't work without this update. The cime version updates + the tables for dry-deposition and changes answers for dry-deposition when it's turned on. Bugs fixed or introduced ------------------------ @@ -25,10 +27,11 @@ Issues fixed (include CTSM Issue #): #992 #994 Fixes #992 -- New initial conditions for 1979, 2000 Fixes #994 -- New CAM SE grids Fixes #888 -- Add support for various "physics grids" needed by CAM -CIME Issues fixed (include issue #): #3593, #3569, #3564 +CIME Issues fixed (include issue #): #3593, #3569, #3564, PR#3557 cime/#3593 -- Fix mapping files for new grids cime/#3569 -- Fix cime regression testing cime/#3564 -- Change alias for arctic grids + cime/#3557 -- updates to dry deposition data (PR) Significant changes to scientifically-supported configurations -------------------------------------------------------------- @@ -117,12 +120,16 @@ Answer changes -------------- Changes answers relative to baseline: No bit-for-bit (unless running with CAM because of new finidat files) + Running with nuopc changes answers because of updates to nuopc drivers + Dry-deposition changes answers when turned on (but doesn't effect anything else) Detailed list of changes ------------------------ -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cmeps, cdeps, fox cime updated to cime5.8.28 (from branch_tags/cime5.8.24_a01) + fox, and cdeps added in + cmeps, cdeps and fox updated to hashes used in the nuopc_dev branch of CESM Pull Requests that document the changes (include PR ids): #1038 (https://github.com/ESCOMP/ctsm/pull) diff --git a/doc/ChangeSum b/doc/ChangeSum index db92d89ea4..595b35fb19 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm1.0.dev105 erik/fis 07/22/2020 Bring in some new SE grids for CAM as well as initial condition files for them + ctsm1.0.dev105 erik/fis 07/23/2020 Bring in some new SE grids for CAM as well as initial condition files for them ctsm1.0.dev104 sacks 07/06/2020 Add LILAC ctsm1.0.dev103 slevis 06/29/2020 Gridcell-level error-check for methane (CH4) ctsm1.0.dev102 erik/ole 06/26/2020 Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 From 2fe11181832f3ca7311df59e788bc0f315c265a5 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 23 Jul 2020 09:45:25 -0600 Subject: [PATCH 1201/1973] removing see also and linking to CISL instructions for running on Cheyenne. --- doc/source/lilac/specific-atm-models/wrf.rst | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index b29ce6e2d5..658ca6d096 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -8,12 +8,13 @@ This section includes instructions on how to use WRF with CTSM using LILAC. The procedure for building and running the CTSM library and its dependencies -repeats some information from earlier sections but with minimal explanation. +repeats some information from earlier section +:numref:`obtaining-building-and-running` but with minimal explanation. .. important:: - This section assumes use of a machine that has been ported to CIME. - In this example we assume NCAR’s Cheyenne HPC system in particular. + This section assumes use of a machine that has been ported to ``CIME``. + In this example we assume NCAR’s ``Cheyenne`` HPC system in particular. Clone WRF and CTSM Repositories @@ -146,12 +147,6 @@ or search the file for the string "Error" with a capital E. Optional: One may use ``tmux`` or ``nohup`` for configuring and compiling. Try ``man nohup`` for more information. -.. seealso:: - - For further detail on preparing the CTSM, including how to - recompile when making code changes to the CTSM, read - section :numref:`obtaining-building-and-running` . - Compile WRF Preprocessing System (WPS) -------------------------------------- @@ -333,8 +328,8 @@ the following files to your WRF run directory:: ln -sf /glade/work/slevis/git_wrf/WRF/test/em_real/wrfbdy_d01.ERAI.12month wrfbdy_d01 Now run WRF-CTSM. On Cheyenne this means submitting a batch job to PBS (Pro workload management system). -For detailed instructions on running a batch job on Cheyenne, please check: -https://www2.cisl.ucar.edu/resources/computational-systems/cheyenne/running-jobs/submitting-jobs-pbs +Please check NCAR CISL's `instructions on running a batch job on Cheyenne. +`__ A simple PBS script to run WRF-CTSM on ``Cheyenne`` looks like this: From 33b45cdb4214b46a2951bb977489b296934c18c9 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 23 Jul 2020 09:52:00 -0600 Subject: [PATCH 1202/1973] renaming from notes on ... to instructions on running CTSM with ... --- doc/source/lilac/specific-atm-models/index.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/index.rst b/doc/source/lilac/specific-atm-models/index.rst index 04a1976253..59ba4192a0 100644 --- a/doc/source/lilac/specific-atm-models/index.rst +++ b/doc/source/lilac/specific-atm-models/index.rst @@ -1,8 +1,8 @@ .. _specific-atm-models: -===================================== - Notes on specific atmosphere models -===================================== +============================================================== + Instructions on running CTSM with specific atmosphere models +============================================================== .. toctree:: :maxdepth: 2 From be2975765637595c7cbe05c4f3fadd26d524c100 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 23 Jul 2020 09:54:55 -0600 Subject: [PATCH 1203/1973] small change. --- doc/source/lilac/specific-atm-models/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/lilac/specific-atm-models/index.rst b/doc/source/lilac/specific-atm-models/index.rst index 59ba4192a0..03e45a9353 100644 --- a/doc/source/lilac/specific-atm-models/index.rst +++ b/doc/source/lilac/specific-atm-models/index.rst @@ -1,7 +1,7 @@ .. _specific-atm-models: ============================================================== - Instructions on running CTSM with specific atmosphere models + Instructions on using CTSM with specific atmosphere models ============================================================== .. toctree:: From 311543fe48cde4d2adfbbd9175dc2e9ba0affeb8 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 23 Jul 2020 12:18:17 -0600 Subject: [PATCH 1204/1973] changing the repository address to https... --- doc/source/lilac/specific-atm-models/wrf.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 658ca6d096..7cc0a3d846 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -22,7 +22,7 @@ Clone WRF and CTSM Repositories Clone the WRF CTSM feature branch:: - git clone git@github.com:negin513/WRF-1.git + git clone https://github.com/negin513/WRF-1.git cd WRF-1 git checkout lilac_dev From 1d3996c12c5cb54f9e83affd17a7a7b23139d102 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 25 Jul 2020 17:18:47 -0600 Subject: [PATCH 1205/1973] merged in the changes in PR#1085 from jedwards --- cime_config/config_pes.xml | 836 ++++++++++++++++++------------------- src/main/histFileMod.F90 | 208 ++++----- src/main/ncdio_pio.F90.in | 7 +- 3 files changed, 529 insertions(+), 522 deletions(-) diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index 6ce8f366a9..0d1559791d 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -7,34 +7,34 @@ none - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -44,34 +44,34 @@ none - -1 - -9 - -9 - -9 - -9 - -9 - -9 - -9 + -1 + -9 + -9 + -9 + -9 + -9 + -9 + -9 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - -1 - -1 - -1 - -1 - -1 - -1 - -1 + 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 @@ -91,24 +91,24 @@ -4 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - -1 - -1 - -1 - -1 - -1 - -1 - -1 + 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 @@ -118,34 +118,34 @@ none - -2 - -2 - -2 - -2 - -2 - -2 - -2 - -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -155,34 +155,34 @@ none - 180 - 180 - 180 - 180 - 180 - 180 - 180 - 180 + 180 + 180 + 180 + 180 + 180 + 180 + 180 + 180 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -192,34 +192,34 @@ none - -10 - -10 - -10 - -10 - -10 - -10 - -10 - -10 + -1 + -40 + -40 + -40 + -40 + -40 + -40 + -40 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 @@ -229,34 +229,34 @@ none - -4 - -4 - -4 - -4 - -4 - -4 - -4 - -4 + -4 + -4 + -4 + -4 + -4 + -4 + -4 + -4 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -266,7 +266,7 @@ none - -1 + -1 -50 -50 -50 @@ -276,24 +276,24 @@ -50 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - -1 - -1 - -1 - -1 - -1 - -1 - -1 + 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 @@ -303,71 +303,71 @@ none - -8 - -8 - -8 - -8 - -8 - -8 - -8 - -8 + -8 + -8 + -8 + -8 + -8 + -8 + -8 + -8 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - + none - -16 - -16 - -16 - -16 - -16 - -16 - -16 - -16 + -16 + -16 + -16 + -16 + -16 + -16 + -16 + -16 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -377,34 +377,34 @@ none - -4 - -4 - -4 - -4 - -4 - -4 - -4 - -4 + -4 + -4 + -4 + -4 + -4 + -4 + -4 + -4 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -525,34 +525,34 @@ none - -16 - -16 - -16 - -16 - -16 - -16 - -16 - -16 + -16 + -16 + -16 + -16 + -16 + -16 + -16 + -16 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -562,34 +562,34 @@ none - -32 - -32 - -32 - -32 - -32 - -32 - -32 - -32 + -32 + -32 + -32 + -32 + -32 + -32 + -32 + -32 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -710,34 +710,34 @@ none - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -747,34 +747,34 @@ none - 5 - 5 - 5 - 5 - 5 - 5 - 5 - 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -784,35 +784,35 @@ none - -4 - -4 - -4 - -4 - -4 - -4 - -4 - -4 - -4 + -4 + -4 + -4 + -4 + -4 + -4 + -4 + -4 + -4 1> - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -822,35 +822,35 @@ none - -2 - -2 - -2 - -2 - -2 - -2 - -2 - -2 - -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 1> - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 @@ -860,35 +860,35 @@ none - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + -1 1> - 1 - 1 - 1 - 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 7405e6166b..c0caa845ca 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2780,89 +2780,89 @@ subroutine htape_timeconst(t, mode) !*** Grid definition variables *** !------------------------------------------------------------------------------- ! For define mode -- only do this for first time-sample - if (mode == 'define' .and. tape(t)%ntimes == 1) then + if(tape(t)%ntimes == 1) then + if (mode == 'define') then + + if (ldomain%isgrid2d) then + call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, dim1name='lon', & + long_name='coordinate longitude', units='degrees_east', & + ncid=nfid(t), missing_value=spval, fill_value=spval) + else + call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, & + dim1name=grlnd, & + long_name='coordinate longitude', units='degrees_east', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, dim1name='lat', & + long_name='coordinate latitude', units='degrees_north', & + ncid=nfid(t), missing_value=spval, fill_value=spval) + else + call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, & + dim1name=grlnd, & + long_name='coordinate latitude', units='degrees_north', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & + dim1name='lon', dim2name='lat',& + long_name='grid cell areas', units='km^2', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + else + call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & + dim1name=grlnd, & + long_name='grid cell areas', units='km^2', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & + dim1name='lon', dim2name='lat', & + long_name='land fraction', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + else + call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & + dim1name=grlnd, & + long_name='land fraction', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='landmask', xtype=ncd_int, & + dim1name='lon', dim2name='lat', & + long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + else + call ncd_defvar(varname='landmask', xtype=ncd_int, & + dim1name=grlnd, & + long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='pftmask' , xtype=ncd_int, & + dim1name='lon', dim2name='lat', & + long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + else + call ncd_defvar(varname='pftmask' , xtype=ncd_int, & + dim1name=grlnd, & + long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & + dim1name='lon', dim2name='lat', & + long_name='index of shallowest bedrock layer', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + else + call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & + dim1name=grlnd, & + long_name='index of shallowest bedrock layer', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, dim1name='lon', & - long_name='coordinate longitude', units='degrees_east', & - ncid=nfid(t), missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='coordinate longitude', units='degrees_east', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, dim1name='lat', & - long_name='coordinate latitude', units='degrees_north', & - ncid=nfid(t), missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='coordinate latitude', units='degrees_north', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & - dim1name='lon', dim2name='lat',& - long_name='grid cell areas', units='km^2', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='grid cell areas', units='km^2', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & - dim1name='lon', dim2name='lat', & - long_name='land fraction', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='land fraction', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='landmask', xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='landmask', xtype=ncd_int, & - dim1name=grlnd, & - long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='index of shallowest bedrock layer', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='index of shallowest bedrock layer', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) end if else if (mode == 'write') then - ! Most of this is constant and only needs to be done on tape(t)%ntimes=1 - ! But, some may change for dynamic PATCH mode for example - if (ldomain%isgrid2d) then call ncd_io(varname='lon', data=lon1d, ncid=nfid(t), flag='write') call ncd_io(varname='lat', data=lat1d, ncid=nfid(t), flag='write') @@ -2923,7 +2923,7 @@ subroutine hfields_write(t, mode) ! Write/define 1d topological info - if (.not. tape(t)%dov2xy) then + if (.not. tape(t)%dov2xy .and. tape(t)%ntimes==1) then if (mode == 'define') then call hfields_1dinfo(t, mode='define') else if (mode == 'write') then @@ -3501,37 +3501,39 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & endif call t_startf('hist_htapes_wrapup_tconst') - ! Write time constant history variables + ! Write time constant history variables (not all are time constant!) call htape_timeconst(t, mode='write') ! Write 3D time constant history variables to first history tapes - if ( do_3Dtconst .and. tape(t)%ntimes == 1 )then - call htape_timeconst3D(t, & - bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='write') - do_3Dtconst = .false. - end if + if (tape(t)%ntimes == 1) then + if ( do_3Dtconst .and. tape(t)%ntimes == 1 )then + call htape_timeconst3D(t, & + bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='write') + do_3Dtconst = .false. + end if - if (masterproc) then - write(iulog,*) - write(iulog,*) trim(subname),' : Writing current time sample to local history file ', & - trim(locfnh(t)),' at nstep = ',get_nstep(), & - ' for history time interval beginning at ', tape(t)%begtime, & - ' and ending at ',time - write(iulog,*) - call shr_sys_flush(iulog) - endif + if (masterproc) then + write(iulog,*) + write(iulog,*) trim(subname),' : Writing current time sample to local history file ', & + trim(locfnh(t)),' at nstep = ',get_nstep(), & + ' for history time interval beginning at ', tape(t)%begtime, & + ' and ending at ',time + write(iulog,*) + call shr_sys_flush(iulog) + endif - ! Update beginning time of next interval - tape(t)%begtime = time - call t_stopf('hist_htapes_wrapup_tconst') + ! Update beginning time of next interval + tape(t)%begtime = time + call t_stopf('hist_htapes_wrapup_tconst') - ! Write history time samples - call t_startf('hist_htapes_wrapup_write') - call hfields_write(t, mode='write') - call t_stopf('hist_htapes_wrapup_write') + ! Write history time samples + call t_startf('hist_htapes_wrapup_write') + call hfields_write(t, mode='write') + call t_stopf('hist_htapes_wrapup_write') - ! Zero necessary history buffers - call hfields_zero(t) + ! Zero necessary history buffers + call hfields_zero(t) + end if end if diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index f116dc91f2..10df7072af 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -33,7 +33,7 @@ module ncdio_pio use pio , only : pio_put_att, pio_put_var, pio_read_darray, pio_real, pio_seterrorhandling use pio , only : pio_setframe, pio_unlimited, pio_write, pio_write_darray, var_desc_t use pio , only : pio_iotask_rank, PIO_REARR_SUBSET, PIO_REARR_BOX - use pio , only : pio_inq_vartype + use pio , only : pio_inq_vartype, pio_syncfile ! ! !PUBLIC TYPES: implicit none @@ -2541,4 +2541,9 @@ contains end subroutine ncd_getiodesc + subroutine ncd_pio_syncfile(ncid) + type(file_desc_t) :: ncid + call pio_syncfile(ncid) + end subroutine ncd_pio_syncfile + end module ncdio_pio From b20b7d088cb02c7a37bbce122b7d4bee244e954e Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 27 Jul 2020 15:48:27 -0600 Subject: [PATCH 1206/1973] Functionalizing the calculation of qsat --- src/biogeophys/QSatMod.F90 | 70 +++++++++++++++++++++++++++++ src/cpl/lilac/lnd_import_export.F90 | 38 +++------------- src/cpl/mct/lnd_import_export.F90 | 20 ++++++--- src/cpl/nuopc/lnd_import_export.F90 | 38 +++------------- 4 files changed, 98 insertions(+), 68 deletions(-) diff --git a/src/biogeophys/QSatMod.F90 b/src/biogeophys/QSatMod.F90 index 0b1819e467..15a7131a31 100644 --- a/src/biogeophys/QSatMod.F90 +++ b/src/biogeophys/QSatMod.F90 @@ -12,6 +12,7 @@ module QSatMod ! ! !PUBLIC MEMBER FUNCTIONS: public :: QSat + public :: QSat_temp ! TODO: rm after testing public :: rhoSat !----------------------------------------------------------------------- @@ -25,6 +26,14 @@ module QSatMod real(r8), parameter :: a6 = 0.892344772e-10_r8 real(r8), parameter :: a7 = -0.373208410e-12_r8 real(r8), parameter :: a8 = 0.209339997e-15_r8 + ! TODO: Delete after testing + real(r8), parameter :: e0 = 6.107799961_r8 + real(r8), parameter :: e1 = 4.436518521e-01_r8 + real(r8), parameter :: e2 = 1.428945805e-02_r8 + real(r8), parameter :: e3 = 2.650648471e-04_r8 + real(r8), parameter :: e4 = 3.031240396e-06_r8 + real(r8), parameter :: e5 = 2.034080948e-08_r8 + real(r8), parameter :: e6 = 6.136820929e-11_r8 ! For derivative:water vapor real(r8), parameter :: b0 = 0.444017302_r8 real(r8), parameter :: b1 = 0.286064092e-01_r8 @@ -45,6 +54,14 @@ module QSatMod real(r8), parameter :: c6 = 0.387940929e-09_r8 real(r8), parameter :: c7 = 0.149436277e-11_r8 real(r8), parameter :: c8 = 0.262655803e-14_r8 + ! TODO: Delete after testing + real(r8), parameter :: f0 = 6.109177956_r8 + real(r8), parameter :: f1 = 5.034698970e-01_r8 + real(r8), parameter :: f2 = 1.886013408e-02_r8 + real(r8), parameter :: f3 = 4.176223716e-04_r8 + real(r8), parameter :: f4 = 5.824720280e-06_r8 + real(r8), parameter :: f5 = 4.838803174e-08_r8 + real(r8), parameter :: f6 = 1.838826904e-10_r8 ! For derivative:ice real(r8), parameter :: d0 = 0.503277922_r8 real(r8), parameter :: d1 = 0.377289173e-01_r8 @@ -123,6 +140,59 @@ subroutine QSat (T, p, es, esdT, qs, qsdT) end subroutine QSat + !----------------------------------------------------------------------- + subroutine QSat_temp (T, p, es, esdT, qs, qsdT) + ! + ! !DESCRIPTION: + ! Temporary subroutine similar to subr. QSat. + ! TODO: Remove after testing. + ! + ! !USES: + use shr_kind_mod , only: r8 => shr_kind_r8 + use shr_const_mod, only: SHR_CONST_TKFRZ + ! + ! !ARGUMENTS: + implicit none + real(r8), intent(in) :: T ! temperature (K) + real(r8), intent(in) :: p ! surface atmospheric pressure (pa) + real(r8), intent(out) :: es ! vapor pressure (pa) + real(r8), intent(out) :: esdT ! d(es)/d(T) + real(r8), intent(out) :: qs ! humidity (kg/kg) + real(r8), intent(out) :: qsdT ! d(qs)/d(T) + ! + ! !LOCAL VARIABLES: + real(r8) :: T_limit + real(r8) :: td,vp,vp1,vp2 + !----------------------------------------------------------------------- + + T_limit = min( 50._r8, max(-50._r8, T - SHR_CONST_TKFRZ)) + + td = T_limit + if (td >= 0.0_r8) then + es = e0 + td*(e1 + td*(e2 + td*(e3 + td*(e4 & + + td*(e5 + td*e6))))) + + esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & + + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) + else + es = f0 + td*(f1 + td*(f2 + td*(f3 + td*(f4 & + + td*(f5 + td*f6))))) + + esdT = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & + + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) + endif + + es = es * 100._r8 ! pa + esdT = esdT * 100._r8 ! pa/K + + vp = 1.0_r8 / (p - 0.378_r8*es) + vp1 = 0.622_r8 * vp + vp2 = vp1 * vp + + qs = es * vp1 ! kg/kg + qsdT = esdT * vp2 * p ! 1 / K + + end subroutine QSat_temp !------------------------------------------------------------------------------- diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 313d0ce635..ae81351ef0 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -18,6 +18,7 @@ module lnd_import_export use atm2lndType , only : atm2lnd_type use lnd_shr_methods , only : chkerr use shr_megan_mod , only : shr_megan_mechcomps_n ! TODO: need to add a namelist read here (see https://github.com/ESCOMP/CTSM/issues/926) + use QSatMod , only : QSat implicit none private ! except @@ -66,14 +67,9 @@ subroutine import_fields( importState, bounds, first_call, rc) integer :: num integer :: begg, endg ! bounds integer :: g,i,k ! indices - real(r8) :: e ! vapor pressure (Pa) - real(r8) :: qsat ! saturation specific humidity (kg/kg) + real(r8) :: dum1, dum2, dum3 ! arguments returned by subr. QSat but not used here + real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: co2_ppmv_val ! temporary - real(r8) :: esatw ! saturation vapor pressure over water (Pa) - real(r8) :: esati ! saturation vapor pressure over ice (Pa) - real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water - real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice - real(r8) :: tdc, t ! Kelvins to Celcius function and its input real(r8) :: forc_t ! atmospheric temperature (Kelvin) real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) @@ -86,21 +82,6 @@ subroutine import_fields( importState, bounds, first_call, rc) real(r8) :: topo_grc(bounds%begg:bounds%endg, 0:glc_nec) character(len=*), parameter :: subname='(lnd_import_export:import_fields)' - ! Constants to compute vapor pressure - parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & - a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & - a4=3.031240396e-06_r8, a5=2.034080948e-08_r8, & - a6=6.136820929e-11_r8) - - parameter (b0=6.109177956_r8 , b1=5.034698970e-01_r8, & - b2=1.886013408e-02_r8, b3=4.176223716e-04_r8, & - b4=5.824720280e-06_r8, b5=4.838803174e-08_r8, & - b6=1.838826904e-10_r8) - - ! function declarations - tdc(t) = min( 50._r8, max(-50._r8,(t-SHR_CONST_TKFRZ)) ) - esatw(t) = 100._r8*(a0+t*(a1+t*(a2+t*(a3+t*(a4+t*(a5+t*a6)))))) - esati(t) = 100._r8*(b0+t*(b1+t*(b2+t*(b3+t*(b4+t*(b5+t*b6)))))) !--------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -295,23 +276,18 @@ subroutine import_fields( importState, bounds, first_call, rc) water_inst%wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) - if (forc_t > SHR_CONST_TKFRZ) then - e = esatw(tdc(forc_t)) - else - e = esati(tdc(forc_t)) - end if - qsat = 0.622_r8*e / (forc_pbot - 0.378_r8*e) + call QSat(forc_t, forc_pbot, dum1, dum2, qsat_kg_kg, dum3) ! modify specific humidity if precip occurs if (1==2) then if ((forc_rainc(g)+forc_rainl(g)) > 0._r8) then - forc_q = 0.95_r8*qsat - !forc_q = qsat + forc_q = 0.95_r8*qsat_kg_kg + !forc_q = qsat_kg_kg water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q endif endif - water_inst%wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) + water_inst%wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) water_inst%wateratm2lndbulk_inst%volr_grc(g) = 0._r8 water_inst%wateratm2lndbulk_inst%volrmch_grc(g) = 0._r8 end do diff --git a/src/cpl/mct/lnd_import_export.F90 b/src/cpl/mct/lnd_import_export.F90 index b93379979a..949ee35215 100644 --- a/src/cpl/mct/lnd_import_export.F90 +++ b/src/cpl/mct/lnd_import_export.F90 @@ -31,6 +31,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat use shr_const_mod , only: SHR_CONST_TKFRZ use shr_string_mod , only: shr_string_listGetName use domainMod , only: ldomain + use QSatMod , only: QSat, QSat_temp ! TODO: rm QSat_temp after testing use shr_infnan_mod , only : isnan => shr_infnan_isnan ! ! !ARGUMENTS: @@ -44,8 +45,10 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat ! !LOCAL VARIABLES: integer :: g,i,k,nstep,ier ! indices, number of steps, and error code real(r8) :: forc_rainc ! rainxy Atm flux mm/s - real(r8) :: e ! vapor pressure (Pa) - real(r8) :: qsat ! saturation specific humidity (kg/kg) + real(r8) :: e ! vapor pressure (Pa) TODO: rm after tests + real(r8) :: dum1, dum2, dum3 ! arguments returned by subr. QSat but not used here + real(r8) :: qsat_old ! TODO: rm after testing + real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_t ! atmospheric temperature (Kelvin) real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) @@ -56,6 +59,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat real(r8) :: co2_ppmv_prog ! temporary real(r8) :: co2_ppmv_val ! temporary integer :: co2_type_idx ! integer flag for co2_type options + ! TODO: Delete through tdc, t after testing real(r8) :: esatw ! saturation vapor pressure over water (Pa) real(r8) :: esati ! saturation vapor pressure over ice (Pa) real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water @@ -64,6 +68,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat character(len=32) :: fname ! name of field that is NaN character(len=32), parameter :: sub = 'lnd_import' + ! TODO: Delete through esati after testing ! Constants to compute vapor pressure parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & @@ -189,23 +194,26 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc + forc_rainl wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc + forc_snowl +! TODO: Delete these lines after testing, except the call QSat if (forc_t > SHR_CONST_TKFRZ) then e = esatw(tdc(forc_t)) else e = esati(tdc(forc_t)) end if - qsat = 0.622_r8*e / (forc_pbot - 0.378_r8*e) + qsat_old = 0.622_r8*e / (forc_pbot - 0.378_r8*e) + call QSat_temp(forc_t, forc_pbot, dum1, dum2, qsat_kg_kg, dum3) + if (qsat_kg_kg - qsat_old > 1.e-14_r8) write(iulog,*) 'qsat_new, qsat_old =', qsat_kg_kg, qsat_old ! slevis diag !modify specific humidity if precip occurs if(1==2) then if((forc_rainc+forc_rainl) > 0._r8) then - forc_q = 0.95_r8*qsat - ! forc_q = qsat + forc_q = 0.95_r8 * qsat_kg_kg + ! forc_q = qsat_kg_kg wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q endif endif - wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) + wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) ! Check that solar, specific-humidity and LW downward aren't negative if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 )then diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index c55f1e16b4..45bbe7a888 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -369,6 +369,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & use clm_varcon , only: rair, o2_molar_const, c13ratio use shr_const_mod , only: SHR_CONST_TKFRZ use Wateratm2lndBulkType , only: wateratm2lndbulk_type + use QSatMod , only: QSat ! input/output variabes type(ESMF_GridComp) :: gcomp @@ -388,13 +389,8 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & integer :: num integer :: begg, endg ! bounds integer :: g,i,k ! indices - real(r8) :: e ! vapor pressure (Pa) - real(r8) :: qsat ! saturation specific humidity (kg/kg) - real(r8) :: esatw ! saturation vapor pressure over water (Pa) - real(r8) :: esati ! saturation vapor pressure over ice (Pa) - real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water - real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice - real(r8) :: tdc, t ! Kelvins to Celcius function and its input + real(r8) :: dum1, dum2, dum3 ! arguments returned by subr. QSat but not used here + real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_t ! atmospheric temperature (Kelvin) real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) @@ -412,21 +408,6 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8) :: icemask_coupled_fluxes_grc(bounds%begg:bounds%endg) character(len=*), parameter :: subname='(lnd_import_export:import_fields)' - ! Constants to compute vapor pressure - parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & - a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & - a4=3.031240396e-06_r8, a5=2.034080948e-08_r8, & - a6=6.136820929e-11_r8) - - parameter (b0=6.109177956_r8 , b1=5.034698970e-01_r8, & - b2=1.886013408e-02_r8, b3=4.176223716e-04_r8, & - b4=5.824720280e-06_r8, b5=4.838803174e-08_r8, & - b6=1.838826904e-10_r8) - - ! function declarations - tdc(t) = min( 50._r8, max(-50._r8,(t-SHR_CONST_TKFRZ)) ) - esatw(t) = 100._r8*(a0+t*(a1+t*(a2+t*(a3+t*(a4+t*(a5+t*a6)))))) - esati(t) = 100._r8*(b0+t*(b1+t*(b2+t*(b3+t*(b4+t*(b5+t*b6)))))) !--------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -704,23 +685,18 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) - if (forc_t > SHR_CONST_TKFRZ) then - e = esatw(tdc(forc_t)) - else - e = esati(tdc(forc_t)) - end if - qsat = 0.622_r8*e / (forc_pbot - 0.378_r8*e) + call QSat(forc_t, forc_pbot, dum1, dum2, qsat_kg_kg, dum3) ! modify specific humidity if precip occurs if (1==2) then if ((forc_rainc(g)+forc_rainl(g)) > 0._r8) then - forc_q = 0.95_r8*qsat - !forc_q = qsat + forc_q = 0.95_r8*qsat_kg_kg + !forc_q = qsat_kg_kg wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q endif endif - wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) + wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) end do !-------------------------- From d80614c5a6d44dd2b86fdf42d12e3b2b5b95ea57 Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 28 Jul 2020 15:15:27 -0600 Subject: [PATCH 1207/1973] implementing Dave's feedback in the code. --- doc/source/lilac/specific-atm-models/wrf.rst | 135 +++++++++++++------ 1 file changed, 95 insertions(+), 40 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 7cc0a3d846..04821c5f7a 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -6,29 +6,41 @@ Using CTSM with WRF ===================== -This section includes instructions on how to use WRF with CTSM using LILAC. -The procedure for building and running the CTSM library and its dependencies -repeats some information from earlier section -:numref:`obtaining-building-and-running` but with minimal explanation. +This section includes instructions on how to run WRF coupled with CTSM via LILAC +framework. + +The procedure for running WRF with CTSM is similar to the +workflow for running WRF real cases, except that it requires +additional steps to (1) clone the CTSM repository, (2) build +CTSM and LILAC, and (3) define namelist options reuired for CTSM. + +A full description of all steps for a WRF-CTSM run are included here. + +Specific new steps that would not be completed in a standard WRF real case +are described in sections :numref:`clone-WRF-CTSM-repositories`, +:numref:`build-CTSM-and-dependencies` , +and :numref:`wrf-set-ctsm-runtime-options`. .. important:: - This section assumes use of a machine that has been ported to ``CIME``. + This section assumes use of a machine that has been ported to CIME. + If CIME is not ported to your machine, please see `instructions on porting CIME + `_. + In this example we assume NCAR’s ``Cheyenne`` HPC system in particular. +.. _clone-WRF-CTSM-repositories: + Clone WRF and CTSM Repositories ------------------------------- Clone the WRF CTSM feature branch:: - git clone https://github.com/negin513/WRF-1.git - cd WRF-1 + git clone https://github.com/negin513/WRF-1.git WRF-CTSM + cd WRF-CTSM git checkout lilac_dev -.. todo:: - - update the git address to WRF repository and feature branch... Clone the CTSM repository:: @@ -36,28 +48,35 @@ Clone the CTSM repository:: cd CTSM ./manage_externals/checkout_externals +.. todo:: + + update the git address to WRF repository and feature branch... + +.. _build-CTSM-and-dependencies: Build CTSM and its dependencies ------------------------------- -Build CTSM and its dependencies based on the instructions from previous sections :: +Build CTSM and its dependencies based on the instructions from section +:numref:`obtaining-and-building-ctsm`:: ./lilac/build_ctsm /PATH/TO/CTSM/BUILD --machine MACHINE --compiler COMPILER For example on ``Cheyenne`` and for ``Intel`` compiler:: - ./lilac/build_ctsm /glade/scratch/$USER/ctsm_build_dir --compiler intel --machine cheyenne + ./lilac/build_ctsm ctsm_build_dir --compiler intel --machine cheyenne + + +.. warning:: + The directory you provided for the build script (``/PATH/TO/CTSM/BUILD``) must *not* exist. + Alternatively, you can use ``--rebuild`` option. .. note:: Run ``./lilac/build_ctsm -h`` to see all options available. For example if you would like to run with threading support you can use ``--build-with-openmp``. -.. warning:: - - The directory you provided for the build script (``/PATH/TO/CTSM/BUILD``) must *not* exist. - Alternatively, you can use ``--rebuild`` option. Building WRF with CTSM ---------------------- @@ -65,29 +84,29 @@ Building WRF with CTSM First, load the same modules and set the same environments as used for CTSM build by sourcing ``ctsm_build_environment.sh`` for Bash:: - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.sh + source ctsm_build_dir/ctsm_build_environment.sh or sourcing ``ctsm_build_environment.csh`` for Cshell: .. code-block:: Tcsh - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh + source ctsm_build_dir/ctsm_build_environment.csh Set makefile variables from CTSM needed for the WRF build by setting the following environment. For example for Bash:: - export WRF_CTSM_MKFILE=/glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk + export WRF_CTSM_MKFILE=ctsm_build_dir/bld/ctsm.mk or for Cshell: .. code-block:: Tcsh - setenv WRF_CTSM_MKFILE /glade/scratch/$USER/ctsm_build_dir/bld/ctsm.mk - + setenv WRF_CTSM_MKFILE ctsm_build_dir/bld/ctsm.mk There are also few other environmental setting that should be set for building WRF. Some of these are not required, but might help if you face any compilation errors. -For more information check WRF Users' Guide. +For more information check +`WRF Users' Guide `_. Explicitly define which model core to build by (Bash):: @@ -101,7 +120,7 @@ or (Cshell): setenv WRF_EM_CORE 1 -Explicilty turn off data assimilation by:: +Explicilty turn off data assimilation by (Bash):: export WRF_DA_CORE=0 @@ -113,6 +132,7 @@ or (Cshell): Now configure and build WRF for your machine and intended compiler:: + cd .. ./clean -a ./configure @@ -127,7 +147,7 @@ in parallel. recommended for compiling WRF. The next prompt requests an option for nesting. Currently nesting is not -available for WRF-CTSM so enter 1. +available for WRF-CTSM so select option 1 (basic). Now compile em_real and save the log:: @@ -135,8 +155,7 @@ Now compile em_real and save the log:: ./compile em_real >& compile.log -Check the bottom of your log file for a successful compilation message -or search the file for the string "Error" with a capital E. +Check the bottom of your log file for a successful compilation message. .. note:: @@ -153,7 +172,7 @@ Compile WRF Preprocessing System (WPS) The WRF Preprocessing System (WPS) is a set of programs to prepare inputs to the real program executable (real.exe) for WRF real-data simulations. If you wish to complete the offered example with preexisting inputs, then -skip to the next section, which is titled "Run WRF." +skip to section :numref:`wrf-set-ctsm-runtime-options`. .. warning:: @@ -273,30 +292,71 @@ Check the last line of the real log file for the following message:: .. _wrf-set-ctsm-runtime-options: + Set CTSM runtime options ------------------------ -.. todo:: +.. seealso:: + + The instructions for setting CTSM runtime options, are discussed in depth + in section :numref:`setting-ctsm-runtime-options`. + +The goal here is to create files that determine CTSM runtime options which +are defined within these three files: + +- ``lnd_in``: This is the main namelist input file for CTSM + +- ``lnd_modelio.nml``: This sets CTSM's PIO (parallel I/O library) configuration settings + +- ``lilac_in``: This namelist controls the operation of LILAC + + +The basic process for creating the necessary input files are summarized as +follows: + +Go to ``runtime_inputs`` directory:: + + cd CTSM/ctsm_build_dir/runtime_inputs - Sam, can you please clarify this section. +Next, modify and fill in the ``ctsm.cfg`` file to set high-level options to CTSM. +A few options should be filled in; most can be left at their default values or changed if +desired. -Now follow the instructions in section :numref:`setting-ctsm-runtime-options` -for setting CTSM runtime options. +The following is the recommended CTSM options to run WRF:: + configuration = nwp + structure = fast + bgc_mode = sp -In step 3 of that Section we used for this example:: +In ``ctsm.cfg`` you should specify CTSM domain file, surface dataset and finidat file. +For this example (US domain), you can use the following settings:: lnd_domain_file = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files/domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc fsurdat = /glade/work/slevis/git_wrf/ctsm_surf/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc finidat = /glade/work/slevis/git_wrf/ctsm_init/finidat_interp_dest_wrfinit_snow_ERAI_12month.nc -In step 4 of that Section we used for this example:: +Run the script ``make_runtime_inputs`` to create ``lnd_in`` and +``clm.input_data_list``. + + +Modify ``lilac_in`` as needed. For this example, you can use the following options:: atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' -In step 6 of that Section you will copy some files to your WRF/run -directory. Then you will be ready to continue. + +Run ``download_input_data`` script to download any of CTSM's standard input +files that are needed based on settings in ``lnd_in`` and ``lilac_in``. + + +Next, copy ``lnd_in``, ``lnd_modelio.nml`` and ``lilac_in`` to the direcotory +from which you will be running the model (e.g. WRF/run). + + +.. todo:: + + Sam, can you please clarify this section. I am not sure what this is + doing and why it is here. .. note:: @@ -346,11 +406,6 @@ A simple PBS script to run WRF-CTSM on ``Cheyenne`` looks like this: #PBS -M your_email_address #PBS -l select=2:ncpus=36:mpiprocs=36 - ### Set TMPDIR as recommended - setenv TMPDIR /glade/scratch/$USER/temp - mkdir -p $TMPDIR - source /glade/scratch/$USER/ctsm_build_dir/ctsm_build_environment.csh - ### Run the executable mpiexec_mpt ./wrf.exe From 46ad833b29e236c3e8656fe33336554b7c4e2b6a Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 28 Jul 2020 20:22:26 -0600 Subject: [PATCH 1208/1973] changing the path to absolute path... --- doc/source/lilac/specific-atm-models/wrf.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 04821c5f7a..474e4064f0 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -95,13 +95,16 @@ or sourcing ``ctsm_build_environment.csh`` for Cshell: Set makefile variables from CTSM needed for the WRF build by setting the following environment. For example for Bash:: - export WRF_CTSM_MKFILE=ctsm_build_dir/bld/ctsm.mk + export WRF_CTSM_MKFILE=/glade/scratch/$USER/WRF-CTSM/CTSM/ctsm_build_dir/bld/ctsm.mk or for Cshell: .. code-block:: Tcsh - setenv WRF_CTSM_MKFILE ctsm_build_dir/bld/ctsm.mk + setenv WRF_CTSM_MKFILE /glade/scratch/$USER/WRF-CTSM/CTSM/ctsm_build_dir/bld/ctsm.mk + +.. warning:: + Please note that you should point to the absolute path of the ``ctsm.mk`` file. There are also few other environmental setting that should be set for building WRF. Some of these are not required, but might help if you face any compilation errors. From 18cb0608631c9bf60e90cdcc9d507f8687969f89 Mon Sep 17 00:00:00 2001 From: negin513 Date: Tue, 28 Jul 2020 20:25:38 -0600 Subject: [PATCH 1209/1973] clarifying more lines in set CTSM runtime options. --- doc/source/lilac/specific-atm-models/wrf.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 474e4064f0..82d6f5204a 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -339,8 +339,9 @@ For this example (US domain), you can use the following settings:: finidat = /glade/work/slevis/git_wrf/ctsm_init/finidat_interp_dest_wrfinit_snow_ERAI_12month.nc Run the script ``make_runtime_inputs`` to create ``lnd_in`` and -``clm.input_data_list``. +``clm.input_data_list``:: + ./make_runtime_inputs Modify ``lilac_in`` as needed. For this example, you can use the following options:: @@ -349,8 +350,9 @@ Modify ``lilac_in`` as needed. For this example, you can use the following optio Run ``download_input_data`` script to download any of CTSM's standard input -files that are needed based on settings in ``lnd_in`` and ``lilac_in``. +files that are needed based on settings in ``lnd_in`` and ``lilac_in``:: + ./download_input_data Next, copy ``lnd_in``, ``lnd_modelio.nml`` and ``lilac_in`` to the direcotory from which you will be running the model (e.g. WRF/run). From 81a35b7a2dbaa7366c104293126346326521eb0a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 29 Jul 2020 14:49:14 -0600 Subject: [PATCH 1210/1973] fixed pio problem --- cime_config/testdefs/testlist_clm.xml | 14 +- src/main/histFileMod.F90 | 279 +++++++++++++------------- src/main/ncdio_pio.F90.in | 1 + 3 files changed, 146 insertions(+), 148 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 413cdc4216..ae540d6309 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -183,7 +183,7 @@ - + @@ -225,7 +225,7 @@ - + @@ -267,7 +267,7 @@ - + @@ -1321,7 +1321,7 @@ - + @@ -1330,7 +1330,7 @@ - + @@ -1541,7 +1541,7 @@ - + @@ -1747,7 +1747,7 @@ - + diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index c0caa845ca..dc242a3cf3 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -13,14 +13,14 @@ module histFileMod use spmdMod , only : masterproc use abortutils , only : endrun use clm_varctl , only : iulog, use_vertsoilc, use_fates - use clm_varcon , only : spval, ispval, dzsoi_decomp + use clm_varcon , only : spval, ispval, dzsoi_decomp use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort use decompMod , only : get_proc_bounds, get_proc_global, bounds_type use GetGlobalValuesMod , only : GetGlobalIndexArray - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch + use GridcellType , only : grc + use LandunitType , only : lun + use ColumnType , only : col + use PatchType , only : patch use EDTypesMod , only : nclmax use EDTypesMod , only : nlevleaf use FatesInterfaceMod , only : nlevsclass, nlevage @@ -29,7 +29,7 @@ module histFileMod use FatesLitterMod , only : ncwd use EDTypesMod , only : num_elements_fates => num_elements use FatesInterfaceMod , only : maxveg_fates => numpft - use ncdio_pio + use ncdio_pio ! implicit none @@ -163,7 +163,7 @@ module histFileMod private :: hfields_write ! Write a variable to a history tape private :: hfields_1dinfo ! Define/output 1d subgrid info if appropriate private :: hist_update_hbuf_field_1d ! Updates history buffer for specific field and tape - private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape + private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape private :: hist_set_snow_field_2d ! Set values in history field dimensioned by levsno private :: list_index ! Find index of field in exclude list private :: set_hist_filename ! Determine history dataset filenames @@ -202,7 +202,7 @@ module histFileMod ! for 2D arrays, where the second dimension is allowed ! to be 1 integer :: num2d ! size of hbuf second dimension (e.g. number of vertical levels) - integer :: hpindex ! history pointer index + integer :: hpindex ! history pointer index character(len=scale_type_strlen) :: p2c_scale_type ! scale factor when averaging patch to column character(len=scale_type_strlen) :: c2l_scale_type ! scale factor when averaging column to landunit character(len=scale_type_strlen) :: l2g_scale_type ! scale factor when averaging landunit to gridcell @@ -359,7 +359,7 @@ subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & integer :: numl ! total number of landunits across all processors integer :: numc ! total number of columns across all processors integer :: nump ! total number of pfts across all processors - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'masterlist_addfld' !------------------------------------------------------------------------ @@ -681,7 +681,7 @@ subroutine htapes_fieldlist() fexcl(:,8) = hist_fexcl8(:) fexcl(:,9) = hist_fexcl9(:) fexcl(:,10) = hist_fexcl10(:) - + ! First ensure contents of fincl and fexcl are valid names @@ -861,7 +861,7 @@ end subroutine htapes_fieldlist logical function is_mapping_upto_subgrid( type1d, type1d_out ) result ( mapping) ! ! !DESCRIPTION: - ! + ! ! Return true if this field will be mapped into a higher subgrid level ! If false it will be output on it's native grid ! @@ -917,7 +917,7 @@ subroutine htape_addfld (t, f, avgflag) integer :: beg1d_out,end1d_out ! history output per-proc 1d beginning and ending indices integer :: beg1d,end1d ! beginning and ending indices for this field (assume already set) integer :: num1d_out ! history output 1d size - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'htape_addfld' !----------------------------------------------------------------------- @@ -1020,7 +1020,7 @@ subroutine htape_addfld (t, f, avgflag) ! Fields native bounds beg1d = masterlist(f)%field%beg1d end1d = masterlist(f)%field%end1d - + ! Alloccate and initialize history buffer and related info num2d = tape(t)%hlist(n)%field%num2d @@ -1058,7 +1058,7 @@ subroutine hist_update_hbuf(bounds) ! into its history buffer for appropriate tapes. ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -1073,8 +1073,8 @@ subroutine hist_update_hbuf(bounds) !$OMP PARALLEL DO PRIVATE (f, num2d, numdims) do f = 1,tape(t)%nflds numdims = tape(t)%hlist(f)%field%numdims - - if ( numdims == 1) then + + if ( numdims == 1) then call hist_update_hbuf_field_1d (t, f, bounds) else num2d = tape(t)%hlist(f)%field%num2d @@ -1103,7 +1103,7 @@ subroutine hist_update_hbuf_field_1d (t, f, bounds) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: hpindex ! history pointer index @@ -1317,7 +1317,7 @@ subroutine hist_update_hbuf_field_1d (t, f, bounds) if ( end1d .eq. ubound(field,1) ) then k_offset = 0 else - k_offset = 1 - beg1d + k_offset = 1 - beg1d endif do k = beg1d,end1d valid = .true. @@ -1397,7 +1397,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds integer, intent(in) :: num2d ! size of second dimension ! ! !LOCAL VARIABLES: @@ -1420,7 +1420,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) integer , pointer :: nacs(:,:) ! accumulation counter real(r8), pointer :: field(:,:) ! clm 2d pointer field logical :: field_allocated! whether 'field' was allocated here - logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) + logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) !(this refers to a point being active, NOT a history field being active) real(r8), allocatable :: field_gcell(:,:) ! gridcell level field (used if mapping to gridcell is done) character(len=*),parameter :: subname = 'hist_update_hbuf_field_2d' @@ -1720,7 +1720,7 @@ end subroutine hist_update_hbuf_field_2d subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d, beg1d, end1d) ! ! !DESCRIPTION: - ! Set values in history field dimensioned by levsno. + ! Set values in history field dimensioned by levsno. ! ! This routine handles what to do when a given snow layer doesn't exist for a given ! point, based on the no_snow_behavior argument. Options are: @@ -1790,7 +1790,7 @@ subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d num_snow_layers = abs(snl(c)) num_nonexistent_layers = num_levels - num_snow_layers - + ! Fill output field appropriately for each layer ! When only a subset of snow layers exist, it is the LAST num_snow_layers that exist ! Levels are rearranged such that the top snow layer (surface layer) becomes level 1, etc. @@ -1801,7 +1801,7 @@ subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d do level = (num_levels-num_nonexistent_layers), 1, -1 field_out(point, level) = field_in(point, level+num_nonexistent_layers) end do - + end do end associate @@ -1953,7 +1953,7 @@ subroutine htape_create (t, histrest) else lnfid => nfid(t) endif - + ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 ! - 1-d hist files have problems with pnetcdf. A better workaround in terms of @@ -2066,7 +2066,7 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'string_length', hist_dim_name_length, strlen_dimid) call ncd_defdim(lnfid, 'scale_type_string_length', scale_type_strlen, dimid) call ncd_defdim( lnfid, 'levdcmp', nlevdecomp_full, dimid) - + if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * maxveg_fates, dimid) @@ -2124,7 +2124,7 @@ subroutine htape_add_ltype_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_ltype_metadata' !----------------------------------------------------------------------- - + do ltype = 1, max_lunit attname = att_prefix // landunit_names(ltype) call ncd_putatt(lnfid, ncd_global, attname, ltype) @@ -2175,7 +2175,7 @@ subroutine htape_add_natpft_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_natpft_metadata' !----------------------------------------------------------------------- - + do ptype = natpft_lb, natpft_ub ptype_1_indexing = ptype + (1 - natpft_lb) attname = att_prefix // pftname(ptype) @@ -2205,7 +2205,7 @@ subroutine htape_add_cft_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_cft_metadata' !----------------------------------------------------------------------- - + do ptype = cft_lb, cft_ub ptype_1_indexing = ptype + (1 - cft_lb) attname = att_prefix // pftname(ptype) @@ -2233,11 +2233,11 @@ subroutine htape_timeconst3D(t, & ! ! !ARGUMENTS: integer , intent(in) :: t ! tape index - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) + real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) character(len=*) , intent(in) :: mode ! 'define' or 'write' ! ! !LOCAL VARIABLES: @@ -2453,7 +2453,7 @@ subroutine htape_timeconst3D(t, & l = col%landunit(c) if (lun%lakpoi(l)) then ! Field indices MUST match varnamesl array order above! - if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) + if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) if (ifld ==2) histil(c,lev) = col%dz_lake(c,lev) end if end do @@ -2579,9 +2579,9 @@ subroutine htape_timeconst(t, mode) long_name='coordinate lake levels', units='m', ncid=nfid(t)) call ncd_defvar(varname='levdcmp', xtype=tape(t)%ncprec, dim1name='levdcmp', & long_name='coordinate soil levels', units='m', ncid=nfid(t)) - + if(use_fates)then - + call ncd_defvar(varname='fates_levscls', xtype=tape(t)%ncprec, dim1name='fates_levscls', & long_name='FATES diameter size class lower bound', units='cm', ncid=nfid(t)) call ncd_defvar(varname='fates_scmap_levscag', xtype=ncd_int, dim1name='fates_levscag', & @@ -2684,7 +2684,7 @@ subroutine htape_timeconst(t, mode) dim1id(1) = time_dimid str = 'days since ' // basedate // " " // basesec call ncd_defvar(nfid(t), 'time', tape(t)%ncprec, 1, dim1id, varid, & - long_name='time',units=str) + long_name='time',units=str) cal = get_calendar() if ( trim(cal) == NO_LEAP_C )then caldesc = "noleap" @@ -2705,7 +2705,7 @@ subroutine htape_timeconst(t, mode) else sec_hist_nhtfrq = hist_nhtfrq(t) end if - + dtime = get_step_size() if (sec_hist_nhtfrq == 0) then !month time_period_freq = 'month_1' @@ -2859,24 +2859,23 @@ subroutine htape_timeconst(t, mode) imissing_value=ispval, ifill_value=ispval) end if - end if - - else if (mode == 'write') then + else if (mode == 'write') then - if (ldomain%isgrid2d) then - call ncd_io(varname='lon', data=lon1d, ncid=nfid(t), flag='write') - call ncd_io(varname='lat', data=lat1d, ncid=nfid(t), flag='write') - else - call ncd_io(varname='lon', data=ldomain%lonc, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='lat', data=ldomain%latc, dim1name=grlnd, ncid=nfid(t), flag='write') - end if - call ncd_io(varname='area' , data=ldomain%area, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='landfrac', data=ldomain%frac, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='landmask', data=ldomain%mask, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='pftmask' , data=ldomain%pftm, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='nbedrock' , data=grc%nbedrock, dim1name=grlnd, ncid=nfid(t), flag='write') + if (ldomain%isgrid2d) then + call ncd_io(varname='lon', data=lon1d, ncid=nfid(t), flag='write') + call ncd_io(varname='lat', data=lat1d, ncid=nfid(t), flag='write') + else + call ncd_io(varname='lon', data=ldomain%lonc, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='lat', data=ldomain%latc, dim1name=grlnd, ncid=nfid(t), flag='write') + end if + call ncd_io(varname='area' , data=ldomain%area, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='landfrac', data=ldomain%frac, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='landmask', data=ldomain%mask, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='pftmask' , data=ldomain%pftm, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='nbedrock' , data=grc%nbedrock, dim1name=grlnd, ncid=nfid(t), flag='write') - end if ! (define/write mode + end if ! (define/write mode + endif end subroutine htape_timeconst @@ -3075,7 +3074,7 @@ subroutine hfields_1dinfo(t, mode) integer , pointer :: ilarr(:) ! temporary integer , pointer :: iparr(:) ! temporary type(file_desc_t), pointer :: ncid ! netcdf file - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'hfields_1dinfo' !----------------------------------------------------------------------- @@ -3384,11 +3383,11 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & ! !ARGUMENTS: logical, intent(in) :: rstwr ! true => write restart file this step logical, intent(in) :: nlend ! true => end of run on this step - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) + real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -3503,37 +3502,36 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & call t_startf('hist_htapes_wrapup_tconst') ! Write time constant history variables (not all are time constant!) call htape_timeconst(t, mode='write') - - ! Write 3D time constant history variables to first history tapes if (tape(t)%ntimes == 1) then - if ( do_3Dtconst .and. tape(t)%ntimes == 1 )then + ! Write 3D time constant history variables to first history tapes + if ( do_3Dtconst )then call htape_timeconst3D(t, & bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='write') do_3Dtconst = .false. end if + endif - if (masterproc) then - write(iulog,*) - write(iulog,*) trim(subname),' : Writing current time sample to local history file ', & - trim(locfnh(t)),' at nstep = ',get_nstep(), & - ' for history time interval beginning at ', tape(t)%begtime, & - ' and ending at ',time - write(iulog,*) - call shr_sys_flush(iulog) - endif + if (masterproc) then + write(iulog,*) + write(iulog,*) trim(subname),' : Writing current time sample to local history file ', & + trim(locfnh(t)),' at nstep = ',get_nstep(), & + ' for history time interval beginning at ', tape(t)%begtime, & + ' and ending at ',time + write(iulog,*) + call shr_sys_flush(iulog) + endif - ! Update beginning time of next interval - tape(t)%begtime = time - call t_stopf('hist_htapes_wrapup_tconst') + ! Update beginning time of next interval + tape(t)%begtime = time + call t_stopf('hist_htapes_wrapup_tconst') - ! Write history time samples - call t_startf('hist_htapes_wrapup_write') - call hfields_write(t, mode='write') - call t_stopf('hist_htapes_wrapup_write') + ! Write history time samples + call t_startf('hist_htapes_wrapup_write') + call hfields_write(t, mode='write') + call t_stopf('hist_htapes_wrapup_write') - ! Zero necessary history buffers - call hfields_zero(t) - end if + ! Zero necessary history buffers + call hfields_zero(t) end if @@ -3561,11 +3559,11 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & write(iulog,*) endif - call ncd_pio_closefile(nfid(t)) - - if (.not.if_stop .and. (tape(t)%ntimes/=tape(t)%mfilt)) then - call ncd_pio_openfile (nfid(t), trim(locfnh(t)), ncd_write) - end if + if (if_stop .or. (tape(t)%ntimes==tape(t)%mfilt)) then + call ncd_pio_closefile(nfid(t)) + else + call ncd_pio_syncfile(nfid(t)) + endif else if (masterproc) then write(iulog,*) trim(subname),' : history tape ',t,': no open file to close' @@ -3574,8 +3572,8 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & endif end do - ! Reset number of time samples to zero if file is full - + ! Reset number of time samples to zero if file is full + do t = 1, ntapes if (.not. history_tape_in_use(t)) then cycle @@ -3585,7 +3583,7 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & tape(t)%ntimes = 0 end if end do - + end subroutine hist_htapes_wrapup !----------------------------------------------------------------------- @@ -3607,7 +3605,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) use pio ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(file_desc_t), intent(inout) :: ncid ! netcdf file character(len=*) , intent(in) :: flag !'read' or 'write' character(len=*) , intent(in), optional :: rdate ! restart file time stamp for name @@ -3737,7 +3735,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ier = PIO_put_att(ncid, vardesc%varid, 'interpinic_flag', iflag_skip) ! max_nflds is the maximum number of fields on any tape - ! max_flds is the maximum number possible number of fields + ! max_flds is the maximum number possible number of fields max_nflds = max_nFields() @@ -3770,7 +3768,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) num2d = tape(t)%hlist(f)%field%num2d nacs => tape(t)%hlist(f)%nacs hbuf => tape(t)%hlist(f)%hbuf - + if (type1d_out == grlnd) then if (ldomain%isgrid2d) then dim1name = 'lon' ; dim2name = 'lat' @@ -3780,10 +3778,10 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) else dim1name = type1d_out ; dim2name = 'undefined' endif - + if (dim2name == 'undefined') then if (num2d == 1) then - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & + call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & dim1name=dim1name, & long_name=trim(long_name), units=trim(units)) call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & @@ -3825,9 +3823,9 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_defdim( ncid_hist(t), 'avgflag_len' , avgflag_strlen, dimid) call ncd_defdim( ncid_hist(t), 'scalar' , 1 , dimid) call ncd_defdim( ncid_hist(t), 'max_chars' , max_chars , dimid) - call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) - call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) - + call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) + call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) + call ncd_defvar(ncid=ncid_hist(t), varname='nhtfrq', xtype=ncd_int, & long_name="Frequency of history writes", & comment="Namelist item", & @@ -3867,7 +3865,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_defvar(ncid=ncid_hist(t), varname='begtime', xtype=ncd_double, & long_name="Beginning time", units="time units", & dim1name='scalar') - + call ncd_defvar(ncid=ncid_hist(t), varname='num2d', xtype=ncd_int, & long_name="Size of second dimension", units="unitless", & dim1name='max_nflds' ) @@ -3909,7 +3907,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_enddef(ncid_hist(t)) - end do ! end of ntapes loop + end do ! end of ntapes loop RETURN @@ -3933,7 +3931,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_io('locfnh', my_locfnh, 'write', ncid, nt=t) call ncd_io('locfnhr', my_locfnhr, 'write', ncid, nt=t) end do - + fincl(:,1) = hist_fincl1(:) fincl(:,2) = hist_fincl2(:) fincl(:,3) = hist_fincl3(:) @@ -3982,7 +3980,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) itemp(:) = 0 do f=1,tape(t)%nflds itemp(f) = tape(t)%hlist(f)%field%num2d - end do + end do call ncd_io(varname='num2d', data=itemp(:), ncid=ncid_hist(t), flag='write') itemp(:) = 0 @@ -4025,7 +4023,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_io('l2g_scale_type', l2g_scale_type, 'write', ncid_hist(t)) deallocate(tname,tlongname,tunits,tmpstr,tavgflag) deallocate(p2c_scale_type, c2l_scale_type, l2g_scale_type) - enddo + enddo deallocate(itemp) ! @@ -4079,7 +4077,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end if ! Determine necessary indices - the following is needed if model decomposition is different on restart - + start(1)=1 if ( is_restart() )then @@ -4094,7 +4092,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) if ( t == 1 )then call ncd_inqdlen(ncid_hist(1),dimid,max_nflds,name='max_nflds') - + allocate(itemp(max_nflds)) end if @@ -4277,7 +4275,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) hist_fexcl10(:) = fexcl(:,10) end if - + if ( allocated(itemp) ) deallocate(itemp) end if @@ -4288,8 +4286,8 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ! so that subsequent time samples are added until the file is full. ! A new history file is used on a branch run. !====================================================================== - - if (flag == 'write') then + + if (flag == 'write') then do t = 1,ntapes if (.not. history_tape_in_use(t)) then @@ -4316,7 +4314,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) write(iulog,*) trim(subname),' ERROR: allocation' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - + hbuf1d(beg1d_out:end1d_out) = hbuf(beg1d_out:end1d_out,1) nacs1d(beg1d_out:end1d_out) = nacs(beg1d_out:end1d_out,1) @@ -4340,9 +4338,9 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_pio_closefile(ncid_hist(t)) - end do ! end of ntapes loop + end do ! end of ntapes loop - else if (flag == 'read') then + else if (flag == 'read') then ! Read history restart information if history files are not full @@ -4363,7 +4361,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end1d_out = tape(t)%hlist(f)%field%end1d_out nacs => tape(t)%hlist(f)%nacs hbuf => tape(t)%hlist(f)%hbuf - + if (num2d == 1) then allocate(hbuf1d(beg1d_out:end1d_out), & nacs1d(beg1d_out:end1d_out), stat=status) @@ -4371,15 +4369,15 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) write(iulog,*) trim(subname),' ERROR: allocation' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - + call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name), & dim1name=type1d_out, data=hbuf1d) call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name_acc), & dim1name=type1d_out, data=nacs1d) - + hbuf(beg1d_out:end1d_out,1) = hbuf1d(beg1d_out:end1d_out) nacs(beg1d_out:end1d_out,1) = nacs1d(beg1d_out:end1d_out) - + deallocate(hbuf1d) deallocate(nacs1d) else @@ -4391,13 +4389,13 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end do end if - + call ncd_pio_closefile(ncid_hist(t)) - + end do - + end if - + end subroutine hist_restart_ncd !----------------------------------------------------------------------- @@ -4419,7 +4417,7 @@ integer function max_nFields() end do return end function max_nFields - + !----------------------------------------------------------------------- character(len=max_namlen) function getname (inname) ! @@ -4616,7 +4614,7 @@ subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds ! boudns + type(bounds_type):: bounds ! boudns character(len=16):: l_default ! local version of 'default' character(len=*),parameter :: subname = 'hist_addfld1d' !------------------------------------------------------------------------ @@ -4770,10 +4768,10 @@ subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & ! Add field to masterlist - call masterlist_addfld (fname=trim(fname), numdims=1, type1d=l_type1d, & + call masterlist_addfld (fname=trim(fname), numdims=1, type1d=l_type1d, & type1d_out=l_type1d_out, type2d='unset', num2d=1, & units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & + p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & l2g_scale_type=scale_type_l2g) l_default = 'active' @@ -4843,13 +4841,13 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds + type(bounds_type):: bounds character(len=16):: l_default ! local version of 'default' character(len=*),parameter :: subname = 'hist_addfld2d' !------------------------------------------------------------------------ call get_proc_bounds(bounds) - + ! Error-check no_snow_behavior optional argument: It should be present if and only if ! type2d is 'levsno', and its value should be one of the public no_snow_* parameters ! defined above. @@ -4942,7 +4940,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('levsno') num2d = nlevsno case ('nlevcan') - num2d = nlevcan + num2d = nlevcan case ('nvegwcs') num2d = nvegwcs case default @@ -5086,12 +5084,12 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, ! Add field to masterlist - call masterlist_addfld (fname=trim(fname), numdims=2, type1d=l_type1d, & + call masterlist_addfld (fname=trim(fname), numdims=2, type1d=l_type1d, & type1d_out=l_type1d_out, type2d=type2d, num2d=num2d, & units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & + p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & l2g_scale_type=scale_type_l2g, no_snow_behavior=no_snow_behavior) - + l_default = 'active' if (present(default)) then l_default = default @@ -5243,12 +5241,12 @@ end subroutine hist_add_subscript subroutine strip_null(str) character(len=*), intent(inout) :: str - integer :: i + integer :: i do i=1,len(str) if(ichar(str(i:i))==0) str(i:i)=' ' end do end subroutine strip_null - + !------------------------------------------------------------------------ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rstwr, nlend) ! @@ -5265,7 +5263,7 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, logical, intent(out) :: if_stop !true => last time step of run logical, intent(out) :: if_disphist(ntapes) !true => save and dispose history file logical, intent(in) :: rstwr - logical, intent(in) :: nlend + logical, intent(in) :: nlend ! ! !LOCAL VARIABLES: integer :: t ! history tape index @@ -5275,26 +5273,26 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rest_now = .false. stop_now = .false. - + if (nlend) stop_now = .true. if (rstwr) rest_now = .true. - + if_stop = stop_now - + if (stop_now) then ! End of run - dispose all history files - + if_disphist(1:ntapes) = .true. - + else if (rest_now) then ! Restart - dispose all history files - + do t = 1,ntapes if_disphist(t) = .true. end do else ! Dispose - + if_disphist(1:ntapes) = .false. do t = 1,ntapes if (hist_ntimes(t) == hist_mfilt(t)) then @@ -5302,7 +5300,7 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, endif end do endif - + end subroutine hist_do_disp !----------------------------------------------------------------------- @@ -5342,4 +5340,3 @@ end function avgflag_valid end module histFileMod - diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 10df7072af..a57a20793d 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -68,6 +68,7 @@ module ncdio_pio public :: ncd_inqvdlen ! inquire variable dimension size public :: ncd_inqvdname ! inquire variable dimension name public :: ncd_io ! write local data + public :: ncd_pio_syncfile ! flush file contents to disk integer,parameter,public :: ncd_int = pio_int integer,parameter,public :: ncd_log =-pio_int From 5779704640117bace7a68df79f7514a168c0d0a4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 29 Jul 2020 14:51:33 -0600 Subject: [PATCH 1211/1973] Start replacing finidat files with ones that don't need to be interpolated, add f09 and f19 clm5_0_cam6.0 1979 SP finidat files needed for CAM --- bld/namelist_files/namelist_defaults_ctsm.xml | 78 +++++++++++++------ .../namelist_definition_ctsm.xml | 2 +- 2 files changed, 54 insertions(+), 26 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index ec8d3ffe5d..b68ec11f79 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -22,7 +22,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 379.0 336.6 -340.6 379.0 388.8 397.5 @@ -505,7 +504,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 61 -1850,1982,2000,2010,2013 +1850,1979,2000,2010,2013 .true. - - +.true. +.true. +.true. -.true. .true. @@ -673,12 +676,22 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -hgrid=0.9x1.25 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + + +hgrid=1.9x2.5 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + + +hgrid=ne0np4.ARCTIC.ne30x4 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 -hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 @@ -752,8 +765,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc + lnd_tuning_mode="clm5_0_GSWP3v1" +>lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc @@ -768,8 +781,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c190116.nc + lnd_tuning_mode="clm5_0_CRUv7" +>lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc @@ -783,8 +796,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc + lnd_tuning_mode="clm5_0_CRUv7" +>lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc @@ -825,28 +838,43 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc + +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr1979_c200729.nc + + +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.1.9x2.5_gx1v7_simyr1979_c200729.nc + + lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTIC_ne30x4_mt12_simyr1982_c200425.nc + lnd_tuning_mode="clm5_0_cam6.0" +>lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTIC_ne30x4_mt12_simyr1979_c200728.nc lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTICGRIS_ne30x8_mt12_simyr1982_c200428.nc + lnd_tuning_mode="clm5_0_cam6.0" +>lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTICGRIS_ne30x8_mt12_simyr1979_c200728.nc lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200506.nc + lnd_tuning_mode="clm5_0_cam6.0" +>lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200728.nc @@ -854,7 +882,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="20000101" use_nitrif_denitrif=".true." use_vertsoilc=".true." sim_year="2000" ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".true." use_init_interp=".true." lnd_tuning_mode="clm4_5_cam6.0" ->lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc +>lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc +>lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc @@ -883,9 +911,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200705.nc +>lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200728.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index e540540813..6455625ed2 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -2024,7 +2024,7 @@ How close in years to use when looking for an initial condition file (finidat) i + group="default_settings" valid_values="1850,1979,2000,2010,2013" > Simulation years you can look for in initial condition files (finidat) if interpolation is turned on (use_init_interp is .true.) From baea0d667fafbefc50a292f6a9aea5e84aaf2bc0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 29 Jul 2020 17:34:08 -0600 Subject: [PATCH 1212/1973] Update I1850Clm45BgcCruGs finidat file --- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index b68ec11f79..c1ad048755 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -749,9 +749,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c190718.nc +>lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc Date: Wed, 29 Jul 2020 22:18:32 -0600 Subject: [PATCH 1213/1973] Replace the rest of the finidat files (all but 2010) --- bld/namelist_files/namelist_defaults_ctsm.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index c1ad048755..0ef8395f58 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -742,9 +742,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c190718.nc +>lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc +>lnd/clm2/initdata_map/clmi.B1850Clm45BgcGs.0161-01-01.0.9x1.25_gx1v7_simyr1850_c200729.nc @@ -789,8 +789,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc + lnd_tuning_mode="clm5_0_cam6.0" +>lnd/clm2/initdata_map/clmi.B1850Clm50BgcCrop.0161-01-01.0.9x1.25_gx1v7_simyr1850_c200729.nc lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc @@ -895,7 +895,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc From 44e7d83257781382d92fc24ceb230fd2986d1208 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 30 Jul 2020 12:12:30 -0600 Subject: [PATCH 1214/1973] Minor updates to lilac docs and fixes for latest sphinx version --- .../ctsm_lilac_runtime_file_workflow.svg | 4 ++-- .../setting-ctsm-runtime-options.rst | 16 ++++++++++------ .../Ecosystem/CLM50_Tech_Note_Ecosystem.rst | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg b/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg index a0d2cf6d07..7dd2f63995 100644 --- a/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg +++ b/doc/source/lilac/obtaining-building-and-running/ctsm_lilac_runtime_file_workflow.svg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d86cfb661a03c99574ec626db8be97d8875884f1c3879db9cab935bd0dee7a7 -size 17275 +oid sha256:73b7f4567783717f844f57e9ad2d7f0faa543e0ce1b22d83309b11c06d8fe611 +size 17487 diff --git a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst index bcdb709dbf..c298972710 100644 --- a/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst +++ b/doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst @@ -6,9 +6,6 @@ Setting CTSM runtime options ============================== -Overview and quick start -======================== - This section describes the process for creating the runtime input text files for CTSM and LILAC. These files, which are in Fortran namelist format, have hard-coded file names. These files must exist with the expected names in the directory from which the @@ -51,8 +48,8 @@ also illustrated in :numref:`Figure ctsm_lilac_runtime_file_workflow`: unnecessary if all of the needed input data already exists. However, it doesn't hurt to run it in this case.) -#. Copy ``lnd_in``, ``lnd_modelio.nml`` and ``lilac_in`` to the directory from which you - will be running the model. +#. Copy or create links to ``lnd_in``, ``lnd_modelio.nml`` and ``lilac_in`` in the + directory from which you will be running the model. .. _Figure ctsm_lilac_runtime_file_workflow: @@ -233,7 +230,8 @@ files (and not to CTSM's standard input files), then this is nothing to worry ab Copying the necessary files to the model's run directory ======================================================== -Finally, copy the following files to the directory from which you will run the model: +Finally, copy or create links to the following files in the directory from which you will +run the model: - ``lnd_in``: This is the main namelist input file for CTSM @@ -241,6 +239,12 @@ Finally, copy the following files to the directory from which you will run the m - ``lilac_in``: This namelist controls the operation of LILAC +.. note:: + + We recommend using symbolic links (via ``ln -s``) rather than copying these files: This + way, if you later update these files in the ``runtime_inputs`` directory, you do not + need to re-copy them. + .. note:: We have not discussed ``lnd_modelio.nml`` above. This is because, if you have run diff --git a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst index d90c8cab40..a60baebffa 100644 --- a/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst +++ b/doc/source/tech_note/Ecosystem/CLM50_Tech_Note_Ecosystem.rst @@ -438,10 +438,10 @@ precipitation :math:`q_{rain}` and solid precipitation However, in CLM5, the atmosphere's partitioning into liquid and solid precipitation is ignored. Instead, CLM repartitions total precipitation using a linear ramp. For most landunits, this ramp generates all snow -below :math:`0 \textdegree C`, all rain above :math:`2 \textdegree C`, +below :math:`0 ^{\circ} C`, all rain above :math:`2 ^{\circ} C`, and a mix of rain and snow for intermediate temperatures. For glaciers, -the end points of the ramp are :math:`-2 \textdegree C` and :math:`0 -\textdegree C`, respectively. Changes to the phase of precipitation are +the end points of the ramp are :math:`-2 ^{\circ} C` and :math:`0 +^{\circ} C`, respectively. Changes to the phase of precipitation are accompanied by a sensible heat flux (positive or negative) to conserve energy. From 2a40a564f0898ea8ad108a04e9636c844223aca1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 31 Jul 2020 01:03:18 -0600 Subject: [PATCH 1215/1973] Remove 2010 finidat settings, move it to inside of 2010_control just for f19 and clm5_0_cam6.0, use st_year for date for finidat file only if a transient simulation --- bld/CLMBuildNamelist.pm | 6 +-- bld/namelist_files/namelist_defaults_ctsm.xml | 50 ------------------- bld/namelist_files/use_cases/2010_control.xml | 5 ++ .../clm45cam6LndTuningMode/include_user_mods | 1 + .../clm/clm45cam6LndTuningMode/shell_commands | 4 ++ 5 files changed, 12 insertions(+), 54 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm45cam6LndTuningMode/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm45cam6LndTuningMode/shell_commands diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 9dba13935f..5c894aa2a9 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2297,10 +2297,8 @@ SIMYR: foreach my $sim_yr ( @sim_years ) { my $how_close = undef; if ( $nl_flags->{'sim_year'} eq "PtVg" ) { $how_close = abs(1850 - $sim_yr); - # EBK 07/20/2020 -- This makes sure the sim_year matched is based on the sim-year - # rather than the start year. - #} elsif ( $nl_flags->{'flanduse_timeseries'} eq "null" ) { - # $how_close = abs($nl_flags->{'sim_year'} - $sim_yr); + } elsif ( $nl_flags->{'flanduse_timeseries'} eq "null" ) { + $how_close = abs($nl_flags->{'sim_year'} - $sim_yr); } else { $how_close = abs($st_year - $sim_yr); } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 0ef8395f58..78bd431c59 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -530,18 +530,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4.ARCTICGRIS.ne30x8">.true. .true. -.true. -.true. -.true. -.true. .true. -.true. .true. @@ -698,36 +688,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - - -lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc - - -lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc - - - .false. .false. +lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc + +.true. + 2010 2010 diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam6LndTuningMode/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm45cam6LndTuningMode/include_user_mods new file mode 100644 index 0000000000..fe0e18cf88 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam6LndTuningMode/include_user_mods @@ -0,0 +1 @@ +../default diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam6LndTuningMode/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm45cam6LndTuningMode/shell_commands new file mode 100644 index 0000000000..bc72045eeb --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam6LndTuningMode/shell_commands @@ -0,0 +1,4 @@ +#!/bin/bash + +./xmlchange LND_TUNING_MODE="clm4_5_cam6.0" + From 7aaad708108760e96461c4d0cb2b1273497b8f9d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 31 Jul 2020 14:50:57 -0600 Subject: [PATCH 1216/1973] Change so st_year is used in place of sim_year for transient case for finidat file selection and that hgrid is used in settings for it as well as for use_init_interp, also fix number of tests --- bld/CLMBuildNamelist.pm | 6 +++--- bld/unit_testers/build-namelist_test.pl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 5c894aa2a9..7297ffa448 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2245,11 +2245,11 @@ sub setup_logic_initial_conditions { $settings{'sim_year'} = $nl_flags->{'sim_year'}; $opts->{'ignore_ic_year'} = 1; } else { - delete( $settings{'sim_year'} ); + $settings{'sim_year'} = $st_year; } foreach my $item ( "mask", "maxpft", "irrigate", "glc_nec", "use_crop", "use_cn", "use_cndv", "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp", "use_fates", - "lnd_tuning_mode" + "lnd_tuning_mode", "hgrid", ) { $settings{$item} = $nl_flags->{$item}; } @@ -2320,7 +2320,7 @@ SIMYR: foreach my $sim_yr ( @sim_years ) { } # SIMYR: $settings{'sim_year'} = $closest_sim_year; add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $useinitvar, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'phys'=>$physv->as_string(), + 'use_cndv'=>$nl_flags->{'use_cndv'}, 'phys'=>$physv->as_string(), 'hgrid'=>$nl_flags->{'res'}, 'sim_year'=>$settings{'sim_year'}, 'nofail'=>1, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, 'use_fates'=>$nl_flags->{'use_fates'} ); $settings{$useinitvar} = $nl->get_value($useinitvar); diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index b1e306aab4..bde36e8c58 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 897; +my $ntests = 889; if ( defined($opts{'compare'}) ) { - $ntests += 552; + $ntests += 546; } plan( tests=>$ntests ); From 7364ad035c63b3594f9b945a22a80fffeb4c7244 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 31 Jul 2020 15:28:13 -0600 Subject: [PATCH 1217/1973] Get rid of 2010 finidat file settings --- bld/namelist_files/namelist_defaults_ctsm.xml | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 78bd431c59..5bea3819a3 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -504,7 +504,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 61 -1850,1979,2000,2010,2013 +1850,1979,2000,2013 .true. @@ -686,13 +684,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - - lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200728.nc - + lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc - -lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc - - Date: Fri, 31 Jul 2020 15:33:58 -0600 Subject: [PATCH 1218/1973] Remove unused rhoSat subroutine --- src/biogeophys/QSatMod.F90 | 42 -------------------------------------- 1 file changed, 42 deletions(-) diff --git a/src/biogeophys/QSatMod.F90 b/src/biogeophys/QSatMod.F90 index 0b1819e467..76d1a40689 100644 --- a/src/biogeophys/QSatMod.F90 +++ b/src/biogeophys/QSatMod.F90 @@ -12,7 +12,6 @@ module QSatMod ! ! !PUBLIC MEMBER FUNCTIONS: public :: QSat - public :: rhoSat !----------------------------------------------------------------------- ! For water vapor (temperature range 0C-100C) @@ -123,45 +122,4 @@ subroutine QSat (T, p, es, esdT, qs, qsdT) end subroutine QSat - - -!------------------------------------------------------------------------------- - subroutine rhoSat(T, rho, rhodT) - ! compute the saturated vapor pressure density and its derivative against the temperature - ! jyt - use clm_varcon, only: rwat - use shr_const_mod, only: SHR_CONST_TKFRZ - - implicit none - real(r8), intent(in) :: T - real(r8), intent(out) :: rho - real(r8), optional, intent(out) :: rhodT - - - !------------------ - - real(r8) :: T_limit - real(r8) :: td, es, esdT - - T_limit = T - SHR_CONST_TKFRZ - if (T_limit > 100.0_r8) T_limit=100.0_r8 - if (T_limit < -75.0_r8) T_limit=-75.0_r8 - - td = T_limit - if (td >= 0.0_r8) then - es = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & - + td*(a5 + td*(a6 + td*(a7 + td*a8))))))) - esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & - + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) - else - es = c0 + td*(c1 + td*(c2 + td*(c3 + td*(c4 & - + td*(c5 + td*(c6 + td*(c7 + td*c8))))))) - esdT = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & - + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) - endif - - es = es * 100._r8 ! pa - rho = es/(rwat*T) !kg m^-3 - if(present(rhodT))rhodT= esdT/(rwat*T)-rho/T !kg m^-3 K^-1 - end subroutine rhoSat end module QSatMod From 357b93df89142a6130733c3b326f55ed9b30abf6 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 31 Jul 2020 15:34:21 -0600 Subject: [PATCH 1219/1973] Fix indentation --- src/biogeophys/QSatMod.F90 | 89 +++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/src/biogeophys/QSatMod.F90 b/src/biogeophys/QSatMod.F90 index 76d1a40689..3d23d85873 100644 --- a/src/biogeophys/QSatMod.F90 +++ b/src/biogeophys/QSatMod.F90 @@ -14,49 +14,48 @@ module QSatMod public :: QSat !----------------------------------------------------------------------- - ! For water vapor (temperature range 0C-100C) - real(r8), parameter :: a0 = 6.11213476_r8 - real(r8), parameter :: a1 = 0.444007856_r8 - real(r8), parameter :: a2 = 0.143064234e-01_r8 - real(r8), parameter :: a3 = 0.264461437e-03_r8 - real(r8), parameter :: a4 = 0.305903558e-05_r8 - real(r8), parameter :: a5 = 0.196237241e-07_r8 - real(r8), parameter :: a6 = 0.892344772e-10_r8 - real(r8), parameter :: a7 = -0.373208410e-12_r8 - real(r8), parameter :: a8 = 0.209339997e-15_r8 - ! For derivative:water vapor - real(r8), parameter :: b0 = 0.444017302_r8 - real(r8), parameter :: b1 = 0.286064092e-01_r8 - real(r8), parameter :: b2 = 0.794683137e-03_r8 - real(r8), parameter :: b3 = 0.121211669e-04_r8 - real(r8), parameter :: b4 = 0.103354611e-06_r8 - real(r8), parameter :: b5 = 0.404125005e-09_r8 - real(r8), parameter :: b6 = -0.788037859e-12_r8 - real(r8), parameter :: b7 = -0.114596802e-13_r8 - real(r8), parameter :: b8 = 0.381294516e-16_r8 - ! For ice (temperature range -75C-0C) - real(r8), parameter :: c0 = 6.11123516_r8 - real(r8), parameter :: c1 = 0.503109514_r8 - real(r8), parameter :: c2 = 0.188369801e-01_r8 - real(r8), parameter :: c3 = 0.420547422e-03_r8 - real(r8), parameter :: c4 = 0.614396778e-05_r8 - real(r8), parameter :: c5 = 0.602780717e-07_r8 - real(r8), parameter :: c6 = 0.387940929e-09_r8 - real(r8), parameter :: c7 = 0.149436277e-11_r8 - real(r8), parameter :: c8 = 0.262655803e-14_r8 - ! For derivative:ice - real(r8), parameter :: d0 = 0.503277922_r8 - real(r8), parameter :: d1 = 0.377289173e-01_r8 - real(r8), parameter :: d2 = 0.126801703e-02_r8 - real(r8), parameter :: d3 = 0.249468427e-04_r8 - real(r8), parameter :: d4 = 0.313703411e-06_r8 - real(r8), parameter :: d5 = 0.257180651e-08_r8 - real(r8), parameter :: d6 = 0.133268878e-10_r8 - real(r8), parameter :: d7 = 0.394116744e-13_r8 - real(r8), parameter :: d8 = 0.498070196e-16_r8 -contains - + ! For water vapor (temperature range 0C-100C) + real(r8), parameter :: a0 = 6.11213476_r8 + real(r8), parameter :: a1 = 0.444007856_r8 + real(r8), parameter :: a2 = 0.143064234e-01_r8 + real(r8), parameter :: a3 = 0.264461437e-03_r8 + real(r8), parameter :: a4 = 0.305903558e-05_r8 + real(r8), parameter :: a5 = 0.196237241e-07_r8 + real(r8), parameter :: a6 = 0.892344772e-10_r8 + real(r8), parameter :: a7 = -0.373208410e-12_r8 + real(r8), parameter :: a8 = 0.209339997e-15_r8 + ! For derivative:water vapor + real(r8), parameter :: b0 = 0.444017302_r8 + real(r8), parameter :: b1 = 0.286064092e-01_r8 + real(r8), parameter :: b2 = 0.794683137e-03_r8 + real(r8), parameter :: b3 = 0.121211669e-04_r8 + real(r8), parameter :: b4 = 0.103354611e-06_r8 + real(r8), parameter :: b5 = 0.404125005e-09_r8 + real(r8), parameter :: b6 = -0.788037859e-12_r8 + real(r8), parameter :: b7 = -0.114596802e-13_r8 + real(r8), parameter :: b8 = 0.381294516e-16_r8 + ! For ice (temperature range -75C-0C) + real(r8), parameter :: c0 = 6.11123516_r8 + real(r8), parameter :: c1 = 0.503109514_r8 + real(r8), parameter :: c2 = 0.188369801e-01_r8 + real(r8), parameter :: c3 = 0.420547422e-03_r8 + real(r8), parameter :: c4 = 0.614396778e-05_r8 + real(r8), parameter :: c5 = 0.602780717e-07_r8 + real(r8), parameter :: c6 = 0.387940929e-09_r8 + real(r8), parameter :: c7 = 0.149436277e-11_r8 + real(r8), parameter :: c8 = 0.262655803e-14_r8 + ! For derivative:ice + real(r8), parameter :: d0 = 0.503277922_r8 + real(r8), parameter :: d1 = 0.377289173e-01_r8 + real(r8), parameter :: d2 = 0.126801703e-02_r8 + real(r8), parameter :: d3 = 0.249468427e-04_r8 + real(r8), parameter :: d4 = 0.313703411e-06_r8 + real(r8), parameter :: d5 = 0.257180651e-08_r8 + real(r8), parameter :: d6 = 0.133268878e-10_r8 + real(r8), parameter :: d7 = 0.394116744e-13_r8 + real(r8), parameter :: d8 = 0.498070196e-16_r8 +contains !----------------------------------------------------------------------- subroutine QSat (T, p, es, esdT, qs, qsdT) @@ -94,8 +93,8 @@ subroutine QSat (T, p, es, esdT, qs, qsdT) if (td >= 0.0_r8) then es = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & + td*(a5 + td*(a6 + td*(a7 + td*a8))))))) - - esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & + + esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) else @@ -111,7 +110,7 @@ subroutine QSat (T, p, es, esdT, qs, qsdT) esdT = esdT * 100._r8 ! pa/K - + vp = 1.0_r8 / (p - 0.378_r8*es) vp1 = 0.622_r8 * vp vp2 = vp1 * vp From fc141769d41b185a176db372f507c4dddfa199ee Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 31 Jul 2020 16:16:24 -0600 Subject: [PATCH 1220/1973] This part was an error, because hgrid was already set and hgrid is set to the value of res, hence this overwrote the correct value with the wrong one --- bld/CLMBuildNamelist.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 7297ffa448..054db5e8f4 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2249,7 +2249,7 @@ sub setup_logic_initial_conditions { } foreach my $item ( "mask", "maxpft", "irrigate", "glc_nec", "use_crop", "use_cn", "use_cndv", "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp", "use_fates", - "lnd_tuning_mode", "hgrid", + "lnd_tuning_mode", ) { $settings{$item} = $nl_flags->{$item}; } From d495c31b8d1a9fa7400c9ea49bdb04ae8db89bc8 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 7 Jul 2020 23:42:00 -0700 Subject: [PATCH 1221/1973] matching Fates testdefs to fates_next_api match FatesColdDef to fates_next_api matching FatesLogging to fates_next_api updating fates testdefs to use FatesColdDef updating ERS_Ld60 fates tests to Clm50 correcting grid and Clm testlist calls correct ERS_D_Ld5 testlists to match fates_next_api correcting ERS_D_Mmpi-serial_Ld5 correcing compset call to ERS_D_Ld5.f19_g16 test update exact restart tests to FatesColdDef adding missing FatesHydro tests correcting SMS compset fixing FatesAllVars history variable setting increasing wallclock time for ERS_D_Ld3 gnu test on cheyenne fixing gnu smoke test called for fates --- cime_config/testdefs/testlist_clm.xml | 63 +++++++++++++------ .../testmods_dirs/clm/Fates/shell_commands | 1 + .../testmods_dirs/clm/Fates/user_nl_clm | 2 +- .../clm/FatesAllVars/include_user_mods | 2 +- .../clm/FatesAllVars/user_nl_clm | 8 +-- .../clm/FatesColdDef/user_nl_clm | 4 ++ .../clm/FatesLogging/include_user_mods | 2 +- .../clm/FatesNoFire/include_user_mods | 2 +- .../clm/FatesPPhys/include_user_mods | 2 +- .../clm/FatesST3/include_user_mods | 2 +- 10 files changed, 59 insertions(+), 29 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 865e862a11..c59b5a985f 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1525,6 +1525,15 @@ + + + + + + + + + @@ -1539,7 +1548,7 @@ - + @@ -1767,7 +1776,7 @@ - + @@ -1775,7 +1784,7 @@ - + @@ -1793,7 +1802,7 @@ - + @@ -1803,52 +1812,64 @@ - + - + - + + - + + - + - + + + + + + + + + + + - + @@ -1858,25 +1879,26 @@ - + + - + - + - + - + @@ -1887,13 +1909,14 @@ + - + @@ -1911,18 +1934,20 @@ - + + - + + diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands b/cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands index 41a2342a51..fe7182b67f 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands @@ -1,2 +1,3 @@ ./xmlchange CLM_BLDNML_OPTS="-no-megan" --append ./xmlchange BFBFLAG="TRUE" +./xmlchange CLM_FORCE_COLDSTART="on" diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm index f39d85411c..7c2892229b 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm @@ -1,4 +1,4 @@ -!!finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/iclm45fates-finit-s1.4.0-a3.0.0-1x1br.clm2.r.0111-01-01-00000.nc' +!! USES THE DEFAULT INITIALIZATION FILE SPECIFIED IN bld/namelist_files/namelist_defaults_ctsm.xml hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods index 4c7aa0f2b4..1f2c03aebe 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods @@ -1 +1 @@ -../Fates +../FatesColdDef diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm index d7c9b447a4..a26b638268 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm @@ -7,7 +7,7 @@ hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE',' 'PARSHA_Z_CNLFPFT','PARSUN_Z_CAN','PARSHA_Z_CAN','LAISUN_Z_CNLF','LAISHA_Z_CNLF','LAISUN_Z_CNLFPFT','LAISHA_Z_CNLFPFT', 'LAISUN_TOP_CAN','LAISHA_TOP_CAN','FABD_SUN_CNLFPFT','FABD_SHA_CNLFPFT','FABI_SUN_CNLFPFT','FABI_SHA_CNLFPFT', 'FABD_SUN_CNLF','FABD_SHA_CNLF','FABI_SUN_CNLF','FABI_SHA_CNLF','FABD_SUN_TOPLF_BYCANLAYER','FABD_SHA_TOPLF_BYCANLAYER', - 'FABI_SUN_TOPLF_BYCANLAYER','FABI_SHA_TOPLF_BYCANLAYER','TS_NET_UPTAKE_CNLF','YEAR_NET_UPTAKE_CNLF','CROWNAREA_CNLF', + 'FABI_SUN_TOPLF_BYCANLAYER','FABI_SHA_TOPLF_BYCANLAYER','NET_C_UPTAKE_CNLF','CROWNAREA_CNLF', 'MORTALITY_CARBONFLUX_CANOPY','MORTALITY_CARBONFLUX_UNDERSTORY','NPLANT_SCAG','NPLANT_CANOPY_SCAG','NPLANT_UNDERSTORY_SCAG', 'DDBH_CANOPY_SCAG','DDBH_UNDERSTORY_SCAG','MORTALITY_CANOPY_SCAG','MORTALITY_UNDERSTORY_SCAG','GPP_SCPF','GPP_CANOPY_SCPF', 'AR_CANOPY_SCPF','GPP_UNDERSTORY_SCPF','AR_UNDERSTORY_SCPF','NPP_SCPF','NPP_LEAF_SCPF','NPP_SEED_SCPF','NPP_FNRT_SCPF', @@ -20,12 +20,12 @@ hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE',' 'YESTERDAYCANLEV_UNDERSTORY_SCLS','BA_SCLS','DEMOTION_RATE_SCLS','PROMOTION_RATE_SCLS','NPLANT_CANOPY_SCLS', 'MORTALITY_CANOPY_SCLS','NPLANT_UNDERSTORY_SCLS','MORTALITY_UNDERSTORY_SCLS','TRIMMING_CANOPY_SCLS','TRIMMING_UNDERSTORY_SCLS', 'CROWN_AREA_CANOPY_SCLS','CROWN_AREA_UNDERSTORY_SCLS','LEAF_MD_CANOPY_SCLS','ROOT_MD_CANOPY_SCLS','CARBON_BALANCE_CANOPY_SCLS', - 'SEED_PROD_CANOPY_SCLS','DBALIVEDT_CANOPY_SCLS','DBDEADDT_CANOPY_SCLS','DBSTOREDT_CANOPY_SCLS','STORAGE_FLUX_CANOPY_SCLS', + 'SEED_PROD_CANOPY_SCLS', 'NPP_LEAF_CANOPY_SCLS','NPP_FROOT_CANOPY_SCLS','NPP_BSW_CANOPY_SCLS','NPP_BDEAD_CANOPY_SCLS','NPP_BSEED_CANOPY_SCLS', 'NPP_STORE_CANOPY_SCLS','RDARK_CANOPY_SCLS','LIVESTEM_MR_CANOPY_SCLS','LIVECROOT_MR_CANOPY_SCLS','FROOT_MR_CANOPY_SCLS', 'RESP_G_CANOPY_SCLS','RESP_M_CANOPY_SCLS','LEAF_MD_UNDERSTORY_SCLS','ROOT_MD_UNDERSTORY_SCLS','CARBON_BALANCE_UNDERSTORY_SCLS', - 'SEED_PROD_UNDERSTORY_SCLS','DBALIVEDT_UNDERSTORY_SCLS','DBDEADDT_UNDERSTORY_SCLS','DBSTOREDT_UNDERSTORY_SCLS', - 'STORAGE_FLUX_UNDERSTORY_SCLS','NPP_LEAF_UNDERSTORY_SCLS','NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS', + 'SEED_PROD_UNDERSTORY_SCLS', + 'NPP_LEAF_UNDERSTORY_SCLS','NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS', 'NPP_BDEAD_UNDERSTORY_SCLS','NPP_BSEED_UNDERSTORY_SCLS','NPP_STORE_UNDERSTORY_SCLS','RDARK_UNDERSTORY_SCLS', 'LIVESTEM_MR_UNDERSTORY_SCLS','LIVECROOT_MR_UNDERSTORY_SCLS','FROOT_MR_UNDERSTORY_SCLS','RESP_G_UNDERSTORY_SCLS', 'RESP_M_UNDERSTORY_SCLS','LITTER_IN_ELEM','LITTER_OUT_ELEM','SEED_BANK_ELEM','SEEDS_IN_LOCAL_ELEM','SEEDS_IN_EXTERN_ELEM', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm index 967a48e89c..02b13dcd1d 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm @@ -1,3 +1,7 @@ +hist_mfilt = 365 +hist_nhtfrq = -24 +hist_empty_htapes = .true. +use_fates_spitfire= .true. hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','FIRE_FUEL_MEF', 'FIRE_FUEL_BULKD','FIRE_FUEL_SAV','FIRE_NESTEROV_INDEX','PFTbiomass', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods index 4c7aa0f2b4..1f2c03aebe 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods @@ -1 +1 @@ -../Fates +../FatesColdDef diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods index 4c7aa0f2b4..1f2c03aebe 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods @@ -1 +1 @@ -../Fates +../FatesColdDef diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods index 4c7aa0f2b4..1f2c03aebe 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods @@ -1 +1 @@ -../Fates +../FatesColdDef diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods index 4c7aa0f2b4..1f2c03aebe 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods @@ -1 +1 @@ -../Fates +../FatesColdDef From a5a173105312b91fa51f3e17b2114acca0693b64 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 31 Jul 2020 16:46:18 -0600 Subject: [PATCH 1222/1973] Make most QSat output arguments optional This has two benefits: (1) It prevents callers from needing to create dummy variables to hold outputs that they don't actually need. (2) If neither qsdT nor esdT are needed, then we can avoid doing some expensive calculations. --- src/biogeophys/BareGroundFluxesMod.F90 | 5 +- src/biogeophys/CanopyFluxesMod.F90 | 14 ++-- src/biogeophys/LakeFluxesMod.F90 | 13 ++-- src/biogeophys/QSatMod.F90 | 68 ++++++++++--------- src/biogeophys/SurfaceHumidityMod.F90 | 14 ++-- src/biogeophys/UrbanFluxesMod.F90 | 5 +- .../test/HumanStress_test/test_humanstress.pf | 14 ++-- src/main/atm2lndMod.F90 | 9 ++- 8 files changed, 75 insertions(+), 67 deletions(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index faf6e425b7..6751459246 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -141,9 +141,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & real(r8) :: z0hg_patch(bounds%begp:bounds%endp) real(r8) :: z0qg_patch(bounds%begp:bounds%endp) real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m real(r8) :: www ! surface soil wetness [-] !------------------------------------------------------------------------------ @@ -419,7 +417,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & q_ref2m(p) = forc_q(c) + temp2(p)*dqh(p)*(1._r8/temp22m(p) - 1._r8/temp2(p)) ! 2 m height relative humidity - call QSat(t_ref2m(p), forc_pbot(c), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) + call QSat(t_ref2m(p), forc_pbot(c), qsat_ref2m, & + es = e_ref2m) rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 2e10512683..231f00f8a3 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -321,13 +321,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: wtalq(bounds%begp:bounds%endp) ! normalized latent heat cond. for air and leaf [-] real(r8) :: wtgaq ! normalized latent heat cond. for air and ground [-] real(r8) :: el(bounds%begp:bounds%endp) ! vapor pressure on leaf surface [pa] - real(r8) :: deldT ! derivative of "el" on "t_veg" [pa/K] real(r8) :: qsatl(bounds%begp:bounds%endp) ! leaf specific humidity [kg/kg] real(r8) :: qsatldT(bounds%begp:bounds%endp) ! derivative of "qsatl" on "t_veg" real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m real(r8) :: air(bounds%begp:bounds%endp) ! atmos. radiation temporay set real(r8) :: bir(bounds%begp:bounds%endp) ! atmos. radiation temporay set real(r8) :: cir(bounds%begp:bounds%endp) ! atmos. radiation temporay set @@ -740,7 +737,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Saturated vapor pressure, specific humidity, and their derivatives ! at the leaf surface - call QSat (t_veg(p), forc_pbot(c), el(p), deldT, qsatl(p), qsatldT(p)) + call QSat (t_veg(p), forc_pbot(c), qsatl(p), & + es = el(p), & + qsdT = qsatldT(p)) ! Determine atmospheric co2 and o2 @@ -1109,7 +1108,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Re-calculate saturated vapor pressure, specific humidity, and their ! derivatives at the leaf surface - call QSat(t_veg(p), forc_pbot(c), el(p), deldT, qsatl(p), qsatldT(p)) + call QSat(t_veg(p), forc_pbot(c), qsatl(p), & + es = el(p), & + qsdT = qsatldT(p)) ! Update vegetation/ground surface temperature, canopy air ! temperature, canopy vapor pressure, aerodynamic temperature, and @@ -1228,7 +1229,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! 2 m height relative humidity - call QSat(t_ref2m(p), forc_pbot(c), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) + call QSat(t_ref2m(p), forc_pbot(c), qsat_ref2m, & + es = e_ref2m) rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) rh_ref2m_r(p) = rh_ref2m(p) diff --git a/src/biogeophys/LakeFluxesMod.F90 b/src/biogeophys/LakeFluxesMod.F90 index 63633fe93c..3477c565d6 100644 --- a/src/biogeophys/LakeFluxesMod.F90 +++ b/src/biogeophys/LakeFluxesMod.F90 @@ -130,12 +130,10 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, integer :: jtop(bounds%begc:bounds%endc) ! top level for each column (no longer all 1) real(r8) :: ax ! used in iteration loop for calculating t_grnd (numerator of NR solution) real(r8) :: bx ! used in iteration loop for calculating t_grnd (denomin. of NR solution) - real(r8) :: degdT ! d(eg)/dT real(r8) :: dqh(bounds%begp:bounds%endp) ! diff of humidity between ref. height and surface real(r8) :: dth(bounds%begp:bounds%endp) ! diff of virtual temp. between ref. height and surface real(r8) :: dthv ! diff of vir. poten. temp. between ref. height and surface real(r8) :: dzsur(bounds%begc:bounds%endc) ! 1/2 the top layer thickness (m) - real(r8) :: eg ! water vapor pressure at temperature T [pa] real(r8) :: htvp(bounds%begc:bounds%endc) ! latent heat of vapor of water (or sublimation) [j/kg] real(r8) :: obu(bounds%begp:bounds%endp) ! monin-obukhov length (m) real(r8) :: obuold(bounds%begp:bounds%endp) ! monin-obukhov length of previous iteration @@ -173,9 +171,7 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, real(r8) :: t_grnd_temp ! Used in surface flux correction over frozen ground real(r8) :: betaprime(bounds%begc:bounds%endc) ! Effective beta: sabg_lyr(p,jtop) for snow layers, beta otherwise real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m real(r8) :: sabg_nir ! NIR that is absorbed (W/m^2) ! For calculating roughness lengths @@ -364,7 +360,8 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, ! Saturated vapor pressure, specific humidity and their derivatives ! at lake surface - call QSat(t_grnd(c), forc_pbot(c), eg, degdT, qsatg(c), qsatgdT(c)) + call QSat(t_grnd(c), forc_pbot(c), qsatg(c), & + qsdT = qsatgdT(c)) ! Potential, virtual potential temperature, and wind speed at the ! reference height @@ -491,7 +488,8 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, ! Re-calculate saturated vapor pressure, specific humidity and their ! derivatives at lake surface - call QSat(t_grnd(c), forc_pbot(c), eg, degdT, qsatg(c), qsatgdT(c)) + call QSat(t_grnd(c), forc_pbot(c), qsatg(c), & + qsdT = qsatgdT(c)) dth(p)=thm(p)-t_grnd(c) dqh(p)=forc_q(c)-qsatg(c) @@ -643,7 +641,8 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, ! 2 m height relative humidity - call QSat(t_ref2m(p), forc_pbot(c), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) + call QSat(t_ref2m(p), forc_pbot(c), qsat_ref2m, & + es = e_ref2m) rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) ! Human Heat Stress diff --git a/src/biogeophys/QSatMod.F90 b/src/biogeophys/QSatMod.F90 index 3d23d85873..4599da978e 100644 --- a/src/biogeophys/QSatMod.F90 +++ b/src/biogeophys/QSatMod.F90 @@ -58,10 +58,10 @@ module QSatMod contains !----------------------------------------------------------------------- - subroutine QSat (T, p, es, esdT, qs, qsdT) + subroutine QSat (T, p, qs, es, qsdT, esdT) ! ! !DESCRIPTION: - ! Computes saturation mixing ratio and the change in saturation + ! Computes saturation mixing ratio and (optionally) the change in saturation ! mixing ratio with respect to temperature. ! Reference: Polynomial approximations from: ! Piotr J. Flatau, et al.,1992: Polynomial fits to saturation @@ -75,49 +75,55 @@ subroutine QSat (T, p, es, esdT, qs, qsdT) implicit none real(r8), intent(in) :: T ! temperature (K) real(r8), intent(in) :: p ! surface atmospheric pressure (pa) - real(r8), intent(out) :: es ! vapor pressure (pa) - real(r8), intent(out) :: esdT ! d(es)/d(T) real(r8), intent(out) :: qs ! humidity (kg/kg) - real(r8), intent(out) :: qsdT ! d(qs)/d(T) + real(r8), intent(out), optional :: es ! vapor pressure (pa) + real(r8), intent(out), optional :: qsdT ! d(qs)/d(T) + real(r8), intent(out), optional :: esdT ! d(es)/d(T) ! ! !LOCAL VARIABLES: - real(r8) :: T_limit + real(r8) :: es_local ! local version of es (in case es is not present) + real(r8) :: esdT_local ! local version of esdT (in case esdT is not present) real(r8) :: td,vp,vp1,vp2 !----------------------------------------------------------------------- - T_limit = T - SHR_CONST_TKFRZ - if (T_limit > 100.0_r8) T_limit=100.0_r8 - if (T_limit < -75.0_r8) T_limit=-75.0_r8 + td = T - SHR_CONST_TKFRZ + if (td > 100.0_r8) td=100.0_r8 + if (td < -75.0_r8) td=-75.0_r8 - td = T_limit if (td >= 0.0_r8) then - es = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & + es_local = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & + td*(a5 + td*(a6 + td*(a7 + td*a8))))))) - - esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & - + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) - else - es = c0 + td*(c1 + td*(c2 + td*(c3 + td*(c4 & + es_local = c0 + td*(c1 + td*(c2 + td*(c3 + td*(c4 & + td*(c5 + td*(c6 + td*(c7 + td*c8))))))) - - esdT = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & - + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) - endif - es = es * 100._r8 ! pa - - esdT = esdT * 100._r8 ! pa/K - - - vp = 1.0_r8 / (p - 0.378_r8*es) + es_local = es_local * 100._r8 ! pa + vp = 1.0_r8 / (p - 0.378_r8*es_local) vp1 = 0.622_r8 * vp - vp2 = vp1 * vp - - qs = es * vp1 ! kg/kg - qsdT = esdT * vp2 * p ! 1 / K - + qs = es_local * vp1 ! kg/kg + if (present(es)) then + es = es_local + end if + + if (present(qsdT) .or. present(esdT)) then + if (td >= 0.0_r8) then + esdT_local = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & + + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) + else + esdT_local = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & + + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) + end if + + esdT_local = esdT_local * 100._r8 ! pa/K + vp2 = vp1 * vp + if (present(qsdT)) then + qsdT = esdT_local * vp2 * p ! 1 / K + end if + if (present(esdT)) then + esdT = esdT_local + end if + end if end subroutine QSat diff --git a/src/biogeophys/SurfaceHumidityMod.F90 b/src/biogeophys/SurfaceHumidityMod.F90 index b412f39d63..425fd4c4cb 100644 --- a/src/biogeophys/SurfaceHumidityMod.F90 +++ b/src/biogeophys/SurfaceHumidityMod.F90 @@ -65,9 +65,7 @@ subroutine CalculateSurfaceHumidity(bounds, & integer :: fp ! lake filter patch index integer :: fc ! lake filter column index real(r8) :: qred ! soil surface relative humidity - real(r8) :: eg ! water vapor pressure at temperature T [pa] real(r8) :: qsatg ! saturated humidity [kg/kg] - real(r8) :: degdT ! d(eg)/dT real(r8) :: qsatgdT ! d(qsatg)/dT real(r8) :: qsatgdT_snow ! d(qsatg)/dT, for snow real(r8) :: qsatgdT_soil ! d(qsatg)/dT, for soil @@ -184,7 +182,8 @@ subroutine CalculateSurfaceHumidity(bounds, & ! compute humidities individually for snow, soil, h2osfc for vegetated landunits if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - call QSat(t_soisno(c,1) , forc_pbot(c), eg, degdT, qsatg, qsatgdT_soil) + call QSat(t_soisno(c,1), forc_pbot(c), qsatg, & + qsdT = qsatgdT_soil) if (qsatg > forc_q(c) .and. forc_q(c) > hr*qsatg) then qsatg = forc_q(c) qsatgdT_soil = 0._r8 @@ -192,7 +191,8 @@ subroutine CalculateSurfaceHumidity(bounds, & qg_soil(c) = hr*qsatg if (snl(c) < 0) then - call QSat(t_soisno(c,snl(c)+1), forc_pbot(c), eg, degdT, qsatg, qsatgdT_snow) + call QSat(t_soisno(c,snl(c)+1), forc_pbot(c), qsatg, & + qsdT = qsatgdT_snow) qg_snow(c) = qsatg dqgdT(c) = frac_sno_eff(c)*qsatgdT_snow + & (1._r8 - frac_sno_eff(c) - frac_h2osfc(c))*hr*qsatgdT_soil @@ -204,7 +204,8 @@ subroutine CalculateSurfaceHumidity(bounds, & endif if (frac_h2osfc(c) > 0._r8) then - call QSat(t_h2osfc(c), forc_pbot(c), eg, degdT, qsatg, qsatgdT_h2osfc) + call QSat(t_h2osfc(c), forc_pbot(c), qsatg, & + qsdT = qsatgdT_h2osfc) qg_h2osfc(c) = qsatg dqgdT(c) = dqgdT(c) + frac_h2osfc(c) * qsatgdT_h2osfc else @@ -215,7 +216,8 @@ subroutine CalculateSurfaceHumidity(bounds, & + frac_h2osfc(c) * qg_h2osfc(c) else - call QSat(t_grnd(c), forc_pbot(c), eg, degdT, qsatg, qsatgdT) + call QSat(t_grnd(c), forc_pbot(c), qsatg, & + qsdT = qsatgdT) qg(c) = qred*qsatg dqgdT(c) = qred*qsatgdT diff --git a/src/biogeophys/UrbanFluxesMod.F90 b/src/biogeophys/UrbanFluxesMod.F90 index 23a687c158..b00de6c5dc 100644 --- a/src/biogeophys/UrbanFluxesMod.F90 +++ b/src/biogeophys/UrbanFluxesMod.F90 @@ -210,9 +210,7 @@ subroutine UrbanFluxes (bounds, num_nourbanl, filter_nourbanl, integer :: indexl ! index of first found in search loop integer :: nstep ! time step number real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m ! real(r8), parameter :: lapse_rate = 0.0098_r8 ! Dry adiabatic lapse rate (K/m) integer , parameter :: niters = 3 ! maximum number of iterations for surface temperature @@ -887,7 +885,8 @@ subroutine UrbanFluxes (bounds, num_nourbanl, filter_nourbanl, ! 2 m height relative humidity - call QSat(t_ref2m(p), forc_pbot(g), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) + call QSat(t_ref2m(p), forc_pbot(g), qsat_ref2m, & + es = e_ref2m) rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) rh_ref2m_u(p) = rh_ref2m(p) diff --git a/src/biogeophys/test/HumanStress_test/test_humanstress.pf b/src/biogeophys/test/HumanStress_test/test_humanstress.pf index 51b41cf8e4..a6cf85bbdd 100644 --- a/src/biogeophys/test/HumanStress_test/test_humanstress.pf +++ b/src/biogeophys/test/HumanStress_test/test_humanstress.pf @@ -51,14 +51,14 @@ contains real(r8) :: shum ! specific humidity real(r8) :: Teq, epott, sat_vapor - real(r8) :: esdT, qsdT real(r8) :: es_mb, de_mbdT, dlnes_mbdT, rs, rsdT, foftk, fdT pres = 100000._r8 temp = 50._r8 + SHR_CONST_TKFRZ rh = 100.0_r8 - call QSat (temp, pres, sat_vapor, esdT, rs, qsdT) + call QSat (temp, pres, rs, & + es = sat_vapor) call VaporPres( rh, sat_vapor, vapor ) call VaporPres( rh, rs, shum ) call Wet_Bulb (temp,vapor,pres,rh,shum,Teq,epott,wbt) @@ -66,7 +66,8 @@ contains temp = 59._r8 + SHR_CONST_TKFRZ rh = 65.0_r8 - call QSat (temp, pres, sat_vapor, esdT, rs, qsdT) + call QSat (temp, pres, rs, & + es = sat_vapor) call VaporPres( rh, sat_vapor, vapor ) call VaporPres( rh, rs, shum ) call Wet_Bulb (temp,vapor,pres,rh,shum,Teq,epott,wbt) @@ -78,7 +79,8 @@ contains do while ( pres > 85000._r8 ) temp = 53._r8 + SHR_CONST_TKFRZ do while ( temp > SHR_CONST_TKFRZ-127.0 ) - call QSat (temp, pres, sat_vapor, esdT, rs, qsdT) + call QSat (temp, pres, rs, & + es = sat_vapor) call VaporPres( rh, sat_vapor, vapor ) call VaporPres( rh, rs, shum ) call Wet_Bulb (temp,vapor,pres,rh,shum,Teq,epott,wbt) @@ -110,7 +112,6 @@ contains real(r8) :: shum ! specific humidity real(r8) :: Teq, epott, sat_vapor - real(r8) :: esdT, qsdT real(r8) :: es_mb, de_mbdT, dlnes_mbdT, rs, rsdT, foftk, fdT rh = 1.0_r8 @@ -119,7 +120,8 @@ contains do while ( pres < 110000._r8 ) temp = 53._r8 + SHR_CONST_TKFRZ do while ( temp <= SHR_CONST_TKFRZ+58.0 ) - call QSat (temp, pres, sat_vapor, esdT, rs, qsdT) + call QSat (temp, pres, rs, & + es = sat_vapor) call VaporPres( rh, sat_vapor, vapor ) call VaporPres( rh, rs, shum ) write(*,*) 'temp, pres, rh : ', temp-SHR_CONST_TKFRZ, pres, rh diff --git a/src/main/atm2lndMod.F90 b/src/main/atm2lndMod.F90 index fc26d7b341..cf81c2089a 100644 --- a/src/main/atm2lndMod.F90 +++ b/src/main/atm2lndMod.F90 @@ -128,10 +128,9 @@ subroutine downscale_forcings(bounds, & ! temporaries for topo downscaling real(r8) :: hsurf_g,hsurf_c real(r8) :: Hbot, zbot - real(r8) :: tbot_g, pbot_g, thbot_g, qbot_g, qs_g, es_g, rhos_g - real(r8) :: tbot_c, pbot_c, thbot_c, qbot_c, qs_c, es_c, rhos_c + real(r8) :: tbot_g, pbot_g, thbot_g, qbot_g, qs_g, rhos_g + real(r8) :: tbot_c, pbot_c, thbot_c, qbot_c, qs_c, rhos_c real(r8) :: rhos_c_estimate, rhos_g_estimate - real(r8) :: dum1, dum2 character(len=*), parameter :: subname = 'downscale_forcings' !----------------------------------------------------------------------- @@ -223,8 +222,8 @@ subroutine downscale_forcings(bounds, & thbot_c= thbot_g + (tbot_c - tbot_g)*exp((zbot/Hbot)*(rair/cpair)) ! pot temp calc - call Qsat(tbot_g,pbot_g,es_g,dum1,qs_g,dum2) - call Qsat(tbot_c,pbot_c,es_c,dum1,qs_c,dum2) + call Qsat(tbot_g,pbot_g,qs_g) + call Qsat(tbot_c,pbot_c,qs_c) qbot_c = qbot_g*(qs_c/qs_g) From a4a9e50a9e200d38fa2963d02dc9e76c93d72585 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 1 Aug 2020 13:57:57 -0600 Subject: [PATCH 1223/1973] changed wallclock time for runs that timed out with nuopc --- cime_config/testdefs/testlist_clm.xml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index ae540d6309..53b7a0ee06 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -183,7 +183,7 @@ - + @@ -1025,7 +1025,7 @@ - + @@ -1321,7 +1321,7 @@ - + @@ -1330,7 +1330,7 @@ - + @@ -1352,16 +1352,6 @@ - - - - - - - - - - @@ -1376,7 +1366,7 @@ - + @@ -1541,7 +1531,7 @@ - + @@ -1747,7 +1737,7 @@ - + From 8dace41cdbdac3a913bc04d00ab2e353d2d81a9b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 3 Aug 2020 14:47:34 -0600 Subject: [PATCH 1224/1973] Minor refactor suggested by Sam Levis --- src/biogeophys/QSatMod.F90 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/QSatMod.F90 b/src/biogeophys/QSatMod.F90 index 4599da978e..9a17ce7001 100644 --- a/src/biogeophys/QSatMod.F90 +++ b/src/biogeophys/QSatMod.F90 @@ -61,8 +61,9 @@ module QSatMod subroutine QSat (T, p, qs, es, qsdT, esdT) ! ! !DESCRIPTION: - ! Computes saturation mixing ratio and (optionally) the change in saturation - ! mixing ratio with respect to temperature. + ! Computes saturation mixing ratio and (optionally) the change in saturation mixing + ! ratio with respect to temperature. Mixing ratio and specific humidity are + ! approximately equal and can be treated as the same. ! Reference: Polynomial approximations from: ! Piotr J. Flatau, et al.,1992: Polynomial fits to saturation ! vapor pressure. Journal of Applied Meteorology, 31, 1507-1513. @@ -86,9 +87,7 @@ subroutine QSat (T, p, qs, es, qsdT, esdT) real(r8) :: td,vp,vp1,vp2 !----------------------------------------------------------------------- - td = T - SHR_CONST_TKFRZ - if (td > 100.0_r8) td=100.0_r8 - if (td < -75.0_r8) td=-75.0_r8 + td = min(100.0_r8, max(-75.0_r8, T - SHR_CONST_TKFRZ)) if (td >= 0.0_r8) then es_local = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & From 0b7aa8a0f750bb4651c522db95fdc3951e884e93 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 23 Apr 2020 18:18:09 -0600 Subject: [PATCH 1225/1973] Extend CNFireMethodMod with a FATESFireData class Following @ekluzek's recommendations in #982. Purpose: Allow FATES access to CTSM's infrastructure that reads lightning and human population data sets for use in SPITFIRE. --- bld/CLMBuildNamelist.pm | 3 + bld/namelist_files/namelist_defaults_ctsm.xml | 7 +- .../namelist_definition_ctsm.xml | 6 +- src/biogeochem/CNFireFactoryMod.F90 | 40 ++++ src/biogeochem/FATESFireDataMod.F90 | 176 +++++++++++++++++ src/biogeochem/FATESFireNoDataMod.F90 | 177 ++++++++++++++++++ src/main/clm_driver.F90 | 18 +- src/main/clm_initializeMod.F90 | 22 ++- src/main/clm_instMod.F90 | 15 +- src/main/controlMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 27 ++- 11 files changed, 482 insertions(+), 11 deletions(-) create mode 100644 src/biogeochem/FATESFireDataMod.F90 create mode 100644 src/biogeochem/FATESFireNoDataMod.F90 diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 32f2bdd255..1f8157c512 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -956,6 +956,9 @@ sub setup_cmdl_fire_light_res { } else { $nl_flags->{$var} = ".false."; } + if ( $nl_flags->{'use_fates_spitfire'} > 1 ) { + $nl_flags->{$var} = ".true."; + } } #------------------------------------------------------------------------------- diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 2474b64dd3..8a09f0ef01 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1173,14 +1173,19 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 none 94x192 94x192 +360x720 0001 0001 +0001 +0001 atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc +atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc bilinear +nn nn nn @@ -2726,7 +2731,7 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 .false. -.false. +0 .false. .false. .false. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 75734bb3e2..1b4df0b22a 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -635,9 +635,9 @@ Toggle to turn on the FATES model Switch deciding which nutrient model to use in FATES. - -Toggle to turn on spitfire module for modeling fire (only relevant if FATES is being used). + +Turn on spitfire module for modeling fire (only relevant if FATES is being used) by setting > 0. Values of 1, 2, and 3 correspond to no external inputs, external lightning data, and external confirmed ignition data, respectively. shr_kind_r8, CL => shr_kind_CL + use shr_log_mod, only: errmsg => shr_log_errMsg + use abortutils, only: endrun + use clm_varctl, only: iulog + use decompMod, only: bounds_type + use CNFireMethodMod, only: cnfire_method_type + use CNFireBaseMod, only: cnfire_base_type + ! + implicit none + private + ! + ! !PUBLIC TYPES: + public :: fates_fire_data_type + ! + type, extends(cnfire_base_type) :: fates_fire_data_type + ! !PRIVATE MEMBER DATA: + real(r8), public, pointer :: lnfm24(:) ! Daily avg lightning by grid cell (#/km2/hr) + contains + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: InitAccBuffer ! Initialize accumulation processes + procedure, public :: InitAccVars ! Initialize accumulation variables + procedure, public :: UpdateAccVars ! Update/extract accumulations vars + + end type fates_fire_data_type + + character(len=*), parameter, private :: sourcefile = __FILE__ + ! + ! !PRIVATE MEMBER DATA: + !----------------------------------------------------------------------- + + interface fates_fire_data_type + ! initialize a new cnfire_base object + module procedure constructor + end interface fates_fire_data_type + !----------------------------------------------------------------------- + +contains + + !------------------------------------------------------------------------ + type(fates_fire_data_type) function constructor() + ! + ! !DESCRIPTION: + ! Creates an object of type fates_fire_data_type + ! !ARGUMENTS: + constructor%need_lightning_and_popdens = .true. + end function constructor + + !----------------------------------------------------------------------- + subroutine InitAccBuffer (this, bounds) + ! + ! !DESCRIPTION: + ! Initialize accumulation buffer for all required module accumulated fields + ! This routine set defaults values that are then overwritten by the + ! restart file for restart or branch runs + ! + ! !USES + use clm_varcon, only : spval + use accumulMod, only : init_accum_field + ! + ! !ARGUMENTS: + class(fates_fire_data_type) :: this + type(bounds_type), intent(in) :: bounds + + ! !LOCAL VARIABLES: + integer :: begg, endg + integer :: ier + !--------------------------------------------------------------------- + + begg = bounds%begg; endg = bounds%endg + + allocate(this%lnfm24(begg:endg), stat=ier) + if (ier/=0) then + call endrun(msg="allocation error for lnfm24"//& + errmsg(sourcefile, __LINE__)) + endif + this%lnfm24(:) = spval + call init_accum_field (name='lnfm24', units='strikes/km2/hr', & + desc='24hr average of lightning strikes', accum_type='runmean', & + accum_period=-1, subgrid_type='gridcell', numlev=1, init_value=0._r8) + + end subroutine InitAccBuffer + + !----------------------------------------------------------------------- + subroutine InitAccVars(this, bounds) + ! + ! !DESCRIPTION: + ! Initialize module variables that are associated with + ! time accumulated fields. This routine is called for both an initial run + ! and a restart run (and must therefore must be called after the restart + ! file is read in and the accumulation buffer is obtained) + ! + ! !USES + use accumulMod , only : extract_accum_field + use clm_time_manager , only : get_nstep + ! + ! !ARGUMENTS: + class(fates_fire_data_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: begg, endg + integer :: nstep + integer :: ier + real(r8), pointer :: rbufslg(:) ! temporary + !--------------------------------------------------------------------- + + begg = bounds%begg; endg = bounds%endg + + ! Allocate needed dynamic memory for single level patch field + allocate(rbufslg(begg:endg), stat=ier) + if (ier/=0) then + call endrun(msg="allocation error for rbufslg"//& + errmsg(sourcefile, __LINE__)) + endif + + ! Determine time step + nstep = get_nstep() + + call extract_accum_field ('lnfm24', rbufslg, nstep) + this%lnfm24(begg:endg) = rbufslg(begg:endg) + + deallocate(rbufslg) + + end subroutine InitAccVars + + !----------------------------------------------------------------------- + subroutine UpdateAccVars (this, bounds) + ! + ! USES + use clm_time_manager, only: get_nstep + use accumulMod, only: update_accum_field, extract_accum_field + use abortutils, only: endrun + ! + ! !ARGUMENTS: + class(fates_fire_data_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: dtime ! timestep size [seconds] + integer :: nstep ! timestep number + integer :: ier ! error status + integer :: begg, endg + real(r8), pointer :: rbufslg(:) ! temporary single level - gridcell level + !--------------------------------------------------------------------- + + begg = bounds%begg; endg = bounds%endg + + nstep = get_nstep() + + ! Allocate needed dynamic memory for single level gridcell field + + allocate(rbufslg(begg:endg), stat=ier) + if (ier/=0) then + write(iulog,*)'UpdateAccVars allocation error for rbuf1dg' + call endrun(msg=errmsg(sourcefile, __LINE__)) + endif + + ! Accumulate and extract lnfm24 + rbufslg(begg:endg) = this%forc_lnfm(begg:endg) + call update_accum_field ('lnfm24', rbufslg, nstep) + call extract_accum_field ('lnfm24', this%lnfm24, nstep) + + deallocate(rbufslg) + + end subroutine UpdateAccVars + +end module FATESFireDataMod diff --git a/src/biogeochem/FATESFireNoDataMod.F90 b/src/biogeochem/FATESFireNoDataMod.F90 new file mode 100644 index 0000000000..2603a7981d --- /dev/null +++ b/src/biogeochem/FATESFireNoDataMod.F90 @@ -0,0 +1,177 @@ +module FATESFireNoDataMod + +#include "shr_assert.h" + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! module for FATES when not obtaining fire inputs from data + ! + ! !USES: + use shr_kind_mod, only: r8 => shr_kind_r8, CL => shr_kind_CL + use shr_log_mod, only: errmsg => shr_log_errMsg + use abortutils, only: endrun + use clm_varctl, only: iulog + use decompMod, only: bounds_type + use CNFireMethodMod, only: cnfire_method_type + use CNFireBaseMod, only: cnfire_base_type + ! + implicit none + private + ! + ! !PUBLIC TYPES: + public :: fates_fire_no_data_type + ! + type, extends(cnfire_base_type) :: fates_fire_no_data_type + ! !PRIVATE MEMBER DATA: + real(r8), public, pointer :: lnfm24(:) ! Daily avg lightning by grid cell (#/km2/hr) + contains + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: InitAccBuffer ! Initialize accumulation processes + procedure, public :: InitAccVars ! Initialize accumulation variables + procedure, public :: UpdateAccVars ! Update/extract accumulations vars + + end type fates_fire_no_data_type + + character(len=*), parameter, private :: sourcefile = __FILE__ + ! + ! !PRIVATE MEMBER DATA: + !----------------------------------------------------------------------- + + interface fates_fire_no_data_type + ! initialize a new cnfire_base object + module procedure constructor + end interface fates_fire_no_data_type + !----------------------------------------------------------------------- + +contains + + !------------------------------------------------------------------------ + type(fates_fire_no_data_type) function constructor() + ! + ! !DESCRIPTION: + ! Creates an object of type fates_fire_no_data_type + ! !ARGUMENTS: + constructor%need_lightning_and_popdens = .true. + end function constructor + + !----------------------------------------------------------------------- + subroutine InitAccBuffer (this, bounds) + ! + ! !DESCRIPTION: + ! Initialize accumulation buffer for all required module accumulated fields + ! This routine set defaults values that are then overwritten by the + ! restart file for restart or branch runs + ! + ! !USES + use clm_varcon, only : spval + use accumulMod, only : init_accum_field + ! + ! !ARGUMENTS: + class(fates_fire_no_data_type) :: this + type(bounds_type), intent(in) :: bounds + + ! !LOCAL VARIABLES: + integer :: begg, endg + integer :: ier + !--------------------------------------------------------------------- + + begg = bounds%begg; endg = bounds%endg + + allocate(this%lnfm24(begg:endg), stat=ier) + if (ier/=0) then + call endrun(msg="allocation error for lnfm24"//& + errMsg(sourcefile, __LINE__)) + endif + this%lnfm24(:) = spval + call init_accum_field (name='lnfm24', units='strikes/km2/hr', & + desc='24hr average of lightning strikes', accum_type='runmean', & + accum_period=-1, subgrid_type='gridcell', numlev=1, init_value=0._r8) + + end subroutine InitAccBuffer + + !----------------------------------------------------------------------- + subroutine InitAccVars(this, bounds) + ! + ! !DESCRIPTION: + ! Initialize module variables that are associated with + ! time accumulated fields. This routine is called for both an initial run + ! and a restart run (and must therefore must be called after the restart + ! file is read in and the accumulation buffer is obtained) + ! + ! !USES + use accumulMod , only : extract_accum_field + use clm_time_manager , only : get_nstep + ! + ! !ARGUMENTS: + class(fates_fire_no_data_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: begg, endg + integer :: nstep + integer :: ier + real(r8), pointer :: rbufslg(:) ! temporary + !--------------------------------------------------------------------- + + begg = bounds%begg; endg = bounds%endg + + ! Allocate needed dynamic memory for single level patch field + allocate(rbufslg(begg:endg), stat=ier) + if (ier/=0) then + call endrun(msg="allocation error for rbufslg"//& + errMsg(sourcefile, __LINE__)) + endif + + ! Determine time step + nstep = get_nstep() + + call extract_accum_field ('lnfm24', rbufslg, nstep) + this%lnfm24(begg:endg) = rbufslg(begg:endg) + + deallocate(rbufslg) + + end subroutine InitAccVars + + !----------------------------------------------------------------------- + subroutine UpdateAccVars (this, bounds) + ! + ! USES + use clm_time_manager, only: get_nstep + use accumulMod, only: update_accum_field, extract_accum_field + use abortutils, only: endrun + use EDParamsMod, only: ED_val_nignitions + ! + ! !ARGUMENTS: + class(fates_fire_no_data_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: dtime ! timestep size [seconds] + integer :: nstep ! timestep number + integer :: ier ! error status + integer :: begg, endg + real(r8), pointer :: rbufslg(:) ! temporary single level - gridcell level + !--------------------------------------------------------------------- + + begg = bounds%begg; endg = bounds%endg + + nstep = get_nstep() + + ! Allocate needed dynamic memory for single level gridcell field + + allocate(rbufslg(begg:endg), stat=ier) + if (ier/=0) then + write(iulog,*)'UpdateAccVars allocation error for rbuf1dg' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + + ! Accumulate and extract lnfm24 + rbufslg(begg:endg) = ED_val_nignitions + call update_accum_field ('lnfm24', rbufslg, nstep) + call extract_accum_field ('lnfm24', this%lnfm24, nstep) + + deallocate(rbufslg) + + end subroutine UpdateAccVars + +end module FATESFireNoDataMod diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index d57499671d..721cbc1699 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -111,11 +111,15 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! ! !USES: use clm_time_manager , only : get_curr_date - use clm_varctl , only : use_lai_streams + use clm_varctl, only: use_lai_streams, use_fates_spitfire use SatellitePhenologyMod, only : lai_advance + use FATESFireNoDataMod, only: fates_fire_no_data_type + use FATESFireDataMod, only: fates_fire_data_type ! ! !ARGUMENTS: implicit none + type(fates_fire_data_type) :: fates_fire_data_inst + type(fates_fire_no_data_type) :: fates_fire_no_data_inst logical , intent(in) :: doalb ! true if time for surface albedo calc real(r8), intent(in) :: nextsw_cday ! calendar day for nstep+1 real(r8), intent(in) :: declinp1 ! declination angle for next time step @@ -398,6 +402,10 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro end if call bgc_vegetation_inst%InterpFileInputs(bounds_proc) call t_stopf('bgc_interp') + ! use_fates_spitfire is assigned an integer value in the namelist + ! see bld/namelist_files/namelist_definition_clm4_5.xml for details + else if (use_fates_spitfire > 1) then + call bgc_vegetation_inst%InterpFileInputs(bounds_proc) end if ! Get time varying urban data @@ -1261,6 +1269,14 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro temperature_inst%t_ref2m_patch, temperature_inst%t_soisno_col) end if + ! use_fates_spitfire is assigned an integer value in the namelist + ! see bld/namelist_files/namelist_definition_clm4_5.xml for details + if (use_fates_spitfire > 1) then + call fates_fire_data_inst%UpdateAccVars(bounds_proc) + else + call fates_fire_no_data_inst%UpdateAccVars(bounds_proc) + end if + call t_stopf('accum') end if diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 9a734b2b8d..35350d0baa 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -280,7 +280,7 @@ subroutine initialize2( ) use clm_varcon , only : spval use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn, use_fates - use clm_varctl , only : use_crop, ndep_from_cpl + use clm_varctl , only : use_crop, ndep_from_cpl, use_fates_spitfire use clm_varorb , only : eccen, mvelpp, lambm0, obliqr use clm_time_manager , only : get_step_size_real, get_curr_calday use clm_time_manager , only : get_curr_date, get_nstep, advance_timestep @@ -305,8 +305,12 @@ subroutine initialize2( ) use controlMod , only : NLFilename use clm_instMod , only : clm_fates use BalanceCheckMod , only : BalanceCheckInit + use FATESFireNoDataMod, only: fates_fire_no_data_type + use FATESFireDataMod, only: fates_fire_data_type ! - ! !ARGUMENTS + ! !ARGUMENTS + type(fates_fire_data_type) :: fates_fire_data_inst + type(fates_fire_no_data_type) :: fates_fire_no_data_inst ! ! !LOCAL VARIABLES: integer :: c,i,j,k,l,p! indices @@ -507,6 +511,10 @@ subroutine initialize2( ) if ( use_c13 .and. use_c13_timeseries ) then call C13_init_TimeSeries() end if + ! use_fates_spitfire is assigned an integer value in the namelist + ! see bld/namelist_files/namelist_definition_clm4_5.xml for details + else if (use_fates_spitfire > 1) then + call bgc_vegetation_inst%Init2(bounds_proc, NLFilename) else call SatellitePhenologyInit(bounds_proc) end if @@ -674,7 +682,15 @@ subroutine initialize2( ) call crop_inst%initAccVars(bounds_proc) end if - !------------------------------------------------------------ + ! use_fates_spitfire is assigned an integer value in the namelist + ! see bld/namelist_files/namelist_definition_clm4_5.xml for details + if (use_fates_spitfire > 1) then + call fates_fire_data_inst%initAccVars(bounds_proc) + else + call fates_fire_no_data_inst%initAccVars(bounds_proc) + end if + + !------------------------------------------------------------ ! Read monthly vegetation !------------------------------------------------------------ diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 74bc921b1e..80552926c0 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -184,7 +184,8 @@ end subroutine clm_instReadNML subroutine clm_instInit(bounds) ! ! !USES: - use clm_varpar , only : nlevsno + use clm_varpar , only : nlevsno, numpft + use clm_varctl , only : use_fates_spitfire use controlMod , only : nlfilename, fsurdat use domainMod , only : ldomain use SoilBiogeochemDecompCascadeBGCMod , only : init_decompcascade_bgc @@ -197,9 +198,13 @@ subroutine clm_instInit(bounds) use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve use decompMod , only : get_proc_bounds use BalanceCheckMod , only : GetBalanceCheckSkipSteps + use FATESFireNoDataMod, only: fates_fire_no_data_type + use FATESFireDataMod, only: fates_fire_data_type ! ! !ARGUMENTS type(bounds_type), intent(in) :: bounds ! processor bounds + type(fates_fire_data_type) :: fates_fire_data_inst + type(fates_fire_no_data_type) :: fates_fire_no_data_inst ! ! !LOCAL VARIABLES: integer :: c,l,g @@ -462,6 +467,14 @@ subroutine clm_instInit(bounds) call crop_inst%InitAccBuffer(bounds) end if + ! use_fates_spitfire is assigned an integer value in the namelist + ! see bld/namelist_files/namelist_definition_clm4_5.xml for details + if (use_fates_spitfire > 1) then + call fates_fire_data_inst%InitAccBuffer(bounds) + else + call fates_fire_no_data_inst%InitAccBuffer(bounds) + end if + call print_accum_fields() call ncd_pio_closefile(params_ncid) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 1ee2fda0da..c912fde132 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -713,7 +713,7 @@ subroutine control_spmd() call mpi_bcast (use_fates, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_fates_spitfire, 1, MPI_LOGICAL, 0, mpicom, ier) + call mpi_bcast (use_fates_spitfire, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (use_fates_logging, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_planthydro, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_cohort_age_tracking, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 6601d00001..3cf8eaeda7 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -137,6 +137,7 @@ module CLMFatesInterfaceMod use FatesPlantHydraulicsMod, only : HydrSiteColdStart use FatesPlantHydraulicsMod, only : InitHydrSites use FatesPlantHydraulicsMod, only : RestartHydrStates + use CNFireMethodMod, only: cnfire_method_type implicit none @@ -177,6 +178,9 @@ module CLMFatesInterfaceMod ! fates_restart is the inteface calss for restarting the model type(fates_restart_interface_type) :: fates_restart + ! fates_fire_data_method determines the fire data passed from HLM to FATES + class(cnfire_method_type), allocatable :: fates_fire_data_method + contains procedure, public :: init @@ -385,7 +389,9 @@ subroutine init(this, bounds_proc ) use FatesInterfaceTypesMod, only : numpft_fates => numpft use FatesParameterDerivedMod, only : param_derived use subgridMod, only : natveg_patch_exists - use clm_instur , only : wt_nat_patch + use clm_instur , only : wt_nat_patch + use CNFireFactoryMod, only: create_fates_fire_data_method + implicit none ! Input Arguments @@ -569,6 +575,10 @@ subroutine init(this, bounds_proc ) ! Report Fates Parameters (debug flag in lower level routines) call FatesReportParameters(masterproc) + ! Fire data to send to FATES + allocate(this%fates_fire_data_method, & + source=create_fates_fire_data_method()) + end subroutine init ! =================================================================================== @@ -619,6 +629,10 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! ed_driver is not a hlm_fates_inst_type procedure because we need an extra step ! to process array bounding information + ! !USES + use FATESFireNoDataMod, only: fates_fire_no_data_type + use FATESFireDataMod, only: fates_fire_data_type + implicit none class(hlm_fates_interface_type), intent(inout) :: this type(bounds_type),intent(in) :: bounds_clump @@ -633,8 +647,12 @@ subroutine dynamics_driv(this, nc, bounds_clump, & type(canopystate_type) , intent(inout) :: canopystate_inst type(soilbiogeochem_carbonflux_type), intent(inout) :: soilbiogeochem_carbonflux_inst + type(fates_fire_data_type) :: fates_fire_data_inst + type(fates_fire_no_data_type) :: fates_fire_no_data_inst + ! !LOCAL VARIABLES: integer :: s ! site index + integer :: g ! grid-cell index (HLM) integer :: c ! column index (HLM) integer :: ifp ! patch index integer :: p ! HLM patch index @@ -686,6 +704,13 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s=1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) + g = col%gridcell(c) + + if (use_fates_spitfire > 1) then + this%fates(nc)%bc_in(s)%lightning24 = fates_fire_data_inst%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day + else + this%fates(nc)%bc_in(s)%lightning24 = fates_fire_no_data_inst%lnfm24(g) / days_per_year ! #/km2/yr to #/km2/day + end if nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil From 2336a24a76bd5a6fd4939facca92985bc7182f06 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sun, 26 Apr 2020 18:30:26 -0600 Subject: [PATCH 1226/1973] Revisions based on code review by @ekluzek --- bld/namelist_files/namelist_defaults_ctsm.xml | 1 + bld/namelist_files/namelist_definition_ctsm.xml | 5 ++++- src/biogeochem/FATESFireNoDataMod.F90 | 9 +++++++-- src/main/clm_driver.F90 | 12 ++++-------- src/main/clm_initializeMod.F90 | 12 ++++-------- src/main/clm_instMod.F90 | 12 ++++-------- src/utils/clmfates_interfaceMod.F90 | 12 +++++------- 7 files changed, 29 insertions(+), 34 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 8a09f0ef01..fffe43963d 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1173,6 +1173,7 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 none 94x192 94x192 +360x720 360x720 0001 diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 1b4df0b22a..920dbf7f1f 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -637,7 +637,10 @@ Switch deciding which nutrient model to use in FATES. -Turn on spitfire module for modeling fire (only relevant if FATES is being used) by setting > 0. Values of 1, 2, and 3 correspond to no external inputs, external lightning data, and external confirmed ignition data, respectively. +Turn on spitfire module to simulate fire by setting use_fates_spitfire > 0. +Relevant only if use_fates = .true.. Values of 1, 2, and 3 correspond to +no external inputs, external lightning data, and external confirmed ignition +data, respectively. 1) then - call fates_fire_data_inst%UpdateAccVars(bounds_proc) - else - call fates_fire_no_data_inst%UpdateAccVars(bounds_proc) + if (use_fates_spitfire > 0) then + call cnfire_method_inst%UpdateAccVars(bounds_proc) end if call t_stopf('accum') diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 35350d0baa..4a6ea4326a 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -305,12 +305,10 @@ subroutine initialize2( ) use controlMod , only : NLFilename use clm_instMod , only : clm_fates use BalanceCheckMod , only : BalanceCheckInit - use FATESFireNoDataMod, only: fates_fire_no_data_type - use FATESFireDataMod, only: fates_fire_data_type + use CNFireMethodMod, only: cnfiremethod_type ! ! !ARGUMENTS - type(fates_fire_data_type) :: fates_fire_data_inst - type(fates_fire_no_data_type) :: fates_fire_no_data_inst + type(cnfire_method_type) :: cnfire_method_inst ! ! !LOCAL VARIABLES: integer :: c,i,j,k,l,p! indices @@ -684,10 +682,8 @@ subroutine initialize2( ) ! use_fates_spitfire is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - if (use_fates_spitfire > 1) then - call fates_fire_data_inst%initAccVars(bounds_proc) - else - call fates_fire_no_data_inst%initAccVars(bounds_proc) + if (use_fates_spitfire > 0) then + call cnfire_method_inst%initAccVars(bounds_proc) end if !------------------------------------------------------------ diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 80552926c0..3a7063d825 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -198,13 +198,11 @@ subroutine clm_instInit(bounds) use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve use decompMod , only : get_proc_bounds use BalanceCheckMod , only : GetBalanceCheckSkipSteps - use FATESFireNoDataMod, only: fates_fire_no_data_type - use FATESFireDataMod, only: fates_fire_data_type + use CNFireMethodMod, only: cnfire_method_type ! ! !ARGUMENTS type(bounds_type), intent(in) :: bounds ! processor bounds - type(fates_fire_data_type) :: fates_fire_data_inst - type(fates_fire_no_data_type) :: fates_fire_no_data_inst + type(cnfire_method_type) :: cnfire_method_inst ! ! !LOCAL VARIABLES: integer :: c,l,g @@ -469,10 +467,8 @@ subroutine clm_instInit(bounds) ! use_fates_spitfire is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - if (use_fates_spitfire > 1) then - call fates_fire_data_inst%InitAccBuffer(bounds) - else - call fates_fire_no_data_inst%InitAccBuffer(bounds) + if (use_fates_spitfire > 0) then + call cnfire_method_inst%InitAccBuffer(bounds) end if call print_accum_fields() diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 3cf8eaeda7..d10707c5c9 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -630,8 +630,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! to process array bounding information ! !USES - use FATESFireNoDataMod, only: fates_fire_no_data_type - use FATESFireDataMod, only: fates_fire_data_type + use CNFireMethodMod, only: cnfire_method_type implicit none class(hlm_fates_interface_type), intent(inout) :: this @@ -647,8 +646,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & type(canopystate_type) , intent(inout) :: canopystate_inst type(soilbiogeochem_carbonflux_type), intent(inout) :: soilbiogeochem_carbonflux_inst - type(fates_fire_data_type) :: fates_fire_data_inst - type(fates_fire_no_data_type) :: fates_fire_no_data_inst + type(cnfire_method_type) :: cnfire_method_inst ! !LOCAL VARIABLES: integer :: s ! site index @@ -706,10 +704,10 @@ subroutine dynamics_driv(this, nc, bounds_clump, & c = this%f2hmap(nc)%fcolumn(s) g = col%gridcell(c) - if (use_fates_spitfire > 1) then - this%fates(nc)%bc_in(s)%lightning24 = fates_fire_data_inst%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day + if (use_fates_spitfire > 0) then + this%fates(nc)%bc_in(s)%lightning24 = cnfire_method_inst%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day else - this%fates(nc)%bc_in(s)%lightning24 = fates_fire_no_data_inst%lnfm24(g) / days_per_year ! #/km2/yr to #/km2/day + this%fates(nc)%bc_in(s)%lightning24 = 0.0_r8 end if nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil From c53979d9bdf143647ef613b1dada01ef5cfa8c38 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 29 Apr 2020 16:01:56 -0600 Subject: [PATCH 1227/1973] Revisions part 2 based on comments by @ekluzek @jkshuman @lmkueppers --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- src/biogeochem/FATESFireNoDataMod.F90 | 79 ++----------------- src/main/clm_driver.F90 | 6 +- src/main/clm_initializeMod.F90 | 6 +- src/main/clm_instMod.F90 | 6 +- src/utils/clmfates_interfaceMod.F90 | 5 +- 6 files changed, 15 insertions(+), 89 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index fffe43963d..4de23f46db 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1186,7 +1186,7 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc bilinear -nn +bilinear nn nn diff --git a/src/biogeochem/FATESFireNoDataMod.F90 b/src/biogeochem/FATESFireNoDataMod.F90 index c863383da4..7fa805cf89 100644 --- a/src/biogeochem/FATESFireNoDataMod.F90 +++ b/src/biogeochem/FATESFireNoDataMod.F90 @@ -22,8 +22,9 @@ module FATESFireNoDataMod public :: fates_fire_no_data_type ! type, extends(cnfire_base_type) :: fates_fire_no_data_type + ! !PRIVATE MEMBER DATA: - real(r8), public, pointer :: lnfm24(:) ! Daily avg lightning by grid cell (#/km2/hr) + contains ! !PUBLIC MEMBER FUNCTIONS: procedure, public :: InitAccBuffer ! Initialize accumulation processes @@ -58,34 +59,20 @@ end function constructor subroutine InitAccBuffer (this, bounds) ! ! !DESCRIPTION: + ! EMPTY subroutine for the no_data case. ! Initialize accumulation buffer for all required module accumulated fields ! This routine set defaults values that are then overwritten by the ! restart file for restart or branch runs ! ! !USES - use clm_varcon, only : spval - use accumulMod, only : init_accum_field ! ! !ARGUMENTS: class(fates_fire_no_data_type) :: this type(bounds_type), intent(in) :: bounds ! !LOCAL VARIABLES: - integer :: begg, endg - integer :: ier !--------------------------------------------------------------------- - begg = bounds%begg; endg = bounds%endg - - allocate(this%lnfm24(begg:endg), stat=ier) - if (ier/=0) then - call endrun(msg="allocation error for lnfm24"//& - errMsg(sourcefile, __LINE__)) - endif - this%lnfm24(:) = spval - call init_accum_field (name='lnfm24', units='strikes/km2/hr', & - desc='24hr average of lightning strikes', accum_type='runmean', & - accum_period=-1, subgrid_type='gridcell', numlev=1, init_value=0._r8) end subroutine InitAccBuffer @@ -93,89 +80,39 @@ end subroutine InitAccBuffer subroutine InitAccVars(this, bounds) ! ! !DESCRIPTION: + ! EMPTY subroutine for the no_data case. ! Initialize module variables that are associated with ! time accumulated fields. This routine is called for both an initial run ! and a restart run (and must therefore must be called after the restart ! file is read in and the accumulation buffer is obtained) ! ! !USES - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep ! ! !ARGUMENTS: class(fates_fire_no_data_type) :: this type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: - integer :: begg, endg - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslg(:) ! temporary !--------------------------------------------------------------------- - begg = bounds%begg; endg = bounds%endg - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslg(begg:endg), stat=ier) - if (ier/=0) then - call endrun(msg="allocation error for rbufslg"//& - errMsg(sourcefile, __LINE__)) - endif - - ! Determine time step - nstep = get_nstep() - - call extract_accum_field ('lnfm24', rbufslg, nstep) - this%lnfm24(begg:endg) = rbufslg(begg:endg) - - deallocate(rbufslg) end subroutine InitAccVars !----------------------------------------------------------------------- subroutine UpdateAccVars (this, bounds) ! - ! USES - use clm_time_manager, only: get_nstep - use clm_time_manager, only: get_days_per_year - use accumulMod, only: update_accum_field, extract_accum_field - use abortutils, only: endrun - use EDParamsMod, only: ED_val_nignitions + ! !DESCRIPTION: + ! EMPTY subroutine for the no_data case. + ! + ! !USES ! ! !ARGUMENTS: class(fates_fire_no_data_type) :: this type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: days_per_year - integer :: ier ! error status - integer :: begg, endg - real(r8), pointer :: rbufslg(:) ! temporary single level - gridcell level !--------------------------------------------------------------------- - begg = bounds%begg; endg = bounds%endg - - nstep = get_nstep() - - ! Allocate needed dynamic memory for single level gridcell field - - allocate(rbufslg(begg:endg), stat=ier) - if (ier/=0) then - write(iulog,*)'UpdateAccVars allocation error for rbuf1dg' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - days_per_year = get_days_per_year() - - ! Accumulate and extract lnfm24 - ! Convert #/km2/yr to #/km2/hr to match lnfm from datasets - rbufslg(begg:endg) = ED_val_nignitions / (days_per_year * 24._r8) - call update_accum_field ('lnfm24', rbufslg, nstep) - call extract_accum_field ('lnfm24', this%lnfm24, nstep) - - deallocate(rbufslg) end subroutine UpdateAccVars diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 627b024ef9..6c353a2539 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1267,11 +1267,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro temperature_inst%t_ref2m_patch, temperature_inst%t_soisno_col) end if - ! use_fates_spitfire is assigned an integer value in the namelist - ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - if (use_fates_spitfire > 0) then - call cnfire_method_inst%UpdateAccVars(bounds_proc) - end if + call cnfire_method_inst%UpdateAccVars(bounds_proc) call t_stopf('accum') end if diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 4a6ea4326a..a1b8a436c4 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -680,11 +680,7 @@ subroutine initialize2( ) call crop_inst%initAccVars(bounds_proc) end if - ! use_fates_spitfire is assigned an integer value in the namelist - ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - if (use_fates_spitfire > 0) then - call cnfire_method_inst%initAccVars(bounds_proc) - end if + call cnfire_method_inst%initAccVars(bounds_proc) !------------------------------------------------------------ ! Read monthly vegetation diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 3a7063d825..81a0ccd6ba 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -465,11 +465,7 @@ subroutine clm_instInit(bounds) call crop_inst%InitAccBuffer(bounds) end if - ! use_fates_spitfire is assigned an integer value in the namelist - ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - if (use_fates_spitfire > 0) then - call cnfire_method_inst%InitAccBuffer(bounds) - end if + call cnfire_method_inst%InitAccBuffer(bounds) call print_accum_fields() diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index d10707c5c9..f924ae3136 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -631,6 +631,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! !USES use CNFireMethodMod, only: cnfire_method_type + use EDParamsMod, only: ED_val_nignitions implicit none class(hlm_fates_interface_type), intent(inout) :: this @@ -704,10 +705,10 @@ subroutine dynamics_driv(this, nc, bounds_clump, & c = this%f2hmap(nc)%fcolumn(s) g = col%gridcell(c) - if (use_fates_spitfire > 0) then + if (use_fates_spitfire > 1) then this%fates(nc)%bc_in(s)%lightning24 = cnfire_method_inst%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day else - this%fates(nc)%bc_in(s)%lightning24 = 0.0_r8 + this%fates(nc)%bc_in(s)%lightning24 = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day end if nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil From d4d6094cc46f27aa52024abf71cba18c70eed142 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 29 Apr 2020 17:44:32 -0600 Subject: [PATCH 1228/1973] Revisions part 3 based on @ekluzek's review --- src/biogeochem/FATESFireDataMod.F90 | 61 +++++++++++++++++++++++++++ src/biogeochem/FATESFireNoDataMod.F90 | 61 +++++++++++++++++++++++++++ src/main/clm_driver.F90 | 2 +- src/main/clm_initializeMod.F90 | 2 +- src/main/clm_instMod.F90 | 1 - src/utils/clmfates_interfaceMod.F90 | 2 +- 6 files changed, 125 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/FATESFireDataMod.F90 b/src/biogeochem/FATESFireDataMod.F90 index 12c2b5cabb..96d1bd0ffe 100644 --- a/src/biogeochem/FATESFireDataMod.F90 +++ b/src/biogeochem/FATESFireDataMod.F90 @@ -29,6 +29,8 @@ module FATESFireDataMod procedure, public :: InitAccBuffer ! Initialize accumulation processes procedure, public :: InitAccVars ! Initialize accumulation variables procedure, public :: UpdateAccVars ! Update/extract accumulations vars + procedure, public :: InterpFileInputs ! Interpolate inputs from files + procedure, public :: Init2 ! Initialization after determining subgrid weights end type fates_fire_data_type @@ -173,4 +175,63 @@ subroutine UpdateAccVars (this, bounds) end subroutine UpdateAccVars + !----------------------------------------------------------------------- + subroutine InterpFileInputs(this, bounds) + ! + ! !DESCRIPTION: + ! Interpolate inputs from files + ! + ! NOTE(wjs, 2016-02-23) Stuff done here could probably be done at the end of + ! InitEachTimeStep, rather than in this separate routine, except for the + ! fact that + ! (currently) this Interp stuff is done with proc bounds rather thna clump + ! bounds. I + ! think that is needed so that you don't update a given stream multiple + ! times. If we + ! rework the handling of threading / clumps so that there is a separate + ! object for + ! each clump, then I think this problem would disappear - at which point we + ! could + ! remove this Interp routine, moving its body to the end of + ! InitEachTimeStep. + ! + ! !USES: + ! + ! !ARGUMENTS: + class(cnfire_method_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'InterpFileInputs' + !----------------------------------------------------------------------- + + call this%cnfire_method%CNFireInterp(bounds) + + end subroutine InterpFileInputs + + !----------------------------------------------------------------------- + subroutine Init2(this, bounds, NLFilename) + ! + ! !DESCRIPTION: + ! Initialization after subgrid weights are determined + ! + ! This copy should only be called if use_fates is .true. + ! + ! !USES: + ! + ! !ARGUMENTS: + class(cnfire_method_type) , intent(inout) :: this + type(bounds_type) , intent(in) :: bounds + character(len=*) , intent(in) :: NLFilename ! namelist filename + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'Init2' + !----------------------------------------------------------------------- + + call this%cnfire_method%CNFireInit(bounds, NLFilename) + + end subroutine Init2 + end module FATESFireDataMod diff --git a/src/biogeochem/FATESFireNoDataMod.F90 b/src/biogeochem/FATESFireNoDataMod.F90 index 7fa805cf89..0420b17539 100644 --- a/src/biogeochem/FATESFireNoDataMod.F90 +++ b/src/biogeochem/FATESFireNoDataMod.F90 @@ -30,6 +30,8 @@ module FATESFireNoDataMod procedure, public :: InitAccBuffer ! Initialize accumulation processes procedure, public :: InitAccVars ! Initialize accumulation variables procedure, public :: UpdateAccVars ! Update/extract accumulations vars + procedure, public :: InterpFileInputs ! Interpolate inputs from files + procedure, public :: Init2 ! Initialization after determining subgrid weights end type fates_fire_no_data_type @@ -116,4 +118,63 @@ subroutine UpdateAccVars (this, bounds) end subroutine UpdateAccVars + !----------------------------------------------------------------------- + subroutine InterpFileInputs(this, bounds) + ! + ! !DESCRIPTION: + ! EMPTY subroutine for the no_data case. + ! Interpolate inputs from files + ! + ! NOTE(wjs, 2016-02-23) Stuff done here could probably be done at the end of + ! InitEachTimeStep, rather than in this separate routine, except for the + ! fact that + ! (currently) this Interp stuff is done with proc bounds rather thna clump + ! bounds. I + ! think that is needed so that you don't update a given stream multiple + ! times. If we + ! rework the handling of threading / clumps so that there is a separate + ! object for + ! each clump, then I think this problem would disappear - at which point we + ! could + ! remove this Interp routine, moving its body to the end of + ! InitEachTimeStep. + ! + ! !USES: + ! + ! !ARGUMENTS: + class(cnfire_method_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'InterpFileInputs' + !----------------------------------------------------------------------- + + + end subroutine InterpFileInputs + + !----------------------------------------------------------------------- + subroutine Init2(this, bounds, NLFilename) + ! + ! !DESCRIPTION: + ! EMPTY subroutine for the no_data case. + ! Initialization after subgrid weights are determined + ! + ! This copy should only be called if use_fates is .true. + ! + ! !USES: + ! + ! !ARGUMENTS: + class(cnfire_method_type) , intent(inout) :: this + type(bounds_type) , intent(in) :: bounds + character(len=*) , intent(in) :: NLFilename ! namelist filename + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'Init2' + !----------------------------------------------------------------------- + + + end subroutine Init2 + end module FATESFireNoDataMod diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 6c353a2539..62d134225f 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -403,7 +403,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! use_fates_spitfire is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details else if (use_fates_spitfire > 1) then - call bgc_vegetation_inst%InterpFileInputs(bounds_proc) + call cnfire_method_inst%InterpFileInputs(bounds_proc) end if ! Get time varying urban data diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index a1b8a436c4..bb12f12ef7 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -512,7 +512,7 @@ subroutine initialize2( ) ! use_fates_spitfire is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details else if (use_fates_spitfire > 1) then - call bgc_vegetation_inst%Init2(bounds_proc, NLFilename) + call cnfire_method_inst%Init2(bounds_proc, NLFilename) else call SatellitePhenologyInit(bounds_proc) end if diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 81a0ccd6ba..0adc522264 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -185,7 +185,6 @@ subroutine clm_instInit(bounds) ! ! !USES: use clm_varpar , only : nlevsno, numpft - use clm_varctl , only : use_fates_spitfire use controlMod , only : nlfilename, fsurdat use domainMod , only : ldomain use SoilBiogeochemDecompCascadeBGCMod , only : init_decompcascade_bgc diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index f924ae3136..b9748e9d49 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -703,9 +703,9 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s=1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - g = col%gridcell(c) if (use_fates_spitfire > 1) then + g = col%gridcell(c) this%fates(nc)%bc_in(s)%lightning24 = cnfire_method_inst%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day else this%fates(nc)%bc_in(s)%lightning24 = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day From 3653aeefff490a98cab4a73c1c9e0ca08e49150b Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 7 May 2020 16:13:53 -0600 Subject: [PATCH 1229/1973] Move InterpFileInputs and Init2 to clmfates_interfaceMod Removed from FATESFire[No]DataMod. Added to clmfates_interfaceMod. Updated calls in clm_driver and clm_initialize. --- src/biogeochem/FATESFireDataMod.F90 | 61 --------------------------- src/biogeochem/FATESFireNoDataMod.F90 | 61 --------------------------- src/main/clm_driver.F90 | 2 +- src/main/clm_initializeMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 61 +++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 124 deletions(-) diff --git a/src/biogeochem/FATESFireDataMod.F90 b/src/biogeochem/FATESFireDataMod.F90 index 96d1bd0ffe..12c2b5cabb 100644 --- a/src/biogeochem/FATESFireDataMod.F90 +++ b/src/biogeochem/FATESFireDataMod.F90 @@ -29,8 +29,6 @@ module FATESFireDataMod procedure, public :: InitAccBuffer ! Initialize accumulation processes procedure, public :: InitAccVars ! Initialize accumulation variables procedure, public :: UpdateAccVars ! Update/extract accumulations vars - procedure, public :: InterpFileInputs ! Interpolate inputs from files - procedure, public :: Init2 ! Initialization after determining subgrid weights end type fates_fire_data_type @@ -175,63 +173,4 @@ subroutine UpdateAccVars (this, bounds) end subroutine UpdateAccVars - !----------------------------------------------------------------------- - subroutine InterpFileInputs(this, bounds) - ! - ! !DESCRIPTION: - ! Interpolate inputs from files - ! - ! NOTE(wjs, 2016-02-23) Stuff done here could probably be done at the end of - ! InitEachTimeStep, rather than in this separate routine, except for the - ! fact that - ! (currently) this Interp stuff is done with proc bounds rather thna clump - ! bounds. I - ! think that is needed so that you don't update a given stream multiple - ! times. If we - ! rework the handling of threading / clumps so that there is a separate - ! object for - ! each clump, then I think this problem would disappear - at which point we - ! could - ! remove this Interp routine, moving its body to the end of - ! InitEachTimeStep. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cnfire_method_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InterpFileInputs' - !----------------------------------------------------------------------- - - call this%cnfire_method%CNFireInterp(bounds) - - end subroutine InterpFileInputs - - !----------------------------------------------------------------------- - subroutine Init2(this, bounds, NLFilename) - ! - ! !DESCRIPTION: - ! Initialization after subgrid weights are determined - ! - ! This copy should only be called if use_fates is .true. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cnfire_method_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! namelist filename - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init2' - !----------------------------------------------------------------------- - - call this%cnfire_method%CNFireInit(bounds, NLFilename) - - end subroutine Init2 - end module FATESFireDataMod diff --git a/src/biogeochem/FATESFireNoDataMod.F90 b/src/biogeochem/FATESFireNoDataMod.F90 index 0420b17539..7fa805cf89 100644 --- a/src/biogeochem/FATESFireNoDataMod.F90 +++ b/src/biogeochem/FATESFireNoDataMod.F90 @@ -30,8 +30,6 @@ module FATESFireNoDataMod procedure, public :: InitAccBuffer ! Initialize accumulation processes procedure, public :: InitAccVars ! Initialize accumulation variables procedure, public :: UpdateAccVars ! Update/extract accumulations vars - procedure, public :: InterpFileInputs ! Interpolate inputs from files - procedure, public :: Init2 ! Initialization after determining subgrid weights end type fates_fire_no_data_type @@ -118,63 +116,4 @@ subroutine UpdateAccVars (this, bounds) end subroutine UpdateAccVars - !----------------------------------------------------------------------- - subroutine InterpFileInputs(this, bounds) - ! - ! !DESCRIPTION: - ! EMPTY subroutine for the no_data case. - ! Interpolate inputs from files - ! - ! NOTE(wjs, 2016-02-23) Stuff done here could probably be done at the end of - ! InitEachTimeStep, rather than in this separate routine, except for the - ! fact that - ! (currently) this Interp stuff is done with proc bounds rather thna clump - ! bounds. I - ! think that is needed so that you don't update a given stream multiple - ! times. If we - ! rework the handling of threading / clumps so that there is a separate - ! object for - ! each clump, then I think this problem would disappear - at which point we - ! could - ! remove this Interp routine, moving its body to the end of - ! InitEachTimeStep. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cnfire_method_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InterpFileInputs' - !----------------------------------------------------------------------- - - - end subroutine InterpFileInputs - - !----------------------------------------------------------------------- - subroutine Init2(this, bounds, NLFilename) - ! - ! !DESCRIPTION: - ! EMPTY subroutine for the no_data case. - ! Initialization after subgrid weights are determined - ! - ! This copy should only be called if use_fates is .true. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cnfire_method_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! namelist filename - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init2' - !----------------------------------------------------------------------- - - - end subroutine Init2 - end module FATESFireNoDataMod diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 62d134225f..f3d4c76885 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -403,7 +403,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! use_fates_spitfire is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details else if (use_fates_spitfire > 1) then - call cnfire_method_inst%InterpFileInputs(bounds_proc) + call clm_fates%InterpFileInputs(bounds_proc) end if ! Get time varying urban data diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index bb12f12ef7..2451db111d 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -512,7 +512,7 @@ subroutine initialize2( ) ! use_fates_spitfire is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details else if (use_fates_spitfire > 1) then - call cnfire_method_inst%Init2(bounds_proc, NLFilename) + call clm_fates%Init2(bounds_proc, NLFilename) else call SatellitePhenologyInit(bounds_proc) end if diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index b9748e9d49..141b190f31 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -196,6 +196,8 @@ module CLMFatesInterfaceMod procedure, public :: wrap_canopy_radiation procedure, public :: wrap_bgc_summary procedure, public :: TransferZ0mDisp + procedure, public :: InterpFileInputs ! Interpolate inputs from files + procedure, public :: Init2 ! Initialization after determining subgrid weights procedure, private :: init_history_io procedure, private :: wrap_update_hlmfates_dyn procedure, private :: init_soil_depths @@ -2025,6 +2027,65 @@ subroutine TransferZ0mDisp(this, bounds_clump, z0m_patch, displa_patch) return end subroutine TransferZ0mDisp + !----------------------------------------------------------------------- + subroutine InterpFileInputs(this, bounds) + ! + ! !DESCRIPTION: + ! Interpolate inputs from files + ! + ! NOTE(wjs, 2016-02-23) Stuff done here could probably be done at the end of + ! InitEachTimeStep, rather than in this separate routine, except for the + ! fact that + ! (currently) this Interp stuff is done with proc bounds rather thna clump + ! bounds. I + ! think that is needed so that you don't update a given stream multiple + ! times. If we + ! rework the handling of threading / clumps so that there is a separate + ! object for + ! each clump, then I think this problem would disappear - at which point we + ! could + ! remove this Interp routine, moving its body to the end of + ! InitEachTimeStep. + ! + ! !USES: + ! + ! !ARGUMENTS: + class(cnfire_method_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'InterpFileInputs' + !----------------------------------------------------------------------- + + call this%cnfire_method%CNFireInterp(bounds) + + end subroutine InterpFileInputs + + !----------------------------------------------------------------------- + subroutine Init2(this, bounds, NLFilename) + ! + ! !DESCRIPTION: + ! Initialization after subgrid weights are determined + ! + ! This copy should only be called if use_fates is .true. + ! + ! !USES: + ! + ! !ARGUMENTS: + class(cnfire_method_type) , intent(inout) :: this + type(bounds_type) , intent(in) :: bounds + character(len=*) , intent(in) :: NLFilename ! namelist filename + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'Init2' + !----------------------------------------------------------------------- + + call this%cnfire_method%CNFireInit(bounds, NLFilename) + + end subroutine Init2 + ! ====================================================================================== subroutine init_history_io(this,bounds_proc) From 1b3871f9d00824fdf9d7f4488d2d94a65e7e1790 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 7 May 2020 16:27:01 -0600 Subject: [PATCH 1230/1973] Added if (use_cn) around reading/interpolating population density ...since FATES only needs lightning for now. --- src/biogeochem/CNFireBaseMod.F90 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 91a60d5f0c..52fdd35fb0 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -116,6 +116,7 @@ subroutine CNFireInit( this, bounds, NLFilename ) ! Initialize CN Fire module ! !USES: use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) + use clm_varctl , only : use_cn ! ! !ARGUMENTS: class(cnfire_base_type) :: this @@ -131,8 +132,11 @@ subroutine CNFireInit( this, bounds, NLFilename ) allocate( this%forc_hdm(bounds%begg:bounds%endg) ) this%forc_hdm(bounds%begg:) = nan - call this%hdm_init(bounds, NLFilename) - call this%hdm_interp(bounds) + if (use_cn) then + call this%hdm_init(bounds, NLFilename) + call this%hdm_interp(bounds) + end if + call this%lnfm_init(bounds, NLFilename) call this%lnfm_interp(bounds) end if @@ -250,13 +254,18 @@ subroutine CNFireInterp(this,bounds) ! !DESCRIPTION: ! Interpolate CN Fire datasets ! + ! !USES: + use clm_varctl, only: use_cn + ! ! !ARGUMENTS: class(cnfire_base_type) :: this type(bounds_type), intent(in) :: bounds !----------------------------------------------------------------------- if ( this%need_lightning_and_popdens ) then - call this%hdm_interp(bounds) + if (use_cn) then + call this%hdm_interp(bounds) + end if call this%lnfm_interp(bounds) end if From 5cb716dba3050005dd3049889146338b25372af2 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 7 May 2020 18:43:17 -0600 Subject: [PATCH 1231/1973] Corrections that reduce the number of compilation errors to two --- src/main/clm_driver.F90 | 2 -- src/main/clm_instMod.F90 | 5 +++-- src/utils/clmfates_interfaceMod.F90 | 17 +++++++---------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index f3d4c76885..c38a03517c 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -113,11 +113,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro use clm_time_manager , only : get_curr_date use clm_varctl, only: use_lai_streams, use_fates_spitfire use SatellitePhenologyMod, only : lai_advance - use CNFireMethodMod, only: cnfire_method_type ! ! !ARGUMENTS: implicit none - type(cnfire_method_type) :: cnfire_method_inst logical , intent(in) :: doalb ! true if time for surface albedo calc real(r8), intent(in) :: nextsw_cday ! calendar day for nstep+1 real(r8), intent(in) :: declinp1 ! declination angle for next time step diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 0adc522264..d205de96d6 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -66,6 +66,7 @@ module clm_instMod use HumanIndexMod , only : humanindex_type use VOCEmissionMod , only : vocemis_type use CNFireEmissionsMod , only : fireemis_type + use CNFireMethodMod , only : cnfire_method_type use atm2lndType , only : atm2lnd_type use lnd2atmType , only : lnd2atm_type use lnd2glcMod , only : lnd2glc_type @@ -153,6 +154,8 @@ module clm_instMod type(vocemis_type) , public :: vocemis_inst type(fireemis_type) , public :: fireemis_inst type(drydepvel_type), public :: drydepvel_inst + type(cnfire_method_type), public :: cnfire_method_inst + ! FATES type(hlm_fates_interface_type), public :: clm_fates @@ -197,11 +200,9 @@ subroutine clm_instInit(bounds) use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve use decompMod , only : get_proc_bounds use BalanceCheckMod , only : GetBalanceCheckSkipSteps - use CNFireMethodMod, only: cnfire_method_type ! ! !ARGUMENTS type(bounds_type), intent(in) :: bounds ! processor bounds - type(cnfire_method_type) :: cnfire_method_inst ! ! !LOCAL VARIABLES: integer :: c,l,g diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 141b190f31..b998dd0764 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -632,7 +632,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! to process array bounding information ! !USES - use CNFireMethodMod, only: cnfire_method_type use EDParamsMod, only: ED_val_nignitions implicit none @@ -649,8 +648,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & type(canopystate_type) , intent(inout) :: canopystate_inst type(soilbiogeochem_carbonflux_type), intent(inout) :: soilbiogeochem_carbonflux_inst - type(cnfire_method_type) :: cnfire_method_inst - ! !LOCAL VARIABLES: integer :: s ! site index integer :: g ! grid-cell index (HLM) @@ -708,7 +705,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & if (use_fates_spitfire > 1) then g = col%gridcell(c) - this%fates(nc)%bc_in(s)%lightning24 = cnfire_method_inst%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day + this%fates(nc)%bc_in(s)%lightning24 = this%fates_fire_data_method%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day else this%fates(nc)%bc_in(s)%lightning24 = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day end if @@ -2050,7 +2047,7 @@ subroutine InterpFileInputs(this, bounds) ! !USES: ! ! !ARGUMENTS: - class(cnfire_method_type), intent(inout) :: this + class(hlm_fates_interface_type), intent(inout) :: this type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: @@ -2058,7 +2055,7 @@ subroutine InterpFileInputs(this, bounds) character(len=*), parameter :: subname = 'InterpFileInputs' !----------------------------------------------------------------------- - call this%cnfire_method%CNFireInterp(bounds) + call this%fates_fire_data_method%CNFireInterp(bounds) end subroutine InterpFileInputs @@ -2073,16 +2070,16 @@ subroutine Init2(this, bounds, NLFilename) ! !USES: ! ! !ARGUMENTS: - class(cnfire_method_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! namelist filename + class(hlm_fates_interface_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + character(len=*), intent(in) :: NLFilename ! namelist filename ! ! !LOCAL VARIABLES: character(len=*), parameter :: subname = 'Init2' !----------------------------------------------------------------------- - call this%cnfire_method%CNFireInit(bounds, NLFilename) + call this%fates_fire_data_method%CNFireInit(bounds, NLFilename) end subroutine Init2 From af1641b5fd66c86a2cbc1872d0e16470225aab64 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 8 May 2020 12:16:13 -0600 Subject: [PATCH 1232/1973] Corrections for the code to compile --- src/main/clm_driver.F90 | 11 ++++++++--- src/main/clm_initializeMod.F90 | 8 +++++--- src/main/clm_instMod.F90 | 9 +++++---- src/utils/clmfates_interfaceMod.F90 | 11 +++++++---- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index c38a03517c..6606fde8e3 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -111,8 +111,10 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! ! !USES: use clm_time_manager , only : get_curr_date - use clm_varctl, only: use_lai_streams, use_fates_spitfire + use clm_varctl , only : use_lai_streams, use_fates_spitfire use SatellitePhenologyMod, only : lai_advance + use FATESFireNoDataMod , only : fates_fire_no_data_type + use FATESFireDataMod , only : fates_fire_data_type ! ! !ARGUMENTS: implicit none @@ -123,6 +125,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro logical, intent(in) :: rstwr ! true => write restart file this step logical, intent(in) :: nlend ! true => end of run on this step character(len=*),intent(in) :: rdate ! restart file time stamp for name + type(fates_fire_no_data_type) :: fates_fire_no_data_inst + type(fates_fire_data_type) :: fates_fire_data_inst ! Whether we're running with a prognostic ROF component. This shouldn't change from ! timestep to timestep, but we pass it into the driver loop because it isn't available @@ -1010,7 +1014,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call clm_fates%dynamics_driv( nc, bounds_clump, & atm2lnd_inst, soilstate_inst, temperature_inst, active_layer_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & - water_inst%wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst) + water_inst%wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst & + frictionvel_inst) ! TODO(wjs, 2016-04-01) I think this setFilters call should be replaced by a ! call to reweight_wrapup, if it's needed at all. @@ -1265,7 +1270,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro temperature_inst%t_ref2m_patch, temperature_inst%t_soisno_col) end if - call cnfire_method_inst%UpdateAccVars(bounds_proc) + call fates_fire_data_inst%UpdateAccVars(bounds_proc) call t_stopf('accum') end if diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 2451db111d..b5e2017c23 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -305,10 +305,12 @@ subroutine initialize2( ) use controlMod , only : NLFilename use clm_instMod , only : clm_fates use BalanceCheckMod , only : BalanceCheckInit - use CNFireMethodMod, only: cnfiremethod_type + use FATESFireNoDataMod , only : fates_fire_no_data_type + use FATESFireDataMod , only : fates_fire_data_type ! ! !ARGUMENTS - type(cnfire_method_type) :: cnfire_method_inst + type(fates_fire_no_data_type) :: fates_fire_no_data_inst + type(fates_fire_data_type) :: fates_fire_data_inst ! ! !LOCAL VARIABLES: integer :: c,i,j,k,l,p! indices @@ -680,7 +682,7 @@ subroutine initialize2( ) call crop_inst%initAccVars(bounds_proc) end if - call cnfire_method_inst%initAccVars(bounds_proc) + call fates_fire_data_inst%initAccVars(bounds_proc) !------------------------------------------------------------ ! Read monthly vegetation diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index d205de96d6..3262991513 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -66,7 +66,6 @@ module clm_instMod use HumanIndexMod , only : humanindex_type use VOCEmissionMod , only : vocemis_type use CNFireEmissionsMod , only : fireemis_type - use CNFireMethodMod , only : cnfire_method_type use atm2lndType , only : atm2lnd_type use lnd2atmType , only : lnd2atm_type use lnd2glcMod , only : lnd2glc_type @@ -154,8 +153,6 @@ module clm_instMod type(vocemis_type) , public :: vocemis_inst type(fireemis_type) , public :: fireemis_inst type(drydepvel_type), public :: drydepvel_inst - type(cnfire_method_type), public :: cnfire_method_inst - ! FATES type(hlm_fates_interface_type), public :: clm_fates @@ -200,9 +197,13 @@ subroutine clm_instInit(bounds) use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve use decompMod , only : get_proc_bounds use BalanceCheckMod , only : GetBalanceCheckSkipSteps + use FATESFireNoDataMod , only : fates_fire_no_data_type + use FATESFireDataMod , only : fates_fire_data_type ! ! !ARGUMENTS type(bounds_type), intent(in) :: bounds ! processor bounds + type(fates_fire_no_data_type) :: fates_fire_no_data_inst + type(fates_fire_data_type) :: fates_fire_data_inst ! ! !LOCAL VARIABLES: integer :: c,l,g @@ -465,7 +466,7 @@ subroutine clm_instInit(bounds) call crop_inst%InitAccBuffer(bounds) end if - call cnfire_method_inst%InitAccBuffer(bounds) + call fates_fire_data_inst%InitAccBuffer(bounds) call print_accum_fields() diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index b998dd0764..8d651e14d4 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -622,9 +622,9 @@ end subroutine check_hlm_active ! ------------------------------------------------------------------------------------ subroutine dynamics_driv(this, nc, bounds_clump, & - atm2lnd_inst, soilstate_inst, temperature_inst, & - active_layer_inst, & - waterstatebulk_inst, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst) + atm2lnd_inst, soilstate_inst, temperature_inst, active_layer_inst, & + waterstatebulk_inst, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + canopystate_inst, soilbiogeochem_carbonflux_inst, frictionvel_inst) ! This wrapper is called daily from clm_driver ! This wrapper calls ed_driver, which is the daily dynamics component of FATES @@ -633,6 +633,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! !USES use EDParamsMod, only: ED_val_nignitions + use FATESFireDataMod, only: fates_fire_data_type implicit none class(hlm_fates_interface_type), intent(inout) :: this @@ -647,6 +648,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, & type(wateratm2lndbulk_type) , intent(inout) :: wateratm2lndbulk_inst type(canopystate_type) , intent(inout) :: canopystate_inst type(soilbiogeochem_carbonflux_type), intent(inout) :: soilbiogeochem_carbonflux_inst + type(frictionvel_type) , intent(inout) :: frictionvel_inst + type(fates_fire_data_type) :: fates_fire_data_inst ! !LOCAL VARIABLES: integer :: s ! site index @@ -705,7 +708,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & if (use_fates_spitfire > 1) then g = col%gridcell(c) - this%fates(nc)%bc_in(s)%lightning24 = this%fates_fire_data_method%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day + this%fates(nc)%bc_in(s)%lightning24 = fates_fire_data_inst%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day else this%fates(nc)%bc_in(s)%lightning24 = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day end if From 737487a6f6ad1f613ebe115b0d525ebfb530feed Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 8 May 2020 14:49:54 -0600 Subject: [PATCH 1233/1973] Changes needed so that fates_fire_data_method is local to clmfates_interface These are the changes that I see that are needed to keep fates_fire_data_method local to clmfates_interface. Whenever fates_fire_data is accessed it has to be done through clmfates_interface, because that's the object that contains it and has it instantiated. We also will want it to be private to clmfates_interface, so it can't be accessed or changed outside of there. There were some stubs here to pass specific instances of the class types before, but they weren't completed. So those are all removed and the generic method is being accessed so that you don't have to know which specific instance is being used. Testing: I haven't tested it yet. But, will before pushing --- src/main/clm_driver.F90 | 8 ++--- src/main/clm_initializeMod.F90 | 8 ++--- src/main/clm_instMod.F90 | 8 ++--- src/utils/clmfates_interfaceMod.F90 | 48 +++++++++++++++++++++++++++-- 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 6606fde8e3..a1fba14146 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -113,8 +113,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro use clm_time_manager , only : get_curr_date use clm_varctl , only : use_lai_streams, use_fates_spitfire use SatellitePhenologyMod, only : lai_advance - use FATESFireNoDataMod , only : fates_fire_no_data_type - use FATESFireDataMod , only : fates_fire_data_type ! ! !ARGUMENTS: implicit none @@ -125,8 +123,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro logical, intent(in) :: rstwr ! true => write restart file this step logical, intent(in) :: nlend ! true => end of run on this step character(len=*),intent(in) :: rdate ! restart file time stamp for name - type(fates_fire_no_data_type) :: fates_fire_no_data_inst - type(fates_fire_data_type) :: fates_fire_data_inst ! Whether we're running with a prognostic ROF component. This shouldn't change from ! timestep to timestep, but we pass it into the driver loop because it isn't available @@ -1270,7 +1266,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro temperature_inst%t_ref2m_patch, temperature_inst%t_soisno_col) end if - call fates_fire_data_inst%UpdateAccVars(bounds_proc) + if(use_fates) then + call clm_fates%UpdateAccVars(bounds_proc) + end if call t_stopf('accum') end if diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index b5e2017c23..c47c64a13c 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -305,12 +305,8 @@ subroutine initialize2( ) use controlMod , only : NLFilename use clm_instMod , only : clm_fates use BalanceCheckMod , only : BalanceCheckInit - use FATESFireNoDataMod , only : fates_fire_no_data_type - use FATESFireDataMod , only : fates_fire_data_type ! ! !ARGUMENTS - type(fates_fire_no_data_type) :: fates_fire_no_data_inst - type(fates_fire_data_type) :: fates_fire_data_inst ! ! !LOCAL VARIABLES: integer :: c,i,j,k,l,p! indices @@ -682,7 +678,9 @@ subroutine initialize2( ) call crop_inst%initAccVars(bounds_proc) end if - call fates_fire_data_inst%initAccVars(bounds_proc) + if ( use_fates )then + call clm_fates%initAccVars(bounds_proc) + end if !------------------------------------------------------------ ! Read monthly vegetation diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 3262991513..07fb44d011 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -197,13 +197,9 @@ subroutine clm_instInit(bounds) use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve use decompMod , only : get_proc_bounds use BalanceCheckMod , only : GetBalanceCheckSkipSteps - use FATESFireNoDataMod , only : fates_fire_no_data_type - use FATESFireDataMod , only : fates_fire_data_type ! ! !ARGUMENTS type(bounds_type), intent(in) :: bounds ! processor bounds - type(fates_fire_no_data_type) :: fates_fire_no_data_inst - type(fates_fire_data_type) :: fates_fire_data_inst ! ! !LOCAL VARIABLES: integer :: c,l,g @@ -466,7 +462,9 @@ subroutine clm_instInit(bounds) call crop_inst%InitAccBuffer(bounds) end if - call fates_fire_data_inst%InitAccBuffer(bounds) + if (use_fates) then + call clm_fates%InitAccBuffer(bounds) + end if call print_accum_fields() diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 8d651e14d4..1cabe33f0f 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -198,6 +198,8 @@ module CLMFatesInterfaceMod procedure, public :: TransferZ0mDisp procedure, public :: InterpFileInputs ! Interpolate inputs from files procedure, public :: Init2 ! Initialization after determining subgrid weights + procedure, public :: InitAccBuffer ! Initialize any accumulation variables + procedure, public :: UpdateAccVars ! Update any accumulation variables procedure, private :: init_history_io procedure, private :: wrap_update_hlmfates_dyn procedure, private :: init_soil_depths @@ -633,7 +635,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! !USES use EDParamsMod, only: ED_val_nignitions - use FATESFireDataMod, only: fates_fire_data_type implicit none class(hlm_fates_interface_type), intent(inout) :: this @@ -649,7 +650,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & type(canopystate_type) , intent(inout) :: canopystate_inst type(soilbiogeochem_carbonflux_type), intent(inout) :: soilbiogeochem_carbonflux_inst type(frictionvel_type) , intent(inout) :: frictionvel_inst - type(fates_fire_data_type) :: fates_fire_data_inst ! !LOCAL VARIABLES: integer :: s ! site index @@ -708,7 +708,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & if (use_fates_spitfire > 1) then g = col%gridcell(c) - this%fates(nc)%bc_in(s)%lightning24 = fates_fire_data_inst%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day + this%fates(nc)%bc_in(s)%lightning24 = this%fates_fire_data_method%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day else this%fates(nc)%bc_in(s)%lightning24 = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day end if @@ -2086,6 +2086,48 @@ subroutine Init2(this, bounds, NLFilename) end subroutine Init2 + !----------------------------------------------------------------------- + subroutine InitAccBuffer(this, bounds) + ! + ! !DESCRIPTION: + ! Initialized any accumulation variables needed for FATES + ! + ! !USES: + ! + ! !ARGUMENTS: + class(hlm_fates_interface_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'InitAccBuffer' + !----------------------------------------------------------------------- + + call this%fates_fire_data_method%InitAccBuffer( bounds ) + + end subroutine InitAccBuffer + + !----------------------------------------------------------------------- + subroutine UpdateAccVars(this, bounds) + ! + ! !DESCRIPTION: + ! Update any accumulation variables needed for FATES + ! + ! !USES: + ! + ! !ARGUMENTS: + class(hlm_fates_interface_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'UpdateAccVars' + !----------------------------------------------------------------------- + + call this%fates_fire_data_method%UpdateAccVars( bounds ) + + end subroutine UpdateAccVars + ! ====================================================================================== subroutine init_history_io(this,bounds_proc) From 5eced0c9e2131dc9fd17324131e9be7be031a725 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 8 May 2020 15:32:59 -0600 Subject: [PATCH 1234/1973] Update to Sam's FATES branch for the lightning reading --- Externals_CLM.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 71cbe69a29..331c344e5a 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -1,8 +1,8 @@ [fates] local_path = src/fates protocol = git -repo_url = https://github.com/NGEET/fates -tag = sci.1.36.0_api.11.2.0 +repo_url = https://github.com/slevisconsulting/fates +branch = lightning_v2_fates required = True [PTCLM] From f959daad137a8a89af295d1da09510d4d2f7d80c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 8 May 2020 15:56:49 -0600 Subject: [PATCH 1235/1973] Make lnfm24 data private add an get method for it Make the lnfm24 data private to inside of FATES_FireData object and add an accessor for it. The accessor gets the pointer, so there's no time spent on copying although using a pointer this way also means you can screw up the data outside of the object. But, it seems fairly well constrained so I don't know that's a problem. This is still not compiling because there needs to be a FATES interface to the object that has the FATES specific new methods that have been added. --- src/biogeochem/FATESFireDataMod.F90 | 17 ++++++++++++++++- src/biogeochem/FATESFireNoDataMod.F90 | 15 +++++++++++++++ src/utils/clmfates_interfaceMod.F90 | 7 +++++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/FATESFireDataMod.F90 b/src/biogeochem/FATESFireDataMod.F90 index 12c2b5cabb..d1d6b07763 100644 --- a/src/biogeochem/FATESFireDataMod.F90 +++ b/src/biogeochem/FATESFireDataMod.F90 @@ -23,9 +23,10 @@ module FATESFireDataMod ! type, extends(cnfire_base_type) :: fates_fire_data_type ! !PRIVATE MEMBER DATA: - real(r8), public, pointer :: lnfm24(:) ! Daily avg lightning by grid cell (#/km2/hr) + real(r8), private, pointer :: lnfm24(:) ! Daily avg lightning by grid cell (#/km2/hr) contains ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: GetLight24 ! Return 24-hour averaged lightning data procedure, public :: InitAccBuffer ! Initialize accumulation processes procedure, public :: InitAccVars ! Initialize accumulation variables procedure, public :: UpdateAccVars ! Update/extract accumulations vars @@ -54,6 +55,20 @@ type(fates_fire_data_type) function constructor() constructor%need_lightning_and_popdens = .true. end function constructor + !----------------------------------------------------------------------- + function GetLight24( this ) result(lnfm24) + ! + ! !DESCRIPTION: Get the 24-hour averaged lightning data + ! !USES + ! + ! !ARGUMENTS: + class(fates_fire_data_type) :: this + real(r8), pointer :: lnfm24(:) + !--------------------------------------------------------------------- + lnfm24 => this%lnfm24 + !--------------------------------------------------------------------- + end function + !----------------------------------------------------------------------- subroutine InitAccBuffer (this, bounds) ! diff --git a/src/biogeochem/FATESFireNoDataMod.F90 b/src/biogeochem/FATESFireNoDataMod.F90 index 7fa805cf89..2101ae6a05 100644 --- a/src/biogeochem/FATESFireNoDataMod.F90 +++ b/src/biogeochem/FATESFireNoDataMod.F90 @@ -27,6 +27,7 @@ module FATESFireNoDataMod contains ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: GetLight24 ! Return the 24-hour averaged lightning data procedure, public :: InitAccBuffer ! Initialize accumulation processes procedure, public :: InitAccVars ! Initialize accumulation variables procedure, public :: UpdateAccVars ! Update/extract accumulations vars @@ -55,6 +56,20 @@ type(fates_fire_no_data_type) function constructor() constructor%need_lightning_and_popdens = .false. end function constructor + !----------------------------------------------------------------------- + function GetLight24( this ) result(lnfm24) + ! + ! !DESCRIPTION: Get the 24-hour averaged lightning data + ! !USES + ! + ! !ARGUMENTS: + class(fates_fire_no_data_type) :: this + real(r8), pointer :: lnfm24(:) + !--------------------------------------------------------------------- + call endrun( "GetLight24 should NOT be called for the FATES No-Data case" ) + !--------------------------------------------------------------------- + end function + !----------------------------------------------------------------------- subroutine InitAccBuffer (this, bounds) ! diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 1cabe33f0f..ccfda0c505 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -673,6 +673,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: days_per_year real(r8) :: model_day real(r8) :: day_of_year + real(r8), pointer :: lnfm24(:) !----------------------------------------------------------------------- ! --------------------------------------------------------------------------------- @@ -701,14 +702,16 @@ subroutine dynamics_driv(this, nc, bounds_clump, & current_date, reference_date, & model_day, floor(day_of_year), & days_per_year, 1.0_r8/dble(days_per_year)) - + if (use_fates_spitfire > 1) then + lnfm24 = this%fates_fire_data_method%GetLight24() + end if do s=1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) if (use_fates_spitfire > 1) then g = col%gridcell(c) - this%fates(nc)%bc_in(s)%lightning24 = this%fates_fire_data_method%lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day + this%fates(nc)%bc_in(s)%lightning24 = lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day else this%fates(nc)%bc_in(s)%lightning24 = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day end if From 34aa9f493ff9ea934eb97a26829d1a410de225bb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 May 2020 13:11:14 -0600 Subject: [PATCH 1236/1973] Get everything consistent and building --- src/biogeochem/CNFireFactoryMod.F90 | 11 +++++---- src/biogeochem/FATESFireDataMod.F90 | 5 ++-- src/biogeochem/FATESFireNoDataMod.F90 | 6 ++--- src/main/clm_varctl.F90 | 3 +-- src/utils/clmfates_interfaceMod.F90 | 34 ++++++++++++++++++++++----- 5 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index 91f028373e..b172c5b5ed 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -125,7 +125,7 @@ end function create_cnfire_method !----------------------------------------------------------------------- !----------------------------------------------------------------------- - function create_fates_fire_data_method() result(fates_fire_data_method) + subroutine create_fates_fire_data_method( fates_fire_data_method ) ! ! !DESCRIPTION: ! Create and return an object of fates_fire_data_method_type. @@ -134,11 +134,12 @@ function create_fates_fire_data_method() result(fates_fire_data_method) ! !USES: use clm_varctl, only: use_fates_spitfire use CNFireMethodMod, only: cnfire_method_type + use FATESFireBase, only: fates_fire_base_type use FATESFireNoDataMod, only: fates_fire_no_data_type use FATESFireDataMod, only: fates_fire_data_type ! ! !ARGUMENTS: - class(cnfire_method_type), allocatable :: fates_fire_data_method ! function result + class(fates_fire_base_type), allocatable, intent(inout) :: fates_fire_data_method ! function result ! ! !LOCAL VARIABLES: integer :: current_case @@ -150,9 +151,9 @@ function create_fates_fire_data_method() result(fates_fire_data_method) select case (current_case) case (0:1) - allocate(fates_fire_data_method, source=fates_fire_no_data_type()) + allocate(fates_fire_no_data_type :: fates_fire_data_method) case (2:3) - allocate(fates_fire_data_method, source=fates_fire_data_type()) + allocate(fates_fire_data_type :: fates_fire_data_method) case default write(iulog,*) subname//' ERROR: unknown method: ', use_fates_spitfire @@ -160,6 +161,6 @@ function create_fates_fire_data_method() result(fates_fire_data_method) end select - end function create_fates_fire_data_method + end subroutine create_fates_fire_data_method end module CNFireFactoryMod diff --git a/src/biogeochem/FATESFireDataMod.F90 b/src/biogeochem/FATESFireDataMod.F90 index d1d6b07763..f545709376 100644 --- a/src/biogeochem/FATESFireDataMod.F90 +++ b/src/biogeochem/FATESFireDataMod.F90 @@ -12,8 +12,7 @@ module FATESFireDataMod use abortutils, only: endrun use clm_varctl, only: iulog use decompMod, only: bounds_type - use CNFireMethodMod, only: cnfire_method_type - use CNFireBaseMod, only: cnfire_base_type + use FatesFireBase, only: fates_fire_base_type ! implicit none private @@ -21,7 +20,7 @@ module FATESFireDataMod ! !PUBLIC TYPES: public :: fates_fire_data_type ! - type, extends(cnfire_base_type) :: fates_fire_data_type + type, extends(fates_fire_base_type) :: fates_fire_data_type ! !PRIVATE MEMBER DATA: real(r8), private, pointer :: lnfm24(:) ! Daily avg lightning by grid cell (#/km2/hr) contains diff --git a/src/biogeochem/FATESFireNoDataMod.F90 b/src/biogeochem/FATESFireNoDataMod.F90 index 2101ae6a05..10f7f57a68 100644 --- a/src/biogeochem/FATESFireNoDataMod.F90 +++ b/src/biogeochem/FATESFireNoDataMod.F90 @@ -12,8 +12,7 @@ module FATESFireNoDataMod use abortutils, only: endrun use clm_varctl, only: iulog use decompMod, only: bounds_type - use CNFireMethodMod, only: cnfire_method_type - use CNFireBaseMod, only: cnfire_base_type + use FatesFireBase, only: fates_fire_base_type ! implicit none private @@ -21,7 +20,8 @@ module FATESFireNoDataMod ! !PUBLIC TYPES: public :: fates_fire_no_data_type ! - type, extends(cnfire_base_type) :: fates_fire_no_data_type + type, extends(fates_fire_base_type) :: fates_fire_no_data_type + private ! !PRIVATE MEMBER DATA: diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 68752767f9..e67ed0d6f4 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -224,8 +224,7 @@ module clm_varctl integer, public :: fates_parteh_mode = -9 ! 1 => carbon only ! 2 => C+N+P (not enabled yet) ! no others enabled - - logical, public :: use_fates_spitfire = .false. ! true => use spitfire model + integer, public :: use_fates_spitfire = 0 ! > 1 => use spitfire model logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro logical, public :: use_fates_cohort_age_tracking = .false. ! true => turn on cohort age tracking diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index ccfda0c505..daf2377177 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -137,7 +137,7 @@ module CLMFatesInterfaceMod use FatesPlantHydraulicsMod, only : HydrSiteColdStart use FatesPlantHydraulicsMod, only : InitHydrSites use FatesPlantHydraulicsMod, only : RestartHydrStates - use CNFireMethodMod, only: cnfire_method_type + use FATESFireBase , only : fates_fire_base_type implicit none @@ -179,7 +179,7 @@ module CLMFatesInterfaceMod type(fates_restart_interface_type) :: fates_restart ! fates_fire_data_method determines the fire data passed from HLM to FATES - class(cnfire_method_type), allocatable :: fates_fire_data_method + class(fates_fire_base_type), allocatable :: fates_fire_data_method contains @@ -198,7 +198,8 @@ module CLMFatesInterfaceMod procedure, public :: TransferZ0mDisp procedure, public :: InterpFileInputs ! Interpolate inputs from files procedure, public :: Init2 ! Initialization after determining subgrid weights - procedure, public :: InitAccBuffer ! Initialize any accumulation variables + procedure, public :: InitAccBuffer ! Initialize any accumulation buffers + procedure, public :: InitAccVars ! Initialize any accumulation variables procedure, public :: UpdateAccVars ! Update any accumulation variables procedure, private :: init_history_io procedure, private :: wrap_update_hlmfates_dyn @@ -580,8 +581,7 @@ subroutine init(this, bounds_proc ) call FatesReportParameters(masterproc) ! Fire data to send to FATES - allocate(this%fates_fire_data_method, & - source=create_fates_fire_data_method()) + call create_fates_fire_data_method( this%fates_fire_data_method ) end subroutine init @@ -2093,7 +2093,7 @@ end subroutine Init2 subroutine InitAccBuffer(this, bounds) ! ! !DESCRIPTION: - ! Initialized any accumulation variables needed for FATES + ! Initialized any accumulation buffers needed for FATES ! ! !USES: ! @@ -2110,6 +2110,28 @@ subroutine InitAccBuffer(this, bounds) end subroutine InitAccBuffer + + !----------------------------------------------------------------------- + subroutine InitAccVars(this, bounds) + ! + ! !DESCRIPTION: + ! Initialized any accumulation variables needed for FATES + ! + ! !USES: + ! + ! !ARGUMENTS: + class(hlm_fates_interface_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'InitAccVars' + !----------------------------------------------------------------------- + + call this%fates_fire_data_method%InitAccVars( bounds ) + + end subroutine InitAccVars + !----------------------------------------------------------------------- subroutine UpdateAccVars(this, bounds) ! From a8f8fdf015d6e3f40831fcbdda2f7f845222d9fd Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 May 2020 13:19:00 -0600 Subject: [PATCH 1237/1973] Use integer value for use_fates_spitfire now --- cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm | 2 +- cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm | 2 +- cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm | 2 +- cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm | 2 +- cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm index 7c2892229b..a2facdeaa6 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm @@ -2,7 +2,7 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .true. -use_fates_spitfire= .true. +use_fates_spitfire= 1 hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN_ELEM','LITTER_OUT_ELEM', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','FIRE_FUEL_MEF', 'FIRE_FUEL_BULKD','FIRE_FUEL_SAV','FIRE_NESTEROV_INDEX','PFTbiomass', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm index a26b638268..7c2969a275 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm @@ -2,7 +2,7 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .false. -use_fates_spitfire= .true. +use_fates_spitfire= 1 hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE','GPP_BY_AGE','PARSUN_Z_CNLF','PARSHA_Z_CNLF','PARSUN_Z_CNLFPFT', 'PARSHA_Z_CNLFPFT','PARSUN_Z_CAN','PARSHA_Z_CAN','LAISUN_Z_CNLF','LAISHA_Z_CNLF','LAISUN_Z_CNLFPFT','LAISHA_Z_CNLFPFT', 'LAISUN_TOP_CAN','LAISHA_TOP_CAN','FABD_SUN_CNLFPFT','FABD_SHA_CNLFPFT','FABI_SUN_CNLFPFT','FABI_SHA_CNLFPFT', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm index 02b13dcd1d..5aea3a43ca 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm @@ -1,7 +1,7 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .true. -use_fates_spitfire= .true. +use_fates_spitfire= 1 hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','FIRE_FUEL_MEF', 'FIRE_FUEL_BULKD','FIRE_FUEL_SAV','FIRE_NESTEROV_INDEX','PFTbiomass', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm index dfdb775ec5..6cf2c7f70d 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm @@ -1 +1 @@ -use_fates_spitfire= .false. +use_fates_spitfire= 0 diff --git a/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm index e3a3b76d71..810eb19987 100644 --- a/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm @@ -1,2 +1,2 @@ -use_fates_spitfire = .true. +use_fates_spitfire = 1 From 9e227b38a6bbd8e1fbe6d586ec2d3be738935dfb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 May 2020 13:22:27 -0600 Subject: [PATCH 1238/1973] Add FATES fire base class --- src/biogeochem/FATESFireBase.F90 | 108 +++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 src/biogeochem/FATESFireBase.F90 diff --git a/src/biogeochem/FATESFireBase.F90 b/src/biogeochem/FATESFireBase.F90 new file mode 100644 index 0000000000..fc3f2bd4c5 --- /dev/null +++ b/src/biogeochem/FATESFireBase.F90 @@ -0,0 +1,108 @@ +module FATESFireBase + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Abstract base class for FATES fire data object + ! + ! !USES: + use CNFireBaseMod , only: cnfire_base_type + ! + implicit none + private + ! + ! !PUBLIC TYPES: + public :: fates_fire_base_type + ! + type, abstract, extends(cnfire_base_type) :: fates_fire_base_type + private + + ! !PRIVATE MEMBER DATA: + + contains + ! !PUBLIC MEMBER FUNCTIONS: + procedure(GetLight24_interface), public, deferred :: GetLight24 ! Return the 24-hour averaged lightning data + procedure(InitAccBuffer_interface), public, deferred :: InitAccBuffer ! Initialize accumulation processes + procedure(InitAccVars_interface), public, deferred :: InitAccVars ! Initialize accumulation variables + procedure(UpdateAccVars_interface), public, deferred :: UpdateAccVars ! Update/extract accumulations vars + + end type fates_fire_base_type + + abstract interface + !----------------------------------------------------------------------- + + !------------------------------------------------------------------------ + function GetLight24_interface( this ) result(lnfm24) + ! + ! !DESCRIPTION: Get the 24-hour averaged lightning data + ! !USES + use shr_kind_mod , only: r8 => shr_kind_r8 + import :: fates_fire_base_type + ! + ! !ARGUMENTS: + class(fates_fire_base_type) :: this + real(r8), pointer :: lnfm24(:) + !--------------------------------------------------------------------- + !--------------------------------------------------------------------- + end function GetLight24_interface + + !----------------------------------------------------------------------- + subroutine InitAccBuffer_interface (this, bounds) + ! + ! !DESCRIPTION: + ! Initialize the accumulation buffers + ! + ! !USES + use decompMod , only: bounds_type + import :: fates_fire_base_type + ! + ! !ARGUMENTS: + class(fates_fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + + ! !LOCAL VARIABLES: + !--------------------------------------------------------------------- + + end subroutine InitAccBuffer_interface + + !----------------------------------------------------------------------- + subroutine InitAccVars_interface(this, bounds) + ! + ! !DESCRIPTION: + ! Initialize the accumulation variables + ! + ! !USES + use decompMod , only: bounds_type + import :: fates_fire_base_type + ! + ! !ARGUMENTS: + class(fates_fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + !--------------------------------------------------------------------- + + end subroutine InitAccVars_interface + + !----------------------------------------------------------------------- + subroutine UpdateAccVars_interface (this, bounds) + ! + ! !DESCRIPTION: + ! Update accumulation variables + ! + ! !USES + use decompMod , only: bounds_type + import :: fates_fire_base_type + ! + ! !ARGUMENTS: + class(fates_fire_base_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + !--------------------------------------------------------------------- + + end subroutine UpdateAccVars_interface + + end interface + !--------------------------------------------------------------------- + +end module FATESFireBase From 9ae963bb99ac730a90837f92f324b65447f5a5d6 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 4 Jun 2020 16:46:10 -0600 Subject: [PATCH 1239/1973] Minor corrections for clm-fates to run with a lightning dataset --- bld/CLMBuildNamelist.pm | 36 +++++++++++++++++-- .../namelist_definition_ctsm.xml | 2 +- src/main/clm_initializeMod.F90 | 10 +++--- src/utils/clmfates_interfaceMod.F90 | 8 +++++ 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 1f8157c512..187927e3af 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -946,7 +946,7 @@ sub setup_cmdl_fire_light_res { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method'); } my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); - if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) ) { + if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) && ! &value_is_true($nl_flags->{'use_fates'}) ) { $log->fatal_error("fire_method is being set even though bgc is NOT cn or bgc."); } if ( defined($fire_method) && $fire_method eq "nofire" ) { @@ -3287,7 +3287,8 @@ sub setup_logic_lightning_streams { # lightning streams require CN/BGC my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - if ( &value_is_true($nl_flags->{'cnfireson'}) ) { +<<<<<<< HEAD + if ( &value_is_true($nl_flags->{'cnfireson'}) || &value_is_true($nl_flags->{'use_fates'}) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, 'hgrid'=>$nl_flags->{'res'}, 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); @@ -3300,6 +3301,37 @@ sub setup_logic_lightning_streams { # Set align year, if first and last years are different if ( $nl->get_value('stream_year_first_lightng') != $nl->get_value('stream_year_last_lightng') ) { +||||||| constructed merge base + if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { + if ( &value_is_true($nl_flags->{'cnfireson'}) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, + 'hgrid'=>$nl_flags->{'res'}, + 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + # Set align year, if first and last years are different + if ( $nl->get_value('stream_year_first_lightng') != + $nl->get_value('stream_year_last_lightng') ) { +======= + if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { + if ( &value_is_true($nl_flags->{'cnfireson'}) || &value_is_true($nl_flags->{'use_fates'}) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, + 'hgrid'=>$nl_flags->{'res'}, + 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + # Set align year, if first and last years are different + if ( $nl->get_value('stream_year_first_lightng') != + $nl->get_value('stream_year_last_lightng') ) { +>>>>>>> Minor corrections for clm-fates to run with a lightning dataset add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_lightng', 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); } diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 920dbf7f1f..5a4099c33c 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -198,7 +198,7 @@ formulation (1). + group="cnfire_inparm" valid_values="nofire,li2014qianfrc,li2016crufrc,spitfire" > The method type to use for CNFire nofire: Turn fire effects off diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index c47c64a13c..53019100c5 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -507,12 +507,14 @@ subroutine initialize2( ) if ( use_c13 .and. use_c13_timeseries ) then call C13_init_TimeSeries() end if - ! use_fates_spitfire is assigned an integer value in the namelist - ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - else if (use_fates_spitfire > 1) then - call clm_fates%Init2(bounds_proc, NLFilename) else call SatellitePhenologyInit(bounds_proc) + + ! use_fates_spitfire is assigned an integer value in the namelist + ! see bld/namelist_files/namelist_definition_clm4_5.xml for details + if (use_fates_spitfire > 1) then + call clm_fates%Init2(bounds_proc, NLFilename) + end if end if if(use_soil_moisture_streams) then diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index daf2377177..f50949cdb0 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -674,6 +674,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & real(r8) :: model_day real(r8) :: day_of_year real(r8), pointer :: lnfm24(:) + integer :: ier !----------------------------------------------------------------------- ! --------------------------------------------------------------------------------- @@ -702,7 +703,14 @@ subroutine dynamics_driv(this, nc, bounds_clump, & current_date, reference_date, & model_day, floor(day_of_year), & days_per_year, 1.0_r8/dble(days_per_year)) + if (use_fates_spitfire > 1) then + allocate(lnfm24(bounds_clump%begg:bounds_clump%endg), stat=ier) + if (ier /= 0) then + call endrun(msg="allocation error for lnfm24"//& + errmsg(sourcefile, __LINE__)) + endif + lnfm24 = this%fates_fire_data_method%GetLight24() end if From 35996d408d2043481e75664d8ef67c0495305bd6 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 5 Jun 2020 17:58:05 -0600 Subject: [PATCH 1240/1973] Additional conflicts resolved; revisions in response to rgknox's review Had to resolve conflicts that did not get caught by git. Did some cleanup recommended by rgknox in Friday's meeting. --- bld/CLMBuildNamelist.pm | 122 +++++++++++++----- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- .../namelist_definition_ctsm.xml | 4 +- bld/unit_testers/build-namelist_test.pl | 2 +- .../testmods_dirs/clm/Fates/user_nl_clm | 2 +- .../clm/FatesAllVars/user_nl_clm | 2 +- .../clm/FatesColdDef/user_nl_clm | 2 +- .../testmods_dirs/clm/FatesNoFire/user_nl_clm | 2 +- .../testmods_dirs/clm/fatesFire/user_nl_clm | 2 +- src/biogeochem/CNFireFactoryMod.F90 | 6 +- src/main/clm_driver.F90 | 6 +- src/main/clm_initializeMod.F90 | 6 +- src/main/clm_varctl.F90 | 2 +- src/main/controlMod.F90 | 6 +- src/utils/clmfates_interfaceMod.F90 | 20 ++- 15 files changed, 125 insertions(+), 61 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 187927e3af..143dcf93bc 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -768,7 +768,7 @@ sub setup_cmdl_fates_mode { } } else { # dis-allow fates specific namelist items with non-fates runs - my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", + my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", "use_fates_cohort_age_tracking", "use_fates_inventory_init","use_fates_fixed_biogeog", "fates_inventory_ctrl_filename","use_fates_logging","fates_parteh_mode" ); foreach my $var ( @list ) { @@ -917,6 +917,7 @@ sub setup_cmdl_fire_light_res { if ( defined($fire_method) && $val ne "none" ) { if ( $fire_method eq "nofire" ) { $log->fatal_error("-$var option used with fire_method='nofire'. -$var can ONLY be used without the nofire option"); +<<<<<<< HEAD } } my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') ); @@ -957,6 +958,91 @@ sub setup_cmdl_fire_light_res { $nl_flags->{$var} = ".false."; } if ( $nl_flags->{'use_fates_spitfire'} > 1 ) { +||||||| constructed merge base + } + } + my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') ); + if ( defined($stream_fldfilename_lightng) && $val ne "none" ) { + $log->fatal_error("-$var option used while also explicitly setting stream_fldfilename_lightng filename which is a contradiction. Use one or the other not both."); + } + if ( ! &value_is_true($nl->get_value('use_cn')) ) { + $log->fatal_error("-$var option used CN is NOT on. -$var can only be used when CN is on (with bgc: cn or bgc)"); + } + if ( &value_is_true($nl->get_value('use_cn')) && $val eq "none" ) { + $log->fatal_error("-$var option is set to none, but CN is on (with bgc: cn or bgc) which is a contradiction"); + } + $nl_flags->{$var} = $val; + } + my $group = $definition->get_group_name($var); + $nl->set_variable_value($group, $var, quote_string($nl_flags->{$var}) ); + if ( ! $definition->is_valid_value( $var, $nl_flags->{$var}, 'noquotes'=>1 ) ) { + my @valid_values = $definition->get_valid_values( $var ); + $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); + } + $log->verbose_message("Using $nl_flags->{$var} for $var."); + # + # Set flag if cn-fires are on or not + # + $var = "cnfireson"; + if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl->get_value('use_cn')) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method'); + } + my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); + if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) && ! &value_is_true($nl_flags->{'use_fates'}) ) { + $log->fatal_error("fire_method is being set even though bgc is NOT cn or bgc."); + } + if ( defined($fire_method) && $fire_method eq "nofire" ) { + $nl_flags->{$var} = ".false."; + } elsif ( &value_is_true($nl->get_value('use_cn')) ) { + $nl_flags->{$var} = ".true."; + } else { + $nl_flags->{$var} = ".false."; + } + if ( $nl_flags->{'use_fates_spitfire'} > 1 ) { +======= + } + } + my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') ); + if ( defined($stream_fldfilename_lightng) && $val ne "none" ) { + $log->fatal_error("-$var option used while also explicitly setting stream_fldfilename_lightng filename which is a contradiction. Use one or the other not both."); + } + if ( ! &value_is_true($nl->get_value('use_cn')) ) { + $log->fatal_error("-$var option used CN is NOT on. -$var can only be used when CN is on (with bgc: cn or bgc)"); + } + if ( &value_is_true($nl->get_value('use_cn')) && $val eq "none" ) { + $log->fatal_error("-$var option is set to none, but CN is on (with bgc: cn or bgc) which is a contradiction"); + } + $nl_flags->{$var} = $val; + } + my $group = $definition->get_group_name($var); + $nl->set_variable_value($group, $var, quote_string($nl_flags->{$var}) ); + if ( ! $definition->is_valid_value( $var, $nl_flags->{$var}, 'noquotes'=>1 ) ) { + my @valid_values = $definition->get_valid_values( $var ); + $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); + } + $log->verbose_message("Using $nl_flags->{$var} for $var."); + # + # Set flag if cn-fires are on or not + # + $var = "cnfireson"; + if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl->get_value('use_cn')) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method'); + } + my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); + if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) && ! &value_is_true($nl_flags->{'use_fates'}) ) { + $log->fatal_error("fire_method is being set even though bgc is NOT cn or bgc."); + } + if ( defined($fire_method) && $fire_method eq "nofire" ) { + $nl_flags->{$var} = ".false."; + } elsif ( &value_is_true($nl->get_value('use_cn')) ) { + $nl_flags->{$var} = ".true."; + } else { + $nl_flags->{$var} = ".false."; + } + # fates_spitfire_mode = 0 for no_fire, 1 for global const. value from + # fates_params, 2 for lightning dataset, 3 for successful_ignitions dataset + if ( $nl_flags->{'fates_spitfire_mode'} > 1 ) { +>>>>>>> Additional conflicts resolved; revisions in response to rgknox's review $nl_flags->{$var} = ".true."; } } @@ -3287,7 +3373,6 @@ sub setup_logic_lightning_streams { # lightning streams require CN/BGC my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; -<<<<<<< HEAD if ( &value_is_true($nl_flags->{'cnfireson'}) || &value_is_true($nl_flags->{'use_fates'}) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, 'hgrid'=>$nl_flags->{'res'}, @@ -3301,37 +3386,6 @@ sub setup_logic_lightning_streams { # Set align year, if first and last years are different if ( $nl->get_value('stream_year_first_lightng') != $nl->get_value('stream_year_last_lightng') ) { -||||||| constructed merge base - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - if ( &value_is_true($nl_flags->{'cnfireson'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, - 'hgrid'=>$nl_flags->{'res'}, - 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_lightng') != - $nl->get_value('stream_year_last_lightng') ) { -======= - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - if ( &value_is_true($nl_flags->{'cnfireson'}) || &value_is_true($nl_flags->{'use_fates'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, - 'hgrid'=>$nl_flags->{'res'}, - 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_lightng') != - $nl->get_value('stream_year_last_lightng') ) { ->>>>>>> Minor corrections for clm-fates to run with a lightning dataset add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_lightng', 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); } @@ -3810,7 +3864,7 @@ sub setup_logic_fates { if (&value_is_true( $nl_flags->{'use_fates'}) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'}); - my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", + my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", "use_fates_inventory_init","use_fates_fixed_biogeog", "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking" ); foreach my $var ( @list ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'} ); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 4de23f46db..028ec58f1e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2732,7 +2732,7 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 .false. -0 +0 .false. .false. .false. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 5a4099c33c..69e6f492a3 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -635,9 +635,9 @@ Toggle to turn on the FATES model Switch deciding which nutrient model to use in FATES. - -Turn on spitfire module to simulate fire by setting use_fates_spitfire > 0. +Turn on spitfire module to simulate fire by setting fates_spitfire_mode > 0. Relevant only if use_fates = .true.. Values of 1, 2, and 3 correspond to no external inputs, external lightning data, and external confirmed ignition data, respectively. diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index faac947342..88229d8cb4 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -823,7 +823,7 @@ sub make_config_cache { phys=>"clm5_0", }, "usespitfireButNOTFATES" =>{ options=>"-envxml_dir . -no-megan", - namelst=>"use_fates_spitfire=.true.", + namelst=>"fates_spitfire_mode>1", GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm4_5", }, diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm index a2facdeaa6..90a188bdb1 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm @@ -2,7 +2,7 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .true. -use_fates_spitfire= 1 +fates_spitfire_mode = 1 hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN_ELEM','LITTER_OUT_ELEM', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','FIRE_FUEL_MEF', 'FIRE_FUEL_BULKD','FIRE_FUEL_SAV','FIRE_NESTEROV_INDEX','PFTbiomass', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm index 7c2969a275..4d488d3c33 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm @@ -2,7 +2,7 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .false. -use_fates_spitfire= 1 +fates_spitfire_mode = 1 hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE','GPP_BY_AGE','PARSUN_Z_CNLF','PARSHA_Z_CNLF','PARSUN_Z_CNLFPFT', 'PARSHA_Z_CNLFPFT','PARSUN_Z_CAN','PARSHA_Z_CAN','LAISUN_Z_CNLF','LAISHA_Z_CNLF','LAISUN_Z_CNLFPFT','LAISHA_Z_CNLFPFT', 'LAISUN_TOP_CAN','LAISHA_TOP_CAN','FABD_SUN_CNLFPFT','FABD_SHA_CNLFPFT','FABI_SUN_CNLFPFT','FABI_SHA_CNLFPFT', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm index 5aea3a43ca..c092059cea 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm @@ -1,7 +1,7 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .true. -use_fates_spitfire= 1 +fates_spitfire_mode = 1 hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','FIRE_FUEL_MEF', 'FIRE_FUEL_BULKD','FIRE_FUEL_SAV','FIRE_NESTEROV_INDEX','PFTbiomass', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm index 6cf2c7f70d..8fc4951e6a 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm @@ -1 +1 @@ -use_fates_spitfire= 0 +fates_spitfire_mode = 0 diff --git a/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm index 810eb19987..265f4c5406 100644 --- a/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm @@ -1,2 +1,2 @@ -use_fates_spitfire = 1 +fates_spitfire_mode = 1 diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index b172c5b5ed..a28e0df482 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -132,7 +132,7 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) ! The particular type is determined based on a namelist parameter. ! ! !USES: - use clm_varctl, only: use_fates_spitfire + use clm_varctl, only: fates_spitfire_mode use CNFireMethodMod, only: cnfire_method_type use FATESFireBase, only: fates_fire_base_type use FATESFireNoDataMod, only: fates_fire_no_data_type @@ -146,7 +146,7 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) character(len=*), parameter :: subname = 'create_fates_fire_data_method' !----------------------------------------------------------------------- - current_case = use_fates_spitfire + current_case = fates_spitfire_mode select case (current_case) @@ -156,7 +156,7 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) allocate(fates_fire_data_type :: fates_fire_data_method) case default - write(iulog,*) subname//' ERROR: unknown method: ', use_fates_spitfire + write(iulog,*) subname//' ERROR: unknown method: ', fates_spitfire_mode call endrun(msg=errMsg(sourcefile, __LINE__)) end select diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index a1fba14146..0b3fe04d19 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -111,7 +111,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! ! !USES: use clm_time_manager , only : get_curr_date - use clm_varctl , only : use_lai_streams, use_fates_spitfire + use clm_varctl , only : use_lai_streams, fates_spitfire_mode use SatellitePhenologyMod, only : lai_advance ! ! !ARGUMENTS: @@ -398,9 +398,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro end if call bgc_vegetation_inst%InterpFileInputs(bounds_proc) call t_stopf('bgc_interp') - ! use_fates_spitfire is assigned an integer value in the namelist + ! fates_spitfire_mode is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - else if (use_fates_spitfire > 1) then + else if (fates_spitfire_mode > 1) then call clm_fates%InterpFileInputs(bounds_proc) end if diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 53019100c5..9128ceb5ee 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -280,7 +280,7 @@ subroutine initialize2( ) use clm_varcon , only : spval use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn, use_fates - use clm_varctl , only : use_crop, ndep_from_cpl, use_fates_spitfire + use clm_varctl , only : use_crop, ndep_from_cpl, fates_spitfire_mode use clm_varorb , only : eccen, mvelpp, lambm0, obliqr use clm_time_manager , only : get_step_size_real, get_curr_calday use clm_time_manager , only : get_curr_date, get_nstep, advance_timestep @@ -510,9 +510,9 @@ subroutine initialize2( ) else call SatellitePhenologyInit(bounds_proc) - ! use_fates_spitfire is assigned an integer value in the namelist + ! fates_spitfire_mode is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - if (use_fates_spitfire > 1) then + if (fates_spitfire_mode > 1) then call clm_fates%Init2(bounds_proc, NLFilename) end if end if diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index e67ed0d6f4..6f0a45790f 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -224,7 +224,7 @@ module clm_varctl integer, public :: fates_parteh_mode = -9 ! 1 => carbon only ! 2 => C+N+P (not enabled yet) ! no others enabled - integer, public :: use_fates_spitfire = 0 ! > 1 => use spitfire model + integer, public :: fates_spitfire_mode = 0 ! > 0 => use spitfire model: 1 with global const. lightning, 2 with lightning dataset, 3 with successful ignition dataset logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro logical, public :: use_fates_cohort_age_tracking = .false. ! true => turn on cohort age tracking diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index c912fde132..db233c4bd0 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -221,7 +221,7 @@ subroutine control_init( ) ! FATES Flags namelist /clm_inparm/ fates_paramfile, use_fates, & - use_fates_spitfire, use_fates_logging, & + fates_spitfire_mode, use_fates_logging, & use_fates_planthydro, use_fates_ed_st3, & use_fates_cohort_age_tracking, & use_fates_ed_prescribed_phys, & @@ -713,7 +713,7 @@ subroutine control_spmd() call mpi_bcast (use_fates, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_fates_spitfire, 1, MPI_INTEGER, 0, mpicom, ier) + call mpi_bcast (fates_spitfire_mode, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (use_fates_logging, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_planthydro, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_fates_cohort_age_tracking, 1, MPI_LOGICAL, 0, mpicom, ier) @@ -1064,7 +1064,7 @@ subroutine control_print () write(iulog, *) ' ED/FATES: ' write(iulog, *) ' use_fates = ', use_fates if (use_fates) then - write(iulog, *) ' use_fates_spitfire = ', use_fates_spitfire + write(iulog, *) ' fates_spitfire_mode = ', fates_spitfire_mode write(iulog, *) ' use_fates_logging = ', use_fates_logging write(iulog, *) ' fates_paramfile = ', fates_paramfile write(iulog, *) ' fates_parteh_mode = ', fates_parteh_mode diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index f50949cdb0..4c618b323c 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -50,7 +50,7 @@ module CLMFatesInterfaceMod use clm_varctl , only : use_vertsoilc use clm_varctl , only : fates_parteh_mode use clm_varctl , only : use_fates - use clm_varctl , only : use_fates_spitfire + use clm_varctl , only : fates_spitfire_mode use clm_varctl , only : use_fates_planthydro use clm_varctl , only : use_fates_cohort_age_tracking use clm_varctl , only : use_fates_ed_st3 @@ -270,6 +270,8 @@ subroutine CLMFatesGlobals() call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) + call set_fates_ctrlparms('spitfire_mode',ival=fates_spitfire_mode) + if(is_restart()) then pass_is_restart = 1 else @@ -704,7 +706,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & model_day, floor(day_of_year), & days_per_year, 1.0_r8/dble(days_per_year)) - if (use_fates_spitfire > 1) then + if (fates_spitfire_mode > 1) then allocate(lnfm24(bounds_clump%begg:bounds_clump%endg), stat=ier) if (ier /= 0) then call endrun(msg="allocation error for lnfm24"//& @@ -717,11 +719,19 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s=1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - if (use_fates_spitfire > 1) then + if (fates_spitfire_mode > 1) then g = col%gridcell(c) - this%fates(nc)%bc_in(s)%lightning24 = lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day + do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno + p = ifp + col%patchi(c) + + this%fates(nc)%bc_in(s)%lightning24(ifp) = lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day + end do else - this%fates(nc)%bc_in(s)%lightning24 = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day + do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno + p = ifp + col%patchi(c) + + this%fates(nc)%bc_in(s)%lightning24(ifp) = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day + end do end if nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil From 91a6745b7dcec06ca7fc10dda491c33cac6ec94f Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 4 Aug 2020 08:40:17 -0600 Subject: [PATCH 1241/1973] mod for pio2 functionality --- src/main/ncdio_pio.F90.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index ff7320bc70..3c41be9ac1 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1541,11 +1541,11 @@ contains call ncd_inqvid (ncid, varname, varid, vardesc) #if ({DIMS}==0) + start(1) = 1 ; count(1) = len(data) if (present(nt)) then do m = 1,len(data) tmpString(m:m) = data(m:m) end do - start(1) = 1 ; count(1) = len(data) start(2) = nt; count(2) = 1 if ( count(1) > size(tmpString) )then call shr_sys_abort( subname//' ERROR: input string size is too large:'//& @@ -1556,23 +1556,23 @@ contains status = pio_put_var(ncid, varid, data ) end if #elif ({DIMS}==1) + start(1) = 1 ; count(1) = len(data) + start(2) = 1 ; count(2) = size(data) if (present(nt)) then - start(1) = 1 ; count(1) = len(data) - start(2) = 1 ; count(2) = size(data) start(3) = nt; count(3) = 1 status = pio_put_var(ncid, varid, start, count, data) else - status = pio_put_var(ncid, varid, data) + status = pio_put_var(ncid, varid, start, count, data) end if #elif ({DIMS}==2) + start(1) = 1 ; count(1) = len(data) + start(2) = 1 ; count(2) = size(data,dim=1) + start(3) = 1 ; count(3) = size(data,dim=2) if (present(nt)) then - start(1) = 1 ; count(1) = len(data) - start(2) = 1 ; count(2) = size(data,dim=1) - start(3) = 1 ; count(3) = size(data,dim=2) start(4) = nt ; count(4) = 1 status = pio_put_var(ncid, varid, start, count, data) else - status = pio_put_var(ncid, varid, data) + status = pio_put_var(ncid, varid, start, count, data) end if #endif From 22c0009e7612a26bdac7dbf7131e0c4d130c9f5d Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 4 Aug 2020 09:36:46 -0600 Subject: [PATCH 1242/1973] update for compatibility with cime master --- .config_files.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.config_files.xml b/.config_files.xml index 8e4868b94f..5c88ec4051 100644 --- a/.config_files.xml +++ b/.config_files.xml @@ -18,9 +18,10 @@ unset $SRCROOT - $CIMEROOT/src/components/data_comps/dlnd - $CIMEROOT/src/components/stub_comps/slnd - $CIMEROOT/src/components/xcpl_comps/xlnd + $CIMEROOT/src/components/data_comps_mct/dlnd + $CIMEROOT/src/components/cdeps/dlnd + $CIMEROOT/src/components/stub_comps_$COMP_INTERFACE/slnd + $CIMEROOT/src/components/xcpl_comps_$COMP_INTERFACE/xlnd case_comps env_case.xml From 7da5ec9beb2e53383eb1b5c92ce101c379441605 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sun, 7 Jun 2020 16:10:16 -0600 Subject: [PATCH 1243/1973] Added new FATES test that exercises the lightning dataset code New test name: ERS_D_Lm12.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-FatesSuccIgnitions I opted for a longer single-point test to allow several months of lightning or ignition data to be read in. NB. This test has uncovered a preexisting problem that I have documented in ExpectedTestFails.xml and which was missed before due to the short lengths of previous FATES tests. --- cime_config/testdefs/ExpectedTestFails.xml | 21 +++++++++++++++++++ cime_config/testdefs/testlist_clm.xml | 8 +++++++ .../clm/FatesSuccIgnitions/README | 21 +++++++++++++++++++ .../clm/FatesSuccIgnitions/user_nl_clm | 5 +++++ 4 files changed, 55 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/README create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/user_nl_clm diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 4b9b0ca8b0..dd63a1fcd6 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -130,4 +130,25 @@ + + + FAIL + #667 + + + + + + FAIL + #667 + + + + + + FAIL + NGEET/fates#991 + + + diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index c59b5a985f..a6052f3a31 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1953,6 +1953,14 @@ + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/README b/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/README new file mode 100644 index 0000000000..4046d99f9d --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/README @@ -0,0 +1,21 @@ +Testing the "successful ignitions" code, though reading the lightning +dataset. The lightning and successful ignitions datasets use the same +format and units, so handling is the same until you're in subroutine +area_burnt_intensity where for "successful ignitions" the model selects +currentSite%FDI = 1.0_r8 +cloud_to_ground_strikes = 1.0_r8 +while for lightning the model can use values < 1 for both. + +Lara Kueppers (UC-Berkeley) has access to a "successful ignitions" +dataset for California that has not been placed in the repository of +CTSM datasets as of 2020/6/6. That dataset can be used with the +following settings: + +fire_method = 'spitfire' +fates_spitfire_mode = 3 +stream_fldfilename_lightng = '.../data_UCB/observed/CA_monthly_ignition_number_1980-2016/ignition_1980_to_2016_monthly_20190801.nc' +stream_year_first_lightng = 1980 +stream_year_last_lightng = 2016 +model_year_align_lightng = 1980 + +where {...} = /fs/cgd/data0/slevis on izumi and /glade/work/slevis on cheyenne. diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/user_nl_clm new file mode 100644 index 0000000000..f15114e4e1 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/user_nl_clm @@ -0,0 +1,5 @@ +fire_method = 'spitfire' +fates_spitfire_mode = 3 +stream_fldfilename_lightng = '/glade/p/cesmdata/cseg/inputdata/atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc' +hist_nhtfrq = 0 +hist_mfilt = 1 From 10915c04ea332bf5f750bbf291b271e1af9c7bae Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 8 Jun 2020 15:54:04 -0600 Subject: [PATCH 1244/1973] Minor corrections from self-reviewing the PR --- bld/CLMBuildNamelist.pm | 2 +- bld/unit_testers/build-namelist_test.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 143dcf93bc..52873a3589 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1030,7 +1030,7 @@ sub setup_cmdl_fire_light_res { } my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) && ! &value_is_true($nl_flags->{'use_fates'}) ) { - $log->fatal_error("fire_method is being set even though bgc is NOT cn or bgc."); + $log->fatal_error("fire_method is being set while use_cn and use_fates are both false."); } if ( defined($fire_method) && $fire_method eq "nofire" ) { $nl_flags->{$var} = ".false."; diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 88229d8cb4..13592ee93c 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -823,7 +823,7 @@ sub make_config_cache { phys=>"clm5_0", }, "usespitfireButNOTFATES" =>{ options=>"-envxml_dir . -no-megan", - namelst=>"fates_spitfire_mode>1", + namelst=>"fates_spitfire_mode>0", GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm4_5", }, From 2d4d64f40c4c1ac43721683b6f7ad33c1999aa82 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 8 Jun 2020 16:35:01 -0600 Subject: [PATCH 1245/1973] Reassigned expected test fail to issue #667 --- cime_config/testdefs/ExpectedTestFails.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index dd63a1fcd6..522eb1004b 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -147,7 +147,7 @@ FAIL - NGEET/fates#991 + #667 From 4d276cc07070e8507f2ccbba6f28020cc4cf79dc Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 11 Jul 2020 16:07:49 -0600 Subject: [PATCH 1246/1973] Updates needed for anthropogenic ignitions in FATES-SPITFIRE Previous commits in this PR made CN's code for reading lightning and population density available to FATES. Here I add the population density to the CTSM-FATES interface so as to calculate anthropogenic fire ignitions in FATES. --- bld/CLMBuildNamelist.pm | 118 +++--------------- bld/namelist_files/namelist_defaults_ctsm.xml | 46 +++++++ .../namelist_definition_ctsm.xml | 11 +- cime_config/testdefs/testlist_clm.xml | 2 +- .../clm/FatesSuccIgnitions/user_nl_clm | 5 - .../README | 14 ++- .../user_nl_clm | 4 + src/biogeochem/CNFireBaseMod.F90 | 12 +- src/utils/clmfates_interfaceMod.F90 | 8 +- 9 files changed, 90 insertions(+), 130 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/user_nl_clm rename cime_config/testdefs/testmods_dirs/clm/{FatesSuccIgnitions => Fates_nat_and_anthro_ignitions}/README (58%) create mode 100644 cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 52873a3589..04cd426e68 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -917,89 +917,6 @@ sub setup_cmdl_fire_light_res { if ( defined($fire_method) && $val ne "none" ) { if ( $fire_method eq "nofire" ) { $log->fatal_error("-$var option used with fire_method='nofire'. -$var can ONLY be used without the nofire option"); -<<<<<<< HEAD - } - } - my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') ); - if ( defined($stream_fldfilename_lightng) && $val ne "none" ) { - $log->fatal_error("-$var option used while also explicitly setting stream_fldfilename_lightng filename which is a contradiction. Use one or the other not both."); - } - if ( ! &value_is_true($nl->get_value('use_cn')) ) { - $log->fatal_error("-$var option used CN is NOT on. -$var can only be used when CN is on (with bgc: cn or bgc)"); - } - if ( &value_is_true($nl->get_value('use_cn')) && $val eq "none" ) { - $log->fatal_error("-$var option is set to none, but CN is on (with bgc: cn or bgc) which is a contradiction"); - } - $nl_flags->{$var} = $val; - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string($nl_flags->{$var}) ); - if ( ! $definition->is_valid_value( $var, $nl_flags->{$var}, 'noquotes'=>1 ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Using $nl_flags->{$var} for $var."); - # - # Set flag if cn-fires are on or not - # - $var = "cnfireson"; - if ( &value_is_true($nl->get_value('use_cn')) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method'); - } - my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); - if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) && ! &value_is_true($nl_flags->{'use_fates'}) ) { - $log->fatal_error("fire_method is being set even though bgc is NOT cn or bgc."); - } - if ( defined($fire_method) && $fire_method eq "nofire" ) { - $nl_flags->{$var} = ".false."; - } elsif ( &value_is_true($nl->get_value('use_cn')) ) { - $nl_flags->{$var} = ".true."; - } else { - $nl_flags->{$var} = ".false."; - } - if ( $nl_flags->{'use_fates_spitfire'} > 1 ) { -||||||| constructed merge base - } - } - my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') ); - if ( defined($stream_fldfilename_lightng) && $val ne "none" ) { - $log->fatal_error("-$var option used while also explicitly setting stream_fldfilename_lightng filename which is a contradiction. Use one or the other not both."); - } - if ( ! &value_is_true($nl->get_value('use_cn')) ) { - $log->fatal_error("-$var option used CN is NOT on. -$var can only be used when CN is on (with bgc: cn or bgc)"); - } - if ( &value_is_true($nl->get_value('use_cn')) && $val eq "none" ) { - $log->fatal_error("-$var option is set to none, but CN is on (with bgc: cn or bgc) which is a contradiction"); - } - $nl_flags->{$var} = $val; - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string($nl_flags->{$var}) ); - if ( ! $definition->is_valid_value( $var, $nl_flags->{$var}, 'noquotes'=>1 ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Using $nl_flags->{$var} for $var."); - # - # Set flag if cn-fires are on or not - # - $var = "cnfireson"; - if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl->get_value('use_cn')) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method'); - } - my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); - if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) && ! &value_is_true($nl_flags->{'use_fates'}) ) { - $log->fatal_error("fire_method is being set even though bgc is NOT cn or bgc."); - } - if ( defined($fire_method) && $fire_method eq "nofire" ) { - $nl_flags->{$var} = ".false."; - } elsif ( &value_is_true($nl->get_value('use_cn')) ) { - $nl_flags->{$var} = ".true."; - } else { - $nl_flags->{$var} = ".false."; - } - if ( $nl_flags->{'use_fates_spitfire'} > 1 ) { -======= } } my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') ); @@ -1025,7 +942,7 @@ sub setup_cmdl_fire_light_res { # Set flag if cn-fires are on or not # $var = "cnfireson"; - if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl->get_value('use_cn')) ) { + if ( &value_is_true($nl->get_value('use_cn')) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method'); } my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); @@ -1039,10 +956,11 @@ sub setup_cmdl_fire_light_res { } else { $nl_flags->{$var} = ".false."; } - # fates_spitfire_mode = 0 for no_fire, 1 for global const. value from - # fates_params, 2 for lightning dataset, 3 for successful_ignitions dataset + # fates_spitfire_mode = 0 for no_fire + # fates_spitfire_mode = 1 for global const. lightning from fates_params + # fates_spitfire_mode > 1 for ignitions from datasets as explained + # in namelist_definition_clm4_5.xml if ( $nl_flags->{'fates_spitfire_mode'} > 1 ) { ->>>>>>> Additional conflicts resolved; revisions in response to rgknox's review $nl_flags->{$var} = ".true."; } } @@ -3373,19 +3291,19 @@ sub setup_logic_lightning_streams { # lightning streams require CN/BGC my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - if ( &value_is_true($nl_flags->{'cnfireson'}) || &value_is_true($nl_flags->{'use_fates'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, - 'hgrid'=>$nl_flags->{'res'}, - 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_lightng') != - $nl->get_value('stream_year_last_lightng') ) { + if ( &value_is_true($nl_flags->{'cnfireson'}) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, + 'hgrid'=>$nl_flags->{'res'}, + 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + 'sim_year'=>$nl_flags->{'sim_year'}, + 'sim_year_range'=>$nl_flags->{'sim_year_range'}); + # Set align year, if first and last years are different + if ( $nl->get_value('stream_year_first_lightng') != + $nl->get_value('stream_year_last_lightng') ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_lightng', 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 028ec58f1e..aa587a33c4 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1223,6 +1223,24 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 2000 2000 +2010 +2010 + +2000 +2000 + +1850 +1850 + +2000 +2000 + +2000 +2000 + +2000 +2000 + lnd/clm2/firedata/clmforc.Li_2017_HYDEv3.2_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2016_c180202.nc lnd/clm2/firedata/clmforc.Li_2018_SSP1_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc @@ -1241,6 +1259,24 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 lnd/clm2/firedata/clmforc.Li_2018_SSP5_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc +lnd/clm2/firedata/clmforc.Li_2017_HYDEv3.2_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2016_c180202.nc +lnd/clm2/firedata/clmforc.Li_2018_SSP1_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP1_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP2_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP3_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP4_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP4_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP5_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + +lnd/clm2/firedata/clmforc.Li_2018_SSP5_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2100_c181205.nc + + bilinear nn @@ -1251,6 +1287,16 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 nn nn +bilinear + +nn +nn +nn +nn +nn +nn +nn + 2015 2106 diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 69e6f492a3..890c8bbc2e 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -636,11 +636,14 @@ Switch deciding which nutrient model to use in FATES. + group="clm_inparm" valid_values="0,1,2,3,4" value=".false."> Turn on spitfire module to simulate fire by setting fates_spitfire_mode > 0. -Relevant only if use_fates = .true.. Values of 1, 2, and 3 correspond to -no external inputs, external lightning data, and external confirmed ignition -data, respectively. +Relevant only if use_fates = .true.. Set to 1 for no external ignition +inputs and use of a global constant lightning rate found in fates_params. +Set to 2 to use an external lightning dataset. Set to 3 to use an +external confirmed ignitions dataset. Set to 4 to use external lightning +and population datasets so as to simulate both natural and anthropogenic +ignitions. 00:40:00 - + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/user_nl_clm deleted file mode 100644 index f15114e4e1..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/user_nl_clm +++ /dev/null @@ -1,5 +0,0 @@ -fire_method = 'spitfire' -fates_spitfire_mode = 3 -stream_fldfilename_lightng = '/glade/p/cesmdata/cseg/inputdata/atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc' -hist_nhtfrq = 0 -hist_mfilt = 1 diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/README b/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README similarity index 58% rename from cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/README rename to cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README index 4046d99f9d..0e78f61023 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesSuccIgnitions/README +++ b/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README @@ -1,7 +1,12 @@ -Testing the "successful ignitions" code, though reading the lightning -dataset. The lightning and successful ignitions datasets use the same -format and units, so handling is the same until you're in subroutine -area_burnt_intensity where for "successful ignitions" the model selects +Testing capability to read/use lightning frequency & population density +datasets. Calculates natural ignitions from lightning using the SPITFIRE +formulation and anthropogenic ignitions using the Li et al. formulation +copied from CTSM-CN's fire model. + +Testing does not include a separate test for reading/using a successful +ignitions dataset which uses the same format and units so handling +is the same until you're in subroutine area_burnt_intensity where for +"successful ignitions" the model selects currentSite%FDI = 1.0_r8 cloud_to_ground_strikes = 1.0_r8 while for lightning the model can use values < 1 for both. @@ -19,3 +24,4 @@ stream_year_last_lightng = 2016 model_year_align_lightng = 1980 where {...} = /fs/cgd/data0/slevis on izumi and /glade/work/slevis on cheyenne. + diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm new file mode 100644 index 0000000000..77d3a7179f --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm @@ -0,0 +1,4 @@ +fire_method = 'spitfire' +fates_spitfire_mode = 4 +hist_nhtfrq = 0 +hist_mfilt = 1 diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 52fdd35fb0..cf1ed9752d 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -116,7 +116,6 @@ subroutine CNFireInit( this, bounds, NLFilename ) ! Initialize CN Fire module ! !USES: use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varctl , only : use_cn ! ! !ARGUMENTS: class(cnfire_base_type) :: this @@ -132,10 +131,8 @@ subroutine CNFireInit( this, bounds, NLFilename ) allocate( this%forc_hdm(bounds%begg:bounds%endg) ) this%forc_hdm(bounds%begg:) = nan - if (use_cn) then - call this%hdm_init(bounds, NLFilename) - call this%hdm_interp(bounds) - end if + call this%hdm_init(bounds, NLFilename) + call this%hdm_interp(bounds) call this%lnfm_init(bounds, NLFilename) call this%lnfm_interp(bounds) @@ -255,7 +252,6 @@ subroutine CNFireInterp(this,bounds) ! Interpolate CN Fire datasets ! ! !USES: - use clm_varctl, only: use_cn ! ! !ARGUMENTS: class(cnfire_base_type) :: this @@ -263,9 +259,7 @@ subroutine CNFireInterp(this,bounds) !----------------------------------------------------------------------- if ( this%need_lightning_and_popdens ) then - if (use_cn) then - call this%hdm_interp(bounds) - end if + call this%hdm_interp(bounds) call this%lnfm_interp(bounds) end if diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 4c618b323c..5e81204f6d 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -636,7 +636,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! to process array bounding information ! !USES - use EDParamsMod, only: ED_val_nignitions implicit none class(hlm_fates_interface_type), intent(inout) :: this @@ -725,12 +724,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & p = ifp + col%patchi(c) this%fates(nc)%bc_in(s)%lightning24(ifp) = lnfm24(g) * 24._r8 ! #/km2/hr to #/km2/day - end do - else - do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - p = ifp + col%patchi(c) - - this%fates(nc)%bc_in(s)%lightning24(ifp) = ED_val_nignitions / days_per_year ! #/km2/yr to #/km2/day + this%fates(nc)%bc_in(s)%pop_density(ifp) = this%fates_fire_data_method%forc_hdm(g) end do end if From 8844da9c6f23f35c7adcc78ae163cc8ea76f2d91 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 11 Jul 2020 16:59:51 -0600 Subject: [PATCH 1247/1973] Minor clean-up Good stopping point: Next I will be testing the population density capability. --- cime_config/testdefs/ExpectedTestFails.xml | 2 +- src/biogeochem/CNFireBaseMod.F90 | 3 --- src/main/clm_varctl.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 6 ++---- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 522eb1004b..5c36197ffa 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -144,7 +144,7 @@ - + FAIL #667 diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index cf1ed9752d..91a60d5f0c 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -133,7 +133,6 @@ subroutine CNFireInit( this, bounds, NLFilename ) call this%hdm_init(bounds, NLFilename) call this%hdm_interp(bounds) - call this%lnfm_init(bounds, NLFilename) call this%lnfm_interp(bounds) end if @@ -251,8 +250,6 @@ subroutine CNFireInterp(this,bounds) ! !DESCRIPTION: ! Interpolate CN Fire datasets ! - ! !USES: - ! ! !ARGUMENTS: class(cnfire_base_type) :: this type(bounds_type), intent(in) :: bounds diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 6f0a45790f..cfc7bec1e3 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -224,7 +224,7 @@ module clm_varctl integer, public :: fates_parteh_mode = -9 ! 1 => carbon only ! 2 => C+N+P (not enabled yet) ! no others enabled - integer, public :: fates_spitfire_mode = 0 ! > 0 => use spitfire model: 1 with global const. lightning, 2 with lightning dataset, 3 with successful ignition dataset + integer, public :: fates_spitfire_mode = 0 ! > 0 => use spitfire model: see bld/namelist_files/namelist_definition_clm4_5.xml for details logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro logical, public :: use_fates_cohort_age_tracking = .false. ! true => turn on cohort age tracking diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 5e81204f6d..aa82501992 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -396,8 +396,8 @@ subroutine init(this, bounds_proc ) use FatesInterfaceTypesMod, only : numpft_fates => numpft use FatesParameterDerivedMod, only : param_derived use subgridMod, only : natveg_patch_exists - use clm_instur , only : wt_nat_patch - use CNFireFactoryMod, only: create_fates_fire_data_method + use clm_instur , only : wt_nat_patch + use CNFireFactoryMod , only: create_fates_fire_data_method implicit none @@ -635,8 +635,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! ed_driver is not a hlm_fates_inst_type procedure because we need an extra step ! to process array bounding information - ! !USES - implicit none class(hlm_fates_interface_type), intent(inout) :: this type(bounds_type),intent(in) :: bounds_clump From e19350a011db82241e6d52dfcadd45f61b30fd99 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sun, 12 Jul 2020 13:49:43 -0600 Subject: [PATCH 1248/1973] Small corrections to get test simulation to run Testing with ./create_test ERS_D_Lm36.1x1_brazil.I2000Clm50FatesCruGs.cheyenne_intel.clm-Fates_nat_and_anthro_ignitions --- bld/CLMBuildNamelist.pm | 9 ++------- src/biogeochem/CNFireFactoryMod.F90 | 9 +++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 04cd426e68..0a5636e8c2 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -951,17 +951,12 @@ sub setup_cmdl_fire_light_res { } if ( defined($fire_method) && $fire_method eq "nofire" ) { $nl_flags->{$var} = ".false."; - } elsif ( &value_is_true($nl->get_value('use_cn')) ) { +# } elsif ( &value_is_true($nl->get_value('use_cn')) || $nl_flags->{'fates_spitfire_mode'} > 1 ) { + } elsif ( &value_is_true($nl->get_value('use_cn')) || &value_is_true($nl->get_value('use_fates')) ) { $nl_flags->{$var} = ".true."; } else { $nl_flags->{$var} = ".false."; } - # fates_spitfire_mode = 0 for no_fire - # fates_spitfire_mode = 1 for global const. lightning from fates_params - # fates_spitfire_mode > 1 for ignitions from datasets as explained - # in namelist_definition_clm4_5.xml - if ( $nl_flags->{'fates_spitfire_mode'} > 1 ) { - $nl_flags->{$var} = ".true."; } } diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index a28e0df482..e0b00cb87e 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -143,6 +143,11 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) ! ! !LOCAL VARIABLES: integer :: current_case + integer, parameter :: no_fire = 0 ! value of no_fire mode + integer, parameter :: scalar_lightning = 1 ! value of scalar_lightning mode + integer, parameter :: lightning_data = 2 ! value of lightning_data mode + integer, parameter :: anthro_ignitions = 4 ! value of anthro_ignitions mode + character(len=*), parameter :: subname = 'create_fates_fire_data_method' !----------------------------------------------------------------------- @@ -150,9 +155,9 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) select case (current_case) - case (0:1) + case (no_fire:scalar_lightning) allocate(fates_fire_no_data_type :: fates_fire_data_method) - case (2:3) + case (lightning_data:anthro_ignitions) allocate(fates_fire_data_type :: fates_fire_data_method) case default From bc7a09531cd03387c8de11001bac37ed778ce0af Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sun, 12 Jul 2020 14:20:42 -0600 Subject: [PATCH 1249/1973] Added some comments to the code --- src/biogeochem/CNFireFactoryMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index e0b00cb87e..af950b36bc 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -143,6 +143,8 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) ! ! !LOCAL VARIABLES: integer :: current_case + ! The following parameters set the ranges of the cases below. + ! NB. The same parameters are set in /fates/fire/SFMainMod integer, parameter :: no_fire = 0 ! value of no_fire mode integer, parameter :: scalar_lightning = 1 ! value of scalar_lightning mode integer, parameter :: lightning_data = 2 ! value of lightning_data mode From 5acd34c079ff6f64e49dce9ce220b890aec4a087 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sun, 12 Jul 2020 17:23:13 -0600 Subject: [PATCH 1250/1973] Changed walltime on new test to avoid timeout --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 3836948e37..d5be518d67 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1958,7 +1958,7 @@ - + From 06dc679e13d001584228dd2b902f2765d9c20c11 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 14 Jul 2020 14:40:49 -0700 Subject: [PATCH 1251/1973] Update bld/namelist_files/namelist_definition_clm4_5.xml Clearer documentation suggested by @jkshuman. Co-authored-by: jkshuman --- bld/namelist_files/namelist_definition_ctsm.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 890c8bbc2e..77594f7c7a 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -638,11 +638,12 @@ Switch deciding which nutrient model to use in FATES. Turn on spitfire module to simulate fire by setting fates_spitfire_mode > 0. -Relevant only if use_fates = .true.. Set to 1 for no external ignition -inputs and use of a global constant lightning rate found in fates_params. -Set to 2 to use an external lightning dataset. Set to 3 to use an -external confirmed ignitions dataset. Set to 4 to use external lightning -and population datasets so as to simulate both natural and anthropogenic +Relevant only if use_fates = .true. +Allowed values are: + 1 : use a global constant lightning rate found in fates_params. + 2 : use an external lightning dataset. + 3 : use an external confirmed ignitions dataset. + 4 : use external lightning and population datasets to simulate both natural and anthropogenic ignitions. From e28c57dd2145d3f11c742dc784cece59c1cc7f67 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 14 Jul 2020 14:42:08 -0700 Subject: [PATCH 1252/1973] Update cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README Clearer documentation suggestion by @jkshuman. Co-authored-by: jkshuman --- .../clm/Fates_nat_and_anthro_ignitions/README | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README b/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README index 0e78f61023..3bd8c7dd62 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README +++ b/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/README @@ -1,7 +1,7 @@ Testing capability to read/use lightning frequency & population density -datasets. Calculates natural ignitions from lightning using the SPITFIRE -formulation and anthropogenic ignitions using the Li et al. formulation -copied from CTSM-CN's fire model. +datasets. Calculates lightning ignitions using the SPITFIRE +formulation and anthropogenic ignitions using the Li et al. 2012 formulation +based on human population density implemented in CTSM-CN's fire model. Testing does not include a separate test for reading/using a successful ignitions dataset which uses the same format and units so handling @@ -24,4 +24,3 @@ stream_year_last_lightng = 2016 model_year_align_lightng = 1980 where {...} = /fs/cgd/data0/slevis on izumi and /glade/work/slevis on cheyenne. - From 9b61c0897b9cb0124ee449363200b4c4b57a3110 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 14 Jul 2020 15:39:34 -0700 Subject: [PATCH 1253/1973] Update src/main/clm_varctl.F90 Clearer comment. Co-authored-by: jkshuman --- src/main/clm_varctl.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index cfc7bec1e3..3be001115c 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -224,7 +224,9 @@ module clm_varctl integer, public :: fates_parteh_mode = -9 ! 1 => carbon only ! 2 => C+N+P (not enabled yet) ! no others enabled - integer, public :: fates_spitfire_mode = 0 ! > 0 => use spitfire model: see bld/namelist_files/namelist_definition_clm4_5.xml for details + integer, public :: fates_spitfire_mode = 0 + ! > 0 => use spitfire model: see bld/namelist_files/namelist_definition_clm4_5.xml for details + ! ignitions: 1=constant, >1=external data sources logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro logical, public :: use_fates_cohort_age_tracking = .false. ! true => turn on cohort age tracking From e20879d06a9e69cefe2160f0bc8ea076a154226f Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 14 Jul 2020 17:47:48 -0700 Subject: [PATCH 1254/1973] Update src/main/clm_varctl.F90 Comment clarification. Co-authored-by: jkshuman --- src/main/clm_varctl.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 3be001115c..d57e85c830 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -226,7 +226,7 @@ module clm_varctl ! no others enabled integer, public :: fates_spitfire_mode = 0 ! > 0 => use spitfire model: see bld/namelist_files/namelist_definition_clm4_5.xml for details - ! ignitions: 1=constant, >1=external data sources + ! ignitions: 1=constant, >1=external data sources (lightning and/or anthropogenic) logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro logical, public :: use_fates_cohort_age_tracking = .false. ! true => turn on cohort age tracking From 79d3c2a11ec6ce150642eb45aefe46dbd3f57487 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 18 Jul 2020 11:24:10 -0600 Subject: [PATCH 1255/1973] Made spitfire_mode flags public for use throughout CTSM-FATES --- src/biogeochem/CNFireFactoryMod.F90 | 19 ++++++++++++------- src/main/clm_driver.F90 | 3 ++- src/main/clm_initializeMod.F90 | 3 ++- src/main/clm_varctl.F90 | 4 ++-- src/utils/clmfates_interfaceMod.F90 | 8 ++++++-- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index af950b36bc..7b3914534d 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -19,6 +19,17 @@ module CNFireFactoryMod public :: create_cnfire_method ! create an object of class cnfire_method_type public :: create_fates_fire_data_method ! create an object of class cnfire_method_type + ! These parameters set the ranges of the cases in subroutine + ! create_fates_fire_data_method. We declare them public in order to + ! use them as flags elsewhere in the CTSM and FATES-SPITFIRE. + ! They correspond one-to-one to the fates_spitfire_mode options listed + ! in bld/namelist_files/namelist_definition_clm4_5.xml + integer, public, parameter :: no_fire = 0 ! value of no_fire mode + integer, public, parameter :: scalar_lightning = 1 ! value of scalar_lightning mode + integer, public, parameter :: lightning_from_data = 2 ! value of lightning_from_data mode + integer, public, parameter :: successful_ignitions = 3 ! value of successful_ignitions mode + integer, public, parameter :: anthro_ignitions = 4 ! value of anthro_ignitions mode + ! !PRIVATE DATA MEMBERS: character(len=80), private :: fire_method = "li2014qianfrc" @@ -143,12 +154,6 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) ! ! !LOCAL VARIABLES: integer :: current_case - ! The following parameters set the ranges of the cases below. - ! NB. The same parameters are set in /fates/fire/SFMainMod - integer, parameter :: no_fire = 0 ! value of no_fire mode - integer, parameter :: scalar_lightning = 1 ! value of scalar_lightning mode - integer, parameter :: lightning_data = 2 ! value of lightning_data mode - integer, parameter :: anthro_ignitions = 4 ! value of anthro_ignitions mode character(len=*), parameter :: subname = 'create_fates_fire_data_method' !----------------------------------------------------------------------- @@ -159,7 +164,7 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) case (no_fire:scalar_lightning) allocate(fates_fire_no_data_type :: fates_fire_data_method) - case (lightning_data:anthro_ignitions) + case (lightning_from_data:anthro_ignitions) allocate(fates_fire_data_type :: fates_fire_data_method) case default diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 0b3fe04d19..5f40ce39db 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -113,6 +113,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro use clm_time_manager , only : get_curr_date use clm_varctl , only : use_lai_streams, fates_spitfire_mode use SatellitePhenologyMod, only : lai_advance + use CNFireFactoryMod , only : scalar_lightning ! ! !ARGUMENTS: implicit none @@ -400,7 +401,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_stopf('bgc_interp') ! fates_spitfire_mode is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - else if (fates_spitfire_mode > 1) then + else if (fates_spitfire_mode > scalar_lightning) then call clm_fates%InterpFileInputs(bounds_proc) end if diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 9128ceb5ee..e946aa6cd8 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -305,6 +305,7 @@ subroutine initialize2( ) use controlMod , only : NLFilename use clm_instMod , only : clm_fates use BalanceCheckMod , only : BalanceCheckInit + use CNFireFactoryMod , only : scalar_lightning ! ! !ARGUMENTS ! @@ -512,7 +513,7 @@ subroutine initialize2( ) ! fates_spitfire_mode is assigned an integer value in the namelist ! see bld/namelist_files/namelist_definition_clm4_5.xml for details - if (fates_spitfire_mode > 1) then + if (fates_spitfire_mode > scalar_lightning) then call clm_fates%Init2(bounds_proc, NLFilename) end if end if diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index d57e85c830..ceb3b6ab01 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -225,8 +225,8 @@ module clm_varctl ! 2 => C+N+P (not enabled yet) ! no others enabled integer, public :: fates_spitfire_mode = 0 - ! > 0 => use spitfire model: see bld/namelist_files/namelist_definition_clm4_5.xml for details - ! ignitions: 1=constant, >1=external data sources (lightning and/or anthropogenic) + ! 0 for no fire; 1 for constant ignitions; > 1 for external data (lightning and/or anthropogenic ignitions) + ! see bld/namelist_files/namelist_definition_clm4_5.xml for details logical, public :: use_fates_logging = .false. ! true => turn on logging module logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro logical, public :: use_fates_cohort_age_tracking = .false. ! true => turn on cohort age tracking diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index aa82501992..132c4a29a4 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -635,6 +635,10 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! ed_driver is not a hlm_fates_inst_type procedure because we need an extra step ! to process array bounding information + ! !USES + use CNFireFactoryMod, only: scalar_lightning + + ! !ARGUMENTS: implicit none class(hlm_fates_interface_type), intent(inout) :: this type(bounds_type),intent(in) :: bounds_clump @@ -703,7 +707,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & model_day, floor(day_of_year), & days_per_year, 1.0_r8/dble(days_per_year)) - if (fates_spitfire_mode > 1) then + if (fates_spitfire_mode > scalar_lightning) then allocate(lnfm24(bounds_clump%begg:bounds_clump%endg), stat=ier) if (ier /= 0) then call endrun(msg="allocation error for lnfm24"//& @@ -716,7 +720,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s=1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - if (fates_spitfire_mode > 1) then + if (fates_spitfire_mode > scalar_lightning) then g = col%gridcell(c) do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno p = ifp + col%patchi(c) From f5821fc48856a5b8d2b6038e10d767e86231d006 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 22 Jul 2020 16:21:17 -0700 Subject: [PATCH 1256/1973] updating externals_clm configuration --- Externals_CLM.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 331c344e5a..20c468015e 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -1,8 +1,8 @@ [fates] local_path = src/fates protocol = git -repo_url = https://github.com/slevisconsulting/fates -branch = lightning_v2_fates +repo_url = https://github.com/NGEET/fates +tag = sci.1.39.0_api.12.0.0 required = True [PTCLM] From c384c8eb1e411f68f301a23f08f62452d17f4191 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 29 Jul 2020 13:25:06 -0400 Subject: [PATCH 1257/1973] fates-interface: added fixes to lightning interface --- src/utils/clmfates_interfaceMod.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 132c4a29a4..2d23472fd7 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -138,6 +138,8 @@ module CLMFatesInterfaceMod use FatesPlantHydraulicsMod, only : InitHydrSites use FatesPlantHydraulicsMod, only : RestartHydrStates use FATESFireBase , only : fates_fire_base_type + use CNFireFactoryMod, only: no_fire, scalar_lightning, & + successful_ignitions, anthro_ignitions implicit none @@ -271,6 +273,10 @@ subroutine CLMFatesGlobals() call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) call set_fates_ctrlparms('spitfire_mode',ival=fates_spitfire_mode) + call set_fates_ctrlparms('sf_nofire_def',ival=no_fire) + call set_fates_ctrlparms('sf_scalar_lightning_def',ival=scalar_lightning) + call set_fates_ctrlparms('sf_successful_ignitions_def',ival=successful_ignitions) + call set_fates_ctrlparms('sf_anthro_ignitions_def',ival=anthro_ignitions) if(is_restart()) then pass_is_restart = 1 From 184b8bee366f7eb87869b5c3d11b5f14453dd26b Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 6 May 2020 12:13:01 -0600 Subject: [PATCH 1258/1973] enabling in bld/CLMBuildNamelist.pm the possibility of running with FATES and transient land-use --- bld/CLMBuildNamelist.pm | 3 --- 1 file changed, 3 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 0a5636e8c2..b59946ebf8 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2205,9 +2205,6 @@ sub setup_logic_surface_dataset { if ($flanduse_timeseries ne "null" && &value_is_true($nl_flags->{'use_cndv'}) ) { $log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with dynamic vegetation (use_cndv=.true)." ); } - if ($flanduse_timeseries ne "null" && &value_is_true($nl_flags->{'use_fates'}) ) { - $log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with ecosystem dynamics (use_fates=.true)." ); - } add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsurdat', 'hgrid'=>$nl_flags->{'res'}, 'sim_year'=>$nl_flags->{'sim_year'}, 'irrigate'=>$nl_flags->{'irrigate'}, From 045c894e2ee1b3e5437882748c9f4eb119142730 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 6 May 2020 13:36:05 -0600 Subject: [PATCH 1259/1973] adding harvest-type-resolved data structure and reading subroutine --- src/biogeochem/dynHarvestMod.F90 | 70 ++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/dynHarvestMod.F90 b/src/biogeochem/dynHarvestMod.F90 index e5dfffc56d..b7dce6a845 100644 --- a/src/biogeochem/dynHarvestMod.F90 +++ b/src/biogeochem/dynHarvestMod.F90 @@ -23,6 +23,7 @@ module dynHarvestMod use clm_varcon , only : grlnd use ColumnType , only : col use PatchType , only : patch + use clm_varctl , only : use_fates ! ! !PUBLIC MEMBER FUNCTIONS: implicit none @@ -50,6 +51,7 @@ module dynHarvestMod type(dyn_var_time_uninterp_type) :: harvest_inst(num_harvest_inst) ! value of each harvest variable real(r8) , allocatable :: harvest(:) ! harvest rates + real(r8) , allocatable :: harvest_typeresolved(:,:) ! harvest rates, resolved by harvest type logical :: do_harvest ! whether we're in a period when we should do harvest character(len=*), parameter :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set character(len=64) :: harvest_units = string_not_set ! units from harvest variables @@ -85,9 +87,16 @@ subroutine dynHarvest_init(bounds, harvest_filename) SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - allocate(harvest(bounds%begg:bounds%endg),stat=ier) - if (ier /= 0) then - call endrun(msg=' allocation error for harvest'//errMsg(sourcefile, __LINE__)) + if ( .not. use_fates ) then + allocate(harvest(bounds%begg:bounds%endg),stat=ier) + if (ier /= 0) then + call endrun(msg=' allocation error for harvest'//errMsg(sourcefile, __LINE__)) + end if + else + allocate(harvest_typeresolved(bounds%begg:bounds%endg, num_harvest_inst),stat=ier) + if (ier /= 0) then + call endrun(msg=' allocation error for harvest_typeresolved'//errMsg(sourcefile, __LINE__)) + end if end if ! Get the year from the START of the timestep for consistency with other dyn file @@ -173,6 +182,61 @@ subroutine dynHarvest_interp(bounds) end subroutine dynHarvest_interp + !----------------------------------------------------------------------- + subroutine dynHarvest_interp_resolve_harvesttypes(bounds) + ! + ! !DESCRIPTION: + ! Get harvest data for model time, when needed. + ! + ! Note that harvest data are stored as rates (not weights) and so time interpolation + ! is not necessary - the harvest rate is held constant through the year. This is + ! consistent with the treatment of changing PFT weights, where interpolation of the + ! annual endpoint weights leads to a constant rate of change in PFT weight through the + ! year, with abrupt changes in the rate at annual boundaries. + ! + ! Note the difference between this and dynHarvest_interp is that here, we keep the different + ! forcing sets distinct (e.g., for passing to FATES which has distinct primary and secondary lands) + ! and thus store it in harvest_typeresolved + ! + ! !USES: + use dynTimeInfoMod , only : time_info_type + ! + ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds ! proc-level bounds + ! + ! !LOCAL VARIABLES: + integer :: varnum ! counter for harvest variables + real(r8), allocatable :: this_data(:) ! data for a single harvest variable + + character(len=*), parameter :: subname = 'dynHarvest_interp' + !----------------------------------------------------------------------- + + SHR_ASSERT_ALL(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') + + call dynHarvest_file%time_info%set_current_year() + + ! Get total harvest for this time step + harvest_typeresolved(bounds%begg:bounds%endg,1:num_harvest_inst) = 0._r8 + + if (dynHarvest_file%time_info%is_before_time_series()) then + ! Turn off harvest before the start of the harvest time series + do_harvest = .false. + else + ! Note that do_harvest stays true even past the end of the time series. This + ! means that harvest rates will be maintained at the rate given in the last + ! year of the file for all years past the end of this specified time series. + do_harvest = .true. + allocate(this_data(bounds%begg:bounds%endg)) + do varnum = 1, num_harvest_inst + call harvest_inst(varnum)%get_current_data(this_data) + harvest_typeresolved(bounds%begg:bounds%endg,varnum) = this_data(bounds%begg:bounds%endg) + end do + deallocate(this_data) + end if + + end subroutine dynHarvest_interp_resolve_harvesttypes + + !----------------------------------------------------------------------- subroutine CNHarvest (num_soilc, filter_soilc, num_soilp, filter_soilp, & soilbiogeochem_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & From b79422e29b3f23b6b572b3c901a37cf28341a2f7 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 6 May 2020 20:37:16 -0600 Subject: [PATCH 1260/1973] some initial updates towards sending land-use drivers to fates --- bld/CLMBuildNamelist.pm | 13 +++++++----- src/biogeochem/EDBGCDynMod.F90 | 1 - src/biogeochem/dynHarvestMod.F90 | 23 +++++++++++----------- src/dyn_subgrid/dynSubgridControlMod.F90 | 8 ++------ src/utils/clmfates_interfaceMod.F90 | 25 ++++++++++++++++++++---- 5 files changed, 43 insertions(+), 27 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index b59946ebf8..f0b5ee1241 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2561,15 +2561,18 @@ sub setup_logic_do_harvest { # cannot_be_true will be set to a non-empty string in any case where # do_harvest should not be true; if it turns out that do_harvest IS true # in any of these cases, a fatal error will be generated - my $cannot_be_true = ""; + my $cannot_be_true = "" if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; - } elsif (!&value_is_true($nl->get_value('use_cn'))) { - $cannot_be_true = "$var can only be set to true when running with CN (use_cn = true)"; - } elsif (&value_is_true($nl->get_value('use_fates'))) { - $cannot_be_true = "$var currently doesn't work with ED"; } + #cdk disabling this for now, but probably there is a better way to do it. + #cdk elsif (!&value_is_true($nl->get_value('use_cn'))) { + #cdk $cannot_be_true = "$var can only be set to true when running with CN (use_cn = true)"; + #cdk } + #cdk elsif (&value_is_true($nl->get_value('use_fates'))) { + #cdk $cannot_be_true = "$var currently doesn't work with ED"; + #cdk } if ($cannot_be_true) { $default_val = ".false."; diff --git a/src/biogeochem/EDBGCDynMod.F90 b/src/biogeochem/EDBGCDynMod.F90 index 5096cf13fa..802ad4b247 100644 --- a/src/biogeochem/EDBGCDynMod.F90 +++ b/src/biogeochem/EDBGCDynMod.F90 @@ -71,7 +71,6 @@ subroutine EDBGCDyn(bounds, & use CNNStateUpdate1Mod , only: NStateUpdate1 use CNNStateUpdate2Mod , only: NStateUpdate2, NStateUpdate2h use CNGapMortalityMod , only: CNGapMortality - use dynHarvestMod , only: CNHarvest use SoilBiogeochemDecompCascadeBGCMod , only: decomp_rate_constants_bgc use SoilBiogeochemDecompCascadeCNMod , only: decomp_rate_constants_cn use SoilBiogeochemCompetitionMod , only: SoilBiogeochemCompetition diff --git a/src/biogeochem/dynHarvestMod.F90 b/src/biogeochem/dynHarvestMod.F90 index b7dce6a845..065c25283f 100644 --- a/src/biogeochem/dynHarvestMod.F90 +++ b/src/biogeochem/dynHarvestMod.F90 @@ -31,6 +31,8 @@ module dynHarvestMod ! public :: dynHarvest_init ! initialize data structures for harvest information public :: dynHarvest_interp ! get harvest data for current time step, if needed + public :: dynHarvest_interp_resolve_harvesttypes ! get harvest data for current time step, if needed, harvest-type-resolved + public :: get_harvest_rate public :: CNHarvest ! harvest mortality routine for CN code ! ! !PRIVATE MEMBER FUNCTIONS: @@ -51,7 +53,6 @@ module dynHarvestMod type(dyn_var_time_uninterp_type) :: harvest_inst(num_harvest_inst) ! value of each harvest variable real(r8) , allocatable :: harvest(:) ! harvest rates - real(r8) , allocatable :: harvest_typeresolved(:,:) ! harvest rates, resolved by harvest type logical :: do_harvest ! whether we're in a period when we should do harvest character(len=*), parameter :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set character(len=64) :: harvest_units = string_not_set ! units from harvest variables @@ -87,16 +88,12 @@ subroutine dynHarvest_init(bounds, harvest_filename) SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - if ( .not. use_fates ) then + ! we only need to keep this summary variable in CN veg type + if ( .not. use_fates ) then allocate(harvest(bounds%begg:bounds%endg),stat=ier) if (ier /= 0) then call endrun(msg=' allocation error for harvest'//errMsg(sourcefile, __LINE__)) end if - else - allocate(harvest_typeresolved(bounds%begg:bounds%endg, num_harvest_inst),stat=ier) - if (ier /= 0) then - call endrun(msg=' allocation error for harvest_typeresolved'//errMsg(sourcefile, __LINE__)) - end if end if ! Get the year from the START of the timestep for consistency with other dyn file @@ -183,7 +180,7 @@ end subroutine dynHarvest_interp !----------------------------------------------------------------------- - subroutine dynHarvest_interp_resolve_harvesttypes(bounds) + subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates) ! ! !DESCRIPTION: ! Get harvest data for model time, when needed. @@ -203,6 +200,7 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds) ! ! !ARGUMENTS: type(bounds_type), intent(in) :: bounds ! proc-level bounds + real(r8) , intent(out):: harvest_rates(bounds%begg: , 1: ) ! output the harvest rates ! ! !LOCAL VARIABLES: integer :: varnum ! counter for harvest variables @@ -215,8 +213,7 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds) call dynHarvest_file%time_info%set_current_year() - ! Get total harvest for this time step - harvest_typeresolved(bounds%begg:bounds%endg,1:num_harvest_inst) = 0._r8 + harvest_rates(bounds%begg:bounds%endg,1:num_harvest_inst) = 0._r8 if (dynHarvest_file%time_info%is_before_time_series()) then ! Turn off harvest before the start of the harvest time series @@ -229,13 +226,17 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds) allocate(this_data(bounds%begg:bounds%endg)) do varnum = 1, num_harvest_inst call harvest_inst(varnum)%get_current_data(this_data) - harvest_typeresolved(bounds%begg:bounds%endg,varnum) = this_data(bounds%begg:bounds%endg) + harvest_rates(bounds%begg:bounds%endg,varnum) = this_data(bounds%begg:bounds%endg) end do deallocate(this_data) end if end subroutine dynHarvest_interp_resolve_harvesttypes + subroutine get_harvest_rate(soilc + + end subroutine get_harvest_rate + !----------------------------------------------------------------------- subroutine CNHarvest (num_soilc, filter_soilc, num_soilp, filter_soilp, & diff --git a/src/dyn_subgrid/dynSubgridControlMod.F90 b/src/dyn_subgrid/dynSubgridControlMod.F90 index 3820d6392a..3e077a036c 100644 --- a/src/dyn_subgrid/dynSubgridControlMod.F90 +++ b/src/dyn_subgrid/dynSubgridControlMod.F90 @@ -267,12 +267,8 @@ subroutine check_namelist_consistency end if if (dyn_subgrid_control_inst%do_harvest) then - if (.not. use_cn) then - write(iulog,*) 'ERROR: do_harvest can only be true if use_cn is true' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (use_fates) then - write(iulog,*) 'ERROR: do_harvest currently does not work with use_fates' + if (.not. (use_cn .or. use_fates)) then + write(iulog,*) 'ERROR: do_harvest can only be true if either use_cn or use_fates are true' call endrun(msg=errMsg(sourcefile, __LINE__)) end if end if diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 2d23472fd7..631673a6ac 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -138,8 +138,11 @@ module CLMFatesInterfaceMod use FatesPlantHydraulicsMod, only : InitHydrSites use FatesPlantHydraulicsMod, only : RestartHydrStates use FATESFireBase , only : fates_fire_base_type - use CNFireFactoryMod, only: no_fire, scalar_lightning, & - successful_ignitions, anthro_ignitions + use CNFireFactoryMod , only : no_fire, scalar_lightning, & + successful_ignitions, anthro_ignitions + use dynSubgridControlMod , only : get_do_harvest + use dynHarvestMod , only : num_harvest_inst, & + dynHarvest_interp_resolve_harvesttypes implicit none @@ -664,6 +667,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: s ! site index integer :: g ! grid-cell index (HLM) integer :: c ! column index (HLM) + integer :: g ! gridcell index (HLM) integer :: ifp ! patch index integer :: p ! HLM patch index integer :: yr ! year (0, ...) @@ -684,6 +688,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, & real(r8) :: day_of_year real(r8), pointer :: lnfm24(:) integer :: ier + integer :: begg,endg + real(r8) :: harvest_rates(bounds_clump%begg:bounds_clump%endg,num_harvest_inst) !----------------------------------------------------------------------- ! --------------------------------------------------------------------------------- @@ -695,6 +701,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! and it keeps all the boundaries in one location ! --------------------------------------------------------------------------------- + begg = bounds_clump%begg; endg = bounds_clump%endg + days_per_year = get_days_per_year() call get_curr_date(current_year,current_month,current_day,current_tod) current_date = current_year*10000 + current_month*100 + current_day @@ -713,6 +721,11 @@ subroutine dynamics_driv(this, nc, bounds_clump, & model_day, floor(day_of_year), & days_per_year, 1.0_r8/dble(days_per_year)) + if (get_do_harvest()) then + call dynHarvest_interp_resolve_harvesttypes(bounds_clump, & + harvest_rates=harvest_rates(begg:endg,1:num_harvest_inst)) + endif + if (fates_spitfire_mode > scalar_lightning) then allocate(lnfm24(bounds_clump%begg:bounds_clump%endg), stat=ier) if (ier /= 0) then @@ -725,9 +738,9 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s=1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) + g = col%gricell(c) if (fates_spitfire_mode > scalar_lightning) then - g = col%gridcell(c) do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno p = ifp + col%patchi(c) @@ -760,6 +773,11 @@ subroutine dynamics_driv(this, nc, bounds_clump, & end do + if (get_do_harvest()) then + do iharv = 1, num_harvest_inst + this%fates(nc)%bc_in(s)%harvest_rates(iharv) = harvest_rates(g,iharv) + end do + endif if(use_fates_planthydro)then this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoil) = soilstate_inst%hksat_col(c,1:nlevsoil) @@ -769,7 +787,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoil) = soilstate_inst%bsw_col(c,1:nlevsoil) this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoil) = waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoil) end if - end do From dc461526132534b585076155277ecc34efad3d2c Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 20 May 2020 10:50:14 -0600 Subject: [PATCH 1261/1973] first attempt to link ctsm to fates with harvest --- src/biogeochem/dynHarvestMod.F90 | 32 ++++++++++------------- src/utils/clmfates_interfaceMod.F90 | 40 ++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/src/biogeochem/dynHarvestMod.F90 b/src/biogeochem/dynHarvestMod.F90 index 065c25283f..464808ed4d 100644 --- a/src/biogeochem/dynHarvestMod.F90 +++ b/src/biogeochem/dynHarvestMod.F90 @@ -32,7 +32,6 @@ module dynHarvestMod public :: dynHarvest_init ! initialize data structures for harvest information public :: dynHarvest_interp ! get harvest data for current time step, if needed public :: dynHarvest_interp_resolve_harvesttypes ! get harvest data for current time step, if needed, harvest-type-resolved - public :: get_harvest_rate public :: CNHarvest ! harvest mortality routine for CN code ! ! !PRIVATE MEMBER FUNCTIONS: @@ -54,8 +53,10 @@ module dynHarvestMod real(r8) , allocatable :: harvest(:) ! harvest rates logical :: do_harvest ! whether we're in a period when we should do harvest - character(len=*), parameter :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set - character(len=64) :: harvest_units = string_not_set ! units from harvest variables + character(len=*), parameter :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set + character(len=64) :: harvest_units = string_not_set ! units from harvest variables + character(len=64), parameter :: mass_units = "gC/m2/yr" + character(len=64), parameter :: unitless_units = "unitless" character(len=*), parameter, private :: sourcefile = & __FILE__ !--------------------------------------------------------------------------- @@ -110,10 +111,10 @@ subroutine dynHarvest_init(bounds, harvest_filename) do_check_sums_equal_1=.false., data_shape=[num_points]) call harvest_inst(varnum)%get_att("units",units) if ( trim(units) == string_not_set ) then - units = "unitless" - else if ( trim(units) == "unitless" ) then + units = unitless_units + else if ( trim(units) == unitless_units ) then - else if ( trim(units) /= "gC/m2/yr" ) then + else if ( trim(units) /= mass_units ) then call endrun(msg=' bad units read in from file='//trim(units)//errMsg(sourcefile, __LINE__)) end if if ( varnum > 1 .and. trim(units) /= trim(harvest_units) )then @@ -123,7 +124,7 @@ subroutine dynHarvest_init(bounds, harvest_filename) harvest_units = units units = string_not_set end do - + end subroutine dynHarvest_init @@ -180,7 +181,7 @@ end subroutine dynHarvest_interp !----------------------------------------------------------------------- - subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates) + subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates, after_start_of_harvest_ts) ! ! !DESCRIPTION: ! Get harvest data for model time, when needed. @@ -201,6 +202,7 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates) ! !ARGUMENTS: type(bounds_type), intent(in) :: bounds ! proc-level bounds real(r8) , intent(out):: harvest_rates(bounds%begg: , 1: ) ! output the harvest rates + logical , intent(out):: after_start_of_harvest_ts ! ! !LOCAL VARIABLES: integer :: varnum ! counter for harvest variables @@ -213,16 +215,15 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates) call dynHarvest_file%time_info%set_current_year() - harvest_rates(bounds%begg:bounds%endg,1:num_harvest_inst) = 0._r8 - if (dynHarvest_file%time_info%is_before_time_series()) then ! Turn off harvest before the start of the harvest time series - do_harvest = .false. + after_start_of_harvest_ts = .false. + harvest_rates(bounds%begg:bounds%endg,1:num_harvest_inst) = 0._r8 else ! Note that do_harvest stays true even past the end of the time series. This ! means that harvest rates will be maintained at the rate given in the last ! year of the file for all years past the end of this specified time series. - do_harvest = .true. + after_start_of_harvest_ts = .true. allocate(this_data(bounds%begg:bounds%endg)) do varnum = 1, num_harvest_inst call harvest_inst(varnum)%get_current_data(this_data) @@ -233,11 +234,6 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates) end subroutine dynHarvest_interp_resolve_harvesttypes - subroutine get_harvest_rate(soilc - - end subroutine get_harvest_rate - - !----------------------------------------------------------------------- subroutine CNHarvest (num_soilc, filter_soilc, num_soilp, filter_soilp, & soilbiogeochem_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & @@ -374,7 +370,7 @@ subroutine CNHarvest (num_soilc, filter_soilc, num_soilp, filter_soilp, & if (ivt(p) > noveg .and. ivt(p) < nbrdlf_evr_shrub) then if (do_harvest) then - if (harvest_units == "gC/m2/yr") then + if (harvest_units == mass_units) then thistreec = leafc(p) + frootc(p) + livestemc(p) + deadstemc(p) + livecrootc(p) + deadcrootc(p) + xsmrpool(p) cm = harvest(g) if (thistreec > 0.0_r8) then diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 631673a6ac..b67df4df84 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -141,8 +141,9 @@ module CLMFatesInterfaceMod use CNFireFactoryMod , only : no_fire, scalar_lightning, & successful_ignitions, anthro_ignitions use dynSubgridControlMod , only : get_do_harvest - use dynHarvestMod , only : num_harvest_inst, & - dynHarvest_interp_resolve_harvesttypes + use dynHarvestMod , only : num_harvest_inst, harvest_varnames + use dynHarvestMod , only : harvest_units, mass_units, unitless_units + use dynHarvestMod , only : dynHarvest_interp_resolve_harvesttypes implicit none @@ -321,6 +322,24 @@ subroutine CLMFatesGlobals() else pass_logging = 0 end if + if(get_do_harvest()) then + pass_logging = 1 + pass_num_lu_harvest_cats = num_harvest_inst + if (wood_harvest_units .eq. unitless_units) then + pass_lu_harvest = 1 + else if (wood_harvest_units .eq. mass_units) then + pass_lu_harvest = 2 + else + write(iulog,*) 'units field not one of the specified options.' + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + else + pass_lu_harvest = 0 + pass_num_lu_harvest_cats = 0 + end if + + call set_fates_ctrlparms('use_lu_harvest',ival=pass_lu_harvest) + call set_fates_ctrlparms('num_lu_harvest_cats',ival=pass_num_lu_harvest_cats) call set_fates_ctrlparms('use_logging',ival=pass_logging) if(use_fates_ed_prescribed_phys) then @@ -529,7 +548,7 @@ subroutine init(this, bounds_proc ) ndecomp = 1 end if - call allocate_bcin(this%fates(nc)%bc_in(s),col%nbedrock(c),ndecomp) + call allocate_bcin(this%fates(nc)%bc_in(s),col%nbedrock(c),ndecomp, num_harvest_inst) call allocate_bcout(this%fates(nc)%bc_out(s),col%nbedrock(c),ndecomp) call zero_bcs(this%fates(nc),s) @@ -690,6 +709,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: ier integer :: begg,endg real(r8) :: harvest_rates(bounds_clump%begg:bounds_clump%endg,num_harvest_inst) + logical :: after_start_of_harvest_ts !----------------------------------------------------------------------- ! --------------------------------------------------------------------------------- @@ -723,7 +743,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, & if (get_do_harvest()) then call dynHarvest_interp_resolve_harvesttypes(bounds_clump, & - harvest_rates=harvest_rates(begg:endg,1:num_harvest_inst)) + harvest_rates=harvest_rates(begg:endg,1:num_harvest_inst), & + after_start_of_harvest_ts) endif if (fates_spitfire_mode > scalar_lightning) then @@ -788,6 +809,17 @@ subroutine dynamics_driv(this, nc, bounds_clump, & this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoil) = waterstatebulk_inst%h2osoi_liq_col(c,1:nlevsoil) end if + ! get the harvest data, which is by gridcell + ! for now there is one veg column per gridcell, so store all harvest data in each site + ! this will eventually change + ! today's hlm harvest flag needs to be set no matter what + g = col_pp%gridcell(c) + this%fates(nc)%bc_in(s)%hlm_do_harvest_today = do_harvest + if (do_harvest) then + this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = harvest_rates(1:num_harvest_inst,g) + this%fates(nc)%bc_in(s)%hlm_harvest_catnames = harvest_catnames + end if + end do ! --------------------------------------------------------------------------------- From f629d6a8375841419684a95141bef69b6399f85f Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 20 May 2020 21:37:08 -0600 Subject: [PATCH 1262/1973] bugfixes to get ctsm to compile and run --- src/biogeochem/dynHarvestMod.F90 | 12 ++-- src/dyn_subgrid/dynSubgridDriverMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 76 ++++++++++++++----------- 3 files changed, 51 insertions(+), 39 deletions(-) diff --git a/src/biogeochem/dynHarvestMod.F90 b/src/biogeochem/dynHarvestMod.F90 index 464808ed4d..afd3fd1152 100644 --- a/src/biogeochem/dynHarvestMod.F90 +++ b/src/biogeochem/dynHarvestMod.F90 @@ -45,18 +45,18 @@ module dynHarvestMod type(dyn_file_type), target :: dynHarvest_file ! information for the file containing harvest data ! Define the underlying harvest variables - integer, parameter :: num_harvest_inst = 5 - character(len=64), parameter :: harvest_varnames(num_harvest_inst) = & + integer, parameter, public :: num_harvest_inst = 5 + character(len=64), parameter, public :: harvest_varnames(num_harvest_inst) = & [character(len=64) :: 'HARVEST_VH1', 'HARVEST_VH2', 'HARVEST_SH1', 'HARVEST_SH2', 'HARVEST_SH3'] type(dyn_var_time_uninterp_type) :: harvest_inst(num_harvest_inst) ! value of each harvest variable real(r8) , allocatable :: harvest(:) ! harvest rates - logical :: do_harvest ! whether we're in a period when we should do harvest + logical, public, protected :: do_harvest ! whether we're in a period when we should do harvest character(len=*), parameter :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set - character(len=64) :: harvest_units = string_not_set ! units from harvest variables - character(len=64), parameter :: mass_units = "gC/m2/yr" - character(len=64), parameter :: unitless_units = "unitless" + character(len=64), public, protected :: harvest_units = string_not_set ! units from harvest variables + character(len=64), parameter, public :: mass_units = "gC/m2/yr" + character(len=64), parameter, public :: unitless_units = "unitless" character(len=*), parameter, private :: sourcefile = & __FILE__ !--------------------------------------------------------------------------- diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index 73c3f9e4b0..a6d91778fd 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -241,7 +241,7 @@ subroutine dynSubgrid_driver(bounds_proc, call dyncrop_interp(bounds_proc,crop_inst) end if - if (get_do_harvest()) then + if (get_do_harvest() .and. .not. use_fates) then call dynHarvest_interp(bounds_proc) end if diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index b67df4df84..9332bf3060 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -247,6 +247,8 @@ subroutine CLMFatesGlobals() integer :: pass_vertsoilc integer :: pass_spitfire integer :: pass_ed_st3 + integer :: pass_num_lu_harvest_cats + integer :: pass_lu_harvest integer :: pass_logging integer :: pass_ed_prescribed_phys integer :: pass_planthydro @@ -322,24 +324,6 @@ subroutine CLMFatesGlobals() else pass_logging = 0 end if - if(get_do_harvest()) then - pass_logging = 1 - pass_num_lu_harvest_cats = num_harvest_inst - if (wood_harvest_units .eq. unitless_units) then - pass_lu_harvest = 1 - else if (wood_harvest_units .eq. mass_units) then - pass_lu_harvest = 2 - else - write(iulog,*) 'units field not one of the specified options.' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - else - pass_lu_harvest = 0 - pass_num_lu_harvest_cats = 0 - end if - - call set_fates_ctrlparms('use_lu_harvest',ival=pass_lu_harvest) - call set_fates_ctrlparms('num_lu_harvest_cats',ival=pass_num_lu_harvest_cats) call set_fates_ctrlparms('use_logging',ival=pass_logging) if(use_fates_ed_prescribed_phys) then @@ -362,6 +346,36 @@ subroutine CLMFatesGlobals() pass_cohort_age_tracking = 0 end if call set_fates_ctrlparms('use_cohort_age_tracking',ival=pass_cohort_age_tracking) + + ! check fates logging namelist value first because hlm harvest overrides it + if(use_fates_logging) then + pass_logging = 1 + else + pass_logging = 0 + end if + + if(get_do_harvest()) then + pass_logging = 1 + pass_num_lu_harvest_cats = num_harvest_inst + ! !!! cdk fo rnow set this inline because harvest_units is being set after this + ! if (trim(harvest_units) .eq. trim(unitless_units)) then + ! pass_lu_harvest = 1 + ! else if (trim(harvest_units) .eq. trim(mass_units)) then + ! pass_lu_harvest = 2 + ! else + ! write(iulog,*) 'units field not one of the specified options.' + ! write(iulog,*) harvest_units + ! call endrun(msg=errMsg(sourcefile, __LINE__)) + ! end if + pass_lu_harvest = 1 + else + pass_lu_harvest = 0 + pass_num_lu_harvest_cats = 0 + end if + + call set_fates_ctrlparms('use_lu_harvest',ival=pass_lu_harvest) + call set_fates_ctrlparms('num_lu_harvest_cats',ival=pass_num_lu_harvest_cats) + call set_fates_ctrlparms('use_logging',ival=pass_logging) if(use_fates_inventory_init) then pass_inventory_init = 1 @@ -710,6 +724,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: begg,endg real(r8) :: harvest_rates(bounds_clump%begg:bounds_clump%endg,num_harvest_inst) logical :: after_start_of_harvest_ts + integer :: iharv !----------------------------------------------------------------------- ! --------------------------------------------------------------------------------- @@ -744,7 +759,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & if (get_do_harvest()) then call dynHarvest_interp_resolve_harvesttypes(bounds_clump, & harvest_rates=harvest_rates(begg:endg,1:num_harvest_inst), & - after_start_of_harvest_ts) + after_start_of_harvest_ts=after_start_of_harvest_ts) endif if (fates_spitfire_mode > scalar_lightning) then @@ -759,7 +774,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s=1,this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) - g = col%gricell(c) + g = col%gridcell(c) if (fates_spitfire_mode > scalar_lightning) then do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno @@ -793,12 +808,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & atm2lnd_inst%wind24_patch(p) end do - - if (get_do_harvest()) then - do iharv = 1, num_harvest_inst - this%fates(nc)%bc_in(s)%harvest_rates(iharv) = harvest_rates(g,iharv) - end do - endif if(use_fates_planthydro)then this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoil) = soilstate_inst%hksat_col(c,1:nlevsoil) @@ -813,12 +822,15 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! for now there is one veg column per gridcell, so store all harvest data in each site ! this will eventually change ! today's hlm harvest flag needs to be set no matter what - g = col_pp%gridcell(c) - this%fates(nc)%bc_in(s)%hlm_do_harvest_today = do_harvest - if (do_harvest) then - this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = harvest_rates(1:num_harvest_inst,g) - this%fates(nc)%bc_in(s)%hlm_harvest_catnames = harvest_catnames - end if + if (get_do_harvest()) then + this%fates(nc)%bc_in(s)%hlm_do_harvest_today = after_start_of_harvest_ts + if (after_start_of_harvest_ts) then + this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = harvest_rates(1:num_harvest_inst,g) + else + this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = 0._r8 + end if + this%fates(nc)%bc_in(s)%hlm_harvest_catnames(1:num_harvest_inst) = harvest_varnames(1:num_harvest_inst) + endif end do From 5dc01b2c7e03e881426609c0531646aca2ec3ff0 Mon Sep 17 00:00:00 2001 From: ckoven Date: Thu, 28 May 2020 11:16:33 -0600 Subject: [PATCH 1263/1973] fixed runtime bugs --- src/biogeochem/dynHarvestMod.F90 | 3 ++- src/utils/clmfates_interfaceMod.F90 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/dynHarvestMod.F90 b/src/biogeochem/dynHarvestMod.F90 index afd3fd1152..a7694d9c84 100644 --- a/src/biogeochem/dynHarvestMod.F90 +++ b/src/biogeochem/dynHarvestMod.F90 @@ -211,7 +211,8 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates, after_s character(len=*), parameter :: subname = 'dynHarvest_interp' !----------------------------------------------------------------------- - SHR_ASSERT_ALL(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') + !!! NOTE I AM NOT USING THE BOUNDS_LEVEL_PROC ASSERTION HERE BECAUSE OF WHERE IN THE CALLING + !!! SEQUENCE THIS IS CALLED. I THINK THIS IS SAFE BUT NEED TO CONFIRM. --CDK call dynHarvest_file%time_info%set_current_year() diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 9332bf3060..9e2927cfd4 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -825,7 +825,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & if (get_do_harvest()) then this%fates(nc)%bc_in(s)%hlm_do_harvest_today = after_start_of_harvest_ts if (after_start_of_harvest_ts) then - this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = harvest_rates(1:num_harvest_inst,g) + this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = harvest_rates(g,1:num_harvest_inst) else this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = 0._r8 end if From d2e1befc694afecae5bbf735d6857a54b7b59695 Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 9 Jun 2020 13:51:28 -0600 Subject: [PATCH 1264/1973] added pass of bc_in to history dynamics subroutine to allow outputting logging BCs to history --- src/utils/clmfates_interfaceMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 9e2927cfd4..f4f14179e2 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -898,7 +898,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! --------------------------------------------------------------------------------- call this%fates_hist%update_history_dyn( nc, & this%fates(nc)%nsites, & - this%fates(nc)%sites) + this%fates(nc)%sites, this%fates(nc)%bc_in) if (masterproc) then write(iulog, *) 'clm: leaving fates model', bounds_clump%begg, & @@ -1355,7 +1355,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & ! ------------------------------------------------------------------------ call this%fates_hist%update_history_dyn( nc, & this%fates(nc)%nsites, & - this%fates(nc)%sites) + this%fates(nc)%sites, this%fates(nc)%bc_in) end if @@ -1468,7 +1468,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & ! ------------------------------------------------------------------------ call this%fates_hist%update_history_dyn( nc, & this%fates(nc)%nsites, & - this%fates(nc)%sites) + this%fates(nc)%sites, this%fates(nc)%bc_in) From 3a55f8346303eef431affb8c7c8be78102663e2e Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 9 Jun 2020 13:51:34 -0600 Subject: [PATCH 1265/1973] Revert "added pass of bc_in to history dynamics subroutine to allow outputting logging BCs to history" This reverts commit c18af043933f0f3aed2920e28b1baa15453f84ab. --- src/utils/clmfates_interfaceMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index f4f14179e2..9e2927cfd4 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -898,7 +898,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! --------------------------------------------------------------------------------- call this%fates_hist%update_history_dyn( nc, & this%fates(nc)%nsites, & - this%fates(nc)%sites, this%fates(nc)%bc_in) + this%fates(nc)%sites) if (masterproc) then write(iulog, *) 'clm: leaving fates model', bounds_clump%begg, & @@ -1355,7 +1355,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & ! ------------------------------------------------------------------------ call this%fates_hist%update_history_dyn( nc, & this%fates(nc)%nsites, & - this%fates(nc)%sites, this%fates(nc)%bc_in) + this%fates(nc)%sites) end if @@ -1468,7 +1468,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & ! ------------------------------------------------------------------------ call this%fates_hist%update_history_dyn( nc, & this%fates(nc)%nsites, & - this%fates(nc)%sites, this%fates(nc)%bc_in) + this%fates(nc)%sites) From 07e6e7f9f8f86239f6722b2cbf2d44ab6ce38652 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 1 Jul 2020 16:38:18 -0600 Subject: [PATCH 1266/1973] made a bunch of changes based on code review --- bld/CLMBuildNamelist.pm | 23 ++++++++++------------- src/biogeochem/dynHarvestMod.F90 | 5 +---- src/utils/clmfates_interfaceMod.F90 | 5 ++--- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index f0b5ee1241..448c3d9b1f 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2563,20 +2563,17 @@ sub setup_logic_do_harvest { # in any of these cases, a fatal error will be generated my $cannot_be_true = "" - if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { - $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; - } - #cdk disabling this for now, but probably there is a better way to do it. - #cdk elsif (!&value_is_true($nl->get_value('use_cn'))) { - #cdk $cannot_be_true = "$var can only be set to true when running with CN (use_cn = true)"; - #cdk } - #cdk elsif (&value_is_true($nl->get_value('use_fates'))) { - #cdk $cannot_be_true = "$var currently doesn't work with ED"; - #cdk } + if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { + $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; + } - if ($cannot_be_true) { - $default_val = ".false."; - } + elsif (!&value_is_true($nl->get_value('use_cn')) && !&value_is_true($nl->get_value('use_fates'))) { + $cannot_be_true = "$var can only be set to true when running with either CN or FATES"; + } + + if ($cannot_be_true) { + $default_val = ".false."; + } if (!$cannot_be_true) { # Note that, if the variable cannot be true, we don't call add_default diff --git a/src/biogeochem/dynHarvestMod.F90 b/src/biogeochem/dynHarvestMod.F90 index a7694d9c84..4c6ae9b105 100644 --- a/src/biogeochem/dynHarvestMod.F90 +++ b/src/biogeochem/dynHarvestMod.F90 @@ -200,7 +200,7 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates, after_s use dynTimeInfoMod , only : time_info_type ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! proc-level bounds + type(bounds_type), intent(in) :: bounds real(r8) , intent(out):: harvest_rates(bounds%begg: , 1: ) ! output the harvest rates logical , intent(out):: after_start_of_harvest_ts ! @@ -211,9 +211,6 @@ subroutine dynHarvest_interp_resolve_harvesttypes(bounds, harvest_rates, after_s character(len=*), parameter :: subname = 'dynHarvest_interp' !----------------------------------------------------------------------- - !!! NOTE I AM NOT USING THE BOUNDS_LEVEL_PROC ASSERTION HERE BECAUSE OF WHERE IN THE CALLING - !!! SEQUENCE THIS IS CALLED. I THINK THIS IS SAFE BUT NEED TO CONFIRM. --CDK - call dynHarvest_file%time_info%set_current_year() if (dynHarvest_file%time_info%is_before_time_series()) then diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 9e2927cfd4..ec6a2f1a7b 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -823,11 +823,10 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! this will eventually change ! today's hlm harvest flag needs to be set no matter what if (get_do_harvest()) then - this%fates(nc)%bc_in(s)%hlm_do_harvest_today = after_start_of_harvest_ts if (after_start_of_harvest_ts) then - this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = harvest_rates(g,1:num_harvest_inst) + this%fates(nc)%bc_in(s)%hlm_harvest_rates(1:num_harvest_inst) = harvest_rates(g,1:num_harvest_inst) else - this%fates(nc)%bc_in(s)%hlm_harvest(1:num_harvest_inst) = 0._r8 + this%fates(nc)%bc_in(s)%hlm_harvest_rates(1:num_harvest_inst) = 0._r8 end if this%fates(nc)%bc_in(s)%hlm_harvest_catnames(1:num_harvest_inst) = harvest_varnames(1:num_harvest_inst) endif From 0ca2231acb0bc84c413ebc369005e9449f5df320 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 1 Jul 2020 20:07:58 -0600 Subject: [PATCH 1267/1973] moved harvest unit specification to bc_in structure --- src/utils/clmfates_interfaceMod.F90 | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index ec6a2f1a7b..d01cf18645 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -144,6 +144,8 @@ module CLMFatesInterfaceMod use dynHarvestMod , only : num_harvest_inst, harvest_varnames use dynHarvestMod , only : harvest_units, mass_units, unitless_units use dynHarvestMod , only : dynHarvest_interp_resolve_harvesttypes + use FatesConstantsMod , only : hlm_harvest_area_fraction + use FatesConstantsMod , only : hlm_harvest_carbon implicit none @@ -357,16 +359,6 @@ subroutine CLMFatesGlobals() if(get_do_harvest()) then pass_logging = 1 pass_num_lu_harvest_cats = num_harvest_inst - ! !!! cdk fo rnow set this inline because harvest_units is being set after this - ! if (trim(harvest_units) .eq. trim(unitless_units)) then - ! pass_lu_harvest = 1 - ! else if (trim(harvest_units) .eq. trim(mass_units)) then - ! pass_lu_harvest = 2 - ! else - ! write(iulog,*) 'units field not one of the specified options.' - ! write(iulog,*) harvest_units - ! call endrun(msg=errMsg(sourcefile, __LINE__)) - ! end if pass_lu_harvest = 1 else pass_lu_harvest = 0 @@ -829,6 +821,19 @@ subroutine dynamics_driv(this, nc, bounds_clump, & this%fates(nc)%bc_in(s)%hlm_harvest_rates(1:num_harvest_inst) = 0._r8 end if this%fates(nc)%bc_in(s)%hlm_harvest_catnames(1:num_harvest_inst) = harvest_varnames(1:num_harvest_inst) + + ! also pass the units that the harvest rates are specified in + if (trim(harvest_units) .eq. trim(unitless_units)) then + this%fates(nc)%bc_in(s)%hlm_harvest_units = hlm_harvest_area_fraction + else if (trim(harvest_units) .eq. trim(mass_units)) then + this%fates(nc)%bc_in(s)%hlm_harvest_units = hlm_harvest_carbon + else + write(iulog,*) 'units field not one of the specified options.' + write(iulog,*) harvest_units + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + + endif end do From 1cfb7a7d988905597723e58b3572c45ad7d876af Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 28 Jul 2020 16:04:52 -0600 Subject: [PATCH 1268/1973] fixing changes requested in code review --- src/{biogeochem => dyn_subgrid}/dynHarvestMod.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename src/{biogeochem => dyn_subgrid}/dynHarvestMod.F90 (99%) diff --git a/src/biogeochem/dynHarvestMod.F90 b/src/dyn_subgrid/dynHarvestMod.F90 similarity index 99% rename from src/biogeochem/dynHarvestMod.F90 rename to src/dyn_subgrid/dynHarvestMod.F90 index 4c6ae9b105..a08c71ff1d 100644 --- a/src/biogeochem/dynHarvestMod.F90 +++ b/src/dyn_subgrid/dynHarvestMod.F90 @@ -29,10 +29,10 @@ module dynHarvestMod implicit none private ! - public :: dynHarvest_init ! initialize data structures for harvest information - public :: dynHarvest_interp ! get harvest data for current time step, if needed - public :: dynHarvest_interp_resolve_harvesttypes ! get harvest data for current time step, if needed, harvest-type-resolved - public :: CNHarvest ! harvest mortality routine for CN code + public :: dynHarvest_init ! initialize data structures for harvest information, used by both FATES and no-FATES + public :: dynHarvest_interp ! get harvest data for current time step, if needed, only used by non-FATES + public :: dynHarvest_interp_resolve_harvesttypes ! get harvest data for current time step, if needed, harvest-type-resolved. only used by FATES. + public :: CNHarvest ! harvest mortality routine for CN code, only used by non-FATES ! ! !PRIVATE MEMBER FUNCTIONS: private :: CNHarvestPftToColumn ! gather patch-level harvest fluxes to the column level @@ -52,8 +52,8 @@ module dynHarvestMod type(dyn_var_time_uninterp_type) :: harvest_inst(num_harvest_inst) ! value of each harvest variable real(r8) , allocatable :: harvest(:) ! harvest rates - logical, public, protected :: do_harvest ! whether we're in a period when we should do harvest - character(len=*), parameter :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set + logical, :: do_harvest ! whether we're in a period when we should do harvest + character(len=*), parameter, private :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set character(len=64), public, protected :: harvest_units = string_not_set ! units from harvest variables character(len=64), parameter, public :: mass_units = "gC/m2/yr" character(len=64), parameter, public :: unitless_units = "unitless" From 89e277e627360e8bb15c57f1167d1145e6e315fa Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 28 Jul 2020 16:19:57 -0600 Subject: [PATCH 1269/1973] compile-time bugfixes on prior --- src/dyn_subgrid/dynHarvestMod.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dyn_subgrid/dynHarvestMod.F90 b/src/dyn_subgrid/dynHarvestMod.F90 index a08c71ff1d..db5b0d25e1 100644 --- a/src/dyn_subgrid/dynHarvestMod.F90 +++ b/src/dyn_subgrid/dynHarvestMod.F90 @@ -29,10 +29,10 @@ module dynHarvestMod implicit none private ! - public :: dynHarvest_init ! initialize data structures for harvest information, used by both FATES and no-FATES - public :: dynHarvest_interp ! get harvest data for current time step, if needed, only used by non-FATES + public :: dynHarvest_init ! initialize data structures for harvest information, used by both FATES and non-FATES/CN + public :: dynHarvest_interp ! get harvest data for current time step, if needed, only used by non-FATES/CN public :: dynHarvest_interp_resolve_harvesttypes ! get harvest data for current time step, if needed, harvest-type-resolved. only used by FATES. - public :: CNHarvest ! harvest mortality routine for CN code, only used by non-FATES + public :: CNHarvest ! harvest mortality routine for CN code, only used by non-FATES/CN ! ! !PRIVATE MEMBER FUNCTIONS: private :: CNHarvestPftToColumn ! gather patch-level harvest fluxes to the column level @@ -52,7 +52,7 @@ module dynHarvestMod type(dyn_var_time_uninterp_type) :: harvest_inst(num_harvest_inst) ! value of each harvest variable real(r8) , allocatable :: harvest(:) ! harvest rates - logical, :: do_harvest ! whether we're in a period when we should do harvest + logical, private :: do_harvest ! whether we're in a period when we should do harvest character(len=*), parameter, private :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set character(len=64), public, protected :: harvest_units = string_not_set ! units from harvest variables character(len=64), parameter, public :: mass_units = "gC/m2/yr" From bf0d97a7d048dddabc881263f9ca3b9c7e7936c2 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 14 Jul 2020 10:44:41 -0700 Subject: [PATCH 1270/1973] applying GetAndSetTime patch --- src/utils/clmfates_interfaceMod.F90 | 105 +++++++++++++++++++--------- 1 file changed, 72 insertions(+), 33 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index d01cf18645..fb19461556 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -222,6 +222,11 @@ module CLMFatesInterfaceMod ! developer will at least question its usage (RGK) private :: hlm_bounds_to_fates_bounds + ! The GetAndSetTime function is used to get the current time from the CLM + ! time procedures and then set to the fates global time variables during restart, + ! init_coldstart, and dynamics_driv function calls + private :: GetAndSetTime + logical :: debug = .false. character(len=*), parameter, private :: sourcefile = & @@ -695,22 +700,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: g ! gridcell index (HLM) integer :: ifp ! patch index integer :: p ! HLM patch index - integer :: yr ! year (0, ...) - integer :: mon ! month (1, ..., 12) - integer :: day ! day of month (1, ..., 31) - integer :: sec ! seconds of the day integer :: nlevsoil ! number of soil layers at the site integer :: nld_si ! site specific number of decomposition layers - integer :: current_year - integer :: current_month - integer :: current_day - integer :: current_tod - integer :: current_date - integer :: jan01_curr_year - integer :: reference_date - integer :: days_per_year - real(r8) :: model_day - real(r8) :: day_of_year real(r8), pointer :: lnfm24(:) integer :: ier integer :: begg,endg @@ -730,23 +721,8 @@ subroutine dynamics_driv(this, nc, bounds_clump, & begg = bounds_clump%begg; endg = bounds_clump%endg - days_per_year = get_days_per_year() - call get_curr_date(current_year,current_month,current_day,current_tod) - current_date = current_year*10000 + current_month*100 + current_day - jan01_curr_year = current_year*10000 + 100 + 1 - - call get_ref_date(yr, mon, day, sec) - reference_date = yr*10000 + mon*100 + day - - call timemgr_datediff(reference_date, sec, current_date, current_tod, model_day) - - call timemgr_datediff(jan01_curr_year,0,current_date,sec,day_of_year) - - call SetFatesTime(current_year, current_month, & - current_day, current_tod, & - current_date, reference_date, & - model_day, floor(day_of_year), & - days_per_year, 1.0_r8/dble(days_per_year)) + ! Set the FATES global time and date variables + call GetAndSetTime if (get_do_harvest()) then call dynHarvest_interp_resolve_harvesttypes(bounds_clump, & @@ -1150,6 +1126,9 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & ! I think that is it... ! --------------------------------------------------------------------------------- + ! Set the FATES global time and date variables + call GetAndSetTime + if(.not.initialized) then initialized=.true. @@ -1352,8 +1331,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & call this%fates_restart%update_3dpatch_radiation(this%fates(nc)%nsites, & this%fates(nc)%sites, & this%fates(nc)%bc_out) - - + ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ @@ -1396,6 +1374,10 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & integer :: s integer :: c + + ! Set the FATES global time and date variables + call GetAndSetTime + nclumps = get_proc_clumps() !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,s,c,j,vol_ice,eff_porosity) @@ -2753,4 +2735,61 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) end subroutine hlm_bounds_to_fates_bounds + ! ====================================================================================== + + subroutine GetAndSetTime() + + ! CLM MODULES + use clm_time_manager , only : get_days_per_year, & + get_curr_date, & + get_ref_date, & + timemgr_datediff + + ! FATES MODULES + use FatesInterfaceMod , only : SetFatesTime + + ! LOCAL VARIABLES + integer :: yr ! year (0, ...) + integer :: mon ! month (1, ..., 12) + integer :: day ! day of month (1, ..., 31) + integer :: sec ! seconds of the day + integer :: current_year + integer :: current_month + integer :: current_day + integer :: current_tod + integer :: current_date + integer :: jan01_curr_year + integer :: reference_date + integer :: days_per_year + real(r8) :: model_day + real(r8) :: day_of_year + + + ! Get the current date and determine the set the start of the current year + call get_curr_date(current_year,current_month,current_day,current_tod) + current_date = current_year*10000 + current_month*100 + current_day + jan01_curr_year = current_year*10000 + 100 + 1 + + ! Get the reference date components and compute the date + call get_ref_date(yr, mon, day, sec) + reference_date = yr*10000 + mon*100 + day + + ! Get the defined number of days per year + days_per_year = get_days_per_year() + + ! Determine the model day + call timemgr_datediff(reference_date, sec, current_date, current_tod, model_day) + + ! Determine the current DOY + call timemgr_datediff(jan01_curr_year,0,current_date,sec,day_of_year) + + ! Set the FATES global time variables + call SetFatesTime(current_year, current_month, & + current_day, current_tod, & + current_date, reference_date, & + model_day, floor(day_of_year), & + days_per_year, 1.0_r8/dble(days_per_year)) + + end subroutine GetAndSetTime + end module CLMFatesInterfaceMod From f8d1e8a6b35fd106c9a4853f74171c6318ee4303 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 22 Jul 2020 18:23:27 -0600 Subject: [PATCH 1271/1973] Updating externals configuration to point to expected fates tag --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 20c468015e..fa6a277979 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.39.0_api.12.0.0 +tag = sci.1.40.0_api.13.0.0 required = True [PTCLM] From b1f7a79825b528db9a3963a0cecdd045fbd1927e Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 23 Jul 2020 16:10:24 -0700 Subject: [PATCH 1272/1973] fixing duplicate integer definition missed in merge --- src/utils/clmfates_interfaceMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index fb19461556..c5872066fc 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -697,7 +697,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, & integer :: s ! site index integer :: g ! grid-cell index (HLM) integer :: c ! column index (HLM) - integer :: g ! gridcell index (HLM) integer :: ifp ! patch index integer :: p ! HLM patch index integer :: nlevsoil ! number of soil layers at the site From 452be1af70295716670acc826ebb6c3dd7a8e8b0 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 30 Jul 2020 10:40:31 -0600 Subject: [PATCH 1273/1973] Updated fates in externals --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index fa6a277979..59cfdabc7d 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.40.0_api.13.0.0 +tag = sci.1.40.1_api.13.0.1 required = True [PTCLM] From d4ec38d30d6b832e1a33978ca4cf0e968b180b10 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 4 Aug 2020 16:18:34 -0600 Subject: [PATCH 1274/1973] missed a change --- src/main/ncdio_pio.F90.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 3c41be9ac1..c53e760364 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1553,7 +1553,7 @@ contains end if status = pio_put_var(ncid, varid, start, count, ival=tmpString(1:count(1))) else - status = pio_put_var(ncid, varid, data ) + status = pio_put_var(ncid, varid, start, count, data ) end if #elif ({DIMS}==1) start(1) = 1 ; count(1) = len(data) From 68e360a69378adb84478cdeb748ba66577ff97d0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 4 Aug 2020 23:18:07 -0600 Subject: [PATCH 1275/1973] Go back to ctsm1.0.dev105 version of namelist_defaults_ctsm using the previous finidat files, since using updated files changes answers for some cases when it gets interpolated another time --- bld/namelist_files/namelist_defaults_ctsm.xml | 163 +++++++++++------- 1 file changed, 101 insertions(+), 62 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 5bea3819a3..ec8d3ffe5d 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -22,6 +22,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 379.0 336.6 +340.6 379.0 388.8 397.5 @@ -504,7 +505,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 61 -1850,1979,2000,2013 +1850,1982,2000,2010,2013 .true. - -.true. -.true. - +.true. -.true. .true. +.true. +.true. +.true. +.true. +.true. +.true. .true. @@ -664,26 +673,48 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -hgrid=0.9x1.25 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=1.9x2.5 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=ne0np4.ARCTIC.ne30x4 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 -hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + + lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc +>lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c190718.nc lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc +>lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c190718.nc lnd/clm2/initdata_map/clmi.B1850Clm45BgcGs.0161-01-01.0.9x1.25_gx1v7_simyr1850_c200729.nc +>lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc + lnd_tuning_mode="clm5_0_GSWP3v1" use_init_interp=".true." +>lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc @@ -737,23 +768,23 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc + lnd_tuning_mode="clm5_0_CRUv7" use_init_interp=".true." +>lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c190116.nc lnd/clm2/initdata_map/clmi.B1850Clm50BgcCrop.0161-01-01.0.9x1.25_gx1v7_simyr1850_c200729.nc + lnd_tuning_mode="clm5_0_cam6.0" use_init_interp=".true." +>lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc + lnd_tuning_mode="clm5_0_CRUv7" use_init_interp=".true." +>lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc @@ -794,59 +825,67 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc - -lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr1979_c200729.nc - - -lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.1.9x2.5_gx1v7_simyr1979_c200729.nc - - lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTIC_ne30x4_mt12_simyr1979_c200728.nc + lnd_tuning_mode="clm5_0_cam6.0" use_init_interp=".true." +>lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTIC_ne30x4_mt12_simyr1982_c200425.nc lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTICGRIS_ne30x8_mt12_simyr1979_c200728.nc + lnd_tuning_mode="clm5_0_cam6.0" use_init_interp=".true." +>lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTICGRIS_ne30x8_mt12_simyr1982_c200428.nc lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200728.nc + lnd_tuning_mode="clm5_0_cam6.0" use_init_interp=".true." +>lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200506.nc - + lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc + + +lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc + + + +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc +>lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc + + + +lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200728.nc +>lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200705.nc From f438a48d3a05747375794fdafec541dea732280a Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 5 Aug 2020 10:42:05 -0600 Subject: [PATCH 1276/1973] fix interface issue --- src/main/ncdio_pio.F90.in | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index c53e760364..5f0fbb6ea1 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1542,19 +1542,17 @@ contains #if ({DIMS}==0) start(1) = 1 ; count(1) = len(data) + do m = 1,len(data) + tmpString(m:m) = data(m:m) + end do if (present(nt)) then - do m = 1,len(data) - tmpString(m:m) = data(m:m) - end do start(2) = nt; count(2) = 1 if ( count(1) > size(tmpString) )then call shr_sys_abort( subname//' ERROR: input string size is too large:'//& errMsg(sourcefile, __LINE__)) end if - status = pio_put_var(ncid, varid, start, count, ival=tmpString(1:count(1))) - else - status = pio_put_var(ncid, varid, start, count, data ) end if + status = pio_put_var(ncid, varid, start, count, ival=tmpString(1:count(1))) #elif ({DIMS}==1) start(1) = 1 ; count(1) = len(data) start(2) = 1 ; count(2) = size(data) From af8e815691064551b8542e94f6b8ea62c2160c2e Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 5 Aug 2020 09:45:19 -0700 Subject: [PATCH 1277/1973] fixing small typos in CLMBuildNamelist due to rebase --- bld/CLMBuildNamelist.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 448c3d9b1f..519e4d2915 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -958,7 +958,6 @@ sub setup_cmdl_fire_light_res { $nl_flags->{$var} = ".false."; } } -} #------------------------------------------------------------------------------- @@ -2561,7 +2560,7 @@ sub setup_logic_do_harvest { # cannot_be_true will be set to a non-empty string in any case where # do_harvest should not be true; if it turns out that do_harvest IS true # in any of these cases, a fatal error will be generated - my $cannot_be_true = "" + my $cannot_be_true = ""; if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; From ccba4b214274ca744467bbe09bc800b98f8957db Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 5 Aug 2020 13:06:46 -0600 Subject: [PATCH 1278/1973] Increase walltime for a couple tests fixing #1096 --- cime_config/testdefs/testlist_clm.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 413cdc4216..ee8abf53e3 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1171,7 +1171,7 @@ - + @@ -1189,7 +1189,7 @@ - + @@ -1198,7 +1198,7 @@ - + From 1ceca79cc004897f1c49482b04d6ace9a7631386 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 5 Aug 2020 14:49:14 -0600 Subject: [PATCH 1279/1973] Few before WRF release changes. --- doc/source/lilac/specific-atm-models/wrf.rst | 59 ++++++-------------- 1 file changed, 16 insertions(+), 43 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 82d6f5204a..33f3746d84 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -37,9 +37,9 @@ Clone WRF and CTSM Repositories Clone the WRF CTSM feature branch:: - git clone https://github.com/negin513/WRF-1.git WRF-CTSM + git clone https://github.com/wrf-model/WRF.git WRF-CTSM cd WRF-CTSM - git checkout lilac_dev + git checkout ctsm_coupling Clone the CTSM repository:: @@ -57,8 +57,8 @@ Clone the CTSM repository:: Build CTSM and its dependencies ------------------------------- -Build CTSM and its dependencies based on the instructions from section -:numref:`obtaining-and-building-ctsm`:: +In your CTSM directory, build CTSM and its dependencies based on the +instructions from section :numref:`obtaining-and-building-ctsm`:: ./lilac/build_ctsm /PATH/TO/CTSM/BUILD --machine MACHINE --compiler COMPILER @@ -112,7 +112,7 @@ For more information check `WRF Users' Guide `_. -Explicitly define which model core to build by (Bash):: +Explicitly define the model core to build by (Bash):: export WRF_EM_CORE=1 @@ -133,16 +133,16 @@ or (Cshell): setenv WRF_DA_CORE 0 -Now configure and build WRF for your machine and intended compiler:: +Now in your WRF directory configure and build WRF for your machine +and intended compiler:: - cd .. ./clean -a ./configure - At the prompt choose one of the options, based on the compiler used for building CTSM. Then you should choose if you'd like to build serially or -in parallel. +in parallel. For example, you can choose to build with ``intel`` compiler with +distributed memory parallelization (``dmpar``). .. tip:: @@ -223,7 +223,6 @@ If the geogrid step finishes successfully, you should see the following message ! Successful completion of geogrid. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - Next, run ungrib to get gribbed data into usable format to be ingested by WRF. To run ungrib.exe, first link the GRIB data files that are going to be used:: @@ -243,7 +242,6 @@ Check ungrib log for the following message showing successful completion of ungr ! Successful completion of ungrib. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - At this point, you should see ungrib output (intermediate files) in your WPS directory. Horizontally interpolate the meteorological fields extracted by ungrib to @@ -251,7 +249,6 @@ the model grids defined in geogrid:: ./metgrid.exe >& log.metgrid - Check the metgrid log for the following message showing successful completion of metgrid step:: @@ -260,7 +257,6 @@ metgrid step:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - Run real.exe ------------ @@ -275,14 +271,9 @@ Edit namelist.input for your WRF domain and desirable configurations. This should be the same domain as WPS namelist. -.. todo:: +To run WRF-CTSM, in your namelist change land-surface option to 6:: - update the option number of wrf namelist. - - -To run WRF-CTSM, in your namelist change land-surface option to 51:: - - sf_surface_physics = 51 + sf_surface_physics = 6 Run real.exe (if compiled parallel submit a batch job) to generate @@ -354,30 +345,12 @@ files that are needed based on settings in ``lnd_in`` and ``lilac_in``:: ./download_input_data -Next, copy ``lnd_in``, ``lnd_modelio.nml`` and ``lilac_in`` to the direcotory -from which you will be running the model (e.g. WRF/run). - - -.. todo:: - - Sam, can you please clarify this section. I am not sure what this is - doing and why it is here. - -.. note:: - - If you wish to merge your WRF initial conditions from a wrfinput file - into the existing CTSM initial condition file, complete the following step. - -Type:: - - module load ncl - ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="the_existing_finidat_file.nc"' 'wrfinput="your_wrfinput_file"' 'merged="the_merged_finidat_file.nc"' - -.. todo:: - - Make the above ncl script available. - +Next, copy or link ``lnd_in``, ``lnd_modelio.nml`` and ``lilac_in`` to the direcotory +from which you will be running the model (e.g. WRF/run) :: + ln -sf /glade/scratch/$USER/WRF-CTSM/CTSM/ctsm_build_dir/runtime_inputs/lnd_in . + ln -sf /glade/scratch/$USER/WRF-CTSM/CTSM/ctsm_build_dir/runtime_inputs/lilac_in . + ln -sf /glade/scratch/$USER/WRF-CTSM/CTSM/ctsm_build_dir/runtime_inputs/lnd_modelio.nml . Run wrf.exe ----------- From d6ef097ccde81c51b355efab87f0489bca845208 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 5 Aug 2020 14:12:47 -0700 Subject: [PATCH 1280/1973] fixing build errors due to rebase of lu and lightning updates --- src/main/clm_driver.F90 | 2 +- src/main/clm_instMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 5f40ce39db..45e60467ca 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1011,7 +1011,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call clm_fates%dynamics_driv( nc, bounds_clump, & atm2lnd_inst, soilstate_inst, temperature_inst, active_layer_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & - water_inst%wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst & + water_inst%wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst, & frictionvel_inst) ! TODO(wjs, 2016-04-01) I think this setFilters call should be replaced by a diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 07fb44d011..6338350c10 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -184,7 +184,7 @@ end subroutine clm_instReadNML subroutine clm_instInit(bounds) ! ! !USES: - use clm_varpar , only : nlevsno, numpft + use clm_varpar , only : nlevsno use controlMod , only : nlfilename, fsurdat use domainMod , only : ldomain use SoilBiogeochemDecompCascadeBGCMod , only : init_decompcascade_bgc diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index c5872066fc..0b044f930b 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -78,6 +78,7 @@ module CLMFatesInterfaceMod use SolarAbsorbedType , only : solarabs_type use SoilBiogeochemCarbonFluxType, only : soilbiogeochem_carbonflux_type use SoilBiogeochemCarbonStateType, only : soilbiogeochem_carbonstate_type + use FrictionVelocityMod , only : frictionvel_type use clm_time_manager , only : is_restart use ncdio_pio , only : file_desc_t, ncd_int, ncd_double use restUtilMod, only : restartvar @@ -305,13 +306,6 @@ subroutine CLMFatesGlobals() end if call set_fates_ctrlparms('use_vertsoilc',ival=pass_vertsoilc) - if(use_fates_spitfire) then - pass_spitfire = 1 - else - pass_spitfire = 0 - end if - call set_fates_ctrlparms('use_spitfire',ival=pass_spitfire) - if(use_fates_fixed_biogeog)then pass_biogeog = 1 else From 7ea80e15bd8a72da7d6a1aa068d24752c2391706 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 5 Aug 2020 17:02:06 -0600 Subject: [PATCH 1281/1973] add fill value settings --- src/main/histFileMod.F90 | 269 +++++++++++++++++++-------------------- 1 file changed, 134 insertions(+), 135 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 7405e6166b..a0dd4eeb9b 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -13,14 +13,14 @@ module histFileMod use spmdMod , only : masterproc use abortutils , only : endrun use clm_varctl , only : iulog, use_vertsoilc, use_fates - use clm_varcon , only : spval, ispval, dzsoi_decomp + use clm_varcon , only : spval, ispval, dzsoi_decomp use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort use decompMod , only : get_proc_bounds, get_proc_global, bounds_type use GetGlobalValuesMod , only : GetGlobalIndexArray - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch + use GridcellType , only : grc + use LandunitType , only : lun + use ColumnType , only : col + use PatchType , only : patch use EDTypesMod , only : nclmax use EDTypesMod , only : nlevleaf use FatesInterfaceMod , only : nlevsclass, nlevage @@ -29,7 +29,7 @@ module histFileMod use FatesLitterMod , only : ncwd use EDTypesMod , only : num_elements_fates => num_elements use FatesInterfaceMod , only : maxveg_fates => numpft - use ncdio_pio + use ncdio_pio ! implicit none @@ -163,7 +163,7 @@ module histFileMod private :: hfields_write ! Write a variable to a history tape private :: hfields_1dinfo ! Define/output 1d subgrid info if appropriate private :: hist_update_hbuf_field_1d ! Updates history buffer for specific field and tape - private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape + private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape private :: hist_set_snow_field_2d ! Set values in history field dimensioned by levsno private :: list_index ! Find index of field in exclude list private :: set_hist_filename ! Determine history dataset filenames @@ -202,7 +202,7 @@ module histFileMod ! for 2D arrays, where the second dimension is allowed ! to be 1 integer :: num2d ! size of hbuf second dimension (e.g. number of vertical levels) - integer :: hpindex ! history pointer index + integer :: hpindex ! history pointer index character(len=scale_type_strlen) :: p2c_scale_type ! scale factor when averaging patch to column character(len=scale_type_strlen) :: c2l_scale_type ! scale factor when averaging column to landunit character(len=scale_type_strlen) :: l2g_scale_type ! scale factor when averaging landunit to gridcell @@ -359,7 +359,7 @@ subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & integer :: numl ! total number of landunits across all processors integer :: numc ! total number of columns across all processors integer :: nump ! total number of pfts across all processors - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'masterlist_addfld' !------------------------------------------------------------------------ @@ -681,7 +681,7 @@ subroutine htapes_fieldlist() fexcl(:,8) = hist_fexcl8(:) fexcl(:,9) = hist_fexcl9(:) fexcl(:,10) = hist_fexcl10(:) - + ! First ensure contents of fincl and fexcl are valid names @@ -861,7 +861,7 @@ end subroutine htapes_fieldlist logical function is_mapping_upto_subgrid( type1d, type1d_out ) result ( mapping) ! ! !DESCRIPTION: - ! + ! ! Return true if this field will be mapped into a higher subgrid level ! If false it will be output on it's native grid ! @@ -917,7 +917,7 @@ subroutine htape_addfld (t, f, avgflag) integer :: beg1d_out,end1d_out ! history output per-proc 1d beginning and ending indices integer :: beg1d,end1d ! beginning and ending indices for this field (assume already set) integer :: num1d_out ! history output 1d size - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'htape_addfld' !----------------------------------------------------------------------- @@ -1020,7 +1020,7 @@ subroutine htape_addfld (t, f, avgflag) ! Fields native bounds beg1d = masterlist(f)%field%beg1d end1d = masterlist(f)%field%end1d - + ! Alloccate and initialize history buffer and related info num2d = tape(t)%hlist(n)%field%num2d @@ -1058,7 +1058,7 @@ subroutine hist_update_hbuf(bounds) ! into its history buffer for appropriate tapes. ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -1073,8 +1073,8 @@ subroutine hist_update_hbuf(bounds) !$OMP PARALLEL DO PRIVATE (f, num2d, numdims) do f = 1,tape(t)%nflds numdims = tape(t)%hlist(f)%field%numdims - - if ( numdims == 1) then + + if ( numdims == 1) then call hist_update_hbuf_field_1d (t, f, bounds) else num2d = tape(t)%hlist(f)%field%num2d @@ -1103,7 +1103,7 @@ subroutine hist_update_hbuf_field_1d (t, f, bounds) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: hpindex ! history pointer index @@ -1317,7 +1317,7 @@ subroutine hist_update_hbuf_field_1d (t, f, bounds) if ( end1d .eq. ubound(field,1) ) then k_offset = 0 else - k_offset = 1 - beg1d + k_offset = 1 - beg1d endif do k = beg1d,end1d valid = .true. @@ -1397,7 +1397,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds integer, intent(in) :: num2d ! size of second dimension ! ! !LOCAL VARIABLES: @@ -1420,7 +1420,7 @@ subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) integer , pointer :: nacs(:,:) ! accumulation counter real(r8), pointer :: field(:,:) ! clm 2d pointer field logical :: field_allocated! whether 'field' was allocated here - logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) + logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) !(this refers to a point being active, NOT a history field being active) real(r8), allocatable :: field_gcell(:,:) ! gridcell level field (used if mapping to gridcell is done) character(len=*),parameter :: subname = 'hist_update_hbuf_field_2d' @@ -1720,7 +1720,7 @@ end subroutine hist_update_hbuf_field_2d subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d, beg1d, end1d) ! ! !DESCRIPTION: - ! Set values in history field dimensioned by levsno. + ! Set values in history field dimensioned by levsno. ! ! This routine handles what to do when a given snow layer doesn't exist for a given ! point, based on the no_snow_behavior argument. Options are: @@ -1790,7 +1790,7 @@ subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d num_snow_layers = abs(snl(c)) num_nonexistent_layers = num_levels - num_snow_layers - + ! Fill output field appropriately for each layer ! When only a subset of snow layers exist, it is the LAST num_snow_layers that exist ! Levels are rearranged such that the top snow layer (surface layer) becomes level 1, etc. @@ -1801,7 +1801,7 @@ subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d do level = (num_levels-num_nonexistent_layers), 1, -1 field_out(point, level) = field_in(point, level+num_nonexistent_layers) end do - + end do end associate @@ -1953,7 +1953,7 @@ subroutine htape_create (t, histrest) else lnfid => nfid(t) endif - + ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 ! - 1-d hist files have problems with pnetcdf. A better workaround in terms of @@ -2066,7 +2066,7 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'string_length', hist_dim_name_length, strlen_dimid) call ncd_defdim(lnfid, 'scale_type_string_length', scale_type_strlen, dimid) call ncd_defdim( lnfid, 'levdcmp', nlevdecomp_full, dimid) - + if(use_fates)then call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) call ncd_defdim(lnfid, 'fates_levscagpf', nlevsclass * nlevage * maxveg_fates, dimid) @@ -2124,7 +2124,7 @@ subroutine htape_add_ltype_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_ltype_metadata' !----------------------------------------------------------------------- - + do ltype = 1, max_lunit attname = att_prefix // landunit_names(ltype) call ncd_putatt(lnfid, ncd_global, attname, ltype) @@ -2175,7 +2175,7 @@ subroutine htape_add_natpft_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_natpft_metadata' !----------------------------------------------------------------------- - + do ptype = natpft_lb, natpft_ub ptype_1_indexing = ptype + (1 - natpft_lb) attname = att_prefix // pftname(ptype) @@ -2205,7 +2205,7 @@ subroutine htape_add_cft_metadata(lnfid) character(len=*), parameter :: subname = 'htape_add_cft_metadata' !----------------------------------------------------------------------- - + do ptype = cft_lb, cft_ub ptype_1_indexing = ptype + (1 - cft_lb) attname = att_prefix // pftname(ptype) @@ -2233,11 +2233,11 @@ subroutine htape_timeconst3D(t, & ! ! !ARGUMENTS: integer , intent(in) :: t ! tape index - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) + real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) character(len=*) , intent(in) :: mode ! 'define' or 'write' ! ! !LOCAL VARIABLES: @@ -2453,7 +2453,7 @@ subroutine htape_timeconst3D(t, & l = col%landunit(c) if (lun%lakpoi(l)) then ! Field indices MUST match varnamesl array order above! - if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) + if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) if (ifld ==2) histil(c,lev) = col%dz_lake(c,lev) end if end do @@ -2579,9 +2579,9 @@ subroutine htape_timeconst(t, mode) long_name='coordinate lake levels', units='m', ncid=nfid(t)) call ncd_defvar(varname='levdcmp', xtype=tape(t)%ncprec, dim1name='levdcmp', & long_name='coordinate soil levels', units='m', ncid=nfid(t)) - + if(use_fates)then - + call ncd_defvar(varname='fates_levscls', xtype=tape(t)%ncprec, dim1name='fates_levscls', & long_name='FATES diameter size class lower bound', units='cm', ncid=nfid(t)) call ncd_defvar(varname='fates_scmap_levscag', xtype=ncd_int, dim1name='fates_levscag', & @@ -2684,7 +2684,7 @@ subroutine htape_timeconst(t, mode) dim1id(1) = time_dimid str = 'days since ' // basedate // " " // basesec call ncd_defvar(nfid(t), 'time', tape(t)%ncprec, 1, dim1id, varid, & - long_name='time',units=str) + long_name='time',units=str) cal = get_calendar() if ( trim(cal) == NO_LEAP_C )then caldesc = "noleap" @@ -2705,7 +2705,7 @@ subroutine htape_timeconst(t, mode) else sec_hist_nhtfrq = hist_nhtfrq(t) end if - + dtime = get_step_size() if (sec_hist_nhtfrq == 0) then !month time_period_freq = 'month_1' @@ -3075,7 +3075,7 @@ subroutine hfields_1dinfo(t, mode) integer , pointer :: ilarr(:) ! temporary integer , pointer :: iparr(:) ! temporary type(file_desc_t), pointer :: ncid ! netcdf file - type(bounds_type) :: bounds + type(bounds_type) :: bounds character(len=*),parameter :: subname = 'hfields_1dinfo' !----------------------------------------------------------------------- @@ -3088,124 +3088,124 @@ subroutine hfields_1dinfo(t, mode) ! Define gridcell info call ncd_defvar(varname='grid1d_lon', xtype=ncd_double, dim1name=nameg, & - long_name='gridcell longitude', units='degrees_east', ncid=ncid) + long_name='gridcell longitude', units='degrees_east', fill_value=spval, ncid=ncid) call ncd_defvar(varname='grid1d_lat', xtype=ncd_double, dim1name=nameg, & - long_name='gridcell latitude', units='degrees_north', ncid=ncid) + long_name='gridcell latitude', units='degrees_north', fill_value=spval, ncid=ncid) call ncd_defvar(varname='grid1d_ixy', xtype=ncd_int, dim1name=nameg, & - long_name='2d longitude index of corresponding gridcell', ncid=ncid) + long_name='2d longitude index of corresponding gridcell', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='grid1d_jxy', xtype=ncd_int, dim1name=nameg, & - long_name='2d latitude index of corresponding gridcell', ncid=ncid) + long_name='2d latitude index of corresponding gridcell', ifill_value=ispval, ncid=ncid) ! Define landunit info call ncd_defvar(varname='land1d_lon', xtype=ncd_double, dim1name=namel, & - long_name='landunit longitude', units='degrees_east', ncid=ncid) + long_name='landunit longitude', units='degrees_east', fill_value=spval, ncid=ncid) call ncd_defvar(varname='land1d_lat', xtype=ncd_double, dim1name=namel, & - long_name='landunit latitude', units='degrees_north', ncid=ncid) + long_name='landunit latitude', units='degrees_north', fill_value=spval, ncid=ncid) call ncd_defvar(varname='land1d_ixy', xtype=ncd_int, dim1name=namel, & - long_name='2d longitude index of corresponding landunit', ncid=ncid) + long_name='2d longitude index of corresponding landunit', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='land1d_jxy', xtype=ncd_int, dim1name=namel, & - long_name='2d latitude index of corresponding landunit', ncid=ncid) + long_name='2d latitude index of corresponding landunit', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='land1d_gi', xtype=ncd_int, dim1name=namel, & - long_name='1d grid index of corresponding landunit', ncid=ncid) + long_name='1d grid index of corresponding landunit', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='land1d_wtgcell', xtype=ncd_double, dim1name=namel, & - long_name='landunit weight relative to corresponding gridcell', ncid=ncid) + long_name='landunit weight relative to corresponding gridcell', fill_value=spval, ncid=ncid) call ncd_defvar(varname='land1d_ityplunit', xtype=ncd_int, dim1name=namel, & long_name='landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) + ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='land1d_active', xtype=ncd_log, dim1name=namel, & - long_name='true => do computations on this landunit', ncid=ncid) + long_name='true => do computations on this landunit', ifill_value=0, ncid=ncid) ! Define column info call ncd_defvar(varname='cols1d_lon', xtype=ncd_double, dim1name=namec, & - long_name='column longitude', units='degrees_east', ncid=ncid) + long_name='column longitude', units='degrees_east', fill_value=spval, ncid=ncid) call ncd_defvar(varname='cols1d_lat', xtype=ncd_double, dim1name=namec, & - long_name='column latitude', units='degrees_north', ncid=ncid) + long_name='column latitude', units='degrees_north', fill_value=spval, ncid=ncid) call ncd_defvar(varname='cols1d_ixy', xtype=ncd_int, dim1name=namec, & - long_name='2d longitude index of corresponding column', ncid=ncid) + long_name='2d longitude index of corresponding column', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='cols1d_jxy', xtype=ncd_int, dim1name=namec, & - long_name='2d latitude index of corresponding column', ncid=ncid) + long_name='2d latitude index of corresponding column', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='cols1d_gi', xtype=ncd_int, dim1name=namec, & - long_name='1d grid index of corresponding column', ncid=ncid) + long_name='1d grid index of corresponding column', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='cols1d_li', xtype=ncd_int, dim1name=namec, & - long_name='1d landunit index of corresponding column', ncid=ncid) + long_name='1d landunit index of corresponding column', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='cols1d_wtgcell', xtype=ncd_double, dim1name=namec, & - long_name='column weight relative to corresponding gridcell', ncid=ncid) + long_name='column weight relative to corresponding gridcell', fill_value=spval, ncid=ncid) call ncd_defvar(varname='cols1d_wtlunit', xtype=ncd_double, dim1name=namec, & - long_name='column weight relative to corresponding landunit', ncid=ncid) + long_name='column weight relative to corresponding landunit', fill_value=spval, ncid=ncid) call ncd_defvar(varname='cols1d_itype_col', xtype=ncd_int, dim1name=namec, & - long_name='column type (see global attributes)', ncid=ncid) + long_name='column type (see global attributes)', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='cols1d_itype_lunit', xtype=ncd_int, dim1name=namec, & long_name='column landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) + ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='cols1d_active', xtype=ncd_log, dim1name=namec, & - long_name='true => do computations on this column', ncid=ncid) + long_name='true => do computations on this column', ifill_value=0, ncid=ncid) ! Define patch info call ncd_defvar(varname='pfts1d_lon', xtype=ncd_double, dim1name=namep, & - long_name='pft longitude', units='degrees_east', ncid=ncid) + long_name='pft longitude', units='degrees_east', fill_value=spval, ncid=ncid) call ncd_defvar(varname='pfts1d_lat', xtype=ncd_double, dim1name=namep, & - long_name='pft latitude', units='degrees_north', ncid=ncid) + long_name='pft latitude', units='degrees_north', fill_value=spval, ncid=ncid) call ncd_defvar(varname='pfts1d_ixy', xtype=ncd_int, dim1name=namep, & - long_name='2d longitude index of corresponding pft', ncid=ncid) + long_name='2d longitude index of corresponding pft', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='pfts1d_jxy', xtype=ncd_int, dim1name=namep, & - long_name='2d latitude index of corresponding pft', ncid=ncid) + long_name='2d latitude index of corresponding pft', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='pfts1d_gi', xtype=ncd_int, dim1name=namep, & - long_name='1d grid index of corresponding pft', ncid=ncid) + long_name='1d grid index of corresponding pft', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='pfts1d_li', xtype=ncd_int, dim1name=namep, & - long_name='1d landunit index of corresponding pft', ncid=ncid) + long_name='1d landunit index of corresponding pft', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='pfts1d_ci', xtype=ncd_int, dim1name=namep, & - long_name='1d column index of corresponding pft', ncid=ncid) + long_name='1d column index of corresponding pft', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='pfts1d_wtgcell', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding gridcell', ncid=ncid) + long_name='pft weight relative to corresponding gridcell', fill_value=spval, ncid=ncid) call ncd_defvar(varname='pfts1d_wtlunit', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding landunit', ncid=ncid) + long_name='pft weight relative to corresponding landunit', fill_value=spval, ncid=ncid) call ncd_defvar(varname='pfts1d_wtcol', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding column', ncid=ncid) + long_name='pft weight relative to corresponding column', fill_value=spval, ncid=ncid) call ncd_defvar(varname='pfts1d_itype_veg', xtype=ncd_int, dim1name=namep, & - long_name='pft vegetation type', ncid=ncid) + long_name='pft vegetation type', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='pfts1d_itype_col', xtype=ncd_int, dim1name=namep, & - long_name='pft column type (see global attributes)', ncid=ncid) + long_name='pft column type (see global attributes)', ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='pfts1d_itype_lunit', xtype=ncd_int, dim1name=namep, & long_name='pft landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) + ifill_value=ispval, ncid=ncid) call ncd_defvar(varname='pfts1d_active', xtype=ncd_log, dim1name=namep, & - long_name='true => do computations on this pft', ncid=ncid) + ifill_value=0, long_name='true => do computations on this pft', ncid=ncid) else if (mode == 'write') then @@ -3384,11 +3384,11 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & ! !ARGUMENTS: logical, intent(in) :: rstwr ! true => write restart file this step logical, intent(in) :: nlend ! true => end of run on this step - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) + real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) + real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -3572,8 +3572,8 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & endif end do - ! Reset number of time samples to zero if file is full - + ! Reset number of time samples to zero if file is full + do t = 1, ntapes if (.not. history_tape_in_use(t)) then cycle @@ -3583,7 +3583,7 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & tape(t)%ntimes = 0 end if end do - + end subroutine hist_htapes_wrapup !----------------------------------------------------------------------- @@ -3605,7 +3605,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) use pio ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(file_desc_t), intent(inout) :: ncid ! netcdf file character(len=*) , intent(in) :: flag !'read' or 'write' character(len=*) , intent(in), optional :: rdate ! restart file time stamp for name @@ -3735,7 +3735,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ier = PIO_put_att(ncid, vardesc%varid, 'interpinic_flag', iflag_skip) ! max_nflds is the maximum number of fields on any tape - ! max_flds is the maximum number possible number of fields + ! max_flds is the maximum number possible number of fields max_nflds = max_nFields() @@ -3768,7 +3768,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) num2d = tape(t)%hlist(f)%field%num2d nacs => tape(t)%hlist(f)%nacs hbuf => tape(t)%hlist(f)%hbuf - + if (type1d_out == grlnd) then if (ldomain%isgrid2d) then dim1name = 'lon' ; dim2name = 'lat' @@ -3778,10 +3778,10 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) else dim1name = type1d_out ; dim2name = 'undefined' endif - + if (dim2name == 'undefined') then if (num2d == 1) then - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & + call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & dim1name=dim1name, & long_name=trim(long_name), units=trim(units)) call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & @@ -3823,9 +3823,9 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_defdim( ncid_hist(t), 'avgflag_len' , avgflag_strlen, dimid) call ncd_defdim( ncid_hist(t), 'scalar' , 1 , dimid) call ncd_defdim( ncid_hist(t), 'max_chars' , max_chars , dimid) - call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) - call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) - + call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) + call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) + call ncd_defvar(ncid=ncid_hist(t), varname='nhtfrq', xtype=ncd_int, & long_name="Frequency of history writes", & comment="Namelist item", & @@ -3865,7 +3865,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_defvar(ncid=ncid_hist(t), varname='begtime', xtype=ncd_double, & long_name="Beginning time", units="time units", & dim1name='scalar') - + call ncd_defvar(ncid=ncid_hist(t), varname='num2d', xtype=ncd_int, & long_name="Size of second dimension", units="unitless", & dim1name='max_nflds' ) @@ -3907,7 +3907,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_enddef(ncid_hist(t)) - end do ! end of ntapes loop + end do ! end of ntapes loop RETURN @@ -3931,7 +3931,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_io('locfnh', my_locfnh, 'write', ncid, nt=t) call ncd_io('locfnhr', my_locfnhr, 'write', ncid, nt=t) end do - + fincl(:,1) = hist_fincl1(:) fincl(:,2) = hist_fincl2(:) fincl(:,3) = hist_fincl3(:) @@ -3980,7 +3980,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) itemp(:) = 0 do f=1,tape(t)%nflds itemp(f) = tape(t)%hlist(f)%field%num2d - end do + end do call ncd_io(varname='num2d', data=itemp(:), ncid=ncid_hist(t), flag='write') itemp(:) = 0 @@ -4023,7 +4023,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_io('l2g_scale_type', l2g_scale_type, 'write', ncid_hist(t)) deallocate(tname,tlongname,tunits,tmpstr,tavgflag) deallocate(p2c_scale_type, c2l_scale_type, l2g_scale_type) - enddo + enddo deallocate(itemp) ! @@ -4077,7 +4077,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end if ! Determine necessary indices - the following is needed if model decomposition is different on restart - + start(1)=1 if ( is_restart() )then @@ -4092,7 +4092,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) if ( t == 1 )then call ncd_inqdlen(ncid_hist(1),dimid,max_nflds,name='max_nflds') - + allocate(itemp(max_nflds)) end if @@ -4275,7 +4275,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) hist_fexcl10(:) = fexcl(:,10) end if - + if ( allocated(itemp) ) deallocate(itemp) end if @@ -4286,8 +4286,8 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ! so that subsequent time samples are added until the file is full. ! A new history file is used on a branch run. !====================================================================== - - if (flag == 'write') then + + if (flag == 'write') then do t = 1,ntapes if (.not. history_tape_in_use(t)) then @@ -4314,7 +4314,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) write(iulog,*) trim(subname),' ERROR: allocation' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - + hbuf1d(beg1d_out:end1d_out) = hbuf(beg1d_out:end1d_out,1) nacs1d(beg1d_out:end1d_out) = nacs(beg1d_out:end1d_out,1) @@ -4338,9 +4338,9 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) call ncd_pio_closefile(ncid_hist(t)) - end do ! end of ntapes loop + end do ! end of ntapes loop - else if (flag == 'read') then + else if (flag == 'read') then ! Read history restart information if history files are not full @@ -4361,7 +4361,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end1d_out = tape(t)%hlist(f)%field%end1d_out nacs => tape(t)%hlist(f)%nacs hbuf => tape(t)%hlist(f)%hbuf - + if (num2d == 1) then allocate(hbuf1d(beg1d_out:end1d_out), & nacs1d(beg1d_out:end1d_out), stat=status) @@ -4369,15 +4369,15 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) write(iulog,*) trim(subname),' ERROR: allocation' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - + call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name), & dim1name=type1d_out, data=hbuf1d) call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name_acc), & dim1name=type1d_out, data=nacs1d) - + hbuf(beg1d_out:end1d_out,1) = hbuf1d(beg1d_out:end1d_out) nacs(beg1d_out:end1d_out,1) = nacs1d(beg1d_out:end1d_out) - + deallocate(hbuf1d) deallocate(nacs1d) else @@ -4389,13 +4389,13 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) end do end if - + call ncd_pio_closefile(ncid_hist(t)) - + end do - + end if - + end subroutine hist_restart_ncd !----------------------------------------------------------------------- @@ -4417,7 +4417,7 @@ integer function max_nFields() end do return end function max_nFields - + !----------------------------------------------------------------------- character(len=max_namlen) function getname (inname) ! @@ -4614,7 +4614,7 @@ subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds ! boudns + type(bounds_type):: bounds ! boudns character(len=16):: l_default ! local version of 'default' character(len=*),parameter :: subname = 'hist_addfld1d' !------------------------------------------------------------------------ @@ -4768,10 +4768,10 @@ subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & ! Add field to masterlist - call masterlist_addfld (fname=trim(fname), numdims=1, type1d=l_type1d, & + call masterlist_addfld (fname=trim(fname), numdims=1, type1d=l_type1d, & type1d_out=l_type1d_out, type2d='unset', num2d=1, & units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & + p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & l2g_scale_type=scale_type_l2g) l_default = 'active' @@ -4841,13 +4841,13 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds + type(bounds_type):: bounds character(len=16):: l_default ! local version of 'default' character(len=*),parameter :: subname = 'hist_addfld2d' !------------------------------------------------------------------------ call get_proc_bounds(bounds) - + ! Error-check no_snow_behavior optional argument: It should be present if and only if ! type2d is 'levsno', and its value should be one of the public no_snow_* parameters ! defined above. @@ -4940,7 +4940,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, case ('levsno') num2d = nlevsno case ('nlevcan') - num2d = nlevcan + num2d = nlevcan case ('nvegwcs') num2d = nvegwcs case default @@ -5084,12 +5084,12 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, ! Add field to masterlist - call masterlist_addfld (fname=trim(fname), numdims=2, type1d=l_type1d, & + call masterlist_addfld (fname=trim(fname), numdims=2, type1d=l_type1d, & type1d_out=l_type1d_out, type2d=type2d, num2d=num2d, & units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & + p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, & l2g_scale_type=scale_type_l2g, no_snow_behavior=no_snow_behavior) - + l_default = 'active' if (present(default)) then l_default = default @@ -5241,12 +5241,12 @@ end subroutine hist_add_subscript subroutine strip_null(str) character(len=*), intent(inout) :: str - integer :: i + integer :: i do i=1,len(str) if(ichar(str(i:i))==0) str(i:i)=' ' end do end subroutine strip_null - + !------------------------------------------------------------------------ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rstwr, nlend) ! @@ -5263,7 +5263,7 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, logical, intent(out) :: if_stop !true => last time step of run logical, intent(out) :: if_disphist(ntapes) !true => save and dispose history file logical, intent(in) :: rstwr - logical, intent(in) :: nlend + logical, intent(in) :: nlend ! ! !LOCAL VARIABLES: integer :: t ! history tape index @@ -5273,26 +5273,26 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rest_now = .false. stop_now = .false. - + if (nlend) stop_now = .true. if (rstwr) rest_now = .true. - + if_stop = stop_now - + if (stop_now) then ! End of run - dispose all history files - + if_disphist(1:ntapes) = .true. - + else if (rest_now) then ! Restart - dispose all history files - + do t = 1,ntapes if_disphist(t) = .true. end do else ! Dispose - + if_disphist(1:ntapes) = .false. do t = 1,ntapes if (hist_ntimes(t) == hist_mfilt(t)) then @@ -5300,7 +5300,7 @@ subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, endif end do endif - + end subroutine hist_do_disp !----------------------------------------------------------------------- @@ -5340,4 +5340,3 @@ end function avgflag_valid end module histFileMod - From e7f9d5920e70be9ae75d29825c2735631248db14 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 5 Aug 2020 16:25:56 -0700 Subject: [PATCH 1282/1973] updating cime to 5.6.23 earlier to incorporate a fix to rel_path --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 0a0f4d24e9..993d5c505d 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.19 +tag = cime5.8.23 externals = ../Externals_cime.cfg required = True From 925cf20cd168754ee4e2c17ce5485c44e5dc35c5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 14:21:35 -0600 Subject: [PATCH 1283/1973] Update RTM and MOSART, and give more wallclock to the ARCTICGRIS test --- Externals.cfg | 4 ++-- cime_config/testdefs/testlist_clm.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index cbca877fd5..c5e31d48f4 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -16,14 +16,14 @@ required = True local_path = components/rtm protocol = git repo_url = https://github.com/ESCOMP/RTM -tag = rtm1_0_71 +tag = rtm1_0_72 required = True [mosart] local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/MOSART -tag = mosart1_0_36 +tag = mosart1_0_37 required = True [cime] diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index ee8abf53e3..8afd0086e5 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1162,7 +1162,7 @@ - + From 3707d957eb5c29ccd5f8099a52fee6dc9e7ea6a2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 14:46:00 -0600 Subject: [PATCH 1284/1973] Update ChangeLog files --- doc/ChangeLog | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 108 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8c46437257..8225123657 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,111 @@ =============================================================== +Tag name: ctsm1.0.dev106 +Originator(s): erik (Erik Kluzek) +Date: Thu Aug 6 14:29:10 MDT 2020 +One-line Summary: Bit-for-bit updates for the CESM2.2.0 release + +Purpose of changes +------------------ + +Fix some bit-for-bit things needed for the CESM2.2.0 release +Bring changes needed from release-clm5.0.31-34 to trunk. ndep change. +Do some refactoring of Fire class so that it makes sense for FATES to use the base class. +Update RTM and MOSART with NUOPC changes and an update of a NetCDF-4 file to NetCDF-5 +needed for the cesm2.2.0 release. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1087 -- wrong finidat file + Fixes #1096 -- failing tests + Fixes #1036 -- ne30 case fails + Fixes #946 --- better error message + Fixes #983 --- Fire method renames + Fixes #938 --- mscripgrid issue + +Known bugs found since the previous tag (include github issue ID): + #1098 -- ARCTICGRIS PE-layout is very slow... + #1097 -- xsmrpool_loss should only be written to the restart file if use_crop is true + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + +Changes made to namelist defaults (e.g., changed parameter values): + +Changes to the datasets (e.g., parameter, surface or initial files): + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + python testing (see instructions in python/README.md; document testing done): + + cheyenne -= PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No (bit-for-bit) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): rtm, mosart + RTM to rtm1_0_72 + MOSART to mosart1_0_37 + +Pull Requests that document the changes (include PR ids): #1079 +(https://github.com/ESCOMP/ctsm/pull) + #1079 -- Bit-for-bit updates for the CESM2.2.0 release + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev105 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) / Chris Fischer Date: Thu Jul 23 08:59:37 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 48f8abbc81..d7fd19ea56 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev106 erik 08/06/2020 Bit-for-bit updates for the CESM2.2.0 release release-clm5.0.34 erik 04/20/2020 Update doc for release-clm5.0 (SKIPPED), and fix issues with no-anthro surface dataset creation release-clm5.0.33 erik 04/07/2020 SKIPPED ON MASTER -- Turn irrigation on for 2300 SSP extensions release-clm5.0.32 erik 04/02/2020 SKIPPED ON MASTER -- Extensions to 2300 for SSP5-8.5,SSP5-3.4, and SSP1-2.6 From df1bd72787899ff175dee3e75ca7ba45b7754309 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 15:35:57 -0600 Subject: [PATCH 1285/1973] Update change files --- doc/ChangeLog | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8225123657..7637a14f2f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm1.0.dev106 Originator(s): erik (Erik Kluzek) -Date: Thu Aug 6 14:29:10 MDT 2020 +Date: Thu Aug 6 15:35:47 MDT 2020 One-line Summary: Bit-for-bit updates for the CESM2.2.0 release Purpose of changes @@ -9,10 +9,14 @@ Purpose of changes Fix some bit-for-bit things needed for the CESM2.2.0 release Bring changes needed from release-clm5.0.31-34 to trunk. ndep change. +Brings in some changes for PtVg datasets for no-anthro compset. Do some refactoring of Fire class so that it makes sense for FATES to use the base class. Update RTM and MOSART with NUOPC changes and an update of a NetCDF-4 file to NetCDF-5 needed for the cesm2.2.0 release. +The 2010 finidat file is now set in the 2010_control use-case rather than relying on the +finidat dataset matching. + Bugs fixed or introduced ------------------------ @@ -50,6 +54,12 @@ Notes of particular relevance for users Caveats for users (e.g., need to interpolate initial conditions): Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + if ndep file isn't found die with a warning rather than fatal error. + The warning allows you to override with CLM_BLDNML_OPTS="-ignore_warnings" + + finidat file matching will now use the sim_year rather than start-year + for a control case (transient cases used the start-year) + Add 2010 f09 finidat file for clm5_0_cam6.0 Changes made to namelist defaults (e.g., changed parameter values): @@ -64,6 +74,8 @@ NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the Caveats for developers (e.g., code that is duplicated that requires double maintenance): Changes to tests or testing: + Add clm45cam6LndTuningMode testmod + Some tests needed more wallclock Code reviewed by: self @@ -74,7 +86,7 @@ CTSM testing: regular build-namelist tests: - cheyenne - PASS + cheyenne - PASS (one test is different than ctsm1.0.dev105) python testing (see instructions in python/README.md; document testing done): From d1013218c495ce63ab372a3b6a54b1c1b4c81084 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 16:09:15 -0600 Subject: [PATCH 1286/1973] Revert "Go back to ctsm1.0.dev105 version of namelist_defaults_ctsm using the previous finidat files, since using updated files changes answers for some cases when it gets interpolated another time" This reverts commit 68e360a69378adb84478cdeb748ba66577ff97d0. --- bld/namelist_files/namelist_defaults_ctsm.xml | 163 +++++++----------- 1 file changed, 62 insertions(+), 101 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index ec8d3ffe5d..5bea3819a3 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -22,7 +22,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 379.0 336.6 -340.6 379.0 388.8 397.5 @@ -505,7 +504,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 61 -1850,1982,2000,2010,2013 +1850,1979,2000,2013 .true. - - +.true. +.true. +.true. -.true. .true. -.true. -.true. -.true. -.true. -.true. -.true. .true. @@ -673,46 +664,24 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -hgrid=ne0np4.ARCTIC.ne30x4 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=0.9x1.25 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=1.9x2.5 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=ne0np4.ARCTIC.ne30x4 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 @@ -729,31 +698,31 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c190718.nc +>lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c190718.nc +>lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc +>lnd/clm2/initdata_map/clmi.B1850Clm45BgcGs.0161-01-01.0.9x1.25_gx1v7_simyr1850_c200729.nc lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc + lnd_tuning_mode="clm5_0_GSWP3v1" +>lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc @@ -768,23 +737,23 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c190116.nc + lnd_tuning_mode="clm5_0_CRUv7" +>lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc + lnd_tuning_mode="clm5_0_cam6.0" +>lnd/clm2/initdata_map/clmi.B1850Clm50BgcCrop.0161-01-01.0.9x1.25_gx1v7_simyr1850_c200729.nc lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c190111.nc + lnd_tuning_mode="clm5_0_CRUv7" +>lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc @@ -825,67 +794,59 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc + +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr1979_c200729.nc + + +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.1.9x2.5_gx1v7_simyr1979_c200729.nc + + lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTIC_ne30x4_mt12_simyr1982_c200425.nc + lnd_tuning_mode="clm5_0_cam6.0" +>lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTIC_ne30x4_mt12_simyr1979_c200728.nc lnd/clm2/initdata_map/clmi.FHISTSp.1982-01-01.ARCTICGRIS_ne30x8_mt12_simyr1982_c200428.nc + lnd_tuning_mode="clm5_0_cam6.0" +>lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTICGRIS_ne30x8_mt12_simyr1979_c200728.nc lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200506.nc - - - -lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc - - -lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc - - - -lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c181015.nc +>lnd/clm2/initdata_map/clmi.F2000.2000-01-01.ne120pg3_mt13_simyr2000_c200728.nc - + lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc +>lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200705.nc +>lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200728.nc From c472cbe0a447d200910f7f4ed14ba4ae572f5182 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 16:09:45 -0600 Subject: [PATCH 1287/1973] Revert "Change back #1004 with wrong ending year of ndep, since it has an apparant change to answers even for cases that dont' run past 2005" This reverts commit f7882107b154c2919cbf355bfaed3ba87a8cf081. --- bld/namelist_files/use_cases/20thC_transient.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/use_cases/20thC_transient.xml b/bld/namelist_files/use_cases/20thC_transient.xml index ff56232b8e..824f63cdc4 100644 --- a/bld/namelist_files/use_cases/20thC_transient.xml +++ b/bld/namelist_files/use_cases/20thC_transient.xml @@ -19,11 +19,11 @@ .false. 1850 -2005 +2015 1850 1850 -2005 +2015 1850 1850 From a6063521315e47c3b400b2df6b131ae3d6de1565 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 16:11:24 -0600 Subject: [PATCH 1288/1973] Let 2010_control usecase use finidat matching rather than hardcoding a 2010 finidat in the use case --- bld/namelist_files/use_cases/2010_control.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bld/namelist_files/use_cases/2010_control.xml b/bld/namelist_files/use_cases/2010_control.xml index 5c63fa8224..244009df02 100644 --- a/bld/namelist_files/use_cases/2010_control.xml +++ b/bld/namelist_files/use_cases/2010_control.xml @@ -12,11 +12,6 @@ .false. .false. -lnd/clm2/initdata_map/clmi.BHIST.2010-01-01.0.9x1.25_gx1v7_simyr2010_c181015.nc - -.true. - 2010 2010 From 39234063b2f94825f75b92f1a477746ea130e3d8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 16:27:14 -0600 Subject: [PATCH 1289/1973] SEt ROF_NCPL,LND_TUNING_MODE, and turn on megan and drydep to waccmx_offline test --- .../testdefs/testmods_dirs/clm/waccmx_offline/shell_commands | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands index 09dc866921..e51937d668 100755 --- a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands @@ -1,2 +1,3 @@ -./xmlchange USE_ESMF_LIB=TRUE,ATM_NCPL=288,CALENDAR=GREGORIAN +./xmlchange USE_ESMF_LIB=TRUE,ATM_NCPL=288,CALENDAR=GREGORIAN,ROF_NCPL='$ATM_NCPL',LND_TUNING_MODE="clm5_0_cam6.0" +./xmlchange CLM_NAMELIST_OPTS="-megan -drydep" --append From 442dfe732edb43f1f4aed163837b71dadbb460ee Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 16:48:00 -0600 Subject: [PATCH 1290/1973] Add a transient waccmx_offline test, shorten some of the tests for CAM grids, add some comments --- cime_config/testdefs/testlist_clm.xml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 8afd0086e5..55ea066a89 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -50,6 +50,7 @@ + @@ -135,6 +136,16 @@ + + + + + + + + + + @@ -1148,7 +1159,7 @@ - + @@ -1157,7 +1168,7 @@ - + @@ -1166,7 +1177,7 @@ - + @@ -1175,7 +1186,7 @@ - + @@ -1184,7 +1195,7 @@ - + @@ -1193,7 +1204,7 @@ - + From 03196510bbf4fb9d2299418e31404a1bd7809d31 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Aug 2020 18:36:51 -0600 Subject: [PATCH 1291/1973] Don't write out xsmrpool_loss if NOT use_crop -- part of the fix for #1097 --- src/biogeochem/CNVegCarbonStateType.F90 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index d4aea5a37f..0a8ea2e03c 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -1205,11 +1205,13 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, dim1name='pft', long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_patch) - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_loss', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_loss_patch) - if (flag == 'read' .and. (.not. readvar) ) then - this%xsmrpool_loss_patch(bounds%begp:bounds%endp) = 0._r8 + if (use_crop) then + call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_loss', xtype=ncd_double, & + dim1name='pft', long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_loss_patch) + if (flag == 'read' .and. (.not. readvar) ) then + this%xsmrpool_loss_patch(bounds%begp:bounds%endp) = 0._r8 + end if end if call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc', xtype=ncd_double, & From 5481b0512f8cc2889f73129d5cd04495d16aa728 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 7 Aug 2020 00:28:48 -0600 Subject: [PATCH 1292/1973] Update finidat files for non-crop with the xsmrpool_loss term removed from them (see issue #1097) --- bld/namelist_files/namelist_defaults_ctsm.xml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 5bea3819a3..161ff5c74b 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -700,21 +700,21 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="18500101" use_nitrif_denitrif=".true." use_vertsoilc=".true." sim_year="1850" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm4_5_GSWP3v1" ->lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc +>lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v7_simyr1850_c200806.nc lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc +>lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v7_simyr1850_c200806.nc lnd/clm2/initdata_map/clmi.B1850Clm45BgcGs.0161-01-01.0.9x1.25_gx1v7_simyr1850_c200729.nc +>lnd/clm2/initdata_map/clmi.B1850Clm45BgcGs.0161-01-01.0.9x1.25_gx1v7_simyr1850_c200806.nc @@ -722,7 +722,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="18500101" use_nitrif_denitrif=".false." use_vertsoilc=".false." sim_year="1850" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm5_0_GSWP3v1" ->lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc +>lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c200806.nc @@ -753,7 +753,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="18500101" use_nitrif_denitrif=".false." use_vertsoilc=".false." sim_year="1850" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm5_0_CRUv7" ->lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c200728.nc +>lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c200806.nc @@ -799,14 +799,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="19790101" use_nitrif_denitrif=".false." use_vertsoilc=".false." sim_year="1979" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm5_0_cam6.0" ->lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr1979_c200729.nc +>lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr1979_c200806.nc lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.1.9x2.5_gx1v7_simyr1979_c200729.nc +>lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.1.9x2.5_gx1v7_simyr1979_c200806.nc @@ -814,7 +814,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="19790101" use_nitrif_denitrif=".false." use_vertsoilc=".false." sim_year="1979" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm5_0_cam6.0" ->lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTIC_ne30x4_mt12_simyr1979_c200728.nc +>lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTIC_ne30x4_mt12_simyr1979_c200806.nc @@ -822,7 +822,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="19790101" use_nitrif_denitrif=".false." use_vertsoilc=".false." sim_year="1979" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm5_0_cam6.0" ->lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTICGRIS_ne30x8_mt12_simyr1979_c200728.nc +>lnd/clm2/initdata_map/clmi.FHISTSp.1979-01-01.ARCTICGRIS_ne30x8_mt12_simyr1979_c200806.nc @@ -846,7 +846,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="20130101" use_nitrif_denitrif=".false." use_vertsoilc=".false." sim_year="2013" ic_tod="0" glc_nec="10" use_crop=".false." irrigate=".true." lnd_tuning_mode="clm5_0_cam6.0" ->lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200728.nc +>lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200806.nc From aa04fcfa22c52f799ec8b084fc90e228fc05941a Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 7 Aug 2020 12:28:19 -0600 Subject: [PATCH 1293/1973] revert cime back to 5.8.19 to avoid ctsm issue 1013 --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 993d5c505d..0a0f4d24e9 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.23 +tag = cime5.8.19 externals = ../Externals_cime.cfg required = True From 6e667960388d1a866e4f92f094c24fea904582f7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 8 Aug 2020 00:37:53 -0600 Subject: [PATCH 1294/1973] levurb and string_len dimensions are no longer needed on the restart files fixing #1101 --- src/main/restFileMod.F90 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 91967c5ed3..83be13835b 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -485,7 +485,7 @@ subroutine restFile_dimset( ncid ) use clm_varctl , only : caseid, ctitle, version, username, hostname, fsurdat use clm_varctl , only : conventions, source use dynSubgridControlMod , only : get_flanduse_timeseries - use clm_varpar , only : numrad, nlevlak, nlevsno, nlevgrnd, nlevurb, nlevcan + use clm_varpar , only : numrad, nlevlak, nlevsno, nlevgrnd, nlevcan use clm_varpar , only : maxpatch_glcmec, nvegwcs use decompMod , only : get_proc_global ! @@ -518,7 +518,6 @@ subroutine restFile_dimset( ncid ) call ncd_defdim(ncid , nameCohort , numCohort , dimid) call ncd_defdim(ncid , 'levgrnd' , nlevgrnd , dimid) - call ncd_defdim(ncid , 'levurb' , nlevurb , dimid) call ncd_defdim(ncid , 'levlak' , nlevlak , dimid) call ncd_defdim(ncid , 'levsno' , nlevsno , dimid) call ncd_defdim(ncid , 'levsno1' , nlevsno+1 , dimid) @@ -528,7 +527,6 @@ subroutine restFile_dimset( ncid ) if ( use_hydrstress ) then call ncd_defdim(ncid , 'vegwcs' , nvegwcs , dimid) end if - call ncd_defdim(ncid , 'string_length', 64 , dimid) call ncd_defdim(ncid , 'glc_nec', maxpatch_glcmec, dimid) call ncd_defdim(ncid , 'glc_nec1', maxpatch_glcmec+1, dimid) @@ -680,7 +678,7 @@ subroutine restFile_dimcheck( ncid ) ! ! !USES: use decompMod, only : get_proc_global - use clm_varpar, only : nlevsno, nlevlak, nlevgrnd, nlevurb + use clm_varpar, only : nlevsno, nlevlak, nlevgrnd use clm_varctl, only : single_column, nsrest, nsrStartup ! ! !ARGUMENTS: @@ -719,7 +717,6 @@ subroutine restFile_dimcheck( ncid ) 'use_init_interp = .true. in user_nl_clm' call check_dim(ncid, 'levsno' , nlevsno, msg=msg) call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg) - call check_dim(ncid, 'levurb' , nlevurb) call check_dim(ncid, 'levlak' , nlevlak) end subroutine restFile_dimcheck From 12cc622622c1a5cba1fb7ddf228216a1a6a3a71d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 8 Aug 2020 00:39:08 -0600 Subject: [PATCH 1295/1973] Fix CLM xml variable name --- .../testdefs/testmods_dirs/clm/waccmx_offline/shell_commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands index e51937d668..28442e910b 100755 --- a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands @@ -1,3 +1,3 @@ ./xmlchange USE_ESMF_LIB=TRUE,ATM_NCPL=288,CALENDAR=GREGORIAN,ROF_NCPL='$ATM_NCPL',LND_TUNING_MODE="clm5_0_cam6.0" -./xmlchange CLM_NAMELIST_OPTS="-megan -drydep" --append +./xmlchange CLM_BLDNML_OPTS="-megan -drydep" --append From 2c6606c87aca78092ea67992e910ad91ab341647 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 8 Aug 2020 00:44:10 -0600 Subject: [PATCH 1296/1973] Add a IHistClm50SpGs that doesn't include CISM, because CISM can't use GREGORIAN calendar and use it for the waccmx test that sets to GREGORIAN --- cime_config/config_compsets.xml | 6 ++++++ cime_config/testdefs/testlist_clm.xml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 87349d0c24..dbcdf4a049 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -232,6 +232,12 @@ + + IHistClm50SpGs + HIST_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV + + + IHistClm50SpCru HIST_DATM%CRUv7_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 55ea066a89..0bd8b24b5e 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -139,7 +139,7 @@ - + From f30d6d5bc47894b7121cf44b90bf468163b53cd0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 9 Aug 2020 23:43:26 -0600 Subject: [PATCH 1297/1973] Add a 2003 f19 finidat file that can be used by the FXHIST test and will work for #1089 --- bld/namelist_files/namelist_defaults_ctsm.xml | 22 ++++++++++++++++++- .../namelist_definition_ctsm.xml | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 161ff5c74b..16d65964ef 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -504,7 +504,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 61 -1850,1979,2000,2013 +1850,1979,2000,2003,2013 +.true. + + .true. @@ -683,6 +688,12 @@ attributes from the config_cache.xml file (with keys converted to upper-case). hgrid="ne0np4.ARCTICGRIS.ne30x8" use_cn=".false." maxpft="17" >hgrid=ne0np4.ARCTICGRIS.ne30x8 maxpft=17 mask=tx0.1v2 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 +p + +hgrid=1.9x2.5 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr2000_c200728.nc + +lnd/clm2/initdata_map/clmi.BHISTSp.2000-01-01.1.9x2.5_gx1v7_simyr2003_c200807.nc + + + + group="default_settings" valid_values="1850,1979,2000,2003,2010,2013" > Simulation years you can look for in initial condition files (finidat) if interpolation is turned on (use_init_interp is .true.) From b2b82d884da783a6b8f1dfa0f6c84e3b2c1e2800 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 10 Aug 2020 01:04:30 -0600 Subject: [PATCH 1298/1973] add a namelist test for a 2003 start, adjust the waccm_offline tests make one of them for a 2005 start --- bld/unit_testers/build-namelist_test.pl | 5 +++-- cime_config/testdefs/testlist_clm.xml | 6 +++--- .../clm/waccmx_offline2005Start/include_user_mods | 1 + .../clm/waccmx_offline2005Start/shell_commands | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/waccmx_offline2005Start/include_user_mods create mode 100755 cime_config/testdefs/testmods_dirs/clm/waccmx_offline2005Start/shell_commands diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index bde36e8c58..ed57cdcc92 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 889; +my $ntests = 893; if ( defined($opts{'compare'}) ) { - $ntests += 546; + $ntests += 549; } plan( tests=>$ntests ); @@ -335,6 +335,7 @@ sub make_config_cache { "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode clm5_0_cam6.0", "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20030101/' -lnd_tuning_mode clm5_0_cam6.0", "-res 1.9x2.5 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode clm5_0_cam6.0", "-res C192 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode clm5_0_cam6.0", "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 0bd8b24b5e..a0f0e6e2d6 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -130,16 +130,16 @@ - + - + - + diff --git a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline2005Start/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline2005Start/include_user_mods new file mode 100644 index 0000000000..e46fc10b2e --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline2005Start/include_user_mods @@ -0,0 +1 @@ +../waccmx_offline diff --git a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline2005Start/shell_commands b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline2005Start/shell_commands new file mode 100755 index 0000000000..b926b0dbb1 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline2005Start/shell_commands @@ -0,0 +1 @@ +./xmlchange RUN_STARTDATE=2005-01-01 From a5d808d7c6a7e8f67fce97818366a13c31848d23 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 10 Aug 2020 02:21:21 -0600 Subject: [PATCH 1299/1973] Update change files --- doc/ChangeLog | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 130 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7637a14f2f..759c005192 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,133 @@ =============================================================== +Tag name: ctsm1.0.dev107 +Originator(s): erik (Erik Kluzek) +Date: Mon Aug 10 02:21:12 MDT 2020 +One-line Summary: Answer changes needed for CESM2.2.0 + +Purpose of changes +------------------ + +A list of small answer changes needed for CESM2.2.0. Nitrogen deposition file now properly +ends in 2015 rather than 2005. Have 2010_control compset match the 2000 IOC file rather than 2010. +Modify the waccmx_offline tests to more closely match the CAM tests. + +Interpolate IC files for an exact match. Answers are identical for an exact match, but different +when used for other resolutions. + +Two small bit-for-bit changes remove levurb and string_len dimensions on restart files. +Remove xsmrpool_loss when use_crop is NOT true. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): [If none, remove this line] + Answer changing fixes: + Fixes #1004 -- stream_year_last_ndep is set to 2005 instead of 2015 for historical with ctsm1.0.dev093 + Fixes #1012 -- Help prevent problems with WACCM-X testing by modifying our waccmx_offline test + Fixes #1090 -- Have 2010_control compset match 2000 simulation-year rather than 2010 + Fixes #1089 -- Failure in FXHIST test when running with CAM + Fixes #1037 -- Interpolate out-of-the-box initial conditions files for CESM2.2 release + (only changes answers for resolutions other than IC file resolution) + + Bit-for-bit changes: + Fixes #1101 -- levurb and string_len dimensions no longer needed on the restart files + Fixes #1097 -- xsmrpool_loss should only be written to the restart file if use_crop is true + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + 2010_control doesn't match 2010 finidat file + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): Interpolated IC files + Add f19 2003 IC file, f09 and 19 1979 IC file + Remove 2010 IC file + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: waccm_offline test changed to more closely match the FXHIST CAM test + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (115 tests are different than before) + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes! + + Hist and SSP BGC compsets change answers because of the correction of the end year for ndep. + You wouldn't think this would matter until you get to the end of the time-sequence -- but it + does for the first time-step. + + The 2010 compset changes answers because of using the 2000 finidat file rather than 2010 + + Some finidat files interpolated to the resolution they are designed for. This causes an apparent + change of answers when these datasets are used for other resolutions (even though it does NOT for + the resolution it's interpolated to) + + waccm_offline tests are also changed in order to more closely match the FXHIST tests in CAM. + + Summarize any changes to answers, i.e., + - what code configurations: Hist, SSP, 2010 compsets, Clm45 and some f10, 1x1 because of IC files + - what platforms/compilers: All + - nature of change: same climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #1100 +(https://github.com/ESCOMP/ctsm/pull) + #1100 -- Answer changes needed for CESM2.2.0 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev106 Originator(s): erik (Erik Kluzek) Date: Thu Aug 6 15:35:47 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index d7fd19ea56..2d511da10a 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev107 erik 08/10/2020 Answer changes needed for CESM2.2.0 ctsm1.0.dev106 erik 08/06/2020 Bit-for-bit updates for the CESM2.2.0 release release-clm5.0.34 erik 04/20/2020 Update doc for release-clm5.0 (SKIPPED), and fix issues with no-anthro surface dataset creation release-clm5.0.33 erik 04/07/2020 SKIPPED ON MASTER -- Turn irrigation on for 2300 SSP extensions From c1985c0d78648a8dbb0f9f926500394d542ebd2e Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 10 Aug 2020 15:27:53 -0600 Subject: [PATCH 1300/1973] Remove all QSat_temp codes that I had added for testing reasons only --- src/biogeophys/QSatMod.F90 | 72 ----------------------------- src/cpl/lilac/lnd_import_export.F90 | 3 +- src/cpl/mct/lnd_import_export.F90 | 38 +-------------- src/cpl/nuopc/lnd_import_export.F90 | 3 +- 4 files changed, 4 insertions(+), 112 deletions(-) diff --git a/src/biogeophys/QSatMod.F90 b/src/biogeophys/QSatMod.F90 index 138a944b22..9a17ce7001 100644 --- a/src/biogeophys/QSatMod.F90 +++ b/src/biogeophys/QSatMod.F90 @@ -12,7 +12,6 @@ module QSatMod ! ! !PUBLIC MEMBER FUNCTIONS: public :: QSat - public :: QSat_temp ! TODO: rm after testing !----------------------------------------------------------------------- ! For water vapor (temperature range 0C-100C) @@ -25,14 +24,6 @@ module QSatMod real(r8), parameter :: a6 = 0.892344772e-10_r8 real(r8), parameter :: a7 = -0.373208410e-12_r8 real(r8), parameter :: a8 = 0.209339997e-15_r8 - ! TODO: Delete after testing - real(r8), parameter :: e0 = 6.107799961_r8 - real(r8), parameter :: e1 = 4.436518521e-01_r8 - real(r8), parameter :: e2 = 1.428945805e-02_r8 - real(r8), parameter :: e3 = 2.650648471e-04_r8 - real(r8), parameter :: e4 = 3.031240396e-06_r8 - real(r8), parameter :: e5 = 2.034080948e-08_r8 - real(r8), parameter :: e6 = 6.136820929e-11_r8 ! For derivative:water vapor real(r8), parameter :: b0 = 0.444017302_r8 real(r8), parameter :: b1 = 0.286064092e-01_r8 @@ -53,14 +44,6 @@ module QSatMod real(r8), parameter :: c6 = 0.387940929e-09_r8 real(r8), parameter :: c7 = 0.149436277e-11_r8 real(r8), parameter :: c8 = 0.262655803e-14_r8 - ! TODO: Delete after testing - real(r8), parameter :: f0 = 6.109177956_r8 - real(r8), parameter :: f1 = 5.034698970e-01_r8 - real(r8), parameter :: f2 = 1.886013408e-02_r8 - real(r8), parameter :: f3 = 4.176223716e-04_r8 - real(r8), parameter :: f4 = 5.824720280e-06_r8 - real(r8), parameter :: f5 = 4.838803174e-08_r8 - real(r8), parameter :: f6 = 1.838826904e-10_r8 ! For derivative:ice real(r8), parameter :: d0 = 0.503277922_r8 real(r8), parameter :: d1 = 0.377289173e-01_r8 @@ -143,59 +126,4 @@ subroutine QSat (T, p, qs, es, qsdT, esdT) end subroutine QSat - !----------------------------------------------------------------------- - subroutine QSat_temp (T, p, es, esdT, qs, qsdT) - ! - ! !DESCRIPTION: - ! Temporary subroutine similar to subr. QSat. - ! TODO: Remove after testing. - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_TKFRZ - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: T ! temperature (K) - real(r8), intent(in) :: p ! surface atmospheric pressure (pa) - real(r8), intent(out) :: es ! vapor pressure (pa) - real(r8), intent(out) :: esdT ! d(es)/d(T) - real(r8), intent(out) :: qs ! humidity (kg/kg) - real(r8), intent(out) :: qsdT ! d(qs)/d(T) - ! - ! !LOCAL VARIABLES: - real(r8) :: T_limit - real(r8) :: td,vp,vp1,vp2 - !----------------------------------------------------------------------- - - T_limit = min( 50._r8, max(-50._r8, T - SHR_CONST_TKFRZ)) - - td = T_limit - if (td >= 0.0_r8) then - es = e0 + td*(e1 + td*(e2 + td*(e3 + td*(e4 & - + td*(e5 + td*e6))))) - - esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & - + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) - else - es = f0 + td*(f1 + td*(f2 + td*(f3 + td*(f4 & - + td*(f5 + td*f6))))) - - esdT = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & - + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) - endif - - es = es * 100._r8 ! pa - esdT = esdT * 100._r8 ! pa/K - - vp = 1.0_r8 / (p - 0.378_r8*es) - vp1 = 0.622_r8 * vp - vp2 = vp1 * vp - - qs = es * vp1 ! kg/kg - qsdT = esdT * vp2 * p ! 1 / K - - end subroutine QSat_temp - - end module QSatMod diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index ae81351ef0..4f0881e06e 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -67,7 +67,6 @@ subroutine import_fields( importState, bounds, first_call, rc) integer :: num integer :: begg, endg ! bounds integer :: g,i,k ! indices - real(r8) :: dum1, dum2, dum3 ! arguments returned by subr. QSat but not used here real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: co2_ppmv_val ! temporary real(r8) :: forc_t ! atmospheric temperature (Kelvin) @@ -276,7 +275,7 @@ subroutine import_fields( importState, bounds, first_call, rc) water_inst%wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) - call QSat(forc_t, forc_pbot, dum1, dum2, qsat_kg_kg, dum3) + call QSat(forc_t, forc_pbot, qsat_kg_kg) ! modify specific humidity if precip occurs if (1==2) then diff --git a/src/cpl/mct/lnd_import_export.F90 b/src/cpl/mct/lnd_import_export.F90 index 949ee35215..7c449b5b8f 100644 --- a/src/cpl/mct/lnd_import_export.F90 +++ b/src/cpl/mct/lnd_import_export.F90 @@ -31,7 +31,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat use shr_const_mod , only: SHR_CONST_TKFRZ use shr_string_mod , only: shr_string_listGetName use domainMod , only: ldomain - use QSatMod , only: QSat, QSat_temp ! TODO: rm QSat_temp after testing + use QSatMod , only: QSat use shr_infnan_mod , only : isnan => shr_infnan_isnan ! ! !ARGUMENTS: @@ -45,9 +45,6 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat ! !LOCAL VARIABLES: integer :: g,i,k,nstep,ier ! indices, number of steps, and error code real(r8) :: forc_rainc ! rainxy Atm flux mm/s - real(r8) :: e ! vapor pressure (Pa) TODO: rm after tests - real(r8) :: dum1, dum2, dum3 ! arguments returned by subr. QSat but not used here - real(r8) :: qsat_old ! TODO: rm after testing real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_t ! atmospheric temperature (Kelvin) real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) @@ -59,32 +56,9 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat real(r8) :: co2_ppmv_prog ! temporary real(r8) :: co2_ppmv_val ! temporary integer :: co2_type_idx ! integer flag for co2_type options - ! TODO: Delete through tdc, t after testing - real(r8) :: esatw ! saturation vapor pressure over water (Pa) - real(r8) :: esati ! saturation vapor pressure over ice (Pa) - real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water - real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice - real(r8) :: tdc, t ! Kelvins to Celcius function and its input character(len=32) :: fname ! name of field that is NaN character(len=32), parameter :: sub = 'lnd_import' - ! TODO: Delete through esati after testing - ! Constants to compute vapor pressure - parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & - a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & - a4=3.031240396e-06_r8, a5=2.034080948e-08_r8, & - a6=6.136820929e-11_r8) - - parameter (b0=6.109177956_r8 , b1=5.034698970e-01_r8, & - b2=1.886013408e-02_r8, b3=4.176223716e-04_r8, & - b4=5.824720280e-06_r8, b5=4.838803174e-08_r8, & - b6=1.838826904e-10_r8) - ! - ! function declarations - ! - tdc(t) = min( 50._r8, max(-50._r8,(t-SHR_CONST_TKFRZ)) ) - esatw(t) = 100._r8*(a0+t*(a1+t*(a2+t*(a3+t*(a4+t*(a5+t*a6)))))) - esati(t) = 100._r8*(b0+t*(b1+t*(b2+t*(b3+t*(b4+t*(b5+t*b6)))))) !--------------------------------------------------------------------------- co2_type_idx = 0 @@ -194,15 +168,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc + forc_rainl wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc + forc_snowl -! TODO: Delete these lines after testing, except the call QSat - if (forc_t > SHR_CONST_TKFRZ) then - e = esatw(tdc(forc_t)) - else - e = esati(tdc(forc_t)) - end if - qsat_old = 0.622_r8*e / (forc_pbot - 0.378_r8*e) - call QSat_temp(forc_t, forc_pbot, dum1, dum2, qsat_kg_kg, dum3) - if (qsat_kg_kg - qsat_old > 1.e-14_r8) write(iulog,*) 'qsat_new, qsat_old =', qsat_kg_kg, qsat_old ! slevis diag + call QSat(forc_t, forc_pbot, qsat_kg_kg) !modify specific humidity if precip occurs if(1==2) then diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 45bbe7a888..eec37992b7 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -389,7 +389,6 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & integer :: num integer :: begg, endg ! bounds integer :: g,i,k ! indices - real(r8) :: dum1, dum2, dum3 ! arguments returned by subr. QSat but not used here real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_t ! atmospheric temperature (Kelvin) real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) @@ -685,7 +684,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) - call QSat(forc_t, forc_pbot, dum1, dum2, qsat_kg_kg, dum3) + call QSat(forc_t, forc_pbot, qsat_kg_kg) ! modify specific humidity if precip occurs if (1==2) then From 527d6833e724f78c9a8250e8739108b6a28362e0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 10 Aug 2020 23:13:02 -0600 Subject: [PATCH 1301/1973] By default check that files exist, and only allow that option to be turned off, check for both f09 and f19 1979 settings, this helps with #1101 --- bld/unit_testers/build-namelist_test.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index d385068291..4772601aa7 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -29,7 +29,7 @@ sub usage { -compare Compare namelists for this version to namelists created by another version. -generate Leave the namelists in place to do a later compare. - -test Use the -test option to make sure datasets exist. + -no-test Do NOT Use the -test option to make sure datasets exist. -csmdata "dir" Root directory of CESM input data. EOF @@ -89,7 +89,7 @@ sub make_config_cache { # my %opts = ( help => 0, generate => 0, - test => 0, + test => 1, compare => undef, csmdata => undef, ); @@ -98,7 +98,7 @@ sub make_config_cache { "h|help" => \$opts{'help'}, "compare=s" => \$opts{'compare'}, "generate" => \$opts{'generate'}, - "test" => \$opts{'test'}, + "test!" => \$opts{'test'}, "csmdata=s" => \$opts{'csmdata'}, ) or usage(); @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 894; +my $ntests = 902; if ( defined($opts{'compare'}) ) { - $ntests += 549; + $ntests += 555; } plan( tests=>$ntests ); @@ -333,6 +333,8 @@ sub make_config_cache { foreach my $options ( "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res 0.9x1.25 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode clm5_0_cam6.0", "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20030101/' -lnd_tuning_mode clm5_0_cam6.0", From c56788f3091ff36e8933c0ab2936ea33a1019adf Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 11 Aug 2020 11:27:55 -0600 Subject: [PATCH 1302/1973] updating pointer to updated fates tag bug fix for lu --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 59cfdabc7d..a776c6a271 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.40.1_api.13.0.1 +tag = sci.1.40.3_api.13.0.1 required = True [PTCLM] From 5655dcfa11311472f394739246a91abed6c9fc6a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 11 Aug 2020 11:59:49 -0600 Subject: [PATCH 1303/1973] updates for 3d stream input --- cime_config/buildlib | 4 +- src/cpl/nuopc/SoilMoistureStreamMod.F90 | 390 ++++++++++++++++++++++++ src/cpl/nuopc/lnd_comp_nuopc.F90 | 28 +- src/cpl/nuopc/lnd_comp_shr.F90 | 15 + 4 files changed, 424 insertions(+), 13 deletions(-) create mode 100644 src/cpl/nuopc/SoilMoistureStreamMod.F90 create mode 100644 src/cpl/nuopc/lnd_comp_shr.F90 diff --git a/cime_config/buildlib b/cime_config/buildlib index 95fd0b14c3..f4baea01a0 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -106,6 +106,7 @@ def _main_func(): caseroot = case.get_value("CASEROOT") paths = [os.path.join(caseroot,"SourceMods","src.clm"), + os.path.join(lnd_root,"src","cpl",driver), os.path.join(lnd_root,"src","main"), os.path.join(lnd_root,"src","biogeophys"), os.path.join(lnd_root,"src","biogeochem"), @@ -119,8 +120,7 @@ def _main_func(): os.path.join(lnd_root,"src","fates","fire"), os.path.join(lnd_root,"src","fates","parteh"), os.path.join(lnd_root,"src","utils"), - os.path.join(lnd_root,"src","cpl"), - os.path.join(lnd_root,"src","cpl",driver)] + os.path.join(lnd_root,"src","cpl")] if driver == 'nuopc': paths.append(os.path.join(cimeroot,"src","drivers","nuopc","nuopc_cap_share")) diff --git a/src/cpl/nuopc/SoilMoistureStreamMod.F90 b/src/cpl/nuopc/SoilMoistureStreamMod.F90 new file mode 100644 index 0000000000..d8ea3b5fe9 --- /dev/null +++ b/src/cpl/nuopc/SoilMoistureStreamMod.F90 @@ -0,0 +1,390 @@ +module SoilMoistureStreamMod + +#include "shr_assert.h" + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Read in soil moisture from data stream + ! + ! !USES: + use ESMF + use dshr_strdata_mod , only : shr_strdata_type, shr_strdata_print + use dshr_strdata_mod , only : shr_strdata_init_from_inline, shr_strdata_advance + use dshr_methods_mod , only : dshr_fldbun_getfldptr + use dshr_stream_mod , only : shr_stream_file_null + use shr_kind_mod , only : r8 => shr_kind_r8, cl => shr_kind_CL, cxx => shr_kind_CXX + use shr_log_mod , only : errMsg => shr_log_errMsg + use shr_mpi_mod , only : shr_mpi_bcast + use decompMod , only : bounds_type + use abortutils , only : endrun + use clm_varctl , only : iulog, use_soil_moisture_streams + use controlMod , only : NLFilename + use LandunitType , only : lun + use ColumnType , only : col + use SoilStateType , only : soilstate_type + use WaterStateBulkType , only : waterstatebulk_type + use perf_mod , only : t_startf, t_stopf + use spmdMod , only : masterproc, mpicom, iam + use clm_time_manager , only : get_calendar, get_curr_date + use clm_nlUtilsMod , only : find_nlgroup_name + use clm_varpar , only : nlevsoi + use clm_varcon , only : denh2o, denice, watmin, spval + use landunit_varcon , only : istsoil, istcrop + use lnd_comp_shr , only : mesh, model_meshfile, model_clock + ! + ! !PUBLIC TYPES: + implicit none + private + ! + ! !PUBLIC MEMBER FUNCTIONS: + public :: PrescribedSoilMoistureInit ! position datasets for soil moisture + public :: PrescribedSoilMoistureAdvance ! Advance the soil moisture stream (outside of Open-MP loops) + public :: PrescribedSoilMoistureInterp ! interpolates between two periods of soil moisture data + + ! !PRIVATE MEMBER DATA: + type(shr_strdata_type) :: sdat_soilm ! soil moisture input data stream + character(*), parameter :: stream_var_name = "H2OSOI" ! base string for field string + character(len=CL) :: stream_lev_dimname = 'levsoi' ! name of vertical layer dimension + integer, allocatable :: g_to_ig(:) ! Array matching gridcell index to data index + logical :: soilm_ignore_data_if_missing ! If should ignore overridding a point with soil moisture data + ! from the streams file, if the streams file shows that point + ! as missing (namelist item) + ! !PRIVATE TYPES: + character(len=*), parameter, private :: sourcefile = & + __FILE__ + character(*), parameter :: u_FILE_u = & + __FILE__ + !----------------------------------------------------------------------- + +contains + + !----------------------------------------------------------------------- + ! + ! soil_moisture_init + ! + !----------------------------------------------------------------------- + subroutine PrescribedSoilMoistureInit(bounds) + ! + ! Initialize data stream information for soil moisture. + ! + ! !USES: + ! + ! !ARGUMENTS: + implicit none + type(bounds_type), intent(in) :: bounds ! bounds + ! + ! !LOCAL VARIABLES: + integer :: rc ! error coe + integer :: i ! index + integer :: stream_year_first_soilm ! first year in Ustar stream to use + integer :: stream_year_last_soilm ! last year in Ustar stream to use + integer :: model_year_align_soilm ! align stream_year_first_soilm with + integer :: nu_nml ! unit for namelist file + integer :: nml_error ! namelist i/o error flag + integer :: soilm_offset ! Offset in time for dataset (sec) + character(len=CL) :: stream_fldfilename_soilm ! ustar stream filename to read + character(len=CL) :: soilm_tintalgo = 'linear' ! Time interpolation alogrithm + character(len=CL) :: stream_mapalgo = 'bilinear' + real(r8) :: stream_dtlimit = 15._r8 + character(len=CL) :: stream_taxmode = 'cycle' + character(*), parameter :: subName = "('PrescribedSoilMoistureInit')" + character(*), parameter :: F00 = "('(PrescribedSoilMoistureInit) ',4a)" + !----------------------------------------------------------------------- + ! + ! deal with namelist variables here in init + ! + namelist /soil_moisture_streams/ & + stream_year_first_soilm, & + stream_year_last_soilm, & + model_year_align_soilm, & + soilm_tintalgo, & + soilm_offset, & + soilm_ignore_data_if_missing, & + stream_fldfilename_soilm + + ! Default values for namelist + stream_year_first_soilm = 1 ! first year in stream to use + stream_year_last_soilm = 1 ! last year in stream to use + model_year_align_soilm = 1 ! align stream_year_first_soilm with this model year + stream_fldfilename_soilm = shr_stream_file_null + soilm_offset = 0 + soilm_ignore_data_if_missing = .false. + + ! Read soilm_streams namelist + if (masterproc) then + open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) + call find_nlgroup_name(nu_nml, 'soil_moisture_streams', status=nml_error) + if (nml_error == 0) then + read(nu_nml, nml=soil_moisture_streams,iostat=nml_error) + if (nml_error /= 0) then + call endrun(subname // ':: ERROR reading soil_moisture_streams namelist') + end if + else + call endrun(subname // ':: ERROR finding soilm_streams namelist') + end if + close(nu_nml) + endif + + call shr_mpi_bcast(stream_year_first_soilm, mpicom) + call shr_mpi_bcast(stream_year_last_soilm, mpicom) + call shr_mpi_bcast(model_year_align_soilm, mpicom) + call shr_mpi_bcast(stream_fldfilename_soilm, mpicom) + call shr_mpi_bcast(soilm_tintalgo, mpicom) + call shr_mpi_bcast(soilm_offset, mpicom) + call shr_mpi_bcast(soilm_ignore_data_if_missing, mpicom) + + if (masterproc) then + write(iulog,*) ' ' + write(iulog,*) 'soil_moisture_stream settings:' + write(iulog,*) ' stream_year_first_soilm = ',stream_year_first_soilm + write(iulog,*) ' stream_year_last_soilm = ',stream_year_last_soilm + write(iulog,*) ' model_year_align_soilm = ',model_year_align_soilm + write(iulog,*) ' stream_fldfilename_soilm = ',trim(stream_fldfilename_soilm) + write(iulog,*) ' soilm_tintalgo = ',trim(soilm_tintalgo) + write(iulog,*) ' soilm_offset = ',soilm_offset + if ( soilm_ignore_data_if_missing ) then + write(iulog,*) ' Do NOT override a point with streams data if the streams data is missing' + else + write(iulog,*) ' Abort, if you find a model point where the input streams data is set to missing value' + end if + endif + + ! Initialize the cdeps data type sdat_soilm + ! TODO: for now stream_meshfile is the same as the model meshfile - must generalize this if want to have + ! stream be at a different resolution + + call shr_strdata_init_from_inline(sdat_soilm, & + my_task = iam, & + logunit = iulog, & + compname = 'LND', & + model_clock = model_clock, & + model_mesh = mesh, & + stream_meshfile = model_meshfile, & + stream_lev_dimname = trim(stream_lev_dimname), & + stream_mapalgo = trim(stream_mapalgo), & + stream_filenames = (/trim(stream_fldfilename_soilm)/), & + stream_fldlistFile = (/trim(stream_var_name)/), & + stream_fldListModel = (/trim(stream_var_name)/), & + stream_yearFirst = stream_year_first_soilm, & + stream_yearLast = stream_year_last_soilm, & + stream_yearAlign = model_year_align_soilm, & + stream_offset = soilm_offset, & + stream_taxmode = stream_taxmode, & + stream_dtlimit = stream_dtlimit, & + stream_tintalgo = soilm_tintalgo, & + rc = rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call ESMF_Finalize(endflag=ESMF_END_ABORT) + end if + + if (masterproc) then + call shr_strdata_print(sdat_soilm,'soil moisture data') + endif + + end subroutine PrescribedSoilMoistureInit + + !----------------------------------------------------------------------- + ! + ! PrescribedSoilMoistureAdvance + ! + !----------------------------------------------------------------------- + subroutine PrescribedSoilMoistureAdvance( bounds ) + ! + ! Advanace the prescribed soil moisture stream + ! + ! !USES: + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: rc + integer :: g, ig + integer :: ier ! error code + integer :: year ! year (0, ...) for nstep+1 + integer :: mon ! month (1, ..., 12) for nstep+1 + integer :: day ! day of month (1, ..., 31) for nstep+1 + integer :: sec ! seconds into current date for nstep+1 + integer :: mcdate ! Current model date (yyyymmdd) + !----------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + call get_curr_date(year, mon, day, sec) + mcdate = year*10000 + mon*100 + day + + ! Advance sdat stream + call shr_strdata_advance(sdat_soilm, ymd=mcdate, tod=sec, logunit=iulog, istr='soil_moisture', rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call ESMF_Finalize(endflag=ESMF_END_ABORT) + end if + + ! Map gridcell to 1->local_size (g_to_ig is a module variable) + ier = 0 + if ( .not. allocated(g_to_ig) )then + allocate (g_to_ig(bounds%begg:bounds%endg), stat=ier) + if (ier /= 0) then + write(iulog,*) 'Prescribed soil moisture allocation error' + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + + ig = 0 + do g = bounds%begg,bounds%endg + ig = ig+1 + g_to_ig(g) = ig + end do + end if + + end subroutine PrescribedSoilMoistureAdvance + + !----------------------------------------------------------------------- + ! + ! PrescribedSoilMoistureInterp + ! + !----------------------------------------------------------------------- + subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, waterstatebulk_inst) + ! + ! Assign data stream information for prescribed soil moisture. + ! + ! !USES: + ! + ! !ARGUMENTS: + implicit none + type(bounds_type) , intent(in) :: bounds + type(soilstate_type) , intent(in) :: soilstate_inst + type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst + ! + ! !LOCAL VARIABLES: + integer :: rc + integer :: c, g, j, ig, n + real(r8) :: soilm_liq_frac ! liquid fraction of soil moisture + real(r8) :: soilm_ice_frac ! ice fraction of soil moisture + real(r8) :: moisture_increment ! soil moisture adjustment increment + real(r8) :: h2osoi_vol_initial ! initial vwc value + real(r8), pointer :: dataptr2d(:,:) ! first dimension is level, second is data on that level + character(*), parameter :: subName = "('PrescribedSoilMoistureInterp')" + !----------------------------------------------------------------------- + + SHR_ASSERT_FL( (lbound(g_to_ig,1) <= bounds%begg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(g_to_ig,1) >= bounds%endg ), sourcefile, __LINE__) + associate( & + dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) + watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) + h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input/Output: [real(r8) (:,:) ] liquid water (kg/m2) + h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input/Output: [real(r8) (:,:) ] ice water (kg/m2) + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col , & ! Output: volumetric soil water (m3/m3) + h2osoi_vol_prs => waterstatebulk_inst%h2osoi_vol_prs_grc & ! Output: prescribed volumetric soil water (m3/m3) + ) + SHR_ASSERT_FL( (lbound(h2osoi_vol,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_vol,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_vol,2) == 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_vol,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(dz,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(dz,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(dz,2) <= 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(dz,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(watsat,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(watsat,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(watsat,2) <= 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(watsat,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_liq,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_liq,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_liq,2) <= 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_liq,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_ice,1) <= bounds%begc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_ice,1) >= bounds%endc ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_ice,2) <= 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_ice,2) >= nlevsoi ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_vol_prs,1) <= bounds%begg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_vol_prs,1) >= bounds%endg ), sourcefile, __LINE__) + SHR_ASSERT_FL( (lbound(h2osoi_vol_prs,2) == 1 ), sourcefile, __LINE__) + SHR_ASSERT_FL( (ubound(h2osoi_vol_prs,2) >= nlevsoi ), sourcefile, __LINE__) + + ! Get pointer for stream data that is time and spatially interpolate to model time and grid + call dshr_fldbun_getFldPtr(sdat_soilm%pstrm(1)%fldbun_model, trim(stream_var_name), fldptr2=dataptr2d, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call ESMF_Finalize(endflag=ESMF_END_ABORT) + end if + + ! Check that inner most dimensino of dataptr2d is equal to nlevsoi + if (size(dataptr2d,dim=1) /= nlevsoi) then + if (masterproc) then + write(iulog,*) 'ERROR: dataptr2d(dim=1) = ',size(dataptr2d,dim=1),& + ' and nlevsoi = ',nlevsoi,' must match ' + end if + call endrun(trim(subname) // & + ' ERROR:: The input soil moisture stream does not have levels equal to nlevsoi') + end if + + ! Set the prescribed soil moisture read from the file everywhere + do g = bounds%begg, bounds%endg + ig = g_to_ig(g) + do j = 1, nlevsoi + h2osoi_vol_prs(g,j) = dataptr2d(j,ig) + + ! If soil moiture is being interpolated in time and the result is + ! large that probably means one of the two data points is missing (set to spval) + if ( h2osoi_vol_prs(g,j) > 10.0_r8 .and. (h2osoi_vol_prs(g,j) /= spval) )then + h2osoi_vol_prs(g,j) = spval + end if + end do + end do + + do c = bounds%begc, bounds%endc + ! Set variable for each gridcell/column combination + g = col%gridcell(c) + ig = g_to_ig(g) + + ! EBK Jan/2020, also check weights on gridcell (See https://github.com/ESCOMP/CTSM/issues/847) + if ( (lun%itype(col%landunit(c)) == istsoil) .or. & + (lun%itype(col%landunit(c)) == istcrop) .and. (col%wtgcell(c) /= 0._r8) ) then + + ! this is a 2d field (gridcell/nlevsoi) ! + do j = 1, nlevsoi + ! if soil water is zero, liq/ice fractions cannot be calculated + if((h2osoi_liq(c, j) + h2osoi_ice(c, j)) > 0._r8) then + + ! save original soil moisture value + h2osoi_vol_initial = h2osoi_vol(c,j) + + ! Check if the vegetated land mask from the dataset on the + ! file is different + if ( (h2osoi_vol_prs(g,j) == spval) .and. (h2osoi_vol_initial /= spval) )then + if ( soilm_ignore_data_if_missing )then + cycle + else + write(iulog,*) 'Input soil moisture dataset is not vegetated as expected: gridcell=', & + g, ' active = ', col%active(c) + call endrun(subname //& + ' ERROR:: The input soil moisture stream is NOT vegetated for one of the land points' ) + end if + end if + + ! update volumetric soil moisture from data prescribed from the file + h2osoi_vol(c,j) = h2osoi_vol_prs(g,j) + + ! calculate liq/ice mass fractions + soilm_liq_frac = h2osoi_liq(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) + soilm_ice_frac = h2osoi_ice(c, j) /(h2osoi_liq(c, j) + h2osoi_ice(c, j)) + + ! calculate moisture increment + moisture_increment = h2osoi_vol(c,j) - h2osoi_vol_initial + ! add limitation check + moisture_increment = min((watsat(c,j) - h2osoi_vol_initial),max(-(h2osoi_vol_initial-watmin),moisture_increment)) + + ! update liq/ice water mass due to (volumetric) moisture increment + h2osoi_liq(c,j) = h2osoi_liq(c,j) + (soilm_liq_frac * moisture_increment * dz(c, j) * denh2o) + h2osoi_ice(c,j) = h2osoi_ice(c,j) + (soilm_ice_frac * moisture_increment * dz(c, j) * denice) + + else + call endrun(subname // ':: ERROR h2osoil liquid plus ice is zero') + endif + enddo + endif + end do + + end associate + + end subroutine PrescribedSoilMoistureInterp + +end module SoilMoistureStreamMod diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 61eee73fc2..ef85e6dc5c 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -34,14 +34,14 @@ module lnd_comp_nuopc use clm_time_manager , only : get_curr_date, get_curr_calday use clm_initializeMod , only : initialize1, initialize2 use clm_driver , only : clm_drv - use lnd_import_export , only : advertise_fields, realize_fields - use lnd_import_export , only : import_fields, export_fields use nuopc_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit use nuopc_shr_methods , only : set_component_logging, get_component_instance, log_clock_advance use perf_mod , only : t_startf, t_stopf, t_barrierf use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable + use lnd_import_export , only : advertise_fields, realize_fields, import_fields, export_fields + use lnd_comp_shr , only : mesh, model_meshfile, model_clock implicit none private ! except @@ -201,7 +201,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call mpi_comm_dup(lmpicom, mpicom, ierr) - ! Note still need compid for those parts of the code that use the data model ! functionality through subroutine calls call NUOPC_CompAttributeGet(gcomp, name='MCTID', value=cvalue, rc=rc) @@ -340,7 +339,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_Mesh) :: mesh, gridmesh ! esmf mesh + type(ESMF_Mesh) :: gridmesh ! temporary esmf mesh type(ESMF_DistGrid) :: DistGrid ! esmf global index space descriptor type(ESMF_VM) :: vm type(ESMF_Time) :: currTime ! Current time @@ -423,6 +422,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !$ call omp_set_num_threads(localPeCount) print *,__FILE__,__LINE__,localPeCount + !---------------------- ! Obtain attribute values !---------------------- @@ -544,6 +544,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ref_tod_in=ref_tod, & dtime_in=dtime_sync) + !---------------------------------------------------------------------------- + ! Set model clock in lnd_comp_shr + !---------------------------------------------------------------------------- + + model_clock = clock + !---------------------- ! Read namelist, grid and surface data !---------------------- @@ -597,11 +603,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !-------------------------------- ! determine if the mesh will be created or read in - call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=cvalue, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=model_meshfile, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (single_column) cvalue = 'create_mesh' + if (single_column) model_meshfile = 'create_mesh' - if (cvalue == 'create_mesh') then + if (trim(model_meshfile) == 'create_mesh') then ! get the datm grid from the domain file call NUOPC_CompAttributeGet(gcomp, name='domain_lnd', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -658,11 +664,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else ! read in the mesh from the file - mesh = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, & + mesh = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, & elementDistgrid=Distgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then - write(iulog,*)'mesh file for domain is ',trim(cvalue) + write(iulog,*)'mesh file for domain is ',trim(model_meshfile) end if end if @@ -778,7 +784,7 @@ subroutine ModelAdvance(gcomp, rc) !------------------------ use clm_instMod, only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst -!$ use omp_lib, only : omp_set_num_threads + !$ use omp_lib, only : omp_set_num_threads use ESMF, only : ESMF_VM, ESMF_VMGet ! input/output variables @@ -834,7 +840,7 @@ subroutine ModelAdvance(gcomp, rc) call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return -!$ call omp_set_num_threads(localPeCount) + !$ call omp_set_num_threads(localPeCount) call shr_file_getLogUnit (shrlogunit) call shr_file_setLogUnit (iulog) diff --git a/src/cpl/nuopc/lnd_comp_shr.F90 b/src/cpl/nuopc/lnd_comp_shr.F90 new file mode 100644 index 0000000000..dd619c7648 --- /dev/null +++ b/src/cpl/nuopc/lnd_comp_shr.F90 @@ -0,0 +1,15 @@ +module lnd_comp_shr + + ! Model mesh info is here in order to be leveraged by CDEPS in line calls + + use ESMF + use shr_kind_mod, only : r8 => shr_kind_r8, cl=>shr_kind_cl + + implicit none + public + + type(ESMF_Clock) :: model_clock ! model clock + type(ESMF_Mesh) :: mesh ! model_mesh + character(len=cl) :: model_meshfile ! model mesh file + +end module lnd_comp_shr From 766a2ea0b634cf57b7f31922278ae5bd189a7f8f Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 12 Aug 2020 13:07:15 -0600 Subject: [PATCH 1304/1973] Consolidation of repetitive code with bit-for-bit same answers --- src/cpl/lilac/lnd_import_export.F90 | 121 ++------------------ src/cpl/mct/lnd_import_export.F90 | 138 +++++++---------------- src/cpl/nuopc/lnd_import_export.F90 | 113 ++----------------- src/main/atm2lndType.F90 | 12 ++ src/utils/lnd_import_export_utils.F90 | 152 ++++++++++++++++++++++++++ 5 files changed, 218 insertions(+), 318 deletions(-) create mode 100644 src/utils/lnd_import_export_utils.F90 diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 4f0881e06e..7de5400109 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -2,12 +2,8 @@ module lnd_import_export use ESMF use shr_kind_mod , only : r8 => shr_kind_r8, cx=>shr_kind_cx, cxx=>shr_kind_cxx, cs=>shr_kind_cs - use shr_infnan_mod , only : isnan => shr_infnan_isnan - use shr_string_mod , only : shr_string_listGetName, shr_string_listGetNum use shr_sys_mod , only : shr_sys_abort - use shr_const_mod , only : SHR_CONST_TKFRZ, fillvalue=>SHR_CONST_SPVAL - use clm_varctl , only : iulog, co2_ppmv, ndep_from_cpl - use clm_varcon , only : rair, o2_molar_const + use clm_varctl , only : iulog, ndep_from_cpl use clm_time_manager , only : get_nstep use clm_instMod , only : atm2lnd_inst, lnd2atm_inst, water_inst use domainMod , only : ldomain @@ -18,7 +14,7 @@ module lnd_import_export use atm2lndType , only : atm2lnd_type use lnd_shr_methods , only : chkerr use shr_megan_mod , only : shr_megan_mechcomps_n ! TODO: need to add a namelist read here (see https://github.com/ESCOMP/CTSM/issues/926) - use QSatMod , only : QSat + use lnd_import_export_utils, only : derive_quantities, check_for_nans implicit none private ! except @@ -29,7 +25,6 @@ module lnd_import_export private :: state_getimport private :: state_setexport private :: state_getfldptr - private :: check_for_nans ! from atm->lnd integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn @@ -68,17 +63,8 @@ subroutine import_fields( importState, bounds, first_call, rc) integer :: begg, endg ! bounds integer :: g,i,k ! indices real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) - real(r8) :: co2_ppmv_val ! temporary - real(r8) :: forc_t ! atmospheric temperature (Kelvin) - real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) - real(r8) :: forc_pbot ! atmospheric pressure (Pa) - real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s - real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s - real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s - real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s real(r8) :: forc_noy(bounds%begg:bounds%endg) real(r8) :: forc_nhx(bounds%begg:bounds%endg) - real(r8) :: topo_grc(bounds%begg:bounds%endg, 0:glc_nec) character(len=*), parameter :: subname='(lnd_import_export:import_fields)' !--------------------------------------------------------------------------- @@ -143,19 +129,19 @@ subroutine import_fields( importState, bounds, first_call, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainc', bounds, & - output=forc_rainc, rc=rc ) + output=atm2lnd_inst%forc_rainc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainl', bounds, & - output=forc_rainl, rc=rc ) + output=atm2lnd_inst%forc_rainl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowc', bounds, & - output=forc_snowc, rc=rc ) + output=atm2lnd_inst%forc_snowc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowl', bounds, & - output=forc_snowl, rc=rc ) + output=atm2lnd_inst%forc_snowl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_lwdn', bounds, & @@ -244,80 +230,16 @@ subroutine import_fields( importState, bounds, first_call, rc) water_inst%wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 - !-------------------------- - ! Derived quantities - !-------------------------- - do g = begg, endg - forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) - forc_q = water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) - forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) - - atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] - atm2lnd_inst%forc_hgt_t_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of temperature [m] - atm2lnd_inst%forc_hgt_q_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of humidity [m] - - atm2lnd_inst%forc_vp_grc(g) = forc_q * forc_pbot / (0.622_r8 + 0.378_r8 * forc_q) - - atm2lnd_inst%forc_rho_not_downscaled_grc(g) = & - (forc_pbot - 0.378_r8 * atm2lnd_inst%forc_vp_grc(g)) / (rair * forc_t) - - atm2lnd_inst%forc_po2_grc(g) = o2_molar_const * forc_pbot - - atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv * 1.e-6_r8 * forc_pbot - - atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) - - atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & - atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) - - water_inst%wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) - water_inst%wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) - - - call QSat(forc_t, forc_pbot, qsat_kg_kg) - - ! modify specific humidity if precip occurs - if (1==2) then - if ((forc_rainc(g)+forc_rainl(g)) > 0._r8) then - forc_q = 0.95_r8*qsat_kg_kg - !forc_q = qsat_kg_kg - water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q - endif - endif - - water_inst%wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) water_inst%wateratm2lndbulk_inst%volr_grc(g) = 0._r8 water_inst%wateratm2lndbulk_inst%volrmch_grc(g) = 0._r8 end do !-------------------------- - ! Error checks + ! Derived quantities for required fields !-------------------------- - ! Check that solar, specific-humidity and LW downward aren't negative - do g = begg,endg - if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 ) then - call shr_sys_abort( subname//& - ' ERROR: Longwave down sent from the atmosphere model is negative or zero' ) - end if - if ( (atm2lnd_inst%forc_solad_grc(g,1) < 0.0_r8) .or. & - (atm2lnd_inst%forc_solad_grc(g,2) < 0.0_r8) .or. & - (atm2lnd_inst%forc_solai_grc(g,1) < 0.0_r8) .or. & - (atm2lnd_inst%forc_solai_grc(g,2) < 0.0_r8) ) then - call shr_sys_abort( subname//& - ' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & - ' from the atmosphere model is negative or zero' ) - end if - if ( water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then - call shr_sys_abort( subname//& - ' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) - end if - end do - - ! Make sure relative humidity is properly bounded - ! atm2lnd_inst%forc_rh_grc(g) = min( 100.0_r8, atm2lnd_inst%forc_rh_grc(g) ) - ! atm2lnd_inst%forc_rh_grc(g) = max( 0.0_r8, atm2lnd_inst%forc_rh_grc(g) ) + call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst) end subroutine import_fields @@ -794,31 +716,4 @@ subroutine state_getfldptr(State, fb, fldname, fldptr1d, fldptr2d, rc) end subroutine state_getfldptr - !=============================================================================== - - subroutine check_for_nans(array, fname, begg) - - ! input/output variables - real(r8) , intent(in) :: array(:) - character(len=*) , intent(in) :: fname - integer , intent(in) :: begg - ! - ! local variables - integer :: i - !------------------------------------------------------------------------------- - - ! Check if any input from lilac or output to lilac is NaN - - if (any(isnan(array))) then - write(iulog,*) '# of NaNs = ', count(isnan(array)) - write(iulog,*) 'Which are NaNs = ', isnan(array) - do i = 1, size(array) - if (isnan(array(i))) then - write(iulog,*) "NaN found in field ", trim(fname), ' at gridcell index ',begg+i-1 - end if - end do - call shr_sys_abort(' ERROR: One or more of the output from CLM to the coupler are NaN ' ) - end if - end subroutine check_for_nans - end module lnd_import_export diff --git a/src/cpl/mct/lnd_import_export.F90 b/src/cpl/mct/lnd_import_export.F90 index 7c449b5b8f..b739980376 100644 --- a/src/cpl/mct/lnd_import_export.F90 +++ b/src/cpl/mct/lnd_import_export.F90 @@ -27,12 +27,9 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat use seq_flds_mod , only: seq_flds_x2l_fields use clm_varctl , only: co2_type, co2_ppmv, iulog, use_c13 use clm_varctl , only: ndep_from_cpl - use clm_varcon , only: rair, o2_molar_const, c13ratio - use shr_const_mod , only: SHR_CONST_TKFRZ - use shr_string_mod , only: shr_string_listGetName + use clm_varcon , only: c13ratio use domainMod , only: ldomain - use QSatMod , only: QSat - use shr_infnan_mod , only : isnan => shr_infnan_isnan + use lnd_import_export_utils, only : derive_quantities, check_for_nans ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds ! bounds @@ -43,15 +40,10 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat type(wateratm2lndbulk_type), intent(inout) :: wateratm2lndbulk_inst ! clm internal input data type ! ! !LOCAL VARIABLES: + integer :: begg, endg ! bounds integer :: g,i,k,nstep,ier ! indices, number of steps, and error code - real(r8) :: forc_rainc ! rainxy Atm flux mm/s real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) - real(r8) :: forc_t ! atmospheric temperature (Kelvin) - real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) - real(r8) :: forc_rainl ! rainxy Atm flux mm/s - real(r8) :: forc_snowc ! snowfxy Atm flux mm/s - real(r8) :: forc_snowl ! snowfxl Atm flux mm/s real(r8) :: co2_ppmv_diag ! temporary real(r8) :: co2_ppmv_prog ! temporary real(r8) :: co2_ppmv_val ! temporary @@ -61,6 +53,9 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat !--------------------------------------------------------------------------- + ! Set bounds + begg = bounds%begg; endg = bounds%endg + co2_type_idx = 0 if (co2_type == 'prognostic') then co2_type_idx = 1 @@ -79,9 +74,8 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat ! by 1000 mm/m resulting in an overall factor of unity. ! Below the units are therefore given in mm/s. - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) + do g = begg,endg + i = 1 + (g - begg) ! Determine flooding input, sign convention is positive downward and ! hierarchy is atm/glc/lnd/rof/ice/ocn. so water sent from rof to land is negative, @@ -109,10 +103,10 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat atm2lnd_inst%forc_t_not_downscaled_grc(g) = x2l(index_x2l_Sa_tbot,i) ! forc_txy Atm state K atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) = x2l(index_x2l_Faxa_lwdn,i) ! flwdsxy Atm flux W/m^2 - forc_rainc = x2l(index_x2l_Faxa_rainc,i) ! mm/s - forc_rainl = x2l(index_x2l_Faxa_rainl,i) ! mm/s - forc_snowc = x2l(index_x2l_Faxa_snowc,i) ! mm/s - forc_snowl = x2l(index_x2l_Faxa_snowl,i) ! mm/s + atm2lnd_inst%forc_rainc_grc(g) = x2l(index_x2l_Faxa_rainc,i) ! mm/s + atm2lnd_inst%forc_rainl_grc(g) = x2l(index_x2l_Faxa_rainl,i) ! mm/s + atm2lnd_inst%forc_snowc_grc(g) = x2l(index_x2l_Faxa_snowc,i) ! mm/s + atm2lnd_inst%forc_snowl_grc(g) = x2l(index_x2l_Faxa_snowl,i) ! mm/s ! atmosphere coupling, for prognostic/prescribed aerosols atm2lnd_inst%forc_aer_grc(g,1) = x2l(index_x2l_Faxa_bcphidry,i) @@ -148,74 +142,27 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat atm2lnd_inst%forc_pch4_grc(g) = x2l(index_x2l_Sa_methane,i) endif - ! Determine derived quantities for required fields + !-------------------------- + ! Check for nans from coupler + !-------------------------- - forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) - forc_q = wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) - forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) - - atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] - atm2lnd_inst%forc_hgt_t_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of temperature [m] - atm2lnd_inst%forc_hgt_q_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of humidity [m] - atm2lnd_inst%forc_vp_grc(g) = forc_q * forc_pbot / (0.622_r8 + 0.378_r8 * forc_q) - atm2lnd_inst%forc_rho_not_downscaled_grc(g) = & - (forc_pbot - 0.378_r8 * atm2lnd_inst%forc_vp_grc(g)) / (rair * forc_t) - atm2lnd_inst%forc_po2_grc(g) = o2_molar_const * forc_pbot - atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) - atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & - atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) - - wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc + forc_rainl - wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc + forc_snowl - - call QSat(forc_t, forc_pbot, qsat_kg_kg) - - !modify specific humidity if precip occurs - if(1==2) then - if((forc_rainc+forc_rainl) > 0._r8) then - forc_q = 0.95_r8 * qsat_kg_kg - ! forc_q = qsat_kg_kg - wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q - endif - endif + call check_for_nans(x2l(:,i), fname, begg) - wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) + end do - ! Check that solar, specific-humidity and LW downward aren't negative - if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 )then - call endrun( sub//' ERROR: Longwave down sent from the atmosphere model is negative or zero' ) - end if - if ( (atm2lnd_inst%forc_solad_grc(g,1) < 0.0_r8) .or. (atm2lnd_inst%forc_solad_grc(g,2) < 0.0_r8) & - .or. (atm2lnd_inst%forc_solai_grc(g,1) < 0.0_r8) .or. (atm2lnd_inst%forc_solai_grc(g,2) < 0.0_r8) ) then - call endrun( sub//' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & - ' from the atmosphere model is negative or zero' ) - end if - if ( wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then - call endrun( sub//' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) - end if + !-------------------------- + ! Derived quantities for required fields + !-------------------------- - ! Check if any input from the coupler is NaN - if ( any(isnan(x2l(:,i))) )then - write(iulog,*) '# of NaNs = ', count(isnan(x2l(:,i))) - write(iulog,*) 'Which are NaNs = ', isnan(x2l(:,i)) - do k = 1, size(x2l(:,i)) - if ( isnan(x2l(k,i)) )then - call shr_string_listGetName( seq_flds_x2l_fields, k, fname ) - write(iulog,*) trim(fname) - end if - end do - write(iulog,*) 'gridcell index = ', g - call endrun( sub//' ERROR: One or more of the input from the atmosphere model are NaN '// & - '(Not a Number from a bad floating point calculation)' ) - end if + call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst) - ! Make sure relative humidity is properly bounded - ! wateratm2lndbulk_inst%forc_rh_grc(g) = min( 100.0_r8, wateratm2lndbulk_inst%forc_rh_grc(g) ) - ! wateratm2lndbulk_inst%forc_rh_grc(g) = max( 0.0_r8, wateratm2lndbulk_inst%forc_rh_grc(g) ) + ! Determine derived quantities for optional fields + ! Note that the following does unit conversions from ppmv to partial pressures (Pa) + ! Note that forc_pbot is in Pa - ! Determine derived quantities for optional fields - ! Note that the following does unit conversions from ppmv to partial pressures (Pa) - ! Note that forc_pbot is in Pa + do g = begg,endg + + forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) if (co2_type_idx == 1) then co2_ppmv_val = co2_ppmv_prog @@ -268,13 +215,10 @@ subroutine lnd_export( bounds, waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst use shr_kind_mod , only : r8 => shr_kind_r8 use seq_flds_mod , only : seq_flds_l2x_fields use clm_varctl , only : iulog - use clm_time_manager , only : get_nstep use seq_drydep_mod , only : n_drydep use shr_megan_mod , only : shr_megan_mechcomps_n use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n - use domainMod , only : ldomain - use shr_string_mod , only : shr_string_listGetName - use shr_infnan_mod , only : isnan => shr_infnan_isnan + use lnd_import_export_utils, only : check_for_nans ! ! !ARGUMENTS: implicit none @@ -285,6 +229,7 @@ subroutine lnd_export( bounds, waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst real(r8) , intent(out) :: l2x(:,:)! land to coupler export state on land grid ! ! !LOCAL VARIABLES: + integer :: begg, endg ! bounds integer :: g,i,k ! indices integer :: ier ! error status integer :: nstep ! time step index @@ -294,12 +239,15 @@ subroutine lnd_export( bounds, waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst character(len=32), parameter :: sub = 'lnd_export' !--------------------------------------------------------------------------- + ! Set bounds + begg = bounds%begg; endg = bounds%endg + ! cesm sign convention is that fluxes are positive downward l2x(:,:) = 0.0_r8 - do g = bounds%begg,bounds%endg - i = 1 + (g-bounds%begg) + do g = begg,endg + i = 1 + (g-begg) l2x(index_l2x_Sl_t,i) = lnd2atm_inst%t_rad_grc(g) l2x(index_l2x_Sl_snowh,i) = waterlnd2atmbulk_inst%h2osno_grc(g) l2x(index_l2x_Sl_avsdr,i) = lnd2atm_inst%albd_grc(g,1) @@ -384,19 +332,11 @@ subroutine lnd_export( bounds, waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst l2x(index_l2x_Flgl_qice(num),i) = lnd2glc_inst%qice_grc(g,num) end do - ! Check if any output sent to the coupler is NaN - if ( any(isnan(l2x(:,i))) )then - write(iulog,*) '# of NaNs = ', count(isnan(l2x(:,i))) - write(iulog,*) 'Which are NaNs = ', isnan(l2x(:,i)) - do k = 1, size(l2x(:,i)) - if ( isnan(l2x(k,i)) )then - call shr_string_listGetName( seq_flds_l2x_fields, k, fname ) - write(iulog,*) trim(fname) - end if - end do - write(iulog,*) 'gridcell index = ', g - call endrun( sub//' ERROR: One or more of the output from CLM to the coupler are NaN ' ) - end if + !-------------------------- + ! Check for nans to coupler + !-------------------------- + + call check_for_nans(l2x(:,i), fname, begg) end do diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index eec37992b7..750d7120fe 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -8,8 +8,6 @@ module lnd_import_export use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise, NUOPC_IsConnected use NUOPC_Model , only : NUOPC_ModelGet use shr_kind_mod , only : r8 => shr_kind_r8, cx=>shr_kind_cx, cxx=>shr_kind_cxx, cs=>shr_kind_cs - use shr_infnan_mod , only : isnan => shr_infnan_isnan - use shr_string_mod , only : shr_string_listGetName, shr_string_listGetNum use shr_sys_mod , only : shr_sys_abort use clm_varctl , only : iulog use clm_time_manager , only : get_nstep @@ -26,6 +24,7 @@ module lnd_import_export use shr_carma_mod , only : shr_carma_readnl use shr_ndep_mod , only : shr_ndep_readnl use lnd_shr_methods , only : chkerr + use lnd_import_export_utils, only : derive_quantities, check_for_nans implicit none private ! except @@ -40,7 +39,6 @@ module lnd_import_export private :: state_getimport private :: state_setexport private :: state_getfldptr - private :: check_for_nans type fld_list_type character(len=128) :: stdname @@ -390,14 +388,8 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & integer :: begg, endg ! bounds integer :: g,i,k ! indices real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) - real(r8) :: forc_t ! atmospheric temperature (Kelvin) - real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) real(r8) :: co2_ppmv_input(bounds%begg:bounds%endg) ! temporary - real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s - real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s - real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s - real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s real(r8) :: forc_noy(bounds%begg:bounds%endg) real(r8) :: forc_nhx(bounds%begg:bounds%endg) real(r8) :: frac_grc(bounds%begg:bounds%endg, 0:glc_nec) @@ -453,16 +445,16 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_getimport(importState, 'Sa_tbot', bounds, output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_rainc', bounds, output=forc_rainc, rc=rc ) + call state_getimport(importState, 'Faxa_rainc', bounds, output=atm2lnd_inst%forc_rainc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_rainl', bounds, output=forc_rainl, rc=rc ) + call state_getimport(importState, 'Faxa_rainl', bounds, output=atm2lnd_inst%forc_rainl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_snowc', bounds, output=forc_snowc, rc=rc ) + call state_getimport(importState, 'Faxa_snowc', bounds, output=atm2lnd_inst%forc_snowc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_snowl', bounds, output=forc_snowl, rc=rc ) + call state_getimport(importState, 'Faxa_snowl', bounds, output=atm2lnd_inst%forc_snowl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'Faxa_lwdn', bounds, output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) @@ -657,74 +649,10 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end if !-------------------------- - ! Derived quantities + ! Derived quantities for required fields !-------------------------- - do g = begg, endg - forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) - forc_q = wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) - forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) - - atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] - atm2lnd_inst%forc_hgt_t_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of temperature [m] - atm2lnd_inst%forc_hgt_q_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of humidity [m] - - atm2lnd_inst%forc_vp_grc(g) = forc_q * forc_pbot / (0.622_r8 + 0.378_r8 * forc_q) - - atm2lnd_inst%forc_rho_not_downscaled_grc(g) = & - (forc_pbot - 0.378_r8 * atm2lnd_inst%forc_vp_grc(g)) / (rair * forc_t) - - atm2lnd_inst%forc_po2_grc(g) = o2_molar_const * forc_pbot - - atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) - - atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & - atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) - - wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) - wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) - - call QSat(forc_t, forc_pbot, qsat_kg_kg) - - ! modify specific humidity if precip occurs - if (1==2) then - if ((forc_rainc(g)+forc_rainl(g)) > 0._r8) then - forc_q = 0.95_r8*qsat_kg_kg - !forc_q = qsat_kg_kg - wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q - endif - endif - - wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) - end do - - !-------------------------- - ! Error checks - !-------------------------- - - ! Check that solar, specific-humidity and LW downward aren't negative - do g = begg,endg - if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 ) then - call shr_sys_abort( subname//& - ' ERROR: Longwave down sent from the atmosphere model is negative or zero' ) - end if - if ( (atm2lnd_inst%forc_solad_grc(g,1) < 0.0_r8) .or. & - (atm2lnd_inst%forc_solad_grc(g,2) < 0.0_r8) .or. & - (atm2lnd_inst%forc_solai_grc(g,1) < 0.0_r8) .or. & - (atm2lnd_inst%forc_solai_grc(g,2) < 0.0_r8) ) then - call shr_sys_abort( subname//& - ' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & - ' from the atmosphere model is negative or zero' ) - end if - if ( wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then - call shr_sys_abort( subname//& - ' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) - end if - end do - - ! Make sure relative humidity is properly bounded - ! atm2lnd_inst%forc_rh_grc(g) = min( 100.0_r8, atm2lnd_inst%forc_rh_grc(g) ) - ! atm2lnd_inst%forc_rh_grc(g) = max( 0.0_r8, atm2lnd_inst%forc_rh_grc(g) ) + call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst) end subroutine import_fields @@ -1313,31 +1241,4 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) end subroutine state_getfldptr - !=============================================================================== - - subroutine check_for_nans(array, fname, begg) - - ! input/output variables - real(r8) , intent(in) :: array(:) - character(len=*) , intent(in) :: fname - integer , intent(in) :: begg - - ! local variables - integer :: i - !------------------------------------------------------------------------------- - - ! Check if any input from mediator or output to mediator is NaN - - if (any(isnan(array))) then - write(iulog,*) '# of NaNs = ', count(isnan(array)) - write(iulog,*) 'Which are NaNs = ', isnan(array) - do i = 1, size(array) - if (isnan(array(i))) then - write(iulog,*) "NaN found in field ", trim(fname), ' at gridcell index ',begg+i-1 - end if - end do - call shr_sys_abort(' ERROR: One or more of the output from CLM to the coupler are NaN ' ) - end if - end subroutine check_for_nans - end module lnd_import_export diff --git a/src/main/atm2lndType.F90 b/src/main/atm2lndType.F90 index a2d09ca85c..949433ea2f 100644 --- a/src/main/atm2lndType.F90 +++ b/src/main/atm2lndType.F90 @@ -89,6 +89,10 @@ module atm2lndType real(r8), pointer :: forc_po2_240_patch (:) => null() ! 10-day mean O2 partial pressure (Pa) real(r8), pointer :: forc_aer_grc (:,:) => null() ! aerosol deposition array real(r8), pointer :: forc_pch4_grc (:) => null() ! CH4 partial pressure (Pa) + real(r8), pointer :: forc_rainc_grc (:) => null() ! convective rain (mm/s) + real(r8), pointer :: forc_rainl_grc (:) => null() ! large scale rain (mm/s) + real(r8), pointer :: forc_snowc_grc (:) => null() ! convective snow (mm/s) + real(r8), pointer :: forc_snowl_grc (:) => null() ! large scale snow (mm/s) real(r8), pointer :: forc_t_not_downscaled_grc (:) => null() ! not downscaled atm temperature (Kelvin) real(r8), pointer :: forc_th_not_downscaled_grc (:) => null() ! not downscaled atm potential temperature (Kelvin) @@ -487,6 +491,10 @@ subroutine InitAllocate(this, bounds) allocate(this%forc_po2_240_patch (begp:endp)) ; this%forc_po2_240_patch (:) = ival allocate(this%forc_pbot240_downscaled_patch(begp:endp)) ; this%forc_pbot240_downscaled_patch (:) = ival endif + allocate(this%forc_rainc_grc (begg:endg)) ; this%forc_rainc_grc (:) = ival + allocate(this%forc_rainl_grc (begg:endg)) ; this%forc_rainl_grc (:) = ival + allocate(this%forc_snowc_grc (begg:endg)) ; this%forc_snowc_grc (:) = ival + allocate(this%forc_snowl_grc (begg:endg)) ; this%forc_snowl_grc (:) = ival ! atm->lnd not downscaled allocate(this%forc_t_not_downscaled_grc (begg:endg)) ; this%forc_t_not_downscaled_grc (:) = ival @@ -999,6 +1007,10 @@ subroutine Clean(this) deallocate(this%forc_po2_grc) deallocate(this%forc_aer_grc) deallocate(this%forc_pch4_grc) + deallocate(this%forc_rainc_grc) + deallocate(this%forc_rainl_grc) + deallocate(this%forc_snowc_grc) + deallocate(this%forc_snowl_grc) ! atm->lnd not downscaled deallocate(this%forc_t_not_downscaled_grc) diff --git a/src/utils/lnd_import_export_utils.F90 b/src/utils/lnd_import_export_utils.F90 new file mode 100644 index 0000000000..3ef49f4039 --- /dev/null +++ b/src/utils/lnd_import_export_utils.F90 @@ -0,0 +1,152 @@ +module lnd_import_export_utils + + use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_infnan_mod , only : isnan => shr_infnan_isnan + use shr_sys_mod , only : shr_sys_abort + use clm_varctl , only : iulog + use decompmod , only : bounds_type + use atm2lndType , only : atm2lnd_type + + implicit none + private ! except + + public :: derive_quantities + public :: check_for_nans + +!============================================================================= +contains +!============================================================================= + + !=========================================================================== + + subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst ) + + !------------------------------------------------------------------------- + ! Convert the input data from the mediator to the land model + !------------------------------------------------------------------------- + + use clm_varctl, only: co2_ppmv + use clm_varcon, only: rair, o2_molar_const + use Wateratm2lndBulkType, only: wateratm2lndbulk_type + use QSatMod, only: QSat + + ! input/output variabes + type(bounds_type), intent(in) :: bounds ! bounds + type(atm2lnd_type), intent(inout) :: atm2lnd_inst ! clm internal input data type + type(Wateratm2lndbulk_type), intent(inout) :: wateratm2lndbulk_inst + + ! local variables + integer :: g ! indices + integer :: begg, endg ! bounds + real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) + real(r8) :: forc_t ! atmospheric temperature (Kelvin) + real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) + real(r8) :: forc_pbot ! atmospheric pressure (Pa) + character(len=*), parameter :: subname='(utils:lnd_import_export_utils)' + + !------------------------------------------------------------------------- + + ! Set bounds + begg = bounds%begg; endg=bounds%endg + + !-------------------------- + ! Derived quantities + !-------------------------- + + do g = begg, endg + forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) + forc_q = wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) + forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) + + atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] + atm2lnd_inst%forc_hgt_t_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of temperature [m] + atm2lnd_inst%forc_hgt_q_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of humidity [m] + + atm2lnd_inst%forc_vp_grc(g) = forc_q * forc_pbot / (0.622_r8 + 0.378_r8 * forc_q) + + atm2lnd_inst%forc_rho_not_downscaled_grc(g) = & + (forc_pbot - 0.378_r8 * atm2lnd_inst%forc_vp_grc(g)) / (rair * forc_t) + + atm2lnd_inst%forc_po2_grc(g) = o2_molar_const * forc_pbot + atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv * 1.e-6_r8 * forc_pbot + + atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) + + atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & + atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) + + wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = atm2lnd_inst%forc_rainc_grc(g) + atm2lnd_inst%forc_rainl_grc(g) + wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = atm2lnd_inst%forc_snowc_grc(g) + atm2lnd_inst%forc_snowl_grc(g) + + call QSat(forc_t, forc_pbot, qsat_kg_kg) + + ! modify specific humidity if precip occurs + if (1==2) then + if ((atm2lnd_inst%forc_rainc_grc(g)+atm2lnd_inst%forc_rainl_grc(g)) > 0._r8) then + forc_q = 0.95_r8 * qsat_kg_kg + !forc_q = qsat_kg_kg + wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q + endif + endif + + wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) + end do + + !-------------------------- + ! Error checks + !-------------------------- + + ! Check that solar, specific-humidity, and LW downward aren't negative + do g = begg, endg + if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 ) then + call shr_sys_abort( subname//& + ' ERROR: Longwave down sent from the atmosphere model is negative or zero' ) + end if + if ( (atm2lnd_inst%forc_solad_grc(g,1) < 0.0_r8) .or. & + (atm2lnd_inst%forc_solad_grc(g,2) < 0.0_r8) .or. & + (atm2lnd_inst%forc_solai_grc(g,1) < 0.0_r8) .or. & + (atm2lnd_inst%forc_solai_grc(g,2) < 0.0_r8) ) then + call shr_sys_abort( subname//& + ' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & + ' from the atmosphere model is negative or zero' ) + end if + if ( wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then + call shr_sys_abort( subname//& + ' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) + end if + end do + + ! Make sure relative humidity is properly bounded + ! atm2lnd_inst%forc_rh_grc(g) = min( 100.0_r8, atm2lnd_inst%forc_rh_grc(g) ) + ! atm2lnd_inst%forc_rh_grc(g) = max( 0.0_r8, atm2lnd_inst%forc_rh_grc(g) ) + + end subroutine derive_quantities + + !============================================================================= + + subroutine check_for_nans(array, fname, begg) + + ! input/output variables + real(r8) , intent(in) :: array(:) + character(len=*) , intent(in) :: fname + integer , intent(in) :: begg + + ! local variables + integer :: i + !--------------------------------------------------------------------------- + + ! Check if any input from mediator or output to mediator is NaN + + if (any(isnan(array))) then + write(iulog,*) '# of NaNs = ', count(isnan(array)) + write(iulog,*) 'Which are NaNs = ', isnan(array) + do i = 1, size(array) + if (isnan(array(i))) then + write(iulog,*) "NaN found in field ", trim(fname), ' at gridcell index ',begg+i-1 + end if + end do + call shr_sys_abort(' ERROR: One or more of the output from CLM to the coupler are NaN ' ) + end if + end subroutine check_for_nans + +end module lnd_import_export_utils From b1eefc22eb369abe2ab46cde7e3c3bed163e563d Mon Sep 17 00:00:00 2001 From: ckoven Date: Fri, 14 Aug 2020 09:49:06 -0600 Subject: [PATCH 1305/1973] added timing calls to all subroutines in clmfates_interfaceMod.F90 --- src/utils/clmfates_interfaceMod.F90 | 106 ++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 4 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 0b044f930b..e0215c416b 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -147,7 +147,7 @@ module CLMFatesInterfaceMod use dynHarvestMod , only : dynHarvest_interp_resolve_harvesttypes use FatesConstantsMod , only : hlm_harvest_area_fraction use FatesConstantsMod , only : hlm_harvest_carbon - + use perf_mod , only : t_startf, t_stopf implicit none type, public :: f2hmap_type @@ -265,6 +265,9 @@ subroutine CLMFatesGlobals() integer :: pass_cohort_age_tracking integer :: pass_biogeog + + call t_startf('fates_globals') + if (use_fates) then verbose_output = .false. @@ -401,6 +404,8 @@ subroutine CLMFatesGlobals() ! it will return some nominal dimension sizes of 1 call SetFatesGlobalElements(use_fates) + + call t_stopf('fates_globals') return end subroutine CLMFatesGlobals @@ -458,6 +463,8 @@ subroutine init(this, bounds_proc ) ! 1) allocate the vectors ! 2) add the history variables defined in clm_inst to the history machinery + + call t_startf('fates_init') ! Parameter Routines call param_derived%Init( numpft_fates ) @@ -618,6 +625,8 @@ subroutine init(this, bounds_proc ) ! Fire data to send to FATES call create_fates_fire_data_method( this%fates_fire_data_method ) + call t_stopf('fates_init') + end subroutine init ! =================================================================================== @@ -637,6 +646,8 @@ subroutine check_hlm_active(this, nc, bounds_clump) ! local variables integer :: c + call t_startf('fates_check_hlm_active') + do c = bounds_clump%begc,bounds_clump%endc ! FATES ACTIVE BUT HLM IS NOT @@ -654,6 +665,8 @@ subroutine check_hlm_active(this, nc, bounds_clump) end if end do + call t_stopf('fates_check_hlm_active') + end subroutine check_hlm_active ! ------------------------------------------------------------------------------------ @@ -712,6 +725,9 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! and it keeps all the boundaries in one location ! --------------------------------------------------------------------------------- + + call t_startf('fates_dynamics_daily_driver') + begg = bounds_clump%begg; endg = bounds_clump%endg ! Set the FATES global time and date variables @@ -878,6 +894,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & bounds_clump%endg end if + call t_stopf('fates_dynamics_daily_driver') return end subroutine dynamics_driv @@ -906,6 +923,8 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & integer :: s ! site index integer :: c ! column index + call t_startf('fates_wrap_update_hlmfates_dyn') + associate( & tlai => canopystate_inst%tlai_patch , & elai => canopystate_inst%elai_patch , & @@ -1036,6 +1055,9 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & end do end associate + + call t_stopf('fates_wrap_update_hlmfates_dyn') + end subroutine wrap_update_hlmfates_dyn ! ==================================================================================== @@ -1096,6 +1118,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & logical, save :: initialized = .false. + call t_startf('fates_restart') nclumps = get_proc_clumps() @@ -1338,6 +1361,8 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & !$OMP END PARALLEL DO end if + + call t_stopf('fates_restart') return end subroutine restart @@ -1367,6 +1392,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & integer :: s integer :: c + call t_startf('fates_initcoldstart') ! Set the FATES global time and date variables call GetAndSetTime @@ -1455,6 +1481,8 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & end do !$OMP END PARALLEL DO + call t_stopf('fates_initcoldstart') + end subroutine init_coldstart ! ====================================================================================== @@ -1493,6 +1521,8 @@ subroutine wrap_sunfrac(this,nc,atm2lnd_inst,canopystate_inst) type(ed_patch_type), pointer :: cpatch ! c"urrent" patch INTERF-TODO: SHOULD ! BE HIDDEN AS A FATES PRIVATE + call t_startf('fates_wrapsunfrac') + associate( forc_solad => atm2lnd_inst%forc_solad_grc, & forc_solai => atm2lnd_inst%forc_solai_grc, & fsun => canopystate_inst%fsun_patch, & @@ -1546,6 +1576,8 @@ subroutine wrap_sunfrac(this,nc,atm2lnd_inst,canopystate_inst) end associate + call t_stopf('fates_wrapsunfrac') + end subroutine wrap_sunfrac ! =================================================================================== @@ -1569,6 +1601,8 @@ subroutine prep_canopyfluxes(this, nc, fn, filterp, photosyns_inst) ! parameters integer,parameter :: rsmax0 = 2.e4_r8 + call t_startf('fates_prepcanfluxes') + do s = 1, this%fates(nc)%nsites ! filter flag == 1 means that this patch has not been called for photosynthesis this%fates(nc)%bc_in(s)%filter_photo_pa(:) = 1 @@ -1580,6 +1614,9 @@ subroutine prep_canopyfluxes(this, nc, fn, filterp, photosyns_inst) end if end do + + call t_stopf('fates_prepcanfluxes') + end subroutine prep_canopyfluxes ! ==================================================================================== @@ -1622,6 +1659,8 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & integer :: p integer :: nlevsoil + call t_startf('fates_wrapbtran') + associate(& sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) @@ -1751,6 +1790,8 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & end do end associate + call t_stopf('fates_wrapbtran') + end subroutine wrap_btran ! ==================================================================================== @@ -1765,7 +1806,6 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & use clm_varcon , only : rgas, tfrz, namep use clm_varctl , only : iulog use pftconMod , only : pftcon - use perf_mod , only : t_startf, t_stopf use PatchType , only : patch use quadraticMod , only : quadratic use EDTypesMod , only : dinc_ed @@ -1793,7 +1833,8 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & integer :: s,c,p,ifp,j,icp real(r8) :: dtime - call t_startf('edpsn') + call t_startf('fates_psn') + associate(& t_soisno => temperature_inst%t_soisno_col , & t_veg => temperature_inst%t_veg_patch , & @@ -1878,7 +1919,8 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & end do end associate - call t_stopf('edpsn') + + call t_stopf('fates_psn') end subroutine wrap_photosynthesis @@ -1895,6 +1937,7 @@ subroutine wrap_accumulatefluxes(this, nc, fn, filterp) integer :: s,c,p,ifp,icp real(r8) :: dtime + call t_startf('fates_wrapaccfluxes') ! Run a check on the filter do icp = 1,fn @@ -1921,6 +1964,8 @@ subroutine wrap_accumulatefluxes(this, nc, fn, filterp) this%fates(nc)%sites, & dtime) + call t_stopf('fates_wrapaccfluxes') + end subroutine wrap_accumulatefluxes ! ====================================================================================== @@ -1943,6 +1988,8 @@ subroutine wrap_canopy_radiation(this, bounds_clump, nc, & ! locals integer :: s,c,p,ifp,icp + call t_startf('fates_wrapcanopyradiation') + associate(& albgrd_col => surfalb_inst%albgrd_col , & !in albgri_col => surfalb_inst%albgri_col , & !in @@ -2007,6 +2054,8 @@ subroutine wrap_canopy_radiation(this, bounds_clump, nc, & end associate + call t_stopf('fates_wrapcanopyradiation') + end subroutine wrap_canopy_radiation ! ====================================================================================== @@ -2026,6 +2075,8 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & real(r8) :: dtime integer :: s,c + call t_startf('fates_wrapbgcsummary') + associate(& hr => soilbiogeochem_carbonflux_inst%hr_col, & ! (gC/m2/s) total heterotrophic respiration totsomc => soilbiogeochem_carbonstate_inst%totsomc_col, & ! (gC/m2) total soil organic matter carbon @@ -2049,6 +2100,9 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & dtime) end associate + + call t_stopf('fates_wrapbgcsummary') + end subroutine wrap_bgc_summary ! ====================================================================================== @@ -2069,6 +2123,8 @@ subroutine TransferZ0mDisp(this, bounds_clump, z0m_patch, displa_patch) integer :: ifp ! Fates patch index integer :: p ! CLM patch index + call t_startf('fates_transferz0disp') + SHR_ASSERT_FL((ubound(z0m_patch, 1) == bounds_clump%endp), sourcefile, __LINE__) SHR_ASSERT_FL((ubound(displa_patch, 1) == bounds_clump%endp), sourcefile, __LINE__) @@ -2087,6 +2143,8 @@ subroutine TransferZ0mDisp(this, bounds_clump, z0m_patch, displa_patch) end do end do + call t_stopf('fates_transferz0disp') + return end subroutine TransferZ0mDisp @@ -2121,8 +2179,12 @@ subroutine InterpFileInputs(this, bounds) character(len=*), parameter :: subname = 'InterpFileInputs' !----------------------------------------------------------------------- + call t_startf('fates_interpfileinputs') + call this%fates_fire_data_method%CNFireInterp(bounds) + call t_stopf('fates_interpfileinputs') + end subroutine InterpFileInputs !----------------------------------------------------------------------- @@ -2145,8 +2207,12 @@ subroutine Init2(this, bounds, NLFilename) character(len=*), parameter :: subname = 'Init2' !----------------------------------------------------------------------- + call t_startf('fates_init2') + call this%fates_fire_data_method%CNFireInit(bounds, NLFilename) + call t_stopf('fates_init2') + end subroutine Init2 !----------------------------------------------------------------------- @@ -2166,8 +2232,12 @@ subroutine InitAccBuffer(this, bounds) character(len=*), parameter :: subname = 'InitAccBuffer' !----------------------------------------------------------------------- + call t_startf('fates_initaccbuff') + call this%fates_fire_data_method%InitAccBuffer( bounds ) + call t_stopf('fates_initaccbuff') + end subroutine InitAccBuffer @@ -2188,8 +2258,12 @@ subroutine InitAccVars(this, bounds) character(len=*), parameter :: subname = 'InitAccVars' !----------------------------------------------------------------------- + call t_startf('fates_initaccvars') + call this%fates_fire_data_method%InitAccVars( bounds ) + call t_stopf('fates_initaccvars') + end subroutine InitAccVars !----------------------------------------------------------------------- @@ -2209,8 +2283,12 @@ subroutine UpdateAccVars(this, bounds) character(len=*), parameter :: subname = 'UpdateAccVars' !----------------------------------------------------------------------- + call t_startf('fates_updateaccvars') + call this%fates_fire_data_method%UpdateAccVars( bounds ) + call t_stopf('fates_updateaccvars') + end subroutine UpdateAccVars ! ====================================================================================== @@ -2252,6 +2330,8 @@ subroutine init_history_io(this,bounds_proc) type(fates_bounds_type) :: fates_bounds type(fates_bounds_type) :: fates_clump + call t_startf('fates_inithistoryio') + ! This routine initializes the types of output variables ! not the variables themselves, just the types ! --------------------------------------------------------------------------------- @@ -2386,6 +2466,9 @@ subroutine init_history_io(this,bounds_proc) end associate end do + + call t_stopf('fates_inithistoryio') + end subroutine init_history_io ! ====================================================================================== @@ -2403,6 +2486,7 @@ subroutine init_soil_depths(this, nc) integer :: nlevsoil integer :: nlevdecomp + call t_startf('fates_initsoildepths') do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) @@ -2437,6 +2521,8 @@ subroutine init_soil_depths(this, nc) end do + call t_stopf('fates_initsoildepths') + return end subroutine init_soil_depths @@ -2463,6 +2549,8 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & if( .not. use_fates_planthydro ) return + call t_startf('fates_rootsoilflux') + nc = bounds_clump%clump_index ! Perform a check that the number of columns submitted to fates for @@ -2495,6 +2583,8 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & end do + + call t_stopf('fates_rootsoilflux') end subroutine ComputeRootSoilFlux @@ -2560,6 +2650,7 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & if ( .not.use_fates_planthydro ) return + call t_startf('fates_wraphydrodriv') dtime = get_step_size_real() @@ -2634,6 +2725,7 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & this%fates(nc)%bc_in, & dtime) + call t_stopf('fates_wraphydrodriv') return end subroutine wrap_hydraulics_drive @@ -2656,6 +2748,8 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) type(bounds_type), intent(in) :: hlm type(fates_bounds_type), intent(out) :: fates + call t_startf('fates_hlm2fatesbnds') + fates%cohort_begin = hlm%begcohort fates%cohort_end = hlm%endcohort @@ -2725,6 +2819,7 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%elage_begin = 1 fates%elage_end = num_elements * nlevage + call t_stopf('fates_hlm2fatesbnds') end subroutine hlm_bounds_to_fates_bounds @@ -2757,6 +2852,7 @@ subroutine GetAndSetTime() real(r8) :: model_day real(r8) :: day_of_year + call t_startf('fates_getandsettime') ! Get the current date and determine the set the start of the current year call get_curr_date(current_year,current_month,current_day,current_tod) @@ -2783,6 +2879,8 @@ subroutine GetAndSetTime() model_day, floor(day_of_year), & days_per_year, 1.0_r8/dble(days_per_year)) + call t_stopf('fates_getandsettime') + end subroutine GetAndSetTime end module CLMFatesInterfaceMod From 2c6d0d9fc6aa7fa34fd14911ee128f6d891a3732 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 14 Aug 2020 11:41:54 -0600 Subject: [PATCH 1306/1973] Small corrections to allow entire test-suite to pass --- src/cpl/lilac/lnd_import_export.F90 | 11 ++++++----- src/cpl/nuopc/lnd_import_export.F90 | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 7de5400109..4f957387b1 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -3,6 +3,7 @@ module lnd_import_export use ESMF use shr_kind_mod , only : r8 => shr_kind_r8, cx=>shr_kind_cx, cxx=>shr_kind_cxx, cs=>shr_kind_cs use shr_sys_mod , only : shr_sys_abort + use shr_const_mod , only : fillvalue=>SHR_CONST_SPVAL use clm_varctl , only : iulog, ndep_from_cpl use clm_time_manager , only : get_nstep use clm_instMod , only : atm2lnd_inst, lnd2atm_inst, water_inst @@ -129,19 +130,19 @@ subroutine import_fields( importState, bounds, first_call, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainc', bounds, & - output=atm2lnd_inst%forc_rainc, rc=rc ) + output=atm2lnd_inst%forc_rainc_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainl', bounds, & - output=atm2lnd_inst%forc_rainl, rc=rc ) + output=atm2lnd_inst%forc_rainl_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowc', bounds, & - output=atm2lnd_inst%forc_snowc, rc=rc ) + output=atm2lnd_inst%forc_snowc_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowl', bounds, & - output=atm2lnd_inst%forc_snowl, rc=rc ) + output=atm2lnd_inst%forc_snowl_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_lwdn', bounds, & @@ -239,7 +240,7 @@ subroutine import_fields( importState, bounds, first_call, rc) ! Derived quantities for required fields !-------------------------- - call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst) + call derive_quantities(bounds, atm2lnd_inst, water_inst%wateratm2lndbulk_inst) end subroutine import_fields diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 750d7120fe..acf2ed9dd1 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -445,16 +445,16 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_getimport(importState, 'Sa_tbot', bounds, output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_rainc', bounds, output=atm2lnd_inst%forc_rainc, rc=rc ) + call state_getimport(importState, 'Faxa_rainc', bounds, output=atm2lnd_inst%forc_rainc_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_rainl', bounds, output=atm2lnd_inst%forc_rainl, rc=rc ) + call state_getimport(importState, 'Faxa_rainl', bounds, output=atm2lnd_inst%forc_rainl_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_snowc', bounds, output=atm2lnd_inst%forc_snowc, rc=rc ) + call state_getimport(importState, 'Faxa_snowc', bounds, output=atm2lnd_inst%forc_snowc_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_snowl', bounds, output=atm2lnd_inst%forc_snowl, rc=rc ) + call state_getimport(importState, 'Faxa_snowl', bounds, output=atm2lnd_inst%forc_snowl_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'Faxa_lwdn', bounds, output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) From 1852e8f11b09d341476b357e20732f95cb21f50b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 14 Aug 2020 16:09:26 -0600 Subject: [PATCH 1307/1973] Add PE layouts for any machine for the new grids, and also set the previous one for cheyenne, for ARCTIC,ARCTICGRIS, and CONUS increase number of nodes to 150 on cheyenne --- cime_config/config_pes.xml | 272 +++++++++++++++++++++++++++++++++---- 1 file changed, 247 insertions(+), 25 deletions(-) diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index 0d1559791d..efe40a579f 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -414,14 +414,14 @@ none - -8 - -8 - -8 - -8 - -8 - -8 - -8 - -8 + -12 + -12 + -12 + -12 + -12 + -12 + -12 + -12 1 @@ -446,19 +446,56 @@ + + + + none + + -1 + -150 + -150 + -150 + -150 + -150 + -150 + -150 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + + + + none - -8 - -8 - -8 - -8 - -8 - -8 - -8 - -8 + -12 + -12 + -12 + -12 + -12 + -12 + -12 + -12 1 @@ -483,19 +520,56 @@ + + + + none + + -1 + -150 + -150 + -150 + -150 + -150 + -150 + -150 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + + + + none - -8 - -8 - -8 - -8 - -8 - -8 - -8 - -8 + -12 + -12 + -12 + -12 + -12 + -12 + -12 + -12 1 @@ -520,6 +594,43 @@ + + + + none + + -1 + -150 + -150 + -150 + -150 + -150 + -150 + -150 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 + + + + @@ -596,6 +707,43 @@ + + none + + -12 + -12 + -12 + -12 + -12 + -12 + -12 + -12 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + none @@ -631,6 +779,43 @@ + + + + none + + -24 + -24 + -24 + -24 + -24 + -24 + -24 + -24 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + @@ -668,8 +853,45 @@ - + + + none + + -48 + -48 + -48 + -48 + -48 + -48 + -48 + -48 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + none From e4f9e3c8deeb164cee23ea9c0972d9d2f6ca8cc2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 14 Aug 2020 16:09:39 -0600 Subject: [PATCH 1308/1973] Update cime and cism externals --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index c5e31d48f4..f1b8d8056b 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -8,7 +8,7 @@ required = True local_path = components/cism protocol = git repo_url = https://github.com/ESCOMP/CISM-wrapper -tag = cism2_1_68 +tag = cism2_1_69 externals = Externals_CISM.cfg required = True @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.28 +tag = cime5.8.30 externals = ../Externals_cime.cfg required = True From fd9fd7f9889f3bcb2a0c3e8f3fc9e59f64f5a162 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 14 Aug 2020 17:41:45 -0600 Subject: [PATCH 1309/1973] Test for f09 and f19 1979 files, helping #1103 --- bld/unit_testers/build-namelist_test.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index ed57cdcc92..f2839d22f8 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 893; +my $ntests = 901; if ( defined($opts{'compare'}) ) { - $ntests += 549; + $ntests += 555; } plan( tests=>$ntests ); @@ -333,6 +333,8 @@ sub make_config_cache { foreach my $options ( "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", + "-res 0.9x1.25 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode clm5_0_cam6.0", "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20030101/' -lnd_tuning_mode clm5_0_cam6.0", From 86e78f4af88f36add5e648d2b1f1bafc23fb9994 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 14 Aug 2020 17:42:21 -0600 Subject: [PATCH 1310/1973] Chagne start date for waccmx test to 1979 to help #1103 --- .../testdefs/testmods_dirs/clm/waccmx_offline/shell_commands | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands index 28442e910b..e7d88b5afa 100755 --- a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands @@ -1,3 +1,4 @@ ./xmlchange USE_ESMF_LIB=TRUE,ATM_NCPL=288,CALENDAR=GREGORIAN,ROF_NCPL='$ATM_NCPL',LND_TUNING_MODE="clm5_0_cam6.0" ./xmlchange CLM_BLDNML_OPTS="-megan -drydep" --append +./xmlchange RUN_STARTDATE=1979-01-01 From aa36c77fe939a41ac9f1933080e2aeac80a1aab0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 14 Aug 2020 18:02:48 -0600 Subject: [PATCH 1311/1973] Change tests with g16 to g17 --- cime_config/testdefs/testlist_clm.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index a0f0e6e2d6..735b0a9253 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -53,7 +53,7 @@ - + @@ -223,7 +223,7 @@ - + @@ -1105,7 +1105,7 @@ - + @@ -1327,7 +1327,7 @@ - + @@ -1874,7 +1874,7 @@ - + @@ -1882,7 +1882,7 @@ - + @@ -1890,7 +1890,7 @@ - + @@ -1907,7 +1907,7 @@ - + @@ -1915,7 +1915,7 @@ - + @@ -1923,7 +1923,7 @@ - + @@ -1940,7 +1940,7 @@ - + From 1e4f8b85fc6f62241c22e5f81cc43071867eedeb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 17 Aug 2020 13:16:04 -0600 Subject: [PATCH 1312/1973] Change number of nodes on cheyenne to 70 from 150 as that seems to run better for the ARCTIC, CONUS and ARCTICGRIS grids from testing ARCTICGRIS --- cime_config/config_pes.xml | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index efe40a579f..efbaa063e8 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -452,13 +452,13 @@ none -1 - -150 - -150 - -150 - -150 - -150 - -150 - -150 + -70 + -70 + -70 + -70 + -70 + -70 + -70 1 @@ -526,13 +526,13 @@ none -1 - -150 - -150 - -150 - -150 - -150 - -150 - -150 + -70 + -70 + -70 + -70 + -70 + -70 + -70 1 @@ -600,13 +600,13 @@ none -1 - -150 - -150 - -150 - -150 - -150 - -150 - -150 + -70 + -70 + -70 + -70 + -70 + -70 + -70 1 From 53376e2f1ce402b8c90772a499aa942c4ef71743 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 17 Aug 2020 13:27:19 -0600 Subject: [PATCH 1313/1973] First draft of my ChangeLog updates for this PR --- doc/ChangeLog | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 141 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8c46437257..636117678f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,144 @@ =============================================================== +Tag name: ctsm1.0.dev108 +Originator(s): slevis (Samuel Levis,303-665-1310) +Date: Mon Aug 17 12:35:19 MDT 2020 +One-line Summary: Reduce duplication between caps + +Purpose of changes +------------------ + + Eliminate duplication of the "derived quantities for required fields" + and corresponding error checking codes that repeat across the mct, + nuopc, and lilac caps. This consolidates the code and reduces + maintenance requirements. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #918 #1094 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: @billsacks @slevisconsulting + + +CTSM testing: + +[... Remove before making master tag. Available test levels: + + a) regular (must be run before handing off a tag to SEs and must be run + before committing a tag) + b) build_namelist (if namelists and/or build_system changed)) + c) tools (only if tools are modified and no CTSM source is modified) + d) short (for use during development and in rare cases where only a small + change with known behavior is added ... eg. a minor bug fix) + e) doc (no source testing required) + +... ] + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- + izumi ------- + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: All + - what platforms/compilers: All + - nature of change: Larger than roundoff/same climate + + +Detailed list of changes +------------------------ + + Changes were implemented in three steps: + + 1) Bit-for-bit: @billsacks simplified subroutine QSat by making three + arguments optional (es, qsdT, esdT). + + 2) Answer-changing: @slevisconsulting replaced local calculations of + qsat in /src/cpl/mct, /src/cpl/lilac, and /src/cpl/nuopc with calls to + CTSM's subroutine QSat. Subroutine QSat uses a higher-order polynomial + approximation to estimate qsat, which explains the larger than + round-off diffs. When moving the three identical local approximations + to QSat as a temporary test instead of using the higher-order + polynomial approximation, the diffs reduce to round-off. + + 3) Bit-for-bit: @slevisconsulting consolidated repeating codes in + /src/cpl/mct, /src/cpl/lilac, and /src/cpl/nuopc by placing in the new + file /src/utils/lnd_import_export_utils.F90. + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + Modified code in /src/cpl @billsacks IS THAT CONSIDERED AN EXTERNAL DIRECTORY? + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/CTSM/pull/1086 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev105 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) / Chris Fischer Date: Thu Jul 23 08:59:37 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 595b35fb19..cfca3cef1f 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev108 slevis 08/17/2020 Reduce duplication between caps ctsm1.0.dev105 erik/fis 07/23/2020 Bring in some new SE grids for CAM as well as initial condition files for them ctsm1.0.dev104 sacks 07/06/2020 Add LILAC ctsm1.0.dev103 slevis 06/29/2020 Gridcell-level error-check for methane (CH4) From b3e08240430a3e50a67e499299c3677e50adc519 Mon Sep 17 00:00:00 2001 From: Ivanderkelen Date: Wed, 20 Feb 2019 12:31:35 -0700 Subject: [PATCH 1314/1973] added dynlakeFileMod to account for lake area changes --- src/dyn_subgrid/dynSubgridDriverMod.F90 | 13 ++- src/dyn_subgrid/dynlakeFileMod.F90 | 142 ++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 src/dyn_subgrid/dynlakeFileMod.F90 diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index 73c3f9e4b0..6eb32f5b91 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -20,6 +20,8 @@ module dynSubgridDriverMod use dynpftFileMod , only : dynpft_init, dynpft_interp use dyncropFileMod , only : dyncrop_init, dyncrop_interp use dynHarvestMod , only : dynHarvest_init, dynHarvest_interp + ! use new lake file module + use dynlakeFileMod , only : dynlake_init, dynlake_interp use dynLandunitAreaMod , only : update_landunit_weights use subgridWeightsMod , only : compute_higher_order_weights, set_subgrid_diagnostic_fields use reweightMod , only : reweight_wrapup @@ -41,7 +43,10 @@ module dynSubgridDriverMod use CropType , only : crop_type use glc2lndMod , only : glc2lnd_type use filterMod , only : filter, filter_inactive_and_active - ! + + + + ! !PUBLIC MEMBER FUNCTIONS: implicit none private @@ -120,6 +125,12 @@ subroutine dynSubgrid_init(bounds_proc, glc_behavior, crop_inst) call dynHarvest_init(bounds_proc, harvest_filename=get_flanduse_timeseries()) end if + + ! Initialize stuff for prescribed transient lakes + ! error if keyword argument like for dynamical land units above: dynlake_filename=get_flanduse_timeseries() + call dynlake_init(bounds_proc, dynlake_filename=get_flanduse_timeseries()) + + ! ------------------------------------------------------------------------ ! Set initial subgrid weights for aspects that are read from file. This is relevant ! for cold start and use_init_interp-based initialization. diff --git a/src/dyn_subgrid/dynlakeFileMod.F90 b/src/dyn_subgrid/dynlakeFileMod.F90 new file mode 100644 index 0000000000..4db8720e07 --- /dev/null +++ b/src/dyn_subgrid/dynlakeFileMod.F90 @@ -0,0 +1,142 @@ +module dynlakeFileMod + + !--------------------------------------------------------------------------- + ! !DESCRIPTION: + ! Handle reading of the dataset that specifies transient areas of the lake landunit + ! + ! !USES: + + ! check this still on unneccesary parts. + +#include "shr_assert.h" + use shr_log_mod , only : errMsg => shr_log_errMsg + use shr_kind_mod , only : r8 => shr_kind_r8 + use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC + use dynFileMod , only : dyn_file_type + use dynVarTimeUninterpMod , only : dyn_var_time_uninterp_type + use clm_varctl , only : iulog + use clm_varcon , only : grlnd, namec + use abortutils , only : endrun + use spmdMod , only : masterproc, mpicom + use LandunitType , only : lun + use ColumnType , only : col + use PatchType , only : patch + + ! !PUBLIC MEMBER FUNCTIONS: + implicit none + private + save + public :: dynlake_init ! initialize information read from landuse.timeseries dataset + public :: dynlake_interp ! get landuse data for the current time step, if needed + ! + ! ! PRIVATE TYPES + type(dyn_file_type), target :: dynlake_file ! information for the file containing transient lake data + type(dyn_var_time_uninterp_type) :: wtlake ! weight of the lake landunit + + ! Names of variables on file + character(len=*), parameter :: lake_varname = 'PCT_LAKE' + + ! TO DO: account for lake depth? + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + !--------------------------------------------------------------------------- + +contains + + !----------------------------------------------------------------------- + subroutine dynlake_init(bounds, dynlake_filename) + ! + ! !DESCRIPTION: + ! Initialize dataset containing transient lake info (position it to the right time + ! samples that bound the initial model date) + ! + ! !USES: + use ncdio_pio , only : check_dim + use dynTimeInfoMod , only : YEAR_POSITION_START_OF_TIMESTEP + + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds ! proc-level bounds + character(len=*) , intent(in) :: dynlake_filename ! name of file containing transient lake information + ! + ! !LOCAL VARIABLES: + integer :: num_points ! number of spatial points + + character(len=*), parameter :: subname = 'dynlake_init' + !----------------------------------------------------------------------- + + SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') + + if (masterproc) then + write(iulog,*) 'Attempting to read lake dynamic landuse data .....' + end if + + ! Get the year from the START of the timestep; this way, we'll update lake areas + ! starting after the year boundary. This is consistent with the timing of glacier + ! updates, and will likely be consistent with the timing of crop updates determined + ! prognostically, if crop areas are ever determined prognostically rather than + ! prescribed ahead of time. + dynlake_file = dyn_file_type(dynlake_filename, YEAR_POSITION_START_OF_TIMESTEP) + + ! read data PCT_LAKE + ! + ! Note: if you want to change transient crops so that they are interpolated, rather + ! than jumping to each year's value on Jan 1 of that year, simply change wtcrop and + ! to be of type dyn_var_time_interp_type (rather than + ! dyn_var_time_uninterp_type), and change the following constructors to construct + ! variables of dyn_var_time_interp_type. That's all you need to do. + num_points = (bounds%endg - bounds%begg + 1) + wtlake = dyn_var_time_uninterp_type( & + dyn_file = dynlake_file, varname=lake_varname, & + dim1name=grlnd, conversion_factor=100._r8, & + do_check_sums_equal_1=.false., data_shape=[num_points]) + + end subroutine dynlake_init + + + !----------------------------------------------------------------------- + subroutine dynlake_interp(bounds) + ! + ! !DESCRIPTION: + ! Get lake cover for model time, when needed. + ! + ! Sets col%wtlunit and lun%wtgcell for crop landunits. + ! + ! Note that crop cover currently jumps to its new value at the start of the year. + ! However, as mentioned above, this behavior can be changed to time interpolation + ! simply by making wtcrop and wtcft dyn_var_time_interp_type variables rather than + ! dyn_var_time_uninterp_type. + ! + ! !USES: + use landunit_varcon , only : istdlak + use subgridWeightsMod , only : set_landunit_weight + ! + ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds ! proc-level bounds + ! + ! !LOCAL VARIABLES: + integer :: g ! indices + real(r8), allocatable :: wtlake_cur(:) ! current weight of the lake landunit + + character(len=*), parameter :: subname = 'dynlake_interp' + !----------------------------------------------------------------------- + + SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') + + call dynlake_file%time_info%set_current_year() + + ! Set new landunit area + allocate(wtlake_cur(bounds%begg:bounds%endg)) + call wtlake%get_current_data(wtlake_cur) + do g = bounds%begg, bounds%endg + call set_landunit_weight(g, istdlak, wtlake_cur(g)) + end do + deallocate(wtlake_cur) + +! also account for landunits, patches and columns? + + + end subroutine dynlake_interp + +end module dynlakeFileMod \ No newline at end of file From eb45afd198aaa0b04b097a3e80071a2a0ba6eea0 Mon Sep 17 00:00:00 2001 From: Inne Vanderkelen Date: Fri, 22 Feb 2019 16:55:19 -0700 Subject: [PATCH 1315/1973] Add computation of lake heat itself in ComputeHeatMod and pass it to dynConsBiogeophysMod.f90 cv is kept constant at water cv for simplicity (altough there is a cv for each lake layer) TEMPORARY change --- src/biogeophys/LakeTemperatureMod.F90 | 4 ++ src/biogeophys/TotalWaterAndHeatMod.F90 | 70 +++++++++++++++++++++++- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 4 +- src/dyn_subgrid/dynSubgridDriverMod.F90 | 4 ++ src/dyn_subgrid/dynlakeFileMod.F90 | 4 +- 5 files changed, 82 insertions(+), 4 deletions(-) diff --git a/src/biogeophys/LakeTemperatureMod.F90 b/src/biogeophys/LakeTemperatureMod.F90 index f550f294a6..25de5f85d4 100644 --- a/src/biogeophys/LakeTemperatureMod.F90 +++ b/src/biogeophys/LakeTemperatureMod.F90 @@ -1001,6 +1001,9 @@ subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_la fin(c) = fin(c) + phi(c,j) end do end do +! write(iulog,*)'Energy content of lake after calculating lake temperature (J/m²)', ncvts + + call waterstatebulk_inst%CalculateTotalH2osno(bounds, num_lakec, filter_lakec, & caller = 'LakeTemperature-2', & @@ -1022,6 +1025,7 @@ subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_la end do + ! Check energy conservation. do fp = 1, num_lakep p = filter_lakep(fp) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 9488eedc70..0fb0ec4303 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -78,6 +78,7 @@ module TotalWaterAndHeatMod ! ! !PRIVATE MEMBER FUNCTIONS: private :: AccumulateLiquidWaterHeat ! For use by ComputeHeat* routines: accumulate quantities that we need to count for liquid water, for a single column + private :: AccumulateLiquidWaterHeatLake ! same as above but able to read in 2D lake temperature private :: TempToHeat ! For use by ComputeHeat* routines: convert temperature to heat content character(len=*), parameter, private :: sourcefile = & @@ -800,7 +801,7 @@ end subroutine AccumulateSoilHeatNonLake !----------------------------------------------------------------------- subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & soilstate_inst, temperature_inst, waterstatebulk_inst, & - heat, heat_liquid, cv_liquid) + heat, heat_liquid, cv_liquid, heat_lake) ! ! !DESCRIPTION: ! Compute total heat content for all lake columns @@ -812,7 +813,13 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & ! ! Note: Changes to this routine - for anything involving liquid or ice - should ! generally be accompanied by similar changes to ComputeLiqIceMassLake - ! + + + + ! REMOVE THIS when done developing + use clm_varctl , only : iulog + + ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_lakec @@ -824,6 +831,8 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & real(r8) , intent(inout) :: heat( bounds%begc: ) ! sum of heat content for all columns [J/m^2] real(r8) , intent(inout) :: heat_liquid( bounds%begc: ) ! sum of heat content for all columns: liquid water, excluding latent heat [J/m^2] real(r8) , intent(inout) :: cv_liquid( bounds%begc: ) ! sum of liquid heat capacity for all columns [J/(m^2 K)] + real(r8) , intent(inout) :: heat_lake( bounds%begc: ) ! heat content of the lake water in column [J/m^2] + ! ! !LOCAL VARIABLES: integer :: fc @@ -832,6 +841,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & real(r8) :: heat_dry_mass(bounds%begc:bounds%endc) ! sum of heat content: dry mass [J/m^2] real(r8) :: heat_ice(bounds%begc:bounds%endc) ! sum of heat content: ice [J/m^2] real(r8) :: latent_heat_liquid(bounds%begc:bounds%endc) ! sum of latent heat content of liquid water [J/m^2] + real(r8) :: latent_heat_liquid_lake(bounds%begc:bounds%endc) ! sum of latent heat content of liquid water of lake itself [J/m^2] character(len=*), parameter :: subname = 'ComputeHeatLake' !----------------------------------------------------------------------- @@ -843,8 +853,10 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & associate( & snl => col%snl, & ! number of snow layers dz => col%dz, & ! layer depth (m) + lakedepth => col%lakedepth, & ! lake depth (m) watsat => soilstate_inst%watsat_col, & ! volumetric soil water at saturation (porosity) csol => soilstate_inst%csol_col, & ! heat capacity, soil solids (J/m**3/Kelvin) + t_lake => temperature_inst%t_lake_col, & ! lake temperature (K) t_soisno => temperature_inst%t_soisno_col, & ! soil temperature (Kelvin) dynbal_baseline_heat => temperature_inst%dynbal_baseline_heat_col, & ! Input: [real(r8) (:) ] baseline heat content subtracted from each column's total heat calculation (J/m2) h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col, & ! liquid water (kg/m2) @@ -902,6 +914,21 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & ! TODO(wjs, 2017-03-11) Include heat content of water in lakes, once we include ! lake water as an explicit water state (https://github.com/ESCOMP/ctsm/issues/200) + ! calculate heat content of lake itself + !set condition on heat_lake when is present (optional argument)? + do fc = 1, num_lakec + c = filter_lakec(fc) + call AccumulateLiquidWaterHeatLake( & + temp = t_lake(c,:), & + h2o = lakedepth(c)*1000, & + cv_liquid = cv_liquid(c), & + heat_liquid = heat_lake(c), & + latent_heat_liquid = latent_heat_liquid_lake(c)) + end do + + write(iulog,*) 'lake heat (J/m^2)', heat_lake(c) + +! Add lake heat here if wanted to incorporate do fc = 1, num_lakec c = filter_lakec(fc) heat(c) = heat_dry_mass(c) + heat_ice(c) + heat_liquid(c) + latent_heat_liquid(c) @@ -1087,6 +1114,45 @@ subroutine AccumulateLiquidWaterHeat(temp, h2o, & latent_heat_liquid = latent_heat_liquid + h2o*hfus end subroutine AccumulateLiquidWaterHeat +! Repeating same module, quick fix to account for 2D temperature field of lake temp. (to be removed) + !----------------------------------------------------------------------- + subroutine AccumulateLiquidWaterHeatLake(temp, h2o, & + heat_liquid, latent_heat_liquid, cv_liquid) + ! + ! !DESCRIPTION: + ! In the course of accumulating heat contents: Accumulate quantities that we need to + ! count for liquid water, for a single column + + use clm_varpar ,only : nlevlak +! + ! !ARGUMENTS: + real(r8), intent(in) :: temp(:) ! temperature [K] + real(r8), intent(in) :: h2o ! water mass [kg/m^2] + + real(r8), intent(inout) :: heat_liquid ! accumulated total heat content of liquid water for this column, excluding latent heat [J/m^2] + real(r8), intent(inout) :: latent_heat_liquid ! accumulated total latent heat content of liquid water for this column [J/m^2] + real(r8), intent(inout), optional :: cv_liquid ! accumulated total liquid heat capacity for this column [J/(m^2 K)] + ! + ! !LOCAL VARIABLES: + real(r8) :: cv ! heat capacity [J/(m^2 K)] + integer :: j ! do loop index + character(len=*), parameter :: subname = 'AccumulateLiquidWaterHeatLake' + !----------------------------------------------------------------------- + + cv = h2o*cpliq + if (present(cv_liquid)) then + cv_liquid = cv_liquid + cv + end if + + ! loop over lake levels + do j = 1,nlevlak + heat_liquid = heat_liquid + TempToHeat(temp = temp(j), cv = cv) + end do + latent_heat_liquid = latent_heat_liquid + h2o*hfus + + end subroutine AccumulateLiquidWaterHeatLake + + !----------------------------------------------------------------------- pure function TempToHeat(temp, cv) result(heat) ! diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index 018cd12176..9c2e6bdf34 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -642,6 +642,7 @@ subroutine dyn_heat_content(bounds, & real(r8) :: heat_col(bounds%begc:bounds%endc) ! sum of heat content for all columns [J/m^2] real(r8) :: heat_liquid_col(bounds%begc:bounds%endc) ! sum of heat content for all columns: liquid water, excluding latent heat [J/m^2] real(r8) :: cv_liquid_col(bounds%begc:bounds%endc) ! sum of liquid heat capacity for all columns [J/(m^2 K)] + real(r8) :: heat_lake_col(bounds%begc:bounds%endc) ! heat content of lake column [J/m^2] real(r8) :: heat_liquid_grc(bounds%begg:bounds%endg) ! heat_liquid_col averaged to grid cell [J/m^2] real(r8) :: cv_liquid_grc(bounds%begg:bounds%endg) ! cv_liquid_col averaged to grid cell [J/(m^2 K)] @@ -662,7 +663,8 @@ subroutine dyn_heat_content(bounds, & soilstate_inst, temperature_inst, waterstatebulk_inst, & heat = heat_col(bounds%begc:bounds%endc), & heat_liquid = heat_liquid_col(bounds%begc:bounds%endc), & - cv_liquid = cv_liquid_col(bounds%begc:bounds%endc)) + cv_liquid = cv_liquid_col(bounds%begc:bounds%endc), & + heat_lake = heat_lake_col(bounds%begc:bounds%endc)) call c2g(bounds, & carr = heat_col(bounds%begc:bounds%endc), & diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index 6eb32f5b91..b7528c1b24 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -255,6 +255,10 @@ subroutine dynSubgrid_driver(bounds_proc, if (get_do_harvest()) then call dynHarvest_interp(bounds_proc) end if + + ! add lake interp (condition to be added later) + + call dynlake_interp(bounds_proc) ! ========================================================================== ! Do land cover change that does not require I/O diff --git a/src/dyn_subgrid/dynlakeFileMod.F90 b/src/dyn_subgrid/dynlakeFileMod.F90 index 4db8720e07..f3179b1f55 100644 --- a/src/dyn_subgrid/dynlakeFileMod.F90 +++ b/src/dyn_subgrid/dynlakeFileMod.F90 @@ -54,6 +54,7 @@ subroutine dynlake_init(bounds, dynlake_filename) ! !USES: use ncdio_pio , only : check_dim use dynTimeInfoMod , only : YEAR_POSITION_START_OF_TIMESTEP + ! ! !ARGUMENTS: @@ -62,7 +63,7 @@ subroutine dynlake_init(bounds, dynlake_filename) ! ! !LOCAL VARIABLES: integer :: num_points ! number of spatial points - + character(len=*), parameter :: subname = 'dynlake_init' !----------------------------------------------------------------------- @@ -91,6 +92,7 @@ subroutine dynlake_init(bounds, dynlake_filename) dyn_file = dynlake_file, varname=lake_varname, & dim1name=grlnd, conversion_factor=100._r8, & do_check_sums_equal_1=.false., data_shape=[num_points]) + end subroutine dynlake_init From 91ac079a897c59e4ff622e977b7bb6e7cf933ca6 Mon Sep 17 00:00:00 2001 From: Inne Vanderkelen Date: Fri, 1 Mar 2019 05:28:50 -0700 Subject: [PATCH 1316/1973] Make lake heat output variable of LakeTemperatureMod.F90 and print is as an history field. The history field only contains the heat content of the lake water itself, and is a column output. --- src/biogeophys/LakeTemperatureMod.F90 | 9 ++++++--- src/biogeophys/TemperatureType.F90 | 9 +++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/LakeTemperatureMod.F90 b/src/biogeophys/LakeTemperatureMod.F90 index 25de5f85d4..26f8ee9134 100644 --- a/src/biogeophys/LakeTemperatureMod.F90 +++ b/src/biogeophys/LakeTemperatureMod.F90 @@ -134,6 +134,7 @@ subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_la type(energyflux_type) , intent(inout) :: energyflux_inst type(temperature_type) , intent(inout) :: temperature_inst type(lakestate_type) , intent(inout) :: lakestate_inst + ! ! !LOCAL VARIABLES: real(r8), parameter :: p0 = 1._r8 ! neutral value of turbulent prandtl number @@ -247,7 +248,8 @@ subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_la t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (Kelvin) t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil (or snow) temperature (Kelvin) t_lake => temperature_inst%t_lake_col , & ! Output: [real(r8) (:,:) ] col lake temperature (Kelvin) - + lake_heat => temperature_inst%lake_heat , & ! Output: [real(r8) (:) ] col lake heat (J/m²) + beta => lakestate_inst%betaprime_col , & ! Output: [real(r8) (:) ] col effective beta: sabg_lyr(p,jtop) for snow layers, beta otherwise lake_icefrac => lakestate_inst%lake_icefrac_col , & ! Output: [real(r8) (:,:) ] col mass fraction of lake layer that is frozen lake_icefracsurf => lakestate_inst%lake_icefracsurf_col , & ! Output: [real(r8) (:,:) ] col mass fraction of surface lake layer that is frozen @@ -999,11 +1001,12 @@ subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_la ncvts(c) = ncvts(c) + cv_lake(c,j)*(t_lake(c,j)-tfrz) & + cfus*dz_lake(c,j)*(1._r8-lake_icefrac(c,j)) fin(c) = fin(c) + phi(c,j) + end do end do -! write(iulog,*)'Energy content of lake after calculating lake temperature (J/m²)', ncvts - + write(iulog,*)'Energy content of lake after calculating lake temperature (J/m²)', ncvts + lake_heat(c) = ncvts(c) call waterstatebulk_inst%CalculateTotalH2osno(bounds, num_lakec, filter_lakec, & caller = 'LakeTemperature-2', & diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 5c69733f8a..5dacf3fa55 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -117,6 +117,9 @@ module TemperatureType real(r8), pointer :: fact_col (:,:) ! used in computing tridiagonal matrix real(r8), pointer :: c_h2osfc_col (:) ! heat capacity of surface water + ! lake heat + real(r8), pointer :: lake_heat (:) ! total heat of lake water (J/m²) + contains procedure, public :: Init @@ -279,6 +282,7 @@ subroutine InitAllocate(this, bounds) allocate(this%fact_col (begc:endc, -nlevsno+1:nlevgrnd)) ; this%fact_col (:,:) = nan allocate(this%c_h2osfc_col (begc:endc)) ; this%c_h2osfc_col (:) = nan + allocate(this%lake_heat (begc:endc)) ; this%lake_heat (:) = nan end subroutine InitAllocate !------------------------------------------------------------------------ @@ -620,6 +624,11 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) ptr_patch=this%t_veg10_night_patch, default='inactive') endif + ! add lake heat history field here + this%lake_heat(begc:endc) = spval + call hist_addfld1d (fname='LAKE_HEAT', units='J/m^2', & + avgflag='A', long_name='Heat content of gridcell lake water', & + ptr_col=this%lake_heat, default='active') end subroutine InitHistory From 36b3f1522c077156044f9f6f945ef51c8ebed035 Mon Sep 17 00:00:00 2001 From: Inne Vanderkelen Date: Fri, 8 Mar 2019 03:48:53 -0700 Subject: [PATCH 1317/1973] Made handle do_transient_lakes to use in namelist for enabling the dynamic lake land unit. Use similar to do_transient_crops --- .../namelist_definition_ctsm.xml | 6 ++++ src/dyn_subgrid/dynSubgridControlMod.F90 | 32 +++++++++++++++++++ src/dyn_subgrid/dynSubgridDriverMod.F90 | 9 +++--- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 5d142e4626..45c39abeaa 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -2426,6 +2426,12 @@ If TRUE, apply transient crops from flanduse_timeseries file. (Only valid for transient runs, where there is a flanduse_timeseries file.) + +If TRUE, apply transient lakes from flanduse_timeseries file. +(Only valid for transient runs, where there is a flanduse_timeseries file.) + + If TRUE, apply harvest from flanduse_timeseries file. diff --git a/src/dyn_subgrid/dynSubgridControlMod.F90 b/src/dyn_subgrid/dynSubgridControlMod.F90 index 3820d6392a..01ff35ab33 100644 --- a/src/dyn_subgrid/dynSubgridControlMod.F90 +++ b/src/dyn_subgrid/dynSubgridControlMod.F90 @@ -24,6 +24,7 @@ module dynSubgridControlMod public :: get_flanduse_timeseries ! return the value of the flanduse_timeseries file name public :: get_do_transient_pfts ! return the value of the do_transient_pfts control flag public :: get_do_transient_crops ! return the value of the do_transient_crops control flag + public :: get_do_transient_lakes ! return the value of the do_transient_lakes control flag public :: run_has_transient_landcover ! returns true if any aspects of prescribed transient landcover are enabled public :: get_do_harvest ! return the value of the do_harvest control flag public :: get_reset_dynbal_baselines ! return the value of the reset_dynbal_baselines control flag @@ -40,6 +41,7 @@ module dynSubgridControlMod character(len=fname_len) :: flanduse_timeseries = ' ' ! transient landuse dataset logical :: do_transient_pfts = .false. ! whether to apply transient natural PFTs from dataset logical :: do_transient_crops = .false. ! whether to apply transient crops from dataset + logical :: do_transient_lakes = .false. ! whether to apply transient lakes from dataset logical :: do_harvest = .false. ! whether to apply harvest from dataset logical :: reset_dynbal_baselines = .false. ! whether to reset baseline values of total column water and energy in the first step of the run @@ -116,6 +118,7 @@ subroutine read_namelist( NLFilename ) character(len=fname_len) :: flanduse_timeseries logical :: do_transient_pfts logical :: do_transient_crops + logical :: do_transient_lakes logical :: do_harvest logical :: reset_dynbal_baselines logical :: for_testing_allow_non_annual_changes @@ -131,6 +134,7 @@ subroutine read_namelist( NLFilename ) flanduse_timeseries, & do_transient_pfts, & do_transient_crops, & + do_transient_lakes, & do_harvest, & reset_dynbal_baselines, & for_testing_allow_non_annual_changes, & @@ -140,6 +144,7 @@ subroutine read_namelist( NLFilename ) flanduse_timeseries = ' ' do_transient_pfts = .false. do_transient_crops = .false. + do_transient_lakes = .false. do_harvest = .false. reset_dynbal_baselines = .false. for_testing_allow_non_annual_changes = .false. @@ -164,6 +169,7 @@ subroutine read_namelist( NLFilename ) call shr_mpi_bcast (flanduse_timeseries, mpicom) call shr_mpi_bcast (do_transient_pfts, mpicom) call shr_mpi_bcast (do_transient_crops, mpicom) + call shr_mpi_bcast (do_transient_lakes, mpicom) call shr_mpi_bcast (do_harvest, mpicom) call shr_mpi_bcast (reset_dynbal_baselines, mpicom) call shr_mpi_bcast (for_testing_allow_non_annual_changes, mpicom) @@ -173,6 +179,7 @@ subroutine read_namelist( NLFilename ) flanduse_timeseries = flanduse_timeseries, & do_transient_pfts = do_transient_pfts, & do_transient_crops = do_transient_crops, & + do_transient_lakes = do_transient_lakes, & do_harvest = do_harvest, & reset_dynbal_baselines = reset_dynbal_baselines, & for_testing_allow_non_annual_changes = for_testing_allow_non_annual_changes, & @@ -218,6 +225,11 @@ subroutine check_namelist_consistency write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)' call endrun(msg=errMsg(sourcefile, __LINE__)) end if + if (dyn_subgrid_control_inst%do_transient_lakes) then + write(iulog,*) 'ERROR: do_transient_lakes can only be true if you are running with' + write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)' + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if if (dyn_subgrid_control_inst%do_harvest) then write(iulog,*) 'ERROR: do_harvest can only be true if you are running with' write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)' @@ -277,6 +289,14 @@ subroutine check_namelist_consistency end if end if + if (dyn_subgrid_control_inst%do_transient_lakes) then + if (use_fates) then + write(iulog,*) 'ERROR: do_transient_lakes currently does not work with use_fates' + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + end if + + end subroutine check_namelist_consistency !----------------------------------------------------------------------- @@ -316,6 +336,18 @@ logical function get_do_transient_crops() get_do_transient_crops = dyn_subgrid_control_inst%do_transient_crops end function get_do_transient_crops + + !----------------------------------------------------------------------- + logical function get_do_transient_lakes() + ! !DESCRIPTION: + ! Return the value of the do_transient_lakes control flag + !----------------------------------------------------------------------- + + SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__)) + + get_do_transient_lakes = dyn_subgrid_control_inst%do_transient_lakes + + end function get_do_transient_lakes !----------------------------------------------------------------------- logical function run_has_transient_landcover() diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index b7528c1b24..c162272e33 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -12,7 +12,7 @@ module dynSubgridDriverMod use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC, BOUNDS_LEVEL_CLUMP use decompMod , only : get_proc_clumps, get_clump_bounds use dynSubgridControlMod , only : get_flanduse_timeseries - use dynSubgridControlMod , only : get_do_transient_pfts, get_do_transient_crops + use dynSubgridControlMod , only : get_do_transient_pfts, get_do_transient_crops, get_do_transient_lakes use dynSubgridControlMod , only : get_do_harvest use dynPriorWeightsMod , only : prior_weights_type use dynPatchStateUpdaterMod , only : patch_state_updater_type @@ -256,10 +256,9 @@ subroutine dynSubgrid_driver(bounds_proc, call dynHarvest_interp(bounds_proc) end if - ! add lake interp (condition to be added later) - - call dynlake_interp(bounds_proc) - + if (get_do_transient_lakes()) then + call dynlake_interp(bounds_proc) + end if ! ========================================================================== ! Do land cover change that does not require I/O ! ========================================================================== From 35c16afa909c66874476a4cd4bceffc64cab8a03 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Thu, 20 Jun 2019 08:29:38 -0600 Subject: [PATCH 1318/1973] Minor changes to source code (This commit was split off from 60c0aafc7 using interactive rebase, discarding the tools changes and just keeping the relatively small source code changes in that commit.) --- src/biogeophys/TotalWaterAndHeatMod.F90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 0fb0ec4303..292bbcb700 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -859,6 +859,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & t_lake => temperature_inst%t_lake_col, & ! lake temperature (K) t_soisno => temperature_inst%t_soisno_col, & ! soil temperature (Kelvin) dynbal_baseline_heat => temperature_inst%dynbal_baseline_heat_col, & ! Input: [real(r8) (:) ] baseline heat content subtracted from each column's total heat calculation (J/m2) + lake_heat => temperature_inst%lake_heat, & ! total heat of lake water (J/m²) h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col, & ! liquid water (kg/m2) h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col & ! frozen water (kg/m2) ) @@ -926,7 +927,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & latent_heat_liquid = latent_heat_liquid_lake(c)) end do - write(iulog,*) 'lake heat (J/m^2)', heat_lake(c) + write(iulog,*) 'lake heat (J/m^2)', heat_lake(c)+latent_heat_liquid(c) ! Add lake heat here if wanted to incorporate do fc = 1, num_lakec @@ -1148,7 +1149,10 @@ subroutine AccumulateLiquidWaterHeatLake(temp, h2o, & do j = 1,nlevlak heat_liquid = heat_liquid + TempToHeat(temp = temp(j), cv = cv) end do - latent_heat_liquid = latent_heat_liquid + h2o*hfus + + ! this would assume the whole lake unfrozen? + latent_heat_liquid = latent_heat_liquid + h2o*hfus + end subroutine AccumulateLiquidWaterHeatLake From 587d8f99300f883b7a992907ebac4cef07b3f079 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Thu, 1 Aug 2019 01:44:24 -0600 Subject: [PATCH 1319/1973] Added lake landunit initialisation for gridcells which will grow lake --- src/biogeophys/LakeTemperatureMod.F90 | 5 +- src/biogeophys/TotalWaterAndHeatMod.F90 | 2 +- src/main/clm_initializeMod.F90 | 7 ++- src/main/clm_varsur.F90 | 3 + src/main/subgridMod.F90 | 51 +++++++++++++-- src/main/subgridWeightsMod.F90 | 12 +++- src/main/surfrdMod.F90 | 84 +++++++++++++++++++++++-- 7 files changed, 146 insertions(+), 18 deletions(-) diff --git a/src/biogeophys/LakeTemperatureMod.F90 b/src/biogeophys/LakeTemperatureMod.F90 index 26f8ee9134..6a20856f67 100644 --- a/src/biogeophys/LakeTemperatureMod.F90 +++ b/src/biogeophys/LakeTemperatureMod.F90 @@ -1004,9 +1004,10 @@ subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_la end do end do - write(iulog,*)'Energy content of lake after calculating lake temperature (J/m²)', ncvts + ! write(iulog,*)'Energy content of lake after calculating lake temperature (J/m²)', ncvts - lake_heat(c) = ncvts(c) + ! IV: currently commented out: caused crash. To do: look at this part of the code!!! + ! lake_heat(c) = ncvts(c) call waterstatebulk_inst%CalculateTotalH2osno(bounds, num_lakec, filter_lakec, & caller = 'LakeTemperature-2', & diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 292bbcb700..8f436687cf 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -927,7 +927,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & latent_heat_liquid = latent_heat_liquid_lake(c)) end do - write(iulog,*) 'lake heat (J/m^2)', heat_lake(c)+latent_heat_liquid(c) + ! write(iulog,*) 'lake heat (J/m^2)', heat_lake(c)+latent_heat_liquid(c) ! Add lake heat here if wanted to incorporate do fc = 1, num_lakec diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 442a77c36b..bdb89df7c2 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -14,7 +14,7 @@ module clm_initializeMod use clm_varctl , only : iulog use clm_varctl , only : use_lch4, use_cn, use_cndv, use_c13, use_c14, use_fates use clm_varctl , only : use_soil_moisture_streams - use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft, irrig_method, wt_glc_mec, topo_glc_mec + use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft, irrig_method, wt_glc_mec, topo_glc_mec, haslake use perf_mod , only : t_startf, t_stopf use readParamsMod , only : readParameters use ncdio_pio , only : file_desc_t @@ -181,7 +181,7 @@ subroutine initialize1(gindex_ocn) allocate (irrig_method (begg:endg, cft_lb:cft_ub )) allocate (wt_glc_mec (begg:endg, maxpatch_glcmec)) allocate (topo_glc_mec(begg:endg, maxpatch_glcmec)) - + allocate (haslake (begg:endg )) ! Read list of Patches and their corresponding parameter values ! Independent of model resolution, Needs to stay before surfrd_get_data @@ -263,7 +263,7 @@ subroutine initialize1(gindex_ocn) ! Some things are kept until the end of initialize2; urban_valid is kept through the ! end of the run for error checking. - deallocate (wt_lunit, wt_cft, wt_glc_mec) + deallocate (wt_lunit, wt_cft, wt_glc_mec, haslake) call t_stopf('clm_init1') @@ -276,6 +276,7 @@ subroutine initialize2( ) ! CLM initialization - second phase ! ! !USES: + use shr_orb_mod , only : shr_orb_decl use shr_scam_mod , only : shr_scam_getCloseLatLon use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND diff --git a/src/main/clm_varsur.F90 b/src/main/clm_varsur.F90 index cd3bacc87a..41740f1e2b 100644 --- a/src/main/clm_varsur.F90 +++ b/src/main/clm_varsur.F90 @@ -45,6 +45,9 @@ module clm_instur ! subgrid glacier_mec sfc elevation real(r8), pointer :: topo_glc_mec(:,:) + + ! whether we have lake to initialise in each grid cell + logical , pointer :: haslake(:) !----------------------------------------------------------------------- end module clm_instur diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index 3f34acda69..c390d9dcaa 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -38,7 +38,8 @@ module subgridMod public :: subgrid_get_info_glacier_mec public :: subgrid_get_info_crop public :: crop_patch_exists ! returns true if the given crop patch should be created in memory - + public :: lake_landunit_exists ! returns true if the lake landunit should be created in memory + ! !PRIVATE MEMBER FUNCTIONS: private :: subgrid_get_info_urban @@ -392,10 +393,10 @@ subroutine subgrid_get_info_lake(gi, npatches, ncols, nlunits) character(len=*), parameter :: subname = 'subgrid_get_info_lake' !----------------------------------------------------------------------- - ! We currently do NOT allow the lake landunit to expand via dynamic landunits, so we - ! only need to allocate space for it where its weight is currently non-zero. - - if (wt_lunit(gi, istdlak) > 0.0_r8) then + ! We do allow the lake landunit to expand via dynamic landunits, so we + ! need to allocate space for where it is known that the lake unit will grow. + + if (lake_landunit_exists(gi) ) then npatches = 1 ncols = 1 nlunits = 1 @@ -484,7 +485,6 @@ subroutine subgrid_get_info_crop(gi, npatches, ncols, nlunits) !----------------------------------------------------------------------- npatches = 0 - do cft = cft_lb, cft_ub if (crop_patch_exists(gi, cft)) then npatches = npatches + 1 @@ -558,6 +558,45 @@ function crop_patch_exists(gi, cft) result(exists) end function crop_patch_exists +!----------------------------------------------------------------------- + function lake_landunit_exists(gi) result(exists) + ! + ! !DESCRIPTION: + ! Returns true if a land unit for lakes should be created in memory + ! which is defined for gridcells which will grow lake, given by haslake + ! + ! !USES: + use dynSubgridControlMod , only : get_do_transient_lakes + use clm_instur , only : haslake + ! + ! !ARGUMENTS: + logical :: exists ! function result + integer, intent(in) :: gi ! grid cell index + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'lake_landunit_exists' + !----------------------------------------------------------------------- + + if (get_do_transient_lakes()) then + ! To support dynamic landunits, we initialise a lake land unit in each grid cell in which there are lakes. + ! This is defined by the haslake variable + + if (haslake(gi)) then + exists = .true. + else + exists = .false. + end if + + else + ! For a run without transient lakes, only allocate memory for lakes actually present in run) + if (wt_lunit(gi, istdlak) > 0.0_r8) then + exists = .true. + else + exists = .false. + end if + end if + end function lake_landunit_exists end module subgridMod diff --git a/src/main/subgridWeightsMod.F90 b/src/main/subgridWeightsMod.F90 index ddcc9585c9..3b67fd7574 100644 --- a/src/main/subgridWeightsMod.F90 +++ b/src/main/subgridWeightsMod.F90 @@ -301,7 +301,7 @@ logical function is_active_l(l, glc_behavior) ! Determine whether the given landunit is active ! ! !USES: - use landunit_varcon, only : istsoil, istice_mec, isturb_MIN, isturb_MAX + use landunit_varcon, only : istsoil, istice_mec, isturb_MIN, isturb_MAX, istdlak ! ! !ARGUMENTS: implicit none @@ -361,7 +361,15 @@ logical function is_active_l(l, glc_behavior) if (lun%itype(l) == istsoil) then is_active_l = .true. end if - + + ! Set all lake land units to active + ! By doing this, lakes are also run virtually in grid cells which will grow + ! lakes during the transient run. + + if (lun%itype(l) == istdlak) then + is_active_l = .true. + end if + end if end function is_active_l diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index 771165459d..f73265cd92 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -289,10 +289,12 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) toosmall_soil, toosmall_crop, toosmall_glacier, & toosmall_lake, toosmall_wetland, toosmall_urban, & n_dom_landunits - use fileutils , only : getfil - use domainMod , only : domain_type, domain_init, domain_clean - use clm_instur , only : wt_lunit, topo_glc_mec + use fileutils , only : getfil + use domainMod , only : domain_type, domain_init, domain_clean + use clm_instur , only : wt_lunit, topo_glc_mec use landunit_varcon, only: max_lunit, istsoil, isturb_MIN, isturb_MAX + use dynSubgridControlMod, only : get_flanduse_timeseries + use clm_varctl , only : fname_len ! ! !ARGUMENTS: integer, intent(in) :: begg, endg, actual_numcft @@ -310,8 +312,11 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) logical :: readvar ! true => variable is on dataset real(r8) :: rmaxlon,rmaxlat ! local min/max vars type(file_desc_t) :: ncid ! netcdf id + type(file_desc_t) :: ncid_dynuse ! netcdf id for landuse timeseries file logical :: istype_domain ! true => input file is of type domain logical :: isgrid2d ! true => intut grid is 2d + character(len=fname_len) :: fdynuse ! landuse.timeseries filename + character(len=32) :: subname = 'surfrd_get_data' ! subroutine name !----------------------------------------------------------------------- @@ -444,6 +449,33 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) write(iulog,*) 'Successfully read surface boundary data' write(iulog,*) end if + + + ! IV: add here call to subroutine to read in lake mask (necessary for initialisation of dynamical lakes) + ! First open landuse.timeseries file for this. + + if (masterproc) then + write(iulog,*) 'Attempting to read landuse.timeseries data .....' + if (lfsurdat == ' ') then + write(iulog,*)'fdynuse must be specified' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + endif + + + ! open landuse_timeseries file + fdynuse = get_flanduse_timeseries() + + call getfil(fdynuse, locfn, 0 ) + + call ncd_pio_openfile (ncid_dynuse, trim(locfn), 0) + + ! read the lakemask + call surfrd_lakemask(begg, endg, ncid_dynuse) + + ! close landuse_timeseries file again + call ncd_pio_closefile(ncid_dynuse) + end subroutine surfrd_get_data @@ -723,7 +755,7 @@ subroutine surfrd_cftformat( ncid, begg, endg, wt_cft, fert_cft, cftsize, natpft wt_nat_patch(begg:,natpft_lb:natpft_size-1+natpft_lb) = array2D(begg:,:) deallocate( array2D ) - end subroutine surfrd_cftformat + end subroutine surfrd_cftformat !----------------------------------------------------------------------- subroutine surfrd_pftformat( begg, endg, ncid ) @@ -946,4 +978,48 @@ subroutine surfrd_veg_dgvm(begg, endg) end subroutine surfrd_veg_dgvm + !----------------------------------------------------------------------- + subroutine surfrd_lakemask(begg, endg, ncid) + ! + ! !DESCRIPTION: + ! Reads the lake mask, indicating where lakes are and will grow + ! of the landuse.timeseries file. + ! Necessary for the initialisation of the lake land units + ! + ! !USES: + use clm_instur , only : haslake + ! !ARGUMENTS: + integer, intent(in) :: begg, endg + type(file_desc_t), intent(inout) :: ncid + ! + ! + ! !LOCAL VARIABLES: + logical :: readvar + integer ,pointer :: haslake_id(:) + ! + ! + character(len=*), parameter :: subname = 'surfrd_lakemask' + ! + !----------------------------------------------------------------------- + + + allocate(haslake_id(begg:endg)) + + call ncd_io(ncid=ncid, varname='HASLAKE' , flag='read', data=haslake_id, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: HASLAKE is not on landuse.timeseries file'//errMsg(sourcefile, __LINE__)) + + where (haslake_id == 1.) + haslake = .true. + elsewhere + haslake = .false. + end where + + + deallocate(haslake_id) + + + end subroutine surfrd_lakemask + + end module surfrdMod From 63b2452563cff0227482fb69eed6bd826f73d7e2 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Mon, 16 Sep 2019 05:11:52 -0600 Subject: [PATCH 1320/1973] Add lake water and heat content to gridcell total water and heat computation --- src/biogeophys/BalanceCheckMod.F90 | 6 +- src/biogeophys/LakeHydrologyMod.F90 | 4 +- src/biogeophys/TotalWaterAndHeatMod.F90 | 130 ++++++++++------------- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 24 +++-- src/dyn_subgrid/dynSubgridDriverMod.F90 | 8 +- src/main/clm_driver.F90 | 4 +- 6 files changed, 87 insertions(+), 89 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index c2d58f711e..65844b7299 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -20,6 +20,7 @@ module BalanceCheckMod use SoilHydrologyType , only : soilhydrology_type use SurfaceAlbedoType , only : surfalb_type use WaterStateType , only : waterstate_type + use LakestateType , only : lakestate_type use WaterDiagnosticBulkType, only : waterdiagnosticbulk_type use WaterDiagnosticType, only : waterdiagnostic_type use Wateratm2lndType , only : wateratm2lnd_type @@ -122,7 +123,7 @@ end function GetBalanceCheckSkipSteps !----------------------------------------------------------------------- subroutine BeginWaterBalance(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, soilhydrology_inst, & + water_inst, soilhydrology_inst, lakestate_inst, & use_aquifer_layer) ! ! !DESCRIPTION: @@ -136,6 +137,7 @@ subroutine BeginWaterBalance(bounds, & integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(water_type) , intent(inout) :: water_inst + type(lakestate_type) , intent(in) :: lakestate_inst type(soilhydrology_type) , intent(in) :: soilhydrology_inst logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! @@ -210,7 +212,7 @@ subroutine BeginWaterBalanceSingle(bounds, & water_mass = begwb(bounds%begc:bounds%endc)) call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, & + waterstate_inst, lakestate_inst, & subtract_dynbal_baselines = .false., & water_mass = begwb(bounds%begc:bounds%endc)) diff --git a/src/biogeophys/LakeHydrologyMod.F90 b/src/biogeophys/LakeHydrologyMod.F90 index 44588fafff..c078e958e1 100644 --- a/src/biogeophys/LakeHydrologyMod.F90 +++ b/src/biogeophys/LakeHydrologyMod.F90 @@ -164,7 +164,7 @@ subroutine LakeHydrology(bounds, & t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] snow temperature (Kelvin) dTdz_top => temperature_inst%dTdz_top_col , & ! Output: [real(r8) (:) ] temperature gradient in top layer K m-1] !TOD snot_top => temperature_inst%snot_top_col , & ! Output: [real(r8) (:) ] snow temperature in top layer [K] !TODO - t_sno_mul_mss => temperature_inst%t_sno_mul_mss_col , & ! Output: [real(r8) (:) ] col snow temperature multiplied by layer mass, layer sum (K * kg/m2) + t_sno_mul_mss => temperature_inst%t_sno_mul_mss_col , & ! Output: [real(r8) (:) ] col snow temperature multiplied by layer mass, layer sum (K * kg/m2) begwb => b_waterbalance_inst%begwb_col , & ! Input: [real(r8) (:) ] water mass begining of the time step endwb => b_waterbalance_inst%endwb_col , & ! Output: [real(r8) (:) ] water mass end of the time step @@ -649,7 +649,7 @@ subroutine LakeHydrology(bounds, & ! Determine ending water balance and volumetric soil water call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & - b_waterstate_inst, & + b_waterstate_inst, lakestate_inst, & subtract_dynbal_baselines = .false., & water_mass = endwb(bounds%begc:bounds%endc)) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 8f436687cf..e176555a14 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -8,8 +8,8 @@ module TotalWaterAndHeatMod #include "shr_assert.h" use shr_kind_mod , only : r8 => shr_kind_r8 use decompMod , only : bounds_type - use clm_varcon , only : cpice, cpliq, denh2o, tfrz, hfus - use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb + use clm_varcon , only : cpice, cpliq, denh2o, denice, tfrz, hfus + use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb, nlevlak use ColumnType , only : col use LandunitType , only : lun use subgridAveMod , only : p2c @@ -21,6 +21,7 @@ module TotalWaterAndHeatMod use UrbanParamsType , only : urbanparams_type use SoilStateType , only : soilstate_type use TemperatureType , only : temperature_type + use LakeStateType , only : lakestate_type use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use column_varcon , only : icol_road_perv, icol_road_imperv use landunit_varcon , only : istdlak, istsoil,istcrop,istwet,istice_mec @@ -78,7 +79,6 @@ module TotalWaterAndHeatMod ! ! !PRIVATE MEMBER FUNCTIONS: private :: AccumulateLiquidWaterHeat ! For use by ComputeHeat* routines: accumulate quantities that we need to count for liquid water, for a single column - private :: AccumulateLiquidWaterHeatLake ! same as above but able to read in 2D lake temperature private :: TempToHeat ! For use by ComputeHeat* routines: convert temperature to heat content character(len=*), parameter, private :: sourcefile = & @@ -140,7 +140,7 @@ end subroutine ComputeWaterMassNonLake !----------------------------------------------------------------------- subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, & + waterstate_inst, lakestate_inst, & subtract_dynbal_baselines, & water_mass) ! @@ -155,6 +155,7 @@ subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points class(waterstate_type) , intent(in) :: waterstate_inst + type(lakestate_type) , intent(in) :: lakestate_inst ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When we can accept answer changes to methane, ! remove this argument, always assuming it's true. @@ -177,6 +178,7 @@ subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & num_lakec = num_lakec, & filter_lakec = filter_lakec, & waterstate_inst = waterstate_inst, & + lakestate_inst = lakestate_inst, & subtract_dynbal_baselines = subtract_dynbal_baselines, & liquid_mass = liquid_mass(bounds%begc:bounds%endc), & ice_mass = ice_mass(bounds%begc:bounds%endc)) @@ -383,7 +385,7 @@ end subroutine AccumulateSoilLiqIceMassNonLake !----------------------------------------------------------------------- subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, & + waterstate_inst, lakestate_inst,& subtract_dynbal_baselines, & liquid_mass, ice_mass) ! @@ -401,6 +403,8 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points class(waterstate_type), intent(in) :: waterstate_inst + type(lakestate_type) , intent(in) :: lakestate_inst + ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When we can accept answer changes to methane, ! remove this argument, always assuming it's true. @@ -410,8 +414,10 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! computed ice mass (kg m-2) ! ! !LOCAL VARIABLES: - integer :: c, j, fc ! indices - + integer :: c, j, fc ! indices + real(r8) :: h2olak_liq(bounds%begc:bounds%endc,1:nlevlak) ! liquid water content of lake layer [kg/m²] + real(r8) :: h2olak_ice(bounds%begc:bounds%endc,1:nlevlak) ! ice water content of lake layer [kg/m²] + character(len=*), parameter :: subname = 'ComputeLiqIceMassLake' !----------------------------------------------------------------------- @@ -420,10 +426,11 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & associate( & snl => col%snl , & ! Input: [integer (:) ] negative number of snow layers - + dz_lake => col%dz_lake , & ! Input: [real(r8) (:,:) ] lake depth (m) h2osno_no_layers => waterstate_inst%h2osno_no_layers_col , & ! Input: [real(r8) (:) ] snow water that is not resolved into layers (mm H2O) h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col, & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) + h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) + lake_icefrac => lakestate_inst%lake_icefrac_col, & ! Input: [real(r8) (:,:) ] lake ice fraction dynbal_baseline_liq => waterstate_inst%dynbal_baseline_liq_col, & ! Input: [real(r8) (:) ] baseline liquid water content subtracted from each column's total liquid water calculation (mm H2O) dynbal_baseline_ice => waterstate_inst%dynbal_baseline_ice_col & ! Input: [real(r8) (:) ] baseline ice content subtracted from each column's total ice calculation (mm H2O) ) @@ -445,6 +452,19 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & end do end do + ! Lake water content + do j = 1, nlevlak + do fc = 1, num_lakec + c = filter_lakec(fc) + ! calculate lake liq and ice content per lake layer first + h2olak_liq(c,j) = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) + h2olak_ice(c,j) = dz_lake(c,j) * denice * lake_icefrac(c,j) + + liquid_mass(c) = liquid_mass(c) + h2olak_liq(c,j) + ice_mass(c) = ice_mass(c) + h2olak_ice(c,j) + end do + end do + ! Soil water content of the soil under the lake do j = 1, nlevgrnd do fc = 1, num_lakec @@ -800,8 +820,8 @@ end subroutine AccumulateSoilHeatNonLake !----------------------------------------------------------------------- subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & - soilstate_inst, temperature_inst, waterstatebulk_inst, & - heat, heat_liquid, cv_liquid, heat_lake) + soilstate_inst, temperature_inst, waterstatebulk_inst, lakestate_inst, & + heat, heat_liquid, cv_liquid) ! ! !DESCRIPTION: ! Compute total heat content for all lake columns @@ -816,10 +836,6 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & - ! REMOVE THIS when done developing - use clm_varctl , only : iulog - - ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_lakec @@ -827,11 +843,12 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & type(soilstate_type) , intent(in) :: soilstate_inst type(temperature_type) , intent(in) :: temperature_inst type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(lakestate_type) , intent(in) :: lakestate_inst + real(r8) , intent(inout) :: heat( bounds%begc: ) ! sum of heat content for all columns [J/m^2] real(r8) , intent(inout) :: heat_liquid( bounds%begc: ) ! sum of heat content for all columns: liquid water, excluding latent heat [J/m^2] real(r8) , intent(inout) :: cv_liquid( bounds%begc: ) ! sum of liquid heat capacity for all columns [J/(m^2 K)] - real(r8) , intent(inout) :: heat_lake( bounds%begc: ) ! heat content of the lake water in column [J/m^2] ! ! !LOCAL VARIABLES: @@ -841,8 +858,9 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & real(r8) :: heat_dry_mass(bounds%begc:bounds%endc) ! sum of heat content: dry mass [J/m^2] real(r8) :: heat_ice(bounds%begc:bounds%endc) ! sum of heat content: ice [J/m^2] real(r8) :: latent_heat_liquid(bounds%begc:bounds%endc) ! sum of latent heat content of liquid water [J/m^2] - real(r8) :: latent_heat_liquid_lake(bounds%begc:bounds%endc) ! sum of latent heat content of liquid water of lake itself [J/m^2] - + real(r8) :: h2olak_liq(bounds%begc:bounds%endc,1:nlevlak) ! liquid water content of lake layer [kg/m²] + real(r8) :: h2olak_ice(bounds%begc:bounds%endc,1:nlevlak) ! ice water content of lake layer [kg/m²] + character(len=*), parameter :: subname = 'ComputeHeatLake' !----------------------------------------------------------------------- @@ -853,7 +871,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & associate( & snl => col%snl, & ! number of snow layers dz => col%dz, & ! layer depth (m) - lakedepth => col%lakedepth, & ! lake depth (m) + dz_lake => col%dz_lake, & ! lake layer depth (m) watsat => soilstate_inst%watsat_col, & ! volumetric soil water at saturation (porosity) csol => soilstate_inst%csol_col, & ! heat capacity, soil solids (J/m**3/Kelvin) t_lake => temperature_inst%t_lake_col, & ! lake temperature (K) @@ -861,7 +879,8 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & dynbal_baseline_heat => temperature_inst%dynbal_baseline_heat_col, & ! Input: [real(r8) (:) ] baseline heat content subtracted from each column's total heat calculation (J/m2) lake_heat => temperature_inst%lake_heat, & ! total heat of lake water (J/m²) h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col, & ! liquid water (kg/m2) - h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col & ! frozen water (kg/m2) + h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col, & ! frozen water (kg/m2) + lake_icefrac => lakestate_inst%lake_icefrac_col & ! Input: [real(r8) (:,:) ] lake ice fraction ) do fc = 1, num_lakec @@ -915,21 +934,27 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & ! TODO(wjs, 2017-03-11) Include heat content of water in lakes, once we include ! lake water as an explicit water state (https://github.com/ESCOMP/ctsm/issues/200) - ! calculate heat content of lake itself - !set condition on heat_lake when is present (optional argument)? - do fc = 1, num_lakec - c = filter_lakec(fc) - call AccumulateLiquidWaterHeatLake( & - temp = t_lake(c,:), & - h2o = lakedepth(c)*1000, & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_lake(c), & - latent_heat_liquid = latent_heat_liquid_lake(c)) - end do + ! calculate heat content of lake itself + do j = 1, nlevlak + do fc = 1, num_lakec + c = filter_lakec(fc) + ! liquid heat + h2olak_liq(c,j) = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) + call AccumulateLiquidWaterHeat( & + temp = t_lake(c,j), & + h2o = h2olak_liq(c,j), & + cv_liquid = cv_liquid(c), & + heat_liquid = heat_liquid(c), & + latent_heat_liquid = latent_heat_liquid(c)) + ! ice heat + h2olak_ice(c,j) = dz_lake(c,j) * denice * lake_icefrac(c,j) + heat_ice(c) = heat_ice(c) + & + TempToHeat(temp=t_lake(c,j), cv = (h2olak_ice(c,j) * cpice)) + end do + end do ! write(iulog,*) 'lake heat (J/m^2)', heat_lake(c)+latent_heat_liquid(c) -! Add lake heat here if wanted to incorporate do fc = 1, num_lakec c = filter_lakec(fc) heat(c) = heat_dry_mass(c) + heat_ice(c) + heat_liquid(c) + latent_heat_liquid(c) @@ -1115,47 +1140,6 @@ subroutine AccumulateLiquidWaterHeat(temp, h2o, & latent_heat_liquid = latent_heat_liquid + h2o*hfus end subroutine AccumulateLiquidWaterHeat -! Repeating same module, quick fix to account for 2D temperature field of lake temp. (to be removed) - !----------------------------------------------------------------------- - subroutine AccumulateLiquidWaterHeatLake(temp, h2o, & - heat_liquid, latent_heat_liquid, cv_liquid) - ! - ! !DESCRIPTION: - ! In the course of accumulating heat contents: Accumulate quantities that we need to - ! count for liquid water, for a single column - - use clm_varpar ,only : nlevlak -! - ! !ARGUMENTS: - real(r8), intent(in) :: temp(:) ! temperature [K] - real(r8), intent(in) :: h2o ! water mass [kg/m^2] - - real(r8), intent(inout) :: heat_liquid ! accumulated total heat content of liquid water for this column, excluding latent heat [J/m^2] - real(r8), intent(inout) :: latent_heat_liquid ! accumulated total latent heat content of liquid water for this column [J/m^2] - real(r8), intent(inout), optional :: cv_liquid ! accumulated total liquid heat capacity for this column [J/(m^2 K)] - ! - ! !LOCAL VARIABLES: - real(r8) :: cv ! heat capacity [J/(m^2 K)] - integer :: j ! do loop index - character(len=*), parameter :: subname = 'AccumulateLiquidWaterHeatLake' - !----------------------------------------------------------------------- - - cv = h2o*cpliq - if (present(cv_liquid)) then - cv_liquid = cv_liquid + cv - end if - - ! loop over lake levels - do j = 1,nlevlak - heat_liquid = heat_liquid + TempToHeat(temp = temp(j), cv = cv) - end do - - ! this would assume the whole lake unfrozen? - latent_heat_liquid = latent_heat_liquid + h2o*hfus - - - end subroutine AccumulateLiquidWaterHeatLake - !----------------------------------------------------------------------- pure function TempToHeat(temp, cv) result(heat) diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index 9c2e6bdf34..95deb10dd8 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -20,6 +20,7 @@ module dynConsBiogeophysMod use WaterFluxType , only : waterflux_type use WaterStateBulkType , only : waterstatebulk_type use WaterStateType , only : waterstate_type + use LakestateType , only : lakestate_type use WaterDiagnosticType , only : waterdiagnostic_type use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use WaterBalanceType , only : waterbalance_type @@ -334,7 +335,7 @@ subroutine dyn_hwcontent_init(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & urbanparams_inst, soilstate_inst, & - water_inst, temperature_inst) + water_inst, temperature_inst, lakestate_inst) ! ! !DESCRIPTION: ! Compute grid cell-level heat and water content before land cover change @@ -350,7 +351,9 @@ subroutine dyn_hwcontent_init(bounds, & type(urbanparams_type) , intent(in) :: urbanparams_inst type(soilstate_type) , intent(in) :: soilstate_inst type(water_type) , intent(inout) :: water_inst + type(lakestate_type) , intent(in) :: lakestate_inst type(temperature_type) , intent(inout) :: temperature_inst + ! ! !LOCAL VARIABLES: integer :: i @@ -369,6 +372,7 @@ subroutine dyn_hwcontent_init(bounds, & num_lakec, filter_lakec, & bulk_or_tracer%waterstate_inst, & bulk_or_tracer%waterdiagnostic_inst, & + lakestate_inst, & liquid_mass = bulk_or_tracer%waterbalance_inst%liq1_grc(begg:endg), & ice_mass = bulk_or_tracer%waterbalance_inst%ice1_grc(begg:endg)) end associate @@ -380,6 +384,7 @@ subroutine dyn_hwcontent_init(bounds, & urbanparams_inst, soilstate_inst, & temperature_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & + lakestate_inst, & heat_grc = temperature_inst%heat1_grc(begg:endg), & liquid_water_temp_grc = temperature_inst%liquid_water_temp1_grc(begg:endg)) @@ -393,7 +398,7 @@ subroutine dyn_hwcontent_final(bounds, & num_lakec, filter_lakec, & urbanparams_inst, soilstate_inst, & water_inst, & - temperature_inst, energyflux_inst) + temperature_inst, energyflux_inst, lakestate_inst) ! ! !DESCRIPTION: ! Compute grid cell-level heat and water content and dynbal fluxes after land cover change @@ -409,6 +414,7 @@ subroutine dyn_hwcontent_final(bounds, & type(urbanparams_type) , intent(in) :: urbanparams_inst type(soilstate_type) , intent(in) :: soilstate_inst type(water_type) , intent(inout) :: water_inst + type(lakestate_type) , intent(in) :: lakestate_inst type(temperature_type) , intent(inout) :: temperature_inst type(energyflux_type) , intent(inout) :: energyflux_inst ! @@ -433,6 +439,7 @@ subroutine dyn_hwcontent_final(bounds, & bulk_or_tracer%waterdiagnostic_inst, & bulk_or_tracer%waterbalance_inst, & bulk_or_tracer%waterflux_inst, & + lakestate_inst, & delta_liq = this_delta_liq(begg:endg)) if (i == water_inst%i_bulk) then delta_liq_bulk(begg:endg) = this_delta_liq(begg:endg) @@ -446,6 +453,7 @@ subroutine dyn_hwcontent_final(bounds, & urbanparams_inst, soilstate_inst, & temperature_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & + lakestate_inst, & heat_grc = temperature_inst%heat2_grc(begg:endg), & liquid_water_temp_grc = temperature_inst%liquid_water_temp2_grc(begg:endg)) @@ -549,7 +557,7 @@ end subroutine dyn_water_content_final subroutine dyn_water_content(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & - waterstate_inst, waterdiagnostic_inst, & + waterstate_inst, waterdiagnostic_inst, lakestate_inst, & liquid_mass, ice_mass) ! ! !DESCRIPTION: @@ -563,6 +571,7 @@ subroutine dyn_water_content(bounds, & integer , intent(in) :: filter_lakec(:) class(waterstate_type) , intent(in) :: waterstate_inst class(waterdiagnostic_type) , intent(in) :: waterdiagnostic_inst + type(lakestate_type) , intent(in) :: lakestate_inst real(r8) , intent(out) :: liquid_mass( bounds%begg: ) ! kg m-2 real(r8) , intent(out) :: ice_mass( bounds%begg: ) ! kg m-2 ! @@ -584,6 +593,7 @@ subroutine dyn_water_content(bounds, & call ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, & + lakestate_inst, & subtract_dynbal_baselines = .true., & liquid_mass = liquid_mass_col(bounds%begc:bounds%endc), & ice_mass = ice_mass_col(bounds%begc:bounds%endc)) @@ -608,7 +618,7 @@ subroutine dyn_heat_content(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & urbanparams_inst, soilstate_inst, & - temperature_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, & + temperature_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, lakestate_inst, & heat_grc, liquid_water_temp_grc) ! !DESCRIPTION: @@ -631,6 +641,7 @@ subroutine dyn_heat_content(bounds, & type(temperature_type) , intent(in) :: temperature_inst type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(lakestate_type) , intent(in) :: lakestate_inst real(r8) , intent(out) :: heat_grc( bounds%begg: ) ! total heat content for each grid cell [J/m^2] real(r8) , intent(out) :: liquid_water_temp_grc( bounds%begg: ) ! weighted average liquid water temperature for each grid cell (K) @@ -660,11 +671,10 @@ subroutine dyn_heat_content(bounds, & cv_liquid = cv_liquid_col(bounds%begc:bounds%endc)) call ComputeHeatLake(bounds, num_lakec, filter_lakec, & - soilstate_inst, temperature_inst, waterstatebulk_inst, & + soilstate_inst, temperature_inst, waterstatebulk_inst, lakestate_inst, & heat = heat_col(bounds%begc:bounds%endc), & heat_liquid = heat_liquid_col(bounds%begc:bounds%endc), & - cv_liquid = cv_liquid_col(bounds%begc:bounds%endc), & - heat_lake = heat_lake_col(bounds%begc:bounds%endc)) + cv_liquid = cv_liquid_col(bounds%begc:bounds%endc)) call c2g(bounds, & carr = heat_col(bounds%begc:bounds%endc), & diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index c162272e33..f5ace35b48 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -39,6 +39,7 @@ module dynSubgridDriverMod use SoilHydrologyType , only : soilhydrology_type use SoilStateType , only : soilstate_type use WaterType , only : water_type + use LakestateType , only : lakestate_type use TemperatureType , only : temperature_type use CropType , only : crop_type use glc2lndMod , only : glc2lnd_type @@ -164,7 +165,7 @@ end subroutine dynSubgrid_init !----------------------------------------------------------------------- subroutine dynSubgrid_driver(bounds_proc, & urbanparams_inst, soilstate_inst, water_inst, & - temperature_inst, energyflux_inst, & + temperature_inst, energyflux_inst, lakestate_inst, & canopystate_inst, photosyns_inst, crop_inst, glc2lnd_inst, bgc_vegetation_inst, & soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, & c13_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst, & @@ -192,6 +193,7 @@ subroutine dynSubgrid_driver(bounds_proc, type(urbanparams_type) , intent(in) :: urbanparams_inst type(soilstate_type) , intent(in) :: soilstate_inst type(water_type) , intent(inout) :: water_inst + type(lakestate_type) , intent(in) :: lakestate_inst type(temperature_type) , intent(inout) :: temperature_inst type(energyflux_type) , intent(inout) :: energyflux_inst type(canopystate_type) , intent(inout) :: canopystate_inst @@ -232,7 +234,7 @@ subroutine dynSubgrid_driver(bounds_proc, filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & urbanparams_inst, soilstate_inst, & - water_inst, temperature_inst) + water_inst, temperature_inst, lakestate_inst) call prior_weights%set_prior_weights(bounds_clump) call patch_state_updater%set_old_weights(bounds_clump) @@ -306,7 +308,7 @@ subroutine dynSubgrid_driver(bounds_proc, filter(nc)%num_lakec, filter(nc)%lakec, & urbanparams_inst, soilstate_inst, & water_inst, & - temperature_inst, energyflux_inst) + temperature_inst, energyflux_inst, lakestate_inst) if (use_cn) then call bgc_vegetation_inst%DynamicAreaConservation(bounds_clump, nc, & diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 92c2372a52..60f64ab03d 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -332,7 +332,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_startf('dyn_subgrid') call dynSubgrid_driver(bounds_proc, & urbanparams_inst, soilstate_inst, water_inst, & - temperature_inst, energyflux_inst, & + temperature_inst, energyflux_inst, lakestate_inst, & canopystate_inst, photosyns_inst, crop_inst, glc2lnd_inst, bgc_vegetation_inst, & soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, & c13_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst, & @@ -378,7 +378,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call BeginWaterBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & - water_inst, soilhydrology_inst, & + water_inst, soilhydrology_inst, lakestate_inst, & use_aquifer_layer = use_aquifer_layer()) call t_stopf('begwbal') From 48cddcc7830f51357ec164349f183b59fc5af457 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Thu, 19 Sep 2019 03:29:21 -0600 Subject: [PATCH 1321/1973] Set initial subgrid weights for aspects that are read from file: add lakes --- src/dyn_subgrid/dynSubgridDriverMod.F90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index f5ace35b48..c82598d444 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -145,6 +145,9 @@ subroutine dynSubgrid_init(bounds_proc, glc_behavior, crop_inst) call dyncrop_interp(bounds_proc, crop_inst) end if + if (get_do_transient_lakes()) then + call dynlake_interp(bounds_proc) + end if ! (We don't bother calling dynHarvest_interp, because the harvest information isn't ! needed until the run loop. Harvest has nothing to do with subgrid weights, and in ! some respects doesn't even really belong in this module at all.) From e9a2709fee992647c5da3197b5acd306e842d833 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Thu, 19 Sep 2019 03:31:18 -0600 Subject: [PATCH 1322/1973] Fix arguments to account for total lake heat and water content --- src/main/clm_initializeMod.F90 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index bdb89df7c2..7f596c14f0 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -486,7 +486,9 @@ subroutine initialize2( ) call dyn_hwcontent_set_baselines(bounds_clump, & filter_inactive_and_active(nc)%num_icemecc, & filter_inactive_and_active(nc)%icemecc, & - urbanparams_inst, soilstate_inst, water_inst, temperature_inst) + filter_inactive_and_active(nc)%num_lakec, & + filter_inactive_and_active(nc)%lakec, & + urbanparams_inst, soilstate_inst, lakestate_inst, water_inst, temperature_inst) end do ! ------------------------------------------------------------------------ @@ -624,7 +626,10 @@ subroutine initialize2( ) call dyn_hwcontent_set_baselines(bounds_clump, & filter_inactive_and_active(nc)%num_icemecc, & filter_inactive_and_active(nc)%icemecc, & - urbanparams_inst, soilstate_inst, water_inst, temperature_inst) + filter_inactive_and_active(nc)%num_lakec, & + filter_inactive_and_active(nc)%lakec, & + urbanparams_inst, soilstate_inst, lakestate_inst, & + water_inst, temperature_inst) end do else if (nsrest == nsrBranch) then call endrun(msg='ERROR clm_initializeMod: '//& From 50bf1975c14e6f599075f45446feed818158c749 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Thu, 19 Sep 2019 09:09:23 -0600 Subject: [PATCH 1323/1973] Add baseline approach for lake dynamical land units --- src/biogeophys/TotalWaterAndHeatMod.F90 | 208 +++++++++++++++++------ src/dyn_subgrid/dynConsBiogeophysMod.F90 | 102 ++++++++--- src/dyn_subgrid/dynSubgridDriverMod.F90 | 2 + 3 files changed, 237 insertions(+), 75 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index e176555a14..60af2a901e 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -39,12 +39,14 @@ module TotalWaterAndHeatMod ! routines parallel with the water routines. public :: ComputeWaterMassNonLake ! Compute total water mass of non-lake columns public :: ComputeWaterMassLake ! Compute total water mass of lake columns + public :: AccumulateLiqIceMassLake ! Accumulate lake water mass of lake columns, separated into liquid and ice public :: ComputeLiqIceMassNonLake ! Compute total water mass of non-lake columns, separated into liquid and ice public :: AccumulateSoilLiqIceMassNonLake ! Accumulate soil water mass of non-lake columns, separated into liquid and ice public :: ComputeLiqIceMassLake ! Compute total water mass of lake columns, separated into liquid and ice public :: ComputeHeatNonLake ! Compute heat content of non-lake columns public :: AccumulateSoilHeatNonLake ! Accumulate soil heat content of non-lake columns public :: ComputeHeatLake ! Compute heat content of lake columns + public :: AccumulateHeatLake ! Accumulate heat content of lake water of lake columns public :: AdjustDeltaHeatForDeltaLiq ! Adjusts the change in gridcell heat content due to land cover change to account for the implicit heat flux associated with delta_liq public :: LiquidWaterHeat ! Get the total heat content of some mass of liquid water at a given temperature @@ -155,7 +157,7 @@ subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points class(waterstate_type) , intent(in) :: waterstate_inst - type(lakestate_type) , intent(in) :: lakestate_inst + type(lakestate_type) , intent(in) :: lakestate_inst ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When we can accept answer changes to methane, ! remove this argument, always assuming it's true. @@ -415,9 +417,7 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & ! ! !LOCAL VARIABLES: integer :: c, j, fc ! indices - real(r8) :: h2olak_liq(bounds%begc:bounds%endc,1:nlevlak) ! liquid water content of lake layer [kg/m²] - real(r8) :: h2olak_ice(bounds%begc:bounds%endc,1:nlevlak) ! ice water content of lake layer [kg/m²] - + character(len=*), parameter :: subname = 'ComputeLiqIceMassLake' !----------------------------------------------------------------------- @@ -426,11 +426,9 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & associate( & snl => col%snl , & ! Input: [integer (:) ] negative number of snow layers - dz_lake => col%dz_lake , & ! Input: [real(r8) (:,:) ] lake depth (m) h2osno_no_layers => waterstate_inst%h2osno_no_layers_col , & ! Input: [real(r8) (:) ] snow water that is not resolved into layers (mm H2O) h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - lake_icefrac => lakestate_inst%lake_icefrac_col, & ! Input: [real(r8) (:,:) ] lake ice fraction dynbal_baseline_liq => waterstate_inst%dynbal_baseline_liq_col, & ! Input: [real(r8) (:) ] baseline liquid water content subtracted from each column's total liquid water calculation (mm H2O) dynbal_baseline_ice => waterstate_inst%dynbal_baseline_ice_col & ! Input: [real(r8) (:) ] baseline ice content subtracted from each column's total ice calculation (mm H2O) ) @@ -451,19 +449,10 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) end do end do - - ! Lake water content - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - ! calculate lake liq and ice content per lake layer first - h2olak_liq(c,j) = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) - h2olak_ice(c,j) = dz_lake(c,j) * denice * lake_icefrac(c,j) - - liquid_mass(c) = liquid_mass(c) + h2olak_liq(c,j) - ice_mass(c) = ice_mass(c) + h2olak_ice(c,j) - end do - end do + + ! Lake water content + call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, & + lakestate_inst, liquid_mass, ice_mass) ! Soil water content of the soil under the lake do j = 1, nlevgrnd @@ -487,6 +476,60 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & end subroutine ComputeLiqIceMassLake + !----------------------------------------------------------------------- + subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & + lakestate_inst, liquid_mass, ice_mass) + ! + ! !DESCRIPTION: + ! Accumulate lake water mass of lake columns, separated into liquid and ice. + ! + ! Adds to any existing values in liquid_mass and ice_mass. + ! + ! Note: Changes to this routine should generally be accompanied by similar changes to + ! AccumulateSoilHeatLake + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_c ! number of column points in column filter (should not include lake points; can be a subset of the no-lake filter) + integer , intent(in) :: filter_c(:) ! column filter (should not include lake points; can be a subset of the no-lake filter) + type(lakestate_type) , intent(in) :: lakestate_inst + real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! accumulated liquid mass (kg m-2) + real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! accumulated ice mass (kg m-2) + ! + ! !LOCAL VARIABLES: + integer :: c, j, fc ! indices + real(r8) :: h2olak_liq(bounds%begc:bounds%endc,1:nlevlak) ! liquid water content of lake layer [kg/m²] + real(r8) :: h2olak_ice(bounds%begc:bounds%endc,1:nlevlak) ! ice water content of lake layer [kg/m²] + + character(len=*), parameter :: subname = 'AccumulateLiqIceMassLake' + !----------------------------------------------------------------------- + + SHR_ASSERT_ALL((ubound(liquid_mass) == [bounds%endc]), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(ice_mass) == [bounds%endc]), errMsg(sourcefile, __LINE__)) + + associate( & + lake_icefrac => lakestate_inst%lake_icefrac_col, & ! Input: [real(r8) (:,:) ] lake ice fraction + dz_lake => col%dz_lake & ! Input: [real(r8) (:,:) ] lake depth (m) + ) + + ! Lake water content + do j = 1, nlevlak + do fc = 1, num_c + c = filter_c(fc) + ! calculate lake liq and ice content per lake layer first + h2olak_liq(c,j) = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) + h2olak_ice(c,j) = dz_lake(c,j) * denice * lake_icefrac(c,j) + + liquid_mass(c) = liquid_mass(c) + h2olak_liq(c,j) + ice_mass(c) = ice_mass(c) + h2olak_ice(c,j) + end do + end do + + end associate + + end subroutine AccumulateLiqIceMassLake + + !----------------------------------------------------------------------- subroutine ComputeHeatNonLake(bounds, num_nolakec, filter_nolakec, & urbanparams_inst, soilstate_inst, & @@ -858,9 +901,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & real(r8) :: heat_dry_mass(bounds%begc:bounds%endc) ! sum of heat content: dry mass [J/m^2] real(r8) :: heat_ice(bounds%begc:bounds%endc) ! sum of heat content: ice [J/m^2] real(r8) :: latent_heat_liquid(bounds%begc:bounds%endc) ! sum of latent heat content of liquid water [J/m^2] - real(r8) :: h2olak_liq(bounds%begc:bounds%endc,1:nlevlak) ! liquid water content of lake layer [kg/m²] - real(r8) :: h2olak_ice(bounds%begc:bounds%endc,1:nlevlak) ! ice water content of lake layer [kg/m²] - + character(len=*), parameter :: subname = 'ComputeHeatLake' !----------------------------------------------------------------------- @@ -871,16 +912,13 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & associate( & snl => col%snl, & ! number of snow layers dz => col%dz, & ! layer depth (m) - dz_lake => col%dz_lake, & ! lake layer depth (m) watsat => soilstate_inst%watsat_col, & ! volumetric soil water at saturation (porosity) csol => soilstate_inst%csol_col, & ! heat capacity, soil solids (J/m**3/Kelvin) - t_lake => temperature_inst%t_lake_col, & ! lake temperature (K) t_soisno => temperature_inst%t_soisno_col, & ! soil temperature (Kelvin) dynbal_baseline_heat => temperature_inst%dynbal_baseline_heat_col, & ! Input: [real(r8) (:) ] baseline heat content subtracted from each column's total heat calculation (J/m2) lake_heat => temperature_inst%lake_heat, & ! total heat of lake water (J/m²) h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col, & ! liquid water (kg/m2) - h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col, & ! frozen water (kg/m2) - lake_icefrac => lakestate_inst%lake_icefrac_col & ! Input: [real(r8) (:,:) ] lake ice fraction + h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col & ! frozen water (kg/m2) ) do fc = 1, num_lakec @@ -913,7 +951,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & end do end do - ! Soil water content of the soil under the lake + ! Soil heat content of the soil under the lake do j = 1,nlevgrnd do fc = 1, num_lakec c = filter_lakec(fc) @@ -930,35 +968,15 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & TempToHeat(temp = t_soisno(c,j), cv = (h2osoi_ice(c,j)*cpice)) end do end do - - ! TODO(wjs, 2017-03-11) Include heat content of water in lakes, once we include - ! lake water as an explicit water state (https://github.com/ESCOMP/ctsm/issues/200) - - ! calculate heat content of lake itself - do j = 1, nlevlak + do fc = 1, num_lakec - c = filter_lakec(fc) - ! liquid heat - h2olak_liq(c,j) = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) - call AccumulateLiquidWaterHeat( & - temp = t_lake(c,j), & - h2o = h2olak_liq(c,j), & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_liquid(c), & - latent_heat_liquid = latent_heat_liquid(c)) - ! ice heat - h2olak_ice(c,j) = dz_lake(c,j) * denice * lake_icefrac(c,j) - heat_ice(c) = heat_ice(c) + & - TempToHeat(temp=t_lake(c,j), cv = (h2olak_ice(c,j) * cpice)) - end do - end do - - ! write(iulog,*) 'lake heat (J/m^2)', heat_lake(c)+latent_heat_liquid(c) - - do fc = 1, num_lakec c = filter_lakec(fc) heat(c) = heat_dry_mass(c) + heat_ice(c) + heat_liquid(c) + latent_heat_liquid(c) end do + + ! Lake water heat content + call AccumulateHeatLake(bounds, num_lakec, filter_lakec, temperature_inst, lakestate_inst, & + heat, heat_liquid, cv_liquid) ! Subtract baselines set in initialization ! @@ -982,6 +1000,92 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & end subroutine ComputeHeatLake + !----------------------------------------------------------------------- + subroutine AccumulateHeatLake(bounds, num_c, filter_c, & + temperature_inst, lakestate_inst, & + heat, heat_liquid, cv_liquid) + ! + ! !DESCRIPTION: + ! Accumulate heat of lake water in lake columns. + ! + ! Adds to any existing values in heat, heat_liquid and cv_liquid. + ! + ! Note: Changes to this routine should generally be accompanied by similar changes to + ! AccumulateLiqIceMassLake + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_c ! number of column points in column filter (should not include lake points; can be a subset of the no-lake filter) + integer , intent(in) :: filter_c(:) ! column filter (should not include lake points; can be a subset of the no-lake filter) + type(temperature_type) , intent(in) :: temperature_inst + type(lakestate_type) , intent(in) :: lakestate_inst + real(r8) , intent(inout) :: heat( bounds%begc: ) ! accumulated heat content [J/m^2] + real(r8) , intent(inout) :: heat_liquid( bounds%begc: ) ! accumulated heat content: liquid water, excluding latent heat [J/m^2] + real(r8) , intent(inout) :: cv_liquid( bounds%begc: ) ! accumulated liquid water heat capacity [J/(m^2 K)] + ! + ! !LOCAL VARIABLES: + integer :: fc + integer :: l, c, j + real(r8) :: h2olak_liq(bounds%begc:bounds%endc,1:nlevlak) ! liquid water content of lake layer [kg/m²] + real(r8) :: h2olak_ice(bounds%begc:bounds%endc,1:nlevlak) ! ice water content of lake layer [kg/m²] + real(r8) :: lake_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: liquid water in lake, excluding latent heat [J/m^2] + real(r8) :: lake_heat_ice(bounds%begc:bounds%endc) ! sum of heat content: ice in lake [J/m^2] + real(r8) :: lake_latent_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: latent heat of liquid water in lake [J/m^2] + + + character(len=*), parameter :: subname = 'AccumulateHeatLake' + !----------------------------------------------------------------------- + + SHR_ASSERT_ALL((ubound(heat) == [bounds%endc]), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(heat_liquid) == [bounds%endc]), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(cv_liquid) == [bounds%endc]), errMsg(sourcefile, __LINE__)) + + associate( & + dz_lake => col%dz_lake, & ! lake layer depth (m) + t_lake => temperature_inst%t_lake_col, & ! lake temperature (K) + lake_icefrac => lakestate_inst%lake_icefrac_col & ! Input: [real(r8) (:,:) ] lake ice fraction + ) + + do fc = 1, num_c + c = filter_c(fc) + + lake_heat_liquid(c) = 0._r8 + lake_heat_ice(c) = 0._r8 + lake_latent_heat_liquid(c) = 0._r8 + end do + + + ! calculate heat content of lake itself + do j = 1, nlevlak + do fc = 1, num_c + c = filter_c(fc) + ! liquid heat + h2olak_liq(c,j) = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) + call AccumulateLiquidWaterHeat( & + temp = t_lake(c,j), & + h2o = h2olak_liq(c,j), & + cv_liquid = cv_liquid(c), & + heat_liquid = lake_heat_liquid(c), & + latent_heat_liquid = lake_latent_heat_liquid(c)) + ! ice heat + h2olak_ice(c,j) = dz_lake(c,j) * denice * lake_icefrac(c,j) + lake_heat_ice(c) = lake_heat_ice(c) + & + TempToHeat(temp=t_lake(c,j), cv = (h2olak_ice(c,j) * cpice)) + end do + end do + + ! add ice heat and liquid heat together (look at this part) + do fc = 1, num_c + c = filter_c(fc) + heat_liquid(c) = heat_liquid(c) + lake_heat_liquid(c) + heat(c) = heat(c) + lake_heat_ice(c) + & + lake_heat_liquid(c) + lake_latent_heat_liquid(c) + end do + + end associate + + end subroutine AccumulateHeatLake + !----------------------------------------------------------------------- subroutine AdjustDeltaHeatForDeltaLiq(bounds, delta_liq, & liquid_water_temp1, liquid_water_temp2, & diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index 95deb10dd8..b30969689f 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -20,13 +20,13 @@ module dynConsBiogeophysMod use WaterFluxType , only : waterflux_type use WaterStateBulkType , only : waterstatebulk_type use WaterStateType , only : waterstate_type - use LakestateType , only : lakestate_type + use LakestateType , only : lakestate_type use WaterDiagnosticType , only : waterdiagnostic_type use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use WaterBalanceType , only : waterbalance_type use WaterType , only : water_type - use TotalWaterAndHeatMod , only : AccumulateSoilLiqIceMassNonLake - use TotalWaterAndHeatMod , only : AccumulateSoilHeatNonLake + use TotalWaterAndHeatMod , only : AccumulateSoilLiqIceMassNonLake, AccumulateLiqIceMassLake + use TotalWaterAndHeatMod , only : AccumulateSoilHeatNonLake, AccumulateHeatLake use TotalWaterAndHeatMod , only : ComputeLiqIceMassNonLake, ComputeLiqIceMassLake use TotalWaterAndHeatMod , only : ComputeHeatNonLake, ComputeHeatLake use TotalWaterAndHeatMod , only : AdjustDeltaHeatForDeltaLiq @@ -65,7 +65,8 @@ module dynConsBiogeophysMod !----------------------------------------------------------------------- subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & - urbanparams_inst, soilstate_inst, water_inst, temperature_inst) + num_lakec, filter_lakec, & + urbanparams_inst, soilstate_inst, lakestate_inst, water_inst, temperature_inst) ! ! !DESCRIPTION: ! Set start-of-run baseline values for heat and water content in some columns. @@ -94,9 +95,13 @@ subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & ! appropriate baseline value for that point. integer, intent(in) :: num_icemecc ! number of points in filter_icemecc integer, intent(in) :: filter_icemecc(:) ! filter for icemec (i.e., glacier) columns + integer, intent(in) :: num_lakec ! number of points in filter_lakec + integer, intent(in) :: filter_lakec(:) ! filter for lake columns + type(urbanparams_type), intent(in) :: urbanparams_inst type(soilstate_type), intent(in) :: soilstate_inst + type(lakestate_type), intent(in) :: lakestate_inst type(water_type), intent(inout) :: water_inst type(temperature_type), intent(inout) :: temperature_inst ! @@ -119,22 +124,23 @@ subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & associate(bulk_or_tracer => water_inst%bulk_and_tracers(i)) call dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & - num_icemecc, filter_icemecc, & - bulk_or_tracer%waterstate_inst) + num_icemecc, filter_icemecc, num_lakec, filter_lakec, & + bulk_or_tracer%waterstate_inst, lakestate_inst) end associate end do - + call dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & - num_icemecc, filter_icemecc, & - urbanparams_inst, soilstate_inst, water_inst%waterstatebulk_inst, & + num_icemecc, filter_icemecc, num_lakec, filter_lakec, & + urbanparams_inst, soilstate_inst, lakestate_inst, water_inst%waterstatebulk_inst, & temperature_inst) + end subroutine dyn_hwcontent_set_baselines !----------------------------------------------------------------------- subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & - num_icemecc, filter_icemecc, & - waterstate_inst) + num_icemecc, filter_icemecc, num_lakec, filter_lakec, & + waterstate_inst, lakestate_inst) ! ! !DESCRIPTION: ! Set start-of-run baseline values for water content, for a single water tracer or @@ -147,13 +153,19 @@ subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & ! The following filter should include inactive as well as active points integer, intent(in) :: num_icemecc ! number of points in filter_icemecc integer, intent(in) :: filter_icemecc(:) ! filter for icemec (i.e., glacier) columns + integer, intent(in) :: num_lakec ! number of points in filter_lakec + integer, intent(in) :: filter_lakec(:) ! filter for lake columns + type(lakestate_type), intent(in) :: lakestate_inst class(waterstate_type), intent(inout) :: waterstate_inst ! ! !LOCAL VARIABLES: + integer :: c, fc ! indices real(r8) :: soil_liquid_mass_col(bounds%begc:bounds%endc) real(r8) :: soil_ice_mass_col(bounds%begc:bounds%endc) - + real(r8) :: lake_liquid_mass_col(bounds%begc:bounds%endc) + real(r8) :: lake_ice_mass_col(bounds%begc:bounds%endc) + character(len=*), parameter :: subname = 'dyn_water_content_set_baselines' !----------------------------------------------------------------------- @@ -164,7 +176,10 @@ subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & soil_liquid_mass_col(bounds%begc:bounds%endc) = 0._r8 soil_ice_mass_col (bounds%begc:bounds%endc) = 0._r8 - + lake_liquid_mass_col(bounds%begc:bounds%endc) = 0._r8 + lake_ice_mass_col (bounds%begc:bounds%endc) = 0._r8 + + call AccumulateSoilLiqIceMassNonLake(bounds, & natveg_and_glc_filterc%num, natveg_and_glc_filterc%indices, & waterstate_inst, & @@ -184,15 +199,31 @@ subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & call set_glacier_baselines(bounds, num_icemecc, filter_icemecc, & vals_col = soil_ice_mass_col(bounds%begc:bounds%endc), & baselines_col = dynbal_baseline_ice(bounds%begc:bounds%endc)) - + + + ! set baselines for lake columns + + ! Calculate the total water volume of the lake column + call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, lakestate_inst, & + liquid_mass = lake_liquid_mass_col(bounds%begc:bounds%endc), & + ice_mass = lake_ice_mass_col(bounds%begc:bounds%endc)) + + do fc = 1, num_lakec + c = filter_lakec(fc) + + dynbal_baseline_liq(c) = lake_liquid_mass_col(c) + dynbal_baseline_ice(c) = lake_ice_mass_col(c) + + end do + end associate end subroutine dyn_water_content_set_baselines !----------------------------------------------------------------------- subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & - num_icemecc, filter_icemecc, & - urbanparams_inst, soilstate_inst, waterstatebulk_inst, & + num_icemecc, filter_icemecc, num_lakec, filter_lakec, & + urbanparams_inst, soilstate_inst, lakestate_inst, waterstatebulk_inst, & temperature_inst) ! ! !DESCRIPTION: @@ -203,18 +234,25 @@ subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & type(filter_col_type), intent(in) :: natveg_and_glc_filterc ! filter for natural veg and glacier columns ! The following filter should include inactive as well as active points - integer, intent(in) :: num_icemecc ! number of points in filter_icemecc + integer, intent(in) :: num_icemecc ! number of points in filter_icemecc integer, intent(in) :: filter_icemecc(:) ! filter for icemec (i.e., glacier) columns + integer, intent(in) :: num_lakec ! number of points in filter_lakec + integer, intent(in) :: filter_lakec(:) ! filter for lake columns - type(urbanparams_type), intent(in) :: urbanparams_inst - type(soilstate_type), intent(in) :: soilstate_inst + type(urbanparams_type), intent(in) :: urbanparams_inst + type(soilstate_type) , intent(in) :: soilstate_inst + type(lakestate_type) , intent(in) :: lakestate_inst type(waterstatebulk_type), intent(in) :: waterstatebulk_inst type(temperature_type), intent(inout) :: temperature_inst ! ! !LOCAL VARIABLES: - real(r8) :: soil_heat_col(bounds%begc:bounds%endc) ! soil heat content [J/m^2] - real(r8) :: soil_heat_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface - real(r8) :: soil_cv_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface + integer :: c, fc ! indices + real(r8) :: soil_heat_col(bounds%begc:bounds%endc) ! soil heat content [J/m^2] + real(r8) :: soil_heat_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface + real(r8) :: soil_cv_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface + real(r8) :: lake_heat_col(bounds%begc:bounds%endc) ! lake heat content [J/m^2] + real(r8) :: lake_heat_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface + real(r8) :: lake_cv_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface character(len=*), parameter :: subname = 'dyn_heat_content_set_baselines' !----------------------------------------------------------------------- @@ -227,12 +265,17 @@ subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & soil_heat_liquid_col(bounds%begc:bounds%endc) = 0._r8 soil_cv_liquid_col(bounds%begc:bounds%endc) = 0._r8 + lake_heat_col(bounds%begc:bounds%endc) = 0._r8 + lake_heat_liquid_col(bounds%begc:bounds%endc) = 0._r8 + lake_cv_liquid_col(bounds%begc:bounds%endc) = 0._r8 + call AccumulateSoilHeatNonLake(bounds, & natveg_and_glc_filterc%num, natveg_and_glc_filterc%indices, & urbanparams_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, & heat = soil_heat_col(bounds%begc:bounds%endc), & heat_liquid = soil_heat_liquid_col(bounds%begc:bounds%endc), & cv_liquid = soil_cv_liquid_col(bounds%begc:bounds%endc)) + ! See comments in dyn_water_content_set_baselines for rationale for these glacier ! baselines. Even though the heat in glacier ice can interact with the rest of the @@ -251,7 +294,20 @@ subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & call set_glacier_baselines(bounds, num_icemecc, filter_icemecc, & vals_col = soil_heat_col(bounds%begc:bounds%endc), & baselines_col = dynbal_baseline_heat(bounds%begc:bounds%endc)) - + + + ! Set baselines for lake columns + call AccumulateHeatLake(bounds, num_lakec, filter_lakec, & + temperature_inst, lakestate_inst, & + heat = lake_heat_col, heat_liquid = lake_heat_liquid_col, cv_liquid = lake_cv_liquid_col) + + do fc = 1, num_lakec + c = filter_lakec(fc) + + dynbal_baseline_heat(c) = lake_heat_col(c) + + end do + end associate end subroutine dyn_heat_content_set_baselines diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index c82598d444..69bbb388a8 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -148,6 +148,8 @@ subroutine dynSubgrid_init(bounds_proc, glc_behavior, crop_inst) if (get_do_transient_lakes()) then call dynlake_interp(bounds_proc) end if + + ! (We don't bother calling dynHarvest_interp, because the harvest information isn't ! needed until the run loop. Harvest has nothing to do with subgrid weights, and in ! some respects doesn't even really belong in this module at all.) From 079e5c47f1d68ba97fca8298ba496cc57b9750cf Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Fri, 20 Sep 2019 08:01:45 -0600 Subject: [PATCH 1324/1973] Removed heat_liquid and cv_liquid calculation for lakes --still to add comments to code! --- src/biogeophys/TotalWaterAndHeatMod.F90 | 17 ++++++++--------- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 10 +++------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 60af2a901e..5b5a7318ee 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -976,7 +976,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & ! Lake water heat content call AccumulateHeatLake(bounds, num_lakec, filter_lakec, temperature_inst, lakestate_inst, & - heat, heat_liquid, cv_liquid) + heat) ! Subtract baselines set in initialization ! @@ -1003,12 +1003,14 @@ end subroutine ComputeHeatLake !----------------------------------------------------------------------- subroutine AccumulateHeatLake(bounds, num_c, filter_c, & temperature_inst, lakestate_inst, & - heat, heat_liquid, cv_liquid) + heat) ! ! !DESCRIPTION: ! Accumulate heat of lake water in lake columns. ! ! Adds to any existing values in heat, heat_liquid and cv_liquid. + ! HERE EXPLANATIONS about not adding heat_liquid and cv_liquid should come. + ! where this routine differs from AccumulateLiqIceMassLake !! ! ! Note: Changes to this routine should generally be accompanied by similar changes to ! AccumulateLiqIceMassLake @@ -1020,9 +1022,7 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & type(temperature_type) , intent(in) :: temperature_inst type(lakestate_type) , intent(in) :: lakestate_inst real(r8) , intent(inout) :: heat( bounds%begc: ) ! accumulated heat content [J/m^2] - real(r8) , intent(inout) :: heat_liquid( bounds%begc: ) ! accumulated heat content: liquid water, excluding latent heat [J/m^2] - real(r8) , intent(inout) :: cv_liquid( bounds%begc: ) ! accumulated liquid water heat capacity [J/(m^2 K)] - ! + ! !LOCAL VARIABLES: integer :: fc integer :: l, c, j @@ -1031,14 +1031,12 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & real(r8) :: lake_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: liquid water in lake, excluding latent heat [J/m^2] real(r8) :: lake_heat_ice(bounds%begc:bounds%endc) ! sum of heat content: ice in lake [J/m^2] real(r8) :: lake_latent_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: latent heat of liquid water in lake [J/m^2] - + real(r8) :: cv_liquid( bounds%begc:bounds%endc ) ! dummy argument to use AccumulateLiquidWaterHeat - not used character(len=*), parameter :: subname = 'AccumulateHeatLake' !----------------------------------------------------------------------- SHR_ASSERT_ALL((ubound(heat) == [bounds%endc]), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(heat_liquid) == [bounds%endc]), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cv_liquid) == [bounds%endc]), errMsg(sourcefile, __LINE__)) associate( & dz_lake => col%dz_lake, & ! lake layer depth (m) @@ -1077,7 +1075,6 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & ! add ice heat and liquid heat together (look at this part) do fc = 1, num_c c = filter_c(fc) - heat_liquid(c) = heat_liquid(c) + lake_heat_liquid(c) heat(c) = heat(c) + lake_heat_ice(c) + & lake_heat_liquid(c) + lake_latent_heat_liquid(c) end do @@ -1116,6 +1113,8 @@ subroutine AdjustDeltaHeatForDeltaLiq(bounds, delta_liq, & ! liquid and ice runoff in CLM, then this routine should be reworked to use the true ! heat contents of both liquid and ice runoff. ! + ! ADD HERE NOTES ABOUT LAKES!!! lake water not accounted. because baselines + ! ! Sign convention: delta_liq and delta_heat are positive if the post-landcover change ! value is greater than the pre-landcover change value. ! diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index b30969689f..e14dcc1d17 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -251,9 +251,7 @@ subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & real(r8) :: soil_heat_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface real(r8) :: soil_cv_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface real(r8) :: lake_heat_col(bounds%begc:bounds%endc) ! lake heat content [J/m^2] - real(r8) :: lake_heat_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface - real(r8) :: lake_cv_liquid_col(bounds%begc:bounds%endc) ! unused; just needed for AccumulateSoilHeatNonLake interface - + character(len=*), parameter :: subname = 'dyn_heat_content_set_baselines' !----------------------------------------------------------------------- @@ -266,9 +264,7 @@ subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & soil_cv_liquid_col(bounds%begc:bounds%endc) = 0._r8 lake_heat_col(bounds%begc:bounds%endc) = 0._r8 - lake_heat_liquid_col(bounds%begc:bounds%endc) = 0._r8 - lake_cv_liquid_col(bounds%begc:bounds%endc) = 0._r8 - + call AccumulateSoilHeatNonLake(bounds, & natveg_and_glc_filterc%num, natveg_and_glc_filterc%indices, & urbanparams_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, & @@ -299,7 +295,7 @@ subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & ! Set baselines for lake columns call AccumulateHeatLake(bounds, num_lakec, filter_lakec, & temperature_inst, lakestate_inst, & - heat = lake_heat_col, heat_liquid = lake_heat_liquid_col, cv_liquid = lake_cv_liquid_col) + heat = lake_heat_col) do fc = 1, num_lakec c = filter_lakec(fc) From 5dd892502b0ed3e24ae19568c140dbfb5897c220 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Fri, 20 Sep 2019 12:13:07 -0600 Subject: [PATCH 1325/1973] Added description for AccumulateLakeHeat --- src/biogeophys/TotalWaterAndHeatMod.F90 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 5b5a7318ee..47b0a561d2 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -980,6 +980,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & ! Subtract baselines set in initialization ! + ! ! NOTE(wjs, 2019-03-01) I haven't given enough thought to how (if at all) we should ! correct for heat_liquid and cv_liquid, which are used to determine the weighted ! average liquid water temperature. For example, if we're subtracting out a baseline @@ -1008,13 +1009,21 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & ! !DESCRIPTION: ! Accumulate heat of lake water in lake columns. ! - ! Adds to any existing values in heat, heat_liquid and cv_liquid. - ! HERE EXPLANATIONS about not adding heat_liquid and cv_liquid should come. - ! where this routine differs from AccumulateLiqIceMassLake !! - ! - ! Note: Changes to this routine should generally be accompanied by similar changes to - ! AccumulateLiqIceMassLake - ! + ! This module differs from AccumulateSoilHeatNonLake in the sense that for lake heat + ! the average heat_liquid and cv_liquid are not calculated. This because the + ! lake water is virtual (there will never by a change in lake water content) + ! and thus it should not be taken into the average column temperature when adjusting the change in + ! heat content of the grid cell for the change in water content. + ! Now, for lake grid cells, this is only done for the water content of the + ! soil under the lake and the snow on the lake. + ! + ! Some minor concerns with this approach: + ! In a rare case, lake water can have some changes in water content in time, + ! when experiencing phase changes: If a lake was completely liquid in initialization, + ! but then partially froze and then grew / shrank, some dynbal fluxes would be generated: + ! equal and opposite dynbal liquid and ice terms. In this case, it would be appropriate to + ! take the lake temperature along in determining the total heat which is corrected for delta liq. + ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_c ! number of column points in column filter (should not include lake points; can be a subset of the no-lake filter) From 27d982ed1695182697eec43aacddd9abcf4e3c48 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Thu, 3 Oct 2019 03:49:20 -0600 Subject: [PATCH 1326/1973] Updated comments to apply to lakes and removed redundant file --- src/dyn_subgrid/dynlakeFileMod.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dyn_subgrid/dynlakeFileMod.F90 b/src/dyn_subgrid/dynlakeFileMod.F90 index f3179b1f55..88f2176510 100644 --- a/src/dyn_subgrid/dynlakeFileMod.F90 +++ b/src/dyn_subgrid/dynlakeFileMod.F90 @@ -82,8 +82,8 @@ subroutine dynlake_init(bounds, dynlake_filename) ! read data PCT_LAKE ! - ! Note: if you want to change transient crops so that they are interpolated, rather - ! than jumping to each year's value on Jan 1 of that year, simply change wtcrop and + ! Note: if you want to change transient lakes so that they are interpolated, rather + ! than jumping to each year's value on Jan 1 of that year, simply change wtlake and ! to be of type dyn_var_time_interp_type (rather than ! dyn_var_time_uninterp_type), and change the following constructors to construct ! variables of dyn_var_time_interp_type. That's all you need to do. @@ -103,11 +103,11 @@ subroutine dynlake_interp(bounds) ! !DESCRIPTION: ! Get lake cover for model time, when needed. ! - ! Sets col%wtlunit and lun%wtgcell for crop landunits. + ! Sets col%wtlunit and lun%wtgcell for lake landunits. ! - ! Note that crop cover currently jumps to its new value at the start of the year. + ! Note that lake cover currently jumps to its new value at the start of the year. ! However, as mentioned above, this behavior can be changed to time interpolation - ! simply by making wtcrop and wtcft dyn_var_time_interp_type variables rather than + ! simply by making wtlake and wtcft dyn_var_time_interp_type variables rather than ! dyn_var_time_uninterp_type. ! ! !USES: @@ -141,4 +141,4 @@ subroutine dynlake_interp(bounds) end subroutine dynlake_interp -end module dynlakeFileMod \ No newline at end of file +end module dynlakeFileMod From 69a655360ccafbbbbf23d680aad6a90cb6d889a0 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Thu, 3 Oct 2019 06:06:21 -0600 Subject: [PATCH 1327/1973] Updated comments in AccumulateHeatLake and some little fixes --- src/biogeophys/TotalWaterAndHeatMod.F90 | 56 ++++++++++++++---------- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 1 - src/dyn_subgrid/dynSubgridControlMod.F90 | 10 +---- src/dyn_subgrid/dynlakeFileMod.F90 | 2 +- 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 47b0a561d2..27d3d96a03 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -486,7 +486,7 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & ! Adds to any existing values in liquid_mass and ice_mass. ! ! Note: Changes to this routine should generally be accompanied by similar changes to - ! AccumulateSoilHeatLake + ! AccumulateHeatLake ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -497,9 +497,9 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! accumulated ice mass (kg m-2) ! ! !LOCAL VARIABLES: - integer :: c, j, fc ! indices - real(r8) :: h2olak_liq(bounds%begc:bounds%endc,1:nlevlak) ! liquid water content of lake layer [kg/m²] - real(r8) :: h2olak_ice(bounds%begc:bounds%endc,1:nlevlak) ! ice water content of lake layer [kg/m²] + integer :: c, j, fc ! indices + real(r8) :: h2olak_liq ! liquid water content of lake layer [kg/m²] + real(r8) :: h2olak_ice ! ice water content of lake layer [kg/m²] character(len=*), parameter :: subname = 'AccumulateLiqIceMassLake' !----------------------------------------------------------------------- @@ -517,11 +517,11 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & do fc = 1, num_c c = filter_c(fc) ! calculate lake liq and ice content per lake layer first - h2olak_liq(c,j) = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) - h2olak_ice(c,j) = dz_lake(c,j) * denice * lake_icefrac(c,j) + h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) + h2olak_ice = dz_lake(c,j) * denice * lake_icefrac(c,j) - liquid_mass(c) = liquid_mass(c) + h2olak_liq(c,j) - ice_mass(c) = ice_mass(c) + h2olak_ice(c,j) + liquid_mass(c) = liquid_mass(c) + h2olak_liq + ice_mass(c) = ice_mass(c) + h2olak_ice end do end do @@ -726,6 +726,11 @@ subroutine ComputeHeatNonLake(bounds, num_nolakec, filter_nolakec, & ! trying to account for the temperature of these baselines at all. This amounts to ! assuming that the baselines that we add / subtract are at the average temperature ! of the real liquid water in the column. + + ! This is different for lakes: there the virtual lake water's temperature is excluded + ! to avoid having it dominating the average temperature calculation + ! see note at top of the AccumulateHeatLake subroutine. + do fc = 1, num_nolakec c = filter_nolakec(fc) heat(c) = heat(c) - dynbal_baseline_heat(c) @@ -975,6 +980,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & end do ! Lake water heat content + ! Note that we do NOT accumulate heat_liquid and cv_liquid in this call. See the comments at the top of AccumulateHeatLake for rationale. call AccumulateHeatLake(bounds, num_lakec, filter_lakec, temperature_inst, lakestate_inst, & heat) @@ -1009,16 +1015,24 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & ! !DESCRIPTION: ! Accumulate heat of lake water in lake columns. ! - ! This module differs from AccumulateSoilHeatNonLake in the sense that for lake heat - ! the average heat_liquid and cv_liquid are not calculated. This because the - ! lake water is virtual (there will never by a change in lake water content) - ! and thus it should not be taken into the average column temperature when adjusting the change in + ! This subroutine differs from AccumulateSoilHeatNonLake in the sense that for lake heat + ! the average heat_liquid and cv_liquid are not accumulated. This is because these + ! terms are currently only used to calculate the implicit temperature of the dynbal liquid flux. + ! Because the lake water is virtual (there will never be a change in lake water content, + ! it should not be taken into the average column temperature when adjusting the change in ! heat content of the grid cell for the change in water content. ! Now, for lake grid cells, this is only done for the water content of the - ! soil under the lake and the snow on the lake. + ! soil under the lake and the snow on the lake. Since the virtual lake water doesn't generally + ! contribute to the dynbal liquid flux, its temperature shouldn't contribute + ! to the implicit temperature of the dynbal liquid flux. (If we allowed it + ! to contribute, the lake's temperature could dominate the average temperature calculation, + ! since there is so much lake water relative to other water in the grid cell.) + ! + ! We are adopting a different approach in the lake and non-lake columns. + ! For the choices made in a non-lake column, see comment at bottom of ComputeHeatNonLake subroutine ! ! Some minor concerns with this approach: - ! In a rare case, lake water can have some changes in water content in time, + ! In some cases, lake water can have some changes in water content in time, ! when experiencing phase changes: If a lake was completely liquid in initialization, ! but then partially froze and then grew / shrank, some dynbal fluxes would be generated: ! equal and opposite dynbal liquid and ice terms. In this case, it would be appropriate to @@ -1035,12 +1049,11 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & ! !LOCAL VARIABLES: integer :: fc integer :: l, c, j - real(r8) :: h2olak_liq(bounds%begc:bounds%endc,1:nlevlak) ! liquid water content of lake layer [kg/m²] - real(r8) :: h2olak_ice(bounds%begc:bounds%endc,1:nlevlak) ! ice water content of lake layer [kg/m²] + real(r8) :: h2olak_liq ! liquid water content of lake layer [kg/m²] + real(r8) :: h2olak_ice ! ice water content of lake layer [kg/m²] real(r8) :: lake_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: liquid water in lake, excluding latent heat [J/m^2] real(r8) :: lake_heat_ice(bounds%begc:bounds%endc) ! sum of heat content: ice in lake [J/m^2] real(r8) :: lake_latent_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: latent heat of liquid water in lake [J/m^2] - real(r8) :: cv_liquid( bounds%begc:bounds%endc ) ! dummy argument to use AccumulateLiquidWaterHeat - not used character(len=*), parameter :: subname = 'AccumulateHeatLake' !----------------------------------------------------------------------- @@ -1067,17 +1080,16 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & do fc = 1, num_c c = filter_c(fc) ! liquid heat - h2olak_liq(c,j) = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) + h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) call AccumulateLiquidWaterHeat( & temp = t_lake(c,j), & - h2o = h2olak_liq(c,j), & - cv_liquid = cv_liquid(c), & + h2o = h2olak_liq, & heat_liquid = lake_heat_liquid(c), & latent_heat_liquid = lake_latent_heat_liquid(c)) ! ice heat - h2olak_ice(c,j) = dz_lake(c,j) * denice * lake_icefrac(c,j) + h2olak_ice = dz_lake(c,j) * denice * lake_icefrac(c,j) lake_heat_ice(c) = lake_heat_ice(c) + & - TempToHeat(temp=t_lake(c,j), cv = (h2olak_ice(c,j) * cpice)) + TempToHeat(temp=t_lake(c,j), cv = (h2olak_ice * cpice)) end do end do diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index e14dcc1d17..954092b3e9 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -705,7 +705,6 @@ subroutine dyn_heat_content(bounds, & real(r8) :: heat_col(bounds%begc:bounds%endc) ! sum of heat content for all columns [J/m^2] real(r8) :: heat_liquid_col(bounds%begc:bounds%endc) ! sum of heat content for all columns: liquid water, excluding latent heat [J/m^2] real(r8) :: cv_liquid_col(bounds%begc:bounds%endc) ! sum of liquid heat capacity for all columns [J/(m^2 K)] - real(r8) :: heat_lake_col(bounds%begc:bounds%endc) ! heat content of lake column [J/m^2] real(r8) :: heat_liquid_grc(bounds%begg:bounds%endg) ! heat_liquid_col averaged to grid cell [J/m^2] real(r8) :: cv_liquid_grc(bounds%begg:bounds%endg) ! cv_liquid_col averaged to grid cell [J/(m^2 K)] diff --git a/src/dyn_subgrid/dynSubgridControlMod.F90 b/src/dyn_subgrid/dynSubgridControlMod.F90 index 01ff35ab33..4cd78c7c1f 100644 --- a/src/dyn_subgrid/dynSubgridControlMod.F90 +++ b/src/dyn_subgrid/dynSubgridControlMod.F90 @@ -287,15 +287,7 @@ subroutine check_namelist_consistency write(iulog,*) 'ERROR: do_harvest currently does not work with use_fates' call endrun(msg=errMsg(sourcefile, __LINE__)) end if - end if - - if (dyn_subgrid_control_inst%do_transient_lakes) then - if (use_fates) then - write(iulog,*) 'ERROR: do_transient_lakes currently does not work with use_fates' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - + end if end subroutine check_namelist_consistency diff --git a/src/dyn_subgrid/dynlakeFileMod.F90 b/src/dyn_subgrid/dynlakeFileMod.F90 index 88f2176510..304c191a02 100644 --- a/src/dyn_subgrid/dynlakeFileMod.F90 +++ b/src/dyn_subgrid/dynlakeFileMod.F90 @@ -36,7 +36,7 @@ module dynlakeFileMod ! Names of variables on file character(len=*), parameter :: lake_varname = 'PCT_LAKE' - ! TO DO: account for lake depth? + character(len=*), parameter, private :: sourcefile = & __FILE__ From 7f8ef4191d0c34e806e0a5f8f0a419b684fbc4ff Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Mon, 16 Mar 2020 04:08:21 -0600 Subject: [PATCH 1328/1973] Finetune option to run without dynamical lakes --- src/dyn_subgrid/dynSubgridDriverMod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index 69bbb388a8..7edcec8f3b 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -129,8 +129,9 @@ subroutine dynSubgrid_init(bounds_proc, glc_behavior, crop_inst) ! Initialize stuff for prescribed transient lakes ! error if keyword argument like for dynamical land units above: dynlake_filename=get_flanduse_timeseries() - call dynlake_init(bounds_proc, dynlake_filename=get_flanduse_timeseries()) - + if (get_do_transient_lakes()) then + call dynlake_init(bounds_proc, dynlake_filename=get_flanduse_timeseries()) + end if ! ------------------------------------------------------------------------ ! Set initial subgrid weights for aspects that are read from file. This is relevant From ddfba1e3d4d9bd6b9edf09ed40bd793d05c311b7 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Wed, 8 Jul 2020 06:59:21 -0600 Subject: [PATCH 1329/1973] Update argument lists of subroutines --- src/biogeophys/BalanceCheckMod.F90 | 6 ++++-- src/biogeophys/TotalWaterAndHeatMod.F90 | 7 ++++--- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 7 ++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 65844b7299..5375880f5c 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -152,6 +152,7 @@ subroutine BeginWaterBalance(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & soilhydrology_inst, & + lakestate_inst, & water_inst%bulk_and_tracers(i)%waterstate_inst, & water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & water_inst%bulk_and_tracers(i)%waterbalance_inst, & @@ -163,8 +164,8 @@ end subroutine BeginWaterBalance !----------------------------------------------------------------------- subroutine BeginWaterBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - soilhydrology_inst, waterstate_inst, waterdiagnostic_inst, waterbalance_inst, & - use_aquifer_layer) + soilhydrology_inst, lakestate_inst, waterstate_inst, & + waterdiagnostic_inst, waterbalance_inst, & use_aquifer_layer) ! ! !DESCRIPTION: ! Initialize column-level water balance at beginning of time step, for bulk or a @@ -177,6 +178,7 @@ subroutine BeginWaterBalanceSingle(bounds, & integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(soilhydrology_type) , intent(in) :: soilhydrology_inst + type(lakestate_type) , intent(in) :: lakestate_inst class(waterstate_type) , intent(inout) :: waterstate_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst class(waterbalance_type) , intent(inout) :: waterbalance_inst diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 27d3d96a03..e817cb6511 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -504,8 +504,8 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & character(len=*), parameter :: subname = 'AccumulateLiqIceMassLake' !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(liquid_mass) == [bounds%endc]), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ice_mass) == [bounds%endc]), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL_FL((ubound(liquid_mass) == (/bounds%endc/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(ice_mass) == (/bounds%endc/)), sourcefile, __LINE__) associate( & lake_icefrac => lakestate_inst%lake_icefrac_col, & ! Input: [real(r8) (:,:) ] lake ice fraction @@ -1058,7 +1058,8 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & character(len=*), parameter :: subname = 'AccumulateHeatLake' !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(heat) == [bounds%endc]), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL_FL((ubound(heat) == (/bounds%endc/)), sourcefile, __LINE__) + associate( & dz_lake => col%dz_lake, & ! lake layer depth (m) diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index 954092b3e9..9947203a3f 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -541,7 +541,7 @@ subroutine dyn_water_content_final(bounds, & num_lakec, filter_lakec, & waterstate_inst, waterdiagnostic_inst, & waterbalance_inst, waterflux_inst, & - delta_liq) + lakestate_inst, delta_liq) ! ! !DESCRIPTION: ! Compute grid cell-level water content and dynbal fluxes after landcover change, for @@ -557,6 +557,7 @@ subroutine dyn_water_content_final(bounds, & class(waterdiagnostic_type) , intent(in) :: waterdiagnostic_inst class(waterbalance_type) , intent(inout) :: waterbalance_inst class(waterflux_type) , intent(inout) :: waterflux_inst + type(lakestate_type) , intent(in) :: lakestate_inst real(r8) , intent(out) :: delta_liq(bounds%begg:) ! change in gridcell h2o liq content ! ! !LOCAL VARIABLES: @@ -575,7 +576,7 @@ subroutine dyn_water_content_final(bounds, & call dyn_water_content(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & - waterstate_inst, waterdiagnostic_inst, & + waterstate_inst, waterdiagnostic_inst, lakestate_inst, & liquid_mass = waterbalance_inst%liq2_grc(bounds%begg:bounds%endg), & ice_mass = waterbalance_inst%ice2_grc(bounds%begg:bounds%endg)) @@ -623,7 +624,7 @@ subroutine dyn_water_content(bounds, & integer , intent(in) :: filter_lakec(:) class(waterstate_type) , intent(in) :: waterstate_inst class(waterdiagnostic_type) , intent(in) :: waterdiagnostic_inst - type(lakestate_type) , intent(in) :: lakestate_inst + type(lakestate_type) , intent(in) :: lakestate_inst real(r8) , intent(out) :: liquid_mass( bounds%begg: ) ! kg m-2 real(r8) , intent(out) :: ice_mass( bounds%begg: ) ! kg m-2 ! From 83484a9e7d15a8b4cf02a734775f523d709b0f78 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 16 Jul 2020 19:54:01 -0600 Subject: [PATCH 1330/1973] Add line break to fix compilation error --- src/biogeophys/BalanceCheckMod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 5375880f5c..65f102a548 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -165,7 +165,8 @@ end subroutine BeginWaterBalance subroutine BeginWaterBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & soilhydrology_inst, lakestate_inst, waterstate_inst, & - waterdiagnostic_inst, waterbalance_inst, & use_aquifer_layer) + waterdiagnostic_inst, waterbalance_inst, & + use_aquifer_layer) ! ! !DESCRIPTION: ! Initialize column-level water balance at beginning of time step, for bulk or a From 124c55262f72515b272a07df4ed3556b9078391e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 22 Jul 2020 06:11:45 -0600 Subject: [PATCH 1331/1973] Fix data type of haslake variable This is a double precision variable on the file, so I'm making it double precision in the code. I think ncdio_pio used to handle data type conversions like this, but now it seems to be corrupting memory: the original code led to errors in decompInitMod, due to what appears to be corruption in some unrelated variable. --- src/main/surfrdMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index f73265cd92..af092daa6b 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -995,7 +995,7 @@ subroutine surfrd_lakemask(begg, endg, ncid) ! ! !LOCAL VARIABLES: logical :: readvar - integer ,pointer :: haslake_id(:) + real(r8),pointer :: haslake_id(:) ! ! character(len=*), parameter :: subname = 'surfrd_lakemask' @@ -1009,7 +1009,7 @@ subroutine surfrd_lakemask(begg, endg, ncid) dim1name=grlnd, readvar=readvar) if (.not. readvar) call endrun( msg=' ERROR: HASLAKE is not on landuse.timeseries file'//errMsg(sourcefile, __LINE__)) - where (haslake_id == 1.) + where (haslake_id == 1._r8) haslake = .true. elsewhere haslake = .false. From f9f87b61b35ac7e74cef51d2508ed080fe9148f0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Aug 2020 14:25:22 -0600 Subject: [PATCH 1332/1973] Add new runtime consistency checks for do_transient_lakes I'm treating do_transient_lakes similar to do_transient_pfts and do_transient_crops in this respect. I'm not sure if all of these checks are truly important for transient lakes (in particular, my guess is that collapse_urban could probably be done with transient lakes - as well as transient pfts and transient crops for that matter), but some of the checks probably are needed, and it seems best to keep transient lakes consistent with other transient areas in this respect. --- src/dyn_subgrid/dynSubgridControlMod.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dyn_subgrid/dynSubgridControlMod.F90 b/src/dyn_subgrid/dynSubgridControlMod.F90 index 4cd78c7c1f..a2ee0ef17d 100644 --- a/src/dyn_subgrid/dynSubgridControlMod.F90 +++ b/src/dyn_subgrid/dynSubgridControlMod.F90 @@ -248,9 +248,11 @@ subroutine check_namelist_consistency end if end if - if (dyn_subgrid_control_inst%do_transient_pfts .or. dyn_subgrid_control_inst%do_transient_crops) then + if (dyn_subgrid_control_inst%do_transient_pfts .or. & + dyn_subgrid_control_inst%do_transient_crops .or. & + dyn_subgrid_control_inst%do_transient_lakes) then if (collapse_urban) then - write(iulog,*) 'ERROR: do_transient_pfts and do_transient_crops are & + write(iulog,*) 'ERROR: do_transient_pfts, do_transient_crops and do_transient_lakes are & incompatible with collapse_urban = .true.' call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -258,7 +260,7 @@ subroutine check_namelist_consistency .or. toosmall_soil > 0._r8 .or. toosmall_crop > 0._r8 & .or. toosmall_glacier > 0._r8 .or. toosmall_lake > 0._r8 & .or. toosmall_wetland > 0._r8 .or. toosmall_urban > 0._r8) then - write(iulog,*) 'ERROR: do_transient_pfts and do_transient_crops are & + write(iulog,*) 'ERROR: do_transient_pfts, do_transient_crops and do_transient_lakes are & incompatible with any of the following set to > 0: & n_dom_pfts > 0, n_dom_landunits > 0, & toosmall_soil > 0._r8, toosmall_crop > 0._r8, & From e18234149300c7051b027d6e110352a4ecf52971 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Aug 2020 14:45:54 -0600 Subject: [PATCH 1333/1973] do_transient_lakes in namelist: set default value and do error checks The new function setup_logic_do_transient_lakes is based on setup_logic_do_transient_crops. As with my previous commit: I'm not sure if all of these checks are truly important for transient lakes (in particular, my guess is that collapse_urban could probably be done with transient lakes - as well as transient pfts and transient crops for that matter), but some of the checks probably are needed, and it seems best to keep transient lakes consistent with other transient areas in this respect. --- bld/CLMBuildNamelist.pm | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 4ee6a65eda..de106915ec 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2372,6 +2372,7 @@ sub setup_logic_dynamic_subgrid { setup_logic_do_transient_pfts($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_do_transient_crops($opts, $nl_flags, $definition, $defaults, $nl); + setup_logic_do_transient_lakes($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_do_harvest($opts, $nl_flags, $definition, $defaults, $nl); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_dynbal_baselines'); @@ -2537,6 +2538,74 @@ sub setup_logic_do_transient_crops { } } +sub setup_logic_do_transient_lakes { + # + # Set do_transient_lakes default value, and perform error checking on do_transient_lakes + # + # Assumes the following are already set in the namelist (although it's okay + # for them to be unset if that will be their final state): + # - flanduse_timeseries + # + my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + + my $var = 'do_transient_lakes'; + + # Start by assuming a default value of '.true.'. Then check a number of + # conditions under which do_transient_lakes cannot be true. Under these + # conditions: (1) set default value to '.false.'; (2) make sure that the + # value is indeed false (e.g., that the user didn't try to set it to true). + + my $default_val = ".true."; + + # cannot_be_true will be set to a non-empty string in any case where + # do_transient_lakes should not be true; if it turns out that + # do_transient_lakes IS true in any of these cases, a fatal error will be + # generated + my $cannot_be_true = ""; + + my $n_dom_pfts = $nl->get_value( 'n_dom_pfts' ); + my $n_dom_landunits = $nl->get_value( 'n_dom_landunits' ); + my $toosmall_soil = $nl->get_value( 'toosmall_soil' ); + my $toosmall_crop = $nl->get_value( 'toosmall_crop' ); + my $toosmall_glacier = $nl->get_value( 'toosmall_glacier' ); + my $toosmall_lake = $nl->get_value( 'toosmall_lake' ); + my $toosmall_wetland = $nl->get_value( 'toosmall_wetland' ); + my $toosmall_urban = $nl->get_value( 'toosmall_urban' ); + + if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { + $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; + } + + if ($cannot_be_true) { + $default_val = ".false."; + } + + if (!$cannot_be_true) { + # Note that, if the variable cannot be true, we don't call add_default + # - so that we don't clutter up the namelist with variables that don't + # matter for this case + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, val=>$default_val); + } + + # Make sure the value is false when it needs to be false - i.e., that the + # user hasn't tried to set a true value at an inappropriate time. + + if (&value_is_true($nl->get_value($var)) && $cannot_be_true) { + $log->fatal_error($cannot_be_true); + } + + # if do_transient_lakes is .true. and any of these (n_dom_* or toosmall_*) + # are > 0 or collapse_urban = .true., then give fatal error + if (&value_is_true($nl->get_value($var))) { + if (&value_is_true($nl->get_value('collapse_urban'))) { + $log->fatal_error("$var cannot be combined with collapse_urban"); + } + if ($n_dom_pfts > 0 || $n_dom_landunits > 0 || $toosmall_soil > 0 || $toosmall_crop > 0 || $toosmall_glacier > 0 || $toosmall_lake > 0 || $toosmall_wetland > 0 || $toosmall_urban > 0) { + $log->fatal_error("$var cannot be combined with any of the of the following > 0: n_dom_pfts > 0, n_dom_landunit > 0, toosmall_soil > 0._r8, toosmall_crop > 0._r8, toosmall_glacier > 0._r8, toosmall_lake > 0._r8, toosmall_wetland > 0._r8, toosmall_urban > 0._r8"); + } + } +} + sub setup_logic_do_harvest { # # Set do_harvest default value, and perform error checking on do_harvest From 5a64ed84bd9a9a777d4bbe848292e3eafd3ed36b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 12 Aug 2020 20:57:56 -0600 Subject: [PATCH 1334/1973] Get do_transient_lakes default from namelist_defaults I didn't see any reason why the default value should be set in the code rather than coming from namelist_defaults_ctsm.xml. Getting it from the latter will make it easier for the default value to differ with different physics versions. --- bld/CLMBuildNamelist.pm | 13 +------------ bld/namelist_files/namelist_defaults_ctsm.xml | 1 + 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index de106915ec..5d79b50ddd 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2550,13 +2550,6 @@ sub setup_logic_do_transient_lakes { my $var = 'do_transient_lakes'; - # Start by assuming a default value of '.true.'. Then check a number of - # conditions under which do_transient_lakes cannot be true. Under these - # conditions: (1) set default value to '.false.'; (2) make sure that the - # value is indeed false (e.g., that the user didn't try to set it to true). - - my $default_val = ".true."; - # cannot_be_true will be set to a non-empty string in any case where # do_transient_lakes should not be true; if it turns out that # do_transient_lakes IS true in any of these cases, a fatal error will be @@ -2576,15 +2569,11 @@ sub setup_logic_do_transient_lakes { $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; } - if ($cannot_be_true) { - $default_val = ".false."; - } - if (!$cannot_be_true) { # Note that, if the variable cannot be true, we don't call add_default # - so that we don't clutter up the namelist with variables that don't # matter for this case - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, val=>$default_val); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); } # Make sure the value is false when it needs to be false - i.e., that the diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index e9dae4e762..5918e30cee 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2965,6 +2965,7 @@ lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr18 +.false. .false. From cfcb2e58113af926302acde9d09075ceb1853abe Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 17 Aug 2020 15:23:32 -0600 Subject: [PATCH 1335/1973] FV3 high resolution grids were setup for fully coupled PE layouts, change them to more standard I compset type layouts on cheyenne, keeping them the same size --- cime_config/config_pes.xml | 124 ++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index efbaa063e8..ba8585f570 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -747,34 +747,34 @@ none - 1152 - 864 - 864 - 288 - 256 - 1152 - 32 - 1152 + -1 + -48 + -48 + -48 + -48 + -48 + -48 + -48 - 3 - 3 - 3 - 3 - 3 - 3 - 3 - 3 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 0 - 0 - 0 - 864 - 1152 - 0 - 1408 - 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 @@ -817,38 +817,38 @@ - + none - 1152 - 864 - 864 - 288 - 256 - 1152 - 32 - 1152 + -1 + -48 + -48 + -48 + -48 + -48 + -48 + -48 - 3 - 3 - 3 - 3 - 3 - 3 - 3 - 3 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 0 - 0 - 0 - 864 - 1152 - 0 - 1408 - 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 @@ -895,14 +895,14 @@ none - 3456 - 3456 - 3456 - 3456 - 3456 - 3456 - 3456 - 3456 + -1 + -96 + -96 + -96 + -96 + -96 + -96 + -96 1 @@ -916,13 +916,13 @@ 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 + -1 + -1 + -1 + -1 + -1 + -1 + -1 From 4cff6af143d8fc3a93c77ba02250604cd0b89ec9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 17 Aug 2020 15:25:54 -0600 Subject: [PATCH 1336/1973] Remove the x8 x4 ending for ARCTIC and ARTCICGRIS grids to make the match more general in case new grids are added later --- cime_config/config_pes.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index ba8585f570..d391f2b9d1 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -483,7 +483,7 @@ - + none @@ -520,7 +520,7 @@ - + none @@ -557,7 +557,7 @@ - + none @@ -594,7 +594,7 @@ - + none From 1e930be4f66c961a3e455c1060736af298e93115 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 17 Aug 2020 16:48:08 -0600 Subject: [PATCH 1337/1973] Change single point tests/compsets to run with stub ROF, add new compset with stub-ROF for I2000Clm50BgcCruGs IHistClm50BgcQianGs --- cime_config/config_compsets.xml | 38 +++++++++++++++++---------- cime_config/testdefs/testlist_clm.xml | 36 ++++++++++++------------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index dbcdf4a049..598aa7bb2e 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -154,8 +154,8 @@ particularly relevant for single-point cases (where datm dominates the runtime) --> - I2000Clm50BgcCropQianGs - 2000_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV + I2000Clm50BgcCropQianRsGs + 2000_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV I2000Clm50SpRtmFl @@ -194,8 +199,8 @@ - I2000Clm50FatesGs - 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV + I2000Clm50FatesRsGs + 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_SROF_SGLC_SWAV @@ -259,6 +264,11 @@ HIST_DATM%QIA_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV + + IHistClm50BgcQianRsGs + HIST_DATM%QIA_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV + + ISSP585Clm50BgcCrop @@ -306,14 +316,14 @@ particularly relevant for single-point cases (where datm dominates the runtime) --> - IHistClm50BgcCropQianGs - HIST_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV + IHistClm50BgcCropQianRsGs + HIST_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV - IHistClm50BgcCropGs - HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV + IHistClm50BgcCropRsGs + HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV @@ -326,8 +336,8 @@ faster datm throughput, which is particularly relevant for single-point cases (where datm dominates the runtime) --> - I2000Clm50BgcDvCropQianGs - 2000_DATM%QIA_CLM50%BGCDV-CROP_SICE_SOCN_MOSART_SGLC_SWAV + I2000Clm50BgcDvCropQianRsGs + 2000_DATM%QIA_CLM50%BGCDV-CROP_SICE_SOCN_SROF_SGLC_SWAV @@ -388,8 +398,8 @@ faster datm throughput, which is particularly relevant for single-point cases (where datm dominates the runtime) --> - IHistClm45BgcCropQianGs - HIST_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV + IHistClm45BgcCropQianRsGs + HIST_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV @@ -414,8 +424,8 @@ - I2000Clm45FatesGs - 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_RTM_SGLC_SWAV + I2000Clm45FatesRsGs + 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 735b0a9253..00f84ccd44 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -17,7 +17,7 @@ - + @@ -916,7 +916,7 @@ - + @@ -950,7 +950,7 @@ - + @@ -959,7 +959,7 @@ - + @@ -968,7 +968,7 @@ - + @@ -977,7 +977,7 @@ - + @@ -986,7 +986,7 @@ - + @@ -1005,7 +1005,7 @@ - + @@ -1023,7 +1023,7 @@ - + @@ -1049,7 +1049,7 @@ - + @@ -1382,7 +1382,7 @@ - + @@ -1566,7 +1566,7 @@ - + @@ -1575,7 +1575,7 @@ - + @@ -1664,7 +1664,7 @@ - + @@ -1681,7 +1681,7 @@ - + @@ -1931,7 +1931,7 @@ - + @@ -1998,7 +1998,7 @@ - + @@ -2038,7 +2038,7 @@ - + From 2e788711e15920ff7f502a781554f1690e735f03 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 18 Aug 2020 11:58:29 -0600 Subject: [PATCH 1338/1973] Use compset with stub ROF for 5x5_amazon tests as well --- cime_config/testdefs/testlist_clm.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 00f84ccd44..ad0bf6f6f9 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1618,7 +1618,7 @@ - + @@ -1627,7 +1627,7 @@ - + @@ -1673,7 +1673,7 @@ - + @@ -1691,7 +1691,7 @@ - + From 75345c5b21d803b2e851a764c2a213f672893f90 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 18 Aug 2020 13:01:57 -0600 Subject: [PATCH 1339/1973] Update externals for nuopc to ones in nuopc_dev branch --- Externals_cime.cfg | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 94b569d479..0e00152795 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,19 +1,12 @@ [cmeps] -hash = 9376b87 +hash = cab9030 protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ required = True -[fox] -hash = 0ed59c1 -protocol = git -repo_url = https://github.com/ESMCI/fox.git -local_path = src/externals/fox -required = True - [cdeps] -hash = 8e77759 +hash = cfc5345 protocol = git repo_url = https://github.com/ESCOMP/CDEPS.git local_path = src/components/cdeps From c1baf34c26f70adb8a936de768b716f587b4f930 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 18 Aug 2020 23:25:23 -0600 Subject: [PATCH 1340/1973] Add fox back in as it's currently required by this version of cime for the build --- Externals_cime.cfg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 0e00152795..90a80b92ea 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -5,6 +5,13 @@ repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ required = True +[fox] +hash = 0ed59c1 +protocol = git +repo_url = https://github.com/ESMCI/fox.git +local_path = src/externals/fox +required = True + [cdeps] hash = cfc5345 protocol = git From 9a6037defae534ad44cca854209b31ab608a2a64 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 19 Aug 2020 13:52:16 -0600 Subject: [PATCH 1341/1973] Move CDEPS version back one commit as it was requiring level dimension in the streams file --- Externals_cime.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_cime.cfg b/Externals_cime.cfg index 90a80b92ea..a9df9d0698 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -13,7 +13,7 @@ local_path = src/externals/fox required = True [cdeps] -hash = cfc5345 +hash = d7b8a4c8e1b7cbff88da5bdb782ab715de62468a protocol = git repo_url = https://github.com/ESCOMP/CDEPS.git local_path = src/components/cdeps From 6a155d6e50163bb1843045768624c920b299f146 Mon Sep 17 00:00:00 2001 From: Danica Date: Wed, 2 Oct 2019 12:13:50 -0600 Subject: [PATCH 1342/1973] Crop/grass snow burial changed based on height and lodging. Addresses issue #516 --- src/biogeochem/SatellitePhenologyMod.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 6963161c4c..80cf1f9226 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -375,8 +375,7 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) else - fb = 1._r8 - max(min(snow_depth(c),0.2_r8),0._r8)/0.2_r8 ! 0.2m is assumed - !depth of snow required for complete burial of grasses + fb = 1._r8 - (max(min(snow_depth(c),max(0.05,htop(p)*0.8_r8)),0._r8)/(max(0.05,htop(p)*0.8_r8))) endif ! area weight by snow covered fraction From 3bfc5250cf373dd210532670f4dd19e465e71958 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 19 Aug 2020 16:15:26 -0600 Subject: [PATCH 1343/1973] Use a compset with stub GLC for a sub-day restart test --- cime_config/testdefs/testlist_clm.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index ad0bf6f6f9..1d6552493f 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1159,13 +1159,14 @@ - + - + From 7049b7124f58c2b4ce79c79ad790f0f2b4e7f1d8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 19 Aug 2020 17:24:00 -0600 Subject: [PATCH 1344/1973] Update changeLog --- doc/ChangeLog | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 115 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 759c005192..e33c0abe88 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,118 @@ =============================================================== +Tag name: ctsm1.0.dev108 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Wed Aug 19 17:23:47 MDT 2020 +One-line Summary: Update default PE layouts for new SE/FV3 grids + +Purpose of changes +------------------ + +Change PE layouts for new high resolution SE/FV3 grids. Have a version for cheyenne and a default one +as well. + +Update externals: cime, cism, CMEPS, CDEPS +Change single point tests to use stub ROF +Change tests to use gx1v7 rather than gx1v6 +Update waccmx_offline to use START=1979 + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1108 Change single point tests to use stub ROF + Fixes #1098 ARCTICGRIS PE layout is very slow + Fixes #1105 Default new FV3/SE grid PE layouts are problematic + Fixes #1103 Some changes to prevent missing file for WACCMX testing + Fixes #1113 ARCTIC test is failing + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Some tests were chagned to use stub ROF and one to stub GLC. @billsacks suggest we should also change + other tests in this same way. + +Changes to tests or testing: Yes + +Code reviewed by: self + + +CTSM testing: regular, tools + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + tools-tests (test/tools): + + cheyenne - PASS + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - OK + + python testing (see instructions in python/README.md; document testing done): + + cheyenne -- PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No (except for waccmx_offline test) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cism, CDEPS, CMEPS + cism to cism2_1_69 + cime to cime5.8.30 + Update hash for CDEPS and CMEPS (so that nuopc test will run) + +Pull Requests that document the changes (include PR ids): #1111 +(https://github.com/ESCOMP/ctsm/pull) + + #1111 -- Adjust FV3/SE PE layouts + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev107 Originator(s): erik (Erik Kluzek) Date: Mon Aug 10 02:21:12 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 2d511da10a..cfabe8bb5b 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev108 erik 08/19/2020 Update default PE layouts for new SE/FV3 grids ctsm1.0.dev107 erik 08/10/2020 Answer changes needed for CESM2.2.0 ctsm1.0.dev106 erik 08/06/2020 Bit-for-bit updates for the CESM2.2.0 release release-clm5.0.34 erik 04/20/2020 Update doc for release-clm5.0 (SKIPPED), and fix issues with no-anthro surface dataset creation From b648253bb60d19e606c1c2585093eadaa053fdd2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 19 Aug 2020 17:47:44 -0600 Subject: [PATCH 1345/1973] Fix for #1107 --- src/biogeophys/PhotosynthesisMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 023b39898f..26fd9c5fa5 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -346,8 +346,8 @@ subroutine InitAllocate(this, bounds) ! statements. allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 - allocate(this%vcmx_prevyr (begp:endp,1:nlevcan)) ; this%vcmx_prevyr (:,:) = 85._r8 - allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 50._r8 + allocate(this%vcmx_prevyr (begp:endp,1:nlevcan)) ; this%vcmx_prevyr (:,:) = 30._r8 + allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 60._r8 allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8 From 6d430b4c749382e7a8a24af2fa6ca5370fd6d631 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 20 Aug 2020 13:05:11 -0600 Subject: [PATCH 1346/1973] update the changelog --- doc/ChangeLog | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 116 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index e33c0abe88..e912c45a75 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,119 @@ =============================================================== +Tag name: ctsm1.0.dev109 +Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) +Date: Thu Aug 20 11:40:07 MDT 2020 +One-line Summary: Allow for resorbtion in transition from live to dead wood N + +Purpose of changes +------------------ + +This PR allows for resorbtion in transition from live to dead wood N, which also move +to NPOOL for free. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): Issue #443 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist +variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] + +Notes of particular relevance for developers: None +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: + +Code reviewed by: + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: + - what platforms/compilers: + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: + + URL for LMWG diagnostics output used to validate new climate: + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev108 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Wed Aug 19 17:23:47 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index cfabe8bb5b..9073311c62 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev109 negins 08/20/2020 Allow for resorbtion in transition from live to dead wood N ctsm1.0.dev108 erik 08/19/2020 Update default PE layouts for new SE/FV3 grids ctsm1.0.dev107 erik 08/10/2020 Answer changes needed for CESM2.2.0 ctsm1.0.dev106 erik 08/06/2020 Bit-for-bit updates for the CESM2.2.0 release From efea885663bd21d999198be58e7ac1d814dc66ac Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 20 Aug 2020 13:25:22 -0600 Subject: [PATCH 1347/1973] filling in more fields in changelog. --- doc/ChangeLog | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index e912c45a75..6e77e31f6c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -22,9 +22,9 @@ Significant changes to scientifically-supported configurations Does this tag change answers significantly for any of the following physics configurations? (Details of any changes will be given in the "Answer changes" section below.) -[ ] clm5_0 +[x] clm5_0 -[ ] ctsm5_0-nwp +[x] ctsm5_0-nwp [ ] clm4_5 @@ -48,9 +48,9 @@ NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the Caveats for developers (e.g., code that is duplicated that requires double maintenance): -Changes to tests or testing: +Changes to tests or testing: None -Code reviewed by: +Code reviewed by: Erik Kluzek CTSM testing: @@ -59,19 +59,19 @@ CTSM testing: build-namelist tests: - cheyenne - + cheyenne - not run tools-tests (test/tools): - cheyenne - + cheyenne - not run PTCLM testing (tools/shared/PTCLM/test): - cheyenne - + cheyenne - not run python testing (see instructions in python/README.md; document testing done): - (any machine) - + (any machine) - not run regular tests (aux_clm): @@ -86,6 +86,8 @@ Answer changes Changes answers relative to baseline: + + If a tag changes answers relative to baseline comparison the following should be filled in (otherwise remove this section): From 906959f121f54b41aade26325ac401f307849ca2 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 20 Aug 2020 13:34:09 -0600 Subject: [PATCH 1348/1973] updating fields in ChangeLog... --- doc/ChangeLog | 158 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 153 insertions(+), 5 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 6e77e31f6c..2e0a8c1aa7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -84,7 +84,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: +Changes answers relative to baseline: YES @@ -92,9 +92,10 @@ Changes answers relative to baseline: following should be filled in (otherwise remove this section): Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): + - what code configurations: ??? + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new + climate): larger than roundoff/same climate??? If bitwise differences were observed, how did you show they were no worse than roundoff? @@ -103,7 +104,154 @@ Changes answers relative to baseline: climate (put details of the simulations in the experiment database) - casename: - URL for LMWG diagnostics output used to validate new climate: + Answer changes appeared for the following tests on Cheyenne: + 0819-233327ch_gnu: 46 tests + FAIL ERI_D_Ld9.f10_f10_musgs.I1850Clm50Bgc.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_D_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_Ld9.f10_f10_musgs.I1850Clm50Bgc.cheyenne_gnu.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D.f10_f10_musgs.IHistClm50Bgc.cheyenne_gnu.clm-decStart BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld3_P36x2.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-ciso_flexCN_FUN BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-snowveg_norad BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5.f10_f10_musgs.I1850Clm50Bgc.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P36x2_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-extra_outputs BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Clm50Cn.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P36x2_Lm13.f10_f10_musgs.IHistClm50Bgc.cheyenne_gnu.clm-monthly BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_Lm40_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.cheyenne_gnu.clm-monthly BASELINE ctsm1.0.dev108: DIFF + FAIL LWISO_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_gnu.clm-coldStart BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld5.f10_f10_musgs.ISSP245Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld5.f10_f10_musgs.ISSP370Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Lm1.f10_f10_musgs.I1850Clm50BgcCropCmip6waccm.cheyenne_gnu.clm-basic BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ly1_Mmpi-serial.1x1_brazil.IHistClm50BgcQianRsGs.cheyenne_gnu.clm-output_bgc_highfreq BASELINE ctsm1.0.dev108: DIFF + + + 0819-233327ch_int: 163 tests + FAIL DAE_N2_D_Lh12.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-DA_multidrv BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_D_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_D_Ld9.ne30_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-vrtlay BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_Ld9.f45_g37.I2000Clm50BgcCruGs.cheyenne_intel.clm-nofire BASELINE ctsm1.0.dev108: DIFF + FAIL ERI_N2_Ld9.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D.f10_f10_musgs.IHistClm50Bgc.cheyenne_intel.clm-decStart BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld10_P36x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_decStart BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld3_P36x2.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5.C96_C96_mg17.IHistClm50BgcCrop.cheyenne_intel.clm-allActive BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-NoVSNoNI BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-rootlit BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5.f19_g17_gl4.I1850Clm50BgcCrop.cheyenne_intel.clm-glcMEC_changeFlags BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5.f19_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5.f19_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-fire_emis BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld9.f19_g17.I2000Clm50Cn.cheyenne_intel.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld30.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-coldStart BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-cn_conly BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-flexCN_FUN BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-luna BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-noFUN_flexCN BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld5.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-irrig_spunup BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P36x2_Ld5.f10_f10_musgs.I2000Clm50BgcCropRtm.cheyenne_intel.clm-irrig_spunup BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld3.f09_g17.I1850Clm50BgcCropCru.cheyenne_intel.clm-ciso BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5.f10_f10_musgs.I1850Clm50Bgc.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5.f10_f10_musgs.I1850Clm50Bgc.cheyenne_intel.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5.f19_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P180x2_D_Ld5.f19_g17_gl4.I1850Clm50BgcCropG.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P180x2_D_Ld5.f19_g17_gl4.I1850Clm50BgcCropG.cheyenne_intel.clm-glcMEC_increase BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P36x2_D_Ld5.f10_f10_musgs.I1850Clm50Bgc.cheyenne_intel.clm-ciso BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Clm50Cn.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Ctsm50NwpBgcCropGswpGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P36x2_Lm13.f10_f10_musgs.IHistClm50Bgc.cheyenne_intel.clm-monthly BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P72x2_Lm25.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-monthly BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P72x2_Lm36.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-clm50cropIrrigMonth_interp BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P72x2_Lm7.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-irrig_alternate_monthly BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_P72x2_Ly3.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-irrig_o3_reduceOutput BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-reseedresetsnow BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld12.f10_f10_musgs.I1850Clm50BgcCropG.cheyenne_intel.clm-glcMEC_spunup_inc_dec_bgc BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-deepsoil_bedrock BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld3.f19_g17_gl4.I1850Clm50BgcCrop.cheyenne_intel.clm-clm50dynroots BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld5.f10_f10_musgs.I2000Clm50BgcCropRtm.cheyenne_intel.rtm-rtmOnFloodOnEffvelOn BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld5.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_D_Ld5.f10_f10_musgs.IHistClm50BgcQianGs.cheyenne_intel.clm-ciso_bombspike1963DecStart BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_Ld3.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-rad_hrly_light_res_half BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.IHistClm50SpGs.cheyenne_intel.clm-clm50cam6LndTuningMode_1979Start COMPARE_base_rest + FAIL ERS_Ly20_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_Ly3.f10_f10_musgs.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF + FAIL LCISO_Lm13.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_monthly BASELINE ctsm1.0.dev108: DIFF + FAIL LII2FINIDATAREAS_D_P360x2_Ld1.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL LII_D_Ld3.f19_g17_gl4.I2000Clm50BgcCrop.cheyenne_intel.clm-glcMEC_spunup_1way BASELINE ctsm1.0.dev108: DIFF + FAIL LVG_Ld5_D.f10_f10_musgs.I1850Clm50Bgc.cheyenne_intel.clm-no_vector_output BASELINE ctsm1.0.dev108: DIFF + FAIL PEM_D_Ld5.ne30_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL PET_P36x2_D.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld1.f09_g17.I1850Clm50BgcSpinup.cheyenne_intel.clm-cplhist BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld5_Vnuopc.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld9.f09_g17_gl4.I1850Clm50BgcNoAnthro.cheyenne_intel.clm-decStart1851_noinitial BASELINE ctsm1.0.dev108: DIFF + FAIL SMS.f19_g17.I2000Clm50Cn.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld1.f09_g17.I1850Clm50Bgc.cheyenne_intel.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld1.f09_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-af_bias_v7 BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld2_D.f09_g17.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic_interp BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld5.f10_f10_musgs.ISSP585Clm50BgcCrop.cheyenne_intel.clm-ciso_dec2050Start BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld5.f19_g17.IHistClm50Bgc.cheyenne_intel.clm-decStart BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Lm1_D.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-output_crop_highfreq BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Lm1_D.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-snowlayers_3_monthly BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Lm1.f19_g17_gl4.I1850Clm50Bgc.cheyenne_intel.clm-clm50dynroots BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Lm1.f19_g17.I1850Clm50BgcCropCmip6waccm.cheyenne_intel.clm-basic BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ln9.ne0ARCTICGRISne30x8_ne0ARCTICGRISne30x8_mt12.ISSP585Clm50BgcCrop.cheyenne_intel.clm-clm50cam6LndTuningMode BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ln9.ne30pg2_ne30pg2_mg17.I2000Clm50BgcCrop.cheyenne_intel.clm-clm50cam6LndTuningMode BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ly3_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.cheyenne_intel.clm-clm50dynroots BASELINE ctsm1.0.dev108: DIFF + FAIL SOILSTRUCTUD_Ld5.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL SSP_D_Ld10.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-rtmColdSSP BASELINE ctsm1.0.dev108: DIFF + FAIL SSP_D_Ld4.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-ciso_rtmColdSSP BASELINE ctsm1.0.dev108: DIFF + FAIL SSP_Ld10.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-rtmColdSSP BASELINE ctsm1.0.dev108: DIFF + + Answer changes appeared for the following tests on Izumi: + + FAIL SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop BASELINE ctsm1.0.dev108: DIFF + FAIL SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop BASELINE ctsm1.0.dev108: DIFF + FAIL PEM_Ld1.f10_f10_musgs.I2000Clm50BgcCropGs.izumi_intel.clm-crop BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_intel.clm-crop BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.izumi_intel.clm-tracer_consistency BASELINE ctsm1.0.dev108: DIFF + FAIL SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_intel.clm-crop BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-ciso BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-reduceOutput BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-decStart BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-ciso BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-flexCN_FUN BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-luna BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-noFUN_flexCN BASELINE ctsm1.0.dev108: DIFF + FAIL ERP_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-reduceOutput BASELINE ctsm1.0.dev108: DIFF + FAIL ERS_Ly5_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.izumi_nag.clm-monthly BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld1_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-af_bias_v7 BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_Ld5.f10_f10_musgs.I2000Clm50BgcCrop.izumi_nag.clm-irrig_alternate BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D_P48x1_Ld5.f10_f10_musgs.I2000Clm50BgcCrop.izumi_nag.clm-irrig_spunup BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-decStart BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-monthly BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_P48x1_D_Ld5.f10_f10_musgs.I2000Clm50Cn.izumi_nag.clm-default BASELINE ctsm1.0.dev108: DIFF + FAIL SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop BASELINE ctsm1.0.dev108: DIFF + FAIL SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop BASELINE ctsm1.0.dev108: DIFF + + + + URL for LMWG diagnostics output used to validate new climate: ??? Detailed list of changes From 45d493df654e38ac356d4921798ea114f8ca2eb4 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 20 Aug 2020 14:30:25 -0600 Subject: [PATCH 1349/1973] update to changelog based on Bill's comments... --- doc/ChangeLog | 149 +------------------------------------------------- 1 file changed, 1 insertion(+), 148 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 2e0a8c1aa7..abc137a8fd 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -87,12 +87,11 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the following should be filled in (otherwise remove this section): Summarize any changes to answers, i.e., - - what code configurations: ??? + - what code configurations: Clm50 with Bgc or Cn - what platforms/compilers: all - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff/same climate??? @@ -104,152 +103,6 @@ Changes answers relative to baseline: YES climate (put details of the simulations in the experiment database) - casename: - Answer changes appeared for the following tests on Cheyenne: - 0819-233327ch_gnu: 46 tests - FAIL ERI_D_Ld9.f10_f10_musgs.I1850Clm50Bgc.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_D_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_Ld9.f10_f10_musgs.I1850Clm50Bgc.cheyenne_gnu.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D.f10_f10_musgs.IHistClm50Bgc.cheyenne_gnu.clm-decStart BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld3_P36x2.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-ciso_flexCN_FUN BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-snowveg_norad BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5.f10_f10_musgs.I1850Clm50Bgc.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P36x2_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-extra_outputs BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Clm50Cn.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P36x2_Lm13.f10_f10_musgs.IHistClm50Bgc.cheyenne_gnu.clm-monthly BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_Lm40_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.cheyenne_gnu.clm-monthly BASELINE ctsm1.0.dev108: DIFF - FAIL LWISO_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_gnu.clm-coldStart BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld5.f10_f10_musgs.ISSP245Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld5.f10_f10_musgs.ISSP370Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Lm1.f10_f10_musgs.I1850Clm50BgcCropCmip6waccm.cheyenne_gnu.clm-basic BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ly1_Mmpi-serial.1x1_brazil.IHistClm50BgcQianRsGs.cheyenne_gnu.clm-output_bgc_highfreq BASELINE ctsm1.0.dev108: DIFF - - - 0819-233327ch_int: 163 tests - FAIL DAE_N2_D_Lh12.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-DA_multidrv BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_D_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_D_Ld9.ne30_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-vrtlay BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_Ld9.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_Ld9.f45_g37.I2000Clm50BgcCruGs.cheyenne_intel.clm-nofire BASELINE ctsm1.0.dev108: DIFF - FAIL ERI_N2_Ld9.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D.f10_f10_musgs.IHistClm50Bgc.cheyenne_intel.clm-decStart BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld10_P36x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_decStart BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld3_P36x2.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5.C96_C96_mg17.IHistClm50BgcCrop.cheyenne_intel.clm-allActive BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-NoVSNoNI BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-rootlit BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5.f19_g17_gl4.I1850Clm50BgcCrop.cheyenne_intel.clm-glcMEC_changeFlags BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5.f19_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5.f19_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-fire_emis BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld9.f19_g17.I2000Clm50Cn.cheyenne_intel.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld30.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-coldStart BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-cn_conly BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-flexCN_FUN BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-luna BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-noFUN_flexCN BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld5.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-irrig_spunup BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P36x2_Ld5.f10_f10_musgs.I2000Clm50BgcCropRtm.cheyenne_intel.clm-irrig_spunup BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld3.f09_g17.I1850Clm50BgcCropCru.cheyenne_intel.clm-ciso BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5.f10_f10_musgs.I1850Clm50Bgc.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5.f10_f10_musgs.I1850Clm50Bgc.cheyenne_intel.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5.f19_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P180x2_D_Ld5.f19_g17_gl4.I1850Clm50BgcCropG.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P180x2_D_Ld5.f19_g17_gl4.I1850Clm50BgcCropG.cheyenne_intel.clm-glcMEC_increase BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P36x2_D_Ld5.f10_f10_musgs.I1850Clm50Bgc.cheyenne_intel.clm-ciso BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Clm50Cn.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Ctsm50NwpBgcCropGswpGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P36x2_Lm13.f10_f10_musgs.IHistClm50Bgc.cheyenne_intel.clm-monthly BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P72x2_Lm25.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-monthly BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P72x2_Lm36.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-clm50cropIrrigMonth_interp BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P72x2_Lm7.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-irrig_alternate_monthly BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_P72x2_Ly3.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-irrig_o3_reduceOutput BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-reseedresetsnow BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld12.f10_f10_musgs.I1850Clm50BgcCropG.cheyenne_intel.clm-glcMEC_spunup_inc_dec_bgc BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-deepsoil_bedrock BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld3.f19_g17_gl4.I1850Clm50BgcCrop.cheyenne_intel.clm-clm50dynroots BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld5.f10_f10_musgs.I2000Clm50BgcCropRtm.cheyenne_intel.rtm-rtmOnFloodOnEffvelOn BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld5.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_D_Ld5.f10_f10_musgs.IHistClm50BgcQianGs.cheyenne_intel.clm-ciso_bombspike1963DecStart BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_Ld3.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-rad_hrly_light_res_half BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.IHistClm50SpGs.cheyenne_intel.clm-clm50cam6LndTuningMode_1979Start COMPARE_base_rest - FAIL ERS_Ly20_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_Ly3.f10_f10_musgs.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF - FAIL LCISO_Lm13.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_monthly BASELINE ctsm1.0.dev108: DIFF - FAIL LII2FINIDATAREAS_D_P360x2_Ld1.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL LII_D_Ld3.f19_g17_gl4.I2000Clm50BgcCrop.cheyenne_intel.clm-glcMEC_spunup_1way BASELINE ctsm1.0.dev108: DIFF - FAIL LVG_Ld5_D.f10_f10_musgs.I1850Clm50Bgc.cheyenne_intel.clm-no_vector_output BASELINE ctsm1.0.dev108: DIFF - FAIL PEM_D_Ld5.ne30_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL PET_P36x2_D.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld1.f09_g17.I1850Clm50BgcSpinup.cheyenne_intel.clm-cplhist BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld5_Vnuopc.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld9.f09_g17_gl4.I1850Clm50BgcNoAnthro.cheyenne_intel.clm-decStart1851_noinitial BASELINE ctsm1.0.dev108: DIFF - FAIL SMS.f19_g17.I2000Clm50Cn.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld1.f09_g17.I1850Clm50Bgc.cheyenne_intel.clm-drydepnomegan BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld1.f09_g17.I2000Clm50BgcCruGs.cheyenne_intel.clm-af_bias_v7 BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld2_D.f09_g17.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic_interp BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld5.f10_f10_musgs.ISSP585Clm50BgcCrop.cheyenne_intel.clm-ciso_dec2050Start BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld5.f19_g17.IHistClm50Bgc.cheyenne_intel.clm-decStart BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Lm1_D.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-output_crop_highfreq BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Lm1_D.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-snowlayers_3_monthly BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Lm1.f19_g17_gl4.I1850Clm50Bgc.cheyenne_intel.clm-clm50dynroots BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Lm1.f19_g17.I1850Clm50BgcCropCmip6waccm.cheyenne_intel.clm-basic BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ln9.ne0ARCTICGRISne30x8_ne0ARCTICGRISne30x8_mt12.ISSP585Clm50BgcCrop.cheyenne_intel.clm-clm50cam6LndTuningMode BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ln9.ne30pg2_ne30pg2_mg17.I2000Clm50BgcCrop.cheyenne_intel.clm-clm50cam6LndTuningMode BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ly3_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.cheyenne_intel.clm-clm50dynroots BASELINE ctsm1.0.dev108: DIFF - FAIL SOILSTRUCTUD_Ld5.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL SSP_D_Ld10.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-rtmColdSSP BASELINE ctsm1.0.dev108: DIFF - FAIL SSP_D_Ld4.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-ciso_rtmColdSSP BASELINE ctsm1.0.dev108: DIFF - FAIL SSP_Ld10.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-rtmColdSSP BASELINE ctsm1.0.dev108: DIFF - - Answer changes appeared for the following tests on Izumi: - - FAIL SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop BASELINE ctsm1.0.dev108: DIFF - FAIL SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop BASELINE ctsm1.0.dev108: DIFF - FAIL PEM_Ld1.f10_f10_musgs.I2000Clm50BgcCropGs.izumi_intel.clm-crop BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_intel.clm-crop BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.izumi_intel.clm-tracer_consistency BASELINE ctsm1.0.dev108: DIFF - FAIL SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_intel.clm-crop BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-ciso BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-reduceOutput BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-decStart BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-ciso BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-flexCN_FUN BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-luna BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-noFUN_flexCN BASELINE ctsm1.0.dev108: DIFF - FAIL ERP_Ld5_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-reduceOutput BASELINE ctsm1.0.dev108: DIFF - FAIL ERS_Ly5_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropQianRsGs.izumi_nag.clm-monthly BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld1_P48x1.f10_f10_musgs.I2000Clm50BgcCruGs.izumi_nag.clm-af_bias_v7 BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_Ld5.f10_f10_musgs.I2000Clm50BgcCrop.izumi_nag.clm-irrig_alternate BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D_P48x1_Ld5.f10_f10_musgs.I2000Clm50BgcCrop.izumi_nag.clm-irrig_spunup BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-decStart BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-monthly BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_P48x1_D_Ld5.f10_f10_musgs.I2000Clm50Cn.izumi_nag.clm-default BASELINE ctsm1.0.dev108: DIFF - FAIL SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop BASELINE ctsm1.0.dev108: DIFF - FAIL SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop BASELINE ctsm1.0.dev108: DIFF - - URL for LMWG diagnostics output used to validate new climate: ??? From 11f607591f02d1920d06f5f7ac1ab98bdb99a275 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 20 Aug 2020 14:59:40 -0600 Subject: [PATCH 1350/1973] adding expected fail #1117 to the expectedtestfails file. --- cime_config/testdefs/ExpectedTestFails.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 938b10be53..08527c0788 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -123,4 +123,11 @@ + + + FAIL + CTSM/#1117 + + + From 8f9591237974ad8ca34517b5c06ece27578d743c Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 20 Aug 2020 15:06:15 -0600 Subject: [PATCH 1351/1973] updating ChangeLog based on Erik's comments. --- doc/ChangeLog | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index abc137a8fd..1bafc5b7b5 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -94,17 +94,20 @@ Changes answers relative to baseline: YES - what code configurations: Clm50 with Bgc or Cn - what platforms/compilers: all - nature of change (roundoff; larger than roundoff/same climate; new - climate): larger than roundoff/same climate??? + climate): larger than roundoff/same climate If bitwise differences were observed, how did you show they were no worse than roundoff? If this tag changes climate describe the run(s) done to evaluate the new climate (put details of the simulations in the experiment database) - - casename: + + Will Wieder thought the changes were small enough that we didn't need to do + a long simulation. Erik Kluzek thinks the changes were verified with single + point simulations. - URL for LMWG diagnostics output used to validate new climate: ??? + URL for LMWG diagnostics output used to validate new climate: Detailed list of changes From 14bc28946ba5e9e00e19dc8fd58a4930a7424e30 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 20 Aug 2020 15:40:57 -0600 Subject: [PATCH 1352/1973] Move expected failure to correct location --- cime_config/testdefs/ExpectedTestFails.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 08527c0788..362265479c 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -37,6 +37,13 @@ + + + FAIL + #1117 + + + @@ -123,11 +130,4 @@ - - - FAIL - CTSM/#1117 - - - From 09bfb313d145d36ff0836f6b64e78345c6a4a8c2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 21 Aug 2020 10:27:02 -0600 Subject: [PATCH 1353/1973] Update ciem tag --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index f1b8d8056b..28ee03e951 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,7 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.30 +tag = cime5.8.31 externals = ../Externals_cime.cfg required = True From 70c0f2929bfc14baf61be29177f1220a382a6e59 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 21 Aug 2020 10:47:05 -0600 Subject: [PATCH 1354/1973] Remove test from expected fails list that is no longer in the test suite It looks like the test ERS_Lm20_Mmpi-serial.1x1_smallvilleIA.I2000Clm50BgcCropQianGs.cheyenne_gnu.clm-monthly has been replaced by ERS_Lm20_Mmpi-serial.1x1_smallvilleIA.I2000Clm50BgcCropQianRsGs.cheyenne_gnu.clm-monthly_noinitial, which is now passing. --- cime_config/testdefs/ExpectedTestFails.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 362265479c..55bab4c483 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -30,13 +30,6 @@ - - - FAIL - #203 - - - FAIL From 552f131d48dc08329d018cc45037fa1ba4bc1558 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 21 Aug 2020 10:58:40 -0600 Subject: [PATCH 1355/1973] Update ChangeLog --- doc/ChangeLog | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 116 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 1bafc5b7b5..18ec683d77 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,119 @@ =============================================================== +Tag name: ctsm1.0.dev110 +Originator(s): jedwards (Jim Edwards) +Date: Fri Aug 21 10:49:08 MDT 2020 +One-line Summary: Fixes needed for PIO2 + +Purpose of changes +------------------ + +Fixes needed for CTSM to work with PIO2. There is an additional fix +needed in PIO2 itself; this is available in a later version of cime that +we will bring in soon. + +Note that this PR also includes a change in config_files.xml that is +needed for a newer version of cime when running compsets with dlnd, slnd +or xlnd; this may be incompatible with the current version of the cime +external, but this does not impact compsets with CTSM. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +The changes in this tag, together with a cime update that will be coming +in soon, resolve the following issues (I'm not sure off-hand which +issues are resolved by the changes here alone and which ones require the +cime update): +- Resolves ESCOMP/CTSM#1029 (FATES tests fail with PIO2) +- Resolves ESCOMP/CTSM#1030 (mpi-serial nag case fails with pio2 when + defining h1 history restart file) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- May not be able to run configurations with dlnd, slnd or xlnd from this tag + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: Not investigated, but almost definitely not + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + + Note: Standard testing was done using PIO1 (as this is still the + default), but separate testing was also done using PIO2 (using an + updated cime) and tests were found to pass. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1095 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev109 Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) Date: Thu Aug 20 11:40:07 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 9073311c62..c217c6f13c 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev110 jedwards 08/21/2020 Fixes needed for PIO2 ctsm1.0.dev109 negins 08/20/2020 Allow for resorbtion in transition from live to dead wood N ctsm1.0.dev108 erik 08/19/2020 Update default PE layouts for new SE/FV3 grids ctsm1.0.dev107 erik 08/10/2020 Answer changes needed for CESM2.2.0 From bc897c4d103663570eec3553b868f335b0a6d337 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 21 Aug 2020 15:39:34 -0600 Subject: [PATCH 1356/1973] Move mksurfdata_map rounding of special landunits to before wetland fill I think this may be important to avoid errors and/or wrong behavior in some edge cases where we have < 0.5% cover of glacier and/or lake, and other cases. See https://github.com/ESCOMP/CTSM/issues/1118 for detailed thoughts Resolves ESCOMP/CTSM#1118 --- tools/mksurfdata_map/src/mksurfdat.F90 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90 index 236740282c..bc6ef6f028 100644 --- a/tools/mksurfdata_map/src/mksurfdat.F90 +++ b/tools/mksurfdata_map/src/mksurfdat.F90 @@ -711,6 +711,18 @@ program mksurfdat do n = 1,ns_o + ! Truncate all percentage fields on output grid. This is needed to + ! insure that wt is zero (not a very small number such as + ! 1e-16) where it really should be zero + + do k = 1,nlevsoi + pctsand(n,k) = float(nint(pctsand(n,k))) + pctclay(n,k) = float(nint(pctclay(n,k))) + end do + pctlak(n) = float(nint(pctlak(n))) + pctwet(n) = float(nint(pctwet(n))) + pctgla(n) = float(nint(pctgla(n))) + ! Assume wetland, glacier and/or lake when dataset landmask implies ocean ! (assume medium soil color (15) and loamy texture). ! Also set pftdata_mask here @@ -734,18 +746,6 @@ program mksurfdat pftdata_mask(n) = 1 end if - ! Truncate all percentage fields on output grid. This is needed to - ! insure that wt is zero (not a very small number such as - ! 1e-16) where it really should be zero - - do k = 1,nlevsoi - pctsand(n,k) = float(nint(pctsand(n,k))) - pctclay(n,k) = float(nint(pctclay(n,k))) - end do - pctlak(n) = float(nint(pctlak(n))) - pctwet(n) = float(nint(pctwet(n))) - pctgla(n) = float(nint(pctgla(n))) - ! Make sure sum of land cover types does not exceed 100. If it does, ! subtract excess from most dominant land cover. From 5b07216aa4c652f3b526f0ba5e1d29da898e2ea5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 21 Aug 2020 15:57:43 -0600 Subject: [PATCH 1357/1973] Fix typo in README --- tools/mksurfdata_map/README.developers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mksurfdata_map/README.developers b/tools/mksurfdata_map/README.developers index 9e3744b25f..6513aeb131 100644 --- a/tools/mksurfdata_map/README.developers +++ b/tools/mksurfdata_map/README.developers @@ -207,7 +207,7 @@ And here are some things to check for when making new landuse.timeseries datasets (which often happens at the same time, and most of the above applies as well): -- Compare one of the productive resolution datasets to a previous version. +- Compare one of the production resolution datasets to a previous version. - If part of it should be identical (for example the historical period) make sure it is identical as expected (using cprnc make sure the historical period From 213bec28bd7b133e8c46e347091fe47500d55e6f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 22 Aug 2020 07:21:12 -0600 Subject: [PATCH 1358/1973] Record run_sys_tests command-line --- python/ctsm/run_sys_tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index 2e64425c7e..bbde160fe3 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -4,6 +4,7 @@ import argparse import logging import os +import sys import subprocess from datetime import datetime @@ -434,6 +435,7 @@ def _record_git_status(testroot, dry_run): now_str = now.strftime("%m%d-%H%M%S") git_status_filepath = git_status_filepath + '_' + now_str with open(git_status_filepath, 'w') as git_status_file: + git_status_file.write(' '.join(sys.argv) + '\n\n') git_status_file.write("SRCROOT: {}\n".format(ctsm_root)) git_status_file.write(output) From 273b75ee959427fde57d4a9af9abbdd3f4796457 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 23 Aug 2020 06:35:33 -0600 Subject: [PATCH 1359/1973] Add some comments --- bld/CLMBuildNamelist.pm | 6 ++++++ src/dyn_subgrid/dynSubgridControlMod.F90 | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 5d79b50ddd..7a3d6b4193 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2546,6 +2546,12 @@ sub setup_logic_do_transient_lakes { # for them to be unset if that will be their final state): # - flanduse_timeseries # + # NOTE(wjs, 2020-08-23) I based this function on setup_logic_do_transient_crops. I'm + # not sure if all of the checks here are truly important for transient lakes (in + # particular, my guess is that collapse_urban could probably be done with transient + # lakes - as well as transient pfts and transient crops for that matter), but some of + # the checks probably are needed, and it seems best to keep transient lakes consistent + # with other transient areas in this respect. my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; my $var = 'do_transient_lakes'; diff --git a/src/dyn_subgrid/dynSubgridControlMod.F90 b/src/dyn_subgrid/dynSubgridControlMod.F90 index a2ee0ef17d..6d9a703b31 100644 --- a/src/dyn_subgrid/dynSubgridControlMod.F90 +++ b/src/dyn_subgrid/dynSubgridControlMod.F90 @@ -248,6 +248,13 @@ subroutine check_namelist_consistency end if end if + ! NOTE(wjs, 2020-08-23) In the following error checks, I'm treating do_transient_lakes + ! similar to do_transient_pfts and do_transient_crops. I'm not sure if all of these + ! checks are truly important for transient lakes (in particular, my guess is that + ! collapse_urban could probably be done with transient lakes - as well as transient + ! pfts and transient crops for that matter), but some of the checks probably are + ! needed, and it seems best to keep transient lakes consistent with other transient + ! areas in this respect. if (dyn_subgrid_control_inst%do_transient_pfts .or. & dyn_subgrid_control_inst%do_transient_crops .or. & dyn_subgrid_control_inst%do_transient_lakes) then From 9f8d2df69ec58051cc0fb464309cbcfd9938988c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 23 Aug 2020 06:51:23 -0600 Subject: [PATCH 1360/1973] Remove unnecessary use statements and unnecessary comments --- src/dyn_subgrid/dynSubgridDriverMod.F90 | 7 +------ src/dyn_subgrid/dynlakeFileMod.F90 | 19 ++++--------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 index 7edcec8f3b..676e14da81 100644 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ b/src/dyn_subgrid/dynSubgridDriverMod.F90 @@ -20,7 +20,6 @@ module dynSubgridDriverMod use dynpftFileMod , only : dynpft_init, dynpft_interp use dyncropFileMod , only : dyncrop_init, dyncrop_interp use dynHarvestMod , only : dynHarvest_init, dynHarvest_interp - ! use new lake file module use dynlakeFileMod , only : dynlake_init, dynlake_interp use dynLandunitAreaMod , only : update_landunit_weights use subgridWeightsMod , only : compute_higher_order_weights, set_subgrid_diagnostic_fields @@ -44,10 +43,7 @@ module dynSubgridDriverMod use CropType , only : crop_type use glc2lndMod , only : glc2lnd_type use filterMod , only : filter, filter_inactive_and_active - - - - + ! ! !PUBLIC MEMBER FUNCTIONS: implicit none private @@ -128,7 +124,6 @@ subroutine dynSubgrid_init(bounds_proc, glc_behavior, crop_inst) ! Initialize stuff for prescribed transient lakes - ! error if keyword argument like for dynamical land units above: dynlake_filename=get_flanduse_timeseries() if (get_do_transient_lakes()) then call dynlake_init(bounds_proc, dynlake_filename=get_flanduse_timeseries()) end if diff --git a/src/dyn_subgrid/dynlakeFileMod.F90 b/src/dyn_subgrid/dynlakeFileMod.F90 index 304c191a02..17b21484fd 100644 --- a/src/dyn_subgrid/dynlakeFileMod.F90 +++ b/src/dyn_subgrid/dynlakeFileMod.F90 @@ -6,8 +6,6 @@ module dynlakeFileMod ! ! !USES: - ! check this still on unneccesary parts. - #include "shr_assert.h" use shr_log_mod , only : errMsg => shr_log_errMsg use shr_kind_mod , only : r8 => shr_kind_r8 @@ -15,12 +13,9 @@ module dynlakeFileMod use dynFileMod , only : dyn_file_type use dynVarTimeUninterpMod , only : dyn_var_time_uninterp_type use clm_varctl , only : iulog - use clm_varcon , only : grlnd, namec + use clm_varcon , only : grlnd use abortutils , only : endrun - use spmdMod , only : masterproc, mpicom - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch + use spmdMod , only : masterproc ! !PUBLIC MEMBER FUNCTIONS: implicit none @@ -35,8 +30,6 @@ module dynlakeFileMod ! Names of variables on file character(len=*), parameter :: lake_varname = 'PCT_LAKE' - - character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -75,8 +68,8 @@ subroutine dynlake_init(bounds, dynlake_filename) ! Get the year from the START of the timestep; this way, we'll update lake areas ! starting after the year boundary. This is consistent with the timing of glacier - ! updates, and will likely be consistent with the timing of crop updates determined - ! prognostically, if crop areas are ever determined prognostically rather than + ! updates, and will likely be consistent with the timing of lake updates determined + ! prognostically, if lake areas are ever determined prognostically rather than ! prescribed ahead of time. dynlake_file = dyn_file_type(dynlake_filename, YEAR_POSITION_START_OF_TIMESTEP) @@ -92,7 +85,6 @@ subroutine dynlake_init(bounds, dynlake_filename) dyn_file = dynlake_file, varname=lake_varname, & dim1name=grlnd, conversion_factor=100._r8, & do_check_sums_equal_1=.false., data_shape=[num_points]) - end subroutine dynlake_init @@ -136,9 +128,6 @@ subroutine dynlake_interp(bounds) end do deallocate(wtlake_cur) -! also account for landunits, patches and columns? - - end subroutine dynlake_interp end module dynlakeFileMod From 9976b45b44cb716cb0b575888f0af9688cf76c2e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 23 Aug 2020 07:31:14 -0600 Subject: [PATCH 1361/1973] Whitespace cleanup --- src/biogeophys/TotalWaterAndHeatMod.F90 | 14 ++++++-------- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 6 ++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index e817cb6511..e5f5b17fa7 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -881,9 +881,7 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & ! ! Note: Changes to this routine - for anything involving liquid or ice - should ! generally be accompanied by similar changes to ComputeLiqIceMassLake - - - + ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_lakec @@ -974,13 +972,14 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & end do end do - do fc = 1, num_lakec + do fc = 1, num_lakec c = filter_lakec(fc) heat(c) = heat_dry_mass(c) + heat_ice(c) + heat_liquid(c) + latent_heat_liquid(c) end do ! Lake water heat content - ! Note that we do NOT accumulate heat_liquid and cv_liquid in this call. See the comments at the top of AccumulateHeatLake for rationale. + ! Note that we do NOT accumulate heat_liquid and cv_liquid in this call. See the + ! comments at the top of AccumulateHeatLake for rationale. call AccumulateHeatLake(bounds, num_lakec, filter_lakec, temperature_inst, lakestate_inst, & heat) @@ -1079,8 +1078,8 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & ! calculate heat content of lake itself do j = 1, nlevlak do fc = 1, num_c - c = filter_c(fc) - ! liquid heat + c = filter_c(fc) + ! liquid heat h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) call AccumulateLiquidWaterHeat( & temp = t_lake(c,j), & @@ -1265,7 +1264,6 @@ subroutine AccumulateLiquidWaterHeat(temp, h2o, & latent_heat_liquid = latent_heat_liquid + h2o*hfus end subroutine AccumulateLiquidWaterHeat - !----------------------------------------------------------------------- pure function TempToHeat(temp, cv) result(heat) ! diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index 9947203a3f..d8bb809bba 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -203,17 +203,15 @@ subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & ! set baselines for lake columns - ! Calculate the total water volume of the lake column + ! Calculate the total water volume of the lake column call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, lakestate_inst, & liquid_mass = lake_liquid_mass_col(bounds%begc:bounds%endc), & ice_mass = lake_ice_mass_col(bounds%begc:bounds%endc)) do fc = 1, num_lakec - c = filter_lakec(fc) - + c = filter_lakec(fc) dynbal_baseline_liq(c) = lake_liquid_mass_col(c) dynbal_baseline_ice(c) = lake_ice_mass_col(c) - end do end associate From e44c19d5959d7d1cdfe82b7047fcca263a6e0280 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Mon, 24 Aug 2020 06:16:59 -0600 Subject: [PATCH 1362/1973] Remove temperature_inst%lake_heat as not used, remove comments on saving lake heat in LakeTemperatureMod --- src/biogeophys/LakeTemperatureMod.F90 | 6 +----- src/biogeophys/TemperatureType.F90 | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/biogeophys/LakeTemperatureMod.F90 b/src/biogeophys/LakeTemperatureMod.F90 index 6a20856f67..280020b6ef 100644 --- a/src/biogeophys/LakeTemperatureMod.F90 +++ b/src/biogeophys/LakeTemperatureMod.F90 @@ -248,7 +248,6 @@ subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_la t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (Kelvin) t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil (or snow) temperature (Kelvin) t_lake => temperature_inst%t_lake_col , & ! Output: [real(r8) (:,:) ] col lake temperature (Kelvin) - lake_heat => temperature_inst%lake_heat , & ! Output: [real(r8) (:) ] col lake heat (J/m²) beta => lakestate_inst%betaprime_col , & ! Output: [real(r8) (:) ] col effective beta: sabg_lyr(p,jtop) for snow layers, beta otherwise lake_icefrac => lakestate_inst%lake_icefrac_col , & ! Output: [real(r8) (:,:) ] col mass fraction of lake layer that is frozen @@ -1004,10 +1003,7 @@ subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_la end do end do - ! write(iulog,*)'Energy content of lake after calculating lake temperature (J/m²)', ncvts - - ! IV: currently commented out: caused crash. To do: look at this part of the code!!! - ! lake_heat(c) = ncvts(c) + call waterstatebulk_inst%CalculateTotalH2osno(bounds, num_lakec, filter_lakec, & caller = 'LakeTemperature-2', & diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 5dacf3fa55..b165ed0796 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -116,9 +116,6 @@ module TemperatureType real(r8), pointer :: xmf_h2osfc_col (:) ! latent heat of phase change of surface water real(r8), pointer :: fact_col (:,:) ! used in computing tridiagonal matrix real(r8), pointer :: c_h2osfc_col (:) ! heat capacity of surface water - - ! lake heat - real(r8), pointer :: lake_heat (:) ! total heat of lake water (J/m²) contains From 2bfb8d7d39cd07469919dd04c402df5cb3e43a82 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Mon, 24 Aug 2020 07:36:17 -0600 Subject: [PATCH 1363/1973] Add description on dynamical lakes for AdjustDeltaHeatForDeltaLiq module and clean up --- src/biogeophys/TotalWaterAndHeatMod.F90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index e5f5b17fa7..6e4ae8624d 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -1093,7 +1093,7 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & end do end do - ! add ice heat and liquid heat together (look at this part) + ! add ice heat and liquid heat together do fc = 1, num_c c = filter_c(fc) heat(c) = heat(c) + lake_heat_ice(c) + & @@ -1130,11 +1130,15 @@ subroutine AdjustDeltaHeatForDeltaLiq(bounds, delta_liq, & ! ice runoff is at heat_base_temp (which is reasonable as long as heat_base_temp = ! tfrz). ! + ! With dynamical lakes, the adjusted delta_heat does not account for the added lake + ! water content due to growing lakes. This is because lake depth is constant, the + ! total lake water content (kg/m^2) does not change. The change in water content of + ! the snow and soil in the lake column are accounted for. + ! ! Eventually, if we begin to explicitly account for the temperature / heat content of ! liquid and ice runoff in CLM, then this routine should be reworked to use the true ! heat contents of both liquid and ice runoff. ! - ! ADD HERE NOTES ABOUT LAKES!!! lake water not accounted. because baselines ! ! Sign convention: delta_liq and delta_heat are positive if the post-landcover change ! value is greater than the pre-landcover change value. From 251a170021db462614cb666d8ab379f7ab4ca9b7 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 24 Aug 2020 08:33:30 -0600 Subject: [PATCH 1364/1973] Moved lnd_import_export_utils.F90 from /src/utils to /src/cpl/utils --- cime_config/buildlib | 1 + src/{ => cpl}/utils/lnd_import_export_utils.F90 | 0 2 files changed, 1 insertion(+) rename src/{ => cpl}/utils/lnd_import_export_utils.F90 (100%) diff --git a/cime_config/buildlib b/cime_config/buildlib index 9e87bad732..2b8b781f47 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -119,6 +119,7 @@ def _main_func(): os.path.join(lnd_root,"src","fates","parteh"), os.path.join(lnd_root,"src","utils"), os.path.join(lnd_root,"src","cpl"), + os.path.join(lnd_root,"src","cpl","utils"), os.path.join(lnd_root,"src","cpl",driver)] if lilac_mode == 'on': diff --git a/src/utils/lnd_import_export_utils.F90 b/src/cpl/utils/lnd_import_export_utils.F90 similarity index 100% rename from src/utils/lnd_import_export_utils.F90 rename to src/cpl/utils/lnd_import_export_utils.F90 From e37d269fe0e98e1aa0fd223196ea02e87fc59328 Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Mon, 24 Aug 2020 08:49:02 -0600 Subject: [PATCH 1365/1973] remove lake_heat allocation and history field --- src/biogeophys/TemperatureType.F90 | 7 ------- src/biogeophys/TotalWaterAndHeatMod.F90 | 1 - 2 files changed, 8 deletions(-) diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index b165ed0796..d9ef9f5cb6 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -279,7 +279,6 @@ subroutine InitAllocate(this, bounds) allocate(this%fact_col (begc:endc, -nlevsno+1:nlevgrnd)) ; this%fact_col (:,:) = nan allocate(this%c_h2osfc_col (begc:endc)) ; this%c_h2osfc_col (:) = nan - allocate(this%lake_heat (begc:endc)) ; this%lake_heat (:) = nan end subroutine InitAllocate !------------------------------------------------------------------------ @@ -621,12 +620,6 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) ptr_patch=this%t_veg10_night_patch, default='inactive') endif - ! add lake heat history field here - this%lake_heat(begc:endc) = spval - call hist_addfld1d (fname='LAKE_HEAT', units='J/m^2', & - avgflag='A', long_name='Heat content of gridcell lake water', & - ptr_col=this%lake_heat, default='active') - end subroutine InitHistory !----------------------------------------------------------------------- diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 6e4ae8624d..b774fe9761 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -919,7 +919,6 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & csol => soilstate_inst%csol_col, & ! heat capacity, soil solids (J/m**3/Kelvin) t_soisno => temperature_inst%t_soisno_col, & ! soil temperature (Kelvin) dynbal_baseline_heat => temperature_inst%dynbal_baseline_heat_col, & ! Input: [real(r8) (:) ] baseline heat content subtracted from each column's total heat calculation (J/m2) - lake_heat => temperature_inst%lake_heat, & ! total heat of lake water (J/m²) h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col, & ! liquid water (kg/m2) h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col & ! frozen water (kg/m2) ) From 1b0c9b730dbd4b31c11c62028166215fcabbdcb8 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 24 Aug 2020 09:57:58 -0600 Subject: [PATCH 1366/1973] Revisions in response to @billsacks review --- src/cpl/lilac/lnd_import_export.F90 | 14 ++++--- src/cpl/mct/lnd_import_export.F90 | 15 +++++--- src/cpl/nuopc/lnd_import_export.F90 | 15 +++++--- src/cpl/utils/lnd_import_export_utils.F90 | 45 +++++++++++++++++++---- 4 files changed, 66 insertions(+), 23 deletions(-) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 4f957387b1..9eb4836337 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -63,6 +63,10 @@ subroutine import_fields( importState, bounds, first_call, rc) integer :: num integer :: begg, endg ! bounds integer :: g,i,k ! indices + real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s + real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_noy(bounds%begg:bounds%endg) real(r8) :: forc_nhx(bounds%begg:bounds%endg) @@ -130,19 +134,19 @@ subroutine import_fields( importState, bounds, first_call, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainc', bounds, & - output=atm2lnd_inst%forc_rainc_grc, rc=rc ) + output=forc_rainc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainl', bounds, & - output=atm2lnd_inst%forc_rainl_grc, rc=rc ) + output=forc_rainl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowc', bounds, & - output=atm2lnd_inst%forc_snowc_grc, rc=rc ) + output=forc_snowc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowl', bounds, & - output=atm2lnd_inst%forc_snowl_grc, rc=rc ) + output=forc_snowl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'c2l_fb_atm', 'Faxa_lwdn', bounds, & @@ -240,7 +244,7 @@ subroutine import_fields( importState, bounds, first_call, rc) ! Derived quantities for required fields !-------------------------- - call derive_quantities(bounds, atm2lnd_inst, water_inst%wateratm2lndbulk_inst) + call derive_quantities(bounds, atm2lnd_inst, water_inst%wateratm2lndbulk_inst, forc_rainc, forc_rainl, forc_snowc, forc_snowl) end subroutine import_fields diff --git a/src/cpl/mct/lnd_import_export.F90 b/src/cpl/mct/lnd_import_export.F90 index b739980376..10486c3bf3 100644 --- a/src/cpl/mct/lnd_import_export.F90 +++ b/src/cpl/mct/lnd_import_export.F90 @@ -44,6 +44,10 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat integer :: g,i,k,nstep,ier ! indices, number of steps, and error code real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) + real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s + real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s real(r8) :: co2_ppmv_diag ! temporary real(r8) :: co2_ppmv_prog ! temporary real(r8) :: co2_ppmv_val ! temporary @@ -103,10 +107,10 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat atm2lnd_inst%forc_t_not_downscaled_grc(g) = x2l(index_x2l_Sa_tbot,i) ! forc_txy Atm state K atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) = x2l(index_x2l_Faxa_lwdn,i) ! flwdsxy Atm flux W/m^2 - atm2lnd_inst%forc_rainc_grc(g) = x2l(index_x2l_Faxa_rainc,i) ! mm/s - atm2lnd_inst%forc_rainl_grc(g) = x2l(index_x2l_Faxa_rainl,i) ! mm/s - atm2lnd_inst%forc_snowc_grc(g) = x2l(index_x2l_Faxa_snowc,i) ! mm/s - atm2lnd_inst%forc_snowl_grc(g) = x2l(index_x2l_Faxa_snowl,i) ! mm/s + forc_rainc(g) = x2l(index_x2l_Faxa_rainc,i) ! mm/s + forc_rainl(g) = x2l(index_x2l_Faxa_rainl,i) ! mm/s + forc_snowc(g) = x2l(index_x2l_Faxa_snowc,i) ! mm/s + forc_snowl(g) = x2l(index_x2l_Faxa_snowl,i) ! mm/s ! atmosphere coupling, for prognostic/prescribed aerosols atm2lnd_inst%forc_aer_grc(g,1) = x2l(index_x2l_Faxa_bcphidry,i) @@ -154,7 +158,8 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat ! Derived quantities for required fields !-------------------------- - call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst) + call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst, & + forc_rainc, forc_rainl, forc_snowc, forc_snowl) ! Determine derived quantities for optional fields ! Note that the following does unit conversions from ppmv to partial pressures (Pa) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index acf2ed9dd1..3c3a1edfe2 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -390,6 +390,10 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) real(r8) :: co2_ppmv_input(bounds%begg:bounds%endg) ! temporary + real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s + real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s + real(r8) :: forc_snowl(bounds%begg:bounds%endg) ! snowfxl Atm flux mm/s real(r8) :: forc_noy(bounds%begg:bounds%endg) real(r8) :: forc_nhx(bounds%begg:bounds%endg) real(r8) :: frac_grc(bounds%begg:bounds%endg, 0:glc_nec) @@ -445,16 +449,16 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_getimport(importState, 'Sa_tbot', bounds, output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_rainc', bounds, output=atm2lnd_inst%forc_rainc_grc, rc=rc ) + call state_getimport(importState, 'Faxa_rainc', bounds, output=forc_rainc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_rainl', bounds, output=atm2lnd_inst%forc_rainl_grc, rc=rc ) + call state_getimport(importState, 'Faxa_rainl', bounds, output=forc_rainl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_snowc', bounds, output=atm2lnd_inst%forc_snowc_grc, rc=rc ) + call state_getimport(importState, 'Faxa_snowc', bounds, output=forc_snowc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_snowl', bounds, output=atm2lnd_inst%forc_snowl_grc, rc=rc ) + call state_getimport(importState, 'Faxa_snowl', bounds, output=forc_snowl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_getimport(importState, 'Faxa_lwdn', bounds, output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) @@ -652,7 +656,8 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! Derived quantities for required fields !-------------------------- - call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst) + call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst, & + forc_rainc, forc_rainl, forc_snowc, forc_snowl) end subroutine import_fields diff --git a/src/cpl/utils/lnd_import_export_utils.F90 b/src/cpl/utils/lnd_import_export_utils.F90 index 3ef49f4039..e7c75a5b4f 100644 --- a/src/cpl/utils/lnd_import_export_utils.F90 +++ b/src/cpl/utils/lnd_import_export_utils.F90 @@ -6,11 +6,13 @@ module lnd_import_export_utils use clm_varctl , only : iulog use decompmod , only : bounds_type use atm2lndType , only : atm2lnd_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type implicit none private ! except public :: derive_quantities + public :: check_for_errors public :: check_for_nans !============================================================================= @@ -19,7 +21,8 @@ module lnd_import_export_utils !=========================================================================== - subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst ) + subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst, & + forc_rainc, forc_rainl, forc_snowc, forc_snowl ) !------------------------------------------------------------------------- ! Convert the input data from the mediator to the land model @@ -27,13 +30,16 @@ subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst ) use clm_varctl, only: co2_ppmv use clm_varcon, only: rair, o2_molar_const - use Wateratm2lndBulkType, only: wateratm2lndbulk_type use QSatMod, only: QSat ! input/output variabes type(bounds_type), intent(in) :: bounds ! bounds type(atm2lnd_type), intent(inout) :: atm2lnd_inst ! clm internal input data type - type(Wateratm2lndbulk_type), intent(inout) :: wateratm2lndbulk_inst + type(wateratm2lndbulk_type), intent(inout) :: wateratm2lndbulk_inst + real(r8), intent(in) :: forc_rainc(bounds%begg:bounds%endg) ! convective rain (mm/s) + real(r8), intent(in) :: forc_rainl(bounds%begg:bounds%endg) ! large scale rain (mm/s) + real(r8), intent(in) :: forc_snowc(bounds%begg:bounds%endg) ! convective snow (mm/s) + real(r8), intent(in) :: forc_snowl(bounds%begg:bounds%endg) ! large scale snow (mm/s) ! local variables integer :: g ! indices @@ -42,7 +48,7 @@ subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst ) real(r8) :: forc_t ! atmospheric temperature (Kelvin) real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) - character(len=*), parameter :: subname='(utils:lnd_import_export_utils)' + character(len=*), parameter :: subname='(cpl:utils:derive_quantities)' !------------------------------------------------------------------------- @@ -75,14 +81,14 @@ subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst ) atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) - wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = atm2lnd_inst%forc_rainc_grc(g) + atm2lnd_inst%forc_rainl_grc(g) - wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = atm2lnd_inst%forc_snowc_grc(g) + atm2lnd_inst%forc_snowl_grc(g) + wateratm2lndbulk_inst%forc_rain_not_downscaled_grc(g) = forc_rainc(g) + forc_rainl(g) + wateratm2lndbulk_inst%forc_snow_not_downscaled_grc(g) = forc_snowc(g) + forc_snowl(g) call QSat(forc_t, forc_pbot, qsat_kg_kg) ! modify specific humidity if precip occurs if (1==2) then - if ((atm2lnd_inst%forc_rainc_grc(g)+atm2lnd_inst%forc_rainl_grc(g)) > 0._r8) then + if ((forc_rainc(g) + forc_rainl(g)) > 0._r8) then forc_q = 0.95_r8 * qsat_kg_kg !forc_q = qsat_kg_kg wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q @@ -92,6 +98,29 @@ subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst ) wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) end do + call check_for_errors(bounds, atm2lnd_inst, wateratm2lndbulk_inst ) + + end subroutine derive_quantities + + !=========================================================================== + + subroutine check_for_errors( bounds, atm2lnd_inst, wateratm2lndbulk_inst ) + + ! input/output variabes + type(bounds_type), intent(in) :: bounds ! bounds + type(atm2lnd_type), intent(inout) :: atm2lnd_inst ! clm internal input data type + type(wateratm2lndbulk_type), intent(inout) :: wateratm2lndbulk_inst + + ! local variables + integer :: g ! indices + integer :: begg, endg ! bounds + character(len=*), parameter :: subname='(cpl:utils:check_for_errors)' + + !------------------------------------------------------------------------- + + ! Set bounds + begg = bounds%begg; endg=bounds%endg + !-------------------------- ! Error checks !-------------------------- @@ -120,7 +149,7 @@ subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst ) ! atm2lnd_inst%forc_rh_grc(g) = min( 100.0_r8, atm2lnd_inst%forc_rh_grc(g) ) ! atm2lnd_inst%forc_rh_grc(g) = max( 0.0_r8, atm2lnd_inst%forc_rh_grc(g) ) - end subroutine derive_quantities + end subroutine check_for_errors !============================================================================= From 30394f88b806ddc6f349572efc45e5fe000a83df Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Mon, 24 Aug 2020 10:09:06 -0600 Subject: [PATCH 1367/1973] Move code to read lakemask to surfd_lakemask routine and clean up --- src/main/surfrdMod.F90 | 75 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index af092daa6b..b9d2e1bb3d 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -292,9 +292,10 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) use fileutils , only : getfil use domainMod , only : domain_type, domain_init, domain_clean use clm_instur , only : wt_lunit, topo_glc_mec - use landunit_varcon, only: max_lunit, istsoil, isturb_MIN, isturb_MAX + use landunit_varcon , only : max_lunit, istsoil, isturb_MIN, isturb_MAX use dynSubgridControlMod, only : get_flanduse_timeseries - use clm_varctl , only : fname_len + use dynSubgridControlMod, only : get_do_transient_lakes + ! ! !ARGUMENTS: integer, intent(in) :: begg, endg, actual_numcft @@ -312,10 +313,8 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) logical :: readvar ! true => variable is on dataset real(r8) :: rmaxlon,rmaxlat ! local min/max vars type(file_desc_t) :: ncid ! netcdf id - type(file_desc_t) :: ncid_dynuse ! netcdf id for landuse timeseries file logical :: istype_domain ! true => input file is of type domain logical :: isgrid2d ! true => intut grid is 2d - character(len=fname_len) :: fdynuse ! landuse.timeseries filename character(len=32) :: subname = 'surfrd_get_data' ! subroutine name !----------------------------------------------------------------------- @@ -450,33 +449,11 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) write(iulog,*) end if + ! read the lakemask (necessary for initialisation of dynamical lakes) + if (get_do_transient_lakes()) then + call surfrd_lakemask(begg, endg) + end if - ! IV: add here call to subroutine to read in lake mask (necessary for initialisation of dynamical lakes) - ! First open landuse.timeseries file for this. - - if (masterproc) then - write(iulog,*) 'Attempting to read landuse.timeseries data .....' - if (lfsurdat == ' ') then - write(iulog,*)'fdynuse must be specified' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - endif - - - ! open landuse_timeseries file - fdynuse = get_flanduse_timeseries() - - call getfil(fdynuse, locfn, 0 ) - - call ncd_pio_openfile (ncid_dynuse, trim(locfn), 0) - - ! read the lakemask - call surfrd_lakemask(begg, endg, ncid_dynuse) - - ! close landuse_timeseries file again - call ncd_pio_closefile(ncid_dynuse) - - end subroutine surfrd_get_data !----------------------------------------------------------------------- @@ -979,7 +956,7 @@ subroutine surfrd_veg_dgvm(begg, endg) end subroutine surfrd_veg_dgvm !----------------------------------------------------------------------- - subroutine surfrd_lakemask(begg, endg, ncid) + subroutine surfrd_lakemask(begg, endg) ! ! !DESCRIPTION: ! Reads the lake mask, indicating where lakes are and will grow @@ -987,25 +964,47 @@ subroutine surfrd_lakemask(begg, endg, ncid) ! Necessary for the initialisation of the lake land units ! ! !USES: - use clm_instur , only : haslake + use clm_instur , only : haslake + use dynSubgridControlMod , only : get_flanduse_timeseries + use clm_varctl , only : fname_len + use fileutils , only : getfil + ! ! !ARGUMENTS: integer, intent(in) :: begg, endg - type(file_desc_t), intent(inout) :: ncid ! ! ! !LOCAL VARIABLES: - logical :: readvar - real(r8),pointer :: haslake_id(:) - ! + type(file_desc_t) :: ncid_dynuse ! netcdf id for landuse timeseries file + character(len=256) :: locfn ! local file name + character(len=fname_len) :: fdynuse ! landuse.timeseries filename + logical :: readvar + real(r8),pointer :: haslake_id(:) ! character(len=*), parameter :: subname = 'surfrd_lakemask' ! !----------------------------------------------------------------------- + ! get filename of landuse_timeseries file + fdynuse = get_flanduse_timeseries() + + if (masterproc) then + write(iulog,*) 'Attempting to read landuse.timeseries data .....' + if (fdynuse == ' ') then + write(iulog,*)'fdynuse must be specified' + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + end if + + call getfil(fdynuse, locfn, 0 ) + + ! open landuse_timeseries file + call ncd_pio_openfile (ncid_dynuse, trim(locfn), 0) + allocate(haslake_id(begg:endg)) - call ncd_io(ncid=ncid, varname='HASLAKE' , flag='read', data=haslake_id, & + ! read the lakemask + call ncd_io(ncid=ncid_dynuse, varname='HASLAKE' , flag='read', data=haslake_id, & dim1name=grlnd, readvar=readvar) if (.not. readvar) call endrun( msg=' ERROR: HASLAKE is not on landuse.timeseries file'//errMsg(sourcefile, __LINE__)) @@ -1015,6 +1014,8 @@ subroutine surfrd_lakemask(begg, endg, ncid) haslake = .false. end where + ! close landuse_timeseries file again + call ncd_pio_closefile(ncid_dynuse) deallocate(haslake_id) From 98151b5a9bbf9d09086cf60b8a86a4d0eccfcb18 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 24 Aug 2020 10:30:25 -0600 Subject: [PATCH 1368/1973] Minor clean-up --- src/main/atm2lndType.F90 | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/main/atm2lndType.F90 b/src/main/atm2lndType.F90 index 949433ea2f..a2d09ca85c 100644 --- a/src/main/atm2lndType.F90 +++ b/src/main/atm2lndType.F90 @@ -89,10 +89,6 @@ module atm2lndType real(r8), pointer :: forc_po2_240_patch (:) => null() ! 10-day mean O2 partial pressure (Pa) real(r8), pointer :: forc_aer_grc (:,:) => null() ! aerosol deposition array real(r8), pointer :: forc_pch4_grc (:) => null() ! CH4 partial pressure (Pa) - real(r8), pointer :: forc_rainc_grc (:) => null() ! convective rain (mm/s) - real(r8), pointer :: forc_rainl_grc (:) => null() ! large scale rain (mm/s) - real(r8), pointer :: forc_snowc_grc (:) => null() ! convective snow (mm/s) - real(r8), pointer :: forc_snowl_grc (:) => null() ! large scale snow (mm/s) real(r8), pointer :: forc_t_not_downscaled_grc (:) => null() ! not downscaled atm temperature (Kelvin) real(r8), pointer :: forc_th_not_downscaled_grc (:) => null() ! not downscaled atm potential temperature (Kelvin) @@ -491,10 +487,6 @@ subroutine InitAllocate(this, bounds) allocate(this%forc_po2_240_patch (begp:endp)) ; this%forc_po2_240_patch (:) = ival allocate(this%forc_pbot240_downscaled_patch(begp:endp)) ; this%forc_pbot240_downscaled_patch (:) = ival endif - allocate(this%forc_rainc_grc (begg:endg)) ; this%forc_rainc_grc (:) = ival - allocate(this%forc_rainl_grc (begg:endg)) ; this%forc_rainl_grc (:) = ival - allocate(this%forc_snowc_grc (begg:endg)) ; this%forc_snowc_grc (:) = ival - allocate(this%forc_snowl_grc (begg:endg)) ; this%forc_snowl_grc (:) = ival ! atm->lnd not downscaled allocate(this%forc_t_not_downscaled_grc (begg:endg)) ; this%forc_t_not_downscaled_grc (:) = ival @@ -1007,10 +999,6 @@ subroutine Clean(this) deallocate(this%forc_po2_grc) deallocate(this%forc_aer_grc) deallocate(this%forc_pch4_grc) - deallocate(this%forc_rainc_grc) - deallocate(this%forc_rainl_grc) - deallocate(this%forc_snowc_grc) - deallocate(this%forc_snowl_grc) ! atm->lnd not downscaled deallocate(this%forc_t_not_downscaled_grc) From 32df50ab5d43a9d2e25384f7c74877675f43a48e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 24 Aug 2020 14:42:42 -0600 Subject: [PATCH 1369/1973] updates for running single column --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 79 ++++++++++++++++---------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index ef85e6dc5c..5aa668f416 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -656,13 +656,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! create the mesh from the grid - gridmesh = ESMF_MeshCreate(lgrid, rc=rc) + mesh = ESMF_MeshCreate(lgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Now redistribute the mesh to use the internal distrid - mesh = ESMF_MeshCreate(gridmesh, elementDistgrid=Distgrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return else + ! read in the mesh from the file mesh = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, & elementDistgrid=Distgrid, rc=rc) @@ -670,15 +668,16 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (masterproc) then write(iulog,*)'mesh file for domain is ',trim(model_meshfile) end if - end if - ! Determine the areas on the mesh - areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='mesh_areas', meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldRegridGetArea(areaField, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(areaField, farrayPtr=areaPtr, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Determine the areas on the mesh + areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='mesh_areas', meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldRegridGetArea(areaField, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(areaField, farrayPtr=areaPtr, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + end if ! realize the actively coupled fields call realize_fields(gcomp, mesh, flds_scalar_name, flds_scalar_num, rc) @@ -695,33 +694,35 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! obtain mesh lats and lons !-------------------------------- - call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ownedElemCoords(spatialDim*numOwnedElements)) - call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = bounds%begg,bounds%endg - n = 1 + (g - bounds%begg) - mesh_lon = ownedElemCoords(2*n-1) - mesh_lat = ownedElemCoords(2*n) - mesh_area = areaPtr(n) - if (abs(mesh_lon - ldomain%lonc(g)) > tolerance_latlon) then - write(6,100)'ERROR: clm_lon, mesh_lon, diff_lon = ',& - ldomain%lonc(g), mesh_lon, abs(mesh_lon - ldomain%lonc(g)) - !call shr_sys_abort() - end if - if (abs(mesh_lat - ldomain%latc(g)) > tolerance_latlon) then - write(6,100)'ERROR: clm_lat, mesh_lat, diff_lat = ',& - ldomain%latc(g), mesh_lat, abs(mesh_lat - ldomain%latc(g)) - !call shr_sys_abort() - end if - if (abs(mesh_area - ldomain%area(g)/(re*re)) > tolerance_area) then - write(6,100)'ERROR: clm_area, mesh_area, diff_area = ',& - ldomain%area(g)/(re*re), mesh_area, abs(mesh_area - ldomain%area(g)/(re*re)) - !call shr_sys_abort() - end if - end do -100 format(a,3(d13.5,2x)) + if (trim(model_meshfile) /= 'create_mesh') then + call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(ownedElemCoords(spatialDim*numOwnedElements)) + call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = bounds%begg,bounds%endg + n = 1 + (g - bounds%begg) + mesh_lon = ownedElemCoords(2*n-1) + mesh_lat = ownedElemCoords(2*n) + mesh_area = areaPtr(n) + if (abs(mesh_lon - ldomain%lonc(g)) > tolerance_latlon) then + write(6,100)'ERROR: clm_lon, mesh_lon, diff_lon = ',& + ldomain%lonc(g), mesh_lon, abs(mesh_lon - ldomain%lonc(g)) + !call shr_sys_abort() + end if + if (abs(mesh_lat - ldomain%latc(g)) > tolerance_latlon) then + write(6,100)'ERROR: clm_lat, mesh_lat, diff_lat = ',& + ldomain%latc(g), mesh_lat, abs(mesh_lat - ldomain%latc(g)) + !call shr_sys_abort() + end if + if (abs(mesh_area - ldomain%area(g)/(re*re)) > tolerance_area) then + write(6,100)'ERROR: clm_area, mesh_area, diff_area = ',& + ldomain%area(g)/(re*re), mesh_area, abs(mesh_area - ldomain%area(g)/(re*re)) + !call shr_sys_abort() + end if + end do +100 format(a,3(d13.5,2x)) + end if !-------------------------------- ! Create land export state From 7cc78f9e5d2a17536fce130d1fb0e9ee978d5608 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 25 Aug 2020 00:58:11 -0600 Subject: [PATCH 1370/1973] Update externals for latest nuopc dev branch --- Externals.cfg | 7 +++++++ Externals_cime.cfg | 16 +--------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 28ee03e951..2acf69ca69 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -26,6 +26,13 @@ repo_url = https://github.com/ESCOMP/MOSART tag = mosart1_0_37 required = True +[cdeps] +hash = 45b7a85 +protocol = git +repo_url = https://github.com/ESCOMP/CDEPS.git +local_path = components/cdeps +required = True + [cime] local_path = cime protocol = git diff --git a/Externals_cime.cfg b/Externals_cime.cfg index a9df9d0698..a4ef9d88e8 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,23 +1,9 @@ [cmeps] -hash = cab9030 +hash = 7654038 protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ required = True -[fox] -hash = 0ed59c1 -protocol = git -repo_url = https://github.com/ESMCI/fox.git -local_path = src/externals/fox -required = True - -[cdeps] -hash = d7b8a4c8e1b7cbff88da5bdb782ab715de62468a -protocol = git -repo_url = https://github.com/ESCOMP/CDEPS.git -local_path = src/components/cdeps -required = True - [externals_description] schema_version = 1.0.0 From b161b927699d62f2105404f5baf1c9a161fbbc34 Mon Sep 17 00:00:00 2001 From: wwieder Date: Tue, 25 Aug 2020 06:12:18 -0600 Subject: [PATCH 1371/1973] updates to current surfdata & landuse files --- tools/contrib/singlept | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/contrib/singlept b/tools/contrib/singlept index 076e67453b..fd82eaf6a2 100755 --- a/tools/contrib/singlept +++ b/tools/contrib/singlept @@ -145,11 +145,12 @@ fdomain = dir_inputdata+'share/domains/domain.lnd.fv0.9x1.25_gx1v7.151020.nc' fdomain2 = dir_output + AddTagToFilename( fdomain, tag ) #-- Specify surface data file -------------------------------- -fsurf = dir_inputdata+'lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_CMIP6_simyr1850_c170706.nc' +fsurf = dir_inputdata+'lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc' + fsurf2 = dir_output + AddTagToFilename( fsurf, tag ) #-- Specify landuse file ------------------------------------- -fluse = dir_inputdata+'lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc' +fluse = dir_inputdata+'lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c190214.nc' fluse2 = dir_output + AddTagToFilename( fluse, tag ) #-- Specify datm domain file --------------------------------- From 796514c6f7311097a9cd4fb3c097388d51deacb4 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 25 Aug 2020 10:24:23 -0600 Subject: [PATCH 1372/1973] Move the call check_for_errors ...from within subroutine derive_quantities to after each call derive_quantities --- src/cpl/lilac/lnd_import_export.F90 | 5 ++++- src/cpl/mct/lnd_import_export.F90 | 5 ++++- src/cpl/nuopc/lnd_import_export.F90 | 5 ++++- src/cpl/utils/lnd_import_export_utils.F90 | 2 -- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 9eb4836337..e5a405e089 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -15,7 +15,7 @@ module lnd_import_export use atm2lndType , only : atm2lnd_type use lnd_shr_methods , only : chkerr use shr_megan_mod , only : shr_megan_mechcomps_n ! TODO: need to add a namelist read here (see https://github.com/ESCOMP/CTSM/issues/926) - use lnd_import_export_utils, only : derive_quantities, check_for_nans + use lnd_import_export_utils, only : derive_quantities, check_for_errors, check_for_nans implicit none private ! except @@ -242,10 +242,13 @@ subroutine import_fields( importState, bounds, first_call, rc) !-------------------------- ! Derived quantities for required fields + ! and corresponding error checks !-------------------------- call derive_quantities(bounds, atm2lnd_inst, water_inst%wateratm2lndbulk_inst, forc_rainc, forc_rainl, forc_snowc, forc_snowl) + call check_for_errors(bounds, atm2lnd_inst, wateratm2lndbulk_inst) + end subroutine import_fields !=============================================================================== diff --git a/src/cpl/mct/lnd_import_export.F90 b/src/cpl/mct/lnd_import_export.F90 index 10486c3bf3..459faeadcd 100644 --- a/src/cpl/mct/lnd_import_export.F90 +++ b/src/cpl/mct/lnd_import_export.F90 @@ -29,7 +29,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat use clm_varctl , only: ndep_from_cpl use clm_varcon , only: c13ratio use domainMod , only: ldomain - use lnd_import_export_utils, only : derive_quantities, check_for_nans + use lnd_import_export_utils, only : derive_quantities, check_for_errors, check_for_nans ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds ! bounds @@ -156,11 +156,14 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat !-------------------------- ! Derived quantities for required fields + ! and corresponding error checks !-------------------------- call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst, & forc_rainc, forc_rainl, forc_snowc, forc_snowl) + call check_for_errors(bounds, atm2lnd_inst, wateratm2lndbulk_inst) + ! Determine derived quantities for optional fields ! Note that the following does unit conversions from ppmv to partial pressures (Pa) ! Note that forc_pbot is in Pa diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 3c3a1edfe2..f468eede7a 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -24,7 +24,7 @@ module lnd_import_export use shr_carma_mod , only : shr_carma_readnl use shr_ndep_mod , only : shr_ndep_readnl use lnd_shr_methods , only : chkerr - use lnd_import_export_utils, only : derive_quantities, check_for_nans + use lnd_import_export_utils, only : derive_quantities, check_for_errors, check_for_nans implicit none private ! except @@ -654,11 +654,14 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & !-------------------------- ! Derived quantities for required fields + ! and corresponding error checks !-------------------------- call derive_quantities(bounds, atm2lnd_inst, wateratm2lndbulk_inst, & forc_rainc, forc_rainl, forc_snowc, forc_snowl) + call check_for_errors(bounds, atm2lnd_inst, wateratm2lndbulk_inst) + end subroutine import_fields !=============================================================================== diff --git a/src/cpl/utils/lnd_import_export_utils.F90 b/src/cpl/utils/lnd_import_export_utils.F90 index e7c75a5b4f..c02e1a18dc 100644 --- a/src/cpl/utils/lnd_import_export_utils.F90 +++ b/src/cpl/utils/lnd_import_export_utils.F90 @@ -98,8 +98,6 @@ subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst, & wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) end do - call check_for_errors(bounds, atm2lnd_inst, wateratm2lndbulk_inst ) - end subroutine derive_quantities !=========================================================================== From 1b6393123b1de70cdbc332eaedb021b413aa77ea Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 25 Aug 2020 22:53:22 -0600 Subject: [PATCH 1373/1973] Point to branch tag for cime --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 2acf69ca69..d2e6d3ad37 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -37,7 +37,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.31 +tag = branch_tags/cime5.8.31_a01 externals = ../Externals_cime.cfg required = True From 3fe5bb5f8f2f96a98e25e86695c835b298d95b98 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 26 Aug 2020 06:21:57 -0600 Subject: [PATCH 1374/1973] fix assign sring to logical --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 5aa668f416..e8b1b76f5a 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -300,7 +300,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (isPresent .and. isSet) then call ESMF_LogWrite(trim(subname)//' cism_evolve = '//trim(cvalue), ESMF_LOGMSG_INFO) - write (cism_evolve,*) cvalue + if (trim(cvalue) .eq. '.true.') then + cism_evolve = .true. + else if (trim(cvalue) .eq. '.false.') then + cism_evolve = .false. + else + call shr_sys_abort(subname//'Could not determine cism_evolve value '//trim(cvalue)) + endif else call shr_sys_abort(subname//'Need to set cism_evolve if glc is present') endif @@ -549,7 +555,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !---------------------------------------------------------------------------- model_clock = clock - + !---------------------- ! Read namelist, grid and surface data !---------------------- @@ -909,7 +915,7 @@ subroutine ModelAdvance(gcomp, rc) caldayp1 = get_curr_calday(offset=dtime) if (nstep == 0) then - doalb = .false. + doalb = .false. else if (nstep == 1) then doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) else From 725f9d60a808d1237863fa3c6e9972669baf0873 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 26 Aug 2020 09:12:20 -0700 Subject: [PATCH 1375/1973] updating need_lightning_and_popdens in fates fire data types for interface refactor --- src/biogeochem/FATESFireDataMod.F90 | 27 ++++++++++++--------------- src/biogeochem/FATESFireNoDataMod.F90 | 27 ++++++++++++--------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/biogeochem/FATESFireDataMod.F90 b/src/biogeochem/FATESFireDataMod.F90 index f545709376..ce842cbf1c 100644 --- a/src/biogeochem/FATESFireDataMod.F90 +++ b/src/biogeochem/FATESFireDataMod.F90 @@ -25,6 +25,7 @@ module FATESFireDataMod real(r8), private, pointer :: lnfm24(:) ! Daily avg lightning by grid cell (#/km2/hr) contains ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: need_lightning_and_popdens procedure, public :: GetLight24 ! Return 24-hour averaged lightning data procedure, public :: InitAccBuffer ! Initialize accumulation processes procedure, public :: InitAccVars ! Initialize accumulation variables @@ -33,26 +34,22 @@ module FATESFireDataMod end type fates_fire_data_type character(len=*), parameter, private :: sourcefile = __FILE__ - ! - ! !PRIVATE MEMBER DATA: - !----------------------------------------------------------------------- - - interface fates_fire_data_type - ! initialize a new cnfire_base object - module procedure constructor - end interface fates_fire_data_type - !----------------------------------------------------------------------- contains !------------------------------------------------------------------------ - type(fates_fire_data_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type fates_fire_data_type + function need_lightning_and_popdens(this) ! !ARGUMENTS: - constructor%need_lightning_and_popdens = .true. - end function constructor + class(fates_fire_data_type), intent(in) :: this + logical :: need_lightning_and_popdens ! function result + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'need_lightning_and_popdens' + !----------------------------------------------------------------------- + + need_lightning_and_popdens = .true. + end function need_lightning_and_popdens !----------------------------------------------------------------------- function GetLight24( this ) result(lnfm24) diff --git a/src/biogeochem/FATESFireNoDataMod.F90 b/src/biogeochem/FATESFireNoDataMod.F90 index 10f7f57a68..3597bef678 100644 --- a/src/biogeochem/FATESFireNoDataMod.F90 +++ b/src/biogeochem/FATESFireNoDataMod.F90 @@ -27,6 +27,7 @@ module FATESFireNoDataMod contains ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: need_lightning_and_popdens procedure, public :: GetLight24 ! Return the 24-hour averaged lightning data procedure, public :: InitAccBuffer ! Initialize accumulation processes procedure, public :: InitAccVars ! Initialize accumulation variables @@ -35,26 +36,22 @@ module FATESFireNoDataMod end type fates_fire_no_data_type character(len=*), parameter, private :: sourcefile = __FILE__ - ! - ! !PRIVATE MEMBER DATA: - !----------------------------------------------------------------------- - - interface fates_fire_no_data_type - ! initialize a new cnfire_base object - module procedure constructor - end interface fates_fire_no_data_type - !----------------------------------------------------------------------- contains !------------------------------------------------------------------------ - type(fates_fire_no_data_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type fates_fire_no_data_type + function need_lightning_and_popdens(this) ! !ARGUMENTS: - constructor%need_lightning_and_popdens = .false. - end function constructor + class(fates_fire_no_data_type), intent(in) :: this + logical :: need_lightning_and_popdens ! function result + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'need_lightning_and_popdens' + !----------------------------------------------------------------------- + + need_lightning_and_popdens = .false. + end function need_lightning_and_popdens !----------------------------------------------------------------------- function GetLight24( this ) result(lnfm24) From 62ff02fade3f714cec8d99e17c93b4cca2f7b0c2 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 26 Aug 2020 11:20:05 -0700 Subject: [PATCH 1376/1973] correcting error in create_cnfire_method due to merge --- src/biogeochem/CNFireFactoryMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index 30e2812d16..e96c90b4aa 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -132,7 +132,7 @@ subroutine create_cnfire_method( NLFilename, cnfire_method ) end select call cnfire_method%CNFireReadNML( NLFilename ) - end function create_cnfire_method + end subroutine create_cnfire_method !----------------------------------------------------------------------- !----------------------------------------------------------------------- From f52d48262aa534d72f70ef15a6dfeed2b8722be4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 26 Aug 2020 13:30:36 -0600 Subject: [PATCH 1377/1973] Remove change to use PIO-1 as PIO-2 is now required this fixes #1067 --- python/ctsm/lilac_build_ctsm.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 967542f356..b13baeba87 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -613,11 +613,6 @@ def _create_case(cime_path, build_dir, compiler, run_cmd_output_on_error(create_newcase_cmd, errmsg='Problem creating CTSM case directory') - # PIO2 sometimes causes errors: see - # https://github.com/ESCOMP/CTSM/issues/876#issuecomment-653189406 and following - # comments in that issue. So use PIO1 for now. - subprocess.check_call([xmlchange, 'PIO_VERSION=1'], cwd=case_dir) - subprocess.check_call([xmlchange, 'LILAC_MODE=on'], cwd=case_dir) if build_debug: subprocess.check_call([xmlchange, 'DEBUG=TRUE'], cwd=case_dir) From d6218030b09d682b4230ecb243897422d3298b8f Mon Sep 17 00:00:00 2001 From: Daniel Kennedy Date: Wed, 26 Aug 2020 15:07:04 -0600 Subject: [PATCH 1378/1973] working patch HR --- src/biogeophys/SoilWaterPlantSinkMod.F90 | 33 +++++++++++++++--------- src/biogeophys/WaterFluxBulkType.F90 | 13 ++++++++-- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/biogeophys/SoilWaterPlantSinkMod.F90 b/src/biogeophys/SoilWaterPlantSinkMod.F90 index 290ba8c164..115e1cab76 100644 --- a/src/biogeophys/SoilWaterPlantSinkMod.F90 +++ b/src/biogeophys/SoilWaterPlantSinkMod.F90 @@ -274,27 +274,30 @@ subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress( bounds, & integer :: pi ! patch index real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting real(r8) :: grav2 ! soil layer gravitational potential relative to surface (mm H2O) + real(r8) :: patchflux ! patch level soil-to-plant water flux (mm/s) integer , parameter :: soil=1,root=4 ! index values !----------------------------------------------------------------------- associate(& - k_soil_root => soilstate_inst%k_soil_root_patch , & ! Input: [real(r8) (:,:) ] + k_soil_root => soilstate_inst%k_soil_root_patch , & ! Input: [real(r8) (:,:) ] ! soil-root interface conductance (mm/s) - qflx_phs_neg_col => waterfluxbulk_inst%qflx_phs_neg_col , & ! Input: [real(r8) (:) ] n - ! net neg hydraulic redistribution flux(mm H2O/s) - qflx_tran_veg_col => waterfluxbulk_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] + qflx_phs_neg_col => waterfluxbulk_inst%qflx_phs_neg_col , & ! Output: [real(r8) (:) ] + ! net neg hydraulic redistribution flux col (mm H2O/s) + qflx_hydr_redist_patch => waterfluxbulk_inst%qflx_hydr_redist_patch, & ! Output: [real(r8) (:) ] + ! net neg hydraulic redistribution flux patch (mm H2O/s) + qflx_tran_veg_col => waterfluxbulk_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_tran_veg_patch => waterfluxbulk_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] + qflx_tran_veg_patch => waterfluxbulk_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:) ] + qflx_rootsoi_col => waterfluxbulk_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:) ] ! col root and soil water ! exchange [mm H2O/s] [+ into root] - smp => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix pot. [mm] - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] + smp => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix pot. [mm] + frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] ! fraction of vegetation not ! covered by snow (0 OR 1) [-] - z => col%z , & ! Input: [real(r8) (:,:) ] layer node depth (m) - vegwp => canopystate_inst%vegwp_patch & ! Input: [real(r8) (:,:) ] vegetation water + z => col%z , & ! Input: [real(r8) (:,:) ] layer node depth (m) + vegwp => canopystate_inst%vegwp_patch & ! Input: [real(r8) (:,:) ] vegetation water ! matric potential (mm) ) @@ -308,10 +311,16 @@ subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress( bounds, & do pi = 1,max_patch_per_col if (pi <= col%npatches(c)) then p = col%patchi(c) + pi - 1 + if (j == 1) then + qflx_hydr_redist_patch(p) = 0._r8 + end if if (patch%active(p).and.frac_veg_nosno(p)>0) then if (patch%wtcol(p) > 0._r8) then - temp(c) = temp(c) + k_soil_root(p,j) & - * (smp(c,j) - vegwp(p,4) - grav2)* patch%wtcol(p) + patchflux = k_soil_root(p,j) * (smp(c,j) - vegwp(p,4) - grav2) + if (patchflux <0) then + qflx_hydr_redist_patch(p) = qflx_hydr_redist_patch(p) + patchflux + end if + temp(c) = temp(c) + patchflux * patch%wtcol(p) endif end if end if diff --git a/src/biogeophys/WaterFluxBulkType.F90 b/src/biogeophys/WaterFluxBulkType.F90 index 9936eec293..cfdd365deb 100644 --- a/src/biogeophys/WaterFluxBulkType.F90 +++ b/src/biogeophys/WaterFluxBulkType.F90 @@ -40,6 +40,7 @@ module WaterFluxBulkType real(r8), pointer :: qflx_adv_col (:,:) ! col advective flux across different soil layer interfaces [mm H2O/s] [+ downward] real(r8), pointer :: qflx_rootsoi_col (:,:) ! col root and soil water exchange [mm H2O/s] [+ into root] + real(r8), pointer :: qflx_hydr_redist_patch (:) ! patch hydraulic redistribution [mm H2O/s] real(r8), pointer :: qflx_sat_excess_surf_col (:) ! col surface runoff due to saturated surface (mm H2O /s) real(r8), pointer :: qflx_infl_excess_col (:) ! col infiltration excess runoff (mm H2O /s) real(r8), pointer :: qflx_infl_excess_surf_col(:) ! col surface runoff due to infiltration excess (mm H2O /s) @@ -112,8 +113,8 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%qflx_snowindunload_patch (begp:endp)) ; this%qflx_snowindunload_patch (:) = nan allocate(this%qflx_snotempunload_patch (begp:endp)) ; this%qflx_snotempunload_patch (:) = nan - - allocate(this%qflx_phs_neg_col (begc:endc)) ; this%qflx_phs_neg_col (:) = nan + allocate(this%qflx_hydr_redist_patch (begp:endp)) ; this%qflx_hydr_redist_patch (:) = nan + allocate(this%qflx_phs_neg_col (begc:endc)) ; this%qflx_phs_neg_col (:) = nan allocate( this%qflx_ev_snow_patch (begp:endp)) ; this%qflx_ev_snow_patch (:) = nan allocate( this%qflx_ev_snow_col (begc:endc)) ; this%qflx_ev_snow_col (:) = nan @@ -186,6 +187,14 @@ subroutine InitBulkHistory(this, bounds) long_name=this%info%lname('water flux from soil to root in each soil-layer'), & ptr_col=this%qflx_rootsoi_col, set_spec=spval, l2g_scale_type='veg', default='inactive') + this%qflx_hydr_redist_patch(begp:endp) = spval + call hist_addfld1d ( & + fname=this%info%fname('QHR'), & + units='mm/s', & + avgflag='A', & + long_name=this%info%lname('hydraulic redistribution'), & + ptr_patch=this%qflx_hydr_redist_patch, set_spec=spval, l2g_scale_type='veg', default='inactive') + this%qflx_snowindunload_patch(begp:endp) = spval call hist_addfld1d ( & fname=this%info%fname('QSNO_WINDUNLOAD'), & From 664eabac186f984f387d36b6e1347f24f1c66a33 Mon Sep 17 00:00:00 2001 From: Daniel Kennedy Date: Thu, 27 Aug 2020 10:07:33 -0600 Subject: [PATCH 1379/1973] add VPD_CAN and predawn and local noon vegwp --- src/biogeophys/CanopyStateType.F90 | 13 ++++++++- src/biogeophys/PhotosynthesisMod.F90 | 40 ++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/biogeophys/CanopyStateType.F90 b/src/biogeophys/CanopyStateType.F90 index a073486eea..f2a351cded 100644 --- a/src/biogeophys/CanopyStateType.F90 +++ b/src/biogeophys/CanopyStateType.F90 @@ -48,6 +48,8 @@ module CanopyStateType real(r8) , pointer :: rscanopy_patch (:) ! patch canopy stomatal resistance (s/m) (ED specific) real(r8) , pointer :: vegwp_patch (:,:) ! patch vegetation water matric potential (mm) + real(r8) , pointer :: vegwp_ln_patch (:,:) ! patch vegetation water matric potential at local noon (mm) + real(r8) , pointer :: vegwp_pd_patch (:,:) ! patch vegetation water matric potential from 12am-2am (mm) real(r8) :: leaf_mr_vcm = spval ! Scalar constant of leaf respiration with Vcmax @@ -131,7 +133,8 @@ subroutine InitAllocate(this, bounds) allocate(this%rscanopy_patch (begp:endp)) ; this%rscanopy_patch (:) = nan ! allocate(this%gccanopy_patch (begp:endp)) ; this%gccanopy_patch (:) = 0.0_r8 allocate(this%vegwp_patch (begp:endp,1:nvegwcs)) ; this%vegwp_patch (:,:) = nan - + allocate(this%vegwp_ln_patch (begp:endp,1:nvegwcs)) ; this%vegwp_ln_patch (:,:) = nan + allocate(this%vegwp_pd_patch (begp:endp,1:nvegwcs)) ; this%vegwp_pd_patch (:,:) = nan end subroutine InitAllocate !----------------------------------------------------------------------- @@ -243,6 +246,14 @@ subroutine InitHistory(this, bounds) call hist_addfld2d (fname='VEGWP', units='mm', type2d='nvegwcs', & avgflag='A', long_name='vegetation water matric potential for sun/sha canopy,xyl,root segments', & ptr_patch=this%vegwp_patch) + this%vegwp_ln_patch(begp:endp,:) = spval + call hist_addfld2d (fname='VEGWPLN', units='mm', type2d='nvegwcs', & + avgflag='A', long_name='vegetation water matric potential for sun/sha canopy,xyl,root at local noon', & + ptr_patch=this%vegwp_ln_patch) + this%vegwp_pd_patch(begp:endp,:) = spval + call hist_addfld2d (fname='VEGWPPD', units='mm', type2d='nvegwcs', avgflag='A', & + long_name='vegetation water matric potential for sun/sha canopy,xyl,root for predawn (b/w 12 and 2am)', & + ptr_patch=this%vegwp_pd_patch) end if end subroutine InitHistory diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 023b39898f..65d2920540 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -148,7 +148,7 @@ module PhotosynthesisMod real(r8), pointer, private :: gs_mol_patch (:,:) ! patch leaf stomatal conductance (umol H2O/m**2/s) real(r8), pointer, private :: gb_mol_patch (:) ! patch leaf boundary layer conductance (umol H2O/m**2/s) real(r8), pointer, private :: rh_leaf_patch (:) ! patch fractional humidity at leaf surface (dimensionless) - + real(r8), pointer, private :: vpd_can_patch (:) ! patch canopy vapor pressure deficit (kPa) real(r8), pointer, private :: alphapsnsun_patch (:) ! patch sunlit 13c fractionation ([]) real(r8), pointer, private :: alphapsnsha_patch (:) ! patch shaded 13c fractionation ([]) @@ -293,7 +293,7 @@ subroutine InitAllocate(this, bounds) allocate(this%mbb_patch (begp:endp)) ; this%mbb_patch (:) = nan allocate(this%gb_mol_patch (begp:endp)) ; this%gb_mol_patch (:) = nan allocate(this%rh_leaf_patch (begp:endp)) ; this%rh_leaf_patch (:) = nan - + allocate(this%vpd_can_patch (begp:endp)) ; this%vpd_can_patch (:) = nan allocate(this%psnsun_patch (begp:endp)) ; this%psnsun_patch (:) = nan allocate(this%psnsha_patch (begp:endp)) ; this%psnsha_patch (:) = nan allocate(this%c13_psnsun_patch (begp:endp)) ; this%c13_psnsun_patch (:) = nan @@ -376,6 +376,14 @@ subroutine InitHistory(this, bounds) call hist_addfld1d (fname='RH_LEAF', units='fraction', & avgflag='A', long_name='fractional humidity at leaf surface', & ptr_patch=this%rh_leaf_patch, set_spec=spval, default='inactive') + + this%vpd_can_patch(begp:endp) = spval + call hist_addfld1d (fname='VPD_CAN', units='kPa', & + avgflag='A', long_name='canopy vapor pressure deficit', & + ptr_patch=this%vpd_can_patch, set_spec=spval, default='inactive') + + + this%lnca_patch(begp:endp) = spval call hist_addfld1d (fname='LNC', units='gN leaf/m^2', & avgflag='A', long_name='leaf N concentration', & @@ -1224,6 +1232,7 @@ subroutine Photosynthesis ( bounds, fn, filterp, & bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) mbb => photosyns_inst%mbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship rh_leaf => photosyns_inst%rh_leaf_patch , & ! Output: [real(r8) (:) ] fractional humidity at leaf surface (dimensionless) + vpd_can => photosyns_inst%vpd_can_patch , & ! Output: [real(r8) (:) ] canopy vapor pressure deficit (kPa) lnc => photosyns_inst%lnca_patch , & ! Output: [real(r8) (:) ] top leaf layer leaf N concentration (gN leaf/m^2) light_inhibit=> photosyns_inst%light_inhibit , & ! Input: [logical ] flag if light should inhibit respiration leafresp_method=> photosyns_inst%leafresp_method , & ! Input: [integer ] method type to use for leaf-maint.-respiration at 25C canopy top @@ -1646,6 +1655,7 @@ subroutine Photosynthesis ( bounds, fn, filterp, & else if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then ! Put some constraints on RH in the canopy when Medlyn stomatal conductance is being used rh_can = max((esat_tv(p) - ceair), 50._r8) * 0.001_r8 + vpd_can(p) = rh_can end if ! Electron transport rate for C3 plants. Convert par from W/m2 to @@ -3310,7 +3320,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & end if !find ci and stomatal conductance - call hybrid_PHS(ci_z_sun(p,iv), ci_z_sha(p,iv), p, iv, c, gb_mol(p), bsun(p),bsha(p), je_sun, & + call hybrid_PHS(ci_z_sun(p,iv), ci_z_sha(p,iv), p, iv, c, g, gb_mol(p), bsun(p),bsha(p), je_sun, & je_sha, cair(p), oair(p), lmr_z_sun(p,iv), lmr_z_sha(p,iv), & par_z_sun(p,iv), par_z_sha(p,iv), rh_can, gs_mol_sun(p,iv), gs_mol_sha(p,iv), & qsatl(p), qaf(p), iter1, iter2, atm2lnd_inst, photosyns_inst, & @@ -3534,7 +3544,7 @@ end subroutine PhotosynthesisHydraulicStress !------------------------------------------------------------------------------ !-------------------------------------------------------------------------------- - subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, gb_mol, bsun, bsha, jesun, jesha, & + subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, g, gb_mol, bsun, bsha, jesun, jesha, & cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha, rh_can, & gs_mol_sun, gs_mol_sha, qsatl, qaf, iter1, iter2, atm2lnd_inst, photosyns_inst, & canopystate_inst, waterdiagnosticbulk_inst, soilstate_inst, temperature_inst, waterfluxbulk_inst) @@ -3551,6 +3561,7 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, gb_mol, bsun, bsha, jesun, jesha, ! ! !!USES: + use clm_time_manager , only : is_near_local_noon, get_local_time ! !! ARGUMENTS: implicit none @@ -3558,6 +3569,7 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, gb_mol, bsun, bsha, jesun, jesha, integer , intent(in) :: p ! pft index integer , intent(in) :: iv ! radiation canopy layer index integer , intent(in) :: c ! column index + integer , intent(in) :: g ! gridcell index real(r8), intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) real(r8), intent(out) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1) real(r8), intent(out) :: bsha ! shaded canopy transpiration wetness factor (0 to 1) @@ -3618,7 +3630,9 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, gb_mol, bsun, bsha, jesun, jesha, associate( & qflx_tran_veg => waterfluxbulk_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - vegwp => canopystate_inst%vegwp_patch & ! Input/Output: [real(r8) (:,:) ] vegetation water matric potential (mm) + vegwp => canopystate_inst%vegwp_patch ,& ! Input/Output: [real(r8) (:,:) ] vegetation water matric potential (mm) + vegwp_ln => canopystate_inst%vegwp_ln_patch & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) at local noon + vegwp_pd => canopystate_inst%vegwp_ln_patch & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) between midnight and 2am local time ) @@ -3767,6 +3781,22 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, gb_mol, bsun, bsha, jesun, jesha, call getvegwp(p, c, x, gb_mol, gs_mol_sun, gs_mol_sha, qsatl, qaf, soilflux, & atm2lnd_inst, canopystate_inst, waterdiagnosticbulk_inst, soilstate_inst, temperature_inst) vegwp(p,:)=x + + !write out local noon vwp (within +/- 1hr) + if ( is_near_local_noon( grc%londeg(g), deltasec=3600 ) )then + vegwp_ln(p,:) = vegwp(p,:) + else + vegwp_ln(p,:) = spval + end if + + !write out predawn vwp (averaged over midnight to 2am) + if ( get_local_time( grc%londeg(g)) <= 7200._r8 )then + vegwp_pd(p,:) = vegwp(p,:) + else + vegwp_pd(p,:) = spval + end if + + if (soilflux<0._r8) soilflux = 0._r8 qflx_tran_veg(p) = soilflux From ba8bd748aadd15cf473b5631d079029cfde897af Mon Sep 17 00:00:00 2001 From: Daniel Kennedy Date: Thu, 27 Aug 2020 10:51:10 -0600 Subject: [PATCH 1380/1973] add vpd_can with PHS --- src/biogeophys/PhotosynthesisMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 65d2920540..1bc1d85649 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -2740,6 +2740,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) mbb => photosyns_inst%mbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship rh_leaf => photosyns_inst%rh_leaf_patch , & ! Output: [real(r8) (:) ] fractional humidity at leaf surface (dimensionless) + vpd_can => photosyns_inst%vpd_can_patch , & ! Output: [real(r8) (:) ] canopy vapor pressure deficit (kPa) lnc => photosyns_inst%lnca_patch , & ! Output: [real(r8) (:) ] top leaf layer leaf N concentration (gN leaf/m^2) light_inhibit=> photosyns_inst%light_inhibit , & ! Input: [logical ] flag if light should inhibit respiration leafresp_method=> photosyns_inst%leafresp_method , & ! Input: [integer ] method type to use for leaf-maint.-respiration at 25C canopy top @@ -3288,6 +3289,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & else if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then ! Put some constraints on RH in the canopy when Medlyn stomatal conductance is being used rh_can = max((esat_tv(p) - ceair), 50._r8) * 0.001_r8 + vpd_can(p) = rh_can end if ! Electron transport rate for C3 plants. Convert par from W/m2 to @@ -3631,7 +3633,7 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, g, gb_mol, bsun, bsha, jesun, jesh associate( & qflx_tran_veg => waterfluxbulk_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) vegwp => canopystate_inst%vegwp_patch ,& ! Input/Output: [real(r8) (:,:) ] vegetation water matric potential (mm) - vegwp_ln => canopystate_inst%vegwp_ln_patch & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) at local noon + vegwp_ln => canopystate_inst%vegwp_ln_patch ,& ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) at local noon vegwp_pd => canopystate_inst%vegwp_ln_patch & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) between midnight and 2am local time ) From be4af0ed7912ac30710641f90c3f10e03143d898 Mon Sep 17 00:00:00 2001 From: Daniel Kennedy Date: Thu, 27 Aug 2020 11:32:34 -0600 Subject: [PATCH 1381/1973] rework implementation of vegwp_pd --- src/biogeophys/PhotosynthesisMod.F90 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 1bc1d85649..85e3e46a12 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -3563,7 +3563,7 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, g, gb_mol, bsun, bsha, jesun, jesh ! ! !!USES: - use clm_time_manager , only : is_near_local_noon, get_local_time + use clm_time_manager , only : is_near_local_noon ! !! ARGUMENTS: implicit none @@ -3633,8 +3633,7 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, g, gb_mol, bsun, bsha, jesun, jesh associate( & qflx_tran_veg => waterfluxbulk_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) vegwp => canopystate_inst%vegwp_patch ,& ! Input/Output: [real(r8) (:,:) ] vegetation water matric potential (mm) - vegwp_ln => canopystate_inst%vegwp_ln_patch ,& ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) at local noon - vegwp_pd => canopystate_inst%vegwp_ln_patch & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) between midnight and 2am local time + vegwp_ln => canopystate_inst%vegwp_ln_patch & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) at local noon ) @@ -3791,14 +3790,6 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, g, gb_mol, bsun, bsha, jesun, jesh vegwp_ln(p,:) = spval end if - !write out predawn vwp (averaged over midnight to 2am) - if ( get_local_time( grc%londeg(g)) <= 7200._r8 )then - vegwp_pd(p,:) = vegwp(p,:) - else - vegwp_pd(p,:) = spval - end if - - if (soilflux<0._r8) soilflux = 0._r8 qflx_tran_veg(p) = soilflux @@ -4273,6 +4264,7 @@ subroutine calcstress(p,c,x,bsun,bsha,gb_mol,gs_mol_sun,gs_mol_sha,qsatl,qaf, & tgcm => temperature_inst%thm_patch , & ! Input: [real(r8) (:) ] air temperature at agcm reference height (kelvin) bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" qflx_tran_veg => waterfluxbulk_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) + vegwp_pd => canopystate_inst%vegwp_pd_patch , & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) at local noon sucsat => soilstate_inst%sucsat_col & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) ) @@ -4411,6 +4403,9 @@ subroutine calcstress(p,c,x,bsun,bsha,gb_mol,gs_mol_sun,gs_mol_sha,qsatl,qaf, & atm2lnd_inst, canopystate_inst, waterdiagnosticbulk_inst, soilstate_inst, temperature_inst) if (soilflux<0._r8) soilflux = 0._r8 qflx_tran_veg(p) = soilflux + vegwp_pd(p,:) = x + else + vegwp_pd(p,:) = spval endif From 241b788e86f1fe0576aada035793dbd2b0a66b68 Mon Sep 17 00:00:00 2001 From: Daniel Kennedy Date: Thu, 27 Aug 2020 11:50:37 -0600 Subject: [PATCH 1382/1973] enforce that vegwp_pd is at night and also before noon --- src/biogeophys/CanopyStateType.F90 | 4 ++-- src/biogeophys/PhotosynthesisMod.F90 | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/CanopyStateType.F90 b/src/biogeophys/CanopyStateType.F90 index f2a351cded..3da289b82c 100644 --- a/src/biogeophys/CanopyStateType.F90 +++ b/src/biogeophys/CanopyStateType.F90 @@ -49,7 +49,7 @@ module CanopyStateType real(r8) , pointer :: vegwp_patch (:,:) ! patch vegetation water matric potential (mm) real(r8) , pointer :: vegwp_ln_patch (:,:) ! patch vegetation water matric potential at local noon (mm) - real(r8) , pointer :: vegwp_pd_patch (:,:) ! patch vegetation water matric potential from 12am-2am (mm) + real(r8) , pointer :: vegwp_pd_patch (:,:) ! patch predawn vegetation water matric potential (mm) real(r8) :: leaf_mr_vcm = spval ! Scalar constant of leaf respiration with Vcmax @@ -252,7 +252,7 @@ subroutine InitHistory(this, bounds) ptr_patch=this%vegwp_ln_patch) this%vegwp_pd_patch(begp:endp,:) = spval call hist_addfld2d (fname='VEGWPPD', units='mm', type2d='nvegwcs', avgflag='A', & - long_name='vegetation water matric potential for sun/sha canopy,xyl,root for predawn (b/w 12 and 2am)', & + long_name='predawn vegetation water matric potential for sun/sha canopy,xyl,root', & ptr_patch=this%vegwp_pd_patch) end if diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 85e3e46a12..aa4c842538 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -17,7 +17,7 @@ module PhotosynthesisMod use clm_varctl , only : use_c13, use_c14, use_cn, use_cndv, use_fates, use_luna, use_hydrstress use clm_varctl , only : iulog use clm_varpar , only : nlevcan, nvegwcs, mxpft - use clm_varcon , only : namep, c14ratio, spval + use clm_varcon , only : namep, c14ratio, spval, isecspday use decompMod , only : bounds_type use QuadraticMod , only : quadratic use pftconMod , only : pftcon @@ -4209,6 +4209,7 @@ subroutine calcstress(p,c,x,bsun,bsha,gb_mol,gs_mol_sun,gs_mol_sha,qsatl,qaf, & ! USES use clm_varpar , only : nlevsoi use clm_varcon , only : rgas + use clm_time_manager , only : get_local_time !! ! !ARGUMENTS: integer , intent(in) :: p ! pft index @@ -4241,6 +4242,7 @@ subroutine calcstress(p,c,x,bsun,bsha,gb_mol,gs_mol_sun,gs_mol_sha,qsatl,qaf, & real(r8) :: gs0sun,gs0sha ! local gs_mol copies real(r8) :: qsun,qsha ! attenuated transpiration fluxes integer :: j ! index + integer :: g ! gridcell index real(r8) :: cf ! s m**2/umol -> s/m integer :: iter ! newton's method iteration number logical :: flag ! signal that matrix was not invertible @@ -4264,7 +4266,7 @@ subroutine calcstress(p,c,x,bsun,bsha,gb_mol,gs_mol_sun,gs_mol_sha,qsatl,qaf, & tgcm => temperature_inst%thm_patch , & ! Input: [real(r8) (:) ] air temperature at agcm reference height (kelvin) bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" qflx_tran_veg => waterfluxbulk_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - vegwp_pd => canopystate_inst%vegwp_pd_patch , & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) at local noon + vegwp_pd => canopystate_inst%vegwp_pd_patch , & ! Output: [real(r8) (:,:) ] vegetation water matric potential (mm) predawn sucsat => soilstate_inst%sucsat_col & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) ) @@ -4403,10 +4405,15 @@ subroutine calcstress(p,c,x,bsun,bsha,gb_mol,gs_mol_sun,gs_mol_sha,qsatl,qaf, & atm2lnd_inst, canopystate_inst, waterdiagnosticbulk_inst, soilstate_inst, temperature_inst) if (soilflux<0._r8) soilflux = 0._r8 qflx_tran_veg(p) = soilflux + endif + + !save predawn vegwp + g = patch%gridcell(p) + if (night .and. get_local_time(grc%londeg(g))<(isecspday/2)) then vegwp_pd(p,:) = x else vegwp_pd(p,:) = spval - endif + end if end associate From a6726928f50f10268d9659130fd4f349d9d1a34c Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Thu, 27 Aug 2020 13:50:41 -0600 Subject: [PATCH 1383/1973] Adjust ice to liquid density in ice mass calculation, as lake layer is not adjusted --- src/biogeophys/TotalWaterAndHeatMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index b774fe9761..87d3256bbf 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -518,7 +518,7 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & c = filter_c(fc) ! calculate lake liq and ice content per lake layer first h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) - h2olak_ice = dz_lake(c,j) * denice * lake_icefrac(c,j) + h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) ! use water density of liquid water as layer depth is not adjusted liquid_mass(c) = liquid_mass(c) + h2olak_liq ice_mass(c) = ice_mass(c) + h2olak_ice From f60a1d2acdfa455c79f0af7842334ec6b8c6e843 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 28 Aug 2020 00:30:26 -0600 Subject: [PATCH 1384/1973] This allows this to run under a CESM checkout --- bld/unit_testers/xFail/expectedFail.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/unit_testers/xFail/expectedFail.pm b/bld/unit_testers/xFail/expectedFail.pm index 877d4a71ae..9feaa3e38b 100755 --- a/bld/unit_testers/xFail/expectedFail.pm +++ b/bld/unit_testers/xFail/expectedFail.pm @@ -428,7 +428,7 @@ sub _readXml # Add $cfgdir to the list of paths that Perl searches for modules my @dirs = ( $cfgdir, "$cfgdir/perl5lib", "$cfgdir/../../cime/utils/perl5lib", - "$cfgdir/../../../cime/utils/perl5lib" + "$cfgdir/../../../../cime/utils/perl5lib" ); unshift @INC, @dirs; my $result = eval "require XML::Lite"; From 5f1a1e5dae55053c4e0f26d67b82322d1592b149 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 28 Aug 2020 00:31:15 -0600 Subject: [PATCH 1385/1973] Add more tests for clm4_5 cases as these were broken --- bld/unit_testers/build-namelist_test.pl | 62 +++++++++++++------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index f2839d22f8..f0c7e88152 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 901; +my $ntests = 949; if ( defined($opts{'compare'}) ) { - $ntests += 555; + $ntests += 591; } plan( tests=>$ntests ); @@ -327,36 +327,38 @@ sub make_config_cache { print "\n===============================================================================\n"; print "Test some CAM specific setups for special grids \n"; print "=================================================================================\n"; -$phys = "clm5_0"; -$mode = "-phys $phys"; -&make_config_cache($phys); -foreach my $options ( - "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 0.9x1.25 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20030101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 1.9x2.5 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res C192 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", +foreach my $phys ( "clm4_5", "clm5_0" ) { + $mode = "-phys $phys"; + &make_config_cache($phys); + foreach my $options ( + "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 0.9x1.25 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20030101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 1x1_brazil -bgc fates -no-megan -use_case 2000_control -lnd_tuning_mode ${phys}_CRUv7", + "-res C192 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode ${phys}_cam6.0", ) { - &make_env_run(); - eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; - is( $@, '', "options: $options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", $mode ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->dodiffonfile( "lnd_in", "$options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); + &make_env_run(); + eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; + is( $@, '', "options: $options" ); + $cfiles->checkfilesexist( "$options", $mode ); + $cfiles->shownmldiff( "default", $mode ); + if ( defined($opts{'compare'}) ) { + $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); + $cfiles->dodiffonfile( "lnd_in", "$options", $mode ); + $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); + $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); + } + if ( defined($opts{'generate'}) ) { + $cfiles->copyfiles( "$options", $mode ); + } + &cleanup(); } - &cleanup(); } print "\n==============================================================\n"; From 58e06c22f59c2cbbdecadab5553fdfc17ecc5aa7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 28 Aug 2020 00:32:44 -0600 Subject: [PATCH 1386/1973] Changes needed to correct finidat finding for clm4_5 cases, especially for clm4_5_cam6.0 tuning cases, there was also a clm5_0_cam6.0 case that was failing as well --- bld/namelist_files/namelist_defaults_ctsm.xml | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 16d65964ef..747a7a340e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -530,15 +530,19 @@ attributes from the config_cache.xml file (with keys converted to upper-case). maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4.ARCTICGRIS.ne30x8">.true. .true. + maxpft="17" use_cn=".false." use_crop=".false." hgrid="1.9x2.5" >.true. .true. - -.true. + +.true. + +.true. +.true. +.true. -.false. +.false. +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr1979_c200806.nc + + Date: Fri, 28 Aug 2020 00:33:36 -0600 Subject: [PATCH 1387/1973] Set some attributes that were missing for use_init_interp get default value --- bld/CLMBuildNamelist.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 054db5e8f4..868245a755 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1207,7 +1207,8 @@ sub setup_cmdl_run_type { if ($opts->{$var} eq "default" ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'}, - 'sim_year'=>$st_year ); + 'sim_year'=>$st_year, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, + 'bgc_spinup'=>$nl_flags->{'bgc_spinup'} ); } else { my $group = $definition->get_group_name($var); $nl->set_variable_value($group, $var, quote_string( $opts->{$var} ) ); From ffc879f88203767e8fa4d70d69e0b192d73deb8d Mon Sep 17 00:00:00 2001 From: ivanderkelen Date: Fri, 28 Aug 2020 00:50:23 -0600 Subject: [PATCH 1388/1973] Adjust ice density to liquid density in AccumulateHeatLake routine --- src/biogeophys/TotalWaterAndHeatMod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 87d3256bbf..79ee0a77d6 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -1086,7 +1086,8 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & heat_liquid = lake_heat_liquid(c), & latent_heat_liquid = lake_latent_heat_liquid(c)) ! ice heat - h2olak_ice = dz_lake(c,j) * denice * lake_icefrac(c,j) + ! use water density as lake layer does not adjust + h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) lake_heat_ice(c) = lake_heat_ice(c) + & TempToHeat(temp=t_lake(c,j), cv = (h2olak_ice * cpice)) end do From 82f39d74448d03d1fccf5ea8e383c7624a03a253 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Aug 2020 08:51:15 -0600 Subject: [PATCH 1389/1973] Expand on some comments a bit --- src/biogeophys/TotalWaterAndHeatMod.F90 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 79ee0a77d6..fcf81941fc 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -518,7 +518,10 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & c = filter_c(fc) ! calculate lake liq and ice content per lake layer first h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) - h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) ! use water density of liquid water as layer depth is not adjusted + + ! use water density rather than ice density because lake layer depths are not + ! adjusted when the layer freezes + h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) liquid_mass(c) = liquid_mass(c) + h2olak_liq ice_mass(c) = ice_mass(c) + h2olak_ice @@ -1085,10 +1088,11 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & h2o = h2olak_liq, & heat_liquid = lake_heat_liquid(c), & latent_heat_liquid = lake_latent_heat_liquid(c)) - ! ice heat - ! use water density as lake layer does not adjust - h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) - lake_heat_ice(c) = lake_heat_ice(c) + & + ! ice heat + ! use water density rather than ice density because lake layer depths are not + ! adjusted when the layer freezes + h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) + lake_heat_ice(c) = lake_heat_ice(c) + & TempToHeat(temp=t_lake(c,j), cv = (h2olak_ice * cpice)) end do end do From 5658ddec583cd6183d4b282906c8062e774b2171 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Aug 2020 11:00:03 -0600 Subject: [PATCH 1390/1973] Tweak some comments --- src/biogeophys/TotalWaterAndHeatMod.F90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index fcf81941fc..3bec595bf0 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -107,8 +107,8 @@ subroutine ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & class(waterstate_type) , intent(in) :: waterstate_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst - ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When we can accept answer changes to methane, - ! remove this argument, always assuming it's true. + ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When https://github.com/ESCOMP/CTSM/issues/658 + ! is resolved, remove this argument, always assuming it's true. logical, intent(in) :: subtract_dynbal_baselines ! whether to subtract dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass real(r8) , intent(inout) :: water_mass( bounds%begc: ) ! computed water mass (kg m-2) @@ -159,8 +159,8 @@ subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & class(waterstate_type) , intent(in) :: waterstate_inst type(lakestate_type) , intent(in) :: lakestate_inst - ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When we can accept answer changes to methane, - ! remove this argument, always assuming it's true. + ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When https://github.com/ESCOMP/CTSM/issues/658 + ! is resolved, remove this argument, always assuming it's true. logical, intent(in) :: subtract_dynbal_baselines ! whether to subtract dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass real(r8) , intent(inout) :: water_mass( bounds%begc: ) ! computed water mass (kg m-2) @@ -215,8 +215,8 @@ subroutine ComputeLiqIceMassNonLake(bounds, num_nolakec, filter_nolakec, & class(waterstate_type) , intent(in) :: waterstate_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst - ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When we can accept answer changes to methane, - ! remove this argument, always assuming it's true. + ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When https://github.com/ESCOMP/CTSM/issues/658 + ! is resolved, remove this argument, always assuming it's true. logical, intent(in) :: subtract_dynbal_baselines ! whether to subtract dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! computed liquid water mass (kg m-2) @@ -408,8 +408,8 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & type(lakestate_type) , intent(in) :: lakestate_inst - ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When we can accept answer changes to methane, - ! remove this argument, always assuming it's true. + ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When https://github.com/ESCOMP/CTSM/issues/658 + ! is resolved, remove this argument, always assuming it's true. logical, intent(in) :: subtract_dynbal_baselines ! whether to subtract dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! computed liquid water mass (kg m-2) From a9fa8754cf01e39a129ba62369358e2e10219e48 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Aug 2020 11:10:14 -0600 Subject: [PATCH 1391/1973] Do not add lake water to begwb and endwb, and thus also TWS See https://github.com/ESCOMP/CTSM/issues/659#issuecomment-682867045 for details. --- src/biogeophys/BalanceCheckMod.F90 | 2 +- src/biogeophys/LakeHydrologyMod.F90 | 2 +- src/biogeophys/TotalWaterAndHeatMod.F90 | 30 +++++++++++++++--------- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 65f102a548..69f7cdb167 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -216,7 +216,7 @@ subroutine BeginWaterBalanceSingle(bounds, & call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, lakestate_inst, & - subtract_dynbal_baselines = .false., & + add_lake_water_and_subtract_dynbal_baselines = .false., & water_mass = begwb(bounds%begc:bounds%endc)) call waterstate_inst%CalculateTotalH2osno(bounds, num_nolakec, filter_nolakec, & diff --git a/src/biogeophys/LakeHydrologyMod.F90 b/src/biogeophys/LakeHydrologyMod.F90 index c078e958e1..f6f83d8956 100644 --- a/src/biogeophys/LakeHydrologyMod.F90 +++ b/src/biogeophys/LakeHydrologyMod.F90 @@ -650,7 +650,7 @@ subroutine LakeHydrology(bounds, & call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & b_waterstate_inst, lakestate_inst, & - subtract_dynbal_baselines = .false., & + add_lake_water_and_subtract_dynbal_baselines = .false., & water_mass = endwb(bounds%begc:bounds%endc)) do j = 1, nlevgrnd diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 3bec595bf0..9cb1d948d6 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -143,7 +143,7 @@ end subroutine ComputeWaterMassNonLake !----------------------------------------------------------------------- subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, lakestate_inst, & - subtract_dynbal_baselines, & + add_lake_water_and_subtract_dynbal_baselines, & water_mass) ! ! !DESCRIPTION: @@ -159,9 +159,12 @@ subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & class(waterstate_type) , intent(in) :: waterstate_inst type(lakestate_type) , intent(in) :: lakestate_inst + ! Whether to (1) add lake water/ice to total accounting, and (2) subtract + ! dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass + ! ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When https://github.com/ESCOMP/CTSM/issues/658 ! is resolved, remove this argument, always assuming it's true. - logical, intent(in) :: subtract_dynbal_baselines ! whether to subtract dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass + logical, intent(in) :: add_lake_water_and_subtract_dynbal_baselines real(r8) , intent(inout) :: water_mass( bounds%begc: ) ! computed water mass (kg m-2) ! @@ -181,7 +184,7 @@ subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & filter_lakec = filter_lakec, & waterstate_inst = waterstate_inst, & lakestate_inst = lakestate_inst, & - subtract_dynbal_baselines = subtract_dynbal_baselines, & + add_lake_water_and_subtract_dynbal_baselines = add_lake_water_and_subtract_dynbal_baselines, & liquid_mass = liquid_mass(bounds%begc:bounds%endc), & ice_mass = ice_mass(bounds%begc:bounds%endc)) @@ -388,7 +391,7 @@ end subroutine AccumulateSoilLiqIceMassNonLake !----------------------------------------------------------------------- subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, lakestate_inst,& - subtract_dynbal_baselines, & + add_lake_water_and_subtract_dynbal_baselines, & liquid_mass, ice_mass) ! ! !DESCRIPTION: @@ -408,9 +411,12 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & type(lakestate_type) , intent(in) :: lakestate_inst + ! Whether to (1) add lake water/ice to total accounting, and (2) subtract + ! dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass + ! ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When https://github.com/ESCOMP/CTSM/issues/658 ! is resolved, remove this argument, always assuming it's true. - logical, intent(in) :: subtract_dynbal_baselines ! whether to subtract dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass + logical, intent(in) :: add_lake_water_and_subtract_dynbal_baselines real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! computed liquid water mass (kg m-2) real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! computed ice mass (kg m-2) @@ -449,11 +455,13 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) end do end do - - ! Lake water content - call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, & - lakestate_inst, liquid_mass, ice_mass) - + + if (add_lake_water_and_subtract_dynbal_baselines) then + ! Lake water content + call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, & + lakestate_inst, liquid_mass, ice_mass) + end if + ! Soil water content of the soil under the lake do j = 1, nlevgrnd do fc = 1, num_lakec @@ -463,7 +471,7 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & end do end do - if (subtract_dynbal_baselines) then + if (add_lake_water_and_subtract_dynbal_baselines) then ! Subtract baselines set in initialization do fc = 1, num_lakec c = filter_lakec(fc) diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index d8bb809bba..9dc9b46002 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -645,7 +645,7 @@ subroutine dyn_water_content(bounds, & call ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, & lakestate_inst, & - subtract_dynbal_baselines = .true., & + add_lake_water_and_subtract_dynbal_baselines = .true., & liquid_mass = liquid_mass_col(bounds%begc:bounds%endc), & ice_mass = ice_mass_col(bounds%begc:bounds%endc)) From 67564bf1eb53e0831ac645cf7cbb538cad06f8bb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 28 Aug 2020 14:08:37 -0600 Subject: [PATCH 1392/1973] Update change files --- doc/ChangeLog | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 113 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 18ec683d77..9515516195 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,116 @@ =============================================================== +Tag name: ctsm1.0.dev111 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Fri Aug 28 14:08:25 MDT 2020 +One-line Summary: Compsets don't use 2014 for GSWP3 forcing, LUNA prevyr changed back + +Purpose of changes +------------------ + +Update cime so that default end year for GSWP3 forcing is 2013 because 2014 data is bad. Also update +the prevyr default for vcmax/jmax to what it was before ctsm1.0.dev102. + +Fix some issues for finding initial condition files for Clm45 compsets. Also bring in updated CDEPS/CMEPS +as they were required with the cime update. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1107 -- Change initial values of LUNA back to previous global values + Fixes #1067 -- Stop using PIO2 in the LILAC build + Fixes #1121 -- FMOZ test fails + +CIME Issues fixed (include issue #): + Fixes ESMCI/cime#3683 -- Avoid artificial limit on string lengths in shr_string_listMerge + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + Last time-step in Dec/2013 for GSWP3 data still has zero humidity + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + cime is pointing to a branch_tag we should update it to a trunk tag as soon as possible + +Changes to tests or testing: build-namelist unit testing improved to find problems like #1121 a #1125 + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (all identical to previous tag) + + tools-tests (test/tools): + + cheyenne - PASS + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes + + Summarize any changes to answers, i.e., + - what code configurations: (2010 and SSP compsets) and Clm50 with LUNA on (Bgc or Sp) + - what platforms/compilers: All + - nature of change: similar climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cmeps, cdeps + (fox removed as a separate checkout) + cime to branch_tags/cime5.8.31_a01 + +Pull Requests that document the changes (include PR ids): #1114 +(https://github.com/ESCOMP/ctsm/pull) + #1114 -- Update cime so default end year for GSWP3 forcing is 2013 and change prevyr default for vcmax/jmax + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev110 Originator(s): jedwards (Jim Edwards) Date: Fri Aug 21 10:49:08 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index c217c6f13c..e2ff442ba4 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev111 erik 08/28/2020 Compsets don't use 2014 for GSWP3 forcing, LUNA prevyr changed back ctsm1.0.dev110 jedwards 08/21/2020 Fixes needed for PIO2 ctsm1.0.dev109 negins 08/20/2020 Allow for resorbtion in transition from live to dead wood N ctsm1.0.dev108 erik 08/19/2020 Update default PE layouts for new SE/FV3 grids From 9c9ce12f741b7e92dd0073d6554f022ec98ca3b4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Aug 2020 19:52:11 -0600 Subject: [PATCH 1393/1973] Update ChangeLog --- doc/ChangeLog | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 124 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 9515516195..db50b78ed4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,127 @@ =============================================================== +Tag name: ctsm1.0.dev112 +Originator(s): sacks (Bill Sacks), wwieder (Will Wieder) +Date: Fri Aug 28 17:10:57 MDT 2020 +One-line Summary: Small changes to mksurfdata_map, singlept tool and run_sys_tests + +Purpose of changes +------------------ + +(1) Move mksurfdata_map rounding of special landunits to before wetland + fill: I think this may be important to avoid errors and/or wrong + behavior in some edge cases where we have < 0.5% cover of glacier + and/or lake, and other cases. See + https://github.com/ESCOMP/CTSM/issues/1118 for detailed + thoughts. May change answers in rare cases, but no answer changes + observed for present-day surface datasets at standard resolutions + (f09, f19, f10, f45). + +(2) run_sys_tests: record command-line arguments in SRCROOT_GIT_STATUS + file + +(3) (From Will Wieder) Updates to current surfdata & landuse files in + tools/contrib/singlept + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1118 (mksurfdata_map rounding/truncation of + special landunits should happen before wetland filling) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - PASS + + Note: ran tools testing on code based off of ctsm1.0.dev110 (before + merging with ctsm1.0.dev111) + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - PASS on mac (bishorn) + + regular tests (aux_clm): + + cheyenne ---- not run + izumi ------- not run + +If the tag used for baseline comparisons was NOT the previous tag, note that here: ctsm1.0.dev110 + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +In principle, the changes to mksurfdata_map could change answers for +rare cases. No answer changes were observed for present-day surface +datasets at resolutions f09, f19, f10 or f45. Also note that no surface +datasets were actually updated in this tag, so if any answer changes +appear from these changes, they would appear the next time we update +surface datasets. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1119 +https://github.com/ESCOMP/CTSM/pull/1120 +https://github.com/ESCOMP/CTSM/pull/1122 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev111 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Fri Aug 28 14:08:25 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index e2ff442ba4..fc2975500f 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev112 sacks/ww 08/28/2020 Small changes to mksurfdata_map, singlept tool and run_sys_tests ctsm1.0.dev111 erik 08/28/2020 Compsets don't use 2014 for GSWP3 forcing, LUNA prevyr changed back ctsm1.0.dev110 jedwards 08/21/2020 Fixes needed for PIO2 ctsm1.0.dev109 negins 08/20/2020 Allow for resorbtion in transition from live to dead wood N From a2d7d25dcec46c54d60018c6489dfdb249bdc0d8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 28 Aug 2020 20:48:27 -0600 Subject: [PATCH 1394/1973] Bring in most changes from ctsm1.0.dev111 Bring in the finidat changes from ctsm1.0.dev111 and externals updates. Changes to be committed: modified: Externals.cfg modified: Externals_cime.cfg modified: bld/CLMBuildNamelist.pm modified: bld/namelist_files/namelist_defaults_ctsm.xml modified: bld/unit_testers/build-namelist_test.pl modified: bld/unit_testers/xFail/expectedFail.pm modified: python/ctsm/lilac_build_ctsm.py --- Externals.cfg | 9 ++- Externals_cime.cfg | 16 +---- bld/CLMBuildNamelist.pm | 3 +- bld/namelist_files/namelist_defaults_ctsm.xml | 23 +++++-- bld/unit_testers/build-namelist_test.pl | 62 ++++++++++--------- bld/unit_testers/xFail/expectedFail.pm | 2 +- python/ctsm/lilac_build_ctsm.py | 5 -- 7 files changed, 61 insertions(+), 59 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index f1b8d8056b..556e30be13 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -26,11 +26,18 @@ repo_url = https://github.com/ESCOMP/MOSART tag = mosart1_0_37 required = True +[cdeps] +hash = 45b7a85 +protocol = git +repo_url = https://github.com/ESCOMP/CDEPS.git +local_path = components/cdeps +required = True + [cime] local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.30 +tag = cime5.8.32 externals = ../Externals_cime.cfg required = True diff --git a/Externals_cime.cfg b/Externals_cime.cfg index a9df9d0698..a4ef9d88e8 100644 --- a/Externals_cime.cfg +++ b/Externals_cime.cfg @@ -1,23 +1,9 @@ [cmeps] -hash = cab9030 +hash = 7654038 protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git local_path = src/drivers/nuopc/ required = True -[fox] -hash = 0ed59c1 -protocol = git -repo_url = https://github.com/ESMCI/fox.git -local_path = src/externals/fox -required = True - -[cdeps] -hash = d7b8a4c8e1b7cbff88da5bdb782ab715de62468a -protocol = git -repo_url = https://github.com/ESCOMP/CDEPS.git -local_path = src/components/cdeps -required = True - [externals_description] schema_version = 1.0.0 diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 054db5e8f4..baee665153 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1207,7 +1207,8 @@ sub setup_cmdl_run_type { if ($opts->{$var} eq "default" ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'}, - 'sim_year'=>$st_year ); + 'sim_year'=>$st_year, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, + 'bgc_spinup'=>$nl_flags->{'bgc_spinup'} ); } else { my $group = $definition->get_group_name($var); $nl->set_variable_value($group, $var, quote_string( $opts->{$var} ) ); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 16d65964ef..747a7a340e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -530,15 +530,19 @@ attributes from the config_cache.xml file (with keys converted to upper-case). maxpft="17" use_cn=".false." use_crop=".false." hgrid="ne0np4.ARCTICGRIS.ne30x8">.true. .true. + maxpft="17" use_cn=".false." use_crop=".false." hgrid="1.9x2.5" >.true. .true. - -.true. + +.true. + +.true. +.true. +.true. -.false. +.false. +lnd/clm2/initdata_map/clmi.BHIST.2000-01-01.0.9x1.25_gx1v7_simyr1979_c200806.nc + + $ntests ); @@ -327,36 +327,38 @@ sub make_config_cache { print "\n===============================================================================\n"; print "Test some CAM specific setups for special grids \n"; print "=================================================================================\n"; -$phys = "clm5_0"; -$mode = "-phys $phys"; -&make_config_cache($phys); -foreach my $options ( - "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 0.9x1.25 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20030101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res 1.9x2.5 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res C192 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode clm5_0_cam6.0", - "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode clm5_0_cam6.0", +foreach my $phys ( "clm4_5", "clm5_0" ) { + $mode = "-phys $phys"; + &make_config_cache($phys); + foreach my $options ( + "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res ne0np4.ARCTICGRIS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 0.9x1.25 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=19790101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 0.9x1.25 -bgc bgc -crop -use_case 20thC_transient -namelist '&a start_ymd=19500101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res ne0np4CONUS.ne30x8 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20030101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 1.9x2.5 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res 1x1_brazil -bgc fates -no-megan -use_case 2000_control -lnd_tuning_mode ${phys}_CRUv7", + "-res C192 -bgc sp -use_case 2010_control -namelist '&a start_ymd=20100101/' -lnd_tuning_mode ${phys}_cam6.0", + "-res ne0np4.ARCTIC.ne30x4 -bgc sp -use_case 20thC_transient -namelist '&a start_ymd=20130101/' -lnd_tuning_mode ${phys}_cam6.0", ) { - &make_env_run(); - eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; - is( $@, '', "options: $options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", $mode ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->dodiffonfile( "lnd_in", "$options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); + &make_env_run(); + eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; + is( $@, '', "options: $options" ); + $cfiles->checkfilesexist( "$options", $mode ); + $cfiles->shownmldiff( "default", $mode ); + if ( defined($opts{'compare'}) ) { + $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); + $cfiles->dodiffonfile( "lnd_in", "$options", $mode ); + $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); + $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); + } + if ( defined($opts{'generate'}) ) { + $cfiles->copyfiles( "$options", $mode ); + } + &cleanup(); } - &cleanup(); } print "\n==============================================================\n"; diff --git a/bld/unit_testers/xFail/expectedFail.pm b/bld/unit_testers/xFail/expectedFail.pm index 877d4a71ae..9feaa3e38b 100755 --- a/bld/unit_testers/xFail/expectedFail.pm +++ b/bld/unit_testers/xFail/expectedFail.pm @@ -428,7 +428,7 @@ sub _readXml # Add $cfgdir to the list of paths that Perl searches for modules my @dirs = ( $cfgdir, "$cfgdir/perl5lib", "$cfgdir/../../cime/utils/perl5lib", - "$cfgdir/../../../cime/utils/perl5lib" + "$cfgdir/../../../../cime/utils/perl5lib" ); unshift @INC, @dirs; my $result = eval "require XML::Lite"; diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 967542f356..b13baeba87 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -613,11 +613,6 @@ def _create_case(cime_path, build_dir, compiler, run_cmd_output_on_error(create_newcase_cmd, errmsg='Problem creating CTSM case directory') - # PIO2 sometimes causes errors: see - # https://github.com/ESCOMP/CTSM/issues/876#issuecomment-653189406 and following - # comments in that issue. So use PIO1 for now. - subprocess.check_call([xmlchange, 'PIO_VERSION=1'], cwd=case_dir) - subprocess.check_call([xmlchange, 'LILAC_MODE=on'], cwd=case_dir) if build_debug: subprocess.check_call([xmlchange, 'DEBUG=TRUE'], cwd=case_dir) From a69b1b219a48fefe9f6a21fcc0913aa722b78688 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 31 Aug 2020 00:53:37 -0600 Subject: [PATCH 1395/1973] Add missing fates compset #1128 --- cime_config/config_compsets.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 598aa7bb2e..f97ff572b4 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -196,6 +196,10 @@ I2000Clm50FatesCruGs 2000_DATM%CRUv7_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV + + I2000Clm50FatesCruRsGs + 2000_DATM%CRUv7_CLM50%FATES_SICE_SOCN_SROF_SGLC_SWAV + From 1934961452df5d7e7df27c25fd1e1d30dd2e2d31 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 31 Aug 2020 11:49:59 -0600 Subject: [PATCH 1396/1973] Remove history variables that don't exist from the user_nl_clm --- .../testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm index d7c9b447a4..0c439291be 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm @@ -7,7 +7,7 @@ hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE',' 'PARSHA_Z_CNLFPFT','PARSUN_Z_CAN','PARSHA_Z_CAN','LAISUN_Z_CNLF','LAISHA_Z_CNLF','LAISUN_Z_CNLFPFT','LAISHA_Z_CNLFPFT', 'LAISUN_TOP_CAN','LAISHA_TOP_CAN','FABD_SUN_CNLFPFT','FABD_SHA_CNLFPFT','FABI_SUN_CNLFPFT','FABI_SHA_CNLFPFT', 'FABD_SUN_CNLF','FABD_SHA_CNLF','FABI_SUN_CNLF','FABI_SHA_CNLF','FABD_SUN_TOPLF_BYCANLAYER','FABD_SHA_TOPLF_BYCANLAYER', - 'FABI_SUN_TOPLF_BYCANLAYER','FABI_SHA_TOPLF_BYCANLAYER','TS_NET_UPTAKE_CNLF','YEAR_NET_UPTAKE_CNLF','CROWNAREA_CNLF', + 'FABI_SUN_TOPLF_BYCANLAYER','FABI_SHA_TOPLF_BYCANLAYER','CROWNAREA_CNLF', 'MORTALITY_CARBONFLUX_CANOPY','MORTALITY_CARBONFLUX_UNDERSTORY','NPLANT_SCAG','NPLANT_CANOPY_SCAG','NPLANT_UNDERSTORY_SCAG', 'DDBH_CANOPY_SCAG','DDBH_UNDERSTORY_SCAG','MORTALITY_CANOPY_SCAG','MORTALITY_UNDERSTORY_SCAG','GPP_SCPF','GPP_CANOPY_SCPF', 'AR_CANOPY_SCPF','GPP_UNDERSTORY_SCPF','AR_UNDERSTORY_SCPF','NPP_SCPF','NPP_LEAF_SCPF','NPP_SEED_SCPF','NPP_FNRT_SCPF', @@ -20,12 +20,12 @@ hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE',' 'YESTERDAYCANLEV_UNDERSTORY_SCLS','BA_SCLS','DEMOTION_RATE_SCLS','PROMOTION_RATE_SCLS','NPLANT_CANOPY_SCLS', 'MORTALITY_CANOPY_SCLS','NPLANT_UNDERSTORY_SCLS','MORTALITY_UNDERSTORY_SCLS','TRIMMING_CANOPY_SCLS','TRIMMING_UNDERSTORY_SCLS', 'CROWN_AREA_CANOPY_SCLS','CROWN_AREA_UNDERSTORY_SCLS','LEAF_MD_CANOPY_SCLS','ROOT_MD_CANOPY_SCLS','CARBON_BALANCE_CANOPY_SCLS', - 'SEED_PROD_CANOPY_SCLS','DBALIVEDT_CANOPY_SCLS','DBDEADDT_CANOPY_SCLS','DBSTOREDT_CANOPY_SCLS','STORAGE_FLUX_CANOPY_SCLS', + 'SEED_PROD_CANOPY_SCLS', 'NPP_LEAF_CANOPY_SCLS','NPP_FROOT_CANOPY_SCLS','NPP_BSW_CANOPY_SCLS','NPP_BDEAD_CANOPY_SCLS','NPP_BSEED_CANOPY_SCLS', 'NPP_STORE_CANOPY_SCLS','RDARK_CANOPY_SCLS','LIVESTEM_MR_CANOPY_SCLS','LIVECROOT_MR_CANOPY_SCLS','FROOT_MR_CANOPY_SCLS', 'RESP_G_CANOPY_SCLS','RESP_M_CANOPY_SCLS','LEAF_MD_UNDERSTORY_SCLS','ROOT_MD_UNDERSTORY_SCLS','CARBON_BALANCE_UNDERSTORY_SCLS', - 'SEED_PROD_UNDERSTORY_SCLS','DBALIVEDT_UNDERSTORY_SCLS','DBDEADDT_UNDERSTORY_SCLS','DBSTOREDT_UNDERSTORY_SCLS', - 'STORAGE_FLUX_UNDERSTORY_SCLS','NPP_LEAF_UNDERSTORY_SCLS','NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS', + 'SEED_PROD_UNDERSTORY_SCLS', + 'NPP_LEAF_UNDERSTORY_SCLS','NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS', 'NPP_BDEAD_UNDERSTORY_SCLS','NPP_BSEED_UNDERSTORY_SCLS','NPP_STORE_UNDERSTORY_SCLS','RDARK_UNDERSTORY_SCLS', 'LIVESTEM_MR_UNDERSTORY_SCLS','LIVECROOT_MR_UNDERSTORY_SCLS','FROOT_MR_UNDERSTORY_SCLS','RESP_G_UNDERSTORY_SCLS', 'RESP_M_UNDERSTORY_SCLS','LITTER_IN_ELEM','LITTER_OUT_ELEM','SEED_BANK_ELEM','SEEDS_IN_LOCAL_ELEM','SEEDS_IN_EXTERN_ELEM', From e77f9ba77246b6e3db9eaa42bf54e8866a2b0b96 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 31 Aug 2020 11:52:25 -0600 Subject: [PATCH 1397/1973] Remove the empty finidat file for fates as it makes it output finidat equal to /glade/p/cesmdata/cseg/inputdata, this fixes the other part of #1129 --- bld/namelist_files/namelist_defaults_ctsm.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 747a7a340e..eea50139d3 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -880,15 +880,6 @@ p >lnd/clm2/initdata_map/clmi.FHISTSp.2013-01-01.ne0CONUSne30x8_mt12_simyr2013_c200806.nc - - - - - - - lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_48x96_hist_16pfts_Irrig_CMIP6_simyr2000_c190214.nc From 1aa1df615f1998aff1af4eda7e488083bf9f624b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 31 Aug 2020 11:52:47 -0600 Subject: [PATCH 1398/1973] Start working on change files --- doc/.release-ChangeLog_template | 101 ++++++++++++++++++++++++++++++++ doc/ChangeSum | 4 ++ doc/UpdateChangelog.pl | 14 ++--- doc/release-cesm2.2.ChangeLog | 95 ++++++++++++++++++++++++++++++ 4 files changed, 207 insertions(+), 7 deletions(-) create mode 100644 doc/.release-ChangeLog_template create mode 100644 doc/release-cesm2.2.ChangeLog diff --git a/doc/.release-ChangeLog_template b/doc/.release-ChangeLog_template new file mode 100644 index 0000000000..aca4c9440c --- /dev/null +++ b/doc/.release-ChangeLog_template @@ -0,0 +1,101 @@ +=============================================================== +Tag name: +Originator(s): +Date: +One-line Summary: + +Purpose of this version: +------------------------ + +[Fill this in with details] + + +CTSM Master Tag This Corresponds To: + +Summary of changes: +------------------- + +Issues fixed (include CTSM Issue #): [If none, remove this line] +CIME Issues fixed (include issue #): [If none, remove this line] + +Science changes since: + +Software changes since: + +Changes to User Interface since: + +Testing: +-------- + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + unit-tests (components/clm/src): + + cheyenne - + izumi ---- + + tools-tests (components/clm/test/tools): + + cheyenne - + izumi ---- + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - + izumi ---- + + regular tests (aux_clm): + + cheyenne_intel ---- + cheyenne_gnu ------ + izumi_nag --------- + izumi_pgi --------- + izumi_intel ------- + + regular tests (prealpha): + + cheyenne_intel - + cheyenne_gnu --- + izumi_nag ------ + + regular tests (prebeta): + + cheyenne_intel - + cheyenne_gnu --- + izumi_nag ------ + +Summary of Answer changes: +------------------------- + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + +Changes answers relative to baseline: + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + + Summarize any changes to answers, i.e., + - what code configurations: + - what platforms/compilers: + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + URL for LMWG diagnostics output for new climate: + + Will new REFCASES need to be made for cesm and/or CAM?: No + (This will likely be true if the LII tests failed) + +Detailed list of changes: +------------------------ + +Externals being used: + +CTSM Tag versions pulled over from master development branch: + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + +=============================================================== diff --git a/doc/ChangeSum b/doc/ChangeSum index cfabe8bb5b..6165ed3502 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,9 @@ Tag Who Date Summary ============================================================================================================================ +release-cesm2.2.01 erik 08/28/2020 Fix clm4_5 initial conditions + ctsm1.0.dev111 erik 08/28/2020 Compsets don't use 2014 for GSWP3 forcing + ctsm1.0.dev110 jedwards 08/21/2020 SKIPPED ON RELEASE BRANCH + ctsm1.0.dev109 negins 08/20/2020 SKIPPED ON RELEASE BRANCH ctsm1.0.dev108 erik 08/19/2020 Update default PE layouts for new SE/FV3 grids ctsm1.0.dev107 erik 08/10/2020 Answer changes needed for CESM2.2.0 ctsm1.0.dev106 erik 08/06/2020 Bit-for-bit updates for the CESM2.2.0 release diff --git a/doc/UpdateChangelog.pl b/doc/UpdateChangelog.pl index 88f8331d03..1cee0866e9 100755 --- a/doc/UpdateChangelog.pl +++ b/doc/UpdateChangelog.pl @@ -41,7 +41,7 @@ sub usage { To document a new tag - $ProgName ctsm1.0.dev012 "Description of this tag" + $ProgName release-cesm2.2.09 "Description of this tag" EOF } @@ -67,7 +67,7 @@ sub usage { $tag = $ARGV[0]; $sum = $ARGV[1]; - if ( $tag !~ /ctsm[0-9]\.[0-9]\.(dev[0-9][0-9][0-9]|[0-9][0-9])/ ) { + if ( $tag !~ /release-cesm[0-9]\.[0-9]\.([0-9][0-9])/ ) { print "ERROR: bad tagname: $tag\n"; usage(); } @@ -84,8 +84,8 @@ sub usage { } -my $template = ".ChangeLog_template"; -my $changelog = "ChangeLog"; +my $template = ".release-ChangeLog_template"; +my $changelog = "release-cesm2.2.ChangeLog"; my $changesum = "ChangeSum"; my $changelog_tmp = "ChangeLog.tmp"; my $changesum_tmp = "ChangeSum.tmp"; @@ -137,7 +137,7 @@ sub usage { my $oldTag = ""; while( $_ = ) { # If adding a new tag check that new tag name does NOT match any old tag - if ( $_ =~ /Tag name:[ ]*(ctsm.+)/ ) { + if ( $_ =~ /Tag name:[ ]*(release-cesm.+)/ ) { $oldTag = $1; if ( (! $opts{'update'}) && ($tag eq $oldTag) ) { close( CL ); @@ -177,10 +177,10 @@ sub usage { # Find header line if ( $_ =~ /=====================/ ) { print FH $_; - my $format = "%16.16s %8.8s %10.10s %s\n"; + my $format = "%18.18s %7.7s %10.10s %s\n"; if ( $update ) { $_ = ; - if ( /^(.{16}) (.{8}) (.{10}) (.+)$/ ) { + if ( /^(.{17}) (.{8}) (.{10}) (.+)$/ ) { $tag = $1; $user = $2; $sum = $4; diff --git a/doc/release-cesm2.2.ChangeLog b/doc/release-cesm2.2.ChangeLog new file mode 100644 index 0000000000..6ee6a797ef --- /dev/null +++ b/doc/release-cesm2.2.ChangeLog @@ -0,0 +1,95 @@ +=============================================================== +Tag name: release-cesm2.2.01 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Fri Aug 28 20:50:32 MDT 2020 +One-line Summary: Fix clm4_5 initial conditions + +Purpose of this version: +------------------------ + +Update cime so that default end year for GSWP3 forcing is 2013 because 2014 data is bad. + +Fix some issues for finding initial condition files for Clm45 compsets. Also bring in updated CDEPS/CMEPS +as they were required with the cime update. + + +CTSM Master Tag This Corresponds To: ctsm1.0.dev108 (with most changes from ctsm1.0.dev111) + +Summary of changes: +------------------- + +Issues fixed (include CTSM Issue #): + Fixes #1067 -- Stop using PIO2 in the LILAC build + Fixes #1121 -- FMOZ test fails +CIME Issues fixed (include issue #): + Fixes ESMCI/cime#3683 -- Avoid artificial limit on string lengths in shr_string_listMerge + +Science changes since: ctsm1.0.dev108 + +Software changes since: ctsm1.0.dev108 + +Changes to User Interface since: ctsm1.0.dev108 + +Testing: +-------- + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + tools-tests (components/clm/test/tools): + + cheyenne - + izumi ---- + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - + izumi ---- + + regular tests (aux_clm): + + cheyenne_intel ---- + cheyenne_gnu ------ + izumi_nag --------- + izumi_pgi --------- + izumi_intel ------- + + regular tests (prealpha): + + cheyenne_intel - + cheyenne_gnu --- + izumi_nag ------ + + regular tests (prebeta): + + cheyenne_intel - + cheyenne_gnu --- + izumi_nag ------ + +Summary of Answer changes: +------------------------- + +If the tag used for baseline comparisons was NOT the previous tag, note that here: ctsm1.0.dev108 + +Changes answers relative to baseline: yes + + Summarize any changes to answers, i.e., + - what code configurations: 2010 and SSP compsets (because of cime update) + - what platforms/compilers: all + - nature of change: same climate + +Detailed list of changes: +------------------------ + +Externals being used: + +CTSM Tag versions pulled over from master development branch: ctsm1.0.dev111 + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + +=============================================================== +=============================================================== From cd7ddb6f76a05f5313cb96598bcf8cd894b28518 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 31 Aug 2020 16:40:24 -0600 Subject: [PATCH 1399/1973] Remove mkprocddata test on izumi because intel on it doesn't have a NetCDF4 build (see #1130) --- test/tools/tests_posttag_izumi_nompi | 1 - 1 file changed, 1 deletion(-) diff --git a/test/tools/tests_posttag_izumi_nompi b/test/tools/tests_posttag_izumi_nompi index 4655f29853..90be9522dc 100644 --- a/test/tools/tests_posttag_izumi_nompi +++ b/test/tools/tests_posttag_izumi_nompi @@ -1,4 +1,3 @@ -smc#4 blc#4 smi54 bli54 smi57 bli57 smiT4 bliT4 From 52105c4cd824764e1e2f862eacd7ace8696a76f3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 1 Sep 2020 16:28:48 -0600 Subject: [PATCH 1400/1973] Use tracer ratio when counting lake water This is needed for water tracer masses to be counted correctly --- src/biogeophys/TotalWaterAndHeatMod.F90 | 19 ++++++++++++------- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 5 +++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 9cb1d948d6..ba794f67a4 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -390,7 +390,7 @@ end subroutine AccumulateSoilLiqIceMassNonLake !----------------------------------------------------------------------- subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, lakestate_inst,& + waterstate_inst, lakestate_inst, & add_lake_water_and_subtract_dynbal_baselines, & liquid_mass, ice_mass) ! @@ -410,7 +410,6 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & class(waterstate_type), intent(in) :: waterstate_inst type(lakestate_type) , intent(in) :: lakestate_inst - ! Whether to (1) add lake water/ice to total accounting, and (2) subtract ! dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass ! @@ -459,7 +458,10 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & if (add_lake_water_and_subtract_dynbal_baselines) then ! Lake water content call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, & - lakestate_inst, liquid_mass, ice_mass) + lakestate_inst, & + tracer_ratio = waterstate_inst%info%get_ratio(), & + liquid_mass = liquid_mass(bounds%begc:bounds%endc), & + ice_mass = ice_mass(bounds%begc:bounds%endc)) end if ! Soil water content of the soil under the lake @@ -486,7 +488,7 @@ end subroutine ComputeLiqIceMassLake !----------------------------------------------------------------------- subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & - lakestate_inst, liquid_mass, ice_mass) + lakestate_inst, tracer_ratio, liquid_mass, ice_mass) ! ! !DESCRIPTION: ! Accumulate lake water mass of lake columns, separated into liquid and ice. @@ -501,6 +503,7 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & integer , intent(in) :: num_c ! number of column points in column filter (should not include lake points; can be a subset of the no-lake filter) integer , intent(in) :: filter_c(:) ! column filter (should not include lake points; can be a subset of the no-lake filter) type(lakestate_type) , intent(in) :: lakestate_inst + real(r8) , intent(in) :: tracer_ratio ! for water tracers, standard ratio of this tracer to bulk water (1 for bulk water) real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! accumulated liquid mass (kg m-2) real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! accumulated ice mass (kg m-2) ! @@ -524,12 +527,14 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, & do j = 1, nlevlak do fc = 1, num_c c = filter_c(fc) - ! calculate lake liq and ice content per lake layer first - h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) + ! Lake water volume isn't tracked explicitly, so we calculate it from lake + ! depth. Because it isn't tracked explicitly, we also don't have any water + ! tracer information, so we assume a fixed, standard tracer ratio. + h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) * tracer_ratio ! use water density rather than ice density because lake layer depths are not ! adjusted when the layer freezes - h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) + h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) * tracer_ratio liquid_mass(c) = liquid_mass(c) + h2olak_liq ice_mass(c) = ice_mass(c) + h2olak_ice diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index 9dc9b46002..6e42b405eb 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -205,8 +205,9 @@ subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & ! Calculate the total water volume of the lake column call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, lakestate_inst, & - liquid_mass = lake_liquid_mass_col(bounds%begc:bounds%endc), & - ice_mass = lake_ice_mass_col(bounds%begc:bounds%endc)) + tracer_ratio = waterstate_inst%info%get_ratio(), & + liquid_mass = lake_liquid_mass_col(bounds%begc:bounds%endc), & + ice_mass = lake_ice_mass_col(bounds%begc:bounds%endc)) do fc = 1, num_lakec c = filter_lakec(fc) From ad6ca8a5fc1808301a074b0b3d8f1aeec8970c3a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 2 Sep 2020 00:12:06 -0600 Subject: [PATCH 1401/1973] Fix mkmapdata.sh fixing #1134 and update ESMF to version 8 --- tools/mkmapdata/mkmapdata.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index d0691a9817..5166d31744 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -338,19 +338,22 @@ echo "Hostname = $hostname" case $hostname in ##cheyenne cheyenne* | r* ) - . /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/bash + . /glade/u/apps/ch/opt/lmod/8.1.7/lmod/lmod/init/bash if [ -z "$REGRID_PROC" ]; then REGRID_PROC=36 fi - esmfvers=7.1.0r - intelvers=18.0.5 # Could also use intel/19.0.2 EBK 10/4/2019 - module load esmf_libs/$esmfvers + esmfvers=8.0.0 + intelvers=19.0.5 + module purge module load intel/$intelvers + module load esmf_libs + module load esmf_libs/$esmfvers module load ncl module load nco if [[ $REGRID_PROC > 1 ]]; then mpi=mpi + module load mpt/2.22 else mpi=uni fi From 8a45b3b66b9632cabf00d349638e758898e49bfe Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 2 Sep 2020 00:12:41 -0600 Subject: [PATCH 1402/1973] Get toools testing working --- test/tools/README | 9 +++++++++ test/tools/input_tests_master | 4 ++-- test/tools/tests_posttag_nompi_regression | 1 - 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/test/tools/README b/test/tools/README index 4929144b20..43438d03a5 100644 --- a/test/tools/README +++ b/test/tools/README @@ -15,6 +15,15 @@ on cheyenne qcmd -l walltime=06:00:00 -- ./test_driver.sh -i >& run.out & +on izumi + +nohup ./test_driver.sh -i >& run.out & + +release tests + +qcmd -l walltime=08:00:00 -- env CLM_INPUT_TESTS=`pwd`/tests_posttag_nompi_regression \ +./test_driver.sh -i >& run.out & + Intended for use on NCAR machines cheyenne, geyser (DAV) and hobart. II. RUNNING test_driver.sh TOOLS TESTING: diff --git a/test/tools/input_tests_master b/test/tools/input_tests_master index be6cf8f454..cb3998557d 100644 --- a/test/tools/input_tests_master +++ b/test/tools/input_tests_master @@ -58,5 +58,5 @@ smiS8 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional_ndep bliS8 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional_ndep smiS9 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional_T62 bliS9 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional_T62 -smiS0 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional_0.5popd -bliS0 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional_0.5popd +smiS0 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional_05popd +bliS0 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional_05popd diff --git a/test/tools/tests_posttag_nompi_regression b/test/tools/tests_posttag_nompi_regression index 8b4f9889c4..1785b5da47 100644 --- a/test/tools/tests_posttag_nompi_regression +++ b/test/tools/tests_posttag_nompi_regression @@ -1,6 +1,5 @@ smc#4 blc#4 sme14 ble14 -sm@14 bl@14 smg54 blg54 smi24 bli24 smi53 bli53 From c08f9fbf59b1f0cefe60e397fececad5b83b6fc7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 2 Sep 2020 01:36:58 -0600 Subject: [PATCH 1403/1973] Set REGRID_PROC to 1 if interactive is on, this is helpful for PTCLMmkdata to work --- tools/mkmapdata/mkmapdata.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index 5166d31744..b5d26ead9b 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -342,6 +342,9 @@ case $hostname in if [ -z "$REGRID_PROC" ]; then REGRID_PROC=36 fi + if [ interactive = "YES" ]; then + REGRID_PROC=1 + fi esmfvers=8.0.0 intelvers=19.0.5 module purge @@ -372,6 +375,9 @@ case $hostname in if [ -z "$REGRID_PROC" ]; then REGRID_PROC=8 fi + if [ interactive = "YES" ]; then + REGRID_PROC=1 + fi echo "REGRID_PROC=$REGRID_PROC" esmfvers=7.1.0r intelvers=17.0.1 From 53b63d801c4ca758ef37fb92540992a4c07bfe45 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 2 Sep 2020 02:38:04 -0600 Subject: [PATCH 1404/1973] Update PTCLM to fix PTCLM#11 --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index f38a229b9f..9c28ed0315 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -9,7 +9,7 @@ required = True local_path = tools/PTCLM protocol = git repo_url = https://github.com/ESCOMP/PTCLM -tag = PTCLM2_20200121 +tag = PTCLM2_20200902 required = True [externals_description] From f79d1794a0734e6497e4a38c8d0bc5fc431d091c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 2 Sep 2020 03:11:44 -0600 Subject: [PATCH 1405/1973] Upodate change log files --- doc/ChangeSum | 2 +- doc/UpdateChangelog.pl | 4 +-- doc/release-cesm2.2.ChangeLog | 51 ++++++++++++++++++----------------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/doc/ChangeSum b/doc/ChangeSum index 6165ed3502..596d7994a0 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ -release-cesm2.2.01 erik 08/28/2020 Fix clm4_5 initial conditions +release-cesm2.2.01 erik 09/02/2020 Fix clm4_5 initial conditions ctsm1.0.dev111 erik 08/28/2020 Compsets don't use 2014 for GSWP3 forcing ctsm1.0.dev110 jedwards 08/21/2020 SKIPPED ON RELEASE BRANCH ctsm1.0.dev109 negins 08/20/2020 SKIPPED ON RELEASE BRANCH diff --git a/doc/UpdateChangelog.pl b/doc/UpdateChangelog.pl index 1cee0866e9..05f80a501b 100755 --- a/doc/UpdateChangelog.pl +++ b/doc/UpdateChangelog.pl @@ -177,10 +177,10 @@ sub usage { # Find header line if ( $_ =~ /=====================/ ) { print FH $_; - my $format = "%18.18s %7.7s %10.10s %s\n"; + my $format = "%18.18s %6.6s %10.10s %s\n"; if ( $update ) { $_ = ; - if ( /^(.{17}) (.{8}) (.{10}) (.+)$/ ) { + if ( /^(.{18}) (.{6}) (.{10}) (.+)$/ ) { $tag = $1; $user = $2; $sum = $4; diff --git a/doc/release-cesm2.2.ChangeLog b/doc/release-cesm2.2.ChangeLog index 6ee6a797ef..1f61e49095 100644 --- a/doc/release-cesm2.2.ChangeLog +++ b/doc/release-cesm2.2.ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: release-cesm2.2.01 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Fri Aug 28 20:50:32 MDT 2020 +Date: Wed Sep 2 02:44:01 MDT 2020 One-line Summary: Fix clm4_5 initial conditions Purpose of this version: @@ -10,7 +10,8 @@ Purpose of this version: Update cime so that default end year for GSWP3 forcing is 2013 because 2014 data is bad. Fix some issues for finding initial condition files for Clm45 compsets. Also bring in updated CDEPS/CMEPS -as they were required with the cime update. +as they were required with the cime update. Also get the CLM offline tools working as well as the tools +testing. CTSM Master Tag This Corresponds To: ctsm1.0.dev108 (with most changes from ctsm1.0.dev111) @@ -19,14 +20,21 @@ Summary of changes: ------------------- Issues fixed (include CTSM Issue #): + Fixes #1134 mkmapdata.sh is not working + Fixes #1129 two FATES tests that fail + Fixes #1128 missing compset Fixes #1067 -- Stop using PIO2 in the LILAC build Fixes #1121 -- FMOZ test fails CIME Issues fixed (include issue #): Fixes ESMCI/cime#3683 -- Avoid artificial limit on string lengths in shr_string_listMerge +PTCLM Issues fixed: + Fixes PTCLM#11 -- not running on cheyenne Science changes since: ctsm1.0.dev108 + 2010 and SSP compsets have forcing end in 2013 rather than 2014 Software changes since: ctsm1.0.dev108 + Fix issues for finding IC files for clm45 Changes to User Interface since: ctsm1.0.dev108 @@ -41,33 +49,20 @@ Testing: tools-tests (components/clm/test/tools): - cheyenne - - izumi ---- + cheyenne - PASS + izumi ---- PASS PTCLM testing (components/clm/tools/shared/PTCLM/test): - cheyenne - - izumi ---- + cheyenne - OK regular tests (aux_clm): - cheyenne_intel ---- - cheyenne_gnu ------ - izumi_nag --------- - izumi_pgi --------- - izumi_intel ------- - - regular tests (prealpha): - - cheyenne_intel - - cheyenne_gnu --- - izumi_nag ------ - - regular tests (prebeta): - - cheyenne_intel - - cheyenne_gnu --- - izumi_nag ------ + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + izumi_nag --------- OK + izumi_pgi --------- OK + izumi_intel ------- OK Summary of Answer changes: ------------------------- @@ -84,11 +79,17 @@ Changes answers relative to baseline: yes Detailed list of changes: ------------------------ -Externals being used: +Externals being used: cesm2_2_alpha06e versions + CISM at cism2_1_69 + RTM at rtm1_0_72 + MOSART at mosart1_0_37 + cime at cime5.8.32 + FATES at sci.1.30.0_api.8.0.0 + PTCLM at PTCLM2_20200902 CTSM Tag versions pulled over from master development branch: ctsm1.0.dev111 -Pull Requests that document the changes (include PR ids): +Pull Requests that document the changes (include PR ids): N/A (https://github.com/ESCOMP/ctsm/pull) =============================================================== From 0728caaee8719598f60172a2700cb2feb822b938 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 12:49:03 -0600 Subject: [PATCH 1406/1973] updating cime tag to cime/5.8.32 mentioned by ekluzek in PR#1102 --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index d2e6d3ad37..556e30be13 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -37,7 +37,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.31_a01 +tag = cime5.8.32 externals = ../Externals_cime.cfg required = True From 01d0f522115b90d848b640e01730214538cc3ade Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 12:50:14 -0600 Subject: [PATCH 1407/1973] updating the comments as suggested by @wwieder in PR #961 --- src/biogeophys/LunaMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 71c6c77c3b..9b26a95666 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -320,8 +320,8 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & jmx25_z => photosyns_inst%jmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 (umol electron/m**2/s) for canopy layer pnlc_z => photosyns_inst%pnlc_z_patch , & ! Output: [real(r8) (:,:) ] patch proportion of leaf nitrogen allocated for light capture for canopy layer enzs_z => photosyns_inst%enzs_z_patch , & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress - vcmx_prevyr => photosyns_inst%vcmx_prevyr , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 from previous year avg - jmx_prevyr => photosyns_inst%jmx_prevyr & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 from previous year avg + vcmx_prevyr => photosyns_inst%vcmx_prevyr , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 from end of the growing season for the previous year + jmx_prevyr => photosyns_inst%jmx_prevyr & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 from the end of the growing season for the previous year ) !---------------------------------------------------------------------------------------------------------------------------------------------------------- !set timestep From 0b31e4f2f2723568b40f991d417b9a3e35c7db40 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 12:57:55 -0600 Subject: [PATCH 1408/1973] changing vcmx_prevyr to vcmx25_z_last_valid_patch as suggested in PR #961 --- src/biogeophys/LunaMod.F90 | 8 ++++---- src/biogeophys/PhotosynthesisMod.F90 | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 9b26a95666..9a1ab1d69a 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -313,14 +313,14 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & t_veg_night => temperature_inst%t_veg_night_patch , & ! Input: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin) t_veg10_day => temperature_inst%t_veg10_day_patch , & ! Input: [real(r8) (:) ] 10-day mean daytime vegetation temperature (Kelvin) t_veg10_night => temperature_inst%t_veg10_night_patch , & ! Input: [real(r8) (:) ] 10-day mean nighttime vegetation temperature (Kelvin) - rh10_p => waterdiagnosticbulk_inst%rh10_af_patch , & ! Input: [real(r8) (:) ] 10-day mean canopy air relative humidity at the pacth (unitless) + rh10_p => waterdiagnosticbulk_inst%rh10_af_patch , & ! Input: [real(r8) (:) ] 10-day mean canopy air relative humidity at the pacth (unitless) rb10_p => frictionvel_inst%rb10_patch , & ! Input: [real(r8) (:) ] 10-day mean boundary layer resistance at the pacth (s/m) gpp_day => photosyns_inst%fpsn24_patch , & ! Input: [real(r8) (:) ] patch 24 hours mean gpp(umol CO2/m**2 ground/day) for canopy layer vcmx25_z => photosyns_inst%vcmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 (umol/m2 leaf/s) for canopy layer jmx25_z => photosyns_inst%jmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 (umol electron/m**2/s) for canopy layer pnlc_z => photosyns_inst%pnlc_z_patch , & ! Output: [real(r8) (:,:) ] patch proportion of leaf nitrogen allocated for light capture for canopy layer enzs_z => photosyns_inst%enzs_z_patch , & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress - vcmx_prevyr => photosyns_inst%vcmx_prevyr , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 from end of the growing season for the previous year + vcmx25_z_last_valid_patch => photosyns_inst%vcmx25_z_last_valid_patch , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 from end of the growing season for the previous year jmx_prevyr => photosyns_inst%jmx_prevyr & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 from the end of the growing season for the previous year ) !---------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -425,7 +425,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & chg = vcmx25_opt-vcmx25_z(p, z) chg_constrn = min(abs(chg),vcmx25_z(p, z)*max_daily_pchg) vcmx25_z(p, z) = vcmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - vcmx_prevyr(p,z) = vcmx25_z(p,z) + vcmx25_z_last_valid_patch(p,z) = vcmx25_z(p,z) chg = jmx25_opt-jmx25_z(p, z) chg_constrn = min(abs(chg),jmx25_z(p, z)*max_daily_pchg) @@ -490,7 +490,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & else do z = 1 , nrad(p) jmx25_z(p, z) = jmx_prevyr(p,z) - vcmx25_z(p, z) = vcmx_prevyr(p,z) + vcmx25_z(p, z) = vcmx25_z_last_valid_patch(p,z) end do endif !checking for LAI and LNC endif !the first daycheck diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 26fd9c5fa5..1c50c26219 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -200,8 +200,8 @@ module PhotosynthesisMod ! LUNA specific variables real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer - real(r8), pointer, public :: vcmx_prevyr (:,:) ! patch leaf Vc,max25 previous year running avg - real(r8), pointer, public :: jmx_prevyr (:,:) ! patch leaf Jmax25 previous year running avg + real(r8), pointer, public :: vcmx25_z_last_valid_patch (:,:) ! patch leaf Vc,max25 at the end of the growing season for the previous year + real(r8), pointer, public :: jmx_prevyr (:,:) ! patch leaf Jmax25 at the end of the growing season for the previous year real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) @@ -346,7 +346,7 @@ subroutine InitAllocate(this, bounds) ! statements. allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 - allocate(this%vcmx_prevyr (begp:endp,1:nlevcan)) ; this%vcmx_prevyr (:,:) = 30._r8 + allocate(this%vcmx25_z_last_valid_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_last_valid_patch (:,:) = 30._r8 allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 60._r8 allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan @@ -892,10 +892,10 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) - call restartvar(ncid=ncid, flag=flag, varname='vcmx_prevyr', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z_last_valid_patch', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & - interpinic_flag='interp', readvar=readvar, data=this%vcmx_prevyr) + interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_last_valid_patch) call restartvar(ncid=ncid, flag=flag, varname='jmx_prevyr', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & From 02a3aad89633f31178b1b6a588073caa54495c2b Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 13:02:32 -0600 Subject: [PATCH 1409/1973] changing jmx_prevyr to jmx25_z_last_valid_patch --- src/biogeophys/LunaMod.F90 | 6 +++--- src/biogeophys/PhotosynthesisMod.F90 | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 index 9a1ab1d69a..e32e7b2734 100644 --- a/src/biogeophys/LunaMod.F90 +++ b/src/biogeophys/LunaMod.F90 @@ -321,7 +321,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & pnlc_z => photosyns_inst%pnlc_z_patch , & ! Output: [real(r8) (:,:) ] patch proportion of leaf nitrogen allocated for light capture for canopy layer enzs_z => photosyns_inst%enzs_z_patch , & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress vcmx25_z_last_valid_patch => photosyns_inst%vcmx25_z_last_valid_patch , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 from end of the growing season for the previous year - jmx_prevyr => photosyns_inst%jmx_prevyr & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 from the end of the growing season for the previous year + jmx25_z_last_valid_patch => photosyns_inst%jmx25_z_last_valid_patch & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 from the end of the growing season for the previous year ) !---------------------------------------------------------------------------------------------------------------------------------------------------------- !set timestep @@ -430,7 +430,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & chg = jmx25_opt-jmx25_z(p, z) chg_constrn = min(abs(chg),jmx25_z(p, z)*max_daily_pchg) jmx25_z(p, z) = jmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - jmx_prevyr(p,z) = jmx25_z(p,z) + jmx25_z_last_valid_patch(p,z) = jmx25_z(p,z) PNlc_z(p, z)= PNlcopt @@ -489,7 +489,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & endif !if not C3 plants else do z = 1 , nrad(p) - jmx25_z(p, z) = jmx_prevyr(p,z) + jmx25_z(p, z) = jmx25_z_last_valid_patch(p,z) vcmx25_z(p, z) = vcmx25_z_last_valid_patch(p,z) end do endif !checking for LAI and LNC diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 1c50c26219..a7ca42adaa 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -201,7 +201,7 @@ module PhotosynthesisMod real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer real(r8), pointer, public :: vcmx25_z_last_valid_patch (:,:) ! patch leaf Vc,max25 at the end of the growing season for the previous year - real(r8), pointer, public :: jmx_prevyr (:,:) ! patch leaf Jmax25 at the end of the growing season for the previous year + real(r8), pointer, public :: jmx25_z_last_valid_patch (:,:) ! patch leaf Jmax25 at the end of the growing season for the previous year real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) @@ -347,7 +347,7 @@ subroutine InitAllocate(this, bounds) allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 allocate(this%vcmx25_z_last_valid_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_last_valid_patch (:,:) = 30._r8 - allocate(this%jmx_prevyr (begp:endp,1:nlevcan)) ; this%jmx_prevyr (:,:) = 60._r8 + allocate(this%jmx25_z_last_valid_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_last_valid_patch (:,:) = 60._r8 allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8 @@ -896,10 +896,10 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_last_valid_patch) - call restartvar(ncid=ncid, flag=flag, varname='jmx_prevyr', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='jmx25_z_last_valid_patch', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & - interpinic_flag='interp', readvar=readvar, data=this%jmx_prevyr) + interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_last_valid_patch) call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='proportion of leaf nitrogen allocated for light capture', units='unitless', & From c517bb39720d54a9f6729e56fa5ec8d83152c013 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 13:09:44 -0600 Subject: [PATCH 1410/1973] changing the long_name for jmx25_z* to maximum rate of electron as suggested by @ekluzek in PR #1060 --- src/biogeophys/PhotosynthesisMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index a7ca42adaa..ff44c15e21 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -540,8 +540,8 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & ptr_patch=this%vcmx25_z_patch) - call hist_addfld2d (fname='Jmx25Z', units='umol/m2/s', type2d='nlevcan', & - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & + call hist_addfld2d (fname='Jmx25Z', units='umol electrons/m2/s', type2d='nlevcan', & + avgflag='A', long_name='maximum rate of electron transport at 25 celcius for canopy laters', & ptr_patch=this%jmx25_z_patch) call hist_addfld2d (fname='PNLCZ', units='unitless', type2d='nlevcan', & @@ -554,7 +554,7 @@ subroutine InitHistory(this, bounds) ptr_patch=ptr_1d) ptr_1d => this%jmx25_z_patch(:,1) call hist_addfld1d (fname='Jmx25Z', units='umol/m2/s',& - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & + avgflag='A', long_name='maximum rate of electron transport at 25 celcius for canopy laters', & ptr_patch=ptr_1d) ptr_1d => this%pnlc_z_patch(:,1) call hist_addfld1d (fname='PNLCZ', units='unitless', & @@ -890,7 +890,7 @@ subroutine Restart(this, bounds, ncid, flag) interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_patch) call restartvar(ncid=ncid, flag=flag, varname='jmx25_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='Maximum rate of electron transport at 25 celcius for canopy layers', units='umol electrons/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z_last_valid_patch', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & @@ -898,7 +898,7 @@ subroutine Restart(this, bounds, ncid, flag) interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_last_valid_patch) call restartvar(ncid=ncid, flag=flag, varname='jmx25_z_last_valid_patch', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & + long_name='avg rate of electron transport at 25 celcius for canopy layers', units='umol electrons/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_last_valid_patch) call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & From d2acd961db3dbc956a2f3ab2286ea216081e19da Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 13:36:43 -0600 Subject: [PATCH 1411/1973] fixing typo and capitalize Celcius --- src/biogeophys/PhotosynthesisMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index ff44c15e21..2b6bdd9ab5 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -541,7 +541,7 @@ subroutine InitHistory(this, bounds) ptr_patch=this%vcmx25_z_patch) call hist_addfld2d (fname='Jmx25Z', units='umol electrons/m2/s', type2d='nlevcan', & - avgflag='A', long_name='maximum rate of electron transport at 25 celcius for canopy laters', & + avgflag='A', long_name='maximum rate of electron transport at 25 Celcius for canopy layers', & ptr_patch=this%jmx25_z_patch) call hist_addfld2d (fname='PNLCZ', units='unitless', type2d='nlevcan', & @@ -554,7 +554,7 @@ subroutine InitHistory(this, bounds) ptr_patch=ptr_1d) ptr_1d => this%jmx25_z_patch(:,1) call hist_addfld1d (fname='Jmx25Z', units='umol/m2/s',& - avgflag='A', long_name='maximum rate of electron transport at 25 celcius for canopy laters', & + avgflag='A', long_name='maximum rate of electron transport at 25 Celcius for canopy layers', & ptr_patch=ptr_1d) ptr_1d => this%pnlc_z_patch(:,1) call hist_addfld1d (fname='PNLCZ', units='unitless', & @@ -886,11 +886,11 @@ subroutine Restart(this, bounds, ncid, flag) if(use_luna) then call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & + long_name='Maximum carboxylation rate at 25 Celcius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_patch) call restartvar(ncid=ncid, flag=flag, varname='jmx25_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum rate of electron transport at 25 celcius for canopy layers', units='umol electrons/m**2/s', & + long_name='Maximum rate of electron transport at 25 Celcius for canopy layers', units='umol electrons/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z_last_valid_patch', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & @@ -898,7 +898,7 @@ subroutine Restart(this, bounds, ncid, flag) interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_last_valid_patch) call restartvar(ncid=ncid, flag=flag, varname='jmx25_z_last_valid_patch', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='avg rate of electron transport at 25 celcius for canopy layers', units='umol electrons/m**2/s', & + long_name='avg rate of electron transport at 25 Celcius for canopy layers', units='umol electrons/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_last_valid_patch) call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & From cc994428a02cf51c95983e26b1ddd9a7b53f20a4 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 13:44:01 -0600 Subject: [PATCH 1412/1973] removing denitrif_nitrateconc_coefficient from namelist --- bld/CLMBuildNamelist.pm | 2 +- bld/namelist_files/namelist_definition_ctsm.xml | 6 ------ bld/unit_testers/build-namelist_test.pl | 5 ----- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 9c0cd46d60..d04120088c 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2748,7 +2748,7 @@ sub setup_logic_nitrif_params { if ( ! &value_is_true($nl_flags->{'use_nitrif_denitrif'}) ) { my @vars = ( "k_nitr_max", "denitrif_respiration_coefficient", "denitrif_respiration_exponent", - "denitrif_nitrateconc_coefficient", "denitrif_nitrateconc_exponent" ); + "denitrif_nitrateconc_exponent" ); foreach my $var ( @vars ) { if ( defined($nl->get_value( $var ) ) ) { $log->fatal_error("$var is only used when use_nitrif_denitrif is turned on"); diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 166bad29e9..c16305e1b6 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -976,12 +976,6 @@ Exponent power for heterotrophic respiration for max denitrification rates (ONLY used if use_nitrif_denitrif is enabled) - -Multiplier for nitrate concentration for max denitrification rates -(ONLY used if use_nitrif_denitrif is enabled) - - Exponent power for nitrate concentrationfor max denitrification rates diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index adcd3b5802..a64a7b472e 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -972,11 +972,6 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, - "nitrcoefWOnitrif" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"use_nitrif_denitrif=.false., denitrif_nitrateconc_coefficient=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - phys=>"clm5_0", - }, "nitrexpWOnitrif" =>{ options=>"-envxml_dir . -bgc bgc", namelst=>"use_nitrif_denitrif=.false., denitrif_nitrateconc_exponent=1.0", GLC_TWO_WAY_COUPLING=>"FALSE", From 93ed1e2e12064892fa7aa26c605ba8a975f7ff27 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 13:47:59 -0600 Subject: [PATCH 1413/1973] removing denitrif_nitrateconc_exponent from namelist as suggested in issue #1062 --- bld/CLMBuildNamelist.pm | 3 +-- bld/namelist_files/namelist_definition_ctsm.xml | 6 ------ bld/unit_testers/build-namelist_test.pl | 5 ----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index d04120088c..25138d6131 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2747,8 +2747,7 @@ sub setup_logic_nitrif_params { my ($nl_flags, $definition, $defaults, $nl) = @_; if ( ! &value_is_true($nl_flags->{'use_nitrif_denitrif'}) ) { - my @vars = ( "k_nitr_max", "denitrif_respiration_coefficient", "denitrif_respiration_exponent", - "denitrif_nitrateconc_exponent" ); + my @vars = ( "k_nitr_max", "denitrif_respiration_coefficient", "denitrif_respiration_exponent"); foreach my $var ( @vars ) { if ( defined($nl->get_value( $var ) ) ) { $log->fatal_error("$var is only used when use_nitrif_denitrif is turned on"); diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index c16305e1b6..da37f3fda2 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -976,12 +976,6 @@ Exponent power for heterotrophic respiration for max denitrification rates (ONLY used if use_nitrif_denitrif is enabled) - -Exponent power for nitrate concentrationfor max denitrification rates -(ONLY used if use_nitrif_denitrif is enabled) - - Maximum nitrification rate constant (1/s) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index a64a7b472e..d77633ea6d 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -972,11 +972,6 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, - "nitrexpWOnitrif" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"use_nitrif_denitrif=.false., denitrif_nitrateconc_exponent=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - phys=>"clm5_0", - }, "lunaWSPandlnctrue" =>{ options=>"-envxml_dir . -bgc sp", namelst=>"use_luna=.true., lnc_opt=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", From ce1c9a40e2342ed9a3416c5fa6592cdb42007b8a Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 2 Sep 2020 16:38:51 -0600 Subject: [PATCH 1414/1973] addressing @billsacks comment for backward compatiblity. --- src/biogeophys/PhotosynthesisMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 2b6bdd9ab5..70c89e809a 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -553,7 +553,7 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & ptr_patch=ptr_1d) ptr_1d => this%jmx25_z_patch(:,1) - call hist_addfld1d (fname='Jmx25Z', units='umol/m2/s',& + call hist_addfld1d (fname='Jmx25Z', units='umol electrons/m2/s',& avgflag='A', long_name='maximum rate of electron transport at 25 Celcius for canopy layers', & ptr_patch=ptr_1d) ptr_1d => this%pnlc_z_patch(:,1) @@ -892,11 +892,11 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='Maximum rate of electron transport at 25 Celcius for canopy layers', units='umol electrons/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) - call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z_last_valid_patch', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z_last_valid_patch:vcmx_prevyr', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='avg carboxylation rate at 25 celsius for canopy layers', units='umol CO2/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_last_valid_patch) - call restartvar(ncid=ncid, flag=flag, varname='jmx25_z_last_valid_patch', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='jmx25_z_last_valid_patch:jmx_prevyr', xtype=ncd_double, & dim1name='pft', dim2name='levcan', switchdim=.true., & long_name='avg rate of electron transport at 25 Celcius for canopy layers', units='umol electrons/m**2/s', & interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_last_valid_patch) From de3e12c83ebfc2b825908d1e9af6da3cbae4d421 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 3 Sep 2020 11:11:37 -0600 Subject: [PATCH 1415/1973] Reset lake dynbal baselines if using an old initial conditions file We have changed the definition of total column water for lake columns, so the baseline values for lakes are incorrect on old initial conditions files. This commit adds some code to check if we're using an old initial conditions file, and if so, resets the dynbal baseline values for lakes to use the new definition. --- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 251 ++++++++++++++--------- src/main/clm_initializeMod.F90 | 66 +++--- src/main/restFileMod.F90 | 78 ++++++- 3 files changed, 269 insertions(+), 126 deletions(-) diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index 6e42b405eb..e3b25b1322 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -12,6 +12,8 @@ module dynConsBiogeophysMod use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type + use spmdMod , only : masterproc + use clm_varctl , only : iulog use UrbanParamsType , only : urbanparams_type use EnergyFluxType , only : energyflux_type use SoilHydrologyType , only : soilhydrology_type @@ -66,7 +68,8 @@ module dynConsBiogeophysMod !----------------------------------------------------------------------- subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & num_lakec, filter_lakec, & - urbanparams_inst, soilstate_inst, lakestate_inst, water_inst, temperature_inst) + urbanparams_inst, soilstate_inst, lakestate_inst, water_inst, temperature_inst, & + reset_all_baselines, reset_lake_baselines, print_resets) ! ! !DESCRIPTION: ! Set start-of-run baseline values for heat and water content in some columns. @@ -79,13 +82,18 @@ subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & ! represented). These corrections will typically reduce the fictitious dynbal ! conservation fluxes. ! - ! At a minimum, this should be called during cold start initialization, to initialize - ! the baseline values based on cold start states. In addition, this can be called when - ! starting a new run from existing initial conditions, if the user desires. This - ! optional resetting can further reduce the dynbal fluxes; however, it can break - ! conservation. (So, for example, it can be done when transitioning from an offline - ! spinup to a coupled run, but it should not be done when transitioning from a - ! coupled historical run to a future scenario.) + ! At a minimum, this should be called during cold start initialization with + ! reset_all_baselines set to true, to initialize the baseline values based on cold + ! start states. This should also be called after reading initial conditions, but the + ! various reset_* flags should be set appropriately; setting all of these flags to + ! false will result in no baselines being reset in this call. + + ! Setting reset_all_baselines can be done when starting a new run from existing + ! initial conditions if the user desires. This optional resetting can further reduce + ! the dynbal fluxes; however, it can break conservation. (So, for example, it can be + ! done when transitioning from an offline spinup to a coupled run, but it should not + ! be done when transitioning from a coupled historical run to a future scenario.) + ! Other reset_* flags are described below. ! ! !ARGUMENTS: type(bounds_type), intent(in) :: bounds @@ -98,12 +106,28 @@ subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & integer, intent(in) :: num_lakec ! number of points in filter_lakec integer, intent(in) :: filter_lakec(:) ! filter for lake columns - type(urbanparams_type), intent(in) :: urbanparams_inst type(soilstate_type), intent(in) :: soilstate_inst type(lakestate_type), intent(in) :: lakestate_inst type(water_type), intent(inout) :: water_inst type(temperature_type), intent(inout) :: temperature_inst + + ! Whether to reset baselines for all columns + logical, intent(in) :: reset_all_baselines + + ! Whether to reset baselines for lake columns. Ignored if reset_all_baselines is + ! true. + ! + ! BACKWARDS_COMPATIBILITY(wjs, 2020-09-02) This is needed when reading old initial + ! conditions files created before https://github.com/ESCOMP/CTSM/issues/1140 was + ! resolved via https://github.com/ESCOMP/CTSM/pull/1109: The definition of total + ! column water content has been changed for lakes, so we need to reset baseline values + ! for lakes on older initial conditions files. + logical, intent(in) :: reset_lake_baselines + + ! Whether to print information about the reset flags + logical, intent(in) :: print_resets + ! ! !LOCAL VARIABLES: integer :: i @@ -112,6 +136,18 @@ subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & character(len=*), parameter :: subname = 'dyn_hwcontent_set_baselines' !----------------------------------------------------------------------- + if (masterproc .and. print_resets) then + if (reset_all_baselines) then + write(iulog,*) ' ' + write(iulog,*) 'Resetting dynbal baselines for all columns' + write(iulog,*) ' ' + else if (reset_lake_baselines) then + write(iulog,*) ' ' + write(iulog,*) 'Resetting dynbal baselines for lake columns' + write(iulog,*) ' ' + end if + end if + ! Note that we include inactive points in the following. This could be important if ! an inactive point later becomes active, so that we have an appropriate baseline ! value for that point. @@ -125,22 +161,26 @@ subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & call dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & num_icemecc, filter_icemecc, num_lakec, filter_lakec, & - bulk_or_tracer%waterstate_inst, lakestate_inst) + bulk_or_tracer%waterstate_inst, lakestate_inst, & + reset_all_baselines = reset_all_baselines, & + reset_lake_baselines = reset_lake_baselines) end associate end do call dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & num_icemecc, filter_icemecc, num_lakec, filter_lakec, & urbanparams_inst, soilstate_inst, lakestate_inst, water_inst%waterstatebulk_inst, & - temperature_inst) - + temperature_inst, & + reset_all_baselines = reset_all_baselines, & + reset_lake_baselines = reset_lake_baselines) end subroutine dyn_hwcontent_set_baselines !----------------------------------------------------------------------- subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & num_icemecc, filter_icemecc, num_lakec, filter_lakec, & - waterstate_inst, lakestate_inst) + waterstate_inst, lakestate_inst, & + reset_all_baselines, reset_lake_baselines) ! ! !DESCRIPTION: ! Set start-of-run baseline values for water content, for a single water tracer or @@ -155,9 +195,13 @@ subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & integer, intent(in) :: filter_icemecc(:) ! filter for icemec (i.e., glacier) columns integer, intent(in) :: num_lakec ! number of points in filter_lakec integer, intent(in) :: filter_lakec(:) ! filter for lake columns - type(lakestate_type), intent(in) :: lakestate_inst + type(lakestate_type), intent(in) :: lakestate_inst class(waterstate_type), intent(inout) :: waterstate_inst + + ! See dyn_hwcontent_set_baselines for documentation of these arguments + logical, intent(in) :: reset_all_baselines + logical, intent(in) :: reset_lake_baselines ! ! !LOCAL VARIABLES: integer :: c, fc ! indices @@ -174,47 +218,50 @@ subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, & dynbal_baseline_ice => waterstate_inst%dynbal_baseline_ice_col & ! Output: [real(r8) (:) ] baseline ice content subtracted from each column's total ice calculation (mm H2O) ) - soil_liquid_mass_col(bounds%begc:bounds%endc) = 0._r8 - soil_ice_mass_col (bounds%begc:bounds%endc) = 0._r8 - lake_liquid_mass_col(bounds%begc:bounds%endc) = 0._r8 - lake_ice_mass_col (bounds%begc:bounds%endc) = 0._r8 - - - call AccumulateSoilLiqIceMassNonLake(bounds, & - natveg_and_glc_filterc%num, natveg_and_glc_filterc%indices, & - waterstate_inst, & - liquid_mass = soil_liquid_mass_col(bounds%begc:bounds%endc), & - ice_mass = soil_ice_mass_col(bounds%begc:bounds%endc)) - - ! For glacier columns, the liquid and ice in the "soil" (i.e., in the glacial ice) is - ! a virtual pool. So we'll subtract this amount when determining the dynbal - ! fluxes. (Note that a positive value in these baseline variables indicates an extra - ! stock that will be subtracted later.) But glacier columns do not represent the soil - ! under the glacial ice. Let's assume that the soil state under each glacier column is - ! the same as the soil state in the natural vegetation landunit on that grid cell. We - ! subtract this from the dynbal baseline variables to indicate a missing stock. - call set_glacier_baselines(bounds, num_icemecc, filter_icemecc, & - vals_col = soil_liquid_mass_col(bounds%begc:bounds%endc), & - baselines_col = dynbal_baseline_liq(bounds%begc:bounds%endc)) - call set_glacier_baselines(bounds, num_icemecc, filter_icemecc, & - vals_col = soil_ice_mass_col(bounds%begc:bounds%endc), & - baselines_col = dynbal_baseline_ice(bounds%begc:bounds%endc)) - - - ! set baselines for lake columns - - ! Calculate the total water volume of the lake column - call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, lakestate_inst, & - tracer_ratio = waterstate_inst%info%get_ratio(), & - liquid_mass = lake_liquid_mass_col(bounds%begc:bounds%endc), & - ice_mass = lake_ice_mass_col(bounds%begc:bounds%endc)) - - do fc = 1, num_lakec - c = filter_lakec(fc) - dynbal_baseline_liq(c) = lake_liquid_mass_col(c) - dynbal_baseline_ice(c) = lake_ice_mass_col(c) - end do + if (reset_all_baselines) then + soil_liquid_mass_col(bounds%begc:bounds%endc) = 0._r8 + soil_ice_mass_col (bounds%begc:bounds%endc) = 0._r8 + + call AccumulateSoilLiqIceMassNonLake(bounds, & + natveg_and_glc_filterc%num, natveg_and_glc_filterc%indices, & + waterstate_inst, & + liquid_mass = soil_liquid_mass_col(bounds%begc:bounds%endc), & + ice_mass = soil_ice_mass_col(bounds%begc:bounds%endc)) + + ! For glacier columns, the liquid and ice in the "soil" (i.e., in the glacial ice) is + ! a virtual pool. So we'll subtract this amount when determining the dynbal + ! fluxes. (Note that a positive value in these baseline variables indicates an extra + ! stock that will be subtracted later.) But glacier columns do not represent the soil + ! under the glacial ice. Let's assume that the soil state under each glacier column is + ! the same as the soil state in the natural vegetation landunit on that grid cell. We + ! subtract this from the dynbal baseline variables to indicate a missing stock. + call set_glacier_baselines(bounds, num_icemecc, filter_icemecc, & + vals_col = soil_liquid_mass_col(bounds%begc:bounds%endc), & + baselines_col = dynbal_baseline_liq(bounds%begc:bounds%endc)) + call set_glacier_baselines(bounds, num_icemecc, filter_icemecc, & + vals_col = soil_ice_mass_col(bounds%begc:bounds%endc), & + baselines_col = dynbal_baseline_ice(bounds%begc:bounds%endc)) + end if + + if (reset_all_baselines .or. reset_lake_baselines) then + ! set baselines for lake columns + lake_liquid_mass_col(bounds%begc:bounds%endc) = 0._r8 + lake_ice_mass_col (bounds%begc:bounds%endc) = 0._r8 + + ! Calculate the total water volume of the lake column + call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, lakestate_inst, & + tracer_ratio = waterstate_inst%info%get_ratio(), & + liquid_mass = lake_liquid_mass_col(bounds%begc:bounds%endc), & + ice_mass = lake_ice_mass_col(bounds%begc:bounds%endc)) + + do fc = 1, num_lakec + c = filter_lakec(fc) + dynbal_baseline_liq(c) = lake_liquid_mass_col(c) + dynbal_baseline_ice(c) = lake_ice_mass_col(c) + end do + end if + end associate end subroutine dyn_water_content_set_baselines @@ -223,7 +270,8 @@ end subroutine dyn_water_content_set_baselines subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & num_icemecc, filter_icemecc, num_lakec, filter_lakec, & urbanparams_inst, soilstate_inst, lakestate_inst, waterstatebulk_inst, & - temperature_inst) + temperature_inst, & + reset_all_baselines, reset_lake_baselines) ! ! !DESCRIPTION: ! Set start-of-run baseline values for heat content. @@ -243,6 +291,10 @@ subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & type(lakestate_type) , intent(in) :: lakestate_inst type(waterstatebulk_type), intent(in) :: waterstatebulk_inst type(temperature_type), intent(inout) :: temperature_inst + + ! See dyn_hwcontent_set_baselines for documentation of these arguments + logical, intent(in) :: reset_all_baselines + logical, intent(in) :: reset_lake_baselines ! ! !LOCAL VARIABLES: integer :: c, fc ! indices @@ -258,51 +310,52 @@ subroutine dyn_heat_content_set_baselines(bounds, natveg_and_glc_filterc, & dynbal_baseline_heat => temperature_inst%dynbal_baseline_heat_col & ! Output: [real(r8) (:) ] baseline heat content subtracted from each column's total heat calculation (J/m2) ) - soil_heat_col(bounds%begc:bounds%endc) = 0._r8 - soil_heat_liquid_col(bounds%begc:bounds%endc) = 0._r8 - soil_cv_liquid_col(bounds%begc:bounds%endc) = 0._r8 - - lake_heat_col(bounds%begc:bounds%endc) = 0._r8 - - call AccumulateSoilHeatNonLake(bounds, & - natveg_and_glc_filterc%num, natveg_and_glc_filterc%indices, & - urbanparams_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, & - heat = soil_heat_col(bounds%begc:bounds%endc), & - heat_liquid = soil_heat_liquid_col(bounds%begc:bounds%endc), & - cv_liquid = soil_cv_liquid_col(bounds%begc:bounds%endc)) - - - ! See comments in dyn_water_content_set_baselines for rationale for these glacier - ! baselines. Even though the heat in glacier ice can interact with the rest of the - ! system (e.g., giving off heat to the atmosphere or receiving heat from the - ! atmosphere), it is still a virtual state in the sense that the glacier ice column - ! is virtual. And, as for water, we subtract the heat of the soil in the associated - ! natural vegetated landunit to account for the fact that we don't explicitly model - ! the soil under glacial ice. - ! - ! Aside from these considerations of what is virtual vs. real, another rationale - ! driving the use of these baselines is the desire to minimize the dynbal fluxes. For - ! the sake of conservation, it seems okay to pick any fixed baseline when summing the - ! energy (or water) content of a given column (as long as that baseline doesn't - ! change over time). By using the baselines computed here, we reduce the dynbal - ! fluxes to more reasonable values. - call set_glacier_baselines(bounds, num_icemecc, filter_icemecc, & - vals_col = soil_heat_col(bounds%begc:bounds%endc), & - baselines_col = dynbal_baseline_heat(bounds%begc:bounds%endc)) - - - ! Set baselines for lake columns - call AccumulateHeatLake(bounds, num_lakec, filter_lakec, & - temperature_inst, lakestate_inst, & - heat = lake_heat_col) - - do fc = 1, num_lakec - c = filter_lakec(fc) + if (reset_all_baselines) then + soil_heat_col(bounds%begc:bounds%endc) = 0._r8 + soil_heat_liquid_col(bounds%begc:bounds%endc) = 0._r8 + soil_cv_liquid_col(bounds%begc:bounds%endc) = 0._r8 + + call AccumulateSoilHeatNonLake(bounds, & + natveg_and_glc_filterc%num, natveg_and_glc_filterc%indices, & + urbanparams_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, & + heat = soil_heat_col(bounds%begc:bounds%endc), & + heat_liquid = soil_heat_liquid_col(bounds%begc:bounds%endc), & + cv_liquid = soil_cv_liquid_col(bounds%begc:bounds%endc)) + + ! See comments in dyn_water_content_set_baselines for rationale for these glacier + ! baselines. Even though the heat in glacier ice can interact with the rest of the + ! system (e.g., giving off heat to the atmosphere or receiving heat from the + ! atmosphere), it is still a virtual state in the sense that the glacier ice column + ! is virtual. And, as for water, we subtract the heat of the soil in the associated + ! natural vegetated landunit to account for the fact that we don't explicitly model + ! the soil under glacial ice. + ! + ! Aside from these considerations of what is virtual vs. real, another rationale + ! driving the use of these baselines is the desire to minimize the dynbal fluxes. For + ! the sake of conservation, it seems okay to pick any fixed baseline when summing the + ! energy (or water) content of a given column (as long as that baseline doesn't + ! change over time). By using the baselines computed here, we reduce the dynbal + ! fluxes to more reasonable values. + call set_glacier_baselines(bounds, num_icemecc, filter_icemecc, & + vals_col = soil_heat_col(bounds%begc:bounds%endc), & + baselines_col = dynbal_baseline_heat(bounds%begc:bounds%endc)) + end if + + if (reset_all_baselines .or. reset_lake_baselines) then + ! Set baselines for lake columns + + lake_heat_col(bounds%begc:bounds%endc) = 0._r8 + + call AccumulateHeatLake(bounds, num_lakec, filter_lakec, & + temperature_inst, lakestate_inst, & + heat = lake_heat_col) + + do fc = 1, num_lakec + c = filter_lakec(fc) + dynbal_baseline_heat(c) = lake_heat_col(c) + end do + end if - dynbal_baseline_heat(c) = lake_heat_col(c) - - end do - end associate end subroutine dyn_heat_content_set_baselines diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index c07a47c7ed..b8f5d0aa95 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -339,6 +339,7 @@ subroutine initialize2( ) logical :: lexist integer :: closelatidx,closelonidx real(r8) :: closelat,closelon + logical :: reset_dynbal_baselines_lake_columns integer :: begp, endp integer :: begc, endc integer :: begl, endl @@ -490,7 +491,13 @@ subroutine initialize2( ) filter_inactive_and_active(nc)%icemecc, & filter_inactive_and_active(nc)%num_lakec, & filter_inactive_and_active(nc)%lakec, & - urbanparams_inst, soilstate_inst, lakestate_inst, water_inst, temperature_inst) + urbanparams_inst, soilstate_inst, lakestate_inst, water_inst, temperature_inst, & + reset_all_baselines = .true., & + ! reset_lake_baselines is irrelevant since reset_all_baselines is true + reset_lake_baselines = .false., & + ! no need to print information about these resets for this initial resetting, + ! which is always done + print_resets = .false.) end do ! ------------------------------------------------------------------------ @@ -543,6 +550,7 @@ subroutine initialize2( ) is_cold_start = .false. is_interpolated_start = .false. + reset_dynbal_baselines_lake_columns = .false. if (nsrest == nsrStartup) then @@ -563,7 +571,8 @@ subroutine initialize2( ) write(iulog,*)'Reading initial conditions from ',trim(finidat) end if call getfil( finidat, fnamer, 0 ) - call restFile_read(bounds_proc, fnamer, glc_behavior) + call restFile_read(bounds_proc, fnamer, glc_behavior, & + reset_dynbal_baselines_lake_columns = reset_dynbal_baselines_lake_columns) end if else if ((nsrest == nsrContinue) .or. (nsrest == nsrBranch)) then @@ -571,7 +580,13 @@ subroutine initialize2( ) if (masterproc) then write(iulog,*)'Reading restart file ',trim(fnamer) end if - call restFile_read(bounds_proc, fnamer, glc_behavior) + call restFile_read(bounds_proc, fnamer, glc_behavior, & + reset_dynbal_baselines_lake_columns = reset_dynbal_baselines_lake_columns) + ! But for a continue or branch run, it seems safest to NOT reset lake dynbal + ! baselines. In nearly all cases, this will be irrelevant, because the restart + ! file will have been a recent one, where reset_dynbal_baselines_lake_columns + ! should be false already. + reset_dynbal_baselines_lake_columns = .false. end if @@ -598,7 +613,8 @@ subroutine initialize2( ) glc_behavior=glc_behavior) ! Read new interpolated conditions file back in - call restFile_read(bounds_proc, finidat_interp_dest, glc_behavior) + call restFile_read(bounds_proc, finidat_interp_dest, glc_behavior, & + reset_dynbal_baselines_lake_columns = reset_dynbal_baselines_lake_columns) ! Reset finidat to now be finidat_interp_dest ! (to be compatible with routines still using finidat) @@ -613,33 +629,31 @@ subroutine initialize2( ) ! interpolated restart file, if applicable). ! ------------------------------------------------------------------------ - if (get_reset_dynbal_baselines()) then - if (nsrest == nsrStartup) then - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'Resetting dynbal baselines' - write(iulog,*) ' ' - end if + if (nsrest == nsrStartup) then - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - call dyn_hwcontent_set_baselines(bounds_clump, & - filter_inactive_and_active(nc)%num_icemecc, & - filter_inactive_and_active(nc)%icemecc, & - filter_inactive_and_active(nc)%num_lakec, & - filter_inactive_and_active(nc)%lakec, & - urbanparams_inst, soilstate_inst, lakestate_inst, & - water_inst, temperature_inst) - end do - else if (nsrest == nsrBranch) then + !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) + do nc = 1,nclumps + call get_clump_bounds(nc, bounds_clump) + + call dyn_hwcontent_set_baselines(bounds_clump, & + filter_inactive_and_active(nc)%num_icemecc, & + filter_inactive_and_active(nc)%icemecc, & + filter_inactive_and_active(nc)%num_lakec, & + filter_inactive_and_active(nc)%lakec, & + urbanparams_inst, soilstate_inst, lakestate_inst, & + water_inst, temperature_inst, & + reset_all_baselines = get_reset_dynbal_baselines(), & + reset_lake_baselines = reset_dynbal_baselines_lake_columns, & + print_resets = .true.) + end do + else if (nsrest == nsrBranch) then + if (get_reset_dynbal_baselines()) then call endrun(msg='ERROR clm_initializeMod: '//& 'Cannot set reset_dynbal_baselines in a branch run') end if - ! nsrContinue not explicitly handled: it's okay for reset_dynbal_baselines to - ! remain set in a continue run, but it has no effect end if + ! nsrContinue not explicitly handled: it's okay for reset_dynbal_baselines to + ! remain set in a continue run, but it has no effect ! ------------------------------------------------------------------------ ! Initialize nitrogen deposition diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 83be13835b..4302cbc1c0 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -25,6 +25,7 @@ module restFileMod use ncdio_pio , only : check_att, ncd_getatt use glcBehaviorMod , only : glc_behavior_type use reweightMod , only : reweight_wrapup + use IssueFixedMetadataHandler, only : write_issue_fixed_metadata, read_issue_fixed_metadata ! ! !PUBLIC TYPES: implicit none @@ -44,6 +45,8 @@ module restFileMod private :: restFile_write_pfile ! Writes restart pointer file private :: restFile_closeRestart ! Close restart file and write restart pointer file private :: restFile_dimset + private :: restFile_write_issues_fixed ! Write metadata for issues fixed + private :: restFile_read_issues_fixed ! Read and process metadata for issues fixed private :: restFile_add_flag_metadata ! Add global metadata for some logical flag private :: restFile_add_ilun_metadata ! Add global metadata defining landunit types private :: restFile_add_icol_metadata ! Add global metadata defining column types @@ -56,6 +59,9 @@ module restFileMod ! ! !PRIVATE TYPES: + ! Issue numbers for issue-fixed metadata + integer, parameter :: lake_dynbal_baseline_issue = 1140 + character(len=*), parameter, private :: sourcefile = & __FILE__ !----------------------------------------------------------------------- @@ -108,6 +114,9 @@ subroutine restFile_write( bounds, file, writing_finidat_interp_dest_file, rdate call hist_restart_ncd (bounds, ncid, flag='define', rdate=rdate ) end if + call restFile_write_issues_fixed(ncid, & + writing_finidat_interp_dest_file = writing_finidat_interp_dest_file) + call restFile_enddef( ncid ) ! Write variables @@ -142,7 +151,7 @@ subroutine restFile_write( bounds, file, writing_finidat_interp_dest_file, rdate end subroutine restFile_write !----------------------------------------------------------------------- - subroutine restFile_read( bounds_proc, file, glc_behavior ) + subroutine restFile_read( bounds_proc, file, glc_behavior, reset_dynbal_baselines_lake_columns ) ! ! !DESCRIPTION: ! Read a CLM restart file. @@ -151,6 +160,13 @@ subroutine restFile_read( bounds_proc, file, glc_behavior ) type(bounds_type) , intent(in) :: bounds_proc ! processor-level bounds character(len=*) , intent(in) :: file ! output netcdf restart file type(glc_behavior_type), intent(in) :: glc_behavior + + ! BACKWARDS_COMPATIBILITY(wjs, 2020-09-02) This is needed when reading old initial + ! conditions files created before https://github.com/ESCOMP/CTSM/issues/1140 was + ! resolved via https://github.com/ESCOMP/CTSM/pull/1109: The definition of total + ! column water content has been changed for lakes, so we need to reset baseline values + ! for lakes on older initial conditions files. + logical, intent(out) :: reset_dynbal_baselines_lake_columns ! ! !LOCAL VARIABLES: type(file_desc_t) :: ncid ! netcdf id @@ -201,6 +217,9 @@ subroutine restFile_read( bounds_proc, file, glc_behavior ) call hist_restart_ncd (bounds_proc, ncid, flag='read' ) + call restFile_read_issues_fixed(ncid, & + reset_dynbal_baselines_lake_columns = reset_dynbal_baselines_lake_columns) + ! Do error checking on file call restFile_check_consistency(bounds_proc, ncid) @@ -563,6 +582,63 @@ subroutine restFile_dimset( ncid ) end subroutine restFile_dimset + !----------------------------------------------------------------------- + subroutine restFile_write_issues_fixed(ncid, writing_finidat_interp_dest_file) + ! + ! !DESCRIPTION: + ! Write metadata for issues fixed + ! + ! !ARGUMENTS: + type(file_desc_t), intent(inout) :: ncid ! local file id + logical , intent(in) :: writing_finidat_interp_dest_file ! true if we are writing a finidat_interp_dest file + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'restFile_write_issues_fixed' + !----------------------------------------------------------------------- + + ! See comment associated with reset_dynbal_baselines_lake_columns in restFile_read + call write_issue_fixed_metadata( & + ncid = ncid, & + writing_finidat_interp_dest_file = writing_finidat_interp_dest_file, & + issue_num = lake_dynbal_baseline_issue) + + end subroutine restFile_write_issues_fixed + + !----------------------------------------------------------------------- + subroutine restFile_read_issues_fixed(ncid, reset_dynbal_baselines_lake_columns) + ! + ! !DESCRIPTION: + ! Read and process metadata for issues fixed + ! + ! !ARGUMENTS: + type(file_desc_t), intent(inout) :: ncid ! local file id + logical, intent(out) :: reset_dynbal_baselines_lake_columns ! see comment in restFile_read for details + ! + ! !LOCAL VARIABLES: + integer :: attribute_value + + character(len=*), parameter :: subname = 'restFile_read_issues_fixed' + !----------------------------------------------------------------------- + + ! See comment associated with reset_dynbal_baselines_lake_columns in restFile_read + call read_issue_fixed_metadata( & + ncid = ncid, & + issue_num = lake_dynbal_baseline_issue, & + attribute_value = attribute_value) + if (attribute_value == 0) then + ! Old restart file, from before lake_dynbal_baseline_issue was resolved, so we + ! need to reset dynbal baselines for lake columns later in initialization. + reset_dynbal_baselines_lake_columns = .true. + else + ! Recent restart file, so no need to reset dynbal baselines for lake columns, + ! because they are already up to date. + reset_dynbal_baselines_lake_columns = .false. + end if + + end subroutine restFile_read_issues_fixed + + !----------------------------------------------------------------------- subroutine restFile_add_flag_metadata(ncid, flag, flag_name) ! From acf09849ccbf6e1f3f4eade1ad959a7fb055ee0b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 3 Sep 2020 12:05:49 -0600 Subject: [PATCH 1416/1973] Reset lake baselines in branch or continue run, too I went back and forth about whether we should do this, but I actually feel that it's best if we do reset the lake baselines in a branch or continue run, if using an older restart file. If we didn't do this, we'd want to add some logic for writing out the issue-fixed metadata for any further restart files written from these runs, to note that this issue isn't actually fixed yet on these restart files. --- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 19 +------ src/main/clm_initializeMod.F90 | 71 +++++++++++++----------- 2 files changed, 41 insertions(+), 49 deletions(-) diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index e3b25b1322..089715233d 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -12,8 +12,6 @@ module dynConsBiogeophysMod use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type - use spmdMod , only : masterproc - use clm_varctl , only : iulog use UrbanParamsType , only : urbanparams_type use EnergyFluxType , only : energyflux_type use SoilHydrologyType , only : soilhydrology_type @@ -69,7 +67,7 @@ module dynConsBiogeophysMod subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & num_lakec, filter_lakec, & urbanparams_inst, soilstate_inst, lakestate_inst, water_inst, temperature_inst, & - reset_all_baselines, reset_lake_baselines, print_resets) + reset_all_baselines, reset_lake_baselines) ! ! !DESCRIPTION: ! Set start-of-run baseline values for heat and water content in some columns. @@ -125,9 +123,6 @@ subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & ! for lakes on older initial conditions files. logical, intent(in) :: reset_lake_baselines - ! Whether to print information about the reset flags - logical, intent(in) :: print_resets - ! ! !LOCAL VARIABLES: integer :: i @@ -136,18 +131,6 @@ subroutine dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & character(len=*), parameter :: subname = 'dyn_hwcontent_set_baselines' !----------------------------------------------------------------------- - if (masterproc .and. print_resets) then - if (reset_all_baselines) then - write(iulog,*) ' ' - write(iulog,*) 'Resetting dynbal baselines for all columns' - write(iulog,*) ' ' - else if (reset_lake_baselines) then - write(iulog,*) ' ' - write(iulog,*) 'Resetting dynbal baselines for lake columns' - write(iulog,*) ' ' - end if - end if - ! Note that we include inactive points in the following. This could be important if ! an inactive point later becomes active, so that we have an appropriate baseline ! value for that point. diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index b8f5d0aa95..771b88e5da 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -339,6 +339,7 @@ subroutine initialize2( ) logical :: lexist integer :: closelatidx,closelonidx real(r8) :: closelat,closelon + logical :: reset_dynbal_baselines_all_columns logical :: reset_dynbal_baselines_lake_columns integer :: begp, endp integer :: begc, endc @@ -494,10 +495,7 @@ subroutine initialize2( ) urbanparams_inst, soilstate_inst, lakestate_inst, water_inst, temperature_inst, & reset_all_baselines = .true., & ! reset_lake_baselines is irrelevant since reset_all_baselines is true - reset_lake_baselines = .false., & - ! no need to print information about these resets for this initial resetting, - ! which is always done - print_resets = .false.) + reset_lake_baselines = .false.) end do ! ------------------------------------------------------------------------ @@ -582,12 +580,6 @@ subroutine initialize2( ) end if call restFile_read(bounds_proc, fnamer, glc_behavior, & reset_dynbal_baselines_lake_columns = reset_dynbal_baselines_lake_columns) - ! But for a continue or branch run, it seems safest to NOT reset lake dynbal - ! baselines. In nearly all cases, this will be irrelevant, because the restart - ! file will have been a recent one, where reset_dynbal_baselines_lake_columns - ! should be false already. - reset_dynbal_baselines_lake_columns = .false. - end if ! ------------------------------------------------------------------------ @@ -629,31 +621,48 @@ subroutine initialize2( ) ! interpolated restart file, if applicable). ! ------------------------------------------------------------------------ - if (nsrest == nsrStartup) then - - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - call dyn_hwcontent_set_baselines(bounds_clump, & - filter_inactive_and_active(nc)%num_icemecc, & - filter_inactive_and_active(nc)%icemecc, & - filter_inactive_and_active(nc)%num_lakec, & - filter_inactive_and_active(nc)%lakec, & - urbanparams_inst, soilstate_inst, lakestate_inst, & - water_inst, temperature_inst, & - reset_all_baselines = get_reset_dynbal_baselines(), & - reset_lake_baselines = reset_dynbal_baselines_lake_columns, & - print_resets = .true.) - end do - else if (nsrest == nsrBranch) then - if (get_reset_dynbal_baselines()) then + reset_dynbal_baselines_all_columns = get_reset_dynbal_baselines() + if (nsrest == nsrBranch) then + if (reset_dynbal_baselines_all_columns) then call endrun(msg='ERROR clm_initializeMod: '//& 'Cannot set reset_dynbal_baselines in a branch run') end if + else if (nsrest == nsrContinue) then + ! It's okay for the reset_dynbal_baselines flag to remain set in a continue + ! run, but we'll ignore it. (This way, the user doesn't have to change their + ! namelist file for the continue run.) + reset_dynbal_baselines_all_columns = .false. + end if + ! Note that we will still honor reset_dynbal_baselines_lake_columns even in a branch + ! or continue run: even in these runs, we want to reset those baselines if they are + ! wrong on the restart file. + + if (masterproc) then + if (reset_dynbal_baselines_all_columns) then + write(iulog,*) ' ' + write(iulog,*) 'Resetting dynbal baselines for all columns' + write(iulog,*) ' ' + else if (reset_dynbal_baselines_lake_columns) then + write(iulog,*) ' ' + write(iulog,*) 'Resetting dynbal baselines for lake columns' + write(iulog,*) ' ' + end if end if - ! nsrContinue not explicitly handled: it's okay for reset_dynbal_baselines to - ! remain set in a continue run, but it has no effect + + !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) + do nc = 1,nclumps + call get_clump_bounds(nc, bounds_clump) + + call dyn_hwcontent_set_baselines(bounds_clump, & + filter_inactive_and_active(nc)%num_icemecc, & + filter_inactive_and_active(nc)%icemecc, & + filter_inactive_and_active(nc)%num_lakec, & + filter_inactive_and_active(nc)%lakec, & + urbanparams_inst, soilstate_inst, lakestate_inst, & + water_inst, temperature_inst, & + reset_all_baselines = reset_dynbal_baselines_all_columns, & + reset_lake_baselines = reset_dynbal_baselines_lake_columns) + end do ! ------------------------------------------------------------------------ ! Initialize nitrogen deposition From 8088c3c5ae7c0f391fa67ddf1367727eaec5ddbd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 3 Sep 2020 13:44:54 -0600 Subject: [PATCH 1417/1973] Add missing 'OMP END PARALLEL DO' statements These seem to have been missing for a while (forever?). --- src/main/clm_initializeMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 771b88e5da..912bbb293b 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -497,6 +497,7 @@ subroutine initialize2( ) ! reset_lake_baselines is irrelevant since reset_all_baselines is true reset_lake_baselines = .false.) end do + !$OMP END PARALLEL DO ! ------------------------------------------------------------------------ ! Initialize modules (after time-manager initialization in most cases) @@ -663,6 +664,7 @@ subroutine initialize2( ) reset_all_baselines = reset_dynbal_baselines_all_columns, & reset_lake_baselines = reset_dynbal_baselines_lake_columns) end do + !$OMP END PARALLEL DO ! ------------------------------------------------------------------------ ! Initialize nitrogen deposition From a31875d11287bc40c2645198ab39ca39234ec914 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 3 Sep 2020 14:19:00 -0600 Subject: [PATCH 1418/1973] Reorder accumulations to avoid loss of precision --- src/biogeophys/TotalWaterAndHeatMod.F90 | 117 ++++++++++++++---------- 1 file changed, 69 insertions(+), 48 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index ba794f67a4..cd7316af81 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -444,18 +444,22 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & ice_mass(c) = 0._r8 end do - ! Snow water content - do fc = 1, num_lakec - c = filter_lakec(fc) + ! ------------------------------------------------------------------------ + ! Start with some large terms that will often cancel (the negative baselines and the + ! lake water content): In order to maintain precision in the other terms, it can help if + ! we deal with these large, often-canceling terms first. (If we accumulated some + ! small terms, then added a big term and then subtracted a big term, we would have + ! lost some precision in the small terms.) + ! ------------------------------------------------------------------------ - ice_mass(c) = ice_mass(c) + h2osno_no_layers(c) - do j = snl(c)+1,0 - liquid_mass(c) = liquid_mass(c) + h2osoi_liq(c,j) - ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) + if (add_lake_water_and_subtract_dynbal_baselines) then + ! Subtract baselines set in initialization + do fc = 1, num_lakec + c = filter_lakec(fc) + liquid_mass(c) = liquid_mass(c) - dynbal_baseline_liq(c) + ice_mass(c) = ice_mass(c) - dynbal_baseline_ice(c) end do - end do - if (add_lake_water_and_subtract_dynbal_baselines) then ! Lake water content call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, & lakestate_inst, & @@ -464,23 +468,29 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & ice_mass = ice_mass(bounds%begc:bounds%endc)) end if - ! Soil water content of the soil under the lake - do j = 1, nlevgrnd - do fc = 1, num_lakec - c = filter_lakec(fc) + ! ------------------------------------------------------------------------ + ! Now add some other terms + ! ------------------------------------------------------------------------ + + ! Snow water content + do fc = 1, num_lakec + c = filter_lakec(fc) + + ice_mass(c) = ice_mass(c) + h2osno_no_layers(c) + do j = snl(c)+1,0 liquid_mass(c) = liquid_mass(c) + h2osoi_liq(c,j) ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) end do end do - if (add_lake_water_and_subtract_dynbal_baselines) then - ! Subtract baselines set in initialization + ! Soil water content of the soil under the lake + do j = 1, nlevgrnd do fc = 1, num_lakec c = filter_lakec(fc) - liquid_mass(c) = liquid_mass(c) - dynbal_baseline_liq(c) - ice_mass(c) = ice_mass(c) - dynbal_baseline_ice(c) + liquid_mass(c) = liquid_mass(c) + h2osoi_liq(c,j) + ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) end do - end if + end do end associate @@ -949,6 +959,42 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & latent_heat_liquid(c) = 0._r8 end do + ! ------------------------------------------------------------------------ + ! Start with some large terms that will often cancel (the negative baselines and the + ! lake water content): In order to maintain precision in the other terms, it can help if + ! we deal with these large, often-canceling terms first. (If we accumulated some + ! small terms, then added a big term and then subtracted a big term, we would have + ! lost some precision in the small terms.) + ! ------------------------------------------------------------------------ + + ! Subtract baselines set in initialization + ! + ! NOTE(wjs, 2019-03-01) I haven't given enough thought to how (if at all) we should + ! correct for heat_liquid and cv_liquid, which are used to determine the weighted + ! average liquid water temperature. For example, if we're subtracting out a baseline + ! water amount because a particular water state is fictitious, we probably shouldn't + ! include that particular state when determining the weighted average temperature of + ! liquid water. And conversely, if we're adding a state via these baselines, should + ! we also add some water temperature of that state? The tricky thing here is what to + ! do when we end up subtracting water due to the baselines, so for now I'm simply not + ! trying to account for the temperature of these baselines at all. This amounts to + ! assuming that the baselines that we add / subtract are at the average temperature + ! of the real liquid water in the column. + do fc = 1, num_lakec + c = filter_lakec(fc) + heat(c) = -dynbal_baseline_heat(c) + end do + + ! Lake water heat content + ! Note that we do NOT accumulate heat_liquid and cv_liquid in this call. See the + ! comments at the top of AccumulateHeatLake for rationale. + call AccumulateHeatLake(bounds, num_lakec, filter_lakec, temperature_inst, lakestate_inst, & + heat) + + ! ------------------------------------------------------------------------ + ! Now add some other terms + ! ------------------------------------------------------------------------ + ! Snow heat content do fc = 1, num_lakec c = filter_lakec(fc) @@ -989,41 +1035,16 @@ subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & do fc = 1, num_lakec c = filter_lakec(fc) - heat(c) = heat_dry_mass(c) + heat_ice(c) + heat_liquid(c) + latent_heat_liquid(c) + heat(c) = heat(c) + heat_dry_mass(c) + heat_ice(c) + heat_liquid(c) + latent_heat_liquid(c) end do - ! Lake water heat content - ! Note that we do NOT accumulate heat_liquid and cv_liquid in this call. See the - ! comments at the top of AccumulateHeatLake for rationale. - call AccumulateHeatLake(bounds, num_lakec, filter_lakec, temperature_inst, lakestate_inst, & - heat) - - ! Subtract baselines set in initialization - ! - ! - ! NOTE(wjs, 2019-03-01) I haven't given enough thought to how (if at all) we should - ! correct for heat_liquid and cv_liquid, which are used to determine the weighted - ! average liquid water temperature. For example, if we're subtracting out a baseline - ! water amount because a particular water state is fictitious, we probably shouldn't - ! include that particular state when determining the weighted average temperature of - ! liquid water. And conversely, if we're adding a state via these baselines, should - ! we also add some water temperature of that state? The tricky thing here is what to - ! do when we end up subtracting water due to the baselines, so for now I'm simply not - ! trying to account for the temperature of these baselines at all. This amounts to - ! assuming that the baselines that we add / subtract are at the average temperature - ! of the real liquid water in the column. - do fc = 1, num_lakec - c = filter_lakec(fc) - heat(c) = heat(c) - dynbal_baseline_heat(c) - end do - end associate end subroutine ComputeHeatLake !----------------------------------------------------------------------- subroutine AccumulateHeatLake(bounds, num_c, filter_c, & - temperature_inst, lakestate_inst, & + temperature_inst, lakestate_inst, & heat) ! ! !DESCRIPTION: @@ -1110,11 +1131,11 @@ subroutine AccumulateHeatLake(bounds, num_c, filter_c, & end do end do - ! add ice heat and liquid heat together + ! add ice heat and liquid heat together do fc = 1, num_c c = filter_c(fc) - heat(c) = heat(c) + lake_heat_ice(c) + & - lake_heat_liquid(c) + lake_latent_heat_liquid(c) + heat(c) = heat(c) + (lake_heat_ice(c) + & + lake_heat_liquid(c) + lake_latent_heat_liquid(c)) end do end associate From e842390011f51dd75f87c1693fa80915970b2371 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 4 Sep 2020 13:13:04 -0600 Subject: [PATCH 1419/1973] Bring changes from fire2019changes to latest Use patch to bring the changes from the lifang/fire2019changes. Make sure the namelist unit test works, and cases build. --- .config_files.xml | 9 +- .gitignore | 5 +- bld/CLMBuildNamelist.pm | 2 +- bld/config_files/clm_phys_vers.pm | 6 +- bld/config_files/config_definition_ctsm.xml | 4 +- bld/listDefaultNamelist.pl | 2 +- bld/namelist_files/namelist_defaults_ctsm.xml | 508 +++++++++----- .../namelist_defaults_drydep.xml | 1 + .../namelist_defaults_overall.xml | 29 +- .../namelist_definition_ctsm.xml | 5 +- bld/namelist_files/use_cases/1850_control.xml | 16 +- .../use_cases/1850_noanthro_control.xml | 19 +- bld/namelist_files/use_cases/2000_control.xml | 18 +- bld/namelist_files/use_cases/2010_control.xml | 50 +- .../use_cases/20thC_transient.xml | 22 +- bld/namelist_files/use_cases/stdurbpt_pd.xml | 8 +- bld/unit_testers/build-namelist_test.pl | 60 +- cime_config/SystemTests/lciso.py | 4 +- cime_config/SystemTests/lii.py | 8 +- cime_config/SystemTests/lii2finidatareas.py | 4 +- cime_config/SystemTests/lvg.py | 4 +- cime_config/SystemTests/lwiso.py | 4 +- cime_config/SystemTests/soilstructud.py | 8 +- cime_config/buildlib | 14 +- cime_config/buildnml | 35 +- cime_config/config_archive.xml | 21 + cime_config/config_component.xml | 53 +- cime_config/config_compsets.xml | 7 +- src/biogeochem/CNDVDriverMod.F90 | 4 +- src/biogeochem/CNFireFactoryMod.F90 | 3 + src/biogeochem/CNFireLi2021Mod.F90 | 661 ++++++++++++++++++ src/biogeophys/SoilMoistStressMod.F90 | 8 +- src/main/clm_varctl.F90 | 3 + src/main/histFileMod.F90 | 10 +- src/main/pftconMod.F90 | 11 + src/main/restFileMod.F90 | 8 +- 36 files changed, 1285 insertions(+), 349 deletions(-) create mode 100644 src/biogeochem/CNFireLi2021Mod.F90 diff --git a/.config_files.xml b/.config_files.xml index 8e4868b94f..e45534d8d7 100644 --- a/.config_files.xml +++ b/.config_files.xml @@ -5,19 +5,20 @@ char unset - $SRCROOT + $SRCROOT + $SRCROOT $CIMEROOT/src/components/data_comps/dlnd $CIMEROOT/src/components/stub_comps/slnd $CIMEROOT/src/components/xcpl_comps/xlnd diff --git a/.gitignore b/.gitignore index 7948b49eed..70b87590a6 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ buildnmlc /bld/unit_testers/drv_flds_in* /bld/unit_testers/temp_file.txt* /bld/unit_testers/user_nl_clm_real_parameters* +/bld/unit_testers/user_nl_ctsm_real_parameters* /bld/unit_testers/env_run.xml # tools testing output @@ -86,8 +87,8 @@ surfdata_*.namelist landuse.timeseries_*.namelist landuse.timeseries_*.log landuse_timeseries_*.txt -clm.input_data_list -clm.input_data_list.previous +ctsm.input_data_list +ctsm.input_data_list.previous *.stdout.txt.o* # mksurfdata unit tests diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 054db5e8f4..6a31b66b3f 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3391,7 +3391,7 @@ sub setup_logic_megan { #------------------------------------------------------------------------------- sub setup_logic_soilm_streams { - # prescribed soil moisture streams require clm4_5/clm5_0 + # prescribed soil moisture streams require clm4_5/clm5_0/ctsm5_1 my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); diff --git a/bld/config_files/clm_phys_vers.pm b/bld/config_files/clm_phys_vers.pm index 32124491a8..c6797f74cd 100755 --- a/bld/config_files/clm_phys_vers.pm +++ b/bld/config_files/clm_phys_vers.pm @@ -28,7 +28,7 @@ use bigint; #use warnings; #use diagnostics; -my @version_strings = ("clm4_5", "clm5_0"); +my @version_strings = ("clm4_5", "clm5_0", "ctsm5_1"); #------------------------------------------------------------------------------- @@ -83,12 +83,12 @@ if ( ! defined(caller) && $#ARGV == -1 ) { require Test::More; Test::More->import( ); - plan( tests=>2 ); + plan( tests=>3 ); sub testit { print "unit tester\n"; my %lastv; - my @vers_list = ( "clm4_5", "clm5_0" ); + my @vers_list = ( "clm4_5", "clm5_0", "ctsm5_1" ); foreach my $vers ( @vers_list ) { my $phys = config_files::clm_phys_vers->new($vers); isa_ok($phys, "config_files::clm_phys_vers", "created clm_phys_vers object"); diff --git a/bld/config_files/config_definition_ctsm.xml b/bld/config_files/config_definition_ctsm.xml index b02510ed64..4f35249039 100644 --- a/bld/config_files/config_definition_ctsm.xml +++ b/bld/config_files/config_definition_ctsm.xml @@ -5,10 +5,10 @@ -Specifies either clm4_5 or clm5_0 physics +Specifies either clm4_5, clm5_0, or ctsm5_1 physics -Specifies clm physics +Specifies clm physics EOF $fh->close(); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 16d65964ef..3479fc34f2 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -34,15 +34,20 @@ attributes from the config_cache.xml file (with keys converted to upper-case). sp -clm4_5_CRUv7 -clm5_0_cam6.0 +clm4_5_CRUv7 +clm5_0_cam6.0 +ctsm5_1_GSWP3v1 off +2 2 1 +2 +2 +2 2 1 0 @@ -61,29 +66,32 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 20 -.false. -.false. - - -.true. -.false. +.false. +.false. +.false. -.true. +.true. +.true. +.false. -2 -1 -0 +2 +2 +1 +0 +.true. .true. .false. -Medlyn2011 -Ball-Berry1987 -Ball-Berry1987 +Medlyn2011 +Ball-Berry1987 +Medlyn2011 +Ball-Berry1987 +Ball-Berry1987 lnd/clm2/isotopes/atm_delta_C13_CMIP6_1850-2015_yearly_v2.0_c190528.nc @@ -103,9 +111,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP5B_3x1_global_1850-2100_yearly_c181209.nc -.true. -.false. -.false. +.true. +.false. +.true. +.false. +.false. .false. .true. @@ -124,60 +134,76 @@ attributes from the config_cache.xml file (with keys converted to upper-case). NONE -0.50,0.30 -0.60,0.40 +0.50,0.30 +0.50,0.30 +0.60,0.40 +ON_WASTEHEAT ON_WASTEHEAT ON -1 -0 +1 +1 +0 -FAST -NONE +FAST +FAST +NONE .false. +.true. .true. .false. 4SL_2m -20SL_8.5m -10SL_3.5m +20SL_8.5m +20SL_8.5m +10SL_3.5m -.false. -.false. -.true. -.false. +.false. +.false. +.true. +.false. +.false. +.true. +.false. -1 -0 +1 +1 +0 -1 -1 +1 +1 +1 -1 -0 +1 +1 +0 -1.d-2 -0.001d00 -1.d-2 -1.d-2 +1.d-2 +0.001d00 +1.d-2 +0.001d00 +1.d-2 +1.d-2 -2.0d00 -0.5d00 +2.0d00 +0.5d00 +0.5d00 -.true. -.false. +.true. +.true. +.false. .true. @@ -192,24 +218,29 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0. 2. -0. -2. +0. +2. --2. -0. +-2. +0. + +-2. +0. -.false. -.true. +.false. +.true. +.true. -li2016crufrc -li2014qianfrc +li2021gswpfrc +li2016crufrc +li2014qianfrc 30.0d00 80.0d00 @@ -249,28 +280,49 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 1050.d00 0.5d00, 0.28d00 +30.0d00 +80.0d00 +0.85d00 +0.98d00 +0.025d00 +0.09d-4 +0.010d00 +0.17d-3 +1.6d-4 +0.33d00 +75.d00 +1050.d00 +0.5d00, 0.28d00 + -.false. -.true. +.false. +.false. +.true. 40 3 -.true. -1.0 -0.05 +.true. +1.0 +0.05 + +.true. +1.0 +0.05 -.false. -0.25 -1.0 +.false. +0.25 +1.0 -0 -1 +0 +1 +1 1 1 +1 4 2 @@ -291,13 +343,15 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 14400 -3400. 0.6 -1.0 -0.5 +1.0 +1.0 +0.5 0.1 -.false. -.false. +.false. +.false. +.false. .false. @@ -307,15 +361,19 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .true. -12 -5 -5 +12 +5 +12 +5 +5 -10000.0 -5000.0 -1000.0 +10000.0 +5000.0 +10000.0 +5000.0 +1000.0 0.010d00 0.015d00 @@ -324,27 +382,34 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.02d00 0.05d00 -2000. +2000. +2000. -1.e30 +1.e30 -10.0d00 -10.0 +10.0d00 +10.0d00 +10.0 +.true. .true. .false. -'Vionnet2012' -'Anderson1976' +'Vionnet2012' +'Vionnet2012' +'Anderson1976' -'Slater2017' -'TruncatedAnderson1976' +'Slater2017' +'Slater2017' +'TruncatedAnderson1976' -100.d00 -175.d00 +100.d00 +175.d00 +175.d00 -54.526d00 -204.526d00 +54.526d00 +204.526d00 +204.526d00 0.08d00 @@ -384,6 +449,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). simplicity, we tie the defaults for both of these options to the overall CLM phys version, rather than having some intermediate option that controls the defaults for both h2osno_max and glc_snow_persistence_max_days. --> +0 0 7300 @@ -391,8 +457,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200624.nc -lnd/clm2/paramdata/clm45_params.c200624.nc +lnd/clm2/paramdata/clm5_params.c200624.nc +lnd/clm2/paramdata/clm5_params.c200624.nc +lnd/clm2/paramdata/clm45_params.c200624.nc @@ -403,13 +470,17 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -.true. -.false. -.false. +.true. +.false. +.true. +.false. +.false. +.true. +.false. .true. -.false. +.false. .false. @@ -437,58 +508,74 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .false. -.true. -.true. +.true. +.true. +.true. -0.17 +0.17 +0.17 .false. -.false. -.true. +.false. +.true. +.true. -constant -varytropicsbylat -12.0d00 -0.4d00 +constant +varytropicsbylat +12.0d00 +0.4d00 +varytropicsbylat +12.0d00 +0.4d00 -3.d00 -1.d00 +3.d00 +3.d00 +1.d00 -0.5 -10.0 +0.5 +10.0 +10.0 -.false. -.true. +.false. +.true. +.true. .true. -.false. -.false. -.false. -.false. -.false. +.false. +.false. +.false. +.false. +.false. +.false. -.false. -.false. -.true. - -1.d-9 -1.d-8 --6.d+1 --6.d+0 --6.d+2 --6.d+1 +.false. +.false. +.true. +.false. +.true. + +1.d-9 +1.d-9 +1.d-8 +-6.d+1 +-6.d+0 +-6.d+1 +-6.d+0 +-6.d+2 +-6.d+1 -.false. -.true. +.false. +.true. +.true. .true. @@ -584,6 +671,16 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 + + hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 @@ -600,6 +697,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 @@ -662,6 +762,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). + hgrid=ne120np4.pg3 maxpft=79 mask=tx0.1v3 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 @@ -767,6 +868,19 @@ p >lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v7_simyr1850_c200806.nc + +lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c200806.nc + +lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc + lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP5-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc -.true. -.false. +.true. +.true. +.false. 0.83d-06 +0.015d00 0.015d00 0.015d00 -20.0d00, 20.0d00, 20.0d00 -200.0d00, 200.0d00, 200.0d00 -20.0d00, 20.0d00, 20.0d00 -200.0d00, 200.0d00, 200.0d00 - -1.50d00 -0.3 -1.50d00 -0.3 - -100.d00 -20.d00 -1.d00 -1.d00 +20.0d00, 20.0d00, 20.0d00 +200.0d00, 200.0d00, 200.0d00 +200.0d00, 200.0d00, 200.0d00 +20.0d00, 20.0d00, 20.0d00 +200.0d00, 200.0d00, 200.0d00 +200.0d00, 200.0d00, 200.0d00 + +1.50d00 +1.50d00 +0.3 +1.50d00 +1.50d00 +0.3 + +100.d00 +100.d00 +20.d00 +1.d00 +1.d00 +1.d00 @@ -1281,13 +1410,17 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc -2015 -2101 -2015 +2015 +2101 +2015 -2015 -2101 -2015 +2015 +2101 +2015 + +2015 +2101 +2015 2010 2010 @@ -1307,35 +1440,49 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 2000 2000 -lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc -lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc +lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc +lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc +lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc +lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc +lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP2-4.5-WACCM_1849-2101_monthly_c191007.nc +lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP3-7.0-WACCM_1849-2101_monthly_c191007.nc + +lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP2-4.5-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP3-7.0-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP3-7.0-WACCM_1849-2101_monthly_c191007.nc -cycle -NDEP_month -limit +cycle +NDEP_month +limit -cycle -NDEP_month -limit +cycle +NDEP_month +limit + +cycle +NDEP_month +limit bilinear @@ -1401,6 +1548,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts none 94x192 94x192 +360x720 0001 0001 @@ -1419,13 +1567,17 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts nn -2015 -2100 -2015 +2015 +2100 +2015 + +2015 +2100 +2015 -2015 -2100 -2015 +2015 +2100 +2015 2010 2010 @@ -1474,13 +1626,17 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts nn -2015 -2106 -2015 +2015 +2106 +2015 + +2015 +2106 +2015 -2015 -2106 -2015 +2015 +2106 +2015 2000 2000 @@ -1500,6 +1656,9 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 1850 2106 +lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc + lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc @@ -3366,8 +3525,9 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts -TWS_inversion -ZWT_inversion +TWS_inversion +TWS_inversion +ZWT_inversion .true. .true. diff --git a/bld/namelist_files/namelist_defaults_drydep.xml b/bld/namelist_files/namelist_defaults_drydep.xml index e73f2987c2..d7ada820c3 100644 --- a/bld/namelist_files/namelist_defaults_drydep.xml +++ b/bld/namelist_files/namelist_defaults_drydep.xml @@ -23,6 +23,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 'ISOP = isoprene', 'C10H16 = pinene_a + carene_3 + thujene_a', 'CH3OH = methanol', 'C2H5OH = ethanol', 'CH2O = formaldehyde', 'CH3CHO = acetaldehyde', 'CH3COOH = acetic_acid', 'CH3COCH3 = acetone' +atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index b69f4c138b..0b6e97a932 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -22,18 +22,23 @@ determine default values for namelists. --> -arb_ic -arb_ic -arb_ic -arb_ic -startup -startup -startup -startup -arb_ic -arb_ic -arb_ic -cold +arb_ic +arb_ic +arb_ic +arb_ic +arb_ic +arb_ic +startup +startup +startup +startup +startup +startup +arb_ic +arb_ic +arb_ic +arb_ic +cold arb_ic diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index ee3586a167..5b9dbbf8cc 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -198,12 +198,13 @@ formulation (1). + group="cnfire_inparm" valid_values="nofire,li2014qianfrc,li2016crufrc,li2021gswpfrc" > The method type to use for CNFire nofire: Turn fire effects off li2014qianfrc: Reference paper Li, et. al.(2014) tuned with QIAN atmospheric forcing li2016crufrc: Reference paper Li, et. al.(2016) tuned with CRU-NCEP atmospheric forcing +li2021gswpfrc: Reference paper Li, et. al.(2021?) tuned with GSWP3 atmospheric forcing + valid_values="clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_0_cam6.0,clm5_0_CRUv7,clm5_0_GSWP3v1,ctsm5_1_GSWP3v1"> General configuration of model version and atmospheric forcing to tune the model to run under. This sets the model to run with constants and initial conditions that were set to run well under the configuration of model version and atmospheric forcing. To run well constants would need to be changed diff --git a/bld/namelist_files/use_cases/1850_control.xml b/bld/namelist_files/use_cases/1850_control.xml index 501d734129..5cd4a6f973 100644 --- a/bld/namelist_files/use_cases/1850_control.xml +++ b/bld/namelist_files/use_cases/1850_control.xml @@ -8,6 +8,7 @@ constant +.false. .false. .false. @@ -17,24 +18,37 @@ 1850 1850 +1850 +1850 + 1850 1850 1850 1850 +1850 +1850 + 1850 1850 1850 1850 +1850 +1850 + +lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc + lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc -cycle +cycle +cycle diff --git a/bld/namelist_files/use_cases/1850_noanthro_control.xml b/bld/namelist_files/use_cases/1850_noanthro_control.xml index cc0cc66ccf..861c192ed7 100644 --- a/bld/namelist_files/use_cases/1850_noanthro_control.xml +++ b/bld/namelist_files/use_cases/1850_noanthro_control.xml @@ -10,22 +10,17 @@ .false. -1850 -1850 - -1850 -1850 - 1850 1850 1850 1850 -cycle +1850 +1850 -1925 -1925 +cycle +cycle 1925 1925 @@ -33,11 +28,17 @@ 1925 1925 +1925 +1925 + lnd/clm2/firedata/clmforc.no_anthro_zero_hdm_1x1_simyr1925_181113.nc nn +1850 +1850 + 1850 1850 diff --git a/bld/namelist_files/use_cases/2000_control.xml b/bld/namelist_files/use_cases/2000_control.xml index f5d2cd59e9..abd116a82f 100644 --- a/bld/namelist_files/use_cases/2000_control.xml +++ b/bld/namelist_files/use_cases/2000_control.xml @@ -8,9 +8,11 @@ constant -.true. -.false. -.false. +.true. +.false. +.true. +.false. +.false. 2000 2000 @@ -18,19 +20,25 @@ 2000 2000 +2000 +2000 + 2000 2000 2000 2000 +2000 +2000 + 2000 2000 2000 2000 -2000 -2000 +2000 +2000 diff --git a/bld/namelist_files/use_cases/2010_control.xml b/bld/namelist_files/use_cases/2010_control.xml index 244009df02..8c7ea36ef7 100644 --- a/bld/namelist_files/use_cases/2010_control.xml +++ b/bld/namelist_files/use_cases/2010_control.xml @@ -8,32 +8,44 @@ constant -.true. -.false. -.false. +.true. +.true. +.false. +.true. +.false. +.false. -2010 -2010 +2010 +2010 -2010 -2010 +2010 +2010 -2010 -2010 +2010 +2010 -2010 -2010 +2010 +2010 -2010 -2010 +2010 +2010 -2010 -2010 +2010 +2010 -2010 -2010 +2010 +2010 -2010 -2010 +2010 +2010 + +2010 +2010 + +2010 +2010 + +2010 +2010 diff --git a/bld/namelist_files/use_cases/20thC_transient.xml b/bld/namelist_files/use_cases/20thC_transient.xml index 824f63cdc4..ecd46f471b 100644 --- a/bld/namelist_files/use_cases/20thC_transient.xml +++ b/bld/namelist_files/use_cases/20thC_transient.xml @@ -14,9 +14,11 @@ flanduse_timeseries -.true. -.false. -.false. +.true. +.false. +.true. +.false. +.false. 1850 2015 @@ -26,6 +28,10 @@ 2015 1850 +1850 +2015 +1850 + 1850 2016 1850 @@ -34,6 +40,10 @@ 2016 1850 +1850 +2016 +1850 + 1850 2106 1850 @@ -42,8 +52,8 @@ 2106 1850 -1850 -2106 -1850 +1850 +2106 +1850 diff --git a/bld/namelist_files/use_cases/stdurbpt_pd.xml b/bld/namelist_files/use_cases/stdurbpt_pd.xml index 9114742e66..5b90241196 100644 --- a/bld/namelist_files/use_cases/stdurbpt_pd.xml +++ b/bld/namelist_files/use_cases/stdurbpt_pd.xml @@ -18,8 +18,10 @@ 'OFF' -.true. -.false. -.false. +.true. +.false. +.true. +.false. +.false. diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index ed57cdcc92..56597d268f 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -78,7 +78,7 @@ sub make_config_cache { -Specifies clm physics +Specifies clm physics EOF $fh->close(); @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 893; +my $ntests = 1461; if ( defined($opts{'compare'}) ) { - $ntests += 549; + $ntests += 975; } plan( tests=>$ntests ); @@ -164,7 +164,7 @@ sub make_config_cache { &make_config_cache($phys); my $DOMFILE = "$inputdata_rootdir/atm/datm7/domain.lnd.T31_gx3v7.090928.nc"; -my $real_par_file = "user_nl_clm_real_parameters"; +my $real_par_file = "user_nl_ctsm_real_parameters"; my $bldnml = "../build-namelist -verbose -csmdata $inputdata_rootdir -lnd_frac $DOMFILE -configuration clm -structure standard -glc_nec 10 -no-note -output_reals $real_par_file"; if ( $opts{'test'} ) { $bldnml .= " -test"; @@ -1072,15 +1072,18 @@ sub make_config_cache { system( "cat $tempfile" ); } +# +# Loop over all physics versions +# +foreach my $phys ( "clm4_5", "clm5_0", "ctsm5_1" ) { +$mode = "-phys $phys"; +&make_config_cache($phys); print "\n==================================================\n"; -print "Test ALL resolutions with CLM5.0 and SP \n"; +print "Test ALL resolutions with SP\n"; print "==================================================\n"; # Check for ALL resolutions with CLM50SP -$phys = "clm5_0"; -$mode = "-phys $phys"; -&make_config_cache($phys); my $reslist = `../queryDefaultNamelist.pl -res list -s`; my @resolutions = split( / /, $reslist ); my @regional; @@ -1144,16 +1147,13 @@ sub make_config_cache { } print "\n==================================================\n"; -print " Test important resolutions for CLM4.5 and BGC\n"; +print " Test important resolutions for BGC\n"; print "==================================================\n"; -$phys = "clm4_5"; -$mode = "-phys $phys"; -&make_config_cache($phys); my @resolutions = ( "4x5", "10x15", "ne30np4", "ne16np4", "1.9x2.5", "0.9x1.25" ); my @regional; my $nlbgcmode = "bgc"; -my $mode = "clm45-$nlbgcmode"; +my $mode = "$phys-$nlbgcmode"; foreach my $res ( @resolutions ) { chomp($res); print "=== Test $res === \n"; @@ -1211,9 +1211,6 @@ sub make_config_cache { print "==================================================\n"; # Check for crop resolutions -$phys = "clm5_0"; -$mode = "-phys $phys"; -&make_config_cache($phys); my @crop_res = ( "1x1_numaIA", "1x1_smallvilleIA", "4x5", "10x15", "0.9x1.25", "1.9x2.5", "ne30np4" ); foreach my $res ( @crop_res ) { $options = "-bgc bgc -crop -res $res -envxml_dir ."; @@ -1247,9 +1244,6 @@ sub make_config_cache { # use cases, but I've kept these pointing to the equivalent normal use # cases; I'm not sure if it's actually important to test this with all # of the different use cases. -$phys = "clm4_5"; -$mode = "-phys $phys"; -&make_config_cache($phys); my @glc_res = ( "0.9x1.25", "1.9x2.5" ); my @use_cases = ( "1850-2100_SSP1-2.6_transient", "1850-2100_SSP2-4.5_transient", @@ -1289,9 +1283,6 @@ sub make_config_cache { } } # Transient 20th Century simulations -$phys = "clm5_0"; -$mode = "-phys $phys"; -&make_config_cache($phys); my @tran_res = ( "0.9x1.25", "1.9x2.5", "ne30np4", "10x15" ); my $usecase = "20thC_transient"; my $GLC_NEC = 10; @@ -1313,9 +1304,6 @@ sub make_config_cache { &cleanup(); } # Transient ssp_rcp scenarios that work -$phys = "clm5_0"; -$mode = "-phys $phys"; -&make_config_cache($phys); my @tran_res = ( "0.9x1.25", "1.9x2.5", "10x15" ); foreach my $usecase ( "1850_control", "1850-2100_SSP5-8.5_transient", "1850-2100_SSP1-2.6_transient", "1850-2100_SSP3-7.0_transient", "1850-2100_SSP2-4.5_transient" ) { @@ -1343,7 +1331,15 @@ sub make_config_cache { &cleanup(); } } +} # End loop over all physics versions +# +# End loop over versions +# + # The SSP's that fail... +$phys = "clm5_0"; +$mode = "-phys $phys"; +&make_config_cache($phys); my $res = "0.9x1.25"; foreach my $usecase ( "1850-2100_SSP4-3.4_transient", "1850-2100_SSP5-3.4_transient", "1850-2100_SSP1-1.9_transient", "1850-2100_SSP4-6.0_transient" ) { @@ -1355,10 +1351,10 @@ sub make_config_cache { } print "\n==================================================\n"; -print "Test clm4.5/clm5.0 resolutions \n"; +print "Test clm4.5/clm5.0/ctsm5_1 resolutions \n"; print "==================================================\n"; -foreach my $phys ( "clm4_5", 'clm5_0' ) { +foreach my $phys ( "clm4_5", 'clm5_0', 'ctsm5_1' ) { my $mode = "-phys $phys"; &make_config_cache($phys); my @clmoptions = ( "-bgc bgc -envxml_dir .", "-bgc bgc -envxml_dir . -clm_accelerated_spinup=on", "-bgc bgc -envxml_dir . -light_res 360x720", @@ -1450,10 +1446,16 @@ sub make_config_cache { my $res = "0.9x1.25"; my $mask = "gx1v6"; my $simyr = "1850"; -foreach my $phys ( "clm4_5", 'clm5_0' ) { +foreach my $phys ( "clm4_5", 'clm5_0', 'ctsm5_1' ) { my $mode = "-phys $phys"; &make_config_cache($phys); - foreach my $forc ( "CRUv7", "GSWP3v1", "cam6.0" ) { + my @forclist = (); + if ( $phys == "ctsm5_1" ) { + @forclist = ( "GSWP3v1" ); + } else { + @forclist = ( "CRUv7", "GSWP3v1", "cam6.0" ); + } + foreach my $forc ( @forclist ) { foreach my $bgc ( "sp", "bgc" ) { my $lndtuningmode = "${phys}_${forc}"; my $clmoptions = "-res $res -mask $mask -sim_year $simyr -envxml_dir . -lnd_tuning_mod $lndtuningmode -bgc $bgc"; diff --git a/cime_config/SystemTests/lciso.py b/cime_config/SystemTests/lciso.py index e79af2886b..6faa43a368 100644 --- a/cime_config/SystemTests/lciso.py +++ b/cime_config/SystemTests/lciso.py @@ -26,11 +26,11 @@ def __init__(self, case): def _case_one_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "use_c13=F, use_c14=F") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "use_c13=.true.,use_c14=.true.,use_c13_timeseries=.true.,use_c14_bombspike=.true." ) diff --git a/cime_config/SystemTests/lii.py b/cime_config/SystemTests/lii.py index 0bf371ee9a..48ce346a27 100644 --- a/cime_config/SystemTests/lii.py +++ b/cime_config/SystemTests/lii.py @@ -23,9 +23,9 @@ (2) Copy the finidat_interp_dest.nc file from the 'base' case to the inputdata space. Rename this to be similar to the name of the file pointed to in this -test's user_nl_clm file, but with a new creation date. +test's user_nl_ctsm file, but with a new creation date. -(3) Update this test's user_nl_clm file (in the appropriate testmods directory) +(3) Update this test's user_nl_ctsm file (in the appropriate testmods directory) to point to the new finidat file. """ @@ -46,11 +46,11 @@ def __init__(self, case): def _case_one_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "use_init_interp = .true.") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "use_init_interp = .false.") diff --git a/cime_config/SystemTests/lii2finidatareas.py b/cime_config/SystemTests/lii2finidatareas.py index 21ba082fff..b167b07a18 100644 --- a/cime_config/SystemTests/lii2finidatareas.py +++ b/cime_config/SystemTests/lii2finidatareas.py @@ -41,7 +41,7 @@ (3) Update namelist defaults to point to the new finidat file. If updating the out-of-the-box file is not desired, then you could instead -point to this new finidat file with a user_nl_clm file in this testmod. +point to this new finidat file with a user_nl_ctsm file in this testmod. """ from CIME.XML.standard_module_setup import * @@ -72,5 +72,5 @@ def __init__(self, case): def _case_one_setup(self): super(LII2FINIDATAREAS, self)._case_one_setup() append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "init_interp_method = 'use_finidat_areas'") diff --git a/cime_config/SystemTests/lvg.py b/cime_config/SystemTests/lvg.py index 36fae196b2..07cd89a2fe 100644 --- a/cime_config/SystemTests/lvg.py +++ b/cime_config/SystemTests/lvg.py @@ -27,11 +27,11 @@ def __init__(self, case): def _case_one_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "glacier_region_behavior = 'single_at_atm_topo', 'virtual', 'virtual', 'multiple'") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "glacier_region_behavior = 'single_at_atm_topo', 'virtual', 'virtual', 'virtual'") diff --git a/cime_config/SystemTests/lwiso.py b/cime_config/SystemTests/lwiso.py index 1083e2ff36..deb8745794 100644 --- a/cime_config/SystemTests/lwiso.py +++ b/cime_config/SystemTests/lwiso.py @@ -34,11 +34,11 @@ def _case_one_setup(self): # eventually, though, we should change this to the latter. (See # .) append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "enable_water_tracer_consistency_checks=.true.") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "enable_water_tracer_consistency_checks=.false.") diff --git a/cime_config/SystemTests/soilstructud.py b/cime_config/SystemTests/soilstructud.py index c59ab8b4f6..1ab331ffdf 100644 --- a/cime_config/SystemTests/soilstructud.py +++ b/cime_config/SystemTests/soilstructud.py @@ -2,10 +2,10 @@ Implementation of the CIME SOILSTRUCTUD test. This is a CLM specific test: -Verifies that a simulation that points to user_nl_clm containing +Verifies that a simulation that points to user_nl_ctsm containing soil_layerstruct_userdefined_nlevsoi = 4 soil_layerstruct_userdefined = 0.1d0,0.3d0,0.6d0,1.0d0,1.0d0 -gives bfb same results as one that points to user_nl_clm containing +gives bfb same results as one that points to user_nl_ctsm containing soil_layerstruct_predefined = '4SL_2m' """ @@ -27,11 +27,11 @@ def __init__(self, case): def _case_one_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "soil_layerstruct_userdefined_nlevsoi = 4,soil_layerstruct_userdefined = 0.1d0,0.3d0,0.6d0,1.0d0,1.0d0") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", + component = "ctsm", contents = "soil_layerstruct_predefined = '4SL_2m'") diff --git a/cime_config/buildlib b/cime_config/buildlib index 9e87bad732..9f6006160a 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -1,7 +1,7 @@ #!/usr/bin/env python """ -build clm library +build ctsm library """ import sys, os @@ -64,6 +64,8 @@ def _write_ctsm_mk(gmake, gmake_opts, makefile, exeroot, libroot): # ====================================================================== # The following settings are meant for internal use, and generally # should not be included directly in an atmosphere model's build. +# NOTE: clm library name and subdirectory will eventually need to +# be updated to ctsm. # ====================================================================== CTSM_BLD_DIR = {ctsm_bld_dir} @@ -103,8 +105,10 @@ def _main_func(): filepath_file = os.path.join(bldroot,"Filepath") if not os.path.isfile(filepath_file): caseroot = case.get_value("CASEROOT") + compname = case.get_value("COMP_LND") + expect( ((compname == "clm") or (compname == "ctsm")), "Unexpected COMP_LND name: %s" % (compname)) - paths = [os.path.join(caseroot,"SourceMods","src.clm"), + paths = [os.path.join(caseroot,"SourceMods","src."+compname), os.path.join(lnd_root,"src","main"), os.path.join(lnd_root,"src","biogeophys"), os.path.join(lnd_root,"src","biogeochem"), @@ -135,10 +139,10 @@ def _main_func(): # create the library in libroot #------------------------------------------------------- - complib = os.path.join(libroot,"libclm.a") + complib = os.path.join(libroot,"lib%s.a"%(compname)) - cmd = "{} complib -j {} MODEL=clm COMPLIB={} -f {} {}" \ - .format(gmake, gmake_j, complib, makefile, gmake_opts) + cmd = "{} complib -j {} MODEL={} COMPLIB={} -f {} {}" \ + .format(gmake, gmake_j, compname, complib, makefile, gmake_opts) rc, out, err = run_cmd(cmd) logger.info("%s: \n\n output:\n %s \n\n err:\n\n%s\n"%(cmd,out,err)) diff --git a/cime_config/buildnml b/cime_config/buildnml index a33fadb864..3f5835013d 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -1,7 +1,7 @@ #!/usr/bin/env python """ -CLM namelist creator +CTSM namelist creator """ import sys, os, shutil @@ -23,17 +23,17 @@ _config_cache_template = """ -Specifies clm physics +Specifies CTSM physics """ ############################################################################### def buildnml(case, caseroot, compname): ############################################################################### - """Build the clm namelist """ + """Build the CTSM namelist """ # Build the component namelist - if compname != "clm": + if compname != "ctsm" and compname != "clm": raise AttributeError lnd_root = case.get_value("COMP_ROOT_DIR_LND") @@ -63,12 +63,12 @@ def buildnml(case, caseroot, compname): mask = case.get_value("MASK_GRID") # ----------------------------------------------------- - # Set clmconf + # Set ctsmconf # ----------------------------------------------------- - clmconf = os.path.join(caseroot, "Buildconf", "clmconf") - if not os.path.isdir(clmconf): - os.makedirs(clmconf) + ctsmconf = os.path.join(caseroot, "Buildconf", "ctsmconf") + if not os.path.isdir(ctsmconf): + os.makedirs(ctsmconf) # ----------------------------------------------------- # Create config_cache.xml file @@ -80,7 +80,7 @@ def buildnml(case, caseroot, compname): clm_phys = case.get_value("CLM_PHYSICS_VERSION") config_cache_text = _config_cache_template.format(clm_phys=clm_phys) - config_cache_path = os.path.join(caseroot, "Buildconf", "clmconf", "config_cache.xml") + config_cache_path = os.path.join(caseroot, "Buildconf", "ctsmconf", "config_cache.xml") with open(config_cache_path, 'w') as config_cache_file: config_cache_file.write(config_cache_text) @@ -148,13 +148,13 @@ def buildnml(case, caseroot, compname): spinup = "-clm_accelerated_spinup %s "%clm_accelerated_spinup - infile = os.path.join(clmconf, "namelist") + infile = os.path.join(ctsmconf, "namelist") - inputdata_file = os.path.join(caseroot,"Buildconf","clm.input_data_list") + inputdata_file = os.path.join(caseroot,"Buildconf","ctsm.input_data_list") lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) - config_cache_file = os.path.join(caseroot,"Buildconf","clmconf","config_cache.xml") + config_cache_file = os.path.join(caseroot,"Buildconf","ctsmconf","config_cache.xml") # ----------------------------------------------------- # Clear out old data @@ -201,7 +201,7 @@ def buildnml(case, caseroot, compname): infile_lines.append(clm_icfile) user_nl_file = os.path.join(caseroot, "user_nl_clm" + inst_string) - namelist_infile = os.path.join(clmconf, "namelist") + namelist_infile = os.path.join(ctsmconf, "namelist") create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines)) @@ -218,7 +218,7 @@ def buildnml(case, caseroot, compname): lndfrac_file, glc_nec, ccsm_co2_ppmv, clm_co2_type, config_cache_file, clm_bldnml_opts, spinup, tuning, gridmask)) - rc, out, err = run_cmd(command, from_dir=clmconf) + rc, out, err = run_cmd(command, from_dir=ctsmconf) expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) if out is not None: logger.debug(" %s"%out) @@ -230,11 +230,11 @@ def buildnml(case, caseroot, compname): # ----------------------------------------------------- if os.path.isdir(rundir): - file1 = os.path.join(clmconf, "lnd_in") + file1 = os.path.join(ctsmconf, "lnd_in") file2 = os.path.join(rundir, "lnd_in") if ninst > 1: file2 += inst_string - logger.debug("CLM namelist copy: file1 %s file2 %s " %(file1, file2)) + logger.debug("CTSM namelist copy: file1 %s file2 %s " %(file1, file2)) shutil.copy(file1,file2) ############################################################################### @@ -242,7 +242,8 @@ def _main_func(): caseroot = parse_input(sys.argv) with Case(caseroot) as case: - buildnml(case, caseroot, "clm") + compname = case.get_value("COMP_LND") + buildnml(case, caseroot, compname) if __name__ == "__main__": _main_func() diff --git a/cime_config/config_archive.xml b/cime_config/config_archive.xml index bc9f1d6c0a..c219a1d1ef 100644 --- a/cime_config/config_archive.xml +++ b/cime_config/config_archive.xml @@ -25,4 +25,25 @@ anothercasename.clm2.i.1976-01-01-00000.nc + + r + rh\d? + h\d*.*\.nc$ + e + locfnh + + rpointer.lnd$NINST_STRING + ./$CASE.ctsm$NINST_STRING.r.$DATENAME.nc + + + rpointer.lnd + rpointer.lnd_9999 + casename.ctsm.r.1976-01-01-00000.nc + casename.ctsm.rh4.1976-01-01-00000.nc + casename.ctsm.h0.1976-01-01-00000.nc + casename.ctsm.h0.1976-01-01-00000.nc.base + casename.ctsm_0002.e.postassim.1976-01-01-00000.nc + casename.ctsm_0002.e.preassim.1976-01-01-00000.nc + + diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 545c17d9c4..f98199bcdc 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -16,6 +16,7 @@ clm4.5: clm5.0: + ctsm5.1: Satellite phenology: CN: Carbon Nitrogen model CNDV: CN with Dynamic Vegetation (deprecated) @@ -36,11 +37,14 @@ NWP configuration with satellite phenology: NWP configuration with BGC and CROP: - char - clm - clm + clm,ctsm + UNSET + + clm + ctsm + case_comp env_case.xml Name of land component @@ -50,19 +54,19 @@ char on,off off - build_component_clm + build_component_ctsm env_build.xml Flag to enable building the LILAC cap and coupling code char - run_component_clm + run_component_ctsm env_run.xml Tuning parameters and initial conditions should be optimized for what CLM model version and what meteorlogical forcing combination? UNSET - clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0 + clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,ctsm5_1_GSWP3v1 clm4_5_CRUv7 clm4_5_CRUv7 @@ -72,22 +76,24 @@ clm5_0_CRUv7 clm5_0_GSWP3v1 clm5_0_cam6.0 + ctsm5_1_GSWP3v1 char - clm4_5,clm5_0 + clm4_5,clm5_0,ctsm5_1 UNSET - clm4_5 - clm5_0 + clm4_5 + clm5_0 + ctsm5_1 - run_component_clm + run_component_ctsm env_run.xml Overall physics version to use. This sets the default values for many different namelist options. @@ -101,7 +107,7 @@ nwp - run_component_clm + run_component_ctsm env_run.xml Sets CLM default namelist options related to model configuration. clm: Configuration used for climate applications (CLM) @@ -116,7 +122,7 @@ fast - run_component_clm + run_component_ctsm env_run.xml Sets CLM default namelist options related to model structure. standard: Standard model structure, allowing for more subgrid heterogeneity, @@ -148,7 +154,7 @@ 20thC_transient 1850-2100_SSP5-8.5_transient - run_component_clm + run_component_ctsm env_run.xml CLM namelist use_case. Determines the use-case that will be sent to the CLM build-namelist utility. @@ -185,8 +191,13 @@ -bgc bgc -dynamic_vegetation -crop -bgc sp -vichydro -bgc fates -no-megan + + -bgc sp + -bgc bgc + -bgc bgc -crop + -bgc fates -no-megan - run_component_clm + run_component_ctsm env_run.xml CLM build-namelist options @@ -202,7 +213,7 @@ diagnostic diagnostic - run_component_clm + run_component_ctsm env_run.xml Determines how CLM will determine where CO2 is set. If value is constant, it will be set to CCSM_CO2_PPMV, @@ -217,7 +228,7 @@ char - run_component_clm + run_component_ctsm env_run.xml CLM-specific namelist settings for -namelist option in the CLM build-namelist. CLM_NAMELIST_OPTS is normally set as a compset variable @@ -232,7 +243,7 @@ char on,off off - run_component_clm + run_component_ctsm env_run.xml Turn on any settings for accellerating the model spinup. @@ -241,7 +252,7 @@ char UNSET - run_component_clm + run_component_ctsm env_run.xml Dataset name for user-created datasets. This is used as the argument in Buildconf/clm.buildnml to build-namelist -clm_usr_name. An example of @@ -253,13 +264,13 @@ char on,off off - run_component_clm + run_component_ctsm env_run.xml Flag to the CLM build-namelist command to force CLM to do a cold start (finidat will be set to blanks). A value of on forces the model to spin up from a cold-start (arbitrary initial conditions). Setting this value in the xml file will take - precedence over any settings for finidat in the $CASEROOT/user_clm_clm file. + precedence over any settings for finidat in the $CASEROOT/user_nl_ctsm file. @@ -272,7 +283,7 @@ $COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_deck $COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_nociso_deck - run_component_clm + run_component_ctsm env_case.xml User mods to apply to specific compset matches. diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index dbcdf4a049..52a8850ab9 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -14,7 +14,7 @@ Where for the CAM specific compsets below the following is supported TIME = Time period (e.g. 2000, HIST, SSP585...) ATM = [CAM40, CAM50, CAM55] - LND = [CLM45, CLM50, SLND] + LND = [CLM45, CLM50, CTSM51, SLND] ICE = [CICE, DICE, SICE] OCN = [DOCN, ,AQUAP, SOCN] ROF = [RTM, SROF] @@ -225,6 +225,11 @@ + + IHistCtsm51BgcCrop + HIST_DATM%GSWP3v1_CTSM51%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + IHistClm50Sp HIST_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV diff --git a/src/biogeochem/CNDVDriverMod.F90 b/src/biogeochem/CNDVDriverMod.F90 index 1d01f435f5..b007495849 100644 --- a/src/biogeochem/CNDVDriverMod.F90 +++ b/src/biogeochem/CNDVDriverMod.F90 @@ -419,7 +419,7 @@ character(len=256) function set_dgvm_filename () ! Determine initial dataset filenames ! ! !USES: - use clm_varctl , only : caseid, inst_suffix + use clm_varctl , only : caseid, inst_suffix, compname use clm_time_manager , only : get_curr_date ! ! !ARGUMENTS: @@ -435,7 +435,7 @@ character(len=256) function set_dgvm_filename () call get_curr_date (yr, mon, day, sec) write(cdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr,mon,day,sec - set_dgvm_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& + set_dgvm_filename = "./"//trim(caseid)//"."//trim(compname)//trim(inst_suffix)//& ".hv."//trim(cdate)//".nc" end function set_dgvm_filename diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index d224348cdf..f2423f6524 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -94,6 +94,7 @@ subroutine create_cnfire_method( NLFilename, cnfire_method ) use CNFireNoFireMod , only : cnfire_nofire_type use CNFireLi2014Mod , only : cnfire_li2014_type use CNFireLi2016Mod , only : cnfire_li2016_type + use CNFireLi2021Mod , only : cnfire_li2021_type use decompMod , only : bounds_type ! ! !ARGUMENTS: @@ -112,6 +113,8 @@ subroutine create_cnfire_method( NLFilename, cnfire_method ) allocate(cnfire_li2014_type :: cnfire_method) case ("li2016crufrc") allocate(cnfire_li2016_type :: cnfire_method) + case ("li2021gswpfrc") + allocate(cnfire_li2021_type :: cnfire_method) case default write(iulog,*) subname//' ERROR: unknown method: ', fire_method diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 new file mode 100644 index 0000000000..b0424f1074 --- /dev/null +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -0,0 +1,661 @@ +module CNFireLi2021Mod + +#include "shr_assert.h" + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! module for fire dynamics + ! created in Nov, 2012 and revised in Apr, 2013 by F. Li and S. Levis + ! based on Li et al. (2012a,b; 2013) + ! revised in Apr, 2014 according to Li et al.(2014) + ! revised in May, 2015, according to Li et al. (2015, in prep.) + ! Fire-related parameters were calibrated or tuned in May, 2015 based on the + ! 20th Century transient simulations at f19_g16 with a CLM4.5 version + ! (clm50fire), CRUNCEPv5, and climatological lightning data. + ! + ! !USES: + use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL + use shr_const_mod , only : SHR_CONST_PI,SHR_CONST_TKFRZ + use shr_infnan_mod , only : shr_infnan_isnan + use shr_log_mod , only : errMsg => shr_log_errMsg + use clm_varctl , only : iulog + use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full + use clm_varcon , only : dzsoi_decomp + use pftconMod , only : noveg, pftcon + use abortutils , only : endrun + use decompMod , only : bounds_type + use subgridAveMod , only : p2c + use atm2lndType , only : atm2lnd_type + use CNDVType , only : dgvs_type + use CNVegStateType , only : cnveg_state_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type + use CNVegCarbonFluxType , only : cnveg_carbonflux_type + use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type + use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type + use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con + use EnergyFluxType , only : energyflux_type + use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use GridcellType , only : grc + use ColumnType , only : col + use PatchType , only : patch + use SoilBiogeochemStateType , only : get_spinup_latitude_term + use FireMethodType , only : fire_method_type + use CNFireBaseMod , only : cnfire_base_type, cnfire_const, cnfire_params + use CNFireBaseMod , only : cnfire_base_type, cnfire_const + ! + implicit none + private + ! + ! !PUBLIC TYPES: + public :: cnfire_li2021_type + ! + type, extends(cnfire_base_type) :: cnfire_li2021_type + private + contains + ! + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: need_lightning_and_popdens + procedure, public :: CNFireArea ! Calculate fire area + end type cnfire_li2021_type + + ! + ! !PRIVATE MEMBER DATA: + !----------------------------------------------------------------------- + character(len=*), parameter, private :: sourcefile = & + __FILE__ + +contains + + + !----------------------------------------------------------------------- + function need_lightning_and_popdens(this) + ! !ARGUMENTS: + class(cnfire_li2021_type), intent(in) :: this + logical :: need_lightning_and_popdens ! function result + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'need_lightning_and_popdens' + !----------------------------------------------------------------------- + + need_lightning_and_popdens = .true. + end function need_lightning_and_popdens + + !----------------------------------------------------------------------- + subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & + wateratm2lndbulk_inst, cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + ! + ! !DESCRIPTION: + ! Computes column-level burned area + ! + ! !USES: + use clm_time_manager , only: get_step_size, get_days_per_year, get_curr_date, get_nstep + use clm_varpar , only: max_patch_per_col + use clm_varcon , only: secspday, secsphr + use clm_varctl , only: spinup_state + use pftconMod , only: nc4_grass, nc3crop, ndllf_evr_tmp_tree + use pftconMod , only: nbrdlf_evr_trp_tree, nbrdlf_dcd_trp_tree, nbrdlf_evr_shrub + use dynSubgridControlMod , only : run_has_transient_landcover + ! + ! !ARGUMENTS: + class(cnfire_li2021_type) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(atm2lnd_type) , intent(in) :: atm2lnd_inst + type(energyflux_type) , intent(in) :: energyflux_inst + type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + real(r8) , intent(in) :: totlitc_col(bounds%begc:) + real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) + real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) + ! + ! !LOCAL VARIABLES: + ! + integer :: g,l,c,p,pi,j,fc,fp,kyr, kmo, kda, mcsec ! index variables + real(r8) :: dt ! time step variable (s) + real(r8) :: dayspyr ! days per year + real(r8) :: cli ! effect of climate on deforestation fires (0-1) + real(r8) :: cri ! thresholds used for cli, (mm/d), see Eq.(7) in Li et al.(2013) + real(r8) :: fb ! availability of fuel for regs A and C + real(r8) :: fhd ! impact of hd on agricultural fire + real(r8) :: fgdp ! impact of gdp on agricultural fire + real(r8) :: fire_m ! combustability of fuel for fire occurrence + real(r8) :: spread_m ! combustability of fuel for fire spread + real(r8) :: Lb_lf ! length-to-breadth ratio added by Lifang + integer :: i_cwd ! cwd pool + real(r8) :: lh ! anthro. ignitions (count/km2/hr) + real(r8) :: fs ! hd-dependent fires suppression (0-1) + real(r8) :: ig ! total ignitions (count/km2/hr) + real(r8) :: hdmlf ! human density + real(r8) :: arh, arh30 !combustability of fuel related to RH and RH30 + real(r8) :: afuel !weight for arh and arh30 + real(r8) :: btran_col(bounds%begc:bounds%endc) + logical :: transient_landcover ! whether this run has any prescribed transient landcover + real(r8), target :: prec60_col_target(bounds%begc:bounds%endc) + real(r8), target :: prec10_col_target(bounds%begc:bounds%endc) + real(r8), target :: rh30_col_target(bounds%begc:bounds%endc) + real(r8), pointer :: prec60_col(:) + real(r8), pointer :: prec10_col(:) + real(r8), pointer :: rh30_col(:) + !----------------------------------------------------------------------- + + SHR_ASSERT_ALL((ubound(totlitc_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(t_soi17cm_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) + + associate( & + totlitc => totlitc_col , & ! Input: [real(r8) (:) ] (gC/m2) total lit C (column-level mean) + decomp_cpools_vr => decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) + tsoi17 => t_soi17cm_col , & ! Input: [real(r8) (:) ] (K) soil T for top 0.17 m + + lfuel => cnfire_const%lfuel , & ! Input: [real(r8) ] (gC/m2) Lower threshold of fuel mass + ufuel => cnfire_const%ufuel , & ! Input: [real(r8) ] (gC/m2) Upper threshold of fuel mass + rh_hgh => cnfire_const%rh_hgh , & ! Input: [real(r8) ] (%) High relative humidity + rh_low => cnfire_const%rh_low , & ! Input: [real(r8) ] (%) Low relative humidity + cli_scale => cnfire_const%cli_scale , & ! Input: [real(r8) ] (/d) global constant for deforestation fires + cropfire_a1 => cnfire_const%cropfire_a1 , & ! Input: [real(r8) ] (/hr) a1 parameter for cropland fire + non_boreal_peatfire_c => cnfire_const%non_boreal_peatfire_c , & ! Input: [real(r8) ] (/hr) c parameter for non-boreal peatland fire + pot_hmn_ign_counts_alpha => cnfire_const%pot_hmn_ign_counts_alpha , & ! Input: [real(r8) ] (/person/month) Potential human ignition counts + boreal_peatfire_c => cnfire_const%boreal_peatfire_c , & ! Input: [real(r8) ] (/hr) c parameter for boreal peatland fire + + fsr_pft => pftcon%fsr_pft , & ! Input: + fd_pft => pftcon%fd_pft , & ! Input: + rswf_min => pftcon%rswf_min , & ! Input: + rswf_max => pftcon%rswf_max , & ! Input: + btran2 => energyflux_inst%btran2_patch , & ! Input: [real(r8) (:) ] root zone soil wetness + fsat => saturated_excess_runoff_inst%fsat_col , & ! Input: [real(r8) (:) ] fractional area with water table at surface + wf2 => waterdiagnosticbulk_inst%wf2_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m + + is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool + spinup_factor => decomp_cascade_con%spinup_factor , & ! Input: [real(r8) (:) ] factor for AD spinup associated with each pool + + forc_rh => wateratm2lndbulk_inst%forc_rh_grc , & ! Input: [real(r8) (:) ] relative humidity + forc_wind => atm2lnd_inst%forc_wind_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed (m/s) + forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric temperature (Kelvin) + forc_rain => wateratm2lndbulk_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] downscaled rain + forc_snow => wateratm2lndbulk_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] downscaled snow + prec60 => wateratm2lndbulk_inst%prec60_patch , & ! Input: [real(r8) (:) ] 60-day running mean of tot. precipitation + prec10 => wateratm2lndbulk_inst%prec10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of tot. precipitation + rh30 => wateratm2lndbulk_inst%rh30_patch , & ! Input: [real(r8) (:) ] 10-day running mean of tot. precipitation + dwt_smoothed => cnveg_state_inst%dwt_smoothed_patch , & ! Input: [real(r8) (:) ] change in patch weight (-1 to 1) on the gridcell, smoothed over the year + cropf_col => cnveg_state_inst%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column + gdp_lf => cnveg_state_inst%gdp_lf_col , & ! Input: [real(r8) (:) ] gdp data + peatf_lf => cnveg_state_inst%peatf_lf_col , & ! Input: [real(r8) (:) ] peatland fraction data + abm_lf => cnveg_state_inst%abm_lf_col , & ! Input: [integer (:) ] prescribed crop fire time + baf_crop => cnveg_state_inst%baf_crop_col , & ! Output: [real(r8) (:) ] burned area fraction for cropland (/sec) + baf_peatf => cnveg_state_inst%baf_peatf_col , & ! Output: [real(r8) (:) ] burned area fraction for peatland (/sec) + burndate => cnveg_state_inst%burndate_patch , & ! Output: [integer (:) ] burn date for crop + fbac => cnveg_state_inst%fbac_col , & ! Output: [real(r8) (:) ] total burned area out of conversion (/sec) + fbac1 => cnveg_state_inst%fbac1_col , & ! Output: [real(r8) (:) ] burned area out of conversion region due to land use fire + farea_burned => cnveg_state_inst%farea_burned_col , & ! Output: [real(r8) (:) ] total fractional area burned (/sec) + nfire => cnveg_state_inst%nfire_col , & ! Output: [real(r8) (:) ] fire counts (count/km2/sec), valid only in Reg. C + fsr_col => cnveg_state_inst%fsr_col , & ! Output: [real(r8) (:) ] fire spread rate at column level + fd_col => cnveg_state_inst%fd_col , & ! Output: [real(r8) (:) ] fire duration rate at column level + lgdp_col => cnveg_state_inst%lgdp_col , & ! Output: [real(r8) (:) ] gdp limitation factor for nfire + lgdp1_col => cnveg_state_inst%lgdp1_col , & ! Output: [real(r8) (:) ] gdp limitation factor for baf per fire + lpop_col => cnveg_state_inst%lpop_col , & ! Output: [real(r8) (:) ] pop limitation factor for baf per fire + lfwt => cnveg_state_inst%lfwt_col , & ! Output: [real(r8) (:) ] fractional coverage of non-crop and non-bare-soil Patches + trotr1_col => cnveg_state_inst%trotr1_col , & ! Output: [real(r8) (:) ] patch weight of BET on the column (0-1) + trotr2_col => cnveg_state_inst%trotr2_col , & ! Output: [real(r8) (:) ] patch weight of BDT on the column (0-1) + dtrotr_col => cnveg_state_inst%dtrotr_col , & ! Output: [real(r8) (:) ] decreased frac. coverage of BET+BDT on grid for dt + lfc => cnveg_state_inst%lfc_col , & ! Output: [real(r8) (:) ] conversion area frac. of BET+BDT that haven't burned before + wtlf => cnveg_state_inst%wtlf_col , & ! Output: [real(r8) (:) ] fractional coverage of non-crop Patches + + totvegc => cnveg_carbonstate_inst%totvegc_col , & ! Input: [real(r8) (:) ] totvegc at column level + deadcrootc => cnveg_carbonstate_inst%deadcrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C + deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage + deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer + deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem root C + frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C + frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage + frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer + livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C + livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage + livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer + leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C + leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage + leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer + rootc_col => cnveg_carbonstate_inst%rootc_col , & ! Output: [real(r8) (:) ] root carbon + leafc_col => cnveg_carbonstate_inst%leafc_col , & ! Output: [real(r8) (:) ] leaf carbon at column level + deadstemc_col => cnveg_carbonstate_inst%deadstemc_col , & ! Output: [real(r8) (:) ] deadstem carbon at column level + fuelc => cnveg_carbonstate_inst%fuelc_col , & ! Output: [real(r8) (:) ] fuel load coutside cropland + fuelc_crop => cnveg_carbonstate_inst%fuelc_crop_col & ! Output: [real(r8) (:) ] fuel load for cropland + ) + + transient_landcover = run_has_transient_landcover() + + !pft to column average + prec10_col =>prec10_col_target + call p2c(bounds, num_soilc, filter_soilc, & + prec10(bounds%begp:bounds%endp), & + prec10_col(bounds%begc:bounds%endc)) + + prec60_col =>prec60_col_target + call p2c(bounds, num_soilc, filter_soilc, & + prec60(bounds%begp:bounds%endp), & + prec60_col(bounds%begc:bounds%endc)) + + rh30_col =>rh30_col_target + call p2c(bounds, num_soilc, filter_soilc, & + rh30(bounds%begp:bounds%endp), & + rh30_col(bounds%begc:bounds%endc)) + + call p2c(bounds, num_soilc, filter_soilc, & + leafc(bounds%begp:bounds%endp), & + leafc_col(bounds%begc:bounds%endc)) + + call p2c(bounds, num_soilc, filter_soilc, & + deadstemc(bounds%begp:bounds%endp), & + deadstemc_col(bounds%begc:bounds%endc)) + + call get_curr_date (kyr, kmo, kda, mcsec) + dayspyr = get_days_per_year() + ! Get model step size + dt = real( get_step_size(), r8 ) + ! + ! On first time-step, just set area burned to zero and exit + ! + if ( get_nstep() == 0 )then + do fc = 1,num_soilc + c = filter_soilc(fc) + farea_burned(c) = 0._r8 + baf_crop(c) = 0._r8 + baf_peatf(c) = 0._r8 + fbac(c) = 0._r8 + fbac1(c) = 0._r8 + cropf_col(c) = 0._r8 + end do + return + end if + ! + ! Calculate fraction of crop (cropf_col) and non-crop and non-bare-soil + ! vegetation (lfwt) in vegetated column + ! + do fc = 1,num_soilc + c = filter_soilc(fc) + cropf_col(c) = 0._r8 + lfwt(c) = 0._r8 + end do + do pi = 1,max_patch_per_col + do fc = 1,num_soilc + c = filter_soilc(fc) + if (pi <= col%npatches(c)) then + p = col%patchi(c) + pi - 1 + ! For crop veg types + if( patch%itype(p) > nc4_grass )then + cropf_col(c) = cropf_col(c) + patch%wtcol(p) + end if + ! For natural vegetation (non-crop and non-bare-soil) + if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then + lfwt(c) = lfwt(c) + patch%wtcol(p) + end if + end if + end do + end do + ! + ! Calculate crop fuel + ! + do fc = 1,num_soilc + c = filter_soilc(fc) + fuelc_crop(c)=0._r8 + end do + do pi = 1,max_patch_per_col + do fc = 1,num_soilc + c = filter_soilc(fc) + if (pi <= col%npatches(c)) then + p = col%patchi(c) + pi - 1 + ! For crop PFTs, fuel load includes leaf and litter; only + ! column-level litter carbon + ! is available, so we use leaf carbon to estimate the + ! litter carbon for crop PFTs + if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then + fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & + leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & + totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) + end if + end if + end do + end do + ! + ! Calculate noncrop column variables + ! + do fc = 1,num_soilc + c = filter_soilc(fc) + fsr_col(c) = 0._r8 + fd_col(c) = 0._r8 + rootc_col(c) = 0._r8 + lgdp_col(c) = 0._r8 + lgdp1_col(c) = 0._r8 + lpop_col(c) = 0._r8 + btran_col(c) = 0._r8 + wtlf(c) = 0._r8 + trotr1_col(c)= 0._r8 + trotr2_col(c)= 0._r8 + if (transient_landcover) then + dtrotr_col(c)=0._r8 + end if + end do + do pi = 1,max_patch_per_col + do fc = 1,num_soilc + c = filter_soilc(fc) + g = col%gridcell(c) + if (pi <= col%npatches(c)) then + p = col%patchi(c) + pi - 1 + + ! For non-crop -- natural vegetation and bare-soil + if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1._r8 )then + if( .not. shr_infnan_isnan(btran2(p))) then + if (btran2(p) <= 1._r8 ) then + btran_col(c) = btran_col(c)+max(0._r8, min(1._r8, & + (btran2(p)-rswf_min(patch%itype(p)))/(rswf_max(patch%itype(p)) & + -rswf_min(patch%itype(p)))))*patch%wtcol(p) + wtlf(c) = wtlf(c)+patch%wtcol(p) + end if + end if + + ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen + ! and deciduous tropical trees (used to determine if a column is + ! tropical closed forest) use the current fractions. However, I think + ! they are used in code that applies to land cover change. Note that + ! land cover change is currently generated on the first time step of the + ! year (even though the fire code sees the annually-smoothed dwt). Thus, + ! I think that, for this to be totally consistent, this code should + ! consider the fractional coverage of each PFT prior to the relevant + ! land cover change event. (These fractions could be computed in the + ! code that handles land cover change, so that the fire code remains + ! agnostic to exactly how and when land cover change happens.) + ! + ! For example, if a year started with fractional coverages of + ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then + ! the start-of-year land cover change reduced both of these to 0.2: The + ! current code would consider the column to NOT be tropical closed + ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), + ! whereas in fact the land cover change occurred when the column *was* + ! tropical closed forest. + if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then + trotr1_col(c)=trotr1_col(c)+patch%wtcol(p)*col%wtgcell(c) + end if + if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then + trotr2_col(c)=trotr2_col(c)+patch%wtcol(p)*col%wtgcell(c) + end if + + if (transient_landcover) then + if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then + if(dwt_smoothed(p) < 0._r8)then + ! Land cover change in CLM happens all at once on the first time + ! step of the year. However, the fire code needs deforestation + ! rates throughout the year, in order to combine these + ! deforestation rates with the current season's climate. So we + ! use a smoothed version of dwt. + ! + ! This isn't ideal, because the carbon stocks that the fire code + ! is operating on will have decreased by the full annual amount + ! before the fire code does anything. But the biggest effect of + ! these deforestation fires is as a trigger for other fires, and + ! the C fluxes are merely diagnostic so don't need to be + ! conservative, so this isn't a big issue. + ! + ! (Actually, it would be even better if the fire code had a + ! realistic breakdown of annual deforestation into the + ! different seasons. But having deforestation spread evenly + ! throughout the year is much better than having it all + ! concentrated on January 1.) + dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p)*col%wtgcell(c) + end if + end if + end if + if (spinup_state == 2) then + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + frootc_xfer(p) + deadcrootc(p) * 10._r8 + & + deadcrootc_storage(p) + deadcrootc_xfer(p) + & + livecrootc(p)+livecrootc_storage(p) + & + livecrootc_xfer(p))*patch%wtcol(p) + else + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + frootc_xfer(p) + deadcrootc(p) + & + deadcrootc_storage(p) + deadcrootc_xfer(p) + & + livecrootc(p)+livecrootc_storage(p) + & + livecrootc_xfer(p))*patch%wtcol(p) + endif + + fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) + + hdmlf=this%forc_hdm(g) + + ! all these constants are in Li et al. BG (2012a,b;2013) + + if( hdmlf > 0.1_r8 )then + ! For NOT bare-soil + if( patch%itype(p) /= noveg )then + ! For shrub and grass (crop already excluded above) + if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass + lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & + exp(-1._r8*SHR_CONST_PI* & + (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & + /(1.0_r8 - cropf_col(c)) + lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & + exp(-1._r8*SHR_CONST_PI* & + (gdp_lf(c)/7._r8)))*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & + exp(-1._r8*SHR_CONST_PI* & + (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else ! for trees + if( gdp_lf(c) > 20._r8 )then + lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c) =lgdp1_col(c)+0.62_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else + if( gdp_lf(c) > 8._r8 )then + lgdp_col(c)=lgdp_col(c)+0.79_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else + lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) + end if + end if + lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & + exp(-1._r8*SHR_CONST_PI* & + (hdmlf/125._r8)))*patch%wtcol(p)/(1._r8 -cropf_col(c)) + end if + end if + else + lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) + lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) + lpop_col(c) = lpop_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) + end if + + fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) + end if + end if + end do + end do + + ! estimate annual decreased fractional coverage of BET+BDT + ! land cover conversion in CLM4.5 is the same for each timestep except for the beginning + + if (transient_landcover) then + do fc = 1,num_soilc + c = filter_soilc(fc) + if( dtrotr_col(c) > 0._r8 )then + if( kmo == 1 .and. kda == 1 .and. mcsec == 0)then + lfc(c) = 0._r8 + end if + if( kmo == 1 .and. kda == 1 .and. mcsec == dt)then + lfc(c) = dtrotr_col(c)*dayspyr*secspday/dt + end if + else + lfc(c)=0._r8 + end if + end do + end if + ! + ! calculate burned area fraction in cropland + ! + do fc = 1,num_soilc + c = filter_soilc(fc) + baf_crop(c)=0._r8 + end do + + do fp = 1,num_soilp + p = filter_soilp(fp) + if( kmo == 1 .and. kda == 1 .and. mcsec == 0 )then + burndate(p) = 10000 ! init. value; actual range [0 365] + end if + end do + + do pi = 1,max_patch_per_col + do fc = 1,num_soilc + c = filter_soilc(fc) + g= col%gridcell(c) + hdmlf=this%forc_hdm(g) + if (pi <= col%npatches(c)) then + p = col%patchi(c) + pi - 1 + ! For crop + if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & + kmo == abm_lf(c) .and. & + burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time + + ! calculate human density impact on ag. fire + fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) + + ! calculate impact of GDP on ag. fire + fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) + + ! calculate burned area + fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) + + ! crop fire only for generic crop types at this time + ! managed crops are treated as grasses if crop model is turned on + baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fhd*fgdp*patch%wtcol(p) + if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then + burndate(p)=kda + end if + end if + end if + end do + end do + ! + ! calculate peatland fire + ! + do fc = 1, num_soilc + c = filter_soilc(fc) + g= col%gridcell(c) + if(grc%latdeg(g) < cnfire_const%borealat )then + baf_peatf(c) = non_boreal_peatfire_c/secsphr*max(0._r8, & + min(1._r8,(4.0_r8-prec60_col(c)*secspday)/ & + 4.0_r8))**2*peatf_lf(c)*(1._r8-fsat(c)) + else + baf_peatf(c) = boreal_peatfire_c/secsphr*exp(-SHR_CONST_PI*(max(wf2(c),0._r8)/0.3_r8))* & + max(0._r8,min(1._r8,(tsoi17(c)-SHR_CONST_TKFRZ)/10._r8))*peatf_lf(c)* & + (1._r8-fsat(c)) + end if + end do + ! + ! calculate other fires + ! + + ! Set the number of timesteps for e-folding. + ! When the simulation has run fewer than this number of steps, + ! re-scale the e-folding time to get a stable early estimate. + + ! find which pool is the cwd pool + i_cwd = 0 + do l = 1, ndecomp_pools + if ( is_cwd(l) ) then + i_cwd = l + endif + end do + + ! + ! begin column loop to calculate fractional area affected by fire + ! + do fc = 1, num_soilc + c = filter_soilc(fc) + g = col%gridcell(c) + hdmlf=this%forc_hdm(g) + if( cropf_col(c) < 1._r8 )then + fuelc(c) = totlitc(c)+totvegc(c)-rootc_col(c)-fuelc_crop(c)*cropf_col(c) + if (spinup_state == 2) then + fuelc(c) = fuelc(c) + ((10._r8 - 1._r8)*deadstemc_col(c)) + do j = 1, nlevdecomp + fuelc(c) = fuelc(c)+decomp_cpools_vr(c,j,i_cwd) * dzsoi_decomp(j) * spinup_factor(i_cwd) & + * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) + end do + else + do j = 1, nlevdecomp + fuelc(c) = fuelc(c)+decomp_cpools_vr(c,j,i_cwd) * dzsoi_decomp(j) + end do + end if + fuelc(c) = fuelc(c)/(1._r8-cropf_col(c)) + fb = max(0.0_r8,min(1.0_r8,(fuelc(c)-lfuel)/(ufuel-lfuel))) + if (trotr1_col(c)+trotr2_col(c)<=0.6_r8) then + afuel =min(1._r8,max(0._r8,(fuelc(c)-2500._r8)/(5000._r8-2500._r8))) + arh=1._r8-max(0._r8, min(1._r8,(forc_rh(g)-rh_low)/(rh_hgh-rh_low))) + arh30=1._r8-max(0.7_r8, min(1._r8,rh30_col(c)/90._r8)) + if (forc_rh(g) < rh_hgh.and. wtlf(c) > 0._r8 .and. tsoi17(c)> SHR_CONST_TKFRZ)then + fire_m = ((afuel*arh30+(1._r8-afuel)*arh)**1.5_r8) & + *((1._r8-btran_col(c)/wtlf(c))**0.5_r8) + else + fire_m = 0._r8 + end if + lh = pot_hmn_ign_counts_alpha*6.8_r8*hdmlf**(0.43_r8)/30._r8/24._r8 + fs = 1._r8-(0.01_r8+0.98_r8*exp(-0.025_r8*hdmlf)) + ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8* & + cos(SHR_CONST_PI/180._r8*3*min(60._r8,abs(grc%latdeg(g)))))*0.22_r8) & + *(1._r8-fs)*(1._r8-cropf_col(c)) + nfire(c) = ig/secsphr*fb*fire_m*lgdp_col(c) !fire counts/km2/sec + Lb_lf = 1._r8+10._r8*(1._r8-EXP(-0.06_r8*forc_wind(g))) + spread_m = fire_m**0.5_r8 + farea_burned(c) = min(1._r8,(cnfire_const%g0*spread_m*fsr_col(c)* & + fd_col(c)/1000._r8)**2*lgdp1_col(c)* & + lpop_col(c)*nfire(c)*SHR_CONST_PI*Lb_lf+ & + baf_crop(c)+baf_peatf(c)) ! fraction (0-1) per sec + else + farea_burned(c)=min(1._r8,baf_crop(c)+baf_peatf(c)) + end if + ! + ! if landuse change data is used, calculate deforestation fires and + ! add it in the total of burned area fraction + ! + if (transient_landcover) then + if( trotr1_col(c)+trotr2_col(c) > 0.6_r8 )then + if(( kmo == 1 .and. kda == 1 .and. mcsec == 0) .or. & + dtrotr_col(c) <=0._r8 )then + fbac1(c) = 0._r8 + farea_burned(c) = baf_crop(c)+baf_peatf(c) + else + cri = (4.0_r8*trotr1_col(c)+1.8_r8*trotr2_col(c))/(trotr1_col(c)+trotr2_col(c)) + cli = (max(0._r8,min(1._r8,(cri-prec60_col(c)*secspday)/cri))**0.5)* & + (max(0._r8,min(1._r8,(cri-prec10_col(c)*secspday)/cri))**0.5)* & + (15._r8*min(0.0016_r8,dtrotr_col(c)/dt*dayspyr*secspday)+0.009_r8)* & + max(0._r8,min(1._r8,(0.25_r8-(forc_rain(c)+forc_snow(c))*secsphr)/0.25_r8)) + farea_burned(c) = fb*cli*(cli_scale/secspday)+baf_crop(c)+baf_peatf(c) + ! burned area out of conversion region due to land use fire + fbac1(c) = max(0._r8,fb*cli*(cli_scale/secspday) - 2.0_r8*lfc(c)/dt) + end if + ! total burned area out of conversion + fbac(c) = fbac1(c)+baf_crop(c)+baf_peatf(c) + else + fbac(c) = farea_burned(c) + end if + end if + + else + farea_burned(c) = min(1._r8,baf_crop(c)+baf_peatf(c)) + end if + + end do ! end of column loop + + end associate + + end subroutine CNFireArea + +end module CNFireLi2021Mod diff --git a/src/biogeophys/SoilMoistStressMod.F90 b/src/biogeophys/SoilMoistStressMod.F90 index 4f8112b611..6706e5a04c 100644 --- a/src/biogeophys/SoilMoistStressMod.F90 +++ b/src/biogeophys/SoilMoistStressMod.F90 @@ -369,7 +369,7 @@ subroutine calc_root_moist_stress_clm45default(bounds, & rootr => soilstate_inst%rootr_patch , & ! Output: [real(r8) (:,:) ] effective fraction of roots in each soil layer (SMS method only) btran => energyflux_inst%btran_patch , & ! Output: [real(r8) (:) ] transpiration wetness factor (0 to 1) (integrated soil water stress) - btran2 => energyflux_inst%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square + btran2 => energyflux_inst%btran2_patch , & ! Output: [real(r8) (:) ] root zone soil wetness (0 to 1) rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root soil water stress (resistance) by layer (0-1) (nlevgrnd) h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] @@ -417,11 +417,9 @@ subroutine calc_root_moist_stress_clm45default(bounds, & end if s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) + ! call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) - smp_node_lf = max(smpsc(patch%itype(p)), smp_node_lf) - btran2(p) = btran2(p) +rootfr(p,j)*max(0._r8,min((smp_node_lf - smpsc(patch%itype(p))) / & - (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8)) + btran2(p) = btran2(p) +rootfr(p,j)*s_node end do end do diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 2273d362e4..aa93d7d2c2 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -68,6 +68,9 @@ module clm_varctl ! dataset conventions character(len=256), public :: conventions = "CF-1.0" + ! component name for filenames (history or restart files) + character(len=4), public :: compname = 'ctsm' + !---------------------------------------------------------- ! Unit Numbers !---------------------------------------------------------- diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 7405e6166b..009cbdd4b1 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -12,7 +12,7 @@ module histFileMod use shr_sys_mod , only : shr_sys_flush use spmdMod , only : masterproc use abortutils , only : endrun - use clm_varctl , only : iulog, use_vertsoilc, use_fates + use clm_varctl , only : iulog, use_vertsoilc, use_fates, compname use clm_varcon , only : spval, ispval, dzsoi_decomp use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort use decompMod , only : get_proc_bounds, get_proc_global, bounds_type @@ -492,7 +492,7 @@ subroutine hist_htapes_build () !----------------------------------------------------------------------- if (masterproc) then - write(iulog,*) trim(subname),' Initializing clm2 history files' + write(iulog,*) trim(subname),' Initializing ', trim(compname), ' history files' write(iulog,'(72a1)') ("-",i=1,60) call shr_sys_flush(iulog) endif @@ -539,7 +539,7 @@ subroutine hist_htapes_build () end do if (masterproc) then - write(iulog,*) trim(subname),' Successfully initialized clm2 history files' + write(iulog,*) trim(subname),' Successfully initialized ', trim(compname), ' history files' write(iulog,'(72a1)') ("-",i=1,60) call shr_sys_flush(iulog) endif @@ -3749,7 +3749,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ! Create the restart history filename and open it write(hnum,'(i1.1)') t-1 - locfnhr(t) = "./" // trim(caseid) //".clm2"// trim(inst_suffix) & + locfnhr(t) = "./" // trim(caseid) //"."// trim(compname) // trim(inst_suffix) & // ".rh" // hnum //"."// trim(rdate) //".nc" call htape_create( t, histrest=.true. ) @@ -4546,7 +4546,7 @@ character(len=max_length_filename) function set_hist_filename (hist_freq, hist_m write(cdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr,mon,day,sec endif write(hist_index,'(i1.1)') hist_file - 1 - set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& + set_hist_filename = "./"//trim(caseid)//"."//trim(compname)//trim(inst_suffix)//& ".h"//hist_index//"."//trim(cdate)//".nc" ! check to see if the concatenated filename exceeded the diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 9b7eefa51b..702a03b511 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -221,6 +221,8 @@ module pftconMod real(r8), allocatable :: fm_droot (:) real(r8), allocatable :: fsr_pft (:) real(r8), allocatable :: fd_pft (:) + real(r8), allocatable :: rswf_min (:) + real(r8), allocatable :: rswf_max (:) ! pft parameters for crop code real(r8), allocatable :: manunitro (:) ! manure @@ -432,6 +434,8 @@ subroutine InitAllocate (this) allocate( this%fm_droot (0:mxpft) ) allocate( this%fsr_pft (0:mxpft) ) allocate( this%fd_pft (0:mxpft) ) + allocate( this%rswf_max (0:mxpft) ) + allocate( this%rswf_min (0:mxpft) ) allocate( this%manunitro (0:mxpft) ) allocate( this%fleafcn (0:mxpft) ) allocate( this%ffrootcn (0:mxpft) ) @@ -951,6 +955,11 @@ subroutine InitRead(this) call ncd_io('fd_pft', this% fd_pft, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + call ncd_io('rswf_min', this% rswf_min, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + + call ncd_io('rswf_max', this% rswf_max, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('planting_temp', this%planttemp, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) @@ -1365,6 +1374,8 @@ subroutine Clean(this) deallocate( this%fm_droot) deallocate( this%fsr_pft) deallocate( this%fd_pft) + deallocate( this%rswf_min) + deallocate( this%rswf_max) deallocate( this%manunitro) deallocate( this%fleafcn) deallocate( this%ffrootcn) diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 83be13835b..e39d1e90cb 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -17,7 +17,7 @@ module restFileMod use accumulMod , only : accumulRest use clm_instMod , only : clm_instRest use histFileMod , only : hist_restart_ncd - use clm_varctl , only : iulog, use_fates, use_hydrstress + use clm_varctl , only : iulog, use_fates, use_hydrstress, compname use clm_varctl , only : create_crop_landunit, irrigate use clm_varcon , only : nameg, namel, namec, namep, nameCohort use ncdio_pio , only : file_desc_t, ncd_pio_createfile, ncd_pio_openfile, ncd_global @@ -263,8 +263,8 @@ subroutine restFile_getfile( file, path ) end if call getfil( path, file, 0 ) - ! tcraig, adding xx. and .clm2 makes this more robust - ctest = 'xx.'//trim(caseid)//'.clm2' + ! tcraig, adding xx. and .compname makes this more robust + ctest = 'xx.'//trim(caseid)//'.'//trim(compname) ftest = 'xx.'//trim(file) status = index(trim(ftest),trim(ctest)) if (status /= 0 .and. .not.(brnch_retain_casename)) then @@ -466,7 +466,7 @@ character(len=256) function restFile_filename( rdate ) character(len=*), intent(in) :: rdate ! input date for restart file name !----------------------------------------------------------------------- - restFile_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& + restFile_filename = "./"//trim(caseid)//"."//trim(compname)//trim(inst_suffix)//& ".r."//trim(rdate)//".nc" if (masterproc) then write(iulog,*)'writing restart file ',trim(restFile_filename),' for model date = ',rdate From e0f02da097f466f85ebb196cc6f42fd6032a786c Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 4 Sep 2020 15:23:48 -0400 Subject: [PATCH 1420/1973] Initial set of changes necessary for updating api to FATES CNP --- src/biogeochem/EDBGCDynMod.F90 | 13 --- src/main/clm_driver.F90 | 42 +++++--- src/main/histFileMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 127 ++++++++++++++++------- src/utils/clmfates_paraminterfaceMod.F90 | 3 + 5 files changed, 123 insertions(+), 64 deletions(-) diff --git a/src/biogeochem/EDBGCDynMod.F90 b/src/biogeochem/EDBGCDynMod.F90 index 802ad4b247..e4150e7789 100644 --- a/src/biogeochem/EDBGCDynMod.F90 +++ b/src/biogeochem/EDBGCDynMod.F90 @@ -336,19 +336,6 @@ subroutine EDBGCDynSummary(bounds, num_soilc, filter_soilc, num_soilp, filter_so ! call soilbiogeochem_nitrogenflux_inst%Summary(bounds, num_soilc, filter_soilc) - ! ----------------------------------------------------------------------------------- - ! fates veg carbon state and flux summary, Nitrogen (TBD) and Balance Checks - ! ----------------------------------------------------------------------------------- - ! ---------------------------------------------- - ! fates veg nitrogen flux summary - ! ---------------------------------------------- - ! ---------------------------------------------- - ! calculate balance checks on entire carbon cycle (FATES + BGC) - ! ---------------------------------------------- - - call clm_fates%wrap_bgc_summary(nc, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_carbonstate_inst) - call t_stopf('BGCsum') end subroutine EDBGCDynSummary diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 45e60467ca..090cf3b988 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1002,22 +1002,31 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro end if - if ( use_fates .and. is_beg_curr_day() ) then ! run fates at the start of each day - if ( masterproc ) then - write(iulog,*) 'clm: calling FATES model ', get_nstep() - end if - - call clm_fates%dynamics_driv( nc, bounds_clump, & - atm2lnd_inst, soilstate_inst, temperature_inst, active_layer_inst, & - water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & - water_inst%wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst, & - frictionvel_inst) - - ! TODO(wjs, 2016-04-01) I think this setFilters call should be replaced by a - ! call to reweight_wrapup, if it's needed at all. - call setFilters( bounds_clump, glc_behavior ) + + if ( use_fates) then + if( is_beg_curr_day() ) then + + ! -------------------------------------------------------------------------- + ! This is the main call to FATES dynamics + ! -------------------------------------------------------------------------- + + if ( masterproc ) then + write(iulog,*) 'clm: calling FATES model ', get_nstep() + end if + + call clm_fates%dynamics_driv( nc, bounds_clump, & + atm2lnd_inst, soilstate_inst, temperature_inst, active_layer_inst, & + water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & + water_inst%wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst, & + frictionvel_inst) + + ! TODO(wjs, 2016-04-01) I think this setFilters call should be replaced by a + ! call to reweight_wrapup, if it's needed at all. + call setFilters( bounds_clump, glc_behavior ) + end if + end if ! use_fates branch @@ -1045,6 +1054,11 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & clm_fates, nc) + + call clm_fates%wrap_update_hifrq_hist(bounds_clump, & + soilbiogeochem_carbonflux_inst, & + soilbiogeochem_carbonstate_inst) + end if diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index c8e0257136..1805e50fb8 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -27,7 +27,7 @@ module histFileMod use FatesInterfaceTypesMod , only : nlevheight use EDTypesMod , only : nfsc use FatesLitterMod , only : ncwd - use EDTypesMod , only : num_elements_fates => num_elements + use PRTGenericMod , only : nelements_fates => num_elements use FatesInterfaceTypesMod , only : numpft_fates => numpft use ncdio_pio diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index e0215c416b..70eb37f70b 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -59,7 +59,8 @@ module CLMFatesInterfaceMod use clm_varctl , only : use_fates_inventory_init use clm_varctl , only : use_fates_fixed_biogeog use clm_varctl , only : fates_inventory_ctrl_filename - + use clm_varctl , only : nu_com + use clm_varctl , only : use_nitrif_denitrif use clm_varcon , only : tfrz use clm_varcon , only : spval use clm_varcon , only : denice @@ -109,6 +110,8 @@ module CLMFatesInterfaceMod use FatesInterfaceMod, only : SetFatesGlobalElements use FatesInterfaceMod , only : allocate_bcin use FatesInterfaceMod , only : allocate_bcout + use FatesInterfaceMod , only : allocate_bcpconst + use FatesInterfaceMod , only : set_bcpconst use FatesInterfaceMod , only : zero_bcs use FatesInterfaceMod , only : SetFatesTime use FatesInterfaceMod , only : set_fates_ctrlparms @@ -118,7 +121,7 @@ module CLMFatesInterfaceMod use FatesRestartInterfaceMod, only : fates_restart_interface_type use EDTypesMod , only : ed_patch_type - use EDTypesMod , only : num_elements + use PRTGenericMod , only : num_elements use FatesInterfaceTypesMod , only : hlm_numlevgrnd use EDMainMod , only : ed_ecosystem_dynamics use EDMainMod , only : ed_update_site @@ -133,7 +136,7 @@ module CLMFatesInterfaceMod use EDCanopyStructureMod , only : canopy_summarization, update_hlm_dynamics use FatesPlantRespPhotosynthMod, only : FatesPlantRespPhotosynthDrive use EDAccumulateFluxesMod , only : AccumulateFluxes_ED - use EDPhysiologyMod , only : FluxIntoLitterPools + use FatesSoilBGCFluxMod , only : FluxIntoLitterPools use FatesPlantHydraulicsMod, only : hydraulics_drive use FatesPlantHydraulicsMod, only : HydrSiteColdStart use FatesPlantHydraulicsMod, only : InitHydrSites @@ -203,6 +206,7 @@ module CLMFatesInterfaceMod procedure, public :: wrap_accumulatefluxes procedure, public :: prep_canopyfluxes procedure, public :: wrap_canopy_radiation + procedure, public :: wrap_update_hifrq_hist procedure, public :: wrap_bgc_summary procedure, public :: TransferZ0mDisp procedure, public :: InterpFileInputs ! Interpolate inputs from files @@ -288,6 +292,30 @@ subroutine CLMFatesGlobals() call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) + + if((trim(nu_com).eq.'ECA') .or. (trim(nu_com).eq.'MIC')) then + call set_fates_ctrlparms('nu_com',cval='ECA') + else + call set_fates_ctrlparms('nu_com',cval='RD') + end if + + + ! These may be in a non-limiting status (ie when supplements) + ! are added, but they are always allocated and cycled non-the less + ! FATES may want to interact differently with other models + ! that don't even have these arrays allocated. + ! FATES also checks that if NO3 is cycled in ELM, then + ! any plant affinity parameters are checked. + + if(use_nitrif_denitrif) then + call set_fates_ctrlparms('nitrogen_spec',ival=1) + else + call set_fates_ctrlparms('nitrogen_spec',ival=2) + end if + + ! Phosphorus is not tracked in CLM + call set_fates_ctrlparms('phosphorus_spec',ival=0) + call set_fates_ctrlparms('spitfire_mode',ival=fates_spitfire_mode) call set_fates_ctrlparms('sf_nofire_def',ival=no_fire) @@ -546,9 +574,19 @@ subroutine init(this, bounds_proc ) ! Allocate the FATES boundary arrays (out) allocate(this%fates(nc)%bc_out(this%fates(nc)%nsites)) + + ! Parameter Constants defined by FATES, but used in ELM + ! Note that FATES has its parameters defined, so we can also set the values + call allocate_bcpconst(this%fates(nc)%bc_pconst,nlevdecomp) + + ! This also needs + call set_bcpconst(this%fates(nc)%bc_pconst,nlevdecomp) + + ! Allocate and Initialize the Boundary Condition Arrays ! These are staticaly allocated at maximums, so ! No information about the patch or cohort structure is needed at this step + do s = 1, this%fates(nc)%nsites @@ -823,6 +861,12 @@ subroutine dynamics_driv(this, nc, bounds_clump, & end do + ! Nutrient uptake fluxes have been accumulating with each short + ! timestep, here, we unload them from the boundary condition + ! structures into the cohort structures. + ! call UnPackNutrientAquisitionBCs(this%fates(nc)%sites, this%fates(nc)%bc_in) + + ! --------------------------------------------------------------------------------- ! Part II: Call the FATES model now that input boundary conditions have been ! provided. @@ -831,21 +875,15 @@ subroutine dynamics_driv(this, nc, bounds_clump, & do s = 1,this%fates(nc)%nsites call ed_ecosystem_dynamics(this%fates(nc)%sites(s), & - this%fates(nc)%bc_in(s)) + this%fates(nc)%bc_in(s), & + this%fates(nc)%bc_out(s)) call ed_update_site(this%fates(nc)%sites(s), & - this%fates(nc)%bc_in(s)) + this%fates(nc)%bc_in(s), & + this%fates(nc)%bc_out(s)) enddo - ! call subroutine to aggregate fates litter output fluxes and - ! package them for handing across interface - call FluxIntoLitterPools(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out) - - ! --------------------------------------------------------------------------------- ! Part III: Process FATES output into the dimensions and structures that are part ! of the HLMs API. (column, depth, and litter fractions) @@ -874,7 +912,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! --------------------------------------------------------------------------------- ! Part III.2 (continued). - ! Update diagnostics of the FATES ecosystem structure that are used in the HLM. + ! Update UpdateLdiagnostics of the FATES ecosystem structure that are used in the HLM. ! --------------------------------------------------------------------------------- call this%wrap_update_hlmfates_dyn(nc, & bounds_clump, & @@ -1297,9 +1335,20 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & ! update type stuff, should consolidate (rgk 11-2016) do s = 1,this%fates(nc)%nsites call ed_update_site( this%fates(nc)%sites(s), & - this%fates(nc)%bc_in(s) ) - end do + this%fates(nc)%bc_in(s), & + this%fates(nc)%bc_out(s) ) + + ! This call sends internal fates variables into the + ! output boundary condition structures. Note: this is called + ! internally in fates dynamics as well. + call FluxIntoLitterPools(this%fates(nc)%sites(s), & + this%fates(nc)%bc_in(s), & + this%fates(nc)%bc_out(s)) + + end do + + ! ------------------------------------------------------------------------ ! Re-populate all the hydraulics variables that are dependent ! on the key hydro state variables and plant carbon/geometry @@ -1412,7 +1461,8 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & end do call set_site_properties(this%fates(nc)%nsites, & - this%fates(nc)%sites,this%fates(nc)%bc_in) + this%fates(nc)%sites, & + this%fates(nc)%bc_in) ! ---------------------------------------------------------------------------- ! Initialize Hydraulics Code if turned on @@ -1459,7 +1509,16 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & do s = 1,this%fates(nc)%nsites call ed_update_site(this%fates(nc)%sites(s), & - this%fates(nc)%bc_in(s)) + this%fates(nc)%bc_in(s), & + this%fates(nc)%bc_out(s)) + + ! This call sends internal fates variables into the + ! output boundary condition structures. Note: this is called + ! internally in fates dynamics as well. + call FluxIntoLitterPools(this%fates(nc)%sites(s), & + this%fates(nc)%bc_in(s), & + this%fates(nc)%bc_out(s)) + end do ! ------------------------------------------------------------------------ @@ -1958,12 +2017,6 @@ subroutine wrap_accumulatefluxes(this, nc, fn, filterp) this%fates(nc)%bc_out, & dtime) - - call this%fates_hist%update_history_prod(nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites, & - dtime) - call t_stopf('fates_wrapaccfluxes') end subroutine wrap_accumulatefluxes @@ -2060,28 +2113,29 @@ end subroutine wrap_canopy_radiation ! ====================================================================================== - subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_carbonstate_inst) - - + subroutine wrap_update_hifrq_hist(this, bounds_clump, & + soilbiogeochem_carbonflux_inst, & + soilbiogeochem_carbonstate_inst) ! Arguments class(hlm_fates_interface_type), intent(inout) :: this - integer , intent(in) :: nc + type(bounds_type), intent(in) :: bounds_clump type(soilbiogeochem_carbonflux_type), intent(in) :: soilbiogeochem_carbonflux_inst type(soilbiogeochem_carbonstate_type), intent(in) :: soilbiogeochem_carbonstate_inst ! locals real(r8) :: dtime - integer :: s,c + integer :: s, c, nc - call t_startf('fates_wrapbgcsummary') + call t_startf('fates_update_hifrq_hist') associate(& - hr => soilbiogeochem_carbonflux_inst%hr_col, & ! (gC/m2/s) total heterotrophic respiration + hr => soilbiogeochem_carbonflux_inst%hr_col, & ! (gC/m2/s) total heterotrophic respiration totsomc => soilbiogeochem_carbonstate_inst%totsomc_col, & ! (gC/m2) total soil organic matter carbon totlitc => soilbiogeochem_carbonstate_inst%totlitc_col) ! (gC/m2) total litter carbon in BGC pools + nc = bounds_clump%clump_index + ! Summarize Net Fluxes do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) @@ -2093,7 +2147,7 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & dtime = get_step_size_real() ! Update history variables that track these variables - call this%fates_hist%update_history_cbal(nc, & + call this%fates_hist%update_history_hifrq(nc, & this%fates(nc)%nsites, & this%fates(nc)%sites, & this%fates(nc)%bc_in, & @@ -2101,9 +2155,9 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & end associate - call t_stopf('fates_wrapbgcsummary') + call t_stopf('fates_wrap_hifrq_hist') - end subroutine wrap_bgc_summary + end subroutine wrap_update_hifrq_hist ! ====================================================================================== @@ -2148,7 +2202,8 @@ subroutine TransferZ0mDisp(this, bounds_clump, z0m_patch, displa_patch) return end subroutine TransferZ0mDisp - !----------------------------------------------------------------------- + !----------------------------------------------------------------------- + subroutine InterpFileInputs(this, bounds) ! ! !DESCRIPTION: diff --git a/src/utils/clmfates_paraminterfaceMod.F90 b/src/utils/clmfates_paraminterfaceMod.F90 index 474ba12394..01a3328747 100644 --- a/src/utils/clmfates_paraminterfaceMod.F90 +++ b/src/utils/clmfates_paraminterfaceMod.F90 @@ -33,6 +33,7 @@ subroutine FatesReadParameters() use EDParamsMod, only : FatesRegisterParams, FatesReceiveParams use SFParamsMod, only : SpitFireRegisterParams, SpitFireReceiveParams + use PRTInitParamsFATESMod, only : PRTRegisterParams, PRTReceiveParams use FatesSynchronizedParamsMod, only : FatesSynchronizedParamsInst implicit none @@ -50,6 +51,7 @@ subroutine FatesReadParameters() call fates_params%Init() call FatesRegisterParams(fates_params) call SpitFireRegisterParams(fates_params) + call PRTRegisterParams(fates_params) call FatesSynchronizedParamsInst%RegisterParams(fates_params) is_host_file = .false. @@ -60,6 +62,7 @@ subroutine FatesReadParameters() call FatesReceiveParams(fates_params) call SpitFireReceiveParams(fates_params) + call PRTReceiveParams(fates_params) call FatesSynchronizedParamsInst%ReceiveParams(fates_params) call fates_params%Destroy() From 186059545a5d7fa796c2b7d12c169229db0fed27 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 4 Sep 2020 23:50:52 -0600 Subject: [PATCH 1421/1973] Changes to get LILACSMOKE test to build --- cime_config/buildlib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index 9f6006160a..5efaa2799d 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -69,7 +69,7 @@ def _write_ctsm_mk(gmake, gmake_opts, makefile, exeroot, libroot): # ====================================================================== CTSM_BLD_DIR = {ctsm_bld_dir} -CTSM_INC = $(CTSM_BLD_DIR)/clm/obj +CTSM_INC = $(CTSM_BLD_DIR)/ctsm/obj # ====================================================================== # The following settings should be included in an atmosphere model's build. @@ -102,10 +102,10 @@ def _main_func(): #------------------------------------------------------- # create Filepath file #------------------------------------------------------- + compname = case.get_value("COMP_LND") filepath_file = os.path.join(bldroot,"Filepath") if not os.path.isfile(filepath_file): caseroot = case.get_value("CASEROOT") - compname = case.get_value("COMP_LND") expect( ((compname == "clm") or (compname == "ctsm")), "Unexpected COMP_LND name: %s" % (compname)) paths = [os.path.join(caseroot,"SourceMods","src."+compname), From 660d2f4bc9fe54b21eea0809a5234702cfdfaec6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 6 Sep 2020 15:08:22 -0600 Subject: [PATCH 1422/1973] ERP and ERI restart tests were failing because it wasn't copying the restart files over, so change it back to clm2 and it works --- src/main/clm_varctl.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index aa93d7d2c2..34e8227480 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -69,7 +69,7 @@ module clm_varctl character(len=256), public :: conventions = "CF-1.0" ! component name for filenames (history or restart files) - character(len=4), public :: compname = 'ctsm' + character(len=4), public :: compname = 'clm2' !---------------------------------------------------------- ! Unit Numbers From 76f6f259ca6f78923c48eef84b346808ede57e28 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 6 Sep 2020 15:09:00 -0600 Subject: [PATCH 1423/1973] Params files with the new data on them, and changes fsr_pft for the ctsm5_1 version --- bld/namelist_files/namelist_defaults_ctsm.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index bf363e391b..6aed1e902b 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -457,9 +457,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/clm5_params.c200624.nc -lnd/clm2/paramdata/clm5_params.c200624.nc -lnd/clm2/paramdata/clm45_params.c200624.nc +lnd/clm2/paramdata/ctsm51_params.c200905.nc +lnd/clm2/paramdata/clm50_params.c200905.nc +lnd/clm2/paramdata/clm45_params.c200905.nc From b0849c6583a7ca3957c09d32e511d7a9524c8184 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 6 Sep 2020 21:20:13 -0600 Subject: [PATCH 1424/1973] Add compname to namelist so restart tests will have the right restart files copied over --- bld/namelist_files/namelist_definition_ctsm.xml | 9 +++++++++ src/main/clm_varctl.F90 | 2 +- src/main/controlMod.F90 | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 5b9dbbf8cc..bfa726fdcc 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -49,6 +49,15 @@ Full pathname of master restart file for a branch run. (only used if RUN_TYPE=br (Set with RUN_REFCASE and RUN_REFDATE) + +Component name to use in history and restart files + + Date: Sun, 6 Sep 2020 23:14:35 -0600 Subject: [PATCH 1425/1973] Always set compname on namelist and set it by the clm physics setting --- bld/CLMBuildNamelist.pm | 7 +++++-- bld/namelist_files/namelist_defaults_ctsm.xml | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 130309aff4..91944d7f77 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1486,7 +1486,7 @@ sub process_namelist_inline_logic { ############################## # namelist group: clm_inparm # ############################## - setup_logic_site_specific($nl_flags, $definition, $nl); + setup_logic_site_specific($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_lnd_frac($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref); setup_logic_co2_type($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_irrigate($opts, $nl_flags, $definition, $defaults, $nl); @@ -1710,7 +1710,7 @@ sub process_namelist_inline_logic { sub setup_logic_site_specific { # site specific requirements - my ($nl_flags, $definition, $nl) = @_; + my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; # res check prevents polluting the namelist with an unnecessary # false variable for every run @@ -1741,6 +1741,9 @@ sub setup_logic_site_specific { $log->fatal_error("1x1_numaIA grids must use a compset with CN and CROP turned on."); } } + # Set compname + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'compname', + 'phys'=>$nl_flags->{'phys'} ); } #------------------------------------------------------------------------------- diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 6aed1e902b..e3de947f0b 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -38,6 +38,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case). clm5_0_cam6.0 ctsm5_1_GSWP3v1 + +ctsm51 +clm50 +clm45 + off From a6844df7cd57b48f217ecd0133f9ae27a13eb7a0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 7 Sep 2020 15:35:53 -0600 Subject: [PATCH 1426/1973] Some operations in cime assume that only one digit is allowed for the version after the compname --- bld/namelist_files/namelist_defaults_ctsm.xml | 6 +++--- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index e3de947f0b..4f936d350d 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -39,9 +39,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ctsm5_1_GSWP3v1 -ctsm51 -clm50 -clm45 +ctsm5 +clm5 +clm4 off diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index bfa726fdcc..48b916cab4 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -54,7 +54,7 @@ Full pathname of master restart file for a branch run. (only used if RUN_TYPE=br category="datasets" group="clm_inparm" value="clm2" - valid_values="clm2,clm45,clm50,ctsm51" > + valid_values="clm2,clm4,clm5,ctsm5" > Component name to use in history and restart files From 3d95dd0de5e0e88acd4c83104ac373b3111de14e Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 8 Sep 2020 11:46:20 -0400 Subject: [PATCH 1427/1973] Fates CNP fixes, expand namelist range for prt 2 --- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- src/main/histFileMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 15 +++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 77594f7c7a..33d64d9c32 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -631,7 +631,7 @@ Toggle to turn on the FATES model + group="clm_inparm" valid_values="1,2"> Switch deciding which nutrient model to use in FATES. diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 1805e50fb8..c3c491a7e6 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -27,7 +27,7 @@ module histFileMod use FatesInterfaceTypesMod , only : nlevheight use EDTypesMod , only : nfsc use FatesLitterMod , only : ncwd - use PRTGenericMod , only : nelements_fates => num_elements + use PRTGenericMod , only : num_elements_fates => num_elements use FatesInterfaceTypesMod , only : numpft_fates => numpft use ncdio_pio diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 70eb37f70b..562a6893a7 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -59,7 +59,6 @@ module CLMFatesInterfaceMod use clm_varctl , only : use_fates_inventory_init use clm_varctl , only : use_fates_fixed_biogeog use clm_varctl , only : fates_inventory_ctrl_filename - use clm_varctl , only : nu_com use clm_varctl , only : use_nitrif_denitrif use clm_varcon , only : tfrz use clm_varcon , only : spval @@ -207,7 +206,6 @@ module CLMFatesInterfaceMod procedure, public :: prep_canopyfluxes procedure, public :: wrap_canopy_radiation procedure, public :: wrap_update_hifrq_hist - procedure, public :: wrap_bgc_summary procedure, public :: TransferZ0mDisp procedure, public :: InterpFileInputs ! Interpolate inputs from files procedure, public :: Init2 ! Initialization after determining subgrid weights @@ -293,12 +291,10 @@ subroutine CLMFatesGlobals() call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) - if((trim(nu_com).eq.'ECA') .or. (trim(nu_com).eq.'MIC')) then - call set_fates_ctrlparms('nu_com',cval='ECA') - else - call set_fates_ctrlparms('nu_com',cval='RD') - end if - + ! CTSM-FATES is not fully coupled (yet) + ! So lets tell fates to use the RD competition mechanism + ! which has fewer boundary conditions (simpler) + call set_fates_ctrlparms('nu_com',cval='RD') ! These may be in a non-limiting status (ie when supplements) ! are added, but they are always allocated and cycled non-the less @@ -2144,6 +2140,9 @@ subroutine wrap_update_hifrq_hist(this, bounds_clump, & this%fates(nc)%bc_in(s)%tot_litc = totlitc(c) end do + + print*,"LSM BGC rates: ",hr(c),totsomc(c),totlitc(c) + dtime = get_step_size_real() ! Update history variables that track these variables From c537fa31e2f02a2a2f62dde083cdff31b1f0cd25 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 8 Sep 2020 13:12:16 -0600 Subject: [PATCH 1428/1973] Set component to clm for user_nl_ files for testing, one test have it trigger based on COMP_LND, but it still should actually use clm --- cime_config/SystemTests/lciso.py | 5 +++-- cime_config/SystemTests/lii.py | 4 ++-- cime_config/SystemTests/lii2finidatareas.py | 2 +- cime_config/SystemTests/lilacsmoke.py | 4 ++-- cime_config/SystemTests/lvg.py | 4 ++-- cime_config/SystemTests/lwiso.py | 4 ++-- cime_config/SystemTests/soilstructud.py | 4 ++-- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/cime_config/SystemTests/lciso.py b/cime_config/SystemTests/lciso.py index 6faa43a368..12a74d5d5c 100644 --- a/cime_config/SystemTests/lciso.py +++ b/cime_config/SystemTests/lciso.py @@ -17,6 +17,7 @@ class LCISO(SystemTestsCompareTwo): def __init__(self, case): + self.comp = case.get_value("COMP_LND") SystemTestsCompareTwo.__init__(self, case, separate_builds = False, run_two_suffix = 'cisoallon', @@ -26,11 +27,11 @@ def __init__(self, case): def _case_one_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = self.comp, contents = "use_c13=F, use_c14=F") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = self.comp, contents = "use_c13=.true.,use_c14=.true.,use_c13_timeseries=.true.,use_c14_bombspike=.true." ) diff --git a/cime_config/SystemTests/lii.py b/cime_config/SystemTests/lii.py index 48ce346a27..3a76a18847 100644 --- a/cime_config/SystemTests/lii.py +++ b/cime_config/SystemTests/lii.py @@ -46,11 +46,11 @@ def __init__(self, case): def _case_one_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "use_init_interp = .true.") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "use_init_interp = .false.") diff --git a/cime_config/SystemTests/lii2finidatareas.py b/cime_config/SystemTests/lii2finidatareas.py index b167b07a18..82fec80013 100644 --- a/cime_config/SystemTests/lii2finidatareas.py +++ b/cime_config/SystemTests/lii2finidatareas.py @@ -72,5 +72,5 @@ def __init__(self, case): def _case_one_setup(self): super(LII2FINIDATAREAS, self)._case_one_setup() append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "init_interp_method = 'use_finidat_areas'") diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index ed4624ff57..a35df0e685 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -146,8 +146,8 @@ def _create_runtime_inputs(self): # The user_nl_ctsm in the case directory is set up based on the standard testmods # mechanism. We use that one in place of the standard user_nl_ctsm, since the one # in the case directory may contain test-specific modifications. - shutil.copyfile(src=os.path.join(caseroot, 'user_nl_ctsm'), - dst=os.path.join(runtime_inputs, 'user_nl_ctsm')) + shutil.copyfile(src=os.path.join(caseroot, 'user_nl_clm'), + dst=os.path.join(runtime_inputs, 'user_nl_clm')) script_to_run = os.path.join(runtime_inputs, 'make_runtime_inputs') self._run_build_cmd('{} --rundir {}'.format(script_to_run, runtime_inputs), diff --git a/cime_config/SystemTests/lvg.py b/cime_config/SystemTests/lvg.py index 07cd89a2fe..36fae196b2 100644 --- a/cime_config/SystemTests/lvg.py +++ b/cime_config/SystemTests/lvg.py @@ -27,11 +27,11 @@ def __init__(self, case): def _case_one_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "glacier_region_behavior = 'single_at_atm_topo', 'virtual', 'virtual', 'multiple'") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "glacier_region_behavior = 'single_at_atm_topo', 'virtual', 'virtual', 'virtual'") diff --git a/cime_config/SystemTests/lwiso.py b/cime_config/SystemTests/lwiso.py index deb8745794..1083e2ff36 100644 --- a/cime_config/SystemTests/lwiso.py +++ b/cime_config/SystemTests/lwiso.py @@ -34,11 +34,11 @@ def _case_one_setup(self): # eventually, though, we should change this to the latter. (See # .) append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "enable_water_tracer_consistency_checks=.true.") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "enable_water_tracer_consistency_checks=.false.") diff --git a/cime_config/SystemTests/soilstructud.py b/cime_config/SystemTests/soilstructud.py index 1ab331ffdf..b454695f6e 100644 --- a/cime_config/SystemTests/soilstructud.py +++ b/cime_config/SystemTests/soilstructud.py @@ -27,11 +27,11 @@ def __init__(self, case): def _case_one_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "soil_layerstruct_userdefined_nlevsoi = 4,soil_layerstruct_userdefined = 0.1d0,0.3d0,0.6d0,1.0d0,1.0d0") def _case_two_setup(self): append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "ctsm", + component = "clm", contents = "soil_layerstruct_predefined = '4SL_2m'") From 372b2a865b8970716b3d7162e84f82b59d79d323 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 8 Sep 2020 13:52:02 -0600 Subject: [PATCH 1429/1973] Check for different component names for refcases, the ERI test now passes --- cime_config/buildnml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 3f5835013d..ddd6cade0f 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -188,11 +188,19 @@ def buildnml(case, caseroot, compname): # ----------------------------------------------------- if run_type == "hybrid" or run_type == "branch": - clm_startfile = "%s.clm2%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) - if not os.path.exists(os.path.join(rundir, clm_startfile)): - clm_startfile = "%s.clm2.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) - logger.warning( "WARNING: the start file being used for a multi-instance case is a single instance: "+clm_startfile ) + compnames = [ "clm4", "clm5", "ctsm5", "clm2" ] + for comp in compnames: + clm_startfile = "%s.%s%s.r.%s-%s.nc"%(run_refcase,comp,inst_string,run_refdate,run_reftod) + if os.path.exists(os.path.join(rundir, clm_startfile)): + break + else: + clm_startfile = "%s.%s.r.%s-%s.nc"%(run_refcase,comp,run_refdate,run_reftod) + if os.path.exists(os.path.join(rundir, clm_startfile)): + logger.warning( "WARNING: the start file being used for a multi-instance case is a single instance: "+clm_startfile ) + break + if not os.path.exists(os.path.join(rundir, clm_startfile)): + logger.warning( "WARNING: Could NOT find a start file to use using"+clm_startfile ) clm_icfile = "%s = \'%s\'"%(startfile_type, clm_startfile) else: clm_icfile = "" From 7b2b225c540fe7f98d876fc1dd194b2de7ff62c7 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Tue, 8 Sep 2020 15:59:41 -0600 Subject: [PATCH 1430/1973] updating ChangeLog and ChangeSum --- doc/ChangeLog | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 109 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index db50b78ed4..c2b4a7d0a4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,112 @@ =============================================================== +Tag name: ctsm1.0.dev113 +Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) +Date: Tue Sep 8 15:57:49 MDT 2020 +One-line Summary: Some bit-for-bit changes needed for the Perturbed Parameter Ensemble work + +Purpose of changes +------------------ + +Some BFB fixes including bug fixes needed for PPE simulations. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1060 (Some code cleanup of luna bug fixes) +- Resolves ESCOMP/CTSM#1062 (PPE namelist parameter defaults) +- Resolves ESCOMP/CTSM#1053 (Non-standard namelist parameter) +- Resolves ESCOMP/CTSM#1055 (Expand potential vcmax:jmax ratio) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +cmb_cmplt_fact was a parameter under namelist control which included an array. +This parameter is now splitted into cmb_cmplt_fact_litter and +cmb_cmplt_fact_cwd whih are two real values. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +Previously, denitrif_nitrateconc_exponent and denitrif_nitrateconc_coefficient +were on the params file but ALSO on the namelist. They are now removed from the namelist. + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: [For timing changes, can check PFS +test(s) in the test suite] None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double +maintenance): None + +Changes to tests or testing: None + + +CTSM testing: + + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- PASS (except for NLCOMP) + izumi ------- PASS (except for NLCOMP) + +If the tag used for baseline comparisons was NOT the previous tag, note that here: +ctsm1.0.dev111 + + +Answer changes +-------------- + +Changes answers relative to baseline: None + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +None + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1102 + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev112 Originator(s): sacks (Bill Sacks), wwieder (Will Wieder) Date: Fri Aug 28 17:10:57 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index fc2975500f..205a0e665a 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm1.0.dev113 negins 09/08/2020 Some bit-for-bit changes needed for the Perturbed Parameter Ensemble work ctsm1.0.dev112 sacks/ww 08/28/2020 Small changes to mksurfdata_map, singlept tool and run_sys_tests ctsm1.0.dev111 erik 08/28/2020 Compsets don't use 2014 for GSWP3 forcing, LUNA prevyr changed back ctsm1.0.dev110 jedwards 08/21/2020 Fixes needed for PIO2 From 6123c2f68bab8e587615b6f20407df5fa052bc43 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 9 Sep 2020 11:06:41 -0600 Subject: [PATCH 1431/1973] adding some updates to implement @ekluzek 's suggestions --- doc/ChangeLog | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index c2b4a7d0a4..39f375cc66 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -7,7 +7,7 @@ One-line Summary: Some bit-for-bit changes needed for the Perturbed Parameter En Purpose of changes ------------------ -Some BFB fixes including bug fixes needed for PPE simulations. +Some BFB fixes including bug fixes needed for PPE simulations. Bugs fixed or introduced ------------------------ @@ -36,9 +36,13 @@ Notes of particular relevance for users --------------------------------------- Caveats for users (e.g., need to interpolate initial conditions): -cmb_cmplt_fact was a parameter under namelist control which included an array. -This parameter is now splitted into cmb_cmplt_fact_litter and -cmb_cmplt_fact_cwd whih are two real values. +cmb_cmplt_fact was a parameter under namelist control pertaining to the fire +model (combusion completion factor [unitless]), which previously included an array. +This parameter is now splitted into two real values i.e. cmb_cmplt_fact_litter and +cmb_cmplt_fact_cwd. +If the users have cmb_cmplt_fact in a user_nl_clm file that worked before, it +won't work anymore since it is now splitted into cmb_cmplt_fact_litter +and cmb_cmplt_fact_cwd. Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Previously, denitrif_nitrateconc_exponent and denitrif_nitrateconc_coefficient From d122e9978dce9912ecbcc4f4d20c22896bff49bd Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 10 Sep 2020 00:36:17 -0600 Subject: [PATCH 1432/1973] Hardcode for previous version, need to add namelist to handle the ctsm5.1 option --- src/biogeophys/SoilMoistStressMod.F90 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/SoilMoistStressMod.F90 b/src/biogeophys/SoilMoistStressMod.F90 index 6706e5a04c..acf9c5d7df 100644 --- a/src/biogeophys/SoilMoistStressMod.F90 +++ b/src/biogeophys/SoilMoistStressMod.F90 @@ -417,9 +417,15 @@ subroutine calc_root_moist_stress_clm45default(bounds, & end if s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - ! call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) + if ( .true. )then + call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) - btran2(p) = btran2(p) +rootfr(p,j)*s_node + smp_node_lf = max(smpsc(patch%itype(p)), smp_node_lf) + btran2(p) = btran2(p) +rootfr(p,j)*max(0._r8,min((smp_node_lf - smpsc(patch%itype(p))) / & + (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8)) + else + btran2(p) = btran2(p) +rootfr(p,j)*s_node + end if end do end do From 9c8157890f8aec3bc81d0ce25edaef19a128926f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 10 Sep 2020 00:39:56 -0600 Subject: [PATCH 1433/1973] Change clm2 in scripts to clm? with wildcard for version, this still won't handle the ctsm5 compname case --- tools/contrib/SpinupStability.ncl | 4 ++-- tools/contrib/run_clm_historical | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/contrib/SpinupStability.ncl b/tools/contrib/SpinupStability.ncl index 9f0eb30302..e8d0a61ba9 100644 --- a/tools/contrib/SpinupStability.ncl +++ b/tools/contrib/SpinupStability.ncl @@ -81,9 +81,9 @@ begin end if if (annual_hist) then - fls = systemfunc("ls " + data_dir + caseid+".clm2.h0.*-*-*-*"+".nc") + fls = systemfunc("ls " + data_dir + caseid+".clm?.h0.*-*-*-*"+".nc") else - fls = systemfunc("ls " + data_dir + caseid+".clm2.h0.*-*"+".nc") + fls = systemfunc("ls " + data_dir + caseid+".clm?.h0.*-*"+".nc") end if flsdims = dimsizes(fls) diff --git a/tools/contrib/run_clm_historical b/tools/contrib/run_clm_historical index d161f1c43b..cd293d5867 100755 --- a/tools/contrib/run_clm_historical +++ b/tools/contrib/run_clm_historical @@ -125,7 +125,7 @@ while ($DONE_RUNA == 0) set DONE_RUNA = 1 echo '1850-1870 run is complete' while ($DONE_ARCHIVE == 0) - set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + set nh0 = `ls -l $WDIR/*clm?.h0.* | egrep -c '^-'` echo $nh0 if ($nh0 == 1) then set DONE_ARCHIVE = 1 @@ -177,7 +177,7 @@ while ($DONE_RUNA == 0) set DONE_RUNA = 1 echo '1850-1900 run is complete' while ($DONE_ARCHIVE == 0) - set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + set nh0 = `ls -l $WDIR/*clm?.h0.* | egrep -c '^-'` echo $nh0 if ($nh0 == 1) then set DONE_ARCHIVE = 1 @@ -242,7 +242,7 @@ while ($DONE_RUNA == 0) set DONE_RUNA = 1 echo '1901-1989 run is complete' while ($DONE_ARCHIVE == 0) - set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + set nh0 = `ls -l $WDIR/*clm?.h0.* | egrep -c '^-'` echo $nh0 if ($nh0 == 1) then set DONE_ARCHIVE = 1 @@ -295,7 +295,7 @@ while ($DONE_RUNA == 0) set DONE_RUNA = 1 echo '1989-2004 run is complete' while ($DONE_ARCHIVE == 0) - set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + set nh0 = `ls -l $WDIR/*clm?.h0.* | egrep -c '^-'` echo $nh0 if ($nh0 == 1) then set DONE_ARCHIVE = 1 @@ -349,7 +349,7 @@ while ($DONE_RUNA == 0) set DONE_RUNA = 1 echo '2005-2014 run is complete' while ($DONE_ARCHIVE == 0) - set nh0 = `ls -l $WDIR/*clm2.h0.* | egrep -c '^-'` + set nh0 = `ls -l $WDIR/*clm?.h0.* | egrep -c '^-'` echo $nh0 if ($nh0 == 1) then set DONE_ARCHIVE = 1 From df66cc2dda2568bf9707b135bc2759dd9712275a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 10 Sep 2020 15:58:19 -0600 Subject: [PATCH 1434/1973] Add --project argument to LILAC's create_newcase command This isn't needed by anything in the LILAC workflow, but cime requires it on machines that expect PROJECT to be set. --- python/ctsm/lilac_build_ctsm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index b13baeba87..ad52f0b2d8 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -606,6 +606,9 @@ def _create_case(cime_path, build_dir, compiler, '--res', _RES, '--compiler', compiler, '--driver', 'nuopc', + # Project isn't used for anything in the LILAC workflow, but it + # still needs to be specified on machines that expect it. + '--project', 'UNSET', '--run-unsupported'] create_newcase_cmd.extend(machine_args) if inputdata_path: From 9287dc7a46edb64c3244b71f9bf523feb5249881 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 13 Sep 2020 13:47:51 -0600 Subject: [PATCH 1435/1973] LILACSMOKE: Call case.load_env() before building the atm driver This is needed for the atm driver build to use the correct module environment --- cime_config/SystemTests/lilacsmoke.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index ed4624ff57..2a566feb60 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -111,6 +111,12 @@ def _build_atm_driver(self): debug=str(self._case.get_value('DEBUG')).upper(), ctsm_mkfile=os.path.join(caseroot, 'lilac_build', 'ctsm.mk')) makecmd = 'make {makevars} atm_driver'.format(makevars=makevars) + + # Normally the user will source either ctsm_build_environment.sh or + # ctsm_build_environment.csh before building the atmosphere model. In the context + # of this test case, case.load_env does the equivalent. + self._case.load_env() + self._run_build_cmd(makecmd, blddir, 'atm_driver.bldlog') def _create_link_to_atm_driver(self): From 385cb62457bb74f2c30822dd84ad6b7d8d60d649 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Sep 2020 11:36:51 -0600 Subject: [PATCH 1436/1973] Change ctsm5_1 version to clm5_1 --- bld/CLMBuildNamelist.pm | 2 +- bld/config_files/clm_phys_vers.pm | 4 +- bld/config_files/config_definition_ctsm.xml | 4 +- bld/listDefaultNamelist.pl | 2 +- bld/namelist_files/namelist_defaults_ctsm.xml | 216 +++++++++--------- .../namelist_defaults_drydep.xml | 2 +- .../namelist_defaults_overall.xml | 8 +- .../namelist_definition_ctsm.xml | 4 +- bld/namelist_files/use_cases/1850_control.xml | 18 +- .../use_cases/1850_noanthro_control.xml | 14 +- bld/namelist_files/use_cases/2000_control.xml | 16 +- bld/namelist_files/use_cases/2010_control.xml | 18 +- .../use_cases/20thC_transient.xml | 22 +- bld/namelist_files/use_cases/stdurbpt_pd.xml | 4 +- bld/unit_testers/build-namelist_test.pl | 12 +- cime_config/buildnml | 4 +- cime_config/config_component.xml | 18 +- cime_config/config_compsets.xml | 4 +- 18 files changed, 186 insertions(+), 186 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 91944d7f77..dbdc02c97b 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3395,7 +3395,7 @@ sub setup_logic_megan { #------------------------------------------------------------------------------- sub setup_logic_soilm_streams { - # prescribed soil moisture streams require clm4_5/clm5_0/ctsm5_1 + # prescribed soil moisture streams require clm4_5/clm5_0/clm5_1 my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_soil_moisture_streams'); diff --git a/bld/config_files/clm_phys_vers.pm b/bld/config_files/clm_phys_vers.pm index c6797f74cd..3e4de9c610 100755 --- a/bld/config_files/clm_phys_vers.pm +++ b/bld/config_files/clm_phys_vers.pm @@ -28,7 +28,7 @@ use bigint; #use warnings; #use diagnostics; -my @version_strings = ("clm4_5", "clm5_0", "ctsm5_1"); +my @version_strings = ("clm4_5", "clm5_0", "clm5_1"); #------------------------------------------------------------------------------- @@ -88,7 +88,7 @@ if ( ! defined(caller) && $#ARGV == -1 ) { sub testit { print "unit tester\n"; my %lastv; - my @vers_list = ( "clm4_5", "clm5_0", "ctsm5_1" ); + my @vers_list = ( "clm4_5", "clm5_0", "clm5_1" ); foreach my $vers ( @vers_list ) { my $phys = config_files::clm_phys_vers->new($vers); isa_ok($phys, "config_files::clm_phys_vers", "created clm_phys_vers object"); diff --git a/bld/config_files/config_definition_ctsm.xml b/bld/config_files/config_definition_ctsm.xml index 4f35249039..06263c6d19 100644 --- a/bld/config_files/config_definition_ctsm.xml +++ b/bld/config_files/config_definition_ctsm.xml @@ -5,10 +5,10 @@ -Specifies either clm4_5, clm5_0, or ctsm5_1 physics +Specifies either clm4_5, clm5_0, or clm5_1 physics -Specifies clm physics +Specifies clm physics EOF $fh->close(); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 4f936d350d..aeed195956 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -36,10 +36,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). clm4_5_CRUv7 clm5_0_cam6.0 -ctsm5_1_GSWP3v1 +clm5_1_GSWP3v1 -ctsm5 +clm5 clm5 clm4 @@ -47,11 +47,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case). off -2 +2 2 1 -2 -2 +2 +2 2 2 1 @@ -71,29 +71,29 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 20 -.false. +.false. .false. .false. -.true. +.true. .true. .false. -2 +2 2 1 0 -.true. +.true. .true. .false. -Medlyn2011 -Ball-Berry1987 +Medlyn2011 +Ball-Berry1987 Medlyn2011 Ball-Berry1987 Ball-Berry1987 @@ -116,8 +116,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP5B_3x1_global_1850-2100_yearly_c181209.nc -.true. -.false. +.true. +.false. .true. .false. .false. @@ -139,20 +139,20 @@ attributes from the config_cache.xml file (with keys converted to upper-case). NONE -0.50,0.30 +0.50,0.30 0.50,0.30 0.60,0.40 -ON_WASTEHEAT +ON_WASTEHEAT ON_WASTEHEAT ON -1 +1 1 0 -FAST +FAST FAST NONE @@ -160,18 +160,18 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. -.true. +.true. .true. .false. 4SL_2m -20SL_8.5m +20SL_8.5m 20SL_8.5m 10SL_3.5m -.false. -.false. -.true. +.false. +.false. +.true. .false. .false. .true. @@ -179,22 +179,22 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -1 +1 1 0 -1 +1 1 1 -1 +1 1 0 -1.d-2 -0.001d00 +1.d-2 +0.001d00 1.d-2 0.001d00 1.d-2 @@ -203,10 +203,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 2.0d00 0.5d00 -0.5d00 +0.5d00 -.true. +.true. .true. .false. @@ -234,16 +234,16 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -2. 0. --2. -0. +-2. +0. .false. .true. -.true. +.true. -li2021gswpfrc +li2021gswpfrc li2016crufrc li2014qianfrc @@ -300,7 +300,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.5d00, 0.28d00 -.false. +.false. .false. .true. @@ -308,9 +308,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 3 -.true. -1.0 -0.05 +.true. +1.0 +0.05 .true. 1.0 @@ -323,11 +323,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0 1 -1 +1 1 1 -1 +1 4 2 @@ -348,13 +348,13 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 14400 -3400. 0.6 -1.0 +1.0 1.0 0.5 0.1 -.false. +.false. .false. .false. @@ -366,16 +366,16 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .true. -12 -5 +12 +5 12 5 5 -10000.0 -5000.0 +10000.0 +5000.0 10000.0 5000.0 1000.0 @@ -387,34 +387,34 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.02d00 0.05d00 -2000. +2000. 2000. 1.e30 -10.0d00 +10.0d00 10.0d00 10.0 -.true. +.true. .true. .false. -'Vionnet2012' +'Vionnet2012' 'Vionnet2012' 'Anderson1976' -'Slater2017' +'Slater2017' 'Slater2017' 'TruncatedAnderson1976' 100.d00 175.d00 -175.d00 +175.d00 54.526d00 204.526d00 -204.526d00 +204.526d00 0.08d00 @@ -454,7 +454,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). simplicity, we tie the defaults for both of these options to the overall CLM phys version, rather than having some intermediate option that controls the defaults for both h2osno_max and glc_snow_persistence_max_days. --> -0 +0 0 7300 @@ -462,7 +462,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c200905.nc +lnd/clm2/paramdata/ctsm51_params.c200905.nc lnd/clm2/paramdata/clm50_params.c200905.nc lnd/clm2/paramdata/clm45_params.c200905.nc @@ -475,15 +475,15 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -.true. -.false. +.true. +.false. .true. .false. .false. -.true. -.false. +.true. +.false. .true. .false. .false. @@ -515,26 +515,26 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .true. .true. -.true. +.true. -0.17 +0.17 0.17 .false. .false. .true. -.true. +.true. constant varytropicsbylat 12.0d00 0.4d00 -varytropicsbylat -12.0d00 -0.4d00 +varytropicsbylat +12.0d00 +0.4d00 -3.d00 +3.d00 3.d00 1.d00 @@ -542,12 +542,12 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.5 10.0 -10.0 +10.0 .false. .true. -.true. +.true. .true. @@ -558,20 +558,20 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .false. .false. -.false. +.false. .false. .false. .true. -.false. -.true. +.false. +.true. -1.d-9 +1.d-9 1.d-9 1.d-8 --6.d+1 --6.d+0 +-6.d+1 +-6.d+0 -6.d+1 -6.d+0 -6.d+2 @@ -580,7 +580,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .true. -.true. +.true. .true. @@ -682,11 +682,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -hgrid=0.9x1.25 maxpft=17 mask=gx1v7 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 @@ -706,7 +706,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 -hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 @@ -881,13 +881,13 @@ p lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v7_simyr1850_c200806.nc lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc @@ -922,7 +922,7 @@ p lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc @@ -1387,36 +1387,36 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts use_crop=".false." >lnd/clm2/surfdata_map/release-clm5.0.18/landuse.timeseries_10x15_SSP5-3.4_16pfts_Irrig_CMIP6_simyr1850-2100_c190228.nc -.true. +.true. .true. .false. 0.83d-06 -0.015d00 +0.015d00 0.015d00 0.015d00 20.0d00, 20.0d00, 20.0d00 200.0d00, 200.0d00, 200.0d00 -200.0d00, 200.0d00, 200.0d00 +200.0d00, 200.0d00, 200.0d00 20.0d00, 20.0d00, 20.0d00 200.0d00, 200.0d00, 200.0d00 -200.0d00, 200.0d00, 200.0d00 +200.0d00, 200.0d00, 200.0d00 -1.50d00 +1.50d00 1.50d00 0.3 -1.50d00 +1.50d00 1.50d00 0.3 -100.d00 +100.d00 100.d00 20.d00 -1.d00 +1.d00 1.d00 1.d00 @@ -1434,9 +1434,9 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 2101 2015 -2015 -2101 -2015 +2015 +2101 +2015 2010 2010 @@ -1456,18 +1456,18 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 2000 2000 -lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc +lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP5-8.5-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP1-2.6-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP2-4.5-WACCM_1849-2101_monthly_c191007.nc -lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP3-7.0-WACCM_1849-2101_monthly_c191007.nc lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP3-7.0-WACCM_1849-2101_monthly_c191007.nc -cycle -NDEP_month -limit +cycle +NDEP_month +limit cycle NDEP_month @@ -1564,7 +1564,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts none 94x192 94x192 -360x720 +360x720 0001 0001 @@ -1591,9 +1591,9 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 2100 2015 -2015 -2100 -2015 +2015 +2100 +2015 2010 2010 @@ -1642,9 +1642,9 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts nn -2015 -2106 -2015 +2015 +2106 +2015 2015 2106 @@ -1672,7 +1672,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 1850 2106 -lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc -TWS_inversion +TWS_inversion TWS_inversion ZWT_inversion .true. diff --git a/bld/namelist_files/namelist_defaults_drydep.xml b/bld/namelist_files/namelist_defaults_drydep.xml index d7ada820c3..25094e4ea8 100644 --- a/bld/namelist_files/namelist_defaults_drydep.xml +++ b/bld/namelist_files/namelist_defaults_drydep.xml @@ -23,7 +23,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 'ISOP = isoprene', 'C10H16 = pinene_a + carene_3 + thujene_a', 'CH3OH = methanol', 'C2H5OH = ethanol', 'CH2O = formaldehyde', 'CH3CHO = acetaldehyde', 'CH3COOH = acetic_acid', 'CH3COCH3 = acetone' -atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc +atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index 0b6e97a932..52386b9944 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -22,17 +22,17 @@ determine default values for namelists. --> -arb_ic +arb_ic arb_ic arb_ic arb_ic -arb_ic +arb_ic arb_ic startup -startup +startup startup startup -startup +startup startup arb_ic arb_ic diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 48b916cab4..04297f1779 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -54,7 +54,7 @@ Full pathname of master restart file for a branch run. (only used if RUN_TYPE=br category="datasets" group="clm_inparm" value="clm2" - valid_values="clm2,clm4,clm5,ctsm5" > + valid_values="clm2,clm4,clm5" > Component name to use in history and restart files @@ -1981,7 +1981,7 @@ Land mask description + valid_values="clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_0_cam6.0,clm5_0_CRUv7,clm5_0_GSWP3v1,clm5_1_GSWP3v1"> General configuration of model version and atmospheric forcing to tune the model to run under. This sets the model to run with constants and initial conditions that were set to run well under the configuration of model version and atmospheric forcing. To run well constants would need to be changed diff --git a/bld/namelist_files/use_cases/1850_control.xml b/bld/namelist_files/use_cases/1850_control.xml index 5cd4a6f973..94ee8c5d0d 100644 --- a/bld/namelist_files/use_cases/1850_control.xml +++ b/bld/namelist_files/use_cases/1850_control.xml @@ -8,7 +8,7 @@ constant -.false. +.false. .false. .false. @@ -18,8 +18,8 @@ 1850 1850 -1850 -1850 +1850 +1850 1850 1850 @@ -27,8 +27,8 @@ 1850 1850 -1850 -1850 +1850 +1850 1850 1850 @@ -36,10 +36,10 @@ 1850 1850 -1850 -1850 +1850 +1850 -lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc cycle -cycle +cycle diff --git a/bld/namelist_files/use_cases/1850_noanthro_control.xml b/bld/namelist_files/use_cases/1850_noanthro_control.xml index 861c192ed7..c998d97608 100644 --- a/bld/namelist_files/use_cases/1850_noanthro_control.xml +++ b/bld/namelist_files/use_cases/1850_noanthro_control.xml @@ -16,11 +16,11 @@ 1850 1850 -1850 -1850 +1850 +1850 cycle -cycle +cycle 1925 1925 @@ -28,16 +28,16 @@ 1925 1925 -1925 -1925 +1925 +1925 lnd/clm2/firedata/clmforc.no_anthro_zero_hdm_1x1_simyr1925_181113.nc nn -1850 -1850 +1850 +1850 1850 1850 diff --git a/bld/namelist_files/use_cases/2000_control.xml b/bld/namelist_files/use_cases/2000_control.xml index abd116a82f..f3c4980fc8 100644 --- a/bld/namelist_files/use_cases/2000_control.xml +++ b/bld/namelist_files/use_cases/2000_control.xml @@ -8,8 +8,8 @@ constant -.true. -.false. +.true. +.false. .true. .false. .false. @@ -20,8 +20,8 @@ 2000 2000 -2000 -2000 +2000 +2000 2000 2000 @@ -29,8 +29,8 @@ 2000 2000 -2000 -2000 +2000 +2000 2000 2000 @@ -38,7 +38,7 @@ 2000 2000 -2000 -2000 +2000 +2000 diff --git a/bld/namelist_files/use_cases/2010_control.xml b/bld/namelist_files/use_cases/2010_control.xml index 8c7ea36ef7..9316ecfb7f 100644 --- a/bld/namelist_files/use_cases/2010_control.xml +++ b/bld/namelist_files/use_cases/2010_control.xml @@ -8,9 +8,9 @@ constant -.true. -.true. -.false. +.true. +.true. +.false. .true. .false. .false. @@ -27,8 +27,8 @@ 2010 2010 -2010 -2010 +2010 +2010 2010 2010 @@ -36,11 +36,11 @@ 2010 2010 -2010 -2010 +2010 +2010 -2010 -2010 +2010 +2010 2010 2010 diff --git a/bld/namelist_files/use_cases/20thC_transient.xml b/bld/namelist_files/use_cases/20thC_transient.xml index ecd46f471b..faf0534f34 100644 --- a/bld/namelist_files/use_cases/20thC_transient.xml +++ b/bld/namelist_files/use_cases/20thC_transient.xml @@ -14,8 +14,8 @@ flanduse_timeseries -.true. -.false. +.true. +.false. .true. .false. .false. @@ -28,9 +28,9 @@ 2015 1850 -1850 -2015 -1850 +1850 +2015 +1850 1850 2016 @@ -40,9 +40,9 @@ 2016 1850 -1850 -2016 -1850 +1850 +2016 +1850 1850 2106 @@ -52,8 +52,8 @@ 2106 1850 -1850 -2106 -1850 +1850 +2106 +1850 diff --git a/bld/namelist_files/use_cases/stdurbpt_pd.xml b/bld/namelist_files/use_cases/stdurbpt_pd.xml index 5b90241196..ab1da63bcf 100644 --- a/bld/namelist_files/use_cases/stdurbpt_pd.xml +++ b/bld/namelist_files/use_cases/stdurbpt_pd.xml @@ -18,8 +18,8 @@ 'OFF' -.true. -.false. +.true. +.false. .true. .false. .false. diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 48683ab1ec..078ea65f22 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -78,7 +78,7 @@ sub make_config_cache { -Specifies clm physics +Specifies clm physics EOF $fh->close(); @@ -1079,7 +1079,7 @@ sub make_config_cache { # # Loop over all physics versions # -foreach my $phys ( "clm4_5", "clm5_0", "ctsm5_1" ) { +foreach my $phys ( "clm4_5", "clm5_0", "clm5_1" ) { $mode = "-phys $phys"; &make_config_cache($phys); @@ -1355,10 +1355,10 @@ sub make_config_cache { } print "\n==================================================\n"; -print "Test clm4.5/clm5.0/ctsm5_1 resolutions \n"; +print "Test clm4.5/clm5.0/clm5_1 resolutions \n"; print "==================================================\n"; -foreach my $phys ( "clm4_5", 'clm5_0', 'ctsm5_1' ) { +foreach my $phys ( "clm4_5", 'clm5_0', 'clm5_1' ) { my $mode = "-phys $phys"; &make_config_cache($phys); my @clmoptions = ( "-bgc bgc -envxml_dir .", "-bgc bgc -envxml_dir . -clm_accelerated_spinup=on", "-bgc bgc -envxml_dir . -light_res 360x720", @@ -1450,11 +1450,11 @@ sub make_config_cache { my $res = "0.9x1.25"; my $mask = "gx1v6"; my $simyr = "1850"; -foreach my $phys ( "clm4_5", 'clm5_0', 'ctsm5_1' ) { +foreach my $phys ( "clm4_5", 'clm5_0', 'clm5_1' ) { my $mode = "-phys $phys"; &make_config_cache($phys); my @forclist = (); - if ( $phys == "ctsm5_1" ) { + if ( $phys == "clm5_1" ) { @forclist = ( "GSWP3v1" ); } else { @forclist = ( "CRUv7", "GSWP3v1", "cam6.0" ); diff --git a/cime_config/buildnml b/cime_config/buildnml index ddd6cade0f..50beea281b 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -23,7 +23,7 @@ _config_cache_template = """ -Specifies CTSM physics +Specifies CTSM physics """ @@ -188,7 +188,7 @@ def buildnml(case, caseroot, compname): # ----------------------------------------------------- if run_type == "hybrid" or run_type == "branch": - compnames = [ "clm4", "clm5", "ctsm5", "clm2" ] + compnames = [ "clm4", "clm5", "clm2" ] for comp in compnames: clm_startfile = "%s.%s%s.r.%s-%s.nc"%(run_refcase,comp,inst_string,run_refdate,run_reftod) if os.path.exists(os.path.join(rundir, clm_startfile)): diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index f98199bcdc..51f8e4bd96 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -16,7 +16,7 @@ clm4.5: clm5.0: - ctsm5.1: + clm5.1: Satellite phenology: CN: Carbon Nitrogen model CNDV: CN with Dynamic Vegetation (deprecated) @@ -66,7 +66,7 @@ Tuning parameters and initial conditions should be optimized for what CLM model version and what meteorlogical forcing combination? UNSET - clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,ctsm5_1_GSWP3v1 + clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_1_GSWP3v1 clm4_5_CRUv7 clm4_5_CRUv7 @@ -76,13 +76,13 @@ clm5_0_CRUv7 clm5_0_GSWP3v1 clm5_0_cam6.0 - ctsm5_1_GSWP3v1 + clm5_1_GSWP3v1 char - clm4_5,clm5_0,ctsm5_1 + clm4_5,clm5_0,clm5_1 -clm5 -clm5 -clm4 +clm2 +clm2 +clm2 off From ffa7377583860ecdedbc74c8bfd108bc71932978 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Sep 2020 13:30:08 -0600 Subject: [PATCH 1438/1973] Have a copy of btran2 that's just inside CNFire --- src/biogeochem/CNFireBaseMod.F90 | 115 +++++++++++++++++++++++++- src/biogeochem/CNVegetationFacade.F90 | 2 + src/main/FireDataBaseType.F90 | 7 +- src/main/FireMethodType.F90 | 47 ++++++++++- src/main/clm_driver.F90 | 5 ++ 5 files changed, 168 insertions(+), 8 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 971b2eaba9..03d7fefef6 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -74,14 +74,18 @@ module CNFireBaseMod type, abstract, extends(fire_base_type) :: cnfire_base_type private ! !PRIVATE MEMBER DATA: + real(r8), pointer :: btran2_patch (:) ! patch root zone soil wetness factor (0 to 1) contains ! ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: FireReadNML ! Read in namelist for CNFire - procedure, public :: CNFireReadParams ! Read in constant parameters from the paramsfile - procedure, public :: CNFireArea ! Calculate fire area - procedure, public :: CNFireFluxes ! Calculate fire fluxes + procedure, public :: FireInit => CNFireInit ! Initialization of Fire + procedure, public :: FireReadNML ! Read in namelist for CNFire + procedure, public :: CNFireRestart ! Restart for CNFire + procedure, public :: CNFireReadParams ! Read in constant parameters from the paramsfile + procedure, public :: CNFireArea ! Calculate fire area + procedure, public :: CNFireFluxes ! Calculate fire fluxes + procedure, public :: CNFire_calc_fire_root_wetness ! Calcualte CN-fire specific root wetness ! end type cnfire_base_type !----------------------------------------------------------------------- @@ -112,6 +116,109 @@ end function need_lightning_and_popdens_interface contains !----------------------------------------------------------------------- + subroutine CNFireInit( this, bounds, NLFilename ) + ! + ! !DESCRIPTION: + ! Initialize CN Fire module + ! !USES: + use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) + use clm_varcon , only : spval + use histFileMod , only : hist_addfld1d + ! + ! !ARGUMENTS: + class(cnfire_base_type) :: this + type(bounds_type), intent(in) :: bounds + character(len=*), intent(in) :: NLFilename + !----------------------------------------------------------------------- + integer :: begp, endp + !------------------------------------------------------------------------ + ! Call the base-class Initialization method + call this%BaseFireInit( bounds, NLFilename ) + + begp = bounds%begp; endp= bounds%endp + + ! Allocate memory + allocate(this%btran2_patch (begp:endp)) ; this%btran2_patch (:) = nan + ! History file + this%btran2_patch(begp:endp) = spval + call hist_addfld1d(fname='BTRAN2', units='unitless', & + avgflag='A', long_name='root zone soil wetness factor', & + ptr_patch=this%btran2_patch, l2g_scale_type='veg') + end subroutine CNFireInit + + !---------------------------------------------------------------------- + subroutine CNFireRestart( this, bounds, ncid, flag ) + use ncdio_pio , only : ncd_double, file_desc_t + use restUtilMod , only : restartvar + implicit none + ! + ! !ARGUMENTS: + class(cnfire_base_type) :: this + type(bounds_type), intent(in) :: bounds + type(file_desc_t), intent(inout) :: ncid + character(len=*) , intent(in) :: flag + + logical :: readvar + + call restartvar(ncid=ncid, flag=flag, varname='btran2', xtype=ncd_double, & + dim1name='pft', & + long_name='', units='', & + interpinic_flag='interp', readvar=readvar, data=this%btran2_patch) + end subroutine CNFireRestart + + !---------------------------------------------------------------------- + subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedvegp, filter_exposedvegp, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) + use pftconMod , only : pftcon + use PatchType , only : patch + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type + class(cnfire_base_type) :: this + type(bounds_type) , intent(in) :: bounds !bounds + integer , intent(in) :: nlevgrnd !number of vertical layers + integer , intent(in) :: num_exposedvegp !number of filters + integer , intent(in) :: filter_exposedvegp(:) !filter array + type(waterstatebulk_type), intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve + + real(r8), parameter :: btran0 = 0.0_r8 ! initial value + real(r8) :: smp_node, s_node !temporary variables + real(r8) :: smp_node_lf !temporary variable + integer :: p, f, j, c, l !indices + + associate( & + smpso => pftcon%smpso , & ! Input: soil water potential at full stomatal opening (mm) + smpsc => pftcon%smpsc , & ! Input: soil water potential at full stomatal closure (mm) + watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation + btran2 => this%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square + rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) + ) + do f = 1, num_exposedvegp + p = filter_exposedvegp(f) + btran2(p) = btran0 + end do + do j = 1,nlevgrnd + do f = 1, num_exposedvegp + p = filter_exposedvegp(f) + c = patch%column(p) + l = patch%landunit(p) + s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) + + call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) + + smp_node_lf = max(smpsc(patch%itype(p)), smp_node_lf) + btran2(p) = btran2(p) +rootfr(p,j)*max(0._r8,min((smp_node_lf - smpsc(patch%itype(p))) / & + (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8)) + end do + end do + end associate + + end subroutine CNFire_calc_fire_root_wetness + + !---------------------------------------------------------------------- subroutine FireReadNML( this, NLFilename ) ! ! !DESCRIPTION: diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 341c376972..196817b3cc 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -506,6 +506,8 @@ subroutine Restart(this, bounds, ncid, flag) end if call this%n_products_inst%restart(bounds, ncid, flag) + call this%cnfire_method%CNFireRestart(bounds, ncid, flag) + end if if (use_cndv) then diff --git a/src/main/FireDataBaseType.F90 b/src/main/FireDataBaseType.F90 index be9325d798..5f3edc529b 100644 --- a/src/main/FireDataBaseType.F90 +++ b/src/main/FireDataBaseType.F90 @@ -42,7 +42,8 @@ module FireDataBaseType contains ! ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: FireInit ! Initialization of Fire + procedure, public :: FireInit => BaseFireInit ! Initialization of Fire + procedure, public :: BaseFireInit ! Initialization of Fire procedure(FireReadNML_interface), public, deferred :: FireReadNML ! Read in namelist for Fire procedure, public :: FireInterp ! Interpolate fire data procedure(need_lightning_and_popdens_interface), public, deferred :: & @@ -92,7 +93,7 @@ subroutine FireReadNML_interface( this, NLFilename ) end subroutine FireReadNML_interface !----------------------------------------------------------------------- - subroutine FireInit( this, bounds, NLFilename ) + subroutine BaseFireInit( this, bounds, NLFilename ) ! ! !DESCRIPTION: ! Initialize CN Fire module @@ -119,7 +120,7 @@ subroutine FireInit( this, bounds, NLFilename ) call this%lnfm_interp(bounds) end if - end subroutine FireInit + end subroutine BaseFireInit !----------------------------------------------------------------------- subroutine FireInterp(this,bounds) diff --git a/src/main/FireMethodType.F90 b/src/main/FireMethodType.F90 index 314ee1ceca..eea2ddce69 100644 --- a/src/main/FireMethodType.F90 +++ b/src/main/FireMethodType.F90 @@ -25,6 +25,9 @@ module FireMethodType ! Read parameters for the fire datasets procedure(CNFireReadParams_interface), public, deferred :: CNFireReadParams + ! Restart + procedure(CNFireRestart_interface), public, deferred :: CNFireRestart + ! Interpolate the fire datasets procedure(FireInterp_interface) , public, deferred :: FireInterp @@ -34,6 +37,9 @@ module FireMethodType ! Figure out the fire fluxes procedure(CNFireFluxes_interface) , public, deferred :: CNFireFluxes + ! Calculate root wetness for the CN Fire + procedure(CNFire_calc_fire_root_wetness_interface) , public, deferred :: CNFire_calc_fire_root_wetness + end type fire_method_type abstract interface @@ -113,6 +119,24 @@ subroutine CNFireReadParams_interface( this, ncid ) end subroutine CNFireReadParams_interface + !----------------------------------------------------------------------- + subroutine CNFireRestart_interface( this, bounds, ncid, flag ) + ! + ! Restart for the CN fire base class + ! !USES: + use ncdio_pio , only : file_desc_t + use decompMod , only : bounds_type + import :: fire_method_type + ! + ! !ARGUMENTS: + class(fire_method_type) :: this + type(bounds_type), intent(in) :: bounds + type(file_desc_t), intent(inout) :: ncid + character(len=*) , intent(in) :: flag + !-------------------------------------------------------------------- + + end subroutine CNFireRestart_interface + !----------------------------------------------------------------------- subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & @@ -206,7 +230,28 @@ subroutine CNFireFluxes_interface (this, bounds, num_soilc, filter_soilc, num_so !----------------------------------------------------------------------- end subroutine CNFireFluxes_interface - !----------------------------------------------------------------------- + !----------------------------------------------------------------------- + + !---------------------------------------------------------------------- + subroutine CNFire_calc_fire_root_wetness_interface( this, bounds, nlevgrnd, num_exposedvegp, & + filter_exposedvegp, waterstatebulk_inst, & + soilstate_inst, soil_water_retention_curve ) + ! Calculate root wetness that will be used for the CN fire model + use decompMod , only : bounds_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type + import :: fire_method_type + class(fire_method_type) :: this + type(bounds_type) , intent(in) :: bounds !bounds + integer , intent(in) :: nlevgrnd !number of vertical layers + integer , intent(in) :: num_exposedvegp !number of filters + integer , intent(in) :: filter_exposedvegp(:) !filter array + type(waterstatebulk_type), intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve + !----------------------------------------------------------------------- + end subroutine CNFire_calc_fire_root_wetness_interface end interface diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index f06c49bc12..0e6736bb40 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -667,6 +667,11 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro croot_carbon = bgc_vegetation_inst%get_croot_carbon_patch( & bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp)) + call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds_clump, nlevgrnd, & + filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & + water_inst%waterstatebulk_inst, soilstate_inst, & + soil_water_retention_curve ) + call CanopyFluxes(bounds_clump, & filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & clm_fates,nc, & From 1316ad3b7a3a0946384a68dee7e77fb7916d0819 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Sep 2020 13:33:43 -0600 Subject: [PATCH 1439/1973] Remove add of btran2 on fire to history file, until we remove the original version --- src/biogeochem/CNFireBaseMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 03d7fefef6..ff152167c8 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -141,9 +141,9 @@ subroutine CNFireInit( this, bounds, NLFilename ) allocate(this%btran2_patch (begp:endp)) ; this%btran2_patch (:) = nan ! History file this%btran2_patch(begp:endp) = spval - call hist_addfld1d(fname='BTRAN2', units='unitless', & - avgflag='A', long_name='root zone soil wetness factor', & - ptr_patch=this%btran2_patch, l2g_scale_type='veg') + !call hist_addfld1d(fname='BTRAN2', units='unitless', & + !avgflag='A', long_name='root zone soil wetness factor', & + !ptr_patch=this%btran2_patch, l2g_scale_type='veg') end subroutine CNFireInit !---------------------------------------------------------------------- From 2d8e368174cb5a58c88496c912e03c4f487d8cba Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Sep 2020 15:32:51 -0600 Subject: [PATCH 1440/1973] Move btran2 calc in cnfire to after CanopyFluxes, as answers are different for BTRAN2 and BTRAN2FIRE, but that's still the case, so the BTRAN2FIRE calculation needs to be inside CanopyFluxes --- src/main/clm_driver.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 0e6736bb40..7f2ff87cfd 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -667,11 +667,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro croot_carbon = bgc_vegetation_inst%get_croot_carbon_patch( & bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp)) - call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds_clump, nlevgrnd, & - filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & - water_inst%waterstatebulk_inst, soilstate_inst, & - soil_water_retention_curve ) - call CanopyFluxes(bounds_clump, & filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & clm_fates,nc, & @@ -688,6 +683,11 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro deallocate(downreg_patch, leafn_patch, froot_carbon, croot_carbon) call t_stopf('canflux') + call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds_clump, nlevgrnd, & + filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & + water_inst%waterstatebulk_inst, soilstate_inst, & + soil_water_retention_curve ) + ! Fluxes for all urban landunits call t_startf('uflux') From 8dd1638b9c23ae0a4340e017d94642119adf5541 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Sep 2020 15:33:35 -0600 Subject: [PATCH 1441/1973] Change name of btran2 inside of fire for restart and history output so can output in addition to the standard one --- src/biogeochem/CNFireBaseMod.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index ff152167c8..ae667d32b7 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -141,9 +141,9 @@ subroutine CNFireInit( this, bounds, NLFilename ) allocate(this%btran2_patch (begp:endp)) ; this%btran2_patch (:) = nan ! History file this%btran2_patch(begp:endp) = spval - !call hist_addfld1d(fname='BTRAN2', units='unitless', & - !avgflag='A', long_name='root zone soil wetness factor', & - !ptr_patch=this%btran2_patch, l2g_scale_type='veg') + call hist_addfld1d(fname='BTRAN2FIRE', units='unitless', & + avgflag='A', long_name='root zone soil wetness factor', & + ptr_patch=this%btran2_patch, l2g_scale_type='veg') end subroutine CNFireInit !---------------------------------------------------------------------- @@ -160,7 +160,7 @@ subroutine CNFireRestart( this, bounds, ncid, flag ) logical :: readvar - call restartvar(ncid=ncid, flag=flag, varname='btran2', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='btran2fire', xtype=ncd_double, & dim1name='pft', & long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%btran2_patch) From 9540e830e462bfa0e45346cd9488acb08fbf7abb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 16 Sep 2020 01:16:05 -0600 Subject: [PATCH 1442/1973] Put calc_fire_root_moist call down into place in soilMoistStress where it's being set --- src/biogeophys/CanopyFluxesMod.F90 | 9 ++++++--- src/biogeophys/SoilMoistStressMod.F90 | 17 ++++++++++++++--- src/main/clm_driver.F90 | 8 ++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 2e10512683..6a009f4f73 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -190,7 +190,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, ch4_inst, ozone_inst, & photosyns_inst, & humanindex_inst, soil_water_retention_curve, & - downreg_patch, leafn_patch, froot_carbon, croot_carbon) + downreg_patch, leafn_patch, froot_carbon, croot_carbon, & + bgc_vegetation_inst) ! ! !DESCRIPTION: ! 1. Calculates the leaf temperature: @@ -233,6 +234,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, swbgt, hmdex, dis_coi, dis_coiS, THIndex, & SwampCoolEff, KtoC, VaporPres use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type + use CNVegetationFacade , only : cn_vegetation_type ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -262,6 +264,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8), intent(in) :: leafn_patch(bounds%begp:) ! leaf N (gN/m2) real(r8), intent(inout) :: froot_carbon(bounds%begp:) ! fine root biomass (gC/m2) real(r8), intent(inout) :: croot_carbon(bounds%begp:) ! live coarse root biomass (gC/m2) + type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: real(r8), pointer :: bsun(:) ! sunlit canopy transpiration wetness factor (0 to 1) @@ -706,8 +709,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, temperature_inst=temperature_inst, & waterstatebulk_inst=waterstatebulk_inst, & waterdiagnosticbulk_inst=waterdiagnosticbulk_inst, & - soil_water_retention_curve=soil_water_retention_curve) - + soil_water_retention_curve=soil_water_retention_curve, & + bgc_vegetation_inst=bgc_vegetation_inst) end if diff --git a/src/biogeophys/SoilMoistStressMod.F90 b/src/biogeophys/SoilMoistStressMod.F90 index 4f8112b611..2d394c8735 100644 --- a/src/biogeophys/SoilMoistStressMod.F90 +++ b/src/biogeophys/SoilMoistStressMod.F90 @@ -312,7 +312,8 @@ end subroutine normalize_unfrozen_rootfr subroutine calc_root_moist_stress_clm45default(bounds, & nlevgrnd, fn, filterp, rootfr_unf, & temperature_inst, soilstate_inst, energyflux_inst, waterstatebulk_inst, & - waterdiagnosticbulk_inst, soil_water_retention_curve) + waterdiagnosticbulk_inst, soil_water_retention_curve, & + bgc_vegetation_inst ) ! ! DESCRIPTIONS ! compute the root water stress using the default clm45 approach @@ -330,6 +331,7 @@ subroutine calc_root_moist_stress_clm45default(bounds, & use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type use PatchType , only : patch use clm_varctl , only : iulog, use_hydrstress + use CNVegetationFacade , only : cn_vegetation_type ! ! !ARGUMENTS: implicit none @@ -344,6 +346,7 @@ subroutine calc_root_moist_stress_clm45default(bounds, & type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve + type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: real(r8), parameter :: btran0 = 0.0_r8 ! initial value @@ -425,6 +428,10 @@ subroutine calc_root_moist_stress_clm45default(bounds, & end do end do + call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds, nlevgrnd, & + fn, filterp, waterstatebulk_inst, soilstate_inst, & + soil_water_retention_curve ) + ! Normalize root resistances to get layer contribution to ET ! Note that rootr as calculated here is based on the SMS (soil moisture stress) method, ! not the PHS (plant hydraulic stress) method. It is (should) only be used by SoilWaterPlantSinkMod.F90 @@ -447,7 +454,8 @@ end subroutine calc_root_moist_stress_clm45default !-------------------------------------------------------------------------------- subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & active_layer_inst, energyflux_inst, soilstate_inst, temperature_inst, & - waterstatebulk_inst, waterdiagnosticbulk_inst, soil_water_retention_curve) + waterstatebulk_inst, waterdiagnosticbulk_inst, soil_water_retention_curve, & + bgc_vegetation_inst ) ! ! DESCRIPTIONS ! compute the root water stress using different approaches @@ -464,6 +472,7 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type use abortutils , only : endrun + use CNVegetationFacade , only : cn_vegetation_type ! ! !ARGUMENTS: implicit none @@ -478,6 +487,7 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve + type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: integer :: p, f, j, c, l ! indices @@ -515,7 +525,8 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & waterstatebulk_inst=waterstatebulk_inst, & waterdiagnosticbulk_inst=waterdiagnosticbulk_inst, & rootfr_unf=rootfr_unf(bounds%begp:bounds%endp,1:nlevgrnd), & - soil_water_retention_curve=soil_water_retention_curve) + soil_water_retention_curve=soil_water_retention_curve, & + bgc_vegetation_inst=bgc_vegetation_inst ) case default call endrun(subname // ':: a root moisture stress function must be specified!') diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 7f2ff87cfd..51647c105e 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -679,15 +679,11 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro downreg_patch = downreg_patch(bounds_clump%begp:bounds_clump%endp), & leafn_patch = leafn_patch(bounds_clump%begp:bounds_clump%endp), & froot_carbon = froot_carbon(bounds_clump%begp:bounds_clump%endp), & - croot_carbon = croot_carbon(bounds_clump%begp:bounds_clump%endp)) + croot_carbon = croot_carbon(bounds_clump%begp:bounds_clump%endp), & + bgc_vegetation_inst = bgc_vegetation_inst ) deallocate(downreg_patch, leafn_patch, froot_carbon, croot_carbon) call t_stopf('canflux') - call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds_clump, nlevgrnd, & - filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & - water_inst%waterstatebulk_inst, soilstate_inst, & - soil_water_retention_curve ) - ! Fluxes for all urban landunits call t_startf('uflux') From bca9d65ef69fc10bef44204d2cc10c6a3f6ce786 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 17 Sep 2020 12:49:58 -0400 Subject: [PATCH 1443/1973] FATES CNP coupling. Swapped call sequence order between FATES dynamics and FATES specific soil BGC calls. This allows for processing of high frequency history diagnostics before calls to fates dynamics, which will cause havoc on cohorts and their subsequent creation/dissapearance. --- src/main/clm_driver.F90 | 56 +++++++++++++++-------------- src/utils/clmfates_interfaceMod.F90 | 8 ++--- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 090cf3b988..6afb0c0003 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1005,32 +1005,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro if ( use_fates) then - if( is_beg_curr_day() ) then - - ! -------------------------------------------------------------------------- - ! This is the main call to FATES dynamics - ! -------------------------------------------------------------------------- - - if ( masterproc ) then - write(iulog,*) 'clm: calling FATES model ', get_nstep() - end if - - call clm_fates%dynamics_driv( nc, bounds_clump, & - atm2lnd_inst, soilstate_inst, temperature_inst, active_layer_inst, & - water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & - water_inst%wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst, & - frictionvel_inst) - - ! TODO(wjs, 2016-04-01) I think this setFilters call should be replaced by a - ! call to reweight_wrapup, if it's needed at all. - call setFilters( bounds_clump, glc_behavior ) - - end if - - end if ! use_fates branch - - - if ( use_fates ) then call EDBGCDyn(bounds_clump, & filter(nc)%num_soilc, filter(nc)%soilc, & @@ -1058,6 +1032,36 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call clm_fates%wrap_update_hifrq_hist(bounds_clump, & soilbiogeochem_carbonflux_inst, & soilbiogeochem_carbonstate_inst) + + + if( is_beg_curr_day() ) then + + ! -------------------------------------------------------------------------- + ! This is the main call to FATES dynamics + ! -------------------------------------------------------------------------- + + if ( masterproc ) then + write(iulog,*) 'clm: calling FATES model ', get_nstep() + end if + + call clm_fates%dynamics_driv( nc, bounds_clump, & + atm2lnd_inst, soilstate_inst, temperature_inst, active_layer_inst, & + water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & + water_inst%wateratm2lndbulk_inst, canopystate_inst, soilbiogeochem_carbonflux_inst, & + frictionvel_inst) + + ! TODO(wjs, 2016-04-01) I think this setFilters call should be replaced by a + ! call to reweight_wrapup, if it's needed at all. + call setFilters( bounds_clump, glc_behavior ) + + end if + + end if ! use_fates branch + + + if ( use_fates ) then + + end if diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 562a6893a7..d778aa1260 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -136,6 +136,7 @@ module CLMFatesInterfaceMod use FatesPlantRespPhotosynthMod, only : FatesPlantRespPhotosynthDrive use EDAccumulateFluxesMod , only : AccumulateFluxes_ED use FatesSoilBGCFluxMod , only : FluxIntoLitterPools + use FatesSoilBGCFluxMod , only : UnPackNutrientAquisitionBCs use FatesPlantHydraulicsMod, only : hydraulics_drive use FatesPlantHydraulicsMod, only : HydrSiteColdStart use FatesPlantHydraulicsMod, only : InitHydrSites @@ -860,7 +861,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! Nutrient uptake fluxes have been accumulating with each short ! timestep, here, we unload them from the boundary condition ! structures into the cohort structures. - ! call UnPackNutrientAquisitionBCs(this%fates(nc)%sites, this%fates(nc)%bc_in) + call UnPackNutrientAquisitionBCs(this%fates(nc)%sites, this%fates(nc)%bc_in) ! --------------------------------------------------------------------------------- @@ -877,7 +878,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & call ed_update_site(this%fates(nc)%sites(s), & this%fates(nc)%bc_in(s), & this%fates(nc)%bc_out(s)) - + enddo ! --------------------------------------------------------------------------------- @@ -2140,9 +2141,6 @@ subroutine wrap_update_hifrq_hist(this, bounds_clump, & this%fates(nc)%bc_in(s)%tot_litc = totlitc(c) end do - - print*,"LSM BGC rates: ",hr(c),totsomc(c),totlitc(c) - dtime = get_step_size_real() ! Update history variables that track these variables From a71f73d5dc08532e5c4dc998ac7414c947356f4a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 17 Sep 2020 12:57:41 -0600 Subject: [PATCH 1444/1973] Try moving cnfire calc in front of main btran2 calc --- src/biogeophys/SoilMoistStressMod.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/biogeophys/SoilMoistStressMod.F90 b/src/biogeophys/SoilMoistStressMod.F90 index 2d394c8735..815227787f 100644 --- a/src/biogeophys/SoilMoistStressMod.F90 +++ b/src/biogeophys/SoilMoistStressMod.F90 @@ -379,6 +379,10 @@ subroutine calc_root_moist_stress_clm45default(bounds, & h2osoi_liqvol => waterdiagnosticbulk_inst%h2osoi_liqvol_col & ! Output: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR ) + call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds, nlevgrnd, & + fn, filterp, waterstatebulk_inst, soilstate_inst, & + soil_water_retention_curve ) + do j = 1,nlevgrnd do f = 1, fn p = filterp(f) @@ -428,10 +432,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & end do end do - call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds, nlevgrnd, & - fn, filterp, waterstatebulk_inst, soilstate_inst, & - soil_water_retention_curve ) - ! Normalize root resistances to get layer contribution to ET ! Note that rootr as calculated here is based on the SMS (soil moisture stress) method, ! not the PHS (plant hydraulic stress) method. It is (should) only be used by SoilWaterPlantSinkMod.F90 From 49065605bc9fbc1be50ae364dbc20362be03813b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 17 Sep 2020 12:59:21 -0600 Subject: [PATCH 1445/1973] Add a couple array size checks, and make btran2 public so can be used in CNFire extensions --- src/biogeochem/CNFireBaseMod.F90 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index ae667d32b7..0d3204313c 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -74,7 +74,7 @@ module CNFireBaseMod type, abstract, extends(fire_base_type) :: cnfire_base_type private ! !PRIVATE MEMBER DATA: - real(r8), pointer :: btran2_patch (:) ! patch root zone soil wetness factor (0 to 1) + real(r8), public, pointer :: btran2_patch (:) ! patch root zone soil wetness factor (0 to 1) contains ! @@ -188,6 +188,8 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg real(r8) :: smp_node_lf !temporary variable integer :: p, f, j, c, l !indices + SHR_ASSERT_ALL_FL((ubound(filter_exposedvegp) >= (/num_exposedvegp/)), sourcefile, __LINE__) + associate( & smpso => pftcon%smpso , & ! Input: soil water potential at full stomatal opening (mm) smpsc => pftcon%smpsc , & ! Input: soil water potential at full stomatal closure (mm) @@ -196,6 +198,11 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) + + SHR_ASSERT_ALL_FL((ubound(watsat) == (/bounds%endc,nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(h2osoi_vol) == (/bounds%endc,nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(rootfr) == (/bounds%endp,nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(btran2) == (/bounds%endp/)), sourcefile, __LINE__) do f = 1, num_exposedvegp p = filter_exposedvegp(f) btran2(p) = btran0 From 56eb25e32f53a1add2d314f372c6635b2787ceb5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 17 Sep 2020 12:59:58 -0600 Subject: [PATCH 1446/1973] Start using the CNFire version, rather than the energyflux version --- src/biogeochem/CNFireLi2016Mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index 5a36e192b2..a95fd712fd 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -170,7 +170,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ fsr_pft => pftcon%fsr_pft , & ! Input: fd_pft => pftcon%fd_pft , & ! Input: - btran2 => energyflux_inst%btran2_patch , & ! Input: [real(r8) (:) ] root zone soil wetness + btran2 => this%cnfire_base_type%btran2_patch , & ! Input: [real(r8) (:) ] root zone soil wetness fsat => saturated_excess_runoff_inst%fsat_col , & ! Input: [real(r8) (:) ] fractional area with water table at surface wf2 => waterdiagnosticbulk_inst%wf2_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m From 5ae38d789a2304f1705235c0b37abab92c1b0ec6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Sep 2020 00:10:30 -0600 Subject: [PATCH 1447/1973] Totally get rid of btran2 for FATES as now it's just inside the BGC CN fire module and not avaialble for FATES -- and not needed either --- src/utils/clmfates_interfaceMod.F90 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 76bcb900ea..580340de01 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -1472,7 +1472,6 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) h2osoi_liqvol => waterdiagnosticbulk_inst%h2osoi_liqvol_col , & ! Input: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR btran => energyflux_inst%btran_patch , & ! Output: [real(r8) (:) ] transpiration wetness factor (0 to 1) - btran2 => energyflux_inst%btran2_patch , & ! Output: [real(r8) (:) ] rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root resistance by layer (0-1) (nlevgrnd) rootr => soilstate_inst%rootr_patch & ! Output: [real(r8) (:,:) ] Fraction of water uptake in each layer ) @@ -1565,8 +1564,8 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & ! Convert output BC's ! For CLM/ALM this wrapper provides return variables that should ! be similar to that of calc_root_moist_stress(). However, - ! CLM/ALM-FATES simulations will no make use of rresis, btran or btran2 - ! outside of FATES. We do not have code in place to calculate btran2 or + ! CLM/ALM-FATES simulations will no make use of rresis or btran + ! outside of FATES. We do not have code in place to calculate or ! rresis right now, so we force to bad. We have btran calculated so we ! pass it in case people want diagnostics. rootr is actually the only ! variable that will be used, as it is needed to help distribute the @@ -1586,7 +1585,6 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & ! it should not thought of as valid output until we decide to. rootr(p,j) = this%fates(nc)%bc_out(s)%rootr_pasl(ifp,j) btran(p) = this%fates(nc)%bc_out(s)%btran_pa(ifp) - btran2(p) = -999.9 ! Not available, force to nonsense end do end do From e7a6c38d080861ba069380d8b3b35630081fa1ea Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Sep 2020 00:12:15 -0600 Subject: [PATCH 1448/1973] Remove btran2 from biogeophys as now isolated in BGC CN fire module, and only call the subroutine to calculate it when CN is on and FATES is not --- src/biogeophys/CanopyFluxesMod.F90 | 2 -- src/biogeophys/EnergyFluxType.F90 | 12 ------------ src/biogeophys/SoilMoistStressMod.F90 | 21 +++++++++------------ 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 6a009f4f73..492108d8b3 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -540,7 +540,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, grnd_ch4_cond => ch4_inst%grnd_ch4_cond_patch , & ! Output: [real(r8) (:) ] tracer conductance for boundary layer [m/s] htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of evaporation (/sublimation) [J/kg] (constant) - btran2 => energyflux_inst%btran2_patch , & ! Output: [real(r8) (:) ] F. Li and S. Levis btran => energyflux_inst%btran_patch , & ! Output: [real(r8) (:) ] transpiration wetness factor (0 to 1) rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root resistance by layer (0-1) (nlevgrnd) taux => energyflux_inst%taux_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: e-w (kg/m/s**2) @@ -633,7 +632,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, wtaq0(p) = 0._r8 obuold(p) = 0._r8 btran(p) = btran0 - btran2(p) = btran0 end do ! calculate daylength control for Vcmax diff --git a/src/biogeophys/EnergyFluxType.F90 b/src/biogeophys/EnergyFluxType.F90 index 3f125e9497..9b1a37a235 100644 --- a/src/biogeophys/EnergyFluxType.F90 +++ b/src/biogeophys/EnergyFluxType.F90 @@ -95,7 +95,6 @@ module EnergyFluxType real(r8), pointer :: bsha_patch (:) ! patch shaded canopy transpiration wetness factor (0 to 1) ! Roots - real(r8), pointer :: btran2_patch (:) ! patch root zone soil wetness factor (0 to 1) real(r8), pointer :: rresis_patch (:,:) ! patch root resistance by layer (0-1) (nlevgrnd) ! Latent heat @@ -250,7 +249,6 @@ subroutine InitAllocate(this, bounds) allocate(this%btran_patch (begp:endp)) ; this%btran_patch (:) = nan allocate(this%btran_min_patch (begp:endp)) ; this%btran_min_patch (:) = nan allocate(this%btran_min_inst_patch (begp:endp)) ; this%btran_min_inst_patch (:) = nan - allocate(this%btran2_patch (begp:endp)) ; this%btran2_patch (:) = nan allocate( this%bsun_patch (begp:endp)) ; this%bsun_patch (:) = nan allocate( this%bsha_patch (begp:endp)) ; this%bsha_patch (:) = nan allocate( this%errsoi_patch (begp:endp)) ; this%errsoi_patch (:) = nan @@ -640,11 +638,6 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp) avgflag='A', long_name='daily minimum of transpiration beta factor', & ptr_patch=this%btran_min_patch, l2g_scale_type='veg') - this%btran2_patch(begp:endp) = spval - call hist_addfld1d (fname='BTRAN2', units='unitless', & - avgflag='A', long_name='root zone soil wetness factor', & - ptr_patch=this%btran2_patch, l2g_scale_type='veg') - if (use_cn) then this%rresis_patch(begp:endp,:) = spval call hist_addfld2d (fname='RRESIS', units='proportion', type2d='levgrnd', & @@ -861,11 +854,6 @@ subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildt interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_heat_col) end if - call restartvar(ncid=ncid, flag=flag, varname='btran2', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%btran2_patch) - call restartvar(ncid=ncid, flag=flag, varname='BTRAN_MIN', xtype=ncd_double, & dim1name='pft', & long_name='daily minimum of transpiration wetness factor', units='', & diff --git a/src/biogeophys/SoilMoistStressMod.F90 b/src/biogeophys/SoilMoistStressMod.F90 index 815227787f..62f37635d3 100644 --- a/src/biogeophys/SoilMoistStressMod.F90 +++ b/src/biogeophys/SoilMoistStressMod.F90 @@ -332,6 +332,7 @@ subroutine calc_root_moist_stress_clm45default(bounds, & use PatchType , only : patch use clm_varctl , only : iulog, use_hydrstress use CNVegetationFacade , only : cn_vegetation_type + use clm_varctl , only : use_cn, use_fates ! ! !ARGUMENTS: implicit none @@ -351,7 +352,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & ! !LOCAL VARIABLES: real(r8), parameter :: btran0 = 0.0_r8 ! initial value real(r8) :: smp_node, s_node !temporary variables - real(r8) :: smp_node_lf !temporary variable integer :: p, f, j, c, l !indices !------------------------------------------------------------------------------ @@ -372,16 +372,20 @@ subroutine calc_root_moist_stress_clm45default(bounds, & rootr => soilstate_inst%rootr_patch , & ! Output: [real(r8) (:,:) ] effective fraction of roots in each soil layer (SMS method only) btran => energyflux_inst%btran_patch , & ! Output: [real(r8) (:) ] transpiration wetness factor (0 to 1) (integrated soil water stress) - btran2 => energyflux_inst%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root soil water stress (resistance) by layer (0-1) (nlevgrnd) h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] h2osoi_liqvol => waterdiagnosticbulk_inst%h2osoi_liqvol_col & ! Output: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR ) - call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds, nlevgrnd, & - fn, filterp, waterstatebulk_inst, soilstate_inst, & - soil_water_retention_curve ) + ! + ! Root zone wetness only used by the CN Li Fire model + ! + if ( use_cn .and. .not. use_fates )then + call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds, nlevgrnd, & + fn, filterp, waterstatebulk_inst, soilstate_inst, & + soil_water_retention_curve ) + end if do j = 1,nlevgrnd do f = 1, fn @@ -422,13 +426,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & ! inconsistency for now. btran(p) = btran(p) + max(rootr(p,j),0._r8) end if - s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - - call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) - - smp_node_lf = max(smpsc(patch%itype(p)), smp_node_lf) - btran2(p) = btran2(p) +rootfr(p,j)*max(0._r8,min((smp_node_lf - smpsc(patch%itype(p))) / & - (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8)) end do end do From 509d0bcfac3418c27660b479fd2693c732efff45 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Sep 2020 00:13:06 -0600 Subject: [PATCH 1449/1973] Use fire module version of btran2 for clm4_5 as well --- src/biogeochem/CNFireLi2014Mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 09a6d52373..5c87e75d1c 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -160,7 +160,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ fsr_pft => pftcon%fsr_pft , & ! Input: fd_pft => pftcon%fd_pft , & ! Input: - btran2 => energyflux_inst%btran2_patch , & ! Input: [real(r8) (:) ] root zone soil wetness + btran2 => this%cnfire_base_type%btran2_patch , & ! Input: [real(r8) (:) ] root zone soil wetness fsat => saturated_excess_runoff_inst%fsat_col , & ! Input: [real(r8) (:) ] fractional area with water table at surface wf => waterdiagnosticbulk_inst%wf_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.05 m wf2 => waterdiagnosticbulk_inst%wf2_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m From e4c311d59476d133f7574f1a4f615e2404ceeb6d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Sep 2020 00:17:07 -0600 Subject: [PATCH 1450/1973] Add a few more comments, and rename the BTRAN2FIRE/btran2fire for history and restart back to the original name of BTRAN2/btran2 that was used in EnergyFluxes, now that that version is removed. @billsacks helped me to see that this restart issue is what led to my thinking the results were different --- src/biogeochem/CNFireBaseMod.F90 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 0d3204313c..cc9d51242b 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -74,6 +74,7 @@ module CNFireBaseMod type, abstract, extends(fire_base_type) :: cnfire_base_type private ! !PRIVATE MEMBER DATA: + ! !PUBLIC MEMBER DATA (used by extensions of the base class): real(r8), public, pointer :: btran2_patch (:) ! patch root zone soil wetness factor (0 to 1) contains @@ -141,7 +142,7 @@ subroutine CNFireInit( this, bounds, NLFilename ) allocate(this%btran2_patch (begp:endp)) ; this%btran2_patch (:) = nan ! History file this%btran2_patch(begp:endp) = spval - call hist_addfld1d(fname='BTRAN2FIRE', units='unitless', & + call hist_addfld1d(fname='BTRAN2', units='unitless', & avgflag='A', long_name='root zone soil wetness factor', & ptr_patch=this%btran2_patch, l2g_scale_type='veg') end subroutine CNFireInit @@ -160,7 +161,7 @@ subroutine CNFireRestart( this, bounds, ncid, flag ) logical :: readvar - call restartvar(ncid=ncid, flag=flag, varname='btran2fire', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='btran2', xtype=ncd_double, & dim1name='pft', & long_name='', units='', & interpinic_flag='interp', readvar=readvar, data=this%btran2_patch) @@ -169,6 +170,9 @@ end subroutine CNFireRestart !---------------------------------------------------------------------- subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) + ! + ! Calculate the root wetness term that will be used by the fire model + ! use pftconMod , only : pftcon use PatchType , only : patch use WaterStateBulkType , only : waterstatebulk_type @@ -182,11 +186,12 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg type(waterstatebulk_type), intent(in) :: waterstatebulk_inst type(soilstate_type) , intent(in) :: soilstate_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - + ! !LOCAL VARIABLES: real(r8), parameter :: btran0 = 0.0_r8 ! initial value real(r8) :: smp_node, s_node !temporary variables real(r8) :: smp_node_lf !temporary variable integer :: p, f, j, c, l !indices + !----------------------------------------------------------------------- SHR_ASSERT_ALL_FL((ubound(filter_exposedvegp) >= (/num_exposedvegp/)), sourcefile, __LINE__) From e345c390332e8178a0fb814305abc3a656273f4e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 18 Sep 2020 04:24:29 -0600 Subject: [PATCH 1451/1973] Call routine to calc fire's btran2 from CNFireArea MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has a few advantages: - It makes the logic of CNFireArea more clear (rather than depending on a btran2 variable that is calculated from some other part of the code) - This avoids having the biogeophysics depend on the biogeochemistry - This lets us avoid doing this btran calc if using no-fire – or other, future, fire methods that don't need it The placement in the driver loop differs from before; in order to get bit-for-bit results, we need to save h2osoi_vol and used that saved version from earlier in the driver loop; in a follow-up, answer-changing step, I plan to change this. --- src/biogeochem/CNDriverMod.F90 | 12 +++++- src/biogeochem/CNFireBaseMod.F90 | 46 ++--------------------- src/biogeochem/CNFireLi2014Mod.F90 | 24 +++++++++--- src/biogeochem/CNFireLi2016Mod.F90 | 24 +++++++++--- src/biogeochem/CNFireNoFireMod.F90 | 18 +++++++-- src/biogeochem/CNVegetationFacade.F90 | 15 ++++++-- src/biogeophys/CanopyFluxesMod.F90 | 8 +--- src/biogeophys/HydrologyNoDrainageMod.F90 | 8 ++++ src/biogeophys/SoilMoistStressMod.F90 | 23 ++---------- src/biogeophys/WaterStateBulkType.F90 | 3 +- src/main/FireMethodType.F90 | 21 ++++++++--- src/main/clm_driver.F90 | 10 +++-- 12 files changed, 114 insertions(+), 98 deletions(-) diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 index f9f4b4532c..a439cee207 100644 --- a/src/biogeochem/CNDriverMod.F90 +++ b/src/biogeochem/CNDriverMod.F90 @@ -40,6 +40,7 @@ module CNDriverMod use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type use ActiveLayerMod , only : active_layer_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type ! ! !PUBLIC TYPES: implicit none @@ -80,7 +81,8 @@ end subroutine CNDriverInit !----------------------------------------------------------------------- subroutine CNDriverNoLeaching(bounds, & - num_soilc, filter_soilc, num_soilp, filter_soilp, num_pcropp, filter_pcropp, doalb, & + num_soilc, filter_soilc, num_soilp, filter_soilp, num_pcropp, filter_pcropp, & + num_exposedvegp, filter_exposedvegp, doalb, & cnveg_state_inst, & cnveg_carbonflux_inst, cnveg_carbonstate_inst, & c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & @@ -94,7 +96,8 @@ subroutine CNDriverNoLeaching(bounds, soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & active_layer_inst, & atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & - wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & + wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, & + soil_water_retention_curve, crop_inst, ch4_inst, & dgvs_inst, photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, cnfire_method, dribble_crophrv_xsmrpool_2atm) ! @@ -146,6 +149,8 @@ subroutine CNDriverNoLeaching(bounds, integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg logical , intent(in) :: doalb ! true = surface albedo calculation time step type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst @@ -178,6 +183,7 @@ subroutine CNDriverNoLeaching(bounds, type(canopystate_type) , intent(inout) :: canopystate_inst type(soilstate_type) , intent(inout) :: soilstate_inst type(temperature_type) , intent(inout) :: temperature_inst + class(soil_water_retention_curve_type) , intent(in) :: soil_water_retention_curve type(crop_type) , intent(inout) :: crop_inst type(ch4_type) , intent(in) :: ch4_inst type(dgvs_type) , intent(inout) :: dgvs_inst @@ -747,7 +753,9 @@ subroutine CNDriverNoLeaching(bounds, call t_startf('CNFire') call cnfire_method%CNFireArea(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, & totlitc_col=soilbiogeochem_carbonstate_inst%totlitc_col(begc:endc), & decomp_cpools_vr_col=soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools), & diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index cc9d51242b..00fecb9943 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -84,7 +84,6 @@ module CNFireBaseMod procedure, public :: FireReadNML ! Read in namelist for CNFire procedure, public :: CNFireRestart ! Restart for CNFire procedure, public :: CNFireReadParams ! Read in constant parameters from the paramsfile - procedure, public :: CNFireArea ! Calculate fire area procedure, public :: CNFireFluxes ! Calculate fire fluxes procedure, public :: CNFire_calc_fire_root_wetness ! Calcualte CN-fire specific root wetness ! @@ -168,19 +167,19 @@ subroutine CNFireRestart( this, bounds, ncid, flag ) end subroutine CNFireRestart !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedvegp, filter_exposedvegp, & + subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) ! ! Calculate the root wetness term that will be used by the fire model ! use pftconMod , only : pftcon + use clm_varpar , only : nlevgrnd use PatchType , only : patch use WaterStateBulkType , only : waterstatebulk_type use SoilStateType , only : soilstate_type use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type class(cnfire_base_type) :: this type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: nlevgrnd !number of vertical layers integer , intent(in) :: num_exposedvegp !number of filters integer , intent(in) :: filter_exposedvegp(:) !filter array type(waterstatebulk_type), intent(in) :: waterstatebulk_inst @@ -201,13 +200,10 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation btran2 => this%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) + ! FIXME(wjs, 2020-09-18) change this to use h2osoi_vol_col instead of the prehydrology version + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_prehydrology_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) - SHR_ASSERT_ALL_FL((ubound(watsat) == (/bounds%endc,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(h2osoi_vol) == (/bounds%endc,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(rootfr) == (/bounds%endp,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(btran2) == (/bounds%endp/)), sourcefile, __LINE__) do f = 1, num_exposedvegp p = filter_exposedvegp(f) btran2(p) = btran0 @@ -338,40 +334,6 @@ subroutine FireReadNML( this, NLFilename ) end subroutine FireReadNML - !----------------------------------------------------------------------- - subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & - waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) - ! - ! !DESCRIPTION: - ! Computes column-level burned area - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - real(r8) , intent(in) :: totlitc_col(bounds%begc:) - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) - real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) - ! - - call endrun( 'cnfire_base::CNFireArea: this method MUST be implemented!' ) - - end subroutine CNFireArea - !----------------------------------------------------------------------- subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & dgvs_inst, cnveg_state_inst, & diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 5c87e75d1c..3ff8916df7 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -34,8 +34,11 @@ module CNFireLi2014Mod use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use GridcellType , only : grc use ColumnType , only : col use PatchType , only : patch @@ -79,8 +82,10 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & - wateratm2lndbulk_inst, cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & + cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: ! Computes column-level burned area @@ -100,11 +105,16 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) @@ -322,6 +332,10 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ dtrotr_col(c)=0._r8 end if end do + + call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) + do pi = 1,max_patch_per_col do fc = 1,num_soilc c = filter_soilc(fc) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index a95fd712fd..5b1457afc6 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -34,8 +34,11 @@ module CNFireLi2016Mod use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use GridcellType , only : grc use ColumnType , only : col use PatchType , only : patch @@ -83,8 +86,10 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & - wateratm2lndbulk_inst, cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & + cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: ! Computes column-level burned area @@ -105,11 +110,16 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) @@ -343,6 +353,10 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ dtrotr_col(c)=0._r8 end if end do + + call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) + do pi = 1,max_patch_per_col do fc = 1,num_soilc c = filter_soilc(fc) diff --git a/src/biogeochem/CNFireNoFireMod.F90 b/src/biogeochem/CNFireNoFireMod.F90 index 025d45cbd8..69411b19eb 100644 --- a/src/biogeochem/CNFireNoFireMod.F90 +++ b/src/biogeochem/CNFireNoFireMod.F90 @@ -17,8 +17,11 @@ module CNFireNoFireMod use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use FireMethodType , only : fire_method_type use CNFireBaseMod , only : cnfire_base_type ! @@ -55,8 +58,10 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: @@ -72,11 +77,16 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 196817b3cc..d200d6aa23 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -94,6 +94,7 @@ module CNVegetationFacade use dynCNDVMod , only : dynCNDV_init, dynCNDV_interp use CNPrecisionControlMod , only: CNPrecisionControl use SoilBiogeochemPrecisionControlMod , only: SoilBiogeochemPrecisionControl + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type ! implicit none private @@ -875,6 +876,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & num_soilc, filter_soilc, & num_soilp, filter_soilp, & num_pcropp, filter_pcropp, & + num_exposedvegp, filter_exposedvegp, & doalb, & soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & @@ -883,7 +885,8 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & active_layer_inst, & atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & - wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & + wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, & + soil_water_retention_curve, crop_inst, ch4_inst, & photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, fireemis_inst) ! @@ -904,6 +907,8 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg logical , intent(in) :: doalb ! true = surface albedo calculation time step type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst @@ -923,6 +928,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & type(canopystate_type) , intent(inout) :: canopystate_inst type(soilstate_type) , intent(inout) :: soilstate_inst type(temperature_type) , intent(inout) :: temperature_inst + class(soil_water_retention_curve_type) , intent(in) :: soil_water_retention_curve type(crop_type) , intent(inout) :: crop_inst type(ch4_type) , intent(in) :: ch4_inst type(photosyns_type) , intent(in) :: photosyns_inst @@ -941,7 +947,9 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & call CNDriverNoLeaching(bounds, & num_soilc, filter_soilc, & num_soilp, filter_soilp, & - num_pcropp, filter_pcropp, doalb, & + num_pcropp, filter_pcropp, & + num_exposedvegp, filter_exposedvegp, & + doalb, & this%cnveg_state_inst, & this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, & this%c13_cnveg_carbonflux_inst, this%c13_cnveg_carbonstate_inst, & @@ -956,7 +964,8 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & active_layer_inst, & atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, & - wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & + wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, & + soil_water_retention_curve, crop_inst, ch4_inst, & this%dgvs_inst, photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, this%cnfire_method, this%dribble_crophrv_xsmrpool_2atm) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 492108d8b3..aeae396733 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -190,8 +190,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, ch4_inst, ozone_inst, & photosyns_inst, & humanindex_inst, soil_water_retention_curve, & - downreg_patch, leafn_patch, froot_carbon, croot_carbon, & - bgc_vegetation_inst) + downreg_patch, leafn_patch, froot_carbon, croot_carbon) ! ! !DESCRIPTION: ! 1. Calculates the leaf temperature: @@ -234,7 +233,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, swbgt, hmdex, dis_coi, dis_coiS, THIndex, & SwampCoolEff, KtoC, VaporPres use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use CNVegetationFacade , only : cn_vegetation_type ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -264,7 +262,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8), intent(in) :: leafn_patch(bounds%begp:) ! leaf N (gN/m2) real(r8), intent(inout) :: froot_carbon(bounds%begp:) ! fine root biomass (gC/m2) real(r8), intent(inout) :: croot_carbon(bounds%begp:) ! live coarse root biomass (gC/m2) - type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: real(r8), pointer :: bsun(:) ! sunlit canopy transpiration wetness factor (0 to 1) @@ -707,8 +704,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, temperature_inst=temperature_inst, & waterstatebulk_inst=waterstatebulk_inst, & waterdiagnosticbulk_inst=waterdiagnosticbulk_inst, & - soil_water_retention_curve=soil_water_retention_curve, & - bgc_vegetation_inst=bgc_vegetation_inst) + soil_water_retention_curve=soil_water_retention_curve) end if diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index 2596f7e5b0..6c2bcee4eb 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -251,6 +251,7 @@ subroutine HydrologyNoDrainage(bounds, & h2osoi_ice_tot => b_waterdiagnostic_inst%h2osoi_ice_tot_col , & ! Output: [real(r8) (:) ] vertically summed ice lens (kg/m2) h2osoi_liq_tot => b_waterdiagnostic_inst%h2osoi_liq_tot_col , & ! Output: [real(r8) (:) ] vertically summed liquid water (kg/m2) h2osoi_vol => b_waterstate_inst%h2osoi_vol_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] + h2osoi_vol_prehydrology => b_waterstate_inst%h2osoi_vol_prehydrology_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) saved before hydrology [m3/m3] h2osno_top => b_waterdiagnostic_inst%h2osno_top_col , & ! Output: [real(r8) (:) ] mass of snow in top layer (col) [kg] wf => b_waterdiagnostic_inst%wf_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.05 m wf2 => b_waterdiagnostic_inst%wf2_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m @@ -272,6 +273,13 @@ subroutine HydrologyNoDrainage(bounds, & call water_inst%TracerConsistencyCheck(bounds, 'before main snow code in HydrologyNoDrainage') end if + do j = 1, nlevgrnd + do fc = 1, num_hydrologyc + c = filter_hydrologyc(fc) + h2osoi_vol_prehydrology(c,j) = h2osoi_vol(c,j) + end do + end do + ! Determine step size dtime = get_step_size_real() diff --git a/src/biogeophys/SoilMoistStressMod.F90 b/src/biogeophys/SoilMoistStressMod.F90 index 62f37635d3..8232b01811 100644 --- a/src/biogeophys/SoilMoistStressMod.F90 +++ b/src/biogeophys/SoilMoistStressMod.F90 @@ -312,8 +312,7 @@ end subroutine normalize_unfrozen_rootfr subroutine calc_root_moist_stress_clm45default(bounds, & nlevgrnd, fn, filterp, rootfr_unf, & temperature_inst, soilstate_inst, energyflux_inst, waterstatebulk_inst, & - waterdiagnosticbulk_inst, soil_water_retention_curve, & - bgc_vegetation_inst ) + waterdiagnosticbulk_inst, soil_water_retention_curve) ! ! DESCRIPTIONS ! compute the root water stress using the default clm45 approach @@ -331,8 +330,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type use PatchType , only : patch use clm_varctl , only : iulog, use_hydrstress - use CNVegetationFacade , only : cn_vegetation_type - use clm_varctl , only : use_cn, use_fates ! ! !ARGUMENTS: implicit none @@ -347,7 +344,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: real(r8), parameter :: btran0 = 0.0_r8 ! initial value @@ -378,15 +374,6 @@ subroutine calc_root_moist_stress_clm45default(bounds, & h2osoi_liqvol => waterdiagnosticbulk_inst%h2osoi_liqvol_col & ! Output: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR ) - ! - ! Root zone wetness only used by the CN Li Fire model - ! - if ( use_cn .and. .not. use_fates )then - call bgc_vegetation_inst%cnfire_method%CNFire_calc_fire_root_wetness( bounds, nlevgrnd, & - fn, filterp, waterstatebulk_inst, soilstate_inst, & - soil_water_retention_curve ) - end if - do j = 1,nlevgrnd do f = 1, fn p = filterp(f) @@ -451,8 +438,7 @@ end subroutine calc_root_moist_stress_clm45default !-------------------------------------------------------------------------------- subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & active_layer_inst, energyflux_inst, soilstate_inst, temperature_inst, & - waterstatebulk_inst, waterdiagnosticbulk_inst, soil_water_retention_curve, & - bgc_vegetation_inst ) + waterstatebulk_inst, waterdiagnosticbulk_inst, soil_water_retention_curve) ! ! DESCRIPTIONS ! compute the root water stress using different approaches @@ -469,7 +455,6 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type use abortutils , only : endrun - use CNVegetationFacade , only : cn_vegetation_type ! ! !ARGUMENTS: implicit none @@ -484,7 +469,6 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst ! ! !LOCAL VARIABLES: integer :: p, f, j, c, l ! indices @@ -522,8 +506,7 @@ subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & waterstatebulk_inst=waterstatebulk_inst, & waterdiagnosticbulk_inst=waterdiagnosticbulk_inst, & rootfr_unf=rootfr_unf(bounds%begp:bounds%endp,1:nlevgrnd), & - soil_water_retention_curve=soil_water_retention_curve, & - bgc_vegetation_inst=bgc_vegetation_inst ) + soil_water_retention_curve=soil_water_retention_curve) case default call endrun(subname // ':: a root moisture stress function must be specified!') diff --git a/src/biogeophys/WaterStateBulkType.F90 b/src/biogeophys/WaterStateBulkType.F90 index 02a3579b80..402486bd2f 100644 --- a/src/biogeophys/WaterStateBulkType.F90 +++ b/src/biogeophys/WaterStateBulkType.F90 @@ -27,6 +27,7 @@ module WaterStateBulkType real(r8), pointer :: snow_persistence_col (:) ! col length of time that ground has had non-zero snow thickness (sec) real(r8), pointer :: int_snow_col (:) ! col integrated snowfall (mm H2O) + real(r8), pointer :: h2osoi_vol_prehydrology_col (:,:) ! col volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - saved pre-hydrology contains @@ -104,7 +105,7 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%snow_persistence_col (begc:endc)) ; this%snow_persistence_col (:) = nan allocate(this%int_snow_col (begc:endc)) ; this%int_snow_col (:) = nan - + allocate(this%h2osoi_vol_prehydrology_col(begc:endc, 1:nlevgrnd)); this%h2osoi_vol_prehydrology_col(:,:) = nan end subroutine InitBulkAllocate diff --git a/src/main/FireMethodType.F90 b/src/main/FireMethodType.F90 index eea2ddce69..d199d662fa 100644 --- a/src/main/FireMethodType.F90 +++ b/src/main/FireMethodType.F90 @@ -139,8 +139,10 @@ end subroutine CNFireRestart_interface !----------------------------------------------------------------------- subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: @@ -152,8 +154,11 @@ subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soil use atm2lndType , only : atm2lnd_type use EnergyFluxType , only : energyflux_type use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use CNVegStateType , only : cnveg_state_type use CNVegCarbonStateType , only : cnveg_carbonstate_type import :: fire_method_type @@ -165,11 +170,16 @@ subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soil integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) @@ -233,7 +243,7 @@ end subroutine CNFireFluxes_interface !----------------------------------------------------------------------- !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness_interface( this, bounds, nlevgrnd, num_exposedvegp, & + subroutine CNFire_calc_fire_root_wetness_interface( this, bounds, num_exposedvegp, & filter_exposedvegp, waterstatebulk_inst, & soilstate_inst, soil_water_retention_curve ) ! Calculate root wetness that will be used for the CN fire model @@ -244,7 +254,6 @@ subroutine CNFire_calc_fire_root_wetness_interface( this, bounds, nlevgrnd, num_ import :: fire_method_type class(fire_method_type) :: this type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: nlevgrnd !number of vertical layers integer , intent(in) :: num_exposedvegp !number of filters integer , intent(in) :: filter_exposedvegp(:) !filter array type(waterstatebulk_type), intent(in) :: waterstatebulk_inst diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 51647c105e..8e38910432 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -679,8 +679,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro downreg_patch = downreg_patch(bounds_clump%begp:bounds_clump%endp), & leafn_patch = leafn_patch(bounds_clump%begp:bounds_clump%endp), & froot_carbon = froot_carbon(bounds_clump%begp:bounds_clump%endp), & - croot_carbon = croot_carbon(bounds_clump%begp:bounds_clump%endp), & - bgc_vegetation_inst = bgc_vegetation_inst ) + croot_carbon = croot_carbon(bounds_clump%begp:bounds_clump%endp)) deallocate(downreg_patch, leafn_patch, froot_carbon, croot_carbon) call t_stopf('canflux') @@ -968,7 +967,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call bgc_vegetation_inst%EcosystemDynamicsPreDrainage(bounds_clump, & filter(nc)%num_soilc, filter(nc)%soilc, & filter(nc)%num_soilp, filter(nc)%soilp, & - filter(nc)%num_pcropp, filter(nc)%pcropp, doalb, & + filter(nc)%num_pcropp, filter(nc)%pcropp, & + filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & + doalb, & soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & @@ -977,7 +978,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro active_layer_inst, & atm2lnd_inst, water_inst%waterstatebulk_inst, & water_inst%waterdiagnosticbulk_inst, water_inst%waterfluxbulk_inst, & - water_inst%wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & + water_inst%wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, & + soil_water_retention_curve, crop_inst, ch4_inst, & photosyns_inst, saturated_excess_runoff_inst, energyflux_inst, & nutrient_competition_method, fireemis_inst) From c7723f9178e77f8a253281a90f64c364879ff0e3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 18 Sep 2020 04:39:12 -0600 Subject: [PATCH 1452/1973] Remove some very expensive tests These are tests of relatively high resolution grids that CAM has recently added. We'll just rely on build-namelist testing to ensure we have datasets for these resolutions. See https://github.com/ESCOMP/CTSM/issues/1139 for details. Resolves ESCOMP/CTSM#1139 --- cime_config/testdefs/testlist_clm.xml | 36 --------------------------- 1 file changed, 36 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 1d6552493f..5c1633234a 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -44,15 +44,6 @@ - - - - - - - - - @@ -231,15 +222,6 @@ - - - - - - - - - @@ -809,15 +791,6 @@ - - - - - - - - - @@ -1178,15 +1151,6 @@ for ERS test as otherwise it won't work for a sub-day test" - - - - - - - - - From 68b913bd07b2b13f15f3653441de47fae0028cd1 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 18 Sep 2020 11:19:16 -0400 Subject: [PATCH 1453/1973] FATES CNP, added an ERS test for fates_parteh_mode=2, which includes a testmod dir that activates its namelist entry --- cime_config/testdefs/testlist_clm.xml | 10 ++++++++++ .../testmods_dirs/clm/FatesPRT2/include_user_mods | 1 + .../testdefs/testmods_dirs/clm/FatesPRT2/user_nl_clm | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesPRT2/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesPRT2/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index d5be518d67..a0caf55a29 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1812,6 +1812,16 @@ + + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesPRT2/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesPRT2/include_user_mods new file mode 100644 index 0000000000..4c7aa0f2b4 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesPRT2/include_user_mods @@ -0,0 +1 @@ +../Fates diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesPRT2/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesPRT2/user_nl_clm new file mode 100644 index 0000000000..400fa7cfd4 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/FatesPRT2/user_nl_clm @@ -0,0 +1,5 @@ +hist_mfilt = 365 +hist_nhtfrq = -24 +hist_empty_htapes = .false. +fates_parteh_mode = 2 +fates_spitfire_mode = 1 \ No newline at end of file From a7e154ce0065d3113d8869a716caf43ba1da8a9a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Sep 2020 15:13:03 -0600 Subject: [PATCH 1454/1973] Fix compset name in new compset --- cime_config/config_compsets.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index e443fecc40..589a2e946c 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -231,7 +231,7 @@ - IHistCtsm51BgcCrop + IHistClm51BgcCrop HIST_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV From 2ddee8eed6d9ff39c7d5752614557ce3f7385f8d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Sep 2020 16:14:37 -0600 Subject: [PATCH 1455/1973] Add private InitHistory and InitAllocate methods to CN base fire class, tested that compiles --- src/biogeochem/CNFireBaseMod.F90 | 49 +++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index cc9d51242b..f76e4dd665 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -87,6 +87,9 @@ module CNFireBaseMod procedure, public :: CNFireArea ! Calculate fire area procedure, public :: CNFireFluxes ! Calculate fire fluxes procedure, public :: CNFire_calc_fire_root_wetness ! Calcualte CN-fire specific root wetness + ! !PRIVATE MEMBER FUNCTIONS: + procedure, private :: InitAllocate ! Memory allocation of Fire + procedure, private :: InitHistory ! History file assignment of fire ! end type cnfire_base_type !----------------------------------------------------------------------- @@ -121,31 +124,57 @@ subroutine CNFireInit( this, bounds, NLFilename ) ! ! !DESCRIPTION: ! Initialize CN Fire module - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varcon , only : spval - use histFileMod , only : hist_addfld1d - ! ! !ARGUMENTS: class(cnfire_base_type) :: this type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename !----------------------------------------------------------------------- - integer :: begp, endp - !------------------------------------------------------------------------ ! Call the base-class Initialization method call this%BaseFireInit( bounds, NLFilename ) + ! Allocate memory + call this%InitAllocate( bounds ) + ! History file + call this%InitHistory( bounds ) + end subroutine CNFireInit + !---------------------------------------------------------------------- + + subroutine InitAllocate( this, bounds ) + ! + ! Initiaze memory allocate's + use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) + ! + ! !ARGUMENTS: + class(cnfire_base_type) :: this + type(bounds_type), intent(in) :: bounds + !----------------------------------------------------------------------- + integer :: begp, endp + !------------------------------------------------------------------------ begp = bounds%begp; endp= bounds%endp - ! Allocate memory allocate(this%btran2_patch (begp:endp)) ; this%btran2_patch (:) = nan - ! History file + + end subroutine InitAllocate + + !----------------------------------------------------------------------- + subroutine InitHistory( this, bounds ) + ! + ! Initailizae history variables + use clm_varcon , only : spval + use histFileMod , only : hist_addfld1d + ! + ! !ARGUMENTS: + class(cnfire_base_type) :: this + type(bounds_type), intent(in) :: bounds + !----------------------------------------------------------------------- + integer :: begp, endp + !------------------------------------------------------------------------ + begp = bounds%begp; endp= bounds%endp this%btran2_patch(begp:endp) = spval call hist_addfld1d(fname='BTRAN2', units='unitless', & avgflag='A', long_name='root zone soil wetness factor', & ptr_patch=this%btran2_patch, l2g_scale_type='veg') - end subroutine CNFireInit + end subroutine InitHistory !---------------------------------------------------------------------- subroutine CNFireRestart( this, bounds, ncid, flag ) From 48bd4655715dde6f98f52bbf2db2fc101011e157 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 18 Sep 2020 16:37:44 -0600 Subject: [PATCH 1456/1973] Add comments --- src/biogeochem/CNFireLi2014Mod.F90 | 1 + src/biogeochem/CNFireLi2016Mod.F90 | 1 + 2 files changed, 2 insertions(+) diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 3ff8916df7..c3efbe7069 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -333,6 +333,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do + ! This subroutine calculates btran2 call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index 5b1457afc6..9d3726ccd1 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -354,6 +354,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do + ! This subroutine calculates btran2 call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) From 4e9308f24f8c748864ae19eeebd66a8c7546b0fd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 18 Sep 2020 16:59:03 -0600 Subject: [PATCH 1457/1973] Restore some high-res tests, but put expensive tests in ctsm_sci This reverts commit c7723f9178e77f8a253281a90f64c364879ff0e3 and makes some changes on top of it. Moving forward, we'd like to have a new test category, ctsm_sci, that tests some resolutions / compsets that are important in CESM, but are too expensive to test with every tag. Resolves ESCOMP/CTSM#1139 --- cime_config/testdefs/testlist_clm.xml | 50 +++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 5c1633234a..3d7a8192d4 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -44,6 +44,15 @@ + + + + + + + + + @@ -222,6 +231,15 @@ + + + + + + + + + @@ -791,6 +809,15 @@ + + + + + + + + + @@ -1134,30 +1161,39 @@ - + +for ERS test as otherwise it won't work for a sub-day test (no need to run this high core count test with every tag, but include it in the less frequent ctsm_sci testing)" - + - - + + + + + + + + + + + - + - + From 4a7e14aa33d83a43f5ffaffa2ee099cfc2fd00ca Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 20 Sep 2020 01:20:23 -0600 Subject: [PATCH 1458/1973] Add a pretty full complement of CLM51 compsets, just Bgc for 1850, 2000 and HIST, and one HIST one also with Crop on --- cime_config/config_compsets.xml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 589a2e946c..51d1a3b7f0 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -92,6 +92,11 @@ 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + I2000Clm51BgcGs + 2000_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV + + I2000Clm50Cn @@ -119,6 +124,12 @@ + + I1850Clm51BgcGs + 1850_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV + + + I1850Clm50BgcCropCmip6 @@ -231,8 +242,13 @@ - IHistClm51BgcCrop - HIST_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + IHistClm51BgcGs + HIST_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV + + + + IHistClm51BgcCropGs + HIST_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV From 10f6d5d936368ad5db4df052f007d6c1299cdbac Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 20 Sep 2020 02:21:44 -0600 Subject: [PATCH 1459/1973] Convert some of the Clm50 tests into Clm51 test, and add one new I2000Clm51BgcGs test --- cime_config/testdefs/testlist_clm.xml | 44 ++++++++++++++++----------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 1d6552493f..7148e6c065 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1,6 +1,6 @@ - + @@ -189,7 +189,7 @@ - + @@ -197,7 +197,15 @@ - + + + + + + + + + @@ -332,7 +340,7 @@ - + @@ -340,7 +348,7 @@ - + @@ -384,7 +392,7 @@ - + @@ -434,7 +442,7 @@ - + @@ -462,7 +470,7 @@ - + @@ -682,7 +690,7 @@ - + @@ -736,7 +744,7 @@ - + @@ -1031,7 +1039,7 @@ - + @@ -1077,7 +1085,7 @@ - + @@ -1086,7 +1094,7 @@ - + @@ -1114,7 +1122,7 @@ - + @@ -1223,7 +1231,7 @@ for ERS test as otherwise it won't work for a sub-day test" - + @@ -1495,7 +1503,7 @@ for ERS test as otherwise it won't work for a sub-day test" - + @@ -1548,7 +1556,7 @@ for ERS test as otherwise it won't work for a sub-day test" - + @@ -1594,7 +1602,7 @@ for ERS test as otherwise it won't work for a sub-day test" - + From 62b105e633c5c1e87d703da2e01c5cd628199489 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 20 Sep 2020 02:24:23 -0600 Subject: [PATCH 1460/1973] Add a 2000 Clm51 compset with crop on --- cime_config/config_compsets.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 51d1a3b7f0..b1ae461e29 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -92,6 +92,11 @@ 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + + I2000Clm51BgcCropGs + 2000_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV + + I2000Clm51BgcGs 2000_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV From ff96e24b986280f4c4749232474658f50ffe8ca5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 20 Sep 2020 13:29:02 -0600 Subject: [PATCH 1461/1973] Revert main code to ctsm1.0.dev113 version, and leave just the changes in mksurfdata_map --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- src/main/clm_initializeMod.F90 | 7 +-- src/main/clm_varpar.F90 | 5 +-- src/main/initVerticalMod.F90 | 5 --- src/main/surfrdMod.F90 | 45 ------------------- 5 files changed, 5 insertions(+), 59 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 0c87bfe33c..c9cc6afc4b 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1517,7 +1517,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 2106 lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c181017.nc +>lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc lnd/clm2/urbandata/CLM45_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index b8c6960b5f..4616aecc09 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -55,8 +55,7 @@ subroutine initialize1(dtime, gindex_ocn) use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp, decompInit_lnd3D use decompInitMod , only: decompInit_ocn use domainMod , only: domain_check, ldomain, domain_init - use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data, surfrd_get_num_patches, & - surfrd_get_nlevurb + use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data, surfrd_get_num_patches use controlMod , only: control_init, control_print, NLFilename use ncdio_pio , only: ncd_pio_init use initGridCellsMod , only: initGridCells @@ -85,7 +84,6 @@ subroutine initialize1(dtime, gindex_ocn) integer :: nc ! clump index integer :: actual_maxsoil_patches ! value from surface dataset integer :: actual_numcft ! numcft from sfc dataset - integer :: actual_nlevurb ! nlevurb from sfc dataset integer ,pointer :: amask(:) ! global land mask character(len=32) :: subname = 'initialize1' ! subroutine name !----------------------------------------------------------------------- @@ -107,8 +105,7 @@ subroutine initialize1(dtime, gindex_ocn) call control_init(dtime) call ncd_pio_init() call surfrd_get_num_patches(fsurdat, actual_maxsoil_patches, actual_numcft) - call surfrd_get_nlevurb(fsurdat, actual_nlevurb) - call clm_varpar_init(actual_maxsoil_patches, actual_numcft, actual_nlevurb) + call clm_varpar_init(actual_maxsoil_patches, actual_numcft) call clm_varcon_init( IsSimpleBuildTemp() ) call landunit_varcon_init() diff --git a/src/main/clm_varpar.F90 b/src/main/clm_varpar.F90 index 054c12ed00..6d0e7b6bd6 100644 --- a/src/main/clm_varpar.F90 +++ b/src/main/clm_varpar.F90 @@ -97,7 +97,7 @@ module clm_varpar contains !------------------------------------------------------------------------------ - subroutine clm_varpar_init(actual_maxsoil_patches, actual_numcft, actual_nlevurb) + subroutine clm_varpar_init(actual_maxsoil_patches, actual_numcft) ! ! !DESCRIPTION: ! Initialize module variables @@ -106,7 +106,6 @@ subroutine clm_varpar_init(actual_maxsoil_patches, actual_numcft, actual_nlevurb implicit none integer, intent(in) :: actual_maxsoil_patches ! value from surface dataset integer, intent(in) :: actual_numcft ! Actual number of crops - integer, intent(in) :: actual_nlevurb ! nlevurb from surface dataset ! ! !LOCAL VARIABLES: ! @@ -145,7 +144,7 @@ subroutine clm_varpar_init(actual_maxsoil_patches, actual_numcft, actual_nlevurb max_patch_per_col= max(maxsoil_patches, actual_numcft, maxpatch_urb) nlevsoifl = 10 - nlevurb = actual_nlevurb + nlevurb = 5 if ( masterproc ) write(iulog, *) 'soil_layerstruct_predefined varpar ', soil_layerstruct_predefined if ( masterproc ) write(iulog, *) 'soil_layerstruct_userdefined varpar ', soil_layerstruct_userdefined diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index f13fde8c5e..634d10e4f2 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -264,11 +264,6 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof write(iulog, *) 'dzsoi_decomp: ',dzsoi_decomp end if - if (nlevurb == ispval) then - call shr_sys_abort(' ERROR nlevurb has not been defined '//& - errMsg(sourcefile, __LINE__)) - end if - if (nlevurb > 0) then allocate(zurb_wall(bounds%begl:bounds%endl,nlevurb), & zurb_roof(bounds%begl:bounds%endl,nlevurb), & diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index d0c795639d..771165459d 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -30,7 +30,6 @@ module surfrdMod public :: surfrd_get_grid ! Read grid/ladnfrac data into domain (after domain decomp) public :: surfrd_get_data ! Read surface dataset and determine subgrid weights public :: surfrd_get_num_patches ! Read surface dataset to determine maxsoil_patches and numcft - public :: surfrd_get_nlevurb ! Read surface dataset to determine nlevurb ! !PRIVATE MEMBER FUNCTIONS: private :: surfrd_special ! Read the special landunits @@ -500,50 +499,6 @@ subroutine surfrd_get_num_patches (lfsurdat, actual_maxsoil_patches, actual_numc end subroutine surfrd_get_num_patches !----------------------------------------------------------------------- - - subroutine surfrd_get_nlevurb (lfsurdat, actual_nlevurb) - ! - ! !DESCRIPTION: - ! Read nlevurb from the surface dataset - ! - ! !USES: - use fileutils , only : getfil - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: lfsurdat ! surface dataset filename - integer, intent(out) :: actual_nlevurb ! nlevurb from surface dataset - ! - ! !LOCAL VARIABLES: - character(len=256):: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf file id - integer :: dimid ! netCDF dimension id - character(len=32) :: subname = 'surfrd_get_nlevurb' ! subroutine name - !----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to read nlevurb from the surface data .....' - if (lfsurdat == ' ') then - write(iulog,*)'lfsurdat must be specified' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - endif - - ! Open surface dataset - call getfil( lfsurdat, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Read nlevurb - call ncd_inqdlen(ncid, dimid, actual_nlevurb, 'nlevurb') - - if ( masterproc )then - write(iulog,*) 'Successfully read nlevurb from the surface data' - write(iulog,*) - end if - - end subroutine surfrd_get_nlevurb - -!----------------------------------------------------------------------- - subroutine surfrd_special(begg, endg, ncid, ns) ! ! !DESCRIPTION: From 503112aa7b394199a705117aab02320d9c51b81d Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 21 Sep 2020 10:37:49 -0600 Subject: [PATCH 1462/1973] updating fates default parameter file. --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index aa587a33c4..b84fe61cd8 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -400,7 +400,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/fates_params_api.11.1.0_12pft_c200529.nc +lnd/clm2/paramdata/fates_params_api.14.0.0_12pft_c200921.nc From b06edc8994b38d16eaa1010c90341786d7afaeb9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Sep 2020 18:08:18 -0600 Subject: [PATCH 1463/1973] Correct typo for clm_start_type for clm5_1 --- bld/namelist_files/namelist_defaults_overall.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index 52386b9944..5839ef7451 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -36,7 +36,7 @@ determine default values for namelists. startup arb_ic arb_ic -arb_ic +arb_ic arb_ic cold From 01085124fd5ebf6a0c06befe2f9a962631d178b0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Sep 2020 19:34:51 -0600 Subject: [PATCH 1464/1973] Get rid of shr assert checks as failing for threaded versions --- src/biogeochem/CNFireBaseMod.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index f76e4dd665..b7ed71a612 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -233,10 +233,6 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) - SHR_ASSERT_ALL_FL((ubound(watsat) == (/bounds%endc,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(h2osoi_vol) == (/bounds%endc,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(rootfr) == (/bounds%endp,nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(btran2) == (/bounds%endp/)), sourcefile, __LINE__) do f = 1, num_exposedvegp p = filter_exposedvegp(f) btran2(p) = btran0 From 8fbaeeae7e237ac35d453c99cda633a5b53eed71 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 00:02:55 -0600 Subject: [PATCH 1465/1973] Go back to use_nl_ctsm as in ctsm1.0.dev113 --- cime_config/SystemTests/lilacsmoke.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/SystemTests/lilacsmoke.py b/cime_config/SystemTests/lilacsmoke.py index 83c90d349b..2a566feb60 100644 --- a/cime_config/SystemTests/lilacsmoke.py +++ b/cime_config/SystemTests/lilacsmoke.py @@ -152,8 +152,8 @@ def _create_runtime_inputs(self): # The user_nl_ctsm in the case directory is set up based on the standard testmods # mechanism. We use that one in place of the standard user_nl_ctsm, since the one # in the case directory may contain test-specific modifications. - shutil.copyfile(src=os.path.join(caseroot, 'user_nl_clm'), - dst=os.path.join(runtime_inputs, 'user_nl_clm')) + shutil.copyfile(src=os.path.join(caseroot, 'user_nl_ctsm'), + dst=os.path.join(runtime_inputs, 'user_nl_ctsm')) script_to_run = os.path.join(runtime_inputs, 'make_runtime_inputs') self._run_build_cmd('{} --rundir {}'.format(script_to_run, runtime_inputs), From a2958a6c6695516ef99dc7894c64b029f7049fee Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 00:18:39 -0600 Subject: [PATCH 1466/1973] Get lilac build working and add option for clm5_1 --- python/ctsm/lilac_make_runtime_inputs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/ctsm/lilac_make_runtime_inputs.py b/python/ctsm/lilac_make_runtime_inputs.py index bfe4998c02..5b9a4e1f76 100644 --- a/python/ctsm/lilac_make_runtime_inputs.py +++ b/python/ctsm/lilac_make_runtime_inputs.py @@ -24,7 +24,7 @@ -Specifies clm physics +Specifies ctsm physics """ @@ -172,7 +172,7 @@ def buildnml(cime_path, rundir): finidat = get_config_value(config, 'buildnml_input', 'finidat', ctsm_cfg_path) ctsm_phys = get_config_value(config, 'buildnml_input', 'ctsm_phys', ctsm_cfg_path, - allowed_values=['clm4_5', 'clm5_0']) + allowed_values=['clm4_5', 'clm5_0', 'clm5_1']) configuration = get_config_value(config, 'buildnml_input', 'configuration', ctsm_cfg_path, allowed_values=['nwp', 'clm']) structure = get_config_value(config, 'buildnml_input', 'structure', ctsm_cfg_path, @@ -217,7 +217,7 @@ def buildnml(cime_path, rundir): tempfile.write(env_lilac_text) # remove any existing clm.input_data_list file - inputdatalist_path = os.path.join(rundir, "clm.input_data_list") + inputdatalist_path = os.path.join(rundir, "ctsm.input_data_list") if os.path.exists(inputdatalist_path): os.remove(inputdatalist_path) From f5844f6f32d2e8b82c129548b8452736edc1fc5e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 00:19:07 -0600 Subject: [PATCH 1467/1973] Add clm5_1 for lilac build template --- lilac/bld_templates/ctsm_template.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lilac/bld_templates/ctsm_template.cfg b/lilac/bld_templates/ctsm_template.cfg index 7351b5da71..04ecce49ca 100644 --- a/lilac/bld_templates/ctsm_template.cfg +++ b/lilac/bld_templates/ctsm_template.cfg @@ -26,7 +26,7 @@ finidat = UNSET # High-level configuration options # ------------------------------------------------------------------------ -# ctsm_phys: 'clm4_5' or 'clm5_0' +# ctsm_phys: 'clm4_5', 'clm5_0', or 'clm5_1' ctsm_phys = clm5_0 # configuration: 'nwp' or 'clm' From 647954258893fc65a5c688042bd83af598a2a9b5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 00:20:04 -0600 Subject: [PATCH 1468/1973] LILAC has to use clm/obj as the obj directory --- cime_config/buildlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index 5efaa2799d..2072ed29f1 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -69,7 +69,7 @@ def _write_ctsm_mk(gmake, gmake_opts, makefile, exeroot, libroot): # ====================================================================== CTSM_BLD_DIR = {ctsm_bld_dir} -CTSM_INC = $(CTSM_BLD_DIR)/ctsm/obj +CTSM_INC = $(CTSM_BLD_DIR)/clm/obj # ====================================================================== # The following settings should be included in an atmosphere model's build. From 4ef8a52068b2cf617c321a9380c8e0ec6cc00d0b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 00:21:31 -0600 Subject: [PATCH 1469/1973] Use component name under Buildconf directory, this is needed to be clm right now until cime allows drv_fld_in to be in ctsmconf directory --- cime_config/buildnml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 50beea281b..f60206a01d 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -66,7 +66,7 @@ def buildnml(case, caseroot, compname): # Set ctsmconf # ----------------------------------------------------- - ctsmconf = os.path.join(caseroot, "Buildconf", "ctsmconf") + ctsmconf = os.path.join(caseroot, "Buildconf", compname+"conf") if not os.path.isdir(ctsmconf): os.makedirs(ctsmconf) @@ -80,7 +80,7 @@ def buildnml(case, caseroot, compname): clm_phys = case.get_value("CLM_PHYSICS_VERSION") config_cache_text = _config_cache_template.format(clm_phys=clm_phys) - config_cache_path = os.path.join(caseroot, "Buildconf", "ctsmconf", "config_cache.xml") + config_cache_path = os.path.join(caseroot, "Buildconf", compname+"conf", "config_cache.xml") with open(config_cache_path, 'w') as config_cache_file: config_cache_file.write(config_cache_text) @@ -154,7 +154,7 @@ def buildnml(case, caseroot, compname): lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) - config_cache_file = os.path.join(caseroot,"Buildconf","ctsmconf","config_cache.xml") + config_cache_file = os.path.join(caseroot,"Buildconf", compname+"conf","config_cache.xml") # ----------------------------------------------------- # Clear out old data From d8a0b1bcc5a0d072e92433ffeb10ce3f55d6d68b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 02:04:18 -0600 Subject: [PATCH 1470/1973] Add a test to ctsm_sci for each science_supported compset/grid --- cime_config/testdefs/testlist_clm.xml | 240 ++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 7148e6c065..7d674ba7a1 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -35,6 +35,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -78,6 +98,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -87,6 +127,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -231,6 +291,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -248,6 +328,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -340,6 +440,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -562,6 +682,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -620,6 +760,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -682,6 +842,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -690,6 +890,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -1204,6 +1424,26 @@ for ERS test as otherwise it won't work for a sub-day test" + + + + + + + + + + + + + + + + + + + + From 78540a400b7e77a368a95e8b99d90173d5e18a95 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 02:04:58 -0600 Subject: [PATCH 1471/1973] Remove left over Clm40 compsets --- cime_config/config_compsets.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index b1ae461e29..63a03f7976 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -529,13 +529,6 @@ 1850_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV - - IHistClm40SpGswGs - HIST_DATM%GSWP3v1_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV - - - - IHistClm50BgcCropG HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV From bceca56d1f0fd5fe22d7327a9a6e7559be5a3970 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 02:07:43 -0600 Subject: [PATCH 1472/1973] Remove two tests from aux_clm as similar tests are in ctsm_sci and these are less important tests with Cru forcing --- cime_config/testdefs/testlist_clm.xml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 7d674ba7a1..b51217eb7e 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -26,15 +26,6 @@ - - - - - - - - - @@ -118,15 +109,6 @@ - - - - - - - - - From ca8f3b7af374fb31a0a4e3cfd96ad76f510c3dc3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 22 Sep 2020 23:36:13 -0600 Subject: [PATCH 1473/1973] Correct test numbers --- bld/unit_testers/build-namelist_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index a68a411c7a..db441b045c 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,7 +138,7 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 1517; +my $ntests = 1516; if ( defined($opts{'compare'}) ) { $ntests += 1017; } From ed7af489d52e87507406fb0b1ec13821003f5105 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 23 Sep 2020 02:16:11 -0600 Subject: [PATCH 1474/1973] Update ChangeLog --- doc/ChangeLog | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 119 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 39f375cc66..488f65d422 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,122 @@ =============================================================== +Tag name: ctsm5.1.dev001 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Wed Sep 23 02:16:01 MDT 2020 +One-line Summary: Start the clm5_1 physics series, with some changes to the fire model from Fang Li + +Purpose of changes +------------------ + + +Fang's latest Fire version - includes allowing clm5.1 phys version. New physics option is added +called "clm5_1", with currently the new feature to use the latest fire changes. This has some +adjustments to the fire model and includes some changes to the parameter file. Other new features +will be added into clm5_1 in future tags. + +Also bring in mksurfdata changes for the raw urban dataset change. This adds some changes to +mksurfdata for a new urban raw dataset, as well as preparation for new changes for some other +urban changes that will be a future part of clm5_1. Also use the half degree lightning dataset +by default for clm5_1. + +Start adding a new test list ctsm_sci that tests all the scientifically supported compsets. +Some of those tests fail due to existing issues, that will be fixed later. + +Some more work done to change clm to ctsm, and allow for ctsm as a component. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fix #1142 -- Add ctsm_sci test list + Fix #1145 -- File was corrupted on glade + Fix #1144 -- Move btran2 to just inside of fire model + Fix #889 --- Some adjustments to the Li Fire model + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Adds clm5_1 option to CLM_PHYSICS_VERSION + clm5_1_GSWP3v1 is the only LND_TUNING_MDOE option for clm5_1 + New compsets added for CLM51 I2000Clm51BgcCropGs, I2000Clm51BgcGs, I1850Clm51BgcGs, IHistClm51BgcGs, IHistClm51BgcCropGs + + +Changes made to namelist defaults (e.g., changed parameter values): clm5_1 physics options added in + Add the ability to set the component name in filenames (default is still clm2, but can be clm4, olr clm5) + By default lightning dataset for clm5_1 is the half degree file + +Changes to the datasets (e.g., parameter, surface or initial files): All params files updated with new fields for fire + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: Add ctsm_sci test list and move some clm5_0 to clm5_1 and one one clm5_1 specific test + +Code reviewed by: self + + +CTSM testing: regular, tools + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (853 tests are different) + + tools-tests (test/tools): + + cheyenne - PASS + + python testing (see instructions in python/README.md; document testing done): + + cheyenne -- PASS + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No (although clm5_1 is a new physics option that is different) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + #1151 -- Move btran2 to inside CNFireBase + #1150 -- ctsm5.1 starting point + #1157 -- Urban mksurfdata_map changes + +=============================================================== +=============================================================== Tag name: ctsm1.0.dev113 Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) Date: Tue Sep 8 15:57:49 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 205a0e665a..dd335bc839 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev001 erik 09/23/2020 Start the clm5_1 physics series, with some changes to the fire model from Fang Li ctsm1.0.dev113 negins 09/08/2020 Some bit-for-bit changes needed for the Perturbed Parameter Ensemble work ctsm1.0.dev112 sacks/ww 08/28/2020 Small changes to mksurfdata_map, singlept tool and run_sys_tests ctsm1.0.dev111 erik 08/28/2020 Compsets don't use 2014 for GSWP3 forcing, LUNA prevyr changed back From c037b5472ce07c49d09ce7145293956dcf9b6a52 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 23 Sep 2020 02:29:25 -0600 Subject: [PATCH 1475/1973] More change file updates --- doc/ChangeLog | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 488f65d422..c7d2df54d2 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,14 +1,13 @@ =============================================================== Tag name: ctsm5.1.dev001 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Sep 23 02:16:01 MDT 2020 +Date: Wed Sep 23 02:29:08 MDT 2020 One-line Summary: Start the clm5_1 physics series, with some changes to the fire model from Fang Li Purpose of changes ------------------ - -Fang's latest Fire version - includes allowing clm5.1 phys version. New physics option is added +Fang Li's latest Fire version - includes allowing clm5.1 phys version. New physics option is added called "clm5_1", with currently the new feature to use the latest fire changes. This has some adjustments to the fire model and includes some changes to the parameter file. Other new features will be added into clm5_1 in future tags. @@ -114,6 +113,8 @@ Pull Requests that document the changes (include PR ids): #1151 -- Move btran2 to inside CNFireBase #1150 -- ctsm5.1 starting point #1157 -- Urban mksurfdata_map changes + #1149 -- LILACSMOKE test change + #1146 -- Add --project to LILACS create_newcase =============================================================== =============================================================== From 85e00062ecbddd081fccea214b7e3900c65db1cc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 23 Sep 2020 23:35:48 -0600 Subject: [PATCH 1476/1973] Set onset_thresh_depends_on_veg and min_crtical_dayl_depends_on_lat to true for ctsm5.1 --- bld/CLMBuildNamelist.pm | 23 +++++++++++++++++++ bld/namelist_files/namelist_defaults_ctsm.xml | 5 ++++ 2 files changed, 28 insertions(+) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index ae53889fa2..2fbb8fa477 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1626,6 +1626,11 @@ sub process_namelist_inline_logic { ################################## setup_logic_bgc_shared($opts, $nl_flags, $definition, $defaults, $nl, $physv); + ################################## + # namelist group: cnphenology + ################################## + setup_logic_cnphenology($opts, $nl_flags, $definition, $defaults, $nl, $physv); + ############################################# # namelist group: soilwater_movement_inparm # ############################################# @@ -2635,6 +2640,24 @@ sub setup_logic_bgc_shared { #------------------------------------------------------------------------------- +sub setup_logic_cnphenology { + my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; + + my @list = ( "onset_thresh_depends_on_veg", "min_crtical_dayl_depends_on_lat" ); + foreach my $var ( @list ) { + if ( &value_is_true($nl_flags->{'use_cn'}) ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, + 'phys'=>$physv->as_string(), 'use_cn'=>$nl_flags->{'use_cn'} ); + } else { + if ( defined($nl->get_value($nl->get_value($var))) ) { + $log->fatal_error("$var should only be set if use_cn is on"); + } + } + } +} + +#------------------------------------------------------------------------------- + sub setup_logic_supplemental_nitrogen { # # Supplemental Nitrogen for prognostic crop cases diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 7a7bbe7ddb..5418372eae 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -541,6 +541,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 3.d00 1.d00 + +.true. +.true. +.false. +.false. 0.5 From 936f85d0ebd78312f16bc15c21fdf13a1a974ccf Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 24 Sep 2020 00:04:08 -0600 Subject: [PATCH 1477/1973] Add test for onset_thresh_depends_on_veg set when use_cn is false and get it to work --- bld/CLMBuildNamelist.pm | 2 +- bld/unit_testers/build-namelist_test.pl | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 2fbb8fa477..17d37a4aac 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -2649,7 +2649,7 @@ sub setup_logic_cnphenology { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'phys'=>$physv->as_string(), 'use_cn'=>$nl_flags->{'use_cn'} ); } else { - if ( defined($nl->get_value($nl->get_value($var))) ) { + if ( defined($nl->get_value($var)) ) { $log->fatal_error("$var should only be set if use_cn is on"); } } diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index db441b045c..f647a1026d 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,7 +138,7 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 1516; +my $ntests = 1517; if ( defined($opts{'compare'}) ) { $ntests += 1017; } @@ -446,6 +446,11 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, + "onset_threh w SP" =>{ options=>" -envxml_dir . -bgc sp", + namelst=>"onset_thresh_depends_on_veg=.true.", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_1", + }, "dribble_crphrv w/o CN" =>{ options=>" -envxml_dir . -bgc sp", namelst=>"dribble_crophrv_xsmrpool_2atm=.true.", GLC_TWO_WAY_COUPLING=>"FALSE", From 53ee045258a69eb3157e0daab77b5fc018da43fc Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 24 Sep 2020 15:14:07 -0400 Subject: [PATCH 1478/1973] updated fates allvars list of history variables --- .../clm/FatesAllVars/user_nl_clm | 68 +++++++++++-------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm index 4d488d3c33..cc7d37aab9 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm @@ -3,31 +3,43 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .false. fates_spitfire_mode = 1 -hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE','GPP_BY_AGE','PARSUN_Z_CNLF','PARSHA_Z_CNLF','PARSUN_Z_CNLFPFT', - 'PARSHA_Z_CNLFPFT','PARSUN_Z_CAN','PARSHA_Z_CAN','LAISUN_Z_CNLF','LAISHA_Z_CNLF','LAISUN_Z_CNLFPFT','LAISHA_Z_CNLFPFT', - 'LAISUN_TOP_CAN','LAISHA_TOP_CAN','FABD_SUN_CNLFPFT','FABD_SHA_CNLFPFT','FABI_SUN_CNLFPFT','FABI_SHA_CNLFPFT', - 'FABD_SUN_CNLF','FABD_SHA_CNLF','FABI_SUN_CNLF','FABI_SHA_CNLF','FABD_SUN_TOPLF_BYCANLAYER','FABD_SHA_TOPLF_BYCANLAYER', - 'FABI_SUN_TOPLF_BYCANLAYER','FABI_SHA_TOPLF_BYCANLAYER','NET_C_UPTAKE_CNLF','CROWNAREA_CNLF', - 'MORTALITY_CARBONFLUX_CANOPY','MORTALITY_CARBONFLUX_UNDERSTORY','NPLANT_SCAG','NPLANT_CANOPY_SCAG','NPLANT_UNDERSTORY_SCAG', - 'DDBH_CANOPY_SCAG','DDBH_UNDERSTORY_SCAG','MORTALITY_CANOPY_SCAG','MORTALITY_UNDERSTORY_SCAG','GPP_SCPF','GPP_CANOPY_SCPF', - 'AR_CANOPY_SCPF','GPP_UNDERSTORY_SCPF','AR_UNDERSTORY_SCPF','NPP_SCPF','NPP_LEAF_SCPF','NPP_SEED_SCPF','NPP_FNRT_SCPF', - 'NPP_BGSW_SCPF','NPP_BGDW_SCPF','NPP_AGSW_SCPF','NPP_AGDW_SCPF','NPP_STOR_SCPF','DDBH_SCPF','DDBH_CANOPY_SCPF', - 'DDBH_UNDERSTORY_SCPF','BA_SCPF','NPLANT_SCPF','M1_SCPF','M2_SCPF','M3_SCPF','M4_SCPF','M5_SCPF','M6_SCPF','M7_SCPF', - 'MORTALITY_CANOPY_SCPF','BSTOR_CANOPY_SCPF','BLEAF_CANOPY_SCPF','NPLANT_CANOPY_SCPF','MORTALITY_UNDERSTORY_SCPF', - 'BSTOR_UNDERSTORY_SCPF','BLEAF_UNDERSTORY_SCPF','NPLANT_UNDERSTORY_SCPF','CWD_AG_CWDSC','CWD_BG_CWDSC','CWD_AG_IN_CWDSC', - 'CWD_BG_IN_CWDSC','CWD_AG_OUT_CWDSC','CWD_BG_OUT_CWDSC','AR_SCPF','AR_GROW_SCPF','AR_MAINT_SCPF','AR_DARKM_SCPF','AR_AGSAPM_SCPF', - 'AR_CROOTM_SCPF','AR_FROOTM_SCPF','DDBH_CANOPY_SCLS','DDBH_UNDERSTORY_SCLS','YESTERDAYCANLEV_CANOPY_SCLS', - 'YESTERDAYCANLEV_UNDERSTORY_SCLS','BA_SCLS','DEMOTION_RATE_SCLS','PROMOTION_RATE_SCLS','NPLANT_CANOPY_SCLS', - 'MORTALITY_CANOPY_SCLS','NPLANT_UNDERSTORY_SCLS','MORTALITY_UNDERSTORY_SCLS','TRIMMING_CANOPY_SCLS','TRIMMING_UNDERSTORY_SCLS', - 'CROWN_AREA_CANOPY_SCLS','CROWN_AREA_UNDERSTORY_SCLS','LEAF_MD_CANOPY_SCLS','ROOT_MD_CANOPY_SCLS','CARBON_BALANCE_CANOPY_SCLS', - 'SEED_PROD_CANOPY_SCLS', - 'NPP_LEAF_CANOPY_SCLS','NPP_FROOT_CANOPY_SCLS','NPP_BSW_CANOPY_SCLS','NPP_BDEAD_CANOPY_SCLS','NPP_BSEED_CANOPY_SCLS', - 'NPP_STORE_CANOPY_SCLS','RDARK_CANOPY_SCLS','LIVESTEM_MR_CANOPY_SCLS','LIVECROOT_MR_CANOPY_SCLS','FROOT_MR_CANOPY_SCLS', - 'RESP_G_CANOPY_SCLS','RESP_M_CANOPY_SCLS','LEAF_MD_UNDERSTORY_SCLS','ROOT_MD_UNDERSTORY_SCLS','CARBON_BALANCE_UNDERSTORY_SCLS', - 'SEED_PROD_UNDERSTORY_SCLS', - 'NPP_LEAF_UNDERSTORY_SCLS','NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS', - 'NPP_BDEAD_UNDERSTORY_SCLS','NPP_BSEED_UNDERSTORY_SCLS','NPP_STORE_UNDERSTORY_SCLS','RDARK_UNDERSTORY_SCLS', - 'LIVESTEM_MR_UNDERSTORY_SCLS','LIVECROOT_MR_UNDERSTORY_SCLS','FROOT_MR_UNDERSTORY_SCLS','RESP_G_UNDERSTORY_SCLS', - 'RESP_M_UNDERSTORY_SCLS','LITTER_IN_ELEM','LITTER_OUT_ELEM','SEED_BANK_ELEM','SEEDS_IN_LOCAL_ELEM','SEEDS_IN_EXTERN_ELEM', - 'SEED_GERM_ELEM','SEED_DECAY','CBALANCE_ERROR_FATES','ERROR_FATES','LITTER_FINES_AG_ELEM','LITTER_FINES_BG_ELEM','LITTER_CWD_BG_ELEM', - 'LITTER_CWD_AG_ELEM','LITTER_CWD' +hist_fincl1 = 'PFTcrownarea','PFTcanopycrownarea','NCL_BY_AGE','NPATCH_BY_AGE', +'BIOMASS_BY_AGE','SECONDARY_FOREST_FRACTION','WOOD_PRODUCT','SECONDARY_FOREST_BIOMASS', +'SECONDARY_AREA_AGE_ANTHRO_DIST','SECONDARY_AREA_PATCH_AGE_DIST','C_STOMATA_BY_AGE','C_LBLAYER_BY_AGE', +'NPP_BY_AGE','GPP_BY_AGE','PARSUN_Z_CNLF','PARSHA_Z_CNLF', +'PARSUN_Z_CNLFPFT','PARSHA_Z_CNLFPFT','PARSUN_Z_CAN','PARSHA_Z_CAN', +'LAISUN_Z_CNLF','LAISHA_Z_CNLF','LAISUN_Z_CNLFPFT','LAISHA_Z_CNLFPFT', +'LAISUN_TOP_CAN','LAISHA_TOP_CAN','FABD_SUN_CNLFPFT','FABD_SHA_CNLFPFT', +'FABI_SUN_CNLFPFT','FABI_SHA_CNLFPFT','FABD_SUN_CNLF','FABD_SHA_CNLF', +'FABI_SUN_CNLF','FABI_SHA_CNLF','PARPROF_DIR_CNLFPFT','PARPROF_DIF_CNLFPFT', +'PARPROF_DIR_CNLF','PARPROF_DIF_CNLF','FABD_SUN_TOPLF_BYCANLAYER', +'FABD_SHA_TOPLF_BYCANLAYER','FABI_SUN_TOPLF_BYCANLAYER','FABI_SHA_TOPLF_BYCANLAYER', +'NET_C_UPTAKE_CNLF','CROWNAREA_CNLF','NPLANT_CANOPY_SCAG','NPLANT_UNDERSTORY_SCAG', +'DDBH_CANOPY_SCAG','DDBH_UNDERSTORY_SCAG','MORTALITY_CANOPY_SCAG','MORTALITY_UNDERSTORY_SCAG', +'NPLANT_SCAGPFT','NPP_AGEPFT','BIOMASS_AGEPFT','GPP_SCPF','GPP_CANOPY_SCPF', +'AR_CANOPY_SCPF','GPP_UNDERSTORY_SCPF','AR_UNDERSTORY_SCPF','NPP_SCPF', +'NPP_LEAF_SCPF','NPP_SEED_SCPF','NPP_FNRT_SCPF','NPP_BGSW_SCPF','NPP_BGDW_SCPF','NPP_AGSW_SCPF', +'NPP_AGDW_SCPF','NPP_STOR_SCPF','DDBH_SCPF','GROWTHFLUX_SCPF','GROWTHFLUX_FUSION_SCPF', +'DDBH_CANOPY_SCPF','DDBH_UNDERSTORY_SCPF','BA_SCPF','AGB_SCPF','NPLANT_SCPF', +'NPLANT_CAPF','M1_SCPF','M2_SCPF','M3_SCPF','M4_SCPF','M5_SCPF','CROWNFIREMORT_SCPF','CAMBIALFIREMORT_SCPF', +'M6_SCPF','M7_SCPF','M8_SCPF','M9_SCPF','M10_SCPF', +'M10_CAPF','MORTALITY_CANOPY_SCPF','C13disc_SCPF','BSTOR_CANOPY_SCPF','BLEAF_CANOPY_SCPF', +'NPLANT_CANOPY_SCPF','MORTALITY_UNDERSTORY_SCPF','BSTOR_UNDERSTORY_SCPF','BLEAF_UNDERSTORY_SCPF', +'NPLANT_UNDERSTORY_SCPF','CWD_AG_CWDSC','CWD_BG_CWDSC','CWD_AG_IN_CWDSC', +'CWD_BG_IN_CWDSC','CWD_AG_OUT_CWDSC','CWD_BG_OUT_CWDSC','AR_SCPF','AR_GROW_SCPF', +'AR_MAINT_SCPF','AR_DARKM_SCPF','AR_AGSAPM_SCPF','AR_CROOTM_SCPF','AR_FROOTM_SCPF', +'YESTERDAYCANLEV_CANOPY_SCLS','YESTERDAYCANLEV_UNDERSTORY_SCLS', +'BIOMASS_SCLS','DEMOTION_RATE_SCLS','PROMOTION_RATE_SCLS','SAI_CANOPY_SCLS','SAI_UNDERSTORY_SCLS', +'CARBON_BALANCE_CANOPY_SCLS','CARBON_BALANCE_UNDERSTORY_SCLS','TRIMMING_CANOPY_SCLS', +'TRIMMING_UNDERSTORY_SCLS','CROWN_AREA_CANOPY_SCLS','CROWN_AREA_UNDERSTORY_SCLS', +'LEAF_MD_CANOPY_SCLS','ROOT_MD_CANOPY_SCLS','BSTORE_MD_CANOPY_SCLS','BDEAD_MD_CANOPY_SCLS', +'BSW_MD_CANOPY_SCLS','SEED_PROD_CANOPY_SCLS','NPP_LEAF_CANOPY_SCLS','NPP_FROOT_CANOPY_SCLS', +'NPP_BSW_CANOPY_SCLS','NPP_BDEAD_CANOPY_SCLS','NPP_BSEED_CANOPY_SCLS', +'NPP_STORE_CANOPY_SCLS','RDARK_CANOPY_SCLS', +'LIVESTEM_MR_CANOPY_SCLS','LIVECROOT_MR_CANOPY_SCLS','FROOT_MR_CANOPY_SCLS','RESP_G_CANOPY_SCLS', +'RESP_M_CANOPY_SCLS','LEAF_MD_UNDERSTORY_SCLS','ROOT_MD_UNDERSTORY_SCLS','BSTORE_MD_UNDERSTORY_SCLS', +'BDEAD_MD_UNDERSTORY_SCLS','BSW_MD_UNDERSTORY_SCLS','SEED_PROD_UNDERSTORY_SCLS','NPP_LEAF_UNDERSTORY_SCLS', +'NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS','NPP_BDEAD_UNDERSTORY_SCLS','NPP_BSEED_UNDERSTORY_SCLS', +'NPP_STORE_UNDERSTORY_SCLS','RDARK_UNDERSTORY_SCLS','LIVESTEM_MR_UNDERSTORY_SCLS','LIVECROOT_MR_UNDERSTORY_SCLS', +'FROOT_MR_UNDERSTORY_SCLS','RESP_G_UNDERSTORY_SCLS','RESP_M_UNDERSTORY_SCLS','TOTVEGC_SCPF', +'LEAFC_SCPF','FNRTC_SCPF','SAPWC_SCPF','STOREC_SCPF','REPROC_SCPF','CEFFLUX_SCPF' From f6893b1a704a0901da4791988885b8ab47b7fdf9 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 24 Sep 2020 13:58:43 -0600 Subject: [PATCH 1479/1973] Changed the fates parteh 2 test to debug mode, removed an untested variable from fates allvars test list --- cime_config/testdefs/testlist_clm.xml | 2 +- cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index a0caf55a29..82ea2337a4 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1812,7 +1812,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm index cc7d37aab9..cd1daa4eea 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm @@ -23,7 +23,7 @@ hist_fincl1 = 'PFTcrownarea','PFTcanopycrownarea','NCL_BY_AGE','NPATCH_BY_ 'DDBH_CANOPY_SCPF','DDBH_UNDERSTORY_SCPF','BA_SCPF','AGB_SCPF','NPLANT_SCPF', 'NPLANT_CAPF','M1_SCPF','M2_SCPF','M3_SCPF','M4_SCPF','M5_SCPF','CROWNFIREMORT_SCPF','CAMBIALFIREMORT_SCPF', 'M6_SCPF','M7_SCPF','M8_SCPF','M9_SCPF','M10_SCPF', -'M10_CAPF','MORTALITY_CANOPY_SCPF','C13disc_SCPF','BSTOR_CANOPY_SCPF','BLEAF_CANOPY_SCPF', +'M10_CAPF','MORTALITY_CANOPY_SCPF','BSTOR_CANOPY_SCPF','BLEAF_CANOPY_SCPF', 'NPLANT_CANOPY_SCPF','MORTALITY_UNDERSTORY_SCPF','BSTOR_UNDERSTORY_SCPF','BLEAF_UNDERSTORY_SCPF', 'NPLANT_UNDERSTORY_SCPF','CWD_AG_CWDSC','CWD_BG_CWDSC','CWD_AG_IN_CWDSC', 'CWD_BG_IN_CWDSC','CWD_AG_OUT_CWDSC','CWD_BG_OUT_CWDSC','AR_SCPF','AR_GROW_SCPF', From 75d2118d99bd8579e41e19a4085397149c27b81e Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 24 Sep 2020 14:24:08 -0600 Subject: [PATCH 1480/1973] adding update for daily history output to FatesHydro testmod for ERS_D_Ld5 test --- cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm index 9b6cebc7a5..bd4ddb8b3e 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesHydro/user_nl_clm @@ -1,3 +1,5 @@ +hist_mfilt = 365 +hist_nhtfrq = -24 hist_empty_htapes = .true. use_fates_planthydro= .true. hist_fincl1 = 'FATES_ERRH2O_SCPF','FATES_TRAN_SCPF', From bd9e8ad751564903451533d770ec97e3d4f828ff Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 24 Sep 2020 16:15:07 -0600 Subject: [PATCH 1481/1973] Updating fates pointer to 1.42 api 14 --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index a776c6a271..448bb39a21 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.40.3_api.13.0.1 +tag = sci.1.42.0_api.14.0.0 required = True [PTCLM] From 332beefec6389f729f13d2b5093eb7ba41ff659d Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 24 Sep 2020 22:50:47 -0700 Subject: [PATCH 1482/1973] cleanup typo and empty logic set --- src/main/clm_driver.F90 | 8 -------- src/utils/clmfates_interfaceMod.F90 | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 6afb0c0003..561bbe0dff 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1058,14 +1058,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro end if ! use_fates branch - - if ( use_fates ) then - - - - end if - - ! ============================================================================ ! Create summaries of water diagnostic terms ! ============================================================================ diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index d778aa1260..1ed29195e9 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -909,7 +909,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! --------------------------------------------------------------------------------- ! Part III.2 (continued). - ! Update UpdateLdiagnostics of the FATES ecosystem structure that are used in the HLM. + ! Update diagnostics of the FATES ecosystem structure that are used in the HLM. ! --------------------------------------------------------------------------------- call this%wrap_update_hlmfates_dyn(nc, & bounds_clump, & From 003dd9e21f32d5bd398be349ed912886de1db75e Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 25 Sep 2020 08:46:17 -0600 Subject: [PATCH 1483/1973] Correction for LILACSMOKE test to pass; cheyenne test-suite now ok --- src/cpl/lilac/lnd_import_export.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index e5a405e089..581bdbedc8 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -247,7 +247,7 @@ subroutine import_fields( importState, bounds, first_call, rc) call derive_quantities(bounds, atm2lnd_inst, water_inst%wateratm2lndbulk_inst, forc_rainc, forc_rainl, forc_snowc, forc_snowl) - call check_for_errors(bounds, atm2lnd_inst, wateratm2lndbulk_inst) + call check_for_errors(bounds, atm2lnd_inst, water_inst%wateratm2lndbulk_inst) end subroutine import_fields From 5e45b94bf23761c00bb0ab9884fbff0cad02676a Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 25 Sep 2020 09:30:10 -0600 Subject: [PATCH 1484/1973] adding wrf-tools to docs source code --- .../lilac/specific-atm-models/index.rst | 1 + .../lilac/specific-atm-models/wrf-tools.rst | 80 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 doc/source/lilac/specific-atm-models/wrf-tools.rst diff --git a/doc/source/lilac/specific-atm-models/index.rst b/doc/source/lilac/specific-atm-models/index.rst index 03e45a9353..e2996135e1 100644 --- a/doc/source/lilac/specific-atm-models/index.rst +++ b/doc/source/lilac/specific-atm-models/index.rst @@ -8,3 +8,4 @@ :maxdepth: 2 wrf.rst + wrf-tools.rst diff --git a/doc/source/lilac/specific-atm-models/wrf-tools.rst b/doc/source/lilac/specific-atm-models/wrf-tools.rst new file mode 100644 index 0000000000..376f4ea5e4 --- /dev/null +++ b/doc/source/lilac/specific-atm-models/wrf-tools.rst @@ -0,0 +1,80 @@ +.. _wrf: + +.. highlight:: shell + +============================= + WRF-CTSM Tools and Utilities +============================= + +This section includes instructions on tools and utilities developed for +WRF-CTSM simulations. + + + +Generate CSTM surface dataset for a WRF domain +---------------------------------------------- + +Before this step, make sure you have successfully created geo_em* files for +your specific WRF domain using WPS. Instructions on how to run ``geogrid.exe`` +is described in here. + + +1. Create SCRIP grid file from WRF ``geo_em*`` files, using the following ncl + script:: + + ncl create_scrip_file.ncl + + This creates two files that are complements of each other only in the mask field + +2. Create mapping files by using ``mkmapdata`` code under + ``CTSM/tools/mkmapdata/``. + + Using environment variables set the following environment varibales needed + by ``mkunitymap.ncl`` code:: + + setenv GRIDFILE1 wrf2clm_ocean_noneg.nc + setenv GRIDFILE2 wrf2clm_land_noneg.nc + setenv MAPFILE wrf2clm_mapping_noneg.nc + setenv PRINT TRUE + + ncl mkunitymap.ncl + + +.. warning::: + + This will throw some git errors if not run in a repository. + +3. Create ESMF mapping files by running ``regridbatch.sh``:: + + qsub regridbatch.sh + +4. In your ctsm repository directory, build:: + + ../../../configure --macros-format Makefile --mpilib mpi-serial + + +5. Generate CTSM domain files using ``get_domain`` tool:: + + ./gen_domain -m /glade/work/$USER/ctsm/nldas_grid/scrip/wrf2clm_mapping_noneg.nc -o wrf2clm_ocn_noneg -l wrf2clm_lnd_noneg + +6. Create surface datasets in ``tools/mksurfdata_map``:: + + ./mksurfdata.pl -res usrspec -usr_gname "nldas" -usr_gdate "190124" -usr_mapdir "/glade/work/$USER/ctsm/nldas_grid/map" -y 2000 -exedir "/glade/u/home/$USER/src/ctsm/ctsm_surfdata/tools/mksurfdata_map" -no-crop + + + +Merge WRF initial conditions into an existing CTSM initial condition file +-------------------------------------------------------------------------- + +The following procedure is if you'd wish to merget WRF inital conditions from +``wrfinput`` file into CTSM initial condition file :: + + + ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="the_existing_finidat_file.nc"' 'wrfinput="your_wrfinput_file"' 'merged="the_merged_finidat_file.nc"' + + +.. todo:: + + Sam, can you please make the above ncl script available. + + From df7d9a3c0d8af7bc57afc29ba41e5f9104a448e4 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 25 Sep 2020 09:31:54 -0600 Subject: [PATCH 1485/1973] updating wrf branch for release --- doc/source/lilac/specific-atm-models/wrf.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 33f3746d84..ee93089b24 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -35,11 +35,11 @@ and :numref:`wrf-set-ctsm-runtime-options`. Clone WRF and CTSM Repositories ------------------------------- -Clone the WRF CTSM feature branch:: +Clone the WRF repository and checkout `develop` branch:: git clone https://github.com/wrf-model/WRF.git WRF-CTSM cd WRF-CTSM - git checkout ctsm_coupling + git checkout develop Clone the CTSM repository:: @@ -48,9 +48,6 @@ Clone the CTSM repository:: cd CTSM ./manage_externals/checkout_externals -.. todo:: - - update the git address to WRF repository and feature branch... .. _build-CTSM-and-dependencies: From 14a16e82262ade5092e97f4605ea68ea1a05252c Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 25 Sep 2020 09:40:10 -0600 Subject: [PATCH 1486/1973] Test-suite results reported in ChangeLog --- doc/ChangeLog | 18 +++--------------- doc/ChangeSum | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index db375649e1..efea12cd47 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev002 Originator(s): slevis (Samuel Levis,303-665-1310) -Date: Mon Aug 17 12:35:19 MDT 2020 +Date: Mon Sep 25 09:39:19 MDT 2020 One-line Summary: Reduce duplication between caps Purpose of changes @@ -59,18 +59,6 @@ Code reviewed by: @billsacks @slevisconsulting CTSM testing: -[... Remove before making master tag. Available test levels: - - a) regular (must be run before handing off a tag to SEs and must be run - before committing a tag) - b) build_namelist (if namelists and/or build_system changed)) - c) tools (only if tools are modified and no CTSM source is modified) - d) short (for use during development and in rare cases where only a small - change with known behavior is added ... eg. a minor bug fix) - e) doc (no source testing required) - -... ] - [PASS means all tests PASS and OK means tests PASS other than expected fails.] build-namelist tests: @@ -91,8 +79,8 @@ CTSM testing: regular tests (aux_clm): - cheyenne ---- - izumi ------- + cheyenne ---- OK + izumi ------- PASS If the tag used for baseline comparisons was NOT the previous tag, note that here: diff --git a/doc/ChangeSum b/doc/ChangeSum index bc4b7a8c5d..1cc194b584 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev002 slevis 09/24/2020 Reduce duplication between caps + ctsm5.1.dev002 slevis 09/25/2020 Reduce duplication between caps ctsm5.1.dev001 erik 09/23/2020 Start the clm5_1 physics series, with some changes to the fire model from Fang Li ctsm1.0.dev113 negins 09/08/2020 Some bit-for-bit changes needed for the Perturbed Parameter Ensemble work ctsm1.0.dev112 sacks/ww 08/28/2020 Small changes to mksurfdata_map, singlept tool and run_sys_tests From 3ea45a66d515487deab0b90dca845bf177a77caa Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 25 Sep 2020 09:53:57 -0600 Subject: [PATCH 1487/1973] Minor ChangeLog edits --- doc/ChangeLog | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index efea12cd47..50815f25d7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -16,7 +16,7 @@ Purpose of changes Bugs fixed or introduced ------------------------ -Issues fixed (include CTSM Issue #): #918 #1094 +Issues fixed (include CTSM Issue #): #918 Significant changes to scientifically-supported configurations @@ -120,11 +120,10 @@ Detailed list of changes file /src/utils/lnd_import_export_utils.F90. List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): - Modified code in /src/cpl @billsacks IS THAT CONSIDERED AN EXTERNAL DIRECTORY? Pull Requests that document the changes (include PR ids): https://github.com/ESCOMP/CTSM/pull/1086 - + https://github.com/ESCOMP/CTSM/pull/1094 =============================================================== =============================================================== Tag name: ctsm5.1.dev001 From 3ab74de5a347518f13129645b16ad35681218e60 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 25 Sep 2020 11:04:33 -0600 Subject: [PATCH 1488/1973] Add a single-point test that exercises dynamic lakes --- cime_config/testdefs/testlist_clm.xml | 10 ++++++++++ .../clm/smallville_dynlakes_monthly/include_user_mods | 1 + .../clm/smallville_dynlakes_monthly/user_nl_clm | 9 +++++++++ 3 files changed, 20 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 1d6552493f..520fb03fa1 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1392,6 +1392,16 @@ for ERS test as otherwise it won't work for a sub-day test" + + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/include_user_mods new file mode 100644 index 0000000000..399579f425 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/include_user_mods @@ -0,0 +1 @@ +../monthly diff --git a/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm new file mode 100644 index 0000000000..49f6dc9e8b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm @@ -0,0 +1,9 @@ +do_transient_lakes = .true. + +! This file was created with the following command: +! ncap2 -s 'PCT_LAKE=array(0.0,0.0,PCT_CROP); PCT_LAKE={0.,50.,25.,25.,25.,25.}; HASLAKE=array(1.,1.,AREA)' landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200923.nc +! Key points are that lake area starts as 0, increases after the first +! year, then decreases after the second year. +! Note that the use of this file means that this testmod can only be +! used with the 1x1_smallvilleIA grid. +flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200923.nc' From d6bcdd49def5de98c097279e2b8e9699c9e1350f Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 25 Sep 2020 12:22:44 -0600 Subject: [PATCH 1489/1973] some small docs changes. --- doc/source/lilac/specific-atm-models/wrf-tools.rst | 4 ++-- doc/source/lilac/specific-atm-models/wrf.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf-tools.rst b/doc/source/lilac/specific-atm-models/wrf-tools.rst index 376f4ea5e4..a651abeb51 100644 --- a/doc/source/lilac/specific-atm-models/wrf-tools.rst +++ b/doc/source/lilac/specific-atm-models/wrf-tools.rst @@ -11,7 +11,7 @@ WRF-CTSM simulations. -Generate CSTM surface dataset for a WRF domain +Generate CTSM surface dataset for a WRF domain ---------------------------------------------- Before this step, make sure you have successfully created geo_em* files for @@ -40,7 +40,7 @@ is described in here. ncl mkunitymap.ncl -.. warning::: +.. warning:: This will throw some git errors if not run in a repository. diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index ee93089b24..4f81c56424 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -35,7 +35,7 @@ and :numref:`wrf-set-ctsm-runtime-options`. Clone WRF and CTSM Repositories ------------------------------- -Clone the WRF repository and checkout `develop` branch:: +Clone the WRF repository and checkout ``develop`` branch:: git clone https://github.com/wrf-model/WRF.git WRF-CTSM cd WRF-CTSM @@ -147,7 +147,7 @@ distributed memory parallelization (``dmpar``). recommended for compiling WRF. The next prompt requests an option for nesting. Currently nesting is not -available for WRF-CTSM so select option 1 (basic). +available for WRF-CTSM so select option ``1 (basic)``. Now compile em_real and save the log:: From 2898fcf3743e89b72260b95157a038cef228c3b3 Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 25 Sep 2020 13:38:34 -0600 Subject: [PATCH 1490/1973] copying the updated namelist.input file (option update and duration update) --- doc/source/lilac/specific-atm-models/wrf.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 4f81c56424..f1118973e9 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -358,9 +358,9 @@ in our directory. If you plan to use this example's preexisting files, copy the following files to your WRF run directory:: - ln -sf /glade/work/slevis/git_wrf/WRF/test/em_real/namelist.input.ctsm.2013.d01.12month namelist.input - ln -sf /glade/work/slevis/git_wrf/WRF/test/em_real/wrfinput_d01.ERAI.12month wrfinput_d01 - ln -sf /glade/work/slevis/git_wrf/WRF/test/em_real/wrfbdy_d01.ERAI.12month wrfbdy_d01 + cp /glade/scratch/negins/wrf_ctsm_files/namelist.input . + cp /glade/scratch/negins/wrf_ctsm_files/wrfinput_d01 . + cp /glade/scratch/negins/wrf_ctsm_files/wrfbdy_d01 . Now run WRF-CTSM. On Cheyenne this means submitting a batch job to PBS (Pro workload management system). Please check NCAR CISL's `instructions on running a batch job on Cheyenne. From 8ff6ca324634026f963506c6353568bf42f0c3a3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 25 Sep 2020 14:49:11 -0600 Subject: [PATCH 1491/1973] Turn off methane in dynlakes test I was getting a gridcell-level methane balance check error when running ERS_Lm25.1x1_smallvilleIA.IHistClm50BgcCropQianRsGs.cheyenne_gnu.clm-smallville_dynlakes_monthly. I'm thinking it was due to ESCOMP/CTSM#43. So for now, I'm disabling methane in this testmod. (I thought about changing it to an Sp case, but (1) currently you're not allowed to run smallville in an Sp case, and (2) it would be nice to exercise as much of the BGC code as possible in this test, to exercise the dynamic landunit conservation code for BGC variables.) --- .../testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm | 4 ++++ src/biogeochem/ch4Mod.F90 | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm index 49f6dc9e8b..7102f7052d 100644 --- a/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm @@ -7,3 +7,7 @@ do_transient_lakes = .true. ! Note that the use of this file means that this testmod can only be ! used with the 1x1_smallvilleIA grid. flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200923.nc' + +! BUG(wjs, 2020-09-25, ESCOMP/CTSM#43) Dynamic lakes don't work when methane is active, +! so for now disable methane for this test. +use_lch4 = .false. diff --git a/src/biogeochem/ch4Mod.F90 b/src/biogeochem/ch4Mod.F90 index 2432b85cf4..0155dd5019 100644 --- a/src/biogeochem/ch4Mod.F90 +++ b/src/biogeochem/ch4Mod.F90 @@ -1251,7 +1251,7 @@ subroutine DynamicColumnAdjustments(this, bounds, clump_index, column_state_upda character(len=*), parameter :: subname = 'DynamicColumnAdjustments' !----------------------------------------------------------------------- - ! BUG(wjs, 2016-02-16, bugz 2283) Need to do some special handling of finundated for + ! BUG(wjs, 2016-02-16, ESCOMP/CTSM#43) Need to do some special handling of finundated for ! increases in lake area, since lakes are assumed to be 100% inundated. Probably it's ! most appropriate for this special handling to happen elsewhere - i.e., within this ! routine, we do the standard adjustments as they are currently done, but then in the From 81fe6ead18ac7df2f1fa4f14342aa76cd67ceb76 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 25 Sep 2020 14:12:02 -0700 Subject: [PATCH 1492/1973] adding soilbiogeochem scalar outputs pass to fates bc_in --- src/utils/clmfates_interfaceMod.F90 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 1ed29195e9..140c74267c 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -799,6 +799,11 @@ subroutine dynamics_driv(this, nc, bounds_clump, & nlevsoil = this%fates(nc)%bc_in(s)%nlevsoil + ! Decomposition fluxes + this%fates(nc)%bc_in(s)%w_scalar_sisl(1:nlevsoil) = soilbiogeochem_carbonflux_inst%w_scalar_col(c,1:nlevsoil) + this%fates(nc)%bc_in(s)%t_scalar_sisl(1:nlevsoil) = soilbiogeochem_carbonflux_inst%t_scalar_col(c,1:nlevsoil) + + ! Soil water this%fates(nc)%bc_in(s)%h2o_liqvol_sl(1:nlevsoil) = & waterstatebulk_inst%h2osoi_vol_col(c,1:nlevsoil) From c138a0b24087a6b481a7ccde962b8edeee9aae77 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Sep 2020 22:41:31 -0600 Subject: [PATCH 1493/1973] Make sure 'Changes answers relative to baseline:' lines have an answer on the same line --- doc/ChangeLog | 523 ++------------------------------------------------ 1 file changed, 17 insertions(+), 506 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 50815f25d7..eda6b83549 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -88,10 +88,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): +Changes answers relative to baseline: Yes Summarize any changes to answers, i.e., - what code configurations: All @@ -794,10 +791,6 @@ Answer changes Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Clm50 with Bgc or Cn - what platforms/compilers: all @@ -1565,8 +1558,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: - No +Changes answers relative to baseline: No Detailed list of changes ------------------------ @@ -1679,9 +1671,6 @@ Answer changes Changes answers relative to baseline: Yes for clm5_0 - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: clm5_0 when Luna on as well as smaller changes for urban - what platforms/compilers: all @@ -2042,9 +2031,6 @@ Answer changes Changes answers relative to baseline: YES, just on izumi due to machine updates - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: some izumi tests - what platforms/compilers: izumi gnu & pgi @@ -2317,9 +2303,6 @@ Changes answers relative to baseline: YES, but diagnostic only due to change in dimension sizes - does not change answers in any meaningful way - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Transient CLM50 cases with crops; just changes dimensions on vector (h1) history files @@ -2461,7 +2444,6 @@ Answer changes Changes answers relative to baseline: No - Detailed list of changes ------------------------ @@ -2570,9 +2552,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: - cheyenne_gnu - due to compiler version update @@ -2585,16 +2564,6 @@ Changes answers relative to baseline: YES in dcaad375 - i.e., the rework of the initialization logic for fire didn't change answers - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -3135,9 +3104,6 @@ Answer changes Changes answers relative to baseline: YES, in theory (but none in test suite) - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: potentially all, but very rarely - what platforms/compilers: all @@ -3147,16 +3113,6 @@ Changes answers relative to baseline: YES, in theory (but none in test suite) Potentially changes answers by roundoff (see notes above), but no changes were observed in any test in the test suite - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -3522,9 +3478,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -3550,16 +3503,6 @@ Changes answers relative to baseline: YES FAIL SMS_D_Lm6_P144x1.f45_f45_mg37.I2000Clm50Fates.cheyenne_intel.clm-FatesColdDef BASELINE ctsm1.0.dev087: DIFF FAIL SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev087: DIFF - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -3674,10 +3617,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): +Changes answers relative to baseline: Yes (only Non-SP cases with NWP) Summarize any changes to answers, i.e., - what code configurations: Non-SP cases with NWP or non-standard @@ -3698,16 +3638,6 @@ Changes answers relative to baseline: happen to be the appropriate PFTs present to show differences in this short, coarse-resolution test. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -3831,9 +3761,6 @@ Answer changes Changes answers relative to baseline: YES (just for NUOPC configurations) - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Just some NUOPC configurations - what platforms/compilers: @@ -3846,16 +3773,6 @@ Changes answers relative to baseline: YES (just for NUOPC configurations) suite, however, because the only nuopc test in the test suite is new in this tag (so did not have baselines). - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -4305,9 +4222,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -4318,16 +4232,6 @@ Changes answers relative to baseline: YES Possibility of other answer changes in rare circumstances, not observed in testing. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -4429,8 +4333,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: - No +Changes answers relative to baseline: No @billsacks recommended running a global test in the branch vs. in master (i.e. with vs. without the code mods) to compare restart files because the test suite @@ -4554,9 +4457,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Cases at f10 resolution - what platforms/compilers: all @@ -4565,16 +4465,6 @@ Changes answers relative to baseline: YES Answer changes are due to https://github.com/esmci/cime/pull/3186 - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -4802,9 +4692,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Clm50Bgc (cases with both use_hydrstress=.true. and methane active) - what platforms/compilers: all @@ -4814,12 +4701,9 @@ Changes answers relative to baseline: YES For details on differences, see https://github.com/ESCOMP/CTSM/issues/812#issuecomment-547924289 - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - If this tag changes climate describe the run(s) done to evaluate the new climate (put details of the simulations in the experiment database) - - casename: N/A + - casename: clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist URL for LMWG diagnostics output used to validate new climate: http://webext.cgd.ucar.edu/I20TR/clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist/lnd/clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist.1995_2014-clm50_ctsm10d074_2deg_GSWP3V1_hist.1995_2014/setsIndex.html @@ -4974,9 +4858,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -5000,16 +4881,6 @@ Changes answers relative to baseline: YES For the non-default use_subgrid_fluxes = .false., there differences in the natural vegetation and crop landunits, too. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -5121,25 +4992,12 @@ Answer changes Changes answers relative to baseline: YES, but just for the diagnostic field FSNO_EFF - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all - nature of change (roundoff; larger than roundoff/same climate; new climate): diagnostic only: just changes FSNO_EFF - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -5255,9 +5113,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -5290,16 +5145,6 @@ Changes answers relative to baseline: YES https://github.com/ESCOMP/CTSM/issues/658#issuecomment-546740771 for more details. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -5433,9 +5278,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -5452,16 +5294,6 @@ Changes answers relative to baseline: YES in FSH in the h1 (vector) history file. Diffs were only over lake points. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -5564,9 +5396,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -5582,16 +5411,6 @@ Changes answers relative to baseline: YES greater differences, with the biggest difference being about 0.1 W m-2. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -5806,25 +5625,12 @@ Answer changes Changes answers relative to baseline: YES, but only for the (default-inactive) field QFLX_EVAP_VEG - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff, but only for the default-inactive field QFLX_EVAP_VEG - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -6047,9 +5853,6 @@ Answer changes Changes answers relative to baseline: YES, but just for select diagnostic fields - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: ALL - what platforms/compilers: ALL @@ -6070,16 +5873,6 @@ Changes answers relative to baseline: YES, but just for select diagnostic fields diagnostic field, in transient cases, although no differences were observed for this field in the test suite (see ESCOMP/ctsm#31). - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -6393,7 +6186,6 @@ Answer changes Changes answers relative to baseline: NO - Detailed list of changes ------------------------ @@ -6498,9 +6290,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -6646,15 +6435,6 @@ Changes answers relative to baseline: YES int_snow(c) = int_snow(c) + frac_sno_eff(c) & * (qflx_dew_snow(c) + qflx_dew_grnd(c) + qflx_liq_grnd(c)) * dtime - - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -6898,8 +6678,7 @@ Changes answers relative to baseline: Yes! If this tag changes climate describe the run(s) done to evaluate the new climate (put details of the simulations in the experiment database) - - casename: - oleson/clm50_cesm20R_2deg_GSWP3V1_issue780_hist (for the fire change) + - casename: oleson/clm50_cesm20R_2deg_GSWP3V1_issue780_hist (for the fire change) URL for LMWG diagnostics output used to validate new climate: http://webext.cgd.ucar.edu/I20TR/clm50_cesm20R_2deg_GSWP3V1_issue780_hist/lnd/clm50_cesm20R_2deg_GSWP3V1_issue780_hist.1995_2014-clm50_cesm20R_2deg_GSWP3V1_hist.1995_2014/setsIndex.html @@ -7307,9 +7086,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: potentially all, though only show up in a few tests @@ -7347,14 +7123,6 @@ Changes answers relative to baseline: YES were bit-for-bit with each other, giving me more confidence that I didn't make a mistake with either implementation. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -7566,10 +7334,10 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: +Changes answers relative to baseline: Yes Summarize any changes to answers, i.e., - - what code configurations: not clm45 + - what code configurations: not clm45 (clm5_0 and ctsm5_0-nwp) - what platforms/compilers: all - nature of change: larger than roundoff/same climate based on the assumption that shifting soil texture assignments by @@ -7716,9 +7484,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -7739,13 +7504,6 @@ Changes answers relative to baseline: YES the old by more than 1e-13; this was not triggered for any test in the aux_clm test suite. - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A (Keith Oleson will run this) - - URL for LMWG diagnostics output used to validate new climate: N/A (Keith Oleson will run this) - - Detailed list of changes ------------------------ @@ -7861,9 +7619,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -8720,10 +8475,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): +Changes answers relative to baseline: Yes (roundoff level) Summarize any changes to answers, i.e., - what code configurations: Many/all @@ -8736,13 +8488,6 @@ Changes answers relative to baseline: If bitwise differences were observed, how did you show they were no worse than roundoff? via summarize_cprnc_diffs - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -8844,7 +8589,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: +Changes answers relative to baseline: Yes (when methane on) Summarize any changes to answers, i.e., - what code configurations: use_lch4 = .true. @@ -8934,7 +8679,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes +Changes answers relative to baseline: Yes (roundoff level change when MOSART on) Summarize any changes to answers, i.e., - what code configurations: some compsets with mosart @@ -9179,9 +8924,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -9208,16 +8950,6 @@ Changes answers relative to baseline: YES potentially have a significant impact on select grid cells, and on some variables in polar regions - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -9347,10 +9079,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): +Changes answers relative to baseline: Yes (mostly roundoff) Summarize any changes to answers, i.e., - what code configurations: all @@ -9407,14 +9136,6 @@ Changes answers relative to baseline: end subroutine initialize2 end module clm_initializeMod - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: n/a - - URL for LMWG diagnostics output used to validate new climate: n/a - - Detailed list of changes ------------------------ @@ -9522,10 +9243,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): +Changes answers relative to baseline: YES (should be small) Summarize any changes to answers, i.e., - what code configurations: all @@ -9537,17 +9255,6 @@ Changes answers relative to baseline: YES change the timing of snow capping a bit, but I haven't looked closely at the magnitude of the answer changes. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -9887,7 +9594,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes! +Changes answers relative to baseline: Yes! (roundoff) Summarize any changes to answers, i.e., - what code configurations: ALL @@ -10028,10 +9735,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): +Changes answers relative to baseline: YES (roundoff) Summarize any changes to answers, i.e., - what code configurations: all @@ -10093,13 +9797,6 @@ Changes answers relative to baseline: YES (SMS_D_Ld1.f19_g17.I1850Clm45Cn.hobart_gnu.clm-default; old: -8.15e-322, new: -2e-323). - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -10206,7 +9903,7 @@ CTSM tag used for the baseline comparisons: Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (single precision roundoff) Summarize any changes to answers, i.e., - what code configurations: ALL - what platforms/compilers: ALL @@ -10329,9 +10026,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all - what platforms/compilers: all @@ -10339,17 +10033,6 @@ Changes answers relative to baseline: YES larger than roundoff; likely same climate, but this still requires investigation - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A (Keith Oleson will run this soon) - - URL for LMWG diagnostics output used to validate new climate: N/A - (Keith Oleson will run this soon) - - Detailed list of changes ------------------------ @@ -10519,7 +10202,6 @@ Answer changes Changes answers relative to baseline: NO - Detailed list of changes ------------------------ @@ -10623,9 +10305,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Present-day compsets (I2000, I1Pt; also I2010 once those compsets are added) - what platforms/compilers: all @@ -10636,16 +10315,6 @@ Changes answers relative to baseline: YES should be the same as before, but the alignment of model year to datm year changes. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -10752,13 +10421,6 @@ Changes answers relative to baseline: Only for Carbon isotopes on under transien - what platforms/compilers: All - nature of change: same climate for bulk Carbon, isotopic Carbon is quite different for regions with land-use change - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: - - URL for LMWG diagnostics output used to validate new climate: - - Detailed list of changes ------------------------ @@ -10878,10 +10540,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev034 Answer changes -------------- -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): +Changes answers relative to baseline: YES (roundoff) Summarize any changes to answers, i.e., - what code configurations: all @@ -10917,13 +10576,6 @@ Changes answers relative to baseline: YES Soon, we plan to do a more rigorous test to double check that this change is not climate-changing. - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -11051,9 +10703,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Clm45 compsets - what platforms/compilers: all @@ -11078,16 +10727,6 @@ Changes answers relative to baseline: YES ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline, which uses a clm45 initial file.) - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -11489,9 +11128,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: ALL, but different configurations show different levels of changes, as noted below @@ -11520,16 +11156,6 @@ Changes answers relative to baseline: YES ICE_CONTENT1, LIQUID_CONTENT1 and HEAT_CONTENT1, over grid cells containing some glacier area. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -11647,9 +11273,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: f19_g17, T31_g37 - what platforms/compilers: all @@ -11665,17 +11288,6 @@ Changes answers relative to baseline: YES - T31_g37: greater than roundoff-level, presumably due to new domain file from cime commit 4fcf592ee - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -11886,9 +11498,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: all configurations that still need use_init_interp = .true. - what platforms/compilers: all @@ -11966,16 +11575,6 @@ Changes answers relative to baseline: YES changes I saw sprinkled around the world for `ERP_Ld5.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-default`. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -12670,9 +12269,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: @@ -12691,16 +12287,6 @@ Changes answers relative to baseline: YES - nature of change (roundoff; larger than roundoff/same climate; new climate): See notes under "what code configurations" for details. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -12955,9 +12541,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Some CLM50 cases that are either cold start or (unusually) use a CLM45 initial conditions file; it's possible @@ -13007,16 +12590,6 @@ Changes answers relative to baseline: YES ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -13129,9 +12702,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: CLM50 cold start or transient (Hist) cases - what platforms/compilers: all @@ -13144,16 +12714,6 @@ Changes answers relative to baseline: YES and partly based on the fact that the only change in this tag is in cold start initialization of some values). - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -13277,9 +12837,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: many - what platforms/compilers: all @@ -13290,13 +12847,6 @@ Changes answers relative to baseline: YES If bitwise differences were observed, how did you show they were no worse than roundoff? via summarize_cprnc_diffs to see differences in the test suite - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -13525,9 +13075,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: All I compsets (except spinup test that uses cplhist datm forcing) - what platforms/compilers: All @@ -13538,16 +13085,6 @@ Changes answers relative to baseline: YES update: new presaero and CO2 datasets (https://github.com/esmci/cime/pull/2828) - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -14699,9 +14236,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Startup / Hybrid runs that include CISM (even NOEVOLVE) and do not use init_interp, due to: @@ -14720,16 +14254,6 @@ Changes answers relative to baseline: YES areas to match CISM's. In the new code, there are no C and N adjustments in the first time step from this adjustment. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -15567,9 +15091,6 @@ Answer changes Changes answers relative to baseline: YES - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - Summarize any changes to answers, i.e., - what code configurations: Essentially all (except CLM4) - what platforms/compilers: All @@ -15585,16 +15106,6 @@ Changes answers relative to baseline: YES investigated carefully) - QOVER diagnostic field: see (A4) note above - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ From d58b5ed9c5ca4c55fe5c3be65d8d0b7e9eb11530 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Sep 2020 23:12:28 -0600 Subject: [PATCH 1494/1973] Make sure tags with answer changes have short description on same line --- doc/ChangeLog | 119 ++++++++++++++++++-------------------------------- 1 file changed, 42 insertions(+), 77 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index eda6b83549..e8a8d94dca 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -88,7 +88,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes +Changes answers relative to baseline: Yes (Similar climate) Summarize any changes to answers, i.e., - what code configurations: All @@ -569,7 +569,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes +Changes answers relative to baseline: Yes (similar climate) Summarize any changes to answers, i.e., - what code configurations: (2010 and SSP compsets) and Clm50 with LUNA on (Bgc or Sp) @@ -789,7 +789,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (similar climate) Summarize any changes to answers, i.e., - what code configurations: Clm50 with Bgc or Cn @@ -797,9 +797,6 @@ Changes answers relative to baseline: YES - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff/same climate - If bitwise differences were observed, how did you show they were no worse - than roundoff? - If this tag changes climate describe the run(s) done to evaluate the new climate (put details of the simulations in the experiment database) @@ -807,10 +804,6 @@ Changes answers relative to baseline: YES a long simulation. Erik Kluzek thinks the changes were verified with single point simulations. - - URL for LMWG diagnostics output used to validate new climate: - - Detailed list of changes ------------------------ @@ -1034,7 +1027,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes! +Changes answers relative to baseline: Yes! (very small) Hist and SSP BGC compsets change answers because of the correction of the end year for ndep. You wouldn't think this would matter until you get to the end of the time-sequence -- but it @@ -1669,7 +1662,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes for clm5_0 +Changes answers relative to baseline: Yes for clm5_0 (important change required retuning) Summarize any changes to answers, i.e., - what code configurations: clm5_0 when Luna on as well as smaller changes for urban @@ -2042,16 +2035,6 @@ Changes answers relative to baseline: YES, just on izumi due to machine updates - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop - SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -2332,16 +2315,6 @@ way Other than this, there were FIELDLIST differences, as expected. - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -2550,7 +2523,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: @@ -2840,7 +2813,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes +Changes answers relative to baseline: Yes (small) Updates in all fsurdat files leads to changes in answers Also there are updated finidat files as they had to be interpolated @@ -3476,7 +3449,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (Small) Summarize any changes to answers, i.e., - what code configurations: all @@ -4220,7 +4193,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (only one diagnostic field) Summarize any changes to answers, i.e., - what code configurations: all @@ -4455,7 +4428,7 @@ was not run on ctsm1.0.dev079. Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (only f10, same climate) Summarize any changes to answers, i.e., - what code configurations: Cases at f10 resolution @@ -4690,7 +4663,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (PHS and methane) (same climate) Summarize any changes to answers, i.e., - what code configurations: Clm50Bgc (cases with both use_hydrstress=.true. and methane active) @@ -4856,7 +4829,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (Small) Summarize any changes to answers, i.e., - what code configurations: all @@ -5111,7 +5084,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (Small) Summarize any changes to answers, i.e., - what code configurations: all @@ -5276,7 +5249,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (same climate, only at startup) Summarize any changes to answers, i.e., - what code configurations: all @@ -5394,7 +5367,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: all @@ -5622,8 +5595,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES, but only for the -(default-inactive) field QFLX_EVAP_VEG +Changes answers relative to baseline: YES, but only for the (default-inactive) field QFLX_EVAP_VEG Summarize any changes to answers, i.e., - what code configurations: all @@ -6288,7 +6260,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (roundoff) Summarize any changes to answers, i.e., - what code configurations: all @@ -6550,7 +6522,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (roundoff) Summarize any changes to answers, i.e., - what code configurations: all @@ -6668,7 +6640,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes! +Changes answers relative to baseline: Yes! (important clm5_0-BGC) Summarize any changes to answers, i.e., - what code configurations: Clm50Bgc and some Clm45Bgc cases @@ -7084,7 +7056,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (roundoff) Summarize any changes to answers, i.e., - what code configurations: potentially all, though only show up in @@ -7334,7 +7306,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes +Changes answers relative to baseline: Yes (clm5) small Summarize any changes to answers, i.e., - what code configurations: not clm45 (clm5_0 and ctsm5_0-nwp) @@ -7482,7 +7454,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: all @@ -7617,7 +7589,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: all @@ -7673,13 +7645,6 @@ Changes answers relative to baseline: YES h2osno_no_layers(c) = h2osno_no_layers(c) + qflx_snow_grnd(c)*dtime ! snow water equivalent (mm) else - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Detailed list of changes ------------------------ @@ -8589,7 +8554,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes (when methane on) +Changes answers relative to baseline: Yes (when methane on) (diagnostic only) Summarize any changes to answers, i.e., - what code configurations: use_lch4 = .true. @@ -8922,7 +8887,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (similar climate) Summarize any changes to answers, i.e., - what code configurations: all @@ -9469,7 +9434,7 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: Yes! +Changes answers relative to baseline: Yes! (Important when FUN model on) Summarize any changes to answers, i.e., - what code configurations: Anything with use_FUN=T (so Clm50Bgc compsets) @@ -10024,7 +9989,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev038 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: all @@ -10303,7 +10268,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev036 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: Present-day compsets (I2000, I1Pt; also I2010 once those compsets are added) @@ -10701,7 +10666,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev033 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (clm4_5) Important Summarize any changes to answers, i.e., - what code configurations: Clm45 compsets @@ -11126,7 +11091,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev030 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (Important) Summarize any changes to answers, i.e., - what code configurations: ALL, but different configurations show @@ -11271,7 +11236,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev029 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (f19_g17, T31_g37 small) Summarize any changes to answers, i.e., - what code configurations: f19_g17, T31_g37 @@ -11496,7 +11461,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev027 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (just for initial conditions) Summarize any changes to answers, i.e., - what code configurations: all configurations that still need use_init_interp = .true. @@ -12267,7 +12232,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev021 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: @@ -12539,7 +12504,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev019 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (same climate) Summarize any changes to answers, i.e., - what code configurations: Some CLM50 cases that are either cold start @@ -12700,7 +12665,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev018 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: CLM50 cold start or transient (Hist) cases @@ -12835,7 +12800,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev017 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (roundoff) Summarize any changes to answers, i.e., - what code configurations: many @@ -13073,7 +13038,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev015 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (new presaesro and CO2 datasets) Summarize any changes to answers, i.e., - what code configurations: All I compsets (except spinup test that uses cplhist datm forcing) @@ -13509,7 +13474,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev012 Answer changes -------------- -Changes answers relative to baseline: Yes! +Changes answers relative to baseline: Yes! (Important) Summarize any changes to answers, i.e., - what code configurations: clm4_5/clm5_0 transient simulations without Crop (either Bgc or SP) @@ -14110,7 +14075,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev007 Answer changes -------------- -Changes answers relative to baseline: Yes! +Changes answers relative to baseline: Yes! (ndep files, and steams years) Summarize any changes to answers, i.e., - what code configurations: 1850_control or 20thC_transient for Clm50 @@ -14234,7 +14199,7 @@ CTSM tag used for the baseline comparisons: ctsm1.0.dev006 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (small) Summarize any changes to answers, i.e., - what code configurations: Startup / Hybrid runs that include CISM @@ -14886,7 +14851,7 @@ CLM tag used for the baseline comparisons: ctsm1.0.dev001 Answer changes -------------- -Changes answers relative to baseline: clm5_0 BGC configurations with FUN and clm5_0 with BGC for new 1850 ndep file +Changes answers relative to baseline: Yes, clm5_0 BGC configurations with FUN and clm5_0 with BGC for new 1850 ndep file Summarize any changes to answers, i.e., - what code configurations: All clm5_0 BGC due to NFIX fields, and clm5_0 1850 BGC due to new ndep file @@ -15089,7 +15054,7 @@ CLM tag used for the baseline comparisons: clm5.0.dev013 Answer changes -------------- -Changes answers relative to baseline: YES +Changes answers relative to baseline: YES (roundoff) Summarize any changes to answers, i.e., - what code configurations: Essentially all (except CLM4) From 7810dc14d2f2726cca51c7bfb504db921abe9c5d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Sep 2020 23:16:56 -0600 Subject: [PATCH 1495/1973] Create new changelog for the ctsm5.1 series, spinoff the ctsm1_0_ChangeLog --- doc/ChangeLog | 14841 --------------------------------------- doc/ctsm1_0_ChangeLog | 14843 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 14843 insertions(+), 14841 deletions(-) create mode 100644 doc/ctsm1_0_ChangeLog diff --git a/doc/ChangeLog b/doc/ChangeLog index e8a8d94dca..b8f8ae3d82 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -242,14844 +242,3 @@ Pull Requests that document the changes (include PR ids): =============================================================== =============================================================== -Tag name: ctsm1.0.dev113 -Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) -Date: Tue Sep 8 15:57:49 MDT 2020 -One-line Summary: Some bit-for-bit changes needed for the Perturbed Parameter Ensemble work - -Purpose of changes ------------------- - -Some BFB fixes including bug fixes needed for PPE simulations. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/CTSM#1060 (Some code cleanup of luna bug fixes) -- Resolves ESCOMP/CTSM#1062 (PPE namelist parameter defaults) -- Resolves ESCOMP/CTSM#1053 (Non-standard namelist parameter) -- Resolves ESCOMP/CTSM#1055 (Expand potential vcmax:jmax ratio) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -cmb_cmplt_fact was a parameter under namelist control pertaining to the fire -model (combusion completion factor [unitless]), which previously included an array. -This parameter is now splitted into two real values i.e. cmb_cmplt_fact_litter and -cmb_cmplt_fact_cwd. -If the users have cmb_cmplt_fact in a user_nl_clm file that worked before, it -won't work anymore since it is now splitted into cmb_cmplt_fact_litter -and cmb_cmplt_fact_cwd. - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -Previously, denitrif_nitrateconc_exponent and denitrif_nitrateconc_coefficient -were on the params file but ALSO on the namelist. They are now removed from the namelist. - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: [For timing changes, can check PFS -test(s) in the test suite] None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double -maintenance): None - -Changes to tests or testing: None - - -CTSM testing: - - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- PASS (except for NLCOMP) - izumi ------- PASS (except for NLCOMP) - -If the tag used for baseline comparisons was NOT the previous tag, note that here: -ctsm1.0.dev111 - - -Answer changes --------------- - -Changes answers relative to baseline: None - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -None - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/1102 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev112 -Originator(s): sacks (Bill Sacks), wwieder (Will Wieder) -Date: Fri Aug 28 17:10:57 MDT 2020 -One-line Summary: Small changes to mksurfdata_map, singlept tool and run_sys_tests - -Purpose of changes ------------------- - -(1) Move mksurfdata_map rounding of special landunits to before wetland - fill: I think this may be important to avoid errors and/or wrong - behavior in some edge cases where we have < 0.5% cover of glacier - and/or lake, and other cases. See - https://github.com/ESCOMP/CTSM/issues/1118 for detailed - thoughts. May change answers in rare cases, but no answer changes - observed for present-day surface datasets at standard resolutions - (f09, f19, f10, f45). - -(2) run_sys_tests: record command-line arguments in SRCROOT_GIT_STATUS - file - -(3) (From Will Wieder) Updates to current surfdata & landuse files in - tools/contrib/singlept - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/CTSM#1118 (mksurfdata_map rounding/truncation of - special landunits should happen before wetland filling) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - PASS - - Note: ran tools testing on code based off of ctsm1.0.dev110 (before - merging with ctsm1.0.dev111) - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - PASS on mac (bishorn) - - regular tests (aux_clm): - - cheyenne ---- not run - izumi ------- not run - -If the tag used for baseline comparisons was NOT the previous tag, note that here: ctsm1.0.dev110 - -Answer changes --------------- - -Changes answers relative to baseline: NO - -In principle, the changes to mksurfdata_map could change answers for -rare cases. No answer changes were observed for present-day surface -datasets at resolutions f09, f19, f10 or f45. Also note that no surface -datasets were actually updated in this tag, so if any answer changes -appear from these changes, they would appear the next time we update -surface datasets. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/1119 -https://github.com/ESCOMP/CTSM/pull/1120 -https://github.com/ESCOMP/CTSM/pull/1122 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev111 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Fri Aug 28 14:08:25 MDT 2020 -One-line Summary: Compsets don't use 2014 for GSWP3 forcing, LUNA prevyr changed back - -Purpose of changes ------------------- - -Update cime so that default end year for GSWP3 forcing is 2013 because 2014 data is bad. Also update -the prevyr default for vcmax/jmax to what it was before ctsm1.0.dev102. - -Fix some issues for finding initial condition files for Clm45 compsets. Also bring in updated CDEPS/CMEPS -as they were required with the cime update. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): - Fixes #1107 -- Change initial values of LUNA back to previous global values - Fixes #1067 -- Stop using PIO2 in the LILAC build - Fixes #1121 -- FMOZ test fails - -CIME Issues fixed (include issue #): - Fixes ESMCI/cime#3683 -- Avoid artificial limit on string lengths in shr_string_listMerge - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - Last time-step in Dec/2013 for GSWP3 data still has zero humidity - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - cime is pointing to a branch_tag we should update it to a trunk tag as soon as possible - -Changes to tests or testing: build-namelist unit testing improved to find problems like #1121 a #1125 - -Code reviewed by: self - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (all identical to previous tag) - - tools-tests (test/tools): - - cheyenne - PASS - - python testing (see instructions in python/README.md; document testing done): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (similar climate) - - Summarize any changes to answers, i.e., - - what code configurations: (2010 and SSP compsets) and Clm50 with LUNA on (Bgc or Sp) - - what platforms/compilers: All - - nature of change: similar climate - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cmeps, cdeps - (fox removed as a separate checkout) - cime to branch_tags/cime5.8.31_a01 - -Pull Requests that document the changes (include PR ids): #1114 -(https://github.com/ESCOMP/ctsm/pull) - #1114 -- Update cime so default end year for GSWP3 forcing is 2013 and change prevyr default for vcmax/jmax - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev110 -Originator(s): jedwards (Jim Edwards) -Date: Fri Aug 21 10:49:08 MDT 2020 -One-line Summary: Fixes needed for PIO2 - -Purpose of changes ------------------- - -Fixes needed for CTSM to work with PIO2. There is an additional fix -needed in PIO2 itself; this is available in a later version of cime that -we will bring in soon. - -Note that this PR also includes a change in config_files.xml that is -needed for a newer version of cime when running compsets with dlnd, slnd -or xlnd; this may be incompatible with the current version of the cime -external, but this does not impact compsets with CTSM. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -The changes in this tag, together with a cime update that will be coming -in soon, resolve the following issues (I'm not sure off-hand which -issues are resolved by the changes here alone and which ones require the -cime update): -- Resolves ESCOMP/CTSM#1029 (FATES tests fail with PIO2) -- Resolves ESCOMP/CTSM#1030 (mpi-serial nag case fails with pio2 when - defining h1 history restart file) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- May not be able to run configurations with dlnd, slnd or xlnd from this tag - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: Not investigated, but almost definitely not - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- PASS - izumi ------- PASS - - Note: Standard testing was done using PIO1 (as this is still the - default), but separate testing was also done using PIO2 (using an - updated cime) and tests were found to pass. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/1095 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev109 -Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) -Date: Thu Aug 20 11:40:07 MDT 2020 -One-line Summary: Allow for resorbtion in transition from live to dead wood N - -Purpose of changes ------------------- - -This PR allows for resorbtion in transition from live to dead wood N, which also move -to NPOOL for free. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): Issue #443 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - -[x] clm5_0 - -[x] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist -variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] - -Notes of particular relevance for developers: None ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: None - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- PASS - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (similar climate) - - Summarize any changes to answers, i.e., - - what code configurations: Clm50 with Bgc or Cn - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new - climate): larger than roundoff/same climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - Will Wieder thought the changes were small enough that we didn't need to do - a long simulation. Erik Kluzek thinks the changes were verified with single - point simulations. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev108 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Aug 19 17:23:47 MDT 2020 -One-line Summary: Update default PE layouts for new SE/FV3 grids - -Purpose of changes ------------------- - -Change PE layouts for new high resolution SE/FV3 grids. Have a version for cheyenne and a default one -as well. - -Update externals: cime, cism, CMEPS, CDEPS -Change single point tests to use stub ROF -Change tests to use gx1v7 rather than gx1v6 -Update waccmx_offline to use START=1979 - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): - Fixes #1108 Change single point tests to use stub ROF - Fixes #1098 ARCTICGRIS PE layout is very slow - Fixes #1105 Default new FV3/SE grid PE layouts are problematic - Fixes #1103 Some changes to prevent missing file for WACCMX testing - Fixes #1113 ARCTIC test is failing - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - Some tests were chagned to use stub ROF and one to stub GLC. @billsacks suggest we should also change - other tests in this same way. - -Changes to tests or testing: Yes - -Code reviewed by: self - - -CTSM testing: regular, tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - tools-tests (test/tools): - - cheyenne - PASS - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - OK - - python testing (see instructions in python/README.md; document testing done): - - cheyenne -- PASS - - regular tests (aux_clm): - - cheyenne ---- PASS - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: No (except for waccmx_offline test) - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cism, CDEPS, CMEPS - cism to cism2_1_69 - cime to cime5.8.30 - Update hash for CDEPS and CMEPS (so that nuopc test will run) - -Pull Requests that document the changes (include PR ids): #1111 -(https://github.com/ESCOMP/ctsm/pull) - - #1111 -- Adjust FV3/SE PE layouts - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev107 -Originator(s): erik (Erik Kluzek) -Date: Mon Aug 10 02:21:12 MDT 2020 -One-line Summary: Answer changes needed for CESM2.2.0 - -Purpose of changes ------------------- - -A list of small answer changes needed for CESM2.2.0. Nitrogen deposition file now properly -ends in 2015 rather than 2005. Have 2010_control compset match the 2000 IOC file rather than 2010. -Modify the waccmx_offline tests to more closely match the CAM tests. - -Interpolate IC files for an exact match. Answers are identical for an exact match, but different -when used for other resolutions. - -Two small bit-for-bit changes remove levurb and string_len dimensions on restart files. -Remove xsmrpool_loss when use_crop is NOT true. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] - Answer changing fixes: - Fixes #1004 -- stream_year_last_ndep is set to 2005 instead of 2015 for historical with ctsm1.0.dev093 - Fixes #1012 -- Help prevent problems with WACCM-X testing by modifying our waccmx_offline test - Fixes #1090 -- Have 2010_control compset match 2000 simulation-year rather than 2010 - Fixes #1089 -- Failure in FXHIST test when running with CAM - Fixes #1037 -- Interpolate out-of-the-box initial conditions files for CESM2.2 release - (only changes answers for resolutions other than IC file resolution) - - Bit-for-bit changes: - Fixes #1101 -- levurb and string_len dimensions no longer needed on the restart files - Fixes #1097 -- xsmrpool_loss should only be written to the restart file if use_crop is true - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - 2010_control doesn't match 2010 finidat file - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): Interpolated IC files - Add f19 2003 IC file, f09 and 19 1979 IC file - Remove 2010 IC file - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: waccm_offline test changed to more closely match the FXHIST CAM test - -Code reviewed by: self - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (115 tests are different than before) - - python testing (see instructions in python/README.md; document testing done): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne ---- PASS - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! (very small) - - Hist and SSP BGC compsets change answers because of the correction of the end year for ndep. - You wouldn't think this would matter until you get to the end of the time-sequence -- but it - does for the first time-step. - - The 2010 compset changes answers because of using the 2000 finidat file rather than 2010 - - Some finidat files interpolated to the resolution they are designed for. This causes an apparent - change of answers when these datasets are used for other resolutions (even though it does NOT for - the resolution it's interpolated to) - - waccm_offline tests are also changed in order to more closely match the FXHIST tests in CAM. - - Summarize any changes to answers, i.e., - - what code configurations: Hist, SSP, 2010 compsets, Clm45 and some f10, 1x1 because of IC files - - what platforms/compilers: All - - nature of change: same climate - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #1100 -(https://github.com/ESCOMP/ctsm/pull) - #1100 -- Answer changes needed for CESM2.2.0 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev106 -Originator(s): erik (Erik Kluzek) -Date: Thu Aug 6 15:35:47 MDT 2020 -One-line Summary: Bit-for-bit updates for the CESM2.2.0 release - -Purpose of changes ------------------- - -Fix some bit-for-bit things needed for the CESM2.2.0 release -Bring changes needed from release-clm5.0.31-34 to trunk. ndep change. -Brings in some changes for PtVg datasets for no-anthro compset. -Do some refactoring of Fire class so that it makes sense for FATES to use the base class. -Update RTM and MOSART with NUOPC changes and an update of a NetCDF-4 file to NetCDF-5 -needed for the cesm2.2.0 release. - -The 2010 finidat file is now set in the 2010_control use-case rather than relying on the -finidat dataset matching. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): - Fixes #1087 -- wrong finidat file - Fixes #1096 -- failing tests - Fixes #1036 -- ne30 case fails - Fixes #946 --- better error message - Fixes #983 --- Fire method renames - Fixes #938 --- mscripgrid issue - -Known bugs found since the previous tag (include github issue ID): - #1098 -- ARCTICGRIS PE-layout is very slow... - #1097 -- xsmrpool_loss should only be written to the restart file if use_crop is true - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - if ndep file isn't found die with a warning rather than fatal error. - The warning allows you to override with CLM_BLDNML_OPTS="-ignore_warnings" - - finidat file matching will now use the sim_year rather than start-year - for a control case (transient cases used the start-year) - Add 2010 f09 finidat file for clm5_0_cam6.0 - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: - Add clm45cam6LndTuningMode testmod - Some tests needed more wallclock - -Code reviewed by: self - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (one test is different than ctsm1.0.dev105) - - python testing (see instructions in python/README.md; document testing done): - - cheyenne -= PASS - - regular tests (aux_clm): - - cheyenne ---- PASS - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: No (bit-for-bit) - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): rtm, mosart - RTM to rtm1_0_72 - MOSART to mosart1_0_37 - -Pull Requests that document the changes (include PR ids): #1079 -(https://github.com/ESCOMP/ctsm/pull) - #1079 -- Bit-for-bit updates for the CESM2.2.0 release - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev105 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) / Chris Fischer -Date: Thu Jul 23 08:59:37 MDT 2020 -One-line Summary: Bring in some new SE grids for CAM as well as initial condition files for them - -Purpose of changes ------------------- - Add new SE (Spectral Element) grids: ne30np4.pg2, ne30np4.pg3, ne30np4, ne60np4, ne120np4, ne120np4.pg2, ne120np4.pg3, - ne0np4CONUS.ne30x8, ne0np4.ARCTIC.ne30x4, ne0np4.ARCTICGRIS.ne30x8 - Add new datasets for them, some new tests, and add support for their creation. - - Also add some new initial condition (IC) files for 1979, 2000, and 2013 for use when coupled to CAM - - The process for picking initial condition files was improved so that there can be more than one year that matches - and it will do the best to pick the best match. Also added the possibility for 1982 and 2013 simulation years for - specific grid matches. - - Also update cime to a newer version that supports these new grids. And update CMEPS (and hence add in fox, CDEPS) - to latest used on the nuopc_dev branch. Testing with nuopc wouldn't work without this update. The cime version updates - the tables for dry-deposition and changes answers for dry-deposition when it's turned on. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #992 #994 - Fixes #992 -- New initial conditions for 1979, 2000 - Fixes #994 -- New CAM SE grids - Fixes #888 -- Add support for various "physics grids" needed by CAM -CIME Issues fixed (include issue #): #3593, #3569, #3564, PR#3557 - cime/#3593 -- Fix mapping files for new grids - cime/#3569 -- Fix cime regression testing - cime/#3564 -- Change alias for arctic grids - cime/#3557 -- updates to dry deposition data (PR) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - Initial conditions (IC) for 1979 start date is technically 1982 - New initial condition files are ONLY for when coupled to CAM (B and F compsets) - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Allow for new grids - User updates to cime: - - Allow a user supplied config_grids.xml file. - - Improved error message for incorrect setting of cime model. - -Changes made to namelist defaults (e.g., changed parameter values): Add IC files for 1982 and 2013 years - -Changes to the datasets (e.g., parameter, surface or initial files): New SE grid datasets - Remove conus_30_x8 grid (previous name for new ne0np4CONUS.ne30x8 grid - Add new grids: ne30np4.pg2, ne30np4.pg3, ne30np4, ne60np4, ne120np4, ne120np4.pg2, ne120np4.pg3, - ne0np4CONUS.ne30x8, ne0np4.ARCTIC.ne30x4, ne0np4.ARCTICGRIS.ne30x8 - Add new mask: tx0.1v3 - New IC files: 1982 for ARCTIC and ARCTICGRIS, ne120np4 for 2000 and 2013 for CONUS all when coupled to CAM - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - Initial condition picking will pick the file it finds with the closet simulation year to the request - for the lnd_tuning_mode desired. It will pick based on year over an exact match in resolution. - You can get around this by setting use_init_interp to be specific for a resolution - - Also realized that there is a dependence between the namelist_defaults_ctsm.xml file and namelist_defaults_overall.xml - for the clm_start_type item. It must be coordinated with use_init_interp, init_interp_attributes and finidat - to work properly. I added a comment about this. We should probably just move them into the same file. - -Changes to tests or testing: Added tests for new grids - -Code reviewed by: self, fischer-ncar, adamrher - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - OK (130 tests fail comparison to previous verison due to new IC files) - - tools-tests (test/tools): - - izumi - OK - - PTCLM testing (tools/shared/PTCLM/test): - - izumi - OK - - python testing (see instructions in python/README.md; document testing done): - - izumi -- PASS - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit (unless running with CAM because of new finidat files) - Running with nuopc changes answers because of updates to nuopc drivers - Dry-deposition changes answers when turned on (but doesn't effect anything else) - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cmeps, cdeps, fox - cime updated to cime5.8.28 (from branch_tags/cime5.8.24_a01) - fox, and cdeps added in - cmeps, cdeps and fox updated to hashes used in the nuopc_dev branch of CESM - -Pull Requests that document the changes (include PR ids): #1038 -(https://github.com/ESCOMP/ctsm/pull) - #1038 -- New fsufdat and landuse time series files for ne grids - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev104 -Originator(s): sacks (Bill Sacks) -Date: Mon Jul 6 09:58:15 MDT 2020 -One-line Summary: Add LILAC - -Purpose of changes ------------------- - -Add LILAC: The Lightweight Infrastructure for Land-Atmosphere -Coupling. This infrastructure consists of two major pieces: - -(1) A lightweight coupling infrastructure built on top of ESMF that - makes it easier for atmosphere models to call CTSM directly, rather - than using the hub-and-spoke architecture that is used by CESM. - -(2) A set of python-based tools for building CTSM and creating its - runtime inputs when running in an atmosphere model via - LILAC. Although these tools are built on top of cime, details of the - create_newcase / case.setup / case.build process are hidden from the - user, because many of the aspects of this workflow don't make sense - in the LILAC context. - -So far we have used LILAC to couple CTSM to WRF. There are plans to use -the same infrastructure to couple CTSM to other regional atmosphere -models. - -Documentation of LILAC is provided in -https://escomp.github.io/ctsm-docs/versions/master/html/lilac/index.html -(though there are still some missing sections), as well as in various -presentations on the wiki -(https://github.com/ESCOMP/CTSM/wiki/Presentations). - -There have been many contributors besides myself to the development, -testing and documentation of LILAC; chief among them being Mariana -Vertenstein, Negin Sobhani, Joe Hamman, Sam Levis, Mike Barlage and Dave -Lawrence. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- See issues in the Done column of https://github.com/ESCOMP/CTSM/projects/23 - -Known bugs introduced in this tag (include github issue ID): -- Although LILAC is working to first order, there is still some work to -do. See outstanding issues in https://github.com/ESCOMP/CTSM/projects/23 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -- dtime no longer specified on the namelist: just obtained from driver - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Added LILACSMOKE test - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - ok - - Baseline comparisons fail as expected. One test failed, but it also - failed for me on master (https://github.com/ESCOMP/CTSM/issues/1074) - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - pass on my mac - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/1068 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev103 -Originator(s): slevis (Samuel Levis, SLevis Consulting LLC,303-665-1310) -Date: Mon Jun 29 17:16:29 MDT 2020 -One-line Summary: Gridcell-level balance-check for methane (CH4) - -Purpose of changes ------------------- - - Bracket the model time-step loop to calculate balance checks at the - gridcell level, as detailed in issue #315. The column-level check - remains unchanged. - - Subroutine ch4_init_balance_check is replaced with - ch4_init_column_balance_check. Subroutine - ch4_init_gridcell_balance_check is added. - - The implementation is similar to the one for carbon and nitrogen (see - tag ctsm1.0.dev096). - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #315 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - None - -Changes made to namelist defaults (e.g., changed parameter values): - None - -Changes to the datasets (e.g., parameter, surface or initial files): - None - -Substantial timing or memory changes: - No - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - None - -Changes to tests or testing: - None - -Code reviewed by: - @billsacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - tools-tests (test/tools): - - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - - - regular tests (aux_clm): - - cheyenne ---- PASS - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: No - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): - None - -Pull Requests that document the changes (include PR ids): - https://github.com/ESCOMP/CTSM/pull/1022 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev102 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Fri Jun 26 01:32:04 MDT 2020 -One-line Summary: Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 - -Purpose of changes ------------------- - -Fix some important issues that were found in LUNA for the arctic. These changes were large enough -that we had to re-tune the clm5_0 parameters to give a similar simulation. Leah Birch noticed -that the formulations in the code disagreed with the paper. Correcting this caused arctic plants -to be less productive. In order to compensate parameters for leafcn, and slatop were adjusted for -broadleaf_deciduous_boreal_shrub and c3_arctic_grass for clm5_0. - -The total vegetation carbon threshold on exit_spinup (from accelerated decomposition (AD) mode) was -increased from 0.1 to 1.0. Without this change some PFT's can die out in exit spinup even when -they have significant carbon stores from the AD spinup mode. - -There is an implicit assumption in the urban building energy model that building width equals -street width. However, this assumption can/should be relaxed and building width can be derived -from the morphology dataset. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #738 #803 #953 #958 #1056 - Fixes #1056 -- Remove allpfts dimension - Fixes #953 -- Incorrect formula in LUNA uses day time rather than average of day/night - Fixes #958 -- LUNA day length factor missing - Fixes #738 -- Totvegc threshold increased from 0.1 to 1. - Fixes #803 -- No longer assume building width - -Known bugs introduced in this tag (include github issue ID): #1060 - #1060 -- Some code cleanup of luna bug fixes - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[x] clm5_0 - -[x] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): clm5_0 climate adjusted for arctic plants - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): New parameter files - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): We - chose some bad names for variables, so we'll clean this up in a seperate step (see #1060) - -Changes to tests or testing: None - -Code reviewed by: self, olyson, bill-sacks, wweider - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (266 compare differently because of update in paramsfile and jmaxb1) - - python testing (see instructions in python/README.md; document testing done): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne ---- PASS - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes for clm5_0 (important change required retuning) - - Summarize any changes to answers, i.e., - - what code configurations: clm5_0 when Luna on as well as smaller changes for urban - - what platforms/compilers: all - - nature of change: climate changing, but tuned to respond similar to clm5.0 - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - luna changes: oleson case clm50_ctsm10d089_2deg_GSWP3V1_luna3_jmaxb1-0.17_slatopA_leafcnA_hist - - URL for LMWG diagnostics output used to validate new climate: - - urban changes: - - -http://webext.cgd.ucar.edu/I2000/clm50_ctsm10d098_1deg_GSWP3V1_CON_FIXBUILDENERGY_2000/lnd/clm50_ctsm10d098_1deg_GSWP3V1_CON_FIXBUILDENERGY_2000.1991_2010-clm50_ctsm10d098_1deg_GSWP3V1_CON_2000.1991_2010/setsIndex.html - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #1034 and #962 -(https://github.com/ESCOMP/ctsm/pull) - #1034 -- Building energy fix - #962 --- Fixes for the LUNA dayl bugs - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev101 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326), oleson (Keith Oleson) -Date: Wed Jun 17 23:51:22 MDT 2020 -One-line Summary: Changes from Keith to bring a list of variables to the parameter file - -Purpose of changes ------------------- - -Change some hardcoded parameters to go on the parameter files. This is needed in preparation -of running the Perturbed Parameter Ensemble. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #995 #138, #206 - -Fixes #995 -- Soil turnover times are on paramfile and hardcoded -Fixes #138 -- use tau_ values on paramfile -Fixes #206 -- add prh30 to paramfile -Some work on #290 -- LUNA refactoring - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): paramfile for both clm4_5 and clm5_0 - Add 51 new parameters to the paramsfile: - bsw_adjustfactor,cpha,csol_clay,csol_om,csol_sand,denitrif_nitrateconc_coefficient,denitrif_nitrateconc_exponent, - denitrif_respiration_coefficient,denitrif_respiration_exponent,drift_gs,e_ice,enzyme_turnover_daily,eta0_anderson, - eta0_vionnet,fnps,hksat_adjustfactor,ignition_efficiency,jmaxb0,jmaxha,jmaxhd,kcha,koha,kp25ratio,lmrha,lmrhd, - lmrse,luna_theta_cj,minrelh,n_baseflow,pd,perched_baseflow_scalar,prh30,relhExp,ssi,sucsat_adjustfactor,theta_cj, - theta_ip,theta_psii,tpuha,tpuhd,tkd_clay,tkd_om,tkd_sand,tkm_om,tpu25ratio,vcmaxha,vcmaxhd,watsat_adjustfactor, - wc2wjb0,wimp,wind_min - k_nitr_max removed and replaced with k_nitr_max_perday - meta-data for the tau_* variables changed, and a roundoff difference in the clm4_5 paramfile - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): prh30 not used for clm4_5 - prh30 was added in but won't be used for the CNFireLi2014 formulation. - It's only used for the clm5_0 and following formulations - -Changes to tests or testing: None - -Code reviewed by: self, oleson - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (170 tests differ from baseline because of new paramfiles) - - python testing (see instructions in python/README.md; document testing done): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #1039 -(https://github.com/ESCOMP/ctsm/pull) - #1039 -- move hardcoded parameters to paramfile - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev100 -Originator(s): sacks (Bill Sacks) -Date: Tue Jun 9 06:15:15 MDT 2020 -One-line Summary: Deallocate memory after running init_interp - -Purpose of changes ------------------- - -Many of the pointer arrays in init_interp were not being deallocated -when init_interp finished. This was a particular problem because some of -these arrays were allocated for the full global source grid on each -processor, so the memory use was significant. This tag fixes this issue. - -This issue is documented in https://github.com/ESCOMP/CTSM/issues/1010 -and https://github.com/ESCOMP/CTSM/issues/1032. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/CTSM#1032 (Memory isn't deallocated in some of the - init_interp code) - -Known bugs found since the previous tag (include github issue ID): -- This does NOT resolve ESCOMP/CTSM#1010 (WACCMX test fails with - ctsm1.0.dev093 in cesm2_2_alpha05c), even though that was the original - hope. - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none -- The initial run of the PFS test showed a very long time taken in - initialization. However, it appears that this was a system issue: - rerunning twice showed times back to normal. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - pass (on my mac) - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - - Most testing was done on f332fafc. After that, I made a minor change - that was needed for the unit tests to pass. I then reran (1) - clm_short on cheyenne, and (2) this subset of the test list on - izumi: - - SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop - PEM_Ld1.f10_f10_musgs.I2000Clm50BgcCropGs.izumi_intel.clm-crop - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_intel.clm-crop - SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop - SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-monthly - ERP_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-default - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev099 -Originator(s): sacks (Bill Sacks) -Date: Mon Jun 8 09:29:38 MDT 2020 -One-line Summary: Update cime, needed for izumi machine updates - -Purpose of changes ------------------- - -Update cime. The most important change here is an update for izumi, -which is needed for the recent izumi machine updates. - -Also: Change izumi PEM test to use SGLC (after the machine updates, the -PEM test was failing; see also -https://github.com/ESCOMP/CTSM/issues/840). - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: not investigated; none expected - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Changed izumi PEM test to use SGLC (after the machine updates, the PEM -test was failing; see also https://github.com/ESCOMP/CTSM/issues/840). - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- ok - - izumi: tests pass, some baselines fail as expected - - ERP_D_Ld3.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-prescribed - showed differences from the stored baselines, but it appears that - the stored baselines were incorrect: when I reran this test from - master, the master version differed from the stored baselines and - was identical to this branch. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES, just on izumi due to machine updates - - Summarize any changes to answers, i.e., - - what code configurations: some izumi tests - - what platforms/compilers: izumi gnu & pgi - - nature of change (roundoff; larger than roundoff/same climate; new climate): - not investigated; expected to be roundoff - - Answer changes were observed in these tests: - - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop - - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop - - SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: branch_tags/cime5.8.23_a01 -> branch_tags/cime5.8.24_a01 - Point to a cime branch tag that is equivalent to cime5.8.24 but uses - pio1 rather than pio2, even for mpi-serial cases (the changes in - branch_tags/cime5.8.24_a01 relative to cime5.8.24 are equivalent to the - changes in branch_tags/cime5.8.23_a01 relative to cime5.8.23). - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev098 -Originator(s): John Truesdale,UCAR/AMP,303-497-1386 -Date: Thu May 28 14:39:27 MDT 2020 -One-line Summary: Bring in GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 - -Purpose of changes ------------------- - -Add support for new GFDL fv3 curbed sphere grids. Low resolution C24, and C48 -Moderate resolution C96, and high resolution C192 and C384. Add in mapping files -so all can be created. Make C96 a default resolution created with new surface -datasets. For all of these only the crop versions of surface and landuse.timeseries -are in place, as non-crop can run in CLM without needing different datasets. Also for -historical landuse.timeseries we use the SSP5-8.5 timeseries files, so that it can be -used for future, historical and beyond 2015 present day. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #1025 - Fixes #1025 -- By default only create crop version of surface/landuse.timeseries datasets - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): New surface and landuse.timeseries files - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: Add C96 tests - -Code reviewed by: @ekluzek - -CTSM testing: regular, tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (15 new tests for new resolutions) - - tools-tests (test/tools): - - cheyenne - OK - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - PASS (cheyenne) - - regular tests (aux_clm): - - cheyenne ---- PASS - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: previous - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #891 -(https://github.com/ESCOMP/ctsm/pull) - - #891 -- add definitions/defaults for GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev097 -Originator(s): ycheng (Yanyan Cheng); final changes & testing by Bill Sacks -Date: Mon May 25 15:14:56 MDT 2020 -One-line Summary: Add two bioenergy crops (switchgrass and miscanthus) - -Purpose of changes ------------------- - -Main change is from Yanyan Cheng: adding parameters and code for two -bioenergy crops, switchgrass and miscanthus. Along with this, there is a -new potential flux from crop leaves and stems to the crop product pool -at harvest, representing biofuel products; a new pft-specific parameter -controls this flux (biofuel_harvfrac). Currently, the out-of-the-box -surface datasets do not specify any area for these crops, but the new -parameter file will allow them to be present if specified on the surface -dataset or landuse_timeseries file. Note that this is only an option for -CLM5.0, NOT for CLM4.5. (See https://github.com/ESCOMP/CTSM/pull/884 for -details.) - -Also, some minor fixes from Bill Sacks: See notes under "bugs fixed" -below. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/CTSM#203 - Fixes creation of harvest-related variables - on surface datasets created with the all_veg option - smallville, - PTCLM, etc. (documented in https://github.com/ESCOMP/CTSM/pull/1019) -- Resolves ESCOMP/CTSM#930 - Makes gindex_ocn intent(inout) rather than - intent(out) -- Resolves ESCOMP/CTSM#1021 - Changes SSP test to only do symlink if - needed - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- For transient crop cases, now more crops in memory. This creates a - need for interpolation of initial conditions for initial conditions - generated from a transient case. - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): -- Changed parameter values for switchgrass and miscanthus (only for clm5.0) -- New pft-specific parameter, biofuel_harvfrac (for both clm4.5 and clm5.0) - -Changes to the datasets (e.g., parameter, surface or initial files): -- New parameter files with the above changes - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Changed smallville ERS_Lm20 test to be cold start (see comment in - commit 8368f222 for details) -- Added a multi-year smallville test that includes these new crops - -Code reviewed by: Bill Sacks, Danica Lombardozzi - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - ok - - Pass except for expected baseline failures - - Ran on 633be0eb, with comparison against ctsm1.0.dev095; tests pass - except these expected baseline failures: - - 030 blf84 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools ....................\c - rc=7 FAIL - - 032 blfc4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools ..............\c - rc=7 FAIL - - Diffs for these are just in the harvest-related fields on the surface dataset, as expected. - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- pass - - For cheyenne testing: a few tests had baseline failures. The - differences just arise in the h1 (vector) files, due to differences - in dimension sizes. These differences are expected. See below for - details. - - Ran most testing on 8309c213. Reran two SSP tests on 4665c9ce - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES, but diagnostic only due to -change in dimension sizes - does not change answers in any meaningful -way - - Summarize any changes to answers, i.e., - - what code configurations: Transient CLM50 cases with crops; just - changes dimensions on vector (h1) history files - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - diagnostic change only - - Differences were observed in the following tests: - - ERS_Ly3_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropQianGs.cheyenne_gnu.clm-cropMonthOutput - SMS_Ld5.f10_f10_musgs.ISSP245Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start - SMS_Ld5.f10_f10_musgs.ISSP370Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start - ERP_D_Ld10_P36x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_decStart - ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive - ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput - ERS_D_Ld7_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_intel.clm-decStart1851_noinitial - ERS_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput - ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput - ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropQianGs.cheyenne_intel.clm-cropMonthOutput - LCISO_Lm13.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_monthly - SMS_Ld5.f10_f10_musgs.ISSP585Clm50BgcCrop.cheyenne_intel.clm-ciso_dec2050Start - - The differences just arise in the h1 files, due to differences in - dimension sizes. I reran these tests with a paramfile where I - reverted the mergeToPft variable; then they were all bfb with - master. - - Other than this, there were FIELDLIST differences, as expected. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/CTSM/pull/884 -- https://github.com/ESCOMP/CTSM/pull/1019 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev096 -Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) -Date: Thu May 21 19:18:24 MDT 2020 -One-line Summary: Gridcell-level balance checks for carbon and nitrogen - -Purpose of changes ------------------- - - Bracket the model's time-step loop to calculate balance checks at the - gridcell level because there are terms in the carbon and nitrogen - cycles not accounted for at the column level. Balance checks at the - column level remain unchanged for now. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #314 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: - @billsacks - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - tools-tests (test/tools): - - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: No - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): - https://github.com/ESCOMP/CTSM/pull/984 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev095 -Originator(s): sacks (Bill Sacks) -Date: Thu May 21 10:25:16 MDT 2020 -One-line Summary: Update cime and cmeps externals; rework initialization of CNFire object - -Purpose of changes ------------------- - -Main change is to update cime and cmeps externals. cime is now -essentially at the version used in cesm2_2_beta05 (but with one change -backed out); cmeps is at latest master. - -Also, reworks initialization of CNFire object to avoid occasional -segmentation faults. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/CTSM#1018 (Occasional seg faults when initializing - CNFire object) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none -- Note: Because of a change in cime, datm now uses netcdf rather than - pnetcdf, but it doesn't seem that that impacts performance - significantly - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- pass - - cheyenne tests pass; some answer changes as expected (as noted below) - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: - - cheyenne_gnu - due to compiler version update - - nuopc - presumably due to the major cmeps update - - what platforms/compilers: see above - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Not investigated - - I have verified that gnu tests in 59d1dd4a are identical to those - in dcaad375 - i.e., the rework of the initialization logic for fire - didn't change answers - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: cime5.8.19 -> branch_tags/cime5.8.23_a01 - (same as cime5.8.23, but reverts to using pio1 for mpi-serial cases, - since some mpi-serial cases failed with pio2) -- cmeps - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev094 -Originator(s): sacks (Bill Sacks) -Date: Fri May 15 13:41:01 MDT 2020 -One-line Summary: Minor bug fixes needed for latest cime - -Purpose of changes ------------------- - -(1) Refactor a conditional to avoid divide by 0 (ESCOMP/CTSM#1013) - -(2) Remove some FATES coordinate variables that were writing garbage - (temporary workaround for ESCOMP/CTSM#1014) - -(3) Minor update to manage_externals - -(4) Document authorship in README.md and .zenodo.json - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/CTSM#1013 -- Workaround for ESCOMP/CTSM#1014, but doesn't properly resolve that issue - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: not checked; none expected - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/1006 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev093 -Originator(s): erik (Erik Kluzek) -Date: Fri May 1 22:27:16 MDT 2020 -One-line Summary: Bring in changes from release-clm5.0 branch to master - -Purpose of changes ------------------- - -Move changes from release-clm5.0.12.13/14/16/17/18/20/21/22/23/24/25/26/27/28/29/30 to master -(note excludes release-clm5.0.15, release-clm5.0.19) - -Answer changing! -Updates FATES with PARTEH option. - -Remove CRUNCEP half degree, ne120np4, f05 surface datasets -Landuse-timeseries files for just: f09, f19, f10, ne30np4, 1x1_numaIA, 1x1_smallvilleIA, 1x1_brazil -Add datasets needed for SSP scenarios (only Tier I for ndep). Add ZWT_inversion dataset for methane. - -Add new ability to use prescribed soil moisture data (from streams files based on an earlier CTSM simulation). - -Add new MODISv2 mapping files for mksurfdata_map. Remove T5 and T21 mapping files. Add conus_30_x8 mapping files, -and T62 mapping files - -Add contrib directory to tools with contributed tools and scripts. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): 31 issues.... - #873 -- Release clm5.0.12 changes - #871 -- don't check for valid resolution for CESM cases by default - #836 -- add izumi as a place that can run tools tests - #831 -- add namelist tint_algo settings for input streams - #817 -- Have clm4_5 use the same ndep file as clm5_0 for 1850 - #809 -- mkmapdata using an old version of intel - #804 -- mksurfdata option - #791 -- fix threading for prescribed LAI and soil-moisture - #786 -- allow use_init_interp for a branch - #746 -- Some CLM45 configurations use CLM50 initial conditions files - #741 -- C13_HR, C13_NBP, FPI values result in numeric conversion not representable error (changes answers) - #734 -- Isotope historical files off of NetCDF-4 - #716 -- 2 degree CMIP6WACCMDECK needs Carbon isotopes off - #707 -- Missing mapping files for hirespft - #673 -- Ice shelf wetland fix in mksurfdata_map can lead to glacier+lake > 100% on surface datasets (changes surface dataset creation) - #653 -- To save disk on fsurdat files use zwt0 on finindated file - #629 -- Remove unused fields from surface datasets - #624 -- QSNOEVAP history output incorrect - #621 -- Fully remove rcp in place of only ssp_rcp - #608 -- Odd (blocky) spatial patterns in generic crop leafc for BGC simulation when initialized from BGC-Crop (changes answers) - #589 -- Existence of content in the lai_streams namelist makes it confusing to users - #557 -- no-anthro compset and options - #553 -- More robust mksurfdata_map logic for determining where to put wetlands - #547 -- Add conus_30_x8 grid as valid option for CTSM and mksurfdata_map - #545 -- Antarctica ice shelves are being treated as wetlands rather than glaciers - #544 -- Transient cases are matching wrong IC file - #533 -- Add -no-anthro option to mksurfdata - #276 -- Tests for pre_alpha/pre_beta - #262 -- hirespft option to mksurfdata.pl - #175 -- Set stream_year_first_urbantv/last for CLM4.5 - #150 -- mksurfdata code cleanup - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): New surface datasets do mean initial conditions - will need to be interpolated - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Add 2010 compset option - New namelist items: ndep_tintalgo, lai_tintalgo, lightng_tintalgo, urbantv_tintalgo, dribble_crophrv_xsmrpool_2atm - New soil moisture namelist items: use_soil_moisture_streams, stream_year_first_soilm, stream_year_last_soilm, model_year_align_soilm, - model_year_align_soilm, soilm_tintalgo, soilm_offset, soilm_ignore_data_if_missing - New namelist items for FATES: fates_parteh_mode - New 2010, no-anthro, SSP use cases - New compsets: I2010Clm50Sp, I2000Clm50BgcCropQianGs, I1850Clm50BgcNoAnthro, I1850Clm50SpNoAnthro, IHistClm50SpCru, IHistClm50SpCru, - IHistClm45SpGs, IHistClm45SpGs - New SSP compsets: ISSP585Clm50BgcCrop, ISSP126Clm50BgcCrop, ISSP126Clm50BgcCrop, ISSP245Clm50BgcCrop, ISSP370Clm50BgcCrop, - ISSP434Clm50BgcCrop, ISSP460Clm50BgcCrop, ISSP460Clm50BgcCrop - LAI streams options don't show up in the namelist unless you ask for them - finundation comes from streams files, no longer from the surface dataset - FATES adds a list of new history variables and dimension types - -Changes made to namelist defaults (e.g., changed parameter values): New fsurdat files, SSP C13/C14 files - Add PtVg surface dataset - most finidat files now need to be interpolated, a few added in to get testing to work - New ndep datasets - -Changes to the datasets (e.g., parameter, surface or initial files): - New fsurdat files, finidat files need to be interpolated from now - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - Threshold to reseed dead vegetation increased from zero to 1.0 as a hard coded parameter. - Reseeding also happens for generic crop types and not just natural vegetation now. - The ability to read in 3D streams was added (input files have to be at the same resolution as the model) - -Changes to tests or testing: - Add no-anthro, 2010, f19 waccm and SSP tests - Make sure prealpha/prebeta tests are also run by aux_clm - Add prescribed soil moisture test - Lengthen waccm_offline test - Remove hcru_hcru and edison tests - Add some aux_cime_baseline tests - -Code reviewed by: self - - -CTSM testing: regular, tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (345 are different than baseline) - - tools-tests (test/tools): - - cheyenne - OK - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - OK - - python testing (see instructions in python/README.md; document testing done): - - cheyennne -- PASS (when ncar_pylib run) - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (small) - - Updates in all fsurdat files leads to changes in answers - Also there are updated finidat files as they had to be interpolated - to work with the new fsurdat files - Reseeding change can effect answers on startup if activated - Extra call to SoilBiogeochemPrecisionControl can cause a small answer change - - Summarize any changes to answers, i.e., - - what code configurations: all global - - what platforms/compilers: all - - nature of change: Main change is around Antarctica - - CMIP6 simulations and release branch simulations were run with these surface datasets - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): fates, PTCLM - - fates to sci.1.30.0_api.8.0.0 - PTCLM to PTCLM2_20200121 - - FATES now points to the NGEET repository rather than the NCAR fates-release - -Pull Requests that document the changes (include PR ids): #998, #883, #849, #567, #564, #561 -(https://github.com/ESCOMP/ctsm/pull) - #998 -- Remove Copyright file - #883 -- Bring changes on release-clm5.0 branch to master PR status: ready priority: high type: enhancement - #849 -- Fix link to new forums - #567 -- Ignore patterns for vim - #564 -- Update mksurfdata_map to include glaciers outside of pft landmask - #561 -- Add list of checks that should be done when making new surface datasets - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev092 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Mon Apr 27 14:51:21 MDT 2020 -One-line Summary: Update cime to version in cesm2_2_beta04 - -Purpose of changes ------------------- - -Update cime to latest in cesm2.2 beta tag (cesm2_2_beta04) -Fix two small issues that had gone on the release-clm5.0 branch. -Update manage_externals (to manic-v1.1.8) - -NOTE: Part of the reason for updating cime, was because of some problems -Mike Mills was having on cheyenne with inputdata files being deleted out -from under him before setting up his cases. We think system issues were -interacting with issues with cime putting in place zero length -missing files for the version of cime he was using. Those issues went -away with a cime update, so we hope updating to a newer cime version here -will help prevent those issues for CTSM users. - -cime updates: - -some cleanup from the last maint-5.6 update -Add ne5np4.pg4 grid. -case.setup: Add --keep option -Add omip as option to DATM_CO2_TSERIES - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #974 #966 - Fixes #974 -- python 3 problem in ssp test - Fixes #966 -- a few history fields need to be made CF compliant -CIME Issues fixed (include issue #): 3459 3466 - 3459 -- case.setup refuses to fix corrupted env_mach_specfic.xml - 3466 -- fix for aquap - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - ./case.setup now has a --keep option - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - tools-tests (test/tools): - - cheyenne - OK - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - OK - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: previous - - -Answer changes --------------- - -Changes answers relative to baseline: None bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime - cime to cime5.8.19 - (NOTE: CMEPS is pointing to a newer hash than used in the beta tag) - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - #996 -- Update cime to latest cesm2.2 beta tag - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev091 -Originator(s): sacks (Bill Sacks) -Date: Fri Apr 24 07:43:46 MDT 2020 -One-line Summary: Increase tolerance on near-zero truncation for a snow state update - -Purpose of changes ------------------- - -In UpdateState_TopLayerFluxes, the tolerance of 1.e-13 was occasionally -exceeded. Although I haven't done a careful analysis, it seems okay to -me to increase this tolerance slightly. Here I increase it to 1.e-12. - -Previously, if top-layer h2osoi_ice or h2osoi_liq were reduced to less -than 1e-13 times the original value (in an absolute value sense), these -masses were set to 0; now we set these masses to 0 if they are reduced -to less than 1e-12 times the original. So we can now occasionally set a -value to exactly 0 when before it was left at slightly different from -zero. If the previous code led to a small positive value, between 1e-13 -and 1e-12 times the original, this tag will change answers slightly. If -the previous code led to a small negative number, it would cause the -model to abort, leading to the issue reported in ESCOMP/CTSM#988; this -change should fix those occasional aborts. - -This tag also introduces the general ability to set tolerances to a -custom value in calls to truncate_small_values. - -See ESCOMP/CTSM#988 for details. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/CTSM#988 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none expected (not checked) - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES, in theory (but none in test suite) - - Summarize any changes to answers, i.e., - - what code configurations: potentially all, but very rarely - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Roundoff - - Potentially changes answers by roundoff (see notes above), but no - changes were observed in any test in the test suite - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/989 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev090 -Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) -Date: Thu Apr 23 09:21:18 MDT 2020 -One-line Summary: Refactoring banded diagonal matrix and solve system in SoilTemperature module - -Purpose of changes ------------------- - -Previously, the SoilTemperature module has a high level of nested subroutine -calls, which hurt its performance and readability. There were many -redundancies, logical issues, and nested conditionals in the modular code -as discussed in issue #323. In this PR, SoilTemperature module is optimized -and rewritten for better readability and performance while maintaining bfb -compatibility. - - -This PR addresses issue ESCOMP/ctsm#323 - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): - -ESCOMP/ctsm#323 - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: The revised code improved the -performance of the previous code by ~1.5-2x. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Bill Sacks - - -CTSM testing: - - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- PASS - -Externals used for the testing: - [cism] - tag = cism2_1_68 - [rtm] - tag = rtm1_0_70 - [mosart] - tag = mosart1_0_35 - [cime] - tag = branch_tags/cime5.8.15_a01 - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/CTSM/pull/979) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev089 -Originator(s): sacks (Bill Sacks) -Date: Tue Apr 7 12:01:59 MDT 2020 -One-line Summary: Bring documentation source to master - -Purpose of changes ------------------- - -1. Bring documentation source to master: Pulls in the source from - https://github.com/escomp/ctsm-docs. This is important so that - documentation can remain in sync with changes in the model - code. Images are stored here using git-lfs (Git Large File - Storage). I also made some minor fixes to get the pdf build of the - tech note working. - -2. Use a different documentation theme that supports a version dropdown - menu, and add the code needed to support this versioning on the - documentation web pages. At a high level, the way the versioned - documentation works is to have separate subdirectories in the - gh-pages branch of the ctsm-docs repository for each version of the - documentation we want to support. There is then a bit of JavaScript - code which uses a json file in the gh-pages branch to determine which - versions exist and how these should be named in the dropdown - menu. Most of these changes were borrowed from ESMCI/cime#3439, which - in turn borrowed from ESCOMP/CISM-wrapper#23, which in turn was a - slight modification of an implementation provided by @mnlevy1981 for - the MARBL documentation, which in turn borrowed from an - implementation put together by Unidata (credit where credit is due). - - I am not aware of out-of-the-box support for a version pull-down in - out-of-the-box sphinx themes (though the last time I looked was in - Fall, 2018, so there may be something available now). However, - support for a version dropdown exists in an open PR in the sphinx - readthedocs theme repository: readthedocs/sphinx_rtd_theme#438. I - have pushed this branch to a new repository in ESMCI - (https://github.com/ESMCI/sphinx_rtd_theme) to facilitate long-term - maintenance of this branch in case it disappears from the official - sphinx_rtd_theme repository. I have also cherry-picked a commit onto - that branch, which is needed to fix search functionality in sphinx1.8 - (from readthedocs/sphinx_rtd_theme#672) (which is another reason for - maintaining our own copy of this branch). The branch in this - repository is now named version-dropdown-with-fixes (branching off of - the version-dropdown branch in the sphinx_rtd_theme repository). In - the long-term, I am a little concerned about using this theme that - isn't showing any signs of being merged to the main branch of the - readthedocs theme, but this has been working for us in other projects - for the last 2 years, so I feel this is a reasonable approach in the - short-medium term. - -The new process for building the documentation is given here: -https://github.com/ESCOMP/CTSM/wiki/Directions-for-editing-CLM-documentation-on-github-and-sphinx - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#239 (Move documentation source to master) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- not run! - izumi ------- not run! - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/954 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev088 -Originator(s): sacks (Bill Sacks) -Date: Tue Apr 7 10:43:03 MDT 2020 -One-line Summary: Fix bug in snow aerosol numerics (causes occasional HUGE aerosol values) - -Purpose of changes ------------------- - -Multiplications / divisions by dtime were missing in a few places, in -some code that ensures that aerosol mass fluxes between the snow layers -don't exceed the total mass. This bug was introduced in ctsm1.0.dev065, -when a term was changed from a mass to a flux (per unit time), but some -of the code wasn't changed correspondingly. - -In one case this bug caused a crash, but in other cases it just causes -incorrect answers. The issue can be seen by examining the history -variables SNOBCMCL, SNOOCMCL and SNODSTMCL. In the case that led to the -crash, SNOBCMCL and SNOOCMCL became huge in one grid cell (~ 10^12) for -a long period before the crash. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#965 (Bug in snow aerosol numerics can cause - aerosol masses to blow up, starting with ctsm1.0.dev065) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none (not checked, but none expected) - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek, Keith Oleson - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- pass - - ok means tests pass, some answer changes as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (Small) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff/same climate - - Answer changes arise due to a bug fix for a condition that only - appears infrequently. When it does appear, answer changes can - potentially be enormous (e.g., snow aerosol concentrations 20 - orders of magnitude too large), though answer changes observed in - the test suite all appear relatively small. - - Answer changes just appeared for the following tests: - - FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm45BgcCrop.cheyenne_gnu.clm-no_subgrid_fluxes BASELINE ctsm1.0.dev087: DIFF - FAIL SMS_Ld1.nldas2_rnldas2_mnldas2.I2000Ctsm50NwpSpNldasGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev087: DIFF - FAIL SMS_Ld1.nldas2_rnldas2_mnldas2.I2000Ctsm50NwpSpNldasRsGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev087: DIFF - FAIL ERI_D_Ld9.ne30_g16.I2000Clm50BgcCruGs.cheyenne_intel.clm-vrtlay BASELINE ctsm1.0.dev087: DIFF - FAIL ERI_D_Ld9.T31_g37.I2000Clm50Sp.cheyenne_intel.clm-SNICARFRC BASELINE ctsm1.0.dev087: DIFF - FAIL ERI_Ld9.f45_g37.I2000Clm50BgcCruGs.cheyenne_intel.clm-nofire BASELINE ctsm1.0.dev087: DIFF - FAIL ERI_N2_Ld9.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev087: DIFF - FAIL SMS_D_Lm6.f45_f45_mg37.I2000Clm50Fates.cheyenne_intel.clm-FatesColdDef BASELINE ctsm1.0.dev087: DIFF - FAIL SMS_D_Lm6_P144x1.f45_f45_mg37.I2000Clm50Fates.cheyenne_intel.clm-FatesColdDef BASELINE ctsm1.0.dev087: DIFF - FAIL SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev087: DIFF - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/971 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev087 -Originator(s): sacks (Bill Sacks) -Date: Mon Apr 6 11:23:51 MDT 2020 -One-line Summary: Change hard-coded soil layers in phenology to use a target depth - -Purpose of changes ------------------- - -Adds infrastructure for finding the soil layer containing a given depth -(covered by unit tests). - -In phenology code, replaces hard-coded level 3 with a target soil -depth. This value is read from the parameter file. The default value is -set in a way that is bit-for-bit for standard CLM45 and CLM50 -configurations, but this will change answers for non-SP configurations -using the NWP soil layer structure or non-standard soil layer -structures. - -This is important for the sake of supporting flexible soil layers, as in -the NWP configuration. - -Also, some cleanup of the CNPhenology parameter reading code. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#952 (Change hard coded soil layers in phenology - to use a target depth) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[X] ctsm5_0-nwp -- only for non-SP cases - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -- New parameter added to NetCDF parameter file: phenology_soil_depth - -Substantial timing or memory changes: none expected (not checked) - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- pass - - ok means tests pass, a few answer changes as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (only Non-SP cases with NWP) - - Summarize any changes to answers, i.e., - - what code configurations: Non-SP cases with NWP or non-standard - soil layer structures - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff; same vs. new climate not investigated - - Differences in non-SP cases with soil layer structure different - from that of standard clm45 or clm50. Differences observed in - tests - ERS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-deepsoil_bedrock - and - SOILSTRUCTUD_Ld5.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-default. - - ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Ctsm50NwpBgcCropGswpGs.cheyenne_intel.clm-default - had no differences; I'm guessing this is just because there didn't - happen to be the appropriate PFTs present to show differences in - this short, coarse-resolution test. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/963 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev086 -Originator(s): mvertens (Mariana Vertenstein) -Date: Thu Mar 19 16:03:26 MDT 2020 -One-line Summary: Updates to NUOPC cap and minor fixes to ncdio_pio - -Purpose of changes ------------------- - -This tag has updates to the NUOPC cap that are needed for the latest -version of CMEPS. - -Now each component NUOPC cap needs to compute possibly time varying -orbital parameters. Before, in cpl7, this was done in the driver and -passed to the components via seq_infodata. However, now the driver is -really just a simple ascii file - so those calculations needed to -migrate to the component caps. - -In addition, this tag contains changes to ncdio_pio.F90 that improve -performance in some situations. - -This also updates MOSART and RTM tags to include fixes for the NUOPC cap -for MOSART and implementation of an initial NUOPC cap for RTM. - -Also, I1Pt compsets now use SROF rather than using an active runoff -model in 'null' mode. This leads to differences in namelists, but not in -results. - -Mariana Vertenstein implemented most of the changes in this tag; Jim -Edwards implemented the ncdio_pio changes; Bill Sacks did final testing -and integration. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#943 (NUOPC tests will fail in ctsm1.0.dev085) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- I1Pt tests and cases now use SROF rather than an active runoff model - with a null grid (only impacts namelists, not results) -- Changed nuopc test to use MOSART rather than SROF -- Changed finidat file used by LII test to solve a problem that was - uncovered with the ncdio_pio changes in this tag - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (just for NUOPC configurations) - - Summarize any changes to answers, i.e., - - what code configurations: Just some NUOPC configurations - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated carefully, but likely to be larger than roundoff - / same climate (due to introduction of time-varying orbital parameters) - - Differences are expected in NUOPC configurations using time-varying - orbital parameters. Note that no differences showed up in the test - suite, however, because the only nuopc test in the test suite is - new in this tag (so did not have baselines). - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- mosart: mosart1_0_35 -> mosart1_0_36 -- rtm: rtm1_0_70 -> rtm1_0_71 -- cmeps - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/issues/943 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev085 -Originator(s): sacks (Bill Sacks) -Date: Mon Mar 16 09:19:57 MDT 2020 -One-line Summary: Update cime - -Purpose of changes ------------------- - -Update to latest version of cime master - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include github issue ID): -- https://github.com/ESCOMP/CTSM/issues/943 - NUOPC tests will fail in ctsm1.0.dev085 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- NUOPC cases will fail from a standalone checkout - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- pass - - Two test failures: - - PEND SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default SHAREDLIB_BUILD - I have added this to the expected fails list for now - FAIL SMS_P720x1_Ln6.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart BASELINE ctsm1.0.dev084: ERROR BFAIL baseline directory '/glade/p/cgd/tss/ctsm_baselines/ctsm1.0.dev084/SMS_P720x1_Ln6.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart' does not exist - This test was added in the previous tag, but apparently wasn't run from there - - Note: I did testing using cime hash - 4f1880756a66ff12d304937d3c166d451ea50cf9, then updated to the tag - (cime5.8.17). The two are identical except for the cime ChangeLog. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -cime: branch_tags/cime5.8.15_a01 -> cime5.8.17 - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev084 -Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) -Date: Wed Feb 19 15:05:03 MST 2020 -One-line Summary: Bounds assertion for C isotopes when threading is on - -Purpose of changes ------------------- - -Previously, the bounds of c13 and c14 in subroutines TruncateCStates and -TruncateCandNStates were not checked when threading was on. This PR allows us -to handle c13 and c14 arrays like everything else in CTSM including (bounds -checking). - -This PR resolves issue ESCOMP/ctsm#811 - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): - -ESCOMP/ctsm#811 - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - - There was an issue (wrong wallclock time ) for one of the tests in the test - definitions which got fixed: (SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs..) - - Also, I tried making the wallclocktime for all tests in - cime_config/testdefs/testlist_clm.xml consistent in the format of hh:mm:ss. - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/CTSM/pull/923) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev083 -Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) -Date: Thu Feb 6 12:12:26 MST 2020 -One-line Summary: Some BFB Fixes: Resolve issues #683, # 874, #878, # 885, # 745, #838 - -Purpose of changes ------------------- - -Resolved issues: - -ESCOMP/ctsm#683 : Writing out FATES parameters only on masterproc. -ESCOMP/ctsm#874 : Changing the number of timesteps to run for - SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStar - to prevent failing with CMEPS. -ESCOMP/ctsm#878 : Removing the unused atm2lnd field. -ESCOMP/ctsm#885 : Changing the defaults for br_root in namelist_defaults to - enable FUN with CLM4.5. -ESCOMP/ctsm#745 : Removing ReadNL private subroutine from initVerticalMod.F90. -ESCOMP/ctsm#838 : Clarifying ZISNO in the variable long name. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -Resolves : - - ESCOMP/ctsm#683 - - ESCOMP/ctsm#874 - - ESCOMP/ctsm#878 - - ESCOMP/ctsm#885 - - ESCOMP/ctsm#745 - - ESCOMP/ctsm#838 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): - Not any changes in parameter values. - changing the default for br_root in namelist_defaults to enable FUN with - CLM4.5. - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - Changed the number of timesteps from Ln3 to Ln6 for - SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStar - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/897 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev082 -Originator(s): oleson (Keith Oleson) -Date: Sat Feb 1 09:28:41 MST 2020 -One-line Summary: Rename variables to avoid confusion; fix QSNOEVAP diagnostic - -Purpose of changes ------------------- - -Renamed variables as discussed in ESCOMP/ctsm#118 throughout the code. - -Also made a couple of minor changes to fix a couple of potential -problems with these variables as described in the branch commit logs. - -Tested for bfb before changing the history field variables -themselves. These changes are all bfb (with the exception of QSNOEVAP) -for a 1 month global 2deg simulation, but may not be bfb under all -conditions. QSNOEVAP is not bfb because I've added in qflx_ev_snow for -lakes. - -Also, update cime slightly with a fix for izumi machine updates - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#118 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none expected (not checked) - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok: tests pass, answer changes in QSNOEVAP but nothing else (as expected) - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (only one diagnostic field) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Larger than roundoff, but only in the diagnostic field QSNOEVAP - - Possibility of other answer changes in rare circumstances, not - observed in testing. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: cime5.8.15 -> branch_tags/cime5.8.15_a01 - Minor update for izumi machine changes - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/893 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev081 -Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) -Date: Mon Jan 13 15:37:07 MST 2020 -One-line Summary: Speed up restart writes - -Purpose of changes ------------------- - - E3SM#3163 made some changes to speed up restart writes. I use E3SM#3163 - function GetGlobalIndexArray in place of GetGlobalIndex so as to get - global indices by array rather than looping over every element. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #801 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: Limited testing did not show substantial timing changes - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: - @billsacks - @bishtgautam - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - tools-tests (test/tools): - - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- PASS - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: No - - @billsacks recommended running a global test in the branch vs. in master (i.e. - with vs. without the code mods) to compare restart files because the test suite - does not compare restart files and an error in the subgrid indices on the - restart file might go undetected. I ran this test: - ERS_D_Ld6.f10_f10_musgs.I1850Clm45BgcCrop.cheyenne_intel.clm-clm50CMIP6frc - and got identical values for all variables in the two restart files. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): - https://github.com/ESCOMP/ctsm/pull/880 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev080 -Originator(s): sacks (Bill Sacks) -Date: Mon Dec 2 12:23:22 MST 2019 -One-line Summary: Update externals, minor fixes to work with latest cime, get nuopc cap working - -Purpose of changes ------------------- - -(1) Update to latest version of externals. This includes a significant - cime update. - -(2) Minor fixes to get things working with the latest version of cime. - -(3) Fix from Mariana Vertenstein to get NUOPC cap working, fixes to - externals cfg files to allow running NUOPC cases out of the box, and - add a NUOPC test. - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -CIME update brings in some changes, e.g., in mapping files; otherwise, none. - -Substantial timing or memory changes: not investigated - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Added NUOPC test: - SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests passed, some baseline comparisons failed as expected - - Note: Most testing was done on ad1ad752; then, from the latest - version, I ran a 2-test test list of: - - SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default - - SMS_D.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default - - In addition to verifying that the above tests passed, I also - inspected the sharedlib build area to verify that separate builds of - the clm library were done for mct and nuopc. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: -- cheyenne tests compared against ctsm1.0.dev078, since cheyenne testing -was not run on ctsm1.0.dev079. - - -Answer changes --------------- - -Changes answers relative to baseline: YES (only f10, same climate) - - Summarize any changes to answers, i.e., - - what code configurations: Cases at f10 resolution - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff, but probably same climate - - Answer changes are due to https://github.com/esmci/cime/pull/3186 - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: branch_tags/cime5.8.3_chint17-05 -> cime5.8.15 -- rtm: rtm1_0_68 -> rtm1_0_70 -- mosart: mosart1_0_34 -> mosart1_0_35 -- cmeps: 471ac52 -> 181ff1ed9dfb279e619e8a2173f43baf7bf1dce3 - Also, note that cmeps is now checked out automatically - - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/845 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev079 -Originator(s): sacks (Bill Sacks) -Date: Mon Nov 4 14:41:41 MST 2019 -One-line Summary: Change a few uses of shr_kind - -Purpose of changes ------------------- - -Change a few uses of shr_kind to work with latest cime. These changes -are from Mariana Vertenstein. - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- NOT RUN! - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev078 -Originator(s): oleson (Keith Oleson) -Date: Thu Oct 31 12:30:00 MDT 2019 -One-line Summary: Fix rootr calculation with use_hydrstress true - -Purpose of changes ------------------- - -In cases with use_hydrstress=.true., both rootr_patch and rootr_col had -problems. This affected the diagnostic fields ROOTR and ROOTR_COLUMN, -and (in BGC cases) fed back on other parts of the system via affecting -the methane code. See https://github.com/ESCOMP/CTSM/issues/812 for more -details. - -This tag fixes this issue via these specific changes: - -1. Calculate btran in SoilMoistStressMod.F90 regardless of - use_hydrstress - -2. Comment on the applicability of this calculation and that of rootr in - SoilMoistStressMod.F90 - -3. Add the following comment to uses of rootr and rootr_col throughout - the code: "SMS method only" - -4. Allow ROOTR_COL history field only if use_hydrstress = .false. - -5. Remove the calculation of rootr_col in subroutine - Compute_EffecRootFrac_And_VertTranSink_HydStress within module - SoilWaterPlantSinkMod.F90 since that calculation is invalid for PHS. - -6. Normalize root resistances for pervious road over nlevgrnd, not - nlevsoi - -Note that the rootr calculation is done using the non-PHS (i.e., SMS) -method. So rootr is not really consistent with PHS; this is something -that should probably be revisited later. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes ESCOMP/ctsm#812 (Problems with rootr when use_hydrstress=.true.) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: not checked; none expected - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests pass, answers change as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (PHS and methane) (same climate) - - Summarize any changes to answers, i.e., - - what code configurations: Clm50Bgc (cases with both use_hydrstress=.true. and methane active) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff / same climate - - For details on differences, see - https://github.com/ESCOMP/CTSM/issues/812#issuecomment-547924289 - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist - - URL for LMWG diagnostics output used to validate new climate: - http://webext.cgd.ucar.edu/I20TR/clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist/lnd/clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist.1995_2014-clm50_ctsm10d074_2deg_GSWP3V1_hist.1995_2014/setsIndex.html - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev077 -Originator(s): sacks (Bill Sacks) -Date: Sun Oct 27 16:23:39 MDT 2019 -One-line Summary: Consistently use frac_sno_eff rather than frac_sno in qg calculations - -Purpose of changes ------------------- - -Consistently use frac_sno_eff rather than frac_sno in qg calculations - -The change here only changes answers for (1) urban pervious road, and -(2) more broadly with use_subgrid_fluxes = .false. - -Previously, code in CalculateSurfaceHumidity was inconsistent regarding -the use of frac_sno vs. frac_sno_eff. I wanted to make this consistent -to facilitate upcoming cleanup of CalculateSurfaceHumidity. I went back -and forth as to which one we should use here. (See also -https://github.com/ESCOMP/CTSM/issues/822). - -Argument for frac_sno_eff: This is consistent with the use of -frac_sno_eff elsewhere in the calculation of surface fluxes. - -Argument for frac_sno: Even in CLM4.0 (prior to the introduction of -frac_sno_eff and frac_h2osfc), frac_sno was used to calculate surface -relative humidity. That makes me think that the parameterizations were -improved by using frac_sno here, even though frac_sno at that point was -mainly just used for albedo / radiation calculations. So sticking with -frac_sno would be more consistent with what has been done for a long -time, and would presumably be a bit better scientifically. - -However, when I tried changing this to use frac_sno rather than -frac_sno_eff: - - qg(c) = frac_sno_eff(c)*qg_snow(c) + (1._r8 - frac_sno_eff(c) - frac_h2osfc(c))*qg_soil(c) & - + frac_h2osfc(c) * qg_h2osfc(c) - -I got a crash with use_subgrid_fluxes false (test -SMS_D_Ld1_P4x1.f10_f10_musgs.I2000Clm45BgcCropQianRsGs.bishorn_gnu.clm-no_subgrid_fluxes), -due to a check I put in relatively recently to ensure that the top-layer -soil liquid never goes significantly negative: - -WJS 218: frac_sno, frac_sno_eff, frac_h2osfc, snl = 6.6447358408778726E-005 1.0000000000000000 0.0000000000000000 -1 - qg_snow, qg_soil, qg_h2osfc, qg = 3.8414454029812475E-003 3.6634834595404343E-003 3.6635176705822736E-003 3.6634952846414733E-003 - ERROR: In UpdateState_TopLayerFluxes, h2osoi_liq has gone significantly negative - Bulk/tracer name = bulk - c, lev_top(c) = 218 0 - h2osoi_liq_top_orig = 6.6448689668604415E-004 - h2osoi_liq = -2.6754040213948407E-004 - frac_sno_eff = 1.0000000000000000 - qflx_liq_grnd*dtime = 0.0000000000000000 - qflx_dew_grnd*dtime = 0.0000000000000000 - qflx_evap_grnd*dtime = 9.3202729882552822E-004 - ENDRUN: - ERROR: In UpdateState_TopLayerFluxes, h2osoi_liq has gone significantly negative - -What seems to be going on is: With a little bit of snow present, when I -use frac_sno rather than frac_sno_eff, we end up with a qg value very -close to that of soil. But I think the later evaporation happens from -the snow, at which point I guess the dryer air above leads to there -being too large evaporation from the snow. - -So in the end, I decided to consistently use frac_sno_eff, even though -this might be a small step backwards in terms of the accuracy of surface -humidity for urban pervious road and with use_subgrid_fluxes = .false. - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self (but approved conceptually by Sean Swenson and -Keith Oleson) - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests pass, answers change as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (Small) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Expected to be larger than roundoff/same climate, but not - investigated carefully - - For the default configuration with use_subgrid_fluxes = .true., - differences are restricted to urban pervious road. I spot-checked - a few tests to ensure that we only saw differences in FSH for - urban landunits; this was generally true, with the exception of - ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput, - which also had differences over crop and natural veg - landunits. This spillover effect seems to be related to the - non-local interactions that arise from methane's dependence on - TWS, though I don't understand why I only saw this in a transient - case, and not in similar non-transient cases. See - https://github.com/ESCOMP/CTSM/issues/658#issuecomment-546740771 - for more details. - - For the non-default use_subgrid_fluxes = .false., there - differences in the natural vegetation and crop landunits, too. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev076 -Originator(s): sacks (Bill Sacks) -Date: Fri Oct 25 16:04:20 MDT 2019 -One-line Summary: Set frac_sno_eff=0 if frac_sno is 0; avoid unnecessary calls to QSat - -Purpose of changes ------------------- - -Two changes that are bit-for-bit except for changes in the FSNO_EFF -diagnostic field, both with an eye towards cleaning up -SurfaceHumidityMod in preparation for adding water tracers to that -module: - -(1) Set frac_sno_eff to 0 if frac_sno is 0. Previously, for cases where - frac_sno_eff was a binary 0/1 rather than being set equal to - frac_sno, frac_sno_eff was always being set to 1, even if there was - no snow. Sean Swenson thinks that didn't matter, but I found it - confusing, and it could be more problematic with some upcoming - changes I plan to make (where I'm going to use frac_sno_eff as a - weighting factor in calculating qg terms, including for landunits - that use a binary 0/1 frac_sno_eff.) - -(2) Avoid unnecessary calls to QSat, since this function is relatively - expensive. - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: No substantial changes; from a -single run of PFS_Ld20.f09_g17.I2000Clm50BgcCrop.cheyenne_intel, max -timing of the main changed section (bgp1) decreased by about 10%; this -may be within machine variability, though. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests pass, answer changes as expected just for FSNO_EFF - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES, but just for the diagnostic field FSNO_EFF - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - diagnostic only: just changes FSNO_EFF - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev075 -Originator(s): sacks (Bill Sacks) -Date: Fri Oct 25 15:44:52 MDT 2019 -One-line Summary: Lakes: Adjust frac_sno after updating 0-layer snow pack for dew & sublimation - -Purpose of changes ------------------- - -Main change is: for lakes, possibly adjust frac_sno after updating -0-layer snow pack for dew & sub, ensuring that zero vs. non-zero values -of frac_sno agree with whether the snow pack has zero or non-zero -amounts of snow. The main motivation for this is to ensure that, if we -have any snow, then frac_sno should be non-zero. Along with this, I'm -also ensuring that, if we go down to 0 snow, then we also go down to 0 -frac_sno. - -A related change was to move the code ensuring that h2osno_no_layers -doesn't go negative: I have moved this to before h2osno_no_layers is -referenced, to assure we don't get a slightly negative snow depth. (I -haven't noticed any problems due to the old placement, but it seems -safer to put the limiting before the reference to h2osno_no_layers.) - -Also, an unrelated change in run_sys_tests: Add option for rerunning -existing failed tests. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#827 (Lake frac_sno can remain 0 even when there - is some snow addition from frost) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: None expected - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - pass (on my mac: 'make test' with python2 & python3 and 'make lint') - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests pass, answers change as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (Small) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Expected to be larger than roundoff/same climate - - Changes are introduced only over lake columns, and these changes - should be small, since they only relate to the setting of frac_sno - when there is dew or sublimation on a very thin snow - pack. - - Although the direct changes should only affect lakes, I did - observe changes in crop columns in a transient test that I - spot-checked - (ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput) - - maybe due to some of the non-local interactions in - https://github.com/ESCOMP/CTSM/wiki/Parameterizations-that-can-cause-nonlocal-interactions, - or maybe due to some other non-local interaction, either known or - buggy. (In non-transient tests that I spot checked - (ERP_P72x2_Lm36.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-clm50cropIrrigMonth_interp - and - SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput): - diffs in FSH in h1 file are just over lake landunits, as - expected.) - - Update: it seems that these changes in crop columns arise from - the nonlocal interactions caused by the dependence of methane - on TWS, though I don't understand why I only saw this in a - transient case, and not in similar non-transient cases. See - https://github.com/ESCOMP/CTSM/issues/658#issuecomment-546740771 - for more details. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev074 -Originator(s): sacks (Bill Sacks) -Date: Wed Oct 23 19:25:21 MDT 2019 -One-line Summary: For lakes: when reading finidat, set frac_sno=1 if h2osno_total > 0 - -Purpose of changes ------------------- - -Due to ESCOMP/ctsm#783, frac_sno used to be 0 for all lake points. That -was mostly fixed, but the issue is still present on initial conditions -files that were generated prior to that fix (which includes most or all -of our out-of-the-box restart files). This causes frac_sno to be 0 for -lake points at the start of the simulation, even if there is a snow pack -present. Currently this doesn't cause significant problems, but I'd like -to change the calculation of frac_sno_eff so that it is 0 if frac_sno is -0 - and then this frac_sno problem becomes an issue (causing divide by 0 -in at least one place). - -However, further problems were introduced if I tried to always apply -this correction: It appears that sometimes the restart file legitimately -has frac_sno == 0 for lake columns with non-zero snow cover. To avoid -changing answers for newer restart files, I am writing metadata to the -restart file documenting whether the fix has already been applied on -that restart file, and if so, we avoid reapplying the fix. - -Getting this restart metadata correct was tricky, especially when -running init_interp. I have introduced a new module to encapsulate this -complexity. This can be used in general for writing / reading metadata -on which issues have been fixed on a given restart file. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] -- Resolves ESCOMP/ctsm#783 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- The setting of initial lake frac_sno to 1 isn't exactly correct, but - it's better than the old value of 0. - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none -- I didn't check the PFS test, but the only change that could have - likely led to performance changes was the addition of a metadata copy - in init_interp. I checked the timing of this piece, and found it to be - a negligible portion of the total init_interp time - (https://github.com/ESCOMP/CTSM/pull/825#issuecomment-545219601). - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek gave this an initial look and gave general -approval for the restart file metadata mechanism I have added. He may -give it a more careful look, possibly accompanied by a further cleanup -tag addressing any issues he finds. - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests passed, baselines fail as expected. - - Note that the FUNIT test failed initially; I got it passing on my - Mac, but didn't rerun it on cheyenne. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (same climate, only at startup) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff/same climate - - The only change is in initial lake frac_sno. This should only - affect the start of the simulation, and only over lake points. I - verified that changes are only over lake points via: For both - SMS_D_Ld1.f09_g17.I1850Clm50Sp.cheyenne_intel.clm-default (which - doesn't use init_interp) and - SMS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default - (which uses init_interp): I checked which points have differences - in FSH in the h1 (vector) history file. Diffs were only over lake - points. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/825 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev073 -Originator(s): sacks (Bill Sacks) -Date: Tue Oct 22 06:14:24 MDT 2019 -One-line Summary: Fix bug in calculation of dqgdT - -Purpose of changes ------------------- - -The calculation of dqgdT, which gives the derivative, d(qg)/dT, was -incorrect for soil/crop landunits when there is no snow. This tag fixes -that bug. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/CTSM#824 (dqgdT incorrect when there is no snow) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: not checked, but none expected - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sean Swenson reviewed and approved my plan, though not the final code - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests pass, answers change as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff/same climate - - I checked the impact from one-day averages in test - SMS_D_Ld1_P4x1.f10_f10_musgs.I2000Clm50BgcCropQianRsGs.bishorn_gnu.clm-default, - by looking at differences in EFLX_LH_TOT. The impact is small: - daily-average differences in that variable are typically 0.01 W - m-2 or less; most grid cells have significantly less difference - than that; only one or a few f10 grid cells have significantly - greater differences, with the biggest difference being about 0.1 W - m-2. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev072 -Originator(s): mvertens (Mariana Vertenstein) -Date: Tue Oct 15 09:41:50 MDT 2019 -One-line Summary: Add NUOPC cap - -Purpose of changes ------------------- - -Add NUOPC cap in order to run with the new NUOPC driver/mediator. There -was some code movement / refactoring of existing code to support this, -with the biggest change being the introduction of a new subdirectory -under src/cpl. - -Most changes are from Mariana Vertenstein and Jim Edwards. - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none expected (not checked) - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- NUOPC cap currently does not have any tests in the aux_clm test suite -- There are currently no tests ensuring that the nuopc and mct caps give - bit-for-bit answers, though the nuopc_cap_bfb testmod could be used to - support such a test - -Changes to tests or testing: none - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- mosart: mosart1_0_33 -> mosart1_0_34 (supports nuopc cap) - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev071 -Originator(s): sacks (Bill Sacks) -Date: Fri Oct 11 07:03:40 MDT 2019 -One-line Summary: Split CanopyTemperature into separate pieces - -Purpose of changes ------------------- - -CanopyTemperature was doing a few unrelated things, none of which -actually had anything to do with calculating canopy temperature. At the -driver level, I have split CanopyTemperature into BiogeophysPreFluxCalcs -and CalculateSurfaceHumidity. BiogeophysPreFluxCalcs calls out to a -number of separate routines, some in that same module and some -elsewhere, including a new routine in FrictionVelocityMod. - -Also some minor related cleanup, including - -- Made FrictionVelocityMod object-oriented - -- A bit of rework of how qflx_evap_veg and qflx_tran_veg are set. This - changes answers for the (default inactive) QFLX_EVAP_VEG history field - (see also ESCOMP/ctsm#816). - -- Removed qsat conditionals that should never be invoked - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes ESCOMP/ctsm#816 (QFLX_EVAP_VEG should be 0 over lakes) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES, but only for the (default-inactive) field QFLX_EVAP_VEG - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff, but only for the default-inactive field QFLX_EVAP_VEG - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev070 -Originator(s): sacks (Bill Sacks) -Date: Wed Oct 9 06:16:39 MDT 2019 -One-line Summary: Fix for writing 0-d variables with PIO2 - -Purpose of changes ------------------- - -Previously, there were problems when writing 0-d (scalar) variables with -PIO2 in DEBUG mode. This change fixes that issue. - -Jim Edwards put in place an initial fix; I put in place the final fix -based on changes Mariana Vertenstein made in MOSART. I have not tested -this with PIO2, but am hopeful that it fixes the PIO2 problem since the -similar MOSART changes fixed that problem. - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self; earlier version reviewed by Erik Kluzek and Mariana Vertenstein - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/CTSM/pull/810 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev069 -Originator(s): sacks (Bill Sacks) -Date: Mon Oct 7 10:22:22 MDT 2019 -One-line Summary: Misc. code cleanup and minor bug fixes - -Purpose of changes ------------------- - -Resolve a variety of "simple bfb" issues. Note that some of these result -in answer changes for select diagnostic fields. See specific notes below -for details, under "Issues fixed" and answer changes. - -The fix for ESCOMP/ctsm#27 changes answers for some diagnostic fields, -as noted below. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#27 (BTRAN should be spval over all special - landunits) - - Also fixed some related fields, as noted below, under answer changes - -- Resolves ESCOMP/ctsm#31 (some CLM history fields don't restart - properly) - - This was mostly resolved previously; here I just did some final - cleanup and fixing of NFIRE - -- Resolves ESCOMP/ctsm#48 (code for initializing some isotope carbon - state variables looks wrong) - - Removed the incorrect code, which was never being exercised - -- Resolves ESCOMP/ctsm#58 (Change SHR_ASSERT calls to avoid using - errMsg) - - Purpose was to speed up DEBUG runs on some machines/compilers - -- Resolves ESCOMP/ctsm#111 (Precision of constants in - SoilTemperature.F90 is not double) - - No answer changes, because 1 (single prec) = 1 (double prec) - -- Resolves ESCOMP/ctsm#334 (Introduce a new activelayer_type) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: potentially speeds up debug runs on some machines/compilers - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests pass, some baseline comparisons fail as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES, but just for select diagnostic fields - - Summarize any changes to answers, i.e., - - what code configurations: ALL - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Greater than roundoff, but only in select diagnostic field - no impact on climate - - There were changes in the following diagnostic fields, which are - now averaged over only vegetated landunits (see ESCOMP/ctsm#27): - - BTRAN - - BTRANMN - - RSSHA - - RSSUN - - ROOTR (inactive by default) - - ROOTR_COLUMN (inactive by default) - - RRESIS (inactive by default) - - Changes are also possible in rare circumstances for the NFIRE - diagnostic field, in transient cases, although no differences were - observed for this field in the test suite (see ESCOMP/ctsm#31). - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev068 -Originator(s): sacks (Bill Sacks) -Date: Mon Sep 30 09:57:04 MDT 2019 -One-line Summary: Add water tracers to CombineSnowLayers, DivideSnowLayers, ZeroEmptySnowLayers - -Purpose of changes ------------------- - -Add water tracers to CombineSnowLayers, DivideSnowLayers and -ZeroEmptySnowLayers. This completes the tracerization of the core snow -code: most or all of the code in SnowHydrologyMod is now tracerized. - -In contrast to most routines that I have tracerized, the tracerization -of these routines is done by embedding loops over tracers inside -existing code structures, rather than splitting out separate routines -that operate on bulk or tracer quantities. This is because (1) it didn't -make sense to introduce explicit fluxes for the state updates done here, -so we didn't have the extra need of having separate routines for flux -calculations vs. state updates; (2) the state updates were embedded in -loops over levels and conditionals in a way that would have been awkward -and messy to try to separately update bulk-and-tracer quantities -(h2osoi_liq, h2osoi_ice, etc.) from bulk-only quantities (dz, etc.). - -Also, a bit of reordering of LakeHydrologyMod in order to keep the snow -code more together. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#778 (Implement water tracers for combining and - dividing snow layers) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: I don't think so - Based on the changes introduced, I expect *very* small increases in - runtime of the modified routines (which would show up in the - hydro_without_drainage timer), even for cases without water tracers, - but I wouldn't expect this to have a significant impact. From PFS - test, and specifically looking at the timing of - hydro_without_drainage in that test, I see a possible small increase - (a few percent) in the timing of that section, though the differences - are within typical machine variability, so don't seem necessarily - significant. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev067 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Thu Sep 26 15:02:39 MDT 2019 -One-line Summary: Add config_archive.xml to CTSM cime_config -- no testing - -Purpose of changes ------------------- - -Add config_archive.xml to cime_config for CTSM. Update the CODE_OF_CONDUCT -to the August/2019 UCAR version. - -No testing done. - -Bugs fixed or introduced ------------------------- - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self - - -CTSM testing: doc (no standard testing done) - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - src unit-tests: - - cheyenne - PASS - - regular tests (aux_clm): None - -If the tag used for baseline comparisons was NOT the previous tag, note that here: previous - - -Answer changes --------------- - -Changes answers relative to baseline: No! - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): None -(https://github.com/ESCOMP/ctsm/pull) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev066 -Originator(s): sacks (Bill Sacks) -Date: Fri Sep 20 09:07:23 MDT 2019 -One-line Summary: Add water tracers to SnowCapping - -Purpose of changes ------------------- - -Update water tracer terms in SnowCapping. As I have done elsewhere, this -has involved splitting each piece of SnowCapping into its own subroutine, -which operates either on bulk, tracers, or bulk + tracers. - -This is supported by calls to ResetCheckedTracers prior to the call to -SnowCapping, since some intervening code is not yet tracerized. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#777 (Implement water tracers for SnowCapping) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - Small increase in total runtime of PFS test, but the relevant timing - section, hydro_without_drainage, took slightly *less* time compared - with the last tag. - - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - izumi ------- pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev065 -Originator(s): sacks (Bill Sacks) -Date: Sat Sep 14 12:52:42 MDT 2019 -One-line Summary: Add water tracers to SnowWater - -Purpose of changes ------------------- - -Update water tracer terms in SnowWater. As I have done elsewhere, this -has involved splitting each piece of SnowWater into its own subroutine, -which operates either on bulk, tracers, or bulk + tracers. - -This is supported by calls to ResetCheckedTracers prior to the call to -SnowWater, since some intervening code is not yet tracerized. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#776 (Implement water tracers for SnowWater) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - izumi ------- ok - - ok means tests pass, baselines fail as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Roundoff level: answer changes just arise because I have made - qflx_snow_percolation_col a true flux, with units of - per-unit-time; this involved dividing by dtime, and later - multiplying by dtime when it is applied to states. Previously, the - corresponding variable (qout / qin) was not per-unit-time. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - I ran comparisons against a version off of master that had the - minimal changes to exhibit these roundoff-level changes. Diffs for - this are below. My branch is bit-for-bit with this version. - - diff --git a/src/biogeophys/SnowHydrologyMod.F90 b/src/biogeophys/SnowHydrologyMod.F90 - index cad47e28..0abcc49f 100644 - --- a/src/biogeophys/SnowHydrologyMod.F90 - +++ b/src/biogeophys/SnowHydrologyMod.F90 - @@ -1140,17 +1140,17 @@ subroutine SnowWater(bounds, & - c = filter_snowc(fc) - if (j >= snl(c)+1) then - - - h2osoi_liq(c,j) = h2osoi_liq(c,j) + qin(c) - + h2osoi_liq(c,j) = h2osoi_liq(c,j) + qin(c)*dtime - - - mss_bcphi(c,j) = mss_bcphi(c,j) + qin_bc_phi(c) - - mss_bcpho(c,j) = mss_bcpho(c,j) + qin_bc_pho(c) - - mss_ocphi(c,j) = mss_ocphi(c,j) + qin_oc_phi(c) - - mss_ocpho(c,j) = mss_ocpho(c,j) + qin_oc_pho(c) - + mss_bcphi(c,j) = mss_bcphi(c,j) + qin_bc_phi(c)*dtime - + mss_bcpho(c,j) = mss_bcpho(c,j) + qin_bc_pho(c)*dtime - + mss_ocphi(c,j) = mss_ocphi(c,j) + qin_oc_phi(c)*dtime - + mss_ocpho(c,j) = mss_ocpho(c,j) + qin_oc_pho(c)*dtime - - - mss_dst1(c,j) = mss_dst1(c,j) + qin_dst1(c) - - mss_dst2(c,j) = mss_dst2(c,j) + qin_dst2(c) - - mss_dst3(c,j) = mss_dst3(c,j) + qin_dst3(c) - - mss_dst4(c,j) = mss_dst4(c,j) + qin_dst4(c) - + mss_dst1(c,j) = mss_dst1(c,j) + qin_dst1(c)*dtime - + mss_dst2(c,j) = mss_dst2(c,j) + qin_dst2(c)*dtime - + mss_dst3(c,j) = mss_dst3(c,j) + qin_dst3(c)*dtime - + mss_dst4(c,j) = mss_dst4(c,j) + qin_dst4(c)*dtime - - if (j <= -1) then - ! No runoff over snow surface, just ponding on surface - @@ -1167,8 +1167,8 @@ subroutine SnowWater(bounds, & - qout(c) = max(0._r8,(vol_liq(c,j) & - - ssi*eff_porosity(c,j))*dz(c,j)*frac_sno_eff(c)) - end if - - qout(c) = qout(c)*1000._r8 - - h2osoi_liq(c,j) = h2osoi_liq(c,j) - qout(c) - + qout(c) = (qout(c)*1000._r8)/dtime - + h2osoi_liq(c,j) = h2osoi_liq(c,j) - qout(c)*dtime - qin(c) = qout(c) - - ! mass of ice+water: in extremely rare circumstances, this can - @@ -1187,7 +1187,7 @@ subroutine SnowWater(bounds, & - if (qout_bc_phi(c) > mss_bcphi(c,j)) then - qout_bc_phi(c) = mss_bcphi(c,j) - endif - - mss_bcphi(c,j) = mss_bcphi(c,j) - qout_bc_phi(c) - + mss_bcphi(c,j) = mss_bcphi(c,j) - qout_bc_phi(c)*dtime - qin_bc_phi(c) = qout_bc_phi(c) - - ! BCPHO: - @@ -1196,7 +1196,7 @@ subroutine SnowWater(bounds, & - if (qout_bc_pho(c) > mss_bcpho(c,j)) then - qout_bc_pho(c) = mss_bcpho(c,j) - endif - - mss_bcpho(c,j) = mss_bcpho(c,j) - qout_bc_pho(c) - + mss_bcpho(c,j) = mss_bcpho(c,j) - qout_bc_pho(c)*dtime - qin_bc_pho(c) = qout_bc_pho(c) - - ! OCPHI: - @@ -1205,7 +1205,7 @@ subroutine SnowWater(bounds, & - if (qout_oc_phi(c) > mss_ocphi(c,j)) then - qout_oc_phi(c) = mss_ocphi(c,j) - endif - - mss_ocphi(c,j) = mss_ocphi(c,j) - qout_oc_phi(c) - + mss_ocphi(c,j) = mss_ocphi(c,j) - qout_oc_phi(c)*dtime - qin_oc_phi(c) = qout_oc_phi(c) - - ! OCPHO: - @@ -1214,7 +1214,7 @@ subroutine SnowWater(bounds, & - if (qout_oc_pho(c) > mss_ocpho(c,j)) then - qout_oc_pho(c) = mss_ocpho(c,j) - endif - - mss_ocpho(c,j) = mss_ocpho(c,j) - qout_oc_pho(c) - + mss_ocpho(c,j) = mss_ocpho(c,j) - qout_oc_pho(c)*dtime - qin_oc_pho(c) = qout_oc_pho(c) - - ! DUST 1: - @@ -1223,7 +1223,7 @@ subroutine SnowWater(bounds, & - if (qout_dst1(c) > mss_dst1(c,j)) then - qout_dst1(c) = mss_dst1(c,j) - endif - - mss_dst1(c,j) = mss_dst1(c,j) - qout_dst1(c) - + mss_dst1(c,j) = mss_dst1(c,j) - qout_dst1(c)*dtime - qin_dst1(c) = qout_dst1(c) - - ! DUST 2: - @@ -1232,7 +1232,7 @@ subroutine SnowWater(bounds, & - if (qout_dst2(c) > mss_dst2(c,j)) then - qout_dst2(c) = mss_dst2(c,j) - endif - - mss_dst2(c,j) = mss_dst2(c,j) - qout_dst2(c) - + mss_dst2(c,j) = mss_dst2(c,j) - qout_dst2(c)*dtime - qin_dst2(c) = qout_dst2(c) - - ! DUST 3: - @@ -1241,7 +1241,7 @@ subroutine SnowWater(bounds, & - if (qout_dst3(c) > mss_dst3(c,j)) then - qout_dst3(c) = mss_dst3(c,j) - endif - - mss_dst3(c,j) = mss_dst3(c,j) - qout_dst3(c) - + mss_dst3(c,j) = mss_dst3(c,j) - qout_dst3(c)*dtime - qin_dst3(c) = qout_dst3(c) - - ! DUST 4: - @@ -1250,7 +1250,7 @@ subroutine SnowWater(bounds, & - if (qout_dst4(c) > mss_dst4(c,j)) then - qout_dst4(c) = mss_dst4(c,j) - endif - - mss_dst4(c,j) = mss_dst4(c,j) - qout_dst4(c) - + mss_dst4(c,j) = mss_dst4(c,j) - qout_dst4(c)*dtime - qin_dst4(c) = qout_dst4(c) - - end if - @@ -1280,9 +1280,9 @@ subroutine SnowWater(bounds, & - do fc = 1, num_snowc - c = filter_snowc(fc) - ! Qout from snow bottom - - qflx_snow_drain(c) = qflx_snow_drain(c) + (qout(c) / dtime) - + qflx_snow_drain(c) = qflx_snow_drain(c) + qout(c) - - - qflx_rain_plus_snomelt(c) = (qout(c) / dtime) & - + qflx_rain_plus_snomelt(c) = qout(c) & - + (1.0_r8 - frac_sno_eff(c)) * qflx_liq_grnd(c) - int_snow(c) = int_snow(c) + frac_sno_eff(c) & - * (qflx_dew_snow(c) + qflx_dew_grnd(c) + qflx_liq_grnd(c)) * dtime - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev064 -Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) -Date: Mon Sep 9 13:14:51 MDT 2019 -One-line Summary: User defined top-two snow layers - -Purpose of changes ------------------- - - Instead of hardcoding, we now set: - - dzmin(1) = snow_dzmin_1 - dzmax_l(1) = snow_dzmax_l_1 - dzmax_u(1) = snow_dzmax_u_1 - dzmin(2) = snow_dzmin_2 - dzmax_l(2) = snow_dzmax_l_2 - dzmax_u(2) = snow_dzmax_u_2 - - where the right-hand-side variables get namelist-defined values and the - model calculates dzmin and dzmax_* for the remaining snow layers using - recursive formulas. The calculation is intended to match the previously - hardcoded values, except for the bottom snow layer when nlevsno < 12. - The bottom layer now always gets dzmax_* = huge(1._r8). The formulas - appear in a document titled "A firn model for CLM" that is linked to - #729. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #729 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - New namelist parameters for specifying the top-two snow layers: - snow_dzmin_1, snow_dzmax_l_1, snow_dzmax_u_1 - snow_dzmin_2, snow_dzmax_l_2, snow_dzmax_u_2 - -Changes made to namelist defaults (e.g., changed parameter values): - Introduced default values for the new parameters so as to maintain - same answers to within roundoff - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: @billsacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - tools-tests (test/tools): - - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change: roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - Introduced temporary code to overwrite dzmin(j), dzmax_l(j), and - dzmax_u(j) with their original values when different by less than - 1e-13 from their original values for all but the bottom snow layer. - The bottom layer was left as dzmax_l = dzmax_u(j) = huge(1._8), i.e. - the new value. The test resulted in bit-for-bit same answers. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): - https://github.com/ESCOMP/ctsm/pull/792 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev063 -Originator(s): erik (Erik Kluzek) -Date: Thu Sep 5 21:28:02 MDT 2019 -One-line Summary: Two answer changing fixes (fire, DWT_SLASH) and fix for urban streams for Clm45 - -Purpose of changes ------------------- - -Fire bug fix and DWT_SLASH change and fix urban stream years for clm4_5. -The latitude used in an expression for Bgc-Fire model Li2016 (used in Clm50) -had latitude in degrees rather than in radians as it should have been. The -term is used for ignition and the cosine was being taken in degrees rather -than radians, hence the spatial pattern for ignition with latitude was incorrect. - -The history field DWT_SLASH_CFLUX was being calculated on the column, but -really should have been a patch level variable. In the same way other fields -were handled we made DWT_SLASH_CFLUX a grid-cell variable, and added -DWT_SLASH_CFLUX_PATCH on the patch level that could be added to output. The same -is true of the C13_ and C14_ versions of it. - -Clm45 was setting urbantv to year 2000, rather than 1850 or historical as it should -have. The urbantv file for Clm45 doesn't actually change, so this doesn't actually -make a difference. But, it does make the namelist look wrong. - -Note, that SP cases, Vic cases and Fates cases do NOT change answers. Or if fire is -off, or certain single-point cases. Some cold-start cases don't seem to be sensitive -to it either. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #175, #787, #780 - fixes #175 urban stream years for clm4_5 - fixes #787 DWT_SLASH field - fixes #780 Bug in CN Fire Li 2016 which used latitude in degrees rather than radians - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): Defaults for urbantv for clm4_5 - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self, @olywon - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (62 compare fail due to namelist changes) - - regular tests (aux_clm): - - cheyenne ---- OK - izumi ------- OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: previous - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! (important clm5_0-BGC) - - Summarize any changes to answers, i.e., - - what code configurations: Clm50Bgc and some Clm45Bgc cases - - what platforms/compilers: All - - nature of change: similar climate (but fire ignition pattern changes by latitude) - DWT_SLASH_* history fields change because moved to gridcell quantity (so change is relatively minor) - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: oleson/clm50_cesm20R_2deg_GSWP3V1_issue780_hist (for the fire change) - - URL for LMWG diagnostics output used to validate new climate: -http://webext.cgd.ucar.edu/I20TR/clm50_cesm20R_2deg_GSWP3V1_issue780_hist/lnd/clm50_cesm20R_2deg_GSWP3V1_issue780_hist.1995_2014-clm50_cesm20R_2deg_GSWP3V1_hist.1995_2014/setsIndex.html - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #802 -(https://github.com/ESCOMP/ctsm/pull) - #802 -- Three answer changing fixes (fire, DWT_SLASH, urban streams for clm4_5) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev062 -Originator(s): sacks (Bill Sacks) -Date: Tue Sep 3 16:04:28 MDT 2019 -One-line Summary: Move hobart tests to izumi - -Purpose of changes ------------------- - -Move all hobart testing to izumi. - - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include github issue ID): -- Recurrence of ESCOMP/ctsm#174 (ne30 case fails on hobart_nag due to floating overflow) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- Testing should now be run on izumi, not hobart - -Changes to tests or testing: -- All hobart tests moved to izumi - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- not run - izumi ------- pass - - Also ran prealpha and prebeta tests that I moved from hobart to izumi. These passed except: - - ERP_D_Ld5.ne30_g16.I1850Clm50BgcCrop.izumi_nag.clm-default (#174) - - ERP_Ld5.f19_g17.I2000Clm50SpRtmFl.izumi_pgi.clm-default - - SMS_D_Ld1.f19_g17.I1850Clm45Cn.izumi_pgi.clm-default - - The last two failed with errors like: - - i011.unified.ucar.edu.44619hfi_userinit: mmap of status page (dabbad0008040000) failed: Operation not permitted - - I wonder if the issue is that multi-node pgi cases don't work on izumi? - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: cime5.8.3_chint17-04 -> cime5.8.3_chint17-05 - Minor change on izumi to allow using run_sys_tests - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev061 -Originator(s): erik (Erik Kluzek) -Date: Sun Sep 1 22:37:07 MDT 2019 -One-line Summary: Simple b4b fixes: new params file, remove override_nsrest/anoxia_wtsat, DV deprecated - -Purpose of changes ------------------- - -New clm5 paramsfile that has the bad date of 631 changed to 701. Along with some simple bit for -bit changes. Removing some problematic options. Making Dynamic Vegetation a deprecated option -that requires you to use -ignore_warnings with it. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #463 #79 #97 #98 #104 #122 #173 #794 #795 #796 - - Fixes #463 bad date on params file that didn't allow using ESMF library with Crop - Fixes #79 correct documentation of qflx_evap_tot - Fixes #97 remove override_nsrest - Fixes #98 add warning when using single instance of a startup file for multi-instance cases - Fixes #104 use get_step_size_real when putting into a real variable - Fixes #122 decomp pool arrays should not start at 0 but 1 - Fixes #173 remove psi_soil_ref as not used - Fixes #794 remove anoxia_wtsat - Fixes #795 Correct documentation of -light_res - Fixes #796 Deprecate Dynamic Vegetation - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Remove namelist items - Remove namelist items: anoxia_wtsat, override_nsrest - Turning dynamic Vegetation on, now displays a warning, and requires using -ignore_warnings in CLM_BLDNML_OPTS - -Changes made to namelist defaults (e.g., changed parameter values): New paramdata files - -Changes to the datasets (e.g., parameter, surface or initial files): - clm5 paramdata file has correct date for crop of 701 (rather than incorrect 631) - clm5 and clm4_5 paramdata file removed an unused variable - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: DV tests removed or changed - -Code reviewed by: self - -CTSM testing: regular - - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (compare shows changes becausse of paramdata files) - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -An additional fail is ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Clm50Cn.cheyenne_gnu.clm-default, because -of #798. Because it's an issue with cime, I'm not marking it as an expected error. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: previous - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #797 -(https://github.com/ESCOMP/ctsm/pull) - - #797 -- Simple b4b fixes: new params file, remove override_nsrest/anoxia_wtsat, DV deprecated - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev060 -Originator(s): sacks (Bill Sacks) -Date: Thu Aug 29 11:18:20 MDT 2019 -One-line Summary: In SnowWater, truncate small h2osoi residuals - -Purpose of changes ------------------- - -Previously, in the handling of sublimation and evaporation from the snow -pack, if these fluxes led to negative h2osoi_ice or h2osoi_liq, these -negative values would be passed down the snow pack until they found a -layer with a large enough positive state to absorb them. This logic was -going to be a challenge for adding water tracers. - -I have done some tests to verify that these negative values never exceed -roundoff-level in either an absolute or relative sense (with tolerance -of 1.e-13). Specifically, I ran the full aux_clm test suite with the -diffs below and verified that the endrun calls were never triggered. - -So here, I simplify this logic: After truncating any near-zero states to -exactly zero, I check to confirm that the states are never negative. I -then removed the code that passed these negative values down the snow -pack: if they are only roundoff-level negative, then it seems safe to -just throw them away rather than trying to handle them. - -Here were the diffs used to verify that the negative values are never -greater than roundoff-level; these endrun calls were never triggered in -a run of the full aux_clm test suite: - - diff --git a/src/biogeophys/SnowHydrologyMod.F90 b/src/biogeophys/SnowHydrologyMod.F90 - index 3dd555cc..07776123 100644 - --- a/src/biogeophys/SnowHydrologyMod.F90 - +++ b/src/biogeophys/SnowHydrologyMod.F90 - @@ -970,6 +970,8 @@ subroutine SnowWater(bounds, & - real(r8) :: vol_ice(bounds%begc:bounds%endc,-nlevsno+1:0) ! partial volume of ice lens in layer - real(r8) :: eff_porosity(bounds%begc:bounds%endc,-nlevsno+1:0) ! effective porosity = porosity - vol_ice - real(r8) :: mss_liqice(bounds%begc:bounds%endc,-nlevsno+1:0) ! mass of liquid+ice in a layer - + real(r8) :: h2osoi_ice_orig - + real(r8) :: h2osoi_liq_orig - !----------------------------------------------------------------------- - - associate( & - @@ -1017,10 +1019,23 @@ subroutine SnowWater(bounds, & - c = filter_snowc(fc) - l=col%landunit(c) - - + h2osoi_ice_orig = h2osoi_ice(c,snl(c)+1) - + h2osoi_liq_orig = h2osoi_liq(c,snl(c)+1) - + - wgdif = h2osoi_ice(c,snl(c)+1) & - + frac_sno_eff(c) * (qflx_dew_snow(c) - qflx_sub_snow(c)) * dtime - h2osoi_ice(c,snl(c)+1) = wgdif - if (wgdif < 0._r8) then - + if (wgdif < -1.e-13_r8) then - + write(iulog,*) 'WJS: big abs wgdif ice: ', c, wgdif, h2osoi_ice_orig - + call endrun('WJS: big abs wgdif ice') - + end if - + if (h2osoi_ice_orig > 0._r8) then - + if (abs(wgdif / h2osoi_ice_orig) > 1.e-13_r8) then - + write(iulog,*) 'WJS: big rel wgdif ice: ', c, wgdif, h2osoi_ice_orig - + call endrun('WJS: big rel wgdif ice') - + end if - + end if - h2osoi_ice(c,snl(c)+1) = 0._r8 - h2osoi_liq(c,snl(c)+1) = h2osoi_liq(c,snl(c)+1) + wgdif - end if - @@ -1030,6 +1045,16 @@ subroutine SnowWater(bounds, & - - ! if negative, reduce deeper layer's liquid water content sequentially - if(h2osoi_liq(c,snl(c)+1) < 0._r8) then - + if (h2osoi_liq(c,snl(c)+1) < -1.e-13_r8) then - + write(iulog,*) 'WJS: big abs wgdif liq: ', c, h2osoi_liq(c,snl(c)+1), h2osoi_liq_orig - + call endrun('WJS: big abs wgdif liq') - + end if - + if (h2osoi_liq_orig > 0._r8) then - + if (abs(h2osoi_liq(c,snl(c)+1) / h2osoi_liq_orig) > 1.e-13_r8) then - + write(iulog,*) 'WJS: big rel wgdif liq: ', c, h2osoi_liq(c,snl(c)+1), h2osoi_liq_orig - + call endrun('WJS: big rel wgdif liq') - + end if - + end if - do j = snl(c)+1, 1 - wgdif=h2osoi_liq(c,j) - if (wgdif >= 0._r8) exit - -Bugs fixed or introduced ------------------------- - -None - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- It's possible that the extra error checks I have added (to ensure we - don't have greater-than-roundoff-level negative residuals) will be - triggered in rare circumstances in a production run, even though they - were never triggered in the test suite. - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none -Although there was a very small increase in total lnd run time, the -timing of hydro_without_drainage actually decreased slightly in the PFS -test relative to the last tag. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- It's possible that the extra error checks I have added (to ensure we - don't have greater-than-roundoff-level negative residuals) will be - triggered in rare circumstances in a production run, even though they - were never triggered in the test suite. - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests passed, some answer changes as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: potentially all, though only show up in - a few tests - - what platforms/compilers: potentially all, though only show up in - a few tests - - nature of change (roundoff; larger than roundoff/same climate; new climate): roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - First, I did some preliminary analyses as documented above, to - ensure that any negative residuals were no greater than roundoff. - - Second, note that the use of truncate_small_values can only - introduce roundoff-level changes (by truncating values that are - roundoff-level different from zero to exactly zero). - - Third, only a few tests showed answer changes, and these were only - in limited fields, and were fairly small RMS differences: - - ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput - ERS_Ly3.f10_f10_musgs.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic - ERS_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput - ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput - - I actually expected more tests to show differences, but most tests - were bit-for-bit. I'm guessing this is because the code added a - roundoff-level term to a larger term, and this ended up not - changing the larger term. - - Finally, as an extra precaution, I ran the test suite twice, on - two different implementations of the truncation: the final one - (which uses truncate_small_values), and one in which I did the - truncation using custom, inline code (commit 0d21ccb5). These two - were bit-for-bit with each other, giving me more confidence that I - didn't make a mistake with either implementation. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev059 -Originator(s): sacks (Bill Sacks) -Date: Sat Aug 24 15:14:06 MDT 2019 -One-line Summary: Continue adding water tracers to LakeHydrology - -Purpose of changes ------------------- - -Finish implementing water tracers for initial snow-related code in -LakeHydrology. This involved refactoring code in order to reuse existing -code in SnowHydrology rather than having near-duplicates of that code in -LakeHydrology. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#775 (Implement water tracers for initial - snow-related code in LakeHydrology) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none -Many tests took longer, including the PFS test. However, by looking at -more detailed timing numbers in the PFS test, the main increases in time -were in initialization and atm run: lnd run only showed a very small -increase. This suggests that glade slowness was probably primarily -responsible for the increased time. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: Increased allowed wallclock time for a few tests -These tests took longer, likely due to machine variability. Increasing -their wallclock time to prevent them from timing out. - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - hobart ------ pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev058 -Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) -Date: Thu Aug 22 10:02:49 MDT 2019 -One-line Summary: Soil texture interpolation bug-fix - -Purpose of changes ------------------- - - When assigning soil texture values from dataset soil levels to model - soil levels, we should be comparing zsoi (NOT zisoi) in the model with - zisoi on the file, i.e. we should be asking whether the node - center (NOT interface) of a given model level falls between two - interface depths on the file. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #772 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - Unexpected failure of test - SMS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.hobart_nag.clm-tracer_consistency - Bill Sacks did some follow-up testing and concluded that this may be a - compiler-specific issue, so he changed the test from "nag" to "intel" - and generated the new test's corresponding baseline - -Code reviewed by: @billsacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - tools-tests (test/tools): - - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (clm5) small - - Summarize any changes to answers, i.e., - - what code configurations: not clm45 (clm5_0 and ctsm5_0-nwp) - - what platforms/compilers: all - - nature of change: larger than roundoff/same climate - based on the assumption that shifting soil texture assignments by - one level in model soil levels below the top-most level should not - generate climate-changing differences. - -Detailed list of changes ------------------------- - 1. Changed zisoi to zsoi as described in the Purpose section above. - This caused the larger than roundoff changes. Before the fix some - model soil levels were getting assigned soil textures from a deeper - soil level in the dataset than they should. - 2. In the same section of code I completed the if-block to address all - zsoi vs. zisoifl comparisons. This ensures explicit assignment of - soil textures for all model soil levels and avoids leaving some - model soil levels with the texture assignment of the previous model - soil level. - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull/788) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev057 -Originator(s): sacks (Bill Sacks) -Date: Tue Aug 20 13:17:39 MDT 2019 -One-line Summary: Fix frac_sno bugs - -Purpose of changes ------------------- - -Two bug fixes related to frac_sno, and a third change involving -replacing a frac_sno calculation with a simpler equation that is -algebraically equivalent: - -(1) Fix lake frac_sno always being 0 - (https://github.com/ESCOMP/ctsm/issues/783). This fixes the albedo - calculation (and possibly others) over snow-covered lake surfaces. - -(2) Fix threshold for explicit snow pack initiation to use frac_sno_eff, - not frac_sno (https://github.com/ESCOMP/ctsm/issues/785). For - standard runs (which have use_subgrid_fluxes = .true.), this just - changes answers for urban columns. This also changes answers more - widely for runs with use_subgrid_fluxes = .false. - -(3) Rewrite Swenson & Lawrence 2012 frac_sno equation to be more - straightforward and less sensitive to roundoff errors - (https://github.com/ESCOMP/ctsm/issues/784) - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#783 (frac_sno is always 0 for lake points) -- Resolves ESCOMP/ctsm#785 (Threshold for explicit snow pack initiation - should use frac_sno_eff, not frac_sno) -- Resolves ESCOMP/ctsm#784 (Suggested algebraic rework of frac_sno - calculation) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] ctsm5_0-nwp - -[X] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, answers change as expected - - Ran most testing on 95dad328 (before 8f1263a7, which removes a - temporary endrun error check). Just reran - SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.hobart_nag.clm-decStart - on the final version. - - There was a memleak for this test: - - FAIL SMS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.hobart_nag.clm-tracer_consistency MEMLEAK memleak detected, memory went from 1250.830000 to 1518.500000 in 8 days - - I have had memleak issues for this test before - (https://github.com/ESCOMP/ctsm/issues/763), which I have chalked up - to a compiler-specific issue. I have simply increased the tolerance - for memleaks for this test moving forward. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff; expected to be same climate in general, - because the only impacts are on urban and lake points, which - represent a small fraction of most grid cells. However, this needs - further investigation. - - See above (under "Purpose of changes") for a description of the - different answer changes in this tag. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - I verified that change (3) is no greater than roundoff by - temporarily putting in an endrun if the new frac_sno differs from - the old by more than 1e-13; this was not triggered for any test in - the aux_clm test suite. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev056 -Originator(s): sacks (Bill Sacks) -Date: Fri Aug 16 11:44:43 MDT 2019 -One-line Summary: Start adding water tracers to LakeHydrology, and related refactoring - -Purpose of changes ------------------- - -Start adding water tracers to LakeHydrology, beginning with some initial -things done for snow. - -This also includes some significant refactoring to allow LakeHydrology -to reuse some of the same snow code used for non-lake columns. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Partially addresses ESCOMP/ctsm#775 (Implement water tracers for - initial snow-related code in LakeHydrology) - -Known bugs found since the previous tag (include github issue ID): -The following will be fixed in an upcoming tag: -- ESCOMP/ctsm#783 (frac_sno is always 0 for lake points) -- ESCOMP/ctsm#784 (Suggested algebraic rework of frac_sno calculation) -- ESCOMP/ctsm#785 (Threshold for explicit snow pack initiation should - use frac_sno_eff, not frac_sno) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, answers change as expected - - Note: Did most testing on 054dc95b (before the small change in - 7e4e52a9); just ran - LWISO_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_gnu.clm-coldStart - on the final commit - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): roundoff - - There are two answer-changes here: - - (1) Roundoff-level changes due to changing some order of operations - for the updating of snow_depth and dz for lakes: The previous - code effectively used (qflx_snow_grnd(c)/bifall(c))*dtime, - whereas the new code uses (qflx_snow_grnd(c)*dtime)/bifall(c); - similarly, the dz update differs. - - (2) A change in FSNO_EFF for lakes: previously, this was set to 0 - when there was no snow. Now this is set consistently with other - landunits, for which it is 1 even if there is no snow. Note that - this only affects the FSNO_EFF diagnostic field, and nothing - else. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - I confirmed that the order-of-operations change is the only - answer-changing part of this tag by comparing against a one-off - from master with the following diffs; this comparison was - bit-for-bit except for changes in the FSNO_EFF diagnostic field: - - diff --git a/src/biogeophys/LakeHydrologyMod.F90 b/src/biogeophys/LakeHydrologyMod.F90 - index 91ddfc79..9711dad7 100644 - --- a/src/biogeophys/LakeHydrologyMod.F90 - +++ b/src/biogeophys/LakeHydrologyMod.F90 - @@ -126,6 +126,8 @@ subroutine LakeHydrology(bounds, & - real(r8) :: heatsum(bounds%begc:bounds%endc) ! used in case above [J/m^2] - real(r8) :: snowmass ! liquid+ice snow mass in a layer [kg/m2] - real(r8) :: snowcap_scl_fct ! temporary factor used to correct for snow capping - + real(r8) :: temp_snow_depth - + real(r8) :: newsnow - real(r8), parameter :: snow_bd = 250._r8 ! assumed snow bulk density (for lakes w/out resolved snow layers) [kg/m^3] - ! Should only be used for frost below. - !----------------------------------------------------------------------- - @@ -246,8 +248,10 @@ subroutine LakeHydrology(bounds, & - ! U.S.Department of Agriculture Forest Service, Project F, - ! Progress Rep. 1, Alta Avalanche Study Center:Snow Layer Densification. - - - dz_snowf = qflx_snow_grnd(c)/bifall(c) - - snow_depth(c) = snow_depth(c) + dz_snowf*dtime - + temp_snow_depth = snow_depth(c) - + newsnow = qflx_snow_grnd(c)*dtime - + snow_depth(c) = snow_depth(c) + newsnow/bifall(c) - + dz_snowf = (snow_depth(c) - temp_snow_depth)/dtime - if (snl(c) == 0) then - h2osno_no_layers(c) = h2osno_no_layers(c) + qflx_snow_grnd(c)*dtime ! snow water equivalent (mm) - else - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev055 -Originator(s): sacks (Bill Sacks) -Date: Tue Aug 6 14:06:50 MDT 2019 -One-line Summary: Modularize snow cover fraction method - -Purpose of changes ------------------- - -This tag moves the calculation of frac_sno - and the related updates of -snow_depth - into a new set of classes, with one class for each -parameterization (Niu & Yang 2007 and Swenson & Lawrence 2012). - -Previously, the code always calculated frac_sno the new way, but then -possibly overwrote it if using the older Niu & Yang method. The new code -cleans this up, only doing the calculations that are needed for each -method. - -In addition, other code that is specific to one of the two methods is -now moved to a home that makes this dependence on method explicit. This -includes the addition of newsnow to int_snow: previously, int_snow was -always updated using an equation specific to the newer CLM5 -parameterization of frac_sno, which was not appropriate if using the Niu -& Yang parameterization; this doesn't make a difference currently, since -int_snow is only referenced if using the Swenson & Lawrence -parameterization, but this clears up some confusion. Also, time-constant -parameters read from namelist or the netCDF parameter file now reside in -the appropriate class rather than being more global. - -This tag also renames two namelist options to increase clarity: -- subgridflag is renamed to use_subgrid_fluxes, and is now a logical -- oldfflag is renamed to snow_cover_fraction_method, and is now a string - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#502 (oldfflag can NOT be used with - subgridflag==1, and rename subgridflag) -- Resolves ESCOMP/ctsm#503 (Clean up CanopyHydrology) - - This tag does the last piece of cleanup called for in that issue -- Resolves ESCOMP/ctsm#571 (Add a system test: turning on water isotopes - shouldn't change answers) - - This is unrelated to the other changes in this tag - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -This tag renames two namelist options to increase clarity: -- subgridflag is renamed to use_subgrid_fluxes, and is now a logical -- oldfflag is renamed to snow_cover_fraction_method, and is now a string - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Added a LWISO test, which confirms that turning on water isotopes - doesn't change answers for bulk -- Added a test with the newer snow cover fraction method but - use_subgrid_fluxes false (testmod no_subgrid_fluxes) - -Code reviewed by: Sean Swenson, Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - ok - - Tests pass; baseline comparisons not done (baseline comparisons - expected to differ) - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - hobart ------ pass - - Additional tests: Compared both of these against ctsm1.0.dev052 (which - should be bit-for-bit with ctsm1.0.dev054): Both were bit-for-bit: - - ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm45BgcCrop.cheyenne_gnu.clm-no_subgrid_fluxes - This is a new test, so did not have baselines; I created baselines - from ctsm1.0.dev052 and compared against those - SMS_Ly3.f10_f10_musgs.I2000Clm45BgcCrop.cheyenne_intel.clm-oldhyd_monthly - This was a temporary test for the sake of running a longer test with - the oldhyd testmod. This testmod was created as a one-off by - changing the current oldhyd testmod to inherit from monthly rather - than default. I ran baselines like this from ctsm1.0.dev052 then ran - this test from this branch and compared against those baselines. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/769 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev054 -Originator(s): sacks (Bill Sacks) -Date: Fri Aug 2 07:57:51 MDT 2019 -One-line Summary: Fix interpolation of surfdat soil layers so we can use interpolation for 10SL case - -Purpose of changes ------------------- - -Previously, on master, there was special-purpose code for the 10SL case -that avoided doing interpolation from the surface dataset to the soil -variables in the model. It would be cleaner - especially now that we -allow user-defined soil layer structures - if we could use the general -interpolation code always, rather than sometimes having special-purpose -code that avoids doing the interpolation. - -This tag accomplishes that generality. In order to preserve answers for -clm45 cases, I needed to make three changes: - -1. The constant 0.025 needed an _r8 appended to it; otherwise, zisoifl - could differ by roundoff from zisoi. - -2. I changed which level is used when zisoi(lev) is exactly equal to - zisoifl(j) for some j: I changed the conditional in the following: - - if (zisoi(lev) >= zisoifl(j) .AND. zisoi(lev) < zisoifl(j+1)) then - clay = clay3d(g,j+1) - sand = sand3d(g,j+1) - om_frac = organic3d(g,j+1)/organic_max - endif - - to: - - if (zisoi(lev) > zisoifl(j) .AND. zisoi(lev) <= zisoifl(j+1)) then - - Previously, when the zisoi values in the model exactly lined up with - the zisoi values in the file, we would set clay in model level j - equal to the value from level j+1 from the surface dataset (and - similarly for sand and om_frac); in the new code, we use level j from - the surface dataset for model level j in this case. - -3. I changed the way zisoifl is calculated for the lowest layer, so that - it matches zisoi(nlevsoi) when running with 10SL_3.5m. Previously, we - had: - - zisoi(10) = 0.38018819123227207690E+01 - zisoifl(10) = 0.34330930154359391437E+01 - - This tag changes zisoifl(10) to match zisoi(10). - -Bugs fixed or introduced ------------------------- - -Known bugs found since the previous tag (include github issue ID): -- #772: Interpolation of clay, sand and om_frac can use the wrong layer - (points out more fundamental issues with this interpolation of layers - from the surface dataset) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sam Levis - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- pass - hobart ------ pass - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO (but see note below) - - In principle, the changes in this tag could change answers for some - soil layer structures, but there were no answer changes for any of - the cases covered by the test suite. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/771 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev053 -Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) -Date: Thu Aug 1 16:56:09 MDT 2019 -One-line Summary: Soil layer definition clean-up and user-defined option - -Purpose of changes ------------------- - - Code clean-up clarifes that there are two types of soil layer - definition: the node-based and the thickness-based. - - User-defined option allows user to specify a soil layer profile in the - form of a dzsoi vector (values in meters) in the thickness-based - approach. - - Default nlevsoi for NWP configurations had to change from 5 to 4 for - consistency with the new error check described in known bugs below. - - Other code clean-up removes a couple of sections of repeating code. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #279 #728 - -Known bugs found since the previous tag (include github issue ID): - #759 (this PR) bug causes model to abort when nlevsoi = nlevgrnd; - bug has been corrected with an error check - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[X] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - if neither soil_layerstruct_predefined nor soil_layerstruct_userdefined - get specified in the namelist, then the model sets - soil_layerstruct_predefined to the old default setting for - soil_layerstruct (clm5: 20SL_8.5m, clm4.5: 10SL_3.5m) - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - renamed soil_layerstruct to soil_layerstruct_predefined and added - soil_layerstruct_userdefined - -Changes made to namelist defaults (e.g., changed parameter values): - Default nlevsoi for NWP configurations had to change from 5 to 4 for - consistency with the new error check described in known bugs below - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers --------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - 1) New test... - ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Ctsm50NwpBgcCropGswpGs.cheyenne_intel.clm-default - replaces existing test - ERS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-rm_indiv_lunits_and_collapse_to_dom - to check the correction described in known bugs above; the new test - together with existing unit tests cover what the old test was testing - - 2) New test and new test type... - SOILSTRUCTUD_Ld5.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-default - ensures that soil_layerstruct_userdefined gives bfb same answers as - soil_layerstruct_predefined = '4SL_2m' when set with the same dzsoi - values. The new test type was put together by: - - listing the test in (1) testlist_clm.xml (as all tests) and (2) config_tests.xml - - creating the file .../cime_config/SystemTests/soilstructud.py named after the test in lower case - -Code reviewed by: @billsacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - tools-tests (test/tools): - - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (just for NWP configurations) - - Summarize any changes to answers, i.e., - - what code configurations: nwp - - what platforms/compilers: all - - nature of change: larger than roundoff/same climate - This is due to the change of nlevsoi from 5 to 4 (more info above). - I confirmed that nwp does return bfb same answers when I revert this - change. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): - https://github.com/ESCOMP/ctsm/pull/759 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev052 -Originator(s): sacks (Bill Sacks) -Date: Mon Jul 22 14:02:43 MDT 2019 -One-line Summary: Fix rare soil color bug in mksurfdata_map - -Purpose of changes ------------------- - -Under rare conditions, mksurfdata_map could put the default soil color -in an output cell where there is actually more information. This tag -fixes that issue. None of the out-of-the-box surface datasets are -impacted by this bug, so I have not recreated any surface datasets. (I -checked all out-of-the-box surface datasets except for -surfdata_0.125x0.125_mp24_simyr2000_c150114.nc, because it doesn't get -remade cleanly out of the box.) - -Also: - -- Add some unit tests for the creation of soil color in mksurfdata_map - -- Point to correct (existing) surface dataset for year-1850 at f05 - resolution - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#4 (Minor bug in creation of soil color in - mksurfdata_map: points can be given the default soil color, when they - should have a real color) -- Resolves ESCOMP/ctsm#765 (Year-1850 f05 surface dataset missing from - inputdata repository) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -- Year-1850 f05 surface dataset now points to a file that actually exists - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - ok - - Most tests pass, including baseline comparisons. The following tests fail, but also failed for me on master: - - 019 smiS4 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................\c - rc=6 FAIL - 020 bliS4 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................\c - rc=4 FAIL - 027 smf84 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools ....................\c - rc=6 FAIL - 028 blf84 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools ....................\c - rc=4 FAIL - 029 smfc4 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools ..............\c - rc=6 FAIL - 030 blfc4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools ..............\c - rc=4 FAIL - 031 smfg4 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Global_clm4_5^buildtools .............\c - rc=6 FAIL - 032 blfg4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Global_clm4_5^buildtools .............\c - rc=4 FAIL - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- not run - hobart ------ not run - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev051 -Originator(s): sacks (Bill Sacks) -Date: Fri Jul 19 13:26:25 MDT 2019 -One-line Summary: Update water tracers for remainder of first stage of hydrology - -Purpose of changes ------------------- - -Main change is to do tracer updates for final pieces of first stage of -hydrology: HandleNewSnow and UpdateFracH2oSfc. Along with this, I have -introduced greater modularity into these routines (breaking the -operations down into more granular steps). - -Other changes included here (somewhat related to the main changes) are: - -- Added a routine that resets checked tracers to bulk*ratio to allow - running the tracer consistency check for more than one time step; we - now run it for 10 days - -- Change logic for rain-snow conversion terms: Use rain diff in rain to - snow, snow diff in snow to rain. This is less sensitive to roundoff - errors, and was needed in order to get the 10-day tracer consistency - test to pass. - -- Setting of qflx_snow_h2osfc moved to CanopyInterceptionAndThroughfall - -- Add col%lun_itype. col%lun_itype(ci) is the same as - lun%itype(col%landunit(ci)), but is often a more convenient way to - access this type. I got tired of having to get the landunit index just - for the sake of getting the landunit's type of a given column. I have - NOT gone through the code and replaced lun%itype(l) with - col%lun_itype(c) where applicable, but this will be useful for the - future. - -- Removed unnecessary code for backwards compatibility of FH2OSFC from - restart files - -- Point to slightly modified initial conditions files for two CLm45 - initial conditions files. These two had FH2OSFC > 0 for some glc_mec - points. I'm not sure how that came to be, but Sean Swenson and I think - that shouldn't be the case. This caused soil balance errors in these - tests: - - ERS_Ly5_P72x1.f10_f10_musgs.IHistClm45BgcCrop.cheyenne_intel.clm-cropMonthOutput - SMS_D_Ld1.f09_g17.I1850Clm45BgcCruGs.cheyenne_intel.clm-default - - I'm fixing the problem by pointing to updated files with FH2OSFC set - to 0 for special landunits, using the following python: - - ctypel = dat.variables['cols1d_ityplun'][:] - dat.variables['FH2OSFC'][ctypel > 2] = 0 - -- Small cime update to fix the SHAREDLIBBUILD phase of - ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#718 (Implement water tracers for HandleNewSnow - and FracH2oSfc) -- Resolves ESCOMP/ctsm#498 (Do tracer consistency checks every time - step, not just first) - -CIME Issues fixed (include issue #): -- ESCMI/cime#3717 (Cheyenne ESMF missing for WACCM X) - -Known bugs introduced in this tag (include github issue ID): -- ESCOMP/ctsm#762 (Water tracers: Make sure calls to ResetCheckedTracers - are removed) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- If you have an initial conditions file with non-zero FH2OSFC for - glacier (this was the case for some out-of-the-box clm45 files, which - are now fixed), may run into soil balance errors. To fix this, set - FH2OSFC to 0 in your restart file for all special landunits. - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -- Point to slightly modified initial conditions files for two CLm45 - initial conditions files: see above for details. - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Changed tracer consistency test to 10 days rather than a single time step - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, some roundoff-level diffs in baseline - comparisons, as noted below - - Also, in order to have a more powerful test of the changes in - SurfaceWaterMod (since the relevant code isn't triggered very often), - I introduced the following diffs: - - diff --git a/src/biogeophys/SurfaceWaterMod.F90 b/src/biogeophys/SurfaceWaterMod.F90 - index 1bc03cae..be656a15 100644 - --- a/src/biogeophys/SurfaceWaterMod.F90 - +++ b/src/biogeophys/SurfaceWaterMod.F90 - @@ -12,6 +12,7 @@ module SurfaceWaterMod - use shr_spfn_mod , only : erf => shr_spfn_erf - use clm_varcon , only : denh2o, denice, roverg, wimp, tfrz, pc, mu, rpi - use clm_varpar , only : nlevsno, nlevgrnd - + use clm_varctl , only : iulog - use clm_time_manager , only : get_step_size - use column_varcon , only : icol_roof, icol_road_imperv, icol_sunwall, icol_shadewall, icol_road_perv - use decompMod , only : bounds_type - @@ -201,7 +202,7 @@ subroutine BulkDiag_FracH2oSfc(bounds, num_soilc, filter_soilc, & - SHR_ASSERT_FL((ubound(qflx_too_small_h2osfc_to_soil, 1) == bounds%endc), sourcefile, __LINE__) - - ! arbitrary lower limit on h2osfc for safer numerics... - - min_h2osfc=1.e-8_r8 - + min_h2osfc=1.e0_r8 - - do f = 1, num_soilc - c = filter_soilc(f) - @@ -230,6 +231,9 @@ subroutine BulkDiag_FracH2oSfc(bounds, num_soilc, filter_soilc, & - - else - frac_h2osfc(c) = 0._r8 - + if (h2osfc(c) > 0._r8) then - + write(iulog,*) 'WJS: in else' - + end if - qflx_too_small_h2osfc_to_soil(c) = h2osfc(c) / dtime - ! The update of h2osfc is deferred to later, keeping with our standard - ! separation of flux calculations from state updates, and because the state - - With those diffs, I ran the tracer consistency test; it passed. In - addition, I ran - SMS_D_Ld1_P4x1.f10_f10_musgs.I2000Clm50BgcCropQianRsGs.bishorn_gnu.clm-default - with comparison against master, with the following diffs on master - (the first change changes behavior to force the relevant code to be - triggered, and is the same on master and on the branch; the second - change on master divides then multiplies by dtime to avoid - roundoff-level diffs): - - diff --git a/src/biogeophys/SurfaceWaterMod.F90 b/src/biogeophys/SurfaceWaterMod.F90 - index 959d539b..4a4a4824 100644 - --- a/src/biogeophys/SurfaceWaterMod.F90 - +++ b/src/biogeophys/SurfaceWaterMod.F90 - @@ -77,7 +77,7 @@ subroutine FracH2oSfc(bounds, num_nolakec, filter_nolakec, & - ) - - ! arbitrary lower limit on h2osfc for safer numerics... - - min_h2osfc=1.e-8_r8 - + min_h2osfc=1.e0_r8 - - call waterstatebulk_inst%CalculateTotalH2osno(bounds, num_nolakec, filter_nolakec, & - caller = 'FracH2oSfc', & - @@ -112,7 +112,7 @@ subroutine FracH2oSfc(bounds, num_nolakec, filter_nolakec, & - - else - frac_h2osfc(c) = 0._r8 - - h2osoi_liq(c,1) = h2osoi_liq(c,1) + h2osfc(c) - + h2osoi_liq(c,1) = h2osoi_liq(c,1) + (h2osfc(c) / get_step_size()) * get_step_size() - h2osfc(c)=0._r8 - endif - - This test passed and was bit-for-bit with master with the above changes. - - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (roundoff level) - - Summarize any changes to answers, i.e., - - what code configurations: Many/all - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Roundoff: just roundoff-level changes in FSH_PRECIP_CONVERSION, - FSH_TO_COUPLER, l2x_Fall_sen due to refactored calculation of - FSH_PRECIP_CONVERSION - - If bitwise differences were observed, how did you show they were no worse - than roundoff? via summarize_cprnc_diffs - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: branch_tags/cime5.8.3_chint17-03 -> branch_tags/cime5.8.3_chint17-04 - Fixes ESMCI/cime#3171 - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev050 -Originator(s): slevis (Samuel Levis,SLevisConsulting LLC,303-665-1310) -Date: Mon Jul 15 11:40:09 MDT 2019 -One-line Summary: dz --> dz_lake bug-fix in LakeTemperatureMod.F90 line 960 - -Purpose of changes ------------------- - - Bug-fix to prevent the model from aborting when running with fewer soil - layers than lake layers; not to imply that this was not a bug when the - model wasn't aborting. It was. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #760 - -Known bugs found since the previous tag (include github issue ID): #759 bug causing model to abort when nlevsoi = nlevgrnd - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers --------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: @dlawrenncar @billsacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - tools-tests (test/tools): - - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (when methane on) (diagnostic only) - - Summarize any changes to answers, i.e., - - what code configurations: use_lch4 = .true. - - what platforms/compilers: all - - nature of change: diagnostic variable WTGQ only - Confirmed this on cheynne and hobart by running - ./summarize_cprnc_diffs -baseline .../tests_0712... -testid '*' - and inspecting the file cprnc.summary.*.by_varname - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): - https://github.com/ESCOMP/ctsm/pull/761 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev049 -Originator(s): erik (Erik Kluzek) -Date: Sun Jun 23 20:56:55 MDT 2019 -One-line Summary: Update mosart and intel to intel-19 on cheyenne - -Purpose of changes ------------------- - -Update mosart to trunk tag (that has a roundoff change to history file -output). And update intel compiler on cheyenne to intel-19. - -Bugs fixed or introduced None ------------------------- - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (roundoff level change when MOSART on) - - Summarize any changes to answers, i.e., - - what code configurations: some compsets with mosart - - what platforms/compilers: cheyenne/intel - - nature of change: roundoff - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, and mosart - mosart to mosart1_0_33 - cime to branch_tags/cime5.8.3_chint17-03 - -Pull Requests that document the changes (include PR ids): #753 -(https://github.com/ESCOMP/ctsm/pull) - #753 -- Update cheyenne to intel/19 and update mosart - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev048 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Sun Jun 23 15:16:01 MDT 2019 -One-line Summary: Updates for buildlib changes and cime and externals updates - -Purpose of changes ------------------- - -Update of most externals: cime, mosart, rtm, cism. The cime update also includes a required CESM-wide -change in buildlib. Uses a function to get the Macros filename "get_standard_makefile_args". -The cime update brought in some answer chagnes, with an update of the intel compiler (but we backed those -out by using a cime branch). There is also a roundoff change by going to the trunk version of RTM. - -Bugs fixed or introduced None ------------------------- - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: @jedwards, self - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - tools-tests (test/tools): - - cheyenne - PASS - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - PASS - - python testing (see instructions in python/README.md; document testing done): - - cheyenne - PASS (for python3) - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes, but only for a few cases (compsets with RTM) - - Summarize any changes to answers, i.e., - - what code configurations: With RTM - - what platforms/compilers: All - - nature of change: roundoff - fieldlist is different for CISM in some cases - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, mosart, rtm, cism - cime to branch_tags/cime5.8.3_chint17-02 - cism to cism2_0_68 - rtm to rtm1_0_68 - mosart to nldas-grid.n02_mosart1_0_31 - -Pull Requests that document the changes (include PR ids): #752 -(https://github.com/ESCOMP/ctsm/pull) - - #752 -- buildlib, cime and externals update - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev047 -Originator(s): sacks (Bill Sacks) -Date: Sun Jun 16 13:04:38 MDT 2019 -One-line Summary: Fix negative snow compaction during snow melt - -Purpose of changes ------------------- - -Fix an issue reported by @kjetilaas: In the presence of surface water, -the old and new snow cover fractions are inconsistently calculated in -subroutine "SnowCompaction". This can result in significant negative -compaction (snow depth increase) during snow melt. - -More details from @kjetilaas (copied from -https://github.com/escomp/ctsm/issues/573): - -There is an inconsistency in the calculation of snow cover fraction -(FSNO) in the SnowCompaction subroutine when there is surface water -present. The actual snow cover is limited to 0.99 when surface water is -present (and the surface water fraction is set to 0.01). However, -SnowCompaction recalculates the old FSNO without accounting for this -limitation. This results in an apparent decrease in FSNO, and -corresponding negative snow compaction from snow melt (ddz3). - -This can result in substantial, artificial increase in snow depth during -summer (can be more than 0.5 m during a single season). - -The problem might be masked in monthly output, but could be significant -whenever snow cover is close to 1 and surface water present. Snow mass -is indirectly affected by this as radiation and temperature fluxes in -the snow pack will be affected by artificially thick snow layers. - -This tag fixes this issue. The fix was implemented and tested by -@swensosc (Sean Swenson). - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#573 (Snow depth increase due to inconsistent snow - cover fraction calculation) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] ctsm5_0-nwp - -[X] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sean Swenson, @kjetilaas, Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, answers change as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (similar climate) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff/same climate - - Sean Swenson ran the LMWG diagnostics package and looked at the - results with Keith Oleson. Their main findings were: - - - Snow depth is a bit smaller over Greenland and polar regions on - average, as expected (up to 5-10% decrease in average snow depth - averaged over the Canadian Arctic) - - - There is a small increase in h2osno over Greenland: about 30 mm - averaged over Greenland; it looks like the main changes are - around the coasts (which makes sense given that this bug only - affects vegetated landunits) - - - There are small changes in runoff over Greenland - - - Changes in snow cover fraction are tiny - - - Overall, this doesn't look climate changing, but could - potentially have a significant impact on select grid cells, and - on some variables in polar regions - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev046 -Originator(s): sacks (Bill Sacks) -Date: Sat Jun 15 15:54:44 MDT 2019 -One-line Summary: Separate the two uses of h2osno - -Purpose of changes ------------------- - -Until now, h2osno has been used in two ways: - -1. When there are explicit snow layers, h2osno is the sum of snow - (liquid + ice) in all layers - -2. When there is a little bit of snow, but not enough to create a snow - layer, h2osno gives the amount of this very thin snow pack (assumed - to be all ice) - -This is confusing and complicates the addition of water tracers to the -code. This tag separates h2osno into two different variables: - -1. h2osno_no_layers is a fundamental state variable that gives the - amount of snow in the case where we don't have explicit snow layers - -2. h2osno_total is purely a diagnostic variable that is the sum of snow - in all explicit layers, plus h2osno_unresolved. This exists in - waterdiagnosticbulk_type, but the version there is just set once at - the end of the time step, so that version is only meant for - diagnostic (history) output. Code that needs the current sum of - h2osno at a given point now computes it locally, via a new method on - waterstate_type: CalculateTotalH2osno. If running in debug mode, that - routine also performs some consistency checks. - -Also, an unrelated change to prevent user from trying to interpolate a -file onto itself. - -Also, add a compset for testing, which is good for use on my mac. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#733 (Make h2osno purely a diagnostic variable) -- Resolves ESCOMP/ctsm#749 (h2osno inconsistent when interpolating from - initial conditions with different snow layers) -- Resolves ESCOMP/ctsm#750 (Prevent user from trying to use the same - filename for init_interp source and destination files) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none (possibly a small improvement -in timing based on PFS run time) - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass; baseline comparisons fail as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (mostly roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Mostly roundoff; greater than roundoff/same climate for cases for - which number of snow layers is less in the case than in its - initial conditions file, due to fixing #749 - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - There was one point where h2osno_total differed from the old h2osno - by roundoff, as verified by a run of the test suite (where I verified - that (a) it only differed by 1e-11 or less, and (b) if I reset it, - there were just roundoff-level changes in a few diagnostic - fields). That one place with roundoff-level diffs can lead to - propagation of diffs, causing differences in many fields in the final - run of the test suite. In particular: I ran the test suite on - 69823de4 (which had this temporary check and reset of h2osno_total - vs. old h2osno). For nearly all tests, there were only roundoff-level - changes in a few diagnostic fields. I then removed the temporary - check and reset and ran the test suite on the result - (4353cc90). Finally, I ran the test suite on the final, cleaned-up - code, with comparison against 4353cc90 and verified bfb. - - In my testing on 69823de4: There were a few tests with greater than - roundoff-level changes due just to differences in the initial value - of h2osno_total (which was incorrect in the old due to #749). I - verified that these only had roundoff-level changes in a few - diagnostic fields if I used the following diffs in both the baseline - and my branch, indicating that the diffs just arose due to the fix of - #749: - - diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 - index 793b36ac..f10ee5e1 100644 - --- a/src/main/clm_initializeMod.F90 - +++ b/src/main/clm_initializeMod.F90 - @@ -762,6 +762,18 @@ subroutine initialize2( ) - !$OMP END PARALLEL DO - end if - + do c = bounds_proc%begc, bounds_proc%endc - + if (col%snl(c) < 0) then - + water_inst%waterstatebulk_inst%h2osno_col(c) = 0._r8 - + do j = col%snl(c)+1, 0 - + water_inst%waterstatebulk_inst%h2osno_col(c) = & - + water_inst%waterstatebulk_inst%h2osno_col(c) + & - + water_inst%waterstatebulk_inst%h2osoi_ice_col(c,j) + & - + water_inst%waterstatebulk_inst%h2osoi_liq_col(c,j) - + end do - + end if - + end do - + - end subroutine initialize2 - end module clm_initializeMod - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev045 -Originator(s): sacks (Bill Sacks) -Date: Thu Jun 6 12:26:57 MDT 2019 -One-line Summary: Recalculate h2osno for the sake of SnowCapping - -Purpose of changes ------------------- - -SnowCapping decides whether to remove excess snow based on -h2osno. However, at the point where this is called,h2osno is out of sync -with (h2osoi_liq + h2osoi_ice): Those variables can be changed slightly -in SnowWater (which is called before SnowCapping), yet h2osno isn't -recalculated based on those changes. - -I don't think this causes a big problem in practice, but it seems like -it would improve code understandability if we had the general rule that -any code that references h2osno is using a version of h2osno that is in -sync with (h2osoi_liq + h2osoi_ice). This is also needed to prevent -answer changes in an upcoming major refactor. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#736 - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sean Swenson signed off on the change, but didn't -review the final code - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, answers change as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (should be small) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff/same climate - - Answer changes are expected to be small, since this should just - change the timing of snow capping a bit, but I haven't looked - closely at the magnitude of the answer changes. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev044 -Originator(s): sacks (Bill Sacks) -Date: Thu Jun 6 12:14:39 MDT 2019 -One-line Summary: Make wetland snow resetting behavior more explicit - -Purpose of changes ------------------- - -There is some code that zeroes out h2osno over thawed wetlands. It seems -like the intended behavior here is to zero out the entire snow -pack. Currently, however, this only zeros out a very thin (zero-layer) -snow pack. For now, I'm adding an snl==0 conditional to make this -behavior explicit; long-term, we'd like to change this to actually zero -out the whole snow pack. (At that time, this code block should probably -be moved to a more appropriate home, as noted in comments in issue -ESCOMP/ctsm#735.) - -Also, unrelated change in run_sys_tests: support machine-specific -baseline directory, in order to support new default location for CTSM -baselines on cheyenne. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Partially addresses, but does NOT fix, ESCOMP/ctsm#735 - -Known bugs introduced in this tag (include github issue ID): -- Partially addresses, but does NOT fix, ESCOMP/ctsm#735 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sean Swenson and Keith Oleson approved this change, -though didn't actually review the final code. - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - python testing (see instructions in python/README.md; document testing done): - - (any machine) - pass on cgdm-bishorn - make python=python2 test - make pyhton=python3 test - make lint - - regular tests (aux_clm): - - cheyenne ---- pass - hobart ------ pass - - Also ran SMS_Ly1.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-monthly - with comparison against baselines: passed and bit-for-bit. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: NO (but see notes below) - - It seems theoretically possible for this to change answers, but no - answer changes were observed in the aux_clm test suite or - SMS_Ly1.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-monthly. - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev043 -Originator(s): erik (Erik Kluzek) -Date: Wed Jun 5 10:17:06 MDT 2019 -One-line Summary: Fix FUN bug (frac_ideal_C_use was backwards in regard to delta_CN), and replace Ball-Berry mbbopt with the CLM4.5 version - -Purpose of changes ------------------- - -Carbon allocation to uptake responds to CN(uptake-cost) and CN(actual). The intended implementation is: For C:N -less than the target C:N, C allocation is reduced with cost. For C:N greater than the target C:N, C allocation -is increased with high C:N. However, the actual implementation is reversed. This change fixes that problem. - -Also the Ball-Berry mbbopt values had been changed in the creation of CLM5.0, as part of the tuning, but the new -values don't work well (as our final tuning uses Medlyn photosynshesis rather than Ball-Berry). This brings the values -for Ball-Berry for CLM5.0 back to the CLM4.5 values. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #704 #705 - - Fixes #705 -- Ball-Berry parameters in CLM5.0 should go back to the previous values in CLM4.5 - Fixes #704 -- FUN code logic to reduce or increase carbon allocation used for uptake is reversed - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): New clm5.0 paramdata file - -Changes to the datasets (e.g., parameter, surface or initial files): mbbopt now use the clm4_5 values - rather than the pretuned clm5_0 values (before Medlyn was being used) - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self, olyson - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (134 tests are different from baseline as expected) - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! (Important when FUN model on) - - Summarize any changes to answers, i.e., - - what code configurations: Anything with use_FUN=T (so Clm50Bgc compsets) - Also with Clm5.0 and Ball-Berry (stomatalcond_method='Ball-Berry1987') (so Clm50Nwp compsets) - - what platforms/compilers: All - - nature of change: climate is similar - - "Our assessment is that the impact is relatively small, but would affect climate; - however it doesn’t appear to strongly affect transient C response." - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - Experiments were done on the release branch - - casename: oleson/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_1850 - oleson/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_hist - - URL for LMWG diagnostics output used to validate new climate: - -http://webext.cgd.ucar.edu/I1850/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_1850/lnd/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_1850.21_40-clm50_release-clm5.0.15_2deg_GSWP3V1_1850.21_40/setsIndex.html - -We've also completed a historical run. Diagnostics are here: - -http://webext.cgd.ucar.edu/I20TR/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_hist/lnd/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_hist.1995_2014-clm50_release-clm5.0.15_2deg_GSWP3V1_hist.1995_2014/setsIndex.html - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #727 -(https://github.com/ESCOMP/ctsm/pull) - - #727 -- Fix the FUN bug, where an if statement was backwards - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev042 -Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) -Date: Tue May 21 23:29:31 MDT 2019 -One-line Summary: Rename, correct, and simplify parameters dewmx and sno_stor_max - -Purpose of changes ------------------- - - To rename - dewmx to liq_canopy_storage_scalar - sno_stor_max to sno_canopy_storage_scalar - in the code and in the clm45 and clm50 param files. - - To change snocanmx, liqcanmx, and fcansno to... - snocanmx = params_inst%snow_canopy_storage_scalar(p) * (elai(p) + esai(p)) - liqcanmx = params_inst%liq_canopy_storage_scalar(p) * (elai(p) + esai(p)) - fcansno(p) = (snocan(p) / (vegt * params_inst%sno_stor_max))**0.15_r8 - - Rewrote fwet(p) to follow the same format as fcansno(p). - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #710 - Fixes #710 -- rename dewmx - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): New default parameter file - -Changes to the datasets (e.g., parameter, surface or initial files): - Pointing to new clm45 and clm50 param files containing the two renamed - parameters listed above. - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: - @billsacks - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (196 different because of new param file) - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - Roundoff changes were expected. - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! (roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: ALL - - what platforms/compilers: ALL - - nature of change: roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - The code modifications causing the change were of the order-of-calculations - type in two lines of code. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): - https://github.com/ESCOMP/ctsm/pull/719 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev041 -Originator(s): sacks (Bill Sacks) -Date: Fri May 17 06:02:38 MDT 2019 -One-line Summary: Add water tracers to CanopyHydrologyMod - -Purpose of changes ------------------- - -Major overhaul of CanopyHydrologyMod in order to support water tracers. - -The part of CanopyHydrology that was actually dealing with canopy -hydrology has now been broken out into a number of small routines in -order to separate flux calculations from state updates. This is needed -in order to calculate tracer versions of the relevant variables, which -is now done here. - -The parts of CanopyHydrology that were NOT dealing with canopy hydrology -have been moved to more appropriate homes. They have not yet been -tracerized, but will be soon. - -This also makes some minor changes to diagnostic fields related to -canopy hydrology. Of particular note: QDRIP now has a different meaning: -it now corresponds to the excess liquid water that runs off from the -canopy (and is inactive by default). - -The design of this broken-out code was developed in consultation with -Mike Barlage, Erik Kluzek, Negin Sobhani, Sean Swenson and Mariana -Vertenstein. We plan to apply this design moving forward to other parts -of the code that need tracerization. See also -. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#360 - Implement water isotopes for - CanopyHydrology -- Resolves ESCOMP/ctsm#709 - QDRIP diagnostic field misleadingly named -- Partially addresses ESCOMP/ctsm#503 - Clean up CanopyHydrology - (We still need to clean up / tracerize the parts that have now been - moved elsewhere.) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Changed meaning of QDRIP diagnostic field: it now corresponds to - qflx_liqcanfall rather than qflx_prec_grnd_patch, and is default - inactive. (There is no longer a diagnostic field corresponding to - qflx_prec_grnd_patch, but there are separate diagnostic fields for the - rain and snow portions of this, both default inactive.) - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none -- checked timing of hydro1 timer vs. previous canhydro timer from my - dev039 testing: differences are negligible - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: -- Design reviewed by Mike Barlage, Erik Kluzek, Negin Sobhani, Sean - Swenson and Mariana Vertenstein -- Final code reviewed only by self - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, baseline comparisons fail as expected - -If the tag used for baseline comparisons was NOT the previous tag, note that here: - - -Answer changes --------------- - -Changes answers relative to baseline: YES (roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - Ensured no-greater-than-roundoff-level by: - - First, generated baselines using code with these diffs (note extra - parentheses in multiplication): - - diff --git a/src/biogeophys/CanopyHydrologyMod.F90 b/src/biogeophys/CanopyHydrologyMod.F90 - index f848f520..31c8c550 100644 - --- a/src/biogeophys/CanopyHydrologyMod.F90 - +++ b/src/biogeophys/CanopyHydrologyMod.F90 - @@ -338,8 +338,8 @@ subroutine CanopyHydrology(bounds, & - ! Intercepted precipitation [mm/s] - qflx_prec_intr(p) = forc_snow(c)*fpisnow + qflx_liq_above_canopy(p)*fpi - ! storage of intercepted snowfall, rain, and dew - - snocan(p) = max(0._r8, snocan(p) + dtime*forc_snow(c)*fpisnow) - - liqcan(p) = max(0._r8, liqcan(p) + dtime*qflx_liq_above_canopy(p)*fpi) - + snocan(p) = max(0._r8, snocan(p) + dtime*(forc_snow(c)*fpisnow)) - + liqcan(p) = max(0._r8, liqcan(p) + dtime*(qflx_liq_above_canopy(p)*fpi)) - - ! Initialize rate of canopy runoff and snow falling off canopy - qflx_snocanfall(p) = 0._r8 - - - Then ran test suite on 1cc9d38a. This is very close to the final - branch, but had a few small tweaks in place to get bit-for-bit: - - 1. Under some conditions, the final branch code resets slightly - negative snocan and liqcan to 0, where master did not. This - commit puts in place temporary code to maintain the slightly - negative values under these conditions, along with a check to - ensure that the values are really always only slightly negative - in this situation. - - 2. When snocan > snocanmx, master reset snocan to exactly snocanmx, - whereas the final branch code can result in snocan being - roundoff-level different from snocanmx, and similar for - liqcan. This commit puts in place temporary code to set snocan - to snocanmx under appropriate circumstances, and liqcan to - liqcanmx, along with a check to ensure that this is only leading - to roundoff-level changes in these state variables. - - 3. Multiplies then divides a flux by dtime in one place - - 4. Has parentheses around a partial sum to ensure same order of - operations as before - - This was bfb with the baselines generated with the diff noted - above, except for roundoff-level changes in SNOCAN in one grid cell - in just one test - (SMS_D_Ld1.f19_g17.I1850Clm45Cn.hobart_gnu.clm-default; old: - -8.15e-322, new: -2e-323). - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -None. But see -https://github.com/billsacks/prototypes-ctsm-canopyhydrology_tracers, -which was the source of our design discussions and contains notes from -these discussions. - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev040 -Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) -Date: Fri May 03 10:34:46 MDT 2019 -One-line Summary: Move some hard-coded parameters from code to params.nc file - -Purpose of changes ------------------- - - Reduce the number of parameters that get hardwired directly in the code - by placing in the params.nc file where they become visible and easier - to modify. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #680 - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: - None - -Changes to CTSM's user interface: - Parameters that were hardwired in the code can now be seen and changed - in the params.nc file. - -Changes made to namelist defaults (e.g., changed parameter values): - None - -Changes to the datasets (e.g., parameter, surface or initial files): - Various parameters have moved out of the code and into the params.nc file. - -Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] - -Notes of particular relevance for developers: - None ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - None - -Changes to tests or testing: - None - -Code reviewed by: - @ekluzek - @billsacks - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - tools-tests (test/tools): - - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - Answers change as expected. - -CTSM tag used for the baseline comparisons: - ctsm1.0.dev039 - -Answer changes --------------- - -Changes answers relative to baseline: YES (single precision roundoff) - Summarize any changes to answers, i.e., - - what code configurations: ALL - - what platforms/compilers: ALL - - nature of change: single-precision roundoff - Changes are due to four parameters: - accum_factor - ko25_coef - kc25_coef - frac_sat_soil_dsl_init - that were not declared "_r8" when hardwired in the code, - while now they are declared "double" in the params.nc files. I - showed that the change was no greater than single-precision roundoff - by writing the new and old values to the lnd and cesm log files and - confirming differences smaller than 1.e-6. - -Detailed list of changes ------------------------- - - - Updated the clm5 and clm4.5 params.nc files to contain the previously - hard-coded parameters that Katie Dagon recommended moving out of the - code (listed here: https://docs.google.com/spreadsheets/d/1cRmcB0xz7CjVP6ljUoCehJx49Usxsore5ma4mWcvQwM/edit#gid=0) - - Now read the parameters in the modules that use them - -Pull Requests that document the changes (include PR ids): - https://github.com/ESCOMP/ctsm/pull/684 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev039 -Originator(s): sacks (Bill Sacks) -Date: Wed May 1 11:12:34 MDT 2019 -One-line Summary: Remove excess canopy liquid/snow regardless of temperature - -Purpose of changes ------------------- - -Previously: if it was above freezing, snow was allowed to accumulate on -the canopy beyond the specified capacity, and if it was below freezing, -liquid was allowed to accumulate beyond the specified capacity. Sean -Swenson, Keith Oleson and Dave Lawrence agreed that this seems wrong. - -This tag changes the behavior so that both liquid and snow canopy -capacities are enforced regardless of temperature. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#699 (Canopy liquid and snow capacities not - enforced consistently?) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] ctsm5_0-nwp - -[X] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Keith Oleson - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, answers change as expected - -CTSM tag used for the baseline comparisons: ctsm1.0.dev038 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff; likely same climate, but this still requires - investigation - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/703 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev038 -Originator(s): sacks (Bill Sacks) -Date: Wed May 1 10:53:02 MDT 2019 -One-line Summary: Support for NWP configuration, NLDAS grid and NLDAS datm forcing - -Purpose of changes ------------------- - -This tag includes a set of changes that, together, provide support for -running an initial Numerical Weather Prediction version of CTSM over the -Continental U.S. - -(1) NWP configuration: The changes in this configuration relative to the - climate (CLM5) configuration mainly target decreasing runtime by - removing features that are expensive and not as important for NWP - time scales (days to months rather than many years) and space scales - (high resolution): - - - Single dominant landunit; if vegetated, single dominant PFT - - - Only 5 soil layers, down to 3 m - - - Only 5 snow layers - - - Plant hydraulic stress off - - - Ball-Berry rather than Medlyn stomatal conductance method (this is - a side-effect of turning plant hydraulic stress off, and is not - itself a critical aspect of the NWP configuration) - - - Maximum of 3 iterations to compute canopy fluxes - - - MEGAN is off - - Note that the NWP compset triggers changes in two new xml variables: - CLM_CONFIGURATION ('clm' vs. 'nwp'; this controls things of a more - scientific nature, like whether plant hydraulic stress is on or - off), and CLM_STRUCTURE ('standard' vs. 'fast'; this controls - structural things like the maximum number of landunits per grid cell - and the soil layer structure). Thus, you can create a case that is a - hybrid between the CLM and NWP configurations by changing these two - xml variables independently. - -(2) NLDAS2 regional grid: 0.125 deg grid over the Continental U.S. - -(3) Updated version of MOSART with support for the same NLDAS2 regional - grid - -(4) NLDAS2 data atmosphere forcing: over the same regional grid; forcing - data are available from 1980 - 2018. (We have excluded 1979 because - a small amount of data were missing for that year, and we didn't - have a good way to handle those missing data.) - -These changes can be used independently or all together. However, note -that you will get garbage if you try to use the new NLDAS2 datm forcing -for a run that extends beyond the boundaries of the NLDAS2 domain. - -There are three new NWP compsets: -- I2000Ctsm50NwpSpGswpGs: GSWP3 datm forcing; meant for global runs or - regional runs outside the NLDAS domain -- I2000Ctsm50NwpSpNldasGs: NLDAS2 datm forcing; meant for regional runs - over the NLDAS domain or some portion of it -- I2000Ctsm50NwpSpNldasRsGs: Same as above, but with a stub runoff model - in place of MOSART, for runs that aren't interested in having a runoff - model and for which you want improved throughput - -The alias for the new grid is: nldas2_rnldas2_mnldas2 (indicating that -we're using the nldas2 grid for land/atmosphere, runoff ('r') and the -ocean mask ('m'). - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#451 (Add NWP physics option) -- Resolves ESCOMP/ctsm#452 (Add an NWP compset) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] ctsm5_0-nwp - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- The NWP configuration is still a work in progress -- The NLDAS surface data set is still a work in progress (will soon - update this to use high-res PFTs) - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -- New xml variables: - - CLM_CONFIGURATION (will eventually be renamed to CTSM_CONFIGURATION) - - CLM_STRUCTURE (will eventually be renamed to CTSM_STRUCTURE) -- New namelist variable: - - itmax_canopy_fluxes - -Changes made to namelist defaults (e.g., changed parameter values): -No changes for existing CLM compsets; new defaults for NWP compsets - -Changes to the datasets (e.g., parameter, surface or initial files): -No changes for existing grids; new surface dataset for nldas2 grid - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- New tests covering NWP compsets, nldas grid and nldas datm forcing - -Code reviewed by: Mike Barlage, Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - ok - - tests pass; namelists change as expected - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- pass - hobart ------ pass - -CTSM tag used for the baseline comparisons: ctsm1.0.dev037 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- MOSART: release-cesm2.0.00 -> nldas-grid.n01_mosart1_0_31 -- CIME: ctsm/ctsm1.0/cime5.7.9/n04 -> ctsm/ctsm1.0/cime5.7.9/n05 - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/682 -- https://github.com/ESCOMP/ctsm/pull/685 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev037 -Originator(s): sacks (Bill Sacks) -Date: Mon Apr 29 16:11:47 MDT 2019 -One-line Summary: Change year alignment for present-day I compsets - -Purpose of changes ------------------- - -Change year alignment for present-day I compsets (typically, these -compsets have aliases beginning with "I2000"), in order to work better -for cases that are meant to replicate particular years. - -(1) Start the model in year 2000 rather than year 1 - -(2) Change datm's year alignment so that model year 2000 uses -observations from year 2000, model year 2001 uses observations from year -2001, etc. - -(This change was requested by Sean Swenson and supported by Dave -Lawrence.) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Year-2000 compsets now start in model year 2000 rather than 1 - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: cime changes reviewed by Erik Kluzek and others - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, year-2000 cases change answers as expected - -CTSM tag used for the baseline comparisons: ctsm1.0.dev036 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: Present-day compsets (I2000, I1Pt; also I2010 once those compsets are added) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff/same climate - - This changes the year alignment of datm. Climatological averages - should be the same as before, but the alignment of model year to - datm year changes. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: ctsm/ctsm1.0/cime5.7.9/n03 -> ctsm/ctsm1.0/cime5.7.9/n04 - -Pull Requests that document the changes (include PR ids): -- cime changes documented in https://github.com/ESMCI/cime/pull/3093 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev036 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Fri Apr 26 01:20:57 MDT 2019 -One-line Summary: Fix carbon isotope bug that caused wrong answers for isotopes under transient land-use change - -Purpose of changes ------------------- - -We currently have a bug so that for transient land-use change cases answers are different starting in soil -carbon when Carbon isotopes (use_c13, or use_c14) are on versus off. Answers are identical if there is no -land-use change. The bug does cause bulk Carbon (C12) to be slightly different, but qualitatively the same. -There is a significant impact to the Carbon isotope simulation however. The bug was causing changes in isotopic -pools to be directed to the bulk Carbon. Because, isotopes are so much smaller than bulk Carbon, this doesn't -cause a marked difference in the bulk Carbon simulation. But, the lack of the change in the isotopic pool -does have a meaningful impact on the simulation of the Carbon isotopic fields. - -Also added a general test for this and specific one to catch this case. And did some updates on documentation -files, and a small bug fix for run_sys_tests. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #692 #675 #686 - #675 -- Answers differ when carbon isotopes are on under transient cases - #686 -- Add a system test to make sure turning on carbon isotopes doesn't change answers - #692 -- run_sys_test issue - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: Added LCISO test type and a 13 month Hist test to make sure carbon isotopes - don't cause a change to answers - -Code reviewed by: dlawren, billsacks, klindsey, bishtgautum - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - tools-tests (test/tools): - - cheyenne - PASS - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - PASS (compare tests fail, because of namelist updates) - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -CTSM tag used for the baseline comparisons: ctsm1.0.dev035 - - -Answer changes --------------- - -Changes answers relative to baseline: Only for Carbon isotopes on under transient land-use change! - - Summarize any changes to answers, i.e., - - what code configurations: Bgc with use_c13 or use_c14 T and with a transient land-use change after each year boundary - - what platforms/compilers: All - - nature of change: same climate for bulk Carbon, isotopic Carbon is quite different for regions with land-use change - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime - cime from -- ctsm/ctsm1.0/cime5.7.9/n01 to ctsm/ctsm1.0/cime5.7.9/n03 - cime update allows the new test to work and starts adding NLDAS grid in - -Pull Requests that document the changes (include PR ids): #696 #694 -(https://github.com/ESCOMP/ctsm/pull) - #696 -- run_sys_test small fix - #694 -- Carbon isotope fix - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev035 -Originator(s): sacks (Bill Sacks) -Date: Mon Apr 22 20:17:40 MDT 2019 -One-line Summary: Change h2ocan to a purely diagnostic variable - -Purpose of changes ------------------- - -Previously, h2ocan_patch was maintained through the driver loop as the -sum of liqcan_patch and snocan_patch. However, there were places where -it was updated separately (though consistently) - i.e., it was not -simply a matter of 'h2ocan = liqcan + snocan'. This made the code -more complex, especially for the upcoming addition of water tracers. - -This tag changes h2ocan_patch to be a purely diagnostic variable, set -once at the end of the driver loop. Prognostic equations that used to -use h2ocan now use liqcan and snocan, either directly or indirectly via -a temporary variable set equal to the current value of liqcan+snocan. - -This tag also completely removes support for snowveg_flag = 'OFF' in -order to clean up the code. - -In addition, this tag renames the namelist variable snowveg_flag to -snowveg_affects_radiation (now a logical). - -Finally, this tag includes a minor change to always compute fcansno, -even if snowveg_affects_radiation is false, in order to simplify the -code. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#199 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -- snowveg_flag renamed to snowveg_affects_radiation, and changed to a - logical flag - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: -- Answer-changing portion of these changes reviewed by Keith Oleson and - (at least to some extent) Sean Swenson - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, answers change as expected - -CTSM tag used for the baseline comparisons: ctsm1.0.dev034 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - I split these changes into two pieces: (1) an answer-changing piece - where I made minimal changes to replace uses of h2ocan_patch with - liqcan+snocan (via temporary h2ocan variables holding this sum), - and (2) non-answer-changing code cleanup. (1) consisted of the - first two commits on this branch (461cafea and f195c105). With the - changes in (1), I added checks near each change to ensure that the - new expression differed by no more than roundoff from the old - (using an absolute cutoff of 1e-13). I ran the full test suite with - these checks in place, and generated new baselines. I then compared - the changes in (2) with the baselines from (1); this cleanup step - was bit-for-bit except for roundoff-level changes in the - now-diagnostic-only field H2OCAN. - - As noted in ESCOMP/ctsm#689, the changes in (1) were larger than I - expected, presumably because initially roundoff-level differences - can lead to divergent code behavior. The most obvious example of - this is in the check of h2ocan > 0 in subroutine FracWet. I have - found that, due to roundoff errors, it is possible for h2ocan_patch - > 0 by roundoff, while (liqcan_patch + snocan_patch) <= 0 by - roundoff. (Presumably the reverse could also be true, though I - haven't seen that – but I haven't spent much time looking for it.) - - Soon, we plan to do a more rigorous test to double check that this - change is not climate-changing. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- First part of changes in https://github.com/ESCOMP/ctsm/pull/689 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev034 -Originator(s): sacks (Bill Sacks) -Date: Sat Apr 20 06:11:23 MDT 2019 -One-line Summary: Change clm4_5: Use Justin Perket snow on vegetation - -Purpose of changes ------------------- - -This tag changes the behavior of clm4_5, making it now use Justin -Perket's snow on vegetation parameterization. This parameterization was -originally introduced in clm4_5_1_r112. At the time it was only used for -clm5_0 cases. This tag uses that parameterization for clm4_5 cases, too, -so that (like clm5_0) they use snowveg_flag = 'ON_RAD' (i.e., vegetation -snow canopy on with albedo influence). - -This changes climate for clm4_5, mainly through albedo changes, -particularly in the shoulder seasons. - -The reason for this change is to allow an upcoming cleanup of the -relationship between h2ocan, snocan and liqcan. (See -https://github.com/escomp/ctsm/issues/199 for details.) - -This tag also no longer allows snowveg_flag = 'OFF'. However, code -cleanup is deferred to a follow-on tag, in order to separate the answer -changes in this tag from the no-greater-than-roundoff-level changes in -the follow-on tag. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- First step towards addressing ESCOMP/ctsm#199 (Clean up relationship - between h2ocan, snocan and liqcan) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[X] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Changes the scientific configuration of clm4_5 cases, as noted above - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): -- For clm4_5: snowveg_flag = 'ON_RAD' rather than 'OFF' - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- Need to clean up code involving snowveg_flag, liqcan, snocan and - h2ocan. I will do this in a follow-on tag. - -Changes to tests or testing: -- Added a test with snowveg_flag = 'ON'. (At least some of the code - paths triggered by this setting were previously covered by clm45 - cases. Now that both clm45 and clm50 use snowveg_flag = 'ON_RAD', - there was some uncovered code. This new test covers this code.) -- Changed long single-point tests to use Qian forcing: With the default - GSWP3 forcing, the vast majority of the runtime was being spent in - datm. In addition, I was getting repeated failures of - ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropGs.cheyenne_intel.clm-cropMonthOutput, - I think due to memory issues; I'm hopeful that changing the datm - forcing will help with that. - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass; NLCOMP and BASELINE failures for Clm45 cases, - as expected - -CTSM tag used for the baseline comparisons: ctsm1.0.dev033 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (clm4_5) Important - - Summarize any changes to answers, i.e., - - what code configurations: Clm45 compsets - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - New climate (as in clm4_5_1_r112 for clm5_0); the main impact is - through albedo changes, particularly in the shoulder seasons. - - Changes in clm4_5 cases are due to: - - (1) Using snowveg_flag = 'ON_RAD' rather than 'OFF' - - (2) Changed initial conditions for canopy water: Rather than using - H2OCAN, which is the meaningful state variable on previous - clm4_5 initial conditions files, now we use LIQCAN and - SNOCAN. These may be 0, although at least some clm4_5 initial - conditions files (including the two non-Fates out-of-the-box - clm4_5 initial conditions files) have non-zero (though still - reasonable) LIQCAN for reasons I can't understand. - - (Also changes answers for - ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline, - which uses a clm45 initial file.) - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev033 -Originator(s): slevis (Samuel Levis, SLevis Consulting LLC, 303-665-1310) -Date: Thu Apr 11 10:51:29 MDT 2019 -One-line Summary: Limit landunit presence with thresholds set in the namelist - -Purpose of changes ------------------- - - Faster simulations. Motivated by NWP applications: - - Introduce user-defined namelist parameters to use as thresholds - above which landunit areas are kept and - below which landunit areas are removed. - - Introduce user-defined logical namelist parameter to collapse the up to - three urban landunits to the dominant urban landunit. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #581 - Fixes #581 -- Allow zeroing out special landunits if their area is below some threshold - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No - -Notes of particular relevance for users ---------------------------------------- - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - - New namelist variables with valid real values from 0._r8 to 100._r8, where - 0 means "do nothing" and other values determine the threshold above - which to keep the landunit in a gridcell. The new variables are: - toosmall_soil - toosmall_crop - toosmall_glacier - toosmall_lake - toosmall_wetland - toosmall_urban - - New logical namelist variable collapse_urban. If .true. then the up to - three urban landunits collapse to the dominant urban landunit. - ---------------------------------------------- -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - There's a typo in the name for n_dom_landunits (missing the s) in bld/CLMBuildNamelist.pm - build-namelist doesn't check for toosmall_* below 0 or above 100, but the code does - -Changes to tests or testing: Yes - New unit tests subroutine test_collapse_individual_lunits and - test_collapse_all_lunit_opts_active in test_surfrdUtils.pf - Modified standard suite test - ERS_D_Ld10.f10_f10_musgs.IHistClm50BgcCropGs.cheyenne_intel.clm-collapse_to_dominant_decStart - to - ERS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-rm_indiv_lunits_and_collapse_to_dom - and introduced fatal error message when namelist parameters toosmall_* > 0 or - n_dom_* > 0 in transient simulations - -Code reviewed by: Erik Kluzek, Bill Sacks - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (384 differences because of new namelist items) - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - -CTSM tag used for the baseline comparisons: - cheyenne ctsm1.0.dev031 - hobart ctsm1.0.dev032 - - -Answer changes --------------- - -Changes answers relative to baseline: No - Note: Comparison to baseline gives NLCOMP failures because the new namelist - parameters always appear in the namelist now, even when they have not been - changed from their default value by the user. - -Detailed list of changes ------------------------- - - Introduced call to new subroutine collapse_individual_lunits that uses - the user-defined namelist variables listed above to determine whether - a landunit gets kept or removed from a gridcell. - - Introduced new call to collapse_to_dominant for when collapse_urban = .true. - - Introduced error checks that do not allow coexistence of transient - simulations and the toosmall_* variables OR the n_dom_pfts/n_dom_landunits - variables OR the collapse_urban parameter. - -Pull Requests that document the changes (include PR ids): #641 - https://github.com/ESCOMP/ctsm/pull/641 - #641 -- Ability to remove individual landunits for faster runs - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev032 -Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) -Date: Mon Apr 8 08:26:57 MDT 2019 -One-line Summary: Fixing the balance check to check for possible errors over all columns/patches - -Purpose of changes ------------------- -Up until now, the BalanceCheckMod code in biogeophysics did not check all -the possible errors over all columns or patches with the error threshold for -aborting clm and it merely compared the last column/patch found (where -warning threshold is met) with the error threshold. -Therefore, there was always a possibility that the abort is not triggered -when it should have been. This issue was first mentioned in ctsm issue #55 -for soil energy balance check, but a similar issue is also present for -other balance checks in BalanceCheckMod.F90 . - -Below is the list of the balance checks with a similar issue: -1. Water balance check -2. Snow balance check -3. Solar radiation energy balance check -4. Longwave radiation energy balance check -5. Surface energy balance check -6. Soil energy balance check (Issue #55) - -For remediating this issue, we used MAXVAL and MAXLOC Fortran intrinsic functions -to compare the largest error with the warning and error thresholds instead -of checking the last column or looping over all columns. - - -In addition, this PR also makes slight changes to ./run_sys_tests outputi/case -directory structure. Previously for each case in a test suite, there were -two set of directories created by run_sys_tests as follows: - * one directory which included run/ and bld/ and named as $SCRATCH/[case-name].... - * The case directory which included logs , timings, CaseDocs/, and misc. scripts - for ./case.build, ./case.submit... under $SCRATCH/tests-[testID]/[case-name].... - -This made debugging confusing and populated many folders in user's scratch. -Now, for every case in a test, all directories related to that case -including bld/ and run/ directories are nested under the case directory under $SCRATCH/tests-[testID]/[case-name].... -This is now similar to ./create_test output folder structure. - - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm issue#55 - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: - - ./run_sys_test is changed so that it nests bld/ and run/ directories under the case directory as $SCRATCH/tests-[testID]/[case-name]... - The output folder structure now is similar to ./create_test for each case in a test. - -Code reviewed by: Bill Sacks - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - -CTSM tag used for the baseline comparisons: ctsm1.0.dev031 - - -Answer changes --------------- - -Changes answers relative to baseline: No - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/670 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev031 -Originator(s): sacks (Bill Sacks) -Date: Wed Mar 13 15:03:42 MDT 2019 -One-line Summary: Subtract virtual states to reduce dynbal fluxes for transient glaciers - -Purpose of changes ------------------- - -Up until now, when computing the dynbal correction (conservation) fluxes -for transient glacier columns, we have been (1) counting the mass and -energy in the ice column as if that is a real state, but on the other -hand (2) NOT accounting for the fact that glacier columns don't -represent the soil under glacier. These two issues work in opposite -directions, but (1) dominates, because there is much more ice (and -energy, I think) in the roughly 50 m of glacial ice than there is in a -typical 50 m soil column. - -In discussing this issue with Bill Lipscomb, we came up with the idea of -subtracting some baseline value from each glacier column. I think that, -as long as we subtract the same baseline value throughout an entire -simulation for a given column, we will still conserve mass and energy -through dynamic landunit transitions. - -So, here we subtract baseline values from glacier columns, accounting -for the two issues mentioned above: (1) we subtract the water and energy -in the glacier ice, because this is a virtual state in CTSM, and (2) we -add the water and energy from the vegetated column(s), to account for -the fact that we don't have an explicit representation of -soil-under-glacier (this carries the assumption that the -soil-under-glacier has the same state as the initial vegetated state in -that grid cell). We set these baselines in initialization, so they begin -equal to the cold start state. Water and ice in the glacial ice stay -fixed over the course of a simulation, so the cold start values should -be the same as the current values at any point in time. The heat content -of the glacial ice does change over time, but by subtracting this -baseline value, we can potentially reduce the dynbal sensible heat -fluxes (however, note that it's also possible that these sensible heat -fluxes could increase when subtracting the cold start value, if ice -temperatures are closer to 0 deg C than to the cold start value, -currently 250 K). - -In addition, this introduces a new namelist flag, -reset_dynbal_baselines, which allows the user to reset these baselines -at some desired point in the simulation. I think that, in general, this -resetting would break conservation. But as long as it is done before the -onset of transient glaciers, I think this should be okay. In this way, -the user can minimize dynbal fluxes even further, by resetting the -baselines after the system has spun up. If the states haven't changed -much from this point to the point when glacier dynamics occur, then the -dynbal fluxes should now be very small. (See the documentation of this -flag in namelist_definition_ctsm.xml for more details.) - -Without this change, dynbal fluxes for a grid cell that undergoes 100% -glaciation / deglaciation in a single year are around 50 m ice, 1 m -liquid water, and a few tens of W m-2 (where those quantities of ice and -water are dribbled throughout the year, so we end up with an ice flux of -about 1.5e-6 mm/s throughout the year; and the energy flux is applied -evenly throughout the year - i.e., tens of W m-2 every time step for a -year). With this change, and with reset_dynbal_baselines set at an -appropriate time, these fluxes can be reduced to close to zero. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Partially addresses ESCOMP/ctsm#274 (Dynamic landunits: improve water - and energy conservation) - -CIME Issues fixed (include issue #): -- Fixes three issues related to inputdata checksum: - - ESCMI/cime#3033 - - ESCMI/cime#3034 - - ESCMI/cime#3036 - -Known bugs introduced in this tag (include github issue ID): -- ESCOMP/ctsm#659 (Subtract dynbal baselines from begwb and endwb) - - This can't be fixed until we're okay having this answer change on - master - -Known bugs found since the previous tag (include github issue ID): -- ESCOMP/ctsm#658 (Methane should not depend on gridcell-level TWS) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] clm4_5 - -Significant answer changes for runs with transient glaciers. - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- For runs with transient glaciers, careful thought should be given to - when to set reset_dynbal_baselines -- Inconsistency between begwb/endwb and liq1/liq2/ice1/ice2 (see ESCOMP/ctsm#659) - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variable: reset_dynbal_baselines - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- Inconsistency between begwb/endwb and liq1/liq2/ice1/ice2 (see ESCOMP/ctsm#659) - -Changes to tests or testing: -- Tweaked a test with transient glacier areas, including adding this new - flag to the test - -Code reviewed by: Bill Lipscomb reviewed the conceptual ideas, but -nobody has reviewed the actual code - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, answers change as expected - -CTSM tag used for the baseline comparisons: ctsm1.0.dev030 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (Important) - - Summarize any changes to answers, i.e., - - what code configurations: ALL, but different configurations show - different levels of changes, as noted below - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - new climate (at least regionally) for some configurations; - roundoff for others: see below - - There are three levels of changes here: - - (1) For runs with transient glaciers, there are large answer changes - in regions with changing glacier area. These answer changes are - in the various dynbal fluxes - for liquid water and ice runoff, - and for the dynbal sensible heat flux. - - (2) For runs with transient vegetation (Hist, Dv and Fates), there - are roundoff-level changes in the dynbal fluxes. For liquid - water and ice, these changes appear to only occur in grid cells - where there is some glacier area (because now both the before - and after gridcell water contents have changed by the same fixed - amount, which changes the difference at the roundoff level). For - heat, there are roundoff-level changes everywhere (because of - changes in the order of operations). - - (3) All runs have large changes in the diagnostic variables, - ICE_CONTENT1, LIQUID_CONTENT1 and HEAT_CONTENT1, over grid cells - containing some glacier area. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: cime5.7.9 -> ctsm/ctsm1.0/cime5.7.9/n01 - - Fixes issues related to inputdata checksum - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/650 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev030 -Originator(s): sacks (Bill Sacks) -Date: Fri Mar 8 15:08:34 MST 2019 -One-line Summary: Update CIME; hookup expected test fails - -Purpose of changes ------------------- - -Two main changes: - -(1) Update to latest cime (from ctsm/ctsm1.0/cime5.7.5/n01 to - cime5.7.9). Some of the important changes are: - - Fix for recent cheyenne system changes - - New domain file for f19_g17 (changes answers at the roundoff - level) - - New domain file for T31_g37 (changes answers by greater than - roundoff) - -(2) In system tests: Annotate cs.status output with expected failures - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes ESCOMP/ctsm#654 - -CIME Issues fixed (include issue #): (Many) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none? - The PFS test showed a significant speedup (170s in the previous tag, - 124s in this tag). However, some other tests showed either a slowdown - or not much change. So I'm not sure there is a consistent pattern of - speedup in this tag. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, some baselines failed as noted below - - Most testing done with cime at eb2eb704f - excluded PR #3030, which - updated support for CAM-SE grids (but the changes in this PR were - very limited). Ran SSP tests with the final version of cime (so I'd - have a few tests covering the latest cime). - -CTSM tag used for the baseline comparisons: ctsm1.0.dev029 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (f19_g17, T31_g37 small) - - Summarize any changes to answers, i.e., - - what code configurations: f19_g17, T31_g37 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - - f19_g17: roundoff-level, presumably due to new domain file (some - diffs grew to greater than roundoff-level: some methane - variables in a long test - - SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput; - and many variables in test with flooding - - ERP_P180x2_D.f19_g17.I2000Clm50SpRtmFl.cheyenne_intel.clm-default) - - - T31_g37: greater than roundoff-level, presumably due to new - domain file from cime commit 4fcf592ee - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: ctsm/ctsm1.0/cime5.7.5/n01 -> cime5.7.9 - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/602 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev029 -Originator(s): slevis (Samuel Levis, SLevis Consulting LLC, 303-665-1310) -Date: Tue Feb 26 23:42:39 MST 2019 -One-line Summary: Collapse landunits to the N most dominant - -Purpose of changes ------------------- - - Allows the collapse to fewer landunits using the concept of - N most dominant for the purpose of faster runs, eg in the context - of NWP (Numerical Weather Prediction). - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #581 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - New namelist variable n_dom_landunits with valid integer values from 0 to - max_lunit currently equal to 9, where 0 means “do nothing” and other - values determine the number of active landunits when running the model. - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - There is a question left in on whether the collapse call needs to also - be moved to inside dynamic landunits reading. - -Changes to tests or testing: Yes - ERS_D_Ld10.f10_f10_musgs.IHistClm50BgcCropGs.cheyenne_intel.clm-collapse_to_dominant_decStart - now replaces (by combining with) this test introduced in ctsm1.0.dev026 - ERS_D_Ld10.f10_f10_musgs.IHistClm50BgcCropGs.cheyenne_intel.clm-collapse_nat_pfts_decStart - I added subroutine test_collapse_to_dom_landunits to test_surfrdUtils.pf - to include new Unit Tests. In same file I renamed - subroutine test_collapse_nat_pfts to test_collapse_to_dom_pfts - to accurately describe the contents of the subroutine. - -Code reviewed by: Erik Kluzek - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -CTSM tag used for the baseline comparisons: - ctsm1.0.dev028 - - -Answer changes --------------- - -Changes answers relative to baseline: No - -Detailed list of changes ------------------------- - - Replaced existing subroutine collapse_nat_pfts with - subroutine collapse_to_dominant which can collapse to the - N dominant landunits or N dominant pfts by performing the - same actions on the data. - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #639 - https://github.com/ESCOMP/ctsm/pull/639 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev028 -Originator(s): sacks (Bill Sacks) -Date: Tue Feb 26 14:35:01 MST 2019 -One-line Summary: Interpolate out-of-the-box initial conditions and remove expensive tests - -Purpose of changes ------------------- - -Two main changes (plus some small additional changes): - -1. Removed / reworked some expensive tests - -2. Interpolated all out-of-the-box initial conditions, so that the - out-of-the-box version is now compatible with our current - configuration. The changes from before were (a) our standard - configuration now uses the gx1v7 rather than gx1v6 land mask; (b) - many inactive points are now absent in memory. - -See https://github.com/ESCOMP/ctsm/pull/622 for details. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#312 -- Partially addresses ESCOMP/ctsm#275 (just a bit) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -- New finidat files - -Substantial timing or memory changes: -- Faster initialization times for cases that no longer need to interpolate initial conditions - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Removed or reworked expensive tests: see details in https://github.com/ESCOMP/ctsm/pull/622 - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok: tests pass, baselines fail as expected - -CTSM tag used for the baseline comparisons: ctsm1.0.dev027 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (just for initial conditions) - - Summarize any changes to answers, i.e., - - what code configurations: all configurations that still need use_init_interp = .true. - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated carefully, but expected to be larger than roundoff/same climate - - Answers change for cases that still need to do interpolation from - these out-of-the-box finidat files. - - I first confirmed that the new finidat files are good via: - - - Compared `ncdump -h` of old vs. new initial conditions files - - - Ran the following tests, with comparison against master; verified that - these all pass and are bit-for-bit, that they use the new initial - conditions files, and that they now have `use_init_interp` unset - (whereas they used to have `use_init_interp` set to `.true.`); note - that these cover 6 of the 7 new initial conditions files: - - ``` - SMS_Ld1.f09_g17.I1850Clm45BgcGs.cheyenne_intel.clm-default - SMS_Ld1.f09_g17.I1850Clm45BgcCruGs.cheyenne_intel.clm-default - SMS_Ld1.f09_g17.I1850Clm50Sp.cheyenne_intel.clm-default - SMS_Ld1.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-ciso - SMS_Ld1.f09_g17.I1850Clm50BgcCropCru.cheyenne_intel.clm-ciso - SMS_Ld1.f09_g17.I1850Clm50SpCru.cheyenne_intel.clm-default - ``` - - - To cover the last new initial conditions file, ran the following test - (with the same checks as above: passes and bit-for-bit, checked - finidat, and checked `use_init_interp`), with `./xmlchange - LND_TUNING_MODE=clm5_0_cam6.0` (for the baseline for this test, I set - `init_interp_method = 'use_finidat_areas'`, which I also used in - interpolating this initial conditions file): - - ``` - SMS_Ld1.f09_g17.I1850Clm50BgcCrop.cheyenne_intel - ``` - - Details on answer changes: - - As noted above, these changes are bit-for-bit for configurations - that can now use the out-of-the-box initial conditions without - interpolation. However, answers change for configurations that still - require interpolation of the out-of-the-box initial conditions - (e.g., because they are at a different resolution than the finidat - file). - - I expected these answer changes around the Caspian Sea, due to the - fact that we are now effectively interpolating twice from the - original file: once to produce the new out-of-the-box file (which - includes an interpolation from `gx1v6` to `gx1v7`, and so - interpolates onto the Caspian Sea region) and once to go from - `f09_g17` to the target resolution (rather than interpolating - directly from `f09_g16` to the target resolution). - - However, when I ran a test with comparison to baselines - - `ERP_Ld5.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-default` - I saw - changes in regions further afield than simply around the Caspian - Sea. See images in https://github.com/ESCOMP/ctsm/pull/622 for - details. It's possible that the other differences are also due to - the Caspian Sea change, but it's also possible that there is some - other cause here that I don't understand. But Erik Kluzek and I - agreed that it isn't worth trying to understand these other - (isolated) differences. - - Also note: While most f09_g17 tests are bit-for-bit with the earlier - tag (because now use_init_interp is .false. for those tests), - `SMS_Ld2_D.f09_g17.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic_interp` - differs in some glc forcing fields for a few grid cells in - Antarctica. This is perhaps not surprising, since this test needs to - use interpolation to get fields for the Antarctica virtual columns; - so, while I don't completely understand the cause of these answer - changes, I suspect the root cause is similar to the isolated answer - changes I saw sprinkled around the world for - `ERP_Ld5.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-default`. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/622 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev027 -Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) -Date: Tue Feb 19 12:57:12 MST 2019 -One-line Summary: Non-constant time initialization for soil hydrology types are moved to SoilHydrologyType.F90. - -Purpose of changes ------------------- - -Initalization of time-varying `zwt`, `zwt_perched`, and `frost_table` are moved to `InitCold` in `SoilHydrologyType.F90`. - -Previously, `zwt`, `zwt_perched`, and `frost_table` were initialized in `SoilHydrologyInitTimeConstMod.F90`, which caused confusions. - -Bugs fixed or introduced ------------------------- -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#575 ("Some variables initialized in SoilHydrologyInitTimeConstMod are not time-constant") - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: Updated a test. The test added in previous tag included decStart with transient glaciers, which would not work. Hence, this test is modified so the compset does not include G. -Test IHistClm50SpG is updated to IHistClm50Sp. - -Code reviewed by: -Bill Sacks -Erik Kluzek - -CTSM testing: - - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, except for the expected failures. - -CTSM tag used for the baseline comparisons: -ctsm1.0.dev026 - -Answer changes -------------- - -Changes answers relative to baseline: no - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): - -Pull Requests that document the changes (include PR ids): -PR #631 Soil hydrology initialization of time-constant variables moved to SoilHydrologyType -https://github.com/ESCOMP/ctsm/pull/631 - - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev026 -Originator(s): slevis (Samuel Levis, SLevis Consulting LLC, 303-665-1310) -Date: Tue Feb 5 17:08:48 MST 2019 -One-line Summary: Collapse unmanaged PFTs to the N most dominant - -Purpose of changes ------------------- - -To run simulations fast for applications such as NWP (Numerical Weather -Prediction), allow collapsing natural PFT's to the number the user wants. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): 457 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -New namelist parameter n_dom_pfts with valid integer values from 0 to -14, where 0 means “do nothing” and other values determine the number -of active pfts when running the model - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None (unless new option invoked) - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: updated tests, added new test -Updated standard testing test to include decStart -(December start). Confirmed that answers were bit-for-bit same with -baseline before introducing the change. -Added standard testing test to test n_dom_pfts = 2 in a -transient vegetation case with December start. -Added subroutine test_collapse_nat_pfts to test_surfrdUtils.pf to -include new Unit Tests. - -Code reviewed by: -Erik Kluzek -Bill Sacks - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne ---- OK - hobart ------ OK - -CTSM tag used for the baseline comparisons: -ctsm1.0.dev025 - -Answer changes --------------- - -Changes answers relative to baseline: No (bit-for-bit) - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/588 -- NWP collapse pfts to the N most dominant -https://github.com/ESCOMP/ctsm/pull/583 -- Add routine to find indices of max k values in data - -Added new subroutines collapse_nat_pfts and collapse_crop_var and called -them from surfrdMod.F90. The second of these subroutines is not needed -when collapsing unmanaged PFTs; however, I created it early in the PR -and decided to keep it for use soon with crop-related variables like -irrigation water and fertilizer. - -Bill Sacks made changes to include subroutine find_k_max_indices for the -benefit of this PR (#583) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev025 -Originator(s): Keith Oleson, Bill Sacks -Date: Wed Jan 23 10:48:01 MST 2019 -One-line Summary: History fields for vertically-resolved sums of soil C and N, and minor fixes - -Purpose of changes ------------------- - -Main change is from Keith Oleson: Add history fields for -vertically-resolved sums of SOIL1C, SOIL2C, and SOIL3C for C12, C13, -C14, and similarly for N. New fields are SOILC_vr, C13_SOILC_vr, and -C14_SOILC_vr, and SOILN_vr. For runs that use the output_bgc usermods, -including cmip6 runs, we no longer output 'SOIL1C_vr', 'SOIL1N_vr', -'SOIL2C_vr', 'SOIL2N_vr', 'SOIL3C_vr', 'SOIL3N_vr'; instead we output -'SOILC_vr', 'SOILN_vr', and similarly for C isotopes. - -Also minor fixes: -- Output cpl hist files in SSP test (resolves ESCOMP/ctsm#61) -- Remove FATES-related commented-out code in OzoneMod (this has been - moved to https://github.com/ESCOMP/ctsm/issues/618) -- Minor tweak to run_sys_tests - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#61 - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): -- For runs that use the output_bgc usermods, including cmip6 runs, we no - longer output 'SOIL1C_vr', 'SOIL1N_vr', 'SOIL2C_vr', 'SOIL2N_vr', - 'SOIL3C_vr', 'SOIL3N_vr'; instead we output 'SOILC_vr', 'SOILN_vr', - and similarly for C isotopes. - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Bill Sacks; Erik Kluzek reviewed the changes to the SSP test - - -CTSM testing: - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- pass - hobart ------ pass - -CTSM tag used for the baseline comparisons: ctsm1.0.dev024 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/551 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev024 -Originator(s): slevis (Samuel Levis,SLevis Consulting, LLC, 303-665-1310) -Date: Mon Jan 14 11:07:04 MST 2019 -One-line Summary: Remove unnecessary restart variables - -Purpose of changes ------------------- - -Remove unnecessary restart variables to conserve on computing resources -and disk space - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): 285 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): - -Substantial timing or memory changes: - -Notes of particular relevance for developers: -Code reviewed by Bill Sacks. -Standard testing (cheyenne and hobart) OK -Unit testing PASS ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: - -Code reviewed by: Bill Sacks - -CTSM testing: -Regular testing (cheyenne and hobart) OK -Unit testing PASS - -CTSM tag used for the baseline comparisons: -ctsm1.0.dev023 - - -Answer changes --------------- - -Changes answers relative to baseline: NO (bfb) - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/598 - -Variables removed from restart: -plant_nalloc -pot_f_nit_vr* -f_nit_vr* -root_depth -qflx_floodg -snounload -qflx_snofrz_lyr -sminn_to_plant_fun_patch - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev023 -Originator(s): sacks (Bill Sacks) -Date: Thu Jan 10 13:00:42 MST 2019 -One-line Summary: Remove CLM4.0 - -Purpose of changes ------------------- - -Remove CLM4.0. This consists of removing code and other files that are -specific to CLM4.0, and doing some resulting cleanup of code that was -shared between CLM4.0 and later versions (primarily in build-namelist). - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves #455 (Remove CLM4.0) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Can no longer run CLM4.0 cases - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -- CLM4.0 compsets no longer supported - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: Removed CLM4.0 tests - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - build-namelist tests: - - cheyenne - pass - - tools-tests (test/tools): - - cheyenne - pass - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - ok - - Total number of tests = 52 - Number of tests that PASS = 51 - Number of tests that Fail = 1 - Number of compare tests that PASS = 37 - Number of compare tests that Fail = 4 - Number of tests without compare = 11 - - The one failing test is: - FAIL fail-no_towerdata.-d+/glade/p/cesmdata/cseg/inputdata++-s+RF-Bra+--debug+--pftgrid+--soilgrid. - - These same failures occurred in ctsm1.0.dev022 (including the - compare tests that Fail). Erik Kluzek says these failures are - okay. - - regular tests (aux_clm): - - cheyenne ---- pass - hobart ------ pass - - Notes on testing: - - - Most testing done on b5380c7e8. Since then, updated to a version of - cime that fixes cime's configure tool (but this isn't invoked in - system tests, so I didn't rerun the system tests) and pointed cime - to a tag rather than a hash. - - - For tools tests: In baseline, cherry-picked commit 148bc2158 into - cime - -CTSM tag used for the baseline comparisons: ctsm1.0.dev022 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: points to branch tag off of cime5.7.5 - (ctsm/ctsm1.0/cime5.7.5/n01), with changes for: - (1) Removal of support for CLM4.0 (equivalent to the changes in - https://github.com/ESMCI/cime/pull/2968) - - (2) Fix for cime configure (cherry-picked 148bc2158) - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/609 (Remove CLM4.0) -- https://github.com/ESCOMP/ctsm/pull/601 (Print git status and related - info when running run_sys_tests) - - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev022 -Originator(s): sacks (Bill Sacks) -Date: Tue Jan 8 11:01:38 MST 2019 -One-line Summary: Set tracer version of irrigation fluxes - -Purpose of changes ------------------- - -Set tracer version of irrigation fluxes. - -This required a substantial rewrite of ApplyIrrigation (now renamed to -CalcIrrigationFluxes). The problem was that the code was written to -compute the total irrigation withdrawal from groundwater, then use this -to compute the application fluxes (drip/sprinkler), then later divide -this total withdrawal by layer. But for tracer fluxes to be computed -correctly, we needed to reorder this, so that the per-layer withdrawals -are determined before determining the application fluxes. This is -because the application flux needs to know the tracer concentrations of -the source, which requires knowing which layers the source is drawing -from. This was made more challenging because of the mix of patch-level -and column-level variables at play: irrigation demand is patch-level, -groundwater availability and extraction is column-level, but application -is back to patch-level. - -In a somewhat-related change, I also reworked the passing of information -between soil hydrology (groundwater availability) and irrigation: -Previously, there was some near-duplicate code in -CalcAvailableUnconfinedAquifer (which was called prior to -ApplyIrrigation) and WithdrawGroundwaterIrrigation (which was called -after ApplyIrrigation). I have reworked the code to remove this -duplication, calling the new CalcIrrigWithdrawals in the midst of -CalcIrrigationFluxes. In doing so, I reconciled an accidental -discrepancy between the two original routines (see -https://github.com/escomp/ctsm/issues/595). - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#521 (Set tracer versions of fluxes set by - ApplyIrrigation) -- Resolves ESCOMP/ctsm#593 (Generalize groundwater irrigation availability to - handle multiple patches per column) -- Resolves ESCOMP/ctsm#595 (Inconsistency between CalcAvailableUnconfinedAquifer - and WithdrawGroundwaterIrrigation) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: - -- Sean Swenson reviewed the initial parts of the rework of - ApplyIrrigation and the passing of information between soil hydrology - and irrigation - -CTSM testing: - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, expected baseline failures as noted below - - Additional manual testing: - - - Out of the box, the one-timestep tracer consistency test - (SMS_D_Ln1.f10_f10_musgs.I2000Clm50BgcCropGs.hobart_nag.clm-tracer_consistency) - passed when the new check was inserted after the irrigation call, - even without the changes in this tag. Presumably this is because no - irrigation was being done in the first time step of this test. To - confirm that the changes here were both necessary and effective, I - hacked the code to force irrigation of all types (surface and - groundwater) on the first time step (see - https://github.com/billsacks/ctsm/commit/d28a03145). I confirmed - that this test, with those code hacks, failed before the changes in - this tag, and passed with these changes in place. - - - I used a multi-step process to confirm that these changes are only - roundoff-level different for groundwater irrigation (because - feedbacks in the system result in - SMS_D_Ld5.f10_f10_musgs.I2000Clm50BgcCrop.hobart_nag.clm-irrig_alternate - looking greater-than-roundoff-level different from the baseline): - - (1) Confirmed that e507fe603 is only roundoff-level different from - baseline using cprnc output from this test. - - (2) Confirmed that a4a1a626c is only roundoff-level different from - e507fe603. This was the tricky part. I did this by introducing - some temporary code that (a) computed some fluxes in both the - old and new ways, (b) compared the old and new methods for each - point and time step, confirming that they were no more than - roundoff-level different, then (c) set the fluxes to the old - method. I confirmed that this was bit-for-bit with e507fe603, - and the checks for greater-than-roundoff-level differences - between the old and new methods were never triggered. (See - https://github.com/billsacks/ctsm/commit/7d23e9e and the earlier - commits on that branch.) - - (3) Confirmed that remaining changes an the branch are bit-for-bit - with a4a1a626c. - -CTSM tag used for the baseline comparisons: ctsm1.0.dev021 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: - - - Small answer changes when groundwater irrigation is enabled. In - principle, could change answers by greater than roundoff due to - fix of #595, but I didn't see any answer changes in my 7-month - test due to that change. Other than that, just roundoff-level - changes. - - - Answer changes when tracers are enabled. - - - Roundoff-level changes in the diagnostic field, - QIRRIG_FROM_SURFACE, for many tests - - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - See notes under "what code configurations" for details. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/600 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev021 -Originator(s): mvr (Mathew Rothstein,UCAR/CSEG,303-497-1304) -Date: Wed Dec 26 16:29:06 MST 2018 -One-line Summary: Added tracer ratio capability and included it in consistency checks - -Purpose of changes ------------------- - -These changes are needed to support the implementation of water isotopes by ensuring -that isotope-related variables are being updated consistently throughout the model. -The consistency checks include the testing of a bulk tracer that should always be -equal to the bulk, and also test tracers that maintain a fixed ratio (other than -one) to the bulk. This commit includes fixes to the cold start initialization for -the water tracers with ratios other than one. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] -#541 Only do water tracer consistency checks on tracers that are - supposed to maintain a fixed ratio -#459 Fix cold start initialization of water tracers -#508 Remove unused variables in new Water types -#357 Put in place Water isotope consistency checks - - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: added unit tests - -Code reviewed by: bill sacks - - -CTSM testing: - - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- PASS - hobart ------ PASS - -CTSM tag used for the baseline comparisons: ctsm1.0.dev020 - - -Answer changes --------------- - -Changes answers relative to baseline: no, b4b - - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): #599 Adding isotope - tracer ratios -(https://github.com/ESCOMP/ctsm/pull) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev020 -Originator(s): Sean Swenson, Bill Sacks -Date: Mon Dec 3 11:51:24 MST 2018 -One-line Summary: New options for irrigation and crop fsat - -Purpose of changes ------------------- - -Introduce three new options: - -(1) Ability to withdraw irrigation water from groundwater if not enough - water is available from rivers. This is controlled via new namelist - flag, use_groundwater_irrigation. Water can be withdrawn from both - the unconfined (from the soil column) and confined (from wa) - aquifers. - -(2) Irrigation method: sprinkler (above canopy) vs. drip (below - canopy). This can be set on a per-crop and per-gridcell basis on the - surface dataset, but out-of-the-box support for creating the - necessary surface dataset field is not yet in place (see - ESCOMP/ctsm#565). For now, it can be controlled globally via a new - namelist flag, irrig_method_default. The default is drip, which was - what we were previously using implicitly. - -(3) Set crop fsat to zero. This is controlled by a new namelist option, - crop_fsat_equals_zero. - -Default behavior is the same as before for all three options. - -Also: - -- If use_aquifer_layer is false (which is the default for CLM50), no - longer reset wa_col every time step - -- Adds indices to vector history files giving column, landunit and - gridcell indices for each patch, etc. (Resolves ESCOMP/ctsm#81: - "Restart files are different for CLM when run over different number of - tasks" (issue name is a misnomer of the remaining to-dos in that - issue.) - -- Writes 3d time-constant fields on first history file for all tapes, - not just the first - -- Small performance improvements to irrigation - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Resolves ESCOMP/ctsm#81 ("Restart files are different for CLM when run - over different number of tasks", but that name was a misnomer for the - remaining work needed on the issue) - -Known bugs introduced in this tag (include github issue ID): -- ESCOMP/ctsm#565: Surface dataset enhancements needed for irrigation method - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variables: - - use_groundwater_irrigation - - irrig_method_default - - crop_fsat_equals_zero -- Partial support for new surface dataset field: irrigation_method - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: -- Added two tests of the new irrigation options -- Added an _includes directory to hold things that should be included by - testmods (not used directly) - - -Code reviewed by: Bill Sacks and Sean Swenson reviewed each other's code - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - ok - - Tests pass, namelists differ as expected - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ pass - - ok: tests pass, some answers change as noted below - -CTSM tag used for the baseline comparisons: ctsm1.0.dev019 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (same climate) - - Summarize any changes to answers, i.e., - - what code configurations: Some CLM50 cases that are either cold start - or (unusually) use a CLM45 initial conditions file; it's possible - that non-cold-start configurations would see differences rarely. - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff, same climate - - Differences arise due to no longer resetting wa_col to - aquifer_water_baseline every time step in BeginWaterBalanceSingle - if use_aquifer_layer is false (which is the default for - CLM50). (This change is needed to conserve water properly with the - new groundwater-based irrigation.) For the most part, wa_col - wasn't being changed when use_aquifer_layer is false (so no longer - resetting it has no effect if groundwater irrigation isn't being - used), but the one exception is the "work around of the negative - liquid water" added by Jinyun Tang in subroutine SoilWater (dated - Jan 14, 2015), which can be exercised when use_flexibleCN is - true. Sean Swenson did some experimentation, and found that the - code that updates wa_col is only exercised in the first time step - of a cold start run, and that finding is borne out in the test - suite results. However, it's possible that there are rare cases - when this is exercised later in a run. - - I have confirmed that this branch is bit-for-bit with the baseline - if I revert the addition of the use_aquifer_layer conditional - around the wa_col resetting in - BeginWaterBalanceSingle. Alternatively, nearly all tests are - bit-for-bit with the baseline if I remove the one line updating - wa_col in subroutine SoilWater (and also remove the endrun for - water balance errors from BalanceCheck); the one exception is the - waccmx_offline test, which uses a CLM45 initial conditions file in - a CLM50 configuration. - - The following tests had baseline failures: - - Cold start tests: - - ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive - ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-cropColdStart - ERP_P180x2_D_Ld5.f19_g17.I2000Clm50BgcDvCrop.cheyenne_intel.clm-crop - ERP_P36x2_Lm25.f10_f10_musgs.I2000Clm50BgcDvCrop.cheyenne_intel.clm-monthly - ERP_P72x2_Lm25.f10_f10_musgs.I2000Clm50BgcDvCrop.cheyenne_intel.clm-monthly - - Test that uses a CLM45 initial conditions file in a CLM50 - configuration: - - ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/523 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev019 -Originator(s): sacks (Bill Sacks) -Date: Fri Nov 30 13:36:57 MST 2018 -One-line Summary: Rework cold start initialization of wa and zwt - -Purpose of changes ------------------- - -Rework cold start initialization of wa and zwt when use_aquifer_layer is -false to reduce answer changes in upcoming groundwater_irrigation -branch. - -In the groundwater_irrigation branch -(https://github.com/ESCOMP/ctsm/pull/523), Sean Swenson has stopped -resetting wa_col each time step if use_aquifer_layer is false. However, -this leads to having a substantially different value of wa_col when -use_aquifer_layer is false: previously, it was reset to -aquifer_water_baseline each time step, but with Sean's changes, it stays -close to its initial values, which have been 4000 in most places. This -tag changes the initial values to match the value it was being reset to, -so it simply starts at aquifer_water_baseline - so the -every-time-step-resetting to aquifer_water_baseline can be removed -without massively changing the value of wa_col. - -In addition to changing the cold start initialization of wa_col, we are -also changing the cold start initialization of zwt in this case where -use_aquifer_layer is false: The old initialization of zwt wouldn't work -as intended now that we have changed the initial value of wa_col; Sean -Swenson suggested this new initialization method instead. This -initialization to zi(c,nbedrock(c)) is correct if there are no saturated -layers, and close enough for a decent cold start even if there are. - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sean Swenson - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, answers change as expected for some cases - -CTSM tag used for the baseline comparisons: ctsm1.0.dev018 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 cold start or transient (Hist) cases - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Larger than roundoff, same climate (not investigated completely - rigorously through long simulations, but Sean Swenson and Bill - Sacks are both pretty confident that the resulting changes will be - small, partly based on difference statistics from the test suite, - and partly based on the fact that the only change in this tag is - in cold start initialization of some values). - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/577 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev018 -Originator(s): sacks (Bill Sacks) -Date: Thu Nov 29 16:03:50 MST 2018 -One-line Summary: Water tracer updates for initial things in driver loop - -Purpose of changes ------------------- - -Update water tracers for initial stuff done in driver loop. This includes -atm2lnd forcings (non-downscaled and downscaled), balance check initialization, -and dyn subgrid updates. - -Broadly speaking, the changes here are: - -(1) Reworked WaterType to make it easier / more robust for other code to loop - over tracers or bulk+tracers - -(2) The most interesting changes are probably the code to update the atm2lnd - water tracers (in Wateratm2lndType.F90 and WaterTracerUtils.F90) - -(3) In various other places, do some infrastructurey stuff (initializing water - balance, doing dyn subgrid stuff) for tracers as well as bulk - -(4) Supporting unit tests and unit test infrastructure - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -Resolves ESCOMP/ctsm#487 -Resolves ESCOMP/ctsm#488 -Resolves ESCOMP/ctsm#489 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- We have chosen not to set all water tracers as soon as possible, but instead - to do these tracer settings later in the driver loop. This keeps the driver - loop cleaner, but means that you cannot arbitrarily sprinkle calls to - TracerConsistencyCheck throughout the driver. Specifically for this tag: the - non-downscaled, gridcell-level atm2lnd water tracers are not updated until - after the call to downscale_forcings, so tracer consistency checks before that - point would fail. - -Changes to tests or testing: -- Added a PFS test - -Code reviewed by: Portions of the design (and possibly code) have been reviewed -by Mat Rothstein, David Noone and Mariana Vertenstein - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, some answers change as expected - -CTSM tag used for the baseline comparisons: ctsm1.0.dev017 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: many - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff-level changes in sensible heat flux from precip conversion due to - refactoring this calculation; everything else bit-for-bit - - If bitwise differences were observed, how did you show they were no worse - than roundoff? via summarize_cprnc_diffs to see differences in the test suite - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -https://github.com/ESCOMP/ctsm/pull/572 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev017 -Originator(s): slevis (Samuel Levis, Slevis Consulting LLC,303-665-1310) -Date: Wed Nov 28 14:27:50 MST 2018 -One-line Summary: Merge the collapse2gencrop branch - -Purpose of changes ------------------- - -These changes allow the model to not need to read 16-pft -datasets and rather read 78-pft datasets. The 78-pft datasets were -developed for use with prognostic crops originally. The current changes -allow the model to use the 78-pft datasets in 16-pft runs by -collapsing the crop pfts (cfts) from specific types to the model's -generic crop types. The changes are generic so that the model may still -read 16-pft datasets for 16-pft runs. Ultimately these changes will -permit users to run with any number of pfts, while the ctsm group -maintains a single set of input pft data. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): Fixes #509 (partial) - #509 -- irrigate in 1850 is off for runs with use_crop but on for those without - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Changes made to namelist defaults (e.g., changed parameter values): -- maxpatch_pft made obsolete -- nnegcrit was increased because of failure in the TRENDY simulations. -This was done in the source, rather than the namelist but does have an -effect on user behavior. - -Substantial timing or memory changes: No - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - - The "irrigate" attribute should now be removed from all fsurdat files for namelist generation. - Thus irrigate on or off is now an option for non-crop cases. - - -Renamed parameters: -maxpatch_pft is obsolete; remove from namelist-related scripts in future PR -numpft + 1 ---> maxsoil_patches -maxpatch_pft ---> maxsoil_patches in CNDV -numpft ---> maxveg -numpft_ed ---> maxveg_fates - -Several modules were made default private. The list of variables in them -that are public are explicitly listed now: -LakeCon.F90 -clm_initializeMod.F90 -clm_instMod.F90 -clm_varpar.F90 -pftconMod.F90 -subgridAveMod.F90 - -Changes to tests or testing: -New test -New unit tests in test_surfrdUtils.pf, all containing the prefix -test_collapse_crop_types_* - -Code reviewed by: -Erik Kluzek and Bill Sacks - -CTSM testing: -Regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- PASS - hobart_pgi -------- OK - hobart_intel ------ PASS - -CTSM tag used for the baseline comparisons: ctsm1.0.dev016 - -Answer changes --------------- - -Changes answers relative to baseline: NO - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #483 - -Sam Levis cloned Erik Kluzek's collapse2gencrop branch and then -tested, corrected errors, resolved conflicts, added unit tests, while -updating to newer tags as needed. - - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev016 -Originator(s): sacks (Bill Sacks) -Date: Thu Nov 1 07:27:48 MDT 2018 -One-line Summary: Update cime, fix FATES DEBUG token, add script to easily run system tests - -Purpose of changes ------------------- - -(1) Update to latest version of cime master - -(2) Update FATES with a minor change: change DEBUG to debug, to allow - working with a preprocessor-defined DEBUG token - -(3) Add a script (run_sys_tests) that allows easily running all system - tests (see - https://github.com/ESCOMP/ctsm/wiki/System-Testing-Guide#running-test-suites-with-the-run-sys-tests-wrapper - for details) - -(4) As part of (3), start work on a CTSM python library and associated - test infrastructure. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes ESCOMP/ctsm#535 (Run Fortran unit tests as part of create_test) - -CIME Issues fixed (include issue #): -- Various - see CIME ChangeLog for details - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] clm4_5 - -[X] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- New run_sys_tests wrapper -- Fortran unit tests now run as part of aux_clm - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - tools-tests (test/tools): - - cheyenne - not run - - PTCLM testing (tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne ---- ok - hobart ------ ok - - ok means tests pass, baselines fail as expected - -CTSM tag used for the baseline comparisons: ctsm1.0.dev015 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (new presaesro and CO2 datasets) - - Summarize any changes to answers, i.e., - - what code configurations: All I compsets (except spinup test that uses cplhist datm forcing) - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Potentially new climate - - Changes answers for I compsets due to datm update as part of the cime - update: new presaero and CO2 datasets - (https://github.com/esmci/cime/pull/2828) - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -- cime: cime5.7.3 -> cime5.7.5 -- fates: fates_s1.8.1_a3.0.0 -> fates_s1.8.1_a3.0.0_rev2 - -Pull Requests that document the changes (include PR ids): -- https://github.com/escomp/ctsm/pull/493 (Wrapper to system tests, and - start of a ctsm python library) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev015 -Originator(s): sacks (Bill Sacks) -Date: Sun Oct 28 14:29:30 MDT 2018 -One-line Summary: CMIP6 compset modifiers, usermods for typical output, and other output enhancements - -Purpose of changes ------------------- - -(1) Support %BGC-CROP-CMIP6DECK and %BGC-CROP-CMIP6WACCMDECK compset - modifiers, so that we can turn on the necessary options - (output-related and others) via new CMIP6-specific compsets. - -(2) Turn on carbon isotopes in CMIP6 runs (from Erik Kluzek) - -(3) Remove setting of CCSM_BGC=CO2A in the cmip6 usermods - -(4) Add usermods directories for getting typical extra output that's - wanted in many cases: output_crop, output_crop_highfreq, output_bgc, - output_bgc_highfreq, output_sp, and output_sp_highfreq. These can be - enabled by adding something like '--user-mods-dir output_crop' on - the create_newcase line (that short-hand works for an I compset; for - F or B compsets, you need to provide the full path to the usermod - directory). - -(4) Allow holes in the number of history tapes. Holes are cases where, - for example, we have h0, h1 and h3 tapes, but no h2 tape (because - there are no fields on the h2 tape). (This is needed for (3).) - -(5) Fix reading and writing of 1-d logical global arrays. This fixes - ESCOMP/ctsm#24 for real (rather than just preventing an attempt to - read/write 1-d logical arrays, as was done in the previous 'fix'). - -(6) Add C13_NBP and C14_NBP diagnostic fields (from Keith Oleson) - -(7) Make a bunch of carbon isotope diagnostic fields inactive by default - -(8) Don't allow interpolation (use_init_interp) from a case without - carbon isotopes to a case with carbon isotopes: Due to - https://github.com/ESCOMP/ctsm/issues/67, interpolation from a case - without carbon isotopes to a case with carbon isotopes yields - incorrect initialization values for the carbon isotopes. Now that - we're turning carbon isotopes on via some semi-out-of-the-box - usermods (for cmip6), it is becoming more important to check to make - sure someone doesn't shoot themselves in the foot this way. - -(9) Add tests of the new output usermods as well as of the CMIP6 compset - modifiers - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #24 for real (ncd_io_1d_log_glob is broken) -- Fixes #529 (Organize usermods_dirs to facilitate running cases with - the right output) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variable, just for testing purposes: - for_testing_allow_interp_non_ciso_to_ciso. This bypasses an error - check, and should only be used in tests. - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Reworked tests of cmip6_deck usermods to use the new - %BGC-CROP-CMIP6DECK compset modifier, and changed f09_g16 to f09_g17 -- Added a test of the %BGC-CROP-CMIP6WACCMDECK compset modifier -- Added tests of output_crop_highfreq, output_bgc_highfreq and - output_sp_highfreq usermods directories -- Note that there are NO tests covering the cmip6_evolving_icesheet - usermods: this usermod directory adds very little beyond cmip6_deck, - so it didn't seem worth its own test - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - - ERI_D_Ld9.T31_g37.I2000Clm50Sp.cheyenne_intel.clm-SNICARFRC - initially failed COMPARE_base_hybrid, COMPARE_base_rest and BASELINE - comparisons. I reran it and it passed. - - Manually compared all history files from - ERS_Ly3.f10_f10_musgs.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic - with baseline - ERS_Ly3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-cmip6. They - were all identical. Also compared all history files from - SMS_Ld5_D.f09_g17.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic - with baseline - SMS_Ld5_D.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-cmip6. They - were all identical (but note that this basically just compared the - cpl.hi file: the test was too short to produce monthly files.) - -CTSM tag used for the baseline comparisons: ctsm1.0.dev014 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/536 - Allow holes in the number of - history tapes and reorganize cmip6 usermods (main PR containing all of - these changes) -- https://github.com/ESCOMP/ctsm/pull/527 - Add carbon_isotope user-mod - directory to turn on c13 and c14 -- https://github.com/ESCOMP/ctsm/pull/539 - Support a %CMIP6DECK compset - modifier - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev014 -Originator(s): sacks (Bill Sacks) -Date: Fri Oct 26 06:20:34 MDT 2018 -One-line Summary: Miscellaneous minor, bit-for-bit bug fixes - -Purpose of changes ------------------- - -Four miscellaneous minor, bit-for-bit bug fixes: - -(1) Py3 pylint check and address cime issue ESMCI/cime#2822 (from Jim - Edwards: ESCOMP/ctsm#526) - -(2) Change uppercase DEBUG variables to lowercase debug (requested by - Jim Edwards to avoid conflicting with the DEBUG CPP token) - (Fixes ESCOMP/ctsm#534) - -(3) Remove unnecessary line of code in LunaMod.F90 that was causing - problems with some compilers due to an uninitialized variable - (Fixes ESCOMP/ctsm#322) - -(4) Add r8 to 0 constant to fix build issue with XLF compiler (from Jim - Edwards: ESCOMP/ctsm#531) - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes ESCOMP/ctsm#322 (ERS_D_Ld5.f19_g16.I2000Clm50BgcCruGs run FAIL (intel)) -- Fixes ESCOMP/ctsm#534 (Rename DEBUG to debug in a few places) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: none - -Code reviewed by: different pieces reviewed by different people - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - ok means tests and baseline comparisons pass. There were unexpected - NLCOMP diffs. From spot-checking a few tests, I see the following: - - - (1) On both cheyenne and hobart: Diffs in logfile. This looks like a - problem in cime: it says: - - BASE: logfile = 'rof.log.136342.hobart.cgd.ucar.edu - COMP: logfile = 'rof.log - - (2) On hobart: Diffs in pio_typename: netcdf vs. pnetcdf (says that - new uses pnetcdf): but when I compare files by hand, they look - the same in this respect (both baseline and new use netcdf), so - maybe this is due to a problem in the timing of when nlcomp is - run? - - Since these both look like problems in the comparison script rather - than in the tag, I'm letting these go, but will open a cime issue if - we see this again. - - -CTSM tag used for the baseline comparisons: ctsm1.0.dev013 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/531 (fix build issue with xlf compiler) -- https://github.com/ESCOMP/ctsm/pull/526 (fix cime issue 2822 and pylint chk) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev013 -Originator(s): erik (Erik Kluzek)/slevisconsulting -Date: Thu Oct 25 18:09:47 MDT 2018 -One-line Summary: Fix the fact that transient Bgc and SP cases had constant crop area in time - -Purpose of changes ------------------- - -Fix transient non-crop cases that had constant crop area so that crop area will change in time -(and hence natural veg area will also change corresponding to it). - -Also bring in changes to update mksurfdata_map to handle SSP-RCP future scenarios. Right now -it can handle SSP5-8.5 out of the box. Also add a new test for that. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #538 - #538 -- In transient pft simulations with use_crop=.false., %crop does not advance from 1850 values - -Known bugs found since the previous tag (include github issue ID): #545 - #545 -- Antarctica ice shelves are being treated as wetlands rather than glaciers - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[X] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): A few more namelist checks - Added a check to make sure do_transient_pfts was the same as do_transient_crops - Don't allow use_fertilizer for non-crop case - namelist checks that create_crop_landunit=T except for FATES - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - New -ssp_rcp option to mksurfdata.pl - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): New mksrfpft datasets in XML for SSP5-8.5 - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - Now, do_transient_pfts and do_transient_crops only work in unison, and hence - should be simplified to one logical called do_transient_veg - -Changes to tests or testing: Add new SSP5-8.5 mksurf test - -Code reviewed by: self, slevisconsulting, billsacks - -CTSM testing: regular, tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (18 of the transient test namelists are different to baseline as expected) - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - OK (PTCLM tests fail) - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CTSM tag used for the baseline comparisons: ctsm1.0.dev012 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! (Important) - - Summarize any changes to answers, i.e., - - what code configurations: clm4_5/clm5_0 transient simulations without Crop (either Bgc or SP) - - what platforms/compilers: All - - nature of change: crop areas increase in time and impact simulations - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: dll/clm50_r267_1deg_GSWP3V1_iso_hist_nocrop_transientfix - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): #546, #540 -(https://github.com/ESCOMP/ctsm/pull) - - #546 -- Add in ability for mksurfdata_map to handle ssp_rcp scenarios and specifically SSP5-8.5 - $540 -- Transient PFT issue - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev012 -Originator(s): erik (Erik Kluzek) -Date: Sat Sep 29 11:49:35 MDT 2018 -One-line Summary: Add snow-free fields for snowmip, fix several issues - -Purpose of changes ------------------- - -Bring in new diagnostic fields added by Justin Perket, Sean Swenson and Mark Flanner -for Snow-MIP. Most of those are fields that represent "Snow Free" data. - -Also bring in fixes for a list of issues. Add handling of the new CO2 which includes -both latitude-band and global average versions. Add some changes to make it easier -for input data processing including NOT doing the slow 1km map file creation. Have -the number of steps that are skipped at startup dependent on the time-step size. Add -a test for some requirements of WACCMX (time-step and use of ESMF). Calculations of -local time are now done in a global subroutine, that can handle negative longitudes. -Fix how FFIX_TO_SMINN is handled for history output. The namelist logical "calc_human_stress_indices" -changed from logical to a character string of three values: FAST, NONE, ALL. FAST -is the default so the less expensive ones are output, NONE turns them all off, and ] -ALL does all of them including the expensive ones. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #428, #474, #475, #476, #450, #482, #481, #491 - Fix #428 -- Update getco2_historical.ncl to handle latitude varying CO2 - Fix #474 -- Add ability to send GRIDFILE to regridbatch.sh script - Fix #475 -- Have number of steps to skip balance-check based on time - Fix #476 -- Add a test for WACCMX standalone - Fix #450 -- Add option to use global average of terrain standard deviation on surfdata files - (partial fix with simplest option) - Fix #482 -- Add extra field on CO2 streams file for global/time-averaged data - Fix #481 -- FFIX_TO_SMINN needs to be output when FUN is on - Fix #491 -- Calculations of local noon assume that longitude is 0 to 360 rather than -180 to 180 - -Known bugs introduced in this tag (include github issue ID): cime#2801 - cime#2801 -- Problem building with ESMF_LIB - -Known bugs found since the previous tag (include github issue ID): #507, #505 - #507 -- Albedo's are bad at night with negative longitudes - #505 -- CTSM input data-set tools can only work on 0-360 grids, and require monotone increasing longitude - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - - New namelist: - use_ssre -- Turn on show free fields needed for SnowMIP - - Changed namelist: - calc_human_stress_indices changed from logical to character with options: ALL, FAST, NONE - - New history fields: - Mostly added Snow Free (SF) fields - ALBDSF - ALBISF - FSRSF - FSRSFND - FSRSFNDLN - FSRSFNI - FSRSFVD - FSRSFVDLN - FSRSFVI - SSRE_FSR - SSRE_FSRND - SSRE_FSRNDLN - SSRE_FSRNI - SSRE_FSRVD - SSRE_FSRVDLN - SSRE_FSRVI - -Changes made to namelist defaults (e.g., changed parameter values): - calc_human_stress_indices = 'FAST' is now the default - -Changes to the datasets (e.g., parameter, surface or initial files): - mkghg_bndtvghg -- Update with new CO2 files, both monthly, lat-bands and yearly, global - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - I was able to reduce the duplication in SurfaceAlbedoMod where the original implementation added a cut - and paste copy of code. But, there is still a lot of duplication in this file that could be improved, by - making smaller functions/subroutines to do sections of code that are essentially repeated many times. - There's a bit of an increase in complexity to reduce the duplication, but reducing the duplication was worth it. - -Changes to tests or testing: - Add a new waccmx_offline test mods and test with it - New test expected fail because of cime issue: ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline - Turn use_ssre on for most tests, off for reducedOutput - And set calc_human_stress_indices=NONE for reducedOutput, FAST for most, and ALL for KitchenSink and KSMOut tests - -Code reviewed by: self, @olyson, @billsacks - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CTSM tag used for the baseline comparisons: ctsm1.0.dev011 - - -Answer changes --------------- - -Changes answers relative to baseline: no bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): No - -Pull Requests that document the changes (include PR ids): #462 #449 -(https://github.com/ESCOMP/ctsm/pull) - - #462 -- Add namelist item to calculate all heat stress indices only if requested; to speed up model - #449 -- Bring in snowmip diagnostic fields - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev011 -Originator(s): sacks (Bill Sacks), mvr (Mathew Rothstein) -Date: Wed Sep 12 10:50:31 MDT 2018 -One-line Summary: Add water tracer consistency checks, and other water tracer work - -Purpose of changes ------------------- - -1. Add water tracer consistency checks - -2. Add infrastructure for looping over all water tracers - currently - just used for the tracer consistency checks - -3. Breakout of atm2lnd and lnd2atm water variables, needed for water tracers - -4. Add some namelist control over the addition of water tracers - -5. Add a system test that exercises the water tracer consistency checks - -6. Add a 'ratio' variable for each water tracer - -7. Add some unit tests of the new water tracer infrastructure - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Partially addresses #357 -- Resolves #479 -- Resolves #492 - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Don't be fooled by the new namelist variable, enable_water_isotopes: - This is just a place-holder for now, not implying that water isotopes - are actually working. - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variables: enable_water_tracer_consistency_checks and - enable_water_isotopes. The latter is just a place-holder for now. - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: New test that runs the water tracer consistency check - I ran this test on cheyenne_gnu and cheyenne_intel along with the - out-of-the-box hobart_nag version - -Code reviewed by: Mat Rothstein and I have worked together on many of -these changes, but not all code has been reviewed by the other. - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - ok (tests pass, clm4_5 and clm5_0 namelists differ from - baseline as expected) - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - -CTSM tag used for the baseline comparisons: ctsm1.0.dev010 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/497 - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev010 -Originator(s): sacks (Bill Sacks) -Date: Thu Aug 30 17:14:28 MDT 2018 -One-line Summary: Update cime to cime5.7.3 - -Purpose of changes ------------------- - -Update cime from cime5.6.10 to cime5.7.3. To support this change, there -are also minor code changes related to the pause-resume implementation -(from Erik Kluzek). - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- ESCOMP/ctsm#384 (VIC test is failing at f09 resolution with signal) - (I'm not sure what fixed this, but it's passing now) - -CIME Issues fixed (include issue #): many - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - -CTSM tag used for the baseline comparisons: ctsm1.0.dev009 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): -cime: cime5.6.10 -> cime5.7.3 - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev009 -Originator(s): sacks (Bill Sacks) -Date: Wed Aug 22 20:32:36 MDT 2018 -One-line Summary: Fix initialization of AnnET in InitAccVars - -Purpose of changes ------------------- - -InitAccVars was mistakenly setting qflx_evap_tot_col rather than -AnnET. This fix allows us to remove now-redundant cold start and restart -code for AnnET. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #480 -- Partially addresses #285 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: basic proposed changes reviewed by Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - -CTSM tag used for the baseline comparisons: ctsm1.0.dev008 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev008 -Originator(s): erik (Erik Kluzek) -Date: Tue Aug 14 10:25:12 MDT 2018 -One-line Summary: Update 1850 ndep file and last year for streams for Historical transient cases - -Purpose of changes ------------------- - -Bring in changes from release-clm5.0.05. Update to latest Nitrogen Deposition file from simulations with WACCM for 1850. -Also fix an issue with the last year for historical transient cases. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): 461 - #461 -- increase last year in streams for transient - -Known bugs found since the previous tag (include github issue ID): [If none, remove this line] - #478 -- Bare soil g1 should be missing value or zero - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): Last year extended for transient datasets - -Changes to the datasets (e.g., parameter, surface or initial files): New ndep dataset for 1850 - -Substantial timing or memory changes: - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: Lengthen some tests - -Code reviewed by: self - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (11 show differences for 1850_control and 20thC_transient) - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CTSM tag used for the baseline comparisons: ctsm1.0.dev007 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! (ndep files, and steams years) - - Summarize any changes to answers, i.e., - - what code configurations: 1850_control or 20thC_transient for Clm50 - - what platforms/compilers: all - - nature of change: similar climate - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #477 -- Move changes from release-clm5.0.05 onto master - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev007 -Originator(s): sacks (Bill Sacks) -Date: Sun Aug 5 21:03:28 MDT 2018 -One-line Summary: Avoid glacier dynamic landunit adjustments in first time step - -Purpose of changes ------------------- - -Always avoid generating dynamic landunit adjustments for glacier area -changes in the first timestep of a startup or hybrid run - not just for -cold start or interpolated start. See the detailed discussion in -https://github.com/ESCOMP/ctsm/issues/340 for rationale. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #340 (Avoid generating dynamic landunit adjustment fluxes for - glacier changes in the first timestep) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - not run - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- ok - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - - ok means tests pass; baseline failures as expected in these two - tests that do not use init_interp: - - FAIL ERI_N2_Ld9.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev006 - FAIL SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev006 - - (The glacier area on the finidat file used in these tests - - clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180715.nc - - seems to have come from an finidat_interp_dest file, and thus does - not match the glacier area from CISM.) - -CTSM tag used for the baseline comparisons: ctsm1.0.dev006 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (small) - - Summarize any changes to answers, i.e., - - what code configurations: Startup / Hybrid runs that include CISM - (even NOEVOLVE) and do not use init_interp, due to: - - different PE layout in new case vs. the one that generated the - finidat (roundoff-level diffs) - - different glacier area on finidat file vs. what's in CISM - (greater than roundoff-level diffs) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Roundoff-level for different PE layout, larger than roundoff but - should be same climate when there is different glacier area on the - finidat file vs. what's in CISM - - The differences arise from dynamic landunit adjustments of the - below-ground C and N states in the old code, as CTSM adjusts its - areas to match CISM's. In the new code, there are no C and N - adjustments in the first time step from this adjustment. - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- #470 (Avoid glacier dynamic landunit adjustments in first time step) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev006 -Originator(s): sacks (Bill Sacks) -Date: Sat Aug 4 07:48:09 MDT 2018 -One-line Summary: Minor bug fixes, cleanup, documentation and enhancements - -Purpose of changes ------------------- - -A collection of minor bug fixes, code cleanup, documentation and -enhancements, all bit-for-bit. See list of issues fixed below for -details. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #24 (ncd_io_1d_log_glob is broken) -- Fixes #120 (Incorrect comments in Biogeophysics1Mod.F90 -- Fixes #217 (Change some cheyenne_gnu tests to cheyenne_intel) -- Fixes #245 (Put all .gitignore entries in top-level file) -- Fixes #272 (Code should error on missing mxsoil_color when SOIL_COLOR - is used) -- Fixes #283 (Add more helpful message about need to do init_interp with - wrong number of vertical layers) -- Fixes #367 (For cmip6 runs: Turn on cpl hist output needed to drive a - TG compset) -- Fixes #412 (Fix documentation of init_interp_method) -- Fixes #419 (Do not allow SOYFIXN diagnostic field with FUN) -- Fixes #464 (Some lines longer than 132 characters) -- Fixes #465 (Remove backwards compatibility check for snw_rds) -- Fixes #467 (Increase wallclock limit for test) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Changed a single-point test from gnu to intel to get better debugging - information - (SMS_D_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm45BgcCropQianGs.cheyenne_intel.clm-cropMonthOutput) -- For some single-point tests on both gnu and intel: removed one - compiler, keeping the tests on just one - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - - NLCOMP failures as expected for tests with the cmip6 test mod - - Some long single-point gnu tests failed due to running out of - wallclock time; I have removed these, just keeping them on intel - (along with removing a few other tests after I ran the testing - see - commit 5c226bdf): - - FAIL ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput RUN time=4803 - FAIL ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput RUN time=6024 - - -CTSM tag used for the baseline comparisons: ctsm1.0.dev005 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - bit-for-bit - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- #392 (Remove old code for snw_rds restart that looks no longer needed) -- (Other changes not documented in PRs) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev005 -Originator(s): sacks (Bill Sacks), mvr (Mathew Rothstein) -Date: Fri Aug 3 07:54:59 MDT 2018 -One-line Summary: Rework water data types to accommodate isotopes and other tracers - -Purpose of changes ------------------- - -This tag reworks the various water data types to allow having multiple -instances of variables that are needed for isotopes and other water -tracers. - -Specific changes include: - -(1) Separated "water state" variables into state, diagnostic and balance - check-related variables. This separation was not essential for the - work here, but was desired by Martyn Clark and others. - -(2) For each of water state, diagnostic and flux variables, separated - variables into those needed for both bulk and tracers vs. those only - needed for bulk. This way, we can have multiple instances of the - variables needed by tracers, but only a single instance of variables - that only apply to bulk water. This follows the design laid out in - https://github.com/escomp/ctsm/pull/395. The separation was based - largely on what was done in the old water isotope branch; we didn't - put a lot of thought into this, because the new design allows us to - easily migrate variables between bulk-only and bulk-and-tracer as - needed. - -(3) Moved water fluxes that were defined in science modules back into - waterflux_type or waterfluxbulk_type. This was needed for (2); there - is more discussion on this in - https://github.com/escomp/ctsm/pull/395 and the log message for - commit 711e5cd7. - -(4) Introduced a top-level water_type that holds instances of all of the - other water-related objects. This follows the design laid out in - https://github.com/escomp/ctsm/pull/395. This is particularly - valuable for the tracer instances: the logic related to number of - tracers can be encapsulated in water_type, rather than infiltrating - clm_instMod. - -(5) Added placeholders for water tracer instances - -(6) Added infrastructure to generate history / restart field names for - the tracer instances. Eventually, the isotope class can also hold - information specific to each isotope. - -This work was a joint effort between Mathew Rothstein and myself; Mat -gets much of the credit for the actual refactoring done here. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #358 (Separate WaterStateType into multiple types) -- Fixes #434 (Separate WaterFluxType into a base class and a class that just applies to bulk) -- Fixes #359 (Set up infrastructure for multiple instances of WaterState and WaterFlux types) -- Fixes #458 (Implement handling of history and restart variables for water tracers) - -Known bugs introduced in this tag (include github issue ID): -- #464 (Some lines longer than 132 characters) -- #456 (Remove backwards compatibility check for snw_rds) (not a - newly-introduced issue, but it's more important to fix this with the - separation of waterstate_type) - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- Water tracers are not yet functional - they are just placeholders -- Whether to use water tracers and which water tracers to use are - currently hard-coded; eventually, this should be namelist-controlled - -Changes to tests or testing: none - -Code reviewed by: Mathew Rothstein and Bill Sacks worked together on -these changes and reviewed each other's changes to some extent. The -high-level design was also reviewed and co-developed by Mariana -Vertenstein. Martyn Clark contributed substantially to the breakout of -water state into state, diagnostic and balance check-related variables. - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - -CTSM tag used for the baseline comparisons: ctsm1.0.dev004 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - bit-for-bit - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- https://github.com/escomp/ctsm/pull/395 (documents the high-level design) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev004 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Jul 18 02:10:23 MDT 2018 -One-line Summary: Add some new diagnostic fields, fix a few issues, update cmip6 output - -Purpose of changes ------------------- - -Add some new diagnostic fields. Some needed for CMIP6. Update the CMIP6 user-mods output. -Fix a couple issues. Get full list of history tapes working correctly. Check for valid range -of CO2. New IC file interpolated from the previous one for f19_g17_gl4 for 2000 Clm50BgcCrop. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): $210, #427, #429 - #210 -- increase number of history tapes - $427 -- Check for zero CO2 - #429 -- New IC for present day - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): New history fields - TSKIN --- skin temperature - TSL ----- temperature of near-surface soil layer - GSSUNLN - sunlit leaf stomatal conductance at local noon - GSSHALN - shaded leaf stomatal conductance at local noon - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): New finidat file f19_g17_gl4 2000 Clm50BgcCrop - New file is just interpolate from the previous file to a f19_g17_gl4 gridfor Clm50BgcCrop and 2000 simulation year - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CLMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: None - -Code reviewed by: self, oleson, abtawfik - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - OK (95 are different because of finidat file change) - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- PASS - hobart_pgi -------- FAIL - hobart_intel ------ PASS - -CTSM tag used for the baseline comparisons: ctsm1.0.dev003 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes -- only 2000 cases because of new IC - - Summarize any changes to answers, i.e., - - what code configurations: Just 2000 cases - - what platforms/compilers: All - - nature of change: same climate - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - - #338 -- Radtemp and other new diagnostic fields - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev003 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Sun Jul 15 00:26:46 MDT 2018 -One-line Summary: Update cime/cism to work on upgraded hobart and with glade changes on cheyenne - -Purpose of changes ------------------- - -Update cime and cism so can work on upgraded hobart. Also fix an issue that the Nag6.2 compiler found -in CTSM. Also get working with glade changes that happened on cheyenne, DIN_LOC_ROOT_CLMFORC was -changed to a new directory. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] - #441 -- Changes in glade invalidate previous softlinks and data locations - #438 -- Illegal argument aliasing caught by nag6.2 - #433 -- with hobart upgrade CTSM not working - -Known bugs introduced in this tag (include github issue ID): - #444 -- PGI fails on cheyenne and hobart - -Known bugs found since the previous tag (include github issue ID): - #443 -- Wood C:N ratios - #440 -- leafcn_max < target leafcn? - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): DIN_LOC_ROOT_CLMFORC on cheyenne - DIN_LOC_ROOT_CLMFORC was change on cheyenne - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: path for cheyenne specific test had to be changed - Add some gnu tests on hobart - Lengthen wallclock on a test - Fix path for DA test_mod - -Code reviewed by: self - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- FAIL - hobart_gnu -------- PASS - hobart_intel ------ PASS - -CLM tag used for the baseline comparisons: ctsm1.0.dev002 - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cism - cism-wrapper to release-cesm2.0.04 - cime to cime5.6.10 - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - #444 -- Get working on upgraded hobart and with glade changes on cheyenne - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev002 -Originator(s): erik (Erik Kluzek) -Date: Fri Jul 6 16:33:03 MDT 2018 -One-line Summary: Fix NFIX flux variables so special land-units are zeroed out, tools update, add some *_MAX fields on mksurfdata_map for transient cases - -Purpose of changes ------------------- - -Nitrogen Fixation flux arrays were being set to missing value over non-vegetated landunits. This sets them to zero everywhere -and averages in the zero's at the gridcell level for history output. It also reads in restarts with missing values and converts -them to zero's. - -There are also some tools updates, getting the tools working on the new upgraded hobart.cgd.ucar.edu. - -And mksurfdata_map is updated to add some *_MAX files on the landuse.timeseries files that will allow us to conserve memory -for transient cases. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #435, #436, #433 (for tools) - #435 -- intel build for tools - #426 -- Nitrogen Fixation flux variables - #433 -- hobart broken, got it working for tools - -Known bugs found since the previous tag (include github issue ID): #433, #431 - - #433 -- with hobart upgrade, hobart build isn't working - #431 -- When set_* options are used to hist_addfld be careful of ordering - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): ndep file updated for clm5_0 for 1850 - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CLMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): NFIX flux variables - NFIX flux variables when read from restart have special-values (missing on non veg landunits) converted to zero's - They are now initialized to zero everywhere. - -Changes to tests or testing: None - -Code reviewed by: self, wwieder, and lawrence, sacks (mksurfdata_map code) - -CLM testing: regular (although none on hobart!) - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (5 tests differ from previous version) - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - hobart --- PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - -CLM tag used for the baseline comparisons: ctsm1.0.dev001 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes, clm5_0 BGC configurations with FUN and clm5_0 with BGC for new 1850 ndep file - - Summarize any changes to answers, i.e., - - what code configurations: All clm5_0 BGC due to NFIX fields, and clm5_0 1850 BGC due to new ndep file - - what platforms/compilers: All - - nature of change: similar climate - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #437 -- ChangeLog template - #432 -- nfix - #331 -- _MAX fields on mksurfdata_map - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev001 -Originator(s): sacks (Bill Sacks) -Date: Fri Jun 22 07:31:43 MDT 2018 -One-line Summary: Begin separating SoilHydrology flux calculations - -Note the new tag naming: Starting with this tag, we are naming tags -"ctsm..." rather than "clm...". We are starting with ctsm version 1, -which for now is nearly the same as clm version 5. We are moving to this -new tag naming now because: - -(1) The changes in this tag represent the first step towards - implementing the CTSM vision (separating the biogeophysics flux - calculations from state updates, making it easier to plug in - alternative parameterizations, etc.). - -(2) This tag changes answers relative to the CLM5 release. (We expect - the climate to be the same, but we haven't tested this carefully - yet.) - -Purpose of changes ------------------- - -First steps toward separating various flux calculations in the soil -hydrology code. The focus here is on saturated surface runoff and -infiltration excess runoff. The changes here separate flux calculations -from state updates and extract various calculations into their own -subroutines to facilitate swapping in alternative parameterizations. - -Most of the changes here are refactorings that are either bit-for-bit or -just introduce roundoff-level differences. However, there are also a few -larger answer changes, as described below. - -These are the greater-than-roundoff-level answer changes: - -(A1) Use full qflx_surf in BGC code. Previously, the subroutines ch4 and - SoilBiogeochemNLeaching had been using a flux that excluded surface - water runoff (qflx_h2osfc_surf). That was deemed to be incorrect - (by Dave Lawrence and others), so these BGC subroutines have been - changed to use the full surface runoff (saturated excess runoff + - infiltration excess runoff + h2osfc runoff). - - Configurations affected: BGC compsets - - Magnitude of change: Larger than roundoff; expected to be same - climate, but not investigated carefully - -(A2) VIC: Don't ever use the TOPModel formulation for SurfaceRunoff - - The code was using the TOPModel-based formulation for SurfaceRunoff - if frost_table > zwt_perched. Sean Swenson felt this shouldn't be - done, and refactoring will be easier if VIC always uses the - vic-looking formulation, so I'm stopping applying this formulation - when using VIC. - - Configurations affected: VIC compsets - - Magnitude of change: Larger than roundoff; not investigated carefully - -(A3) VIC: Remove infiltration excess runoff - - Martyn Clark reviewed the VIC implementation, and felt that the - current implementation of infiltration excess runoff is - inconsistent with the standard VIC implementation. It appears that - what was being called VIC's infiltration excess runoff was actually - just an attempt to give a better numerical approximation to the - solution for saturated surface excess runoff. So deleting this - leaves only a first-order approximation to VIC's saturated surface - excess runoff. - - Eventually we may want to put in place a more accurate solution for - VIC's saturated surface excess runoff. But Martyn's feeling is that - this can come in with other changes we want to make regarding - numerical solutions in CTSM. - - Configurations affected: VIC compsets - - Magnitude of change: Larger than roundoff; expected to be same - climate, but not investigated carefully - -(A4) Change in QOVER diagnostic field: now includes QH2OSFC. - -These are the major refactorings (either bit-for-bit or just -roundoff-level differences): - -(R1) Extract surface runoff to its own module, and other modularization - related to what used to be subroutine SurfaceRunoff: extract a - subroutine for each fsat method, move urban surface runoff code - into different routines. - -(R2) Extract infiltration excess runoff to its own module, and other - modularization related to what used to be subroutine Infiltration. - -NOTE: For a detailed breakdown of changes, including documentation of -which changed changed answers, see the file ChangeLog_branch which was -deleted from this branch shortly before it was merged to master. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #424 (decStart testmod is missing an `--append` in an xmlchange command) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): - -Substantial timing or memory changes: - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CLMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: -- Shortened a 25-month f19 test to 13-months - (SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput): - This test took a long time to run, and we already have long tests of - this configuration at coarse-resolution. I suggested removing this - test entirely, but Erik Kluzek wanted to maintain a shortened version - of it. Erik's comments were: - - How about either flip it to f45 (because Rosie is using that - resolution for science) -- or leave it at f19 and have it run for 9 - months? The 25 months was to take it just past the 2-year spinup - time. From spunup initial conditions 9-months pretty much does a - full harvest cycle. f19 and f09 are the main configurations for - science and it would be good to have something longer than just - really short tests. - - I decided on Lm13, because this still completes in significantly less - than 2-hours, and if we're running for 9 months anyway, it seems - valuable to finish out the year and run a bit into the next year, - since some crop stuff triggers at the end of the year. - -Code reviewed by: Various code reviews done last Fall, when these -changes were first implemented. - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - - OK means tests pass, answers change as expected. - -CLM tag used for the baseline comparisons: clm5.0.dev013 - - -Answer changes --------------- - -Changes answers relative to baseline: YES (roundoff) - - Summarize any changes to answers, i.e., - - what code configurations: Essentially all (except CLM4) - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Roundoff-level changes for nearly all configurations (except CLM4). - - Greater-than-roundoff-level changes for the following - configurations: - - BGC: see (A1) note above (expected to be same climate, but not - investigated carefully) - - VIC: see (A2) and (A3) notes above (magnitude of change not - investigated carefully) - - QOVER diagnostic field: see (A4) note above - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- https://github.com/ESCOMP/ctsm/pull/244 -- https://github.com/ESCOMP/ctsm/pull/190 -- Other PRs that existed on the old NCAR/clm-ctsm repository (which has - been deleted), which were not migrated to the new repository - -=============================================================== diff --git a/doc/ctsm1_0_ChangeLog b/doc/ctsm1_0_ChangeLog new file mode 100644 index 0000000000..e02561d30a --- /dev/null +++ b/doc/ctsm1_0_ChangeLog @@ -0,0 +1,14843 @@ +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev113 +Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) +Date: Tue Sep 8 15:57:49 MDT 2020 +One-line Summary: Some bit-for-bit changes needed for the Perturbed Parameter Ensemble work + +Purpose of changes +------------------ + +Some BFB fixes including bug fixes needed for PPE simulations. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1060 (Some code cleanup of luna bug fixes) +- Resolves ESCOMP/CTSM#1062 (PPE namelist parameter defaults) +- Resolves ESCOMP/CTSM#1053 (Non-standard namelist parameter) +- Resolves ESCOMP/CTSM#1055 (Expand potential vcmax:jmax ratio) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +cmb_cmplt_fact was a parameter under namelist control pertaining to the fire +model (combusion completion factor [unitless]), which previously included an array. +This parameter is now splitted into two real values i.e. cmb_cmplt_fact_litter and +cmb_cmplt_fact_cwd. +If the users have cmb_cmplt_fact in a user_nl_clm file that worked before, it +won't work anymore since it is now splitted into cmb_cmplt_fact_litter +and cmb_cmplt_fact_cwd. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +Previously, denitrif_nitrateconc_exponent and denitrif_nitrateconc_coefficient +were on the params file but ALSO on the namelist. They are now removed from the namelist. + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: [For timing changes, can check PFS +test(s) in the test suite] None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double +maintenance): None + +Changes to tests or testing: None + + +CTSM testing: + + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- PASS (except for NLCOMP) + izumi ------- PASS (except for NLCOMP) + +If the tag used for baseline comparisons was NOT the previous tag, note that here: +ctsm1.0.dev111 + + +Answer changes +-------------- + +Changes answers relative to baseline: None + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +None + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1102 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev112 +Originator(s): sacks (Bill Sacks), wwieder (Will Wieder) +Date: Fri Aug 28 17:10:57 MDT 2020 +One-line Summary: Small changes to mksurfdata_map, singlept tool and run_sys_tests + +Purpose of changes +------------------ + +(1) Move mksurfdata_map rounding of special landunits to before wetland + fill: I think this may be important to avoid errors and/or wrong + behavior in some edge cases where we have < 0.5% cover of glacier + and/or lake, and other cases. See + https://github.com/ESCOMP/CTSM/issues/1118 for detailed + thoughts. May change answers in rare cases, but no answer changes + observed for present-day surface datasets at standard resolutions + (f09, f19, f10, f45). + +(2) run_sys_tests: record command-line arguments in SRCROOT_GIT_STATUS + file + +(3) (From Will Wieder) Updates to current surfdata & landuse files in + tools/contrib/singlept + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1118 (mksurfdata_map rounding/truncation of + special landunits should happen before wetland filling) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - PASS + + Note: ran tools testing on code based off of ctsm1.0.dev110 (before + merging with ctsm1.0.dev111) + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - PASS on mac (bishorn) + + regular tests (aux_clm): + + cheyenne ---- not run + izumi ------- not run + +If the tag used for baseline comparisons was NOT the previous tag, note that here: ctsm1.0.dev110 + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +In principle, the changes to mksurfdata_map could change answers for +rare cases. No answer changes were observed for present-day surface +datasets at resolutions f09, f19, f10 or f45. Also note that no surface +datasets were actually updated in this tag, so if any answer changes +appear from these changes, they would appear the next time we update +surface datasets. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1119 +https://github.com/ESCOMP/CTSM/pull/1120 +https://github.com/ESCOMP/CTSM/pull/1122 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev111 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Fri Aug 28 14:08:25 MDT 2020 +One-line Summary: Compsets don't use 2014 for GSWP3 forcing, LUNA prevyr changed back + +Purpose of changes +------------------ + +Update cime so that default end year for GSWP3 forcing is 2013 because 2014 data is bad. Also update +the prevyr default for vcmax/jmax to what it was before ctsm1.0.dev102. + +Fix some issues for finding initial condition files for Clm45 compsets. Also bring in updated CDEPS/CMEPS +as they were required with the cime update. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1107 -- Change initial values of LUNA back to previous global values + Fixes #1067 -- Stop using PIO2 in the LILAC build + Fixes #1121 -- FMOZ test fails + +CIME Issues fixed (include issue #): + Fixes ESMCI/cime#3683 -- Avoid artificial limit on string lengths in shr_string_listMerge + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + Last time-step in Dec/2013 for GSWP3 data still has zero humidity + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + cime is pointing to a branch_tag we should update it to a trunk tag as soon as possible + +Changes to tests or testing: build-namelist unit testing improved to find problems like #1121 a #1125 + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (all identical to previous tag) + + tools-tests (test/tools): + + cheyenne - PASS + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes (similar climate) + + Summarize any changes to answers, i.e., + - what code configurations: (2010 and SSP compsets) and Clm50 with LUNA on (Bgc or Sp) + - what platforms/compilers: All + - nature of change: similar climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cmeps, cdeps + (fox removed as a separate checkout) + cime to branch_tags/cime5.8.31_a01 + +Pull Requests that document the changes (include PR ids): #1114 +(https://github.com/ESCOMP/ctsm/pull) + #1114 -- Update cime so default end year for GSWP3 forcing is 2013 and change prevyr default for vcmax/jmax + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev110 +Originator(s): jedwards (Jim Edwards) +Date: Fri Aug 21 10:49:08 MDT 2020 +One-line Summary: Fixes needed for PIO2 + +Purpose of changes +------------------ + +Fixes needed for CTSM to work with PIO2. There is an additional fix +needed in PIO2 itself; this is available in a later version of cime that +we will bring in soon. + +Note that this PR also includes a change in config_files.xml that is +needed for a newer version of cime when running compsets with dlnd, slnd +or xlnd; this may be incompatible with the current version of the cime +external, but this does not impact compsets with CTSM. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +The changes in this tag, together with a cime update that will be coming +in soon, resolve the following issues (I'm not sure off-hand which +issues are resolved by the changes here alone and which ones require the +cime update): +- Resolves ESCOMP/CTSM#1029 (FATES tests fail with PIO2) +- Resolves ESCOMP/CTSM#1030 (mpi-serial nag case fails with pio2 when + defining h1 history restart file) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- May not be able to run configurations with dlnd, slnd or xlnd from this tag + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: Not investigated, but almost definitely not + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + + Note: Standard testing was done using PIO1 (as this is still the + default), but separate testing was also done using PIO2 (using an + updated cime) and tests were found to pass. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1095 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev109 +Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) +Date: Thu Aug 20 11:40:07 MDT 2020 +One-line Summary: Allow for resorbtion in transition from live to dead wood N + +Purpose of changes +------------------ + +This PR allows for resorbtion in transition from live to dead wood N, which also move +to NPOOL for free. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): Issue #443 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + +[x] clm5_0 + +[x] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist +variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] + +Notes of particular relevance for developers: None +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: None + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (similar climate) + + Summarize any changes to answers, i.e., + - what code configurations: Clm50 with Bgc or Cn + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new + climate): larger than roundoff/same climate + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + + Will Wieder thought the changes were small enough that we didn't need to do + a long simulation. Erik Kluzek thinks the changes were verified with single + point simulations. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev108 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Wed Aug 19 17:23:47 MDT 2020 +One-line Summary: Update default PE layouts for new SE/FV3 grids + +Purpose of changes +------------------ + +Change PE layouts for new high resolution SE/FV3 grids. Have a version for cheyenne and a default one +as well. + +Update externals: cime, cism, CMEPS, CDEPS +Change single point tests to use stub ROF +Change tests to use gx1v7 rather than gx1v6 +Update waccmx_offline to use START=1979 + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1108 Change single point tests to use stub ROF + Fixes #1098 ARCTICGRIS PE layout is very slow + Fixes #1105 Default new FV3/SE grid PE layouts are problematic + Fixes #1103 Some changes to prevent missing file for WACCMX testing + Fixes #1113 ARCTIC test is failing + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Some tests were chagned to use stub ROF and one to stub GLC. @billsacks suggest we should also change + other tests in this same way. + +Changes to tests or testing: Yes + +Code reviewed by: self + + +CTSM testing: regular, tools + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + tools-tests (test/tools): + + cheyenne - PASS + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - OK + + python testing (see instructions in python/README.md; document testing done): + + cheyenne -- PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No (except for waccmx_offline test) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cism, CDEPS, CMEPS + cism to cism2_1_69 + cime to cime5.8.30 + Update hash for CDEPS and CMEPS (so that nuopc test will run) + +Pull Requests that document the changes (include PR ids): #1111 +(https://github.com/ESCOMP/ctsm/pull) + + #1111 -- Adjust FV3/SE PE layouts + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev107 +Originator(s): erik (Erik Kluzek) +Date: Mon Aug 10 02:21:12 MDT 2020 +One-line Summary: Answer changes needed for CESM2.2.0 + +Purpose of changes +------------------ + +A list of small answer changes needed for CESM2.2.0. Nitrogen deposition file now properly +ends in 2015 rather than 2005. Have 2010_control compset match the 2000 IOC file rather than 2010. +Modify the waccmx_offline tests to more closely match the CAM tests. + +Interpolate IC files for an exact match. Answers are identical for an exact match, but different +when used for other resolutions. + +Two small bit-for-bit changes remove levurb and string_len dimensions on restart files. +Remove xsmrpool_loss when use_crop is NOT true. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): [If none, remove this line] + Answer changing fixes: + Fixes #1004 -- stream_year_last_ndep is set to 2005 instead of 2015 for historical with ctsm1.0.dev093 + Fixes #1012 -- Help prevent problems with WACCM-X testing by modifying our waccmx_offline test + Fixes #1090 -- Have 2010_control compset match 2000 simulation-year rather than 2010 + Fixes #1089 -- Failure in FXHIST test when running with CAM + Fixes #1037 -- Interpolate out-of-the-box initial conditions files for CESM2.2 release + (only changes answers for resolutions other than IC file resolution) + + Bit-for-bit changes: + Fixes #1101 -- levurb and string_len dimensions no longer needed on the restart files + Fixes #1097 -- xsmrpool_loss should only be written to the restart file if use_crop is true + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + 2010_control doesn't match 2010 finidat file + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): Interpolated IC files + Add f19 2003 IC file, f09 and 19 1979 IC file + Remove 2010 IC file + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: waccm_offline test changed to more closely match the FXHIST CAM test + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (115 tests are different than before) + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes! (very small) + + Hist and SSP BGC compsets change answers because of the correction of the end year for ndep. + You wouldn't think this would matter until you get to the end of the time-sequence -- but it + does for the first time-step. + + The 2010 compset changes answers because of using the 2000 finidat file rather than 2010 + + Some finidat files interpolated to the resolution they are designed for. This causes an apparent + change of answers when these datasets are used for other resolutions (even though it does NOT for + the resolution it's interpolated to) + + waccm_offline tests are also changed in order to more closely match the FXHIST tests in CAM. + + Summarize any changes to answers, i.e., + - what code configurations: Hist, SSP, 2010 compsets, Clm45 and some f10, 1x1 because of IC files + - what platforms/compilers: All + - nature of change: same climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #1100 +(https://github.com/ESCOMP/ctsm/pull) + #1100 -- Answer changes needed for CESM2.2.0 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev106 +Originator(s): erik (Erik Kluzek) +Date: Thu Aug 6 15:35:47 MDT 2020 +One-line Summary: Bit-for-bit updates for the CESM2.2.0 release + +Purpose of changes +------------------ + +Fix some bit-for-bit things needed for the CESM2.2.0 release +Bring changes needed from release-clm5.0.31-34 to trunk. ndep change. +Brings in some changes for PtVg datasets for no-anthro compset. +Do some refactoring of Fire class so that it makes sense for FATES to use the base class. +Update RTM and MOSART with NUOPC changes and an update of a NetCDF-4 file to NetCDF-5 +needed for the cesm2.2.0 release. + +The 2010 finidat file is now set in the 2010_control use-case rather than relying on the +finidat dataset matching. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1087 -- wrong finidat file + Fixes #1096 -- failing tests + Fixes #1036 -- ne30 case fails + Fixes #946 --- better error message + Fixes #983 --- Fire method renames + Fixes #938 --- mscripgrid issue + +Known bugs found since the previous tag (include github issue ID): + #1098 -- ARCTICGRIS PE-layout is very slow... + #1097 -- xsmrpool_loss should only be written to the restart file if use_crop is true + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + if ndep file isn't found die with a warning rather than fatal error. + The warning allows you to override with CLM_BLDNML_OPTS="-ignore_warnings" + + finidat file matching will now use the sim_year rather than start-year + for a control case (transient cases used the start-year) + Add 2010 f09 finidat file for clm5_0_cam6.0 + +Changes made to namelist defaults (e.g., changed parameter values): + +Changes to the datasets (e.g., parameter, surface or initial files): + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: + Add clm45cam6LndTuningMode testmod + Some tests needed more wallclock + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (one test is different than ctsm1.0.dev105) + + python testing (see instructions in python/README.md; document testing done): + + cheyenne -= PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No (bit-for-bit) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): rtm, mosart + RTM to rtm1_0_72 + MOSART to mosart1_0_37 + +Pull Requests that document the changes (include PR ids): #1079 +(https://github.com/ESCOMP/ctsm/pull) + #1079 -- Bit-for-bit updates for the CESM2.2.0 release + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev105 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) / Chris Fischer +Date: Thu Jul 23 08:59:37 MDT 2020 +One-line Summary: Bring in some new SE grids for CAM as well as initial condition files for them + +Purpose of changes +------------------ + Add new SE (Spectral Element) grids: ne30np4.pg2, ne30np4.pg3, ne30np4, ne60np4, ne120np4, ne120np4.pg2, ne120np4.pg3, + ne0np4CONUS.ne30x8, ne0np4.ARCTIC.ne30x4, ne0np4.ARCTICGRIS.ne30x8 + Add new datasets for them, some new tests, and add support for their creation. + + Also add some new initial condition (IC) files for 1979, 2000, and 2013 for use when coupled to CAM + + The process for picking initial condition files was improved so that there can be more than one year that matches + and it will do the best to pick the best match. Also added the possibility for 1982 and 2013 simulation years for + specific grid matches. + + Also update cime to a newer version that supports these new grids. And update CMEPS (and hence add in fox, CDEPS) + to latest used on the nuopc_dev branch. Testing with nuopc wouldn't work without this update. The cime version updates + the tables for dry-deposition and changes answers for dry-deposition when it's turned on. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #992 #994 + Fixes #992 -- New initial conditions for 1979, 2000 + Fixes #994 -- New CAM SE grids + Fixes #888 -- Add support for various "physics grids" needed by CAM +CIME Issues fixed (include issue #): #3593, #3569, #3564, PR#3557 + cime/#3593 -- Fix mapping files for new grids + cime/#3569 -- Fix cime regression testing + cime/#3564 -- Change alias for arctic grids + cime/#3557 -- updates to dry deposition data (PR) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + Initial conditions (IC) for 1979 start date is technically 1982 + New initial condition files are ONLY for when coupled to CAM (B and F compsets) + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Allow for new grids + User updates to cime: + - Allow a user supplied config_grids.xml file. + - Improved error message for incorrect setting of cime model. + +Changes made to namelist defaults (e.g., changed parameter values): Add IC files for 1982 and 2013 years + +Changes to the datasets (e.g., parameter, surface or initial files): New SE grid datasets + Remove conus_30_x8 grid (previous name for new ne0np4CONUS.ne30x8 grid + Add new grids: ne30np4.pg2, ne30np4.pg3, ne30np4, ne60np4, ne120np4, ne120np4.pg2, ne120np4.pg3, + ne0np4CONUS.ne30x8, ne0np4.ARCTIC.ne30x4, ne0np4.ARCTICGRIS.ne30x8 + Add new mask: tx0.1v3 + New IC files: 1982 for ARCTIC and ARCTICGRIS, ne120np4 for 2000 and 2013 for CONUS all when coupled to CAM + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Initial condition picking will pick the file it finds with the closet simulation year to the request + for the lnd_tuning_mode desired. It will pick based on year over an exact match in resolution. + You can get around this by setting use_init_interp to be specific for a resolution + + Also realized that there is a dependence between the namelist_defaults_ctsm.xml file and namelist_defaults_overall.xml + for the clm_start_type item. It must be coordinated with use_init_interp, init_interp_attributes and finidat + to work properly. I added a comment about this. We should probably just move them into the same file. + +Changes to tests or testing: Added tests for new grids + +Code reviewed by: self, fischer-ncar, adamrher + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - OK (130 tests fail comparison to previous verison due to new IC files) + + tools-tests (test/tools): + + izumi - OK + + PTCLM testing (tools/shared/PTCLM/test): + + izumi - OK + + python testing (see instructions in python/README.md; document testing done): + + izumi -- PASS + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit (unless running with CAM because of new finidat files) + Running with nuopc changes answers because of updates to nuopc drivers + Dry-deposition changes answers when turned on (but doesn't effect anything else) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cmeps, cdeps, fox + cime updated to cime5.8.28 (from branch_tags/cime5.8.24_a01) + fox, and cdeps added in + cmeps, cdeps and fox updated to hashes used in the nuopc_dev branch of CESM + +Pull Requests that document the changes (include PR ids): #1038 +(https://github.com/ESCOMP/ctsm/pull) + #1038 -- New fsufdat and landuse time series files for ne grids + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev104 +Originator(s): sacks (Bill Sacks) +Date: Mon Jul 6 09:58:15 MDT 2020 +One-line Summary: Add LILAC + +Purpose of changes +------------------ + +Add LILAC: The Lightweight Infrastructure for Land-Atmosphere +Coupling. This infrastructure consists of two major pieces: + +(1) A lightweight coupling infrastructure built on top of ESMF that + makes it easier for atmosphere models to call CTSM directly, rather + than using the hub-and-spoke architecture that is used by CESM. + +(2) A set of python-based tools for building CTSM and creating its + runtime inputs when running in an atmosphere model via + LILAC. Although these tools are built on top of cime, details of the + create_newcase / case.setup / case.build process are hidden from the + user, because many of the aspects of this workflow don't make sense + in the LILAC context. + +So far we have used LILAC to couple CTSM to WRF. There are plans to use +the same infrastructure to couple CTSM to other regional atmosphere +models. + +Documentation of LILAC is provided in +https://escomp.github.io/ctsm-docs/versions/master/html/lilac/index.html +(though there are still some missing sections), as well as in various +presentations on the wiki +(https://github.com/ESCOMP/CTSM/wiki/Presentations). + +There have been many contributors besides myself to the development, +testing and documentation of LILAC; chief among them being Mariana +Vertenstein, Negin Sobhani, Joe Hamman, Sam Levis, Mike Barlage and Dave +Lawrence. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- See issues in the Done column of https://github.com/ESCOMP/CTSM/projects/23 + +Known bugs introduced in this tag (include github issue ID): +- Although LILAC is working to first order, there is still some work to +do. See outstanding issues in https://github.com/ESCOMP/CTSM/projects/23 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- dtime no longer specified on the namelist: just obtained from driver + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Added LILACSMOKE test + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - ok + + Baseline comparisons fail as expected. One test failed, but it also + failed for me on master (https://github.com/ESCOMP/CTSM/issues/1074) + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - pass on my mac + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1068 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev103 +Originator(s): slevis (Samuel Levis, SLevis Consulting LLC,303-665-1310) +Date: Mon Jun 29 17:16:29 MDT 2020 +One-line Summary: Gridcell-level balance-check for methane (CH4) + +Purpose of changes +------------------ + + Bracket the model time-step loop to calculate balance checks at the + gridcell level, as detailed in issue #315. The column-level check + remains unchanged. + + Subroutine ch4_init_balance_check is replaced with + ch4_init_column_balance_check. Subroutine + ch4_init_gridcell_balance_check is added. + + The implementation is similar to the one for carbon and nitrogen (see + tag ctsm1.0.dev096). + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #315 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + None + +Changes made to namelist defaults (e.g., changed parameter values): + None + +Changes to the datasets (e.g., parameter, surface or initial files): + None + +Substantial timing or memory changes: + No + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + None + +Changes to tests or testing: + None + +Code reviewed by: + @billsacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + None + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/CTSM/pull/1022 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev102 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Fri Jun 26 01:32:04 MDT 2020 +One-line Summary: Some important fixes for LUNA in clm5_0, and small urban issue in clm5_0 + +Purpose of changes +------------------ + +Fix some important issues that were found in LUNA for the arctic. These changes were large enough +that we had to re-tune the clm5_0 parameters to give a similar simulation. Leah Birch noticed +that the formulations in the code disagreed with the paper. Correcting this caused arctic plants +to be less productive. In order to compensate parameters for leafcn, and slatop were adjusted for +broadleaf_deciduous_boreal_shrub and c3_arctic_grass for clm5_0. + +The total vegetation carbon threshold on exit_spinup (from accelerated decomposition (AD) mode) was +increased from 0.1 to 1.0. Without this change some PFT's can die out in exit spinup even when +they have significant carbon stores from the AD spinup mode. + +There is an implicit assumption in the urban building energy model that building width equals +street width. However, this assumption can/should be relaxed and building width can be derived +from the morphology dataset. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #738 #803 #953 #958 #1056 + Fixes #1056 -- Remove allpfts dimension + Fixes #953 -- Incorrect formula in LUNA uses day time rather than average of day/night + Fixes #958 -- LUNA day length factor missing + Fixes #738 -- Totvegc threshold increased from 0.1 to 1. + Fixes #803 -- No longer assume building width + +Known bugs introduced in this tag (include github issue ID): #1060 + #1060 -- Some code cleanup of luna bug fixes + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[x] clm5_0 + +[x] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): clm5_0 climate adjusted for arctic plants + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): + +Changes to the datasets (e.g., parameter, surface or initial files): New parameter files + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): We + chose some bad names for variables, so we'll clean this up in a seperate step (see #1060) + +Changes to tests or testing: None + +Code reviewed by: self, olyson, bill-sacks, wweider + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (266 compare differently because of update in paramsfile and jmaxb1) + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes for clm5_0 (important change required retuning) + + Summarize any changes to answers, i.e., + - what code configurations: clm5_0 when Luna on as well as smaller changes for urban + - what platforms/compilers: all + - nature of change: climate changing, but tuned to respond similar to clm5.0 + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + luna changes: oleson case clm50_ctsm10d089_2deg_GSWP3V1_luna3_jmaxb1-0.17_slatopA_leafcnA_hist + + URL for LMWG diagnostics output used to validate new climate: + + urban changes: + + +http://webext.cgd.ucar.edu/I2000/clm50_ctsm10d098_1deg_GSWP3V1_CON_FIXBUILDENERGY_2000/lnd/clm50_ctsm10d098_1deg_GSWP3V1_CON_FIXBUILDENERGY_2000.1991_2010-clm50_ctsm10d098_1deg_GSWP3V1_CON_2000.1991_2010/setsIndex.html + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #1034 and #962 +(https://github.com/ESCOMP/ctsm/pull) + #1034 -- Building energy fix + #962 --- Fixes for the LUNA dayl bugs + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev101 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326), oleson (Keith Oleson) +Date: Wed Jun 17 23:51:22 MDT 2020 +One-line Summary: Changes from Keith to bring a list of variables to the parameter file + +Purpose of changes +------------------ + +Change some hardcoded parameters to go on the parameter files. This is needed in preparation +of running the Perturbed Parameter Ensemble. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #995 #138, #206 + +Fixes #995 -- Soil turnover times are on paramfile and hardcoded +Fixes #138 -- use tau_ values on paramfile +Fixes #206 -- add prh30 to paramfile +Some work on #290 -- LUNA refactoring + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): paramfile for both clm4_5 and clm5_0 + Add 51 new parameters to the paramsfile: + bsw_adjustfactor,cpha,csol_clay,csol_om,csol_sand,denitrif_nitrateconc_coefficient,denitrif_nitrateconc_exponent, + denitrif_respiration_coefficient,denitrif_respiration_exponent,drift_gs,e_ice,enzyme_turnover_daily,eta0_anderson, + eta0_vionnet,fnps,hksat_adjustfactor,ignition_efficiency,jmaxb0,jmaxha,jmaxhd,kcha,koha,kp25ratio,lmrha,lmrhd, + lmrse,luna_theta_cj,minrelh,n_baseflow,pd,perched_baseflow_scalar,prh30,relhExp,ssi,sucsat_adjustfactor,theta_cj, + theta_ip,theta_psii,tpuha,tpuhd,tkd_clay,tkd_om,tkd_sand,tkm_om,tpu25ratio,vcmaxha,vcmaxhd,watsat_adjustfactor, + wc2wjb0,wimp,wind_min + k_nitr_max removed and replaced with k_nitr_max_perday + meta-data for the tau_* variables changed, and a roundoff difference in the clm4_5 paramfile + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): prh30 not used for clm4_5 + prh30 was added in but won't be used for the CNFireLi2014 formulation. + It's only used for the clm5_0 and following formulations + +Changes to tests or testing: None + +Code reviewed by: self, oleson + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (170 tests differ from baseline because of new paramfiles) + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #1039 +(https://github.com/ESCOMP/ctsm/pull) + #1039 -- move hardcoded parameters to paramfile + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev100 +Originator(s): sacks (Bill Sacks) +Date: Tue Jun 9 06:15:15 MDT 2020 +One-line Summary: Deallocate memory after running init_interp + +Purpose of changes +------------------ + +Many of the pointer arrays in init_interp were not being deallocated +when init_interp finished. This was a particular problem because some of +these arrays were allocated for the full global source grid on each +processor, so the memory use was significant. This tag fixes this issue. + +This issue is documented in https://github.com/ESCOMP/CTSM/issues/1010 +and https://github.com/ESCOMP/CTSM/issues/1032. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1032 (Memory isn't deallocated in some of the + init_interp code) + +Known bugs found since the previous tag (include github issue ID): +- This does NOT resolve ESCOMP/CTSM#1010 (WACCMX test fails with + ctsm1.0.dev093 in cesm2_2_alpha05c), even though that was the original + hope. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none +- The initial run of the PFS test showed a very long time taken in + initialization. However, it appears that this was a system issue: + rerunning twice showed times back to normal. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - pass (on my mac) + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + + Most testing was done on f332fafc. After that, I made a minor change + that was needed for the unit tests to pass. I then reran (1) + clm_short on cheyenne, and (2) this subset of the test list on + izumi: + + SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop + SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop + PEM_Ld1.f10_f10_musgs.I2000Clm50BgcCropGs.izumi_intel.clm-crop + SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_intel.clm-crop + SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.izumi_nag.clm-monthly + ERP_Ld5_P48x1.f10_f10_musgs.I1850Clm50Bgc.izumi_nag.clm-default + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev099 +Originator(s): sacks (Bill Sacks) +Date: Mon Jun 8 09:29:38 MDT 2020 +One-line Summary: Update cime, needed for izumi machine updates + +Purpose of changes +------------------ + +Update cime. The most important change here is an update for izumi, +which is needed for the recent izumi machine updates. + +Also: Change izumi PEM test to use SGLC (after the machine updates, the +PEM test was failing; see also +https://github.com/ESCOMP/CTSM/issues/840). + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not investigated; none expected + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Changed izumi PEM test to use SGLC (after the machine updates, the PEM +test was failing; see also https://github.com/ESCOMP/CTSM/issues/840). + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- ok + + izumi: tests pass, some baselines fail as expected + + ERP_D_Ld3.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-prescribed + showed differences from the stored baselines, but it appears that + the stored baselines were incorrect: when I reran this test from + master, the master version differed from the stored baselines and + was identical to this branch. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, just on izumi due to machine updates + + Summarize any changes to answers, i.e., + - what code configurations: some izumi tests + - what platforms/compilers: izumi gnu & pgi + - nature of change (roundoff; larger than roundoff/same climate; new climate): + not investigated; expected to be roundoff + + Answer changes were observed in these tests: + - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_gnu.clm-crop + - SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + - SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: branch_tags/cime5.8.23_a01 -> branch_tags/cime5.8.24_a01 + Point to a cime branch tag that is equivalent to cime5.8.24 but uses + pio1 rather than pio2, even for mpi-serial cases (the changes in + branch_tags/cime5.8.24_a01 relative to cime5.8.24 are equivalent to the + changes in branch_tags/cime5.8.23_a01 relative to cime5.8.23). + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev098 +Originator(s): John Truesdale,UCAR/AMP,303-497-1386 +Date: Thu May 28 14:39:27 MDT 2020 +One-line Summary: Bring in GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 + +Purpose of changes +------------------ + +Add support for new GFDL fv3 curbed sphere grids. Low resolution C24, and C48 +Moderate resolution C96, and high resolution C192 and C384. Add in mapping files +so all can be created. Make C96 a default resolution created with new surface +datasets. For all of these only the crop versions of surface and landuse.timeseries +are in place, as non-crop can run in CLM without needing different datasets. Also for +historical landuse.timeseries we use the SSP5-8.5 timeseries files, so that it can be +used for future, historical and beyond 2015 present day. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #1025 + Fixes #1025 -- By default only create crop version of surface/landuse.timeseries datasets + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): New surface and landuse.timeseries files + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: Add C96 tests + +Code reviewed by: @ekluzek + +CTSM testing: regular, tools + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (15 new tests for new resolutions) + + tools-tests (test/tools): + + cheyenne - OK + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - PASS (cheyenne) + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #891 +(https://github.com/ESCOMP/ctsm/pull) + + #891 -- add definitions/defaults for GFDL fv3 cubed sphere grids C24, C48, C96, C192, C384 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev097 +Originator(s): ycheng (Yanyan Cheng); final changes & testing by Bill Sacks +Date: Mon May 25 15:14:56 MDT 2020 +One-line Summary: Add two bioenergy crops (switchgrass and miscanthus) + +Purpose of changes +------------------ + +Main change is from Yanyan Cheng: adding parameters and code for two +bioenergy crops, switchgrass and miscanthus. Along with this, there is a +new potential flux from crop leaves and stems to the crop product pool +at harvest, representing biofuel products; a new pft-specific parameter +controls this flux (biofuel_harvfrac). Currently, the out-of-the-box +surface datasets do not specify any area for these crops, but the new +parameter file will allow them to be present if specified on the surface +dataset or landuse_timeseries file. Note that this is only an option for +CLM5.0, NOT for CLM4.5. (See https://github.com/ESCOMP/CTSM/pull/884 for +details.) + +Also, some minor fixes from Bill Sacks: See notes under "bugs fixed" +below. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#203 - Fixes creation of harvest-related variables + on surface datasets created with the all_veg option - smallville, + PTCLM, etc. (documented in https://github.com/ESCOMP/CTSM/pull/1019) +- Resolves ESCOMP/CTSM#930 - Makes gindex_ocn intent(inout) rather than + intent(out) +- Resolves ESCOMP/CTSM#1021 - Changes SSP test to only do symlink if + needed + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- For transient crop cases, now more crops in memory. This creates a + need for interpolation of initial conditions for initial conditions + generated from a transient case. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): +- Changed parameter values for switchgrass and miscanthus (only for clm5.0) +- New pft-specific parameter, biofuel_harvfrac (for both clm4.5 and clm5.0) + +Changes to the datasets (e.g., parameter, surface or initial files): +- New parameter files with the above changes + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Changed smallville ERS_Lm20 test to be cold start (see comment in + commit 8368f222 for details) +- Added a multi-year smallville test that includes these new crops + +Code reviewed by: Bill Sacks, Danica Lombardozzi + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - ok + + Pass except for expected baseline failures + + Ran on 633be0eb, with comparison against ctsm1.0.dev095; tests pass + except these expected baseline failures: + + 030 blf84 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools ....................\c + rc=7 FAIL + + 032 blfc4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools ..............\c + rc=7 FAIL + + Diffs for these are just in the harvest-related fields on the surface dataset, as expected. + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + + For cheyenne testing: a few tests had baseline failures. The + differences just arise in the h1 (vector) files, due to differences + in dimension sizes. These differences are expected. See below for + details. + + Ran most testing on 8309c213. Reran two SSP tests on 4665c9ce + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but diagnostic only due to +change in dimension sizes - does not change answers in any meaningful +way + + Summarize any changes to answers, i.e., + - what code configurations: Transient CLM50 cases with crops; just + changes dimensions on vector (h1) history files + - what platforms/compilers: All + - nature of change (roundoff; larger than roundoff/same climate; new climate): + diagnostic change only + + Differences were observed in the following tests: + + ERS_Ly3_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropQianGs.cheyenne_gnu.clm-cropMonthOutput + SMS_Ld5.f10_f10_musgs.ISSP245Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start + SMS_Ld5.f10_f10_musgs.ISSP370Clm50BgcCrop.cheyenne_gnu.clm-ciso_dec2050Start + ERP_D_Ld10_P36x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_decStart + ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive + ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput + ERS_D_Ld7_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_intel.clm-decStart1851_noinitial + ERS_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput + ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput + ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropQianGs.cheyenne_intel.clm-cropMonthOutput + LCISO_Lm13.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_monthly + SMS_Ld5.f10_f10_musgs.ISSP585Clm50BgcCrop.cheyenne_intel.clm-ciso_dec2050Start + + The differences just arise in the h1 files, due to differences in + dimension sizes. I reran these tests with a paramfile where I + reverted the mergeToPft variable; then they were all bfb with + master. + + Other than this, there were FIELDLIST differences, as expected. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/CTSM/pull/884 +- https://github.com/ESCOMP/CTSM/pull/1019 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev096 +Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) +Date: Thu May 21 19:18:24 MDT 2020 +One-line Summary: Gridcell-level balance checks for carbon and nitrogen + +Purpose of changes +------------------ + + Bracket the model's time-step loop to calculate balance checks at the + gridcell level because there are terms in the carbon and nitrogen + cycles not accounted for at the column level. Balance checks at the + column level remain unchanged for now. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #314 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: + @billsacks + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/CTSM/pull/984 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev095 +Originator(s): sacks (Bill Sacks) +Date: Thu May 21 10:25:16 MDT 2020 +One-line Summary: Update cime and cmeps externals; rework initialization of CNFire object + +Purpose of changes +------------------ + +Main change is to update cime and cmeps externals. cime is now +essentially at the version used in cesm2_2_beta05 (but with one change +backed out); cmeps is at latest master. + +Also, reworks initialization of CNFire object to avoid occasional +segmentation faults. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1018 (Occasional seg faults when initializing + CNFire object) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none +- Note: Because of a change in cime, datm now uses netcdf rather than + pnetcdf, but it doesn't seem that that impacts performance + significantly + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + + cheyenne tests pass; some answer changes as expected (as noted below) + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: + - cheyenne_gnu - due to compiler version update + - nuopc - presumably due to the major cmeps update + - what platforms/compilers: see above + - nature of change (roundoff; larger than roundoff/same climate; new climate): + - Not investigated + + I have verified that gnu tests in 59d1dd4a are identical to those + in dcaad375 - i.e., the rework of the initialization logic for fire + didn't change answers + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: cime5.8.19 -> branch_tags/cime5.8.23_a01 + (same as cime5.8.23, but reverts to using pio1 for mpi-serial cases, + since some mpi-serial cases failed with pio2) +- cmeps + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev094 +Originator(s): sacks (Bill Sacks) +Date: Fri May 15 13:41:01 MDT 2020 +One-line Summary: Minor bug fixes needed for latest cime + +Purpose of changes +------------------ + +(1) Refactor a conditional to avoid divide by 0 (ESCOMP/CTSM#1013) + +(2) Remove some FATES coordinate variables that were writing garbage + (temporary workaround for ESCOMP/CTSM#1014) + +(3) Minor update to manage_externals + +(4) Document authorship in README.md and .zenodo.json + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1013 +- Workaround for ESCOMP/CTSM#1014, but doesn't properly resolve that issue + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not checked; none expected + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/1006 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev093 +Originator(s): erik (Erik Kluzek) +Date: Fri May 1 22:27:16 MDT 2020 +One-line Summary: Bring in changes from release-clm5.0 branch to master + +Purpose of changes +------------------ + +Move changes from release-clm5.0.12.13/14/16/17/18/20/21/22/23/24/25/26/27/28/29/30 to master +(note excludes release-clm5.0.15, release-clm5.0.19) + +Answer changing! +Updates FATES with PARTEH option. + +Remove CRUNCEP half degree, ne120np4, f05 surface datasets +Landuse-timeseries files for just: f09, f19, f10, ne30np4, 1x1_numaIA, 1x1_smallvilleIA, 1x1_brazil +Add datasets needed for SSP scenarios (only Tier I for ndep). Add ZWT_inversion dataset for methane. + +Add new ability to use prescribed soil moisture data (from streams files based on an earlier CTSM simulation). + +Add new MODISv2 mapping files for mksurfdata_map. Remove T5 and T21 mapping files. Add conus_30_x8 mapping files, +and T62 mapping files + +Add contrib directory to tools with contributed tools and scripts. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): 31 issues.... + #873 -- Release clm5.0.12 changes + #871 -- don't check for valid resolution for CESM cases by default + #836 -- add izumi as a place that can run tools tests + #831 -- add namelist tint_algo settings for input streams + #817 -- Have clm4_5 use the same ndep file as clm5_0 for 1850 + #809 -- mkmapdata using an old version of intel + #804 -- mksurfdata option + #791 -- fix threading for prescribed LAI and soil-moisture + #786 -- allow use_init_interp for a branch + #746 -- Some CLM45 configurations use CLM50 initial conditions files + #741 -- C13_HR, C13_NBP, FPI values result in numeric conversion not representable error (changes answers) + #734 -- Isotope historical files off of NetCDF-4 + #716 -- 2 degree CMIP6WACCMDECK needs Carbon isotopes off + #707 -- Missing mapping files for hirespft + #673 -- Ice shelf wetland fix in mksurfdata_map can lead to glacier+lake > 100% on surface datasets (changes surface dataset creation) + #653 -- To save disk on fsurdat files use zwt0 on finindated file + #629 -- Remove unused fields from surface datasets + #624 -- QSNOEVAP history output incorrect + #621 -- Fully remove rcp in place of only ssp_rcp + #608 -- Odd (blocky) spatial patterns in generic crop leafc for BGC simulation when initialized from BGC-Crop (changes answers) + #589 -- Existence of content in the lai_streams namelist makes it confusing to users + #557 -- no-anthro compset and options + #553 -- More robust mksurfdata_map logic for determining where to put wetlands + #547 -- Add conus_30_x8 grid as valid option for CTSM and mksurfdata_map + #545 -- Antarctica ice shelves are being treated as wetlands rather than glaciers + #544 -- Transient cases are matching wrong IC file + #533 -- Add -no-anthro option to mksurfdata + #276 -- Tests for pre_alpha/pre_beta + #262 -- hirespft option to mksurfdata.pl + #175 -- Set stream_year_first_urbantv/last for CLM4.5 + #150 -- mksurfdata code cleanup + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): New surface datasets do mean initial conditions + will need to be interpolated + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Add 2010 compset option + New namelist items: ndep_tintalgo, lai_tintalgo, lightng_tintalgo, urbantv_tintalgo, dribble_crophrv_xsmrpool_2atm + New soil moisture namelist items: use_soil_moisture_streams, stream_year_first_soilm, stream_year_last_soilm, model_year_align_soilm, + model_year_align_soilm, soilm_tintalgo, soilm_offset, soilm_ignore_data_if_missing + New namelist items for FATES: fates_parteh_mode + New 2010, no-anthro, SSP use cases + New compsets: I2010Clm50Sp, I2000Clm50BgcCropQianGs, I1850Clm50BgcNoAnthro, I1850Clm50SpNoAnthro, IHistClm50SpCru, IHistClm50SpCru, + IHistClm45SpGs, IHistClm45SpGs + New SSP compsets: ISSP585Clm50BgcCrop, ISSP126Clm50BgcCrop, ISSP126Clm50BgcCrop, ISSP245Clm50BgcCrop, ISSP370Clm50BgcCrop, + ISSP434Clm50BgcCrop, ISSP460Clm50BgcCrop, ISSP460Clm50BgcCrop + LAI streams options don't show up in the namelist unless you ask for them + finundation comes from streams files, no longer from the surface dataset + FATES adds a list of new history variables and dimension types + +Changes made to namelist defaults (e.g., changed parameter values): New fsurdat files, SSP C13/C14 files + Add PtVg surface dataset + most finidat files now need to be interpolated, a few added in to get testing to work + New ndep datasets + +Changes to the datasets (e.g., parameter, surface or initial files): + New fsurdat files, finidat files need to be interpolated from now + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Threshold to reseed dead vegetation increased from zero to 1.0 as a hard coded parameter. + Reseeding also happens for generic crop types and not just natural vegetation now. + The ability to read in 3D streams was added (input files have to be at the same resolution as the model) + +Changes to tests or testing: + Add no-anthro, 2010, f19 waccm and SSP tests + Make sure prealpha/prebeta tests are also run by aux_clm + Add prescribed soil moisture test + Lengthen waccm_offline test + Remove hcru_hcru and edison tests + Add some aux_cime_baseline tests + +Code reviewed by: self + + +CTSM testing: regular, tools + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (345 are different than baseline) + + tools-tests (test/tools): + + cheyenne - OK + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - OK + + python testing (see instructions in python/README.md; document testing done): + + cheyennne -- PASS (when ncar_pylib run) + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes (small) + + Updates in all fsurdat files leads to changes in answers + Also there are updated finidat files as they had to be interpolated + to work with the new fsurdat files + Reseeding change can effect answers on startup if activated + Extra call to SoilBiogeochemPrecisionControl can cause a small answer change + + Summarize any changes to answers, i.e., + - what code configurations: all global + - what platforms/compilers: all + - nature of change: Main change is around Antarctica + + CMIP6 simulations and release branch simulations were run with these surface datasets + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): fates, PTCLM + + fates to sci.1.30.0_api.8.0.0 + PTCLM to PTCLM2_20200121 + + FATES now points to the NGEET repository rather than the NCAR fates-release + +Pull Requests that document the changes (include PR ids): #998, #883, #849, #567, #564, #561 +(https://github.com/ESCOMP/ctsm/pull) + #998 -- Remove Copyright file + #883 -- Bring changes on release-clm5.0 branch to master PR status: ready priority: high type: enhancement + #849 -- Fix link to new forums + #567 -- Ignore patterns for vim + #564 -- Update mksurfdata_map to include glaciers outside of pft landmask + #561 -- Add list of checks that should be done when making new surface datasets + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev092 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Mon Apr 27 14:51:21 MDT 2020 +One-line Summary: Update cime to version in cesm2_2_beta04 + +Purpose of changes +------------------ + +Update cime to latest in cesm2.2 beta tag (cesm2_2_beta04) +Fix two small issues that had gone on the release-clm5.0 branch. +Update manage_externals (to manic-v1.1.8) + +NOTE: Part of the reason for updating cime, was because of some problems +Mike Mills was having on cheyenne with inputdata files being deleted out +from under him before setting up his cases. We think system issues were +interacting with issues with cime putting in place zero length +missing files for the version of cime he was using. Those issues went +away with a cime update, so we hope updating to a newer cime version here +will help prevent those issues for CTSM users. + +cime updates: + +some cleanup from the last maint-5.6 update +Add ne5np4.pg4 grid. +case.setup: Add --keep option +Add omip as option to DATM_CO2_TSERIES + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #974 #966 + Fixes #974 -- python 3 problem in ssp test + Fixes #966 -- a few history fields need to be made CF compliant +CIME Issues fixed (include issue #): 3459 3466 + 3459 -- case.setup refuses to fix corrupted env_mach_specfic.xml + 3466 -- fix for aquap + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + ./case.setup now has a --keep option + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + tools-tests (test/tools): + + cheyenne - OK + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - OK + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + + +Answer changes +-------------- + +Changes answers relative to baseline: None bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime + cime to cime5.8.19 + (NOTE: CMEPS is pointing to a newer hash than used in the beta tag) + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + #996 -- Update cime to latest cesm2.2 beta tag + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev091 +Originator(s): sacks (Bill Sacks) +Date: Fri Apr 24 07:43:46 MDT 2020 +One-line Summary: Increase tolerance on near-zero truncation for a snow state update + +Purpose of changes +------------------ + +In UpdateState_TopLayerFluxes, the tolerance of 1.e-13 was occasionally +exceeded. Although I haven't done a careful analysis, it seems okay to +me to increase this tolerance slightly. Here I increase it to 1.e-12. + +Previously, if top-layer h2osoi_ice or h2osoi_liq were reduced to less +than 1e-13 times the original value (in an absolute value sense), these +masses were set to 0; now we set these masses to 0 if they are reduced +to less than 1e-12 times the original. So we can now occasionally set a +value to exactly 0 when before it was left at slightly different from +zero. If the previous code led to a small positive value, between 1e-13 +and 1e-12 times the original, this tag will change answers slightly. If +the previous code led to a small negative number, it would cause the +model to abort, leading to the issue reported in ESCOMP/CTSM#988; this +change should fix those occasional aborts. + +This tag also introduces the general ability to set tolerances to a +custom value in calls to truncate_small_values. + +See ESCOMP/CTSM#988 for details. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#988 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none expected (not checked) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, in theory (but none in test suite) + + Summarize any changes to answers, i.e., + - what code configurations: potentially all, but very rarely + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Roundoff + + Potentially changes answers by roundoff (see notes above), but no + changes were observed in any test in the test suite + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/989 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev090 +Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) +Date: Thu Apr 23 09:21:18 MDT 2020 +One-line Summary: Refactoring banded diagonal matrix and solve system in SoilTemperature module + +Purpose of changes +------------------ + +Previously, the SoilTemperature module has a high level of nested subroutine +calls, which hurt its performance and readability. There were many +redundancies, logical issues, and nested conditionals in the modular code +as discussed in issue #323. In this PR, SoilTemperature module is optimized +and rewritten for better readability and performance while maintaining bfb +compatibility. + + +This PR addresses issue ESCOMP/ctsm#323 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + -ESCOMP/ctsm#323 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: The revised code improved the +performance of the previous code by ~1.5-2x. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks + + +CTSM testing: + + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +Externals used for the testing: + [cism] + tag = cism2_1_68 + [rtm] + tag = rtm1_0_70 + [mosart] + tag = mosart1_0_35 + [cime] + tag = branch_tags/cime5.8.15_a01 + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/CTSM/pull/979) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev089 +Originator(s): sacks (Bill Sacks) +Date: Tue Apr 7 12:01:59 MDT 2020 +One-line Summary: Bring documentation source to master + +Purpose of changes +------------------ + +1. Bring documentation source to master: Pulls in the source from + https://github.com/escomp/ctsm-docs. This is important so that + documentation can remain in sync with changes in the model + code. Images are stored here using git-lfs (Git Large File + Storage). I also made some minor fixes to get the pdf build of the + tech note working. + +2. Use a different documentation theme that supports a version dropdown + menu, and add the code needed to support this versioning on the + documentation web pages. At a high level, the way the versioned + documentation works is to have separate subdirectories in the + gh-pages branch of the ctsm-docs repository for each version of the + documentation we want to support. There is then a bit of JavaScript + code which uses a json file in the gh-pages branch to determine which + versions exist and how these should be named in the dropdown + menu. Most of these changes were borrowed from ESMCI/cime#3439, which + in turn borrowed from ESCOMP/CISM-wrapper#23, which in turn was a + slight modification of an implementation provided by @mnlevy1981 for + the MARBL documentation, which in turn borrowed from an + implementation put together by Unidata (credit where credit is due). + + I am not aware of out-of-the-box support for a version pull-down in + out-of-the-box sphinx themes (though the last time I looked was in + Fall, 2018, so there may be something available now). However, + support for a version dropdown exists in an open PR in the sphinx + readthedocs theme repository: readthedocs/sphinx_rtd_theme#438. I + have pushed this branch to a new repository in ESMCI + (https://github.com/ESMCI/sphinx_rtd_theme) to facilitate long-term + maintenance of this branch in case it disappears from the official + sphinx_rtd_theme repository. I have also cherry-picked a commit onto + that branch, which is needed to fix search functionality in sphinx1.8 + (from readthedocs/sphinx_rtd_theme#672) (which is another reason for + maintaining our own copy of this branch). The branch in this + repository is now named version-dropdown-with-fixes (branching off of + the version-dropdown branch in the sphinx_rtd_theme repository). In + the long-term, I am a little concerned about using this theme that + isn't showing any signs of being merged to the main branch of the + readthedocs theme, but this has been working for us in other projects + for the last 2 years, so I feel this is a reasonable approach in the + short-medium term. + +The new process for building the documentation is given here: +https://github.com/ESCOMP/CTSM/wiki/Directions-for-editing-CLM-documentation-on-github-and-sphinx + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#239 (Move documentation source to master) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- not run! + izumi ------- not run! + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/954 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev088 +Originator(s): sacks (Bill Sacks) +Date: Tue Apr 7 10:43:03 MDT 2020 +One-line Summary: Fix bug in snow aerosol numerics (causes occasional HUGE aerosol values) + +Purpose of changes +------------------ + +Multiplications / divisions by dtime were missing in a few places, in +some code that ensures that aerosol mass fluxes between the snow layers +don't exceed the total mass. This bug was introduced in ctsm1.0.dev065, +when a term was changed from a mass to a flux (per unit time), but some +of the code wasn't changed correspondingly. + +In one case this bug caused a crash, but in other cases it just causes +incorrect answers. The issue can be seen by examining the history +variables SNOBCMCL, SNOOCMCL and SNODSTMCL. In the case that led to the +crash, SNOBCMCL and SNOOCMCL became huge in one grid cell (~ 10^12) for +a long period before the crash. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#965 (Bug in snow aerosol numerics can cause + aerosol masses to blow up, starting with ctsm1.0.dev065) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none (not checked, but none expected) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Erik Kluzek, Keith Oleson + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + + ok means tests pass, some answer changes as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (Small) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff/same climate + + Answer changes arise due to a bug fix for a condition that only + appears infrequently. When it does appear, answer changes can + potentially be enormous (e.g., snow aerosol concentrations 20 + orders of magnitude too large), though answer changes observed in + the test suite all appear relatively small. + + Answer changes just appeared for the following tests: + + FAIL ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm45BgcCrop.cheyenne_gnu.clm-no_subgrid_fluxes BASELINE ctsm1.0.dev087: DIFF + FAIL SMS_Ld1.nldas2_rnldas2_mnldas2.I2000Ctsm50NwpSpNldasGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev087: DIFF + FAIL SMS_Ld1.nldas2_rnldas2_mnldas2.I2000Ctsm50NwpSpNldasRsGs.cheyenne_gnu.clm-default BASELINE ctsm1.0.dev087: DIFF + FAIL ERI_D_Ld9.ne30_g16.I2000Clm50BgcCruGs.cheyenne_intel.clm-vrtlay BASELINE ctsm1.0.dev087: DIFF + FAIL ERI_D_Ld9.T31_g37.I2000Clm50Sp.cheyenne_intel.clm-SNICARFRC BASELINE ctsm1.0.dev087: DIFF + FAIL ERI_Ld9.f45_g37.I2000Clm50BgcCruGs.cheyenne_intel.clm-nofire BASELINE ctsm1.0.dev087: DIFF + FAIL ERI_N2_Ld9.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev087: DIFF + FAIL SMS_D_Lm6.f45_f45_mg37.I2000Clm50Fates.cheyenne_intel.clm-FatesColdDef BASELINE ctsm1.0.dev087: DIFF + FAIL SMS_D_Lm6_P144x1.f45_f45_mg37.I2000Clm50Fates.cheyenne_intel.clm-FatesColdDef BASELINE ctsm1.0.dev087: DIFF + FAIL SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev087: DIFF + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/971 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev087 +Originator(s): sacks (Bill Sacks) +Date: Mon Apr 6 11:23:51 MDT 2020 +One-line Summary: Change hard-coded soil layers in phenology to use a target depth + +Purpose of changes +------------------ + +Adds infrastructure for finding the soil layer containing a given depth +(covered by unit tests). + +In phenology code, replaces hard-coded level 3 with a target soil +depth. This value is read from the parameter file. The default value is +set in a way that is bit-for-bit for standard CLM45 and CLM50 +configurations, but this will change answers for non-SP configurations +using the NWP soil layer structure or non-standard soil layer +structures. + +This is important for the sake of supporting flexible soil layers, as in +the NWP configuration. + +Also, some cleanup of the CNPhenology parameter reading code. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#952 (Change hard coded soil layers in phenology + to use a target depth) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[X] ctsm5_0-nwp -- only for non-SP cases + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): +- New parameter added to NetCDF parameter file: phenology_soil_depth + +Substantial timing or memory changes: none expected (not checked) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + + ok means tests pass, a few answer changes as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes (only Non-SP cases with NWP) + + Summarize any changes to answers, i.e., + - what code configurations: Non-SP cases with NWP or non-standard + soil layer structures + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff; same vs. new climate not investigated + + Differences in non-SP cases with soil layer structure different + from that of standard clm45 or clm50. Differences observed in + tests + ERS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_intel.clm-deepsoil_bedrock + and + SOILSTRUCTUD_Ld5.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-default. + + ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Ctsm50NwpBgcCropGswpGs.cheyenne_intel.clm-default + had no differences; I'm guessing this is just because there didn't + happen to be the appropriate PFTs present to show differences in + this short, coarse-resolution test. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/963 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev086 +Originator(s): mvertens (Mariana Vertenstein) +Date: Thu Mar 19 16:03:26 MDT 2020 +One-line Summary: Updates to NUOPC cap and minor fixes to ncdio_pio + +Purpose of changes +------------------ + +This tag has updates to the NUOPC cap that are needed for the latest +version of CMEPS. + +Now each component NUOPC cap needs to compute possibly time varying +orbital parameters. Before, in cpl7, this was done in the driver and +passed to the components via seq_infodata. However, now the driver is +really just a simple ascii file - so those calculations needed to +migrate to the component caps. + +In addition, this tag contains changes to ncdio_pio.F90 that improve +performance in some situations. + +This also updates MOSART and RTM tags to include fixes for the NUOPC cap +for MOSART and implementation of an initial NUOPC cap for RTM. + +Also, I1Pt compsets now use SROF rather than using an active runoff +model in 'null' mode. This leads to differences in namelists, but not in +results. + +Mariana Vertenstein implemented most of the changes in this tag; Jim +Edwards implemented the ncdio_pio changes; Bill Sacks did final testing +and integration. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#943 (NUOPC tests will fail in ctsm1.0.dev085) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- I1Pt tests and cases now use SROF rather than an active runoff model + with a null grid (only impacts namelists, not results) +- Changed nuopc test to use MOSART rather than SROF +- Changed finidat file used by LII test to solve a problem that was + uncovered with the ncdio_pio changes in this tag + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (just for NUOPC configurations) + + Summarize any changes to answers, i.e., + - what code configurations: Just some NUOPC configurations + - what platforms/compilers: + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Not investigated carefully, but likely to be larger than roundoff + / same climate (due to introduction of time-varying orbital parameters) + + Differences are expected in NUOPC configurations using time-varying + orbital parameters. Note that no differences showed up in the test + suite, however, because the only nuopc test in the test suite is + new in this tag (so did not have baselines). + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- mosart: mosart1_0_35 -> mosart1_0_36 +- rtm: rtm1_0_70 -> rtm1_0_71 +- cmeps + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/issues/943 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev085 +Originator(s): sacks (Bill Sacks) +Date: Mon Mar 16 09:19:57 MDT 2020 +One-line Summary: Update cime + +Purpose of changes +------------------ + +Update to latest version of cime master + +Bugs fixed or introduced +------------------------ + +Known bugs introduced in this tag (include github issue ID): +- https://github.com/ESCOMP/CTSM/issues/943 - NUOPC tests will fail in ctsm1.0.dev085 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- NUOPC cases will fail from a standalone checkout + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + + Two test failures: + + PEND SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default SHAREDLIB_BUILD + I have added this to the expected fails list for now + FAIL SMS_P720x1_Ln6.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart BASELINE ctsm1.0.dev084: ERROR BFAIL baseline directory '/glade/p/cgd/tss/ctsm_baselines/ctsm1.0.dev084/SMS_P720x1_Ln6.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStart' does not exist + This test was added in the previous tag, but apparently wasn't run from there + + Note: I did testing using cime hash + 4f1880756a66ff12d304937d3c166d451ea50cf9, then updated to the tag + (cime5.8.17). The two are identical except for the cime ChangeLog. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +cime: branch_tags/cime5.8.15_a01 -> cime5.8.17 + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev084 +Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) +Date: Wed Feb 19 15:05:03 MST 2020 +One-line Summary: Bounds assertion for C isotopes when threading is on + +Purpose of changes +------------------ + +Previously, the bounds of c13 and c14 in subroutines TruncateCStates and +TruncateCandNStates were not checked when threading was on. This PR allows us +to handle c13 and c14 arrays like everything else in CTSM including (bounds +checking). + +This PR resolves issue ESCOMP/ctsm#811 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + -ESCOMP/ctsm#811 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: + - There was an issue (wrong wallclock time ) for one of the tests in the test + definitions which got fixed: (SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs..) + - Also, I tried making the wallclocktime for all tests in + cime_config/testdefs/testlist_clm.xml consistent in the format of hh:mm:ss. + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/CTSM/pull/923) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev083 +Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) +Date: Thu Feb 6 12:12:26 MST 2020 +One-line Summary: Some BFB Fixes: Resolve issues #683, # 874, #878, # 885, # 745, #838 + +Purpose of changes +------------------ + +Resolved issues: + +ESCOMP/ctsm#683 : Writing out FATES parameters only on masterproc. +ESCOMP/ctsm#874 : Changing the number of timesteps to run for + SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStar + to prevent failing with CMEPS. +ESCOMP/ctsm#878 : Removing the unused atm2lnd field. +ESCOMP/ctsm#885 : Changing the defaults for br_root in namelist_defaults to + enable FUN with CLM4.5. +ESCOMP/ctsm#745 : Removing ReadNL private subroutine from initVerticalMod.F90. +ESCOMP/ctsm#838 : Clarifying ZISNO in the variable long name. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +Resolves : + - ESCOMP/ctsm#683 + - ESCOMP/ctsm#874 + - ESCOMP/ctsm#878 + - ESCOMP/ctsm#885 + - ESCOMP/ctsm#745 + - ESCOMP/ctsm#838 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): + Not any changes in parameter values. + changing the default for br_root in namelist_defaults to enable FUN with + CLM4.5. + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: + Changed the number of timesteps from Ln3 to Ln6 for + SMS_P720x1_Ln3.hcru_hcru.I2000Clm50BgcCruGs.cheyenne_intel.clm-coldStar + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/897 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev082 +Originator(s): oleson (Keith Oleson) +Date: Sat Feb 1 09:28:41 MST 2020 +One-line Summary: Rename variables to avoid confusion; fix QSNOEVAP diagnostic + +Purpose of changes +------------------ + +Renamed variables as discussed in ESCOMP/ctsm#118 throughout the code. + +Also made a couple of minor changes to fix a couple of potential +problems with these variables as described in the branch commit logs. + +Tested for bfb before changing the history field variables +themselves. These changes are all bfb (with the exception of QSNOEVAP) +for a 1 month global 2deg simulation, but may not be bfb under all +conditions. QSNOEVAP is not bfb because I've added in qflx_ev_snow for +lakes. + +Also, update cime slightly with a fix for izumi machine updates + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#118 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none expected (not checked) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok: tests pass, answer changes in QSNOEVAP but nothing else (as expected) + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (only one diagnostic field) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + Larger than roundoff, but only in the diagnostic field QSNOEVAP + + Possibility of other answer changes in rare circumstances, not + observed in testing. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: cime5.8.15 -> branch_tags/cime5.8.15_a01 + Minor update for izumi machine changes + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/893 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev081 +Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) +Date: Mon Jan 13 15:37:07 MST 2020 +One-line Summary: Speed up restart writes + +Purpose of changes +------------------ + + E3SM#3163 made some changes to speed up restart writes. I use E3SM#3163 + function GetGlobalIndexArray in place of GetGlobalIndex so as to get + global indices by array rather than looping over every element. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #801 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: Limited testing did not show substantial timing changes + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: + @billsacks + @bishtgautam + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No + + @billsacks recommended running a global test in the branch vs. in master (i.e. + with vs. without the code mods) to compare restart files because the test suite + does not compare restart files and an error in the subgrid indices on the + restart file might go undetected. I ran this test: + ERS_D_Ld6.f10_f10_musgs.I1850Clm45BgcCrop.cheyenne_intel.clm-clm50CMIP6frc + and got identical values for all variables in the two restart files. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/ctsm/pull/880 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev080 +Originator(s): sacks (Bill Sacks) +Date: Mon Dec 2 12:23:22 MST 2019 +One-line Summary: Update externals, minor fixes to work with latest cime, get nuopc cap working + +Purpose of changes +------------------ + +(1) Update to latest version of externals. This includes a significant + cime update. + +(2) Minor fixes to get things working with the latest version of cime. + +(3) Fix from Mariana Vertenstein to get NUOPC cap working, fixes to + externals cfg files to allow running NUOPC cases out of the box, and + add a NUOPC test. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): +CIME update brings in some changes, e.g., in mapping files; otherwise, none. + +Substantial timing or memory changes: not investigated + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Added NUOPC test: + SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests passed, some baseline comparisons failed as expected + + Note: Most testing was done on ad1ad752; then, from the latest + version, I ran a 2-test test list of: + - SMS_D_Vnuopc.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default + - SMS_D.f10_f10_musgs.I2000Clm50SpRsGs.cheyenne_intel.clm-default + + In addition to verifying that the above tests passed, I also + inspected the sharedlib build area to verify that separate builds of + the clm library were done for mct and nuopc. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: +- cheyenne tests compared against ctsm1.0.dev078, since cheyenne testing +was not run on ctsm1.0.dev079. + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (only f10, same climate) + + Summarize any changes to answers, i.e., + - what code configurations: Cases at f10 resolution + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Larger than roundoff, but probably same climate + + Answer changes are due to https://github.com/esmci/cime/pull/3186 + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: branch_tags/cime5.8.3_chint17-05 -> cime5.8.15 +- rtm: rtm1_0_68 -> rtm1_0_70 +- mosart: mosart1_0_34 -> mosart1_0_35 +- cmeps: 471ac52 -> 181ff1ed9dfb279e619e8a2173f43baf7bf1dce3 + Also, note that cmeps is now checked out automatically + + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/845 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev079 +Originator(s): sacks (Bill Sacks) +Date: Mon Nov 4 14:41:41 MST 2019 +One-line Summary: Change a few uses of shr_kind + +Purpose of changes +------------------ + +Change a few uses of shr_kind to work with latest cime. These changes +are from Mariana Vertenstein. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- NOT RUN! + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev078 +Originator(s): oleson (Keith Oleson) +Date: Thu Oct 31 12:30:00 MDT 2019 +One-line Summary: Fix rootr calculation with use_hydrstress true + +Purpose of changes +------------------ + +In cases with use_hydrstress=.true., both rootr_patch and rootr_col had +problems. This affected the diagnostic fields ROOTR and ROOTR_COLUMN, +and (in BGC cases) fed back on other parts of the system via affecting +the methane code. See https://github.com/ESCOMP/CTSM/issues/812 for more +details. + +This tag fixes this issue via these specific changes: + +1. Calculate btran in SoilMoistStressMod.F90 regardless of + use_hydrstress + +2. Comment on the applicability of this calculation and that of rootr in + SoilMoistStressMod.F90 + +3. Add the following comment to uses of rootr and rootr_col throughout + the code: "SMS method only" + +4. Allow ROOTR_COL history field only if use_hydrstress = .false. + +5. Remove the calculation of rootr_col in subroutine + Compute_EffecRootFrac_And_VertTranSink_HydStress within module + SoilWaterPlantSinkMod.F90 since that calculation is invalid for PHS. + +6. Normalize root resistances for pervious road over nlevgrnd, not + nlevsoi + +Note that the rootr calculation is done using the non-PHS (i.e., SMS) +method. So rootr is not really consistent with PHS; this is something +that should probably be revisited later. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes ESCOMP/ctsm#812 (Problems with rootr when use_hydrstress=.true.) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not checked; none expected + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests pass, answers change as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (PHS and methane) (same climate) + + Summarize any changes to answers, i.e., + - what code configurations: Clm50Bgc (cases with both use_hydrstress=.true. and methane active) + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff / same climate + + For details on differences, see + https://github.com/ESCOMP/CTSM/issues/812#issuecomment-547924289 + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist + + URL for LMWG diagnostics output used to validate new climate: + http://webext.cgd.ucar.edu/I20TR/clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist/lnd/clm50_ctsm10d074_2deg_GSWP3V1_rootr_hist.1995_2014-clm50_ctsm10d074_2deg_GSWP3V1_hist.1995_2014/setsIndex.html + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev077 +Originator(s): sacks (Bill Sacks) +Date: Sun Oct 27 16:23:39 MDT 2019 +One-line Summary: Consistently use frac_sno_eff rather than frac_sno in qg calculations + +Purpose of changes +------------------ + +Consistently use frac_sno_eff rather than frac_sno in qg calculations + +The change here only changes answers for (1) urban pervious road, and +(2) more broadly with use_subgrid_fluxes = .false. + +Previously, code in CalculateSurfaceHumidity was inconsistent regarding +the use of frac_sno vs. frac_sno_eff. I wanted to make this consistent +to facilitate upcoming cleanup of CalculateSurfaceHumidity. I went back +and forth as to which one we should use here. (See also +https://github.com/ESCOMP/CTSM/issues/822). + +Argument for frac_sno_eff: This is consistent with the use of +frac_sno_eff elsewhere in the calculation of surface fluxes. + +Argument for frac_sno: Even in CLM4.0 (prior to the introduction of +frac_sno_eff and frac_h2osfc), frac_sno was used to calculate surface +relative humidity. That makes me think that the parameterizations were +improved by using frac_sno here, even though frac_sno at that point was +mainly just used for albedo / radiation calculations. So sticking with +frac_sno would be more consistent with what has been done for a long +time, and would presumably be a bit better scientifically. + +However, when I tried changing this to use frac_sno rather than +frac_sno_eff: + + qg(c) = frac_sno_eff(c)*qg_snow(c) + (1._r8 - frac_sno_eff(c) - frac_h2osfc(c))*qg_soil(c) & + + frac_h2osfc(c) * qg_h2osfc(c) + +I got a crash with use_subgrid_fluxes false (test +SMS_D_Ld1_P4x1.f10_f10_musgs.I2000Clm45BgcCropQianRsGs.bishorn_gnu.clm-no_subgrid_fluxes), +due to a check I put in relatively recently to ensure that the top-layer +soil liquid never goes significantly negative: + +WJS 218: frac_sno, frac_sno_eff, frac_h2osfc, snl = 6.6447358408778726E-005 1.0000000000000000 0.0000000000000000 -1 + qg_snow, qg_soil, qg_h2osfc, qg = 3.8414454029812475E-003 3.6634834595404343E-003 3.6635176705822736E-003 3.6634952846414733E-003 + ERROR: In UpdateState_TopLayerFluxes, h2osoi_liq has gone significantly negative + Bulk/tracer name = bulk + c, lev_top(c) = 218 0 + h2osoi_liq_top_orig = 6.6448689668604415E-004 + h2osoi_liq = -2.6754040213948407E-004 + frac_sno_eff = 1.0000000000000000 + qflx_liq_grnd*dtime = 0.0000000000000000 + qflx_dew_grnd*dtime = 0.0000000000000000 + qflx_evap_grnd*dtime = 9.3202729882552822E-004 + ENDRUN: + ERROR: In UpdateState_TopLayerFluxes, h2osoi_liq has gone significantly negative + +What seems to be going on is: With a little bit of snow present, when I +use frac_sno rather than frac_sno_eff, we end up with a qg value very +close to that of soil. But I think the later evaporation happens from +the snow, at which point I guess the dryer air above leads to there +being too large evaporation from the snow. + +So in the end, I decided to consistently use frac_sno_eff, even though +this might be a small step backwards in terms of the accuracy of surface +humidity for urban pervious road and with use_subgrid_fluxes = .false. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self (but approved conceptually by Sean Swenson and +Keith Oleson) + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests pass, answers change as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (Small) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Expected to be larger than roundoff/same climate, but not + investigated carefully + + For the default configuration with use_subgrid_fluxes = .true., + differences are restricted to urban pervious road. I spot-checked + a few tests to ensure that we only saw differences in FSH for + urban landunits; this was generally true, with the exception of + ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput, + which also had differences over crop and natural veg + landunits. This spillover effect seems to be related to the + non-local interactions that arise from methane's dependence on + TWS, though I don't understand why I only saw this in a transient + case, and not in similar non-transient cases. See + https://github.com/ESCOMP/CTSM/issues/658#issuecomment-546740771 + for more details. + + For the non-default use_subgrid_fluxes = .false., there + differences in the natural vegetation and crop landunits, too. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev076 +Originator(s): sacks (Bill Sacks) +Date: Fri Oct 25 16:04:20 MDT 2019 +One-line Summary: Set frac_sno_eff=0 if frac_sno is 0; avoid unnecessary calls to QSat + +Purpose of changes +------------------ + +Two changes that are bit-for-bit except for changes in the FSNO_EFF +diagnostic field, both with an eye towards cleaning up +SurfaceHumidityMod in preparation for adding water tracers to that +module: + +(1) Set frac_sno_eff to 0 if frac_sno is 0. Previously, for cases where + frac_sno_eff was a binary 0/1 rather than being set equal to + frac_sno, frac_sno_eff was always being set to 1, even if there was + no snow. Sean Swenson thinks that didn't matter, but I found it + confusing, and it could be more problematic with some upcoming + changes I plan to make (where I'm going to use frac_sno_eff as a + weighting factor in calculating qg terms, including for landunits + that use a binary 0/1 frac_sno_eff.) + +(2) Avoid unnecessary calls to QSat, since this function is relatively + expensive. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: No substantial changes; from a +single run of PFS_Ld20.f09_g17.I2000Clm50BgcCrop.cheyenne_intel, max +timing of the main changed section (bgp1) decreased by about 10%; this +may be within machine variability, though. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests pass, answer changes as expected just for FSNO_EFF + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but just for the diagnostic field FSNO_EFF + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + diagnostic only: just changes FSNO_EFF + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev075 +Originator(s): sacks (Bill Sacks) +Date: Fri Oct 25 15:44:52 MDT 2019 +One-line Summary: Lakes: Adjust frac_sno after updating 0-layer snow pack for dew & sublimation + +Purpose of changes +------------------ + +Main change is: for lakes, possibly adjust frac_sno after updating +0-layer snow pack for dew & sub, ensuring that zero vs. non-zero values +of frac_sno agree with whether the snow pack has zero or non-zero +amounts of snow. The main motivation for this is to ensure that, if we +have any snow, then frac_sno should be non-zero. Along with this, I'm +also ensuring that, if we go down to 0 snow, then we also go down to 0 +frac_sno. + +A related change was to move the code ensuring that h2osno_no_layers +doesn't go negative: I have moved this to before h2osno_no_layers is +referenced, to assure we don't get a slightly negative snow depth. (I +haven't noticed any problems due to the old placement, but it seems +safer to put the limiting before the reference to h2osno_no_layers.) + +Also, an unrelated change in run_sys_tests: Add option for rerunning +existing failed tests. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#827 (Lake frac_sno can remain 0 even when there + is some snow addition from frost) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: None expected + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - pass (on my mac: 'make test' with python2 & python3 and 'make lint') + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests pass, answers change as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (Small) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Expected to be larger than roundoff/same climate + + Changes are introduced only over lake columns, and these changes + should be small, since they only relate to the setting of frac_sno + when there is dew or sublimation on a very thin snow + pack. + + Although the direct changes should only affect lakes, I did + observe changes in crop columns in a transient test that I + spot-checked + (ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput) + - maybe due to some of the non-local interactions in + https://github.com/ESCOMP/CTSM/wiki/Parameterizations-that-can-cause-nonlocal-interactions, + or maybe due to some other non-local interaction, either known or + buggy. (In non-transient tests that I spot checked + (ERP_P72x2_Lm36.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-clm50cropIrrigMonth_interp + and + SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput): + diffs in FSH in h1 file are just over lake landunits, as + expected.) + + Update: it seems that these changes in crop columns arise from + the nonlocal interactions caused by the dependence of methane + on TWS, though I don't understand why I only saw this in a + transient case, and not in similar non-transient cases. See + https://github.com/ESCOMP/CTSM/issues/658#issuecomment-546740771 + for more details. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev074 +Originator(s): sacks (Bill Sacks) +Date: Wed Oct 23 19:25:21 MDT 2019 +One-line Summary: For lakes: when reading finidat, set frac_sno=1 if h2osno_total > 0 + +Purpose of changes +------------------ + +Due to ESCOMP/ctsm#783, frac_sno used to be 0 for all lake points. That +was mostly fixed, but the issue is still present on initial conditions +files that were generated prior to that fix (which includes most or all +of our out-of-the-box restart files). This causes frac_sno to be 0 for +lake points at the start of the simulation, even if there is a snow pack +present. Currently this doesn't cause significant problems, but I'd like +to change the calculation of frac_sno_eff so that it is 0 if frac_sno is +0 - and then this frac_sno problem becomes an issue (causing divide by 0 +in at least one place). + +However, further problems were introduced if I tried to always apply +this correction: It appears that sometimes the restart file legitimately +has frac_sno == 0 for lake columns with non-zero snow cover. To avoid +changing answers for newer restart files, I am writing metadata to the +restart file documenting whether the fix has already been applied on +that restart file, and if so, we avoid reapplying the fix. + +Getting this restart metadata correct was tricky, especially when +running init_interp. I have introduced a new module to encapsulate this +complexity. This can be used in general for writing / reading metadata +on which issues have been fixed on a given restart file. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): [If none, remove this line] +- Resolves ESCOMP/ctsm#783 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- The setting of initial lake frac_sno to 1 isn't exactly correct, but + it's better than the old value of 0. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none +- I didn't check the PFS test, but the only change that could have + likely led to performance changes was the addition of a metadata copy + in init_interp. I checked the timing of this piece, and found it to be + a negligible portion of the total init_interp time + (https://github.com/ESCOMP/CTSM/pull/825#issuecomment-545219601). + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Erik Kluzek gave this an initial look and gave general +approval for the restart file metadata mechanism I have added. He may +give it a more careful look, possibly accompanied by a further cleanup +tag addressing any issues he finds. + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests passed, baselines fail as expected. + + Note that the FUNIT test failed initially; I got it passing on my + Mac, but didn't rerun it on cheyenne. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (same climate, only at startup) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Larger than roundoff/same climate + + The only change is in initial lake frac_sno. This should only + affect the start of the simulation, and only over lake points. I + verified that changes are only over lake points via: For both + SMS_D_Ld1.f09_g17.I1850Clm50Sp.cheyenne_intel.clm-default (which + doesn't use init_interp) and + SMS_D_Ld3.f10_f10_musgs.I2000Clm50BgcCruGs.cheyenne_gnu.clm-default + (which uses init_interp): I checked which points have differences + in FSH in the h1 (vector) history file. Diffs were only over lake + points. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/825 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev073 +Originator(s): sacks (Bill Sacks) +Date: Tue Oct 22 06:14:24 MDT 2019 +One-line Summary: Fix bug in calculation of dqgdT + +Purpose of changes +------------------ + +The calculation of dqgdT, which gives the derivative, d(qg)/dT, was +incorrect for soil/crop landunits when there is no snow. This tag fixes +that bug. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#824 (dqgdT incorrect when there is no snow) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not checked, but none expected + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Sean Swenson reviewed and approved my plan, though not the final code + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests pass, answers change as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Larger than roundoff/same climate + + I checked the impact from one-day averages in test + SMS_D_Ld1_P4x1.f10_f10_musgs.I2000Clm50BgcCropQianRsGs.bishorn_gnu.clm-default, + by looking at differences in EFLX_LH_TOT. The impact is small: + daily-average differences in that variable are typically 0.01 W + m-2 or less; most grid cells have significantly less difference + than that; only one or a few f10 grid cells have significantly + greater differences, with the biggest difference being about 0.1 W + m-2. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev072 +Originator(s): mvertens (Mariana Vertenstein) +Date: Tue Oct 15 09:41:50 MDT 2019 +One-line Summary: Add NUOPC cap + +Purpose of changes +------------------ + +Add NUOPC cap in order to run with the new NUOPC driver/mediator. There +was some code movement / refactoring of existing code to support this, +with the biggest change being the introduction of a new subdirectory +under src/cpl. + +Most changes are from Mariana Vertenstein and Jim Edwards. + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none expected (not checked) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- NUOPC cap currently does not have any tests in the aux_clm test suite +- There are currently no tests ensuring that the nuopc and mct caps give + bit-for-bit answers, though the nuopc_cap_bfb testmod could be used to + support such a test + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- mosart: mosart1_0_33 -> mosart1_0_34 (supports nuopc cap) + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev071 +Originator(s): sacks (Bill Sacks) +Date: Fri Oct 11 07:03:40 MDT 2019 +One-line Summary: Split CanopyTemperature into separate pieces + +Purpose of changes +------------------ + +CanopyTemperature was doing a few unrelated things, none of which +actually had anything to do with calculating canopy temperature. At the +driver level, I have split CanopyTemperature into BiogeophysPreFluxCalcs +and CalculateSurfaceHumidity. BiogeophysPreFluxCalcs calls out to a +number of separate routines, some in that same module and some +elsewhere, including a new routine in FrictionVelocityMod. + +Also some minor related cleanup, including + +- Made FrictionVelocityMod object-oriented + +- A bit of rework of how qflx_evap_veg and qflx_tran_veg are set. This + changes answers for the (default inactive) QFLX_EVAP_VEG history field + (see also ESCOMP/ctsm#816). + +- Removed qsat conditionals that should never be invoked + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes ESCOMP/ctsm#816 (QFLX_EVAP_VEG should be 0 over lakes) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but only for the (default-inactive) field QFLX_EVAP_VEG + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff, but only for the default-inactive field QFLX_EVAP_VEG + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev070 +Originator(s): sacks (Bill Sacks) +Date: Wed Oct 9 06:16:39 MDT 2019 +One-line Summary: Fix for writing 0-d variables with PIO2 + +Purpose of changes +------------------ + +Previously, there were problems when writing 0-d (scalar) variables with +PIO2 in DEBUG mode. This change fixes that issue. + +Jim Edwards put in place an initial fix; I put in place the final fix +based on changes Mariana Vertenstein made in MOSART. I have not tested +this with PIO2, but am hopeful that it fixes the PIO2 problem since the +similar MOSART changes fixed that problem. + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self; earlier version reviewed by Erik Kluzek and Mariana Vertenstein + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/810 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev069 +Originator(s): sacks (Bill Sacks) +Date: Mon Oct 7 10:22:22 MDT 2019 +One-line Summary: Misc. code cleanup and minor bug fixes + +Purpose of changes +------------------ + +Resolve a variety of "simple bfb" issues. Note that some of these result +in answer changes for select diagnostic fields. See specific notes below +for details, under "Issues fixed" and answer changes. + +The fix for ESCOMP/ctsm#27 changes answers for some diagnostic fields, +as noted below. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#27 (BTRAN should be spval over all special + landunits) + - Also fixed some related fields, as noted below, under answer changes + +- Resolves ESCOMP/ctsm#31 (some CLM history fields don't restart + properly) + - This was mostly resolved previously; here I just did some final + cleanup and fixing of NFIRE + +- Resolves ESCOMP/ctsm#48 (code for initializing some isotope carbon + state variables looks wrong) + - Removed the incorrect code, which was never being exercised + +- Resolves ESCOMP/ctsm#58 (Change SHR_ASSERT calls to avoid using + errMsg) + - Purpose was to speed up DEBUG runs on some machines/compilers + +- Resolves ESCOMP/ctsm#111 (Precision of constants in + SoilTemperature.F90 is not double) + - No answer changes, because 1 (single prec) = 1 (double prec) + +- Resolves ESCOMP/ctsm#334 (Introduce a new activelayer_type) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: potentially speeds up debug runs on some machines/compilers + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests pass, some baseline comparisons fail as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but just for select diagnostic fields + + Summarize any changes to answers, i.e., + - what code configurations: ALL + - what platforms/compilers: ALL + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Greater than roundoff, but only in select diagnostic field - no impact on climate + + There were changes in the following diagnostic fields, which are + now averaged over only vegetated landunits (see ESCOMP/ctsm#27): + - BTRAN + - BTRANMN + - RSSHA + - RSSUN + - ROOTR (inactive by default) + - ROOTR_COLUMN (inactive by default) + - RRESIS (inactive by default) + + Changes are also possible in rare circumstances for the NFIRE + diagnostic field, in transient cases, although no differences were + observed for this field in the test suite (see ESCOMP/ctsm#31). + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev068 +Originator(s): sacks (Bill Sacks) +Date: Mon Sep 30 09:57:04 MDT 2019 +One-line Summary: Add water tracers to CombineSnowLayers, DivideSnowLayers, ZeroEmptySnowLayers + +Purpose of changes +------------------ + +Add water tracers to CombineSnowLayers, DivideSnowLayers and +ZeroEmptySnowLayers. This completes the tracerization of the core snow +code: most or all of the code in SnowHydrologyMod is now tracerized. + +In contrast to most routines that I have tracerized, the tracerization +of these routines is done by embedding loops over tracers inside +existing code structures, rather than splitting out separate routines +that operate on bulk or tracer quantities. This is because (1) it didn't +make sense to introduce explicit fluxes for the state updates done here, +so we didn't have the extra need of having separate routines for flux +calculations vs. state updates; (2) the state updates were embedded in +loops over levels and conditionals in a way that would have been awkward +and messy to try to separately update bulk-and-tracer quantities +(h2osoi_liq, h2osoi_ice, etc.) from bulk-only quantities (dz, etc.). + +Also, a bit of reordering of LakeHydrologyMod in order to keep the snow +code more together. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#778 (Implement water tracers for combining and + dividing snow layers) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: I don't think so + Based on the changes introduced, I expect *very* small increases in + runtime of the modified routines (which would show up in the + hydro_without_drainage timer), even for cases without water tracers, + but I wouldn't expect this to have a significant impact. From PFS + test, and specifically looking at the timing of + hydro_without_drainage in that test, I see a possible small increase + (a few percent) in the timing of that section, though the differences + are within typical machine variability, so don't seem necessarily + significant. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev067 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Thu Sep 26 15:02:39 MDT 2019 +One-line Summary: Add config_archive.xml to CTSM cime_config -- no testing + +Purpose of changes +------------------ + +Add config_archive.xml to cime_config for CTSM. Update the CODE_OF_CONDUCT +to the August/2019 UCAR version. + +No testing done. + +Bugs fixed or introduced +------------------------ + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: self + + +CTSM testing: doc (no standard testing done) + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + src unit-tests: + + cheyenne - PASS + + regular tests (aux_clm): None + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + + +Answer changes +-------------- + +Changes answers relative to baseline: No! + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): None +(https://github.com/ESCOMP/ctsm/pull) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev066 +Originator(s): sacks (Bill Sacks) +Date: Fri Sep 20 09:07:23 MDT 2019 +One-line Summary: Add water tracers to SnowCapping + +Purpose of changes +------------------ + +Update water tracer terms in SnowCapping. As I have done elsewhere, this +has involved splitting each piece of SnowCapping into its own subroutine, +which operates either on bulk, tracers, or bulk + tracers. + +This is supported by calls to ResetCheckedTracers prior to the call to +SnowCapping, since some intervening code is not yet tracerized. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#777 (Implement water tracers for SnowCapping) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + Small increase in total runtime of PFS test, but the relevant timing + section, hydro_without_drainage, took slightly *less* time compared + with the last tag. + + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev065 +Originator(s): sacks (Bill Sacks) +Date: Sat Sep 14 12:52:42 MDT 2019 +One-line Summary: Add water tracers to SnowWater + +Purpose of changes +------------------ + +Update water tracer terms in SnowWater. As I have done elsewhere, this +has involved splitting each piece of SnowWater into its own subroutine, +which operates either on bulk, tracers, or bulk + tracers. + +This is supported by calls to ResetCheckedTracers prior to the call to +SnowWater, since some intervening code is not yet tracerized. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#776 (Implement water tracers for SnowWater) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok means tests pass, baselines fail as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + Roundoff level: answer changes just arise because I have made + qflx_snow_percolation_col a true flux, with units of + per-unit-time; this involved dividing by dtime, and later + multiplying by dtime when it is applied to states. Previously, the + corresponding variable (qout / qin) was not per-unit-time. + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + I ran comparisons against a version off of master that had the + minimal changes to exhibit these roundoff-level changes. Diffs for + this are below. My branch is bit-for-bit with this version. + + diff --git a/src/biogeophys/SnowHydrologyMod.F90 b/src/biogeophys/SnowHydrologyMod.F90 + index cad47e28..0abcc49f 100644 + --- a/src/biogeophys/SnowHydrologyMod.F90 + +++ b/src/biogeophys/SnowHydrologyMod.F90 + @@ -1140,17 +1140,17 @@ subroutine SnowWater(bounds, & + c = filter_snowc(fc) + if (j >= snl(c)+1) then + + - h2osoi_liq(c,j) = h2osoi_liq(c,j) + qin(c) + + h2osoi_liq(c,j) = h2osoi_liq(c,j) + qin(c)*dtime + + - mss_bcphi(c,j) = mss_bcphi(c,j) + qin_bc_phi(c) + - mss_bcpho(c,j) = mss_bcpho(c,j) + qin_bc_pho(c) + - mss_ocphi(c,j) = mss_ocphi(c,j) + qin_oc_phi(c) + - mss_ocpho(c,j) = mss_ocpho(c,j) + qin_oc_pho(c) + + mss_bcphi(c,j) = mss_bcphi(c,j) + qin_bc_phi(c)*dtime + + mss_bcpho(c,j) = mss_bcpho(c,j) + qin_bc_pho(c)*dtime + + mss_ocphi(c,j) = mss_ocphi(c,j) + qin_oc_phi(c)*dtime + + mss_ocpho(c,j) = mss_ocpho(c,j) + qin_oc_pho(c)*dtime + + - mss_dst1(c,j) = mss_dst1(c,j) + qin_dst1(c) + - mss_dst2(c,j) = mss_dst2(c,j) + qin_dst2(c) + - mss_dst3(c,j) = mss_dst3(c,j) + qin_dst3(c) + - mss_dst4(c,j) = mss_dst4(c,j) + qin_dst4(c) + + mss_dst1(c,j) = mss_dst1(c,j) + qin_dst1(c)*dtime + + mss_dst2(c,j) = mss_dst2(c,j) + qin_dst2(c)*dtime + + mss_dst3(c,j) = mss_dst3(c,j) + qin_dst3(c)*dtime + + mss_dst4(c,j) = mss_dst4(c,j) + qin_dst4(c)*dtime + + if (j <= -1) then + ! No runoff over snow surface, just ponding on surface + @@ -1167,8 +1167,8 @@ subroutine SnowWater(bounds, & + qout(c) = max(0._r8,(vol_liq(c,j) & + - ssi*eff_porosity(c,j))*dz(c,j)*frac_sno_eff(c)) + end if + - qout(c) = qout(c)*1000._r8 + - h2osoi_liq(c,j) = h2osoi_liq(c,j) - qout(c) + + qout(c) = (qout(c)*1000._r8)/dtime + + h2osoi_liq(c,j) = h2osoi_liq(c,j) - qout(c)*dtime + qin(c) = qout(c) + + ! mass of ice+water: in extremely rare circumstances, this can + @@ -1187,7 +1187,7 @@ subroutine SnowWater(bounds, & + if (qout_bc_phi(c) > mss_bcphi(c,j)) then + qout_bc_phi(c) = mss_bcphi(c,j) + endif + - mss_bcphi(c,j) = mss_bcphi(c,j) - qout_bc_phi(c) + + mss_bcphi(c,j) = mss_bcphi(c,j) - qout_bc_phi(c)*dtime + qin_bc_phi(c) = qout_bc_phi(c) + + ! BCPHO: + @@ -1196,7 +1196,7 @@ subroutine SnowWater(bounds, & + if (qout_bc_pho(c) > mss_bcpho(c,j)) then + qout_bc_pho(c) = mss_bcpho(c,j) + endif + - mss_bcpho(c,j) = mss_bcpho(c,j) - qout_bc_pho(c) + + mss_bcpho(c,j) = mss_bcpho(c,j) - qout_bc_pho(c)*dtime + qin_bc_pho(c) = qout_bc_pho(c) + + ! OCPHI: + @@ -1205,7 +1205,7 @@ subroutine SnowWater(bounds, & + if (qout_oc_phi(c) > mss_ocphi(c,j)) then + qout_oc_phi(c) = mss_ocphi(c,j) + endif + - mss_ocphi(c,j) = mss_ocphi(c,j) - qout_oc_phi(c) + + mss_ocphi(c,j) = mss_ocphi(c,j) - qout_oc_phi(c)*dtime + qin_oc_phi(c) = qout_oc_phi(c) + + ! OCPHO: + @@ -1214,7 +1214,7 @@ subroutine SnowWater(bounds, & + if (qout_oc_pho(c) > mss_ocpho(c,j)) then + qout_oc_pho(c) = mss_ocpho(c,j) + endif + - mss_ocpho(c,j) = mss_ocpho(c,j) - qout_oc_pho(c) + + mss_ocpho(c,j) = mss_ocpho(c,j) - qout_oc_pho(c)*dtime + qin_oc_pho(c) = qout_oc_pho(c) + + ! DUST 1: + @@ -1223,7 +1223,7 @@ subroutine SnowWater(bounds, & + if (qout_dst1(c) > mss_dst1(c,j)) then + qout_dst1(c) = mss_dst1(c,j) + endif + - mss_dst1(c,j) = mss_dst1(c,j) - qout_dst1(c) + + mss_dst1(c,j) = mss_dst1(c,j) - qout_dst1(c)*dtime + qin_dst1(c) = qout_dst1(c) + + ! DUST 2: + @@ -1232,7 +1232,7 @@ subroutine SnowWater(bounds, & + if (qout_dst2(c) > mss_dst2(c,j)) then + qout_dst2(c) = mss_dst2(c,j) + endif + - mss_dst2(c,j) = mss_dst2(c,j) - qout_dst2(c) + + mss_dst2(c,j) = mss_dst2(c,j) - qout_dst2(c)*dtime + qin_dst2(c) = qout_dst2(c) + + ! DUST 3: + @@ -1241,7 +1241,7 @@ subroutine SnowWater(bounds, & + if (qout_dst3(c) > mss_dst3(c,j)) then + qout_dst3(c) = mss_dst3(c,j) + endif + - mss_dst3(c,j) = mss_dst3(c,j) - qout_dst3(c) + + mss_dst3(c,j) = mss_dst3(c,j) - qout_dst3(c)*dtime + qin_dst3(c) = qout_dst3(c) + + ! DUST 4: + @@ -1250,7 +1250,7 @@ subroutine SnowWater(bounds, & + if (qout_dst4(c) > mss_dst4(c,j)) then + qout_dst4(c) = mss_dst4(c,j) + endif + - mss_dst4(c,j) = mss_dst4(c,j) - qout_dst4(c) + + mss_dst4(c,j) = mss_dst4(c,j) - qout_dst4(c)*dtime + qin_dst4(c) = qout_dst4(c) + + end if + @@ -1280,9 +1280,9 @@ subroutine SnowWater(bounds, & + do fc = 1, num_snowc + c = filter_snowc(fc) + ! Qout from snow bottom + - qflx_snow_drain(c) = qflx_snow_drain(c) + (qout(c) / dtime) + + qflx_snow_drain(c) = qflx_snow_drain(c) + qout(c) + + - qflx_rain_plus_snomelt(c) = (qout(c) / dtime) & + + qflx_rain_plus_snomelt(c) = qout(c) & + + (1.0_r8 - frac_sno_eff(c)) * qflx_liq_grnd(c) + int_snow(c) = int_snow(c) + frac_sno_eff(c) & + * (qflx_dew_snow(c) + qflx_dew_grnd(c) + qflx_liq_grnd(c)) * dtime + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev064 +Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) +Date: Mon Sep 9 13:14:51 MDT 2019 +One-line Summary: User defined top-two snow layers + +Purpose of changes +------------------ + + Instead of hardcoding, we now set: + + dzmin(1) = snow_dzmin_1 + dzmax_l(1) = snow_dzmax_l_1 + dzmax_u(1) = snow_dzmax_u_1 + dzmin(2) = snow_dzmin_2 + dzmax_l(2) = snow_dzmax_l_2 + dzmax_u(2) = snow_dzmax_u_2 + + where the right-hand-side variables get namelist-defined values and the + model calculates dzmin and dzmax_* for the remaining snow layers using + recursive formulas. The calculation is intended to match the previously + hardcoded values, except for the bottom snow layer when nlevsno < 12. + The bottom layer now always gets dzmax_* = huge(1._r8). The formulas + appear in a document titled "A firn model for CLM" that is linked to + #729. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #729 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + New namelist parameters for specifying the top-two snow layers: + snow_dzmin_1, snow_dzmax_l_1, snow_dzmax_u_1 + snow_dzmin_2, snow_dzmax_l_2, snow_dzmax_u_2 + +Changes made to namelist defaults (e.g., changed parameter values): + Introduced default values for the new parameters so as to maintain + same answers to within roundoff + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: @billsacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change: roundoff + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + Introduced temporary code to overwrite dzmin(j), dzmax_l(j), and + dzmax_u(j) with their original values when different by less than + 1e-13 from their original values for all but the bottom snow layer. + The bottom layer was left as dzmax_l = dzmax_u(j) = huge(1._8), i.e. + the new value. The test resulted in bit-for-bit same answers. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/ctsm/pull/792 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev063 +Originator(s): erik (Erik Kluzek) +Date: Thu Sep 5 21:28:02 MDT 2019 +One-line Summary: Two answer changing fixes (fire, DWT_SLASH) and fix for urban streams for Clm45 + +Purpose of changes +------------------ + +Fire bug fix and DWT_SLASH change and fix urban stream years for clm4_5. +The latitude used in an expression for Bgc-Fire model Li2016 (used in Clm50) +had latitude in degrees rather than in radians as it should have been. The +term is used for ignition and the cosine was being taken in degrees rather +than radians, hence the spatial pattern for ignition with latitude was incorrect. + +The history field DWT_SLASH_CFLUX was being calculated on the column, but +really should have been a patch level variable. In the same way other fields +were handled we made DWT_SLASH_CFLUX a grid-cell variable, and added +DWT_SLASH_CFLUX_PATCH on the patch level that could be added to output. The same +is true of the C13_ and C14_ versions of it. + +Clm45 was setting urbantv to year 2000, rather than 1850 or historical as it should +have. The urbantv file for Clm45 doesn't actually change, so this doesn't actually +make a difference. But, it does make the namelist look wrong. + +Note, that SP cases, Vic cases and Fates cases do NOT change answers. Or if fire is +off, or certain single-point cases. Some cold-start cases don't seem to be sensitive +to it either. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #175, #787, #780 + fixes #175 urban stream years for clm4_5 + fixes #787 DWT_SLASH field + fixes #780 Bug in CN Fire Li 2016 which used latitude in degrees rather than radians + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): Defaults for urbantv for clm4_5 + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: self, @olywon + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (62 compare fail due to namelist changes) + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes! (important clm5_0-BGC) + + Summarize any changes to answers, i.e., + - what code configurations: Clm50Bgc and some Clm45Bgc cases + - what platforms/compilers: All + - nature of change: similar climate (but fire ignition pattern changes by latitude) + DWT_SLASH_* history fields change because moved to gridcell quantity (so change is relatively minor) + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: oleson/clm50_cesm20R_2deg_GSWP3V1_issue780_hist (for the fire change) + + URL for LMWG diagnostics output used to validate new climate: +http://webext.cgd.ucar.edu/I20TR/clm50_cesm20R_2deg_GSWP3V1_issue780_hist/lnd/clm50_cesm20R_2deg_GSWP3V1_issue780_hist.1995_2014-clm50_cesm20R_2deg_GSWP3V1_hist.1995_2014/setsIndex.html + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #802 +(https://github.com/ESCOMP/ctsm/pull) + #802 -- Three answer changing fixes (fire, DWT_SLASH, urban streams for clm4_5) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev062 +Originator(s): sacks (Bill Sacks) +Date: Tue Sep 3 16:04:28 MDT 2019 +One-line Summary: Move hobart tests to izumi + +Purpose of changes +------------------ + +Move all hobart testing to izumi. + + +Bugs fixed or introduced +------------------------ + +Known bugs introduced in this tag (include github issue ID): +- Recurrence of ESCOMP/ctsm#174 (ne30 case fails on hobart_nag due to floating overflow) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- Testing should now be run on izumi, not hobart + +Changes to tests or testing: +- All hobart tests moved to izumi + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- not run + izumi ------- pass + + Also ran prealpha and prebeta tests that I moved from hobart to izumi. These passed except: + - ERP_D_Ld5.ne30_g16.I1850Clm50BgcCrop.izumi_nag.clm-default (#174) + - ERP_Ld5.f19_g17.I2000Clm50SpRtmFl.izumi_pgi.clm-default + - SMS_D_Ld1.f19_g17.I1850Clm45Cn.izumi_pgi.clm-default + + The last two failed with errors like: + + i011.unified.ucar.edu.44619hfi_userinit: mmap of status page (dabbad0008040000) failed: Operation not permitted + + I wonder if the issue is that multi-node pgi cases don't work on izumi? + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: cime5.8.3_chint17-04 -> cime5.8.3_chint17-05 + Minor change on izumi to allow using run_sys_tests + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev061 +Originator(s): erik (Erik Kluzek) +Date: Sun Sep 1 22:37:07 MDT 2019 +One-line Summary: Simple b4b fixes: new params file, remove override_nsrest/anoxia_wtsat, DV deprecated + +Purpose of changes +------------------ + +New clm5 paramsfile that has the bad date of 631 changed to 701. Along with some simple bit for +bit changes. Removing some problematic options. Making Dynamic Vegetation a deprecated option +that requires you to use -ignore_warnings with it. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #463 #79 #97 #98 #104 #122 #173 #794 #795 #796 + + Fixes #463 bad date on params file that didn't allow using ESMF library with Crop + Fixes #79 correct documentation of qflx_evap_tot + Fixes #97 remove override_nsrest + Fixes #98 add warning when using single instance of a startup file for multi-instance cases + Fixes #104 use get_step_size_real when putting into a real variable + Fixes #122 decomp pool arrays should not start at 0 but 1 + Fixes #173 remove psi_soil_ref as not used + Fixes #794 remove anoxia_wtsat + Fixes #795 Correct documentation of -light_res + Fixes #796 Deprecate Dynamic Vegetation + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Remove namelist items + Remove namelist items: anoxia_wtsat, override_nsrest + Turning dynamic Vegetation on, now displays a warning, and requires using -ignore_warnings in CLM_BLDNML_OPTS + +Changes made to namelist defaults (e.g., changed parameter values): New paramdata files + +Changes to the datasets (e.g., parameter, surface or initial files): + clm5 paramdata file has correct date for crop of 701 (rather than incorrect 631) + clm5 and clm4_5 paramdata file removed an unused variable + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: DV tests removed or changed + +Code reviewed by: self + +CTSM testing: regular + + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (compare shows changes becausse of paramdata files) + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +An additional fail is ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Clm50Cn.cheyenne_gnu.clm-default, because +of #798. Because it's an issue with cime, I'm not marking it as an expected error. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: previous + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #797 +(https://github.com/ESCOMP/ctsm/pull) + + #797 -- Simple b4b fixes: new params file, remove override_nsrest/anoxia_wtsat, DV deprecated + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev060 +Originator(s): sacks (Bill Sacks) +Date: Thu Aug 29 11:18:20 MDT 2019 +One-line Summary: In SnowWater, truncate small h2osoi residuals + +Purpose of changes +------------------ + +Previously, in the handling of sublimation and evaporation from the snow +pack, if these fluxes led to negative h2osoi_ice or h2osoi_liq, these +negative values would be passed down the snow pack until they found a +layer with a large enough positive state to absorb them. This logic was +going to be a challenge for adding water tracers. + +I have done some tests to verify that these negative values never exceed +roundoff-level in either an absolute or relative sense (with tolerance +of 1.e-13). Specifically, I ran the full aux_clm test suite with the +diffs below and verified that the endrun calls were never triggered. + +So here, I simplify this logic: After truncating any near-zero states to +exactly zero, I check to confirm that the states are never negative. I +then removed the code that passed these negative values down the snow +pack: if they are only roundoff-level negative, then it seems safe to +just throw them away rather than trying to handle them. + +Here were the diffs used to verify that the negative values are never +greater than roundoff-level; these endrun calls were never triggered in +a run of the full aux_clm test suite: + + diff --git a/src/biogeophys/SnowHydrologyMod.F90 b/src/biogeophys/SnowHydrologyMod.F90 + index 3dd555cc..07776123 100644 + --- a/src/biogeophys/SnowHydrologyMod.F90 + +++ b/src/biogeophys/SnowHydrologyMod.F90 + @@ -970,6 +970,8 @@ subroutine SnowWater(bounds, & + real(r8) :: vol_ice(bounds%begc:bounds%endc,-nlevsno+1:0) ! partial volume of ice lens in layer + real(r8) :: eff_porosity(bounds%begc:bounds%endc,-nlevsno+1:0) ! effective porosity = porosity - vol_ice + real(r8) :: mss_liqice(bounds%begc:bounds%endc,-nlevsno+1:0) ! mass of liquid+ice in a layer + + real(r8) :: h2osoi_ice_orig + + real(r8) :: h2osoi_liq_orig + !----------------------------------------------------------------------- + + associate( & + @@ -1017,10 +1019,23 @@ subroutine SnowWater(bounds, & + c = filter_snowc(fc) + l=col%landunit(c) + + + h2osoi_ice_orig = h2osoi_ice(c,snl(c)+1) + + h2osoi_liq_orig = h2osoi_liq(c,snl(c)+1) + + + wgdif = h2osoi_ice(c,snl(c)+1) & + + frac_sno_eff(c) * (qflx_dew_snow(c) - qflx_sub_snow(c)) * dtime + h2osoi_ice(c,snl(c)+1) = wgdif + if (wgdif < 0._r8) then + + if (wgdif < -1.e-13_r8) then + + write(iulog,*) 'WJS: big abs wgdif ice: ', c, wgdif, h2osoi_ice_orig + + call endrun('WJS: big abs wgdif ice') + + end if + + if (h2osoi_ice_orig > 0._r8) then + + if (abs(wgdif / h2osoi_ice_orig) > 1.e-13_r8) then + + write(iulog,*) 'WJS: big rel wgdif ice: ', c, wgdif, h2osoi_ice_orig + + call endrun('WJS: big rel wgdif ice') + + end if + + end if + h2osoi_ice(c,snl(c)+1) = 0._r8 + h2osoi_liq(c,snl(c)+1) = h2osoi_liq(c,snl(c)+1) + wgdif + end if + @@ -1030,6 +1045,16 @@ subroutine SnowWater(bounds, & + + ! if negative, reduce deeper layer's liquid water content sequentially + if(h2osoi_liq(c,snl(c)+1) < 0._r8) then + + if (h2osoi_liq(c,snl(c)+1) < -1.e-13_r8) then + + write(iulog,*) 'WJS: big abs wgdif liq: ', c, h2osoi_liq(c,snl(c)+1), h2osoi_liq_orig + + call endrun('WJS: big abs wgdif liq') + + end if + + if (h2osoi_liq_orig > 0._r8) then + + if (abs(h2osoi_liq(c,snl(c)+1) / h2osoi_liq_orig) > 1.e-13_r8) then + + write(iulog,*) 'WJS: big rel wgdif liq: ', c, h2osoi_liq(c,snl(c)+1), h2osoi_liq_orig + + call endrun('WJS: big rel wgdif liq') + + end if + + end if + do j = snl(c)+1, 1 + wgdif=h2osoi_liq(c,j) + if (wgdif >= 0._r8) exit + +Bugs fixed or introduced +------------------------ + +None + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- It's possible that the extra error checks I have added (to ensure we + don't have greater-than-roundoff-level negative residuals) will be + triggered in rare circumstances in a production run, even though they + were never triggered in the test suite. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none +Although there was a very small increase in total lnd run time, the +timing of hydro_without_drainage actually decreased slightly in the PFS +test relative to the last tag. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- It's possible that the extra error checks I have added (to ensure we + don't have greater-than-roundoff-level negative residuals) will be + triggered in rare circumstances in a production run, even though they + were never triggered in the test suite. + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests passed, some answer changes as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: potentially all, though only show up in + a few tests + - what platforms/compilers: potentially all, though only show up in + a few tests + - nature of change (roundoff; larger than roundoff/same climate; new climate): roundoff + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + First, I did some preliminary analyses as documented above, to + ensure that any negative residuals were no greater than roundoff. + + Second, note that the use of truncate_small_values can only + introduce roundoff-level changes (by truncating values that are + roundoff-level different from zero to exactly zero). + + Third, only a few tests showed answer changes, and these were only + in limited fields, and were fairly small RMS differences: + + ERP_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput + ERS_Ly3.f10_f10_musgs.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic + ERS_Ly3_P72x2.f10_f10_musgs.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput + ERS_Ly5_P144x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput + + I actually expected more tests to show differences, but most tests + were bit-for-bit. I'm guessing this is because the code added a + roundoff-level term to a larger term, and this ended up not + changing the larger term. + + Finally, as an extra precaution, I ran the test suite twice, on + two different implementations of the truncation: the final one + (which uses truncate_small_values), and one in which I did the + truncation using custom, inline code (commit 0d21ccb5). These two + were bit-for-bit with each other, giving me more confidence that I + didn't make a mistake with either implementation. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev059 +Originator(s): sacks (Bill Sacks) +Date: Sat Aug 24 15:14:06 MDT 2019 +One-line Summary: Continue adding water tracers to LakeHydrology + +Purpose of changes +------------------ + +Finish implementing water tracers for initial snow-related code in +LakeHydrology. This involved refactoring code in order to reuse existing +code in SnowHydrology rather than having near-duplicates of that code in +LakeHydrology. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#775 (Implement water tracers for initial + snow-related code in LakeHydrology) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none +Many tests took longer, including the PFS test. However, by looking at +more detailed timing numbers in the PFS test, the main increases in time +were in initialization and atm run: lnd run only showed a very small +increase. This suggests that glade slowness was probably primarily +responsible for the increased time. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: Increased allowed wallclock time for a few tests +These tests took longer, likely due to machine variability. Increasing +their wallclock time to prevent them from timing out. + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + hobart ------ pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev058 +Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) +Date: Thu Aug 22 10:02:49 MDT 2019 +One-line Summary: Soil texture interpolation bug-fix + +Purpose of changes +------------------ + + When assigning soil texture values from dataset soil levels to model + soil levels, we should be comparing zsoi (NOT zisoi) in the model with + zisoi on the file, i.e. we should be asking whether the node + center (NOT interface) of a given model level falls between two + interface depths on the file. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #772 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: + Unexpected failure of test + SMS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.hobart_nag.clm-tracer_consistency + Bill Sacks did some follow-up testing and concluded that this may be a + compiler-specific issue, so he changed the test from "nag" to "intel" + and generated the new test's corresponding baseline + +Code reviewed by: @billsacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes (clm5) small + + Summarize any changes to answers, i.e., + - what code configurations: not clm45 (clm5_0 and ctsm5_0-nwp) + - what platforms/compilers: all + - nature of change: larger than roundoff/same climate + based on the assumption that shifting soil texture assignments by + one level in model soil levels below the top-most level should not + generate climate-changing differences. + +Detailed list of changes +------------------------ + 1. Changed zisoi to zsoi as described in the Purpose section above. + This caused the larger than roundoff changes. Before the fix some + model soil levels were getting assigned soil textures from a deeper + soil level in the dataset than they should. + 2. In the same section of code I completed the if-block to address all + zsoi vs. zisoifl comparisons. This ensures explicit assignment of + soil textures for all model soil levels and avoids leaving some + model soil levels with the texture assignment of the previous model + soil level. + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull/788) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev057 +Originator(s): sacks (Bill Sacks) +Date: Tue Aug 20 13:17:39 MDT 2019 +One-line Summary: Fix frac_sno bugs + +Purpose of changes +------------------ + +Two bug fixes related to frac_sno, and a third change involving +replacing a frac_sno calculation with a simpler equation that is +algebraically equivalent: + +(1) Fix lake frac_sno always being 0 + (https://github.com/ESCOMP/ctsm/issues/783). This fixes the albedo + calculation (and possibly others) over snow-covered lake surfaces. + +(2) Fix threshold for explicit snow pack initiation to use frac_sno_eff, + not frac_sno (https://github.com/ESCOMP/ctsm/issues/785). For + standard runs (which have use_subgrid_fluxes = .true.), this just + changes answers for urban columns. This also changes answers more + widely for runs with use_subgrid_fluxes = .false. + +(3) Rewrite Swenson & Lawrence 2012 frac_sno equation to be more + straightforward and less sensitive to roundoff errors + (https://github.com/ESCOMP/ctsm/issues/784) + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#783 (frac_sno is always 0 for lake points) +- Resolves ESCOMP/ctsm#785 (Threshold for explicit snow pack initiation + should use frac_sno_eff, not frac_sno) +- Resolves ESCOMP/ctsm#784 (Suggested algebraic rework of frac_sno + calculation) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, answers change as expected + + Ran most testing on 95dad328 (before 8f1263a7, which removes a + temporary endrun error check). Just reran + SMS_Ld5_D_P48x1.f10_f10_musgs.IHistClm50Bgc.hobart_nag.clm-decStart + on the final version. + + There was a memleak for this test: + + FAIL SMS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.hobart_nag.clm-tracer_consistency MEMLEAK memleak detected, memory went from 1250.830000 to 1518.500000 in 8 days + + I have had memleak issues for this test before + (https://github.com/ESCOMP/ctsm/issues/763), which I have chalked up + to a compiler-specific issue. I have simply increased the tolerance + for memleaks for this test moving forward. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Larger than roundoff; expected to be same climate in general, + because the only impacts are on urban and lake points, which + represent a small fraction of most grid cells. However, this needs + further investigation. + + See above (under "Purpose of changes") for a description of the + different answer changes in this tag. + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + I verified that change (3) is no greater than roundoff by + temporarily putting in an endrun if the new frac_sno differs from + the old by more than 1e-13; this was not triggered for any test in + the aux_clm test suite. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev056 +Originator(s): sacks (Bill Sacks) +Date: Fri Aug 16 11:44:43 MDT 2019 +One-line Summary: Start adding water tracers to LakeHydrology, and related refactoring + +Purpose of changes +------------------ + +Start adding water tracers to LakeHydrology, beginning with some initial +things done for snow. + +This also includes some significant refactoring to allow LakeHydrology +to reuse some of the same snow code used for non-lake columns. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Partially addresses ESCOMP/ctsm#775 (Implement water tracers for + initial snow-related code in LakeHydrology) + +Known bugs found since the previous tag (include github issue ID): +The following will be fixed in an upcoming tag: +- ESCOMP/ctsm#783 (frac_sno is always 0 for lake points) +- ESCOMP/ctsm#784 (Suggested algebraic rework of frac_sno calculation) +- ESCOMP/ctsm#785 (Threshold for explicit snow pack initiation should + use frac_sno_eff, not frac_sno) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, answers change as expected + + Note: Did most testing on 054dc95b (before the small change in + 7e4e52a9); just ran + LWISO_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_gnu.clm-coldStart + on the final commit + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): roundoff + + There are two answer-changes here: + + (1) Roundoff-level changes due to changing some order of operations + for the updating of snow_depth and dz for lakes: The previous + code effectively used (qflx_snow_grnd(c)/bifall(c))*dtime, + whereas the new code uses (qflx_snow_grnd(c)*dtime)/bifall(c); + similarly, the dz update differs. + + (2) A change in FSNO_EFF for lakes: previously, this was set to 0 + when there was no snow. Now this is set consistently with other + landunits, for which it is 1 even if there is no snow. Note that + this only affects the FSNO_EFF diagnostic field, and nothing + else. + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + I confirmed that the order-of-operations change is the only + answer-changing part of this tag by comparing against a one-off + from master with the following diffs; this comparison was + bit-for-bit except for changes in the FSNO_EFF diagnostic field: + + diff --git a/src/biogeophys/LakeHydrologyMod.F90 b/src/biogeophys/LakeHydrologyMod.F90 + index 91ddfc79..9711dad7 100644 + --- a/src/biogeophys/LakeHydrologyMod.F90 + +++ b/src/biogeophys/LakeHydrologyMod.F90 + @@ -126,6 +126,8 @@ subroutine LakeHydrology(bounds, & + real(r8) :: heatsum(bounds%begc:bounds%endc) ! used in case above [J/m^2] + real(r8) :: snowmass ! liquid+ice snow mass in a layer [kg/m2] + real(r8) :: snowcap_scl_fct ! temporary factor used to correct for snow capping + + real(r8) :: temp_snow_depth + + real(r8) :: newsnow + real(r8), parameter :: snow_bd = 250._r8 ! assumed snow bulk density (for lakes w/out resolved snow layers) [kg/m^3] + ! Should only be used for frost below. + !----------------------------------------------------------------------- + @@ -246,8 +248,10 @@ subroutine LakeHydrology(bounds, & + ! U.S.Department of Agriculture Forest Service, Project F, + ! Progress Rep. 1, Alta Avalanche Study Center:Snow Layer Densification. + + - dz_snowf = qflx_snow_grnd(c)/bifall(c) + - snow_depth(c) = snow_depth(c) + dz_snowf*dtime + + temp_snow_depth = snow_depth(c) + + newsnow = qflx_snow_grnd(c)*dtime + + snow_depth(c) = snow_depth(c) + newsnow/bifall(c) + + dz_snowf = (snow_depth(c) - temp_snow_depth)/dtime + if (snl(c) == 0) then + h2osno_no_layers(c) = h2osno_no_layers(c) + qflx_snow_grnd(c)*dtime ! snow water equivalent (mm) + else + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev055 +Originator(s): sacks (Bill Sacks) +Date: Tue Aug 6 14:06:50 MDT 2019 +One-line Summary: Modularize snow cover fraction method + +Purpose of changes +------------------ + +This tag moves the calculation of frac_sno - and the related updates of +snow_depth - into a new set of classes, with one class for each +parameterization (Niu & Yang 2007 and Swenson & Lawrence 2012). + +Previously, the code always calculated frac_sno the new way, but then +possibly overwrote it if using the older Niu & Yang method. The new code +cleans this up, only doing the calculations that are needed for each +method. + +In addition, other code that is specific to one of the two methods is +now moved to a home that makes this dependence on method explicit. This +includes the addition of newsnow to int_snow: previously, int_snow was +always updated using an equation specific to the newer CLM5 +parameterization of frac_sno, which was not appropriate if using the Niu +& Yang parameterization; this doesn't make a difference currently, since +int_snow is only referenced if using the Swenson & Lawrence +parameterization, but this clears up some confusion. Also, time-constant +parameters read from namelist or the netCDF parameter file now reside in +the appropriate class rather than being more global. + +This tag also renames two namelist options to increase clarity: +- subgridflag is renamed to use_subgrid_fluxes, and is now a logical +- oldfflag is renamed to snow_cover_fraction_method, and is now a string + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#502 (oldfflag can NOT be used with + subgridflag==1, and rename subgridflag) +- Resolves ESCOMP/ctsm#503 (Clean up CanopyHydrology) + - This tag does the last piece of cleanup called for in that issue +- Resolves ESCOMP/ctsm#571 (Add a system test: turning on water isotopes + shouldn't change answers) + - This is unrelated to the other changes in this tag + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +This tag renames two namelist options to increase clarity: +- subgridflag is renamed to use_subgrid_fluxes, and is now a logical +- oldfflag is renamed to snow_cover_fraction_method, and is now a string + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Added a LWISO test, which confirms that turning on water isotopes + doesn't change answers for bulk +- Added a test with the newer snow cover fraction method but + use_subgrid_fluxes false (testmod no_subgrid_fluxes) + +Code reviewed by: Sean Swenson, Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - ok + + Tests pass; baseline comparisons not done (baseline comparisons + expected to differ) + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + hobart ------ pass + + Additional tests: Compared both of these against ctsm1.0.dev052 (which + should be bit-for-bit with ctsm1.0.dev054): Both were bit-for-bit: + + ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm45BgcCrop.cheyenne_gnu.clm-no_subgrid_fluxes + This is a new test, so did not have baselines; I created baselines + from ctsm1.0.dev052 and compared against those + SMS_Ly3.f10_f10_musgs.I2000Clm45BgcCrop.cheyenne_intel.clm-oldhyd_monthly + This was a temporary test for the sake of running a longer test with + the oldhyd testmod. This testmod was created as a one-off by + changing the current oldhyd testmod to inherit from monthly rather + than default. I ran baselines like this from ctsm1.0.dev052 then ran + this test from this branch and compared against those baselines. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/769 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev054 +Originator(s): sacks (Bill Sacks) +Date: Fri Aug 2 07:57:51 MDT 2019 +One-line Summary: Fix interpolation of surfdat soil layers so we can use interpolation for 10SL case + +Purpose of changes +------------------ + +Previously, on master, there was special-purpose code for the 10SL case +that avoided doing interpolation from the surface dataset to the soil +variables in the model. It would be cleaner - especially now that we +allow user-defined soil layer structures - if we could use the general +interpolation code always, rather than sometimes having special-purpose +code that avoids doing the interpolation. + +This tag accomplishes that generality. In order to preserve answers for +clm45 cases, I needed to make three changes: + +1. The constant 0.025 needed an _r8 appended to it; otherwise, zisoifl + could differ by roundoff from zisoi. + +2. I changed which level is used when zisoi(lev) is exactly equal to + zisoifl(j) for some j: I changed the conditional in the following: + + if (zisoi(lev) >= zisoifl(j) .AND. zisoi(lev) < zisoifl(j+1)) then + clay = clay3d(g,j+1) + sand = sand3d(g,j+1) + om_frac = organic3d(g,j+1)/organic_max + endif + + to: + + if (zisoi(lev) > zisoifl(j) .AND. zisoi(lev) <= zisoifl(j+1)) then + + Previously, when the zisoi values in the model exactly lined up with + the zisoi values in the file, we would set clay in model level j + equal to the value from level j+1 from the surface dataset (and + similarly for sand and om_frac); in the new code, we use level j from + the surface dataset for model level j in this case. + +3. I changed the way zisoifl is calculated for the lowest layer, so that + it matches zisoi(nlevsoi) when running with 10SL_3.5m. Previously, we + had: + + zisoi(10) = 0.38018819123227207690E+01 + zisoifl(10) = 0.34330930154359391437E+01 + + This tag changes zisoifl(10) to match zisoi(10). + +Bugs fixed or introduced +------------------------ + +Known bugs found since the previous tag (include github issue ID): +- #772: Interpolation of clay, sand and om_frac can use the wrong layer + (points out more fundamental issues with this interpolation of layers + from the surface dataset) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Sam Levis + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + hobart ------ pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO (but see note below) + + In principle, the changes in this tag could change answers for some + soil layer structures, but there were no answer changes for any of + the cases covered by the test suite. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/771 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev053 +Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) +Date: Thu Aug 1 16:56:09 MDT 2019 +One-line Summary: Soil layer definition clean-up and user-defined option + +Purpose of changes +------------------ + + Code clean-up clarifes that there are two types of soil layer + definition: the node-based and the thickness-based. + + User-defined option allows user to specify a soil layer profile in the + form of a dzsoi vector (values in meters) in the thickness-based + approach. + + Default nlevsoi for NWP configurations had to change from 5 to 4 for + consistency with the new error check described in known bugs below. + + Other code clean-up removes a couple of sections of repeating code. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #279 #728 + +Known bugs found since the previous tag (include github issue ID): + #759 (this PR) bug causes model to abort when nlevsoi = nlevgrnd; + bug has been corrected with an error check + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[X] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + if neither soil_layerstruct_predefined nor soil_layerstruct_userdefined + get specified in the namelist, then the model sets + soil_layerstruct_predefined to the old default setting for + soil_layerstruct (clm5: 20SL_8.5m, clm4.5: 10SL_3.5m) + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + renamed soil_layerstruct to soil_layerstruct_predefined and added + soil_layerstruct_userdefined + +Changes made to namelist defaults (e.g., changed parameter values): + Default nlevsoi for NWP configurations had to change from 5 to 4 for + consistency with the new error check described in known bugs below + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers +-------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: + 1) New test... + ERP_P36x2_D_Ld5.f10_f10_musgs.I2000Ctsm50NwpBgcCropGswpGs.cheyenne_intel.clm-default + replaces existing test + ERS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-rm_indiv_lunits_and_collapse_to_dom + to check the correction described in known bugs above; the new test + together with existing unit tests cover what the old test was testing + + 2) New test and new test type... + SOILSTRUCTUD_Ld5.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-default + ensures that soil_layerstruct_userdefined gives bfb same answers as + soil_layerstruct_predefined = '4SL_2m' when set with the same dzsoi + values. The new test type was put together by: + - listing the test in (1) testlist_clm.xml (as all tests) and (2) config_tests.xml + - creating the file .../cime_config/SystemTests/soilstructud.py named after the test in lower case + +Code reviewed by: @billsacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (just for NWP configurations) + + Summarize any changes to answers, i.e., + - what code configurations: nwp + - what platforms/compilers: all + - nature of change: larger than roundoff/same climate + This is due to the change of nlevsoi from 5 to 4 (more info above). + I confirmed that nwp does return bfb same answers when I revert this + change. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/ctsm/pull/759 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev052 +Originator(s): sacks (Bill Sacks) +Date: Mon Jul 22 14:02:43 MDT 2019 +One-line Summary: Fix rare soil color bug in mksurfdata_map + +Purpose of changes +------------------ + +Under rare conditions, mksurfdata_map could put the default soil color +in an output cell where there is actually more information. This tag +fixes that issue. None of the out-of-the-box surface datasets are +impacted by this bug, so I have not recreated any surface datasets. (I +checked all out-of-the-box surface datasets except for +surfdata_0.125x0.125_mp24_simyr2000_c150114.nc, because it doesn't get +remade cleanly out of the box.) + +Also: + +- Add some unit tests for the creation of soil color in mksurfdata_map + +- Point to correct (existing) surface dataset for year-1850 at f05 + resolution + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#4 (Minor bug in creation of soil color in + mksurfdata_map: points can be given the default soil color, when they + should have a real color) +- Resolves ESCOMP/ctsm#765 (Year-1850 f05 surface dataset missing from + inputdata repository) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): +- Year-1850 f05 surface dataset now points to a file that actually exists + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - ok + + Most tests pass, including baseline comparisons. The following tests fail, but also failed for me on master: + + 019 smiS4 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................\c + rc=6 FAIL + 020 bliS4 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................\c + rc=4 FAIL + 027 smf84 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools ....................\c + rc=6 FAIL + 028 blf84 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools ....................\c + rc=4 FAIL + 029 smfc4 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools ..............\c + rc=6 FAIL + 030 blfc4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools ..............\c + rc=4 FAIL + 031 smfg4 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Global_clm4_5^buildtools .............\c + rc=6 FAIL + 032 blfg4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Global_clm4_5^buildtools .............\c + rc=4 FAIL + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- not run + hobart ------ not run + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev051 +Originator(s): sacks (Bill Sacks) +Date: Fri Jul 19 13:26:25 MDT 2019 +One-line Summary: Update water tracers for remainder of first stage of hydrology + +Purpose of changes +------------------ + +Main change is to do tracer updates for final pieces of first stage of +hydrology: HandleNewSnow and UpdateFracH2oSfc. Along with this, I have +introduced greater modularity into these routines (breaking the +operations down into more granular steps). + +Other changes included here (somewhat related to the main changes) are: + +- Added a routine that resets checked tracers to bulk*ratio to allow + running the tracer consistency check for more than one time step; we + now run it for 10 days + +- Change logic for rain-snow conversion terms: Use rain diff in rain to + snow, snow diff in snow to rain. This is less sensitive to roundoff + errors, and was needed in order to get the 10-day tracer consistency + test to pass. + +- Setting of qflx_snow_h2osfc moved to CanopyInterceptionAndThroughfall + +- Add col%lun_itype. col%lun_itype(ci) is the same as + lun%itype(col%landunit(ci)), but is often a more convenient way to + access this type. I got tired of having to get the landunit index just + for the sake of getting the landunit's type of a given column. I have + NOT gone through the code and replaced lun%itype(l) with + col%lun_itype(c) where applicable, but this will be useful for the + future. + +- Removed unnecessary code for backwards compatibility of FH2OSFC from + restart files + +- Point to slightly modified initial conditions files for two CLm45 + initial conditions files. These two had FH2OSFC > 0 for some glc_mec + points. I'm not sure how that came to be, but Sean Swenson and I think + that shouldn't be the case. This caused soil balance errors in these + tests: + + ERS_Ly5_P72x1.f10_f10_musgs.IHistClm45BgcCrop.cheyenne_intel.clm-cropMonthOutput + SMS_D_Ld1.f09_g17.I1850Clm45BgcCruGs.cheyenne_intel.clm-default + + I'm fixing the problem by pointing to updated files with FH2OSFC set + to 0 for special landunits, using the following python: + + ctypel = dat.variables['cols1d_ityplun'][:] + dat.variables['FH2OSFC'][ctypel > 2] = 0 + +- Small cime update to fix the SHAREDLIBBUILD phase of + ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#718 (Implement water tracers for HandleNewSnow + and FracH2oSfc) +- Resolves ESCOMP/ctsm#498 (Do tracer consistency checks every time + step, not just first) + +CIME Issues fixed (include issue #): +- ESCMI/cime#3717 (Cheyenne ESMF missing for WACCM X) + +Known bugs introduced in this tag (include github issue ID): +- ESCOMP/ctsm#762 (Water tracers: Make sure calls to ResetCheckedTracers + are removed) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- If you have an initial conditions file with non-zero FH2OSFC for + glacier (this was the case for some out-of-the-box clm45 files, which + are now fixed), may run into soil balance errors. To fix this, set + FH2OSFC to 0 in your restart file for all special landunits. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): +- Point to slightly modified initial conditions files for two CLm45 + initial conditions files: see above for details. + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Changed tracer consistency test to 10 days rather than a single time step + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, some roundoff-level diffs in baseline + comparisons, as noted below + + Also, in order to have a more powerful test of the changes in + SurfaceWaterMod (since the relevant code isn't triggered very often), + I introduced the following diffs: + + diff --git a/src/biogeophys/SurfaceWaterMod.F90 b/src/biogeophys/SurfaceWaterMod.F90 + index 1bc03cae..be656a15 100644 + --- a/src/biogeophys/SurfaceWaterMod.F90 + +++ b/src/biogeophys/SurfaceWaterMod.F90 + @@ -12,6 +12,7 @@ module SurfaceWaterMod + use shr_spfn_mod , only : erf => shr_spfn_erf + use clm_varcon , only : denh2o, denice, roverg, wimp, tfrz, pc, mu, rpi + use clm_varpar , only : nlevsno, nlevgrnd + + use clm_varctl , only : iulog + use clm_time_manager , only : get_step_size + use column_varcon , only : icol_roof, icol_road_imperv, icol_sunwall, icol_shadewall, icol_road_perv + use decompMod , only : bounds_type + @@ -201,7 +202,7 @@ subroutine BulkDiag_FracH2oSfc(bounds, num_soilc, filter_soilc, & + SHR_ASSERT_FL((ubound(qflx_too_small_h2osfc_to_soil, 1) == bounds%endc), sourcefile, __LINE__) + + ! arbitrary lower limit on h2osfc for safer numerics... + - min_h2osfc=1.e-8_r8 + + min_h2osfc=1.e0_r8 + + do f = 1, num_soilc + c = filter_soilc(f) + @@ -230,6 +231,9 @@ subroutine BulkDiag_FracH2oSfc(bounds, num_soilc, filter_soilc, & + + else + frac_h2osfc(c) = 0._r8 + + if (h2osfc(c) > 0._r8) then + + write(iulog,*) 'WJS: in else' + + end if + qflx_too_small_h2osfc_to_soil(c) = h2osfc(c) / dtime + ! The update of h2osfc is deferred to later, keeping with our standard + ! separation of flux calculations from state updates, and because the state + + With those diffs, I ran the tracer consistency test; it passed. In + addition, I ran + SMS_D_Ld1_P4x1.f10_f10_musgs.I2000Clm50BgcCropQianRsGs.bishorn_gnu.clm-default + with comparison against master, with the following diffs on master + (the first change changes behavior to force the relevant code to be + triggered, and is the same on master and on the branch; the second + change on master divides then multiplies by dtime to avoid + roundoff-level diffs): + + diff --git a/src/biogeophys/SurfaceWaterMod.F90 b/src/biogeophys/SurfaceWaterMod.F90 + index 959d539b..4a4a4824 100644 + --- a/src/biogeophys/SurfaceWaterMod.F90 + +++ b/src/biogeophys/SurfaceWaterMod.F90 + @@ -77,7 +77,7 @@ subroutine FracH2oSfc(bounds, num_nolakec, filter_nolakec, & + ) + + ! arbitrary lower limit on h2osfc for safer numerics... + - min_h2osfc=1.e-8_r8 + + min_h2osfc=1.e0_r8 + + call waterstatebulk_inst%CalculateTotalH2osno(bounds, num_nolakec, filter_nolakec, & + caller = 'FracH2oSfc', & + @@ -112,7 +112,7 @@ subroutine FracH2oSfc(bounds, num_nolakec, filter_nolakec, & + + else + frac_h2osfc(c) = 0._r8 + - h2osoi_liq(c,1) = h2osoi_liq(c,1) + h2osfc(c) + + h2osoi_liq(c,1) = h2osoi_liq(c,1) + (h2osfc(c) / get_step_size()) * get_step_size() + h2osfc(c)=0._r8 + endif + + This test passed and was bit-for-bit with master with the above changes. + + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes (roundoff level) + + Summarize any changes to answers, i.e., + - what code configurations: Many/all + - what platforms/compilers: All + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Roundoff: just roundoff-level changes in FSH_PRECIP_CONVERSION, + FSH_TO_COUPLER, l2x_Fall_sen due to refactored calculation of + FSH_PRECIP_CONVERSION + + If bitwise differences were observed, how did you show they were no worse + than roundoff? via summarize_cprnc_diffs + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: branch_tags/cime5.8.3_chint17-03 -> branch_tags/cime5.8.3_chint17-04 + Fixes ESMCI/cime#3171 + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev050 +Originator(s): slevis (Samuel Levis,SLevisConsulting LLC,303-665-1310) +Date: Mon Jul 15 11:40:09 MDT 2019 +One-line Summary: dz --> dz_lake bug-fix in LakeTemperatureMod.F90 line 960 + +Purpose of changes +------------------ + + Bug-fix to prevent the model from aborting when running with fewer soil + layers than lake layers; not to imply that this was not a bug when the + model wasn't aborting. It was. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #760 + +Known bugs found since the previous tag (include github issue ID): #759 bug causing model to abort when nlevsoi = nlevgrnd + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers +-------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: @dlawrenncar @billsacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes (when methane on) (diagnostic only) + + Summarize any changes to answers, i.e., + - what code configurations: use_lch4 = .true. + - what platforms/compilers: all + - nature of change: diagnostic variable WTGQ only + Confirmed this on cheynne and hobart by running + ./summarize_cprnc_diffs -baseline .../tests_0712... -testid '*' + and inspecting the file cprnc.summary.*.by_varname + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/ctsm/pull/761 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev049 +Originator(s): erik (Erik Kluzek) +Date: Sun Jun 23 20:56:55 MDT 2019 +One-line Summary: Update mosart and intel to intel-19 on cheyenne + +Purpose of changes +------------------ + +Update mosart to trunk tag (that has a roundoff change to history file +output). And update intel compiler on cheyenne to intel-19. + +Bugs fixed or introduced None +------------------------ + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: self + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes (roundoff level change when MOSART on) + + Summarize any changes to answers, i.e., + - what code configurations: some compsets with mosart + - what platforms/compilers: cheyenne/intel + - nature of change: roundoff + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, and mosart + mosart to mosart1_0_33 + cime to branch_tags/cime5.8.3_chint17-03 + +Pull Requests that document the changes (include PR ids): #753 +(https://github.com/ESCOMP/ctsm/pull) + #753 -- Update cheyenne to intel/19 and update mosart + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev048 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Sun Jun 23 15:16:01 MDT 2019 +One-line Summary: Updates for buildlib changes and cime and externals updates + +Purpose of changes +------------------ + +Update of most externals: cime, mosart, rtm, cism. The cime update also includes a required CESM-wide +change in buildlib. Uses a function to get the Macros filename "get_standard_makefile_args". +The cime update brought in some answer chagnes, with an update of the intel compiler (but we backed those +out by using a cime branch). There is also a roundoff change by going to the trunk version of RTM. + +Bugs fixed or introduced None +------------------------ + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: @jedwards, self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + tools-tests (test/tools): + + cheyenne - PASS + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - PASS + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS (for python3) + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes, but only for a few cases (compsets with RTM) + + Summarize any changes to answers, i.e., + - what code configurations: With RTM + - what platforms/compilers: All + - nature of change: roundoff + fieldlist is different for CISM in some cases + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, mosart, rtm, cism + cime to branch_tags/cime5.8.3_chint17-02 + cism to cism2_0_68 + rtm to rtm1_0_68 + mosart to nldas-grid.n02_mosart1_0_31 + +Pull Requests that document the changes (include PR ids): #752 +(https://github.com/ESCOMP/ctsm/pull) + + #752 -- buildlib, cime and externals update + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev047 +Originator(s): sacks (Bill Sacks) +Date: Sun Jun 16 13:04:38 MDT 2019 +One-line Summary: Fix negative snow compaction during snow melt + +Purpose of changes +------------------ + +Fix an issue reported by @kjetilaas: In the presence of surface water, +the old and new snow cover fractions are inconsistently calculated in +subroutine "SnowCompaction". This can result in significant negative +compaction (snow depth increase) during snow melt. + +More details from @kjetilaas (copied from +https://github.com/escomp/ctsm/issues/573): + +There is an inconsistency in the calculation of snow cover fraction +(FSNO) in the SnowCompaction subroutine when there is surface water +present. The actual snow cover is limited to 0.99 when surface water is +present (and the surface water fraction is set to 0.01). However, +SnowCompaction recalculates the old FSNO without accounting for this +limitation. This results in an apparent decrease in FSNO, and +corresponding negative snow compaction from snow melt (ddz3). + +This can result in substantial, artificial increase in snow depth during +summer (can be more than 0.5 m during a single season). + +The problem might be masked in monthly output, but could be significant +whenever snow cover is close to 1 and surface water present. Snow mass +is indirectly affected by this as radiation and temperature fluxes in +the snow pack will be affected by artificially thick snow layers. + +This tag fixes this issue. The fix was implemented and tested by +@swensosc (Sean Swenson). + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#573 (Snow depth increase due to inconsistent snow + cover fraction calculation) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Sean Swenson, @kjetilaas, Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, answers change as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (similar climate) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Larger than roundoff/same climate + + Sean Swenson ran the LMWG diagnostics package and looked at the + results with Keith Oleson. Their main findings were: + + - Snow depth is a bit smaller over Greenland and polar regions on + average, as expected (up to 5-10% decrease in average snow depth + averaged over the Canadian Arctic) + + - There is a small increase in h2osno over Greenland: about 30 mm + averaged over Greenland; it looks like the main changes are + around the coasts (which makes sense given that this bug only + affects vegetated landunits) + + - There are small changes in runoff over Greenland + + - Changes in snow cover fraction are tiny + + - Overall, this doesn't look climate changing, but could + potentially have a significant impact on select grid cells, and + on some variables in polar regions + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev046 +Originator(s): sacks (Bill Sacks) +Date: Sat Jun 15 15:54:44 MDT 2019 +One-line Summary: Separate the two uses of h2osno + +Purpose of changes +------------------ + +Until now, h2osno has been used in two ways: + +1. When there are explicit snow layers, h2osno is the sum of snow + (liquid + ice) in all layers + +2. When there is a little bit of snow, but not enough to create a snow + layer, h2osno gives the amount of this very thin snow pack (assumed + to be all ice) + +This is confusing and complicates the addition of water tracers to the +code. This tag separates h2osno into two different variables: + +1. h2osno_no_layers is a fundamental state variable that gives the + amount of snow in the case where we don't have explicit snow layers + +2. h2osno_total is purely a diagnostic variable that is the sum of snow + in all explicit layers, plus h2osno_unresolved. This exists in + waterdiagnosticbulk_type, but the version there is just set once at + the end of the time step, so that version is only meant for + diagnostic (history) output. Code that needs the current sum of + h2osno at a given point now computes it locally, via a new method on + waterstate_type: CalculateTotalH2osno. If running in debug mode, that + routine also performs some consistency checks. + +Also, an unrelated change to prevent user from trying to interpolate a +file onto itself. + +Also, add a compset for testing, which is good for use on my mac. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#733 (Make h2osno purely a diagnostic variable) +- Resolves ESCOMP/ctsm#749 (h2osno inconsistent when interpolating from + initial conditions with different snow layers) +- Resolves ESCOMP/ctsm#750 (Prevent user from trying to use the same + filename for init_interp source and destination files) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none (possibly a small improvement +in timing based on PFS run time) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass; baseline comparisons fail as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes (mostly roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Mostly roundoff; greater than roundoff/same climate for cases for + which number of snow layers is less in the case than in its + initial conditions file, due to fixing #749 + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + There was one point where h2osno_total differed from the old h2osno + by roundoff, as verified by a run of the test suite (where I verified + that (a) it only differed by 1e-11 or less, and (b) if I reset it, + there were just roundoff-level changes in a few diagnostic + fields). That one place with roundoff-level diffs can lead to + propagation of diffs, causing differences in many fields in the final + run of the test suite. In particular: I ran the test suite on + 69823de4 (which had this temporary check and reset of h2osno_total + vs. old h2osno). For nearly all tests, there were only roundoff-level + changes in a few diagnostic fields. I then removed the temporary + check and reset and ran the test suite on the result + (4353cc90). Finally, I ran the test suite on the final, cleaned-up + code, with comparison against 4353cc90 and verified bfb. + + In my testing on 69823de4: There were a few tests with greater than + roundoff-level changes due just to differences in the initial value + of h2osno_total (which was incorrect in the old due to #749). I + verified that these only had roundoff-level changes in a few + diagnostic fields if I used the following diffs in both the baseline + and my branch, indicating that the diffs just arose due to the fix of + #749: + + diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 + index 793b36ac..f10ee5e1 100644 + --- a/src/main/clm_initializeMod.F90 + +++ b/src/main/clm_initializeMod.F90 + @@ -762,6 +762,18 @@ subroutine initialize2( ) + !$OMP END PARALLEL DO + end if + + do c = bounds_proc%begc, bounds_proc%endc + + if (col%snl(c) < 0) then + + water_inst%waterstatebulk_inst%h2osno_col(c) = 0._r8 + + do j = col%snl(c)+1, 0 + + water_inst%waterstatebulk_inst%h2osno_col(c) = & + + water_inst%waterstatebulk_inst%h2osno_col(c) + & + + water_inst%waterstatebulk_inst%h2osoi_ice_col(c,j) + & + + water_inst%waterstatebulk_inst%h2osoi_liq_col(c,j) + + end do + + end if + + end do + + + end subroutine initialize2 + end module clm_initializeMod + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev045 +Originator(s): sacks (Bill Sacks) +Date: Thu Jun 6 12:26:57 MDT 2019 +One-line Summary: Recalculate h2osno for the sake of SnowCapping + +Purpose of changes +------------------ + +SnowCapping decides whether to remove excess snow based on +h2osno. However, at the point where this is called,h2osno is out of sync +with (h2osoi_liq + h2osoi_ice): Those variables can be changed slightly +in SnowWater (which is called before SnowCapping), yet h2osno isn't +recalculated based on those changes. + +I don't think this causes a big problem in practice, but it seems like +it would improve code understandability if we had the general rule that +any code that references h2osno is using a version of h2osno that is in +sync with (h2osoi_liq + h2osoi_ice). This is also needed to prevent +answer changes in an upcoming major refactor. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#736 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Sean Swenson signed off on the change, but didn't +review the final code + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, answers change as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (should be small) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Larger than roundoff/same climate + + Answer changes are expected to be small, since this should just + change the timing of snow capping a bit, but I haven't looked + closely at the magnitude of the answer changes. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev044 +Originator(s): sacks (Bill Sacks) +Date: Thu Jun 6 12:14:39 MDT 2019 +One-line Summary: Make wetland snow resetting behavior more explicit + +Purpose of changes +------------------ + +There is some code that zeroes out h2osno over thawed wetlands. It seems +like the intended behavior here is to zero out the entire snow +pack. Currently, however, this only zeros out a very thin (zero-layer) +snow pack. For now, I'm adding an snl==0 conditional to make this +behavior explicit; long-term, we'd like to change this to actually zero +out the whole snow pack. (At that time, this code block should probably +be moved to a more appropriate home, as noted in comments in issue +ESCOMP/ctsm#735.) + +Also, unrelated change in run_sys_tests: support machine-specific +baseline directory, in order to support new default location for CTSM +baselines on cheyenne. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Partially addresses, but does NOT fix, ESCOMP/ctsm#735 + +Known bugs introduced in this tag (include github issue ID): +- Partially addresses, but does NOT fix, ESCOMP/ctsm#735 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Sean Swenson and Keith Oleson approved this change, +though didn't actually review the final code. + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - pass on cgdm-bishorn + make python=python2 test + make pyhton=python3 test + make lint + + regular tests (aux_clm): + + cheyenne ---- pass + hobart ------ pass + + Also ran SMS_Ly1.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-monthly + with comparison against baselines: passed and bit-for-bit. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO (but see notes below) + + It seems theoretically possible for this to change answers, but no + answer changes were observed in the aux_clm test suite or + SMS_Ly1.f09_g17.I2000Clm50SpGs.cheyenne_intel.clm-monthly. + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev043 +Originator(s): erik (Erik Kluzek) +Date: Wed Jun 5 10:17:06 MDT 2019 +One-line Summary: Fix FUN bug (frac_ideal_C_use was backwards in regard to delta_CN), and replace Ball-Berry mbbopt with the CLM4.5 version + +Purpose of changes +------------------ + +Carbon allocation to uptake responds to CN(uptake-cost) and CN(actual). The intended implementation is: For C:N +less than the target C:N, C allocation is reduced with cost. For C:N greater than the target C:N, C allocation +is increased with high C:N. However, the actual implementation is reversed. This change fixes that problem. + +Also the Ball-Berry mbbopt values had been changed in the creation of CLM5.0, as part of the tuning, but the new +values don't work well (as our final tuning uses Medlyn photosynshesis rather than Ball-Berry). This brings the values +for Ball-Berry for CLM5.0 back to the CLM4.5 values. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #704 #705 + + Fixes #705 -- Ball-Berry parameters in CLM5.0 should go back to the previous values in CLM4.5 + Fixes #704 -- FUN code logic to reduce or increase carbon allocation used for uptake is reversed + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): New clm5.0 paramdata file + +Changes to the datasets (e.g., parameter, surface or initial files): mbbopt now use the clm4_5 values + rather than the pretuned clm5_0 values (before Medlyn was being used) + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: self, olyson + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (134 tests are different from baseline as expected) + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes! (Important when FUN model on) + + Summarize any changes to answers, i.e., + - what code configurations: Anything with use_FUN=T (so Clm50Bgc compsets) + Also with Clm5.0 and Ball-Berry (stomatalcond_method='Ball-Berry1987') (so Clm50Nwp compsets) + - what platforms/compilers: All + - nature of change: climate is similar + + "Our assessment is that the impact is relatively small, but would affect climate; + however it doesn’t appear to strongly affect transient C response." + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + Experiments were done on the release branch + - casename: oleson/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_1850 + oleson/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_hist + + URL for LMWG diagnostics output used to validate new climate: + +http://webext.cgd.ucar.edu/I1850/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_1850/lnd/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_1850.21_40-clm50_release-clm5.0.15_2deg_GSWP3V1_1850.21_40/setsIndex.html + +We've also completed a historical run. Diagnostics are here: + +http://webext.cgd.ucar.edu/I20TR/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_hist/lnd/clm50_release-clm5.0.15_delta_CN_FUNbug_2deg_GSWP3V1_hist.1995_2014-clm50_release-clm5.0.15_2deg_GSWP3V1_hist.1995_2014/setsIndex.html + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #727 +(https://github.com/ESCOMP/ctsm/pull) + + #727 -- Fix the FUN bug, where an if statement was backwards + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev042 +Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) +Date: Tue May 21 23:29:31 MDT 2019 +One-line Summary: Rename, correct, and simplify parameters dewmx and sno_stor_max + +Purpose of changes +------------------ + + To rename + dewmx to liq_canopy_storage_scalar + sno_stor_max to sno_canopy_storage_scalar + in the code and in the clm45 and clm50 param files. + + To change snocanmx, liqcanmx, and fcansno to... + snocanmx = params_inst%snow_canopy_storage_scalar(p) * (elai(p) + esai(p)) + liqcanmx = params_inst%liq_canopy_storage_scalar(p) * (elai(p) + esai(p)) + fcansno(p) = (snocan(p) / (vegt * params_inst%sno_stor_max))**0.15_r8 + + Rewrote fwet(p) to follow the same format as fcansno(p). + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #710 + Fixes #710 -- rename dewmx + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): New default parameter file + +Changes to the datasets (e.g., parameter, surface or initial files): + Pointing to new clm45 and clm50 param files containing the two renamed + parameters listed above. + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: None + +Code reviewed by: + @billsacks + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (196 different because of new param file) + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + Roundoff changes were expected. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes! (roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: ALL + - what platforms/compilers: ALL + - nature of change: roundoff + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + The code modifications causing the change were of the order-of-calculations + type in two lines of code. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/ctsm/pull/719 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev041 +Originator(s): sacks (Bill Sacks) +Date: Fri May 17 06:02:38 MDT 2019 +One-line Summary: Add water tracers to CanopyHydrologyMod + +Purpose of changes +------------------ + +Major overhaul of CanopyHydrologyMod in order to support water tracers. + +The part of CanopyHydrology that was actually dealing with canopy +hydrology has now been broken out into a number of small routines in +order to separate flux calculations from state updates. This is needed +in order to calculate tracer versions of the relevant variables, which +is now done here. + +The parts of CanopyHydrology that were NOT dealing with canopy hydrology +have been moved to more appropriate homes. They have not yet been +tracerized, but will be soon. + +This also makes some minor changes to diagnostic fields related to +canopy hydrology. Of particular note: QDRIP now has a different meaning: +it now corresponds to the excess liquid water that runs off from the +canopy (and is inactive by default). + +The design of this broken-out code was developed in consultation with +Mike Barlage, Erik Kluzek, Negin Sobhani, Sean Swenson and Mariana +Vertenstein. We plan to apply this design moving forward to other parts +of the code that need tracerization. See also +. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#360 - Implement water isotopes for + CanopyHydrology +- Resolves ESCOMP/ctsm#709 - QDRIP diagnostic field misleadingly named +- Partially addresses ESCOMP/ctsm#503 - Clean up CanopyHydrology + (We still need to clean up / tracerize the parts that have now been + moved elsewhere.) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- Changed meaning of QDRIP diagnostic field: it now corresponds to + qflx_liqcanfall rather than qflx_prec_grnd_patch, and is default + inactive. (There is no longer a diagnostic field corresponding to + qflx_prec_grnd_patch, but there are separate diagnostic fields for the + rain and snow portions of this, both default inactive.) + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none +- checked timing of hydro1 timer vs. previous canhydro timer from my + dev039 testing: differences are negligible + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: +- Design reviewed by Mike Barlage, Erik Kluzek, Negin Sobhani, Sean + Swenson and Mariana Vertenstein +- Final code reviewed only by self + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, baseline comparisons fail as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + roundoff + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + Ensured no-greater-than-roundoff-level by: + + First, generated baselines using code with these diffs (note extra + parentheses in multiplication): + + diff --git a/src/biogeophys/CanopyHydrologyMod.F90 b/src/biogeophys/CanopyHydrologyMod.F90 + index f848f520..31c8c550 100644 + --- a/src/biogeophys/CanopyHydrologyMod.F90 + +++ b/src/biogeophys/CanopyHydrologyMod.F90 + @@ -338,8 +338,8 @@ subroutine CanopyHydrology(bounds, & + ! Intercepted precipitation [mm/s] + qflx_prec_intr(p) = forc_snow(c)*fpisnow + qflx_liq_above_canopy(p)*fpi + ! storage of intercepted snowfall, rain, and dew + - snocan(p) = max(0._r8, snocan(p) + dtime*forc_snow(c)*fpisnow) + - liqcan(p) = max(0._r8, liqcan(p) + dtime*qflx_liq_above_canopy(p)*fpi) + + snocan(p) = max(0._r8, snocan(p) + dtime*(forc_snow(c)*fpisnow)) + + liqcan(p) = max(0._r8, liqcan(p) + dtime*(qflx_liq_above_canopy(p)*fpi)) + + ! Initialize rate of canopy runoff and snow falling off canopy + qflx_snocanfall(p) = 0._r8 + + + Then ran test suite on 1cc9d38a. This is very close to the final + branch, but had a few small tweaks in place to get bit-for-bit: + + 1. Under some conditions, the final branch code resets slightly + negative snocan and liqcan to 0, where master did not. This + commit puts in place temporary code to maintain the slightly + negative values under these conditions, along with a check to + ensure that the values are really always only slightly negative + in this situation. + + 2. When snocan > snocanmx, master reset snocan to exactly snocanmx, + whereas the final branch code can result in snocan being + roundoff-level different from snocanmx, and similar for + liqcan. This commit puts in place temporary code to set snocan + to snocanmx under appropriate circumstances, and liqcan to + liqcanmx, along with a check to ensure that this is only leading + to roundoff-level changes in these state variables. + + 3. Multiplies then divides a flux by dtime in one place + + 4. Has parentheses around a partial sum to ensure same order of + operations as before + + This was bfb with the baselines generated with the diff noted + above, except for roundoff-level changes in SNOCAN in one grid cell + in just one test + (SMS_D_Ld1.f19_g17.I1850Clm45Cn.hobart_gnu.clm-default; old: + -8.15e-322, new: -2e-323). + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +None. But see +https://github.com/billsacks/prototypes-ctsm-canopyhydrology_tracers, +which was the source of our design discussions and contains notes from +these discussions. + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev040 +Originator(s): slevis (Samuel Levis,SLevis Consulting LLC,303-665-1310) +Date: Fri May 03 10:34:46 MDT 2019 +One-line Summary: Move some hard-coded parameters from code to params.nc file + +Purpose of changes +------------------ + + Reduce the number of parameters that get hardwired directly in the code + by placing in the params.nc file where they become visible and easier + to modify. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #680 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users: + None + +Changes to CTSM's user interface: + Parameters that were hardwired in the code can now be seen and changed + in the params.nc file. + +Changes made to namelist defaults (e.g., changed parameter values): + None + +Changes to the datasets (e.g., parameter, surface or initial files): + Various parameters have moved out of the code and into the params.nc file. + +Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] + +Notes of particular relevance for developers: + None +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + None + +Changes to tests or testing: + None + +Code reviewed by: + @ekluzek + @billsacks + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + Answers change as expected. + +CTSM tag used for the baseline comparisons: + ctsm1.0.dev039 + +Answer changes +-------------- + +Changes answers relative to baseline: YES (single precision roundoff) + Summarize any changes to answers, i.e., + - what code configurations: ALL + - what platforms/compilers: ALL + - nature of change: single-precision roundoff + Changes are due to four parameters: + accum_factor + ko25_coef + kc25_coef + frac_sat_soil_dsl_init + that were not declared "_r8" when hardwired in the code, + while now they are declared "double" in the params.nc files. I + showed that the change was no greater than single-precision roundoff + by writing the new and old values to the lnd and cesm log files and + confirming differences smaller than 1.e-6. + +Detailed list of changes +------------------------ + + - Updated the clm5 and clm4.5 params.nc files to contain the previously + hard-coded parameters that Katie Dagon recommended moving out of the + code (listed here: https://docs.google.com/spreadsheets/d/1cRmcB0xz7CjVP6ljUoCehJx49Usxsore5ma4mWcvQwM/edit#gid=0) + - Now read the parameters in the modules that use them + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/ctsm/pull/684 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev039 +Originator(s): sacks (Bill Sacks) +Date: Wed May 1 11:12:34 MDT 2019 +One-line Summary: Remove excess canopy liquid/snow regardless of temperature + +Purpose of changes +------------------ + +Previously: if it was above freezing, snow was allowed to accumulate on +the canopy beyond the specified capacity, and if it was below freezing, +liquid was allowed to accumulate beyond the specified capacity. Sean +Swenson, Keith Oleson and Dave Lawrence agreed that this seems wrong. + +This tag changes the behavior so that both liquid and snow canopy +capacities are enforced regardless of temperature. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#699 (Canopy liquid and snow capacities not + enforced consistently?) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Keith Oleson + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, answers change as expected + +CTSM tag used for the baseline comparisons: ctsm1.0.dev038 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff; likely same climate, but this still requires + investigation + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/703 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev038 +Originator(s): sacks (Bill Sacks) +Date: Wed May 1 10:53:02 MDT 2019 +One-line Summary: Support for NWP configuration, NLDAS grid and NLDAS datm forcing + +Purpose of changes +------------------ + +This tag includes a set of changes that, together, provide support for +running an initial Numerical Weather Prediction version of CTSM over the +Continental U.S. + +(1) NWP configuration: The changes in this configuration relative to the + climate (CLM5) configuration mainly target decreasing runtime by + removing features that are expensive and not as important for NWP + time scales (days to months rather than many years) and space scales + (high resolution): + + - Single dominant landunit; if vegetated, single dominant PFT + + - Only 5 soil layers, down to 3 m + + - Only 5 snow layers + + - Plant hydraulic stress off + + - Ball-Berry rather than Medlyn stomatal conductance method (this is + a side-effect of turning plant hydraulic stress off, and is not + itself a critical aspect of the NWP configuration) + + - Maximum of 3 iterations to compute canopy fluxes + + - MEGAN is off + + Note that the NWP compset triggers changes in two new xml variables: + CLM_CONFIGURATION ('clm' vs. 'nwp'; this controls things of a more + scientific nature, like whether plant hydraulic stress is on or + off), and CLM_STRUCTURE ('standard' vs. 'fast'; this controls + structural things like the maximum number of landunits per grid cell + and the soil layer structure). Thus, you can create a case that is a + hybrid between the CLM and NWP configurations by changing these two + xml variables independently. + +(2) NLDAS2 regional grid: 0.125 deg grid over the Continental U.S. + +(3) Updated version of MOSART with support for the same NLDAS2 regional + grid + +(4) NLDAS2 data atmosphere forcing: over the same regional grid; forcing + data are available from 1980 - 2018. (We have excluded 1979 because + a small amount of data were missing for that year, and we didn't + have a good way to handle those missing data.) + +These changes can be used independently or all together. However, note +that you will get garbage if you try to use the new NLDAS2 datm forcing +for a run that extends beyond the boundaries of the NLDAS2 domain. + +There are three new NWP compsets: +- I2000Ctsm50NwpSpGswpGs: GSWP3 datm forcing; meant for global runs or + regional runs outside the NLDAS domain +- I2000Ctsm50NwpSpNldasGs: NLDAS2 datm forcing; meant for regional runs + over the NLDAS domain or some portion of it +- I2000Ctsm50NwpSpNldasRsGs: Same as above, but with a stub runoff model + in place of MOSART, for runs that aren't interested in having a runoff + model and for which you want improved throughput + +The alias for the new grid is: nldas2_rnldas2_mnldas2 (indicating that +we're using the nldas2 grid for land/atmosphere, runoff ('r') and the +ocean mask ('m'). + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#451 (Add NWP physics option) +- Resolves ESCOMP/ctsm#452 (Add an NWP compset) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- The NWP configuration is still a work in progress +- The NLDAS surface data set is still a work in progress (will soon + update this to use high-res PFTs) + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- New xml variables: + - CLM_CONFIGURATION (will eventually be renamed to CTSM_CONFIGURATION) + - CLM_STRUCTURE (will eventually be renamed to CTSM_STRUCTURE) +- New namelist variable: + - itmax_canopy_fluxes + +Changes made to namelist defaults (e.g., changed parameter values): +No changes for existing CLM compsets; new defaults for NWP compsets + +Changes to the datasets (e.g., parameter, surface or initial files): +No changes for existing grids; new surface dataset for nldas2 grid + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- New tests covering NWP compsets, nldas grid and nldas datm forcing + +Code reviewed by: Mike Barlage, Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - ok + + tests pass; namelists change as expected + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- pass + hobart ------ pass + +CTSM tag used for the baseline comparisons: ctsm1.0.dev037 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- MOSART: release-cesm2.0.00 -> nldas-grid.n01_mosart1_0_31 +- CIME: ctsm/ctsm1.0/cime5.7.9/n04 -> ctsm/ctsm1.0/cime5.7.9/n05 + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/682 +- https://github.com/ESCOMP/ctsm/pull/685 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev037 +Originator(s): sacks (Bill Sacks) +Date: Mon Apr 29 16:11:47 MDT 2019 +One-line Summary: Change year alignment for present-day I compsets + +Purpose of changes +------------------ + +Change year alignment for present-day I compsets (typically, these +compsets have aliases beginning with "I2000"), in order to work better +for cases that are meant to replicate particular years. + +(1) Start the model in year 2000 rather than year 1 + +(2) Change datm's year alignment so that model year 2000 uses +observations from year 2000, model year 2001 uses observations from year +2001, etc. + +(This change was requested by Sean Swenson and supported by Dave +Lawrence.) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- Year-2000 compsets now start in model year 2000 rather than 1 + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: cime changes reviewed by Erik Kluzek and others + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, year-2000 cases change answers as expected + +CTSM tag used for the baseline comparisons: ctsm1.0.dev036 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: Present-day compsets (I2000, I1Pt; also I2010 once those compsets are added) + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff/same climate + + This changes the year alignment of datm. Climatological averages + should be the same as before, but the alignment of model year to + datm year changes. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: ctsm/ctsm1.0/cime5.7.9/n03 -> ctsm/ctsm1.0/cime5.7.9/n04 + +Pull Requests that document the changes (include PR ids): +- cime changes documented in https://github.com/ESMCI/cime/pull/3093 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev036 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Fri Apr 26 01:20:57 MDT 2019 +One-line Summary: Fix carbon isotope bug that caused wrong answers for isotopes under transient land-use change + +Purpose of changes +------------------ + +We currently have a bug so that for transient land-use change cases answers are different starting in soil +carbon when Carbon isotopes (use_c13, or use_c14) are on versus off. Answers are identical if there is no +land-use change. The bug does cause bulk Carbon (C12) to be slightly different, but qualitatively the same. +There is a significant impact to the Carbon isotope simulation however. The bug was causing changes in isotopic +pools to be directed to the bulk Carbon. Because, isotopes are so much smaller than bulk Carbon, this doesn't +cause a marked difference in the bulk Carbon simulation. But, the lack of the change in the isotopic pool +does have a meaningful impact on the simulation of the Carbon isotopic fields. + +Also added a general test for this and specific one to catch this case. And did some updates on documentation +files, and a small bug fix for run_sys_tests. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #692 #675 #686 + #675 -- Answers differ when carbon isotopes are on under transient cases + #686 -- Add a system test to make sure turning on carbon isotopes doesn't change answers + #692 -- run_sys_test issue + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: Added LCISO test type and a 13 month Hist test to make sure carbon isotopes + don't cause a change to answers + +Code reviewed by: dlawren, billsacks, klindsey, bishtgautum + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + tools-tests (test/tools): + + cheyenne - PASS + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - PASS (compare tests fail, because of namelist updates) + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +CTSM tag used for the baseline comparisons: ctsm1.0.dev035 + + +Answer changes +-------------- + +Changes answers relative to baseline: Only for Carbon isotopes on under transient land-use change! + + Summarize any changes to answers, i.e., + - what code configurations: Bgc with use_c13 or use_c14 T and with a transient land-use change after each year boundary + - what platforms/compilers: All + - nature of change: same climate for bulk Carbon, isotopic Carbon is quite different for regions with land-use change + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime + cime from -- ctsm/ctsm1.0/cime5.7.9/n01 to ctsm/ctsm1.0/cime5.7.9/n03 + cime update allows the new test to work and starts adding NLDAS grid in + +Pull Requests that document the changes (include PR ids): #696 #694 +(https://github.com/ESCOMP/ctsm/pull) + #696 -- run_sys_test small fix + #694 -- Carbon isotope fix + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev035 +Originator(s): sacks (Bill Sacks) +Date: Mon Apr 22 20:17:40 MDT 2019 +One-line Summary: Change h2ocan to a purely diagnostic variable + +Purpose of changes +------------------ + +Previously, h2ocan_patch was maintained through the driver loop as the +sum of liqcan_patch and snocan_patch. However, there were places where +it was updated separately (though consistently) - i.e., it was not +simply a matter of 'h2ocan = liqcan + snocan'. This made the code +more complex, especially for the upcoming addition of water tracers. + +This tag changes h2ocan_patch to be a purely diagnostic variable, set +once at the end of the driver loop. Prognostic equations that used to +use h2ocan now use liqcan and snocan, either directly or indirectly via +a temporary variable set equal to the current value of liqcan+snocan. + +This tag also completely removes support for snowveg_flag = 'OFF' in +order to clean up the code. + +In addition, this tag renames the namelist variable snowveg_flag to +snowveg_affects_radiation (now a logical). + +Finally, this tag includes a minor change to always compute fcansno, +even if snowveg_affects_radiation is false, in order to simplify the +code. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#199 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- snowveg_flag renamed to snowveg_affects_radiation, and changed to a + logical flag + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: +- Answer-changing portion of these changes reviewed by Keith Oleson and + (at least to some extent) Sean Swenson + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, answers change as expected + +CTSM tag used for the baseline comparisons: ctsm1.0.dev034 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + roundoff + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + I split these changes into two pieces: (1) an answer-changing piece + where I made minimal changes to replace uses of h2ocan_patch with + liqcan+snocan (via temporary h2ocan variables holding this sum), + and (2) non-answer-changing code cleanup. (1) consisted of the + first two commits on this branch (461cafea and f195c105). With the + changes in (1), I added checks near each change to ensure that the + new expression differed by no more than roundoff from the old + (using an absolute cutoff of 1e-13). I ran the full test suite with + these checks in place, and generated new baselines. I then compared + the changes in (2) with the baselines from (1); this cleanup step + was bit-for-bit except for roundoff-level changes in the + now-diagnostic-only field H2OCAN. + + As noted in ESCOMP/ctsm#689, the changes in (1) were larger than I + expected, presumably because initially roundoff-level differences + can lead to divergent code behavior. The most obvious example of + this is in the check of h2ocan > 0 in subroutine FracWet. I have + found that, due to roundoff errors, it is possible for h2ocan_patch + > 0 by roundoff, while (liqcan_patch + snocan_patch) <= 0 by + roundoff. (Presumably the reverse could also be true, though I + haven't seen that – but I haven't spent much time looking for it.) + + Soon, we plan to do a more rigorous test to double check that this + change is not climate-changing. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- First part of changes in https://github.com/ESCOMP/ctsm/pull/689 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev034 +Originator(s): sacks (Bill Sacks) +Date: Sat Apr 20 06:11:23 MDT 2019 +One-line Summary: Change clm4_5: Use Justin Perket snow on vegetation + +Purpose of changes +------------------ + +This tag changes the behavior of clm4_5, making it now use Justin +Perket's snow on vegetation parameterization. This parameterization was +originally introduced in clm4_5_1_r112. At the time it was only used for +clm5_0 cases. This tag uses that parameterization for clm4_5 cases, too, +so that (like clm5_0) they use snowveg_flag = 'ON_RAD' (i.e., vegetation +snow canopy on with albedo influence). + +This changes climate for clm4_5, mainly through albedo changes, +particularly in the shoulder seasons. + +The reason for this change is to allow an upcoming cleanup of the +relationship between h2ocan, snocan and liqcan. (See +https://github.com/escomp/ctsm/issues/199 for details.) + +This tag also no longer allows snowveg_flag = 'OFF'. However, code +cleanup is deferred to a follow-on tag, in order to separate the answer +changes in this tag from the no-greater-than-roundoff-level changes in +the follow-on tag. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- First step towards addressing ESCOMP/ctsm#199 (Clean up relationship + between h2ocan, snocan and liqcan) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- Changes the scientific configuration of clm4_5 cases, as noted above + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): +- For clm4_5: snowveg_flag = 'ON_RAD' rather than 'OFF' + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- Need to clean up code involving snowveg_flag, liqcan, snocan and + h2ocan. I will do this in a follow-on tag. + +Changes to tests or testing: +- Added a test with snowveg_flag = 'ON'. (At least some of the code + paths triggered by this setting were previously covered by clm45 + cases. Now that both clm45 and clm50 use snowveg_flag = 'ON_RAD', + there was some uncovered code. This new test covers this code.) +- Changed long single-point tests to use Qian forcing: With the default + GSWP3 forcing, the vast majority of the runtime was being spent in + datm. In addition, I was getting repeated failures of + ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropGs.cheyenne_intel.clm-cropMonthOutput, + I think due to memory issues; I'm hopeful that changing the datm + forcing will help with that. + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass; NLCOMP and BASELINE failures for Clm45 cases, + as expected + +CTSM tag used for the baseline comparisons: ctsm1.0.dev033 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (clm4_5) Important + + Summarize any changes to answers, i.e., + - what code configurations: Clm45 compsets + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + New climate (as in clm4_5_1_r112 for clm5_0); the main impact is + through albedo changes, particularly in the shoulder seasons. + + Changes in clm4_5 cases are due to: + + (1) Using snowveg_flag = 'ON_RAD' rather than 'OFF' + + (2) Changed initial conditions for canopy water: Rather than using + H2OCAN, which is the meaningful state variable on previous + clm4_5 initial conditions files, now we use LIQCAN and + SNOCAN. These may be 0, although at least some clm4_5 initial + conditions files (including the two non-Fates out-of-the-box + clm4_5 initial conditions files) have non-zero (though still + reasonable) LIQCAN for reasons I can't understand. + + (Also changes answers for + ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline, + which uses a clm45 initial file.) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev033 +Originator(s): slevis (Samuel Levis, SLevis Consulting LLC, 303-665-1310) +Date: Thu Apr 11 10:51:29 MDT 2019 +One-line Summary: Limit landunit presence with thresholds set in the namelist + +Purpose of changes +------------------ + + Faster simulations. Motivated by NWP applications: + - Introduce user-defined namelist parameters to use as thresholds + above which landunit areas are kept and + below which landunit areas are removed. + - Introduce user-defined logical namelist parameter to collapse the up to + three urban landunits to the dominant urban landunit. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #581 + Fixes #581 -- Allow zeroing out special landunits if their area is below some threshold + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No + +Notes of particular relevance for users +--------------------------------------- + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + - New namelist variables with valid real values from 0._r8 to 100._r8, where + 0 means "do nothing" and other values determine the threshold above + which to keep the landunit in a gridcell. The new variables are: + toosmall_soil + toosmall_crop + toosmall_glacier + toosmall_lake + toosmall_wetland + toosmall_urban + - New logical namelist variable collapse_urban. If .true. then the up to + three urban landunits collapse to the dominant urban landunit. + +--------------------------------------------- +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + There's a typo in the name for n_dom_landunits (missing the s) in bld/CLMBuildNamelist.pm + build-namelist doesn't check for toosmall_* below 0 or above 100, but the code does + +Changes to tests or testing: Yes + New unit tests subroutine test_collapse_individual_lunits and + test_collapse_all_lunit_opts_active in test_surfrdUtils.pf + Modified standard suite test + ERS_D_Ld10.f10_f10_musgs.IHistClm50BgcCropGs.cheyenne_intel.clm-collapse_to_dominant_decStart + to + ERS_D_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_intel.clm-rm_indiv_lunits_and_collapse_to_dom + and introduced fatal error message when namelist parameters toosmall_* > 0 or + n_dom_* > 0 in transient simulations + +Code reviewed by: Erik Kluzek, Bill Sacks + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (384 differences because of new namelist items) + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + +CTSM tag used for the baseline comparisons: + cheyenne ctsm1.0.dev031 + hobart ctsm1.0.dev032 + + +Answer changes +-------------- + +Changes answers relative to baseline: No + Note: Comparison to baseline gives NLCOMP failures because the new namelist + parameters always appear in the namelist now, even when they have not been + changed from their default value by the user. + +Detailed list of changes +------------------------ + - Introduced call to new subroutine collapse_individual_lunits that uses + the user-defined namelist variables listed above to determine whether + a landunit gets kept or removed from a gridcell. + - Introduced new call to collapse_to_dominant for when collapse_urban = .true. + - Introduced error checks that do not allow coexistence of transient + simulations and the toosmall_* variables OR the n_dom_pfts/n_dom_landunits + variables OR the collapse_urban parameter. + +Pull Requests that document the changes (include PR ids): #641 + https://github.com/ESCOMP/ctsm/pull/641 + #641 -- Ability to remove individual landunits for faster runs + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev032 +Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) +Date: Mon Apr 8 08:26:57 MDT 2019 +One-line Summary: Fixing the balance check to check for possible errors over all columns/patches + +Purpose of changes +------------------ +Up until now, the BalanceCheckMod code in biogeophysics did not check all +the possible errors over all columns or patches with the error threshold for +aborting clm and it merely compared the last column/patch found (where +warning threshold is met) with the error threshold. +Therefore, there was always a possibility that the abort is not triggered +when it should have been. This issue was first mentioned in ctsm issue #55 +for soil energy balance check, but a similar issue is also present for +other balance checks in BalanceCheckMod.F90 . + +Below is the list of the balance checks with a similar issue: +1. Water balance check +2. Snow balance check +3. Solar radiation energy balance check +4. Longwave radiation energy balance check +5. Surface energy balance check +6. Soil energy balance check (Issue #55) + +For remediating this issue, we used MAXVAL and MAXLOC Fortran intrinsic functions +to compare the largest error with the warning and error thresholds instead +of checking the last column or looping over all columns. + + +In addition, this PR also makes slight changes to ./run_sys_tests outputi/case +directory structure. Previously for each case in a test suite, there were +two set of directories created by run_sys_tests as follows: + * one directory which included run/ and bld/ and named as $SCRATCH/[case-name].... + * The case directory which included logs , timings, CaseDocs/, and misc. scripts + for ./case.build, ./case.submit... under $SCRATCH/tests-[testID]/[case-name].... + +This made debugging confusing and populated many folders in user's scratch. +Now, for every case in a test, all directories related to that case +including bld/ and run/ directories are nested under the case directory under $SCRATCH/tests-[testID]/[case-name].... +This is now similar to ./create_test output folder structure. + + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm issue#55 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: + - ./run_sys_test is changed so that it nests bld/ and run/ directories under the case directory as $SCRATCH/tests-[testID]/[case-name]... + The output folder structure now is similar to ./create_test for each case in a test. + +Code reviewed by: Bill Sacks + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + +CTSM tag used for the baseline comparisons: ctsm1.0.dev031 + + +Answer changes +-------------- + +Changes answers relative to baseline: No + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/670 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev031 +Originator(s): sacks (Bill Sacks) +Date: Wed Mar 13 15:03:42 MDT 2019 +One-line Summary: Subtract virtual states to reduce dynbal fluxes for transient glaciers + +Purpose of changes +------------------ + +Up until now, when computing the dynbal correction (conservation) fluxes +for transient glacier columns, we have been (1) counting the mass and +energy in the ice column as if that is a real state, but on the other +hand (2) NOT accounting for the fact that glacier columns don't +represent the soil under glacier. These two issues work in opposite +directions, but (1) dominates, because there is much more ice (and +energy, I think) in the roughly 50 m of glacial ice than there is in a +typical 50 m soil column. + +In discussing this issue with Bill Lipscomb, we came up with the idea of +subtracting some baseline value from each glacier column. I think that, +as long as we subtract the same baseline value throughout an entire +simulation for a given column, we will still conserve mass and energy +through dynamic landunit transitions. + +So, here we subtract baseline values from glacier columns, accounting +for the two issues mentioned above: (1) we subtract the water and energy +in the glacier ice, because this is a virtual state in CTSM, and (2) we +add the water and energy from the vegetated column(s), to account for +the fact that we don't have an explicit representation of +soil-under-glacier (this carries the assumption that the +soil-under-glacier has the same state as the initial vegetated state in +that grid cell). We set these baselines in initialization, so they begin +equal to the cold start state. Water and ice in the glacial ice stay +fixed over the course of a simulation, so the cold start values should +be the same as the current values at any point in time. The heat content +of the glacial ice does change over time, but by subtracting this +baseline value, we can potentially reduce the dynbal sensible heat +fluxes (however, note that it's also possible that these sensible heat +fluxes could increase when subtracting the cold start value, if ice +temperatures are closer to 0 deg C than to the cold start value, +currently 250 K). + +In addition, this introduces a new namelist flag, +reset_dynbal_baselines, which allows the user to reset these baselines +at some desired point in the simulation. I think that, in general, this +resetting would break conservation. But as long as it is done before the +onset of transient glaciers, I think this should be okay. In this way, +the user can minimize dynbal fluxes even further, by resetting the +baselines after the system has spun up. If the states haven't changed +much from this point to the point when glacier dynamics occur, then the +dynbal fluxes should now be very small. (See the documentation of this +flag in namelist_definition_ctsm.xml for more details.) + +Without this change, dynbal fluxes for a grid cell that undergoes 100% +glaciation / deglaciation in a single year are around 50 m ice, 1 m +liquid water, and a few tens of W m-2 (where those quantities of ice and +water are dribbled throughout the year, so we end up with an ice flux of +about 1.5e-6 mm/s throughout the year; and the energy flux is applied +evenly throughout the year - i.e., tens of W m-2 every time step for a +year). With this change, and with reset_dynbal_baselines set at an +appropriate time, these fluxes can be reduced to close to zero. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Partially addresses ESCOMP/ctsm#274 (Dynamic landunits: improve water + and energy conservation) + +CIME Issues fixed (include issue #): +- Fixes three issues related to inputdata checksum: + - ESCMI/cime#3033 + - ESCMI/cime#3034 + - ESCMI/cime#3036 + +Known bugs introduced in this tag (include github issue ID): +- ESCOMP/ctsm#659 (Subtract dynbal baselines from begwb and endwb) + - This can't be fixed until we're okay having this answer change on + master + +Known bugs found since the previous tag (include github issue ID): +- ESCOMP/ctsm#658 (Methane should not depend on gridcell-level TWS) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] clm4_5 + +Significant answer changes for runs with transient glaciers. + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- For runs with transient glaciers, careful thought should be given to + when to set reset_dynbal_baselines +- Inconsistency between begwb/endwb and liq1/liq2/ice1/ice2 (see ESCOMP/ctsm#659) + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- New namelist variable: reset_dynbal_baselines + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- Inconsistency between begwb/endwb and liq1/liq2/ice1/ice2 (see ESCOMP/ctsm#659) + +Changes to tests or testing: +- Tweaked a test with transient glacier areas, including adding this new + flag to the test + +Code reviewed by: Bill Lipscomb reviewed the conceptual ideas, but +nobody has reviewed the actual code + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, answers change as expected + +CTSM tag used for the baseline comparisons: ctsm1.0.dev030 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (Important) + + Summarize any changes to answers, i.e., + - what code configurations: ALL, but different configurations show + different levels of changes, as noted below + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + - new climate (at least regionally) for some configurations; + roundoff for others: see below + + There are three levels of changes here: + + (1) For runs with transient glaciers, there are large answer changes + in regions with changing glacier area. These answer changes are + in the various dynbal fluxes - for liquid water and ice runoff, + and for the dynbal sensible heat flux. + + (2) For runs with transient vegetation (Hist, Dv and Fates), there + are roundoff-level changes in the dynbal fluxes. For liquid + water and ice, these changes appear to only occur in grid cells + where there is some glacier area (because now both the before + and after gridcell water contents have changed by the same fixed + amount, which changes the difference at the roundoff level). For + heat, there are roundoff-level changes everywhere (because of + changes in the order of operations). + + (3) All runs have large changes in the diagnostic variables, + ICE_CONTENT1, LIQUID_CONTENT1 and HEAT_CONTENT1, over grid cells + containing some glacier area. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: cime5.7.9 -> ctsm/ctsm1.0/cime5.7.9/n01 + - Fixes issues related to inputdata checksum + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/650 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev030 +Originator(s): sacks (Bill Sacks) +Date: Fri Mar 8 15:08:34 MST 2019 +One-line Summary: Update CIME; hookup expected test fails + +Purpose of changes +------------------ + +Two main changes: + +(1) Update to latest cime (from ctsm/ctsm1.0/cime5.7.5/n01 to + cime5.7.9). Some of the important changes are: + - Fix for recent cheyenne system changes + - New domain file for f19_g17 (changes answers at the roundoff + level) + - New domain file for T31_g37 (changes answers by greater than + roundoff) + +(2) In system tests: Annotate cs.status output with expected failures + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes ESCOMP/ctsm#654 + +CIME Issues fixed (include issue #): (Many) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none? + The PFS test showed a significant speedup (170s in the previous tag, + 124s in this tag). However, some other tests showed either a slowdown + or not much change. So I'm not sure there is a consistent pattern of + speedup in this tag. + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, some baselines failed as noted below + + Most testing done with cime at eb2eb704f - excluded PR #3030, which + updated support for CAM-SE grids (but the changes in this PR were + very limited). Ran SSP tests with the final version of cime (so I'd + have a few tests covering the latest cime). + +CTSM tag used for the baseline comparisons: ctsm1.0.dev029 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (f19_g17, T31_g37 small) + + Summarize any changes to answers, i.e., + - what code configurations: f19_g17, T31_g37 + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + - f19_g17: roundoff-level, presumably due to new domain file (some + diffs grew to greater than roundoff-level: some methane + variables in a long test - + SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput; + and many variables in test with flooding - + ERP_P180x2_D.f19_g17.I2000Clm50SpRtmFl.cheyenne_intel.clm-default) + + - T31_g37: greater than roundoff-level, presumably due to new + domain file from cime commit 4fcf592ee + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: ctsm/ctsm1.0/cime5.7.5/n01 -> cime5.7.9 + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/602 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev029 +Originator(s): slevis (Samuel Levis, SLevis Consulting LLC, 303-665-1310) +Date: Tue Feb 26 23:42:39 MST 2019 +One-line Summary: Collapse landunits to the N most dominant + +Purpose of changes +------------------ + + Allows the collapse to fewer landunits using the concept of + N most dominant for the purpose of faster runs, eg in the context + of NWP (Numerical Weather Prediction). + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #581 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + New namelist variable n_dom_landunits with valid integer values from 0 to + max_lunit currently equal to 9, where 0 means “do nothing” and other + values determine the number of active landunits when running the model. + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + There is a question left in on whether the collapse call needs to also + be moved to inside dynamic landunits reading. + +Changes to tests or testing: Yes + ERS_D_Ld10.f10_f10_musgs.IHistClm50BgcCropGs.cheyenne_intel.clm-collapse_to_dominant_decStart + now replaces (by combining with) this test introduced in ctsm1.0.dev026 + ERS_D_Ld10.f10_f10_musgs.IHistClm50BgcCropGs.cheyenne_intel.clm-collapse_nat_pfts_decStart + I added subroutine test_collapse_to_dom_landunits to test_surfrdUtils.pf + to include new Unit Tests. In same file I renamed + subroutine test_collapse_nat_pfts to test_collapse_to_dom_pfts + to accurately describe the contents of the subroutine. + +Code reviewed by: Erik Kluzek + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +CTSM tag used for the baseline comparisons: + ctsm1.0.dev028 + + +Answer changes +-------------- + +Changes answers relative to baseline: No + +Detailed list of changes +------------------------ + + Replaced existing subroutine collapse_nat_pfts with + subroutine collapse_to_dominant which can collapse to the + N dominant landunits or N dominant pfts by performing the + same actions on the data. + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #639 + https://github.com/ESCOMP/ctsm/pull/639 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev028 +Originator(s): sacks (Bill Sacks) +Date: Tue Feb 26 14:35:01 MST 2019 +One-line Summary: Interpolate out-of-the-box initial conditions and remove expensive tests + +Purpose of changes +------------------ + +Two main changes (plus some small additional changes): + +1. Removed / reworked some expensive tests + +2. Interpolated all out-of-the-box initial conditions, so that the + out-of-the-box version is now compatible with our current + configuration. The changes from before were (a) our standard + configuration now uses the gx1v7 rather than gx1v6 land mask; (b) + many inactive points are now absent in memory. + +See https://github.com/ESCOMP/ctsm/pull/622 for details. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#312 +- Partially addresses ESCOMP/ctsm#275 (just a bit) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): +- New finidat files + +Substantial timing or memory changes: +- Faster initialization times for cases that no longer need to interpolate initial conditions + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Removed or reworked expensive tests: see details in https://github.com/ESCOMP/ctsm/pull/622 + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok: tests pass, baselines fail as expected + +CTSM tag used for the baseline comparisons: ctsm1.0.dev027 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (just for initial conditions) + + Summarize any changes to answers, i.e., + - what code configurations: all configurations that still need use_init_interp = .true. + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Not investigated carefully, but expected to be larger than roundoff/same climate + + Answers change for cases that still need to do interpolation from + these out-of-the-box finidat files. + + I first confirmed that the new finidat files are good via: + + - Compared `ncdump -h` of old vs. new initial conditions files + + - Ran the following tests, with comparison against master; verified that + these all pass and are bit-for-bit, that they use the new initial + conditions files, and that they now have `use_init_interp` unset + (whereas they used to have `use_init_interp` set to `.true.`); note + that these cover 6 of the 7 new initial conditions files: + + ``` + SMS_Ld1.f09_g17.I1850Clm45BgcGs.cheyenne_intel.clm-default + SMS_Ld1.f09_g17.I1850Clm45BgcCruGs.cheyenne_intel.clm-default + SMS_Ld1.f09_g17.I1850Clm50Sp.cheyenne_intel.clm-default + SMS_Ld1.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-ciso + SMS_Ld1.f09_g17.I1850Clm50BgcCropCru.cheyenne_intel.clm-ciso + SMS_Ld1.f09_g17.I1850Clm50SpCru.cheyenne_intel.clm-default + ``` + + - To cover the last new initial conditions file, ran the following test + (with the same checks as above: passes and bit-for-bit, checked + finidat, and checked `use_init_interp`), with `./xmlchange + LND_TUNING_MODE=clm5_0_cam6.0` (for the baseline for this test, I set + `init_interp_method = 'use_finidat_areas'`, which I also used in + interpolating this initial conditions file): + + ``` + SMS_Ld1.f09_g17.I1850Clm50BgcCrop.cheyenne_intel + ``` + + Details on answer changes: + + As noted above, these changes are bit-for-bit for configurations + that can now use the out-of-the-box initial conditions without + interpolation. However, answers change for configurations that still + require interpolation of the out-of-the-box initial conditions + (e.g., because they are at a different resolution than the finidat + file). + + I expected these answer changes around the Caspian Sea, due to the + fact that we are now effectively interpolating twice from the + original file: once to produce the new out-of-the-box file (which + includes an interpolation from `gx1v6` to `gx1v7`, and so + interpolates onto the Caspian Sea region) and once to go from + `f09_g17` to the target resolution (rather than interpolating + directly from `f09_g16` to the target resolution). + + However, when I ran a test with comparison to baselines - + `ERP_Ld5.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-default` - I saw + changes in regions further afield than simply around the Caspian + Sea. See images in https://github.com/ESCOMP/ctsm/pull/622 for + details. It's possible that the other differences are also due to + the Caspian Sea change, but it's also possible that there is some + other cause here that I don't understand. But Erik Kluzek and I + agreed that it isn't worth trying to understand these other + (isolated) differences. + + Also note: While most f09_g17 tests are bit-for-bit with the earlier + tag (because now use_init_interp is .false. for those tests), + `SMS_Ld2_D.f09_g17.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic_interp` + differs in some glc forcing fields for a few grid cells in + Antarctica. This is perhaps not surprising, since this test needs to + use interpolation to get fields for the Antarctica virtual columns; + so, while I don't completely understand the cause of these answer + changes, I suspect the root cause is similar to the isolated answer + changes I saw sprinkled around the world for + `ERP_Ld5.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-default`. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/622 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev027 +Originator(s): negins (Negin Sobhani,UCAR/CSEG,303-497-1224) +Date: Tue Feb 19 12:57:12 MST 2019 +One-line Summary: Non-constant time initialization for soil hydrology types are moved to SoilHydrologyType.F90. + +Purpose of changes +------------------ + +Initalization of time-varying `zwt`, `zwt_perched`, and `frost_table` are moved to `InitCold` in `SoilHydrologyType.F90`. + +Previously, `zwt`, `zwt_perched`, and `frost_table` were initialized in `SoilHydrologyInitTimeConstMod.F90`, which caused confusions. + +Bugs fixed or introduced +------------------------ +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#575 ("Some variables initialized in SoilHydrologyInitTimeConstMod are not time-constant") + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: Updated a test. The test added in previous tag included decStart with transient glaciers, which would not work. Hence, this test is modified so the compset does not include G. +Test IHistClm50SpG is updated to IHistClm50Sp. + +Code reviewed by: +Bill Sacks +Erik Kluzek + +CTSM testing: + + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, except for the expected failures. + +CTSM tag used for the baseline comparisons: +ctsm1.0.dev026 + +Answer changes +------------- + +Changes answers relative to baseline: no + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + +Pull Requests that document the changes (include PR ids): +PR #631 Soil hydrology initialization of time-constant variables moved to SoilHydrologyType +https://github.com/ESCOMP/ctsm/pull/631 + + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev026 +Originator(s): slevis (Samuel Levis, SLevis Consulting LLC, 303-665-1310) +Date: Tue Feb 5 17:08:48 MST 2019 +One-line Summary: Collapse unmanaged PFTs to the N most dominant + +Purpose of changes +------------------ + +To run simulations fast for applications such as NWP (Numerical Weather +Prediction), allow collapsing natural PFT's to the number the user wants. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): 457 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +New namelist parameter n_dom_pfts with valid integer values from 0 to +14, where 0 means “do nothing” and other values determine the number +of active pfts when running the model + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None (unless new option invoked) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: updated tests, added new test +Updated standard testing test to include decStart +(December start). Confirmed that answers were bit-for-bit same with +baseline before introducing the change. +Added standard testing test to test n_dom_pfts = 2 in a +transient vegetation case with December start. +Added subroutine test_collapse_nat_pfts to test_surfrdUtils.pf to +include new Unit Tests. + +Code reviewed by: +Erik Kluzek +Bill Sacks + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- OK + hobart ------ OK + +CTSM tag used for the baseline comparisons: +ctsm1.0.dev025 + +Answer changes +-------------- + +Changes answers relative to baseline: No (bit-for-bit) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/588 -- NWP collapse pfts to the N most dominant +https://github.com/ESCOMP/ctsm/pull/583 -- Add routine to find indices of max k values in data + +Added new subroutines collapse_nat_pfts and collapse_crop_var and called +them from surfrdMod.F90. The second of these subroutines is not needed +when collapsing unmanaged PFTs; however, I created it early in the PR +and decided to keep it for use soon with crop-related variables like +irrigation water and fertilizer. + +Bill Sacks made changes to include subroutine find_k_max_indices for the +benefit of this PR (#583) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev025 +Originator(s): Keith Oleson, Bill Sacks +Date: Wed Jan 23 10:48:01 MST 2019 +One-line Summary: History fields for vertically-resolved sums of soil C and N, and minor fixes + +Purpose of changes +------------------ + +Main change is from Keith Oleson: Add history fields for +vertically-resolved sums of SOIL1C, SOIL2C, and SOIL3C for C12, C13, +C14, and similarly for N. New fields are SOILC_vr, C13_SOILC_vr, and +C14_SOILC_vr, and SOILN_vr. For runs that use the output_bgc usermods, +including cmip6 runs, we no longer output 'SOIL1C_vr', 'SOIL1N_vr', +'SOIL2C_vr', 'SOIL2N_vr', 'SOIL3C_vr', 'SOIL3N_vr'; instead we output +'SOILC_vr', 'SOILN_vr', and similarly for C isotopes. + +Also minor fixes: +- Output cpl hist files in SSP test (resolves ESCOMP/ctsm#61) +- Remove FATES-related commented-out code in OzoneMod (this has been + moved to https://github.com/ESCOMP/ctsm/issues/618) +- Minor tweak to run_sys_tests + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#61 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): +- For runs that use the output_bgc usermods, including cmip6 runs, we no + longer output 'SOIL1C_vr', 'SOIL1N_vr', 'SOIL2C_vr', 'SOIL2N_vr', + 'SOIL3C_vr', 'SOIL3N_vr'; instead we output 'SOILC_vr', 'SOILN_vr', + and similarly for C isotopes. + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Bill Sacks; Erik Kluzek reviewed the changes to the SSP test + + +CTSM testing: + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- pass + hobart ------ pass + +CTSM tag used for the baseline comparisons: ctsm1.0.dev024 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/551 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev024 +Originator(s): slevis (Samuel Levis,SLevis Consulting, LLC, 303-665-1310) +Date: Mon Jan 14 11:07:04 MST 2019 +One-line Summary: Remove unnecessary restart variables + +Purpose of changes +------------------ + +Remove unnecessary restart variables to conserve on computing resources +and disk space + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): 285 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + +Changes made to namelist defaults (e.g., changed parameter values): + +Changes to the datasets (e.g., parameter, surface or initial files): + +Substantial timing or memory changes: + +Notes of particular relevance for developers: +Code reviewed by Bill Sacks. +Standard testing (cheyenne and hobart) OK +Unit testing PASS +--------------------------------------------- + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: + +Code reviewed by: Bill Sacks + +CTSM testing: +Regular testing (cheyenne and hobart) OK +Unit testing PASS + +CTSM tag used for the baseline comparisons: +ctsm1.0.dev023 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO (bfb) + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/598 + +Variables removed from restart: +plant_nalloc +pot_f_nit_vr* +f_nit_vr* +root_depth +qflx_floodg +snounload +qflx_snofrz_lyr +sminn_to_plant_fun_patch + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev023 +Originator(s): sacks (Bill Sacks) +Date: Thu Jan 10 13:00:42 MST 2019 +One-line Summary: Remove CLM4.0 + +Purpose of changes +------------------ + +Remove CLM4.0. This consists of removing code and other files that are +specific to CLM4.0, and doing some resulting cleanup of code that was +shared between CLM4.0 and later versions (primarily in build-namelist). + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves #455 (Remove CLM4.0) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- Can no longer run CLM4.0 cases + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- CLM4.0 compsets no longer supported + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: Removed CLM4.0 tests + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + build-namelist tests: + + cheyenne - pass + + tools-tests (test/tools): + + cheyenne - pass + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - ok + + Total number of tests = 52 + Number of tests that PASS = 51 + Number of tests that Fail = 1 + Number of compare tests that PASS = 37 + Number of compare tests that Fail = 4 + Number of tests without compare = 11 + + The one failing test is: + FAIL fail-no_towerdata.-d+/glade/p/cesmdata/cseg/inputdata++-s+RF-Bra+--debug+--pftgrid+--soilgrid. + + These same failures occurred in ctsm1.0.dev022 (including the + compare tests that Fail). Erik Kluzek says these failures are + okay. + + regular tests (aux_clm): + + cheyenne ---- pass + hobart ------ pass + + Notes on testing: + + - Most testing done on b5380c7e8. Since then, updated to a version of + cime that fixes cime's configure tool (but this isn't invoked in + system tests, so I didn't rerun the system tests) and pointed cime + to a tag rather than a hash. + + - For tools tests: In baseline, cherry-picked commit 148bc2158 into + cime + +CTSM tag used for the baseline comparisons: ctsm1.0.dev022 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: points to branch tag off of cime5.7.5 + (ctsm/ctsm1.0/cime5.7.5/n01), with changes for: + (1) Removal of support for CLM4.0 (equivalent to the changes in + https://github.com/ESMCI/cime/pull/2968) + + (2) Fix for cime configure (cherry-picked 148bc2158) + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/609 (Remove CLM4.0) +- https://github.com/ESCOMP/ctsm/pull/601 (Print git status and related + info when running run_sys_tests) + + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev022 +Originator(s): sacks (Bill Sacks) +Date: Tue Jan 8 11:01:38 MST 2019 +One-line Summary: Set tracer version of irrigation fluxes + +Purpose of changes +------------------ + +Set tracer version of irrigation fluxes. + +This required a substantial rewrite of ApplyIrrigation (now renamed to +CalcIrrigationFluxes). The problem was that the code was written to +compute the total irrigation withdrawal from groundwater, then use this +to compute the application fluxes (drip/sprinkler), then later divide +this total withdrawal by layer. But for tracer fluxes to be computed +correctly, we needed to reorder this, so that the per-layer withdrawals +are determined before determining the application fluxes. This is +because the application flux needs to know the tracer concentrations of +the source, which requires knowing which layers the source is drawing +from. This was made more challenging because of the mix of patch-level +and column-level variables at play: irrigation demand is patch-level, +groundwater availability and extraction is column-level, but application +is back to patch-level. + +In a somewhat-related change, I also reworked the passing of information +between soil hydrology (groundwater availability) and irrigation: +Previously, there was some near-duplicate code in +CalcAvailableUnconfinedAquifer (which was called prior to +ApplyIrrigation) and WithdrawGroundwaterIrrigation (which was called +after ApplyIrrigation). I have reworked the code to remove this +duplication, calling the new CalcIrrigWithdrawals in the midst of +CalcIrrigationFluxes. In doing so, I reconciled an accidental +discrepancy between the two original routines (see +https://github.com/escomp/ctsm/issues/595). + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#521 (Set tracer versions of fluxes set by + ApplyIrrigation) +- Resolves ESCOMP/ctsm#593 (Generalize groundwater irrigation availability to + handle multiple patches per column) +- Resolves ESCOMP/ctsm#595 (Inconsistency between CalcAvailableUnconfinedAquifer + and WithdrawGroundwaterIrrigation) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: + +- Sean Swenson reviewed the initial parts of the rework of + ApplyIrrigation and the passing of information between soil hydrology + and irrigation + +CTSM testing: + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, expected baseline failures as noted below + + Additional manual testing: + + - Out of the box, the one-timestep tracer consistency test + (SMS_D_Ln1.f10_f10_musgs.I2000Clm50BgcCropGs.hobart_nag.clm-tracer_consistency) + passed when the new check was inserted after the irrigation call, + even without the changes in this tag. Presumably this is because no + irrigation was being done in the first time step of this test. To + confirm that the changes here were both necessary and effective, I + hacked the code to force irrigation of all types (surface and + groundwater) on the first time step (see + https://github.com/billsacks/ctsm/commit/d28a03145). I confirmed + that this test, with those code hacks, failed before the changes in + this tag, and passed with these changes in place. + + - I used a multi-step process to confirm that these changes are only + roundoff-level different for groundwater irrigation (because + feedbacks in the system result in + SMS_D_Ld5.f10_f10_musgs.I2000Clm50BgcCrop.hobart_nag.clm-irrig_alternate + looking greater-than-roundoff-level different from the baseline): + + (1) Confirmed that e507fe603 is only roundoff-level different from + baseline using cprnc output from this test. + + (2) Confirmed that a4a1a626c is only roundoff-level different from + e507fe603. This was the tricky part. I did this by introducing + some temporary code that (a) computed some fluxes in both the + old and new ways, (b) compared the old and new methods for each + point and time step, confirming that they were no more than + roundoff-level different, then (c) set the fluxes to the old + method. I confirmed that this was bit-for-bit with e507fe603, + and the checks for greater-than-roundoff-level differences + between the old and new methods were never triggered. (See + https://github.com/billsacks/ctsm/commit/7d23e9e and the earlier + commits on that branch.) + + (3) Confirmed that remaining changes an the branch are bit-for-bit + with a4a1a626c. + +CTSM tag used for the baseline comparisons: ctsm1.0.dev021 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: + + - Small answer changes when groundwater irrigation is enabled. In + principle, could change answers by greater than roundoff due to + fix of #595, but I didn't see any answer changes in my 7-month + test due to that change. Other than that, just roundoff-level + changes. + + - Answer changes when tracers are enabled. + + - Roundoff-level changes in the diagnostic field, + QIRRIG_FROM_SURFACE, for many tests + + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + See notes under "what code configurations" for details. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/600 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev021 +Originator(s): mvr (Mathew Rothstein,UCAR/CSEG,303-497-1304) +Date: Wed Dec 26 16:29:06 MST 2018 +One-line Summary: Added tracer ratio capability and included it in consistency checks + +Purpose of changes +------------------ + +These changes are needed to support the implementation of water isotopes by ensuring +that isotope-related variables are being updated consistently throughout the model. +The consistency checks include the testing of a bulk tracer that should always be +equal to the bulk, and also test tracers that maintain a fixed ratio (other than +one) to the bulk. This commit includes fixes to the cold start initialization for +the water tracers with ratios other than one. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): [If none, remove this line] +#541 Only do water tracer consistency checks on tracers that are + supposed to maintain a fixed ratio +#459 Fix cold start initialization of water tracers +#508 Remove unused variables in new Water types +#357 Put in place Water isotope consistency checks + + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: added unit tests + +Code reviewed by: bill sacks + + +CTSM testing: + + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- PASS + hobart ------ PASS + +CTSM tag used for the baseline comparisons: ctsm1.0.dev020 + + +Answer changes +-------------- + +Changes answers relative to baseline: no, b4b + + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): #599 Adding isotope + tracer ratios +(https://github.com/ESCOMP/ctsm/pull) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev020 +Originator(s): Sean Swenson, Bill Sacks +Date: Mon Dec 3 11:51:24 MST 2018 +One-line Summary: New options for irrigation and crop fsat + +Purpose of changes +------------------ + +Introduce three new options: + +(1) Ability to withdraw irrigation water from groundwater if not enough + water is available from rivers. This is controlled via new namelist + flag, use_groundwater_irrigation. Water can be withdrawn from both + the unconfined (from the soil column) and confined (from wa) + aquifers. + +(2) Irrigation method: sprinkler (above canopy) vs. drip (below + canopy). This can be set on a per-crop and per-gridcell basis on the + surface dataset, but out-of-the-box support for creating the + necessary surface dataset field is not yet in place (see + ESCOMP/ctsm#565). For now, it can be controlled globally via a new + namelist flag, irrig_method_default. The default is drip, which was + what we were previously using implicitly. + +(3) Set crop fsat to zero. This is controlled by a new namelist option, + crop_fsat_equals_zero. + +Default behavior is the same as before for all three options. + +Also: + +- If use_aquifer_layer is false (which is the default for CLM50), no + longer reset wa_col every time step + +- Adds indices to vector history files giving column, landunit and + gridcell indices for each patch, etc. (Resolves ESCOMP/ctsm#81: + "Restart files are different for CLM when run over different number of + tasks" (issue name is a misnomer of the remaining to-dos in that + issue.) + +- Writes 3d time-constant fields on first history file for all tapes, + not just the first + +- Small performance improvements to irrigation + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/ctsm#81 ("Restart files are different for CLM when run + over different number of tasks", but that name was a misnomer for the + remaining work needed on the issue) + +Known bugs introduced in this tag (include github issue ID): +- ESCOMP/ctsm#565: Surface dataset enhancements needed for irrigation method + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- New namelist variables: + - use_groundwater_irrigation + - irrig_method_default + - crop_fsat_equals_zero +- Partial support for new surface dataset field: irrigation_method + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: +- Added two tests of the new irrigation options +- Added an _includes directory to hold things that should be included by + testmods (not used directly) + + +Code reviewed by: Bill Sacks and Sean Swenson reviewed each other's code + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - ok + + Tests pass, namelists differ as expected + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ pass + + ok: tests pass, some answers change as noted below + +CTSM tag used for the baseline comparisons: ctsm1.0.dev019 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (same climate) + + Summarize any changes to answers, i.e., + - what code configurations: Some CLM50 cases that are either cold start + or (unusually) use a CLM45 initial conditions file; it's possible + that non-cold-start configurations would see differences rarely. + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Larger than roundoff, same climate + + Differences arise due to no longer resetting wa_col to + aquifer_water_baseline every time step in BeginWaterBalanceSingle + if use_aquifer_layer is false (which is the default for + CLM50). (This change is needed to conserve water properly with the + new groundwater-based irrigation.) For the most part, wa_col + wasn't being changed when use_aquifer_layer is false (so no longer + resetting it has no effect if groundwater irrigation isn't being + used), but the one exception is the "work around of the negative + liquid water" added by Jinyun Tang in subroutine SoilWater (dated + Jan 14, 2015), which can be exercised when use_flexibleCN is + true. Sean Swenson did some experimentation, and found that the + code that updates wa_col is only exercised in the first time step + of a cold start run, and that finding is borne out in the test + suite results. However, it's possible that there are rare cases + when this is exercised later in a run. + + I have confirmed that this branch is bit-for-bit with the baseline + if I revert the addition of the use_aquifer_layer conditional + around the wa_col resetting in + BeginWaterBalanceSingle. Alternatively, nearly all tests are + bit-for-bit with the baseline if I remove the one line updating + wa_col in subroutine SoilWater (and also remove the endrun for + water balance errors from BalanceCheck); the one exception is the + waccmx_offline test, which uses a CLM45 initial conditions file in + a CLM50 configuration. + + The following tests had baseline failures: + + Cold start tests: + + ERP_D_Ld5.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-allActive + ERP_D_P36x2_Ld3.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-cropColdStart + ERP_P180x2_D_Ld5.f19_g17.I2000Clm50BgcDvCrop.cheyenne_intel.clm-crop + ERP_P36x2_Lm25.f10_f10_musgs.I2000Clm50BgcDvCrop.cheyenne_intel.clm-monthly + ERP_P72x2_Lm25.f10_f10_musgs.I2000Clm50BgcDvCrop.cheyenne_intel.clm-monthly + + Test that uses a CLM45 initial conditions file in a CLM50 + configuration: + + ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/523 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev019 +Originator(s): sacks (Bill Sacks) +Date: Fri Nov 30 13:36:57 MST 2018 +One-line Summary: Rework cold start initialization of wa and zwt + +Purpose of changes +------------------ + +Rework cold start initialization of wa and zwt when use_aquifer_layer is +false to reduce answer changes in upcoming groundwater_irrigation +branch. + +In the groundwater_irrigation branch +(https://github.com/ESCOMP/ctsm/pull/523), Sean Swenson has stopped +resetting wa_col each time step if use_aquifer_layer is false. However, +this leads to having a substantially different value of wa_col when +use_aquifer_layer is false: previously, it was reset to +aquifer_water_baseline each time step, but with Sean's changes, it stays +close to its initial values, which have been 4000 in most places. This +tag changes the initial values to match the value it was being reset to, +so it simply starts at aquifer_water_baseline - so the +every-time-step-resetting to aquifer_water_baseline can be removed +without massively changing the value of wa_col. + +In addition to changing the cold start initialization of wa_col, we are +also changing the cold start initialization of zwt in this case where +use_aquifer_layer is false: The old initialization of zwt wouldn't work +as intended now that we have changed the initial value of wa_col; Sean +Swenson suggested this new initialization method instead. This +initialization to zi(c,nbedrock(c)) is correct if there are no saturated +layers, and close enough for a decent cold start even if there are. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Sean Swenson + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, answers change as expected for some cases + +CTSM tag used for the baseline comparisons: ctsm1.0.dev018 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: CLM50 cold start or transient (Hist) cases + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + Larger than roundoff, same climate (not investigated completely + rigorously through long simulations, but Sean Swenson and Bill + Sacks are both pretty confident that the resulting changes will be + small, partly based on difference statistics from the test suite, + and partly based on the fact that the only change in this tag is + in cold start initialization of some values). + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/577 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev018 +Originator(s): sacks (Bill Sacks) +Date: Thu Nov 29 16:03:50 MST 2018 +One-line Summary: Water tracer updates for initial things in driver loop + +Purpose of changes +------------------ + +Update water tracers for initial stuff done in driver loop. This includes +atm2lnd forcings (non-downscaled and downscaled), balance check initialization, +and dyn subgrid updates. + +Broadly speaking, the changes here are: + +(1) Reworked WaterType to make it easier / more robust for other code to loop + over tracers or bulk+tracers + +(2) The most interesting changes are probably the code to update the atm2lnd + water tracers (in Wateratm2lndType.F90 and WaterTracerUtils.F90) + +(3) In various other places, do some infrastructurey stuff (initializing water + balance, doing dyn subgrid stuff) for tracers as well as bulk + +(4) Supporting unit tests and unit test infrastructure + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +Resolves ESCOMP/ctsm#487 +Resolves ESCOMP/ctsm#488 +Resolves ESCOMP/ctsm#489 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- We have chosen not to set all water tracers as soon as possible, but instead + to do these tracer settings later in the driver loop. This keeps the driver + loop cleaner, but means that you cannot arbitrarily sprinkle calls to + TracerConsistencyCheck throughout the driver. Specifically for this tag: the + non-downscaled, gridcell-level atm2lnd water tracers are not updated until + after the call to downscale_forcings, so tracer consistency checks before that + point would fail. + +Changes to tests or testing: +- Added a PFS test + +Code reviewed by: Portions of the design (and possibly code) have been reviewed +by Mat Rothstein, David Noone and Mariana Vertenstein + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, some answers change as expected + +CTSM tag used for the baseline comparisons: ctsm1.0.dev017 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: many + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + roundoff-level changes in sensible heat flux from precip conversion due to + refactoring this calculation; everything else bit-for-bit + + If bitwise differences were observed, how did you show they were no worse + than roundoff? via summarize_cprnc_diffs to see differences in the test suite + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/ctsm/pull/572 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev017 +Originator(s): slevis (Samuel Levis, Slevis Consulting LLC,303-665-1310) +Date: Wed Nov 28 14:27:50 MST 2018 +One-line Summary: Merge the collapse2gencrop branch + +Purpose of changes +------------------ + +These changes allow the model to not need to read 16-pft +datasets and rather read 78-pft datasets. The 78-pft datasets were +developed for use with prognostic crops originally. The current changes +allow the model to use the 78-pft datasets in 16-pft runs by +collapsing the crop pfts (cfts) from specific types to the model's +generic crop types. The changes are generic so that the model may still +read 16-pft datasets for 16-pft runs. Ultimately these changes will +permit users to run with any number of pfts, while the ctsm group +maintains a single set of input pft data. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): Fixes #509 (partial) + #509 -- irrigate in 1850 is off for runs with use_crop but on for those without + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Changes made to namelist defaults (e.g., changed parameter values): +- maxpatch_pft made obsolete +- nnegcrit was increased because of failure in the TRENDY simulations. +This was done in the source, rather than the namelist but does have an +effect on user behavior. + +Substantial timing or memory changes: No + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + + The "irrigate" attribute should now be removed from all fsurdat files for namelist generation. + Thus irrigate on or off is now an option for non-crop cases. + + +Renamed parameters: +maxpatch_pft is obsolete; remove from namelist-related scripts in future PR +numpft + 1 ---> maxsoil_patches +maxpatch_pft ---> maxsoil_patches in CNDV +numpft ---> maxveg +numpft_ed ---> maxveg_fates + +Several modules were made default private. The list of variables in them +that are public are explicitly listed now: +LakeCon.F90 +clm_initializeMod.F90 +clm_instMod.F90 +clm_varpar.F90 +pftconMod.F90 +subgridAveMod.F90 + +Changes to tests or testing: +New test +New unit tests in test_surfrdUtils.pf, all containing the prefix +test_collapse_crop_types_* + +Code reviewed by: +Erik Kluzek and Bill Sacks + +CTSM testing: +Regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + hobart_nag -------- PASS + hobart_pgi -------- OK + hobart_intel ------ PASS + +CTSM tag used for the baseline comparisons: ctsm1.0.dev016 + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #483 + +Sam Levis cloned Erik Kluzek's collapse2gencrop branch and then +tested, corrected errors, resolved conflicts, added unit tests, while +updating to newer tags as needed. + + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev016 +Originator(s): sacks (Bill Sacks) +Date: Thu Nov 1 07:27:48 MDT 2018 +One-line Summary: Update cime, fix FATES DEBUG token, add script to easily run system tests + +Purpose of changes +------------------ + +(1) Update to latest version of cime master + +(2) Update FATES with a minor change: change DEBUG to debug, to allow + working with a preprocessor-defined DEBUG token + +(3) Add a script (run_sys_tests) that allows easily running all system + tests (see + https://github.com/ESCOMP/ctsm/wiki/System-Testing-Guide#running-test-suites-with-the-run-sys-tests-wrapper + for details) + +(4) As part of (3), start work on a CTSM python library and associated + test infrastructure. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes ESCOMP/ctsm#535 (Run Fortran unit tests as part of create_test) + +CIME Issues fixed (include issue #): +- Various - see CIME ChangeLog for details + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] clm4_5 + +[X] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- New run_sys_tests wrapper +- Fortran unit tests now run as part of aux_clm + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne ---- ok + hobart ------ ok + + ok means tests pass, baselines fail as expected + +CTSM tag used for the baseline comparisons: ctsm1.0.dev015 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (new presaesro and CO2 datasets) + + Summarize any changes to answers, i.e., + - what code configurations: All I compsets (except spinup test that uses cplhist datm forcing) + - what platforms/compilers: All + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Potentially new climate + + Changes answers for I compsets due to datm update as part of the cime + update: new presaero and CO2 datasets + (https://github.com/esmci/cime/pull/2828) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: cime5.7.3 -> cime5.7.5 +- fates: fates_s1.8.1_a3.0.0 -> fates_s1.8.1_a3.0.0_rev2 + +Pull Requests that document the changes (include PR ids): +- https://github.com/escomp/ctsm/pull/493 (Wrapper to system tests, and + start of a ctsm python library) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev015 +Originator(s): sacks (Bill Sacks) +Date: Sun Oct 28 14:29:30 MDT 2018 +One-line Summary: CMIP6 compset modifiers, usermods for typical output, and other output enhancements + +Purpose of changes +------------------ + +(1) Support %BGC-CROP-CMIP6DECK and %BGC-CROP-CMIP6WACCMDECK compset + modifiers, so that we can turn on the necessary options + (output-related and others) via new CMIP6-specific compsets. + +(2) Turn on carbon isotopes in CMIP6 runs (from Erik Kluzek) + +(3) Remove setting of CCSM_BGC=CO2A in the cmip6 usermods + +(4) Add usermods directories for getting typical extra output that's + wanted in many cases: output_crop, output_crop_highfreq, output_bgc, + output_bgc_highfreq, output_sp, and output_sp_highfreq. These can be + enabled by adding something like '--user-mods-dir output_crop' on + the create_newcase line (that short-hand works for an I compset; for + F or B compsets, you need to provide the full path to the usermod + directory). + +(4) Allow holes in the number of history tapes. Holes are cases where, + for example, we have h0, h1 and h3 tapes, but no h2 tape (because + there are no fields on the h2 tape). (This is needed for (3).) + +(5) Fix reading and writing of 1-d logical global arrays. This fixes + ESCOMP/ctsm#24 for real (rather than just preventing an attempt to + read/write 1-d logical arrays, as was done in the previous 'fix'). + +(6) Add C13_NBP and C14_NBP diagnostic fields (from Keith Oleson) + +(7) Make a bunch of carbon isotope diagnostic fields inactive by default + +(8) Don't allow interpolation (use_init_interp) from a case without + carbon isotopes to a case with carbon isotopes: Due to + https://github.com/ESCOMP/ctsm/issues/67, interpolation from a case + without carbon isotopes to a case with carbon isotopes yields + incorrect initialization values for the carbon isotopes. Now that + we're turning carbon isotopes on via some semi-out-of-the-box + usermods (for cmip6), it is becoming more important to check to make + sure someone doesn't shoot themselves in the foot this way. + +(9) Add tests of the new output usermods as well as of the CMIP6 compset + modifiers + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes #24 for real (ncd_io_1d_log_glob is broken) +- Fixes #529 (Organize usermods_dirs to facilitate running cases with + the right output) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- New namelist variable, just for testing purposes: + for_testing_allow_interp_non_ciso_to_ciso. This bypasses an error + check, and should only be used in tests. + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Reworked tests of cmip6_deck usermods to use the new + %BGC-CROP-CMIP6DECK compset modifier, and changed f09_g16 to f09_g17 +- Added a test of the %BGC-CROP-CMIP6WACCMDECK compset modifier +- Added tests of output_crop_highfreq, output_bgc_highfreq and + output_sp_highfreq usermods directories +- Note that there are NO tests covering the cmip6_evolving_icesheet + usermods: this usermod directory adds very little beyond cmip6_deck, + so it didn't seem worth its own test + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - pass + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- pass + cheyenne_gnu ------ pass + hobart_nag -------- pass + hobart_pgi -------- pass + hobart_intel ------ pass + + ERI_D_Ld9.T31_g37.I2000Clm50Sp.cheyenne_intel.clm-SNICARFRC + initially failed COMPARE_base_hybrid, COMPARE_base_rest and BASELINE + comparisons. I reran it and it passed. + + Manually compared all history files from + ERS_Ly3.f10_f10_musgs.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic + with baseline + ERS_Ly3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-cmip6. They + were all identical. Also compared all history files from + SMS_Ld5_D.f09_g17.I1850Clm50BgcCropCmip6.cheyenne_intel.clm-basic + with baseline + SMS_Ld5_D.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-cmip6. They + were all identical (but note that this basically just compared the + cpl.hi file: the test was too short to produce monthly files.) + +CTSM tag used for the baseline comparisons: ctsm1.0.dev014 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/536 - Allow holes in the number of + history tapes and reorganize cmip6 usermods (main PR containing all of + these changes) +- https://github.com/ESCOMP/ctsm/pull/527 - Add carbon_isotope user-mod + directory to turn on c13 and c14 +- https://github.com/ESCOMP/ctsm/pull/539 - Support a %CMIP6DECK compset + modifier + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev014 +Originator(s): sacks (Bill Sacks) +Date: Fri Oct 26 06:20:34 MDT 2018 +One-line Summary: Miscellaneous minor, bit-for-bit bug fixes + +Purpose of changes +------------------ + +Four miscellaneous minor, bit-for-bit bug fixes: + +(1) Py3 pylint check and address cime issue ESMCI/cime#2822 (from Jim + Edwards: ESCOMP/ctsm#526) + +(2) Change uppercase DEBUG variables to lowercase debug (requested by + Jim Edwards to avoid conflicting with the DEBUG CPP token) + (Fixes ESCOMP/ctsm#534) + +(3) Remove unnecessary line of code in LunaMod.F90 that was causing + problems with some compilers due to an uninitialized variable + (Fixes ESCOMP/ctsm#322) + +(4) Add r8 to 0 constant to fix build issue with XLF compiler (from Jim + Edwards: ESCOMP/ctsm#531) + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes ESCOMP/ctsm#322 (ERS_D_Ld5.f19_g16.I2000Clm50BgcCruGs run FAIL (intel)) +- Fixes ESCOMP/ctsm#534 (Rename DEBUG to debug in a few places) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: none + +Code reviewed by: different pieces reviewed by different people + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - pass + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- ok + cheyenne_gnu ------ ok + hobart_nag -------- ok + hobart_pgi -------- ok + hobart_intel ------ ok + + ok means tests and baseline comparisons pass. There were unexpected + NLCOMP diffs. From spot-checking a few tests, I see the following: + + + (1) On both cheyenne and hobart: Diffs in logfile. This looks like a + problem in cime: it says: + + BASE: logfile = 'rof.log.136342.hobart.cgd.ucar.edu + COMP: logfile = 'rof.log + + (2) On hobart: Diffs in pio_typename: netcdf vs. pnetcdf (says that + new uses pnetcdf): but when I compare files by hand, they look + the same in this respect (both baseline and new use netcdf), so + maybe this is due to a problem in the timing of when nlcomp is + run? + + Since these both look like problems in the comparison script rather + than in the tag, I'm letting these go, but will open a cime issue if + we see this again. + + +CTSM tag used for the baseline comparisons: ctsm1.0.dev013 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/531 (fix build issue with xlf compiler) +- https://github.com/ESCOMP/ctsm/pull/526 (fix cime issue 2822 and pylint chk) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev013 +Originator(s): erik (Erik Kluzek)/slevisconsulting +Date: Thu Oct 25 18:09:47 MDT 2018 +One-line Summary: Fix the fact that transient Bgc and SP cases had constant crop area in time + +Purpose of changes +------------------ + +Fix transient non-crop cases that had constant crop area so that crop area will change in time +(and hence natural veg area will also change corresponding to it). + +Also bring in changes to update mksurfdata_map to handle SSP-RCP future scenarios. Right now +it can handle SSP5-8.5 out of the box. Also add a new test for that. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #538 + #538 -- In transient pft simulations with use_crop=.false., %crop does not advance from 1850 values + +Known bugs found since the previous tag (include github issue ID): #545 + #545 -- Antarctica ice shelves are being treated as wetlands rather than glaciers + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[X] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): A few more namelist checks + Added a check to make sure do_transient_pfts was the same as do_transient_crops + Don't allow use_fertilizer for non-crop case + namelist checks that create_crop_landunit=T except for FATES + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + New -ssp_rcp option to mksurfdata.pl + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): New mksrfpft datasets in XML for SSP5-8.5 + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in ../CTSMMasterChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Now, do_transient_pfts and do_transient_crops only work in unison, and hence + should be simplified to one logical called do_transient_veg + +Changes to tests or testing: Add new SSP5-8.5 mksurf test + +Code reviewed by: self, slevisconsulting, billsacks + +CTSM testing: regular, tools + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (18 of the transient test namelists are different to baseline as expected) + + unit-tests (components/clm/src): + + cheyenne - PASS + + tools-tests (components/clm/test/tools): + + cheyenne - OK (PTCLM tests fail) + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + hobart_nag -------- OK + hobart_pgi -------- OK + hobart_intel ------ OK + +CTSM tag used for the baseline comparisons: ctsm1.0.dev012 + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes! (Important) + + Summarize any changes to answers, i.e., + - what code configurations: clm4_5/clm5_0 transient simulations without Crop (either Bgc or SP) + - what platforms/compilers: All + - nature of change: crop areas increase in time and impact simulations + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: dll/clm50_r267_1deg_GSWP3V1_iso_hist_nocrop_transientfix + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #546, #540 +(https://github.com/ESCOMP/ctsm/pull) + + #546 -- Add in ability for mksurfdata_map to handle ssp_rcp scenarios and specifically SSP5-8.5 + $540 -- Transient PFT issue + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev012 +Originator(s): erik (Erik Kluzek) +Date: Sat Sep 29 11:49:35 MDT 2018 +One-line Summary: Add snow-free fields for snowmip, fix several issues + +Purpose of changes +------------------ + +Bring in new diagnostic fields added by Justin Perket, Sean Swenson and Mark Flanner +for Snow-MIP. Most of those are fields that represent "Snow Free" data. + +Also bring in fixes for a list of issues. Add handling of the new CO2 which includes +both latitude-band and global average versions. Add some changes to make it easier +for input data processing including NOT doing the slow 1km map file creation. Have +the number of steps that are skipped at startup dependent on the time-step size. Add +a test for some requirements of WACCMX (time-step and use of ESMF). Calculations of +local time are now done in a global subroutine, that can handle negative longitudes. +Fix how FFIX_TO_SMINN is handled for history output. The namelist logical "calc_human_stress_indices" +changed from logical to a character string of three values: FAST, NONE, ALL. FAST +is the default so the less expensive ones are output, NONE turns them all off, and ] +ALL does all of them including the expensive ones. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #428, #474, #475, #476, #450, #482, #481, #491 + Fix #428 -- Update getco2_historical.ncl to handle latitude varying CO2 + Fix #474 -- Add ability to send GRIDFILE to regridbatch.sh script + Fix #475 -- Have number of steps to skip balance-check based on time + Fix #476 -- Add a test for WACCMX standalone + Fix #450 -- Add option to use global average of terrain standard deviation on surfdata files + (partial fix with simplest option) + Fix #482 -- Add extra field on CO2 streams file for global/time-averaged data + Fix #481 -- FFIX_TO_SMINN needs to be output when FUN is on + Fix #491 -- Calculations of local noon assume that longitude is 0 to 360 rather than -180 to 180 + +Known bugs introduced in this tag (include github issue ID): cime#2801 + cime#2801 -- Problem building with ESMF_LIB + +Known bugs found since the previous tag (include github issue ID): #507, #505 + #507 -- Albedo's are bad at night with negative longitudes + #505 -- CTSM input data-set tools can only work on 0-360 grids, and require monotone increasing longitude + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + + New namelist: + use_ssre -- Turn on show free fields needed for SnowMIP + + Changed namelist: + calc_human_stress_indices changed from logical to character with options: ALL, FAST, NONE + + New history fields: + Mostly added Snow Free (SF) fields + ALBDSF + ALBISF + FSRSF + FSRSFND + FSRSFNDLN + FSRSFNI + FSRSFVD + FSRSFVDLN + FSRSFVI + SSRE_FSR + SSRE_FSRND + SSRE_FSRNDLN + SSRE_FSRNI + SSRE_FSRVD + SSRE_FSRVDLN + SSRE_FSRVI + +Changes made to namelist defaults (e.g., changed parameter values): + calc_human_stress_indices = 'FAST' is now the default + +Changes to the datasets (e.g., parameter, surface or initial files): + mkghg_bndtvghg -- Update with new CO2 files, both monthly, lat-bands and yearly, global + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + I was able to reduce the duplication in SurfaceAlbedoMod where the original implementation added a cut + and paste copy of code. But, there is still a lot of duplication in this file that could be improved, by + making smaller functions/subroutines to do sections of code that are essentially repeated many times. + There's a bit of an increase in complexity to reduce the duplication, but reducing the duplication was worth it. + +Changes to tests or testing: + Add a new waccmx_offline test mods and test with it + New test expected fail because of cime issue: ERS_D_Ln9_P480x3.f19_g16.I2000Clm50SpGs.cheyenne_intel.clm-waccmx_offline + Turn use_ssre on for most tests, off for reducedOutput + And set calc_human_stress_indices=NONE for reducedOutput, FAST for most, and ALL for KitchenSink and KSMOut tests + +Code reviewed by: self, @olyson, @billsacks + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + unit-tests (components/clm/src): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + hobart_nag -------- OK + hobart_pgi -------- OK + hobart_intel ------ OK + +CTSM tag used for the baseline comparisons: ctsm1.0.dev011 + + +Answer changes +-------------- + +Changes answers relative to baseline: no bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): No + +Pull Requests that document the changes (include PR ids): #462 #449 +(https://github.com/ESCOMP/ctsm/pull) + + #462 -- Add namelist item to calculate all heat stress indices only if requested; to speed up model + #449 -- Bring in snowmip diagnostic fields + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev011 +Originator(s): sacks (Bill Sacks), mvr (Mathew Rothstein) +Date: Wed Sep 12 10:50:31 MDT 2018 +One-line Summary: Add water tracer consistency checks, and other water tracer work + +Purpose of changes +------------------ + +1. Add water tracer consistency checks + +2. Add infrastructure for looping over all water tracers - currently + just used for the tracer consistency checks + +3. Breakout of atm2lnd and lnd2atm water variables, needed for water tracers + +4. Add some namelist control over the addition of water tracers + +5. Add a system test that exercises the water tracer consistency checks + +6. Add a 'ratio' variable for each water tracer + +7. Add some unit tests of the new water tracer infrastructure + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Partially addresses #357 +- Resolves #479 +- Resolves #492 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- Don't be fooled by the new namelist variable, enable_water_isotopes: + This is just a place-holder for now, not implying that water isotopes + are actually working. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- New namelist variables: enable_water_tracer_consistency_checks and + enable_water_isotopes. The latter is just a place-holder for now. + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: New test that runs the water tracer consistency check + I ran this test on cheyenne_gnu and cheyenne_intel along with the + out-of-the-box hobart_nag version + +Code reviewed by: Mat Rothstein and I have worked together on many of +these changes, but not all code has been reviewed by the other. + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - ok (tests pass, clm4_5 and clm5_0 namelists differ from + baseline as expected) + + unit-tests (components/clm/src): + + cheyenne - pass + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- pass + cheyenne_gnu ------ pass + hobart_nag -------- pass + hobart_pgi -------- pass + hobart_intel ------ pass + +CTSM tag used for the baseline comparisons: ctsm1.0.dev010 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/497 + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev010 +Originator(s): sacks (Bill Sacks) +Date: Thu Aug 30 17:14:28 MDT 2018 +One-line Summary: Update cime to cime5.7.3 + +Purpose of changes +------------------ + +Update cime from cime5.6.10 to cime5.7.3. To support this change, there +are also minor code changes related to the pause-resume implementation +(from Erik Kluzek). + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- ESCOMP/ctsm#384 (VIC test is failing at f09 resolution with signal) + (I'm not sure what fixed this, but it's passing now) + +CIME Issues fixed (include issue #): many + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - pass + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- pass + cheyenne_gnu ------ pass + hobart_nag -------- pass + hobart_pgi -------- pass + hobart_intel ------ pass + +CTSM tag used for the baseline comparisons: ctsm1.0.dev009 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO - bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +cime: cime5.6.10 -> cime5.7.3 + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev009 +Originator(s): sacks (Bill Sacks) +Date: Wed Aug 22 20:32:36 MDT 2018 +One-line Summary: Fix initialization of AnnET in InitAccVars + +Purpose of changes +------------------ + +InitAccVars was mistakenly setting qflx_evap_tot_col rather than +AnnET. This fix allows us to remove now-redundant cold start and restart +code for AnnET. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes #480 +- Partially addresses #285 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: basic proposed changes reviewed by Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - pass + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- pass + cheyenne_gnu ------ pass + hobart_nag -------- pass + hobart_pgi -------- pass + hobart_intel ------ pass + +CTSM tag used for the baseline comparisons: ctsm1.0.dev008 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev008 +Originator(s): erik (Erik Kluzek) +Date: Tue Aug 14 10:25:12 MDT 2018 +One-line Summary: Update 1850 ndep file and last year for streams for Historical transient cases + +Purpose of changes +------------------ + +Bring in changes from release-clm5.0.05. Update to latest Nitrogen Deposition file from simulations with WACCM for 1850. +Also fix an issue with the last year for historical transient cases. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): 461 + #461 -- increase last year in streams for transient + +Known bugs found since the previous tag (include github issue ID): [If none, remove this line] + #478 -- Bare soil g1 should be missing value or zero + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): Last year extended for transient datasets + +Changes to the datasets (e.g., parameter, surface or initial files): New ndep dataset for 1850 + +Substantial timing or memory changes: + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: Lengthen some tests + +Code reviewed by: self + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (11 show differences for 1850_control and 20thC_transient) + + unit-tests (components/clm/src): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + hobart_nag -------- OK + hobart_pgi -------- OK + hobart_intel ------ OK + +CTSM tag used for the baseline comparisons: ctsm1.0.dev007 + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes! (ndep files, and steams years) + + Summarize any changes to answers, i.e., + - what code configurations: 1850_control or 20thC_transient for Clm50 + - what platforms/compilers: all + - nature of change: similar climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + + #477 -- Move changes from release-clm5.0.05 onto master + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev007 +Originator(s): sacks (Bill Sacks) +Date: Sun Aug 5 21:03:28 MDT 2018 +One-line Summary: Avoid glacier dynamic landunit adjustments in first time step + +Purpose of changes +------------------ + +Always avoid generating dynamic landunit adjustments for glacier area +changes in the first timestep of a startup or hybrid run - not just for +cold start or interpolated start. See the detailed discussion in +https://github.com/ESCOMP/ctsm/issues/340 for rationale. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes #340 (Avoid generating dynamic landunit adjustment fluxes for + glacier changes in the first timestep) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +Code reviewed by: Erik Kluzek + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - not run + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- ok + cheyenne_gnu ------ pass + hobart_nag -------- pass + hobart_pgi -------- pass + hobart_intel ------ pass + + ok means tests pass; baseline failures as expected in these two + tests that do not use init_interp: + + FAIL ERI_N2_Ld9.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev006 + FAIL SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev006 + + (The glacier area on the finidat file used in these tests - + clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180715.nc + - seems to have come from an finidat_interp_dest file, and thus does + not match the glacier area from CISM.) + +CTSM tag used for the baseline comparisons: ctsm1.0.dev006 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (small) + + Summarize any changes to answers, i.e., + - what code configurations: Startup / Hybrid runs that include CISM + (even NOEVOLVE) and do not use init_interp, due to: + - different PE layout in new case vs. the one that generated the + finidat (roundoff-level diffs) + - different glacier area on finidat file vs. what's in CISM + (greater than roundoff-level diffs) + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Roundoff-level for different PE layout, larger than roundoff but + should be same climate when there is different glacier area on the + finidat file vs. what's in CISM + + The differences arise from dynamic landunit adjustments of the + below-ground C and N states in the old code, as CTSM adjusts its + areas to match CISM's. In the new code, there are no C and N + adjustments in the first time step from this adjustment. + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- #470 (Avoid glacier dynamic landunit adjustments in first time step) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev006 +Originator(s): sacks (Bill Sacks) +Date: Sat Aug 4 07:48:09 MDT 2018 +One-line Summary: Minor bug fixes, cleanup, documentation and enhancements + +Purpose of changes +------------------ + +A collection of minor bug fixes, code cleanup, documentation and +enhancements, all bit-for-bit. See list of issues fixed below for +details. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes #24 (ncd_io_1d_log_glob is broken) +- Fixes #120 (Incorrect comments in Biogeophysics1Mod.F90 +- Fixes #217 (Change some cheyenne_gnu tests to cheyenne_intel) +- Fixes #245 (Put all .gitignore entries in top-level file) +- Fixes #272 (Code should error on missing mxsoil_color when SOIL_COLOR + is used) +- Fixes #283 (Add more helpful message about need to do init_interp with + wrong number of vertical layers) +- Fixes #367 (For cmip6 runs: Turn on cpl hist output needed to drive a + TG compset) +- Fixes #412 (Fix documentation of init_interp_method) +- Fixes #419 (Do not allow SOYFIXN diagnostic field with FUN) +- Fixes #464 (Some lines longer than 132 characters) +- Fixes #465 (Remove backwards compatibility check for snw_rds) +- Fixes #467 (Increase wallclock limit for test) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Changed a single-point test from gnu to intel to get better debugging + information + (SMS_D_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm45BgcCropQianGs.cheyenne_intel.clm-cropMonthOutput) +- For some single-point tests on both gnu and intel: removed one + compiler, keeping the tests on just one + +Code reviewed by: self + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - pass + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- pass + cheyenne_gnu ------ pass + hobart_nag -------- pass + hobart_pgi -------- pass + hobart_intel ------ pass + + NLCOMP failures as expected for tests with the cmip6 test mod + + Some long single-point gnu tests failed due to running out of + wallclock time; I have removed these, just keeping them on intel + (along with removing a few other tests after I ran the testing - see + commit 5c226bdf): + + FAIL ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput RUN time=4803 + FAIL ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput RUN time=6024 + + +CTSM tag used for the baseline comparisons: ctsm1.0.dev005 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO - bit-for-bit + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- #392 (Remove old code for snw_rds restart that looks no longer needed) +- (Other changes not documented in PRs) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev005 +Originator(s): sacks (Bill Sacks), mvr (Mathew Rothstein) +Date: Fri Aug 3 07:54:59 MDT 2018 +One-line Summary: Rework water data types to accommodate isotopes and other tracers + +Purpose of changes +------------------ + +This tag reworks the various water data types to allow having multiple +instances of variables that are needed for isotopes and other water +tracers. + +Specific changes include: + +(1) Separated "water state" variables into state, diagnostic and balance + check-related variables. This separation was not essential for the + work here, but was desired by Martyn Clark and others. + +(2) For each of water state, diagnostic and flux variables, separated + variables into those needed for both bulk and tracers vs. those only + needed for bulk. This way, we can have multiple instances of the + variables needed by tracers, but only a single instance of variables + that only apply to bulk water. This follows the design laid out in + https://github.com/escomp/ctsm/pull/395. The separation was based + largely on what was done in the old water isotope branch; we didn't + put a lot of thought into this, because the new design allows us to + easily migrate variables between bulk-only and bulk-and-tracer as + needed. + +(3) Moved water fluxes that were defined in science modules back into + waterflux_type or waterfluxbulk_type. This was needed for (2); there + is more discussion on this in + https://github.com/escomp/ctsm/pull/395 and the log message for + commit 711e5cd7. + +(4) Introduced a top-level water_type that holds instances of all of the + other water-related objects. This follows the design laid out in + https://github.com/escomp/ctsm/pull/395. This is particularly + valuable for the tracer instances: the logic related to number of + tracers can be encapsulated in water_type, rather than infiltrating + clm_instMod. + +(5) Added placeholders for water tracer instances + +(6) Added infrastructure to generate history / restart field names for + the tracer instances. Eventually, the isotope class can also hold + information specific to each isotope. + +This work was a joint effort between Mathew Rothstein and myself; Mat +gets much of the credit for the actual refactoring done here. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes #358 (Separate WaterStateType into multiple types) +- Fixes #434 (Separate WaterFluxType into a base class and a class that just applies to bulk) +- Fixes #359 (Set up infrastructure for multiple instances of WaterState and WaterFlux types) +- Fixes #458 (Implement handling of history and restart variables for water tracers) + +Known bugs introduced in this tag (include github issue ID): +- #464 (Some lines longer than 132 characters) +- #456 (Remove backwards compatibility check for snw_rds) (not a + newly-introduced issue, but it's more important to fix this with the + separation of waterstate_type) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- Water tracers are not yet functional - they are just placeholders +- Whether to use water tracers and which water tracers to use are + currently hard-coded; eventually, this should be namelist-controlled + +Changes to tests or testing: none + +Code reviewed by: Mathew Rothstein and Bill Sacks worked together on +these changes and reviewed each other's changes to some extent. The +high-level design was also reviewed and co-developed by Mariana +Vertenstein. Martyn Clark contributed substantially to the breakout of +water state into state, diagnostic and balance check-related variables. + + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - pass + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- pass + cheyenne_gnu ------ pass + hobart_nag -------- pass + hobart_pgi -------- pass + hobart_intel ------ pass + +CTSM tag used for the baseline comparisons: ctsm1.0.dev004 + + +Answer changes +-------------- + +Changes answers relative to baseline: NO - bit-for-bit + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/escomp/ctsm/pull/395 (documents the high-level design) + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev004 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Wed Jul 18 02:10:23 MDT 2018 +One-line Summary: Add some new diagnostic fields, fix a few issues, update cmip6 output + +Purpose of changes +------------------ + +Add some new diagnostic fields. Some needed for CMIP6. Update the CMIP6 user-mods output. +Fix a couple issues. Get full list of history tapes working correctly. Check for valid range +of CO2. New IC file interpolated from the previous one for f19_g17_gl4 for 2000 Clm50BgcCrop. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): $210, #427, #429 + #210 -- increase number of history tapes + $427 -- Check for zero CO2 + #429 -- New IC for present day + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): New history fields + TSKIN --- skin temperature + TSL ----- temperature of near-surface soil layer + GSSUNLN - sunlit leaf stomatal conductance at local noon + GSSHALN - shaded leaf stomatal conductance at local noon + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): New finidat file f19_g17_gl4 2000 Clm50BgcCrop + New file is just interpolate from the previous file to a f19_g17_gl4 gridfor Clm50BgcCrop and 2000 simulation year + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CLMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: None + +Code reviewed by: self, oleson, abtawfik + + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - OK (95 are different because of finidat file change) + + unit-tests (components/clm/src): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + hobart_nag -------- PASS + hobart_pgi -------- FAIL + hobart_intel ------ PASS + +CTSM tag used for the baseline comparisons: ctsm1.0.dev003 + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes -- only 2000 cases because of new IC + + Summarize any changes to answers, i.e., + - what code configurations: Just 2000 cases + - what platforms/compilers: All + - nature of change: same climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + + + #338 -- Radtemp and other new diagnostic fields + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev003 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Sun Jul 15 00:26:46 MDT 2018 +One-line Summary: Update cime/cism to work on upgraded hobart and with glade changes on cheyenne + +Purpose of changes +------------------ + +Update cime and cism so can work on upgraded hobart. Also fix an issue that the Nag6.2 compiler found +in CTSM. Also get working with glade changes that happened on cheyenne, DIN_LOC_ROOT_CLMFORC was +changed to a new directory. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): [If none, remove this line] + #441 -- Changes in glade invalidate previous softlinks and data locations + #438 -- Illegal argument aliasing caught by nag6.2 + #433 -- with hobart upgrade CTSM not working + +Known bugs introduced in this tag (include github issue ID): + #444 -- PGI fails on cheyenne and hobart + +Known bugs found since the previous tag (include github issue ID): + #443 -- Wood C:N ratios + #440 -- leafcn_max < target leafcn? + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): DIN_LOC_ROOT_CLMFORC on cheyenne + DIN_LOC_ROOT_CLMFORC was change on cheyenne + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: path for cheyenne specific test had to be changed + Add some gnu tests on hobart + Lengthen wallclock on a test + Fix path for DA test_mod + +Code reviewed by: self + +CLM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + unit-tests (components/clm/src): + + cheyenne - PASS + + tools-tests (components/clm/test/tools): + + cheyenne - PASS + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - OK + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + hobart_nag -------- OK + hobart_pgi -------- FAIL + hobart_gnu -------- PASS + hobart_intel ------ PASS + +CLM tag used for the baseline comparisons: ctsm1.0.dev002 + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cism + cism-wrapper to release-cesm2.0.04 + cime to cime5.6.10 + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + #444 -- Get working on upgraded hobart and with glade changes on cheyenne + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev002 +Originator(s): erik (Erik Kluzek) +Date: Fri Jul 6 16:33:03 MDT 2018 +One-line Summary: Fix NFIX flux variables so special land-units are zeroed out, tools update, add some *_MAX fields on mksurfdata_map for transient cases + +Purpose of changes +------------------ + +Nitrogen Fixation flux arrays were being set to missing value over non-vegetated landunits. This sets them to zero everywhere +and averages in the zero's at the gridcell level for history output. It also reads in restarts with missing values and converts +them to zero's. + +There are also some tools updates, getting the tools working on the new upgraded hobart.cgd.ucar.edu. + +And mksurfdata_map is updated to add some *_MAX files on the landuse.timeseries files that will allow us to conserve memory +for transient cases. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #435, #436, #433 (for tools) + #435 -- intel build for tools + #426 -- Nitrogen Fixation flux variables + #433 -- hobart broken, got it working for tools + +Known bugs found since the previous tag (include github issue ID): #433, #431 + + #433 -- with hobart upgrade, hobart build isn't working + #431 -- When set_* options are used to hist_addfld be careful of ordering + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_0 + +[ ] clm4_5 + +[ ] clm4_0 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): ndep file updated for clm5_0 for 1850 + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CLMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): NFIX flux variables + NFIX flux variables when read from restart have special-values (missing on non veg landunits) converted to zero's + They are now initialized to zero everywhere. + +Changes to tests or testing: None + +Code reviewed by: self, wwieder, and lawrence, sacks (mksurfdata_map code) + +CLM testing: regular (although none on hobart!) + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS (5 tests differ from previous version) + + unit-tests (components/clm/src): + + cheyenne - PASS + + tools-tests (components/clm/test/tools): + + cheyenne - PASS + hobart --- PASS + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + +CLM tag used for the baseline comparisons: ctsm1.0.dev001 + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes, clm5_0 BGC configurations with FUN and clm5_0 with BGC for new 1850 ndep file + + Summarize any changes to answers, i.e., + - what code configurations: All clm5_0 BGC due to NFIX fields, and clm5_0 1850 BGC due to new ndep file + - what platforms/compilers: All + - nature of change: similar climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + + #437 -- ChangeLog template + #432 -- nfix + #331 -- _MAX fields on mksurfdata_map + +=============================================================== +=============================================================== +Tag name: ctsm1.0.dev001 +Originator(s): sacks (Bill Sacks) +Date: Fri Jun 22 07:31:43 MDT 2018 +One-line Summary: Begin separating SoilHydrology flux calculations + +Note the new tag naming: Starting with this tag, we are naming tags +"ctsm..." rather than "clm...". We are starting with ctsm version 1, +which for now is nearly the same as clm version 5. We are moving to this +new tag naming now because: + +(1) The changes in this tag represent the first step towards + implementing the CTSM vision (separating the biogeophysics flux + calculations from state updates, making it easier to plug in + alternative parameterizations, etc.). + +(2) This tag changes answers relative to the CLM5 release. (We expect + the climate to be the same, but we haven't tested this carefully + yet.) + +Purpose of changes +------------------ + +First steps toward separating various flux calculations in the soil +hydrology code. The focus here is on saturated surface runoff and +infiltration excess runoff. The changes here separate flux calculations +from state updates and extract various calculations into their own +subroutines to facilitate swapping in alternative parameterizations. + +Most of the changes here are refactorings that are either bit-for-bit or +just introduce roundoff-level differences. However, there are also a few +larger answer changes, as described below. + +These are the greater-than-roundoff-level answer changes: + +(A1) Use full qflx_surf in BGC code. Previously, the subroutines ch4 and + SoilBiogeochemNLeaching had been using a flux that excluded surface + water runoff (qflx_h2osfc_surf). That was deemed to be incorrect + (by Dave Lawrence and others), so these BGC subroutines have been + changed to use the full surface runoff (saturated excess runoff + + infiltration excess runoff + h2osfc runoff). + + Configurations affected: BGC compsets + + Magnitude of change: Larger than roundoff; expected to be same + climate, but not investigated carefully + +(A2) VIC: Don't ever use the TOPModel formulation for SurfaceRunoff + + The code was using the TOPModel-based formulation for SurfaceRunoff + if frost_table > zwt_perched. Sean Swenson felt this shouldn't be + done, and refactoring will be easier if VIC always uses the + vic-looking formulation, so I'm stopping applying this formulation + when using VIC. + + Configurations affected: VIC compsets + + Magnitude of change: Larger than roundoff; not investigated carefully + +(A3) VIC: Remove infiltration excess runoff + + Martyn Clark reviewed the VIC implementation, and felt that the + current implementation of infiltration excess runoff is + inconsistent with the standard VIC implementation. It appears that + what was being called VIC's infiltration excess runoff was actually + just an attempt to give a better numerical approximation to the + solution for saturated surface excess runoff. So deleting this + leaves only a first-order approximation to VIC's saturated surface + excess runoff. + + Eventually we may want to put in place a more accurate solution for + VIC's saturated surface excess runoff. But Martyn's feeling is that + this can come in with other changes we want to make regarding + numerical solutions in CTSM. + + Configurations affected: VIC compsets + + Magnitude of change: Larger than roundoff; expected to be same + climate, but not investigated carefully + +(A4) Change in QOVER diagnostic field: now includes QH2OSFC. + +These are the major refactorings (either bit-for-bit or just +roundoff-level differences): + +(R1) Extract surface runoff to its own module, and other modularization + related to what used to be subroutine SurfaceRunoff: extract a + subroutine for each fsat method, move urban surface runoff code + into different routines. + +(R2) Extract infiltration excess runoff to its own module, and other + modularization related to what used to be subroutine Infiltration. + +NOTE: For a detailed breakdown of changes, including documentation of +which changed changed answers, see the file ChangeLog_branch which was +deleted from this branch shortly before it was merged to master. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Fixes #424 (decStart testmod is missing an `--append` in an xmlchange command) + + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + +Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): + +Changes made to namelist defaults (e.g., changed parameter values): + +Changes to the datasets (e.g., parameter, surface or initial files): + +Substantial timing or memory changes: + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in .CLMTrunkChecklist as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: +- Shortened a 25-month f19 test to 13-months + (SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput): + This test took a long time to run, and we already have long tests of + this configuration at coarse-resolution. I suggested removing this + test entirely, but Erik Kluzek wanted to maintain a shortened version + of it. Erik's comments were: + + How about either flip it to f45 (because Rosie is using that + resolution for science) -- or leave it at f19 and have it run for 9 + months? The 25 months was to take it just past the 2-year spinup + time. From spunup initial conditions 9-months pretty much does a + full harvest cycle. f19 and f09 are the main configurations for + science and it would be good to have something longer than just + really short tests. + + I decided on Lm13, because this still completes in significantly less + than 2-hours, and if we're running for 9 months anyway, it seems + valuable to finish out the year and run a bit into the next year, + since some crop stuff triggers at the end of the year. + +Code reviewed by: Various code reviews done last Fall, when these +changes were first implemented. + +CLM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + unit-tests (components/clm/src): + + cheyenne - PASS + + tools-tests (components/clm/test/tools): + + cheyenne - not run + + PTCLM testing (components/clm/tools/shared/PTCLM/test): + + cheyenne - not run + + regular tests (aux_clm): + + cheyenne_intel ---- OK + cheyenne_gnu ------ OK + hobart_nag -------- OK + hobart_pgi -------- OK + hobart_intel ------ OK + + OK means tests pass, answers change as expected. + +CLM tag used for the baseline comparisons: clm5.0.dev013 + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (roundoff) + + Summarize any changes to answers, i.e., + - what code configurations: Essentially all (except CLM4) + - what platforms/compilers: All + - nature of change (roundoff; larger than roundoff/same climate; new climate): + + Roundoff-level changes for nearly all configurations (except CLM4). + + Greater-than-roundoff-level changes for the following + configurations: + - BGC: see (A1) note above (expected to be same climate, but not + investigated carefully) + - VIC: see (A2) and (A3) notes above (magnitude of change not + investigated carefully) + - QOVER diagnostic field: see (A4) note above + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/ctsm/pull/244 +- https://github.com/ESCOMP/ctsm/pull/190 +- Other PRs that existed on the old NCAR/clm-ctsm repository (which has + been deleted), which were not migrated to the new repository + +=============================================================== From a7c2cea00e0193e1608dd52b512b11aaa04791b8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Sep 2020 23:19:55 -0600 Subject: [PATCH 1496/1973] Remove note about code review and add an extra line about the change answers section --- doc/.ChangeLog_template | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index f5474f33a8..1e0dae6bd9 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -56,9 +56,6 @@ Caveats for developers (e.g., code that is duplicated that requires double maint Changes to tests or testing: -Code reviewed by: - - CTSM testing: [... Remove before making master tag. Available test levels: @@ -106,6 +103,7 @@ Changes answers relative to baseline: If a tag changes answers relative to baseline comparison the following should be filled in (otherwise remove this section): + And always remove these three lines and parts that don't apply. Summarize any changes to answers, i.e., - what code configurations: From 6615ce4e98ce027ff3b9a00709b72108f2eb643f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 28 Sep 2020 14:40:03 -0600 Subject: [PATCH 1497/1973] Remove comment so identical to ctsm1.0.dev113 --- src/main/initGridCellsMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 index 565a03e245..0d9b20ef7b 100644 --- a/src/main/initGridCellsMod.F90 +++ b/src/main/initGridCellsMod.F90 @@ -130,7 +130,6 @@ subroutine initGridcells(glc_behavior) li = bounds_clump%begl-1 ci = bounds_clump%begc-1 pi = bounds_clump%begp-1 - ! Determine naturally vegetated landunit do gdc = bounds_clump%begg,bounds_clump%endg From 210f63a96c45de0dd015bb972f66be8f56fb9e1d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 28 Sep 2020 14:42:20 -0600 Subject: [PATCH 1498/1973] Remove comment so identical to ctsm1.0.dev113 --- src/main/subgridMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index 8307c440ff..3f34acda69 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -153,7 +153,6 @@ subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits) if (npatches > 0) then ! Assume that the vegetated landunit has one column ncols = 1 - nlunits = 1 else ! As noted in natveg_patch_exists, we expect a naturally vegetated landunit in From f2e2011652e9a99955c0f4b4353f61039d666f7c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 28 Sep 2020 15:21:57 -0600 Subject: [PATCH 1499/1973] Point to new version of landuse timeseries file for dyn lakes test The important part of this is that it has PCT_LAKE + PCT_CROP <= 100% for all times. --- .../clm/smallville_dynlakes_monthly/user_nl_clm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm index 7102f7052d..b85d0ba6c1 100644 --- a/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/smallville_dynlakes_monthly/user_nl_clm @@ -1,12 +1,11 @@ do_transient_lakes = .true. ! This file was created with the following command: -! ncap2 -s 'PCT_LAKE=array(0.0,0.0,PCT_CROP); PCT_LAKE={0.,50.,25.,25.,25.,25.}; HASLAKE=array(1.,1.,AREA)' landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200923.nc -! Key points are that lake area starts as 0, increases after the first -! year, then decreases after the second year. -! Note that the use of this file means that this testmod can only be -! used with the 1x1_smallvilleIA grid. -flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200923.nc' +! ncap2 -s 'PCT_LAKE=array(0.0,0.0,PCT_CROP); PCT_LAKE={0.,50.,25.,25.,25.,25.}; HASLAKE=array(1.,1.,AREA); PCT_CROP=array(0.0,0.0,PCT_LAKE); PCT_CROP={0.,25.,12.,12.,12.,12.}' landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200928.nc +! Key points are that lake area starts as 0, increases after the first year, then decreases after the second year. +! PCT_CROP is also changed so that PCT_LAKE + PCT_CROP <= 100. (Here, PCT_CROP increases and decreases at the same time as PCT_LAKE in order to exercise the simultaneous increase or decrease of two landunits, but that isn't a critical part of this test.) +! Note that the use of this file means that this testmod can only be used with the 1x1_smallvilleIA grid. +flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200928.nc' ! BUG(wjs, 2020-09-25, ESCOMP/CTSM#43) Dynamic lakes don't work when methane is active, ! so for now disable methane for this test. From d9b49729b7349f36d704ece617a13df4b99c0e63 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 28 Sep 2020 15:59:29 -0600 Subject: [PATCH 1500/1973] Fix unit tests --- src/biogeophys/CMakeLists.txt | 1 + .../test_dyn_cons_biogeophys.pf | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/CMakeLists.txt b/src/biogeophys/CMakeLists.txt index a25ba5ed0e..1bb52accc5 100644 --- a/src/biogeophys/CMakeLists.txt +++ b/src/biogeophys/CMakeLists.txt @@ -12,6 +12,7 @@ list(APPEND clm_sources InfiltrationExcessRunoffMod.F90 IrrigationMod.F90 LakeCon.F90 + LakeStateType.F90 QSatMod.F90 RootBiophysMod.F90 SaturatedExcessRunoffMod.F90 diff --git a/src/dyn_subgrid/test/dynConsBiogeophys_test/test_dyn_cons_biogeophys.pf b/src/dyn_subgrid/test/dynConsBiogeophys_test/test_dyn_cons_biogeophys.pf index 54f56b333f..47f802e5bf 100644 --- a/src/dyn_subgrid/test/dynConsBiogeophys_test/test_dyn_cons_biogeophys.pf +++ b/src/dyn_subgrid/test/dynConsBiogeophys_test/test_dyn_cons_biogeophys.pf @@ -7,7 +7,7 @@ module test_dyn_cons_biogeophys use shr_kind_mod , only : r8 => shr_kind_r8 use unittestSubgridMod use unittestArrayMod, only : col_array - use unittestFilterBuilderMod, only : filter_from_range + use unittestFilterBuilderMod, only : filter_from_range, filter_empty use unittestWaterTypeFactory, only : unittest_water_type_factory_type use clm_varpar, only : nlevgrnd, nlevsno, maxpatch_glcmec use column_varcon, only : icemec_class_to_col_itype @@ -18,6 +18,7 @@ module test_dyn_cons_biogeophys use SoilStateType, only : soilstate_type use TemperatureType, only : temperature_type use UrbanParamsType, only : urbanparams_type + use LakestateType, only : lakestate_type use WaterType, only : water_type use TotalWaterAndHeatMod, only : AccumulateSoilLiqIceMassNonLake use TotalWaterAndHeatMod, only : AccumulateSoilHeatNonLake @@ -30,6 +31,7 @@ module test_dyn_cons_biogeophys type(soilstate_type) :: soilstate_inst type(temperature_type) :: temperature_inst type(urbanparams_type) :: urbanparams_inst + type(lakestate_type) :: lakestate_inst type(water_type) :: water_inst contains procedure :: setUp @@ -99,8 +101,8 @@ contains real(r8), parameter :: wt_veg_col1 = 0.25_r8 real(r8), parameter :: wt_veg_col2 = 0.75_r8 integer :: veg_col1, veg_col2, glc_col - integer :: num_icemecc, num_natveg_and_icemecc - integer, allocatable :: filter_icemecc(:), filter_natveg_and_icemecc(:) + integer :: num_icemecc, num_natveg_and_icemecc, num_lakec + integer, allocatable :: filter_icemecc(:), filter_natveg_and_icemecc(:), filter_lakec(:) integer :: c real(r8), allocatable :: expected_vals_liq_col(:) real(r8), allocatable :: expected_vals_ice_col(:) @@ -160,6 +162,9 @@ contains numf=num_icemecc, filter=filter_icemecc) call filter_from_range(start=veg_col1, end=glc_col, & numf=num_natveg_and_icemecc, filter=filter_natveg_and_icemecc) + ! For now, this test does NOT cover lake columns. So just use an empty lake filter. + ! This also allows us to avoid initializing variables in this%lakestate_inst. + call filter_empty(num_lakec, filter_lakec) ! Initialize necessary variables in soilstate_inst allocate(this%soilstate_inst%csol_col(bounds%begc:bounds%endc, nlevgrnd)) @@ -203,8 +208,10 @@ contains ! ------------------------------------------------------------------------ call dyn_hwcontent_set_baselines(bounds, num_icemecc, filter_icemecc, & - this%urbanparams_inst, this%soilstate_inst, & - this%water_inst, this%temperature_inst) + num_lakec, filter_lakec, & + this%urbanparams_inst, this%soilstate_inst, this%lakestate_inst, & + this%water_inst, this%temperature_inst, & + reset_all_baselines = .true., reset_lake_baselines = .false.) ! ------------------------------------------------------------------------ ! Compute expected values From 2ad6094dfdff029db8571974fa65d43384c63b60 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 29 Sep 2020 10:17:40 -0600 Subject: [PATCH 1501/1973] add specific heat capacities to clm_varcon --- src/biogeophys/CanopyFluxesMod.F90 | 24 +++++++++++++++--------- src/biogeophys/EnergyFluxType.F90 | 10 +++++----- src/main/clm_varcon.F90 | 2 ++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index ff1ce1688c..2dfe5107dc 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -228,6 +228,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, use clm_varcon , only : sb, cpair, hvap, vkc, grav, denice, c_to_b use clm_varcon , only : denh2o, tfrz, tlsai_crit, alpha_aero use clm_varcon , only : c14ratio + use clm_varcon , only : c_water, c_dry_biomass use perf_mod , only : t_startf, t_stopf use QSatMod , only : QSat use CLMFatesInterfaceMod, only : hlm_fates_interface_type @@ -740,12 +741,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! calculate specify heat capacity of vegetation ! as weighted averaged of dry biomass and water - ! lma_dry has units of kg dry mass/m2 here (table 2 of bonan 2017) - ! cdry_biomass = 1400 J/kg/K, cwater = 4188 J/kg/K - cp_leaf(p) = leaf_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) + ! lma_dry has units of kg dry mass/m2 here + ! (Appendix B of Bonan et al., GMD, 2018) + + cp_leaf(p) = leaf_biomass(p) * (c_dry_biomass*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*c_water) ! cp-stem will have units J/k/ground_area - cp_stem(p) = stem_biomass(p) * (1400._r8*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*4188._r8) + cp_stem(p) = stem_biomass(p) * (c_dry_biomass*(1.-fbw(patch%itype(p))) + (fbw(patch%itype(p)))*c_water) ! adjust for departure from cylindrical stem model cp_stem(p) = k_cyl_vol * cp_stem(p) @@ -1471,15 +1473,19 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy - dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & - emv(p)*emg(c)*sb*(tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1.-frac_rad_abs_by_stem(p))+ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p))*frac_rad_abs_by_stem(p)) + dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & + + emv(p)*emg(c)*sb*(tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & + *(1.-frac_rad_abs_by_stem(p))+ts_ini(p)**3*(ts_ini(p) & + + 4._r8*dt_stem(p))*frac_rad_abs_by_stem(p)) ! Upward longwave radiation above the canopy ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*((1.-frac_rad_abs_by_stem(p)) & - *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))+frac_rad_abs_by_stem(p)*ts_ini(p)**3*(ts_ini(p) & - + 4._r8*dt_stem(p))) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & + *((1.-frac_rad_abs_by_stem(p))*tlbef(p)**3 & + *(tlbef(p) + 4._r8*dt_veg(p)) & + +frac_rad_abs_by_stem(p)*ts_ini(p)**3*(ts_ini(p)+ 4._r8*dt_stem(p))) & + + emg(c)*(1._r8-emv(p))*sb*lw_grnd) ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction diff --git a/src/biogeophys/EnergyFluxType.F90 b/src/biogeophys/EnergyFluxType.F90 index 07829cc199..1f1aa64a9e 100644 --- a/src/biogeophys/EnergyFluxType.F90 +++ b/src/biogeophys/EnergyFluxType.F90 @@ -441,12 +441,12 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp) avgflag='A', long_name='sensible heat from veg', & ptr_patch=this%eflx_sh_veg_patch, set_lake=0._r8, c2l_scale_type='urbanf') - this%eflx_sh_stem_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_STEM', units='W/m^2', & - avgflag='A', long_name='sensible heat from stem', & - ptr_patch=this%eflx_sh_stem_patch, c2l_scale_type='urbanf',default = 'inactive') - if (use_biomass_heat_storage) then + this%eflx_sh_stem_patch(begp:endp) = spval + call hist_addfld1d (fname='FSH_STEM', units='W/m^2', & + avgflag='A', long_name='sensible heat from stem', & + ptr_patch=this%eflx_sh_stem_patch, c2l_scale_type='urbanf',default = 'inactive') + this%dhsdt_canopy_patch(begp:endp) = spval call hist_addfld1d (fname='DHSDT_CANOPY', units='W/m^2', & avgflag='A', long_name='change in canopy heat storage', & diff --git a/src/main/clm_varcon.F90 b/src/main/clm_varcon.F90 index a6044dcb3e..ff9f5e0d2c 100644 --- a/src/main/clm_varcon.F90 +++ b/src/main/clm_varcon.F90 @@ -81,6 +81,8 @@ module clm_varcon real(r8), public :: alpha_aero = 1.0_r8 ! constant for aerodynamic parameter weighting real(r8), public :: tlsai_crit = 2.0_r8 ! critical value of elai+esai for which aerodynamic parameters are maximum real(r8), public :: watmin = 0.01_r8 ! minimum soil moisture (mm) + real(r8), public :: c_water = 4188_r8 ! specific heat of water [J/kg/K] + real(r8), public :: c_dry_biomass = 1400_r8 ! specific heat of dry biomass real(r8), public :: re = SHR_CONST_REARTH*0.001_r8 ! radius of earth (km) From 5da56d380011700afe31667bbe30e0f979501485 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 29 Sep 2020 10:35:01 -0600 Subject: [PATCH 1502/1973] add comment regarding tuning parameters --- src/biogeophys/CanopyFluxesMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 2dfe5107dc..ef1b30d2d6 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -421,7 +421,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed real(r8) :: carea_stem !cross-sectional area of stem - ! biomass parameters + ! Biomass heat storage tuning parameters + ! These parameters can be used to account for differences + ! in vegetation shape. real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume real(r8), parameter :: k_cyl_area = 1.0 !departure from cylindrical area From 23568dd35783ca20d55b2ab610a71ae30dbf3558 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 29 Sep 2020 10:43:58 -0600 Subject: [PATCH 1503/1973] Update ChangeLog --- doc/ChangeLog | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 176 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index b8f8ae3d82..419b9cc203 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,179 @@ =============================================================== +Tag name: ctsm5.1.dev003 +Originator(s): ivanderkelen (Inne Vanderkelen) / sacks (Bill Sacks) +Date: Tue Sep 29 10:16:00 MDT 2020 +One-line Summary: Add capability for dynamic lakes + +Purpose of changes +------------------ + +Adds the capability for dynamic lake areas, read from the +landuse_timeseries file. This represents reservoir construction. For +now, this capability is off by default. Turning it on requires new +fields on the landuse_timeseries file which cannot yet be produced by +mksurfdata_map; these new fields will be added in +https://github.com/ESCOMP/CTSM/pull/1073. + +A substantial part of this tag involved changing the accounting of water +and energy in lakes in order to conserve water and energy across +landunit transitions while not producing too large adjustment +fluxes. This change results in roundoff-level answer changes for all +transient cases. + +The core changes in this tag are from Inne Vanderkelen, in consultation +with Bill Sacks. Additional changes are from Bill Sacks, in consultation +with Inne Vanderkelen. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#200 (Count energy of water in lakes in total + gridcell heat content) +- Resolves ESCOMP/CTSM#1140 (Add lake water to dynbal baselines) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- Using the dynamic lakes functionality will require either the + mksurfdata_map changes in https://github.com/ESCOMP/CTSM/pull/1073 or + manually adding the necessary fields to the landuse_timeseries file. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- New namelist variable for transient runs: do_transient_lakes + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- Using the dynamic lakes functionality will require either the + mksurfdata_map changes in https://github.com/ESCOMP/CTSM/pull/1073 or + manually adding the necessary fields to the landuse_timeseries file. +- For this reason, the new test + (ERS_Lm25.1x1_smallvilleIA.IHistClm50BgcCropQianRsGs.cheyenne_gnu.clm-smallville_dynlakes_monthly) + requires a manual step to create the necessary landuse_timeseries + file. This step is documented in the README file for the + clm-smallville_dynlakes_monthly testmod. + +Changes to tests or testing: +- Added a single-point test covering dynamic lakes, using a + manually-created landuse_timeseries file: + ERS_Lm25.1x1_smallvilleIA.IHistClm50BgcCropQianRsGs.cheyenne_gnu.clm-smallville_dynlakes_monthly + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - ok + + Tests pass, differences from baseline as expected due to new + namelist variable + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + Tests pass, baselines differ as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES + + If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section): + And always remove these three lines and parts that don't apply. + + Summarize any changes to answers, i.e., + - what code configurations: Transient cases + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Mostly roundoff-level. See below for details. + + - Differences in HEAT_CONTENT1, ICE_CONTENT1, LIQUID_CONTENT1, as + expected + + - In transient tests (including Hist/SSP, Fates, CNDV and + transient glacier), roundoff-level diffs in EFLX_DYNBAL, + QFLX_ICE_DYNBAL and QFLX_LIQ_DYNBAL, along with related flux + terms, and river volume + + - In some transient tests, roundoff-level diffs in methane terms, + presumably from downstream effects of changes in VOLR due to + roundoff-level changes in fluxes. In multi-year tests, these + methane diffs grow to bigger than roundoff-level, but I think + they originate from roundoff-level diffs. (I feel like I've seen + this high sensitivity before.) + + - glcMEC_increase test + (ERP_P180x2_D_Ld5.f19_g17_gl4.I1850Clm50BgcCropG.cheyenne_intel.clm-glcMEC_increase) + shows significant differences in river-related terms, maybe due + to glacier running over lake and now lake has different states + than before; also, FILLDIFFs in h1 file because lake remains + active even when it goes to 0 area. + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + - Examined cprnc RMS diffs + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: N/A + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1109 +https://github.com/billsacks/ctsm/pull/3 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev002 Originator(s): slevis (Samuel Levis,303-665-1310) Date: Mon Sep 25 09:39:19 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 1cc194b584..0be3fbeb78 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev003 ivanderk 09/29/2020 Add capability for dynamic lakes ctsm5.1.dev002 slevis 09/25/2020 Reduce duplication between caps ctsm5.1.dev001 erik 09/23/2020 Start the clm5_1 physics series, with some changes to the fire model from Fang Li ctsm1.0.dev113 negins 09/08/2020 Some bit-for-bit changes needed for the Perturbed Parameter Ensemble work From 1e9be52627dbe5b3a9c383a4d13211e0e79f84fa Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Sep 2020 12:58:07 -0600 Subject: [PATCH 1504/1973] Remove whitespace difference so same as ctsm5.1.dev003 base code --- src/main/readParamsMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 index 482d7b05a5..38d412414e 100644 --- a/src/main/readParamsMod.F90 +++ b/src/main/readParamsMod.F90 @@ -57,7 +57,6 @@ subroutine readParameters (nutrient_competition_method, photosyns_inst) use NutrientCompetitionMethodMod , only : nutrient_competition_method_type use clm_varctl, only : NLFilename_in use PhotosynthesisMod , only : photosyns_type - ! ! !ARGUMENTS: type(photosyns_type) , intent(in) :: photosyns_inst From 67a6dda244b23d626668aa1d451e05a816bffc00 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Sep 2020 13:00:56 -0600 Subject: [PATCH 1505/1973] Turn bio-mass heat storage on for clm5_1 --- bld/namelist_files/namelist_defaults_ctsm.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 72592395ea..66a4ca6ac1 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -306,7 +306,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .true. -.false. +.true. +.false. 40 3 From 08e5a90e715a2134a82be20c79c7c9278a743c15 Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Tue, 29 Sep 2020 15:16:45 -0600 Subject: [PATCH 1506/1973] Fix issue#1163 --- src/biogeochem/CNPhenologyMod.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index eba25818c5..28c0ff99ec 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -772,7 +772,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! if this is the end of the offset_period, reset phenology ! flags and indices - if (offset_counter(p) == 0.0_r8) then + if (offset_counter(p) < dt/2._r8) then ! this code block was originally handled by call cn_offset_cleanup(p) ! inlined during vectorization @@ -797,7 +797,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! if this is the end of the onset period, reset phenology ! flags and indices - if (onset_counter(p) == 0.0_r8) then + if (onset_counter(p) < dt/2._r8) then ! this code block was originally handled by call cn_onset_cleanup(p) ! inlined during vectorization @@ -1092,7 +1092,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! if this is the end of the offset_period, reset phenology ! flags and indices - if (offset_counter(p) == 0._r8) then + if (offset_counter(p) < dt/2._r8) then ! this code block was originally handled by call cn_offset_cleanup(p) ! inlined during vectorization offset_flag(p) = 0._r8 @@ -1113,7 +1113,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & ! if this is the end of the onset period, reset phenology ! flags and indices - if (onset_counter(p) == 0.0_r8) then + if (onset_counter(p) < dt/2._r8) then ! this code block was originally handled by call cn_onset_cleanup(p) ! inlined during vectorization onset_flag(p) = 0._r8 @@ -2282,7 +2282,7 @@ subroutine CNOnsetGrowth (num_soilp, filter_soilp, & ! The transfer rate is a linearly decreasing function of time, ! going to zero on the last timestep of the onset period - if (onset_counter(p) == dt) then + if (abs(onset_counter(p) - dt) <= dt/2._r8) then t1 = 1.0_r8 / dt else t1 = 2.0_r8 / (onset_counter(p)) @@ -2427,7 +2427,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & ! only calculate fluxes during offset period if (offset_flag(p) == 1._r8) then - if (offset_counter(p) == dt) then + if (abs(offset_counter(p) - dt) <= dt/2._r8) then t1 = 1.0_r8 / dt frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) From c072fa5c1dbf92a611b21e695729915ca3f7632d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 30 Sep 2020 10:57:34 -0600 Subject: [PATCH 1507/1973] Update ChangeLog --- doc/.ChangeLog_template | 6 +- doc/ChangeLog | 127 ++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 3 files changed, 131 insertions(+), 3 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 1e0dae6bd9..1a33e89e6d 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -101,9 +101,9 @@ Answer changes Changes answers relative to baseline: - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - And always remove these three lines and parts that don't apply. + [ If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section). + And always remove these three lines and parts that don't apply. ] Summarize any changes to answers, i.e., - what code configurations: diff --git a/doc/ChangeLog b/doc/ChangeLog index 419b9cc203..ef35c20835 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,131 @@ =============================================================== +Tag name: ctsm5.1.dev004 +Originator(s): oleson (Keith Oleson), sacks (Bill Sacks) +Date: Wed Sep 30 10:45:25 MDT 2020 +One-line Summary: Improve robustness of onset and offset counters when changing dt + +Purpose of changes +------------------ + +The logic in CNPhenology for onset_counter and offset_counter was not +robust when the model time step differed from the time step used to +generate the finidat file. This showed up when running with a 20-minute +time step using a finidat file that was generated with a 30-minute time +step. See https://github.com/ESCOMP/CTSM/issues/1163 for details. + +The fix here improves the situation significantly, but I believe still +leaves some issues remaining; see +https://github.com/ESCOMP/CTSM/issues/1167 for details. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1163 (onset_counter variable on (all?) restart + files is not compatible with subsequent model runs using a 20 minute + time step) + +Known bugs introduced in this tag (include github issue ID): +- ESCOMP/CTSM#1167 (Rework CNPhenology onset and offset triggers to be + more robust to changes in dt) + - This issue was not exactly introduced in this tag, but it captures + some things that I think still need to be done for complete robustness + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not checked (none expected) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- pass + + ok: tests pass, one test had answer changes as noted below + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but in very limited circumstances + + Summarize any changes to answers, i.e., + - what code configurations: Only when the model run uses a different + time step than the initial conditions file + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff; magnitude not investigated; in some cases, + the differences might be significant if the model actually + continues without aborting + + In the aux_clm test suite, this only appears in one test: + SMS_Ln9.ne30pg2_ne30pg2_mg17.I2000Clm50BgcCrop.cheyenne_intel.clm-clm50cam6LndTuningMode + + but it might appear more widely in cam / fully coupled testing + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1165 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev003 Originator(s): ivanderkelen (Inne Vanderkelen) / sacks (Bill Sacks) Date: Tue Sep 29 10:16:00 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 0be3fbeb78..5b86617538 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev004 oleson 09/30/2020 Improve robustness of onset and offset counters when changing dt ctsm5.1.dev003 ivanderk 09/29/2020 Add capability for dynamic lakes ctsm5.1.dev002 slevis 09/25/2020 Reduce duplication between caps ctsm5.1.dev001 erik 09/23/2020 Start the clm5_1 physics series, with some changes to the fire model from Fang Li From 5cd478e01faba5935a5ef9431225ab0bdb3be5b6 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 30 Sep 2020 14:49:42 -0600 Subject: [PATCH 1508/1973] Apply changes to CNFireLi2021 like those applied to other fire versions Similar to the changes in e345c3903 for other fire versions --- src/biogeochem/CNFireLi2021Mod.F90 | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 1d89a11a83..e008205bd4 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -19,7 +19,7 @@ module CNFireLi2021Mod use shr_infnan_mod , only : shr_infnan_isnan use shr_log_mod , only : errMsg => shr_log_errMsg use clm_varctl , only : iulog - use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full + use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full, nlevgrnd use clm_varcon , only : dzsoi_decomp use pftconMod , only : noveg, pftcon use abortutils , only : endrun @@ -37,6 +37,9 @@ module CNFireLi2021Mod use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use GridcellType , only : grc use ColumnType , only : col use PatchType , only : patch @@ -85,8 +88,10 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & - wateratm2lndbulk_inst, cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & + cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: ! Computes column-level burned area @@ -107,11 +112,16 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilc(:) ! filter for soil columns integer , intent(in) :: num_soilp ! number of soil patches in filter integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst real(r8) , intent(in) :: totlitc_col(bounds%begc:) @@ -344,6 +354,10 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ dtrotr_col(c)=0._r8 end if end do + + call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) + do pi = 1,max_patch_per_col do fc = 1,num_soilc c = filter_soilc(fc) @@ -659,19 +673,15 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end subroutine CNFireArea !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedvegp, filter_exposedvegp, & + subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) ! ! Calculate the root wetness term that will be used by the fire model ! use pftconMod , only : pftcon use PatchType , only : patch - use WaterStateBulkType , only : waterstatebulk_type - use SoilStateType , only : soilstate_type - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type class(cnfire_base_type) :: this type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: nlevgrnd !number of vertical layers integer , intent(in) :: num_exposedvegp !number of filters integer , intent(in) :: filter_exposedvegp(:) !filter array type(waterstatebulk_type), intent(in) :: waterstatebulk_inst @@ -688,7 +698,8 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation btran2 => this%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) + ! FIXME(wjs, 2020-09-18) change this to use h2osoi_vol_col instead of the prehydrology version + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_prehydrology_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) do j = 1,nlevgrnd From bfed6141d5c48c8c3495e82aa63961349f35399c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 30 Sep 2020 14:55:23 -0600 Subject: [PATCH 1509/1973] Minor cleanup --- src/biogeochem/CNFireLi2021Mod.F90 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index e008205bd4..544ee7fb8c 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -17,7 +17,6 @@ module CNFireLi2021Mod use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL use shr_const_mod , only : SHR_CONST_PI,SHR_CONST_TKFRZ use shr_infnan_mod , only : shr_infnan_isnan - use shr_log_mod , only : errMsg => shr_log_errMsg use clm_varctl , only : iulog use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full, nlevgrnd use clm_varcon , only : dzsoi_decomp @@ -46,7 +45,6 @@ module CNFireLi2021Mod use SoilBiogeochemStateType , only : get_spinup_latitude_term use FireMethodType , only : fire_method_type use CNFireBaseMod , only : cnfire_base_type, cnfire_const, cnfire_params - use CNFireBaseMod , only : cnfire_base_type, cnfire_const ! implicit none private @@ -66,12 +64,12 @@ module CNFireLi2021Mod ! ! !PRIVATE MEMBER DATA: !----------------------------------------------------------------------- + character(len=*), parameter, private :: sourcefile = & __FILE__ contains - !----------------------------------------------------------------------- function need_lightning_and_popdens(this) ! !ARGUMENTS: @@ -97,7 +95,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! Computes column-level burned area ! ! !USES: - use clm_time_manager , only: get_step_size, get_days_per_year, get_curr_date, get_nstep + use clm_time_manager , only: get_step_size_real, get_days_per_year, get_curr_date, get_nstep use clm_varpar , only: max_patch_per_col use clm_varcon , only: secspday, secsphr use clm_varctl , only: spinup_state @@ -158,9 +156,9 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ real(r8), pointer :: rh30_col(:) !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(totlitc_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soi17cm_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL_FL((ubound(totlitc_col) == (/bounds%endc/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(t_soi17cm_col) == (/bounds%endc/)), sourcefile, __LINE__) associate( & totlitc => totlitc_col , & ! Input: [real(r8) (:) ] (gC/m2) total lit C (column-level mean) @@ -270,7 +268,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ call get_curr_date (kyr, kmo, kda, mcsec) dayspyr = get_days_per_year() ! Get model step size - dt = real( get_step_size(), r8 ) + dt = get_step_size_real() ! ! On first time-step, just set area burned to zero and exit ! @@ -355,6 +353,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do + ! This subroutine calculates btran2 call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) From b496b65ab9b6ddf7668a0e3cf4a6ca67da6941ad Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 30 Sep 2020 15:55:02 -0600 Subject: [PATCH 1510/1973] Change some stray SHR_ASSERT calls to SHR_ASSERT_FL --- src/dyn_subgrid/dynSubgridControlMod.F90 | 2 +- src/main/glc2lndMod.F90 | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dyn_subgrid/dynSubgridControlMod.F90 b/src/dyn_subgrid/dynSubgridControlMod.F90 index 6d9a703b31..e7f7b174a3 100644 --- a/src/dyn_subgrid/dynSubgridControlMod.F90 +++ b/src/dyn_subgrid/dynSubgridControlMod.F90 @@ -344,7 +344,7 @@ logical function get_do_transient_lakes() ! Return the value of the do_transient_lakes control flag !----------------------------------------------------------------------- - SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__)) + SHR_ASSERT_FL(dyn_subgrid_control_inst%initialized, sourcefile, __LINE__) get_do_transient_lakes = dyn_subgrid_control_inst%do_transient_lakes diff --git a/src/main/glc2lndMod.F90 b/src/main/glc2lndMod.F90 index 4bbb016109..b23e40c333 100644 --- a/src/main/glc2lndMod.F90 +++ b/src/main/glc2lndMod.F90 @@ -324,11 +324,11 @@ subroutine set_glc2lnd_fields_nuopc(this, bounds, glc_present, & character(len=*), parameter :: subname = 'set_glc2lnd_fields_nuopc' !----------------------------------------------------------------------- - SHR_ASSERT((ubound(frac_grc, 1) == bounds%endg), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((ubound(topo_grc, 1) == bounds%endg), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((ubound(hflx_grc, 1) == bounds%endg), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((ubound(icemask_grc,1) == bounds%endg), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((ubound(icemask_coupled_fluxes_grc,1) == bounds%endg), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_FL((ubound(frac_grc, 1) == bounds%endg), sourcefile, __LINE__) + SHR_ASSERT_FL((ubound(topo_grc, 1) == bounds%endg), sourcefile, __LINE__) + SHR_ASSERT_FL((ubound(hflx_grc, 1) == bounds%endg), sourcefile, __LINE__) + SHR_ASSERT_FL((ubound(icemask_grc,1) == bounds%endg), sourcefile, __LINE__) + SHR_ASSERT_FL((ubound(icemask_coupled_fluxes_grc,1) == bounds%endg), sourcefile, __LINE__) if (glc_present) then do g = bounds%begg, bounds%endg From 0a970625cd1714b853b7242ee99be6ce3afe4546 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 30 Sep 2020 16:34:46 -0600 Subject: [PATCH 1511/1973] run_sys_tests: use abspath of --testfile argument This is needed on izumi, since the create_test batch job is run from your home directory rather than the current working directory --- python/ctsm/run_sys_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index bbde160fe3..7d5d0a2e94 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -164,7 +164,7 @@ def run_sys_tests(machine, cime_path, if not dry_run: _make_cs_status_non_suite(testroot, testid_base) if testfile: - test_args = ['--testfile', testfile] + test_args = ['--testfile', os.path.abspath(testfile)] elif testlist: test_args = testlist else: From e4b6bccac824324047ff13831c936429df2a364c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Oct 2020 16:56:11 -0600 Subject: [PATCH 1512/1973] Initialize btran2 to 0 in CNFireLi2021Mod Resolves ESCOMP/CTSM#1171 --- src/biogeochem/CNFireLi2021Mod.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 1d89a11a83..7552a6f7bb 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -691,6 +691,10 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) + do f = 1, num_exposedvegp + p = filter_exposedvegp(f) + btran2(p) = 0._r8 + end do do j = 1,nlevgrnd do f = 1, num_exposedvegp p = filter_exposedvegp(f) From 7a7ab79dc634f85676c1d8b1adb750adfe72c7d2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Oct 2020 17:02:11 -0600 Subject: [PATCH 1513/1973] Remove multiplications by col%wtgcell in CNFireLi2021Mod Partially addresses ESCOMP/CTSM/#1169. See today's comments in https://github.com/ESCOMP/CTSM/issues/889 --- src/biogeochem/CNFireLi2021Mod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 7552a6f7bb..ee66095ce2 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -382,10 +382,10 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! whereas in fact the land cover change occurred when the column *was* ! tropical closed forest. if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr1_col(c)=trotr1_col(c)+patch%wtcol(p)*col%wtgcell(c) + trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) end if if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr2_col(c)=trotr2_col(c)+patch%wtcol(p)*col%wtgcell(c) + trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) end if if (transient_landcover) then @@ -409,7 +409,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! different seasons. But having deforestation spread evenly ! throughout the year is much better than having it all ! concentrated on January 1.) - dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p)*col%wtgcell(c) + dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) end if end if end if From b45f492f403622c1b0ced81cbbd9300347ade0fd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Oct 2020 17:06:41 -0600 Subject: [PATCH 1514/1973] Initialize nfire to 0 in CNFireLi2021Mod Partially addresses ESCOMP/CTSM#1169 --- src/biogeochem/CNFireLi2021Mod.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index ee66095ce2..b6926f967a 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -581,6 +581,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ c = filter_soilc(fc) g = col%gridcell(c) hdmlf=this%forc_hdm(g) + nfire(c) = 0._r8 if( cropf_col(c) < 1._r8 )then fuelc(c) = totlitc(c)+totvegc(c)-rootc_col(c)-fuelc_crop(c)*cropf_col(c) if (spinup_state == 2) then From e8327910a82fbab49e252c9d387336ad0af70589 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Oct 2020 17:09:15 -0600 Subject: [PATCH 1515/1973] Fix organic_frac_squared default for clm5_1 Partially addresses ESCOMP/CTSM#1166 --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 1ca1015d9e..0e4cb6857d 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -160,9 +160,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. -.true. .true. .false. +.false. 4SL_2m 20SL_8.5m From 97e12a8f4efc46e32b483f75c9d9dd8884cd00e6 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Oct 2020 17:21:15 -0600 Subject: [PATCH 1516/1973] Add a place to document significant changes to CLM51 configurations --- doc/.ChangeLog_template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 1a33e89e6d..107df0102a 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -29,6 +29,8 @@ Does this tag change answers significantly for any of the following physics conf [Put an [X] in the box for any configuration with significant answer changes.] +[ ] clm5_1 + [ ] clm5_0 [ ] ctsm5_0-nwp From 00a8c3ad35e945e5ba365df4238224f5a5e99b9c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 2 Oct 2020 09:56:21 -0600 Subject: [PATCH 1517/1973] Update ChangeLog --- doc/ChangeLog | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 126 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index ef35c20835..51d3b6fd43 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,129 @@ =============================================================== +Tag name: ctsm5.1.dev005 +Originator(s): sacks (Bill Sacks) +Date: Fri Oct 2 09:51:08 MDT 2020 +One-line Summary: Answer changing bug fixes for clm51: fire and organic_frac_squared + +Purpose of changes +------------------ + +A few bug fixes for CLM51: +- Initialize btran2 to 0 in CNFireLi2021Mod +- Remove multiplications by col%wtgcell in CNFireLi2021Mod +- Initialize nfire to 0 in CNFireLi2021Mod +- Fix organic_frac_squared default for clm5_1 + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1171 (btran2 not initialized to zero in + CNFireLi2021Mod.F90) +- Partially addresses ESCOMP/CTSM#1169 (CNFireLi2021Mod reintroduces a + number of bugs that were fixed in earlier versions) +- Partially addresses ESCOMP/CTSM#1166 (Possible problems with namelist + defaults starting in ctsm5.0.dev001) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): +- Fixes default for organic_frac_squared for clm5_1 + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not investigated (none expected) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok: tests pass, baselines fail just for CLM51 cases, as expected + + NOTE: The following expensive tests did not run, due to a long queue + wait time; we are about to remove these tests from the test suite + anyway: + + PEND ERS_D_Ld10.C96_C96_mg17.IHistClm50Sp.cheyenne_intel.clm-decStart RUN + PEND ERS_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.IHistClm50SpGs.cheyenne_intel.clm-clm50cam6LndTuningMode_1979Start RUN + PEND SMS_Ln9.ne0ARCTICGRISne30x8_ne0ARCTICGRISne30x8_mt12.IHistClm50Sp.cheyenne_intel.clm-clm50cam6LndTuningMode_1979Start RUN + PEND SMS_Ln9.ne0ARCTICGRISne30x8_ne0ARCTICGRISne30x8_mt12.ISSP585Clm50BgcCrop.cheyenne_intel.clm-clm50cam6LndTuningMode RUN + PEND SMS_Ln9.ne0CONUSne30x8_ne0CONUSne30x8_mt12.IHistClm50Sp.cheyenne_intel.clm-clm50cam6LndTuningMode_2013Start RUN + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES - just for CLM51 + + Summarize any changes to answers, i.e., + - what code configurations: CLM51 + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + possibly new climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1172 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev004 Originator(s): oleson (Keith Oleson), sacks (Bill Sacks) Date: Wed Sep 30 10:45:25 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 5b86617538..1e29e23064 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev005 sacks 10/02/2020 Answer changing bug fixes for clm51: fire and organic_frac_squared ctsm5.1.dev004 oleson 09/30/2020 Improve robustness of onset and offset counters when changing dt ctsm5.1.dev003 ivanderk 09/29/2020 Add capability for dynamic lakes ctsm5.1.dev002 slevis 09/25/2020 Reduce duplication between caps From fe48181cb15602f7a9b51490ce8ebe3b897d16b9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 2 Oct 2020 12:35:44 -0600 Subject: [PATCH 1518/1973] Call correct routine to calculate btran2 for CNFireLi2021 Resolves ESCOMP/CTSM#1173 --- src/biogeochem/CNFireLi2021Mod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index b6926f967a..2547a7305a 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -58,6 +58,7 @@ module CNFireLi2021Mod ! !PUBLIC MEMBER FUNCTIONS: procedure, public :: need_lightning_and_popdens procedure, public :: CNFireArea ! Calculate fire area + procedure, public :: CNFire_calc_fire_root_wetness ! Calculate the root wetness term that will be used by the fire model end type cnfire_li2021_type ! @@ -670,7 +671,7 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, nlevgrnd, num_exposedveg use WaterStateBulkType , only : waterstatebulk_type use SoilStateType , only : soilstate_type use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - class(cnfire_base_type) :: this + class(cnfire_li2021_type) :: this type(bounds_type) , intent(in) :: bounds !bounds integer , intent(in) :: nlevgrnd !number of vertical layers integer , intent(in) :: num_exposedvegp !number of filters From ec8d075d57c071436921e9599d0e300319e123fe Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 30 Sep 2020 16:47:38 -0600 Subject: [PATCH 1519/1973] Calculate fire btran2 using updated h2osoi_vol I had introduced a temporary, saved version of h2osoi_vol to achieve bit-for-bit results in my testing. Now that I have verified that the main changes are bit-for-bit, I'm changing this to use the actual h2osoi_vol. This will change answers, because fire's btran2 will now use the values of h2osoi_vol updated later in the driver loop. --- src/biogeochem/CNFireBaseMod.F90 | 3 +-- src/biogeochem/CNFireLi2021Mod.F90 | 3 +-- src/biogeophys/HydrologyNoDrainageMod.F90 | 8 -------- src/biogeophys/WaterStateBulkType.F90 | 4 ---- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 47feaca2fa..ddbc8f8156 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -229,8 +229,7 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation btran2 => this%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - ! FIXME(wjs, 2020-09-18) change this to use h2osoi_vol_col instead of the prehydrology version - h2osoi_vol => waterstatebulk_inst%h2osoi_vol_prehydrology_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) do f = 1, num_exposedvegp diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 5fd8a79ec4..688d3d56e7 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -699,8 +699,7 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation btran2 => this%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - ! FIXME(wjs, 2020-09-18) change this to use h2osoi_vol_col instead of the prehydrology version - h2osoi_vol => waterstatebulk_inst%h2osoi_vol_prehydrology_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) do f = 1, num_exposedvegp diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index 6c2bcee4eb..2596f7e5b0 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -251,7 +251,6 @@ subroutine HydrologyNoDrainage(bounds, & h2osoi_ice_tot => b_waterdiagnostic_inst%h2osoi_ice_tot_col , & ! Output: [real(r8) (:) ] vertically summed ice lens (kg/m2) h2osoi_liq_tot => b_waterdiagnostic_inst%h2osoi_liq_tot_col , & ! Output: [real(r8) (:) ] vertically summed liquid water (kg/m2) h2osoi_vol => b_waterstate_inst%h2osoi_vol_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - h2osoi_vol_prehydrology => b_waterstate_inst%h2osoi_vol_prehydrology_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) saved before hydrology [m3/m3] h2osno_top => b_waterdiagnostic_inst%h2osno_top_col , & ! Output: [real(r8) (:) ] mass of snow in top layer (col) [kg] wf => b_waterdiagnostic_inst%wf_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.05 m wf2 => b_waterdiagnostic_inst%wf2_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m @@ -273,13 +272,6 @@ subroutine HydrologyNoDrainage(bounds, & call water_inst%TracerConsistencyCheck(bounds, 'before main snow code in HydrologyNoDrainage') end if - do j = 1, nlevgrnd - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - h2osoi_vol_prehydrology(c,j) = h2osoi_vol(c,j) - end do - end do - ! Determine step size dtime = get_step_size_real() diff --git a/src/biogeophys/WaterStateBulkType.F90 b/src/biogeophys/WaterStateBulkType.F90 index 402486bd2f..ff3cd23a2e 100644 --- a/src/biogeophys/WaterStateBulkType.F90 +++ b/src/biogeophys/WaterStateBulkType.F90 @@ -27,8 +27,6 @@ module WaterStateBulkType real(r8), pointer :: snow_persistence_col (:) ! col length of time that ground has had non-zero snow thickness (sec) real(r8), pointer :: int_snow_col (:) ! col integrated snowfall (mm H2O) - real(r8), pointer :: h2osoi_vol_prehydrology_col (:,:) ! col volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - saved pre-hydrology - contains @@ -105,8 +103,6 @@ subroutine InitBulkAllocate(this, bounds) allocate(this%snow_persistence_col (begc:endc)) ; this%snow_persistence_col (:) = nan allocate(this%int_snow_col (begc:endc)) ; this%int_snow_col (:) = nan - allocate(this%h2osoi_vol_prehydrology_col(begc:endc, 1:nlevgrnd)); this%h2osoi_vol_prehydrology_col(:,:) = nan - end subroutine InitBulkAllocate From b1cf8b9f915c328b161f69525c56a04955c5d642 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 2 Oct 2020 10:09:29 -0600 Subject: [PATCH 1520/1973] Reinitialize fire btran2 to spval for all patches in each time step This, or something like it, is important so that the fire code isn't trying to use btran2 from earlier time steps for patches that were in the exposed veg filter at one point but no longer are. The fix here is not the cleanest way to fix this issue, but represents a minimal set of changes to fix the issue. In a later commit, I'll try to fix this in a better way (which should be bit-for-bit with this fix). Resolves ESCOMP/CTSM#1153 (Fire btran2 is only computed for exposed veg patches, but is used over all veg patches) --- src/biogeochem/CNFireBaseMod.F90 | 5 +++++ src/biogeochem/CNFireLi2021Mod.F90 | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index ddbc8f8156..0b126f20cb 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -201,6 +201,8 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ ! ! Calculate the root wetness term that will be used by the fire model ! + ! FIXME(wjs, 2020-10-02) remove next line + use clm_varcon , only : spval use pftconMod , only : pftcon use clm_varpar , only : nlevgrnd use PatchType , only : patch @@ -232,6 +234,9 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) + ! FIXME(wjs, 2020-10-02) Remove next line + btran2(bounds%begp:bounds%endp) = spval + do f = 1, num_exposedvegp p = filter_exposedvegp(f) btran2(p) = btran0 diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 688d3d56e7..07d7234262 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -679,6 +679,8 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ ! ! Calculate the root wetness term that will be used by the fire model ! + ! FIXME(wjs, 2020-10-02) remove next line + use clm_varcon , only : spval use pftconMod , only : pftcon use PatchType , only : patch class(cnfire_li2021_type) :: this @@ -702,6 +704,9 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) + ! FIXME(wjs, 2020-10-02) Remove next line + btran2(bounds%begp:bounds%endp) = spval + do f = 1, num_exposedvegp p = filter_exposedvegp(f) btran2(p) = 0._r8 From 4291f064f7c98c787a4bb17476a83d3b3fee0cc4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 2 Oct 2020 10:42:40 -0600 Subject: [PATCH 1521/1973] Limit fire btran2 to be <= 1 For the older version calculated in CNFireBaseMod, btran2 could sometimes be roundoff-level greater than 1. Due to a conditional in CNFireArea, these slightly-greater-than-1 values were being ignored when computing btran_col, rather than averaging in a 1 value. I haven't investigated the behavior in the new version in CNFireLi2021Mod, but it seems like this could have the same issue. It's also possible, though, that we'd exceed 1 by more than roundoff in that version under some conditions, if h2osoi_vol > watsat in some layers. The endrun call will tell us if that's happening. Note that I plan to remove the endrun call after initial testing, because it seems like the correct thing to do here is to limit the btran2 value to be no more than 1 even if it exceeds 1 by more than roundoff. --- src/biogeochem/CNFireBaseMod.F90 | 13 +++++++++++++ src/biogeochem/CNFireLi2021Mod.F90 | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 0b126f20cb..f4725bf9f8 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -255,6 +255,19 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8)) end do end do + + do f = 1, num_exposedvegp + p = filter_exposedvegp(f) + if (btran2(p) > 1._r8) then + ! FIXME(wjs, 2020-10-02) remove this endrun conditional + if (btran2(p) > (1._r8 + 1.e-12_r8)) then + write(iulog,*) 'btran2 exceeds 1 by too much: ', p, btran2(p) + call endrun('btran2 exceeds 1 by too much') + end if + btran2(p) = 1._r8 + end if + end do + end associate end subroutine CNFire_calc_fire_root_wetness diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 07d7234262..644e528d0a 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -720,6 +720,19 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ btran2(p) = btran2(p) + rootfr(p,j)*s_node end do end do + + do f = 1, num_exposedvegp + p = filter_exposedvegp(f) + if (btran2(p) > 1._r8) then + ! FIXME(wjs, 2020-10-02) remove this endrun conditional + if (btran2(p) > (1._r8 + 1.e-12_r8)) then + write(iulog,*) 'btran2 exceeds 1 by too much: ', p, btran2(p) + call endrun('btran2 exceeds 1 by too much') + end if + btran2(p) = 1._r8 + end if + end do + end associate end subroutine CNFire_calc_fire_root_wetness From d6d5342ae4a8fccdad8c387ff5318d276316fca1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 3 Oct 2020 19:54:45 -0600 Subject: [PATCH 1522/1973] Update ChangeLog --- doc/ChangeLog | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 118 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 51d3b6fd43..0af8f22877 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,121 @@ =============================================================== +Tag name: ctsm5.1.dev006 +Originator(s): sacks (Bill Sacks) +Date: Sat Oct 3 19:50:41 MDT 2020 +One-line Summary: Call correct routine to calculate btran2 for CNFireLi2021 + +Purpose of changes +------------------ + +Due to a subtle code bug, CNFireLi2021 was using the btran2 calculating +routine from the base class rather than the new one that is specific to +this formulation. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1173 (CNFireLi2021Mod uses the wrong btran2 + routine) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: not investigated (none expected) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok: tests pass, Clm51Bgc baselines fail as expected + + Note: there were also the following BFAIL results due to missing + baselines, as documented in the previous tag: + + FAIL ERS_D_Ld10.C96_C96_mg17.IHistClm50Sp.cheyenne_intel.clm-decStart BASELINE ctsm5.1.dev005: ERROR BFAIL some baseline files were missing + FAIL ERS_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.IHistClm50SpGs.cheyenne_intel.clm-clm50cam6LndTuningMode_1979Start BASELINE ctsm5.1.dev005: ERROR BFAIL some baseline files were missing + FAIL SMS_Ln9.ne0ARCTICGRISne30x8_ne0ARCTICGRISne30x8_mt12.IHistClm50Sp.cheyenne_intel.clm-clm50cam6LndTuningMode_1979Start BASELINE ctsm5.1.dev005: ERROR BFAIL some baseline files were missing + FAIL SMS_Ln9.ne0ARCTICGRISne30x8_ne0ARCTICGRISne30x8_mt12.ISSP585Clm50BgcCrop.cheyenne_intel.clm-clm50cam6LndTuningMode BASELINE ctsm5.1.dev005: ERROR BFAIL some baseline files were missing + FAIL SMS_Ln9.ne0CONUSne30x8_ne0CONUSne30x8_mt12.IHistClm50Sp.cheyenne_intel.clm-clm50cam6LndTuningMode_2013Start BASELINE ctsm5.1.dev005: ERROR BFAIL some baseline files were missing + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES + + Summarize any changes to answers, i.e., + - what code configurations: Clm51Bgc + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff; whether it is climate changing was not investigated + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1174 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev005 Originator(s): sacks (Bill Sacks) Date: Fri Oct 2 09:51:08 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 1e29e23064..fe6c8fa632 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev006 sacks 10/03/2020 Call correct routine to calculate btran2 for CNFireLi2021 ctsm5.1.dev005 sacks 10/02/2020 Answer changing bug fixes for clm51: fire and organic_frac_squared ctsm5.1.dev004 oleson 09/30/2020 Improve robustness of onset and offset counters when changing dt ctsm5.1.dev003 ivanderk 09/29/2020 Add capability for dynamic lakes From c6675b3c2754ccdfa18f127126dee544fd464e2c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 4 Oct 2020 11:59:15 -0600 Subject: [PATCH 1523/1973] In CNFireLi2021: Allow btran2 to exceed 1 by somewhat more In the test ERS_Ly5_P144x1.f10_f10_musgs.IHistClm51BgcCropGs.cheyenne_intel.clm-cropMonthOutput, btran2 was sometimes exceeding (1 + 1e-12). I was sort of expecting this. So relax tolerance to (1.01); let's see if this is enough. --- src/biogeochem/CNFireLi2021Mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 644e528d0a..4029de6bf1 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -725,7 +725,7 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ p = filter_exposedvegp(f) if (btran2(p) > 1._r8) then ! FIXME(wjs, 2020-10-02) remove this endrun conditional - if (btran2(p) > (1._r8 + 1.e-12_r8)) then + if (btran2(p) > (1._r8 + 1.e-2_r8)) then write(iulog,*) 'btran2 exceeds 1 by too much: ', p, btran2(p) call endrun('btran2 exceeds 1 by too much') end if From 04c968c04d0944d2afabdf0b16ca7f309d46e0c1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 4 Oct 2020 12:21:11 -0600 Subject: [PATCH 1524/1973] In CNFireLi2021: Remove check on btran2 significantly greater than 1 I am finding that, for the new (2021) fire code, btran2 can sometimes exceed 1 by more than roundoff. From about 3 days at f10 resolution, it seems like this new definition of btran2 still does not get substantially more than 1, but I saw values as high as 1.01. (In contrast, the older definition of btran2 remained no greater than (1 + 1e-12) over multiple years.) I still feel that the correct thing to do is to limit btran2 to be no greater than 1 - rather than the current code, which allows btran2 > 1 but then ignores all values > 1 when taking the column average. I will move ahead with this fix unless someone chimes in with different feelings. --- src/biogeochem/CNFireLi2021Mod.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 4029de6bf1..f7310d4053 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -724,11 +724,6 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ do f = 1, num_exposedvegp p = filter_exposedvegp(f) if (btran2(p) > 1._r8) then - ! FIXME(wjs, 2020-10-02) remove this endrun conditional - if (btran2(p) > (1._r8 + 1.e-2_r8)) then - write(iulog,*) 'btran2 exceeds 1 by too much: ', p, btran2(p) - call endrun('btran2 exceeds 1 by too much') - end if btran2(p) = 1._r8 end if end do From ad4f17c2a8c196c4aca39c6cfead59602cef1a3a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 4 Oct 2020 12:08:54 -0600 Subject: [PATCH 1525/1973] Fire btran2 cleanup that should be bit-for-bit After the answer changing fixes in the previous commits, this cleanup should now be bit-for-bit: - get rid of the temporary initialization of btran2 to spval over all points - get rid of my temporary endrun call for btran2(p) significantly greater than 1 - remove btran2 from the restart file - the calculations of btran_col and wtlf should just be done over the exposedvegp filter - get rid of the checks for shr_infnan_isnan(btran2(p)) and btran2(p) <= 1 --- src/biogeochem/CNFireBaseMod.F90 | 31 --------------------------- src/biogeochem/CNFireLi2014Mod.F90 | 15 +++++++------ src/biogeochem/CNFireLi2016Mod.F90 | 15 +++++++------ src/biogeochem/CNFireLi2021Mod.F90 | 26 +++++++++++----------- src/biogeochem/CNVegetationFacade.F90 | 2 -- src/main/FireMethodType.F90 | 21 ------------------ 6 files changed, 30 insertions(+), 80 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index f4725bf9f8..a88e3778e9 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -82,7 +82,6 @@ module CNFireBaseMod ! !PUBLIC MEMBER FUNCTIONS: procedure, public :: FireInit => CNFireInit ! Initialization of Fire procedure, public :: FireReadNML ! Read in namelist for CNFire - procedure, public :: CNFireRestart ! Restart for CNFire procedure, public :: CNFireReadParams ! Read in constant parameters from the paramsfile procedure, public :: CNFireFluxes ! Calculate fire fluxes procedure, public :: CNFire_calc_fire_root_wetness ! Calcualte CN-fire specific root wetness @@ -175,34 +174,12 @@ subroutine InitHistory( this, bounds ) ptr_patch=this%btran2_patch, l2g_scale_type='veg') end subroutine InitHistory - !---------------------------------------------------------------------- - subroutine CNFireRestart( this, bounds, ncid, flag ) - use ncdio_pio , only : ncd_double, file_desc_t - use restUtilMod , only : restartvar - implicit none - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - - logical :: readvar - - call restartvar(ncid=ncid, flag=flag, varname='btran2', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%btran2_patch) - end subroutine CNFireRestart - !---------------------------------------------------------------------- subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) ! ! Calculate the root wetness term that will be used by the fire model ! - ! FIXME(wjs, 2020-10-02) remove next line - use clm_varcon , only : spval use pftconMod , only : pftcon use clm_varpar , only : nlevgrnd use PatchType , only : patch @@ -234,9 +211,6 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) - ! FIXME(wjs, 2020-10-02) Remove next line - btran2(bounds%begp:bounds%endp) = spval - do f = 1, num_exposedvegp p = filter_exposedvegp(f) btran2(p) = btran0 @@ -259,11 +233,6 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ do f = 1, num_exposedvegp p = filter_exposedvegp(f) if (btran2(p) > 1._r8) then - ! FIXME(wjs, 2020-10-02) remove this endrun conditional - if (btran2(p) > (1._r8 + 1.e-12_r8)) then - write(iulog,*) 'btran2 exceeds 1 by too much: ', p, btran2(p) - call endrun('btran2 exceeds 1 by too much') - end if btran2(p) = 1._r8 end if end do diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index c3efbe7069..6abe8f7ca3 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -336,6 +336,15 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! This subroutine calculates btran2 call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + c = patch%column(p) + ! For non-crop -- natural vegetation and bare-soil + if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then + btran_col(c) = btran_col(c)+btran2(p)*patch%wtcol(p) + wtlf(c) = wtlf(c)+patch%wtcol(p) + end if + end do do pi = 1,max_patch_per_col do fc = 1,num_soilc @@ -346,12 +355,6 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! For non-crop -- natural vegetation and bare-soil if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then - if( .not. shr_infnan_isnan(btran2(p))) then - if (btran2(p) <= 1._r8 ) then - btran_col(c) = btran_col(c)+btran2(p)*patch%wtcol(p) - wtlf(c) = wtlf(c)+patch%wtcol(p) - end if - end if ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen ! and deciduous tropical trees (used to determine if a column is diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index 9d3726ccd1..01a5751a8f 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -357,6 +357,15 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! This subroutine calculates btran2 call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + c = patch%column(p) + ! For non-crop -- natural vegetation and bare-soil + if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then + btran_col(c) = btran_col(c)+btran2(p)*patch%wtcol(p) + wtlf(c) = wtlf(c)+patch%wtcol(p) + end if + end do do pi = 1,max_patch_per_col do fc = 1,num_soilc @@ -367,12 +376,6 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! For non-crop -- natural vegetation and bare-soil if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then - if( .not. shr_infnan_isnan(btran2(p))) then - if (btran2(p) <= 1._r8 ) then - btran_col(c) = btran_col(c)+btran2(p)*patch%wtcol(p) - wtlf(c) = wtlf(c)+patch%wtcol(p) - end if - end if ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen ! and deciduous tropical trees (used to determine if a column is diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index f7310d4053..9ee9f72898 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -357,6 +357,17 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! This subroutine calculates btran2 call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + c = patch%column(p) + ! For non-crop -- natural vegetation and bare-soil + if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then + btran_col(c) = btran_col(c)+max(0._r8, min(1._r8, & + (btran2(p)-rswf_min(patch%itype(p)))/(rswf_max(patch%itype(p)) & + -rswf_min(patch%itype(p)))))*patch%wtcol(p) + wtlf(c) = wtlf(c)+patch%wtcol(p) + end if + end do do pi = 1,max_patch_per_col do fc = 1,num_soilc @@ -366,15 +377,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ p = col%patchi(c) + pi - 1 ! For non-crop -- natural vegetation and bare-soil - if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1._r8 )then - if( .not. shr_infnan_isnan(btran2(p))) then - if (btran2(p) <= 1._r8 ) then - btran_col(c) = btran_col(c)+max(0._r8, min(1._r8, & - (btran2(p)-rswf_min(patch%itype(p)))/(rswf_max(patch%itype(p)) & - -rswf_min(patch%itype(p)))))*patch%wtcol(p) - wtlf(c) = wtlf(c)+patch%wtcol(p) - end if - end if + if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen ! and deciduous tropical trees (used to determine if a column is @@ -679,8 +682,6 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ ! ! Calculate the root wetness term that will be used by the fire model ! - ! FIXME(wjs, 2020-10-02) remove next line - use clm_varcon , only : spval use pftconMod , only : pftcon use PatchType , only : patch class(cnfire_li2021_type) :: this @@ -704,9 +705,6 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) - ! FIXME(wjs, 2020-10-02) Remove next line - btran2(bounds%begp:bounds%endp) = spval - do f = 1, num_exposedvegp p = filter_exposedvegp(f) btran2(p) = 0._r8 diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index d200d6aa23..8f0a5ddab7 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -507,8 +507,6 @@ subroutine Restart(this, bounds, ncid, flag) end if call this%n_products_inst%restart(bounds, ncid, flag) - call this%cnfire_method%CNFireRestart(bounds, ncid, flag) - end if if (use_cndv) then diff --git a/src/main/FireMethodType.F90 b/src/main/FireMethodType.F90 index d199d662fa..b9119ed064 100644 --- a/src/main/FireMethodType.F90 +++ b/src/main/FireMethodType.F90 @@ -25,9 +25,6 @@ module FireMethodType ! Read parameters for the fire datasets procedure(CNFireReadParams_interface), public, deferred :: CNFireReadParams - ! Restart - procedure(CNFireRestart_interface), public, deferred :: CNFireRestart - ! Interpolate the fire datasets procedure(FireInterp_interface) , public, deferred :: FireInterp @@ -119,24 +116,6 @@ subroutine CNFireReadParams_interface( this, ncid ) end subroutine CNFireReadParams_interface - !----------------------------------------------------------------------- - subroutine CNFireRestart_interface( this, bounds, ncid, flag ) - ! - ! Restart for the CN fire base class - ! !USES: - use ncdio_pio , only : file_desc_t - use decompMod , only : bounds_type - import :: fire_method_type - ! - ! !ARGUMENTS: - class(fire_method_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - !-------------------------------------------------------------------- - - end subroutine CNFireRestart_interface - !----------------------------------------------------------------------- subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & num_exposedvegp, filter_exposedvegp, & From cb6e7ce27829320963a050df9e0fd5deb01f4644 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 5 Oct 2020 14:44:31 -0600 Subject: [PATCH 1526/1973] Move calc_fire_root_wetness for CNFireLi2021 into the base type The motivation here is to avoid future bugs: When the next fire version comes along, we'll likely have it extend cnfire_base_type. But then we would likely end up accidentally using the original calc_fire_root_wetness rather than the 2021 version of that routine. I don't love the decrease in locality that this refactor produces, but it seems worth it to avoid that potential bug. And in any case, we'd have to do something non-ideal when the next fire version comes along if we want it to share the 2021 version of this routine. (We could have the new version extend the 2021 version, but that leads to an even more complex inheritance hierarchy than we already have for fire.) --- src/biogeochem/CNFireBaseMod.F90 | 72 ++++++++++++++++++++++++++---- src/biogeochem/CNFireLi2014Mod.F90 | 2 +- src/biogeochem/CNFireLi2016Mod.F90 | 2 +- src/biogeochem/CNFireLi2021Mod.F90 | 59 +----------------------- src/main/FireMethodType.F90 | 23 ---------- 5 files changed, 66 insertions(+), 92 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index a88e3778e9..4e35fd86f2 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -17,6 +17,7 @@ module CNFireBaseMod use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL use shr_log_mod , only : errMsg => shr_log_errMsg use clm_varctl , only : iulog + use clm_varpar , only : nlevgrnd use pftconMod , only : noveg, pftcon use abortutils , only : endrun use decompMod , only : bounds_type @@ -32,6 +33,9 @@ module CNFireBaseMod use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use GridcellType , only : grc use ColumnType , only : col use PatchType , only : patch @@ -84,7 +88,8 @@ module CNFireBaseMod procedure, public :: FireReadNML ! Read in namelist for CNFire procedure, public :: CNFireReadParams ! Read in constant parameters from the paramsfile procedure, public :: CNFireFluxes ! Calculate fire fluxes - procedure, public :: CNFire_calc_fire_root_wetness ! Calcualte CN-fire specific root wetness + procedure, public :: CNFire_calc_fire_root_wetness_Li2014 ! Calculate CN-fire specific root wetness: original version + procedure, public :: CNFire_calc_fire_root_wetness_Li2021 ! Calculate CN-fire specific root wetness: 2021 version ! !PRIVATE MEMBER FUNCTIONS: procedure, private :: InitAllocate ! Memory allocation of Fire procedure, private :: InitHistory ! History file assignment of fire @@ -175,17 +180,11 @@ subroutine InitHistory( this, bounds ) end subroutine InitHistory !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_exposedvegp, & + subroutine CNFire_calc_fire_root_wetness_Li2014( this, bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) ! ! Calculate the root wetness term that will be used by the fire model ! - use pftconMod , only : pftcon - use clm_varpar , only : nlevgrnd - use PatchType , only : patch - use WaterStateBulkType , only : waterstatebulk_type - use SoilStateType , only : soilstate_type - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type class(cnfire_base_type) :: this type(bounds_type) , intent(in) :: bounds !bounds integer , intent(in) :: num_exposedvegp !number of filters @@ -239,7 +238,62 @@ subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_ end associate - end subroutine CNFire_calc_fire_root_wetness + end subroutine CNFire_calc_fire_root_wetness_Li2014 + + !---------------------------------------------------------------------- + subroutine CNFire_calc_fire_root_wetness_Li2021( this, bounds, num_exposedvegp, filter_exposedvegp, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) + ! + ! Calculate the root wetness term that will be used by the fire model + ! + use pftconMod , only : pftcon + use PatchType , only : patch + class(cnfire_base_type) :: this + type(bounds_type) , intent(in) :: bounds !bounds + integer , intent(in) :: num_exposedvegp !number of filters + integer , intent(in) :: filter_exposedvegp(:) !filter array + type(waterstatebulk_type), intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve + ! !LOCAL VARIABLES: + real(r8) :: s_node !temporary variables + integer :: p, f, j, c !indices + !----------------------------------------------------------------------- + + SHR_ASSERT_ALL_FL((ubound(filter_exposedvegp) >= (/num_exposedvegp/)), sourcefile, __LINE__) + + associate( & + watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation + btran2 => this%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square + rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer + h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) + ) + + do f = 1, num_exposedvegp + p = filter_exposedvegp(f) + btran2(p) = 0._r8 + end do + do j = 1,nlevgrnd + do f = 1, num_exposedvegp + p = filter_exposedvegp(f) + c = patch%column(p) + s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) + + btran2(p) = btran2(p) + rootfr(p,j)*s_node + end do + end do + + do f = 1, num_exposedvegp + p = filter_exposedvegp(f) + if (btran2(p) > 1._r8) then + btran2(p) = 1._r8 + end if + end do + + end associate + + end subroutine CNFire_calc_fire_root_wetness_Li2021 + !---------------------------------------------------------------------- !---------------------------------------------------------------------- subroutine FireReadNML( this, NLFilename ) diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 6abe8f7ca3..10dd66b2e4 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -334,7 +334,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end do ! This subroutine calculates btran2 - call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & + call this%CNFire_calc_fire_root_wetness_Li2014(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) do fp = 1, num_exposedvegp p = filter_exposedvegp(fp) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index 01a5751a8f..7db9e0ceca 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -355,7 +355,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end do ! This subroutine calculates btran2 - call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & + call this%CNFire_calc_fire_root_wetness_Li2014(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) do fp = 1, num_exposedvegp p = filter_exposedvegp(fp) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 9ee9f72898..b5e7b4f380 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -59,7 +59,6 @@ module CNFireLi2021Mod ! !PUBLIC MEMBER FUNCTIONS: procedure, public :: need_lightning_and_popdens procedure, public :: CNFireArea ! Calculate fire area - procedure, public :: CNFire_calc_fire_root_wetness ! Calculate the root wetness term that will be used by the fire model end type cnfire_li2021_type ! @@ -355,7 +354,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end do ! This subroutine calculates btran2 - call this%CNFire_calc_fire_root_wetness(bounds, num_exposedvegp, filter_exposedvegp, & + call this%CNFire_calc_fire_root_wetness_Li2021(bounds, num_exposedvegp, filter_exposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) do fp = 1, num_exposedvegp p = filter_exposedvegp(fp) @@ -676,60 +675,4 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end subroutine CNFireArea - !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness( this, bounds, num_exposedvegp, filter_exposedvegp, & - waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) - ! - ! Calculate the root wetness term that will be used by the fire model - ! - use pftconMod , only : pftcon - use PatchType , only : patch - class(cnfire_li2021_type) :: this - type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: num_exposedvegp !number of filters - integer , intent(in) :: filter_exposedvegp(:) !filter array - type(waterstatebulk_type), intent(in) :: waterstatebulk_inst - type(soilstate_type) , intent(in) :: soilstate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - ! !LOCAL VARIABLES: - real(r8) :: s_node !temporary variables - integer :: p, f, j, c !indices - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL_FL((ubound(filter_exposedvegp) >= (/num_exposedvegp/)), sourcefile, __LINE__) - - associate( & - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation - btran2 => this%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square - rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) - ) - - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) - btran2(p) = 0._r8 - end do - do j = 1,nlevgrnd - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) - c = patch%column(p) - s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - - btran2(p) = btran2(p) + rootfr(p,j)*s_node - end do - end do - - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) - if (btran2(p) > 1._r8) then - btran2(p) = 1._r8 - end if - end do - - end associate - - end subroutine CNFire_calc_fire_root_wetness - !---------------------------------------------------------------------- - - end module CNFireLi2021Mod diff --git a/src/main/FireMethodType.F90 b/src/main/FireMethodType.F90 index b9119ed064..21ab83e9d9 100644 --- a/src/main/FireMethodType.F90 +++ b/src/main/FireMethodType.F90 @@ -34,9 +34,6 @@ module FireMethodType ! Figure out the fire fluxes procedure(CNFireFluxes_interface) , public, deferred :: CNFireFluxes - ! Calculate root wetness for the CN Fire - procedure(CNFire_calc_fire_root_wetness_interface) , public, deferred :: CNFire_calc_fire_root_wetness - end type fire_method_type abstract interface @@ -221,26 +218,6 @@ end subroutine CNFireFluxes_interface !----------------------------------------------------------------------- - !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness_interface( this, bounds, num_exposedvegp, & - filter_exposedvegp, waterstatebulk_inst, & - soilstate_inst, soil_water_retention_curve ) - ! Calculate root wetness that will be used for the CN fire model - use decompMod , only : bounds_type - use WaterStateBulkType , only : waterstatebulk_type - use SoilStateType , only : soilstate_type - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - import :: fire_method_type - class(fire_method_type) :: this - type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: num_exposedvegp !number of filters - integer , intent(in) :: filter_exposedvegp(:) !filter array - type(waterstatebulk_type), intent(in) :: waterstatebulk_inst - type(soilstate_type) , intent(in) :: soilstate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - !----------------------------------------------------------------------- - end subroutine CNFire_calc_fire_root_wetness_interface - end interface end module FireMethodType From 460efa4a9c9e8a4e03b9bb3fd28438e8f73ecdab Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 5 Oct 2020 15:03:44 -0600 Subject: [PATCH 1527/1973] Set btran2 to 0 over non-exposed-veg points This is needed for history diagnostics: otherwise, the history diagnostics over non-exposed-veg points use whatever happened to be there from when it was last exposed. --- src/biogeochem/CNDriverMod.F90 | 6 +- src/biogeochem/CNFireBaseMod.F90 | 97 ++++++++++++++++----------- src/biogeochem/CNFireLi2014Mod.F90 | 7 +- src/biogeochem/CNFireLi2016Mod.F90 | 7 +- src/biogeochem/CNFireLi2021Mod.F90 | 7 +- src/biogeochem/CNFireNoFireMod.F90 | 4 +- src/biogeochem/CNVegetationFacade.F90 | 4 ++ src/main/FireMethodType.F90 | 4 +- src/main/clm_driver.F90 | 1 + 9 files changed, 88 insertions(+), 49 deletions(-) diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 index a439cee207..a969349136 100644 --- a/src/biogeochem/CNDriverMod.F90 +++ b/src/biogeochem/CNDriverMod.F90 @@ -82,7 +82,7 @@ end subroutine CNDriverInit !----------------------------------------------------------------------- subroutine CNDriverNoLeaching(bounds, & num_soilc, filter_soilc, num_soilp, filter_soilp, num_pcropp, filter_pcropp, & - num_exposedvegp, filter_exposedvegp, doalb, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, doalb, & cnveg_state_inst, & cnveg_carbonflux_inst, cnveg_carbonstate_inst, & c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & @@ -151,6 +151,8 @@ subroutine CNDriverNoLeaching(bounds, integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 logical , intent(in) :: doalb ! true = surface albedo calculation time step type(cnveg_state_type) , intent(inout) :: cnveg_state_inst type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst @@ -753,7 +755,7 @@ subroutine CNDriverNoLeaching(bounds, call t_startf('CNFire') call cnfire_method%CNFireArea(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_exposedvegp, filter_exposedvegp, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, & diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 4e35fd86f2..d256b67cad 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -180,8 +180,9 @@ subroutine InitHistory( this, bounds ) end subroutine InitHistory !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness_Li2014( this, bounds, num_exposedvegp, filter_exposedvegp, & - waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) + subroutine CNFire_calc_fire_root_wetness_Li2014( this, bounds, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) ! ! Calculate the root wetness term that will be used by the fire model ! @@ -189,14 +190,15 @@ subroutine CNFire_calc_fire_root_wetness_Li2014( this, bounds, num_exposedvegp, type(bounds_type) , intent(in) :: bounds !bounds integer , intent(in) :: num_exposedvegp !number of filters integer , intent(in) :: filter_exposedvegp(:) !filter array + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 type(waterstatebulk_type), intent(in) :: waterstatebulk_inst type(soilstate_type) , intent(in) :: soilstate_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve ! !LOCAL VARIABLES: - real(r8), parameter :: btran0 = 0.0_r8 ! initial value real(r8) :: smp_node, s_node !temporary variables real(r8) :: smp_node_lf !temporary variable - integer :: p, f, j, c, l !indices + integer :: p, fp, j, c, l !indices !----------------------------------------------------------------------- SHR_ASSERT_ALL_FL((ubound(filter_exposedvegp) >= (/num_exposedvegp/)), sourcefile, __LINE__) @@ -210,38 +212,46 @@ subroutine CNFire_calc_fire_root_wetness_Li2014( this, bounds, num_exposedvegp, h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) - btran2(p) = btran0 - end do - do j = 1,nlevgrnd - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) - c = patch%column(p) - l = patch%landunit(p) - s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - - call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) - - smp_node_lf = max(smpsc(patch%itype(p)), smp_node_lf) - btran2(p) = btran2(p) +rootfr(p,j)*max(0._r8,min((smp_node_lf - smpsc(patch%itype(p))) / & - (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8)) - end do - end do - - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) - if (btran2(p) > 1._r8) then - btran2(p) = 1._r8 - end if - end do - - end associate + do fp = 1, num_noexposedvegp + p = filter_noexposedvegp(fp) + ! Set for the sake of history diagnostics. The "normal" btran is set to 0 over + ! this filter, so we do the same for btran2. + btran2(p) = 0._r8 + end do + + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + btran2(p) = 0._r8 + end do + do j = 1,nlevgrnd + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + c = patch%column(p) + l = patch%landunit(p) + s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) + + call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) + + smp_node_lf = max(smpsc(patch%itype(p)), smp_node_lf) + btran2(p) = btran2(p) +rootfr(p,j)*max(0._r8,min((smp_node_lf - smpsc(patch%itype(p))) / & + (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8)) + end do + end do + + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + if (btran2(p) > 1._r8) then + btran2(p) = 1._r8 + end if + end do + + end associate end subroutine CNFire_calc_fire_root_wetness_Li2014 !---------------------------------------------------------------------- - subroutine CNFire_calc_fire_root_wetness_Li2021( this, bounds, num_exposedvegp, filter_exposedvegp, & + subroutine CNFire_calc_fire_root_wetness_Li2021( this, bounds, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve ) ! ! Calculate the root wetness term that will be used by the fire model @@ -252,12 +262,14 @@ subroutine CNFire_calc_fire_root_wetness_Li2021( this, bounds, num_exposedvegp, type(bounds_type) , intent(in) :: bounds !bounds integer , intent(in) :: num_exposedvegp !number of filters integer , intent(in) :: filter_exposedvegp(:) !filter array + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 type(waterstatebulk_type), intent(in) :: waterstatebulk_inst type(soilstate_type) , intent(in) :: soilstate_inst class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve ! !LOCAL VARIABLES: real(r8) :: s_node !temporary variables - integer :: p, f, j, c !indices + integer :: p, fp, j, c !indices !----------------------------------------------------------------------- SHR_ASSERT_ALL_FL((ubound(filter_exposedvegp) >= (/num_exposedvegp/)), sourcefile, __LINE__) @@ -269,13 +281,20 @@ subroutine CNFire_calc_fire_root_wetness_Li2021( this, bounds, num_exposedvegp, h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (porosity) (constant) ) - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) + do fp = 1, num_noexposedvegp + p = filter_noexposedvegp(fp) + ! Set for the sake of history diagnostics. The "normal" btran is set to 0 over + ! this filter, so we do the same for btran2. + btran2(p) = 0._r8 + end do + + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) btran2(p) = 0._r8 end do do j = 1,nlevgrnd - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) c = patch%column(p) s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) @@ -283,8 +302,8 @@ subroutine CNFire_calc_fire_root_wetness_Li2021( this, bounds, num_exposedvegp, end do end do - do f = 1, num_exposedvegp - p = filter_exposedvegp(f) + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) if (btran2(p) > 1._r8) then btran2(p) = 1._r8 end if diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 10dd66b2e4..0cc5dac224 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -82,7 +82,7 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_exposedvegp, filter_exposedvegp, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) @@ -107,6 +107,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst @@ -334,7 +336,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end do ! This subroutine calculates btran2 - call this%CNFire_calc_fire_root_wetness_Li2014(bounds, num_exposedvegp, filter_exposedvegp, & + call this%CNFire_calc_fire_root_wetness_Li2014(bounds, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) do fp = 1, num_exposedvegp p = filter_exposedvegp(fp) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index 7db9e0ceca..4de67714a2 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -86,7 +86,7 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_exposedvegp, filter_exposedvegp, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) @@ -112,6 +112,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst @@ -355,7 +357,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end do ! This subroutine calculates btran2 - call this%CNFire_calc_fire_root_wetness_Li2014(bounds, num_exposedvegp, filter_exposedvegp, & + call this%CNFire_calc_fire_root_wetness_Li2014(bounds, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) do fp = 1, num_exposedvegp p = filter_exposedvegp(fp) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index b5e7b4f380..5cc7c10dd3 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -86,7 +86,7 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_exposedvegp, filter_exposedvegp, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) @@ -112,6 +112,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst @@ -354,7 +356,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end do ! This subroutine calculates btran2 - call this%CNFire_calc_fire_root_wetness_Li2021(bounds, num_exposedvegp, filter_exposedvegp, & + call this%CNFire_calc_fire_root_wetness_Li2021(bounds, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve) do fp = 1, num_exposedvegp p = filter_exposedvegp(fp) diff --git a/src/biogeochem/CNFireNoFireMod.F90 b/src/biogeochem/CNFireNoFireMod.F90 index 69411b19eb..0dc1ee39d1 100644 --- a/src/biogeochem/CNFireNoFireMod.F90 +++ b/src/biogeochem/CNFireNoFireMod.F90 @@ -58,7 +58,7 @@ end function need_lightning_and_popdens !----------------------------------------------------------------------- subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_exposedvegp, filter_exposedvegp, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & @@ -79,6 +79,8 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 8f0a5ddab7..44e904bf2c 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -875,6 +875,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & num_soilp, filter_soilp, & num_pcropp, filter_pcropp, & num_exposedvegp, filter_exposedvegp, & + num_noexposedvegp, filter_noexposedvegp, & doalb, & soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & @@ -907,6 +908,8 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 logical , intent(in) :: doalb ! true = surface albedo calculation time step type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst @@ -947,6 +950,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, & num_soilp, filter_soilp, & num_pcropp, filter_pcropp, & num_exposedvegp, filter_exposedvegp, & + num_noexposedvegp, filter_noexposedvegp, & doalb, & this%cnveg_state_inst, & this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, & diff --git a/src/main/FireMethodType.F90 b/src/main/FireMethodType.F90 index 21ab83e9d9..d0685f0826 100644 --- a/src/main/FireMethodType.F90 +++ b/src/main/FireMethodType.F90 @@ -115,7 +115,7 @@ end subroutine CNFireReadParams_interface !----------------------------------------------------------------------- subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_exposedvegp, filter_exposedvegp, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & @@ -148,6 +148,8 @@ subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soil integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(energyflux_type) , intent(in) :: energyflux_inst type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 88f3f68387..bba8fb6332 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -969,6 +969,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro filter(nc)%num_soilp, filter(nc)%soilp, & filter(nc)%num_pcropp, filter(nc)%pcropp, & filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & + filter(nc)%num_noexposedvegp, filter(nc)%noexposedvegp, & doalb, & soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & From a7efe34472078e47c817e0ab50c49994504fbf5b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 5 Oct 2020 17:27:19 -0600 Subject: [PATCH 1528/1973] Change fire looping structure to be more standard The patch looping structure of having an outer loop over max_patch_per_col and a column filter loop is non-standard and probably worse for performance; replace these with a more standard patch filter loop. --- src/biogeochem/CNFireBaseMod.F90 | 147 +++++---- src/biogeochem/CNFireLi2014Mod.F90 | 475 ++++++++++++++--------------- src/biogeochem/CNFireLi2016Mod.F90 | 341 ++++++++++----------- src/biogeochem/CNFireLi2021Mod.F90 | 341 ++++++++++----------- 4 files changed, 622 insertions(+), 682 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index d256b67cad..1ba0efc4d4 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -441,7 +441,6 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! ! !USES: use clm_time_manager , only: get_step_size_real,get_days_per_year,get_curr_date - use clm_varpar , only: max_patch_per_col use clm_varctl , only: use_cndv, spinup_state use clm_varcon , only: secspday use pftconMod , only: nc3crop @@ -471,7 +470,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte real(r8) , intent(out) :: somc_fire_col(bounds%begc:) ! (gC/m2/s) fire C emissions due to peat burning ! ! !LOCAL VARIABLES: - integer :: g,c,p,j,l,pi,kyr, kmo, kda, mcsec ! indices + integer :: g,c,p,j,l,kyr, kmo, kda, mcsec ! indices integer :: fp,fc ! filter indices real(r8):: f ! rate for fire effects (1/s) real(r8):: m ! acceleration factor for fuel carbon @@ -927,81 +926,75 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! fire-induced transfer of carbon and nitrogen pools to litter and cwd do j = 1,nlevdecomp - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if ( patch%active(p) ) then - - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_deadstemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_deadcrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_deadstemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_deadcrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - - - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_livestemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_livecrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_livestemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_livecrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - - - m_c_to_litr_met_fire(c,j)=m_c_to_litr_met_fire(c,j) + & - ((m_leafc_to_litter_fire(p)*lf_flab(patch%itype(p)) & - +m_leafc_storage_to_litter_fire(p) + & - m_leafc_xfer_to_litter_fire(p) + & - m_gresp_storage_to_litter_fire(p) & - +m_gresp_xfer_to_litter_fire(p))*leaf_prof(p,j) + & - (m_frootc_to_litter_fire(p)*fr_flab(patch%itype(p)) & - +m_frootc_storage_to_litter_fire(p) + & - m_frootc_xfer_to_litter_fire(p))*froot_prof(p,j) & - +(m_livestemc_storage_to_litter_fire(p) + & - m_livestemc_xfer_to_litter_fire(p) & - +m_deadstemc_storage_to_litter_fire(p) + & - m_deadstemc_xfer_to_litter_fire(p))* stem_prof(p,j)& - +(m_livecrootc_storage_to_litter_fire(p) + & - m_livecrootc_xfer_to_litter_fire(p) & - +m_deadcrootc_storage_to_litter_fire(p) + & - m_deadcrootc_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) - m_c_to_litr_cel_fire(c,j)=m_c_to_litr_cel_fire(c,j) + & - (m_leafc_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - m_c_to_litr_lig_fire(c,j)=m_c_to_litr_lig_fire(c,j) + & - (m_leafc_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - - m_n_to_litr_met_fire(c,j)=m_n_to_litr_met_fire(c,j) + & - ((m_leafn_to_litter_fire(p)*lf_flab(patch%itype(p)) & - +m_leafn_storage_to_litter_fire(p) + & - m_leafn_xfer_to_litter_fire(p)+m_retransn_to_litter_fire(p)) & - *leaf_prof(p,j) +(m_frootn_to_litter_fire(p)*fr_flab(patch%itype(p)) & - +m_frootn_storage_to_litter_fire(p) + & - m_frootn_xfer_to_litter_fire(p))*froot_prof(p,j) & - +(m_livestemn_storage_to_litter_fire(p) + & - m_livestemn_xfer_to_litter_fire(p) & - +m_deadstemn_storage_to_litter_fire(p) + & - m_deadstemn_xfer_to_litter_fire(p))* stem_prof(p,j)& - +(m_livecrootn_storage_to_litter_fire(p) + & - m_livecrootn_xfer_to_litter_fire(p) & - +m_deadcrootn_storage_to_litter_fire(p) + & - m_deadcrootn_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) - m_n_to_litr_cel_fire(c,j)=m_n_to_litr_cel_fire(c,j) + & - (m_leafn_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - m_n_to_litr_lig_fire(c,j)=m_n_to_litr_lig_fire(c,j) + & - (m_leafn_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - end if - end if - end do + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + + fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & + m_deadstemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) + fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & + m_deadcrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) + fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & + m_deadstemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) + fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & + m_deadcrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) + + + fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & + m_livestemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) + fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & + m_livecrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) + fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & + m_livestemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) + fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & + m_livecrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) + + + m_c_to_litr_met_fire(c,j)=m_c_to_litr_met_fire(c,j) + & + ((m_leafc_to_litter_fire(p)*lf_flab(patch%itype(p)) & + +m_leafc_storage_to_litter_fire(p) + & + m_leafc_xfer_to_litter_fire(p) + & + m_gresp_storage_to_litter_fire(p) & + +m_gresp_xfer_to_litter_fire(p))*leaf_prof(p,j) + & + (m_frootc_to_litter_fire(p)*fr_flab(patch%itype(p)) & + +m_frootc_storage_to_litter_fire(p) + & + m_frootc_xfer_to_litter_fire(p))*froot_prof(p,j) & + +(m_livestemc_storage_to_litter_fire(p) + & + m_livestemc_xfer_to_litter_fire(p) & + +m_deadstemc_storage_to_litter_fire(p) + & + m_deadstemc_xfer_to_litter_fire(p))* stem_prof(p,j)& + +(m_livecrootc_storage_to_litter_fire(p) + & + m_livecrootc_xfer_to_litter_fire(p) & + +m_deadcrootc_storage_to_litter_fire(p) + & + m_deadcrootc_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) + m_c_to_litr_cel_fire(c,j)=m_c_to_litr_cel_fire(c,j) + & + (m_leafc_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & + m_frootc_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + m_c_to_litr_lig_fire(c,j)=m_c_to_litr_lig_fire(c,j) + & + (m_leafc_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & + m_frootc_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + + m_n_to_litr_met_fire(c,j)=m_n_to_litr_met_fire(c,j) + & + ((m_leafn_to_litter_fire(p)*lf_flab(patch%itype(p)) & + +m_leafn_storage_to_litter_fire(p) + & + m_leafn_xfer_to_litter_fire(p)+m_retransn_to_litter_fire(p)) & + *leaf_prof(p,j) +(m_frootn_to_litter_fire(p)*fr_flab(patch%itype(p)) & + +m_frootn_storage_to_litter_fire(p) + & + m_frootn_xfer_to_litter_fire(p))*froot_prof(p,j) & + +(m_livestemn_storage_to_litter_fire(p) + & + m_livestemn_xfer_to_litter_fire(p) & + +m_deadstemn_storage_to_litter_fire(p) + & + m_deadstemn_xfer_to_litter_fire(p))* stem_prof(p,j)& + +(m_livecrootn_storage_to_litter_fire(p) + & + m_livecrootn_xfer_to_litter_fire(p) & + +m_deadcrootn_storage_to_litter_fire(p) + & + m_deadcrootn_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) + m_n_to_litr_cel_fire(c,j)=m_n_to_litr_cel_fire(c,j) + & + (m_leafn_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & + m_frootn_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + m_n_to_litr_lig_fire(c,j)=m_n_to_litr_lig_fire(c,j) + & + (m_leafn_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & + m_frootn_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) end do end do ! diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index 0cc5dac224..a69efbfeae 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -92,7 +92,6 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! ! !USES: use clm_time_manager , only: get_step_size_real, get_days_per_year, get_curr_date, get_nstep - use clm_varpar , only: max_patch_per_col use clm_varcon , only: secspday, secsphr use pftconMod , only: nc4_grass, nc3crop, ndllf_evr_tmp_tree use pftconMod , only: nbrdlf_evr_trp_tree, nbrdlf_dcd_trp_tree, nbrdlf_evr_shrub @@ -275,21 +274,17 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ cropf_col(c) = 0._r8 lfwt(c) = 0._r8 end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop veg types - if( patch%itype(p) > nc4_grass )then - cropf_col(c) = cropf_col(c) + patch%wtcol(p) - end if - ! For natural vegetation (non-crop and non-bare-soil) - if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then - lfwt(c) = lfwt(c) + patch%wtcol(p) - end if - end if - end do + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + ! For crop veg types + if( patch%itype(p) > nc4_grass )then + cropf_col(c) = cropf_col(c) + patch%wtcol(p) + end if + ! For natural vegetation (non-crop and non-bare-soil) + if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then + lfwt(c) = lfwt(c) + patch%wtcol(p) + end if end do ! ! Calculate crop fuel @@ -298,22 +293,18 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ c = filter_soilc(fc) fuelc_crop(c)=0._r8 end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop PFTs, fuel load includes leaf and litter; only - ! column-level litter carbon - ! is available, so we use leaf carbon to estimate the - ! litter carbon for crop PFTs - if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then - fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & - leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & - totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) - end if - end if - end do + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + ! For crop PFTs, fuel load includes leaf and litter; only + ! column-level litter carbon + ! is available, so we use leaf carbon to estimate the + ! litter carbon for crop PFTs + if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then + fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & + leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & + totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) + end if end do ! ! Calculate noncrop column variables @@ -349,126 +340,122 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - ! For non-crop -- natural vegetation and bare-soil - if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then - - ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen - ! and deciduous tropical trees (used to determine if a column is - ! tropical closed forest) use the current fractions. However, I think - ! they are used in code that applies to land cover change. Note that - ! land cover change is currently generated on the first time step of the - ! year (even though the fire code sees the annually-smoothed dwt). Thus, - ! I think that, for this to be totally consistent, this code should - ! consider the fractional coverage of each PFT prior to the relevant - ! land cover change event. (These fractions could be computed in the - ! code that handles land cover change, so that the fire code remains - ! agnostic to exactly how and when land cover change happens.) - ! - ! For example, if a year started with fractional coverages of - ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then - ! the start-of-year land cover change reduced both of these to 0.2: The - ! current code would consider the column to NOT be tropical closed - ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), - ! whereas in fact the land cover change occurred when the column *was* - ! tropical closed forest. - if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) - end if - if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) - end if + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + g = col%gridcell(c) - if (transient_landcover) then - if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then - if(dwt_smoothed(p) < 0._r8)then - ! Land cover change in CLM happens all at once on the first time - ! step of the year. However, the fire code needs deforestation - ! rates throughout the year, in order to combine these - ! deforestation rates with the current season's climate. So we - ! use a smoothed version of dwt. - ! - ! This isn't ideal, because the carbon stocks that the fire code - ! is operating on will have decreased by the full annual amount - ! before the fire code does anything. But the biggest effect of - ! these deforestation fires is as a trigger for other fires, and - ! the C fluxes are merely diagnostic so don't need to be - ! conservative, so this isn't a big issue. - ! - ! (Actually, it would be even better if the fire code had a - ! realistic breakdown of annual deforestation into the - ! different seasons. But having deforestation spread evenly - ! throughout the year is much better than having it all - ! concentrated on January 1.) - dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) - end if - end if + ! For non-crop -- natural vegetation and bare-soil + if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then + + ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen + ! and deciduous tropical trees (used to determine if a column is + ! tropical closed forest) use the current fractions. However, I think + ! they are used in code that applies to land cover change. Note that + ! land cover change is currently generated on the first time step of the + ! year (even though the fire code sees the annually-smoothed dwt). Thus, + ! I think that, for this to be totally consistent, this code should + ! consider the fractional coverage of each PFT prior to the relevant + ! land cover change event. (These fractions could be computed in the + ! code that handles land cover change, so that the fire code remains + ! agnostic to exactly how and when land cover change happens.) + ! + ! For example, if a year started with fractional coverages of + ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then + ! the start-of-year land cover change reduced both of these to 0.2: The + ! current code would consider the column to NOT be tropical closed + ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), + ! whereas in fact the land cover change occurred when the column *was* + ! tropical closed forest. + if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then + trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) + end if + if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then + trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) + end if + + if (transient_landcover) then + if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then + if(dwt_smoothed(p) < 0._r8)then + ! Land cover change in CLM happens all at once on the first time + ! step of the year. However, the fire code needs deforestation + ! rates throughout the year, in order to combine these + ! deforestation rates with the current season's climate. So we + ! use a smoothed version of dwt. + ! + ! This isn't ideal, because the carbon stocks that the fire code + ! is operating on will have decreased by the full annual amount + ! before the fire code does anything. But the biggest effect of + ! these deforestation fires is as a trigger for other fires, and + ! the C fluxes are merely diagnostic so don't need to be + ! conservative, so this isn't a big issue. + ! + ! (Actually, it would be even better if the fire code had a + ! realistic breakdown of annual deforestation into the + ! different seasons. But having deforestation spread evenly + ! throughout the year is much better than having it all + ! concentrated on January 1.) + dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) end if - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - - fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) - - if( lfwt(c) /= 0.0_r8 )then - hdmlf=this%forc_hdm(g) - - ! all these constants are in Li et al. BG (2012a,b;2013) - - if( hdmlf > 0.1_r8 )then - ! For NOT bare-soil - if( patch%itype(p) /= noveg )then - ! For shrub and grass (crop already excluded above) - if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass - lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & - /(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/7._r8)))*patch%wtcol(p)/lfwt(c) - lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/lfwt(c) - else ! for trees - if( gdp_lf(c) > 20._r8 )then - lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - end if - if( gdp_lf(c) > 20._r8 )then - lgdp1_col(c) = lgdp1_col(c)+0.62_r8*patch%wtcol(p)/lfwt(c) - else - if( gdp_lf(c) > 8._r8 ) then - lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/lfwt(c) - else - lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/lfwt(c) - end if - end if - lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/125._r8)))*patch%wtcol(p)/lfwt(c) + end if + end if + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + frootc_xfer(p) + deadcrootc(p) + & + deadcrootc_storage(p) + deadcrootc_xfer(p) + & + livecrootc(p)+livecrootc_storage(p) + & + livecrootc_xfer(p))*patch%wtcol(p) + + fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) + + if( lfwt(c) /= 0.0_r8 )then + hdmlf=this%forc_hdm(g) + + ! all these constants are in Li et al. BG (2012a,b;2013) + + if( hdmlf > 0.1_r8 )then + ! For NOT bare-soil + if( patch%itype(p) /= noveg )then + ! For shrub and grass (crop already excluded above) + if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass + lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & + exp(-1._r8*SHR_CONST_PI* & + (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & + /(1.0_r8 - cropf_col(c)) + lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & + exp(-1._r8*SHR_CONST_PI* & + (gdp_lf(c)/7._r8)))*patch%wtcol(p)/lfwt(c) + lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & + exp(-1._r8*SHR_CONST_PI* & + (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/lfwt(c) + else ! for trees + if( gdp_lf(c) > 20._r8 )then + lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1.0_r8 - cropf_col(c)) + else + lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) + end if + if( gdp_lf(c) > 20._r8 )then + lgdp1_col(c) = lgdp1_col(c)+0.62_r8*patch%wtcol(p)/lfwt(c) + else + if( gdp_lf(c) > 8._r8 ) then + lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/lfwt(c) + else + lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/lfwt(c) end if end if - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/lfwt(c) - lpop_col(c) = lpop_col(c)+patch%wtcol(p)/lfwt(c) + lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & + exp(-1._r8*SHR_CONST_PI* & + (hdmlf/125._r8)))*patch%wtcol(p)/lfwt(c) end if end if - - fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) + else + lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) + lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/lfwt(c) + lpop_col(c) = lpop_col(c)+patch%wtcol(p)/lfwt(c) end if end if - end do + + fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) + end if end do ! estimate annual decreased fractional coverage of BET+BDT @@ -504,36 +491,33 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g= col%gridcell(c) - hdmlf=this%forc_hdm(g) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop - if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & - kmo == abm_lf(c) .and. forc_rain(c)+forc_snow(c) == 0._r8 .and. & - burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time - - ! calculate human density impact on ag. fire - fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) - - ! calculate impact of GDP on ag. fire - fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) - - ! calculate burned area - fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) - - ! crop fire only for generic crop types at this time - ! managed crops are treated as grasses if crop model is turned on - baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fb*fhd*fgdp*patch%wtcol(p) - if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then - burndate(p)=kda - end if - end if + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + g = col%gridcell(c) + ! For crop + if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & + kmo == abm_lf(c) .and. forc_rain(c)+forc_snow(c) == 0._r8 .and. & + burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time + + hdmlf = this%forc_hdm(g) + + ! calculate human density impact on ag. fire + fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) + + ! calculate impact of GDP on ag. fire + fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) + + ! calculate burned area + fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) + + ! crop fire only for generic crop types at this time + ! managed crops are treated as grasses if crop model is turned on + baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fb*fhd*fgdp*patch%wtcol(p) + if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then + burndate(p)=kda end if - end do + end if end do ! ! calculate peatland fire @@ -663,7 +647,6 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! ! !USES: use clm_time_manager , only: get_step_size_real,get_days_per_year,get_curr_date - use clm_varpar , only: max_patch_per_col use clm_varctl , only: use_cndv use clm_varcon , only: secspday use pftconMod , only: nc3crop @@ -1129,81 +1112,75 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! fire-induced transfer of carbon and nitrogen pools to litter and cwd do j = 1,nlevdecomp - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if ( patch%active(p) ) then - - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_deadstemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_deadcrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_deadstemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_deadcrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - - - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_livestemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_livecrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_livestemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_livecrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - - - m_c_to_litr_met_fire(c,j)=m_c_to_litr_met_fire(c,j) + & - ((m_leafc_to_litter_fire(p)*lf_flab(patch%itype(p)) & - +m_leafc_storage_to_litter_fire(p) + & - m_leafc_xfer_to_litter_fire(p) + & - m_gresp_storage_to_litter_fire(p) & - +m_gresp_xfer_to_litter_fire(p))*leaf_prof(p,j) + & - (m_frootc_to_litter_fire(p)*fr_flab(patch%itype(p)) & - +m_frootc_storage_to_litter_fire(p) + & - m_frootc_xfer_to_litter_fire(p))*froot_prof(p,j) & - +(m_livestemc_storage_to_litter_fire(p) + & - m_livestemc_xfer_to_litter_fire(p) & - +m_deadstemc_storage_to_litter_fire(p) + & - m_deadstemc_xfer_to_litter_fire(p))* stem_prof(p,j)& - +(m_livecrootc_storage_to_litter_fire(p) + & - m_livecrootc_xfer_to_litter_fire(p) & - +m_deadcrootc_storage_to_litter_fire(p) + & - m_deadcrootc_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) - m_c_to_litr_cel_fire(c,j)=m_c_to_litr_cel_fire(c,j) + & - (m_leafc_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - m_c_to_litr_lig_fire(c,j)=m_c_to_litr_lig_fire(c,j) + & - (m_leafc_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - - m_n_to_litr_met_fire(c,j)=m_n_to_litr_met_fire(c,j) + & - ((m_leafn_to_litter_fire(p)*lf_flab(patch%itype(p)) & - +m_leafn_storage_to_litter_fire(p) + & - m_leafn_xfer_to_litter_fire(p)+m_retransn_to_litter_fire(p)) & - *leaf_prof(p,j) +(m_frootn_to_litter_fire(p)*fr_flab(patch%itype(p)) & - +m_frootn_storage_to_litter_fire(p) + & - m_frootn_xfer_to_litter_fire(p))*froot_prof(p,j) & - +(m_livestemn_storage_to_litter_fire(p) + & - m_livestemn_xfer_to_litter_fire(p) & - +m_deadstemn_storage_to_litter_fire(p) + & - m_deadstemn_xfer_to_litter_fire(p))* stem_prof(p,j)& - +(m_livecrootn_storage_to_litter_fire(p) + & - m_livecrootn_xfer_to_litter_fire(p) & - +m_deadcrootn_storage_to_litter_fire(p) + & - m_deadcrootn_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) - m_n_to_litr_cel_fire(c,j)=m_n_to_litr_cel_fire(c,j) + & - (m_leafn_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - m_n_to_litr_lig_fire(c,j)=m_n_to_litr_lig_fire(c,j) + & - (m_leafn_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - end if - end if - end do + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + + fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & + m_deadstemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) + fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & + m_deadcrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) + fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & + m_deadstemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) + fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & + m_deadcrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) + + + fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & + m_livestemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) + fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & + m_livecrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) + fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & + m_livestemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) + fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & + m_livecrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) + + + m_c_to_litr_met_fire(c,j)=m_c_to_litr_met_fire(c,j) + & + ((m_leafc_to_litter_fire(p)*lf_flab(patch%itype(p)) & + +m_leafc_storage_to_litter_fire(p) + & + m_leafc_xfer_to_litter_fire(p) + & + m_gresp_storage_to_litter_fire(p) & + +m_gresp_xfer_to_litter_fire(p))*leaf_prof(p,j) + & + (m_frootc_to_litter_fire(p)*fr_flab(patch%itype(p)) & + +m_frootc_storage_to_litter_fire(p) + & + m_frootc_xfer_to_litter_fire(p))*froot_prof(p,j) & + +(m_livestemc_storage_to_litter_fire(p) + & + m_livestemc_xfer_to_litter_fire(p) & + +m_deadstemc_storage_to_litter_fire(p) + & + m_deadstemc_xfer_to_litter_fire(p))* stem_prof(p,j)& + +(m_livecrootc_storage_to_litter_fire(p) + & + m_livecrootc_xfer_to_litter_fire(p) & + +m_deadcrootc_storage_to_litter_fire(p) + & + m_deadcrootc_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) + m_c_to_litr_cel_fire(c,j)=m_c_to_litr_cel_fire(c,j) + & + (m_leafc_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & + m_frootc_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + m_c_to_litr_lig_fire(c,j)=m_c_to_litr_lig_fire(c,j) + & + (m_leafc_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & + m_frootc_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + + m_n_to_litr_met_fire(c,j)=m_n_to_litr_met_fire(c,j) + & + ((m_leafn_to_litter_fire(p)*lf_flab(patch%itype(p)) & + +m_leafn_storage_to_litter_fire(p) + & + m_leafn_xfer_to_litter_fire(p)+m_retransn_to_litter_fire(p)) & + *leaf_prof(p,j) +(m_frootn_to_litter_fire(p)*fr_flab(patch%itype(p)) & + +m_frootn_storage_to_litter_fire(p) + & + m_frootn_xfer_to_litter_fire(p))*froot_prof(p,j) & + +(m_livestemn_storage_to_litter_fire(p) + & + m_livestemn_xfer_to_litter_fire(p) & + +m_deadstemn_storage_to_litter_fire(p) + & + m_deadstemn_xfer_to_litter_fire(p))* stem_prof(p,j)& + +(m_livecrootn_storage_to_litter_fire(p) + & + m_livecrootn_xfer_to_litter_fire(p) & + +m_deadcrootn_storage_to_litter_fire(p) + & + m_deadcrootn_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) + m_n_to_litr_cel_fire(c,j)=m_n_to_litr_cel_fire(c,j) + & + (m_leafn_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & + m_frootn_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) + m_n_to_litr_lig_fire(c,j)=m_n_to_litr_lig_fire(c,j) + & + (m_leafn_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & + m_frootn_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) end do end do ! diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index 4de67714a2..b1cdafb4ee 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -96,7 +96,6 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! ! !USES: use clm_time_manager , only: get_step_size_real, get_days_per_year, get_curr_date, get_nstep - use clm_varpar , only: max_patch_per_col use clm_varcon , only: secspday, secsphr use clm_varctl , only: spinup_state use pftconMod , only: nc4_grass, nc3crop, ndllf_evr_tmp_tree @@ -296,21 +295,17 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ cropf_col(c) = 0._r8 lfwt(c) = 0._r8 end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop veg types - if( patch%itype(p) > nc4_grass )then - cropf_col(c) = cropf_col(c) + patch%wtcol(p) - end if - ! For natural vegetation (non-crop and non-bare-soil) - if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then - lfwt(c) = lfwt(c) + patch%wtcol(p) - end if - end if - end do + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + ! For crop veg types + if( patch%itype(p) > nc4_grass )then + cropf_col(c) = cropf_col(c) + patch%wtcol(p) + end if + ! For natural vegetation (non-crop and non-bare-soil) + if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then + lfwt(c) = lfwt(c) + patch%wtcol(p) + end if end do ! ! Calculate crop fuel @@ -319,22 +314,18 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ c = filter_soilc(fc) fuelc_crop(c)=0._r8 end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop PFTs, fuel load includes leaf and litter; only - ! column-level litter carbon - ! is available, so we use leaf carbon to estimate the - ! litter carbon for crop PFTs - if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then - fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & - leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & - totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) - end if - end if - end do + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + ! For crop PFTs, fuel load includes leaf and litter; only + ! column-level litter carbon + ! is available, so we use leaf carbon to estimate the + ! litter carbon for crop PFTs + if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then + fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & + leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & + totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) + end if end do ! ! Calculate noncrop column variables @@ -370,130 +361,126 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - ! For non-crop -- natural vegetation and bare-soil - if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then - - ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen - ! and deciduous tropical trees (used to determine if a column is - ! tropical closed forest) use the current fractions. However, I think - ! they are used in code that applies to land cover change. Note that - ! land cover change is currently generated on the first time step of the - ! year (even though the fire code sees the annually-smoothed dwt). Thus, - ! I think that, for this to be totally consistent, this code should - ! consider the fractional coverage of each PFT prior to the relevant - ! land cover change event. (These fractions could be computed in the - ! code that handles land cover change, so that the fire code remains - ! agnostic to exactly how and when land cover change happens.) - ! - ! For example, if a year started with fractional coverages of - ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then - ! the start-of-year land cover change reduced both of these to 0.2: The - ! current code would consider the column to NOT be tropical closed - ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), - ! whereas in fact the land cover change occurred when the column *was* - ! tropical closed forest. - if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) - end if - if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + g = col%gridcell(c) + + ! For non-crop -- natural vegetation and bare-soil + if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then + + ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen + ! and deciduous tropical trees (used to determine if a column is + ! tropical closed forest) use the current fractions. However, I think + ! they are used in code that applies to land cover change. Note that + ! land cover change is currently generated on the first time step of the + ! year (even though the fire code sees the annually-smoothed dwt). Thus, + ! I think that, for this to be totally consistent, this code should + ! consider the fractional coverage of each PFT prior to the relevant + ! land cover change event. (These fractions could be computed in the + ! code that handles land cover change, so that the fire code remains + ! agnostic to exactly how and when land cover change happens.) + ! + ! For example, if a year started with fractional coverages of + ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then + ! the start-of-year land cover change reduced both of these to 0.2: The + ! current code would consider the column to NOT be tropical closed + ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), + ! whereas in fact the land cover change occurred when the column *was* + ! tropical closed forest. + if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then + trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) + end if + if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then + trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) + end if + + if (transient_landcover) then + if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then + if(dwt_smoothed(p) < 0._r8)then + ! Land cover change in CLM happens all at once on the first time + ! step of the year. However, the fire code needs deforestation + ! rates throughout the year, in order to combine these + ! deforestation rates with the current season's climate. So we + ! use a smoothed version of dwt. + ! + ! This isn't ideal, because the carbon stocks that the fire code + ! is operating on will have decreased by the full annual amount + ! before the fire code does anything. But the biggest effect of + ! these deforestation fires is as a trigger for other fires, and + ! the C fluxes are merely diagnostic so don't need to be + ! conservative, so this isn't a big issue. + ! + ! (Actually, it would be even better if the fire code had a + ! realistic breakdown of annual deforestation into the + ! different seasons. But having deforestation spread evenly + ! throughout the year is much better than having it all + ! concentrated on January 1.) + dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) end if + end if + end if + if (spinup_state == 2) then + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + frootc_xfer(p) + deadcrootc(p) * 10._r8 + & + deadcrootc_storage(p) + deadcrootc_xfer(p) + & + livecrootc(p)+livecrootc_storage(p) + & + livecrootc_xfer(p))*patch%wtcol(p) + else + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + frootc_xfer(p) + deadcrootc(p) + & + deadcrootc_storage(p) + deadcrootc_xfer(p) + & + livecrootc(p)+livecrootc_storage(p) + & + livecrootc_xfer(p))*patch%wtcol(p) + endif - if (transient_landcover) then - if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then - if(dwt_smoothed(p) < 0._r8)then - ! Land cover change in CLM happens all at once on the first time - ! step of the year. However, the fire code needs deforestation - ! rates throughout the year, in order to combine these - ! deforestation rates with the current season's climate. So we - ! use a smoothed version of dwt. - ! - ! This isn't ideal, because the carbon stocks that the fire code - ! is operating on will have decreased by the full annual amount - ! before the fire code does anything. But the biggest effect of - ! these deforestation fires is as a trigger for other fires, and - ! the C fluxes are merely diagnostic so don't need to be - ! conservative, so this isn't a big issue. - ! - ! (Actually, it would be even better if the fire code had a - ! realistic breakdown of annual deforestation into the - ! different seasons. But having deforestation spread evenly - ! throughout the year is much better than having it all - ! concentrated on January 1.) - dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) + fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) + + hdmlf=this%forc_hdm(g) + + ! all these constants are in Li et al. BG (2012a,b;2013) + + if( hdmlf > 0.1_r8 )then + ! For NOT bare-soil + if( patch%itype(p) /= noveg )then + ! For shrub and grass (crop already excluded above) + if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass + lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & + exp(-1._r8*SHR_CONST_PI* & + (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & + /(1.0_r8 - cropf_col(c)) + lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & + exp(-1._r8*SHR_CONST_PI* & + (gdp_lf(c)/7._r8)))*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & + exp(-1._r8*SHR_CONST_PI* & + (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else ! for trees + if( gdp_lf(c) > 20._r8 )then + lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c) =lgdp1_col(c)+0.62_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else + if( gdp_lf(c) > 8._r8 )then + lgdp_col(c)=lgdp_col(c)+0.79_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else + lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) end if end if + lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & + exp(-1._r8*SHR_CONST_PI* & + (hdmlf/125._r8)))*patch%wtcol(p)/(1._r8 -cropf_col(c)) end if - if (spinup_state == 2) then - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) * 10._r8 + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - else - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - endif - - fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) - - hdmlf=this%forc_hdm(g) - - ! all these constants are in Li et al. BG (2012a,b;2013) - - if( hdmlf > 0.1_r8 )then - ! For NOT bare-soil - if( patch%itype(p) /= noveg )then - ! For shrub and grass (crop already excluded above) - if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass - lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & - /(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/7._r8)))*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else ! for trees - if( gdp_lf(c) > 20._r8 )then - lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c) =lgdp1_col(c)+0.62_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else - if( gdp_lf(c) > 8._r8 )then - lgdp_col(c)=lgdp_col(c)+0.79_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) - end if - end if - lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/125._r8)))*patch%wtcol(p)/(1._r8 -cropf_col(c)) - end if - end if - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) - lpop_col(c) = lpop_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) - end if - - fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) end if + else + lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) + lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) + lpop_col(c) = lpop_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) end if - end do + + fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) + end if end do ! estimate annual decreased fractional coverage of BET+BDT @@ -529,36 +516,34 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g= col%gridcell(c) - hdmlf=this%forc_hdm(g) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop - if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & - kmo == abm_lf(c) .and. & - burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time - - ! calculate human density impact on ag. fire - fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) - - ! calculate impact of GDP on ag. fire - fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) - - ! calculate burned area - fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) - - ! crop fire only for generic crop types at this time - ! managed crops are treated as grasses if crop model is turned on - baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fhd*fgdp*patch%wtcol(p) - if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then - burndate(p)=kda - end if - end if + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + g = col%gridcell(c) + + ! For crop + if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & + kmo == abm_lf(c) .and. & + burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time + + hdmlf = this%forc_hdm(g) + + ! calculate human density impact on ag. fire + fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) + + ! calculate impact of GDP on ag. fire + fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) + + ! calculate burned area + fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) + + ! crop fire only for generic crop types at this time + ! managed crops are treated as grasses if crop model is turned on + baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fhd*fgdp*patch%wtcol(p) + if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then + burndate(p)=kda end if - end do + end if end do ! ! calculate peatland fire diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 5cc7c10dd3..77b0693fca 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -96,7 +96,6 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! ! !USES: use clm_time_manager , only: get_step_size_real, get_days_per_year, get_curr_date, get_nstep - use clm_varpar , only: max_patch_per_col use clm_varcon , only: secspday, secsphr use clm_varctl , only: spinup_state use pftconMod , only: nc4_grass, nc3crop, ndllf_evr_tmp_tree @@ -295,21 +294,17 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ cropf_col(c) = 0._r8 lfwt(c) = 0._r8 end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop veg types - if( patch%itype(p) > nc4_grass )then - cropf_col(c) = cropf_col(c) + patch%wtcol(p) - end if - ! For natural vegetation (non-crop and non-bare-soil) - if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then - lfwt(c) = lfwt(c) + patch%wtcol(p) - end if - end if - end do + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + ! For crop veg types + if( patch%itype(p) > nc4_grass )then + cropf_col(c) = cropf_col(c) + patch%wtcol(p) + end if + ! For natural vegetation (non-crop and non-bare-soil) + if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then + lfwt(c) = lfwt(c) + patch%wtcol(p) + end if end do ! ! Calculate crop fuel @@ -318,22 +313,18 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ c = filter_soilc(fc) fuelc_crop(c)=0._r8 end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop PFTs, fuel load includes leaf and litter; only - ! column-level litter carbon - ! is available, so we use leaf carbon to estimate the - ! litter carbon for crop PFTs - if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then - fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & - leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & - totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) - end if - end if - end do + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + ! For crop PFTs, fuel load includes leaf and litter; only + ! column-level litter carbon + ! is available, so we use leaf carbon to estimate the + ! litter carbon for crop PFTs + if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then + fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & + leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & + totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) + end if end do ! ! Calculate noncrop column variables @@ -371,130 +362,126 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - ! For non-crop -- natural vegetation and bare-soil - if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then - - ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen - ! and deciduous tropical trees (used to determine if a column is - ! tropical closed forest) use the current fractions. However, I think - ! they are used in code that applies to land cover change. Note that - ! land cover change is currently generated on the first time step of the - ! year (even though the fire code sees the annually-smoothed dwt). Thus, - ! I think that, for this to be totally consistent, this code should - ! consider the fractional coverage of each PFT prior to the relevant - ! land cover change event. (These fractions could be computed in the - ! code that handles land cover change, so that the fire code remains - ! agnostic to exactly how and when land cover change happens.) - ! - ! For example, if a year started with fractional coverages of - ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then - ! the start-of-year land cover change reduced both of these to 0.2: The - ! current code would consider the column to NOT be tropical closed - ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), - ! whereas in fact the land cover change occurred when the column *was* - ! tropical closed forest. - if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) - end if - if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + g = col%gridcell(c) + + ! For non-crop -- natural vegetation and bare-soil + if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then + + ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen + ! and deciduous tropical trees (used to determine if a column is + ! tropical closed forest) use the current fractions. However, I think + ! they are used in code that applies to land cover change. Note that + ! land cover change is currently generated on the first time step of the + ! year (even though the fire code sees the annually-smoothed dwt). Thus, + ! I think that, for this to be totally consistent, this code should + ! consider the fractional coverage of each PFT prior to the relevant + ! land cover change event. (These fractions could be computed in the + ! code that handles land cover change, so that the fire code remains + ! agnostic to exactly how and when land cover change happens.) + ! + ! For example, if a year started with fractional coverages of + ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then + ! the start-of-year land cover change reduced both of these to 0.2: The + ! current code would consider the column to NOT be tropical closed + ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), + ! whereas in fact the land cover change occurred when the column *was* + ! tropical closed forest. + if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then + trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) + end if + if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then + trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) + end if + + if (transient_landcover) then + if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then + if(dwt_smoothed(p) < 0._r8)then + ! Land cover change in CLM happens all at once on the first time + ! step of the year. However, the fire code needs deforestation + ! rates throughout the year, in order to combine these + ! deforestation rates with the current season's climate. So we + ! use a smoothed version of dwt. + ! + ! This isn't ideal, because the carbon stocks that the fire code + ! is operating on will have decreased by the full annual amount + ! before the fire code does anything. But the biggest effect of + ! these deforestation fires is as a trigger for other fires, and + ! the C fluxes are merely diagnostic so don't need to be + ! conservative, so this isn't a big issue. + ! + ! (Actually, it would be even better if the fire code had a + ! realistic breakdown of annual deforestation into the + ! different seasons. But having deforestation spread evenly + ! throughout the year is much better than having it all + ! concentrated on January 1.) + dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) end if + end if + end if + if (spinup_state == 2) then + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + frootc_xfer(p) + deadcrootc(p) * 10._r8 + & + deadcrootc_storage(p) + deadcrootc_xfer(p) + & + livecrootc(p)+livecrootc_storage(p) + & + livecrootc_xfer(p))*patch%wtcol(p) + else + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + frootc_xfer(p) + deadcrootc(p) + & + deadcrootc_storage(p) + deadcrootc_xfer(p) + & + livecrootc(p)+livecrootc_storage(p) + & + livecrootc_xfer(p))*patch%wtcol(p) + endif - if (transient_landcover) then - if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then - if(dwt_smoothed(p) < 0._r8)then - ! Land cover change in CLM happens all at once on the first time - ! step of the year. However, the fire code needs deforestation - ! rates throughout the year, in order to combine these - ! deforestation rates with the current season's climate. So we - ! use a smoothed version of dwt. - ! - ! This isn't ideal, because the carbon stocks that the fire code - ! is operating on will have decreased by the full annual amount - ! before the fire code does anything. But the biggest effect of - ! these deforestation fires is as a trigger for other fires, and - ! the C fluxes are merely diagnostic so don't need to be - ! conservative, so this isn't a big issue. - ! - ! (Actually, it would be even better if the fire code had a - ! realistic breakdown of annual deforestation into the - ! different seasons. But having deforestation spread evenly - ! throughout the year is much better than having it all - ! concentrated on January 1.) - dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) + fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) + + hdmlf=this%forc_hdm(g) + + ! all these constants are in Li et al. BG (2012a,b;2013) + + if( hdmlf > 0.1_r8 )then + ! For NOT bare-soil + if( patch%itype(p) /= noveg )then + ! For shrub and grass (crop already excluded above) + if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass + lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & + exp(-1._r8*SHR_CONST_PI* & + (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & + /(1.0_r8 - cropf_col(c)) + lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & + exp(-1._r8*SHR_CONST_PI* & + (gdp_lf(c)/7._r8)))*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & + exp(-1._r8*SHR_CONST_PI* & + (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else ! for trees + if( gdp_lf(c) > 20._r8 )then + lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c) =lgdp1_col(c)+0.62_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else + if( gdp_lf(c) > 8._r8 )then + lgdp_col(c)=lgdp_col(c)+0.79_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) + else + lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) + lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) end if end if + lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & + exp(-1._r8*SHR_CONST_PI* & + (hdmlf/125._r8)))*patch%wtcol(p)/(1._r8 -cropf_col(c)) end if - if (spinup_state == 2) then - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) * 10._r8 + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - else - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - endif - - fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) - - hdmlf=this%forc_hdm(g) - - ! all these constants are in Li et al. BG (2012a,b;2013) - - if( hdmlf > 0.1_r8 )then - ! For NOT bare-soil - if( patch%itype(p) /= noveg )then - ! For shrub and grass (crop already excluded above) - if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass - lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & - /(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/7._r8)))*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else ! for trees - if( gdp_lf(c) > 20._r8 )then - lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c) =lgdp1_col(c)+0.62_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else - if( gdp_lf(c) > 8._r8 )then - lgdp_col(c)=lgdp_col(c)+0.79_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) - end if - end if - lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/125._r8)))*patch%wtcol(p)/(1._r8 -cropf_col(c)) - end if - end if - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) - lpop_col(c) = lpop_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) - end if - - fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) end if + else + lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) + lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) + lpop_col(c) = lpop_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) end if - end do + + fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) + end if end do ! estimate annual decreased fractional coverage of BET+BDT @@ -530,36 +517,34 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g= col%gridcell(c) - hdmlf=this%forc_hdm(g) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop - if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & - kmo == abm_lf(c) .and. & - burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time - - ! calculate human density impact on ag. fire - fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) - - ! calculate impact of GDP on ag. fire - fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) - - ! calculate burned area - fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) - - ! crop fire only for generic crop types at this time - ! managed crops are treated as grasses if crop model is turned on - baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fhd*fgdp*patch%wtcol(p) - if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then - burndate(p)=kda - end if - end if + do fp = 1, num_soilp + p = filter_soilp(fp) + c = patch%column(p) + g = col%gridcell(c) + + ! For crop + if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & + kmo == abm_lf(c) .and. & + burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time + + hdmlf = this%forc_hdm(g) + + ! calculate human density impact on ag. fire + fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) + + ! calculate impact of GDP on ag. fire + fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) + + ! calculate burned area + fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) + + ! crop fire only for generic crop types at this time + ! managed crops are treated as grasses if crop model is turned on + baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fhd*fgdp*patch%wtcol(p) + if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then + burndate(p)=kda end if - end do + end if end do ! ! calculate peatland fire From ba1d9e691c34ba8ab3f3396f9b1e46bc9a7ee18c Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 6 Oct 2020 08:18:29 -0600 Subject: [PATCH 1529/1973] move initialization of iulog --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index e8b1b76f5a..eb9ebcab8a 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -201,6 +201,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call mpi_comm_dup(lmpicom, mpicom, ierr) + !---------------------------------------------------------------------------- + ! reset shr logging to my log file + !---------------------------------------------------------------------------- + + call set_component_logging(gcomp, localPet==0, iulog, shrlogunit, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Note still need compid for those parts of the code that use the data model ! functionality through subroutine calls call NUOPC_CompAttributeGet(gcomp, name='MCTID', value=cvalue, rc=rc) @@ -216,13 +223,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call get_component_instance(gcomp, inst_suffix, inst_index, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - !---------------------------------------------------------------------------- - ! reset shr logging to my log file - !---------------------------------------------------------------------------- - - call set_component_logging(gcomp, localPet==0, iulog, shrlogunit, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - !---------------------------------------------------------------------------- ! advertise fields !---------------------------------------------------------------------------- @@ -327,7 +327,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_file_setLogUnit (shrlogunit) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) - end subroutine InitializeAdvertise !=============================================================================== @@ -427,7 +426,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return !$ call omp_set_num_threads(localPeCount) - print *,__FILE__,__LINE__,localPeCount !---------------------- ! Obtain attribute values From d2f5705b13ba1f83d53748247abeec042b8900ac Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 6 Oct 2020 11:27:21 -0600 Subject: [PATCH 1530/1973] Update ChangeLog --- doc/ChangeLog | 210 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 211 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 0af8f22877..96b4989325 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,214 @@ =============================================================== +Tag name: ctsm5.1.dev007 +Originator(s): sacks (Bill Sacks) +Date: Tue Oct 6 09:29:27 MDT 2020 +One-line Summary: CNFire: btran2 fixes and general cleanup + +Purpose of changes +------------------ + +(1) Call routine to calculate fire's btran2 from CNFireArea; this has a + few advantages: + + - It makes the logic of CNFireArea more clear (rather than depending on + a btran2 variable that is calculated from some other part of the code) + + - This avoids having the biogeophysics depend on the biogeochemistry + + - This lets us avoid doing this btran calc if using no-fire – or other, + future, fire methods that don't need it + + Note regarding testing: In the initial step, I kept this calculation + dependent on a saved version of h2osoi_vol to avoid changing + answers; I changed this in the answer changes in step (2), as noted + below. + +(2) Answer-changing fixes to CNFire's btran2 calculation and use: + + (a) Calculate fire btran2 using updated h2osoi_vol (this is an + answer-changing cleanup step from (1)) + + (b) TEMPORARY CHANGE (reverted in the cleanup in (3)): Reinitialize + fire btran2 to spval for all patches in each time step, so that + the fire code isn't trying to use btran2 from earlier time steps + for patches that were in the exposed veg filter at one point but + no longer are. + + One implication of this is that, if there is currently no + exposed veg on a column, the new code leads to the block of code + that forces fire_m = 0 (because wtlf will be 0). Previously, in + contrast, it looks like fire_m was allowed to be non-zero even + if there is currently no exposed veg, because btran2 and wtlf + were accumulated if a patch ever was exposed in the past. + + (c) Limit fire btran2 to be <= 1, rather than letting it be slightly + greater than 1. (Due to a conditional in CNFireArea, these + slightly-greater-tan-1 values were being ignored when computing + btran_col, rather than averaging in a 1 value.) + +(3) Non-answer-changing fire code cleanup: + + (a) Cleanup of the btran2 fixes, including reverting the TEMPORARY + CHANGE noted in (2b), instead relying on a better mechanism: + just doing the calculations of btran_col and wtlf over the + exposedvegp filter. Also, get rid of the checks for + shr_infnan_isnan(btran2(p)) and btran2(p) <= 1 (allowed by the + other changes in (2) and (3)). + + (b) Set btran2 to 0 over non-exposed-veg points: this changes + answers for the BTRAN2 diagnostic field, but nothing else. (This + follows what is done for the standard BTRAN.) + + (c) Move calc_fire_root_wetness for CNFireLi2021 into the base type + to avoid future bugs (assuming that the next fire module will + extend the base class but will also want to use this new version + of calc_fire_root_wetness). + + (d) Change fire looping structure to be more standard + +(4) Remove some very expensive tests from aux_clm, putting some in the + new ctsm_sci test list instead + +(5) A bit of other minor cleanup + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1139 (Decrease expense of ne0ARCTICGRISne30x8 + test and C96 tests) +- Resolves ESCOMP/CTSM#1153 (Fire btran2 is only computed for exposed + veg patches, but is used over all veg patches) +- Resolves ESCOMP/CTSM#1170 (CNFire code: btran2 should not be skipped + when it's greater than 1) +- Partially addresses ESCOMP/CTSM#1142 (Add ctsm_sci test list that + would be used for releases and making sure important resolutions run + well) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: Remove some very expensive tests from +aux_clm, putting some in the new ctsm_sci test list instead. + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - pass (on my mac) + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok: tests pass, many baselines fail as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, for all CN/BGC configurations + + Summarize any changes to answers, i.e., + - what code configurations: All CN/BGC configurations + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + larger than roundoff; expected to be same climate, but not + investigated yet + + + To verify that the answer changes only came from expected changes, I + did a few rounds of testing. The following numbers refer to the groups + of changes listed under "Purpose of changes", above. The changes in + groups (4) and (5) were combined with those in groups (1) and (3) - + i.e., the basically non-answer-changing sets. + + First, I tested with just the changes in (1). This led to differences + in only limited configurations, as noted in + https://github.com/ESCOMP/CTSM/pull/1155#issuecomment-695035048: + - nofire tests had diffs in BTRAN2 + - dynroots tests had extensive diffs because now btran2 is calculated + after the dyn roots updates in each time step + - tests where the compared clm2 h0 file includes the 0th time step had + diffs just in BTRAN2, for reasons I couldn't determine + + Then I tested with the changes in (2), which were expected to change + answers for all CN/BGC tests. In particular, these change answers due + to: + - using updated h2osoi_vol rather than the one earlier in the time + step when calculating btran2 + - only considering points in the exposed veg filter when averaging + btran2 from patch to column, rather than using stale values from + no-longer-exposed patches (which also means having fire_m = 0 if + there are no currently-exposed veg patches in a column) (fix for + ESCOMP/CTSM#1153) + - treating btran2 values that are slightly greater than 1 as 1, rather + than ignoring them completely (fix for ESCOMP/CTSM#1170) + + Finally, I tested with all of the changes, comparing against the + baselines generated from (2). As expected, the only answer changes in + this final round were in the BTRAN2 diagnostic field (due to setting + btran2 to 0 over non-exposed-veg points). + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1155 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev006 Originator(s): sacks (Bill Sacks) Date: Sat Oct 3 19:50:41 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index fe6c8fa632..0ad89637f5 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev007 sacks 10/06/2020 CNFire: btran2 fixes and general cleanup ctsm5.1.dev006 sacks 10/03/2020 Call correct routine to calculate btran2 for CNFireLi2021 ctsm5.1.dev005 sacks 10/02/2020 Answer changing bug fixes for clm51: fire and organic_frac_squared ctsm5.1.dev004 oleson 09/30/2020 Improve robustness of onset and offset counters when changing dt From 84d8982df28a0a10f1d01809d8055c9b9cdd7c2a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 6 Oct 2020 16:11:50 -0600 Subject: [PATCH 1531/1973] Fix for #1158 always turning on the dribbling when crop is on for all physics versions --- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 0e4cb6857d..f5e1cf0295 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -586,8 +586,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .true. -.true. -.false. + +.true. .true. +.true. .true. .true. @@ -717,6 +718,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 + Date: Wed, 7 Oct 2020 09:37:14 -0600 Subject: [PATCH 1535/1973] refactor ncdio_pio for local type conversion --- src/main/ncdio_pio.F90.in | 94 +++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 9 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 3c1c5502a2..319eb8f399 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1612,6 +1612,7 @@ contains logical :: varpresent ! if true, variable is on tape integer :: xtype ! type of var in file integer , pointer :: idata(:) ! Temporary integer data to send to file + real(r4) , pointer :: fdata(:) ! Temporary double data to send to file real(r8) , pointer :: ddata(:) ! Temporary double data to send to file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc @@ -1713,7 +1714,30 @@ contains endif #else call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) +#if ({ITYPE}==TYPEINT) + if (xtype == PIO_INT .or. xtype == PIO_REAL) then + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) + else if (xtype == PIO_DOUBLE) then + allocate(ddata(size(data))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, ddata, status) + data = int(ddata) + deallocate( ddata ) + endif +#else if ({ITYPE}==TYPEDOUBLE) + if (xtype == PIO_DOUBLE) then + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) + else if (xtype == PIO_INT) then + allocate(idata(size(data))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) + data = real(idata, kind=R8) + deallocate(idata) + else if (xtype == PIO_REAL) then + allocate(fdata(size(data))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, fdata, status) + data = real(fdata, kind=R8) + deallocate(fdata) + endif +#endif #endif if ( status /= PIO_NOERR ) then call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & @@ -1818,6 +1842,9 @@ contains integer :: lb1,lb2 integer :: ub1,ub2 integer :: xtype ! netcdf type of variable on file + integer , pointer :: idata(:,:) ! Temporary integer data to read from file + real(r4) , pointer :: fdata(:,:) ! Temporary double data to read from file + real(r8) , pointer :: ddata(:,:) ! Temporary double data to read from file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc @@ -1913,18 +1940,40 @@ contains if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) end if +#if ({ITYPE}==TYPEINT) + if(xtype == PIO_INT .or. xtype == PIO_REAL) then + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) + elseif(xtype == PIO_DOUBLE) then + allocate(ddata(size(data,1),size(data,2))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, ddata, status) + data = int(ddata) + endif +#endif +#if ({ITYPE}==TYPEDOUBLE) + if(xtype == PIO_DOUBLE) then + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) + else if(xtype == PIO_INT) then + allocate(idata(size(data,1),size(data,2))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) + data = real(idata, kind=R8) + deallocate(idata) + else if(xtype == PIO_REAL) then + allocate(fdata(size(data,1),size(data,2))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, fdata, status) + data = real(fdata, kind=R8) + deallocate(fdata) + endif +#endif if (present(switchdim)) then - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status) + temp = data do j = lb2,ub2 - do i = lb1,ub1 - data(i,j) = temp(j,i) - end do + do i = lb1,ub1 + data(i,j) = temp(j,i) + end do end do - else - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) end if end if -#if ({ITYPE}!=TYPEINT) +#if ({ITYPE}==TYPEDOUBLE) if ( present(cnvrtnan2fill) )then do j = lb2,ub2 do i = lb1,ub1 @@ -2054,6 +2103,9 @@ contains integer :: count(5) ! netcdf count index integer :: xtype ! netcdf type of variable on file logical :: varpresent ! if true, variable is on tape + integer , pointer :: idata(:,:,:) ! Temporary integer data to read from file + real(r4) , pointer :: fdata(:,:,:) ! Temporary double data to read from file + real(r8) , pointer :: ddata(:,:,:) ! Temporary double data to read from file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc character(len=*),parameter :: subname='ncd_io_3d_{TYPE}' ! subroutine name @@ -2116,7 +2168,31 @@ contains if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) end if - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) +#if ({ITYPE}==TYPEINT) + if(xtype == PIO_INT .or. xtype == PIO_REAL) then + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) + elseif (xtype == PIO_DOUBLE) then + allocate(ddata(size(data,1),size(data,2),size(data,3))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, ddata, status) + data = int(ddata) + deallocate(ddata) + endif +#endif +#if ({ITYPE}==TYPEDOUBLE) + if(xtype == PIO_INT) then + allocate(idata(size(data,1),size(data,2),size(data,3))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) + data = real(idata, kind=r8) + deallocate(idata) + else if(xtype == PIO_REAL) then + allocate(fdata(size(data,1),size(data,2),size(data,3))) + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, fdata, status) + data = real(fdata, kind=r8) + deallocate(fdata) + else + call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) + endif +#endif end if end if if (present(readvar)) readvar = varpresent From f34a6ef1b4805a0c96838d2660536524c8267527 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 7 Oct 2020 11:47:12 -0600 Subject: [PATCH 1536/1973] Update change files --- doc/ChangeLog | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 102 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 96b4989325..14307c013f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,105 @@ =============================================================== +Tag name: ctsm5.1.dev008 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Wed Oct 7 11:36:54 MDT 2020 +One-line Summary: Two answer changes: Clm45/50/51 with crop, and for 2000Clm51 + +Purpose of changes +------------------ + +Turn dribble_crophrv_xsmrpool_2atm when crop is on for clm4_5, clm5_0, and clm5_1 physics +Fix the finidat files being selected for 2000_control conditions for clm5_1 + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1158 -- Turn dribble_crophrv_xsmrpool_2atm on when crop is on for all physics versions + Another issue in #1166 -- correct finidat file for 2000Clm51 + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[x] clm5_1 + +[x] clm5_0 + +[ ] ctsm5_0-nwp + +[x] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None + +Changes made to namelist defaults (e.g., changed parameter values): + dribble_crophrv_xsmrpool_2atm now on when crop on for all physics versions + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + The namelist dribble_crophrv_xsmrpool_2atm should now be removed as a namelist item both + in the fortran code and in build-namelist scripts. This change should be bit-for-bit. + +Changes to tests or testing: None + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + python testing (see instructions in python/README.md; document testing done): + + cheyenne -- PASS + + regular tests (aux_clm): + + cheyenne ---- PASS + izumi ------- PASS + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes + + Summarize any changes to answers, i.e., + - what code configurations: Clm45/50/51 with crop (except with prognostic CO2) and 2000Clm51 + - what platforms/compilers: All + - nature of change: same climate + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): #1177 +(https://github.com/ESCOMP/ctsm/pull) + + #1177 -- Two answer changes turn dribble_crophrv_xsmrpool_2atm and correct clm5_1 finidat + file for 2000 conditions + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev007 Originator(s): sacks (Bill Sacks) Date: Tue Oct 6 09:29:27 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 0ad89637f5..43dd86692d 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev008 erik 10/07/2020 Two answer changes: Clm45/50/51 with crop, and for 2000Clm51 ctsm5.1.dev007 sacks 10/06/2020 CNFire: btran2 fixes and general cleanup ctsm5.1.dev006 sacks 10/03/2020 Call correct routine to calculate btran2 for CNFireLi2021 ctsm5.1.dev005 sacks 10/02/2020 Answer changing bug fixes for clm51: fire and organic_frac_squared From fb5ebdb696a58a5c86f079754045467a8e460af3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 7 Oct 2020 11:48:44 -0600 Subject: [PATCH 1537/1973] Update change files --- doc/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 14307c013f..0c28276286 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev008 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Oct 7 11:36:54 MDT 2020 +Date: Wed Oct 7 11:48:30 MDT 2020 One-line Summary: Two answer changes: Clm45/50/51 with crop, and for 2000Clm51 Purpose of changes @@ -63,7 +63,7 @@ CTSM testing: regular build-namelist tests: - cheyenne - PASS + cheyenne - PASS (120 tests are different than before) python testing (see instructions in python/README.md; document testing done): From 84e9ce85c8345c8af7fdef3359e34acf42f86506 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 7 Oct 2020 12:51:11 -0600 Subject: [PATCH 1538/1973] Remove the specific release-cesm2.2 branch changes to update change files --- doc/UpdateChangelog.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/UpdateChangelog.pl b/doc/UpdateChangelog.pl index 05f80a501b..4a5329175b 100755 --- a/doc/UpdateChangelog.pl +++ b/doc/UpdateChangelog.pl @@ -41,7 +41,7 @@ sub usage { To document a new tag - $ProgName release-cesm2.2.09 "Description of this tag" + $ProgName ctsm5.2.dev099 "Description of this tag" EOF } @@ -67,7 +67,7 @@ sub usage { $tag = $ARGV[0]; $sum = $ARGV[1]; - if ( $tag !~ /release-cesm[0-9]\.[0-9]\.([0-9][0-9])/ ) { + if ( $tag !~ /ctsm[0-9]\.[0-9]\.(dev[0-9][0-9][0-9]|[0-9][0-9])/ ) { print "ERROR: bad tagname: $tag\n"; usage(); } @@ -84,8 +84,8 @@ sub usage { } -my $template = ".release-ChangeLog_template"; -my $changelog = "release-cesm2.2.ChangeLog"; +my $template = ".ChangeLog_template"; +my $changelog = "ChangeLog"; my $changesum = "ChangeSum"; my $changelog_tmp = "ChangeLog.tmp"; my $changesum_tmp = "ChangeSum.tmp"; @@ -137,7 +137,7 @@ sub usage { my $oldTag = ""; while( $_ = ) { # If adding a new tag check that new tag name does NOT match any old tag - if ( $_ =~ /Tag name:[ ]*(release-cesm.+)/ ) { + if ( $_ =~ /Tag name:[ ]*(ctsm.+)/ ) { $oldTag = $1; if ( (! $opts{'update'}) && ($tag eq $oldTag) ) { close( CL ); @@ -177,10 +177,10 @@ sub usage { # Find header line if ( $_ =~ /=====================/ ) { print FH $_; - my $format = "%18.18s %6.6s %10.10s %s\n"; + my $format = "%18.18s %8.8s %10.10s %s\n"; if ( $update ) { $_ = ; - if ( /^(.{18}) (.{6}) (.{10}) (.+)$/ ) { + if ( /^(.{18}) (.{8}) (.{10}) (.+)$/ ) { $tag = $1; $user = $2; $sum = $4; From 033aad7202ae3e0283d7a6c6c5f10d80f1ae6626 Mon Sep 17 00:00:00 2001 From: Danica Date: Thu, 8 Oct 2020 09:30:52 -0600 Subject: [PATCH 1539/1973] Add documentation for SP changes --- src/biogeochem/SatellitePhenologyMod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index eab3e55d65..4e4f6cbc44 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -414,7 +414,8 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & endif ! area weight by snow covered fraction - + !grass and crop snow burial changes with PFT height + !accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 elai(p) = max(tlai(p)*(1.0_r8 - frac_sno(c)) + tlai(p)*fb*frac_sno(c), 0.0_r8) esai(p) = max(tsai(p)*(1.0_r8 - frac_sno(c)) + tsai(p)*fb*frac_sno(c), 0.0_r8) if (elai(p) < 0.05_r8) elai(p) = 0._r8 From 66c4d49ada33f3b85da8044cf8547c2f61fb7f79 Mon Sep 17 00:00:00 2001 From: Danica Date: Thu, 8 Oct 2020 09:36:42 -0600 Subject: [PATCH 1540/1973] Fix to quadratic solution error bug #756 caused by negative shaded photosynthesis --- src/biogeophys/PhotosynthesisMod.F90 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 023b39898f..056e359e63 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -4108,10 +4108,13 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b ! With an <= 0, then gs_mol = bbb ! Sunlit - cs_sun = cair - 1.4_r8/gb_mol * an_sun(p,iv) * forc_pbot(c) - cs_sun = max(cs_sun,10.e-06_r8) + if (an_sun(p,iv) >= 0._r8) then + cs_sun = cair - 1.4_r8/gb_mol * an_sun(p,iv) * forc_pbot(c) + cs_sun = max(cs_sun,10.e-06_r8) + end if if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then + if (an_sun(p,iv) >= 0._r8) then term = 1.6_r8 * an_sun(p,iv) / (cs_sun / forc_pbot(c) * 1.e06_r8) aquad = 1.0_r8 bquad = -(2.0 * (medlynintercept(patch%itype(p))*1.e-06_r8 + term) + (medlynslope(patch%itype(p)) * term)**2 / & @@ -4122,8 +4125,10 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b call quadratic (aquad, bquad, cquad, r1, r2) gs_mol_sun = max(r1,r2) * 1.e06_r8 - + end if + ! Shaded + if (an_sha(p,iv) >= 0._r8) then cs_sha = cair - 1.4_r8/gb_mol * an_sha(p,iv) * forc_pbot(c) cs_sha = max(cs_sha,10.e-06_r8) @@ -4137,14 +4142,18 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b call quadratic (aquad, bquad, cquad, r1, r2) gs_mol_sha = max(r1,r2)* 1.e06_r8 + end if else if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then + if (an_sun(p,iv) >= 0._r8) then aquad = cs_sun bquad = cs_sun*(gb_mol - max(bsun*bbb(p),1._r8)) - mbb(p)*an_sun(p,iv)*forc_pbot(c) cquad = -gb_mol*(cs_sun*max(bsun*bbb(p),1._r8) + mbb(p)*an_sun(p,iv)*forc_pbot(c)*rh_can) call quadratic (aquad, bquad, cquad, r1, r2) gs_mol_sun = max(r1,r2) + end if ! Shaded + if (an_sha(p,iv) >= 0._r8) then cs_sha = cair - 1.4_r8/gb_mol * an_sha(p,iv) * forc_pbot(c) cs_sha = max(cs_sha,10.e-06_r8) @@ -4153,6 +4162,7 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b cquad = -gb_mol*(cs_sha*max(bsha*bbb(p),1._r8) + mbb(p)*an_sha(p,iv)*forc_pbot(c)*rh_can) call quadratic (aquad, bquad, cquad, r1, r2) gs_mol_sha = max(r1,r2) + end if end if ! Derive new estimate for cisun,cisha From 264f598f592e8581b73c117bc3dd7cfc463bf9a3 Mon Sep 17 00:00:00 2001 From: Danica Date: Thu, 8 Oct 2020 09:45:21 -0600 Subject: [PATCH 1541/1973] Update to BGC code to account for crop/grass height in snow burial calculation, fix for bug #516 --- src/biogeochem/CNVegStructUpdateMod.F90 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 6f5b19476e..09f6a2f57a 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -106,7 +106,8 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & nind => dgvs_inst%nind_patch , & ! Input: [real(r8) (:) ] number of individuals (#/m**2) fpcgrid => dgvs_inst%fpcgrid_patch , & ! Input: [real(r8) (:) ] fractional area of patch (pft area/nat veg area) - snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) + frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) + snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: [real(r8) (:) ] observational height of wind at patch-level [m] @@ -292,8 +293,10 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & !depth of snow required for complete burial of grasses endif - elai(p) = max(tlai(p)*fb, 0.0_r8) - esai(p) = max(tsai(p)*fb, 0.0_r8) + !grass and crop snow burial changes with PFT height + !accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 + elai(p) = max(tlai(p)*(1.0_r8 - frac_sno(c)) + tlai(p)*fb*frac_sno(c), 0.0_r8) + esai(p) = max(tsai(p)*(1.0_r8 - frac_sno(c)) + tsai(p)*fb*frac_sno(c), 0.0_r8) ! Fraction of vegetation free of snow if ((elai(p) + esai(p)) > 0._r8) then From 6cb3524621ab630553d0b12b2f1927a93818af0d Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 8 Oct 2020 10:51:14 -0600 Subject: [PATCH 1542/1973] rewrite read_darray interface --- src/main/ncdio_pio.F90.in | 309 ++++++++++++++++++++++++-------------- 1 file changed, 200 insertions(+), 109 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 319eb8f399..951c2b2b43 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1616,6 +1616,7 @@ contains real(r8) , pointer :: ddata(:) ! Temporary double data to send to file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc + integer :: oldhandle ! previous value of pio_error_handle character(len=*),parameter :: subname='ncd_io_1d_{TYPE}' ! subroutine name !----------------------------------------------------------------------- @@ -1641,7 +1642,6 @@ contains call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) if (varpresent) then - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) if (single_column) then start(:) = 1 ; count(:) = 1 call scam_field_offsets(ncid,clmlevel,vardesc,start,count) @@ -1660,6 +1660,7 @@ contains end if #if ({ITYPE}==TYPELOGICAL) allocate(idata(size(data))) + call pio_seterrorhandling(ncid, PIO_BCAST_ERROR, oldhandle) status = pio_get_var(ncid, varid, start(1:n), count(1:n), idata) data = (idata == 1) if ( any(idata /= 0 .and. idata /= 1) )then @@ -1673,6 +1674,8 @@ contains call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & // errMsg(sourcefile, __LINE__)) end if + call pio_seterrorhandling(ncid, oldhandle) + else status = pio_inq_varndims(ncid, vardesc, ndims) status = pio_inq_vardimid(ncid, vardesc, dids(1:ndims)) @@ -1694,58 +1697,20 @@ contains if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) end if -#if ({ITYPE}==TYPELOGICAL) - if (xtype == PIO_INT .or. xtype == PIO_REAL) then - allocate(idata(size(data))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) - data = (idata == 1) - if ( any(idata /= 0 .and. idata /= 1) )then - call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__)) - end if - deallocate( idata ) - else if (xtype == PIO_DOUBLE) then - allocate(ddata(size(data))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, ddata, status) - data = (ddata == 1.) - if ( any(ddata /= 0. .and. ddata /= 1.) )then - call shr_sys_abort(' ERROR: read in bad value(s) for logical data'//errMsg(sourcefile, __LINE__)) - end if - deallocate( ddata ) - endif -#else - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) -#if ({ITYPE}==TYPEINT) - if (xtype == PIO_INT .or. xtype == PIO_REAL) then - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - else if (xtype == PIO_DOUBLE) then - allocate(ddata(size(data))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, ddata, status) - data = int(ddata) - deallocate( ddata ) - endif -#else if ({ITYPE}==TYPEDOUBLE) - if (xtype == PIO_DOUBLE) then - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - else if (xtype == PIO_INT) then - allocate(idata(size(data))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) - data = real(idata, kind=R8) - deallocate(idata) - else if (xtype == PIO_REAL) then - allocate(fdata(size(data))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, fdata, status) - data = real(fdata, kind=R8) - deallocate(fdata) + if(xtype == PIO_INT) then + call read_darray_{TYPE}_from_int_1(ncid, vardesc, iodesc_plus%iodesc, varname, data) + elseif(xtype == PIO_REAL) then + call read_darray_{TYPE}_from_real_1(ncid, vardesc, iodesc_plus%iodesc, varname, data) + elseif(xtype == PIO_DOUBLE) then + call read_darray_{TYPE}_from_double_1(ncid, vardesc, iodesc_plus%iodesc, varname, data) + else + call shr_sys_abort(' ERROR: unrecognised type in read'//errMsg(sourcefile, __LINE__)) + endif -#endif -#endif - if ( status /= PIO_NOERR ) then - call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & - // errMsg(sourcefile, __LINE__)) - end if + end if end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) + if (present(readvar)) readvar = varpresent elseif (flag == 'write') then @@ -1929,48 +1894,41 @@ contains status = pio_inq_dimlen(ncid,dids(n),dims(n)) enddo status = pio_inq_vartype(ncid, vardesc, xtype) - if (present(switchdim)) then - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - xtype, iodnum, switchdim=.true.) - else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - xtype, iodnum) - end if - iodesc_plus => iodesc_list(iodnum) if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) end if -#if ({ITYPE}==TYPEINT) - if(xtype == PIO_INT .or. xtype == PIO_REAL) then - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - elseif(xtype == PIO_DOUBLE) then - allocate(ddata(size(data,1),size(data,2))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, ddata, status) - data = int(ddata) - endif -#endif -#if ({ITYPE}==TYPEDOUBLE) - if(xtype == PIO_DOUBLE) then - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - else if(xtype == PIO_INT) then - allocate(idata(size(data,1),size(data,2))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) - data = real(idata, kind=R8) - deallocate(idata) - else if(xtype == PIO_REAL) then - allocate(fdata(size(data,1),size(data,2))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, fdata, status) - data = real(fdata, kind=R8) - deallocate(fdata) - endif -#endif if (present(switchdim)) then - temp = data + call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & + xtype, iodnum, switchdim=.true.) + iodesc_plus => iodesc_list(iodnum) + if(xtype == PIO_INT) then + call read_darray_{TYPE}_from_int_2(ncid, vardesc, iodesc_plus%iodesc, varname, temp) + elseif(xtype == PIO_REAL) then + call read_darray_{TYPE}_from_real_2(ncid, vardesc, iodesc_plus%iodesc, varname, temp) + elseif(xtype == PIO_DOUBLE) then + call read_darray_{TYPE}_from_double_2(ncid, vardesc, iodesc_plus%iodesc, varname, temp) + else + call shr_sys_abort(' ERROR: unrecognised type in read'//errMsg(sourcefile, __LINE__)) + endif do j = lb2,ub2 do i = lb1,ub1 data(i,j) = temp(j,i) end do end do + else + call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & + xtype, iodnum) + iodesc_plus => iodesc_list(iodnum) + + if(xtype == PIO_INT) then + call read_darray_{TYPE}_from_int_2(ncid, vardesc, iodesc_plus%iodesc, varname, data) + elseif(xtype == PIO_REAL) then + call read_darray_{TYPE}_from_real_2(ncid, vardesc, iodesc_plus%iodesc, varname, data) + elseif(xtype == PIO_DOUBLE) then + call read_darray_{TYPE}_from_double_2(ncid, vardesc, iodesc_plus%iodesc, varname, data) + else + call shr_sys_abort(' ERROR: unrecognised type in read'//errMsg(sourcefile, __LINE__)) + endif end if end if #if ({ITYPE}==TYPEDOUBLE) @@ -2069,7 +2027,6 @@ contains end if end subroutine ncd_io_2d_{TYPE} - !----------------------------------------------------------------------- !TYPE int,double @@ -2168,31 +2125,17 @@ contains if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) end if -#if ({ITYPE}==TYPEINT) - if(xtype == PIO_INT .or. xtype == PIO_REAL) then - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - elseif (xtype == PIO_DOUBLE) then - allocate(ddata(size(data,1),size(data,2),size(data,3))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, ddata, status) - data = int(ddata) - deallocate(ddata) - endif -#endif -#if ({ITYPE}==TYPEDOUBLE) - if(xtype == PIO_INT) then - allocate(idata(size(data,1),size(data,2),size(data,3))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) - data = real(idata, kind=r8) - deallocate(idata) - else if(xtype == PIO_REAL) then - allocate(fdata(size(data,1),size(data,2),size(data,3))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, fdata, status) - data = real(fdata, kind=r8) - deallocate(fdata) - else - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - endif -#endif + + if(xtype == PIO_INT) then + call read_darray_{TYPE}_from_int_3(ncid, vardesc, iodesc_plus%iodesc, varname, data) + elseif(xtype == PIO_REAL) then + call read_darray_{TYPE}_from_real_3(ncid, vardesc, iodesc_plus%iodesc, varname, data) + elseif(xtype == PIO_DOUBLE) then + call read_darray_{TYPE}_from_double_3(ncid, vardesc, iodesc_plus%iodesc, varname, data) + else + call shr_sys_abort(' ERROR: unrecognised type in read'//errMsg(sourcefile, __LINE__)) + endif + end if end if if (present(readvar)) readvar = varpresent @@ -2235,6 +2178,154 @@ contains end subroutine ncd_io_3d_{TYPE} + + !TYPE int,double,logical + !DIMS 1,2,3 + subroutine read_darray_{TYPE}_from_double_{DIMS}(ncid, vardesc, iodesc, varname, data) + class(file_desc_t), intent(inout) :: ncid + type(var_desc_t), intent(inout) :: vardesc + type(io_desc_t), intent(inout) :: iodesc + {VTYPE}, pointer :: data{DIMSTR} + character(len=*), intent(in) :: varname + integer :: status + + real(R8), allocatable :: ddata{DIMSTR} + integer :: oldhandle + + call pio_seterrorhandling(ncid, PIO_BCAST_ERROR, oldhandle) +#if({ITYPE}==TYPEDOUBLE) + call pio_read_darray(ncid, vardesc, iodesc, data, status) + if ( status /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & + // errMsg(sourcefile, __LINE__)) + end if +#else +#if({DIMS}==1) + allocate(ddata(size(data))) +#elif({DIMS}==2) + allocate(ddata(size(data,1),size(data,2))) +#elif({DIMS}==3) + allocate(ddata(size(data,1),size(data,2),size(data,3))) +#endif + call pio_read_darray(ncid, vardesc, iodesc, ddata, status) + if ( status /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & + // errMsg(sourcefile, __LINE__)) + end if +#if({ITYPE}==TYPEINT) + data = int(ddata) +#else + if ( any(ddata /= 0. .and. ddata /= 1.) )then + call shr_sys_abort(' ERROR: read in bad value(s) for logical data'//errMsg(sourcefile, __LINE__)) + end if + + where( ddata /= 0.) + data = .true. + elsewhere + data = .false. + end where +#endif + deallocate(ddata) +#endif + call pio_seterrorhandling(ncid, oldhandle) + end subroutine read_darray_{TYPE}_from_double_{DIMS} + + !TYPE int,double,logical + !DIMS 1,2,3 + subroutine read_darray_{TYPE}_from_int_{DIMS}(ncid, vardesc, iodesc, varname, data) + class(file_desc_t), intent(inout) :: ncid + type(var_desc_t), intent(inout) :: vardesc + type(io_desc_t), intent(inout) :: iodesc + character(len=*), intent(in) :: varname + {VTYPE}, pointer :: data{DIMSTR} + integer :: status + + integer, allocatable :: idata{DIMSTR} + integer :: oldhandle + + call pio_seterrorhandling(ncid, PIO_BCAST_ERROR, oldhandle) +#if({ITYPE}==TYPEINT) + call pio_read_darray(ncid, vardesc, iodesc, data, status) + if ( status /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & + // errMsg(sourcefile, __LINE__)) + end if +#else +#if({DIMS}==1) + allocate(idata(size(data))) +#elif({DIMS}==2) + allocate(idata(size(data,1),size(data,2))) +#elif({DIMS}==3) + allocate(idata(size(data,1),size(data,2),size(data,3))) +#endif + call pio_read_darray(ncid, vardesc, iodesc, idata, status) + if ( status /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & + // errMsg(sourcefile, __LINE__)) + end if +#if({ITYPE}==TYPEDOUBLE) + data = real(idata, kind=R8) +#else + if ( any(idata /= 0 .and. idata /= 1) )then + call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__)) + end if + where( idata /= 0) + data = .true. + elsewhere + data = .false. + end where +#endif + deallocate(idata) +#endif + call pio_seterrorhandling(ncid, oldhandle) + end subroutine read_darray_{TYPE}_from_int_{DIMS} + + !TYPE int,double,logical + !DIMS 1,2,3 + subroutine read_darray_{TYPE}_from_real_{DIMS}(ncid, vardesc, iodesc, varname, data) + class(file_desc_t), intent(inout) :: ncid + type(var_desc_t), intent(inout) :: vardesc + type(io_desc_t), intent(inout) :: iodesc + character(len=*), intent(in) :: varname + {VTYPE}, pointer :: data{DIMSTR} + + integer :: status + real(r4), allocatable :: rdata{DIMSTR} + integer :: oldhandle + + call pio_seterrorhandling(ncid, PIO_BCAST_ERROR, oldhandle) + +#if({DIMS}==1) + allocate(rdata(size(data))) +#elif({DIMS}==2) + allocate(rdata(size(data,1),size(data,2))) +#elif({DIMS}==3) + allocate(rdata(size(data,1),size(data,2),size(data,3))) +#endif + call pio_read_darray(ncid, vardesc, iodesc, rdata, status) + if ( status /= PIO_NOERR ) then + call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & + // errMsg(sourcefile, __LINE__)) + end if +#if({ITYPE}==TYPEDOUBLE) + data = real(rdata, kind=R8) +#elif({ITYPE}==TYPEINT) + data = int(rdata) +#else + if ( any(rdata /= 0. .and. rdata /= 1.) )then + call shr_sys_abort(' ERROR: read in bad value(s) for logical data'//errMsg(sourcefile, __LINE__)) + end if + where(rdata /= 0.) + data = .true. + elsewhere + data = .false. + end where +#endif + deallocate(rdata) + call pio_seterrorhandling(ncid, oldhandle) + + end subroutine read_darray_{TYPE}_from_real_{DIMS} + !------------------------------------------------------------------------ subroutine scam_field_offsets( ncid, dim1name, vardesc, start, count, & From 4fec1b1bffe26859236ce95a33f0476560808be4 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 8 Oct 2020 10:09:14 -0700 Subject: [PATCH 1543/1973] updating fates tag to latest --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index a776c6a271..436f5ae996 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.40.3_api.13.0.1 +tag = sci.1.42.4_api.14.0.0 required = True [PTCLM] From bfe5830dcd63ebfadcdbe302e26807af650fe7bb Mon Sep 17 00:00:00 2001 From: Danica Date: Thu, 8 Oct 2020 16:10:02 -0600 Subject: [PATCH 1544/1973] Moved comment location and updated calculation of fb as per @billsacks comment --- src/biogeochem/CNVegStructUpdateMod.F90 | 8 +++----- src/biogeochem/SatellitePhenologyMod.F90 | 6 ++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 09f6a2f57a..3fe0b383eb 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -283,18 +283,16 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & end if ! adjust lai and sai for burying by snow. - ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. + ! snow burial fraction for short vegetation (e.g. grasses, crops) changes with vegetation height + ! accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 if (ivt(p) > noveg .and. ivt(p) <= nbrdlf_dcd_brl_shrub ) then ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) else - fb = 1._r8 - max(min(snow_depth(c),0.2_r8),0._r8)/0.2_r8 ! 0.2m is assumed + fb = 1._r8 - (max(min(snow_depth(c),max(0.05,htop(p)*0.8_r8)),0._r8)/(max(0.05,htop(p)*0.8_r8))) !depth of snow required for complete burial of grasses endif - !grass and crop snow burial changes with PFT height - !accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 elai(p) = max(tlai(p)*(1.0_r8 - frac_sno(c)) + tlai(p)*fb*frac_sno(c), 0.0_r8) esai(p) = max(tsai(p)*(1.0_r8 - frac_sno(c)) + tsai(p)*fb*frac_sno(c), 0.0_r8) diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 4e4f6cbc44..5f02642209 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -403,8 +403,8 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & ! are less than 0.05, set equal to zero to prevent numerical ! problems associated with very small lai and sai. - ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. + ! snow burial fraction for short vegetation (e.g. grasses, crops) changes with vegetation height + ! accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 if (patch%itype(p) > noveg .and. patch%itype(p) <= nbrdlf_dcd_brl_shrub ) then ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) @@ -414,8 +414,6 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & endif ! area weight by snow covered fraction - !grass and crop snow burial changes with PFT height - !accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 elai(p) = max(tlai(p)*(1.0_r8 - frac_sno(c)) + tlai(p)*fb*frac_sno(c), 0.0_r8) esai(p) = max(tsai(p)*(1.0_r8 - frac_sno(c)) + tsai(p)*fb*frac_sno(c), 0.0_r8) if (elai(p) < 0.05_r8) elai(p) = 0._r8 From e0528a0a1d69ff43f7033669b1318ec102f37288 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 8 Oct 2020 17:29:02 -0600 Subject: [PATCH 1545/1973] Add comments --- src/biogeochem/CNVegStructUpdateMod.F90 | 4 ++++ src/biogeochem/SatellitePhenologyMod.F90 | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 3fe0b383eb..c55731b25f 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -285,6 +285,10 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & ! adjust lai and sai for burying by snow. ! snow burial fraction for short vegetation (e.g. grasses, crops) changes with vegetation height ! accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 + + ! NOTE: The following snow burial code is duplicated in SatellitePhenologyMod. + ! Changes in one place should be accompanied by similar changes in the other. + if (ivt(p) > noveg .and. ivt(p) <= nbrdlf_dcd_brl_shrub ) then ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 5f02642209..0635d0f1b9 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -406,6 +406,9 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & ! snow burial fraction for short vegetation (e.g. grasses, crops) changes with vegetation height ! accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 + ! NOTE: The following snow burial code is duplicated in CNVegStructUpdateMod. + ! Changes in one place should be accompanied by similar changes in the other. + if (patch%itype(p) > noveg .and. patch%itype(p) <= nbrdlf_dcd_brl_shrub ) then ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) From 23cd88d68a194514f6efee9398d46a82ed50d1ea Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 8 Oct 2020 17:30:13 -0600 Subject: [PATCH 1546/1973] Fix indentation --- src/biogeophys/PhotosynthesisMod.F90 | 76 ++++++++++++++-------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 056e359e63..17edc045f5 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -4114,55 +4114,55 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b end if if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then - if (an_sun(p,iv) >= 0._r8) then - term = 1.6_r8 * an_sun(p,iv) / (cs_sun / forc_pbot(c) * 1.e06_r8) - aquad = 1.0_r8 - bquad = -(2.0 * (medlynintercept(patch%itype(p))*1.e-06_r8 + term) + (medlynslope(patch%itype(p)) * term)**2 / & + if (an_sun(p,iv) >= 0._r8) then + term = 1.6_r8 * an_sun(p,iv) / (cs_sun / forc_pbot(c) * 1.e06_r8) + aquad = 1.0_r8 + bquad = -(2.0 * (medlynintercept(patch%itype(p))*1.e-06_r8 + term) + (medlynslope(patch%itype(p)) * term)**2 / & (gb_mol*1.e-06_r8 * rh_can)) - cquad = medlynintercept(patch%itype(p))*medlynintercept(patch%itype(p))*1.e-12_r8 + & + cquad = medlynintercept(patch%itype(p))*medlynintercept(patch%itype(p))*1.e-12_r8 + & (2.0*medlynintercept(patch%itype(p))*1.e-06_r8 + term * & (1.0 - medlynslope(patch%itype(p))* medlynslope(patch%itype(p)) / rh_can)) * term - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol_sun = max(r1,r2) * 1.e06_r8 - end if - + call quadratic (aquad, bquad, cquad, r1, r2) + gs_mol_sun = max(r1,r2) * 1.e06_r8 + end if + ! Shaded - if (an_sha(p,iv) >= 0._r8) then - cs_sha = cair - 1.4_r8/gb_mol * an_sha(p,iv) * forc_pbot(c) - cs_sha = max(cs_sha,10.e-06_r8) - - term = 1.6_r8 * an_sha(p,iv) / (cs_sha / forc_pbot(c) * 1.e06_r8) - aquad = 1.0_r8 - bquad = -(2.0 * (medlynintercept(patch%itype(p))*1.e-06_r8 + term) + (medlynslope(patch%itype(p)) * term)**2 / & + if (an_sha(p,iv) >= 0._r8) then + cs_sha = cair - 1.4_r8/gb_mol * an_sha(p,iv) * forc_pbot(c) + cs_sha = max(cs_sha,10.e-06_r8) + + term = 1.6_r8 * an_sha(p,iv) / (cs_sha / forc_pbot(c) * 1.e06_r8) + aquad = 1.0_r8 + bquad = -(2.0 * (medlynintercept(patch%itype(p))*1.e-06_r8 + term) + (medlynslope(patch%itype(p)) * term)**2 / & (gb_mol*1.e-06_r8 * rh_can)) - cquad = medlynintercept(patch%itype(p))*medlynintercept(patch%itype(p))*1.e-12_r8 + & + cquad = medlynintercept(patch%itype(p))*medlynintercept(patch%itype(p))*1.e-12_r8 + & (2.0*medlynintercept(patch%itype(p))*1.e-06_r8 + term * (1.0 - medlynslope(patch%itype(p))* & medlynslope(patch%itype(p)) / rh_can)) * term - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol_sha = max(r1,r2)* 1.e06_r8 - end if + call quadratic (aquad, bquad, cquad, r1, r2) + gs_mol_sha = max(r1,r2)* 1.e06_r8 + end if else if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - if (an_sun(p,iv) >= 0._r8) then - aquad = cs_sun - bquad = cs_sun*(gb_mol - max(bsun*bbb(p),1._r8)) - mbb(p)*an_sun(p,iv)*forc_pbot(c) - cquad = -gb_mol*(cs_sun*max(bsun*bbb(p),1._r8) + mbb(p)*an_sun(p,iv)*forc_pbot(c)*rh_can) - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol_sun = max(r1,r2) - end if - + if (an_sun(p,iv) >= 0._r8) then + aquad = cs_sun + bquad = cs_sun*(gb_mol - max(bsun*bbb(p),1._r8)) - mbb(p)*an_sun(p,iv)*forc_pbot(c) + cquad = -gb_mol*(cs_sun*max(bsun*bbb(p),1._r8) + mbb(p)*an_sun(p,iv)*forc_pbot(c)*rh_can) + call quadratic (aquad, bquad, cquad, r1, r2) + gs_mol_sun = max(r1,r2) + end if + ! Shaded - if (an_sha(p,iv) >= 0._r8) then - cs_sha = cair - 1.4_r8/gb_mol * an_sha(p,iv) * forc_pbot(c) - cs_sha = max(cs_sha,10.e-06_r8) - - aquad = cs_sha - bquad = cs_sha*(gb_mol - max(bsha*bbb(p),1._r8)) - mbb(p)*an_sha(p,iv)*forc_pbot(c) - cquad = -gb_mol*(cs_sha*max(bsha*bbb(p),1._r8) + mbb(p)*an_sha(p,iv)*forc_pbot(c)*rh_can) - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol_sha = max(r1,r2) - end if + if (an_sha(p,iv) >= 0._r8) then + cs_sha = cair - 1.4_r8/gb_mol * an_sha(p,iv) * forc_pbot(c) + cs_sha = max(cs_sha,10.e-06_r8) + + aquad = cs_sha + bquad = cs_sha*(gb_mol - max(bsha*bbb(p),1._r8)) - mbb(p)*an_sha(p,iv)*forc_pbot(c) + cquad = -gb_mol*(cs_sha*max(bsha*bbb(p),1._r8) + mbb(p)*an_sha(p,iv)*forc_pbot(c)*rh_can) + call quadratic (aquad, bquad, cquad, r1, r2) + gs_mol_sha = max(r1,r2) + end if end if ! Derive new estimate for cisun,cisha From c190810db316039499ea5f044ea5fd0b42d76171 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 8 Oct 2020 19:02:49 -0600 Subject: [PATCH 1547/1973] removing maxpatch_pft to address #881 --- bld/CLMBuildNamelist.pm | 18 ------------------ .../namelist_definition_ctsm.xml | 5 ----- bld/unit_testers/build-namelist_test.pl | 5 ----- src/main/clm_varpar.F90 | 1 - src/main/controlMod.F90 | 11 +---------- 5 files changed, 1 insertion(+), 39 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 3dea32a937..eb287df576 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1008,24 +1008,6 @@ sub setup_cmdl_maxpft { } $nl_flags->{'maxpft'} = $val; - $var = "maxpatch_pft"; - my $group = $definition->get_group_name($var); - if ( ! defined($nl->get_variable_value($group, $var)) ) { - $val = $nl_flags->{'maxpft'}; - $nl->set_variable_value($group, $var, $val); - } - $val = $nl->get_variable_value($group, $var); - my @valid_values = ($maxpatchpft{'.true.'}, $maxpatchpft{'.false.'} ); - my $found = 0; - foreach my $valid_val ( @valid_values ) { - if ( $val == $valid_val ) { - $found = 1; - last; - } - } - if ( ! $found ) { - $log->warning("$var has a value ($val) that is normally NOT valid. Normal valid values are: @valid_values"); - } } #------------------------------------------------------------------------------- diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 8e57bc98e4..0f76c2a388 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1082,11 +1082,6 @@ Toggle for vancouver specific logic. Toggle for mexico city specific logic. - -Max number of plant functional types in naturally vegetated landunit. - - diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index db441b045c..0fee84f11c 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -1033,11 +1033,6 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, - "maxpft_wrong" =>{ options=>"-envxml_dir . -bgc cn", - namelst=>"maxpatch_pft=19", - GLC_TWO_WAY_COUPLING=>"FALSE", - phys=>"clm5_0", - }, "soilm_stream w transient" =>{ options=>"-res 0.9x1.25 -envxml_dir . -use_case 20thC_transient", namelst=>"use_soil_moisture_streams=T,soilm_tintalgo='linear'", GLC_TWO_WAY_COUPLING=>"FALSE", diff --git a/src/main/clm_varpar.F90 b/src/main/clm_varpar.F90 index 6d0e7b6bd6..8f7677a6f3 100644 --- a/src/main/clm_varpar.F90 +++ b/src/main/clm_varpar.F90 @@ -58,7 +58,6 @@ module clm_varpar integer, public :: maxveg ! # of pfts + cfts integer, public :: maxpatch_urb= 5 ! max number of urban patches (columns) in urban landunit - integer, public :: maxpatch_pft ! obsolete: max number of plant functional types in naturally vegetated landunit (namelist setting) integer, public :: maxsoil_patches ! # of pfts + cfts + bare ground; replaces maxpatch_pft, which is obsolete ! constants for decomposition cascade diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 56369f076f..cf4f94c34b 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -19,7 +19,7 @@ module controlMod use spmdMod , only: MPI_CHARACTER, MPI_INTEGER, MPI_LOGICAL, MPI_REAL8 use decompMod , only: clump_pproc use clm_varcon , only: h2osno_max - use clm_varpar , only: maxpatch_pft, maxpatch_glcmec, numrad, nlevsno + use clm_varpar , only: maxpatch_glcmec, numrad, nlevsno use fileutils , only: getavu, relavu, get_filename use histFileMod , only: max_tapes, max_namlen use histFileMod , only: hist_empty_htapes, hist_dov2xy, hist_avgflag_pertape, hist_type1d_pertape @@ -250,10 +250,6 @@ subroutine control_init(dtime) ! All old cpp-ifdefs are below and have been converted to namelist variables - ! maxpatch_pft is obsolete and has been replaced with maxsoil_patches - ! maxpatch_pft will eventually be removed from the perl and the namelist - namelist /clm_inparm/ maxpatch_pft - ! Number of dominant pfts and landunits. Enhance ctsm performance by ! reducing the number of active pfts to n_dom_pfts and ! active landunits to n_dom_landunits. @@ -667,16 +663,11 @@ subroutine control_spmd() call mpi_bcast(run_zero_weight_urban, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast(all_active, 1, MPI_LOGICAL, 0, mpicom, ier) - ! maxpatch_pft is obsolete and has been replaced with maxsoil_patches - ! maxpatch_pft will eventually be removed from the perl and the namelist - call mpi_bcast(maxpatch_pft, 1, MPI_LOGICAL, 0, mpicom, ier) - ! Number of dominant pfts and landunits. Enhance ctsm performance by ! reducing the number of active pfts to n_dom_pfts and ! active landunits to n_dom_landunits. ! Also choose to collapse the urban landunits to the dominant urban ! landunit by setting collapse_urban = .true. - ! slevis: maxpatch_pft is MPI_LOGICAL? Doesn't matter since obsolete. call mpi_bcast(n_dom_pfts, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast(n_dom_landunits, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast(collapse_urban, 1, MPI_LOGICAL, 0, mpicom, ier) From f752cf8efa4a25afe855b8bb1c200541a9697a4a Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 8 Oct 2020 19:18:07 -0600 Subject: [PATCH 1548/1973] removing the dublicated lines for #1020 --- bld/namelist_files/namelist_defaults_ctsm.xml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 444aecf895..933f995526 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1529,17 +1529,6 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/prescribed_data/LFMIP-pdLC-SST.H2OSOI.0.9x1.25.20levsoi.natveg.climo1980-2014.MONS_c190709.nc -linear - - - -.false. -1997 -1997 -1997 - -lnd/clm2/prescribed_data/LFMIP-pdLC-SST.H2OSOI.0.9x1.25.20levsoi.natveg.1980-2014.MONS_climo.c190716.nc - linear 0 From 09dc9963b5aa0b40f12b94843377a45de67f24cb Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 8 Oct 2020 19:21:55 -0600 Subject: [PATCH 1549/1973] removing the test def lines for #1020 --- .../namelist_definition_ctsm.xml | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 0f76c2a388..f9ecbbe45a 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1655,37 +1655,6 @@ Filename of input stream data for prescribed soil moisture streams data Time interpolation method to use for prescribed soil moisture streams data - - -Toggle to turn on use of input prescribed soil moisture streams rather than have CLM prognose it (EXPERIMENTAL) - - - -First year to loop over for prescribed soil moisture streams data - - - -Last year to loop over for prescribed soil moisture streams data - - - -Simulation year that aligns with stream_year_first_soilm value - - - -Filename of input stream data for prescribed soil moisture streams data - - - -Time interpolation method to use for prescribed soil moisture streams data - - Offset in time coordinate for soil moisture streams (sec) From 3c99424b38564aec43d3f801e6c8586a47f94aba Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 9 Oct 2020 14:10:59 -0600 Subject: [PATCH 1550/1973] Remove unused local variables --- src/main/ncdio_pio.F90.in | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 951c2b2b43..4ebdb73033 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1612,8 +1612,6 @@ contains logical :: varpresent ! if true, variable is on tape integer :: xtype ! type of var in file integer , pointer :: idata(:) ! Temporary integer data to send to file - real(r4) , pointer :: fdata(:) ! Temporary double data to send to file - real(r8) , pointer :: ddata(:) ! Temporary double data to send to file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc integer :: oldhandle ! previous value of pio_error_handle @@ -1807,9 +1805,6 @@ contains integer :: lb1,lb2 integer :: ub1,ub2 integer :: xtype ! netcdf type of variable on file - integer , pointer :: idata(:,:) ! Temporary integer data to read from file - real(r4) , pointer :: fdata(:,:) ! Temporary double data to read from file - real(r8) , pointer :: ddata(:,:) ! Temporary double data to read from file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc @@ -2060,9 +2055,6 @@ contains integer :: count(5) ! netcdf count index integer :: xtype ! netcdf type of variable on file logical :: varpresent ! if true, variable is on tape - integer , pointer :: idata(:,:,:) ! Temporary integer data to read from file - real(r4) , pointer :: fdata(:,:,:) ! Temporary double data to read from file - real(r8) , pointer :: ddata(:,:,:) ! Temporary double data to read from file type(iodesc_plus_type) , pointer :: iodesc_plus type(var_desc_t) :: vardesc character(len=*),parameter :: subname='ncd_io_3d_{TYPE}' ! subroutine name @@ -2178,7 +2170,7 @@ contains end subroutine ncd_io_3d_{TYPE} - + !------------------------------------------------------------------------ !TYPE int,double,logical !DIMS 1,2,3 subroutine read_darray_{TYPE}_from_double_{DIMS}(ncid, vardesc, iodesc, varname, data) @@ -2230,6 +2222,7 @@ contains call pio_seterrorhandling(ncid, oldhandle) end subroutine read_darray_{TYPE}_from_double_{DIMS} + !------------------------------------------------------------------------ !TYPE int,double,logical !DIMS 1,2,3 subroutine read_darray_{TYPE}_from_int_{DIMS}(ncid, vardesc, iodesc, varname, data) @@ -2280,6 +2273,7 @@ contains call pio_seterrorhandling(ncid, oldhandle) end subroutine read_darray_{TYPE}_from_int_{DIMS} + !------------------------------------------------------------------------ !TYPE int,double,logical !DIMS 1,2,3 subroutine read_darray_{TYPE}_from_real_{DIMS}(ncid, vardesc, iodesc, varname, data) From acf90766cf6bf75b7e2d4609d90e3e0745214f9a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 9 Oct 2020 14:29:44 -0600 Subject: [PATCH 1551/1973] Minor cleanup --- src/main/ncdio_pio.F90.in | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 4ebdb73033..eeeb2c3095 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -2206,16 +2206,18 @@ contains end if #if({ITYPE}==TYPEINT) data = int(ddata) -#else - if ( any(ddata /= 0. .and. ddata /= 1.) )then +#elif({ITYPE}==TYPELOGICAL) + if ( any(ddata /= 0._r8 .and. ddata /= 1._r8) )then call shr_sys_abort(' ERROR: read in bad value(s) for logical data'//errMsg(sourcefile, __LINE__)) end if - where( ddata /= 0.) - data = .true. - elsewhere - data = .false. + where( ddata == 1._r8) + data = .true. + elsewhere + data = .false. end where +#else + call shr_sys_abort(' ERROR: unhandled type'//errMsg(sourcefile, __LINE__)) #endif deallocate(ddata) #endif @@ -2258,15 +2260,17 @@ contains end if #if({ITYPE}==TYPEDOUBLE) data = real(idata, kind=R8) -#else +#elif({ITYPE}==TYPELOGICAL) if ( any(idata /= 0 .and. idata /= 1) )then call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__)) end if - where( idata /= 0) - data = .true. - elsewhere - data = .false. + where( idata == 1) + data = .true. + elsewhere + data = .false. end where +#else + call shr_sys_abort(' ERROR: unhandled type'//errMsg(sourcefile, __LINE__)) #endif deallocate(idata) #endif @@ -2305,15 +2309,17 @@ contains data = real(rdata, kind=R8) #elif({ITYPE}==TYPEINT) data = int(rdata) -#else +#elif({ITYPE}==TYPELOGICAL) if ( any(rdata /= 0. .and. rdata /= 1.) )then call shr_sys_abort(' ERROR: read in bad value(s) for logical data'//errMsg(sourcefile, __LINE__)) end if - where(rdata /= 0.) + where(rdata == 1.) data = .true. elsewhere data = .false. end where +#else + call shr_sys_abort(' ERROR: unhandled type'//errMsg(sourcefile, __LINE__)) #endif deallocate(rdata) call pio_seterrorhandling(ncid, oldhandle) From 1e7122395def5ff0e24f2a9277c464ddc10e5b9a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 9 Oct 2020 16:05:07 -0600 Subject: [PATCH 1552/1973] Use genf90 to simplify allocations --- src/main/ncdio_pio.F90.in | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index eeeb2c3095..94547701bb 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -2192,13 +2192,7 @@ contains // errMsg(sourcefile, __LINE__)) end if #else -#if({DIMS}==1) - allocate(ddata(size(data))) -#elif({DIMS}==2) - allocate(ddata(size(data,1),size(data,2))) -#elif({DIMS}==3) - allocate(ddata(size(data,1),size(data,2),size(data,3))) -#endif + allocate(ddata({REPEAT: size(data,#)})) call pio_read_darray(ncid, vardesc, iodesc, ddata, status) if ( status /= PIO_NOERR ) then call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & @@ -2246,13 +2240,7 @@ contains // errMsg(sourcefile, __LINE__)) end if #else -#if({DIMS}==1) - allocate(idata(size(data))) -#elif({DIMS}==2) - allocate(idata(size(data,1),size(data,2))) -#elif({DIMS}==3) - allocate(idata(size(data,1),size(data,2),size(data,3))) -#endif + allocate(idata({REPEAT: size(data,#)})) call pio_read_darray(ncid, vardesc, iodesc, idata, status) if ( status /= PIO_NOERR ) then call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & @@ -2293,13 +2281,7 @@ contains call pio_seterrorhandling(ncid, PIO_BCAST_ERROR, oldhandle) -#if({DIMS}==1) - allocate(rdata(size(data))) -#elif({DIMS}==2) - allocate(rdata(size(data,1),size(data,2))) -#elif({DIMS}==3) - allocate(rdata(size(data,1),size(data,2),size(data,3))) -#endif + allocate(rdata({REPEAT: size(data,#)})) call pio_read_darray(ncid, vardesc, iodesc, rdata, status) if ( status /= PIO_NOERR ) then call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & From 81c00100dfb5b23233d55f43853c70deaa584bb7 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 12 Oct 2020 20:38:01 -0600 Subject: [PATCH 1553/1973] replaced global unity mask on mesh with land mask --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index eb9ebcab8a..8e91d21949 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -366,6 +366,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, pointer :: gindex(:) ! global index space for land and ocean points integer, pointer :: gindex_lnd(:) ! global index space for just land points integer, pointer :: gindex_ocn(:) ! global index space for just ocean points + integer, pointer :: mask(:) ! local land/ocean mask character(ESMF_MAXSTR) :: cvalue ! config data integer :: nlnd, nocn ! local size ofarrays integer :: g,n ! indices @@ -589,11 +590,14 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! create a global index that includes both land and ocean points nocn = size(gindex_ocn) allocate(gindex(nlnd + nocn)) + allocate(mask(nlnd + nocn)) do n = 1,nlnd+nocn if (n <= nlnd) then gindex(n) = gindex_lnd(n) + mask(n) = 1 else gindex(n) = gindex_ocn(n-nlnd) + mask(n) = 0 end if end do @@ -663,6 +667,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) mesh = ESMF_MeshCreate(lgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! reset the global mask (which is 1) to the land/ocean mask + call ESMF_MeshSet(mesh, elementMask=mask, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + deallocate(mask) + else ! read in the mesh from the file From 04400d63b4a7a853e3aefa82f50ec724a0d70c6a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 13 Oct 2020 12:12:36 -0600 Subject: [PATCH 1554/1973] Introduce subroutine for converting numeric arrays to logical, and tests --- src/main/ncdio_pio.F90.in | 29 +----- src/utils/array_utils.F90.in | 43 ++++++++- .../test/array_utils_test/CMakeLists.txt | 4 +- .../test_convert_to_logical.pf | 94 +++++++++++++++++++ 4 files changed, 141 insertions(+), 29 deletions(-) create mode 100644 src/utils/test/array_utils_test/test_convert_to_logical.pf diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 94547701bb..e2a1e59a86 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -34,6 +34,7 @@ module ncdio_pio use pio , only : pio_setframe, pio_unlimited, pio_write, pio_write_darray, var_desc_t use pio , only : pio_iotask_rank, PIO_REARR_SUBSET, PIO_REARR_BOX use pio , only : pio_inq_vartype, pio_real + use array_utils , only : convert_to_logical ! ! !PUBLIC TYPES: implicit none @@ -2201,15 +2202,7 @@ contains #if({ITYPE}==TYPEINT) data = int(ddata) #elif({ITYPE}==TYPELOGICAL) - if ( any(ddata /= 0._r8 .and. ddata /= 1._r8) )then - call shr_sys_abort(' ERROR: read in bad value(s) for logical data'//errMsg(sourcefile, __LINE__)) - end if - - where( ddata == 1._r8) - data = .true. - elsewhere - data = .false. - end where + call convert_to_logical(ddata, data) #else call shr_sys_abort(' ERROR: unhandled type'//errMsg(sourcefile, __LINE__)) #endif @@ -2249,14 +2242,7 @@ contains #if({ITYPE}==TYPEDOUBLE) data = real(idata, kind=R8) #elif({ITYPE}==TYPELOGICAL) - if ( any(idata /= 0 .and. idata /= 1) )then - call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__)) - end if - where( idata == 1) - data = .true. - elsewhere - data = .false. - end where + call convert_to_logical(idata, data) #else call shr_sys_abort(' ERROR: unhandled type'//errMsg(sourcefile, __LINE__)) #endif @@ -2292,14 +2278,7 @@ contains #elif({ITYPE}==TYPEINT) data = int(rdata) #elif({ITYPE}==TYPELOGICAL) - if ( any(rdata /= 0. .and. rdata /= 1.) )then - call shr_sys_abort(' ERROR: read in bad value(s) for logical data'//errMsg(sourcefile, __LINE__)) - end if - where(rdata == 1.) - data = .true. - elsewhere - data = .false. - end where + call convert_to_logical(rdata, data) #else call shr_sys_abort(' ERROR: unhandled type'//errMsg(sourcefile, __LINE__)) #endif diff --git a/src/utils/array_utils.F90.in b/src/utils/array_utils.F90.in index 1152e9bc7c..4e20b602d5 100644 --- a/src/utils/array_utils.F90.in +++ b/src/utils/array_utils.F90.in @@ -12,8 +12,9 @@ module array_utils ! ! !USES: #include "shr_assert.h" - use shr_kind_mod, only : r8 => shr_kind_r8, i4=>shr_kind_i4 - use abortutils , only : endrun + use shr_kind_mod, only : r8 => shr_kind_r8, r4 => shr_kind_r4, i4=>shr_kind_i4 + use shr_log_mod , only : errMsg => shr_log_errMsg + use shr_sys_mod , only : shr_sys_abort implicit none private @@ -22,14 +23,23 @@ module array_utils ! Public routines public :: find_k_max_indices ! returns the indices of the maximum k values in data, in sorted order + public :: convert_to_logical ! convert a numeric array to logical array public :: transpose_wrapper ! wrap the intrinsic transpose function, first allocating the destination array public :: pack_wrapper ! wrap the intrinsic pack function, first allocating the destination array + interface convert_to_logical + !DIMS 1,2,3 + !TYPE double,real,int + module procedure convert_to_logical_{DIMS}d_{TYPE} + end interface convert_to_logical + interface transpose_wrapper !TYPE int,double module procedure transpose_wrapper_{TYPE} end interface transpose_wrapper + character(len=*), parameter, private :: sourcefile = & + __FILE__ contains !----------------------------------------------------------------------- @@ -60,7 +70,7 @@ contains SHR_ASSERT_FL((size(max_indices) == k), subname, __LINE__) if (k < 1 .or. k > size(data)) then - call endrun(subname//': must have 1 <= k <= size(data)') + call shr_sys_abort(subname//': must have 1 <= k <= size(data)') end if max_indices(:) = lb - 1 @@ -92,6 +102,33 @@ contains end subroutine find_k_max_indices + !----------------------------------------------------------------------- + !DIMS 1,2,3 + !TYPE double,real,int + subroutine convert_to_logical_{DIMS}d_{TYPE}(data_numeric, data_logical) + ! + ! !DESCRIPTION: + ! Convert a numeric variable to logical + ! + ! !ARGUMENTS: + {VTYPE}, intent(in) :: data_numeric{DIMSTR} + logical, intent(out) :: data_logical{DIMSTR} + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'convert_to_logical_{DIMS}d_{TYPE}' + !----------------------------------------------------------------------- + + if (any(data_numeric /= 0 .and. data_numeric /= 1)) then + call shr_sys_abort('convert_to_logical: bad value(s) for logical data') + end if + + where (data_numeric == 1) + data_logical = .true. + elsewhere + data_logical = .false. + end where + end subroutine convert_to_logical_{DIMS}d_{TYPE} !----------------------------------------------------------------------- !TYPE int,double diff --git a/src/utils/test/array_utils_test/CMakeLists.txt b/src/utils/test/array_utils_test/CMakeLists.txt index 46825df90a..11cbd47e5a 100644 --- a/src/utils/test/array_utils_test/CMakeLists.txt +++ b/src/utils/test/array_utils_test/CMakeLists.txt @@ -1,5 +1,7 @@ set (pfunit_sources - test_find_k_max_indices.pf) + test_find_k_max_indices.pf + test_convert_to_logical.pf + ) set (extra_sources ) diff --git a/src/utils/test/array_utils_test/test_convert_to_logical.pf b/src/utils/test/array_utils_test/test_convert_to_logical.pf new file mode 100644 index 0000000000..6e726d443a --- /dev/null +++ b/src/utils/test/array_utils_test/test_convert_to_logical.pf @@ -0,0 +1,94 @@ +module test_convert_to_logical + + ! Tests of array_utils: convert_to_logical + + use pfunit_mod + use array_utils + use shr_kind_mod , only : r8 => shr_kind_r8 + use unittestUtils, only : endrun_msg + + implicit none + + @TestCase + type, extends(TestCase) :: TestCTL + character(len=:), allocatable :: expected_msg ! expected error message for failures + contains + procedure :: setUp + procedure :: tearDown + end type TestCTL + + real(r8), parameter :: tol = 1.e-13_r8 + +contains + + subroutine setUp(this) + class(TestCTL), intent(inout) :: this + + this%expected_msg = endrun_msg('convert_to_logical: bad value(s) for logical data') + end subroutine setUp + + subroutine tearDown(this) + class(TestCTL), intent(inout) :: this + end subroutine tearDown + + @Test + subroutine test_convertToLogical_2dint(this) + class(TestCTL), intent(inout) :: this + integer :: my_int(2,3) + logical :: my_log(2,3) + logical :: expected(2,3) + + my_int = reshape([0,1,0,1,0,1], [2,3]) + expected = reshape([.false., .true., .false., .true., .false., .true.], [2, 3]) + + call convert_to_logical(my_int, my_log) + + ! assertEquivalent only handles 1-d arrays, so we need to reshape the 2-d arrays to + ! be 1-d for this comparison + @assertEquivalent(reshape(expected, [6]), reshape(my_log, [6])) + end subroutine test_convertToLogical_2dint + + @Test + subroutine test_convertToLogical_2ddouble(this) + class(TestCTL), intent(inout) :: this + real(r8) :: my_double(2,3) + logical :: my_log(2,3) + logical :: expected(2,3) + + my_double = reshape([0.,1.,0.,1.,0.,1.], [2,3]) + expected = reshape([.false., .true., .false., .true., .false., .true.], [2, 3]) + + call convert_to_logical(my_double, my_log) + + ! assertEquivalent only handles 1-d arrays, so we need to reshape the 2-d arrays to + ! be 1-d for this comparison + @assertEquivalent(reshape(expected, [6]), reshape(my_log, [6])) + end subroutine test_convertToLogical_2ddouble + + @Test + subroutine test_convertToLogical_2dint_fails(this) + class(TestCTL), intent(inout) :: this + integer :: my_int(2,3) + logical :: my_log(2,3) + + my_int = reshape([0,1,2,1,0,1], [2,3]) + + call convert_to_logical(my_int, my_log) + + @assertExceptionRaised(this%expected_msg) + end subroutine test_convertToLogical_2dint_fails + + @Test + subroutine test_convertToLogical_2ddouble_fails(this) + class(TestCTL), intent(inout) :: this + real(r8) :: my_double(2,3) + logical :: my_log(2,3) + + my_double = reshape([0.,1.,0.1,1.,0.,1.], [2,3]) + + call convert_to_logical(my_double, my_log) + + @assertExceptionRaised(this%expected_msg) + end subroutine test_convertToLogical_2ddouble_fails + +end module test_convert_to_logical From 5399fd33d284d28333aa40b505470d302abd3b9a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 13 Oct 2020 16:31:16 -0600 Subject: [PATCH 1555/1973] Add hooks for run_self_tests --- bld/CLMBuildNamelist.pm | 12 ++++++ bld/namelist_files/namelist_defaults_ctsm.xml | 2 + .../namelist_definition_ctsm.xml | 6 +++ cime_config/buildlib | 1 + cime_config/testdefs/testlist_clm.xml | 13 +++++++ .../testmods_dirs/clm/run_self_tests/README | 5 +++ .../clm/run_self_tests/shell_commands | 3 ++ .../clm/run_self_tests/user_nl_clm | 1 + src/main/clm_initializeMod.F90 | 9 ++++- src/main/clm_varctl.F90 | 3 ++ src/main/controlMod.F90 | 7 +++- src/self_tests/README | 8 ++++ src/self_tests/SelfTestDriver.F90 | 37 +++++++++++++++++++ 13 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/run_self_tests/README create mode 100644 cime_config/testdefs/testmods_dirs/clm/run_self_tests/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm create mode 100644 src/self_tests/README create mode 100644 src/self_tests/SelfTestDriver.F90 diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 3dea32a937..1b49b9f5dd 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1514,6 +1514,7 @@ sub process_namelist_inline_logic { setup_logic_supplemental_nitrogen($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_fates($opts, $nl_flags, $definition, $defaults, $nl); + setup_logic_misc($opts, $nl_flags, $definition, $defaults, $nl); ######################################### # namelist group: atm2lnd_inparm @@ -3901,6 +3902,17 @@ sub setup_logic_fates { #------------------------------------------------------------------------------- +sub setup_logic_misc { + # + # Set some misc options + # + my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'run_self_tests'); +} + +#------------------------------------------------------------------------------- + sub write_output_files { my ($opts, $nl_flags, $defaults, $nl) = @_; diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 0e4cb6857d..bda2953c68 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -57,6 +57,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 1 0 +.false. + .true. + +Whether to run self-tests as part of the model run. This is typically +only used in automated tests. + + diff --git a/cime_config/buildlib b/cime_config/buildlib index c0750d0e9c..fe5c20375a 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -115,6 +115,7 @@ def _main_func(): os.path.join(lnd_root,"src","soilbiogeochem"), os.path.join(lnd_root,"src","dyn_subgrid"), os.path.join(lnd_root,"src","init_interp"), + os.path.join(lnd_root,"src","self_tests"), os.path.join(lnd_root,"src","fates"), os.path.join(lnd_root,"src","fates","main"), os.path.join(lnd_root,"src","fates","biogeophys"), diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 2150d73bc8..0f6322cb34 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -2331,6 +2331,19 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + + + + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/run_self_tests/README b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/README new file mode 100644 index 0000000000..340cd43cc1 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/README @@ -0,0 +1,5 @@ +The purpose of this testmod directory is to trigger the run_self_tests +option. This runs a suite of unit/integration tests. + +We use cold start so that we can get through initialization faster, +since how we initialize the model is unimportant for these self-tests. diff --git a/cime_config/testdefs/testmods_dirs/clm/run_self_tests/shell_commands b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/shell_commands new file mode 100644 index 0000000000..a66f52f6fd --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/shell_commands @@ -0,0 +1,3 @@ +#!/bin/bash +./xmlchange CLM_FORCE_COLDSTART="on" + diff --git a/cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm new file mode 100644 index 0000000000..74ad5186dd --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm @@ -0,0 +1 @@ +run_self_tests = .true. diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 912bbb293b..21c57837d7 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -13,7 +13,7 @@ module clm_initializeMod use clm_varctl , only : is_cold_start, is_interpolated_start use clm_varctl , only : iulog use clm_varctl , only : use_lch4, use_cn, use_cndv, use_c13, use_c14, use_fates - use clm_varctl , only : use_soil_moisture_streams + use clm_varctl , only : use_soil_moisture_streams, run_self_tests use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft, irrig_method, wt_glc_mec, topo_glc_mec, haslake use perf_mod , only : t_startf, t_stopf use readParamsMod , only : readParameters @@ -26,6 +26,7 @@ module clm_initializeMod use filterMod , only : allocFilters, filter, filter_inactive_and_active use FatesInterfaceMod, only : set_fates_global_elements use dynSubgridControlMod, only: dynSubgridControl_init, get_reset_dynbal_baselines + use SelfTestDriver, only : self_test_driver use clm_instMod use SoilMoistureStreamMod, only : PrescribedSoilMoistureInit @@ -261,6 +262,12 @@ subroutine initialize1(dtime, gindex_ocn) call ch4conrd() end if + ! Run self-tests if requested + + if (run_self_tests) then + call self_test_driver + end if + ! Deallocate surface grid dynamic memory for variables that aren't needed elsewhere. ! Some things are kept until the end of initialize2; urban_valid is kept through the ! end of the run for error checking. diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 0b798b983e..a011118ca4 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -53,6 +53,9 @@ module clm_varctl !true => no valid land points -- do NOT run logical, public :: noland = .false. + ! true => run self_tests + logical, public :: run_self_tests = .false. + ! Hostname of machine running on character(len=256), public :: hostname = ' ' diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 56369f076f..6c078f3105 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -139,7 +139,7 @@ subroutine control_init(dtime) ! CLM namelist settings - namelist /clm_inparm / & + namelist /clm_inparm/ & fatmlndfrc, finidat, nrevsn, & finidat_interp_dest, & use_init_interp, compname @@ -202,7 +202,7 @@ subroutine control_init(dtime) albice, soil_layerstruct_predefined, soil_layerstruct_userdefined, & soil_layerstruct_userdefined_nlevsoi, use_subgrid_fluxes, snow_cover_fraction_method, & irrigate, run_zero_weight_urban, all_active, & - crop_fsat_equals_zero + crop_fsat_equals_zero, run_self_tests ! vertical soil mixing variables namelist /clm_inparm/ & @@ -660,6 +660,9 @@ subroutine control_spmd() ! Crop saturated excess runoff call mpi_bcast(crop_fsat_equals_zero, 1, MPI_LOGICAL, 0, mpicom, ier) + ! Whether to run self-tests + call mpi_bcast(run_self_tests, 1, MPI_LOGICAL, 0, mpicom, ier) + ! Landunit generation call mpi_bcast(create_crop_landunit, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/self_tests/README b/src/self_tests/README new file mode 100644 index 0000000000..bbd4164375 --- /dev/null +++ b/src/self_tests/README @@ -0,0 +1,8 @@ +This directory contains code that is invoked only when running with +self-tests enabled. This self-test code is similar to unit tests, but is +run in the context of a full model run because it covers code that is +difficult to get into a unit test harness. As such, the tests here may +be viewed more as integration tests than unit tests. An example is tests +that cover the PIO interface, since these require building and +initializing the PIO system (which is difficult to do in our unit +testing framework). diff --git a/src/self_tests/SelfTestDriver.F90 b/src/self_tests/SelfTestDriver.F90 new file mode 100644 index 0000000000..8fde966921 --- /dev/null +++ b/src/self_tests/SelfTestDriver.F90 @@ -0,0 +1,37 @@ +module SelfTestDriver + + ! ------------------------------------------------------------------------ + ! !DESCRIPTION: + ! This module contains a top-level driver to the self-test code. + ! + ! See the README file in this directory for a high-level overview of these self-tests. + + implicit none + private + save + + ! Public routines + + public :: self_test_driver + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + +contains + + !----------------------------------------------------------------------- + subroutine self_test_driver + ! + ! !DESCRIPTION: + ! Top-level driver to the self-test code + ! + ! !ARGUMENTS: + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'self_test_driver' + !----------------------------------------------------------------------- + + end subroutine self_test_driver + +end module SelfTestDriver From 819ccd5b326627ba3d2d95e1298021b560a6675f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 15 Oct 2020 13:22:30 -0600 Subject: [PATCH 1556/1973] Add self-tests of ncdio_pio This barely scratches the surface of what should be tested in this module, but it at least covers the new code and a bit more. --- src/CMakeLists.txt | 2 + src/main/clm_initializeMod.F90 | 2 +- src/main/ncdio_pio.F90.in | 23 + src/self_tests/Assertions.F90.in | 201 ++++++++ src/self_tests/CMakeLists.txt | 14 + src/self_tests/SelfTestDriver.F90 | 8 +- src/self_tests/TestNcdioPio.F90 | 447 ++++++++++++++++++ src/self_tests/test/CMakeLists.txt | 1 + src/self_tests/test/README | 5 + .../test/assertions_test/CMakeLists.txt | 10 + .../test/assertions_test/test_assertions.pf | 157 ++++++ 11 files changed, 868 insertions(+), 2 deletions(-) create mode 100644 src/self_tests/Assertions.F90.in create mode 100644 src/self_tests/CMakeLists.txt create mode 100644 src/self_tests/TestNcdioPio.F90 create mode 100644 src/self_tests/test/CMakeLists.txt create mode 100644 src/self_tests/test/README create mode 100644 src/self_tests/test/assertions_test/CMakeLists.txt create mode 100644 src/self_tests/test/assertions_test/test_assertions.pf diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e4ab93151..490aa3542a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,6 +35,7 @@ add_subdirectory(${CLM_ROOT}/src/biogeophys clm_biogeophys) add_subdirectory(${CLM_ROOT}/src/dyn_subgrid clm_dyn_subgrid) add_subdirectory(${CLM_ROOT}/src/main clm_main) add_subdirectory(${CLM_ROOT}/src/init_interp clm_init_interp) +add_subdirectory(${CLM_ROOT}/src/self_tests clm_self_tests) # Add general unit test directories (stubbed out files, etc.) add_subdirectory(unit_test_stubs) @@ -105,3 +106,4 @@ add_subdirectory(${CLM_ROOT}/src/soilbiogeochem/test clm_soilbiogeochem_test) add_subdirectory(${CLM_ROOT}/src/dyn_subgrid/test clm_dyn_subgrid_test) add_subdirectory(${CLM_ROOT}/src/main/test clm_main_test) add_subdirectory(${CLM_ROOT}/src/init_interp/test clm_init_interp_test) +add_subdirectory(${CLM_ROOT}/src/self_tests/test clm_self_tests_test) \ No newline at end of file diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 21c57837d7..01a1fe5a39 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -265,7 +265,7 @@ subroutine initialize1(dtime, gindex_ocn) ! Run self-tests if requested if (run_self_tests) then - call self_test_driver + call self_test_driver(bounds_proc) end if ! Deallocate surface grid dynamic memory for variables that aren't needed elsewhere. diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index e2a1e59a86..bc3054fb11 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -64,6 +64,7 @@ module ncdio_pio public :: ncd_defvar ! define variables public :: ncd_inqvid ! inquire variable id public :: ncd_inqvname ! inquire variable name + public :: ncd_inqvtype ! inquire variable type public :: ncd_inqvdims ! inquire variable ndims public :: ncd_inqvdids ! inquire variable dimids public :: ncd_inqvdlen ! inquire variable dimension size @@ -591,6 +592,28 @@ contains end subroutine ncd_inqvid + !----------------------------------------------------------------------- + subroutine ncd_inqvtype(ncid, vardesc, vartype) + ! + ! !DESCRIPTION: + ! Inquire variable type + ! + ! !ARGUMENTS: + class(file_desc_t) , intent(in) :: ncid ! netcdf file id + type(var_desc_t) , intent(in) :: vardesc ! variable descriptor + integer , intent(out) :: vartype ! type of var in file (ncd_int, ncd_float, ncd_double, etc.) + ! + ! !LOCAL VARIABLES: + integer :: status + + character(len=*), parameter :: subname = 'ncd_inqvtype' + !----------------------------------------------------------------------- + + vartype = -9999 + status = pio_inq_vartype(ncid, vardesc, vartype) + + end subroutine ncd_inqvtype + !----------------------------------------------------------------------- subroutine ncd_inqvdims(ncid,ndims,vardesc) ! diff --git a/src/self_tests/Assertions.F90.in b/src/self_tests/Assertions.F90.in new file mode 100644 index 0000000000..2a4c8cccc6 --- /dev/null +++ b/src/self_tests/Assertions.F90.in @@ -0,0 +1,201 @@ +module Assertions + + ! ------------------------------------------------------------------------ + ! !DESCRIPTION: + ! This module contains various assertion methods that can be used in self-tests + ! + ! When an assertion fails, it will call endrun + + use shr_kind_mod, only : r8 => shr_kind_r8, i4 => shr_kind_i4 + use abortutils, only : endrun + use clm_varctl, only : iulog + + implicit none + private + save + + public :: assert_equal + + interface assert_equal + !TYPE double,int,logical + module procedure assert_equal_1d_{TYPE} + + !TYPE double,int,logical + module procedure assert_equal_2d_{TYPE} + + !TYPE double,int,logical + module procedure assert_equal_3d_{TYPE} + end interface assert_equal + + interface vals_are_equal + !TYPE double,int,logical + module procedure vals_are_equal_{TYPE} + end interface vals_are_equal + +contains + + !----------------------------------------------------------------------- + !TYPE double,int,logical + subroutine assert_equal_1d_{TYPE}(expected, actual, msg, abs_tol) + ! + ! !DESCRIPTION: + ! Assert 1-d arrays are equal + ! + ! !ARGUMENTS: + {VTYPE}, intent(in) :: expected(:) + {VTYPE}, intent(in) :: actual(:) + character(len=*), intent(in) :: msg + + ! absolute tolerance; if not specified, require exact equality; ignored for logicals + real(r8), intent(in), optional :: abs_tol + ! + ! !LOCAL VARIABLES: + integer :: i + + character(len=*), parameter :: subname = 'assert_equal_1d_{TYPE}' + !----------------------------------------------------------------------- + + if (any(shape(actual) /= shape(expected))) then + write(iulog,*) 'ERROR in assert_equal: ', msg + write(iulog,*) 'Shape mismatch:' + write(iulog,*) 'Actual shape: ', shape(actual) + write(iulog,*) 'Expected shape: ', shape(expected) + call endrun('ERROR in assert_equal') + end if + + do i = 1, size(expected, 1) + if (.not. vals_are_equal(actual(i), expected(i), abs_tol)) then + write(iulog,*) 'ERROR in assert_equal: ', msg + write(iulog,*) 'Data mismatch: first mismatch at index: ', i + write(iulog,*) 'Actual : ', actual(i) + write(iulog,*) 'Expected: ', expected(i) + call endrun('ERROR in assert_equal') + end if + end do + + end subroutine assert_equal_1d_{TYPE} + + !----------------------------------------------------------------------- + !TYPE double,int,logical + subroutine assert_equal_2d_{TYPE}(expected, actual, msg, abs_tol) + ! + ! !DESCRIPTION: + ! Assert 2-d arrays are equal + ! + ! !ARGUMENTS: + {VTYPE}, intent(in) :: expected(:,:) + {VTYPE}, intent(in) :: actual(:,:) + character(len=*), intent(in) :: msg + + ! absolute tolerance; if not specified, require exact equality; ignored for logicals + real(r8), intent(in), optional :: abs_tol + ! + ! !LOCAL VARIABLES: + integer :: i, j + + character(len=*), parameter :: subname = 'assert_equal_2d_{TYPE}' + !----------------------------------------------------------------------- + + if (any(shape(actual) /= shape(expected))) then + write(iulog,*) 'ERROR in assert_equal: ', msg + write(iulog,*) 'Shape mismatch:' + write(iulog,*) 'Actual shape: ', shape(actual) + write(iulog,*) 'Expected shape: ', shape(expected) + call endrun('ERROR in assert_equal') + end if + + do j = 1, size(expected, 2) + do i = 1, size(expected, 1) + if (.not. vals_are_equal(actual(i,j), expected(i,j), abs_tol)) then + write(iulog,*) 'ERROR in assert_equal: ', msg + write(iulog,*) 'Data mismatch: first mismatch at index: ', i, j + write(iulog,*) 'Actual : ', actual(i,j) + write(iulog,*) 'Expected: ', expected(i,j) + call endrun('ERROR in assert_equal') + end if + end do + end do + + end subroutine assert_equal_2d_{TYPE} + + !----------------------------------------------------------------------- + !TYPE double,int,logical + subroutine assert_equal_3d_{TYPE}(expected, actual, msg, abs_tol) + ! + ! !DESCRIPTION: + ! Assert 3-d arrays are equal + ! + ! !ARGUMENTS: + {VTYPE}, intent(in) :: expected(:,:,:) + {VTYPE}, intent(in) :: actual(:,:,:) + character(len=*), intent(in) :: msg + + ! absolute tolerance; if not specified, require exact equality; ignored for logicals + real(r8), intent(in), optional :: abs_tol + ! + ! !LOCAL VARIABLES: + integer :: i, j, k + + character(len=*), parameter :: subname = 'assert_equal_3d_{TYPE}' + !----------------------------------------------------------------------- + + if (any(shape(actual) /= shape(expected))) then + write(iulog,*) 'ERROR in assert_equal: ', msg + write(iulog,*) 'Shape mismatch:' + write(iulog,*) 'Actual shape: ', shape(actual) + write(iulog,*) 'Expected shape: ', shape(expected) + call endrun('ERROR in assert_equal') + end if + + do k = 1, size(expected, 3) + do j = 1, size(expected, 2) + do i = 1, size(expected, 1) + if (.not. vals_are_equal(actual(i,j,k), expected(i,j,k), abs_tol)) then + write(iulog,*) 'ERROR in assert_equal: ', msg + write(iulog,*) 'Data mismatch: first mismatch at index: ', i, j, k + write(iulog,*) 'Actual : ', actual(i,j,k) + write(iulog,*) 'Expected: ', expected(i,j,k) + call endrun('ERROR in assert_equal') + end if + end do + end do + end do + + end subroutine assert_equal_3d_{TYPE} + + !----------------------------------------------------------------------- + !TYPE double,int,logical + function vals_are_equal_{TYPE}(actual, expected, abs_tol) result(vals_equal) + ! + ! !DESCRIPTION: + ! Returns true if actual is the same as expected, false otherwise + ! + ! !ARGUMENTS: + logical :: vals_equal ! function result + {VTYPE}, intent(in) :: actual + {VTYPE}, intent(in) :: expected + + ! absolute tolerance; if not specified, require exact equality; ignored for logicals + real(r8), intent(in), optional :: abs_tol + ! + ! !LOCAL VARIABLES: + real(r8) :: abs_tol_loc ! local version of abs_tol + + character(len=*), parameter :: subname = 'vals_are_equal_{TYPE}' + !----------------------------------------------------------------------- + +#if ({ITYPE}==TYPELOGICAL) + vals_equal = (actual .eqv. expected) +#else + if (present(abs_tol)) then + abs_tol_loc = abs_tol + else + abs_tol_loc = 0._r8 + end if + + vals_equal = (abs(actual - expected) <= abs_tol_loc) +#endif + + end function vals_are_equal_{TYPE} + +end module Assertions diff --git a/src/self_tests/CMakeLists.txt b/src/self_tests/CMakeLists.txt new file mode 100644 index 0000000000..3a454aab2b --- /dev/null +++ b/src/self_tests/CMakeLists.txt @@ -0,0 +1,14 @@ +# Note that this is just used for unit testing; hence, we only need to add +# source files that are currently used in unit tests + +set(genf90_files + Assertions.F90.in + ) + +process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_BINARY_DIR} clm_genf90_sources) + +sourcelist_to_parent(clm_genf90_sources) + +list(APPEND clm_sources "${clm_genf90_sources}") + +sourcelist_to_parent(clm_sources) diff --git a/src/self_tests/SelfTestDriver.F90 b/src/self_tests/SelfTestDriver.F90 index 8fde966921..bd948f48cd 100644 --- a/src/self_tests/SelfTestDriver.F90 +++ b/src/self_tests/SelfTestDriver.F90 @@ -6,6 +6,9 @@ module SelfTestDriver ! ! See the README file in this directory for a high-level overview of these self-tests. + use decompMod, only : bounds_type + use TestNcdioPio, only : test_ncdio_pio + implicit none private save @@ -20,18 +23,21 @@ module SelfTestDriver contains !----------------------------------------------------------------------- - subroutine self_test_driver + subroutine self_test_driver(bounds) ! ! !DESCRIPTION: ! Top-level driver to the self-test code ! ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: character(len=*), parameter :: subname = 'self_test_driver' !----------------------------------------------------------------------- + call test_ncdio_pio(bounds) + end subroutine self_test_driver end module SelfTestDriver diff --git a/src/self_tests/TestNcdioPio.F90 b/src/self_tests/TestNcdioPio.F90 new file mode 100644 index 0000000000..5a3c314c33 --- /dev/null +++ b/src/self_tests/TestNcdioPio.F90 @@ -0,0 +1,447 @@ +module TestNcdioPio + + ! ------------------------------------------------------------------------ + ! !DESCRIPTION: + ! This module contains tests of ncdio_pio + + use ncdio_pio + use shr_kind_mod, only : r8 => shr_kind_r8 + use Assertions, only : assert_equal + use clm_varcon, only : nameg + use abortutils, only : endrun + use array_utils, only : convert_to_logical + use decompMod, only : bounds_type, get_proc_global + use GridcellType, only : grc + use spmdMod, only : masterproc + + implicit none + private + save + + ! Public routines + + public :: test_ncdio_pio + + ! Module data used in various tests + + integer, parameter :: nlev1 = 5 + character(len=*), parameter :: lev1_name = 'lev1' + + integer, parameter :: nlev2 = 3 + character(len=*), parameter :: lev2_name = 'lev2' + + character(len=*), parameter :: testfilename = 'test_ncdio_pio.nc' + + real(r8), pointer :: data_double_1d_grc(:) + integer, pointer :: data_int_1d_grc(:) + integer, pointer :: data_intlogical_1d_grc(:) ! only has 0 & 1 values (representing a logical) + real(r8), pointer :: data_double_2d_grc(:,:) + real(r8), pointer :: data_double_3d_grc(:,:,:) + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + +contains + + !----------------------------------------------------------------------- + subroutine test_ncdio_pio(bounds) + ! + ! !DESCRIPTION: + ! Drive tests of ncdio_pio + ! + ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'test_ncdio_pio' + !----------------------------------------------------------------------- + + call write_to_log(subname//': create_vars') + call create_vars(bounds) + + call write_to_log(subname//': test_write_vars') + call test_write_vars + + call write_to_log(subname//': test_read_vars') + call test_read_vars + + call write_to_log(subname//': test_read_vars_change_type') + call test_read_vars_change_type + + call clean + + end subroutine test_ncdio_pio + + !----------------------------------------------------------------------- + subroutine create_vars(bounds) + ! + ! !DESCRIPTION: + ! Create module data used in tests here + ! + ! !ARGUMENTS: + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + integer :: g + integer :: lev1, lev2 + integer :: cur_intlogical + + character(len=*), parameter :: subname = 'create_vars' + !----------------------------------------------------------------------- + + associate( & + begg => bounds%begg, & + endg => bounds%endg & + ) + + allocate(data_double_1d_grc(begg:endg)) + do g = begg, endg + data_double_1d_grc(g) = grc%latdeg(g)*1.1_r8 + end do + + allocate(data_int_1d_grc(begg:endg)) + do g = begg, endg + data_int_1d_grc(g) = int(grc%latdeg(g))*3 + end do + + ! This definition of the logical values will lead to differences based on processor + ! count. That's okay for now, but we may need to revisit this if it causes problems + ! in the future. + allocate(data_intlogical_1d_grc(begg:endg)) + cur_intlogical = 1 + do g = begg, endg + data_intlogical_1d_grc(g) = cur_intlogical + cur_intlogical = 1 - cur_intlogical + end do + + allocate(data_double_2d_grc(begg:endg, 1:nlev1)) + do lev1 = 1, nlev1 + do g = begg, endg + data_double_2d_grc(g, lev1) = grc%latdeg(g)*4.4_r8 + lev1*5.5_r8 + end do + end do + + allocate(data_double_3d_grc(begg:endg, 1:nlev1, 1:nlev2)) + do lev2 = 1, nlev2 + do lev1 = 1, nlev1 + do g = begg, endg + data_double_3d_grc(g, lev1, lev2) = grc%latdeg(g)*4.4_r8 + lev1*5.5_r8 + lev2*6.6_r8 + end do + end do + end do + + end associate + + end subroutine create_vars + + !----------------------------------------------------------------------- + subroutine test_write_vars + ! + ! !DESCRIPTION: + ! Write all variables to a test file; confirm that the variables are written and that + ! they are the expected type + ! + ! !ARGUMENTS: + ! + ! !LOCAL VARIABLES: + type(file_desc_t) :: ncid + integer :: numg + integer :: dimid + + character(len=*), parameter :: subname = 'test_write_vars' + !----------------------------------------------------------------------- + + call ncd_pio_createfile(ncid, testfilename) + + call get_proc_global(ng=numg) + call ncd_defdim(ncid, nameg, numg, dimid) + call ncd_defdim(ncid, lev1_name, nlev1, dimid) + call ncd_defdim(ncid, lev2_name, nlev2, dimid) + + ! Write latitude since many of the variables' values depend on it (in case we want to + ! double-check those values) + call ncd_defvar(ncid=ncid, varname='latdeg', xtype=ncd_double, & + dim1name=nameg, & + long_name='latitude', units='degrees') + + call ncd_defvar(ncid=ncid, varname='data_double_1d_grc', xtype=ncd_double, & + dim1name=nameg, & + long_name=' ', units=' ') + call ncd_defvar(ncid=ncid, varname='data_double_1d_grc_float', xtype=ncd_float, & + dim1name=nameg, & + long_name=' ', units=' ') + call ncd_defvar(ncid=ncid, varname='data_int_1d_grc', xtype=ncd_int, & + dim1name=nameg, & + long_name=' ', units=' ') + call ncd_defvar(ncid=ncid, varname='data_intlogical_1d_grc', xtype=ncd_int, & + dim1name=nameg, & + long_name=' ', units=' ') + call ncd_defvar(ncid=ncid, varname='data_double_2d_grc', xtype=ncd_double, & + dim1name=nameg, dim2name=lev1_name, & + long_name=' ', units=' ') + call ncd_defvar(ncid=ncid, varname='data_double_2d_grc_switchdim', xtype=ncd_double, & + dim1name=lev1_name, dim2name=nameg, & + long_name=' ', units=' ') + call ncd_defvar(ncid=ncid, varname='data_double_3d_grc', xtype=ncd_double, & + dim1name=nameg, dim2name=lev1_name, dim3name=lev2_name) + + call ncd_enddef(ncid) + + call write_to_log('Writing latdeg') + call ncd_io(varname='latdeg', data=grc%latdeg, & + dim1name=nameg, ncid=ncid, flag='write') + + call write_to_log('Writing data_double_1d_grc') + call ncd_io(varname='data_double_1d_grc', data=data_double_1d_grc, & + dim1name=nameg, ncid=ncid, flag='write') + call write_to_log('Writing data_double_1d_grc_float') + call ncd_io(varname='data_double_1d_grc_float', data=data_double_1d_grc, & + dim1name=nameg, ncid=ncid, flag='write') + call write_to_log('Writing data_int_1d_grc') + call ncd_io(varname='data_int_1d_grc', data=data_int_1d_grc, & + dim1name=nameg, ncid=ncid, flag='write') + call write_to_log('Writing data_intlogical_1d_grc') + call ncd_io(varname='data_intlogical_1d_grc', data=data_intlogical_1d_grc, & + dim1name=nameg, ncid=ncid, flag='write') + call write_to_log('Writing data_double_2d_grc') + call ncd_io(varname='data_double_2d_grc', data=data_double_2d_grc, & + dim1name=nameg, ncid=ncid, flag='write') + call write_to_log('Writing data_double_2d_grc_switchdim') + call ncd_io(varname='data_double_2d_grc_switchdim', data=data_double_2d_grc, & + dim1name=nameg, switchdim=.true., ncid=ncid, flag='write') + call write_to_log('Writing data_double_3d_grc') + call ncd_io(varname='data_double_3d_grc', data=data_double_3d_grc, & + dim1name=nameg, ncid=ncid, flag='write') + + call ncd_pio_closefile(ncid) + + call write_to_log('Confirming that all variables have been written with correct type') + call ncd_pio_openfile(ncid, testfilename, 0) + call confirm_var_on_file(ncid, 'data_double_1d_grc', ncd_double) + call confirm_var_on_file(ncid, 'data_double_1d_grc_float', ncd_float) + call confirm_var_on_file(ncid, 'data_int_1d_grc', ncd_int) + call confirm_var_on_file(ncid, 'data_intlogical_1d_grc', ncd_int) + call confirm_var_on_file(ncid, 'data_double_2d_grc', ncd_double) + call confirm_var_on_file(ncid, 'data_double_2d_grc_switchdim', ncd_double) + call confirm_var_on_file(ncid, 'data_double_3d_grc', ncd_double) + call ncd_pio_closefile(ncid) + + end subroutine test_write_vars + + !----------------------------------------------------------------------- + subroutine confirm_var_on_file(ncid, varname, expected_type) + ! + ! !DESCRIPTION: + ! Confirm that the given variable exists on the file, with the expected type + ! + ! !ARGUMENTS: + type(file_desc_t), intent(inout) :: ncid + character(len=*), intent(in) :: varname + integer, intent(in) :: expected_type + ! + ! !LOCAL VARIABLES: + logical :: readvar + integer :: vartype + type(var_desc_t) :: vardesc + + character(len=*), parameter :: subname = 'check_var_written' + !----------------------------------------------------------------------- + + call check_var(ncid, varname, vardesc, readvar) + if (.not. readvar) then + call endrun(trim(varname)//' not found on file') + end if + + call ncd_inqvtype(ncid, vardesc, vartype) + if (vartype /= expected_type) then + call endrun(trim(varname)//' not expected type') + end if + + end subroutine confirm_var_on_file + + !----------------------------------------------------------------------- + subroutine test_read_vars() + ! + ! !DESCRIPTION: + ! Test reading the variables from file into variables in memory; ensure these match + ! the originals. + ! + ! This just tests reading a variable of a given type on file into a variable of the + ! same type in memory. Tests involving type conversion happen elsewhere. + ! + ! !ARGUMENTS: + ! + ! !LOCAL VARIABLES: + type(file_desc_t) :: ncid + real(r8), pointer :: local_double_1d_grc(:) + integer, pointer :: local_int_1d_grc(:) + real(r8), pointer :: local_double_2d_grc(:,:) + real(r8), pointer :: local_double_2d_grc_switchdim(:,:) + real(r8), pointer :: local_double_3d_grc(:,:,:) + + character(len=*), parameter :: subname = 'test_read_vars' + !----------------------------------------------------------------------- + + allocate(local_double_1d_grc(size(data_double_1d_grc, 1))) + allocate(local_int_1d_grc(size(data_int_1d_grc, 1))) + allocate(local_double_2d_grc(size(data_double_2d_grc, 1), size(data_double_2d_grc, 2))) + allocate(local_double_2d_grc_switchdim(size(data_double_2d_grc, 1), size(data_double_2d_grc, 2))) + allocate(local_double_3d_grc(size(data_double_3d_grc, 1), size(data_double_3d_grc, 2), size(data_double_3d_grc, 3))) + + call ncd_pio_openfile(ncid, testfilename, 0) + + call write_to_log(subname//': Reading and comparing data_double_1d_grc') + call ncd_io(varname='data_double_1d_grc', data=local_double_1d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + call assert_equal(expected=data_double_1d_grc, actual=local_double_1d_grc, & + msg='data_double_1d_grc') + + call write_to_log(subname//': Reading and comparing data_int_1d_grc') + call ncd_io(varname='data_int_1d_grc', data=local_int_1d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + call assert_equal(expected=data_int_1d_grc, actual=local_int_1d_grc, & + msg='data_int_1d_grc') + + call write_to_log(subname//': Reading and comparing data_double_2d_grc') + call ncd_io(varname='data_double_2d_grc', data=local_double_2d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + call assert_equal(expected=data_double_2d_grc, actual=local_double_2d_grc, & + msg='data_double_2d_grc') + + call write_to_log(subname//': Reading and comparing data_double_2d_grc_switchdim') + call ncd_io(varname='data_double_2d_grc_switchdim', data=local_double_2d_grc_switchdim, & + dim1name=nameg, switchdim=.true., ncid=ncid, flag='read') + call assert_equal(expected=data_double_2d_grc, actual=local_double_2d_grc_switchdim, & + msg='data_double_2d_grc_switchdim') + + call write_to_log(subname//': Reading and comparing data_double_3d_grc') + call ncd_io(varname='data_double_3d_grc', data=local_double_3d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + call assert_equal(expected=data_double_3d_grc, actual=local_double_3d_grc, & + msg='data_double_3d_grc') + + call ncd_pio_closefile(ncid) + + deallocate(local_double_1d_grc) + deallocate(local_int_1d_grc) + deallocate(local_double_2d_grc) + deallocate(local_double_2d_grc_switchdim) + deallocate(local_double_3d_grc) + + end subroutine test_read_vars + + !----------------------------------------------------------------------- + subroutine test_read_vars_change_type() + ! + ! !DESCRIPTION: + ! Test reading some variables from file into variables in memory with different + ! types, to ensure this type conversion is done correctly. + ! + ! !ARGUMENTS: + ! + ! !LOCAL VARIABLES: + type(file_desc_t) :: ncid + real(r8), pointer :: local_double_1d_grc(:) + integer, pointer :: local_int_1d_grc(:) + logical, pointer :: local_log_1d_grc(:) + logical, allocatable :: expected_log_1d(:) + + character(len=*), parameter :: subname = 'test_read_vars_change_type' + !----------------------------------------------------------------------- + + allocate(local_double_1d_grc(size(data_double_1d_grc, 1))) + allocate(local_int_1d_grc(size(data_double_1d_grc, 1))) + allocate(local_log_1d_grc(size(data_double_1d_grc, 1))) + + call ncd_pio_openfile(ncid, testfilename, 0) + + call write_to_log(subname//': Reading float into double') + local_double_1d_grc(:) = 0._r8 + call ncd_io(varname='data_double_1d_grc_float', data=local_double_1d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + call assert_equal(expected=data_double_1d_grc, actual=local_double_1d_grc, & + msg='data_double_1d_grc_float to double', abs_tol=1.e-4_r8) + + call write_to_log(subname//': Reading int into double') + local_double_1d_grc(:) = 0._r8 + call ncd_io(varname='data_int_1d_grc', data=local_double_1d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + call assert_equal(expected=real(data_int_1d_grc, r8), actual=local_double_1d_grc, & + msg='data_int_1d_grc to double') + + call write_to_log(subname//': Reading double into int') + local_int_1d_grc(:) = 0._r8 + call ncd_io(varname='data_double_1d_grc', data=local_int_1d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + call assert_equal(expected=int(data_double_1d_grc), actual=local_int_1d_grc, & + msg='data_double_1d_grc to int') + + call write_to_log(subname//': Reading float into int') + local_int_1d_grc(:) = 0._r8 + call ncd_io(varname='data_double_1d_grc_float', data=local_int_1d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + call assert_equal(expected=int(data_double_1d_grc), actual=local_int_1d_grc, & + msg='data_double_1d_grc_float to int') + + call write_to_log(subname//': Reading int into logical') + local_log_1d_grc(:) = .false. + call ncd_io(varname='data_intlogical_1d_grc', data=local_log_1d_grc, & + dim1name=nameg, ncid=ncid, flag='read') + allocate(expected_log_1d(size(data_intlogical_1d_grc))) + call convert_to_logical(data_intlogical_1d_grc, expected_log_1d) + call assert_equal(expected=expected_log_1d, actual=local_log_1d_grc, & + msg='data_intlogical_1d_grc to logical') + + call ncd_pio_closefile(ncid) + + deallocate(local_double_1d_grc) + deallocate(local_int_1d_grc) + deallocate(local_log_1d_grc) + + end subroutine test_read_vars_change_type + + + !----------------------------------------------------------------------- + subroutine write_to_log(msg) + ! + ! !DESCRIPTION: + ! Write a message to the log file, just from the masterproc + ! + ! !ARGUMENTS: + character(len=*), intent(in) :: msg + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'write_to_log' + !----------------------------------------------------------------------- + + if (masterproc) then + write(*,'(a)') msg + end if + + end subroutine write_to_log + + !----------------------------------------------------------------------- + subroutine clean + ! + ! !DESCRIPTION: + ! Do end-of-testing cleanup + ! + ! !ARGUMENTS: + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'clean' + !----------------------------------------------------------------------- + + deallocate(data_double_1d_grc) + deallocate(data_int_1d_grc) + deallocate(data_intlogical_1d_grc) + deallocate(data_double_2d_grc) + deallocate(data_double_3d_grc) + + end subroutine clean + + +end module TestNcdioPio diff --git a/src/self_tests/test/CMakeLists.txt b/src/self_tests/test/CMakeLists.txt new file mode 100644 index 0000000000..d616310bcd --- /dev/null +++ b/src/self_tests/test/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(assertions_test) diff --git a/src/self_tests/test/README b/src/self_tests/test/README new file mode 100644 index 0000000000..a78c047628 --- /dev/null +++ b/src/self_tests/test/README @@ -0,0 +1,5 @@ +This directory contains unit tests of some utility code contained in +this self_tests directory. This is a bit confusing: the self-tests +themselves are NOT run from here (they are NOT run via the standard unit +testing infrastructure), but this directory contains some standard unit +tests of lower-level infrastructure code leveraged by the self-tests. diff --git a/src/self_tests/test/assertions_test/CMakeLists.txt b/src/self_tests/test/assertions_test/CMakeLists.txt new file mode 100644 index 0000000000..de7a0febef --- /dev/null +++ b/src/self_tests/test/assertions_test/CMakeLists.txt @@ -0,0 +1,10 @@ +set (pfunit_sources + test_assertions.pf) + +set (extra_sources + ) + +create_pFUnit_test(assertions test_assertions_exe + "${pfunit_sources}" "${extra_sources}") + +target_link_libraries(test_assertions_exe clm csm_share esmf_wrf_timemgr) diff --git a/src/self_tests/test/assertions_test/test_assertions.pf b/src/self_tests/test/assertions_test/test_assertions.pf new file mode 100644 index 0000000000..10eaaafce6 --- /dev/null +++ b/src/self_tests/test/assertions_test/test_assertions.pf @@ -0,0 +1,157 @@ +module test_assertions + + ! Tests of Assertions + + use pfunit_mod + use Assertions + use shr_kind_mod , only : r8 => shr_kind_r8 + use unittestUtils, only : endrun_msg + + implicit none + + @TestCase + type, extends(TestCase) :: TestAssertions + character(len=:), allocatable :: expected_msg ! expected error message for failures + contains + procedure :: setUp + procedure :: tearDown + end type TestAssertions + + real(r8), parameter :: tol = 1.e-13_r8 + +contains + + subroutine setUp(this) + class(TestAssertions), intent(inout) :: this + + this%expected_msg = endrun_msg('ERROR in assert_equal') + end subroutine setUp + + subroutine tearDown(this) + class(TestAssertions), intent(inout) :: this + end subroutine tearDown + + @Test + subroutine test_assertEqual_1dDouble_passes(this) + class(TestAssertions), intent(inout) :: this + real(r8) :: data1(3), data2(3) + + data1 = [1._r8, 2._r8, 3._r8] + data2 = data1 + + ! Just make sure this doesn't abort + call assert_equal(data1, data2, msg=' ') + end subroutine test_assertEqual_1dDouble_passes + + @Test + subroutine test_assertEqual_1dDouble_fails(this) + class(TestAssertions), intent(inout) :: this + real(r8) :: data1(3), data2(3) + + data1 = [1._r8, 2._r8, 3._r8] + data2 = [1._r8, 2.1_r8, 3._r8] + + call assert_equal(data1, data2, msg=' ') + @assertExceptionRaised(this%expected_msg) + end subroutine test_assertEqual_1dDouble_fails + + @Test + subroutine test_assertEqual_1dDouble_withTol_passes(this) + class(TestAssertions), intent(inout) :: this + real(r8) :: data1(3), data2(3) + + data1 = [1._r8, 2._r8, 3._r8] + data2 = [1._r8, 2.1_r8, 3._r8] + + ! Just make sure this doesn't abort + call assert_equal(data1, data2, msg=' ', abs_tol=0.11_r8) + end subroutine test_assertEqual_1dDouble_withTol_passes + + @Test + subroutine test_assertEqual_1dDouble_withTol_fails(this) + class(TestAssertions), intent(inout) :: this + real(r8) :: data1(3), data2(3) + + data1 = [1._r8, 2._r8, 3._r8] + data2 = [1._r8, 2.1_r8, 3._r8] + + call assert_equal(data1, data2, msg=' ', abs_tol=0.09_r8) + @assertExceptionRaised(this%expected_msg) + end subroutine test_assertEqual_1dDouble_withTol_fails + + @Test + subroutine test_assertEqual_1dLogical_passes(this) + class(TestAssertions), intent(inout) :: this + logical :: data1(4), data2(4) + + data1 = [.true., .false., .true., .false.] + data2 = data1 + + ! Just make sure this doesn't abort + call assert_equal(data1, data2, msg=' ') + end subroutine test_assertEqual_1dLogical_passes + + @Test + subroutine test_assertEqual_1dLogical_fails(this) + class(TestAssertions), intent(inout) :: this + logical :: data1(4), data2(4) + + data1 = [.true., .false., .true., .false.] + data2 = [.true., .true. , .true., .false.] + + call assert_equal(data1, data2, msg=' ') + @assertExceptionRaised(this%expected_msg) + end subroutine test_assertEqual_1dLogical_fails + + @Test + subroutine test_assertEqual_2dDouble_passes(this) + class(TestAssertions), intent(inout) :: this + real(r8) :: data1(3,2), data2(3,2) + + data1 = reshape([1._r8, 2._r8, 3._r8, 4._r8, 5._r8, 6._r8], [3, 2]) + data2 = data1 + + ! Just make sure this doesn't abort + call assert_equal(data1, data2, msg=' ') + end subroutine test_assertEqual_2dDouble_passes + + @Test + subroutine test_assertEqual_2dDouble_fails(this) + class(TestAssertions), intent(inout) :: this + real(r8) :: data1(3,2), data2(3,2) + + data1 = reshape([1._r8, 2._r8, 3._r8, 4._r8, 5._r8, 6._r8], [3, 2]) + data2 = reshape([1._r8, 2._r8, 3._r8, 4._r8, 5.1_r8, 6._r8], [3, 2]) + + call assert_equal(data1, data2, msg=' ') + @assertExceptionRaised(this%expected_msg) + end subroutine test_assertEqual_2dDouble_fails + + @Test + subroutine test_assertEqual_3dDouble_passes(this) + class(TestAssertions), intent(inout) :: this + real(r8) :: data1(4,3,2), data2(4,3,2) + integer :: i + + data1 = reshape([(real(i, r8), i = 1, 24)], [4, 3, 2]) + data2 = data1 + + ! Just make sure this doesn't abort + call assert_equal(data1, data2, msg=' ') + end subroutine test_assertEqual_3dDouble_passes + + @Test + subroutine test_assertEqual_3dDouble_fails(this) + class(TestAssertions), intent(inout) :: this + real(r8) :: data1(4,3,2), data2(4,3,2) + integer :: i + + data1 = reshape([(real(i, r8), i = 1, 24)], [4, 3, 2]) + data2 = data1 + data2(3,2,2) = data2(3,2,2) + 0.1_r8 + + call assert_equal(data1, data2, msg=' ') + @assertExceptionRaised(this%expected_msg) + end subroutine test_assertEqual_3dDouble_fails + +end module test_assertions From 2ac9a55d9059d2f5c2d6ff906c1823301387cfaf Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 15 Oct 2020 13:40:55 -0600 Subject: [PATCH 1557/1973] Rename run_self_tests to more specific for_testing_run_ncdiopio_tests @ekluzek suggested this so that individual sets of self-tests can be turned on or off separately. --- bld/CLMBuildNamelist.pm | 2 +- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- bld/namelist_files/namelist_definition_ctsm.xml | 6 +++--- cime_config/testdefs/testlist_clm.xml | 2 +- .../testdefs/testmods_dirs/clm/run_self_tests/README | 4 ++-- .../testmods_dirs/clm/run_self_tests/user_nl_clm | 2 +- src/main/clm_initializeMod.F90 | 9 +++------ src/main/clm_varctl.F90 | 4 ++-- src/main/controlMod.F90 | 6 +++--- src/self_tests/SelfTestDriver.F90 | 8 +++++++- 10 files changed, 24 insertions(+), 21 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 1b49b9f5dd..b64733cbc3 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3908,7 +3908,7 @@ sub setup_logic_misc { # my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'run_self_tests'); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'for_testing_run_ncdiopio_tests'); } #------------------------------------------------------------------------------- diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index bda2953c68..6465a332a5 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -57,7 +57,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 1 0 -.false. +.false. .true. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 83dae121bf..73cc27aabc 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -941,10 +941,10 @@ Whether to use subgrid fluxes for snow Whether snow on the vegetation canopy affects the radiation/albedo calculations - -Whether to run self-tests as part of the model run. This is typically -only used in automated tests. +Whether to run some tests of ncdio_pio as part of the model run. This is +typically only used in automated tests. diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 0f6322cb34..423fd1be72 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -2337,7 +2337,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + diff --git a/cime_config/testdefs/testmods_dirs/clm/run_self_tests/README b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/README index 340cd43cc1..938dffbe6f 100644 --- a/cime_config/testdefs/testmods_dirs/clm/run_self_tests/README +++ b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/README @@ -1,5 +1,5 @@ -The purpose of this testmod directory is to trigger the run_self_tests -option. This runs a suite of unit/integration tests. +The purpose of this testmod directory is to trigger the runtime +self-tests. This runs a suite of unit/integration tests. We use cold start so that we can get through initialization faster, since how we initialize the model is unimportant for these self-tests. diff --git a/cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm index 74ad5186dd..6187386336 100644 --- a/cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm @@ -1 +1 @@ -run_self_tests = .true. +for_testing_run_ncdiopio_tests = .true. diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 01a1fe5a39..a2ba5111b5 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -13,7 +13,7 @@ module clm_initializeMod use clm_varctl , only : is_cold_start, is_interpolated_start use clm_varctl , only : iulog use clm_varctl , only : use_lch4, use_cn, use_cndv, use_c13, use_c14, use_fates - use clm_varctl , only : use_soil_moisture_streams, run_self_tests + use clm_varctl , only : use_soil_moisture_streams use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft, irrig_method, wt_glc_mec, topo_glc_mec, haslake use perf_mod , only : t_startf, t_stopf use readParamsMod , only : readParameters @@ -262,11 +262,8 @@ subroutine initialize1(dtime, gindex_ocn) call ch4conrd() end if - ! Run self-tests if requested - - if (run_self_tests) then - call self_test_driver(bounds_proc) - end if + ! Run any requested self-tests + call self_test_driver(bounds_proc) ! Deallocate surface grid dynamic memory for variables that aren't needed elsewhere. ! Some things are kept until the end of initialize2; urban_valid is kept through the diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index a011118ca4..75ec36d035 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -53,8 +53,8 @@ module clm_varctl !true => no valid land points -- do NOT run logical, public :: noland = .false. - ! true => run self_tests - logical, public :: run_self_tests = .false. + ! true => run tests of ncdio_pio + logical, public :: for_testing_run_ncdiopio_tests = .false. ! Hostname of machine running on character(len=256), public :: hostname = ' ' diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 6c078f3105..5960cf01ac 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -202,7 +202,7 @@ subroutine control_init(dtime) albice, soil_layerstruct_predefined, soil_layerstruct_userdefined, & soil_layerstruct_userdefined_nlevsoi, use_subgrid_fluxes, snow_cover_fraction_method, & irrigate, run_zero_weight_urban, all_active, & - crop_fsat_equals_zero, run_self_tests + crop_fsat_equals_zero, for_testing_run_ncdiopio_tests ! vertical soil mixing variables namelist /clm_inparm/ & @@ -660,8 +660,8 @@ subroutine control_spmd() ! Crop saturated excess runoff call mpi_bcast(crop_fsat_equals_zero, 1, MPI_LOGICAL, 0, mpicom, ier) - ! Whether to run self-tests - call mpi_bcast(run_self_tests, 1, MPI_LOGICAL, 0, mpicom, ier) + ! Whether to run tests of ncdio_pio + call mpi_bcast(for_testing_run_ncdiopio_tests, 1, MPI_LOGICAL, 0, mpicom, ier) ! Landunit generation call mpi_bcast(create_crop_landunit, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/self_tests/SelfTestDriver.F90 b/src/self_tests/SelfTestDriver.F90 index bd948f48cd..d109a27827 100644 --- a/src/self_tests/SelfTestDriver.F90 +++ b/src/self_tests/SelfTestDriver.F90 @@ -6,6 +6,7 @@ module SelfTestDriver ! ! See the README file in this directory for a high-level overview of these self-tests. + use clm_varctl, only : for_testing_run_ncdiopio_tests use decompMod, only : bounds_type use TestNcdioPio, only : test_ncdio_pio @@ -28,6 +29,9 @@ subroutine self_test_driver(bounds) ! !DESCRIPTION: ! Top-level driver to the self-test code ! + ! This subroutine should be called all the time, but each set of self tests is only + ! run if the appropriate flag is set. + ! ! !ARGUMENTS: type(bounds_type), intent(in) :: bounds ! @@ -36,7 +40,9 @@ subroutine self_test_driver(bounds) character(len=*), parameter :: subname = 'self_test_driver' !----------------------------------------------------------------------- - call test_ncdio_pio(bounds) + if (for_testing_run_ncdiopio_tests) then + call test_ncdio_pio(bounds) + end if end subroutine self_test_driver From cb2fbed596fcbc21cc91b4520c8f130ff2f0cf30 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 15 Oct 2020 14:05:45 -0600 Subject: [PATCH 1558/1973] In unit tests: generate files from genf90 in build dir, not in source I never liked that the files generated from genf90 in the unit test build were put in the source tree. This fixes that issue. This also lets us remove some dtypes.h files that were in the source tree, presumably just because of this old usage. Resolves ESCOMP/CTSM#1188 --- .gitignore | 10 ---------- src/dyn_subgrid/CMakeLists.txt | 2 +- src/main/dtypes.h | 6 ------ src/unit_test_shr/CMakeLists.txt | 2 +- src/unit_test_stubs/main/CMakeLists.txt | 2 +- src/unit_test_stubs/utils/CMakeLists.txt | 2 +- src/utils/CMakeLists.txt | 2 +- src/utils/dtypes.h | 6 ------ 8 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 src/main/dtypes.h delete mode 100644 src/utils/dtypes.h diff --git a/.gitignore b/.gitignore index 70b87590a6..d5dd1a7132 100644 --- a/.gitignore +++ b/.gitignore @@ -47,16 +47,6 @@ CMakeFiles/ # unit testing directories /src/unit_tests.* -# files generated by the unit test build -/src/dyn_subgrid/dynVarMod.F90 -/src/dyn_subgrid/dynVarTimeInterpMod.F90 -/src/dyn_subgrid/dynVarTimeUninterpMod.F90 -/src/utils/array_utils.F90 -/src/unit_test_stubs/utils/restUtilMod_stub.F90 -/src/unit_test_stubs/main/ncdio_pio_fake.F90 -/src/unit_test_stubs/main/ncdio_var.F90 -/src/unit_test_shr/unittestArrayMod.F90 - # cime_config buildnmlc diff --git a/src/dyn_subgrid/CMakeLists.txt b/src/dyn_subgrid/CMakeLists.txt index 42ecc336ef..4445c85809 100644 --- a/src/dyn_subgrid/CMakeLists.txt +++ b/src/dyn_subgrid/CMakeLists.txt @@ -7,7 +7,7 @@ set(genf90_files dynVarTimeUninterpMod.F90.in ) -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) +process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_BINARY_DIR} clm_genf90_sources) sourcelist_to_parent(clm_genf90_sources) diff --git a/src/main/dtypes.h b/src/main/dtypes.h deleted file mode 100644 index aa1dc3bd0f..0000000000 --- a/src/main/dtypes.h +++ /dev/null @@ -1,6 +0,0 @@ -#define TYPETEXT 100 -#define TYPEREAL 101 -#define TYPEDOUBLE 102 -#define TYPEINT 103 -#define TYPELONG 104 -#define TYPELOGICAL 105 diff --git a/src/unit_test_shr/CMakeLists.txt b/src/unit_test_shr/CMakeLists.txt index d0172f5931..9bf95c728f 100644 --- a/src/unit_test_shr/CMakeLists.txt +++ b/src/unit_test_shr/CMakeLists.txt @@ -2,7 +2,7 @@ set(genf90_files unittestArrayMod.F90.in ) -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) +process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_BINARY_DIR} clm_genf90_sources) sourcelist_to_parent(clm_genf90_sources) diff --git a/src/unit_test_stubs/main/CMakeLists.txt b/src/unit_test_stubs/main/CMakeLists.txt index b98156b5d0..e66a71488c 100644 --- a/src/unit_test_stubs/main/CMakeLists.txt +++ b/src/unit_test_stubs/main/CMakeLists.txt @@ -3,7 +3,7 @@ set(genf90_files ncdio_var.F90.in ) -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) +process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_BINARY_DIR} clm_genf90_sources) sourcelist_to_parent(clm_genf90_sources) diff --git a/src/unit_test_stubs/utils/CMakeLists.txt b/src/unit_test_stubs/utils/CMakeLists.txt index dc48aa9225..25f7c0c29f 100644 --- a/src/unit_test_stubs/utils/CMakeLists.txt +++ b/src/unit_test_stubs/utils/CMakeLists.txt @@ -2,7 +2,7 @@ set(genf90_files restUtilMod_stub.F90.in ) -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) +process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_BINARY_DIR} clm_genf90_sources) sourcelist_to_parent(clm_genf90_sources) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 47a2417c02..653fa9bb47 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -5,7 +5,7 @@ set(genf90_files array_utils.F90.in ) -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) +process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_BINARY_DIR} clm_genf90_sources) sourcelist_to_parent(clm_genf90_sources) diff --git a/src/utils/dtypes.h b/src/utils/dtypes.h deleted file mode 100644 index 977e95ad75..0000000000 --- a/src/utils/dtypes.h +++ /dev/null @@ -1,6 +0,0 @@ -#define TYPEDOUBLE 102 -#define TYPEINT 103 -#define TYPETEXT 100 -#define TYPELONG 104 -#define TYPEREAL 101 -#define TYPELOGICAL 105 From 58a6a2ebe8633ad5fabbda78bb44782cf294485f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 15 Oct 2020 15:10:56 -0600 Subject: [PATCH 1559/1973] Add a comment --- src/self_tests/TestNcdioPio.F90 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/self_tests/TestNcdioPio.F90 b/src/self_tests/TestNcdioPio.F90 index 5a3c314c33..c3d2a2dfa9 100644 --- a/src/self_tests/TestNcdioPio.F90 +++ b/src/self_tests/TestNcdioPio.F90 @@ -49,6 +49,22 @@ subroutine test_ncdio_pio(bounds) ! !DESCRIPTION: ! Drive tests of ncdio_pio ! + ! NOTE(wjs, 2020-10-15) Currently, endrun is called when any test assertion fails. I + ! thought about changing this so that, instead, a counter is incremented for each + ! failure, then at the end of the testing (in the higher-level self-test driver), + ! endrun is called if this counter is greater than 0. The benefit of this is that we'd + ! see all test failures, not just the first failure. To do that, we'd need to change + ! the assertions here to increment a counter rather than aborting. However, I'm not + ! spending the time to make this change for now because (1) I'm not sure how much + ! value we'd get from it; (2) even if we made that change, it's still very possible + ! for test code to abort for reasons other than assertions, if something goes wrong + ! inside ncdio_pio or pio; and (3) some tests here are dependent on earlier tests (for + ! example, the reads depend on the writes having worked), so a failure in an early + ! phase could really muck things up for later testing phases. Migrating to a + ! pFUnit-based unit test would solve this problem, since each pFUnit test is + ! independent, though would prevent us from being able to have dependent tests the + ! way we do here (where reads depend on earlier writes), for better or for worse. + ! ! !ARGUMENTS: type(bounds_type), intent(in) :: bounds ! From 0071378b9aab65ed67828aa0962b0ceec3009fd3 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 15 Oct 2020 15:58:55 -0600 Subject: [PATCH 1560/1973] remove workaround for 1730 --- src/main/histFileMod.F90 | 15 ++------------- src/main/ncdio_pio.F90.in | 21 +-------------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 22e5750f1e..99da038298 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -1954,17 +1954,6 @@ subroutine htape_create (t, histrest) lnfid => nfid(t) endif - ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for - ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 - ! - 1-d hist files have problems with pnetcdf. A better workaround in terms of - ! performance is to keep pnetcdf, but set PIO_BUFFER_SIZE_LIMIT=0, but that can't be - ! done on a per-file basis. - if (.not. tape(t)%dov2xy) then - avoid_pnetcdf = .true. - else - avoid_pnetcdf = .false. - end if - ! Create new netCDF file. It will be in define mode if ( .not. lhistrest )then @@ -1973,7 +1962,7 @@ subroutine htape_create (t, histrest) trim(locfnh(t)) call shr_sys_flush(iulog) end if - call ncd_pio_createfile(lnfid, trim(locfnh(t)), avoid_pnetcdf=avoid_pnetcdf) + call ncd_pio_createfile(lnfid, trim(locfnh(t))) call ncd_putatt(lnfid, ncd_global, 'title', 'CLM History file information' ) call ncd_putatt(lnfid, ncd_global, 'comment', & "NOTE: None of the variables are weighted by land fraction!" ) @@ -1983,7 +1972,7 @@ subroutine htape_create (t, histrest) trim(locfnhr(t)) call shr_sys_flush(iulog) end if - call ncd_pio_createfile(lnfid, trim(locfnhr(t)), avoid_pnetcdf=avoid_pnetcdf) + call ncd_pio_createfile(lnfid, trim(locfnhr(t))) call ncd_putatt(lnfid, ncd_global, 'title', & 'CLM Restart History information, required to continue a simulation' ) call ncd_putatt(lnfid, ncd_global, 'comment', & diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index bc3054fb11..fd743cad9d 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -226,7 +226,7 @@ contains end subroutine ncd_pio_closefile !----------------------------------------------------------------------- - subroutine ncd_pio_createfile(file, fname, avoid_pnetcdf) + subroutine ncd_pio_createfile(file, fname) ! ! !DESCRIPTION: ! Create a new NetCDF file with PIO @@ -238,32 +238,13 @@ contains class(file_desc_t), intent(inout) :: file ! PIO file descriptor character(len=*) , intent(in) :: fname ! File name to create - ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for - ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 - logical, intent(in), optional :: avoid_pnetcdf ! ! !LOCAL VARIABLES: - logical :: l_avoid_pnetcdf ! local version of avoid_pnetcdf integer :: my_io_type integer :: ierr !----------------------------------------------------------------------- - l_avoid_pnetcdf = .false. - if (present(avoid_pnetcdf)) then - l_avoid_pnetcdf = avoid_pnetcdf - end if - my_io_type = io_type - if (l_avoid_pnetcdf) then - if (my_io_type == pio_iotype_pnetcdf) then - my_io_type = pio_iotype_netcdf - if(pio_iotask_rank(pio_subsystem)==0 .and. masterproc) then - write(iulog,*) 'Workaround for bugz 1730: creating' - write(iulog,*) trim(fname) - write(iulog,*) 'with type netcdf instead of pnetcdf' - end if - end if - end if ierr = pio_createfile(pio_subsystem, file, my_io_type, fname, ior(PIO_CLOBBER,io_netcdf_format)) From 674254bf9eb0fcc7bc60e0c297c9ab34190832a4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 15 Oct 2020 16:25:13 -0600 Subject: [PATCH 1561/1973] Remove some unnecessary local variables --- src/main/histFileMod.F90 | 1 - src/main/ncdio_pio.F90.in | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 99da038298..1d7ae3bfc8 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -1924,7 +1924,6 @@ subroutine htape_create (t, histrest) integer :: numl ! total number of landunits across all processors integer :: numg ! total number of gridcells across all processors integer :: numa ! total number of atm cells across all processors - logical :: avoid_pnetcdf ! whether we should avoid using pnetcdf logical :: lhistrest ! local history restart flag type(file_desc_t), pointer :: lnfid ! local file id character(len= 8) :: curdate ! current date diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index fd743cad9d..f2f5440d28 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -240,13 +240,10 @@ contains ! ! !LOCAL VARIABLES: - integer :: my_io_type integer :: ierr !----------------------------------------------------------------------- - my_io_type = io_type - - ierr = pio_createfile(pio_subsystem, file, my_io_type, fname, ior(PIO_CLOBBER,io_netcdf_format)) + ierr = pio_createfile(pio_subsystem, file, io_type, fname, ior(PIO_CLOBBER,io_netcdf_format)) if(ierr/= PIO_NOERR) then call shr_sys_abort( ' ncd_pio_createfile ERROR: Failed to open file to write: '//trim(fname)) From f8c4f478ae439102f45f292b15ea779e9d90bf26 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 16 Oct 2020 14:51:14 -0600 Subject: [PATCH 1562/1973] Move pio_seterrorhandling call in single_column block The previous placement caused pts mode tests to fail, I think because oldhandle was undefined in the later call to reset the error handling. --- src/main/ncdio_pio.F90.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index bc3054fb11..b1e01bbd22 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1680,9 +1680,9 @@ contains start(2) = nt ; count(2) = 1 end if end if + call pio_seterrorhandling(ncid, PIO_BCAST_ERROR, oldhandle) #if ({ITYPE}==TYPELOGICAL) allocate(idata(size(data))) - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR, oldhandle) status = pio_get_var(ncid, varid, start(1:n), count(1:n), idata) data = (idata == 1) if ( any(idata /= 0 .and. idata /= 1) )then From 591727fcf1eef7c0587154f833ea95219d6aecf4 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 19 Oct 2020 12:42:57 -0600 Subject: [PATCH 1563/1973] adding the fields to restart and making defaults active --- src/biogeophys/CanopyStateType.F90 | 15 +++++++++++++-- src/biogeophys/PhotosynthesisMod.F90 | 9 ++++++++- src/biogeophys/WaterFluxBulkType.F90 | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/biogeophys/CanopyStateType.F90 b/src/biogeophys/CanopyStateType.F90 index 3da289b82c..19106882f3 100644 --- a/src/biogeophys/CanopyStateType.F90 +++ b/src/biogeophys/CanopyStateType.F90 @@ -249,11 +249,11 @@ subroutine InitHistory(this, bounds) this%vegwp_ln_patch(begp:endp,:) = spval call hist_addfld2d (fname='VEGWPLN', units='mm', type2d='nvegwcs', & avgflag='A', long_name='vegetation water matric potential for sun/sha canopy,xyl,root at local noon', & - ptr_patch=this%vegwp_ln_patch) + ptr_patch=this%vegwp_ln_patch, default='active') this%vegwp_pd_patch(begp:endp,:) = spval call hist_addfld2d (fname='VEGWPPD', units='mm', type2d='nvegwcs', avgflag='A', & long_name='predawn vegetation water matric potential for sun/sha canopy,xyl,root', & - ptr_patch=this%vegwp_pd_patch) + ptr_patch=this%vegwp_pd_patch, default='active') end if end subroutine InitHistory @@ -544,6 +544,17 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', long_name='sunlit fraction of canopy', units='', & interpinic_flag='interp', readvar=readvar, data=this%fsun_patch) + call restartvar(ncid=ncid, flag=flag, varname='VEGWPLN', xtype=ncd_double, & + dim1name='pft', dim2name='vegwcs', & + long_name='vegetation water matric potential for sun/sha canopy,xyl,root at local noon', units='mm', & + interpinic_flag='skip', readvar=readvar, data=this%vegwp_ln_patch) + + call restartvar(ncid=ncid, flag=flag, varname='VEGWPPD', xtype=ncd_double, & + dim1name='pft', dim2name='vegwcs', & + long_name='predawn vegetation water matric potential for sun/sha canopy,xyl,root', units='mm', & + interpinic_flag='skip', readvar=readvar, data=this%vegwp_pd_patch) + + if (flag=='read' )then do p = bounds%begp,bounds%endp if (shr_infnan_isnan(this%fsun_patch(p)) ) then diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 33d44a5f6f..946a8b25cf 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -380,7 +380,7 @@ subroutine InitHistory(this, bounds) this%vpd_can_patch(begp:endp) = spval call hist_addfld1d (fname='VPD_CAN', units='kPa', & avgflag='A', long_name='canopy vapor pressure deficit', & - ptr_patch=this%vpd_can_patch, set_spec=spval, default='inactive') + ptr_patch=this%vpd_can_patch, set_spec=spval, default='active') @@ -935,6 +935,13 @@ subroutine Restart(this, bounds, ncid, flag) units='umol/m2/s', & interpinic_flag='interp', readvar=readvar, data=this%lutpu25top_patch) + call restartvar(ncid=ncid, flag=flag, varname='VPD_CAN', xtype=ncd_double, & + dim1name='pft', long_name='canopy vapor pressure deficit', & + units='kPa', & + interpinic_flag='interp', readvar=readvar, data=this%vpd_can_patch) + + + end subroutine Restart !------------------------------------------------------------------------------ diff --git a/src/biogeophys/WaterFluxBulkType.F90 b/src/biogeophys/WaterFluxBulkType.F90 index cfdd365deb..eb0a1d3303 100644 --- a/src/biogeophys/WaterFluxBulkType.F90 +++ b/src/biogeophys/WaterFluxBulkType.F90 @@ -193,7 +193,7 @@ subroutine InitBulkHistory(this, bounds) units='mm/s', & avgflag='A', & long_name=this%info%lname('hydraulic redistribution'), & - ptr_patch=this%qflx_hydr_redist_patch, set_spec=spval, l2g_scale_type='veg', default='inactive') + ptr_patch=this%qflx_hydr_redist_patch, set_spec=spval, l2g_scale_type='veg', default='active') this%qflx_snowindunload_patch(begp:endp) = spval call hist_addfld1d ( & From 2f9acf11e57857f6292a53c5229c815afe0f7d56 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 20 Oct 2020 10:31:24 -0600 Subject: [PATCH 1564/1973] Consolidate duplicated read_darray dispatch code In addition to general goals of removing duplication, I wanted to do this to avoid having untested blocks (from untested permutations of the data type on file vs. dimensionality). --- src/main/ncdio_pio.F90.in | 84 +++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index b1e01bbd22..e3c1448a52 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -140,6 +140,12 @@ module ncdio_pio module procedure ncd_inqvdname_byName end interface + interface read_darray_dispatcher + !TYPE int,double,logical + !DIMS 1,2,3 + module procedure read_darray_{TYPE}_dispatcher_{DIMS} + end interface read_darray_dispatcher + private :: ncd_getiodesc ! obtain iodesc private :: scam_field_offsets ! get offset to proper lat/lon gridcell for SCAM @@ -1719,16 +1725,7 @@ contains if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) end if - if(xtype == PIO_INT) then - call read_darray_{TYPE}_from_int_1(ncid, vardesc, iodesc_plus%iodesc, varname, data) - elseif(xtype == PIO_REAL) then - call read_darray_{TYPE}_from_real_1(ncid, vardesc, iodesc_plus%iodesc, varname, data) - elseif(xtype == PIO_DOUBLE) then - call read_darray_{TYPE}_from_double_1(ncid, vardesc, iodesc_plus%iodesc, varname, data) - else - call shr_sys_abort(' ERROR: unrecognised type in read'//errMsg(sourcefile, __LINE__)) - - endif + call read_darray_dispatcher(ncid, vardesc, iodesc_plus%iodesc, varname, xtype, data) end if end if @@ -1920,15 +1917,7 @@ contains call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & xtype, iodnum, switchdim=.true.) iodesc_plus => iodesc_list(iodnum) - if(xtype == PIO_INT) then - call read_darray_{TYPE}_from_int_2(ncid, vardesc, iodesc_plus%iodesc, varname, temp) - elseif(xtype == PIO_REAL) then - call read_darray_{TYPE}_from_real_2(ncid, vardesc, iodesc_plus%iodesc, varname, temp) - elseif(xtype == PIO_DOUBLE) then - call read_darray_{TYPE}_from_double_2(ncid, vardesc, iodesc_plus%iodesc, varname, temp) - else - call shr_sys_abort(' ERROR: unrecognised type in read'//errMsg(sourcefile, __LINE__)) - endif + call read_darray_dispatcher(ncid, vardesc, iodesc_plus%iodesc, varname, xtype, temp) do j = lb2,ub2 do i = lb1,ub1 data(i,j) = temp(j,i) @@ -1938,16 +1927,8 @@ contains call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & xtype, iodnum) iodesc_plus => iodesc_list(iodnum) + call read_darray_dispatcher(ncid, vardesc, iodesc_plus%iodesc, varname, xtype, data) - if(xtype == PIO_INT) then - call read_darray_{TYPE}_from_int_2(ncid, vardesc, iodesc_plus%iodesc, varname, data) - elseif(xtype == PIO_REAL) then - call read_darray_{TYPE}_from_real_2(ncid, vardesc, iodesc_plus%iodesc, varname, data) - elseif(xtype == PIO_DOUBLE) then - call read_darray_{TYPE}_from_double_2(ncid, vardesc, iodesc_plus%iodesc, varname, data) - else - call shr_sys_abort(' ERROR: unrecognised type in read'//errMsg(sourcefile, __LINE__)) - endif end if end if #if ({ITYPE}==TYPEDOUBLE) @@ -2141,16 +2122,7 @@ contains if (present(nt)) then call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) end if - - if(xtype == PIO_INT) then - call read_darray_{TYPE}_from_int_3(ncid, vardesc, iodesc_plus%iodesc, varname, data) - elseif(xtype == PIO_REAL) then - call read_darray_{TYPE}_from_real_3(ncid, vardesc, iodesc_plus%iodesc, varname, data) - elseif(xtype == PIO_DOUBLE) then - call read_darray_{TYPE}_from_double_3(ncid, vardesc, iodesc_plus%iodesc, varname, data) - else - call shr_sys_abort(' ERROR: unrecognised type in read'//errMsg(sourcefile, __LINE__)) - endif + call read_darray_dispatcher(ncid, vardesc, iodesc_plus%iodesc, varname, xtype, data) end if end if @@ -2194,6 +2166,42 @@ contains end subroutine ncd_io_3d_{TYPE} + !----------------------------------------------------------------------- + !TYPE int,double,logical + !DIMS 1,2,3 + subroutine read_darray_{TYPE}_dispatcher_{DIMS}(ncid, vardesc, iodesc, varname, xtype, data) + ! + ! !DESCRIPTION: + ! Dispatch to the appropriate read_darray routine based on xtype (the type of var in file) + ! + ! !ARGUMENTS: + class(file_desc_t), intent(inout) :: ncid + type(var_desc_t), intent(inout) :: vardesc + type(io_desc_t), intent(inout) :: iodesc + character(len=*), intent(in) :: varname + integer, intent(in) :: xtype + {VTYPE}, pointer :: data{DIMSTR} + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'read_darray_{TYPE}_dispatcher_{DIMS}' + !----------------------------------------------------------------------- + + select case (xtype) + case (PIO_INT) + call read_darray_{TYPE}_from_int_{DIMS}(ncid, vardesc, iodesc, varname, data) + case (PIO_REAL) + call read_darray_{TYPE}_from_real_{DIMS}(ncid, vardesc, iodesc, varname, data) + case (PIO_DOUBLE) + call read_darray_{TYPE}_from_double_{DIMS}(ncid, vardesc, iodesc, varname, data) + case default + write(iulog,*) subname//' ERROR: unrecognized type in read: ', xtype + call shr_sys_abort(' ERROR: unrecognized type in read '//errMsg(sourcefile, __LINE__)) + end select + + end subroutine read_darray_{TYPE}_dispatcher_{DIMS} + + !------------------------------------------------------------------------ !TYPE int,double,logical !DIMS 1,2,3 From da18e129670ada3bb20393ee692fc54786a11965 Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Tue, 20 Oct 2020 14:07:59 -0600 Subject: [PATCH 1565/1973] adding use_hydrstress --- src/biogeophys/CanopyStateType.F90 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/biogeophys/CanopyStateType.F90 b/src/biogeophys/CanopyStateType.F90 index 19106882f3..8aa8a24f68 100644 --- a/src/biogeophys/CanopyStateType.F90 +++ b/src/biogeophys/CanopyStateType.F90 @@ -544,15 +544,6 @@ subroutine Restart(this, bounds, ncid, flag) dim1name='pft', long_name='sunlit fraction of canopy', units='', & interpinic_flag='interp', readvar=readvar, data=this%fsun_patch) - call restartvar(ncid=ncid, flag=flag, varname='VEGWPLN', xtype=ncd_double, & - dim1name='pft', dim2name='vegwcs', & - long_name='vegetation water matric potential for sun/sha canopy,xyl,root at local noon', units='mm', & - interpinic_flag='skip', readvar=readvar, data=this%vegwp_ln_patch) - - call restartvar(ncid=ncid, flag=flag, varname='VEGWPPD', xtype=ncd_double, & - dim1name='pft', dim2name='vegwcs', & - long_name='predawn vegetation water matric potential for sun/sha canopy,xyl,root', units='mm', & - interpinic_flag='skip', readvar=readvar, data=this%vegwp_pd_patch) if (flag=='read' )then @@ -569,6 +560,16 @@ subroutine Restart(this, bounds, ncid, flag) long_name='vegetation water matric potential', units='mm', & interpinic_flag='interp', readvar=readvar, data=this%vegwp_patch) + call restartvar(ncid=ncid, flag=flag, varname='VEGWPLN', xtype=ncd_double, & + dim1name='pft', dim2name='vegwcs', & + long_name='vegetation water matric potential for sun/sha canopy,xyl,root at local noon', units='mm', & + interpinic_flag='skip', readvar=readvar, data=this%vegwp_ln_patch) + + call restartvar(ncid=ncid, flag=flag, varname='VEGWPPD', xtype=ncd_double, & + dim1name='pft', dim2name='vegwcs', & + long_name='predawn vegetation water matric potential for sun/sha canopy,xyl,root', units='mm', & + interpinic_flag='skip', readvar=readvar, data=this%vegwp_pd_patch) + end if end subroutine Restart From e45e38d510120f38c4fd0d580d0b403debc3656f Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Wed, 21 Oct 2020 11:15:58 -0600 Subject: [PATCH 1566/1973] updating ChangeLog and ChangeSum --- doc/ChangeLog | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 106 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 0c28276286..57681b6566 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,109 @@ =============================================================== +Tag name: ctsm5.1.dev009 +Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) +Date: Wed Oct 21 11:14:25 MDT 2020 +One-line Summary: BFB changes for Perturbed Parameter Ensemble and Hydraulic redistribution + +Purpose of changes +------------------ + +Some BFB changes for PPE work and Hydraulic redistribution + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): [If none, remove this line] + - resolves ESCOMP/CTSM#881 + - resolves ESCOMP/CTSM#1020 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + - maxpatch_pft is removed from namelist + +Changes made to namelist defaults (e.g., changed parameter values): None + +Changes to the datasets (e.g., parameter, surface or initial files): None + +Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): None + +Changes to tests or testing: + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - None + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + +If the tag used for baseline comparisons was NOT the previous tag, note that here: N/A + + +Answer changes +-------------- + +Changes answers relative to baseline: + Four new fields regarding plant hydraulic processes has been added: + + - QHR (patch-level hydraulic redistribution) + - VEGWPLN (local noon vegetation water potential) + - VEGWPPD (predawn vegetation water potential) + - VPD_CAN: canopy vapor pressure deficit (functional input to Medlyn model) + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1187 +https://github.com/ESCOMP/CTSM/pull/1126 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev008 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Wed Oct 7 11:48:30 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 43dd86692d..28ba9a590f 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev009 negins 10/21/2020 BFB changes for Perturbed Parameter Ensemble and Hydraulic redistribution ctsm5.1.dev008 erik 10/07/2020 Two answer changes: Clm45/50/51 with crop, and for 2000Clm51 ctsm5.1.dev007 sacks 10/06/2020 CNFire: btran2 fixes and general cleanup ctsm5.1.dev006 sacks 10/03/2020 Call correct routine to calculate btran2 for CNFireLi2021 From 621e1e1668bf0a6a55f54dacee49409548e8b64f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 21 Oct 2020 15:24:53 -0600 Subject: [PATCH 1567/1973] Fixes to vertical level metadata I think these fixes are needed for init_interp's vertical interpolation to work correctly. --- src/main/initVerticalMod.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index 8ae1df2260..0af03df358 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -663,6 +663,11 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof col%z(c,1:nlevgrnd) = zsoi(1:nlevgrnd) col%zi(c,0:nlevgrnd) = zisoi(0:nlevgrnd) col%dz(c,1:nlevgrnd) = dzsoi(1:nlevgrnd) + if (nlevgrnd < nlevurb) then + col%z(c,nlevgrnd+1:nlevurb) = spval + col%zi(c,nlevgrnd+1:nlevurb) = spval + col%dz(c,nlevgrnd+1:nlevurb) = spval + end if end if end do @@ -689,7 +694,7 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof end if end do - do j = 1, nlevgrnd + do j = 1, nlevmaxurbgrnd do c = bounds%begc, bounds%endc if (col%z(c,j) == spval) then col%levgrnd_class(c,j) = ispval From cfdf6ff28a663eadfd2593c3c12d5e1c11134385 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 21 Oct 2020 16:01:32 -0600 Subject: [PATCH 1568/1973] Remove check_dim for levmaxurbgrnd Removing this check is largely for the sake of backwards compatibility (to support old restart files that do not have 'levmaxurbgrnd'). But in addition, that check seems unnecessary since we already check both levgrnd and levurb. --- src/main/restFileMod.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 8eb6d1d912..2371a3fc97 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -720,8 +720,11 @@ subroutine restFile_dimcheck( ncid ) call check_dim(ncid, 'levsno' , nlevsno, msg=msg) call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg) call check_dim(ncid, 'levurb' , nlevurb) - call check_dim(ncid, 'levmaxurbgrnd' , nlevmaxurbgrnd, msg=msg) call check_dim(ncid, 'levlak' , nlevlak) + ! NOTE(wjs, 2020-10-21) We deliberately do NOT check 'levmaxurbgrnd' against + ! nlevmaxurbgrnd. This is largely for the sake of backwards compatibility (to support + ! old restart files that do not have 'levmaxurbgrnd'). But in addition, that check + ! seems unnecessary since we already check both levgrnd and levurb. end subroutine restFile_dimcheck From 5b1e96856f09e9084c16a1a1fc9055ef7c198bbb Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 23 Oct 2020 14:50:25 -0600 Subject: [PATCH 1569/1973] Update ChangeLog --- doc/ChangeLog | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 132 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 57681b6566..80bbc4e759 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,135 @@ =============================================================== +Tag name: ctsm5.1.dev010 +Originator(s): sacks (Bill Sacks), jedwards (Jim Edwards) +Date: Fri Oct 23 14:36:03 MDT 2020 +One-line Summary: Fix reading netcdf variable into a different data type + +Purpose of changes +------------------ + +Main change is to fix the reading of a variable that is one type on a +NetCDF file but a different data type in memory. Previously, this could +lead to memory corruption (not just of the variable in question, but +other variables as well). This was not causing any problems in +out-of-the-box configurations, but it sometimes tripped up some +developers when they added new fields on datasets. + +In addition, this adds new self-test code to test ncdio_pio. This module +is hard to get under unit test, but we want to have some tests of it, to +pick up problems like the one fixed in this tag. So as a compromise +solution for now, I have introduced unit test-like tests that are built +into a standard build of CTSM and run in a standard run if a given +namelist flag is set. A better long-term solution would be to integrate +these tests into the pFUnit-based unit testing framework, but that would +take some work. I have added tests of the new code, and a bit of testing +of other code in ncdio_pio, but there's still a lot in ncdio_pio that is +not tested. I figure we can gradually add tests as we make changes to +ncdio_pio. + +Finally, an unrelated change to the unit test build: files generated by +genf90 now appear in the unit test build directory rather than the +source tree. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1091 (Memory corruption when reading a netcdf + variable into a variable of a different type, at least with PIO1) +- Resolves ESCOMP/CTSM#1188 (In unit test build: files generated by + genf90 should go in build dir rather than source dir) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- new namelist variable, for_testing_run_ncdiopio_tests + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- Ideally the ncdio_pio self-tests would be recoded as true unit tests, + leveraging the pFUnit framework. This would get them out of the main + source code, and would give other benefits that come with a real unit + testing framework, such as that a single failure doesn't abort the + entire test suite. +- The existence of tests for ncdio_pio should NOT be taken as a sign + that all (or even most) of this module is now under unit test: in + fact, much of it is not covered yet by my new testing module. + +Changes to tests or testing: +- Added a test that triggers for_testing_run_ncdiopio_tests + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1189 +https://github.com/ESCOMP/CTSM/pull/1176 (old version, superseded by 1189) + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev009 Originator(s): negins (Negin Sobhani,UCAR/TSS,303-497-1224) Date: Wed Oct 21 11:14:25 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 28ba9a590f..ea890c5781 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev010 sacks/je 10/23/2020 Fix reading netcdf variable into a different data type ctsm5.1.dev009 negins 10/21/2020 BFB changes for Perturbed Parameter Ensemble and Hydraulic redistribution ctsm5.1.dev008 erik 10/07/2020 Two answer changes: Clm45/50/51 with crop, and for 2000Clm51 ctsm5.1.dev007 sacks 10/06/2020 CNFire: btran2 fixes and general cleanup From 45a668077dcf078be24d31d5ed3f2116db63070f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 23 Oct 2020 16:29:57 -0600 Subject: [PATCH 1570/1973] Fix init_interp for levmaxurbgrnd Variables dimensioned by levtot now go all the way down to levmaxurbgrnd, not just levgrnd. --- .../initInterpMultilevelContainer.F90 | 250 +++++++++++++++--- 1 file changed, 207 insertions(+), 43 deletions(-) diff --git a/src/init_interp/initInterpMultilevelContainer.F90 b/src/init_interp/initInterpMultilevelContainer.F90 index 1c16518117..a67e3c7b5a 100644 --- a/src/init_interp/initInterpMultilevelContainer.F90 +++ b/src/init_interp/initInterpMultilevelContainer.F90 @@ -21,7 +21,7 @@ module initInterpMultilevelContainer use initInterpMultilevelSplit , only : interp_multilevel_split_type, create_interp_multilevel_split_type use initInterp2dvar , only : interp_2dvar_type use initInterp1dData , only : interp_1d_data - use ncdio_pio , only : file_desc_t, var_desc_t, check_var, ncd_io + use ncdio_pio , only : file_desc_t, var_desc_t, check_var, ncd_io, ncd_inqdlen, ncd_inqdid use clm_varctl , only : iulog use abortutils , only : endrun use shr_log_mod , only : errMsg => shr_log_errMsg @@ -46,6 +46,7 @@ module initInterpMultilevelContainer ! attribute.) type(interp_multilevel_copy_type), pointer :: interp_multilevel_copy type(interp_multilevel_interp_type), pointer :: interp_multilevel_levgrnd_col + type(interp_multilevel_interp_type), pointer :: interp_multilevel_levmaxurbgrnd_col type(interp_multilevel_interp_type), pointer :: interp_multilevel_levgrnd_pft type(interp_multilevel_snow_type), pointer :: interp_multilevel_levsno type(interp_multilevel_snow_type), pointer :: interp_multilevel_levsno1 @@ -60,7 +61,9 @@ module initInterpMultilevelContainer ! Private routines - private :: create_interp_multilevel_levgrnd + private :: create_levgrnd_col_interpolators + private :: create_levgrnd_pft_interpolator + private :: get_levmaxurbgrnd_metadata private :: interp_levgrnd_check_source_file private :: create_snow_interpolators @@ -80,9 +83,6 @@ function constructor(ncid_source, ncid_dest, bounds_source, bounds_dest, & ! !DESCRIPTION: ! Create an interp_multilevel_container_type instance. ! - ! !USES: - use ncdio_pio, only : file_desc_t - ! ! !ARGUMENTS: type(interp_multilevel_container_type) :: this ! function result type(file_desc_t), target, intent(inout) :: ncid_source ! netcdf ID for source file @@ -96,6 +96,9 @@ function constructor(ncid_source, ncid_dest, bounds_source, bounds_dest, & integer, intent(in) :: colindex(:) ! ! !LOCAL VARIABLES: + integer :: levgrnd_source ! size of the levgrnd dimension in source + integer :: levgrnd_dest ! size of the levgrnd dimension in dest + integer :: dimid ! dimension id character(len=*), parameter :: subname = 'constructor' !----------------------------------------------------------------------- @@ -103,25 +106,40 @@ function constructor(ncid_source, ncid_dest, bounds_source, bounds_dest, & allocate(this%interp_multilevel_copy) this%interp_multilevel_copy = interp_multilevel_copy_type() + call ncd_inqdlen(ncid_source, dimid, levgrnd_source, name='levgrnd') + call ncd_inqdlen(ncid_dest , dimid, levgrnd_dest , name='levgrnd') + + ! Note that there are two (often identical) interpolators for column-level levgrnd: + ! interp_multilevel_levgrnd_col is used for interpolating variables that are + ! dimensioned by levgrnd; interp_multilevel_levmaxurbgrnd_col is used as part of the + ! levtot interpolator for interpolating variables that are dimensioned by levtot, + ! because levtot is snow plus levmaxurbgrnd. If nlevgrnd >= nlevurb (which is often + ! the case), then these two are identical; however, if nlevgrnd < nlevurb for source + ! and/or destination, then interp_multilevel_levmaxurbgrnd_col will have additional + ! levels beyond those in interp_multilevel_levgrnd_col. allocate(this%interp_multilevel_levgrnd_col) - this%interp_multilevel_levgrnd_col = create_interp_multilevel_levgrnd( & + allocate(this%interp_multilevel_levmaxurbgrnd_col) + call create_levgrnd_col_interpolators( & ncid_source = ncid_source, & ncid_dest = ncid_dest, & bounds_source = bounds_source, & bounds_dest = bounds_dest, & - coord_varname = 'COL_Z', & - level_class_varname = 'LEVGRND_CLASS', & - sgridindex = colindex) + levgrnd_source = levgrnd_source, & + levgrnd_dest = levgrnd_dest, & + colindex = colindex, & + interp_multilevel_levgrnd_col = this%interp_multilevel_levgrnd_col, & + interp_multilevel_levmaxurbgrnd_col = this%interp_multilevel_levmaxurbgrnd_col) allocate(this%interp_multilevel_levgrnd_pft) - this%interp_multilevel_levgrnd_pft = create_interp_multilevel_levgrnd( & + call create_levgrnd_pft_interpolator( & ncid_source = ncid_source, & ncid_dest = ncid_dest, & bounds_source = bounds_source, & bounds_dest = bounds_dest, & - coord_varname = 'COL_Z_p', & - level_class_varname = 'LEVGRND_CLASS_p', & - sgridindex = pftindex) + levgrnd_source = levgrnd_source, & + levgrnd_dest = levgrnd_dest, & + pftindex = pftindex, & + interp_multilevel_levgrnd_pft = this%interp_multilevel_levgrnd_pft) allocate(this%interp_multilevel_levsno) allocate(this%interp_multilevel_levsno1) @@ -133,13 +151,14 @@ function constructor(ncid_source, ncid_dest, bounds_source, bounds_dest, & bounds_dest = bounds_dest, & colindex = colindex) - ! levtot is two sets of levels: first snow, then levgrnd + ! levtot is two sets of levels: first snow, then levmaxurbgrnd (where levmaxurbgrnd = + ! max(levgrnd, levurb)) allocate(this%interp_multilevel_levtot_col) this%interp_multilevel_levtot_col = create_interp_multilevel_split_type( & interpolator_first_levels = this%find_interpolator('levsno', 'column'), & - interpolator_second_levels = this%interp_multilevel_levgrnd_col, & - num_second_levels_source = this%interp_multilevel_levgrnd_col%get_nlev_source(), & - num_second_levels_dest = this%interp_multilevel_levgrnd_col%get_nlev_dest()) + interpolator_second_levels = this%interp_multilevel_levmaxurbgrnd_col, & + num_second_levels_source = this%interp_multilevel_levmaxurbgrnd_col%get_nlev_source(), & + num_second_levels_dest = this%interp_multilevel_levmaxurbgrnd_col%get_nlev_dest()) end function constructor @@ -178,6 +197,16 @@ function find_interpolator(this, lev_dimname, vec_dimname) result(interpolator) case default call error_not_found(subname, lev_dimname, vec_dimname) end select + case ('levmaxurbgrnd') + select case (vec_dimname) + case ('column') + ! NOTE(wjs, 2020-10-23) Currently, no variables use this interpolator, but we + ! need it as part of the levtot interpolator, so we might as well support it as + ! a standalone interpolator in case it's needed in the future. + interpolator => this%interp_multilevel_levmaxurbgrnd_col + case default + call error_not_found(subname, lev_dimname, vec_dimname) + end select case ('levtot') select case (vec_dimname) case ('column') @@ -213,19 +242,121 @@ end function find_interpolator ! ======================================================================== !----------------------------------------------------------------------- - function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & - bounds_source, bounds_dest, & - coord_varname, level_class_varname, & - sgridindex) & - result(interpolator) + subroutine create_levgrnd_col_interpolators(ncid_source, ncid_dest, & + bounds_source, bounds_dest, colindex, levgrnd_source, levgrnd_dest, & + interp_multilevel_levgrnd_col, interp_multilevel_levmaxurbgrnd_col) ! ! !DESCRIPTION: - ! Create the interpolator used to interpolate variables dimensioned by levgrnd + ! Create the interp_multilevel_levgrnd_col and interp_multilevel_levmaxurbgrnd_col interpolators ! - ! !USES: + ! !ARGUMENTS: + type(file_desc_t), target, intent(inout) :: ncid_source + type(file_desc_t), target, intent(inout) :: ncid_dest + type(interp_bounds_type), intent(in) :: bounds_source + type(interp_bounds_type), intent(in) :: bounds_dest + integer, intent(in) :: colindex(:) ! mappings from column-level source to dest points + integer, intent(in) :: levgrnd_source ! size of the levgrnd dimension in source + integer, intent(in) :: levgrnd_dest ! size of the levgrnd dimension in dest + type(interp_multilevel_interp_type), intent(out) :: interp_multilevel_levgrnd_col + type(interp_multilevel_interp_type), intent(out) :: interp_multilevel_levmaxurbgrnd_col + ! + ! !LOCAL VARIABLES: + real(r8), allocatable :: coordinates_source(:,:) ! [lev, vec] + real(r8), allocatable :: coordinates_dest(:,:) ! [lev, vec] + integer , allocatable :: level_classes_source(:,:) ! [lev, vec] + integer , allocatable :: level_classes_dest(:,:) ! [lev, vec] + + character(len=*), parameter :: subname = 'create_levgrnd_col_interpolators' + !----------------------------------------------------------------------- + + call get_levmaxurbgrnd_metadata( & + ncid_source = ncid_source, & + ncid_dest = ncid_dest, & + bounds_source = bounds_source, & + bounds_dest = bounds_dest, & + coord_varname = 'COL_Z', & + level_class_varname = 'LEVGRND_CLASS', & + sgridindex = colindex, & + coordinates_source = coordinates_source, & + coordinates_dest = coordinates_dest, & + level_classes_source = level_classes_source, & + level_classes_dest = level_classes_dest) + + interp_multilevel_levmaxurbgrnd_col = interp_multilevel_interp_type( & + coordinates_source = coordinates_source, & + coordinates_dest = coordinates_dest, & + level_classes_source = level_classes_source, & + level_classes_dest = level_classes_dest, & + coord_varname = 'COL_Z') + + interp_multilevel_levgrnd_col = interp_multilevel_interp_type( & + coordinates_source = coordinates_source(1:levgrnd_source, :), & + coordinates_dest = coordinates_dest(1:levgrnd_dest, :), & + level_classes_source = level_classes_source(1:levgrnd_source, :), & + level_classes_dest = level_classes_dest(1:levgrnd_dest, :), & + coord_varname = 'COL_Z down to levgrnd') + + end subroutine create_levgrnd_col_interpolators + + !----------------------------------------------------------------------- + subroutine create_levgrnd_pft_interpolator(ncid_source, ncid_dest, & + bounds_source, bounds_dest, pftindex, levgrnd_source, levgrnd_dest, & + interp_multilevel_levgrnd_pft) + ! + ! !DESCRIPTION: + ! Create the interp_multilevel_levgrnd_pft interpolator + ! + ! !ARGUMENTS: + type(file_desc_t), target, intent(inout) :: ncid_source + type(file_desc_t), target, intent(inout) :: ncid_dest + type(interp_bounds_type), intent(in) :: bounds_source + type(interp_bounds_type), intent(in) :: bounds_dest + integer, intent(in) :: pftindex(:) ! mappings from patch-level source to dest points + integer, intent(in) :: levgrnd_source ! size of the levgrnd dimension in source + integer, intent(in) :: levgrnd_dest ! size of the levgrnd dimension in dest + type(interp_multilevel_interp_type), intent(out) :: interp_multilevel_levgrnd_pft + ! + ! !LOCAL VARIABLES: + real(r8), allocatable :: coordinates_source(:,:) ! [lev, vec] + real(r8), allocatable :: coordinates_dest(:,:) ! [lev, vec] + integer , allocatable :: level_classes_source(:,:) ! [lev, vec] + integer , allocatable :: level_classes_dest(:,:) ! [lev, vec] + + character(len=*), parameter :: subname = 'create_levgrnd_pft_interpolator' + !----------------------------------------------------------------------- + + call get_levmaxurbgrnd_metadata( & + ncid_source = ncid_source, & + ncid_dest = ncid_dest, & + bounds_source = bounds_source, & + bounds_dest = bounds_dest, & + coord_varname = 'COL_Z_p', & + level_class_varname = 'LEVGRND_CLASS_p', & + sgridindex = pftindex, & + coordinates_source = coordinates_source, & + coordinates_dest = coordinates_dest, & + level_classes_source = level_classes_source, & + level_classes_dest = level_classes_dest) + + interp_multilevel_levgrnd_pft = interp_multilevel_interp_type( & + coordinates_source = coordinates_source(1:levgrnd_source, :), & + coordinates_dest = coordinates_dest(1:levgrnd_dest, :), & + level_classes_source = level_classes_source(1:levgrnd_source, :), & + level_classes_dest = level_classes_dest(1:levgrnd_dest, :), & + coord_varname = 'COL_Z_p down to levgrnd') + + end subroutine create_levgrnd_pft_interpolator + + !----------------------------------------------------------------------- + subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & + bounds_source, bounds_dest, & + coord_varname, level_class_varname, sgridindex, & + coordinates_source, coordinates_dest, level_classes_source, level_classes_dest) + ! + ! !DESCRIPTION: + ! Get coordinate and level class metadata for the levmaxurbgrnd dimension ! ! !ARGUMENTS: - type(interp_multilevel_interp_type) :: interpolator ! function result type(file_desc_t), target, intent(inout) :: ncid_source type(file_desc_t), target, intent(inout) :: ncid_dest type(interp_bounds_type), intent(in) :: bounds_source @@ -233,6 +364,12 @@ function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & character(len=*), intent(in) :: coord_varname character(len=*), intent(in) :: level_class_varname integer, intent(in) :: sgridindex(:) ! mappings from source to dest points for the appropriate subgrid level (e.g., column-level mappings if this interpolator is for column-level data) + + ! The following output arrays are all allocated in this subroutine: + real(r8), allocatable, intent(out) :: coordinates_source(:,:) ! [lev, vec] + real(r8), allocatable, intent(out) :: coordinates_dest(:,:) ! [lev, vec] + integer , allocatable, intent(out) :: level_classes_source(:,:) ! [lev, vec] + integer , allocatable, intent(out) :: level_classes_dest(:,:) ! [lev, vec] ! ! !LOCAL VARIABLES: type(interp_2dvar_type) :: coord_source @@ -245,10 +382,12 @@ function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & integer , pointer :: level_class_data_source_sgrid_1d(:) ! [vec] On the source grid integer , allocatable :: level_class_data_source(:,:) ! [vec, lev] Interpolated to the dest grid, but source vertical grid integer , pointer :: level_class_data_dest(:,:) ! [vec, lev] Dest horiz & vertical grid - real(r8), allocatable :: coord_data_source_transpose(:,:) ! [lev, vec] - real(r8), allocatable :: coord_data_dest_transpose(:,:) ! [lev, vec] - integer , allocatable :: level_class_data_source_transpose(:,:) ! [lev, vec] - integer , allocatable :: level_class_data_dest_transpose(:,:) ! [lev, vec] + + integer :: dimid ! netcdf dimension id + logical :: dimexist ! whether the given dimension exists on file + + integer :: levmaxurbgrnd_source ! length of levmaxurbgrnd dimension on source file + integer :: levmaxurbgrnd_dest ! length of levmaxurbgrnd dimension on dest file integer :: beg_dest integer :: end_dest @@ -258,9 +397,25 @@ function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & integer :: level integer :: nlev_source - character(len=*), parameter :: subname = 'create_interp_multilevel_levgrnd' + character(len=*), parameter :: levmaxurbgrnd_name = 'levmaxurbgrnd' + + character(len=*), parameter :: subname = 'get_levmaxurbgrnd_metadata' !----------------------------------------------------------------------- + ! Get levmaxurbgrnd dimension size on source and dest + ! BACKWARDS_COMPATIBILITY(wjs, 2020-10-22) On older initial conditions files, + ! levmaxurbgrnd doesn't exist, but we can use levgrnd for the same purpose because + ! prior to the existence of levmaxurbgrnd, it was always the case that levgrnd >= + ! levurb. + call ncd_inqdid(ncid_source, levmaxurbgrnd_name, dimid, dimexist) + if (dimexist) then + call ncd_inqdlen(ncid_source, dimid, levmaxurbgrnd_source) + else + call ncd_inqdlen(ncid_source, dimid, levmaxurbgrnd_source, name='levgrnd') + end if + ! For dest, we can assume this dimension exists + call ncd_inqdlen(ncid_dest, dimid, levmaxurbgrnd_dest, name=levmaxurbgrnd_name) + ! Set coord_data_dest coord_dest = interp_2dvar_type( & varname = coord_varname, & @@ -272,6 +427,10 @@ function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & ! match can be found for the generic subprogram call "READVAR"'. So we ! explicitly call the specific routine, rather than calling readvar. call coord_dest%readvar_double(coord_data_dest) + call shr_assert(coord_dest%get_nlev() == levmaxurbgrnd_dest, & + msg = 'dest '//coord_varname//' dimension length does not match expected levmaxurbgrnd size', & + file = sourcefile, & + line = __LINE__) beg_dest = coord_dest%get_vec_beg() end_dest = coord_dest%get_vec_end() @@ -286,6 +445,10 @@ function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & ! match can be found for the generic subprogram call "READVAR"'. So we ! explicitly call the specific routine, rather than calling readvar. call level_class_dest%readvar_int(level_class_data_dest) + call shr_assert(level_class_dest%get_nlev() == levmaxurbgrnd_dest, & + msg = 'dest '//level_class_varname//' dimension length does not match expected levmaxurbgrnd size', & + file = sourcefile, & + line = __LINE__) SHR_ASSERT(level_class_dest%get_vec_beg() == beg_dest, errMsg(sourcefile, __LINE__)) SHR_ASSERT(level_class_dest%get_vec_end() == end_dest, errMsg(sourcefile, __LINE__)) @@ -302,6 +465,10 @@ function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & ncid = ncid_source, & file_is_dest = .false., & bounds = bounds_source) + call shr_assert(coord_source%get_nlev() == levmaxurbgrnd_source, & + msg = 'source '//coord_varname//' dimension length does not match expected levmaxurbgrnd size', & + file = sourcefile, & + line = __LINE__) nlev_source = coord_source%get_nlev() beg_source = coord_source%get_vec_beg() end_source = coord_source%get_vec_end() @@ -329,7 +496,10 @@ function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & ncid = ncid_source, & file_is_dest = .false., & bounds = bounds_source) - SHR_ASSERT(level_class_source%get_nlev() == nlev_source, errMsg(sourcefile, __LINE__)) + call shr_assert(level_class_source%get_nlev() == levmaxurbgrnd_source, & + msg = 'source '//level_class_varname//' dimension length does not match expected levmaxurbgrnd size', & + file = sourcefile, & + line = __LINE__) SHR_ASSERT(level_class_source%get_vec_beg() == beg_source, errMsg(sourcefile, __LINE__)) SHR_ASSERT(level_class_source%get_vec_end() == end_source, errMsg(sourcefile, __LINE__)) allocate(level_class_data_source(beg_dest:end_dest, nlev_source)) @@ -350,23 +520,17 @@ function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & end do deallocate(level_class_data_source_sgrid_1d) - ! Create interpolator - call transpose_wrapper(coord_data_source_transpose, coord_data_source) - call transpose_wrapper(coord_data_dest_transpose, coord_data_dest) - call transpose_wrapper(level_class_data_source_transpose, level_class_data_source) - call transpose_wrapper(level_class_data_dest_transpose, level_class_data_dest) - interpolator = interp_multilevel_interp_type( & - coordinates_source = coord_data_source_transpose, & - coordinates_dest = coord_data_dest_transpose, & - level_classes_source = level_class_data_source_transpose, & - level_classes_dest = level_class_data_dest_transpose, & - coord_varname = coord_varname) + ! Set output arrays + call transpose_wrapper(coordinates_source, coord_data_source) + call transpose_wrapper(coordinates_dest, coord_data_dest) + call transpose_wrapper(level_classes_source, level_class_data_source) + call transpose_wrapper(level_classes_dest, level_class_data_dest) ! Deallocate pointers (allocatables are automatically deallocated) deallocate(coord_data_dest) deallocate(level_class_data_dest) - end function create_interp_multilevel_levgrnd + end subroutine get_levmaxurbgrnd_metadata !----------------------------------------------------------------------- subroutine interp_levgrnd_check_source_file(ncid_source, coord_varname, level_class_varname) From 948eb17616ea29e1b821138e9b23de0037245e9b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 27 Oct 2020 06:10:10 -0600 Subject: [PATCH 1571/1973] Make vardesc arg of check_var optional Some callers didn't want this, and making this optional will assist with some upcoming changes. --- .../initInterpMultilevelContainer.F90 | 6 ++--- src/main/ncdio_pio.F90.in | 22 +++++++++++-------- src/main/paramUtilMod.F90 | 2 +- src/main/surfrdMod.F90 | 9 +++----- src/self_tests/TestNcdioPio.F90 | 2 +- .../main/ncdio_pio_fake.F90.in | 15 +++++++------ 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/init_interp/initInterpMultilevelContainer.F90 b/src/init_interp/initInterpMultilevelContainer.F90 index 732108e6e4..d27f7591de 100644 --- a/src/init_interp/initInterpMultilevelContainer.F90 +++ b/src/init_interp/initInterpMultilevelContainer.F90 @@ -545,19 +545,17 @@ subroutine interp_levgrnd_check_source_file(ncid_source, coord_varname, level_cl ! !LOCAL VARIABLES: logical :: coord_on_source logical :: level_class_on_source - type(var_desc_t) :: coord_source_vardesc ! unused, but needed for check_var interface - type(var_desc_t) :: level_class_source_vardesc ! unused, but needed for check_var interface character(len=:), allocatable :: variables_missing character(len=*), parameter :: subname = 'interp_levgrnd_check_source_file' !----------------------------------------------------------------------- variables_missing = ' ' - call check_var(ncid_source, coord_varname, coord_source_vardesc, coord_on_source) + call check_var(ncid_source, coord_varname, coord_on_source) if (.not. coord_on_source) then variables_missing = variables_missing // coord_varname // ' ' end if - call check_var(ncid_source, level_class_varname, level_class_source_vardesc, level_class_on_source) + call check_var(ncid_source, level_class_varname, level_class_on_source) if (.not. level_class_on_source) then variables_missing = variables_missing // level_class_varname // ' ' end if diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index e3c1448a52..a4ce4a3c6c 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -282,21 +282,22 @@ contains end subroutine ncd_pio_createfile !----------------------------------------------------------------------- - subroutine check_var(ncid, varname, vardesc, readvar, print_err ) + subroutine check_var(ncid, varname, readvar, vardesc, print_err ) ! ! !DESCRIPTION: ! Check if variable is on netcdf file ! ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor - character(len=*) , intent(in) :: varname ! Varible name to check - type(Var_desc_t) , intent(out) :: vardesc ! Output variable descriptor - logical , intent(out) :: readvar ! If variable exists or not - logical, optional , intent(in) :: print_err ! If should print about error + class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor + character(len=*) , intent(in) :: varname ! Varible name to check + logical , intent(out) :: readvar ! If variable exists or not + type(Var_desc_t) , optional, intent(out) :: vardesc ! Output variable descriptor (if desired) + logical , optional, intent(in) :: print_err ! If should print about error ! ! !LOCAL VARIABLES: integer :: ret ! return value logical :: log_err ! if should log error + type(Var_desc_t) :: vardesc_local character(len=*),parameter :: subname='check_var' ! subroutine name !----------------------------------------------------------------------- @@ -308,7 +309,10 @@ contains end if readvar = .true. call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - ret = PIO_inq_varid (ncid, varname, vardesc) + ret = PIO_inq_varid (ncid, varname, vardesc_local) + if (present(vardesc)) then + vardesc = vardesc_local + end if if (ret /= PIO_noerr) then readvar = .false. if (masterproc .and. log_err) & @@ -757,7 +761,7 @@ contains integer, parameter :: error_variable_not_found = 11 !----------------------------------------------------------------------- - call check_var(ncid, varname, vardesc, readvar) + call check_var(ncid, varname, readvar, vardesc=vardesc) if (readvar) then call ncd_inqvdlen_byDesc(ncid, vardesc, dimnum, dlen, err_code) else @@ -846,7 +850,7 @@ contains character(len=*), parameter :: subname = 'ncd_inqvdname_byName' !----------------------------------------------------------------------- - call check_var(ncid, varname, vardesc, readvar) + call check_var(ncid, varname, readvar, vardesc=vardesc) if (readvar) then call ncd_inqvdname_byDesc(ncid, vardesc, dimnum, dname, err_code) else diff --git a/src/main/paramUtilMod.F90 b/src/main/paramUtilMod.F90 index 96c95440e7..ac6845fc01 100644 --- a/src/main/paramUtilMod.F90 +++ b/src/main/paramUtilMod.F90 @@ -265,7 +265,7 @@ subroutine checkDimensions(ncid, varName, expected_numDims, expected_dimNames, c integer :: d, num_dims character(len=256) :: msg - call check_var(ncid, varName, var_desc, readvar) + call check_var(ncid, varName, readvar, vardesc=var_desc) if (readvar) then call ncd_inqvdims(ncid, num_dims, var_desc) if (num_dims /= expected_numDims) then diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index 5f980bd2b2..4901425dbc 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -71,7 +71,6 @@ subroutine surfrd_get_globmask(filename, mask, ni, nj) integer :: n,i,j ! index integer :: ier ! error status type(file_desc_t) :: ncid ! netcdf id - type(var_desc_t) :: vardesc ! variable descriptor character(len=256) :: varname ! variable name character(len=256) :: locfn ! local file name logical :: readvar ! read variable in or not @@ -154,7 +153,6 @@ subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) ! ! !LOCAL VARIABLES: type(file_desc_t) :: ncid ! netcdf id - type(var_desc_t) :: vardesc ! variable descriptor integer :: beg ! local beg index integer :: end ! local end index integer :: ni,nj,ns ! size of grid on file @@ -189,7 +187,7 @@ subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) call domain_init(ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) ! Determine type of file - old style grid file or new style domain file - call check_var(ncid=ncid, varname='xc', vardesc=vardesc, readvar=readvar) + call check_var(ncid=ncid, varname='xc', readvar=readvar) if (readvar)then istype_domain = .true. else @@ -303,7 +301,6 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) character(len=*), intent(in) :: lfsurdat ! surface dataset filename ! ! !LOCAL VARIABLES: - type(var_desc_t) :: vardesc ! pio variable descriptor type(domain_type) :: surfdata_domain ! local domain associated with surface dataset character(len=256):: locfn ! local file name integer, parameter :: n_dom_urban = 1 ! # of dominant urban landunits @@ -344,11 +341,11 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) ! Check if fsurdat grid is "close" to fatmlndfrc grid, exit if lats/lon > 0.001 - call check_var(ncid=ncid, varname='xc', vardesc=vardesc, readvar=readvar) + call check_var(ncid=ncid, varname='xc', readvar=readvar) if (readvar) then istype_domain = .true. else - call check_var(ncid=ncid, varname='LONGXY', vardesc=vardesc, readvar=readvar) + call check_var(ncid=ncid, varname='LONGXY', readvar=readvar) if (readvar) then istype_domain = .false. else diff --git a/src/self_tests/TestNcdioPio.F90 b/src/self_tests/TestNcdioPio.F90 index c3d2a2dfa9..b467431cbe 100644 --- a/src/self_tests/TestNcdioPio.F90 +++ b/src/self_tests/TestNcdioPio.F90 @@ -264,7 +264,7 @@ subroutine confirm_var_on_file(ncid, varname, expected_type) character(len=*), parameter :: subname = 'check_var_written' !----------------------------------------------------------------------- - call check_var(ncid, varname, vardesc, readvar) + call check_var(ncid, varname, readvar, vardesc=vardesc) if (.not. readvar) then call endrun(trim(varname)//' not found on file') end if diff --git a/src/unit_test_stubs/main/ncdio_pio_fake.F90.in b/src/unit_test_stubs/main/ncdio_pio_fake.F90.in index 2fa421051d..482e622bd6 100644 --- a/src/unit_test_stubs/main/ncdio_pio_fake.F90.in +++ b/src/unit_test_stubs/main/ncdio_pio_fake.F90.in @@ -270,25 +270,26 @@ contains end subroutine ncd_inqvid !----------------------------------------------------------------------- - subroutine check_var(ncid, varname, vardesc, readvar, print_err) + subroutine check_var(ncid, varname, readvar, vardesc, print_err) ! ! !DESCRIPTION: ! Fake to check if variable is on netcdf file ! ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor - character(len=*) , intent(in) :: varname ! Varible name to check - type(Var_desc_t) , intent(out) :: vardesc ! Output variable descriptor (not set in this implementation) - logical , intent(out) :: readvar ! If variable exists or not - logical, optional , intent(in) :: print_err ! If should print about error (ignored in this implementation) + class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor + character(len=*) , intent(in) :: varname ! Varible name to check + logical , intent(out) :: readvar ! If variable exists or not + type(Var_desc_t) , optional, intent(out) :: vardesc ! Output variable descriptor (not set in this implementation) + logical , optional, intent(in) :: print_err ! If should print about error (ignored in this implementation) ! ! !LOCAL VARIABLES: integer :: varid + type(Var_desc_t) :: vardesc_local character(len=*), parameter :: subname = 'check_var' !----------------------------------------------------------------------- - call ncd_inqvid(ncid, varname, varid, vardesc, readvar) + call ncd_inqvid(ncid, varname, varid, vardesc_local, readvar) end subroutine check_var From a6fabb4ae7b51c3e40dd5348a45e48f04663fac4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 27 Oct 2020 06:19:55 -0600 Subject: [PATCH 1572/1973] Rename check_dim to check_dim_size This is so I can add a check_dim that has symmetry with check_var --- src/biogeochem/SatellitePhenologyMod.F90 | 2 +- src/dyn_subgrid/dyncropFileMod.F90 | 4 ++-- src/dyn_subgrid/dynlakeFileMod.F90 | 3 --- src/dyn_subgrid/dynpftFileMod.F90 | 2 +- src/main/ncdio_pio.F90.in | 8 ++++---- src/main/restFileMod.F90 | 18 +++++++++--------- src/main/surfrdMod.F90 | 14 +++++++------- 7 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 62cc027641..cd03a742a8 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -551,7 +551,7 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns call endrun(msg=errMsg(sourcefile, __LINE__)) end if - call check_dim(ncid, 'lsmpft', maxsoil_patches) + call check_dim_size(ncid, 'lsmpft', maxsoil_patches) if (single_column) then call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & diff --git a/src/dyn_subgrid/dyncropFileMod.F90 b/src/dyn_subgrid/dyncropFileMod.F90 index 0d27cf8bfc..4ea7a4ff12 100644 --- a/src/dyn_subgrid/dyncropFileMod.F90 +++ b/src/dyn_subgrid/dyncropFileMod.F90 @@ -53,7 +53,7 @@ subroutine dyncrop_init(bounds, dyncrop_filename) ! ! !USES: use clm_varpar , only : cft_size - use ncdio_pio , only : check_dim + use ncdio_pio , only : check_dim_size use dynTimeInfoMod , only : YEAR_POSITION_START_OF_TIMESTEP ! ! !ARGUMENTS: @@ -80,7 +80,7 @@ subroutine dyncrop_init(bounds, dyncrop_filename) ! prognostically, if crop areas are ever determined prognostically rather than ! prescribed ahead of time. dyncrop_file = dyn_file_type(dyncrop_filename, YEAR_POSITION_START_OF_TIMESTEP) - call check_dim(dyncrop_file, 'cft', cft_size) + call check_dim_size(dyncrop_file, 'cft', cft_size) ! read data PCT_CROP and PCT_CFT corresponding to correct year ! diff --git a/src/dyn_subgrid/dynlakeFileMod.F90 b/src/dyn_subgrid/dynlakeFileMod.F90 index 17b21484fd..317f98ec75 100644 --- a/src/dyn_subgrid/dynlakeFileMod.F90 +++ b/src/dyn_subgrid/dynlakeFileMod.F90 @@ -45,10 +45,7 @@ subroutine dynlake_init(bounds, dynlake_filename) ! samples that bound the initial model date) ! ! !USES: - use ncdio_pio , only : check_dim use dynTimeInfoMod , only : YEAR_POSITION_START_OF_TIMESTEP - - ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds ! proc-level bounds diff --git a/src/dyn_subgrid/dynpftFileMod.F90 b/src/dyn_subgrid/dynpftFileMod.F90 index 3d50ee740b..836b3cd6ee 100644 --- a/src/dyn_subgrid/dynpftFileMod.F90 +++ b/src/dyn_subgrid/dynpftFileMod.F90 @@ -78,7 +78,7 @@ subroutine dynpft_init(bounds, dynpft_filename) dynpft_file = dyn_file_type(dynpft_filename, YEAR_POSITION_START_OF_TIMESTEP) ! Consistency checks - call check_dim(dynpft_file, 'natpft', natpft_size) + call check_dim_size(dynpft_file, 'natpft', natpft_size) call dynpft_check_consistency(bounds) ! read data PCT_NAT_PFT corresponding to correct year diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index a4ce4a3c6c..b3b208cda9 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -45,7 +45,7 @@ module ncdio_pio ! public :: check_var ! determine if variable is on netcdf file public :: check_att ! check if attribute is on file - public :: check_dim ! validity check on dimension + public :: check_dim_size ! validity check on dimension public :: ncd_pio_openfile ! open a file public :: ncd_pio_createfile ! create a new file public :: ncd_pio_closefile ! close a file @@ -355,7 +355,7 @@ contains end subroutine check_att !----------------------------------------------------------------------- - subroutine check_dim(ncid, dimname, value, msg) + subroutine check_dim_size(ncid, dimname, value, msg) ! ! !DESCRIPTION: ! Validity check on dimension @@ -370,7 +370,7 @@ contains ! !LOCAL VARIABLES: integer :: dimid, dimlen ! temporaries integer :: status ! error code - character(len=*),parameter :: subname='check_dim' ! subroutine name + character(len=*),parameter :: subname='check_dim_size' ! subroutine name !----------------------------------------------------------------------- status = pio_inq_dimid (ncid, trim(dimname), dimid) @@ -384,7 +384,7 @@ contains call shr_sys_abort(errMsg(sourcefile, __LINE__)) end if - end subroutine check_dim + end subroutine check_dim_size !----------------------------------------------------------------------- subroutine ncd_redef(ncid) diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 567e75d82f..fb5223ad8b 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -21,7 +21,7 @@ module restFileMod use clm_varctl , only : create_crop_landunit, irrigate use clm_varcon , only : nameg, namel, namec, namep, nameCohort use ncdio_pio , only : file_desc_t, ncd_pio_createfile, ncd_pio_openfile, ncd_global - use ncdio_pio , only : ncd_pio_closefile, ncd_defdim, ncd_putatt, ncd_enddef, check_dim + use ncdio_pio , only : ncd_pio_closefile, ncd_defdim, ncd_putatt, ncd_enddef, check_dim_size use ncdio_pio , only : check_att, ncd_getatt use glcBehaviorMod , only : glc_behavior_type use reweightMod , only : reweight_wrapup @@ -784,17 +784,17 @@ subroutine restFile_dimcheck( ncid ) 'or a non-transient run using an initial conditions file from a transient run,' // & new_line('x') // & 'or when running a resolution or configuration that differs from the initial conditions.)' - call check_dim(ncid, nameg, numg, msg=msg) - call check_dim(ncid, namel, numl, msg=msg) - call check_dim(ncid, namec, numc, msg=msg) - call check_dim(ncid, namep, nump, msg=msg) - if ( use_fates ) call check_dim(ncid, nameCohort , numCohort, msg=msg) + call check_dim_size(ncid, nameg, numg, msg=msg) + call check_dim_size(ncid, namel, numl, msg=msg) + call check_dim_size(ncid, namec, numc, msg=msg) + call check_dim_size(ncid, namep, nump, msg=msg) + if ( use_fates ) call check_dim_size(ncid, nameCohort , numCohort, msg=msg) end if msg = 'You can deal with this mismatch by rerunning with ' // & 'use_init_interp = .true. in user_nl_clm' - call check_dim(ncid, 'levsno' , nlevsno, msg=msg) - call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg) - call check_dim(ncid, 'levlak' , nlevlak) + call check_dim_size(ncid, 'levsno' , nlevsno, msg=msg) + call check_dim_size(ncid, 'levgrnd' , nlevgrnd, msg=msg) + call check_dim_size(ncid, 'levlak' , nlevlak) ! NOTE(wjs, 2020-10-21) We deliberately do NOT check 'levmaxurbgrnd' against ! nlevmaxurbgrnd. This is largely for the sake of backwards compatibility (to support ! old restart files that do not have 'levmaxurbgrnd'). But in addition, that check diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index 4901425dbc..6412fafe9c 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -17,7 +17,7 @@ module surfrdMod use clm_varctl , only : use_cndv, use_crop use surfrdUtilsMod , only : check_sums_equal_1, collapse_crop_types, collapse_to_dominant, collapse_crop_var, collapse_individual_lunits use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile - use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim, ncd_inqdid, ncd_inqdlen + use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim_size, ncd_inqdid, ncd_inqdlen use pio use spmdMod ! @@ -551,7 +551,7 @@ subroutine surfrd_special(begg, endg, ncid, ns) allocate(urban_region_id(begg:endg)) allocate(pctspec(begg:endg)) - call check_dim(ncid, 'nlevsoi', nlevsoifl) + call check_dim_size(ncid, 'nlevsoi', nlevsoifl) ! Obtain non-grid surface properties of surface dataset other than percent patch @@ -602,8 +602,8 @@ subroutine surfrd_special(begg, endg, ncid, ns) ! Read glacier info - call check_dim(ncid, 'nglcec', maxpatch_glcmec ) - call check_dim(ncid, 'nglcecp1', maxpatch_glcmec+1 ) + call check_dim_size(ncid, 'nglcec', maxpatch_glcmec ) + call check_dim_size(ncid, 'nglcecp1', maxpatch_glcmec+1 ) call ncd_io(ncid=ncid, varname='PCT_GLC_MEC', flag='read', data=wt_glc_mec, & dim1name=grlnd, readvar=readvar) @@ -691,8 +691,8 @@ subroutine surfrd_cftformat( ncid, begg, endg, wt_cft, fert_cft, cftsize, natpft SHR_ASSERT_ALL_FL((ubound(fert_cft, dim=2) >= (/cftsize+1-cft_lb/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(wt_nat_patch) >= (/endg,natpft_size-1+natpft_lb/)), sourcefile, __LINE__) - call check_dim(ncid, 'cft', cftsize) - call check_dim(ncid, 'natpft', natpft_size) + call check_dim_size(ncid, 'cft', cftsize) + call check_dim_size(ncid, 'natpft', natpft_size) call ncd_io(ncid=ncid, varname='PCT_CFT', flag='read', data=wt_cft, & dim1name=grlnd, readvar=readvar) @@ -754,7 +754,7 @@ subroutine surfrd_pftformat( begg, endg, ncid ) !----------------------------------------------------------------------- SHR_ASSERT_ALL_FL((ubound(wt_nat_patch) == (/endg, natpft_size-1+natpft_lb/)), sourcefile, __LINE__) - call check_dim(ncid, 'natpft', natpft_size) + call check_dim_size(ncid, 'natpft', natpft_size) ! If cft_size == 0, then we expect to be running with a surface dataset ! that does ! NOT have a PCT_CFT array (or CONST_FERTNITRO_CFT array), and thus does not have a 'cft' dimension. From 71f8bd66cde26e35d06129ff99c766483f415902 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 27 Oct 2020 06:28:52 -0600 Subject: [PATCH 1573/1973] Add check_dim routine Like check_var but for dimensions --- src/main/ncdio_pio.F90.in | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index b3b208cda9..defa582f47 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -44,6 +44,7 @@ module ncdio_pio ! !PUBLIC MEMBER FUNCTIONS: ! public :: check_var ! determine if variable is on netcdf file + public :: check_dim ! determine if dimension is on netcdf file public :: check_att ! check if attribute is on file public :: check_dim_size ! validity check on dimension public :: ncd_pio_openfile ! open a file @@ -322,6 +323,27 @@ contains end subroutine check_var + !----------------------------------------------------------------------- + subroutine check_dim(ncid, dimname, dimexist) + ! + ! !DESCRIPTION: + ! Check if dimension is on netcdf file + ! + ! !ARGUMENTS: + class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor + character(len=*) , intent(in) :: dimname ! dimension name + logical , intent(out) :: dimexist ! if this dimension exists or not + ! + ! !LOCAL VARIABLES: + integer :: dimid + + character(len=*), parameter :: subname = 'check_dim' + !----------------------------------------------------------------------- + + call ncd_inqdid(ncid, dimname, dimid, dimexist) + + end subroutine check_dim + !----------------------------------------------------------------------- subroutine check_att(ncid, varid, attrib, att_found) ! From f83bb2518b1abd40a3d1fea8d2d6cadbaff3fe9a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 27 Oct 2020 06:38:25 -0600 Subject: [PATCH 1574/1973] Fix unit tests: need to set nlevmaxurbgrnd when creating water_type inst --- src/unit_test_shr/unittestWaterTypeFactory.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/unit_test_shr/unittestWaterTypeFactory.F90 b/src/unit_test_shr/unittestWaterTypeFactory.F90 index 05d8ae1c0c..cc3510e881 100644 --- a/src/unit_test_shr/unittestWaterTypeFactory.F90 +++ b/src/unit_test_shr/unittestWaterTypeFactory.F90 @@ -23,7 +23,7 @@ module unittestWaterTypeFactory #include "shr_assert.h" use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varpar, only : nlevsoi, nlevgrnd, nlevsno + use clm_varpar, only : nlevsoi, nlevgrnd, nlevmaxurbgrnd, nlevsno use ColumnType, only : col use WaterType, only : water_type, water_params_type use unittestArrayMod, only : col_array @@ -66,6 +66,7 @@ subroutine setup_before_subgrid(this, my_nlevsoi, nlevgrnd_additional, my_nlevsn nlevsoi = my_nlevsoi nlevgrnd = nlevsoi + nlevgrnd_additional + nlevmaxurbgrnd = nlevgrnd nlevsno = my_nlevsno end subroutine setup_before_subgrid From 115d2cf324a05ebe0fb74dbb701d6cd144d97c70 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 27 Oct 2020 06:48:31 -0600 Subject: [PATCH 1575/1973] Add check_var_or_dim subroutine This will be helpful for an upcoming commit --- src/main/ncdio_pio.F90.in | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index defa582f47..00f5c202e4 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -45,6 +45,7 @@ module ncdio_pio ! public :: check_var ! determine if variable is on netcdf file public :: check_dim ! determine if dimension is on netcdf file + public :: check_var_or_dim ! determine if variable or dimension is on netcdf file public :: check_att ! check if attribute is on file public :: check_dim_size ! validity check on dimension public :: ncd_pio_openfile ! open a file @@ -344,6 +345,31 @@ contains end subroutine check_dim + !----------------------------------------------------------------------- + subroutine check_var_or_dim(ncid, name, is_dim, exists) + ! + ! !DESCRIPTION: + ! Check if variable or dimension is on netcdf file + ! + ! !ARGUMENTS: + class(file_desc_t), intent(inout) :: ncid ! PIO file descriptor + character(len=*), intent(in) :: name ! variable or dimension name to check + logical, intent(in) :: is_dim ! if true, check for dimension; if false, check for variable + logical, intent(out) :: exists ! whether the given variable or dimension exists on file + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'check_var_or_dim' + !----------------------------------------------------------------------- + + if (is_dim) then + call check_dim(ncid, name, exists) + else + call check_var(ncid, name, exists, print_err=.false.) + end if + + end subroutine check_var_or_dim + !----------------------------------------------------------------------- subroutine check_att(ncid, varid, attrib, att_found) ! From 90a2001607ea28bcde25a16525a4bf56ea900a4c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 27 Oct 2020 10:59:10 -0600 Subject: [PATCH 1576/1973] Add tests of check_var_or_dim This tests the logic in check_var_or_dim as well as in check_var and check_dim --- src/self_tests/TestNcdioPio.F90 | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/self_tests/TestNcdioPio.F90 b/src/self_tests/TestNcdioPio.F90 index b467431cbe..3bac472950 100644 --- a/src/self_tests/TestNcdioPio.F90 +++ b/src/self_tests/TestNcdioPio.F90 @@ -4,6 +4,7 @@ module TestNcdioPio ! !DESCRIPTION: ! This module contains tests of ncdio_pio +#include "shr_assert.h" use ncdio_pio use shr_kind_mod, only : r8 => shr_kind_r8 use Assertions, only : assert_equal @@ -79,6 +80,9 @@ subroutine test_ncdio_pio(bounds) call write_to_log(subname//': test_write_vars') call test_write_vars + call write_to_log(subname//': test_check_var_or_dim') + call test_check_var_or_dim + call write_to_log(subname//': test_read_vars') call test_read_vars @@ -276,6 +280,48 @@ subroutine confirm_var_on_file(ncid, varname, expected_type) end subroutine confirm_var_on_file + !----------------------------------------------------------------------- + subroutine test_check_var_or_dim() + ! + ! !DESCRIPTION: + ! Test the check_var_or_dim subroutine with variables and dimensions, returning true + ! and false + ! + ! This also covers check_var and check_dim + ! + ! !ARGUMENTS: + ! + ! !LOCAL VARIABLES: + type(file_desc_t) :: ncid + logical :: exists + + character(len=*), parameter :: var_to_check = 'data_double_1d_grc' + character(len=*), parameter :: dim_to_check = lev1_name + + character(len=*), parameter :: subname = 'test_check_var_or_dim' + !----------------------------------------------------------------------- + + call ncd_pio_openfile(ncid, testfilename, 0) + + call check_var_or_dim(ncid, var_to_check, is_dim=.false., exists=exists) + call shr_assert(exists, 'check_var_or_dim: var exists') + + ! Make sure that check_var_or_dim returns false when the given variable doesn't exist + ! - even if it is an existing dimension + call check_var_or_dim(ncid, dim_to_check, is_dim=.false., exists=exists) + call shr_assert(.not. exists, 'check_var_or_dim: var does not exist') + + call check_var_or_dim(ncid, dim_to_check, is_dim=.true., exists=exists) + call shr_assert(exists, 'check_var_or_dim: dim exists') + + ! Make sure that check_var_or_dim returns false when the given dimension doesn't + ! exist - even if it is an existing variable + call check_var_or_dim(ncid, var_to_check, is_dim=.true., exists=exists) + call shr_assert(.not. exists, 'check_var_or_dim: dim does not exist') + + call ncd_pio_closefile(ncid) + end subroutine test_check_var_or_dim + !----------------------------------------------------------------------- subroutine test_read_vars() ! From 2e14871ce14f86527b1caa24f2851720e0295208 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 27 Oct 2020 12:24:55 -0600 Subject: [PATCH 1577/1973] Extend find_var_on_file to support finding dimensions --- src/init_interp/initInterp.F90 | 2 +- src/main/ncdio_pio.F90.in | 8 ++--- src/main/ncdio_utils.F90 | 8 ++--- .../test/ncdio_utils_test/test_ncdio_utils.pf | 12 ++++---- .../main/ncdio_pio_fake.F90.in | 29 +++++++++++++++++++ src/utils/restUtilMod.F90.in | 6 ++-- 6 files changed, 46 insertions(+), 19 deletions(-) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index f9272ba339..0e6e8da6e2 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -485,7 +485,7 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) end if ! Find which of the list of possible variables actually exists on the input file. - call find_var_on_file(ncidi, varname_i_options, varname_i) + call find_var_on_file(ncidi, varname_i_options, is_dim=.false., varname_on_file=varname_i) ! Note that, if none of the options are found, varname_i will be set to the first ! variable in the list, in which case the following code will determine that we diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 00f5c202e4..dfd7c64e00 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -352,10 +352,10 @@ contains ! Check if variable or dimension is on netcdf file ! ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! PIO file descriptor - character(len=*), intent(in) :: name ! variable or dimension name to check - logical, intent(in) :: is_dim ! if true, check for dimension; if false, check for variable - logical, intent(out) :: exists ! whether the given variable or dimension exists on file + class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor + character(len=*) , intent(in) :: name ! variable or dimension name to check + logical , intent(in) :: is_dim ! if true, check for dimension; if false, check for variable + logical , intent(out) :: exists ! whether the given variable or dimension exists on file ! ! !LOCAL VARIABLES: diff --git a/src/main/ncdio_utils.F90 b/src/main/ncdio_utils.F90 index 977e10b484..e72232941f 100644 --- a/src/main/ncdio_utils.F90 +++ b/src/main/ncdio_utils.F90 @@ -17,7 +17,7 @@ module ncdio_utils contains !----------------------------------------------------------------------- - subroutine find_var_on_file(ncid, varname_list, varname_on_file) + subroutine find_var_on_file(ncid, varname_list, is_dim, varname_on_file) ! ! !DESCRIPTION: ! Given a colon-delimited list of possible variable names, return the first one that @@ -33,6 +33,7 @@ subroutine find_var_on_file(ncid, varname_list, varname_on_file) ! !ARGUMENTS: type(file_desc_t) , intent(inout) :: ncid ! netcdf file id character(len=*) , intent(in) :: varname_list ! colon-delimited list of possible variable names + logical , intent(in) :: is_dim ! if .true., then look at dimensions rather than variables character(len=*) , intent(out) :: varname_on_file ! first variable from the list that was found on file ! ! !LOCAL VARIABLES: @@ -41,8 +42,6 @@ subroutine find_var_on_file(ncid, varname_list, varname_on_file) logical :: found logical :: readvar character(len=len(varname_on_file)) :: cur_varname - integer :: varid - type(var_desc_t) :: vardesc character(len=*), parameter :: subname = 'find_var_on_file' !----------------------------------------------------------------------- @@ -53,8 +52,7 @@ subroutine find_var_on_file(ncid, varname_list, varname_on_file) n = 1 do while ((.not. found) .and. (n <= num_vars)) call shr_string_listGetName(varname_list, n, cur_varname) - call ncd_inqvid(ncid, cur_varname, varid, vardesc, readvar=readvar) - found = readvar + call check_var_or_dim(ncid, cur_varname, is_dim=is_dim, exists=found) n = n + 1 end do diff --git a/src/main/test/ncdio_utils_test/test_ncdio_utils.pf b/src/main/test/ncdio_utils_test/test_ncdio_utils.pf index e8cbeb37db..c87a89e4f7 100644 --- a/src/main/test/ncdio_utils_test/test_ncdio_utils.pf +++ b/src/main/test/ncdio_utils_test/test_ncdio_utils.pf @@ -55,7 +55,7 @@ contains ncid = file_desc_t() call add_vars_to_file(ncid, ['foo']) - call find_var_on_file(ncid, 'foo', actual) + call find_var_on_file(ncid, 'foo', is_dim=.false., varname_on_file=actual) @assertEqual('foo', actual) end subroutine test_find_var_on_file_oneElement_found @@ -68,7 +68,7 @@ contains ncid = file_desc_t() - call find_var_on_file(ncid, 'foo', actual) + call find_var_on_file(ncid, 'foo', is_dim=.false., varname_on_file=actual) @assertEqual('foo', actual) end subroutine test_find_var_on_file_oneElement_notFound @@ -82,7 +82,7 @@ contains ncid = file_desc_t() call add_vars_to_file(ncid, ['foo', 'bar', 'baz']) - call find_var_on_file(ncid, 'foo:bar:baz', actual) + call find_var_on_file(ncid, 'foo:bar:baz', is_dim=.false., varname_on_file=actual) @assertEqual('foo', actual) end subroutine test_find_var_on_file_3Elements_first @@ -96,7 +96,7 @@ contains ncid = file_desc_t() call add_vars_to_file(ncid, ['bar', 'baz']) - call find_var_on_file(ncid, 'foo:bar:baz', actual) + call find_var_on_file(ncid, 'foo:bar:baz', is_dim=.false., varname_on_file=actual) @assertEqual('bar', actual) end subroutine test_find_var_on_file_3Elements_second @@ -110,7 +110,7 @@ contains ncid = file_desc_t() call add_vars_to_file(ncid, ['baz']) - call find_var_on_file(ncid, 'foo:bar:baz', actual) + call find_var_on_file(ncid, 'foo:bar:baz', is_dim=.false., varname_on_file=actual) @assertEqual('baz', actual) end subroutine test_find_var_on_file_3Elements_third @@ -123,7 +123,7 @@ contains ncid = file_desc_t() - call find_var_on_file(ncid, 'foo:bar:baz', actual) + call find_var_on_file(ncid, 'foo:bar:baz', is_dim=.false., varname_on_file=actual) @assertEqual('foo', actual) end subroutine test_find_var_on_file_3Elements_noneFound diff --git a/src/unit_test_stubs/main/ncdio_pio_fake.F90.in b/src/unit_test_stubs/main/ncdio_pio_fake.F90.in index 482e622bd6..45dcd90ba3 100644 --- a/src/unit_test_stubs/main/ncdio_pio_fake.F90.in +++ b/src/unit_test_stubs/main/ncdio_pio_fake.F90.in @@ -46,6 +46,7 @@ module ncdio_pio ! !PUBLIC MEMBER FUNCTIONS: public :: check_var ! determine if variable is on netcdf file + public :: check_var_or_dim ! determine if variable or dimension is on netcdf file public :: ncd_io ! do fake i/o (currently only set up to read) public :: ncd_inqvid ! inquire on a variable id public :: ncd_set_var ! set data on "file" for one variable @@ -293,6 +294,34 @@ contains end subroutine check_var + !----------------------------------------------------------------------- + subroutine check_var_or_dim(ncid, name, is_dim, exists) + ! + ! !DESCRIPTION: + ! Fake to check if variable or dimension is on netcdf file + ! + ! NOTE: dimension check currently not implemented! + ! + ! !ARGUMENTS: + class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor + character(len=*) , intent(in) :: name ! variable or dimension name to check + logical , intent(in) :: is_dim ! if true, check for dimension; if false, check for variable + logical , intent(out) :: exists ! whether the given variable or dimension exists on file + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'check_var_or_dim' + !----------------------------------------------------------------------- + + if (is_dim) then + call endrun(subname//': is_dim=.true. not yet implemented') + else + call check_var(ncid, name, exists, print_err=.false.) + end if + + end subroutine check_var_or_dim + + !----------------------------------------------------------------------- subroutine ncd_inqdid(ncid, name, dimid, dimexist) ! diff --git a/src/utils/restUtilMod.F90.in b/src/utils/restUtilMod.F90.in index f95c54f373..ea8b8ff84d 100644 --- a/src/utils/restUtilMod.F90.in +++ b/src/utils/restUtilMod.F90.in @@ -120,7 +120,7 @@ contains call shr_string_listGetName(varname, 1, primary_varname) if (flag == 'read') then - call find_var_on_file(ncid, varname, my_varname) + call find_var_on_file(ncid, varname, is_dim=.false., varname_on_file=my_varname) if ((my_varname /= primary_varname) .and. masterproc) then write(iulog,*) 'Restart file backwards compatibility: Translating: ', & trim(my_varname), ' => ', trim(primary_varname) @@ -256,7 +256,7 @@ contains call shr_string_listGetName(varname, 1, primary_varname) if (flag == 'read') then - call find_var_on_file(ncid, varname, my_varname) + call find_var_on_file(ncid, varname, is_dim=.false., varname_on_file=my_varname) if ((my_varname /= primary_varname) .and. masterproc) then write(iulog,*) 'Restart file backwards compatibility: Translating: ', & trim(my_varname), ' => ', trim(primary_varname) @@ -405,7 +405,7 @@ contains call shr_string_listGetName(varname, 1, primary_varname) if (flag == 'read') then - call find_var_on_file(ncid, varname, my_varname) + call find_var_on_file(ncid, varname, is_dim=.false., varname_on_file=my_varname) if ((my_varname /= primary_varname) .and. masterproc) then write(iulog,*) 'Restart file backwards compatibility: Translating: ', & trim(my_varname), ' => ', trim(primary_varname) From 77b1d90e5c5a652b09e13757c3b9b8320480b8ba Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 27 Oct 2020 12:31:10 -0600 Subject: [PATCH 1578/1973] Restore check for levmaxurbgrnd dim size on restart file Since levurb is no longer written to the restart file, this can be important after all. Use new functionality in find_var_on_file to fall back on levgrnd for backwards compatibility. --- src/main/restFileMod.F90 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index fb5223ad8b..0e60653930 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -23,6 +23,7 @@ module restFileMod use ncdio_pio , only : file_desc_t, ncd_pio_createfile, ncd_pio_openfile, ncd_global use ncdio_pio , only : ncd_pio_closefile, ncd_defdim, ncd_putatt, ncd_enddef, check_dim_size use ncdio_pio , only : check_att, ncd_getatt + use ncdio_utils , only : find_var_on_file use glcBehaviorMod , only : glc_behavior_type use reweightMod , only : reweight_wrapup use IssueFixedMetadataHandler, only : write_issue_fixed_metadata, read_issue_fixed_metadata @@ -767,6 +768,7 @@ subroutine restFile_dimcheck( ncid ) integer :: numc ! total number of columns across all processors integer :: nump ! total number of pfts across all processors integer :: numCohort ! total number of cohorts across all processors + character(len=64) :: dimname character(len=:), allocatable :: msg ! diagnostic message character(len=32) :: subname='restFile_dimcheck' ! subroutine name !----------------------------------------------------------------------- @@ -794,11 +796,14 @@ subroutine restFile_dimcheck( ncid ) 'use_init_interp = .true. in user_nl_clm' call check_dim_size(ncid, 'levsno' , nlevsno, msg=msg) call check_dim_size(ncid, 'levgrnd' , nlevgrnd, msg=msg) - call check_dim_size(ncid, 'levlak' , nlevlak) - ! NOTE(wjs, 2020-10-21) We deliberately do NOT check 'levmaxurbgrnd' against - ! nlevmaxurbgrnd. This is largely for the sake of backwards compatibility (to support - ! old restart files that do not have 'levmaxurbgrnd'). But in addition, that check - ! seems unnecessary since we already check both levgrnd and levurb. + call check_dim_size(ncid, 'levlak' , nlevlak) + + ! BACKWARDS_COMPATIBILITY(wjs, 2020-10-27) The possibility of falling back on levgrnd + ! is needed for backwards compatibility with older restart files that do not have a + ! levmaxurbgrnd dimension. On these old restart files, we expect the levgrnd dimension + ! to give the implicit value of levmaxurbgrnd. + call find_var_on_file(ncid, 'levmaxurbgrnd:levgrnd', is_dim=.true., varname_on_file=dimname) + call check_dim_size(ncid, dimname, nlevmaxurbgrnd) end subroutine restFile_dimcheck From 61432e0a22cb5a569a1dc5dfebf84a9b777f229d Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Wed, 28 Oct 2020 08:33:26 -0600 Subject: [PATCH 1579/1973] Restore changes to SoilTemperatureMod.F90. Update new code in SnowHydrologyMod.F90 and SurfaceWaterMod.F90 with nlevmaxurbgrnd. --- src/biogeophys/SnowHydrologyMod.F90 | 16 +- src/biogeophys/SoilTemperatureMod.F90 | 236 ++++++++++++++------------ src/biogeophys/SurfaceWaterMod.F90 | 4 +- 3 files changed, 141 insertions(+), 115 deletions(-) diff --git a/src/biogeophys/SnowHydrologyMod.F90 b/src/biogeophys/SnowHydrologyMod.F90 index 2eb9ac6a32..8d1824a70c 100644 --- a/src/biogeophys/SnowHydrologyMod.F90 +++ b/src/biogeophys/SnowHydrologyMod.F90 @@ -21,7 +21,7 @@ module SnowHydrologyMod use decompMod , only : bounds_type use abortutils , only : endrun use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevsoi, nlevgrnd + use clm_varpar , only : nlevsno, nlevsoi, nlevgrnd, nlevmaxurbgrnd use clm_varctl , only : iulog, use_subgrid_fluxes use clm_varcon , only : namec, h2osno_max, hfus, denh2o, denice, rpi, spval, tfrz use clm_varcon , only : cpice, cpliq @@ -949,10 +949,10 @@ subroutine Bulk_InitializeSnowPack(bounds, snowpack_initialized_filterc, & SHR_ASSERT_FL((ubound(forc_t, 1) == bounds%endc), sourcefile, __LINE__) SHR_ASSERT_FL((ubound(snow_depth, 1) == bounds%endc), sourcefile, __LINE__) SHR_ASSERT_FL((ubound(snl, 1) == bounds%endc), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(zi) == [bounds%endc, nlevgrnd]), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(dz) == [bounds%endc, nlevgrnd]), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(z) == [bounds%endc, nlevgrnd]), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(t_soisno) == [bounds%endc, nlevgrnd]), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(zi) == [bounds%endc, nlevmaxurbgrnd]), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(dz) == [bounds%endc, nlevmaxurbgrnd]), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(z) == [bounds%endc, nlevmaxurbgrnd]), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(t_soisno) == [bounds%endc, nlevmaxurbgrnd]), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(frac_iceold) == [bounds%endc, nlevgrnd]), sourcefile, __LINE__) do fc = 1, snowpack_initialized_filterc%num @@ -2922,9 +2922,9 @@ subroutine InitSnowLayers (bounds, snow_depth) associate( & snl => col%snl, & ! Output: [integer (:) ] number of snow layers - dz => col%dz, & ! Output: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevgrnd) - z => col%z, & ! Output: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevgrnd) - zi => col%zi & ! Output: [real(r8) (:,:) ] interface level below a "z" level (m) (-nlevsno+0:nlevgrnd) + dz => col%dz, & ! Output: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevmaxurbgrnd) + z => col%z, & ! Output: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevmaxurbgrnd) + zi => col%zi & ! Output: [real(r8) (:,:) ] interface level below a "z" level (m) (-nlevsno+0:nlevmaxurbgrnd) ) allocate(dzmin(1:nlevsno)) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 75711f7564..9c915e5f1e 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -148,10 +148,10 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter integer :: fl ! urban filtered landunit indices integer :: jtop(bounds%begc:bounds%endc) ! top level at each column real(r8) :: dtime ! land model time step (sec) - real(r8) :: cv (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat capacity [J/(m2 K)] - real(r8) :: tk (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! thermal conductivity [W/(m K)] - real(r8) :: fn (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat diffusion through the layer interface [W/m2] - real(r8) :: fn1(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat diffusion through the layer interface [W/m2] + real(r8) :: cv (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! heat capacity [J/(m2 K)] + real(r8) :: tk (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! thermal conductivity [W/(m K)] + real(r8) :: fn (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! heat diffusion through the layer interface [W/m2] + real(r8) :: fn1(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! heat diffusion through the layer interface [W/m2] real(r8) :: dzm ! used in computing tridiagonal matrix real(r8) :: dzp ! used in computing tridiagonal matrix real(r8) :: sabg_lyr_col(bounds%begc:bounds%endc,-nlevsno+1:1) ! absorbed solar radiation (col,lyr) [W/m2] @@ -162,9 +162,9 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter real(r8) :: fn_h2osfc(bounds%begc:bounds%endc) ! heat diffusion through standing-water/soil interface [W/m2] real(r8) :: dz_h2osfc(bounds%begc:bounds%endc) ! height of standing surface water [m] integer, parameter :: nband=5 - real(r8) :: bmatrix(bounds%begc:bounds%endc,nband,-nlevsno:nlevgrnd) ! banded matrix for numerical solution of temperature - real(r8) :: tvector(bounds%begc:bounds%endc,-nlevsno:nlevgrnd) ! initial temperature solution [K] - real(r8) :: rvector(bounds%begc:bounds%endc,-nlevsno:nlevgrnd) ! RHS vector for numerical solution of temperature + real(r8) :: bmatrix(bounds%begc:bounds%endc,nband,-nlevsno:nlevmaxurbgrnd) ! banded matrix for numerical solution of temperature + real(r8) :: tvector(bounds%begc:bounds%endc,-nlevsno:nlevmaxurbgrnd) ! initial temperature solution [K] + real(r8) :: rvector(bounds%begc:bounds%endc,-nlevsno:nlevmaxurbgrnd) ! RHS vector for numerical solution of temperature real(r8) :: tk_h2osfc(bounds%begc:bounds%endc) ! thermal conductivity of h2osfc [W/(m K)] [col] real(r8) :: dhsdT(bounds%begc:bounds%endc) ! temperature derivative of "hs" [col] real(r8) :: hs_soil(bounds%begc:bounds%endc) ! heat flux on soil [W/m2] @@ -371,7 +371,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter tvector(c,0) = t_h2osfc(c) ! soil layers; top layer will have one offset and one extra coefficient - tvector(c,1:nlevgrnd) = t_soisno(c,1:nlevgrnd) + tvector(c,1:nlevmaxurbgrnd) = t_soisno(c,1:nlevmaxurbgrnd) enddo @@ -379,7 +379,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter ! Solve the system - call BandDiagonal(bounds, -nlevsno, nlevgrnd, jtop(begc:endc), jbot(begc:endc), & + call BandDiagonal(bounds, -nlevsno, nlevmaxurbgrnd, jtop(begc:endc), jbot(begc:endc), & num_nolakec, filter_nolakec, nband, bmatrix(begc:endc, :, :), & rvector(begc:endc, :), tvector(begc:endc, :)) call t_stopf( 'SoilTempBandDiag') @@ -391,7 +391,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter do j = snl(c)+1, 0 t_soisno(c,j) = tvector(c,j-1) !snow layers end do - t_soisno(c,1:nlevgrnd) = tvector(c,1:nlevgrnd) !soil layers + t_soisno(c,1:nlevmaxurbgrnd) = tvector(c,1:nlevmaxurbgrnd) !soil layers if (frac_h2osfc(c) == 0._r8) then t_h2osfc(c)=t_soisno(c,1) @@ -402,7 +402,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter ! Melting or Freezing - do j = -nlevsno+1,nlevgrnd + do j = -nlevsno+1,nlevmaxurbgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) @@ -568,7 +568,7 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! flux from the interface to the node j+1. ! ! !USES: - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevsoi + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevsoi, nlevmaxurbgrnd use clm_varcon , only : denh2o, denice, tfrz, tkwat, tkice, tkair, cpice, cpliq, thk_bedrock, csol_bedrock use landunit_varcon , only : istice_mec, istwet use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv @@ -600,8 +600,8 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & call t_startf( 'SoilThermProp' ) ! Enforce expected array sizes - SHR_ASSERT_ALL_FL((ubound(cv) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(cv) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(tk_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) associate( & @@ -637,9 +637,6 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ) ! Thermal conductivity of soil from Farouki (1981) - ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) - ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., - ! 41, 1011-1026. do j = -nlevsno+1,nlevgrnd do fc = 1, num_nolakec @@ -648,15 +645,12 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! Only examine levels from 1->nlevgrnd if (j >= 1) then l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then - thk(c,j) = tk_wall(l,j) - else if (col%itype(c) == icol_roof .and. j <= nlevurb) then - thk(c,j) = tk_roof(l,j) - else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then - thk(c,j) = tk_improad(l,j) - else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & - .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & - col%itype(c) /= icol_roof) then + + ! This will include pervious road for all nlevgrnd layers and impervious road for j > nlev_improad + if ((lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec & + .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & + col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) .or. & + (col%itype(c) == icol_road_imperv .and. j > nlev_improad(l))) then satw = (h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice)/(dz(c,j)*watsat(c,j)) satw = min(1._r8, satw) @@ -697,9 +691,25 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & end do end do + do j = 1,nlevurb + do fc = 1, num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then + thk(c,j) = tk_wall(l,j) + else if (col%itype(c) == icol_roof) then + thk(c,j) = tk_roof(l,j) + else if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then + thk(c,j) = tk_improad(l,j) + end if + + end do + end do + ! Thermal conductivity at the layer interface - do j = -nlevsno+1,nlevgrnd + do j = -nlevsno+1,nlevmaxurbgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & @@ -735,23 +745,15 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & enddo ! Soil heat capacity, from de Vires (1963) - ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) - ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., - ! 41, 1011-1026. do j = 1, nlevgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then - cv(c,j) = cv_wall(l,j) * dz(c,j) - else if (col%itype(c) == icol_roof .and. j <= nlevurb) then - cv(c,j) = cv_roof(l,j) * dz(c,j) - else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then - cv(c,j) = cv_improad(l,j) * dz(c,j) - else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & - .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & - col%itype(c) /= icol_roof) then + if ((lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec & + .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & + col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) .or. & + (col%itype(c) == icol_road_imperv .and. j > nlev_improad(l))) then cv(c,j) = csol(c,j)*(1._r8-watsat(c,j))*dz(c,j) + (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) if (j > nbedrock(c)) cv(c,j) = csol_bedrock*dz(c,j) else if (lun%itype(l) == istwet) then @@ -760,7 +762,8 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & else if (lun%itype(l) == istice_mec) then cv(c,j) = (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) endif - if (j == 1) then + if (j == 1 .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & + col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) then if (h2osno_no_layers(c) > 0._r8) then cv(c,j) = cv(c,j) + cpice*h2osno_no_layers(c) end if @@ -768,6 +771,27 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & enddo end do + do j = 1, nlevurb + do fc = 1,num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then + cv(c,j) = cv_wall(l,j) * dz(c,j) + else if (col%itype(c) == icol_roof) then + cv(c,j) = cv_roof(l,j) * dz(c,j) + else if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then + cv(c,j) = cv_improad(l,j) * dz(c,j) + endif + if (j == 1 .and. (col%itype(c) == icol_sunwall .or. & + col%itype(c) == icol_shadewall .or. col%itype(c) == icol_roof .or. & + col%itype(c) == icol_road_imperv)) then + if (h2osno_no_layers(c) > 0._r8) then + cv(c,j) = cv(c,j) + cpice*h2osno_no_layers(c) + end if + end if + end do + end do + ! Snow heat capacity do j = -nlevsno+1,0 @@ -1035,7 +1059,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & ! ! !USES: use clm_time_manager , only : get_step_size_real - use clm_varpar , only : nlevsno, nlevgrnd,nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevmaxurbgrnd use clm_varctl , only : iulog use clm_varcon , only : tfrz, hfus, grav use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv @@ -1059,14 +1083,14 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & real(r8) :: dtime !land model time step (sec) real(r8) :: heatr !energy residual or loss after melting or freezing real(r8) :: temp1 !temporary variables [kg/m2] - real(r8) :: hm(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !energy residual [W/m2] - real(r8) :: xm(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !melting or freezing within a time step [kg/m2] - real(r8) :: wmass0(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of ice and liquid (kg/m2) - real(r8) :: wice0 (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of ice (kg/m2) - real(r8) :: wliq0 (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of liquid (kg/m2) - real(r8) :: supercool(bounds%begc:bounds%endc,nlevgrnd) !supercooled water in soil (kg/m2) + real(r8) :: hm(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) !energy residual [W/m2] + real(r8) :: xm(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) !melting or freezing within a time step [kg/m2] + real(r8) :: wmass0(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd)!initial mass of ice and liquid (kg/m2) + real(r8) :: wice0 (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd)!initial mass of ice (kg/m2) + real(r8) :: wliq0 (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd)!initial mass of liquid (kg/m2) + real(r8) :: supercool(bounds%begc:bounds%endc,nlevmaxurbgrnd) !supercooled water in soil (kg/m2) real(r8) :: propor !proportionality constant (-) - real(r8) :: tinc(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !t(n+1)-t(n) [K] + real(r8) :: tinc(bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) !t(n+1)-t(n) [K] real(r8) :: smp !frozen water potential (mm) !----------------------------------------------------------------------- @@ -1123,7 +1147,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & qflx_snow_drain(c) = 0._r8 end do - do j = -nlevsno+1,nlevgrnd ! all layers + do j = -nlevsno+1,nlevmaxurbgrnd ! all layers do fc = 1,num_nolakec c = filter_nolakec(fc) if (j >= snl(c)+1) then @@ -1173,21 +1197,21 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & enddo ! end of level-loop !-- soil layers --------------------------------------------------- - do j = 1,nlevgrnd + do j = 1,nlevmaxurbgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) supercool(c,j) = 0.0_r8 ! add in urban condition if-block if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then - - + .and. col%itype(c) /= icol_roof .and. j <= nlevgrnd) .or. & + ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) .and. j <= nlevurb)) then if (h2osoi_ice(c,j) > 0. .AND. t_soisno(c,j) > tfrz) then imelt(c,j) = 1 ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) + tinc(c,j) = tfrz - t_soisno(c,j) t_soisno(c,j) = tfrz endif @@ -1204,7 +1228,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & if (h2osoi_liq(c,j) > supercool(c,j) .AND. t_soisno(c,j) < tfrz) then imelt(c,j) = 2 ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) + tinc(c,j) = tfrz - t_soisno(c,j) t_soisno(c,j) = tfrz endif @@ -1224,12 +1248,14 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & enddo - do j = -nlevsno+1,nlevgrnd ! all layers + do j = -nlevsno+1,nlevmaxurbgrnd ! all layers do fc = 1,num_nolakec c = filter_nolakec(fc) if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then + .and. col%itype(c) /= icol_roof .and. j <= nlevgrnd) .or. & + ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & + .or. col%itype(c) == icol_roof) .and. j <= nlevurb)) then if (j >= snl(c)+1) then @@ -1298,7 +1324,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & qflx_snomelt(c) = max(0._r8,(temp1-h2osno_no_layers(c)))/dtime ! kg/(m2 s) ! no snow layers, so qflx_snomelt_lyr is not set xmf(c) = hfus*qflx_snomelt(c) - qflx_snow_drain(c) = qflx_snomelt(c) + qflx_snow_drain(c) = qflx_snomelt(c) endif endif @@ -1350,7 +1376,7 @@ subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & end if endif ! end of heatr > 0 if-block - if (j >= 1) then + if (j >= 1) then xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime else xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime @@ -1663,7 +1689,7 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti ! !USES: use clm_varcon , only : capr, cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevmaxurbgrnd use UrbanParamsType, only : IsSimpleBuildTemp ! ! !ARGUMENTS: @@ -1686,10 +1712,10 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti !----------------------------------------------------------------------- ! Enforce expected array sizes - SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(cv) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fn) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(cv) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) associate(& zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) @@ -1708,7 +1734,7 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti ! tridiagonal matrix and set up vector r and vectors a, b, c that define tridiagonal ! matrix and solve system - do j = -nlevsno+1,nlevgrnd + do j = -nlevsno+1,nlevmaxurbgrnd do fc = 1,num_nolakec c = filter_nolakec(fc) l = col%landunit(c) @@ -1742,7 +1768,7 @@ subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dti end if end if else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then + .and. col%itype(c) /= icol_roof .and. j <= nlevgrnd) then if (j >= col%snl(c)+1) then if (j == col%snl(c)+1) then fact(c,j) = dtime/cv(c,j) * dz(c,j) / (0.5_r8*(z(c,j)-zi(c,j-1)+capr*(z(c,j+1)-zi(c,j-1)))) @@ -1786,7 +1812,7 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & ! !USES: use clm_varcon , only : cnfac, cpliq use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -1813,11 +1839,11 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & ! !LOCAL VARIABLES: integer :: j,c ! indices integer :: fc ! lake filtered column indices - real(r8) :: rt (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "r" vector for tridiagonal solution + real(r8) :: rt (bounds%begc:bounds%endc,-nlevsno+1:nlevmaxurbgrnd) ! "r" vector for tridiagonal solution real(r8) :: fn_h2osfc(bounds%begc:bounds%endc) ! heat diffusion through standing-water/soil interface [W/m2] real(r8) :: rt_snow(bounds%begc:bounds%endc,-nlevsno:-1) ! RHS vector corresponding to snow layers real(r8) :: rt_ssw(bounds%begc:bounds%endc,1) ! RHS vector corresponding to standing surface water - real(r8) :: rt_soil(bounds%begc:bounds%endc,1:nlevgrnd) ! RHS vector corresponding to soil layer + real(r8) :: rt_soil(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) ! RHS vector corresponding to soil layer !----------------------------------------------------------------------- ! Enforce expected array sizes @@ -1827,13 +1853,13 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & SHR_ASSERT_ALL_FL((ubound(hs_top) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dhsdT) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(tk_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fn) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dz_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(rvector) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(rvector) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) associate( & t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature [K] @@ -1899,7 +1925,7 @@ subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & c = filter_nolakec(fc) rvector(c, -nlevsno:-1) = rt_snow(c, -nlevsno:-1) rvector(c, 0 ) = rt_ssw(c, 1 ) - rvector(c, 1:nlevgrnd ) = rt_soil(c, 1:nlevgrnd ) + rvector(c, 1:nlevmaxurbgrnd ) = rt_soil(c, 1:nlevmaxurbgrnd ) end do end associate @@ -1918,7 +1944,7 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -1947,9 +1973,9 @@ subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL_FL((ubound(hs_top) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dhsdT) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fn) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(t_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(rt) == (/bounds%endc, -1/)), sourcefile, __LINE__) @@ -2013,7 +2039,7 @@ subroutine SetRHSVec_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2044,7 +2070,7 @@ subroutine SetRHSVec_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d SHR_ASSERT_ALL_FL((ubound(c_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dz_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(fn_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(t_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(rt) == (/bounds%endc,1/)), sourcefile, __LINE__) @@ -2080,7 +2106,7 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevurb, nlevgrnd, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2110,14 +2136,14 @@ subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & SHR_ASSERT_ALL_FL((ubound(hs_soil) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dhsdT) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fn) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fn) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(fn_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(frac_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(frac_sno_eff) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(rt) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(t_soisno) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(rt) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) associate(& begc => bounds%begc , & ! Input: [integer ] beginning column index @@ -2229,7 +2255,7 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2254,7 +2280,7 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & real(r8) :: dzp ! used in computing tridiagonal matrix real(r8) :: bmatrix_snow(bounds%begc:bounds%endc,nband,-nlevsno:-1 ) ! block-diagonal matrix for snow layers real(r8) :: bmatrix_ssw(bounds%begc:bounds%endc,nband, 0:0 ) ! block-diagonal matrix for standing surface water - real(r8) :: bmatrix_soil(bounds%begc:bounds%endc,nband, 1:nlevgrnd) ! block-diagonal matrix for soil layers + real(r8) :: bmatrix_soil(bounds%begc:bounds%endc,nband, 1:nlevmaxurbgrnd) ! block-diagonal matrix for soil layers real(r8) :: bmatrix_snow_soil(bounds%begc:bounds%endc,nband,-1:-1) ! off-diagonal matrix for snow-soil interaction real(r8) :: bmatrix_ssw_soil(bounds%begc:bounds%endc,nband, 0:0 ) ! off-diagonal matrix for standing surface water-soil interaction real(r8) :: bmatrix_soil_snow(bounds%begc:bounds%endc,nband, 1:1 ) ! off-diagonal matrix for soil-snow interaction @@ -2263,12 +2289,12 @@ subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL_FL((ubound(dhsdT) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(tk_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dz_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(bmatrix) == (/bounds%endc, nband, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(bmatrix) == (/bounds%endc, nband, nlevmaxurbgrnd/)), sourcefile, __LINE__) associate( & z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness [m] @@ -2375,7 +2401,7 @@ subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nb ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2400,12 +2426,12 @@ subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nb ! Enforce expected array sizes SHR_ASSERT_ALL_FL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_ssw) == (/bounds%endc, nband, 0/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_ssw_soil) == (/bounds%endc, nband, 0/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_soil_ssw) == (/bounds%endc, nband, 1/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(bmatrix) == (/bounds%endc, nband, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(bmatrix) == (/bounds%endc, nband, nlevmaxurbgrnd/)), sourcefile, __LINE__) ! Assemble the full matrix @@ -2429,8 +2455,8 @@ subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nb ! Soil bmatrix(c,2:3,1 ) = bmatrix_soil(c,2:3,1 ) - bmatrix(c,2:4,2:nlevgrnd-1) = bmatrix_soil(c,2:4,2:nlevgrnd-1) - bmatrix(c,3:4,nlevgrnd ) = bmatrix_soil(c,3:4,nlevgrnd ) + bmatrix(c,2:4,2:nlevmaxurbgrnd-1) = bmatrix_soil(c,2:4,2:nlevmaxurbgrnd-1) + bmatrix(c,3:4,nlevmaxurbgrnd ) = bmatrix_soil(c,3:4,nlevmaxurbgrnd ) ! Soil-Snow bmatrix(c,5,1) = bmatrix_soil_snow(c,5,1) @@ -2453,7 +2479,7 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2478,8 +2504,8 @@ subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL_FL((ubound(dhsdT) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(frac_sno_eff) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), sourcefile, __LINE__) @@ -2550,7 +2576,7 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2578,13 +2604,13 @@ subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & ! Enforce expected array sizes SHR_ASSERT_ALL_FL((ubound(dhsdT) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(tk_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dz_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(frac_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(frac_sno_eff) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), sourcefile, __LINE__) associate( & @@ -2716,7 +2742,7 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d ! !USES: use clm_varcon , only : cnfac use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd ! ! !ARGUMENTS: implicit none @@ -2744,9 +2770,9 @@ subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, d ! Enforce expected array sizes SHR_ASSERT_ALL_FL((ubound(dhsdT) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(tk) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(tk_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevgrnd/)), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(fact) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(c_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(dz_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(frac_h2osfc) == (/bounds%endc/)), sourcefile, __LINE__) diff --git a/src/biogeophys/SurfaceWaterMod.F90 b/src/biogeophys/SurfaceWaterMod.F90 index 069e14d393..768e9a8445 100644 --- a/src/biogeophys/SurfaceWaterMod.F90 +++ b/src/biogeophys/SurfaceWaterMod.F90 @@ -10,7 +10,7 @@ module SurfaceWaterMod use shr_const_mod , only : shr_const_pi use shr_spfn_mod , only : erf => shr_spfn_erf use clm_varcon , only : denh2o, denice, roverg, tfrz, pc, mu, rpi - use clm_varpar , only : nlevsno, nlevgrnd + use clm_varpar , only : nlevsno, nlevmaxurbgrnd use clm_time_manager , only : get_step_size_real use column_varcon , only : icol_roof, icol_road_imperv, icol_sunwall, icol_shadewall, icol_road_perv use decompMod , only : bounds_type @@ -293,7 +293,7 @@ subroutine UpdateState_TooSmallH2osfcToSoil(bounds, num_soilc, filter_soilc, & SHR_ASSERT_FL((ubound(qflx_too_small_h2osfc_to_soil, 1) == bounds%endc), sourcefile, __LINE__) SHR_ASSERT_FL((ubound(h2osfc, 1) == bounds%endc), sourcefile, __LINE__) - SHR_ASSERT_ALL_FL((ubound(h2osoi_liq) == [bounds%endc, nlevgrnd]), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((ubound(h2osoi_liq) == [bounds%endc, nlevmaxurbgrnd]), sourcefile, __LINE__) do fc = 1, num_soilc c = filter_soilc(fc) From 8c6bfdc221603ceb054fc0c2aab6dbeb8890e2f3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 28 Oct 2020 13:00:13 -0600 Subject: [PATCH 1580/1973] Change CISM2%NOEVOLVE compsets to instead use SGLC The use of CISM2%NOEVOLVE adds complexity and (perhaps most importantly) increases the turnaround time of CTSM software testing. Long-term, we'd like to use a data glc model for this purpose. For now, though, we're going to use SGLC. In addition to changing CISM2%NOEVOLVE to SGLC in compset definitions, this also involves getting rid of the Gs designator (for SGLC) in compset aliases, since now all I compsets are assumed to use SGLC, unless they use a fully-active CISM (in which case they have a G at the end of the compset alias). Resolves ESCOMP/CTSM#1135 --- cime_config/config_compsets.xml | 218 +++++--------- cime_config/testdefs/testlist_clm.xml | 285 +++++++++--------- .../testmods_dirs/clm/decStart/user_nl_cism | 9 - python/ctsm/lilac_build_ctsm.py | 2 +- 4 files changed, 215 insertions(+), 299 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 63a03f7976..5a2d5f820b 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -37,12 +37,12 @@ - I1PtClm50SpRsGs + I1PtClm50SpRs 2000_DATM%1PT_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV - I1PtClm45SpRsGs + I1PtClm45SpRs 2000_DATM%1PT_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV @@ -50,87 +50,81 @@ I2000Clm50Sp - 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV - I2000Clm50SpRsGs + I2000Clm50SpRs 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV - I2000Clm50SpRtmGs + I2000Clm50SpRtm 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_RTM_SGLC_SWAV I2010Clm50Sp - 2010_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 2010_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV I2000Clm50BgcCru - 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV I2000Clm50BgcCropRtm - 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - - I2000Clm50BgcCropRtmGs 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV I2000Clm50BgcCrop - 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - I2000Clm51BgcCropGs + I2000Clm51BgcCrop 2000_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - I2000Clm51BgcGs + I2000Clm51Bgc 2000_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV I2000Clm50Cn - 2000_DATM%GSWP3v1_CLM50%CN_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM50%CN_SICE_SOCN_MOSART_SGLC_SWAV I1850Clm50Sp - 1850_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV I1850Clm50SpCru - 1850_DATM%CRUv7_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%CRUv7_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV I1850Clm50BgcCrop - 1850_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - I1850Clm51BgcGs + I1850Clm51Bgc 1850_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV @@ -138,231 +132,191 @@ I1850Clm50BgcCropCmip6 - 1850_DATM%GSWP3v1_CLM50%BGC-CROP-CMIP6DECK_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM50%BGC-CROP-CMIP6DECK_SICE_SOCN_MOSART_SGLC_SWAV I1850Clm50BgcCropCmip6waccm - 1850_DATM%GSWP3v1_CLM50%BGC-CROP-CMIP6WACCMDECK_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM50%BGC-CROP-CMIP6WACCMDECK_SICE_SOCN_MOSART_SGLC_SWAV I1850Clm50BgcCropCru - 1850_DATM%CRUv7_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%CRUv7_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - - I2000Clm50SpGs - 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV - - - - - I2000Clm50BgcCropGs - 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - - - - - I2000Clm50BgcCropQianRsGs - 2000_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV - - + atm forcing to speed up datm, SROF to speed up build and run --> - I2000Clm50BgcCropQianRsGs + I2000Clm50BgcCropQianRs 2000_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV - I2000Clm45BgcCropQianRsGs + I2000Clm45BgcCropQianRs 2000_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV - I2000Clm50BgcCruGs - 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV - - - - I2000Clm50BgcCruRsGs + I2000Clm50BgcCruRs 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV I2000Clm50SpRtmFl - 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_RTM%FLOOD_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_RTM%FLOOD_SGLC_SWAV I2000Clm50Fates - 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV - I2000Clm50FatesCruGs + I2000Clm50FatesCru 2000_DATM%CRUv7_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV - - I2000Clm50FatesRsGs - 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_SROF_SGLC_SWAV - - - - I2000Clm50FatesRsGs + I2000Clm50FatesRs 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_SROF_SGLC_SWAV I1850Clm50Bgc - 1850_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV I1850Clm50BgcNoAnthro - 1850_DATM%GSWP3v1_CLM50%BGC-NOANTHRO_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM50%BGC-NOANTHRO_SICE_SOCN_MOSART_SGLC_SWAV I1850Clm50SpNoAnthro - 1850_DATM%GSWP3v1_CLM50%SP-NOANTHRO_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM50%SP-NOANTHRO_SICE_SOCN_MOSART_SGLC_SWAV IHistClm50BgcCrop - HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - IHistClm51BgcGs + IHistClm51Bgc HIST_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV - IHistClm51BgcCropGs + IHistClm51BgcCrop HIST_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV IHistClm50Sp - HIST_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + HIST_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV - - IHistClm50SpGs - HIST_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV - - - IHistClm50SpCru - HIST_DATM%CRUv7_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + HIST_DATM%CRUv7_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV IHistClm50Bgc - HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV - + - IHistClm50BgcQianGs + IHistClm50BgcQian HIST_DATM%QIA_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV - IHistClm50BgcQianRsGs + IHistClm50BgcQianRs HIST_DATM%QIA_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV ISSP585Clm50BgcCrop - SSP585_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + SSP585_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV ISSP126Clm50BgcCrop - SSP126_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + SSP126_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV ISSP119Clm50BgcCrop - SSP119_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + SSP119_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV ISSP245Clm50BgcCrop - SSP245_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + SSP245_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV ISSP370Clm50BgcCrop - SSP370_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + SSP370_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV ISSP434Clm50BgcCrop - SSP434_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + SSP434_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV ISSP460Clm50BgcCrop - SSP460_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + SSP460_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV ISSP534Clm50BgcCrop - SSP534_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + SSP534_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - + - IHistClm50BgcCropQianRsGs + IHistClm50BgcCropQianRs HIST_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV - + - IHistClm50BgcCropRsGs + IHistClm50BgcCropRs HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV I2000Clm50BgcDvCrop - 2000_DATM%GSWP3v1_CLM50%BGCDV-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM50%BGCDV-CROP_SICE_SOCN_MOSART_SGLC_SWAV - I2000Clm50BgcDvCropQianRsGs + I2000Clm50BgcDvCropQianRs 2000_DATM%QIA_CLM50%BGCDV-CROP_SICE_SOCN_SROF_SGLC_SWAV @@ -370,33 +324,33 @@ I1850Clm50BgcSpinup - 1850_DATM%CPLHIST_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV + 1850_DATM%CPLHIST_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV - I2000Ctsm50NwpSpGswpGs + I2000Ctsm50NwpSpGswp 2000_DATM%GSWP3v1_CLM50%NWP-SP_SICE_SOCN_MOSART_SGLC_SWAV - I2000Ctsm50NwpBgcCropGswpGs + I2000Ctsm50NwpBgcCropGswp 2000_DATM%GSWP3v1_CLM50%NWP-BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - I2000Ctsm50NwpSpNldasGs + I2000Ctsm50NwpSpNldas 2000_DATM%NLDAS2_CLM50%NWP-SP_SICE_SOCN_MOSART_SGLC_SWAV - I2000Ctsm50NwpSpNldasRsGs + I2000Ctsm50NwpSpNldasRs 2000_DATM%NLDAS2_CLM50%NWP-SP_SICE_SOCN_SROF_SGLC_SWAV @@ -404,11 +358,11 @@ I1850Clm45BgcCrop - 1850_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV - I1850Clm45BgcCruGs + I1850Clm45BgcCru 1850_DATM%CRUv7_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV @@ -417,86 +371,66 @@ IHistClm45BgcCrop - HIST_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV + HIST_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV - IHistClm45BgcCropQianRsGs + IHistClm45BgcCropQianRs HIST_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_SROF_SGLC_SWAV I2000Clm45Sp - 2000_DATM%GSWP3v1_CLM45%SP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV I2000Clm45BgcCrop - 2000_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV I2000Clm45Fates - 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - - I2000Clm45FatesRsGs - 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_SROF_SGLC_SWAV + 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_RTM_SGLC_SWAV + - I2000Clm45FatesRsGs + I2000Clm45FatesRs 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_SROF_SGLC_SWAV I1850Clm45Cn - 1850_DATM%GSWP3v1_CLM45%CN_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV + 1850_DATM%GSWP3v1_CLM45%CN_SICE_SOCN_RTM_SGLC_SWAV I1850Clm45Bgc - 1850_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - I1850Clm45BgcGs 1850_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - - I1850Clm45BgcCru - 1850_DATM%CRUv7_CLM45%BGC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - IHistClm45Bgc - HIST_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - IHistClm45BgcGs HIST_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - IHistClm45BgcCruGs + IHistClm45BgcCru HIST_DATM%CRUv7_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - IHistClm45SpGs + IHistClm45Sp HIST_DATM%GSWP3v1_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV @@ -505,11 +439,11 @@ I2000Clm50Vic - 2000_DATM%GSWP3v1_CLM50%SP-VIC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV + 2000_DATM%GSWP3v1_CLM50%SP-VIC_SICE_SOCN_RTM_SGLC_SWAV I2000Clm45VicCru - 2000_DATM%CRUv7_CLM45%SP-VIC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV + 2000_DATM%CRUv7_CLM45%SP-VIC_SICE_SOCN_RTM_SGLC_SWAV @@ -542,7 +476,7 @@ tests, but it seems most intuitive to use the same compset for both purposes.) --> - I2000Ctsm50NwpSpAsRsGs + I2000Ctsm50NwpSpAsRs 2000_SATM_CLM50%NWP-SP_SICE_SOCN_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 423fd1be72..2044ddf68e 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1,6 +1,6 @@ - + @@ -17,7 +17,7 @@ - + @@ -26,27 +26,27 @@ - + - + - + - + - + @@ -55,7 +55,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -129,7 +129,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -190,7 +190,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -206,7 +206,7 @@ - + @@ -214,7 +214,7 @@ - + @@ -223,7 +223,7 @@ - + @@ -231,7 +231,7 @@ - + @@ -239,7 +239,7 @@ - + @@ -247,7 +247,7 @@ - + @@ -256,7 +256,7 @@ - + @@ -339,7 +339,7 @@ - + @@ -347,7 +347,7 @@ - + @@ -355,7 +355,7 @@ - + @@ -363,7 +363,7 @@ - + @@ -371,7 +371,7 @@ - + @@ -442,7 +442,7 @@ - + @@ -450,7 +450,7 @@ - + @@ -459,7 +459,7 @@ - + @@ -494,7 +494,7 @@ - + @@ -502,7 +502,7 @@ - + @@ -510,7 +510,7 @@ - + @@ -518,7 +518,7 @@ - + @@ -526,7 +526,7 @@ - + @@ -535,7 +535,7 @@ - + @@ -544,7 +544,7 @@ - + @@ -572,7 +572,7 @@ - + @@ -614,7 +614,7 @@ - + @@ -692,7 +692,7 @@ - + @@ -700,7 +700,7 @@ - + @@ -708,7 +708,7 @@ - + @@ -716,7 +716,7 @@ - + @@ -733,33 +733,24 @@ - - - - - - - - - - + - + - + - + @@ -768,7 +759,7 @@ - + @@ -815,56 +806,56 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -872,27 +863,27 @@ - + - + - + - + - + @@ -946,7 +937,7 @@ - + @@ -1037,7 +1028,7 @@ - + @@ -1084,7 +1075,7 @@ - + @@ -1093,7 +1084,7 @@ - + @@ -1101,7 +1092,7 @@ - + @@ -1109,7 +1100,7 @@ - + @@ -1126,7 +1117,7 @@ - + @@ -1143,7 +1134,7 @@ - + @@ -1152,7 +1143,7 @@ - + @@ -1160,7 +1151,7 @@ - + @@ -1169,7 +1160,7 @@ - + @@ -1178,7 +1169,7 @@ - + @@ -1187,7 +1178,7 @@ - + @@ -1196,7 +1187,7 @@ - + @@ -1215,7 +1206,7 @@ - + @@ -1233,7 +1224,7 @@ - + @@ -1241,7 +1232,7 @@ - + @@ -1259,7 +1250,7 @@ - + @@ -1287,7 +1278,7 @@ - + @@ -1296,7 +1287,7 @@ - + @@ -1315,7 +1306,7 @@ - + @@ -1324,7 +1315,7 @@ - + @@ -1369,7 +1360,7 @@ - + @@ -1453,7 +1444,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1472,7 +1463,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1480,7 +1471,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1488,7 +1479,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1498,7 +1489,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1529,7 +1520,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1548,7 +1539,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1558,7 +1549,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1566,7 +1557,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1584,7 +1575,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1594,7 +1585,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1604,7 +1595,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1613,7 +1604,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1622,7 +1613,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1642,7 +1633,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1650,7 +1641,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1666,7 +1657,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1674,7 +1665,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1684,7 +1675,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1692,7 +1683,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1735,7 +1726,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1788,7 +1779,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1807,7 +1798,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1816,7 +1807,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1834,7 +1825,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1859,7 +1850,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1868,7 +1859,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1905,7 +1896,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1914,7 +1905,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1922,7 +1913,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1932,7 +1923,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2045,7 +2036,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2057,7 +2048,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2069,7 +2060,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2079,7 +2070,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2091,31 +2082,31 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + - + - + - + - + @@ -2123,7 +2114,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2148,7 +2139,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2164,7 +2155,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2172,7 +2163,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2239,7 +2230,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2279,7 +2270,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2289,7 +2280,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2299,7 +2290,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2320,7 +2311,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2331,7 +2322,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2344,7 +2335,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + diff --git a/cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism b/cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism deleted file mode 100644 index 85f5789000..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism +++ /dev/null @@ -1,9 +0,0 @@ -! The need for this is subtle. The problem is that this decStart testmod is used in short -! (multi-day) ERP tests, whose length is such that the end of the year occurs in the -! initial run but not in the restart run. Without setting history_option = 'coupler', this -! would mean that CISM outputs a history file in the initial run but not in the restart -! run, which causes the test to fail because the test system requires any component's -! final history file in one case to have a counterpart in the other case. Setting -! history_option = 'coupler' forces CISM to output a history file only at the end of the -! run. -history_option = 'coupler' diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index ad52f0b2d8..4774993e7e 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -22,7 +22,7 @@ # these are arbitrary, since we only use the case for its build, not any of the runtime # settings; they just need to be valid -_COMPSET = 'I2000Ctsm50NwpSpAsRsGs' +_COMPSET = 'I2000Ctsm50NwpSpAsRs' _RES = 'f10_f10_musgs' _PATH_TO_TEMPLATES = os.path.join(path_to_ctsm_root(), From 68054ec76f089578b5ff4364872f4b74c01b4960 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 29 Oct 2020 12:10:26 -0700 Subject: [PATCH 1581/1973] updating externals_CLM.cfg --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 448bb39a21..91a3403f5d 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.42.0_api.14.0.0 +tag = sci.1.43.0_api.14.1.0 required = True [PTCLM] From e3053a35e6960ef039ad2602f5ccf92ce11db901 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 30 Oct 2020 11:24:57 -0600 Subject: [PATCH 1582/1973] Fix indentation --- doc/source/lilac/specific-atm-models/wrf-tools.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf-tools.rst b/doc/source/lilac/specific-atm-models/wrf-tools.rst index 376f4ea5e4..ea8bd3a93b 100644 --- a/doc/source/lilac/specific-atm-models/wrf-tools.rst +++ b/doc/source/lilac/specific-atm-models/wrf-tools.rst @@ -46,20 +46,20 @@ is described in here. 3. Create ESMF mapping files by running ``regridbatch.sh``:: - qsub regridbatch.sh + qsub regridbatch.sh 4. In your ctsm repository directory, build:: - ../../../configure --macros-format Makefile --mpilib mpi-serial + ../../../configure --macros-format Makefile --mpilib mpi-serial 5. Generate CTSM domain files using ``get_domain`` tool:: - ./gen_domain -m /glade/work/$USER/ctsm/nldas_grid/scrip/wrf2clm_mapping_noneg.nc -o wrf2clm_ocn_noneg -l wrf2clm_lnd_noneg + ./gen_domain -m /glade/work/$USER/ctsm/nldas_grid/scrip/wrf2clm_mapping_noneg.nc -o wrf2clm_ocn_noneg -l wrf2clm_lnd_noneg 6. Create surface datasets in ``tools/mksurfdata_map``:: - ./mksurfdata.pl -res usrspec -usr_gname "nldas" -usr_gdate "190124" -usr_mapdir "/glade/work/$USER/ctsm/nldas_grid/map" -y 2000 -exedir "/glade/u/home/$USER/src/ctsm/ctsm_surfdata/tools/mksurfdata_map" -no-crop + ./mksurfdata.pl -res usrspec -usr_gname "nldas" -usr_gdate "190124" -usr_mapdir "/glade/work/$USER/ctsm/nldas_grid/map" -y 2000 -exedir "/glade/u/home/$USER/src/ctsm/ctsm_surfdata/tools/mksurfdata_map" -no-crop From 7fb8b420c9f698a70909fda7a3f2fc2b6513a9b7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 30 Oct 2020 12:33:49 -0600 Subject: [PATCH 1583/1973] Add doc-builder as an optional external --- .gitignore | 1 + Externals.cfg | 7 +++++++ doc/build_docs | 7 +++++++ 3 files changed, 15 insertions(+) create mode 100755 doc/build_docs diff --git a/.gitignore b/.gitignore index d5dd1a7132..26aca9549c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ manage_externals.log /tools/PTCLM/ /cime/ /components/ +/doc/doc-builder/ # ignore svn directories **/.svn/** diff --git a/Externals.cfg b/Externals.cfg index 556e30be13..98577aa1c1 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -41,6 +41,13 @@ tag = cime5.8.32 externals = ../Externals_cime.cfg required = True +[doc-builder] +local_path = doc/doc-builder +protocol = git +repo_url = https://github.com/ESMCI/doc-builder +tag = v1.0.0 +required = False + [externals_description] schema_version = 1.0.0 diff --git a/doc/build_docs b/doc/build_docs new file mode 100755 index 0000000000..5d71933e0b --- /dev/null +++ b/doc/build_docs @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [ -f doc-builder/build_docs ]; then + doc-builder/build_docs "$@" +else + echo "Obtain doc-builder by running ./manage_externals/checkout_externals -o from the top-level" +fi From 3011cb61522e0dbffaaeeb63f5e3e8c27a0ced77 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 30 Oct 2020 16:47:13 -0600 Subject: [PATCH 1584/1973] Update version of doc-builder --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 98577aa1c1..08aca5394a 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -45,7 +45,7 @@ required = True local_path = doc/doc-builder protocol = git repo_url = https://github.com/ESMCI/doc-builder -tag = v1.0.0 +tag = v1.0.1 required = False [externals_description] From 8c75ebee9ce56b00786ccb19bd2e8106ed644460 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 1 Nov 2020 09:01:52 -0700 Subject: [PATCH 1585/1973] Update version of doc-builder --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 08aca5394a..a7be1a1bea 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -45,7 +45,7 @@ required = True local_path = doc/doc-builder protocol = git repo_url = https://github.com/ESMCI/doc-builder -tag = v1.0.1 +tag = v1.0.2 required = False [externals_description] From 52d931a1a6ca4da34026f229aefdcbe21a11a85c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 1 Nov 2020 12:35:02 -0700 Subject: [PATCH 1586/1973] Point to updated rtm & mosart tags These tags fix the test lists to use new compset names --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 556e30be13..ea74046ebb 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -16,14 +16,14 @@ required = True local_path = components/rtm protocol = git repo_url = https://github.com/ESCOMP/RTM -tag = rtm1_0_72 +tag = rtm1_0_73 required = True [mosart] local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/MOSART -tag = mosart1_0_37 +tag = mosart1_0_38 required = True [cdeps] From f75335a45ea99ed70f9ca858de4b0ccc7bd48537 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 1 Nov 2020 13:15:56 -0700 Subject: [PATCH 1587/1973] No longer need a specific testmod for the LII test We used to need a testmod that turned off GLC_TWO_WAY_COUPLING and pointed to a compatible initial conditions file. However, this is no longer needed, because: - An LII test passes now even with GLC_TWO_WAY_COUPLING on (because https://github.com/ESCOMP/ctsm/issues/340 has been resolved) - Even if that weren't the case, this compset now uses SGLC, which sets GLC_TWO_WAY_COUPLING=FALSE. - The out-of-the-box initial conditions file is currently compatible with this configuration, so there's no need to point to an initial conditions file specifically for this test. (We could reintroduce a testmods later if we no longer have an out-of-the-box initial conditions file compatible with this test... though it may be better just to change the test so that it continues to have a compatible out-of-the-box initial conditions file, so that we don't need to maintain an initial conditions file just for this test.) --- cime_config/SystemTests/lii.py | 8 ++--- cime_config/testdefs/testlist_clm.xml | 4 +-- .../clm/glcMEC_spunup_1way/README | 34 ------------------- .../clm/glcMEC_spunup_1way/include_user_mods | 1 - .../clm/glcMEC_spunup_1way/shell_commands | 1 - .../clm/glcMEC_spunup_1way/user_nl_clm | 5 --- 6 files changed, 6 insertions(+), 47 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm diff --git a/cime_config/SystemTests/lii.py b/cime_config/SystemTests/lii.py index 3a76a18847..d89bd0aa09 100644 --- a/cime_config/SystemTests/lii.py +++ b/cime_config/SystemTests/lii.py @@ -1,5 +1,4 @@ -""" -Implementation of the CIME LII test. +"""Implementation of the CIME LII test. This is a CLM specific test: Verifies that interpolation of initial conditions onto an identical @@ -25,8 +24,9 @@ space. Rename this to be similar to the name of the file pointed to in this test's user_nl_ctsm file, but with a new creation date. -(3) Update this test's user_nl_ctsm file (in the appropriate testmods directory) -to point to the new finidat file. +(3) Update this test's user_nl_ctsm file (in the appropriate testmods directory, or in +namelist_defaults if the test is using an out-of-the-box initial conditions file and it is +acceptable to update that file) to point to the new finidat file. """ from CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 2044ddf68e..7e5854d59b 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1260,13 +1260,13 @@ - + - + diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README deleted file mode 100644 index ec74e38b4c..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README +++ /dev/null @@ -1,34 +0,0 @@ -This testmods directory is for running LII tests which compare the answers for a case where -initial condition interpolation is on (use_init_interp=T) to a case with it's off and ensures -they are exact. For the interpolated result to match uninterpolation, it needs to be a case that -essentially needs no interpolation so it's at the same resolution as the initial condition -file (finidat file). When surface datasets are changed, or the land-mask is changed, or an -important change is made to model physics (for example where new fields are added to the restart -file) -- you'll need to update the initial conditions file in this test (finidat file in -the user_nl_clm file). - -This testmods also turns off the glc two-way coupling. This is done so that -glacier areas are taken from the restart file rather than from -CISM. This is partly so that changes in CISM don't affect the test -results, but more importantly so that LII tests can pass even if CISM -changes. (GLC two-way coupling was off in the generation of the -initial conditions file used here, too.) (4-24-18: I *think* we'll be -able to turn two-way coupling on once -https://github.com/ESCOMP/ctsm/issues/340 is resolved, though I'm not -positive about that. However, if -https://github.com/ESMCI/cime/issues/2484 is done, then we'd need this -testmods to turn off comparison of cpl initial hist files if we have -two-way coupling on, since areas will differ in initialization between -the two cases.) - -To update the initial conditions (finidat) file for this test: - -(1) Run the LII test; the 'base' case should run to completion even if the -no_interp test fails. - -(2) Copy the finidat_interp_dest.nc file from the 'base' case to the inputdata -space. Rename this to be similar to the name of the file pointed to in this -test's user_nl_clm file, but with a new creation date. - -(3) Update this the user_nl_clm file in this directory to point to the new -finidat file. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods deleted file mode 100644 index 1730b6b7cf..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../glcMEC diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands deleted file mode 100755 index 404b22b006..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange GLC_TWO_WAY_COUPLING=FALSE diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm deleted file mode 100644 index 44014d43e0..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm +++ /dev/null @@ -1,5 +0,0 @@ -! See more notes in the README file in this directory and in the comments in the test list. -! -! Initial condition file at the desired configuration to run, so can verify that interpolating from it gives the same result -! Note that this was generated with GLC_TWO_WAY_COUPLING=FALSE -finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2000-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c200428.nc' From 4cdd95ff9a500c1fd9f6c1415c45337b25f35379 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 1 Nov 2020 13:42:57 -0700 Subject: [PATCH 1588/1973] Remove some comments in the LII2FINIDATAREAS test I don't *think* it is the case any more that having GLC_TWO_WAY_COUPLING=TRUE makes this test more powerful. (I'm thinking that this stopped being true once we resolved https://github.com/ESCOMP/ctsm/issues/340, which was also when the standard LII test stopped needing GLC_TWO_WAY_COUPLING=FALSE. But I may be forgetting some reason why GLC_TWO_WAY_COUPLING is still preferable in this LII2FINIDATAREAS test.) --- cime_config/SystemTests/lii2finidatareas.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/cime_config/SystemTests/lii2finidatareas.py b/cime_config/SystemTests/lii2finidatareas.py index 82fec80013..f7a0a2f10e 100644 --- a/cime_config/SystemTests/lii2finidatareas.py +++ b/cime_config/SystemTests/lii2finidatareas.py @@ -1,17 +1,11 @@ -""" -Implementation of the LII2FINIDATAREAS test. +"""Implementation of the LII2FINIDATAREAS test. This is similar to the LII test, but tests init_interp with mode 'use_finidat_areas'. -As with the standard LII test, this must be used in a configuration for -which we have a compatible out-of-the-box finidat file (so that the run -with use_init_interp = .false. runs successfully). In constrast to our -standard LII test (which uses glcMEC_spunup_1way), this one can use a -standard CISM2%NOEVOLVE configuration: we do *not* need to set -GLC_TWO_WAY_COUPLING=FALSE; in fact, it's a better test if we have -GLC_TWO_WAY_COUPLING=TRUE: with this mode of operation, areas should -match between the two runs. +As with the standard LII test, this must be used in a configuration for which we have a +compatible out-of-the-box finidat file (so that the run with use_init_interp = +.false. runs successfully). It may not be totally necessary to have a system test covering this init_interp_method: between unit tests and inline checks, we have quite From e350beceda68dbab93ecb5400e03261912be28a3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 1 Nov 2020 14:04:24 -0700 Subject: [PATCH 1589/1973] Change the glcMEC_changeFlags test to be more useful The compset it was using was changed to SGLC. So the first order of business was changing this test to use a compset with CISM, so that the test of GLC_TWO_WAY_COUPLING=FALSE is meaningful. I wondered if we really needed to still test that flag, but there are some places in the code where the glc_do_dynglacier logic wouldn't be completely covered by testing if the only time that was false was in tests using SGLC - so I do think there is at least some small value in keeping a test that sets glc_do_dynglacier to false in a test with an active CISM. While I was doing this, I also changed a few other things about this test: - I am using a testmod that forces CISM to experience large, fast area changes, to better test GLC_TWO_WAY_COUPLING=FALSE - I changed the grid and compiler to achieve better test suite turnaround time --- cime_config/testdefs/testlist_clm.xml | 5 +++-- .../testdefs/testmods_dirs/clm/glcMEC_changeFlags/README | 8 +++++++- .../clm/glcMEC_changeFlags/include_user_mods | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 7e5854d59b..0a151d27fb 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -265,12 +265,13 @@ - + - + + diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README b/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README index 2e8fcfc52e..5afac87d62 100644 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README +++ b/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README @@ -1,4 +1,10 @@ This testmods directory switches some glc_mec-related flags in CLM, in order to test different branches than are tested with the default options. -It also turns off the feedback from CISM to CLM, to test that option. +It also turns off the feedback from CISM to CLM, to test that +option. For this piece of the test to be useful, it should be used in a +test that uses CISM rather than SGLC, and ideally should be in a test +where CISM's glacier areas change within the test (though that last +piece may not be strictly necessary, since the relevant logic will still +be exercised in the first time step of the run even with a non-evolving +CISM). diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods index 1730b6b7cf..f076fe1cf5 100644 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods @@ -1 +1 @@ -../glcMEC +../glcMEC_increase From dd3a4ee7271e5d49db8062299f3c1c9bfde6a542 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 1 Nov 2020 14:15:29 -0700 Subject: [PATCH 1590/1973] Remove _gl4 from resolution in tests that no longer use CISM --- cime_config/testdefs/testlist_clm.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 0a151d27fb..cd6ab98e5f 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -8,7 +8,7 @@ - + @@ -1066,7 +1066,7 @@ - + @@ -1763,7 +1763,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + From a3ced0e5a547597477e07cae933915119cd23367 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Nov 2020 10:46:16 -0700 Subject: [PATCH 1591/1973] Update ChangeLog --- doc/ChangeLog | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 184 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 80bbc4e759..39c5ad11aa 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,187 @@ =============================================================== +Tag name: ctsm5.1.dev011 +Originator(s): sacks (Bill Sacks) +Date: Mon Nov 2 10:28:35 MST 2020 +One-line Summary: Change CISM2%NOEVOLVE compsets to use SGLC; documentation updates + +Purpose of changes +------------------ + +(1) Change CISM2%NOEVOLVE compsets to use SGLC. + +The use of CISM2%NOEVOLVE adds complexity and (perhaps most importantly) +increases the turnaround time of CTSM software testing, while adding +only marginal scientific value. Therefore, we are changing I compsets to +use a stub glacier (SGLC) rather than CISM2%NOEVOLVE for now. Within the +next year, we'd like to have these use a data glc model, but that will +most likely wait until we switch to using NUOPC by default (so we can +use a data glc in CDEPS: ESCOMP/CDEPS#25). + +This tag changes the meaning of compset aliases that previously had +neither a Gs (for stub glacier) or G (for CISM2%EVOLVE), so that they +now use a stub glacier (SGLC) rather than CISM2%NOEVOLVE. Compset +aliases that previously had Gs (so were already using a stub glacier) +have been changed so that there is no longer a Gs in the alias: stub +glacier is now the implied default. + +This change reduces our test build time to 40% of what it previously +was! When I ran the test suite for ctsm5.1.dev010, the cheyenne-intel +test suite (by far the largest of our test suites) took 5 hours, 8 min +to build. In yesterday's run of the test suite with this change in +place, the cheyenne-intel test suite took only 2 hours, 6 min to build! +The final test in this test suite finished running just 2 hours, 29 min +after I started the test suite. This may not be a completely fair +comparison, because the machine may have been relatively lightly loaded +during this Sunday afternoon run, but I wouldn't expect the test suite +build time (which is what I'm reporting here) to be hugely impacted by +that. + +Changes due to using SGLC in place of CISM2%NOEVOLVE are documented +here: +. + +(2) Documentation updates + +Brings in a new optional external, doc-builder, to assist with building +the documentation, specifically with a new Docker-based workflow +documented here +. + +Also updates LILAC documentation and a bit more. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1135 (Replace CISM2%NOEVOLVE compsets with SGLC) + +Known bugs introduced in this tag (include github issue ID): +- See ESCOMP/CTSM#1136 (Use data glc model where we used to use CISM2%NOEVOLVE) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- This tag changes the meaning of compset aliases that previously had + neither a Gs (for stub glacier) or G (for CISM2%EVOLVE), so that they + now use a stub glacier (SGLC) rather than CISM2%NOEVOLVE. Compset + aliases that previously had Gs (so were already using a stub glacier) + have been changed so that there is no longer a Gs in the alias: stub + glacier is now the implied default. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Changed compsets used in testing according to the above notes. In + particular, this involved removing the 'Gs' from compset names in + tests. +- No longer need a specific testmod for the LII test (see commit + f75335a45) +- Changed the glcMEC_changeFlags test to be more useful (see commit + e350beced) +- Removed _gl4 from resolution in tests that no longer use CISM + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok: tests pass, baselines fail as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES + + Summarize any changes to answers, i.e., + - what code configurations: ALL + - what platforms/compilers: ALL + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Larger than roundoff; potentially new climate regionally, over Greenland + + The changes arise from changes in the meaning of + compsets. Configurations that used to use a stub GLC (compsets + with Gs in their alias) have the same meaning as before, but a + different compset alias (so in testing, this resulted in BFAILs + due to missing baselines). Configurations that previously used + CISM2%NOEVOLVE (which included most of our standard + configurations) now instead use a stub GLC. This results in + differences over Greenland (in ways described here: + ). + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: N/A + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- New doc-builder external (at v1.0.2) + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev010 Originator(s): sacks (Bill Sacks), jedwards (Jim Edwards) Date: Fri Oct 23 14:36:03 MDT 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index ea890c5781..9dae06bd90 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev011 sacks 11/02/2020 Change CISM2%NOEVOLVE compsets to use SGLC; documentation updates ctsm5.1.dev010 sacks/je 10/23/2020 Fix reading netcdf variable into a different data type ctsm5.1.dev009 negins 10/21/2020 BFB changes for Perturbed Parameter Ensemble and Hydraulic redistribution ctsm5.1.dev008 erik 10/07/2020 Two answer changes: Clm45/50/51 with crop, and for 2000Clm51 From dcb56e8d78f4d468f9c1b80734b8e54cff77ad54 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Nov 2020 12:33:13 -0700 Subject: [PATCH 1592/1973] Remove the snowlayers_3_monthly test I had noted in the comment for that test that it could be removed once CLM5 had been out for a while. That is now the case. --- cime_config/testdefs/testlist_clm.xml | 9 --------- .../clm/snowlayers_3_monthly/include_user_mods | 1 - .../testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm | 4 ---- 3 files changed, 14 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index cd6ab98e5f..30fbcc0f37 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1771,15 +1771,6 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods deleted file mode 100644 index 399579f425..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../monthly diff --git a/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm deleted file mode 100644 index e7500fff58..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm +++ /dev/null @@ -1,4 +0,0 @@ -nlevsno = 3 - -! Need to set use_init_interp because initial conditions file has 5 snow layers -use_init_interp = .true. From cb66f1bf45cace6600062e00c9bca3be1d94614f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Nov 2020 12:49:16 -0700 Subject: [PATCH 1593/1973] Add a test with nlevgrnd < nlevurb The main point of this testmod is to exercise the case where nlevgrnd < nlevurb (connected with https://github.com/ESCOMP/CTSM/issues/674). If/when we have an out-of-the-box configuration with nlevgrnd < nlevurb (such as the NWP configuration once nlevurb = 10 is the standard) then we can remove this test. A secondary consideration is having a test that interpolates from a configuration with nlevgrnd > nlevurb onto one with lower nlevgrnd and nlevgrnd < nlevurb. But I don't think it's critical to maintain this test just for that purpose - e.g., if we start having an out-of-the-box configuration with nlevgrnd < nlevurb but where the finidat file also has nlevgrnd < nlevurb, then I feel it will be okay to remove this test. --- cime_config/testdefs/testlist_clm.xml | 10 ++++++++++ .../testmods_dirs/clm/nlevgrnd_small/README | 13 +++++++++++++ .../clm/nlevgrnd_small/include_user_mods | 1 + .../testmods_dirs/clm/nlevgrnd_small/user_nl_clm | 8 ++++++++ 4 files changed, 32 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/README create mode 100644 cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 30fbcc0f37..f12cf0f16d 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1771,6 +1771,16 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/README b/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/README new file mode 100644 index 0000000000..3be0d15bfc --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/README @@ -0,0 +1,13 @@ +The main point of this testmod is to exercise the case where nlevgrnd < +nlevurb (connected with +https://github.com/ESCOMP/CTSM/issues/674). If/when we have an +out-of-the-box configuration with nlevgrnd < nlevurb (such as the NWP +configuration once nlevurb = 10 is the standard) then we can remove this +test. + +A secondary consideration is having a test that interpolates from a +configuration with nlevgrnd > nlevurb onto one with lower nlevgrnd and +nlevgrnd < nlevurb. But I don't think it's critical to maintain this +test just for that purpose - e.g., if we start having an out-of-the-box +configuration with nlevgrnd < nlevurb but where the finidat file also +has nlevgrnd < nlevurb, then I feel it will be okay to remove this test. diff --git a/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/include_user_mods new file mode 100644 index 0000000000..fe0e18cf88 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/include_user_mods @@ -0,0 +1 @@ +../default diff --git a/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/user_nl_clm new file mode 100644 index 0000000000..d7e1f9bbc2 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/nlevgrnd_small/user_nl_clm @@ -0,0 +1,8 @@ +! The following results in nlevsoi = 3, nlevgrnd = 4; together with the standard setting +! of nlevurb = 5, this results in nlevgrnd < nlevurb, which is what we particularly want +! to test here. +soil_layerstruct_userdefined = 0.2, 0.4, 0.8, 1.6 +soil_layerstruct_userdefined_nlevsoi = 3 + +! Need to make sure interpolation is on because of the change in nlevgrnd relative to finidat +use_init_interp = .true. From 7ae28f2b7243d56d2985fcc26dacf1796e338513 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 2 Nov 2020 11:56:42 -0800 Subject: [PATCH 1594/1973] fixing merge de-conflict error in externals tags --- Externals_CLM.cfg | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 72d7fb1c4e..91a3403f5d 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,13 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -<<<<<<< HEAD tag = sci.1.43.0_api.14.1.0 -||||||| c724747c -tag = sci.1.42.0_api.14.0.0 -======= -tag = sci.1.42.4_api.14.0.0 ->>>>>>> fates_main_api required = True [PTCLM] From ff839e3f8fb38271b4b2231e4e883c5eff6f69c0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Nov 2020 13:32:56 -0700 Subject: [PATCH 1595/1973] Remove duplicate settings of t_h2osfc_bef --- src/biogeophys/BiogeophysPreFluxCalcsMod.F90 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/biogeophys/BiogeophysPreFluxCalcsMod.F90 b/src/biogeophys/BiogeophysPreFluxCalcsMod.F90 index 6967ffdd4d..f533a62916 100644 --- a/src/biogeophys/BiogeophysPreFluxCalcsMod.F90 +++ b/src/biogeophys/BiogeophysPreFluxCalcsMod.F90 @@ -249,8 +249,6 @@ subroutine CalcInitialTemperatureAndEnergyVars(bounds, & .and. col%itype(c) /= icol_roof) then tssbef(c,j) = t_soisno(c,j) end if - ! record t_h2osfc prior to updating - t_h2osfc_bef(c) = t_h2osfc(c) end do end do @@ -265,8 +263,6 @@ subroutine CalcInitialTemperatureAndEnergyVars(bounds, & tssbef(c,j) = t_soisno(c,j) end if end if - ! record t_h2osfc prior to updating - t_h2osfc_bef(c) = t_h2osfc(c) end do end do @@ -274,6 +270,9 @@ subroutine CalcInitialTemperatureAndEnergyVars(bounds, & c = filter_nolakec(fc) l = col%landunit(c) + ! record t_h2osfc prior to updating + t_h2osfc_bef(c) = t_h2osfc(c) + ! ground temperature is weighted average of exposed soil, snow, and h2osfc if (snl(c) < 0) then t_grnd(c) = frac_sno_eff(c) * t_soisno(c,snl(c)+1) & From 60f00d8e5c51e41f72d031f75c0f61f491dab8c6 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Nov 2020 13:34:15 -0700 Subject: [PATCH 1596/1973] Remove unused local variables --- src/biogeophys/TotalWaterAndHeatMod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index c46c1ffbce..ffce06b552 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -349,7 +349,6 @@ subroutine AccumulateSoilLiqIceMassNonLake(bounds, num_c, filter_c, & ! !LOCAL VARIABLES: integer :: c, j, fc ! indices logical :: has_h2o ! whether this point potentially has water to add - integer :: nlev ! greater of nlevgrnd and nlevurb character(len=*), parameter :: subname = 'AccumulateSoilLiqIceMassNonLake' !----------------------------------------------------------------------- @@ -801,7 +800,6 @@ subroutine AccumulateSoilHeatNonLake(bounds, num_c, filter_c, & ! !LOCAL VARIABLES: integer :: fc integer :: l, c, j - integer :: nlev ! greater of nlevgrnd and nlevurb logical :: has_h2o ! whether this point potentially has water to add real(r8) :: soil_heat_liquid(bounds%begc:bounds%endc) ! sum of heat content: liquid water in soil, excluding latent heat [J/m^2] From b5356e86f0f8ee2c23986ea4c36bb80bf9c0de07 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Nov 2020 14:07:58 -0700 Subject: [PATCH 1597/1973] Change some loops in SoilThermProp for efficiency --- src/biogeophys/SoilTemperatureMod.F90 | 34 ++++++++++++--------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 index 9c915e5f1e..e8a6b0ef68 100644 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ b/src/biogeophys/SoilTemperatureMod.F90 @@ -278,7 +278,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter ! Thermal conductivity and Heat capacity tk_h2osfc(begc:endc) = nan - call SoilThermProp(bounds, num_nolakec, filter_nolakec, & + call SoilThermProp(bounds, num_urbanc, filter_urbanc, num_nolakec, filter_nolakec, & tk(begc:endc, :), & cv(begc:endc, :), & tk_h2osfc(begc:endc), & @@ -548,7 +548,7 @@ subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_urbanc, filter end subroutine SoilTemperature !----------------------------------------------------------------------- - subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & + subroutine SoilThermProp (bounds, num_urbanc, filter_urbanc, num_nolakec, filter_nolakec, & tk, cv, tk_h2osfc, & urbanparams_inst, temperature_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, soilstate_inst) @@ -576,6 +576,8 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_urbanc ! number of urban columns in clump + integer , intent(in) :: filter_urbanc(:) ! urban column filter integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points real(r8) , intent(out) :: cv( bounds%begc: , -nlevsno+1: ) ! heat capacity [J/(m2 K) ] [col, lev] @@ -692,8 +694,8 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & end do do j = 1,nlevurb - do fc = 1, num_nolakec - c = filter_nolakec(fc) + do fc = 1, num_urbanc + c = filter_urbanc(fc) l = col%landunit(c) if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then @@ -762,18 +764,12 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & else if (lun%itype(l) == istice_mec) then cv(c,j) = (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) endif - if (j == 1 .and. col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall .and. & - col%itype(c) /= icol_roof .and. col%itype(c) /= icol_road_imperv) then - if (h2osno_no_layers(c) > 0._r8) then - cv(c,j) = cv(c,j) + cpice*h2osno_no_layers(c) - end if - end if enddo end do do j = 1, nlevurb - do fc = 1,num_nolakec - c = filter_nolakec(fc) + do fc = 1,num_urbanc + c = filter_urbanc(fc) l = col%landunit(c) if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then cv(c,j) = cv_wall(l,j) * dz(c,j) @@ -782,16 +778,16 @@ subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & else if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then cv(c,j) = cv_improad(l,j) * dz(c,j) endif - if (j == 1 .and. (col%itype(c) == icol_sunwall .or. & - col%itype(c) == icol_shadewall .or. col%itype(c) == icol_roof .or. & - col%itype(c) == icol_road_imperv)) then - if (h2osno_no_layers(c) > 0._r8) then - cv(c,j) = cv(c,j) + cpice*h2osno_no_layers(c) - end if - end if end do end do + do fc = 1, num_nolakec + c = filter_nolakec(fc) + if (h2osno_no_layers(c) > 0._r8) then + cv(c,1) = cv(c,1) + cpice*h2osno_no_layers(c) + end if + end do + ! Snow heat capacity do j = -nlevsno+1,0 From dce0e99aaf9defa3c0a02a47c10e415e29484059 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 2 Nov 2020 14:17:35 -0700 Subject: [PATCH 1598/1973] Add levsoi coordinate variable Also fix the long names of some existing coordinate variables --- src/main/histFileMod.F90 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index d6c70b7ebe..977700c49e 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2495,6 +2495,7 @@ subroutine htape_timeconst(t, mode) ! contents. ! ! !USES: + use clm_varpar , only : nlevsoi use clm_varcon , only : zsoi, zlak, secspday, isecspday, isecsphr, isecspmin use domainMod , only : ldomain, lon1d, lat1d use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time @@ -2574,12 +2575,15 @@ subroutine htape_timeconst(t, mode) if (mode == 'define') then call ncd_defvar(varname='levgrnd', xtype=tape(t)%ncprec, & dim1name='levgrnd', & - long_name='coordinate soil levels', units='m', ncid=nfid(t)) + long_name='coordinate ground levels', units='m', ncid=nfid(t)) + call ncd_defvar(varname='levsoi', xtype=tape(t)%ncprec, & + dim1name='levsoi', & + long_name='coordinate soil levels (equivalent to top nlevsoi levels of levgrnd)', units='m', ncid=nfid(t)) call ncd_defvar(varname='levlak', xtype=tape(t)%ncprec, & dim1name='levlak', & long_name='coordinate lake levels', units='m', ncid=nfid(t)) call ncd_defvar(varname='levdcmp', xtype=tape(t)%ncprec, dim1name='levdcmp', & - long_name='coordinate soil levels', units='m', ncid=nfid(t)) + long_name='coordinate levels for soil decomposition variables', units='m', ncid=nfid(t)) if(use_fates)then @@ -2632,6 +2636,7 @@ subroutine htape_timeconst(t, mode) elseif (mode == 'write') then if ( masterproc ) write(iulog, *) ' zsoi:',zsoi call ncd_io(varname='levgrnd', data=zsoi, ncid=nfid(t), flag='write') + call ncd_io(varname='levsoi', data=zsoi(1:nlevsoi), ncid=nfid(t), flag='write') call ncd_io(varname='levlak' , data=zlak, ncid=nfid(t), flag='write') if (use_vertsoilc) then call ncd_io(varname='levdcmp', data=zsoi, ncid=nfid(t), flag='write') From b0757e7aee723af40ea2ac785f233eaf04a63ec9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 3 Nov 2020 09:38:19 -0700 Subject: [PATCH 1599/1973] Update ChangeLog --- doc/ChangeLog | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 108 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 39c5ad11aa..770dad6006 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,111 @@ =============================================================== +Tag name: ctsm5.1.dev012 +Originator(s): oleson (Keith Oleson) / sacks (Bill Sacks) +Date: Tue Nov 3 09:31:41 MST 2020 +One-line Summary: Allow nlevgrnd < nlevurb + +Purpose of changes +------------------ + +Allow nlevgrnd < nlevurb. This will become more important soon, when +nlevurb is increased to 10, yet we want to allow simple soil layer +structures, e.g., for NWP applications. + +Also some additions to ncdio-related utilities to support this, +including extending find_var_on_file to support dimensions as well as +variables. + +Also add levsoi coordinate variable on history files. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#674 (Allow nlevgrnd less than nlevurb) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: +- Removed the no-longer-useful snowlayers_3_monthly test +- Added a test with nlevgrnd < nlevurb + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1195 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev011 Originator(s): sacks (Bill Sacks) Date: Mon Nov 2 10:28:35 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 9dae06bd90..d9edfd061a 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev012 oleson/s 11/03/2020 Allow nlevgrnd < nlevurb ctsm5.1.dev011 sacks 11/02/2020 Change CISM2%NOEVOLVE compsets to use SGLC; documentation updates ctsm5.1.dev010 sacks/je 10/23/2020 Fix reading netcdf variable into a different data type ctsm5.1.dev009 negins 10/21/2020 BFB changes for Perturbed Parameter Ensemble and Hydraulic redistribution From 9ca4bfe8580ecdd3143c364c7feb1f1d68e56522 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 3 Nov 2020 13:04:14 -0700 Subject: [PATCH 1600/1973] add anomaly forcing section --- .../Running-with-anomaly-forcing.rst | 45 +++++++++++++++++++ .../running-special-cases/index.rst | 1 + 2 files changed, 46 insertions(+) create mode 100644 doc/source/users_guide/running-special-cases/Running-with-anomaly-forcing.rst diff --git a/doc/source/users_guide/running-special-cases/Running-with-anomaly-forcing.rst b/doc/source/users_guide/running-special-cases/Running-with-anomaly-forcing.rst new file mode 100644 index 0000000000..10af089814 --- /dev/null +++ b/doc/source/users_guide/running-special-cases/Running-with-anomaly-forcing.rst @@ -0,0 +1,45 @@ +.. _running-with-anomaly-forcing: + +.. include:: ../substitutions.rst + +============================== + Running with anomaly forcing +============================== +Because performing fully coupled climate simulations is computationally expensive, an alternate method of running land-only simulations forced by future climate projections was developed for CTSM called 'anomaly forcing'. The anomaly forcing method uses a previously completed fully coupled simulation to create monthly anomalies, relative to the present day, of near-surface atmospheric states and fluxes. These anomalies, representing the evolution of future climate projections, are applied to a repeating cycle of present day atmospheric forcing data, either as an additive (for states) or multiplicative (for fluxes) quantity. Thus, high-frequency variability is obtained from the present day atmospheric forcing data, while the long-term evolution of the climate is determined by the anomaly forcing dataset. + +To enable anomaly forcing in a CTSM simulation, the following namelist variable can be added to the user\_nl\_datm file: + + anomaly\_forcing = 'Anomaly.Forcing.Precip','Anomaly.Forcing.Temperature','Anomaly.Forcing.Pressure','Anomaly.Forcing.Humidity','Anomaly.Forcing.Uwind','Anomaly.Forcing.Vwind','Anomaly.Forcing.Shortwave','Anomaly.Forcing.Longwave' + +Any combination or subset of forcing variables can be used, e.g. to modify only a single atmospheric forcing variable, one could use: + + anomaly\_forcing = 'Anomaly.Forcing.Temperature' + +which will only adjust the temperature (TBOT). + +After the namelist has been created, the run directory will be populated with files such as these: + + datm.streams.txt.Anomaly.Forcing.Temperature + +which will contain the location of the default anomaly forcing datasets. To use alternative data, copy these files to the case directory with the 'user\_' prefix, and modify the 'user\_*' files accordingly, e.g.: + + user\_datm.streams.txt.Anomaly.Forcing.Temperature + + For example, one could use the user\_datm.streams.txt.Anomaly.Forcing.* files to point to these SSP-derived anomaly forcing datasets: + + /glade/p/cesmdata/cseg/inputdata/atm/datm7/anomaly\_forcing/CMIP6-SSP3-7.0 + + af.huss.cesm2.SSP3-7.0.2015-2100\_c20200329.nc + af.pr.cesm2.SSP3-7.0.2015-2100\_c20200329.nc + af.ps.cesm2.SSP3-7.0.2015-2100\_c20200329.nc + af.rlds.cesm2.SSP3-7.0.2015-2100\_c20200329.nc + af.rsds.cesm2.SSP3-7.0.2015-2100\_c20200329.nc + af.tas.cesm2.SSP3-7.0.2015-2100\_c20200329.nc + +Users may wish to also update files such as the landuse\_timeseries and aerosol and Ndepostion files to correspond to the appropriate SSP. + +For single point simulations, the global anomaly forcing files can be used, but the map_algo namelist variable should be appended with nearest neighbor values for each of the anomaly forcing fields, e.g. + + mapalgo = 'nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn' (the number of 'nn' values will depend on the number of original streams plus the number of anomaly forcing streams) + +The cycling of the present-day (base) climate is controlled through the DATM\_CLMNCEP\_YR\_START and DATM_CLMNCEP\_YR\_END variables in env\_run.xml. diff --git a/doc/source/users_guide/running-special-cases/index.rst b/doc/source/users_guide/running-special-cases/index.rst index f063992c67..f84b7706fb 100644 --- a/doc/source/users_guide/running-special-cases/index.rst +++ b/doc/source/users_guide/running-special-cases/index.rst @@ -22,3 +22,4 @@ Running Special Cases Running-with-MOAR-data-as-atmospheric-forcing-to-spinup-the-model.rst Running-with-your-own-previous-simulation-as-atmospheric-forcing-to-spinup-the-model.rst Running-stand-alone-CLM-with-transient-historical-CO2-concentration.rst + Running-with-anomaly-forcing.rst From 6712d36d67146563c2265f9568ad6d0d0d7fc9f0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 4 Nov 2020 14:07:52 -0700 Subject: [PATCH 1601/1973] Reduce wallclock time for C96 tests These sometimes sit in the queue for a while. SMS_Ln9.C96_C96_mg17.IHistClm50BgcCrop.cheyenne_intel.clm-default takes less than 4 minutes to run, so a wallclock time of 10 min should be sufficient, and hopefully this will decrease the queue wait time. --- cime_config/testdefs/testlist_clm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index f12cf0f16d..a8f1c0cefd 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -307,7 +307,7 @@ - + @@ -1016,7 +1016,7 @@ - + From 6eb4c3c727c53533852af8f09675ce69be59f921 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 4 Nov 2020 15:06:26 -0700 Subject: [PATCH 1602/1973] Change PE counts for C96 and C192 resolutions The main motivation for this is to get the aux_clm C96 test through the queue faster (the current test sometimes waits for multiple hours in the queue). (1) Make the out-of-the-box PE counts unthreaded, as is standard for I compsets (2) In the aux_clm test for C92, use a 360x2 PE layout: Use a PE layout that (a) has threading, because CAM uses threading at this resolution; and (b) has a smaller-than-standard task count in order to get through the queue faster. --- cime_config/config_pes.xml | 32 +++++++++++++-------------- cime_config/testdefs/testlist_clm.xml | 4 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index d391f2b9d1..909c0d8049 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -757,14 +757,14 @@ -48 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 0 @@ -831,14 +831,14 @@ -48 - 2 - 2 - 2 - 2 - 2 - 2 - 2 - 2 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 0 diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index a8f1c0cefd..a818fa5d29 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -302,13 +302,13 @@ - + - + From 1153267a17296126ee451c2ed054e4765d906927 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 4 Nov 2020 15:42:01 -0700 Subject: [PATCH 1603/1973] Update ChangeLog --- doc/ChangeLog | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 128 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 770dad6006..9e52f6939f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,131 @@ =============================================================== +Tag name: ctsm5.1.dev013 +Originator(s): jedwards (Jim Edwards) / sacks (Bill Sacks) +Date: Wed Nov 4 14:24:55 MST 2020 +One-line Summary: Allow pnetcdf for vector history files + +Purpose of changes +------------------ + +Ever since clm4_5_1_r091, we had been avoiding the use of pnetcdf for +vector history files (i.e., history files with dov2xy = .false.). This +was to workaround an issue that was found on the old yellowstone +supercomputer (bugzilla 1730). However, I cannot reproduce this issue on +cheyenne, either with PIO1 or with PIO2. Moreover, the workaround was +leading to very slow performance with PIO2, at least for some +tests. This tag removes that old workaround. + +See https://github.com/ESCOMP/CTSM/issues/33 for details. + +Also change PE layouts for C96 and C192. The main motivation for this is +to get the aux_clm C96 test through the queue faster (the current test +sometimes waits for multiple hours in the queue): + +(1) Make the out-of-the-box PE counts unthreaded, as is standard for I + compsets + +(2) In the aux_clm test for C92, use a 360x2 PE layout: Use a PE layout + that (a) has threading, because CAM uses threading at this + resolution; and (b) has a smaller-than-standard task count in order + to get through the queue faster. + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: + + Timing changes seem small, though not investigated carefully. No + timing changes are expected to show up in the PFS test (because it + doesn't do history output), but I looked at a few other non-debug f09 + cases: ERP_Ld5.f09_g17.I2000Clm50Vic.cheyenne_intel.clm-vrtlay, + ERP_Ld3.f09_g17.I1850Clm50BgcCropCru.cheyenne_intel.clm-ciso, + ERS_Ld3.f09_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-rad_hrly_light_res_half, + ERS_Ld3.f09_g17.I2000Clm50Fates.cheyenne_intel.clm-FatesColdDef. Total + runtime of these increased in some tests and decreased in others + relative to the baseline, but on average, there was little change + relative to the baseline. I have more carefully investigated this + change in the context of pio2, which will soon become the default: + with pio2, this change is important to get good performance. + + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: Changed PE layout for C96 test + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + + Note: testing was done on 13c693d88, which was before the PE layout + change for C96 and C192. I then ran the new C96 test manually. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1190 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev012 Originator(s): oleson (Keith Oleson) / sacks (Bill Sacks) Date: Tue Nov 3 09:31:41 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index d9edfd061a..ac3a64d97a 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev013 jedwards 11/04/2020 Allow pnetcdf for vector history files ctsm5.1.dev012 oleson/s 11/03/2020 Allow nlevgrnd < nlevurb ctsm5.1.dev011 sacks 11/02/2020 Change CISM2%NOEVOLVE compsets to use SGLC; documentation updates ctsm5.1.dev010 sacks/je 10/23/2020 Fix reading netcdf variable into a different data type From 129c9ef9f1c83439d538a360fdba84d7ef080728 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 4 Nov 2020 17:05:29 -0700 Subject: [PATCH 1604/1973] Point to cime branch tag This contains the changes to fix https://github.com/ESMCI/cime/issues/3769, equivalent to https://github.com/ESMCI/cime/pull/3770. Resolves ESCOMP/CTSM#1203 --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 7fbf9a86e3..3abc4b91fc 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -37,7 +37,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.32 +tag = branch_tags/cime5.8.32_a01 externals = ../Externals_cime.cfg required = True From e8658658a5a648aa1b4ea6ed713224e1c3ac69f4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 6 Nov 2020 10:55:04 -0700 Subject: [PATCH 1605/1973] Rely on build_docs to run 'make fetch-images' rather than Makefile rule Doing this as part of the build process via a Makefile rule can cause problems if building via Docker, e.g., if you set up your repository via ssh keys (since the Docker image won't be able to use those). So now I am changing the process so that 'make fetch-images' is run by build_docs before launching the Docker image. --- Externals.cfg | 2 +- doc/Makefile | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 7fbf9a86e3..54259b9970 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -45,7 +45,7 @@ required = True local_path = doc/doc-builder protocol = git repo_url = https://github.com/ESMCI/doc-builder -tag = v1.0.2 +tag = v1.0.3 required = False [externals_description] diff --git a/doc/Makefile b/doc/Makefile index 47304542de..9b2c2dcd0d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -12,12 +12,12 @@ BUILDDIR = build help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -# Before building html or pdf, obtain all of the images. This is needed -# because we have configured this repository (via an .lfsconfig file at -# the top level) to NOT automatically fetch any of the large files when -# cloning / fetching. -html: fetch-images -latexpdf: fetch-images +# 'make fetch-images' should be run before building the +# documentation. (If building via https://github.com/ESMCI/doc-builder, +# this is run automatically for you.) This is needed because we have +# configured this repository (via an .lfsconfig file at the top level) +# to NOT automatically fetch any of the large files when cloning / +# fetching. fetch-images: git lfs pull --exclude="" From da62ac9a26e47cff8bde2a844f59eb5f755cdb92 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 6 Nov 2020 11:34:49 -0700 Subject: [PATCH 1606/1973] Update doc-builder This version requires us to explicitly pass the -i/--fetch-images flag. The advantage of this is that if the 'make fetch-images' command fails, this will now be more obvious. To make this invisible to users, pass this flag from the wrapper build_docs script. --- Externals.cfg | 2 +- doc/build_docs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 54259b9970..371d6c86d7 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -45,7 +45,7 @@ required = True local_path = doc/doc-builder protocol = git repo_url = https://github.com/ESMCI/doc-builder -tag = v1.0.3 +tag = v1.0.4 required = False [externals_description] diff --git a/doc/build_docs b/doc/build_docs index 5d71933e0b..97fb7aa9b2 100755 --- a/doc/build_docs +++ b/doc/build_docs @@ -1,7 +1,8 @@ #!/usr/bin/env bash if [ -f doc-builder/build_docs ]; then - doc-builder/build_docs "$@" + echo "Running: doc-builder/build_docs --fetch-images $@" + doc-builder/build_docs --fetch-images "$@" else echo "Obtain doc-builder by running ./manage_externals/checkout_externals -o from the top-level" fi From d37d834936574248b24270d8c7e8621a861b09bc Mon Sep 17 00:00:00 2001 From: Keith Oleson Date: Fri, 6 Nov 2020 13:29:34 -0700 Subject: [PATCH 1607/1973] Add threshold on frac_sno to avoid numerical problems with small elai & esai --- src/biogeochem/CNVegStructUpdateMod.F90 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index c55731b25f..22bbea8614 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -74,8 +74,10 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & real(r8) :: tsai_min ! PATCH derived minimum tsai real(r8) :: tsai_alpha ! monthly decay rate of tsai real(r8) :: dt ! radiation time step (sec) + real(r8) :: frac_sno_adjusted ! frac_sno adjusted per frac_sno_threshold real(r8), parameter :: dtsmonth = 2592000._r8 ! number of seconds in a 30 day month (60x60x24x30) + real(r8), parameter :: frac_sno_threshold = 0.999_r8 ! frac_sno values greater than this are treated as 1 !----------------------------------------------------------------------- ! tsai formula from Zeng et. al. 2002, Journal of Climate, p1835 ! @@ -297,8 +299,15 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & !depth of snow required for complete burial of grasses endif - elai(p) = max(tlai(p)*(1.0_r8 - frac_sno(c)) + tlai(p)*fb*frac_sno(c), 0.0_r8) - esai(p) = max(tsai(p)*(1.0_r8 - frac_sno(c)) + tsai(p)*fb*frac_sno(c), 0.0_r8) + if (frac_sno(c) <= frac_sno_threshold) then + frac_sno_adjusted = frac_sno(c) + else + ! avoid tiny but non-zero elai and esai that can cause radiation and/or photosynthesis code to blow up + frac_sno_adjusted = 1._r8 + end if + + elai(p) = max(tlai(p)*(1.0_r8 - frac_sno_adjusted) + tlai(p)*fb*frac_sno_adjusted, 0.0_r8) + esai(p) = max(tsai(p)*(1.0_r8 - frac_sno_adjusted) + tsai(p)*fb*frac_sno_adjusted, 0.0_r8) ! Fraction of vegetation free of snow if ((elai(p) + esai(p)) > 0._r8) then From 8004515e7eda6ae6b1eb27d1412c524d9058fe85 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 6 Nov 2020 14:17:23 -0700 Subject: [PATCH 1608/1973] Call out the version dropdown menu --- doc/source/conf.py | 9 +++++++++ doc/source/index.rst | 10 ++++++++-- doc/source/lilac/index.rst | 6 ++++++ doc/source/tech_note/index.rst | 10 ++++++++-- doc/source/users_guide/index.rst | 10 ++++++++-- 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 540abade16..13911e0e79 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -65,6 +65,15 @@ version = u'CTSM1' # The full version, including alpha/beta/rc tags. release = u'CTSM master' +# CTSM-specific: version label used at the top of some pages. (We define a new variable +# for this purpose because 'version' and 'release' are already used in the User's Guide, +# and we need a different label than either of those on master.) We need a separate +# replacement for the bolded version because it doesn't work to have variable replacements +# within formatting. +rst_epilog = """ +.. |version_label| replace:: the latest development code +.. |version_label_bold| replace:: **the latest development code** +""" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/index.rst b/doc/source/index.rst index 9a9d8016ef..156ec18dda 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -3,8 +3,14 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to the CTSM documentation -================================== +Welcome to the CTSM documentation for |version_label| +===================================================== + +.. important:: + + **You are viewing the documentation for** |version_label_bold|. **There are separate + versions of this documentation for each maintained CTSM release. Use the menu at the + top left to select the version of CTSM you are using.** This document has three major sections. diff --git a/doc/source/lilac/index.rst b/doc/source/lilac/index.rst index 3aac77f9ef..0ac745f8bc 100644 --- a/doc/source/lilac/index.rst +++ b/doc/source/lilac/index.rst @@ -4,6 +4,12 @@ CTSM-LILAC User's Guide ####################### +.. important:: + + **You are viewing the documentation for** |version_label_bold|. **There are separate + versions of this documentation for each maintained CTSM release. Use the menu at the + top left to select the version of CTSM you are using.** + .. toctree:: :maxdepth: 2 diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index 5f72de7d9b..f1856c69c9 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -5,9 +5,15 @@ .. _tech_note: -##################################### +################## CLM Technical Note -##################################### +################## + +.. important:: + + **You are viewing the documentation for** |version_label_bold|. **There are separate + versions of this documentation for each maintained CTSM release. Use the menu at the + top left to select the version of CTSM you are using.** .. toctree:: :maxdepth: 2 diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst index f4cf0e5123..4ac9bc379c 100644 --- a/doc/source/users_guide/index.rst +++ b/doc/source/users_guide/index.rst @@ -7,9 +7,15 @@ .. include:: substitutions.rst -##################################### +###################### |version| User's Guide -##################################### +###################### + +.. important:: + + **You are viewing the documentation for** |version_label_bold|. **There are separate + versions of this documentation for each maintained CTSM release. Use the menu at the + top left to select the version of CTSM you are using.** .. toctree:: :maxdepth: 2 From 7ed0c133b97836f2b5371d3229e2503b1b23df1b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 6 Nov 2020 17:12:12 -0700 Subject: [PATCH 1609/1973] Tweak handling of version_label to reduce duplication --- doc/source/conf.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 13911e0e79..bee524164a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -65,15 +65,16 @@ version = u'CTSM1' # The full version, including alpha/beta/rc tags. release = u'CTSM master' -# CTSM-specific: version label used at the top of some pages. (We define a new variable -# for this purpose because 'version' and 'release' are already used in the User's Guide, -# and we need a different label than either of those on master.) We need a separate -# replacement for the bolded version because it doesn't work to have variable replacements -# within formatting. +# CTSM-specific: version label used at the top of some pages. +version_label = 'the latest development code' + +# version_label is not a standard sphinx variable, so we need some custom rst to allow +# pages to use it. We need a separate replacement for the bolded version because it +# doesn't work to have variable replacements within formatting. rst_epilog = """ -.. |version_label| replace:: the latest development code -.. |version_label_bold| replace:: **the latest development code** -""" +.. |version_label| replace:: {version_label} +.. |version_label_bold| replace:: **{version_label}** +""".format(version_label=version_label) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From ba26a0676ddd3a4855dc7fa5f215a7a33eaecabd Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 7 Nov 2020 05:10:45 -0700 Subject: [PATCH 1610/1973] Tweak "important" call-out Suggested by @olyson --- doc/source/index.rst | 5 +++-- doc/source/lilac/index.rst | 5 +++-- doc/source/tech_note/index.rst | 5 +++-- doc/source/users_guide/index.rst | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 156ec18dda..4059b6f89f 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -9,8 +9,9 @@ Welcome to the CTSM documentation for |version_label| .. important:: **You are viewing the documentation for** |version_label_bold|. **There are separate - versions of this documentation for each maintained CTSM release. Use the menu at the - top left to select the version of CTSM you are using.** + versions of this documentation for each maintained CTSM release (e.g., CLM5.0) and for + the latest development code. Use the menu at the top left to select the version of CTSM + you are using.** This document has three major sections. diff --git a/doc/source/lilac/index.rst b/doc/source/lilac/index.rst index 0ac745f8bc..7badf94d00 100644 --- a/doc/source/lilac/index.rst +++ b/doc/source/lilac/index.rst @@ -7,8 +7,9 @@ CTSM-LILAC User's Guide .. important:: **You are viewing the documentation for** |version_label_bold|. **There are separate - versions of this documentation for each maintained CTSM release. Use the menu at the - top left to select the version of CTSM you are using.** + versions of this documentation for each maintained CTSM release (e.g., CLM5.0) and for + the latest development code. Use the menu at the top left to select the version of CTSM + you are using.** .. toctree:: :maxdepth: 2 diff --git a/doc/source/tech_note/index.rst b/doc/source/tech_note/index.rst index f1856c69c9..5baaa61540 100644 --- a/doc/source/tech_note/index.rst +++ b/doc/source/tech_note/index.rst @@ -12,8 +12,9 @@ CLM Technical Note .. important:: **You are viewing the documentation for** |version_label_bold|. **There are separate - versions of this documentation for each maintained CTSM release. Use the menu at the - top left to select the version of CTSM you are using.** + versions of this documentation for each maintained CTSM release (e.g., CLM5.0) and for + the latest development code. Use the menu at the top left to select the version of CTSM + you are using.** .. toctree:: :maxdepth: 2 diff --git a/doc/source/users_guide/index.rst b/doc/source/users_guide/index.rst index 4ac9bc379c..45afc39c72 100644 --- a/doc/source/users_guide/index.rst +++ b/doc/source/users_guide/index.rst @@ -14,8 +14,9 @@ .. important:: **You are viewing the documentation for** |version_label_bold|. **There are separate - versions of this documentation for each maintained CTSM release. Use the menu at the - top left to select the version of CTSM you are using.** + versions of this documentation for each maintained CTSM release (e.g., CLM5.0) and for + the latest development code. Use the menu at the top left to select the version of CTSM + you are using.** .. toctree:: :maxdepth: 2 From 0b86ddd7e06e3f6355c3e92f7847193f667e8e01 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 7 Nov 2020 12:42:52 -0700 Subject: [PATCH 1611/1973] Update ChangeLog --- doc/ChangeLog | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 148 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 9e52f6939f..3bdc732d0a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,151 @@ =============================================================== +Tag name: ctsm5.1.dev014 +Originator(s): dll (Danica Lombardozzi) / oleson (Keith Oleson) / sacks (Bill Sacks) +Date: Sat Nov 7 12:19:14 MST 2020 +One-line Summary: Grass/crop snow burial fraction fix, and some other fixes + +Purpose of changes +------------------ + +(1) Crop/grass snow burial changed based on height and lodging (Danica + Lombardozzi) - resolves ESCOMP/CTSM#516. Updates grass and crop snow + burial ('fb' in SatellitePhenologyMod.F90) from being 0.2m to change + with PFT height and accounts for 20% lodging (falling over). + +(2) In BGC code, make elai and esai depend on frac_sno (Danica + Lombardozzi, Keith Oleson & Bill Sacks) - resolves ESCOMP/CTSM#1116 + +(3) Fix to quadratic solution error bug caused by negative shaded + photosynthesis (Danica Lombardozzi & Keith Oleson) - resolves + ESCOMP/CTSM#756 + +(4) Point to cime branch tag that avoids building CDEPS with LILAC, to + avoid dependence on unreleased ESMF code (Bill Sacks) - resolves + ESCOMP/CTSM#1203 + +(5) Some tweaks to documentation and how the documentation is built + (Bill Sacks) + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#516 (crop and grass snow burial) +- Resolves ESCOMP/CTSM#1116 (elai and esai for non-SP runs should use + frac_sno) +- Resolves ESCOMP/CTSM#756 (Quadratic solution error) +- Resolves ESCOMP/CTSM#1203 (Rework LILAC build to avoid dependence on + unreleased ESMF code) + +CIME Issues fixed (include issue #): +- https://github.com/ESMCI/cime/issues/3769 (Avoid building CDEPS with + CTSM's LILAC) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- ok + izumi ------- ok + + ok: tests pass, baselines fail as expected + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES + + Summarize any changes to answers, i.e., + - what code configurations: all (or at least most) + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + new climate, at least to some extent + + Changes arise from (1) & (2) (large changes) and from (3) (small + changes). The change in snow burial parameterizations results in + changes to albedo and water & energy fluxes. + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: + For analysis of diffs, see + https://github.com/danicalombardozzi/ctsm_py/blob/7543b0f3b413bae9974c11b467fdbc0413c3b7fa/notebooks/SnowBurial.ipynb + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: cime5.8.32 -> branch_tags/cime5.8.32_a01 +- doc-builder: v1.0.2 -> v1.0.4 + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1112 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev013 Originator(s): jedwards (Jim Edwards) / sacks (Bill Sacks) Date: Wed Nov 4 14:24:55 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index ac3a64d97a..cbe950b62e 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes ctsm5.1.dev013 jedwards 11/04/2020 Allow pnetcdf for vector history files ctsm5.1.dev012 oleson/s 11/03/2020 Allow nlevgrnd < nlevurb ctsm5.1.dev011 sacks 11/02/2020 Change CISM2%NOEVOLVE compsets to use SGLC; documentation updates From ffa225c4dbabdfe9cb6d2f48ca71879c486b0a93 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 9 Nov 2020 22:50:32 -0700 Subject: [PATCH 1612/1973] Write history master fields list to optional file User can make this choice in the namelist --- .../namelist_definition_ctsm.xml | 5 ++ cime_config/testdefs/testlist_clm.xml | 9 ++ .../write_hist_master_list/include_user_mods | 1 + .../clm/write_hist_master_list/user_nl_clm | 1 + src/main/clm_varctl.F90 | 4 + src/main/controlMod.F90 | 3 +- src/main/histFileMod.F90 | 86 ++++++++++++++++++- 7 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/user_nl_clm diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index be5959d6bf..fd6ff02e68 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -729,6 +729,11 @@ SNICAR (SNow, ICe, and Aerosol Radiative model) optical data file name SNICAR (SNow, ICe, and Aerosol Radiative model) snow aging data file name + +If TRUE, write master field list to separate file for documentation purposes + + Per file averaging flag. diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index a818fa5d29..c62ac4da64 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1800,6 +1800,15 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/include_user_mods new file mode 100644 index 0000000000..fe0e18cf88 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/include_user_mods @@ -0,0 +1 @@ +../default diff --git a/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/user_nl_clm new file mode 100644 index 0000000000..df55aff666 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/user_nl_clm @@ -0,0 +1 @@ +hist_master_list_file = .true. diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 75ec36d035..22bd8aebc4 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -79,6 +79,7 @@ module clm_varctl !---------------------------------------------------------- ! integer, public :: iulog = 6 ! "stdout" log file unit number, default is 6 + integer, public :: master_list_file = 9 ! unit number for optional output file containing master history list in tabular form !---------------------------------------------------------- ! Output NetCDF files @@ -347,6 +348,9 @@ module clm_varctl ! namelist: write CH4 extra diagnostic output logical, public :: hist_wrtch4diag = .false. + ! namelist: write history master list to a file for use in documentation + logical, public :: hist_master_list_file = .false. + !---------------------------------------------------------- ! FATES !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 55bbd43d75..0d0f189cb8 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -164,7 +164,7 @@ subroutine control_init(dtime) hist_fexcl4, hist_fexcl5, hist_fexcl6, & hist_fexcl7, hist_fexcl8, & hist_fexcl9, hist_fexcl10 - namelist /clm_inparm/ hist_wrtch4diag + namelist /clm_inparm/ hist_wrtch4diag, hist_master_list_file ! BGC info @@ -806,6 +806,7 @@ subroutine control_spmd() if (use_lch4) then call mpi_bcast (hist_wrtch4diag, 1, MPI_LOGICAL, 0, mpicom, ier) end if + call mpi_bcast (hist_master_list_file, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (hist_fexcl1, max_namlen*size(hist_fexcl1), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (hist_fexcl2, max_namlen*size(hist_fexcl2), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (hist_fexcl3, max_namlen*size(hist_fexcl3), MPI_CHARACTER, 0, mpicom, ier) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 8e6be4a571..3b856c7c98 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -301,10 +301,22 @@ subroutine hist_printflds() ! !DESCRIPTION: ! Print summary of master field list. ! + ! !USES: + use clm_varctl, only: master_list_file, hist_master_list_file + ! ! !ARGUMENTS: ! ! !LOCAL VARIABLES: - integer nf + integer nf, i ! do-loop counters + integer width_col_1 ! widths of table columns 1... + integer width_col_2 ! ...2 + integer width_col_3 ! ...3 + integer width_col_4 ! ...and 4 + integer width_col_sum ! widths of columns summed, including spaces + character(len=1) str_w_col_1 ! string versions of width_col_1 through 4 + character(len=2) str_w_col_2, str_w_col_3, str_w_col_4 + character(len=3) str_w_col_sum ! string version of width_col_sum + character(len=25) fmt_txt ! format statement character(len=*),parameter :: subname = 'CLM_hist_printflds' !----------------------------------------------------------------------- @@ -318,6 +330,78 @@ subroutine hist_printflds() call shr_sys_flush(iulog) end if + ! Print master field list in separate file if namelist variable + ! requests it + if (masterproc .and. hist_master_list_file) then + ! hardwired table column widths + width_col_1 = 4 ! column that shows the variable number, nf + width_col_2 = 39 ! variable name column + width_col_3 = 94 ! long description column + width_col_4 = 65 ! units column + width_col_sum = width_col_1 + width_col_2 + & ! sum of widths plus + width_col_3 + width_col_4 + 3 ! ...3 blank spaces + + ! Convert integer widths to strings for use in format statements + ! These write statements are not outputting to files + write(str_w_col_1,'(i1)') width_col_1 + write(str_w_col_2,'(i2)') width_col_2 + write(str_w_col_3,'(i2)') width_col_3 + write(str_w_col_4,'(i2)') width_col_4 + write(str_w_col_sum,'(i3)') width_col_sum + + ! Open master_list_file + open(unit = master_list_file, file = 'master_list_file.txt', & + status = 'new', action = 'write', form = 'formatted') + + ! File header + ! Concatenate strings needed in format statement + fmt_txt = '('//str_w_col_1//'a,1x,'//str_w_col_2//'a,1x,'//str_w_col_3//'a,1x,'//str_w_col_4//'a)' + write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & + ('=', i=1, width_col_2), & + ('=', i=1, width_col_3), & + ('=', i=1, width_col_4) + ! Table's title + write(master_list_file,*) 'CTSM History Fields' + + ! Sub-header + ! Concatenate strings needed in format statement + fmt_txt = '('//str_w_col_sum//'a)' + write(master_list_file,fmt_txt) ('-', i=1, width_col_sum) + ! Concatenate strings needed in format statement + fmt_txt = '('//'a'//str_w_col_1//',1x,a'//str_w_col_2//',1x,a'//str_w_col_3//',1x,a'//str_w_col_4//')' + write(master_list_file,fmt_txt) '#', 'Variable Name', & + 'Long Description', 'Units' + + ! End header, same as header + ! Concatenate strings needed in format statement + fmt_txt = '('//str_w_col_1//'a,1x,'//str_w_col_2//'a,1x,'//str_w_col_3//'a,1x,'//str_w_col_4//'a)' + write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & + ('=', i=1, width_col_2), & + ('=', i=1, width_col_3), & + ('=', i=1, width_col_4) + + ! Main table + ! Concatenate strings needed in format statement + fmt_txt = '('//'i'//str_w_col_1//',1x,a'//str_w_col_2//',1x,a'//str_w_col_3//',1x,a'//str_w_col_4//')' + do nf = 1,nfmaster + write(master_list_file,fmt_txt) nf, & + masterlist(nf)%field%name, & + masterlist(nf)%field%long_name, & + masterlist(nf)%field%units + end do + + ! File footer, same as header + ! Concatenate strings needed in format statement + fmt_txt = '('//str_w_col_1//'a,1x,'//str_w_col_2//'a,1x,'//str_w_col_3//'a,1x,'//str_w_col_4//'a)' + write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & + ('=', i=1, width_col_2), & + ('=', i=1, width_col_3), & + ('=', i=1, width_col_4) + + call shr_sys_flush(master_list_file) + close(unit = master_list_file) + end if + end subroutine hist_printflds !----------------------------------------------------------------------- From 413b0d077636de145abedd440d3084c63fa7d674 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 10 Nov 2020 18:04:37 -0700 Subject: [PATCH 1613/1973] First few revisions based on @billsacks code review --- bld/CLMBuildNamelist.pm | 1 + bld/namelist_files/namelist_defaults_ctsm.xml | 3 +++ src/main/clm_varctl.F90 | 1 - src/main/histFileMod.F90 | 8 ++++++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index a3da59e8a8..c80ccab573 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3891,6 +3891,7 @@ sub setup_logic_misc { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'for_testing_run_ncdiopio_tests'); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'hist_master_list_file'); } #------------------------------------------------------------------------------- diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 9abffb3cdf..57793cc83d 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -59,6 +59,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. + +.false. + .true. Date: Wed, 11 Nov 2020 11:53:58 -0700 Subject: [PATCH 1614/1973] Back out the new test from cheyenne's test suite Consolidate the new test with the "extra_outputs" test mod --- cime_config/testdefs/testlist_clm.xml | 10 +--------- .../testdefs/testmods_dirs/clm/extra_outputs/README | 3 +++ .../testmods_dirs/clm/extra_outputs/user_nl_clm | 1 + .../clm/write_hist_master_list/include_user_mods | 1 - .../clm/write_hist_master_list/user_nl_clm | 1 - 5 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index c62ac4da64..2e3ff301f6 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1053,6 +1053,7 @@ + @@ -1800,15 +1801,6 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/clm/extra_outputs/README b/cime_config/testdefs/testmods_dirs/clm/extra_outputs/README index 83fad7964a..03bc956b6f 100644 --- a/cime_config/testdefs/testmods_dirs/clm/extra_outputs/README +++ b/cime_config/testdefs/testmods_dirs/clm/extra_outputs/README @@ -1 +1,4 @@ This test mod turns on extra diagnostic fields + +It also outputs an optional text file containing a table of the +history fields master list diff --git a/cime_config/testdefs/testmods_dirs/clm/extra_outputs/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/extra_outputs/user_nl_clm index 512a426909..6d1167fc39 100644 --- a/cime_config/testdefs/testmods_dirs/clm/extra_outputs/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/extra_outputs/user_nl_clm @@ -1 +1,2 @@ calc_human_stress_indices = 'ALL' +hist_master_list_file = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/user_nl_clm deleted file mode 100644 index df55aff666..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/write_hist_master_list/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -hist_master_list_file = .true. From 30a5ad883d0e9fd7e135dc43a68303c139f02170 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 11 Nov 2020 12:33:25 -0700 Subject: [PATCH 1615/1973] A few more revisions suggested by @billsacks review --- src/main/histFileMod.F90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 9e9fe9f142..7f70210985 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -315,10 +315,10 @@ subroutine hist_printflds() integer width_col_3 ! ...3 integer width_col_4 ! ...and 4 integer width_col_sum ! widths of columns summed, including spaces - character(len=1) str_w_col_1 ! string versions of width_col_1 through 4 - character(len=2) str_w_col_2, str_w_col_3, str_w_col_4 + character(len=3) str_w_col_1 ! string versions of width_col_1 through 4 + character(len=3) str_w_col_2, str_w_col_3, str_w_col_4 character(len=3) str_w_col_sum ! string version of width_col_sum - character(len=25) fmt_txt ! format statement + character(len=99) fmt_txt ! format statement character(len=*),parameter :: subname = 'CLM_hist_printflds' !----------------------------------------------------------------------- @@ -345,11 +345,11 @@ subroutine hist_printflds() ! Convert integer widths to strings for use in format statements ! These write statements are not outputting to files - write(str_w_col_1,'(i1)') width_col_1 - write(str_w_col_2,'(i2)') width_col_2 - write(str_w_col_3,'(i2)') width_col_3 - write(str_w_col_4,'(i2)') width_col_4 - write(str_w_col_sum,'(i3)') width_col_sum + write(str_w_col_1,'(i0)') width_col_1 + write(str_w_col_2,'(i0)') width_col_2 + write(str_w_col_3,'(i0)') width_col_3 + write(str_w_col_4,'(i0)') width_col_4 + write(str_w_col_sum,'(i0)') width_col_sum ! Open master_list_file master_list_file = getavu() ! get next available file unit number From 56744abf6ebbc9da7ede7b97494a88b44a8df08a Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 10 Nov 2020 07:48:52 -0700 Subject: [PATCH 1616/1973] more pio2 compatibility changes --- src/main/ncdio_pio.F90.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 3474f2f2fe..f8f5edca10 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1497,7 +1497,8 @@ contains call scam_field_offsets(ncid,'undefined', vardesc,& start, count, found=found, posNOTonfile=posNOTonfile) if ( found )then - status = pio_get_var(ncid, varid, start, count, data) + status = pio_inq_varndims(ncid, vardesc, ndims) + status = pio_get_var(ncid, varid, start(1:ndims), count(1:ndims), data) else status = pio_get_var(ncid, varid, data) end if From 40c68cb56642753ce76a8a4c0dd1c83aae374a6f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Nov 2020 17:05:11 -0700 Subject: [PATCH 1617/1973] Another fix that I think is needed for pio2 I didn't see any test failures due to this, but the code pattern is the same as what was fixed by @jedwards4b in 56744abf6, so I'm applying the same fix as in that commit. --- src/main/ncdio_pio.F90.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index f8f5edca10..4b7b75c82e 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1381,7 +1381,8 @@ contains call scam_field_offsets(ncid,'undefined', vardesc,& start, count, found=found, posNOTonfile=posNOTonfile) if ( found )then - status = pio_get_var(ncid, varid, start, count, idata1d) + status = pio_inq_varndims(ncid, vardesc, ndims) + status = pio_get_var(ncid, varid, start(1:ndims), count(1:ndims), idata1d) else status = pio_get_var(ncid, varid, idata1d) end if From aeeb91a84b48641faba5f38d3a578a6bcddc9610 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 11 Nov 2020 17:45:19 -0700 Subject: [PATCH 1618/1973] Adding draft of the new table to /user_guide for comment --- .../customizing-the-clm-namelist.rst | 2 +- .../master_list_file.rst | 1270 +++++++++++++++++ src/main/histFileMod.F90 | 4 +- 3 files changed, 1274 insertions(+), 2 deletions(-) create mode 100644 doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst index 93f30f8a29..a7d19c40dd 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst @@ -43,7 +43,7 @@ Included in the table are the following pieces of information: Table 1-3. CLM History Fields ----------------------------- -Table goes here. +Table `master_list_file` --------------------------------------------- diff --git a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst new file mode 100644 index 0000000000..e1f4171e79 --- /dev/null +++ b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst @@ -0,0 +1,1270 @@ +==== ======================================= ============================================================================================== ================================================================= + CTSM History Fields +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + # Variable Name Long Description Units +==== ======================================= ============================================================================================== ================================================================= + 1 LEAFCN Leaf CN ratio used for flexible CN gC/gN + 2 LEAFCN_STORAGE Storage Leaf CN ratio used for flexible CN gC/gN + 3 DAYL daylength s + 4 PREV_DAYL daylength from previous timestep s + 5 SNO_Z Snow layer thicknesses m + 6 SNO_Z_ICE Snow layer thicknesses (ice landunits only) m + 7 ZII convective boundary height m + 8 SWBGT 2 m Simplified Wetbulb Globe Temp C + 9 SWBGT_U Urban 2 m Simplified Wetbulb Globe Temp C + 10 SWBGT_R Rural 2 m Simplified Wetbulb Globe Temp C + 11 HUMIDEX 2 m Humidex C + 12 HUMIDEX_U Urban 2 m Humidex C + 13 HUMIDEX_R Rural 2 m Humidex C + 14 WBT 2 m Stull Wet Bulb C + 15 WBT_U Urban 2 m Stull Wet Bulb C + 16 WBT_R Rural 2 m Stull Wet Bulb C + 17 HIA 2 m NWS Heat Index C + 18 HIA_U Urban 2 m NWS Heat Index C + 19 HIA_R Rural 2 m NWS Heat Index C + 20 APPAR_TEMP 2 m apparent temperature C + 21 APPAR_TEMP_U Urban 2 m apparent temperature C + 22 APPAR_TEMP_R Rural 2 m apparent temperature C + 23 WBA 2 m Wet Bulb C + 24 WBA_U Urban 2 m Wet Bulb C + 25 WBA_R Rural 2 m Wet Bulb C + 26 TEQ 2 m Equiv Temp K + 27 TEQ_U Urban 2 m Equiv Temp K + 28 TEQ_R Rural 2 m Equiv Temp K + 29 EPT 2 m Equiv Pot Temp K + 30 EPT_U Urban 2 m Equiv Pot Temp K + 31 EPT_R Rural 2 m Equiv Pot Temp K + 32 DISCOI 2 m Discomfort Index C + 33 DISCOI_U Urban 2 m Discomfort Index C + 34 DISCOI_R Rural 2 m Discomfort Index C + 35 THIP 2 m Temp Hum Index Physiology C + 36 THIP_U Urban 2 m Temp Hum Index Physiology C + 37 THIP_R Rural 2 m Temp Hum Index Physiology C + 38 THIC 2 m Temp Hum Index Comfort C + 39 THIC_U Urban 2 m Temp Hum Index Comfort C + 40 THIC_R Rural 2 m Temp Hum Index Comfort C + 41 SWMP65 2 m Swamp Cooler Temp 65% Eff C + 42 SWMP65_U Urban 2 m Swamp Cooler Temp 65% Eff C + 43 SWMP65_R Rural 2 m Swamp Cooler Temp 65% Eff C + 44 SWMP80 2 m Swamp Cooler Temp 80% Eff C + 45 SWMP80_U Urban 2 m Swamp Cooler Temp 80% Eff C + 46 SWMP80_R Rural 2 m Swamp Cooler Temp 80% Eff C + 47 DISCOIS 2 m Stull Discomfort Index C + 48 DISCOIS_U Urban 2 m Stull Discomfort Index C + 49 DISCOIS_R Rural 2 m Stull Discomfort Index C + 50 TBUILD_MAX prescribed maximum interior building temperature K + 51 WIND atmospheric wind velocity magnitude m/s + 52 Wind atmospheric wind velocity magnitude m/s + 53 ZBOT atmospheric reference height m + 54 ATM_TOPO atmospheric surface height m + 55 FSDS atmospheric incident solar radiation W/m^2 + 56 PCO2 atmospheric partial pressure of CO2 Pa + 57 SWdown atmospheric incident solar radiation W/m^2 + 58 PCH4 atmospheric partial pressure of CH4 Pa + 59 Tair_from_atm atmospheric air temperature received from atmosphere (pre-downscaling) K + 60 TBOT atmospheric air temperature (downscaled to columns in glacier regions) K + 61 Tair atmospheric air temperature (downscaled to columns in glacier regions) K + 62 PBOT atmospheric pressure at surface (downscaled to columns in glacier regions) Pa + 63 PSurf atmospheric pressure at surface (downscaled to columns in glacier regions) Pa + 64 FLDS atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 + 65 LWdown atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 + 66 FLDS_ICE atmospheric longwave radiation (downscaled to columns in glacier regions) (ice landunits only) W/m^2 + 67 THBOT atmospheric air potential temperature (downscaled to columns in glacier regions) K + 68 FSI24 indirect radiation (last 24hrs) K + 69 FSI240 indirect radiation (last 240hrs) K + 70 FSD24 direct radiation (last 24hrs) K + 71 FSD240 direct radiation (last 240hrs) K + 72 PCO2_240 10 day running mean of CO2 pressure Pa + 73 PO2_240 10 day running mean of O2 pressure Pa + 74 PBOT_240 10 day running mean of air pressure Pa + 75 FSH_TO_COUPLER sensible heat sent to coupler (includes corrections for land use change, rain/snow conversion W/m^2 + 76 FSH_RUNOFF_ICE_TO_LIQ sensible heat flux generated from conversion of ice runoff to liquid W/m^2 + 77 FCO2 CO2 flux to atmosphere (+ to atm) kgCO2/m2/s + 78 Z0M_TO_COUPLER roughness length, momentum: gridcell average sent to coupler m + 79 FCH4 Gridcell surface CH4 flux to atmosphere (+ to atm) kgC/m2/s + 80 NEM Gridcell net adjustment to net carbon exchange passed to atm. for methane production gC/m2/s + 81 ICE_MODEL_FRACTION Ice sheet model fractional coverage unitless + 82 QICE_FORC qice forcing sent to GLC mm/s + 83 TSRF_FORC surface temperature sent to GLC K + 84 TOPO_FORC topograephic height sent to GLC m + 85 TH2OSFC surface water temperature K + 86 TG_U Urban ground temperature K + 87 TLAKE lake temperature K + 88 SNO_T Snow temperatures K + 89 SNO_T_ICE Snow temperatures (ice landunits only) K + 90 TSA 2m air temperature K + 91 TSA_ICE 2m air temperature (ice landunits only) K + 92 TSA_R Rural 2m air temperature K + 93 TREFMNAV daily minimum of average 2-m temperature K + 94 TREFMXAV daily maximum of average 2-m temperature K + 95 TREFMNAV_R Rural daily minimum of average 2-m temperature K + 96 TREFMXAV_R Rural daily maximum of average 2-m temperature K + 97 TSA_U Urban 2m air temperature K + 98 TREFMNAV_U Urban daily minimum of average 2-m temperature K + 99 TREFMXAV_U Urban daily maximum of average 2-m temperature K + 100 TV vegetation temperature K + 101 TSKIN skin temperature K + 102 TG ground temperature K + 103 TG_ICE ground temperature (ice landunits only) K + 104 TG_R Rural ground temperature K + 105 TSOI soil temperature (natural vegetated and crop landunits only) K + 106 TSOI_ICE soil temperature (ice landunits only) K + 107 TSOI_10CM soil temperature in top 10cm of soil K + 108 TSL temperature of near-surface soil layer (natural vegetated and crop landunits only) K + 109 SNOTXMASS snow temperature times layer mass, layer sum; to get mass-weighted temperature, divide by (SNO K kg/m2 + 110 SNOTXMASS_ICE snow temperature times layer mass, layer sum (ice landunits only); to get mass-weighted temper K kg/m2 + 111 T10 10-day running mean of 2-m temperature K + 112 A5TMIN 5-day running mean of min 2-m temperature K + 113 A10TMIN 10-day running mean of min 2-m temperature K + 114 TBUILD internal urban building air temperature K + 115 TROOF_INNER roof inside surface temperature K + 116 TSUNW_INNER sunwall inside surface temperature K + 117 TSHDW_INNER shadewall inside surface temperature K + 118 TFLOOR floor temperature K + 119 HEAT_CONTENT1 initial gridcell total heat content J/m^2 + 120 HEAT_CONTENT1_VEG initial gridcell total heat content - natural vegetated and crop landunits only J/m^2 + 121 HEAT_CONTENT2 post land cover change total heat content J/m^2 + 122 LIQUID_WATER_TEMP1 initial gridcell weighted average liquid water temperature K + 123 SNOTTOPL snow temperature (top layer) K + 124 SNOTTOPL_ICE snow temperature (top layer, ice landunits only) K + 125 SNOdTdzL top snow layer temperature gradient (land) K/m + 126 DT_VEG change in t_veg, last iteration K + 127 EMV vegetation emissivity proportion + 128 EMG ground emissivity proportion + 129 BETA coefficient of convective velocity none + 130 TV24 vegetation temperature (last 24hrs) K + 131 TV240 vegetation temperature (last 240hrs) K + 132 GDD0 Growing degree days base 0C from planting ddays + 133 GDD8 Growing degree days base 8C from planting ddays + 134 GDD10 Growing degree days base 10C from planting ddays + 135 GDD020 Twenty year average of growing degree days base 0C from planting ddays + 136 GDD820 Twenty year average of growing degree days base 8C from planting ddays + 137 GDD1020 Twenty year average of growing degree days base 10C from planting ddays + 138 TVEGD10 10 day running mean of patch daytime vegetation temperature Kelvin + 139 TVEGN10 10 day running mean of patch night-time vegetation temperature Kelvin + 140 ALT current active layer thickness m + 141 ALTMAX maximum annual active layer thickness m + 142 ALTMAX_LASTYEAR maximum prior year active layer thickness m + 143 ELAI exposed one-sided leaf area index m^2/m^2 + 144 ESAI exposed one-sided stem area index m^2/m^2 + 145 TLAI total projected leaf area index m^2/m^2 + 146 TSAI total projected stem area index m^2/m^2 + 147 LAISUN sunlit projected leaf area index m^2/m^2 + 148 LAISHA shaded projected leaf area index m^2/m^2 + 149 FSUN sunlit fraction of canopy proportion + 150 HTOP canopy top m + 151 HBOT canopy bottom m + 152 DISPLA displacement height m + 153 Z0M momentum roughness length m + 154 FSUN24 fraction sunlit (last 24hrs) K + 155 FSUN240 fraction sunlit (last 240hrs) K + 156 LAI240 240hr average of leaf area index m^2/m^2 + 157 VEGWP vegetation water matric potential for sun/sha canopy,xyl,root segments mm + 158 VEGWPLN vegetation water matric potential for sun/sha canopy,xyl,root at local noon mm + 159 VEGWPPD predawn vegetation water matric potential for sun/sha canopy,xyl,root mm + 160 SMP soil matric potential (natural vegetated and crop landunits only) mm + 161 KROOT root conductance each soil layer 1/s + 162 KSOIL soil conductance in each soil layer 1/s + 163 bsw clap and hornberger B unitless + 164 ROOTR effective fraction of roots in each soil layer (SMS method) proportion + 165 SOILPSI soil water potential in each soil layer MPa + 166 SNO_TK Thermal conductivity W/m-K + 167 SNO_TK_ICE Thermal conductivity (ice landunits only) W/m-K + 168 HK hydraulic conductivity (natural vegetated and crop landunits only) mm/s + 169 SoilAlpha factor limiting ground evap unitless + 170 SoilAlpha_U urban factor limiting ground evap unitless + 171 watsat water saturated m^3/m^3 + 172 EFF_POROSITY effective porosity = porosity - vol_ice proportion + 173 watfc water field capacity m^3/m^3 + 174 SOILRESIS soil resistance to evaporation s/m + 175 DSL dry surface layer thickness mm + 176 SNO_LIQH2O Snow liquid water content kg/m2 + 177 SNO_ICE Snow ice content kg/m2 + 178 H2OSOI volumetric soil water (natural vegetated and crop landunits only) mm3/mm3 + 179 SOILLIQ soil liquid water (natural vegetated and crop landunits only) kg/m2 + 180 SOILICE soil ice (natural vegetated and crop landunits only) kg/m2 + 181 SNOCAN intercepted snow mm + 182 LIQCAN intercepted liquid water mm + 183 H2OSFC surface water depth mm + 184 WA water in the unconfined aquifer (natural vegetated and crop landunits only) mm + 185 INT_SNOW accumulated swe (natural vegetated and crop landunits only) mm + 186 INT_SNOW_ICE accumulated swe (ice landunits only) mm + 187 SNOW_PERSISTENCE Length of time of continuous snow cover (nat. veg. landunits only) seconds + 188 H2OCAN intercepted water mm + 189 SOILWATER_10CM soil liquid water + ice in top 10cm of soil (veg landunits only) kg/m2 + 190 TWS total water storage mm + 191 Q2M 2m specific humidity kg/kg + 192 SNOWLIQ snow liquid water kg/m2 + 193 SNOWLIQ_ICE snow liquid water (ice landunits only) kg/m2 + 194 SNOWICE snow ice kg/m2 + 195 SNOWICE_ICE snow ice (ice landunits only) kg/m2 + 196 H2OSNO snow depth (liquid water) mm + 197 H2OSNO_ICE snow depth (liquid water, ice landunits only) mm + 198 TOTSOILLIQ vertically summed soil liquid water (veg landunits only) kg/m2 + 199 TOTSOILICE vertically summed soil cie (veg landunits only) kg/m2 + 200 RH2M 2m relative humidity % + 201 RH2M_R Rural 2m specific humidity % + 202 RH2M_U Urban 2m relative humidity % + 203 RHAF fractional humidity of canopy air fraction + 204 RHAF10 10 day running mean of fractional humidity of canopy air fraction + 205 FH2OSFC fraction of ground covered by surface water unitless + 206 FH2OSFC_NOSNOW fraction of ground covered by surface water (if no snow present) unitless + 207 FSNO fraction of ground covered by snow unitless + 208 FSNO_ICE fraction of ground covered by snow (ice landunits only) unitless + 209 FSNO_EFF effective fraction of ground covered by snow unitless + 210 FWET fraction of canopy that is wet proportion + 211 FCANSNO fraction of canopy that is wet proportion + 212 FDRY fraction of foliage that is green and dry proportion + 213 FRAC_ICEOLD fraction of ice relative to the tot water proportion + 214 SNOW_DEPTH snow height of snow covered area m + 215 SNOW_DEPTH_ICE snow height of snow covered area (ice landunits only) m + 216 SNOWDP gridcell mean snow height m + 217 WF soil water as frac. of whc for top 0.05 m proportion + 218 H2OSNO_TOP mass of snow in top snow layer kg/m2 + 219 SNORDSL top snow layer effective grain radius m^-6 + 220 SNOLIQFL top snow layer liquid water fraction (land) fraction + 221 SNO_EXISTENCE Fraction of averaging period for which each snow layer existed unitless + 222 SNO_BW Partial density of water in the snow pack (ice + liquid) kg/m3 + 223 SNO_BW_ICE Partial density of water in the snow pack (ice + liquid, ice landunits only) kg/m3 + 224 SNO_GS Mean snow grain size Microns + 225 SNO_GS_ICE Mean snow grain size (ice landunits only) Microns + 226 QINTR interception mm/s + 227 SNOW_SOURCES snow sources (liquid water) mm/s + 228 SNOW_SINKS snow sinks (liquid water) mm/s + 229 LIQUID_CONTENT1 initial gridcell total liq content mm + 230 LIQUID_CONTENT2 post landuse change gridcell total liq content mm + 231 ICE_CONTENT1 initial gridcell total ice content mm + 232 ICE_CONTENT2 post land cover change total ice content mm + 233 ERRH2O total water conservation error mm + 234 ERRH2OSNO imbalance in snow depth (liquid water) mm + 235 QDIRECT_THROUGHFALL direct throughfall of liquid (rain + above-canopy irrigation) mm/s + 236 QDIRECT_THROUGHFALL_SNOW direct throughfall of snow mm/s + 237 QDRIP rate of excess canopy liquid falling off canopy mm/s + 238 QDRIP_SNOW rate of excess canopy snow falling off canopy mm/s + 239 QSNOUNLOAD canopy snow unloading mm/s + 240 QTOPSOIL water input to surface mm/s + 241 QINFL infiltration mm/s + 242 QOVER total surface runoff (includes QH2OSFC) mm/s + 243 QRGWL surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff fro mm/s + 244 QDRAI sub-surface drainage mm/s + 245 QDRAI_PERCH perched wt drainage mm/s + 246 QFLX_LIQ_DYNBAL liq dynamic land cover change conversion runoff flux mm/s + 247 QFLX_ICE_DYNBAL ice dynamic land cover change conversion runoff flux mm/s + 248 QRUNOFF total liquid runoff not including correction for land use change mm/s + 249 QRUNOFF_ICE total liquid runoff not incl corret for LULCC (ice landunits only) mm/s + 250 QRUNOFF_U Urban total runoff mm/s + 251 QRUNOFF_R Rural total runoff mm/s + 252 QSNOMELT snow melt rate mm/s + 253 QSNOMELT_ICE snow melt (ice landunits only) mm/s + 254 QSNOFRZ column-integrated snow freezing rate kg/m2/s + 255 QSNOFRZ_ICE column-integrated snow freezing rate (ice landunits only) mm/s + 256 SNO_FRZ snow freezing rate in each snow layer kg/m2/s + 257 SNO_FRZ_ICE snow freezing rate in each snow layer (ice landunits only) mm/s + 258 QFLX_SNOW_DRAIN drainage from snow pack mm/s + 259 QFLX_SNOW_DRAIN_ICE drainage from snow pack melt (ice landunits only) mm/s + 260 QSOIL Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew) mm/s + 261 QSOIL_ICE Ground evaporation (ice landunits only) mm/s + 262 QVEGE canopy evaporation mm/s + 263 QVEGT canopy transpiration mm/s + 264 QSNOCPLIQ excess liquid h2o due to snow capping not including correction for land use change mm H2O/s + 265 QSNWCPICE excess solid h2o due to snow capping not including correction for land use change mm H2O/s + 266 QICE ice growth/melt mm/s + 267 QICE_FRZ ice growth mm/s + 268 QICE_MELT ice melt mm/s + 269 QFLX_LIQ_GRND liquid (rain+irrigation) on ground after interception mm H2O/s + 270 QFLX_SNOW_GRND snow on ground after interception mm H2O/s + 271 QFLX_LIQEVAP_FROM_TOP_LAYER rate of liquid water evaporated from top soil or snow layer mm H2O/s + 272 QFLX_EVAP_VEG vegetation evaporation mm H2O/s + 273 QFLX_EVAP_TOT qflx_evap_soi + qflx_evap_can + qflx_tran_veg kg m-2 s-1 + 274 QFLX_LIQDEW_TO_TOP_LAYER rate of liquid water deposited on top soil or snow layer (dew) mm H2O/s + 275 QFLX_SOLIDEVAP_FROM_TOP_LAYER rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s + 276 QFLX_SOLIDEVAP_FROM_TOP_LAYER_ICE rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s + 277 QFLX_SOLIDDEW_TO_TOP_LAYER rate of solid water deposited on top soil or snow layer (frost) mm H2O/s + 278 QDRAI_XS saturation excess drainage mm/s + 279 QH2OSFC_TO_ICE surface water converted to ice mm/s + 280 QIRRIG_FROM_SURFACE water added through surface water irrigation mm/s + 281 QIRRIG_FROM_GW_UNCONFINED water added through unconfined groundwater irrigation mm/s + 282 QIRRIG_FROM_GW_CONFINED water added through confined groundwater irrigation mm/s + 283 QIRRIG_DRIP water added via drip irrigation mm/s + 284 QIRRIG_SPRINKLER water added via sprinkler irrigation mm/s + 285 SNO_MELT snow melt rate in each snow layer mm/s + 286 SNO_MELT_ICE snow melt rate in each snow layer (ice landunits only) mm/s + 287 QROOTSINK water flux from soil to root in each soil-layer mm/s + 288 QHR hydraulic redistribution mm/s + 289 QSNO_WINDUNLOAD canopy snow wind unloading mm/s + 290 QSNO_TEMPUNLOAD canopy snow temp unloading mm/s + 291 QSNOEVAP evaporation from snow (only when snl<0, otherwise it is equal to qflx_ev_soil) mm/s + 292 QH2OSFC surface water runoff mm/s + 293 QPHSNEG net negative hydraulic redistribution flux mm/s + 294 AnnET Annual ET mm/s + 295 QRUNOFF_TO_COUPLER total liquid runoff sent to coupler (includes corrections for land use change) mm/s + 296 QRUNOFF_ICE_TO_COUPLER total ice runoff sent to coupler (includes corrections for land use change) mm/s + 297 QRUNOFF_ICE_TO_LIQ liquid runoff from converted ice runoff mm/s + 298 RAIN_FROM_ATM atmospheric rain received from atmosphere (pre-repartitioning) mm/s + 299 SNOW_FROM_ATM atmospheric snow received from atmosphere (pre-repartitioning) mm/s + 300 QBOT atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg + 301 Qair atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg + 302 QFLOOD runoff from river flooding mm/s + 303 RAIN atmospheric rain, after rain/snow repartitioning based on temperature mm/s + 304 Rainf atmospheric rain, after rain/snow repartitioning based on temperature mm/s + 305 RAIN_ICE atmospheric rain, after rain/snow repartitioning based on temperature (ice landunits only) mm/s + 306 SNOW atmospheric snow, after rain/snow repartitioning based on temperature mm/s + 307 SNOW_ICE atmospheric snow, after rain/snow repartitioning based on temperature (ice landunits only) mm/s + 308 VOLR river channel total water storage m3 + 309 VOLRMCH river channel main channel water storage m3 + 310 RH atmospheric relative humidity % + 311 RH30 30-day running mean of relative humidity % + 312 PREC10 10-day running mean of PREC MM H2O/S + 313 PREC60 60-day running mean of PREC MM H2O/S + 314 EFLX_DYNBAL dynamic land cover change conversion energy flux W/m^2 + 315 FSM snow melt heat flux W/m^2 + 316 FSM_ICE snow melt heat flux (ice landunits only) W/m^2 + 317 FSM_R Rural snow melt heat flux W/m^2 + 318 FSM_U Urban snow melt heat flux W/m^2 + 319 FIRA net infrared (longwave) radiation W/m^2 + 320 FIRA_ICE net infrared (longwave) radiation (ice landunits only) W/m^2 + 321 FIRA_R Rural net infrared (longwave) radiation W/m^2 + 322 FIRE emitted infrared (longwave) radiation W/m^2 + 323 LWup upwelling longwave radiation W/m^2 + 324 FIRE_ICE emitted infrared (longwave) radiation (ice landunits only) W/m^2 + 325 FIRE_R Rural emitted infrared (longwave) radiation W/m^2 + 326 FCTR canopy transpiration W/m^2 + 327 FCEV canopy evaporation W/m^2 + 328 FGEV ground evaporation W/m^2 + 329 FSH sensible heat not including correction for land use change and rain/snow conversion W/m^2 + 330 FSH_ICE sensible heat not including correction for land use change and rain/snow conversion (ice landu W/m^2 + 331 FSH_R Rural sensible heat W/m^2 + 332 Qh sensible heat W/m^2 + 333 Qle total evaporation W/m^2 + 334 EFLX_LH_TOT total latent heat flux [+ to atm] W/m^2 + 335 EFLX_LH_TOT_ICE total latent heat flux [+ to atm] (ice landunits only) W/m^2 + 336 EFLX_LH_TOT_R Rural total evaporation W/m^2 + 337 Qstor storage heat flux (includes snowmelt) W/m^2 + 338 FSH_V sensible heat from veg W/m^2 + 339 FSH_G sensible heat from ground W/m^2 + 340 FGR heat flux into soil/snow including snow melt and lake / snow light transmission W/m^2 + 341 FGR_ICE heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits W/m^2 + 342 FGR_R Rural heat flux into soil/snow including snow melt and snow light transmission W/m^2 + 343 FIRA_U Urban net infrared (longwave) radiation W/m^2 + 344 EFLX_SOIL_GRND soil heat flux [+ into soil] W/m^2 + 345 FIRE_U Urban emitted infrared (longwave) radiation W/m^2 + 346 FSH_U Urban sensible heat W/m^2 + 347 FSH_PRECIP_CONVERSION Sensible heat flux from conversion of rain/snow atm forcing W/m^2 + 348 EFLX_LH_TOT_U Urban total evaporation W/m^2 + 349 FGR_U Urban heat flux into soil/snow including snow melt W/m^2 + 350 Rnet net radiation W/m^2 + 351 DLRAD downward longwave radiation below the canopy W/m^2 + 352 ULRAD upward longwave radiation above the canopy W/m^2 + 353 CGRND deriv. of soil energy flux wrt to soil temp W/m^2/K + 354 CGRNDL deriv. of soil latent heat flux wrt soil temp W/m^2/K + 355 CGRNDS deriv. of soil sensible heat flux wrt soil temp W/m^2/K + 356 EFLX_GNET net heat flux into ground W/m^2 + 357 EFLX_GRND_LAKE net heat flux into lake/snow surface, excluding light transmission W/m^2 + 358 EFLXBUILD building heat flux from change in interior building air temperature W/m^2 + 359 URBAN_AC urban air conditioning flux W/m^2 + 360 URBAN_HEAT urban heating flux W/m^2 + 361 DGNETDT derivative of net ground heat flux wrt soil temp W/m^2/K + 362 FGR12 heat flux between soil layers 1 and 2 W/m^2 + 363 FGR_SOIL_R Rural downward heat flux at interface below each soil layer watt/m^2 + 364 TRAFFICFLUX sensible heat flux from urban traffic W/m^2 + 365 WASTEHEAT sensible heat flux from heating/cooling sources of urban waste heat W/m^2 + 366 HEAT_FROM_AC sensible heat flux put into canyon due to heat removed from air conditioning W/m^2 + 367 TAUX zonal surface stress kg/m/s^2 + 368 Qtau momentum flux kg/m/s^2 + 369 TAUY meridional surface stress kg/m/s^2 + 370 BTRANMN daily minimum of transpiration beta factor unitless + 371 RRESIS root resistance in each soil layer proportion + 372 ERRSOI soil/lake energy conservation error W/m^2 + 373 ERRSEB surface energy conservation error W/m^2 + 374 ERRSOL solar radiation conservation error W/m^2 + 375 DSTDEP total dust deposition (dry+wet) from atmosphere kg/m^2/s + 376 BCDEP total BC deposition (dry+wet) from atmosphere kg/m^2/s + 377 OCDEP total OC deposition (dry+wet) from atmosphere kg/m^2/s + 378 SNOBCMCL mass of BC in snow column kg/m2 + 379 SNOBCMSL mass of BC in top snow layer kg/m2 + 380 SNOOCMCL mass of OC in snow column kg/m2 + 381 SNOOCMSL mass of OC in top snow layer kg/m2 + 382 SNODSTMCL mass of dust in snow column kg/m2 + 383 SNODSTMSL mass of dust in top snow layer kg/m2 + 384 Z0MG roughness length over ground, momentum m + 385 Z0HG roughness length over ground, sensible heat m + 386 Z0QG roughness length over ground, latent heat m + 387 VA atmospheric wind speed plus convective velocity m/s + 388 U10 10-m wind m/s + 389 U10_ICE 10-m wind (ice landunits only) m/s + 390 U10_DUST 10-m wind for dust model m/s + 391 RAM1 aerodynamical resistance s/m + 392 FV friction velocity for dust model m/s + 393 Z0HV roughness length over vegetation, sensible heat m + 394 Z0MV roughness length over vegetation, momentum m + 395 Z0QV roughness length over vegetation, latent heat m + 396 RB10 10 day running mean boundary layer resistance s/m + 397 LAKEICEFRAC lake layer ice mass fraction unitless + 398 LAKEICEFRAC_SURF surface lake layer ice mass fraction unitless + 399 LAKEICETHICK thickness of lake ice (including physical expansion on freezing) m + 400 TKE1 top lake level eddy thermal conductivity W/(mK) + 401 RAM_LAKE aerodynamic resistance for momentum (lakes only) s/m + 402 UST_LAKE friction velocity (lakes only) m/s + 403 RH_LEAF fractional humidity at leaf surface fraction + 404 VPD_CAN canopy vapor pressure deficit kPa + 405 LNC leaf N concentration gN leaf/m^2 + 406 FPSN photosynthesis umol m-2 s-1 + 407 FPSN_WC Rubisco-limited photosynthesis umol m-2 s-1 + 408 FPSN_WJ RuBP-limited photosynthesis umol m-2 s-1 + 409 FPSN_WP Product-limited photosynthesis umol m-2 s-1 + 410 PSNSUN sunlit leaf photosynthesis umolCO2/m^2/s + 411 PSNSHA shaded leaf photosynthesis umolCO2/m^2/s + 412 RSSUN sunlit leaf stomatal resistance s/m + 413 RSSHA shaded leaf stomatal resistance s/m + 414 GSSUN sunlit leaf stomatal conductance umol H20/m2/s + 415 GSSHA shaded leaf stomatal conductance umol H20/m2/s + 416 GSSUNLN sunlit leaf stomatal conductance at local noon umol H20/m2/s + 417 GSSHALN shaded leaf stomatal conductance at local noon umol H20/m2/s + 418 Vcmx25Z canopy profile of vcmax25 predicted by LUNA model umol/m2/s + 419 Jmx25Z maximum rate of electron transport at 25 Celcius for canopy layers umol electrons/m2/s + 420 PNLCZ Proportion of nitrogen allocated for light capture unitless + 421 VCMX25T canopy profile of vcmax25 umol/m2/s + 422 JMX25T canopy profile of jmax umol/m2/s + 423 TPU25T canopy profile of tpu umol/m2/s + 424 FPSN24 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m**2 ground/day + 425 QCHARGE aquifer recharge rate (natural vegetated and crop landunits only) mm/s + 426 NSUBSTEPS number of adaptive timesteps in CLM timestep unitless + 427 FROST_TABLE frost table depth (natural vegetated and crop landunits only) m + 428 ZWT water table depth (natural vegetated and crop landunits only) m + 429 ZWT_PERCH perched water table depth (natural vegetated and crop landunits only) m + 430 FCOV fractional impermeable area unitless + 431 FSAT fractional area with water table at surface unitless + 432 FSA absorbed solar radiation W/m^2 + 433 FSA_ICE absorbed solar radiation (ice landunits only) W/m^2 + 434 FSA_R Rural absorbed solar radiation W/m^2 + 435 FSA_U Urban absorbed solar radiation W/m^2 + 436 FSR reflected solar radiation W/m^2 + 437 SWup upwelling shortwave radiation W/m^2 + 438 FSR_ICE reflected solar radiation (ice landunits only) W/m^2 + 439 SNO_ABS Absorbed solar radiation in each snow layer W/m^2 + 440 SNO_ABS_ICE Absorbed solar radiation in each snow layer (ice landunits only) W/m^2 + 441 SABV solar rad absorbed by veg W/m^2 + 442 SABG solar rad absorbed by ground W/m^2 + 443 SABG_PEN Rural solar rad penetrating top soil or snow layer watt/m^2 + 444 FSDSND direct nir incident solar radiation W/m^2 + 445 FSDSNI diffuse nir incident solar radiation W/m^2 + 446 FSDSNDLN direct nir incident solar radiation at local noon W/m^2 + 447 FSRND direct nir reflected solar radiation W/m^2 + 448 FSRNI diffuse nir reflected solar radiation W/m^2 + 449 FSRNDLN direct nir reflected solar radiation at local noon W/m^2 + 450 FSRSF reflected solar radiation W/m^2 + 451 SSRE_FSR surface snow effect on reflected solar radiation W/m^2 + 452 FSRSFND direct nir reflected solar radiation W/m^2 + 453 FSRSFNI diffuse nir reflected solar radiation W/m^2 + 454 FSRSFNDLN direct nir reflected solar radiation at local noon W/m^2 + 455 SSRE_FSRND surface snow effect on direct nir reflected solar radiation W/m^2 + 456 SSRE_FSRNI surface snow effect on diffuse nir reflected solar radiation W/m^2 + 457 SSRE_FSRNDLN surface snow effect on direct nir reflected solar radiation at local noon W/m^2 + 458 SNOINTABS Fraction of incoming solar absorbed by lower snow layers - + 459 PAR240DZ 10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer W/m^2 + 460 PAR240XZ 10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer W/m^2 + 461 COSZEN cosine of solar zenith angle none + 462 ALBGRD ground albedo (direct) proportion + 463 ALBGRI ground albedo (indirect) proportion + 464 ALBDSF diagnostic snow-free surface albedo (direct) proportion + 465 ALBISF diagnostic snow-free surface albedo (indirect) proportion + 466 ALBD surface albedo (direct) proportion + 467 ALBI surface albedo (indirect) proportion + 468 FSDSVD direct vis incident solar radiation W/m^2 + 469 FSDSVI diffuse vis incident solar radiation W/m^2 + 470 FSRVD direct vis reflected solar radiation W/m^2 + 471 FSRVI diffuse vis reflected solar radiation W/m^2 + 472 FSRSFVD direct vis reflected solar radiation W/m^2 + 473 FSRSFVI diffuse vis reflected solar radiation W/m^2 + 474 SSRE_FSRVD surface snow radiatve effect on direct vis reflected solar radiation W/m^2 + 475 SSRE_FSRVI surface snow radiatve effect on diffuse vis reflected solar radiation W/m^2 + 476 FSDSVDLN direct vis incident solar radiation at local noon W/m^2 + 477 FSDSVILN diffuse vis incident solar radiation at local noon W/m^2 + 478 PARVEGLN absorbed par by vegetation at local noon W/m^2 + 479 FSRVDLN direct vis reflected solar radiation at local noon W/m^2 + 480 FSRSFVDLN direct vis reflected solar radiation at local noon W/m^2 + 481 SSRE_FSRVDLN surface snow radiatve effect on direct vis reflected solar radiation at local noon W/m^2 + 482 SNOFSDSVD direct vis incident solar radiation on snow W/m^2 + 483 SNOFSDSND direct nir incident solar radiation on snow W/m^2 + 484 SNOFSDSVI diffuse vis incident solar radiation on snow W/m^2 + 485 SNOFSDSNI diffuse nir incident solar radiation on snow W/m^2 + 486 SNOFSRVD direct vis reflected solar radiation from snow W/m^2 + 487 SNOFSRND direct nir reflected solar radiation from snow W/m^2 + 488 SNOFSRVI diffuse vis reflected solar radiation from snow W/m^2 + 489 SNOFSRNI diffuse nir reflected solar radiation from snow W/m^2 + 490 DSTFLXT total surface dust emission kg/m2/s + 491 DPVLTRB1 turbulent deposition velocity 1 m/s + 492 DPVLTRB2 turbulent deposition velocity 2 m/s + 493 DPVLTRB3 turbulent deposition velocity 3 m/s + 494 DPVLTRB4 turbulent deposition velocity 4 m/s + 495 QIRRIG_DEMAND irrigation demand mm/s + 496 TOPO_COL column-level topographic height m + 497 TOPO_COL_ICE column-level topographic height (ice landunits only) m + 498 FINUNDATED fractional inundated area of vegetated columns unitless + 499 FINUNDATED_LAG time-lagged inundated fraction of vegetated columns unitless + 500 CH4_SURF_DIFF_SAT diffusive surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s + 501 CH4_SURF_DIFF_UNSAT diffusive surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s + 502 CH4_EBUL_TOTAL_SAT ebullition surface CH4 flux; (+ to atm) mol/m2/s + 503 CH4_EBUL_TOTAL_UNSAT ebullition surface CH4 flux; (+ to atm) mol/m2/s + 504 CH4_SURF_EBUL_SAT ebullition surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s + 505 CH4_SURF_EBUL_UNSAT ebullition surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s + 506 CH4_SURF_AERE_SAT aerenchyma surface CH4 flux for inundated area; (+ to atm) mol/m2/s + 507 CH4_SURF_AERE_UNSAT aerenchyma surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s + 508 TOTCOLCH4 total belowground CH4 (0 for non-lake special landunits in the absence of dynamic landunits) gC/m2 + 509 CONC_CH4_SAT CH4 soil Concentration for inundated / lake area mol/m3 + 510 CONC_CH4_UNSAT CH4 soil Concentration for non-inundated area mol/m3 + 511 O2_DECOMP_DEPTH_UNSAT O2 consumption from HR and AR for non-inundated area mol/m3/s + 512 CONC_O2_SAT O2 soil Concentration for inundated / lake area mol/m3 + 513 CONC_O2_UNSAT O2 soil Concentration for non-inundated area mol/m3 + 514 FCH4TOCO2 Gridcell oxidation of CH4 to CO2 gC/m2/s + 515 CH4PROD Gridcell total production of CH4 gC/m2/s + 516 FCH4_DFSAT CH4 additional flux due to changing fsat, natural vegetated and crop landunits only kgC/m2/s + 517 ZWT_CH4_UNSAT depth of water table for methane production used in non-inundated area m + 518 QOVER_LAG time-lagged surface runoff for soil columns mm/s + 519 WTGQ surface tracer conductance m/s + 520 DYN_COL_ADJUSTMENTS_CH4 Adjustments in ch4 due to dynamic column areas; only makes sense at the column level: should n gC/m^2 + 521 MEG_isoprene MEGAN flux kg/m2/sec + 522 MEG_pinene_a MEGAN flux kg/m2/sec + 523 MEG_carene_3 MEGAN flux kg/m2/sec + 524 MEG_thujene_a MEGAN flux kg/m2/sec + 525 MEG_methanol MEGAN flux kg/m2/sec + 526 MEG_ethanol MEGAN flux kg/m2/sec + 527 MEG_formaldehyde MEGAN flux kg/m2/sec + 528 MEG_acetaldehyde MEGAN flux kg/m2/sec + 529 MEG_acetic_acid MEGAN flux kg/m2/sec + 530 MEG_acetone MEGAN flux kg/m2/sec + 531 VOCFLXT total VOC flux into atmosphere moles/m2/sec + 532 GAMMA total gamma for VOC calc non + 533 GAMMAL gamma L for VOC calc non + 534 GAMMAT gamma T for VOC calc non + 535 GAMMAP gamma P for VOC calc non + 536 GAMMAA gamma A for VOC calc non + 537 GAMMAS gamma S for VOC calc non + 538 GAMMAC gamma C for VOC calc non + 539 EOPT Eopt coefficient for VOC calc non + 540 TOPT topt coefficient for VOC calc non + 541 ALPHA alpha coefficient for VOC calc non + 542 currentPatch currentPatch coefficient for VOC calc non + 543 PAR_sun sunlit PAR umol/m2/s + 544 PAR24_sun sunlit PAR (24 hrs) umol/m2/s + 545 PAR240_sun sunlit PAR (240 hrs) umol/m2/s + 546 PAR_shade shade PAR umol/m2/s + 547 PAR24_shade shade PAR (24 hrs) umol/m2/s + 548 PAR240_shade shade PAR (240 hrs) umol/m2/s + 549 FireComp_BC fire emissions flux of BC kg/m2/sec + 550 FireComp_OC fire emissions flux of OC kg/m2/sec + 551 FireComp_SO2 fire emissions flux of SO2 kg/m2/sec + 552 FireMech_bc_a1 fire emissions flux of bc_a1 kg/m2/sec + 553 FireMech_pom_a1 fire emissions flux of pom_a1 kg/m2/sec + 554 FireMech_SO2 fire emissions flux of SO2 kg/m2/sec + 555 FireEmis_TOT Total fire emissions flux gC/m2/sec + 556 FireEmis_ZTOP Top of vertical fire emissions distribution m + 557 CROOT_PROF profile for litter C and N inputs from coarse roots 1/m + 558 FROOT_PROF profile for litter C and N inputs from fine roots 1/m + 559 LEAF_PROF profile for litter C and N inputs from leaves 1/m + 560 STEM_PROF profile for litter C and N inputs from stems 1/m + 561 NFIXATION_PROF profile for biological N fixation 1/m + 562 NDEP_PROF profile for atmospheric N deposition 1/m + 563 SOM_ADV_COEF advection term for vertical SOM translocation m/s + 564 SOM_DIFFUS_COEF diffusion coefficient for vertical SOM translocation m^2/s + 565 FPI fraction of potential immobilization proportion + 566 FPI_vr fraction of potential immobilization proportion + 567 SOILC_vr SOIL C (vertically resolved) gC/m^3 + 568 LITR1C_vr LITR1 C (vertically resolved) gC/m^3 + 569 LITR1C LITR1 C gC/m^2 + 570 LITR1C_1m LITR1 C to 1 meter gC/m^2 + 571 LITR2C_vr LITR2 C (vertically resolved) gC/m^3 + 572 LITR2C LITR2 C gC/m^2 + 573 LITR2C_1m LITR2 C to 1 meter gC/m^2 + 574 LITR3C_vr LITR3 C (vertically resolved) gC/m^3 + 575 LITR3C LITR3 C gC/m^2 + 576 LITR3C_1m LITR3 C to 1 meter gC/m^2 + 577 CWDC_vr CWD C (vertically resolved) gC/m^3 + 578 CWDC CWD C gC/m^2 + 579 CWDC_1m CWD C to 1 meter gC/m^2 + 580 SOIL1C_vr SOIL1 C (vertically resolved) gC/m^3 + 581 SOIL1C SOIL1 C gC/m^2 + 582 SOIL1C_1m SOIL1 C to 1 meter gC/m^2 + 583 SOIL2C_vr SOIL2 C (vertically resolved) gC/m^3 + 584 SOIL2C SOIL2 C gC/m^2 + 585 SOIL2C_1m SOIL2 C to 1 meter gC/m^2 + 586 SOIL3C_vr SOIL3 C (vertically resolved) gC/m^3 + 587 SOIL3C SOIL3 C gC/m^2 + 588 SOIL3C_1m SOIL3 C to 1 meter gC/m^2 + 589 TOTLITC total litter carbon gC/m^2 + 590 TOTSOMC total soil organic matter carbon gC/m^2 + 591 TOTLITC_1m total litter carbon to 1 meter depth gC/m^2 + 592 TOTSOMC_1m total soil organic matter carbon to 1 meter depth gC/m^2 + 593 COL_CTRUNC column-level sink for C truncation gC/m^2 + 594 DYN_COL_SOIL_ADJUSTMENTS_C Adjustments in soil carbon due to dynamic column areas; only makes sense at the column level: gC/m^2 + 595 HR total heterotrophic respiration gC/m^2/s + 596 LITTERC_HR litter C heterotrophic respiration gC/m^2/s + 597 SOILC_HR soil C heterotrophic respiration gC/m^2/s + 598 SOMC_FIRE C loss due to peat burning gC/m^2/s + 599 K_LITR1 litter 1 potential loss coefficient 1/s + 600 K_LITR2 litter 2 potential loss coefficient 1/s + 601 K_LITR3 litter 3 potential loss coefficient 1/s + 602 K_CWD coarse woody debris potential loss coefficient 1/s + 603 K_SOIL1 soil 1 potential loss coefficient 1/s + 604 K_SOIL2 soil 2 potential loss coefficient 1/s + 605 K_SOIL3 soil 3 potential loss coefficient 1/s + 606 LITR1_HR Het. Resp. from litter 1 gC/m^2/s + 607 LITR1C_TO_SOIL1C decomp. of litter 1 C to soil 1 C gC/m^2/s + 608 LITR1_HR_vr Het. Resp. from litter 1 gC/m^3/s + 609 LITR1C_TO_SOIL1C_vr decomp. of litter 1 C to soil 1 C gC/m^3/s + 610 LITR2_HR Het. Resp. from litter 2 gC/m^2/s + 611 LITR2C_TO_SOIL1C decomp. of litter 2 C to soil 1 C gC/m^2/s + 612 LITR2_HR_vr Het. Resp. from litter 2 gC/m^3/s + 613 LITR2C_TO_SOIL1C_vr decomp. of litter 2 C to soil 1 C gC/m^3/s + 614 LITR3_HR Het. Resp. from litter 3 gC/m^2/s + 615 LITR3C_TO_SOIL2C decomp. of litter 3 C to soil 2 C gC/m^2/s + 616 LITR3_HR_vr Het. Resp. from litter 3 gC/m^3/s + 617 LITR3C_TO_SOIL2C_vr decomp. of litter 3 C to soil 2 C gC/m^3/s + 618 SOIL1_HR_S2 Het. Resp. from soil 1 gC/m^2/s + 619 SOIL1C_TO_SOIL2C decomp. of soil 1 C to soil 2 C gC/m^2/s + 620 SOIL1_HR_S2_vr Het. Resp. from soil 1 gC/m^3/s + 621 SOIL1C_TO_SOIL2C_vr decomp. of soil 1 C to soil 2 C gC/m^3/s + 622 SOIL1_HR_S3 Het. Resp. from soil 1 gC/m^2/s + 623 SOIL1C_TO_SOIL3C decomp. of soil 1 C to soil 3 C gC/m^2/s + 624 SOIL1_HR_S3_vr Het. Resp. from soil 1 gC/m^3/s + 625 SOIL1C_TO_SOIL3C_vr decomp. of soil 1 C to soil 3 C gC/m^3/s + 626 SOIL2_HR_S1 Het. Resp. from soil 2 gC/m^2/s + 627 SOIL2C_TO_SOIL1C decomp. of soil 2 C to soil 1 C gC/m^2/s + 628 SOIL2_HR_S1_vr Het. Resp. from soil 2 gC/m^3/s + 629 SOIL2C_TO_SOIL1C_vr decomp. of soil 2 C to soil 1 C gC/m^3/s + 630 SOIL2_HR_S3 Het. Resp. from soil 2 gC/m^2/s + 631 SOIL2C_TO_SOIL3C decomp. of soil 2 C to soil 3 C gC/m^2/s + 632 SOIL2_HR_S3_vr Het. Resp. from soil 2 gC/m^3/s + 633 SOIL2C_TO_SOIL3C_vr decomp. of soil 2 C to soil 3 C gC/m^3/s + 634 SOIL3_HR Het. Resp. from soil 3 gC/m^2/s + 635 SOIL3C_TO_SOIL1C decomp. of soil 3 C to soil 1 C gC/m^2/s + 636 SOIL3_HR_vr Het. Resp. from soil 3 gC/m^3/s + 637 SOIL3C_TO_SOIL1C_vr decomp. of soil 3 C to soil 1 C gC/m^3/s + 638 CWDC_TO_LITR2C decomp. of coarse woody debris C to litter 2 C gC/m^2/s + 639 CWDC_TO_LITR2C_vr decomp. of coarse woody debris C to litter 2 C gC/m^3/s + 640 CWDC_TO_LITR3C decomp. of coarse woody debris C to litter 3 C gC/m^2/s + 641 CWDC_TO_LITR3C_vr decomp. of coarse woody debris C to litter 3 C gC/m^3/s + 642 T_SCALAR temperature inhibition of decomposition unitless + 643 W_SCALAR Moisture (dryness) inhibition of decomposition unitless + 644 O_SCALAR fraction by which decomposition is reduced due to anoxia unitless + 645 SOM_C_LEACHED total flux of C from SOM pools due to leaching gC/m^2/s + 646 M_LITR1C_TO_LEACHING litter 1 C leaching loss gC/m^2/s + 647 LITR1C_TNDNCY_VERT_TRANS litter 1 C tendency due to vertical transport gC/m^3/s + 648 M_LITR2C_TO_LEACHING litter 2 C leaching loss gC/m^2/s + 649 LITR2C_TNDNCY_VERT_TRANS litter 2 C tendency due to vertical transport gC/m^3/s + 650 M_LITR3C_TO_LEACHING litter 3 C leaching loss gC/m^2/s + 651 LITR3C_TNDNCY_VERT_TRANS litter 3 C tendency due to vertical transport gC/m^3/s + 652 M_SOIL1C_TO_LEACHING soil 1 C leaching loss gC/m^2/s + 653 SOIL1C_TNDNCY_VERT_TRANS soil 1 C tendency due to vertical transport gC/m^3/s + 654 M_SOIL2C_TO_LEACHING soil 2 C leaching loss gC/m^2/s + 655 SOIL2C_TNDNCY_VERT_TRANS soil 2 C tendency due to vertical transport gC/m^3/s + 656 M_SOIL3C_TO_LEACHING soil 3 C leaching loss gC/m^2/s + 657 SOIL3C_TNDNCY_VERT_TRANS soil 3 C tendency due to vertical transport gC/m^3/s + 658 HR_vr total vertically resolved heterotrophic respiration gC/m^3/s + 659 SOILN_vr SOIL N (vertically resolved) gN/m^3 + 660 LITR1N_vr LITR1 N (vertically resolved) gN/m^3 + 661 LITR1N LITR1 N gN/m^2 + 662 LITR1N_1m LITR1 N to 1 meter gN/m^2 + 663 LITR2N_vr LITR2 N (vertically resolved) gN/m^3 + 664 LITR2N LITR2 N gN/m^2 + 665 LITR2N_1m LITR2 N to 1 meter gN/m^2 + 666 LITR3N_vr LITR3 N (vertically resolved) gN/m^3 + 667 LITR3N LITR3 N gN/m^2 + 668 LITR3N_1m LITR3 N to 1 meter gN/m^2 + 669 CWDN_vr CWD N (vertically resolved) gN/m^3 + 670 CWDN CWD N gN/m^2 + 671 CWDN_1m CWD N to 1 meter gN/m^2 + 672 SOIL1N_vr SOIL1 N (vertically resolved) gN/m^3 + 673 SOIL1N SOIL1 N gN/m^2 + 674 SOIL1N_1m SOIL1 N to 1 meter gN/m^2 + 675 SOIL2N_vr SOIL2 N (vertically resolved) gN/m^3 + 676 SOIL2N SOIL2 N gN/m^2 + 677 SOIL2N_1m SOIL2 N to 1 meter gN/m^2 + 678 SOIL3N_vr SOIL3 N (vertically resolved) gN/m^3 + 679 SOIL3N SOIL3 N gN/m^2 + 680 SOIL3N_1m SOIL3 N to 1 meter gN/m^2 + 681 SMINN soil mineral N gN/m^2 + 682 TOTLITN_1m total litter N to 1 meter gN/m^2 + 683 TOTSOMN_1m total soil organic matter N to 1 meter gN/m^2 + 684 COL_NTRUNC column-level sink for N truncation gN/m^2 + 685 SMIN_NO3_vr soil mineral NO3 (vert. res.) gN/m^3 + 686 SMIN_NH4_vr soil mineral NH4 (vert. res.) gN/m^3 + 687 SMINN_vr soil mineral N gN/m^3 + 688 SMIN_NO3 soil mineral NO3 gN/m^2 + 689 SMIN_NH4 soil mineral NH4 gN/m^2 + 690 TOTLITN total litter N gN/m^2 + 691 TOTSOMN total soil organic matter N gN/m^2 + 692 DYN_COL_SOIL_ADJUSTMENTS_N Adjustments in soil nitrogen due to dynamic column areas; only makes sense at the column level gN/m^2 + 693 DYN_COL_SOIL_ADJUSTMENTS_NO3 Adjustments in soil NO3 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 + 694 DYN_COL_SOIL_ADJUSTMENTS_NH4 Adjustments in soil NH4 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 + 695 NDEP_TO_SMINN atmospheric N deposition to soil mineral N gN/m^2/s + 696 NFIX_TO_SMINN symbiotic/asymbiotic N fixation to soil mineral N gN/m^2/s + 697 FFIX_TO_SMINN free living N fixation to soil mineral N gN/m^2/s + 698 SMINN_TO_SOIL1N_L1 mineral N flux for decomp. of LITR1to SOIL1 gN/m^2 + 699 LITR1N_TO_SOIL1N decomp. of litter 1 N to soil 1 N gN/m^2 + 700 SMINN_TO_SOIL1N_L1_vr mineral N flux for decomp. of LITR1to SOIL1 gN/m^3 + 701 LITR1N_TO_SOIL1N_vr decomp. of litter 1 N to soil 1 N gN/m^3 + 702 SMINN_TO_SOIL1N_L2 mineral N flux for decomp. of LITR2to SOIL1 gN/m^2 + 703 LITR2N_TO_SOIL1N decomp. of litter 2 N to soil 1 N gN/m^2 + 704 SMINN_TO_SOIL1N_L2_vr mineral N flux for decomp. of LITR2to SOIL1 gN/m^3 + 705 LITR2N_TO_SOIL1N_vr decomp. of litter 2 N to soil 1 N gN/m^3 + 706 SMINN_TO_SOIL2N_L3 mineral N flux for decomp. of LITR3to SOIL2 gN/m^2 + 707 LITR3N_TO_SOIL2N decomp. of litter 3 N to soil 2 N gN/m^2 + 708 SMINN_TO_SOIL2N_L3_vr mineral N flux for decomp. of LITR3to SOIL2 gN/m^3 + 709 LITR3N_TO_SOIL2N_vr decomp. of litter 3 N to soil 2 N gN/m^3 + 710 SMINN_TO_SOIL2N_S1 mineral N flux for decomp. of SOIL1to SOIL2 gN/m^2 + 711 SOIL1N_TO_SOIL2N decomp. of soil 1 N to soil 2 N gN/m^2 + 712 SMINN_TO_SOIL2N_S1_vr mineral N flux for decomp. of SOIL1to SOIL2 gN/m^3 + 713 SOIL1N_TO_SOIL2N_vr decomp. of soil 1 N to soil 2 N gN/m^3 + 714 SMINN_TO_SOIL3N_S1 mineral N flux for decomp. of SOIL1to SOIL3 gN/m^2 + 715 SOIL1N_TO_SOIL3N decomp. of soil 1 N to soil 3 N gN/m^2 + 716 SMINN_TO_SOIL3N_S1_vr mineral N flux for decomp. of SOIL1to SOIL3 gN/m^3 + 717 SOIL1N_TO_SOIL3N_vr decomp. of soil 1 N to soil 3 N gN/m^3 + 718 SMINN_TO_SOIL1N_S2 mineral N flux for decomp. of SOIL2to SOIL1 gN/m^2 + 719 SOIL2N_TO_SOIL1N decomp. of soil 2 N to soil 1 N gN/m^2 + 720 SMINN_TO_SOIL1N_S2_vr mineral N flux for decomp. of SOIL2to SOIL1 gN/m^3 + 721 SOIL2N_TO_SOIL1N_vr decomp. of soil 2 N to soil 1 N gN/m^3 + 722 SMINN_TO_SOIL3N_S2 mineral N flux for decomp. of SOIL2to SOIL3 gN/m^2 + 723 SOIL2N_TO_SOIL3N decomp. of soil 2 N to soil 3 N gN/m^2 + 724 SMINN_TO_SOIL3N_S2_vr mineral N flux for decomp. of SOIL2to SOIL3 gN/m^3 + 725 SOIL2N_TO_SOIL3N_vr decomp. of soil 2 N to soil 3 N gN/m^3 + 726 SMINN_TO_SOIL1N_S3 mineral N flux for decomp. of SOIL3to SOIL1 gN/m^2 + 727 SOIL3N_TO_SOIL1N decomp. of soil 3 N to soil 1 N gN/m^2 + 728 SMINN_TO_SOIL1N_S3_vr mineral N flux for decomp. of SOIL3to SOIL1 gN/m^3 + 729 SOIL3N_TO_SOIL1N_vr decomp. of soil 3 N to soil 1 N gN/m^3 + 730 CWDN_TO_LITR2N decomp. of coarse woody debris N to litter 2 N gN/m^2 + 731 CWDN_TO_LITR2N_vr decomp. of coarse woody debris N to litter 2 N gN/m^3 + 732 CWDN_TO_LITR3N decomp. of coarse woody debris N to litter 3 N gN/m^2 + 733 CWDN_TO_LITR3N_vr decomp. of coarse woody debris N to litter 3 N gN/m^3 + 734 DENIT total rate of denitrification gN/m^2/s + 735 SOM_N_LEACHED total flux of N from SOM pools due to leaching gN/m^2/s + 736 M_LITR1N_TO_LEACHING litter 1 N leaching loss gN/m^2/s + 737 LITR1N_TNDNCY_VERT_TRANS litter 1 N tendency due to vertical transport gN/m^3/s + 738 M_LITR2N_TO_LEACHING litter 2 N leaching loss gN/m^2/s + 739 LITR2N_TNDNCY_VERT_TRANS litter 2 N tendency due to vertical transport gN/m^3/s + 740 M_LITR3N_TO_LEACHING litter 3 N leaching loss gN/m^2/s + 741 LITR3N_TNDNCY_VERT_TRANS litter 3 N tendency due to vertical transport gN/m^3/s + 742 M_SOIL1N_TO_LEACHING soil 1 N leaching loss gN/m^2/s + 743 SOIL1N_TNDNCY_VERT_TRANS soil 1 N tendency due to vertical transport gN/m^3/s + 744 M_SOIL2N_TO_LEACHING soil 2 N leaching loss gN/m^2/s + 745 SOIL2N_TNDNCY_VERT_TRANS soil 2 N tendency due to vertical transport gN/m^3/s + 746 M_SOIL3N_TO_LEACHING soil 3 N leaching loss gN/m^2/s + 747 SOIL3N_TNDNCY_VERT_TRANS soil 3 N tendency due to vertical transport gN/m^3/s + 748 F_NIT nitrification flux gN/m^2/s + 749 F_DENIT denitrification flux gN/m^2/s + 750 POT_F_NIT potential nitrification flux gN/m^2/s + 751 POT_F_DENIT potential denitrification flux gN/m^2/s + 752 SMIN_NO3_LEACHED soil NO3 pool loss to leaching gN/m^2/s + 753 SMIN_NO3_RUNOFF soil NO3 pool loss to runoff gN/m^2/s + 754 F_NIT_vr nitrification flux gN/m^3/s + 755 F_DENIT_vr denitrification flux gN/m^3/s + 756 POT_F_NIT_vr potential nitrification flux gN/m^3/s + 757 POT_F_DENIT_vr potential denitrification flux gN/m^3/s + 758 SMIN_NO3_LEACHED_vr soil NO3 pool loss to leaching gN/m^3/s + 759 SMIN_NO3_RUNOFF_vr soil NO3 pool loss to runoff gN/m^3/s + 760 n2_n2o_ratio_denit n2_n2o_ratio_denit gN/gN + 761 ACTUAL_IMMOB_NO3 immobilization of NO3 gN/m^3/s + 762 ACTUAL_IMMOB_NH4 immobilization of NH4 gN/m^3/s + 763 SMIN_NO3_TO_PLANT plant uptake of NO3 gN/m^3/s + 764 SMIN_NH4_TO_PLANT plant uptake of NH4 gN/m^3/s + 765 SMIN_NO3_MASSDENS SMIN_NO3_MASSDENS ugN/cm^3 soil + 766 K_NITR_T K_NITR_T unitless + 767 K_NITR_PH K_NITR_PH unitless + 768 K_NITR_H2O K_NITR_H2O unitless + 769 K_NITR K_NITR 1/s + 770 WFPS WFPS percent + 771 FMAX_DENIT_CARBONSUBSTRATE FMAX_DENIT_CARBONSUBSTRATE gN/m^3/s + 772 FMAX_DENIT_NITRATE FMAX_DENIT_NITRATE gN/m^3/s + 773 F_DENIT_BASE F_DENIT_BASE gN/m^3/s + 774 diffus diffusivity m^2/s + 775 ratio_k1 ratio_k1 none + 776 ratio_no3_co2 ratio_no3_co2 ratio + 777 soil_co2_prod soil_co2_prod ug C / g soil / day + 778 fr_WFPS fr_WFPS fraction + 779 soil_bulkdensity soil_bulkdensity kg/m3 + 780 anaerobic_frac anaerobic_frac m3/m3 + 781 r_psi r_psi m + 782 POTENTIAL_IMMOB_vr potential N immobilization gN/m^3/s + 783 ACTUAL_IMMOB_vr actual N immobilization gN/m^3/s + 784 SMINN_TO_PLANT_vr plant uptake of soil mineral N gN/m^3/s + 785 SUPPLEMENT_TO_SMINN_vr supplemental N supply gN/m^3/s + 786 GROSS_NMIN_vr gross rate of N mineralization gN/m^3/s + 787 NET_NMIN_vr net rate of N mineralization gN/m^3/s + 788 POTENTIAL_IMMOB potential N immobilization gN/m^2/s + 789 ACTUAL_IMMOB actual N immobilization gN/m^2/s + 790 SMINN_TO_PLANT plant uptake of soil mineral N gN/m^2/s + 791 SUPPLEMENT_TO_SMINN supplemental N supply gN/m^2/s + 792 GROSS_NMIN gross rate of N mineralization gN/m^2/s + 793 NET_NMIN net rate of N mineralization gN/m^2/s + 794 F_N2O_NIT nitrification N2O flux gN/m^2/s + 795 F_N2O_DENIT denitrification N2O flux gN/m^2/s + 796 FERT_TO_SMINN fertilizer to soil mineral N gN/m^2/s + 797 GDDHARV Growing degree days (gdd) needed to harvest ddays + 798 LFC2 conversion area fraction of BET and BDT that burned per sec + 799 ANNSUM_COUNTER seconds since last annual accumulator turnover s + 800 CANNAVG_T2M annual average of 2m air temperature K + 801 NFIRE fire counts valid only in Reg.C counts/km2/sec + 802 FAREA_BURNED timestep fractional area burned s-1 + 803 BAF_CROP fractional area burned for crop s-1 + 804 BAF_PEATF fractional area burned in peatland s-1 + 805 ANNAVG_T2M annual average 2m air temperature K + 806 TEMPAVG_T2M temporary average 2m air temperature K + 807 DORMANT_FLAG dormancy flag none + 808 DAYS_ACTIVE number of days since last dormancy days + 809 ONSET_FLAG onset flag none + 810 ONSET_COUNTER onset days counter days + 811 ONSET_GDDFLAG onset flag for growing degree day sum none + 812 ONSET_FDD onset freezing degree days counter C degree-days + 813 ONSET_GDD onset growing degree days C degree-days + 814 ONSET_SWI onset soil water index none + 815 OFFSET_FLAG offset flag none + 816 OFFSET_COUNTER offset days counter days + 817 OFFSET_FDD offset freezing degree days counter C degree-days + 818 OFFSET_SWI offset soil water index none + 819 LGSF long growing season factor proportion + 820 BGLFR background litterfall rate 1/s + 821 BGTR background transfer growth rate 1/s + 822 C_ALLOMETRY C allocation index none + 823 N_ALLOMETRY N allocation index none + 824 TEMPSUM_POTENTIAL_GPP temporary annual sum of potential GPP gC/m^2/yr + 825 ANNSUM_POTENTIAL_GPP annual sum of potential GPP gN/m^2/yr + 826 TEMPMAX_RETRANSN temporary annual max of retranslocated N pool gN/m^2 + 827 ANNMAX_RETRANSN annual max of retranslocated N pool gN/m^2 + 828 DOWNREG fractional reduction in GPP due to N limitation proportion + 829 LEAFCN_OFFSET Leaf C:N used by FUN unitless + 830 PLANTCN Plant C:N used by FUN unitless + 831 GRAINC grain C (does not equal yield) gC/m^2 + 832 CROPSEEDC_DEFICIT C used for crop seed that needs to be repaid gC/m^2 + 833 XSMRPOOL_LOSS temporary photosynthate C pool loss gC/m^2 + 834 WOODC wood C gC/m^2 + 835 LEAFC leaf C gC/m^2 + 836 LEAFC_STORAGE leaf C storage gC/m^2 + 837 LEAFC_XFER leaf C transfer gC/m^2 + 838 LEAFC_STORAGE_XFER_ACC Accumulated leaf C transfer gC/m^2 + 839 STORAGE_CDEMAND C use from the C storage pool gC/m^2 + 840 FROOTC fine root C gC/m^2 + 841 FROOTC_STORAGE fine root C storage gC/m^2 + 842 FROOTC_XFER fine root C transfer gC/m^2 + 843 LIVESTEMC live stem C gC/m^2 + 844 LIVESTEMC_STORAGE live stem C storage gC/m^2 + 845 LIVESTEMC_XFER live stem C transfer gC/m^2 + 846 DEADSTEMC dead stem C gC/m^2 + 847 DEADSTEMC_STORAGE dead stem C storage gC/m^2 + 848 DEADSTEMC_XFER dead stem C transfer gC/m^2 + 849 LIVECROOTC live coarse root C gC/m^2 + 850 LIVECROOTC_STORAGE live coarse root C storage gC/m^2 + 851 LIVECROOTC_XFER live coarse root C transfer gC/m^2 + 852 DEADCROOTC dead coarse root C gC/m^2 + 853 DEADCROOTC_STORAGE dead coarse root C storage gC/m^2 + 854 DEADCROOTC_XFER dead coarse root C transfer gC/m^2 + 855 GRESP_STORAGE growth respiration storage gC/m^2 + 856 GRESP_XFER growth respiration transfer gC/m^2 + 857 CPOOL temporary photosynthate C pool gC/m^2 + 858 XSMRPOOL temporary photosynthate C pool gC/m^2 + 859 PFT_CTRUNC patch-level sink for C truncation gC/m^2 + 860 DISPVEGC displayed veg carbon, excluding storage and cpool gC/m^2 + 861 STORVEGC stored vegetation carbon, excluding cpool gC/m^2 + 862 TOTVEGC total vegetation carbon, excluding cpool gC/m^2 + 863 TOTPFTC total patch-level carbon, including cpool gC/m^2 + 864 SEEDC pool for seeding new PFTs via dynamic landcover gC/m^2 + 865 FUELC fuel load gC/m^2 + 866 TOTCOLC total column carbon, incl veg and cpool but excl product pools gC/m^2 + 867 TOTECOSYSC total ecosystem carbon, incl veg but excl cpool and product pools gC/m^2 + 868 GRAINC_TO_FOOD grain C to food gC/m^2/s + 869 LEAFC_TO_BIOFUELC leaf C to biofuel C gC/m^2/s + 870 LIVESTEMC_TO_BIOFUELC livestem C to biofuel C gC/m^2/s + 871 GRAINC_TO_SEED grain C to seed gC/m^2/s + 872 LITTERC_LOSS litter C loss gC/m^2/s + 873 WOODC_ALLOC wood C eallocation gC/m^2/s + 874 WOODC_LOSS wood C loss gC/m^2/s + 875 LEAFC_LOSS leaf C loss gC/m^2/s + 876 LEAFC_ALLOC leaf C allocation gC/m^2/s + 877 FROOTC_LOSS fine root C loss gC/m^2/s + 878 FROOTC_ALLOC fine root C allocation gC/m^2/s + 879 M_LEAFC_TO_LITTER leaf C mortality gC/m^2/s + 880 M_FROOTC_TO_LITTER fine root C mortality gC/m^2/s + 881 M_LEAFC_STORAGE_TO_LITTER leaf C storage mortality gC/m^2/s + 882 M_FROOTC_STORAGE_TO_LITTER fine root C storage mortality gC/m^2/s + 883 M_LIVESTEMC_STORAGE_TO_LITTER live stem C storage mortality gC/m^2/s + 884 M_DEADSTEMC_STORAGE_TO_LITTER dead stem C storage mortality gC/m^2/s + 885 M_LIVECROOTC_STORAGE_TO_LITTER live coarse root C storage mortality gC/m^2/s + 886 M_DEADCROOTC_STORAGE_TO_LITTER dead coarse root C storage mortality gC/m^2/s + 887 M_LEAFC_XFER_TO_LITTER leaf C transfer mortality gC/m^2/s + 888 M_FROOTC_XFER_TO_LITTER fine root C transfer mortality gC/m^2/s + 889 M_LIVESTEMC_XFER_TO_LITTER live stem C transfer mortality gC/m^2/s + 890 M_DEADSTEMC_XFER_TO_LITTER dead stem C transfer mortality gC/m^2/s + 891 M_LIVECROOTC_XFER_TO_LITTER live coarse root C transfer mortality gC/m^2/s + 892 M_DEADCROOTC_XFER_TO_LITTER dead coarse root C transfer mortality gC/m^2/s + 893 M_LIVESTEMC_TO_LITTER live stem C mortality gC/m^2/s + 894 M_DEADSTEMC_TO_LITTER dead stem C mortality gC/m^2/s + 895 M_LIVECROOTC_TO_LITTER live coarse root C mortality gC/m^2/s + 896 M_DEADCROOTC_TO_LITTER dead coarse root C mortality gC/m^2/s + 897 M_GRESP_STORAGE_TO_LITTER growth respiration storage mortality gC/m^2/s + 898 M_GRESP_XFER_TO_LITTER growth respiration transfer mortality gC/m^2/s + 899 M_LEAFC_TO_FIRE leaf C fire loss gC/m^2/s + 900 M_LEAFC_STORAGE_TO_FIRE leaf C storage fire loss gC/m^2/s + 901 M_LEAFC_XFER_TO_FIRE leaf C transfer fire loss gC/m^2/s + 902 M_LIVESTEMC_TO_FIRE live stem C fire loss gC/m^2/s + 903 M_LIVESTEMC_STORAGE_TO_FIRE live stem C storage fire loss gC/m^2/s + 904 M_LIVESTEMC_XFER_TO_FIRE live stem C transfer fire loss gC/m^2/s + 905 M_DEADSTEMC_TO_FIRE dead stem C fire loss gC/m^2/s + 906 M_DEADSTEMC_STORAGE_TO_FIRE dead stem C storage fire loss gC/m^2/s + 907 M_DEADSTEMC_XFER_TO_FIRE dead stem C transfer fire loss gC/m^2/s + 908 M_FROOTC_TO_FIRE fine root C fire loss gC/m^2/s + 909 M_FROOTC_STORAGE_TO_FIRE fine root C storage fire loss gC/m^2/s + 910 M_FROOTC_XFER_TO_FIRE fine root C transfer fire loss gC/m^2/s + 911 M_LIVEROOTC_TO_FIRE live root C fire loss gC/m^2/s + 912 M_LIVEROOTC_STORAGE_TO_FIRE live root C storage fire loss gC/m^2/s + 913 M_LIVEROOTC_XFER_TO_FIRE live root C transfer fire loss gC/m^2/s + 914 M_DEADROOTC_TO_FIRE dead root C fire loss gC/m^2/s + 915 M_DEADROOTC_STORAGE_TO_FIRE dead root C storage fire loss gC/m^2/s + 916 M_DEADROOTC_XFER_TO_FIRE dead root C transfer fire loss gC/m^2/s + 917 M_GRESP_STORAGE_TO_FIRE growth respiration storage fire loss gC/m^2/s + 918 M_GRESP_XFER_TO_FIRE growth respiration transfer fire loss gC/m^2/s + 919 M_LEAFC_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s + 920 M_LEAFC_STORAGE_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s + 921 M_LEAFC_XFER_TO_LITTER_FIRE leaf C transfer fire mortality to litter gC/m^2/s + 922 M_LIVESTEMC_TO_LITTER_FIRE live stem C fire mortality to litter gC/m^2/s + 923 M_LIVESTEMC_STORAGE_TO_LITTER_FIRE live stem C storage fire mortality to litter gC/m^2/s + 924 M_LIVESTEMC_XFER_TO_LITTER_FIRE live stem C transfer fire mortality to litter gC/m^2/s + 925 M_LIVESTEMC_TO_DEADSTEMC_FIRE live stem C fire mortality to dead stem C gC/m^2/s + 926 M_DEADSTEMC_TO_LITTER_FIRE dead stem C fire mortality to litter gC/m^2/s + 927 M_DEADSTEMC_STORAGE_TO_LITTER_FIRE dead stem C storage fire mortality to litter gC/m^2/s + 928 M_DEADSTEMC_XFER_TO_LITTER_FIRE dead stem C transfer fire mortality to litter gC/m^2/s + 929 M_FROOTC_TO_LITTER_FIRE fine root C fire mortality to litter gC/m^2/s + 930 M_FROOTC_STORAGE_TO_LITTER_FIRE fine root C storage fire mortality to litter gC/m^2/s + 931 M_FROOTC_XFER_TO_LITTER_FIRE fine root C transfer fire mortality to litter gC/m^2/s + 932 M_LIVEROOTC_TO_LITTER_FIRE live root C fire mortality to litter gC/m^2/s + 933 M_LIVEROOTC_STORAGE_TO_LITTER_FIRE live root C storage fire mortality to litter gC/m^2/s + 934 M_LIVEROOTC_XFER_TO_LITTER_FIRE live root C transfer fire mortality to litter gC/m^2/s + 935 M_LIVEROOTC_TO_DEADROOTC_FIRE live root C fire mortality to dead root C gC/m^2/s + 936 M_DEADROOTC_TO_LITTER_FIRE dead root C fire mortality to litter gC/m^2/s + 937 M_DEADROOTC_STORAGE_TO_LITTER_FIRE dead root C storage fire mortality to litter gC/m^2/s + 938 M_DEADROOTC_XFER_TO_LITTER_FIRE dead root C transfer fire mortality to litter gC/m^2/s + 939 M_LIVECROOTC_STORAGE_TO_LITTER_FIRE live coarse root C fire mortality to litter gC/m^2/s + 940 M_DEADCROOTC_STORAGE_TO_LITTER_FIRE dead coarse root C storage fire mortality to litter gC/m^2/s + 941 M_GRESP_STORAGE_TO_LITTER_FIRE growth respiration storage fire mortality to litter gC/m^2/s + 942 M_GRESP_XFER_TO_LITTER_FIRE growth respiration transfer fire mortality to litter gC/m^2/s + 943 LEAFC_XFER_TO_LEAFC leaf C growth from storage gC/m^2/s + 944 FROOTC_XFER_TO_FROOTC fine root C growth from storage gC/m^2/s + 945 LIVESTEMC_XFER_TO_LIVESTEMC live stem C growth from storage gC/m^2/s + 946 DEADSTEMC_XFER_TO_DEADSTEMC dead stem C growth from storage gC/m^2/s + 947 LIVECROOTC_XFER_TO_LIVECROOTC live coarse root C growth from storage gC/m^2/s + 948 DEADCROOTC_XFER_TO_DEADCROOTC dead coarse root C growth from storage gC/m^2/s + 949 LEAFC_TO_LITTER leaf C litterfall gC/m^2/s + 950 LEAFC_TO_LITTER_FUN leaf C litterfall used by FUN gC/m^2/s + 951 FROOTC_TO_LITTER fine root C litterfall gC/m^2/s + 952 EXCESSC_MR excess C maintenance respiration gC/m^2/s + 953 LEAF_MR leaf maintenance respiration gC/m^2/s + 954 FROOT_MR fine root maintenance respiration gC/m^2/s + 955 LIVESTEM_MR live stem maintenance respiration gC/m^2/s + 956 LIVECROOT_MR live coarse root maintenance respiration gC/m^2/s + 957 PSNSUN_TO_CPOOL C fixation from sunlit canopy gC/m^2/s + 958 PSNSHADE_TO_CPOOL C fixation from shaded canopy gC/m^2/s + 959 CPOOL_TO_LEAFC allocation to leaf C gC/m^2/s + 960 CPOOL_TO_LEAFC_STORAGE allocation to leaf C storage gC/m^2/s + 961 CPOOL_TO_FROOTC allocation to fine root C gC/m^2/s + 962 CPOOL_TO_FROOTC_STORAGE allocation to fine root C storage gC/m^2/s + 963 CPOOL_TO_LIVESTEMC allocation to live stem C gC/m^2/s + 964 CPOOL_TO_LIVESTEMC_STORAGE allocation to live stem C storage gC/m^2/s + 965 CPOOL_TO_DEADSTEMC allocation to dead stem C gC/m^2/s + 966 CPOOL_TO_DEADSTEMC_STORAGE allocation to dead stem C storage gC/m^2/s + 967 CPOOL_TO_LIVECROOTC allocation to live coarse root C gC/m^2/s + 968 CPOOL_TO_LIVECROOTC_STORAGE allocation to live coarse root C storage gC/m^2/s + 969 CPOOL_TO_DEADCROOTC allocation to dead coarse root C gC/m^2/s + 970 CPOOL_TO_DEADCROOTC_STORAGE allocation to dead coarse root C storage gC/m^2/s + 971 CPOOL_TO_GRESP_STORAGE allocation to growth respiration storage gC/m^2/s + 972 CPOOL_LEAF_GR leaf growth respiration gC/m^2/s + 973 CPOOL_LEAF_STORAGE_GR leaf growth respiration to storage gC/m^2/s + 974 TRANSFER_LEAF_GR leaf growth respiration from storage gC/m^2/s + 975 CPOOL_FROOT_GR fine root growth respiration gC/m^2/s + 976 CPOOL_FROOT_STORAGE_GR fine root growth respiration to storage gC/m^2/s + 977 TRANSFER_FROOT_GR fine root growth respiration from storage gC/m^2/s + 978 CPOOL_LIVESTEM_GR live stem growth respiration gC/m^2/s + 979 CPOOL_LIVESTEM_STORAGE_GR live stem growth respiration to storage gC/m^2/s + 980 TRANSFER_LIVESTEM_GR live stem growth respiration from storage gC/m^2/s + 981 CPOOL_DEADSTEM_GR dead stem growth respiration gC/m^2/s + 982 CPOOL_DEADSTEM_STORAGE_GR dead stem growth respiration to storage gC/m^2/s + 983 TRANSFER_DEADSTEM_GR dead stem growth respiration from storage gC/m^2/s + 984 CPOOL_LIVECROOT_GR live coarse root growth respiration gC/m^2/s + 985 CPOOL_LIVECROOT_STORAGE_GR live coarse root growth respiration to storage gC/m^2/s + 986 TRANSFER_LIVECROOT_GR live coarse root growth respiration from storage gC/m^2/s + 987 CPOOL_DEADCROOT_GR dead coarse root growth respiration gC/m^2/s + 988 CPOOL_DEADCROOT_STORAGE_GR dead coarse root growth respiration to storage gC/m^2/s + 989 TRANSFER_DEADCROOT_GR dead coarse root growth respiration from storage gC/m^2/s + 990 LEAFC_STORAGE_TO_XFER leaf C shift storage to transfer gC/m^2/s + 991 FROOTC_STORAGE_TO_XFER fine root C shift storage to transfer gC/m^2/s + 992 LIVESTEMC_STORAGE_TO_XFER live stem C shift storage to transfer gC/m^2/s + 993 DEADSTEMC_STORAGE_TO_XFER dead stem C shift storage to transfer gC/m^2/s + 994 LIVECROOTC_STORAGE_TO_XFER live coarse root C shift storage to transfer gC/m^2/s + 995 DEADCROOTC_STORAGE_TO_XFER dead coarse root C shift storage to transfer gC/m^2/s + 996 GRESP_STORAGE_TO_XFER growth respiration shift storage to transfer gC/m^2/s + 997 LIVESTEMC_TO_DEADSTEMC live stem C turnover gC/m^2/s + 998 LIVECROOTC_TO_DEADCROOTC live coarse root C turnover gC/m^2/s + 999 INIT_GPP GPP flux before downregulation gC/m^2/s +1000 CURRENT_GR growth resp for new growth displayed in this timestep gC/m^2/s +1001 TRANSFER_GR growth resp for transfer growth displayed in this timestep gC/m^2/s +1002 STORAGE_GR growth resp for growth sent to storage for later display gC/m^2/s +1003 AVAILC C flux available for allocation gC/m^2/s +1004 PLANT_CALLOC total allocated C flux gC/m^2/s +1005 EXCESS_CFLUX C flux not allocated due to downregulation gC/m^2/s +1006 PREV_LEAFC_TO_LITTER previous timestep leaf C litterfall flux gC/m^2/s +1007 PREV_FROOTC_TO_LITTER previous timestep froot C litterfall flux gC/m^2/s +1008 XSMRPOOL_RECOVER C flux assigned to recovery of negative xsmrpool gC/m^2/s +1009 GPP gross primary production gC/m^2/s +1010 RR root respiration (fine root MR + total root GR) gC/m^2/s +1011 MR maintenance respiration gC/m^2/s +1012 GR total growth respiration gC/m^2/s +1013 AR autotrophic respiration (MR + GR) gC/m^2/s +1014 NPP net primary production gC/m^2/s +1015 AGNPP aboveground NPP gC/m^2/s +1016 BGNPP belowground NPP gC/m^2/s +1017 LITFALL litterfall (leaves and fine roots) gC/m^2/s +1018 WOOD_HARVESTC wood harvest carbon (to product pools) gC/m^2/s +1019 SLASH_HARVESTC slash harvest carbon (to litter) gC/m^2/s +1020 PFT_FIRE_CLOSS total patch-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s +1021 NPP_NACTIVE Mycorrhizal N uptake used C gC/m^2/s +1022 NPP_BURNEDOFF C that cannot be used for N uptake gC/m^2/s +1023 NPP_NNONMYC Non-mycorrhizal N uptake used C gC/m^2/s +1024 NPP_NAM AM-associated N uptake used C gC/m^2/s +1025 NPP_NECM ECM-associated N uptake used C gC/m^2/s +1026 NPP_NACTIVE_NO3 Mycorrhizal N uptake used C gC/m^2/s +1027 NPP_NACTIVE_NH4 Mycorrhizal N uptake use C gC/m^2/s +1028 NPP_NNONMYC_NO3 Non-mycorrhizal N uptake use C gC/m^2/s +1029 NPP_NNONMYC_NH4 Non-mycorrhizal N uptake use C gC/m^2/s +1030 NPP_NAM_NO3 AM-associated N uptake use C gC/m^2/s +1031 NPP_NAM_NH4 AM-associated N uptake use C gC/m^2/s +1032 NPP_NECM_NO3 ECM-associated N uptake used C gC/m^2/s +1033 NPP_NECM_NH4 ECM-associated N uptake use C gC/m^2/s +1034 NPP_NFIX Symbiotic BNF uptake used C gC/m^2/s +1035 NPP_NRETRANS Retranslocated N uptake flux gC/m^2/s +1036 NPP_NUPTAKE Total C used by N uptake in FUN gC/m^2/s +1037 NPP_GROWTH Total C used for growth in FUN gC/m^2/s +1038 LEAFC_CHANGE C change in leaf gC/m^2/s +1039 SOILC_CHANGE C change in soil gC/m^2/s +1040 CWDC_LOSS coarse woody debris C loss gC/m^2/s +1041 M_LITR1C_TO_FIRE litter 1 C fire loss gC/m^2/s +1042 M_LITR1C_TO_FIRE_vr litter 1 C fire loss gC/m^3/s +1043 M_LITR2C_TO_FIRE litter 2 C fire loss gC/m^2/s +1044 M_LITR2C_TO_FIRE_vr litter 2 C fire loss gC/m^3/s +1045 M_LITR3C_TO_FIRE litter 3 C fire loss gC/m^2/s +1046 M_LITR3C_TO_FIRE_vr litter 3 C fire loss gC/m^3/s +1047 M_CWDC_TO_FIRE coarse woody debris C fire loss gC/m^2/s +1048 M_CWDC_TO_FIRE_vr coarse woody debris C fire loss gC/m^3/s +1049 DWT_SEEDC_TO_LEAF seed source to patch-level leaf gC/m^2/s +1050 DWT_SEEDC_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gC/m^2/s +1051 DWT_SEEDC_TO_DEADSTEM seed source to patch-level deadstem gC/m^2/s +1052 DWT_SEEDC_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gC/m^2/s +1053 DWT_CONV_CFLUX conversion C flux (immediate loss to atm) (0 at all times except first timestep of year) gC/m^2/s +1054 DWT_CONV_CFLUX_PATCH patch-level conversion C flux (immediate loss to atm) (0 at all times except first timestep of gC/m^2/s +1055 DWT_CONV_CFLUX_DRIBBLED conversion C flux (immediate loss to atm), dribbled throughout the year gC/m^2/s +1056 DWT_WOOD_PRODUCTC_GAIN_PATCH patch-level landcover change-driven addition to wood product pools(0 at all times except first gC/m^2/s +1057 DWT_SLASH_CFLUX slash C flux (to litter diagnostic only) (0 at all times except first timestep of year) gC/m^2/s +1058 DWT_SLASH_CFLUX_PATCH patch-level slash C flux (to litter diagnostic only) (0 at all times except first timestep of gC/m^2/s +1059 DWT_FROOTC_TO_LITR_MET_C fine root to litter due to landcover change gC/m^2/s +1060 DWT_FROOTC_TO_LITR_CEL_C fine root to litter due to landcover change gC/m^2/s +1061 DWT_FROOTC_TO_LITR_LIG_C fine root to litter due to landcover change gC/m^2/s +1062 DWT_LIVECROOTC_TO_CWDC live coarse root to CWD due to landcover change gC/m^2/s +1063 DWT_DEADCROOTC_TO_CWDC dead coarse root to CWD due to landcover change gC/m^2/s +1064 CROP_SEEDC_TO_LEAF crop seed source to leaf gC/m^2/s +1065 SR total soil respiration (HR + root resp) gC/m^2/s +1066 ER total ecosystem respiration, autotrophic + heterotrophic gC/m^2/s +1067 LITFIRE litter fire losses gC/m^2/s +1068 SOMFIRE soil organic matter fire losses gC/m^2/s +1069 TOTFIRE total ecosystem fire losses gC/m^2/s +1070 COL_FIRE_CLOSS total column-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s +1071 ANNSUM_NPP annual sum of NPP gC/m^2/yr +1072 CANNSUM_NPP annual sum of column-level NPP gC/m^2/s +1073 NEP net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink gC/m^2/s +1074 NBP net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux (latter smoothed o gC/m^2/s +1075 NEE net ecosystem exchange of carbon, includes fire and hrv_xsmrpool (latter smoothed over the yea gC/m^2/s +1076 LAND_USE_FLUX total C emitted from land cover conversion (smoothed over the year) and wood and grain product gC/m^2/s +1077 GRAINN grain N gN/m^2 +1078 CROPSEEDN_DEFICIT N used for crop seed that needs to be repaid gN/m^2 +1079 LEAFN leaf N gN/m^2 +1080 LEAFN_STORAGE leaf N storage gN/m^2 +1081 LEAFN_XFER leaf N transfer gN/m^2 +1082 LEAFN_STORAGE_XFER_ACC Accmulated leaf N transfer gN/m^2 +1083 STORAGE_NDEMAND N demand during the offset period gN/m^2 +1084 FROOTN fine root N gN/m^2 +1085 FROOTN_STORAGE fine root N storage gN/m^2 +1086 FROOTN_XFER fine root N transfer gN/m^2 +1087 LIVESTEMN live stem N gN/m^2 +1088 LIVESTEMN_STORAGE live stem N storage gN/m^2 +1089 LIVESTEMN_XFER live stem N transfer gN/m^2 +1090 DEADSTEMN dead stem N gN/m^2 +1091 DEADSTEMN_STORAGE dead stem N storage gN/m^2 +1092 DEADSTEMN_XFER dead stem N transfer gN/m^2 +1093 LIVECROOTN live coarse root N gN/m^2 +1094 LIVECROOTN_STORAGE live coarse root N storage gN/m^2 +1095 LIVECROOTN_XFER live coarse root N transfer gN/m^2 +1096 DEADCROOTN dead coarse root N gN/m^2 +1097 DEADCROOTN_STORAGE dead coarse root N storage gN/m^2 +1098 DEADCROOTN_XFER dead coarse root N transfer gN/m^2 +1099 RETRANSN plant pool of retranslocated N gN/m^2 +1100 NPOOL temporary plant N pool gN/m^2 +1101 PFT_NTRUNC patch-level sink for N truncation gN/m^2 +1102 DISPVEGN displayed vegetation nitrogen gN/m^2 +1103 STORVEGN stored vegetation nitrogen gN/m^2 +1104 TOTVEGN total vegetation nitrogen gN/m^2 +1105 TOTPFTN total patch-level nitrogen gN/m^2 +1106 SEEDN pool for seeding new PFTs via dynamic landcover gN/m^2 +1107 TOTECOSYSN total ecosystem N, excluding product pools gN/m^2 +1108 TOTCOLN total column-level N, excluding product pools gN/m^2 +1109 M_LEAFN_TO_LITTER leaf N mortality gN/m^2/s +1110 M_FROOTN_TO_LITTER fine root N mortality gN/m^2/s +1111 M_LEAFN_STORAGE_TO_LITTER leaf N storage mortality gN/m^2/s +1112 M_FROOTN_STORAGE_TO_LITTER fine root N storage mortality gN/m^2/s +1113 M_LIVESTEMN_STORAGE_TO_LITTER live stem N storage mortality gN/m^2/s +1114 M_DEADSTEMN_STORAGE_TO_LITTER dead stem N storage mortality gN/m^2/s +1115 M_LIVECROOTN_STORAGE_TO_LITTER live coarse root N storage mortality gN/m^2/s +1116 M_DEADCROOTN_STORAGE_TO_LITTER dead coarse root N storage mortality gN/m^2/s +1117 M_LEAFN_XFER_TO_LITTER leaf N transfer mortality gN/m^2/s +1118 M_FROOTN_XFER_TO_LITTER fine root N transfer mortality gN/m^2/s +1119 M_LIVESTEMN_XFER_TO_LITTER live stem N transfer mortality gN/m^2/s +1120 M_DEADSTEMN_XFER_TO_LITTER dead stem N transfer mortality gN/m^2/s +1121 M_LIVECROOTN_XFER_TO_LITTER live coarse root N transfer mortality gN/m^2/s +1122 M_DEADCROOTN_XFER_TO_LITTER dead coarse root N transfer mortality gN/m^2/s +1123 M_LIVESTEMN_TO_LITTER live stem N mortality gN/m^2/s +1124 M_DEADSTEMN_TO_LITTER dead stem N mortality gN/m^2/s +1125 M_LIVECROOTN_TO_LITTER live coarse root N mortality gN/m^2/s +1126 M_DEADCROOTN_TO_LITTER dead coarse root N mortality gN/m^2/s +1127 M_RETRANSN_TO_LITTER retranslocated N pool mortality gN/m^2/s +1128 M_LEAFN_TO_FIRE leaf N fire loss gN/m^2/s +1129 M_FROOTN_TO_FIRE fine root N fire loss gN/m^2/s +1130 M_LEAFN_STORAGE_TO_FIRE leaf N storage fire loss gN/m^2/s +1131 M_FROOTN_STORAGE_TO_FIRE fine root N storage fire loss gN/m^2/s +1132 M_LIVESTEMN_STORAGE_TO_FIRE live stem N storage fire loss gN/m^2/s +1133 M_DEADSTEMN_STORAGE_TO_FIRE dead stem N storage fire loss gN/m^2/s +1134 M_LIVECROOTN_STORAGE_TO_FIRE live coarse root N storage fire loss gN/m^2/s +1135 M_DEADCROOTN_STORAGE_TO_FIRE dead coarse root N storage fire loss gN/m^2/s +1136 M_LEAFN_XFER_TO_FIRE leaf N transfer fire loss gN/m^2/s +1137 M_FROOTN_XFER_TO_FIRE fine root N transfer fire loss gN/m^2/s +1138 M_LIVESTEMN_XFER_TO_FIRE live stem N transfer fire loss gN/m^2/s +1139 M_DEADSTEMN_XFER_TO_FIRE dead stem N transfer fire loss gN/m^2/s +1140 M_LIVECROOTN_XFER_TO_FIRE live coarse root N transfer fire loss gN/m^2/s +1141 M_DEADCROOTN_XFER_TO_FIRE dead coarse root N transfer fire loss gN/m^2/s +1142 M_LIVESTEMN_TO_FIRE live stem N fire loss gN/m^2/s +1143 M_DEADSTEMN_TO_FIRE dead stem N fire loss gN/m^2/s +1144 M_DEADSTEMN_TO_LITTER_FIRE dead stem N fire mortality to litter gN/m^2/s +1145 M_LIVECROOTN_TO_FIRE live coarse root N fire loss gN/m^2/s +1146 M_DEADCROOTN_TO_FIRE dead coarse root N fire loss gN/m^2/s +1147 M_DEADCROOTN_TO_LITTER_FIRE dead coarse root N fire mortality to litter gN/m^2/s +1148 M_RETRANSN_TO_FIRE retranslocated N pool fire loss gN/m^2/s +1149 LEAFN_XFER_TO_LEAFN leaf N growth from storage gN/m^2/s +1150 FROOTN_XFER_TO_FROOTN fine root N growth from storage gN/m^2/s +1151 LIVESTEMN_XFER_TO_LIVESTEMN live stem N growth from storage gN/m^2/s +1152 DEADSTEMN_XFER_TO_DEADSTEMN dead stem N growth from storage gN/m^2/s +1153 LIVECROOTN_XFER_TO_LIVECROOTN live coarse root N growth from storage gN/m^2/s +1154 DEADCROOTN_XFER_TO_DEADCROOTN dead coarse root N growth from storage gN/m^2/s +1155 LEAFN_TO_LITTER leaf N litterfall gN/m^2/s +1156 LEAFN_TO_RETRANSN leaf N to retranslocated N pool gN/m^2/s +1157 FROOTN_TO_LITTER fine root N litterfall gN/m^2/s +1158 RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s +1159 FREE_RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s +1160 SMINN_TO_NPOOL deployment of soil mineral N uptake gN/m^2/s +1161 NPOOL_TO_LEAFN allocation to leaf N gN/m^2/s +1162 NPOOL_TO_LEAFN_STORAGE allocation to leaf N storage gN/m^2/s +1163 NPOOL_TO_FROOTN allocation to fine root N gN/m^2/s +1164 NPOOL_TO_FROOTN_STORAGE allocation to fine root N storage gN/m^2/s +1165 NPOOL_TO_LIVESTEMN allocation to live stem N gN/m^2/s +1166 NPOOL_TO_LIVESTEMN_STORAGE allocation to live stem N storage gN/m^2/s +1167 NPOOL_TO_DEADSTEMN allocation to dead stem N gN/m^2/s +1168 NPOOL_TO_DEADSTEMN_STORAGE allocation to dead stem N storage gN/m^2/s +1169 NPOOL_TO_LIVECROOTN allocation to live coarse root N gN/m^2/s +1170 NPOOL_TO_LIVECROOTN_STORAGE allocation to live coarse root N storage gN/m^2/s +1171 NPOOL_TO_DEADCROOTN allocation to dead coarse root N gN/m^2/s +1172 NPOOL_TO_DEADCROOTN_STORAGE allocation to dead coarse root N storage gN/m^2/s +1173 LEAFN_STORAGE_TO_XFER leaf N shift storage to transfer gN/m^2/s +1174 FROOTN_STORAGE_TO_XFER fine root N shift storage to transfer gN/m^2/s +1175 LIVESTEMN_STORAGE_TO_XFER live stem N shift storage to transfer gN/m^2/s +1176 DEADSTEMN_STORAGE_TO_XFER dead stem N shift storage to transfer gN/m^2/s +1177 LIVECROOTN_STORAGE_TO_XFER live coarse root N shift storage to transfer gN/m^2/s +1178 DEADCROOTN_STORAGE_TO_XFER dead coarse root N shift storage to transfer gN/m^2/s +1179 LIVESTEMN_TO_DEADSTEMN live stem N turnover gN/m^2/s +1180 LIVESTEMN_TO_RETRANSN live stem N to retranslocated N pool gN/m^2/s +1181 LIVECROOTN_TO_DEADCROOTN live coarse root N turnover gN/m^2/s +1182 LIVECROOTN_TO_RETRANSN live coarse root N to retranslocated N pool gN/m^2/s +1183 NDEPLOY total N deployed in new growth gN/m^2/s +1184 WOOD_HARVESTN wood harvest N (to product pools) gN/m^2/s +1185 PFT_FIRE_NLOSS total patch-level fire N loss gN/m^2/s +1186 NFERTILIZATION fertilizer added gN/m^2/s +1187 FERT_COUNTER time left to fertilize seconds +1188 M_LITR1N_TO_FIRE litter 1 N fire loss gN/m^2 +1189 M_LITR1N_TO_FIRE_vr litter 1 N fire loss gN/m^3 +1190 M_LITR2N_TO_FIRE litter 2 N fire loss gN/m^2 +1191 M_LITR2N_TO_FIRE_vr litter 2 N fire loss gN/m^3 +1192 M_LITR3N_TO_FIRE litter 3 N fire loss gN/m^2 +1193 M_LITR3N_TO_FIRE_vr litter 3 N fire loss gN/m^3 +1194 M_CWDN_TO_FIRE coarse woody debris N fire loss gN/m^2 +1195 M_CWDN_TO_FIRE_vr coarse woody debris N fire loss gN/m^3 +1196 COL_FIRE_NLOSS total column-level fire N loss gN/m^2/s +1197 DWT_SEEDN_TO_LEAF seed source to patch-level leaf gN/m^2/s +1198 DWT_SEEDN_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gN/m^2/s +1199 DWT_SEEDN_TO_DEADSTEM seed source to patch-level deadstem gN/m^2/s +1200 DWT_SEEDN_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gN/m^2/s +1201 DWT_CONV_NFLUX conversion N flux (immediate loss to atm) (0 at all times except first timestep of year) gN/m^2/s +1202 DWT_CONV_NFLUX_PATCH patch-level conversion N flux (immediate loss to atm) (0 at all times except first timestep of gN/m^2/s +1203 DWT_FROOTN_TO_LITR_MET_N fine root to litter due to landcover change gN/m^2/s +1204 DWT_FROOTN_TO_LITR_CEL_N fine root to litter due to landcover change gN/m^2/s +1205 DWT_FROOTN_TO_LITR_LIG_N fine root to litter due to landcover change gN/m^2/s +1206 DWT_LIVECROOTN_TO_CWDN live coarse root to CWD due to landcover change gN/m^2/s +1207 DWT_DEADCROOTN_TO_CWDN dead coarse root to CWD due to landcover change gN/m^2/s +1208 CROP_SEEDN_TO_LEAF crop seed source to leaf gN/m^2/s +1209 PLANT_NDEMAND N flux required to support initial GPP gN/m^2/s +1210 AVAIL_RETRANSN N flux available from retranslocation pool gN/m^2/s +1211 PLANT_NALLOC total allocated N flux gN/m^2/s +1212 NACTIVE Mycorrhizal N uptake flux gN/m^2/s +1213 NNONMYC Non-mycorrhizal N uptake flux gN/m^2/s +1214 NAM AM-associated N uptake flux gN/m^2/s +1215 NECM ECM-associated N uptake flux gN/m^2/s +1216 NACTIVE_NO3 Mycorrhizal N uptake flux gN/m^2/s +1217 NACTIVE_NH4 Mycorrhizal N uptake flux gN/m^2/s +1218 NNONMYC_NO3 Non-mycorrhizal N uptake flux gN/m^2/s +1219 NNONMYC_NH4 Non-mycorrhizal N uptake flux gN/m^2/s +1220 NAM_NO3 AM-associated N uptake flux gN/m^2/s +1221 NAM_NH4 AM-associated N uptake flux gN/m^2/s +1222 NECM_NO3 ECM-associated N uptake flux gN/m^2/s +1223 NECM_NH4 ECM-associated N uptake flux gN/m^2/s +1224 NPASSIVE Passive N uptake flux gN/m^2/s +1225 NFIX Symbiotic BNF uptake flux gN/m^2/s +1226 NRETRANS Retranslocated N uptake flux gN/m^2/s +1227 NRETRANS_REG Retranslocated N uptake flux gN/m^2/s +1228 NRETRANS_SEASON Retranslocated N uptake flux gN/m^2/s +1229 NRETRANS_STRESS Retranslocated N uptake flux gN/m^2/s +1230 NUPTAKE Total N uptake of FUN gN/m^2/s +1231 SMINN_TO_PLANT_FUN Total soil N uptake of FUN gN/m^2/s +1232 COST_NFIX Cost of fixation gN/gC +1233 COST_NACTIVE Cost of active uptake gN/gC +1234 COST_NRETRANS Cost of retranslocation gN/gC +1235 NUPTAKE_NPP_FRACTION frac of NPP used in N uptake - +1236 CROPPROD1C 1-yr crop product (grain+biofuel) C gC/m^2 +1237 PROD10C 10-yr wood product C gC/m^2 +1238 PROD100C 100-yr wood product C gC/m^2 +1239 TOT_WOODPRODC total wood product C gC/m^2 +1240 DWT_PROD10C_GAIN landcover change-driven addition to 10-yr wood product pool gC/m^2/s +1241 DWT_PROD100C_GAIN landcover change-driven addition to 100-yr wood product pool gC/m^2/s +1242 DWT_WOODPRODC_GAIN landcover change-driven addition to wood product pools gC/m^2/s +1243 DWT_CROPPROD1C_GAIN landcover change-driven addition to 1-year crop product pool gC/m^2/s +1244 CROPPROD1C_LOSS loss from 1-yr crop product pool gC/m^2/s +1245 PROD10C_LOSS loss from 10-yr wood product pool gC/m^2/s +1246 PROD100C_LOSS loss from 100-yr wood product pool gC/m^2/s +1247 TOT_WOODPRODC_LOSS total loss from wood product pools gC/m^2/s +1248 CROPPROD1N 1-yr crop product (grain+biofuel) N gN/m^2 +1249 PROD10N 10-yr wood product N gN/m^2 +1250 PROD100N 100-yr wood product N gN/m^2 +1251 TOT_WOODPRODN total wood product N gN/m^2 +1252 DWT_PROD10N_GAIN landcover change-driven addition to 10-yr wood product pool gN/m^2/s +1253 DWT_PROD100N_GAIN landcover change-driven addition to 100-yr wood product pool gN/m^2/s +1254 DWT_WOODPRODN_GAIN landcover change-driven addition to wood product pools gN/m^2/s +1255 DWT_CROPPROD1N_GAIN landcover change-driven addition to 1-year crop product pool gN/m^2/s +1256 CROPPROD1N_LOSS loss from 1-yr crop product pool gN/m^2/s +1257 PROD10N_LOSS loss from 10-yr wood product pool gN/m^2/s +1258 PROD100N_LOSS loss from 100-yr wood product pool gN/m^2/s +1259 TOT_WOODPRODN_LOSS total loss from wood product pools gN/m^2/s +1260 FERTNITRO Nitrogen fertilizer for each crop gN/m2/yr +1261 GDDPLANT Accumulated growing degree days past planting date for crop ddays +1262 GDDTSOI Growing degree-days from planting (top two soil layers) ddays +1263 CPHASE crop phenology phase 0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest +1264 LATBASET latitude vary base temperature for gddplant degree C +==== ======================================= ============================================================================================== ================================================================= diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 7f70210985..9889c13960 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -335,7 +335,9 @@ subroutine hist_printflds() ! Print master field list in separate file if namelist variable ! requests it if (masterproc .and. hist_master_list_file) then - ! hardwired table column widths + ! hardwired table column widths to fit table on a computer + ! screen; TODO test whether text will wrap around in available + ! space in sphinx width_col_1 = 4 ! column that shows the variable number, nf width_col_2 = 39 ! variable name column width_col_3 = 94 ! long description column From 4a736e890d5ce5a6b3216d5a80b1d10f42f2a8f6 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Nov 2020 19:50:40 -0700 Subject: [PATCH 1619/1973] Add point of interest code for debugging Copied from https://github.com/billsacks/ctsm-debugging-aids Resolves ESCOMP/CTSM#1210 --- src/utils/point_of_interest.F90 | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/utils/point_of_interest.F90 diff --git a/src/utils/point_of_interest.F90 b/src/utils/point_of_interest.F90 new file mode 100644 index 0000000000..558b7acbb6 --- /dev/null +++ b/src/utils/point_of_interest.F90 @@ -0,0 +1,64 @@ +! This module contains logical functions to find point(s) of interest in CLM. +! Note the abbreviation: p.o.i = point of interest + +! Its typical use will be something like: +! if (poi_c(c)) then +! write(iulog,*) ... + +! Look for comments about "customize" to see what to customize. + +module point_of_interest + + use GridcellType, only : grc + use LandunitType, only : lun + use ColumnType, only : col + use shr_kind_mod , only : r8 => shr_kind_r8 + + implicit none + save + private + + ! Customize: can define other levels like poi_p, etc. + public :: poi_c + +contains + + logical function poi_c(c) + integer, intent(in) :: c + + integer :: g, l + + g = col%gridcell(c) + l = col%landunit(c) + + poi_c = .false. + + ! Customize this conditional + if (at_poi(g) .and. lun%itype(l) == 1) then + poi_c = .true. + end if + + end function poi_c + + + + logical function at_poi(g) + integer, intent(in) :: g + + ! Customize these parameters (adding more blocks if necessary) + real(r8), parameter :: poi_lon = 237.5_r8 + real(r8), parameter :: poi_lat = -72.94737_r8 + + real(r8), parameter :: poi_tol = 0.01_r8 ! tolerance on check of lat/lon + + + if ( abs(grc%londeg(g) - poi_lon) < poi_tol .and. & + abs(grc%latdeg(g) - poi_lat) < poi_tol) then + at_poi = .true. + else + at_poi = .false. + end if + + end function at_poi + +end module point_of_interest From dc4ca72a737b1ec8c699057377bbc80502e11804 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 11 Nov 2020 20:02:55 -0700 Subject: [PATCH 1620/1973] Add comments to point of interest code --- src/utils/point_of_interest.F90 | 59 ++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/src/utils/point_of_interest.F90 b/src/utils/point_of_interest.F90 index 558b7acbb6..363f9dc687 100644 --- a/src/utils/point_of_interest.F90 +++ b/src/utils/point_of_interest.F90 @@ -1,19 +1,41 @@ -! This module contains logical functions to find point(s) of interest in CLM. -! Note the abbreviation: p.o.i = point of interest - -! Its typical use will be something like: -! if (poi_c(c)) then -! write(iulog,*) ... - -! Look for comments about "customize" to see what to customize. - module point_of_interest + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! This module contains logical functions to find point(s) of interest in CTSM. Note the + ! abbreviation: p.o.i = point of interest. + ! + ! The idea is: It is common, when debugging, to want to print the values of various + ! variables for all patches or columns of certain landunit types within a certain grid + ! cell of interest. This module helps create the logical functions needed to do this. + ! + ! This module is compiled into every CTSM build, but is not invoked by default. To use + ! it: + ! + ! (1) Customize the code here by changing the functions below and/or adding new + ! functions. Look for comments about "customize" to see what to customize. + ! + ! (2) Add calls in the code + ! + ! Its typical use will be something like: + ! + ! do fc = 1, num_nolakec + ! c = filter_nolakec(fc) + ! + ! ! Various code here, maybe setting foo and bar variables + ! + ! if (poi_c(c)) then + ! write(iulog,*) 'DEBUG: foo, bar = ', foo(c), bar(c) + ! end if + ! end do + ! + ! !USES: use GridcellType, only : grc use LandunitType, only : lun use ColumnType, only : col use shr_kind_mod , only : r8 => shr_kind_r8 - + use landunit_varcon, only : istsoil + implicit none save private @@ -23,34 +45,39 @@ module point_of_interest contains + !----------------------------------------------------------------------- logical function poi_c(c) + ! This function can be used in a column-level loop to find columns with a given + ! landunit type(s) within the grid cell(s) of interest. integer, intent(in) :: c integer :: g, l + !----------------------------------------------------------------------- g = col%gridcell(c) l = col%landunit(c) poi_c = .false. - ! Customize this conditional - if (at_poi(g) .and. lun%itype(l) == 1) then + ! Customize this conditional; it is currently set up to flag columns in the natural + ! vegetated landunit (istsoil) of the target grid cell(s). + if (at_poi(g) .and. lun%itype(l) == istsoil) then poi_c = .true. end if end function poi_c - - + !----------------------------------------------------------------------- logical function at_poi(g) integer, intent(in) :: g - ! Customize these parameters (adding more blocks if necessary) + ! Customize these parameters (adding more blocks if necessary). These give the + ! longitude and latitude of the grid cell of interest. real(r8), parameter :: poi_lon = 237.5_r8 real(r8), parameter :: poi_lat = -72.94737_r8 real(r8), parameter :: poi_tol = 0.01_r8 ! tolerance on check of lat/lon - + !----------------------------------------------------------------------- if ( abs(grc%londeg(g) - poi_lon) < poi_tol .and. & abs(grc%latdeg(g) - poi_lat) < poi_tol) then From c623915109128417e1c15a6c3c2ecd4bfe239a89 Mon Sep 17 00:00:00 2001 From: Sunniva Indrehus Date: Thu, 12 Nov 2020 09:30:12 +0100 Subject: [PATCH 1621/1973] Updated the function call for broadcasting bytes in the file CTSM/src/main/controlMod.F90 l804 (pointed out by @olyson and @billsacks) ESCMP/CTSM#1191: call mpi_bcast (hist_avgflag_pertape, size(hist_avgflag_pertape), MPI_CHARACTER, 0, mpicom, ier) --> call mpi_bcast (hist_avgflag_pertape, len(hist_avgflag_pertape)*size(hist_avgflag_pertape), MPI_CHARACTER, 0, mpicom, ier) mpi_bcast should be replaced with shr_mpi_bcast in the whole suproutine in the future. --- src/main/controlMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 55bbd43d75..b6407435eb 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -801,7 +801,7 @@ subroutine control_spmd() call mpi_bcast (hist_nhtfrq, size(hist_nhtfrq), MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (hist_mfilt, size(hist_mfilt), MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (hist_ndens, size(hist_ndens), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_avgflag_pertape, size(hist_avgflag_pertape), MPI_CHARACTER, 0, mpicom, ier) + call mpi_bcast (hist_avgflag_pertape, len(hist_avgflag_pertape)*size(hist_avgflag_pertape), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (hist_type1d_pertape, max_namlen*size(hist_type1d_pertape), MPI_CHARACTER, 0, mpicom, ier) if (use_lch4) then call mpi_bcast (hist_wrtch4diag, 1, MPI_LOGICAL, 0, mpicom, ier) From 06246f97d5c62dfa3163cc3f72cf52558e57c3e8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 12 Nov 2020 15:06:37 -0700 Subject: [PATCH 1622/1973] Fix invalid xml Resolves ESCOMP/CTSM#1159 --- bld/namelist_files/namelist_definition_ctsm.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index be5959d6bf..455d7015e3 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1109,37 +1109,37 @@ If true, this directs the model to collapse the urban landunits to the dominant Percentage threshold above which the model keeps the soil landunit. Selecting the value 0 means DO NOTHING. Default: 0 Percentage threshold above which the model keeps the crop landunit. Selecting the value 0 means DO NOTHING. Default: 0 Percentage threshold above which the model keeps the glacier landunit. Selecting the value 0 means DO NOTHING. Default: 0 Percentage threshold above which the model keeps the lake landunit. Selecting the value 0 means DO NOTHING. Default: 0 Percentage threshold above which the model keeps the wetland landunit. Selecting the value 0 means DO NOTHING. Default: 0 Percentage threshold above which the model keeps the urban landunits. Selecting the value 0 means DO NOTHING. If collapse_urban = .false., the same threshold will apply to all three urban landunits if they are present. If collapse_urban = .true., this threshold will apply to the single collapsed urban landunit if presnet. Default: 0 From 5f26ef833ac566c93fe5c0e439cba48551923f5b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 12 Nov 2020 15:50:33 -0700 Subject: [PATCH 1623/1973] Add mizuRoute external (Copied from previous addition from @ekluzek) --- Externals.cfg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Externals.cfg b/Externals.cfg index c021a25771..d1f7704306 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -26,6 +26,13 @@ repo_url = https://github.com/ESCOMP/MOSART tag = mosart1_0_38 required = True +[mizuRoute] +local_path = components/mizuRoute +protocol = git +repo_url = https://github.com/nmizukami/mizuRoute +hash = 34723c2 +required = True + [cdeps] hash = 45b7a85 protocol = git From 090f2e34310d3582e1cff91791bb502a196f13c2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 12 Nov 2020 16:34:30 -0700 Subject: [PATCH 1624/1973] Change shr_pio_getiotype to use 'LND' rather than inst_name Same as what was done in f5de7e42e (changes to CNFireBaseMod.F90 are now needed in FireDataBaseType.f90) --- src/main/FireDataBaseType.F90 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/FireDataBaseType.F90 b/src/main/FireDataBaseType.F90 index 5f3edc529b..1e02033c95 100644 --- a/src/main/FireDataBaseType.F90 +++ b/src/main/FireDataBaseType.F90 @@ -147,7 +147,6 @@ subroutine hdm_init( this, bounds, NLFilename ) ! Initialize data stream information for population density. ! ! !USES: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -225,7 +224,7 @@ subroutine hdm_init( this, bounds, NLFilename ) call shr_strdata_create(this%sdat_hdm,name="clmhdm", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -304,7 +303,6 @@ subroutine lnfm_init( this, bounds, NLFilename ) ! Initialize data stream information for Lightning. ! ! !USES: - use clm_varctl , only : inst_name use clm_time_manager , only : get_calendar use ncdio_pio , only : pio_subsystem use shr_pio_mod , only : shr_pio_getiotype @@ -382,7 +380,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) call shr_strdata_create(this%sdat_lnfm,name="clmlnfm", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & + pio_iotype=shr_pio_getiotype('LND'), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & From 17b929b3c423cea405af41106ae8093dafd32d37 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 12 Nov 2020 17:12:29 -0700 Subject: [PATCH 1625/1973] Restore histFileMod to how it is on master The changes in histFileMod on this branch came from https://github.com/ESCOMP/CTSM/pull/1085, but we ended up redoing that PR in a different way. --- src/main/histFileMod.F90 | 214 +++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 0115499e41..8e6be4a571 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2774,102 +2774,103 @@ subroutine htape_timeconst(t, mode) !*** Grid definition variables *** !------------------------------------------------------------------------------- ! For define mode -- only do this for first time-sample - if(tape(t)%ntimes == 1) then - if (mode == 'define') then + if (mode == 'define' .and. tape(t)%ntimes == 1) then - if (ldomain%isgrid2d) then - call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, dim1name='lon', & - long_name='coordinate longitude', units='degrees_east', & - ncid=nfid(t), missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='coordinate longitude', units='degrees_east', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, dim1name='lat', & - long_name='coordinate latitude', units='degrees_north', & - ncid=nfid(t), missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='coordinate latitude', units='degrees_north', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & - dim1name='lon', dim2name='lat',& - long_name='grid cell areas', units='km^2', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='grid cell areas', units='km^2', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & - dim1name='lon', dim2name='lat', & - long_name='land fraction', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='land fraction', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='landmask', xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='landmask', xtype=ncd_int, & - dim1name=grlnd, & - long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='index of shallowest bedrock layer', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='index of shallowest bedrock layer', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, dim1name='lon', & + long_name='coordinate longitude', units='degrees_east', & + ncid=nfid(t), missing_value=spval, fill_value=spval) + else + call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, & + dim1name=grlnd, & + long_name='coordinate longitude', units='degrees_east', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, dim1name='lat', & + long_name='coordinate latitude', units='degrees_north', & + ncid=nfid(t), missing_value=spval, fill_value=spval) + else + call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, & + dim1name=grlnd, & + long_name='coordinate latitude', units='degrees_north', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & + dim1name='lon', dim2name='lat',& + long_name='grid cell areas', units='km^2', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + else + call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & + dim1name=grlnd, & + long_name='grid cell areas', units='km^2', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & + dim1name='lon', dim2name='lat', & + long_name='land fraction', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + else + call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & + dim1name=grlnd, & + long_name='land fraction', ncid=nfid(t), & + missing_value=spval, fill_value=spval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='landmask', xtype=ncd_int, & + dim1name='lon', dim2name='lat', & + long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + else + call ncd_defvar(varname='landmask', xtype=ncd_int, & + dim1name=grlnd, & + long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='pftmask' , xtype=ncd_int, & + dim1name='lon', dim2name='lat', & + long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + else + call ncd_defvar(varname='pftmask' , xtype=ncd_int, & + dim1name=grlnd, & + long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + end if + if (ldomain%isgrid2d) then + call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & + dim1name='lon', dim2name='lat', & + long_name='index of shallowest bedrock layer', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + else + call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & + dim1name=grlnd, & + long_name='index of shallowest bedrock layer', ncid=nfid(t), & + imissing_value=ispval, ifill_value=ispval) + end if - else if (mode == 'write') then + else if (mode == 'write') then - if (ldomain%isgrid2d) then - call ncd_io(varname='lon', data=lon1d, ncid=nfid(t), flag='write') - call ncd_io(varname='lat', data=lat1d, ncid=nfid(t), flag='write') - else - call ncd_io(varname='lon', data=ldomain%lonc, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='lat', data=ldomain%latc, dim1name=grlnd, ncid=nfid(t), flag='write') - end if - call ncd_io(varname='area' , data=ldomain%area, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='landfrac', data=ldomain%frac, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='landmask', data=ldomain%mask, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='pftmask' , data=ldomain%pftm, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='nbedrock' , data=grc%nbedrock, dim1name=grlnd, ncid=nfid(t), flag='write') + ! Most of this is constant and only needs to be done on tape(t)%ntimes=1 + ! But, some may change for dynamic PATCH mode for example - end if ! (define/write mode - endif + if (ldomain%isgrid2d) then + call ncd_io(varname='lon', data=lon1d, ncid=nfid(t), flag='write') + call ncd_io(varname='lat', data=lat1d, ncid=nfid(t), flag='write') + else + call ncd_io(varname='lon', data=ldomain%lonc, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='lat', data=ldomain%latc, dim1name=grlnd, ncid=nfid(t), flag='write') + end if + call ncd_io(varname='area' , data=ldomain%area, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='landfrac', data=ldomain%frac, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='landmask', data=ldomain%mask, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='pftmask' , data=ldomain%pftm, dim1name=grlnd, ncid=nfid(t), flag='write') + call ncd_io(varname='nbedrock' , data=grc%nbedrock, dim1name=grlnd, ncid=nfid(t), flag='write') + + end if ! (define/write mode end subroutine htape_timeconst @@ -2916,7 +2917,7 @@ subroutine hfields_write(t, mode) ! Write/define 1d topological info - if (.not. tape(t)%dov2xy .and. tape(t)%ntimes==1) then + if (.not. tape(t)%dov2xy) then if (mode == 'define') then call hfields_1dinfo(t, mode='define') else if (mode == 'write') then @@ -3494,16 +3495,15 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & endif call t_startf('hist_htapes_wrapup_tconst') - ! Write time constant history variables (not all are time constant!) + ! Write time constant history variables call htape_timeconst(t, mode='write') - if (tape(t)%ntimes == 1) then - ! Write 3D time constant history variables to first history tapes - if ( do_3Dtconst )then - call htape_timeconst3D(t, & - bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='write') - do_3Dtconst = .false. - end if - endif + + ! Write 3D time constant history variables to first history tapes + if ( do_3Dtconst .and. tape(t)%ntimes == 1 )then + call htape_timeconst3D(t, & + bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='write') + do_3Dtconst = .false. + end if if (masterproc) then write(iulog,*) @@ -3553,11 +3553,11 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & write(iulog,*) endif - if (if_stop .or. (tape(t)%ntimes==tape(t)%mfilt)) then - call ncd_pio_closefile(nfid(t)) - else - call ncd_pio_syncfile(nfid(t)) - endif + call ncd_pio_closefile(nfid(t)) + + if (.not.if_stop .and. (tape(t)%ntimes/=tape(t)%mfilt)) then + call ncd_pio_openfile (nfid(t), trim(locfnh(t)), ncd_write) + end if else if (masterproc) then write(iulog,*) trim(subname),' : history tape ',t,': no open file to close' From 01c36e67fa4bd80d1bc31280665f326b7701008c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 12 Nov 2020 17:13:56 -0700 Subject: [PATCH 1626/1973] Remove unneeded ncd_pio_syncfile This came from https://github.com/ESCOMP/CTSM/pull/1085, but we ended up redoing that PR in a different way on master. --- src/main/ncdio_pio.F90.in | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 5ee1af4df4..0eb8725514 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -33,7 +33,7 @@ module ncdio_pio use pio , only : pio_put_att, pio_put_var, pio_read_darray, pio_real, pio_seterrorhandling use pio , only : pio_setframe, pio_unlimited, pio_write, pio_write_darray, var_desc_t use pio , only : pio_iotask_rank, PIO_REARR_SUBSET, PIO_REARR_BOX - use pio , only : pio_inq_vartype, pio_real, pio_syncfile + use pio , only : pio_inq_vartype, pio_real use array_utils , only : convert_to_logical ! ! !PUBLIC TYPES: @@ -72,7 +72,6 @@ module ncdio_pio public :: ncd_inqvdlen ! inquire variable dimension size public :: ncd_inqvdname ! inquire variable dimension name public :: ncd_io ! write local data - public :: ncd_pio_syncfile ! flush file contents to disk integer,parameter,public :: ncd_int = pio_int integer,parameter,public :: ncd_log =-pio_int @@ -2740,9 +2739,4 @@ contains end subroutine ncd_getiodesc - subroutine ncd_pio_syncfile(ncid) - type(file_desc_t) :: ncid - call pio_syncfile(ncid) - end subroutine ncd_pio_syncfile - end module ncdio_pio From 93dc54abd8a68b85f15e85766695d8c3bba3320c Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 13 Nov 2020 07:58:07 -0700 Subject: [PATCH 1627/1973] move nuopc share code build to csm_share library --- cime_config/buildlib | 2 -- 1 file changed, 2 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index f4baea01a0..a6dab8210c 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -121,8 +121,6 @@ def _main_func(): os.path.join(lnd_root,"src","fates","parteh"), os.path.join(lnd_root,"src","utils"), os.path.join(lnd_root,"src","cpl")] - if driver == 'nuopc': - paths.append(os.path.join(cimeroot,"src","drivers","nuopc","nuopc_cap_share")) if lilac_mode == 'on': paths.append(os.path.join(lnd_root,"lilac","src")) From 7470cfb175a396f852ae7ba76d9f66e391d1de58 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 13 Nov 2020 11:57:12 -0700 Subject: [PATCH 1628/1973] Update ChangeLog --- doc/ChangeLog | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 109 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 3bdc732d0a..5a08b657dd 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,112 @@ =============================================================== +Tag name: ctsm5.1.dev015 +Originator(s): sacks (Bill Sacks) +Date: Fri Nov 13 11:52:34 MST 2020 +One-line Summary: A few small fixes + +Purpose of changes +------------------ + +(1) Fixes needed for PIO2 when running in pts/scam mode (from Jim + Edwards and Bill Sacks) + +(2) Fix mpi broadcast of hist_avgflag_pertape so that this namelist + variable is applied properly (from Sunniva Indrehus, Keith Oleson + and Bill Sacks) + +(3) Fix invalid xml in namelist_definition_ctsm.xml + +(4) Add point of interest code for debugging + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1191 (hist_avgflag_pertape doesn't always produce + desired averaging type for some history file streams) +- Resolves ESCOMP/CTSM#1159 (Invalid xml in + namelist_definition_ctsm.xml) +- Resolves ESCOMP/CTSM#1210 (Add "point of interest" code) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none expected (not checked) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1214 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev014 Originator(s): dll (Danica Lombardozzi) / oleson (Keith Oleson) / sacks (Bill Sacks) Date: Sat Nov 7 12:19:14 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index cbe950b62e..b706eeea98 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev015 sacks 11/13/2020 A few small fixes ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes ctsm5.1.dev013 jedwards 11/04/2020 Allow pnetcdf for vector history files ctsm5.1.dev012 oleson/s 11/03/2020 Allow nlevgrnd < nlevurb From f8131bc98051475bbbec6e23b612f0c0a273f276 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 13 Nov 2020 14:17:35 -0700 Subject: [PATCH 1629/1973] Add comments --- src/biogeophys/SoilMoistureStreamMod.F90 | 9 +++++++++ src/cpl/nuopc/SoilMoistureStreamMod.F90 | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index c276f7f826..edca4150f8 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -1,5 +1,14 @@ module SoilMoistureStreamMod + ! ********************************************************************** + ! --------------------------- IMPORTANT NOTE --------------------------- + ! + ! In cases using the NUOPC driver/mediator, we use a different version of this module, + ! based on CDEPS, which resides in src/cpl/nuopc/. Changes to the science here should + ! also be made in the similar file in src/cpl/nuopc. Once we start using CDEPS by + ! default, we can remove this version and move the CDEPS-based version into its place. + ! ********************************************************************** + #include "shr_assert.h" !----------------------------------------------------------------------- diff --git a/src/cpl/nuopc/SoilMoistureStreamMod.F90 b/src/cpl/nuopc/SoilMoistureStreamMod.F90 index d8ea3b5fe9..3c6b23a0aa 100644 --- a/src/cpl/nuopc/SoilMoistureStreamMod.F90 +++ b/src/cpl/nuopc/SoilMoistureStreamMod.F90 @@ -1,5 +1,15 @@ module SoilMoistureStreamMod + ! ********************************************************************** + ! --------------------------- IMPORTANT NOTE --------------------------- + ! + ! This file is here temporarily in order to exercise the CDEPS stream code for this 3-d + ! stream. In cases using the NUOPC driver/mediator, this version is used instead of the + ! version in src/biogeophys. Changes to the science here should also be made in the + ! similar file in src/biogeophys. Once we start using CDEPS by default, we can remove + ! the version in src/biogeophys and move this version into there. + ! ********************************************************************** + #include "shr_assert.h" !----------------------------------------------------------------------- From 7ddec31d337ccd714f8b1cdf7605633d310c7173 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 13 Nov 2020 14:21:25 -0700 Subject: [PATCH 1630/1973] Remove OMP CRITICAL block in clm_ptrs_check Jim Edwards added this earlier on this branch, but I don't think it's actually needed. --- src/main/initSubgridMod.F90 | 45 ++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/main/initSubgridMod.F90 b/src/main/initSubgridMod.F90 index 7cabcdbbda..43851c337b 100644 --- a/src/main/initSubgridMod.F90 +++ b/src/main/initSubgridMod.F90 @@ -13,10 +13,10 @@ module initSubgridMod use clm_varctl , only : iulog, use_fates use clm_varcon , only : namep, namec, namel use decompMod , only : bounds_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch + use GridcellType , only : grc + use LandunitType , only : lun + use ColumnType , only : col + use PatchType , only : patch use column_varcon , only : is_hydrologically_active ! ! !PUBLIC TYPES: @@ -37,27 +37,27 @@ module initSubgridMod !----------------------------------------------------------------------- contains - + !------------------------------------------------------------------------------ subroutine clm_ptrs_compdown(bounds) ! ! !DESCRIPTION: - ! Assumes the part of the subgrid pointing up has been set. Fills + ! Assumes the part of the subgrid pointing up has been set. Fills ! in the data pointing down. Up is p_c, p_l, p_g, c_l, c_g, and l_g. ! ! This algorithm assumes all indices besides grid cell are monotonically ! increasing. (Note that grid cell index is NOT monotonically increasing, - ! hence we cannot set initial & final indices at the grid cell level - + ! hence we cannot set initial & final indices at the grid cell level - ! grc%luni, grc%lunf, etc.) ! ! Algorithm works as follows. The p, c, and l loops march through ! the full arrays (nump, numc, and numl) checking the "up" indexes. - ! As soon as the "up" index of the current (p,c,l) cell changes relative - ! to the previous (p,c,l) cell, the *i array will be set to point down + ! As soon as the "up" index of the current (p,c,l) cell changes relative + ! to the previous (p,c,l) cell, the *i array will be set to point down ! to that cell. The *f array follows the same logic, so it's always the ! last "up" index from the previous cell when an "up" index changes. ! - ! For example, a case where p_c(1:4) = 1 and p_c(5:12) = 2. This + ! For example, a case where p_c(1:4) = 1 and p_c(5:12) = 2. This ! subroutine will set c_pi(1) = 1, c_pf(1) = 4, c_pi(2) = 5, c_pf(2) = 12. ! ! !USES @@ -79,7 +79,7 @@ subroutine clm_ptrs_compdown(bounds) !--- Loop p through full local begp:endp length !--- Separately check the p_c, p_l, and p_g indexes for a change in !--- the "up" index. - !--- If there is a change, verify that the current c,l,g is within the + !--- If there is a change, verify that the current c,l,g is within the !--- valid range, and set c_pi, l_pi, or g_pi to that current c,l,g !--- Constantly update the c_pf, l_pf, and g_pf array. When the !--- g, l, c index changes, the *_pf array will be set correctly @@ -167,7 +167,7 @@ subroutine clm_ptrs_check(bounds) integer :: ltype ! landunit type logical :: error ! error flag !------------------------------------------------------------------------------ -!$OMP CRITICAL + associate( & begg => bounds%begg, & endg => bounds%endg, & @@ -178,8 +178,10 @@ subroutine clm_ptrs_check(bounds) begp => bounds%begp, & endp => bounds%endp & ) + if (masterproc) write(iulog,*) ' ' if (masterproc) write(iulog,*) '---clm_ptrs_check:' + !--- check index ranges --- error = .false. do g = begg, endg @@ -190,12 +192,12 @@ subroutine clm_ptrs_check(bounds) end if end do end do - if (error) then write(iulog,*) ' clm_ptrs_check: g index ranges - ERROR' call endrun(msg=errMsg(sourcefile, __LINE__)) end if if (masterproc) write(iulog,*) ' clm_ptrs_check: g index ranges - OK' + error = .false. if (minval(lun%gridcell(begl:endl)) < begg .or. maxval(lun%gridcell(begl:endl)) > endg) error=.true. if (minval(lun%coli(begl:endl)) < begc .or. maxval(lun%coli(begl:endl)) > endc) error=.true. @@ -284,6 +286,7 @@ subroutine clm_ptrs_check(bounds) endif enddo if (masterproc) write(iulog,*) ' clm_ptrs_check: p mono increasing - OK' + !--- check that the tree is internally consistent --- error = .false. do g = begg, endg @@ -320,9 +323,9 @@ subroutine clm_ptrs_check(bounds) enddo ! g if (masterproc) write(iulog,*) ' clm_ptrs_check: tree consistent - OK' if (masterproc) write(iulog,*) ' ' - end associate -!$OMP END CRITICAL + end associate + end subroutine clm_ptrs_check !----------------------------------------------------------------------- @@ -343,10 +346,10 @@ subroutine add_landunit(li, gi, ltype, wtgcell) real(r8) , intent(in) :: wtgcell ! weight of the landunit relative to the grid cell ! ! !LOCAL VARIABLES: - + character(len=*), parameter :: subname = 'add_landunit' !----------------------------------------------------------------------- - + li = li + 1 lun%gridcell(li) = gi @@ -439,10 +442,10 @@ subroutine add_patch(pi, ci, ptype, wtcol) ! !LOCAL VARIABLES: integer :: li ! landunit index integer :: lb_offset ! offset between natpft_lb and 1 - + character(len=*), parameter :: subname = 'add_patch' !----------------------------------------------------------------------- - + pi = pi + 1 patch%column(pi) = ci @@ -453,7 +456,7 @@ subroutine add_patch(pi, ci, ptype, wtcol) patch%wtcol(pi) = wtcol ! TODO (MV, 10-17-14): The following must be commented out because - ! currently patch%itype is used in CanopyTemperatureMod to calculate + ! currently patch%itype is used in CanopyTemperatureMod to calculate ! z0m(p) and displa(p) - and is still called even when fates is on !if (.not. use_fates) then @@ -466,7 +469,7 @@ subroutine add_patch(pi, ci, ptype, wtcol) else patch%mxy(pi) = ispval end if - + end subroutine add_patch From 07045ffa92a1241b9750fd98d586a23d22b29b7d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 13 Nov 2020 14:58:06 -0700 Subject: [PATCH 1631/1973] Update cime --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index d1f7704306..14e9df1799 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -44,7 +44,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.32_a01 +tag = branch_tags/cime5.8.32_a02 externals = ../Externals_cime.cfg required = True From c61920a6bdefff572609cd3e1672f1eb3784326b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 13 Nov 2020 15:02:22 -0700 Subject: [PATCH 1632/1973] Remove Externals_cime.cfg Move cmeps into main Externals.cfg --- Externals.cfg | 22 ++++++++++++++-------- Externals_cime.cfg | 9 --------- 2 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 Externals_cime.cfg diff --git a/Externals.cfg b/Externals.cfg index 14e9df1799..f57280c888 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -33,19 +33,25 @@ repo_url = https://github.com/nmizukami/mizuRoute hash = 34723c2 required = True -[cdeps] -hash = 45b7a85 -protocol = git -repo_url = https://github.com/ESCOMP/CDEPS.git -local_path = components/cdeps -required = True - [cime] local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime tag = branch_tags/cime5.8.32_a02 -externals = ../Externals_cime.cfg +required = True + +[cmeps] +local_path = cime/src/drivers/nuopc/ +protocol = git +repo_url = https://github.com/ESCOMP/CMEPS.git +hash = 7654038 +required = True + +[cdeps] +local_path = components/cdeps +protocol = git +repo_url = https://github.com/ESCOMP/CDEPS.git +hash = 45b7a85 required = True [doc-builder] diff --git a/Externals_cime.cfg b/Externals_cime.cfg deleted file mode 100644 index a4ef9d88e8..0000000000 --- a/Externals_cime.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[cmeps] -hash = 7654038 -protocol = git -repo_url = https://github.com/ESCOMP/CMEPS.git -local_path = src/drivers/nuopc/ -required = True - -[externals_description] -schema_version = 1.0.0 From 555242546213691a00e4ee86725a4d7866e8f03d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 13 Nov 2020 15:07:11 -0700 Subject: [PATCH 1633/1973] Squashed 'manage_externals/' changes from c33a3bd2a..39ad53263 39ad53263 Merge pull request #150 from gold2718/fix_combo_config 75f8f02f5 Merge pull request #152 from jedwards4b/sort_by_local_path 42687bd53 remove commented code 29e26af81 fix pylint issues 7c9f3c613 add a test for nested repo checkout 75c5353d2 fix spacing 24a3726a1 improve sorting, checkout externals with each comp 29f45b086 remove py2 test and fix super call 880a4e765 remove decode 1c53be854 no need for set call 36c56dbac simplier fix for issue dc67cc682 simpler solution b32c6fca9 fix to allow submodule name different from path 5b5e1c2b0 Merge pull request #144 from billsacks/improve_errmsg c983863c4 Add another option for dealing with modified externals 59ce252cf Add some details to the error message when externals are modified be5a1a4d7 Merge pull request #143 from jedwards4b/add_exclude 2aa014a1b fix lint issue 49cd5e890 fix lint issues 418173ffd Added tests for ExternalsDescriptionDict afab352c8 fix lint issue be85b7d1b fix the test a580a570b push test d43710864 add a test 21affe33c fix formatting issue 72e6b64ae add an exclude option git-subtree-dir: manage_externals git-subtree-split: 39ad532636944b8e759ad9e56ef5f453aaea81f0 --- .gitignore | 3 + .travis.yml | 3 +- manic/checkout.py | 33 ++++-- manic/externals_description.py | 41 +++++-- manic/sourcetree.py | 16 +-- test/test_sys_checkout.py | 151 ++++++++++++++++++++++-- test/test_unit_externals_description.py | 77 ++++++++++++ 7 files changed, 280 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index 411de5d96e..a71ac0cd75 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ components/ # generated python files *.pyc + +# test tmp file +test/tmp diff --git a/.travis.yml b/.travis.yml index 1990cb9604..d9b24c584d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: python os: linux -python: - - "2.7" +python: - "3.4" - "3.5" - "3.6" diff --git a/manic/checkout.py b/manic/checkout.py index edc5655954..8dd1798d7a 100755 --- a/manic/checkout.py +++ b/manic/checkout.py @@ -279,6 +279,9 @@ def commandline_arguments(args=None): help='The externals description filename. ' 'Default: %(default)s.') + parser.add_argument('-x', '--exclude', nargs='*', + help='Component(s) listed in the externals file which should be ignored.') + parser.add_argument('-o', '--optional', action='store_true', default=False, help='By default only the required externals ' 'are checked out. This flag will also checkout the ' @@ -362,7 +365,7 @@ def main(args): root_dir = os.path.abspath(os.getcwd()) external_data = read_externals_description_file(root_dir, args.externals) external = create_externals_description( - external_data, components=args.components) + external_data, components=args.components, exclude=args.exclude) for comp in args.components: if comp not in external.keys(): @@ -377,29 +380,37 @@ def main(args): if args.status: # user requested status-only - for comp in sorted(tree_status.keys()): + for comp in sorted(tree_status): tree_status[comp].log_status_message(args.verbose) else: # checkout / update the external repositories. safe_to_update = check_safe_to_update_repos(tree_status) if not safe_to_update: # print status - for comp in sorted(tree_status.keys()): + for comp in sorted(tree_status): tree_status[comp].log_status_message(args.verbose) # exit gracefully msg = """The external repositories labeled with 'M' above are not in a clean state. -The following are two options for how to proceed: +The following are three options for how to proceed: -(1) Go into each external that is not in a clean state and issue either - an 'svn status' or a 'git status' command. Either revert or commit - your changes so that all externals are in a clean state. (Note, - though, that it is okay to have untracked files in your working +(1) Go into each external that is not in a clean state and issue either a 'git status' or + an 'svn status' command (depending on whether the external is managed by git or + svn). Either revert or commit your changes so that all externals are in a clean + state. (To revert changes in git, follow the instructions given when you run 'git + status'.) (Note, though, that it is okay to have untracked files in your working directory.) Then rerun {program_name}. -(2) Alternatively, you do not have to rely on {program_name}. Instead, you - can manually update out-of-sync externals (labeled with 's' above) - as described in the configuration file {config_file}. +(2) Alternatively, you do not have to rely on {program_name}. Instead, you can manually + update out-of-sync externals (labeled with 's' above) as described in the + configuration file {config_file}. (For example, run 'git fetch' and 'git checkout' + commands to checkout the appropriate tags for each external, as given in + {config_file}.) + +(3) You can also use {program_name} to manage most, but not all externals: You can specify + one or more externals to ignore using the '-x' or '--exclude' argument to + {program_name}. Excluding externals labeled with 'M' will allow {program_name} to + update the other, non-excluded externals. The external repositories labeled with '?' above are not under version diff --git a/manic/externals_description.py b/manic/externals_description.py index bd644c9814..918d616e37 100644 --- a/manic/externals_description.py +++ b/manic/externals_description.py @@ -253,9 +253,21 @@ def read_gitmodules_file(root_dir, file_name): ExternalsDescription.REPO_URL, url) externals_description.set(sec_name, ExternalsDescription.REQUIRED, 'True') - git_hash = submods[sec_name]['hash'] - externals_description.set(sec_name, - ExternalsDescription.HASH, git_hash) + if sec_name in submods: + submod_name = sec_name + else: + # The section name does not have to match the path + submod_name = path + + if submod_name in submods: + git_hash = submods[submod_name]['hash'] + externals_description.set(sec_name, + ExternalsDescription.HASH, + git_hash) + else: + emsg = "submodule status has no section, '{}'" + emsg += "\nCheck section names in externals config file" + fatal_error(emsg.format(submod_name)) # Required items externals_description.add_section(DESCRIPTION_SECTION) @@ -264,18 +276,18 @@ def read_gitmodules_file(root_dir, file_name): return externals_description def create_externals_description( - model_data, model_format='cfg', components=None, parent_repo=None): + model_data, model_format='cfg', components=None, exclude=None, parent_repo=None): """Create the a externals description object from the provided data """ externals_description = None if model_format == 'dict': externals_description = ExternalsDescriptionDict( - model_data, components=components) + model_data, components=components, exclude=exclude) elif model_format == 'cfg': major, _, _ = get_cfg_schema_version(model_data) if major == 1: externals_description = ExternalsDescriptionConfigV1( - model_data, components=components, parent_repo=parent_repo) + model_data, components=components, exclude=exclude, parent_repo=parent_repo) else: msg = ('Externals description file has unsupported schema ' 'version "{0}".'.format(major)) @@ -710,7 +722,7 @@ class ExternalsDescriptionDict(ExternalsDescription): """ - def __init__(self, model_data, components=None): + def __init__(self, model_data, components=None, exclude=None): """Parse a native dictionary into a externals description. """ ExternalsDescription.__init__(self) @@ -722,10 +734,15 @@ def __init__(self, model_data, components=None): self._input_patch = 0 self._verify_schema_version() if components: - for key in model_data.items(): + for key in list(model_data.keys()): if key not in components: del model_data[key] + if exclude: + for key in list(model_data.keys()): + if key in exclude: + del model_data[key] + self.update(model_data) self._check_user_input() @@ -736,7 +753,7 @@ class ExternalsDescriptionConfigV1(ExternalsDescription): """ - def __init__(self, model_data, components=None, parent_repo=None): + def __init__(self, model_data, components=None, exclude=None, parent_repo=None): """Convert the config data into a standardized dict that can be used to construct the source objects @@ -749,7 +766,7 @@ def __init__(self, model_data, components=None, parent_repo=None): get_cfg_schema_version(model_data) self._verify_schema_version() self._remove_metadata(model_data) - self._parse_cfg(model_data, components=components) + self._parse_cfg(model_data, components=components, exclude=exclude) self._check_user_input() @staticmethod @@ -761,7 +778,7 @@ def _remove_metadata(model_data): """ model_data.remove_section(DESCRIPTION_SECTION) - def _parse_cfg(self, cfg_data, components=None): + def _parse_cfg(self, cfg_data, components=None, exclude=None): """Parse a config_parser object into a externals description. """ def list_to_dict(input_list, convert_to_lower_case=True): @@ -778,7 +795,7 @@ def list_to_dict(input_list, convert_to_lower_case=True): for section in cfg_data.sections(): name = config_string_cleaner(section.lower().strip()) - if components and name not in components: + if (components and name not in components) or (exclude and name in exclude): continue self[name] = {} self[name].update(list_to_dict(cfg_data.items(section))) diff --git a/manic/sourcetree.py b/manic/sourcetree.py index b9c9c21082..54de763c30 100644 --- a/manic/sourcetree.py +++ b/manic/sourcetree.py @@ -331,12 +331,14 @@ def checkout(self, verbosity, load_all, load_comp=None): printlog('Checking out externals: ', end='') if load_all: - load_comps = self._all_components.keys() + tmp_comps = self._all_components.keys() elif load_comp is not None: - load_comps = [load_comp] + tmp_comps = [load_comp] else: - load_comps = self._required_compnames - + tmp_comps = self._required_compnames + # Sort by path so that if paths are nested the + # parent repo is checked out first. + load_comps = sorted(tmp_comps, key=lambda comp: self._all_components[comp].get_local_path()) # checkout the primary externals for comp in load_comps: if verbosity < VERBOSITY_VERBOSE: @@ -346,8 +348,6 @@ def checkout(self, verbosity, load_all, load_comp=None): # output a newline printlog(EMPTY_STR) self._all_components[comp].checkout(verbosity, load_all) - printlog('') - - # now give each external an opportunitity to checkout it's externals. - for comp in load_comps: + # now give each external an opportunitity to checkout it's externals. self._all_components[comp].checkout_externals(verbosity, load_all) + printlog('') diff --git a/test/test_sys_checkout.py b/test/test_sys_checkout.py index df726f2b70..118bee5308 100644 --- a/test/test_sys_checkout.py +++ b/test/test_sys_checkout.py @@ -38,6 +38,7 @@ import os import os.path import shutil +import sys import unittest from manic.externals_description import ExternalsDescription @@ -85,6 +86,8 @@ CFG_SUB_NAME = 'sub-externals.cfg' README_NAME = 'readme.txt' REMOTE_BRANCH_FEATURE2 = 'feature2' +NESTED_NAME = ['./fred', './fred/wilma', './fred/wilma/barney'] + SVN_TEST_REPO = 'https://github.com/escomp/cesm' @@ -160,6 +163,23 @@ def container_simple_required(self, dest_dir): self.write_config(dest_dir) + def container_nested_required(self, dest_dir, order): + """Create a container externals file with only simple externals. + + """ + self.create_config() + self.create_section(SIMPLE_REPO_NAME, 'simp_tag', nested=True, + tag='tag1', path=NESTED_NAME[order[0]]) + + self.create_section(SIMPLE_REPO_NAME, 'simp_branch', nested=True, + branch=REMOTE_BRANCH_FEATURE2, path=NESTED_NAME[order[1]]) + + self.create_section(SIMPLE_REPO_NAME, 'simp_hash', nested=True, + ref_hash='60b1cc1a38d63', path=NESTED_NAME[order[2]]) + + self.write_config(dest_dir) + + def container_simple_optional(self, dest_dir): """Create a container externals file with optional simple externals @@ -261,7 +281,7 @@ def create_metadata(self): def create_section(self, repo_type, name, tag='', branch='', ref_hash='', required=True, path=EXTERNALS_NAME, externals='', repo_path=None, from_submodule=False, - sparse=''): + sparse='', nested=False): # pylint: disable=too-many-branches """Create a config section with autofilling some items and handling optional items. @@ -270,8 +290,11 @@ def create_section(self, repo_type, name, tag='', branch='', # pylint: disable=R0913 self._config.add_section(name) if not from_submodule: - self._config.set(name, ExternalsDescription.PATH, - os.path.join(path, name)) + if nested: + self._config.set(name, ExternalsDescription.PATH, path) + else: + self._config.set(name, ExternalsDescription.PATH, + os.path.join(path, name)) self._config.set(name, ExternalsDescription.PROTOCOL, ExternalsDescription.PROTOCOL_GIT) @@ -535,12 +558,26 @@ def setUp(self): self._test_id = self.id().split('.')[-1] + # find root + if os.path.exists(os.path.join(os.getcwd(), 'checkout_externals')): + root_dir = os.path.abspath(os.getcwd()) + else: + # maybe we are in a subdir, search up + root_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir)) + while os.path.basename(root_dir): + if os.path.exists(os.path.join(root_dir, 'checkout_externals')): + break + root_dir = os.path.dirname(root_dir) + + if not os.path.exists(os.path.join(root_dir, 'checkout_externals')): + raise RuntimeError('Cannot find checkout_externals') + # path to the executable - self._checkout = os.path.join('../checkout_externals') - self._checkout = os.path.abspath(self._checkout) + self._checkout = os.path.join(root_dir, 'checkout_externals') # directory where we have test repositories - self._bare_root = os.path.join(os.getcwd(), BARE_REPO_ROOT_NAME) + test_dir = os.path.join(root_dir, 'test') + self._bare_root = os.path.join(test_dir, BARE_REPO_ROOT_NAME) self._bare_root = os.path.abspath(self._bare_root) # set into the environment so var will be expanded in externals files @@ -671,10 +708,16 @@ def _check_simple_tag_empty(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_tag'.format(directory) self._check_generic_empty_default_required(tree, name) + def _check_nested_tag_empty(self, tree, name=EXTERNALS_NAME): + self._check_generic_empty_default_required(tree, name) + def _check_simple_tag_ok(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_tag'.format(directory) self._check_generic_ok_clean_required(tree, name) + def _check_nested_tag_ok(self, tree, name=EXTERNALS_NAME): + self._check_generic_ok_clean_required(tree, name) + def _check_simple_tag_dirty(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_tag'.format(directory) self._check_generic_ok_dirty_required(tree, name) @@ -687,10 +730,16 @@ def _check_simple_branch_empty(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_branch'.format(directory) self._check_generic_empty_default_required(tree, name) + def _check_nested_branch_empty(self, tree, name=EXTERNALS_NAME): + self._check_generic_empty_default_required(tree, name) + def _check_simple_branch_ok(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_branch'.format(directory) self._check_generic_ok_clean_required(tree, name) + def _check_nested_branch_ok(self, tree, name=EXTERNALS_NAME): + self._check_generic_ok_clean_required(tree, name) + def _check_simple_branch_modified(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_branch'.format(directory) self._check_generic_modified_ok_required(tree, name) @@ -699,10 +748,16 @@ def _check_simple_hash_empty(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_hash'.format(directory) self._check_generic_empty_default_required(tree, name) + def _check_nested_hash_empty(self, tree, name=EXTERNALS_NAME): + self._check_generic_empty_default_required(tree, name) + def _check_simple_hash_ok(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_hash'.format(directory) self._check_generic_ok_clean_required(tree, name) + def _check_nested_hash_ok(self, tree, name=EXTERNALS_NAME): + self._check_generic_ok_clean_required(tree, name) + def _check_simple_hash_modified(self, tree, directory=EXTERNALS_NAME): name = './{0}/simp_hash'.format(directory) self._check_generic_modified_ok_required(tree, name) @@ -754,6 +809,12 @@ def _check_container_simple_required_pre_checkout(self, overall, tree): self._check_simple_branch_empty(tree) self._check_simple_hash_empty(tree) + def _check_container_nested_required_pre_checkout(self, overall, tree, order): + self.assertEqual(overall, 0) + self._check_nested_tag_empty(tree, name=NESTED_NAME[order[0]]) + self._check_nested_branch_empty(tree, name=NESTED_NAME[order[1]]) + self._check_nested_hash_empty(tree, name=NESTED_NAME[order[2]]) + def _check_container_simple_required_checkout(self, overall, tree): # Note, this is the internal tree status just before checkout self.assertEqual(overall, 0) @@ -761,12 +822,25 @@ def _check_container_simple_required_checkout(self, overall, tree): self._check_simple_branch_empty(tree) self._check_simple_hash_empty(tree) + def _check_container_nested_required_checkout(self, overall, tree, order): + # Note, this is the internal tree status just before checkout + self.assertEqual(overall, 0) + self._check_nested_tag_empty(tree, name=NESTED_NAME[order[0]]) + self._check_nested_branch_empty(tree, name=NESTED_NAME[order[1]]) + self._check_nested_hash_empty(tree, name=NESTED_NAME[order[2]]) + def _check_container_simple_required_post_checkout(self, overall, tree): self.assertEqual(overall, 0) self._check_simple_tag_ok(tree) self._check_simple_branch_ok(tree) self._check_simple_hash_ok(tree) + def _check_container_nested_required_post_checkout(self, overall, tree, order): + self.assertEqual(overall, 0) + self._check_nested_tag_ok(tree, name=NESTED_NAME[order[0]]) + self._check_nested_branch_ok(tree, name=NESTED_NAME[order[1]]) + self._check_nested_hash_ok(tree, name=NESTED_NAME[order[2]]) + def _check_container_simple_required_out_of_sync(self, overall, tree): self.assertEqual(overall, 0) self._check_simple_tag_modified(tree) @@ -819,10 +893,15 @@ def _check_container_component_post_checkout(self, overall, tree): def _check_container_component_post_checkout2(self, overall, tree): self.assertEqual(overall, 0) - self._check_simple_opt_ok(tree) self._check_simple_tag_empty(tree) self._check_simple_branch_ok(tree) + def _check_container_component_post_checkout3(self, overall, tree): + self.assertEqual(overall, 0) + self.assertFalse("simp_opt" in tree) + self._check_simple_tag_ok(tree) + self._check_simple_branch_ok(tree) + def _check_container_full_post_checkout(self, overall, tree): self.assertEqual(overall, 0) self._check_simple_tag_ok(tree) @@ -959,6 +1038,37 @@ def test_container_simple_required(self): self.status_args) self._check_container_simple_required_post_checkout(overall, tree) + def test_container_nested_required(self): + """Verify that a container with nested subrepos + generates the correct initial status. + Tests over all possible permutations + """ + + orders = [[0, 1, 2], [1, 2, 0], [2, 0, 1], + [0, 2, 1], [2, 1, 0], [1, 0, 2]] + for n, order in enumerate(orders): + # create repo + dest_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT], + self._test_id, "test"+str(n)) + under_test_dir = self.setup_test_repo(CONTAINER_REPO_NAME, + dest_dir_in=dest_dir) + self._generator.container_nested_required(under_test_dir, order) + + # status of empty repo + overall, tree = self.execute_cmd_in_dir(under_test_dir, + self.status_args) + self._check_container_nested_required_pre_checkout(overall, tree, order) + + # checkout + overall, tree = self.execute_cmd_in_dir(under_test_dir, + self.checkout_args) + self._check_container_nested_required_checkout(overall, tree, order) + + # status clean checked out + overall, tree = self.execute_cmd_in_dir(under_test_dir, + self.status_args) + self._check_container_nested_required_post_checkout(overall, tree, order) + def test_container_simple_optional(self): """Verify that container with an optional simple subrepos generates the correct initial status. @@ -1347,6 +1457,23 @@ def test_container_component(self): self.status_args) self._check_container_component_post_checkout2(overall, tree) + def test_container_exclude_component(self): + """Verify that exclude component checkout works + """ + # create the test repository + under_test_dir = self.setup_test_repo(CONTAINER_REPO_NAME) + + # create the top level externals file + self._generator.container_full(under_test_dir) + + # inital checkout, exclude simp_opt + checkout_args = ['--exclude', 'simp_opt'] + checkout_args.extend(self.checkout_args) + overall, tree = self.execute_cmd_in_dir(under_test_dir, checkout_args) + checkout_args.append("--status") + overall, tree = self.execute_cmd_in_dir(under_test_dir, checkout_args) + self._check_container_component_post_checkout3(overall, tree) + def test_mixed_simple(self): """Verify that a mixed use repo can serve as a 'full' container, pulling in a set of externals and a seperate set of sub-externals. @@ -1569,7 +1696,7 @@ def setUp(self): """ # Run the basic setup - super(TestSubrepoCheckout, self).setUp() + super().setUp() # create test repo # We need to do this here (rather than have a static repo) because # git submodules do not allow for variables in .gitmodules files @@ -1588,8 +1715,9 @@ def setUp(self): cwd = os.getcwd() fork_repo_dir = os.path.join(self._bare_root, SIMPLE_FORK_NAME) simple_repo_dir = os.path.join(self._bare_root, SIMPLE_REPO_NAME) - self._simple_ext_fork_name = SIMPLE_FORK_NAME.split('.')[0] - self._simple_ext_name = SIMPLE_REPO_NAME.split('.')[0] + self._simple_ext_fork_name = os.path.splitext(SIMPLE_FORK_NAME)[0] + self._simple_ext_name = os.path.join('sourc', + os.path.splitext(SIMPLE_REPO_NAME)[0]) os.chdir(self._repo_dir) # Add a branch with a subrepo cmd = ['git', 'branch', self._bare_branch_name, 'master'] @@ -1610,7 +1738,8 @@ def setUp(self): execute_subprocess(cmd) cmd = ['git', 'checkout', self._config_branch_name] execute_subprocess(cmd) - cmd = ['git', 'submodule', 'add', simple_repo_dir] + cmd = ['git', 'submodule', 'add', '--name', SIMPLE_REPO_NAME, + simple_repo_dir, self._simple_ext_name] execute_subprocess(cmd) # Checkout feature2 os.chdir(self._simple_ext_name) diff --git a/test/test_unit_externals_description.py b/test/test_unit_externals_description.py index 637f760ee5..0b1248f670 100644 --- a/test/test_unit_externals_description.py +++ b/test/test_unit_externals_description.py @@ -342,6 +342,40 @@ def setup_config(self): # NOTE(goldy, 2019-03) Should test other possible keywords such as # fetchRecurseSubmodules, ignore, and shallow + @staticmethod + def setup_dict_config(): + """Create the full container dictionary with simple and mixed use + externals + + """ + rdatat = {ExternalsDescription.PROTOCOL: 'git', + ExternalsDescription.REPO_URL: 'simple-ext.git', + ExternalsDescription.TAG: 'tag1'} + rdatab = {ExternalsDescription.PROTOCOL: 'git', + ExternalsDescription.REPO_URL: 'simple-ext.git', + ExternalsDescription.BRANCH: 'feature2'} + rdatam = {ExternalsDescription.PROTOCOL: 'git', + ExternalsDescription.REPO_URL: 'mixed-cont-ext.git', + ExternalsDescription.BRANCH: 'master'} + desc = {'simp_tag': {ExternalsDescription.REQUIRED: True, + ExternalsDescription.PATH: 'simp_tag', + ExternalsDescription.EXTERNALS: EMPTY_STR, + ExternalsDescription.REPO: rdatat}, + 'simp_branch' : {ExternalsDescription.REQUIRED: True, + ExternalsDescription.PATH: 'simp_branch', + ExternalsDescription.EXTERNALS: EMPTY_STR, + ExternalsDescription.REPO: rdatab}, + 'simp_opt': {ExternalsDescription.REQUIRED: False, + ExternalsDescription.PATH: 'simp_opt', + ExternalsDescription.EXTERNALS: EMPTY_STR, + ExternalsDescription.REPO: rdatat}, + 'mixed_req': {ExternalsDescription.REQUIRED: True, + ExternalsDescription.PATH: 'mixed_req', + ExternalsDescription.EXTERNALS: 'sub-ext.cfg', + ExternalsDescription.REPO: rdatam}} + + return desc + def test_cfg_v1_ok(self): """Test that a correct cfg v1 object is created by create_externals_description @@ -379,6 +413,49 @@ def test_dict(self): ext = create_externals_description(desc, model_format='dict') self.assertIsInstance(ext, ExternalsDescriptionDict) + def test_cfg_component_dict(self): + """Verify that create_externals_description works with a dictionary + """ + # create the top level externals file + desc = self.setup_dict_config() + # Check external with all repos + external = create_externals_description(desc, model_format='dict') + self.assertIsInstance(external, ExternalsDescriptionDict) + self.assertTrue('simp_tag' in external) + self.assertTrue('simp_branch' in external) + self.assertTrue('simp_opt' in external) + self.assertTrue('mixed_req' in external) + + def test_cfg_exclude_component_dict(self): + """Verify that exclude component checkout works with a dictionary + """ + # create the top level externals file + desc = self.setup_dict_config() + # Test an excluded repo + external = create_externals_description(desc, model_format='dict', + exclude=['simp_tag', + 'simp_opt']) + self.assertIsInstance(external, ExternalsDescriptionDict) + self.assertFalse('simp_tag' in external) + self.assertTrue('simp_branch' in external) + self.assertFalse('simp_opt' in external) + self.assertTrue('mixed_req' in external) + + def test_cfg_opt_component_dict(self): + """Verify that exclude component checkout works with a dictionary + """ + # create the top level externals file + desc = self.setup_dict_config() + # Test an excluded repo + external = create_externals_description(desc, model_format='dict', + components=['simp_tag', + 'simp_opt']) + self.assertIsInstance(external, ExternalsDescriptionDict) + self.assertTrue('simp_tag' in external) + self.assertFalse('simp_branch' in external) + self.assertTrue('simp_opt' in external) + self.assertFalse('mixed_req' in external) + def test_cfg_unknown_version(self): """Test that a runtime error is raised when an unknown file version is received From 67e4e2eb663fd6e30dd355fc739d9ab6d53cb81d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 15 Nov 2020 14:44:23 -0700 Subject: [PATCH 1634/1973] For now, don't set element mask when creating mesh file This is needed for mpi-serial tests --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 8e91d21949..f564646dc8 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -667,9 +667,16 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) mesh = ESMF_MeshCreate(lgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! TODO: is the mask by default set to 1 if created from a grid? ! reset the global mask (which is 1) to the land/ocean mask - call ESMF_MeshSet(mesh, elementMask=mask, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! + ! Currently, this call requires that the information has + ! already been added to the mesh during creation. For example, + ! you can only change the element mask information, if the mesh + ! was initially created with element masking. + !!! call ESMF_MeshSet(mesh, elementMask=mask, rc=rc) + !!! if (ChkErr(rc,__LINE__,u_FILE_u)) return + deallocate(mask) else From a5f21555cbd85b5f0af954585faf3c5f7cb432a7 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 16 Nov 2020 08:27:55 -0700 Subject: [PATCH 1635/1973] fix issue with inst_name --- src/biogeophys/UrbanTimeVarType.F90 | 16 ++++++++-------- src/cpl/mct/lnd_comp_mct.F90 | 5 ++--- src/cpl/nuopc/lnd_comp_nuopc.F90 | 6 +++--- src/main/ncdio_pio.F90.in | 7 ++++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/biogeophys/UrbanTimeVarType.F90 b/src/biogeophys/UrbanTimeVarType.F90 index c2d4aac3f3..7a907bb9b9 100644 --- a/src/biogeophys/UrbanTimeVarType.F90 +++ b/src/biogeophys/UrbanTimeVarType.F90 @@ -9,10 +9,10 @@ module UrbanTimeVarType use shr_log_mod , only : errMsg => shr_log_errMsg use abortutils , only : endrun use decompMod , only : bounds_type - use clm_varctl , only : iulog + use clm_varctl , only : iulog, inst_name use landunit_varcon , only : isturb_MIN, isturb_MAX use clm_varcon , only : spval - use LandunitType , only : lun + use LandunitType , only : lun use GridcellType , only : grc use mct_mod use shr_strdata_mod , only : shr_strdata_type @@ -34,10 +34,10 @@ module UrbanTimeVarType procedure, public :: Init ! Allocate and initialize urbantv procedure, public :: urbantv_init ! Initialize urban time varying stream procedure, public :: urbantv_interp ! Interpolate urban time varying stream - + end type urbantv_type - !----------------------------------------------------------------------- + !----------------------------------------------------------------------- character(15), private :: stream_var_name(isturb_MIN:isturb_MAX) character(len=*), parameter, private :: sourcefile = & @@ -56,7 +56,7 @@ subroutine Init(this, bounds, NLFilename) ! ! !ARGUMENTS: class(urbantv_type) :: this - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds character(len=*) , intent(in) :: NLFilename ! Namelist filename ! ! !LOCAL VARIABLES: @@ -116,11 +116,11 @@ subroutine urbantv_init(this, bounds, NLFilename) integer :: ifield ! field index integer :: stream_year_first_urbantv ! first year in urban tv stream to use integer :: stream_year_last_urbantv ! last year in urban tv stream to use - integer :: model_year_align_urbantv ! align stream_year_first_urbantv + integer :: model_year_align_urbantv ! align stream_year_first_urbantv ! with this model year integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_urbantv ! urban tv streams filename character(len=CL) :: urbantvmapalgo = 'nn' ! mapping alogrithm for urban ac character(len=CL) :: urbantv_tintalgo = 'linear' ! time interpolation alogrithm @@ -192,7 +192,7 @@ subroutine urbantv_init(this, bounds, NLFilename) call shr_strdata_create(this%sdat_urbantv,name="clmurbantv", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index b5b46ca97e..1ae6b9f6b9 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -74,7 +74,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) character(len=*), optional, intent(in) :: NLFilename ! Namelist filename to read ! ! !LOCAL VARIABLES: - integer :: LNDID ! Land identifyer + integer :: LNDID ! Land identifyer integer :: mpicom_lnd ! MPI communicator type(mct_gsMap), pointer :: GSMap_lnd ! Land model MCT GS map type(mct_gGrid), pointer :: dom_l ! Land model domain @@ -130,7 +130,6 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) inst_name = seq_comm_name(LNDID) inst_index = seq_comm_inst(LNDID) inst_suffix = seq_comm_suffix(LNDID) - ! Initialize io log unit call shr_file_getLogUnit (shrlogunit) @@ -430,7 +429,7 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) nstep = get_nstep() caldayp1 = get_curr_calday(offset=dtime) if (nstep == 0) then - doalb = .false. + doalb = .false. else if (nstep == 1) then doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) else diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 8e91d21949..af583f8c65 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -24,7 +24,7 @@ module lnd_comp_nuopc use domainMod , only : ldomain use controlMod , only : control_setNL use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use clm_varctl , only : inst_index, inst_suffix + use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_varctl , only : single_column, clm_varctl_set, iulog use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch use clm_varcon , only : re @@ -222,7 +222,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call get_component_instance(gcomp, inst_suffix, inst_index, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - + inst_name = 'LND' !---------------------------------------------------------------------------- ! advertise fields !---------------------------------------------------------------------------- @@ -366,7 +366,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, pointer :: gindex(:) ! global index space for land and ocean points integer, pointer :: gindex_lnd(:) ! global index space for just land points integer, pointer :: gindex_ocn(:) ! global index space for just ocean points - integer, pointer :: mask(:) ! local land/ocean mask + integer, pointer :: mask(:) ! local land/ocean mask character(ESMF_MAXSTR) :: cvalue ! config data integer :: nlnd, nocn ! local size ofarrays integer :: g,n ! indices diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 89bcd10836..4b7b75c82e 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -186,11 +186,12 @@ contains ! ! !USES: use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat + use clm_varctl , only : inst_name !----------------------------------------------------------------------- - PIO_subsystem => shr_pio_getiosys('LND') - io_type = shr_pio_getiotype('LND') - io_netcdf_format = shr_pio_getioformat('LND') + PIO_subsystem => shr_pio_getiosys(inst_name) + io_type = shr_pio_getiotype(inst_name) + io_netcdf_format = shr_pio_getioformat(inst_name) end subroutine ncd_pio_init !----------------------------------------------------------------------- From 451c995f83ee0946e1c7d37fd129088d54d54001 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 16 Nov 2020 08:37:45 -0700 Subject: [PATCH 1636/1973] replace LND with inst_name --- src/biogeochem/SatellitePhenologyMod.F90 | 62 +++++++++++----------- src/biogeochem/ch4FInundatedStreamType.F90 | 33 ++++++------ src/biogeophys/SoilMoistureStreamMod.F90 | 46 ++++++++-------- src/cpl/nuopc/lnd_comp_nuopc.F90 | 1 + src/main/FireDataBaseType.F90 | 54 +++++++++---------- src/main/ndepStreamMod.F90 | 18 +++---- 6 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index a0fb6d9b24..7b5aea35dd 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -4,8 +4,8 @@ module SatellitePhenologyMod !----------------------------------------------------------------------- ! !DESCRIPTION: - ! CLM Satelitte Phenology model (SP) ecosystem dynamics (phenology, vegetation). - ! Allow some subroutines to be used by the CLM Carbon Nitrogen model (CLMCN) + ! CLM Satelitte Phenology model (SP) ecosystem dynamics (phenology, vegetation). + ! Allow some subroutines to be used by the CLM Carbon Nitrogen model (CLMCN) ! so that DryDeposition code can get estimates of LAI differences between months. ! ! !USES: @@ -18,20 +18,20 @@ module SatellitePhenologyMod use decompMod , only : bounds_type use abortutils , only : endrun use clm_varctl , only : scmlat,scmlon,single_column - use clm_varctl , only : iulog, use_lai_streams + use clm_varctl , only : iulog, use_lai_streams, inst_name use clm_varcon , only : grlnd use controlMod , only : NLFilename use decompMod , only : gsmap_lnd_gdc2glo use domainMod , only : ldomain use fileutils , only : getavu, relavu - use PatchType , only : patch + use PatchType , only : patch use CanopyStateType , only : canopystate_type use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type use perf_mod , only : t_startf, t_stopf use spmdMod , only : masterproc use spmdMod , only : mpicom, comp_id use mct_mod - use ncdio_pio + use ncdio_pio ! ! !PUBLIC TYPES: implicit none @@ -66,7 +66,7 @@ module SatellitePhenologyMod !----------------------------------------------------------------------- contains - + !----------------------------------------------------------------------- ! ! lai_init @@ -95,10 +95,10 @@ subroutine lai_init(bounds) integer :: i ! index integer :: stream_year_first_lai ! first year in Lai stream to use integer :: stream_year_last_lai ! last year in Lai stream to use - integer :: model_year_align_lai ! align stream_year_first_lai with + integer :: model_year_align_lai ! align stream_year_first_lai with integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_lai ! lai stream filename to read character(len=CL) :: lai_mapalgo = 'bilinear' ! Mapping alogrithm character(len=CL) :: lai_tintalgo = 'linear' ! Time interpolation alogrithm @@ -153,9 +153,9 @@ subroutine lai_init(bounds) write(iulog,*) ' ' write(iulog,*) 'lai_stream settings:' - write(iulog,*) ' stream_year_first_lai = ',stream_year_first_lai - write(iulog,*) ' stream_year_last_lai = ',stream_year_last_lai - write(iulog,*) ' model_year_align_lai = ',model_year_align_lai + write(iulog,*) ' stream_year_first_lai = ',stream_year_first_lai + write(iulog,*) ' stream_year_last_lai = ',stream_year_last_lai + write(iulog,*) ' model_year_align_lai = ',model_year_align_lai write(iulog,*) ' stream_fldFileName_lai = ',trim(stream_fldFileName_lai) write(iulog,*) ' lai_tintalgo = ',trim(lai_tintalgo) @@ -169,8 +169,8 @@ subroutine lai_init(bounds) fldList = shr_string_listCreateField( numLaiFields, laiString ) call shr_strdata_create(sdat_lai,name="laidyn", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -182,7 +182,7 @@ subroutine lai_init(bounds) domFileName=trim(stream_fldFileName_lai), & domTvarName='time', & domXvarName='lon' , & - domYvarName='lat' , & + domYvarName='lat' , & domAreaName='area', & domMaskName='mask', & filePath='', & @@ -215,7 +215,7 @@ subroutine lai_advance( bounds ) ! ! !ARGUMENTS: implicit none - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: g, ig ! Indices @@ -257,7 +257,7 @@ subroutine lai_interp(bounds, canopystate_inst) ! ! !ARGUMENTS: implicit none - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds type(canopystate_type) , intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: @@ -298,7 +298,7 @@ subroutine SatellitePhenologyInit (bounds) use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: ier ! error code @@ -341,7 +341,7 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & use pftconMod, only : noveg, nbrdlf_dcd_brl_shrub ! ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter integer , intent(in) :: filter_nolakep(bounds%endp-bounds%begp+1) ! patch filter for non-lake points type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst @@ -354,14 +354,14 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & !----------------------------------------------------------------------- associate( & - frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow + frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) + snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) + tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow - htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) - hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) + htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) + hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch & ! Output: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] ) @@ -402,7 +402,7 @@ subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & ! are less than 0.05, set equal to zero to prevent numerical ! problems associated with very small lai and sai. - ! snow burial fraction for short vegetation (e.g. grasses, crops) changes with vegetation height + ! snow burial fraction for short vegetation (e.g. grasses, crops) changes with vegetation height ! accounts for a 20% bending factor, as used in Lombardozzi et al. (2018) GRL 45(18), 9889-9897 ! NOTE: The following snow burial code is duplicated in CNVegStructUpdateMod. @@ -446,7 +446,7 @@ subroutine interpMonthlyVeg (bounds, canopystate_inst) use clm_time_manager, only : get_curr_date, get_step_size_real, get_nstep ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(canopystate_type), intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: @@ -504,12 +504,12 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) use shr_scam_mod, only : shr_scam_getCloseLatLon ! ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds type(canopystate_type), intent(inout) :: canopystate_inst ! ! !LOCAL VARIABLES: type(file_desc_t) :: ncid ! netcdf id - real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set + real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set real(r8), pointer :: mlai(:,:) ! lai read from input files real(r8):: closelat,closelon ! single column vars integer :: ier ! error code @@ -526,13 +526,13 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) character(len=32) :: subname = 'readAnnualVegetation' !----------------------------------------------------------------------- - annlai => canopystate_inst%annlai_patch + annlai => canopystate_inst%annlai_patch ! Determine necessary indices allocate(mlai(bounds%begg:bounds%endg,0:maxveg), stat=ier) if (ier /= 0) then - write(iulog,*)subname, 'allocation error ' + write(iulog,*)subname, 'allocation error ' call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -578,7 +578,7 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) else !! non-vegetated pft annlai(k,p) = 0._r8 end if - end do ! end of loop over patches + end do ! end of loop over patches enddo ! months loop @@ -605,7 +605,7 @@ subroutine readMonthlyVegetation (bounds, & use netcdf ! ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds + type(bounds_type) , intent(in) :: bounds character(len=*) , intent(in) :: fveg ! file with monthly vegetation data integer , intent(in) :: months(2) ! months to be interpolated (1 to 12) type(canopystate_type), intent(inout) :: canopystate_inst diff --git a/src/biogeochem/ch4FInundatedStreamType.F90 b/src/biogeochem/ch4FInundatedStreamType.F90 index 12db0528f8..9d38ab8332 100644 --- a/src/biogeochem/ch4FInundatedStreamType.F90 +++ b/src/biogeochem/ch4FInundatedStreamType.F90 @@ -1,16 +1,15 @@ - module ch4FInundatedStreamType #include "shr_assert.h" - !----------------------------------------------------------------------- - ! !DESCRIPTION: + !----------------------------------------------------------------------- + ! !DESCRIPTION: ! Contains methods for reading in finundated streams file for methane code. ! ! !USES use shr_kind_mod , only: r8 => shr_kind_r8, CL => shr_kind_cl use spmdMod , only: mpicom, masterproc - use clm_varctl , only: iulog + use clm_varctl , only: iulog, inst_name use abortutils , only: endrun use decompMod , only: bounds_type use ch4varcon , only: finundation_mtd @@ -60,7 +59,7 @@ module ch4FInundatedStreamType !============================================================================== subroutine Init(this, bounds, NLFilename) - ! + ! ! Initialize the ch4 finundated stream object ! ! Uses: @@ -82,12 +81,12 @@ subroutine Init(this, bounds, NLFilename) ! arguments implicit none class(ch4finundatedstream_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! local variables integer :: ig, g ! Indices - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information type(shr_strdata_type) :: sdat ! input data stream integer :: index_ZWT0 = 0 ! Index of ZWT0 field integer :: index_F0 = 0 ! Index of F0 field @@ -110,8 +109,8 @@ subroutine Init(this, bounds, NLFilename) call clm_domain_mct (bounds, dom_clm) call shr_strdata_create(sdat,name=stream_name,& - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -123,7 +122,7 @@ subroutine Init(this, bounds, NLFilename) domFileName=trim(control%stream_fldFileName_ch4finundated), & domTvarName='time', & domXvarName='LONGXY' , & - domYvarName='LATIXY' , & + domYvarName='LATIXY' , & domAreaName='AREA', & domMaskName='LANDMASK', & filePath='', & @@ -190,7 +189,7 @@ end subroutine Init logical function UseStreams(this) ! ! !DESCRIPTION: - ! Return true if + ! Return true if ! ! !USES: ! @@ -200,9 +199,9 @@ logical function UseStreams(this) ! ! !LOCAL VARIABLES: if ( trim(control%stream_fldFileName_ch4finundated) == '' )then - UseStreams = .false. + UseStreams = .false. else - UseStreams = .true. + UseStreams = .true. end if end function UseStreams @@ -245,7 +244,7 @@ subroutine CalcFinundated(this, bounds, num_soilc, filter_soilc, soilhydrology_i waterdiagnosticbulk_inst, qflx_surf_lag_col, finundated ) ! ! !DESCRIPTION: - ! + ! ! Calculate finundated according to the appropriate methodology ! ! !USES: @@ -311,8 +310,8 @@ end subroutine CalcFinundated !============================================================================== subroutine ReadNML(this, bounds, NLFilename) - ! - ! Read the namelist data stream information. + ! + ! Read the namelist data stream information. ! ! Uses: use clm_time_manager , only : get_calendar @@ -327,7 +326,7 @@ subroutine ReadNML(this, bounds, NLFilename) ! arguments implicit none class(streamcontrol_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! local variables diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index edca4150f8..421d729f0b 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -23,7 +23,7 @@ module SoilMoistureStreamMod use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use abortutils , only : endrun - use clm_varctl , only : scmlat,scmlon,single_column + use clm_varctl , only : scmlat,scmlon,single_column, inst_name use clm_varctl , only : iulog, use_soil_moisture_streams use clm_varcon , only : grlnd use controlMod , only : NLFilename @@ -31,14 +31,14 @@ module SoilMoistureStreamMod use domainMod , only : ldomain use fileutils , only : getavu, relavu use LandunitType , only : lun - use ColumnType , only : col + use ColumnType , only : col use SoilStateType , only : soilstate_type use WaterStateBulkType, only : waterstatebulk_type use perf_mod , only : t_startf, t_stopf use spmdMod , only : masterproc use spmdMod , only : mpicom, comp_id use mct_mod - use ncdio_pio + use ncdio_pio ! ! !PUBLIC TYPES: implicit none @@ -54,7 +54,7 @@ module SoilMoistureStreamMod integer :: ism ! Soil moisture steram index integer, allocatable :: g_to_ig(:) ! Array matching gridcell index to data index logical :: soilm_ignore_data_if_missing ! If should ignore overridding a point with soil moisture data - ! from the streams file, if the streams file shows that point + ! from the streams file, if the streams file shows that point ! as missing (namelist item) ! ! !PRIVATE TYPES: @@ -64,7 +64,7 @@ module SoilMoistureStreamMod !----------------------------------------------------------------------- contains - + !----------------------------------------------------------------------- ! ! soil_moisture_init @@ -93,11 +93,11 @@ subroutine PrescribedSoilMoistureInit(bounds) integer :: i ! index integer :: stream_year_first_soilm ! first year in Ustar stream to use integer :: stream_year_last_soilm ! last year in Ustar stream to use - integer :: model_year_align_soilm ! align stream_year_first_soilm with + integer :: model_year_align_soilm ! align stream_year_first_soilm with integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag integer :: soilm_offset ! Offset in time for dataset (sec) - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldfilename_soilm ! ustar stream filename to read character(len=CL) :: soilm_tintalgo = 'linear' ! Time interpolation alogrithm @@ -155,9 +155,9 @@ subroutine PrescribedSoilMoistureInit(bounds) write(iulog,*) ' ' write(iulog,*) 'soil_moisture_stream settings:' - write(iulog,*) ' stream_year_first_soilm = ',stream_year_first_soilm - write(iulog,*) ' stream_year_last_soilm = ',stream_year_last_soilm - write(iulog,*) ' model_year_align_soilm = ',model_year_align_soilm + write(iulog,*) ' stream_year_first_soilm = ',stream_year_first_soilm + write(iulog,*) ' stream_year_last_soilm = ',stream_year_last_soilm + write(iulog,*) ' model_year_align_soilm = ',model_year_align_soilm write(iulog,*) ' stream_fldfilename_soilm = ',trim(stream_fldfilename_soilm) write(iulog,*) ' soilm_tintalgo = ',trim(soilm_tintalgo) write(iulog,*) ' soilm_offset = ',soilm_offset @@ -177,10 +177,10 @@ subroutine PrescribedSoilMoistureInit(bounds) fldList = trim(soilmString) if (masterproc) write(iulog,*) 'fieldlist: ', trim(fldList) - + call shr_strdata_create(sdat_soilm,name="soil_moisture", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & gsmap=gsMap_lnd2Dsoi_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -193,8 +193,8 @@ subroutine PrescribedSoilMoistureInit(bounds) domFileName=trim(stream_fldFileName_soilm), & domTvarName='time', & domXvarName='lon' , & - domYvarName='lat' , & - domZvarName='levsoi' , & + domYvarName='lat' , & + domZvarName='levsoi' , & domAreaName='area', & domMaskName='mask', & filePath='', & @@ -307,7 +307,7 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & SHR_ASSERT_FL( (lbound(sdat_soilm%avs(1)%rAttr,2) <= g_to_ig(bounds%begg) ), sourcefile, __LINE__) SHR_ASSERT_FL( (ubound(sdat_soilm%avs(1)%rAttr,2) >= g_to_ig(bounds%endg)+(nlevsoi-1)*size(g_to_ig) ), sourcefile, __LINE__) associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) + dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Input/Output: [real(r8) (:,:) ] liquid water (kg/m2) h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Input/Output: [real(r8) (:,:) ] ice water (kg/m2) @@ -344,7 +344,7 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & do g = bounds%begg, bounds%endg ig = g_to_ig(g) do j = 1, nlevsoi - + !n = ig + (j-1)*size(g_to_ig) n = ig + (j-1)*size(g_to_ig) @@ -358,28 +358,28 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & end do end do - + do c = bounds%begc, bounds%endc ! ! Set variable for each gridcell/column combination ! g = col%gridcell(c) ig = g_to_ig(g) - + ! EBK Jan/2020, also check weights on gridcell (See https://github.com/ESCOMP/CTSM/issues/847) if ( (lun%itype(col%landunit(c)) == istsoil) .or. (lun%itype(col%landunit(c)) == istcrop) .and. & (col%wtgcell(c) /= 0._r8) ) then ! this is a 2d field (gridcell/nlevsoi) ! do j = 1, nlevsoi - + n = ig + (j-1)*size(g_to_ig) ! if soil water is zero, liq/ice fractions cannot be calculated if((h2osoi_liq(c, j) + h2osoi_ice(c, j)) > 0._r8) then - + ! save original soil moisture value h2osoi_vol_initial = h2osoi_vol(c,j) - + ! Check if the vegetated land mask from the dataset on the ! file is different if ( (h2osoi_vol_prs(g,j) == spval) .and. (h2osoi_vol_initial /= spval) )then @@ -413,7 +413,7 @@ subroutine PrescribedSoilMoistureInterp(bounds, soilstate_inst, & call endrun(subname // ':: ERROR h2osoil liquid plus ice is zero') endif enddo - endif + endif end do end associate diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index af583f8c65..112ccd72fa 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -223,6 +223,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call get_component_instance(gcomp, inst_suffix, inst_index, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return inst_name = 'LND' + !---------------------------------------------------------------------------- ! advertise fields !---------------------------------------------------------------------------- diff --git a/src/main/FireDataBaseType.F90 b/src/main/FireDataBaseType.F90 index 1e02033c95..ac7d28171f 100644 --- a/src/main/FireDataBaseType.F90 +++ b/src/main/FireDataBaseType.F90 @@ -11,7 +11,7 @@ module FireDataBaseType use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create, shr_strdata_print use shr_strdata_mod , only : shr_strdata_advance use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog + use clm_varctl , only : iulog, inst_name use spmdMod , only : masterproc, mpicom, comp_id use fileutils , only : getavu, relavu use decompMod , only : gsmap_lnd_gdc2glo @@ -102,7 +102,7 @@ subroutine BaseFireInit( this, bounds, NLFilename ) ! ! !ARGUMENTS: class(fire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename !----------------------------------------------------------------------- @@ -130,7 +130,7 @@ subroutine FireInterp(this,bounds) ! ! !ARGUMENTS: class(fire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds !----------------------------------------------------------------------- if ( this%need_lightning_and_popdens() ) then @@ -157,16 +157,16 @@ subroutine hdm_init( this, bounds, NLFilename ) ! !ARGUMENTS: implicit none class(fire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! !LOCAL VARIABLES: integer :: stream_year_first_popdens ! first year in pop. dens. stream to use integer :: stream_year_last_popdens ! last year in pop. dens. stream to use - integer :: model_year_align_popdens ! align stream_year_first_hdm with + integer :: model_year_align_popdens ! align stream_year_first_hdm with integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_popdens ! population density streams filename character(len=CL) :: popdensmapalgo = 'bilinear' ! mapping alogrithm for population density character(len=CL) :: popdens_tintalgo = 'nearest'! time interpolation alogrithm for population density @@ -212,9 +212,9 @@ subroutine hdm_init( this, bounds, NLFilename ) if (masterproc) then write(iulog,*) ' ' write(iulog,*) 'popdens_streams settings:' - write(iulog,*) ' stream_year_first_popdens = ',stream_year_first_popdens - write(iulog,*) ' stream_year_last_popdens = ',stream_year_last_popdens - write(iulog,*) ' model_year_align_popdens = ',model_year_align_popdens + write(iulog,*) ' stream_year_first_popdens = ',stream_year_first_popdens + write(iulog,*) ' stream_year_last_popdens = ',stream_year_last_popdens + write(iulog,*) ' model_year_align_popdens = ',model_year_align_popdens write(iulog,*) ' stream_fldFileName_popdens = ',stream_fldFileName_popdens write(iulog,*) ' popdens_tintalgo = ',popdens_tintalgo write(iulog,*) ' ' @@ -223,8 +223,8 @@ subroutine hdm_init( this, bounds, NLFilename ) call clm_domain_mct (bounds, dom_clm) call shr_strdata_create(this%sdat_hdm,name="clmhdm", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -236,7 +236,7 @@ subroutine hdm_init( this, bounds, NLFilename ) domFileName=trim(stream_fldFileName_popdens), & domTvarName='time', & domXvarName='lon' , & - domYvarName='lat' , & + domYvarName='lat' , & domAreaName='area', & domMaskName='mask', & filePath='', & @@ -259,7 +259,7 @@ subroutine hdm_init( this, bounds, NLFilename ) ptr_lnd=this%forc_hdm, default='inactive') end subroutine hdm_init - + !----------------------------------------------------------------------- subroutine hdm_interp( this, bounds) ! @@ -271,7 +271,7 @@ subroutine hdm_interp( this, bounds) ! ! !ARGUMENTS: class(fire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: g, ig @@ -292,7 +292,7 @@ subroutine hdm_interp( this, bounds) ig = ig+1 this%forc_hdm(g) = this%sdat_hdm%avs(1)%rAttr(1,ig) end do - + end subroutine hdm_interp !----------------------------------------------------------------------- @@ -313,16 +313,16 @@ subroutine lnfm_init( this, bounds, NLFilename ) ! !ARGUMENTS: implicit none class(fire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! ! !LOCAL VARIABLES: integer :: stream_year_first_lightng ! first year in Lightning stream to use integer :: stream_year_last_lightng ! last year in Lightning stream to use - integer :: model_year_align_lightng ! align stream_year_first_lnfm with + integer :: model_year_align_lightng ! align stream_year_first_lnfm with integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information + type(mct_ggrid) :: dom_clm ! domain information character(len=CL) :: stream_fldFileName_lightng ! lightning stream filename to read character(len=CL) :: lightng_tintalgo = 'linear'! time interpolation alogrithm character(len=CL) :: lightngmapalgo = 'bilinear'! Mapping alogrithm @@ -368,9 +368,9 @@ subroutine lnfm_init( this, bounds, NLFilename ) if (masterproc) then write(iulog,*) ' ' write(iulog,*) 'light_stream settings:' - write(iulog,*) ' stream_year_first_lightng = ',stream_year_first_lightng - write(iulog,*) ' stream_year_last_lightng = ',stream_year_last_lightng - write(iulog,*) ' model_year_align_lightng = ',model_year_align_lightng + write(iulog,*) ' stream_year_first_lightng = ',stream_year_first_lightng + write(iulog,*) ' stream_year_last_lightng = ',stream_year_last_lightng + write(iulog,*) ' model_year_align_lightng = ',model_year_align_lightng write(iulog,*) ' stream_fldFileName_lightng = ',stream_fldFileName_lightng write(iulog,*) ' lightng_tintalgo = ',lightng_tintalgo write(iulog,*) ' ' @@ -379,8 +379,8 @@ subroutine lnfm_init( this, bounds, NLFilename ) call clm_domain_mct (bounds, dom_clm) call shr_strdata_create(this%sdat_lnfm,name="clmlnfm", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_subsystem=pio_subsystem, & + pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -392,7 +392,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) domFileName=trim(stream_fldFileName_lightng), & domTvarName='time', & domXvarName='lon' , & - domYvarName='lat' , & + domYvarName='lat' , & domAreaName='area', & domMaskName='mask', & filePath='', & @@ -415,7 +415,7 @@ subroutine lnfm_init( this, bounds, NLFilename ) ptr_lnd=this%forc_lnfm, default='inactive') end subroutine lnfm_init - + !----------------------------------------------------------------------- subroutine lnfm_interp(this, bounds ) ! @@ -427,7 +427,7 @@ subroutine lnfm_interp(this, bounds ) ! ! !ARGUMENTS: class(fire_base_type) :: this - type(bounds_type), intent(in) :: bounds + type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: integer :: g, ig @@ -448,7 +448,7 @@ subroutine lnfm_interp(this, bounds ) ig = ig+1 this%forc_lnfm(g) = this%sdat_lnfm%avs(1)%rAttr(1,ig) end do - + end subroutine lnfm_interp end module FireDataBaseType diff --git a/src/main/ndepStreamMod.F90 b/src/main/ndepStreamMod.F90 index 3d79dfff04..4741e879ea 100644 --- a/src/main/ndepStreamMod.F90 +++ b/src/main/ndepStreamMod.F90 @@ -12,7 +12,7 @@ module ndepStreamMod use shr_strdata_mod, only: shr_strdata_print, shr_strdata_advance use mct_mod , only: mct_ggrid use spmdMod , only: mpicom, masterproc, comp_id, iam - use clm_varctl , only: iulog + use clm_varctl , only: iulog, inst_name use abortutils , only: endrun use fileutils , only: getavu, relavu use decompMod , only: bounds_type, ldecomp @@ -57,7 +57,7 @@ subroutine ndep_init(bounds, NLFilename) use shr_nl_mod , only : shr_nl_find_group_name use shr_log_mod , only : errMsg => shr_log_errMsg use shr_mpi_mod , only : shr_mpi_bcast - use decompMod , only : gsmap_lnd_gdc2glo + use decompMod , only : gsmap_lnd_gdc2glo ! ! arguments implicit none @@ -138,7 +138,7 @@ subroutine ndep_init(bounds, NLFilename) call shr_strdata_create(sdat,name="clmndep", & pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype('LND'), & + pio_iotype=shr_pio_getiotype(inst_name), & mpicom=mpicom, compid=comp_id, & gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & nxg=ldomain%ni, nyg=ldomain%nj, & @@ -301,7 +301,7 @@ subroutine clm_domain_mct(bounds, dom_clm, nlevels) ! Initialize mct domain type ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) ! Note that in addition land carries around landfrac for the purposes of domain checking - ! + ! lsize = mct_gsMap_lsize(gsmap, mpicom) call mct_gGrid_init( GGrid=dom_clm, & CoordChars='lat:lon:hgt', OtherChars='area:aream:mask:frac', lsize=lsize ) @@ -338,7 +338,7 @@ subroutine clm_domain_mct(bounds, dom_clm, nlevels) data(i) = ldomain%lonc(g) end do end do - call mct_gGrid_importRattr(dom_clm,"lon",data,lsize) + call mct_gGrid_importRattr(dom_clm,"lon",data,lsize) do k = 1, nlevs do g = bounds%begg,bounds%endg @@ -346,7 +346,7 @@ subroutine clm_domain_mct(bounds, dom_clm, nlevels) data(i) = ldomain%latc(g) end do end do - call mct_gGrid_importRattr(dom_clm,"lat",data,lsize) + call mct_gGrid_importRattr(dom_clm,"lat",data,lsize) do k = 1, nlevs do g = bounds%begg,bounds%endg @@ -354,7 +354,7 @@ subroutine clm_domain_mct(bounds, dom_clm, nlevels) data(i) = ldomain%area(g)/(re*re) end do end do - call mct_gGrid_importRattr(dom_clm,"area",data,lsize) + call mct_gGrid_importRattr(dom_clm,"area",data,lsize) do k = 1, nlevs do g = bounds%begg,bounds%endg @@ -362,7 +362,7 @@ subroutine clm_domain_mct(bounds, dom_clm, nlevels) data(i) = real(ldomain%mask(g), r8) end do end do - call mct_gGrid_importRattr(dom_clm,"mask",data,lsize) + call mct_gGrid_importRattr(dom_clm,"mask",data,lsize) do k = 1, nlevs do g = bounds%begg,bounds%endg @@ -370,7 +370,7 @@ subroutine clm_domain_mct(bounds, dom_clm, nlevels) data(i) = real(ldomain%frac(g), r8) end do end do - call mct_gGrid_importRattr(dom_clm,"frac",data,lsize) + call mct_gGrid_importRattr(dom_clm,"frac",data,lsize) deallocate(data) deallocate(idata) From e921f5a507fdee396a4e46d28e3c72ea2fdd8023 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 16 Nov 2020 09:46:27 -0700 Subject: [PATCH 1637/1973] Updated comment about table column widths --- src/main/histFileMod.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 9889c13960..fcfc469944 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -335,9 +335,11 @@ subroutine hist_printflds() ! Print master field list in separate file if namelist variable ! requests it if (masterproc .and. hist_master_list_file) then - ! hardwired table column widths to fit table on a computer - ! screen; TODO test whether text will wrap around in available - ! space in sphinx + ! Hardwired table column widths to fit the table on a computer + ! screen. Some strings will be truncated as a result of the + ! current choices (4, 39, 94, 65). In sphinx (ie the web-based + ! documentation), text that has not been truncated will wrap + ! around in the available space. width_col_1 = 4 ! column that shows the variable number, nf width_col_2 = 39 ! variable name column width_col_3 = 94 ! long description column From d1f47de51ccc69103656e0436c38831847a16dc1 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 16 Nov 2020 10:17:53 -0700 Subject: [PATCH 1638/1973] First draft of updated ChangeLog --- doc/ChangeLog | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 129 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 5a08b657dd..e4bfe26cc5 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,132 @@ =============================================================== +Tag name: ctsm5.1.dev016 +Originator(s): slevis (Samuel Levis,303-665-1310) +Date: Mon Nov 16 09:50:47 MST 2020 +One-line Summary: Write history filds master list to separate optional file + +Purpose of changes +------------------ + + User can choose to write the history fields master list in a separate + text file by setting hist_master_list_file = .true. in CTSM's namelist. + + File contents follow recommended reStructuredText "simple table" + formatting (see + https://docutils.sourceforge.io/docs/user/rst/quickref.html#tables) + for use in CTSM documentation in the sphinx environment. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #34 #941 #29 TODO: CONFIRM LAST ONE*** + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + New namelist option hist_master_list_file. Setting to true generates a + new text output file containing the history fields master list. + +Changes made to namelist defaults (e.g., changed parameter values): + Default for hist_master_list_file = .false. + +Changes to the datasets (e.g., parameter, surface or initial files): + None + +Substantial timing or memory changes: + No + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + None + +Changes to tests or testing: + Introduced testing for the new namelist option within the existing test + ERP_P36x2_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-extra_outputs + by adding hist_master_list_file = .true. to the test's user_nl_clm + +CTSM testing: + +[... Remove before making master tag. Available test levels: + + a) regular (must be run before handing off a tag to SEs and must be run + before committing a tag) + b) build_namelist (if namelists and/or build_system changed)) + c) tools (only if tools are modified and no CTSM source is modified) + d) short (for use during development and in rare cases where only a small + change with known behavior is added ... eg. a minor bug fix) + e) doc (no source testing required) + +... ] + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- TODO + izumi ------- TODO + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + No + +Detailed list of changes +------------------------ + + Added section to subr. hist_printflds (called by subr. initialize2). + The new section runs when hist_master_list_file = .true. + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + None + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/CTSM/pull/1209 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev015 Originator(s): sacks (Bill Sacks) Date: Fri Nov 13 11:52:34 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index b706eeea98..907a297eb4 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev016 slevis 11/16/2020 Write history filds master list to separate optional file ctsm5.1.dev015 sacks 11/13/2020 A few small fixes ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes ctsm5.1.dev013 jedwards 11/04/2020 Allow pnetcdf for vector history files From bfb1ba85218e53d97d09d383df9c29ae562d96a5 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 16 Nov 2020 10:31:20 -0700 Subject: [PATCH 1639/1973] Updated comment about .rst output --- src/main/histFileMod.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index fcfc469944..53485f33ef 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -332,8 +332,10 @@ subroutine hist_printflds() call shr_sys_flush(iulog) end if - ! Print master field list in separate file if namelist variable - ! requests it + ! Print master field list in separate text file when namelist + ! variable requests it. Text file is formatted in the .rst + ! (reStructuredText) format for easy introduction of the file to + ! the CTSM's web-based documentation. if (masterproc .and. hist_master_list_file) then ! Hardwired table column widths to fit the table on a computer ! screen. Some strings will be truncated as a result of the From a2ab3ee46cb2d8b77d5e59ae70a4485824ec8c8a Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 16 Nov 2020 20:59:16 -0700 Subject: [PATCH 1640/1973] Introduce link to master_list_file.rst and add README file --- .../README_master_list_file | 9 +++++++++ .../customizing-the-clm-namelist.rst | 2 +- .../users_guide/setting-up-and-running-a-case/index.rst | 1 + .../setting-up-and-running-a-case/master_list_file.rst | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 doc/source/users_guide/setting-up-and-running-a-case/README_master_list_file diff --git a/doc/source/users_guide/setting-up-and-running-a-case/README_master_list_file b/doc/source/users_guide/setting-up-and-running-a-case/README_master_list_file new file mode 100644 index 0000000000..ac9fa73864 --- /dev/null +++ b/doc/source/users_guide/setting-up-and-running-a-case/README_master_list_file @@ -0,0 +1,9 @@ +2020/11/16 slevis + +The file master_list_file.rst contains a table of the history fields, +active and inactive, available in the CTSM case that gets generated by +this test: +ERP_P36x2_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-extra_outputs + +To reproduce master_list_file.rst, run the above test and the file +will appear in the run directory. diff --git a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst index a7d19c40dd..2712c70ae7 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/customizing-the-clm-namelist.rst @@ -43,7 +43,7 @@ Included in the table are the following pieces of information: Table 1-3. CLM History Fields ----------------------------- -Table `master_list_file` +For Table, please see :doc:`master_list_file`. --------------------------------------------- diff --git a/doc/source/users_guide/setting-up-and-running-a-case/index.rst b/doc/source/users_guide/setting-up-and-running-a-case/index.rst index 3fb9a41391..4703223c73 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/index.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/index.rst @@ -18,4 +18,5 @@ Setting Up and Running a Case customizing-the-clm-configuration.rst customizing-the-clm-namelist.rst customizing-the-datm-namelist.rst + master_list_file diff --git a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst index e1f4171e79..0410f123b8 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst @@ -1,3 +1,8 @@ + +==================== + CTSM History Fields +==================== + ==== ======================================= ============================================================================================== ================================================================= CTSM History Fields ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- From 3a2ea60e1aac83e66fcaba2e77d8724100bd3965 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 16 Nov 2020 21:23:15 -0700 Subject: [PATCH 1641/1973] Minor formatting change in units of a history field --- doc/ChangeLog | 2 +- src/biogeophys/PhotosynthesisMod.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index e4bfe26cc5..175ebb4745 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -18,7 +18,7 @@ Purpose of changes Bugs fixed or introduced ------------------------ -Issues fixed (include CTSM Issue #): #34 #941 #29 TODO: CONFIRM LAST ONE*** +Issues fixed (include CTSM Issue #): #34 #941 Significant changes to scientifically-supported configurations -------------------------------------------------------------- diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 31289b0ca3..44e28a681c 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -586,7 +586,7 @@ subroutine InitHistory(this, bounds) endif this%fpsn24_patch = spval - call hist_addfld1d (fname='FPSN24', units='umol CO2/m**2 ground/day',& + call hist_addfld1d (fname='FPSN24', units='umol CO2/m^2 ground/day',& avgflag='A', long_name='24 hour accumulative patch photosynthesis starting from mid-night', & ptr_patch=this%fpsn24_patch, default='inactive') From aa228c5d89ee85793bd36ff05476555a8e043afc Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 17 Nov 2020 10:51:19 -0700 Subject: [PATCH 1642/1973] Last commit's formatting chg, now visible in the new .rst file Also adding the code that inserts the new .rst file's title --- .../master_list_file.rst | 9 ++++---- src/main/histFileMod.F90 | 21 ++++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst index 0410f123b8..93356473ed 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst @@ -1,7 +1,6 @@ - -==================== - CTSM History Fields -==================== +=================== +CTSM History Fields +=================== ==== ======================================= ============================================================================================== ================================================================= CTSM History Fields @@ -431,7 +430,7 @@ 421 VCMX25T canopy profile of vcmax25 umol/m2/s 422 JMX25T canopy profile of jmax umol/m2/s 423 TPU25T canopy profile of tpu umol/m2/s - 424 FPSN24 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m**2 ground/day + 424 FPSN24 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m^2 ground/day 425 QCHARGE aquifer recharge rate (natural vegetated and crop landunits only) mm/s 426 NSUBSTEPS number of adaptive timesteps in CLM timestep unitless 427 FROST_TABLE frost table depth (natural vegetated and crop landunits only) m diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 53485f33ef..f6caf58e57 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -362,9 +362,16 @@ subroutine hist_printflds() open(unit = master_list_file, file = 'master_list_file.rst', & status = 'new', action = 'write', form = 'formatted') - ! File header + ! File title + fmt_txt = '(19a)' + write(master_list_file,fmt_txt) '===================' + write(master_list_file,fmt_txt) 'CTSM History Fields' + write(master_list_file,fmt_txt) '===================' + write(master_list_file,*) + + ! Table header ! Concatenate strings needed in format statement - fmt_txt = '('//str_w_col_1//'a,1x,'//str_w_col_2//'a,1x,'//str_w_col_3//'a,1x,'//str_w_col_4//'a)' + fmt_txt = '('//str_w_col_1//'a,x,'//str_w_col_2//'a,x,'//str_w_col_3//'a,x,'//str_w_col_4//'a)' write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & ('=', i=1, width_col_2), & ('=', i=1, width_col_3), & @@ -377,13 +384,13 @@ subroutine hist_printflds() fmt_txt = '('//str_w_col_sum//'a)' write(master_list_file,fmt_txt) ('-', i=1, width_col_sum) ! Concatenate strings needed in format statement - fmt_txt = '('//'a'//str_w_col_1//',1x,a'//str_w_col_2//',1x,a'//str_w_col_3//',1x,a'//str_w_col_4//')' + fmt_txt = '('//'a'//str_w_col_1//',x,a'//str_w_col_2//',x,a'//str_w_col_3//',x,a'//str_w_col_4//')' write(master_list_file,fmt_txt) '#', 'Variable Name', & 'Long Description', 'Units' ! End header, same as header ! Concatenate strings needed in format statement - fmt_txt = '('//str_w_col_1//'a,1x,'//str_w_col_2//'a,1x,'//str_w_col_3//'a,1x,'//str_w_col_4//'a)' + fmt_txt = '('//str_w_col_1//'a,x,'//str_w_col_2//'a,x,'//str_w_col_3//'a,x,'//str_w_col_4//'a)' write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & ('=', i=1, width_col_2), & ('=', i=1, width_col_3), & @@ -391,7 +398,7 @@ subroutine hist_printflds() ! Main table ! Concatenate strings needed in format statement - fmt_txt = '('//'i'//str_w_col_1//',1x,a'//str_w_col_2//',1x,a'//str_w_col_3//',1x,a'//str_w_col_4//')' + fmt_txt = '('//'i'//str_w_col_1//',x,a'//str_w_col_2//',x,a'//str_w_col_3//',x,a'//str_w_col_4//')' do nf = 1,nfmaster write(master_list_file,fmt_txt) nf, & masterlist(nf)%field%name, & @@ -399,9 +406,9 @@ subroutine hist_printflds() masterlist(nf)%field%units end do - ! File footer, same as header + ! Table footer, same as header ! Concatenate strings needed in format statement - fmt_txt = '('//str_w_col_1//'a,1x,'//str_w_col_2//'a,1x,'//str_w_col_3//'a,1x,'//str_w_col_4//'a)' + fmt_txt = '('//str_w_col_1//'a,x,'//str_w_col_2//'a,x,'//str_w_col_3//'a,x,'//str_w_col_4//'a)' write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & ('=', i=1, width_col_2), & ('=', i=1, width_col_3), & From 488dba30742572628ac1522b059e48c9c5f9e5ec Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 17 Nov 2020 11:09:59 -0700 Subject: [PATCH 1643/1973] Adding value=.false. also in namelist_definition_ctsm.xml --- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 166ce7a93d..23612b2c88 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -730,7 +730,7 @@ SNICAR (SNow, ICe, and Aerosol Radiative model) snow aging data file name + group="clm_inparm" valid_values="" value=".false."> If TRUE, write master field list to separate file for documentation purposes From 1a4bdd2df3f27d56c16e4b689c095d25e385fa87 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 17 Nov 2020 11:10:19 -0700 Subject: [PATCH 1644/1973] Update ChangeLog --- doc/ChangeLog | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 103 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 5a08b657dd..cdb7e6fa8f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,106 @@ =============================================================== +Tag name: ctsm5.1.dev016 +Originator(s): mvertens (Mariana Vertenstein), jedwards (Jim Edwards), + sacks (Bill Sacks), erik (Erik Kluzek) +Date: Tue Nov 17 10:49:40 MST 2020 +One-line Summary: Updates for nuopc + +Purpose of changes +------------------ + +Various updates needed for NUOPC. + +Also adds mizuRoute as an external component. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- SoilMoistureStreamMod now is duplicated: the version used with mct is + still in src/biogeochem, but there is a new version used with nuopc + and the CDEPS data models in src/cpl/nuopc. The latter has just been + introduced for testing purposes. Eventually, once we switch everything + to use CDEPS, we'll remove this duplicated version. + +Changes to tests or testing: none + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- Added mizuRoute (at 34723c2) +- cime: branch_tags/cime5.8.32_a01 -> branch_tags/cime5.8.32_a02 +- (Some other rearrangement of Externals files, but versions stayed the + same) + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev015 Originator(s): sacks (Bill Sacks) Date: Fri Nov 13 11:52:34 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index b706eeea98..d31073d7f4 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev016 multiple 11/17/2020 Updates for nuopc ctsm5.1.dev015 sacks 11/13/2020 A few small fixes ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes ctsm5.1.dev013 jedwards 11/04/2020 Allow pnetcdf for vector history files From ce8070dc14059df9932164d998470776025a5d5b Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 17 Nov 2020 12:14:37 -0700 Subject: [PATCH 1645/1973] Minor format statmt and ChangeLog updates --- doc/ChangeLog | 4 ++-- doc/ChangeSum | 2 +- src/main/histFileMod.F90 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 175ebb4745..b3db3ca854 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== -Tag name: ctsm5.1.dev016 +Tag name: ctsm5.1.dev017 Originator(s): slevis (Samuel Levis,303-665-1310) -Date: Mon Nov 16 09:50:47 MST 2020 +Date: Mon Nov 17 11:15:47 MST 2020 One-line Summary: Write history filds master list to separate optional file Purpose of changes diff --git a/doc/ChangeSum b/doc/ChangeSum index 907a297eb4..a161a88513 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev016 slevis 11/16/2020 Write history filds master list to separate optional file + ctsm5.1.dev017 slevis 11/18/2020 Write history filds master list to separate optional file ctsm5.1.dev015 sacks 11/13/2020 A few small fixes ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes ctsm5.1.dev013 jedwards 11/04/2020 Allow pnetcdf for vector history files diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index f6caf58e57..10d101c0e7 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -363,7 +363,7 @@ subroutine hist_printflds() status = 'new', action = 'write', form = 'formatted') ! File title - fmt_txt = '(19a)' + fmt_txt = '(a)' write(master_list_file,fmt_txt) '===================' write(master_list_file,fmt_txt) 'CTSM History Fields' write(master_list_file,fmt_txt) '===================' From 1ca9047b719e8f9dedc51960fc5b7a31b385afe1 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 17 Nov 2020 18:21:49 -0700 Subject: [PATCH 1646/1973] Updated ChangeLog/ChangeSum --- doc/ChangeLog | 6 +++--- doc/ChangeSum | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index ae28281951..25b3735c38 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev017 Originator(s): slevis (Samuel Levis,303-665-1310) -Date: Mon Nov 17 11:15:47 MST 2020 +Date: Tue Nov 17 18:19:20 MST 2020 One-line Summary: Write history filds master list to separate optional file Purpose of changes @@ -101,8 +101,8 @@ CTSM testing: regular tests (aux_clm): - cheyenne ---- TODO - izumi ------- TODO + cheyenne ---- OK (NLCOMP tests fail as expected) + izumi ------- OK (NLCOMP tests fail as expected) If the tag used for baseline comparisons was NOT the previous tag, note that here: diff --git a/doc/ChangeSum b/doc/ChangeSum index 20f0568671..919b11ec43 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev017 slevis 11/18/2020 Write history filds master list to separate optional file + ctsm5.1.dev017 slevis 11/17/2020 Write history filds master list to separate optional file ctsm5.1.dev016 multiple 11/17/2020 Updates for nuopc ctsm5.1.dev015 sacks 11/13/2020 A few small fixes ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes From d828aa0d7fdd8e0caf5ea7bb5a31a339d17fef45 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 18 Nov 2020 16:56:13 -0800 Subject: [PATCH 1647/1973] initial attempt at creating new age x fuel size class dimension --- src/main/histFileMod.F90 | 11 +++++++++++ src/utils/clmfates_interfaceMod.F90 | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index ffb034cd6d..32cbefb932 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2092,6 +2092,7 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'fates_levelpft', num_elements_fates * numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levelcwd', num_elements_fates * ncwd, dimid) call ncd_defdim(lnfid, 'fates_levelage', num_elements_fates * nlevage, dimid) + call ncd_defdim(lnfid, 'fates_levagenfsc', nlevage * nfsc, dimid) end if if ( .not. lhistrest )then @@ -2640,6 +2641,12 @@ subroutine htape_timeconst(t, mode) long_name='FATES pft map into patch age x pft', units='-', ncid=nfid(t)) call ncd_defvar(varname='fates_agmap_levagepft', xtype=ncd_int, dim1name='fates_levagepft', & long_name='FATES age-class map into patch age x pft', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_agmap_levagenfsc', xtype=ncd_int, dim1name='fates_levagenfsc', & + long_name='FATES age-class map into patch age x fuel size', units='-', ncid=nfid(t)) + call ncd_defvar(varname='fates_fscmap_levagenfsc', xtype=ncd_int, dim1name='fates_levagenfsc', & + long_name='FATES fuel size-class map into patch age x fuel size', units='-', ncid=nfid(t)) + + end if @@ -2679,6 +2686,8 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='fates_pftmap_levscagpft',data=fates_hdim_pftmap_levscagpft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levagepft',data=fates_hdim_pftmap_levagepft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_agmap_levagepft',data=fates_hdim_agmap_levagepft, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_agmap_levagenfsc',data=fates_hdim_agmap_levagenfsc, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_fscmap_levagenfsc',data=fates_hdim_fscmap_levagenfsc, ncid=nfid(t), flag='write') end if endif @@ -4946,6 +4955,8 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, num2d = num_elements_fates*ncwd case ('fates_levelage') num2d = num_elements_fates*nlevage + case ('fates_levagenfsc') + num2d = nlevage*nfsc case('cft') if (cft_size > 0) then num2d = cft_size diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 140c74267c..d98d5508e8 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2363,7 +2363,7 @@ subroutine init_history_io(this,bounds_proc) use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 use FatesIOVariableKindMod, only : site_height_r8, site_elem_r8, site_elpft_r8 - use FatesIOVariableKindMod, only : site_elcwd_r8, site_elage_r8 + use FatesIOVariableKindMod, only : site_elcwd_r8, site_elage_r8, site_agenfsc_r8 use FatesIODimensionsMod, only : fates_bounds_type @@ -2502,7 +2502,7 @@ subroutine init_history_io(this,bounds_proc) site_fuel_r8, site_cwdsc_r8, & site_can_r8,site_cnlf_r8, site_cnlfpft_r8, site_scag_r8, & site_scagpft_r8, site_agepft_r8, site_elem_r8, site_elpft_r8, & - site_elcwd_r8, site_elage_r8) + site_elcwd_r8, site_elage_r8, site_agenfsc_r8) d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index @@ -2876,6 +2876,10 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%elage_begin = 1 fates%elage_end = num_elements * nlevage + fates%agenfsc_begin = 1 + fates%agenfsc_end = nlevage * nfsc + + call t_stopf('fates_hlm2fatesbnds') end subroutine hlm_bounds_to_fates_bounds From aec6dd0a5e1c1fc1446572918fe225f9c4af1d34 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 18 Nov 2020 22:46:33 -0800 Subject: [PATCH 1648/1973] change naming of age x fuel size class to agefuel --- src/main/histFileMod.F90 | 12 ++++++------ src/utils/clmfates_interfaceMod.F90 | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 32cbefb932..857590464a 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2092,7 +2092,7 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'fates_levelpft', num_elements_fates * numpft_fates, dimid) call ncd_defdim(lnfid, 'fates_levelcwd', num_elements_fates * ncwd, dimid) call ncd_defdim(lnfid, 'fates_levelage', num_elements_fates * nlevage, dimid) - call ncd_defdim(lnfid, 'fates_levagenfsc', nlevage * nfsc, dimid) + call ncd_defdim(lnfid, 'fates_levagefuel', nlevage * nfsc, dimid) end if if ( .not. lhistrest )then @@ -2641,9 +2641,9 @@ subroutine htape_timeconst(t, mode) long_name='FATES pft map into patch age x pft', units='-', ncid=nfid(t)) call ncd_defvar(varname='fates_agmap_levagepft', xtype=ncd_int, dim1name='fates_levagepft', & long_name='FATES age-class map into patch age x pft', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_agmap_levagenfsc', xtype=ncd_int, dim1name='fates_levagenfsc', & + call ncd_defvar(varname='fates_agmap_levagefuel', xtype=ncd_int, dim1name='fates_levagefuel', & long_name='FATES age-class map into patch age x fuel size', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_fscmap_levagenfsc', xtype=ncd_int, dim1name='fates_levagenfsc', & + call ncd_defvar(varname='fates_fscmap_levagefuel', xtype=ncd_int, dim1name='fates_levagefuel', & long_name='FATES fuel size-class map into patch age x fuel size', units='-', ncid=nfid(t)) @@ -2686,8 +2686,8 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='fates_pftmap_levscagpft',data=fates_hdim_pftmap_levscagpft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_pftmap_levagepft',data=fates_hdim_pftmap_levagepft, ncid=nfid(t), flag='write') call ncd_io(varname='fates_agmap_levagepft',data=fates_hdim_agmap_levagepft, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_agmap_levagenfsc',data=fates_hdim_agmap_levagenfsc, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_fscmap_levagenfsc',data=fates_hdim_fscmap_levagenfsc, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_agmap_levagefuel',data=fates_hdim_agmap_levagefuel, ncid=nfid(t), flag='write') + call ncd_io(varname='fates_fscmap_levagefuel',data=fates_hdim_fscmap_levagefuel, ncid=nfid(t), flag='write') end if endif @@ -4955,7 +4955,7 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, num2d = num_elements_fates*ncwd case ('fates_levelage') num2d = num_elements_fates*nlevage - case ('fates_levagenfsc') + case ('fates_levagefuel') num2d = nlevage*nfsc case('cft') if (cft_size > 0) then diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index d98d5508e8..ab62a6cb6f 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2363,7 +2363,7 @@ subroutine init_history_io(this,bounds_proc) use FatesIOVariableKindMod, only : site_scagpft_r8, site_agepft_r8 use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 use FatesIOVariableKindMod, only : site_height_r8, site_elem_r8, site_elpft_r8 - use FatesIOVariableKindMod, only : site_elcwd_r8, site_elage_r8, site_agenfsc_r8 + use FatesIOVariableKindMod, only : site_elcwd_r8, site_elage_r8, site_agefuel_r8 use FatesIODimensionsMod, only : fates_bounds_type @@ -2502,7 +2502,7 @@ subroutine init_history_io(this,bounds_proc) site_fuel_r8, site_cwdsc_r8, & site_can_r8,site_cnlf_r8, site_cnlfpft_r8, site_scag_r8, & site_scagpft_r8, site_agepft_r8, site_elem_r8, site_elpft_r8, & - site_elcwd_r8, site_elage_r8, site_agenfsc_r8) + site_elcwd_r8, site_elage_r8, site_agefuel_r8) d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index @@ -2876,8 +2876,8 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%elage_begin = 1 fates%elage_end = num_elements * nlevage - fates%agenfsc_begin = 1 - fates%agenfsc_end = nlevage * nfsc + fates%agefuel_begin = 1 + fates%agefuel_end = nlevage * nfsc call t_stopf('fates_hlm2fatesbnds') From 0392347e51747abf16039b2d4771cc97785be987 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 18 Nov 2020 23:02:07 -0800 Subject: [PATCH 1649/1973] fixing error due to missing use of FatesInterfaceTypesMod --- src/main/histFileMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 857590464a..d7be796315 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -2537,6 +2537,8 @@ subroutine htape_timeconst(t, mode) use FatesInterfaceTypesMod, only : fates_hdim_cwdmap_levelcwd use FatesInterfaceTypesMod, only : fates_hdim_elmap_levelage use FatesInterfaceTypesMod, only : fates_hdim_agemap_levelage + use FatesInterfaceTypesMod, only : fates_hdim_agmap_levagefuel + use FatesInterfaceTypesMod, only : fates_hdim_fscmap_levagefuel ! From 5bbf08978949823f8e84c3b5e9ff0808ab190875 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 19 Nov 2020 06:51:34 -0700 Subject: [PATCH 1650/1973] Fix typo in ChangeLog --- doc/ChangeLog | 2 +- doc/ChangeSum | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 25b3735c38..af92011009 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,7 +2,7 @@ Tag name: ctsm5.1.dev017 Originator(s): slevis (Samuel Levis,303-665-1310) Date: Tue Nov 17 18:19:20 MST 2020 -One-line Summary: Write history filds master list to separate optional file +One-line Summary: Write history fields master list to separate optional file Purpose of changes ------------------ diff --git a/doc/ChangeSum b/doc/ChangeSum index 919b11ec43..1179769937 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev017 slevis 11/17/2020 Write history filds master list to separate optional file + ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file ctsm5.1.dev016 multiple 11/17/2020 Updates for nuopc ctsm5.1.dev015 sacks 11/13/2020 A few small fixes ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes From 95499126f813877a6c5fd2847594dd8c8d67752b Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 19 Nov 2020 06:53:34 -0700 Subject: [PATCH 1651/1973] Remove findHistFields.pl This no longer works, and has been superseded by the changes in https://github.com/ESCOMP/CTSM/pull/1209 --- src/main/findHistFields.pl | 546 ------------------------------------- 1 file changed, 546 deletions(-) delete mode 100755 src/main/findHistFields.pl diff --git a/src/main/findHistFields.pl b/src/main/findHistFields.pl deleted file mode 100755 index 34bc7a7f9f..0000000000 --- a/src/main/findHistFields.pl +++ /dev/null @@ -1,546 +0,0 @@ -#!/usr/bin/env perl -# -# This perl script reads in the histFldsMod.F90 file to find the total list of history -# fields that can be added for this model version, regardless of namelist options, or -# CPP processing. -# -use strict; -#use warnings; -#use diagnostics; - -use Cwd; -use English; -use Getopt::Long; -use IO::File; -use File::Glob ':glob'; - -# Set the directory that contains the CLM configuration scripts. If the command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume -# the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script - # is in - # the user's PATH -my $cmdline = "@ARGV"; # Command line arguments to script -my $cwd = getcwd(); # current working directory -my $cfgdir; # absolute pathname of directory that contains this script -my $nm = "${ProgName}::"; # name to use if script dies -if ($ProgDir) { - $cfgdir = $ProgDir; -} else { - $cfgdir = $cwd; -} -# The namelist definition file contains entries for all namelist variables that -# can be output by build-namelist. -my $nl_definition_file = "$cfgdir/../../bld/namelist_files/namelist_definition_ctsm.xml"; -(-f "$nl_definition_file") or die <<"EOF"; -** $ProgName - Cannot find namelist definition file \"$nl_definition_file\" ** -EOF -print "Using namelist definition file $nl_definition_file\n"; - -# The Build::NamelistDefinition module provides utilities to get the list of -# megan compounds - -#The root directory to cesm utils Tools -my $cesm_tools = "$cfgdir/../../../../cime/utils/"; - -if ( ! -f "$cesm_tools/perl5lib/Build/NamelistDefinition.pm") { - $cesm_tools = "$cfgdir/../../cime/utils/"; - if ( ! -f "$cesm_tools/perl5lib/Build/NamelistDefinition.pm") { - die <<"EOF"; -** $ProgName - Cannot find perl module \"Build/NamelistDefinition.pm\" in directory - \"$cesm_tools/perl5lib\" ** -EOF - } -} -# Add $cfgdir/perl5lib to the list of paths that Perl searches for modules -my @dirs = ( $cfgdir, "$cesm_tools/perl5lib"); -unshift @INC, @dirs; -require Build::NamelistDefinition; -# Create a namelist definition object. This object provides a method for verifying that -# the -# output namelist variables are in the definition file, and are output in the correct -# namelist groups. -my $definition = Build::NamelistDefinition->new($nl_definition_file); - - -my $mxname = 0; -my $mxlongn = 0; -my %fields; -my $fldnamevar = "fieldname_var"; - -sub matchKeyword { -# -# Match a keyword -# - my $keyword = shift; - my $line = shift; - my $fh = shift; - - my $match = undef; - if ( $line =~ /$keyword/ ) { - if ( $line =~ /$keyword\s*=\s*['"]([^'"]+)(['"&])/ ) { - $match = $1; - if ( $2 eq "&" ) { - $line = <$fh>; - if ( $line =~ /&([^'"]+)['"]/ ) { - $match .= $1; - } - } - } elsif ( $line =~ /$keyword\s*=\s*&\s*$/ ) { - $line = <$fh>; - if ( $line =~ /^\s*['"]([^'"]+)['"]/ ) { - $match = $1; - } else { - die "ERROR: Trouble getting keyword string\n Line: $line"; - } - } else { - if ( $line =~ /fname\s*=\s*fieldname/ ) { - print STDERR "Found variable used for fieldname = $line\n"; - $match = $fldnamevar; - } elsif ( $line =~ /fname\s*=\s*trim\(fname\)/ ) { - $match = undef; - } elsif ( $line =~ /units\s*=\s*units/ ) { - $match = undef; - } elsif ( $line =~ /long_name\s*=\s*long_name/ ) { - $match = undef; - } elsif ( $line =~ /long_name\s*=\s*lname/ ) { - $match = undef; - } elsif ( $line =~ /long_name\s*=\s*longname/ ) { - print STDERR "Found variable used for longname = $line\n"; - $match = "longname_var"; - } else { - die "ERROR: Still have a match on $keyword\n Line: $line"; - } - } - } - return( $match ); -} - -sub getFieldInfo { -# -# Get field Information -# - my $fh = shift; - my $line = shift; - - my $fname = undef; - my $units = undef; - my $longn = undef; - my $endin = undef; - do { - if ( $line =~ /MEG_/ ) { - $line =~ s|'//'_'|_'|g; - $line =~ s|'//trim\(meg_cmp\%name\)|megancmpd'|gi; - if ( $line =~ /meg_cmp\%name/ ) { - die "ERROR: Still have meg_cmp in a line\n"; - } - } - if ( $line =~ /^(.+)this\%species\%hist_fname\(\s*['"]*([^'"]+)['"]\s*[,]*([^\)]*)\)(.*)/ ) { - my $suffix = ""; - my $beg = $1; - my $mid = $2; - my $suf = $3; - my $end = $4; - if ( $suf =~ /suffix\s*=\s*['"]([^'"]+)['"]/ ) { - $suffix=$1; - } - $line = "$beg 'ISO_${mid}ELEM_${suffix}' $end"; - } - $line -~ s|['"]\s*\/\/\s*this\%species\%get_species\(\)\s*\/\/\s*['"]|ELEM_|g; - if ( ! defined($fname) ) { - $fname = &matchKeyword( "fname", $line, $fh ); - } - if ( ! defined($units) ) { - $units = &matchKeyword( "units", $line, $fh ); - } - if ( ! defined($longn) ) { - $longn = &matchKeyword( "long_name", $line, $fh ); - } - if ( $line =~ /\)\s*$/ ) { - $endin = 1; - } - if ( ! defined($endin) ) { $line = <$fh>; } - - } until( (defined($fname) && defined($units) && defined($longn)) || - ! defined($line) || defined($endin) ); - if ( ! defined($fname) ) { - print "fname: $fname units: $units longn: $longn endin: $endin\n"; - die "ERROR: name undefined for field ending with: $line\n"; - } - return( $fname, $longn, $units ); -} - -sub setField { -# -# Set the field -# - my $name = shift; - my $longn = shift; - my $units = shift; - - if ( defined($name) && $name ne $fldnamevar ) { - if ( length($name) > $mxname ) { $mxname = length($name); } - if ( length($longn) > $mxlongn ) { $mxlongn = length($longn); } - my $len; - if ( length($longn) > 90 ) { - $len = 110; - } elsif ( length($longn) > 60 ) { - $len = 90; - } else { - $len = 60; - } - $fields{$name}{'field'} = sprintf( "%-${len}s\t(%s)", $longn, $units ); - $fields{$name}{'longn'} = $longn; - $fields{$name}{'units'} = $units; - } -} - -sub XML_Header { -# -# Write out header to history fields file -# - my $outfh = shift; - my $outfilename = shift; - - print STDERR " Write out header to history fields file to: $outfilename\n"; - my $svnurl = '$URL: https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_40/models/lnd/clm/src/main/findHistFields.pl $'; - my $svnid = '$Id: findHistFields.pl 34757 2012-02-15 18:38:05Z erik $'; - print $outfh <<"EOF"; - - -\<\?xml-stylesheet type="text\/xsl" href="history_fields.xsl"\?\> - -\<\!-- - List of history file field names, long-names and units for all the fields output - by CLM. - SVN version information: - $svnurl - $svnid ---\> - -\ -EOF -} - -sub XML_Footer { -# -# Write out footer to history fields file -# - my $outfh = shift; - - print STDERR " Write out footer to history fields file\n"; - print $outfh "\n\n"; -} - -my $pwd = `pwd`; -chomp( $pwd ); -my @megcmpds = $definition->get_valid_values( "megan_cmpds", 'noquotes'=>1 ); -my @filenames = glob( "$pwd/*.F90" ); -push( @filenames, glob( "$pwd/../biogeochem/*.F90" ) ); -push( @filenames, glob( "$pwd/../biogeophys/*.F90" ) ); -push( @filenames, glob( "$pwd/../soilbiogeochem/*.F90" ) ); -push( @filenames, glob( "$pwd/../biogeophys/*.F90" ) ); -push( @filenames, glob( "$pwd/../fates/main/*.F90" ) ); - -# -# Loop over all files that have hist_addfld calls in them -# -foreach my $filename ( @filenames ) { - - if ( $filename =~ /histFileMod.F90$/ ) { - next; - } - my $fh = IO::File->new($filename, '<') or die "** $ProgName - can't open history Fields file: $filename\n"; - print( "Filename: $filename\n" ); - # - # Read in the list of fields from the source file - # - while (my $line = <$fh>) { - - # Comments - if ($line =~ /(.*)\!/) { - $line = $1; - } - #if ($line =~ /end subroutine/) { - # last; - #} - my $format = "\n\n"; - if ($line =~ /call\s*hist_addfld/i ) { - (my $name, my $longn, my $units) = &getFieldInfo( $fh, $line ); - if ( $name ne "MEG_megancmpd" && $name =~ /ISO_/ ) { - &setField( $name, $longn, $units ); - printf( , $format, $name, $units, $longn ); - } elsif ( $name =~ /ISO_/ ) { - foreach my $iso ( "C12", "C13", "C14", "N" ) { - my $elem = substr( $iso, 0, 1 ); - $name =~ s/ISO_/$iso/g; - $name =~ s/ELEM_/$elem/g; - $longn =~ s/ISO_/$elem/g; - $longn =~ s/ELEM_/$elem/g; - $units =~ s/ISO_/$iso/g; - $units =~ s/ELEM_/$elem/g; - &setField( $name, $longn, $units ); - printf( , $format, $name, $units, $longn ); - } - } elsif ( $name eq "MEG_megancmpd" ) { - foreach my $megcmpd ( @megcmpds ) { - my $name = "MEG_${megcmpd}"; - &setField( $name, $longn, $units ); - printf( , $format, $name, $units, $longn ); - } - } - } - } - close( $fh ); -} -print STDERR " mxname = $mxname\n"; -print STDERR " mxlongn = $mxlongn\n"; -my %pool_name = ( - L1=> { hist=>'LITR1', long=>'litter 1' }, - L2=> { hist=>'LITR2', long=>'litter 2' }, - L3=> { hist=>'LITR3', long=>'litter 3' }, - CWD=>{ hist=>'CWD', long=>'coarse woody debris' }, - S1=> { hist=>'SOIL1', long=>'soil 1' }, - S2=> { hist=>'SOIL2', long=>'soil 2' }, - S3=> { hist=>'SOIL3', long=>'soil 3' }, - S4=> { hist=>'SOIL4', long=>'soil 4' }, - atm=>{ hist=>'atmosphere', long=>'atmosphere' }, - ); - -my %vrt_suffix = ( C=>" C", "C_vr"=>" C (vertically resolved)", C_1m=>" C to 1 meter", - C_30cm=>" C to 30 cm", C_activelayer=>" C in active layer", - N=>" C", "N_vr"=>" N (vertically resolved)", N_1m=>" N to 1 meter", - N_30cm=>" N to 30 cm", N_activelayer=>" N in active layer", - ); -my %firelist = ( - C_TO_FIRE=>" C fire loss", C_TO_FIRE_vr=>" C fire loss", - N_TO_FIRE=>" N fire loss", N_TO_FIRE_vr=>" N fire loss", - ); -my %leechlist = ( - C_TO_LEACHING=>" C leaching loss", C_TNDNCY_VERT_TRANSPORT=>" C tendency due to vertical transport", - N_TO_LEACHING=>" N leaching loss", N_TNDNCY_VERT_TRANSPORT=>" N tendency due to vertical transport", - ); -# -# Add fields that are looped over -# -my $name, my $longn, my $units; -foreach my $pool ( keys(%pool_name) ) { - my $fname = $pool_name{$pool}{'hist'}; - foreach my $fld ( keys(%vrt_suffix) ) { - $name = $fname . $fld; - $longn = $pool_name{$pool}{'hist'} . $vrt_suffix{$fld}; - $units; - if ( $fld eq "C_vr" ) { - $units = "gC/m^3"; - } elsif ( $fld eq "N_vr" ) { - $units = "gN/m^3"; - } elsif ( $fld =~ /^N/) { - $units = "gN/m^2"; - } else { - $units = "gC/m^2"; - } - &setField( $name, $longn, $units ); - if ( $fld eq "C" || $fld eq "C_vr" ) { - foreach my $ciso ( "C13", "C14" ) { - $name = $ciso."_".$fname . $fld; - $longn = $ciso." ".$pool_name{$pool}{'long'} . $vrt_suffix{$fld}; - if ( $fld eq "C_vr" ) { - $units = "g${ciso}m^3"; - } else { - $units = "g${ciso}/m^2"; - } - &setField( $name, $longn, $units ); - } - } - if ( $fld =~ "C_1m" || $fld eq "C_30m" || $fld eq "C_activelayer" ) { - foreach my $ciso ( "C14" ) { - $name = $ciso."_".$fname . $fld; - $longn = $ciso." ".$pool_name{$pool}{'long'} . $vrt_suffix{$fld}; - $units = "g${ciso}/m^2"; - &setField( $name, $longn, $units ); - } - } - } - # Fire list - if ( $fname =~ /^CWD/ || $fname =~ /^LIT/ ) { - foreach my $fld ( keys(%firelist) ) { - $name = "M_".$fname . $fld; - $longn = $firelist{$fname}; - $units; - if ( $fld =~ /_vr$/ ) { - $units = "gC/m^3"; - } else { - $units = "gC/m^2"; - } - &setField( $name, $longn, $units ); - # Carbon isotopes (C13/C14) - if ( $fld =~ /^C/ ) { - foreach my $ciso ( "C13", "C14" ) { - $name = "${ciso}_M_".$fname . $fld; - $longn = $ciso.$firelist{$fname}; - if ( $fld =~ /_vr$/ ) { - $units = "g${ciso}/m^3"; - } else { - $units = "g${ciso}/m^2"; - } - &setField( $name, $longn, $units ); - } - } - } - } - # Potential loss coefficient - $name = "K_".$fname; - $longn = $pool_name{$pool}{'long'} . " potential loss coefficient"; - $units = "1/s"; - &setField( $name, $longn, $units ); - # - # Not CWD - # - if ( $fname !~ /^CWD/ ) { - foreach my $fld ( keys(%leechlist) ) { - $name = "M_".$fname . $fld; - $longn = $leechlist{$fname}; - my $elm; - if ( $fld =~ /^N/ ) { - $elm = "N"; - } else { - $elm = "C"; - } - if ( $fld =~ /VERT$/ ) { - $units = "g${elm}/m^3"; - } else { - $units = "g${elm}/m^2"; - } - &setField( $name, $longn, $units ); - } - } -} -my %translist = ( - # CN transitions - L1S1 =>{d=>"L1", r=>"S1"}, L2S2 =>{d=>"L2", r=>"S2"}, - L3S3 =>{d=>"L3", r=>"S3"}, S1S2 =>{d=>"S1", r=>"S2"}, - S2S3 =>{d=>"S2", r=>"S3"}, S3S4 =>{d=>"S3", r=>"S4"}, - S4 =>{d=>"S4", r=>"atm"}, - CWDL2=>{d=>"CWD", r=>"L2"}, CWDL3=>{d=>"CWD", r=>"L3"}, - # CENTURY transitions NOT already given above - L2S1 =>{d=>"L2", r=>"S1"}, L3S2 =>{d=>"L3", r=>"S2"}, - S1S3 =>{d=>"S1", r=>"S3"}, S2S1 =>{d=>"S2", r=>"S1"}, - S3S1 =>{d=>"S3", r=>"S1"}, - ); -# -# Transition list (NOT complete) -# -my $unitsvr; -foreach my $trans ( keys(%translist) ) { - my $donor = $translist{$trans}{'d'}; - my $rcvr = $translist{$trans}{'r'}; - if ( $trans ne "${donor}${rcvr}" && ($rcvr ne "atm" || $trans ne $donor) ) { - die "ERROR: Either bad transition name: $trans or bad donor: $donor or receiver: -$rcvr\n"; - } - # Carbon isotopes - foreach my $ciso ( "", "C13", "C14" ) { - if ( $ciso eq "" ) { - $units = "gC/m^2/s"; - $unitsvr = "gC/m^3/s"; - } else { - $units = "g${ciso}/m^2/s"; - $unitsvr = "g${ciso}/m^3/s"; - } - if ( $donor ne "CWD" ) { - my $ii = 0; - foreach my $trans2 ( keys(%translist) ) { - if ($donor eq $translist{$trans}{'d'} ) { $ii = $ii + 1; } - } - # HR - if ( $ii == 1 ) { - $name = $pool_name{$donor}{'hist'}."_HR"; - } else { - $name = $pool_name{$donor}{'hist'}."_HR_$rcvr"; - } - if ( $ciso ne "" ) { - $name = "${ciso}$name"; - } - $longn = 'Het. Resp. from '.$pool_name{$donor}{'long'}; - # vertically integrated fluxes - &setField( $name, $longn, $units ); - # vertically resolved version - &setField( "${name}_vr", $longn, $unitsvr ); - } - if ( $rcvr ne "atm" ) { - # transfer - $name = $pool_name{$donor}{'hist'}. "C_TO_" . - $pool_name{$rcvr}{'hist'}. "C"; - $longn = "decomp of " . $pool_name{$donor}{'long'}. " C to " . - $pool_name{$rcvr}{'long'}. " C"; - if ( $ciso ne "" ) { - $name = "${ciso}$name"; - } - # vertically integrated fluxes - &setField( $name, $longn, $units ); - # vertically resolved version - &setField( "${name}_vr", $longn, $unitsvr ); - } - } - - #-- mineralization/immobilization fluxes (none from CWD) - if ( $donor ne "CWD" ) { - $units = "gN/m^2/s"; - $unitsvr = "gN/m^3/s"; - if ( $rcvr ne "atm" ) { - $name = "SMINN_TO_".$pool_name{$rcvr}{'hist'}. "N_$donor"; - } else { - $name = $pool_name{$donor}{'hist'}. "N_TO_SMINN"; - } - $longn = "mineral N flux for decomp. of " . $pool_name{$donor}{'hist'}; - # vertically integrated fluxes - &setField( $name, $longn, $units ); - # vertically resolved fluxes - &setField( "${name}_vr", $longn, $unitsvr ); - # transfer fluxes - if ( $rcvr ne "atm" ) { - $name = $pool_name{$donor}{'hist'}. "N_TO_" . - $pool_name{$rcvr}{'hist'}. "N"; - $longn = "decomp of " . $pool_name{$donor}{'long'}. " N to " . - $pool_name{$rcvr}{'long'}. " N"; - # vertically integrated fluxes - &setField( $name, $longn, $units ); - # vertically resolved fluxes - &setField( "${name}_vr", $longn, $unitsvr ); - } - # NITRIF_DENITRIF - $name = "SMINN_TO_DENIT_$trans"; - $longn = "denitrification for decomp. of " . $pool_name{$donor}{'long'} . - "to ". $pool_name{$rcvr}{'hist'}; - &setField( $name, $longn, "gN/m^2" ); - # vertically resolved fluxes - &setField( "${name}_vr", $longn, "gN/m^3" ); - } -} - -# -# List the fields in a neatly ordered list -# And Output to an XML file -# -my $outfilename = "$pwd/../../bld/namelist_files/history_fields_clm4_5.xml"; - -my $outfh = IO::File->new($outfilename, '>') or die "** $ProgName - can't open output history Fields XML file: $outfilename\n"; -&XML_Header( $outfh, $outfilename ); -foreach my $name ( sort(keys(%fields)) ) { - my $len; - if ( length($name) > 20 ) { - $len = 40; - } else { - $len = 20; - } - printf( "%-${len}s = %s\n", $name, $fields{$name}{'field'} ); - printf( $outfh "\n\n", - $name, $fields{$name}{'units'}, $fields{$name}{'longn'} ); -} - -&XML_Footer( $outfh ); -close( $outfh ); From a7a9fd6514cbf1c43ab18938b5d16794c7c48c30 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 20 Nov 2020 16:58:03 -0700 Subject: [PATCH 1652/1973] Update doc-builder external This fixes issues encountered by @olyson on a Windows machine --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index f57280c888..aecac45976 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -58,7 +58,7 @@ required = True local_path = doc/doc-builder protocol = git repo_url = https://github.com/ESMCI/doc-builder -tag = v1.0.4 +tag = v1.0.5 required = False [externals_description] From a527483d9c4d68ce17a1405c4c3c3ed9d5213ef5 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 23 Nov 2020 16:40:02 -0700 Subject: [PATCH 1653/1973] Add ACTIVE (T or F) column to hist fields master table While doing this, I made the code less dependent on the number of columns in the table --- .../master_list_file.rst | 2540 ++++++++--------- src/main/histFileMod.F90 | 76 +- 2 files changed, 1307 insertions(+), 1309 deletions(-) diff --git a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst index 93356473ed..d9dbafe972 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst @@ -2,1273 +2,1273 @@ CTSM History Fields =================== -==== ======================================= ============================================================================================== ================================================================= - CTSM History Fields -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - # Variable Name Long Description Units -==== ======================================= ============================================================================================== ================================================================= - 1 LEAFCN Leaf CN ratio used for flexible CN gC/gN - 2 LEAFCN_STORAGE Storage Leaf CN ratio used for flexible CN gC/gN - 3 DAYL daylength s - 4 PREV_DAYL daylength from previous timestep s - 5 SNO_Z Snow layer thicknesses m - 6 SNO_Z_ICE Snow layer thicknesses (ice landunits only) m - 7 ZII convective boundary height m - 8 SWBGT 2 m Simplified Wetbulb Globe Temp C - 9 SWBGT_U Urban 2 m Simplified Wetbulb Globe Temp C - 10 SWBGT_R Rural 2 m Simplified Wetbulb Globe Temp C - 11 HUMIDEX 2 m Humidex C - 12 HUMIDEX_U Urban 2 m Humidex C - 13 HUMIDEX_R Rural 2 m Humidex C - 14 WBT 2 m Stull Wet Bulb C - 15 WBT_U Urban 2 m Stull Wet Bulb C - 16 WBT_R Rural 2 m Stull Wet Bulb C - 17 HIA 2 m NWS Heat Index C - 18 HIA_U Urban 2 m NWS Heat Index C - 19 HIA_R Rural 2 m NWS Heat Index C - 20 APPAR_TEMP 2 m apparent temperature C - 21 APPAR_TEMP_U Urban 2 m apparent temperature C - 22 APPAR_TEMP_R Rural 2 m apparent temperature C - 23 WBA 2 m Wet Bulb C - 24 WBA_U Urban 2 m Wet Bulb C - 25 WBA_R Rural 2 m Wet Bulb C - 26 TEQ 2 m Equiv Temp K - 27 TEQ_U Urban 2 m Equiv Temp K - 28 TEQ_R Rural 2 m Equiv Temp K - 29 EPT 2 m Equiv Pot Temp K - 30 EPT_U Urban 2 m Equiv Pot Temp K - 31 EPT_R Rural 2 m Equiv Pot Temp K - 32 DISCOI 2 m Discomfort Index C - 33 DISCOI_U Urban 2 m Discomfort Index C - 34 DISCOI_R Rural 2 m Discomfort Index C - 35 THIP 2 m Temp Hum Index Physiology C - 36 THIP_U Urban 2 m Temp Hum Index Physiology C - 37 THIP_R Rural 2 m Temp Hum Index Physiology C - 38 THIC 2 m Temp Hum Index Comfort C - 39 THIC_U Urban 2 m Temp Hum Index Comfort C - 40 THIC_R Rural 2 m Temp Hum Index Comfort C - 41 SWMP65 2 m Swamp Cooler Temp 65% Eff C - 42 SWMP65_U Urban 2 m Swamp Cooler Temp 65% Eff C - 43 SWMP65_R Rural 2 m Swamp Cooler Temp 65% Eff C - 44 SWMP80 2 m Swamp Cooler Temp 80% Eff C - 45 SWMP80_U Urban 2 m Swamp Cooler Temp 80% Eff C - 46 SWMP80_R Rural 2 m Swamp Cooler Temp 80% Eff C - 47 DISCOIS 2 m Stull Discomfort Index C - 48 DISCOIS_U Urban 2 m Stull Discomfort Index C - 49 DISCOIS_R Rural 2 m Stull Discomfort Index C - 50 TBUILD_MAX prescribed maximum interior building temperature K - 51 WIND atmospheric wind velocity magnitude m/s - 52 Wind atmospheric wind velocity magnitude m/s - 53 ZBOT atmospheric reference height m - 54 ATM_TOPO atmospheric surface height m - 55 FSDS atmospheric incident solar radiation W/m^2 - 56 PCO2 atmospheric partial pressure of CO2 Pa - 57 SWdown atmospheric incident solar radiation W/m^2 - 58 PCH4 atmospheric partial pressure of CH4 Pa - 59 Tair_from_atm atmospheric air temperature received from atmosphere (pre-downscaling) K - 60 TBOT atmospheric air temperature (downscaled to columns in glacier regions) K - 61 Tair atmospheric air temperature (downscaled to columns in glacier regions) K - 62 PBOT atmospheric pressure at surface (downscaled to columns in glacier regions) Pa - 63 PSurf atmospheric pressure at surface (downscaled to columns in glacier regions) Pa - 64 FLDS atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 - 65 LWdown atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 - 66 FLDS_ICE atmospheric longwave radiation (downscaled to columns in glacier regions) (ice landunits only) W/m^2 - 67 THBOT atmospheric air potential temperature (downscaled to columns in glacier regions) K - 68 FSI24 indirect radiation (last 24hrs) K - 69 FSI240 indirect radiation (last 240hrs) K - 70 FSD24 direct radiation (last 24hrs) K - 71 FSD240 direct radiation (last 240hrs) K - 72 PCO2_240 10 day running mean of CO2 pressure Pa - 73 PO2_240 10 day running mean of O2 pressure Pa - 74 PBOT_240 10 day running mean of air pressure Pa - 75 FSH_TO_COUPLER sensible heat sent to coupler (includes corrections for land use change, rain/snow conversion W/m^2 - 76 FSH_RUNOFF_ICE_TO_LIQ sensible heat flux generated from conversion of ice runoff to liquid W/m^2 - 77 FCO2 CO2 flux to atmosphere (+ to atm) kgCO2/m2/s - 78 Z0M_TO_COUPLER roughness length, momentum: gridcell average sent to coupler m - 79 FCH4 Gridcell surface CH4 flux to atmosphere (+ to atm) kgC/m2/s - 80 NEM Gridcell net adjustment to net carbon exchange passed to atm. for methane production gC/m2/s - 81 ICE_MODEL_FRACTION Ice sheet model fractional coverage unitless - 82 QICE_FORC qice forcing sent to GLC mm/s - 83 TSRF_FORC surface temperature sent to GLC K - 84 TOPO_FORC topograephic height sent to GLC m - 85 TH2OSFC surface water temperature K - 86 TG_U Urban ground temperature K - 87 TLAKE lake temperature K - 88 SNO_T Snow temperatures K - 89 SNO_T_ICE Snow temperatures (ice landunits only) K - 90 TSA 2m air temperature K - 91 TSA_ICE 2m air temperature (ice landunits only) K - 92 TSA_R Rural 2m air temperature K - 93 TREFMNAV daily minimum of average 2-m temperature K - 94 TREFMXAV daily maximum of average 2-m temperature K - 95 TREFMNAV_R Rural daily minimum of average 2-m temperature K - 96 TREFMXAV_R Rural daily maximum of average 2-m temperature K - 97 TSA_U Urban 2m air temperature K - 98 TREFMNAV_U Urban daily minimum of average 2-m temperature K - 99 TREFMXAV_U Urban daily maximum of average 2-m temperature K - 100 TV vegetation temperature K - 101 TSKIN skin temperature K - 102 TG ground temperature K - 103 TG_ICE ground temperature (ice landunits only) K - 104 TG_R Rural ground temperature K - 105 TSOI soil temperature (natural vegetated and crop landunits only) K - 106 TSOI_ICE soil temperature (ice landunits only) K - 107 TSOI_10CM soil temperature in top 10cm of soil K - 108 TSL temperature of near-surface soil layer (natural vegetated and crop landunits only) K - 109 SNOTXMASS snow temperature times layer mass, layer sum; to get mass-weighted temperature, divide by (SNO K kg/m2 - 110 SNOTXMASS_ICE snow temperature times layer mass, layer sum (ice landunits only); to get mass-weighted temper K kg/m2 - 111 T10 10-day running mean of 2-m temperature K - 112 A5TMIN 5-day running mean of min 2-m temperature K - 113 A10TMIN 10-day running mean of min 2-m temperature K - 114 TBUILD internal urban building air temperature K - 115 TROOF_INNER roof inside surface temperature K - 116 TSUNW_INNER sunwall inside surface temperature K - 117 TSHDW_INNER shadewall inside surface temperature K - 118 TFLOOR floor temperature K - 119 HEAT_CONTENT1 initial gridcell total heat content J/m^2 - 120 HEAT_CONTENT1_VEG initial gridcell total heat content - natural vegetated and crop landunits only J/m^2 - 121 HEAT_CONTENT2 post land cover change total heat content J/m^2 - 122 LIQUID_WATER_TEMP1 initial gridcell weighted average liquid water temperature K - 123 SNOTTOPL snow temperature (top layer) K - 124 SNOTTOPL_ICE snow temperature (top layer, ice landunits only) K - 125 SNOdTdzL top snow layer temperature gradient (land) K/m - 126 DT_VEG change in t_veg, last iteration K - 127 EMV vegetation emissivity proportion - 128 EMG ground emissivity proportion - 129 BETA coefficient of convective velocity none - 130 TV24 vegetation temperature (last 24hrs) K - 131 TV240 vegetation temperature (last 240hrs) K - 132 GDD0 Growing degree days base 0C from planting ddays - 133 GDD8 Growing degree days base 8C from planting ddays - 134 GDD10 Growing degree days base 10C from planting ddays - 135 GDD020 Twenty year average of growing degree days base 0C from planting ddays - 136 GDD820 Twenty year average of growing degree days base 8C from planting ddays - 137 GDD1020 Twenty year average of growing degree days base 10C from planting ddays - 138 TVEGD10 10 day running mean of patch daytime vegetation temperature Kelvin - 139 TVEGN10 10 day running mean of patch night-time vegetation temperature Kelvin - 140 ALT current active layer thickness m - 141 ALTMAX maximum annual active layer thickness m - 142 ALTMAX_LASTYEAR maximum prior year active layer thickness m - 143 ELAI exposed one-sided leaf area index m^2/m^2 - 144 ESAI exposed one-sided stem area index m^2/m^2 - 145 TLAI total projected leaf area index m^2/m^2 - 146 TSAI total projected stem area index m^2/m^2 - 147 LAISUN sunlit projected leaf area index m^2/m^2 - 148 LAISHA shaded projected leaf area index m^2/m^2 - 149 FSUN sunlit fraction of canopy proportion - 150 HTOP canopy top m - 151 HBOT canopy bottom m - 152 DISPLA displacement height m - 153 Z0M momentum roughness length m - 154 FSUN24 fraction sunlit (last 24hrs) K - 155 FSUN240 fraction sunlit (last 240hrs) K - 156 LAI240 240hr average of leaf area index m^2/m^2 - 157 VEGWP vegetation water matric potential for sun/sha canopy,xyl,root segments mm - 158 VEGWPLN vegetation water matric potential for sun/sha canopy,xyl,root at local noon mm - 159 VEGWPPD predawn vegetation water matric potential for sun/sha canopy,xyl,root mm - 160 SMP soil matric potential (natural vegetated and crop landunits only) mm - 161 KROOT root conductance each soil layer 1/s - 162 KSOIL soil conductance in each soil layer 1/s - 163 bsw clap and hornberger B unitless - 164 ROOTR effective fraction of roots in each soil layer (SMS method) proportion - 165 SOILPSI soil water potential in each soil layer MPa - 166 SNO_TK Thermal conductivity W/m-K - 167 SNO_TK_ICE Thermal conductivity (ice landunits only) W/m-K - 168 HK hydraulic conductivity (natural vegetated and crop landunits only) mm/s - 169 SoilAlpha factor limiting ground evap unitless - 170 SoilAlpha_U urban factor limiting ground evap unitless - 171 watsat water saturated m^3/m^3 - 172 EFF_POROSITY effective porosity = porosity - vol_ice proportion - 173 watfc water field capacity m^3/m^3 - 174 SOILRESIS soil resistance to evaporation s/m - 175 DSL dry surface layer thickness mm - 176 SNO_LIQH2O Snow liquid water content kg/m2 - 177 SNO_ICE Snow ice content kg/m2 - 178 H2OSOI volumetric soil water (natural vegetated and crop landunits only) mm3/mm3 - 179 SOILLIQ soil liquid water (natural vegetated and crop landunits only) kg/m2 - 180 SOILICE soil ice (natural vegetated and crop landunits only) kg/m2 - 181 SNOCAN intercepted snow mm - 182 LIQCAN intercepted liquid water mm - 183 H2OSFC surface water depth mm - 184 WA water in the unconfined aquifer (natural vegetated and crop landunits only) mm - 185 INT_SNOW accumulated swe (natural vegetated and crop landunits only) mm - 186 INT_SNOW_ICE accumulated swe (ice landunits only) mm - 187 SNOW_PERSISTENCE Length of time of continuous snow cover (nat. veg. landunits only) seconds - 188 H2OCAN intercepted water mm - 189 SOILWATER_10CM soil liquid water + ice in top 10cm of soil (veg landunits only) kg/m2 - 190 TWS total water storage mm - 191 Q2M 2m specific humidity kg/kg - 192 SNOWLIQ snow liquid water kg/m2 - 193 SNOWLIQ_ICE snow liquid water (ice landunits only) kg/m2 - 194 SNOWICE snow ice kg/m2 - 195 SNOWICE_ICE snow ice (ice landunits only) kg/m2 - 196 H2OSNO snow depth (liquid water) mm - 197 H2OSNO_ICE snow depth (liquid water, ice landunits only) mm - 198 TOTSOILLIQ vertically summed soil liquid water (veg landunits only) kg/m2 - 199 TOTSOILICE vertically summed soil cie (veg landunits only) kg/m2 - 200 RH2M 2m relative humidity % - 201 RH2M_R Rural 2m specific humidity % - 202 RH2M_U Urban 2m relative humidity % - 203 RHAF fractional humidity of canopy air fraction - 204 RHAF10 10 day running mean of fractional humidity of canopy air fraction - 205 FH2OSFC fraction of ground covered by surface water unitless - 206 FH2OSFC_NOSNOW fraction of ground covered by surface water (if no snow present) unitless - 207 FSNO fraction of ground covered by snow unitless - 208 FSNO_ICE fraction of ground covered by snow (ice landunits only) unitless - 209 FSNO_EFF effective fraction of ground covered by snow unitless - 210 FWET fraction of canopy that is wet proportion - 211 FCANSNO fraction of canopy that is wet proportion - 212 FDRY fraction of foliage that is green and dry proportion - 213 FRAC_ICEOLD fraction of ice relative to the tot water proportion - 214 SNOW_DEPTH snow height of snow covered area m - 215 SNOW_DEPTH_ICE snow height of snow covered area (ice landunits only) m - 216 SNOWDP gridcell mean snow height m - 217 WF soil water as frac. of whc for top 0.05 m proportion - 218 H2OSNO_TOP mass of snow in top snow layer kg/m2 - 219 SNORDSL top snow layer effective grain radius m^-6 - 220 SNOLIQFL top snow layer liquid water fraction (land) fraction - 221 SNO_EXISTENCE Fraction of averaging period for which each snow layer existed unitless - 222 SNO_BW Partial density of water in the snow pack (ice + liquid) kg/m3 - 223 SNO_BW_ICE Partial density of water in the snow pack (ice + liquid, ice landunits only) kg/m3 - 224 SNO_GS Mean snow grain size Microns - 225 SNO_GS_ICE Mean snow grain size (ice landunits only) Microns - 226 QINTR interception mm/s - 227 SNOW_SOURCES snow sources (liquid water) mm/s - 228 SNOW_SINKS snow sinks (liquid water) mm/s - 229 LIQUID_CONTENT1 initial gridcell total liq content mm - 230 LIQUID_CONTENT2 post landuse change gridcell total liq content mm - 231 ICE_CONTENT1 initial gridcell total ice content mm - 232 ICE_CONTENT2 post land cover change total ice content mm - 233 ERRH2O total water conservation error mm - 234 ERRH2OSNO imbalance in snow depth (liquid water) mm - 235 QDIRECT_THROUGHFALL direct throughfall of liquid (rain + above-canopy irrigation) mm/s - 236 QDIRECT_THROUGHFALL_SNOW direct throughfall of snow mm/s - 237 QDRIP rate of excess canopy liquid falling off canopy mm/s - 238 QDRIP_SNOW rate of excess canopy snow falling off canopy mm/s - 239 QSNOUNLOAD canopy snow unloading mm/s - 240 QTOPSOIL water input to surface mm/s - 241 QINFL infiltration mm/s - 242 QOVER total surface runoff (includes QH2OSFC) mm/s - 243 QRGWL surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff fro mm/s - 244 QDRAI sub-surface drainage mm/s - 245 QDRAI_PERCH perched wt drainage mm/s - 246 QFLX_LIQ_DYNBAL liq dynamic land cover change conversion runoff flux mm/s - 247 QFLX_ICE_DYNBAL ice dynamic land cover change conversion runoff flux mm/s - 248 QRUNOFF total liquid runoff not including correction for land use change mm/s - 249 QRUNOFF_ICE total liquid runoff not incl corret for LULCC (ice landunits only) mm/s - 250 QRUNOFF_U Urban total runoff mm/s - 251 QRUNOFF_R Rural total runoff mm/s - 252 QSNOMELT snow melt rate mm/s - 253 QSNOMELT_ICE snow melt (ice landunits only) mm/s - 254 QSNOFRZ column-integrated snow freezing rate kg/m2/s - 255 QSNOFRZ_ICE column-integrated snow freezing rate (ice landunits only) mm/s - 256 SNO_FRZ snow freezing rate in each snow layer kg/m2/s - 257 SNO_FRZ_ICE snow freezing rate in each snow layer (ice landunits only) mm/s - 258 QFLX_SNOW_DRAIN drainage from snow pack mm/s - 259 QFLX_SNOW_DRAIN_ICE drainage from snow pack melt (ice landunits only) mm/s - 260 QSOIL Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew) mm/s - 261 QSOIL_ICE Ground evaporation (ice landunits only) mm/s - 262 QVEGE canopy evaporation mm/s - 263 QVEGT canopy transpiration mm/s - 264 QSNOCPLIQ excess liquid h2o due to snow capping not including correction for land use change mm H2O/s - 265 QSNWCPICE excess solid h2o due to snow capping not including correction for land use change mm H2O/s - 266 QICE ice growth/melt mm/s - 267 QICE_FRZ ice growth mm/s - 268 QICE_MELT ice melt mm/s - 269 QFLX_LIQ_GRND liquid (rain+irrigation) on ground after interception mm H2O/s - 270 QFLX_SNOW_GRND snow on ground after interception mm H2O/s - 271 QFLX_LIQEVAP_FROM_TOP_LAYER rate of liquid water evaporated from top soil or snow layer mm H2O/s - 272 QFLX_EVAP_VEG vegetation evaporation mm H2O/s - 273 QFLX_EVAP_TOT qflx_evap_soi + qflx_evap_can + qflx_tran_veg kg m-2 s-1 - 274 QFLX_LIQDEW_TO_TOP_LAYER rate of liquid water deposited on top soil or snow layer (dew) mm H2O/s - 275 QFLX_SOLIDEVAP_FROM_TOP_LAYER rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s - 276 QFLX_SOLIDEVAP_FROM_TOP_LAYER_ICE rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s - 277 QFLX_SOLIDDEW_TO_TOP_LAYER rate of solid water deposited on top soil or snow layer (frost) mm H2O/s - 278 QDRAI_XS saturation excess drainage mm/s - 279 QH2OSFC_TO_ICE surface water converted to ice mm/s - 280 QIRRIG_FROM_SURFACE water added through surface water irrigation mm/s - 281 QIRRIG_FROM_GW_UNCONFINED water added through unconfined groundwater irrigation mm/s - 282 QIRRIG_FROM_GW_CONFINED water added through confined groundwater irrigation mm/s - 283 QIRRIG_DRIP water added via drip irrigation mm/s - 284 QIRRIG_SPRINKLER water added via sprinkler irrigation mm/s - 285 SNO_MELT snow melt rate in each snow layer mm/s - 286 SNO_MELT_ICE snow melt rate in each snow layer (ice landunits only) mm/s - 287 QROOTSINK water flux from soil to root in each soil-layer mm/s - 288 QHR hydraulic redistribution mm/s - 289 QSNO_WINDUNLOAD canopy snow wind unloading mm/s - 290 QSNO_TEMPUNLOAD canopy snow temp unloading mm/s - 291 QSNOEVAP evaporation from snow (only when snl<0, otherwise it is equal to qflx_ev_soil) mm/s - 292 QH2OSFC surface water runoff mm/s - 293 QPHSNEG net negative hydraulic redistribution flux mm/s - 294 AnnET Annual ET mm/s - 295 QRUNOFF_TO_COUPLER total liquid runoff sent to coupler (includes corrections for land use change) mm/s - 296 QRUNOFF_ICE_TO_COUPLER total ice runoff sent to coupler (includes corrections for land use change) mm/s - 297 QRUNOFF_ICE_TO_LIQ liquid runoff from converted ice runoff mm/s - 298 RAIN_FROM_ATM atmospheric rain received from atmosphere (pre-repartitioning) mm/s - 299 SNOW_FROM_ATM atmospheric snow received from atmosphere (pre-repartitioning) mm/s - 300 QBOT atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg - 301 Qair atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg - 302 QFLOOD runoff from river flooding mm/s - 303 RAIN atmospheric rain, after rain/snow repartitioning based on temperature mm/s - 304 Rainf atmospheric rain, after rain/snow repartitioning based on temperature mm/s - 305 RAIN_ICE atmospheric rain, after rain/snow repartitioning based on temperature (ice landunits only) mm/s - 306 SNOW atmospheric snow, after rain/snow repartitioning based on temperature mm/s - 307 SNOW_ICE atmospheric snow, after rain/snow repartitioning based on temperature (ice landunits only) mm/s - 308 VOLR river channel total water storage m3 - 309 VOLRMCH river channel main channel water storage m3 - 310 RH atmospheric relative humidity % - 311 RH30 30-day running mean of relative humidity % - 312 PREC10 10-day running mean of PREC MM H2O/S - 313 PREC60 60-day running mean of PREC MM H2O/S - 314 EFLX_DYNBAL dynamic land cover change conversion energy flux W/m^2 - 315 FSM snow melt heat flux W/m^2 - 316 FSM_ICE snow melt heat flux (ice landunits only) W/m^2 - 317 FSM_R Rural snow melt heat flux W/m^2 - 318 FSM_U Urban snow melt heat flux W/m^2 - 319 FIRA net infrared (longwave) radiation W/m^2 - 320 FIRA_ICE net infrared (longwave) radiation (ice landunits only) W/m^2 - 321 FIRA_R Rural net infrared (longwave) radiation W/m^2 - 322 FIRE emitted infrared (longwave) radiation W/m^2 - 323 LWup upwelling longwave radiation W/m^2 - 324 FIRE_ICE emitted infrared (longwave) radiation (ice landunits only) W/m^2 - 325 FIRE_R Rural emitted infrared (longwave) radiation W/m^2 - 326 FCTR canopy transpiration W/m^2 - 327 FCEV canopy evaporation W/m^2 - 328 FGEV ground evaporation W/m^2 - 329 FSH sensible heat not including correction for land use change and rain/snow conversion W/m^2 - 330 FSH_ICE sensible heat not including correction for land use change and rain/snow conversion (ice landu W/m^2 - 331 FSH_R Rural sensible heat W/m^2 - 332 Qh sensible heat W/m^2 - 333 Qle total evaporation W/m^2 - 334 EFLX_LH_TOT total latent heat flux [+ to atm] W/m^2 - 335 EFLX_LH_TOT_ICE total latent heat flux [+ to atm] (ice landunits only) W/m^2 - 336 EFLX_LH_TOT_R Rural total evaporation W/m^2 - 337 Qstor storage heat flux (includes snowmelt) W/m^2 - 338 FSH_V sensible heat from veg W/m^2 - 339 FSH_G sensible heat from ground W/m^2 - 340 FGR heat flux into soil/snow including snow melt and lake / snow light transmission W/m^2 - 341 FGR_ICE heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits W/m^2 - 342 FGR_R Rural heat flux into soil/snow including snow melt and snow light transmission W/m^2 - 343 FIRA_U Urban net infrared (longwave) radiation W/m^2 - 344 EFLX_SOIL_GRND soil heat flux [+ into soil] W/m^2 - 345 FIRE_U Urban emitted infrared (longwave) radiation W/m^2 - 346 FSH_U Urban sensible heat W/m^2 - 347 FSH_PRECIP_CONVERSION Sensible heat flux from conversion of rain/snow atm forcing W/m^2 - 348 EFLX_LH_TOT_U Urban total evaporation W/m^2 - 349 FGR_U Urban heat flux into soil/snow including snow melt W/m^2 - 350 Rnet net radiation W/m^2 - 351 DLRAD downward longwave radiation below the canopy W/m^2 - 352 ULRAD upward longwave radiation above the canopy W/m^2 - 353 CGRND deriv. of soil energy flux wrt to soil temp W/m^2/K - 354 CGRNDL deriv. of soil latent heat flux wrt soil temp W/m^2/K - 355 CGRNDS deriv. of soil sensible heat flux wrt soil temp W/m^2/K - 356 EFLX_GNET net heat flux into ground W/m^2 - 357 EFLX_GRND_LAKE net heat flux into lake/snow surface, excluding light transmission W/m^2 - 358 EFLXBUILD building heat flux from change in interior building air temperature W/m^2 - 359 URBAN_AC urban air conditioning flux W/m^2 - 360 URBAN_HEAT urban heating flux W/m^2 - 361 DGNETDT derivative of net ground heat flux wrt soil temp W/m^2/K - 362 FGR12 heat flux between soil layers 1 and 2 W/m^2 - 363 FGR_SOIL_R Rural downward heat flux at interface below each soil layer watt/m^2 - 364 TRAFFICFLUX sensible heat flux from urban traffic W/m^2 - 365 WASTEHEAT sensible heat flux from heating/cooling sources of urban waste heat W/m^2 - 366 HEAT_FROM_AC sensible heat flux put into canyon due to heat removed from air conditioning W/m^2 - 367 TAUX zonal surface stress kg/m/s^2 - 368 Qtau momentum flux kg/m/s^2 - 369 TAUY meridional surface stress kg/m/s^2 - 370 BTRANMN daily minimum of transpiration beta factor unitless - 371 RRESIS root resistance in each soil layer proportion - 372 ERRSOI soil/lake energy conservation error W/m^2 - 373 ERRSEB surface energy conservation error W/m^2 - 374 ERRSOL solar radiation conservation error W/m^2 - 375 DSTDEP total dust deposition (dry+wet) from atmosphere kg/m^2/s - 376 BCDEP total BC deposition (dry+wet) from atmosphere kg/m^2/s - 377 OCDEP total OC deposition (dry+wet) from atmosphere kg/m^2/s - 378 SNOBCMCL mass of BC in snow column kg/m2 - 379 SNOBCMSL mass of BC in top snow layer kg/m2 - 380 SNOOCMCL mass of OC in snow column kg/m2 - 381 SNOOCMSL mass of OC in top snow layer kg/m2 - 382 SNODSTMCL mass of dust in snow column kg/m2 - 383 SNODSTMSL mass of dust in top snow layer kg/m2 - 384 Z0MG roughness length over ground, momentum m - 385 Z0HG roughness length over ground, sensible heat m - 386 Z0QG roughness length over ground, latent heat m - 387 VA atmospheric wind speed plus convective velocity m/s - 388 U10 10-m wind m/s - 389 U10_ICE 10-m wind (ice landunits only) m/s - 390 U10_DUST 10-m wind for dust model m/s - 391 RAM1 aerodynamical resistance s/m - 392 FV friction velocity for dust model m/s - 393 Z0HV roughness length over vegetation, sensible heat m - 394 Z0MV roughness length over vegetation, momentum m - 395 Z0QV roughness length over vegetation, latent heat m - 396 RB10 10 day running mean boundary layer resistance s/m - 397 LAKEICEFRAC lake layer ice mass fraction unitless - 398 LAKEICEFRAC_SURF surface lake layer ice mass fraction unitless - 399 LAKEICETHICK thickness of lake ice (including physical expansion on freezing) m - 400 TKE1 top lake level eddy thermal conductivity W/(mK) - 401 RAM_LAKE aerodynamic resistance for momentum (lakes only) s/m - 402 UST_LAKE friction velocity (lakes only) m/s - 403 RH_LEAF fractional humidity at leaf surface fraction - 404 VPD_CAN canopy vapor pressure deficit kPa - 405 LNC leaf N concentration gN leaf/m^2 - 406 FPSN photosynthesis umol m-2 s-1 - 407 FPSN_WC Rubisco-limited photosynthesis umol m-2 s-1 - 408 FPSN_WJ RuBP-limited photosynthesis umol m-2 s-1 - 409 FPSN_WP Product-limited photosynthesis umol m-2 s-1 - 410 PSNSUN sunlit leaf photosynthesis umolCO2/m^2/s - 411 PSNSHA shaded leaf photosynthesis umolCO2/m^2/s - 412 RSSUN sunlit leaf stomatal resistance s/m - 413 RSSHA shaded leaf stomatal resistance s/m - 414 GSSUN sunlit leaf stomatal conductance umol H20/m2/s - 415 GSSHA shaded leaf stomatal conductance umol H20/m2/s - 416 GSSUNLN sunlit leaf stomatal conductance at local noon umol H20/m2/s - 417 GSSHALN shaded leaf stomatal conductance at local noon umol H20/m2/s - 418 Vcmx25Z canopy profile of vcmax25 predicted by LUNA model umol/m2/s - 419 Jmx25Z maximum rate of electron transport at 25 Celcius for canopy layers umol electrons/m2/s - 420 PNLCZ Proportion of nitrogen allocated for light capture unitless - 421 VCMX25T canopy profile of vcmax25 umol/m2/s - 422 JMX25T canopy profile of jmax umol/m2/s - 423 TPU25T canopy profile of tpu umol/m2/s - 424 FPSN24 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m^2 ground/day - 425 QCHARGE aquifer recharge rate (natural vegetated and crop landunits only) mm/s - 426 NSUBSTEPS number of adaptive timesteps in CLM timestep unitless - 427 FROST_TABLE frost table depth (natural vegetated and crop landunits only) m - 428 ZWT water table depth (natural vegetated and crop landunits only) m - 429 ZWT_PERCH perched water table depth (natural vegetated and crop landunits only) m - 430 FCOV fractional impermeable area unitless - 431 FSAT fractional area with water table at surface unitless - 432 FSA absorbed solar radiation W/m^2 - 433 FSA_ICE absorbed solar radiation (ice landunits only) W/m^2 - 434 FSA_R Rural absorbed solar radiation W/m^2 - 435 FSA_U Urban absorbed solar radiation W/m^2 - 436 FSR reflected solar radiation W/m^2 - 437 SWup upwelling shortwave radiation W/m^2 - 438 FSR_ICE reflected solar radiation (ice landunits only) W/m^2 - 439 SNO_ABS Absorbed solar radiation in each snow layer W/m^2 - 440 SNO_ABS_ICE Absorbed solar radiation in each snow layer (ice landunits only) W/m^2 - 441 SABV solar rad absorbed by veg W/m^2 - 442 SABG solar rad absorbed by ground W/m^2 - 443 SABG_PEN Rural solar rad penetrating top soil or snow layer watt/m^2 - 444 FSDSND direct nir incident solar radiation W/m^2 - 445 FSDSNI diffuse nir incident solar radiation W/m^2 - 446 FSDSNDLN direct nir incident solar radiation at local noon W/m^2 - 447 FSRND direct nir reflected solar radiation W/m^2 - 448 FSRNI diffuse nir reflected solar radiation W/m^2 - 449 FSRNDLN direct nir reflected solar radiation at local noon W/m^2 - 450 FSRSF reflected solar radiation W/m^2 - 451 SSRE_FSR surface snow effect on reflected solar radiation W/m^2 - 452 FSRSFND direct nir reflected solar radiation W/m^2 - 453 FSRSFNI diffuse nir reflected solar radiation W/m^2 - 454 FSRSFNDLN direct nir reflected solar radiation at local noon W/m^2 - 455 SSRE_FSRND surface snow effect on direct nir reflected solar radiation W/m^2 - 456 SSRE_FSRNI surface snow effect on diffuse nir reflected solar radiation W/m^2 - 457 SSRE_FSRNDLN surface snow effect on direct nir reflected solar radiation at local noon W/m^2 - 458 SNOINTABS Fraction of incoming solar absorbed by lower snow layers - - 459 PAR240DZ 10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer W/m^2 - 460 PAR240XZ 10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer W/m^2 - 461 COSZEN cosine of solar zenith angle none - 462 ALBGRD ground albedo (direct) proportion - 463 ALBGRI ground albedo (indirect) proportion - 464 ALBDSF diagnostic snow-free surface albedo (direct) proportion - 465 ALBISF diagnostic snow-free surface albedo (indirect) proportion - 466 ALBD surface albedo (direct) proportion - 467 ALBI surface albedo (indirect) proportion - 468 FSDSVD direct vis incident solar radiation W/m^2 - 469 FSDSVI diffuse vis incident solar radiation W/m^2 - 470 FSRVD direct vis reflected solar radiation W/m^2 - 471 FSRVI diffuse vis reflected solar radiation W/m^2 - 472 FSRSFVD direct vis reflected solar radiation W/m^2 - 473 FSRSFVI diffuse vis reflected solar radiation W/m^2 - 474 SSRE_FSRVD surface snow radiatve effect on direct vis reflected solar radiation W/m^2 - 475 SSRE_FSRVI surface snow radiatve effect on diffuse vis reflected solar radiation W/m^2 - 476 FSDSVDLN direct vis incident solar radiation at local noon W/m^2 - 477 FSDSVILN diffuse vis incident solar radiation at local noon W/m^2 - 478 PARVEGLN absorbed par by vegetation at local noon W/m^2 - 479 FSRVDLN direct vis reflected solar radiation at local noon W/m^2 - 480 FSRSFVDLN direct vis reflected solar radiation at local noon W/m^2 - 481 SSRE_FSRVDLN surface snow radiatve effect on direct vis reflected solar radiation at local noon W/m^2 - 482 SNOFSDSVD direct vis incident solar radiation on snow W/m^2 - 483 SNOFSDSND direct nir incident solar radiation on snow W/m^2 - 484 SNOFSDSVI diffuse vis incident solar radiation on snow W/m^2 - 485 SNOFSDSNI diffuse nir incident solar radiation on snow W/m^2 - 486 SNOFSRVD direct vis reflected solar radiation from snow W/m^2 - 487 SNOFSRND direct nir reflected solar radiation from snow W/m^2 - 488 SNOFSRVI diffuse vis reflected solar radiation from snow W/m^2 - 489 SNOFSRNI diffuse nir reflected solar radiation from snow W/m^2 - 490 DSTFLXT total surface dust emission kg/m2/s - 491 DPVLTRB1 turbulent deposition velocity 1 m/s - 492 DPVLTRB2 turbulent deposition velocity 2 m/s - 493 DPVLTRB3 turbulent deposition velocity 3 m/s - 494 DPVLTRB4 turbulent deposition velocity 4 m/s - 495 QIRRIG_DEMAND irrigation demand mm/s - 496 TOPO_COL column-level topographic height m - 497 TOPO_COL_ICE column-level topographic height (ice landunits only) m - 498 FINUNDATED fractional inundated area of vegetated columns unitless - 499 FINUNDATED_LAG time-lagged inundated fraction of vegetated columns unitless - 500 CH4_SURF_DIFF_SAT diffusive surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s - 501 CH4_SURF_DIFF_UNSAT diffusive surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s - 502 CH4_EBUL_TOTAL_SAT ebullition surface CH4 flux; (+ to atm) mol/m2/s - 503 CH4_EBUL_TOTAL_UNSAT ebullition surface CH4 flux; (+ to atm) mol/m2/s - 504 CH4_SURF_EBUL_SAT ebullition surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s - 505 CH4_SURF_EBUL_UNSAT ebullition surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s - 506 CH4_SURF_AERE_SAT aerenchyma surface CH4 flux for inundated area; (+ to atm) mol/m2/s - 507 CH4_SURF_AERE_UNSAT aerenchyma surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s - 508 TOTCOLCH4 total belowground CH4 (0 for non-lake special landunits in the absence of dynamic landunits) gC/m2 - 509 CONC_CH4_SAT CH4 soil Concentration for inundated / lake area mol/m3 - 510 CONC_CH4_UNSAT CH4 soil Concentration for non-inundated area mol/m3 - 511 O2_DECOMP_DEPTH_UNSAT O2 consumption from HR and AR for non-inundated area mol/m3/s - 512 CONC_O2_SAT O2 soil Concentration for inundated / lake area mol/m3 - 513 CONC_O2_UNSAT O2 soil Concentration for non-inundated area mol/m3 - 514 FCH4TOCO2 Gridcell oxidation of CH4 to CO2 gC/m2/s - 515 CH4PROD Gridcell total production of CH4 gC/m2/s - 516 FCH4_DFSAT CH4 additional flux due to changing fsat, natural vegetated and crop landunits only kgC/m2/s - 517 ZWT_CH4_UNSAT depth of water table for methane production used in non-inundated area m - 518 QOVER_LAG time-lagged surface runoff for soil columns mm/s - 519 WTGQ surface tracer conductance m/s - 520 DYN_COL_ADJUSTMENTS_CH4 Adjustments in ch4 due to dynamic column areas; only makes sense at the column level: should n gC/m^2 - 521 MEG_isoprene MEGAN flux kg/m2/sec - 522 MEG_pinene_a MEGAN flux kg/m2/sec - 523 MEG_carene_3 MEGAN flux kg/m2/sec - 524 MEG_thujene_a MEGAN flux kg/m2/sec - 525 MEG_methanol MEGAN flux kg/m2/sec - 526 MEG_ethanol MEGAN flux kg/m2/sec - 527 MEG_formaldehyde MEGAN flux kg/m2/sec - 528 MEG_acetaldehyde MEGAN flux kg/m2/sec - 529 MEG_acetic_acid MEGAN flux kg/m2/sec - 530 MEG_acetone MEGAN flux kg/m2/sec - 531 VOCFLXT total VOC flux into atmosphere moles/m2/sec - 532 GAMMA total gamma for VOC calc non - 533 GAMMAL gamma L for VOC calc non - 534 GAMMAT gamma T for VOC calc non - 535 GAMMAP gamma P for VOC calc non - 536 GAMMAA gamma A for VOC calc non - 537 GAMMAS gamma S for VOC calc non - 538 GAMMAC gamma C for VOC calc non - 539 EOPT Eopt coefficient for VOC calc non - 540 TOPT topt coefficient for VOC calc non - 541 ALPHA alpha coefficient for VOC calc non - 542 currentPatch currentPatch coefficient for VOC calc non - 543 PAR_sun sunlit PAR umol/m2/s - 544 PAR24_sun sunlit PAR (24 hrs) umol/m2/s - 545 PAR240_sun sunlit PAR (240 hrs) umol/m2/s - 546 PAR_shade shade PAR umol/m2/s - 547 PAR24_shade shade PAR (24 hrs) umol/m2/s - 548 PAR240_shade shade PAR (240 hrs) umol/m2/s - 549 FireComp_BC fire emissions flux of BC kg/m2/sec - 550 FireComp_OC fire emissions flux of OC kg/m2/sec - 551 FireComp_SO2 fire emissions flux of SO2 kg/m2/sec - 552 FireMech_bc_a1 fire emissions flux of bc_a1 kg/m2/sec - 553 FireMech_pom_a1 fire emissions flux of pom_a1 kg/m2/sec - 554 FireMech_SO2 fire emissions flux of SO2 kg/m2/sec - 555 FireEmis_TOT Total fire emissions flux gC/m2/sec - 556 FireEmis_ZTOP Top of vertical fire emissions distribution m - 557 CROOT_PROF profile for litter C and N inputs from coarse roots 1/m - 558 FROOT_PROF profile for litter C and N inputs from fine roots 1/m - 559 LEAF_PROF profile for litter C and N inputs from leaves 1/m - 560 STEM_PROF profile for litter C and N inputs from stems 1/m - 561 NFIXATION_PROF profile for biological N fixation 1/m - 562 NDEP_PROF profile for atmospheric N deposition 1/m - 563 SOM_ADV_COEF advection term for vertical SOM translocation m/s - 564 SOM_DIFFUS_COEF diffusion coefficient for vertical SOM translocation m^2/s - 565 FPI fraction of potential immobilization proportion - 566 FPI_vr fraction of potential immobilization proportion - 567 SOILC_vr SOIL C (vertically resolved) gC/m^3 - 568 LITR1C_vr LITR1 C (vertically resolved) gC/m^3 - 569 LITR1C LITR1 C gC/m^2 - 570 LITR1C_1m LITR1 C to 1 meter gC/m^2 - 571 LITR2C_vr LITR2 C (vertically resolved) gC/m^3 - 572 LITR2C LITR2 C gC/m^2 - 573 LITR2C_1m LITR2 C to 1 meter gC/m^2 - 574 LITR3C_vr LITR3 C (vertically resolved) gC/m^3 - 575 LITR3C LITR3 C gC/m^2 - 576 LITR3C_1m LITR3 C to 1 meter gC/m^2 - 577 CWDC_vr CWD C (vertically resolved) gC/m^3 - 578 CWDC CWD C gC/m^2 - 579 CWDC_1m CWD C to 1 meter gC/m^2 - 580 SOIL1C_vr SOIL1 C (vertically resolved) gC/m^3 - 581 SOIL1C SOIL1 C gC/m^2 - 582 SOIL1C_1m SOIL1 C to 1 meter gC/m^2 - 583 SOIL2C_vr SOIL2 C (vertically resolved) gC/m^3 - 584 SOIL2C SOIL2 C gC/m^2 - 585 SOIL2C_1m SOIL2 C to 1 meter gC/m^2 - 586 SOIL3C_vr SOIL3 C (vertically resolved) gC/m^3 - 587 SOIL3C SOIL3 C gC/m^2 - 588 SOIL3C_1m SOIL3 C to 1 meter gC/m^2 - 589 TOTLITC total litter carbon gC/m^2 - 590 TOTSOMC total soil organic matter carbon gC/m^2 - 591 TOTLITC_1m total litter carbon to 1 meter depth gC/m^2 - 592 TOTSOMC_1m total soil organic matter carbon to 1 meter depth gC/m^2 - 593 COL_CTRUNC column-level sink for C truncation gC/m^2 - 594 DYN_COL_SOIL_ADJUSTMENTS_C Adjustments in soil carbon due to dynamic column areas; only makes sense at the column level: gC/m^2 - 595 HR total heterotrophic respiration gC/m^2/s - 596 LITTERC_HR litter C heterotrophic respiration gC/m^2/s - 597 SOILC_HR soil C heterotrophic respiration gC/m^2/s - 598 SOMC_FIRE C loss due to peat burning gC/m^2/s - 599 K_LITR1 litter 1 potential loss coefficient 1/s - 600 K_LITR2 litter 2 potential loss coefficient 1/s - 601 K_LITR3 litter 3 potential loss coefficient 1/s - 602 K_CWD coarse woody debris potential loss coefficient 1/s - 603 K_SOIL1 soil 1 potential loss coefficient 1/s - 604 K_SOIL2 soil 2 potential loss coefficient 1/s - 605 K_SOIL3 soil 3 potential loss coefficient 1/s - 606 LITR1_HR Het. Resp. from litter 1 gC/m^2/s - 607 LITR1C_TO_SOIL1C decomp. of litter 1 C to soil 1 C gC/m^2/s - 608 LITR1_HR_vr Het. Resp. from litter 1 gC/m^3/s - 609 LITR1C_TO_SOIL1C_vr decomp. of litter 1 C to soil 1 C gC/m^3/s - 610 LITR2_HR Het. Resp. from litter 2 gC/m^2/s - 611 LITR2C_TO_SOIL1C decomp. of litter 2 C to soil 1 C gC/m^2/s - 612 LITR2_HR_vr Het. Resp. from litter 2 gC/m^3/s - 613 LITR2C_TO_SOIL1C_vr decomp. of litter 2 C to soil 1 C gC/m^3/s - 614 LITR3_HR Het. Resp. from litter 3 gC/m^2/s - 615 LITR3C_TO_SOIL2C decomp. of litter 3 C to soil 2 C gC/m^2/s - 616 LITR3_HR_vr Het. Resp. from litter 3 gC/m^3/s - 617 LITR3C_TO_SOIL2C_vr decomp. of litter 3 C to soil 2 C gC/m^3/s - 618 SOIL1_HR_S2 Het. Resp. from soil 1 gC/m^2/s - 619 SOIL1C_TO_SOIL2C decomp. of soil 1 C to soil 2 C gC/m^2/s - 620 SOIL1_HR_S2_vr Het. Resp. from soil 1 gC/m^3/s - 621 SOIL1C_TO_SOIL2C_vr decomp. of soil 1 C to soil 2 C gC/m^3/s - 622 SOIL1_HR_S3 Het. Resp. from soil 1 gC/m^2/s - 623 SOIL1C_TO_SOIL3C decomp. of soil 1 C to soil 3 C gC/m^2/s - 624 SOIL1_HR_S3_vr Het. Resp. from soil 1 gC/m^3/s - 625 SOIL1C_TO_SOIL3C_vr decomp. of soil 1 C to soil 3 C gC/m^3/s - 626 SOIL2_HR_S1 Het. Resp. from soil 2 gC/m^2/s - 627 SOIL2C_TO_SOIL1C decomp. of soil 2 C to soil 1 C gC/m^2/s - 628 SOIL2_HR_S1_vr Het. Resp. from soil 2 gC/m^3/s - 629 SOIL2C_TO_SOIL1C_vr decomp. of soil 2 C to soil 1 C gC/m^3/s - 630 SOIL2_HR_S3 Het. Resp. from soil 2 gC/m^2/s - 631 SOIL2C_TO_SOIL3C decomp. of soil 2 C to soil 3 C gC/m^2/s - 632 SOIL2_HR_S3_vr Het. Resp. from soil 2 gC/m^3/s - 633 SOIL2C_TO_SOIL3C_vr decomp. of soil 2 C to soil 3 C gC/m^3/s - 634 SOIL3_HR Het. Resp. from soil 3 gC/m^2/s - 635 SOIL3C_TO_SOIL1C decomp. of soil 3 C to soil 1 C gC/m^2/s - 636 SOIL3_HR_vr Het. Resp. from soil 3 gC/m^3/s - 637 SOIL3C_TO_SOIL1C_vr decomp. of soil 3 C to soil 1 C gC/m^3/s - 638 CWDC_TO_LITR2C decomp. of coarse woody debris C to litter 2 C gC/m^2/s - 639 CWDC_TO_LITR2C_vr decomp. of coarse woody debris C to litter 2 C gC/m^3/s - 640 CWDC_TO_LITR3C decomp. of coarse woody debris C to litter 3 C gC/m^2/s - 641 CWDC_TO_LITR3C_vr decomp. of coarse woody debris C to litter 3 C gC/m^3/s - 642 T_SCALAR temperature inhibition of decomposition unitless - 643 W_SCALAR Moisture (dryness) inhibition of decomposition unitless - 644 O_SCALAR fraction by which decomposition is reduced due to anoxia unitless - 645 SOM_C_LEACHED total flux of C from SOM pools due to leaching gC/m^2/s - 646 M_LITR1C_TO_LEACHING litter 1 C leaching loss gC/m^2/s - 647 LITR1C_TNDNCY_VERT_TRANS litter 1 C tendency due to vertical transport gC/m^3/s - 648 M_LITR2C_TO_LEACHING litter 2 C leaching loss gC/m^2/s - 649 LITR2C_TNDNCY_VERT_TRANS litter 2 C tendency due to vertical transport gC/m^3/s - 650 M_LITR3C_TO_LEACHING litter 3 C leaching loss gC/m^2/s - 651 LITR3C_TNDNCY_VERT_TRANS litter 3 C tendency due to vertical transport gC/m^3/s - 652 M_SOIL1C_TO_LEACHING soil 1 C leaching loss gC/m^2/s - 653 SOIL1C_TNDNCY_VERT_TRANS soil 1 C tendency due to vertical transport gC/m^3/s - 654 M_SOIL2C_TO_LEACHING soil 2 C leaching loss gC/m^2/s - 655 SOIL2C_TNDNCY_VERT_TRANS soil 2 C tendency due to vertical transport gC/m^3/s - 656 M_SOIL3C_TO_LEACHING soil 3 C leaching loss gC/m^2/s - 657 SOIL3C_TNDNCY_VERT_TRANS soil 3 C tendency due to vertical transport gC/m^3/s - 658 HR_vr total vertically resolved heterotrophic respiration gC/m^3/s - 659 SOILN_vr SOIL N (vertically resolved) gN/m^3 - 660 LITR1N_vr LITR1 N (vertically resolved) gN/m^3 - 661 LITR1N LITR1 N gN/m^2 - 662 LITR1N_1m LITR1 N to 1 meter gN/m^2 - 663 LITR2N_vr LITR2 N (vertically resolved) gN/m^3 - 664 LITR2N LITR2 N gN/m^2 - 665 LITR2N_1m LITR2 N to 1 meter gN/m^2 - 666 LITR3N_vr LITR3 N (vertically resolved) gN/m^3 - 667 LITR3N LITR3 N gN/m^2 - 668 LITR3N_1m LITR3 N to 1 meter gN/m^2 - 669 CWDN_vr CWD N (vertically resolved) gN/m^3 - 670 CWDN CWD N gN/m^2 - 671 CWDN_1m CWD N to 1 meter gN/m^2 - 672 SOIL1N_vr SOIL1 N (vertically resolved) gN/m^3 - 673 SOIL1N SOIL1 N gN/m^2 - 674 SOIL1N_1m SOIL1 N to 1 meter gN/m^2 - 675 SOIL2N_vr SOIL2 N (vertically resolved) gN/m^3 - 676 SOIL2N SOIL2 N gN/m^2 - 677 SOIL2N_1m SOIL2 N to 1 meter gN/m^2 - 678 SOIL3N_vr SOIL3 N (vertically resolved) gN/m^3 - 679 SOIL3N SOIL3 N gN/m^2 - 680 SOIL3N_1m SOIL3 N to 1 meter gN/m^2 - 681 SMINN soil mineral N gN/m^2 - 682 TOTLITN_1m total litter N to 1 meter gN/m^2 - 683 TOTSOMN_1m total soil organic matter N to 1 meter gN/m^2 - 684 COL_NTRUNC column-level sink for N truncation gN/m^2 - 685 SMIN_NO3_vr soil mineral NO3 (vert. res.) gN/m^3 - 686 SMIN_NH4_vr soil mineral NH4 (vert. res.) gN/m^3 - 687 SMINN_vr soil mineral N gN/m^3 - 688 SMIN_NO3 soil mineral NO3 gN/m^2 - 689 SMIN_NH4 soil mineral NH4 gN/m^2 - 690 TOTLITN total litter N gN/m^2 - 691 TOTSOMN total soil organic matter N gN/m^2 - 692 DYN_COL_SOIL_ADJUSTMENTS_N Adjustments in soil nitrogen due to dynamic column areas; only makes sense at the column level gN/m^2 - 693 DYN_COL_SOIL_ADJUSTMENTS_NO3 Adjustments in soil NO3 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 - 694 DYN_COL_SOIL_ADJUSTMENTS_NH4 Adjustments in soil NH4 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 - 695 NDEP_TO_SMINN atmospheric N deposition to soil mineral N gN/m^2/s - 696 NFIX_TO_SMINN symbiotic/asymbiotic N fixation to soil mineral N gN/m^2/s - 697 FFIX_TO_SMINN free living N fixation to soil mineral N gN/m^2/s - 698 SMINN_TO_SOIL1N_L1 mineral N flux for decomp. of LITR1to SOIL1 gN/m^2 - 699 LITR1N_TO_SOIL1N decomp. of litter 1 N to soil 1 N gN/m^2 - 700 SMINN_TO_SOIL1N_L1_vr mineral N flux for decomp. of LITR1to SOIL1 gN/m^3 - 701 LITR1N_TO_SOIL1N_vr decomp. of litter 1 N to soil 1 N gN/m^3 - 702 SMINN_TO_SOIL1N_L2 mineral N flux for decomp. of LITR2to SOIL1 gN/m^2 - 703 LITR2N_TO_SOIL1N decomp. of litter 2 N to soil 1 N gN/m^2 - 704 SMINN_TO_SOIL1N_L2_vr mineral N flux for decomp. of LITR2to SOIL1 gN/m^3 - 705 LITR2N_TO_SOIL1N_vr decomp. of litter 2 N to soil 1 N gN/m^3 - 706 SMINN_TO_SOIL2N_L3 mineral N flux for decomp. of LITR3to SOIL2 gN/m^2 - 707 LITR3N_TO_SOIL2N decomp. of litter 3 N to soil 2 N gN/m^2 - 708 SMINN_TO_SOIL2N_L3_vr mineral N flux for decomp. of LITR3to SOIL2 gN/m^3 - 709 LITR3N_TO_SOIL2N_vr decomp. of litter 3 N to soil 2 N gN/m^3 - 710 SMINN_TO_SOIL2N_S1 mineral N flux for decomp. of SOIL1to SOIL2 gN/m^2 - 711 SOIL1N_TO_SOIL2N decomp. of soil 1 N to soil 2 N gN/m^2 - 712 SMINN_TO_SOIL2N_S1_vr mineral N flux for decomp. of SOIL1to SOIL2 gN/m^3 - 713 SOIL1N_TO_SOIL2N_vr decomp. of soil 1 N to soil 2 N gN/m^3 - 714 SMINN_TO_SOIL3N_S1 mineral N flux for decomp. of SOIL1to SOIL3 gN/m^2 - 715 SOIL1N_TO_SOIL3N decomp. of soil 1 N to soil 3 N gN/m^2 - 716 SMINN_TO_SOIL3N_S1_vr mineral N flux for decomp. of SOIL1to SOIL3 gN/m^3 - 717 SOIL1N_TO_SOIL3N_vr decomp. of soil 1 N to soil 3 N gN/m^3 - 718 SMINN_TO_SOIL1N_S2 mineral N flux for decomp. of SOIL2to SOIL1 gN/m^2 - 719 SOIL2N_TO_SOIL1N decomp. of soil 2 N to soil 1 N gN/m^2 - 720 SMINN_TO_SOIL1N_S2_vr mineral N flux for decomp. of SOIL2to SOIL1 gN/m^3 - 721 SOIL2N_TO_SOIL1N_vr decomp. of soil 2 N to soil 1 N gN/m^3 - 722 SMINN_TO_SOIL3N_S2 mineral N flux for decomp. of SOIL2to SOIL3 gN/m^2 - 723 SOIL2N_TO_SOIL3N decomp. of soil 2 N to soil 3 N gN/m^2 - 724 SMINN_TO_SOIL3N_S2_vr mineral N flux for decomp. of SOIL2to SOIL3 gN/m^3 - 725 SOIL2N_TO_SOIL3N_vr decomp. of soil 2 N to soil 3 N gN/m^3 - 726 SMINN_TO_SOIL1N_S3 mineral N flux for decomp. of SOIL3to SOIL1 gN/m^2 - 727 SOIL3N_TO_SOIL1N decomp. of soil 3 N to soil 1 N gN/m^2 - 728 SMINN_TO_SOIL1N_S3_vr mineral N flux for decomp. of SOIL3to SOIL1 gN/m^3 - 729 SOIL3N_TO_SOIL1N_vr decomp. of soil 3 N to soil 1 N gN/m^3 - 730 CWDN_TO_LITR2N decomp. of coarse woody debris N to litter 2 N gN/m^2 - 731 CWDN_TO_LITR2N_vr decomp. of coarse woody debris N to litter 2 N gN/m^3 - 732 CWDN_TO_LITR3N decomp. of coarse woody debris N to litter 3 N gN/m^2 - 733 CWDN_TO_LITR3N_vr decomp. of coarse woody debris N to litter 3 N gN/m^3 - 734 DENIT total rate of denitrification gN/m^2/s - 735 SOM_N_LEACHED total flux of N from SOM pools due to leaching gN/m^2/s - 736 M_LITR1N_TO_LEACHING litter 1 N leaching loss gN/m^2/s - 737 LITR1N_TNDNCY_VERT_TRANS litter 1 N tendency due to vertical transport gN/m^3/s - 738 M_LITR2N_TO_LEACHING litter 2 N leaching loss gN/m^2/s - 739 LITR2N_TNDNCY_VERT_TRANS litter 2 N tendency due to vertical transport gN/m^3/s - 740 M_LITR3N_TO_LEACHING litter 3 N leaching loss gN/m^2/s - 741 LITR3N_TNDNCY_VERT_TRANS litter 3 N tendency due to vertical transport gN/m^3/s - 742 M_SOIL1N_TO_LEACHING soil 1 N leaching loss gN/m^2/s - 743 SOIL1N_TNDNCY_VERT_TRANS soil 1 N tendency due to vertical transport gN/m^3/s - 744 M_SOIL2N_TO_LEACHING soil 2 N leaching loss gN/m^2/s - 745 SOIL2N_TNDNCY_VERT_TRANS soil 2 N tendency due to vertical transport gN/m^3/s - 746 M_SOIL3N_TO_LEACHING soil 3 N leaching loss gN/m^2/s - 747 SOIL3N_TNDNCY_VERT_TRANS soil 3 N tendency due to vertical transport gN/m^3/s - 748 F_NIT nitrification flux gN/m^2/s - 749 F_DENIT denitrification flux gN/m^2/s - 750 POT_F_NIT potential nitrification flux gN/m^2/s - 751 POT_F_DENIT potential denitrification flux gN/m^2/s - 752 SMIN_NO3_LEACHED soil NO3 pool loss to leaching gN/m^2/s - 753 SMIN_NO3_RUNOFF soil NO3 pool loss to runoff gN/m^2/s - 754 F_NIT_vr nitrification flux gN/m^3/s - 755 F_DENIT_vr denitrification flux gN/m^3/s - 756 POT_F_NIT_vr potential nitrification flux gN/m^3/s - 757 POT_F_DENIT_vr potential denitrification flux gN/m^3/s - 758 SMIN_NO3_LEACHED_vr soil NO3 pool loss to leaching gN/m^3/s - 759 SMIN_NO3_RUNOFF_vr soil NO3 pool loss to runoff gN/m^3/s - 760 n2_n2o_ratio_denit n2_n2o_ratio_denit gN/gN - 761 ACTUAL_IMMOB_NO3 immobilization of NO3 gN/m^3/s - 762 ACTUAL_IMMOB_NH4 immobilization of NH4 gN/m^3/s - 763 SMIN_NO3_TO_PLANT plant uptake of NO3 gN/m^3/s - 764 SMIN_NH4_TO_PLANT plant uptake of NH4 gN/m^3/s - 765 SMIN_NO3_MASSDENS SMIN_NO3_MASSDENS ugN/cm^3 soil - 766 K_NITR_T K_NITR_T unitless - 767 K_NITR_PH K_NITR_PH unitless - 768 K_NITR_H2O K_NITR_H2O unitless - 769 K_NITR K_NITR 1/s - 770 WFPS WFPS percent - 771 FMAX_DENIT_CARBONSUBSTRATE FMAX_DENIT_CARBONSUBSTRATE gN/m^3/s - 772 FMAX_DENIT_NITRATE FMAX_DENIT_NITRATE gN/m^3/s - 773 F_DENIT_BASE F_DENIT_BASE gN/m^3/s - 774 diffus diffusivity m^2/s - 775 ratio_k1 ratio_k1 none - 776 ratio_no3_co2 ratio_no3_co2 ratio - 777 soil_co2_prod soil_co2_prod ug C / g soil / day - 778 fr_WFPS fr_WFPS fraction - 779 soil_bulkdensity soil_bulkdensity kg/m3 - 780 anaerobic_frac anaerobic_frac m3/m3 - 781 r_psi r_psi m - 782 POTENTIAL_IMMOB_vr potential N immobilization gN/m^3/s - 783 ACTUAL_IMMOB_vr actual N immobilization gN/m^3/s - 784 SMINN_TO_PLANT_vr plant uptake of soil mineral N gN/m^3/s - 785 SUPPLEMENT_TO_SMINN_vr supplemental N supply gN/m^3/s - 786 GROSS_NMIN_vr gross rate of N mineralization gN/m^3/s - 787 NET_NMIN_vr net rate of N mineralization gN/m^3/s - 788 POTENTIAL_IMMOB potential N immobilization gN/m^2/s - 789 ACTUAL_IMMOB actual N immobilization gN/m^2/s - 790 SMINN_TO_PLANT plant uptake of soil mineral N gN/m^2/s - 791 SUPPLEMENT_TO_SMINN supplemental N supply gN/m^2/s - 792 GROSS_NMIN gross rate of N mineralization gN/m^2/s - 793 NET_NMIN net rate of N mineralization gN/m^2/s - 794 F_N2O_NIT nitrification N2O flux gN/m^2/s - 795 F_N2O_DENIT denitrification N2O flux gN/m^2/s - 796 FERT_TO_SMINN fertilizer to soil mineral N gN/m^2/s - 797 GDDHARV Growing degree days (gdd) needed to harvest ddays - 798 LFC2 conversion area fraction of BET and BDT that burned per sec - 799 ANNSUM_COUNTER seconds since last annual accumulator turnover s - 800 CANNAVG_T2M annual average of 2m air temperature K - 801 NFIRE fire counts valid only in Reg.C counts/km2/sec - 802 FAREA_BURNED timestep fractional area burned s-1 - 803 BAF_CROP fractional area burned for crop s-1 - 804 BAF_PEATF fractional area burned in peatland s-1 - 805 ANNAVG_T2M annual average 2m air temperature K - 806 TEMPAVG_T2M temporary average 2m air temperature K - 807 DORMANT_FLAG dormancy flag none - 808 DAYS_ACTIVE number of days since last dormancy days - 809 ONSET_FLAG onset flag none - 810 ONSET_COUNTER onset days counter days - 811 ONSET_GDDFLAG onset flag for growing degree day sum none - 812 ONSET_FDD onset freezing degree days counter C degree-days - 813 ONSET_GDD onset growing degree days C degree-days - 814 ONSET_SWI onset soil water index none - 815 OFFSET_FLAG offset flag none - 816 OFFSET_COUNTER offset days counter days - 817 OFFSET_FDD offset freezing degree days counter C degree-days - 818 OFFSET_SWI offset soil water index none - 819 LGSF long growing season factor proportion - 820 BGLFR background litterfall rate 1/s - 821 BGTR background transfer growth rate 1/s - 822 C_ALLOMETRY C allocation index none - 823 N_ALLOMETRY N allocation index none - 824 TEMPSUM_POTENTIAL_GPP temporary annual sum of potential GPP gC/m^2/yr - 825 ANNSUM_POTENTIAL_GPP annual sum of potential GPP gN/m^2/yr - 826 TEMPMAX_RETRANSN temporary annual max of retranslocated N pool gN/m^2 - 827 ANNMAX_RETRANSN annual max of retranslocated N pool gN/m^2 - 828 DOWNREG fractional reduction in GPP due to N limitation proportion - 829 LEAFCN_OFFSET Leaf C:N used by FUN unitless - 830 PLANTCN Plant C:N used by FUN unitless - 831 GRAINC grain C (does not equal yield) gC/m^2 - 832 CROPSEEDC_DEFICIT C used for crop seed that needs to be repaid gC/m^2 - 833 XSMRPOOL_LOSS temporary photosynthate C pool loss gC/m^2 - 834 WOODC wood C gC/m^2 - 835 LEAFC leaf C gC/m^2 - 836 LEAFC_STORAGE leaf C storage gC/m^2 - 837 LEAFC_XFER leaf C transfer gC/m^2 - 838 LEAFC_STORAGE_XFER_ACC Accumulated leaf C transfer gC/m^2 - 839 STORAGE_CDEMAND C use from the C storage pool gC/m^2 - 840 FROOTC fine root C gC/m^2 - 841 FROOTC_STORAGE fine root C storage gC/m^2 - 842 FROOTC_XFER fine root C transfer gC/m^2 - 843 LIVESTEMC live stem C gC/m^2 - 844 LIVESTEMC_STORAGE live stem C storage gC/m^2 - 845 LIVESTEMC_XFER live stem C transfer gC/m^2 - 846 DEADSTEMC dead stem C gC/m^2 - 847 DEADSTEMC_STORAGE dead stem C storage gC/m^2 - 848 DEADSTEMC_XFER dead stem C transfer gC/m^2 - 849 LIVECROOTC live coarse root C gC/m^2 - 850 LIVECROOTC_STORAGE live coarse root C storage gC/m^2 - 851 LIVECROOTC_XFER live coarse root C transfer gC/m^2 - 852 DEADCROOTC dead coarse root C gC/m^2 - 853 DEADCROOTC_STORAGE dead coarse root C storage gC/m^2 - 854 DEADCROOTC_XFER dead coarse root C transfer gC/m^2 - 855 GRESP_STORAGE growth respiration storage gC/m^2 - 856 GRESP_XFER growth respiration transfer gC/m^2 - 857 CPOOL temporary photosynthate C pool gC/m^2 - 858 XSMRPOOL temporary photosynthate C pool gC/m^2 - 859 PFT_CTRUNC patch-level sink for C truncation gC/m^2 - 860 DISPVEGC displayed veg carbon, excluding storage and cpool gC/m^2 - 861 STORVEGC stored vegetation carbon, excluding cpool gC/m^2 - 862 TOTVEGC total vegetation carbon, excluding cpool gC/m^2 - 863 TOTPFTC total patch-level carbon, including cpool gC/m^2 - 864 SEEDC pool for seeding new PFTs via dynamic landcover gC/m^2 - 865 FUELC fuel load gC/m^2 - 866 TOTCOLC total column carbon, incl veg and cpool but excl product pools gC/m^2 - 867 TOTECOSYSC total ecosystem carbon, incl veg but excl cpool and product pools gC/m^2 - 868 GRAINC_TO_FOOD grain C to food gC/m^2/s - 869 LEAFC_TO_BIOFUELC leaf C to biofuel C gC/m^2/s - 870 LIVESTEMC_TO_BIOFUELC livestem C to biofuel C gC/m^2/s - 871 GRAINC_TO_SEED grain C to seed gC/m^2/s - 872 LITTERC_LOSS litter C loss gC/m^2/s - 873 WOODC_ALLOC wood C eallocation gC/m^2/s - 874 WOODC_LOSS wood C loss gC/m^2/s - 875 LEAFC_LOSS leaf C loss gC/m^2/s - 876 LEAFC_ALLOC leaf C allocation gC/m^2/s - 877 FROOTC_LOSS fine root C loss gC/m^2/s - 878 FROOTC_ALLOC fine root C allocation gC/m^2/s - 879 M_LEAFC_TO_LITTER leaf C mortality gC/m^2/s - 880 M_FROOTC_TO_LITTER fine root C mortality gC/m^2/s - 881 M_LEAFC_STORAGE_TO_LITTER leaf C storage mortality gC/m^2/s - 882 M_FROOTC_STORAGE_TO_LITTER fine root C storage mortality gC/m^2/s - 883 M_LIVESTEMC_STORAGE_TO_LITTER live stem C storage mortality gC/m^2/s - 884 M_DEADSTEMC_STORAGE_TO_LITTER dead stem C storage mortality gC/m^2/s - 885 M_LIVECROOTC_STORAGE_TO_LITTER live coarse root C storage mortality gC/m^2/s - 886 M_DEADCROOTC_STORAGE_TO_LITTER dead coarse root C storage mortality gC/m^2/s - 887 M_LEAFC_XFER_TO_LITTER leaf C transfer mortality gC/m^2/s - 888 M_FROOTC_XFER_TO_LITTER fine root C transfer mortality gC/m^2/s - 889 M_LIVESTEMC_XFER_TO_LITTER live stem C transfer mortality gC/m^2/s - 890 M_DEADSTEMC_XFER_TO_LITTER dead stem C transfer mortality gC/m^2/s - 891 M_LIVECROOTC_XFER_TO_LITTER live coarse root C transfer mortality gC/m^2/s - 892 M_DEADCROOTC_XFER_TO_LITTER dead coarse root C transfer mortality gC/m^2/s - 893 M_LIVESTEMC_TO_LITTER live stem C mortality gC/m^2/s - 894 M_DEADSTEMC_TO_LITTER dead stem C mortality gC/m^2/s - 895 M_LIVECROOTC_TO_LITTER live coarse root C mortality gC/m^2/s - 896 M_DEADCROOTC_TO_LITTER dead coarse root C mortality gC/m^2/s - 897 M_GRESP_STORAGE_TO_LITTER growth respiration storage mortality gC/m^2/s - 898 M_GRESP_XFER_TO_LITTER growth respiration transfer mortality gC/m^2/s - 899 M_LEAFC_TO_FIRE leaf C fire loss gC/m^2/s - 900 M_LEAFC_STORAGE_TO_FIRE leaf C storage fire loss gC/m^2/s - 901 M_LEAFC_XFER_TO_FIRE leaf C transfer fire loss gC/m^2/s - 902 M_LIVESTEMC_TO_FIRE live stem C fire loss gC/m^2/s - 903 M_LIVESTEMC_STORAGE_TO_FIRE live stem C storage fire loss gC/m^2/s - 904 M_LIVESTEMC_XFER_TO_FIRE live stem C transfer fire loss gC/m^2/s - 905 M_DEADSTEMC_TO_FIRE dead stem C fire loss gC/m^2/s - 906 M_DEADSTEMC_STORAGE_TO_FIRE dead stem C storage fire loss gC/m^2/s - 907 M_DEADSTEMC_XFER_TO_FIRE dead stem C transfer fire loss gC/m^2/s - 908 M_FROOTC_TO_FIRE fine root C fire loss gC/m^2/s - 909 M_FROOTC_STORAGE_TO_FIRE fine root C storage fire loss gC/m^2/s - 910 M_FROOTC_XFER_TO_FIRE fine root C transfer fire loss gC/m^2/s - 911 M_LIVEROOTC_TO_FIRE live root C fire loss gC/m^2/s - 912 M_LIVEROOTC_STORAGE_TO_FIRE live root C storage fire loss gC/m^2/s - 913 M_LIVEROOTC_XFER_TO_FIRE live root C transfer fire loss gC/m^2/s - 914 M_DEADROOTC_TO_FIRE dead root C fire loss gC/m^2/s - 915 M_DEADROOTC_STORAGE_TO_FIRE dead root C storage fire loss gC/m^2/s - 916 M_DEADROOTC_XFER_TO_FIRE dead root C transfer fire loss gC/m^2/s - 917 M_GRESP_STORAGE_TO_FIRE growth respiration storage fire loss gC/m^2/s - 918 M_GRESP_XFER_TO_FIRE growth respiration transfer fire loss gC/m^2/s - 919 M_LEAFC_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s - 920 M_LEAFC_STORAGE_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s - 921 M_LEAFC_XFER_TO_LITTER_FIRE leaf C transfer fire mortality to litter gC/m^2/s - 922 M_LIVESTEMC_TO_LITTER_FIRE live stem C fire mortality to litter gC/m^2/s - 923 M_LIVESTEMC_STORAGE_TO_LITTER_FIRE live stem C storage fire mortality to litter gC/m^2/s - 924 M_LIVESTEMC_XFER_TO_LITTER_FIRE live stem C transfer fire mortality to litter gC/m^2/s - 925 M_LIVESTEMC_TO_DEADSTEMC_FIRE live stem C fire mortality to dead stem C gC/m^2/s - 926 M_DEADSTEMC_TO_LITTER_FIRE dead stem C fire mortality to litter gC/m^2/s - 927 M_DEADSTEMC_STORAGE_TO_LITTER_FIRE dead stem C storage fire mortality to litter gC/m^2/s - 928 M_DEADSTEMC_XFER_TO_LITTER_FIRE dead stem C transfer fire mortality to litter gC/m^2/s - 929 M_FROOTC_TO_LITTER_FIRE fine root C fire mortality to litter gC/m^2/s - 930 M_FROOTC_STORAGE_TO_LITTER_FIRE fine root C storage fire mortality to litter gC/m^2/s - 931 M_FROOTC_XFER_TO_LITTER_FIRE fine root C transfer fire mortality to litter gC/m^2/s - 932 M_LIVEROOTC_TO_LITTER_FIRE live root C fire mortality to litter gC/m^2/s - 933 M_LIVEROOTC_STORAGE_TO_LITTER_FIRE live root C storage fire mortality to litter gC/m^2/s - 934 M_LIVEROOTC_XFER_TO_LITTER_FIRE live root C transfer fire mortality to litter gC/m^2/s - 935 M_LIVEROOTC_TO_DEADROOTC_FIRE live root C fire mortality to dead root C gC/m^2/s - 936 M_DEADROOTC_TO_LITTER_FIRE dead root C fire mortality to litter gC/m^2/s - 937 M_DEADROOTC_STORAGE_TO_LITTER_FIRE dead root C storage fire mortality to litter gC/m^2/s - 938 M_DEADROOTC_XFER_TO_LITTER_FIRE dead root C transfer fire mortality to litter gC/m^2/s - 939 M_LIVECROOTC_STORAGE_TO_LITTER_FIRE live coarse root C fire mortality to litter gC/m^2/s - 940 M_DEADCROOTC_STORAGE_TO_LITTER_FIRE dead coarse root C storage fire mortality to litter gC/m^2/s - 941 M_GRESP_STORAGE_TO_LITTER_FIRE growth respiration storage fire mortality to litter gC/m^2/s - 942 M_GRESP_XFER_TO_LITTER_FIRE growth respiration transfer fire mortality to litter gC/m^2/s - 943 LEAFC_XFER_TO_LEAFC leaf C growth from storage gC/m^2/s - 944 FROOTC_XFER_TO_FROOTC fine root C growth from storage gC/m^2/s - 945 LIVESTEMC_XFER_TO_LIVESTEMC live stem C growth from storage gC/m^2/s - 946 DEADSTEMC_XFER_TO_DEADSTEMC dead stem C growth from storage gC/m^2/s - 947 LIVECROOTC_XFER_TO_LIVECROOTC live coarse root C growth from storage gC/m^2/s - 948 DEADCROOTC_XFER_TO_DEADCROOTC dead coarse root C growth from storage gC/m^2/s - 949 LEAFC_TO_LITTER leaf C litterfall gC/m^2/s - 950 LEAFC_TO_LITTER_FUN leaf C litterfall used by FUN gC/m^2/s - 951 FROOTC_TO_LITTER fine root C litterfall gC/m^2/s - 952 EXCESSC_MR excess C maintenance respiration gC/m^2/s - 953 LEAF_MR leaf maintenance respiration gC/m^2/s - 954 FROOT_MR fine root maintenance respiration gC/m^2/s - 955 LIVESTEM_MR live stem maintenance respiration gC/m^2/s - 956 LIVECROOT_MR live coarse root maintenance respiration gC/m^2/s - 957 PSNSUN_TO_CPOOL C fixation from sunlit canopy gC/m^2/s - 958 PSNSHADE_TO_CPOOL C fixation from shaded canopy gC/m^2/s - 959 CPOOL_TO_LEAFC allocation to leaf C gC/m^2/s - 960 CPOOL_TO_LEAFC_STORAGE allocation to leaf C storage gC/m^2/s - 961 CPOOL_TO_FROOTC allocation to fine root C gC/m^2/s - 962 CPOOL_TO_FROOTC_STORAGE allocation to fine root C storage gC/m^2/s - 963 CPOOL_TO_LIVESTEMC allocation to live stem C gC/m^2/s - 964 CPOOL_TO_LIVESTEMC_STORAGE allocation to live stem C storage gC/m^2/s - 965 CPOOL_TO_DEADSTEMC allocation to dead stem C gC/m^2/s - 966 CPOOL_TO_DEADSTEMC_STORAGE allocation to dead stem C storage gC/m^2/s - 967 CPOOL_TO_LIVECROOTC allocation to live coarse root C gC/m^2/s - 968 CPOOL_TO_LIVECROOTC_STORAGE allocation to live coarse root C storage gC/m^2/s - 969 CPOOL_TO_DEADCROOTC allocation to dead coarse root C gC/m^2/s - 970 CPOOL_TO_DEADCROOTC_STORAGE allocation to dead coarse root C storage gC/m^2/s - 971 CPOOL_TO_GRESP_STORAGE allocation to growth respiration storage gC/m^2/s - 972 CPOOL_LEAF_GR leaf growth respiration gC/m^2/s - 973 CPOOL_LEAF_STORAGE_GR leaf growth respiration to storage gC/m^2/s - 974 TRANSFER_LEAF_GR leaf growth respiration from storage gC/m^2/s - 975 CPOOL_FROOT_GR fine root growth respiration gC/m^2/s - 976 CPOOL_FROOT_STORAGE_GR fine root growth respiration to storage gC/m^2/s - 977 TRANSFER_FROOT_GR fine root growth respiration from storage gC/m^2/s - 978 CPOOL_LIVESTEM_GR live stem growth respiration gC/m^2/s - 979 CPOOL_LIVESTEM_STORAGE_GR live stem growth respiration to storage gC/m^2/s - 980 TRANSFER_LIVESTEM_GR live stem growth respiration from storage gC/m^2/s - 981 CPOOL_DEADSTEM_GR dead stem growth respiration gC/m^2/s - 982 CPOOL_DEADSTEM_STORAGE_GR dead stem growth respiration to storage gC/m^2/s - 983 TRANSFER_DEADSTEM_GR dead stem growth respiration from storage gC/m^2/s - 984 CPOOL_LIVECROOT_GR live coarse root growth respiration gC/m^2/s - 985 CPOOL_LIVECROOT_STORAGE_GR live coarse root growth respiration to storage gC/m^2/s - 986 TRANSFER_LIVECROOT_GR live coarse root growth respiration from storage gC/m^2/s - 987 CPOOL_DEADCROOT_GR dead coarse root growth respiration gC/m^2/s - 988 CPOOL_DEADCROOT_STORAGE_GR dead coarse root growth respiration to storage gC/m^2/s - 989 TRANSFER_DEADCROOT_GR dead coarse root growth respiration from storage gC/m^2/s - 990 LEAFC_STORAGE_TO_XFER leaf C shift storage to transfer gC/m^2/s - 991 FROOTC_STORAGE_TO_XFER fine root C shift storage to transfer gC/m^2/s - 992 LIVESTEMC_STORAGE_TO_XFER live stem C shift storage to transfer gC/m^2/s - 993 DEADSTEMC_STORAGE_TO_XFER dead stem C shift storage to transfer gC/m^2/s - 994 LIVECROOTC_STORAGE_TO_XFER live coarse root C shift storage to transfer gC/m^2/s - 995 DEADCROOTC_STORAGE_TO_XFER dead coarse root C shift storage to transfer gC/m^2/s - 996 GRESP_STORAGE_TO_XFER growth respiration shift storage to transfer gC/m^2/s - 997 LIVESTEMC_TO_DEADSTEMC live stem C turnover gC/m^2/s - 998 LIVECROOTC_TO_DEADCROOTC live coarse root C turnover gC/m^2/s - 999 INIT_GPP GPP flux before downregulation gC/m^2/s -1000 CURRENT_GR growth resp for new growth displayed in this timestep gC/m^2/s -1001 TRANSFER_GR growth resp for transfer growth displayed in this timestep gC/m^2/s -1002 STORAGE_GR growth resp for growth sent to storage for later display gC/m^2/s -1003 AVAILC C flux available for allocation gC/m^2/s -1004 PLANT_CALLOC total allocated C flux gC/m^2/s -1005 EXCESS_CFLUX C flux not allocated due to downregulation gC/m^2/s -1006 PREV_LEAFC_TO_LITTER previous timestep leaf C litterfall flux gC/m^2/s -1007 PREV_FROOTC_TO_LITTER previous timestep froot C litterfall flux gC/m^2/s -1008 XSMRPOOL_RECOVER C flux assigned to recovery of negative xsmrpool gC/m^2/s -1009 GPP gross primary production gC/m^2/s -1010 RR root respiration (fine root MR + total root GR) gC/m^2/s -1011 MR maintenance respiration gC/m^2/s -1012 GR total growth respiration gC/m^2/s -1013 AR autotrophic respiration (MR + GR) gC/m^2/s -1014 NPP net primary production gC/m^2/s -1015 AGNPP aboveground NPP gC/m^2/s -1016 BGNPP belowground NPP gC/m^2/s -1017 LITFALL litterfall (leaves and fine roots) gC/m^2/s -1018 WOOD_HARVESTC wood harvest carbon (to product pools) gC/m^2/s -1019 SLASH_HARVESTC slash harvest carbon (to litter) gC/m^2/s -1020 PFT_FIRE_CLOSS total patch-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s -1021 NPP_NACTIVE Mycorrhizal N uptake used C gC/m^2/s -1022 NPP_BURNEDOFF C that cannot be used for N uptake gC/m^2/s -1023 NPP_NNONMYC Non-mycorrhizal N uptake used C gC/m^2/s -1024 NPP_NAM AM-associated N uptake used C gC/m^2/s -1025 NPP_NECM ECM-associated N uptake used C gC/m^2/s -1026 NPP_NACTIVE_NO3 Mycorrhizal N uptake used C gC/m^2/s -1027 NPP_NACTIVE_NH4 Mycorrhizal N uptake use C gC/m^2/s -1028 NPP_NNONMYC_NO3 Non-mycorrhizal N uptake use C gC/m^2/s -1029 NPP_NNONMYC_NH4 Non-mycorrhizal N uptake use C gC/m^2/s -1030 NPP_NAM_NO3 AM-associated N uptake use C gC/m^2/s -1031 NPP_NAM_NH4 AM-associated N uptake use C gC/m^2/s -1032 NPP_NECM_NO3 ECM-associated N uptake used C gC/m^2/s -1033 NPP_NECM_NH4 ECM-associated N uptake use C gC/m^2/s -1034 NPP_NFIX Symbiotic BNF uptake used C gC/m^2/s -1035 NPP_NRETRANS Retranslocated N uptake flux gC/m^2/s -1036 NPP_NUPTAKE Total C used by N uptake in FUN gC/m^2/s -1037 NPP_GROWTH Total C used for growth in FUN gC/m^2/s -1038 LEAFC_CHANGE C change in leaf gC/m^2/s -1039 SOILC_CHANGE C change in soil gC/m^2/s -1040 CWDC_LOSS coarse woody debris C loss gC/m^2/s -1041 M_LITR1C_TO_FIRE litter 1 C fire loss gC/m^2/s -1042 M_LITR1C_TO_FIRE_vr litter 1 C fire loss gC/m^3/s -1043 M_LITR2C_TO_FIRE litter 2 C fire loss gC/m^2/s -1044 M_LITR2C_TO_FIRE_vr litter 2 C fire loss gC/m^3/s -1045 M_LITR3C_TO_FIRE litter 3 C fire loss gC/m^2/s -1046 M_LITR3C_TO_FIRE_vr litter 3 C fire loss gC/m^3/s -1047 M_CWDC_TO_FIRE coarse woody debris C fire loss gC/m^2/s -1048 M_CWDC_TO_FIRE_vr coarse woody debris C fire loss gC/m^3/s -1049 DWT_SEEDC_TO_LEAF seed source to patch-level leaf gC/m^2/s -1050 DWT_SEEDC_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gC/m^2/s -1051 DWT_SEEDC_TO_DEADSTEM seed source to patch-level deadstem gC/m^2/s -1052 DWT_SEEDC_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gC/m^2/s -1053 DWT_CONV_CFLUX conversion C flux (immediate loss to atm) (0 at all times except first timestep of year) gC/m^2/s -1054 DWT_CONV_CFLUX_PATCH patch-level conversion C flux (immediate loss to atm) (0 at all times except first timestep of gC/m^2/s -1055 DWT_CONV_CFLUX_DRIBBLED conversion C flux (immediate loss to atm), dribbled throughout the year gC/m^2/s -1056 DWT_WOOD_PRODUCTC_GAIN_PATCH patch-level landcover change-driven addition to wood product pools(0 at all times except first gC/m^2/s -1057 DWT_SLASH_CFLUX slash C flux (to litter diagnostic only) (0 at all times except first timestep of year) gC/m^2/s -1058 DWT_SLASH_CFLUX_PATCH patch-level slash C flux (to litter diagnostic only) (0 at all times except first timestep of gC/m^2/s -1059 DWT_FROOTC_TO_LITR_MET_C fine root to litter due to landcover change gC/m^2/s -1060 DWT_FROOTC_TO_LITR_CEL_C fine root to litter due to landcover change gC/m^2/s -1061 DWT_FROOTC_TO_LITR_LIG_C fine root to litter due to landcover change gC/m^2/s -1062 DWT_LIVECROOTC_TO_CWDC live coarse root to CWD due to landcover change gC/m^2/s -1063 DWT_DEADCROOTC_TO_CWDC dead coarse root to CWD due to landcover change gC/m^2/s -1064 CROP_SEEDC_TO_LEAF crop seed source to leaf gC/m^2/s -1065 SR total soil respiration (HR + root resp) gC/m^2/s -1066 ER total ecosystem respiration, autotrophic + heterotrophic gC/m^2/s -1067 LITFIRE litter fire losses gC/m^2/s -1068 SOMFIRE soil organic matter fire losses gC/m^2/s -1069 TOTFIRE total ecosystem fire losses gC/m^2/s -1070 COL_FIRE_CLOSS total column-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s -1071 ANNSUM_NPP annual sum of NPP gC/m^2/yr -1072 CANNSUM_NPP annual sum of column-level NPP gC/m^2/s -1073 NEP net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink gC/m^2/s -1074 NBP net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux (latter smoothed o gC/m^2/s -1075 NEE net ecosystem exchange of carbon, includes fire and hrv_xsmrpool (latter smoothed over the yea gC/m^2/s -1076 LAND_USE_FLUX total C emitted from land cover conversion (smoothed over the year) and wood and grain product gC/m^2/s -1077 GRAINN grain N gN/m^2 -1078 CROPSEEDN_DEFICIT N used for crop seed that needs to be repaid gN/m^2 -1079 LEAFN leaf N gN/m^2 -1080 LEAFN_STORAGE leaf N storage gN/m^2 -1081 LEAFN_XFER leaf N transfer gN/m^2 -1082 LEAFN_STORAGE_XFER_ACC Accmulated leaf N transfer gN/m^2 -1083 STORAGE_NDEMAND N demand during the offset period gN/m^2 -1084 FROOTN fine root N gN/m^2 -1085 FROOTN_STORAGE fine root N storage gN/m^2 -1086 FROOTN_XFER fine root N transfer gN/m^2 -1087 LIVESTEMN live stem N gN/m^2 -1088 LIVESTEMN_STORAGE live stem N storage gN/m^2 -1089 LIVESTEMN_XFER live stem N transfer gN/m^2 -1090 DEADSTEMN dead stem N gN/m^2 -1091 DEADSTEMN_STORAGE dead stem N storage gN/m^2 -1092 DEADSTEMN_XFER dead stem N transfer gN/m^2 -1093 LIVECROOTN live coarse root N gN/m^2 -1094 LIVECROOTN_STORAGE live coarse root N storage gN/m^2 -1095 LIVECROOTN_XFER live coarse root N transfer gN/m^2 -1096 DEADCROOTN dead coarse root N gN/m^2 -1097 DEADCROOTN_STORAGE dead coarse root N storage gN/m^2 -1098 DEADCROOTN_XFER dead coarse root N transfer gN/m^2 -1099 RETRANSN plant pool of retranslocated N gN/m^2 -1100 NPOOL temporary plant N pool gN/m^2 -1101 PFT_NTRUNC patch-level sink for N truncation gN/m^2 -1102 DISPVEGN displayed vegetation nitrogen gN/m^2 -1103 STORVEGN stored vegetation nitrogen gN/m^2 -1104 TOTVEGN total vegetation nitrogen gN/m^2 -1105 TOTPFTN total patch-level nitrogen gN/m^2 -1106 SEEDN pool for seeding new PFTs via dynamic landcover gN/m^2 -1107 TOTECOSYSN total ecosystem N, excluding product pools gN/m^2 -1108 TOTCOLN total column-level N, excluding product pools gN/m^2 -1109 M_LEAFN_TO_LITTER leaf N mortality gN/m^2/s -1110 M_FROOTN_TO_LITTER fine root N mortality gN/m^2/s -1111 M_LEAFN_STORAGE_TO_LITTER leaf N storage mortality gN/m^2/s -1112 M_FROOTN_STORAGE_TO_LITTER fine root N storage mortality gN/m^2/s -1113 M_LIVESTEMN_STORAGE_TO_LITTER live stem N storage mortality gN/m^2/s -1114 M_DEADSTEMN_STORAGE_TO_LITTER dead stem N storage mortality gN/m^2/s -1115 M_LIVECROOTN_STORAGE_TO_LITTER live coarse root N storage mortality gN/m^2/s -1116 M_DEADCROOTN_STORAGE_TO_LITTER dead coarse root N storage mortality gN/m^2/s -1117 M_LEAFN_XFER_TO_LITTER leaf N transfer mortality gN/m^2/s -1118 M_FROOTN_XFER_TO_LITTER fine root N transfer mortality gN/m^2/s -1119 M_LIVESTEMN_XFER_TO_LITTER live stem N transfer mortality gN/m^2/s -1120 M_DEADSTEMN_XFER_TO_LITTER dead stem N transfer mortality gN/m^2/s -1121 M_LIVECROOTN_XFER_TO_LITTER live coarse root N transfer mortality gN/m^2/s -1122 M_DEADCROOTN_XFER_TO_LITTER dead coarse root N transfer mortality gN/m^2/s -1123 M_LIVESTEMN_TO_LITTER live stem N mortality gN/m^2/s -1124 M_DEADSTEMN_TO_LITTER dead stem N mortality gN/m^2/s -1125 M_LIVECROOTN_TO_LITTER live coarse root N mortality gN/m^2/s -1126 M_DEADCROOTN_TO_LITTER dead coarse root N mortality gN/m^2/s -1127 M_RETRANSN_TO_LITTER retranslocated N pool mortality gN/m^2/s -1128 M_LEAFN_TO_FIRE leaf N fire loss gN/m^2/s -1129 M_FROOTN_TO_FIRE fine root N fire loss gN/m^2/s -1130 M_LEAFN_STORAGE_TO_FIRE leaf N storage fire loss gN/m^2/s -1131 M_FROOTN_STORAGE_TO_FIRE fine root N storage fire loss gN/m^2/s -1132 M_LIVESTEMN_STORAGE_TO_FIRE live stem N storage fire loss gN/m^2/s -1133 M_DEADSTEMN_STORAGE_TO_FIRE dead stem N storage fire loss gN/m^2/s -1134 M_LIVECROOTN_STORAGE_TO_FIRE live coarse root N storage fire loss gN/m^2/s -1135 M_DEADCROOTN_STORAGE_TO_FIRE dead coarse root N storage fire loss gN/m^2/s -1136 M_LEAFN_XFER_TO_FIRE leaf N transfer fire loss gN/m^2/s -1137 M_FROOTN_XFER_TO_FIRE fine root N transfer fire loss gN/m^2/s -1138 M_LIVESTEMN_XFER_TO_FIRE live stem N transfer fire loss gN/m^2/s -1139 M_DEADSTEMN_XFER_TO_FIRE dead stem N transfer fire loss gN/m^2/s -1140 M_LIVECROOTN_XFER_TO_FIRE live coarse root N transfer fire loss gN/m^2/s -1141 M_DEADCROOTN_XFER_TO_FIRE dead coarse root N transfer fire loss gN/m^2/s -1142 M_LIVESTEMN_TO_FIRE live stem N fire loss gN/m^2/s -1143 M_DEADSTEMN_TO_FIRE dead stem N fire loss gN/m^2/s -1144 M_DEADSTEMN_TO_LITTER_FIRE dead stem N fire mortality to litter gN/m^2/s -1145 M_LIVECROOTN_TO_FIRE live coarse root N fire loss gN/m^2/s -1146 M_DEADCROOTN_TO_FIRE dead coarse root N fire loss gN/m^2/s -1147 M_DEADCROOTN_TO_LITTER_FIRE dead coarse root N fire mortality to litter gN/m^2/s -1148 M_RETRANSN_TO_FIRE retranslocated N pool fire loss gN/m^2/s -1149 LEAFN_XFER_TO_LEAFN leaf N growth from storage gN/m^2/s -1150 FROOTN_XFER_TO_FROOTN fine root N growth from storage gN/m^2/s -1151 LIVESTEMN_XFER_TO_LIVESTEMN live stem N growth from storage gN/m^2/s -1152 DEADSTEMN_XFER_TO_DEADSTEMN dead stem N growth from storage gN/m^2/s -1153 LIVECROOTN_XFER_TO_LIVECROOTN live coarse root N growth from storage gN/m^2/s -1154 DEADCROOTN_XFER_TO_DEADCROOTN dead coarse root N growth from storage gN/m^2/s -1155 LEAFN_TO_LITTER leaf N litterfall gN/m^2/s -1156 LEAFN_TO_RETRANSN leaf N to retranslocated N pool gN/m^2/s -1157 FROOTN_TO_LITTER fine root N litterfall gN/m^2/s -1158 RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s -1159 FREE_RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s -1160 SMINN_TO_NPOOL deployment of soil mineral N uptake gN/m^2/s -1161 NPOOL_TO_LEAFN allocation to leaf N gN/m^2/s -1162 NPOOL_TO_LEAFN_STORAGE allocation to leaf N storage gN/m^2/s -1163 NPOOL_TO_FROOTN allocation to fine root N gN/m^2/s -1164 NPOOL_TO_FROOTN_STORAGE allocation to fine root N storage gN/m^2/s -1165 NPOOL_TO_LIVESTEMN allocation to live stem N gN/m^2/s -1166 NPOOL_TO_LIVESTEMN_STORAGE allocation to live stem N storage gN/m^2/s -1167 NPOOL_TO_DEADSTEMN allocation to dead stem N gN/m^2/s -1168 NPOOL_TO_DEADSTEMN_STORAGE allocation to dead stem N storage gN/m^2/s -1169 NPOOL_TO_LIVECROOTN allocation to live coarse root N gN/m^2/s -1170 NPOOL_TO_LIVECROOTN_STORAGE allocation to live coarse root N storage gN/m^2/s -1171 NPOOL_TO_DEADCROOTN allocation to dead coarse root N gN/m^2/s -1172 NPOOL_TO_DEADCROOTN_STORAGE allocation to dead coarse root N storage gN/m^2/s -1173 LEAFN_STORAGE_TO_XFER leaf N shift storage to transfer gN/m^2/s -1174 FROOTN_STORAGE_TO_XFER fine root N shift storage to transfer gN/m^2/s -1175 LIVESTEMN_STORAGE_TO_XFER live stem N shift storage to transfer gN/m^2/s -1176 DEADSTEMN_STORAGE_TO_XFER dead stem N shift storage to transfer gN/m^2/s -1177 LIVECROOTN_STORAGE_TO_XFER live coarse root N shift storage to transfer gN/m^2/s -1178 DEADCROOTN_STORAGE_TO_XFER dead coarse root N shift storage to transfer gN/m^2/s -1179 LIVESTEMN_TO_DEADSTEMN live stem N turnover gN/m^2/s -1180 LIVESTEMN_TO_RETRANSN live stem N to retranslocated N pool gN/m^2/s -1181 LIVECROOTN_TO_DEADCROOTN live coarse root N turnover gN/m^2/s -1182 LIVECROOTN_TO_RETRANSN live coarse root N to retranslocated N pool gN/m^2/s -1183 NDEPLOY total N deployed in new growth gN/m^2/s -1184 WOOD_HARVESTN wood harvest N (to product pools) gN/m^2/s -1185 PFT_FIRE_NLOSS total patch-level fire N loss gN/m^2/s -1186 NFERTILIZATION fertilizer added gN/m^2/s -1187 FERT_COUNTER time left to fertilize seconds -1188 M_LITR1N_TO_FIRE litter 1 N fire loss gN/m^2 -1189 M_LITR1N_TO_FIRE_vr litter 1 N fire loss gN/m^3 -1190 M_LITR2N_TO_FIRE litter 2 N fire loss gN/m^2 -1191 M_LITR2N_TO_FIRE_vr litter 2 N fire loss gN/m^3 -1192 M_LITR3N_TO_FIRE litter 3 N fire loss gN/m^2 -1193 M_LITR3N_TO_FIRE_vr litter 3 N fire loss gN/m^3 -1194 M_CWDN_TO_FIRE coarse woody debris N fire loss gN/m^2 -1195 M_CWDN_TO_FIRE_vr coarse woody debris N fire loss gN/m^3 -1196 COL_FIRE_NLOSS total column-level fire N loss gN/m^2/s -1197 DWT_SEEDN_TO_LEAF seed source to patch-level leaf gN/m^2/s -1198 DWT_SEEDN_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gN/m^2/s -1199 DWT_SEEDN_TO_DEADSTEM seed source to patch-level deadstem gN/m^2/s -1200 DWT_SEEDN_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gN/m^2/s -1201 DWT_CONV_NFLUX conversion N flux (immediate loss to atm) (0 at all times except first timestep of year) gN/m^2/s -1202 DWT_CONV_NFLUX_PATCH patch-level conversion N flux (immediate loss to atm) (0 at all times except first timestep of gN/m^2/s -1203 DWT_FROOTN_TO_LITR_MET_N fine root to litter due to landcover change gN/m^2/s -1204 DWT_FROOTN_TO_LITR_CEL_N fine root to litter due to landcover change gN/m^2/s -1205 DWT_FROOTN_TO_LITR_LIG_N fine root to litter due to landcover change gN/m^2/s -1206 DWT_LIVECROOTN_TO_CWDN live coarse root to CWD due to landcover change gN/m^2/s -1207 DWT_DEADCROOTN_TO_CWDN dead coarse root to CWD due to landcover change gN/m^2/s -1208 CROP_SEEDN_TO_LEAF crop seed source to leaf gN/m^2/s -1209 PLANT_NDEMAND N flux required to support initial GPP gN/m^2/s -1210 AVAIL_RETRANSN N flux available from retranslocation pool gN/m^2/s -1211 PLANT_NALLOC total allocated N flux gN/m^2/s -1212 NACTIVE Mycorrhizal N uptake flux gN/m^2/s -1213 NNONMYC Non-mycorrhizal N uptake flux gN/m^2/s -1214 NAM AM-associated N uptake flux gN/m^2/s -1215 NECM ECM-associated N uptake flux gN/m^2/s -1216 NACTIVE_NO3 Mycorrhizal N uptake flux gN/m^2/s -1217 NACTIVE_NH4 Mycorrhizal N uptake flux gN/m^2/s -1218 NNONMYC_NO3 Non-mycorrhizal N uptake flux gN/m^2/s -1219 NNONMYC_NH4 Non-mycorrhizal N uptake flux gN/m^2/s -1220 NAM_NO3 AM-associated N uptake flux gN/m^2/s -1221 NAM_NH4 AM-associated N uptake flux gN/m^2/s -1222 NECM_NO3 ECM-associated N uptake flux gN/m^2/s -1223 NECM_NH4 ECM-associated N uptake flux gN/m^2/s -1224 NPASSIVE Passive N uptake flux gN/m^2/s -1225 NFIX Symbiotic BNF uptake flux gN/m^2/s -1226 NRETRANS Retranslocated N uptake flux gN/m^2/s -1227 NRETRANS_REG Retranslocated N uptake flux gN/m^2/s -1228 NRETRANS_SEASON Retranslocated N uptake flux gN/m^2/s -1229 NRETRANS_STRESS Retranslocated N uptake flux gN/m^2/s -1230 NUPTAKE Total N uptake of FUN gN/m^2/s -1231 SMINN_TO_PLANT_FUN Total soil N uptake of FUN gN/m^2/s -1232 COST_NFIX Cost of fixation gN/gC -1233 COST_NACTIVE Cost of active uptake gN/gC -1234 COST_NRETRANS Cost of retranslocation gN/gC -1235 NUPTAKE_NPP_FRACTION frac of NPP used in N uptake - -1236 CROPPROD1C 1-yr crop product (grain+biofuel) C gC/m^2 -1237 PROD10C 10-yr wood product C gC/m^2 -1238 PROD100C 100-yr wood product C gC/m^2 -1239 TOT_WOODPRODC total wood product C gC/m^2 -1240 DWT_PROD10C_GAIN landcover change-driven addition to 10-yr wood product pool gC/m^2/s -1241 DWT_PROD100C_GAIN landcover change-driven addition to 100-yr wood product pool gC/m^2/s -1242 DWT_WOODPRODC_GAIN landcover change-driven addition to wood product pools gC/m^2/s -1243 DWT_CROPPROD1C_GAIN landcover change-driven addition to 1-year crop product pool gC/m^2/s -1244 CROPPROD1C_LOSS loss from 1-yr crop product pool gC/m^2/s -1245 PROD10C_LOSS loss from 10-yr wood product pool gC/m^2/s -1246 PROD100C_LOSS loss from 100-yr wood product pool gC/m^2/s -1247 TOT_WOODPRODC_LOSS total loss from wood product pools gC/m^2/s -1248 CROPPROD1N 1-yr crop product (grain+biofuel) N gN/m^2 -1249 PROD10N 10-yr wood product N gN/m^2 -1250 PROD100N 100-yr wood product N gN/m^2 -1251 TOT_WOODPRODN total wood product N gN/m^2 -1252 DWT_PROD10N_GAIN landcover change-driven addition to 10-yr wood product pool gN/m^2/s -1253 DWT_PROD100N_GAIN landcover change-driven addition to 100-yr wood product pool gN/m^2/s -1254 DWT_WOODPRODN_GAIN landcover change-driven addition to wood product pools gN/m^2/s -1255 DWT_CROPPROD1N_GAIN landcover change-driven addition to 1-year crop product pool gN/m^2/s -1256 CROPPROD1N_LOSS loss from 1-yr crop product pool gN/m^2/s -1257 PROD10N_LOSS loss from 10-yr wood product pool gN/m^2/s -1258 PROD100N_LOSS loss from 100-yr wood product pool gN/m^2/s -1259 TOT_WOODPRODN_LOSS total loss from wood product pools gN/m^2/s -1260 FERTNITRO Nitrogen fertilizer for each crop gN/m2/yr -1261 GDDPLANT Accumulated growing degree days past planting date for crop ddays -1262 GDDTSOI Growing degree-days from planting (top two soil layers) ddays -1263 CPHASE crop phenology phase 0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest -1264 LATBASET latitude vary base temperature for gddplant degree C -==== ======================================= ============================================================================================== ================================================================= +==== =================================== ============================================================================================== ================================================================= ======= +CTSM History Fields +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + # Variable Name Long Description Units Active? +==== =================================== ============================================================================================== ================================================================= ======= + 1 LEAFCN Leaf CN ratio used for flexible CN gC/gN T + 2 LEAFCN_STORAGE Storage Leaf CN ratio used for flexible CN gC/gN F + 3 DAYL daylength s F + 4 PREV_DAYL daylength from previous timestep s F + 5 SNO_Z Snow layer thicknesses m F + 6 SNO_Z_ICE Snow layer thicknesses (ice landunits only) m F + 7 ZII convective boundary height m F + 8 SWBGT 2 m Simplified Wetbulb Globe Temp C T + 9 SWBGT_U Urban 2 m Simplified Wetbulb Globe Temp C T + 10 SWBGT_R Rural 2 m Simplified Wetbulb Globe Temp C T + 11 HUMIDEX 2 m Humidex C T + 12 HUMIDEX_U Urban 2 m Humidex C T + 13 HUMIDEX_R Rural 2 m Humidex C T + 14 WBT 2 m Stull Wet Bulb C T + 15 WBT_U Urban 2 m Stull Wet Bulb C T + 16 WBT_R Rural 2 m Stull Wet Bulb C T + 17 HIA 2 m NWS Heat Index C T + 18 HIA_U Urban 2 m NWS Heat Index C T + 19 HIA_R Rural 2 m NWS Heat Index C T + 20 APPAR_TEMP 2 m apparent temperature C T + 21 APPAR_TEMP_U Urban 2 m apparent temperature C T + 22 APPAR_TEMP_R Rural 2 m apparent temperature C T + 23 WBA 2 m Wet Bulb C T + 24 WBA_U Urban 2 m Wet Bulb C T + 25 WBA_R Rural 2 m Wet Bulb C T + 26 TEQ 2 m Equiv Temp K T + 27 TEQ_U Urban 2 m Equiv Temp K T + 28 TEQ_R Rural 2 m Equiv Temp K T + 29 EPT 2 m Equiv Pot Temp K T + 30 EPT_U Urban 2 m Equiv Pot Temp K T + 31 EPT_R Rural 2 m Equiv Pot Temp K T + 32 DISCOI 2 m Discomfort Index C T + 33 DISCOI_U Urban 2 m Discomfort Index C T + 34 DISCOI_R Rural 2 m Discomfort Index C T + 35 THIP 2 m Temp Hum Index Physiology C T + 36 THIP_U Urban 2 m Temp Hum Index Physiology C T + 37 THIP_R Rural 2 m Temp Hum Index Physiology C T + 38 THIC 2 m Temp Hum Index Comfort C T + 39 THIC_U Urban 2 m Temp Hum Index Comfort C T + 40 THIC_R Rural 2 m Temp Hum Index Comfort C T + 41 SWMP65 2 m Swamp Cooler Temp 65% Eff C T + 42 SWMP65_U Urban 2 m Swamp Cooler Temp 65% Eff C T + 43 SWMP65_R Rural 2 m Swamp Cooler Temp 65% Eff C T + 44 SWMP80 2 m Swamp Cooler Temp 80% Eff C T + 45 SWMP80_U Urban 2 m Swamp Cooler Temp 80% Eff C T + 46 SWMP80_R Rural 2 m Swamp Cooler Temp 80% Eff C T + 47 DISCOIS 2 m Stull Discomfort Index C T + 48 DISCOIS_U Urban 2 m Stull Discomfort Index C T + 49 DISCOIS_R Rural 2 m Stull Discomfort Index C T + 50 TBUILD_MAX prescribed maximum interior building temperature K F + 51 WIND atmospheric wind velocity magnitude m/s T + 52 Wind atmospheric wind velocity magnitude m/s F + 53 ZBOT atmospheric reference height m T + 54 ATM_TOPO atmospheric surface height m T + 55 FSDS atmospheric incident solar radiation W/m^2 T + 56 PCO2 atmospheric partial pressure of CO2 Pa T + 57 SWdown atmospheric incident solar radiation W/m^2 F + 58 PCH4 atmospheric partial pressure of CH4 Pa T + 59 Tair_from_atm atmospheric air temperature received from atmosphere (pre-downscaling) K F + 60 TBOT atmospheric air temperature (downscaled to columns in glacier regions) K T + 61 Tair atmospheric air temperature (downscaled to columns in glacier regions) K F + 62 PBOT atmospheric pressure at surface (downscaled to columns in glacier regions) Pa T + 63 PSurf atmospheric pressure at surface (downscaled to columns in glacier regions) Pa F + 64 FLDS atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 T + 65 LWdown atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 F + 66 FLDS_ICE atmospheric longwave radiation (downscaled to columns in glacier regions) (ice landunits only) W/m^2 F + 67 THBOT atmospheric air potential temperature (downscaled to columns in glacier regions) K T + 68 FSI24 indirect radiation (last 24hrs) K F + 69 FSI240 indirect radiation (last 240hrs) K F + 70 FSD24 direct radiation (last 24hrs) K F + 71 FSD240 direct radiation (last 240hrs) K F + 72 PCO2_240 10 day running mean of CO2 pressure Pa F + 73 PO2_240 10 day running mean of O2 pressure Pa F + 74 PBOT_240 10 day running mean of air pressure Pa F + 75 FSH_TO_COUPLER sensible heat sent to coupler (includes corrections for land use change, rain/snow conversion W/m^2 T + 76 FSH_RUNOFF_ICE_TO_LIQ sensible heat flux generated from conversion of ice runoff to liquid W/m^2 T + 77 FCO2 CO2 flux to atmosphere (+ to atm) kgCO2/m2/s F + 78 Z0M_TO_COUPLER roughness length, momentum: gridcell average sent to coupler m F + 79 FCH4 Gridcell surface CH4 flux to atmosphere (+ to atm) kgC/m2/s T + 80 NEM Gridcell net adjustment to net carbon exchange passed to atm. for methane production gC/m2/s T + 81 ICE_MODEL_FRACTION Ice sheet model fractional coverage unitless F + 82 QICE_FORC qice forcing sent to GLC mm/s F + 83 TSRF_FORC surface temperature sent to GLC K F + 84 TOPO_FORC topograephic height sent to GLC m F + 85 TH2OSFC surface water temperature K T + 86 TG_U Urban ground temperature K F + 87 TLAKE lake temperature K T + 88 SNO_T Snow temperatures K F + 89 SNO_T_ICE Snow temperatures (ice landunits only) K F + 90 TSA 2m air temperature K T + 91 TSA_ICE 2m air temperature (ice landunits only) K F + 92 TSA_R Rural 2m air temperature K F + 93 TREFMNAV daily minimum of average 2-m temperature K T + 94 TREFMXAV daily maximum of average 2-m temperature K T + 95 TREFMNAV_R Rural daily minimum of average 2-m temperature K F + 96 TREFMXAV_R Rural daily maximum of average 2-m temperature K F + 97 TSA_U Urban 2m air temperature K F + 98 TREFMNAV_U Urban daily minimum of average 2-m temperature K F + 99 TREFMXAV_U Urban daily maximum of average 2-m temperature K F + 100 TV vegetation temperature K T + 101 TSKIN skin temperature K T + 102 TG ground temperature K T + 103 TG_ICE ground temperature (ice landunits only) K F + 104 TG_R Rural ground temperature K F + 105 TSOI soil temperature (natural vegetated and crop landunits only) K T + 106 TSOI_ICE soil temperature (ice landunits only) K T + 107 TSOI_10CM soil temperature in top 10cm of soil K T + 108 TSL temperature of near-surface soil layer (natural vegetated and crop landunits only) K T + 109 SNOTXMASS snow temperature times layer mass, layer sum; to get mass-weighted temperature, divide by (SNO K kg/m2 T + 110 SNOTXMASS_ICE snow temperature times layer mass, layer sum (ice landunits only); to get mass-weighted temper K kg/m2 F + 111 T10 10-day running mean of 2-m temperature K F + 112 A5TMIN 5-day running mean of min 2-m temperature K F + 113 A10TMIN 10-day running mean of min 2-m temperature K F + 114 TBUILD internal urban building air temperature K T + 115 TROOF_INNER roof inside surface temperature K F + 116 TSUNW_INNER sunwall inside surface temperature K F + 117 TSHDW_INNER shadewall inside surface temperature K F + 118 TFLOOR floor temperature K F + 119 HEAT_CONTENT1 initial gridcell total heat content J/m^2 T + 120 HEAT_CONTENT1_VEG initial gridcell total heat content - natural vegetated and crop landunits only J/m^2 F + 121 HEAT_CONTENT2 post land cover change total heat content J/m^2 F + 122 LIQUID_WATER_TEMP1 initial gridcell weighted average liquid water temperature K F + 123 SNOTTOPL snow temperature (top layer) K F + 124 SNOTTOPL_ICE snow temperature (top layer, ice landunits only) K F + 125 SNOdTdzL top snow layer temperature gradient (land) K/m F + 126 DT_VEG change in t_veg, last iteration K F + 127 EMV vegetation emissivity proportion F + 128 EMG ground emissivity proportion F + 129 BETA coefficient of convective velocity none F + 130 TV24 vegetation temperature (last 24hrs) K F + 131 TV240 vegetation temperature (last 240hrs) K F + 132 GDD0 Growing degree days base 0C from planting ddays F + 133 GDD8 Growing degree days base 8C from planting ddays F + 134 GDD10 Growing degree days base 10C from planting ddays F + 135 GDD020 Twenty year average of growing degree days base 0C from planting ddays F + 136 GDD820 Twenty year average of growing degree days base 8C from planting ddays F + 137 GDD1020 Twenty year average of growing degree days base 10C from planting ddays F + 138 TVEGD10 10 day running mean of patch daytime vegetation temperature Kelvin F + 139 TVEGN10 10 day running mean of patch night-time vegetation temperature Kelvin F + 140 ALT current active layer thickness m T + 141 ALTMAX maximum annual active layer thickness m T + 142 ALTMAX_LASTYEAR maximum prior year active layer thickness m F + 143 ELAI exposed one-sided leaf area index m^2/m^2 T + 144 ESAI exposed one-sided stem area index m^2/m^2 T + 145 TLAI total projected leaf area index m^2/m^2 T + 146 TSAI total projected stem area index m^2/m^2 T + 147 LAISUN sunlit projected leaf area index m^2/m^2 T + 148 LAISHA shaded projected leaf area index m^2/m^2 T + 149 FSUN sunlit fraction of canopy proportion F + 150 HTOP canopy top m T + 151 HBOT canopy bottom m F + 152 DISPLA displacement height m F + 153 Z0M momentum roughness length m F + 154 FSUN24 fraction sunlit (last 24hrs) K F + 155 FSUN240 fraction sunlit (last 240hrs) K F + 156 LAI240 240hr average of leaf area index m^2/m^2 F + 157 VEGWP vegetation water matric potential for sun/sha canopy,xyl,root segments mm T + 158 VEGWPLN vegetation water matric potential for sun/sha canopy,xyl,root at local noon mm T + 159 VEGWPPD predawn vegetation water matric potential for sun/sha canopy,xyl,root mm T + 160 SMP soil matric potential (natural vegetated and crop landunits only) mm T + 161 KROOT root conductance each soil layer 1/s F + 162 KSOIL soil conductance in each soil layer 1/s F + 163 bsw clap and hornberger B unitless F + 164 ROOTR effective fraction of roots in each soil layer (SMS method) proportion F + 165 SOILPSI soil water potential in each soil layer MPa F + 166 SNO_TK Thermal conductivity W/m-K F + 167 SNO_TK_ICE Thermal conductivity (ice landunits only) W/m-K F + 168 HK hydraulic conductivity (natural vegetated and crop landunits only) mm/s F + 169 SoilAlpha factor limiting ground evap unitless F + 170 SoilAlpha_U urban factor limiting ground evap unitless F + 171 watsat water saturated m^3/m^3 F + 172 EFF_POROSITY effective porosity = porosity - vol_ice proportion F + 173 watfc water field capacity m^3/m^3 F + 174 SOILRESIS soil resistance to evaporation s/m T + 175 DSL dry surface layer thickness mm T + 176 SNO_LIQH2O Snow liquid water content kg/m2 F + 177 SNO_ICE Snow ice content kg/m2 F + 178 H2OSOI volumetric soil water (natural vegetated and crop landunits only) mm3/mm3 T + 179 SOILLIQ soil liquid water (natural vegetated and crop landunits only) kg/m2 T + 180 SOILICE soil ice (natural vegetated and crop landunits only) kg/m2 T + 181 SNOCAN intercepted snow mm T + 182 LIQCAN intercepted liquid water mm T + 183 H2OSFC surface water depth mm T + 184 WA water in the unconfined aquifer (natural vegetated and crop landunits only) mm T + 185 INT_SNOW accumulated swe (natural vegetated and crop landunits only) mm F + 186 INT_SNOW_ICE accumulated swe (ice landunits only) mm F + 187 SNOW_PERSISTENCE Length of time of continuous snow cover (nat. veg. landunits only) seconds T + 188 H2OCAN intercepted water mm T + 189 SOILWATER_10CM soil liquid water + ice in top 10cm of soil (veg landunits only) kg/m2 T + 190 TWS total water storage mm T + 191 Q2M 2m specific humidity kg/kg T + 192 SNOWLIQ snow liquid water kg/m2 T + 193 SNOWLIQ_ICE snow liquid water (ice landunits only) kg/m2 F + 194 SNOWICE snow ice kg/m2 T + 195 SNOWICE_ICE snow ice (ice landunits only) kg/m2 F + 196 H2OSNO snow depth (liquid water) mm T + 197 H2OSNO_ICE snow depth (liquid water, ice landunits only) mm F + 198 TOTSOILLIQ vertically summed soil liquid water (veg landunits only) kg/m2 T + 199 TOTSOILICE vertically summed soil cie (veg landunits only) kg/m2 T + 200 RH2M 2m relative humidity % T + 201 RH2M_R Rural 2m specific humidity % F + 202 RH2M_U Urban 2m relative humidity % F + 203 RHAF fractional humidity of canopy air fraction F + 204 RHAF10 10 day running mean of fractional humidity of canopy air fraction F + 205 FH2OSFC fraction of ground covered by surface water unitless T + 206 FH2OSFC_NOSNOW fraction of ground covered by surface water (if no snow present) unitless F + 207 FSNO fraction of ground covered by snow unitless T + 208 FSNO_ICE fraction of ground covered by snow (ice landunits only) unitless F + 209 FSNO_EFF effective fraction of ground covered by snow unitless T + 210 FWET fraction of canopy that is wet proportion F + 211 FCANSNO fraction of canopy that is wet proportion F + 212 FDRY fraction of foliage that is green and dry proportion F + 213 FRAC_ICEOLD fraction of ice relative to the tot water proportion F + 214 SNOW_DEPTH snow height of snow covered area m T + 215 SNOW_DEPTH_ICE snow height of snow covered area (ice landunits only) m F + 216 SNOWDP gridcell mean snow height m T + 217 WF soil water as frac. of whc for top 0.05 m proportion F + 218 H2OSNO_TOP mass of snow in top snow layer kg/m2 T + 219 SNORDSL top snow layer effective grain radius m^-6 F + 220 SNOLIQFL top snow layer liquid water fraction (land) fraction F + 221 SNO_EXISTENCE Fraction of averaging period for which each snow layer existed unitless F + 222 SNO_BW Partial density of water in the snow pack (ice + liquid) kg/m3 F + 223 SNO_BW_ICE Partial density of water in the snow pack (ice + liquid, ice landunits only) kg/m3 F + 224 SNO_GS Mean snow grain size Microns F + 225 SNO_GS_ICE Mean snow grain size (ice landunits only) Microns F + 226 QINTR interception mm/s T + 227 SNOW_SOURCES snow sources (liquid water) mm/s T + 228 SNOW_SINKS snow sinks (liquid water) mm/s T + 229 LIQUID_CONTENT1 initial gridcell total liq content mm T + 230 LIQUID_CONTENT2 post landuse change gridcell total liq content mm F + 231 ICE_CONTENT1 initial gridcell total ice content mm T + 232 ICE_CONTENT2 post land cover change total ice content mm F + 233 ERRH2O total water conservation error mm T + 234 ERRH2OSNO imbalance in snow depth (liquid water) mm T + 235 QDIRECT_THROUGHFALL direct throughfall of liquid (rain + above-canopy irrigation) mm/s F + 236 QDIRECT_THROUGHFALL_SNOW direct throughfall of snow mm/s F + 237 QDRIP rate of excess canopy liquid falling off canopy mm/s F + 238 QDRIP_SNOW rate of excess canopy snow falling off canopy mm/s F + 239 QSNOUNLOAD canopy snow unloading mm/s T + 240 QTOPSOIL water input to surface mm/s F + 241 QINFL infiltration mm/s T + 242 QOVER total surface runoff (includes QH2OSFC) mm/s T + 243 QRGWL surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff fro mm/s T + 244 QDRAI sub-surface drainage mm/s T + 245 QDRAI_PERCH perched wt drainage mm/s T + 246 QFLX_LIQ_DYNBAL liq dynamic land cover change conversion runoff flux mm/s T + 247 QFLX_ICE_DYNBAL ice dynamic land cover change conversion runoff flux mm/s T + 248 QRUNOFF total liquid runoff not including correction for land use change mm/s T + 249 QRUNOFF_ICE total liquid runoff not incl corret for LULCC (ice landunits only) mm/s T + 250 QRUNOFF_U Urban total runoff mm/s F + 251 QRUNOFF_R Rural total runoff mm/s F + 252 QSNOMELT snow melt rate mm/s T + 253 QSNOMELT_ICE snow melt (ice landunits only) mm/s T + 254 QSNOFRZ column-integrated snow freezing rate kg/m2/s T + 255 QSNOFRZ_ICE column-integrated snow freezing rate (ice landunits only) mm/s T + 256 SNO_FRZ snow freezing rate in each snow layer kg/m2/s F + 257 SNO_FRZ_ICE snow freezing rate in each snow layer (ice landunits only) mm/s F + 258 QFLX_SNOW_DRAIN drainage from snow pack mm/s T + 259 QFLX_SNOW_DRAIN_ICE drainage from snow pack melt (ice landunits only) mm/s T + 260 QSOIL Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew) mm/s T + 261 QSOIL_ICE Ground evaporation (ice landunits only) mm/s T + 262 QVEGE canopy evaporation mm/s T + 263 QVEGT canopy transpiration mm/s T + 264 QSNOCPLIQ excess liquid h2o due to snow capping not including correction for land use change mm H2O/s T + 265 QSNWCPICE excess solid h2o due to snow capping not including correction for land use change mm H2O/s T + 266 QICE ice growth/melt mm/s T + 267 QICE_FRZ ice growth mm/s T + 268 QICE_MELT ice melt mm/s T + 269 QFLX_LIQ_GRND liquid (rain+irrigation) on ground after interception mm H2O/s F + 270 QFLX_SNOW_GRND snow on ground after interception mm H2O/s F + 271 QFLX_LIQEVAP_FROM_TOP_LAYER rate of liquid water evaporated from top soil or snow layer mm H2O/s T + 272 QFLX_EVAP_VEG vegetation evaporation mm H2O/s F + 273 QFLX_EVAP_TOT qflx_evap_soi + qflx_evap_can + qflx_tran_veg kg m-2 s-1 T + 274 QFLX_LIQDEW_TO_TOP_LAYER rate of liquid water deposited on top soil or snow layer (dew) mm H2O/s T + 275 QFLX_SOLIDEVAP_FROM_TOP_LAYER rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s T + 276 QFLX_SOLIDEVAP_FROM_TOP_LAYER_ICE rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s F + 277 QFLX_SOLIDDEW_TO_TOP_LAYER rate of solid water deposited on top soil or snow layer (frost) mm H2O/s T + 278 QDRAI_XS saturation excess drainage mm/s T + 279 QH2OSFC_TO_ICE surface water converted to ice mm/s F + 280 QIRRIG_FROM_SURFACE water added through surface water irrigation mm/s T + 281 QIRRIG_FROM_GW_UNCONFINED water added through unconfined groundwater irrigation mm/s T + 282 QIRRIG_FROM_GW_CONFINED water added through confined groundwater irrigation mm/s T + 283 QIRRIG_DRIP water added via drip irrigation mm/s F + 284 QIRRIG_SPRINKLER water added via sprinkler irrigation mm/s F + 285 SNO_MELT snow melt rate in each snow layer mm/s F + 286 SNO_MELT_ICE snow melt rate in each snow layer (ice landunits only) mm/s F + 287 QROOTSINK water flux from soil to root in each soil-layer mm/s F + 288 QHR hydraulic redistribution mm/s T + 289 QSNO_WINDUNLOAD canopy snow wind unloading mm/s T + 290 QSNO_TEMPUNLOAD canopy snow temp unloading mm/s T + 291 QSNOEVAP evaporation from snow (only when snl<0, otherwise it is equal to qflx_ev_soil) mm/s T + 292 QH2OSFC surface water runoff mm/s T + 293 QPHSNEG net negative hydraulic redistribution flux mm/s F + 294 AnnET Annual ET mm/s F + 295 QRUNOFF_TO_COUPLER total liquid runoff sent to coupler (includes corrections for land use change) mm/s T + 296 QRUNOFF_ICE_TO_COUPLER total ice runoff sent to coupler (includes corrections for land use change) mm/s T + 297 QRUNOFF_ICE_TO_LIQ liquid runoff from converted ice runoff mm/s F + 298 RAIN_FROM_ATM atmospheric rain received from atmosphere (pre-repartitioning) mm/s T + 299 SNOW_FROM_ATM atmospheric snow received from atmosphere (pre-repartitioning) mm/s T + 300 QBOT atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg T + 301 Qair atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg F + 302 QFLOOD runoff from river flooding mm/s T + 303 RAIN atmospheric rain, after rain/snow repartitioning based on temperature mm/s T + 304 Rainf atmospheric rain, after rain/snow repartitioning based on temperature mm/s F + 305 RAIN_ICE atmospheric rain, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F + 306 SNOW atmospheric snow, after rain/snow repartitioning based on temperature mm/s T + 307 SNOW_ICE atmospheric snow, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F + 308 VOLR river channel total water storage m3 T + 309 VOLRMCH river channel main channel water storage m3 T + 310 RH atmospheric relative humidity % F + 311 RH30 30-day running mean of relative humidity % F + 312 PREC10 10-day running mean of PREC MM H2O/S F + 313 PREC60 60-day running mean of PREC MM H2O/S F + 314 EFLX_DYNBAL dynamic land cover change conversion energy flux W/m^2 T + 315 FSM snow melt heat flux W/m^2 T + 316 FSM_ICE snow melt heat flux (ice landunits only) W/m^2 F + 317 FSM_R Rural snow melt heat flux W/m^2 F + 318 FSM_U Urban snow melt heat flux W/m^2 F + 319 FIRA net infrared (longwave) radiation W/m^2 T + 320 FIRA_ICE net infrared (longwave) radiation (ice landunits only) W/m^2 F + 321 FIRA_R Rural net infrared (longwave) radiation W/m^2 T + 322 FIRE emitted infrared (longwave) radiation W/m^2 T + 323 LWup upwelling longwave radiation W/m^2 F + 324 FIRE_ICE emitted infrared (longwave) radiation (ice landunits only) W/m^2 F + 325 FIRE_R Rural emitted infrared (longwave) radiation W/m^2 T + 326 FCTR canopy transpiration W/m^2 T + 327 FCEV canopy evaporation W/m^2 T + 328 FGEV ground evaporation W/m^2 T + 329 FSH sensible heat not including correction for land use change and rain/snow conversion W/m^2 T + 330 FSH_ICE sensible heat not including correction for land use change and rain/snow conversion (ice landu W/m^2 F + 331 FSH_R Rural sensible heat W/m^2 T + 332 Qh sensible heat W/m^2 F + 333 Qle total evaporation W/m^2 F + 334 EFLX_LH_TOT total latent heat flux [+ to atm] W/m^2 T + 335 EFLX_LH_TOT_ICE total latent heat flux [+ to atm] (ice landunits only) W/m^2 F + 336 EFLX_LH_TOT_R Rural total evaporation W/m^2 T + 337 Qstor storage heat flux (includes snowmelt) W/m^2 F + 338 FSH_V sensible heat from veg W/m^2 T + 339 FSH_G sensible heat from ground W/m^2 T + 340 FGR heat flux into soil/snow including snow melt and lake / snow light transmission W/m^2 T + 341 FGR_ICE heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits W/m^2 F + 342 FGR_R Rural heat flux into soil/snow including snow melt and snow light transmission W/m^2 F + 343 FIRA_U Urban net infrared (longwave) radiation W/m^2 F + 344 EFLX_SOIL_GRND soil heat flux [+ into soil] W/m^2 F + 345 FIRE_U Urban emitted infrared (longwave) radiation W/m^2 F + 346 FSH_U Urban sensible heat W/m^2 F + 347 FSH_PRECIP_CONVERSION Sensible heat flux from conversion of rain/snow atm forcing W/m^2 T + 348 EFLX_LH_TOT_U Urban total evaporation W/m^2 F + 349 FGR_U Urban heat flux into soil/snow including snow melt W/m^2 F + 350 Rnet net radiation W/m^2 F + 351 DLRAD downward longwave radiation below the canopy W/m^2 F + 352 ULRAD upward longwave radiation above the canopy W/m^2 F + 353 CGRND deriv. of soil energy flux wrt to soil temp W/m^2/K F + 354 CGRNDL deriv. of soil latent heat flux wrt soil temp W/m^2/K F + 355 CGRNDS deriv. of soil sensible heat flux wrt soil temp W/m^2/K F + 356 EFLX_GNET net heat flux into ground W/m^2 F + 357 EFLX_GRND_LAKE net heat flux into lake/snow surface, excluding light transmission W/m^2 T + 358 EFLXBUILD building heat flux from change in interior building air temperature W/m^2 T + 359 URBAN_AC urban air conditioning flux W/m^2 T + 360 URBAN_HEAT urban heating flux W/m^2 T + 361 DGNETDT derivative of net ground heat flux wrt soil temp W/m^2/K F + 362 FGR12 heat flux between soil layers 1 and 2 W/m^2 T + 363 FGR_SOIL_R Rural downward heat flux at interface below each soil layer watt/m^2 F + 364 TRAFFICFLUX sensible heat flux from urban traffic W/m^2 F + 365 WASTEHEAT sensible heat flux from heating/cooling sources of urban waste heat W/m^2 T + 366 HEAT_FROM_AC sensible heat flux put into canyon due to heat removed from air conditioning W/m^2 T + 367 TAUX zonal surface stress kg/m/s^2 T + 368 Qtau momentum flux kg/m/s^2 F + 369 TAUY meridional surface stress kg/m/s^2 T + 370 BTRANMN daily minimum of transpiration beta factor unitless T + 371 RRESIS root resistance in each soil layer proportion F + 372 ERRSOI soil/lake energy conservation error W/m^2 T + 373 ERRSEB surface energy conservation error W/m^2 T + 374 ERRSOL solar radiation conservation error W/m^2 T + 375 DSTDEP total dust deposition (dry+wet) from atmosphere kg/m^2/s T + 376 BCDEP total BC deposition (dry+wet) from atmosphere kg/m^2/s T + 377 OCDEP total OC deposition (dry+wet) from atmosphere kg/m^2/s T + 378 SNOBCMCL mass of BC in snow column kg/m2 T + 379 SNOBCMSL mass of BC in top snow layer kg/m2 T + 380 SNOOCMCL mass of OC in snow column kg/m2 T + 381 SNOOCMSL mass of OC in top snow layer kg/m2 T + 382 SNODSTMCL mass of dust in snow column kg/m2 T + 383 SNODSTMSL mass of dust in top snow layer kg/m2 T + 384 Z0MG roughness length over ground, momentum m F + 385 Z0HG roughness length over ground, sensible heat m F + 386 Z0QG roughness length over ground, latent heat m F + 387 VA atmospheric wind speed plus convective velocity m/s F + 388 U10 10-m wind m/s T + 389 U10_ICE 10-m wind (ice landunits only) m/s F + 390 U10_DUST 10-m wind for dust model m/s T + 391 RAM1 aerodynamical resistance s/m F + 392 FV friction velocity for dust model m/s F + 393 Z0HV roughness length over vegetation, sensible heat m F + 394 Z0MV roughness length over vegetation, momentum m F + 395 Z0QV roughness length over vegetation, latent heat m F + 396 RB10 10 day running mean boundary layer resistance s/m F + 397 LAKEICEFRAC lake layer ice mass fraction unitless F + 398 LAKEICEFRAC_SURF surface lake layer ice mass fraction unitless T + 399 LAKEICETHICK thickness of lake ice (including physical expansion on freezing) m T + 400 TKE1 top lake level eddy thermal conductivity W/(mK) T + 401 RAM_LAKE aerodynamic resistance for momentum (lakes only) s/m F + 402 UST_LAKE friction velocity (lakes only) m/s F + 403 RH_LEAF fractional humidity at leaf surface fraction F + 404 VPD_CAN canopy vapor pressure deficit kPa T + 405 LNC leaf N concentration gN leaf/m^2 T + 406 FPSN photosynthesis umol m-2 s-1 T + 407 FPSN_WC Rubisco-limited photosynthesis umol m-2 s-1 F + 408 FPSN_WJ RuBP-limited photosynthesis umol m-2 s-1 F + 409 FPSN_WP Product-limited photosynthesis umol m-2 s-1 F + 410 PSNSUN sunlit leaf photosynthesis umolCO2/m^2/s T + 411 PSNSHA shaded leaf photosynthesis umolCO2/m^2/s T + 412 RSSUN sunlit leaf stomatal resistance s/m T + 413 RSSHA shaded leaf stomatal resistance s/m T + 414 GSSUN sunlit leaf stomatal conductance umol H20/m2/s T + 415 GSSHA shaded leaf stomatal conductance umol H20/m2/s T + 416 GSSUNLN sunlit leaf stomatal conductance at local noon umol H20/m2/s T + 417 GSSHALN shaded leaf stomatal conductance at local noon umol H20/m2/s T + 418 Vcmx25Z canopy profile of vcmax25 predicted by LUNA model umol/m2/s T + 419 Jmx25Z maximum rate of electron transport at 25 Celcius for canopy layers umol electrons/m2/s T + 420 PNLCZ Proportion of nitrogen allocated for light capture unitless F + 421 VCMX25T canopy profile of vcmax25 umol/m2/s T + 422 JMX25T canopy profile of jmax umol/m2/s T + 423 TPU25T canopy profile of tpu umol/m2/s T + 424 FPSN24 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m^2 ground/day F + 425 QCHARGE aquifer recharge rate (natural vegetated and crop landunits only) mm/s T + 426 NSUBSTEPS number of adaptive timesteps in CLM timestep unitless F + 427 FROST_TABLE frost table depth (natural vegetated and crop landunits only) m F + 428 ZWT water table depth (natural vegetated and crop landunits only) m T + 429 ZWT_PERCH perched water table depth (natural vegetated and crop landunits only) m T + 430 FCOV fractional impermeable area unitless T + 431 FSAT fractional area with water table at surface unitless T + 432 FSA absorbed solar radiation W/m^2 T + 433 FSA_ICE absorbed solar radiation (ice landunits only) W/m^2 F + 434 FSA_R Rural absorbed solar radiation W/m^2 F + 435 FSA_U Urban absorbed solar radiation W/m^2 F + 436 FSR reflected solar radiation W/m^2 T + 437 SWup upwelling shortwave radiation W/m^2 F + 438 FSR_ICE reflected solar radiation (ice landunits only) W/m^2 F + 439 SNO_ABS Absorbed solar radiation in each snow layer W/m^2 F + 440 SNO_ABS_ICE Absorbed solar radiation in each snow layer (ice landunits only) W/m^2 F + 441 SABV solar rad absorbed by veg W/m^2 T + 442 SABG solar rad absorbed by ground W/m^2 T + 443 SABG_PEN Rural solar rad penetrating top soil or snow layer watt/m^2 T + 444 FSDSND direct nir incident solar radiation W/m^2 T + 445 FSDSNI diffuse nir incident solar radiation W/m^2 T + 446 FSDSNDLN direct nir incident solar radiation at local noon W/m^2 T + 447 FSRND direct nir reflected solar radiation W/m^2 T + 448 FSRNI diffuse nir reflected solar radiation W/m^2 T + 449 FSRNDLN direct nir reflected solar radiation at local noon W/m^2 T + 450 FSRSF reflected solar radiation W/m^2 T + 451 SSRE_FSR surface snow effect on reflected solar radiation W/m^2 T + 452 FSRSFND direct nir reflected solar radiation W/m^2 T + 453 FSRSFNI diffuse nir reflected solar radiation W/m^2 T + 454 FSRSFNDLN direct nir reflected solar radiation at local noon W/m^2 T + 455 SSRE_FSRND surface snow effect on direct nir reflected solar radiation W/m^2 T + 456 SSRE_FSRNI surface snow effect on diffuse nir reflected solar radiation W/m^2 T + 457 SSRE_FSRNDLN surface snow effect on direct nir reflected solar radiation at local noon W/m^2 T + 458 SNOINTABS Fraction of incoming solar absorbed by lower snow layers - T + 459 PAR240DZ 10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer W/m^2 F + 460 PAR240XZ 10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer W/m^2 F + 461 COSZEN cosine of solar zenith angle none F + 462 ALBGRD ground albedo (direct) proportion F + 463 ALBGRI ground albedo (indirect) proportion F + 464 ALBDSF diagnostic snow-free surface albedo (direct) proportion T + 465 ALBISF diagnostic snow-free surface albedo (indirect) proportion T + 466 ALBD surface albedo (direct) proportion T + 467 ALBI surface albedo (indirect) proportion T + 468 FSDSVD direct vis incident solar radiation W/m^2 T + 469 FSDSVI diffuse vis incident solar radiation W/m^2 T + 470 FSRVD direct vis reflected solar radiation W/m^2 T + 471 FSRVI diffuse vis reflected solar radiation W/m^2 T + 472 FSRSFVD direct vis reflected solar radiation W/m^2 T + 473 FSRSFVI diffuse vis reflected solar radiation W/m^2 T + 474 SSRE_FSRVD surface snow radiatve effect on direct vis reflected solar radiation W/m^2 T + 475 SSRE_FSRVI surface snow radiatve effect on diffuse vis reflected solar radiation W/m^2 T + 476 FSDSVDLN direct vis incident solar radiation at local noon W/m^2 T + 477 FSDSVILN diffuse vis incident solar radiation at local noon W/m^2 T + 478 PARVEGLN absorbed par by vegetation at local noon W/m^2 T + 479 FSRVDLN direct vis reflected solar radiation at local noon W/m^2 T + 480 FSRSFVDLN direct vis reflected solar radiation at local noon W/m^2 T + 481 SSRE_FSRVDLN surface snow radiatve effect on direct vis reflected solar radiation at local noon W/m^2 T + 482 SNOFSDSVD direct vis incident solar radiation on snow W/m^2 F + 483 SNOFSDSND direct nir incident solar radiation on snow W/m^2 F + 484 SNOFSDSVI diffuse vis incident solar radiation on snow W/m^2 F + 485 SNOFSDSNI diffuse nir incident solar radiation on snow W/m^2 F + 486 SNOFSRVD direct vis reflected solar radiation from snow W/m^2 T + 487 SNOFSRND direct nir reflected solar radiation from snow W/m^2 T + 488 SNOFSRVI diffuse vis reflected solar radiation from snow W/m^2 T + 489 SNOFSRNI diffuse nir reflected solar radiation from snow W/m^2 T + 490 DSTFLXT total surface dust emission kg/m2/s T + 491 DPVLTRB1 turbulent deposition velocity 1 m/s F + 492 DPVLTRB2 turbulent deposition velocity 2 m/s F + 493 DPVLTRB3 turbulent deposition velocity 3 m/s F + 494 DPVLTRB4 turbulent deposition velocity 4 m/s F + 495 QIRRIG_DEMAND irrigation demand mm/s F + 496 TOPO_COL column-level topographic height m F + 497 TOPO_COL_ICE column-level topographic height (ice landunits only) m F + 498 FINUNDATED fractional inundated area of vegetated columns unitless T + 499 FINUNDATED_LAG time-lagged inundated fraction of vegetated columns unitless F + 500 CH4_SURF_DIFF_SAT diffusive surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T + 501 CH4_SURF_DIFF_UNSAT diffusive surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T + 502 CH4_EBUL_TOTAL_SAT ebullition surface CH4 flux; (+ to atm) mol/m2/s F + 503 CH4_EBUL_TOTAL_UNSAT ebullition surface CH4 flux; (+ to atm) mol/m2/s F + 504 CH4_SURF_EBUL_SAT ebullition surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T + 505 CH4_SURF_EBUL_UNSAT ebullition surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T + 506 CH4_SURF_AERE_SAT aerenchyma surface CH4 flux for inundated area; (+ to atm) mol/m2/s T + 507 CH4_SURF_AERE_UNSAT aerenchyma surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T + 508 TOTCOLCH4 total belowground CH4 (0 for non-lake special landunits in the absence of dynamic landunits) gC/m2 T + 509 CONC_CH4_SAT CH4 soil Concentration for inundated / lake area mol/m3 F + 510 CONC_CH4_UNSAT CH4 soil Concentration for non-inundated area mol/m3 F + 511 O2_DECOMP_DEPTH_UNSAT O2 consumption from HR and AR for non-inundated area mol/m3/s F + 512 CONC_O2_SAT O2 soil Concentration for inundated / lake area mol/m3 T + 513 CONC_O2_UNSAT O2 soil Concentration for non-inundated area mol/m3 T + 514 FCH4TOCO2 Gridcell oxidation of CH4 to CO2 gC/m2/s T + 515 CH4PROD Gridcell total production of CH4 gC/m2/s T + 516 FCH4_DFSAT CH4 additional flux due to changing fsat, natural vegetated and crop landunits only kgC/m2/s T + 517 ZWT_CH4_UNSAT depth of water table for methane production used in non-inundated area m T + 518 QOVER_LAG time-lagged surface runoff for soil columns mm/s F + 519 WTGQ surface tracer conductance m/s T + 520 DYN_COL_ADJUSTMENTS_CH4 Adjustments in ch4 due to dynamic column areas; only makes sense at the column level: should n gC/m^2 F + 521 MEG_isoprene MEGAN flux kg/m2/sec T + 522 MEG_pinene_a MEGAN flux kg/m2/sec T + 523 MEG_carene_3 MEGAN flux kg/m2/sec T + 524 MEG_thujene_a MEGAN flux kg/m2/sec T + 525 MEG_methanol MEGAN flux kg/m2/sec T + 526 MEG_ethanol MEGAN flux kg/m2/sec T + 527 MEG_formaldehyde MEGAN flux kg/m2/sec T + 528 MEG_acetaldehyde MEGAN flux kg/m2/sec T + 529 MEG_acetic_acid MEGAN flux kg/m2/sec T + 530 MEG_acetone MEGAN flux kg/m2/sec T + 531 VOCFLXT total VOC flux into atmosphere moles/m2/sec F + 532 GAMMA total gamma for VOC calc non F + 533 GAMMAL gamma L for VOC calc non F + 534 GAMMAT gamma T for VOC calc non F + 535 GAMMAP gamma P for VOC calc non F + 536 GAMMAA gamma A for VOC calc non F + 537 GAMMAS gamma S for VOC calc non F + 538 GAMMAC gamma C for VOC calc non F + 539 EOPT Eopt coefficient for VOC calc non F + 540 TOPT topt coefficient for VOC calc non F + 541 ALPHA alpha coefficient for VOC calc non F + 542 currentPatch currentPatch coefficient for VOC calc non F + 543 PAR_sun sunlit PAR umol/m2/s F + 544 PAR24_sun sunlit PAR (24 hrs) umol/m2/s F + 545 PAR240_sun sunlit PAR (240 hrs) umol/m2/s F + 546 PAR_shade shade PAR umol/m2/s F + 547 PAR24_shade shade PAR (24 hrs) umol/m2/s F + 548 PAR240_shade shade PAR (240 hrs) umol/m2/s F + 549 FireComp_BC fire emissions flux of BC kg/m2/sec F + 550 FireComp_OC fire emissions flux of OC kg/m2/sec F + 551 FireComp_SO2 fire emissions flux of SO2 kg/m2/sec F + 552 FireMech_bc_a1 fire emissions flux of bc_a1 kg/m2/sec F + 553 FireMech_pom_a1 fire emissions flux of pom_a1 kg/m2/sec F + 554 FireMech_SO2 fire emissions flux of SO2 kg/m2/sec F + 555 FireEmis_TOT Total fire emissions flux gC/m2/sec F + 556 FireEmis_ZTOP Top of vertical fire emissions distribution m F + 557 CROOT_PROF profile for litter C and N inputs from coarse roots 1/m F + 558 FROOT_PROF profile for litter C and N inputs from fine roots 1/m F + 559 LEAF_PROF profile for litter C and N inputs from leaves 1/m F + 560 STEM_PROF profile for litter C and N inputs from stems 1/m F + 561 NFIXATION_PROF profile for biological N fixation 1/m F + 562 NDEP_PROF profile for atmospheric N deposition 1/m F + 563 SOM_ADV_COEF advection term for vertical SOM translocation m/s F + 564 SOM_DIFFUS_COEF diffusion coefficient for vertical SOM translocation m^2/s F + 565 FPI fraction of potential immobilization proportion T + 566 FPI_vr fraction of potential immobilization proportion F + 567 SOILC_vr SOIL C (vertically resolved) gC/m^3 T + 568 LITR1C_vr LITR1 C (vertically resolved) gC/m^3 T + 569 LITR1C LITR1 C gC/m^2 T + 570 LITR1C_1m LITR1 C to 1 meter gC/m^2 F + 571 LITR2C_vr LITR2 C (vertically resolved) gC/m^3 T + 572 LITR2C LITR2 C gC/m^2 T + 573 LITR2C_1m LITR2 C to 1 meter gC/m^2 F + 574 LITR3C_vr LITR3 C (vertically resolved) gC/m^3 T + 575 LITR3C LITR3 C gC/m^2 T + 576 LITR3C_1m LITR3 C to 1 meter gC/m^2 F + 577 CWDC_vr CWD C (vertically resolved) gC/m^3 T + 578 CWDC CWD C gC/m^2 T + 579 CWDC_1m CWD C to 1 meter gC/m^2 F + 580 SOIL1C_vr SOIL1 C (vertically resolved) gC/m^3 T + 581 SOIL1C SOIL1 C gC/m^2 T + 582 SOIL1C_1m SOIL1 C to 1 meter gC/m^2 F + 583 SOIL2C_vr SOIL2 C (vertically resolved) gC/m^3 T + 584 SOIL2C SOIL2 C gC/m^2 T + 585 SOIL2C_1m SOIL2 C to 1 meter gC/m^2 F + 586 SOIL3C_vr SOIL3 C (vertically resolved) gC/m^3 T + 587 SOIL3C SOIL3 C gC/m^2 T + 588 SOIL3C_1m SOIL3 C to 1 meter gC/m^2 F + 589 TOTLITC total litter carbon gC/m^2 T + 590 TOTSOMC total soil organic matter carbon gC/m^2 T + 591 TOTLITC_1m total litter carbon to 1 meter depth gC/m^2 T + 592 TOTSOMC_1m total soil organic matter carbon to 1 meter depth gC/m^2 T + 593 COL_CTRUNC column-level sink for C truncation gC/m^2 F + 594 DYN_COL_SOIL_ADJUSTMENTS_C Adjustments in soil carbon due to dynamic column areas; only makes sense at the column level: gC/m^2 F + 595 HR total heterotrophic respiration gC/m^2/s T + 596 LITTERC_HR litter C heterotrophic respiration gC/m^2/s T + 597 SOILC_HR soil C heterotrophic respiration gC/m^2/s T + 598 SOMC_FIRE C loss due to peat burning gC/m^2/s T + 599 K_LITR1 litter 1 potential loss coefficient 1/s F + 600 K_LITR2 litter 2 potential loss coefficient 1/s F + 601 K_LITR3 litter 3 potential loss coefficient 1/s F + 602 K_CWD coarse woody debris potential loss coefficient 1/s F + 603 K_SOIL1 soil 1 potential loss coefficient 1/s F + 604 K_SOIL2 soil 2 potential loss coefficient 1/s F + 605 K_SOIL3 soil 3 potential loss coefficient 1/s F + 606 LITR1_HR Het. Resp. from litter 1 gC/m^2/s F + 607 LITR1C_TO_SOIL1C decomp. of litter 1 C to soil 1 C gC/m^2/s F + 608 LITR1_HR_vr Het. Resp. from litter 1 gC/m^3/s F + 609 LITR1C_TO_SOIL1C_vr decomp. of litter 1 C to soil 1 C gC/m^3/s F + 610 LITR2_HR Het. Resp. from litter 2 gC/m^2/s F + 611 LITR2C_TO_SOIL1C decomp. of litter 2 C to soil 1 C gC/m^2/s F + 612 LITR2_HR_vr Het. Resp. from litter 2 gC/m^3/s F + 613 LITR2C_TO_SOIL1C_vr decomp. of litter 2 C to soil 1 C gC/m^3/s F + 614 LITR3_HR Het. Resp. from litter 3 gC/m^2/s F + 615 LITR3C_TO_SOIL2C decomp. of litter 3 C to soil 2 C gC/m^2/s F + 616 LITR3_HR_vr Het. Resp. from litter 3 gC/m^3/s F + 617 LITR3C_TO_SOIL2C_vr decomp. of litter 3 C to soil 2 C gC/m^3/s F + 618 SOIL1_HR_S2 Het. Resp. from soil 1 gC/m^2/s F + 619 SOIL1C_TO_SOIL2C decomp. of soil 1 C to soil 2 C gC/m^2/s F + 620 SOIL1_HR_S2_vr Het. Resp. from soil 1 gC/m^3/s F + 621 SOIL1C_TO_SOIL2C_vr decomp. of soil 1 C to soil 2 C gC/m^3/s F + 622 SOIL1_HR_S3 Het. Resp. from soil 1 gC/m^2/s F + 623 SOIL1C_TO_SOIL3C decomp. of soil 1 C to soil 3 C gC/m^2/s F + 624 SOIL1_HR_S3_vr Het. Resp. from soil 1 gC/m^3/s F + 625 SOIL1C_TO_SOIL3C_vr decomp. of soil 1 C to soil 3 C gC/m^3/s F + 626 SOIL2_HR_S1 Het. Resp. from soil 2 gC/m^2/s F + 627 SOIL2C_TO_SOIL1C decomp. of soil 2 C to soil 1 C gC/m^2/s F + 628 SOIL2_HR_S1_vr Het. Resp. from soil 2 gC/m^3/s F + 629 SOIL2C_TO_SOIL1C_vr decomp. of soil 2 C to soil 1 C gC/m^3/s F + 630 SOIL2_HR_S3 Het. Resp. from soil 2 gC/m^2/s F + 631 SOIL2C_TO_SOIL3C decomp. of soil 2 C to soil 3 C gC/m^2/s F + 632 SOIL2_HR_S3_vr Het. Resp. from soil 2 gC/m^3/s F + 633 SOIL2C_TO_SOIL3C_vr decomp. of soil 2 C to soil 3 C gC/m^3/s F + 634 SOIL3_HR Het. Resp. from soil 3 gC/m^2/s F + 635 SOIL3C_TO_SOIL1C decomp. of soil 3 C to soil 1 C gC/m^2/s F + 636 SOIL3_HR_vr Het. Resp. from soil 3 gC/m^3/s F + 637 SOIL3C_TO_SOIL1C_vr decomp. of soil 3 C to soil 1 C gC/m^3/s F + 638 CWDC_TO_LITR2C decomp. of coarse woody debris C to litter 2 C gC/m^2/s F + 639 CWDC_TO_LITR2C_vr decomp. of coarse woody debris C to litter 2 C gC/m^3/s F + 640 CWDC_TO_LITR3C decomp. of coarse woody debris C to litter 3 C gC/m^2/s F + 641 CWDC_TO_LITR3C_vr decomp. of coarse woody debris C to litter 3 C gC/m^3/s F + 642 T_SCALAR temperature inhibition of decomposition unitless T + 643 W_SCALAR Moisture (dryness) inhibition of decomposition unitless T + 644 O_SCALAR fraction by which decomposition is reduced due to anoxia unitless T + 645 SOM_C_LEACHED total flux of C from SOM pools due to leaching gC/m^2/s T + 646 M_LITR1C_TO_LEACHING litter 1 C leaching loss gC/m^2/s F + 647 LITR1C_TNDNCY_VERT_TRANS litter 1 C tendency due to vertical transport gC/m^3/s F + 648 M_LITR2C_TO_LEACHING litter 2 C leaching loss gC/m^2/s F + 649 LITR2C_TNDNCY_VERT_TRANS litter 2 C tendency due to vertical transport gC/m^3/s F + 650 M_LITR3C_TO_LEACHING litter 3 C leaching loss gC/m^2/s F + 651 LITR3C_TNDNCY_VERT_TRANS litter 3 C tendency due to vertical transport gC/m^3/s F + 652 M_SOIL1C_TO_LEACHING soil 1 C leaching loss gC/m^2/s F + 653 SOIL1C_TNDNCY_VERT_TRANS soil 1 C tendency due to vertical transport gC/m^3/s F + 654 M_SOIL2C_TO_LEACHING soil 2 C leaching loss gC/m^2/s F + 655 SOIL2C_TNDNCY_VERT_TRANS soil 2 C tendency due to vertical transport gC/m^3/s F + 656 M_SOIL3C_TO_LEACHING soil 3 C leaching loss gC/m^2/s F + 657 SOIL3C_TNDNCY_VERT_TRANS soil 3 C tendency due to vertical transport gC/m^3/s F + 658 HR_vr total vertically resolved heterotrophic respiration gC/m^3/s T + 659 SOILN_vr SOIL N (vertically resolved) gN/m^3 T + 660 LITR1N_vr LITR1 N (vertically resolved) gN/m^3 T + 661 LITR1N LITR1 N gN/m^2 T + 662 LITR1N_1m LITR1 N to 1 meter gN/m^2 F + 663 LITR2N_vr LITR2 N (vertically resolved) gN/m^3 T + 664 LITR2N LITR2 N gN/m^2 T + 665 LITR2N_1m LITR2 N to 1 meter gN/m^2 F + 666 LITR3N_vr LITR3 N (vertically resolved) gN/m^3 T + 667 LITR3N LITR3 N gN/m^2 T + 668 LITR3N_1m LITR3 N to 1 meter gN/m^2 F + 669 CWDN_vr CWD N (vertically resolved) gN/m^3 T + 670 CWDN CWD N gN/m^2 T + 671 CWDN_1m CWD N to 1 meter gN/m^2 F + 672 SOIL1N_vr SOIL1 N (vertically resolved) gN/m^3 T + 673 SOIL1N SOIL1 N gN/m^2 T + 674 SOIL1N_1m SOIL1 N to 1 meter gN/m^2 F + 675 SOIL2N_vr SOIL2 N (vertically resolved) gN/m^3 T + 676 SOIL2N SOIL2 N gN/m^2 T + 677 SOIL2N_1m SOIL2 N to 1 meter gN/m^2 F + 678 SOIL3N_vr SOIL3 N (vertically resolved) gN/m^3 T + 679 SOIL3N SOIL3 N gN/m^2 T + 680 SOIL3N_1m SOIL3 N to 1 meter gN/m^2 F + 681 SMINN soil mineral N gN/m^2 T + 682 TOTLITN_1m total litter N to 1 meter gN/m^2 T + 683 TOTSOMN_1m total soil organic matter N to 1 meter gN/m^2 T + 684 COL_NTRUNC column-level sink for N truncation gN/m^2 F + 685 SMIN_NO3_vr soil mineral NO3 (vert. res.) gN/m^3 T + 686 SMIN_NH4_vr soil mineral NH4 (vert. res.) gN/m^3 T + 687 SMINN_vr soil mineral N gN/m^3 T + 688 SMIN_NO3 soil mineral NO3 gN/m^2 T + 689 SMIN_NH4 soil mineral NH4 gN/m^2 T + 690 TOTLITN total litter N gN/m^2 T + 691 TOTSOMN total soil organic matter N gN/m^2 T + 692 DYN_COL_SOIL_ADJUSTMENTS_N Adjustments in soil nitrogen due to dynamic column areas; only makes sense at the column level gN/m^2 F + 693 DYN_COL_SOIL_ADJUSTMENTS_NO3 Adjustments in soil NO3 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F + 694 DYN_COL_SOIL_ADJUSTMENTS_NH4 Adjustments in soil NH4 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F + 695 NDEP_TO_SMINN atmospheric N deposition to soil mineral N gN/m^2/s T + 696 NFIX_TO_SMINN symbiotic/asymbiotic N fixation to soil mineral N gN/m^2/s F + 697 FFIX_TO_SMINN free living N fixation to soil mineral N gN/m^2/s T + 698 SMINN_TO_SOIL1N_L1 mineral N flux for decomp. of LITR1to SOIL1 gN/m^2 F + 699 LITR1N_TO_SOIL1N decomp. of litter 1 N to soil 1 N gN/m^2 F + 700 SMINN_TO_SOIL1N_L1_vr mineral N flux for decomp. of LITR1to SOIL1 gN/m^3 F + 701 LITR1N_TO_SOIL1N_vr decomp. of litter 1 N to soil 1 N gN/m^3 F + 702 SMINN_TO_SOIL1N_L2 mineral N flux for decomp. of LITR2to SOIL1 gN/m^2 F + 703 LITR2N_TO_SOIL1N decomp. of litter 2 N to soil 1 N gN/m^2 F + 704 SMINN_TO_SOIL1N_L2_vr mineral N flux for decomp. of LITR2to SOIL1 gN/m^3 F + 705 LITR2N_TO_SOIL1N_vr decomp. of litter 2 N to soil 1 N gN/m^3 F + 706 SMINN_TO_SOIL2N_L3 mineral N flux for decomp. of LITR3to SOIL2 gN/m^2 F + 707 LITR3N_TO_SOIL2N decomp. of litter 3 N to soil 2 N gN/m^2 F + 708 SMINN_TO_SOIL2N_L3_vr mineral N flux for decomp. of LITR3to SOIL2 gN/m^3 F + 709 LITR3N_TO_SOIL2N_vr decomp. of litter 3 N to soil 2 N gN/m^3 F + 710 SMINN_TO_SOIL2N_S1 mineral N flux for decomp. of SOIL1to SOIL2 gN/m^2 F + 711 SOIL1N_TO_SOIL2N decomp. of soil 1 N to soil 2 N gN/m^2 F + 712 SMINN_TO_SOIL2N_S1_vr mineral N flux for decomp. of SOIL1to SOIL2 gN/m^3 F + 713 SOIL1N_TO_SOIL2N_vr decomp. of soil 1 N to soil 2 N gN/m^3 F + 714 SMINN_TO_SOIL3N_S1 mineral N flux for decomp. of SOIL1to SOIL3 gN/m^2 F + 715 SOIL1N_TO_SOIL3N decomp. of soil 1 N to soil 3 N gN/m^2 F + 716 SMINN_TO_SOIL3N_S1_vr mineral N flux for decomp. of SOIL1to SOIL3 gN/m^3 F + 717 SOIL1N_TO_SOIL3N_vr decomp. of soil 1 N to soil 3 N gN/m^3 F + 718 SMINN_TO_SOIL1N_S2 mineral N flux for decomp. of SOIL2to SOIL1 gN/m^2 F + 719 SOIL2N_TO_SOIL1N decomp. of soil 2 N to soil 1 N gN/m^2 F + 720 SMINN_TO_SOIL1N_S2_vr mineral N flux for decomp. of SOIL2to SOIL1 gN/m^3 F + 721 SOIL2N_TO_SOIL1N_vr decomp. of soil 2 N to soil 1 N gN/m^3 F + 722 SMINN_TO_SOIL3N_S2 mineral N flux for decomp. of SOIL2to SOIL3 gN/m^2 F + 723 SOIL2N_TO_SOIL3N decomp. of soil 2 N to soil 3 N gN/m^2 F + 724 SMINN_TO_SOIL3N_S2_vr mineral N flux for decomp. of SOIL2to SOIL3 gN/m^3 F + 725 SOIL2N_TO_SOIL3N_vr decomp. of soil 2 N to soil 3 N gN/m^3 F + 726 SMINN_TO_SOIL1N_S3 mineral N flux for decomp. of SOIL3to SOIL1 gN/m^2 F + 727 SOIL3N_TO_SOIL1N decomp. of soil 3 N to soil 1 N gN/m^2 F + 728 SMINN_TO_SOIL1N_S3_vr mineral N flux for decomp. of SOIL3to SOIL1 gN/m^3 F + 729 SOIL3N_TO_SOIL1N_vr decomp. of soil 3 N to soil 1 N gN/m^3 F + 730 CWDN_TO_LITR2N decomp. of coarse woody debris N to litter 2 N gN/m^2 F + 731 CWDN_TO_LITR2N_vr decomp. of coarse woody debris N to litter 2 N gN/m^3 F + 732 CWDN_TO_LITR3N decomp. of coarse woody debris N to litter 3 N gN/m^2 F + 733 CWDN_TO_LITR3N_vr decomp. of coarse woody debris N to litter 3 N gN/m^3 F + 734 DENIT total rate of denitrification gN/m^2/s T + 735 SOM_N_LEACHED total flux of N from SOM pools due to leaching gN/m^2/s F + 736 M_LITR1N_TO_LEACHING litter 1 N leaching loss gN/m^2/s F + 737 LITR1N_TNDNCY_VERT_TRANS litter 1 N tendency due to vertical transport gN/m^3/s F + 738 M_LITR2N_TO_LEACHING litter 2 N leaching loss gN/m^2/s F + 739 LITR2N_TNDNCY_VERT_TRANS litter 2 N tendency due to vertical transport gN/m^3/s F + 740 M_LITR3N_TO_LEACHING litter 3 N leaching loss gN/m^2/s F + 741 LITR3N_TNDNCY_VERT_TRANS litter 3 N tendency due to vertical transport gN/m^3/s F + 742 M_SOIL1N_TO_LEACHING soil 1 N leaching loss gN/m^2/s F + 743 SOIL1N_TNDNCY_VERT_TRANS soil 1 N tendency due to vertical transport gN/m^3/s F + 744 M_SOIL2N_TO_LEACHING soil 2 N leaching loss gN/m^2/s F + 745 SOIL2N_TNDNCY_VERT_TRANS soil 2 N tendency due to vertical transport gN/m^3/s F + 746 M_SOIL3N_TO_LEACHING soil 3 N leaching loss gN/m^2/s F + 747 SOIL3N_TNDNCY_VERT_TRANS soil 3 N tendency due to vertical transport gN/m^3/s F + 748 F_NIT nitrification flux gN/m^2/s T + 749 F_DENIT denitrification flux gN/m^2/s T + 750 POT_F_NIT potential nitrification flux gN/m^2/s T + 751 POT_F_DENIT potential denitrification flux gN/m^2/s T + 752 SMIN_NO3_LEACHED soil NO3 pool loss to leaching gN/m^2/s T + 753 SMIN_NO3_RUNOFF soil NO3 pool loss to runoff gN/m^2/s T + 754 F_NIT_vr nitrification flux gN/m^3/s F + 755 F_DENIT_vr denitrification flux gN/m^3/s F + 756 POT_F_NIT_vr potential nitrification flux gN/m^3/s F + 757 POT_F_DENIT_vr potential denitrification flux gN/m^3/s F + 758 SMIN_NO3_LEACHED_vr soil NO3 pool loss to leaching gN/m^3/s F + 759 SMIN_NO3_RUNOFF_vr soil NO3 pool loss to runoff gN/m^3/s F + 760 n2_n2o_ratio_denit n2_n2o_ratio_denit gN/gN F + 761 ACTUAL_IMMOB_NO3 immobilization of NO3 gN/m^3/s F + 762 ACTUAL_IMMOB_NH4 immobilization of NH4 gN/m^3/s F + 763 SMIN_NO3_TO_PLANT plant uptake of NO3 gN/m^3/s F + 764 SMIN_NH4_TO_PLANT plant uptake of NH4 gN/m^3/s F + 765 SMIN_NO3_MASSDENS SMIN_NO3_MASSDENS ugN/cm^3 soil F + 766 K_NITR_T K_NITR_T unitless F + 767 K_NITR_PH K_NITR_PH unitless F + 768 K_NITR_H2O K_NITR_H2O unitless F + 769 K_NITR K_NITR 1/s F + 770 WFPS WFPS percent F + 771 FMAX_DENIT_CARBONSUBSTRATE FMAX_DENIT_CARBONSUBSTRATE gN/m^3/s F + 772 FMAX_DENIT_NITRATE FMAX_DENIT_NITRATE gN/m^3/s F + 773 F_DENIT_BASE F_DENIT_BASE gN/m^3/s F + 774 diffus diffusivity m^2/s F + 775 ratio_k1 ratio_k1 none F + 776 ratio_no3_co2 ratio_no3_co2 ratio F + 777 soil_co2_prod soil_co2_prod ug C / g soil / day F + 778 fr_WFPS fr_WFPS fraction F + 779 soil_bulkdensity soil_bulkdensity kg/m3 F + 780 anaerobic_frac anaerobic_frac m3/m3 F + 781 r_psi r_psi m F + 782 POTENTIAL_IMMOB_vr potential N immobilization gN/m^3/s F + 783 ACTUAL_IMMOB_vr actual N immobilization gN/m^3/s F + 784 SMINN_TO_PLANT_vr plant uptake of soil mineral N gN/m^3/s F + 785 SUPPLEMENT_TO_SMINN_vr supplemental N supply gN/m^3/s F + 786 GROSS_NMIN_vr gross rate of N mineralization gN/m^3/s F + 787 NET_NMIN_vr net rate of N mineralization gN/m^3/s F + 788 POTENTIAL_IMMOB potential N immobilization gN/m^2/s T + 789 ACTUAL_IMMOB actual N immobilization gN/m^2/s T + 790 SMINN_TO_PLANT plant uptake of soil mineral N gN/m^2/s T + 791 SUPPLEMENT_TO_SMINN supplemental N supply gN/m^2/s T + 792 GROSS_NMIN gross rate of N mineralization gN/m^2/s T + 793 NET_NMIN net rate of N mineralization gN/m^2/s T + 794 F_N2O_NIT nitrification N2O flux gN/m^2/s T + 795 F_N2O_DENIT denitrification N2O flux gN/m^2/s T + 796 FERT_TO_SMINN fertilizer to soil mineral N gN/m^2/s F + 797 GDDHARV Growing degree days (gdd) needed to harvest ddays F + 798 LFC2 conversion area fraction of BET and BDT that burned per sec T + 799 ANNSUM_COUNTER seconds since last annual accumulator turnover s F + 800 CANNAVG_T2M annual average of 2m air temperature K F + 801 NFIRE fire counts valid only in Reg.C counts/km2/sec T + 802 FAREA_BURNED timestep fractional area burned s-1 T + 803 BAF_CROP fractional area burned for crop s-1 T + 804 BAF_PEATF fractional area burned in peatland s-1 T + 805 ANNAVG_T2M annual average 2m air temperature K F + 806 TEMPAVG_T2M temporary average 2m air temperature K F + 807 DORMANT_FLAG dormancy flag none F + 808 DAYS_ACTIVE number of days since last dormancy days F + 809 ONSET_FLAG onset flag none F + 810 ONSET_COUNTER onset days counter days F + 811 ONSET_GDDFLAG onset flag for growing degree day sum none F + 812 ONSET_FDD onset freezing degree days counter C degree-days F + 813 ONSET_GDD onset growing degree days C degree-days F + 814 ONSET_SWI onset soil water index none F + 815 OFFSET_FLAG offset flag none F + 816 OFFSET_COUNTER offset days counter days F + 817 OFFSET_FDD offset freezing degree days counter C degree-days F + 818 OFFSET_SWI offset soil water index none F + 819 LGSF long growing season factor proportion F + 820 BGLFR background litterfall rate 1/s F + 821 BGTR background transfer growth rate 1/s F + 822 C_ALLOMETRY C allocation index none F + 823 N_ALLOMETRY N allocation index none F + 824 TEMPSUM_POTENTIAL_GPP temporary annual sum of potential GPP gC/m^2/yr F + 825 ANNSUM_POTENTIAL_GPP annual sum of potential GPP gN/m^2/yr F + 826 TEMPMAX_RETRANSN temporary annual max of retranslocated N pool gN/m^2 F + 827 ANNMAX_RETRANSN annual max of retranslocated N pool gN/m^2 F + 828 DOWNREG fractional reduction in GPP due to N limitation proportion F + 829 LEAFCN_OFFSET Leaf C:N used by FUN unitless F + 830 PLANTCN Plant C:N used by FUN unitless F + 831 GRAINC grain C (does not equal yield) gC/m^2 T + 832 CROPSEEDC_DEFICIT C used for crop seed that needs to be repaid gC/m^2 T + 833 XSMRPOOL_LOSS temporary photosynthate C pool loss gC/m^2 F + 834 WOODC wood C gC/m^2 T + 835 LEAFC leaf C gC/m^2 T + 836 LEAFC_STORAGE leaf C storage gC/m^2 F + 837 LEAFC_XFER leaf C transfer gC/m^2 F + 838 LEAFC_STORAGE_XFER_ACC Accumulated leaf C transfer gC/m^2 F + 839 STORAGE_CDEMAND C use from the C storage pool gC/m^2 F + 840 FROOTC fine root C gC/m^2 T + 841 FROOTC_STORAGE fine root C storage gC/m^2 F + 842 FROOTC_XFER fine root C transfer gC/m^2 F + 843 LIVESTEMC live stem C gC/m^2 T + 844 LIVESTEMC_STORAGE live stem C storage gC/m^2 F + 845 LIVESTEMC_XFER live stem C transfer gC/m^2 F + 846 DEADSTEMC dead stem C gC/m^2 T + 847 DEADSTEMC_STORAGE dead stem C storage gC/m^2 F + 848 DEADSTEMC_XFER dead stem C transfer gC/m^2 F + 849 LIVECROOTC live coarse root C gC/m^2 T + 850 LIVECROOTC_STORAGE live coarse root C storage gC/m^2 F + 851 LIVECROOTC_XFER live coarse root C transfer gC/m^2 F + 852 DEADCROOTC dead coarse root C gC/m^2 T + 853 DEADCROOTC_STORAGE dead coarse root C storage gC/m^2 F + 854 DEADCROOTC_XFER dead coarse root C transfer gC/m^2 F + 855 GRESP_STORAGE growth respiration storage gC/m^2 F + 856 GRESP_XFER growth respiration transfer gC/m^2 F + 857 CPOOL temporary photosynthate C pool gC/m^2 T + 858 XSMRPOOL temporary photosynthate C pool gC/m^2 T + 859 PFT_CTRUNC patch-level sink for C truncation gC/m^2 F + 860 DISPVEGC displayed veg carbon, excluding storage and cpool gC/m^2 T + 861 STORVEGC stored vegetation carbon, excluding cpool gC/m^2 T + 862 TOTVEGC total vegetation carbon, excluding cpool gC/m^2 T + 863 TOTPFTC total patch-level carbon, including cpool gC/m^2 T + 864 SEEDC pool for seeding new PFTs via dynamic landcover gC/m^2 T + 865 FUELC fuel load gC/m^2 T + 866 TOTCOLC total column carbon, incl veg and cpool but excl product pools gC/m^2 T + 867 TOTECOSYSC total ecosystem carbon, incl veg but excl cpool and product pools gC/m^2 T + 868 GRAINC_TO_FOOD grain C to food gC/m^2/s T + 869 LEAFC_TO_BIOFUELC leaf C to biofuel C gC/m^2/s T + 870 LIVESTEMC_TO_BIOFUELC livestem C to biofuel C gC/m^2/s T + 871 GRAINC_TO_SEED grain C to seed gC/m^2/s T + 872 LITTERC_LOSS litter C loss gC/m^2/s T + 873 WOODC_ALLOC wood C eallocation gC/m^2/s T + 874 WOODC_LOSS wood C loss gC/m^2/s T + 875 LEAFC_LOSS leaf C loss gC/m^2/s T + 876 LEAFC_ALLOC leaf C allocation gC/m^2/s T + 877 FROOTC_LOSS fine root C loss gC/m^2/s T + 878 FROOTC_ALLOC fine root C allocation gC/m^2/s T + 879 M_LEAFC_TO_LITTER leaf C mortality gC/m^2/s F + 880 M_FROOTC_TO_LITTER fine root C mortality gC/m^2/s F + 881 M_LEAFC_STORAGE_TO_LITTER leaf C storage mortality gC/m^2/s F + 882 M_FROOTC_STORAGE_TO_LITTER fine root C storage mortality gC/m^2/s F + 883 M_LIVESTEMC_STORAGE_TO_LITTER live stem C storage mortality gC/m^2/s F + 884 M_DEADSTEMC_STORAGE_TO_LITTER dead stem C storage mortality gC/m^2/s F + 885 M_LIVECROOTC_STORAGE_TO_LITTER live coarse root C storage mortality gC/m^2/s F + 886 M_DEADCROOTC_STORAGE_TO_LITTER dead coarse root C storage mortality gC/m^2/s F + 887 M_LEAFC_XFER_TO_LITTER leaf C transfer mortality gC/m^2/s F + 888 M_FROOTC_XFER_TO_LITTER fine root C transfer mortality gC/m^2/s F + 889 M_LIVESTEMC_XFER_TO_LITTER live stem C transfer mortality gC/m^2/s F + 890 M_DEADSTEMC_XFER_TO_LITTER dead stem C transfer mortality gC/m^2/s F + 891 M_LIVECROOTC_XFER_TO_LITTER live coarse root C transfer mortality gC/m^2/s F + 892 M_DEADCROOTC_XFER_TO_LITTER dead coarse root C transfer mortality gC/m^2/s F + 893 M_LIVESTEMC_TO_LITTER live stem C mortality gC/m^2/s F + 894 M_DEADSTEMC_TO_LITTER dead stem C mortality gC/m^2/s F + 895 M_LIVECROOTC_TO_LITTER live coarse root C mortality gC/m^2/s F + 896 M_DEADCROOTC_TO_LITTER dead coarse root C mortality gC/m^2/s F + 897 M_GRESP_STORAGE_TO_LITTER growth respiration storage mortality gC/m^2/s F + 898 M_GRESP_XFER_TO_LITTER growth respiration transfer mortality gC/m^2/s F + 899 M_LEAFC_TO_FIRE leaf C fire loss gC/m^2/s F + 900 M_LEAFC_STORAGE_TO_FIRE leaf C storage fire loss gC/m^2/s F + 901 M_LEAFC_XFER_TO_FIRE leaf C transfer fire loss gC/m^2/s F + 902 M_LIVESTEMC_TO_FIRE live stem C fire loss gC/m^2/s F + 903 M_LIVESTEMC_STORAGE_TO_FIRE live stem C storage fire loss gC/m^2/s F + 904 M_LIVESTEMC_XFER_TO_FIRE live stem C transfer fire loss gC/m^2/s F + 905 M_DEADSTEMC_TO_FIRE dead stem C fire loss gC/m^2/s F + 906 M_DEADSTEMC_STORAGE_TO_FIRE dead stem C storage fire loss gC/m^2/s F + 907 M_DEADSTEMC_XFER_TO_FIRE dead stem C transfer fire loss gC/m^2/s F + 908 M_FROOTC_TO_FIRE fine root C fire loss gC/m^2/s F + 909 M_FROOTC_STORAGE_TO_FIRE fine root C storage fire loss gC/m^2/s F + 910 M_FROOTC_XFER_TO_FIRE fine root C transfer fire loss gC/m^2/s F + 911 M_LIVEROOTC_TO_FIRE live root C fire loss gC/m^2/s F + 912 M_LIVEROOTC_STORAGE_TO_FIRE live root C storage fire loss gC/m^2/s F + 913 M_LIVEROOTC_XFER_TO_FIRE live root C transfer fire loss gC/m^2/s F + 914 M_DEADROOTC_TO_FIRE dead root C fire loss gC/m^2/s F + 915 M_DEADROOTC_STORAGE_TO_FIRE dead root C storage fire loss gC/m^2/s F + 916 M_DEADROOTC_XFER_TO_FIRE dead root C transfer fire loss gC/m^2/s F + 917 M_GRESP_STORAGE_TO_FIRE growth respiration storage fire loss gC/m^2/s F + 918 M_GRESP_XFER_TO_FIRE growth respiration transfer fire loss gC/m^2/s F + 919 M_LEAFC_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s F + 920 M_LEAFC_STORAGE_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s F + 921 M_LEAFC_XFER_TO_LITTER_FIRE leaf C transfer fire mortality to litter gC/m^2/s F + 922 M_LIVESTEMC_TO_LITTER_FIRE live stem C fire mortality to litter gC/m^2/s F + 923 M_LIVESTEMC_STORAGE_TO_LITTER_FIRE live stem C storage fire mortality to litter gC/m^2/s F + 924 M_LIVESTEMC_XFER_TO_LITTER_FIRE live stem C transfer fire mortality to litter gC/m^2/s F + 925 M_LIVESTEMC_TO_DEADSTEMC_FIRE live stem C fire mortality to dead stem C gC/m^2/s F + 926 M_DEADSTEMC_TO_LITTER_FIRE dead stem C fire mortality to litter gC/m^2/s F + 927 M_DEADSTEMC_STORAGE_TO_LITTER_FIRE dead stem C storage fire mortality to litter gC/m^2/s F + 928 M_DEADSTEMC_XFER_TO_LITTER_FIRE dead stem C transfer fire mortality to litter gC/m^2/s F + 929 M_FROOTC_TO_LITTER_FIRE fine root C fire mortality to litter gC/m^2/s F + 930 M_FROOTC_STORAGE_TO_LITTER_FIRE fine root C storage fire mortality to litter gC/m^2/s F + 931 M_FROOTC_XFER_TO_LITTER_FIRE fine root C transfer fire mortality to litter gC/m^2/s F + 932 M_LIVEROOTC_TO_LITTER_FIRE live root C fire mortality to litter gC/m^2/s F + 933 M_LIVEROOTC_STORAGE_TO_LITTER_FIRE live root C storage fire mortality to litter gC/m^2/s F + 934 M_LIVEROOTC_XFER_TO_LITTER_FIRE live root C transfer fire mortality to litter gC/m^2/s F + 935 M_LIVEROOTC_TO_DEADROOTC_FIRE live root C fire mortality to dead root C gC/m^2/s F + 936 M_DEADROOTC_TO_LITTER_FIRE dead root C fire mortality to litter gC/m^2/s F + 937 M_DEADROOTC_STORAGE_TO_LITTER_FIRE dead root C storage fire mortality to litter gC/m^2/s F + 938 M_DEADROOTC_XFER_TO_LITTER_FIRE dead root C transfer fire mortality to litter gC/m^2/s F + 939 M_LIVECROOTC_STORAGE_TO_LITTER_FIRE live coarse root C fire mortality to litter gC/m^2/s F + 940 M_DEADCROOTC_STORAGE_TO_LITTER_FIRE dead coarse root C storage fire mortality to litter gC/m^2/s F + 941 M_GRESP_STORAGE_TO_LITTER_FIRE growth respiration storage fire mortality to litter gC/m^2/s F + 942 M_GRESP_XFER_TO_LITTER_FIRE growth respiration transfer fire mortality to litter gC/m^2/s F + 943 LEAFC_XFER_TO_LEAFC leaf C growth from storage gC/m^2/s F + 944 FROOTC_XFER_TO_FROOTC fine root C growth from storage gC/m^2/s F + 945 LIVESTEMC_XFER_TO_LIVESTEMC live stem C growth from storage gC/m^2/s F + 946 DEADSTEMC_XFER_TO_DEADSTEMC dead stem C growth from storage gC/m^2/s F + 947 LIVECROOTC_XFER_TO_LIVECROOTC live coarse root C growth from storage gC/m^2/s F + 948 DEADCROOTC_XFER_TO_DEADCROOTC dead coarse root C growth from storage gC/m^2/s F + 949 LEAFC_TO_LITTER leaf C litterfall gC/m^2/s F + 950 LEAFC_TO_LITTER_FUN leaf C litterfall used by FUN gC/m^2/s T + 951 FROOTC_TO_LITTER fine root C litterfall gC/m^2/s F + 952 EXCESSC_MR excess C maintenance respiration gC/m^2/s F + 953 LEAF_MR leaf maintenance respiration gC/m^2/s T + 954 FROOT_MR fine root maintenance respiration gC/m^2/s F + 955 LIVESTEM_MR live stem maintenance respiration gC/m^2/s F + 956 LIVECROOT_MR live coarse root maintenance respiration gC/m^2/s F + 957 PSNSUN_TO_CPOOL C fixation from sunlit canopy gC/m^2/s T + 958 PSNSHADE_TO_CPOOL C fixation from shaded canopy gC/m^2/s T + 959 CPOOL_TO_LEAFC allocation to leaf C gC/m^2/s F + 960 CPOOL_TO_LEAFC_STORAGE allocation to leaf C storage gC/m^2/s F + 961 CPOOL_TO_FROOTC allocation to fine root C gC/m^2/s F + 962 CPOOL_TO_FROOTC_STORAGE allocation to fine root C storage gC/m^2/s F + 963 CPOOL_TO_LIVESTEMC allocation to live stem C gC/m^2/s F + 964 CPOOL_TO_LIVESTEMC_STORAGE allocation to live stem C storage gC/m^2/s F + 965 CPOOL_TO_DEADSTEMC allocation to dead stem C gC/m^2/s F + 966 CPOOL_TO_DEADSTEMC_STORAGE allocation to dead stem C storage gC/m^2/s F + 967 CPOOL_TO_LIVECROOTC allocation to live coarse root C gC/m^2/s F + 968 CPOOL_TO_LIVECROOTC_STORAGE allocation to live coarse root C storage gC/m^2/s F + 969 CPOOL_TO_DEADCROOTC allocation to dead coarse root C gC/m^2/s F + 970 CPOOL_TO_DEADCROOTC_STORAGE allocation to dead coarse root C storage gC/m^2/s F + 971 CPOOL_TO_GRESP_STORAGE allocation to growth respiration storage gC/m^2/s F + 972 CPOOL_LEAF_GR leaf growth respiration gC/m^2/s F + 973 CPOOL_LEAF_STORAGE_GR leaf growth respiration to storage gC/m^2/s F + 974 TRANSFER_LEAF_GR leaf growth respiration from storage gC/m^2/s F + 975 CPOOL_FROOT_GR fine root growth respiration gC/m^2/s F + 976 CPOOL_FROOT_STORAGE_GR fine root growth respiration to storage gC/m^2/s F + 977 TRANSFER_FROOT_GR fine root growth respiration from storage gC/m^2/s F + 978 CPOOL_LIVESTEM_GR live stem growth respiration gC/m^2/s F + 979 CPOOL_LIVESTEM_STORAGE_GR live stem growth respiration to storage gC/m^2/s F + 980 TRANSFER_LIVESTEM_GR live stem growth respiration from storage gC/m^2/s F + 981 CPOOL_DEADSTEM_GR dead stem growth respiration gC/m^2/s F + 982 CPOOL_DEADSTEM_STORAGE_GR dead stem growth respiration to storage gC/m^2/s F + 983 TRANSFER_DEADSTEM_GR dead stem growth respiration from storage gC/m^2/s F + 984 CPOOL_LIVECROOT_GR live coarse root growth respiration gC/m^2/s F + 985 CPOOL_LIVECROOT_STORAGE_GR live coarse root growth respiration to storage gC/m^2/s F + 986 TRANSFER_LIVECROOT_GR live coarse root growth respiration from storage gC/m^2/s F + 987 CPOOL_DEADCROOT_GR dead coarse root growth respiration gC/m^2/s F + 988 CPOOL_DEADCROOT_STORAGE_GR dead coarse root growth respiration to storage gC/m^2/s F + 989 TRANSFER_DEADCROOT_GR dead coarse root growth respiration from storage gC/m^2/s F + 990 LEAFC_STORAGE_TO_XFER leaf C shift storage to transfer gC/m^2/s F + 991 FROOTC_STORAGE_TO_XFER fine root C shift storage to transfer gC/m^2/s F + 992 LIVESTEMC_STORAGE_TO_XFER live stem C shift storage to transfer gC/m^2/s F + 993 DEADSTEMC_STORAGE_TO_XFER dead stem C shift storage to transfer gC/m^2/s F + 994 LIVECROOTC_STORAGE_TO_XFER live coarse root C shift storage to transfer gC/m^2/s F + 995 DEADCROOTC_STORAGE_TO_XFER dead coarse root C shift storage to transfer gC/m^2/s F + 996 GRESP_STORAGE_TO_XFER growth respiration shift storage to transfer gC/m^2/s F + 997 LIVESTEMC_TO_DEADSTEMC live stem C turnover gC/m^2/s F + 998 LIVECROOTC_TO_DEADCROOTC live coarse root C turnover gC/m^2/s F + 999 INIT_GPP GPP flux before downregulation gC/m^2/s F +1000 CURRENT_GR growth resp for new growth displayed in this timestep gC/m^2/s F +1001 TRANSFER_GR growth resp for transfer growth displayed in this timestep gC/m^2/s F +1002 STORAGE_GR growth resp for growth sent to storage for later display gC/m^2/s F +1003 AVAILC C flux available for allocation gC/m^2/s F +1004 PLANT_CALLOC total allocated C flux gC/m^2/s F +1005 EXCESS_CFLUX C flux not allocated due to downregulation gC/m^2/s F +1006 PREV_LEAFC_TO_LITTER previous timestep leaf C litterfall flux gC/m^2/s F +1007 PREV_FROOTC_TO_LITTER previous timestep froot C litterfall flux gC/m^2/s F +1008 XSMRPOOL_RECOVER C flux assigned to recovery of negative xsmrpool gC/m^2/s T +1009 GPP gross primary production gC/m^2/s T +1010 RR root respiration (fine root MR + total root GR) gC/m^2/s T +1011 MR maintenance respiration gC/m^2/s T +1012 GR total growth respiration gC/m^2/s T +1013 AR autotrophic respiration (MR + GR) gC/m^2/s T +1014 NPP net primary production gC/m^2/s T +1015 AGNPP aboveground NPP gC/m^2/s T +1016 BGNPP belowground NPP gC/m^2/s T +1017 LITFALL litterfall (leaves and fine roots) gC/m^2/s T +1018 WOOD_HARVESTC wood harvest carbon (to product pools) gC/m^2/s T +1019 SLASH_HARVESTC slash harvest carbon (to litter) gC/m^2/s T +1020 PFT_FIRE_CLOSS total patch-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T +1021 NPP_NACTIVE Mycorrhizal N uptake used C gC/m^2/s T +1022 NPP_BURNEDOFF C that cannot be used for N uptake gC/m^2/s F +1023 NPP_NNONMYC Non-mycorrhizal N uptake used C gC/m^2/s T +1024 NPP_NAM AM-associated N uptake used C gC/m^2/s T +1025 NPP_NECM ECM-associated N uptake used C gC/m^2/s T +1026 NPP_NACTIVE_NO3 Mycorrhizal N uptake used C gC/m^2/s T +1027 NPP_NACTIVE_NH4 Mycorrhizal N uptake use C gC/m^2/s T +1028 NPP_NNONMYC_NO3 Non-mycorrhizal N uptake use C gC/m^2/s T +1029 NPP_NNONMYC_NH4 Non-mycorrhizal N uptake use C gC/m^2/s T +1030 NPP_NAM_NO3 AM-associated N uptake use C gC/m^2/s T +1031 NPP_NAM_NH4 AM-associated N uptake use C gC/m^2/s T +1032 NPP_NECM_NO3 ECM-associated N uptake used C gC/m^2/s T +1033 NPP_NECM_NH4 ECM-associated N uptake use C gC/m^2/s T +1034 NPP_NFIX Symbiotic BNF uptake used C gC/m^2/s T +1035 NPP_NRETRANS Retranslocated N uptake flux gC/m^2/s T +1036 NPP_NUPTAKE Total C used by N uptake in FUN gC/m^2/s T +1037 NPP_GROWTH Total C used for growth in FUN gC/m^2/s T +1038 LEAFC_CHANGE C change in leaf gC/m^2/s T +1039 SOILC_CHANGE C change in soil gC/m^2/s T +1040 CWDC_LOSS coarse woody debris C loss gC/m^2/s T +1041 M_LITR1C_TO_FIRE litter 1 C fire loss gC/m^2/s F +1042 M_LITR1C_TO_FIRE_vr litter 1 C fire loss gC/m^3/s F +1043 M_LITR2C_TO_FIRE litter 2 C fire loss gC/m^2/s F +1044 M_LITR2C_TO_FIRE_vr litter 2 C fire loss gC/m^3/s F +1045 M_LITR3C_TO_FIRE litter 3 C fire loss gC/m^2/s F +1046 M_LITR3C_TO_FIRE_vr litter 3 C fire loss gC/m^3/s F +1047 M_CWDC_TO_FIRE coarse woody debris C fire loss gC/m^2/s F +1048 M_CWDC_TO_FIRE_vr coarse woody debris C fire loss gC/m^3/s F +1049 DWT_SEEDC_TO_LEAF seed source to patch-level leaf gC/m^2/s F +1050 DWT_SEEDC_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gC/m^2/s F +1051 DWT_SEEDC_TO_DEADSTEM seed source to patch-level deadstem gC/m^2/s F +1052 DWT_SEEDC_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gC/m^2/s F +1053 DWT_CONV_CFLUX conversion C flux (immediate loss to atm) (0 at all times except first timestep of year) gC/m^2/s T +1054 DWT_CONV_CFLUX_PATCH patch-level conversion C flux (immediate loss to atm) (0 at all times except first timestep of gC/m^2/s F +1055 DWT_CONV_CFLUX_DRIBBLED conversion C flux (immediate loss to atm), dribbled throughout the year gC/m^2/s T +1056 DWT_WOOD_PRODUCTC_GAIN_PATCH patch-level landcover change-driven addition to wood product pools(0 at all times except first gC/m^2/s F +1057 DWT_SLASH_CFLUX slash C flux (to litter diagnostic only) (0 at all times except first timestep of year) gC/m^2/s T +1058 DWT_SLASH_CFLUX_PATCH patch-level slash C flux (to litter diagnostic only) (0 at all times except first timestep of gC/m^2/s F +1059 DWT_FROOTC_TO_LITR_MET_C fine root to litter due to landcover change gC/m^2/s F +1060 DWT_FROOTC_TO_LITR_CEL_C fine root to litter due to landcover change gC/m^2/s F +1061 DWT_FROOTC_TO_LITR_LIG_C fine root to litter due to landcover change gC/m^2/s F +1062 DWT_LIVECROOTC_TO_CWDC live coarse root to CWD due to landcover change gC/m^2/s F +1063 DWT_DEADCROOTC_TO_CWDC dead coarse root to CWD due to landcover change gC/m^2/s F +1064 CROP_SEEDC_TO_LEAF crop seed source to leaf gC/m^2/s F +1065 SR total soil respiration (HR + root resp) gC/m^2/s T +1066 ER total ecosystem respiration, autotrophic + heterotrophic gC/m^2/s T +1067 LITFIRE litter fire losses gC/m^2/s F +1068 SOMFIRE soil organic matter fire losses gC/m^2/s F +1069 TOTFIRE total ecosystem fire losses gC/m^2/s F +1070 COL_FIRE_CLOSS total column-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T +1071 ANNSUM_NPP annual sum of NPP gC/m^2/yr F +1072 CANNSUM_NPP annual sum of column-level NPP gC/m^2/s F +1073 NEP net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink gC/m^2/s T +1074 NBP net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux (latter smoothed o gC/m^2/s T +1075 NEE net ecosystem exchange of carbon, includes fire and hrv_xsmrpool (latter smoothed over the yea gC/m^2/s T +1076 LAND_USE_FLUX total C emitted from land cover conversion (smoothed over the year) and wood and grain product gC/m^2/s T +1077 GRAINN grain N gN/m^2 T +1078 CROPSEEDN_DEFICIT N used for crop seed that needs to be repaid gN/m^2 F +1079 LEAFN leaf N gN/m^2 T +1080 LEAFN_STORAGE leaf N storage gN/m^2 F +1081 LEAFN_XFER leaf N transfer gN/m^2 F +1082 LEAFN_STORAGE_XFER_ACC Accmulated leaf N transfer gN/m^2 F +1083 STORAGE_NDEMAND N demand during the offset period gN/m^2 F +1084 FROOTN fine root N gN/m^2 T +1085 FROOTN_STORAGE fine root N storage gN/m^2 F +1086 FROOTN_XFER fine root N transfer gN/m^2 F +1087 LIVESTEMN live stem N gN/m^2 T +1088 LIVESTEMN_STORAGE live stem N storage gN/m^2 F +1089 LIVESTEMN_XFER live stem N transfer gN/m^2 F +1090 DEADSTEMN dead stem N gN/m^2 T +1091 DEADSTEMN_STORAGE dead stem N storage gN/m^2 F +1092 DEADSTEMN_XFER dead stem N transfer gN/m^2 F +1093 LIVECROOTN live coarse root N gN/m^2 T +1094 LIVECROOTN_STORAGE live coarse root N storage gN/m^2 F +1095 LIVECROOTN_XFER live coarse root N transfer gN/m^2 F +1096 DEADCROOTN dead coarse root N gN/m^2 T +1097 DEADCROOTN_STORAGE dead coarse root N storage gN/m^2 F +1098 DEADCROOTN_XFER dead coarse root N transfer gN/m^2 F +1099 RETRANSN plant pool of retranslocated N gN/m^2 T +1100 NPOOL temporary plant N pool gN/m^2 T +1101 PFT_NTRUNC patch-level sink for N truncation gN/m^2 F +1102 DISPVEGN displayed vegetation nitrogen gN/m^2 T +1103 STORVEGN stored vegetation nitrogen gN/m^2 T +1104 TOTVEGN total vegetation nitrogen gN/m^2 T +1105 TOTPFTN total patch-level nitrogen gN/m^2 T +1106 SEEDN pool for seeding new PFTs via dynamic landcover gN/m^2 T +1107 TOTECOSYSN total ecosystem N, excluding product pools gN/m^2 T +1108 TOTCOLN total column-level N, excluding product pools gN/m^2 T +1109 M_LEAFN_TO_LITTER leaf N mortality gN/m^2/s F +1110 M_FROOTN_TO_LITTER fine root N mortality gN/m^2/s F +1111 M_LEAFN_STORAGE_TO_LITTER leaf N storage mortality gN/m^2/s F +1112 M_FROOTN_STORAGE_TO_LITTER fine root N storage mortality gN/m^2/s F +1113 M_LIVESTEMN_STORAGE_TO_LITTER live stem N storage mortality gN/m^2/s F +1114 M_DEADSTEMN_STORAGE_TO_LITTER dead stem N storage mortality gN/m^2/s F +1115 M_LIVECROOTN_STORAGE_TO_LITTER live coarse root N storage mortality gN/m^2/s F +1116 M_DEADCROOTN_STORAGE_TO_LITTER dead coarse root N storage mortality gN/m^2/s F +1117 M_LEAFN_XFER_TO_LITTER leaf N transfer mortality gN/m^2/s F +1118 M_FROOTN_XFER_TO_LITTER fine root N transfer mortality gN/m^2/s F +1119 M_LIVESTEMN_XFER_TO_LITTER live stem N transfer mortality gN/m^2/s F +1120 M_DEADSTEMN_XFER_TO_LITTER dead stem N transfer mortality gN/m^2/s F +1121 M_LIVECROOTN_XFER_TO_LITTER live coarse root N transfer mortality gN/m^2/s F +1122 M_DEADCROOTN_XFER_TO_LITTER dead coarse root N transfer mortality gN/m^2/s F +1123 M_LIVESTEMN_TO_LITTER live stem N mortality gN/m^2/s F +1124 M_DEADSTEMN_TO_LITTER dead stem N mortality gN/m^2/s F +1125 M_LIVECROOTN_TO_LITTER live coarse root N mortality gN/m^2/s F +1126 M_DEADCROOTN_TO_LITTER dead coarse root N mortality gN/m^2/s F +1127 M_RETRANSN_TO_LITTER retranslocated N pool mortality gN/m^2/s F +1128 M_LEAFN_TO_FIRE leaf N fire loss gN/m^2/s F +1129 M_FROOTN_TO_FIRE fine root N fire loss gN/m^2/s F +1130 M_LEAFN_STORAGE_TO_FIRE leaf N storage fire loss gN/m^2/s F +1131 M_FROOTN_STORAGE_TO_FIRE fine root N storage fire loss gN/m^2/s F +1132 M_LIVESTEMN_STORAGE_TO_FIRE live stem N storage fire loss gN/m^2/s F +1133 M_DEADSTEMN_STORAGE_TO_FIRE dead stem N storage fire loss gN/m^2/s F +1134 M_LIVECROOTN_STORAGE_TO_FIRE live coarse root N storage fire loss gN/m^2/s F +1135 M_DEADCROOTN_STORAGE_TO_FIRE dead coarse root N storage fire loss gN/m^2/s F +1136 M_LEAFN_XFER_TO_FIRE leaf N transfer fire loss gN/m^2/s F +1137 M_FROOTN_XFER_TO_FIRE fine root N transfer fire loss gN/m^2/s F +1138 M_LIVESTEMN_XFER_TO_FIRE live stem N transfer fire loss gN/m^2/s F +1139 M_DEADSTEMN_XFER_TO_FIRE dead stem N transfer fire loss gN/m^2/s F +1140 M_LIVECROOTN_XFER_TO_FIRE live coarse root N transfer fire loss gN/m^2/s F +1141 M_DEADCROOTN_XFER_TO_FIRE dead coarse root N transfer fire loss gN/m^2/s F +1142 M_LIVESTEMN_TO_FIRE live stem N fire loss gN/m^2/s F +1143 M_DEADSTEMN_TO_FIRE dead stem N fire loss gN/m^2/s F +1144 M_DEADSTEMN_TO_LITTER_FIRE dead stem N fire mortality to litter gN/m^2/s F +1145 M_LIVECROOTN_TO_FIRE live coarse root N fire loss gN/m^2/s F +1146 M_DEADCROOTN_TO_FIRE dead coarse root N fire loss gN/m^2/s F +1147 M_DEADCROOTN_TO_LITTER_FIRE dead coarse root N fire mortality to litter gN/m^2/s F +1148 M_RETRANSN_TO_FIRE retranslocated N pool fire loss gN/m^2/s F +1149 LEAFN_XFER_TO_LEAFN leaf N growth from storage gN/m^2/s F +1150 FROOTN_XFER_TO_FROOTN fine root N growth from storage gN/m^2/s F +1151 LIVESTEMN_XFER_TO_LIVESTEMN live stem N growth from storage gN/m^2/s F +1152 DEADSTEMN_XFER_TO_DEADSTEMN dead stem N growth from storage gN/m^2/s F +1153 LIVECROOTN_XFER_TO_LIVECROOTN live coarse root N growth from storage gN/m^2/s F +1154 DEADCROOTN_XFER_TO_DEADCROOTN dead coarse root N growth from storage gN/m^2/s F +1155 LEAFN_TO_LITTER leaf N litterfall gN/m^2/s T +1156 LEAFN_TO_RETRANSN leaf N to retranslocated N pool gN/m^2/s F +1157 FROOTN_TO_LITTER fine root N litterfall gN/m^2/s F +1158 RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s T +1159 FREE_RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s T +1160 SMINN_TO_NPOOL deployment of soil mineral N uptake gN/m^2/s T +1161 NPOOL_TO_LEAFN allocation to leaf N gN/m^2/s F +1162 NPOOL_TO_LEAFN_STORAGE allocation to leaf N storage gN/m^2/s F +1163 NPOOL_TO_FROOTN allocation to fine root N gN/m^2/s F +1164 NPOOL_TO_FROOTN_STORAGE allocation to fine root N storage gN/m^2/s F +1165 NPOOL_TO_LIVESTEMN allocation to live stem N gN/m^2/s F +1166 NPOOL_TO_LIVESTEMN_STORAGE allocation to live stem N storage gN/m^2/s F +1167 NPOOL_TO_DEADSTEMN allocation to dead stem N gN/m^2/s F +1168 NPOOL_TO_DEADSTEMN_STORAGE allocation to dead stem N storage gN/m^2/s F +1169 NPOOL_TO_LIVECROOTN allocation to live coarse root N gN/m^2/s F +1170 NPOOL_TO_LIVECROOTN_STORAGE allocation to live coarse root N storage gN/m^2/s F +1171 NPOOL_TO_DEADCROOTN allocation to dead coarse root N gN/m^2/s F +1172 NPOOL_TO_DEADCROOTN_STORAGE allocation to dead coarse root N storage gN/m^2/s F +1173 LEAFN_STORAGE_TO_XFER leaf N shift storage to transfer gN/m^2/s F +1174 FROOTN_STORAGE_TO_XFER fine root N shift storage to transfer gN/m^2/s F +1175 LIVESTEMN_STORAGE_TO_XFER live stem N shift storage to transfer gN/m^2/s F +1176 DEADSTEMN_STORAGE_TO_XFER dead stem N shift storage to transfer gN/m^2/s F +1177 LIVECROOTN_STORAGE_TO_XFER live coarse root N shift storage to transfer gN/m^2/s F +1178 DEADCROOTN_STORAGE_TO_XFER dead coarse root N shift storage to transfer gN/m^2/s F +1179 LIVESTEMN_TO_DEADSTEMN live stem N turnover gN/m^2/s F +1180 LIVESTEMN_TO_RETRANSN live stem N to retranslocated N pool gN/m^2/s F +1181 LIVECROOTN_TO_DEADCROOTN live coarse root N turnover gN/m^2/s F +1182 LIVECROOTN_TO_RETRANSN live coarse root N to retranslocated N pool gN/m^2/s F +1183 NDEPLOY total N deployed in new growth gN/m^2/s T +1184 WOOD_HARVESTN wood harvest N (to product pools) gN/m^2/s T +1185 PFT_FIRE_NLOSS total patch-level fire N loss gN/m^2/s T +1186 NFERTILIZATION fertilizer added gN/m^2/s T +1187 FERT_COUNTER time left to fertilize seconds F +1188 M_LITR1N_TO_FIRE litter 1 N fire loss gN/m^2 F +1189 M_LITR1N_TO_FIRE_vr litter 1 N fire loss gN/m^3 F +1190 M_LITR2N_TO_FIRE litter 2 N fire loss gN/m^2 F +1191 M_LITR2N_TO_FIRE_vr litter 2 N fire loss gN/m^3 F +1192 M_LITR3N_TO_FIRE litter 3 N fire loss gN/m^2 F +1193 M_LITR3N_TO_FIRE_vr litter 3 N fire loss gN/m^3 F +1194 M_CWDN_TO_FIRE coarse woody debris N fire loss gN/m^2 F +1195 M_CWDN_TO_FIRE_vr coarse woody debris N fire loss gN/m^3 F +1196 COL_FIRE_NLOSS total column-level fire N loss gN/m^2/s T +1197 DWT_SEEDN_TO_LEAF seed source to patch-level leaf gN/m^2/s T +1198 DWT_SEEDN_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gN/m^2/s F +1199 DWT_SEEDN_TO_DEADSTEM seed source to patch-level deadstem gN/m^2/s T +1200 DWT_SEEDN_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gN/m^2/s F +1201 DWT_CONV_NFLUX conversion N flux (immediate loss to atm) (0 at all times except first timestep of year) gN/m^2/s T +1202 DWT_CONV_NFLUX_PATCH patch-level conversion N flux (immediate loss to atm) (0 at all times except first timestep of gN/m^2/s F +1203 DWT_FROOTN_TO_LITR_MET_N fine root to litter due to landcover change gN/m^2/s F +1204 DWT_FROOTN_TO_LITR_CEL_N fine root to litter due to landcover change gN/m^2/s F +1205 DWT_FROOTN_TO_LITR_LIG_N fine root to litter due to landcover change gN/m^2/s F +1206 DWT_LIVECROOTN_TO_CWDN live coarse root to CWD due to landcover change gN/m^2/s F +1207 DWT_DEADCROOTN_TO_CWDN dead coarse root to CWD due to landcover change gN/m^2/s F +1208 CROP_SEEDN_TO_LEAF crop seed source to leaf gN/m^2/s F +1209 PLANT_NDEMAND N flux required to support initial GPP gN/m^2/s T +1210 AVAIL_RETRANSN N flux available from retranslocation pool gN/m^2/s F +1211 PLANT_NALLOC total allocated N flux gN/m^2/s F +1212 NACTIVE Mycorrhizal N uptake flux gN/m^2/s T +1213 NNONMYC Non-mycorrhizal N uptake flux gN/m^2/s T +1214 NAM AM-associated N uptake flux gN/m^2/s T +1215 NECM ECM-associated N uptake flux gN/m^2/s T +1216 NACTIVE_NO3 Mycorrhizal N uptake flux gN/m^2/s T +1217 NACTIVE_NH4 Mycorrhizal N uptake flux gN/m^2/s T +1218 NNONMYC_NO3 Non-mycorrhizal N uptake flux gN/m^2/s T +1219 NNONMYC_NH4 Non-mycorrhizal N uptake flux gN/m^2/s T +1220 NAM_NO3 AM-associated N uptake flux gN/m^2/s T +1221 NAM_NH4 AM-associated N uptake flux gN/m^2/s T +1222 NECM_NO3 ECM-associated N uptake flux gN/m^2/s T +1223 NECM_NH4 ECM-associated N uptake flux gN/m^2/s T +1224 NPASSIVE Passive N uptake flux gN/m^2/s T +1225 NFIX Symbiotic BNF uptake flux gN/m^2/s T +1226 NRETRANS Retranslocated N uptake flux gN/m^2/s T +1227 NRETRANS_REG Retranslocated N uptake flux gN/m^2/s T +1228 NRETRANS_SEASON Retranslocated N uptake flux gN/m^2/s T +1229 NRETRANS_STRESS Retranslocated N uptake flux gN/m^2/s T +1230 NUPTAKE Total N uptake of FUN gN/m^2/s T +1231 SMINN_TO_PLANT_FUN Total soil N uptake of FUN gN/m^2/s T +1232 COST_NFIX Cost of fixation gN/gC T +1233 COST_NACTIVE Cost of active uptake gN/gC T +1234 COST_NRETRANS Cost of retranslocation gN/gC T +1235 NUPTAKE_NPP_FRACTION frac of NPP used in N uptake - T +1236 CROPPROD1C 1-yr crop product (grain+biofuel) C gC/m^2 T +1237 PROD10C 10-yr wood product C gC/m^2 F +1238 PROD100C 100-yr wood product C gC/m^2 F +1239 TOT_WOODPRODC total wood product C gC/m^2 T +1240 DWT_PROD10C_GAIN landcover change-driven addition to 10-yr wood product pool gC/m^2/s F +1241 DWT_PROD100C_GAIN landcover change-driven addition to 100-yr wood product pool gC/m^2/s F +1242 DWT_WOODPRODC_GAIN landcover change-driven addition to wood product pools gC/m^2/s T +1243 DWT_CROPPROD1C_GAIN landcover change-driven addition to 1-year crop product pool gC/m^2/s T +1244 CROPPROD1C_LOSS loss from 1-yr crop product pool gC/m^2/s T +1245 PROD10C_LOSS loss from 10-yr wood product pool gC/m^2/s F +1246 PROD100C_LOSS loss from 100-yr wood product pool gC/m^2/s F +1247 TOT_WOODPRODC_LOSS total loss from wood product pools gC/m^2/s T +1248 CROPPROD1N 1-yr crop product (grain+biofuel) N gN/m^2 T +1249 PROD10N 10-yr wood product N gN/m^2 F +1250 PROD100N 100-yr wood product N gN/m^2 F +1251 TOT_WOODPRODN total wood product N gN/m^2 T +1252 DWT_PROD10N_GAIN landcover change-driven addition to 10-yr wood product pool gN/m^2/s F +1253 DWT_PROD100N_GAIN landcover change-driven addition to 100-yr wood product pool gN/m^2/s F +1254 DWT_WOODPRODN_GAIN landcover change-driven addition to wood product pools gN/m^2/s T +1255 DWT_CROPPROD1N_GAIN landcover change-driven addition to 1-year crop product pool gN/m^2/s T +1256 CROPPROD1N_LOSS loss from 1-yr crop product pool gN/m^2/s T +1257 PROD10N_LOSS loss from 10-yr wood product pool gN/m^2/s F +1258 PROD100N_LOSS loss from 100-yr wood product pool gN/m^2/s F +1259 TOT_WOODPRODN_LOSS total loss from wood product pools gN/m^2/s T +1260 FERTNITRO Nitrogen fertilizer for each crop gN/m2/yr F +1261 GDDPLANT Accumulated growing degree days past planting date for crop ddays F +1262 GDDTSOI Growing degree-days from planting (top two soil layers) ddays F +1263 CPHASE crop phenology phase 0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest T +1264 LATBASET latitude vary base temperature for gddplant degree C F +==== =================================== ============================================================================================== ================================================================= ======= diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 10d101c0e7..68b741e3fc 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -308,15 +308,12 @@ subroutine hist_printflds() ! !ARGUMENTS: ! ! !LOCAL VARIABLES: - integer nf, i ! do-loop counters + integer, parameter :: ncol = 5 ! number of table columns + integer nf, i, j ! do-loop counters integer master_list_file ! file unit number - integer width_col_1 ! widths of table columns 1... - integer width_col_2 ! ...2 - integer width_col_3 ! ...3 - integer width_col_4 ! ...and 4 + integer width_col(ncol) ! widths of table columns integer width_col_sum ! widths of columns summed, including spaces - character(len=3) str_w_col_1 ! string versions of width_col_1 through 4 - character(len=3) str_w_col_2, str_w_col_3, str_w_col_4 + character(len=3) str_width_col(ncol) ! string version of width_col character(len=3) str_w_col_sum ! string version of width_col_sum character(len=99) fmt_txt ! format statement character(len=*),parameter :: subname = 'CLM_hist_printflds' @@ -339,22 +336,21 @@ subroutine hist_printflds() if (masterproc .and. hist_master_list_file) then ! Hardwired table column widths to fit the table on a computer ! screen. Some strings will be truncated as a result of the - ! current choices (4, 39, 94, 65). In sphinx (ie the web-based + ! current choices (4, 35, 94, 65, 7). In sphinx (ie the web-based ! documentation), text that has not been truncated will wrap ! around in the available space. - width_col_1 = 4 ! column that shows the variable number, nf - width_col_2 = 39 ! variable name column - width_col_3 = 94 ! long description column - width_col_4 = 65 ! units column - width_col_sum = width_col_1 + width_col_2 + & ! sum of widths plus - width_col_3 + width_col_4 + 3 ! ...3 blank spaces + width_col(1) = 4 ! column that shows the variable number, nf + width_col(2) = 35 ! variable name column + width_col(3) = 94 ! long description column + width_col(4) = 65 ! units column + width_col(5) = 7 ! active (T or F) column + width_col_sum = sum(width_col) + ncol - 1 ! sum of widths & blank spaces ! Convert integer widths to strings for use in format statements ! These write statements are not outputting to files - write(str_w_col_1,'(i0)') width_col_1 - write(str_w_col_2,'(i0)') width_col_2 - write(str_w_col_3,'(i0)') width_col_3 - write(str_w_col_4,'(i0)') width_col_4 + do i = 1, ncol + write(str_width_col(i),'(i0)') width_col(i) + end do write(str_w_col_sum,'(i0)') width_col_sum ! Open master_list_file @@ -371,48 +367,50 @@ subroutine hist_printflds() ! Table header ! Concatenate strings needed in format statement - fmt_txt = '('//str_w_col_1//'a,x,'//str_w_col_2//'a,x,'//str_w_col_3//'a,x,'//str_w_col_4//'a)' - write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & - ('=', i=1, width_col_2), & - ('=', i=1, width_col_3), & - ('=', i=1, width_col_4) - ! Table's title - write(master_list_file,*) 'CTSM History Fields' + do i = 1, ncol + fmt_txt = '('//str_width_col(i)//'a,x)' + write(master_list_file,fmt_txt,advance='no') ('=', j=1,width_col(i)) + end do + write(master_list_file,*) ! next write statement will now appear in new line + + ! Table title + fmt_txt = '(a)' + write(master_list_file,fmt_txt) 'CTSM History Fields' ! Sub-header ! Concatenate strings needed in format statement fmt_txt = '('//str_w_col_sum//'a)' write(master_list_file,fmt_txt) ('-', i=1, width_col_sum) ! Concatenate strings needed in format statement - fmt_txt = '('//'a'//str_w_col_1//',x,a'//str_w_col_2//',x,a'//str_w_col_3//',x,a'//str_w_col_4//')' + fmt_txt = '(a'//str_width_col(1)//',x,a'//str_width_col(2)//',x,a'//str_width_col(3)//',x,a'//str_width_col(4)//',x,a'//str_width_col(5)//')' write(master_list_file,fmt_txt) '#', 'Variable Name', & - 'Long Description', 'Units' + 'Long Description', 'Units', 'Active?' ! End header, same as header ! Concatenate strings needed in format statement - fmt_txt = '('//str_w_col_1//'a,x,'//str_w_col_2//'a,x,'//str_w_col_3//'a,x,'//str_w_col_4//'a)' - write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & - ('=', i=1, width_col_2), & - ('=', i=1, width_col_3), & - ('=', i=1, width_col_4) + do i = 1, ncol + fmt_txt = '('//str_width_col(i)//'a,x)' + write(master_list_file,fmt_txt,advance='no') ('=', j=1,width_col(i)) + end do + write(master_list_file,*) ! next write statement will now appear in new line ! Main table ! Concatenate strings needed in format statement - fmt_txt = '('//'i'//str_w_col_1//',x,a'//str_w_col_2//',x,a'//str_w_col_3//',x,a'//str_w_col_4//')' + fmt_txt = '(i'//str_width_col(1)//',x,a'//str_width_col(2)//',x,a'//str_width_col(3)//',x,a'//str_width_col(4)//',l'//str_width_col(5)//')' do nf = 1,nfmaster write(master_list_file,fmt_txt) nf, & masterlist(nf)%field%name, & masterlist(nf)%field%long_name, & - masterlist(nf)%field%units + masterlist(nf)%field%units, & + masterlist(nf)%actflag(1) end do ! Table footer, same as header ! Concatenate strings needed in format statement - fmt_txt = '('//str_w_col_1//'a,x,'//str_w_col_2//'a,x,'//str_w_col_3//'a,x,'//str_w_col_4//'a)' - write(master_list_file,fmt_txt) ('=', i=1, width_col_1), & - ('=', i=1, width_col_2), & - ('=', i=1, width_col_3), & - ('=', i=1, width_col_4) + do i = 1, ncol + fmt_txt = '('//str_width_col(i)//'a,x)' + write(master_list_file,fmt_txt,advance='no') ('=', j=1,width_col(i)) + end do call shr_sys_flush(master_list_file) close(unit = master_list_file) From 9a8703408b5a50c3f9696023ae4a220284af0b0e Mon Sep 17 00:00:00 2001 From: olyson Date: Tue, 24 Nov 2020 11:40:05 -0700 Subject: [PATCH 1654/1973] Update troubleshooting chapter in User's Guide for point_of_interest code. --- .../trouble-shooting/trouble-shooting.rst | 111 +++++++++++++++--- 1 file changed, 94 insertions(+), 17 deletions(-) diff --git a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst index 9af807041f..1b0a1191dd 100644 --- a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst +++ b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst @@ -6,44 +6,121 @@ Trouble Shooting ********************* -In this chapter we give some guidance on what to do when you encounter some of the most common problems. We can't cover all the problems that a user could potentially have, but we will try to help you recognize some of the most common situations. And we'll give you some suggestions on how to approach the problem to come up with a solution. +In this chapter we give some guidance on what to do when you encounter some of the most common problems. -In general you will run into one of three type of problems: +In general you may run into one of four types of problems: 1. *case-creation* #. *setup-time* #. *build-time* #. *run-time* -See the `CIME Trouble Shooting Guide `_ for some help on the first three. - +Start with the `CIME Trouble Shooting Guide `_ , especially if you encounter one of the first three types of problems. The CIME troubleshooting guide also provides some useful tips regarding run-time errors. If this doesn't identify and solve your problem, then try some of the suggestions below for run-time errors. General Advice on Debugging Run time Problems ============================================= -Here are some suggestions on how to track down a problem while running. In general if the problem still occurs for a simpler case, it will be easier to track down. +The model has been run for thousands and thousands of simulation years in many different configurations, both fully-coupled and in land-only modes, without problems. If you have modified the model in any way, by using either different input datasets or new or modified code, then obviously that is the first place to look if you encounter an error. However, the model is not completely infallible, as noted below. -1. *Run in DEBUG mode* -#. *Run with a smaller set of processors* -#. *Run in serial mode with a single processor* -#. *Run at a lower resolution* -#. *Run a simpler case* -#. *Run with a debugger* +It is important to examine all of the component log files in the run directory for errors. An error in the land model may not appear in the lnd log file, it may show up in the cesm log. In a land-only simulation, errors associated with the data atmosphere model may show up in the atm log or the cesm log, or both. The two logs together may contain useful information about the error. Frequently, the error output in the log files will include a **traceback** of code where the error occurred. Identifying the specific line of code where the error occurred is the first step in diagnosing the error and developing a solution. If a traceback doesn't appear in the log files, then try running in debug mode as noted in the CIME troubleshooting guide. An example of a traceback in the cesm log is given below +:: + +> 398: ERROR: Carbon or Nitrogen patch negative = -60.0630620423182 +> 398: -1.49270707132601 +> 398: ERROR: limits = -60.0000000000000 -6.00000000000000 +> 398: ENDRUN: +> 398: ERROR: +> 398: ERROR: carbon or nitrogen state critically negative ERROR in CNPrecisionControl +> 398: Mod.F90 at line 209 +> 398:Image PC Routine Line Source +> 398:cesm.exe 000000000383B3EA Unknown Unknown Unknown +> 398:cesm.exe 0000000002F1E5D0 shr_abort_mod_mp_ 114 shr_abort_mod.F90 +> 398:cesm.exe 0000000001AF22BF abortutils_mp_end 50 abortutils.F90 +> 398:cesm.exe 0000000001D02677 cnprecisioncontro 693 CNPrecisionControlMod.F90 +> 398:cesm.exe 0000000001CFCC58 cnprecisioncontro 207 CNPrecisionControlMod.F90 +> 398:cesm.exe 00000000021FB4F5 cndrivermod_mp_cn 575 CNDriverMod.F90 +> 398:cesm.exe 0000000001D0F5C7 cnvegetationfacad 866 CNVegetationFacade.F90 +> 398:cesm.exe 0000000001AFEC96 clm_driver_mp_clm 925 clm_driver.F90 +> 398:cesm.exe 0000000001AE744B lnd_comp_mct_mp_l 458 lnd_comp_mct.F90 +> 398:cesm.exe 0000000000429414 component_mod_mp_ 737 component_mod.F90 +> 398:cesm.exe 000000000040AE4B cime_comp_mod_mp_ 2622 cime_comp_mod.F90 +> 398:cesm.exe 000000000042904C MAIN__ 133 cime_driver.F90 +> 398:cesm.exe 0000000000408D22 Unknown Unknown Unknown +> 398:libc.so.6 00002B8B95D306E5 __libc_start_main Unknown Unknown +> 398:cesm.exe 0000000000408C29 Unknown Unknown Unknown + +Here, the output is identifying the sequence of fortran statements involved in the error, starting with line 133 in cime_driver.F90 and ending with line 114 in shr_abort_mod.F90. In this case the run is triggering an error check in the model related to negative carbon/nitrogen at line 693 of CNPrecisionControlMod.F90. In addition, there is additional information related to the error indicating the carbon or nitrogen state is critically negative at line 209 in CNPrecisionControlMod.F90, which is +:: + +> call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & +> ns%leafn_patch(bounds%begp:bounds%endp), & +> pc(bounds%begp:), pn(bounds%begp:), __LINE__, & +> num_truncatep, filter_truncatep) + +So here we know that it is either leaf nitrogen (leafn) or leaf carbon (leafc) that has triggered the error. Furthermore, from the information above and looking at the code, we see that it is leaf carbon that is triggering the error, as the value is -60.0630620423182 and the limit is -60. + +At this point it is useful as a next step to identify the particular pft index and perhaps the pft type that is triggering the error. This can be done by inserting the following code before the **endrun** that is called in CNPrecisionControlMod.F90 at line 693. +:: + +> if (abs(carbon_patch(p)) < ccrit) then +> write(iulog,*)'p: ',p +> write(iulog,*)'itype(p): ',patch%itype(p) +> end if + +The pft index and the pft type will appear in either the cesm or lnd log file. In this case, the pft index is 163723 and the pft type is 10. From there, one can use this pft index to write out variables that are used in updating leafc, for example, leafc is updated a number of times in CNCStateUpdate1Mod.F90. +:: -Run in DEBUG mode ------------------ +> if (p .eq. 163723) then +> write(iulog,*)'CNCStateUpdate1Mod leafc: ',cs_veg%leafc_patch(p) +> write(iulog,*)'CNCStateUpdate1Mod +leafc_xfer_to_leafc: ',cf_veg%leafc_xfer_to_leafc_patch(p)*dt +> end if -The first thing to try is to run in DEBUG mode so that float point trapping will be triggered as well as array bounds checking and other things the compiler can turn on to help you find problems. -To do this edit the ``env_build.xml`` file and set DEBUG to TRUE as follows: +By placing these write statements in the code, one can get a sense of how leafc is evolving toward a negative state and why. +This is a very complex example of troubleshooting. To make a long story short, as described `here `_, the error turned out to be caused by a few lines in the phenology code that weren't handling a 20 minute time step properly, thus an actual bug in the code. This was also a good example of where a much less computationally expensive land-only simulation was able to be used for debugging instead of the orginal expensive fully-coupled simulation. + +Another method of troubleshooting is to use the **point_of_interest** module. + +Use the point_of_interest module +-------------------------------- + +It is common, when debugging, to want to print the values of various variables for all patches or columns of certain landunit types within a certain grid cell of interest. For example, one might be able to identify a certain grid cell with an erroneous value for a particular history field variable (e.g., GPP) using for example ncview. Once the latitude and longitude of this grid cell has been determined, the point_of_interest module (**src/utils/point_of_interest.F90**) helps create the logical functions needed to do this. +This module is compiled into every CTSM build, but is not invoked by default. +To use it + +(1) Enter in the latitude/longitude of the point of interest in the function **at_poi** in **point_of_interest.F90** by setting the variables **poi_lat** and **poi_lon**. + +(2) You may customize the **point_of_interest.F90** code by changing the example function (**poi_c**) and/or adding new functions. Look for comments about "Customize" to see what to customize. + +(3) Add calls to these functions in the CTSM code + +The example function in **point_of_interest.F90** is **poi_c**. It finds columns with a given landunit type (in this case, the natural vegetated landunit). That function can be used in a column-level loop to find columns with that landunit within the grid cell of interest. Its typical use in CTSM code is +:: + + > do fc = 1, num_nolakec + > c = filter_nolakec(fc) + > ! Various code here, maybe setting foo and bar variables + > if (poi_c(c)) then + > write(iulog,*) 'DEBUG: foo, bar = ', foo(c), bar(c) + > end if + > end do + +You will also need a **use** statement in the module from which you are calling poi_c :: - > ./xmlchange DEBUG=TRUE +> use point_of_interest, only : poi_c +Here are some other suggestions on how to track down a problem encountered while running. These involve setting up and running simpler cases. In general if the problem still occurs for a simpler case, it will be easier to track down. However, we note that most errors are specific to the case being run. + +#. *Run with a smaller set of processors* +#. *Run in serial mode with a single processor* +#. *Run at a lower resolution* +#. *Run a simpler case* +#. *Run with a debugger* Run with a smaller set of processors ------------------------------------ -Another way to simplify the system is to run with a smaller set of processors. You will need to clean the setup and edit the --env_mach_pes.xml--. For example, to run with four processors: +One way to simplify the system is to run with a smaller set of processors. You will need to clean the setup and edit the --env_mach_pes.xml--. For example, to run with four processors: :: > ./case.setup -clean From b14a3abcab2eabb167d9b32edf87e982f7137ae2 Mon Sep 17 00:00:00 2001 From: olyson Date: Tue, 24 Nov 2020 12:40:31 -0700 Subject: [PATCH 1655/1973] Edit per Bill Sacks --- doc/source/users_guide/trouble-shooting/trouble-shooting.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst index 1b0a1191dd..cdc8f8dc62 100644 --- a/doc/source/users_guide/trouble-shooting/trouble-shooting.rst +++ b/doc/source/users_guide/trouble-shooting/trouble-shooting.rst @@ -20,7 +20,7 @@ Start with the `CIME Trouble Shooting Guide Date: Wed, 25 Nov 2020 11:54:41 -0700 Subject: [PATCH 1656/1973] Sort history fields master table alphabetically Moved the sorting do loops from subr. htapes_fieldlist to their own new subroutine sort_hist_list for use by two calls: One from subr. htapes_fieldlist and one from subr. hist_printflds. To accomplish this, I changed masterlist(max_flds) from a master_entry to a history_entry entity. --- src/main/histFileMod.F90 | 180 +++++++++++++++++++++------------------ 1 file changed, 99 insertions(+), 81 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 68b741e3fc..56de744a2a 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -209,15 +209,10 @@ module histFileMod integer :: no_snow_behavior ! for multi-layer snow fields, flag saying how to treat times when a given snow layer is absent end type field_info - type master_entry - type (field_info) :: field ! field information - logical :: actflag(max_tapes) ! active/inactive flag - character(len=avgflag_strlen) :: avgflag(max_tapes) ! time averaging flag ("X","A","M","I","SUM") - end type master_entry - type history_entry type (field_info) :: field ! field information - character(len=avgflag_strlen) :: avgflag ! time averaging flag + logical :: actflag ! active/inactive flag + character(len=avgflag_strlen) :: avgflag ! time averaging flag ("X","A","M","I","SUM") real(r8), pointer :: hbuf(:,:) ! history buffer (dimensions: dim1d x num2d) integer , pointer :: nacs(:,:) ! accumulation counter (dimensions: dim1d x num2d) end type history_entry @@ -232,6 +227,7 @@ module histFileMod logical :: is_endhist ! true => current time step is end of history interval real(r8) :: begtime ! time at beginning of history averaging interval type (history_entry) :: hlist(max_flds) ! array of active history tape entries + type (history_entry) :: masterlist(max_flds) ! master field list end type history_tape type clmpoint_rs ! Pointer to real scalar data (1D) @@ -246,10 +242,6 @@ module histFileMod type (clmpoint_rs) :: clmptr_rs(max_mapflds) ! Real scalar data (1D) type (clmpoint_ra) :: clmptr_ra(max_mapflds) ! Real array data (2D) ! - ! Master list: an array of master_entry entities - ! - type (master_entry) :: masterlist(max_flds) ! master field list - ! ! Whether each history tape is in use in this run. If history_tape_in_use(i) is false, ! then data in tape(i) is undefined and should not be referenced. ! @@ -323,7 +315,7 @@ subroutine hist_printflds() write(iulog,*) trim(subname),' : number of master fields = ',nfmaster write(iulog,*)' ******* MASTER FIELD LIST *******' do nf = 1,nfmaster - write(iulog,9000)nf, masterlist(nf)%field%name, masterlist(nf)%field%units + write(iulog,9000)nf, tape(1)%masterlist(nf)%field%name, tape(1)%masterlist(nf)%field%units 9000 format (i5,1x,a32,1x,a16) end do call shr_sys_flush(iulog) @@ -333,6 +325,10 @@ subroutine hist_printflds() ! variable requests it. Text file is formatted in the .rst ! (reStructuredText) format for easy introduction of the file to ! the CTSM's web-based documentation. + + ! First sort the list to be in alphabetical order + call sort_hist_list(1, nfmaster, tape(1)%masterlist) + if (masterproc .and. hist_master_list_file) then ! Hardwired table column widths to fit the table on a computer ! screen. Some strings will be truncated as a result of the @@ -399,10 +395,10 @@ subroutine hist_printflds() fmt_txt = '(i'//str_width_col(1)//',x,a'//str_width_col(2)//',x,a'//str_width_col(3)//',x,a'//str_width_col(4)//',l'//str_width_col(5)//')' do nf = 1,nfmaster write(master_list_file,fmt_txt) nf, & - masterlist(nf)%field%name, & - masterlist(nf)%field%long_name, & - masterlist(nf)%field%units, & - masterlist(nf)%actflag(1) + tape(1)%masterlist(nf)%field%name, & + tape(1)%masterlist(nf)%field%long_name, & + tape(1)%masterlist(nf)%field%units, & + tape(1)%masterlist(nf)%actflag end do ! Table footer, same as header @@ -488,7 +484,7 @@ subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & ! Ensure that new field doesn't already exist do n = 1,nfmaster - if (masterlist(n)%field%name == fname) then + if (tape(1)%masterlist(n)%field%name == fname) then write(iulog,*) trim(subname),' ERROR:', fname, ' already on list' call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -509,49 +505,49 @@ subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & ! Add field to master list - masterlist(f)%field%name = fname - masterlist(f)%field%long_name = long_name - masterlist(f)%field%units = units - masterlist(f)%field%type1d = type1d - masterlist(f)%field%type1d_out = type1d_out - masterlist(f)%field%type2d = type2d - masterlist(f)%field%numdims = numdims - masterlist(f)%field%num2d = num2d - masterlist(f)%field%hpindex = hpindex - masterlist(f)%field%p2c_scale_type = p2c_scale_type - masterlist(f)%field%c2l_scale_type = c2l_scale_type - masterlist(f)%field%l2g_scale_type = l2g_scale_type + tape(1)%masterlist(f)%field%name = fname + tape(1)%masterlist(f)%field%long_name = long_name + tape(1)%masterlist(f)%field%units = units + tape(1)%masterlist(f)%field%type1d = type1d + tape(1)%masterlist(f)%field%type1d_out = type1d_out + tape(1)%masterlist(f)%field%type2d = type2d + tape(1)%masterlist(f)%field%numdims = numdims + tape(1)%masterlist(f)%field%num2d = num2d + tape(1)%masterlist(f)%field%hpindex = hpindex + tape(1)%masterlist(f)%field%p2c_scale_type = p2c_scale_type + tape(1)%masterlist(f)%field%c2l_scale_type = c2l_scale_type + tape(1)%masterlist(f)%field%l2g_scale_type = l2g_scale_type select case (type1d) case (grlnd) - masterlist(f)%field%beg1d = bounds%begg - masterlist(f)%field%end1d = bounds%endg - masterlist(f)%field%num1d = numg + tape(1)%masterlist(f)%field%beg1d = bounds%begg + tape(1)%masterlist(f)%field%end1d = bounds%endg + tape(1)%masterlist(f)%field%num1d = numg case (nameg) - masterlist(f)%field%beg1d = bounds%begg - masterlist(f)%field%end1d = bounds%endg - masterlist(f)%field%num1d = numg + tape(1)%masterlist(f)%field%beg1d = bounds%begg + tape(1)%masterlist(f)%field%end1d = bounds%endg + tape(1)%masterlist(f)%field%num1d = numg case (namel) - masterlist(f)%field%beg1d = bounds%begl - masterlist(f)%field%end1d = bounds%endl - masterlist(f)%field%num1d = numl + tape(1)%masterlist(f)%field%beg1d = bounds%begl + tape(1)%masterlist(f)%field%end1d = bounds%endl + tape(1)%masterlist(f)%field%num1d = numl case (namec) - masterlist(f)%field%beg1d = bounds%begc - masterlist(f)%field%end1d = bounds%endc - masterlist(f)%field%num1d = numc + tape(1)%masterlist(f)%field%beg1d = bounds%begc + tape(1)%masterlist(f)%field%end1d = bounds%endc + tape(1)%masterlist(f)%field%num1d = numc case (namep) - masterlist(f)%field%beg1d = bounds%begp - masterlist(f)%field%end1d = bounds%endp - masterlist(f)%field%num1d = nump + tape(1)%masterlist(f)%field%beg1d = bounds%begp + tape(1)%masterlist(f)%field%end1d = bounds%endp + tape(1)%masterlist(f)%field%num1d = nump case default write(iulog,*) trim(subname),' ERROR: unknown 1d output type= ',type1d call endrun(msg=errMsg(sourcefile, __LINE__)) end select if (present(no_snow_behavior)) then - masterlist(f)%field%no_snow_behavior = no_snow_behavior + tape(1)%masterlist(f)%field%no_snow_behavior = no_snow_behavior else - masterlist(f)%field%no_snow_behavior = no_snow_unset + tape(1)%masterlist(f)%field%no_snow_behavior = no_snow_unset end if ! The following two fields are used only in master field list, @@ -559,8 +555,8 @@ subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & ! ALL FIELDS IN THE MASTER LIST ARE INITIALIZED WITH THE ACTIVE ! FLAG SET TO FALSE - masterlist(f)%avgflag(:) = avgflag - masterlist(f)%actflag(:) = .false. + tape(:)%masterlist(f)%avgflag = avgflag + tape(:)%masterlist(f)%actflag = .false. end subroutine masterlist_addfld @@ -683,10 +679,10 @@ subroutine masterlist_make_active (name, tape_index, avgflag) found = .false. do f = 1,nfmaster - if (trim(name) == trim(masterlist(f)%field%name)) then - masterlist(f)%actflag(tape_index) = .true. + if (trim(name) == trim(tape(1)%masterlist(f)%field%name)) then + tape(tape_index)%masterlist(f)%actflag = .true. if (present(avgflag)) then - if (avgflag/= ' ') masterlist(f)%avgflag(tape_index) = avgflag + if (avgflag/= ' ') tape(tape_index)%masterlist(f)%avgflag = avgflag end if found = .true. exit @@ -722,7 +718,7 @@ subroutine masterlist_change_timeavg (t) end if do f = 1,nfmaster - masterlist(f)%avgflag(t) = avgflag + tape(t)%masterlist(f)%avgflag = avgflag end do end subroutine masterlist_change_timeavg @@ -746,7 +742,6 @@ subroutine htapes_fieldlist() character(len=avgflag_strlen) :: avgflag ! averaging flag character(len=1) :: prec_acc ! history buffer precision flag character(len=1) :: prec_wrt ! history buffer write precision flag - type (history_entry) :: tmp ! temporary used for swapping character(len=*),parameter :: subname = 'htapes_fieldlist' !----------------------------------------------------------------------- @@ -789,7 +784,7 @@ subroutine htapes_fieldlist() do while (f < max_flds .and. fincl(f,t) /= ' ') name = getname (fincl(f,t)) do ff = 1,nfmaster - mastername = masterlist(ff)%field%name + mastername = tape(1)%masterlist(ff)%field%name if (name == mastername) exit end do if (name /= mastername) then @@ -803,7 +798,7 @@ subroutine htapes_fieldlist() f = 1 do while (f < max_flds .and. fexcl(f,t) /= ' ') do ff = 1,nfmaster - mastername = masterlist(ff)%field%name + mastername = tape(1)%masterlist(ff)%field%name if (fexcl(f,t) == mastername) exit end do if (fexcl(f,t) /= mastername) then @@ -827,7 +822,7 @@ subroutine htapes_fieldlist() ! or if it is on by default and was not excluded via namelist (FEXCL[1-max_tapes]). do f = 1,nfmaster - mastername = masterlist(f)%field%name + mastername = tape(1)%masterlist(f)%field%name call list_index (fincl(1,t), mastername, ff) if (ff > 0) then @@ -851,7 +846,7 @@ subroutine htapes_fieldlist() ! called below only if field is not in exclude list OR in ! include list - if (ff == 0 .and. masterlist(f)%actflag(t)) then + if (ff == 0 .and. tape(t)%masterlist(f)%actflag) then call htape_addfld (t, f, ' ') end if @@ -860,25 +855,10 @@ subroutine htapes_fieldlist() ! Specification of tape contents now complete. ! Sort each list of active entries - - do f = tape(t)%nflds-1,1,-1 - do ff = 1,f - if (tape(t)%hlist(ff)%field%name > tape(t)%hlist(ff+1)%field%name) then - - tmp = tape(t)%hlist(ff) - tape(t)%hlist(ff ) = tape(t)%hlist(ff+1) - tape(t)%hlist(ff+1) = tmp - - else if (tape(t)%hlist(ff)%field%name == tape(t)%hlist(ff+1)%field%name) then - - write(iulog,*) trim(subname),' ERROR: Duplicate field ', & - tape(t)%hlist(ff)%field%name, & - 't,ff,name=',t,ff,tape(t)%hlist(ff+1)%field%name - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end if - end do - end do + associate(n_fields => tape(t)%nflds, & + hist_list => tape(t)%hlist) + call sort_hist_list(t, n_fields, hist_list) + end associate if (masterproc) then if (tape(t)%nflds > 0) then @@ -956,6 +936,44 @@ subroutine htapes_fieldlist() end subroutine htapes_fieldlist + !----------------------------------------------------------------------- + subroutine sort_hist_list(t, n_fields, hist_list) + + ! !DESCRIPTION: + + ! !ARGUMENTS: + integer, intent(in) :: t ! tape index + integer, intent(in) :: n_fields ! number of fields + type (history_entry), intent(inout) :: hist_list(n_fields) ! array of history tape entries + + ! !LOCAL VARIABLES: + integer :: f, ff ! field indices + type (history_entry) :: tmp ! temporary used for swapping + + character(len=*), parameter :: subname = 'sort_hist_list' + !----------------------------------------------------------------------- + + do f = n_fields-1, 1, -1 + do ff = 1, f + if (hist_list(ff)%field%name > hist_list(ff+1)%field%name) then + + tmp = hist_list(ff) + hist_list(ff ) = hist_list(ff+1) + hist_list(ff+1) = tmp + + else if (hist_list(ff)%field%name == hist_list(ff+1)%field%name) then + + write(iulog,*) trim(subname),' ERROR: Duplicate field ', & + hist_list(ff)%field%name, & + 't,ff,name=',t,ff,hist_list(ff+1)%field%name + call endrun(msg=errMsg(sourcefile, __LINE__)) + + end if + end do + end do + + end subroutine sort_hist_list + !----------------------------------------------------------------------- logical function is_mapping_upto_subgrid( type1d, type1d_out ) result ( mapping) ! @@ -1024,7 +1042,7 @@ subroutine htape_addfld (t, f, avgflag) if (htapes_defined) then write(iulog,*) trim(subname),' ERROR: attempt to add field ', & - masterlist(f)%field%name, ' after history files are set' + tape(1)%masterlist(f)%field%name, ' after history files are set' call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -1033,7 +1051,7 @@ subroutine htape_addfld (t, f, avgflag) ! Copy field information - tape(t)%hlist(n)%field = masterlist(f)%field + tape(t)%hlist(n)%field = tape(1)%masterlist(f)%field ! Determine bounds @@ -1117,8 +1135,8 @@ subroutine htape_addfld (t, f, avgflag) tape(t)%hlist(n)%field%num1d_out = num1d_out ! Fields native bounds - beg1d = masterlist(f)%field%beg1d - end1d = masterlist(f)%field%end1d + beg1d = tape(1)%masterlist(f)%field%beg1d + end1d = tape(1)%masterlist(f)%field%end1d ! Alloccate and initialize history buffer and related info @@ -1142,7 +1160,7 @@ subroutine htape_addfld (t, f, avgflag) end if if (avgflag == ' ') then - tape(t)%hlist(n)%avgflag = masterlist(f)%avgflag(t) + tape(t)%hlist(n)%avgflag = tape(t)%masterlist(f)%avgflag else tape(t)%hlist(n)%avgflag = avgflag end if From e9873ad8264d10f3cd964628854ec413d88d5184 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 25 Nov 2020 12:15:49 -0700 Subject: [PATCH 1657/1973] Committing the alphabetically sorted master_list_file.rst --- .../master_list_file.rst | 2528 ++++++++--------- 1 file changed, 1264 insertions(+), 1264 deletions(-) diff --git a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst index d9dbafe972..610975876b 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/master_list_file.rst @@ -7,1268 +7,1268 @@ CTSM History Fields ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Variable Name Long Description Units Active? ==== =================================== ============================================================================================== ================================================================= ======= - 1 LEAFCN Leaf CN ratio used for flexible CN gC/gN T - 2 LEAFCN_STORAGE Storage Leaf CN ratio used for flexible CN gC/gN F - 3 DAYL daylength s F - 4 PREV_DAYL daylength from previous timestep s F - 5 SNO_Z Snow layer thicknesses m F - 6 SNO_Z_ICE Snow layer thicknesses (ice landunits only) m F - 7 ZII convective boundary height m F - 8 SWBGT 2 m Simplified Wetbulb Globe Temp C T - 9 SWBGT_U Urban 2 m Simplified Wetbulb Globe Temp C T - 10 SWBGT_R Rural 2 m Simplified Wetbulb Globe Temp C T - 11 HUMIDEX 2 m Humidex C T - 12 HUMIDEX_U Urban 2 m Humidex C T - 13 HUMIDEX_R Rural 2 m Humidex C T - 14 WBT 2 m Stull Wet Bulb C T - 15 WBT_U Urban 2 m Stull Wet Bulb C T - 16 WBT_R Rural 2 m Stull Wet Bulb C T - 17 HIA 2 m NWS Heat Index C T - 18 HIA_U Urban 2 m NWS Heat Index C T - 19 HIA_R Rural 2 m NWS Heat Index C T - 20 APPAR_TEMP 2 m apparent temperature C T - 21 APPAR_TEMP_U Urban 2 m apparent temperature C T - 22 APPAR_TEMP_R Rural 2 m apparent temperature C T - 23 WBA 2 m Wet Bulb C T - 24 WBA_U Urban 2 m Wet Bulb C T - 25 WBA_R Rural 2 m Wet Bulb C T - 26 TEQ 2 m Equiv Temp K T - 27 TEQ_U Urban 2 m Equiv Temp K T - 28 TEQ_R Rural 2 m Equiv Temp K T - 29 EPT 2 m Equiv Pot Temp K T - 30 EPT_U Urban 2 m Equiv Pot Temp K T - 31 EPT_R Rural 2 m Equiv Pot Temp K T - 32 DISCOI 2 m Discomfort Index C T - 33 DISCOI_U Urban 2 m Discomfort Index C T - 34 DISCOI_R Rural 2 m Discomfort Index C T - 35 THIP 2 m Temp Hum Index Physiology C T - 36 THIP_U Urban 2 m Temp Hum Index Physiology C T - 37 THIP_R Rural 2 m Temp Hum Index Physiology C T - 38 THIC 2 m Temp Hum Index Comfort C T - 39 THIC_U Urban 2 m Temp Hum Index Comfort C T - 40 THIC_R Rural 2 m Temp Hum Index Comfort C T - 41 SWMP65 2 m Swamp Cooler Temp 65% Eff C T - 42 SWMP65_U Urban 2 m Swamp Cooler Temp 65% Eff C T - 43 SWMP65_R Rural 2 m Swamp Cooler Temp 65% Eff C T - 44 SWMP80 2 m Swamp Cooler Temp 80% Eff C T - 45 SWMP80_U Urban 2 m Swamp Cooler Temp 80% Eff C T - 46 SWMP80_R Rural 2 m Swamp Cooler Temp 80% Eff C T - 47 DISCOIS 2 m Stull Discomfort Index C T - 48 DISCOIS_U Urban 2 m Stull Discomfort Index C T - 49 DISCOIS_R Rural 2 m Stull Discomfort Index C T - 50 TBUILD_MAX prescribed maximum interior building temperature K F - 51 WIND atmospheric wind velocity magnitude m/s T - 52 Wind atmospheric wind velocity magnitude m/s F - 53 ZBOT atmospheric reference height m T - 54 ATM_TOPO atmospheric surface height m T - 55 FSDS atmospheric incident solar radiation W/m^2 T - 56 PCO2 atmospheric partial pressure of CO2 Pa T - 57 SWdown atmospheric incident solar radiation W/m^2 F - 58 PCH4 atmospheric partial pressure of CH4 Pa T - 59 Tair_from_atm atmospheric air temperature received from atmosphere (pre-downscaling) K F - 60 TBOT atmospheric air temperature (downscaled to columns in glacier regions) K T - 61 Tair atmospheric air temperature (downscaled to columns in glacier regions) K F - 62 PBOT atmospheric pressure at surface (downscaled to columns in glacier regions) Pa T - 63 PSurf atmospheric pressure at surface (downscaled to columns in glacier regions) Pa F - 64 FLDS atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 T - 65 LWdown atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 F - 66 FLDS_ICE atmospheric longwave radiation (downscaled to columns in glacier regions) (ice landunits only) W/m^2 F - 67 THBOT atmospheric air potential temperature (downscaled to columns in glacier regions) K T - 68 FSI24 indirect radiation (last 24hrs) K F - 69 FSI240 indirect radiation (last 240hrs) K F - 70 FSD24 direct radiation (last 24hrs) K F - 71 FSD240 direct radiation (last 240hrs) K F - 72 PCO2_240 10 day running mean of CO2 pressure Pa F - 73 PO2_240 10 day running mean of O2 pressure Pa F - 74 PBOT_240 10 day running mean of air pressure Pa F - 75 FSH_TO_COUPLER sensible heat sent to coupler (includes corrections for land use change, rain/snow conversion W/m^2 T - 76 FSH_RUNOFF_ICE_TO_LIQ sensible heat flux generated from conversion of ice runoff to liquid W/m^2 T - 77 FCO2 CO2 flux to atmosphere (+ to atm) kgCO2/m2/s F - 78 Z0M_TO_COUPLER roughness length, momentum: gridcell average sent to coupler m F - 79 FCH4 Gridcell surface CH4 flux to atmosphere (+ to atm) kgC/m2/s T - 80 NEM Gridcell net adjustment to net carbon exchange passed to atm. for methane production gC/m2/s T - 81 ICE_MODEL_FRACTION Ice sheet model fractional coverage unitless F - 82 QICE_FORC qice forcing sent to GLC mm/s F - 83 TSRF_FORC surface temperature sent to GLC K F - 84 TOPO_FORC topograephic height sent to GLC m F - 85 TH2OSFC surface water temperature K T - 86 TG_U Urban ground temperature K F - 87 TLAKE lake temperature K T - 88 SNO_T Snow temperatures K F - 89 SNO_T_ICE Snow temperatures (ice landunits only) K F - 90 TSA 2m air temperature K T - 91 TSA_ICE 2m air temperature (ice landunits only) K F - 92 TSA_R Rural 2m air temperature K F - 93 TREFMNAV daily minimum of average 2-m temperature K T - 94 TREFMXAV daily maximum of average 2-m temperature K T - 95 TREFMNAV_R Rural daily minimum of average 2-m temperature K F - 96 TREFMXAV_R Rural daily maximum of average 2-m temperature K F - 97 TSA_U Urban 2m air temperature K F - 98 TREFMNAV_U Urban daily minimum of average 2-m temperature K F - 99 TREFMXAV_U Urban daily maximum of average 2-m temperature K F - 100 TV vegetation temperature K T - 101 TSKIN skin temperature K T - 102 TG ground temperature K T - 103 TG_ICE ground temperature (ice landunits only) K F - 104 TG_R Rural ground temperature K F - 105 TSOI soil temperature (natural vegetated and crop landunits only) K T - 106 TSOI_ICE soil temperature (ice landunits only) K T - 107 TSOI_10CM soil temperature in top 10cm of soil K T - 108 TSL temperature of near-surface soil layer (natural vegetated and crop landunits only) K T - 109 SNOTXMASS snow temperature times layer mass, layer sum; to get mass-weighted temperature, divide by (SNO K kg/m2 T - 110 SNOTXMASS_ICE snow temperature times layer mass, layer sum (ice landunits only); to get mass-weighted temper K kg/m2 F - 111 T10 10-day running mean of 2-m temperature K F - 112 A5TMIN 5-day running mean of min 2-m temperature K F - 113 A10TMIN 10-day running mean of min 2-m temperature K F - 114 TBUILD internal urban building air temperature K T - 115 TROOF_INNER roof inside surface temperature K F - 116 TSUNW_INNER sunwall inside surface temperature K F - 117 TSHDW_INNER shadewall inside surface temperature K F - 118 TFLOOR floor temperature K F - 119 HEAT_CONTENT1 initial gridcell total heat content J/m^2 T - 120 HEAT_CONTENT1_VEG initial gridcell total heat content - natural vegetated and crop landunits only J/m^2 F - 121 HEAT_CONTENT2 post land cover change total heat content J/m^2 F - 122 LIQUID_WATER_TEMP1 initial gridcell weighted average liquid water temperature K F - 123 SNOTTOPL snow temperature (top layer) K F - 124 SNOTTOPL_ICE snow temperature (top layer, ice landunits only) K F - 125 SNOdTdzL top snow layer temperature gradient (land) K/m F - 126 DT_VEG change in t_veg, last iteration K F - 127 EMV vegetation emissivity proportion F - 128 EMG ground emissivity proportion F - 129 BETA coefficient of convective velocity none F - 130 TV24 vegetation temperature (last 24hrs) K F - 131 TV240 vegetation temperature (last 240hrs) K F - 132 GDD0 Growing degree days base 0C from planting ddays F - 133 GDD8 Growing degree days base 8C from planting ddays F - 134 GDD10 Growing degree days base 10C from planting ddays F - 135 GDD020 Twenty year average of growing degree days base 0C from planting ddays F - 136 GDD820 Twenty year average of growing degree days base 8C from planting ddays F - 137 GDD1020 Twenty year average of growing degree days base 10C from planting ddays F - 138 TVEGD10 10 day running mean of patch daytime vegetation temperature Kelvin F - 139 TVEGN10 10 day running mean of patch night-time vegetation temperature Kelvin F - 140 ALT current active layer thickness m T - 141 ALTMAX maximum annual active layer thickness m T - 142 ALTMAX_LASTYEAR maximum prior year active layer thickness m F - 143 ELAI exposed one-sided leaf area index m^2/m^2 T - 144 ESAI exposed one-sided stem area index m^2/m^2 T - 145 TLAI total projected leaf area index m^2/m^2 T - 146 TSAI total projected stem area index m^2/m^2 T - 147 LAISUN sunlit projected leaf area index m^2/m^2 T - 148 LAISHA shaded projected leaf area index m^2/m^2 T - 149 FSUN sunlit fraction of canopy proportion F - 150 HTOP canopy top m T - 151 HBOT canopy bottom m F - 152 DISPLA displacement height m F - 153 Z0M momentum roughness length m F - 154 FSUN24 fraction sunlit (last 24hrs) K F - 155 FSUN240 fraction sunlit (last 240hrs) K F - 156 LAI240 240hr average of leaf area index m^2/m^2 F - 157 VEGWP vegetation water matric potential for sun/sha canopy,xyl,root segments mm T - 158 VEGWPLN vegetation water matric potential for sun/sha canopy,xyl,root at local noon mm T - 159 VEGWPPD predawn vegetation water matric potential for sun/sha canopy,xyl,root mm T - 160 SMP soil matric potential (natural vegetated and crop landunits only) mm T - 161 KROOT root conductance each soil layer 1/s F - 162 KSOIL soil conductance in each soil layer 1/s F - 163 bsw clap and hornberger B unitless F - 164 ROOTR effective fraction of roots in each soil layer (SMS method) proportion F - 165 SOILPSI soil water potential in each soil layer MPa F - 166 SNO_TK Thermal conductivity W/m-K F - 167 SNO_TK_ICE Thermal conductivity (ice landunits only) W/m-K F - 168 HK hydraulic conductivity (natural vegetated and crop landunits only) mm/s F - 169 SoilAlpha factor limiting ground evap unitless F - 170 SoilAlpha_U urban factor limiting ground evap unitless F - 171 watsat water saturated m^3/m^3 F - 172 EFF_POROSITY effective porosity = porosity - vol_ice proportion F - 173 watfc water field capacity m^3/m^3 F - 174 SOILRESIS soil resistance to evaporation s/m T - 175 DSL dry surface layer thickness mm T - 176 SNO_LIQH2O Snow liquid water content kg/m2 F - 177 SNO_ICE Snow ice content kg/m2 F - 178 H2OSOI volumetric soil water (natural vegetated and crop landunits only) mm3/mm3 T - 179 SOILLIQ soil liquid water (natural vegetated and crop landunits only) kg/m2 T - 180 SOILICE soil ice (natural vegetated and crop landunits only) kg/m2 T - 181 SNOCAN intercepted snow mm T - 182 LIQCAN intercepted liquid water mm T - 183 H2OSFC surface water depth mm T - 184 WA water in the unconfined aquifer (natural vegetated and crop landunits only) mm T - 185 INT_SNOW accumulated swe (natural vegetated and crop landunits only) mm F - 186 INT_SNOW_ICE accumulated swe (ice landunits only) mm F - 187 SNOW_PERSISTENCE Length of time of continuous snow cover (nat. veg. landunits only) seconds T - 188 H2OCAN intercepted water mm T - 189 SOILWATER_10CM soil liquid water + ice in top 10cm of soil (veg landunits only) kg/m2 T - 190 TWS total water storage mm T - 191 Q2M 2m specific humidity kg/kg T - 192 SNOWLIQ snow liquid water kg/m2 T - 193 SNOWLIQ_ICE snow liquid water (ice landunits only) kg/m2 F - 194 SNOWICE snow ice kg/m2 T - 195 SNOWICE_ICE snow ice (ice landunits only) kg/m2 F - 196 H2OSNO snow depth (liquid water) mm T - 197 H2OSNO_ICE snow depth (liquid water, ice landunits only) mm F - 198 TOTSOILLIQ vertically summed soil liquid water (veg landunits only) kg/m2 T - 199 TOTSOILICE vertically summed soil cie (veg landunits only) kg/m2 T - 200 RH2M 2m relative humidity % T - 201 RH2M_R Rural 2m specific humidity % F - 202 RH2M_U Urban 2m relative humidity % F - 203 RHAF fractional humidity of canopy air fraction F - 204 RHAF10 10 day running mean of fractional humidity of canopy air fraction F - 205 FH2OSFC fraction of ground covered by surface water unitless T - 206 FH2OSFC_NOSNOW fraction of ground covered by surface water (if no snow present) unitless F - 207 FSNO fraction of ground covered by snow unitless T - 208 FSNO_ICE fraction of ground covered by snow (ice landunits only) unitless F - 209 FSNO_EFF effective fraction of ground covered by snow unitless T - 210 FWET fraction of canopy that is wet proportion F - 211 FCANSNO fraction of canopy that is wet proportion F - 212 FDRY fraction of foliage that is green and dry proportion F - 213 FRAC_ICEOLD fraction of ice relative to the tot water proportion F - 214 SNOW_DEPTH snow height of snow covered area m T - 215 SNOW_DEPTH_ICE snow height of snow covered area (ice landunits only) m F - 216 SNOWDP gridcell mean snow height m T - 217 WF soil water as frac. of whc for top 0.05 m proportion F - 218 H2OSNO_TOP mass of snow in top snow layer kg/m2 T - 219 SNORDSL top snow layer effective grain radius m^-6 F - 220 SNOLIQFL top snow layer liquid water fraction (land) fraction F - 221 SNO_EXISTENCE Fraction of averaging period for which each snow layer existed unitless F - 222 SNO_BW Partial density of water in the snow pack (ice + liquid) kg/m3 F - 223 SNO_BW_ICE Partial density of water in the snow pack (ice + liquid, ice landunits only) kg/m3 F - 224 SNO_GS Mean snow grain size Microns F - 225 SNO_GS_ICE Mean snow grain size (ice landunits only) Microns F - 226 QINTR interception mm/s T - 227 SNOW_SOURCES snow sources (liquid water) mm/s T - 228 SNOW_SINKS snow sinks (liquid water) mm/s T - 229 LIQUID_CONTENT1 initial gridcell total liq content mm T - 230 LIQUID_CONTENT2 post landuse change gridcell total liq content mm F - 231 ICE_CONTENT1 initial gridcell total ice content mm T - 232 ICE_CONTENT2 post land cover change total ice content mm F - 233 ERRH2O total water conservation error mm T - 234 ERRH2OSNO imbalance in snow depth (liquid water) mm T - 235 QDIRECT_THROUGHFALL direct throughfall of liquid (rain + above-canopy irrigation) mm/s F - 236 QDIRECT_THROUGHFALL_SNOW direct throughfall of snow mm/s F - 237 QDRIP rate of excess canopy liquid falling off canopy mm/s F - 238 QDRIP_SNOW rate of excess canopy snow falling off canopy mm/s F - 239 QSNOUNLOAD canopy snow unloading mm/s T - 240 QTOPSOIL water input to surface mm/s F - 241 QINFL infiltration mm/s T - 242 QOVER total surface runoff (includes QH2OSFC) mm/s T - 243 QRGWL surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff fro mm/s T - 244 QDRAI sub-surface drainage mm/s T - 245 QDRAI_PERCH perched wt drainage mm/s T - 246 QFLX_LIQ_DYNBAL liq dynamic land cover change conversion runoff flux mm/s T - 247 QFLX_ICE_DYNBAL ice dynamic land cover change conversion runoff flux mm/s T - 248 QRUNOFF total liquid runoff not including correction for land use change mm/s T - 249 QRUNOFF_ICE total liquid runoff not incl corret for LULCC (ice landunits only) mm/s T - 250 QRUNOFF_U Urban total runoff mm/s F - 251 QRUNOFF_R Rural total runoff mm/s F - 252 QSNOMELT snow melt rate mm/s T - 253 QSNOMELT_ICE snow melt (ice landunits only) mm/s T - 254 QSNOFRZ column-integrated snow freezing rate kg/m2/s T - 255 QSNOFRZ_ICE column-integrated snow freezing rate (ice landunits only) mm/s T - 256 SNO_FRZ snow freezing rate in each snow layer kg/m2/s F - 257 SNO_FRZ_ICE snow freezing rate in each snow layer (ice landunits only) mm/s F - 258 QFLX_SNOW_DRAIN drainage from snow pack mm/s T - 259 QFLX_SNOW_DRAIN_ICE drainage from snow pack melt (ice landunits only) mm/s T - 260 QSOIL Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew) mm/s T - 261 QSOIL_ICE Ground evaporation (ice landunits only) mm/s T - 262 QVEGE canopy evaporation mm/s T - 263 QVEGT canopy transpiration mm/s T - 264 QSNOCPLIQ excess liquid h2o due to snow capping not including correction for land use change mm H2O/s T - 265 QSNWCPICE excess solid h2o due to snow capping not including correction for land use change mm H2O/s T - 266 QICE ice growth/melt mm/s T - 267 QICE_FRZ ice growth mm/s T - 268 QICE_MELT ice melt mm/s T - 269 QFLX_LIQ_GRND liquid (rain+irrigation) on ground after interception mm H2O/s F - 270 QFLX_SNOW_GRND snow on ground after interception mm H2O/s F - 271 QFLX_LIQEVAP_FROM_TOP_LAYER rate of liquid water evaporated from top soil or snow layer mm H2O/s T - 272 QFLX_EVAP_VEG vegetation evaporation mm H2O/s F - 273 QFLX_EVAP_TOT qflx_evap_soi + qflx_evap_can + qflx_tran_veg kg m-2 s-1 T - 274 QFLX_LIQDEW_TO_TOP_LAYER rate of liquid water deposited on top soil or snow layer (dew) mm H2O/s T - 275 QFLX_SOLIDEVAP_FROM_TOP_LAYER rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s T - 276 QFLX_SOLIDEVAP_FROM_TOP_LAYER_ICE rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s F - 277 QFLX_SOLIDDEW_TO_TOP_LAYER rate of solid water deposited on top soil or snow layer (frost) mm H2O/s T - 278 QDRAI_XS saturation excess drainage mm/s T - 279 QH2OSFC_TO_ICE surface water converted to ice mm/s F - 280 QIRRIG_FROM_SURFACE water added through surface water irrigation mm/s T - 281 QIRRIG_FROM_GW_UNCONFINED water added through unconfined groundwater irrigation mm/s T - 282 QIRRIG_FROM_GW_CONFINED water added through confined groundwater irrigation mm/s T - 283 QIRRIG_DRIP water added via drip irrigation mm/s F - 284 QIRRIG_SPRINKLER water added via sprinkler irrigation mm/s F - 285 SNO_MELT snow melt rate in each snow layer mm/s F - 286 SNO_MELT_ICE snow melt rate in each snow layer (ice landunits only) mm/s F - 287 QROOTSINK water flux from soil to root in each soil-layer mm/s F - 288 QHR hydraulic redistribution mm/s T - 289 QSNO_WINDUNLOAD canopy snow wind unloading mm/s T - 290 QSNO_TEMPUNLOAD canopy snow temp unloading mm/s T - 291 QSNOEVAP evaporation from snow (only when snl<0, otherwise it is equal to qflx_ev_soil) mm/s T - 292 QH2OSFC surface water runoff mm/s T - 293 QPHSNEG net negative hydraulic redistribution flux mm/s F - 294 AnnET Annual ET mm/s F - 295 QRUNOFF_TO_COUPLER total liquid runoff sent to coupler (includes corrections for land use change) mm/s T - 296 QRUNOFF_ICE_TO_COUPLER total ice runoff sent to coupler (includes corrections for land use change) mm/s T - 297 QRUNOFF_ICE_TO_LIQ liquid runoff from converted ice runoff mm/s F - 298 RAIN_FROM_ATM atmospheric rain received from atmosphere (pre-repartitioning) mm/s T - 299 SNOW_FROM_ATM atmospheric snow received from atmosphere (pre-repartitioning) mm/s T - 300 QBOT atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg T - 301 Qair atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg F - 302 QFLOOD runoff from river flooding mm/s T - 303 RAIN atmospheric rain, after rain/snow repartitioning based on temperature mm/s T - 304 Rainf atmospheric rain, after rain/snow repartitioning based on temperature mm/s F - 305 RAIN_ICE atmospheric rain, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F - 306 SNOW atmospheric snow, after rain/snow repartitioning based on temperature mm/s T - 307 SNOW_ICE atmospheric snow, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F - 308 VOLR river channel total water storage m3 T - 309 VOLRMCH river channel main channel water storage m3 T - 310 RH atmospheric relative humidity % F - 311 RH30 30-day running mean of relative humidity % F - 312 PREC10 10-day running mean of PREC MM H2O/S F - 313 PREC60 60-day running mean of PREC MM H2O/S F - 314 EFLX_DYNBAL dynamic land cover change conversion energy flux W/m^2 T - 315 FSM snow melt heat flux W/m^2 T - 316 FSM_ICE snow melt heat flux (ice landunits only) W/m^2 F - 317 FSM_R Rural snow melt heat flux W/m^2 F - 318 FSM_U Urban snow melt heat flux W/m^2 F - 319 FIRA net infrared (longwave) radiation W/m^2 T - 320 FIRA_ICE net infrared (longwave) radiation (ice landunits only) W/m^2 F - 321 FIRA_R Rural net infrared (longwave) radiation W/m^2 T - 322 FIRE emitted infrared (longwave) radiation W/m^2 T - 323 LWup upwelling longwave radiation W/m^2 F - 324 FIRE_ICE emitted infrared (longwave) radiation (ice landunits only) W/m^2 F - 325 FIRE_R Rural emitted infrared (longwave) radiation W/m^2 T - 326 FCTR canopy transpiration W/m^2 T - 327 FCEV canopy evaporation W/m^2 T - 328 FGEV ground evaporation W/m^2 T - 329 FSH sensible heat not including correction for land use change and rain/snow conversion W/m^2 T - 330 FSH_ICE sensible heat not including correction for land use change and rain/snow conversion (ice landu W/m^2 F - 331 FSH_R Rural sensible heat W/m^2 T - 332 Qh sensible heat W/m^2 F - 333 Qle total evaporation W/m^2 F - 334 EFLX_LH_TOT total latent heat flux [+ to atm] W/m^2 T - 335 EFLX_LH_TOT_ICE total latent heat flux [+ to atm] (ice landunits only) W/m^2 F - 336 EFLX_LH_TOT_R Rural total evaporation W/m^2 T - 337 Qstor storage heat flux (includes snowmelt) W/m^2 F - 338 FSH_V sensible heat from veg W/m^2 T - 339 FSH_G sensible heat from ground W/m^2 T - 340 FGR heat flux into soil/snow including snow melt and lake / snow light transmission W/m^2 T - 341 FGR_ICE heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits W/m^2 F - 342 FGR_R Rural heat flux into soil/snow including snow melt and snow light transmission W/m^2 F - 343 FIRA_U Urban net infrared (longwave) radiation W/m^2 F - 344 EFLX_SOIL_GRND soil heat flux [+ into soil] W/m^2 F - 345 FIRE_U Urban emitted infrared (longwave) radiation W/m^2 F - 346 FSH_U Urban sensible heat W/m^2 F - 347 FSH_PRECIP_CONVERSION Sensible heat flux from conversion of rain/snow atm forcing W/m^2 T - 348 EFLX_LH_TOT_U Urban total evaporation W/m^2 F - 349 FGR_U Urban heat flux into soil/snow including snow melt W/m^2 F - 350 Rnet net radiation W/m^2 F - 351 DLRAD downward longwave radiation below the canopy W/m^2 F - 352 ULRAD upward longwave radiation above the canopy W/m^2 F - 353 CGRND deriv. of soil energy flux wrt to soil temp W/m^2/K F - 354 CGRNDL deriv. of soil latent heat flux wrt soil temp W/m^2/K F - 355 CGRNDS deriv. of soil sensible heat flux wrt soil temp W/m^2/K F - 356 EFLX_GNET net heat flux into ground W/m^2 F - 357 EFLX_GRND_LAKE net heat flux into lake/snow surface, excluding light transmission W/m^2 T - 358 EFLXBUILD building heat flux from change in interior building air temperature W/m^2 T - 359 URBAN_AC urban air conditioning flux W/m^2 T - 360 URBAN_HEAT urban heating flux W/m^2 T - 361 DGNETDT derivative of net ground heat flux wrt soil temp W/m^2/K F - 362 FGR12 heat flux between soil layers 1 and 2 W/m^2 T - 363 FGR_SOIL_R Rural downward heat flux at interface below each soil layer watt/m^2 F - 364 TRAFFICFLUX sensible heat flux from urban traffic W/m^2 F - 365 WASTEHEAT sensible heat flux from heating/cooling sources of urban waste heat W/m^2 T - 366 HEAT_FROM_AC sensible heat flux put into canyon due to heat removed from air conditioning W/m^2 T - 367 TAUX zonal surface stress kg/m/s^2 T - 368 Qtau momentum flux kg/m/s^2 F - 369 TAUY meridional surface stress kg/m/s^2 T - 370 BTRANMN daily minimum of transpiration beta factor unitless T - 371 RRESIS root resistance in each soil layer proportion F - 372 ERRSOI soil/lake energy conservation error W/m^2 T - 373 ERRSEB surface energy conservation error W/m^2 T - 374 ERRSOL solar radiation conservation error W/m^2 T - 375 DSTDEP total dust deposition (dry+wet) from atmosphere kg/m^2/s T - 376 BCDEP total BC deposition (dry+wet) from atmosphere kg/m^2/s T - 377 OCDEP total OC deposition (dry+wet) from atmosphere kg/m^2/s T - 378 SNOBCMCL mass of BC in snow column kg/m2 T - 379 SNOBCMSL mass of BC in top snow layer kg/m2 T - 380 SNOOCMCL mass of OC in snow column kg/m2 T - 381 SNOOCMSL mass of OC in top snow layer kg/m2 T - 382 SNODSTMCL mass of dust in snow column kg/m2 T - 383 SNODSTMSL mass of dust in top snow layer kg/m2 T - 384 Z0MG roughness length over ground, momentum m F - 385 Z0HG roughness length over ground, sensible heat m F - 386 Z0QG roughness length over ground, latent heat m F - 387 VA atmospheric wind speed plus convective velocity m/s F - 388 U10 10-m wind m/s T - 389 U10_ICE 10-m wind (ice landunits only) m/s F - 390 U10_DUST 10-m wind for dust model m/s T - 391 RAM1 aerodynamical resistance s/m F - 392 FV friction velocity for dust model m/s F - 393 Z0HV roughness length over vegetation, sensible heat m F - 394 Z0MV roughness length over vegetation, momentum m F - 395 Z0QV roughness length over vegetation, latent heat m F - 396 RB10 10 day running mean boundary layer resistance s/m F - 397 LAKEICEFRAC lake layer ice mass fraction unitless F - 398 LAKEICEFRAC_SURF surface lake layer ice mass fraction unitless T - 399 LAKEICETHICK thickness of lake ice (including physical expansion on freezing) m T - 400 TKE1 top lake level eddy thermal conductivity W/(mK) T - 401 RAM_LAKE aerodynamic resistance for momentum (lakes only) s/m F - 402 UST_LAKE friction velocity (lakes only) m/s F - 403 RH_LEAF fractional humidity at leaf surface fraction F - 404 VPD_CAN canopy vapor pressure deficit kPa T - 405 LNC leaf N concentration gN leaf/m^2 T - 406 FPSN photosynthesis umol m-2 s-1 T - 407 FPSN_WC Rubisco-limited photosynthesis umol m-2 s-1 F - 408 FPSN_WJ RuBP-limited photosynthesis umol m-2 s-1 F - 409 FPSN_WP Product-limited photosynthesis umol m-2 s-1 F - 410 PSNSUN sunlit leaf photosynthesis umolCO2/m^2/s T - 411 PSNSHA shaded leaf photosynthesis umolCO2/m^2/s T - 412 RSSUN sunlit leaf stomatal resistance s/m T - 413 RSSHA shaded leaf stomatal resistance s/m T - 414 GSSUN sunlit leaf stomatal conductance umol H20/m2/s T - 415 GSSHA shaded leaf stomatal conductance umol H20/m2/s T - 416 GSSUNLN sunlit leaf stomatal conductance at local noon umol H20/m2/s T - 417 GSSHALN shaded leaf stomatal conductance at local noon umol H20/m2/s T - 418 Vcmx25Z canopy profile of vcmax25 predicted by LUNA model umol/m2/s T - 419 Jmx25Z maximum rate of electron transport at 25 Celcius for canopy layers umol electrons/m2/s T - 420 PNLCZ Proportion of nitrogen allocated for light capture unitless F - 421 VCMX25T canopy profile of vcmax25 umol/m2/s T - 422 JMX25T canopy profile of jmax umol/m2/s T - 423 TPU25T canopy profile of tpu umol/m2/s T - 424 FPSN24 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m^2 ground/day F - 425 QCHARGE aquifer recharge rate (natural vegetated and crop landunits only) mm/s T - 426 NSUBSTEPS number of adaptive timesteps in CLM timestep unitless F - 427 FROST_TABLE frost table depth (natural vegetated and crop landunits only) m F - 428 ZWT water table depth (natural vegetated and crop landunits only) m T - 429 ZWT_PERCH perched water table depth (natural vegetated and crop landunits only) m T - 430 FCOV fractional impermeable area unitless T - 431 FSAT fractional area with water table at surface unitless T - 432 FSA absorbed solar radiation W/m^2 T - 433 FSA_ICE absorbed solar radiation (ice landunits only) W/m^2 F - 434 FSA_R Rural absorbed solar radiation W/m^2 F - 435 FSA_U Urban absorbed solar radiation W/m^2 F - 436 FSR reflected solar radiation W/m^2 T - 437 SWup upwelling shortwave radiation W/m^2 F - 438 FSR_ICE reflected solar radiation (ice landunits only) W/m^2 F - 439 SNO_ABS Absorbed solar radiation in each snow layer W/m^2 F - 440 SNO_ABS_ICE Absorbed solar radiation in each snow layer (ice landunits only) W/m^2 F - 441 SABV solar rad absorbed by veg W/m^2 T - 442 SABG solar rad absorbed by ground W/m^2 T - 443 SABG_PEN Rural solar rad penetrating top soil or snow layer watt/m^2 T - 444 FSDSND direct nir incident solar radiation W/m^2 T - 445 FSDSNI diffuse nir incident solar radiation W/m^2 T - 446 FSDSNDLN direct nir incident solar radiation at local noon W/m^2 T - 447 FSRND direct nir reflected solar radiation W/m^2 T - 448 FSRNI diffuse nir reflected solar radiation W/m^2 T - 449 FSRNDLN direct nir reflected solar radiation at local noon W/m^2 T - 450 FSRSF reflected solar radiation W/m^2 T - 451 SSRE_FSR surface snow effect on reflected solar radiation W/m^2 T - 452 FSRSFND direct nir reflected solar radiation W/m^2 T - 453 FSRSFNI diffuse nir reflected solar radiation W/m^2 T - 454 FSRSFNDLN direct nir reflected solar radiation at local noon W/m^2 T - 455 SSRE_FSRND surface snow effect on direct nir reflected solar radiation W/m^2 T - 456 SSRE_FSRNI surface snow effect on diffuse nir reflected solar radiation W/m^2 T - 457 SSRE_FSRNDLN surface snow effect on direct nir reflected solar radiation at local noon W/m^2 T - 458 SNOINTABS Fraction of incoming solar absorbed by lower snow layers - T - 459 PAR240DZ 10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer W/m^2 F - 460 PAR240XZ 10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer W/m^2 F - 461 COSZEN cosine of solar zenith angle none F - 462 ALBGRD ground albedo (direct) proportion F - 463 ALBGRI ground albedo (indirect) proportion F - 464 ALBDSF diagnostic snow-free surface albedo (direct) proportion T - 465 ALBISF diagnostic snow-free surface albedo (indirect) proportion T - 466 ALBD surface albedo (direct) proportion T - 467 ALBI surface albedo (indirect) proportion T - 468 FSDSVD direct vis incident solar radiation W/m^2 T - 469 FSDSVI diffuse vis incident solar radiation W/m^2 T - 470 FSRVD direct vis reflected solar radiation W/m^2 T - 471 FSRVI diffuse vis reflected solar radiation W/m^2 T - 472 FSRSFVD direct vis reflected solar radiation W/m^2 T - 473 FSRSFVI diffuse vis reflected solar radiation W/m^2 T - 474 SSRE_FSRVD surface snow radiatve effect on direct vis reflected solar radiation W/m^2 T - 475 SSRE_FSRVI surface snow radiatve effect on diffuse vis reflected solar radiation W/m^2 T - 476 FSDSVDLN direct vis incident solar radiation at local noon W/m^2 T - 477 FSDSVILN diffuse vis incident solar radiation at local noon W/m^2 T - 478 PARVEGLN absorbed par by vegetation at local noon W/m^2 T - 479 FSRVDLN direct vis reflected solar radiation at local noon W/m^2 T - 480 FSRSFVDLN direct vis reflected solar radiation at local noon W/m^2 T - 481 SSRE_FSRVDLN surface snow radiatve effect on direct vis reflected solar radiation at local noon W/m^2 T - 482 SNOFSDSVD direct vis incident solar radiation on snow W/m^2 F - 483 SNOFSDSND direct nir incident solar radiation on snow W/m^2 F - 484 SNOFSDSVI diffuse vis incident solar radiation on snow W/m^2 F - 485 SNOFSDSNI diffuse nir incident solar radiation on snow W/m^2 F - 486 SNOFSRVD direct vis reflected solar radiation from snow W/m^2 T - 487 SNOFSRND direct nir reflected solar radiation from snow W/m^2 T - 488 SNOFSRVI diffuse vis reflected solar radiation from snow W/m^2 T - 489 SNOFSRNI diffuse nir reflected solar radiation from snow W/m^2 T - 490 DSTFLXT total surface dust emission kg/m2/s T - 491 DPVLTRB1 turbulent deposition velocity 1 m/s F - 492 DPVLTRB2 turbulent deposition velocity 2 m/s F - 493 DPVLTRB3 turbulent deposition velocity 3 m/s F - 494 DPVLTRB4 turbulent deposition velocity 4 m/s F - 495 QIRRIG_DEMAND irrigation demand mm/s F - 496 TOPO_COL column-level topographic height m F - 497 TOPO_COL_ICE column-level topographic height (ice landunits only) m F - 498 FINUNDATED fractional inundated area of vegetated columns unitless T - 499 FINUNDATED_LAG time-lagged inundated fraction of vegetated columns unitless F - 500 CH4_SURF_DIFF_SAT diffusive surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T - 501 CH4_SURF_DIFF_UNSAT diffusive surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T - 502 CH4_EBUL_TOTAL_SAT ebullition surface CH4 flux; (+ to atm) mol/m2/s F - 503 CH4_EBUL_TOTAL_UNSAT ebullition surface CH4 flux; (+ to atm) mol/m2/s F - 504 CH4_SURF_EBUL_SAT ebullition surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T - 505 CH4_SURF_EBUL_UNSAT ebullition surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T - 506 CH4_SURF_AERE_SAT aerenchyma surface CH4 flux for inundated area; (+ to atm) mol/m2/s T - 507 CH4_SURF_AERE_UNSAT aerenchyma surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T - 508 TOTCOLCH4 total belowground CH4 (0 for non-lake special landunits in the absence of dynamic landunits) gC/m2 T - 509 CONC_CH4_SAT CH4 soil Concentration for inundated / lake area mol/m3 F - 510 CONC_CH4_UNSAT CH4 soil Concentration for non-inundated area mol/m3 F - 511 O2_DECOMP_DEPTH_UNSAT O2 consumption from HR and AR for non-inundated area mol/m3/s F - 512 CONC_O2_SAT O2 soil Concentration for inundated / lake area mol/m3 T - 513 CONC_O2_UNSAT O2 soil Concentration for non-inundated area mol/m3 T - 514 FCH4TOCO2 Gridcell oxidation of CH4 to CO2 gC/m2/s T - 515 CH4PROD Gridcell total production of CH4 gC/m2/s T - 516 FCH4_DFSAT CH4 additional flux due to changing fsat, natural vegetated and crop landunits only kgC/m2/s T - 517 ZWT_CH4_UNSAT depth of water table for methane production used in non-inundated area m T - 518 QOVER_LAG time-lagged surface runoff for soil columns mm/s F - 519 WTGQ surface tracer conductance m/s T - 520 DYN_COL_ADJUSTMENTS_CH4 Adjustments in ch4 due to dynamic column areas; only makes sense at the column level: should n gC/m^2 F - 521 MEG_isoprene MEGAN flux kg/m2/sec T - 522 MEG_pinene_a MEGAN flux kg/m2/sec T - 523 MEG_carene_3 MEGAN flux kg/m2/sec T - 524 MEG_thujene_a MEGAN flux kg/m2/sec T - 525 MEG_methanol MEGAN flux kg/m2/sec T - 526 MEG_ethanol MEGAN flux kg/m2/sec T - 527 MEG_formaldehyde MEGAN flux kg/m2/sec T - 528 MEG_acetaldehyde MEGAN flux kg/m2/sec T - 529 MEG_acetic_acid MEGAN flux kg/m2/sec T - 530 MEG_acetone MEGAN flux kg/m2/sec T - 531 VOCFLXT total VOC flux into atmosphere moles/m2/sec F - 532 GAMMA total gamma for VOC calc non F - 533 GAMMAL gamma L for VOC calc non F - 534 GAMMAT gamma T for VOC calc non F - 535 GAMMAP gamma P for VOC calc non F - 536 GAMMAA gamma A for VOC calc non F - 537 GAMMAS gamma S for VOC calc non F - 538 GAMMAC gamma C for VOC calc non F - 539 EOPT Eopt coefficient for VOC calc non F - 540 TOPT topt coefficient for VOC calc non F - 541 ALPHA alpha coefficient for VOC calc non F - 542 currentPatch currentPatch coefficient for VOC calc non F - 543 PAR_sun sunlit PAR umol/m2/s F - 544 PAR24_sun sunlit PAR (24 hrs) umol/m2/s F - 545 PAR240_sun sunlit PAR (240 hrs) umol/m2/s F - 546 PAR_shade shade PAR umol/m2/s F - 547 PAR24_shade shade PAR (24 hrs) umol/m2/s F - 548 PAR240_shade shade PAR (240 hrs) umol/m2/s F - 549 FireComp_BC fire emissions flux of BC kg/m2/sec F - 550 FireComp_OC fire emissions flux of OC kg/m2/sec F - 551 FireComp_SO2 fire emissions flux of SO2 kg/m2/sec F - 552 FireMech_bc_a1 fire emissions flux of bc_a1 kg/m2/sec F - 553 FireMech_pom_a1 fire emissions flux of pom_a1 kg/m2/sec F - 554 FireMech_SO2 fire emissions flux of SO2 kg/m2/sec F - 555 FireEmis_TOT Total fire emissions flux gC/m2/sec F - 556 FireEmis_ZTOP Top of vertical fire emissions distribution m F - 557 CROOT_PROF profile for litter C and N inputs from coarse roots 1/m F - 558 FROOT_PROF profile for litter C and N inputs from fine roots 1/m F - 559 LEAF_PROF profile for litter C and N inputs from leaves 1/m F - 560 STEM_PROF profile for litter C and N inputs from stems 1/m F - 561 NFIXATION_PROF profile for biological N fixation 1/m F - 562 NDEP_PROF profile for atmospheric N deposition 1/m F - 563 SOM_ADV_COEF advection term for vertical SOM translocation m/s F - 564 SOM_DIFFUS_COEF diffusion coefficient for vertical SOM translocation m^2/s F - 565 FPI fraction of potential immobilization proportion T - 566 FPI_vr fraction of potential immobilization proportion F - 567 SOILC_vr SOIL C (vertically resolved) gC/m^3 T - 568 LITR1C_vr LITR1 C (vertically resolved) gC/m^3 T - 569 LITR1C LITR1 C gC/m^2 T - 570 LITR1C_1m LITR1 C to 1 meter gC/m^2 F - 571 LITR2C_vr LITR2 C (vertically resolved) gC/m^3 T - 572 LITR2C LITR2 C gC/m^2 T - 573 LITR2C_1m LITR2 C to 1 meter gC/m^2 F - 574 LITR3C_vr LITR3 C (vertically resolved) gC/m^3 T - 575 LITR3C LITR3 C gC/m^2 T - 576 LITR3C_1m LITR3 C to 1 meter gC/m^2 F - 577 CWDC_vr CWD C (vertically resolved) gC/m^3 T - 578 CWDC CWD C gC/m^2 T - 579 CWDC_1m CWD C to 1 meter gC/m^2 F - 580 SOIL1C_vr SOIL1 C (vertically resolved) gC/m^3 T - 581 SOIL1C SOIL1 C gC/m^2 T - 582 SOIL1C_1m SOIL1 C to 1 meter gC/m^2 F - 583 SOIL2C_vr SOIL2 C (vertically resolved) gC/m^3 T - 584 SOIL2C SOIL2 C gC/m^2 T - 585 SOIL2C_1m SOIL2 C to 1 meter gC/m^2 F - 586 SOIL3C_vr SOIL3 C (vertically resolved) gC/m^3 T - 587 SOIL3C SOIL3 C gC/m^2 T - 588 SOIL3C_1m SOIL3 C to 1 meter gC/m^2 F - 589 TOTLITC total litter carbon gC/m^2 T - 590 TOTSOMC total soil organic matter carbon gC/m^2 T - 591 TOTLITC_1m total litter carbon to 1 meter depth gC/m^2 T - 592 TOTSOMC_1m total soil organic matter carbon to 1 meter depth gC/m^2 T - 593 COL_CTRUNC column-level sink for C truncation gC/m^2 F - 594 DYN_COL_SOIL_ADJUSTMENTS_C Adjustments in soil carbon due to dynamic column areas; only makes sense at the column level: gC/m^2 F - 595 HR total heterotrophic respiration gC/m^2/s T - 596 LITTERC_HR litter C heterotrophic respiration gC/m^2/s T - 597 SOILC_HR soil C heterotrophic respiration gC/m^2/s T - 598 SOMC_FIRE C loss due to peat burning gC/m^2/s T - 599 K_LITR1 litter 1 potential loss coefficient 1/s F - 600 K_LITR2 litter 2 potential loss coefficient 1/s F - 601 K_LITR3 litter 3 potential loss coefficient 1/s F - 602 K_CWD coarse woody debris potential loss coefficient 1/s F - 603 K_SOIL1 soil 1 potential loss coefficient 1/s F - 604 K_SOIL2 soil 2 potential loss coefficient 1/s F - 605 K_SOIL3 soil 3 potential loss coefficient 1/s F - 606 LITR1_HR Het. Resp. from litter 1 gC/m^2/s F - 607 LITR1C_TO_SOIL1C decomp. of litter 1 C to soil 1 C gC/m^2/s F - 608 LITR1_HR_vr Het. Resp. from litter 1 gC/m^3/s F - 609 LITR1C_TO_SOIL1C_vr decomp. of litter 1 C to soil 1 C gC/m^3/s F - 610 LITR2_HR Het. Resp. from litter 2 gC/m^2/s F - 611 LITR2C_TO_SOIL1C decomp. of litter 2 C to soil 1 C gC/m^2/s F - 612 LITR2_HR_vr Het. Resp. from litter 2 gC/m^3/s F - 613 LITR2C_TO_SOIL1C_vr decomp. of litter 2 C to soil 1 C gC/m^3/s F - 614 LITR3_HR Het. Resp. from litter 3 gC/m^2/s F - 615 LITR3C_TO_SOIL2C decomp. of litter 3 C to soil 2 C gC/m^2/s F - 616 LITR3_HR_vr Het. Resp. from litter 3 gC/m^3/s F - 617 LITR3C_TO_SOIL2C_vr decomp. of litter 3 C to soil 2 C gC/m^3/s F - 618 SOIL1_HR_S2 Het. Resp. from soil 1 gC/m^2/s F - 619 SOIL1C_TO_SOIL2C decomp. of soil 1 C to soil 2 C gC/m^2/s F - 620 SOIL1_HR_S2_vr Het. Resp. from soil 1 gC/m^3/s F - 621 SOIL1C_TO_SOIL2C_vr decomp. of soil 1 C to soil 2 C gC/m^3/s F - 622 SOIL1_HR_S3 Het. Resp. from soil 1 gC/m^2/s F - 623 SOIL1C_TO_SOIL3C decomp. of soil 1 C to soil 3 C gC/m^2/s F - 624 SOIL1_HR_S3_vr Het. Resp. from soil 1 gC/m^3/s F - 625 SOIL1C_TO_SOIL3C_vr decomp. of soil 1 C to soil 3 C gC/m^3/s F - 626 SOIL2_HR_S1 Het. Resp. from soil 2 gC/m^2/s F - 627 SOIL2C_TO_SOIL1C decomp. of soil 2 C to soil 1 C gC/m^2/s F - 628 SOIL2_HR_S1_vr Het. Resp. from soil 2 gC/m^3/s F - 629 SOIL2C_TO_SOIL1C_vr decomp. of soil 2 C to soil 1 C gC/m^3/s F - 630 SOIL2_HR_S3 Het. Resp. from soil 2 gC/m^2/s F - 631 SOIL2C_TO_SOIL3C decomp. of soil 2 C to soil 3 C gC/m^2/s F - 632 SOIL2_HR_S3_vr Het. Resp. from soil 2 gC/m^3/s F - 633 SOIL2C_TO_SOIL3C_vr decomp. of soil 2 C to soil 3 C gC/m^3/s F - 634 SOIL3_HR Het. Resp. from soil 3 gC/m^2/s F - 635 SOIL3C_TO_SOIL1C decomp. of soil 3 C to soil 1 C gC/m^2/s F - 636 SOIL3_HR_vr Het. Resp. from soil 3 gC/m^3/s F - 637 SOIL3C_TO_SOIL1C_vr decomp. of soil 3 C to soil 1 C gC/m^3/s F - 638 CWDC_TO_LITR2C decomp. of coarse woody debris C to litter 2 C gC/m^2/s F - 639 CWDC_TO_LITR2C_vr decomp. of coarse woody debris C to litter 2 C gC/m^3/s F - 640 CWDC_TO_LITR3C decomp. of coarse woody debris C to litter 3 C gC/m^2/s F - 641 CWDC_TO_LITR3C_vr decomp. of coarse woody debris C to litter 3 C gC/m^3/s F - 642 T_SCALAR temperature inhibition of decomposition unitless T - 643 W_SCALAR Moisture (dryness) inhibition of decomposition unitless T - 644 O_SCALAR fraction by which decomposition is reduced due to anoxia unitless T - 645 SOM_C_LEACHED total flux of C from SOM pools due to leaching gC/m^2/s T - 646 M_LITR1C_TO_LEACHING litter 1 C leaching loss gC/m^2/s F - 647 LITR1C_TNDNCY_VERT_TRANS litter 1 C tendency due to vertical transport gC/m^3/s F - 648 M_LITR2C_TO_LEACHING litter 2 C leaching loss gC/m^2/s F - 649 LITR2C_TNDNCY_VERT_TRANS litter 2 C tendency due to vertical transport gC/m^3/s F - 650 M_LITR3C_TO_LEACHING litter 3 C leaching loss gC/m^2/s F - 651 LITR3C_TNDNCY_VERT_TRANS litter 3 C tendency due to vertical transport gC/m^3/s F - 652 M_SOIL1C_TO_LEACHING soil 1 C leaching loss gC/m^2/s F - 653 SOIL1C_TNDNCY_VERT_TRANS soil 1 C tendency due to vertical transport gC/m^3/s F - 654 M_SOIL2C_TO_LEACHING soil 2 C leaching loss gC/m^2/s F - 655 SOIL2C_TNDNCY_VERT_TRANS soil 2 C tendency due to vertical transport gC/m^3/s F - 656 M_SOIL3C_TO_LEACHING soil 3 C leaching loss gC/m^2/s F - 657 SOIL3C_TNDNCY_VERT_TRANS soil 3 C tendency due to vertical transport gC/m^3/s F - 658 HR_vr total vertically resolved heterotrophic respiration gC/m^3/s T - 659 SOILN_vr SOIL N (vertically resolved) gN/m^3 T - 660 LITR1N_vr LITR1 N (vertically resolved) gN/m^3 T - 661 LITR1N LITR1 N gN/m^2 T - 662 LITR1N_1m LITR1 N to 1 meter gN/m^2 F - 663 LITR2N_vr LITR2 N (vertically resolved) gN/m^3 T - 664 LITR2N LITR2 N gN/m^2 T - 665 LITR2N_1m LITR2 N to 1 meter gN/m^2 F - 666 LITR3N_vr LITR3 N (vertically resolved) gN/m^3 T - 667 LITR3N LITR3 N gN/m^2 T - 668 LITR3N_1m LITR3 N to 1 meter gN/m^2 F - 669 CWDN_vr CWD N (vertically resolved) gN/m^3 T - 670 CWDN CWD N gN/m^2 T - 671 CWDN_1m CWD N to 1 meter gN/m^2 F - 672 SOIL1N_vr SOIL1 N (vertically resolved) gN/m^3 T - 673 SOIL1N SOIL1 N gN/m^2 T - 674 SOIL1N_1m SOIL1 N to 1 meter gN/m^2 F - 675 SOIL2N_vr SOIL2 N (vertically resolved) gN/m^3 T - 676 SOIL2N SOIL2 N gN/m^2 T - 677 SOIL2N_1m SOIL2 N to 1 meter gN/m^2 F - 678 SOIL3N_vr SOIL3 N (vertically resolved) gN/m^3 T - 679 SOIL3N SOIL3 N gN/m^2 T - 680 SOIL3N_1m SOIL3 N to 1 meter gN/m^2 F - 681 SMINN soil mineral N gN/m^2 T - 682 TOTLITN_1m total litter N to 1 meter gN/m^2 T - 683 TOTSOMN_1m total soil organic matter N to 1 meter gN/m^2 T - 684 COL_NTRUNC column-level sink for N truncation gN/m^2 F - 685 SMIN_NO3_vr soil mineral NO3 (vert. res.) gN/m^3 T - 686 SMIN_NH4_vr soil mineral NH4 (vert. res.) gN/m^3 T - 687 SMINN_vr soil mineral N gN/m^3 T - 688 SMIN_NO3 soil mineral NO3 gN/m^2 T - 689 SMIN_NH4 soil mineral NH4 gN/m^2 T - 690 TOTLITN total litter N gN/m^2 T - 691 TOTSOMN total soil organic matter N gN/m^2 T - 692 DYN_COL_SOIL_ADJUSTMENTS_N Adjustments in soil nitrogen due to dynamic column areas; only makes sense at the column level gN/m^2 F - 693 DYN_COL_SOIL_ADJUSTMENTS_NO3 Adjustments in soil NO3 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F - 694 DYN_COL_SOIL_ADJUSTMENTS_NH4 Adjustments in soil NH4 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F - 695 NDEP_TO_SMINN atmospheric N deposition to soil mineral N gN/m^2/s T - 696 NFIX_TO_SMINN symbiotic/asymbiotic N fixation to soil mineral N gN/m^2/s F - 697 FFIX_TO_SMINN free living N fixation to soil mineral N gN/m^2/s T - 698 SMINN_TO_SOIL1N_L1 mineral N flux for decomp. of LITR1to SOIL1 gN/m^2 F - 699 LITR1N_TO_SOIL1N decomp. of litter 1 N to soil 1 N gN/m^2 F - 700 SMINN_TO_SOIL1N_L1_vr mineral N flux for decomp. of LITR1to SOIL1 gN/m^3 F - 701 LITR1N_TO_SOIL1N_vr decomp. of litter 1 N to soil 1 N gN/m^3 F - 702 SMINN_TO_SOIL1N_L2 mineral N flux for decomp. of LITR2to SOIL1 gN/m^2 F - 703 LITR2N_TO_SOIL1N decomp. of litter 2 N to soil 1 N gN/m^2 F - 704 SMINN_TO_SOIL1N_L2_vr mineral N flux for decomp. of LITR2to SOIL1 gN/m^3 F - 705 LITR2N_TO_SOIL1N_vr decomp. of litter 2 N to soil 1 N gN/m^3 F - 706 SMINN_TO_SOIL2N_L3 mineral N flux for decomp. of LITR3to SOIL2 gN/m^2 F - 707 LITR3N_TO_SOIL2N decomp. of litter 3 N to soil 2 N gN/m^2 F - 708 SMINN_TO_SOIL2N_L3_vr mineral N flux for decomp. of LITR3to SOIL2 gN/m^3 F - 709 LITR3N_TO_SOIL2N_vr decomp. of litter 3 N to soil 2 N gN/m^3 F - 710 SMINN_TO_SOIL2N_S1 mineral N flux for decomp. of SOIL1to SOIL2 gN/m^2 F - 711 SOIL1N_TO_SOIL2N decomp. of soil 1 N to soil 2 N gN/m^2 F - 712 SMINN_TO_SOIL2N_S1_vr mineral N flux for decomp. of SOIL1to SOIL2 gN/m^3 F - 713 SOIL1N_TO_SOIL2N_vr decomp. of soil 1 N to soil 2 N gN/m^3 F - 714 SMINN_TO_SOIL3N_S1 mineral N flux for decomp. of SOIL1to SOIL3 gN/m^2 F - 715 SOIL1N_TO_SOIL3N decomp. of soil 1 N to soil 3 N gN/m^2 F - 716 SMINN_TO_SOIL3N_S1_vr mineral N flux for decomp. of SOIL1to SOIL3 gN/m^3 F - 717 SOIL1N_TO_SOIL3N_vr decomp. of soil 1 N to soil 3 N gN/m^3 F - 718 SMINN_TO_SOIL1N_S2 mineral N flux for decomp. of SOIL2to SOIL1 gN/m^2 F - 719 SOIL2N_TO_SOIL1N decomp. of soil 2 N to soil 1 N gN/m^2 F - 720 SMINN_TO_SOIL1N_S2_vr mineral N flux for decomp. of SOIL2to SOIL1 gN/m^3 F - 721 SOIL2N_TO_SOIL1N_vr decomp. of soil 2 N to soil 1 N gN/m^3 F - 722 SMINN_TO_SOIL3N_S2 mineral N flux for decomp. of SOIL2to SOIL3 gN/m^2 F - 723 SOIL2N_TO_SOIL3N decomp. of soil 2 N to soil 3 N gN/m^2 F - 724 SMINN_TO_SOIL3N_S2_vr mineral N flux for decomp. of SOIL2to SOIL3 gN/m^3 F - 725 SOIL2N_TO_SOIL3N_vr decomp. of soil 2 N to soil 3 N gN/m^3 F - 726 SMINN_TO_SOIL1N_S3 mineral N flux for decomp. of SOIL3to SOIL1 gN/m^2 F - 727 SOIL3N_TO_SOIL1N decomp. of soil 3 N to soil 1 N gN/m^2 F - 728 SMINN_TO_SOIL1N_S3_vr mineral N flux for decomp. of SOIL3to SOIL1 gN/m^3 F - 729 SOIL3N_TO_SOIL1N_vr decomp. of soil 3 N to soil 1 N gN/m^3 F - 730 CWDN_TO_LITR2N decomp. of coarse woody debris N to litter 2 N gN/m^2 F - 731 CWDN_TO_LITR2N_vr decomp. of coarse woody debris N to litter 2 N gN/m^3 F - 732 CWDN_TO_LITR3N decomp. of coarse woody debris N to litter 3 N gN/m^2 F - 733 CWDN_TO_LITR3N_vr decomp. of coarse woody debris N to litter 3 N gN/m^3 F - 734 DENIT total rate of denitrification gN/m^2/s T - 735 SOM_N_LEACHED total flux of N from SOM pools due to leaching gN/m^2/s F - 736 M_LITR1N_TO_LEACHING litter 1 N leaching loss gN/m^2/s F - 737 LITR1N_TNDNCY_VERT_TRANS litter 1 N tendency due to vertical transport gN/m^3/s F - 738 M_LITR2N_TO_LEACHING litter 2 N leaching loss gN/m^2/s F - 739 LITR2N_TNDNCY_VERT_TRANS litter 2 N tendency due to vertical transport gN/m^3/s F - 740 M_LITR3N_TO_LEACHING litter 3 N leaching loss gN/m^2/s F - 741 LITR3N_TNDNCY_VERT_TRANS litter 3 N tendency due to vertical transport gN/m^3/s F - 742 M_SOIL1N_TO_LEACHING soil 1 N leaching loss gN/m^2/s F - 743 SOIL1N_TNDNCY_VERT_TRANS soil 1 N tendency due to vertical transport gN/m^3/s F - 744 M_SOIL2N_TO_LEACHING soil 2 N leaching loss gN/m^2/s F - 745 SOIL2N_TNDNCY_VERT_TRANS soil 2 N tendency due to vertical transport gN/m^3/s F - 746 M_SOIL3N_TO_LEACHING soil 3 N leaching loss gN/m^2/s F - 747 SOIL3N_TNDNCY_VERT_TRANS soil 3 N tendency due to vertical transport gN/m^3/s F - 748 F_NIT nitrification flux gN/m^2/s T - 749 F_DENIT denitrification flux gN/m^2/s T - 750 POT_F_NIT potential nitrification flux gN/m^2/s T - 751 POT_F_DENIT potential denitrification flux gN/m^2/s T - 752 SMIN_NO3_LEACHED soil NO3 pool loss to leaching gN/m^2/s T - 753 SMIN_NO3_RUNOFF soil NO3 pool loss to runoff gN/m^2/s T - 754 F_NIT_vr nitrification flux gN/m^3/s F - 755 F_DENIT_vr denitrification flux gN/m^3/s F - 756 POT_F_NIT_vr potential nitrification flux gN/m^3/s F - 757 POT_F_DENIT_vr potential denitrification flux gN/m^3/s F - 758 SMIN_NO3_LEACHED_vr soil NO3 pool loss to leaching gN/m^3/s F - 759 SMIN_NO3_RUNOFF_vr soil NO3 pool loss to runoff gN/m^3/s F - 760 n2_n2o_ratio_denit n2_n2o_ratio_denit gN/gN F - 761 ACTUAL_IMMOB_NO3 immobilization of NO3 gN/m^3/s F - 762 ACTUAL_IMMOB_NH4 immobilization of NH4 gN/m^3/s F - 763 SMIN_NO3_TO_PLANT plant uptake of NO3 gN/m^3/s F - 764 SMIN_NH4_TO_PLANT plant uptake of NH4 gN/m^3/s F - 765 SMIN_NO3_MASSDENS SMIN_NO3_MASSDENS ugN/cm^3 soil F - 766 K_NITR_T K_NITR_T unitless F - 767 K_NITR_PH K_NITR_PH unitless F - 768 K_NITR_H2O K_NITR_H2O unitless F - 769 K_NITR K_NITR 1/s F - 770 WFPS WFPS percent F - 771 FMAX_DENIT_CARBONSUBSTRATE FMAX_DENIT_CARBONSUBSTRATE gN/m^3/s F - 772 FMAX_DENIT_NITRATE FMAX_DENIT_NITRATE gN/m^3/s F - 773 F_DENIT_BASE F_DENIT_BASE gN/m^3/s F - 774 diffus diffusivity m^2/s F - 775 ratio_k1 ratio_k1 none F - 776 ratio_no3_co2 ratio_no3_co2 ratio F - 777 soil_co2_prod soil_co2_prod ug C / g soil / day F - 778 fr_WFPS fr_WFPS fraction F - 779 soil_bulkdensity soil_bulkdensity kg/m3 F - 780 anaerobic_frac anaerobic_frac m3/m3 F - 781 r_psi r_psi m F - 782 POTENTIAL_IMMOB_vr potential N immobilization gN/m^3/s F - 783 ACTUAL_IMMOB_vr actual N immobilization gN/m^3/s F - 784 SMINN_TO_PLANT_vr plant uptake of soil mineral N gN/m^3/s F - 785 SUPPLEMENT_TO_SMINN_vr supplemental N supply gN/m^3/s F - 786 GROSS_NMIN_vr gross rate of N mineralization gN/m^3/s F - 787 NET_NMIN_vr net rate of N mineralization gN/m^3/s F - 788 POTENTIAL_IMMOB potential N immobilization gN/m^2/s T - 789 ACTUAL_IMMOB actual N immobilization gN/m^2/s T - 790 SMINN_TO_PLANT plant uptake of soil mineral N gN/m^2/s T - 791 SUPPLEMENT_TO_SMINN supplemental N supply gN/m^2/s T - 792 GROSS_NMIN gross rate of N mineralization gN/m^2/s T - 793 NET_NMIN net rate of N mineralization gN/m^2/s T - 794 F_N2O_NIT nitrification N2O flux gN/m^2/s T - 795 F_N2O_DENIT denitrification N2O flux gN/m^2/s T - 796 FERT_TO_SMINN fertilizer to soil mineral N gN/m^2/s F - 797 GDDHARV Growing degree days (gdd) needed to harvest ddays F - 798 LFC2 conversion area fraction of BET and BDT that burned per sec T - 799 ANNSUM_COUNTER seconds since last annual accumulator turnover s F - 800 CANNAVG_T2M annual average of 2m air temperature K F - 801 NFIRE fire counts valid only in Reg.C counts/km2/sec T - 802 FAREA_BURNED timestep fractional area burned s-1 T - 803 BAF_CROP fractional area burned for crop s-1 T - 804 BAF_PEATF fractional area burned in peatland s-1 T - 805 ANNAVG_T2M annual average 2m air temperature K F - 806 TEMPAVG_T2M temporary average 2m air temperature K F - 807 DORMANT_FLAG dormancy flag none F - 808 DAYS_ACTIVE number of days since last dormancy days F - 809 ONSET_FLAG onset flag none F - 810 ONSET_COUNTER onset days counter days F - 811 ONSET_GDDFLAG onset flag for growing degree day sum none F - 812 ONSET_FDD onset freezing degree days counter C degree-days F - 813 ONSET_GDD onset growing degree days C degree-days F - 814 ONSET_SWI onset soil water index none F - 815 OFFSET_FLAG offset flag none F - 816 OFFSET_COUNTER offset days counter days F - 817 OFFSET_FDD offset freezing degree days counter C degree-days F - 818 OFFSET_SWI offset soil water index none F - 819 LGSF long growing season factor proportion F - 820 BGLFR background litterfall rate 1/s F - 821 BGTR background transfer growth rate 1/s F - 822 C_ALLOMETRY C allocation index none F - 823 N_ALLOMETRY N allocation index none F - 824 TEMPSUM_POTENTIAL_GPP temporary annual sum of potential GPP gC/m^2/yr F - 825 ANNSUM_POTENTIAL_GPP annual sum of potential GPP gN/m^2/yr F - 826 TEMPMAX_RETRANSN temporary annual max of retranslocated N pool gN/m^2 F - 827 ANNMAX_RETRANSN annual max of retranslocated N pool gN/m^2 F - 828 DOWNREG fractional reduction in GPP due to N limitation proportion F - 829 LEAFCN_OFFSET Leaf C:N used by FUN unitless F - 830 PLANTCN Plant C:N used by FUN unitless F - 831 GRAINC grain C (does not equal yield) gC/m^2 T - 832 CROPSEEDC_DEFICIT C used for crop seed that needs to be repaid gC/m^2 T - 833 XSMRPOOL_LOSS temporary photosynthate C pool loss gC/m^2 F - 834 WOODC wood C gC/m^2 T - 835 LEAFC leaf C gC/m^2 T - 836 LEAFC_STORAGE leaf C storage gC/m^2 F - 837 LEAFC_XFER leaf C transfer gC/m^2 F - 838 LEAFC_STORAGE_XFER_ACC Accumulated leaf C transfer gC/m^2 F - 839 STORAGE_CDEMAND C use from the C storage pool gC/m^2 F - 840 FROOTC fine root C gC/m^2 T - 841 FROOTC_STORAGE fine root C storage gC/m^2 F - 842 FROOTC_XFER fine root C transfer gC/m^2 F - 843 LIVESTEMC live stem C gC/m^2 T - 844 LIVESTEMC_STORAGE live stem C storage gC/m^2 F - 845 LIVESTEMC_XFER live stem C transfer gC/m^2 F - 846 DEADSTEMC dead stem C gC/m^2 T - 847 DEADSTEMC_STORAGE dead stem C storage gC/m^2 F - 848 DEADSTEMC_XFER dead stem C transfer gC/m^2 F - 849 LIVECROOTC live coarse root C gC/m^2 T - 850 LIVECROOTC_STORAGE live coarse root C storage gC/m^2 F - 851 LIVECROOTC_XFER live coarse root C transfer gC/m^2 F - 852 DEADCROOTC dead coarse root C gC/m^2 T - 853 DEADCROOTC_STORAGE dead coarse root C storage gC/m^2 F - 854 DEADCROOTC_XFER dead coarse root C transfer gC/m^2 F - 855 GRESP_STORAGE growth respiration storage gC/m^2 F - 856 GRESP_XFER growth respiration transfer gC/m^2 F - 857 CPOOL temporary photosynthate C pool gC/m^2 T - 858 XSMRPOOL temporary photosynthate C pool gC/m^2 T - 859 PFT_CTRUNC patch-level sink for C truncation gC/m^2 F - 860 DISPVEGC displayed veg carbon, excluding storage and cpool gC/m^2 T - 861 STORVEGC stored vegetation carbon, excluding cpool gC/m^2 T - 862 TOTVEGC total vegetation carbon, excluding cpool gC/m^2 T - 863 TOTPFTC total patch-level carbon, including cpool gC/m^2 T - 864 SEEDC pool for seeding new PFTs via dynamic landcover gC/m^2 T - 865 FUELC fuel load gC/m^2 T - 866 TOTCOLC total column carbon, incl veg and cpool but excl product pools gC/m^2 T - 867 TOTECOSYSC total ecosystem carbon, incl veg but excl cpool and product pools gC/m^2 T - 868 GRAINC_TO_FOOD grain C to food gC/m^2/s T - 869 LEAFC_TO_BIOFUELC leaf C to biofuel C gC/m^2/s T - 870 LIVESTEMC_TO_BIOFUELC livestem C to biofuel C gC/m^2/s T - 871 GRAINC_TO_SEED grain C to seed gC/m^2/s T - 872 LITTERC_LOSS litter C loss gC/m^2/s T - 873 WOODC_ALLOC wood C eallocation gC/m^2/s T - 874 WOODC_LOSS wood C loss gC/m^2/s T - 875 LEAFC_LOSS leaf C loss gC/m^2/s T - 876 LEAFC_ALLOC leaf C allocation gC/m^2/s T - 877 FROOTC_LOSS fine root C loss gC/m^2/s T - 878 FROOTC_ALLOC fine root C allocation gC/m^2/s T - 879 M_LEAFC_TO_LITTER leaf C mortality gC/m^2/s F - 880 M_FROOTC_TO_LITTER fine root C mortality gC/m^2/s F - 881 M_LEAFC_STORAGE_TO_LITTER leaf C storage mortality gC/m^2/s F - 882 M_FROOTC_STORAGE_TO_LITTER fine root C storage mortality gC/m^2/s F - 883 M_LIVESTEMC_STORAGE_TO_LITTER live stem C storage mortality gC/m^2/s F - 884 M_DEADSTEMC_STORAGE_TO_LITTER dead stem C storage mortality gC/m^2/s F - 885 M_LIVECROOTC_STORAGE_TO_LITTER live coarse root C storage mortality gC/m^2/s F - 886 M_DEADCROOTC_STORAGE_TO_LITTER dead coarse root C storage mortality gC/m^2/s F - 887 M_LEAFC_XFER_TO_LITTER leaf C transfer mortality gC/m^2/s F - 888 M_FROOTC_XFER_TO_LITTER fine root C transfer mortality gC/m^2/s F - 889 M_LIVESTEMC_XFER_TO_LITTER live stem C transfer mortality gC/m^2/s F - 890 M_DEADSTEMC_XFER_TO_LITTER dead stem C transfer mortality gC/m^2/s F - 891 M_LIVECROOTC_XFER_TO_LITTER live coarse root C transfer mortality gC/m^2/s F - 892 M_DEADCROOTC_XFER_TO_LITTER dead coarse root C transfer mortality gC/m^2/s F - 893 M_LIVESTEMC_TO_LITTER live stem C mortality gC/m^2/s F - 894 M_DEADSTEMC_TO_LITTER dead stem C mortality gC/m^2/s F - 895 M_LIVECROOTC_TO_LITTER live coarse root C mortality gC/m^2/s F - 896 M_DEADCROOTC_TO_LITTER dead coarse root C mortality gC/m^2/s F - 897 M_GRESP_STORAGE_TO_LITTER growth respiration storage mortality gC/m^2/s F - 898 M_GRESP_XFER_TO_LITTER growth respiration transfer mortality gC/m^2/s F - 899 M_LEAFC_TO_FIRE leaf C fire loss gC/m^2/s F - 900 M_LEAFC_STORAGE_TO_FIRE leaf C storage fire loss gC/m^2/s F - 901 M_LEAFC_XFER_TO_FIRE leaf C transfer fire loss gC/m^2/s F - 902 M_LIVESTEMC_TO_FIRE live stem C fire loss gC/m^2/s F - 903 M_LIVESTEMC_STORAGE_TO_FIRE live stem C storage fire loss gC/m^2/s F - 904 M_LIVESTEMC_XFER_TO_FIRE live stem C transfer fire loss gC/m^2/s F - 905 M_DEADSTEMC_TO_FIRE dead stem C fire loss gC/m^2/s F - 906 M_DEADSTEMC_STORAGE_TO_FIRE dead stem C storage fire loss gC/m^2/s F - 907 M_DEADSTEMC_XFER_TO_FIRE dead stem C transfer fire loss gC/m^2/s F - 908 M_FROOTC_TO_FIRE fine root C fire loss gC/m^2/s F - 909 M_FROOTC_STORAGE_TO_FIRE fine root C storage fire loss gC/m^2/s F - 910 M_FROOTC_XFER_TO_FIRE fine root C transfer fire loss gC/m^2/s F - 911 M_LIVEROOTC_TO_FIRE live root C fire loss gC/m^2/s F - 912 M_LIVEROOTC_STORAGE_TO_FIRE live root C storage fire loss gC/m^2/s F - 913 M_LIVEROOTC_XFER_TO_FIRE live root C transfer fire loss gC/m^2/s F - 914 M_DEADROOTC_TO_FIRE dead root C fire loss gC/m^2/s F - 915 M_DEADROOTC_STORAGE_TO_FIRE dead root C storage fire loss gC/m^2/s F - 916 M_DEADROOTC_XFER_TO_FIRE dead root C transfer fire loss gC/m^2/s F - 917 M_GRESP_STORAGE_TO_FIRE growth respiration storage fire loss gC/m^2/s F - 918 M_GRESP_XFER_TO_FIRE growth respiration transfer fire loss gC/m^2/s F - 919 M_LEAFC_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s F - 920 M_LEAFC_STORAGE_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s F - 921 M_LEAFC_XFER_TO_LITTER_FIRE leaf C transfer fire mortality to litter gC/m^2/s F - 922 M_LIVESTEMC_TO_LITTER_FIRE live stem C fire mortality to litter gC/m^2/s F - 923 M_LIVESTEMC_STORAGE_TO_LITTER_FIRE live stem C storage fire mortality to litter gC/m^2/s F - 924 M_LIVESTEMC_XFER_TO_LITTER_FIRE live stem C transfer fire mortality to litter gC/m^2/s F - 925 M_LIVESTEMC_TO_DEADSTEMC_FIRE live stem C fire mortality to dead stem C gC/m^2/s F - 926 M_DEADSTEMC_TO_LITTER_FIRE dead stem C fire mortality to litter gC/m^2/s F - 927 M_DEADSTEMC_STORAGE_TO_LITTER_FIRE dead stem C storage fire mortality to litter gC/m^2/s F - 928 M_DEADSTEMC_XFER_TO_LITTER_FIRE dead stem C transfer fire mortality to litter gC/m^2/s F - 929 M_FROOTC_TO_LITTER_FIRE fine root C fire mortality to litter gC/m^2/s F - 930 M_FROOTC_STORAGE_TO_LITTER_FIRE fine root C storage fire mortality to litter gC/m^2/s F - 931 M_FROOTC_XFER_TO_LITTER_FIRE fine root C transfer fire mortality to litter gC/m^2/s F - 932 M_LIVEROOTC_TO_LITTER_FIRE live root C fire mortality to litter gC/m^2/s F - 933 M_LIVEROOTC_STORAGE_TO_LITTER_FIRE live root C storage fire mortality to litter gC/m^2/s F - 934 M_LIVEROOTC_XFER_TO_LITTER_FIRE live root C transfer fire mortality to litter gC/m^2/s F - 935 M_LIVEROOTC_TO_DEADROOTC_FIRE live root C fire mortality to dead root C gC/m^2/s F - 936 M_DEADROOTC_TO_LITTER_FIRE dead root C fire mortality to litter gC/m^2/s F - 937 M_DEADROOTC_STORAGE_TO_LITTER_FIRE dead root C storage fire mortality to litter gC/m^2/s F - 938 M_DEADROOTC_XFER_TO_LITTER_FIRE dead root C transfer fire mortality to litter gC/m^2/s F - 939 M_LIVECROOTC_STORAGE_TO_LITTER_FIRE live coarse root C fire mortality to litter gC/m^2/s F - 940 M_DEADCROOTC_STORAGE_TO_LITTER_FIRE dead coarse root C storage fire mortality to litter gC/m^2/s F - 941 M_GRESP_STORAGE_TO_LITTER_FIRE growth respiration storage fire mortality to litter gC/m^2/s F - 942 M_GRESP_XFER_TO_LITTER_FIRE growth respiration transfer fire mortality to litter gC/m^2/s F - 943 LEAFC_XFER_TO_LEAFC leaf C growth from storage gC/m^2/s F - 944 FROOTC_XFER_TO_FROOTC fine root C growth from storage gC/m^2/s F - 945 LIVESTEMC_XFER_TO_LIVESTEMC live stem C growth from storage gC/m^2/s F - 946 DEADSTEMC_XFER_TO_DEADSTEMC dead stem C growth from storage gC/m^2/s F - 947 LIVECROOTC_XFER_TO_LIVECROOTC live coarse root C growth from storage gC/m^2/s F - 948 DEADCROOTC_XFER_TO_DEADCROOTC dead coarse root C growth from storage gC/m^2/s F - 949 LEAFC_TO_LITTER leaf C litterfall gC/m^2/s F - 950 LEAFC_TO_LITTER_FUN leaf C litterfall used by FUN gC/m^2/s T - 951 FROOTC_TO_LITTER fine root C litterfall gC/m^2/s F - 952 EXCESSC_MR excess C maintenance respiration gC/m^2/s F - 953 LEAF_MR leaf maintenance respiration gC/m^2/s T - 954 FROOT_MR fine root maintenance respiration gC/m^2/s F - 955 LIVESTEM_MR live stem maintenance respiration gC/m^2/s F - 956 LIVECROOT_MR live coarse root maintenance respiration gC/m^2/s F - 957 PSNSUN_TO_CPOOL C fixation from sunlit canopy gC/m^2/s T - 958 PSNSHADE_TO_CPOOL C fixation from shaded canopy gC/m^2/s T - 959 CPOOL_TO_LEAFC allocation to leaf C gC/m^2/s F - 960 CPOOL_TO_LEAFC_STORAGE allocation to leaf C storage gC/m^2/s F - 961 CPOOL_TO_FROOTC allocation to fine root C gC/m^2/s F - 962 CPOOL_TO_FROOTC_STORAGE allocation to fine root C storage gC/m^2/s F - 963 CPOOL_TO_LIVESTEMC allocation to live stem C gC/m^2/s F - 964 CPOOL_TO_LIVESTEMC_STORAGE allocation to live stem C storage gC/m^2/s F - 965 CPOOL_TO_DEADSTEMC allocation to dead stem C gC/m^2/s F - 966 CPOOL_TO_DEADSTEMC_STORAGE allocation to dead stem C storage gC/m^2/s F - 967 CPOOL_TO_LIVECROOTC allocation to live coarse root C gC/m^2/s F - 968 CPOOL_TO_LIVECROOTC_STORAGE allocation to live coarse root C storage gC/m^2/s F - 969 CPOOL_TO_DEADCROOTC allocation to dead coarse root C gC/m^2/s F - 970 CPOOL_TO_DEADCROOTC_STORAGE allocation to dead coarse root C storage gC/m^2/s F - 971 CPOOL_TO_GRESP_STORAGE allocation to growth respiration storage gC/m^2/s F - 972 CPOOL_LEAF_GR leaf growth respiration gC/m^2/s F - 973 CPOOL_LEAF_STORAGE_GR leaf growth respiration to storage gC/m^2/s F - 974 TRANSFER_LEAF_GR leaf growth respiration from storage gC/m^2/s F - 975 CPOOL_FROOT_GR fine root growth respiration gC/m^2/s F - 976 CPOOL_FROOT_STORAGE_GR fine root growth respiration to storage gC/m^2/s F - 977 TRANSFER_FROOT_GR fine root growth respiration from storage gC/m^2/s F - 978 CPOOL_LIVESTEM_GR live stem growth respiration gC/m^2/s F - 979 CPOOL_LIVESTEM_STORAGE_GR live stem growth respiration to storage gC/m^2/s F - 980 TRANSFER_LIVESTEM_GR live stem growth respiration from storage gC/m^2/s F - 981 CPOOL_DEADSTEM_GR dead stem growth respiration gC/m^2/s F - 982 CPOOL_DEADSTEM_STORAGE_GR dead stem growth respiration to storage gC/m^2/s F - 983 TRANSFER_DEADSTEM_GR dead stem growth respiration from storage gC/m^2/s F - 984 CPOOL_LIVECROOT_GR live coarse root growth respiration gC/m^2/s F - 985 CPOOL_LIVECROOT_STORAGE_GR live coarse root growth respiration to storage gC/m^2/s F - 986 TRANSFER_LIVECROOT_GR live coarse root growth respiration from storage gC/m^2/s F - 987 CPOOL_DEADCROOT_GR dead coarse root growth respiration gC/m^2/s F - 988 CPOOL_DEADCROOT_STORAGE_GR dead coarse root growth respiration to storage gC/m^2/s F - 989 TRANSFER_DEADCROOT_GR dead coarse root growth respiration from storage gC/m^2/s F - 990 LEAFC_STORAGE_TO_XFER leaf C shift storage to transfer gC/m^2/s F - 991 FROOTC_STORAGE_TO_XFER fine root C shift storage to transfer gC/m^2/s F - 992 LIVESTEMC_STORAGE_TO_XFER live stem C shift storage to transfer gC/m^2/s F - 993 DEADSTEMC_STORAGE_TO_XFER dead stem C shift storage to transfer gC/m^2/s F - 994 LIVECROOTC_STORAGE_TO_XFER live coarse root C shift storage to transfer gC/m^2/s F - 995 DEADCROOTC_STORAGE_TO_XFER dead coarse root C shift storage to transfer gC/m^2/s F - 996 GRESP_STORAGE_TO_XFER growth respiration shift storage to transfer gC/m^2/s F - 997 LIVESTEMC_TO_DEADSTEMC live stem C turnover gC/m^2/s F - 998 LIVECROOTC_TO_DEADCROOTC live coarse root C turnover gC/m^2/s F - 999 INIT_GPP GPP flux before downregulation gC/m^2/s F -1000 CURRENT_GR growth resp for new growth displayed in this timestep gC/m^2/s F -1001 TRANSFER_GR growth resp for transfer growth displayed in this timestep gC/m^2/s F -1002 STORAGE_GR growth resp for growth sent to storage for later display gC/m^2/s F -1003 AVAILC C flux available for allocation gC/m^2/s F -1004 PLANT_CALLOC total allocated C flux gC/m^2/s F -1005 EXCESS_CFLUX C flux not allocated due to downregulation gC/m^2/s F -1006 PREV_LEAFC_TO_LITTER previous timestep leaf C litterfall flux gC/m^2/s F -1007 PREV_FROOTC_TO_LITTER previous timestep froot C litterfall flux gC/m^2/s F -1008 XSMRPOOL_RECOVER C flux assigned to recovery of negative xsmrpool gC/m^2/s T -1009 GPP gross primary production gC/m^2/s T -1010 RR root respiration (fine root MR + total root GR) gC/m^2/s T -1011 MR maintenance respiration gC/m^2/s T -1012 GR total growth respiration gC/m^2/s T -1013 AR autotrophic respiration (MR + GR) gC/m^2/s T -1014 NPP net primary production gC/m^2/s T -1015 AGNPP aboveground NPP gC/m^2/s T -1016 BGNPP belowground NPP gC/m^2/s T -1017 LITFALL litterfall (leaves and fine roots) gC/m^2/s T -1018 WOOD_HARVESTC wood harvest carbon (to product pools) gC/m^2/s T -1019 SLASH_HARVESTC slash harvest carbon (to litter) gC/m^2/s T -1020 PFT_FIRE_CLOSS total patch-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T -1021 NPP_NACTIVE Mycorrhizal N uptake used C gC/m^2/s T -1022 NPP_BURNEDOFF C that cannot be used for N uptake gC/m^2/s F -1023 NPP_NNONMYC Non-mycorrhizal N uptake used C gC/m^2/s T -1024 NPP_NAM AM-associated N uptake used C gC/m^2/s T -1025 NPP_NECM ECM-associated N uptake used C gC/m^2/s T -1026 NPP_NACTIVE_NO3 Mycorrhizal N uptake used C gC/m^2/s T -1027 NPP_NACTIVE_NH4 Mycorrhizal N uptake use C gC/m^2/s T -1028 NPP_NNONMYC_NO3 Non-mycorrhizal N uptake use C gC/m^2/s T -1029 NPP_NNONMYC_NH4 Non-mycorrhizal N uptake use C gC/m^2/s T -1030 NPP_NAM_NO3 AM-associated N uptake use C gC/m^2/s T -1031 NPP_NAM_NH4 AM-associated N uptake use C gC/m^2/s T -1032 NPP_NECM_NO3 ECM-associated N uptake used C gC/m^2/s T -1033 NPP_NECM_NH4 ECM-associated N uptake use C gC/m^2/s T -1034 NPP_NFIX Symbiotic BNF uptake used C gC/m^2/s T -1035 NPP_NRETRANS Retranslocated N uptake flux gC/m^2/s T -1036 NPP_NUPTAKE Total C used by N uptake in FUN gC/m^2/s T -1037 NPP_GROWTH Total C used for growth in FUN gC/m^2/s T -1038 LEAFC_CHANGE C change in leaf gC/m^2/s T -1039 SOILC_CHANGE C change in soil gC/m^2/s T -1040 CWDC_LOSS coarse woody debris C loss gC/m^2/s T -1041 M_LITR1C_TO_FIRE litter 1 C fire loss gC/m^2/s F -1042 M_LITR1C_TO_FIRE_vr litter 1 C fire loss gC/m^3/s F -1043 M_LITR2C_TO_FIRE litter 2 C fire loss gC/m^2/s F -1044 M_LITR2C_TO_FIRE_vr litter 2 C fire loss gC/m^3/s F -1045 M_LITR3C_TO_FIRE litter 3 C fire loss gC/m^2/s F -1046 M_LITR3C_TO_FIRE_vr litter 3 C fire loss gC/m^3/s F -1047 M_CWDC_TO_FIRE coarse woody debris C fire loss gC/m^2/s F -1048 M_CWDC_TO_FIRE_vr coarse woody debris C fire loss gC/m^3/s F -1049 DWT_SEEDC_TO_LEAF seed source to patch-level leaf gC/m^2/s F -1050 DWT_SEEDC_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gC/m^2/s F -1051 DWT_SEEDC_TO_DEADSTEM seed source to patch-level deadstem gC/m^2/s F -1052 DWT_SEEDC_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gC/m^2/s F -1053 DWT_CONV_CFLUX conversion C flux (immediate loss to atm) (0 at all times except first timestep of year) gC/m^2/s T -1054 DWT_CONV_CFLUX_PATCH patch-level conversion C flux (immediate loss to atm) (0 at all times except first timestep of gC/m^2/s F -1055 DWT_CONV_CFLUX_DRIBBLED conversion C flux (immediate loss to atm), dribbled throughout the year gC/m^2/s T -1056 DWT_WOOD_PRODUCTC_GAIN_PATCH patch-level landcover change-driven addition to wood product pools(0 at all times except first gC/m^2/s F -1057 DWT_SLASH_CFLUX slash C flux (to litter diagnostic only) (0 at all times except first timestep of year) gC/m^2/s T -1058 DWT_SLASH_CFLUX_PATCH patch-level slash C flux (to litter diagnostic only) (0 at all times except first timestep of gC/m^2/s F -1059 DWT_FROOTC_TO_LITR_MET_C fine root to litter due to landcover change gC/m^2/s F -1060 DWT_FROOTC_TO_LITR_CEL_C fine root to litter due to landcover change gC/m^2/s F -1061 DWT_FROOTC_TO_LITR_LIG_C fine root to litter due to landcover change gC/m^2/s F -1062 DWT_LIVECROOTC_TO_CWDC live coarse root to CWD due to landcover change gC/m^2/s F -1063 DWT_DEADCROOTC_TO_CWDC dead coarse root to CWD due to landcover change gC/m^2/s F -1064 CROP_SEEDC_TO_LEAF crop seed source to leaf gC/m^2/s F -1065 SR total soil respiration (HR + root resp) gC/m^2/s T -1066 ER total ecosystem respiration, autotrophic + heterotrophic gC/m^2/s T -1067 LITFIRE litter fire losses gC/m^2/s F -1068 SOMFIRE soil organic matter fire losses gC/m^2/s F -1069 TOTFIRE total ecosystem fire losses gC/m^2/s F -1070 COL_FIRE_CLOSS total column-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T -1071 ANNSUM_NPP annual sum of NPP gC/m^2/yr F -1072 CANNSUM_NPP annual sum of column-level NPP gC/m^2/s F -1073 NEP net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink gC/m^2/s T -1074 NBP net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux (latter smoothed o gC/m^2/s T -1075 NEE net ecosystem exchange of carbon, includes fire and hrv_xsmrpool (latter smoothed over the yea gC/m^2/s T -1076 LAND_USE_FLUX total C emitted from land cover conversion (smoothed over the year) and wood and grain product gC/m^2/s T -1077 GRAINN grain N gN/m^2 T -1078 CROPSEEDN_DEFICIT N used for crop seed that needs to be repaid gN/m^2 F -1079 LEAFN leaf N gN/m^2 T -1080 LEAFN_STORAGE leaf N storage gN/m^2 F -1081 LEAFN_XFER leaf N transfer gN/m^2 F -1082 LEAFN_STORAGE_XFER_ACC Accmulated leaf N transfer gN/m^2 F -1083 STORAGE_NDEMAND N demand during the offset period gN/m^2 F -1084 FROOTN fine root N gN/m^2 T -1085 FROOTN_STORAGE fine root N storage gN/m^2 F -1086 FROOTN_XFER fine root N transfer gN/m^2 F -1087 LIVESTEMN live stem N gN/m^2 T -1088 LIVESTEMN_STORAGE live stem N storage gN/m^2 F -1089 LIVESTEMN_XFER live stem N transfer gN/m^2 F -1090 DEADSTEMN dead stem N gN/m^2 T -1091 DEADSTEMN_STORAGE dead stem N storage gN/m^2 F -1092 DEADSTEMN_XFER dead stem N transfer gN/m^2 F -1093 LIVECROOTN live coarse root N gN/m^2 T -1094 LIVECROOTN_STORAGE live coarse root N storage gN/m^2 F -1095 LIVECROOTN_XFER live coarse root N transfer gN/m^2 F -1096 DEADCROOTN dead coarse root N gN/m^2 T -1097 DEADCROOTN_STORAGE dead coarse root N storage gN/m^2 F -1098 DEADCROOTN_XFER dead coarse root N transfer gN/m^2 F -1099 RETRANSN plant pool of retranslocated N gN/m^2 T -1100 NPOOL temporary plant N pool gN/m^2 T -1101 PFT_NTRUNC patch-level sink for N truncation gN/m^2 F -1102 DISPVEGN displayed vegetation nitrogen gN/m^2 T -1103 STORVEGN stored vegetation nitrogen gN/m^2 T -1104 TOTVEGN total vegetation nitrogen gN/m^2 T -1105 TOTPFTN total patch-level nitrogen gN/m^2 T -1106 SEEDN pool for seeding new PFTs via dynamic landcover gN/m^2 T -1107 TOTECOSYSN total ecosystem N, excluding product pools gN/m^2 T -1108 TOTCOLN total column-level N, excluding product pools gN/m^2 T -1109 M_LEAFN_TO_LITTER leaf N mortality gN/m^2/s F -1110 M_FROOTN_TO_LITTER fine root N mortality gN/m^2/s F -1111 M_LEAFN_STORAGE_TO_LITTER leaf N storage mortality gN/m^2/s F -1112 M_FROOTN_STORAGE_TO_LITTER fine root N storage mortality gN/m^2/s F -1113 M_LIVESTEMN_STORAGE_TO_LITTER live stem N storage mortality gN/m^2/s F -1114 M_DEADSTEMN_STORAGE_TO_LITTER dead stem N storage mortality gN/m^2/s F -1115 M_LIVECROOTN_STORAGE_TO_LITTER live coarse root N storage mortality gN/m^2/s F -1116 M_DEADCROOTN_STORAGE_TO_LITTER dead coarse root N storage mortality gN/m^2/s F -1117 M_LEAFN_XFER_TO_LITTER leaf N transfer mortality gN/m^2/s F -1118 M_FROOTN_XFER_TO_LITTER fine root N transfer mortality gN/m^2/s F -1119 M_LIVESTEMN_XFER_TO_LITTER live stem N transfer mortality gN/m^2/s F -1120 M_DEADSTEMN_XFER_TO_LITTER dead stem N transfer mortality gN/m^2/s F -1121 M_LIVECROOTN_XFER_TO_LITTER live coarse root N transfer mortality gN/m^2/s F -1122 M_DEADCROOTN_XFER_TO_LITTER dead coarse root N transfer mortality gN/m^2/s F -1123 M_LIVESTEMN_TO_LITTER live stem N mortality gN/m^2/s F -1124 M_DEADSTEMN_TO_LITTER dead stem N mortality gN/m^2/s F -1125 M_LIVECROOTN_TO_LITTER live coarse root N mortality gN/m^2/s F -1126 M_DEADCROOTN_TO_LITTER dead coarse root N mortality gN/m^2/s F -1127 M_RETRANSN_TO_LITTER retranslocated N pool mortality gN/m^2/s F -1128 M_LEAFN_TO_FIRE leaf N fire loss gN/m^2/s F -1129 M_FROOTN_TO_FIRE fine root N fire loss gN/m^2/s F -1130 M_LEAFN_STORAGE_TO_FIRE leaf N storage fire loss gN/m^2/s F -1131 M_FROOTN_STORAGE_TO_FIRE fine root N storage fire loss gN/m^2/s F -1132 M_LIVESTEMN_STORAGE_TO_FIRE live stem N storage fire loss gN/m^2/s F -1133 M_DEADSTEMN_STORAGE_TO_FIRE dead stem N storage fire loss gN/m^2/s F -1134 M_LIVECROOTN_STORAGE_TO_FIRE live coarse root N storage fire loss gN/m^2/s F -1135 M_DEADCROOTN_STORAGE_TO_FIRE dead coarse root N storage fire loss gN/m^2/s F -1136 M_LEAFN_XFER_TO_FIRE leaf N transfer fire loss gN/m^2/s F -1137 M_FROOTN_XFER_TO_FIRE fine root N transfer fire loss gN/m^2/s F -1138 M_LIVESTEMN_XFER_TO_FIRE live stem N transfer fire loss gN/m^2/s F -1139 M_DEADSTEMN_XFER_TO_FIRE dead stem N transfer fire loss gN/m^2/s F -1140 M_LIVECROOTN_XFER_TO_FIRE live coarse root N transfer fire loss gN/m^2/s F -1141 M_DEADCROOTN_XFER_TO_FIRE dead coarse root N transfer fire loss gN/m^2/s F -1142 M_LIVESTEMN_TO_FIRE live stem N fire loss gN/m^2/s F -1143 M_DEADSTEMN_TO_FIRE dead stem N fire loss gN/m^2/s F -1144 M_DEADSTEMN_TO_LITTER_FIRE dead stem N fire mortality to litter gN/m^2/s F -1145 M_LIVECROOTN_TO_FIRE live coarse root N fire loss gN/m^2/s F -1146 M_DEADCROOTN_TO_FIRE dead coarse root N fire loss gN/m^2/s F -1147 M_DEADCROOTN_TO_LITTER_FIRE dead coarse root N fire mortality to litter gN/m^2/s F -1148 M_RETRANSN_TO_FIRE retranslocated N pool fire loss gN/m^2/s F -1149 LEAFN_XFER_TO_LEAFN leaf N growth from storage gN/m^2/s F -1150 FROOTN_XFER_TO_FROOTN fine root N growth from storage gN/m^2/s F -1151 LIVESTEMN_XFER_TO_LIVESTEMN live stem N growth from storage gN/m^2/s F -1152 DEADSTEMN_XFER_TO_DEADSTEMN dead stem N growth from storage gN/m^2/s F -1153 LIVECROOTN_XFER_TO_LIVECROOTN live coarse root N growth from storage gN/m^2/s F -1154 DEADCROOTN_XFER_TO_DEADCROOTN dead coarse root N growth from storage gN/m^2/s F -1155 LEAFN_TO_LITTER leaf N litterfall gN/m^2/s T -1156 LEAFN_TO_RETRANSN leaf N to retranslocated N pool gN/m^2/s F -1157 FROOTN_TO_LITTER fine root N litterfall gN/m^2/s F -1158 RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s T -1159 FREE_RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s T -1160 SMINN_TO_NPOOL deployment of soil mineral N uptake gN/m^2/s T -1161 NPOOL_TO_LEAFN allocation to leaf N gN/m^2/s F -1162 NPOOL_TO_LEAFN_STORAGE allocation to leaf N storage gN/m^2/s F -1163 NPOOL_TO_FROOTN allocation to fine root N gN/m^2/s F -1164 NPOOL_TO_FROOTN_STORAGE allocation to fine root N storage gN/m^2/s F -1165 NPOOL_TO_LIVESTEMN allocation to live stem N gN/m^2/s F -1166 NPOOL_TO_LIVESTEMN_STORAGE allocation to live stem N storage gN/m^2/s F -1167 NPOOL_TO_DEADSTEMN allocation to dead stem N gN/m^2/s F -1168 NPOOL_TO_DEADSTEMN_STORAGE allocation to dead stem N storage gN/m^2/s F -1169 NPOOL_TO_LIVECROOTN allocation to live coarse root N gN/m^2/s F -1170 NPOOL_TO_LIVECROOTN_STORAGE allocation to live coarse root N storage gN/m^2/s F -1171 NPOOL_TO_DEADCROOTN allocation to dead coarse root N gN/m^2/s F -1172 NPOOL_TO_DEADCROOTN_STORAGE allocation to dead coarse root N storage gN/m^2/s F -1173 LEAFN_STORAGE_TO_XFER leaf N shift storage to transfer gN/m^2/s F -1174 FROOTN_STORAGE_TO_XFER fine root N shift storage to transfer gN/m^2/s F -1175 LIVESTEMN_STORAGE_TO_XFER live stem N shift storage to transfer gN/m^2/s F -1176 DEADSTEMN_STORAGE_TO_XFER dead stem N shift storage to transfer gN/m^2/s F -1177 LIVECROOTN_STORAGE_TO_XFER live coarse root N shift storage to transfer gN/m^2/s F -1178 DEADCROOTN_STORAGE_TO_XFER dead coarse root N shift storage to transfer gN/m^2/s F -1179 LIVESTEMN_TO_DEADSTEMN live stem N turnover gN/m^2/s F -1180 LIVESTEMN_TO_RETRANSN live stem N to retranslocated N pool gN/m^2/s F -1181 LIVECROOTN_TO_DEADCROOTN live coarse root N turnover gN/m^2/s F -1182 LIVECROOTN_TO_RETRANSN live coarse root N to retranslocated N pool gN/m^2/s F -1183 NDEPLOY total N deployed in new growth gN/m^2/s T -1184 WOOD_HARVESTN wood harvest N (to product pools) gN/m^2/s T -1185 PFT_FIRE_NLOSS total patch-level fire N loss gN/m^2/s T -1186 NFERTILIZATION fertilizer added gN/m^2/s T -1187 FERT_COUNTER time left to fertilize seconds F -1188 M_LITR1N_TO_FIRE litter 1 N fire loss gN/m^2 F -1189 M_LITR1N_TO_FIRE_vr litter 1 N fire loss gN/m^3 F -1190 M_LITR2N_TO_FIRE litter 2 N fire loss gN/m^2 F -1191 M_LITR2N_TO_FIRE_vr litter 2 N fire loss gN/m^3 F -1192 M_LITR3N_TO_FIRE litter 3 N fire loss gN/m^2 F -1193 M_LITR3N_TO_FIRE_vr litter 3 N fire loss gN/m^3 F -1194 M_CWDN_TO_FIRE coarse woody debris N fire loss gN/m^2 F -1195 M_CWDN_TO_FIRE_vr coarse woody debris N fire loss gN/m^3 F -1196 COL_FIRE_NLOSS total column-level fire N loss gN/m^2/s T -1197 DWT_SEEDN_TO_LEAF seed source to patch-level leaf gN/m^2/s T -1198 DWT_SEEDN_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gN/m^2/s F -1199 DWT_SEEDN_TO_DEADSTEM seed source to patch-level deadstem gN/m^2/s T -1200 DWT_SEEDN_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gN/m^2/s F -1201 DWT_CONV_NFLUX conversion N flux (immediate loss to atm) (0 at all times except first timestep of year) gN/m^2/s T -1202 DWT_CONV_NFLUX_PATCH patch-level conversion N flux (immediate loss to atm) (0 at all times except first timestep of gN/m^2/s F -1203 DWT_FROOTN_TO_LITR_MET_N fine root to litter due to landcover change gN/m^2/s F -1204 DWT_FROOTN_TO_LITR_CEL_N fine root to litter due to landcover change gN/m^2/s F -1205 DWT_FROOTN_TO_LITR_LIG_N fine root to litter due to landcover change gN/m^2/s F -1206 DWT_LIVECROOTN_TO_CWDN live coarse root to CWD due to landcover change gN/m^2/s F -1207 DWT_DEADCROOTN_TO_CWDN dead coarse root to CWD due to landcover change gN/m^2/s F -1208 CROP_SEEDN_TO_LEAF crop seed source to leaf gN/m^2/s F -1209 PLANT_NDEMAND N flux required to support initial GPP gN/m^2/s T -1210 AVAIL_RETRANSN N flux available from retranslocation pool gN/m^2/s F -1211 PLANT_NALLOC total allocated N flux gN/m^2/s F -1212 NACTIVE Mycorrhizal N uptake flux gN/m^2/s T -1213 NNONMYC Non-mycorrhizal N uptake flux gN/m^2/s T -1214 NAM AM-associated N uptake flux gN/m^2/s T -1215 NECM ECM-associated N uptake flux gN/m^2/s T -1216 NACTIVE_NO3 Mycorrhizal N uptake flux gN/m^2/s T -1217 NACTIVE_NH4 Mycorrhizal N uptake flux gN/m^2/s T -1218 NNONMYC_NO3 Non-mycorrhizal N uptake flux gN/m^2/s T -1219 NNONMYC_NH4 Non-mycorrhizal N uptake flux gN/m^2/s T -1220 NAM_NO3 AM-associated N uptake flux gN/m^2/s T -1221 NAM_NH4 AM-associated N uptake flux gN/m^2/s T -1222 NECM_NO3 ECM-associated N uptake flux gN/m^2/s T -1223 NECM_NH4 ECM-associated N uptake flux gN/m^2/s T -1224 NPASSIVE Passive N uptake flux gN/m^2/s T -1225 NFIX Symbiotic BNF uptake flux gN/m^2/s T -1226 NRETRANS Retranslocated N uptake flux gN/m^2/s T -1227 NRETRANS_REG Retranslocated N uptake flux gN/m^2/s T -1228 NRETRANS_SEASON Retranslocated N uptake flux gN/m^2/s T -1229 NRETRANS_STRESS Retranslocated N uptake flux gN/m^2/s T -1230 NUPTAKE Total N uptake of FUN gN/m^2/s T -1231 SMINN_TO_PLANT_FUN Total soil N uptake of FUN gN/m^2/s T -1232 COST_NFIX Cost of fixation gN/gC T -1233 COST_NACTIVE Cost of active uptake gN/gC T -1234 COST_NRETRANS Cost of retranslocation gN/gC T -1235 NUPTAKE_NPP_FRACTION frac of NPP used in N uptake - T -1236 CROPPROD1C 1-yr crop product (grain+biofuel) C gC/m^2 T -1237 PROD10C 10-yr wood product C gC/m^2 F -1238 PROD100C 100-yr wood product C gC/m^2 F -1239 TOT_WOODPRODC total wood product C gC/m^2 T -1240 DWT_PROD10C_GAIN landcover change-driven addition to 10-yr wood product pool gC/m^2/s F -1241 DWT_PROD100C_GAIN landcover change-driven addition to 100-yr wood product pool gC/m^2/s F -1242 DWT_WOODPRODC_GAIN landcover change-driven addition to wood product pools gC/m^2/s T -1243 DWT_CROPPROD1C_GAIN landcover change-driven addition to 1-year crop product pool gC/m^2/s T -1244 CROPPROD1C_LOSS loss from 1-yr crop product pool gC/m^2/s T -1245 PROD10C_LOSS loss from 10-yr wood product pool gC/m^2/s F -1246 PROD100C_LOSS loss from 100-yr wood product pool gC/m^2/s F -1247 TOT_WOODPRODC_LOSS total loss from wood product pools gC/m^2/s T -1248 CROPPROD1N 1-yr crop product (grain+biofuel) N gN/m^2 T -1249 PROD10N 10-yr wood product N gN/m^2 F -1250 PROD100N 100-yr wood product N gN/m^2 F -1251 TOT_WOODPRODN total wood product N gN/m^2 T -1252 DWT_PROD10N_GAIN landcover change-driven addition to 10-yr wood product pool gN/m^2/s F -1253 DWT_PROD100N_GAIN landcover change-driven addition to 100-yr wood product pool gN/m^2/s F -1254 DWT_WOODPRODN_GAIN landcover change-driven addition to wood product pools gN/m^2/s T -1255 DWT_CROPPROD1N_GAIN landcover change-driven addition to 1-year crop product pool gN/m^2/s T -1256 CROPPROD1N_LOSS loss from 1-yr crop product pool gN/m^2/s T -1257 PROD10N_LOSS loss from 10-yr wood product pool gN/m^2/s F -1258 PROD100N_LOSS loss from 100-yr wood product pool gN/m^2/s F -1259 TOT_WOODPRODN_LOSS total loss from wood product pools gN/m^2/s T -1260 FERTNITRO Nitrogen fertilizer for each crop gN/m2/yr F -1261 GDDPLANT Accumulated growing degree days past planting date for crop ddays F -1262 GDDTSOI Growing degree-days from planting (top two soil layers) ddays F -1263 CPHASE crop phenology phase 0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest T -1264 LATBASET latitude vary base temperature for gddplant degree C F + 1 A10TMIN 10-day running mean of min 2-m temperature K F + 2 A5TMIN 5-day running mean of min 2-m temperature K F + 3 ACTUAL_IMMOB actual N immobilization gN/m^2/s T + 4 ACTUAL_IMMOB_NH4 immobilization of NH4 gN/m^3/s F + 5 ACTUAL_IMMOB_NO3 immobilization of NO3 gN/m^3/s F + 6 ACTUAL_IMMOB_vr actual N immobilization gN/m^3/s F + 7 AGNPP aboveground NPP gC/m^2/s T + 8 ALBD surface albedo (direct) proportion T + 9 ALBDSF diagnostic snow-free surface albedo (direct) proportion T + 10 ALBGRD ground albedo (direct) proportion F + 11 ALBGRI ground albedo (indirect) proportion F + 12 ALBI surface albedo (indirect) proportion T + 13 ALBISF diagnostic snow-free surface albedo (indirect) proportion T + 14 ALPHA alpha coefficient for VOC calc non F + 15 ALT current active layer thickness m T + 16 ALTMAX maximum annual active layer thickness m T + 17 ALTMAX_LASTYEAR maximum prior year active layer thickness m F + 18 ANNAVG_T2M annual average 2m air temperature K F + 19 ANNMAX_RETRANSN annual max of retranslocated N pool gN/m^2 F + 20 ANNSUM_COUNTER seconds since last annual accumulator turnover s F + 21 ANNSUM_NPP annual sum of NPP gC/m^2/yr F + 22 ANNSUM_POTENTIAL_GPP annual sum of potential GPP gN/m^2/yr F + 23 APPAR_TEMP 2 m apparent temperature C T + 24 APPAR_TEMP_R Rural 2 m apparent temperature C T + 25 APPAR_TEMP_U Urban 2 m apparent temperature C T + 26 AR autotrophic respiration (MR + GR) gC/m^2/s T + 27 ATM_TOPO atmospheric surface height m T + 28 AVAILC C flux available for allocation gC/m^2/s F + 29 AVAIL_RETRANSN N flux available from retranslocation pool gN/m^2/s F + 30 AnnET Annual ET mm/s F + 31 BAF_CROP fractional area burned for crop s-1 T + 32 BAF_PEATF fractional area burned in peatland s-1 T + 33 BCDEP total BC deposition (dry+wet) from atmosphere kg/m^2/s T + 34 BETA coefficient of convective velocity none F + 35 BGLFR background litterfall rate 1/s F + 36 BGNPP belowground NPP gC/m^2/s T + 37 BGTR background transfer growth rate 1/s F + 38 BTRANMN daily minimum of transpiration beta factor unitless T + 39 CANNAVG_T2M annual average of 2m air temperature K F + 40 CANNSUM_NPP annual sum of column-level NPP gC/m^2/s F + 41 CGRND deriv. of soil energy flux wrt to soil temp W/m^2/K F + 42 CGRNDL deriv. of soil latent heat flux wrt soil temp W/m^2/K F + 43 CGRNDS deriv. of soil sensible heat flux wrt soil temp W/m^2/K F + 44 CH4PROD Gridcell total production of CH4 gC/m2/s T + 45 CH4_EBUL_TOTAL_SAT ebullition surface CH4 flux; (+ to atm) mol/m2/s F + 46 CH4_EBUL_TOTAL_UNSAT ebullition surface CH4 flux; (+ to atm) mol/m2/s F + 47 CH4_SURF_AERE_SAT aerenchyma surface CH4 flux for inundated area; (+ to atm) mol/m2/s T + 48 CH4_SURF_AERE_UNSAT aerenchyma surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T + 49 CH4_SURF_DIFF_SAT diffusive surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T + 50 CH4_SURF_DIFF_UNSAT diffusive surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T + 51 CH4_SURF_EBUL_SAT ebullition surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T + 52 CH4_SURF_EBUL_UNSAT ebullition surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T + 53 COL_CTRUNC column-level sink for C truncation gC/m^2 F + 54 COL_FIRE_CLOSS total column-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T + 55 COL_FIRE_NLOSS total column-level fire N loss gN/m^2/s T + 56 COL_NTRUNC column-level sink for N truncation gN/m^2 F + 57 CONC_CH4_SAT CH4 soil Concentration for inundated / lake area mol/m3 F + 58 CONC_CH4_UNSAT CH4 soil Concentration for non-inundated area mol/m3 F + 59 CONC_O2_SAT O2 soil Concentration for inundated / lake area mol/m3 T + 60 CONC_O2_UNSAT O2 soil Concentration for non-inundated area mol/m3 T + 61 COST_NACTIVE Cost of active uptake gN/gC T + 62 COST_NFIX Cost of fixation gN/gC T + 63 COST_NRETRANS Cost of retranslocation gN/gC T + 64 COSZEN cosine of solar zenith angle none F + 65 CPHASE crop phenology phase 0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest T + 66 CPOOL temporary photosynthate C pool gC/m^2 T + 67 CPOOL_DEADCROOT_GR dead coarse root growth respiration gC/m^2/s F + 68 CPOOL_DEADCROOT_STORAGE_GR dead coarse root growth respiration to storage gC/m^2/s F + 69 CPOOL_DEADSTEM_GR dead stem growth respiration gC/m^2/s F + 70 CPOOL_DEADSTEM_STORAGE_GR dead stem growth respiration to storage gC/m^2/s F + 71 CPOOL_FROOT_GR fine root growth respiration gC/m^2/s F + 72 CPOOL_FROOT_STORAGE_GR fine root growth respiration to storage gC/m^2/s F + 73 CPOOL_LEAF_GR leaf growth respiration gC/m^2/s F + 74 CPOOL_LEAF_STORAGE_GR leaf growth respiration to storage gC/m^2/s F + 75 CPOOL_LIVECROOT_GR live coarse root growth respiration gC/m^2/s F + 76 CPOOL_LIVECROOT_STORAGE_GR live coarse root growth respiration to storage gC/m^2/s F + 77 CPOOL_LIVESTEM_GR live stem growth respiration gC/m^2/s F + 78 CPOOL_LIVESTEM_STORAGE_GR live stem growth respiration to storage gC/m^2/s F + 79 CPOOL_TO_DEADCROOTC allocation to dead coarse root C gC/m^2/s F + 80 CPOOL_TO_DEADCROOTC_STORAGE allocation to dead coarse root C storage gC/m^2/s F + 81 CPOOL_TO_DEADSTEMC allocation to dead stem C gC/m^2/s F + 82 CPOOL_TO_DEADSTEMC_STORAGE allocation to dead stem C storage gC/m^2/s F + 83 CPOOL_TO_FROOTC allocation to fine root C gC/m^2/s F + 84 CPOOL_TO_FROOTC_STORAGE allocation to fine root C storage gC/m^2/s F + 85 CPOOL_TO_GRESP_STORAGE allocation to growth respiration storage gC/m^2/s F + 86 CPOOL_TO_LEAFC allocation to leaf C gC/m^2/s F + 87 CPOOL_TO_LEAFC_STORAGE allocation to leaf C storage gC/m^2/s F + 88 CPOOL_TO_LIVECROOTC allocation to live coarse root C gC/m^2/s F + 89 CPOOL_TO_LIVECROOTC_STORAGE allocation to live coarse root C storage gC/m^2/s F + 90 CPOOL_TO_LIVESTEMC allocation to live stem C gC/m^2/s F + 91 CPOOL_TO_LIVESTEMC_STORAGE allocation to live stem C storage gC/m^2/s F + 92 CROOT_PROF profile for litter C and N inputs from coarse roots 1/m F + 93 CROPPROD1C 1-yr crop product (grain+biofuel) C gC/m^2 T + 94 CROPPROD1C_LOSS loss from 1-yr crop product pool gC/m^2/s T + 95 CROPPROD1N 1-yr crop product (grain+biofuel) N gN/m^2 T + 96 CROPPROD1N_LOSS loss from 1-yr crop product pool gN/m^2/s T + 97 CROPSEEDC_DEFICIT C used for crop seed that needs to be repaid gC/m^2 T + 98 CROPSEEDN_DEFICIT N used for crop seed that needs to be repaid gN/m^2 F + 99 CROP_SEEDC_TO_LEAF crop seed source to leaf gC/m^2/s F + 100 CROP_SEEDN_TO_LEAF crop seed source to leaf gN/m^2/s F + 101 CURRENT_GR growth resp for new growth displayed in this timestep gC/m^2/s F + 102 CWDC CWD C gC/m^2 T + 103 CWDC_1m CWD C to 1 meter gC/m^2 F + 104 CWDC_LOSS coarse woody debris C loss gC/m^2/s T + 105 CWDC_TO_LITR2C decomp. of coarse woody debris C to litter 2 C gC/m^2/s F + 106 CWDC_TO_LITR2C_vr decomp. of coarse woody debris C to litter 2 C gC/m^3/s F + 107 CWDC_TO_LITR3C decomp. of coarse woody debris C to litter 3 C gC/m^2/s F + 108 CWDC_TO_LITR3C_vr decomp. of coarse woody debris C to litter 3 C gC/m^3/s F + 109 CWDC_vr CWD C (vertically resolved) gC/m^3 T + 110 CWDN CWD N gN/m^2 T + 111 CWDN_1m CWD N to 1 meter gN/m^2 F + 112 CWDN_TO_LITR2N decomp. of coarse woody debris N to litter 2 N gN/m^2 F + 113 CWDN_TO_LITR2N_vr decomp. of coarse woody debris N to litter 2 N gN/m^3 F + 114 CWDN_TO_LITR3N decomp. of coarse woody debris N to litter 3 N gN/m^2 F + 115 CWDN_TO_LITR3N_vr decomp. of coarse woody debris N to litter 3 N gN/m^3 F + 116 CWDN_vr CWD N (vertically resolved) gN/m^3 T + 117 C_ALLOMETRY C allocation index none F + 118 DAYL daylength s F + 119 DAYS_ACTIVE number of days since last dormancy days F + 120 DEADCROOTC dead coarse root C gC/m^2 T + 121 DEADCROOTC_STORAGE dead coarse root C storage gC/m^2 F + 122 DEADCROOTC_STORAGE_TO_XFER dead coarse root C shift storage to transfer gC/m^2/s F + 123 DEADCROOTC_XFER dead coarse root C transfer gC/m^2 F + 124 DEADCROOTC_XFER_TO_DEADCROOTC dead coarse root C growth from storage gC/m^2/s F + 125 DEADCROOTN dead coarse root N gN/m^2 T + 126 DEADCROOTN_STORAGE dead coarse root N storage gN/m^2 F + 127 DEADCROOTN_STORAGE_TO_XFER dead coarse root N shift storage to transfer gN/m^2/s F + 128 DEADCROOTN_XFER dead coarse root N transfer gN/m^2 F + 129 DEADCROOTN_XFER_TO_DEADCROOTN dead coarse root N growth from storage gN/m^2/s F + 130 DEADSTEMC dead stem C gC/m^2 T + 131 DEADSTEMC_STORAGE dead stem C storage gC/m^2 F + 132 DEADSTEMC_STORAGE_TO_XFER dead stem C shift storage to transfer gC/m^2/s F + 133 DEADSTEMC_XFER dead stem C transfer gC/m^2 F + 134 DEADSTEMC_XFER_TO_DEADSTEMC dead stem C growth from storage gC/m^2/s F + 135 DEADSTEMN dead stem N gN/m^2 T + 136 DEADSTEMN_STORAGE dead stem N storage gN/m^2 F + 137 DEADSTEMN_STORAGE_TO_XFER dead stem N shift storage to transfer gN/m^2/s F + 138 DEADSTEMN_XFER dead stem N transfer gN/m^2 F + 139 DEADSTEMN_XFER_TO_DEADSTEMN dead stem N growth from storage gN/m^2/s F + 140 DENIT total rate of denitrification gN/m^2/s T + 141 DGNETDT derivative of net ground heat flux wrt soil temp W/m^2/K F + 142 DISCOI 2 m Discomfort Index C T + 143 DISCOIS 2 m Stull Discomfort Index C T + 144 DISCOIS_R Rural 2 m Stull Discomfort Index C T + 145 DISCOIS_U Urban 2 m Stull Discomfort Index C T + 146 DISCOI_R Rural 2 m Discomfort Index C T + 147 DISCOI_U Urban 2 m Discomfort Index C T + 148 DISPLA displacement height m F + 149 DISPVEGC displayed veg carbon, excluding storage and cpool gC/m^2 T + 150 DISPVEGN displayed vegetation nitrogen gN/m^2 T + 151 DLRAD downward longwave radiation below the canopy W/m^2 F + 152 DORMANT_FLAG dormancy flag none F + 153 DOWNREG fractional reduction in GPP due to N limitation proportion F + 154 DPVLTRB1 turbulent deposition velocity 1 m/s F + 155 DPVLTRB2 turbulent deposition velocity 2 m/s F + 156 DPVLTRB3 turbulent deposition velocity 3 m/s F + 157 DPVLTRB4 turbulent deposition velocity 4 m/s F + 158 DSL dry surface layer thickness mm T + 159 DSTDEP total dust deposition (dry+wet) from atmosphere kg/m^2/s T + 160 DSTFLXT total surface dust emission kg/m2/s T + 161 DT_VEG change in t_veg, last iteration K F + 162 DWT_CONV_CFLUX conversion C flux (immediate loss to atm) (0 at all times except first timestep of year) gC/m^2/s T + 163 DWT_CONV_CFLUX_DRIBBLED conversion C flux (immediate loss to atm), dribbled throughout the year gC/m^2/s T + 164 DWT_CONV_CFLUX_PATCH patch-level conversion C flux (immediate loss to atm) (0 at all times except first timestep of gC/m^2/s F + 165 DWT_CONV_NFLUX conversion N flux (immediate loss to atm) (0 at all times except first timestep of year) gN/m^2/s T + 166 DWT_CONV_NFLUX_PATCH patch-level conversion N flux (immediate loss to atm) (0 at all times except first timestep of gN/m^2/s F + 167 DWT_CROPPROD1C_GAIN landcover change-driven addition to 1-year crop product pool gC/m^2/s T + 168 DWT_CROPPROD1N_GAIN landcover change-driven addition to 1-year crop product pool gN/m^2/s T + 169 DWT_DEADCROOTC_TO_CWDC dead coarse root to CWD due to landcover change gC/m^2/s F + 170 DWT_DEADCROOTN_TO_CWDN dead coarse root to CWD due to landcover change gN/m^2/s F + 171 DWT_FROOTC_TO_LITR_CEL_C fine root to litter due to landcover change gC/m^2/s F + 172 DWT_FROOTC_TO_LITR_LIG_C fine root to litter due to landcover change gC/m^2/s F + 173 DWT_FROOTC_TO_LITR_MET_C fine root to litter due to landcover change gC/m^2/s F + 174 DWT_FROOTN_TO_LITR_CEL_N fine root to litter due to landcover change gN/m^2/s F + 175 DWT_FROOTN_TO_LITR_LIG_N fine root to litter due to landcover change gN/m^2/s F + 176 DWT_FROOTN_TO_LITR_MET_N fine root to litter due to landcover change gN/m^2/s F + 177 DWT_LIVECROOTC_TO_CWDC live coarse root to CWD due to landcover change gC/m^2/s F + 178 DWT_LIVECROOTN_TO_CWDN live coarse root to CWD due to landcover change gN/m^2/s F + 179 DWT_PROD100C_GAIN landcover change-driven addition to 100-yr wood product pool gC/m^2/s F + 180 DWT_PROD100N_GAIN landcover change-driven addition to 100-yr wood product pool gN/m^2/s F + 181 DWT_PROD10C_GAIN landcover change-driven addition to 10-yr wood product pool gC/m^2/s F + 182 DWT_PROD10N_GAIN landcover change-driven addition to 10-yr wood product pool gN/m^2/s F + 183 DWT_SEEDC_TO_DEADSTEM seed source to patch-level deadstem gC/m^2/s F + 184 DWT_SEEDC_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gC/m^2/s F + 185 DWT_SEEDC_TO_LEAF seed source to patch-level leaf gC/m^2/s F + 186 DWT_SEEDC_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gC/m^2/s F + 187 DWT_SEEDN_TO_DEADSTEM seed source to patch-level deadstem gN/m^2/s T + 188 DWT_SEEDN_TO_DEADSTEM_PATCH patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gN/m^2/s F + 189 DWT_SEEDN_TO_LEAF seed source to patch-level leaf gN/m^2/s T + 190 DWT_SEEDN_TO_LEAF_PATCH patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gN/m^2/s F + 191 DWT_SLASH_CFLUX slash C flux (to litter diagnostic only) (0 at all times except first timestep of year) gC/m^2/s T + 192 DWT_SLASH_CFLUX_PATCH patch-level slash C flux (to litter diagnostic only) (0 at all times except first timestep of gC/m^2/s F + 193 DWT_WOODPRODC_GAIN landcover change-driven addition to wood product pools gC/m^2/s T + 194 DWT_WOODPRODN_GAIN landcover change-driven addition to wood product pools gN/m^2/s T + 195 DWT_WOOD_PRODUCTC_GAIN_PATCH patch-level landcover change-driven addition to wood product pools(0 at all times except first gC/m^2/s F + 196 DYN_COL_ADJUSTMENTS_CH4 Adjustments in ch4 due to dynamic column areas; only makes sense at the column level: should n gC/m^2 F + 197 DYN_COL_SOIL_ADJUSTMENTS_C Adjustments in soil carbon due to dynamic column areas; only makes sense at the column level: gC/m^2 F + 198 DYN_COL_SOIL_ADJUSTMENTS_N Adjustments in soil nitrogen due to dynamic column areas; only makes sense at the column level gN/m^2 F + 199 DYN_COL_SOIL_ADJUSTMENTS_NH4 Adjustments in soil NH4 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F + 200 DYN_COL_SOIL_ADJUSTMENTS_NO3 Adjustments in soil NO3 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F + 201 EFF_POROSITY effective porosity = porosity - vol_ice proportion F + 202 EFLXBUILD building heat flux from change in interior building air temperature W/m^2 T + 203 EFLX_DYNBAL dynamic land cover change conversion energy flux W/m^2 T + 204 EFLX_GNET net heat flux into ground W/m^2 F + 205 EFLX_GRND_LAKE net heat flux into lake/snow surface, excluding light transmission W/m^2 T + 206 EFLX_LH_TOT total latent heat flux [+ to atm] W/m^2 T + 207 EFLX_LH_TOT_ICE total latent heat flux [+ to atm] (ice landunits only) W/m^2 F + 208 EFLX_LH_TOT_R Rural total evaporation W/m^2 T + 209 EFLX_LH_TOT_U Urban total evaporation W/m^2 F + 210 EFLX_SOIL_GRND soil heat flux [+ into soil] W/m^2 F + 211 ELAI exposed one-sided leaf area index m^2/m^2 T + 212 EMG ground emissivity proportion F + 213 EMV vegetation emissivity proportion F + 214 EOPT Eopt coefficient for VOC calc non F + 215 EPT 2 m Equiv Pot Temp K T + 216 EPT_R Rural 2 m Equiv Pot Temp K T + 217 EPT_U Urban 2 m Equiv Pot Temp K T + 218 ER total ecosystem respiration, autotrophic + heterotrophic gC/m^2/s T + 219 ERRH2O total water conservation error mm T + 220 ERRH2OSNO imbalance in snow depth (liquid water) mm T + 221 ERRSEB surface energy conservation error W/m^2 T + 222 ERRSOI soil/lake energy conservation error W/m^2 T + 223 ERRSOL solar radiation conservation error W/m^2 T + 224 ESAI exposed one-sided stem area index m^2/m^2 T + 225 EXCESSC_MR excess C maintenance respiration gC/m^2/s F + 226 EXCESS_CFLUX C flux not allocated due to downregulation gC/m^2/s F + 227 FAREA_BURNED timestep fractional area burned s-1 T + 228 FCANSNO fraction of canopy that is wet proportion F + 229 FCEV canopy evaporation W/m^2 T + 230 FCH4 Gridcell surface CH4 flux to atmosphere (+ to atm) kgC/m2/s T + 231 FCH4TOCO2 Gridcell oxidation of CH4 to CO2 gC/m2/s T + 232 FCH4_DFSAT CH4 additional flux due to changing fsat, natural vegetated and crop landunits only kgC/m2/s T + 233 FCO2 CO2 flux to atmosphere (+ to atm) kgCO2/m2/s F + 234 FCOV fractional impermeable area unitless T + 235 FCTR canopy transpiration W/m^2 T + 236 FDRY fraction of foliage that is green and dry proportion F + 237 FERTNITRO Nitrogen fertilizer for each crop gN/m2/yr F + 238 FERT_COUNTER time left to fertilize seconds F + 239 FERT_TO_SMINN fertilizer to soil mineral N gN/m^2/s F + 240 FFIX_TO_SMINN free living N fixation to soil mineral N gN/m^2/s T + 241 FGEV ground evaporation W/m^2 T + 242 FGR heat flux into soil/snow including snow melt and lake / snow light transmission W/m^2 T + 243 FGR12 heat flux between soil layers 1 and 2 W/m^2 T + 244 FGR_ICE heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits W/m^2 F + 245 FGR_R Rural heat flux into soil/snow including snow melt and snow light transmission W/m^2 F + 246 FGR_SOIL_R Rural downward heat flux at interface below each soil layer watt/m^2 F + 247 FGR_U Urban heat flux into soil/snow including snow melt W/m^2 F + 248 FH2OSFC fraction of ground covered by surface water unitless T + 249 FH2OSFC_NOSNOW fraction of ground covered by surface water (if no snow present) unitless F + 250 FINUNDATED fractional inundated area of vegetated columns unitless T + 251 FINUNDATED_LAG time-lagged inundated fraction of vegetated columns unitless F + 252 FIRA net infrared (longwave) radiation W/m^2 T + 253 FIRA_ICE net infrared (longwave) radiation (ice landunits only) W/m^2 F + 254 FIRA_R Rural net infrared (longwave) radiation W/m^2 T + 255 FIRA_U Urban net infrared (longwave) radiation W/m^2 F + 256 FIRE emitted infrared (longwave) radiation W/m^2 T + 257 FIRE_ICE emitted infrared (longwave) radiation (ice landunits only) W/m^2 F + 258 FIRE_R Rural emitted infrared (longwave) radiation W/m^2 T + 259 FIRE_U Urban emitted infrared (longwave) radiation W/m^2 F + 260 FLDS atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 T + 261 FLDS_ICE atmospheric longwave radiation (downscaled to columns in glacier regions) (ice landunits only) W/m^2 F + 262 FMAX_DENIT_CARBONSUBSTRATE FMAX_DENIT_CARBONSUBSTRATE gN/m^3/s F + 263 FMAX_DENIT_NITRATE FMAX_DENIT_NITRATE gN/m^3/s F + 264 FPI fraction of potential immobilization proportion T + 265 FPI_vr fraction of potential immobilization proportion F + 266 FPSN photosynthesis umol m-2 s-1 T + 267 FPSN24 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m^2 ground/day F + 268 FPSN_WC Rubisco-limited photosynthesis umol m-2 s-1 F + 269 FPSN_WJ RuBP-limited photosynthesis umol m-2 s-1 F + 270 FPSN_WP Product-limited photosynthesis umol m-2 s-1 F + 271 FRAC_ICEOLD fraction of ice relative to the tot water proportion F + 272 FREE_RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s T + 273 FROOTC fine root C gC/m^2 T + 274 FROOTC_ALLOC fine root C allocation gC/m^2/s T + 275 FROOTC_LOSS fine root C loss gC/m^2/s T + 276 FROOTC_STORAGE fine root C storage gC/m^2 F + 277 FROOTC_STORAGE_TO_XFER fine root C shift storage to transfer gC/m^2/s F + 278 FROOTC_TO_LITTER fine root C litterfall gC/m^2/s F + 279 FROOTC_XFER fine root C transfer gC/m^2 F + 280 FROOTC_XFER_TO_FROOTC fine root C growth from storage gC/m^2/s F + 281 FROOTN fine root N gN/m^2 T + 282 FROOTN_STORAGE fine root N storage gN/m^2 F + 283 FROOTN_STORAGE_TO_XFER fine root N shift storage to transfer gN/m^2/s F + 284 FROOTN_TO_LITTER fine root N litterfall gN/m^2/s F + 285 FROOTN_XFER fine root N transfer gN/m^2 F + 286 FROOTN_XFER_TO_FROOTN fine root N growth from storage gN/m^2/s F + 287 FROOT_MR fine root maintenance respiration gC/m^2/s F + 288 FROOT_PROF profile for litter C and N inputs from fine roots 1/m F + 289 FROST_TABLE frost table depth (natural vegetated and crop landunits only) m F + 290 FSA absorbed solar radiation W/m^2 T + 291 FSAT fractional area with water table at surface unitless T + 292 FSA_ICE absorbed solar radiation (ice landunits only) W/m^2 F + 293 FSA_R Rural absorbed solar radiation W/m^2 F + 294 FSA_U Urban absorbed solar radiation W/m^2 F + 295 FSD24 direct radiation (last 24hrs) K F + 296 FSD240 direct radiation (last 240hrs) K F + 297 FSDS atmospheric incident solar radiation W/m^2 T + 298 FSDSND direct nir incident solar radiation W/m^2 T + 299 FSDSNDLN direct nir incident solar radiation at local noon W/m^2 T + 300 FSDSNI diffuse nir incident solar radiation W/m^2 T + 301 FSDSVD direct vis incident solar radiation W/m^2 T + 302 FSDSVDLN direct vis incident solar radiation at local noon W/m^2 T + 303 FSDSVI diffuse vis incident solar radiation W/m^2 T + 304 FSDSVILN diffuse vis incident solar radiation at local noon W/m^2 T + 305 FSH sensible heat not including correction for land use change and rain/snow conversion W/m^2 T + 306 FSH_G sensible heat from ground W/m^2 T + 307 FSH_ICE sensible heat not including correction for land use change and rain/snow conversion (ice landu W/m^2 F + 308 FSH_PRECIP_CONVERSION Sensible heat flux from conversion of rain/snow atm forcing W/m^2 T + 309 FSH_R Rural sensible heat W/m^2 T + 310 FSH_RUNOFF_ICE_TO_LIQ sensible heat flux generated from conversion of ice runoff to liquid W/m^2 T + 311 FSH_TO_COUPLER sensible heat sent to coupler (includes corrections for land use change, rain/snow conversion W/m^2 T + 312 FSH_U Urban sensible heat W/m^2 F + 313 FSH_V sensible heat from veg W/m^2 T + 314 FSI24 indirect radiation (last 24hrs) K F + 315 FSI240 indirect radiation (last 240hrs) K F + 316 FSM snow melt heat flux W/m^2 T + 317 FSM_ICE snow melt heat flux (ice landunits only) W/m^2 F + 318 FSM_R Rural snow melt heat flux W/m^2 F + 319 FSM_U Urban snow melt heat flux W/m^2 F + 320 FSNO fraction of ground covered by snow unitless T + 321 FSNO_EFF effective fraction of ground covered by snow unitless T + 322 FSNO_ICE fraction of ground covered by snow (ice landunits only) unitless F + 323 FSR reflected solar radiation W/m^2 T + 324 FSRND direct nir reflected solar radiation W/m^2 T + 325 FSRNDLN direct nir reflected solar radiation at local noon W/m^2 T + 326 FSRNI diffuse nir reflected solar radiation W/m^2 T + 327 FSRSF reflected solar radiation W/m^2 T + 328 FSRSFND direct nir reflected solar radiation W/m^2 T + 329 FSRSFNDLN direct nir reflected solar radiation at local noon W/m^2 T + 330 FSRSFNI diffuse nir reflected solar radiation W/m^2 T + 331 FSRSFVD direct vis reflected solar radiation W/m^2 T + 332 FSRSFVDLN direct vis reflected solar radiation at local noon W/m^2 T + 333 FSRSFVI diffuse vis reflected solar radiation W/m^2 T + 334 FSRVD direct vis reflected solar radiation W/m^2 T + 335 FSRVDLN direct vis reflected solar radiation at local noon W/m^2 T + 336 FSRVI diffuse vis reflected solar radiation W/m^2 T + 337 FSR_ICE reflected solar radiation (ice landunits only) W/m^2 F + 338 FSUN sunlit fraction of canopy proportion F + 339 FSUN24 fraction sunlit (last 24hrs) K F + 340 FSUN240 fraction sunlit (last 240hrs) K F + 341 FUELC fuel load gC/m^2 T + 342 FV friction velocity for dust model m/s F + 343 FWET fraction of canopy that is wet proportion F + 344 F_DENIT denitrification flux gN/m^2/s T + 345 F_DENIT_BASE F_DENIT_BASE gN/m^3/s F + 346 F_DENIT_vr denitrification flux gN/m^3/s F + 347 F_N2O_DENIT denitrification N2O flux gN/m^2/s T + 348 F_N2O_NIT nitrification N2O flux gN/m^2/s T + 349 F_NIT nitrification flux gN/m^2/s T + 350 F_NIT_vr nitrification flux gN/m^3/s F + 351 FireComp_BC fire emissions flux of BC kg/m2/sec F + 352 FireComp_OC fire emissions flux of OC kg/m2/sec F + 353 FireComp_SO2 fire emissions flux of SO2 kg/m2/sec F + 354 FireEmis_TOT Total fire emissions flux gC/m2/sec F + 355 FireEmis_ZTOP Top of vertical fire emissions distribution m F + 356 FireMech_SO2 fire emissions flux of SO2 kg/m2/sec F + 357 FireMech_bc_a1 fire emissions flux of bc_a1 kg/m2/sec F + 358 FireMech_pom_a1 fire emissions flux of pom_a1 kg/m2/sec F + 359 GAMMA total gamma for VOC calc non F + 360 GAMMAA gamma A for VOC calc non F + 361 GAMMAC gamma C for VOC calc non F + 362 GAMMAL gamma L for VOC calc non F + 363 GAMMAP gamma P for VOC calc non F + 364 GAMMAS gamma S for VOC calc non F + 365 GAMMAT gamma T for VOC calc non F + 366 GDD0 Growing degree days base 0C from planting ddays F + 367 GDD020 Twenty year average of growing degree days base 0C from planting ddays F + 368 GDD10 Growing degree days base 10C from planting ddays F + 369 GDD1020 Twenty year average of growing degree days base 10C from planting ddays F + 370 GDD8 Growing degree days base 8C from planting ddays F + 371 GDD820 Twenty year average of growing degree days base 8C from planting ddays F + 372 GDDHARV Growing degree days (gdd) needed to harvest ddays F + 373 GDDPLANT Accumulated growing degree days past planting date for crop ddays F + 374 GDDTSOI Growing degree-days from planting (top two soil layers) ddays F + 375 GPP gross primary production gC/m^2/s T + 376 GR total growth respiration gC/m^2/s T + 377 GRAINC grain C (does not equal yield) gC/m^2 T + 378 GRAINC_TO_FOOD grain C to food gC/m^2/s T + 379 GRAINC_TO_SEED grain C to seed gC/m^2/s T + 380 GRAINN grain N gN/m^2 T + 381 GRESP_STORAGE growth respiration storage gC/m^2 F + 382 GRESP_STORAGE_TO_XFER growth respiration shift storage to transfer gC/m^2/s F + 383 GRESP_XFER growth respiration transfer gC/m^2 F + 384 GROSS_NMIN gross rate of N mineralization gN/m^2/s T + 385 GROSS_NMIN_vr gross rate of N mineralization gN/m^3/s F + 386 GSSHA shaded leaf stomatal conductance umol H20/m2/s T + 387 GSSHALN shaded leaf stomatal conductance at local noon umol H20/m2/s T + 388 GSSUN sunlit leaf stomatal conductance umol H20/m2/s T + 389 GSSUNLN sunlit leaf stomatal conductance at local noon umol H20/m2/s T + 390 H2OCAN intercepted water mm T + 391 H2OSFC surface water depth mm T + 392 H2OSNO snow depth (liquid water) mm T + 393 H2OSNO_ICE snow depth (liquid water, ice landunits only) mm F + 394 H2OSNO_TOP mass of snow in top snow layer kg/m2 T + 395 H2OSOI volumetric soil water (natural vegetated and crop landunits only) mm3/mm3 T + 396 HBOT canopy bottom m F + 397 HEAT_CONTENT1 initial gridcell total heat content J/m^2 T + 398 HEAT_CONTENT1_VEG initial gridcell total heat content - natural vegetated and crop landunits only J/m^2 F + 399 HEAT_CONTENT2 post land cover change total heat content J/m^2 F + 400 HEAT_FROM_AC sensible heat flux put into canyon due to heat removed from air conditioning W/m^2 T + 401 HIA 2 m NWS Heat Index C T + 402 HIA_R Rural 2 m NWS Heat Index C T + 403 HIA_U Urban 2 m NWS Heat Index C T + 404 HK hydraulic conductivity (natural vegetated and crop landunits only) mm/s F + 405 HR total heterotrophic respiration gC/m^2/s T + 406 HR_vr total vertically resolved heterotrophic respiration gC/m^3/s T + 407 HTOP canopy top m T + 408 HUMIDEX 2 m Humidex C T + 409 HUMIDEX_R Rural 2 m Humidex C T + 410 HUMIDEX_U Urban 2 m Humidex C T + 411 ICE_CONTENT1 initial gridcell total ice content mm T + 412 ICE_CONTENT2 post land cover change total ice content mm F + 413 ICE_MODEL_FRACTION Ice sheet model fractional coverage unitless F + 414 INIT_GPP GPP flux before downregulation gC/m^2/s F + 415 INT_SNOW accumulated swe (natural vegetated and crop landunits only) mm F + 416 INT_SNOW_ICE accumulated swe (ice landunits only) mm F + 417 JMX25T canopy profile of jmax umol/m2/s T + 418 Jmx25Z maximum rate of electron transport at 25 Celcius for canopy layers umol electrons/m2/s T + 419 KROOT root conductance each soil layer 1/s F + 420 KSOIL soil conductance in each soil layer 1/s F + 421 K_CWD coarse woody debris potential loss coefficient 1/s F + 422 K_LITR1 litter 1 potential loss coefficient 1/s F + 423 K_LITR2 litter 2 potential loss coefficient 1/s F + 424 K_LITR3 litter 3 potential loss coefficient 1/s F + 425 K_NITR K_NITR 1/s F + 426 K_NITR_H2O K_NITR_H2O unitless F + 427 K_NITR_PH K_NITR_PH unitless F + 428 K_NITR_T K_NITR_T unitless F + 429 K_SOIL1 soil 1 potential loss coefficient 1/s F + 430 K_SOIL2 soil 2 potential loss coefficient 1/s F + 431 K_SOIL3 soil 3 potential loss coefficient 1/s F + 432 LAI240 240hr average of leaf area index m^2/m^2 F + 433 LAISHA shaded projected leaf area index m^2/m^2 T + 434 LAISUN sunlit projected leaf area index m^2/m^2 T + 435 LAKEICEFRAC lake layer ice mass fraction unitless F + 436 LAKEICEFRAC_SURF surface lake layer ice mass fraction unitless T + 437 LAKEICETHICK thickness of lake ice (including physical expansion on freezing) m T + 438 LAND_USE_FLUX total C emitted from land cover conversion (smoothed over the year) and wood and grain product gC/m^2/s T + 439 LATBASET latitude vary base temperature for gddplant degree C F + 440 LEAFC leaf C gC/m^2 T + 441 LEAFCN Leaf CN ratio used for flexible CN gC/gN T + 442 LEAFCN_OFFSET Leaf C:N used by FUN unitless F + 443 LEAFCN_STORAGE Storage Leaf CN ratio used for flexible CN gC/gN F + 444 LEAFC_ALLOC leaf C allocation gC/m^2/s T + 445 LEAFC_CHANGE C change in leaf gC/m^2/s T + 446 LEAFC_LOSS leaf C loss gC/m^2/s T + 447 LEAFC_STORAGE leaf C storage gC/m^2 F + 448 LEAFC_STORAGE_TO_XFER leaf C shift storage to transfer gC/m^2/s F + 449 LEAFC_STORAGE_XFER_ACC Accumulated leaf C transfer gC/m^2 F + 450 LEAFC_TO_BIOFUELC leaf C to biofuel C gC/m^2/s T + 451 LEAFC_TO_LITTER leaf C litterfall gC/m^2/s F + 452 LEAFC_TO_LITTER_FUN leaf C litterfall used by FUN gC/m^2/s T + 453 LEAFC_XFER leaf C transfer gC/m^2 F + 454 LEAFC_XFER_TO_LEAFC leaf C growth from storage gC/m^2/s F + 455 LEAFN leaf N gN/m^2 T + 456 LEAFN_STORAGE leaf N storage gN/m^2 F + 457 LEAFN_STORAGE_TO_XFER leaf N shift storage to transfer gN/m^2/s F + 458 LEAFN_STORAGE_XFER_ACC Accmulated leaf N transfer gN/m^2 F + 459 LEAFN_TO_LITTER leaf N litterfall gN/m^2/s T + 460 LEAFN_TO_RETRANSN leaf N to retranslocated N pool gN/m^2/s F + 461 LEAFN_XFER leaf N transfer gN/m^2 F + 462 LEAFN_XFER_TO_LEAFN leaf N growth from storage gN/m^2/s F + 463 LEAF_MR leaf maintenance respiration gC/m^2/s T + 464 LEAF_PROF profile for litter C and N inputs from leaves 1/m F + 465 LFC2 conversion area fraction of BET and BDT that burned per sec T + 466 LGSF long growing season factor proportion F + 467 LIQCAN intercepted liquid water mm T + 468 LIQUID_CONTENT1 initial gridcell total liq content mm T + 469 LIQUID_CONTENT2 post landuse change gridcell total liq content mm F + 470 LIQUID_WATER_TEMP1 initial gridcell weighted average liquid water temperature K F + 471 LITFALL litterfall (leaves and fine roots) gC/m^2/s T + 472 LITFIRE litter fire losses gC/m^2/s F + 473 LITR1C LITR1 C gC/m^2 T + 474 LITR1C_1m LITR1 C to 1 meter gC/m^2 F + 475 LITR1C_TNDNCY_VERT_TRANS litter 1 C tendency due to vertical transport gC/m^3/s F + 476 LITR1C_TO_SOIL1C decomp. of litter 1 C to soil 1 C gC/m^2/s F + 477 LITR1C_TO_SOIL1C_vr decomp. of litter 1 C to soil 1 C gC/m^3/s F + 478 LITR1C_vr LITR1 C (vertically resolved) gC/m^3 T + 479 LITR1N LITR1 N gN/m^2 T + 480 LITR1N_1m LITR1 N to 1 meter gN/m^2 F + 481 LITR1N_TNDNCY_VERT_TRANS litter 1 N tendency due to vertical transport gN/m^3/s F + 482 LITR1N_TO_SOIL1N decomp. of litter 1 N to soil 1 N gN/m^2 F + 483 LITR1N_TO_SOIL1N_vr decomp. of litter 1 N to soil 1 N gN/m^3 F + 484 LITR1N_vr LITR1 N (vertically resolved) gN/m^3 T + 485 LITR1_HR Het. Resp. from litter 1 gC/m^2/s F + 486 LITR1_HR_vr Het. Resp. from litter 1 gC/m^3/s F + 487 LITR2C LITR2 C gC/m^2 T + 488 LITR2C_1m LITR2 C to 1 meter gC/m^2 F + 489 LITR2C_TNDNCY_VERT_TRANS litter 2 C tendency due to vertical transport gC/m^3/s F + 490 LITR2C_TO_SOIL1C decomp. of litter 2 C to soil 1 C gC/m^2/s F + 491 LITR2C_TO_SOIL1C_vr decomp. of litter 2 C to soil 1 C gC/m^3/s F + 492 LITR2C_vr LITR2 C (vertically resolved) gC/m^3 T + 493 LITR2N LITR2 N gN/m^2 T + 494 LITR2N_1m LITR2 N to 1 meter gN/m^2 F + 495 LITR2N_TNDNCY_VERT_TRANS litter 2 N tendency due to vertical transport gN/m^3/s F + 496 LITR2N_TO_SOIL1N decomp. of litter 2 N to soil 1 N gN/m^2 F + 497 LITR2N_TO_SOIL1N_vr decomp. of litter 2 N to soil 1 N gN/m^3 F + 498 LITR2N_vr LITR2 N (vertically resolved) gN/m^3 T + 499 LITR2_HR Het. Resp. from litter 2 gC/m^2/s F + 500 LITR2_HR_vr Het. Resp. from litter 2 gC/m^3/s F + 501 LITR3C LITR3 C gC/m^2 T + 502 LITR3C_1m LITR3 C to 1 meter gC/m^2 F + 503 LITR3C_TNDNCY_VERT_TRANS litter 3 C tendency due to vertical transport gC/m^3/s F + 504 LITR3C_TO_SOIL2C decomp. of litter 3 C to soil 2 C gC/m^2/s F + 505 LITR3C_TO_SOIL2C_vr decomp. of litter 3 C to soil 2 C gC/m^3/s F + 506 LITR3C_vr LITR3 C (vertically resolved) gC/m^3 T + 507 LITR3N LITR3 N gN/m^2 T + 508 LITR3N_1m LITR3 N to 1 meter gN/m^2 F + 509 LITR3N_TNDNCY_VERT_TRANS litter 3 N tendency due to vertical transport gN/m^3/s F + 510 LITR3N_TO_SOIL2N decomp. of litter 3 N to soil 2 N gN/m^2 F + 511 LITR3N_TO_SOIL2N_vr decomp. of litter 3 N to soil 2 N gN/m^3 F + 512 LITR3N_vr LITR3 N (vertically resolved) gN/m^3 T + 513 LITR3_HR Het. Resp. from litter 3 gC/m^2/s F + 514 LITR3_HR_vr Het. Resp. from litter 3 gC/m^3/s F + 515 LITTERC_HR litter C heterotrophic respiration gC/m^2/s T + 516 LITTERC_LOSS litter C loss gC/m^2/s T + 517 LIVECROOTC live coarse root C gC/m^2 T + 518 LIVECROOTC_STORAGE live coarse root C storage gC/m^2 F + 519 LIVECROOTC_STORAGE_TO_XFER live coarse root C shift storage to transfer gC/m^2/s F + 520 LIVECROOTC_TO_DEADCROOTC live coarse root C turnover gC/m^2/s F + 521 LIVECROOTC_XFER live coarse root C transfer gC/m^2 F + 522 LIVECROOTC_XFER_TO_LIVECROOTC live coarse root C growth from storage gC/m^2/s F + 523 LIVECROOTN live coarse root N gN/m^2 T + 524 LIVECROOTN_STORAGE live coarse root N storage gN/m^2 F + 525 LIVECROOTN_STORAGE_TO_XFER live coarse root N shift storage to transfer gN/m^2/s F + 526 LIVECROOTN_TO_DEADCROOTN live coarse root N turnover gN/m^2/s F + 527 LIVECROOTN_TO_RETRANSN live coarse root N to retranslocated N pool gN/m^2/s F + 528 LIVECROOTN_XFER live coarse root N transfer gN/m^2 F + 529 LIVECROOTN_XFER_TO_LIVECROOTN live coarse root N growth from storage gN/m^2/s F + 530 LIVECROOT_MR live coarse root maintenance respiration gC/m^2/s F + 531 LIVESTEMC live stem C gC/m^2 T + 532 LIVESTEMC_STORAGE live stem C storage gC/m^2 F + 533 LIVESTEMC_STORAGE_TO_XFER live stem C shift storage to transfer gC/m^2/s F + 534 LIVESTEMC_TO_BIOFUELC livestem C to biofuel C gC/m^2/s T + 535 LIVESTEMC_TO_DEADSTEMC live stem C turnover gC/m^2/s F + 536 LIVESTEMC_XFER live stem C transfer gC/m^2 F + 537 LIVESTEMC_XFER_TO_LIVESTEMC live stem C growth from storage gC/m^2/s F + 538 LIVESTEMN live stem N gN/m^2 T + 539 LIVESTEMN_STORAGE live stem N storage gN/m^2 F + 540 LIVESTEMN_STORAGE_TO_XFER live stem N shift storage to transfer gN/m^2/s F + 541 LIVESTEMN_TO_DEADSTEMN live stem N turnover gN/m^2/s F + 542 LIVESTEMN_TO_RETRANSN live stem N to retranslocated N pool gN/m^2/s F + 543 LIVESTEMN_XFER live stem N transfer gN/m^2 F + 544 LIVESTEMN_XFER_TO_LIVESTEMN live stem N growth from storage gN/m^2/s F + 545 LIVESTEM_MR live stem maintenance respiration gC/m^2/s F + 546 LNC leaf N concentration gN leaf/m^2 T + 547 LWdown atmospheric longwave radiation (downscaled to columns in glacier regions) W/m^2 F + 548 LWup upwelling longwave radiation W/m^2 F + 549 MEG_acetaldehyde MEGAN flux kg/m2/sec T + 550 MEG_acetic_acid MEGAN flux kg/m2/sec T + 551 MEG_acetone MEGAN flux kg/m2/sec T + 552 MEG_carene_3 MEGAN flux kg/m2/sec T + 553 MEG_ethanol MEGAN flux kg/m2/sec T + 554 MEG_formaldehyde MEGAN flux kg/m2/sec T + 555 MEG_isoprene MEGAN flux kg/m2/sec T + 556 MEG_methanol MEGAN flux kg/m2/sec T + 557 MEG_pinene_a MEGAN flux kg/m2/sec T + 558 MEG_thujene_a MEGAN flux kg/m2/sec T + 559 MR maintenance respiration gC/m^2/s T + 560 M_CWDC_TO_FIRE coarse woody debris C fire loss gC/m^2/s F + 561 M_CWDC_TO_FIRE_vr coarse woody debris C fire loss gC/m^3/s F + 562 M_CWDN_TO_FIRE coarse woody debris N fire loss gN/m^2 F + 563 M_CWDN_TO_FIRE_vr coarse woody debris N fire loss gN/m^3 F + 564 M_DEADCROOTC_STORAGE_TO_LITTER dead coarse root C storage mortality gC/m^2/s F + 565 M_DEADCROOTC_STORAGE_TO_LITTER_FIRE dead coarse root C storage fire mortality to litter gC/m^2/s F + 566 M_DEADCROOTC_TO_LITTER dead coarse root C mortality gC/m^2/s F + 567 M_DEADCROOTC_XFER_TO_LITTER dead coarse root C transfer mortality gC/m^2/s F + 568 M_DEADCROOTN_STORAGE_TO_FIRE dead coarse root N storage fire loss gN/m^2/s F + 569 M_DEADCROOTN_STORAGE_TO_LITTER dead coarse root N storage mortality gN/m^2/s F + 570 M_DEADCROOTN_TO_FIRE dead coarse root N fire loss gN/m^2/s F + 571 M_DEADCROOTN_TO_LITTER dead coarse root N mortality gN/m^2/s F + 572 M_DEADCROOTN_TO_LITTER_FIRE dead coarse root N fire mortality to litter gN/m^2/s F + 573 M_DEADCROOTN_XFER_TO_FIRE dead coarse root N transfer fire loss gN/m^2/s F + 574 M_DEADCROOTN_XFER_TO_LITTER dead coarse root N transfer mortality gN/m^2/s F + 575 M_DEADROOTC_STORAGE_TO_FIRE dead root C storage fire loss gC/m^2/s F + 576 M_DEADROOTC_STORAGE_TO_LITTER_FIRE dead root C storage fire mortality to litter gC/m^2/s F + 577 M_DEADROOTC_TO_FIRE dead root C fire loss gC/m^2/s F + 578 M_DEADROOTC_TO_LITTER_FIRE dead root C fire mortality to litter gC/m^2/s F + 579 M_DEADROOTC_XFER_TO_FIRE dead root C transfer fire loss gC/m^2/s F + 580 M_DEADROOTC_XFER_TO_LITTER_FIRE dead root C transfer fire mortality to litter gC/m^2/s F + 581 M_DEADSTEMC_STORAGE_TO_FIRE dead stem C storage fire loss gC/m^2/s F + 582 M_DEADSTEMC_STORAGE_TO_LITTER dead stem C storage mortality gC/m^2/s F + 583 M_DEADSTEMC_STORAGE_TO_LITTER_FIRE dead stem C storage fire mortality to litter gC/m^2/s F + 584 M_DEADSTEMC_TO_FIRE dead stem C fire loss gC/m^2/s F + 585 M_DEADSTEMC_TO_LITTER dead stem C mortality gC/m^2/s F + 586 M_DEADSTEMC_TO_LITTER_FIRE dead stem C fire mortality to litter gC/m^2/s F + 587 M_DEADSTEMC_XFER_TO_FIRE dead stem C transfer fire loss gC/m^2/s F + 588 M_DEADSTEMC_XFER_TO_LITTER dead stem C transfer mortality gC/m^2/s F + 589 M_DEADSTEMC_XFER_TO_LITTER_FIRE dead stem C transfer fire mortality to litter gC/m^2/s F + 590 M_DEADSTEMN_STORAGE_TO_FIRE dead stem N storage fire loss gN/m^2/s F + 591 M_DEADSTEMN_STORAGE_TO_LITTER dead stem N storage mortality gN/m^2/s F + 592 M_DEADSTEMN_TO_FIRE dead stem N fire loss gN/m^2/s F + 593 M_DEADSTEMN_TO_LITTER dead stem N mortality gN/m^2/s F + 594 M_DEADSTEMN_TO_LITTER_FIRE dead stem N fire mortality to litter gN/m^2/s F + 595 M_DEADSTEMN_XFER_TO_FIRE dead stem N transfer fire loss gN/m^2/s F + 596 M_DEADSTEMN_XFER_TO_LITTER dead stem N transfer mortality gN/m^2/s F + 597 M_FROOTC_STORAGE_TO_FIRE fine root C storage fire loss gC/m^2/s F + 598 M_FROOTC_STORAGE_TO_LITTER fine root C storage mortality gC/m^2/s F + 599 M_FROOTC_STORAGE_TO_LITTER_FIRE fine root C storage fire mortality to litter gC/m^2/s F + 600 M_FROOTC_TO_FIRE fine root C fire loss gC/m^2/s F + 601 M_FROOTC_TO_LITTER fine root C mortality gC/m^2/s F + 602 M_FROOTC_TO_LITTER_FIRE fine root C fire mortality to litter gC/m^2/s F + 603 M_FROOTC_XFER_TO_FIRE fine root C transfer fire loss gC/m^2/s F + 604 M_FROOTC_XFER_TO_LITTER fine root C transfer mortality gC/m^2/s F + 605 M_FROOTC_XFER_TO_LITTER_FIRE fine root C transfer fire mortality to litter gC/m^2/s F + 606 M_FROOTN_STORAGE_TO_FIRE fine root N storage fire loss gN/m^2/s F + 607 M_FROOTN_STORAGE_TO_LITTER fine root N storage mortality gN/m^2/s F + 608 M_FROOTN_TO_FIRE fine root N fire loss gN/m^2/s F + 609 M_FROOTN_TO_LITTER fine root N mortality gN/m^2/s F + 610 M_FROOTN_XFER_TO_FIRE fine root N transfer fire loss gN/m^2/s F + 611 M_FROOTN_XFER_TO_LITTER fine root N transfer mortality gN/m^2/s F + 612 M_GRESP_STORAGE_TO_FIRE growth respiration storage fire loss gC/m^2/s F + 613 M_GRESP_STORAGE_TO_LITTER growth respiration storage mortality gC/m^2/s F + 614 M_GRESP_STORAGE_TO_LITTER_FIRE growth respiration storage fire mortality to litter gC/m^2/s F + 615 M_GRESP_XFER_TO_FIRE growth respiration transfer fire loss gC/m^2/s F + 616 M_GRESP_XFER_TO_LITTER growth respiration transfer mortality gC/m^2/s F + 617 M_GRESP_XFER_TO_LITTER_FIRE growth respiration transfer fire mortality to litter gC/m^2/s F + 618 M_LEAFC_STORAGE_TO_FIRE leaf C storage fire loss gC/m^2/s F + 619 M_LEAFC_STORAGE_TO_LITTER leaf C storage mortality gC/m^2/s F + 620 M_LEAFC_STORAGE_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s F + 621 M_LEAFC_TO_FIRE leaf C fire loss gC/m^2/s F + 622 M_LEAFC_TO_LITTER leaf C mortality gC/m^2/s F + 623 M_LEAFC_TO_LITTER_FIRE leaf C fire mortality to litter gC/m^2/s F + 624 M_LEAFC_XFER_TO_FIRE leaf C transfer fire loss gC/m^2/s F + 625 M_LEAFC_XFER_TO_LITTER leaf C transfer mortality gC/m^2/s F + 626 M_LEAFC_XFER_TO_LITTER_FIRE leaf C transfer fire mortality to litter gC/m^2/s F + 627 M_LEAFN_STORAGE_TO_FIRE leaf N storage fire loss gN/m^2/s F + 628 M_LEAFN_STORAGE_TO_LITTER leaf N storage mortality gN/m^2/s F + 629 M_LEAFN_TO_FIRE leaf N fire loss gN/m^2/s F + 630 M_LEAFN_TO_LITTER leaf N mortality gN/m^2/s F + 631 M_LEAFN_XFER_TO_FIRE leaf N transfer fire loss gN/m^2/s F + 632 M_LEAFN_XFER_TO_LITTER leaf N transfer mortality gN/m^2/s F + 633 M_LITR1C_TO_FIRE litter 1 C fire loss gC/m^2/s F + 634 M_LITR1C_TO_FIRE_vr litter 1 C fire loss gC/m^3/s F + 635 M_LITR1C_TO_LEACHING litter 1 C leaching loss gC/m^2/s F + 636 M_LITR1N_TO_FIRE litter 1 N fire loss gN/m^2 F + 637 M_LITR1N_TO_FIRE_vr litter 1 N fire loss gN/m^3 F + 638 M_LITR1N_TO_LEACHING litter 1 N leaching loss gN/m^2/s F + 639 M_LITR2C_TO_FIRE litter 2 C fire loss gC/m^2/s F + 640 M_LITR2C_TO_FIRE_vr litter 2 C fire loss gC/m^3/s F + 641 M_LITR2C_TO_LEACHING litter 2 C leaching loss gC/m^2/s F + 642 M_LITR2N_TO_FIRE litter 2 N fire loss gN/m^2 F + 643 M_LITR2N_TO_FIRE_vr litter 2 N fire loss gN/m^3 F + 644 M_LITR2N_TO_LEACHING litter 2 N leaching loss gN/m^2/s F + 645 M_LITR3C_TO_FIRE litter 3 C fire loss gC/m^2/s F + 646 M_LITR3C_TO_FIRE_vr litter 3 C fire loss gC/m^3/s F + 647 M_LITR3C_TO_LEACHING litter 3 C leaching loss gC/m^2/s F + 648 M_LITR3N_TO_FIRE litter 3 N fire loss gN/m^2 F + 649 M_LITR3N_TO_FIRE_vr litter 3 N fire loss gN/m^3 F + 650 M_LITR3N_TO_LEACHING litter 3 N leaching loss gN/m^2/s F + 651 M_LIVECROOTC_STORAGE_TO_LITTER live coarse root C storage mortality gC/m^2/s F + 652 M_LIVECROOTC_STORAGE_TO_LITTER_FIRE live coarse root C fire mortality to litter gC/m^2/s F + 653 M_LIVECROOTC_TO_LITTER live coarse root C mortality gC/m^2/s F + 654 M_LIVECROOTC_XFER_TO_LITTER live coarse root C transfer mortality gC/m^2/s F + 655 M_LIVECROOTN_STORAGE_TO_FIRE live coarse root N storage fire loss gN/m^2/s F + 656 M_LIVECROOTN_STORAGE_TO_LITTER live coarse root N storage mortality gN/m^2/s F + 657 M_LIVECROOTN_TO_FIRE live coarse root N fire loss gN/m^2/s F + 658 M_LIVECROOTN_TO_LITTER live coarse root N mortality gN/m^2/s F + 659 M_LIVECROOTN_XFER_TO_FIRE live coarse root N transfer fire loss gN/m^2/s F + 660 M_LIVECROOTN_XFER_TO_LITTER live coarse root N transfer mortality gN/m^2/s F + 661 M_LIVEROOTC_STORAGE_TO_FIRE live root C storage fire loss gC/m^2/s F + 662 M_LIVEROOTC_STORAGE_TO_LITTER_FIRE live root C storage fire mortality to litter gC/m^2/s F + 663 M_LIVEROOTC_TO_DEADROOTC_FIRE live root C fire mortality to dead root C gC/m^2/s F + 664 M_LIVEROOTC_TO_FIRE live root C fire loss gC/m^2/s F + 665 M_LIVEROOTC_TO_LITTER_FIRE live root C fire mortality to litter gC/m^2/s F + 666 M_LIVEROOTC_XFER_TO_FIRE live root C transfer fire loss gC/m^2/s F + 667 M_LIVEROOTC_XFER_TO_LITTER_FIRE live root C transfer fire mortality to litter gC/m^2/s F + 668 M_LIVESTEMC_STORAGE_TO_FIRE live stem C storage fire loss gC/m^2/s F + 669 M_LIVESTEMC_STORAGE_TO_LITTER live stem C storage mortality gC/m^2/s F + 670 M_LIVESTEMC_STORAGE_TO_LITTER_FIRE live stem C storage fire mortality to litter gC/m^2/s F + 671 M_LIVESTEMC_TO_DEADSTEMC_FIRE live stem C fire mortality to dead stem C gC/m^2/s F + 672 M_LIVESTEMC_TO_FIRE live stem C fire loss gC/m^2/s F + 673 M_LIVESTEMC_TO_LITTER live stem C mortality gC/m^2/s F + 674 M_LIVESTEMC_TO_LITTER_FIRE live stem C fire mortality to litter gC/m^2/s F + 675 M_LIVESTEMC_XFER_TO_FIRE live stem C transfer fire loss gC/m^2/s F + 676 M_LIVESTEMC_XFER_TO_LITTER live stem C transfer mortality gC/m^2/s F + 677 M_LIVESTEMC_XFER_TO_LITTER_FIRE live stem C transfer fire mortality to litter gC/m^2/s F + 678 M_LIVESTEMN_STORAGE_TO_FIRE live stem N storage fire loss gN/m^2/s F + 679 M_LIVESTEMN_STORAGE_TO_LITTER live stem N storage mortality gN/m^2/s F + 680 M_LIVESTEMN_TO_FIRE live stem N fire loss gN/m^2/s F + 681 M_LIVESTEMN_TO_LITTER live stem N mortality gN/m^2/s F + 682 M_LIVESTEMN_XFER_TO_FIRE live stem N transfer fire loss gN/m^2/s F + 683 M_LIVESTEMN_XFER_TO_LITTER live stem N transfer mortality gN/m^2/s F + 684 M_RETRANSN_TO_FIRE retranslocated N pool fire loss gN/m^2/s F + 685 M_RETRANSN_TO_LITTER retranslocated N pool mortality gN/m^2/s F + 686 M_SOIL1C_TO_LEACHING soil 1 C leaching loss gC/m^2/s F + 687 M_SOIL1N_TO_LEACHING soil 1 N leaching loss gN/m^2/s F + 688 M_SOIL2C_TO_LEACHING soil 2 C leaching loss gC/m^2/s F + 689 M_SOIL2N_TO_LEACHING soil 2 N leaching loss gN/m^2/s F + 690 M_SOIL3C_TO_LEACHING soil 3 C leaching loss gC/m^2/s F + 691 M_SOIL3N_TO_LEACHING soil 3 N leaching loss gN/m^2/s F + 692 NACTIVE Mycorrhizal N uptake flux gN/m^2/s T + 693 NACTIVE_NH4 Mycorrhizal N uptake flux gN/m^2/s T + 694 NACTIVE_NO3 Mycorrhizal N uptake flux gN/m^2/s T + 695 NAM AM-associated N uptake flux gN/m^2/s T + 696 NAM_NH4 AM-associated N uptake flux gN/m^2/s T + 697 NAM_NO3 AM-associated N uptake flux gN/m^2/s T + 698 NBP net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux (latter smoothed o gC/m^2/s T + 699 NDEPLOY total N deployed in new growth gN/m^2/s T + 700 NDEP_PROF profile for atmospheric N deposition 1/m F + 701 NDEP_TO_SMINN atmospheric N deposition to soil mineral N gN/m^2/s T + 702 NECM ECM-associated N uptake flux gN/m^2/s T + 703 NECM_NH4 ECM-associated N uptake flux gN/m^2/s T + 704 NECM_NO3 ECM-associated N uptake flux gN/m^2/s T + 705 NEE net ecosystem exchange of carbon, includes fire and hrv_xsmrpool (latter smoothed over the yea gC/m^2/s T + 706 NEM Gridcell net adjustment to net carbon exchange passed to atm. for methane production gC/m2/s T + 707 NEP net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink gC/m^2/s T + 708 NET_NMIN net rate of N mineralization gN/m^2/s T + 709 NET_NMIN_vr net rate of N mineralization gN/m^3/s F + 710 NFERTILIZATION fertilizer added gN/m^2/s T + 711 NFIRE fire counts valid only in Reg.C counts/km2/sec T + 712 NFIX Symbiotic BNF uptake flux gN/m^2/s T + 713 NFIXATION_PROF profile for biological N fixation 1/m F + 714 NFIX_TO_SMINN symbiotic/asymbiotic N fixation to soil mineral N gN/m^2/s F + 715 NNONMYC Non-mycorrhizal N uptake flux gN/m^2/s T + 716 NNONMYC_NH4 Non-mycorrhizal N uptake flux gN/m^2/s T + 717 NNONMYC_NO3 Non-mycorrhizal N uptake flux gN/m^2/s T + 718 NPASSIVE Passive N uptake flux gN/m^2/s T + 719 NPOOL temporary plant N pool gN/m^2 T + 720 NPOOL_TO_DEADCROOTN allocation to dead coarse root N gN/m^2/s F + 721 NPOOL_TO_DEADCROOTN_STORAGE allocation to dead coarse root N storage gN/m^2/s F + 722 NPOOL_TO_DEADSTEMN allocation to dead stem N gN/m^2/s F + 723 NPOOL_TO_DEADSTEMN_STORAGE allocation to dead stem N storage gN/m^2/s F + 724 NPOOL_TO_FROOTN allocation to fine root N gN/m^2/s F + 725 NPOOL_TO_FROOTN_STORAGE allocation to fine root N storage gN/m^2/s F + 726 NPOOL_TO_LEAFN allocation to leaf N gN/m^2/s F + 727 NPOOL_TO_LEAFN_STORAGE allocation to leaf N storage gN/m^2/s F + 728 NPOOL_TO_LIVECROOTN allocation to live coarse root N gN/m^2/s F + 729 NPOOL_TO_LIVECROOTN_STORAGE allocation to live coarse root N storage gN/m^2/s F + 730 NPOOL_TO_LIVESTEMN allocation to live stem N gN/m^2/s F + 731 NPOOL_TO_LIVESTEMN_STORAGE allocation to live stem N storage gN/m^2/s F + 732 NPP net primary production gC/m^2/s T + 733 NPP_BURNEDOFF C that cannot be used for N uptake gC/m^2/s F + 734 NPP_GROWTH Total C used for growth in FUN gC/m^2/s T + 735 NPP_NACTIVE Mycorrhizal N uptake used C gC/m^2/s T + 736 NPP_NACTIVE_NH4 Mycorrhizal N uptake use C gC/m^2/s T + 737 NPP_NACTIVE_NO3 Mycorrhizal N uptake used C gC/m^2/s T + 738 NPP_NAM AM-associated N uptake used C gC/m^2/s T + 739 NPP_NAM_NH4 AM-associated N uptake use C gC/m^2/s T + 740 NPP_NAM_NO3 AM-associated N uptake use C gC/m^2/s T + 741 NPP_NECM ECM-associated N uptake used C gC/m^2/s T + 742 NPP_NECM_NH4 ECM-associated N uptake use C gC/m^2/s T + 743 NPP_NECM_NO3 ECM-associated N uptake used C gC/m^2/s T + 744 NPP_NFIX Symbiotic BNF uptake used C gC/m^2/s T + 745 NPP_NNONMYC Non-mycorrhizal N uptake used C gC/m^2/s T + 746 NPP_NNONMYC_NH4 Non-mycorrhizal N uptake use C gC/m^2/s T + 747 NPP_NNONMYC_NO3 Non-mycorrhizal N uptake use C gC/m^2/s T + 748 NPP_NRETRANS Retranslocated N uptake flux gC/m^2/s T + 749 NPP_NUPTAKE Total C used by N uptake in FUN gC/m^2/s T + 750 NRETRANS Retranslocated N uptake flux gN/m^2/s T + 751 NRETRANS_REG Retranslocated N uptake flux gN/m^2/s T + 752 NRETRANS_SEASON Retranslocated N uptake flux gN/m^2/s T + 753 NRETRANS_STRESS Retranslocated N uptake flux gN/m^2/s T + 754 NSUBSTEPS number of adaptive timesteps in CLM timestep unitless F + 755 NUPTAKE Total N uptake of FUN gN/m^2/s T + 756 NUPTAKE_NPP_FRACTION frac of NPP used in N uptake - T + 757 N_ALLOMETRY N allocation index none F + 758 O2_DECOMP_DEPTH_UNSAT O2 consumption from HR and AR for non-inundated area mol/m3/s F + 759 OCDEP total OC deposition (dry+wet) from atmosphere kg/m^2/s T + 760 OFFSET_COUNTER offset days counter days F + 761 OFFSET_FDD offset freezing degree days counter C degree-days F + 762 OFFSET_FLAG offset flag none F + 763 OFFSET_SWI offset soil water index none F + 764 ONSET_COUNTER onset days counter days F + 765 ONSET_FDD onset freezing degree days counter C degree-days F + 766 ONSET_FLAG onset flag none F + 767 ONSET_GDD onset growing degree days C degree-days F + 768 ONSET_GDDFLAG onset flag for growing degree day sum none F + 769 ONSET_SWI onset soil water index none F + 770 O_SCALAR fraction by which decomposition is reduced due to anoxia unitless T + 771 PAR240DZ 10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer W/m^2 F + 772 PAR240XZ 10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer W/m^2 F + 773 PAR240_shade shade PAR (240 hrs) umol/m2/s F + 774 PAR240_sun sunlit PAR (240 hrs) umol/m2/s F + 775 PAR24_shade shade PAR (24 hrs) umol/m2/s F + 776 PAR24_sun sunlit PAR (24 hrs) umol/m2/s F + 777 PARVEGLN absorbed par by vegetation at local noon W/m^2 T + 778 PAR_shade shade PAR umol/m2/s F + 779 PAR_sun sunlit PAR umol/m2/s F + 780 PBOT atmospheric pressure at surface (downscaled to columns in glacier regions) Pa T + 781 PBOT_240 10 day running mean of air pressure Pa F + 782 PCH4 atmospheric partial pressure of CH4 Pa T + 783 PCO2 atmospheric partial pressure of CO2 Pa T + 784 PCO2_240 10 day running mean of CO2 pressure Pa F + 785 PFT_CTRUNC patch-level sink for C truncation gC/m^2 F + 786 PFT_FIRE_CLOSS total patch-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T + 787 PFT_FIRE_NLOSS total patch-level fire N loss gN/m^2/s T + 788 PFT_NTRUNC patch-level sink for N truncation gN/m^2 F + 789 PLANTCN Plant C:N used by FUN unitless F + 790 PLANT_CALLOC total allocated C flux gC/m^2/s F + 791 PLANT_NALLOC total allocated N flux gN/m^2/s F + 792 PLANT_NDEMAND N flux required to support initial GPP gN/m^2/s T + 793 PNLCZ Proportion of nitrogen allocated for light capture unitless F + 794 PO2_240 10 day running mean of O2 pressure Pa F + 795 POTENTIAL_IMMOB potential N immobilization gN/m^2/s T + 796 POTENTIAL_IMMOB_vr potential N immobilization gN/m^3/s F + 797 POT_F_DENIT potential denitrification flux gN/m^2/s T + 798 POT_F_DENIT_vr potential denitrification flux gN/m^3/s F + 799 POT_F_NIT potential nitrification flux gN/m^2/s T + 800 POT_F_NIT_vr potential nitrification flux gN/m^3/s F + 801 PREC10 10-day running mean of PREC MM H2O/S F + 802 PREC60 60-day running mean of PREC MM H2O/S F + 803 PREV_DAYL daylength from previous timestep s F + 804 PREV_FROOTC_TO_LITTER previous timestep froot C litterfall flux gC/m^2/s F + 805 PREV_LEAFC_TO_LITTER previous timestep leaf C litterfall flux gC/m^2/s F + 806 PROD100C 100-yr wood product C gC/m^2 F + 807 PROD100C_LOSS loss from 100-yr wood product pool gC/m^2/s F + 808 PROD100N 100-yr wood product N gN/m^2 F + 809 PROD100N_LOSS loss from 100-yr wood product pool gN/m^2/s F + 810 PROD10C 10-yr wood product C gC/m^2 F + 811 PROD10C_LOSS loss from 10-yr wood product pool gC/m^2/s F + 812 PROD10N 10-yr wood product N gN/m^2 F + 813 PROD10N_LOSS loss from 10-yr wood product pool gN/m^2/s F + 814 PSNSHA shaded leaf photosynthesis umolCO2/m^2/s T + 815 PSNSHADE_TO_CPOOL C fixation from shaded canopy gC/m^2/s T + 816 PSNSUN sunlit leaf photosynthesis umolCO2/m^2/s T + 817 PSNSUN_TO_CPOOL C fixation from sunlit canopy gC/m^2/s T + 818 PSurf atmospheric pressure at surface (downscaled to columns in glacier regions) Pa F + 819 Q2M 2m specific humidity kg/kg T + 820 QBOT atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg T + 821 QCHARGE aquifer recharge rate (natural vegetated and crop landunits only) mm/s T + 822 QDIRECT_THROUGHFALL direct throughfall of liquid (rain + above-canopy irrigation) mm/s F + 823 QDIRECT_THROUGHFALL_SNOW direct throughfall of snow mm/s F + 824 QDRAI sub-surface drainage mm/s T + 825 QDRAI_PERCH perched wt drainage mm/s T + 826 QDRAI_XS saturation excess drainage mm/s T + 827 QDRIP rate of excess canopy liquid falling off canopy mm/s F + 828 QDRIP_SNOW rate of excess canopy snow falling off canopy mm/s F + 829 QFLOOD runoff from river flooding mm/s T + 830 QFLX_EVAP_TOT qflx_evap_soi + qflx_evap_can + qflx_tran_veg kg m-2 s-1 T + 831 QFLX_EVAP_VEG vegetation evaporation mm H2O/s F + 832 QFLX_ICE_DYNBAL ice dynamic land cover change conversion runoff flux mm/s T + 833 QFLX_LIQDEW_TO_TOP_LAYER rate of liquid water deposited on top soil or snow layer (dew) mm H2O/s T + 834 QFLX_LIQEVAP_FROM_TOP_LAYER rate of liquid water evaporated from top soil or snow layer mm H2O/s T + 835 QFLX_LIQ_DYNBAL liq dynamic land cover change conversion runoff flux mm/s T + 836 QFLX_LIQ_GRND liquid (rain+irrigation) on ground after interception mm H2O/s F + 837 QFLX_SNOW_DRAIN drainage from snow pack mm/s T + 838 QFLX_SNOW_DRAIN_ICE drainage from snow pack melt (ice landunits only) mm/s T + 839 QFLX_SNOW_GRND snow on ground after interception mm H2O/s F + 840 QFLX_SOLIDDEW_TO_TOP_LAYER rate of solid water deposited on top soil or snow layer (frost) mm H2O/s T + 841 QFLX_SOLIDEVAP_FROM_TOP_LAYER rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s T + 842 QFLX_SOLIDEVAP_FROM_TOP_LAYER_ICE rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s F + 843 QH2OSFC surface water runoff mm/s T + 844 QH2OSFC_TO_ICE surface water converted to ice mm/s F + 845 QHR hydraulic redistribution mm/s T + 846 QICE ice growth/melt mm/s T + 847 QICE_FORC qice forcing sent to GLC mm/s F + 848 QICE_FRZ ice growth mm/s T + 849 QICE_MELT ice melt mm/s T + 850 QINFL infiltration mm/s T + 851 QINTR interception mm/s T + 852 QIRRIG_DEMAND irrigation demand mm/s F + 853 QIRRIG_DRIP water added via drip irrigation mm/s F + 854 QIRRIG_FROM_GW_CONFINED water added through confined groundwater irrigation mm/s T + 855 QIRRIG_FROM_GW_UNCONFINED water added through unconfined groundwater irrigation mm/s T + 856 QIRRIG_FROM_SURFACE water added through surface water irrigation mm/s T + 857 QIRRIG_SPRINKLER water added via sprinkler irrigation mm/s F + 858 QOVER total surface runoff (includes QH2OSFC) mm/s T + 859 QOVER_LAG time-lagged surface runoff for soil columns mm/s F + 860 QPHSNEG net negative hydraulic redistribution flux mm/s F + 861 QRGWL surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff fro mm/s T + 862 QROOTSINK water flux from soil to root in each soil-layer mm/s F + 863 QRUNOFF total liquid runoff not including correction for land use change mm/s T + 864 QRUNOFF_ICE total liquid runoff not incl corret for LULCC (ice landunits only) mm/s T + 865 QRUNOFF_ICE_TO_COUPLER total ice runoff sent to coupler (includes corrections for land use change) mm/s T + 866 QRUNOFF_ICE_TO_LIQ liquid runoff from converted ice runoff mm/s F + 867 QRUNOFF_R Rural total runoff mm/s F + 868 QRUNOFF_TO_COUPLER total liquid runoff sent to coupler (includes corrections for land use change) mm/s T + 869 QRUNOFF_U Urban total runoff mm/s F + 870 QSNOCPLIQ excess liquid h2o due to snow capping not including correction for land use change mm H2O/s T + 871 QSNOEVAP evaporation from snow (only when snl<0, otherwise it is equal to qflx_ev_soil) mm/s T + 872 QSNOFRZ column-integrated snow freezing rate kg/m2/s T + 873 QSNOFRZ_ICE column-integrated snow freezing rate (ice landunits only) mm/s T + 874 QSNOMELT snow melt rate mm/s T + 875 QSNOMELT_ICE snow melt (ice landunits only) mm/s T + 876 QSNOUNLOAD canopy snow unloading mm/s T + 877 QSNO_TEMPUNLOAD canopy snow temp unloading mm/s T + 878 QSNO_WINDUNLOAD canopy snow wind unloading mm/s T + 879 QSNWCPICE excess solid h2o due to snow capping not including correction for land use change mm H2O/s T + 880 QSOIL Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew) mm/s T + 881 QSOIL_ICE Ground evaporation (ice landunits only) mm/s T + 882 QTOPSOIL water input to surface mm/s F + 883 QVEGE canopy evaporation mm/s T + 884 QVEGT canopy transpiration mm/s T + 885 Qair atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg F + 886 Qh sensible heat W/m^2 F + 887 Qle total evaporation W/m^2 F + 888 Qstor storage heat flux (includes snowmelt) W/m^2 F + 889 Qtau momentum flux kg/m/s^2 F + 890 RAIN atmospheric rain, after rain/snow repartitioning based on temperature mm/s T + 891 RAIN_FROM_ATM atmospheric rain received from atmosphere (pre-repartitioning) mm/s T + 892 RAIN_ICE atmospheric rain, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F + 893 RAM1 aerodynamical resistance s/m F + 894 RAM_LAKE aerodynamic resistance for momentum (lakes only) s/m F + 895 RB10 10 day running mean boundary layer resistance s/m F + 896 RETRANSN plant pool of retranslocated N gN/m^2 T + 897 RETRANSN_TO_NPOOL deployment of retranslocated N gN/m^2/s T + 898 RH atmospheric relative humidity % F + 899 RH2M 2m relative humidity % T + 900 RH2M_R Rural 2m specific humidity % F + 901 RH2M_U Urban 2m relative humidity % F + 902 RH30 30-day running mean of relative humidity % F + 903 RHAF fractional humidity of canopy air fraction F + 904 RHAF10 10 day running mean of fractional humidity of canopy air fraction F + 905 RH_LEAF fractional humidity at leaf surface fraction F + 906 ROOTR effective fraction of roots in each soil layer (SMS method) proportion F + 907 RR root respiration (fine root MR + total root GR) gC/m^2/s T + 908 RRESIS root resistance in each soil layer proportion F + 909 RSSHA shaded leaf stomatal resistance s/m T + 910 RSSUN sunlit leaf stomatal resistance s/m T + 911 Rainf atmospheric rain, after rain/snow repartitioning based on temperature mm/s F + 912 Rnet net radiation W/m^2 F + 913 SABG solar rad absorbed by ground W/m^2 T + 914 SABG_PEN Rural solar rad penetrating top soil or snow layer watt/m^2 T + 915 SABV solar rad absorbed by veg W/m^2 T + 916 SEEDC pool for seeding new PFTs via dynamic landcover gC/m^2 T + 917 SEEDN pool for seeding new PFTs via dynamic landcover gN/m^2 T + 918 SLASH_HARVESTC slash harvest carbon (to litter) gC/m^2/s T + 919 SMINN soil mineral N gN/m^2 T + 920 SMINN_TO_NPOOL deployment of soil mineral N uptake gN/m^2/s T + 921 SMINN_TO_PLANT plant uptake of soil mineral N gN/m^2/s T + 922 SMINN_TO_PLANT_FUN Total soil N uptake of FUN gN/m^2/s T + 923 SMINN_TO_PLANT_vr plant uptake of soil mineral N gN/m^3/s F + 924 SMINN_TO_SOIL1N_L1 mineral N flux for decomp. of LITR1to SOIL1 gN/m^2 F + 925 SMINN_TO_SOIL1N_L1_vr mineral N flux for decomp. of LITR1to SOIL1 gN/m^3 F + 926 SMINN_TO_SOIL1N_L2 mineral N flux for decomp. of LITR2to SOIL1 gN/m^2 F + 927 SMINN_TO_SOIL1N_L2_vr mineral N flux for decomp. of LITR2to SOIL1 gN/m^3 F + 928 SMINN_TO_SOIL1N_S2 mineral N flux for decomp. of SOIL2to SOIL1 gN/m^2 F + 929 SMINN_TO_SOIL1N_S2_vr mineral N flux for decomp. of SOIL2to SOIL1 gN/m^3 F + 930 SMINN_TO_SOIL1N_S3 mineral N flux for decomp. of SOIL3to SOIL1 gN/m^2 F + 931 SMINN_TO_SOIL1N_S3_vr mineral N flux for decomp. of SOIL3to SOIL1 gN/m^3 F + 932 SMINN_TO_SOIL2N_L3 mineral N flux for decomp. of LITR3to SOIL2 gN/m^2 F + 933 SMINN_TO_SOIL2N_L3_vr mineral N flux for decomp. of LITR3to SOIL2 gN/m^3 F + 934 SMINN_TO_SOIL2N_S1 mineral N flux for decomp. of SOIL1to SOIL2 gN/m^2 F + 935 SMINN_TO_SOIL2N_S1_vr mineral N flux for decomp. of SOIL1to SOIL2 gN/m^3 F + 936 SMINN_TO_SOIL3N_S1 mineral N flux for decomp. of SOIL1to SOIL3 gN/m^2 F + 937 SMINN_TO_SOIL3N_S1_vr mineral N flux for decomp. of SOIL1to SOIL3 gN/m^3 F + 938 SMINN_TO_SOIL3N_S2 mineral N flux for decomp. of SOIL2to SOIL3 gN/m^2 F + 939 SMINN_TO_SOIL3N_S2_vr mineral N flux for decomp. of SOIL2to SOIL3 gN/m^3 F + 940 SMINN_vr soil mineral N gN/m^3 T + 941 SMIN_NH4 soil mineral NH4 gN/m^2 T + 942 SMIN_NH4_TO_PLANT plant uptake of NH4 gN/m^3/s F + 943 SMIN_NH4_vr soil mineral NH4 (vert. res.) gN/m^3 T + 944 SMIN_NO3 soil mineral NO3 gN/m^2 T + 945 SMIN_NO3_LEACHED soil NO3 pool loss to leaching gN/m^2/s T + 946 SMIN_NO3_LEACHED_vr soil NO3 pool loss to leaching gN/m^3/s F + 947 SMIN_NO3_MASSDENS SMIN_NO3_MASSDENS ugN/cm^3 soil F + 948 SMIN_NO3_RUNOFF soil NO3 pool loss to runoff gN/m^2/s T + 949 SMIN_NO3_RUNOFF_vr soil NO3 pool loss to runoff gN/m^3/s F + 950 SMIN_NO3_TO_PLANT plant uptake of NO3 gN/m^3/s F + 951 SMIN_NO3_vr soil mineral NO3 (vert. res.) gN/m^3 T + 952 SMP soil matric potential (natural vegetated and crop landunits only) mm T + 953 SNOBCMCL mass of BC in snow column kg/m2 T + 954 SNOBCMSL mass of BC in top snow layer kg/m2 T + 955 SNOCAN intercepted snow mm T + 956 SNODSTMCL mass of dust in snow column kg/m2 T + 957 SNODSTMSL mass of dust in top snow layer kg/m2 T + 958 SNOFSDSND direct nir incident solar radiation on snow W/m^2 F + 959 SNOFSDSNI diffuse nir incident solar radiation on snow W/m^2 F + 960 SNOFSDSVD direct vis incident solar radiation on snow W/m^2 F + 961 SNOFSDSVI diffuse vis incident solar radiation on snow W/m^2 F + 962 SNOFSRND direct nir reflected solar radiation from snow W/m^2 T + 963 SNOFSRNI diffuse nir reflected solar radiation from snow W/m^2 T + 964 SNOFSRVD direct vis reflected solar radiation from snow W/m^2 T + 965 SNOFSRVI diffuse vis reflected solar radiation from snow W/m^2 T + 966 SNOINTABS Fraction of incoming solar absorbed by lower snow layers - T + 967 SNOLIQFL top snow layer liquid water fraction (land) fraction F + 968 SNOOCMCL mass of OC in snow column kg/m2 T + 969 SNOOCMSL mass of OC in top snow layer kg/m2 T + 970 SNORDSL top snow layer effective grain radius m^-6 F + 971 SNOTTOPL snow temperature (top layer) K F + 972 SNOTTOPL_ICE snow temperature (top layer, ice landunits only) K F + 973 SNOTXMASS snow temperature times layer mass, layer sum; to get mass-weighted temperature, divide by (SNO K kg/m2 T + 974 SNOTXMASS_ICE snow temperature times layer mass, layer sum (ice landunits only); to get mass-weighted temper K kg/m2 F + 975 SNOW atmospheric snow, after rain/snow repartitioning based on temperature mm/s T + 976 SNOWDP gridcell mean snow height m T + 977 SNOWICE snow ice kg/m2 T + 978 SNOWICE_ICE snow ice (ice landunits only) kg/m2 F + 979 SNOWLIQ snow liquid water kg/m2 T + 980 SNOWLIQ_ICE snow liquid water (ice landunits only) kg/m2 F + 981 SNOW_DEPTH snow height of snow covered area m T + 982 SNOW_DEPTH_ICE snow height of snow covered area (ice landunits only) m F + 983 SNOW_FROM_ATM atmospheric snow received from atmosphere (pre-repartitioning) mm/s T + 984 SNOW_ICE atmospheric snow, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F + 985 SNOW_PERSISTENCE Length of time of continuous snow cover (nat. veg. landunits only) seconds T + 986 SNOW_SINKS snow sinks (liquid water) mm/s T + 987 SNOW_SOURCES snow sources (liquid water) mm/s T + 988 SNO_ABS Absorbed solar radiation in each snow layer W/m^2 F + 989 SNO_ABS_ICE Absorbed solar radiation in each snow layer (ice landunits only) W/m^2 F + 990 SNO_BW Partial density of water in the snow pack (ice + liquid) kg/m3 F + 991 SNO_BW_ICE Partial density of water in the snow pack (ice + liquid, ice landunits only) kg/m3 F + 992 SNO_EXISTENCE Fraction of averaging period for which each snow layer existed unitless F + 993 SNO_FRZ snow freezing rate in each snow layer kg/m2/s F + 994 SNO_FRZ_ICE snow freezing rate in each snow layer (ice landunits only) mm/s F + 995 SNO_GS Mean snow grain size Microns F + 996 SNO_GS_ICE Mean snow grain size (ice landunits only) Microns F + 997 SNO_ICE Snow ice content kg/m2 F + 998 SNO_LIQH2O Snow liquid water content kg/m2 F + 999 SNO_MELT snow melt rate in each snow layer mm/s F +1000 SNO_MELT_ICE snow melt rate in each snow layer (ice landunits only) mm/s F +1001 SNO_T Snow temperatures K F +1002 SNO_TK Thermal conductivity W/m-K F +1003 SNO_TK_ICE Thermal conductivity (ice landunits only) W/m-K F +1004 SNO_T_ICE Snow temperatures (ice landunits only) K F +1005 SNO_Z Snow layer thicknesses m F +1006 SNO_Z_ICE Snow layer thicknesses (ice landunits only) m F +1007 SNOdTdzL top snow layer temperature gradient (land) K/m F +1008 SOIL1C SOIL1 C gC/m^2 T +1009 SOIL1C_1m SOIL1 C to 1 meter gC/m^2 F +1010 SOIL1C_TNDNCY_VERT_TRANS soil 1 C tendency due to vertical transport gC/m^3/s F +1011 SOIL1C_TO_SOIL2C decomp. of soil 1 C to soil 2 C gC/m^2/s F +1012 SOIL1C_TO_SOIL2C_vr decomp. of soil 1 C to soil 2 C gC/m^3/s F +1013 SOIL1C_TO_SOIL3C decomp. of soil 1 C to soil 3 C gC/m^2/s F +1014 SOIL1C_TO_SOIL3C_vr decomp. of soil 1 C to soil 3 C gC/m^3/s F +1015 SOIL1C_vr SOIL1 C (vertically resolved) gC/m^3 T +1016 SOIL1N SOIL1 N gN/m^2 T +1017 SOIL1N_1m SOIL1 N to 1 meter gN/m^2 F +1018 SOIL1N_TNDNCY_VERT_TRANS soil 1 N tendency due to vertical transport gN/m^3/s F +1019 SOIL1N_TO_SOIL2N decomp. of soil 1 N to soil 2 N gN/m^2 F +1020 SOIL1N_TO_SOIL2N_vr decomp. of soil 1 N to soil 2 N gN/m^3 F +1021 SOIL1N_TO_SOIL3N decomp. of soil 1 N to soil 3 N gN/m^2 F +1022 SOIL1N_TO_SOIL3N_vr decomp. of soil 1 N to soil 3 N gN/m^3 F +1023 SOIL1N_vr SOIL1 N (vertically resolved) gN/m^3 T +1024 SOIL1_HR_S2 Het. Resp. from soil 1 gC/m^2/s F +1025 SOIL1_HR_S2_vr Het. Resp. from soil 1 gC/m^3/s F +1026 SOIL1_HR_S3 Het. Resp. from soil 1 gC/m^2/s F +1027 SOIL1_HR_S3_vr Het. Resp. from soil 1 gC/m^3/s F +1028 SOIL2C SOIL2 C gC/m^2 T +1029 SOIL2C_1m SOIL2 C to 1 meter gC/m^2 F +1030 SOIL2C_TNDNCY_VERT_TRANS soil 2 C tendency due to vertical transport gC/m^3/s F +1031 SOIL2C_TO_SOIL1C decomp. of soil 2 C to soil 1 C gC/m^2/s F +1032 SOIL2C_TO_SOIL1C_vr decomp. of soil 2 C to soil 1 C gC/m^3/s F +1033 SOIL2C_TO_SOIL3C decomp. of soil 2 C to soil 3 C gC/m^2/s F +1034 SOIL2C_TO_SOIL3C_vr decomp. of soil 2 C to soil 3 C gC/m^3/s F +1035 SOIL2C_vr SOIL2 C (vertically resolved) gC/m^3 T +1036 SOIL2N SOIL2 N gN/m^2 T +1037 SOIL2N_1m SOIL2 N to 1 meter gN/m^2 F +1038 SOIL2N_TNDNCY_VERT_TRANS soil 2 N tendency due to vertical transport gN/m^3/s F +1039 SOIL2N_TO_SOIL1N decomp. of soil 2 N to soil 1 N gN/m^2 F +1040 SOIL2N_TO_SOIL1N_vr decomp. of soil 2 N to soil 1 N gN/m^3 F +1041 SOIL2N_TO_SOIL3N decomp. of soil 2 N to soil 3 N gN/m^2 F +1042 SOIL2N_TO_SOIL3N_vr decomp. of soil 2 N to soil 3 N gN/m^3 F +1043 SOIL2N_vr SOIL2 N (vertically resolved) gN/m^3 T +1044 SOIL2_HR_S1 Het. Resp. from soil 2 gC/m^2/s F +1045 SOIL2_HR_S1_vr Het. Resp. from soil 2 gC/m^3/s F +1046 SOIL2_HR_S3 Het. Resp. from soil 2 gC/m^2/s F +1047 SOIL2_HR_S3_vr Het. Resp. from soil 2 gC/m^3/s F +1048 SOIL3C SOIL3 C gC/m^2 T +1049 SOIL3C_1m SOIL3 C to 1 meter gC/m^2 F +1050 SOIL3C_TNDNCY_VERT_TRANS soil 3 C tendency due to vertical transport gC/m^3/s F +1051 SOIL3C_TO_SOIL1C decomp. of soil 3 C to soil 1 C gC/m^2/s F +1052 SOIL3C_TO_SOIL1C_vr decomp. of soil 3 C to soil 1 C gC/m^3/s F +1053 SOIL3C_vr SOIL3 C (vertically resolved) gC/m^3 T +1054 SOIL3N SOIL3 N gN/m^2 T +1055 SOIL3N_1m SOIL3 N to 1 meter gN/m^2 F +1056 SOIL3N_TNDNCY_VERT_TRANS soil 3 N tendency due to vertical transport gN/m^3/s F +1057 SOIL3N_TO_SOIL1N decomp. of soil 3 N to soil 1 N gN/m^2 F +1058 SOIL3N_TO_SOIL1N_vr decomp. of soil 3 N to soil 1 N gN/m^3 F +1059 SOIL3N_vr SOIL3 N (vertically resolved) gN/m^3 T +1060 SOIL3_HR Het. Resp. from soil 3 gC/m^2/s F +1061 SOIL3_HR_vr Het. Resp. from soil 3 gC/m^3/s F +1062 SOILC_CHANGE C change in soil gC/m^2/s T +1063 SOILC_HR soil C heterotrophic respiration gC/m^2/s T +1064 SOILC_vr SOIL C (vertically resolved) gC/m^3 T +1065 SOILICE soil ice (natural vegetated and crop landunits only) kg/m2 T +1066 SOILLIQ soil liquid water (natural vegetated and crop landunits only) kg/m2 T +1067 SOILN_vr SOIL N (vertically resolved) gN/m^3 T +1068 SOILPSI soil water potential in each soil layer MPa F +1069 SOILRESIS soil resistance to evaporation s/m T +1070 SOILWATER_10CM soil liquid water + ice in top 10cm of soil (veg landunits only) kg/m2 T +1071 SOMC_FIRE C loss due to peat burning gC/m^2/s T +1072 SOMFIRE soil organic matter fire losses gC/m^2/s F +1073 SOM_ADV_COEF advection term for vertical SOM translocation m/s F +1074 SOM_C_LEACHED total flux of C from SOM pools due to leaching gC/m^2/s T +1075 SOM_DIFFUS_COEF diffusion coefficient for vertical SOM translocation m^2/s F +1076 SOM_N_LEACHED total flux of N from SOM pools due to leaching gN/m^2/s F +1077 SR total soil respiration (HR + root resp) gC/m^2/s T +1078 SSRE_FSR surface snow effect on reflected solar radiation W/m^2 T +1079 SSRE_FSRND surface snow effect on direct nir reflected solar radiation W/m^2 T +1080 SSRE_FSRNDLN surface snow effect on direct nir reflected solar radiation at local noon W/m^2 T +1081 SSRE_FSRNI surface snow effect on diffuse nir reflected solar radiation W/m^2 T +1082 SSRE_FSRVD surface snow radiatve effect on direct vis reflected solar radiation W/m^2 T +1083 SSRE_FSRVDLN surface snow radiatve effect on direct vis reflected solar radiation at local noon W/m^2 T +1084 SSRE_FSRVI surface snow radiatve effect on diffuse vis reflected solar radiation W/m^2 T +1085 STEM_PROF profile for litter C and N inputs from stems 1/m F +1086 STORAGE_CDEMAND C use from the C storage pool gC/m^2 F +1087 STORAGE_GR growth resp for growth sent to storage for later display gC/m^2/s F +1088 STORAGE_NDEMAND N demand during the offset period gN/m^2 F +1089 STORVEGC stored vegetation carbon, excluding cpool gC/m^2 T +1090 STORVEGN stored vegetation nitrogen gN/m^2 T +1091 SUPPLEMENT_TO_SMINN supplemental N supply gN/m^2/s T +1092 SUPPLEMENT_TO_SMINN_vr supplemental N supply gN/m^3/s F +1093 SWBGT 2 m Simplified Wetbulb Globe Temp C T +1094 SWBGT_R Rural 2 m Simplified Wetbulb Globe Temp C T +1095 SWBGT_U Urban 2 m Simplified Wetbulb Globe Temp C T +1096 SWMP65 2 m Swamp Cooler Temp 65% Eff C T +1097 SWMP65_R Rural 2 m Swamp Cooler Temp 65% Eff C T +1098 SWMP65_U Urban 2 m Swamp Cooler Temp 65% Eff C T +1099 SWMP80 2 m Swamp Cooler Temp 80% Eff C T +1100 SWMP80_R Rural 2 m Swamp Cooler Temp 80% Eff C T +1101 SWMP80_U Urban 2 m Swamp Cooler Temp 80% Eff C T +1102 SWdown atmospheric incident solar radiation W/m^2 F +1103 SWup upwelling shortwave radiation W/m^2 F +1104 SoilAlpha factor limiting ground evap unitless F +1105 SoilAlpha_U urban factor limiting ground evap unitless F +1106 T10 10-day running mean of 2-m temperature K F +1107 TAUX zonal surface stress kg/m/s^2 T +1108 TAUY meridional surface stress kg/m/s^2 T +1109 TBOT atmospheric air temperature (downscaled to columns in glacier regions) K T +1110 TBUILD internal urban building air temperature K T +1111 TBUILD_MAX prescribed maximum interior building temperature K F +1112 TEMPAVG_T2M temporary average 2m air temperature K F +1113 TEMPMAX_RETRANSN temporary annual max of retranslocated N pool gN/m^2 F +1114 TEMPSUM_POTENTIAL_GPP temporary annual sum of potential GPP gC/m^2/yr F +1115 TEQ 2 m Equiv Temp K T +1116 TEQ_R Rural 2 m Equiv Temp K T +1117 TEQ_U Urban 2 m Equiv Temp K T +1118 TFLOOR floor temperature K F +1119 TG ground temperature K T +1120 TG_ICE ground temperature (ice landunits only) K F +1121 TG_R Rural ground temperature K F +1122 TG_U Urban ground temperature K F +1123 TH2OSFC surface water temperature K T +1124 THBOT atmospheric air potential temperature (downscaled to columns in glacier regions) K T +1125 THIC 2 m Temp Hum Index Comfort C T +1126 THIC_R Rural 2 m Temp Hum Index Comfort C T +1127 THIC_U Urban 2 m Temp Hum Index Comfort C T +1128 THIP 2 m Temp Hum Index Physiology C T +1129 THIP_R Rural 2 m Temp Hum Index Physiology C T +1130 THIP_U Urban 2 m Temp Hum Index Physiology C T +1131 TKE1 top lake level eddy thermal conductivity W/(mK) T +1132 TLAI total projected leaf area index m^2/m^2 T +1133 TLAKE lake temperature K T +1134 TOPO_COL column-level topographic height m F +1135 TOPO_COL_ICE column-level topographic height (ice landunits only) m F +1136 TOPO_FORC topograephic height sent to GLC m F +1137 TOPT topt coefficient for VOC calc non F +1138 TOTCOLC total column carbon, incl veg and cpool but excl product pools gC/m^2 T +1139 TOTCOLCH4 total belowground CH4 (0 for non-lake special landunits in the absence of dynamic landunits) gC/m2 T +1140 TOTCOLN total column-level N, excluding product pools gN/m^2 T +1141 TOTECOSYSC total ecosystem carbon, incl veg but excl cpool and product pools gC/m^2 T +1142 TOTECOSYSN total ecosystem N, excluding product pools gN/m^2 T +1143 TOTFIRE total ecosystem fire losses gC/m^2/s F +1144 TOTLITC total litter carbon gC/m^2 T +1145 TOTLITC_1m total litter carbon to 1 meter depth gC/m^2 T +1146 TOTLITN total litter N gN/m^2 T +1147 TOTLITN_1m total litter N to 1 meter gN/m^2 T +1148 TOTPFTC total patch-level carbon, including cpool gC/m^2 T +1149 TOTPFTN total patch-level nitrogen gN/m^2 T +1150 TOTSOILICE vertically summed soil cie (veg landunits only) kg/m2 T +1151 TOTSOILLIQ vertically summed soil liquid water (veg landunits only) kg/m2 T +1152 TOTSOMC total soil organic matter carbon gC/m^2 T +1153 TOTSOMC_1m total soil organic matter carbon to 1 meter depth gC/m^2 T +1154 TOTSOMN total soil organic matter N gN/m^2 T +1155 TOTSOMN_1m total soil organic matter N to 1 meter gN/m^2 T +1156 TOTVEGC total vegetation carbon, excluding cpool gC/m^2 T +1157 TOTVEGN total vegetation nitrogen gN/m^2 T +1158 TOT_WOODPRODC total wood product C gC/m^2 T +1159 TOT_WOODPRODC_LOSS total loss from wood product pools gC/m^2/s T +1160 TOT_WOODPRODN total wood product N gN/m^2 T +1161 TOT_WOODPRODN_LOSS total loss from wood product pools gN/m^2/s T +1162 TPU25T canopy profile of tpu umol/m2/s T +1163 TRAFFICFLUX sensible heat flux from urban traffic W/m^2 F +1164 TRANSFER_DEADCROOT_GR dead coarse root growth respiration from storage gC/m^2/s F +1165 TRANSFER_DEADSTEM_GR dead stem growth respiration from storage gC/m^2/s F +1166 TRANSFER_FROOT_GR fine root growth respiration from storage gC/m^2/s F +1167 TRANSFER_GR growth resp for transfer growth displayed in this timestep gC/m^2/s F +1168 TRANSFER_LEAF_GR leaf growth respiration from storage gC/m^2/s F +1169 TRANSFER_LIVECROOT_GR live coarse root growth respiration from storage gC/m^2/s F +1170 TRANSFER_LIVESTEM_GR live stem growth respiration from storage gC/m^2/s F +1171 TREFMNAV daily minimum of average 2-m temperature K T +1172 TREFMNAV_R Rural daily minimum of average 2-m temperature K F +1173 TREFMNAV_U Urban daily minimum of average 2-m temperature K F +1174 TREFMXAV daily maximum of average 2-m temperature K T +1175 TREFMXAV_R Rural daily maximum of average 2-m temperature K F +1176 TREFMXAV_U Urban daily maximum of average 2-m temperature K F +1177 TROOF_INNER roof inside surface temperature K F +1178 TSA 2m air temperature K T +1179 TSAI total projected stem area index m^2/m^2 T +1180 TSA_ICE 2m air temperature (ice landunits only) K F +1181 TSA_R Rural 2m air temperature K F +1182 TSA_U Urban 2m air temperature K F +1183 TSHDW_INNER shadewall inside surface temperature K F +1184 TSKIN skin temperature K T +1185 TSL temperature of near-surface soil layer (natural vegetated and crop landunits only) K T +1186 TSOI soil temperature (natural vegetated and crop landunits only) K T +1187 TSOI_10CM soil temperature in top 10cm of soil K T +1188 TSOI_ICE soil temperature (ice landunits only) K T +1189 TSRF_FORC surface temperature sent to GLC K F +1190 TSUNW_INNER sunwall inside surface temperature K F +1191 TV vegetation temperature K T +1192 TV24 vegetation temperature (last 24hrs) K F +1193 TV240 vegetation temperature (last 240hrs) K F +1194 TVEGD10 10 day running mean of patch daytime vegetation temperature Kelvin F +1195 TVEGN10 10 day running mean of patch night-time vegetation temperature Kelvin F +1196 TWS total water storage mm T +1197 T_SCALAR temperature inhibition of decomposition unitless T +1198 Tair atmospheric air temperature (downscaled to columns in glacier regions) K F +1199 Tair_from_atm atmospheric air temperature received from atmosphere (pre-downscaling) K F +1200 U10 10-m wind m/s T +1201 U10_DUST 10-m wind for dust model m/s T +1202 U10_ICE 10-m wind (ice landunits only) m/s F +1203 ULRAD upward longwave radiation above the canopy W/m^2 F +1204 URBAN_AC urban air conditioning flux W/m^2 T +1205 URBAN_HEAT urban heating flux W/m^2 T +1206 UST_LAKE friction velocity (lakes only) m/s F +1207 VA atmospheric wind speed plus convective velocity m/s F +1208 VCMX25T canopy profile of vcmax25 umol/m2/s T +1209 VEGWP vegetation water matric potential for sun/sha canopy,xyl,root segments mm T +1210 VEGWPLN vegetation water matric potential for sun/sha canopy,xyl,root at local noon mm T +1211 VEGWPPD predawn vegetation water matric potential for sun/sha canopy,xyl,root mm T +1212 VOCFLXT total VOC flux into atmosphere moles/m2/sec F +1213 VOLR river channel total water storage m3 T +1214 VOLRMCH river channel main channel water storage m3 T +1215 VPD_CAN canopy vapor pressure deficit kPa T +1216 Vcmx25Z canopy profile of vcmax25 predicted by LUNA model umol/m2/s T +1217 WA water in the unconfined aquifer (natural vegetated and crop landunits only) mm T +1218 WASTEHEAT sensible heat flux from heating/cooling sources of urban waste heat W/m^2 T +1219 WBA 2 m Wet Bulb C T +1220 WBA_R Rural 2 m Wet Bulb C T +1221 WBA_U Urban 2 m Wet Bulb C T +1222 WBT 2 m Stull Wet Bulb C T +1223 WBT_R Rural 2 m Stull Wet Bulb C T +1224 WBT_U Urban 2 m Stull Wet Bulb C T +1225 WF soil water as frac. of whc for top 0.05 m proportion F +1226 WFPS WFPS percent F +1227 WIND atmospheric wind velocity magnitude m/s T +1228 WOODC wood C gC/m^2 T +1229 WOODC_ALLOC wood C eallocation gC/m^2/s T +1230 WOODC_LOSS wood C loss gC/m^2/s T +1231 WOOD_HARVESTC wood harvest carbon (to product pools) gC/m^2/s T +1232 WOOD_HARVESTN wood harvest N (to product pools) gN/m^2/s T +1233 WTGQ surface tracer conductance m/s T +1234 W_SCALAR Moisture (dryness) inhibition of decomposition unitless T +1235 Wind atmospheric wind velocity magnitude m/s F +1236 XSMRPOOL temporary photosynthate C pool gC/m^2 T +1237 XSMRPOOL_LOSS temporary photosynthate C pool loss gC/m^2 F +1238 XSMRPOOL_RECOVER C flux assigned to recovery of negative xsmrpool gC/m^2/s T +1239 Z0HG roughness length over ground, sensible heat m F +1240 Z0HV roughness length over vegetation, sensible heat m F +1241 Z0M momentum roughness length m F +1242 Z0MG roughness length over ground, momentum m F +1243 Z0MV roughness length over vegetation, momentum m F +1244 Z0M_TO_COUPLER roughness length, momentum: gridcell average sent to coupler m F +1245 Z0QG roughness length over ground, latent heat m F +1246 Z0QV roughness length over vegetation, latent heat m F +1247 ZBOT atmospheric reference height m T +1248 ZII convective boundary height m F +1249 ZWT water table depth (natural vegetated and crop landunits only) m T +1250 ZWT_CH4_UNSAT depth of water table for methane production used in non-inundated area m T +1251 ZWT_PERCH perched water table depth (natural vegetated and crop landunits only) m T +1252 anaerobic_frac anaerobic_frac m3/m3 F +1253 bsw clap and hornberger B unitless F +1254 currentPatch currentPatch coefficient for VOC calc non F +1255 diffus diffusivity m^2/s F +1256 fr_WFPS fr_WFPS fraction F +1257 n2_n2o_ratio_denit n2_n2o_ratio_denit gN/gN F +1258 r_psi r_psi m F +1259 ratio_k1 ratio_k1 none F +1260 ratio_no3_co2 ratio_no3_co2 ratio F +1261 soil_bulkdensity soil_bulkdensity kg/m3 F +1262 soil_co2_prod soil_co2_prod ug C / g soil / day F +1263 watfc water field capacity m^3/m^3 F +1264 watsat water saturated m^3/m^3 F ==== =================================== ============================================================================================== ================================================================= ======= From b80600310273560fdf41ac8bcbdf1e52bbac66e5 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 28 Nov 2020 14:47:33 -0700 Subject: [PATCH 1658/1973] Sort history fields using @billsacks code modifications --- src/main/histFileMod.F90 | 195 ++++++++++++++++++++++++++------------- 1 file changed, 131 insertions(+), 64 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 56de744a2a..2e037c143a 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -209,12 +209,34 @@ module histFileMod integer :: no_snow_behavior ! for multi-layer snow fields, flag saying how to treat times when a given snow layer is absent end type field_info - type history_entry + type, abstract :: entry_base type (field_info) :: field ! field information - logical :: actflag ! active/inactive flag + contains + procedure(copy_entry_interface), deferred :: copy + end type entry_base + + abstract interface + subroutine copy_entry_interface(this, other) + ! set this = other + import :: entry_base + class(entry_base), intent(out) :: this + class(entry_base), intent(in) :: other + end subroutine copy_entry_interface + end interface + + type, extends(entry_base) :: master_entry + logical :: actflag(max_tapes) ! active/inactive flag + character(len=avgflag_strlen) :: avgflag(max_tapes) ! time averaging flag + contains + procedure :: copy => copy_master_entry + end type master_entry + + type, extends(entry_base) :: history_entry character(len=avgflag_strlen) :: avgflag ! time averaging flag ("X","A","M","I","SUM") real(r8), pointer :: hbuf(:,:) ! history buffer (dimensions: dim1d x num2d) integer , pointer :: nacs(:,:) ! accumulation counter (dimensions: dim1d x num2d) + contains + procedure :: copy => copy_history_entry end type history_entry type history_tape @@ -227,7 +249,6 @@ module histFileMod logical :: is_endhist ! true => current time step is end of history interval real(r8) :: begtime ! time at beginning of history averaging interval type (history_entry) :: hlist(max_flds) ! array of active history tape entries - type (history_entry) :: masterlist(max_flds) ! master field list end type history_tape type clmpoint_rs ! Pointer to real scalar data (1D) @@ -242,6 +263,10 @@ module histFileMod type (clmpoint_rs) :: clmptr_rs(max_mapflds) ! Real scalar data (1D) type (clmpoint_ra) :: clmptr_ra(max_mapflds) ! Real array data (2D) ! + ! Master list: an array of master_entry entities + ! + type (master_entry) :: masterlist(max_flds) ! master field list + ! ! Whether each history tape is in use in this run. If history_tape_in_use(i) is false, ! then data in tape(i) is undefined and should not be referenced. ! @@ -315,7 +340,7 @@ subroutine hist_printflds() write(iulog,*) trim(subname),' : number of master fields = ',nfmaster write(iulog,*)' ******* MASTER FIELD LIST *******' do nf = 1,nfmaster - write(iulog,9000)nf, tape(1)%masterlist(nf)%field%name, tape(1)%masterlist(nf)%field%units + write(iulog,9000)nf, masterlist(nf)%field%name, masterlist(nf)%field%units 9000 format (i5,1x,a32,1x,a16) end do call shr_sys_flush(iulog) @@ -327,7 +352,7 @@ subroutine hist_printflds() ! the CTSM's web-based documentation. ! First sort the list to be in alphabetical order - call sort_hist_list(1, nfmaster, tape(1)%masterlist) + call sort_hist_list(1, nfmaster, masterlist) if (masterproc .and. hist_master_list_file) then ! Hardwired table column widths to fit the table on a computer @@ -395,10 +420,10 @@ subroutine hist_printflds() fmt_txt = '(i'//str_width_col(1)//',x,a'//str_width_col(2)//',x,a'//str_width_col(3)//',x,a'//str_width_col(4)//',l'//str_width_col(5)//')' do nf = 1,nfmaster write(master_list_file,fmt_txt) nf, & - tape(1)%masterlist(nf)%field%name, & - tape(1)%masterlist(nf)%field%long_name, & - tape(1)%masterlist(nf)%field%units, & - tape(1)%masterlist(nf)%actflag + masterlist(nf)%field%name, & + masterlist(nf)%field%long_name, & + masterlist(nf)%field%units, & + masterlist(nf)%actflag(1) end do ! Table footer, same as header @@ -484,7 +509,7 @@ subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & ! Ensure that new field doesn't already exist do n = 1,nfmaster - if (tape(1)%masterlist(n)%field%name == fname) then + if (masterlist(n)%field%name == fname) then write(iulog,*) trim(subname),' ERROR:', fname, ' already on list' call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -505,49 +530,49 @@ subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & ! Add field to master list - tape(1)%masterlist(f)%field%name = fname - tape(1)%masterlist(f)%field%long_name = long_name - tape(1)%masterlist(f)%field%units = units - tape(1)%masterlist(f)%field%type1d = type1d - tape(1)%masterlist(f)%field%type1d_out = type1d_out - tape(1)%masterlist(f)%field%type2d = type2d - tape(1)%masterlist(f)%field%numdims = numdims - tape(1)%masterlist(f)%field%num2d = num2d - tape(1)%masterlist(f)%field%hpindex = hpindex - tape(1)%masterlist(f)%field%p2c_scale_type = p2c_scale_type - tape(1)%masterlist(f)%field%c2l_scale_type = c2l_scale_type - tape(1)%masterlist(f)%field%l2g_scale_type = l2g_scale_type + masterlist(f)%field%name = fname + masterlist(f)%field%long_name = long_name + masterlist(f)%field%units = units + masterlist(f)%field%type1d = type1d + masterlist(f)%field%type1d_out = type1d_out + masterlist(f)%field%type2d = type2d + masterlist(f)%field%numdims = numdims + masterlist(f)%field%num2d = num2d + masterlist(f)%field%hpindex = hpindex + masterlist(f)%field%p2c_scale_type = p2c_scale_type + masterlist(f)%field%c2l_scale_type = c2l_scale_type + masterlist(f)%field%l2g_scale_type = l2g_scale_type select case (type1d) case (grlnd) - tape(1)%masterlist(f)%field%beg1d = bounds%begg - tape(1)%masterlist(f)%field%end1d = bounds%endg - tape(1)%masterlist(f)%field%num1d = numg + masterlist(f)%field%beg1d = bounds%begg + masterlist(f)%field%end1d = bounds%endg + masterlist(f)%field%num1d = numg case (nameg) - tape(1)%masterlist(f)%field%beg1d = bounds%begg - tape(1)%masterlist(f)%field%end1d = bounds%endg - tape(1)%masterlist(f)%field%num1d = numg + masterlist(f)%field%beg1d = bounds%begg + masterlist(f)%field%end1d = bounds%endg + masterlist(f)%field%num1d = numg case (namel) - tape(1)%masterlist(f)%field%beg1d = bounds%begl - tape(1)%masterlist(f)%field%end1d = bounds%endl - tape(1)%masterlist(f)%field%num1d = numl + masterlist(f)%field%beg1d = bounds%begl + masterlist(f)%field%end1d = bounds%endl + masterlist(f)%field%num1d = numl case (namec) - tape(1)%masterlist(f)%field%beg1d = bounds%begc - tape(1)%masterlist(f)%field%end1d = bounds%endc - tape(1)%masterlist(f)%field%num1d = numc + masterlist(f)%field%beg1d = bounds%begc + masterlist(f)%field%end1d = bounds%endc + masterlist(f)%field%num1d = numc case (namep) - tape(1)%masterlist(f)%field%beg1d = bounds%begp - tape(1)%masterlist(f)%field%end1d = bounds%endp - tape(1)%masterlist(f)%field%num1d = nump + masterlist(f)%field%beg1d = bounds%begp + masterlist(f)%field%end1d = bounds%endp + masterlist(f)%field%num1d = nump case default write(iulog,*) trim(subname),' ERROR: unknown 1d output type= ',type1d call endrun(msg=errMsg(sourcefile, __LINE__)) end select if (present(no_snow_behavior)) then - tape(1)%masterlist(f)%field%no_snow_behavior = no_snow_behavior + masterlist(f)%field%no_snow_behavior = no_snow_behavior else - tape(1)%masterlist(f)%field%no_snow_behavior = no_snow_unset + masterlist(f)%field%no_snow_behavior = no_snow_unset end if ! The following two fields are used only in master field list, @@ -555,8 +580,8 @@ subroutine masterlist_addfld (fname, numdims, type1d, type1d_out, & ! ALL FIELDS IN THE MASTER LIST ARE INITIALIZED WITH THE ACTIVE ! FLAG SET TO FALSE - tape(:)%masterlist(f)%avgflag = avgflag - tape(:)%masterlist(f)%actflag = .false. + masterlist(f)%avgflag(:) = avgflag + masterlist(f)%actflag(:) = .false. end subroutine masterlist_addfld @@ -679,10 +704,10 @@ subroutine masterlist_make_active (name, tape_index, avgflag) found = .false. do f = 1,nfmaster - if (trim(name) == trim(tape(1)%masterlist(f)%field%name)) then - tape(tape_index)%masterlist(f)%actflag = .true. + if (trim(name) == trim(masterlist(f)%field%name)) then + masterlist(f)%actflag(tape_index) = .true. if (present(avgflag)) then - if (avgflag/= ' ') tape(tape_index)%masterlist(f)%avgflag = avgflag + if (avgflag/= ' ') masterlist(f)%avgflag(tape_index) = avgflag end if found = .true. exit @@ -718,7 +743,7 @@ subroutine masterlist_change_timeavg (t) end if do f = 1,nfmaster - tape(t)%masterlist(f)%avgflag = avgflag + masterlist(f)%avgflag(t) = avgflag end do end subroutine masterlist_change_timeavg @@ -784,7 +809,7 @@ subroutine htapes_fieldlist() do while (f < max_flds .and. fincl(f,t) /= ' ') name = getname (fincl(f,t)) do ff = 1,nfmaster - mastername = tape(1)%masterlist(ff)%field%name + mastername = masterlist(ff)%field%name if (name == mastername) exit end do if (name /= mastername) then @@ -798,7 +823,7 @@ subroutine htapes_fieldlist() f = 1 do while (f < max_flds .and. fexcl(f,t) /= ' ') do ff = 1,nfmaster - mastername = tape(1)%masterlist(ff)%field%name + mastername = masterlist(ff)%field%name if (fexcl(f,t) == mastername) exit end do if (fexcl(f,t) /= mastername) then @@ -822,7 +847,7 @@ subroutine htapes_fieldlist() ! or if it is on by default and was not excluded via namelist (FEXCL[1-max_tapes]). do f = 1,nfmaster - mastername = tape(1)%masterlist(f)%field%name + mastername = masterlist(f)%field%name call list_index (fincl(1,t), mastername, ff) if (ff > 0) then @@ -846,7 +871,7 @@ subroutine htapes_fieldlist() ! called below only if field is not in exclude list OR in ! include list - if (ff == 0 .and. tape(t)%masterlist(f)%actflag) then + if (ff == 0 .and. masterlist(f)%actflag(t)) then call htape_addfld (t, f, ' ') end if @@ -855,10 +880,7 @@ subroutine htapes_fieldlist() ! Specification of tape contents now complete. ! Sort each list of active entries - associate(n_fields => tape(t)%nflds, & - hist_list => tape(t)%hlist) - call sort_hist_list(t, n_fields, hist_list) - end associate + call sort_hist_list(t, tape(t)%nflds, tape(t)%hlist) if (masterproc) then if (tape(t)%nflds > 0) then @@ -936,6 +958,44 @@ subroutine htapes_fieldlist() end subroutine htapes_fieldlist + !----------------------------------------------------------------------- + subroutine copy_master_entry(this, other) + ! set this = other + class(master_entry), intent(out) :: this + class(entry_base), intent(in) :: other + + select type(this) + type is (master_entry) + select type(other) + type is (master_entry) + this = other + class default + call endrun('Unexpected type of "other" in copy_master_entry') + end select + class default + call endrun('Unexpected type of "this" in copy_master_entry') + end select + end subroutine copy_master_entry + + !----------------------------------------------------------------------- + subroutine copy_history_entry(this, other) + ! set this = other + class(history_entry), intent(out) :: this + class(entry_base), intent(in) :: other + + select type(this) + type is (history_entry) + select type(other) + type is (history_entry) + this = other + class default + call endrun('Unexpected type of "other" in copy_history_entry') + end select + class default + call endrun('Unexpected type of "this" in copy_history_entry') + end select + end subroutine copy_history_entry + !----------------------------------------------------------------------- subroutine sort_hist_list(t, n_fields, hist_list) @@ -944,22 +1004,30 @@ subroutine sort_hist_list(t, n_fields, hist_list) ! !ARGUMENTS: integer, intent(in) :: t ! tape index integer, intent(in) :: n_fields ! number of fields - type (history_entry), intent(inout) :: hist_list(n_fields) ! array of history tape entries + class(entry_base), intent(inout) :: hist_list(:) ! !LOCAL VARIABLES: integer :: f, ff ! field indices - type (history_entry) :: tmp ! temporary used for swapping + class(entry_base), allocatable :: tmp character(len=*), parameter :: subname = 'sort_hist_list' !----------------------------------------------------------------------- + SHR_ASSERT_FL(size(hist_list) >= n_fields, sourcefile, __LINE__) + + if (n_fields < 2) then + return + end if + + allocate(tmp, source = hist_list(1)) + do f = n_fields-1, 1, -1 do ff = 1, f if (hist_list(ff)%field%name > hist_list(ff+1)%field%name) then - tmp = hist_list(ff) - hist_list(ff ) = hist_list(ff+1) - hist_list(ff+1) = tmp + call tmp%copy(hist_list(ff)) + call hist_list(ff )%copy(hist_list(ff+1)) + call hist_list(ff+1)%copy(tmp) else if (hist_list(ff)%field%name == hist_list(ff+1)%field%name) then @@ -967,7 +1035,6 @@ subroutine sort_hist_list(t, n_fields, hist_list) hist_list(ff)%field%name, & 't,ff,name=',t,ff,hist_list(ff+1)%field%name call endrun(msg=errMsg(sourcefile, __LINE__)) - end if end do end do @@ -1042,7 +1109,7 @@ subroutine htape_addfld (t, f, avgflag) if (htapes_defined) then write(iulog,*) trim(subname),' ERROR: attempt to add field ', & - tape(1)%masterlist(f)%field%name, ' after history files are set' + masterlist(f)%field%name, ' after history files are set' call endrun(msg=errMsg(sourcefile, __LINE__)) end if @@ -1051,7 +1118,7 @@ subroutine htape_addfld (t, f, avgflag) ! Copy field information - tape(t)%hlist(n)%field = tape(1)%masterlist(f)%field + tape(t)%hlist(n)%field = masterlist(f)%field ! Determine bounds @@ -1135,8 +1202,8 @@ subroutine htape_addfld (t, f, avgflag) tape(t)%hlist(n)%field%num1d_out = num1d_out ! Fields native bounds - beg1d = tape(1)%masterlist(f)%field%beg1d - end1d = tape(1)%masterlist(f)%field%end1d + beg1d = masterlist(f)%field%beg1d + end1d = masterlist(f)%field%end1d ! Alloccate and initialize history buffer and related info @@ -1160,7 +1227,7 @@ subroutine htape_addfld (t, f, avgflag) end if if (avgflag == ' ') then - tape(t)%hlist(n)%avgflag = tape(t)%masterlist(f)%avgflag + tape(t)%hlist(n)%avgflag = masterlist(f)%avgflag(t) else tape(t)%hlist(n)%avgflag = avgflag end if From 55df59a56dac79298075553bea9f00bdca436266 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 28 Nov 2020 15:11:33 -0700 Subject: [PATCH 1659/1973] First draft of updated ChangeLog --- doc/ChangeLog | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 108 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index af92011009..4e502ec937 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,111 @@ =============================================================== +Tag name: ctsm5.1.dev018 +Originator(s): slevis (Samuel Levis,,303-665-1310) +Date: Sat Nov 28 15:06:12 MST 2020 +One-line Summary: Add ACTIVE (T/F) column to master hist fields table and alphabetize + +Purpose of changes +------------------ + + For convenience, added an ACTIVE column to the master fields table and + alphabetized. + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #941 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + None + +Changes made to namelist defaults (e.g., changed parameter values): + None + +Changes to the datasets (e.g., parameter, surface or initial files): + None + +Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] + None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + None + +Changes to tests or testing: + None + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- WAIT + izumi ------- WAIT + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + No + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + None + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/CTSM/pull/1222 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev017 Originator(s): slevis (Samuel Levis,303-665-1310) Date: Tue Nov 17 18:19:20 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 1179769937..fec9c45439 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev018 slevis 11/28/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file ctsm5.1.dev016 multiple 11/17/2020 Updates for nuopc ctsm5.1.dev015 sacks 11/13/2020 A few small fixes From 55956addb71ba2525281206cfc70a376b84fffa3 Mon Sep 17 00:00:00 2001 From: negin513 Date: Wed, 2 Dec 2020 12:45:55 -0700 Subject: [PATCH 1660/1973] one-way nesting instructions for WRF-CTSM. --- .../lilac/specific-atm-models/index.rst | 1 + .../lilac/specific-atm-models/wrf-nesting.rst | 262 ++++++++++++++++++ 2 files changed, 263 insertions(+) create mode 100644 doc/source/lilac/specific-atm-models/wrf-nesting.rst diff --git a/doc/source/lilac/specific-atm-models/index.rst b/doc/source/lilac/specific-atm-models/index.rst index e2996135e1..b5c3d2bc08 100644 --- a/doc/source/lilac/specific-atm-models/index.rst +++ b/doc/source/lilac/specific-atm-models/index.rst @@ -8,4 +8,5 @@ :maxdepth: 2 wrf.rst + wrf-nesting.rst wrf-tools.rst diff --git a/doc/source/lilac/specific-atm-models/wrf-nesting.rst b/doc/source/lilac/specific-atm-models/wrf-nesting.rst new file mode 100644 index 0000000000..b21593029b --- /dev/null +++ b/doc/source/lilac/specific-atm-models/wrf-nesting.rst @@ -0,0 +1,262 @@ +.. _wrf: + +.. highlight:: shell + +======================================== + Using CTSM with WRF (Nested Model Runs) +======================================== + +This section includes instructions on how to run WRF coupled with CTSM for a +nested domain. + +A nested domain is usually used to have a finer-resolution domain within the +coarser model domain. A nested simulation enables running at a higher +resolution over a smaller domain + +.. note:: + A nest should cover a portion of the parent domain and is fully contained by + the parent domain, so that it is driven along its lateral boundaries by the + parent domain. + +.. todo:: + Negin wants to add a flowchart showing the workflow of a nested case. + +There are currently two types of nesting available within WRF: + +#. **One-way nesting:** + In One-way nesting, the boundary conditions are fed to the inner (child) domain from the outer (parent) domain. + +#. **Two-way nesting:** + In two-way nesting, two things are being done: + + - Exactly similar to 1-way nesting the boundary conditions are fed to the inner domain from the outer (parent) domain. + - Also, the averaged values from the inner domain are being sent back to the outer domain at the corresponding grid points. + +.. important:: + Currently, the WRF-CTSM coupling infrastructure only support one-way nesting. + This example clarifies the workflow for running a nested WRF-CTSM case using one-way nesting with ``ndown.exe``. + +The procedure for running a nested simulation for WRF with CTSM is +similar to the workflow for running WRF real cases, except that it requires +additional steps to (1) clone the CTSM repository, (2) build +CTSM and LILAC, and (3) define namelist options reuired for CTSM. + +A full description of all steps for a WRF-CTSM run are included here. + +.. important:: + + This section assumes the user has completed all the steps required for + WRF-CTSM simulation single domain. + Therefore, we are not repeating the steps necessary for building WRF and + CTSM. + + +In this example we use a nested domain over the CONUS as shows below: + + +.. _Figure ctsm-ndown: + +.. figure:: ndown_ctsm_diagram.svg + + Flowchart for WRF-CTSM one-way nested simulations + +Nested Simulations : Pre-processing (geogrid.exe) +------------------------------------------------- +In the WPS/ directory, edit `namelist.wps` for a nested simulation over your +desired domains. Make sure to change `max_dom=2`. + +First, use geogrid.exe to define the domain and interpolate static geographical data +to the grids:: + + ./geogrid.exe >& log.geogrid + +This step creates two files `geo_em.d01.nc` & `geo_em.d02.nc` which includes +the domain definition for each domain. + +If the geogrid step finishes successfully, you should see the following message in the log file:: + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Successful completion of geogrid. ! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +The basic difference here with a non-nested case is the namelist.wps should +have a column for each domain with `max_dom=2`. For example:: + + &share + wrf_core = 'ARW', + max_dom = 2, + start_date = '2013-04-01_00:00:00','2013-04-01_00:00:00', + end_date = '2013-04-30_00:00:00','2013-04-30_00:00:00', + interval_seconds = 21600 + io_form_geogrid = 2, + / + + &geogrid + parent_id = 1, 1, + parent_grid_ratio = 1, 3, + i_parent_start = 1, 61, + j_parent_start = 1, 57, + e_we = 200, 103, + e_sn = 140, 103, + +Therefore ``geogrid.exe`` creates two files corresponding to each domain. + +Nested Simulations : Pre-processing (ungrib.exe) +------------------------------------------------- +As mentioned previously, the purpose of the ungrib script is to unpack GRIB +meteorological data and pack it into an intermediate file format. +This step is exactly identical to a non-nested simulation. + +Run ungrib to get gribbed data into usable format to be ingested by WRF. + +To run ungrib.exe, first link the GRIB data files that are going to be used:: + + ./link_grib.csh $your_GRIB_data_path + +Based on your GRIB data type, link or copy the appropriate VTable to your WPS directory. +WRF has some prepared VTable under ``/ungrib/Variable_tables/`` folder. + +Extract meteorological fields from GRIB-formatted files:: + + ./ungrib.exe >& log.ungrib + +Check ungrib log for the following message showing successful completion of ungrib step:: + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Successful completion of ungrib. ! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +At this point, you should see ungrib output (intermediate files) in your WPS directory. + + +Nested Simulations : Pre-processing (metgrid.exe) +------------------------------------------------- +Ensure that the `start_date` and `end_date` for domain two is set correctly for +your simulation. +Next, run ``metgrid.exe``:: + + ./metgrid.exe >& log.metgrid + +Check the metgrid log for the following message showing successful completion of +metgrid step:: + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Successful completion of metgrid. ! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + +Running metgrid for two domains will create files like +below:: + met_em.d01.* + met_em.d02.* + + + +Nested Simulations : real.exe +------------------------------ + +In this step, run ``real.exe`` to generate initial and boundary conditions for +both domains. + +In summary, complete the following steps: + +Move or link WPS output files (``met_em.d01*`` and ``met_em.d02`` files) to your WRF test directory. + +Edit namelist.input for your WRF domain and desirable configurations. +This should be the same domain as WPS namelist. Make sure you set ``max_dom = +2,`` in the namelist. + +To run WRF-CTSM, in your namelist change land-surface option to 6 for both +domains:: + + sf_surface_physics = 6, 6, + + +Run real.exe (if compiled parallel submit a batch job) to generate +initail and boundary condition files for both domain. +Make sure the following three files have been created in your directory:: + + wrfinput_d01 + wrfinput_d02 + wrfbdy_d01 + +The boundary condition file is only created for the outer domain. + +Check the last line of the real log file for the following message:: + +Rename wrfinput_d02 +------------------- +Next, rename the ``wrfinput_d02`` file to ``wrfndi_d02``:: + + mv wrfinput_d02 wrfndi_d02 + +Run ndown.exe +------------- +In this step, we run ndown.exe to create initial and boundary condition for +domain 2 based on the domain 1 (outer domain). + +Add the following into your namelist.input file under ``&time_control``:: + + io_form_auxinput2 = 2 + +Run ndown.exe to create ``wrfinput_d02`` and ``wrfbdy_d02``. + +Run WRF for coarser domain +--------------------------- +In this step, run WRF for the outer domain. +Make sure that ``max_dom = 1`` to run only for the coarser domain. + +This step is exactly identical as the previous example and only creates the +``wrfout*`` files for the coarser domain. + +Please make sure to copy ``lnd_in`` , ``lilac_in``, and ``lnd_modelio`` for the +coarser domain in this directory. + +Create CTSM runtime files for the fine domain +--------------------------------------------- +This step is in addition creating CTSM runtime files for coarser domain which +was explained here. For succesfully completing the previous step you should +have already created these files for the coarser domain. + +.. seealso:: + + The instructions for setting CTSM runtime options, are discussed in depth + in section :numref:`setting-ctsm-runtime-options`. For creating the runtime + files for the finer domain you should follow the steps in section + :numref:`setting-ctsm-runtime-options`. + + +Again, the goal here is to create files that determine CTSM runtime options which +are defined within these three files: + +- ``lnd_in``: This is the main namelist input file for CTSM inner domain + +- ``lnd_modelio.nml``: This sets CTSM's PIO (parallel I/O library) configuration settings + +- ``lilac_in``: This namelist controls the operation of LILAC + + +Run WRF for the finer domain +----------------------------- +First, save (rename or move) the data from the coarser domain simulation +(``wrfout_d01_*`` files). +Next, rename ``wrfinput_d02`` and ``wrfbdy_d02`` to ``wrfinput_d01`` and ``wrfbdy_d01``, respectively. + + +Edit namelist.input, moving all of the fine-grid domain data from column 2 to column 1 +so that this run will be for the fine-grid domain only. Make sure you set +`max_dom=1` and set your `time_step` based on the finer domain. + +.. note:: + It may be beneficial to save namelist.input to something else prior to this step in case you need to repeat this + process in the future. Save the newly-edited namelist as namelist.input . + +Now run wrf.exe by submitting a job similar to a not-nested case. + +.. important:: + + The output for the finer domain is wrfout_d01_* not wrfout_d02_* and although + in the name it is saying d01 it is technically d02 domain. + + + From 6dc9ed93f323f3077a9d2da0186920ce70adaca9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 2 Dec 2020 16:02:46 -0700 Subject: [PATCH 1661/1973] Remove support for CISM1 As of cism2_1_74, CISM1 is no longer supported, so we don't need to have a PE layout section for it. --- cime_config/config_compsets.xml | 2 +- cime_config/config_pes.xml | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index cc947a7439..787750a71c 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -18,7 +18,7 @@ ICE = [CICE, DICE, SICE] OCN = [DOCN, ,AQUAP, SOCN] ROF = [RTM, SROF] - GLC = [CISM1, CISM2] + GLC = [CISM2, SGLC] WAV = [SWAV] BGC = optional BGC scenario diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index 909c0d8049..bf141781ec 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -1190,19 +1190,4 @@ - - - - - - 1 - - - 1 - - - - - - From 8d8cca40983e423299efb6bbd1921a839c0798dc Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 4 Dec 2020 07:34:13 -0700 Subject: [PATCH 1662/1973] Update ChangeLog template Main change is to instruct removing lines that don't apply in most sections (as we agreed upon at yesterday's CTSM software meeting). I have also tweaked some clarifying text in some places, and moved the "significant changes" section higher up. --- doc/.ChangeLog_template | 60 +++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 107df0102a..a60ed2f865 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -10,17 +10,6 @@ Purpose of changes [Fill this in with details] -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] -CIME Issues fixed (include issue #): [If none, remove this line] - -Known bugs introduced in this tag (include github issue ID): [If none, remove this line] - -Known bugs found since the previous tag (include github issue ID): [If none, remove this line] - - Significant changes to scientifically-supported configurations -------------------------------------------------------------- @@ -37,8 +26,23 @@ Does this tag change answers significantly for any of the following physics conf [ ] clm4_5 + +Bugs fixed or introduced +------------------------ +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Issues fixed (include CTSM Issue #): + +CIME Issues fixed (include issue #): + +Known bugs introduced in this tag (include issue #): + +Known bugs found since the previous tag (include issue #): + + Notes of particular relevance for users --------------------------------------- +[Remove any lines that don't apply. Remove entire section if nothing applies.] Caveats for users (e.g., need to interpolate initial conditions): @@ -48,37 +52,34 @@ Changes made to namelist defaults (e.g., changed parameter values): Changes to the datasets (e.g., parameter, surface or initial files): -Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] +Substantial timing or memory changes: +[For timing changes, you should at least check the PFS test in the test + suite, whether or not you expect timing changes: ensure that its run + time has not increased significantly relative to the baseline.] + -Notes of particular relevance for developers: (including Code reviews and testing) +Notes of particular relevance for developers: --------------------------------------------- NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide +[Remove any lines that don't apply. Remove entire section if nothing applies.] Caveats for developers (e.g., code that is duplicated that requires double maintenance): Changes to tests or testing: -CTSM testing: - -[... Remove before making master tag. Available test levels: - - a) regular (must be run before handing off a tag to SEs and must be run - before committing a tag) - b) build_namelist (if namelists and/or build_system changed)) - c) tools (only if tools are modified and no CTSM source is modified) - d) short (for use during development and in rare cases where only a small - change with known behavior is added ... eg. a minor bug fix) - e) doc (no source testing required) -... ] +Testing summary +--------------- +[Remove any lines that don't apply.] - [PASS means all tests PASS and OK means tests PASS other than expected fails.] + [PASS means all tests PASS; OK means tests PASS other than + expected fails, including expected baseline failures.] - build-namelist tests: + build-namelist tests (if CLMBuildNamelist.pm has changed): cheyenne - - tools-tests (test/tools): + tools-tests (test/tools) (if tools have been changed): cheyenne - @@ -86,7 +87,7 @@ CTSM testing: cheyenne - - python testing (see instructions in python/README.md; document testing done): + python testing (if python code has changed; see instructions in python/README.md; document testing done): (any machine) - @@ -124,6 +125,7 @@ Changes answers relative to baseline: Detailed list of changes ------------------------ +[Remove any lines that don't apply. Remove entire section if nothing applies.] List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): From e0ba5046ebea8e37091b8c7e1d6f9e751c470bd2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 4 Dec 2020 11:21:33 -0700 Subject: [PATCH 1663/1973] Update some wording --- doc/.ChangeLog_template | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index a60ed2f865..5c1269ec2e 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -4,8 +4,8 @@ Originator(s): Date: One-line Summary: -Purpose of changes ------------------- +Purpose and description of changes +---------------------------------- [Fill this in with details] @@ -73,7 +73,7 @@ Testing summary [Remove any lines that don't apply.] [PASS means all tests PASS; OK means tests PASS other than - expected fails, including expected baseline failures.] + expected baseline failures.] build-namelist tests (if CLMBuildNamelist.pm has changed): From 3ac218680a5b7458c92be64c85798a88b8fc8094 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 4 Dec 2020 13:03:32 -0700 Subject: [PATCH 1664/1973] Return to earlier wording regarding expected fails @slevisconsulting and @ekluzek report "OK" if tests fail that are in the expected fails list, so we'll make that the standard (in addition to "OK" when there are expected baseline failures). --- doc/.ChangeLog_template | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 5c1269ec2e..f0799fdc69 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -72,8 +72,7 @@ Testing summary --------------- [Remove any lines that don't apply.] - [PASS means all tests PASS; OK means tests PASS other than - expected baseline failures.] + [PASS means all tests PASS; OK means tests PASS other than expected fails.] build-namelist tests (if CLMBuildNamelist.pm has changed): From cdd3b2ebd74968a4d5986b2eb347642acb749aa8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 4 Dec 2020 13:19:09 -0700 Subject: [PATCH 1665/1973] Use a throughput tolerance of 10% for the PFS test --- cime_config/testdefs/testlist_clm.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 2e3ff301f6..ad1a5982f2 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -2309,6 +2309,8 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + From 57da194e3a77fd39aff73d7494043e3b33381ca7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 4 Dec 2020 15:57:30 -0700 Subject: [PATCH 1666/1973] Change section wording --- doc/.ChangeLog_template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index f0799fdc69..3ea6ff316d 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -122,8 +122,8 @@ Changes answers relative to baseline: URL for LMWG diagnostics output used to validate new climate: -Detailed list of changes ------------------------- +Other details +------------- [Remove any lines that don't apply. Remove entire section if nothing applies.] List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): From 00ab2d65e3257894ce282c3b5436dd384bc498dc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 4 Dec 2020 16:44:55 -0700 Subject: [PATCH 1667/1973] PTCLM and test level section update Added some notes about the PTCLM test Also added back the test levels section --- doc/.ChangeLog_template | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 3ea6ff316d..acb3a1d1fa 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -68,8 +68,19 @@ Caveats for developers (e.g., code that is duplicated that requires double maint Changes to tests or testing: -Testing summary ---------------- +Testing summary: +---------------- +[... Remove before making master tag. Available test levels: + + a) regular (regular tests on normal machines if CTSM source is modified) + c) tools (if tools are modified) + d) minimal (for use in rare cases where only a small change with + known behavior is added ... eg. a minor bug fix. This + might be to just run the "short" test list, or to run + a single test. Whatever makes sense for the particular case.) + e) doc (no source testing required) +...] + [Remove any lines that don't apply.] [PASS means all tests PASS; OK means tests PASS other than expected fails.] @@ -82,7 +93,8 @@ Testing summary cheyenne - - PTCLM testing (tools/shared/PTCLM/test): + PTCLM testing (tools/shared/PTCLM/test): (if cime or cime_config are changed) + (PTCLM is being deprecated, so we only expect this to be done on occasion) cheyenne - From 77790c1d438823e5828673ea2346391b4e07e169 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 7 Dec 2020 14:28:18 -0800 Subject: [PATCH 1668/1973] updated externals tag for fates --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 91a3403f5d..6412efffe5 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.43.0_api.14.1.0 +tag = sci.1.43.2_api.14.2.0 required = True [PTCLM] From 654b53dd55145bd374c0b3722485b23be4cff26f Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 7 Dec 2020 17:14:05 -0700 Subject: [PATCH 1669/1973] Grid cell-level error check for H2O: non-transient simulations only Works for non-transient simulations. In this attempt I convert most column-level variables to grid cell-level locally in subr. BalanceCheck. Using grid cell-level variables calculated in subr. lnd2atm did not work because subr. lnd2atm is called after subr. BalanceCheck. --- src/biogeophys/BalanceCheckMod.F90 | 312 +++++++++++++++++++++++++--- src/biogeophys/WaterBalanceType.F90 | 18 +- src/main/clm_driver.F90 | 18 +- src/main/lnd2atmMod.F90 | 4 +- 4 files changed, 315 insertions(+), 37 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index c2d58f711e..bc73b68265 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -11,7 +11,7 @@ module BalanceCheckMod use decompMod , only : bounds_type use abortutils , only : endrun use clm_varctl , only : iulog - use clm_varcon , only : namep, namec + use clm_varcon , only : namep, namec, nameg use clm_varpar , only : nlevsoi use GetGlobalValuesMod , only : GetGlobalIndex use atm2lndType , only : atm2lnd_type @@ -23,6 +23,7 @@ module BalanceCheckMod use WaterDiagnosticBulkType, only : waterdiagnosticbulk_type use WaterDiagnosticType, only : waterdiagnostic_type use Wateratm2lndType , only : wateratm2lnd_type +! use Waterlnd2atmType , only : waterlnd2atm_type ! slevis: place holder use WaterBalanceType , only : waterbalance_type use WaterFluxType , only : waterflux_type use WaterType , only : water_type @@ -43,8 +44,9 @@ module BalanceCheckMod ! !PUBLIC MEMBER FUNCTIONS: public :: BalanceCheckInit ! Initialization of Water and energy balance check - public :: BeginWaterBalance ! Initialize water balance check - public :: BalanceCheck ! Water and energy balance check + public :: BeginWaterGridcellBalance ! Initialize grid cell-level water balance check + public :: BeginWaterColumnBalance ! Initialize column-level water balance check + public :: BalanceCheck ! Water & energy balance checks public :: GetBalanceCheckSkipSteps ! Get the number of steps to skip for the balance check public :: BalanceCheckClean ! Clean up for BalanceCheck @@ -54,7 +56,8 @@ module BalanceCheckMod ! ! !PRIVATE MEMBER FUNCTIONS: - private :: BeginWaterBalanceSingle ! Initialize water balance check for bulk or a single tracer + private :: BeginWaterGridcellBalanceSingle ! Initialize grid cell-level water balance check for bulk or a single tracer + private :: BeginWaterColumnBalanceSingle ! Initialize column-level water balance check for bulk or a single tracer character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -120,7 +123,46 @@ end function GetBalanceCheckSkipSteps !----------------------------------------------------------------------- !----------------------------------------------------------------------- - subroutine BeginWaterBalance(bounds, & + subroutine BeginWaterGridcellBalance(bounds, & + num_nolakec, filter_nolakec, num_lakec, filter_lakec, & + water_inst, soilhydrology_inst, & + use_aquifer_layer) + ! + ! !DESCRIPTION: + ! Initialize grid cell-level water balance at beginning of time step + ! for bulk water and each water tracer + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter + integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points + integer , intent(in) :: num_lakec ! number of column lake points in column filter + integer , intent(in) :: filter_lakec(:) ! column filter for lake points + type(water_type) , intent(inout) :: water_inst + type(soilhydrology_type), intent(in) :: soilhydrology_inst + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run + ! + ! !LOCAL VARIABLES: + integer :: i + + character(len=*), parameter :: subname = 'BeginWaterGridcellBalance' + !----------------------------------------------------------------------- + + do i = water_inst%bulk_and_tracers_beg, water_inst%bulk_and_tracers_end + call BeginWaterGridcellBalanceSingle(bounds, & + num_nolakec, filter_nolakec, & + num_lakec, filter_lakec, & + soilhydrology_inst, & + water_inst%bulk_and_tracers(i)%waterstate_inst, & + water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & + water_inst%bulk_and_tracers(i)%waterbalance_inst, & + use_aquifer_layer = use_aquifer_layer) + end do + + end subroutine BeginWaterGridcellBalance + + !----------------------------------------------------------------------- + subroutine BeginWaterColumnBalance(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & water_inst, soilhydrology_inst, & use_aquifer_layer) @@ -142,11 +184,11 @@ subroutine BeginWaterBalance(bounds, & ! !LOCAL VARIABLES: integer :: i - character(len=*), parameter :: subname = 'BeginWaterBalance' + character(len=*), parameter :: subname = 'BeginWaterColumnBalance' !----------------------------------------------------------------------- do i = water_inst%bulk_and_tracers_beg, water_inst%bulk_and_tracers_end - call BeginWaterBalanceSingle(bounds, & + call BeginWaterColumnBalanceSingle(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & soilhydrology_inst, & @@ -156,10 +198,85 @@ subroutine BeginWaterBalance(bounds, & use_aquifer_layer = use_aquifer_layer) end do - end subroutine BeginWaterBalance + end subroutine BeginWaterColumnBalance !----------------------------------------------------------------------- - subroutine BeginWaterBalanceSingle(bounds, & + subroutine BeginWaterGridcellBalanceSingle(bounds, & + num_nolakec, filter_nolakec, num_lakec, filter_lakec, & + soilhydrology_inst, waterstate_inst, waterdiagnostic_inst, waterbalance_inst, & + use_aquifer_layer) + ! + ! !DESCRIPTION: + ! Initialize grid cell-level water balance at beginning of time step + ! for bulk or a single tracer + ! + ! !USES: + use subgridAveMod, only: c2g + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter + integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points + integer , intent(in) :: num_lakec ! number of column lake points in column filter + integer , intent(in) :: filter_lakec(:) ! column filter for lake points + type(soilhydrology_type) , intent(in) :: soilhydrology_inst + class(waterstate_type) , intent(inout) :: waterstate_inst + class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst + class(waterbalance_type) , intent(inout) :: waterbalance_inst + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run + ! + ! !LOCAL VARIABLES: + integer :: c, j, fc ! indices + integer :: begc, endc, begg, endg ! bounds + !----------------------------------------------------------------------- + + associate( & + zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) + zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) + aquifer_water_baseline => waterstate_inst%aquifer_water_baseline, & ! Input: [real(r8)] baseline value for water in the unconfined aquifer (wa_col) for this bulk / tracer (mm) + wa => waterstate_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) + begwb_col => waterbalance_inst%begwb_col, & ! Output: [real(r8) (:) ] column-level water mass begining of the time step + begwb_grc => waterbalance_inst%begwb_grc & ! Output: [real(r8) (:) ] grid cell-level water mass begining of the time step + ) + + begc = bounds%begc + endc = bounds%endc + begg = bounds%begg + endg = bounds%endg + + ! wa(c) gets added to liquid_mass in ComputeLiqIceMassNonLake + if(use_aquifer_layer) then + do fc = 1, num_nolakec + c = filter_nolakec(fc) + if (col%hydrologically_active(c)) then + if(zwt(c) <= zi(c,nlevsoi)) then + wa(c) = aquifer_water_baseline + end if + end if + end do + endif + + ! NOTES subroutines Compute*Mass* are in TotalWaterAndHeatMod.F90 + ! endwb is calculated in HydrologyDrainageMod & LakeHydrologyMod + call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & + waterstate_inst, waterdiagnostic_inst, & + subtract_dynbal_baselines = .false., & + water_mass = begwb_col(begc:endc)) + + call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & + waterstate_inst, & + subtract_dynbal_baselines = .false., & + water_mass = begwb_col(begc:endc)) + + call c2g(bounds, begwb_col(begc:endc), begwb_grc(begg:endg), & + c2l_scale_type='urbanf', l2g_scale_type='unity') + + end associate + + end subroutine BeginWaterGridcellBalanceSingle + + !----------------------------------------------------------------------- + subroutine BeginWaterColumnBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & soilhydrology_inst, waterstate_inst, waterdiagnostic_inst, waterbalance_inst, & use_aquifer_layer) @@ -223,7 +340,7 @@ subroutine BeginWaterBalanceSingle(bounds, & end associate - end subroutine BeginWaterBalanceSingle + end subroutine BeginWaterColumnBalanceSingle !----------------------------------------------------------------------- subroutine BalanceCheck( bounds, & @@ -231,6 +348,7 @@ subroutine BalanceCheck( bounds, & atm2lnd_inst, solarabs_inst, waterflux_inst, waterstate_inst, & waterdiagnosticbulk_inst, waterbalance_inst, wateratm2lnd_inst, & surfalb_inst, energyflux_inst, canopystate_inst) +! waterlnd2atm_inst, surfalb_inst, energyflux_inst, canopystate_inst) ! ! !DESCRIPTION: ! This subroutine accumulates the numerical truncation errors of the water @@ -251,7 +369,7 @@ subroutine BalanceCheck( bounds, & use clm_time_manager , only : get_step_size_real, get_nstep use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause use CanopyStateType , only : canopystate_type - use subgridAveMod + use subgridAveMod ! , only : c2g ? ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -263,6 +381,7 @@ subroutine BalanceCheck( bounds, & class(waterstate_type), intent(in) :: waterstate_inst type(waterdiagnosticbulk_type), intent(in) :: waterdiagnosticbulk_inst class(waterbalance_type), intent(inout) :: waterbalance_inst +! class(waterlnd2atm_type), intent(in) :: waterlnd2atm_inst class(wateratm2lnd_type) , intent(in) :: wateratm2lnd_inst type(surfalb_type) , intent(in) :: surfalb_inst type(energyflux_type) , intent(inout) :: energyflux_inst @@ -277,6 +396,18 @@ subroutine BalanceCheck( bounds, & real(r8) :: forc_rain_col(bounds%begc:bounds%endc) ! column level rain rate [mm/s] real(r8) :: forc_snow_col(bounds%begc:bounds%endc) ! column level snow rate [mm/s] real(r8) :: h2osno_total(bounds%begc:bounds%endc) ! total snow water [mm H2O] + real(r8) :: endwb_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now + real(r8) :: qflx_irrig_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now + real(r8) :: qflx_glcice_dyn_water_flux_locgrc(bounds%begg:bounds%endg) ! water flux needed for balance check due to glc_dyn_runoff_routing [mm H2O/s] (positive means addition of water to the system) + real(r8) :: qflx_evap_tot_locgrc(bounds%begg:bounds%endg) ! grid cell level total evapotranspiration [mm/s] + real(r8) :: qflx_surf_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now + real(r8) :: qflx_drain_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now + real(r8) :: qflx_drain_perched_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now + real(r8) :: qflx_qrgwl_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now + real(r8) :: qflx_ice_runoff_snwcp_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now + real(r8) :: qflx_ice_runoff_xs_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now + real(r8) :: qflx_snwcp_discarded_liq_locgrc(bounds%begg:bounds%endg) ! excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] + real(r8) :: qflx_snwcp_discarded_ice_locgrc(bounds%begg:bounds%endg) ! excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] real(r8) :: errh2o_max_val ! Maximum value of error in water conservation error over all columns [mm H2O] real(r8) :: errh2osno_max_val ! Maximum value of error in h2osno conservation error over all columns [kg m-2] @@ -294,6 +425,9 @@ subroutine BalanceCheck( bounds, & associate( & forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse radiation (vis=forc_solsd, nir=forc_solld) + forc_rain_grc => wateratm2lnd_inst%forc_rain_not_downscaled_grc , & ! Input: [real(r8) (:)] grid cell-level rain rate [mm/s] + forc_snow_grc => wateratm2lnd_inst%forc_snow_not_downscaled_grc , & ! Input: [real(r8) (:)] grid cell-level snow rate [mm/s] + qflx_flood_grc => wateratm2lnd_inst%forc_flood_grc , & ! Input: [real(r8) (:) ] total grid cell-level runoff from river model forc_rain => wateratm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] rain rate [mm/s] forc_snow => wateratm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] snow rate [mm/s] forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) @@ -302,10 +436,13 @@ subroutine BalanceCheck( bounds, & frac_sno_eff => waterdiagnosticbulk_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] effective snow fraction frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - begwb => waterbalance_inst%begwb_col , & ! Input: [real(r8) (:) ] water mass begining of the time step - errh2o => waterbalance_inst%errh2o_col , & ! Output: [real(r8) (:) ] water conservation error (mm H2O) + begwb_grc => waterbalance_inst%begwb_grc , & ! Input: [real(r8) (:) ] grid cell-level water mass begining of the time step +! endwb_grc => waterbalance_inst%endwb_grc , & ! Output: [real(r8) (:) ] grid cell-level water mass end of the time step + errh2o_grc => waterbalance_inst%errh2o_grc , & ! Output: [real(r8) (:) ] grid cell-level water conservation error (mm H2O) + begwb_col => waterbalance_inst%begwb_col , & ! Input: [real(r8) (:) ] column-level water mass begining of the time step + endwb_col => waterbalance_inst%endwb_col , & ! Output: [real(r8) (:) ] column-level water mass end of the time step + errh2o_col => waterbalance_inst%errh2o_col , & ! Output: [real(r8) (:) ] column-level water conservation error (mm H2O) errh2osno => waterbalance_inst%errh2osno_col , & ! Output: [real(r8) (:) ] error in h2osno (kg m-2) - endwb => waterbalance_inst%endwb_col , & ! Output: [real(r8) (:) ] water mass end of the time step snow_sources => waterbalance_inst%snow_sources_col , & ! Output: [real(r8) (:) ] snow sources (mm H2O /s) snow_sinks => waterbalance_inst%snow_sinks_col , & ! Output: [real(r8) (:) ] snow sinks (mm H2O /s) qflx_liq_grnd_col => waterflux_inst%qflx_liq_grnd_col , & ! Input: [real(r8) (:) ] liquid on ground after interception (mm H2O/s) [+] @@ -315,6 +452,7 @@ subroutine BalanceCheck( bounds, & qflx_snwcp_discarded_liq => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Input: [real(r8) (:) ] excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+]` qflx_snwcp_discarded_ice => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Input: [real(r8) (:) ] excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+]` qflx_evap_tot => waterflux_inst%qflx_evap_tot_col , & ! Input: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg +! qflx_evap_tot_grc => waterlnd2atm_inst%qflx_evap_tot_grc, & ! Input: [real(r8) (:) ] grid cell-level qflx_evap_soi + qflx_evap_can + qflx_tran_veg qflx_soliddew_to_top_layer => waterflux_inst%qflx_soliddew_to_top_layer_col , & ! Input: [real(r8) (:) ] rate of solid water deposited on top soil or snow layer (frost) (mm H2O /s) [+] qflx_solidevap_from_top_layer => waterflux_inst%qflx_solidevap_from_top_layer_col, & ! Input: [real(r8) (:) ] rate of ice evaporated from top soil or snow layer (sublimation) (mm H2O /s) [+] qflx_liqevap_from_top_layer => waterflux_inst%qflx_liqevap_from_top_layer_col , & ! Input: [real(r8) (:) ] rate of liquid water evaporated from top soil or snow layer (mm H2O/s) [+] @@ -323,16 +461,24 @@ subroutine BalanceCheck( bounds, & qflx_snow_h2osfc => waterflux_inst%qflx_snow_h2osfc_col , & ! Input: [real(r8) (:) ] snow falling on surface water (mm/s) qflx_h2osfc_to_ice => waterflux_inst%qflx_h2osfc_to_ice_col , & ! Input: [real(r8) (:) ] conversion of h2osfc to ice qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) +! qflx_rofliq_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:) ] grid cell-level sub-surface runoff (mm H2O /s) qflx_floodc => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] total runoff due to flooding qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Input: [real(r8) (:) ] drainage from snow pack +! qflx_liq_dynbal_grc => waterflux_inst%qflx_liq_dynbal_grc , & ! Input: [real(r8) (:) ] slevis: place holder +! qflx_ice_dynbal_grc => waterflux_inst%qflx_ice_dynbal_grc , & ! Input: [real(r8) (:) ] slevis: place holder +! qflx_runoff_col => waterflux_inst%qflx_runoff_col , & ! total runoff (mm H2O / s) slevis: place holder qflx_surf => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] surface runoff (mm H2O /s) +! qflx_rofliq_qsur_grc => waterlnd2atm_inst%qflx_rofliq_qsur_grc , & ! Input: [real(r8) (:) ] grid cell-level surface runoff (mm H20 /s) qflx_qrgwl => waterflux_inst%qflx_qrgwl_col , & ! Input: [real(r8) (:) ] qflx_surf at glaciers, wetlands, lakes +! qflx_rofliq_qgwl_grc => waterlnd2atm_inst%qflx_rofliq_qgwl_grc , & ! Input: [real(r8) (:) ] grid cell-level qflx_surf at glaciers, wetlands, lakes qflx_drain => waterflux_inst%qflx_drain_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) +! qflx_rofliq_qsub_grc => waterlnd2atm_inst%qflx_rofliq_qsub_grc , & ! Input: [real(r8) (:) ] grid cell-level drainage (mm H20 /s) qflx_ice_runoff_snwcp => waterflux_inst%qflx_ice_runoff_snwcp_col, & ! Input: [real(r8) (:) ] solid runoff from snow capping (mm H2O /s) qflx_ice_runoff_xs => waterflux_inst%qflx_ice_runoff_xs_col , & ! Input: [real(r8) (:) ] solid runoff from excess ice in soil (mm H2O /s) qflx_sl_top_soil => waterflux_inst%qflx_sl_top_soil_col , & ! Input: [real(r8) (:) ] liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) qflx_sfc_irrig => waterflux_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s) +! qirrig_grc => waterlnd2atm_inst%qirrig_grc , & ! Input: [real(r8) (:) ] grid cell-level irrigation flux (mm H20 /s) qflx_glcice_dyn_water_flux => waterflux_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) @@ -393,14 +539,14 @@ subroutine BalanceCheck( bounds, & end if end do - ! Water balance check + ! Water balance check at the column level do c = bounds%begc, bounds%endc ! add qflx_drain_perched and qflx_flood if (col%active(c)) then - errh2o(c) = endwb(c) - begwb(c) & + errh2o_col(c) = endwb_col(c) - begwb_col(c) & - (forc_rain_col(c) & + forc_snow_col(c) & + qflx_floodc(c) & @@ -418,31 +564,31 @@ subroutine BalanceCheck( bounds, & else - errh2o(c) = 0.0_r8 + errh2o_col(c) = 0.0_r8 end if end do - errh2o_max_val = maxval(abs(errh2o(bounds%begc:bounds%endc))) + errh2o_max_val = maxval(abs(errh2o_col(bounds%begc:bounds%endc))) if (errh2o_max_val > h2o_warning_thresh) then - indexc = maxloc( abs(errh2o(bounds%begc:bounds%endc)), 1 ) + bounds%begc -1 - write(iulog,*)'WARNING: water balance error ',& + indexc = maxloc( abs(errh2o_col(bounds%begc:bounds%endc)), 1 ) + bounds%begc -1 + write(iulog,*)'WARNING: column-level water balance error ',& ' nstep= ',nstep, & ' local indexc= ',indexc,& ! ' global indexc= ',GetGlobalIndex(decomp_index=indexc, clmlevel=namec), & - ' errh2o= ',errh2o(indexc) + ' errh2o= ',errh2o_col(indexc) if ((errh2o_max_val > error_thresh) .and. (DAnstep > skip_steps)) then write(iulog,*)'clm urban model is stopping - error is greater than 1e-5 (mm)' write(iulog,*)'nstep = ',nstep - write(iulog,*)'errh2o = ',errh2o(indexc) + write(iulog,*)'errh2o_col = ',errh2o_col(indexc) write(iulog,*)'forc_rain = ',forc_rain_col(indexc)*dtime write(iulog,*)'forc_snow = ',forc_snow_col(indexc)*dtime - write(iulog,*)'endwb = ',endwb(indexc) - write(iulog,*)'begwb = ',begwb(indexc) + write(iulog,*)'endwb_col = ',endwb_col(indexc) + write(iulog,*)'begwb_col = ',begwb_col(indexc) write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot(indexc)*dtime write(iulog,*)'qflx_sfc_irrig = ',qflx_sfc_irrig(indexc)*dtime @@ -455,8 +601,8 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice(indexc)*dtime write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq(indexc)*dtime - write(iulog,*)'deltawb = ',endwb(indexc)-begwb(indexc) - write(iulog,*)'deltawb/dtime = ',(endwb(indexc)-begwb(indexc))/dtime + write(iulog,*)'deltawb = ',endwb_col(indexc)-begwb_col(indexc) + write(iulog,*)'deltawb/dtime = ',(endwb_col(indexc)-begwb_col(indexc))/dtime if (.not.(col%itype(indexc) == icol_roof .or. & col%itype(indexc) == icol_road_imperv .or. & @@ -473,7 +619,118 @@ subroutine BalanceCheck( bounds, & end if - ! Snow balance check + ! Water balance check at the grid cell level + + call c2g(bounds, & + endwb_col(bounds%begc:bounds%endc), & + endwb_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type='urbanf', l2g_scale_type='unity') + call c2g( bounds, & + qflx_sfc_irrig(bounds%begc:bounds%endc), & + qflx_irrig_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_glcice_dyn_water_flux(bounds%begc:bounds%endc), & + qflx_glcice_dyn_water_flux_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_evap_tot(bounds%begc:bounds%endc), & + qflx_evap_tot_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_surf(bounds%begc:bounds%endc), & + qflx_surf_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_qrgwl(bounds%begc:bounds%endc), & + qflx_qrgwl_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_drain(bounds%begc:bounds%endc), & + qflx_drain_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_drain_perched(bounds%begc:bounds%endc), & + qflx_drain_perched_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_ice_runoff_snwcp(bounds%begc:bounds%endc), & + qflx_ice_runoff_snwcp_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_ice_runoff_xs(bounds%begc:bounds%endc), & + qflx_ice_runoff_xs_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_snwcp_discarded_liq(bounds%begc:bounds%endc), & + qflx_snwcp_discarded_liq_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call c2g( bounds, & + qflx_snwcp_discarded_ice(bounds%begc:bounds%endc), & + qflx_snwcp_discarded_ice_locgrc(bounds%begg:bounds%endg), & + c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + + do g = bounds%begg, bounds%endg + errh2o_grc(g) = endwb_locgrc(g) - begwb_grc(g) & + - (forc_rain_grc(g) & + + forc_snow_grc(g) & + + qflx_flood_grc(g) & + + qflx_irrig_locgrc(g) & + + qflx_glcice_dyn_water_flux_locgrc(g) & + - qflx_evap_tot_locgrc(g) & + - qflx_surf_locgrc(g) & + - qflx_qrgwl_locgrc(g) & + - qflx_drain_locgrc(g) & + - qflx_drain_perched_locgrc(g) & + - qflx_ice_runoff_snwcp_locgrc(g) & + - qflx_ice_runoff_xs_locgrc(g) & + - qflx_snwcp_discarded_liq_locgrc(g) & + - qflx_snwcp_discarded_ice_locgrc(g)) * dtime + end do + + errh2o_max_val = maxval(abs(errh2o_grc(bounds%begg:bounds%endg))) + + if (errh2o_max_val > h2o_warning_thresh) then + + indexg = maxloc( abs(errh2o_grc(bounds%begg:bounds%endg)), 1 ) + bounds%begg -1 + write(iulog,*)'WARNING: grid cell-level water balance error ',& + ' nstep= ',nstep, & + ' local indexg= ',indexg,& + ' errh2o_grc= ',errh2o_grc(indexg) + if ((errh2o_max_val > error_thresh) .and. (DAnstep > skip_steps)) then + + write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' + write(iulog,*)'nstep = ',nstep + write(iulog,*)'errh2o_grc = ',errh2o_grc(indexg) + write(iulog,*)'forc_rain = ',forc_rain_grc(indexg)*dtime + write(iulog,*)'forc_snow = ',forc_snow_grc(indexg)*dtime + write(iulog,*)'endwb_loc = ',endwb_locgrc(indexg) + write(iulog,*)'begwb_grc = ',begwb_grc(indexg) + + write(iulog,*)'qflx_evap_tot_loc = ',qflx_evap_tot_locgrc(indexg)*dtime + write(iulog,*)'qflx_irrig_loc = ',qflx_irrig_locgrc(indexg)*dtime + write(iulog,*)'qflx_surf_loc = ',qflx_surf_locgrc(indexg)*dtime + write(iulog,*)'qflx_qrgwl_loc = ',qflx_qrgwl_locgrc(indexg)*dtime + write(iulog,*)'qflx_drain_loc = ',qflx_drain_locgrc(indexg)*dtime + write(iulog,*)'qflx_ice_runoff_snwcp_loc = ',qflx_ice_runoff_snwcp_locgrc(indexg)*dtime + write(iulog,*)'qflx_ice_runoff_xs_loc = ',qflx_ice_runoff_xs_locgrc(indexg)*dtime + write(iulog,*)'qflx_snwcp_discarded_ice_loc = ',qflx_snwcp_discarded_ice_locgrc(indexg)*dtime + write(iulog,*)'qflx_snwcp_discarded_liq_loc = ',qflx_snwcp_discarded_liq_locgrc(indexg)*dtime + write(iulog,*)'deltawb = ',endwb_locgrc(indexg)-begwb_grc(indexg) + write(iulog,*)'deltawb/dtime = ',(endwb_locgrc(indexg)-begwb_grc(indexg))/dtime + write(iulog,*)'qflx_drain_perched_loc = ',qflx_drain_perched_locgrc(indexg)*dtime + write(iulog,*)'qflx_flood = ',qflx_flood_grc(indexg)*dtime + write(iulog,*)'qflx_glcice_dyn_water_flux_grc_loc = ',qflx_glcice_dyn_water_flux_locgrc(indexg)*dtime + + write(iulog,*)'clm model is stopping' + call endrun(decomp_index=indexg, clmlevel=nameg, msg=errmsg(sourcefile, __LINE__)) + end if + + end if + + ! Snow balance check at the grid cell level. + ! Beginning snow balance variable h2osno_old is calculated once + ! for both the column-level and grid cell-level balance checks. call waterstate_inst%CalculateTotalH2osno(bounds, num_allc, filter_allc, & caller = 'BalanceCheck', & @@ -574,6 +831,7 @@ subroutine BalanceCheck( bounds, & end if + ! Energy balance checks do p = bounds%begp, bounds%endp diff --git a/src/biogeophys/WaterBalanceType.F90 b/src/biogeophys/WaterBalanceType.F90 index d8e6f3f8ba..4d747acebe 100644 --- a/src/biogeophys/WaterBalanceType.F90 +++ b/src/biogeophys/WaterBalanceType.F90 @@ -36,10 +36,13 @@ module WaterBalanceType ! Balance Checks - real(r8), pointer :: begwb_col (:) ! water mass begining of the time step - real(r8), pointer :: endwb_col (:) ! water mass end of the time step + real(r8), pointer :: begwb_grc (:) ! grid cell-level water mass begining of the time step + real(r8), pointer :: endwb_grc (:) ! grid cell-level water mass end of the time step + real(r8), pointer :: begwb_col (:) ! column-level water mass begining of the time step + real(r8), pointer :: endwb_col (:) ! column-level water mass end of the time step real(r8), pointer :: errh2o_patch (:) ! water conservation error (mm H2O) - real(r8), pointer :: errh2o_col (:) ! water conservation error (mm H2O) + real(r8), pointer :: errh2o_col (:) ! column-level water conservation error (mm H2O) + real(r8), pointer :: errh2o_grc (:) ! grid cell-level water conservation error (mm H2O) real(r8), pointer :: errh2osno_col (:) ! snow water conservation error(mm H2O) contains @@ -112,6 +115,12 @@ subroutine InitAllocate(this, bounds, tracer_vars) container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN) + call AllocateVar1d(var = this%begwb_grc, name = 'begwb_grc', & + container = tracer_vars, & + bounds = bounds, subgrid_level = BOUNDS_SUBGRID_GRIDCELL) + call AllocateVar1d(var = this%endwb_grc, name = 'endwb_grc', & + container = tracer_vars, & + bounds = bounds, subgrid_level = BOUNDS_SUBGRID_GRIDCELL) call AllocateVar1d(var = this%begwb_col, name = 'begwb_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN) @@ -124,6 +133,9 @@ subroutine InitAllocate(this, bounds, tracer_vars) call AllocateVar1d(var = this%errh2o_col, name = 'errh2o_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN) + call AllocateVar1d(var = this%errh2o_grc, name = 'errh2o_grc', & + container = tracer_vars, & + bounds = bounds, subgrid_level = BOUNDS_SUBGRID_GRIDCELL) call AllocateVar1d(var = this%errh2osno_col, name = 'errh2osno_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index f06c49bc12..c332f9a662 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -26,7 +26,7 @@ module clm_driver use abortutils , only : endrun ! use dynSubgridDriverMod , only : dynSubgrid_driver, dynSubgrid_wrapup_weight_changes - use BalanceCheckMod , only : BeginWaterBalance, BalanceCheck + use BalanceCheckMod , only : BeginWaterGridcellBalance, BeginWaterColumnBalance, BalanceCheck ! use BiogeophysPreFluxCalcsMod , only : BiogeophysPreFluxCalcs use SurfaceHumidityMod , only : CalculateSurfaceHumidity @@ -326,6 +326,13 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro end if call t_stopf('begcnbal_grc') + call t_startf('begwbal') + call BeginWaterGridcellBalance(bounds_clump, & + filter(nc)%num_nolakec, filter(nc)%nolakec, & + filter(nc)%num_lakec, filter(nc)%lakec, & + water_inst, soilhydrology_inst, & + use_aquifer_layer = use_aquifer_layer()) + call t_stopf('begwbal') end do !$OMP END PARALLEL DO @@ -361,9 +368,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! For water: Currently, I believe this needs to be done after weights are updated for ! prescribed transient patches or CNDV, because column-level water is not generally ! conserved when weights change (instead the difference is put in the grid cell-level - ! terms, qflx_liq_dynbal, etc.). In the future, we may want to change the balance - ! checks to ensure that the grid cell-level water is conserved, considering - ! qflx_liq_dynbal; in this case, the call to BeginWaterBalance should be moved to + ! terms, qflx_liq_dynbal, etc.). Grid cell-level balance + ! checks ensure that the grid cell-level water is conserved by considering + ! qflx_liq_dynbal and calling BeginWaterGridcellBalance ! before the weight updates. ! ! For carbon & nitrogen: This needs to be done after dynSubgrid_driver, because the @@ -381,7 +388,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_stopf('prescribed_sm') endif call t_startf('begwbal') - call BeginWaterBalance(bounds_clump, & + call BeginWaterColumnBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & water_inst, soilhydrology_inst, & @@ -1103,6 +1110,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & water_inst%waterbalancebulk_inst, water_inst%wateratm2lndbulk_inst, & surfalb_inst, energyflux_inst, canopystate_inst) +! water_inst%waterlnd2atmbulk_inst, surfalb_inst, energyflux_inst, canopystate_inst) call t_stopf('balchk') ! ============================================================================ diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index 9a18428264..6c64043d8c 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -405,10 +405,10 @@ subroutine lnd2atm(bounds, & call c2g( bounds, & water_inst%waterbalancebulk_inst%endwb_col(bounds%begc:bounds%endc), & - water_inst%waterdiagnosticbulk_inst%tws_grc (bounds%begg:bounds%endg), & + water_inst%waterbalancebulk_inst%endwb_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) do g = bounds%begg, bounds%endg - water_inst%waterdiagnosticbulk_inst%tws_grc(g) = water_inst%waterdiagnosticbulk_inst%tws_grc(g) + water_inst%wateratm2lndbulk_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8 + water_inst%waterdiagnosticbulk_inst%tws_grc(g) = water_inst%waterbalancebulk_inst%endwb_grc(g) + water_inst%wateratm2lndbulk_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8 enddo end subroutine lnd2atm From a29c9c2e1b53f90ed1a047d02204afb046862bb8 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 8 Dec 2020 11:21:45 -0700 Subject: [PATCH 1670/1973] Updated ChangeLog and ChangeSum and addition of a comment --- doc/ChangeLog | 7 +++---- doc/ChangeSum | 2 +- src/main/histFileMod.F90 | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4e502ec937..2f0751eb16 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev018 Originator(s): slevis (Samuel Levis,,303-665-1310) -Date: Sat Nov 28 15:06:12 MST 2020 +Date: Tue Dec 8 11:19:02 MST 2020 One-line Summary: Add ACTIVE (T/F) column to master hist fields table and alphabetize Purpose of changes @@ -10,7 +10,6 @@ Purpose of changes For convenience, added an ACTIVE column to the master fields table and alphabetized. - Bugs fixed or introduced ------------------------ @@ -83,8 +82,8 @@ CTSM testing: regular tests (aux_clm): - cheyenne ---- WAIT - izumi ------- WAIT + cheyenne ---- PASS + izumi ------- PASS If the tag used for baseline comparisons was NOT the previous tag, note that here: diff --git a/doc/ChangeSum b/doc/ChangeSum index fec9c45439..510d1612c5 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev018 slevis 11/28/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize + ctsm5.1.dev018 slevis 12/08/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file ctsm5.1.dev016 multiple 11/17/2020 Updates for nuopc ctsm5.1.dev015 sacks 11/13/2020 A few small fixes diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 2e037c143a..e5b0a1ba4a 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -1000,6 +1000,8 @@ end subroutine copy_history_entry subroutine sort_hist_list(t, n_fields, hist_list) ! !DESCRIPTION: + ! Sort list of history variable names hist_list in alphabetical + ! order. ! !ARGUMENTS: integer, intent(in) :: t ! tape index From 5a0c758d672fcae5ef383617663650d76f2348bd Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 8 Dec 2020 16:17:06 -0700 Subject: [PATCH 1671/1973] Deleted a blank line; committing this in prep for update to latest tag --- src/biogeophys/BalanceCheckMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index bc73b68265..206af92946 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -831,7 +831,6 @@ subroutine BalanceCheck( bounds, & end if - ! Energy balance checks do p = bounds%begp, bounds%endp From f5f56ee0d7294bf7847951977d46153e1bf7d3aa Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 8 Dec 2020 16:34:55 -0700 Subject: [PATCH 1672/1973] Correct test number, Sam Levis removed some tests no longer relevent in a previous tag --- bld/unit_testers/build-namelist_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 0fee84f11c..1a86b5faf6 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,7 +138,7 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 1516; +my $ntests = 1513; if ( defined($opts{'compare'}) ) { $ntests += 1017; } From 01c13f038c051247369b239be669431fb86be87e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 8 Dec 2020 16:47:10 -0700 Subject: [PATCH 1673/1973] Move biomass heat storage if outside of long loop, have a small loop for else case --- src/biogeophys/CanopyFluxesMod.F90 | 33 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 715d797e87..ab19bff11a 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -680,10 +680,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, end do ! calculate biomass heat capacities - do f = 1, fn - p = filterp(f) - - if(use_biomass_heat_storage) then + if(use_biomass_heat_storage) then +bioms: do f = 1, fn + p = filterp(f) ! fraction of stem receiving incoming radiation frac_rad_abs_by_stem(p) = (esai(p))/(elai(p)+esai(p)) @@ -750,18 +749,22 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! resistance between internal stem temperature and canopy air rstem(p) = rstem_per_dbh(patch%itype(p))*dbh(p) - else - ! use_biomass_heat_storage .false. - frac_rad_abs_by_stem(p) = 0._r8 - sa_stem(p) = 0._r8 - sa_leaf(p) = (elai(p)+esai(p)) - sa_internal(p) = 0._r8 - cp_leaf(p) = 0._r8 - cp_stem(p) = 0._r8 - rstem(p) = 0._r8 - endif - enddo + enddo bioms + else + ! Otherwise set biomass heat storage terms to zero + do f = 1, fn + p = filterp(f) + sa_leaf(p) = (elai(p)+esai(p)) + frac_rad_abs_by_stem(p) = 0._r8 + sa_stem(p) = 0._r8 + sa_internal(p) = 0._r8 + cp_leaf(p) = 0._r8 + cp_stem(p) = 0._r8 + rstem(p) = 0._r8 + end do + end if + ! calculate daylength control for Vcmax do f = 1, fn From ff59a5fe62f57b9b7b795256254311bcda1aafe9 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 8 Dec 2020 17:51:35 -0700 Subject: [PATCH 1674/1973] Mods required in new code from conflicts not caught by git --- src/biogeophys/BalanceCheckMod.F90 | 12 ++++++++---- src/main/clm_driver.F90 | 8 ++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index ea3e4360ab..b9390c57b3 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -126,7 +126,7 @@ end function GetBalanceCheckSkipSteps !----------------------------------------------------------------------- subroutine BeginWaterGridcellBalance(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, soilhydrology_inst, & + water_inst, soilhydrology_inst, lakestate_inst, & use_aquifer_layer) ! ! !DESCRIPTION: @@ -140,6 +140,7 @@ subroutine BeginWaterGridcellBalance(bounds, & integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(water_type) , intent(inout) :: water_inst + type(lakestate_type) , intent(in) :: lakestate_inst type(soilhydrology_type), intent(in) :: soilhydrology_inst logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! @@ -154,6 +155,7 @@ subroutine BeginWaterGridcellBalance(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & soilhydrology_inst, & + lakestate_inst, & water_inst%bulk_and_tracers(i)%waterstate_inst, & water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & water_inst%bulk_and_tracers(i)%waterbalance_inst, & @@ -206,7 +208,8 @@ end subroutine BeginWaterColumnBalance !----------------------------------------------------------------------- subroutine BeginWaterGridcellBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - soilhydrology_inst, waterstate_inst, waterdiagnostic_inst, waterbalance_inst, & + soilhydrology_inst, lakestate_inst, waterstate_inst, & + waterdiagnostic_inst, waterbalance_inst, & use_aquifer_layer) ! ! !DESCRIPTION: @@ -223,6 +226,7 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(soilhydrology_type) , intent(in) :: soilhydrology_inst + type(lakestate_type) , intent(in) :: lakestate_inst class(waterstate_type) , intent(inout) :: waterstate_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst class(waterbalance_type) , intent(inout) :: waterbalance_inst @@ -267,8 +271,8 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & water_mass = begwb_col(begc:endc)) call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, & - subtract_dynbal_baselines = .false., & + waterstate_inst, lakestate_inst, & + add_lake_water_and_subtract_dynbal_baselines = .false., & water_mass = begwb_col(begc:endc)) call c2g(bounds, begwb_col(begc:endc), begwb_grc(begg:endg), & diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 3b619b1e45..943106bbd2 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -327,10 +327,10 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_stopf('begcnbal_grc') call t_startf('begwbal') - call BeginWaterGridcellBalance(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_lakec, filter(nc)%lakec, & - water_inst, soilhydrology_inst, & + call BeginWaterGridcellBalance(bounds_clump, & + filter(nc)%num_nolakec, filter(nc)%nolakec, & + filter(nc)%num_lakec, filter(nc)%lakec, & + water_inst, soilhydrology_inst, lakestate_inst, & use_aquifer_layer = use_aquifer_layer()) call t_stopf('begwbal') end do From 37ab0e187da6caf1f502a8e91d412e09b0a20aa8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 10 Dec 2020 16:32:29 -0700 Subject: [PATCH 1675/1973] Update .ChangeLog_template More work with test levels. --- doc/.ChangeLog_template | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index acb3a1d1fa..b0632412ee 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -72,13 +72,18 @@ Testing summary: ---------------- [... Remove before making master tag. Available test levels: +Model test levels one of the next three (one MUST be given): a) regular (regular tests on normal machines if CTSM source is modified) - c) tools (if tools are modified) - d) minimal (for use in rare cases where only a small change with + b) minimal (for use in rare cases where only a small change with known behavior is added ... eg. a minor bug fix. This might be to just run the "short" test list, or to run a single test. Whatever makes sense for the particular case.) - e) doc (no source testing required) + c) doc (no source testing required) +Optional Tools test level: add this if standard tools were changed: + d) tools (if tools are modified) + +i.e. for regular testing with tools the test level would be: regular tools +if JUST tools were changed it would be: tools ...] [Remove any lines that don't apply.] From a624c70f8a3943f958ef50da3e422cce31a7a876 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 10 Dec 2020 16:50:52 -0700 Subject: [PATCH 1676/1973] Update .ChangeLog_template Note that model test level should always be given, so tools-only test level would be: doc tools --- doc/.ChangeLog_template | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index b0632412ee..bc52a4b52d 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -83,7 +83,8 @@ Optional Tools test level: add this if standard tools were changed: d) tools (if tools are modified) i.e. for regular testing with tools the test level would be: regular tools -if JUST tools were changed it would be: tools +if JUST tools were changed it would be: doc tools +which says no testing of the source was done, but the tools tests were also done ...] [Remove any lines that don't apply.] From 7552e7f381360ca3d773740fc877ded55d1bdf71 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 10 Dec 2020 17:04:14 -0700 Subject: [PATCH 1677/1973] Update .ChangeLog_template Added two new test levels for fates and release. --- doc/.ChangeLog_template | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index bc52a4b52d..331cbda28b 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -72,15 +72,20 @@ Testing summary: ---------------- [... Remove before making master tag. Available test levels: -Model test levels one of the next three (one MUST be given): - a) regular (regular tests on normal machines if CTSM source is modified) +Model test levels one of the next five (one MUST be given): + a) doc (no source testing required) b) minimal (for use in rare cases where only a small change with known behavior is added ... eg. a minor bug fix. This might be to just run the "short" test list, or to run a single test. Whatever makes sense for the particular case.) - c) doc (no source testing required) + c) fates (Just run the fates test list on normal machines if CTSM source + only relating to fates is modified) + d) regular (regular tests on normal machines if CTSM source is modified) + e) release (regular tests plus the fates, ctsm_sci, aux_glc, mosart and rtm test lists + and normally all of the ancillary tests (build-namelist, python, ptclm, etc.) + would be run as well) Optional Tools test level: add this if standard tools were changed: - d) tools (if tools are modified) + f) tools (if tools are modified) i.e. for regular testing with tools the test level would be: regular tools if JUST tools were changed it would be: doc tools From 74a9f94094086ea39ae02f65b72f7d4dfa43f09d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 10 Dec 2020 17:07:57 -0700 Subject: [PATCH 1678/1973] Update .ChangeLog_template Change the test level so it's worded to say what testing is required, rather than what testing was done. The details give what tests were actually run, the test level gives the general requirements of what testing should be done. --- doc/.ChangeLog_template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 331cbda28b..8883a6729a 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -89,7 +89,7 @@ Optional Tools test level: add this if standard tools were changed: i.e. for regular testing with tools the test level would be: regular tools if JUST tools were changed it would be: doc tools -which says no testing of the source was done, but the tools tests were also done +which says testing of the source was not required, but the tools tests were required ...] [Remove any lines that don't apply.] From 2a9d30314a22b8c6d5803c0d005896e433fe3bbf Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 11 Dec 2020 15:19:04 -0700 Subject: [PATCH 1679/1973] Another iteration of describing testing levels --- doc/.ChangeLog_template | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 8883a6729a..708f64301b 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -70,26 +70,24 @@ Changes to tests or testing: Testing summary: ---------------- -[... Remove before making master tag. Available test levels: +[... Remove before making master tag. -Model test levels one of the next five (one MUST be given): +Nearly all CTSM tags should undergo 'regular' (aux_clm) testing. +However, it occasionally makes sense to do more or less system testing; +here is guidance on different available levels of system testing: a) doc (no source testing required) b) minimal (for use in rare cases where only a small change with known behavior is added ... eg. a minor bug fix. This might be to just run the "short" test list, or to run a single test. Whatever makes sense for the particular case.) - c) fates (Just run the fates test list on normal machines if CTSM source - only relating to fates is modified) - d) regular (regular tests on normal machines if CTSM source is modified) - e) release (regular tests plus the fates, ctsm_sci, aux_glc, mosart and rtm test lists + c) regular (regular tests on normal machines if CTSM source is modified) + d) release (regular tests plus the fates, ctsm_sci, mosart and rtm test lists and normally all of the ancillary tests (build-namelist, python, ptclm, etc.) would be run as well) -Optional Tools test level: add this if standard tools were changed: - f) tools (if tools are modified) - -i.e. for regular testing with tools the test level would be: regular tools -if JUST tools were changed it would be: doc tools -which says testing of the source was not required, but the tools tests were required + +In addition, various other tests of the tools, python and perl +infrastructure should be run when appropriate, as described below. + ...] [Remove any lines that don't apply.] @@ -113,11 +111,13 @@ which says testing of the source was not required, but the tools tests were requ (any machine) - - regular tests (aux_clm): + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): cheyenne ---- izumi ------- + any other testing (give details below): + If the tag used for baseline comparisons was NOT the previous tag, note that here: From 7a3307fee10a68b8d386a567a0fdf4711af511e3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 11 Dec 2020 15:29:46 -0700 Subject: [PATCH 1680/1973] One more addition to ChangeLog template --- doc/.ChangeLog_template | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 708f64301b..1150edaa03 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -75,7 +75,11 @@ Testing summary: Nearly all CTSM tags should undergo 'regular' (aux_clm) testing. However, it occasionally makes sense to do more or less system testing; here is guidance on different available levels of system testing: - a) doc (no source testing required) + a) no system testing (for use when the only changes are ones that + have absolutely no impact on system runs; this + includes documentation-only tags, tags that + just change the tools or some python code that + does not impact system runs, etc.) b) minimal (for use in rare cases where only a small change with known behavior is added ... eg. a minor bug fix. This might be to just run the "short" test list, or to run From b24f4fea90ecb22382b0f5db7908b6ee893af63b Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 14 Dec 2020 14:56:00 -0700 Subject: [PATCH 1681/1973] refactor to remove roundoff differences --- src/biogeochem/CNVegStructUpdateMod.F90 | 3 +++ src/biogeophys/CanopyFluxesMod.F90 | 28 +++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index c94f8b4de2..1049a7ad3f 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -236,6 +236,9 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & if (spinup_state == 2) then stem_biomass(p) = 10._r8 * stem_biomass(p) end if + else + leaf_biomass(p) = 0_r8 + stem_biomass(p) = 0_r8 end if ! Peter Thornton, 5/3/2004 diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index ab19bff11a..a927066f97 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -693,9 +693,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! if using Satellite Phenology mode, use values in parameter file ! otherwise calculate dbh from stem biomass if(use_cn) then - dbh(p) = 2._r8 * sqrt(stem_biomass(p) * (1._r8 - fbw(patch%itype(p))) & - / ( shr_const_pi * htop(p) * k_cyl_vol & - * nstem(patch%itype(p)) * wood_density(patch%itype(p)))) + if(stem_biomass(p) > 0._r8) then + dbh(p) = 2._r8 * sqrt(stem_biomass(p) * (1._r8 - fbw(patch%itype(p))) & + / ( shr_const_pi * htop(p) * k_cyl_vol & + * nstem(patch%itype(p)) * wood_density(patch%itype(p)))) + else + dbh(p) = 0._r8 + endif else dbh(p) = dbh_param(patch%itype(p)) endif @@ -1121,7 +1125,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, canopy_cond(p) = (laisun(p)/(rb(p)+rssun(p)) + laisha(p)/(rb(p)+rssha(p)))/max(elai(p), 0.01_r8) end if - efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p)*(qsatl(p)-qaf(p)) + efpot = forc_rho(c)*((elai(p)+esai(p))/rb(p))*(qsatl(p)-qaf(p)) h2ocan = liqcan(p) + snocan(p) ! When the hydraulic stress parameterization is active calculate rpp @@ -1243,7 +1247,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! result in an imbalance in "hvap*qflx_evap_veg" and ! "efe + dc2*wtgaq*qsatdt_veg" - efpot = forc_rho(c)*(elai(p)+esai(p))/rb(p) & + efpot = forc_rho(c)*((elai(p)+esai(p))/rb(p)) & *(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) qflx_evap_veg(p) = rpp*efpot @@ -1478,18 +1482,20 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & - + emv(p)*emg(c)*sb*(tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & - *(1.-frac_rad_abs_by_stem(p))+ts_ini(p)**3*(ts_ini(p) & - + 4._r8*dt_stem(p))*frac_rad_abs_by_stem(p)) + + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & + *(1.-frac_rad_abs_by_stem(p)) & + + emv(p)*emg(c)*sb*ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p)) & + *frac_rad_abs_by_stem(p) ! Upward longwave radiation above the canopy ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & - *((1.-frac_rad_abs_by_stem(p))*tlbef(p)**3 & - *(tlbef(p) + 4._r8*dt_veg(p)) & - +frac_rad_abs_by_stem(p)*ts_ini(p)**3*(ts_ini(p)+ 4._r8*dt_stem(p))) & + *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1.-frac_rad_abs_by_stem(p)) & + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & + *ts_ini(p)**3*(ts_ini(p)+ 4._r8*dt_stem(p))*frac_rad_abs_by_stem(p) & + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction From a4634b4ae9727e244df13b1ac7642c4eec62b474 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Dec 2020 17:16:55 -0700 Subject: [PATCH 1682/1973] Add a test to make sure fates does not set use_biomass_heat_storage, add some more fates tests --- bld/unit_testers/build-namelist_test.pl | 31 ++++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 1a86b5faf6..61df4288a8 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,9 +138,9 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 1513; +my $ntests = 1550; if ( defined($opts{'compare'}) ) { - $ntests += 1017; + $ntests += 1026; } plan( tests=>$ntests ); @@ -837,6 +837,11 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, + "useFATESWbMH" =>{ options=>"-bgc fates -envxml_dir . -no-megan", + namelst=>"use_biomass_heat_storage=.true.", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_1", + }, "createcropFalse" =>{ options=>"-bgc bgc -envxml_dir . -no-megan", namelst=>"create_crop_landunit=.false.", GLC_TWO_WAY_COUPLING=>"FALSE", @@ -1413,22 +1418,30 @@ sub make_config_cache { &cleanup(); # Run FATES mode for several resolutions and configurations my $clmoptions = "-bgc fates -envxml_dir . -no-megan"; - my @clmres = ( "1x1_brazil", "5x5_amazon", "10x15", "1.9x2.5" ); + my @clmres = ( "1x1_brazil", "5x5_amazon", "4x5", "1.9x2.5" ); foreach my $res ( @clmres ) { - $options = "-res $res"; - my @edoptions = ( "-use_case 2000_control", "", "-namelist \"&a use_lch4=.true.,use_nitrif_denitrif=.true./\"", "-clm_accelerated_spinup on" ); + $options = "-res $res -clm_start_type cold"; + my @edoptions = ( "-use_case 2000_control", + "-use_case 1850_control", + "", + "-namelist \"&a use_lch4=.true.,use_nitrif_denitrif=.true./\"", + "-clm_accelerated_spinup on" + ); foreach my $edop (@edoptions ) { + if ( $res eq "5x5_amazon" && ($edop =~ /1850_control/) ) { + next; + } &make_env_run( ); eval{ system( "$bldnml $options $clmoptions $edop > $tempfile 2>&1 " ); }; is( $@, '', "$options $edop" ); - $cfiles->checkfilesexist( "$options $edop", $mode ); + $cfiles->checkfilesexist( "$options $clmoptions $edop", $mode ); $cfiles->shownmldiff( "default", "standard" ); if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options $edop", $mode ); - $cfiles->comparefiles( "$options $edop", $mode, $opts{'compare'} ); + $cfiles->doNOTdodiffonfile( "$tempfile", "$options $clmoptions $edop", $mode ); + $cfiles->comparefiles( "$options $clmoptions $edop", $mode, $opts{'compare'} ); } if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options $edop", $mode ); + $cfiles->copyfiles( "$options $clmoptions $edop", $mode ); } &cleanup(); } From bcea798a0d0a2ab19230aa6c6add3fa4e2d3670d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Dec 2020 17:17:52 -0700 Subject: [PATCH 1683/1973] Bring in a paramsfile that has the biomass heat storage terms on it for clm5_1, also turn it off when fates is on --- bld/namelist_files/namelist_defaults_ctsm.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 523ac2c1f9..3fbed6e3a2 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -311,8 +311,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .true. -.true. -.false. +.true. +.false. +.false. 40 3 @@ -472,7 +473,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c200905.nc +lnd/clm2/paramdata/ctsm51_params.c201215.nc lnd/clm2/paramdata/clm50_params.c200905.nc lnd/clm2/paramdata/clm45_params.c200905.nc From 08ddb0336c3e0102aafde479858632bc1bf92b71 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Dec 2020 17:18:20 -0700 Subject: [PATCH 1684/1973] Send use_fates when setting default for biomass heat storage --- bld/CLMBuildNamelist.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 46a8591b3b..50196698ec 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3675,7 +3675,8 @@ sub setup_logic_canopyfluxes { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_undercanopy_stability' ); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'itmax_canopy_fluxes', 'structure'=>$nl_flags->{'structure'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_biomass_heat_storage'); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_biomass_heat_storage', + 'use_fates'=>$nl_flags->{'use_fates'}, 'phys'=>$nl_flags->{'phys'} ); } #------------------------------------------------------------------------------- From 8aeb64db891b4bced2894b1f0e87bb65c610ec61 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Dec 2020 18:25:16 -0700 Subject: [PATCH 1685/1973] Correct compare number of tests --- bld/unit_testers/build-namelist_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 61df4288a8..24c7a0add3 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -140,7 +140,7 @@ sub make_config_cache { # my $ntests = 1550; if ( defined($opts{'compare'}) ) { - $ntests += 1026; + $ntests += 1044; } plan( tests=>$ntests ); From 1eec345bf85802f523df0bd50dc50b9f89f91572 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 15 Dec 2020 18:25:53 -0700 Subject: [PATCH 1686/1973] Make sure use_biomass_heat_storage is NOT on when fates is --- bld/CLMBuildNamelist.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 50196698ec..3326c4b105 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3677,6 +3677,9 @@ sub setup_logic_canopyfluxes { 'structure'=>$nl_flags->{'structure'}); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_biomass_heat_storage', 'use_fates'=>$nl_flags->{'use_fates'}, 'phys'=>$nl_flags->{'phys'} ); + if ( &value_is_true($nl->get_value('use_biomass_heat_storage') ) && &value_is_true( $nl_flags->{'use_fates'}) ) { + $log->fatal_error('use_biomass_heat_storage can NOT be set to true when fates is on'); + } } #------------------------------------------------------------------------------- From 85c37e458baef25b3aa7aa3bc8e4afe2987066cd Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 16 Dec 2020 10:14:07 -0700 Subject: [PATCH 1687/1973] performance udpates --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 36 +- src/cpl/nuopc/lnd_import_export.F90 | 1141 +++++++++++++++------------ 2 files changed, 636 insertions(+), 541 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index af4f1c64bf..30c1c97d61 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -70,6 +70,7 @@ module lnd_comp_nuopc logical :: glc_present logical :: rof_prognostic + logical :: atm_prognostic integer, parameter :: dbug = 0 character(*),parameter :: modName = "(lnd_comp_nuopc)" character(*),parameter :: u_FILE_u = & @@ -290,6 +291,14 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) rof_prognostic = .true. end if + call NUOPC_CompAttributeGet(gcomp, name='ATM_model', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (trim(cvalue) == 'satm' .or. trim(cvalue) == 'datm') then + atm_prognostic = .false. + else + atm_prognostic = .true. + end if + call NUOPC_CompAttributeGet(gcomp, name='GLC_model', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (trim(cvalue) == 'sglc') then @@ -312,14 +321,15 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_sys_abort(subname//'Need to set cism_evolve if glc is present') endif end if - + if (masterproc) then + write(iulog,*)' atm_prognostic = ',atm_prognostic write(iulog,*)' rof_prognostic = ',rof_prognostic write(iulog,*)' glc_present = ',glc_present if (glc_present) write(iulog,*)' cism_evolve = ',cism_evolve end if - call advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, rc) + call advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, atm_prognostic, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !---------------------------------------------------------------------------- @@ -328,10 +338,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_file_setLogUnit (shrlogunit) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) + end subroutine InitializeAdvertise !=============================================================================== - subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) use clm_instMod, only : lnd2atm_inst, lnd2glc_inst, water_inst @@ -885,27 +895,22 @@ subroutine ModelAdvance(gcomp, rc) ! Determine time of next atmospheric shortwave calculation !-------------------------------- + call t_startf(trim(subname)//' nextsw_cday') call State_GetScalar(importState, & flds_scalar_index_nextsw_cday, nextsw_cday, & flds_scalar_name, flds_scalar_num, rc) call set_nextsw_cday( nextsw_cday ) - - !---------------------- - ! Get orbital values - !---------------------- - + call t_stopf(trim(subname)//' nextsw_cday') !-------------------------------- ! Unpack import state !-------------------------------- call t_startf ('lc_lnd_import') - call get_proc_bounds(bounds) call import_fields( gcomp, bounds, glc_present, rof_prognostic, & atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf ('lc_lnd_import') !-------------------------------- @@ -974,32 +979,27 @@ subroutine ModelAdvance(gcomp, rc) ! Run CTSM !-------------------------------- - call t_barrierf('sync_ctsm_run1', mpicom) + ! call ESMF_VMBarrier(vm, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return call t_startf ('shr_orb_decl') - ! Note - the orbital inquiries set the values in clm_varorb via the module use statements call clm_orbital_update(clock, iulog, masterproc, eccen, obliqr, lambm0, mvelpp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - calday = get_curr_calday() call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) call t_stopf ('shr_orb_decl') call t_startf ('ctsm_run') - ! Restart File - use nexttimestr rather than currtimestr here since that is the time at the end of ! the timestep and is preferred for restart file names - call ESMF_ClockGetNextTime(clock, nextTime=nextTime, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_TimeGet(nexttime, yy=yr_sync, mm=mon_sync, dd=day_sync, s=tod_sync, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync, mon_sync, day_sync, tod_sync - call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) - call t_stopf ('ctsm_run') !-------------------------------- @@ -1007,11 +1007,9 @@ subroutine ModelAdvance(gcomp, rc) !-------------------------------- call t_startf ('lc_lnd_export') - call export_fields(gcomp, bounds, glc_present, rof_prognostic, & water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call t_stopf ('lc_lnd_export') !-------------------------------- diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 346e4f6e7f..a705060911 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -36,9 +36,8 @@ module lnd_import_export private :: fldlist_add private :: fldlist_realize - private :: state_getimport - private :: state_setexport private :: state_getfldptr + private :: fldchk type fld_list_type character(len=128) :: stdname @@ -51,7 +50,6 @@ module lnd_import_export integer :: fldsFrLnd_num = 0 type (fld_list_type) :: fldsToLnd(fldsMax) type (fld_list_type) :: fldsFrLnd(fldsMax) - integer, parameter :: gridTofieldMap = 2 ! ungridded dimension is innermost ! from atm->lnd integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn @@ -76,7 +74,7 @@ module lnd_import_export contains !=============================================================================== - subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, rc) + subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, atm_prognostic, rc) use clm_varctl, only : ndep_from_cpl @@ -86,6 +84,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r logical , intent(in) :: glc_present logical , intent(in) :: cism_evolve logical , intent(in) :: rof_prognostic + logical , intent(in) :: atm_prognostic integer , intent(out) :: rc ! local variables @@ -137,22 +136,66 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r !-------------------------------- call fldlist_add(fldsFrLnd_num, fldsFrlnd, trim(flds_scalar_name)) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_lfrin') + + ! export to atm + if (atm_prognostic) then + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_t' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_tref' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_qref' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdr' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidr' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdf' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidf' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_snowh' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_u10' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_fv' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_ram1' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_taux' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_tauy' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lat' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_sen' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lwup' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_evap' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_swnet' ) + ! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_methane' ) + + ! dust fluxes from land (4 sizes) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_flxdst', ungridded_lbound=1, ungridded_ubound=4) + + ! co2 fields from land + if (flds_co2b .or. flds_co2c) then + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_fco2_lnd' ) + end if + + ! Dry Deposition velocities from land - ALSO initialize drydep here + call seq_drydep_readnl("drv_flds_in", drydep_nflds) + if (drydep_nflds > 0) then + call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_ddvel', ungridded_lbound=1, ungridded_ubound=drydep_nflds) + end if - ! export land states - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_lfrin' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_t' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_tref' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_qref' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdr' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidr' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdf' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidf' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_snowh' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_u10' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_fv' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_ram1' ) - - ! export fluxes to river + ! MEGAN VOC emissions fluxes from land + call shr_megan_readnl('drv_flds_in', megan_nflds) + if (shr_megan_mechcomps_n .ne. megan_nflds) call shr_sys_abort('ERROR: megan field count mismatch') + if (shr_megan_mechcomps_n > 0) then + call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_voc', ungridded_lbound=1, ungridded_ubound=megan_nflds) + end if + + ! Fire emissions fluxes from land + call shr_fire_emis_readnl('drv_flds_in', emis_nflds) + if (emis_nflds > 0) then + call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_fire', ungridded_lbound=1, ungridded_ubound=emis_nflds) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_fztop') + end if + ! CARMA volumetric soil water from land + ! TODO: is the following correct - the CARMA field exchange is very confusing in mct + call shr_carma_readnl('drv_flds_in', carma_fields) + if (carma_fields /= ' ') then + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_soilw') ! optional for carma + end if + end if + + ! export to rof if (rof_prognostic) then call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofsur' ) call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofgwl' ) @@ -161,51 +204,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_irrig' ) end if - ! export fluxes to atm - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_taux' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_tauy' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lat' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_sen' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lwup' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_evap' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_swnet' ) - - ! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_methane' ) - - ! dust fluxes from land (4 sizes) - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_flxdst', ungridded_lbound=1, ungridded_ubound=4) - - ! co2 fields from land - if (flds_co2b .or. flds_co2c) then - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_fco2_lnd' ) - end if - - ! Dry Deposition velocities from land - ALSO initialize drydep here - call seq_drydep_readnl("drv_flds_in", drydep_nflds) - if (drydep_nflds > 0) then - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_ddvel', ungridded_lbound=1, ungridded_ubound=drydep_nflds) - end if - - ! MEGAN VOC emissions fluxes from land - call shr_megan_readnl('drv_flds_in', megan_nflds) - if (shr_megan_mechcomps_n .ne. megan_nflds) call shr_sys_abort('ERROR: megan field count mismatch') - if (shr_megan_mechcomps_n > 0) then - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_voc', ungridded_lbound=1, ungridded_ubound=megan_nflds) - end if - - ! Fire emissions fluxes from land - call shr_fire_emis_readnl('drv_flds_in', emis_nflds) - if (emis_nflds > 0) then - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_fire', ungridded_lbound=1, ungridded_ubound=emis_nflds) - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_fztop') - end if - ! CARMA volumetric soil water from land - ! TODO: is the following correct - the CARMA field exchange is very confusing in mct - call shr_carma_readnl('drv_flds_in', carma_fields) - if (carma_fields /= ' ') then - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_soilw') ! optional for carma - end if - + ! export to glc if (glc_present .and. cism_evolve) then ! lnd->glc states from land all lnd->glc elevation classes (1:glc_nec) plus bare land (index 0). ! The following puts all of the elevation class fields as an @@ -310,7 +309,6 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r end subroutine advertise_fields !=============================================================================== - subroutine realize_fields(gcomp, Emesh, flds_scalar_name, flds_scalar_num, rc) ! input/output variables @@ -354,7 +352,6 @@ subroutine realize_fields(gcomp, Emesh, flds_scalar_name, flds_scalar_num, rc) end subroutine realize_fields !=============================================================================== - subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & atm2lnd_inst, glc2lnd_inst, wateratm2lndbulk_inst, rc) @@ -382,10 +379,12 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & type(ESMF_State) :: importState type(ESMF_StateItem_Flag) :: itemFlag real(r8), pointer :: dataPtr(:) + real(r8), pointer :: fldPtr1d(:) + real(r8), pointer :: fldPtr2d(:,:) character(len=128) :: fldname integer :: num integer :: begg, endg ! bounds - integer :: g,i,k ! indices + integer :: g,i,k,n ! indices real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) real(r8) :: co2_ppmv_input(bounds%begg:bounds%endg) ! temporary @@ -424,126 +423,205 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! Required atmosphere input fields !-------------------------- - call state_getimport(importState, 'Sa_z', bounds, output=atm2lnd_inst%forc_hgt_grc, rc=rc) + call state_getfldptr(importState, 'Sa_z', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_z', begg) + do g = begg, endg + atm2lnd_inst%forc_hgt_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Sa_topo', bounds, output=atm2lnd_inst%forc_topo_grc, rc=rc) + call state_getfldptr(importState, 'Sa_topo', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_topo', begg) + do g = begg, endg + atm2lnd_inst%forc_topo_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Sa_u', bounds, output=atm2lnd_inst%forc_u_grc, rc=rc ) + call state_getfldptr(importState, 'Sa_u', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_u', begg) + do g = begg, endg + atm2lnd_inst%forc_u_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Sa_v', bounds, output=atm2lnd_inst%forc_v_grc, rc=rc ) + call state_getfldptr(importState, 'Sa_v', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_v', begg) + do g = begg, endg + atm2lnd_inst%forc_v_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Sa_ptem', bounds, output=atm2lnd_inst%forc_th_not_downscaled_grc, rc=rc) + call state_getfldptr(importState, 'Sa_ptem', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_ptem', begg) + do g = begg, endg + atm2lnd_inst%forc_th_not_downscaled_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Sa_shum', bounds, output=wateratm2lndbulk_inst%forc_q_not_downscaled_grc, rc=rc) + call state_getfldptr(importState, 'Sa_shum', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_shum', begg) + do g = begg, endg + wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Sa_pbot', bounds, output=atm2lnd_inst%forc_pbot_not_downscaled_grc, rc=rc) + call state_getfldptr(importState, 'Sa_pbot', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_pbot', begg) + do g = begg, endg + atm2lnd_inst%forc_pbot_not_downscaled_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Sa_tbot', bounds, output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) + call state_getfldptr(importState, 'Sa_tbot', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_tbot', begg) + do g = begg, endg + atm2lnd_inst%forc_t_not_downscaled_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_rainc', bounds, output=forc_rainc, rc=rc ) + call state_getfldptr(importState, 'Faxa_rainc', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Faxa_rainc', begg) + do g = begg, endg + forc_rainc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_rainl', bounds, output=forc_rainl, rc=rc ) + call state_getfldptr(importState, 'Faxa_rainl', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Faxa_rainl', begg) + do g = begg, endg + forc_rainl(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_snowc', bounds, output=forc_snowc, rc=rc ) + call state_getfldptr(importState, 'Faxa_snowc', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Faxa_snowc', begg) + do g = begg, endg + forc_snowc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_snowl', bounds, output=forc_snowl, rc=rc ) + call state_getfldptr(importState, 'Faxa_snowl', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Faxa_snowl', begg) + do g = begg, endg + forc_snowl(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_lwdn', bounds, output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getfldptr(importState, 'Faxa_lwdn', fldptr1d, rc=rc) + call check_for_nans(fldptr1d, 'Faxa_lwdn', begg) + do g = begg, endg + atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_swvdr', bounds, output=atm2lnd_inst%forc_solad_grc(:,1), rc=rc) + call state_getfldptr(importState, 'Faxa_swvdr', fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Faxa_swvdr', begg) + do g = begg, endg + atm2lnd_inst%forc_solad_grc(g,1) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_swndr', bounds, output=atm2lnd_inst%forc_solad_grc(:,2), rc=rc) + call state_getfldptr(importState, 'Faxa_swndr', fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Faxa_swndr', begg) + do g = begg, endg + atm2lnd_inst%forc_solad_grc(g,2) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_swvdf', bounds, output=atm2lnd_inst%forc_solai_grc(:,1), rc=rc ) + call state_getfldptr(importState, 'Faxa_swvdf', fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Faxa_swvdf', begg) + do g = begg, endg + atm2lnd_inst%forc_solai_grc(g,1) = fldptr1d(g-begg+1) + end do - call state_getimport(importState, 'Faxa_swndf', bounds, output=atm2lnd_inst%forc_solai_grc(:,2), rc=rc ) + call state_getfldptr(importState, 'Faxa_swndf', fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Faxa_swndf', begg) + do g = begg, endg + atm2lnd_inst%forc_solai_grc(g,2) = fldptr1d(g-begg+1) + end do ! Atmosphere prognostic/prescribed aerosol fields + if (fldchk(importState, 'Faxa_bcph')) then + write(6,*)'i am here' + call state_getfldptr(importState, 'Faxa_bcph', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr2d(1,:), 'Faxa_bcph(1)', begg) + call check_for_nans(fldptr2d(2,:), 'Faxa_bcph(2)', begg) + call check_for_nans(fldptr2d(3,:), 'Faxa_bcph(3)', begg) + do g = begg, endg + n = g - begg + 1 + atm2lnd_inst%forc_aer_grc(g,1) = fldptr2d(1,n) ! bcphidry + atm2lnd_inst%forc_aer_grc(g,2) = fldptr2d(2,n) ! bcphodry + atm2lnd_inst%forc_aer_grc(g,3) = fldptr2d(3,n) ! bcphiwet + end do + end if + if (fldchk(importState, 'Faxa_ocph')) then + call state_getfldptr(importState, 'Faxa_ocph', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr2d(1,:), 'Faxa_ocph(1)', begg) + call check_for_nans(fldptr2d(2,:), 'Faxa_ocph(2)', begg) + call check_for_nans(fldptr2d(3,:), 'Faxa_ocph(3)', begg) + do g = begg, endg + n = g - begg + 1 + atm2lnd_inst%forc_aer_grc(g,4) = fldptr2d(1,n) ! ocphidry + atm2lnd_inst%forc_aer_grc(g,5) = fldptr2d(2,n) ! ocphodry + atm2lnd_inst%forc_aer_grc(g,6) = fldptr2d(3,n) ! ocphiwet + end do + end if - ! bcphidry - call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,1), & - ungridded_index=1, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! bcphodry - call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,2), & - ungridded_index=2, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! bcphiwet - call state_getimport(importState, 'Faxa_bcph', bounds, output=atm2lnd_inst%forc_aer_grc(:,3), & - ungridded_index=3, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! ocphidry - call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,4), & - ungridded_index=1, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ocphodry - call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,5), & - ungridded_index=2, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! ocphiwet - call state_getimport(importState, 'Faxa_ocph', bounds, output=atm2lnd_inst%forc_aer_grc(:,6), & - ungridded_index=3, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,7), & - ungridded_index=1, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,8), & - ungridded_index=1, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,9), & - ungridded_index=2, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,10), & - ungridded_index=2, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,11), & - ungridded_index=3, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,12), & - ungridded_index=3, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'Faxa_dstwet', bounds, output=atm2lnd_inst%forc_aer_grc(:,13), & - ungridded_index=4, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_dstdry', bounds, output=atm2lnd_inst%forc_aer_grc(:,14), & - ungridded_index=4, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (fldchk(importState, 'Faxa_dstwet')) then + call state_getfldptr(importState, 'Faxa_dstwet', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr2d(1,:), 'Faxa_dstwet(1)', begg) + call check_for_nans(fldptr2d(2,:), 'Faxa_dstwet(2)', begg) + call check_for_nans(fldptr2d(3,:), 'Faxa_dstwet(3)', begg) + call check_for_nans(fldptr2d(4,:), 'Faxa_dstwet(4)', begg) + do g = begg, endg + n = g - begg + 1 + atm2lnd_inst%forc_aer_grc(g,7) = fldptr2d(1,n) + atm2lnd_inst%forc_aer_grc(g,9) = fldptr2d(2,n) + atm2lnd_inst%forc_aer_grc(g,11) = fldptr2d(3,n) + atm2lnd_inst%forc_aer_grc(g,13) = fldptr2d(4,n) + end do + end if + if (fldchk(importState, 'Faxa_dstdry')) then + call state_getfldptr(importState, 'Faxa_dstdry', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr2d(1,:), 'Faxa_dstdry(1)', begg) + call check_for_nans(fldptr2d(2,:), 'Faxa_dstdry(2)', begg) + call check_for_nans(fldptr2d(3,:), 'Faxa_dstdry(3)', begg) + call check_for_nans(fldptr2d(4,:), 'Faxa_dstdry(4)', begg) + do g = begg, endg + n = g - begg + 1 + atm2lnd_inst%forc_aer_grc(g,8) = fldptr2d(1,n) + atm2lnd_inst%forc_aer_grc(g,10) = fldptr2d(2,n) + atm2lnd_inst%forc_aer_grc(g,12) = fldptr2d(3,n) + atm2lnd_inst%forc_aer_grc(g,14) = fldptr2d(4,n) + end do + end if - ! The mediator is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec - ! so the following conversion needs to happen + if (fldchk(importState, 'Sa_methane')) then + call state_getfldptr(importState, 'Sa_methane', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr1d, 'Sa_methane', begg) + do g = begg, endg + atm2lnd_inst%forc_pch4_grc(g) = fldptr1d(g-begg+1) + end do + end if - call state_getimport(importState, 'Faxa_ndep', bounds, output=forc_nhx, ungridded_index=1, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Faxa_ndep', bounds, output=forc_noy, ungridded_index=2, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg,endg - atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 - end do + if (fldchk(importState, 'Faxa_ndep')) then + ! The mediator is sending ndep in units if kgN/m2/s - and ctsm + ! uses units of gN/m2/sec so the following conversion needs to happen + call state_getfldptr(importState, 'Faxa_ndep', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call check_for_nans(fldptr2d(1,:), 'Faxa_ndep(1)', begg) + call check_for_nans(fldptr2d(2,:), 'Faxa_ndep(2)', begg) + do g = begg, endg + n = g - begg + 1 + atm2lnd_inst%forc_ndep_grc(g) = (fldptr2d(1,n) + fldptr2d(2,n))*1000._r8 + end do + end if !-------------------------- ! Atmosphere co2 @@ -601,26 +679,30 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! so water sent from rof to land is negative, ! change the sign to indicate addition of water to system. - if (rof_prognostic) then - call state_getimport(importState, 'Flrr_flood', bounds, output=wateratm2lndbulk_inst%forc_flood_grc, rc=rc ) + if (fldchk(importState, 'Flrr_flood')) then + call state_getfldptr(importState, 'Flrr_flood', fldptr1d=fldptr1d, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - wateratm2lndbulk_inst%forc_flood_grc(:) = -wateratm2lndbulk_inst%forc_flood_grc(:) + do g = begg, endg + wateratm2lndbulk_inst%forc_flood_grc(g) = -fldptr1d(g-begg+1) + end do else wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 end if - - if (rof_prognostic) then - call state_getimport(importState, 'Flrr_volr', bounds, output=wateratm2lndbulk_inst%volr_grc, rc=rc ) + if (fldchk(importState, 'Flrr_volr')) then + call state_getfldptr(importState, 'Flrr_flood', fldptr1d=fldptr1d, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - wateratm2lndbulk_inst%volr_grc(:) = wateratm2lndbulk_inst%volr_grc(:) * (ldomain%area(:) * 1.e6_r8) + do g = begg, endg + wateratm2lndbulk_inst%forc_flood_grc(g) = fldptr1d(g-begg+1) * (ldomain%area(g) * 1.e6_r8) + end do else wateratm2lndbulk_inst%volr_grc(:) = 0._r8 end if - - if (rof_prognostic) then - call state_getimport(importState, 'Flrr_volrmch', bounds, output=wateratm2lndbulk_inst%volrmch_grc, rc=rc ) + if (fldchk(importState, 'Flrr_volrmch')) then + call state_getfldptr(importState, 'Flrr_volrmch', fldptr1d=fldptr1d, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - wateratm2lndbulk_inst%volrmch_grc(:) = wateratm2lndbulk_inst%volrmch_grc(:) * (ldomain%area(:) * 1.e6_r8) + do g = begg, endg + wateratm2lndbulk_inst%volrmch_grc(g) = fldptr1d(g-begg+1) * (ldomain%area(g) * 1.e6_r8) + end do else wateratm2lndbulk_inst%volrmch_grc(:) = 0._r8 end if @@ -634,19 +716,49 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! help with performance. (The downside would be that we wouldn't have these fields ! available for diagnostic purposes or to force a later T compset with dlnd.) - do num = 0,glc_nec - call state_getimport(importState, 'Sg_ice_covered_elev', bounds, frac_grc(:,num), ungridded_index=num+1, rc=rc) + if ( fldchk(importState, 'Sg_ice_covered_elev')) then + call state_getfldptr(importState, 'Sg_ice_covered_elev', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg, endg + do num = 0,glc_nec + frac_grc(g,num) = fldptr2d(num+1,g-begg+1) + end do + end do + end if + if ( fldchk(importState, 'Sl_topo_elev')) then + call state_getfldptr(importState, 'Sg_topo_elev', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg, endg + do num = 0,glc_nec + topo_grc(g,num) = fldptr2d(num+1,g-begg+1) + end do + end do + end if + if ( fldchk(importState, 'Sl_topo_elev')) then + call state_getfldptr(importState, 'Flgg_hflx_elev', fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sg_topo_elev' , bounds, topo_grc(:,num), ungridded_index=num+1, rc=rc) + do g = begg, endg + do num = 0,glc_nec + hflx_grc(g,num) = fldptr2d(num+1,g-begg+1) + end do + end do + else + hflx_grc(:,:) = 0._r8 + end if + if ( fldchk(importState, 'Sg_icemask')) then + call state_getfldptr(importState, 'Sg_icemask', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Flgg_hflx_elev' , bounds, hflx_grc(:,num), ungridded_index=num+1, rc=rc) + do g = begg, endg + icemask_grc(g) = fldptr1d(g-begg+1) + end do + end if + if ( fldchk(importState, 'Sg_icemask_coupled_fluxes')) then + call state_getfldptr(importState, 'Sg_icemask', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - call state_getimport(importState, 'Sg_icemask' , bounds, icemask_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'Sg_icemask_coupled_fluxes', bounds, icemask_coupled_fluxes_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - + do g = begg, endg + icemask_coupled_fluxes_grc(g) = fldptr1d(g-begg+1) + end do + end if call glc2lnd_inst%set_glc2lnd_fields_nuopc( bounds, glc_present, & frac_grc, topo_grc, hflx_grc, icemask_grc, icemask_coupled_fluxes_grc ) end if @@ -664,7 +776,6 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end subroutine import_fields !=============================================================================== - subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) @@ -685,9 +796,12 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & integer , intent(out) :: rc ! local variables - type(ESMF_State) :: exportState - integer :: i, g, num - real(r8) :: array(bounds%begg:bounds%endg) + type(ESMF_State) :: exportState + real(r8), pointer :: fldPtr1d(:) + real(r8), pointer :: fldPtr2d(:,:) + integer :: begg, endg ! bounds + integer :: i, g, num + real(r8) :: array(bounds%begg:bounds%endg) character(len=*), parameter :: subname='(lnd_import_export:export_fields)' !--------------------------------------------------------------------------- @@ -697,121 +811,246 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & call NUOPC_ModelGet(gcomp, exportState=exportState, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Set bounds + begg = bounds%begg + endg = bounds%endg + ! ----------------------- ! output to mediator ! ----------------------- - - call state_setexport(exportState, 'Sl_lfrin', bounds, input=ldomain%frac, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (fldchk(exportState, 'Sl_lfrin')) then + call state_getfldptr(exportState, 'Sl_lfrin', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = ldomain%frac(g) + end do + end if ! ----------------------- ! output to atm ! ----------------------- - - call state_setexport(exportState, 'Sl_t', bounds, input=lnd2atm_inst%t_rad_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_snowh', bounds, input=waterlnd2atmbulk_inst%h2osno_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_avsdr', bounds, input=lnd2atm_inst%albd_grc(bounds%begg:,1), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_anidr', bounds, input=lnd2atm_inst%albd_grc(bounds%begg:,2), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_avsdf', bounds, input=lnd2atm_inst%albi_grc(bounds%begg:,1), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_anidf', bounds, input=lnd2atm_inst%albi_grc(bounds%begg:,2), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_tref', bounds, input=lnd2atm_inst%t_ref2m_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_qref', bounds, input=waterlnd2atmbulk_inst%q_ref2m_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_u10', bounds, input=lnd2atm_inst%u_ref10m_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_taux', bounds, input=lnd2atm_inst%taux_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_tauy', bounds, input=lnd2atm_inst%tauy_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_lat', bounds, input=lnd2atm_inst%eflx_lh_tot_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_sen', bounds, input=lnd2atm_inst%eflx_sh_tot_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_lwup', bounds, input=lnd2atm_inst%eflx_lwrad_out_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_evap', bounds, input=waterlnd2atmbulk_inst%qflx_evap_tot_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_swnet', bounds, input=lnd2atm_inst%fsa_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,1), & - minus=.true., ungridded_index=1, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,2), & - minus=.true., ungridded_index=2, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,3), & - minus=.true., ungridded_index=3, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Fall_flxdst', bounds, input=lnd2atm_inst%flxdst_grc(:,4), & - minus=.true., ungridded_index=4, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Fall_methane', bounds, input=lnd2atm_inst%ch4_surf_flux_tot_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_ram1', bounds, input=lnd2atm_inst%ram1_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_fv', bounds, input=lnd2atm_inst%fv_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'Sl_soilw', bounds, & - input=waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! co2 from land - if (flds_co2b .or. flds_co2c) then - call state_setexport(exportState, 'Fall_fco2_lnd', bounds, lnd2atm_inst%net_carbon_exchange_grc, minus=.true., rc=rc) + if (fldchk(exportState, 'Sl_t')) then + call state_getfldptr(exportState, 'Sl_t', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%t_rad_grc(g) + end do end if - - ! dry dep velocities - do num = 1, drydep_nflds - call state_setexport(exportState, 'Sl_ddvel', bounds, input=lnd2atm_inst%ddvel_grc(:,num), & - ungridded_index=num, rc=rc) + if (fldchk(exportState, 'Sl_snowh')) then + call state_getfldptr(exportState, 'Sl_snowh', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - - ! MEGAN VOC emis fluxes - do num = 1, shr_megan_mechcomps_n - call state_setexport(exportState, 'Fall_voc', bounds, input=lnd2atm_inst%flxvoc_grc(:,num), minus=.true., & - ungridded_index=num, rc=rc) + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%h2osno_grc(g) + end do + end if + if (fldchk(exportState, 'Sl_avsdr')) then + call state_getfldptr(exportState, 'Sl_avsdr', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do - - ! fire emis fluxes - if (emis_nflds > 0) then - do num = 1, emis_nflds - call state_setexport(exportState, 'Fall_fire', bounds, input=lnd2atm_inst%fireflx_grc(:,num), minus=.true., & - ungridded_index=num, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%albd_grc(g,1) + end do + end if + if (fldchk(exportState, 'Sl_anidr')) then + call state_getfldptr(exportState, 'Sl_anidr', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%albd_grc(g,2) + end do + end if + if (fldchk(exportState, 'Sl_avsdf')) then + call state_getfldptr(exportState, 'Sl_avsdf', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%albi_grc(g,1) + end do + end if + if (fldchk(exportState, 'Sl_anidf')) then + call state_getfldptr(exportState, 'Sl_anidf', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%albi_grc(g,2) end do - call state_setexport(exportState, 'Sl_fztop', bounds, input=lnd2atm_inst%fireztop_grc, rc=rc) + end if + if (fldchk(exportState, 'Sl_tref')) then + call state_getfldptr(exportState, 'Sl_tref', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%t_ref2m_grc(g) + end do + end if + if (fldchk(exportState, 'Sl_qref')) then + call state_getfldptr(exportState, 'Sl_qref', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%q_ref2m_grc(g) + end do + end if + if (fldchk(exportState, 'Fall_taux')) then + call state_getfldptr(exportState, 'Fall_taux', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -lnd2atm_inst%taux_grc(g) + end do + end if + if (fldchk(exportState, 'Fall_tauy')) then + call state_getfldptr(exportState, 'Fall_tauy', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -lnd2atm_inst%tauy_grc(g) + end do + end if + if (fldchk(exportState, 'Fall_lat')) then + call state_getfldptr(exportState, 'Fall_lat', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_lh_tot_grc(g) + end do + end if + if (fldchk(exportState, 'Fall_sen')) then + call state_getfldptr(exportState, 'Fall_sen', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_sh_tot_grc(g) + end do + end if + if (fldchk(exportState, 'Fall_lwup')) then + call state_getfldptr(exportState, 'Fall_lwup', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_lwrad_out_grc(g) + end do + end if + if (fldchk(exportState, 'Fall_evap')) then + call state_getfldptr(exportState, 'Fall_evap', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -waterlnd2atmbulk_inst%qflx_evap_tot_grc(g) + end do + end if + if (fldchk(exportState, 'Fall_swnet')) then + call state_getfldptr(exportState, 'Fall_swnet', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%fsa_grc(g) + end do + end if + if (fldchk(exportState, 'Fall_flxdst')) then + call state_getfldptr(exportState, 'Fall_flxdst', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0._r8 + do g = begg, endg + fldptr2d(1,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,1) + fldptr2d(2,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,2) + fldptr2d(3,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,3) + fldptr2d(4,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,4) + end do + end if + if (fldchk(exportState, 'Fall_methane')) then + call state_getfldptr(exportState, 'Fall_methane', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -lnd2atm_inst%ch4_surf_flux_tot_grc(g) + end do + end if + if (fldchk(exportState, 'Sl_u10')) then + call state_getfldptr(exportState, 'Sl_u10', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%u_ref10m_grc(g) + end do + end if + if (fldchk(exportState, 'Sl_ram1')) then + call state_getfldptr(exportState, 'Sl_ram1', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%ram1_grc(g) + end do + end if + if (fldchk(exportState, 'Sl_fv')) then + call state_getfldptr(exportState, 'Sl_fv', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%fv_grc(g) + end do + end if + if (fldchk(exportState, 'Sl_soilw')) then + call state_getfldptr(exportState, 'Sl_soilw', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg, endg + fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%h2osoi_vol_grc(g,1) + end do + end if + if (flds_co2b .or. flds_co2c) then + ! co2 from land + call state_getfldptr(exportState, 'Fall_fco2_lnd', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -lnd2atm_inst%net_carbon_exchange_grc(g) + end do + end if + if (fldchk(exportState, 'Sl_ddvel')) then + ! dry dep velocities + call state_getfldptr(exportState, 'Sl_ddvel', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0._r8 + do g = begg, endg + do num = 1, drydep_nflds + fldptr2d(num,g-begg+1) = lnd2atm_inst%ddvel_grc(g,num) + end do + end do + end if + if (fldchk(exportState, 'Fall_voc')) then + ! megan voc emis fluxes + call state_getfldptr(exportState, 'Fall_voc', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0._r8 + do g = begg, endg + do num = 1, shr_megan_mechcomps_n + fldptr2d(num,g-begg+1) = -lnd2atm_inst%flxvoc_grc(g,num) + end do + end do + end if + if (fldchk(exportState, 'Fall_fire')) then + if (emis_nflds > 0) then + ! fire emis fluxes + call state_getfldptr(exportState, 'Fall_fire', fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0._r8 + do g = begg, endg + do num = 1, emis_nflds + fldptr2d(num,g-begg+1) = -lnd2atm_inst%fireflx_grc(g,num) + end do + end do + call state_getfldptr(exportState, 'Sl_fztop', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%fireztop_grc(g) + end do + end if endif + ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. ! i.e. water sent from land to rof is positive @@ -820,55 +1059,96 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! ----------------------- ! surface runoff is the sum of qflx_over, qflx_h2osfc_surf - ! do g = bounds%begg,bounds%endg - ! array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) - ! end do - call state_setexport(exportState, 'Flrl_rofsur', bounds, input=waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - do g = bounds%begg,bounds%endg - array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) - end do - call state_setexport(exportState, 'Flrl_rofsub', bounds, input=array, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! qgwl sent individually to coupler - call state_setexport(exportState, 'Flrl_rofgwl', bounds, input=waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! ice sent individually to coupler - call state_setexport(exportState, 'Flrl_rofi', bounds, input=waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! irrigation flux to be removed from main channel storage (negative) - call state_setexport(exportState, 'Flrl_irrig', bounds, input=waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! do g = bounds%begg,bounds%endg + ! array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + & + ! waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) + ! end do + if (fldchk(exportState, 'Flrl_rofsur')) then + call state_getfldptr(exportState, 'Flrl_rofsur', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + end do + end if + if (fldchk(exportState, 'Flrl_rofsub')) then + ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain + call state_getfldptr(exportState, 'Flrl_rofsub', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & + waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) + end do + end if + if (fldchk(exportState, 'Flrl_rofgwl')) then + ! qgwl sent individually to coupler + call state_getfldptr(exportState, 'Flrl_rofgwl', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) + end do + end if + if (fldchk(exportState, 'Flrl_rofi')) then + ! ice sent individually to coupler + call state_getfldptr(exportState, 'Flrl_rofi', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofice_grc(g) + end do + end if + if (fldchk(exportState, 'Flrl_irrig')) then + ! irrigation flux to be removed from main channel storage (negative) + call state_getfldptr(exportState, 'Flrl_irrig', fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = -waterlnd2atmbulk_inst%qirrig_grc(g) + end do + end if ! ----------------------- ! output to glc ! ----------------------- - ! We could avoid setting these fields if glc_present is .false., if that would ! help with performance. (The downside would be that we wouldn't have these fields ! available for diagnostic purposes or to force a later T compset with dlnd.) - - do num = 0,glc_nec - call state_setexport(exportState, 'Sl_tsrf_elev', bounds, input=lnd2glc_inst%tsrf_grc(:,num), & - ungridded_index=num+1, rc=rc) + if (fldchk(exportState, 'Sl_tsrf_elev')) then + call state_getfldptr(exportState, 'Sl_tsrf_elev', fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Sl_topo_elev', bounds, input=lnd2glc_inst%topo_grc(:,num), & - ungridded_index=num+1, rc=rc) + fldptr2d(:,:) = 0._r8 + do g = begg, endg + do num = 0,glc_nec + fldptr2d(num+1,g-begg+1) = lnd2glc_inst%tsrf_grc(g,num) + end do + end do + end if + if (fldchk(exportState, 'Sl_topo_elev')) then + call state_getfldptr(exportState, 'Sl_topo_elev', fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'Flgl_qice_elev', bounds, input=lnd2glc_inst%qice_grc(:,num), & - ungridded_index=num+1, rc=rc) + fldptr2d(:,:) = 0._r8 + do g = begg, endg + do num = 0,glc_nec + fldptr2d(num+1,g-begg+1) = lnd2glc_inst%topo_grc(g,num) + end do + end do + end if + if (fldchk(exportState, 'Flgl_qice_elev')) then + call state_getfldptr(exportState, 'Flgl_qice_elev', fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - end do + fldptr2d(:,:) = 0._r8 + do g = begg, endg + do num = 0,glc_nec + fldptr2d(num+1,g-begg+1) = lnd2glc_inst%qice_grc(g,num) + end do + end do + end if end subroutine export_fields !=============================================================================== - subroutine fldlist_add(num, fldlist, stdname, ungridded_lbound, ungridded_ubound) ! input/output variables @@ -901,7 +1181,6 @@ subroutine fldlist_add(num, fldlist, stdname, ungridded_lbound, ungridded_ubound end subroutine fldlist_add !=============================================================================== - subroutine fldlist_realize(state, fldList, numflds, flds_scalar_name, flds_scalar_num, mesh, tag, rc) use NUOPC , only : NUOPC_IsConnected, NUOPC_Realize @@ -944,7 +1223,7 @@ subroutine fldlist_realize(state, fldList, numflds, flds_scalar_name, flds_scala field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, & ungriddedLbound=(/fldlist(n)%ungridded_lbound/), & ungriddedUbound=(/fldlist(n)%ungridded_ubound/), & - gridToFieldMap=(/gridToFieldMap/), rc=rc) + gridToFieldMap=(/2/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else field = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name=stdname, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) @@ -1006,185 +1285,6 @@ end subroutine SetScalarField end subroutine fldlist_realize !=============================================================================== - - subroutine state_getimport(state, fldname, bounds, output, ungridded_index, rc) - - ! ---------------------------------------------- - ! Map import state field to output array - ! ---------------------------------------------- - - ! input/output variables - type(ESMF_State) , intent(in) :: state - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: fldname - real(r8) , intent(out) :: output(bounds%begg:bounds%endg) - integer, optional , intent(in) :: ungridded_index - integer , intent(out) :: rc - - ! local variables - integer :: g, i,n - real(R8), pointer :: fldptr1d(:) - real(R8), pointer :: fldptr2d(:,:) - type(ESMF_StateItem_Flag) :: itemFlag - character(len=cs) :: cvalue - character(len=*), parameter :: subname='(lnd_import_export:state_getimport)' - ! ---------------------------------------------- - - rc = ESMF_SUCCESS - - ! Determine if field with name fldname exists in state - call ESMF_StateGet(state, trim(fldname), itemFlag, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! if field exists then create output array - else do nothing - if (itemflag /= ESMF_STATEITEM_NOTFOUND) then - - ! get field pointer - if (present(ungridded_index)) then - write(cvalue,*) ungridded_index - call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname)//" index "//trim(cvalue), & - ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname),ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - ! determine output array - if (present(ungridded_index)) then - if (gridToFieldMap == 1) then - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr2d(n,ungridded_index) - end do - else if (gridToFieldMap == 2) then - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr2d(ungridded_index,n) - end do - end if - else - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr1d(n) - end do - end if - - ! write debug output if appropriate - if (masterproc .and. debug > 0 .and. get_nstep() < 48) then - do g = bounds%begg,bounds%endg - i = 1 + g - bounds%begg - write(iulog,F01)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) - end do - end if - - ! check for nans - call check_for_nans(output, trim(fldname), bounds%begg) - end if - - end subroutine state_getimport - - !=============================================================================== - - subroutine state_setexport(state, fldname, bounds, input, minus, ungridded_index, rc) - - ! ---------------------------------------------- - ! Map input array to export state field - ! ---------------------------------------------- - - use shr_const_mod, only : fillvalue=>SHR_CONST_SPVAL - - ! input/output variables - type(ESMF_State) , intent(inout) :: state - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: fldname - real(r8) , intent(in) :: input(bounds%begg:bounds%endg) - logical, optional , intent(in) :: minus - integer, optional , intent(in) :: ungridded_index - integer , intent(out) :: rc - - ! local variables - logical :: l_minus ! local version of minus - integer :: g, i, n - real(R8), pointer :: fldptr1d(:) - real(R8), pointer :: fldptr2d(:,:) - character(len=cs) :: cvalue - type(ESMF_StateItem_Flag) :: itemFlag - character(len=*), parameter :: subname='(lnd_import_export:state_setexport)' - ! ---------------------------------------------- - - rc = ESMF_SUCCESS - - l_minus = .false. - if (present(minus)) then - l_minus = minus - end if - - ! Determine if field with name fldname exists in state - call ESMF_StateGet(state, trim(fldname), itemFlag, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! if field exists then create output array - else do nothing - if (itemflag /= ESMF_STATEITEM_NOTFOUND) then - - ! get field pointer - if (present(ungridded_index)) then - write(cvalue,*) ungridded_index - call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname)//" index "//trim(cvalue), & - ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname), ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - ! TODO: if fillvalue = shr_const_spval the snowhl sent to the atm will have the spval over some points - ! rather than 0 - this is very odd and needs to be understood - !fldptr1d(:) = fillvalue - - ! determine output array - if (present(ungridded_index)) then - fldptr2d(ungridded_index,:) = 0._r8 - !fldptr2d(ungridded_index,:) = fillvalue - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - fldptr2d(ungridded_index,n) = input(g) - end do - if (l_minus) then - fldptr2d(ungridded_index,:) = -fldptr2d(ungridded_index,:) - end if - else - fldptr1d(:) = 0._r8 - !fldptr1d(:) = fillvalue - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - fldptr1d(n) = input(g) - end do - if (l_minus) then - fldptr1d(:) = -fldptr1d(:) - end if - end if - - ! write debug output if appropriate - if (masterproc .and. debug > 0 .and. get_nstep() < 48) then - do g = bounds%begg,bounds%endg - i = 1 + g - bounds%begg - write(iulog,F01)'export: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,input(g) - end do - end if - - ! check for nans - call check_for_nans(input, trim(fldname), bounds%begg) - end if - - end subroutine state_setexport - - !=============================================================================== - subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) ! ---------------------------------------------- @@ -1205,8 +1305,6 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) ! local variables type(ESMF_FieldStatus_Flag) :: status type(ESMF_Field) :: lfield - type(ESMF_Mesh) :: lmesh - integer :: nnodes, nelements character(len=*), parameter :: subname='(lnd_import_export:state_getfldptr)' ! ---------------------------------------------- @@ -1214,38 +1312,37 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_FieldGet(lfield, status=status, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - if (status /= ESMF_FIELDSTATUS_COMPLETE) then - call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) - rc = ESMF_FAILURE - return - else - call ESMF_FieldGet(lfield, mesh=lmesh, rc=rc) + if (present(fldptr1d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_MeshGet(lmesh, numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) + else if (present(fldptr2d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") + end if - if (nnodes == 0 .and. nelements == 0) then - call ESMF_LogWrite(trim(subname)//": no local nodes or elements ", ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + end subroutine state_getfldptr - if (present(fldptr1d)) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (present(fldptr2d)) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") - end if - endif ! status + !=============================================================================== + logical function fldchk(state, fldname) + ! ---------------------------------------------- + ! Determine if field with fldname is in the input state + ! ---------------------------------------------- - end subroutine state_getfldptr + ! input/output variables + type(ESMF_State), intent(in) :: state + character(len=*), intent(in) :: fldname + + ! local variables + type(ESMF_StateItem_Flag) :: itemFlag + ! ---------------------------------------------- + call ESMF_StateGet(state, trim(fldname), itemFlag) + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + fldchk = .true. + else + fldchk = .false. + endif + end function fldchk end module lnd_import_export From 1cec0104c1ed283241c2a4fea2945ea33d470d56 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 16 Dec 2020 11:47:07 -0700 Subject: [PATCH 1688/1973] convert taper/stocking to arrays --- src/biogeochem/CNVegStructUpdateMod.F90 | 41 +++++++++++++++---------- src/biogeochem/CNVegetationFacade.F90 | 2 +- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 1049a7ad3f..1066c93e43 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -16,6 +16,7 @@ module CNVegStructUpdateMod use CNVegCarbonStateType , only : cnveg_carbonstate_type use CanopyStateType , only : canopystate_type use PatchType , only : patch + use decompMod , only : bounds_type ! implicit none private @@ -27,7 +28,7 @@ module CNVegStructUpdateMod contains !----------------------------------------------------------------------- - subroutine CNVegStructUpdate(num_soilp, filter_soilp, & + subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & waterdiagnosticbulk_inst, frictionvel_inst, dgvs_inst, cnveg_state_inst, crop_inst, & cnveg_carbonstate_inst, canopystate_inst) ! @@ -49,6 +50,7 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & use clm_time_manager , only : get_rad_step_size ! ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_soilp ! number of column soil points in patch filter integer , intent(in) :: filter_soilp(:) ! patch filter for soil points type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst @@ -66,8 +68,8 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & ! !LOCAL VARIABLES: integer :: p,c,g ! indices integer :: fp ! lake filter indices - real(r8) :: taper ! ratio of height:radius_breast_height (tree allometry) - real(r8) :: stocking ! #stems / ha (stocking density) + real(r8) :: taper(bounds%begp:bounds%endp) ! ratio of height:radius_breast_height (tree allometry) + real(r8) :: stocking(bounds%begp:bounds%endp) ! #stems / ha (stocking density) real(r8) :: ol ! thickness of canopy layer covered by snow (m) real(r8) :: fb ! fraction of canopy layer covered by snow real(r8) :: tlai_old ! for use in Zeng tsai formula @@ -141,11 +143,18 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & dt = real( get_rad_step_size(), r8 ) ! constant allometric parameters - taper = 200._r8 - stocking = 1000._r8 - - ! convert from stems/ha -> stems/m^2 - stocking = stocking / 10000._r8 + taper(:) = 200._r8 + + if (use_biomass_heat_storage) then + do fp = 1,num_soilp + p = filter_soilp(fp) + stocking(p) = nstem(ivt(p)) + enddo + else + stocking(:) = 1000._r8 + ! convert from stems/ha -> stems/m^2 + stocking(:) = stocking(:) / 10000._r8 + endif ! patch loop do fp = 1,num_soilp @@ -192,10 +201,10 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & ! if shrubs have a squat taper if (ivt(p) >= nbrdlf_evr_shrub .and. ivt(p) <= nbrdlf_dcd_brl_shrub) then - taper = 10._r8 + taper(p) = 10._r8 ! otherwise have a tall taper else - taper = 200._r8 + taper(p) = 200._r8 end if ! trees and shrubs for now have a very simple allometry, with hard-wired @@ -204,9 +213,9 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area + stocking(p) = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area htop(p) = allom2(ivt(p)) * ( (24._r8 * deadstemc(p) / & - (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper))**(1._r8/3._r8) )**allom3(ivt(p)) ! lpj's htop w/ cn's stemdiam + (SHR_CONST_PI * stocking(p) * dwood(ivt(p)) * taper(p)))**(1._r8/3._r8) )**allom3(ivt(p)) ! lpj's htop w/ cn's stemdiam else htop(p) = 0._r8 @@ -215,11 +224,11 @@ subroutine CNVegStructUpdate(num_soilp, filter_soilp, & else !correct height calculation if doing accelerated spinup if (spinup_state == 2) then - htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper * taper)/ & - (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) + htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper(p) * taper(p))/ & + (SHR_CONST_PI * stocking(p) * dwood(ivt(p))))**(1._r8/3._r8) else - htop(p) = ((3._r8 * deadstemc(p) * taper * taper)/ & - (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) + htop(p) = ((3._r8 * deadstemc(p) * taper(p) * taper(p))/ & + (SHR_CONST_PI * stocking(p) * dwood(ivt(p))))**(1._r8/3._r8) end if endif diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 44e904bf2c..d0741e68ff 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -1084,7 +1084,7 @@ subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & ! vegetation structure (LAI, SAI, height) if (doalb) then - call CNVegStructUpdate(num_soilp, filter_soilp, & + call CNVegStructUpdate(bounds,num_soilp, filter_soilp, & waterdiagnosticbulk_inst, frictionvel_inst, this%dgvs_inst, this%cnveg_state_inst, & crop_inst, this%cnveg_carbonstate_inst, canopystate_inst) end if From 2a04340a7b78e350cd0bc8200c4a630716b32403 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 16 Dec 2020 17:16:33 -0700 Subject: [PATCH 1689/1973] Update paramsfile to a ctsm5_1 one that has the new BHS terms on it --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 523ac2c1f9..9b28e857d6 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -472,7 +472,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c200905.nc +lnd/clm2/paramdata/ctsm51_params.c201215.nc lnd/clm2/paramdata/clm50_params.c200905.nc lnd/clm2/paramdata/clm45_params.c200905.nc From b1610f80fd1a4b53d660b34a8dbf70523f1de854 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 16 Dec 2020 17:17:51 -0700 Subject: [PATCH 1690/1973] Set dhsdt_canopy to zero over lake --- src/biogeophys/LakeFluxesMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/biogeophys/LakeFluxesMod.F90 b/src/biogeophys/LakeFluxesMod.F90 index 3477c565d6..212d0ca7d1 100644 --- a/src/biogeophys/LakeFluxesMod.F90 +++ b/src/biogeophys/LakeFluxesMod.F90 @@ -269,6 +269,7 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, eflx_gnet => energyflux_inst%eflx_gnet_patch , & ! Output: [real(r8) (:) ] net heat flux into ground (W/m**2) taux => energyflux_inst%taux_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: e-w (kg/m/s**2) tauy => energyflux_inst%tauy_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: n-s (kg/m/s**2) + dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] ks => lakestate_inst%ks_col , & ! Output: [real(r8) (:) ] coefficient passed to LakeTemperature ws => lakestate_inst%ws_col , & ! Output: [real(r8) (:) ] surface friction velocity (m/s) @@ -377,6 +378,7 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, c = patch%column(p) g = patch%gridcell(p) + dhsdt_canopy(p) = 0.0_r8 nmozsgn(p) = 0 obuold(p) = 0._r8 displa(p) = 0._r8 From 876cf8c17b6ed2eb2aab2f02177405df04c300d1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 16 Dec 2020 17:20:59 -0700 Subject: [PATCH 1691/1973] Set terms when BHS off to double precision, set nstem to exactly how stocking was set in CNVegStructUpdate (probably just needs to be double precision, but doing it the same to make sure) --- src/main/pftconMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index e8924cbe36..219e556f51 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -1043,11 +1043,11 @@ subroutine InitRead(this) call ncd_io('wood_density',this%wood_density, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) else - this%dbh = 0.0 - this%fbw = 0.0 - this%nstem = 0.1 - this%rstem_per_dbh = 0.0 - this%wood_density = 0.0 + this%dbh = 0.0_r8 + this%fbw = 0.0_r8 + this%nstem = 1000._r8 / 10000._r8 + this%rstem_per_dbh = 0.0_r8 + this%wood_density = 0.0_r8 end if call ncd_pio_closefile(ncid) From 78a979fd989f1c82875e995b030ddb6ecf7f5465 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 17 Dec 2020 14:46:50 -0700 Subject: [PATCH 1692/1973] Move call BalanceCheck to after call lnd2atm; use existing _grc vars --- src/biogeophys/BalanceCheckMod.F90 | 139 +++++++++------------------- src/biogeophys/Waterlnd2atmType.F90 | 7 +- src/main/clm_driver.F90 | 32 ++++--- src/main/lnd2atmMod.F90 | 5 +- 4 files changed, 70 insertions(+), 113 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index b9390c57b3..fb73adfaaf 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -24,7 +24,7 @@ module BalanceCheckMod use WaterDiagnosticBulkType, only : waterdiagnosticbulk_type use WaterDiagnosticType, only : waterdiagnostic_type use Wateratm2lndType , only : wateratm2lnd_type -! use Waterlnd2atmType , only : waterlnd2atm_type ! slevis: place holder + use Waterlnd2atmType , only : waterlnd2atm_type use WaterBalanceType , only : waterbalance_type use WaterFluxType , only : waterflux_type use WaterType , only : water_type @@ -356,8 +356,7 @@ subroutine BalanceCheck( bounds, & num_allc, filter_allc, & atm2lnd_inst, solarabs_inst, waterflux_inst, waterstate_inst, & waterdiagnosticbulk_inst, waterbalance_inst, wateratm2lnd_inst, & - surfalb_inst, energyflux_inst, canopystate_inst) -! waterlnd2atm_inst, surfalb_inst, energyflux_inst, canopystate_inst) + waterlnd2atm_inst, surfalb_inst, energyflux_inst, canopystate_inst) ! ! !DESCRIPTION: ! This subroutine accumulates the numerical truncation errors of the water @@ -390,7 +389,7 @@ subroutine BalanceCheck( bounds, & class(waterstate_type), intent(in) :: waterstate_inst type(waterdiagnosticbulk_type), intent(in) :: waterdiagnosticbulk_inst class(waterbalance_type), intent(inout) :: waterbalance_inst -! class(waterlnd2atm_type), intent(in) :: waterlnd2atm_inst + class(waterlnd2atm_type), intent(in) :: waterlnd2atm_inst class(wateratm2lnd_type) , intent(in) :: wateratm2lnd_inst type(surfalb_type) , intent(in) :: surfalb_inst type(energyflux_type) , intent(inout) :: energyflux_inst @@ -405,18 +404,9 @@ subroutine BalanceCheck( bounds, & real(r8) :: forc_rain_col(bounds%begc:bounds%endc) ! column level rain rate [mm/s] real(r8) :: forc_snow_col(bounds%begc:bounds%endc) ! column level snow rate [mm/s] real(r8) :: h2osno_total(bounds%begc:bounds%endc) ! total snow water [mm H2O] - real(r8) :: endwb_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now - real(r8) :: qflx_irrig_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now - real(r8) :: qflx_glcice_dyn_water_flux_locgrc(bounds%begg:bounds%endg) ! water flux needed for balance check due to glc_dyn_runoff_routing [mm H2O/s] (positive means addition of water to the system) - real(r8) :: qflx_evap_tot_locgrc(bounds%begg:bounds%endg) ! grid cell level total evapotranspiration [mm/s] - real(r8) :: qflx_surf_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now - real(r8) :: qflx_drain_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now - real(r8) :: qflx_drain_perched_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now - real(r8) :: qflx_qrgwl_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now - real(r8) :: qflx_ice_runoff_snwcp_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now - real(r8) :: qflx_ice_runoff_xs_locgrc(bounds%begg:bounds%endg) ! slevis: using local for now - real(r8) :: qflx_snwcp_discarded_liq_locgrc(bounds%begg:bounds%endg) ! excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] - real(r8) :: qflx_snwcp_discarded_ice_locgrc(bounds%begg:bounds%endg) ! excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] + real(r8) :: qflx_glcice_dyn_water_flux_grc(bounds%begg:bounds%endg) ! grid cell-level water flux needed for balance check due to glc_dyn_runoff_routing [mm H2O/s] (positive means addition of water to the system) + real(r8) :: qflx_snwcp_discarded_liq_grc(bounds%begg:bounds%endg) ! grid cell-level excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] + real(r8) :: qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg) ! grid cell-level excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] real(r8) :: errh2o_max_val ! Maximum value of error in water conservation error over all columns [mm H2O] real(r8) :: errh2osno_max_val ! Maximum value of error in h2osno conservation error over all columns [kg m-2] @@ -446,7 +436,7 @@ subroutine BalanceCheck( bounds, & frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) begwb_grc => waterbalance_inst%begwb_grc , & ! Input: [real(r8) (:) ] grid cell-level water mass begining of the time step -! endwb_grc => waterbalance_inst%endwb_grc , & ! Output: [real(r8) (:) ] grid cell-level water mass end of the time step + endwb_grc => waterbalance_inst%endwb_grc , & ! Output: [real(r8) (:) ] grid cell-level water mass end of the time step errh2o_grc => waterbalance_inst%errh2o_grc , & ! Output: [real(r8) (:) ] grid cell-level water conservation error (mm H2O) begwb_col => waterbalance_inst%begwb_col , & ! Input: [real(r8) (:) ] column-level water mass begining of the time step endwb_col => waterbalance_inst%endwb_col , & ! Output: [real(r8) (:) ] column-level water mass end of the time step @@ -461,7 +451,7 @@ subroutine BalanceCheck( bounds, & qflx_snwcp_discarded_liq => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Input: [real(r8) (:) ] excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+]` qflx_snwcp_discarded_ice => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Input: [real(r8) (:) ] excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+]` qflx_evap_tot => waterflux_inst%qflx_evap_tot_col , & ! Input: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg -! qflx_evap_tot_grc => waterlnd2atm_inst%qflx_evap_tot_grc, & ! Input: [real(r8) (:) ] grid cell-level qflx_evap_soi + qflx_evap_can + qflx_tran_veg + qflx_evap_tot_grc => waterlnd2atm_inst%qflx_evap_tot_grc, & ! Input: [real(r8) (:) ] grid cell-level qflx_evap_soi + qflx_evap_can + qflx_tran_veg qflx_soliddew_to_top_layer => waterflux_inst%qflx_soliddew_to_top_layer_col , & ! Input: [real(r8) (:) ] rate of solid water deposited on top soil or snow layer (frost) (mm H2O /s) [+] qflx_solidevap_from_top_layer => waterflux_inst%qflx_solidevap_from_top_layer_col, & ! Input: [real(r8) (:) ] rate of ice evaporated from top soil or snow layer (sublimation) (mm H2O /s) [+] qflx_liqevap_from_top_layer => waterflux_inst%qflx_liqevap_from_top_layer_col , & ! Input: [real(r8) (:) ] rate of liquid water evaporated from top soil or snow layer (mm H2O/s) [+] @@ -470,24 +460,23 @@ subroutine BalanceCheck( bounds, & qflx_snow_h2osfc => waterflux_inst%qflx_snow_h2osfc_col , & ! Input: [real(r8) (:) ] snow falling on surface water (mm/s) qflx_h2osfc_to_ice => waterflux_inst%qflx_h2osfc_to_ice_col , & ! Input: [real(r8) (:) ] conversion of h2osfc to ice qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) -! qflx_rofliq_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:) ] grid cell-level sub-surface runoff (mm H2O /s) + qflx_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:) ] grid cell-level sub-surface runoff (mm H2O /s) qflx_floodc => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] total runoff due to flooding qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Input: [real(r8) (:) ] drainage from snow pack ! qflx_liq_dynbal_grc => waterflux_inst%qflx_liq_dynbal_grc , & ! Input: [real(r8) (:) ] slevis: place holder ! qflx_ice_dynbal_grc => waterflux_inst%qflx_ice_dynbal_grc , & ! Input: [real(r8) (:) ] slevis: place holder -! qflx_runoff_col => waterflux_inst%qflx_runoff_col , & ! total runoff (mm H2O / s) slevis: place holder qflx_surf => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] surface runoff (mm H2O /s) -! qflx_rofliq_qsur_grc => waterlnd2atm_inst%qflx_rofliq_qsur_grc , & ! Input: [real(r8) (:) ] grid cell-level surface runoff (mm H20 /s) + qflx_surf_grc => waterlnd2atm_inst%qflx_rofliq_qsur_grc , & ! Input: [real(r8) (:) ] grid cell-level surface runoff (mm H20 /s) qflx_qrgwl => waterflux_inst%qflx_qrgwl_col , & ! Input: [real(r8) (:) ] qflx_surf at glaciers, wetlands, lakes -! qflx_rofliq_qgwl_grc => waterlnd2atm_inst%qflx_rofliq_qgwl_grc , & ! Input: [real(r8) (:) ] grid cell-level qflx_surf at glaciers, wetlands, lakes + qflx_qrgwl_grc => waterlnd2atm_inst%qflx_rofliq_qgwl_grc , & ! Input: [real(r8) (:) ] grid cell-level qflx_surf at glaciers, wetlands, lakes qflx_drain => waterflux_inst%qflx_drain_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) -! qflx_rofliq_qsub_grc => waterlnd2atm_inst%qflx_rofliq_qsub_grc , & ! Input: [real(r8) (:) ] grid cell-level drainage (mm H20 /s) - qflx_ice_runoff_snwcp => waterflux_inst%qflx_ice_runoff_snwcp_col, & ! Input: [real(r8) (:) ] solid runoff from snow capping (mm H2O /s) - qflx_ice_runoff_xs => waterflux_inst%qflx_ice_runoff_xs_col , & ! Input: [real(r8) (:) ] solid runoff from excess ice in soil (mm H2O /s) + qflx_drain_grc => waterlnd2atm_inst%qflx_rofliq_qsub_grc , & ! Input: [real(r8) (:) ] grid cell-level drainage (mm H20 /s) + qflx_ice_runoff => waterlnd2atm_inst%qflx_ice_runoff_col , & ! Input: [real(r8) (:) ] column level solid runoff from snow capping and from excess ice in soil (mm H2O /s) + qflx_ice_runoff_grc => waterlnd2atm_inst%qflx_rofice_grc , & ! Input: [real(r8) (:) ] grid cell-level solid runoff from snow capping and from excess ice in soil (mm H2O /s) qflx_sl_top_soil => waterflux_inst%qflx_sl_top_soil_col , & ! Input: [real(r8) (:) ] liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) qflx_sfc_irrig => waterflux_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s) -! qirrig_grc => waterlnd2atm_inst%qirrig_grc , & ! Input: [real(r8) (:) ] grid cell-level irrigation flux (mm H20 /s) + qirrig_grc => waterlnd2atm_inst%qirrig_grc , & ! Input: [real(r8) (:) ] grid cell-level irrigation flux (mm H20 /s) qflx_glcice_dyn_water_flux => waterflux_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) @@ -566,8 +555,7 @@ subroutine BalanceCheck( bounds, & - qflx_qrgwl(c) & - qflx_drain(c) & - qflx_drain_perched(c) & - - qflx_ice_runoff_snwcp(c) & - - qflx_ice_runoff_xs(c) & + - qflx_ice_runoff(c) & - qflx_snwcp_discarded_liq(c) & - qflx_snwcp_discarded_ice(c)) * dtime @@ -605,8 +593,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl(indexc)*dtime write(iulog,*)'qflx_drain = ',qflx_drain(indexc)*dtime - write(iulog,*)'qflx_ice_runoff_snwcp = ',qflx_ice_runoff_snwcp(indexc)*dtime - write(iulog,*)'qflx_ice_runoff_xs = ',qflx_ice_runoff_xs(indexc)*dtime + write(iulog,*)'qflx_ice_runoff = ',qflx_ice_runoff(indexc)*dtime write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice(indexc)*dtime write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq(indexc)*dtime @@ -630,71 +617,34 @@ subroutine BalanceCheck( bounds, & ! Water balance check at the grid cell level - call c2g(bounds, & - endwb_col(bounds%begc:bounds%endc), & - endwb_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type='urbanf', l2g_scale_type='unity') - call c2g( bounds, & - qflx_sfc_irrig(bounds%begc:bounds%endc), & - qflx_irrig_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) call c2g( bounds, & qflx_glcice_dyn_water_flux(bounds%begc:bounds%endc), & - qflx_glcice_dyn_water_flux_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - call c2g( bounds, & - qflx_evap_tot(bounds%begc:bounds%endc), & - qflx_evap_tot_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - call c2g( bounds, & - qflx_surf(bounds%begc:bounds%endc), & - qflx_surf_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - call c2g( bounds, & - qflx_qrgwl(bounds%begc:bounds%endc), & - qflx_qrgwl_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - call c2g( bounds, & - qflx_drain(bounds%begc:bounds%endc), & - qflx_drain_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - call c2g( bounds, & - qflx_drain_perched(bounds%begc:bounds%endc), & - qflx_drain_perched_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - call c2g( bounds, & - qflx_ice_runoff_snwcp(bounds%begc:bounds%endc), & - qflx_ice_runoff_snwcp_locgrc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - call c2g( bounds, & - qflx_ice_runoff_xs(bounds%begc:bounds%endc), & - qflx_ice_runoff_xs_locgrc(bounds%begg:bounds%endg), & + qflx_glcice_dyn_water_flux_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) call c2g( bounds, & qflx_snwcp_discarded_liq(bounds%begc:bounds%endc), & - qflx_snwcp_discarded_liq_locgrc(bounds%begg:bounds%endg), & + qflx_snwcp_discarded_liq_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) call c2g( bounds, & qflx_snwcp_discarded_ice(bounds%begc:bounds%endc), & - qflx_snwcp_discarded_ice_locgrc(bounds%begg:bounds%endg), & + qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) do g = bounds%begg, bounds%endg - errh2o_grc(g) = endwb_locgrc(g) - begwb_grc(g) & + errh2o_grc(g) = endwb_grc(g) - begwb_grc(g) & - (forc_rain_grc(g) & + forc_snow_grc(g) & + qflx_flood_grc(g) & - + qflx_irrig_locgrc(g) & - + qflx_glcice_dyn_water_flux_locgrc(g) & - - qflx_evap_tot_locgrc(g) & - - qflx_surf_locgrc(g) & - - qflx_qrgwl_locgrc(g) & - - qflx_drain_locgrc(g) & - - qflx_drain_perched_locgrc(g) & - - qflx_ice_runoff_snwcp_locgrc(g) & - - qflx_ice_runoff_xs_locgrc(g) & - - qflx_snwcp_discarded_liq_locgrc(g) & - - qflx_snwcp_discarded_ice_locgrc(g)) * dtime + + qirrig_grc(g) & + + qflx_glcice_dyn_water_flux_grc(g) & + - qflx_evap_tot_grc(g) & + - qflx_surf_grc(g) & + - qflx_qrgwl_grc(g) & + - qflx_drain_grc(g) & + - qflx_drain_perched_grc(g) & + - qflx_ice_runoff_grc(g) & + - qflx_snwcp_discarded_liq_grc(g) & + - qflx_snwcp_discarded_ice_grc(g)) * dtime end do errh2o_max_val = maxval(abs(errh2o_grc(bounds%begg:bounds%endg))) @@ -713,23 +663,22 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'errh2o_grc = ',errh2o_grc(indexg) write(iulog,*)'forc_rain = ',forc_rain_grc(indexg)*dtime write(iulog,*)'forc_snow = ',forc_snow_grc(indexg)*dtime - write(iulog,*)'endwb_loc = ',endwb_locgrc(indexg) + write(iulog,*)'endwb_grc = ',endwb_grc(indexg) write(iulog,*)'begwb_grc = ',begwb_grc(indexg) - write(iulog,*)'qflx_evap_tot_loc = ',qflx_evap_tot_locgrc(indexg)*dtime - write(iulog,*)'qflx_irrig_loc = ',qflx_irrig_locgrc(indexg)*dtime - write(iulog,*)'qflx_surf_loc = ',qflx_surf_locgrc(indexg)*dtime - write(iulog,*)'qflx_qrgwl_loc = ',qflx_qrgwl_locgrc(indexg)*dtime - write(iulog,*)'qflx_drain_loc = ',qflx_drain_locgrc(indexg)*dtime - write(iulog,*)'qflx_ice_runoff_snwcp_loc = ',qflx_ice_runoff_snwcp_locgrc(indexg)*dtime - write(iulog,*)'qflx_ice_runoff_xs_loc = ',qflx_ice_runoff_xs_locgrc(indexg)*dtime - write(iulog,*)'qflx_snwcp_discarded_ice_loc = ',qflx_snwcp_discarded_ice_locgrc(indexg)*dtime - write(iulog,*)'qflx_snwcp_discarded_liq_loc = ',qflx_snwcp_discarded_liq_locgrc(indexg)*dtime - write(iulog,*)'deltawb = ',endwb_locgrc(indexg)-begwb_grc(indexg) - write(iulog,*)'deltawb/dtime = ',(endwb_locgrc(indexg)-begwb_grc(indexg))/dtime - write(iulog,*)'qflx_drain_perched_loc = ',qflx_drain_perched_locgrc(indexg)*dtime + write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot_grc(indexg)*dtime + write(iulog,*)'qirrig = ',qirrig_grc(indexg)*dtime + write(iulog,*)'qflx_surf = ',qflx_surf_grc(indexg)*dtime + write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl_grc(indexg)*dtime + write(iulog,*)'qflx_drain = ',qflx_drain_grc(indexg)*dtime + write(iulog,*)'qflx_ice_runoff = ',qflx_ice_runoff_grc(indexg)*dtime + write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice_grc(indexg)*dtime + write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq_grc(indexg)*dtime + write(iulog,*)'deltawb = ',endwb_grc(indexg)-begwb_grc(indexg) + write(iulog,*)'deltawb/dtime = ',(endwb_grc(indexg)-begwb_grc(indexg))/dtime + write(iulog,*)'qflx_drain_perched = ',qflx_drain_perched_grc(indexg)*dtime write(iulog,*)'qflx_flood = ',qflx_flood_grc(indexg)*dtime - write(iulog,*)'qflx_glcice_dyn_water_flux_grc_loc = ',qflx_glcice_dyn_water_flux_locgrc(indexg)*dtime + write(iulog,*)'qflx_glcice_dyn_water_flux_grc = ',qflx_glcice_dyn_water_flux_grc(indexg)*dtime write(iulog,*)'clm model is stopping' call endrun(decomp_index=indexg, clmlevel=nameg, msg=errmsg(sourcefile, __LINE__)) diff --git a/src/biogeophys/Waterlnd2atmType.F90 b/src/biogeophys/Waterlnd2atmType.F90 index ed6e9ca0dd..fb59d1c83c 100644 --- a/src/biogeophys/Waterlnd2atmType.F90 +++ b/src/biogeophys/Waterlnd2atmType.F90 @@ -32,7 +32,8 @@ module Waterlnd2atmType real(r8), pointer :: qflx_rofliq_qsub_grc (:) ! rof liq -- subsurface runoff component real(r8), pointer :: qflx_rofliq_qgwl_grc (:) ! rof liq -- glacier, wetland and lakes water balance residual component real(r8), pointer :: qflx_rofliq_drain_perched_grc (:) ! rof liq -- perched water table runoff component - real(r8), pointer :: qflx_rofice_grc (:) ! rof ice forcing + real(r8), pointer :: qflx_ice_runoff_col(:) ! rof ice forcing, col level + real(r8), pointer :: qflx_rofice_grc (:) ! rof ice forcing, grc level real(r8), pointer :: qflx_liq_from_ice_col(:) ! liquid runoff from converted ice runoff real(r8), pointer :: qirrig_grc (:) ! irrigation flux @@ -119,6 +120,10 @@ subroutine InitAllocate(this, bounds, tracer_vars) container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_GRIDCELL, & ival=ival) + call AllocateVar1d(var = this%qflx_ice_runoff_col, name = 'qflx_ice_runoff_col', & + container = tracer_vars, & + bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN, & + ival=ival) call AllocateVar1d(var = this%qflx_rofice_grc, name = 'qflx_rofice_grc', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_GRIDCELL, & diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 943106bbd2..eb94d5de83 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1105,20 +1105,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro filter(nc)%num_soilp, filter(nc)%soilp, & filter(nc)%num_allc, filter(nc)%allc) - ! ============================================================================ - ! Check the energy and water balance - ! ============================================================================ - - call t_startf('balchk') - call BalanceCheck(bounds_clump, & - filter(nc)%num_allc, filter(nc)%allc, & - atm2lnd_inst, solarabs_inst, water_inst%waterfluxbulk_inst, & - water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & - water_inst%waterbalancebulk_inst, water_inst%wateratm2lndbulk_inst, & - surfalb_inst, energyflux_inst, canopystate_inst) -! water_inst%waterlnd2atmbulk_inst, surfalb_inst, energyflux_inst, canopystate_inst) - call t_stopf('balchk') - ! ============================================================================ ! Check the carbon and nitrogen balance ! ============================================================================ @@ -1272,6 +1258,24 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro !$OMP END PARALLEL DO call t_stopf('lnd2glc') + ! ========================================================================== + ! Check the energy and water balance + ! ========================================================================== + + call t_startf('balchk') + !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) + do nc = 1,nclumps + call get_clump_bounds(nc, bounds_clump) + call BalanceCheck(bounds_clump, & + filter(nc)%num_allc, filter(nc)%allc, & + atm2lnd_inst, solarabs_inst, water_inst%waterfluxbulk_inst, & + water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & + water_inst%waterbalancebulk_inst, water_inst%wateratm2lndbulk_inst, & + water_inst%waterlnd2atmbulk_inst, surfalb_inst, energyflux_inst, canopystate_inst) + end do + !$OMP END PARALLEL DO + call t_stopf('balchk') + ! ============================================================================ ! Write global average diagnostics to standard output ! ============================================================================ diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index e7052b6020..d3eb22d610 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -180,7 +180,6 @@ subroutine lnd2atm(bounds, & ! ! !LOCAL VARIABLES: integer :: c, g ! indices - real(r8) :: qflx_ice_runoff_col(bounds%begc:bounds%endc) ! total column-level ice runoff real(r8) :: eflx_sh_ice_to_liq_grc(bounds%begg:bounds%endg) ! sensible heat flux generated from the ice to liquid conversion, averaged to gridcell real(r8), parameter :: amC = 12.0_r8 ! Atomic mass number for Carbon real(r8), parameter :: amO = 16.0_r8 ! Atomic mass number for Oxygen @@ -193,7 +192,7 @@ subroutine lnd2atm(bounds, & call handle_ice_runoff(bounds, water_inst%waterfluxbulk_inst, glc_behavior, & melt_non_icesheet_ice_runoff = lnd2atm_inst%params%melt_non_icesheet_ice_runoff, & - qflx_ice_runoff_col = qflx_ice_runoff_col(bounds%begc:bounds%endc), & + qflx_ice_runoff_col = water_inst%waterlnd2atmbulk_inst%qflx_ice_runoff_col(bounds%begc:bounds%endc), & qflx_liq_from_ice_col = water_inst%waterlnd2atmbulk_inst%qflx_liq_from_ice_col(bounds%begc:bounds%endc), & eflx_sh_ice_to_liq_col = lnd2atm_inst%eflx_sh_ice_to_liq_col(bounds%begc:bounds%endc)) @@ -391,7 +390,7 @@ subroutine lnd2atm(bounds, & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) call c2g( bounds, & - qflx_ice_runoff_col(bounds%begc:bounds%endc), & + water_inst%waterlnd2atmbulk_inst%qflx_ice_runoff_col(bounds%begc:bounds%endc), & water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) do g = bounds%begg, bounds%endg From 4ab9f3d54e7151b80d3b5b08f4e5ed5d857ed746 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 17 Dec 2020 19:21:53 -0700 Subject: [PATCH 1693/1973] Some clean-up before moving on to solving the transient h2o balance --- src/biogeophys/BalanceCheckMod.F90 | 108 ++++++++++++++--------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index fb73adfaaf..91c6b9c0e9 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -377,7 +377,7 @@ subroutine BalanceCheck( bounds, & use clm_time_manager , only : get_step_size_real, get_nstep use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause use CanopyStateType , only : canopystate_type - use subgridAveMod ! , only : c2g ? + use subgridAveMod , only : c2g ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -424,11 +424,10 @@ subroutine BalanceCheck( bounds, & associate( & forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse radiation (vis=forc_solsd, nir=forc_solld) - forc_rain_grc => wateratm2lnd_inst%forc_rain_not_downscaled_grc , & ! Input: [real(r8) (:)] grid cell-level rain rate [mm/s] - forc_snow_grc => wateratm2lnd_inst%forc_snow_not_downscaled_grc , & ! Input: [real(r8) (:)] grid cell-level snow rate [mm/s] - qflx_flood_grc => wateratm2lnd_inst%forc_flood_grc , & ! Input: [real(r8) (:) ] total grid cell-level runoff from river model - forc_rain => wateratm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] rain rate [mm/s] - forc_snow => wateratm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] snow rate [mm/s] + forc_rain => wateratm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] column level rain rate [mm/s] + forc_rain_grc => wateratm2lnd_inst%forc_rain_not_downscaled_grc, & ! Input: [real(r8) (:)] grid cell-level rain rate [mm/s] + forc_snow => wateratm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] column level snow rate [mm/s] + forc_snow_grc => wateratm2lnd_inst%forc_snow_not_downscaled_grc, & ! Input: [real(r8) (:)] grid cell-level snow rate [mm/s] forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) h2osno_old => waterbalance_inst%h2osno_old_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) at previous time step @@ -448,10 +447,10 @@ subroutine BalanceCheck( bounds, & qflx_snow_grnd_col => waterflux_inst%qflx_snow_grnd_col , & ! Input: [real(r8) (:) ] snow on ground after interception (mm H2O/s) [+] qflx_snwcp_liq => waterflux_inst%qflx_snwcp_liq_col , & ! Input: [real(r8) (:) ] excess liquid h2o due to snow capping (outgoing) (mm H2O /s) [+]` qflx_snwcp_ice => waterflux_inst%qflx_snwcp_ice_col , & ! Input: [real(r8) (:) ] excess solid h2o due to snow capping (outgoing) (mm H2O /s) [+]` - qflx_snwcp_discarded_liq => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Input: [real(r8) (:) ] excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+]` - qflx_snwcp_discarded_ice => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Input: [real(r8) (:) ] excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+]` - qflx_evap_tot => waterflux_inst%qflx_evap_tot_col , & ! Input: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg - qflx_evap_tot_grc => waterlnd2atm_inst%qflx_evap_tot_grc, & ! Input: [real(r8) (:) ] grid cell-level qflx_evap_soi + qflx_evap_can + qflx_tran_veg + qflx_snwcp_discarded_liq_col => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Input: [real(r8) (:) ] column level excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] + qflx_snwcp_discarded_ice_col => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Input: [real(r8) (:) ] column level excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] + qflx_evap_tot_col => waterflux_inst%qflx_evap_tot_col , & ! Input: [real(r8) (:) ] column level qflx_evap_soi + qflx_evap_can + qflx_tran_veg + qflx_evap_tot_grc => waterlnd2atm_inst%qflx_evap_tot_grc , & ! Input: [real(r8) (:) ] grid cell-level qflx_evap_soi + qflx_evap_can + qflx_tran_veg qflx_soliddew_to_top_layer => waterflux_inst%qflx_soliddew_to_top_layer_col , & ! Input: [real(r8) (:) ] rate of solid water deposited on top soil or snow layer (frost) (mm H2O /s) [+] qflx_solidevap_from_top_layer => waterflux_inst%qflx_solidevap_from_top_layer_col, & ! Input: [real(r8) (:) ] rate of ice evaporated from top soil or snow layer (sublimation) (mm H2O /s) [+] qflx_liqevap_from_top_layer => waterflux_inst%qflx_liqevap_from_top_layer_col , & ! Input: [real(r8) (:) ] rate of liquid water evaporated from top soil or snow layer (mm H2O/s) [+] @@ -459,25 +458,26 @@ subroutine BalanceCheck( bounds, & qflx_prec_grnd => waterdiagnosticbulk_inst%qflx_prec_grnd_col, & ! Input: [real(r8) (:) ] water onto ground including canopy runoff [kg/(m2 s)] qflx_snow_h2osfc => waterflux_inst%qflx_snow_h2osfc_col , & ! Input: [real(r8) (:) ] snow falling on surface water (mm/s) qflx_h2osfc_to_ice => waterflux_inst%qflx_h2osfc_to_ice_col , & ! Input: [real(r8) (:) ] conversion of h2osfc to ice - qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:) ] grid cell-level sub-surface runoff (mm H2O /s) - qflx_floodc => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] total runoff due to flooding + qflx_drain_perched_col => waterflux_inst%qflx_drain_perched_col , & ! Input: [real(r8) (:) ] column level sub-surface runoff (mm H2O /s) + qflx_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:) ] grid cell-level sub-surface runoff (mm H2O /s) + qflx_flood_col => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] column level total runoff due to flooding + forc_flood_grc => wateratm2lnd_inst%forc_flood_grc , & ! Input: [real(r8) (:) ] grid cell-level total grid cell-level runoff from river model qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Input: [real(r8) (:) ] drainage from snow pack ! qflx_liq_dynbal_grc => waterflux_inst%qflx_liq_dynbal_grc , & ! Input: [real(r8) (:) ] slevis: place holder ! qflx_ice_dynbal_grc => waterflux_inst%qflx_ice_dynbal_grc , & ! Input: [real(r8) (:) ] slevis: place holder - qflx_surf => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] surface runoff (mm H2O /s) + qflx_surf_col => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] column level surface runoff (mm H2O /s) qflx_surf_grc => waterlnd2atm_inst%qflx_rofliq_qsur_grc , & ! Input: [real(r8) (:) ] grid cell-level surface runoff (mm H20 /s) - qflx_qrgwl => waterflux_inst%qflx_qrgwl_col , & ! Input: [real(r8) (:) ] qflx_surf at glaciers, wetlands, lakes + qflx_qrgwl_col => waterflux_inst%qflx_qrgwl_col , & ! Input: [real(r8) (:) ] column level qflx_surf at glaciers, wetlands, lakes qflx_qrgwl_grc => waterlnd2atm_inst%qflx_rofliq_qgwl_grc , & ! Input: [real(r8) (:) ] grid cell-level qflx_surf at glaciers, wetlands, lakes - qflx_drain => waterflux_inst%qflx_drain_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) + qflx_drain_col => waterflux_inst%qflx_drain_col , & ! Input: [real(r8) (:) ] column level sub-surface runoff (mm H2O /s) qflx_drain_grc => waterlnd2atm_inst%qflx_rofliq_qsub_grc , & ! Input: [real(r8) (:) ] grid cell-level drainage (mm H20 /s) - qflx_ice_runoff => waterlnd2atm_inst%qflx_ice_runoff_col , & ! Input: [real(r8) (:) ] column level solid runoff from snow capping and from excess ice in soil (mm H2O /s) + qflx_ice_runoff_col => waterlnd2atm_inst%qflx_ice_runoff_col , & ! Input: [real(r8) (:) ] column level solid runoff from snow capping and from excess ice in soil (mm H2O /s) qflx_ice_runoff_grc => waterlnd2atm_inst%qflx_rofice_grc , & ! Input: [real(r8) (:) ] grid cell-level solid runoff from snow capping and from excess ice in soil (mm H2O /s) qflx_sl_top_soil => waterflux_inst%qflx_sl_top_soil_col , & ! Input: [real(r8) (:) ] liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) - qflx_sfc_irrig => waterflux_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s) - qirrig_grc => waterlnd2atm_inst%qirrig_grc , & ! Input: [real(r8) (:) ] grid cell-level irrigation flux (mm H20 /s) - qflx_glcice_dyn_water_flux => waterflux_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) + qflx_sfc_irrig_col => waterflux_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] column level irrigation flux (mm H2O /s) + qflx_sfc_irrig_grc => waterlnd2atm_inst%qirrig_grc , & ! Input: [real(r8) (:) ] grid cell-level irrigation flux (mm H20 /s) + qflx_glcice_dyn_water_flux_col => waterflux_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] column level water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Input: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] @@ -547,17 +547,17 @@ subroutine BalanceCheck( bounds, & errh2o_col(c) = endwb_col(c) - begwb_col(c) & - (forc_rain_col(c) & + forc_snow_col(c) & - + qflx_floodc(c) & - + qflx_sfc_irrig(c) & - + qflx_glcice_dyn_water_flux(c) & - - qflx_evap_tot(c) & - - qflx_surf(c) & - - qflx_qrgwl(c) & - - qflx_drain(c) & - - qflx_drain_perched(c) & - - qflx_ice_runoff(c) & - - qflx_snwcp_discarded_liq(c) & - - qflx_snwcp_discarded_ice(c)) * dtime + + qflx_flood_col(c) & + + qflx_sfc_irrig_col(c) & + + qflx_glcice_dyn_water_flux_col(c) & + - qflx_evap_tot_col(c) & + - qflx_surf_col(c) & + - qflx_qrgwl_col(c) & + - qflx_drain_col(c) & + - qflx_drain_perched_col(c) & + - qflx_ice_runoff_col(c) & + - qflx_snwcp_discarded_liq_col(c) & + - qflx_snwcp_discarded_ice_col(c)) * dtime else @@ -587,25 +587,25 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'endwb_col = ',endwb_col(indexc) write(iulog,*)'begwb_col = ',begwb_col(indexc) - write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot(indexc)*dtime - write(iulog,*)'qflx_sfc_irrig = ',qflx_sfc_irrig(indexc)*dtime - write(iulog,*)'qflx_surf = ',qflx_surf(indexc)*dtime - write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl(indexc)*dtime - write(iulog,*)'qflx_drain = ',qflx_drain(indexc)*dtime + write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot_col(indexc)*dtime + write(iulog,*)'qflx_sfc_irrig = ',qflx_sfc_irrig_col(indexc)*dtime + write(iulog,*)'qflx_surf = ',qflx_surf_col(indexc)*dtime + write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl_col(indexc)*dtime + write(iulog,*)'qflx_drain = ',qflx_drain_col(indexc)*dtime - write(iulog,*)'qflx_ice_runoff = ',qflx_ice_runoff(indexc)*dtime + write(iulog,*)'qflx_ice_runoff = ',qflx_ice_runoff_col(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq(indexc)*dtime + write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice_col(indexc)*dtime + write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq_col(indexc)*dtime write(iulog,*)'deltawb = ',endwb_col(indexc)-begwb_col(indexc) write(iulog,*)'deltawb/dtime = ',(endwb_col(indexc)-begwb_col(indexc))/dtime if (.not.(col%itype(indexc) == icol_roof .or. & col%itype(indexc) == icol_road_imperv .or. & col%itype(indexc) == icol_road_perv)) then - write(iulog,*)'qflx_drain_perched = ',qflx_drain_perched(indexc)*dtime - write(iulog,*)'qflx_flood = ',qflx_floodc(indexc)*dtime - write(iulog,*)'qflx_glcice_dyn_water_flux = ', qflx_glcice_dyn_water_flux(indexc)*dtime + write(iulog,*)'qflx_drain_perched = ',qflx_drain_perched_col(indexc)*dtime + write(iulog,*)'qflx_flood = ',qflx_flood_col(indexc)*dtime + write(iulog,*)'qflx_glcice_dyn_water_flux = ', qflx_glcice_dyn_water_flux_col(indexc)*dtime end if write(iulog,*)'clm model is stopping' @@ -618,15 +618,15 @@ subroutine BalanceCheck( bounds, & ! Water balance check at the grid cell level call c2g( bounds, & - qflx_glcice_dyn_water_flux(bounds%begc:bounds%endc), & + qflx_glcice_dyn_water_flux_col(bounds%begc:bounds%endc), & qflx_glcice_dyn_water_flux_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) call c2g( bounds, & - qflx_snwcp_discarded_liq(bounds%begc:bounds%endc), & + qflx_snwcp_discarded_liq_col(bounds%begc:bounds%endc), & qflx_snwcp_discarded_liq_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) call c2g( bounds, & - qflx_snwcp_discarded_ice(bounds%begc:bounds%endc), & + qflx_snwcp_discarded_ice_col(bounds%begc:bounds%endc), & qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) @@ -634,8 +634,8 @@ subroutine BalanceCheck( bounds, & errh2o_grc(g) = endwb_grc(g) - begwb_grc(g) & - (forc_rain_grc(g) & + forc_snow_grc(g) & - + qflx_flood_grc(g) & - + qirrig_grc(g) & + + forc_flood_grc(g) & + + qflx_sfc_irrig_grc(g) & + qflx_glcice_dyn_water_flux_grc(g) & - qflx_evap_tot_grc(g) & - qflx_surf_grc(g) & @@ -667,7 +667,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'begwb_grc = ',begwb_grc(indexg) write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot_grc(indexg)*dtime - write(iulog,*)'qirrig = ',qirrig_grc(indexg)*dtime + write(iulog,*)'qflx_sfc_irrig = ',qflx_sfc_irrig_grc(indexg)*dtime write(iulog,*)'qflx_surf = ',qflx_surf_grc(indexg)*dtime write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl_grc(indexg)*dtime write(iulog,*)'qflx_drain = ',qflx_drain_grc(indexg)*dtime @@ -677,7 +677,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'deltawb = ',endwb_grc(indexg)-begwb_grc(indexg) write(iulog,*)'deltawb/dtime = ',(endwb_grc(indexg)-begwb_grc(indexg))/dtime write(iulog,*)'qflx_drain_perched = ',qflx_drain_perched_grc(indexg)*dtime - write(iulog,*)'qflx_flood = ',qflx_flood_grc(indexg)*dtime + write(iulog,*)'forc_flood = ',forc_flood_grc(indexg)*dtime write(iulog,*)'qflx_glcice_dyn_water_flux_grc = ',qflx_glcice_dyn_water_flux_grc(indexg)*dtime write(iulog,*)'clm model is stopping' @@ -709,7 +709,7 @@ subroutine BalanceCheck( bounds, & + qflx_liqdew_to_top_layer(c) snow_sinks(c) = qflx_solidevap_from_top_layer(c) + qflx_liqevap_from_top_layer(c) & + qflx_snow_drain(c) + qflx_snwcp_ice(c) + qflx_snwcp_liq(c) & - + qflx_snwcp_discarded_ice(c) + qflx_snwcp_discarded_liq(c) & + + qflx_snwcp_discarded_ice_col(c) + qflx_snwcp_discarded_liq_col(c) & + qflx_sl_top_soil(c) if (lun%itype(l) == istdlak) then @@ -718,7 +718,7 @@ subroutine BalanceCheck( bounds, & + qflx_soliddew_to_top_layer(c) + qflx_liqdew_to_top_layer(c) ) snow_sinks(c) = frac_sno_eff(c) * (qflx_solidevap_from_top_layer(c) & + qflx_liqevap_from_top_layer(c) ) + qflx_snwcp_ice(c) + qflx_snwcp_liq(c) & - + qflx_snwcp_discarded_ice(c) + qflx_snwcp_discarded_liq(c) & + + qflx_snwcp_discarded_ice_col(c) + qflx_snwcp_discarded_liq_col(c) & + qflx_snow_drain(c) + qflx_sl_top_soil(c) endif @@ -731,7 +731,7 @@ subroutine BalanceCheck( bounds, & + qflx_h2osfc_to_ice(c) snow_sinks(c) = frac_sno_eff(c) * (qflx_solidevap_from_top_layer(c) & + qflx_liqevap_from_top_layer(c)) + qflx_snwcp_ice(c) + qflx_snwcp_liq(c) & - + qflx_snwcp_discarded_ice(c) + qflx_snwcp_discarded_liq(c) & + + qflx_snwcp_discarded_ice_col(c) + qflx_snwcp_discarded_liq_col(c) & + qflx_snow_drain(c) + qflx_sl_top_soil(c) endif @@ -780,8 +780,8 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'qflx_liqdew_to_top_layer = ',qflx_liqdew_to_top_layer(indexc)*dtime write(iulog,*)'qflx_snwcp_ice = ',qflx_snwcp_ice(indexc)*dtime write(iulog,*)'qflx_snwcp_liq = ',qflx_snwcp_liq(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq(indexc)*dtime + write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice_col(indexc)*dtime + write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq_col(indexc)*dtime write(iulog,*)'qflx_sl_top_soil = ',qflx_sl_top_soil(indexc)*dtime write(iulog,*)'clm model is stopping' call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) From 1e1562777e061d6b70a203c6abb9a2880fd7e5ea Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 18 Dec 2020 00:52:39 -0800 Subject: [PATCH 1694/1973] fixing calls to refactored CNFireFactoryMod --- src/biogeochem/CNFireFactoryMod.F90 | 3 +-- src/utils/clmfates_interfaceMod.F90 | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index 603521a209..9ec8f8254d 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -17,7 +17,7 @@ module CNFireFactoryMod ! !PUBLIC ROUTINES: public :: CNFireReadNML ! read the fire namelist public :: create_cnfire_method ! create an object of class fire_method_type - public :: create_fates_fire_data_method ! create an object of class cnfire_method_type + public :: create_fates_fire_data_method ! create an object of class fates_fire_base_type ! These parameters set the ranges of the cases in subroutine ! create_fates_fire_data_method. We declare them public in order to @@ -144,7 +144,6 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) ! ! !USES: use clm_varctl, only: fates_spitfire_mode - use CNFireMethodMod, only: cnfire_method_type use FATESFireBase, only: fates_fire_base_type use FATESFireNoDataMod, only: fates_fire_no_data_type use FATESFireDataMod, only: fates_fire_data_type diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index ab62a6cb6f..1d1ee04baf 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -2238,7 +2238,7 @@ subroutine InterpFileInputs(this, bounds) call t_startf('fates_interpfileinputs') - call this%fates_fire_data_method%CNFireInterp(bounds) + call this%fates_fire_data_method%FireInterp(bounds) call t_stopf('fates_interpfileinputs') @@ -2266,7 +2266,7 @@ subroutine Init2(this, bounds, NLFilename) call t_startf('fates_init2') - call this%fates_fire_data_method%CNFireInit(bounds, NLFilename) + call this%fates_fire_data_method%FireInit(bounds, NLFilename) call t_stopf('fates_init2') From 9d96016eca31ffc167c80c1fbe45ed62f71cfa00 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Dec 2020 11:28:55 -0700 Subject: [PATCH 1695/1973] @swesosc found this update to min stem diameter allows the simulations to run --- src/biogeophys/CanopyFluxesMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index a927066f97..36edd7761c 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -425,7 +425,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume real(r8), parameter :: k_cyl_area = 1.0 !departure from cylindrical area real(r8), parameter :: k_internal = 0.0 !self-absorbtion of leaf/stem longwave - real(r8), parameter :: min_stem_diameter = 0.01!minimum stem diameter for which to calculate stem interactions + real(r8), parameter :: min_stem_diameter = 0.05!minimum stem diameter for which to calculate stem interactions integer :: dummy_to_make_pgi_happy !------------------------------------------------------------------------------ From 0c4a1d8871cf53a081c592916cebda9e73f02a63 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 18 Dec 2020 16:13:45 -0700 Subject: [PATCH 1696/1973] Fix ndep from coupler Resolves ESCOMP/CTSM#1233 --- src/cpl/mct/lnd_import_export.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpl/mct/lnd_import_export.F90 b/src/cpl/mct/lnd_import_export.F90 index 459faeadcd..afdf575a30 100644 --- a/src/cpl/mct/lnd_import_export.F90 +++ b/src/cpl/mct/lnd_import_export.F90 @@ -169,6 +169,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst, wat ! Note that forc_pbot is in Pa do g = begg,endg + i = 1 + (g - begg) forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) From 64d6fedd3dfea0e6d50a3294caed57bec43fb932 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 19 Dec 2020 07:02:05 -0700 Subject: [PATCH 1697/1973] Update ChangeLog --- doc/ChangeLog | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 128 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 2f0751eb16..5642709fc1 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,131 @@ =============================================================== +Tag name: ctsm5.1.dev019 +Originator(s): sacks (Bill Sacks) +Date: Sat Dec 19 06:55:46 MST 2020 +One-line Summary: Fix ndep from coupler + +Purpose of changes +------------------ + +There was a bug in ndep forcing (forc_ndep_grc) when receiving ndep from +CAM (ndep_from_cpl true). This first appeared in ctsm5.1.dev002. NDEP +forcings have been garbage since then when receiving ndep from CAM. + +This tag fixes that issue. + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1233 (ndep forcing incorrect when receiving ndep + from CAM (starting with ctsm5.1.dev002)) + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: none expected (not checked) + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): none + +Changes to tests or testing: none + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - not run + + tools-tests (test/tools): + + cheyenne - not run + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - not run + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - not run + + regular tests (aux_clm): + + cheyenne ---- pass + izumi ------- pass + + izumi testing: baseline generation failed due to running out of disk + space. I have sym linked the ctsm5.1.dev018 baselines to + ctsm5.1.dev019, because answers are bit-for-bit between the two tags + as far as aux_clm testing is concerned. + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but just in select coupled configurations + + [ If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section). + And always remove these three lines and parts that don't apply. ] + + Summarize any changes to answers, i.e., + - what code configurations: Coupled configurations where CTSM + receives NDEP from CAM + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + potentially new climate + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + - casename: N/A + + URL for LMWG diagnostics output used to validate new climate: N/A + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none + +Pull Requests that document the changes (include PR ids): none + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev018 Originator(s): slevis (Samuel Levis,,303-665-1310) Date: Tue Dec 8 11:19:02 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 510d1612c5..3789dbee16 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler ctsm5.1.dev018 slevis 12/08/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file ctsm5.1.dev016 multiple 11/17/2020 Updates for nuopc From bf37912f23f8aec28890bcba3055020d8b7e9998 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 19 Dec 2020 13:10:42 -0700 Subject: [PATCH 1698/1973] remove extraneous write statement --- src/cpl/nuopc/lnd_import_export.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index a705060911..c951e39505 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -543,7 +543,6 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! Atmosphere prognostic/prescribed aerosol fields if (fldchk(importState, 'Faxa_bcph')) then - write(6,*)'i am here' call state_getfldptr(importState, 'Faxa_bcph', fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call check_for_nans(fldptr2d(1,:), 'Faxa_bcph(1)', begg) From 77b48f3f82fd1002b46b8208c219a15b3f47776f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 19 Dec 2020 20:03:34 -0700 Subject: [PATCH 1699/1973] fixed bugs --- src/cpl/nuopc/lnd_import_export.F90 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index c951e39505..8c9359c3a4 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -687,15 +687,17 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & else wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 end if + if (fldchk(importState, 'Flrr_volr')) then - call state_getfldptr(importState, 'Flrr_flood', fldptr1d=fldptr1d, rc=rc ) + call state_getfldptr(importState, 'Flrr_volr', fldptr1d=fldptr1d, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg - wateratm2lndbulk_inst%forc_flood_grc(g) = fldptr1d(g-begg+1) * (ldomain%area(g) * 1.e6_r8) + wateratm2lndbulk_inst%volr_grc(g) = fldptr1d(g-begg+1) * (ldomain%area(g) * 1.e6_r8) end do else wateratm2lndbulk_inst%volr_grc(:) = 0._r8 end if + if (fldchk(importState, 'Flrr_volrmch')) then call state_getfldptr(importState, 'Flrr_volrmch', fldptr1d=fldptr1d, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -733,7 +735,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end do end if - if ( fldchk(importState, 'Sl_topo_elev')) then + if ( fldchk(importState, 'Flgg_hflx_elev')) then call state_getfldptr(importState, 'Flgg_hflx_elev', fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg @@ -752,7 +754,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end if if ( fldchk(importState, 'Sg_icemask_coupled_fluxes')) then - call state_getfldptr(importState, 'Sg_icemask', fldptr1d=fldptr1d, rc=rc) + call state_getfldptr(importState, 'Sg_icemask_coupled_fluxes', fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg icemask_coupled_fluxes_grc(g) = fldptr1d(g-begg+1) From c974d6dc4368958d509de694467c752af979b02f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 19 Dec 2020 20:14:40 -0700 Subject: [PATCH 1700/1973] cleaned up import name specification --- src/cpl/nuopc/lnd_import_export.F90 | 200 ++++++++++++++++------------ 1 file changed, 116 insertions(+), 84 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 8c9359c3a4..9169f5c1aa 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -94,7 +94,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r character(ESMF_MAXSTR) :: cvalue character(len=2) :: nec_str integer :: n, num - character(len=128) :: fldname + character(len=CS) :: fldname character(len=*), parameter :: subname='(lnd_import_export:advertise_fields)' !------------------------------------------------------------------------------- @@ -381,7 +381,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8), pointer :: dataPtr(:) real(r8), pointer :: fldPtr1d(:) real(r8), pointer :: fldPtr2d(:,:) - character(len=128) :: fldname + character(len=CS) :: fldname integer :: num integer :: begg, endg ! bounds integer :: g,i,k,n ! indices @@ -423,131 +423,149 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! Required atmosphere input fields !-------------------------- - call state_getfldptr(importState, 'Sa_z', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sa_z' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_z', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_hgt_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Sa_topo', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sa_topo' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_topo', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_topo_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Sa_u', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sa_u' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_u', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_u_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Sa_v', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sa_v' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_v', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_v_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Sa_ptem', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sa_ptem' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_ptem', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_th_not_downscaled_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Sa_shum', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sa_shum' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_shum', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Sa_pbot', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sa_pbot' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_pbot', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_pbot_not_downscaled_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Sa_tbot', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sa_tbot' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_tbot', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_t_not_downscaled_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_rainc', fldptr1d=fldptr1d, rc=rc) + fldname = 'Faxa_rainc' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Faxa_rainc', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg forc_rainc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_rainl', fldptr1d=fldptr1d, rc=rc) + fldname = 'Faxa_rainl' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Faxa_rainl', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg forc_rainl(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_snowc', fldptr1d=fldptr1d, rc=rc) + fldname = 'Faxa_snowc' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Faxa_snowc', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg forc_snowc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_snowl', fldptr1d=fldptr1d, rc=rc) + fldname = 'Faxa_snowl' + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Faxa_snowl', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg forc_snowl(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_lwdn', fldptr1d, rc=rc) - call check_for_nans(fldptr1d, 'Faxa_lwdn', begg) + fldname = 'Faxa_lwdn' + call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_swvdr', fldptr1d, rc=rc) + fldname = 'Faxa_swvdr' + call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Faxa_swvdr', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_solad_grc(g,1) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_swndr', fldptr1d, rc=rc) + fldname = 'Faxa_swndr' + call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Faxa_swndr', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_solad_grc(g,2) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_swvdf', fldptr1d, rc=rc) + fldname = 'Faxa_swvdf' + call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Faxa_swvdf', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_solai_grc(g,1) = fldptr1d(g-begg+1) end do - call state_getfldptr(importState, 'Faxa_swndf', fldptr1d, rc=rc) + fldname = 'Faxa_swndf' + call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Faxa_swndf', begg) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_solai_grc(g,2) = fldptr1d(g-begg+1) end do ! Atmosphere prognostic/prescribed aerosol fields - if (fldchk(importState, 'Faxa_bcph')) then - call state_getfldptr(importState, 'Faxa_bcph', fldptr2d=fldptr2d, rc=rc) + fldname = 'Faxa_bcph' + if (fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), 'Faxa_bcph(1)', begg) - call check_for_nans(fldptr2d(2,:), 'Faxa_bcph(2)', begg) - call check_for_nans(fldptr2d(3,:), 'Faxa_bcph(3)', begg) + call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) + call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) + call check_for_nans(fldptr2d(3,:), trim(fldname)//'(3)', begg) do g = begg, endg n = g - begg + 1 atm2lnd_inst%forc_aer_grc(g,1) = fldptr2d(1,n) ! bcphidry @@ -555,12 +573,13 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & atm2lnd_inst%forc_aer_grc(g,3) = fldptr2d(3,n) ! bcphiwet end do end if - if (fldchk(importState, 'Faxa_ocph')) then - call state_getfldptr(importState, 'Faxa_ocph', fldptr2d=fldptr2d, rc=rc) + fldname = 'Faxa_ocph' + if (fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), 'Faxa_ocph(1)', begg) - call check_for_nans(fldptr2d(2,:), 'Faxa_ocph(2)', begg) - call check_for_nans(fldptr2d(3,:), 'Faxa_ocph(3)', begg) + call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) + call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) + call check_for_nans(fldptr2d(3,:), trim(fldname)//'(3)', begg) do g = begg, endg n = g - begg + 1 atm2lnd_inst%forc_aer_grc(g,4) = fldptr2d(1,n) ! ocphidry @@ -568,14 +587,14 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & atm2lnd_inst%forc_aer_grc(g,6) = fldptr2d(3,n) ! ocphiwet end do end if - - if (fldchk(importState, 'Faxa_dstwet')) then - call state_getfldptr(importState, 'Faxa_dstwet', fldptr2d=fldptr2d, rc=rc) + fldname = 'Faxa_dstwet' + if (fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), 'Faxa_dstwet(1)', begg) - call check_for_nans(fldptr2d(2,:), 'Faxa_dstwet(2)', begg) - call check_for_nans(fldptr2d(3,:), 'Faxa_dstwet(3)', begg) - call check_for_nans(fldptr2d(4,:), 'Faxa_dstwet(4)', begg) + call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) + call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) + call check_for_nans(fldptr2d(3,:), trim(fldname)//'(3)', begg) + call check_for_nans(fldptr2d(4,:), trim(fldname)//'(4)', begg) do g = begg, endg n = g - begg + 1 atm2lnd_inst%forc_aer_grc(g,7) = fldptr2d(1,n) @@ -584,13 +603,14 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & atm2lnd_inst%forc_aer_grc(g,13) = fldptr2d(4,n) end do end if - if (fldchk(importState, 'Faxa_dstdry')) then - call state_getfldptr(importState, 'Faxa_dstdry', fldptr2d=fldptr2d, rc=rc) + fldname = 'Faxa_dstdry' + if (fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), 'Faxa_dstdry(1)', begg) - call check_for_nans(fldptr2d(2,:), 'Faxa_dstdry(2)', begg) - call check_for_nans(fldptr2d(3,:), 'Faxa_dstdry(3)', begg) - call check_for_nans(fldptr2d(4,:), 'Faxa_dstdry(4)', begg) + call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) + call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) + call check_for_nans(fldptr2d(3,:), trim(fldname)//'(3)', begg) + call check_for_nans(fldptr2d(4,:), trim(fldname)//'(4)', begg) do g = begg, endg n = g - begg + 1 atm2lnd_inst%forc_aer_grc(g,8) = fldptr2d(1,n) @@ -600,22 +620,23 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end if - if (fldchk(importState, 'Sa_methane')) then - call state_getfldptr(importState, 'Sa_methane', fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, 'Sa_methane', begg) + fldname = 'Sa_methane' + if (fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc ) + call check_for_nans(fldptr1d, trim(fldname), begg) do g = begg, endg atm2lnd_inst%forc_pch4_grc(g) = fldptr1d(g-begg+1) end do end if - if (fldchk(importState, 'Faxa_ndep')) then + fldname = 'Faxa_ndep' + if (fldchk(importState, trim(fldname))) then ! The mediator is sending ndep in units if kgN/m2/s - and ctsm ! uses units of gN/m2/sec so the following conversion needs to happen - call state_getfldptr(importState, 'Faxa_ndep', fldptr2d=fldptr2d, rc=rc) + call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), 'Faxa_ndep(1)', begg) - call check_for_nans(fldptr2d(2,:), 'Faxa_ndep(2)', begg) + call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) + call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) do g = begg, endg n = g - begg + 1 atm2lnd_inst%forc_ndep_grc(g) = (fldptr2d(1,n) + fldptr2d(2,n))*1000._r8 @@ -678,8 +699,9 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! so water sent from rof to land is negative, ! change the sign to indicate addition of water to system. - if (fldchk(importState, 'Flrr_flood')) then - call state_getfldptr(importState, 'Flrr_flood', fldptr1d=fldptr1d, rc=rc ) + fldname = 'Flrr_flood' + if (fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg wateratm2lndbulk_inst%forc_flood_grc(g) = -fldptr1d(g-begg+1) @@ -688,8 +710,9 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 end if - if (fldchk(importState, 'Flrr_volr')) then - call state_getfldptr(importState, 'Flrr_volr', fldptr1d=fldptr1d, rc=rc ) + fldname = 'Flrr_volr' + if (fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg wateratm2lndbulk_inst%volr_grc(g) = fldptr1d(g-begg+1) * (ldomain%area(g) * 1.e6_r8) @@ -698,8 +721,9 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & wateratm2lndbulk_inst%volr_grc(:) = 0._r8 end if - if (fldchk(importState, 'Flrr_volrmch')) then - call state_getfldptr(importState, 'Flrr_volrmch', fldptr1d=fldptr1d, rc=rc ) + fldname = 'Flrr_volrmch' + if (fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg wateratm2lndbulk_inst%volrmch_grc(g) = fldptr1d(g-begg+1) * (ldomain%area(g) * 1.e6_r8) @@ -717,8 +741,9 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! help with performance. (The downside would be that we wouldn't have these fields ! available for diagnostic purposes or to force a later T compset with dlnd.) - if ( fldchk(importState, 'Sg_ice_covered_elev')) then - call state_getfldptr(importState, 'Sg_ice_covered_elev', fldptr2d=fldptr2d, rc=rc) + fldname = 'Sg_ice_covered_elev' + if ( fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg do num = 0,glc_nec @@ -726,8 +751,10 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end do end if - if ( fldchk(importState, 'Sl_topo_elev')) then - call state_getfldptr(importState, 'Sg_topo_elev', fldptr2d=fldptr2d, rc=rc) + + fldname = 'Sg_topo_elev' + if ( fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg do num = 0,glc_nec @@ -735,8 +762,10 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end do end if - if ( fldchk(importState, 'Flgg_hflx_elev')) then - call state_getfldptr(importState, 'Flgg_hflx_elev', fldptr2d=fldptr2d, rc=rc) + + fldname = 'Flgg_hflx_elev' + if ( fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg do num = 0,glc_nec @@ -746,15 +775,18 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & else hflx_grc(:,:) = 0._r8 end if - if ( fldchk(importState, 'Sg_icemask')) then - call state_getfldptr(importState, 'Sg_icemask', fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + + fldname = 'Sg_icemask' + if ( fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) do g = begg, endg icemask_grc(g) = fldptr1d(g-begg+1) end do end if - if ( fldchk(importState, 'Sg_icemask_coupled_fluxes')) then - call state_getfldptr(importState, 'Sg_icemask_coupled_fluxes', fldptr1d=fldptr1d, rc=rc) + + fldname = 'Sg_icemask_coupled_fluxes' + if ( fldchk(importState, trim(fldname))) then + call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg icemask_coupled_fluxes_grc(g) = fldptr1d(g-begg+1) From 39e2f8625703a5ac4bb5e5025bb9c269838966b0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 20 Dec 2020 00:55:32 -0700 Subject: [PATCH 1701/1973] Set new bhs variables on the params file for prognostic crop to the same as the values for grassland, they aren't actually used and the tests: ERS_Ly5_P144x1.f10_f10_musgs.IHistClm51BgcCrop.cheyenne_intel.clm-cropMonthOutput and SMS_Lm13.f19_g17.I2000Clm51BgcCrop.cheyenne_intel.clm-cropMonthOutput show that answers don't change. This is because effectively these parameters only matter for tree and shrubs and aren't used for other veg types --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 9b28e857d6..bd04e99e80 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -472,7 +472,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c201215.nc +lnd/clm2/paramdata/ctsm51_params.c201220.nc lnd/clm2/paramdata/clm50_params.c200905.nc lnd/clm2/paramdata/clm45_params.c200905.nc From e289ca0c8934b8e04fdaf7ddf4dbe648ec851bb2 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 20 Dec 2020 11:17:35 -0700 Subject: [PATCH 1702/1973] cleaned up export name specification --- src/cpl/nuopc/lnd_import_export.F90 | 219 ++++++++++++++++------------ 1 file changed, 127 insertions(+), 92 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 9169f5c1aa..ae0813135a 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -400,7 +400,6 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8) :: icemask_grc(bounds%begg:bounds%endg) real(r8) :: icemask_coupled_fluxes_grc(bounds%begg:bounds%endg) character(len=*), parameter :: subname='(lnd_import_export:import_fields)' - !--------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -832,6 +831,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & type(ESMF_State) :: exportState real(r8), pointer :: fldPtr1d(:) real(r8), pointer :: fldPtr2d(:,:) + character(len=CS) :: fldname integer :: begg, endg ! bounds integer :: i, g, num real(r8) :: array(bounds%begg:bounds%endg) @@ -851,8 +851,9 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! ----------------------- ! output to mediator ! ----------------------- - if (fldchk(exportState, 'Sl_lfrin')) then - call state_getfldptr(exportState, 'Sl_lfrin', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_lfrin' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg @@ -863,128 +864,144 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! ----------------------- ! output to atm ! ----------------------- - if (fldchk(exportState, 'Sl_t')) then - call state_getfldptr(exportState, 'Sl_t', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_t' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%t_rad_grc(g) end do end if - if (fldchk(exportState, 'Sl_snowh')) then - call state_getfldptr(exportState, 'Sl_snowh', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_snowh' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%h2osno_grc(g) end do end if - if (fldchk(exportState, 'Sl_avsdr')) then - call state_getfldptr(exportState, 'Sl_avsdr', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_avsdr' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%albd_grc(g,1) end do end if - if (fldchk(exportState, 'Sl_anidr')) then - call state_getfldptr(exportState, 'Sl_anidr', fldptr1d=fldptr1d, rc=rc) + fldname='Sl_anidr' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%albd_grc(g,2) end do end if - if (fldchk(exportState, 'Sl_avsdf')) then - call state_getfldptr(exportState, 'Sl_avsdf', fldptr1d=fldptr1d, rc=rc) + fldname= 'Sl_avsdf' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%albi_grc(g,1) end do end if - if (fldchk(exportState, 'Sl_anidf')) then - call state_getfldptr(exportState, 'Sl_anidf', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_anidf' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%albi_grc(g,2) end do end if - if (fldchk(exportState, 'Sl_tref')) then - call state_getfldptr(exportState, 'Sl_tref', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_tref' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%t_ref2m_grc(g) end do end if - if (fldchk(exportState, 'Sl_qref')) then - call state_getfldptr(exportState, 'Sl_qref', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_qref' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%q_ref2m_grc(g) end do end if - if (fldchk(exportState, 'Fall_taux')) then - call state_getfldptr(exportState, 'Fall_taux', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_taux' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = -lnd2atm_inst%taux_grc(g) end do end if - if (fldchk(exportState, 'Fall_tauy')) then - call state_getfldptr(exportState, 'Fall_tauy', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_tauy' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = -lnd2atm_inst%tauy_grc(g) end do end if - if (fldchk(exportState, 'Fall_lat')) then - call state_getfldptr(exportState, 'Fall_lat', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_lat' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_lh_tot_grc(g) end do end if - if (fldchk(exportState, 'Fall_sen')) then - call state_getfldptr(exportState, 'Fall_sen', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_sen' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_sh_tot_grc(g) end do end if - if (fldchk(exportState, 'Fall_lwup')) then - call state_getfldptr(exportState, 'Fall_lwup', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_lwup' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_lwrad_out_grc(g) end do end if - if (fldchk(exportState, 'Fall_evap')) then - call state_getfldptr(exportState, 'Fall_evap', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_evap' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = -waterlnd2atmbulk_inst%qflx_evap_tot_grc(g) end do end if - if (fldchk(exportState, 'Fall_swnet')) then - call state_getfldptr(exportState, 'Fall_swnet', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_swnet' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%fsa_grc(g) end do end if - if (fldchk(exportState, 'Fall_flxdst')) then - call state_getfldptr(exportState, 'Fall_flxdst', fldptr2d=fldptr2d, rc=rc) + fldname = 'Fall_flxdst' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr2d(:,:) = 0._r8 do g = begg, endg @@ -994,57 +1011,62 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & fldptr2d(4,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,4) end do end if - if (fldchk(exportState, 'Fall_methane')) then - call state_getfldptr(exportState, 'Fall_methane', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_methane' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = -lnd2atm_inst%ch4_surf_flux_tot_grc(g) end do end if - if (fldchk(exportState, 'Sl_u10')) then - call state_getfldptr(exportState, 'Sl_u10', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_u10' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%u_ref10m_grc(g) end do end if - if (fldchk(exportState, 'Sl_ram1')) then - call state_getfldptr(exportState, 'Sl_ram1', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_ram1' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%ram1_grc(g) end do end if - if (fldchk(exportState, 'Sl_fv')) then - call state_getfldptr(exportState, 'Sl_fv', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_fv' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = lnd2atm_inst%fv_grc(g) end do end if - if (fldchk(exportState, 'Sl_soilw')) then - call state_getfldptr(exportState, 'Sl_soilw', fldptr1d=fldptr1d, rc=rc) + fldname = 'Sl_soilw' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%h2osoi_vol_grc(g,1) end do end if - if (flds_co2b .or. flds_co2c) then - ! co2 from land - call state_getfldptr(exportState, 'Fall_fco2_lnd', fldptr1d=fldptr1d, rc=rc) + fldname = 'Fall_fco2_lnd' ! co2 from land + if (fldchk(exportState, trim(fldname) )) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = -lnd2atm_inst%net_carbon_exchange_grc(g) end do end if - if (fldchk(exportState, 'Sl_ddvel')) then - ! dry dep velocities - call state_getfldptr(exportState, 'Sl_ddvel', fldptr2d=fldptr2d, rc=rc) + fldname = 'Sl_ddvel' ! dry dep velocities + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr2d(:,:) = 0._r8 do g = begg, endg @@ -1053,9 +1075,9 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end do end if - if (fldchk(exportState, 'Fall_voc')) then - ! megan voc emis fluxes - call state_getfldptr(exportState, 'Fall_voc', fldptr2d=fldptr2d, rc=rc) + fldname = 'Fall_voc' ! megan voc emis fluxes + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr2d(:,:) = 0._r8 do g = begg, endg @@ -1064,25 +1086,26 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end do end if - if (fldchk(exportState, 'Fall_fire')) then - if (emis_nflds > 0) then - ! fire emis fluxes - call state_getfldptr(exportState, 'Fall_fire', fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._r8 - do g = begg, endg - do num = 1, emis_nflds - fldptr2d(num,g-begg+1) = -lnd2atm_inst%fireflx_grc(g,num) - end do - end do - call state_getfldptr(exportState, 'Sl_fztop', fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%fireztop_grc(g) + fldname = 'Fall_fire' ! fire emis from land + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0._r8 + do g = begg, endg + do num = 1, emis_nflds + fldptr2d(num,g-begg+1) = -lnd2atm_inst%fireflx_grc(g,num) end do - end if - endif + end do + end if + fldname = 'Sl_fztop' ! fire emis from land + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + do g = begg, endg + fldptr1d(g-begg+1) = lnd2atm_inst%fireztop_grc(g) + end do + end if ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. ! i.e. water sent from land to rof is positive @@ -1096,17 +1119,20 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + & ! waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) ! end do - if (fldchk(exportState, 'Flrl_rofsur')) then - call state_getfldptr(exportState, 'Flrl_rofsur', fldptr1d=fldptr1d, rc=rc) + + fldname = 'Flrl_rofsur' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) end do end if - if (fldchk(exportState, 'Flrl_rofsub')) then - ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - call state_getfldptr(exportState, 'Flrl_rofsub', fldptr1d=fldptr1d, rc=rc) + + fldname = 'Flrl_rofsub' ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg @@ -1114,27 +1140,30 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) end do end if - if (fldchk(exportState, 'Flrl_rofgwl')) then - ! qgwl sent individually to coupler - call state_getfldptr(exportState, 'Flrl_rofgwl', fldptr1d=fldptr1d, rc=rc) + + fldname = 'Flrl_rofgwl' ! qgwl sent individually to mediator + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) end do end if - if (fldchk(exportState, 'Flrl_rofi')) then - ! ice sent individually to coupler - call state_getfldptr(exportState, 'Flrl_rofi', fldptr1d=fldptr1d, rc=rc) + + fldname = 'Flrl_rofi' ! ice sent individually to mediator + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofice_grc(g) end do end if - if (fldchk(exportState, 'Flrl_irrig')) then - ! irrigation flux to be removed from main channel storage (negative) - call state_getfldptr(exportState, 'Flrl_irrig', fldptr1d=fldptr1d, rc=rc) + + fldname = 'Flrl_irrig' ! irrigation flux to be removed from main channel storage (negative) + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 do g = begg, endg @@ -1148,8 +1177,10 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! We could avoid setting these fields if glc_present is .false., if that would ! help with performance. (The downside would be that we wouldn't have these fields ! available for diagnostic purposes or to force a later T compset with dlnd.) - if (fldchk(exportState, 'Sl_tsrf_elev')) then - call state_getfldptr(exportState, 'Sl_tsrf_elev', fldptr2d=fldptr2d, rc=rc) + + fldname = 'Sl_tsrf_elev' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr2d(:,:) = 0._r8 do g = begg, endg @@ -1158,8 +1189,10 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end do end if - if (fldchk(exportState, 'Sl_topo_elev')) then - call state_getfldptr(exportState, 'Sl_topo_elev', fldptr2d=fldptr2d, rc=rc) + + fldname = 'Sl_topo_elev' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr2d(:,:) = 0._r8 do g = begg, endg @@ -1168,8 +1201,10 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end do end if - if (fldchk(exportState, 'Flgl_qice_elev')) then - call state_getfldptr(exportState, 'Flgl_qice_elev', fldptr2d=fldptr2d, rc=rc) + + fldname = 'Flgl_qice_elev' + if (fldchk(exportState, trim(fldname))) then + call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr2d(:,:) = 0._r8 do g = begg, endg From b23838a70314d89a0d2c9343bb837dd8b55ace20 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 20 Dec 2020 20:29:48 -0700 Subject: [PATCH 1703/1973] Add Clm51Sp compsets, as now answers will diverge from Clm50 for those cases --- cime_config/config_compsets.xml | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index cc947a7439..de0139fc63 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -36,6 +36,11 @@ + + I1PtClm51SpRs + 2000_DATM%1PT_CLM51%SP_SICE_SOCN_SROF_SGLC_SWAV + + I1PtClm50SpRs 2000_DATM%1PT_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV @@ -59,6 +64,17 @@ 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm51Sp + 2000_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_MOSART_SGLC_SWAV + + + + + I2000Clm51SpRs + 2000_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm50SpRtm @@ -128,6 +144,11 @@ + + I1850Clm51Sp + 1850_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_MOSART_SGLC_SWAV + + I1850Clm51Bgc 1850_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV @@ -177,6 +198,10 @@ + + I2000Clm51Fates + 2000_DATM%GSWP3v1_CLM51%FATES_SICE_SOCN_MOSART_SGLC_SWAV + I2000Clm50Fates 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV @@ -213,6 +238,16 @@ + + I1850Clm51SpNoAnthro + 1850_DATM%GSWP3v1_CLM51%SP-NOANTHRO_SICE_SOCN_MOSART_SGLC_SWAV + + + + IHistClm51Sp + HIST_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_MOSART_SGLC_SWAV + + IHistClm51Bgc HIST_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV From 78baadc1bcbd52ae128edb9572f312e1213a3b3c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 20 Dec 2020 20:52:15 -0700 Subject: [PATCH 1704/1973] Add two new Clm51 tests with Sp on --- cime_config/testdefs/testlist_clm.xml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 2e3ff301f6..cebb54f7f5 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -381,12 +381,13 @@ - + + @@ -423,6 +424,15 @@ + + + + + + + + + From 50d751bf326fb9c7f958e794156806b1c4c3d8a9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Dec 2020 00:53:17 -0700 Subject: [PATCH 1705/1973] Convert a Clm50 Fates test to Clm51 since we now have changes that show up outside of BGC tests --- cime_config/testdefs/testlist_clm.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index cebb54f7f5..c673d4e544 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1973,12 +1973,13 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + + From 5d293bb0aa9e879fe585ccee1af511a413acfdce Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Dec 2020 13:33:01 -0700 Subject: [PATCH 1706/1973] Some minor formatting changes and work on comments a bit --- src/biogeochem/CNVegStructUpdateMod.F90 | 6 +- src/biogeophys/BareGroundFluxesMod.F90 | 14 ++--- src/biogeophys/CanopyFluxesMod.F90 | 79 ++++++++++++++----------- src/biogeophys/SoilFluxesMod.F90 | 4 +- src/main/pftconMod.F90 | 4 ++ 5 files changed, 61 insertions(+), 46 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 1066c93e43..e3c529d119 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -233,15 +233,17 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & endif + ! ! calculate vegetation physiological parameters used in biomass heat storage + ! if (use_biomass_heat_storage) then - ! Assumes fbw the same for leaves and stems + ! Assumes fbw (fraction of biomass that is water) is the same for leaves and stems leaf_biomass(p) = max(0.0025_r8,leafc(p)) & * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) stem_biomass(p) = (deadstemc(p) + livestemc(p)) & * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) - + if (spinup_state == 2) then stem_biomass(p) = 10._r8 * stem_biomass(p) end if diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index 7520543de9..89893e3aa4 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -146,8 +146,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & !------------------------------------------------------------------------------ associate( & - dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] - eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] + dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] + eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:,:) ] evaporative soil resistance (s/m) snl => col%snl , & ! Input: [integer (:) ] number of snow layers dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) @@ -244,11 +244,11 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & ram1 => frictionvel_inst%ram1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) num_iter => frictionvel_inst%num_iter_patch , & ! Output: [real(r8) (:) ] number of iterations htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of evaporation (/sublimation) [J/kg] - qflx_ev_snow => waterfluxbulk_inst%qflx_ev_snow_patch , & ! Output: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] - qflx_ev_soil => waterfluxbulk_inst%qflx_ev_soil_patch , & ! Output: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] - qflx_ev_h2osfc => waterfluxbulk_inst%qflx_ev_h2osfc_patch , & ! Output: [real(r8) (:) ] evaporation flux from h2osfc (mm H2O/s) [+ to atm] - qflx_evap_soi => waterfluxbulk_inst%qflx_evap_soi_patch , & ! Output: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_evap_tot => waterfluxbulk_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg + qflx_ev_snow => waterfluxbulk_inst%qflx_ev_snow_patch , & ! Output: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] + qflx_ev_soil => waterfluxbulk_inst%qflx_ev_soil_patch , & ! Output: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] + qflx_ev_h2osfc => waterfluxbulk_inst%qflx_ev_h2osfc_patch , & ! Output: [real(r8) (:) ] evaporation flux from h2osfc (mm H2O/s) [+ to atm] + qflx_evap_soi => waterfluxbulk_inst%qflx_evap_soi_patch , & ! Output: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) + qflx_evap_tot => waterfluxbulk_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg qflx_tran_veg => waterfluxbulk_inst%qflx_tran_veg_patch , & ! Output: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) qflx_evap_veg => waterfluxbulk_inst%qflx_evap_veg_patch , & ! Output: [real(r8) (:) ] vegetation evaporation (mm H2O/s) (+ = to atm) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 36edd7761c..eba84b814e 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -51,7 +51,7 @@ module CanopyFluxesMod ! ! !PUBLIC TYPES: implicit none - ! + ! ! !PUBLIC MEMBER FUNCTIONS: public :: CanopyFluxesReadNML ! Read in namelist settings public :: CanopyFluxes ! Calculate canopy fluxes @@ -299,8 +299,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: rppdry ! fraction of potential evaporation through transp [-] real(r8) :: cf ! heat transfer coefficient from leaves [-] real(r8) :: rb(bounds%begp:bounds%endp) ! leaf boundary layer resistance [s/m] - real(r8) :: rah(bounds%begp:bounds%endp,2) ! thermal resistance [s/m] - real(r8) :: raw(bounds%begp:bounds%endp,2) ! moisture resistance [s/m] + real(r8) :: rah(bounds%begp:bounds%endp,2) ! thermal resistance [s/m] (air, ground) + real(r8) :: raw(bounds%begp:bounds%endp,2) ! moisture resistance [s/m] (air, ground) real(r8) :: wta ! heat conductance for air [m/s] real(r8) :: wtg(bounds%begp:bounds%endp) ! heat conductance for ground [m/s] real(r8) :: wtl ! heat conductance for leaf [m/s] @@ -418,15 +418,18 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed real(r8) :: carea_stem !cross-sectional area of stem + ! Indices for raw and rah + integer, parameter :: above_canopy = 1 ! Above canopy + integer, parameter :: below_canopy = 2 ! Below canopy ! Biomass heat storage tuning parameters ! These parameters can be used to account for differences ! in vegetation shape. - real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem - real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume - real(r8), parameter :: k_cyl_area = 1.0 !departure from cylindrical area - real(r8), parameter :: k_internal = 0.0 !self-absorbtion of leaf/stem longwave - real(r8), parameter :: min_stem_diameter = 0.05!minimum stem diameter for which to calculate stem interactions - + real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem + real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume + real(r8), parameter :: k_cyl_area = 1.0 !departure from cylindrical area + real(r8), parameter :: k_internal = 0.0 !self-absorbtion of leaf/stem longwave + real(r8), parameter :: min_stem_diameter = 0.05 !minimum stem diameter for which to calculate stem interactions + integer :: dummy_to_make_pgi_happy !------------------------------------------------------------------------------ @@ -434,10 +437,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, SHR_ASSERT_ALL_FL((ubound(leafn_patch) == (/bounds%endp/)), sourcefile, __LINE__) associate( & - t_stem => temperature_inst%t_stem_patch , & ! Output: [real(r8) (:) ] stem temperature (Kelvin) - dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] + t_stem => temperature_inst%t_stem_patch , & ! Output: [real(r8) (:) ] stem temperature (Kelvin) + dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Output: [real(r8) (:) ] change in heat storage of stem (W/m**2) [+ to atm] soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:) ] soil evaporative resistance - snl => col%snl , & ! Input: [integer (:) ] number of snow layers + snl => col%snl , & ! Input: [integer (:) ] number of snow layers dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) max_dayl => grc%max_dayl , & ! Input: [real(r8) (:) ] maximum daylength for this grid cell (s) is_tree => pftcon%is_tree , & ! Input: tree patch or not @@ -446,11 +449,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, dbh_param => pftcon%dbh , & ! Input: diameter at brest height (m) fbw => pftcon%fbw , & ! Input: fraction of biomass that is water nstem => pftcon%nstem , & ! Input: stem number density (#ind/m2) - rstem_per_dbh => pftcon%rstem_per_dbh , & ! Input: stem resistance per stem diameter (s/m**2) + rstem_per_dbh => pftcon%rstem_per_dbh , & ! Input: stem resistance per stem diameter (s/m**2) wood_density => pftcon%wood_density , & ! Input: dry wood density (kg/m3) forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - forc_q => wateratm2lndbulk_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) + forc_q => wateratm2lndbulk_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) forc_th => atm2lnd_inst%forc_th_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric potential temperature (Kelvin) forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] density (kg/m**3) @@ -581,7 +584,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Output: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] + eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] eflx_sh_veg => energyflux_inst%eflx_sh_veg_patch , & ! Output: [real(r8) (:) ] sensible heat flux from leaves (W/m**2) [+ to atm] eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] rah1 => frictionvel_inst%rah1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance [s/m] @@ -679,7 +682,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, eflx_sh_stem(p) = 0._r8 end do - ! calculate biomass heat capacities + ! + ! Calculate biomass heat capacities + ! if(use_biomass_heat_storage) then bioms: do f = 1, fn p = filterp(f) @@ -709,18 +714,21 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! double in spirit of full surface area for sensible heat sa_leaf(p) = 2.*sa_leaf(p) + ! Surface area for stem sa_stem(p) = nstem(patch%itype(p))*(htop(p)*shr_const_pi*dbh(p)) ! adjust for departure of cylindrical stem model sa_stem(p) = k_cyl_area * sa_stem(p) + ! ! only calculate separate leaf/stem heat capacity for trees ! and shrubs if dbh is greater than some minimum value + ! (set surface area for stem, and fraction absorbed by stem to zero) if(.not.(is_tree(patch%itype(p)) .or. is_shrub(patch%itype(p))) & .or. dbh(p) < min_stem_diameter) then frac_rad_abs_by_stem(p) = 0.0 sa_stem(p) = 0.0 endif - + ! cross-sectional area of stems carea_stem = shr_const_pi * (dbh(p)*0.5)**2 @@ -733,7 +741,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, * nstem(patch%itype(p)) * wood_density(patch%itype(p)) & /(1.-fbw(patch%itype(p))) endif - + ! internal longwave fluxes between leaf and stem ! (use same area of interaction i.e. ignore leaf <-> leaf) sa_internal(p) = min(sa_leaf(p),sa_stem(p)) @@ -753,7 +761,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! resistance between internal stem temperature and canopy air rstem(p) = rstem_per_dbh(patch%itype(p))*dbh(p) - + enddo bioms else ! Otherwise set biomass heat storage terms to zero @@ -847,7 +855,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, end if - ! Modify aerodynamic parameters for sparse/dense canopy (X. Zeng) + !! Modify aerodynamic parameters for sparse/dense canopy (X. Zeng) + do f = 1, fn p = filterp(f) c = patch%column(p) @@ -1008,7 +1017,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, else csoilcn = csoilb*w + params_inst%csoilc*(1._r8-w) end if - + !! Sakaguchi changes for stability formulation ends here if (use_biomass_heat_storage) then @@ -1030,10 +1039,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, eah(p) = forc_pbot(c) * qaf(p) / 0.622_r8 ! pa rhaf(p) = eah(p)/svpts(p) ! variables for history fields - rah1(p) = rah(p,1) - raw1(p) = raw(p,1) - rah2(p) = rah(p,2) - raw2(p) = raw(p,2) + rah1(p) = rah(p,1) + raw1(p) = raw(p,1) + rah2(p) = rah(p,2) + raw2(p) = raw(p,2) vpd(p) = max((svpts(p) - eah(p)), 50._r8) * 0.001_r8 end do @@ -1093,12 +1102,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Sensible heat conductance for air, leaf and ground ! Moved the original subroutine in-line... - wta = 1._r8/rah(p,1) ! air - wtl = sa_leaf(p)/rb(p) ! leaf - wtg(p) = 1._r8/rah(p,2) ! ground - wtstem = sa_stem(p)/(rstem(p) + rb(p)) ! stem + wta = 1._r8/rah(p,1) ! air + wtl = sa_leaf(p)/rb(p) ! leaf + wtg(p) = 1._r8/rah(p,2) ! ground + wtstem = sa_stem(p)/(rstem(p) + rb(p)) ! stem - wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) + wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) ! air, leaf, stem and ground wtl0(p) = wtl*wtshi ! leaf wtg0 = wtg(p)*wtshi ! ground @@ -1111,7 +1120,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! internal longwave fluxes between leaf and stem lw_stem(p) = sa_internal(p) * emv(p) * sb * t_stem(p)**4 lw_leaf(p) = sa_internal(p) * emv(p) * sb * t_veg(p)**4 - + ! Fraction of potential evaporation from leaf if (fdry(p) > 0._r8) then @@ -1225,7 +1234,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +dc1*wtga(p) +dc2*wtgaq*qsatldT(p) + cp_leaf(p)/dtime) t_veg(p) = tlbef(p) + dt_veg(p) - + dels = dt_veg(p) del(p) = abs(dels) err(p) = 0._r8 @@ -1379,7 +1388,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, - ((t_veg(p)-tl_ini(p))*cp_leaf(p)/dtime) ! Update stem temperature; adjust outgoing longwave - ! does not account for changes in SH or internal LW, + ! does not account for changes in SH or internal LW, ! as that would change result for t_veg above if (use_biomass_heat_storage) then if (stem_biomass(p) > 0._r8) then @@ -1390,10 +1399,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, else dt_stem(p) = 0._r8 endif - + dhsdt_canopy(p) = dt_stem(p)*cp_stem(p)/dtime & +(t_veg(p)-tl_ini(p))*cp_leaf(p)/dtime - + t_stem(p) = t_stem(p) + dt_stem(p) else dt_stem(p) = 0._r8 diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index e9fa942afa..10082db373 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -88,7 +88,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & !----------------------------------------------------------------------- associate( & - eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] + eflx_sh_stem => energyflux_inst%eflx_sh_stem_patch , & ! Output: [real(r8) (:) ] sensible heat flux from stems (W/m**2) [+ to atm] eflx_h2osfc_to_snow_col => energyflux_inst%eflx_h2osfc_to_snow_col , & ! Input: [real(r8) (:) ] col snow melt to h2osfc heat flux (W/m**2) forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) @@ -316,7 +316,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! Total fluxes (vegetation + ground) eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_grnd(p) - if (.not. lun%urbpoi(l)) eflx_sh_tot(p) = eflx_sh_tot(p) + eflx_sh_stem(p) + if (.not. lun%urbpoi(l)) eflx_sh_tot(p) = eflx_sh_tot(p) + eflx_sh_stem(p) qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) eflx_lh_tot(p)= hvap*qflx_evap_veg(p) + htvp(c)*qflx_evap_soi(p) if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 219e556f51..d80ffa1acb 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -1032,6 +1032,10 @@ subroutine InitRead(this) ! Biomass heat storage variables ! if (use_biomass_heat_storage ) then + ! + ! These variables are used for stem biomass and only for tree and shrub + ! (They are effectively unused for other veg types) + ! call ncd_io('dbh',this%dbh, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('fbw',this%fbw, 'read', ncid, readvar=readv) From 51748a003affae62eae1a361a120bd85cd9b984a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Dec 2020 13:50:14 -0700 Subject: [PATCH 1707/1973] Use index parameters rather than hardcoded indices to better document what is going on --- src/biogeophys/CanopyFluxesMod.F90 | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index eba84b814e..56e3f6390a 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -972,8 +972,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Determine aerodynamic resistances ram1(p) = 1._r8/(ustar(p)*ustar(p)/um(p)) - rah(p,1) = 1._r8/(temp1(p)*ustar(p)) - raw(p,1) = 1._r8/(temp2(p)*ustar(p)) + rah(p,above_canopy) = 1._r8/(temp1(p)*ustar(p)) + raw(p,above_canopy) = 1._r8/(temp2(p)*ustar(p)) ! Bulk boundary layer resistance of leaves @@ -1022,14 +1022,14 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, if (use_biomass_heat_storage) then ! use uuc for ground fluxes (keep uaf for canopy terms) - rah(p,2) = 1._r8/(csoilcn*uuc(p)) + rah(p,below_canopy) = 1._r8/(csoilcn*uuc(p)) else - rah(p,2) = 1._r8/(csoilcn*uaf(p)) + rah(p,below_canopy) = 1._r8/(csoilcn*uaf(p)) endif - raw(p,2) = rah(p,2) + raw(p,below_canopy) = rah(p,below_canopy) if (use_lch4) then - grnd_ch4_cond(p) = 1._r8/(raw(p,1)+raw(p,2)) + grnd_ch4_cond(p) = 1._r8/(raw(p,above_canopy)+raw(p,below_canopy)) end if ! Stomatal resistances for sunlit and shaded fractions of canopy. @@ -1039,10 +1039,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, eah(p) = forc_pbot(c) * qaf(p) / 0.622_r8 ! pa rhaf(p) = eah(p)/svpts(p) ! variables for history fields - rah1(p) = rah(p,1) - raw1(p) = raw(p,1) - rah2(p) = rah(p,2) - raw2(p) = raw(p,2) + rah1(p) = rah(p,above_canopy) + raw1(p) = raw(p,above_canopy) + rah2(p) = rah(p,below_canopy) + raw2(p) = raw(p,below_canopy) vpd(p) = max((svpts(p) - eah(p)), 50._r8) * 0.001_r8 end do @@ -1102,9 +1102,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Sensible heat conductance for air, leaf and ground ! Moved the original subroutine in-line... - wta = 1._r8/rah(p,1) ! air + wta = 1._r8/rah(p,above_canopy) ! air wtl = sa_leaf(p)/rb(p) ! leaf - wtg(p) = 1._r8/rah(p,2) ! ground + wtg(p) = 1._r8/rah(p,below_canopy) ! ground wtstem = sa_stem(p)/(rstem(p) + rb(p)) ! stem wtshi = 1._r8/(wta+wtl+wtstem+wtg(p)) ! air, leaf, stem and ground @@ -1175,7 +1175,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Air has same conductance for both sensible and latent heat. ! Moved the original subroutine in-line... - wtaq = frac_veg_nosno(p)/raw(p,1) ! air + wtaq = frac_veg_nosno(p)/raw(p,above_canopy) ! air wtlq = frac_veg_nosno(p)*(elai(p)+esai(p))/rb(p) * rpp ! leaf !Litter layer resistance. Added by K.Sakaguchi @@ -1186,13 +1186,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! add litter resistance and Lee and Pielke 1992 beta if (delq(p) < 0._r8) then !dew. Do not apply beta for negative flux (follow old rsoil) - wtgq(p) = frac_veg_nosno(p)/(raw(p,2)+rdl) + wtgq(p) = frac_veg_nosno(p)/(raw(p,below_canopy)+rdl) else if (do_soilevap_beta()) then - wtgq(p) = soilbeta(c)*frac_veg_nosno(p)/(raw(p,2)+rdl) + wtgq(p) = soilbeta(c)*frac_veg_nosno(p)/(raw(p,below_canopy)+rdl) endif if (do_soil_resistance_sl14()) then - wtgq(p) = frac_veg_nosno(p)/(raw(p,2)+soilresis(c)) + wtgq(p) = frac_veg_nosno(p)/(raw(p,below_canopy)+soilresis(c)) endif end if From 7856d9927ac945a7175995536043680ad13c9742 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Dec 2020 15:08:39 -0700 Subject: [PATCH 1708/1973] Use nstem whether use_biomass_heat_storage is on or not, answers remain identical --- src/biogeochem/CNVegStructUpdateMod.F90 | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index e3c529d119..dde7fb27c5 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -145,16 +145,10 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & ! constant allometric parameters taper(:) = 200._r8 - if (use_biomass_heat_storage) then - do fp = 1,num_soilp - p = filter_soilp(fp) - stocking(p) = nstem(ivt(p)) - enddo - else - stocking(:) = 1000._r8 - ! convert from stems/ha -> stems/m^2 - stocking(:) = stocking(:) / 10000._r8 - endif + do fp = 1,num_soilp + p = filter_soilp(fp) + stocking(p) = nstem(ivt(p)) + enddo ! patch loop do fp = 1,num_soilp From 9085b77dcd4a41e736c943745b69f98365e86479 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Dec 2020 15:26:24 -0700 Subject: [PATCH 1709/1973] Set stocking back to a scalar and only use for CNDV, use nstem directly otherwise, which removes some extra memory use and hence should be more efficient --- src/biogeochem/CNVegStructUpdateMod.F90 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index dde7fb27c5..5dfb64f68b 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -69,7 +69,7 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & integer :: p,c,g ! indices integer :: fp ! lake filter indices real(r8) :: taper(bounds%begp:bounds%endp) ! ratio of height:radius_breast_height (tree allometry) - real(r8) :: stocking(bounds%begp:bounds%endp) ! #stems / ha (stocking density) + real(r8) :: stocking ! #stems / ha (stocking density) real(r8) :: ol ! thickness of canopy layer covered by snow (m) real(r8) :: fb ! fraction of canopy layer covered by snow real(r8) :: tlai_old ! for use in Zeng tsai formula @@ -145,11 +145,6 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & ! constant allometric parameters taper(:) = 200._r8 - do fp = 1,num_soilp - p = filter_soilp(fp) - stocking(p) = nstem(ivt(p)) - enddo - ! patch loop do fp = 1,num_soilp p = filter_soilp(fp) @@ -202,14 +197,14 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & end if ! trees and shrubs for now have a very simple allometry, with hard-wired - ! stem taper (height:radius) and hard-wired stocking density (#individuals/area) + ! stem taper (height:radius) and nstem from PFT parameter file if (use_cndv) then if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - stocking(p) = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area + stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area htop(p) = allom2(ivt(p)) * ( (24._r8 * deadstemc(p) / & - (SHR_CONST_PI * stocking(p) * dwood(ivt(p)) * taper(p)))**(1._r8/3._r8) )**allom3(ivt(p)) ! lpj's htop w/ cn's stemdiam + (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper(p)))**(1._r8/3._r8) )**allom3(ivt(p)) ! lpj's htop w/ cn's stemdiam else htop(p) = 0._r8 @@ -219,10 +214,10 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & !correct height calculation if doing accelerated spinup if (spinup_state == 2) then htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper(p) * taper(p))/ & - (SHR_CONST_PI * stocking(p) * dwood(ivt(p))))**(1._r8/3._r8) + (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) else htop(p) = ((3._r8 * deadstemc(p) * taper(p) * taper(p))/ & - (SHR_CONST_PI * stocking(p) * dwood(ivt(p))))**(1._r8/3._r8) + (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) end if endif From a354746c7187616ce29afefb78cdab4f221ce4b1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Dec 2020 16:56:40 -0700 Subject: [PATCH 1710/1973] Put taper as a hardcoded parameter in pftcon, use it rather than a large array. This improves memory efficiency and simplifies the CN code, also verify with SMS_Lm1.f10_f10_musgs.I1850Clm50BgcCropCmip6waccm.cheyenne_gnu.clm-basic that answers are identical --- src/biogeochem/CNVegStructUpdateMod.F90 | 21 ++++----------------- src/main/pftconMod.F90 | 10 ++++++++++ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 5dfb64f68b..1cb7dad82f 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -68,7 +68,6 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & ! !LOCAL VARIABLES: integer :: p,c,g ! indices integer :: fp ! lake filter indices - real(r8) :: taper(bounds%begp:bounds%endp) ! ratio of height:radius_breast_height (tree allometry) real(r8) :: stocking ! #stems / ha (stocking density) real(r8) :: ol ! thickness of canopy layer covered by snow (m) real(r8) :: fb ! fraction of canopy layer covered by snow @@ -105,6 +104,7 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & ztopmx => pftcon%ztopmx , & ! Input: laimx => pftcon%laimx , & ! Input: nstem => pftcon%nstem , & ! Input: Tree number density (#ind/m2) + taper => pftcon%taper , & ! Input: ratio of height:radius_breast_height (tree allometry) fbw => pftcon%fbw , & ! Input: Fraction of fresh biomass that is water allom2 => dgv_ecophyscon%allom2 , & ! Input: [real(r8) (:) ] ecophys const @@ -142,9 +142,6 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & dt = real( get_rad_step_size(), r8 ) - ! constant allometric parameters - taper(:) = 200._r8 - ! patch loop do fp = 1,num_soilp p = filter_soilp(fp) @@ -186,16 +183,6 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & if (woody(ivt(p)) == 1._r8) then - ! trees and shrubs - - ! if shrubs have a squat taper - if (ivt(p) >= nbrdlf_evr_shrub .and. ivt(p) <= nbrdlf_dcd_brl_shrub) then - taper(p) = 10._r8 - ! otherwise have a tall taper - else - taper(p) = 200._r8 - end if - ! trees and shrubs for now have a very simple allometry, with hard-wired ! stem taper (height:radius) and nstem from PFT parameter file if (use_cndv) then @@ -204,7 +191,7 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area htop(p) = allom2(ivt(p)) * ( (24._r8 * deadstemc(p) / & - (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper(p)))**(1._r8/3._r8) )**allom3(ivt(p)) ! lpj's htop w/ cn's stemdiam + (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper(ivt(p))))**(1._r8/3._r8) )**allom3(ivt(p)) ! lpj's htop w/ cn's stemdiam else htop(p) = 0._r8 @@ -213,10 +200,10 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & else !correct height calculation if doing accelerated spinup if (spinup_state == 2) then - htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper(p) * taper(p))/ & + htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper(ivt(p)) * taper(ivt(p)))/ & (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) else - htop(p) = ((3._r8 * deadstemc(p) * taper(p) * taper(p))/ & + htop(p) = ((3._r8 * deadstemc(p) * taper(ivt(p)) * taper(ivt(p)))/ & (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) end if diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index d80ffa1acb..91851e8626 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -152,6 +152,7 @@ module pftconMod real(r8), allocatable :: dbh (:) ! diameter at breast height (m) real(r8), allocatable :: fbw (:) ! fraction of biomass that is water real(r8), allocatable :: nstem (:) ! stem density (#/m2) + real(r8), allocatable :: taper (:) ! tapering ratio of height:radius_breast_height real(r8), allocatable :: rstem_per_dbh (:) ! stem resistance per dbh (s/m/m) real(r8), allocatable :: wood_density (:) ! wood density (kg/m3) @@ -480,6 +481,7 @@ subroutine InitAllocate (this) allocate( this%dbh (0:mxpft) ) allocate( this%fbw (0:mxpft) ) allocate( this%nstem (0:mxpft) ) + allocate( this%taper (0:mxpft) ) allocate( this%rstem_per_dbh (0:mxpft) ) allocate( this%wood_density (0:mxpft) ) @@ -1053,6 +1055,7 @@ subroutine InitRead(this) this%rstem_per_dbh = 0.0_r8 this%wood_density = 0.0_r8 end if + this%taper = 200._r8 ! Initialize taper to the same value everywhere (below change it for shrub) call ncd_pio_closefile(ncid) @@ -1175,6 +1178,13 @@ subroutine InitRead(this) else this%is_grass(m) = .false. endif + + ! Set taper differently if shrub + if ( this%is_shrub(m) )then + this%taper(m) = 10._r8 + else + this%taper(m) = 200._r8 + end if end do From 026d506401c6fb0b971f8b58547bd6aa6bb383eb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Dec 2020 17:35:12 -0700 Subject: [PATCH 1711/1973] Make sure constants are double precision. This does cause an apparant change in answers from the SMS_Lm13.f19_g17.I2000Clm51BgcCrop.cheyenne_intel.clm-cropMonthOutput test. It should only be a change at single precision roundoff level --- src/biogeophys/CanopyFluxesMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 56e3f6390a..b10df5bdcd 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -424,11 +424,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Biomass heat storage tuning parameters ! These parameters can be used to account for differences ! in vegetation shape. - real(r8), parameter :: k_vert = 0.1 !vertical distribution of stem - real(r8), parameter :: k_cyl_vol = 1.0 !departure from cylindrical volume - real(r8), parameter :: k_cyl_area = 1.0 !departure from cylindrical area - real(r8), parameter :: k_internal = 0.0 !self-absorbtion of leaf/stem longwave - real(r8), parameter :: min_stem_diameter = 0.05 !minimum stem diameter for which to calculate stem interactions + real(r8), parameter :: k_vert = 0.1_r8 !vertical distribution of stem + real(r8), parameter :: k_cyl_vol = 1.0_r8 !departure from cylindrical volume + real(r8), parameter :: k_cyl_area = 1.0_r8 !departure from cylindrical area + real(r8), parameter :: k_internal = 0.0_r8 !self-absorbtion of leaf/stem longwave + real(r8), parameter :: min_stem_diameter = 0.05_r8 !minimum stem diameter for which to calculate stem interactions integer :: dummy_to_make_pgi_happy !------------------------------------------------------------------------------ From 4f3a139d811226c89c82ab891e486ff9cda6ded9 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 21 Dec 2020 20:41:24 -0700 Subject: [PATCH 1712/1973] refactor lnd_import_export.F90 with better interfaces --- src/cpl/nuopc/lnd_import_export.F90 | 1101 +++++++++++---------------- 1 file changed, 451 insertions(+), 650 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index ae0813135a..4dd10675b4 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -66,6 +66,78 @@ module lnd_import_export integer :: glc_nec ! number of glc elevation classes integer, parameter :: debug = 0 ! internal debug level + ! import fields + character(*), parameter :: Sa_z = 'Sa_z' + character(*), parameter :: Sa_topo = 'Sa_topo' + character(*), parameter :: Sa_u = 'Sa_u' + character(*), parameter :: Sa_v = 'Sa_v' + character(*), parameter :: Sa_ptem = 'Sa_ptem' + character(*), parameter :: Sa_shum = 'Sa_shum' + character(*), parameter :: Sa_pbot = 'Sa_pbot' + character(*), parameter :: Sa_tbot = 'Sa_tbot' + character(*), parameter :: Faxa_rainc = 'Faxa_rainc' + character(*), parameter :: Faxa_rainl = 'Faxa_rainl' + character(*), parameter :: Faxa_snowc = 'Faxa_snowc' + character(*), parameter :: Faxa_snowl = 'Faxa_snowl' + character(*), parameter :: Faxa_lwdn = 'Faxa_lwdn' + character(*), parameter :: Faxa_swvdr = 'Faxa_swvdr' + character(*), parameter :: Faxa_swndr = 'Faxa_swndr' + character(*), parameter :: Faxa_swvdf = 'Faxa_swvdf' + character(*), parameter :: Faxa_swndf = 'Faxa_swndf' + character(*), parameter :: Faxa_bcph = 'Faxa_bcph' + character(*), parameter :: Faxa_ocph = 'Faxa_ocph' + character(*), parameter :: Faxa_dstwet = 'Faxa_dstwet' + character(*), parameter :: Faxa_dstdry = 'Faxa_dstdry' + character(*), parameter :: Sa_methane = 'Sa_methaneaxa_ndep' + character(*), parameter :: Faxa_ndep = 'Faxa_ndep' + character(*), parameter :: Sa_co2prog = 'Sa_co2prog' + character(*), parameter :: Sa_co2diag = 'Sa_co2diag' + character(*), parameter :: Flrr_flood = 'Flrr_flood' + character(*), parameter :: Flrr_volr = 'Flrr_volr' + character(*), parameter :: Flrr_volrmch = 'Flrr_volrmch' + character(*), parameter :: Sg_ice_covered_elev = 'Sg_ice_covered_elev' + character(*), parameter :: Sg_topo_elev = 'Sg_topo_elev' + character(*), parameter :: Flgg_hflx_elev = 'Flgg_hflx_elev' + character(*), parameter :: Sg_icemask = 'Sg_icemask' + character(*), parameter :: Sg_icemask_coupled_fluxes = 'Sg_icemask_coupled_fluxes' + + ! export fields + character(*), parameter :: Sl_lfrin = 'Sl_lfrin' + character(*), parameter :: Sl_t = 'Sl_t' + character(*), parameter :: Sl_snowh = 'Sl_snowh' + character(*), parameter :: Sl_avsdr = 'Sl_avsdr' + character(*), parameter :: Sl_anidr = 'Sl_anidr' + character(*), parameter :: Sl_avsdf = 'Sl_avsdf' + character(*), parameter :: Sl_anidf = 'Sl_anidf' + character(*), parameter :: Sl_tref = 'Sl_tref' + character(*), parameter :: Sl_qref = 'Sl_qref' + character(*), parameter :: Fall_taux = 'Fall_taux' + character(*), parameter :: Fall_tauy = 'Fall_tauy' + character(*), parameter :: Fall_lat = 'Fall_lat' + character(*), parameter :: Fall_sen = 'Fall_sen' + character(*), parameter :: Fall_lwup = 'Fall_lwup' + character(*), parameter :: Fall_evap = 'Fall_evap' + character(*), parameter :: Fall_swnet = 'Fall_swnet' + character(*), parameter :: Fall_flxdst = 'Fall_flxdst' + character(*), parameter :: Fall_methane = 'Fall_methane' + character(*), parameter :: Sl_u10 = 'Sl_u10' + character(*), parameter :: Sl_ram1 = 'Sl_ram1' + character(*), parameter :: Sl_fv = 'Sl_fv' + character(*), parameter :: Sl_soilw = 'Sl_soilw' + character(*), parameter :: Fall_fco2_lnd = 'Fall_fco2_lnd' + character(*), parameter :: Sl_ddvel = 'Sl_ddvel' + character(*), parameter :: Fall_voc = 'Fall_voc' + character(*), parameter :: Fall_fire = 'Fall_fire' + character(*), parameter :: Sl_fztop = 'Sl_fztop' + character(*), parameter :: Flrl_rofsur = 'Flrl_rofsur' + character(*), parameter :: Flrl_rofsub = 'Flrl_rofsub' + character(*), parameter :: Flrl_rofgwl = 'Flrl_rofgwl' + character(*), parameter :: Flrl_rofi = 'Flrl_rofi' + character(*), parameter :: Flrl_irrig = 'Flrl_irrig' + character(*), parameter :: Sl_tsrf_elev = 'Sl_tsrf_elev' + character(*), parameter :: Sl_topo_elev = 'Sl_topo_elev' + character(*), parameter :: Flgl_qice_elev = 'Flgl_qice_elev' + character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" character(*),parameter :: u_FILE_u = & __FILE__ @@ -139,69 +211,69 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_lfrin') ! export to atm - if (atm_prognostic) then - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_t' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_tref' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_qref' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdr' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidr' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_avsdf' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_anidf' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_snowh' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_u10' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_fv' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_ram1' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_taux' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_tauy' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lat' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_sen' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_lwup' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_evap' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_swnet' ) - ! call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_methane' ) + !if (atm_prognostic) then + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_t ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_tref ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_qref ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_avsdr ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_anidr ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_avsdf ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_anidf ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_snowh ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_u10 ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_fv ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_ram1 ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_taux ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_tauy ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_lat ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_sen ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_lwup ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_evap ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_swnet ) + ! call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_methane ) ! dust fluxes from land (4 sizes) - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_flxdst', ungridded_lbound=1, ungridded_ubound=4) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, Fall_flxdst, ungridded_lbound=1, ungridded_ubound=4) ! co2 fields from land if (flds_co2b .or. flds_co2c) then - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Fall_fco2_lnd' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_fco2_lnd ) end if ! Dry Deposition velocities from land - ALSO initialize drydep here call seq_drydep_readnl("drv_flds_in", drydep_nflds) if (drydep_nflds > 0) then - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_ddvel', ungridded_lbound=1, ungridded_ubound=drydep_nflds) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, Sl_ddvel, ungridded_lbound=1, ungridded_ubound=drydep_nflds) end if ! MEGAN VOC emissions fluxes from land call shr_megan_readnl('drv_flds_in', megan_nflds) if (shr_megan_mechcomps_n .ne. megan_nflds) call shr_sys_abort('ERROR: megan field count mismatch') if (shr_megan_mechcomps_n > 0) then - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_voc', ungridded_lbound=1, ungridded_ubound=megan_nflds) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, Fall_voc, ungridded_lbound=1, ungridded_ubound=megan_nflds) end if ! Fire emissions fluxes from land call shr_fire_emis_readnl('drv_flds_in', emis_nflds) if (emis_nflds > 0) then - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Fall_fire', ungridded_lbound=1, ungridded_ubound=emis_nflds) - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_fztop') + call fldlist_add(fldsFrLnd_num, fldsFrLnd, Fall_fire, ungridded_lbound=1, ungridded_ubound=emis_nflds) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, Sl_fztop) end if ! CARMA volumetric soil water from land ! TODO: is the following correct - the CARMA field exchange is very confusing in mct call shr_carma_readnl('drv_flds_in', carma_fields) if (carma_fields /= ' ') then - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_soilw') ! optional for carma + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_soilw) ! optional for carma end if - end if + !end if ! export to rof if (rof_prognostic) then - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofsur' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofgwl' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofsub' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_rofi' ) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Flrl_irrig' ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Flrl_rofsur) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Flrl_rofgwl) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Flrl_rofsub) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Flrl_rofi ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Flrl_irrig ) end if ! export to glc @@ -210,9 +282,9 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r ! The following puts all of the elevation class fields as an ! undidstributed dimension in the export state field - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_tsrf_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Sl_topo_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) - call fldlist_add(fldsFrLnd_num, fldsFrLnd, 'Flgl_qice_elev', ungridded_lbound=1, ungridded_ubound=glc_nec+1) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, Sl_tsrf_elev , ungridded_lbound=1, ungridded_ubound=glc_nec+1) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, Sl_topo_elev , ungridded_lbound=1, ungridded_ubound=glc_nec+1) + call fldlist_add(fldsFrLnd_num, fldsFrLnd, Flgl_qice_elev, ungridded_lbound=1, ungridded_ubound=glc_nec+1) end if ! Now advertise above export fields @@ -228,75 +300,73 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r call fldlist_add(fldsToLnd_num, fldsToLnd, trim(flds_scalar_name)) - ! from atm - states - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_z' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_topo' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_u' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_v' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_ptem' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_pbot' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_tbot' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_shum' ) - !call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_methane' ) - - ! from atm - fluxes - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_lwdn' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_rainc' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_rainl' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_snowc' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_snowl' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swndr' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swvdr' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swndf' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_swvdf' ) + ! from atm + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_z ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_topo ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_u ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_v ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_ptem ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_pbot ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_tbot ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_shum ) + !call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_methane ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_lwdn ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_rainc ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_rainl ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_snowc ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_snowl ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_swndr ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_swvdr ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_swndf ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_swvdf ) ! from atm - black carbon deposition fluxes (3) ! (1) => bcphidry, (2) => bcphodry, (3) => bcphiwet - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_bcph', ungridded_lbound=1, ungridded_ubound=3) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_bcph, ungridded_lbound=1, ungridded_ubound=3) ! from atm - organic carbon deposition fluxes (3) ! (1) => ocphidry, (2) => ocphodry, (3) => ocphiwet - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_ocph', ungridded_lbound=1, ungridded_ubound=3) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_ocph, ungridded_lbound=1, ungridded_ubound=3) ! from atm - wet dust deposition frluxes (4 sizes) ! (1) => dstwet1, (2) => dstwet2, (3) => dstwet3, (4) => dstwet4 - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_dstwet', ungridded_lbound=1, ungridded_ubound=4) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_dstwet, ungridded_lbound=1, ungridded_ubound=4) ! from - atm dry dust deposition frluxes (4 sizes) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_dstdry', ungridded_lbound=1, ungridded_ubound=4) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_dstdry, ungridded_lbound=1, ungridded_ubound=4) ! from atm - nitrogen deposition call shr_ndep_readnl("drv_flds_in", ndep_nflds) if (ndep_nflds > 0) then - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Faxa_ndep', ungridded_lbound=1, ungridded_ubound=ndep_nflds) + call fldlist_add(fldsToLnd_num, fldsToLnd, Faxa_ndep, ungridded_lbound=1, ungridded_ubound=ndep_nflds) ! This sets a variable in clm_varctl ndep_from_cpl = .true. end if ! from atm - co2 exchange scenarios if (flds_co2a .or. flds_co2b .or. flds_co2c) then - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_co2prog') - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sa_co2diag') + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_co2prog) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_co2diag) end if if (rof_prognostic) then ! from river - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_flood' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_volr' ) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flrr_volrmch' ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Flrr_flood ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Flrr_volr ) + call fldlist_add(fldsToLnd_num, fldsToLnd, Flrr_volrmch ) end if if (glc_present) then ! from land-ice (glc) - no elevation classes - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_icemask' ) ! mask of where cism is running - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_icemask_coupled_fluxes') ! + call fldlist_add(fldsToLnd_num, fldsToLnd, Sg_icemask ) ! mask of where cism is running + call fldlist_add(fldsToLnd_num, fldsToLnd, Sg_icemask_coupled_fluxes) ! ! from land-ice (glc) - fields for all glc->lnd elevation classes (1:glc_nec) plus bare land (index 0) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_ice_covered_elev', ungridded_lbound=1, ungridded_ubound=glc_nec+1) - call fldlist_add(fldsToLnd_num, fldsToLnd, 'Sg_topo_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sg_ice_covered_elev, ungridded_lbound=1, ungridded_ubound=glc_nec+1) + call fldlist_add(fldsToLnd_num, fldsToLnd, Sg_topo_elev , ungridded_lbound=1, ungridded_ubound=glc_nec+1) !current not used - but could be used in the future - !call fldlist_add(fldsToLnd_num, fldsToLnd, 'Flgg_hflx_elev' , ungridded_lbound=1, ungridded_ubound=glc_nec+1) + !call fldlist_add(fldsToLnd_num, fldsToLnd, Flgg_hflx_elev , ungridded_lbound=1, ungridded_ubound=glc_nec+1) end if ! Now advertise import fields @@ -388,6 +458,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) real(r8) :: forc_pbot ! atmospheric pressure (Pa) real(r8) :: co2_ppmv_input(bounds%begg:bounds%endg) ! temporary + real(r8) :: forc_ndep(bounds%begg:bounds%endg,2) real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s real(r8) :: forc_rainl(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s real(r8) :: forc_snowc(bounds%begg:bounds%endg) ! snowfxy Atm flux mm/s @@ -418,240 +489,84 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! by 1000 mm/m resulting in an overall factor of unity. ! Below the units are therefore given in mm/s. - !-------------------------- - ! Required atmosphere input fields - !-------------------------- - - fldname = 'Sa_z' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + ! Required atm input fields + call state_getimport_1d(importState, Sa_z , atm2lnd_inst%forc_hgt_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_hgt_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Sa_topo' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Sa_topo , atm2lnd_inst%forc_topo_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_topo_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Sa_u' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Sa_u , atm2lnd_inst%forc_u_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_u_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Sa_v' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Sa_v , atm2lnd_inst%forc_v_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_v_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Sa_ptem' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Sa_shum , wateratm2lndbulk_inst%forc_q_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_th_not_downscaled_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Sa_shum' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Sa_ptem , atm2lnd_inst%forc_th_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Sa_pbot' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Sa_pbot , atm2lnd_inst%forc_pbot_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_pbot_not_downscaled_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Sa_tbot' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Sa_tbot , atm2lnd_inst%forc_t_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_t_not_downscaled_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_rainc' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Faxa_rainc, forc_rainc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - forc_rainc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_rainl' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Faxa_rainl, forc_rainl(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - forc_rainl(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_snowc' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Faxa_snowc, forc_snowc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - forc_snowc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_snowl' - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_getimport_1d(importState, Faxa_snowl, forc_snowl(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - forc_snowl(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_lwdn' - call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_swvdr' - call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) + call state_getimport_1d(importState, Faxa_lwdn , atm2lnd_inst%forc_lwrad_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_solad_grc(g,1) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_swndr' - call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) + call state_getimport_1d(importState, Faxa_swvdr, atm2lnd_inst%forc_solad_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_solad_grc(g,2) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_swvdf' - call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) + call state_getimport_1d(importState, Faxa_swndr, atm2lnd_inst%forc_solad_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_solai_grc(g,1) = fldptr1d(g-begg+1) - end do - - fldname = 'Faxa_swndf' - call state_getfldptr(importState, trim(fldname), fldptr1d, rc=rc) + call state_getimport_1d(importState, Faxa_swvdf, atm2lnd_inst%forc_solai_grc(begg:,1), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport_1d(importState, Faxa_swndf, atm2lnd_inst%forc_solai_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_solai_grc(g,2) = fldptr1d(g-begg+1) - end do - ! Atmosphere prognostic/prescribed aerosol fields - fldname = 'Faxa_bcph' - if (fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + ! optional atm input fields + if (fldchk(importState, Faxa_bcph)) then + ! 1 = bcphidry, 2 = bcphodry, 3 = bcphiwet + call state_getimport_2d(importState, Faxa_bcph, atm2lnd_inst%forc_aer_grc(begg:,1:3), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) - call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) - call check_for_nans(fldptr2d(3,:), trim(fldname)//'(3)', begg) - do g = begg, endg - n = g - begg + 1 - atm2lnd_inst%forc_aer_grc(g,1) = fldptr2d(1,n) ! bcphidry - atm2lnd_inst%forc_aer_grc(g,2) = fldptr2d(2,n) ! bcphodry - atm2lnd_inst%forc_aer_grc(g,3) = fldptr2d(3,n) ! bcphiwet - end do end if - fldname = 'Faxa_ocph' - if (fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (fldchk(importState, Faxa_ocph)) then + ! 4 = ocphidry, 5 = ocphodry, 6 = ocphiwet + call state_getimport_2d(importState, Faxa_ocph, atm2lnd_inst%forc_aer_grc(begg:,4:6), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) - call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) - call check_for_nans(fldptr2d(3,:), trim(fldname)//'(3)', begg) - do g = begg, endg - n = g - begg + 1 - atm2lnd_inst%forc_aer_grc(g,4) = fldptr2d(1,n) ! ocphidry - atm2lnd_inst%forc_aer_grc(g,5) = fldptr2d(2,n) ! ocphodry - atm2lnd_inst%forc_aer_grc(g,6) = fldptr2d(3,n) ! ocphiwet - end do end if - fldname = 'Faxa_dstwet' - if (fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (fldchk(importState, Faxa_dstwet)) then + ! 7 = dstwet1, 9 = dstwet2, 11 = dstwet3, 13 = dstwet4 + call state_getimport_2d(importState, Faxa_dstwet, atm2lnd_inst%forc_aer_grc(begg:,7:13:2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) - call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) - call check_for_nans(fldptr2d(3,:), trim(fldname)//'(3)', begg) - call check_for_nans(fldptr2d(4,:), trim(fldname)//'(4)', begg) - do g = begg, endg - n = g - begg + 1 - atm2lnd_inst%forc_aer_grc(g,7) = fldptr2d(1,n) - atm2lnd_inst%forc_aer_grc(g,9) = fldptr2d(2,n) - atm2lnd_inst%forc_aer_grc(g,11) = fldptr2d(3,n) - atm2lnd_inst%forc_aer_grc(g,13) = fldptr2d(4,n) - end do end if - fldname = 'Faxa_dstdry' - if (fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (fldchk(importState, Faxa_dstdry)) then + ! 8 = dstdry1, 10 = dstdry2, 12 = dstdry3, 14 = dstdry4 + call state_getimport_2d(importState, Faxa_dstdry, atm2lnd_inst%forc_aer_grc(begg:,8:14:2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) - call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) - call check_for_nans(fldptr2d(3,:), trim(fldname)//'(3)', begg) - call check_for_nans(fldptr2d(4,:), trim(fldname)//'(4)', begg) - do g = begg, endg - n = g - begg + 1 - atm2lnd_inst%forc_aer_grc(g,8) = fldptr2d(1,n) - atm2lnd_inst%forc_aer_grc(g,10) = fldptr2d(2,n) - atm2lnd_inst%forc_aer_grc(g,12) = fldptr2d(3,n) - atm2lnd_inst%forc_aer_grc(g,14) = fldptr2d(4,n) - end do end if - - fldname = 'Sa_methane' - if (fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc ) - call check_for_nans(fldptr1d, trim(fldname), begg) - do g = begg, endg - atm2lnd_inst%forc_pch4_grc(g) = fldptr1d(g-begg+1) - end do + if (fldchk(importState, Sa_methane)) then + call state_getimport_1d(importState, Sa_methane, atm2lnd_inst%forc_pch4_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - - fldname = 'Faxa_ndep' - if (fldchk(importState, trim(fldname))) then + if (fldchk(importState, Faxa_ndep)) then ! The mediator is sending ndep in units if kgN/m2/s - and ctsm ! uses units of gN/m2/sec so the following conversion needs to happen - call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + call state_getimport_2d(importState, Faxa_ndep, forc_ndep(begg:,:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call check_for_nans(fldptr2d(1,:), trim(fldname)//'(1)', begg) - call check_for_nans(fldptr2d(2,:), trim(fldname)//'(2)', begg) do g = begg, endg - n = g - begg + 1 - atm2lnd_inst%forc_ndep_grc(g) = (fldptr2d(1,n) + fldptr2d(2,n))*1000._r8 + atm2lnd_inst%forc_ndep_grc(g) = (forc_ndep(g,1) + forc_ndep(g,2))*1000._r8 end do end if - !-------------------------- ! Atmosphere co2 - !-------------------------- - ! Set default value to a constant and overwrite for prognostic and diagnostic do g = begg,endg co2_ppmv_input(g) = co2_ppmv end do if (co2_type == 'prognostic') then - fldName = 'Sa_co2prog' + fldName = Sa_co2prog call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) if ( ChkErr(rc,__LINE__,u_FILE_u)) return if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'prognostic') then @@ -665,7 +580,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & end do end if else if (co2_type == 'diagnostic') then - fldName = 'Sa_co2diag' + fldName = Sa_co2diag call ESMF_StateGet(importState, trim(fldname), itemFlag, rc=rc) if ( ChkErr(rc,__LINE__,u_FILE_u)) return if (itemflag == ESMF_STATEITEM_NOTFOUND .and. co2_type == 'diagnostic') then @@ -685,112 +600,66 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & do g = begg,endg forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_input(g) * 1.e-6_r8 * forc_pbot - if (use_c13) then - atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_input(g) * c13ratio * 1.e-6_r8 * forc_pbot - end if end do + if (use_c13) then + do g = begg,endg + forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) + atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_input(g) * c13ratio * 1.e-6_r8 * forc_pbot + end do + end if - !-------------------------- - ! Flooding back from river - !-------------------------- - + ! Flooding from river ! sign convention is positive downward and hierarchy is atm/glc/lnd/rof/ice/ocn. ! so water sent from rof to land is negative, ! change the sign to indicate addition of water to system. - - fldname = 'Flrr_flood' - if (fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc ) + if (fldchk(importState, Flrr_flood)) then + call state_getimport_1d(importState, Flrr_flood, wateratm2lndbulk_inst%forc_flood_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg - wateratm2lndbulk_inst%forc_flood_grc(g) = -fldptr1d(g-begg+1) + wateratm2lndbulk_inst%forc_flood_grc(g) = wateratm2lndbulk_inst%forc_flood_grc(g) * (ldomain%area(g) * 1.e6_r8) end do else wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 end if - - fldname = 'Flrr_volr' - if (fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc ) + if (fldchk(importState, Flrr_volr)) then + call state_getimport_1d(importState, Flrr_volr, wateratm2lndbulk_inst%volr_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg - wateratm2lndbulk_inst%volr_grc(g) = fldptr1d(g-begg+1) * (ldomain%area(g) * 1.e6_r8) + wateratm2lndbulk_inst%volr_grc(g) = wateratm2lndbulk_inst%volr_grc(g) * (ldomain%area(g) * 1.e6_r8) end do else wateratm2lndbulk_inst%volr_grc(:) = 0._r8 end if - - fldname = 'Flrr_volrmch' - if (fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc ) + if (fldchk(importState, Flrr_volrmch)) then + call state_getimport_1d(importState, Flrr_volrmch, wateratm2lndbulk_inst%volrmch_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg - wateratm2lndbulk_inst%volrmch_grc(g) = fldptr1d(g-begg+1) * (ldomain%area(g) * 1.e6_r8) + wateratm2lndbulk_inst%volrmch_grc(g) = wateratm2lndbulk_inst%volrmch_grc(g) * (ldomain%area(g) * 1.e6_r8) end do else wateratm2lndbulk_inst%volrmch_grc(:) = 0._r8 end if - !-------------------------- ! Land-ice (glc) fields - !-------------------------- - if (glc_present) then ! We could avoid setting these fields if glc_present is .false., if that would ! help with performance. (The downside would be that we wouldn't have these fields ! available for diagnostic purposes or to force a later T compset with dlnd.) - fldname = 'Sg_ice_covered_elev' - if ( fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg, endg - do num = 0,glc_nec - frac_grc(g,num) = fldptr2d(num+1,g-begg+1) - end do - end do - end if - - fldname = 'Sg_topo_elev' - if ( fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg, endg - do num = 0,glc_nec - topo_grc(g,num) = fldptr2d(num+1,g-begg+1) - end do - end do - end if - - fldname = 'Flgg_hflx_elev' - if ( fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + call state_getimport_2d(importState, Sg_ice_covered_elev , frac_grc(begg:,0:glc_nec), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport_2d(importState, Sg_topo_elev , topo_grc(begg:,0:glc_nec), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport_1d(importState, Sg_icemask , icemask_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_getimport_1d(importState, Sg_icemask_coupled_fluxes , icemask_coupled_fluxes_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (fldchk(importState, Flgg_hflx_elev)) then + call state_getimport_2d(importState, Flgg_hflx_elev, hflx_grc(begg:,0:glc_nec), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg, endg - do num = 0,glc_nec - hflx_grc(g,num) = fldptr2d(num+1,g-begg+1) - end do - end do else hflx_grc(:,:) = 0._r8 end if - - fldname = 'Sg_icemask' - if ( fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - do g = begg, endg - icemask_grc(g) = fldptr1d(g-begg+1) - end do - end if - - fldname = 'Sg_icemask_coupled_fluxes' - if ( fldchk(importState, trim(fldname))) then - call state_getfldptr(importState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg, endg - icemask_coupled_fluxes_grc(g) = fldptr1d(g-begg+1) - end do - end if call glc2lnd_inst%set_glc2lnd_fields_nuopc( bounds, glc_present, & frac_grc, topo_grc, hflx_grc, icemask_grc, icemask_coupled_fluxes_grc ) end if @@ -813,6 +682,8 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & !------------------------------- ! Pack the export state + ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. + ! i.e. water sent from land to rof is positive !------------------------------- use Waterlnd2atmBulkType , only: waterlnd2atmbulk_type @@ -834,7 +705,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & character(len=CS) :: fldname integer :: begg, endg ! bounds integer :: i, g, num - real(r8) :: array(bounds%begg:bounds%endg) + real(r8) :: data1d(bounds%begg:bounds%endg) character(len=*), parameter :: subname='(lnd_import_export:export_fields)' !--------------------------------------------------------------------------- @@ -851,324 +722,130 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! ----------------------- ! output to mediator ! ----------------------- - fldname = 'Sl_lfrin' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = ldomain%frac(g) - end do - end if + call state_setexport_1d(exportState, Sl_lfrin, ldomain%frac(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ----------------------- ! output to atm ! ----------------------- - fldname = 'Sl_t' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + !if (atm_prognostic) then + call state_setexport_1d(exportState, Sl_t , lnd2atm_inst%t_rad_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%t_rad_grc(g) - end do - end if - fldname = 'Sl_snowh' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Sl_snowh , waterlnd2atmbulk_inst%h2osno_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%h2osno_grc(g) - end do - end if - fldname = 'Sl_avsdr' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Sl_avsdr , lnd2atm_inst%albd_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%albd_grc(g,1) - end do - end if - fldname='Sl_anidr' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Sl_anidr , lnd2atm_inst%albd_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%albd_grc(g,2) - end do - end if - fldname= 'Sl_avsdf' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%albi_grc(g,1) - end do - end if - fldname = 'Sl_anidf' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%albi_grc(g,2) - end do - end if - fldname = 'Sl_tref' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Sl_avsdf , lnd2atm_inst%albi_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%t_ref2m_grc(g) - end do - end if - fldname = 'Sl_qref' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%q_ref2m_grc(g) - end do - end if - fldname = 'Fall_taux' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = -lnd2atm_inst%taux_grc(g) - end do - end if - fldname = 'Fall_tauy' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = -lnd2atm_inst%tauy_grc(g) - end do - end if - fldname = 'Fall_lat' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_lh_tot_grc(g) - end do - end if - fldname = 'Fall_sen' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_sh_tot_grc(g) - end do - end if - fldname = 'Fall_lwup' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = -lnd2atm_inst%eflx_lwrad_out_grc(g) - end do - end if - fldname = 'Fall_evap' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = -waterlnd2atmbulk_inst%qflx_evap_tot_grc(g) - end do - end if - fldname = 'Fall_swnet' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%fsa_grc(g) - end do - end if - fldname = 'Fall_flxdst' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._r8 - do g = begg, endg - fldptr2d(1,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,1) - fldptr2d(2,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,2) - fldptr2d(3,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,3) - fldptr2d(4,g-begg+1) = -lnd2atm_inst%flxdst_grc(g,4) - end do - end if - fldname = 'Fall_methane' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Sl_anidf , lnd2atm_inst%albi_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = -lnd2atm_inst%ch4_surf_flux_tot_grc(g) - end do - end if - fldname = 'Sl_u10' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Sl_tref , lnd2atm_inst%t_ref2m_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%u_ref10m_grc(g) - end do - end if - fldname = 'Sl_ram1' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Sl_qref , waterlnd2atmbulk_inst%q_ref2m_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%ram1_grc(g) - end do - end if - fldname = 'Sl_fv' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Fall_taux , lnd2atm_inst%taux_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%fv_grc(g) - end do - end if - fldname = 'Sl_soilw' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Fall_tauy , lnd2atm_inst%tauy_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg, endg - fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%h2osoi_vol_grc(g,1) - end do - end if - fldname = 'Fall_fco2_lnd' ! co2 from land - if (fldchk(exportState, trim(fldname) )) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Fall_lat , lnd2atm_inst%eflx_lh_tot_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = -lnd2atm_inst%net_carbon_exchange_grc(g) - end do - end if - fldname = 'Sl_ddvel' ! dry dep velocities - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + call state_setexport_1d(exportState, Fall_sen , lnd2atm_inst%eflx_sh_tot_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._r8 - do g = begg, endg - do num = 1, drydep_nflds - fldptr2d(num,g-begg+1) = lnd2atm_inst%ddvel_grc(g,num) - end do - end do - end if - fldname = 'Fall_voc' ! megan voc emis fluxes - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + call state_setexport_1d(exportState, Fall_lwup , lnd2atm_inst%eflx_lwrad_out_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._r8 - do g = begg, endg - do num = 1, shr_megan_mechcomps_n - fldptr2d(num,g-begg+1) = -lnd2atm_inst%flxvoc_grc(g,num) - end do - end do - end if - fldname = 'Fall_fire' ! fire emis from land - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + call state_setexport_1d(exportState, Fall_evap , waterlnd2atmbulk_inst%qflx_evap_tot_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._r8 - do g = begg, endg - do num = 1, emis_nflds - fldptr2d(num,g-begg+1) = -lnd2atm_inst%fireflx_grc(g,num) - end do - end do - end if - fldname = 'Sl_fztop' ! fire emis from land - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + call state_setexport_1d(exportState, Fall_swnet, lnd2atm_inst%fsa_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = lnd2atm_inst%fireztop_grc(g) - end do - end if - ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. - ! i.e. water sent from land to rof is positive + ! optional fields + if (fldchk(exportState, Fall_flxdst)) then + call state_setexport_2d(exportState, Fall_flxdst, lnd2atm_inst%flxdst_grc(begg:,1:4), & + minus= .true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Fall_methane)) then + call state_setexport_1d(exportState, Fall_methane, lnd2atm_inst%ch4_surf_flux_tot_grc(begg:), & + minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Sl_u10)) then + call state_setexport_1d(exportState, Sl_u10, lnd2atm_inst%u_ref10m_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Sl_ram1)) then + call state_setexport_1d(exportState, Sl_ram1, lnd2atm_inst%ram1_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Sl_fv)) then + call state_setexport_1d(exportState, Sl_fv, lnd2atm_inst%fv_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Sl_soilw)) then + call state_setexport_1d(exportState, Sl_soilw, waterlnd2atmbulk_inst%h2osoi_vol_grc(begg:,1), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Fall_fco2_lnd)) then + call state_setexport_1d(exportState, Fall_fco2_lnd, lnd2atm_inst%net_carbon_exchange_grc(begg:), & + minus=.true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Sl_ddvel)) then ! dry dep velocities + call state_setexport_2d(exportState, Sl_ddvel, lnd2atm_inst%ddvel_grc(begg:,1:drydep_nflds), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Fall_voc)) then ! megan voc emis fluxes + call state_setexport_2d(exportState, Fall_voc, lnd2atm_inst%flxvoc_grc(begg:,1:shr_megan_mechcomps_n), & + minus = .true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Fall_fire)) then ! fire emis from land + call state_setexport_2d(exportState, Fall_fire, lnd2atm_inst%fireflx_grc(begg:,1:emis_nflds), & + minus = .true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + if (fldchk(exportState, Sl_fztop)) then ! fire emis from land + call state_setexport_1d(exportState, Sl_fztop, lnd2atm_inst%fireztop_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + !endif ! ----------------------- ! output to river ! ----------------------- - ! surface runoff is the sum of qflx_over, qflx_h2osfc_surf - ! do g = bounds%begg,bounds%endg - ! array(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + & + ! do g = begg,endg + ! data1d(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + & ! waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) ! end do - fldname = 'Flrl_rofsur' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (fldchk(exportState, Flrl_rofsur)) then + call state_setexport_1d(exportState, Flrl_rofsur, waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) - end do end if - - fldname = 'Flrl_rofsub' ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (fldchk(exportState, Flrl_rofgwl)) then ! qgwl sent individually to mediator + call state_setexport_1d(exportState, Flrl_rofgwl, waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & - waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) - end do end if - - fldname = 'Flrl_rofgwl' ! qgwl sent individually to mediator - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (fldchk(exportState, Flrl_rofi)) then ! ice set individually to mediator + call state_setexport_1d(exportState, Flrl_rofi, waterlnd2atmbulk_inst%qflx_rofice_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) - end do end if - - fldname = 'Flrl_rofi' ! ice sent individually to mediator - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (fldchk(exportState, Flrl_irrig)) then ! irrigation flux to be removed from main channel storage (negative) + call state_setexport_1d(exportState, Flrl_irrig, waterlnd2atmbulk_inst%qirrig_grc(begg:), & + minus = .true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 - do g = begg, endg - fldptr1d(g-begg+1) = waterlnd2atmbulk_inst%qflx_rofice_grc(g) - end do end if - - fldname = 'Flrl_irrig' ! irrigation flux to be removed from main channel storage (negative) - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 + if (fldchk(exportState, Flrl_rofsub)) then + ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain do g = begg, endg - fldptr1d(g-begg+1) = -waterlnd2atmbulk_inst%qirrig_grc(g) + data1d(g) = waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & + waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) end do + call state_setexport_1d(exportState, Flrl_rofsub, data1d(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! ----------------------- @@ -1178,40 +855,18 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! help with performance. (The downside would be that we wouldn't have these fields ! available for diagnostic purposes or to force a later T compset with dlnd.) - fldname = 'Sl_tsrf_elev' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (fldchk(exportState, Sl_tsrf_elev)) then + call state_setexport_2d(exportState, Sl_tsrf_elev, lnd2glc_inst%tsrf_grc(begg:,0:glc_nec), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._r8 - do g = begg, endg - do num = 0,glc_nec - fldptr2d(num+1,g-begg+1) = lnd2glc_inst%tsrf_grc(g,num) - end do - end do end if - - fldname = 'Sl_topo_elev' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (fldchk(exportState, Sl_topo_elev)) then + call state_setexport_2d(exportState, Sl_topo_elev, lnd2glc_inst%topo_grc(begg:,0:glc_nec), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._r8 - do g = begg, endg - do num = 0,glc_nec - fldptr2d(num+1,g-begg+1) = lnd2glc_inst%topo_grc(g,num) - end do - end do end if - - fldname = 'Flgl_qice_elev' - if (fldchk(exportState, trim(fldname))) then - call state_getfldptr(exportState, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (fldchk(exportState, Flgl_qice_elev)) then + call state_setexport_2d(exportState, Flgl_qice_elev, lnd2glc_inst%qice_grc(begg:,0:glc_nec), & + minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr2d(:,:) = 0._r8 - do g = begg, endg - do num = 0,glc_nec - fldptr2d(num+1,g-begg+1) = lnd2glc_inst%qice_grc(g,num) - end do - end do end if end subroutine export_fields @@ -1352,6 +1007,152 @@ end subroutine SetScalarField end subroutine fldlist_realize + !=============================================================================== + subroutine state_getimport_1d(state, fldname, ctsmdata, rc) + + ! fill in ctsm import data for 1d field + + use ESMF, only : ESMF_LOGERR_PASSTHRU, ESMF_END_ABORT, ESMF_LogFoundError + use ESMF, only : ESMF_Finalize + + ! input/output variabes + type(ESMF_State) , intent(in) :: state + character(len=*) , intent(in) :: fldname + real(r8) , intent(inout) :: ctsmdata(:) + integer , intent(out) :: rc + + ! local variables + real(r8), pointer :: fldPtr1d(:) + integer :: g + character(len=*), parameter :: subname='(lnd_import_export:state_getimport_1d)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + call state_getfldptr(State, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = 1,size(ctsmdata) + ctsmdata(g) = fldptr1d(g) + end do + call check_for_nans(ctsmdata, trim(fldname), 1) + + end subroutine state_getimport_1d + + !=============================================================================== + subroutine state_getimport_2d(state, fldname, ctsmdata, rc) + + ! fill in ctsm import data for 2d field + + use ESMF, only : ESMF_LOGERR_PASSTHRU, ESMF_END_ABORT, ESMF_LogFoundError + use ESMF, only : ESMF_Finalize + + ! input/output variabes + type(ESMF_State) , intent(in) :: state + character(len=*) , intent(in) :: fldname + real(r8) , intent(inout) :: ctsmdata(:,:) + integer , intent(out) :: rc + + ! local variables + real(r8), pointer :: fldPtr2d(:,:) + integer :: g,n + character(len=CS) :: cnum + character(len=*), parameter :: subname='(lnd_import_export:state_getimport_1d)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do n = 1,size(ctsmdata, dim=2) + write(cnum,'(i0)') n + do g = 1,size(ctsmdata,dim=1) + ctsmdata(g,n) = fldptr2d(n,g) + end do + call check_for_nans(ctsmdata(:,n), trim(fldname)//trim(cnum), 1) + end do + + end subroutine state_getimport_2d + + !=============================================================================== + subroutine state_setexport_1d(state, fldname, ctsmdata, minus, rc) + + ! fill in ctsm export data for 1d field + + use ESMF, only : ESMF_LOGERR_PASSTHRU, ESMF_END_ABORT, ESMF_LogFoundError + use ESMF, only : ESMF_Finalize + + ! input/output variabes + type(ESMF_State) , intent(in) :: state + character(len=*) , intent(in) :: fldname + real(r8) , intent(in) :: ctsmdata(:) + logical, optional, intent(in) :: minus + integer , intent(out):: rc + + ! local variables + real(r8), pointer :: fldPtr1d(:) + integer :: g + character(len=*), parameter :: subname='(lnd_export_export:state_setexport_1d)' + ! ---------------------------------------------- + + call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + if (present(minus)) then + do g = 1,size(ctsmdata) + fldptr1d(g) = -ctsmdata(g) + end do + else + do g = 1,size(ctsmdata) + fldptr1d(g) = ctsmdata(g) + end do + end if + call check_for_nans(ctsmdata, trim(fldname), 1) + + end subroutine state_setexport_1d + + !=============================================================================== + subroutine state_setexport_2d(state, fldname, ctsmdata, minus, rc) + + ! fill in ctsm export data for 2d field + + use ESMF, only : ESMF_LOGERR_PASSTHRU, ESMF_END_ABORT, ESMF_LogFoundError + use ESMF, only : ESMF_Finalize + + ! input/output variabes + type(ESMF_State) , intent(in) :: state + character(len=*) , intent(in) :: fldname + real(r8) , intent(in) :: ctsmdata(:,:) + logical, optional, intent(in) :: minus + integer , intent(out):: rc + + ! local variables + real(r8), pointer :: fldPtr2d(:,:) + integer :: g, n + character(len=CS) :: cnum + character(len=*), parameter :: subname='(lnd_export_export:state_setexport_2d)' + ! ---------------------------------------------- + + rc = ESMF_SUCCESS + + call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0._r8 + do n = 1,size(ctsmdata, dim=2) + write(cnum,'(i0)') n + if (present(minus)) then + do g = 1,size(ctsmdata, dim=1) + fldptr2d(n,g) = -ctsmdata(g,n) + end do + else + do g = 1,size(ctsmdata, dim=1) + fldptr2d(n,g) = ctsmdata(g,n) + end do + end if + call check_for_nans(ctsmdata(:,n), trim(fldname)//trim(cnum), 1) + end do + + end subroutine state_setexport_2d + !=============================================================================== subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) From 9940aea5fa495c3d6a7afb5bc702cf3e06d4c25d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 21 Dec 2020 20:46:01 -0700 Subject: [PATCH 1713/1973] more cleanup --- src/cpl/nuopc/lnd_import_export.F90 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 4dd10675b4..1c18ab253c 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -138,6 +138,8 @@ module lnd_import_export character(*), parameter :: Sl_topo_elev = 'Sl_topo_elev' character(*), parameter :: Flgl_qice_elev = 'Flgl_qice_elev' + logical :: send_to_atm = .false. + character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" character(*),parameter :: u_FILE_u = & __FILE__ @@ -162,11 +164,8 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r ! local variables type(ESMF_State) :: importState type(ESMF_State) :: exportState - character(ESMF_MAXSTR) :: stdname character(ESMF_MAXSTR) :: cvalue - character(len=2) :: nec_str integer :: n, num - character(len=CS) :: fldname character(len=*), parameter :: subname='(lnd_import_export:advertise_fields)' !------------------------------------------------------------------------------- @@ -179,6 +178,12 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r ! determine necessary toggles for below !-------------------------------- + if (atm_prognostic) then + send_to_atm = .true. + else + send_to_atm = .false. + end if + call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) flds_co2a @@ -211,7 +216,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_lfrin') ! export to atm - !if (atm_prognostic) then + if (send_to_atm) then call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_t ) call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_tref ) call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_qref ) @@ -265,7 +270,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r if (carma_fields /= ' ') then call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_soilw) ! optional for carma end if - !end if + end if ! export to rof if (rof_prognostic) then @@ -728,7 +733,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! ----------------------- ! output to atm ! ----------------------- - !if (atm_prognostic) then + if (send_to_atm) then call state_setexport_1d(exportState, Sl_t , lnd2atm_inst%t_rad_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call state_setexport_1d(exportState, Sl_snowh , waterlnd2atmbulk_inst%h2osno_grc(begg:), rc=rc) @@ -810,7 +815,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_setexport_1d(exportState, Sl_fztop, lnd2atm_inst%fireztop_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - !endif + endif ! ----------------------- ! output to river From 1ce3299002e0d4324f511c832d5b6f57d37c761a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Dec 2020 22:48:44 -0700 Subject: [PATCH 1714/1973] Add spinup_factor which is normally one, but 10 when spinup_state is Accel. Decomp. (2) --- src/biogeochem/CNVegCarbonStateType.F90 | 2 ++ src/biogeochem/CNVegStructUpdateMod.F90 | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index 0a8ea2e03c..9a754640c7 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -102,6 +102,8 @@ module CNVegCarbonStateType end type cnveg_carbonstate_type + real(r8), public :: spinup_factor = 1.0_r8 ! Spinup factor used when in Accelerated Decomposition mode + ! !PRIVATE DATA: type, private :: cnvegcarbonstate_const_type diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 1cb7dad82f..d9740e7ef9 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -13,7 +13,7 @@ module CNVegStructUpdateMod use CNDVType , only : dgvs_type use CNVegStateType , only : cnveg_state_type use CropType , only : crop_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor use CanopyStateType , only : canopystate_type use PatchType , only : patch use decompMod , only : bounds_type @@ -217,12 +217,9 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & leaf_biomass(p) = max(0.0025_r8,leafc(p)) & * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) - stem_biomass(p) = (deadstemc(p) + livestemc(p)) & + stem_biomass(p) = (spinup_factor*deadstemc(p) + livestemc(p)) & * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) - if (spinup_state == 2) then - stem_biomass(p) = 10._r8 * stem_biomass(p) - end if else leaf_biomass(p) = 0_r8 stem_biomass(p) = 0_r8 From 5218525acb22e1880f5835bb213107b97f824f0d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 22 Dec 2020 10:44:09 -0700 Subject: [PATCH 1715/1973] fixed glc import bug --- src/cpl/nuopc/lnd_import_export.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 1c18ab253c..f53b6ccd5e 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -665,6 +665,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & else hflx_grc(:,:) = 0._r8 end if + call glc2lnd_inst%set_glc2lnd_fields_nuopc( bounds, glc_present, & frac_grc, topo_grc, hflx_grc, icemask_grc, icemask_coupled_fluxes_grc ) end if @@ -869,8 +870,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & if (ChkErr(rc,__LINE__,u_FILE_u)) return end if if (fldchk(exportState, Flgl_qice_elev)) then - call state_setexport_2d(exportState, Flgl_qice_elev, lnd2glc_inst%qice_grc(begg:,0:glc_nec), & - minus=.true., rc=rc) + call state_setexport_2d(exportState, Flgl_qice_elev, lnd2glc_inst%qice_grc(begg:,0:glc_nec), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if From 4d875083b0e31fcf8c4eb402a3d6604d317ea78f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 22 Dec 2020 13:34:03 -0700 Subject: [PATCH 1716/1973] Add private declarations --- src/cpl/nuopc/lnd_import_export.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index f53b6ccd5e..bbcb7d0d52 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -36,6 +36,10 @@ module lnd_import_export private :: fldlist_add private :: fldlist_realize + private :: state_getimport_1d + private :: state_getimport_2d + private :: state_setexport_1d + private :: state_setexport_2d private :: state_getfldptr private :: fldchk From 144137e728e8d5014b8505ee7d2cb946658f87d1 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 22 Dec 2020 16:19:02 -0700 Subject: [PATCH 1717/1973] Return to always sending to atm See https://github.com/ESCOMP/CTSM/issues/1237 for how we want to handle this longer term. --- src/cpl/nuopc/lnd_import_export.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index bbcb7d0d52..e3e4e11bc3 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -170,6 +170,11 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r type(ESMF_State) :: exportState character(ESMF_MAXSTR) :: cvalue integer :: n, num + + ! BUG(wjs, 2020-12-22, ESCOMP/CTSM#1237) force_send_to_atm should be read from the + ! namelist rather than being hard-coded to true. + logical, parameter :: force_send_to_atm = .true. + character(len=*), parameter :: subname='(lnd_import_export:advertise_fields)' !------------------------------------------------------------------------------- @@ -182,7 +187,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r ! determine necessary toggles for below !-------------------------------- - if (atm_prognostic) then + if (atm_prognostic .or. force_send_to_atm) then send_to_atm = .true. else send_to_atm = .false. From 1cf3b8b6cebb9b1ba8b95d34c8062532a7ee12fa Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 22 Dec 2020 16:27:41 -0700 Subject: [PATCH 1718/1973] Remove unnecessary timer --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 30c1c97d61..2f6ddc921b 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -895,12 +895,10 @@ subroutine ModelAdvance(gcomp, rc) ! Determine time of next atmospheric shortwave calculation !-------------------------------- - call t_startf(trim(subname)//' nextsw_cday') call State_GetScalar(importState, & flds_scalar_index_nextsw_cday, nextsw_cday, & flds_scalar_name, flds_scalar_num, rc) call set_nextsw_cday( nextsw_cday ) - call t_stopf(trim(subname)//' nextsw_cday') !-------------------------------- ! Unpack import state From 16bc97a8ee04d97e4d52c96578cca143f1120e9a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 22 Dec 2020 16:28:54 -0700 Subject: [PATCH 1719/1973] Remove mistakenly added correction to flood term It seems this was added in error, at least based on comparison with the mct code. Mariana agrees. Note that I have also restored the negative. --- src/cpl/nuopc/lnd_import_export.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index e3e4e11bc3..ef3b72462a 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -630,7 +630,7 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & call state_getimport_1d(importState, Flrr_flood, wateratm2lndbulk_inst%forc_flood_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg, endg - wateratm2lndbulk_inst%forc_flood_grc(g) = wateratm2lndbulk_inst%forc_flood_grc(g) * (ldomain%area(g) * 1.e6_r8) + wateratm2lndbulk_inst%forc_flood_grc(g) = -wateratm2lndbulk_inst%forc_flood_grc(g) end do else wateratm2lndbulk_inst%forc_flood_grc(:) = 0._r8 From 219377b39198fe9a8ea502f923b441fe2d08560a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 22 Dec 2020 16:40:57 -0700 Subject: [PATCH 1720/1973] Fix implementation of minus optional argument --- src/cpl/nuopc/lnd_import_export.F90 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index ef3b72462a..d7ca763acd 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -1103,15 +1103,24 @@ subroutine state_setexport_1d(state, fldname, ctsmdata, minus, rc) integer , intent(out):: rc ! local variables + logical :: l_minus ! local version of minus real(r8), pointer :: fldPtr1d(:) integer :: g character(len=*), parameter :: subname='(lnd_export_export:state_setexport_1d)' ! ---------------------------------------------- + rc = ESMF_SUCCESS + + if (present(minus)) then + l_minus = minus + else + l_minus = .false. + end if + call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr1d(:) = 0._r8 - if (present(minus)) then + if (l_minus) then do g = 1,size(ctsmdata) fldptr1d(g) = -ctsmdata(g) end do @@ -1140,6 +1149,7 @@ subroutine state_setexport_2d(state, fldname, ctsmdata, minus, rc) integer , intent(out):: rc ! local variables + logical :: l_minus ! local version of minus real(r8), pointer :: fldPtr2d(:,:) integer :: g, n character(len=CS) :: cnum @@ -1148,12 +1158,18 @@ subroutine state_setexport_2d(state, fldname, ctsmdata, minus, rc) rc = ESMF_SUCCESS + if (present(minus)) then + l_minus = minus + else + l_minus = .false. + end if + call state_getfldptr(state, trim(fldname), fldptr2d=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return fldptr2d(:,:) = 0._r8 do n = 1,size(ctsmdata, dim=2) write(cnum,'(i0)') n - if (present(minus)) then + if (l_minus) then do g = 1,size(ctsmdata, dim=1) fldptr2d(n,g) = -ctsmdata(g,n) end do From d267cebc28311fa6f19e85ab704fcc35b502d780 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 23 Dec 2020 10:13:08 -0700 Subject: [PATCH 1721/1973] Mods for successful grid cell-level H2O error checks in transient cases These tests PASS: ERP_D.f10_f10_musgs.IHistClm50Bgc.cheyenne_gnu.clm-decStart ERS_Ly3_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropQianRs.cheyenne_gnu.clm-cropMonthOutput --- src/biogeophys/BalanceCheckMod.F90 | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 91c6b9c0e9..6bad841b8f 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -159,6 +159,7 @@ subroutine BeginWaterGridcellBalance(bounds, & water_inst%bulk_and_tracers(i)%waterstate_inst, & water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & water_inst%bulk_and_tracers(i)%waterbalance_inst, & + water_inst%bulk_and_tracers(i)%waterflux_inst, & use_aquifer_layer = use_aquifer_layer) end do @@ -209,7 +210,7 @@ end subroutine BeginWaterColumnBalance subroutine BeginWaterGridcellBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & soilhydrology_inst, lakestate_inst, waterstate_inst, & - waterdiagnostic_inst, waterbalance_inst, & + waterdiagnostic_inst, waterbalance_inst, waterflux_inst, & use_aquifer_layer) ! ! !DESCRIPTION: @@ -228,13 +229,16 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & type(soilhydrology_type) , intent(in) :: soilhydrology_inst type(lakestate_type) , intent(in) :: lakestate_inst class(waterstate_type) , intent(inout) :: waterstate_inst + class(waterflux_type) , intent(inout) :: waterflux_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst class(waterbalance_type) , intent(inout) :: waterbalance_inst logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: - integer :: c, j, fc ! indices + integer :: c, g, j, fc ! indices integer :: begc, endc, begg, endg ! bounds + real(r8) :: qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at beginning of time step + real(r8) :: qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc ice dynamic land cover change conversion runoff flux at beginning of time step !----------------------------------------------------------------------- associate( & @@ -278,6 +282,14 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & call c2g(bounds, begwb_col(begc:endc), begwb_grc(begg:endg), & c2l_scale_type='urbanf', l2g_scale_type='unity') + call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_beg(bounds, qflx_liq_dynbal_left_to_dribble(begg:endg)) + call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_beg(bounds, qflx_ice_dynbal_left_to_dribble(begg:endg)) + + do g = begg, endg + begwb_grc(g) = begwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & + - qflx_ice_dynbal_left_to_dribble(g) + end do + end associate end subroutine BeginWaterGridcellBalanceSingle @@ -407,6 +419,8 @@ subroutine BalanceCheck( bounds, & real(r8) :: qflx_glcice_dyn_water_flux_grc(bounds%begg:bounds%endg) ! grid cell-level water flux needed for balance check due to glc_dyn_runoff_routing [mm H2O/s] (positive means addition of water to the system) real(r8) :: qflx_snwcp_discarded_liq_grc(bounds%begg:bounds%endg) ! grid cell-level excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] real(r8) :: qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg) ! grid cell-level excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] + real(r8) :: qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at end of time step + real(r8) :: qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at end of time step real(r8) :: errh2o_max_val ! Maximum value of error in water conservation error over all columns [mm H2O] real(r8) :: errh2osno_max_val ! Maximum value of error in h2osno conservation error over all columns [kg m-2] @@ -630,7 +644,13 @@ subroutine BalanceCheck( bounds, & qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_end(bounds, qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg)) + call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_end(bounds, qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg)) + do g = bounds%begg, bounds%endg + endwb_grc(g) = endwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & + - qflx_ice_dynbal_left_to_dribble(g) + errh2o_grc(g) = endwb_grc(g) - begwb_grc(g) & - (forc_rain_grc(g) & + forc_snow_grc(g) & From 7e19306103ced0526e83167d8201cdb84015969c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 23 Dec 2020 10:34:00 -0700 Subject: [PATCH 1722/1973] Get SMS_D_Ld1_Mmpi-serial.f45_f45_mg37.I2000Clm50Sp.izumi_pgi.clm-ptsRLA to replicate ctsm5.1.dev019 answers by modifying three terms, that would've just been roundoff different when use_biomass_heat_storage is off --- src/biogeophys/CanopyFluxesMod.F90 | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 36edd7761c..8a47888ad6 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -410,6 +410,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: rstem(bounds%begp:bounds%endp) !stem resistance to heat transfer real(r8) :: dt_stem(bounds%begp:bounds%endp) !change in stem temperature real(r8) :: frac_rad_abs_by_stem(bounds%begp:bounds%endp) !fraction of incoming radiation absorbed by stems + real(r8) :: frac_rad_abs_by_leaf !fraction of incoming radiation absorbed by leaf real(r8) :: lw_stem(bounds%begp:bounds%endp) !internal longwave stem real(r8) :: lw_leaf(bounds%begp:bounds%endp) !internal longwave leaf real(r8) :: sa_stem(bounds%begp:bounds%endp) !surface area stem m2/m2_ground @@ -1216,13 +1217,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - dt_veg(p) = ((1.-frac_rad_abs_by_stem(p))*(sabv(p) + air(p) & + dt_veg(p) = ((1._r8-frac_rad_abs_by_stem(p))*(sabv(p) + air(p) & + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & - efsh - efe(p) - lw_leaf(p) + lw_stem(p) & - (cp_leaf(p)/dtime)*(t_veg(p) - tl_ini(p))) & - / ((1.-frac_rad_abs_by_stem(p))*(- 4._r8*bir(p)*t_veg(p)**3) & + / (((1._r8-frac_rad_abs_by_stem(p))*(- 4._r8*bir(p)*t_veg(p)**3) & + 4._r8*sa_internal(p)*emv(p)*sb*t_veg(p)**3 & - +dc1*wtga(p) +dc2*wtgaq*qsatldT(p) + cp_leaf(p)/dtime) + +dc1*wtga(p) +dc2*wtgaq*qsatldT(p)) + cp_leaf(p)/dtime) t_veg(p) = tlbef(p) + dt_veg(p) @@ -1481,20 +1482,35 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy +! dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & +! emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & - + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & - *(1.-frac_rad_abs_by_stem(p)) & + + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) + if ( use_biomass_heat_storage )then + frac_rad_abs_by_leaf = 1._r8-frac_rad_abs_by_stem(p) + else + frac_rad_abs_by_leaf = 1._r8 + end if + dlrad(p) = dlrad(p) & + *(1._r8-frac_rad_abs_by_stem(p)) & + emv(p)*emg(c)*sb*ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p)) & *frac_rad_abs_by_stem(p) ! Upward longwave radiation above the canopy - ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & + ulrad(p) = (1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) + if ( .not. use_biomass_heat_storage )then + ulrad(p) = (ulrad(p) & + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + & + 4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + else + ulrad(p) = (ulrad(p) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & - *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1.-frac_rad_abs_by_stem(p)) & + *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1._r8-frac_rad_abs_by_stem(p)) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & *ts_ini(p)**3*(ts_ini(p)+ 4._r8*dt_stem(p))*frac_rad_abs_by_stem(p) & + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + end if From 32a793082ee494232457bc35cf5207fa32953e03 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 23 Dec 2020 11:23:14 -0700 Subject: [PATCH 1723/1973] Minor clean-up --- src/biogeophys/BalanceCheckMod.F90 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 6bad841b8f..ad2cbd31dd 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -439,9 +439,9 @@ subroutine BalanceCheck( bounds, & forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse radiation (vis=forc_solsd, nir=forc_solld) forc_rain => wateratm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] column level rain rate [mm/s] - forc_rain_grc => wateratm2lnd_inst%forc_rain_not_downscaled_grc, & ! Input: [real(r8) (:)] grid cell-level rain rate [mm/s] + forc_rain_grc => wateratm2lnd_inst%forc_rain_not_downscaled_grc, & ! Input: [real(r8) (:) ] grid cell-level rain rate [mm/s] forc_snow => wateratm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] column level snow rate [mm/s] - forc_snow_grc => wateratm2lnd_inst%forc_snow_not_downscaled_grc, & ! Input: [real(r8) (:)] grid cell-level snow rate [mm/s] + forc_snow_grc => wateratm2lnd_inst%forc_snow_not_downscaled_grc, & ! Input: [real(r8) (:) ] grid cell-level snow rate [mm/s] forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) h2osno_old => waterbalance_inst%h2osno_old_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) at previous time step @@ -461,8 +461,8 @@ subroutine BalanceCheck( bounds, & qflx_snow_grnd_col => waterflux_inst%qflx_snow_grnd_col , & ! Input: [real(r8) (:) ] snow on ground after interception (mm H2O/s) [+] qflx_snwcp_liq => waterflux_inst%qflx_snwcp_liq_col , & ! Input: [real(r8) (:) ] excess liquid h2o due to snow capping (outgoing) (mm H2O /s) [+]` qflx_snwcp_ice => waterflux_inst%qflx_snwcp_ice_col , & ! Input: [real(r8) (:) ] excess solid h2o due to snow capping (outgoing) (mm H2O /s) [+]` - qflx_snwcp_discarded_liq_col => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Input: [real(r8) (:) ] column level excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] - qflx_snwcp_discarded_ice_col => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Input: [real(r8) (:) ] column level excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] + qflx_snwcp_discarded_liq_col => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Input: [real(r8) (:)] column level excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] + qflx_snwcp_discarded_ice_col => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Input: [real(r8) (:)] column level excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] qflx_evap_tot_col => waterflux_inst%qflx_evap_tot_col , & ! Input: [real(r8) (:) ] column level qflx_evap_soi + qflx_evap_can + qflx_tran_veg qflx_evap_tot_grc => waterlnd2atm_inst%qflx_evap_tot_grc , & ! Input: [real(r8) (:) ] grid cell-level qflx_evap_soi + qflx_evap_can + qflx_tran_veg qflx_soliddew_to_top_layer => waterflux_inst%qflx_soliddew_to_top_layer_col , & ! Input: [real(r8) (:) ] rate of solid water deposited on top soil or snow layer (frost) (mm H2O /s) [+] @@ -473,20 +473,18 @@ subroutine BalanceCheck( bounds, & qflx_snow_h2osfc => waterflux_inst%qflx_snow_h2osfc_col , & ! Input: [real(r8) (:) ] snow falling on surface water (mm/s) qflx_h2osfc_to_ice => waterflux_inst%qflx_h2osfc_to_ice_col , & ! Input: [real(r8) (:) ] conversion of h2osfc to ice qflx_drain_perched_col => waterflux_inst%qflx_drain_perched_col , & ! Input: [real(r8) (:) ] column level sub-surface runoff (mm H2O /s) - qflx_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:) ] grid cell-level sub-surface runoff (mm H2O /s) + qflx_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:)] grid cell-level sub-surface runoff (mm H2O /s) qflx_flood_col => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] column level total runoff due to flooding forc_flood_grc => wateratm2lnd_inst%forc_flood_grc , & ! Input: [real(r8) (:) ] grid cell-level total grid cell-level runoff from river model qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Input: [real(r8) (:) ] drainage from snow pack -! qflx_liq_dynbal_grc => waterflux_inst%qflx_liq_dynbal_grc , & ! Input: [real(r8) (:) ] slevis: place holder -! qflx_ice_dynbal_grc => waterflux_inst%qflx_ice_dynbal_grc , & ! Input: [real(r8) (:) ] slevis: place holder qflx_surf_col => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] column level surface runoff (mm H2O /s) qflx_surf_grc => waterlnd2atm_inst%qflx_rofliq_qsur_grc , & ! Input: [real(r8) (:) ] grid cell-level surface runoff (mm H20 /s) qflx_qrgwl_col => waterflux_inst%qflx_qrgwl_col , & ! Input: [real(r8) (:) ] column level qflx_surf at glaciers, wetlands, lakes qflx_qrgwl_grc => waterlnd2atm_inst%qflx_rofliq_qgwl_grc , & ! Input: [real(r8) (:) ] grid cell-level qflx_surf at glaciers, wetlands, lakes qflx_drain_col => waterflux_inst%qflx_drain_col , & ! Input: [real(r8) (:) ] column level sub-surface runoff (mm H2O /s) qflx_drain_grc => waterlnd2atm_inst%qflx_rofliq_qsub_grc , & ! Input: [real(r8) (:) ] grid cell-level drainage (mm H20 /s) - qflx_ice_runoff_col => waterlnd2atm_inst%qflx_ice_runoff_col , & ! Input: [real(r8) (:) ] column level solid runoff from snow capping and from excess ice in soil (mm H2O /s) - qflx_ice_runoff_grc => waterlnd2atm_inst%qflx_rofice_grc , & ! Input: [real(r8) (:) ] grid cell-level solid runoff from snow capping and from excess ice in soil (mm H2O /s) + qflx_ice_runoff_col => waterlnd2atm_inst%qflx_ice_runoff_col , & ! Input: [real(r8) (:) ] column level solid runoff from snow capping and from excess ice in soil (mm H2O /s) + qflx_ice_runoff_grc => waterlnd2atm_inst%qflx_rofice_grc , & ! Input: [real(r8) (:) ] grid cell-level solid runoff from snow capping and from excess ice in soil (mm H2O /s) qflx_sl_top_soil => waterflux_inst%qflx_sl_top_soil_col , & ! Input: [real(r8) (:) ] liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) qflx_sfc_irrig_col => waterflux_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] column level irrigation flux (mm H2O /s) @@ -585,7 +583,7 @@ subroutine BalanceCheck( bounds, & if (errh2o_max_val > h2o_warning_thresh) then - indexc = maxloc( abs(errh2o_col(bounds%begc:bounds%endc)), 1 ) + bounds%begc -1 + indexc = maxloc( abs(errh2o_col(bounds%begc:bounds%endc)), 1 ) + bounds%begc - 1 write(iulog,*)'WARNING: column-level water balance error ',& ' nstep= ',nstep, & ' local indexc= ',indexc,& @@ -671,7 +669,7 @@ subroutine BalanceCheck( bounds, & if (errh2o_max_val > h2o_warning_thresh) then - indexg = maxloc( abs(errh2o_grc(bounds%begg:bounds%endg)), 1 ) + bounds%begg -1 + indexg = maxloc( abs(errh2o_grc(bounds%begg:bounds%endg)), 1 ) + bounds%begg - 1 write(iulog,*)'WARNING: grid cell-level water balance error ',& ' nstep= ',nstep, & ' local indexg= ',indexg,& @@ -698,7 +696,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'deltawb/dtime = ',(endwb_grc(indexg)-begwb_grc(indexg))/dtime write(iulog,*)'qflx_drain_perched = ',qflx_drain_perched_grc(indexg)*dtime write(iulog,*)'forc_flood = ',forc_flood_grc(indexg)*dtime - write(iulog,*)'qflx_glcice_dyn_water_flux_grc = ',qflx_glcice_dyn_water_flux_grc(indexg)*dtime + write(iulog,*)'qflx_glcice_dyn_water_flux = ',qflx_glcice_dyn_water_flux_grc(indexg)*dtime write(iulog,*)'clm model is stopping' call endrun(decomp_index=indexg, clmlevel=nameg, msg=errmsg(sourcefile, __LINE__)) From 097ff9805c5d10e55c9be42e6ec19d066a3b963f Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 23 Dec 2020 12:08:39 -0700 Subject: [PATCH 1724/1973] First draft of ChangeLog --- doc/ChangeLog | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 121 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 5642709fc1..a9cbe04d1e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,124 @@ =============================================================== +Tag name: ctsm5.1.dev020 +Originator(s): slevis (Samuel Levis,303-665-1310) +Date: Wed Dec 23 11:29:33 MST 2020 +One-line Summary: Grid cell-level error check for H2O + +Purpose of changes +------------------ + + For more robust mass balance error checking, introduced + grid cell-level error check for H2O following the approach + of pull requests #984 and #1022 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): #201 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + None + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + None + +Changes made to namelist defaults (e.g., changed parameter values): + None + +Changes to the datasets (e.g., parameter, surface or initial files): + None + +Substantial timing or memory changes: [For timing changes, can check PFS test(s) in the test suite] + None + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + None + +Changes to tests or testing: + None + +CTSM testing: + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - + + tools-tests (test/tools): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): + + cheyenne - + + python testing (see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm): + + cheyenne ---- PEND (expect OK) + izumi ------- PEND (expect OK) + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + + Summarize any changes to answers, i.e., + - what code configurations: ALL + - what platforms/compilers: ALL + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Specific example from running the single point test + ERI_D_Ld9.1x1_camdenNJ.I2000Clm50BgcCruRs.cheyenne_intel.clm-default: + RMS ERRH2O 6.0280E-21 NORMALIZED 7.6050E-06 + + Explanation: Moving call BalanceCheck to after the call lnd2glc in + subroutine clm_drv causes a change in order of operations that leads to + the above change in ERRH2O. + + +Detailed list of changes +------------------------ + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + None + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/ctsm/pull/1228 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev019 Originator(s): sacks (Bill Sacks) Date: Sat Dec 19 06:55:46 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 3789dbee16..6cfae1392f 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev020 slevis 12/23/2020 Grid cell-level error check for H2O ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler ctsm5.1.dev018 slevis 12/08/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file From 11e69572aae09643934615d9a53cee3250c3f90d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 23 Dec 2020 14:38:28 -0700 Subject: [PATCH 1725/1973] Remove frac_rad_abs_by_leaf as it wasn't be used --- src/biogeophys/CanopyFluxesMod.F90 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 8a47888ad6..20adce4bf2 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -410,7 +410,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: rstem(bounds%begp:bounds%endp) !stem resistance to heat transfer real(r8) :: dt_stem(bounds%begp:bounds%endp) !change in stem temperature real(r8) :: frac_rad_abs_by_stem(bounds%begp:bounds%endp) !fraction of incoming radiation absorbed by stems - real(r8) :: frac_rad_abs_by_leaf !fraction of incoming radiation absorbed by leaf real(r8) :: lw_stem(bounds%begp:bounds%endp) !internal longwave stem real(r8) :: lw_leaf(bounds%begp:bounds%endp) !internal longwave leaf real(r8) :: sa_stem(bounds%begp:bounds%endp) !surface area stem m2/m2_ground @@ -1486,11 +1485,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) - if ( use_biomass_heat_storage )then - frac_rad_abs_by_leaf = 1._r8-frac_rad_abs_by_stem(p) - else - frac_rad_abs_by_leaf = 1._r8 - end if dlrad(p) = dlrad(p) & *(1._r8-frac_rad_abs_by_stem(p)) & + emv(p)*emg(c)*sb*ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p)) & From 552bfa366f703683a51ea89ea3c44d4e7bf8af62 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 23 Dec 2020 19:35:12 -0700 Subject: [PATCH 1726/1973] Fix a mistake with dlrad --- src/biogeophys/CanopyFluxesMod.F90 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 20adce4bf2..bb361d29d6 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -417,6 +417,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: sa_internal(bounds%begp:bounds%endp) !min(sa_stem,sa_leaf) real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed real(r8) :: carea_stem !cross-sectional area of stem + real(r8) :: dlrad_leaf !Downward longwave radition from leaf ! Biomass heat storage tuning parameters ! These parameters can be used to account for differences @@ -1483,12 +1484,15 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & ! emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) - dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & - + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) - dlrad(p) = dlrad(p) & - *(1._r8-frac_rad_abs_by_stem(p)) & + dlrad_leaf = emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) + dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + if ( .not. use_biomass_heat_storage )then + dlrad(p) = dlrad(p) + dlrad_leaf + else + dlrad(p) = dlrad(p) + dlrad_leaf *(1._r8-frac_rad_abs_by_stem(p)) & + emv(p)*emg(c)*sb*ts_ini(p)**3*(ts_ini(p) + 4._r8*dt_stem(p)) & *frac_rad_abs_by_stem(p) + end if ! Upward longwave radiation above the canopy From 96e1a9293429ca586573697bac119b5ccbdba54f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 26 Dec 2020 12:27:59 -0700 Subject: [PATCH 1727/1973] refator to set ldecomp and ldomain data types in caps --- src/cpl/lilac/lnd_comp_esmf.F90 | 29 +- src/cpl/lilac/lnd_set_decomp_and_domain.F90 | 596 ++++++++++++++++++++ src/cpl/mct/lnd_comp_mct.F90 | 127 ++--- src/cpl/mct/lnd_set_decomp_and_domain.F90 | 299 ++++++++++ src/cpl/nuopc/lnd_comp_nuopc.F90 | 321 ++--------- src/cpl/nuopc/lnd_import_export.F90 | 36 +- src/main/clm_initializeMod.F90 | 238 ++++---- src/main/clm_varctl.F90 | 3 - src/main/decompInitMod.F90 | 8 +- src/main/surfrdMod.F90 | 262 +-------- 10 files changed, 1162 insertions(+), 757 deletions(-) create mode 100644 src/cpl/lilac/lnd_set_decomp_and_domain.F90 create mode 100644 src/cpl/mct/lnd_set_decomp_and_domain.F90 diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index ba5f73c2b7..ea3af7c88e 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -35,7 +35,7 @@ module lnd_comp_esmf use clm_time_manager , only : set_nextsw_cday, update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size use clm_time_manager , only : get_curr_date, get_curr_calday - use clm_initializeMod , only : initialize1, initialize2 + use clm_initializeMod , only : initialize1, initialize2, initialize3 use clm_driver , only : clm_drv use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_diagnose @@ -320,36 +320,31 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call set_timemgr_init( & calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, dtime_in=dtime_lilac) + call ESMF_LogWrite(subname//"ctsm time manager initialized....", ESMF_LOGMSG_INFO) !---------------------- ! Read namelist, grid and surface data !---------------------- - ! set default values for run control variables call clm_varctl_set(caseid_in=caseid, nsrest_in=nsrest) - call ESMF_LogWrite(subname//"default values for run control variables are set...", ESMF_LOGMSG_INFO) - - !---------------------- ! Initialize glc_elevclass module - !---------------------- - call glc_elevclass_init(glc_nec) + call ESMF_LogWrite(subname//"default values for run control variables are set...", ESMF_LOGMSG_INFO) !---------------------- ! Call initialize1 !---------------------- - - ! Note that the memory for gindex_ocn will be allocated in the following call - - call initialize1(dtime=dtime_lilac, gindex_ocn=gindex_ocn) - - call ESMF_LogWrite(subname//"ctsm time manager initialized....", ESMF_LOGMSG_INFO) + call initialize1(dtime=dtime_sync) call ESMF_LogWrite(subname//"ctsm initialize1 done...", ESMF_LOGMSG_INFO) + !---------------------- + ! Initialize decomposition (ldecomp) and domain (ldomain) types + !---------------------- + call lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) + !-------------------------------- ! generate the land mesh on ctsm distribution !-------------------------------- - ! obtain global index array for just land points which includes mask=0 or ocean points call get_proc_bounds( bounds ) @@ -359,7 +354,6 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) n = 1 + (g - bounds%begg) gindex_lnd(n) = ldecomp%gdc2glo(g) end do - call ESMF_LogWrite(subname//"obtained global index", ESMF_LOGMSG_INFO) ! create a global index that includes both land and ocean points @@ -393,14 +387,13 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !-------------------------------- ! Finish initializing ctsm !-------------------------------- - - call initialize2() + call initialize2(ni,nj) + call initialize3() call ESMF_LogWrite(subname//"ctsm initialize2 done...", ESMF_LOGMSG_INFO) !-------------------------------- ! Create import state (only assume input from atm - not rof and glc) !-------------------------------- - ! create an empty field bundle for import of atm fields c2l_fb_atm = ESMF_FieldBundleCreate (name='c2l_fb_atm', rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/src/cpl/lilac/lnd_set_decomp_and_domain.F90 b/src/cpl/lilac/lnd_set_decomp_and_domain.F90 new file mode 100644 index 0000000000..d11ddbf5aa --- /dev/null +++ b/src/cpl/lilac/lnd_set_decomp_and_domain.F90 @@ -0,0 +1,596 @@ +module lnd_set_decomp_and_domain + + use ESMF + use NUOPC , only : NUOPC_CompAttributeGet + use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl + use spmdMod , only : masterproc + use clm_varctl , only : iulog + use perf_mod , only : t_startf, t_stopf, t_barrierf + + implicit none + private ! except + + ! Module public routines + public :: lnd_set_decomp_and_domain_from_meshinfo + public :: lnd_set_decomp_and_domain_from_surfrd + + ! Module private routines + private :: clm_getlandmask_from_lndmesh + + character(len=*) , parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) + + ! Initialize ldecomp and ldomain data types + + use clm_varpar , only: nlevsoi + use clm_varctl , only: fatmlndfrc, use_soil_moisture_streams + use decompInitMod , only: decompInit_lnd, decompInit_lnd3D + use decompMod , only: bounds_type, get_proc_bounds + use domainMod , only: ldomain, domain_init, domain_check + + ! input/output variables + logical, intent(out) :: noland + integer, intent(out) :: ni, nj ! global grid sizes + + ! local variables + integer ,pointer :: amask(:) ! global land mask + integer :: begg, endg ! processor bounds + type(bounds_type) :: bounds ! bounds + character(len=32) :: subname = 'lnd_set_decomp_and_domain_from_surfrd' + !----------------------------------------------------------------------- + + ! Read in global land grid and land mask (amask)- needed to set decomposition + ! global memory for amask is allocate in surfrd_get_glomask - must be deallocated below + if (masterproc) then + write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) + endif + + ! Get global mask, ni and nj + call surfrd_get_globmask(filename=fatmlndfrc, mask=amask, ni=ni, nj=nj) + + ! Exit early if no valid land points + if ( all(amask == 0) )then + if (masterproc) write(iulog,*) trim(subname)//': no valid land points do NOT run clm' + noland = .true. + return + else + noland = .false. + end if + + ! Initialize ldecomp data type + ! Determine ctsm gridcell decomposition and processor bounds for gridcells + call decompInit_lnd(ni, nj, amask) + deallocate(amask) + if (use_soil_moisture_streams) call decompInit_lnd3D(ni, nj, nlevsoi) + + ! Initialize bounds for just gridcells + ! Remaining bounds (landunits, columns, patches) will be determined + ! after the call to decompInit_glcp - so get_proc_bounds is called + ! twice and the gridcell information is just filled in twice + call get_proc_bounds(bounds) + + ! Get grid cell bounds values + begg = bounds%begg + endg = bounds%endg + + ! Initialize ldomain data type + if (masterproc) then + write(iulog,*) 'Attempting to read ldomain from ',trim(fatmlndfrc) + endif + call surfrd_get_grid(begg, endg, ldomain, fatmlndfrc) + if (masterproc) then + call domain_check(ldomain) + endif + ldomain%mask = 1 !!! TODO - is this needed? + + end subroutine lnd_set_decomp_and_domain_from_surfrd + + !==================================================================================== + subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, rc) + + use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D + use domainMod , only : ldomain, domain_init, lon1d, lat1d + use decompMod , only : bounds_type, get_proc_bounds + use clm_varpar , only : nlevsoi + use clm_varctl , only : use_soil_moisture_streams, single_column + use clm_varcon , only : re + use lnd_comp_shr , only : mesh, model_meshfile, model_clock + + ! input/output variables + type(ESMF_GridComp) , intent(inout) :: gcomp + type(ESMF_Mesh) , intent(out) :: mesh + integer , intent(out) :: rc + + ! local variables + type(ESMF_VM) :: vm + type(ESMF_Mesh) :: mesh_lnd + type(ESMF_Mesh) :: mesh_ocn + type(ESMF_RouteHandle) :: rhandle_ocn2lnd + type(ESMF_DistGrid) :: distgrid_mesh + type(ESMF_DistGrid) :: distgrid_lnd + character(CL) :: cvalue ! config data + integer :: nlnd, nocn ! local size ofarrays + integer :: g,n ! indices + type(bounds_type) :: bounds ! bounds + integer :: begg,endg + character(CL) :: meshfile_ocn + integer , pointer :: gindex_lnd(:) ! global index space for just land points + integer , pointer :: gindex_ocn(:) ! global index space for just ocean points + integer , pointer :: gindex(:) ! global index space for land and ocean points + integer , pointer :: mask(:) ! local land/ocean mask + integer , pointer :: lndmask_loc(:) + real(r8) , pointer :: lndfrac_loc(:) + real(r8) , pointer :: lndarea_loc(:) + integer , pointer :: lndmask_glob(:) + real(r8) , pointer :: lndfrac_glob(:) + real(r8) , pointer :: lndarea_glob(:) + real(r8) , pointer :: lndlats_glob(:) + real(r8) , pointer :: lndlons_glob(:) + real(r8) , pointer :: rtemp_glob(:) + integer , pointer :: itemp_glob(:) + real(r8) , pointer :: dataptr1d(:) + integer :: srcMaskValue = 0 + integer :: dstMaskValue = -987987 ! spval for RH mask values + integer :: srcTermProcessing_Value = 0 + logical :: checkflag = .false. + real(r8) :: fminval = 0.001_r8 + real(r8) :: fmaxval = 1._r8 + integer :: lsize,gsize + logical :: isgrid2d + real(R8) , pointer :: ownedElemCoords(:) + integer :: spatialDim + type(ESMF_Field) :: areaField + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! determine global 2d sizes + call NUOPC_CompAttributeGet(gcomp, name='lnd_ni', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) ni + call NUOPC_CompAttributeGet(gcomp, name='lnd_nj', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) nj + gsize = ni*nj + if (single_column) then + isgrid2d = .true. + else if (nj == 1) then + isgrid2d = .false. + else + isgrid2d = .true. + end if + if (masterproc) then + write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj + if (isgrid2d) then + write(iulog,'(a)') 'model grid is 2-dimensional' + else + write(iulog,'(a)') 'model grid is not 2-dimensional' + end if + end if + + ! read in the land mesh from the file + mesh_lnd = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(iulog,'(a)')'land mesh file ',trim(model_meshfile) + end if + + ! read in ocn mask meshfile + call NUOPC_CompAttributeGet(gcomp, name='mesh_ocnmask', value=meshfile_ocn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + mesh_ocn = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) + end if + + ! obtain land mask from land mesh file - assume that land frac is identical to land mask + call clm_getlandmask_from_lndmesh(mesh_lnd, lsize, lndmask_loc, landfrac_loc, distgrid_lnd, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! determine global landmask_glob - needed to determine the ctsm decomposition + ! land frac, lats, lons and areas will be done below + allocate(gindex(lsize)) + call ESMF_DistGridGet(distgrid_lnd, 0, seqIndexList=gindex, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 + do n = 1,lsize + lndmask_glob(gindex(n)) = lndmask_loc(n) + end do + allocate(itemp_glob(gsize)) + call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndmask_glob(:) = int(itemp_glob(:)) + deallocate(itemp_glob) + call ESMF_DistGridDestroy(distgrid_lnd) + + ! determine lnd decomposition that will be used by ctsm + call decompInit_lnd(lni=ni, lnj=nj, amask=lndmask_glob) + if (use_soil_moisture_streams) then + call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) + end if + + ! Determine ocn decomposition that will be used to create the full mesh + ! note that the memory for gindex_ocn will be allocated in the following call + call decompInit_ocn(ni=ni, nj=nj, amask=lndmask_glob, gindex_ocn=gindex_ocn) + + ! *** Get JUST gridcell processor bounds *** + ! Remaining bounds (landunits, columns, patches) will be set after calling decompInit_glcp + ! so get_proc_bounds is called twice and the gridcell information is just filled in twice + call get_proc_bounds(bounds) + begg = bounds%begg + endg = bounds%endg + + ! Create gindex_lnd + nlnd = endg - begg + 1 + allocate(gindex_lnd(nlnd)) + do g = begg, endg + n = 1 + (g - begg) + gindex_lnd(n) = ldecomp%gdc2glo(g) + end do + + ! Initialize domain data structure + call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + + ! Determine ldomain%mask + do g = begg, endg + n = 1 + (g - begg) + ldomain%mask(g) = lndmask_glob(gindex_lnd(n)) + end do + deallocate(lndmask_glob) + + ! Determine ldomain%frac + allocate(rtemp_glob(gsize)) + allocate(lndfrac_glob(gsize)) + lndfrac_glob(:) = 0._r8 + do n = 1,lsize + lndfrac_glob(gindex(n)) = lndfrac_loc(n) + end do + call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndfrac_glob(:) = rtemp_glob(:) + do g = begg, endg + ldomain%frac(g) = lndfrac_glob(gindex_lnd(g-begg+1)) + end do + deallocate(lndfrac_glob) + + ! Get ownedElemCords from the mesh to be used to obtain ldoman%latc and ldomain%lonc + call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, rc=rc) + allocate(ownedElemCoords(spatialDim*lsize)) + call ESMF_MeshGet(mesh_lnd, ownedElemCoords=ownedElemCoords) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine ldomain%latc and lat1d + allocate(lndlats_glob(gsize)) + lndlats_glob(:) = 0._r8 + do n = 1,lsize + lndlats_glob(gindex(n)) = ownedElemCoords(2*n) + end do + call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndlats_glob(:) = rtemp_glob(:) + do g = begg, endg + ldomain%latc(g) = lndlats_glob(gindex_lnd(g-begg+1)) + end do + if (isgrid2d) then + allocate(lat1d(nj)) + do n = 1,nj + lat1d(n) = lndlats_glob((n-1)*ni + 1) + end do + end if + deallocate(lndlats_glob) + + ! Determine ldomain%lonc and lon1d + allocate(lndlons_glob(gsize)) + lndlons_glob(:) = 0._r8 + do n = 1,lsize + lndlons_glob(gindex(n)) = ownedElemCoords(2*n-1) + end do + call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndlons_glob(:) = rtemp_glob(:) + do g = begg, endg + ldomain%lonc(g) = lndlats_glob(gindex_lnd(g-begg+1)) + end do + if (isgrid2d) then + allocate(lon1d(ni)) + do n = 1,ni + lon1d(n) = lndlons_glob(n) + end do + end if + deallocate(lndlons_glob) + deallocate(rtemp_glob) + + ! Create a global index that includes both land and ocean points + nocn = size(gindex_ocn) + allocate(gindex(nlnd + nocn)) + do n = 1,nlnd+nocn + if (n <= nlnd) then + gindex(n) = gindex_lnd(n) + else + gindex(n) = gindex_ocn(n-nlnd) + end if + end do + + ! Generate a new mesh on the gindex decomposition + distGrid_mesh = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + deallocate(gindex) + mesh = ESMF_MeshCreate(mesh_lnd, elementDistGrid=distgrid_mesh, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Create ldomain%area by querying the mesh on the ctsm decomposition + areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldRegridGetArea(areaField, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(areaField, farrayPtr=dataptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg, endg + ldomain%area(g) = dataptr1d(g-begg+1) * (re*re) + end do + call ESMF_FieldDestroy(areaField) + + end subroutine lnd_set_decomp_and_domain_from_inputmesh + + !=============================================================================== + subroutine clm_getlandmask_from_lndmesh(mesh_lnd, lndmask_loc, lndfrac_loc, lsize, distgrid_lnd, rc) + + ! input/out variables + type(ESMF_Mesh) , intent(in) :: mesh_lnd + integer , pointer :: lndmask_loc(:) + real(r8) , pointer :: lndfrac_loc(:) + integer , intent(out) :: lsize + type(ESMF_DistGrid) , intent(out) :: distgrid_lnd + integer , intent(out) :: rc + + ! local variables: + type(ESMF_Array) :: elemMaskArray + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Determine lsize and distgrid_lnd + call ESMF_MeshGet(mesh_lnd, elementdistGrid=distgrid_lnd, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_DistGridGet(distgrid_lnd, localDe=0, elementCount=lsize, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine lndfrac_loc + allocate(lndmask_loc(lsize)) + elemMaskArray = ESMF_ArrayCreate(distgrid_lnd, lndmask_loc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! The following calls fills in the values of lndmask_loc + call ESMF_MeshGet(mesh_lnd elemMaskArray=elemMaskArray, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine lndmask_loc + ! ASSUME that land fraction is identical to land mask in this case + allocate(lndfrac_loc(lsize)) + lndfrac_loc(:) = lndmask_loc(:) + + end subroutine clm_getlandmask_from_lndmesh + + !=============================================================================== + logical function chkerr(rc, line, file) + integer, intent(in) :: rc + integer, intent(in) :: line + character(len=*), intent(in) :: file + integer :: lrc + chkerr = .false. + lrc = rc + if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=line, file=file)) then + chkerr = .true. + endif + end function chkerr + + !=============================================================================== + subroutine surfrd_get_globmask(filename, mask, ni, nj) + ! + ! !DESCRIPTION: + ! Read the surface dataset grid related information: + ! This is the first routine called by clm_initialize + ! NO DOMAIN DECOMPOSITION HAS BEEN SET YET + ! + ! !USES: + use fileutils , only : getfil + use ncdio_pio , only : ncd_io, ncd_pio_openfile, ncd_pio_closefile, ncd_inqfdims, file_desc_t + use abortutils , only : endrun + use shr_log_mod, only : errMsg => shr_log_errMsg + ! + ! !ARGUMENTS: + character(len=*), intent(in) :: filename ! grid filename + integer , pointer :: mask(:) ! grid mask + integer , intent(out) :: ni, nj ! global grid sizes + ! + ! !LOCAL VARIABLES: + logical :: isgrid2d + integer :: dimid,varid ! netCDF id's + integer :: ns ! size of grid on file + integer :: n,i,j ! index + integer :: ier ! error status + type(file_desc_t) :: ncid ! netcdf id + character(len=256) :: varname ! variable name + character(len=256) :: locfn ! local file name + logical :: readvar ! read variable in or not + integer , allocatable :: idata2d(:,:) + character(len=32) :: subname = 'surfrd_get_globmask' ! subroutine name + !----------------------------------------------------------------------- + + if (filename == ' ') then + mask(:) = 1 + else + ! Check if file exists + if (masterproc) then + if (filename == ' ') then + write(iulog,*) trim(subname),' ERROR: filename must be specified ' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + end if + + ! Open file + call getfil( filename, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + + ! Determine dimensions and if grid file is 2d or 1d + call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) + if (masterproc) then + write(iulog,*)'lat/lon grid flag (isgrid2d) is ',isgrid2d + end if + allocate(mask(ns)) + mask(:) = 1 + if (isgrid2d) then + ! Grid is 2d + allocate(idata2d(ni,nj)) + idata2d(:,:) = 1 + call ncd_io(ncid=ncid, varname='LANDMASK', data=idata2d, flag='read', readvar=readvar) + if (.not. readvar) then + call ncd_io(ncid=ncid, varname='mask', data=idata2d, flag='read', readvar=readvar) + end if + if (readvar) then + do j = 1,nj + do i = 1,ni + n = (j-1)*ni + i + mask(n) = idata2d(i,j) + enddo + enddo + end if + deallocate(idata2d) + else + ! Grid is not 2d + call ncd_io(ncid=ncid, varname='LANDMASK', data=mask, flag='read', readvar=readvar) + if (.not. readvar) then + call ncd_io(ncid=ncid, varname='mask', data=mask, flag='read', readvar=readvar) + end if + end if + if (.not. readvar) call endrun( msg=' ERROR: landmask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + + ! Close file + call ncd_pio_closefile(ncid) + end if + + end subroutine surfrd_get_globmask + + !=============================================================================== + subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) + ! + ! !DESCRIPTION: + ! THIS IS CALLED AFTER THE DOMAIN DECOMPOSITION HAS BEEN CREATED + ! Read the surface dataset grid related information: + ! o real latitude of grid cell (degrees) + ! o real longitude of grid cell (degrees) + ! + ! !USES: + use clm_varcon , only : spval, re, grlnd + use domainMod , only : domain_type, domain_init, domain_clean, lon1d, lat1d + use fileutils , only : getfil + use abortutils , only : endrun + use shr_log_mod, only : errMsg => shr_log_errMsg + use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile + use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim_size, ncd_inqdid, ncd_inqdlen + use pio + ! + ! !ARGUMENTS: + integer , intent(in) :: begg, endg + type(domain_type) , intent(inout) :: ldomain ! domain to init + character(len=*) , intent(in) :: filename ! grid filename + character(len=*) ,optional , intent(in) :: glcfilename ! glc mask filename + ! + ! !LOCAL VARIABLES: + type(file_desc_t) :: ncid ! netcdf id + integer :: beg ! local beg index + integer :: end ! local end index + integer :: ni,nj,ns ! size of grid on file + integer :: dimid,varid ! netCDF id's + integer :: start(1), count(1) ! 1d lat/lon array sections + integer :: ier,ret ! error status + logical :: readvar ! true => variable is on input file + logical :: isgrid2d ! true => file is 2d lat/lon + logical :: istype_domain ! true => input file is of type domain + real(r8), allocatable :: rdata2d(:,:) ! temporary + character(len=16) :: vname ! temporary + character(len=256) :: locfn ! local file name + integer :: n ! indices + character(len=32) :: subname = 'surfrd_get_grid' ! subroutine name +!----------------------------------------------------------------------- + + if (masterproc) then + if (filename == ' ') then + write(iulog,*) trim(subname),' ERROR: filename must be specified ' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + end if + + call getfil( filename, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + + ! Determine dimensions + call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) + + ! Determine isgrid2d flag for domain + call domain_init(ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + + ! Determine type of file - old style grid file or new style domain file + call check_var(ncid=ncid, varname='xc', readvar=readvar) + if (readvar)then + istype_domain = .true. + else + istype_domain = .false. + end if + + ! Read in area, lon, lat + if (istype_domain) then + call ncd_io(ncid=ncid, varname= 'area', flag='read', data=ldomain%area, & + dim1name=grlnd, readvar=readvar) + ! convert from radians**2 to km**2 + ldomain%area = ldomain%area * (re**2) + if (.not. readvar) call endrun( msg=' ERROR: area NOT on file'//errMsg(sourcefile, __LINE__)) + call ncd_io(ncid=ncid, varname= 'xc', flag='read', data=ldomain%lonc, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: xc NOT on file'//errMsg(sourcefile, __LINE__)) + call ncd_io(ncid=ncid, varname= 'yc', flag='read', data=ldomain%latc, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: yc NOT on file'//errMsg(sourcefile, __LINE__)) + else + call endrun( msg=" ERROR: can no longer read non domain files" ) + end if + + if (isgrid2d) then + allocate(rdata2d(ni,nj), lon1d(ni), lat1d(nj)) + if (istype_domain) vname = 'xc' + call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) + lon1d(:) = rdata2d(:,1) + if (istype_domain) vname = 'yc' + call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) + lat1d(:) = rdata2d(1,:) + deallocate(rdata2d) + end if + + ! Check lat limited to -90,90 + if (minval(ldomain%latc) < -90.0_r8 .or. & + maxval(ldomain%latc) > 90.0_r8) then + write(iulog,*) trim(subname),' WARNING: lat/lon min/max is ', & + minval(ldomain%latc),maxval(ldomain%latc) + endif + if ( any(ldomain%lonc < 0.0_r8) )then + call endrun( msg=' ERROR: lonc is negative (see https://github.com/ESCOMP/ctsm/issues/507)' & + //errMsg(sourcefile, __LINE__)) + endif + call ncd_io(ncid=ncid, varname='mask', flag='read', data=ldomain%mask, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) then + call endrun( msg=' ERROR: LANDMASK NOT on fracdata file'//errMsg(sourcefile, __LINE__)) + end if + call ncd_io(ncid=ncid, varname='frac', flag='read', data=ldomain%frac, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) then + call endrun( msg=' ERROR: LANDFRAC NOT on fracdata file'//errMsg(sourcefile, __LINE__)) + end if + + call ncd_pio_closefile(ncid) + + end subroutine surfrd_get_grid + +end module lnd_set_decomp_and_domain diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index 1ae6b9f6b9..afd948941f 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -27,11 +27,10 @@ module lnd_comp_mct private :: lnd_setgsmap_mct ! set the land model mct gs map private :: lnd_domain_mct ! set the land model domain information private :: lnd_handle_resume ! handle pause/resume signals from the coupler - !--------------------------------------------------------------------------- +!==================================================================================== contains - - !==================================================================================== +!==================================================================================== subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) ! @@ -43,9 +42,9 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) use shr_kind_mod , only : shr_kind_cl use abortutils , only : endrun use clm_time_manager , only : get_nstep, set_timemgr_init, set_nextsw_cday - use clm_initializeMod, only : initialize1, initialize2 + use clm_initializeMod, only : initialize1, initialize2, initialize3 use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst - use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog, noland + use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_varorb , only : eccen, obliqr, lambm0, mvelpp use controlMod , only : control_setNL @@ -65,6 +64,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch use clm_cpl_indices , only : clm_cpl_indices_set use mct_mod , only : mct_aVect_init, mct_aVect_zero, mct_gsMap_lsize + use lnd_set_decomp_and_domain, only : lnd_set_decomp_and_domain_from_surfrd use ESMF ! ! !ARGUMENTS: @@ -103,21 +103,20 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) integer :: lbnum ! input to memory diagnostic integer :: shrlogunit,shrloglev ! old values for log unit and log level type(bounds_type) :: bounds ! bounds + logical :: noland + integer :: ni,nj character(len=32), parameter :: sub = 'lnd_init_mct' character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" !----------------------------------------------------------------------- ! Set cdata data - call seq_cdata_setptrs(cdata_l, ID=LNDID, mpicom=mpicom_lnd, & gsMap=GSMap_lnd, dom=dom_l, infodata=infodata) ! Determine attriute vector indices - call clm_cpl_indices_set() ! Initialize clm MPI communicator - call spmd_init( mpicom_lnd, LNDID ) #if (defined _MEMTRACE) @@ -148,18 +147,16 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) call shr_file_setLogUnit (iulog) ! Use infodata to set orbital values - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & orb_lambm0=lambm0, orb_obliqr=obliqr ) ! Consistency check on namelist filename - call control_setNL("lnd_in"//trim(inst_suffix)) ! Initialize clm - ! initialize1 reads namelist, grid and surface data (need this to initialize gsmap) - ! initialize2 performs rest of initialization - + ! initialize1 reads namelists + ! decomp and domain are set in lnd_set_decomp_and_domain_from_surfrd + ! initialize2 and initialize3 perform rest of initialization call seq_timemgr_EClockGetData(EClock, & start_ymd=start_ymd, & start_tod=start_tod, ref_ymd=ref_ymd, & @@ -169,7 +166,6 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) if (masterproc) then write(iulog,*)'dtime = ',dtime_sync end if - call seq_infodata_GetData(infodata, case_name=caseid, & case_desc=ctitle, single_column=single_column, & scmlat=scmlat, scmlon=scmlon, & @@ -192,83 +188,76 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) call endrun( sub//' ERROR: unknown starttype' ) end if + ! set default values for run control variables call clm_varctl_set(caseid_in=caseid, ctitle_in=ctitle, & brnch_retain_casename_in=brnch_retain_casename, & single_column_in=single_column, scmlat_in=scmlat, & scmlon_in=scmlon, nsrest_in=nsrest, version_in=version, & hostname_in=hostname, username_in=username) - ! Read namelist, grid and surface data - + ! Read namelists call initialize1(dtime=dtime_sync) - ! If no land then exit out of initialization + ! Initialize decomposition (ldecomp) and domain (ldomain) types + call lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) + ! If no land then exit out of initialization if ( noland ) then + call seq_infodata_PutData( infodata, lnd_present =.false.) call seq_infodata_PutData( infodata, lnd_prognostic=.false.) - return - end if - - ! Determine if aerosol and dust deposition come from atmosphere component - - call seq_infodata_GetData(infodata, atm_aero=atm_aero ) - if ( .not. atm_aero )then - call endrun( sub//' ERROR: atmosphere model MUST send aerosols to CLM' ) - end if - - ! Initialize clm gsMap, clm domain and clm attribute vectors - - call get_proc_bounds( bounds ) - - call lnd_SetgsMap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) - lsize = mct_gsMap_lsize(gsMap_lnd, mpicom_lnd) - - call lnd_domain_mct( bounds, lsize, gsMap_lnd, dom_l ) - - call mct_aVect_init(x2l_l, rList=seq_flds_x2l_fields, lsize=lsize) - call mct_aVect_zero(x2l_l) - - call mct_aVect_init(l2x_l, rList=seq_flds_l2x_fields, lsize=lsize) - call mct_aVect_zero(l2x_l) - ! Finish initializing clm - - call initialize2() - - ! Create land export state - - call lnd_export(bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) - - ! Fill in infodata settings + else - call seq_infodata_PutData(infodata, lnd_prognostic=.true.) - call seq_infodata_PutData(infodata, lnd_nx=ldomain%ni, lnd_ny=ldomain%nj) + ! Determine if aerosol and dust deposition come from atmosphere component + call seq_infodata_GetData(infodata, atm_aero=atm_aero ) + if ( .not. atm_aero )then + call endrun( sub//' ERROR: atmosphere model MUST send aerosols to CLM' ) + end if - ! Get infodata info + ! Initialize clm gsMap, clm domain and clm attribute vectors + call get_proc_bounds( bounds ) + call lnd_SetgsMap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) + lsize = mct_gsMap_lsize(gsMap_lnd, mpicom_lnd) + call lnd_domain_mct( bounds, lsize, gsMap_lnd, dom_l ) + call mct_aVect_init(x2l_l, rList=seq_flds_x2l_fields, lsize=lsize) + call mct_aVect_zero(x2l_l) + call mct_aVect_init(l2x_l, rList=seq_flds_l2x_fields, lsize=lsize) + call mct_aVect_zero(l2x_l) + + ! Finish initializing clm + call initialize2(ni,nj) + call initialize3() + + ! Create land export state + call lnd_export(bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) - call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) - call set_nextsw_cday(nextsw_cday) - call lnd_handle_resume( cdata_l ) + ! Fill in infodata settings + call seq_infodata_PutData(infodata, lnd_prognostic=.true.) + call seq_infodata_PutData(infodata, lnd_nx=ldomain%ni, lnd_ny=ldomain%nj) - ! Reset shr logging to original values + ! Get infodata info + call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) + call set_nextsw_cday(nextsw_cday) + call lnd_handle_resume( cdata_l ) - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) + ! Reset shr logging to original values + call shr_file_setLogUnit (shrlogunit) + call shr_file_setLogLevel(shrloglev) #if (defined _MEMTRACE) - if(masterproc) then - write(iulog,*) TRIM(Sub) // ':end::' - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_int_mct:end::',lbnum) - call memmon_reset_addr() - endif + if(masterproc) then + write(iulog,*) TRIM(Sub) // ':end::' + lbnum=1 + call memmon_dump_fort('memmon.out','lnd_int_mct:end::',lbnum) + call memmon_reset_addr() + endif #endif + end if end subroutine lnd_init_mct !==================================================================================== - subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) ! ! !DESCRIPTION: @@ -500,7 +489,6 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) end subroutine lnd_run_mct !==================================================================================== - subroutine lnd_final_mct( EClock, cdata_l, x2l_l, l2x_l) ! ! !DESCRIPTION: @@ -522,7 +510,6 @@ subroutine lnd_final_mct( EClock, cdata_l, x2l_l, l2x_l) end subroutine lnd_final_mct !==================================================================================== - subroutine lnd_setgsmap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) ! ! !DESCRIPTION: @@ -550,11 +537,9 @@ subroutine lnd_setgsmap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) ! Build the land grid numbering for MCT ! NOTE: Numbering scheme is: West to East and South to North ! starting at south pole. Should be the same as what's used in SCRIP - allocate(gindex(bounds%begg:bounds%endg),stat=ier) ! number the local grid - do n = bounds%begg, bounds%endg gindex(n) = ldecomp%gdc2glo(n) end do @@ -568,7 +553,6 @@ subroutine lnd_setgsmap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) end subroutine lnd_SetgsMap_mct !==================================================================================== - subroutine lnd_domain_mct( bounds, lsize, gsMap_l, dom_l ) ! ! !DESCRIPTION: @@ -660,7 +644,6 @@ subroutine lnd_domain_mct( bounds, lsize, gsMap_l, dom_l ) end subroutine lnd_domain_mct !==================================================================================== - subroutine lnd_handle_resume( cdata_l ) ! ! !DESCRIPTION: diff --git a/src/cpl/mct/lnd_set_decomp_and_domain.F90 b/src/cpl/mct/lnd_set_decomp_and_domain.F90 new file mode 100644 index 0000000000..6b343875c7 --- /dev/null +++ b/src/cpl/mct/lnd_set_decomp_and_domain.F90 @@ -0,0 +1,299 @@ +module lnd_set_decomp_and_domain + + use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl + use spmdMod , only : masterproc + use clm_varctl , only : iulog + use perf_mod , only : t_startf, t_stopf, t_barrierf + + implicit none + private ! except + + ! public member routines + public :: lnd_set_decomp_and_domain_from_surfrd + + ! private member routines + public :: surfrd_get_globmask ! Reads global land mask (needed for setting domain decomp) + public :: surfrd_get_grid ! Read grid/ladnfrac data into domain (after domain decomp) + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) + + ! Initialize ldecomp and ldomain data types + + use clm_varpar , only: nlevsoi + use clm_varctl , only: fatmlndfrc, use_soil_moisture_streams + use decompInitMod , only: decompInit_lnd, decompInit_lnd3D + use decompMod , only: bounds_type, get_proc_bounds + use domainMod , only: ldomain, domain_init, domain_check + + ! input/output variables + logical, intent(out) :: noland + integer, intent(out) :: ni, nj ! global grid sizes + + ! local variables + integer ,pointer :: amask(:) ! global land mask + integer :: begg, endg ! processor bounds + type(bounds_type) :: bounds ! bounds + character(len=32) :: subname = 'lnd_set_decomp_and_domain_from_surfrd' + !----------------------------------------------------------------------- + + ! Read in global land grid and land mask (amask)- needed to set decomposition + ! global memory for amask is allocate in surfrd_get_glomask - must be deallocated below + if (masterproc) then + write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) + endif + + ! Get global mask, ni and nj + call surfrd_get_globmask(filename=fatmlndfrc, mask=amask, ni=ni, nj=nj) + + ! Exit early if no valid land points + if ( all(amask == 0) )then + if (masterproc) write(iulog,*) trim(subname)//': no valid land points do NOT run clm' + noland = .true. + return + else + noland = .false. + end if + + ! Initialize ldecomp data type + ! Determine ctsm gridcell decomposition and processor bounds for gridcells + call decompInit_lnd(ni, nj, amask) + deallocate(amask) + if (use_soil_moisture_streams) call decompInit_lnd3D(ni, nj, nlevsoi) + + ! Initialize bounds for just gridcells + ! Remaining bounds (landunits, columns, patches) will be determined + ! after the call to decompInit_glcp - so get_proc_bounds is called + ! twice and the gridcell information is just filled in twice + call get_proc_bounds(bounds) + + ! Get grid cell bounds values + begg = bounds%begg + endg = bounds%endg + + ! Initialize ldomain data type + if (masterproc) then + write(iulog,*) 'Attempting to read ldomain from ',trim(fatmlndfrc) + endif + call surfrd_get_grid(begg, endg, ldomain, fatmlndfrc) + if (masterproc) then + call domain_check(ldomain) + endif + ldomain%mask = 1 !!! TODO - is this needed? + + end subroutine lnd_set_decomp_and_domain_from_surfrd + + !----------------------------------------------------------------------- + subroutine surfrd_get_globmask(filename, mask, ni, nj) + ! + ! !DESCRIPTION: + ! Read the surface dataset grid related information: + ! This is the first routine called by clm_initialize + ! NO DOMAIN DECOMPOSITION HAS BEEN SET YET + ! + ! !USES: + use fileutils , only : getfil + use ncdio_pio , only : ncd_io, ncd_pio_openfile, ncd_pio_closefile, ncd_inqfdims, file_desc_t + use abortutils , only : endrun + use shr_log_mod, only : errMsg => shr_log_errMsg + ! + ! !ARGUMENTS: + character(len=*), intent(in) :: filename ! grid filename + integer , pointer :: mask(:) ! grid mask + integer , intent(out) :: ni, nj ! global grid sizes + ! + ! !LOCAL VARIABLES: + logical :: isgrid2d + integer :: dimid,varid ! netCDF id's + integer :: ns ! size of grid on file + integer :: n,i,j ! index + integer :: ier ! error status + type(file_desc_t) :: ncid ! netcdf id + character(len=256) :: varname ! variable name + character(len=256) :: locfn ! local file name + logical :: readvar ! read variable in or not + integer , allocatable :: idata2d(:,:) + character(len=32) :: subname = 'surfrd_get_globmask' ! subroutine name + !----------------------------------------------------------------------- + + if (filename == ' ') then + mask(:) = 1 + else + ! Check if file exists + if (masterproc) then + if (filename == ' ') then + write(iulog,*) trim(subname),' ERROR: filename must be specified ' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + end if + + ! Open file + call getfil( filename, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + + ! Determine dimensions and if grid file is 2d or 1d + call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) + if (masterproc) then + write(iulog,*)'lat/lon grid flag (isgrid2d) is ',isgrid2d + end if + allocate(mask(ns)) + mask(:) = 1 + if (isgrid2d) then + ! Grid is 2d + allocate(idata2d(ni,nj)) + idata2d(:,:) = 1 + call ncd_io(ncid=ncid, varname='LANDMASK', data=idata2d, flag='read', readvar=readvar) + if (.not. readvar) then + call ncd_io(ncid=ncid, varname='mask', data=idata2d, flag='read', readvar=readvar) + end if + if (readvar) then + do j = 1,nj + do i = 1,ni + n = (j-1)*ni + i + mask(n) = idata2d(i,j) + enddo + enddo + end if + deallocate(idata2d) + else + ! Grid is not 2d + call ncd_io(ncid=ncid, varname='LANDMASK', data=mask, flag='read', readvar=readvar) + if (.not. readvar) then + call ncd_io(ncid=ncid, varname='mask', data=mask, flag='read', readvar=readvar) + end if + end if + if (.not. readvar) call endrun( msg=' ERROR: landmask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + + ! Close file + call ncd_pio_closefile(ncid) + end if + + end subroutine surfrd_get_globmask + + !----------------------------------------------------------------------- + subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) + ! + ! !DESCRIPTION: + ! THIS IS CALLED AFTER THE DOMAIN DECOMPOSITION HAS BEEN CREATED + ! Read the surface dataset grid related information: + ! o real latitude of grid cell (degrees) + ! o real longitude of grid cell (degrees) + ! + ! !USES: + use clm_varcon , only : spval, re, grlnd + use domainMod , only : domain_type, domain_init, domain_clean, lon1d, lat1d + use fileutils , only : getfil + use abortutils , only : endrun + use shr_log_mod, only : errMsg => shr_log_errMsg + use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile + use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim_size, ncd_inqdid, ncd_inqdlen + use pio + ! + ! !ARGUMENTS: + integer , intent(in) :: begg, endg + type(domain_type) , intent(inout) :: ldomain ! domain to init + character(len=*) , intent(in) :: filename ! grid filename + character(len=*) ,optional , intent(in) :: glcfilename ! glc mask filename + ! + ! !LOCAL VARIABLES: + type(file_desc_t) :: ncid ! netcdf id + integer :: beg ! local beg index + integer :: end ! local end index + integer :: ni,nj,ns ! size of grid on file + integer :: dimid,varid ! netCDF id's + integer :: start(1), count(1) ! 1d lat/lon array sections + integer :: ier,ret ! error status + logical :: readvar ! true => variable is on input file + logical :: isgrid2d ! true => file is 2d lat/lon + logical :: istype_domain ! true => input file is of type domain + real(r8), allocatable :: rdata2d(:,:) ! temporary + character(len=16) :: vname ! temporary + character(len=256) :: locfn ! local file name + integer :: n ! indices + character(len=32) :: subname = 'surfrd_get_grid' ! subroutine name +!----------------------------------------------------------------------- + + if (masterproc) then + if (filename == ' ') then + write(iulog,*) trim(subname),' ERROR: filename must be specified ' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + end if + + call getfil( filename, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + + ! Determine dimensions + call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) + + ! Determine isgrid2d flag for domain + call domain_init(ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + + ! Determine type of file - old style grid file or new style domain file + call check_var(ncid=ncid, varname='xc', readvar=readvar) + if (readvar)then + istype_domain = .true. + else + istype_domain = .false. + end if + + ! Read in area, lon, lat + if (istype_domain) then + call ncd_io(ncid=ncid, varname= 'area', flag='read', data=ldomain%area, & + dim1name=grlnd, readvar=readvar) + ! convert from radians**2 to km**2 + ldomain%area = ldomain%area * (re**2) + if (.not. readvar) call endrun( msg=' ERROR: area NOT on file'//errMsg(sourcefile, __LINE__)) + call ncd_io(ncid=ncid, varname= 'xc', flag='read', data=ldomain%lonc, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: xc NOT on file'//errMsg(sourcefile, __LINE__)) + call ncd_io(ncid=ncid, varname= 'yc', flag='read', data=ldomain%latc, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: yc NOT on file'//errMsg(sourcefile, __LINE__)) + else + call endrun( msg=" ERROR: can no longer read non domain files" ) + end if + + if (isgrid2d) then + allocate(rdata2d(ni,nj), lon1d(ni), lat1d(nj)) + if (istype_domain) vname = 'xc' + call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) + lon1d(:) = rdata2d(:,1) + if (istype_domain) vname = 'yc' + call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) + lat1d(:) = rdata2d(1,:) + deallocate(rdata2d) + end if + + ! Check lat limited to -90,90 + if (minval(ldomain%latc) < -90.0_r8 .or. & + maxval(ldomain%latc) > 90.0_r8) then + write(iulog,*) trim(subname),' WARNING: lat/lon min/max is ', & + minval(ldomain%latc),maxval(ldomain%latc) + endif + if ( any(ldomain%lonc < 0.0_r8) )then + call endrun( msg=' ERROR: lonc is negative (see https://github.com/ESCOMP/ctsm/issues/507)' & + //errMsg(sourcefile, __LINE__)) + endif + call ncd_io(ncid=ncid, varname='mask', flag='read', data=ldomain%mask, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) then + call endrun( msg=' ERROR: LANDMASK NOT on fracdata file'//errMsg(sourcefile, __LINE__)) + end if + call ncd_io(ncid=ncid, varname='frac', flag='read', data=ldomain%frac, & + dim1name=grlnd, readvar=readvar) + if (.not. readvar) then + call endrun( msg=' ERROR: LANDFRAC NOT on fracdata file'//errMsg(sourcefile, __LINE__)) + end if + + call ncd_pio_closefile(ncid) + + end subroutine surfrd_get_grid + +end module lnd_set_decomp_and_domain diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 30c1c97d61..461e99205e 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -20,35 +20,30 @@ module lnd_comp_nuopc use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date use spmdMod , only : masterproc, mpicom, spmd_init - use decompMod , only : bounds_type, ldecomp, get_proc_bounds - use domainMod , only : ldomain - use controlMod , only : control_setNL + use controlMod , only : control_setNL, control_init, control_print, NLFilename use clm_varorb , only : eccen, obliqr, lambm0, mvelpp use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_varctl , only : single_column, clm_varctl_set, iulog use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch - use clm_varcon , only : re use clm_time_manager , only : set_timemgr_init, advance_timestep use clm_time_manager , only : set_nextsw_cday, update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size use clm_time_manager , only : get_curr_date, get_curr_calday - use clm_initializeMod , only : initialize1, initialize2 - use clm_driver , only : clm_drv + use clm_initializeMod , only : initialize1, initialize2, initialize3 use nuopc_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit use nuopc_shr_methods , only : set_component_logging, get_component_instance, log_clock_advance - use perf_mod , only : t_startf, t_stopf, t_barrierf - use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror - use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var - use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable use lnd_import_export , only : advertise_fields, realize_fields, import_fields, export_fields use lnd_comp_shr , only : mesh, model_meshfile, model_clock + use perf_mod , only : t_startf, t_stopf, t_barrierf implicit none private ! except - ! Module routines + ! Module public routines public :: SetServices public :: SetVM + + ! Module private routines private :: InitializeP0 private :: InitializeAdvertise private :: InitializeRealize @@ -73,8 +68,6 @@ module lnd_comp_nuopc logical :: atm_prognostic integer, parameter :: dbug = 0 character(*),parameter :: modName = "(lnd_comp_nuopc)" - character(*),parameter :: u_FILE_u = & - __FILE__ character(len=CL) :: orb_mode ! attribute - orbital mode integer :: orb_iyear ! attribute - orbital year @@ -87,6 +80,13 @@ module lnd_comp_nuopc character(len=*) , parameter :: orb_variable_year = 'variable_year' character(len=*) , parameter :: orb_fixed_parameters = 'fixed_parameters' + character(len=*) , parameter :: startup_run = 'startup' + character(len=*) , parameter :: continue_run = 'continue' + character(len=*) , parameter :: branch_run = 'branch' + + character(len=*) , parameter :: u_FILE_u = & + __FILE__ + !=============================================================================== contains !=============================================================================== @@ -138,7 +138,6 @@ subroutine SetServices(gcomp, rc) end subroutine SetServices !=============================================================================== - subroutine InitializeP0(gcomp, importState, exportState, clock, rc) ! input/output variables @@ -151,14 +150,12 @@ subroutine InitializeP0(gcomp, importState, exportState, clock, rc) rc = ESMF_SUCCESS ! Switch to IPDv01 by filtering all other phaseMap entries - call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, acceptStringList=(/"IPDv01p"/), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine InitializeP0 !=============================================================================== - subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! input/output variables @@ -192,7 +189,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMGet(vm, mpiCommunicator=lmpicom, localpet=localpet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -321,7 +317,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_sys_abort(subname//'Need to set cism_evolve if glc is present') endif end if - + if (masterproc) then write(iulog,*)' atm_prognostic = ',atm_prognostic write(iulog,*)' rof_prognostic = ',rof_prognostic @@ -344,9 +340,14 @@ end subroutine InitializeAdvertise !=============================================================================== subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) - use clm_instMod, only : lnd2atm_inst, lnd2glc_inst, water_inst -!$ use omp_lib, only : omp_set_num_threads - use ESMF, only : ESMF_VM, ESMF_VMGet + !$ use omp_lib, only : omp_set_num_threads + use ESMF , only : ESMF_VM, ESMF_VMGet + use clm_instMod , only : lnd2atm_inst, lnd2glc_inst, water_inst + use domainMod , only : ldomain + use decompMod , only : ldecomp, bounds_type, get_proc_bounds + use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_newmesh + use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_meshinfo + ! input/output variables type(ESMF_GridComp) :: gcomp type(ESMF_State) :: importState @@ -355,8 +356,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_Mesh) :: gridmesh ! temporary esmf mesh - type(ESMF_DistGrid) :: DistGrid ! esmf global index space descriptor type(ESMF_VM) :: vm type(ESMF_Time) :: currTime ! Current time type(ESMF_Time) :: startTime ! Start time @@ -374,13 +373,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: dtime_sync ! coupling time-step from the input synchronization clock integer :: localPet integer :: localpecount - integer, pointer :: gindex(:) ! global index space for land and ocean points - integer, pointer :: gindex_lnd(:) ! global index space for just land points - integer, pointer :: gindex_ocn(:) ! global index space for just ocean points - integer, pointer :: mask(:) ! local land/ocean mask character(ESMF_MAXSTR) :: cvalue ! config data - integer :: nlnd, nocn ! local size ofarrays - integer :: g,n ! indices real(r8) :: scmlat ! single-column latitude real(r8) :: scmlon ! single-column longitude real(r8) :: nextsw_cday ! calday from clock of next radiation computation @@ -394,25 +387,9 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: nsrest ! ctsm restart type logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type integer :: lbnum ! input to memory diagnostic - type(bounds_type) :: bounds ! bounds integer :: shrlogunit ! original log unit - real(r8) :: mesh_lon, mesh_lat, mesh_area - real(r8) :: tolerance_latlon = 1.e-5 - real(r8) :: tolerance_area = 1.e-3 - integer :: spatialDim - integer :: numOwnedElements - real(R8), pointer :: ownedElemCoords(:) - real(r8), pointer :: areaPtr(:) - type(ESMF_Field) :: areaField - integer :: dimid_ni, dimid_nj, dimid_nv - integer :: ncid, ierr - integer :: ni, nj, nv - integer :: varid_xv, varid_yv - real(r8), allocatable :: xv(:,:,:), yv(:,:,:) - integer :: maxIndex(2) - real(r8) :: mincornerCoord(2) - real(r8) :: maxcornerCoord(2) - type(ESMF_Grid) :: lgrid + type(bounds_type) :: bounds ! bounds + integer :: ni, nj character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -447,45 +424,36 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) caseid ctitle= trim(caseid) - call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) scmlon - call NUOPC_CompAttributeGet(gcomp, name='scmlat', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) scmlat - call NUOPC_CompAttributeGet(gcomp, name='single_column', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) single_column - call NUOPC_CompAttributeGet(gcomp, name='brnch_retain_casename', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) brnch_retain_casename - call NUOPC_CompAttributeGet(gcomp, name='start_type', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) starttype - call NUOPC_CompAttributeGet(gcomp, name='model_version', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) model_version - call NUOPC_CompAttributeGet(gcomp, name='hostname', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) hostname - call NUOPC_CompAttributeGet(gcomp, name='username', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) username - !TODO: the following strings must not be hard-wired - must have module variables - if ( trim(starttype) == trim('startup')) then + if ( trim(starttype) == trim(startup_run)) then nsrest = nsrStartup - else if (trim(starttype) == trim('continue') ) then + else if (trim(starttype) == trim(continue_run)) then nsrest = nsrContinue - else if (trim(starttype) == trim('branch')) then + else if (trim(starttype) == trim(branch_run)) then nsrest = nsrBranch else call shr_sys_abort( subname//' ERROR: unknown starttype' ) @@ -494,33 +462,25 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !---------------------- ! Consistency check on namelist filename !---------------------- - call control_setNL("lnd_in"//trim(inst_suffix)) !---------------------- ! Get properties from clock !---------------------- - - call ESMF_ClockGet( clock, & - currTime=currTime, startTime=startTime, refTime=RefTime, & + call ESMF_ClockGet( clock, currTime=currTime, startTime=startTime, refTime=RefTime, & timeStep=timeStep, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_TimeGet( currTime, yy=yy, mm=mm, dd=dd, s=curr_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,curr_ymd) - call ESMF_TimeGet( startTime, yy=yy, mm=mm, dd=dd, s=start_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,start_ymd) - call ESMF_TimeGet( refTime, yy=yy, mm=mm, dd=dd, s=ref_tod, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call shr_cal_ymd2date(yy,mm,dd,ref_ymd) - call ESMF_TimeGet( currTime, calkindflag=esmf_caltype, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (esmf_caltype == ESMF_CALKIND_NOLEAP) then calendar = shr_cal_noleap else if (esmf_caltype == ESMF_CALKIND_GREGORIAN) then @@ -528,10 +488,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) else call shr_sys_abort( subname//'ERROR:: bad calendar for ESMF' ) end if - call ESMF_TimeIntervalGet( timeStep, s=dtime_sync, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then write(iulog,*)'dtime = ', dtime_sync end if @@ -539,17 +497,14 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !---------------------- ! Initialize module orbital values and update orbital !---------------------- - call clm_orbital_init(gcomp, iulog, masterproc, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call clm_orbital_update(clock, iulog, masterproc, eccen, obliqr, lambm0, mvelpp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !---------------------- ! Initialize CTSM time manager !---------------------- - ! Note that we assume that CTSM's internal dtime matches the coupling time step. ! i.e., we currently do NOT allow sub-cycling within a coupling time step. call set_timemgr_init( & @@ -563,13 +518,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !---------------------------------------------------------------------------- ! Set model clock in lnd_comp_shr !---------------------------------------------------------------------------- - model_clock = clock - !---------------------- - ! Read namelist, grid and surface data - !---------------------- - + ! --------------------- + ! Initialize first phase of ctsm + ! --------------------- ! set default values for run control variables call clm_varctl_set(& caseid_in=caseid, ctitle_in=ctitle, & @@ -580,185 +533,42 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) hostname_in=hostname, & username_in=username) - ! note that the memory for gindex_ocn will be allocated in the following call - call initialize1(dtime=dtime_sync, gindex_ocn=gindex_ocn) - - ! If no land then abort for now - ! TODO: need to handle the case of noland with CMEPS - ! if ( noland ) then - ! call shr_sys_abort(trim(subname)//"ERROR: Currently cannot handle case of single column with non-land") - ! end if - - ! obtain global index array for just land points which includes mask=0 or ocean points - call get_proc_bounds( bounds ) - nlnd = bounds%endg - bounds%begg + 1 - allocate(gindex_lnd(nlnd)) - do g = bounds%begg,bounds%endg - n = 1 + (g - bounds%begg) - gindex_lnd(n) = ldecomp%gdc2glo(g) - end do - - ! create a global index that includes both land and ocean points - nocn = size(gindex_ocn) - allocate(gindex(nlnd + nocn)) - allocate(mask(nlnd + nocn)) - do n = 1,nlnd+nocn - if (n <= nlnd) then - gindex(n) = gindex_lnd(n) - mask(n) = 1 - else - gindex(n) = gindex_ocn(n-nlnd) - mask(n) = 0 - end if - end do - - ! create distGrid from global index array - DistGrid = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - deallocate(gindex) - - !-------------------------------- - ! generate the mesh and realize fields - !-------------------------------- + call initialize1(dtime=dtime_sync) - ! determine if the mesh will be created or read in + ! --------------------- + ! Create ctsm decomp and domain info + ! --------------------- call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=model_meshfile, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (single_column) model_meshfile = 'create_mesh' - if (trim(model_meshfile) == 'create_mesh') then - ! get the datm grid from the domain file - call NUOPC_CompAttributeGet(gcomp, name='domain_lnd', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! open file - ierr = nf90_open(cvalue, NF90_NOWRITE, ncid) - call nc_check_err(ierr, 'nf90_open', trim(cvalue)) - ! get dimension ids - ierr = nf90_inq_dimid(ncid, 'ni', dimid_ni) - call nc_check_err(ierr, 'nf90_inq_dimid for ni', trim(cvalue)) - ierr = nf90_inq_dimid(ncid, 'nj', dimid_nj) - call nc_check_err(ierr, 'nf90_inq_dimid for nj', trim(cvalue)) - ierr = nf90_inq_dimid(ncid, 'nv', dimid_nv) - call nc_check_err(ierr, 'nf90_inq_dimid for nv', trim(cvalue)) - ! get dimension values - ierr = nf90_inquire_dimension(ncid, dimid_ni, len=ni) - call nc_check_err(ierr, 'nf90_inq_dimension for ni', trim(cvalue)) - ierr = nf90_inquire_dimension(ncid, dimid_nj, len=nj) - call nc_check_err(ierr, 'nf90_inq_dimension for nj', trim(cvalue)) - ierr = nf90_inquire_dimension(ncid, dimid_nv, len=nv) - call nc_check_err(ierr, 'nf90_inq_dimension for nv', trim(cvalue)) - ! get variable ids - ierr = nf90_inq_varid(ncid, 'xv', varid_xv) - call nc_check_err(ierr, 'nf90_inq_varid for xv', trim(cvalue)) - ierr = nf90_inq_varid(ncid, 'yv', varid_yv) - call nc_check_err(ierr, 'nf90_inq_varid for yv', trim(cvalue)) - ! allocate memory for variables and get variable values - allocate(xv(nv,ni,nj), yv(nv,ni,nj)) - ierr = nf90_get_var(ncid, varid_xv, xv) - call nc_check_err(ierr, 'nf90_get_var for xv', trim(cvalue)) - ierr = nf90_get_var(ncid, varid_yv, yv) - call nc_check_err(ierr, 'nf90_get_var for yv', trim(cvalue)) - ! close file - ierr = nf90_close(ncid) - call nc_check_err(ierr, 'nf90_close', trim(cvalue)) - ! create the grid - maxIndex(1) = ni ! number of lons - maxIndex(2) = nj ! number of lats - mincornerCoord(1) = xv(1,1,1) ! min lon - mincornerCoord(2) = yv(1,1,1) ! min lat - maxcornerCoord(1) = xv(3,ni,nj) ! max lon - maxcornerCoord(2) = yv(3,ni,nj) ! max lat - deallocate(xv,yv) - lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & - mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & - staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! create the mesh from the grid - mesh = ESMF_MeshCreate(lgrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! TODO: is the mask by default set to 1 if created from a grid? - ! reset the global mask (which is 1) to the land/ocean mask - ! - ! Currently, this call requires that the information has - ! already been added to the mesh during creation. For example, - ! you can only change the element mask information, if the mesh - ! was initially created with element masking. - !!! call ESMF_MeshSet(mesh, elementMask=mask, rc=rc) - !!! if (ChkErr(rc,__LINE__,u_FILE_u)) return - - deallocate(mask) - + call lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) else - - ! read in the mesh from the file - mesh = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, & - elementDistgrid=Distgrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,*)'mesh file for domain is ',trim(model_meshfile) - end if - - ! Determine the areas on the mesh - areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, name='mesh_areas', meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldRegridGetArea(areaField, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(areaField, farrayPtr=areaPtr, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - + call lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) end if - ! realize the actively coupled fields - call realize_fields(gcomp, mesh, flds_scalar_name, flds_scalar_num, rc) + ! --------------------- + ! Realize the actively coupled fields + ! --------------------- + call realize_fields(gcomp, mesh, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - !-------------------------------- + ! --------------------- ! Finish initializing ctsm - !-------------------------------- - - call initialize2() - - !-------------------------------- - ! Check that lats, lons and areas on mesh are the same as those internal to ctsm - ! obtain mesh lats and lons - !-------------------------------- + ! --------------------- + ! If no land then abort for now + ! TODO: need to handle the case of noland with CMEPS + ! if ( noland ) then + ! call shr_sys_abort(trim(subname)//"ERROR: Currently cannot handle case of single column with non-land") + ! end if - if (trim(model_meshfile) /= 'create_mesh') then - call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ownedElemCoords(spatialDim*numOwnedElements)) - call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = bounds%begg,bounds%endg - n = 1 + (g - bounds%begg) - mesh_lon = ownedElemCoords(2*n-1) - mesh_lat = ownedElemCoords(2*n) - mesh_area = areaPtr(n) - if (abs(mesh_lon - ldomain%lonc(g)) > tolerance_latlon) then - write(6,100)'ERROR: clm_lon, mesh_lon, diff_lon = ',& - ldomain%lonc(g), mesh_lon, abs(mesh_lon - ldomain%lonc(g)) - !call shr_sys_abort() - end if - if (abs(mesh_lat - ldomain%latc(g)) > tolerance_latlon) then - write(6,100)'ERROR: clm_lat, mesh_lat, diff_lat = ',& - ldomain%latc(g), mesh_lat, abs(mesh_lat - ldomain%latc(g)) - !call shr_sys_abort() - end if - if (abs(mesh_area - ldomain%area(g)/(re*re)) > tolerance_area) then - write(6,100)'ERROR: clm_area, mesh_area, diff_area = ',& - ldomain%area(g)/(re*re), mesh_area, abs(mesh_area - ldomain%area(g)/(re*re)) - !call shr_sys_abort() - end if - end do -100 format(a,3(d13.5,2x)) - end if + call initialize2(ni, nj) + call initialize3() !-------------------------------- ! Create land export state !-------------------------------- - + call get_proc_bounds(bounds) call export_fields(gcomp, bounds, glc_present, rof_prognostic, & water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -808,16 +618,17 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) end subroutine InitializeRealize !=============================================================================== - subroutine ModelAdvance(gcomp, rc) !------------------------ ! Run CTSM !------------------------ - use clm_instMod, only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst !$ use omp_lib, only : omp_set_num_threads - use ESMF, only : ESMF_VM, ESMF_VMGet + use ESMF , only : ESMF_VM, ESMF_VMGet + use clm_instMod , only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst + use decompMod , only : bounds_type, get_proc_bounds + use clm_driver , only : clm_drv ! input/output variables type(ESMF_GridComp) :: gcomp @@ -902,12 +713,14 @@ subroutine ModelAdvance(gcomp, rc) call set_nextsw_cday( nextsw_cday ) call t_stopf(trim(subname)//' nextsw_cday') + ! Get proc bounds + call get_proc_bounds(bounds) + !-------------------------------- ! Unpack import state !-------------------------------- call t_startf ('lc_lnd_import') - call get_proc_bounds(bounds) call import_fields( gcomp, bounds, glc_present, rof_prognostic, & atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1077,7 +890,6 @@ subroutine ModelAdvance(gcomp, rc) end subroutine ModelAdvance !=============================================================================== - subroutine ModelSetRunClock(gcomp, rc) type(ESMF_GridComp) :: gcomp @@ -1201,7 +1013,6 @@ subroutine ModelSetRunClock(gcomp, rc) end subroutine ModelSetRunClock !=============================================================================== - subroutine ModelFinalize(gcomp, rc) type(ESMF_GridComp) :: gcomp integer, intent(out) :: rc @@ -1230,7 +1041,6 @@ subroutine ModelFinalize(gcomp, rc) end subroutine ModelFinalize !=============================================================================== - subroutine clm_orbital_init(gcomp, logunit, mastertask, rc) !---------------------------------------------------------- @@ -1330,7 +1140,6 @@ subroutine clm_orbital_init(gcomp, logunit, mastertask, rc) end subroutine clm_orbital_init !=============================================================================== - subroutine clm_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm0, mvelpp, rc) !---------------------------------------------------------- @@ -1386,18 +1195,4 @@ subroutine clm_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm0 end subroutine clm_orbital_update - !=============================================================================== - - subroutine nc_check_err(ierror, description, filename) - integer , intent(in) :: ierror - character(*), intent(in) :: description - character(*), intent(in) :: filename - - if (ierror /= nf90_noerr) then - write (*,'(6a)') 'ERROR ', trim(description),'. NetCDF file : "', trim(filename),& - '". Error message:', trim(nf90_strerror(ierror)) - call shr_sys_abort() - endif - end subroutine nc_check_err - end module lnd_comp_nuopc diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index f53b6ccd5e..622e3acca9 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -11,7 +11,7 @@ module lnd_import_export use shr_sys_mod , only : shr_sys_abort use clm_varctl , only : iulog use clm_time_manager , only : get_nstep - use decompmod , only : bounds_type + use decompmod , only : bounds_type, get_proc_bounds use lnd2atmType , only : lnd2atm_type use lnd2glcMod , only : lnd2glc_type use atm2lndType , only : atm2lnd_type @@ -183,6 +183,9 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r else send_to_atm = .false. end if + !DEBUG: + send_to_atm = .true. + !DEBUG call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -305,7 +308,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r call fldlist_add(fldsToLnd_num, fldsToLnd, trim(flds_scalar_name)) - ! from atm + ! from atm call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_z ) call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_topo ) call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_u ) @@ -442,11 +445,11 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! input/output variabes type(ESMF_GridComp) :: gcomp - type(bounds_type) , intent(in) :: bounds ! bounds + type(bounds_type) , intent(in) :: bounds ! bounds logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model logical , intent(in) :: rof_prognostic ! .true. => running with a prognostic ROF model - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! clm internal input data type - type(glc2lnd_type) , intent(inout) :: glc2lnd_inst ! clm internal input data type + type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! clm internal input data type + type(glc2lnd_type) , intent(inout) :: glc2lnd_inst ! clm internal input data type type(Wateratm2lndbulk_type) , intent(inout) :: wateratm2lndbulk_inst integer , intent(out) :: rc @@ -458,10 +461,10 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8), pointer :: fldPtr2d(:,:) character(len=CS) :: fldname integer :: num - integer :: begg, endg ! bounds - integer :: g,i,k,n ! indices - real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) - real(r8) :: forc_pbot ! atmospheric pressure (Pa) + integer :: begg, endg ! bounds + integer :: g,i,k,n ! indices + real(r8) :: qsat_kg_kg ! saturation specific humidity (kg/kg) + real(r8) :: forc_pbot ! atmospheric pressure (Pa) real(r8) :: co2_ppmv_input(bounds%begg:bounds%endg) ! temporary real(r8) :: forc_ndep(bounds%begg:bounds%endg,2) real(r8) :: forc_rainc(bounds%begg:bounds%endg) ! rainxy Atm flux mm/s @@ -696,7 +699,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! input/output variables type(ESMF_GridComp) :: gcomp - type(bounds_type) , intent(in) :: bounds ! bounds + type(bounds_type) , intent(in) :: bounds logical , intent(in) :: glc_present logical , intent(in) :: rof_prognostic type(waterlnd2atmbulk_type) , intent(inout) :: waterlnd2atmbulk_inst @@ -709,7 +712,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & real(r8), pointer :: fldPtr1d(:) real(r8), pointer :: fldPtr2d(:,:) character(len=CS) :: fldname - integer :: begg, endg ! bounds + integer :: begg, endg integer :: i, g, num real(r8) :: data1d(bounds%begg:bounds%endg) character(len=*), parameter :: subname='(lnd_import_export:export_fields)' @@ -728,6 +731,7 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! ----------------------- ! output to mediator ! ----------------------- + call state_setexport_1d(exportState, Sl_lfrin, ldomain%frac(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -807,12 +811,12 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & minus = .true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - if (fldchk(exportState, Fall_fire)) then ! fire emis from land + if (fldchk(exportState, Fall_fire)) then ! fire emis from land call state_setexport_2d(exportState, Fall_fire, lnd2atm_inst%fireflx_grc(begg:,1:emis_nflds), & minus = .true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - if (fldchk(exportState, Sl_fztop)) then ! fire emis from land + if (fldchk(exportState, Sl_fztop)) then ! fire emis from land call state_setexport_1d(exportState, Sl_fztop, lnd2atm_inst%fireztop_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if @@ -861,15 +865,15 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & ! help with performance. (The downside would be that we wouldn't have these fields ! available for diagnostic purposes or to force a later T compset with dlnd.) - if (fldchk(exportState, Sl_tsrf_elev)) then + if (fldchk(exportState, Sl_tsrf_elev)) then call state_setexport_2d(exportState, Sl_tsrf_elev, lnd2glc_inst%tsrf_grc(begg:,0:glc_nec), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - if (fldchk(exportState, Sl_topo_elev)) then + if (fldchk(exportState, Sl_topo_elev)) then call state_setexport_2d(exportState, Sl_topo_elev, lnd2glc_inst%topo_grc(begg:,0:glc_nec), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - if (fldchk(exportState, Flgl_qice_elev)) then + if (fldchk(exportState, Flgl_qice_elev)) then call state_setexport_2d(exportState, Flgl_qice_elev, lnd2glc_inst%qice_grc(begg:,0:glc_nec), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 36bf1d8a80..86aae3f5a0 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -2,76 +2,68 @@ module clm_initializeMod !----------------------------------------------------------------------- ! Performs land model initialization - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use decompMod , only : bounds_type, get_proc_bounds, get_proc_clumps, get_clump_bounds - use abortutils , only : endrun - use clm_varctl , only : nsrest, nsrStartup, nsrContinue, nsrBranch - use clm_varctl , only : is_cold_start, is_interpolated_start - use clm_varctl , only : iulog - use clm_varctl , only : use_lch4, use_cn, use_cndv, use_c13, use_c14, use_fates - use clm_varctl , only : use_soil_moisture_streams - use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft, irrig_method, wt_glc_mec, topo_glc_mec, haslake - use perf_mod , only : t_startf, t_stopf - use readParamsMod , only : readParameters - use ncdio_pio , only : file_desc_t - use GridcellType , only : grc ! instance - use LandunitType , only : lun ! instance - use ColumnType , only : col ! instance - use PatchType , only : patch ! instance - use reweightMod , only : reweight_wrapup - use filterMod , only : allocFilters, filter, filter_inactive_and_active - use FatesInterfaceMod, only : set_fates_global_elements - use dynSubgridControlMod, only: dynSubgridControl_init, get_reset_dynbal_baselines - use SelfTestDriver, only : self_test_driver + !----------------------------------------------------------------------- + use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_sys_mod , only : shr_sys_flush + use shr_log_mod , only : errMsg => shr_log_errMsg + use spmdMod , only : masterproc + use decompMod , only : bounds_type, get_proc_bounds, get_proc_clumps, get_clump_bounds + use abortutils , only : endrun + use clm_varctl , only : nsrest, nsrStartup, nsrContinue, nsrBranch + use clm_varctl , only : is_cold_start, is_interpolated_start + use clm_varctl , only : iulog + use clm_varctl , only : use_lch4, use_cn, use_cndv, use_c13, use_c14, use_fates + use clm_varctl , only : use_soil_moisture_streams + use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft + use clm_instur , only : irrig_method, wt_glc_mec, topo_glc_mec, haslake + use perf_mod , only : t_startf, t_stopf + use readParamsMod , only : readParameters + use ncdio_pio , only : file_desc_t + use GridcellType , only : grc ! instance + use LandunitType , only : lun ! instance + use ColumnType , only : col ! instance + use PatchType , only : patch ! instance + use reweightMod , only : reweight_wrapup + use filterMod , only : allocFilters, filter, filter_inactive_and_active + use FatesInterfaceMod , only : set_fates_global_elements + use dynSubgridControlMod , only : dynSubgridControl_init, get_reset_dynbal_baselines + use SelfTestDriver , only : self_test_driver + use SoilMoistureStreamMod , only : PrescribedSoilMoistureInit use clm_instMod - use SoilMoistureStreamMod, only : PrescribedSoilMoistureInit ! implicit none private ! By default everything is private - ! public :: initialize1 ! Phase one initialization public :: initialize2 ! Phase two initialization - !----------------------------------------------------------------------- + public :: initialize3 ! Phase two initialization + integer :: actual_numcft ! numcft from sfc dataset + +!----------------------------------------------------------------------- contains +!----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine initialize1(dtime, gindex_ocn) + subroutine initialize1(dtime) ! ! !DESCRIPTION: ! CLM initialization first phase ! ! !USES: - use clm_varpar , only: clm_varpar_init, natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec, nlevsoi - use clm_varcon , only: clm_varcon_init - use landunit_varcon , only: landunit_varcon_init, max_lunit - use clm_varctl , only: fsurdat, fatmlndfrc, noland, version - use pftconMod , only: pftcon - use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp, decompInit_lnd3D - use decompInitMod , only: decompInit_ocn - use domainMod , only: domain_check, ldomain, domain_init - use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data, surfrd_get_num_patches - use controlMod , only: control_init, control_print, NLFilename - use ncdio_pio , only: ncd_pio_init - use initGridCellsMod , only: initGridCells - use ch4varcon , only: ch4conrd - use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp + use clm_varpar , only: clm_varpar_init + use clm_varcon , only: clm_varcon_init + use landunit_varcon , only: landunit_varcon_init + use clm_varctl , only: fsurdat, version + use surfrdMod , only: surfrd_get_num_patches + use controlMod , only: control_init, control_print, NLFilename + use ncdio_pio , only: ncd_pio_init + use initGridCellsMod , only: initGridCells + use UrbanParamsType , only: IsSimpleBuildTemp + use dynSubgridControlMod , only: dynSubgridControl_init ! ! !ARGUMENTS integer, intent(in) :: dtime ! model time step (seconds) - - ! COMPILER_BUG(wjs, 2020-02-20, intel18.0.3) Although gindex_ocn could be - ! intent(out), intel18.0.3 generates a runtime segmentation fault in runs that don't - ! have this argument present when this is declared intent(out). (It works fine on - ! intel 19.0.2 when declared as intent(out).) See also - ! https://github.com/ESCOMP/CTSM/issues/930. - integer, pointer, optional, intent(inout) :: gindex_ocn(:) ! If present, this will hold the decomposition of ocean points (which is needed for the nuopc interface); note that this variable is allocated here, and is assumed to start unallocated ! ! !LOCAL VARIABLES: integer :: ier ! error status @@ -84,16 +76,13 @@ subroutine initialize1(dtime, gindex_ocn) integer :: nclumps ! number of clumps on this processor integer :: nc ! clump index integer :: actual_maxsoil_patches ! value from surface dataset - integer :: actual_numcft ! numcft from sfc dataset integer ,pointer :: amask(:) ! global land mask character(len=32) :: subname = 'initialize1' ! subroutine name !----------------------------------------------------------------------- call t_startf('clm_init1') - ! ------------------------------------------------------------------------ ! Initialize run control variables, timestep - ! ------------------------------------------------------------------------ if ( masterproc )then write(iulog,*) trim(version) @@ -109,121 +98,99 @@ subroutine initialize1(dtime, gindex_ocn) call clm_varpar_init(actual_maxsoil_patches, actual_numcft) call clm_varcon_init( IsSimpleBuildTemp() ) call landunit_varcon_init() - if (masterproc) call control_print() - call dynSubgridControl_init(NLFilename) - ! ------------------------------------------------------------------------ - ! Read in global land grid and land mask (amask)- needed to set decomposition - ! ------------------------------------------------------------------------ - - ! global memory for amask is allocate in surfrd_get_glomask - must be - ! deallocated below - if (masterproc) then - write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) - call shr_sys_flush(iulog) - endif - call surfrd_get_globmask(filename=fatmlndfrc, mask=amask, ni=ni, nj=nj) + call t_stopf('clm_init1') - ! Exit early if no valid land points - if ( all(amask == 0) )then - if (masterproc) write(iulog,*) trim(subname)//': no valid land points do NOT run clm' - noland = .true. - return - end if + end subroutine initialize1 - ! ------------------------------------------------------------------------ + !----------------------------------------------------------------------- + subroutine initialize2(ni,nj) + ! + ! !DESCRIPTION: + ! CLM initialization second phase ! Determine clm gridcell decomposition and processor bounds for gridcells - ! ------------------------------------------------------------------------ - - call decompInit_lnd(ni, nj, amask) - if (present(gindex_ocn)) then - call decompInit_ocn(ni, nj, amask, gindex_ocn=gindex_ocn) - end if - deallocate(amask) + ! + ! !USES: + use clm_varpar , only: natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec + use landunit_varcon , only: landunit_varcon_init, max_lunit + use clm_varctl , only: fsurdat + use pftconMod , only: pftcon + use decompInitMod , only: decompInit_clumps, decompInit_glcp + use domainMod , only: domain_check, ldomain, domain_init + use surfrdMod , only: surfrd_get_data + use controlMod , only: NLFilename + use initGridCellsMod , only: initGridCells + use ch4varcon , only: ch4conrd + use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp + ! + ! !ARGUMENTS + integer, intent(in) :: ni, nj ! global grid sizes + ! + ! !LOCAL VARIABLES: + integer :: i,j,n,k,c,l,g ! indices + integer :: begg, endg ! processor bounds + type(bounds_type) :: bounds_proc + type(bounds_type) :: bounds_clump + integer :: nclumps ! number of clumps on this processor + integer :: nc ! clump index + character(len=32) :: subname = 'initialize2' ! subroutine name + !----------------------------------------------------------------------- - if(use_soil_moisture_streams) call decompInit_lnd3D(ni, nj, nlevsoi) - ! *** Get JUST gridcell processor bounds *** - ! Remaining bounds (landunits, columns, patches) will be determined - ! after the call to decompInit_glcp - so get_proc_bounds is called - ! twice and the gridcell information is just filled in twice + call t_startf('clm_init2') + ! Get processor bounds call get_proc_bounds(begg, endg) - ! ------------------------------------------------------------------------ - ! Get grid and land fraction (set ldomain) - ! ------------------------------------------------------------------------ - - if (masterproc) then - write(iulog,*) 'Attempting to read ldomain from ',trim(fatmlndfrc) - call shr_sys_flush(iulog) - endif - call surfrd_get_grid(begg, endg, ldomain, fatmlndfrc) - if (masterproc) then - call domain_check(ldomain) - endif - ldomain%mask = 1 !!! TODO - is this needed? - ! Initialize glc behavior call glc_behavior%Init(begg, endg, NLFilename) ! Initialize urban model input (initialize urbinp data structure) ! This needs to be called BEFORE the call to surfrd_get_data since ! that will call surfrd_get_special which in turn calls check_urban - call UrbanInput(begg, endg, mode='initialize') ! Allocate surface grid dynamic memory (just gridcell bounds dependent) - allocate (wt_lunit (begg:endg, max_lunit )) allocate (urban_valid (begg:endg )) allocate (wt_nat_patch (begg:endg, natpft_lb:natpft_ub )) allocate (wt_cft (begg:endg, cft_lb:cft_ub )) allocate (fert_cft (begg:endg, cft_lb:cft_ub )) allocate (irrig_method (begg:endg, cft_lb:cft_ub )) - allocate (wt_glc_mec (begg:endg, maxpatch_glcmec)) - allocate (topo_glc_mec(begg:endg, maxpatch_glcmec)) + allocate (wt_glc_mec (begg:endg, maxpatch_glcmec )) + allocate (topo_glc_mec (begg:endg, maxpatch_glcmec )) allocate (haslake (begg:endg )) + ! Read list of Patches and their corresponding parameter values ! Independent of model resolution, Needs to stay before surfrd_get_data - call pftcon%Init() ! Read surface dataset and set up subgrid weight arrays call surfrd_get_data(begg, endg, ldomain, fsurdat, actual_numcft) - ! ------------------------------------------------------------------------ ! Ask Fates to evaluate its own dimensioning needs. ! This determines the total amount of space it requires in its largest ! dimension. We are currently calling that the "cohort" dimension, but ! it is really a utility dimension that captures the models largest ! size need. ! Sets: - ! fates_maxElementsPerPatch - ! fates_maxElementsPerSite (where a site is roughly equivalent to a column) - ! + ! fates_maxElementsPerPatch + ! fates_maxElementsPerSite (where a site is roughly equivalent to a column) ! (Note: fates_maxELementsPerSite is the critical variable used by CLM ! to allocate space) - ! ------------------------------------------------------------------------ - call set_fates_global_elements(use_fates) - ! ------------------------------------------------------------------------ ! Determine decomposition of subgrid scale landunits, columns, patches - ! ------------------------------------------------------------------------ - - call decompInit_clumps(ns, ni, nj, glc_behavior) + call decompInit_clumps(ni, nj, glc_behavior) ! *** Get ALL processor bounds - for gridcells, landunit, columns and patches *** - call get_proc_bounds(bounds_proc) ! Allocate memory for subgrid data structures ! This is needed here BEFORE the following call to initGridcells ! Note that the assumption is made that none of the subgrid initialization ! can depend on other elements of the subgrid in the calls below - call grc%Init (bounds_proc%begg, bounds_proc%endg) call lun%Init (bounds_proc%begl, bounds_proc%endl) call col%Init (bounds_proc%begc, bounds_proc%endc) @@ -231,15 +198,12 @@ subroutine initialize1(dtime, gindex_ocn) ! Build hierarchy and topological info for derived types ! This is needed here for the following call to decompInit_glcp - call initGridCells(glc_behavior) ! Set global seg maps for gridcells, landlunits, columns and patches - - call decompInit_glcp(ns, ni, nj, glc_behavior) + call decompInit_glcp(ni, nj, glc_behavior) ! Set filters - call allocFilters() nclumps = get_proc_clumps() @@ -250,14 +214,10 @@ subroutine initialize1(dtime, gindex_ocn) end do !$OMP END PARALLEL DO - ! ------------------------------------------------------------------------ - ! Remainder of initialization1 - ! ------------------------------------------------------------------------ ! Set CH4 Model Parameters from namelist. ! Need to do before initTimeConst so that it knows whether to ! look for several optional parameters on surfdata file. - if (use_lch4) then call ch4conrd() end if @@ -268,21 +228,19 @@ subroutine initialize1(dtime, gindex_ocn) ! Deallocate surface grid dynamic memory for variables that aren't needed elsewhere. ! Some things are kept until the end of initialize2; urban_valid is kept through the ! end of the run for error checking. - deallocate (wt_lunit, wt_cft, wt_glc_mec, haslake) - call t_stopf('clm_init1') + call t_stopf('clm_init2') - end subroutine initialize1 + end subroutine initialize2 !----------------------------------------------------------------------- - subroutine initialize2( ) + subroutine initialize3( ) ! ! !DESCRIPTION: - ! CLM initialization - second phase + ! CLM initialization - third phase ! ! !USES: - use shr_orb_mod , only : shr_orb_decl use shr_scam_mod , only : shr_scam_getCloseLatLon use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND @@ -349,10 +307,10 @@ subroutine initialize2( ) integer :: begc, endc integer :: begl, endl real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - character(len=32) :: subname = 'initialize2' + character(len=32) :: subname = 'initialize3' !---------------------------------------------------------------------- - call t_startf('clm_init2') + call t_startf('clm_init3') ! ------------------------------------------------------------------------ ! Determine processor bounds and clumps for this processor @@ -510,30 +468,24 @@ subroutine initialize2( ) ! NOTE(wjs, 2016-02-23) Maybe the rest of the body of this conditional should also ! be moved into bgc_vegetation_inst%Init2 - if (n_drydep > 0 .and. drydep_method == DD_XLND) then ! Must do this also when drydeposition is used so that estimates of monthly ! differences in LAI can be computed call SatellitePhenologyInit(bounds_proc) end if - if ( use_c14 .and. use_c14_bombspike ) then call C14_init_BombSpike() end if - if ( use_c13 .and. use_c13_timeseries ) then call C13_init_TimeSeries() end if else call SatellitePhenologyInit(bounds_proc) end if - - if(use_soil_moisture_streams) then + if (use_soil_moisture_streams) then call PrescribedSoilMoistureInit(bounds_proc) endif - - ! ------------------------------------------------------------------------ ! On restart only - process the history namelist. ! ------------------------------------------------------------------------ @@ -803,8 +755,6 @@ subroutine initialize2( ) endif call t_stopf('init_wlog') - call t_stopf('clm_init2') - if (water_inst%DoConsistencyCheck()) then !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) do nc = 1,nclumps @@ -814,6 +764,8 @@ subroutine initialize2( ) !$OMP END PARALLEL DO end if - end subroutine initialize2 + call t_stopf('clm_init3') + + end subroutine initialize3 end module clm_initializeMod diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index b70827a084..05a68c4c9a 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -50,9 +50,6 @@ module clm_varctl ! by default this is not allowed logical, public :: brnch_retain_casename = .false. - !true => no valid land points -- do NOT run - logical, public :: noland = .false. - ! true => run tests of ncdio_pio logical, public :: for_testing_run_ncdiopio_tests = .false. diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 index 540dd3cde9..0ad490aaf1 100644 --- a/src/main/decompInitMod.F90 +++ b/src/main/decompInitMod.F90 @@ -428,7 +428,7 @@ subroutine decompInit_ocn(ni, nj, amask, gindex_ocn) end subroutine decompInit_ocn !------------------------------------------------------------------------------ - subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) + subroutine decompInit_clumps(lni,lnj,glc_behavior) ! ! !DESCRIPTION: ! This subroutine initializes the land surface decomposition into a clump @@ -441,7 +441,7 @@ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) ! ! !ARGUMENTS: implicit none - integer , intent(in) :: lns,lni,lnj ! land domain global size + integer , intent(in) :: lni,lnj ! land domain global size type(glc_behavior_type), intent(in) :: glc_behavior ! ! !LOCAL VARIABLES: @@ -590,7 +590,7 @@ subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) end subroutine decompInit_clumps !------------------------------------------------------------------------------ - subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) + subroutine decompInit_glcp(lni,lnj,glc_behavior) ! ! !DESCRIPTION: ! Determine gsMaps for landunits, columns, patches and cohorts @@ -602,7 +602,7 @@ subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) ! ! !ARGUMENTS: implicit none - integer , intent(in) :: lns,lni,lnj ! land domain global size + integer , intent(in) :: lni,lnj ! land domain global size type(glc_behavior_type), intent(in) :: glc_behavior ! ! !LOCAL VARIABLES: diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index 6412fafe9c..33c5194423 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -15,7 +15,8 @@ module surfrdMod use clm_varcon , only : grlnd use clm_varctl , only : iulog use clm_varctl , only : use_cndv, use_crop - use surfrdUtilsMod , only : check_sums_equal_1, collapse_crop_types, collapse_to_dominant, collapse_crop_var, collapse_individual_lunits + use surfrdUtilsMod , only : check_sums_equal_1, collapse_crop_types + use surfrdUtilsMod , only : collapse_to_dominant, collapse_crop_var, collapse_individual_lunits use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim_size, ncd_inqdid, ncd_inqdlen use pio @@ -26,238 +27,23 @@ module surfrdMod save ! ! !PUBLIC MEMBER FUNCTIONS: - public :: surfrd_get_globmask ! Reads global land mask (needed for setting domain decomp) - public :: surfrd_get_grid ! Read grid/ladnfrac data into domain (after domain decomp) - public :: surfrd_get_data ! Read surface dataset and determine subgrid weights + public :: surfrd_get_data ! Read surface dataset and determine subgrid weights public :: surfrd_get_num_patches ! Read surface dataset to determine maxsoil_patches and numcft ! !PRIVATE MEMBER FUNCTIONS: - private :: surfrd_special ! Read the special landunits - private :: surfrd_veg_all ! Read all of the vegetated landunits - private :: surfrd_veg_dgvm ! Read vegetated landunits for DGVM mode - private :: surfrd_pftformat ! Read crop pfts in file format where they are part of the vegetated land unit - private :: surfrd_cftformat ! Read crop pfts in file format where they are on their own landunit + private :: surfrd_special ! Read the special landunits + private :: surfrd_veg_all ! Read all of the vegetated landunits + private :: surfrd_veg_dgvm ! Read vegetated landunits for DGVM mode + private :: surfrd_pftformat ! Read crop pfts in file format where they are part of the vegetated land unit + private :: surfrd_cftformat ! Read crop pfts in file format where they are on their own landunit ! ! !PRIVATE DATA MEMBERS: - ! default multiplication factor for epsilon for error checks - real(r8), private, parameter :: eps_fact = 2._r8 - character(len=*), parameter, private :: sourcefile = & __FILE__ !----------------------------------------------------------------------- contains - !----------------------------------------------------------------------- - subroutine surfrd_get_globmask(filename, mask, ni, nj) - ! - ! !DESCRIPTION: - ! Read the surface dataset grid related information: - ! This is the first routine called by clm_initialize - ! NO DOMAIN DECOMPOSITION HAS BEEN SET YET - ! - ! !USES: - use fileutils , only : getfil - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: filename ! grid filename - integer , pointer :: mask(:) ! grid mask - integer , intent(out) :: ni, nj ! global grid sizes - ! - ! !LOCAL VARIABLES: - logical :: isgrid2d - integer :: dimid,varid ! netCDF id's - integer :: ns ! size of grid on file - integer :: n,i,j ! index - integer :: ier ! error status - type(file_desc_t) :: ncid ! netcdf id - character(len=256) :: varname ! variable name - character(len=256) :: locfn ! local file name - logical :: readvar ! read variable in or not - integer , allocatable :: idata2d(:,:) - character(len=32) :: subname = 'surfrd_get_globmask' ! subroutine name - !----------------------------------------------------------------------- - - if (filename == ' ') then - mask(:) = 1 - RETURN - end if - - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end if - - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Determine dimensions and if grid file is 2d or 1d - - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - if (masterproc) then - write(iulog,*)'lat/lon grid flag (isgrid2d) is ',isgrid2d - end if - - allocate(mask(ns)) - mask(:) = 1 - - if (isgrid2d) then - allocate(idata2d(ni,nj)) - idata2d(:,:) = 1 - call ncd_io(ncid=ncid, varname='LANDMASK', data=idata2d, flag='read', readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', data=idata2d, flag='read', readvar=readvar) - end if - if (readvar) then - do j = 1,nj - do i = 1,ni - n = (j-1)*ni + i - mask(n) = idata2d(i,j) - enddo - enddo - end if - deallocate(idata2d) - else - call ncd_io(ncid=ncid, varname='LANDMASK', data=mask, flag='read', readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', data=mask, flag='read', readvar=readvar) - end if - end if - if (.not. readvar) call endrun( msg=' ERROR: landmask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - - call ncd_pio_closefile(ncid) - - end subroutine surfrd_get_globmask - - !----------------------------------------------------------------------- - subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) - ! - ! !DESCRIPTION: - ! THIS IS CALLED AFTER THE DOMAIN DECOMPOSITION HAS BEEN CREATED - ! Read the surface dataset grid related information: - ! o real latitude of grid cell (degrees) - ! o real longitude of grid cell (degrees) - ! - ! !USES: - use clm_varcon, only : spval, re - use domainMod , only : domain_type, domain_init, domain_clean, lon1d, lat1d - use fileutils , only : getfil - ! - ! !ARGUMENTS: - integer ,intent(in) :: begg, endg - type(domain_type),intent(inout) :: ldomain ! domain to init - character(len=*) ,intent(in) :: filename ! grid filename - character(len=*) ,optional, intent(in) :: glcfilename ! glc mask filename - ! - ! !LOCAL VARIABLES: - type(file_desc_t) :: ncid ! netcdf id - integer :: beg ! local beg index - integer :: end ! local end index - integer :: ni,nj,ns ! size of grid on file - integer :: dimid,varid ! netCDF id's - integer :: start(1), count(1) ! 1d lat/lon array sections - integer :: ier,ret ! error status - logical :: readvar ! true => variable is on input file - logical :: isgrid2d ! true => file is 2d lat/lon - logical :: istype_domain ! true => input file is of type domain - real(r8), allocatable :: rdata2d(:,:) ! temporary - character(len=16) :: vname ! temporary - character(len=256):: locfn ! local file name - integer :: n ! indices - real(r8):: eps = 1.0e-12_r8 ! lat/lon error tolerance - character(len=32) :: subname = 'surfrd_get_grid' ! subroutine name -!----------------------------------------------------------------------- - - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end if - - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Determine dimensions - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - - ! Determine isgrid2d flag for domain - call domain_init(ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - - ! Determine type of file - old style grid file or new style domain file - call check_var(ncid=ncid, varname='xc', readvar=readvar) - if (readvar)then - istype_domain = .true. - else - istype_domain = .false. - end if - - ! Read in area, lon, lat - - if (istype_domain) then - call ncd_io(ncid=ncid, varname= 'area', flag='read', data=ldomain%area, & - dim1name=grlnd, readvar=readvar) - ! convert from radians**2 to km**2 - ldomain%area = ldomain%area * (re**2) - if (.not. readvar) call endrun( msg=' ERROR: area NOT on file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname= 'xc', flag='read', data=ldomain%lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: xc NOT on file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname= 'yc', flag='read', data=ldomain%latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: yc NOT on file'//errMsg(sourcefile, __LINE__)) - else - call endrun( msg=" ERROR: can no longer read non domain files" ) - end if - - if (isgrid2d) then - allocate(rdata2d(ni,nj), lon1d(ni), lat1d(nj)) - if (istype_domain) vname = 'xc' - call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) - lon1d(:) = rdata2d(:,1) - if (istype_domain) vname = 'yc' - call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) - lat1d(:) = rdata2d(1,:) - deallocate(rdata2d) - end if - - ! Check lat limited to -90,90 - - if (minval(ldomain%latc) < -90.0_r8 .or. & - maxval(ldomain%latc) > 90.0_r8) then - write(iulog,*) trim(subname),' WARNING: lat/lon min/max is ', & - minval(ldomain%latc),maxval(ldomain%latc) - ! call endrun( msg=' ERROR: lat is outside [-90,90]'//errMsg(sourcefile, __LINE__)) - ! write(iulog,*) trim(subname),' Limiting lat/lon to [-90/90] from ', & - ! minval(domain%latc),maxval(domain%latc) - ! where (ldomain%latc < -90.0_r8) ldomain%latc = -90.0_r8 - ! where (ldomain%latc > 90.0_r8) ldomain%latc = 90.0_r8 - endif - if ( any(ldomain%lonc < 0.0_r8) )then - call endrun( msg=' ERROR: lonc is negative and currently can NOT be (see https://github.com/ESCOMP/ctsm/issues/507)' & - //errMsg(sourcefile, __LINE__)) - endif - - call ncd_io(ncid=ncid, varname='mask', flag='read', data=ldomain%mask, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: LANDMASK NOT on fracdata file'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='frac', flag='read', data=ldomain%frac, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: LANDFRAC NOT on fracdata file'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_pio_closefile(ncid) - - end subroutine surfrd_get_grid - !----------------------------------------------------------------------- subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) ! @@ -523,24 +309,24 @@ subroutine surfrd_special(begg, endg, ncid, ns) integer , intent(in) :: ns ! domain size ! ! !LOCAL VARIABLES: - integer :: n,nl,nurb,g ! indices - integer :: dimid,varid ! netCDF id's - real(r8) :: nlevsoidata(nlevsoifl) - logical :: found ! temporary for error check - integer :: nindx ! temporary for error check - integer :: ier ! error status - logical :: readvar - real(r8),pointer :: pctgla(:) ! percent of grid cell is glacier - real(r8),pointer :: pctlak(:) ! percent of grid cell is lake - real(r8),pointer :: pctwet(:) ! percent of grid cell is wetland - real(r8),pointer :: pcturb(:,:) ! percent of grid cell is urbanized + integer :: n,nl,nurb,g ! indices + integer :: dimid,varid ! netCDF id's + real(r8) :: nlevsoidata(nlevsoifl) + logical :: found ! temporary for error check + integer :: nindx ! temporary for error check + integer :: ier ! error status + logical :: readvar + real(r8),pointer :: pctgla(:) ! percent of grid cell is glacier + real(r8),pointer :: pctlak(:) ! percent of grid cell is lake + real(r8),pointer :: pctwet(:) ! percent of grid cell is wetland + real(r8),pointer :: pcturb(:,:) ! percent of grid cell is urbanized integer ,pointer :: urban_region_id(:) - real(r8),pointer :: pcturb_tot(:) ! percent of grid cell is urban (sum over density classes) - real(r8),pointer :: pctspec(:) ! percent of spec lunits wrt gcell - integer :: dens_index ! urban density index - character(len=32) :: subname = 'surfrd_special' ! subroutine name - real(r8) closelat,closelon + real(r8),pointer :: pcturb_tot(:) ! percent of grid cell is urban (sum over density classes) + real(r8),pointer :: pctspec(:) ! percent of spec lunits wrt gcell + integer :: dens_index ! urban density index + real(r8) :: closelat,closelon integer, parameter :: urban_invalid_region = 0 ! urban_region_id indicating invalid point + character(len=32) :: subname = 'surfrd_special' ! subroutine name !----------------------------------------------------------------------- allocate(pctgla(begg:endg)) From 0df69be0fed13be5975d8a1c640931bd1f051a0a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 26 Dec 2020 14:50:22 -0700 Subject: [PATCH 1728/1973] added new file --- src/cpl/nuopc/lnd_set_decomp_and_domain.F90 | 543 ++++++++++++++++++++ 1 file changed, 543 insertions(+) create mode 100644 src/cpl/nuopc/lnd_set_decomp_and_domain.F90 diff --git a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 new file mode 100644 index 0000000000..de65fa9b58 --- /dev/null +++ b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 @@ -0,0 +1,543 @@ +module lnd_set_decomp_and_domain + + use ESMF + use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl + use spmdMod , only : masterproc + use clm_varctl , only : iulog + use nuopc_shr_methods , only : chkerr + + implicit none + private ! except + + ! Module public routines + public :: lnd_set_decomp_and_domain_from_meshinfo + public :: lnd_set_decomp_and_domain_from_newmesh + + ! Module private routines + private :: clm_getlandmask_from_ocnmesh + private :: clm_getlandmask_from_lndmesh + private :: nc_check_err + + character(len=*) , parameter :: u_FILE_u = & + __FILE__ + +!=============================================================================== +contains +!=============================================================================== + + subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) + + use NUOPC , only : NUOPC_CompAttributeGet + use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D + use domainMod , only : ldomain, domain_init, lon1d, lat1d + use decompMod , only : ldecomp, bounds_type, get_proc_bounds + use clm_varpar , only : nlevsoi + use clm_varctl , only : use_soil_moisture_streams, single_column + use clm_varcon , only : re + use lnd_comp_shr , only : model_meshfile, model_clock + + ! input/output variables + type(ESMF_GridComp) , intent(inout) :: gcomp + type(ESMF_Mesh) , intent(out) :: mesh + integer , intent(out) :: ni,nj ! global grid dimensions + integer , intent(out) :: rc + + ! local variables + type(ESMF_VM) :: vm + type(ESMF_Mesh) :: mesh_lnd + type(ESMF_Mesh) :: mesh_ocn + type(ESMF_DistGrid) :: distgrid_mesh + type(ESMF_DistGrid) :: distgrid_lnd + character(CL) :: cvalue ! config data + integer :: nlnd, nocn ! local size of arrays + integer :: g,n ! indices + type(bounds_type) :: bounds ! bounds + integer :: begg,endg + character(CL) :: meshfile_ocn + integer , pointer :: gindex_lnd(:) ! global index space for just land points + integer , pointer :: gindex_ocn(:) ! global index space for just ocean points + integer , pointer :: gindex(:) ! global index space for land and ocean points + integer , pointer :: mask(:) ! local land/ocean mask + integer , pointer :: lndmask_loc(:) + real(r8) , pointer :: lndfrac_loc(:) + real(r8) , pointer :: lndarea_loc(:) + integer , pointer :: lndmask_glob(:) + real(r8) , pointer :: lndfrac_glob(:) + real(r8) , pointer :: lndarea_glob(:) + real(r8) , pointer :: lndlats_glob(:) + real(r8) , pointer :: lndlons_glob(:) + real(r8) , pointer :: rtemp_glob(:) + integer , pointer :: itemp_glob(:) + real(r8) , pointer :: ownedElemCoords(:) + real(r8) , pointer :: dataptr1d(:) + integer :: lsize, gsize + logical :: isgrid2d + integer :: spatialDim + type(ESMF_Field) :: areaField + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! get vm + call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! determine global 2d sizes + call NUOPC_CompAttributeGet(gcomp, name='lnd_ni', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) ni + call NUOPC_CompAttributeGet(gcomp, name='lnd_nj', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) nj + gsize = ni*nj + if (single_column) then + isgrid2d = .true. + else if (nj == 1) then + isgrid2d = .false. + else + isgrid2d = .true. + end if + if (masterproc) then + write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj + if (isgrid2d) then + write(iulog,'(a)') 'model grid is 2-dimensional' + else + write(iulog,'(a)') 'model grid is not 2-dimensional' + end if + end if + + ! read in the land mesh from the file + mesh_lnd = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(iulog,'(a)')'land mesh file ',trim(model_meshfile) + end if + + ! read in ocn mask meshfile + call NUOPC_CompAttributeGet(gcomp, name='mesh_ocnmask', value=meshfile_ocn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + mesh_ocn = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) + end if + + ! set local land fraction and land mask for input read decomposition + ! Note that lndmask_loc and lndfrac_loc are allocated in the following calls and lsize is returned + if (trim(meshfile_ocn) == 'null') then + ! obtain land mask from land mesh file - assume that land frac is identical to land mask + call clm_getlandmask_from_lndmesh(mesh_lnd, lsize, lndmask_loc, lndfrac_loc, distgrid_lnd, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call clm_getlandmask_from_ocnmesh(mesh_lnd, mesh_ocn, lsize, lndmask_loc, lndfrac_loc, distgrid_lnd, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! determine global landmask_glob - needed to determine the ctsm decomposition + ! land frac, lats, lons and areas will be done below + allocate(gindex(lsize)) + call ESMF_DistGridGet(distgrid_lnd, 0, seqIndexList=gindex, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 + do n = 1,lsize + lndmask_glob(gindex(n)) = lndmask_loc(n) + end do + allocate(itemp_glob(gsize)) + call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndmask_glob(:) = int(itemp_glob(:)) + deallocate(itemp_glob) + + ! determine lnd decomposition that will be used by ctsm + call decompInit_lnd(lni=ni, lnj=nj, amask=lndmask_glob) + if (use_soil_moisture_streams) then + call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) + end if + + ! Determine ocn decomposition that will be used to create the full mesh + ! note that the memory for gindex_ocn will be allocated in the following call + call decompInit_ocn(ni=ni, nj=nj, amask=lndmask_glob, gindex_ocn=gindex_ocn) + + ! *** Get JUST gridcell processor bounds *** + ! Remaining bounds (landunits, columns, patches) will be set after calling decompInit_glcp + ! so get_proc_bounds is called twice and the gridcell information is just filled in twice + call get_proc_bounds(bounds) + begg = bounds%begg + endg = bounds%endg + + ! Create gindex_lnd + nlnd = endg - begg + 1 + allocate(gindex_lnd(nlnd)) + do g = begg, endg + n = 1 + (g - begg) + gindex_lnd(n) = ldecomp%gdc2glo(g) + end do + + ! Initialize domain data structure + call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + + ! Determine ldomain%mask + do g = begg, endg + n = 1 + (g - begg) + ldomain%mask(g) = lndmask_glob(gindex_lnd(n)) + end do + deallocate(lndmask_glob) + + ! Determine ldomain%frac + allocate(rtemp_glob(gsize)) + allocate(lndfrac_glob(gsize)) + lndfrac_glob(:) = 0._r8 + do n = 1,lsize + lndfrac_glob(gindex(n)) = lndfrac_loc(n) + end do + call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndfrac_glob(:) = rtemp_glob(:) + do g = begg, endg + ldomain%frac(g) = lndfrac_glob(gindex_lnd(g-begg+1)) + end do + deallocate(lndfrac_glob) + + ! Get ownedElemCords from the mesh to be used to obtain ldoman%latc and ldomain%lonc + call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, rc=rc) + allocate(ownedElemCoords(spatialDim*lsize)) + call ESMF_MeshGet(mesh_lnd, ownedElemCoords=ownedElemCoords) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine ldomain%latc and global lat1d + allocate(lndlats_glob(gsize)) + lndlats_glob(:) = 0._r8 + do n = 1,lsize + lndlats_glob(gindex(n)) = ownedElemCoords(2*n) + end do + call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndlats_glob(:) = rtemp_glob(:) + do g = begg, endg + ldomain%latc(g) = lndlats_glob(gindex_lnd(g-begg+1)) + end do + if (isgrid2d) then + allocate(lat1d(nj)) + do n = 1,nj + lat1d(n) = lndlats_glob((n-1)*ni + 1) + end do + end if + deallocate(lndlats_glob) + + ! Determine ldomain%lonc and global lon1d + allocate(lndlons_glob(gsize)) + lndlons_glob(:) = 0._r8 + do n = 1,lsize + lndlons_glob(gindex(n)) = ownedElemCoords(2*n-1) + end do + call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndlons_glob(:) = rtemp_glob(:) + do g = begg, endg + ldomain%lonc(g) = lndlons_glob(gindex_lnd(g-begg+1)) + end do + if (isgrid2d) then + allocate(lon1d(ni)) + do n = 1,ni + lon1d(n) = lndlons_glob(n) + end do + end if + deallocate(lndlons_glob) + deallocate(rtemp_glob) + + ! Create a global index that includes both land and ocean points + nocn = size(gindex_ocn) + allocate(gindex(nlnd + nocn)) + do n = 1,nlnd+nocn + if (n <= nlnd) then + gindex(n) = gindex_lnd(n) + else + gindex(n) = gindex_ocn(n-nlnd) + end if + end do + + ! Generate a new mesh on the gindex decomposition + distGrid_mesh = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + deallocate(gindex) + mesh = ESMF_MeshCreate(mesh_lnd, elementDistGrid=distgrid_mesh, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Create ldomain%area by querying the mesh on the ctsm decomposition + areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldRegridGetArea(areaField, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(areaField, farrayPtr=dataptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg, endg + ldomain%area(g) = dataptr1d(g-begg+1) * (re*re) + end do + call ESMF_FieldDestroy(areaField) + + end subroutine lnd_set_decomp_and_domain_from_meshinfo + + !=============================================================================== + subroutine lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) + + use NUOPC , only : NUOPC_CompAttributeGet + use clm_varctl , only : single_column + use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror + use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var + use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable + + ! input/output variables + type(ESMF_GridComp) , intent(inout) :: gcomp + type(ESMF_Mesh) , intent(out) :: mesh + integer , intent(out) :: ni,nj ! global grid dimensions + integer , intent(out) :: rc + + ! local variables + integer :: ncid, ierr + integer :: nv + integer :: dimid_ni, dimid_nj, dimid_nv + integer :: maxIndex(2) + real(r8) :: mincornerCoord(2) + real(r8) :: maxcornerCoord(2) + type(ESMF_Grid) :: lgrid + real(r8), allocatable :: xv(:,:,:), yv(:,:,:) + integer :: varid_xv, varid_yv + character(len=CL) :: cvalue + integer :: gsize + logical :: isgrid2d + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! determine global 2d sizes + call NUOPC_CompAttributeGet(gcomp, name='lnd_ni', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) ni + call NUOPC_CompAttributeGet(gcomp, name='lnd_nj', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) nj + gsize = ni*nj + if (single_column) then + isgrid2d = .true. + else if (nj == 1) then + isgrid2d = .false. + else + isgrid2d = .true. + end if + if (masterproc) then + write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj + if (isgrid2d) then + write(iulog,'(a)') 'model grid is 2-dimensional' + else + write(iulog,'(a)') 'model grid is not 2-dimensional' + end if + end if + + ! get the datm grid from the domain file + call NUOPC_CompAttributeGet(gcomp, name='domain_lnd', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! open file + ierr = nf90_open(cvalue, NF90_NOWRITE, ncid) + call nc_check_err(ierr, 'nf90_open', trim(cvalue)) + ! get dimension ids + ierr = nf90_inq_dimid(ncid, 'ni', dimid_ni) + call nc_check_err(ierr, 'nf90_inq_dimid for ni', trim(cvalue)) + ierr = nf90_inq_dimid(ncid, 'nj', dimid_nj) + call nc_check_err(ierr, 'nf90_inq_dimid for nj', trim(cvalue)) + ierr = nf90_inq_dimid(ncid, 'nv', dimid_nv) + call nc_check_err(ierr, 'nf90_inq_dimid for nv', trim(cvalue)) + ! get dimension values + ierr = nf90_inquire_dimension(ncid, dimid_ni, len=ni) + call nc_check_err(ierr, 'nf90_inq_dimension for ni', trim(cvalue)) + ierr = nf90_inquire_dimension(ncid, dimid_nj, len=nj) + call nc_check_err(ierr, 'nf90_inq_dimension for nj', trim(cvalue)) + ierr = nf90_inquire_dimension(ncid, dimid_nv, len=nv) + call nc_check_err(ierr, 'nf90_inq_dimension for nv', trim(cvalue)) + ! get variable ids + ierr = nf90_inq_varid(ncid, 'xv', varid_xv) + call nc_check_err(ierr, 'nf90_inq_varid for xv', trim(cvalue)) + ierr = nf90_inq_varid(ncid, 'yv', varid_yv) + call nc_check_err(ierr, 'nf90_inq_varid for yv', trim(cvalue)) + ! allocate memory for variables and get variable values + allocate(xv(nv,ni,nj), yv(nv,ni,nj)) + ierr = nf90_get_var(ncid, varid_xv, xv) + call nc_check_err(ierr, 'nf90_get_var for xv', trim(cvalue)) + ierr = nf90_get_var(ncid, varid_yv, yv) + call nc_check_err(ierr, 'nf90_get_var for yv', trim(cvalue)) + ! close file + ierr = nf90_close(ncid) + call nc_check_err(ierr, 'nf90_close', trim(cvalue)) + ! create the grid + maxIndex(1) = ni ! number of lons + maxIndex(2) = nj ! number of lats + mincornerCoord(1) = xv(1,1,1) ! min lon + mincornerCoord(2) = yv(1,1,1) ! min lat + maxcornerCoord(1) = xv(3,ni,nj) ! max lon + maxcornerCoord(2) = yv(3,ni,nj) ! max lat + deallocate(xv,yv) + lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & + mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & + staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! create the mesh from the grid + mesh = ESMF_MeshCreate(lgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! TODO: initialize the decomposition + ! initialize ldomain + ! initialize the mask and mesh + ! for created meshes assume the mask is 1 + ! create a pointer for mask and set it to 1 + ! call ESMF_MeshSet(mesh, elementMask=mask, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! deallocate(mask) + + end subroutine lnd_set_decomp_and_domain_from_newmesh + + !=============================================================================== + subroutine clm_getlandmask_from_ocnmesh(mesh_lnd, mesh_ocn, lsize_lnd, lndmask_loc, lndfrac_loc, distgrid_lnd, rc) + + ! input/out variables + type(ESMF_Mesh) , intent(in) :: mesh_lnd + type(ESMF_Mesh) , intent(in) :: mesh_ocn + integer , pointer :: lndmask_loc(:) + real(r8) , pointer :: lndfrac_loc(:) + integer , intent(out) :: lsize_lnd + type(ESMF_DistGrid) , intent(out) :: distgrid_lnd + integer , intent(out) :: rc + + ! local variables: + type(ESMF_RouteHandle) :: rhandle_ocn2lnd + type(ESMF_Field) :: field_lnd + type(ESMF_Field) :: field_ocn + type(ESMF_DistGrid) :: distgrid_ocn + real(r8) , pointer :: ocnmask_loc(:) ! on ocean mesh + real(r8) , pointer :: ocnfrac_loc(:) ! on land mesh + real(r8) , pointer :: dataptr1d(:) + type(ESMF_Array) :: elemMaskArray + integer :: lsize_ocn + integer :: n, spatialDim + integer :: srcMaskValue = 0 + integer :: dstMaskValue = -987987 ! spval for RH mask values + integer :: srcTermProcessing_Value = 0 + real(r8) :: fminval = 0.001_r8 + real(r8) :: fmaxval = 1._r8 + logical :: checkflag = .false. + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, numOwnedElements=lsize_lnd, & + elementDistGrid=distgrid_lnd, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(lndmask_loc(lsize_lnd)) + allocate(lndfrac_loc(lsize_lnd)) + + ! create fields on land and ocean meshes + field_lnd = ESMF_FieldCreate(mesh_lnd, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + field_ocn = ESMF_FieldCreate(mesh_ocn, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! create route handle to map ocean mask from ocn mesh to land mesh + call ESMF_FieldRegridStore(field_ocn, field_lnd, routehandle=rhandle_ocn2lnd, & + srcMaskValues=(/srcMaskValue/), dstMaskValues=(/dstMaskValue/), & + regridmethod=ESMF_REGRIDMETHOD_CONSERVE, normType=ESMF_NORMTYPE_DSTAREA, & + srcTermProcessing=srcTermProcessing_Value, & + ignoreDegenerate=.true., unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! fill in values for field_ocn with mask on ocn mesh + call ESMF_MeshGet(mesh_ocn, elementdistGrid=distgrid_ocn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_DistGridGet(distgrid_ocn, localDe=0, elementCount=lsize_ocn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(ocnmask_loc(lsize_ocn)) + elemMaskArray = ESMF_ArrayCreate(distgrid_ocn, ocnmask_loc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(mesh_ocn, elemMaskArray=elemMaskArray, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(field_ocn, farrayptr=dataptr1d, rc=rc) + dataptr1d(:) = ocnmask_loc(:) + + ! map ocn mask to land mesh + call ESMF_FieldRegrid(field_ocn, field_lnd, routehandle=rhandle_ocn2lnd, & + termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(ocnfrac_loc(lsize_lnd)) + call ESMF_FieldGet(field_lnd, farrayptr=ocnfrac_loc, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1,lsize_lnd + lndfrac_loc(n) = 1._r8 - ocnfrac_loc(n) + if (lndfrac_loc(n) > fmaxval) lndfrac_loc(n) = 1._r8 + if (lndfrac_loc(n) < fminval) lndfrac_loc(n) = 0._r8 + if (lndfrac_loc(n) /= 0._r8) then + lndmask_loc(n) = 1 + else + lndmask_loc(n) = 0 + end if + enddo + + ! deallocate memory + call ESMF_FieldDestroy(field_lnd) + call ESMF_FieldDestroy(field_ocn) + deallocate(ocnmask_loc) + + end subroutine clm_getlandmask_from_ocnmesh + + !=============================================================================== + subroutine clm_getlandmask_from_lndmesh(mesh_lnd, lsize, lndmask_loc, lndfrac_loc, distgrid_lnd, rc) + + ! input/out variables + type(ESMF_Mesh) , intent(in) :: mesh_lnd + integer , intent(out) :: lsize + integer , pointer :: lndmask_loc(:) + real(r8) , pointer :: lndfrac_loc(:) + type(ESMF_DistGrid) , intent(out) :: distgrid_lnd + integer , intent(out) :: rc + + ! local variables: + type(ESMF_Array) :: elemMaskArray + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Determine lsize and distgrid_lnd + call ESMF_MeshGet(mesh_lnd, elementdistGrid=distgrid_lnd, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_DistGridGet(distgrid_lnd, localDe=0, elementCount=lsize, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine lndfrac_loc + ! The call to ESMF_MeshGet fills in the values of lndmask_loc + allocate(lndmask_loc(lsize)) + elemMaskArray = ESMF_ArrayCreate(distgrid_lnd, lndmask_loc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(mesh_lnd, elemMaskArray=elemMaskArray, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine lndmask_loc + ! ASSUME that land fraction is identical to land mask in this case + allocate(lndfrac_loc(lsize)) + lndfrac_loc(:) = lndmask_loc(:) + + end subroutine clm_getlandmask_from_lndmesh + + !=============================================================================== + subroutine nc_check_err(ierror, description, filename) + + use shr_sys_mod , only : shr_sys_abort + use netcdf , only : nf90_noerr, nf90_strerror + + integer , intent(in) :: ierror + character(*), intent(in) :: description + character(*), intent(in) :: filename + + if (ierror /= nf90_noerr) then + write (*,'(6a)') 'ERROR ', trim(description),'. NetCDF file : "', trim(filename),& + '". Error message:', trim(nf90_strerror(ierror)) + call shr_sys_abort() + endif + end subroutine nc_check_err + +end module lnd_set_decomp_and_domain From e0beea686ac6ad5c73805352bfdc372e494b9d47 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 27 Dec 2020 11:53:22 -0700 Subject: [PATCH 1729/1973] refactor of lilac cap to optionally obtain all info from the land mesh --- src/cpl/lilac/lnd_comp_esmf.F90 | 56 +- src/cpl/lilac/lnd_set_decomp_and_domain.F90 | 637 ++++++-------------- src/cpl/nuopc/lnd_set_decomp_and_domain.F90 | 2 - 3 files changed, 201 insertions(+), 494 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index ea3af7c88e..d04aa66d9a 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -39,6 +39,7 @@ module lnd_comp_esmf use clm_driver , only : clm_drv use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_diagnose + use lnd_set_decomp_and_domain, only : lnd_set_decomp_and_domain_from_meshinfo implicit none private ! By default make data private except @@ -129,12 +130,10 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! mesh generation type(ESMF_Mesh) :: lnd_mesh character(ESMF_MAXSTR) :: lnd_mesh_filename ! full filepath of land mesh file - integer :: nlnd, nocn ! local size ofarrays integer, pointer :: gindex(:) ! global index space for land and ocean points - integer, pointer :: gindex_lnd(:) ! global index space for just land points - integer, pointer :: gindex_ocn(:) ! global index space for just ocean points type(ESMF_DistGrid) :: distgrid integer :: fileunit + integer :: ni, nj ! clock info character(len=CL) :: calendar ! calendar type name @@ -334,62 +333,21 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- ! Call initialize1 !---------------------- - call initialize1(dtime=dtime_sync) + call initialize1(dtime=dtime_lilac) call ESMF_LogWrite(subname//"ctsm initialize1 done...", ESMF_LOGMSG_INFO) !---------------------- - ! Initialize decomposition (ldecomp) and domain (ldomain) types + ! Initialize decomposition (ldecomp) and domain (ldomain) types and generate land mesh !---------------------- - call lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) - - !-------------------------------- - ! generate the land mesh on ctsm distribution - !-------------------------------- - ! obtain global index array for just land points which includes mask=0 or ocean points - call get_proc_bounds( bounds ) - - nlnd = bounds%endg - bounds%begg + 1 - allocate(gindex_lnd(nlnd)) - do g = bounds%begg,bounds%endg - n = 1 + (g - bounds%begg) - gindex_lnd(n) = ldecomp%gdc2glo(g) - end do - call ESMF_LogWrite(subname//"obtained global index", ESMF_LOGMSG_INFO) - - ! create a global index that includes both land and ocean points - nocn = size(gindex_ocn) - allocate(gindex(nlnd + nocn)) - do n = 1,nlnd+nocn - if (n <= nlnd) then - gindex(n) = gindex_lnd(n) - else - gindex(n) = gindex_ocn(n-nlnd) - end if - end do - - ! create distGrid from global index array - DistGrid = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) + call lnd_set_decomp_and_domain_from_meshinfo(lnd_mesh_filename, lnd_mesh, ni, nj, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - deallocate(gindex) - call ESMF_LogWrite(subname//"DistGrid created......", ESMF_LOGMSG_INFO) - - ! create esmf mesh using distgrid and lnd_mesh_filename - lnd_mesh = ESMF_MeshCreate(filename=trim(lnd_mesh_filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, & - elementDistgrid=Distgrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) then - call shr_sys_abort("Error in creating mesh "// trim(lnd_mesh_filename)) - end if - if (masterproc) then - write(iulog,*)'mesh file for domain is ',trim(lnd_mesh_filename) - end if - call ESMF_LogWrite(subname//" Create Mesh using file ...."//trim(lnd_mesh_filename), ESMF_LOGMSG_INFO) !-------------------------------- ! Finish initializing ctsm !-------------------------------- call initialize2(ni,nj) call initialize3() - call ESMF_LogWrite(subname//"ctsm initialize2 done...", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"ctsm initialize done...", ESMF_LOGMSG_INFO) !-------------------------------- ! Create import state (only assume input from atm - not rof and glc) @@ -470,6 +428,8 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Fill in ctsm export state !-------------------------------- + call get_proc_bounds( bounds ) + call export_fields(export_state, bounds, rc=rc) if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT) diff --git a/src/cpl/lilac/lnd_set_decomp_and_domain.F90 b/src/cpl/lilac/lnd_set_decomp_and_domain.F90 index d11ddbf5aa..315f5a835c 100644 --- a/src/cpl/lilac/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/lilac/lnd_set_decomp_and_domain.F90 @@ -1,7 +1,6 @@ module lnd_set_decomp_and_domain use ESMF - use NUOPC , only : NUOPC_CompAttributeGet use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl use spmdMod , only : masterproc use clm_varctl , only : iulog @@ -12,151 +11,94 @@ module lnd_set_decomp_and_domain ! Module public routines public :: lnd_set_decomp_and_domain_from_meshinfo - public :: lnd_set_decomp_and_domain_from_surfrd ! Module private routines - private :: clm_getlandmask_from_lndmesh + private :: chkerr character(len=*) , parameter :: u_FILE_u = & __FILE__ + character(len=*), parameter, private :: sourcefile = & + __FILE__ !=============================================================================== contains !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) - - ! Initialize ldecomp and ldomain data types - - use clm_varpar , only: nlevsoi - use clm_varctl , only: fatmlndfrc, use_soil_moisture_streams - use decompInitMod , only: decompInit_lnd, decompInit_lnd3D - use decompMod , only: bounds_type, get_proc_bounds - use domainMod , only: ldomain, domain_init, domain_check - - ! input/output variables - logical, intent(out) :: noland - integer, intent(out) :: ni, nj ! global grid sizes - - ! local variables - integer ,pointer :: amask(:) ! global land mask - integer :: begg, endg ! processor bounds - type(bounds_type) :: bounds ! bounds - character(len=32) :: subname = 'lnd_set_decomp_and_domain_from_surfrd' - !----------------------------------------------------------------------- - - ! Read in global land grid and land mask (amask)- needed to set decomposition - ! global memory for amask is allocate in surfrd_get_glomask - must be deallocated below - if (masterproc) then - write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) - endif - - ! Get global mask, ni and nj - call surfrd_get_globmask(filename=fatmlndfrc, mask=amask, ni=ni, nj=nj) - - ! Exit early if no valid land points - if ( all(amask == 0) )then - if (masterproc) write(iulog,*) trim(subname)//': no valid land points do NOT run clm' - noland = .true. - return - else - noland = .false. - end if - - ! Initialize ldecomp data type - ! Determine ctsm gridcell decomposition and processor bounds for gridcells - call decompInit_lnd(ni, nj, amask) - deallocate(amask) - if (use_soil_moisture_streams) call decompInit_lnd3D(ni, nj, nlevsoi) - - ! Initialize bounds for just gridcells - ! Remaining bounds (landunits, columns, patches) will be determined - ! after the call to decompInit_glcp - so get_proc_bounds is called - ! twice and the gridcell information is just filled in twice - call get_proc_bounds(bounds) - - ! Get grid cell bounds values - begg = bounds%begg - endg = bounds%endg - - ! Initialize ldomain data type - if (masterproc) then - write(iulog,*) 'Attempting to read ldomain from ',trim(fatmlndfrc) - endif - call surfrd_get_grid(begg, endg, ldomain, fatmlndfrc) - if (masterproc) then - call domain_check(ldomain) - endif - ldomain%mask = 1 !!! TODO - is this needed? - - end subroutine lnd_set_decomp_and_domain_from_surfrd - - !==================================================================================== - subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, rc) + subroutine lnd_set_decomp_and_domain_from_meshinfo(model_meshfile, mesh_ctsm, ni, nj, rc) use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D use domainMod , only : ldomain, domain_init, lon1d, lat1d - use decompMod , only : bounds_type, get_proc_bounds + use decompMod , only : ldecomp, bounds_type, get_proc_bounds use clm_varpar , only : nlevsoi - use clm_varctl , only : use_soil_moisture_streams, single_column + use clm_varctl , only : fatmlndfrc, fsurdat, use_soil_moisture_streams, single_column use clm_varcon , only : re - use lnd_comp_shr , only : mesh, model_meshfile, model_clock + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen + use abortutils , only : endrun + use shr_log_mod , only : errMsg => shr_log_errMsg + use fileutils , only : getfil ! input/output variables - type(ESMF_GridComp) , intent(inout) :: gcomp - type(ESMF_Mesh) , intent(out) :: mesh + character(len=*) , intent(in) :: model_meshfile + type(ESMF_Mesh) , intent(out) :: mesh_ctsm + integer , intent(out) :: ni,nj ! global sizes of dimensions integer , intent(out) :: rc ! local variables type(ESMF_VM) :: vm - type(ESMF_Mesh) :: mesh_lnd - type(ESMF_Mesh) :: mesh_ocn - type(ESMF_RouteHandle) :: rhandle_ocn2lnd - type(ESMF_DistGrid) :: distgrid_mesh - type(ESMF_DistGrid) :: distgrid_lnd + type(ESMF_Mesh) :: mesh_input + type(ESMF_DistGrid) :: distgrid_ctsm + type(ESMF_DistGrid) :: distgrid_input character(CL) :: cvalue ! config data integer :: nlnd, nocn ! local size ofarrays integer :: g,n ! indices type(bounds_type) :: bounds ! bounds integer :: begg,endg - character(CL) :: meshfile_ocn integer , pointer :: gindex_lnd(:) ! global index space for just land points integer , pointer :: gindex_ocn(:) ! global index space for just ocean points integer , pointer :: gindex(:) ! global index space for land and ocean points + integer , pointer :: gindex_temp(:) ! temporary global index space integer , pointer :: mask(:) ! local land/ocean mask integer , pointer :: lndmask_loc(:) real(r8) , pointer :: lndfrac_loc(:) - real(r8) , pointer :: lndarea_loc(:) integer , pointer :: lndmask_glob(:) real(r8) , pointer :: lndfrac_glob(:) - real(r8) , pointer :: lndarea_glob(:) real(r8) , pointer :: lndlats_glob(:) real(r8) , pointer :: lndlons_glob(:) real(r8) , pointer :: rtemp_glob(:) integer , pointer :: itemp_glob(:) real(r8) , pointer :: dataptr1d(:) - integer :: srcMaskValue = 0 - integer :: dstMaskValue = -987987 ! spval for RH mask values - integer :: srcTermProcessing_Value = 0 - logical :: checkflag = .false. - real(r8) :: fminval = 0.001_r8 - real(r8) :: fmaxval = 1._r8 integer :: lsize,gsize logical :: isgrid2d + integer :: numownedelements real(R8) , pointer :: ownedElemCoords(:) integer :: spatialDim type(ESMF_Field) :: areaField + type(ESMF_Array) :: elemMaskArray + character(len=CL) :: locfn + type(file_desc_t) :: ncid ! netcdf file id + integer :: dimid ! netCDF dimension id + logical :: readvar ! read variable in or not !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! determine global 2d sizes - call NUOPC_CompAttributeGet(gcomp, name='lnd_ni', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) ni - call NUOPC_CompAttributeGet(gcomp, name='lnd_nj', value=cvalue, rc=rc) + ! Get current vm + call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) nj + + ! Determine global 2d sizes from read of dimensions of surface dataset + if (masterproc) then + write(iulog,*) 'Attempting to global dimensions from surface dataset' + if (fsurdat == ' ') then + write(iulog,*)'fsurdat must be specified' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + endif + call getfil(fsurdat, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') + call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') + call ncd_pio_closefile(ncid) gsize = ni*nj if (single_column) then isgrid2d = .true. @@ -175,50 +117,82 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, rc) end if ! read in the land mesh from the file - mesh_lnd = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + mesh_input = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then write(iulog,'(a)')'land mesh file ',trim(model_meshfile) end if - ! read in ocn mask meshfile - call NUOPC_CompAttributeGet(gcomp, name='mesh_ocnmask', value=meshfile_ocn, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - mesh_ocn = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) + ! Obtain global land amsk + if (trim(fatmlndfrc) /= 'null') then + if (masterproc) then + write(iulog,*) 'Generating ctsm decomposition from ',trim(fatmlndfrc) + endif + else + if (masterproc) then + write(iulog,*) 'Generating ctsm decomposition from ',trim(model_meshfile) + endif end if - ! obtain land mask from land mesh file - assume that land frac is identical to land mask - call clm_getlandmask_from_lndmesh(mesh_lnd, lsize, lndmask_loc, landfrac_loc, distgrid_lnd, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(lndmask_glob(ni*nj)); lndmask_glob(:) = 0 + allocate(rtemp_glob(gsize)) + + if (trim(fatmlndfrc) /= 'null') then - ! determine global landmask_glob - needed to determine the ctsm decomposition - ! land frac, lats, lons and areas will be done below - allocate(gindex(lsize)) - call ESMF_DistGridGet(distgrid_lnd, 0, seqIndexList=gindex, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 - do n = 1,lsize - lndmask_glob(gindex(n)) = lndmask_loc(n) - end do - allocate(itemp_glob(gsize)) - call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndmask_glob(:) = int(itemp_glob(:)) - deallocate(itemp_glob) - call ESMF_DistGridDestroy(distgrid_lnd) + ! Read in global land mask and land fraction from fatmlndfrc + call getfil( trim(fatmlndfrc), locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + call ncd_io(ncid=ncid, varname='mask', data=lndmask_glob, flag='read', readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: variable mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + allocate(lndfrac_glob(ni*nj)); lndfrac_glob(:) = 0._r8 + call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + call ncd_pio_closefile(ncid) + + else + + ! Obtain land mask from land mesh file - ASSUME THAT LAND FRAC IS IDENTICAL TO LAND MASK + call ESMF_MeshGet(mesh_input, elementdistGrid=distgrid_input, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_DistGridGet(distgrid_input, localDe=0, elementCount=lsize, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine lndmask_loc + allocate(lndmask_loc(lsize)) + elemMaskArray = ESMF_ArrayCreate(distgrid_input, lndmask_loc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! The following calls fills in the values of lndmask_loc + call ESMF_MeshGet(mesh_input, elemMaskArray=elemMaskArray, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine lndfrac_loc + ! ASSUME that land fraction is identical to land mask in this case + allocate(lndfrac_loc(lsize)) + lndfrac_loc(:) = lndmask_loc(:) + + ! determine global landmask_glob - needed to determine the ctsm decomposition + ! land frac, lats, lons and areas will be done below + allocate(gindex_temp(lsize)) + call ESMF_DistGridGet(distgrid_input, 0, seqIndexList=gindex_temp, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 + do n = 1,lsize + lndmask_glob(gindex(n)) = lndmask_loc(n) + end do + allocate(itemp_glob(gsize)) + call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndmask_glob(:) = int(itemp_glob(:)) + deallocate(itemp_glob) + + end if - ! determine lnd decomposition that will be used by ctsm + ! Determine lnd decomposition that will be used by ctsm call decompInit_lnd(lni=ni, lnj=nj, amask=lndmask_glob) if (use_soil_moisture_streams) then call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) end if - ! Determine ocn decomposition that will be used to create the full mesh - ! note that the memory for gindex_ocn will be allocated in the following call - call decompInit_ocn(ni=ni, nj=nj, amask=lndmask_glob, gindex_ocn=gindex_ocn) - ! *** Get JUST gridcell processor bounds *** ! Remaining bounds (landunits, columns, patches) will be set after calling decompInit_glcp ! so get_proc_bounds is called twice and the gridcell information is just filled in twice @@ -234,74 +208,10 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, rc) gindex_lnd(n) = ldecomp%gdc2glo(g) end do - ! Initialize domain data structure - call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - - ! Determine ldomain%mask - do g = begg, endg - n = 1 + (g - begg) - ldomain%mask(g) = lndmask_glob(gindex_lnd(n)) - end do - deallocate(lndmask_glob) - - ! Determine ldomain%frac - allocate(rtemp_glob(gsize)) - allocate(lndfrac_glob(gsize)) - lndfrac_glob(:) = 0._r8 - do n = 1,lsize - lndfrac_glob(gindex(n)) = lndfrac_loc(n) - end do - call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndfrac_glob(:) = rtemp_glob(:) - do g = begg, endg - ldomain%frac(g) = lndfrac_glob(gindex_lnd(g-begg+1)) - end do - deallocate(lndfrac_glob) - - ! Get ownedElemCords from the mesh to be used to obtain ldoman%latc and ldomain%lonc - call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, rc=rc) - allocate(ownedElemCoords(spatialDim*lsize)) - call ESMF_MeshGet(mesh_lnd, ownedElemCoords=ownedElemCoords) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Determine ldomain%latc and lat1d - allocate(lndlats_glob(gsize)) - lndlats_glob(:) = 0._r8 - do n = 1,lsize - lndlats_glob(gindex(n)) = ownedElemCoords(2*n) - end do - call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndlats_glob(:) = rtemp_glob(:) - do g = begg, endg - ldomain%latc(g) = lndlats_glob(gindex_lnd(g-begg+1)) - end do - if (isgrid2d) then - allocate(lat1d(nj)) - do n = 1,nj - lat1d(n) = lndlats_glob((n-1)*ni + 1) - end do - end if - deallocate(lndlats_glob) - - ! Determine ldomain%lonc and lon1d - allocate(lndlons_glob(gsize)) - lndlons_glob(:) = 0._r8 - do n = 1,lsize - lndlons_glob(gindex(n)) = ownedElemCoords(2*n-1) - end do - call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndlons_glob(:) = rtemp_glob(:) - do g = begg, endg - ldomain%lonc(g) = lndlats_glob(gindex_lnd(g-begg+1)) - end do - if (isgrid2d) then - allocate(lon1d(ni)) - do n = 1,ni - lon1d(n) = lndlons_glob(n) - end do - end if - deallocate(lndlons_glob) - deallocate(rtemp_glob) + ! Create gindex_ocn + ! Need this decomposition to create the full mesh + ! Note that the memory for gindex_ocn will be allocated in the following call + call decompInit_ocn(ni=ni, nj=nj, amask=lndmask_glob, gindex_ocn=gindex_ocn) ! Create a global index that includes both land and ocean points nocn = size(gindex_ocn) @@ -314,15 +224,62 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, rc) end if end do - ! Generate a new mesh on the gindex decomposition - distGrid_mesh = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) + ! Generate a new distgrid based on gindex + distgrid_ctsm = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - deallocate(gindex) - mesh = ESMF_MeshCreate(mesh_lnd, elementDistGrid=distgrid_mesh, rc=rc) + + ! Generate the ctsm mesh on the gindex decomposition + mesh_ctsm = ESMF_MeshCreate(mesh_input, elementDistGrid=distgrid_ctsm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Create ldomain%area by querying the mesh on the ctsm decomposition - areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + ! Initialize domain data structure + call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + + ! Determine ldomain%mask + do g = begg, endg + n = gindex(g-begg+1) + ldomain%mask(g) = lndmask_glob(n) + end do + deallocate(lndmask_glob) + + ! Determine ldomain%frac + ! note that lndfrac_glob was read in from fatmlndfrc above if it was not set to null + if (trim(fatmlndfrc) == 'null') then + allocate(lndfrac_glob(gsize)) + do n = 1,nlnd + lndfrac_glob(gindex_lnd(n)) = lndfrac_loc(n) + end do + call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + do g = begg, endg + n = gindex(g-begg+1) + ldomain%frac(g) = rtemp_glob(n) + end do + deallocate(lndfrac_glob) + else + do g = begg, endg + n = gindex(g-begg+1) + ldomain%frac(g) = lndfrac_glob(n) + end do + deallocate(lndfrac_glob) + end if + + ! Determine ldoman%latc and ldomain%lonc + call ESMF_MeshGet(mesh_ctsm, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(ownedElemCoords(spatialDim*numownedelements)) + call ESMF_MeshGet(mesh_ctsm, ownedElemCoords=ownedElemCoords) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(mesh_ctsm, ownedElemCoords=ownedElemCoords, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg,endg + n = g - begg + 1 + ldomain%lonc(g) = ownedElemCoords(2*n-1) + if (ldomain%lonc(g) == 360._r8) ldomain%lonc(g) = 0._r8 ! TODO: why the difference? + ldomain%latc(g) = ownedElemCoords(2*n) + end do + + ! Determine ldomain%area by querying the mesh on the ctsm decomposition + areaField = ESMF_FieldCreate(mesh_ctsm, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldRegridGetArea(areaField, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -333,45 +290,44 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, rc) end do call ESMF_FieldDestroy(areaField) - end subroutine lnd_set_decomp_and_domain_from_inputmesh - - !=============================================================================== - subroutine clm_getlandmask_from_lndmesh(mesh_lnd, lndmask_loc, lndfrac_loc, lsize, distgrid_lnd, rc) - - ! input/out variables - type(ESMF_Mesh) , intent(in) :: mesh_lnd - integer , pointer :: lndmask_loc(:) - real(r8) , pointer :: lndfrac_loc(:) - integer , intent(out) :: lsize - type(ESMF_DistGrid) , intent(out) :: distgrid_lnd - integer , intent(out) :: rc - - ! local variables: - type(ESMF_Array) :: elemMaskArray - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! Determine lsize and distgrid_lnd - call ESMF_MeshGet(mesh_lnd, elementdistGrid=distgrid_lnd, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_DistGridGet(distgrid_lnd, localDe=0, elementCount=lsize, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! If grid is 2d, determine lon1d and lat1d + if (isgrid2d) then + ! Determine lon1d + allocate(lndlons_glob(gsize)) + lndlons_glob(:) = 0._r8 + do n = 1,numownedelements + if (ownedElemCoords(2*n-1) == 360._r8) then ! TODO: why is this needed? + lndlons_glob(gindex(n)) = 0._r8 + else + lndlons_glob(gindex(n)) = ownedElemCoords(2*n-1) + end if + end do + call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + deallocate(lndlons_glob) + allocate(lon1d(ni)) + do n = 1,ni + lon1d(n) = rtemp_glob(n) + end do - ! Determine lndfrac_loc - allocate(lndmask_loc(lsize)) - elemMaskArray = ESMF_ArrayCreate(distgrid_lnd, lndmask_loc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! The following calls fills in the values of lndmask_loc - call ESMF_MeshGet(mesh_lnd elemMaskArray=elemMaskArray, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Determine lat1d + allocate(lndlats_glob(gsize)) + lndlats_glob(:) = 0._r8 + do n = 1,numownedelements + lndlats_glob(gindex(n)) = ownedElemCoords(2*n) + end do + call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + deallocate(lndlats_glob) + allocate(lat1d(nj)) + do n = 1,nj + lat1d(n) = rtemp_glob((n-1)*ni + 1) + end do + end if - ! Determine lndmask_loc - ! ASSUME that land fraction is identical to land mask in this case - allocate(lndfrac_loc(lsize)) - lndfrac_loc(:) = lndmask_loc(:) + deallocate(ownedElemCoords) + deallocate(rtemp_glob) + deallocate(gindex) - end subroutine clm_getlandmask_from_lndmesh + end subroutine lnd_set_decomp_and_domain_from_meshinfo !=============================================================================== logical function chkerr(rc, line, file) @@ -386,211 +342,4 @@ logical function chkerr(rc, line, file) endif end function chkerr - !=============================================================================== - subroutine surfrd_get_globmask(filename, mask, ni, nj) - ! - ! !DESCRIPTION: - ! Read the surface dataset grid related information: - ! This is the first routine called by clm_initialize - ! NO DOMAIN DECOMPOSITION HAS BEEN SET YET - ! - ! !USES: - use fileutils , only : getfil - use ncdio_pio , only : ncd_io, ncd_pio_openfile, ncd_pio_closefile, ncd_inqfdims, file_desc_t - use abortutils , only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: filename ! grid filename - integer , pointer :: mask(:) ! grid mask - integer , intent(out) :: ni, nj ! global grid sizes - ! - ! !LOCAL VARIABLES: - logical :: isgrid2d - integer :: dimid,varid ! netCDF id's - integer :: ns ! size of grid on file - integer :: n,i,j ! index - integer :: ier ! error status - type(file_desc_t) :: ncid ! netcdf id - character(len=256) :: varname ! variable name - character(len=256) :: locfn ! local file name - logical :: readvar ! read variable in or not - integer , allocatable :: idata2d(:,:) - character(len=32) :: subname = 'surfrd_get_globmask' ! subroutine name - !----------------------------------------------------------------------- - - if (filename == ' ') then - mask(:) = 1 - else - ! Check if file exists - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end if - - ! Open file - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Determine dimensions and if grid file is 2d or 1d - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - if (masterproc) then - write(iulog,*)'lat/lon grid flag (isgrid2d) is ',isgrid2d - end if - allocate(mask(ns)) - mask(:) = 1 - if (isgrid2d) then - ! Grid is 2d - allocate(idata2d(ni,nj)) - idata2d(:,:) = 1 - call ncd_io(ncid=ncid, varname='LANDMASK', data=idata2d, flag='read', readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', data=idata2d, flag='read', readvar=readvar) - end if - if (readvar) then - do j = 1,nj - do i = 1,ni - n = (j-1)*ni + i - mask(n) = idata2d(i,j) - enddo - enddo - end if - deallocate(idata2d) - else - ! Grid is not 2d - call ncd_io(ncid=ncid, varname='LANDMASK', data=mask, flag='read', readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', data=mask, flag='read', readvar=readvar) - end if - end if - if (.not. readvar) call endrun( msg=' ERROR: landmask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - - ! Close file - call ncd_pio_closefile(ncid) - end if - - end subroutine surfrd_get_globmask - - !=============================================================================== - subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) - ! - ! !DESCRIPTION: - ! THIS IS CALLED AFTER THE DOMAIN DECOMPOSITION HAS BEEN CREATED - ! Read the surface dataset grid related information: - ! o real latitude of grid cell (degrees) - ! o real longitude of grid cell (degrees) - ! - ! !USES: - use clm_varcon , only : spval, re, grlnd - use domainMod , only : domain_type, domain_init, domain_clean, lon1d, lat1d - use fileutils , only : getfil - use abortutils , only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile - use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim_size, ncd_inqdid, ncd_inqdlen - use pio - ! - ! !ARGUMENTS: - integer , intent(in) :: begg, endg - type(domain_type) , intent(inout) :: ldomain ! domain to init - character(len=*) , intent(in) :: filename ! grid filename - character(len=*) ,optional , intent(in) :: glcfilename ! glc mask filename - ! - ! !LOCAL VARIABLES: - type(file_desc_t) :: ncid ! netcdf id - integer :: beg ! local beg index - integer :: end ! local end index - integer :: ni,nj,ns ! size of grid on file - integer :: dimid,varid ! netCDF id's - integer :: start(1), count(1) ! 1d lat/lon array sections - integer :: ier,ret ! error status - logical :: readvar ! true => variable is on input file - logical :: isgrid2d ! true => file is 2d lat/lon - logical :: istype_domain ! true => input file is of type domain - real(r8), allocatable :: rdata2d(:,:) ! temporary - character(len=16) :: vname ! temporary - character(len=256) :: locfn ! local file name - integer :: n ! indices - character(len=32) :: subname = 'surfrd_get_grid' ! subroutine name -!----------------------------------------------------------------------- - - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end if - - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Determine dimensions - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - - ! Determine isgrid2d flag for domain - call domain_init(ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - - ! Determine type of file - old style grid file or new style domain file - call check_var(ncid=ncid, varname='xc', readvar=readvar) - if (readvar)then - istype_domain = .true. - else - istype_domain = .false. - end if - - ! Read in area, lon, lat - if (istype_domain) then - call ncd_io(ncid=ncid, varname= 'area', flag='read', data=ldomain%area, & - dim1name=grlnd, readvar=readvar) - ! convert from radians**2 to km**2 - ldomain%area = ldomain%area * (re**2) - if (.not. readvar) call endrun( msg=' ERROR: area NOT on file'//errMsg(sourcefile, __LINE__)) - call ncd_io(ncid=ncid, varname= 'xc', flag='read', data=ldomain%lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: xc NOT on file'//errMsg(sourcefile, __LINE__)) - call ncd_io(ncid=ncid, varname= 'yc', flag='read', data=ldomain%latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: yc NOT on file'//errMsg(sourcefile, __LINE__)) - else - call endrun( msg=" ERROR: can no longer read non domain files" ) - end if - - if (isgrid2d) then - allocate(rdata2d(ni,nj), lon1d(ni), lat1d(nj)) - if (istype_domain) vname = 'xc' - call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) - lon1d(:) = rdata2d(:,1) - if (istype_domain) vname = 'yc' - call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) - lat1d(:) = rdata2d(1,:) - deallocate(rdata2d) - end if - - ! Check lat limited to -90,90 - if (minval(ldomain%latc) < -90.0_r8 .or. & - maxval(ldomain%latc) > 90.0_r8) then - write(iulog,*) trim(subname),' WARNING: lat/lon min/max is ', & - minval(ldomain%latc),maxval(ldomain%latc) - endif - if ( any(ldomain%lonc < 0.0_r8) )then - call endrun( msg=' ERROR: lonc is negative (see https://github.com/ESCOMP/ctsm/issues/507)' & - //errMsg(sourcefile, __LINE__)) - endif - call ncd_io(ncid=ncid, varname='mask', flag='read', data=ldomain%mask, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: LANDMASK NOT on fracdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='frac', flag='read', data=ldomain%frac, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: LANDFRAC NOT on fracdata file'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_pio_closefile(ncid) - - end subroutine surfrd_get_grid - end module lnd_set_decomp_and_domain diff --git a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 index de65fa9b58..ca91bf4ce5 100644 --- a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 @@ -60,10 +60,8 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) integer , pointer :: mask(:) ! local land/ocean mask integer , pointer :: lndmask_loc(:) real(r8) , pointer :: lndfrac_loc(:) - real(r8) , pointer :: lndarea_loc(:) integer , pointer :: lndmask_glob(:) real(r8) , pointer :: lndfrac_glob(:) - real(r8) , pointer :: lndarea_glob(:) real(r8) , pointer :: lndlats_glob(:) real(r8) , pointer :: lndlons_glob(:) real(r8) , pointer :: rtemp_glob(:) From 36b3f33611c9c146006f0f20774d415a93634132 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 27 Dec 2020 12:14:55 -0700 Subject: [PATCH 1730/1973] merged intialize2 and initialize3 into initialize2 - so back to two phase intialization and move call go single column init to the caps --- src/cpl/lilac/lnd_comp_esmf.F90 | 5 +- src/cpl/mct/lnd_comp_mct.F90 | 5 +- src/cpl/mct/lnd_set_decomp_and_domain.F90 | 66 ++--- src/cpl/nuopc/lnd_comp_nuopc.F90 | 4 +- src/cpl/nuopc/lnd_import_export.F90 | 66 +++-- src/main/clm_initializeMod.F90 | 291 +++++++--------------- 6 files changed, 160 insertions(+), 277 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index d04aa66d9a..a0e1cdec22 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -35,7 +35,7 @@ module lnd_comp_esmf use clm_time_manager , only : set_nextsw_cday, update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size use clm_time_manager , only : get_curr_date, get_curr_calday - use clm_initializeMod , only : initialize1, initialize2, initialize3 + use clm_initializeMod , only : initialize1, initialize2 use clm_driver , only : clm_drv use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_diagnose @@ -346,8 +346,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) ! Finish initializing ctsm !-------------------------------- call initialize2(ni,nj) - call initialize3() - call ESMF_LogWrite(subname//"ctsm initialize done...", ESMF_LOGMSG_INFO) + call ESMF_LogWrite(subname//"ctsm initialize2 done...", ESMF_LOGMSG_INFO) !-------------------------------- ! Create import state (only assume input from atm - not rof and glc) diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index afd948941f..21745d0ce6 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -42,7 +42,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) use shr_kind_mod , only : shr_kind_cl use abortutils , only : endrun use clm_time_manager , only : get_nstep, set_timemgr_init, set_nextsw_cday - use clm_initializeMod, only : initialize1, initialize2, initialize3 + use clm_initializeMod, only : initialize1, initialize2 use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog use clm_varctl , only : inst_index, inst_suffix, inst_name @@ -156,7 +156,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) ! Initialize clm ! initialize1 reads namelists ! decomp and domain are set in lnd_set_decomp_and_domain_from_surfrd - ! initialize2 and initialize3 perform rest of initialization + ! initialize2 performs the rest of initialization call seq_timemgr_EClockGetData(EClock, & start_ymd=start_ymd, & start_tod=start_tod, ref_ymd=ref_ymd, & @@ -227,7 +227,6 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) ! Finish initializing clm call initialize2(ni,nj) - call initialize3() ! Create land export state call lnd_export(bounds, water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) diff --git a/src/cpl/mct/lnd_set_decomp_and_domain.F90 b/src/cpl/mct/lnd_set_decomp_and_domain.F90 index 6b343875c7..1b8edece43 100644 --- a/src/cpl/mct/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/mct/lnd_set_decomp_and_domain.F90 @@ -71,7 +71,7 @@ subroutine lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) ! Remaining bounds (landunits, columns, patches) will be determined ! after the call to decompInit_glcp - so get_proc_bounds is called ! twice and the gridcell information is just filled in twice - call get_proc_bounds(bounds) + call get_proc_bounds(bounds) ! Get grid cell bounds values begg = bounds%begg @@ -91,24 +91,21 @@ end subroutine lnd_set_decomp_and_domain_from_surfrd !----------------------------------------------------------------------- subroutine surfrd_get_globmask(filename, mask, ni, nj) - ! - ! !DESCRIPTION: - ! Read the surface dataset grid related information: - ! This is the first routine called by clm_initialize - ! NO DOMAIN DECOMPOSITION HAS BEEN SET YET - ! - ! !USES: + + ! Read the surface dataset grid related information + ! This is used to set the domain decomposition - so global data is read here + use fileutils , only : getfil use ncdio_pio , only : ncd_io, ncd_pio_openfile, ncd_pio_closefile, ncd_inqfdims, file_desc_t use abortutils , only : endrun use shr_log_mod, only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: + + ! input/output variables character(len=*), intent(in) :: filename ! grid filename integer , pointer :: mask(:) ! grid mask integer , intent(out) :: ni, nj ! global grid sizes - ! - ! !LOCAL VARIABLES: + + ! local variables logical :: isgrid2d integer :: dimid,varid ! netCDF id's integer :: ns ! size of grid on file @@ -178,30 +175,30 @@ end subroutine surfrd_get_globmask !----------------------------------------------------------------------- subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) - ! - ! !DESCRIPTION: - ! THIS IS CALLED AFTER THE DOMAIN DECOMPOSITION HAS BEEN CREATED + ! Read the surface dataset grid related information: - ! o real latitude of grid cell (degrees) - ! o real longitude of grid cell (degrees) - ! - ! !USES: - use clm_varcon , only : spval, re, grlnd - use domainMod , only : domain_type, domain_init, domain_clean, lon1d, lat1d - use fileutils , only : getfil - use abortutils , only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile - use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim_size, ncd_inqdid, ncd_inqdlen + ! This is called after the domain decomposition has been created + ! - real latitude of grid cell (degrees) + ! - real longitude of grid cell (degrees) + + use clm_varcon , only : spval, re, grlnd + use domainMod , only : domain_type, domain_init, domain_clean, lon1d, lat1d + use fileutils , only : getfil + use abortutils , only : endrun + use shr_log_mod , only : errMsg => shr_log_errMsg + use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile + use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim_size, ncd_inqdid, ncd_inqdlen + use clm_varctl , only : single_column, scmlat, scmlon + use shr_scam_mod , only : shr_scam_getCloseLatLon use pio - ! - ! !ARGUMENTS: + + ! input/output variables integer , intent(in) :: begg, endg type(domain_type) , intent(inout) :: ldomain ! domain to init character(len=*) , intent(in) :: filename ! grid filename character(len=*) ,optional , intent(in) :: glcfilename ! glc mask filename - ! - ! !LOCAL VARIABLES: + + ! local variables type(file_desc_t) :: ncid ! netcdf id integer :: beg ! local beg index integer :: end ! local end index @@ -216,6 +213,10 @@ subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) character(len=16) :: vname ! temporary character(len=256) :: locfn ! local file name integer :: n ! indices + integer :: closelatidx + integer :: closelonidx + real(r8) :: closelat + real(r8) :: closelon character(len=32) :: subname = 'surfrd_get_grid' ! subroutine name !----------------------------------------------------------------------- @@ -292,6 +293,11 @@ subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) call endrun( msg=' ERROR: LANDFRAC NOT on fracdata file'//errMsg(sourcefile, __LINE__)) end if + if (single_column) then + call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & + closelat, closelon, closelatidx, closelonidx) + end if + call ncd_pio_closefile(ncid) end subroutine surfrd_get_grid diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 461e99205e..b6bec64684 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -29,7 +29,7 @@ module lnd_comp_nuopc use clm_time_manager , only : set_nextsw_cday, update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size use clm_time_manager , only : get_curr_date, get_curr_calday - use clm_initializeMod , only : initialize1, initialize2, initialize3 + use clm_initializeMod , only : initialize1, initialize2 use nuopc_shr_methods , only : chkerr, state_setscalar, state_getscalar, state_diagnose, alarmInit use nuopc_shr_methods , only : set_component_logging, get_component_instance, log_clock_advance use lnd_import_export , only : advertise_fields, realize_fields, import_fields, export_fields @@ -561,9 +561,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! if ( noland ) then ! call shr_sys_abort(trim(subname)//"ERROR: Currently cannot handle case of single column with non-land") ! end if - call initialize2(ni, nj) - call initialize3() !-------------------------------- ! Create land export state diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 622e3acca9..508e51ce9d 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -1,30 +1,27 @@ module lnd_import_export - use ESMF , only : ESMF_GridComp, ESMF_State, ESMF_Mesh, ESMF_StateGet - use ESMF , only : ESMF_KIND_R8, ESMF_SUCCESS, ESMF_MAXSTR, ESMF_LOGMSG_INFO - use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_ERROR, ESMF_LogFoundError - use ESMF , only : ESMF_STATEITEM_NOTFOUND, ESMF_StateItem_Flag - use ESMF , only : operator(/=), operator(==) - use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise, NUOPC_IsConnected - use NUOPC_Model , only : NUOPC_ModelGet - use shr_kind_mod , only : r8 => shr_kind_r8, cx=>shr_kind_cx, cxx=>shr_kind_cxx, cs=>shr_kind_cs - use shr_sys_mod , only : shr_sys_abort - use clm_varctl , only : iulog - use clm_time_manager , only : get_nstep - use decompmod , only : bounds_type, get_proc_bounds - use lnd2atmType , only : lnd2atm_type - use lnd2glcMod , only : lnd2glc_type - use atm2lndType , only : atm2lnd_type - use glc2lndMod , only : glc2lnd_type - use domainMod , only : ldomain - use spmdMod , only : masterproc - use seq_drydep_mod , only : seq_drydep_readnl, n_drydep - use shr_megan_mod , only : shr_megan_readnl, shr_megan_mechcomps_n - use shr_fire_emis_mod , only : shr_fire_emis_readnl - use shr_carma_mod , only : shr_carma_readnl - use shr_ndep_mod , only : shr_ndep_readnl - use nuopc_shr_methods , only : chkerr - use lnd_import_export_utils, only : derive_quantities, check_for_errors, check_for_nans + use ESMF , only : ESMF_GridComp, ESMF_State, ESMF_Mesh, ESMF_StateGet + use ESMF , only : ESMF_KIND_R8, ESMF_SUCCESS, ESMF_MAXSTR, ESMF_LOGMSG_INFO + use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_ERROR, ESMF_LogFoundError + use ESMF , only : ESMF_STATEITEM_NOTFOUND, ESMF_StateItem_Flag + use ESMF , only : operator(/=), operator(==) + use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_Advertise, NUOPC_IsConnected + use NUOPC_Model , only : NUOPC_ModelGet + use shr_kind_mod , only : r8 => shr_kind_r8, cx=>shr_kind_cx, cxx=>shr_kind_cxx, cs=>shr_kind_cs + use shr_sys_mod , only : shr_sys_abort + use clm_varctl , only : iulog + use clm_time_manager , only : get_nstep + use decompmod , only : bounds_type, get_proc_bounds + use lnd2atmType , only : lnd2atm_type + use lnd2glcMod , only : lnd2glc_type + use atm2lndType , only : atm2lnd_type + use glc2lndMod , only : glc2lnd_type + use domainMod , only : ldomain + use spmdMod , only : masterproc + use seq_drydep_mod , only : seq_drydep_readnl, n_drydep + use shr_megan_mod , only : shr_megan_readnl, shr_megan_mechcomps_n + use nuopc_shr_methods , only : chkerr + use lnd_import_export_utils , only : check_for_errors, check_for_nans implicit none private ! except @@ -150,7 +147,10 @@ module lnd_import_export subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, atm_prognostic, rc) - use clm_varctl, only : ndep_from_cpl + use shr_carma_mod , only : shr_carma_readnl + use shr_ndep_mod , only : shr_ndep_readnl + use shr_fire_emis_mod , only : shr_fire_emis_readnl + use clm_varctl , only : ndep_from_cpl ! input/output variables type(ESMF_GridComp) :: gcomp @@ -183,9 +183,6 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r else send_to_atm = .false. end if - !DEBUG: - send_to_atm = .true. - !DEBUG call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -437,11 +434,12 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & ! Convert the input data from the mediator to the land model !--------------------------------------------------------------------------- - use clm_varctl , only: co2_type, co2_ppmv, use_c13, ndep_from_cpl - use clm_varcon , only: rair, o2_molar_const, c13ratio - use shr_const_mod , only: SHR_CONST_TKFRZ - use Wateratm2lndBulkType , only: wateratm2lndbulk_type - use QSatMod , only: QSat + use clm_varctl , only: co2_type, co2_ppmv, use_c13, ndep_from_cpl + use clm_varcon , only: rair, o2_molar_const, c13ratio + use shr_const_mod , only: SHR_CONST_TKFRZ + use Wateratm2lndBulkType , only: wateratm2lndbulk_type + use QSatMod , only: QSat + use lnd_import_export_utils , only: derive_quantities, check_for_errors ! input/output variabes type(ESMF_GridComp) :: gcomp diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 86aae3f5a0..f2e07696f9 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -31,13 +31,12 @@ module clm_initializeMod use SelfTestDriver , only : self_test_driver use SoilMoistureStreamMod , only : PrescribedSoilMoistureInit use clm_instMod - ! + ! implicit none private ! By default everything is private ! public :: initialize1 ! Phase one initialization public :: initialize2 ! Phase two initialization - public :: initialize3 ! Phase two initialization integer :: actual_numcft ! numcft from sfc dataset @@ -110,31 +109,84 @@ subroutine initialize2(ni,nj) ! ! !DESCRIPTION: ! CLM initialization second phase - ! Determine clm gridcell decomposition and processor bounds for gridcells ! ! !USES: - use clm_varpar , only: natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec - use landunit_varcon , only: landunit_varcon_init, max_lunit - use clm_varctl , only: fsurdat - use pftconMod , only: pftcon - use decompInitMod , only: decompInit_clumps, decompInit_glcp - use domainMod , only: domain_check, ldomain, domain_init - use surfrdMod , only: surfrd_get_data - use controlMod , only: NLFilename - use initGridCellsMod , only: initGridCells - use ch4varcon , only: ch4conrd - use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp + use clm_varcon , only : spval + use clm_varpar , only : natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec + use clm_varpar , only : nlevsno + use clm_varctl , only : fsurdat + use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat + use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn, use_fates + use clm_varctl , only : use_crop, ndep_from_cpl + use clm_varorb , only : eccen, mvelpp, lambm0, obliqr + use landunit_varcon , only : landunit_varcon_init, max_lunit + use pftconMod , only : pftcon + use decompInitMod , only : decompInit_clumps, decompInit_glcp + use domainMod , only : domain_check, ldomain, domain_init + use surfrdMod , only : surfrd_get_data + use controlMod , only : NLFilename + use initGridCellsMod , only : initGridCells + use ch4varcon , only : ch4conrd + use UrbanParamsType , only : UrbanInput, IsSimpleBuildTemp + use shr_orb_mod , only : shr_orb_decl + use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND + use accumulMod , only : print_accum_fields + use clm_time_manager , only : get_step_size_real, get_curr_calday + use clm_time_manager , only : get_curr_date, get_nstep, advance_timestep + use clm_time_manager , only : timemgr_init, timemgr_restart_io, timemgr_restart, is_restart + use CIsoAtmTimeseriesMod , only : C14_init_BombSpike, use_c14_bombspike, C13_init_TimeSeries, use_c13_timeseries + use DaylengthMod , only : InitDaylength + use dynSubgridDriverMod , only : dynSubgrid_init + use dynConsBiogeophysMod , only : dyn_hwcontent_set_baselines + use fileutils , only : getfil + use initInterpMod , only : initInterp + use subgridWeightsMod , only : init_subgrid_weights_mod + use histFileMod , only : hist_htapes_build, htapes_fieldlist, hist_printflds + use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal + use restFileMod , only : restFile_getfile, restFile_open, restFile_close + use restFileMod , only : restFile_read, restFile_write + use ndepStreamMod , only : ndep_init, ndep_interp + use LakeCon , only : LakeConInit + use SatellitePhenologyMod , only : SatellitePhenologyInit, readAnnualVegetation, interpMonthlyVeg + use SnowSnicarMod , only : SnowAge_init, SnowOptics_init + use lnd2atmMod , only : lnd2atm_minimal + use controlMod , only : NLFilename + use clm_instMod , only : clm_fates + use BalanceCheckMod , only : BalanceCheckInit + use NutrientCompetitionFactoryMod , only : create_nutrient_competition_method ! ! !ARGUMENTS integer, intent(in) :: ni, nj ! global grid sizes ! ! !LOCAL VARIABLES: - integer :: i,j,n,k,c,l,g ! indices - integer :: begg, endg ! processor bounds - type(bounds_type) :: bounds_proc - type(bounds_type) :: bounds_clump - integer :: nclumps ! number of clumps on this processor - integer :: nc ! clump index + integer :: c,g,i,j,k,l,n,p ! indices + integer :: yr ! current year (0, ...) + integer :: mon ! current month (1 -> 12) + integer :: day ! current day (1 -> 31) + integer :: ncsec ! current time of day [seconds] + character(len=256) :: fnamer ! name of netcdf restart file + character(len=256) :: pnamer ! full pathname of netcdf restart file + character(len=256) :: locfn ! local file name + type(file_desc_t) :: ncid ! netcdf id + real(r8) :: dtime ! time step increment (sec) + integer :: nstep ! model time step + real(r8) :: calday ! calendar day for nstep + real(r8) :: caldaym1 ! calendar day for nstep-1 + real(r8) :: declin ! solar declination angle in radians for nstep + real(r8) :: declinm1 ! solar declination angle in radians for nstep-1 + real(r8) :: eccf ! earth orbit eccentricity factor + type(bounds_type) :: bounds_proc ! processor bounds + type(bounds_type) :: bounds_clump ! clump bounds + integer :: nclumps ! number of clumps on this processor + integer :: nc ! clump index + logical :: lexist + logical :: reset_dynbal_baselines_all_columns + logical :: reset_dynbal_baselines_lake_columns + integer :: begg, endg + integer :: begp, endp + integer :: begc, endc + integer :: begl, endl + real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays character(len=32) :: subname = 'initialize2' ! subroutine name !----------------------------------------------------------------------- @@ -214,7 +266,6 @@ subroutine initialize2(ni,nj) end do !$OMP END PARALLEL DO - ! Set CH4 Model Parameters from namelist. ! Need to do before initTimeConst so that it knows whether to ! look for several optional parameters on surfdata file. @@ -230,109 +281,17 @@ subroutine initialize2(ni,nj) ! end of the run for error checking. deallocate (wt_lunit, wt_cft, wt_glc_mec, haslake) - call t_stopf('clm_init2') - - end subroutine initialize2 - - !----------------------------------------------------------------------- - subroutine initialize3( ) - ! - ! !DESCRIPTION: - ! CLM initialization - third phase - ! - ! !USES: - use shr_orb_mod , only : shr_orb_decl - use shr_scam_mod , only : shr_scam_getCloseLatLon - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - use accumulMod , only : print_accum_fields - use clm_varpar , only : nlevsno - use clm_varcon , only : spval - use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat - use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn, use_fates - use clm_varctl , only : use_crop, ndep_from_cpl - use clm_varorb , only : eccen, mvelpp, lambm0, obliqr - use clm_time_manager , only : get_step_size_real, get_curr_calday - use clm_time_manager , only : get_curr_date, get_nstep, advance_timestep - use clm_time_manager , only : timemgr_init, timemgr_restart_io, timemgr_restart, is_restart - use CIsoAtmTimeseriesMod , only : C14_init_BombSpike, use_c14_bombspike, C13_init_TimeSeries, use_c13_timeseries - use DaylengthMod , only : InitDaylength - use dynSubgridDriverMod , only : dynSubgrid_init - use dynConsBiogeophysMod , only : dyn_hwcontent_set_baselines - use fileutils , only : getfil - use initInterpMod , only : initInterp - use subgridWeightsMod , only : init_subgrid_weights_mod - use histFileMod , only : hist_htapes_build, htapes_fieldlist, hist_printflds - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal - use restFileMod , only : restFile_getfile, restFile_open, restFile_close - use restFileMod , only : restFile_read, restFile_write - use ndepStreamMod , only : ndep_init, ndep_interp - use LakeCon , only : LakeConInit - use SatellitePhenologyMod , only : SatellitePhenologyInit, readAnnualVegetation, interpMonthlyVeg - use SnowSnicarMod , only : SnowAge_init, SnowOptics_init - use lnd2atmMod , only : lnd2atm_minimal - use NutrientCompetitionFactoryMod, only : create_nutrient_competition_method - use controlMod , only : NLFilename - use clm_instMod , only : clm_fates - use BalanceCheckMod , only : BalanceCheckInit - ! - ! !ARGUMENTS - ! - ! !LOCAL VARIABLES: - integer :: c,i,j,k,l,p! indices - integer :: yr ! current year (0, ...) - integer :: mon ! current month (1 -> 12) - integer :: day ! current day (1 -> 31) - integer :: ncsec ! current time of day [seconds] - integer :: nc ! clump index - integer :: nclumps ! number of clumps on this processor - character(len=256) :: fnamer ! name of netcdf restart file - character(len=256) :: pnamer ! full pathname of netcdf restart file - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - real(r8) :: dtime ! time step increment (sec) - integer :: nstep ! model time step - real(r8) :: calday ! calendar day for nstep - real(r8) :: caldaym1 ! calendar day for nstep-1 - real(r8) :: declin ! solar declination angle in radians for nstep - real(r8) :: declinm1 ! solar declination angle in radians for nstep-1 - real(r8) :: eccf ! earth orbit eccentricity factor - type(bounds_type) :: bounds_proc ! processor bounds - type(bounds_type) :: bounds_clump ! clump bounds - logical :: lexist - integer :: closelatidx,closelonidx - real(r8) :: closelat,closelon - logical :: reset_dynbal_baselines_all_columns - logical :: reset_dynbal_baselines_lake_columns - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - character(len=32) :: subname = 'initialize3' - !---------------------------------------------------------------------- - - call t_startf('clm_init3') - - ! ------------------------------------------------------------------------ ! Determine processor bounds and clumps for this processor - ! ------------------------------------------------------------------------ - call get_proc_bounds(bounds_proc) nclumps = get_proc_clumps() - ! ------------------------------------------------------------------------ ! Read in parameters files - ! ------------------------------------------------------------------------ - call clm_instReadNML( NLFilename ) allocate(nutrient_competition_method, & source=create_nutrient_competition_method(bounds_proc)) - call readParameters(nutrient_competition_method, photosyns_inst) - ! ------------------------------------------------------------------------ ! Initialize time manager - ! ------------------------------------------------------------------------ - if (nsrest == nsrStartup) then call timemgr_init() else @@ -343,28 +302,20 @@ subroutine initialize3( ) call timemgr_restart() end if - ! ------------------------------------------------------------------------ ! Initialize daylength from the previous time step (needed so prev_dayl can be set correctly) - ! ------------------------------------------------------------------------ - call t_startf('init_orbd') - calday = get_curr_calday() call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr, declin, eccf ) - dtime = get_step_size_real() caldaym1 = get_curr_calday(offset=-int(dtime)) call shr_orb_decl( caldaym1, eccen, mvelpp, lambm0, obliqr, declinm1, eccf ) - call t_stopf('init_orbd') - call InitDaylength(bounds_proc, declin=declin, declinm1=declinm1, obliquity=obliqr) ! Initialize Balance checking (after time-manager) call BalanceCheckInit() ! History file variables - if (use_cn) then call hist_addfld1d (fname='DAYL', units='s', & avgflag='A', long_name='daylength', & @@ -375,13 +326,9 @@ subroutine initialize3( ) ptr_gcell=grc%prev_dayl, default='inactive') end if - ! ------------------------------------------------------------------------ ! Initialize component data structures - ! ------------------------------------------------------------------------ - ! Note: new logic is in place that sets all the history fields to spval so ! there is no guesswork in the initialization to nans of the allocated variables - ! First put in history calls for subgrid data structures - these cannot appear in the ! module for the subgrid data definition due to circular dependencies that are introduced @@ -402,47 +349,41 @@ subroutine initialize3( ) ptr_col=col%zii, default='inactive') ! If single-column determine closest latitude and longitude - - if (single_column) then - call getfil (fsurdat, locfn, 0) - call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - closelat, closelon, closelatidx, closelonidx) - end if + ! TODO: for mct this should use fatmlnd file - for nuopc should use esmf functionality for nearest neighbor, + ! for lilac not applicable + ! TODO: these values are never used - is scam even working for ctsm? + ! if (single_column) then + ! call getfil (fsurdat, locfn, 0) + ! call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & + ! closelat, closelon, closelatidx, closelonidx) + ! end if ! Initialize instances of all derived types as well as time constant variables call clm_instInit(bounds_proc) - ! Initialize SNICAR optical and aging parameters + ! Initialize SNICAR optical and aging parameters call SnowOptics_init( ) ! SNICAR optical parameters: call SnowAge_init( ) ! SNICAR aging parameters: + ! Print history field info to standard out call hist_printflds() - ! ------------------------------------------------------------------------ ! Initializate dynamic subgrid weights (for prescribed transient Patches, CNDV - ! and/or dynamic landunits); note that these will be overwritten in a - ! restart run - ! ------------------------------------------------------------------------ - + ! and/or dynamic landunits); note that these will be overwritten in a restart run call t_startf('init_dyn_subgrid') call init_subgrid_weights_mod(bounds_proc) call dynSubgrid_init(bounds_proc, glc_behavior, crop_inst) call t_stopf('init_dyn_subgrid') - ! ------------------------------------------------------------------------ ! Initialize baseline water and energy states needed for dynamic subgrid operation - ! ! This will be overwritten by the restart file, but needs to be done for a cold start ! case. - ! ! BACKWARDS_COMPATIBILITY(wjs, 2019-03-05) dyn_hwcontent_set_baselines is called again ! later in initialization if reset_dynbal_baselines is set. I think we could just have ! a single call in that location (adding some logic to also do the call if we're doing ! a cold start) once we can assume that all finidat files have the necessary restart ! fields on them. But for now, having the extra call here handles the case where the ! relevant restart fields are missing from an old finidat file. - ! ------------------------------------------------------------------------ - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) do nc = 1,nclumps call get_clump_bounds(nc, bounds_clump) @@ -459,10 +400,7 @@ subroutine initialize3( ) end do !$OMP END PARALLEL DO - ! ------------------------------------------------------------------------ ! Initialize modules (after time-manager initialization in most cases) - ! ------------------------------------------------------------------------ - if (use_cn) then call bgc_vegetation_inst%Init2(bounds_proc, NLFilename) @@ -482,31 +420,22 @@ subroutine initialize3( ) else call SatellitePhenologyInit(bounds_proc) end if - if (use_soil_moisture_streams) then + if (use_soil_moisture_streams) then call PrescribedSoilMoistureInit(bounds_proc) endif - ! ------------------------------------------------------------------------ ! On restart only - process the history namelist. - ! ------------------------------------------------------------------------ - ! Later the namelist from the restart file will be used. This allows basic ! checking to make sure you didn't try to change the history namelist on restart. - if (nsrest == nsrContinue ) then call htapes_fieldlist() end if - ! ------------------------------------------------------------------------ ! Read restart/initial info - ! ------------------------------------------------------------------------ - is_cold_start = .false. is_interpolated_start = .false. reset_dynbal_baselines_lake_columns = .false. - if (nsrest == nsrStartup) then - if (finidat == ' ') then if (finidat_interp_source == ' ') then is_cold_start = .true. @@ -527,9 +456,7 @@ subroutine initialize3( ) call restFile_read(bounds_proc, fnamer, glc_behavior, & reset_dynbal_baselines_lake_columns = reset_dynbal_baselines_lake_columns) end if - else if ((nsrest == nsrContinue) .or. (nsrest == nsrBranch)) then - if (masterproc) then write(iulog,*)'Reading restart file ',trim(fnamer) end if @@ -537,12 +464,8 @@ subroutine initialize3( ) reset_dynbal_baselines_lake_columns = reset_dynbal_baselines_lake_columns) end if - ! ------------------------------------------------------------------------ ! If appropriate, create interpolated initial conditions - ! ------------------------------------------------------------------------ - if (nsrest == nsrStartup .and. finidat_interp_source /= ' ') then - is_interpolated_start = .true. ! Check that finidat is not cold start - abort if it is @@ -566,16 +489,11 @@ subroutine initialize3( ) ! Reset finidat to now be finidat_interp_dest ! (to be compatible with routines still using finidat) finidat = trim(finidat_interp_dest) - end if - ! ------------------------------------------------------------------------ ! If requested, reset dynbal baselines - ! ! This needs to happen after reading the restart file (including after reading the ! interpolated restart file, if applicable). - ! ------------------------------------------------------------------------ - reset_dynbal_baselines_all_columns = get_reset_dynbal_baselines() if (nsrest == nsrBranch) then if (reset_dynbal_baselines_all_columns) then @@ -620,10 +538,7 @@ subroutine initialize3( ) end do !$OMP END PARALLEL DO - ! ------------------------------------------------------------------------ ! Initialize nitrogen deposition - ! ------------------------------------------------------------------------ - if (use_cn) then call t_startf('init_ndep') if (.not. ndep_from_cpl) then @@ -633,45 +548,31 @@ subroutine initialize3( ) call t_stopf('init_ndep') end if - ! ------------------------------------------------------------------------ ! Initialize active history fields. - ! ------------------------------------------------------------------------ - ! This is only done if not a restart run. If a restart run, then this ! information has already been obtained from the restart data read above. ! Note that routine hist_htapes_build needs time manager information, ! so this call must be made after the restart information has been read. - if (nsrest /= nsrContinue) then call hist_htapes_build() end if - ! ------------------------------------------------------------------------ ! Initialize variables that are associated with accumulated fields. - ! ------------------------------------------------------------------------ - ! The following is called for both initial and restart runs and must ! must be called after the restart file is read - call atm2lnd_inst%initAccVars(bounds_proc) call temperature_inst%initAccVars(bounds_proc) call water_inst%initAccVars(bounds_proc) call energyflux_inst%initAccVars(bounds_proc) call canopystate_inst%initAccVars(bounds_proc) - call bgc_vegetation_inst%initAccVars(bounds_proc) - if (use_crop) then call crop_inst%initAccVars(bounds_proc) end if - !------------------------------------------------------------ ! Read monthly vegetation - !------------------------------------------------------------ - ! Even if CN is on, and dry-deposition is active, read CLMSP annual vegetation ! to get estimates of monthly LAI - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then call readAnnualVegetation(bounds_proc, canopystate_inst) if (nsrest == nsrStartup .and. finidat /= ' ') then @@ -681,10 +582,7 @@ subroutine initialize3( ) end if end if - !------------------------------------------------------------ ! Determine gridcell averaged properties to send to atm - !------------------------------------------------------------ - if (nsrest == nsrStartup) then call t_startf('init_map2gc') call lnd2atm_minimal(bounds_proc, & @@ -692,10 +590,7 @@ subroutine initialize3( ) call t_stopf('init_map2gc') end if - !------------------------------------------------------------ ! Initialize sno export state to send to glc - !------------------------------------------------------------ - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) do nc = 1,nclumps call get_clump_bounds(nc, bounds_clump) @@ -709,19 +604,12 @@ subroutine initialize3( ) end do !$OMP END PARALLEL DO - !------------------------------------------------------------ ! Deallocate wt_nat_patch - !------------------------------------------------------------ - ! wt_nat_patch was allocated in initialize1, but needed to be kept around through ! initialize2 for some consistency checking; now it can be deallocated - deallocate(wt_nat_patch) - ! -------------------------------------------------------------- ! Initialise the fates model state structure - ! -------------------------------------------------------------- - if ( use_fates .and. .not.is_restart() .and. finidat == ' ') then call clm_fates%init_coldstart(water_inst%waterstatebulk_inst, & water_inst%waterdiagnosticbulk_inst, canopystate_inst, & @@ -729,15 +617,10 @@ subroutine initialize3( ) end if ! topo_glc_mec was allocated in initialize1, but needed to be kept around through - ! initialize2 because it is used to initialize other variables; now it can be - ! deallocated - + ! initialize2 because it is used to initialize other variables; now it can be deallocated deallocate(topo_glc_mec, fert_cft, irrig_method) - !------------------------------------------------------------ ! Write log output for end of initialization - !------------------------------------------------------------ - call t_startf('init_wlog') if (masterproc) then write(iulog,*) 'Successfully initialized the land model' @@ -764,8 +647,8 @@ subroutine initialize3( ) !$OMP END PARALLEL DO end if - call t_stopf('clm_init3') + call t_stopf('clm_init2') - end subroutine initialize3 + end subroutine initialize2 end module clm_initializeMod From 52681285c688659f2c3191406a5fea01de3ac372 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 27 Dec 2020 18:25:29 -0700 Subject: [PATCH 1731/1973] refactored nuopc cap some more --- src/cpl/nuopc/lnd_import_export.F90 | 3 + src/cpl/nuopc/lnd_set_decomp_and_domain.F90 | 206 +++++++++++--------- 2 files changed, 115 insertions(+), 94 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 508e51ce9d..a63ba87eac 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -183,6 +183,9 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r else send_to_atm = .false. end if + !DEBUG + send_to_atm = .true. + !DEBUG call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 index ca91bf4ce5..7e2f800089 100644 --- a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 @@ -25,7 +25,7 @@ module lnd_set_decomp_and_domain contains !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) + subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh_ctsm, ni, nj, rc) use NUOPC , only : NUOPC_CompAttributeGet use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D @@ -38,26 +38,27 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) ! input/output variables type(ESMF_GridComp) , intent(inout) :: gcomp - type(ESMF_Mesh) , intent(out) :: mesh + type(ESMF_Mesh) , intent(out) :: mesh_ctsm integer , intent(out) :: ni,nj ! global grid dimensions integer , intent(out) :: rc ! local variables type(ESMF_VM) :: vm - type(ESMF_Mesh) :: mesh_lnd - type(ESMF_Mesh) :: mesh_ocn - type(ESMF_DistGrid) :: distgrid_mesh - type(ESMF_DistGrid) :: distgrid_lnd - character(CL) :: cvalue ! config data - integer :: nlnd, nocn ! local size of arrays - integer :: g,n ! indices - type(bounds_type) :: bounds ! bounds + type(ESMF_Mesh) :: mesh_ocninput + type(ESMF_Mesh) :: mesh_lndinput + type(ESMF_DistGrid) :: distgrid_lndinput + type(ESMF_DistGrid) :: distgrid_ctsm + character(CL) :: cvalue ! config data + integer :: nlnd, nocn ! local size of arrays + integer :: g,n ! indices + type(bounds_type) :: bounds ! bounds integer :: begg,endg character(CL) :: meshfile_ocn - integer , pointer :: gindex_lnd(:) ! global index space for just land points - integer , pointer :: gindex_ocn(:) ! global index space for just ocean points - integer , pointer :: gindex(:) ! global index space for land and ocean points - integer , pointer :: mask(:) ! local land/ocean mask + integer , pointer :: gindex_lnd(:) ! global index space for just land points + integer , pointer :: gindex_ocn(:) ! global index space for just ocean points + integer , pointer :: gindex_ctsm(:) ! global index space for land and ocean points + integer , pointer :: gindex_input(:) ! global index space for land and ocean points + integer , pointer :: mask(:) ! local land/ocean mask integer , pointer :: lndmask_loc(:) real(r8) , pointer :: lndfrac_loc(:) integer , pointer :: lndmask_glob(:) @@ -66,9 +67,11 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) real(r8) , pointer :: lndlons_glob(:) real(r8) , pointer :: rtemp_glob(:) integer , pointer :: itemp_glob(:) + integer :: numownedelements real(r8) , pointer :: ownedElemCoords(:) real(r8) , pointer :: dataptr1d(:) - integer :: lsize, gsize + integer :: lsize_input + integer :: gsize logical :: isgrid2d integer :: spatialDim type(ESMF_Field) :: areaField @@ -87,7 +90,7 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) call NUOPC_CompAttributeGet(gcomp, name='lnd_nj', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) nj - gsize = ni*nj + gsize = ni*nj if (single_column) then isgrid2d = .true. else if (nj == 1) then @@ -105,7 +108,7 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) end if ! read in the land mesh from the file - mesh_lnd = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + mesh_lndinput = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then write(iulog,'(a)')'land mesh file ',trim(model_meshfile) @@ -114,31 +117,34 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) ! read in ocn mask meshfile call NUOPC_CompAttributeGet(gcomp, name='mesh_ocnmask', value=meshfile_ocn, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - mesh_ocn = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) end if ! set local land fraction and land mask for input read decomposition - ! Note that lndmask_loc and lndfrac_loc are allocated in the following calls and lsize is returned + ! Note that lndmask_loc and lndfrac_loc are + ! - allocated in the following calls and lsize is returned + ! - on the input decomposition (gindex_input) + ! - lsize references to the local size of the input decomposition if (trim(meshfile_ocn) == 'null') then ! obtain land mask from land mesh file - assume that land frac is identical to land mask - call clm_getlandmask_from_lndmesh(mesh_lnd, lsize, lndmask_loc, lndfrac_loc, distgrid_lnd, rc) + call clm_getlandmask_from_lndmesh(mesh_lndinput, lsize_input, lndmask_loc, lndfrac_loc, distgrid_lndinput, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call clm_getlandmask_from_ocnmesh(mesh_lnd, mesh_ocn, lsize, lndmask_loc, lndfrac_loc, distgrid_lnd, rc) + call clm_getlandmask_from_ocnmesh(mesh_lndinput, mesh_ocninput, lsize_input, lndmask_loc, lndfrac_loc, distgrid_lndinput, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! determine global landmask_glob - needed to determine the ctsm decomposition ! land frac, lats, lons and areas will be done below - allocate(gindex(lsize)) - call ESMF_DistGridGet(distgrid_lnd, 0, seqIndexList=gindex, rc=rc) + allocate(gindex_input(lsize_input)) + call ESMF_DistGridGet(distgrid_lndinput, 0, seqIndexList=gindex_input, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 - do n = 1,lsize - lndmask_glob(gindex(n)) = lndmask_loc(n) + do n = 1,lsize_input + lndmask_glob(gindex_input(n)) = lndmask_loc(n) end do allocate(itemp_glob(gsize)) call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) @@ -162,7 +168,7 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) begg = bounds%begg endg = bounds%endg - ! Create gindex_lnd + ! Create ctsm gindex_lnd nlnd = endg - begg + 1 allocate(gindex_lnd(nlnd)) do g = begg, endg @@ -173,92 +179,64 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) ! Initialize domain data structure call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - ! Determine ldomain%mask + ! Determine ldomain%mask using ctsm decomposition do g = begg, endg n = 1 + (g - begg) ldomain%mask(g) = lndmask_glob(gindex_lnd(n)) end do deallocate(lndmask_glob) - ! Determine ldomain%frac + ! Determine ldomain%frac using both input and ctsm decompositions + ! lndfrac_glob is filled using the input decomposition and + ! ldomin%frac is set using the ctsm decomposition allocate(rtemp_glob(gsize)) allocate(lndfrac_glob(gsize)) lndfrac_glob(:) = 0._r8 - do n = 1,lsize - lndfrac_glob(gindex(n)) = lndfrac_loc(n) + do n = 1,lsize_input + lndfrac_glob(gindex_input(n)) = lndfrac_loc(n) end do - call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) lndfrac_glob(:) = rtemp_glob(:) do g = begg, endg ldomain%frac(g) = lndfrac_glob(gindex_lnd(g-begg+1)) end do deallocate(lndfrac_glob) - ! Get ownedElemCords from the mesh to be used to obtain ldoman%latc and ldomain%lonc - call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, rc=rc) - allocate(ownedElemCoords(spatialDim*lsize)) - call ESMF_MeshGet(mesh_lnd, ownedElemCoords=ownedElemCoords) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Determine ldomain%latc and global lat1d - allocate(lndlats_glob(gsize)) - lndlats_glob(:) = 0._r8 - do n = 1,lsize - lndlats_glob(gindex(n)) = ownedElemCoords(2*n) - end do - call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndlats_glob(:) = rtemp_glob(:) - do g = begg, endg - ldomain%latc(g) = lndlats_glob(gindex_lnd(g-begg+1)) - end do - if (isgrid2d) then - allocate(lat1d(nj)) - do n = 1,nj - lat1d(n) = lndlats_glob((n-1)*ni + 1) - end do - end if - deallocate(lndlats_glob) - - ! Determine ldomain%lonc and global lon1d - allocate(lndlons_glob(gsize)) - lndlons_glob(:) = 0._r8 - do n = 1,lsize - lndlons_glob(gindex(n)) = ownedElemCoords(2*n-1) - end do - call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndlons_glob(:) = rtemp_glob(:) - do g = begg, endg - ldomain%lonc(g) = lndlons_glob(gindex_lnd(g-begg+1)) - end do - if (isgrid2d) then - allocate(lon1d(ni)) - do n = 1,ni - lon1d(n) = lndlons_glob(n) - end do - end if - deallocate(lndlons_glob) - deallocate(rtemp_glob) - - ! Create a global index that includes both land and ocean points + ! Generate a ctsm global index that includes both land and ocean points nocn = size(gindex_ocn) - allocate(gindex(nlnd + nocn)) + allocate(gindex_ctsm(nlnd + nocn)) do n = 1,nlnd+nocn if (n <= nlnd) then - gindex(n) = gindex_lnd(n) + gindex_ctsm(n) = gindex_lnd(n) else - gindex(n) = gindex_ocn(n-nlnd) + gindex_ctsm(n) = gindex_ocn(n-nlnd) end if end do ! Generate a new mesh on the gindex decomposition - distGrid_mesh = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) + distGrid_ctsm = ESMF_DistGridCreate(arbSeqIndexList=gindex_ctsm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - deallocate(gindex) - mesh = ESMF_MeshCreate(mesh_lnd, elementDistGrid=distgrid_mesh, rc=rc) + mesh_ctsm = ESMF_MeshCreate(mesh_lndinput, elementDistGrid=distgrid_ctsm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Determine ldoman%latc and ldomain%lonc + call ESMF_MeshGet(mesh_ctsm, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(ownedElemCoords(spatialDim*numownedelements)) + call ESMF_MeshGet(mesh_ctsm, ownedElemCoords=ownedElemCoords) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(mesh_ctsm, ownedElemCoords=ownedElemCoords, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg,endg + n = g - begg + 1 + ldomain%lonc(g) = ownedElemCoords(2*n-1) + if (ldomain%lonc(g) == 360._r8) ldomain%lonc(g) = 0._r8 ! TODO: why the difference? + ldomain%latc(g) = ownedElemCoords(2*n) + end do + ! Create ldomain%area by querying the mesh on the ctsm decomposition - areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + areaField = ESMF_FieldCreate(mesh_ctsm, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldRegridGetArea(areaField, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -269,11 +247,49 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) end do call ESMF_FieldDestroy(areaField) + ! If grid is 2d, determine lon1d and lat1d + if (isgrid2d) then + ! Determine lon1d + allocate(lndlons_glob(gsize)) + lndlons_glob(:) = 0._r8 + do n = 1,numownedelements + if (ownedElemCoords(2*n-1) == 360._r8) then ! TODO: why is this needed? + lndlons_glob(gindex_ctsm(n)) = 0._r8 + else + lndlons_glob(gindex_ctsm(n)) = ownedElemCoords(2*n-1) + end if + end do + call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + deallocate(lndlons_glob) + allocate(lon1d(ni)) + do n = 1,ni + lon1d(n) = rtemp_glob(n) + end do + + ! Determine lat1d + allocate(lndlats_glob(gsize)) + lndlats_glob(:) = 0._r8 + do n = 1,numownedelements + lndlats_glob(gindex_ctsm(n)) = ownedElemCoords(2*n) + end do + call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + deallocate(lndlats_glob) + allocate(lat1d(nj)) + do n = 1,nj + lat1d(n) = rtemp_glob((n-1)*ni + 1) + end do + end if + + deallocate(gindex_ctsm) + deallocate(rtemp_glob) + end subroutine lnd_set_decomp_and_domain_from_meshinfo !=============================================================================== subroutine lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) + ! Generate a new mesh from the global 2d sizes and set the mask to 1 + use NUOPC , only : NUOPC_CompAttributeGet use clm_varctl , only : single_column use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror @@ -299,6 +315,8 @@ subroutine lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) character(len=CL) :: cvalue integer :: gsize logical :: isgrid2d + integer :: numownedelements + integer, allocatable :: mask(:) !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -310,7 +328,7 @@ subroutine lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) call NUOPC_CompAttributeGet(gcomp, name='lnd_nj', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) nj - gsize = ni*nj + gsize = ni*nj if (single_column) then isgrid2d = .true. else if (nj == 1) then @@ -378,14 +396,14 @@ subroutine lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) mesh = ESMF_MeshCreate(lgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! TODO: initialize the decomposition - ! initialize ldomain - ! initialize the mask and mesh - ! for created meshes assume the mask is 1 - ! create a pointer for mask and set it to 1 - ! call ESMF_MeshSet(mesh, elementMask=mask, rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! deallocate(mask) + ! Set the mesh mask to 1 + call ESMF_MeshGet(mesh, numOwnedElements=numOwnedElements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(mask(numownedelements)) + mask(:) = 1 + call ESMF_MeshSet(mesh, elementMask=mask, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + deallocate(mask) end subroutine lnd_set_decomp_and_domain_from_newmesh @@ -441,7 +459,7 @@ subroutine clm_getlandmask_from_ocnmesh(mesh_lnd, mesh_ocn, lsize_lnd, lndmask_l srcTermProcessing=srcTermProcessing_Value, & ignoreDegenerate=.true., unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - + ! fill in values for field_ocn with mask on ocn mesh call ESMF_MeshGet(mesh_ocn, elementdistGrid=distgrid_ocn, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 04670adf533555ff247a0ca7468ba36ca9489185 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 28 Dec 2020 13:22:59 -0700 Subject: [PATCH 1732/1973] unification of lilac and nuopc code for lnd_set_decomp_and_domain.F90 --- src/cpl/lilac/lnd_comp_esmf.F90 | 5 +- src/cpl/lilac/lnd_set_decomp_and_domain.F90 | 717 +++++++++++++++----- src/cpl/nuopc/lnd_comp_nuopc.F90 | 21 +- src/cpl/nuopc/lnd_set_decomp_and_domain.F90 | 651 +++++++++++------- 4 files changed, 953 insertions(+), 441 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index a0e1cdec22..d038170baf 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -339,7 +339,10 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- ! Initialize decomposition (ldecomp) and domain (ldomain) types and generate land mesh !---------------------- - call lnd_set_decomp_and_domain_from_meshinfo(lnd_mesh_filename, lnd_mesh, ni, nj, rc) + call ESMF_VMGetCurrent(vm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lnd_set_decomp_and_domain_from_meshinfo(mode='lilac', vm=vm, & + meshfile_lnd=lnd_mesh_filename, meshfile_ocn='null', mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return !-------------------------------- diff --git a/src/cpl/lilac/lnd_set_decomp_and_domain.F90 b/src/cpl/lilac/lnd_set_decomp_and_domain.F90 index 315f5a835c..f3be6085e9 100644 --- a/src/cpl/lilac/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/lilac/lnd_set_decomp_and_domain.F90 @@ -4,187 +4,123 @@ module lnd_set_decomp_and_domain use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl use spmdMod , only : masterproc use clm_varctl , only : iulog - use perf_mod , only : t_startf, t_stopf, t_barrierf implicit none private ! except ! Module public routines - public :: lnd_set_decomp_and_domain_from_meshinfo + public :: lnd_set_decomp_and_domain_from_readmesh + public :: lnd_set_decomp_and_domain_from_newmesh ! Module private routines - private :: chkerr + private :: lnd_get_global_dims + private :: lnd_get_lndmask_from_ocnmesh + private :: lnd_get_lndmask_from_lndmesh + private :: lnd_set_ldomain_gridinfo + private :: nc_check_err + private :: chkerr character(len=*) , parameter :: u_FILE_u = & __FILE__ + character(len=*), parameter, private :: sourcefile = & __FILE__ - + !=============================================================================== contains !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_meshinfo(model_meshfile, mesh_ctsm, ni, nj, rc) + subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshfile_ocn, mesh_ctsm, ni, nj, rc) use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D - use domainMod , only : ldomain, domain_init, lon1d, lat1d + use domainMod , only : ldomain, domain_init use decompMod , only : ldecomp, bounds_type, get_proc_bounds use clm_varpar , only : nlevsoi - use clm_varctl , only : fatmlndfrc, fsurdat, use_soil_moisture_streams, single_column - use clm_varcon , only : re + use clm_varctl , only : fatmlndfrc, fsurdat + use clm_varctl , only : use_soil_moisture_streams, single_column + ! use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen use abortutils , only : endrun use shr_log_mod , only : errMsg => shr_log_errMsg use fileutils , only : getfil ! input/output variables - character(len=*) , intent(in) :: model_meshfile + character(len=*) , intent(in) :: mode ! lilac or nuopc mode + type(ESMF_VM) , intent(in) :: vm + character(len=*) , intent(in) :: meshfile_lnd + character(len=*) , intent(in) :: meshfile_ocn type(ESMF_Mesh) , intent(out) :: mesh_ctsm - integer , intent(out) :: ni,nj ! global sizes of dimensions + integer , intent(out) :: ni,nj ! global grid dimensions integer , intent(out) :: rc ! local variables - type(ESMF_VM) :: vm - type(ESMF_Mesh) :: mesh_input + type(ESMF_Mesh) :: mesh_ocninput + type(ESMF_Mesh) :: mesh_lndinput type(ESMF_DistGrid) :: distgrid_ctsm - type(ESMF_DistGrid) :: distgrid_input - character(CL) :: cvalue ! config data - integer :: nlnd, nocn ! local size ofarrays - integer :: g,n ! indices - type(bounds_type) :: bounds ! bounds + character(CL) :: cvalue ! config data + integer :: nlnd, nocn ! local size of arrays + integer :: g,n ! indices + type(bounds_type) :: bounds ! bounds integer :: begg,endg - integer , pointer :: gindex_lnd(:) ! global index space for just land points - integer , pointer :: gindex_ocn(:) ! global index space for just ocean points - integer , pointer :: gindex(:) ! global index space for land and ocean points - integer , pointer :: gindex_temp(:) ! temporary global index space - integer , pointer :: mask(:) ! local land/ocean mask - integer , pointer :: lndmask_loc(:) - real(r8) , pointer :: lndfrac_loc(:) + integer , pointer :: gindex_lnd(:) ! global index space for just land points + integer , pointer :: gindex_ocn(:) ! global index space for just ocean points + integer , pointer :: gindex_ctsm(:) ! global index space for land and ocean points + integer , pointer :: gindex_input(:) ! global index space for land and ocean points integer , pointer :: lndmask_glob(:) real(r8) , pointer :: lndfrac_glob(:) - real(r8) , pointer :: lndlats_glob(:) - real(r8) , pointer :: lndlons_glob(:) - real(r8) , pointer :: rtemp_glob(:) - integer , pointer :: itemp_glob(:) - real(r8) , pointer :: dataptr1d(:) - integer :: lsize,gsize + integer :: lsize_input + integer :: gsize logical :: isgrid2d - integer :: numownedelements - real(R8) , pointer :: ownedElemCoords(:) - integer :: spatialDim - type(ESMF_Field) :: areaField - type(ESMF_Array) :: elemMaskArray character(len=CL) :: locfn - type(file_desc_t) :: ncid ! netcdf file id - integer :: dimid ! netCDF dimension id - logical :: readvar ! read variable in or not + type(file_desc_t) :: ncid ! netcdf file id + integer :: dimid ! netCDF dimension id + logical :: readvar ! read variable in or not !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! Get current vm - call ESMF_VMGetCurrent(vm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Determine global 2d sizes from read of dimensions of surface dataset - if (masterproc) then - write(iulog,*) 'Attempting to global dimensions from surface dataset' - if (fsurdat == ' ') then - write(iulog,*)'fsurdat must be specified' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - endif - call getfil(fsurdat, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') - call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') - call ncd_pio_closefile(ncid) - gsize = ni*nj - if (single_column) then - isgrid2d = .true. - else if (nj == 1) then - isgrid2d = .false. - else - isgrid2d = .true. - end if - if (masterproc) then - write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj - if (isgrid2d) then - write(iulog,'(a)') 'model grid is 2-dimensional' - else - write(iulog,'(a)') 'model grid is not 2-dimensional' - end if - end if + call lnd_get_global_dims(ni, nj, gsize, isgrid2d) + + ! Allocate global memory for land mask and land fraction + allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 + allocate(lndfrac_glob(gsize)); lndfrac_glob(:) = 0._r8 ! read in the land mesh from the file - mesh_input = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + mesh_lndinput = ESMF_MeshCreate(filename=trim(meshfile_lnd), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then - write(iulog,'(a)')'land mesh file ',trim(model_meshfile) - end if - - ! Obtain global land amsk - if (trim(fatmlndfrc) /= 'null') then - if (masterproc) then - write(iulog,*) 'Generating ctsm decomposition from ',trim(fatmlndfrc) - endif - else - if (masterproc) then - write(iulog,*) 'Generating ctsm decomposition from ',trim(model_meshfile) - endif + write(iulog,'(a)')'land mesh file ',trim(meshfile_lnd) end if - allocate(lndmask_glob(ni*nj)); lndmask_glob(:) = 0 - allocate(rtemp_glob(gsize)) - - if (trim(fatmlndfrc) /= 'null') then - - ! Read in global land mask and land fraction from fatmlndfrc - call getfil( trim(fatmlndfrc), locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_io(ncid=ncid, varname='mask', data=lndmask_glob, flag='read', readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: variable mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - allocate(lndfrac_glob(ni*nj)); lndfrac_glob(:) = 0._r8 - call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - call ncd_pio_closefile(ncid) - - else - - ! Obtain land mask from land mesh file - ASSUME THAT LAND FRAC IS IDENTICAL TO LAND MASK - call ESMF_MeshGet(mesh_input, elementdistGrid=distgrid_input, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_DistGridGet(distgrid_input, localDe=0, elementCount=lsize, rc=rc) + ! Set global land fraction and global land mask across all processors + if (trim(meshfile_ocn) /= 'null') then + ! read in ocn mask meshfile + mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) + end if - ! Determine lndmask_loc - allocate(lndmask_loc(lsize)) - elemMaskArray = ESMF_ArrayCreate(distgrid_input, lndmask_loc, rc=rc) + ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh + call lnd_get_lndmask_from_ocnmesh(mesh_lndinput, mesh_ocninput, vm, gsize, lndmask_glob, lndfrac_glob, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! The following calls fills in the values of lndmask_loc - call ESMF_MeshGet(mesh_input, elemMaskArray=elemMaskArray, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Determine lndfrac_loc - ! ASSUME that land fraction is identical to land mask in this case - allocate(lndfrac_loc(lsize)) - lndfrac_loc(:) = lndmask_loc(:) - - ! determine global landmask_glob - needed to determine the ctsm decomposition - ! land frac, lats, lons and areas will be done below - allocate(gindex_temp(lsize)) - call ESMF_DistGridGet(distgrid_input, 0, seqIndexList=gindex_temp, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 - do n = 1,lsize - lndmask_glob(gindex(n)) = lndmask_loc(n) - end do - allocate(itemp_glob(gsize)) - call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, & - reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndmask_glob(:) = int(itemp_glob(:)) - deallocate(itemp_glob) - + else + if (mode == 'lilac' .and. trim(fatmlndfrc) /= 'null') then + ! Read in global land mask and land fraction from fatmlndfrc + call getfil( trim(fatmlndfrc), locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + call ncd_io(ncid=ncid, varname='mask', data=lndmask_glob, flag='read', readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: variable mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + allocate(lndfrac_glob(ni*nj)); lndfrac_glob(:) = 0._r8 + call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + call ncd_pio_closefile(ncid) + else + ! obtain land mask from land mesh file - assume that land frac is identical to land mask + call lnd_get_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if end if ! Determine lnd decomposition that will be used by ctsm @@ -193,14 +129,19 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(model_meshfile, mesh_ctsm, ni call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) end if - ! *** Get JUST gridcell processor bounds *** + ! Determine ocn decomposition that will be used to create the full mesh + ! note that the memory for gindex_ocn will be allocated in the following call + ! but deallocated at the end of this routine + call decompInit_ocn(ni=ni, nj=nj, amask=lndmask_glob, gindex_ocn=gindex_ocn) + + ! Get JUST gridcell processor bounds ! Remaining bounds (landunits, columns, patches) will be set after calling decompInit_glcp ! so get_proc_bounds is called twice and the gridcell information is just filled in twice call get_proc_bounds(bounds) begg = bounds%begg endg = bounds%endg - ! Create gindex_lnd + ! Create ctsm gindex_lnd nlnd = endg - begg + 1 allocate(gindex_lnd(nlnd)) do g = begg, endg @@ -208,68 +149,462 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(model_meshfile, mesh_ctsm, ni gindex_lnd(n) = ldecomp%gdc2glo(g) end do - ! Create gindex_ocn - ! Need this decomposition to create the full mesh - ! Note that the memory for gindex_ocn will be allocated in the following call - call decompInit_ocn(ni=ni, nj=nj, amask=lndmask_glob, gindex_ocn=gindex_ocn) + ! Initialize domain data structure + call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + + ! Determine ldomain%mask and ldomain%frac using ctsm decomposition + do g = begg, endg + n = 1 + (g - begg) + ldomain%mask(g) = lndmask_glob(gindex_lnd(n)) + ldomain%frac(g) = lndfrac_glob(gindex_lnd(n)) + end do + deallocate(lndmask_glob) + deallocate(lndfrac_glob) - ! Create a global index that includes both land and ocean points + ! Generate a ctsm global index that includes both land and ocean points nocn = size(gindex_ocn) - allocate(gindex(nlnd + nocn)) + allocate(gindex_ctsm(nlnd + nocn)) do n = 1,nlnd+nocn if (n <= nlnd) then - gindex(n) = gindex_lnd(n) + gindex_ctsm(n) = gindex_lnd(n) else - gindex(n) = gindex_ocn(n-nlnd) + gindex_ctsm(n) = gindex_ocn(n-nlnd) end if end do - ! Generate a new distgrid based on gindex - distgrid_ctsm = ESMF_DistGridCreate(arbSeqIndexList=gindex, rc=rc) + ! Generate a new mesh on the gindex decomposition + distGrid_ctsm = ESMF_DistGridCreate(arbSeqIndexList=gindex_ctsm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + mesh_ctsm = ESMF_MeshCreate(mesh_lndinput, elementDistGrid=distgrid_ctsm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Get ldomain%lonc, ldomain%latc and ldomain%area and optionally + ! lon1d and lat1d if isgrid2d + call lnd_set_ldomain_gridinfo(mesh_ctsm, vm, gindex_ctsm, bounds, isgrid2d, ni, nj, ldomain, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Deallocate memory + deallocate(gindex_lnd) + deallocate(gindex_ocn) + deallocate(gindex_ctsm) + + end subroutine lnd_set_decomp_and_domain_from_readmesh + + !=============================================================================== + subroutine lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) + + ! Generate a new mesh from the input domain file and set the mask to 1 + + use decompInitMod , only : decompInit_lnd, decompInit_lnd3D + use decompMod , only : ldecomp, bounds_type, get_proc_bounds + use domainMod , only : ldomain, domain_init + use clm_varctl , only : use_soil_moisture_streams, single_column + use clm_varpar , only : nlevsoi + use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror + use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var + use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable + + ! input/output variables + character(len=CL) , intent(in) :: domain_file + type(ESMF_Mesh) , intent(out) :: mesh + integer , intent(out) :: ni,nj ! global grid dimensions + integer , intent(out) :: rc + + ! local variables + logical :: isgrid2d + integer :: g,n + integer :: nv + integer :: ncid, ierr + integer :: dimid_ni, dimid_nj, dimid_nv + integer :: maxIndex(2) + real(r8) :: mincornerCoord(2) + real(r8) :: maxcornerCoord(2) + type(ESMF_Grid) :: lgrid + real(r8), allocatable :: xv(:,:,:), yv(:,:,:) + integer :: varid_xv, varid_yv + integer :: numownedelements + integer, allocatable :: lnd_mask(:) + type(bounds_type) :: bounds ! bounds + integer :: begg,endg + integer :: nlnd + integer, pointer :: gindex_lnd(:) ! global index space for just land points + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! open file + ierr = nf90_open(domain_file, NF90_NOWRITE, ncid) + call nc_check_err(ierr, 'nf90_open', trim(domain_file)) + ! get dimension ids + ierr = nf90_inq_dimid(ncid, 'ni', dimid_ni) + call nc_check_err(ierr, 'nf90_inq_dimid for ni', trim(domain_file)) + ierr = nf90_inq_dimid(ncid, 'nj', dimid_nj) + call nc_check_err(ierr, 'nf90_inq_dimid for nj', trim(domain_file)) + ierr = nf90_inq_dimid(ncid, 'nv', dimid_nv) + call nc_check_err(ierr, 'nf90_inq_dimid for nv', trim(domain_file)) + ! get dimension values + ierr = nf90_inquire_dimension(ncid, dimid_ni, len=ni) + call nc_check_err(ierr, 'nf90_inq_dimension for ni', trim(domain_file)) + ierr = nf90_inquire_dimension(ncid, dimid_nj, len=nj) + call nc_check_err(ierr, 'nf90_inq_dimension for nj', trim(domain_file)) + ierr = nf90_inquire_dimension(ncid, dimid_nv, len=nv) + call nc_check_err(ierr, 'nf90_inq_dimension for nv', trim(domain_file)) + ! get variable ids + ierr = nf90_inq_varid(ncid, 'xv', varid_xv) + call nc_check_err(ierr, 'nf90_inq_varid for xv', trim(domain_file)) + ierr = nf90_inq_varid(ncid, 'yv', varid_yv) + call nc_check_err(ierr, 'nf90_inq_varid for yv', trim(domain_file)) + ! allocate memory for variables and get variable values + allocate(xv(nv,ni,nj), yv(nv,ni,nj)) + ierr = nf90_get_var(ncid, varid_xv, xv) + call nc_check_err(ierr, 'nf90_get_var for xv', trim(domain_file)) + ierr = nf90_get_var(ncid, varid_yv, yv) + call nc_check_err(ierr, 'nf90_get_var for yv', trim(domain_file)) + ! close file + ierr = nf90_close(ncid) + call nc_check_err(ierr, 'nf90_close', trim(domain_file)) + ! create the grid + maxIndex(1) = ni ! number of lons + maxIndex(2) = nj ! number of lats + mincornerCoord(1) = xv(1,1,1) ! min lon + mincornerCoord(2) = yv(1,1,1) ! min lat + maxcornerCoord(1) = xv(3,ni,nj) ! max lon + maxcornerCoord(2) = yv(3,ni,nj) ! max lat + deallocate(xv,yv) + lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & + mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & + staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! create the mesh from the grid + mesh = ESMF_MeshCreate(lgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Generate the ctsm mesh on the gindex decomposition - mesh_ctsm = ESMF_MeshCreate(mesh_input, elementDistGrid=distgrid_ctsm, rc=rc) + ! Set the mesh mask to 1 + call ESMF_MeshGet(mesh, numOwnedElements=numOwnedElements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lnd_mask(numownedelements)) + lnd_mask(:) = 1 + call ESMF_MeshSet(mesh, elementMask=lnd_mask, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Determine ldecomp and ldomain + call decompInit_lnd(lni=ni, lnj=nj, amask=lnd_mask) + if (use_soil_moisture_streams) then + call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) + end if + + ! Initialize processor bounds + call get_proc_bounds(bounds) + begg = bounds%begg + endg = bounds%endg + + ! Create ctsm gindex_lnd + nlnd = endg - begg + 1 + allocate(gindex_lnd(nlnd)) + do g = begg, endg + n = 1 + (g - begg) + gindex_lnd(n) = ldecomp%gdc2glo(g) + end do + ! Initialize domain data structure + isgrid2d = .true. call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - ! Determine ldomain%mask + ! Determine ldomain%mask and ldomain%frac do g = begg, endg - n = gindex(g-begg+1) - ldomain%mask(g) = lndmask_glob(n) + ldomain%mask(g) = 1 + ldomain%frac(g) = 1._r8 end do - deallocate(lndmask_glob) + deallocate(lnd_mask) - ! Determine ldomain%frac - ! note that lndfrac_glob was read in from fatmlndfrc above if it was not set to null - if (trim(fatmlndfrc) == 'null') then - allocate(lndfrac_glob(gsize)) - do n = 1,nlnd - lndfrac_glob(gindex_lnd(n)) = lndfrac_loc(n) - end do - call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - do g = begg, endg - n = gindex(g-begg+1) - ldomain%frac(g) = rtemp_glob(n) - end do - deallocate(lndfrac_glob) + end subroutine lnd_set_decomp_and_domain_from_newmesh + + !=============================================================================== + subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) + + ! Determine global 2d sizes from read of dimensions of surface dataset + + use clm_varctl , only : fsurdat, single_column + use fileutils , only : getfil + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen + use abortutils , only : endrun + use shr_log_mod , only : errMsg => shr_log_errMsg + + ! input/output variables + integer, intent(out) :: ni + integer, intent(out) :: nj + integer, intent(out) :: gsize + logical, intent(out) :: isgrid2d + + ! local variables + character(len=CL) :: locfn + type(file_desc_t) :: ncid ! netcdf file id + integer :: dimid ! netCDF dimension id + logical :: readvar ! read variable in or not + !------------------------------------------------------------------------------- + + if (masterproc) then + write(iulog,*) 'Attempting to global dimensions from surface dataset' + if (fsurdat == ' ') then + write(iulog,*)'fsurdat must be specified' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + endif + call getfil(fsurdat, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') + call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') + call ncd_pio_closefile(ncid) + gsize = ni*nj + if (single_column) then + isgrid2d = .true. + else if (nj == 1) then + isgrid2d = .false. else - do g = begg, endg - n = gindex(g-begg+1) - ldomain%frac(g) = lndfrac_glob(n) - end do - deallocate(lndfrac_glob) + isgrid2d = .true. + end if + if (masterproc) then + write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj + if (isgrid2d) then + write(iulog,'(a)') 'model grid is 2-dimensional' + else + write(iulog,'(a)') 'model grid is not 2-dimensional' + end if end if + end subroutine lnd_get_global_dims + + !=============================================================================== + subroutine lnd_get_lndmask_from_ocnmesh(mesh_lnd, mesh_ocn, vm, gsize, lndmask_glob, lndfrac_glob, rc) + + ! input/out variables + type(ESMF_Mesh) , intent(in) :: mesh_lnd + type(ESMF_Mesh) , intent(in) :: mesh_ocn + type(ESMF_VM) , intent(in) :: vm + integer , intent(in) :: gsize + integer , pointer :: lndmask_glob(:) + real(r8) , pointer :: lndfrac_glob(:) + integer , intent(out) :: rc + + ! local variables: + type(ESMF_DistGrid) :: distgrid_lnd + type(ESMF_RouteHandle) :: rhandle_ocn2lnd + type(ESMF_Field) :: field_lnd + type(ESMF_Field) :: field_ocn + type(ESMF_DistGrid) :: distgrid_ocn + integer , pointer :: gindex_input(:) ! global index space for land and ocean points + integer , pointer :: lndmask_loc(:) + integer , pointer :: itemp_glob(:) + real(r8) , pointer :: rtemp_glob(:) + real(r8) , pointer :: lndfrac_loc(:) + real(r8) , pointer :: ocnmask_loc(:) ! on ocean mesh + real(r8) , pointer :: ocnfrac_loc(:) ! on land mesh + real(r8) , pointer :: dataptr1d(:) + type(ESMF_Array) :: elemMaskArray + integer :: lsize_lnd + integer :: lsize_ocn + integer :: n, spatialDim + integer :: srcMaskValue = 0 + integer :: dstMaskValue = -987987 ! spval for RH mask values + integer :: srcTermProcessing_Value = 0 + real(r8) :: fminval = 0.001_r8 + real(r8) :: fmaxval = 1._r8 + logical :: checkflag = .false. + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, numOwnedElements=lsize_lnd, & + elementDistGrid=distgrid_lnd, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(lndmask_loc(lsize_lnd)) + allocate(lndfrac_loc(lsize_lnd)) + + ! create fields on land and ocean meshes + field_lnd = ESMF_FieldCreate(mesh_lnd, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + field_ocn = ESMF_FieldCreate(mesh_ocn, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! create route handle to map ocean mask from ocn mesh to land mesh + call ESMF_FieldRegridStore(field_ocn, field_lnd, routehandle=rhandle_ocn2lnd, & + srcMaskValues=(/srcMaskValue/), dstMaskValues=(/dstMaskValue/), & + regridmethod=ESMF_REGRIDMETHOD_CONSERVE, normType=ESMF_NORMTYPE_DSTAREA, & + srcTermProcessing=srcTermProcessing_Value, & + ignoreDegenerate=.true., unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + ! fill in values for field_ocn with mask on ocn mesh + call ESMF_MeshGet(mesh_ocn, elementdistGrid=distgrid_ocn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_DistGridGet(distgrid_ocn, localDe=0, elementCount=lsize_ocn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(ocnmask_loc(lsize_ocn)) + elemMaskArray = ESMF_ArrayCreate(distgrid_ocn, ocnmask_loc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(mesh_ocn, elemMaskArray=elemMaskArray, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(field_ocn, farrayptr=dataptr1d, rc=rc) + dataptr1d(:) = ocnmask_loc(:) + + ! map ocn mask to land mesh + call ESMF_FieldRegrid(field_ocn, field_lnd, routehandle=rhandle_ocn2lnd, & + termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(ocnfrac_loc(lsize_lnd)) + call ESMF_FieldGet(field_lnd, farrayptr=ocnfrac_loc, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1,lsize_lnd + lndfrac_loc(n) = 1._r8 - ocnfrac_loc(n) + if (lndfrac_loc(n) > fmaxval) lndfrac_loc(n) = 1._r8 + if (lndfrac_loc(n) < fminval) lndfrac_loc(n) = 0._r8 + if (lndfrac_loc(n) /= 0._r8) then + lndmask_loc(n) = 1 + else + lndmask_loc(n) = 0 + end if + enddo + call ESMF_FieldDestroy(field_lnd) + call ESMF_FieldDestroy(field_ocn) + + ! determine global landmask_glob - needed to determine the ctsm decomposition + ! land frac, lats, lons and areas will be done below + allocate(gindex_input(lsize_lnd)) + call ESMF_DistGridGet(distgrid_lnd, 0, seqIndexList=gindex_input, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1,lsize_lnd + lndmask_glob(gindex_input(n)) = lndmask_loc(n) + end do + allocate(itemp_glob(gsize)) + call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndmask_glob(:) = int(itemp_glob(:)) + deallocate(itemp_glob) + + ! Determine ldomain%frac using both input and ctsm decompositions + ! lndfrac_glob is filled using the input decomposition and + ! ldomin%frac is set using the ctsm decomposition + allocate(rtemp_glob(gsize)) + do n = 1,lsize_lnd + lndfrac_glob(gindex_input(n)) = lndfrac_loc(n) + end do + call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndfrac_glob(:) = rtemp_glob(:) + deallocate(rtemp_glob) + + ! deallocate memory + deallocate(ocnmask_loc) + deallocate(lndmask_loc) + deallocate(lndfrac_loc) + + end subroutine lnd_get_lndmask_from_ocnmesh + + !=============================================================================== + subroutine lnd_get_lndmask_from_lndmesh(mesh_lnd, vm, gsize, lndmask_glob, lndfrac_glob, rc) + + ! input/out variables + type(ESMF_Mesh) , intent(in) :: mesh_lnd + type(ESMF_VM) , intent(in) :: vm + integer , intent(in) :: gsize + integer , pointer :: lndmask_glob(:) + real(r8) , pointer :: lndfrac_glob(:) + integer , intent(out) :: rc + + ! local variables: + integer :: n + integer :: lsize + integer , pointer :: gindex(:) + integer , pointer :: lndmask_loc(:) + integer , pointer :: itemp_glob(:) + type(ESMF_DistGrid) :: distgrid + type(ESMF_Array) :: elemMaskArray + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + ! Determine lsize and distgrid_lnd + call ESMF_MeshGet(mesh_lnd, elementdistGrid=distgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_DistGridGet(distgrid, localDe=0, elementCount=lsize, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine lndmask_loc + ! The call to ESMF_MeshGet fills in the values of lndmask_loc + allocate(lndmask_loc(lsize)) + elemMaskArray = ESMF_ArrayCreate(distgrid, lndmask_loc, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(mesh_lnd, elemMaskArray=elemMaskArray, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine global landmask_glob - needed to determine the ctsm decomposition + ! land frac, lats, lons and areas will be done below + allocate(gindex(lsize)) + allocate(itemp_glob(gsize)) + call ESMF_DistGridGet(distgrid, 0, seqIndexList=gindex, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1,lsize + lndmask_glob(gindex(n)) = lndmask_loc(n) + end do + call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndmask_glob(:) = int(itemp_glob(:)) + deallocate(itemp_glob) + deallocate(gindex) + deallocate(lndmask_loc) + + ! ASSUME that land fraction is identical to land mask in this case + lndfrac_glob(:) = lndmask_glob(:) + + end subroutine lnd_get_lndmask_from_lndmesh + + !=============================================================================== + subroutine lnd_set_ldomain_gridinfo(mesh, vm, gindex, bounds, isgrid2d, ni, nj, ldomain, rc) + + use domainMod , only : domain_type, lon1d, lat1d + use decompMod , only : bounds_type, get_proc_bounds + use clm_varcon , only : re + + ! input/output variables + type(ESMF_Mesh) , intent(in) :: mesh + type(ESMF_VM) , intent(in) :: vm + integer , intent(in) :: gindex(:) + type(bounds_type) , intent(in) :: bounds + logical , intent(in) :: isgrid2d + integer , intent(in) :: ni,nj + type(domain_type) , intent(inout) :: ldomain + integer , intent(out) :: rc + + ! local variables + integer :: g,n + integer :: gsize + integer :: begg,endg + integer :: numownedelements + real(r8) , pointer :: lndlats_glob(:) + real(r8) , pointer :: lndlons_glob(:) + real(r8) , pointer :: rtemp_glob(:) + real(r8) , pointer :: ownedElemCoords(:) + integer :: spatialDim + real(r8) , pointer :: dataptr1d(:) + type(ESMF_Field) :: areaField + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + begg = bounds%begg + endg = bounds%endg + ! Determine ldoman%latc and ldomain%lonc - call ESMF_MeshGet(mesh_ctsm, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return allocate(ownedElemCoords(spatialDim*numownedelements)) - call ESMF_MeshGet(mesh_ctsm, ownedElemCoords=ownedElemCoords) + call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords) if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_MeshGet(mesh_ctsm, ownedElemCoords=ownedElemCoords, rc=rc) + call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg,endg n = g - begg + 1 @@ -278,8 +613,8 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(model_meshfile, mesh_ctsm, ni ldomain%latc(g) = ownedElemCoords(2*n) end do - ! Determine ldomain%area by querying the mesh on the ctsm decomposition - areaField = ESMF_FieldCreate(mesh_ctsm, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + ! Create ldomain%area by querying the mesh on the ctsm decomposition + areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldRegridGetArea(areaField, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -292,6 +627,9 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(model_meshfile, mesh_ctsm, ni ! If grid is 2d, determine lon1d and lat1d if (isgrid2d) then + gsize = ni*nj + allocate(rtemp_glob(gsize)) + ! Determine lon1d allocate(lndlons_glob(gsize)) lndlons_glob(:) = 0._r8 @@ -302,7 +640,8 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(model_meshfile, mesh_ctsm, ni lndlons_glob(gindex(n)) = ownedElemCoords(2*n-1) end if end do - call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) deallocate(lndlons_glob) allocate(lon1d(ni)) do n = 1,ni @@ -315,25 +654,41 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(model_meshfile, mesh_ctsm, ni do n = 1,numownedelements lndlats_glob(gindex(n)) = ownedElemCoords(2*n) end do - call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) + call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) deallocate(lndlats_glob) allocate(lat1d(nj)) do n = 1,nj lat1d(n) = rtemp_glob((n-1)*ni + 1) end do + deallocate(rtemp_glob) end if - deallocate(ownedElemCoords) - deallocate(rtemp_glob) - deallocate(gindex) + end subroutine lnd_set_ldomain_gridinfo + + !=============================================================================== + subroutine nc_check_err(ierror, description, filename) + + use shr_sys_mod , only : shr_sys_abort + use netcdf , only : nf90_noerr, nf90_strerror - end subroutine lnd_set_decomp_and_domain_from_meshinfo + integer , intent(in) :: ierror + character(*), intent(in) :: description + character(*), intent(in) :: filename + + if (ierror /= nf90_noerr) then + write (*,'(6a)') 'ERROR ', trim(description),'. NetCDF file : "', trim(filename),& + '". Error message:', trim(nf90_strerror(ierror)) + call shr_sys_abort() + endif + end subroutine nc_check_err !=============================================================================== logical function chkerr(rc, line, file) - integer, intent(in) :: rc - integer, intent(in) :: line - character(len=*), intent(in) :: file + integer , intent(in) :: rc + integer , intent(in) :: line + character(len=*) , intent(in) :: file + integer :: lrc chkerr = .false. lrc = rc diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index b6bec64684..170c47ab99 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -346,7 +346,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) use domainMod , only : ldomain use decompMod , only : ldecomp, bounds_type, get_proc_bounds use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_newmesh - use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_meshinfo + use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_readmesh ! input/output variables type(ESMF_GridComp) :: gcomp @@ -390,6 +390,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: shrlogunit ! original log unit type(bounds_type) :: bounds ! bounds integer :: ni, nj + character(len=CL) :: meshfile_ocn + character(len=CL) :: domain_file character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -414,7 +416,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return -!$ call omp_set_num_threads(localPeCount) + !$ call omp_set_num_threads(localPeCount) !---------------------- ! Obtain attribute values @@ -541,10 +543,21 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=model_meshfile, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (single_column) model_meshfile = 'create_mesh' + if (trim(model_meshfile) == 'create_mesh') then - call lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) + ! TODO: can't this just be fatmlndfrc + call NUOPC_CompAttributeGet(gcomp, name='domain_lnd', value=domain_file, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh, ni, nj, rc) + call NUOPC_CompAttributeGet(gcomp, name='mesh_ocnmask', value=meshfile_ocn, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call lnd_set_decomp_and_domain_from_readmesh(mode='nuopc', vm=vm, & + meshfile_lnd=model_meshfile, meshfile_ocn=meshfile_ocn, mesh_ctsm=mesh, ni=ni, nj=nj, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if ! --------------------- diff --git a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 index 7e2f800089..f3be6085e9 100644 --- a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 @@ -4,154 +4,126 @@ module lnd_set_decomp_and_domain use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl use spmdMod , only : masterproc use clm_varctl , only : iulog - use nuopc_shr_methods , only : chkerr implicit none private ! except ! Module public routines - public :: lnd_set_decomp_and_domain_from_meshinfo + public :: lnd_set_decomp_and_domain_from_readmesh public :: lnd_set_decomp_and_domain_from_newmesh ! Module private routines - private :: clm_getlandmask_from_ocnmesh - private :: clm_getlandmask_from_lndmesh + private :: lnd_get_global_dims + private :: lnd_get_lndmask_from_ocnmesh + private :: lnd_get_lndmask_from_lndmesh + private :: lnd_set_ldomain_gridinfo private :: nc_check_err + private :: chkerr character(len=*) , parameter :: u_FILE_u = & __FILE__ + character(len=*), parameter, private :: sourcefile = & + __FILE__ + !=============================================================================== contains !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh_ctsm, ni, nj, rc) + subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshfile_ocn, mesh_ctsm, ni, nj, rc) - use NUOPC , only : NUOPC_CompAttributeGet use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D - use domainMod , only : ldomain, domain_init, lon1d, lat1d + use domainMod , only : ldomain, domain_init use decompMod , only : ldecomp, bounds_type, get_proc_bounds use clm_varpar , only : nlevsoi + use clm_varctl , only : fatmlndfrc, fsurdat use clm_varctl , only : use_soil_moisture_streams, single_column - use clm_varcon , only : re - use lnd_comp_shr , only : model_meshfile, model_clock + ! + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen + use abortutils , only : endrun + use shr_log_mod , only : errMsg => shr_log_errMsg + use fileutils , only : getfil ! input/output variables - type(ESMF_GridComp) , intent(inout) :: gcomp + character(len=*) , intent(in) :: mode ! lilac or nuopc mode + type(ESMF_VM) , intent(in) :: vm + character(len=*) , intent(in) :: meshfile_lnd + character(len=*) , intent(in) :: meshfile_ocn type(ESMF_Mesh) , intent(out) :: mesh_ctsm integer , intent(out) :: ni,nj ! global grid dimensions integer , intent(out) :: rc ! local variables - type(ESMF_VM) :: vm type(ESMF_Mesh) :: mesh_ocninput type(ESMF_Mesh) :: mesh_lndinput - type(ESMF_DistGrid) :: distgrid_lndinput type(ESMF_DistGrid) :: distgrid_ctsm character(CL) :: cvalue ! config data integer :: nlnd, nocn ! local size of arrays integer :: g,n ! indices type(bounds_type) :: bounds ! bounds integer :: begg,endg - character(CL) :: meshfile_ocn integer , pointer :: gindex_lnd(:) ! global index space for just land points integer , pointer :: gindex_ocn(:) ! global index space for just ocean points integer , pointer :: gindex_ctsm(:) ! global index space for land and ocean points integer , pointer :: gindex_input(:) ! global index space for land and ocean points - integer , pointer :: mask(:) ! local land/ocean mask - integer , pointer :: lndmask_loc(:) - real(r8) , pointer :: lndfrac_loc(:) integer , pointer :: lndmask_glob(:) real(r8) , pointer :: lndfrac_glob(:) - real(r8) , pointer :: lndlats_glob(:) - real(r8) , pointer :: lndlons_glob(:) - real(r8) , pointer :: rtemp_glob(:) - integer , pointer :: itemp_glob(:) - integer :: numownedelements - real(r8) , pointer :: ownedElemCoords(:) - real(r8) , pointer :: dataptr1d(:) integer :: lsize_input integer :: gsize logical :: isgrid2d - integer :: spatialDim - type(ESMF_Field) :: areaField + character(len=CL) :: locfn + type(file_desc_t) :: ncid ! netcdf file id + integer :: dimid ! netCDF dimension id + logical :: readvar ! read variable in or not !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! get vm - call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Determine global 2d sizes from read of dimensions of surface dataset + call lnd_get_global_dims(ni, nj, gsize, isgrid2d) - ! determine global 2d sizes - call NUOPC_CompAttributeGet(gcomp, name='lnd_ni', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) ni - call NUOPC_CompAttributeGet(gcomp, name='lnd_nj', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) nj - gsize = ni*nj - if (single_column) then - isgrid2d = .true. - else if (nj == 1) then - isgrid2d = .false. - else - isgrid2d = .true. - end if - if (masterproc) then - write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj - if (isgrid2d) then - write(iulog,'(a)') 'model grid is 2-dimensional' - else - write(iulog,'(a)') 'model grid is not 2-dimensional' - end if - end if + ! Allocate global memory for land mask and land fraction + allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 + allocate(lndfrac_glob(gsize)); lndfrac_glob(:) = 0._r8 ! read in the land mesh from the file - mesh_lndinput = ESMF_MeshCreate(filename=trim(model_meshfile), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + mesh_lndinput = ESMF_MeshCreate(filename=trim(meshfile_lnd), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then - write(iulog,'(a)')'land mesh file ',trim(model_meshfile) + write(iulog,'(a)')'land mesh file ',trim(meshfile_lnd) end if - ! read in ocn mask meshfile - call NUOPC_CompAttributeGet(gcomp, name='mesh_ocnmask', value=meshfile_ocn, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) - end if + ! Set global land fraction and global land mask across all processors + if (trim(meshfile_ocn) /= 'null') then + ! read in ocn mask meshfile + mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) + end if - ! set local land fraction and land mask for input read decomposition - ! Note that lndmask_loc and lndfrac_loc are - ! - allocated in the following calls and lsize is returned - ! - on the input decomposition (gindex_input) - ! - lsize references to the local size of the input decomposition - if (trim(meshfile_ocn) == 'null') then - ! obtain land mask from land mesh file - assume that land frac is identical to land mask - call clm_getlandmask_from_lndmesh(mesh_lndinput, lsize_input, lndmask_loc, lndfrac_loc, distgrid_lndinput, rc) + ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh + call lnd_get_lndmask_from_ocnmesh(mesh_lndinput, mesh_ocninput, vm, gsize, lndmask_glob, lndfrac_glob, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call clm_getlandmask_from_ocnmesh(mesh_lndinput, mesh_ocninput, lsize_input, lndmask_loc, lndfrac_loc, distgrid_lndinput, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (mode == 'lilac' .and. trim(fatmlndfrc) /= 'null') then + ! Read in global land mask and land fraction from fatmlndfrc + call getfil( trim(fatmlndfrc), locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + call ncd_io(ncid=ncid, varname='mask', data=lndmask_glob, flag='read', readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: variable mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + allocate(lndfrac_glob(ni*nj)); lndfrac_glob(:) = 0._r8 + call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + call ncd_pio_closefile(ncid) + else + ! obtain land mask from land mesh file - assume that land frac is identical to land mask + call lnd_get_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if end if - ! determine global landmask_glob - needed to determine the ctsm decomposition - ! land frac, lats, lons and areas will be done below - allocate(gindex_input(lsize_input)) - call ESMF_DistGridGet(distgrid_lndinput, 0, seqIndexList=gindex_input, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 - do n = 1,lsize_input - lndmask_glob(gindex_input(n)) = lndmask_loc(n) - end do - allocate(itemp_glob(gsize)) - call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndmask_glob(:) = int(itemp_glob(:)) - deallocate(itemp_glob) - - ! determine lnd decomposition that will be used by ctsm + ! Determine lnd decomposition that will be used by ctsm call decompInit_lnd(lni=ni, lnj=nj, amask=lndmask_glob) if (use_soil_moisture_streams) then call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) @@ -159,9 +131,10 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh_ctsm, ni, nj, rc) ! Determine ocn decomposition that will be used to create the full mesh ! note that the memory for gindex_ocn will be allocated in the following call + ! but deallocated at the end of this routine call decompInit_ocn(ni=ni, nj=nj, amask=lndmask_glob, gindex_ocn=gindex_ocn) - ! *** Get JUST gridcell processor bounds *** + ! Get JUST gridcell processor bounds ! Remaining bounds (landunits, columns, patches) will be set after calling decompInit_glcp ! so get_proc_bounds is called twice and the gridcell information is just filled in twice call get_proc_bounds(bounds) @@ -179,28 +152,13 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh_ctsm, ni, nj, rc) ! Initialize domain data structure call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - ! Determine ldomain%mask using ctsm decomposition + ! Determine ldomain%mask and ldomain%frac using ctsm decomposition do g = begg, endg n = 1 + (g - begg) ldomain%mask(g) = lndmask_glob(gindex_lnd(n)) + ldomain%frac(g) = lndfrac_glob(gindex_lnd(n)) end do deallocate(lndmask_glob) - - ! Determine ldomain%frac using both input and ctsm decompositions - ! lndfrac_glob is filled using the input decomposition and - ! ldomin%frac is set using the ctsm decomposition - allocate(rtemp_glob(gsize)) - allocate(lndfrac_glob(gsize)) - lndfrac_glob(:) = 0._r8 - do n = 1,lsize_input - lndfrac_glob(gindex_input(n)) = lndfrac_loc(n) - end do - call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, & - reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndfrac_glob(:) = rtemp_glob(:) - do g = begg, endg - ldomain%frac(g) = lndfrac_glob(gindex_lnd(g-begg+1)) - end do deallocate(lndfrac_glob) ! Generate a ctsm global index that includes both land and ocean points @@ -220,165 +178,91 @@ subroutine lnd_set_decomp_and_domain_from_meshinfo(gcomp, mesh_ctsm, ni, nj, rc) mesh_ctsm = ESMF_MeshCreate(mesh_lndinput, elementDistGrid=distgrid_ctsm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Determine ldoman%latc and ldomain%lonc - call ESMF_MeshGet(mesh_ctsm, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(ownedElemCoords(spatialDim*numownedelements)) - call ESMF_MeshGet(mesh_ctsm, ownedElemCoords=ownedElemCoords) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_MeshGet(mesh_ctsm, ownedElemCoords=ownedElemCoords, rc=rc) + ! Get ldomain%lonc, ldomain%latc and ldomain%area and optionally + ! lon1d and lat1d if isgrid2d + call lnd_set_ldomain_gridinfo(mesh_ctsm, vm, gindex_ctsm, bounds, isgrid2d, ni, nj, ldomain, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg,endg - n = g - begg + 1 - ldomain%lonc(g) = ownedElemCoords(2*n-1) - if (ldomain%lonc(g) == 360._r8) ldomain%lonc(g) = 0._r8 ! TODO: why the difference? - ldomain%latc(g) = ownedElemCoords(2*n) - end do - - ! Create ldomain%area by querying the mesh on the ctsm decomposition - areaField = ESMF_FieldCreate(mesh_ctsm, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldRegridGetArea(areaField, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(areaField, farrayPtr=dataptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg, endg - ldomain%area(g) = dataptr1d(g-begg+1) * (re*re) - end do - call ESMF_FieldDestroy(areaField) - - ! If grid is 2d, determine lon1d and lat1d - if (isgrid2d) then - ! Determine lon1d - allocate(lndlons_glob(gsize)) - lndlons_glob(:) = 0._r8 - do n = 1,numownedelements - if (ownedElemCoords(2*n-1) == 360._r8) then ! TODO: why is this needed? - lndlons_glob(gindex_ctsm(n)) = 0._r8 - else - lndlons_glob(gindex_ctsm(n)) = ownedElemCoords(2*n-1) - end if - end do - call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - deallocate(lndlons_glob) - allocate(lon1d(ni)) - do n = 1,ni - lon1d(n) = rtemp_glob(n) - end do - - ! Determine lat1d - allocate(lndlats_glob(gsize)) - lndlats_glob(:) = 0._r8 - do n = 1,numownedelements - lndlats_glob(gindex_ctsm(n)) = ownedElemCoords(2*n) - end do - call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, reduceflag=ESMF_REDUCE_SUM, rc=rc) - deallocate(lndlats_glob) - allocate(lat1d(nj)) - do n = 1,nj - lat1d(n) = rtemp_glob((n-1)*ni + 1) - end do - end if + ! Deallocate memory + deallocate(gindex_lnd) + deallocate(gindex_ocn) deallocate(gindex_ctsm) - deallocate(rtemp_glob) - end subroutine lnd_set_decomp_and_domain_from_meshinfo + end subroutine lnd_set_decomp_and_domain_from_readmesh !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) + subroutine lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) - ! Generate a new mesh from the global 2d sizes and set the mask to 1 + ! Generate a new mesh from the input domain file and set the mask to 1 - use NUOPC , only : NUOPC_CompAttributeGet - use clm_varctl , only : single_column - use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror - use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var - use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable + use decompInitMod , only : decompInit_lnd, decompInit_lnd3D + use decompMod , only : ldecomp, bounds_type, get_proc_bounds + use domainMod , only : ldomain, domain_init + use clm_varctl , only : use_soil_moisture_streams, single_column + use clm_varpar , only : nlevsoi + use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror + use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var + use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable ! input/output variables - type(ESMF_GridComp) , intent(inout) :: gcomp - type(ESMF_Mesh) , intent(out) :: mesh - integer , intent(out) :: ni,nj ! global grid dimensions - integer , intent(out) :: rc + character(len=CL) , intent(in) :: domain_file + type(ESMF_Mesh) , intent(out) :: mesh + integer , intent(out) :: ni,nj ! global grid dimensions + integer , intent(out) :: rc ! local variables - integer :: ncid, ierr - integer :: nv - integer :: dimid_ni, dimid_nj, dimid_nv - integer :: maxIndex(2) - real(r8) :: mincornerCoord(2) - real(r8) :: maxcornerCoord(2) - type(ESMF_Grid) :: lgrid - real(r8), allocatable :: xv(:,:,:), yv(:,:,:) - integer :: varid_xv, varid_yv - character(len=CL) :: cvalue - integer :: gsize - logical :: isgrid2d - integer :: numownedelements - integer, allocatable :: mask(:) + logical :: isgrid2d + integer :: g,n + integer :: nv + integer :: ncid, ierr + integer :: dimid_ni, dimid_nj, dimid_nv + integer :: maxIndex(2) + real(r8) :: mincornerCoord(2) + real(r8) :: maxcornerCoord(2) + type(ESMF_Grid) :: lgrid + real(r8), allocatable :: xv(:,:,:), yv(:,:,:) + integer :: varid_xv, varid_yv + integer :: numownedelements + integer, allocatable :: lnd_mask(:) + type(bounds_type) :: bounds ! bounds + integer :: begg,endg + integer :: nlnd + integer, pointer :: gindex_lnd(:) ! global index space for just land points !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! determine global 2d sizes - call NUOPC_CompAttributeGet(gcomp, name='lnd_ni', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) ni - call NUOPC_CompAttributeGet(gcomp, name='lnd_nj', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) nj - gsize = ni*nj - if (single_column) then - isgrid2d = .true. - else if (nj == 1) then - isgrid2d = .false. - else - isgrid2d = .true. - end if - if (masterproc) then - write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj - if (isgrid2d) then - write(iulog,'(a)') 'model grid is 2-dimensional' - else - write(iulog,'(a)') 'model grid is not 2-dimensional' - end if - end if - - ! get the datm grid from the domain file - call NUOPC_CompAttributeGet(gcomp, name='domain_lnd', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return ! open file - ierr = nf90_open(cvalue, NF90_NOWRITE, ncid) - call nc_check_err(ierr, 'nf90_open', trim(cvalue)) + ierr = nf90_open(domain_file, NF90_NOWRITE, ncid) + call nc_check_err(ierr, 'nf90_open', trim(domain_file)) ! get dimension ids ierr = nf90_inq_dimid(ncid, 'ni', dimid_ni) - call nc_check_err(ierr, 'nf90_inq_dimid for ni', trim(cvalue)) + call nc_check_err(ierr, 'nf90_inq_dimid for ni', trim(domain_file)) ierr = nf90_inq_dimid(ncid, 'nj', dimid_nj) - call nc_check_err(ierr, 'nf90_inq_dimid for nj', trim(cvalue)) + call nc_check_err(ierr, 'nf90_inq_dimid for nj', trim(domain_file)) ierr = nf90_inq_dimid(ncid, 'nv', dimid_nv) - call nc_check_err(ierr, 'nf90_inq_dimid for nv', trim(cvalue)) + call nc_check_err(ierr, 'nf90_inq_dimid for nv', trim(domain_file)) ! get dimension values ierr = nf90_inquire_dimension(ncid, dimid_ni, len=ni) - call nc_check_err(ierr, 'nf90_inq_dimension for ni', trim(cvalue)) + call nc_check_err(ierr, 'nf90_inq_dimension for ni', trim(domain_file)) ierr = nf90_inquire_dimension(ncid, dimid_nj, len=nj) - call nc_check_err(ierr, 'nf90_inq_dimension for nj', trim(cvalue)) + call nc_check_err(ierr, 'nf90_inq_dimension for nj', trim(domain_file)) ierr = nf90_inquire_dimension(ncid, dimid_nv, len=nv) - call nc_check_err(ierr, 'nf90_inq_dimension for nv', trim(cvalue)) + call nc_check_err(ierr, 'nf90_inq_dimension for nv', trim(domain_file)) ! get variable ids ierr = nf90_inq_varid(ncid, 'xv', varid_xv) - call nc_check_err(ierr, 'nf90_inq_varid for xv', trim(cvalue)) + call nc_check_err(ierr, 'nf90_inq_varid for xv', trim(domain_file)) ierr = nf90_inq_varid(ncid, 'yv', varid_yv) - call nc_check_err(ierr, 'nf90_inq_varid for yv', trim(cvalue)) + call nc_check_err(ierr, 'nf90_inq_varid for yv', trim(domain_file)) ! allocate memory for variables and get variable values allocate(xv(nv,ni,nj), yv(nv,ni,nj)) ierr = nf90_get_var(ncid, varid_xv, xv) - call nc_check_err(ierr, 'nf90_get_var for xv', trim(cvalue)) + call nc_check_err(ierr, 'nf90_get_var for xv', trim(domain_file)) ierr = nf90_get_var(ncid, varid_yv, yv) - call nc_check_err(ierr, 'nf90_get_var for yv', trim(cvalue)) + call nc_check_err(ierr, 'nf90_get_var for yv', trim(domain_file)) ! close file ierr = nf90_close(ncid) - call nc_check_err(ierr, 'nf90_close', trim(cvalue)) + call nc_check_err(ierr, 'nf90_close', trim(domain_file)) ! create the grid maxIndex(1) = ni ! number of lons maxIndex(2) = nj ! number of lats @@ -399,35 +283,126 @@ subroutine lnd_set_decomp_and_domain_from_newmesh(gcomp, mesh, ni, nj, rc) ! Set the mesh mask to 1 call ESMF_MeshGet(mesh, numOwnedElements=numOwnedElements, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(mask(numownedelements)) - mask(:) = 1 - call ESMF_MeshSet(mesh, elementMask=mask, rc=rc) + allocate(lnd_mask(numownedelements)) + lnd_mask(:) = 1 + call ESMF_MeshSet(mesh, elementMask=lnd_mask, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - deallocate(mask) + + ! Determine ldecomp and ldomain + call decompInit_lnd(lni=ni, lnj=nj, amask=lnd_mask) + if (use_soil_moisture_streams) then + call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) + end if + + ! Initialize processor bounds + call get_proc_bounds(bounds) + begg = bounds%begg + endg = bounds%endg + + ! Create ctsm gindex_lnd + nlnd = endg - begg + 1 + allocate(gindex_lnd(nlnd)) + do g = begg, endg + n = 1 + (g - begg) + gindex_lnd(n) = ldecomp%gdc2glo(g) + end do + + ! Initialize domain data structure + isgrid2d = .true. + call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + + ! Determine ldomain%mask and ldomain%frac + do g = begg, endg + ldomain%mask(g) = 1 + ldomain%frac(g) = 1._r8 + end do + deallocate(lnd_mask) end subroutine lnd_set_decomp_and_domain_from_newmesh !=============================================================================== - subroutine clm_getlandmask_from_ocnmesh(mesh_lnd, mesh_ocn, lsize_lnd, lndmask_loc, lndfrac_loc, distgrid_lnd, rc) + subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) + + ! Determine global 2d sizes from read of dimensions of surface dataset + + use clm_varctl , only : fsurdat, single_column + use fileutils , only : getfil + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen + use abortutils , only : endrun + use shr_log_mod , only : errMsg => shr_log_errMsg + + ! input/output variables + integer, intent(out) :: ni + integer, intent(out) :: nj + integer, intent(out) :: gsize + logical, intent(out) :: isgrid2d + + ! local variables + character(len=CL) :: locfn + type(file_desc_t) :: ncid ! netcdf file id + integer :: dimid ! netCDF dimension id + logical :: readvar ! read variable in or not + !------------------------------------------------------------------------------- + + if (masterproc) then + write(iulog,*) 'Attempting to global dimensions from surface dataset' + if (fsurdat == ' ') then + write(iulog,*)'fsurdat must be specified' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + endif + call getfil(fsurdat, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') + call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') + call ncd_pio_closefile(ncid) + gsize = ni*nj + if (single_column) then + isgrid2d = .true. + else if (nj == 1) then + isgrid2d = .false. + else + isgrid2d = .true. + end if + if (masterproc) then + write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj + if (isgrid2d) then + write(iulog,'(a)') 'model grid is 2-dimensional' + else + write(iulog,'(a)') 'model grid is not 2-dimensional' + end if + end if + + end subroutine lnd_get_global_dims + + !=============================================================================== + subroutine lnd_get_lndmask_from_ocnmesh(mesh_lnd, mesh_ocn, vm, gsize, lndmask_glob, lndfrac_glob, rc) ! input/out variables type(ESMF_Mesh) , intent(in) :: mesh_lnd type(ESMF_Mesh) , intent(in) :: mesh_ocn - integer , pointer :: lndmask_loc(:) - real(r8) , pointer :: lndfrac_loc(:) - integer , intent(out) :: lsize_lnd - type(ESMF_DistGrid) , intent(out) :: distgrid_lnd + type(ESMF_VM) , intent(in) :: vm + integer , intent(in) :: gsize + integer , pointer :: lndmask_glob(:) + real(r8) , pointer :: lndfrac_glob(:) integer , intent(out) :: rc ! local variables: + type(ESMF_DistGrid) :: distgrid_lnd type(ESMF_RouteHandle) :: rhandle_ocn2lnd type(ESMF_Field) :: field_lnd type(ESMF_Field) :: field_ocn type(ESMF_DistGrid) :: distgrid_ocn + integer , pointer :: gindex_input(:) ! global index space for land and ocean points + integer , pointer :: lndmask_loc(:) + integer , pointer :: itemp_glob(:) + real(r8) , pointer :: rtemp_glob(:) + real(r8) , pointer :: lndfrac_loc(:) real(r8) , pointer :: ocnmask_loc(:) ! on ocean mesh real(r8) , pointer :: ocnfrac_loc(:) ! on land mesh real(r8) , pointer :: dataptr1d(:) type(ESMF_Array) :: elemMaskArray + integer :: lsize_lnd integer :: lsize_ocn integer :: n, spatialDim integer :: srcMaskValue = 0 @@ -493,51 +468,203 @@ subroutine clm_getlandmask_from_ocnmesh(mesh_lnd, mesh_ocn, lsize_lnd, lndmask_l lndmask_loc(n) = 0 end if enddo - - ! deallocate memory call ESMF_FieldDestroy(field_lnd) call ESMF_FieldDestroy(field_ocn) + + ! determine global landmask_glob - needed to determine the ctsm decomposition + ! land frac, lats, lons and areas will be done below + allocate(gindex_input(lsize_lnd)) + call ESMF_DistGridGet(distgrid_lnd, 0, seqIndexList=gindex_input, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1,lsize_lnd + lndmask_glob(gindex_input(n)) = lndmask_loc(n) + end do + allocate(itemp_glob(gsize)) + call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndmask_glob(:) = int(itemp_glob(:)) + deallocate(itemp_glob) + + ! Determine ldomain%frac using both input and ctsm decompositions + ! lndfrac_glob is filled using the input decomposition and + ! ldomin%frac is set using the ctsm decomposition + allocate(rtemp_glob(gsize)) + do n = 1,lsize_lnd + lndfrac_glob(gindex_input(n)) = lndfrac_loc(n) + end do + call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndfrac_glob(:) = rtemp_glob(:) + deallocate(rtemp_glob) + + ! deallocate memory deallocate(ocnmask_loc) + deallocate(lndmask_loc) + deallocate(lndfrac_loc) - end subroutine clm_getlandmask_from_ocnmesh + end subroutine lnd_get_lndmask_from_ocnmesh !=============================================================================== - subroutine clm_getlandmask_from_lndmesh(mesh_lnd, lsize, lndmask_loc, lndfrac_loc, distgrid_lnd, rc) + subroutine lnd_get_lndmask_from_lndmesh(mesh_lnd, vm, gsize, lndmask_glob, lndfrac_glob, rc) ! input/out variables type(ESMF_Mesh) , intent(in) :: mesh_lnd - integer , intent(out) :: lsize - integer , pointer :: lndmask_loc(:) - real(r8) , pointer :: lndfrac_loc(:) - type(ESMF_DistGrid) , intent(out) :: distgrid_lnd + type(ESMF_VM) , intent(in) :: vm + integer , intent(in) :: gsize + integer , pointer :: lndmask_glob(:) + real(r8) , pointer :: lndfrac_glob(:) integer , intent(out) :: rc ! local variables: - type(ESMF_Array) :: elemMaskArray + integer :: n + integer :: lsize + integer , pointer :: gindex(:) + integer , pointer :: lndmask_loc(:) + integer , pointer :: itemp_glob(:) + type(ESMF_DistGrid) :: distgrid + type(ESMF_Array) :: elemMaskArray !------------------------------------------------------------------------------- rc = ESMF_SUCCESS ! Determine lsize and distgrid_lnd - call ESMF_MeshGet(mesh_lnd, elementdistGrid=distgrid_lnd, rc=rc) + call ESMF_MeshGet(mesh_lnd, elementdistGrid=distgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_DistGridGet(distgrid_lnd, localDe=0, elementCount=lsize, rc=rc) + call ESMF_DistGridGet(distgrid, localDe=0, elementCount=lsize, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Determine lndfrac_loc + ! Determine lndmask_loc ! The call to ESMF_MeshGet fills in the values of lndmask_loc allocate(lndmask_loc(lsize)) - elemMaskArray = ESMF_ArrayCreate(distgrid_lnd, lndmask_loc, rc=rc) + elemMaskArray = ESMF_ArrayCreate(distgrid, lndmask_loc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_MeshGet(mesh_lnd, elemMaskArray=elemMaskArray, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Determine lndmask_loc + ! Determine global landmask_glob - needed to determine the ctsm decomposition + ! land frac, lats, lons and areas will be done below + allocate(gindex(lsize)) + allocate(itemp_glob(gsize)) + call ESMF_DistGridGet(distgrid, 0, seqIndexList=gindex, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1,lsize + lndmask_glob(gindex(n)) = lndmask_loc(n) + end do + call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + lndmask_glob(:) = int(itemp_glob(:)) + deallocate(itemp_glob) + deallocate(gindex) + deallocate(lndmask_loc) + ! ASSUME that land fraction is identical to land mask in this case - allocate(lndfrac_loc(lsize)) - lndfrac_loc(:) = lndmask_loc(:) + lndfrac_glob(:) = lndmask_glob(:) + + end subroutine lnd_get_lndmask_from_lndmesh + + !=============================================================================== + subroutine lnd_set_ldomain_gridinfo(mesh, vm, gindex, bounds, isgrid2d, ni, nj, ldomain, rc) + + use domainMod , only : domain_type, lon1d, lat1d + use decompMod , only : bounds_type, get_proc_bounds + use clm_varcon , only : re + + ! input/output variables + type(ESMF_Mesh) , intent(in) :: mesh + type(ESMF_VM) , intent(in) :: vm + integer , intent(in) :: gindex(:) + type(bounds_type) , intent(in) :: bounds + logical , intent(in) :: isgrid2d + integer , intent(in) :: ni,nj + type(domain_type) , intent(inout) :: ldomain + integer , intent(out) :: rc + + ! local variables + integer :: g,n + integer :: gsize + integer :: begg,endg + integer :: numownedelements + real(r8) , pointer :: lndlats_glob(:) + real(r8) , pointer :: lndlons_glob(:) + real(r8) , pointer :: rtemp_glob(:) + real(r8) , pointer :: ownedElemCoords(:) + integer :: spatialDim + real(r8) , pointer :: dataptr1d(:) + type(ESMF_Field) :: areaField + !------------------------------------------------------------------------------- - end subroutine clm_getlandmask_from_lndmesh + rc = ESMF_SUCCESS + + begg = bounds%begg + endg = bounds%endg + + ! Determine ldoman%latc and ldomain%lonc + call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(ownedElemCoords(spatialDim*numownedelements)) + call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg,endg + n = g - begg + 1 + ldomain%lonc(g) = ownedElemCoords(2*n-1) + if (ldomain%lonc(g) == 360._r8) ldomain%lonc(g) = 0._r8 ! TODO: why the difference? + ldomain%latc(g) = ownedElemCoords(2*n) + end do + + ! Create ldomain%area by querying the mesh on the ctsm decomposition + areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldRegridGetArea(areaField, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(areaField, farrayPtr=dataptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = begg, endg + ldomain%area(g) = dataptr1d(g-begg+1) * (re*re) + end do + call ESMF_FieldDestroy(areaField) + + ! If grid is 2d, determine lon1d and lat1d + if (isgrid2d) then + gsize = ni*nj + allocate(rtemp_glob(gsize)) + + ! Determine lon1d + allocate(lndlons_glob(gsize)) + lndlons_glob(:) = 0._r8 + do n = 1,numownedelements + if (ownedElemCoords(2*n-1) == 360._r8) then ! TODO: why is this needed? + lndlons_glob(gindex(n)) = 0._r8 + else + lndlons_glob(gindex(n)) = ownedElemCoords(2*n-1) + end if + end do + call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + deallocate(lndlons_glob) + allocate(lon1d(ni)) + do n = 1,ni + lon1d(n) = rtemp_glob(n) + end do + + ! Determine lat1d + allocate(lndlats_glob(gsize)) + lndlats_glob(:) = 0._r8 + do n = 1,numownedelements + lndlats_glob(gindex(n)) = ownedElemCoords(2*n) + end do + call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, & + reduceflag=ESMF_REDUCE_SUM, rc=rc) + deallocate(lndlats_glob) + allocate(lat1d(nj)) + do n = 1,nj + lat1d(n) = rtemp_glob((n-1)*ni + 1) + end do + deallocate(rtemp_glob) + end if + + end subroutine lnd_set_ldomain_gridinfo !=============================================================================== subroutine nc_check_err(ierror, description, filename) @@ -556,4 +683,18 @@ subroutine nc_check_err(ierror, description, filename) endif end subroutine nc_check_err + !=============================================================================== + logical function chkerr(rc, line, file) + integer , intent(in) :: rc + integer , intent(in) :: line + character(len=*) , intent(in) :: file + + integer :: lrc + chkerr = .false. + lrc = rc + if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=line, file=file)) then + chkerr = .true. + endif + end function chkerr + end module lnd_set_decomp_and_domain From 264adb65bb1a30abd665b2c79e251cb68a12dc07 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 28 Dec 2020 19:58:57 -0700 Subject: [PATCH 1733/1973] updates to have share code --- cime_config/buildlib | 3 + src/cpl/lilac/lnd_import_export.F90 | 587 ++++++--------- src/cpl/nuopc/lnd_set_decomp_and_domain.F90 | 700 ------------------ .../lnd_set_decomp_and_domain.F90 | 43 +- 4 files changed, 255 insertions(+), 1078 deletions(-) delete mode 100644 src/cpl/nuopc/lnd_set_decomp_and_domain.F90 rename src/cpl/{lilac => share_esmf}/lnd_set_decomp_and_domain.F90 (94%) diff --git a/cime_config/buildlib b/cime_config/buildlib index 1b32e401ed..55c47be4e9 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -133,6 +133,9 @@ def _main_func(): # to use its directories in place of stub_rof paths.append(os.path.join(lnd_root,"lilac","stub_rof")) + if (driver == 'lilac' or driver == 'nuopc'): + paths.append(os.path.join(lnd_root,"src","cpl","share_esmf")) + with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) filepath.write("\n") diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 581bdbedc8..95c5d6426f 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -27,14 +27,80 @@ module lnd_import_export private :: state_setexport private :: state_getfldptr + ! import fields + character(*), parameter :: Sa_z = 'Sa_z' + character(*), parameter :: Sa_topo = 'Sa_topo' + character(*), parameter :: Sa_u = 'Sa_u' + character(*), parameter :: Sa_v = 'Sa_v' + character(*), parameter :: Sa_ptem = 'Sa_ptem' + character(*), parameter :: Sa_shum = 'Sa_shum' + character(*), parameter :: Sa_pbot = 'Sa_pbot' + character(*), parameter :: Sa_tbot = 'Sa_tbot' + character(*), parameter :: Sa_methane = 'Sa_methane' + character(*), parameter :: Faxa_rainc = 'Faxa_rainc' + character(*), parameter :: Faxa_rainl = 'Faxa_rainl' + character(*), parameter :: Faxa_snowc = 'Faxa_snowc' + character(*), parameter :: Faxa_snowl = 'Faxa_snowl' + character(*), parameter :: Faxa_lwdn = 'Faxa_lwdn' + character(*), parameter :: Faxa_swvdr = 'Faxa_swvdr' + character(*), parameter :: Faxa_swndr = 'Faxa_swndr' + character(*), parameter :: Faxa_swvdf = 'Faxa_swvdf' + character(*), parameter :: Faxa_swndf = 'Faxa_swndf' + character(*), parameter :: Faxa_bcphidry = 'Faxa_bcphidry' + character(*), parameter :: Faxa_bcphodry = 'Faxa_bcphodry' + character(*), parameter :: Faxa_bcphiwet = 'Faxa_bcphiwet' + character(*), parameter :: Faxa_ocphidry = 'Faxa_ocphidry' + character(*), parameter :: Faxa_ocphodry = 'Faxa_ocphodry' + character(*), parameter :: Faxa_ocphiwet = 'Faxa_ocphiwet' + character(*), parameter :: Faxa_dstwet1 = 'Faxa_dstwet1' + character(*), parameter :: Faxa_dstwet2 = 'Faxa_dstwet2' + character(*), parameter :: Faxa_dstwet3 = 'Faxa_dstwet3' + character(*), parameter :: Faxa_dstwet4 = 'Faxa_dstwet4' + character(*), parameter :: Faxa_dstdry1 = 'Faxa_dstdry1' + character(*), parameter :: Faxa_dstdry2 = 'Faxa_dstdry2' + character(*), parameter :: Faxa_dstdry3 = 'Faxa_dstdry3' + character(*), parameter :: Faxa_dstdry3 = 'Faxa_dstdry4' + character(*), parameter :: Faxa_ndep = 'Faxa_ndep' + + ! export fields + character(*), parameter :: Sl_t = 'Sl_t' + character(*), parameter :: Sl_snowh = 'Sl_snowh' + character(*), parameter :: Sl_avsdr = 'Sl_avsdr' + character(*), parameter :: Sl_anidr = 'Sl_anidr' + character(*), parameter :: Sl_avsdf = 'Sl_avsdf' + character(*), parameter :: Sl_anidf = 'Sl_anidf' + character(*), parameter :: Sl_tref = 'Sl_tref' + character(*), parameter :: Sl_qref = 'Sl_qref' + character(*), parameter :: Sl_u10 = 'Sl_u10' + character(*), parameter :: Sl_ram1 = 'Sl_ram1' + character(*), parameter :: Sl_fv = 'Sl_fv' + character(*), parameter :: Sl_z0m = 'Sl_z0m' + character(*), parameter :: Sl_soilw = 'Sl_soilw' + character(*), parameter :: Sl_ddvel = 'Sl_ddvel' + character(*), parameter :: Sl_fztop = 'Sl_fztop' + character(*), parameter :: Fall_taux = 'Fall_taux' + character(*), parameter :: Fall_tauy = 'Fall_tauy' + character(*), parameter :: Fall_lat = 'Fall_lat' + character(*), parameter :: Fall_sen = 'Fall_sen' + character(*), parameter :: Fall_lwup = 'Fall_lwup' + character(*), parameter :: Fall_evap = 'Fall_evap' + character(*), parameter :: Fall_swnet = 'Fall_swnet' + character(*), parameter :: Fall_flxdst = 'Fall_flxdst' + character(*), parameter :: Fall_methane = 'Fall_methane' + character(*), parameter :: Fall_voc = 'Fall_voc' + character(*), parameter :: Fall_fire = 'Fall_fire' + character(*), parameter :: Flrl_rofsur = 'Flrl_rofsur' + character(*), parameter :: Flrl_rofsub = 'Flrl_rofsub' + character(*), parameter :: Flrl_rofgwl = 'Flrl_rofgwl' + character(*), parameter :: Flrl_rofi = 'Flrl_rofi' + character(*), parameter :: Flrl_irrig = 'Flrl_irrig' + ! from atm->lnd integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn ! from lnd->atm integer :: drydep_nflds ! number of dry deposition velocity fields lnd-> atm integer :: emis_nflds ! number of fire emission fields from lnd-> atm - - integer :: glc_nec = 10 ! number of glc elevation classes integer, parameter :: debug = 0 ! internal debug level character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" @@ -101,129 +167,80 @@ subroutine import_fields( importState, bounds, first_call, rc) ! Required atmosphere input fields !-------------------------- - call state_getimport(importState, 'c2l_fb_atm', 'Sa_z', bounds, & - output=atm2lnd_inst%forc_hgt_grc, rc=rc) + call state_getimport_1d(importState, Sa_z , atm2lnd_inst%forc_hgt_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Sa_topo', bounds, & - output=atm2lnd_inst%forc_topo_grc, rc=rc) + call state_getimport_1d(importState, Sa_topo , atm2lnd_inst%forc_topo_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Sa_u', bounds, & - output=atm2lnd_inst%forc_u_grc, rc=rc ) + call state_getimport_1d(importState, Sa_u , atm2lnd_inst%forc_u_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Sa_v', bounds, & - output=atm2lnd_inst%forc_v_grc, rc=rc ) + call state_getimport_1d(importState, Sa_v , atm2lnd_inst%forc_v_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Sa_ptem', bounds, & - output=atm2lnd_inst%forc_th_not_downscaled_grc, rc=rc) + call state_getimport_1d(importState, Sa_shum , wateratm2lndbulk_inst%forc_q_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Sa_shum', bounds, & - output=water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc, rc=rc) + call state_getimport_1d(importState, Sa_ptem , atm2lnd_inst%forc_th_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Sa_pbot', bounds, & - output=atm2lnd_inst%forc_pbot_not_downscaled_grc, rc=rc) + call state_getimport_1d(importState, Sa_pbot , atm2lnd_inst%forc_pbot_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Sa_tbot', bounds, & - output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) + call state_getimport_1d(importState, Sa_tbot , atm2lnd_inst%forc_t_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainc', bounds, & - output=forc_rainc, rc=rc ) + call state_getimport_1d(importState, Faxa_rainc, forc_rainc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainl', bounds, & - output=forc_rainl, rc=rc ) + call state_getimport_1d(importState, Faxa_rainl, forc_rainl(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowc', bounds, & - output=forc_snowc, rc=rc ) + call state_getimport_1d(importState, Faxa_snowc, forc_snowc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowl', bounds, & - output=forc_snowl, rc=rc ) + call state_getimport_1d(importState, Faxa_snowl, forc_snowl(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_lwdn', bounds, & - output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) + call state_getimport_1d(importState, Faxa_lwdn , atm2lnd_inst%forc_lwrad_not_downscaled_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swvdr', bounds, & - output=atm2lnd_inst%forc_solad_grc(:,1), rc=rc) + call state_getimport_1d(importState, Faxa_swvdr, atm2lnd_inst%forc_solad_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swndr', bounds, & - output=atm2lnd_inst%forc_solad_grc(:,2), rc=rc) + call state_getimport_1d(importState, Faxa_swndr, atm2lnd_inst%forc_solad_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swvdf', bounds, & - output=atm2lnd_inst%forc_solai_grc(:,1), rc=rc ) + call state_getimport_1d(importState, Faxa_swvdf, atm2lnd_inst%forc_solai_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swndf', bounds, & - output=atm2lnd_inst%forc_solai_grc(:,2), rc=rc ) + call state_getimport_1d(importState, Faxa_swndf, atm2lnd_inst%forc_solai_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ! Atmosphere prognostic/prescribed aerosol fields - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphidry', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,1), rc=rc) + call state_getimport_1d(importState, Faxa_bcphidry, atm2lnd_inst%forc_aer_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphodry', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,2), rc=rc) + call state_getimport_1d(importState, Faxa_bcphodry, atm2lnd_inst%forc_aer_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphiwet', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,3), rc=rc) + call state_getimport_1d(importState, Faxa_bcphiwet, atm2lnd_inst%forc_aer_grc(begg:,3), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphidry', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,4), rc=rc) + call state_getimport_1d(importState, Faxa_ocphidry, atm2lnd_inst%forc_aer_grc(begg:,4), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphodry', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,5), rc=rc) + call state_getimport_1d(importState, Faxa_ocphodry, atm2lnd_inst%forc_aer_grc(begg:,5), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphiwet', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,6), rc=rc) + call state_getimport_1d(importState, Faxa_ocphiwet, atm2lnd_inst%forc_aer_grc(begg:,6), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet1', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,7), rc=rc) + call state_getimport_1d(importState, Faxa_dstwet1, output=atm2lnd_inst%forc_aer_grc(begg:,7), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry1', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,8), rc=rc) + call state_getimport_1d(importState, Faxa_dstwet2, output=atm2lnd_inst%forc_aer_grc(begg:,9), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet2', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,9), rc=rc) + call state_getimport_1d(importState, Faxa_dstwet3, output=atm2lnd_inst%forc_aer_grc(begg:,11), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry2', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,10), rc=rc) + call state_getimport_1d(importState, Faxa_dstwet4, output=atm2lnd_inst%forc_aer_grc(begg:,13), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet3', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,11), rc=rc) + + call state_getimport_1d(importState, Faxa_dstdry1, output=atm2lnd_inst%forc_aer_grc(begg:,8), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry3', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,12), rc=rc) + call state_getimport_1d(importState, Faxa_dstdry2, output=atm2lnd_inst%forc_aer_grc(begg:,10), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet4', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,13), rc=rc) + call state_getimport_1d(importState, Faxa_dstdry3, output=atm2lnd_inst%forc_aer_grc(begg:,12), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry4', bounds, & - output=atm2lnd_inst%forc_aer_grc(:,14), rc=rc) + call state_getimport_1d(importState, Faxa_dstdry4, output=atm2lnd_inst%forc_aer_grc(begg:,14), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'c2l_fb_atm', 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + !call state_getimport_1d(importState, Sa_methane, atm2lnd_inst%forc_pch4_grc(begg:), rc=rc) + !if (ChkErr(rc,__LINE__,u_FILE_u)) return ! The lilac is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec ! so the following conversion needs to happen - ! call state_getimport(importState, 'c2l_fb_atm', 'Faxa_nhx', bounds, output=forc_nhx, rc=rc ) + ! call state_getimport_1d(importState, Faxa_nhx, output=forc_nhx(begg:), rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport(importState, 'c2l_fb_atm', 'Faxa_noy', bounds, output=forc_noy, rc=rc ) + ! call state_getimport_1d(importState, Faxa_nhy, output=forc_nhy(begg:), rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! do g = begg,endg ! atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 @@ -316,139 +333,102 @@ subroutine export_fields(exportState, bounds, rc) ! local variables integer :: i, g, num + integer :: begg, endg real(r8) :: array(bounds%begg:bounds%endg) + character(len=CS) :: cnum character(len=*), parameter :: subname='(lnd_import_export:export_fields)' !--------------------------------------------------------------------------- rc = ESMF_SUCCESS + begg = bounds%begg + endg = bounds%endg + ! ----------------------- ! output to atm ! ----------------------- - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_t', bounds, & - input=lnd2atm_inst%t_rad_grc, rc=rc) + call state_setexport_1d(exportState, Sl_t , lnd2atm_inst%t_rad_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_snowh', bounds, & - input=water_inst%waterlnd2atmbulk_inst%h2osno_grc, rc=rc) + call state_setexport_1d(exportState, Sl_snowh , waterlnd2atmbulk_inst%h2osno_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_avsdr', bounds, & - input=lnd2atm_inst%albd_grc(bounds%begg:,1), rc=rc) + call state_setexport_1d(exportState, Sl_avsdr , lnd2atm_inst%albd_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_anidr', bounds, & - input=lnd2atm_inst%albd_grc(bounds%begg:,2), rc=rc) + call state_setexport_1d(exportState, Sl_anidr , lnd2atm_inst%albd_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_avsdf', bounds, & - input=lnd2atm_inst%albi_grc(bounds%begg:,1), rc=rc) + call state_setexport_1d(exportState, Sl_avsdf , lnd2atm_inst%albi_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_anidf', bounds, & - input=lnd2atm_inst%albi_grc(bounds%begg:,2), rc=rc) + call state_setexport_1d(exportState, Sl_anidf , lnd2atm_inst%albi_grc(begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_tref', bounds, & - input=lnd2atm_inst%t_ref2m_grc, rc=rc) + call state_setexport_1d(exportState, Sl_tref , lnd2atm_inst%t_ref2m_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_qref', bounds, & - input=water_inst%waterlnd2atmbulk_inst%q_ref2m_grc, rc=rc) + call state_setexport_1d(exportState, Sl_qref , waterlnd2atmbulk_inst%q_ref2m_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_u10', bounds, & - input=lnd2atm_inst%u_ref10m_grc, rc=rc) + call state_setexport_1d(exportState, Sl_u10 , lnd2atm_inst%u_ref10m_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_taux', bounds, & - input=lnd2atm_inst%taux_grc, minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_taux , lnd2atm_inst%taux_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_tauy', bounds, & - input=lnd2atm_inst%tauy_grc, minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_tauy , lnd2atm_inst%tauy_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_lat', bounds, & - input=lnd2atm_inst%eflx_lh_tot_grc, minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_lat , lnd2atm_inst%eflx_lh_tot_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_sen', bounds, & - input=lnd2atm_inst%eflx_sh_tot_grc, minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_sen , lnd2atm_inst%eflx_sh_tot_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_lwup', bounds, & - input=lnd2atm_inst%eflx_lwrad_out_grc, minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_lwup , lnd2atm_inst%eflx_lwrad_out_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_evap', bounds, & - input=water_inst%waterlnd2atmbulk_inst%qflx_evap_tot_grc, minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_evap , waterlnd2atmbulk_inst%qflx_evap_tot_grc(begg:), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_swnet', bounds, & - input=lnd2atm_inst%fsa_grc, rc=rc) + call state_setexport_1d(exportState, Fall_swnet , lnd2atm_inst%fsa_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst1', bounds, & - input=lnd2atm_inst%flxdst_grc(:,1), minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_flxdst1 , lnd2atm_inst%flxdst_grc(begg:,1), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst2', bounds, & - input=lnd2atm_inst%flxdst_grc(:,2), minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_flxdst2 , lnd2atm_inst%flxdst_grc(begg:,2), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst3', bounds, & - input=lnd2atm_inst%flxdst_grc(:,3), minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_flxdst3 , lnd2atm_inst%flxdst_grc(begg:,3), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst4', bounds, & - input=lnd2atm_inst%flxdst_grc(:,4), minus=.true., rc=rc) + call state_setexport_1d(exportState, Fall_flxdst4 , lnd2atm_inst%flxdst_grc(begg:,4), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_ram1', bounds, & - input=lnd2atm_inst%ram1_grc, rc=rc) + call state_setexport_1d(exportState, Sl_ram1 , lnd2atm_inst%ram1_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_fv', bounds, & - input=lnd2atm_inst%fv_grc, rc=rc) + call state_setexport_1d(exportState, Sl_fv , lnd2atm_inst%fv_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_setexport(exportState, 'l2c_fb_atm', 'Sl_z0m', bounds, & - input=lnd2atm_inst%z0m_grc, rc=rc) + call state_setexport_1d(exportState, Sl_z0m , lnd2atm_inst%z0m_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! methanem - ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_methane', bounds, & - ! input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) + ! methane + ! call state_setexport_1d(exportState, Fall_methane , lnd2atm_inst%flux_ch4_grc(begg:), minus=.true., rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! soil water - ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_soilw', bounds, & - ! input=water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) + ! call state_setexport_1d(exportState, Sl_soilw , water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(begg:,1), rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! dry dep velocities ! do num = 1, drydep_nflds - ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_ddvel', bounds, & - ! input=lnd2atm_inst%ddvel_grc(:,num), ungridded_index=num, rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! write(cnum,'(i0)') num + ! call state_setexport_1d(exportState, trim(Sl_ddvel)//trim(cnum), & + ! lnd2atm_inst%ddvel_grc(begg:,num), rc=rc) ! end do ! MEGAN VOC emis fluxes ! do num = 1, shr_megan_mechcomps_n - ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_voc', bounds, & - ! input=lnd2atm_inst%flxvoc_grc(:,num), minus=.true., ungridded_index=num, rc=rc) + ! write(cnum,'(i0)') num + ! call state_setexport_1d(exportState, trim(Fall_voc)//trim(cnum), & + ! lnd2atm_inst%flxvoc_grc(begg:,num), minus=.true., rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! end do ! fire emis fluxes ! do num = 1, emis_nflds - ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_fire', bounds, & - ! input=lnd2atm_inst%fireflx_grc(:,num), minus=.true., ungridded_index=num, rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! end do + ! write(cnum,'(i0)') num + ! call state_setexport_2d(exportState, trim(Fall_fire)//trim(cnum), lnd2atm_inst%fireflx_grc(begg:,num), & + ! minus = .true., rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! if (emis_nflds > 0) then - ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_fztopo', bounds, input=lnd2atm_inst%fireztop_grc, rc=rc) + ! call state_setexport_1d(exportState, Sl_fztop, lnd2atm_inst%fireztop_grc(begg:), rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! endif + ! end if + ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. ! i.e. water sent from land to rof is positive @@ -457,211 +437,118 @@ subroutine export_fields(exportState, bounds, rc) ! ----------------------- ! surface runoff is the sum of qflx_over, qflx_h2osfc_surf - ! do g = bounds%begg,bounds%endg + ! do g = begg,endg ! array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + & ! water_inst%waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) ! end do - call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofsur', bounds, & - input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) + call state_setexport_1d(exportState, Flrl_rofsur, waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - do g = bounds%begg,bounds%endg + do g = begg,endg array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & water_inst%waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) end do - call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofsub', bounds, & - input=array, rc=rc) + call state_setexport_1d(exportState, Flrl_rofsub, array(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! qgwl sent individually to coupler - call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofgwl', bounds, & - input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) + call state_setexport_1d(exportState, Flrl_rofgwl, waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ice sent individually to coupler - call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofi', bounds, & - input=water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) + call state_setexport_1d(exportState, Flrl_rofi, waterlnd2atmbulk_inst%qflx_rofice_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! irrigation flux to be removed from main channel storage (negative) - call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_irrig', bounds, & - input=water_inst%waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) + call state_setexport_1d(exportState, Flrl_irrig, waterlnd2atmbulk_inst%qirrig_grc(begg:), & + minus = .true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine export_fields !=============================================================================== + subroutine state_getimport_1d(state, fldname, ctsmdata, rc) - subroutine state_getimport(state, fb, fldname, bounds, output, ungridded_index, rc) + ! fill in ctsm import data for 1d field - ! ---------------------------------------------- - ! Map import state field to output array - ! ---------------------------------------------- + use ESMF, only : ESMF_LOGERR_PASSTHRU, ESMF_END_ABORT, ESMF_LogFoundError + use ESMF, only : ESMF_Finalize - ! input/output variables - type(ESMF_State) , intent(in) :: state - character(len=*) , intent(in) :: fb - character(len=*) , intent(in) :: fldname - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(out) :: output(bounds%begg:bounds%endg) - integer, optional , intent(in) :: ungridded_index - integer , intent(out) :: rc + ! input/output variabes + type(ESMF_State) , intent(in) :: state + character(len=*) , intent(in) :: fldname + real(r8) , intent(inout) :: ctsmdata(:) + integer , intent(out) :: rc ! local variables - integer :: g, i,n - real(R8), pointer :: fldptr1d(:) - real(R8), pointer :: fldptr2d(:,:) - character(len=cs) :: cvalue - character(len=*), parameter :: subname='(lnd_import_export:state_getimport)' + real(r8), pointer :: fldPtr1d(:) + integer :: g + character(len=*), parameter :: subname='(lnd_import_export:state_getimport_1d)' ! ---------------------------------------------- rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - - if (masterproc .and. debug > 0) then - write(iulog,F01)' Show me what is in the state? for '//trim(fldname) - call ESMF_StatePrint(state, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - ! Get the pointer to data in the field - if (present(ungridded_index)) then - write(cvalue,*) ungridded_index - call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname)//" index "//trim(cvalue), & - ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fb), trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname),ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fb), trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - ! Fill in output array - if (present(ungridded_index)) then - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr2d(ungridded_index,n) - end do - else - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - output(g) = fldptr1d(n) - if (masterproc .and. debug > 0 .and. get_nstep() < 5) then - write(iulog,F02)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) - end if - end do - end if - - ! Write debug output if appropriate - if (masterproc .and. debug > 0 .and. get_nstep() < 5) then - do g = bounds%begg,bounds%endg - i = 1 + g - bounds%begg - write(iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) - end do - end if - - ! Check for nans - call check_for_nans(output, trim(fldname), bounds%begg) + call state_getfldptr(State, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + do g = 1,size(ctsmdata) + ctsmdata(g) = fldptr1d(g) + end do + call check_for_nans(ctsmdata, trim(fldname), 1) - end subroutine state_getimport + end subroutine state_getimport_1d !=============================================================================== + subroutine state_setexport_1d(state, fldname, ctsmdata, minus, rc) - subroutine state_setexport(state, fb, fldname, bounds, input, minus, ungridded_index, rc) + ! fill in ctsm export data for 1d field - ! ---------------------------------------------- - ! Map input array to export state field - ! ---------------------------------------------- + use ESMF, only : ESMF_LOGERR_PASSTHRU, ESMF_END_ABORT, ESMF_LogFoundError + use ESMF, only : ESMF_Finalize - ! input/output variables - type(ESMF_State) , intent(inout) :: state - character(len=*) , intent(in) :: fb - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: fldname - real(r8) , intent(in) :: input(bounds%begg:bounds%endg) - logical, optional , intent(in) :: minus - integer, optional , intent(in) :: ungridded_index - integer , intent(out) :: rc + ! input/output variabes + type(ESMF_State) , intent(in) :: state + character(len=*) , intent(in) :: fldname + real(r8) , intent(in) :: ctsmdata(:) + logical, optional, intent(in) :: minus + integer , intent(out):: rc ! local variables - logical :: l_minus ! local version of minus - integer :: g, i, n - real(R8), pointer :: fldptr1d(:) - real(R8), pointer :: fldptr2d(:,:) - character(len=cs) :: cvalue - character(len=*), parameter :: subname='(lnd_import_export:state_setexport)' + real(r8), pointer :: fldPtr1d(:) + integer :: g + character(len=*), parameter :: subname='(lnd_export_export:state_setexport_1d)' ! ---------------------------------------------- - rc = ESMF_SUCCESS - - l_minus = .false. + call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 if (present(minus)) then - l_minus = minus - end if - - ! get field pointer - if (present(ungridded_index)) then - call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname)//" index "//trim(cvalue), & - ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fb), trim(fldname), fldptr2d=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname), ESMF_LOGMSG_INFO) - call state_getfldptr(state, trim(fb), trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - - ! determine output array - if (present(ungridded_index)) then - fldptr2d(ungridded_index,:) = fillvalue - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - if (l_minus) then - fldptr2d(ungridded_index,n) = -input(g) - else - fldptr2d(ungridded_index,n) = input(g) - end if + do g = 1,size(ctsmdata) + fldptr1d(g) = -ctsmdata(g) end do else - fldptr1d(:) = fillvalue - do g = bounds%begg, bounds%endg - n = g - bounds%begg + 1 - if (l_minus) then - fldptr1d(n) = -input(g) - else - fldptr1d(n) = input(g) - end if - end do - end if - - ! write debug output if appropriate - if (masterproc .and. debug > 0 .and. get_nstep() < 5) then - do g = bounds%begg,bounds%endg - i = 1 + g - bounds%begg - write(iulog,F01)'export: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,input(g) + do g = 1,size(ctsmdata) + fldptr1d(g) = ctsmdata(g) end do end if + call check_for_nans(ctsmdata, trim(fldname), 1) - ! check for nans - call check_for_nans(input, trim(fldname), bounds%begg) - - end subroutine state_setexport + end subroutine state_setexport_1d !=============================================================================== - - subroutine state_getfldptr(State, fb, fldname, fldptr1d, fldptr2d, rc) + subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) ! ---------------------------------------------- ! Get pointer to a state field ! ---------------------------------------------- + use ESMF , only : ESMF_State, ESMF_Field, ESMF_Mesh, ESMF_FieldStatus_Flag + use ESMF , only : ESMF_StateGet, ESMF_FieldGet, ESMF_MeshGet + use ESMF , only : ESMF_FIELDSTATUS_COMPLETE, ESMF_FAILURE + ! input/output variables type(ESMF_State), intent(in) :: State - character(len=*), intent(in) :: fb character(len=*), intent(in) :: fldname real(R8), pointer, optional , intent(out) :: fldptr1d(:) real(R8), pointer, optional , intent(out) :: fldptr2d(:,:) @@ -670,58 +557,44 @@ subroutine state_getfldptr(State, fb, fldname, fldptr1d, fldptr2d, rc) ! local variables type(ESMF_FieldStatus_Flag) :: status type(ESMF_Field) :: lfield - type(ESMF_Mesh) :: lmesh - integer :: nnodes, nelements - type(ESMF_FieldBundle) :: fieldBundle character(len=*), parameter :: subname='(lnd_import_export:state_getfldptr)' ! ---------------------------------------------- rc = ESMF_SUCCESS - ! Get the fieldbundle from the state... - call ESMF_StateGet(state, trim(fb), fieldBundle, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("ERROR: fb "//trim(fb)//" not found in state") - - ! Get the field from the field bundle - call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Get the status of the field - call ESMF_FieldGet(lfield, status=status, rc=rc) + call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - if (status /= ESMF_FIELDSTATUS_COMPLETE) then - call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) - rc = ESMF_FAILURE - return - else - call ESMF_FieldGet(lfield, mesh=lmesh, rc=rc) + if (present(fldptr1d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call ESMF_MeshGet(lmesh, numOwnedNodes=nnodes, numOwnedElements=nelements, rc=rc) + else if (present(fldptr2d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") + end if - if (nnodes == 0 .and. nelements == 0) then - call ESMF_LogWrite(trim(subname)//": no local nodes or elements ", ESMF_LOGMSG_INFO) - rc = ESMF_FAILURE - return - end if + end subroutine state_getfldptr - ! Get the data from the field - if (present(fldptr1d)) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc .and. debug > 0) then - write(iulog,F01)' in '//trim(subname)//'fldptr1d for '//trim(fldname)//' is ' - end if - else if (present(fldptr2d)) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") - end if - endif ! status + !=============================================================================== + logical function fldchk(state, fldname) + ! ---------------------------------------------- + ! Determine if field with fldname is in the input state + ! ---------------------------------------------- - end subroutine state_getfldptr + ! input/output variables + type(ESMF_State), intent(in) :: state + character(len=*), intent(in) :: fldname + + ! local variables + type(ESMF_StateItem_Flag) :: itemFlag + ! ---------------------------------------------- + call ESMF_StateGet(state, trim(fldname), itemFlag) + if (itemflag /= ESMF_STATEITEM_NOTFOUND) then + fldchk = .true. + else + fldchk = .false. + endif + end function fldchk end module lnd_import_export diff --git a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 b/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 deleted file mode 100644 index f3be6085e9..0000000000 --- a/src/cpl/nuopc/lnd_set_decomp_and_domain.F90 +++ /dev/null @@ -1,700 +0,0 @@ -module lnd_set_decomp_and_domain - - use ESMF - use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl - use spmdMod , only : masterproc - use clm_varctl , only : iulog - - implicit none - private ! except - - ! Module public routines - public :: lnd_set_decomp_and_domain_from_readmesh - public :: lnd_set_decomp_and_domain_from_newmesh - - ! Module private routines - private :: lnd_get_global_dims - private :: lnd_get_lndmask_from_ocnmesh - private :: lnd_get_lndmask_from_lndmesh - private :: lnd_set_ldomain_gridinfo - private :: nc_check_err - private :: chkerr - - character(len=*) , parameter :: u_FILE_u = & - __FILE__ - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -!=============================================================================== -contains -!=============================================================================== - - subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshfile_ocn, mesh_ctsm, ni, nj, rc) - - use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D - use domainMod , only : ldomain, domain_init - use decompMod , only : ldecomp, bounds_type, get_proc_bounds - use clm_varpar , only : nlevsoi - use clm_varctl , only : fatmlndfrc, fsurdat - use clm_varctl , only : use_soil_moisture_streams, single_column - ! - use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getfil - - ! input/output variables - character(len=*) , intent(in) :: mode ! lilac or nuopc mode - type(ESMF_VM) , intent(in) :: vm - character(len=*) , intent(in) :: meshfile_lnd - character(len=*) , intent(in) :: meshfile_ocn - type(ESMF_Mesh) , intent(out) :: mesh_ctsm - integer , intent(out) :: ni,nj ! global grid dimensions - integer , intent(out) :: rc - - ! local variables - type(ESMF_Mesh) :: mesh_ocninput - type(ESMF_Mesh) :: mesh_lndinput - type(ESMF_DistGrid) :: distgrid_ctsm - character(CL) :: cvalue ! config data - integer :: nlnd, nocn ! local size of arrays - integer :: g,n ! indices - type(bounds_type) :: bounds ! bounds - integer :: begg,endg - integer , pointer :: gindex_lnd(:) ! global index space for just land points - integer , pointer :: gindex_ocn(:) ! global index space for just ocean points - integer , pointer :: gindex_ctsm(:) ! global index space for land and ocean points - integer , pointer :: gindex_input(:) ! global index space for land and ocean points - integer , pointer :: lndmask_glob(:) - real(r8) , pointer :: lndfrac_glob(:) - integer :: lsize_input - integer :: gsize - logical :: isgrid2d - character(len=CL) :: locfn - type(file_desc_t) :: ncid ! netcdf file id - integer :: dimid ! netCDF dimension id - logical :: readvar ! read variable in or not - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! Determine global 2d sizes from read of dimensions of surface dataset - call lnd_get_global_dims(ni, nj, gsize, isgrid2d) - - ! Allocate global memory for land mask and land fraction - allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 - allocate(lndfrac_glob(gsize)); lndfrac_glob(:) = 0._r8 - - ! read in the land mesh from the file - mesh_lndinput = ESMF_MeshCreate(filename=trim(meshfile_lnd), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,'(a)')'land mesh file ',trim(meshfile_lnd) - end if - - ! Set global land fraction and global land mask across all processors - if (trim(meshfile_ocn) /= 'null') then - ! read in ocn mask meshfile - mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) - end if - - ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh - call lnd_get_lndmask_from_ocnmesh(mesh_lndinput, mesh_ocninput, vm, gsize, lndmask_glob, lndfrac_glob, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - if (mode == 'lilac' .and. trim(fatmlndfrc) /= 'null') then - ! Read in global land mask and land fraction from fatmlndfrc - call getfil( trim(fatmlndfrc), locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_io(ncid=ncid, varname='mask', data=lndmask_glob, flag='read', readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: variable mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - allocate(lndfrac_glob(ni*nj)); lndfrac_glob(:) = 0._r8 - call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - call ncd_pio_closefile(ncid) - else - ! obtain land mask from land mesh file - assume that land frac is identical to land mask - call lnd_get_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - end if - - ! Determine lnd decomposition that will be used by ctsm - call decompInit_lnd(lni=ni, lnj=nj, amask=lndmask_glob) - if (use_soil_moisture_streams) then - call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) - end if - - ! Determine ocn decomposition that will be used to create the full mesh - ! note that the memory for gindex_ocn will be allocated in the following call - ! but deallocated at the end of this routine - call decompInit_ocn(ni=ni, nj=nj, amask=lndmask_glob, gindex_ocn=gindex_ocn) - - ! Get JUST gridcell processor bounds - ! Remaining bounds (landunits, columns, patches) will be set after calling decompInit_glcp - ! so get_proc_bounds is called twice and the gridcell information is just filled in twice - call get_proc_bounds(bounds) - begg = bounds%begg - endg = bounds%endg - - ! Create ctsm gindex_lnd - nlnd = endg - begg + 1 - allocate(gindex_lnd(nlnd)) - do g = begg, endg - n = 1 + (g - begg) - gindex_lnd(n) = ldecomp%gdc2glo(g) - end do - - ! Initialize domain data structure - call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - - ! Determine ldomain%mask and ldomain%frac using ctsm decomposition - do g = begg, endg - n = 1 + (g - begg) - ldomain%mask(g) = lndmask_glob(gindex_lnd(n)) - ldomain%frac(g) = lndfrac_glob(gindex_lnd(n)) - end do - deallocate(lndmask_glob) - deallocate(lndfrac_glob) - - ! Generate a ctsm global index that includes both land and ocean points - nocn = size(gindex_ocn) - allocate(gindex_ctsm(nlnd + nocn)) - do n = 1,nlnd+nocn - if (n <= nlnd) then - gindex_ctsm(n) = gindex_lnd(n) - else - gindex_ctsm(n) = gindex_ocn(n-nlnd) - end if - end do - - ! Generate a new mesh on the gindex decomposition - distGrid_ctsm = ESMF_DistGridCreate(arbSeqIndexList=gindex_ctsm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - mesh_ctsm = ESMF_MeshCreate(mesh_lndinput, elementDistGrid=distgrid_ctsm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Get ldomain%lonc, ldomain%latc and ldomain%area and optionally - ! lon1d and lat1d if isgrid2d - call lnd_set_ldomain_gridinfo(mesh_ctsm, vm, gindex_ctsm, bounds, isgrid2d, ni, nj, ldomain, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Deallocate memory - deallocate(gindex_lnd) - deallocate(gindex_ocn) - deallocate(gindex_ctsm) - - end subroutine lnd_set_decomp_and_domain_from_readmesh - - !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) - - ! Generate a new mesh from the input domain file and set the mask to 1 - - use decompInitMod , only : decompInit_lnd, decompInit_lnd3D - use decompMod , only : ldecomp, bounds_type, get_proc_bounds - use domainMod , only : ldomain, domain_init - use clm_varctl , only : use_soil_moisture_streams, single_column - use clm_varpar , only : nlevsoi - use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror - use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var - use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable - - ! input/output variables - character(len=CL) , intent(in) :: domain_file - type(ESMF_Mesh) , intent(out) :: mesh - integer , intent(out) :: ni,nj ! global grid dimensions - integer , intent(out) :: rc - - ! local variables - logical :: isgrid2d - integer :: g,n - integer :: nv - integer :: ncid, ierr - integer :: dimid_ni, dimid_nj, dimid_nv - integer :: maxIndex(2) - real(r8) :: mincornerCoord(2) - real(r8) :: maxcornerCoord(2) - type(ESMF_Grid) :: lgrid - real(r8), allocatable :: xv(:,:,:), yv(:,:,:) - integer :: varid_xv, varid_yv - integer :: numownedelements - integer, allocatable :: lnd_mask(:) - type(bounds_type) :: bounds ! bounds - integer :: begg,endg - integer :: nlnd - integer, pointer :: gindex_lnd(:) ! global index space for just land points - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! open file - ierr = nf90_open(domain_file, NF90_NOWRITE, ncid) - call nc_check_err(ierr, 'nf90_open', trim(domain_file)) - ! get dimension ids - ierr = nf90_inq_dimid(ncid, 'ni', dimid_ni) - call nc_check_err(ierr, 'nf90_inq_dimid for ni', trim(domain_file)) - ierr = nf90_inq_dimid(ncid, 'nj', dimid_nj) - call nc_check_err(ierr, 'nf90_inq_dimid for nj', trim(domain_file)) - ierr = nf90_inq_dimid(ncid, 'nv', dimid_nv) - call nc_check_err(ierr, 'nf90_inq_dimid for nv', trim(domain_file)) - ! get dimension values - ierr = nf90_inquire_dimension(ncid, dimid_ni, len=ni) - call nc_check_err(ierr, 'nf90_inq_dimension for ni', trim(domain_file)) - ierr = nf90_inquire_dimension(ncid, dimid_nj, len=nj) - call nc_check_err(ierr, 'nf90_inq_dimension for nj', trim(domain_file)) - ierr = nf90_inquire_dimension(ncid, dimid_nv, len=nv) - call nc_check_err(ierr, 'nf90_inq_dimension for nv', trim(domain_file)) - ! get variable ids - ierr = nf90_inq_varid(ncid, 'xv', varid_xv) - call nc_check_err(ierr, 'nf90_inq_varid for xv', trim(domain_file)) - ierr = nf90_inq_varid(ncid, 'yv', varid_yv) - call nc_check_err(ierr, 'nf90_inq_varid for yv', trim(domain_file)) - ! allocate memory for variables and get variable values - allocate(xv(nv,ni,nj), yv(nv,ni,nj)) - ierr = nf90_get_var(ncid, varid_xv, xv) - call nc_check_err(ierr, 'nf90_get_var for xv', trim(domain_file)) - ierr = nf90_get_var(ncid, varid_yv, yv) - call nc_check_err(ierr, 'nf90_get_var for yv', trim(domain_file)) - ! close file - ierr = nf90_close(ncid) - call nc_check_err(ierr, 'nf90_close', trim(domain_file)) - ! create the grid - maxIndex(1) = ni ! number of lons - maxIndex(2) = nj ! number of lats - mincornerCoord(1) = xv(1,1,1) ! min lon - mincornerCoord(2) = yv(1,1,1) ! min lat - maxcornerCoord(1) = xv(3,ni,nj) ! max lon - maxcornerCoord(2) = yv(3,ni,nj) ! max lat - deallocate(xv,yv) - lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & - mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & - staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! create the mesh from the grid - mesh = ESMF_MeshCreate(lgrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Set the mesh mask to 1 - call ESMF_MeshGet(mesh, numOwnedElements=numOwnedElements, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lnd_mask(numownedelements)) - lnd_mask(:) = 1 - call ESMF_MeshSet(mesh, elementMask=lnd_mask, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Determine ldecomp and ldomain - call decompInit_lnd(lni=ni, lnj=nj, amask=lnd_mask) - if (use_soil_moisture_streams) then - call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) - end if - - ! Initialize processor bounds - call get_proc_bounds(bounds) - begg = bounds%begg - endg = bounds%endg - - ! Create ctsm gindex_lnd - nlnd = endg - begg + 1 - allocate(gindex_lnd(nlnd)) - do g = begg, endg - n = 1 + (g - begg) - gindex_lnd(n) = ldecomp%gdc2glo(g) - end do - - ! Initialize domain data structure - isgrid2d = .true. - call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - - ! Determine ldomain%mask and ldomain%frac - do g = begg, endg - ldomain%mask(g) = 1 - ldomain%frac(g) = 1._r8 - end do - deallocate(lnd_mask) - - end subroutine lnd_set_decomp_and_domain_from_newmesh - - !=============================================================================== - subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) - - ! Determine global 2d sizes from read of dimensions of surface dataset - - use clm_varctl , only : fsurdat, single_column - use fileutils , only : getfil - use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - - ! input/output variables - integer, intent(out) :: ni - integer, intent(out) :: nj - integer, intent(out) :: gsize - logical, intent(out) :: isgrid2d - - ! local variables - character(len=CL) :: locfn - type(file_desc_t) :: ncid ! netcdf file id - integer :: dimid ! netCDF dimension id - logical :: readvar ! read variable in or not - !------------------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to global dimensions from surface dataset' - if (fsurdat == ' ') then - write(iulog,*)'fsurdat must be specified' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - endif - call getfil(fsurdat, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') - call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') - call ncd_pio_closefile(ncid) - gsize = ni*nj - if (single_column) then - isgrid2d = .true. - else if (nj == 1) then - isgrid2d = .false. - else - isgrid2d = .true. - end if - if (masterproc) then - write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj - if (isgrid2d) then - write(iulog,'(a)') 'model grid is 2-dimensional' - else - write(iulog,'(a)') 'model grid is not 2-dimensional' - end if - end if - - end subroutine lnd_get_global_dims - - !=============================================================================== - subroutine lnd_get_lndmask_from_ocnmesh(mesh_lnd, mesh_ocn, vm, gsize, lndmask_glob, lndfrac_glob, rc) - - ! input/out variables - type(ESMF_Mesh) , intent(in) :: mesh_lnd - type(ESMF_Mesh) , intent(in) :: mesh_ocn - type(ESMF_VM) , intent(in) :: vm - integer , intent(in) :: gsize - integer , pointer :: lndmask_glob(:) - real(r8) , pointer :: lndfrac_glob(:) - integer , intent(out) :: rc - - ! local variables: - type(ESMF_DistGrid) :: distgrid_lnd - type(ESMF_RouteHandle) :: rhandle_ocn2lnd - type(ESMF_Field) :: field_lnd - type(ESMF_Field) :: field_ocn - type(ESMF_DistGrid) :: distgrid_ocn - integer , pointer :: gindex_input(:) ! global index space for land and ocean points - integer , pointer :: lndmask_loc(:) - integer , pointer :: itemp_glob(:) - real(r8) , pointer :: rtemp_glob(:) - real(r8) , pointer :: lndfrac_loc(:) - real(r8) , pointer :: ocnmask_loc(:) ! on ocean mesh - real(r8) , pointer :: ocnfrac_loc(:) ! on land mesh - real(r8) , pointer :: dataptr1d(:) - type(ESMF_Array) :: elemMaskArray - integer :: lsize_lnd - integer :: lsize_ocn - integer :: n, spatialDim - integer :: srcMaskValue = 0 - integer :: dstMaskValue = -987987 ! spval for RH mask values - integer :: srcTermProcessing_Value = 0 - real(r8) :: fminval = 0.001_r8 - real(r8) :: fmaxval = 1._r8 - logical :: checkflag = .false. - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, numOwnedElements=lsize_lnd, & - elementDistGrid=distgrid_lnd, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(lndmask_loc(lsize_lnd)) - allocate(lndfrac_loc(lsize_lnd)) - - ! create fields on land and ocean meshes - field_lnd = ESMF_FieldCreate(mesh_lnd, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - field_ocn = ESMF_FieldCreate(mesh_ocn, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! create route handle to map ocean mask from ocn mesh to land mesh - call ESMF_FieldRegridStore(field_ocn, field_lnd, routehandle=rhandle_ocn2lnd, & - srcMaskValues=(/srcMaskValue/), dstMaskValues=(/dstMaskValue/), & - regridmethod=ESMF_REGRIDMETHOD_CONSERVE, normType=ESMF_NORMTYPE_DSTAREA, & - srcTermProcessing=srcTermProcessing_Value, & - ignoreDegenerate=.true., unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - ! fill in values for field_ocn with mask on ocn mesh - call ESMF_MeshGet(mesh_ocn, elementdistGrid=distgrid_ocn, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_DistGridGet(distgrid_ocn, localDe=0, elementCount=lsize_ocn, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ocnmask_loc(lsize_ocn)) - elemMaskArray = ESMF_ArrayCreate(distgrid_ocn, ocnmask_loc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_MeshGet(mesh_ocn, elemMaskArray=elemMaskArray, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(field_ocn, farrayptr=dataptr1d, rc=rc) - dataptr1d(:) = ocnmask_loc(:) - - ! map ocn mask to land mesh - call ESMF_FieldRegrid(field_ocn, field_lnd, routehandle=rhandle_ocn2lnd, & - termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ocnfrac_loc(lsize_lnd)) - call ESMF_FieldGet(field_lnd, farrayptr=ocnfrac_loc, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1,lsize_lnd - lndfrac_loc(n) = 1._r8 - ocnfrac_loc(n) - if (lndfrac_loc(n) > fmaxval) lndfrac_loc(n) = 1._r8 - if (lndfrac_loc(n) < fminval) lndfrac_loc(n) = 0._r8 - if (lndfrac_loc(n) /= 0._r8) then - lndmask_loc(n) = 1 - else - lndmask_loc(n) = 0 - end if - enddo - call ESMF_FieldDestroy(field_lnd) - call ESMF_FieldDestroy(field_ocn) - - ! determine global landmask_glob - needed to determine the ctsm decomposition - ! land frac, lats, lons and areas will be done below - allocate(gindex_input(lsize_lnd)) - call ESMF_DistGridGet(distgrid_lnd, 0, seqIndexList=gindex_input, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1,lsize_lnd - lndmask_glob(gindex_input(n)) = lndmask_loc(n) - end do - allocate(itemp_glob(gsize)) - call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, & - reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndmask_glob(:) = int(itemp_glob(:)) - deallocate(itemp_glob) - - ! Determine ldomain%frac using both input and ctsm decompositions - ! lndfrac_glob is filled using the input decomposition and - ! ldomin%frac is set using the ctsm decomposition - allocate(rtemp_glob(gsize)) - do n = 1,lsize_lnd - lndfrac_glob(gindex_input(n)) = lndfrac_loc(n) - end do - call ESMF_VMAllReduce(vm, sendData=lndfrac_glob, recvData=rtemp_glob, count=gsize, & - reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndfrac_glob(:) = rtemp_glob(:) - deallocate(rtemp_glob) - - ! deallocate memory - deallocate(ocnmask_loc) - deallocate(lndmask_loc) - deallocate(lndfrac_loc) - - end subroutine lnd_get_lndmask_from_ocnmesh - - !=============================================================================== - subroutine lnd_get_lndmask_from_lndmesh(mesh_lnd, vm, gsize, lndmask_glob, lndfrac_glob, rc) - - ! input/out variables - type(ESMF_Mesh) , intent(in) :: mesh_lnd - type(ESMF_VM) , intent(in) :: vm - integer , intent(in) :: gsize - integer , pointer :: lndmask_glob(:) - real(r8) , pointer :: lndfrac_glob(:) - integer , intent(out) :: rc - - ! local variables: - integer :: n - integer :: lsize - integer , pointer :: gindex(:) - integer , pointer :: lndmask_loc(:) - integer , pointer :: itemp_glob(:) - type(ESMF_DistGrid) :: distgrid - type(ESMF_Array) :: elemMaskArray - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! Determine lsize and distgrid_lnd - call ESMF_MeshGet(mesh_lnd, elementdistGrid=distgrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_DistGridGet(distgrid, localDe=0, elementCount=lsize, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Determine lndmask_loc - ! The call to ESMF_MeshGet fills in the values of lndmask_loc - allocate(lndmask_loc(lsize)) - elemMaskArray = ESMF_ArrayCreate(distgrid, lndmask_loc, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_MeshGet(mesh_lnd, elemMaskArray=elemMaskArray, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Determine global landmask_glob - needed to determine the ctsm decomposition - ! land frac, lats, lons and areas will be done below - allocate(gindex(lsize)) - allocate(itemp_glob(gsize)) - call ESMF_DistGridGet(distgrid, 0, seqIndexList=gindex, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - do n = 1,lsize - lndmask_glob(gindex(n)) = lndmask_loc(n) - end do - call ESMF_VMAllReduce(vm, sendData=lndmask_glob, recvData=itemp_glob, count=gsize, & - reduceflag=ESMF_REDUCE_SUM, rc=rc) - lndmask_glob(:) = int(itemp_glob(:)) - deallocate(itemp_glob) - deallocate(gindex) - deallocate(lndmask_loc) - - ! ASSUME that land fraction is identical to land mask in this case - lndfrac_glob(:) = lndmask_glob(:) - - end subroutine lnd_get_lndmask_from_lndmesh - - !=============================================================================== - subroutine lnd_set_ldomain_gridinfo(mesh, vm, gindex, bounds, isgrid2d, ni, nj, ldomain, rc) - - use domainMod , only : domain_type, lon1d, lat1d - use decompMod , only : bounds_type, get_proc_bounds - use clm_varcon , only : re - - ! input/output variables - type(ESMF_Mesh) , intent(in) :: mesh - type(ESMF_VM) , intent(in) :: vm - integer , intent(in) :: gindex(:) - type(bounds_type) , intent(in) :: bounds - logical , intent(in) :: isgrid2d - integer , intent(in) :: ni,nj - type(domain_type) , intent(inout) :: ldomain - integer , intent(out) :: rc - - ! local variables - integer :: g,n - integer :: gsize - integer :: begg,endg - integer :: numownedelements - real(r8) , pointer :: lndlats_glob(:) - real(r8) , pointer :: lndlons_glob(:) - real(r8) , pointer :: rtemp_glob(:) - real(r8) , pointer :: ownedElemCoords(:) - integer :: spatialDim - real(r8) , pointer :: dataptr1d(:) - type(ESMF_Field) :: areaField - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - begg = bounds%begg - endg = bounds%endg - - ! Determine ldoman%latc and ldomain%lonc - call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(ownedElemCoords(spatialDim*numownedelements)) - call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg,endg - n = g - begg + 1 - ldomain%lonc(g) = ownedElemCoords(2*n-1) - if (ldomain%lonc(g) == 360._r8) ldomain%lonc(g) = 0._r8 ! TODO: why the difference? - ldomain%latc(g) = ownedElemCoords(2*n) - end do - - ! Create ldomain%area by querying the mesh on the ctsm decomposition - areaField = ESMF_FieldCreate(mesh, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldRegridGetArea(areaField, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(areaField, farrayPtr=dataptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = begg, endg - ldomain%area(g) = dataptr1d(g-begg+1) * (re*re) - end do - call ESMF_FieldDestroy(areaField) - - ! If grid is 2d, determine lon1d and lat1d - if (isgrid2d) then - gsize = ni*nj - allocate(rtemp_glob(gsize)) - - ! Determine lon1d - allocate(lndlons_glob(gsize)) - lndlons_glob(:) = 0._r8 - do n = 1,numownedelements - if (ownedElemCoords(2*n-1) == 360._r8) then ! TODO: why is this needed? - lndlons_glob(gindex(n)) = 0._r8 - else - lndlons_glob(gindex(n)) = ownedElemCoords(2*n-1) - end if - end do - call ESMF_VMAllReduce(vm, sendData=lndlons_glob, recvData=rtemp_glob, count=gsize, & - reduceflag=ESMF_REDUCE_SUM, rc=rc) - deallocate(lndlons_glob) - allocate(lon1d(ni)) - do n = 1,ni - lon1d(n) = rtemp_glob(n) - end do - - ! Determine lat1d - allocate(lndlats_glob(gsize)) - lndlats_glob(:) = 0._r8 - do n = 1,numownedelements - lndlats_glob(gindex(n)) = ownedElemCoords(2*n) - end do - call ESMF_VMAllReduce(vm, sendData=lndlats_glob, recvData=rtemp_glob, count=gsize, & - reduceflag=ESMF_REDUCE_SUM, rc=rc) - deallocate(lndlats_glob) - allocate(lat1d(nj)) - do n = 1,nj - lat1d(n) = rtemp_glob((n-1)*ni + 1) - end do - deallocate(rtemp_glob) - end if - - end subroutine lnd_set_ldomain_gridinfo - - !=============================================================================== - subroutine nc_check_err(ierror, description, filename) - - use shr_sys_mod , only : shr_sys_abort - use netcdf , only : nf90_noerr, nf90_strerror - - integer , intent(in) :: ierror - character(*), intent(in) :: description - character(*), intent(in) :: filename - - if (ierror /= nf90_noerr) then - write (*,'(6a)') 'ERROR ', trim(description),'. NetCDF file : "', trim(filename),& - '". Error message:', trim(nf90_strerror(ierror)) - call shr_sys_abort() - endif - end subroutine nc_check_err - - !=============================================================================== - logical function chkerr(rc, line, file) - integer , intent(in) :: rc - integer , intent(in) :: line - character(len=*) , intent(in) :: file - - integer :: lrc - chkerr = .false. - lrc = rc - if (ESMF_LogFoundError(rcToCheck=lrc, msg=ESMF_LOGERR_PASSTHRU, line=line, file=file)) then - chkerr = .true. - endif - end function chkerr - -end module lnd_set_decomp_and_domain diff --git a/src/cpl/lilac/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 similarity index 94% rename from src/cpl/lilac/lnd_set_decomp_and_domain.F90 rename to src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index f3be6085e9..1cc0ee4ce1 100644 --- a/src/cpl/lilac/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -94,28 +94,29 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf end if ! Set global land fraction and global land mask across all processors - if (trim(meshfile_ocn) /= 'null') then - ! read in ocn mask meshfile - mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) - end if - - ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh - call lnd_get_lndmask_from_ocnmesh(mesh_lndinput, mesh_ocninput, vm, gsize, lndmask_glob, lndfrac_glob, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (mode == 'lilac' .and. trim(fatmlndfrc) /= 'null') then + ! Note that is just for backwards compatibility + ! Read in global land mask and land fraction from fatmlndfrc + call getfil( trim(fatmlndfrc), locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + call ncd_io(ncid=ncid, varname='mask', data=lndmask_glob, flag='read', readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: variable mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + allocate(lndfrac_glob(ni*nj)); lndfrac_glob(:) = 0._r8 + call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) + if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + call ncd_pio_closefile(ncid) else - if (mode == 'lilac' .and. trim(fatmlndfrc) /= 'null') then - ! Read in global land mask and land fraction from fatmlndfrc - call getfil( trim(fatmlndfrc), locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_io(ncid=ncid, varname='mask', data=lndmask_glob, flag='read', readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: variable mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - allocate(lndfrac_glob(ni*nj)); lndfrac_glob(:) = 0._r8 - call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - call ncd_pio_closefile(ncid) + if (trim(meshfile_ocn) /= 'null') then + ! read in ocn mask meshfile + mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc) then + write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) + end if + + ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh + call lnd_get_lndmask_from_ocnmesh(mesh_lndinput, mesh_ocninput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return else ! obtain land mask from land mesh file - assume that land frac is identical to land mask call lnd_get_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) From df3748fff4bd7e942c5a02579baa6181a6ebab07 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 28 Dec 2020 20:47:02 -0700 Subject: [PATCH 1734/1973] reverted changes to lnd_import_export --- src/cpl/lilac/lnd_comp_esmf.F90 | 13 +- src/cpl/lilac/lnd_import_export.F90 | 583 +++++++++++++++++----------- 2 files changed, 352 insertions(+), 244 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index d038170baf..05613e23a1 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -39,7 +39,7 @@ module lnd_comp_esmf use clm_driver , only : clm_drv use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_diagnose - use lnd_set_decomp_and_domain, only : lnd_set_decomp_and_domain_from_meshinfo + use lnd_set_decomp_and_domain, only : lnd_set_decomp_and_domain_from_readmesh implicit none private ! By default make data private except @@ -341,7 +341,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lnd_set_decomp_and_domain_from_meshinfo(mode='lilac', vm=vm, & + call lnd_set_decomp_and_domain_from_readmesh(mode='lilac', vm=vm, & meshfile_lnd=lnd_mesh_filename, meshfile_ocn='null', mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return @@ -815,15 +815,6 @@ subroutine lnd_run(gcomp, import_state, export_state, clock, rc) ! diagnostics !-------------------------------- - !if (dbug > 1) then - ! call State_diagnose(exportState,subname//':ES',rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! if (masterproc) then - ! call log_clock_advance(clock, 'CTSM', iulog, rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! end if - !end if - call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) #if (defined _MEMTRACE) diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 95c5d6426f..951b9f239d 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -27,80 +27,13 @@ module lnd_import_export private :: state_setexport private :: state_getfldptr - ! import fields - character(*), parameter :: Sa_z = 'Sa_z' - character(*), parameter :: Sa_topo = 'Sa_topo' - character(*), parameter :: Sa_u = 'Sa_u' - character(*), parameter :: Sa_v = 'Sa_v' - character(*), parameter :: Sa_ptem = 'Sa_ptem' - character(*), parameter :: Sa_shum = 'Sa_shum' - character(*), parameter :: Sa_pbot = 'Sa_pbot' - character(*), parameter :: Sa_tbot = 'Sa_tbot' - character(*), parameter :: Sa_methane = 'Sa_methane' - character(*), parameter :: Faxa_rainc = 'Faxa_rainc' - character(*), parameter :: Faxa_rainl = 'Faxa_rainl' - character(*), parameter :: Faxa_snowc = 'Faxa_snowc' - character(*), parameter :: Faxa_snowl = 'Faxa_snowl' - character(*), parameter :: Faxa_lwdn = 'Faxa_lwdn' - character(*), parameter :: Faxa_swvdr = 'Faxa_swvdr' - character(*), parameter :: Faxa_swndr = 'Faxa_swndr' - character(*), parameter :: Faxa_swvdf = 'Faxa_swvdf' - character(*), parameter :: Faxa_swndf = 'Faxa_swndf' - character(*), parameter :: Faxa_bcphidry = 'Faxa_bcphidry' - character(*), parameter :: Faxa_bcphodry = 'Faxa_bcphodry' - character(*), parameter :: Faxa_bcphiwet = 'Faxa_bcphiwet' - character(*), parameter :: Faxa_ocphidry = 'Faxa_ocphidry' - character(*), parameter :: Faxa_ocphodry = 'Faxa_ocphodry' - character(*), parameter :: Faxa_ocphiwet = 'Faxa_ocphiwet' - character(*), parameter :: Faxa_dstwet1 = 'Faxa_dstwet1' - character(*), parameter :: Faxa_dstwet2 = 'Faxa_dstwet2' - character(*), parameter :: Faxa_dstwet3 = 'Faxa_dstwet3' - character(*), parameter :: Faxa_dstwet4 = 'Faxa_dstwet4' - character(*), parameter :: Faxa_dstdry1 = 'Faxa_dstdry1' - character(*), parameter :: Faxa_dstdry2 = 'Faxa_dstdry2' - character(*), parameter :: Faxa_dstdry3 = 'Faxa_dstdry3' - character(*), parameter :: Faxa_dstdry3 = 'Faxa_dstdry4' - character(*), parameter :: Faxa_ndep = 'Faxa_ndep' - - ! export fields - character(*), parameter :: Sl_t = 'Sl_t' - character(*), parameter :: Sl_snowh = 'Sl_snowh' - character(*), parameter :: Sl_avsdr = 'Sl_avsdr' - character(*), parameter :: Sl_anidr = 'Sl_anidr' - character(*), parameter :: Sl_avsdf = 'Sl_avsdf' - character(*), parameter :: Sl_anidf = 'Sl_anidf' - character(*), parameter :: Sl_tref = 'Sl_tref' - character(*), parameter :: Sl_qref = 'Sl_qref' - character(*), parameter :: Sl_u10 = 'Sl_u10' - character(*), parameter :: Sl_ram1 = 'Sl_ram1' - character(*), parameter :: Sl_fv = 'Sl_fv' - character(*), parameter :: Sl_z0m = 'Sl_z0m' - character(*), parameter :: Sl_soilw = 'Sl_soilw' - character(*), parameter :: Sl_ddvel = 'Sl_ddvel' - character(*), parameter :: Sl_fztop = 'Sl_fztop' - character(*), parameter :: Fall_taux = 'Fall_taux' - character(*), parameter :: Fall_tauy = 'Fall_tauy' - character(*), parameter :: Fall_lat = 'Fall_lat' - character(*), parameter :: Fall_sen = 'Fall_sen' - character(*), parameter :: Fall_lwup = 'Fall_lwup' - character(*), parameter :: Fall_evap = 'Fall_evap' - character(*), parameter :: Fall_swnet = 'Fall_swnet' - character(*), parameter :: Fall_flxdst = 'Fall_flxdst' - character(*), parameter :: Fall_methane = 'Fall_methane' - character(*), parameter :: Fall_voc = 'Fall_voc' - character(*), parameter :: Fall_fire = 'Fall_fire' - character(*), parameter :: Flrl_rofsur = 'Flrl_rofsur' - character(*), parameter :: Flrl_rofsub = 'Flrl_rofsub' - character(*), parameter :: Flrl_rofgwl = 'Flrl_rofgwl' - character(*), parameter :: Flrl_rofi = 'Flrl_rofi' - character(*), parameter :: Flrl_irrig = 'Flrl_irrig' - ! from atm->lnd integer :: ndep_nflds ! number of nitrogen deposition fields from atm->lnd/ocn ! from lnd->atm integer :: drydep_nflds ! number of dry deposition velocity fields lnd-> atm integer :: emis_nflds ! number of fire emission fields from lnd-> atm + integer, parameter :: debug = 0 ! internal debug level character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" @@ -141,7 +74,6 @@ subroutine import_fields( importState, bounds, first_call, rc) !--------------------------------------------------------------------------- rc = ESMF_SUCCESS - call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) ! Set bounds begg = bounds%begg; endg=bounds%endg @@ -167,80 +99,129 @@ subroutine import_fields( importState, bounds, first_call, rc) ! Required atmosphere input fields !-------------------------- - call state_getimport_1d(importState, Sa_z , atm2lnd_inst%forc_hgt_grc(begg:), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Sa_z', bounds, & + output=atm2lnd_inst%forc_hgt_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Sa_topo , atm2lnd_inst%forc_topo_grc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Sa_topo', bounds, & + output=atm2lnd_inst%forc_topo_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Sa_u , atm2lnd_inst%forc_u_grc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Sa_u', bounds, & + output=atm2lnd_inst%forc_u_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Sa_v , atm2lnd_inst%forc_v_grc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Sa_v', bounds, & + output=atm2lnd_inst%forc_v_grc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Sa_shum , wateratm2lndbulk_inst%forc_q_not_downscaled_grc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Sa_ptem', bounds, & + output=atm2lnd_inst%forc_th_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Sa_ptem , atm2lnd_inst%forc_th_not_downscaled_grc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Sa_shum', bounds, & + output=water_inst%wateratm2lndbulk_inst%forc_q_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Sa_pbot , atm2lnd_inst%forc_pbot_not_downscaled_grc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Sa_pbot', bounds, & + output=atm2lnd_inst%forc_pbot_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Sa_tbot , atm2lnd_inst%forc_t_not_downscaled_grc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Sa_tbot', bounds, & + output=atm2lnd_inst%forc_t_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_rainc, forc_rainc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainc', bounds, & + output=forc_rainc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_rainl, forc_rainl(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_rainl', bounds, & + output=forc_rainl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_snowc, forc_snowc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowc', bounds, & + output=forc_snowc, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_snowl, forc_snowl(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_snowl', bounds, & + output=forc_snowl, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_lwdn , atm2lnd_inst%forc_lwrad_not_downscaled_grc(begg:), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_lwdn', bounds, & + output=atm2lnd_inst%forc_lwrad_not_downscaled_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_swvdr, atm2lnd_inst%forc_solad_grc(begg:,1), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swvdr', bounds, & + output=atm2lnd_inst%forc_solad_grc(:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_swndr, atm2lnd_inst%forc_solad_grc(begg:,2), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swndr', bounds, & + output=atm2lnd_inst%forc_solad_grc(:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_swvdf, atm2lnd_inst%forc_solai_grc(begg:,1), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swvdf', bounds, & + output=atm2lnd_inst%forc_solai_grc(:,1), rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_swndf, atm2lnd_inst%forc_solai_grc(begg:,2), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_swndf', bounds, & + output=atm2lnd_inst%forc_solai_grc(:,2), rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ! Atmosphere prognostic/prescribed aerosol fields - call state_getimport_1d(importState, Faxa_bcphidry, atm2lnd_inst%forc_aer_grc(begg:,1), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphidry', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_bcphodry, atm2lnd_inst%forc_aer_grc(begg:,2), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphodry', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_bcphiwet, atm2lnd_inst%forc_aer_grc(begg:,3), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_bcphiwet', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,3), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_ocphidry, atm2lnd_inst%forc_aer_grc(begg:,4), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphidry', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,4), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_ocphodry, atm2lnd_inst%forc_aer_grc(begg:,5), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphodry', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,5), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_ocphiwet, atm2lnd_inst%forc_aer_grc(begg:,6), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_ocphiwet', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,6), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_dstwet1, output=atm2lnd_inst%forc_aer_grc(begg:,7), rc=rc) + + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet1', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,7), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_dstwet2, output=atm2lnd_inst%forc_aer_grc(begg:,9), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry1', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,8), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_dstwet3, output=atm2lnd_inst%forc_aer_grc(begg:,11), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet2', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,9), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_dstwet4, output=atm2lnd_inst%forc_aer_grc(begg:,13), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry2', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,10), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - - call state_getimport_1d(importState, Faxa_dstdry1, output=atm2lnd_inst%forc_aer_grc(begg:,8), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet3', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,11), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_dstdry2, output=atm2lnd_inst%forc_aer_grc(begg:,10), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry3', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,12), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_dstdry3, output=atm2lnd_inst%forc_aer_grc(begg:,12), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstwet4', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,13), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_getimport_1d(importState, Faxa_dstdry4, output=atm2lnd_inst%forc_aer_grc(begg:,14), rc=rc) + call state_getimport(importState, 'c2l_fb_atm', 'Faxa_dstdry4', bounds, & + output=atm2lnd_inst%forc_aer_grc(:,14), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - !call state_getimport_1d(importState, Sa_methane, atm2lnd_inst%forc_pch4_grc(begg:), rc=rc) - !if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call state_getimport(importState, 'c2l_fb_atm', 'Sa_methane', bounds, output=atm2lnd_inst%forc_pch4_grc, rc=rc ) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! The lilac is sending ndep in units if kgN/m2/s - and ctsm uses units of gN/m2/sec ! so the following conversion needs to happen - ! call state_getimport_1d(importState, Faxa_nhx, output=forc_nhx(begg:), rc=rc) + ! call state_getimport(importState, 'c2l_fb_atm', 'Faxa_nhx', bounds, output=forc_nhx, rc=rc ) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! call state_getimport_1d(importState, Faxa_nhy, output=forc_nhy(begg:), rc=rc) + ! call state_getimport(importState, 'c2l_fb_atm', 'Faxa_noy', bounds, output=forc_noy, rc=rc ) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! do g = begg,endg ! atm2lnd_inst%forc_ndep_grc(g) = (forc_nhx(g) + forc_noy(g))*1000._r8 @@ -333,102 +314,139 @@ subroutine export_fields(exportState, bounds, rc) ! local variables integer :: i, g, num - integer :: begg, endg real(r8) :: array(bounds%begg:bounds%endg) - character(len=CS) :: cnum character(len=*), parameter :: subname='(lnd_import_export:export_fields)' !--------------------------------------------------------------------------- rc = ESMF_SUCCESS - begg = bounds%begg - endg = bounds%endg - ! ----------------------- ! output to atm ! ----------------------- - call state_setexport_1d(exportState, Sl_t , lnd2atm_inst%t_rad_grc(begg:), rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_t', bounds, & + input=lnd2atm_inst%t_rad_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_snowh , waterlnd2atmbulk_inst%h2osno_grc(begg:), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_snowh', bounds, & + input=water_inst%waterlnd2atmbulk_inst%h2osno_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_avsdr , lnd2atm_inst%albd_grc(begg:,1), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_avsdr', bounds, & + input=lnd2atm_inst%albd_grc(bounds%begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_anidr , lnd2atm_inst%albd_grc(begg:,2), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_anidr', bounds, & + input=lnd2atm_inst%albd_grc(bounds%begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_avsdf , lnd2atm_inst%albi_grc(begg:,1), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_avsdf', bounds, & + input=lnd2atm_inst%albi_grc(bounds%begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_anidf , lnd2atm_inst%albi_grc(begg:,2), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_anidf', bounds, & + input=lnd2atm_inst%albi_grc(bounds%begg:,2), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_tref , lnd2atm_inst%t_ref2m_grc(begg:), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_tref', bounds, & + input=lnd2atm_inst%t_ref2m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_qref , waterlnd2atmbulk_inst%q_ref2m_grc(begg:), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_qref', bounds, & + input=water_inst%waterlnd2atmbulk_inst%q_ref2m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_u10 , lnd2atm_inst%u_ref10m_grc(begg:), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_u10', bounds, & + input=lnd2atm_inst%u_ref10m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_taux , lnd2atm_inst%taux_grc(begg:), minus=.true., rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_taux', bounds, & + input=lnd2atm_inst%taux_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_tauy , lnd2atm_inst%tauy_grc(begg:), minus=.true., rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_tauy', bounds, & + input=lnd2atm_inst%tauy_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_lat , lnd2atm_inst%eflx_lh_tot_grc(begg:), minus=.true., rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_lat', bounds, & + input=lnd2atm_inst%eflx_lh_tot_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_sen , lnd2atm_inst%eflx_sh_tot_grc(begg:), minus=.true., rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_sen', bounds, & + input=lnd2atm_inst%eflx_sh_tot_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_lwup , lnd2atm_inst%eflx_lwrad_out_grc(begg:), minus=.true., rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_lwup', bounds, & + input=lnd2atm_inst%eflx_lwrad_out_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_evap , waterlnd2atmbulk_inst%qflx_evap_tot_grc(begg:), minus=.true., rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_evap', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qflx_evap_tot_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_swnet , lnd2atm_inst%fsa_grc(begg:), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_swnet', bounds, & + input=lnd2atm_inst%fsa_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_flxdst1 , lnd2atm_inst%flxdst_grc(begg:,1), minus=.true., rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst1', bounds, & + input=lnd2atm_inst%flxdst_grc(:,1), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_flxdst2 , lnd2atm_inst%flxdst_grc(begg:,2), minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst2', bounds, & + input=lnd2atm_inst%flxdst_grc(:,2), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_flxdst3 , lnd2atm_inst%flxdst_grc(begg:,3), minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst3', bounds, & + input=lnd2atm_inst%flxdst_grc(:,3), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Fall_flxdst4 , lnd2atm_inst%flxdst_grc(begg:,4), minus=.true., rc=rc) + call state_setexport(exportState, 'l2c_fb_atm', 'Fall_flxdst4', bounds, & + input=lnd2atm_inst%flxdst_grc(:,4), minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_ram1 , lnd2atm_inst%ram1_grc(begg:), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_ram1', bounds, & + input=lnd2atm_inst%ram1_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_fv , lnd2atm_inst%fv_grc(begg:), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_fv', bounds, & + input=lnd2atm_inst%fv_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call state_setexport_1d(exportState, Sl_z0m , lnd2atm_inst%z0m_grc(begg:), rc=rc) + + call state_setexport(exportState, 'l2c_fb_atm', 'Sl_z0m', bounds, & + input=lnd2atm_inst%z0m_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! methane - ! call state_setexport_1d(exportState, Fall_methane , lnd2atm_inst%flux_ch4_grc(begg:), minus=.true., rc=rc) + ! methanem + ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_methane', bounds, & + ! input=lnd2atm_inst%flux_ch4_grc, minus=.true., rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! soil water - ! call state_setexport_1d(exportState, Sl_soilw , water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(begg:,1), rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_soilw', bounds, & + ! input=water_inst%waterlnd2atmbulk_inst%h2osoi_vol_grc(:,1), rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! dry dep velocities ! do num = 1, drydep_nflds - ! write(cnum,'(i0)') num - ! call state_setexport_1d(exportState, trim(Sl_ddvel)//trim(cnum), & - ! lnd2atm_inst%ddvel_grc(begg:,num), rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_ddvel', bounds, & + ! input=lnd2atm_inst%ddvel_grc(:,num), ungridded_index=num, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! end do ! MEGAN VOC emis fluxes ! do num = 1, shr_megan_mechcomps_n - ! write(cnum,'(i0)') num - ! call state_setexport_1d(exportState, trim(Fall_voc)//trim(cnum), & - ! lnd2atm_inst%flxvoc_grc(begg:,num), minus=.true., rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_voc', bounds, & + ! input=lnd2atm_inst%flxvoc_grc(:,num), minus=.true., ungridded_index=num, rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return ! end do ! fire emis fluxes ! do num = 1, emis_nflds - ! write(cnum,'(i0)') num - ! call state_setexport_2d(exportState, trim(Fall_fire)//trim(cnum), lnd2atm_inst%fireflx_grc(begg:,num), & - ! minus = .true., rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! call state_setexport(exportState, 'l2c_fb_atm', 'Fall_fire', bounds, & + ! input=lnd2atm_inst%fireflx_grc(:,num), minus=.true., ungridded_index=num, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! end do ! if (emis_nflds > 0) then - ! call state_setexport_1d(exportState, Sl_fztop, lnd2atm_inst%fireztop_grc(begg:), rc=rc) + ! call state_setexport(exportState, 'l2c_fb_atm', 'Sl_fztopo', bounds, input=lnd2atm_inst%fireztop_grc, rc=rc) ! if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! end if - + ! endif ! sign convention is positive downward with hierarchy of atm/glc/lnd/rof/ice/ocn. ! i.e. water sent from land to rof is positive @@ -437,118 +455,217 @@ subroutine export_fields(exportState, bounds, rc) ! ----------------------- ! surface runoff is the sum of qflx_over, qflx_h2osfc_surf - ! do g = begg,endg + ! do g = bounds%begg,bounds%endg ! array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(g) + & ! water_inst%waterlnd2atmbulk_inst%qflx_rofliq_h2osfc_grc(g) ! end do - call state_setexport_1d(exportState, Flrl_rofsur, waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc(begg:), rc=rc) + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofsur', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsur_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - do g = begg,endg + do g = bounds%begg,bounds%endg array(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qsub_grc(g) + & water_inst%waterlnd2atmbulk_inst%qflx_rofliq_drain_perched_grc(g) end do - call state_setexport_1d(exportState, Flrl_rofsub, array(begg:), rc=rc) + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofsub', bounds, & + input=array, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! qgwl sent individually to coupler - call state_setexport_1d(exportState, Flrl_rofgwl, waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(begg:), rc=rc) + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofgwl', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! ice sent individually to coupler - call state_setexport_1d(exportState, Flrl_rofi, waterlnd2atmbulk_inst%qflx_rofice_grc(begg:), rc=rc) + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_rofi', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! irrigation flux to be removed from main channel storage (negative) - call state_setexport_1d(exportState, Flrl_irrig, waterlnd2atmbulk_inst%qirrig_grc(begg:), & - minus = .true., rc=rc) + call state_setexport(exportState, 'l2c_fb_rof', 'Flrl_irrig', bounds, & + input=water_inst%waterlnd2atmbulk_inst%qirrig_grc, minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end subroutine export_fields !=============================================================================== - subroutine state_getimport_1d(state, fldname, ctsmdata, rc) - ! fill in ctsm import data for 1d field + subroutine state_getimport(state, fb, fldname, bounds, output, ungridded_index, rc) - use ESMF, only : ESMF_LOGERR_PASSTHRU, ESMF_END_ABORT, ESMF_LogFoundError - use ESMF, only : ESMF_Finalize + ! ---------------------------------------------- + ! Map import state field to output array + ! ---------------------------------------------- - ! input/output variabes - type(ESMF_State) , intent(in) :: state - character(len=*) , intent(in) :: fldname - real(r8) , intent(inout) :: ctsmdata(:) - integer , intent(out) :: rc + ! input/output variables + type(ESMF_State) , intent(in) :: state + character(len=*) , intent(in) :: fb + character(len=*) , intent(in) :: fldname + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(out) :: output(bounds%begg:bounds%endg) + integer, optional , intent(in) :: ungridded_index + integer , intent(out) :: rc ! local variables - real(r8), pointer :: fldPtr1d(:) - integer :: g - character(len=*), parameter :: subname='(lnd_import_export:state_getimport_1d)' + integer :: g, i,n + real(R8), pointer :: fldptr1d(:) + real(R8), pointer :: fldptr2d(:,:) + character(len=cs) :: cvalue + character(len=*), parameter :: subname='(lnd_import_export:state_getimport)' ! ---------------------------------------------- rc = ESMF_SUCCESS - call state_getfldptr(State, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - do g = 1,size(ctsmdata) - ctsmdata(g) = fldptr1d(g) - end do - call check_for_nans(ctsmdata, trim(fldname), 1) + if (masterproc .and. debug > 0) then + write(iulog,F01)' Show me what is in the state? for '//trim(fldname) + call ESMF_StatePrint(state, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if - end subroutine state_getimport_1d + ! Get the pointer to data in the field + if (present(ungridded_index)) then + write(cvalue,*) ungridded_index + if (debug > 0) then + call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname)//" index "//trim(cvalue), & + ESMF_LOGMSG_INFO) + end if + call state_getfldptr(state, trim(fb), trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + if (debug > 0) then + call ESMF_LogWrite(trim(subname)//": getting import for "//trim(fldname),ESMF_LOGMSG_INFO) + end if + call state_getfldptr(state, trim(fb), trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! Fill in output array + if (present(ungridded_index)) then + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + output(g) = fldptr2d(ungridded_index,n) + end do + else + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + output(g) = fldptr1d(n) + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + write(iulog,F02)' n, g , fldptr1d(n) '//trim(fldname)//' = ',n, g, fldptr1d(n) + end if + end do + end if + + ! Write debug output if appropriate + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + do g = bounds%begg,bounds%endg + i = 1 + g - bounds%begg + write(iulog,F02)'import: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,output(g) + end do + end if + + ! Check for nans + call check_for_nans(output, trim(fldname), bounds%begg) + + end subroutine state_getimport !=============================================================================== - subroutine state_setexport_1d(state, fldname, ctsmdata, minus, rc) - ! fill in ctsm export data for 1d field + subroutine state_setexport(state, fb, fldname, bounds, input, minus, ungridded_index, rc) - use ESMF, only : ESMF_LOGERR_PASSTHRU, ESMF_END_ABORT, ESMF_LogFoundError - use ESMF, only : ESMF_Finalize + ! ---------------------------------------------- + ! Map input array to export state field + ! ---------------------------------------------- - ! input/output variabes - type(ESMF_State) , intent(in) :: state - character(len=*) , intent(in) :: fldname - real(r8) , intent(in) :: ctsmdata(:) - logical, optional, intent(in) :: minus - integer , intent(out):: rc + ! input/output variables + type(ESMF_State) , intent(inout) :: state + character(len=*) , intent(in) :: fb + type(bounds_type) , intent(in) :: bounds + character(len=*) , intent(in) :: fldname + real(r8) , intent(in) :: input(bounds%begg:bounds%endg) + logical, optional , intent(in) :: minus + integer, optional , intent(in) :: ungridded_index + integer , intent(out) :: rc ! local variables - real(r8), pointer :: fldPtr1d(:) - integer :: g - character(len=*), parameter :: subname='(lnd_export_export:state_setexport_1d)' + logical :: l_minus ! local version of minus + integer :: g, i, n + real(R8), pointer :: fldptr1d(:) + real(R8), pointer :: fldptr2d(:,:) + character(len=cs) :: cvalue + character(len=*), parameter :: subname='(lnd_import_export:state_setexport)' ! ---------------------------------------------- - call state_getfldptr(state, trim(fldname), fldptr1d=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr1d(:) = 0._r8 + rc = ESMF_SUCCESS + + l_minus = .false. if (present(minus)) then - do g = 1,size(ctsmdata) - fldptr1d(g) = -ctsmdata(g) + l_minus = minus + end if + + ! get field pointer + if (present(ungridded_index)) then + if (debug > 0) then + call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname)//" index "//trim(cvalue), & + ESMF_LOGMSG_INFO) + end if + call state_getfldptr(state, trim(fb), trim(fldname), fldptr2d=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + if (debug > 0) then + call ESMF_LogWrite(trim(subname)//": setting export for "//trim(fldname), ESMF_LOGMSG_INFO) + end if + call state_getfldptr(state, trim(fb), trim(fldname), fldptr1d=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + + ! determine output array + if (present(ungridded_index)) then + fldptr2d(ungridded_index,:) = fillvalue + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + if (l_minus) then + fldptr2d(ungridded_index,n) = -input(g) + else + fldptr2d(ungridded_index,n) = input(g) + end if end do else - do g = 1,size(ctsmdata) - fldptr1d(g) = ctsmdata(g) + fldptr1d(:) = fillvalue + do g = bounds%begg, bounds%endg + n = g - bounds%begg + 1 + if (l_minus) then + fldptr1d(n) = -input(g) + else + fldptr1d(n) = input(g) + end if end do end if - call check_for_nans(ctsmdata, trim(fldname), 1) - end subroutine state_setexport_1d + ! write debug output if appropriate + if (masterproc .and. debug > 0 .and. get_nstep() < 5) then + do g = bounds%begg,bounds%endg + i = 1 + g - bounds%begg + write(iulog,F01)'export: nstep, n, '//trim(fldname)//' = ',get_nstep(),i,input(g) + end do + end if + + ! check for nans + call check_for_nans(input, trim(fldname), bounds%begg) + + end subroutine state_setexport !=============================================================================== - subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) + + subroutine state_getfldptr(State, fb, fldname, fldptr1d, fldptr2d, rc) ! ---------------------------------------------- ! Get pointer to a state field ! ---------------------------------------------- - use ESMF , only : ESMF_State, ESMF_Field, ESMF_Mesh, ESMF_FieldStatus_Flag - use ESMF , only : ESMF_StateGet, ESMF_FieldGet, ESMF_MeshGet - use ESMF , only : ESMF_FIELDSTATUS_COMPLETE, ESMF_FAILURE - ! input/output variables type(ESMF_State), intent(in) :: State + character(len=*), intent(in) :: fb character(len=*), intent(in) :: fldname real(R8), pointer, optional , intent(out) :: fldptr1d(:) real(R8), pointer, optional , intent(out) :: fldptr2d(:,:) @@ -557,44 +674,44 @@ subroutine state_getfldptr(State, fldname, fldptr1d, fldptr2d, rc) ! local variables type(ESMF_FieldStatus_Flag) :: status type(ESMF_Field) :: lfield + type(ESMF_FieldBundle) :: fieldBundle character(len=*), parameter :: subname='(lnd_import_export:state_getfldptr)' ! ---------------------------------------------- rc = ESMF_SUCCESS - call ESMF_StateGet(State, itemName=trim(fldname), field=lfield, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (present(fldptr1d)) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else if (present(fldptr2d)) then - call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") - end if + ! Get the fieldbundle from the state... + call ESMF_StateGet(state, trim(fb), fieldBundle, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) call shr_sys_abort("ERROR: fb "//trim(fb)//" not found in state") - end subroutine state_getfldptr - - !=============================================================================== - logical function fldchk(state, fldname) - ! ---------------------------------------------- - ! Determine if field with fldname is in the input state - ! ---------------------------------------------- + ! Get the field from the field bundle + call ESMF_FieldBundleGet(fieldBundle,fieldName=trim(fldname), field=lfield, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! input/output variables - type(ESMF_State), intent(in) :: state - character(len=*), intent(in) :: fldname + ! Get the status of the field + call ESMF_FieldGet(lfield, status=status, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! local variables - type(ESMF_StateItem_Flag) :: itemFlag - ! ---------------------------------------------- - call ESMF_StateGet(state, trim(fldname), itemFlag) - if (itemflag /= ESMF_STATEITEM_NOTFOUND) then - fldchk = .true. + if (status /= ESMF_FIELDSTATUS_COMPLETE) then + call ESMF_LogWrite(trim(subname)//": ERROR data not allocated ", ESMF_LOGMSG_INFO, rc=rc) + rc = ESMF_FAILURE + return else - fldchk = .false. - endif - end function fldchk + ! Get the data from the field + if (present(fldptr1d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (masterproc .and. debug > 0) then + write(iulog,F01)' in '//trim(subname)//'fldptr1d for '//trim(fldname)//' is ' + end if + else if (present(fldptr2d)) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + call shr_sys_abort("either fldptr1d or fldptr2d must be an input argument") + end if + endif ! status + + end subroutine state_getfldptr end module lnd_import_export From b9b9c216fcc268185a48fa4faf93413aa45d15b9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 03:28:13 -0700 Subject: [PATCH 1735/1973] Preparation for biomass heat storage by rearrnaging terms a bit for dt_veg, dlrad and ulrad, this is shown to be different on the PGI compiler, but should be only different by roundoff, since it's just a difference in order of operations for those terms --- src/biogeophys/CanopyFluxesMod.F90 | 39 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 6d8ae4b81b..d299c07830 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -402,6 +402,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: dt_veg_temp(bounds%begp:bounds%endp) integer :: iv logical :: is_end_day ! is end of current day + real(r8) :: frac_rad_abs_by_stem !fraction of incoming radiation absorbed by stems + real(r8) :: lw_stem !internal longwave stem + real(r8) :: lw_leaf !internal longwave leaf integer :: dummy_to_make_pgi_happy !------------------------------------------------------------------------------ @@ -627,6 +630,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, obuold(p) = 0._r8 btran(p) = btran0 end do + frac_rad_abs_by_stem = 0._r8 + lw_leaf = 0._r8 + lw_stem = 0._r8 ! calculate daylength control for Vcmax do f = 1, fn @@ -1046,9 +1052,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - dt_veg(p) = (sabv(p) + air(p) + bir(p)*t_veg(p)**4 + & - cir(p)*lw_grnd - efsh - efe(p)) / & - (- 4._r8*bir(p)*t_veg(p)**3 +dc1*wtga +dc2*wtgaq*qsatldT(p)) + dt_veg(p) = ((1._r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) & + + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & + - efsh - efe(p) - lw_leaf + lw_stem ) & + / ((1._r8-frac_rad_abs_by_stem)*(- 4._r8*bir(p)*t_veg(p)**3 & + +dc1*wtga+dc2*wtgaq*qsatldT(p))) t_veg(p) = tlbef(p) + dt_veg(p) dels = dt_veg(p) del(p) = abs(dels) @@ -1056,9 +1064,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, if (del(p) > delmax) then dt_veg(p) = delmax*dels/del(p) t_veg(p) = tlbef(p) + dt_veg(p) - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + cir(p)*lw_grnd - & - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & + err(p) = (1._r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) & + + bir(p)*tlbef(p)**3*(tlbef(p) + & + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & + + lw_stem & + - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & dc2*wtgaq*qsatldT(p)*dt_veg(p)) end if @@ -1183,9 +1193,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & - !+ cir(p)*t_grnd(c)**4 - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) - + cir(p)*lw_grnd - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) + err(p) = (1.0_r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & + *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*t_grnd(c)**4) & + - lw_leaf + lw_stem - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) ! Fluxes from ground to canopy space @@ -1269,14 +1279,17 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy - dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & - emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) + dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & + + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & + *(1.0_r8-frac_rad_abs_by_stem) ! Upward longwave radiation above the canopy ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & + *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1._r8-frac_rad_abs_by_stem) & + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & + + emg(c)*(1._r8-emv(p))*sb*lw_grnd) ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction ! The weight is the so-called vegetation emissivity, but not that emv is actually an attentuation From 49b0e9f1d7c7da31fe450d82918455dd7389008e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 13:18:58 -0700 Subject: [PATCH 1736/1973] Add checks that differences are within roundoff, get it working correctly --- src/biogeophys/CanopyFluxesMod.F90 | 41 ++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index d299c07830..2f9316fa4f 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -405,6 +405,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: frac_rad_abs_by_stem !fraction of incoming radiation absorbed by stems real(r8) :: lw_stem !internal longwave stem real(r8) :: lw_leaf !internal longwave leaf + real(r8) :: temp integer :: dummy_to_make_pgi_happy !------------------------------------------------------------------------------ @@ -1052,11 +1053,18 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) + dt_veg(p) = (sabv(p) + air(p) + bir(p)*t_veg(p)**4 + & + cir(p)*lw_grnd - efsh - efe(p)) / & + (- 4._r8*bir(p)*t_veg(p)**3 +dc1*wtga +dc2*wtgaq*qsatldT(p)) + temp = dt_veg(p) dt_veg(p) = ((1._r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) & + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & - efsh - efe(p) - lw_leaf + lw_stem ) & / ((1._r8-frac_rad_abs_by_stem)*(- 4._r8*bir(p)*t_veg(p)**3 & +dc1*wtga+dc2*wtgaq*qsatldT(p))) + if ( abs(temp - dt_veg(p) ) > 1.e-13 )then + call endrun( "Difference greater than roundoff" ) + end if t_veg(p) = tlbef(p) + dt_veg(p) dels = dt_veg(p) del(p) = abs(dels) @@ -1064,12 +1072,20 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, if (del(p) > delmax) then dt_veg(p) = delmax*dels/del(p) t_veg(p) = tlbef(p) + dt_veg(p) + err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + & + 4._r8*dt_veg(p)) + cir(p)*lw_grnd - & + (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & + dc2*wtgaq*qsatldT(p)*dt_veg(p)) + temp = err(p) err(p) = (1._r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) & + bir(p)*tlbef(p)**3*(tlbef(p) + & 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & + lw_stem & - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & dc2*wtgaq*qsatldT(p)*dt_veg(p)) + if ( abs(temp - err(p) ) > 1.e-13 )then + call endrun( "Difference greater than roundoff" ) + end if end if ! Fluxes from leaves to canopy space @@ -1193,9 +1209,17 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) + err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & + !+ cir(p)*t_grnd(c)**4 - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) + + cir(p)*lw_grnd - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) + temp = err(p) err(p) = (1.0_r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & - *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*t_grnd(c)**4) & + *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & - lw_leaf + lw_stem - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) + if ( abs(temp - err(p) ) > 1.e-13 )then + write(iulog,*) 'Difference = ', temp - err(p) + call endrun( "Difference greater than roundoff" ) + end if ! Fluxes from ground to canopy space @@ -1279,17 +1303,30 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy + dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) + temp = dlrad(p) dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & *(1.0_r8-frac_rad_abs_by_stem) + if ( abs(temp - dlrad(p) ) > 1.e-13 )then + call endrun( "Difference greater than roundoff" ) + end if ! Upward longwave radiation above the canopy + ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + & + 4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + temp = ulrad(p) ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1._r8-frac_rad_abs_by_stem) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & + emg(c)*(1._r8-emv(p))*sb*lw_grnd) + if ( abs(temp - ulrad(p) ) > 1.e-13 )then + write(iulog,*) 'Difference = ', temp - ulrad(p) + call endrun( "Difference greater than roundoff" ) + end if ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction ! The weight is the so-called vegetation emissivity, but not that emv is actually an attentuation From eb7bdfe4f64362c575085d34e744c3cb35594834 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 13:27:09 -0700 Subject: [PATCH 1737/1973] Add new clm51 compsets with Sp mode, change one test to use it and add another additional test as well for one of the new compsets --- cime_config/config_compsets.xml | 35 +++++++++++++++++++++++++++ cime_config/testdefs/testlist_clm.xml | 12 ++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index cc947a7439..de0139fc63 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -36,6 +36,11 @@ + + I1PtClm51SpRs + 2000_DATM%1PT_CLM51%SP_SICE_SOCN_SROF_SGLC_SWAV + + I1PtClm50SpRs 2000_DATM%1PT_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV @@ -59,6 +64,17 @@ 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm51Sp + 2000_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_MOSART_SGLC_SWAV + + + + + I2000Clm51SpRs + 2000_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_SROF_SGLC_SWAV + + I2000Clm50SpRtm @@ -128,6 +144,11 @@ + + I1850Clm51Sp + 1850_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_MOSART_SGLC_SWAV + + I1850Clm51Bgc 1850_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV @@ -177,6 +198,10 @@ + + I2000Clm51Fates + 2000_DATM%GSWP3v1_CLM51%FATES_SICE_SOCN_MOSART_SGLC_SWAV + I2000Clm50Fates 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV @@ -213,6 +238,16 @@ + + I1850Clm51SpNoAnthro + 1850_DATM%GSWP3v1_CLM51%SP-NOANTHRO_SICE_SOCN_MOSART_SGLC_SWAV + + + + IHistClm51Sp + HIST_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_MOSART_SGLC_SWAV + + IHistClm51Bgc HIST_DATM%GSWP3v1_CLM51%BGC_SICE_SOCN_MOSART_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 2e3ff301f6..cebb54f7f5 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -381,12 +381,13 @@ - + + @@ -423,6 +424,15 @@ + + + + + + + + + From 501f5f8c4f04279fe2138b4bd4348d22b148dea9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 14:45:22 -0700 Subject: [PATCH 1738/1973] Add some more terms to match the full BHS work, increase tolerance to e-11 and e-12, e-13 showed problems --- src/biogeophys/CanopyFluxesMod.F90 | 39 ++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 2f9316fa4f..c8b5bbbc15 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -402,9 +402,14 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: dt_veg_temp(bounds%begp:bounds%endp) integer :: iv logical :: is_end_day ! is end of current day + real(r8) :: tl_ini ! leaf temperature from beginning of time step [K] + real(r8) :: ts_ini ! stem temperature from beginning of time step [K] + real(r8) :: cp_leaf !heat capacity of leaves + real(r8) :: dt_stem !change in stem temperature real(r8) :: frac_rad_abs_by_stem !fraction of incoming radiation absorbed by stems real(r8) :: lw_stem !internal longwave stem real(r8) :: lw_leaf !internal longwave leaf + real(r8) :: sa_internal !min(sa_stem,sa_leaf) real(r8) :: temp integer :: dummy_to_make_pgi_happy @@ -633,7 +638,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, end do frac_rad_abs_by_stem = 0._r8 lw_leaf = 0._r8 + cp_leaf = 0._r8 lw_stem = 0._r8 + sa_internal = 0._r8 + dt_stem = 0._r8 + tl_ini = 0._r8 + ts_ini = 0._r8 ! calculate daylength control for Vcmax do f = 1, fn @@ -1059,10 +1069,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, temp = dt_veg(p) dt_veg(p) = ((1._r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) & + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & - - efsh - efe(p) - lw_leaf + lw_stem ) & + - efsh - efe(p) - lw_leaf + lw_stem & + - (cp_leaf/dtime)*(t_veg(p) - tl_ini)) & / ((1._r8-frac_rad_abs_by_stem)*(- 4._r8*bir(p)*t_veg(p)**3 & - +dc1*wtga+dc2*wtgaq*qsatldT(p))) - if ( abs(temp - dt_veg(p) ) > 1.e-13 )then + + 4._r8*sa_internal*emv(p)*sb*t_veg(p)**3 & + +dc1*wtga+dc2*wtgaq*qsatldT(p))+ cp_leaf/dtime) + if ( abs(temp - dt_veg(p) ) > 1.e-12 )then call endrun( "Difference greater than roundoff" ) end if t_veg(p) = tlbef(p) + dt_veg(p) @@ -1080,10 +1092,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, err(p) = (1._r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) & + bir(p)*tlbef(p)**3*(tlbef(p) + & 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & + -sa_internal*emv(p)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & + lw_stem & - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & - dc2*wtgaq*qsatldT(p)*dt_veg(p)) - if ( abs(temp - err(p) ) > 1.e-13 )then + dc2*wtgaq*qsatldT(p)*dt_veg(p)) & + - (cp_leaf/dtime)*(t_veg(p) - tl_ini) + if ( abs(temp - err(p) ) > 1.e-12 )then call endrun( "Difference greater than roundoff" ) end if end if @@ -1215,8 +1229,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, temp = err(p) err(p) = (1.0_r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & - - lw_leaf + lw_stem - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) - if ( abs(temp - err(p) ) > 1.e-13 )then + - lw_leaf + lw_stem - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) & + - ((t_veg(p)-tl_ini)*cp_leaf/dtime) + if ( abs(temp - err(p) ) > 1.e-11 )then write(iulog,*) 'Difference = ', temp - err(p) call endrun( "Difference greater than roundoff" ) end if @@ -1308,8 +1323,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, temp = dlrad(p) dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & - *(1.0_r8-frac_rad_abs_by_stem) - if ( abs(temp - dlrad(p) ) > 1.e-13 )then + *(1.0_r8-frac_rad_abs_by_stem) & + + emv(p)*emg(c)*sb*ts_ini**3*(ts_ini + 4._r8*dt_stem) & + *frac_rad_abs_by_stem + if ( abs(temp - dlrad(p) ) > 1.e-12 )then call endrun( "Difference greater than roundoff" ) end if @@ -1322,8 +1339,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1._r8-frac_rad_abs_by_stem) & + + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & + *ts_ini**3*(ts_ini+ 4._r8*dt_stem)*frac_rad_abs_by_stem & + emg(c)*(1._r8-emv(p))*sb*lw_grnd) - if ( abs(temp - ulrad(p) ) > 1.e-13 )then + if ( abs(temp - ulrad(p) ) > 1.e-11 )then write(iulog,*) 'Difference = ', temp - ulrad(p) call endrun( "Difference greater than roundoff" ) end if From e3797fc939380d01706b0cab2ec32c11de0a2a17 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 17:09:54 -0700 Subject: [PATCH 1739/1973] Do relative diffs rather than absolute, lower tolerance to 1.e-14, ran two tests to verify: SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop and SMS_Ld1_Mmpi-serial.f45_f45_mg37.I2000Clm50Sp.izumi_pgi.clm-ptsRLA --- src/biogeophys/CanopyFluxesMod.F90 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index c8b5bbbc15..8017f7d550 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1074,9 +1074,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, / ((1._r8-frac_rad_abs_by_stem)*(- 4._r8*bir(p)*t_veg(p)**3 & + 4._r8*sa_internal*emv(p)*sb*t_veg(p)**3 & +dc1*wtga+dc2*wtgaq*qsatldT(p))+ cp_leaf/dtime) - if ( abs(temp - dt_veg(p) ) > 1.e-12 )then + if( temp /= 0._r8 )then + if ( abs(temp - dt_veg(p) )/abs(temp) > 1.d-14 )then + write(iulog,*) 'Difference = ', temp - dt_veg(p) + write(iulog,*) 'R Difference = ', (temp - dt_veg(p))/temp call endrun( "Difference greater than roundoff" ) end if + end if t_veg(p) = tlbef(p) + dt_veg(p) dels = dt_veg(p) del(p) = abs(dels) @@ -1097,9 +1101,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & dc2*wtgaq*qsatldT(p)*dt_veg(p)) & - (cp_leaf/dtime)*(t_veg(p) - tl_ini) - if ( abs(temp - err(p) ) > 1.e-12 )then + if( temp /= 0._r8 )then + if ( abs(temp - err(p) )/abs(temp) > 1.d-14 )then call endrun( "Difference greater than roundoff" ) end if + end if end if ! Fluxes from leaves to canopy space @@ -1231,10 +1237,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & - lw_leaf + lw_stem - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) & - ((t_veg(p)-tl_ini)*cp_leaf/dtime) - if ( abs(temp - err(p) ) > 1.e-11 )then + if( temp /= 0._r8 )then + if ( abs(temp - err(p) )/abs(temp) > 1.d-14 )then write(iulog,*) 'Difference = ', temp - err(p) call endrun( "Difference greater than roundoff" ) end if + end if ! Fluxes from ground to canopy space @@ -1326,9 +1334,11 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, *(1.0_r8-frac_rad_abs_by_stem) & + emv(p)*emg(c)*sb*ts_ini**3*(ts_ini + 4._r8*dt_stem) & *frac_rad_abs_by_stem - if ( abs(temp - dlrad(p) ) > 1.e-12 )then + if( temp /= 0._r8 )then + if ( abs(temp - dlrad(p) ) > 1.d-14*temp )then call endrun( "Difference greater than roundoff" ) end if + end if ! Upward longwave radiation above the canopy @@ -1342,10 +1352,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & *ts_ini**3*(ts_ini+ 4._r8*dt_stem)*frac_rad_abs_by_stem & + emg(c)*(1._r8-emv(p))*sb*lw_grnd) - if ( abs(temp - ulrad(p) ) > 1.e-11 )then + if( temp /= 0._r8 )then + if ( abs(temp - ulrad(p) ) > 1.d-14*temp )then write(iulog,*) 'Difference = ', temp - ulrad(p) call endrun( "Difference greater than roundoff" ) end if + end if ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction ! The weight is the so-called vegetation emissivity, but not that emv is actually an attentuation From 22fcf15c77616240f8b3bd54063f56de7aa343f6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 17:22:23 -0700 Subject: [PATCH 1740/1973] Remove temporary tests for terms being only different by relative difference of order roundoff --- src/biogeophys/CanopyFluxesMod.F90 | 50 ------------------------------ 1 file changed, 50 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 8017f7d550..b96b43187c 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -410,7 +410,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: lw_stem !internal longwave stem real(r8) :: lw_leaf !internal longwave leaf real(r8) :: sa_internal !min(sa_stem,sa_leaf) - real(r8) :: temp integer :: dummy_to_make_pgi_happy !------------------------------------------------------------------------------ @@ -1063,10 +1062,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - dt_veg(p) = (sabv(p) + air(p) + bir(p)*t_veg(p)**4 + & - cir(p)*lw_grnd - efsh - efe(p)) / & - (- 4._r8*bir(p)*t_veg(p)**3 +dc1*wtga +dc2*wtgaq*qsatldT(p)) - temp = dt_veg(p) dt_veg(p) = ((1._r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) & + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & - efsh - efe(p) - lw_leaf + lw_stem & @@ -1074,13 +1069,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, / ((1._r8-frac_rad_abs_by_stem)*(- 4._r8*bir(p)*t_veg(p)**3 & + 4._r8*sa_internal*emv(p)*sb*t_veg(p)**3 & +dc1*wtga+dc2*wtgaq*qsatldT(p))+ cp_leaf/dtime) - if( temp /= 0._r8 )then - if ( abs(temp - dt_veg(p) )/abs(temp) > 1.d-14 )then - write(iulog,*) 'Difference = ', temp - dt_veg(p) - write(iulog,*) 'R Difference = ', (temp - dt_veg(p))/temp - call endrun( "Difference greater than roundoff" ) - end if - end if t_veg(p) = tlbef(p) + dt_veg(p) dels = dt_veg(p) del(p) = abs(dels) @@ -1088,11 +1076,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, if (del(p) > delmax) then dt_veg(p) = delmax*dels/del(p) t_veg(p) = tlbef(p) + dt_veg(p) - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + cir(p)*lw_grnd - & - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & - dc2*wtgaq*qsatldT(p)*dt_veg(p)) - temp = err(p) err(p) = (1._r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) & + bir(p)*tlbef(p)**3*(tlbef(p) + & 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & @@ -1101,11 +1084,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & dc2*wtgaq*qsatldT(p)*dt_veg(p)) & - (cp_leaf/dtime)*(t_veg(p) - tl_ini) - if( temp /= 0._r8 )then - if ( abs(temp - err(p) )/abs(temp) > 1.d-14 )then - call endrun( "Difference greater than roundoff" ) - end if - end if end if ! Fluxes from leaves to canopy space @@ -1229,20 +1207,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & +frac_h2osfc(c)*t_h2osfc(c)**4) - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & - !+ cir(p)*t_grnd(c)**4 - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) - + cir(p)*lw_grnd - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) - temp = err(p) err(p) = (1.0_r8-frac_rad_abs_by_stem)*(sabv(p) + air(p) + bir(p)*tlbef(p)**3 & *(tlbef(p) + 4._r8*dt_veg(p)) + cir(p)*lw_grnd) & - lw_leaf + lw_stem - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) & - ((t_veg(p)-tl_ini)*cp_leaf/dtime) - if( temp /= 0._r8 )then - if ( abs(temp - err(p) )/abs(temp) > 1.d-14 )then - write(iulog,*) 'Difference = ', temp - err(p) - call endrun( "Difference greater than roundoff" ) - end if - end if ! Fluxes from ground to canopy space @@ -1326,38 +1294,20 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Downward longwave radiation below the canopy - dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & - emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) - temp = dlrad(p) dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) & + emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & *(1.0_r8-frac_rad_abs_by_stem) & + emv(p)*emg(c)*sb*ts_ini**3*(ts_ini + 4._r8*dt_stem) & *frac_rad_abs_by_stem - if( temp /= 0._r8 )then - if ( abs(temp - dlrad(p) ) > 1.d-14*temp )then - call endrun( "Difference greater than roundoff" ) - end if - end if ! Upward longwave radiation above the canopy - ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) - temp = ulrad(p) ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & *tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))*(1._r8-frac_rad_abs_by_stem) & + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb & *ts_ini**3*(ts_ini+ 4._r8*dt_stem)*frac_rad_abs_by_stem & + emg(c)*(1._r8-emv(p))*sb*lw_grnd) - if( temp /= 0._r8 )then - if ( abs(temp - ulrad(p) ) > 1.d-14*temp )then - write(iulog,*) 'Difference = ', temp - ulrad(p) - call endrun( "Difference greater than roundoff" ) - end if - end if ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction ! The weight is the so-called vegetation emissivity, but not that emv is actually an attentuation From 5dfd6280980addd7b1d385feca2d8996e455ab25 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 18:01:20 -0700 Subject: [PATCH 1741/1973] Correct number of tests --- bld/unit_testers/build-namelist_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 0fee84f11c..1a86b5faf6 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,7 +138,7 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 1516; +my $ntests = 1513; if ( defined($opts{'compare'}) ) { $ntests += 1017; } From 5bb7e59aaf8ab0df0fbbe80ff97f3e7761c63101 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 18:14:40 -0700 Subject: [PATCH 1742/1973] Work on ChangeLog --- doc/ChangeLog | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 103 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 5642709fc1..1351d524cf 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,106 @@ =============================================================== +Tag name: ctsm5.1.dev020 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Tue Dec 29 17:47:30 MST 2020 +One-line Summary: Potential roundoff changes in preparation for bio-mass heat storage option + +Purpose of changes +------------------ + +This adds in some changes that may be roundoff different in preparation for bringing in the changes +that allow turning on the bio-mass heat storage option. There's a few zeroed terms added to some calculations +in CanopyFluxes. The new terms are identical to what will come in for BHS except the zeroed terms are +not arrays here but scalars. I showed the new terms are only off by roundoff with a previous commit that added +explicit tests for the terms and verified it for two tests. + + +Bugs fixed or introduced +------------------------ + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): Added new Clm51 compsets + I1PtClm51SpRs + I2000Clm51Sp + I2000Clm51SpRs + I1850Clm51Sp + I2000Clm51Fates + I1850Clm51SpNoAnthro + IHistClm51Sp + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Here I set some terms to zero that will be non-zero even when BHS is off + Earlier commits show the smaller set of changes that are needed. + +Changes to tests or testing: Switched one Clm50Sp test to Clm51Sp and added one HistClm51Sp test + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - PASS + + python testing (see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: izumi-PGI + - nature of change: roundoff + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + Earlier commit tested the new terms versus the old and showed they were + order e-11 for absolute difference and e-14 relative difference. + +Detailed list of changes +------------------------ + +Pull Requests that document the changes (include PR ids): #1241 +(https://github.com/ESCOMP/ctsm/pull) + + #1241 -- Small answer changes in preparation for adding option for bio-mass heat storage + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev019 Originator(s): sacks (Bill Sacks) Date: Sat Dec 19 06:55:46 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 3789dbee16..7122565900 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev020 erik 12/29/2020 Potential roundoff changes in preparation for bio-mass heat storage option ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler ctsm5.1.dev018 slevis 12/08/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file From f0abdd920080def7da1bddabf3fe300581566a4c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 29 Dec 2020 23:32:04 -0700 Subject: [PATCH 1743/1973] Update changelog --- doc/ChangeLog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 1351d524cf..6611e3f52a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev020 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Tue Dec 29 17:47:30 MST 2020 +Date: Tue Dec 29 23:31:47 MST 2020 One-line Summary: Potential roundoff changes in preparation for bio-mass heat storage option Purpose of changes @@ -91,6 +91,12 @@ Changes answers relative to baseline: Earlier commit tested the new terms versus the old and showed they were order e-11 for absolute difference and e-14 relative difference. + Tests that change from baseline.... + + ERS_Ly5_P144x1.f10_f10_musgs.IHistClm51BgcCrop.cheyenne_intel.clm-cropMonthOutput + SMS.f10_f10_musgs.I2000Clm50BgcCrop.izumi_pgi.clm-crop + SMS_D.f10_f10_musgs.I2000Clm51BgcCrop.izumi_pgi.clm-crop + Detailed list of changes ------------------------ From 7410b454effd3394156ab90d388f456c468380fb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 30 Dec 2020 00:42:37 -0700 Subject: [PATCH 1744/1973] Update change files --- doc/ChangeLog | 2 +- doc/ChangeSum | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 6611e3f52a..4eac6c847f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev020 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Tue Dec 29 23:31:47 MST 2020 +Date: Wed Dec 30 00:42:16 MST 2020 One-line Summary: Potential roundoff changes in preparation for bio-mass heat storage option Purpose of changes diff --git a/doc/ChangeSum b/doc/ChangeSum index 7122565900..6dc5b4fc0d 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev020 erik 12/29/2020 Potential roundoff changes in preparation for bio-mass heat storage option + ctsm5.1.dev020 erik 12/30/2020 Potential roundoff changes in preparation for bio-mass heat storage option ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler ctsm5.1.dev018 slevis 12/08/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file From 6ccb03c628ef72b6d64bc8e496cca55d257fc3f5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 30 Dec 2020 16:08:30 -0700 Subject: [PATCH 1745/1973] Set BHS constants when off to double precision --- src/main/pftconMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index e8924cbe36..219e556f51 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -1043,11 +1043,11 @@ subroutine InitRead(this) call ncd_io('wood_density',this%wood_density, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) else - this%dbh = 0.0 - this%fbw = 0.0 - this%nstem = 0.1 - this%rstem_per_dbh = 0.0 - this%wood_density = 0.0 + this%dbh = 0.0_r8 + this%fbw = 0.0_r8 + this%nstem = 1000._r8 / 10000._r8 + this%rstem_per_dbh = 0.0_r8 + this%wood_density = 0.0_r8 end if call ncd_pio_closefile(ncid) From bbdab6a6a8354b82d97b85cae4fa265b4a62c03f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 31 Dec 2020 10:48:42 -0700 Subject: [PATCH 1746/1973] added ability to read surface data dimensions from non lat/lon grids --- cime_config/testdefs/testlist_clm_nuopc.xml | 1911 ----------------- .../share_esmf/lnd_set_decomp_and_domain.F90 | 26 +- 2 files changed, 22 insertions(+), 1915 deletions(-) delete mode 100644 cime_config/testdefs/testlist_clm_nuopc.xml diff --git a/cime_config/testdefs/testlist_clm_nuopc.xml b/cime_config/testdefs/testlist_clm_nuopc.xml deleted file mode 100644 index fe8f121f4a..0000000000 --- a/cime_config/testdefs/testlist_clm_nuopc.xml +++ /dev/null @@ -1,1911 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index 1cc0ee4ce1..649140deea 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -38,7 +38,6 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf use clm_varpar , only : nlevsoi use clm_varctl , only : fatmlndfrc, fsurdat use clm_varctl , only : use_soil_moisture_streams, single_column - ! use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen use abortutils , only : endrun use shr_log_mod , only : errMsg => shr_log_errMsg @@ -328,9 +327,10 @@ subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) use clm_varctl , only : fsurdat, single_column use fileutils , only : getfil - use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen, ncd_inqdid use abortutils , only : endrun use shr_log_mod , only : errMsg => shr_log_errMsg + use shr_sys_mod , only : shr_sys_abort ! input/output variables integer, intent(out) :: ni @@ -343,6 +343,8 @@ subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) type(file_desc_t) :: ncid ! netcdf file id integer :: dimid ! netCDF dimension id logical :: readvar ! read variable in or not + logical :: dim_exists + logical :: dim_found = .false. !------------------------------------------------------------------------------- if (masterproc) then @@ -354,8 +356,24 @@ subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) endif call getfil(fsurdat, locfn, 0 ) call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') - call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') + dim_found = .false. + call ncd_inqdid(ncid, 'lsmlon', dimid, dim_exists) + if ( dim_exists ) then + dim_found = .true. + call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') + call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') + end if + if (.not. dim_found) then + call ncd_inqdid(ncid, 'gridcell', dimid, dim_exists) + if ( dim_exists ) then + dim_found = .true. + call ncd_inqdlen(ncid, dimid, ni, 'gridcell') + nj = 1 + end if + end if + if (.not. dim_found) then + call shr_sys_abort('ERROR: surface dataset does not contain dims of lsmlon,lsmlat or gridcell') + end if call ncd_pio_closefile(ncid) gsize = ni*nj if (single_column) then From 7a7a526e4cedcaef7773f0ce40b6799878308cc1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 4 Jan 2021 12:48:03 -0700 Subject: [PATCH 1747/1973] fixes for calculating dynamic fraction at run time --- .../namelist_defaults_overall.xml | 16 +- cime_config/testdefs/testlist_clm.xml | 232 +++++----- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 +- src/cpl/nuopc/lnd_import_export.F90 | 40 +- .../share_esmf/lnd_set_decomp_and_domain.F90 | 400 +++++++++++------- 5 files changed, 382 insertions(+), 308 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index 5839ef7451..f0c7f3c0ff 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -82,18 +82,18 @@ determine default values for namelists. gx1v6 gx1v6 -gx1v6 -gx1v6 +gx1v7 +gx1v7 gx3v7 gx3v7 -USGS +gx3v7 cruncep -USGS -USGS +gx1v7 +gx1v7 gx3v7 -USGS -USGS +gx3v7 +gx3v7 T62 @@ -111,7 +111,7 @@ determine default values for namelists. test navy test -gx1v6 +gx1v7 diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 2e3ff301f6..165f6be9b4 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1,6 +1,6 @@ - + @@ -46,7 +46,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -156,7 +156,7 @@ - + @@ -190,7 +190,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -206,7 +206,7 @@ - + @@ -214,7 +214,7 @@ - + @@ -247,7 +247,7 @@ - + @@ -256,7 +256,7 @@ - + @@ -265,7 +265,7 @@ - + @@ -331,7 +331,7 @@ - + @@ -340,7 +340,7 @@ - + @@ -348,7 +348,7 @@ - + @@ -356,7 +356,7 @@ - + @@ -381,7 +381,7 @@ - + @@ -389,7 +389,7 @@ - + @@ -406,7 +406,7 @@ - + @@ -443,7 +443,7 @@ - + @@ -451,7 +451,7 @@ - + @@ -460,7 +460,7 @@ - + @@ -468,7 +468,7 @@ - + @@ -484,7 +484,7 @@ - + @@ -495,7 +495,7 @@ - + @@ -503,7 +503,7 @@ - + @@ -511,7 +511,7 @@ - + @@ -519,7 +519,7 @@ - + @@ -527,7 +527,7 @@ - + @@ -536,7 +536,7 @@ - + @@ -545,7 +545,7 @@ - + @@ -554,7 +554,7 @@ - + @@ -563,7 +563,7 @@ - + @@ -573,7 +573,7 @@ - + @@ -582,7 +582,7 @@ - + @@ -590,7 +590,7 @@ - + @@ -598,7 +598,7 @@ - + @@ -641,7 +641,7 @@ - + @@ -649,7 +649,7 @@ - + @@ -685,7 +685,7 @@ - + @@ -693,7 +693,7 @@ - + @@ -701,7 +701,7 @@ - + @@ -709,7 +709,7 @@ - + @@ -717,7 +717,7 @@ - + @@ -725,7 +725,7 @@ - + @@ -754,7 +754,7 @@ - + @@ -763,7 +763,7 @@ - + @@ -772,7 +772,7 @@ - + @@ -780,7 +780,7 @@ - + @@ -788,7 +788,7 @@ - + @@ -797,7 +797,7 @@ - + @@ -807,7 +807,7 @@ - + @@ -856,7 +856,7 @@ - + @@ -884,7 +884,7 @@ - + @@ -938,7 +938,7 @@ - + @@ -947,7 +947,7 @@ - + @@ -957,7 +957,7 @@ - + @@ -965,7 +965,7 @@ - + @@ -974,7 +974,7 @@ - + @@ -984,7 +984,7 @@ - + @@ -994,7 +994,7 @@ - + @@ -1002,7 +1002,7 @@ - + @@ -1020,7 +1020,7 @@ - + @@ -1029,7 +1029,7 @@ - + @@ -1038,7 +1038,7 @@ - + @@ -1047,7 +1047,7 @@ - + @@ -1056,7 +1056,7 @@ - + @@ -1077,7 +1077,7 @@ - + @@ -1086,7 +1086,7 @@ - + @@ -1094,7 +1094,7 @@ - + @@ -1110,7 +1110,7 @@ - + @@ -1199,7 +1199,7 @@ - + @@ -1217,7 +1217,7 @@ - + @@ -1234,7 +1234,7 @@ - + @@ -1243,7 +1243,7 @@ - + @@ -1280,7 +1280,7 @@ - + @@ -1289,7 +1289,7 @@ - + @@ -1299,7 +1299,7 @@ - + @@ -1317,7 +1317,7 @@ - + @@ -1326,7 +1326,7 @@ - + @@ -1336,7 +1336,7 @@ - + @@ -1446,7 +1446,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1504,7 +1504,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1512,7 +1512,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1522,7 +1522,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1530,7 +1530,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1541,7 +1541,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1559,7 +1559,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1568,7 +1568,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1597,7 +1597,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1625,7 +1625,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1693,7 +1693,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1720,7 +1720,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1728,7 +1728,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1736,7 +1736,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1746,7 +1746,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1755,7 +1755,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1772,7 +1772,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1791,7 +1791,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1819,7 +1819,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1872,7 +1872,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1890,7 +1890,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1934,7 +1934,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1952,7 +1952,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1996,7 +1996,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2012,7 +2012,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2029,7 +2029,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2039,7 +2039,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2051,7 +2051,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2063,7 +2063,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2073,7 +2073,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2241,7 +2241,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2263,7 +2263,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this 2-degree since that resolution turns off Carbon isotopes - + @@ -2293,7 +2293,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2314,7 +2314,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2325,7 +2325,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2338,7 +2338,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 170c47ab99..43ab789e96 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -551,7 +551,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call NUOPC_CompAttributeGet(gcomp, name='mesh_ocnmask', value=meshfile_ocn, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name='mesh_lndmask', value=meshfile_ocn, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index a63ba87eac..1ba40f22f1 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -183,9 +183,8 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r else send_to_atm = .false. end if - !DEBUG + ! for now always send to atm send_to_atm = .true. - !DEBUG call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -215,10 +214,25 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r ! Advertise export fields !-------------------------------- - call fldlist_add(fldsFrLnd_num, fldsFrlnd, trim(flds_scalar_name)) - call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_lfrin') + ! The following namelist reads should always be called regardless of the send_to_atm value + + ! Dry Deposition velocities from land - ALSO initialize drydep here + call seq_drydep_readnl("drv_flds_in", drydep_nflds) + + ! Fire emissions fluxes from land + call shr_fire_emis_readnl('drv_flds_in', emis_nflds) + + ! MEGAN VOC emissions fluxes from land + call shr_megan_readnl('drv_flds_in', megan_nflds) + if (shr_megan_mechcomps_n .ne. megan_nflds) call shr_sys_abort('ERROR: megan field count mismatch') + + ! CARMA volumetric soil water from land + ! TODO: is the following correct - the CARMA field exchange is very confusing in mct + call shr_carma_readnl('drv_flds_in', carma_fields) ! export to atm + call fldlist_add(fldsFrLnd_num, fldsFrlnd, trim(flds_scalar_name)) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, 'Sl_lfrin') if (send_to_atm) then call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_t ) call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_tref ) @@ -239,37 +253,21 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_evap ) call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_swnet ) ! call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_methane ) - ! dust fluxes from land (4 sizes) call fldlist_add(fldsFrLnd_num, fldsFrLnd, Fall_flxdst, ungridded_lbound=1, ungridded_ubound=4) - - ! co2 fields from land if (flds_co2b .or. flds_co2c) then - call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_fco2_lnd ) + call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_fco2_lnd ) ! co2 fields from land end if - - ! Dry Deposition velocities from land - ALSO initialize drydep here - call seq_drydep_readnl("drv_flds_in", drydep_nflds) if (drydep_nflds > 0) then call fldlist_add(fldsFrLnd_num, fldsFrLnd, Sl_ddvel, ungridded_lbound=1, ungridded_ubound=drydep_nflds) end if - - ! MEGAN VOC emissions fluxes from land - call shr_megan_readnl('drv_flds_in', megan_nflds) - if (shr_megan_mechcomps_n .ne. megan_nflds) call shr_sys_abort('ERROR: megan field count mismatch') if (shr_megan_mechcomps_n > 0) then call fldlist_add(fldsFrLnd_num, fldsFrLnd, Fall_voc, ungridded_lbound=1, ungridded_ubound=megan_nflds) end if - - ! Fire emissions fluxes from land - call shr_fire_emis_readnl('drv_flds_in', emis_nflds) if (emis_nflds > 0) then call fldlist_add(fldsFrLnd_num, fldsFrLnd, Fall_fire, ungridded_lbound=1, ungridded_ubound=emis_nflds) call fldlist_add(fldsFrLnd_num, fldsFrLnd, Sl_fztop) end if - ! CARMA volumetric soil water from land - ! TODO: is the following correct - the CARMA field exchange is very confusing in mct - call shr_carma_readnl('drv_flds_in', carma_fields) if (carma_fields /= ' ') then call fldlist_add(fldsFrLnd_num, fldsFrlnd, Sl_soilw) ! optional for carma end if diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index 649140deea..6b6de817aa 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -14,23 +14,24 @@ module lnd_set_decomp_and_domain ! Module private routines private :: lnd_get_global_dims - private :: lnd_get_lndmask_from_ocnmesh - private :: lnd_get_lndmask_from_lndmesh - private :: lnd_set_ldomain_gridinfo + private :: lnd_set_lndmask_from_maskmesh + private :: lnd_set_lndmask_from_lndmesh + private :: lnd_set_ldomain_gridinfo_from_mesh + private :: chkerr private :: nc_check_err - private :: chkerr character(len=*) , parameter :: u_FILE_u = & __FILE__ character(len=*), parameter, private :: sourcefile = & __FILE__ - + !=============================================================================== contains !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshfile_ocn, mesh_ctsm, ni, nj, rc) + subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshfile_ocn, mesh_ctsm, & + ni, nj, rc) use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D use domainMod , only : ldomain, domain_init @@ -38,7 +39,9 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf use clm_varpar , only : nlevsoi use clm_varctl , only : fatmlndfrc, fsurdat use clm_varctl , only : use_soil_moisture_streams, single_column - use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile + use ncdio_pio , only : ncd_defdim, ncd_defvar, ncd_enddef, ncd_inqdlen + use ncdio_pio , only : ncd_int, ncd_double, ncd_pio_createfile use abortutils , only : endrun use shr_log_mod , only : errMsg => shr_log_errMsg use fileutils , only : getfil @@ -53,27 +56,33 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf integer , intent(out) :: rc ! local variables - type(ESMF_Mesh) :: mesh_ocninput - type(ESMF_Mesh) :: mesh_lndinput - type(ESMF_DistGrid) :: distgrid_ctsm - character(CL) :: cvalue ! config data - integer :: nlnd, nocn ! local size of arrays - integer :: g,n ! indices - type(bounds_type) :: bounds ! bounds - integer :: begg,endg - integer , pointer :: gindex_lnd(:) ! global index space for just land points - integer , pointer :: gindex_ocn(:) ! global index space for just ocean points - integer , pointer :: gindex_ctsm(:) ! global index space for land and ocean points - integer , pointer :: gindex_input(:) ! global index space for land and ocean points - integer , pointer :: lndmask_glob(:) - real(r8) , pointer :: lndfrac_glob(:) - integer :: lsize_input - integer :: gsize - logical :: isgrid2d - character(len=CL) :: locfn - type(file_desc_t) :: ncid ! netcdf file id - integer :: dimid ! netCDF dimension id - logical :: readvar ! read variable in or not + type(ESMF_Mesh) :: mesh_ocninput + type(ESMF_Mesh) :: mesh_lndinput + type(ESMF_DistGrid) :: distgrid_ctsm + character(CL) :: cvalue ! config data + integer :: nlnd, nocn ! local size of arrays + integer :: g,n ! indices + type(bounds_type) :: bounds ! bounds + integer :: begg,endg + integer , pointer :: gindex_lnd(:) ! global index space for just land points + integer , pointer :: gindex_ocn(:) ! global index space for just ocean points + integer , pointer :: gindex_ctsm(:) ! global index space for land and ocean points + integer , pointer :: gindex_input(:) ! global index space for land and ocean points + integer , pointer :: lndmask_glob(:) + real(r8) , pointer :: lndfrac_glob(:) + integer :: lsize_input + integer :: gsize + logical :: isgrid2d + character(len=CL) :: locfn + type(file_desc_t) :: ncid ! netcdf file id + integer :: dimid ! netCDF dimension id + integer :: varid + logical :: readvar ! read variable in or not + logical :: fileexists + logical :: read_fatmlndfrc + logical :: write_landmask_file + logical :: read_landmask_file + character(len=CL) :: flandfrac = 'landfrac.nc' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -92,9 +101,15 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf write(iulog,'(a)')'land mesh file ',trim(meshfile_lnd) end if - ! Set global land fraction and global land mask across all processors if (mode == 'lilac' .and. trim(fatmlndfrc) /= 'null') then - ! Note that is just for backwards compatibility + read_fatmlndfrc = .true. + else + read_fatmlndfrc = .false. + end if + + ! Set global land fraction and global land mask across all processors + if (read_fatmlndfrc) then + ! Read in global land mask and land fraction from fatmlndfrc call getfil( trim(fatmlndfrc), locfn, 0 ) call ncd_pio_openfile (ncid, trim(locfn), 0) @@ -104,21 +119,55 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) call ncd_pio_closefile(ncid) + else + + ! TODO: write landmask_file on initialization and read it in on restart or branch + ! for now see if any tests fail like ERP if the file is not written out + write_landmask_file = .false. + read_landmask_file = .false. + + ! Read in ocean mesh file if its not null, map the mask to the land mesh and write out the landfrac and land mask if (trim(meshfile_ocn) /= 'null') then - ! read in ocn mask meshfile + ! first read in ocn mask meshfile mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) end if - ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh - call lnd_get_lndmask_from_ocnmesh(mesh_lndinput, mesh_ocninput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + call lnd_set_lndmask_from_maskmesh(mesh_lndinput, mesh_ocninput, vm, gsize, lndmask_glob, lndfrac_glob, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (write_landmask_file) then + ! NOW write land mesh/fraction to file in executable directory - this will be used from now on + if (masterproc) then + write(iulog,*) + write(iulog,'(a)') 'lnd_set_decomp_and_domain: writing landmask and landfrac data to landfrac.nc' + write(iulog,*) + end if + call ncd_pio_createfile(ncid, trim(flandfrac)) + call ncd_defdim (ncid, 'gridcell', gsize, dimid) + call ncd_defvar(ncid=ncid, varname='landmask', xtype=ncd_int , dim1name='gridcell') + call ncd_defvar(ncid=ncid, varname='landfrac', xtype=ncd_double, dim1name='gridcell') + call ncd_enddef(ncid) + call ncd_io(ncid=ncid, varname='landmask', data=lndmask_glob, flag='write') + call ncd_io(ncid=ncid, varname='landfrac', data=lndfrac_glob, flag='write') + call ncd_pio_closefile(ncid) + else if (read_landmask_file) then + if (masterproc) then + write(iulog,*) + write(iulog,'(a)') 'lnd_set_decomp_and_domain: reading landmask and landfrac data from landfrac.nc' + write(iulog,*) + end if + call ncd_pio_openfile (ncid, trim(flandfrac), 0) + call ncd_io(ncid=ncid, varname='landmask', data=lndmask_glob, flag='read') + call ncd_io(ncid=ncid, varname='landfrac', data=lndfrac_glob, flag='read') + call ncd_pio_closefile(ncid) + end if else ! obtain land mask from land mesh file - assume that land frac is identical to land mask - call lnd_get_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + call lnd_set_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if end if @@ -178,9 +227,8 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf mesh_ctsm = ESMF_MeshCreate(mesh_lndinput, elementDistGrid=distgrid_ctsm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Get ldomain%lonc, ldomain%latc and ldomain%area and optionally - ! lon1d and lat1d if isgrid2d - call lnd_set_ldomain_gridinfo(mesh_ctsm, vm, gindex_ctsm, bounds, isgrid2d, ni, nj, ldomain, rc) + ! Set ldomain%lonc, ldomain%latc and ldomain%area + call lnd_set_ldomain_gridinfo_from_mesh(mesh_ctsm, vm, gindex_ctsm, begg, endg, isgrid2d, ni, nj, ldomain, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Deallocate memory @@ -190,6 +238,80 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf end subroutine lnd_set_decomp_and_domain_from_readmesh + !=============================================================================== + subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) + + ! Determine global 2d sizes from read of dimensions of surface dataset + + use clm_varctl , only : fsurdat, single_column + use fileutils , only : getfil + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen, ncd_inqdid + use abortutils , only : endrun + use shr_log_mod , only : errMsg => shr_log_errMsg + use shr_sys_mod , only : shr_sys_abort + + ! input/output variables + integer, intent(out) :: ni + integer, intent(out) :: nj + integer, intent(out) :: gsize + logical, intent(out) :: isgrid2d + + ! local variables + character(len=CL) :: locfn + type(file_desc_t) :: ncid ! netcdf file id + integer :: dimid ! netCDF dimension id + logical :: readvar ! read variable in or not + logical :: dim_exists + logical :: dim_found = .false. + !------------------------------------------------------------------------------- + + if (masterproc) then + write(iulog,*) 'Attempting to global dimensions from surface dataset' + if (fsurdat == ' ') then + write(iulog,*)'fsurdat must be specified' + call endrun(msg=errMsg(sourcefile, __LINE__)) + endif + endif + call getfil(fsurdat, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + dim_found = .false. + call ncd_inqdid(ncid, 'lsmlon', dimid, dim_exists) + if ( dim_exists ) then + dim_found = .true. + call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') + call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') + end if + if (.not. dim_found) then + call ncd_inqdid(ncid, 'gridcell', dimid, dim_exists) + if ( dim_exists ) then + dim_found = .true. + call ncd_inqdlen(ncid, dimid, ni, 'gridcell') + nj = 1 + end if + end if + if (.not. dim_found) then + call shr_sys_abort('ERROR: surface dataset does not contain dims of lsmlon,lsmlat or gridcell') + end if + call ncd_pio_closefile(ncid) + gsize = ni*nj + if (single_column) then + isgrid2d = .true. + else if (nj == 1) then + isgrid2d = .false. + else + isgrid2d = .true. + end if + if (masterproc) then + write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj + if (isgrid2d) then + write(iulog,'(a)') 'model grid is 2-dimensional' + else + write(iulog,'(a)') 'model grid is not 2-dimensional' + end if + end if + + end subroutine lnd_get_global_dims + !=============================================================================== subroutine lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) @@ -321,85 +443,11 @@ subroutine lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) end subroutine lnd_set_decomp_and_domain_from_newmesh !=============================================================================== - subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) - - ! Determine global 2d sizes from read of dimensions of surface dataset - - use clm_varctl , only : fsurdat, single_column - use fileutils , only : getfil - use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen, ncd_inqdid - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_sys_mod , only : shr_sys_abort - - ! input/output variables - integer, intent(out) :: ni - integer, intent(out) :: nj - integer, intent(out) :: gsize - logical, intent(out) :: isgrid2d - - ! local variables - character(len=CL) :: locfn - type(file_desc_t) :: ncid ! netcdf file id - integer :: dimid ! netCDF dimension id - logical :: readvar ! read variable in or not - logical :: dim_exists - logical :: dim_found = .false. - !------------------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to global dimensions from surface dataset' - if (fsurdat == ' ') then - write(iulog,*)'fsurdat must be specified' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - endif - call getfil(fsurdat, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - dim_found = .false. - call ncd_inqdid(ncid, 'lsmlon', dimid, dim_exists) - if ( dim_exists ) then - dim_found = .true. - call ncd_inqdlen(ncid, dimid, ni, 'lsmlon') - call ncd_inqdlen(ncid, dimid, nj, 'lsmlat') - end if - if (.not. dim_found) then - call ncd_inqdid(ncid, 'gridcell', dimid, dim_exists) - if ( dim_exists ) then - dim_found = .true. - call ncd_inqdlen(ncid, dimid, ni, 'gridcell') - nj = 1 - end if - end if - if (.not. dim_found) then - call shr_sys_abort('ERROR: surface dataset does not contain dims of lsmlon,lsmlat or gridcell') - end if - call ncd_pio_closefile(ncid) - gsize = ni*nj - if (single_column) then - isgrid2d = .true. - else if (nj == 1) then - isgrid2d = .false. - else - isgrid2d = .true. - end if - if (masterproc) then - write(iulog,'(a,2(i8,2x))') 'global ni,nj = ',ni,nj - if (isgrid2d) then - write(iulog,'(a)') 'model grid is 2-dimensional' - else - write(iulog,'(a)') 'model grid is not 2-dimensional' - end if - end if - - end subroutine lnd_get_global_dims - - !=============================================================================== - subroutine lnd_get_lndmask_from_ocnmesh(mesh_lnd, mesh_ocn, vm, gsize, lndmask_glob, lndfrac_glob, rc) + subroutine lnd_set_lndmask_from_maskmesh(mesh_lnd, mesh_mask, vm, gsize, lndmask_glob, lndfrac_glob, rc) ! input/out variables type(ESMF_Mesh) , intent(in) :: mesh_lnd - type(ESMF_Mesh) , intent(in) :: mesh_ocn + type(ESMF_Mesh) , intent(in) :: mesh_mask type(ESMF_VM) , intent(in) :: vm integer , intent(in) :: gsize integer , pointer :: lndmask_glob(:) @@ -408,21 +456,21 @@ subroutine lnd_get_lndmask_from_ocnmesh(mesh_lnd, mesh_ocn, vm, gsize, lndmask_g ! local variables: type(ESMF_DistGrid) :: distgrid_lnd - type(ESMF_RouteHandle) :: rhandle_ocn2lnd + type(ESMF_RouteHandle) :: rhandle_mask2lnd type(ESMF_Field) :: field_lnd - type(ESMF_Field) :: field_ocn - type(ESMF_DistGrid) :: distgrid_ocn + type(ESMF_Field) :: field_mask + type(ESMF_DistGrid) :: distgrid_mask integer , pointer :: gindex_input(:) ! global index space for land and ocean points integer , pointer :: lndmask_loc(:) integer , pointer :: itemp_glob(:) real(r8) , pointer :: rtemp_glob(:) real(r8) , pointer :: lndfrac_loc(:) - real(r8) , pointer :: ocnmask_loc(:) ! on ocean mesh - real(r8) , pointer :: ocnfrac_loc(:) ! on land mesh + real(r8) , pointer :: maskmask_loc(:) ! on ocean mesh + real(r8) , pointer :: maskfrac_loc(:) ! on land mesh real(r8) , pointer :: dataptr1d(:) type(ESMF_Array) :: elemMaskArray integer :: lsize_lnd - integer :: lsize_ocn + integer :: lsize_mask integer :: n, spatialDim integer :: srcMaskValue = 0 integer :: dstMaskValue = -987987 ! spval for RH mask values @@ -443,42 +491,42 @@ subroutine lnd_get_lndmask_from_ocnmesh(mesh_lnd, mesh_ocn, vm, gsize, lndmask_g ! create fields on land and ocean meshes field_lnd = ESMF_FieldCreate(mesh_lnd, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - field_ocn = ESMF_FieldCreate(mesh_ocn, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) + field_mask = ESMF_FieldCreate(mesh_mask, ESMF_TYPEKIND_R8, meshloc=ESMF_MESHLOC_ELEMENT, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! create route handle to map ocean mask from ocn mesh to land mesh - call ESMF_FieldRegridStore(field_ocn, field_lnd, routehandle=rhandle_ocn2lnd, & + ! create route handle to map ocean mask from mask mesh to land mesh + call ESMF_FieldRegridStore(field_mask, field_lnd, routehandle=rhandle_mask2lnd, & srcMaskValues=(/srcMaskValue/), dstMaskValues=(/dstMaskValue/), & regridmethod=ESMF_REGRIDMETHOD_CONSERVE, normType=ESMF_NORMTYPE_DSTAREA, & srcTermProcessing=srcTermProcessing_Value, & ignoreDegenerate=.true., unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! fill in values for field_ocn with mask on ocn mesh - call ESMF_MeshGet(mesh_ocn, elementdistGrid=distgrid_ocn, rc=rc) + ! fill in values for field_mask with mask on mask mesh + call ESMF_MeshGet(mesh_mask, elementdistGrid=distgrid_mask, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_DistGridGet(distgrid_ocn, localDe=0, elementCount=lsize_ocn, rc=rc) + call ESMF_DistGridGet(distgrid_mask, localDe=0, elementCount=lsize_mask, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ocnmask_loc(lsize_ocn)) - elemMaskArray = ESMF_ArrayCreate(distgrid_ocn, ocnmask_loc, rc=rc) + allocate(maskmask_loc(lsize_mask)) + elemMaskArray = ESMF_ArrayCreate(distgrid_mask, maskmask_loc, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_MeshGet(mesh_ocn, elemMaskArray=elemMaskArray, rc=rc) + call ESMF_MeshGet(mesh_mask, elemMaskArray=elemMaskArray, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(field_ocn, farrayptr=dataptr1d, rc=rc) - dataptr1d(:) = ocnmask_loc(:) + call ESMF_FieldGet(field_mask, farrayptr=dataptr1d, rc=rc) + dataptr1d(:) = maskmask_loc(:) - ! map ocn mask to land mesh - call ESMF_FieldRegrid(field_ocn, field_lnd, routehandle=rhandle_ocn2lnd, & + ! map mask mask to land mesh + call ESMF_FieldRegrid(field_mask, field_lnd, routehandle=rhandle_mask2lnd, & termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=checkflag, zeroregion=ESMF_REGION_TOTAL, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_MeshGet(mesh_lnd, spatialDim=spatialDim, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(ocnfrac_loc(lsize_lnd)) - call ESMF_FieldGet(field_lnd, farrayptr=ocnfrac_loc, rc=rc) + allocate(maskfrac_loc(lsize_lnd)) + call ESMF_FieldGet(field_lnd, farrayptr=maskfrac_loc, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return do n = 1,lsize_lnd - lndfrac_loc(n) = 1._r8 - ocnfrac_loc(n) + lndfrac_loc(n) = 1._r8 - maskfrac_loc(n) if (lndfrac_loc(n) > fmaxval) lndfrac_loc(n) = 1._r8 if (lndfrac_loc(n) < fminval) lndfrac_loc(n) = 0._r8 if (lndfrac_loc(n) /= 0._r8) then @@ -488,7 +536,7 @@ subroutine lnd_get_lndmask_from_ocnmesh(mesh_lnd, mesh_ocn, vm, gsize, lndmask_g end if enddo call ESMF_FieldDestroy(field_lnd) - call ESMF_FieldDestroy(field_ocn) + call ESMF_FieldDestroy(field_mask) ! determine global landmask_glob - needed to determine the ctsm decomposition ! land frac, lats, lons and areas will be done below @@ -517,14 +565,14 @@ subroutine lnd_get_lndmask_from_ocnmesh(mesh_lnd, mesh_ocn, vm, gsize, lndmask_g deallocate(rtemp_glob) ! deallocate memory - deallocate(ocnmask_loc) + deallocate(maskmask_loc) deallocate(lndmask_loc) deallocate(lndfrac_loc) - end subroutine lnd_get_lndmask_from_ocnmesh + end subroutine lnd_set_lndmask_from_maskmesh !=============================================================================== - subroutine lnd_get_lndmask_from_lndmesh(mesh_lnd, vm, gsize, lndmask_glob, lndfrac_glob, rc) + subroutine lnd_set_lndmask_from_lndmesh(mesh_lnd, vm, gsize, lndmask_glob, lndfrac_glob, rc) ! input/out variables type(ESMF_Mesh) , intent(in) :: mesh_lnd @@ -579,44 +627,53 @@ subroutine lnd_get_lndmask_from_lndmesh(mesh_lnd, vm, gsize, lndmask_glob, lndfr ! ASSUME that land fraction is identical to land mask in this case lndfrac_glob(:) = lndmask_glob(:) - end subroutine lnd_get_lndmask_from_lndmesh - + end subroutine lnd_set_lndmask_from_lndmesh + !=============================================================================== - subroutine lnd_set_ldomain_gridinfo(mesh, vm, gindex, bounds, isgrid2d, ni, nj, ldomain, rc) + subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgrid2d, ni, nj, ldomain, rc) use domainMod , only : domain_type, lon1d, lat1d - use decompMod , only : bounds_type, get_proc_bounds use clm_varcon , only : re + ! for reading in fatmlndfrc to override mesh data + use clm_varctl , only : fatmlndfrc + use clm_varcon , only : grlnd + use fileutils , only : getfil + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile + ! input/output variables type(ESMF_Mesh) , intent(in) :: mesh type(ESMF_VM) , intent(in) :: vm integer , intent(in) :: gindex(:) - type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: begg,endg logical , intent(in) :: isgrid2d - integer , intent(in) :: ni,nj + integer , intent(in) :: ni, nj type(domain_type) , intent(inout) :: ldomain - integer , intent(out) :: rc + integer , intent(out) :: rc ! local variables - integer :: g,n - integer :: gsize - integer :: begg,endg - integer :: numownedelements - real(r8) , pointer :: lndlats_glob(:) - real(r8) , pointer :: lndlons_glob(:) - real(r8) , pointer :: rtemp_glob(:) - real(r8) , pointer :: ownedElemCoords(:) - integer :: spatialDim - real(r8) , pointer :: dataptr1d(:) - type(ESMF_Field) :: areaField + integer :: g,n + integer :: gsize + integer :: numownedelements + real(r8) , pointer :: ownedElemCoords(:) + integer :: spatialDim + real(r8) , pointer :: dataptr1d(:) + real(r8) , pointer :: lndlats_glob(:) + real(r8) , pointer :: lndlons_glob(:) + real(r8) , pointer :: rtemp_glob(:) + type(ESMF_Field) :: areaField + + ! for reading in fatmlndfrc to override mesh data + type(file_desc_t) :: ncid ! netcdf id + character(len=CL) :: locfn ! local file name + logical :: override_lon = .false. + logical :: override_lat = .true. + logical :: override_area = .false. + real(r8), allocatable :: rdata2d(:,:) ! temporary !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - begg = bounds%begg - endg = bounds%endg - ! Determine ldoman%latc and ldomain%lonc call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -644,7 +701,7 @@ subroutine lnd_set_ldomain_gridinfo(mesh, vm, gindex, bounds, isgrid2d, ni, nj, end do call ESMF_FieldDestroy(areaField) - ! If grid is 2d, determine lon1d and lat1d + ! If grid is 2d, determine lon1d and lat1d from mesh if (isgrid2d) then gsize = ni*nj allocate(rtemp_glob(gsize)) @@ -683,7 +740,26 @@ subroutine lnd_set_ldomain_gridinfo(mesh, vm, gindex, bounds, isgrid2d, ni, nj, deallocate(rtemp_glob) end if - end subroutine lnd_set_ldomain_gridinfo + ! TODO: For BFB with previous baselines - the following read will overwrite + ! ldomain%latc, ldomain%lonc and ldomain%area with the data above + ! Note that latitude and longitude read in are in degrees + call getfil( trim(fatmlndfrc), locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + if (override_lon .or. override_lat .or. override_area) then + if (override_lon) then + call ncd_io(ncid=ncid, varname= 'xc' , flag='read', data=ldomain%lonc , dim1name=grlnd) + end if + if (override_lat) then + call ncd_io(ncid=ncid, varname= 'yc' , flag='read', data=ldomain%latc , dim1name=grlnd) + end if + if (override_area) then + call ncd_io(ncid=ncid, varname= 'area', flag='read', data=ldomain%area, dim1name=grlnd) + ldomain%area = ldomain%area * (re**2) ! convert from radians**2 to km**2 + end if + end if + call ncd_pio_closefile(ncid) + + end subroutine lnd_set_ldomain_gridinfo_from_mesh !=============================================================================== subroutine nc_check_err(ierror, description, filename) From 47e55987582af7806808ed3d01f4b11d1b994551 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 5 Jan 2021 17:08:14 -0700 Subject: [PATCH 1748/1973] updates for using maskfile --- src/cpl/lilac/lnd_comp_esmf.F90 | 2 +- src/cpl/nuopc/lnd_comp_nuopc.F90 | 6 +- .../share_esmf/lnd_set_decomp_and_domain.F90 | 74 ++++++++++--------- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 05613e23a1..7e8f55e464 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -342,7 +342,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call lnd_set_decomp_and_domain_from_readmesh(mode='lilac', vm=vm, & - meshfile_lnd=lnd_mesh_filename, meshfile_ocn='null', mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) + meshfile_lnd=lnd_mesh_filename, meshfile_mask='null', mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return !-------------------------------- diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 43ab789e96..60938b9cc9 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -390,7 +390,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: shrlogunit ! original log unit type(bounds_type) :: bounds ! bounds integer :: ni, nj - character(len=CL) :: meshfile_ocn + character(len=CL) :: meshfile_mask character(len=CL) :: domain_file character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -551,12 +551,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else - call NUOPC_CompAttributeGet(gcomp, name='mesh_lndmask', value=meshfile_ocn, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name='mesh_mask', value=meshfile_mask, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call lnd_set_decomp_and_domain_from_readmesh(mode='nuopc', vm=vm, & - meshfile_lnd=model_meshfile, meshfile_ocn=meshfile_ocn, mesh_ctsm=mesh, ni=ni, nj=nj, rc=rc) + meshfile_lnd=model_meshfile, meshfile_mask=meshfile_mask, mesh_ctsm=mesh, ni=ni, nj=nj, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index 6b6de817aa..7b43e4584e 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -1,9 +1,10 @@ module lnd_set_decomp_and_domain use ESMF - use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl - use spmdMod , only : masterproc - use clm_varctl , only : iulog + use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl + use shr_sys_mod , only : shr_sys_abort + use spmdMod , only : masterproc + use clm_varctl , only : iulog implicit none private ! except @@ -30,15 +31,14 @@ module lnd_set_decomp_and_domain contains !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshfile_ocn, mesh_ctsm, & + subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshfile_mask, mesh_ctsm, & ni, nj, rc) use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D use domainMod , only : ldomain, domain_init use decompMod , only : ldecomp, bounds_type, get_proc_bounds use clm_varpar , only : nlevsoi - use clm_varctl , only : fatmlndfrc, fsurdat - use clm_varctl , only : use_soil_moisture_streams, single_column + use clm_varctl , only : fatmlndfrc, use_soil_moisture_streams, single_column use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile use ncdio_pio , only : ncd_defdim, ncd_defvar, ncd_enddef, ncd_inqdlen use ncdio_pio , only : ncd_int, ncd_double, ncd_pio_createfile @@ -50,13 +50,13 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf character(len=*) , intent(in) :: mode ! lilac or nuopc mode type(ESMF_VM) , intent(in) :: vm character(len=*) , intent(in) :: meshfile_lnd - character(len=*) , intent(in) :: meshfile_ocn + character(len=*) , intent(in) :: meshfile_mask type(ESMF_Mesh) , intent(out) :: mesh_ctsm integer , intent(out) :: ni,nj ! global grid dimensions integer , intent(out) :: rc ! local variables - type(ESMF_Mesh) :: mesh_ocninput + type(ESMF_Mesh) :: mesh_maskinput type(ESMF_Mesh) :: mesh_lndinput type(ESMF_DistGrid) :: distgrid_ctsm character(CL) :: cvalue ! config data @@ -101,7 +101,8 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf write(iulog,'(a)')'land mesh file ',trim(meshfile_lnd) end if - if (mode == 'lilac' .and. trim(fatmlndfrc) /= 'null') then + if (mode == 'lilac') then + ! TODO: how can lilac be generalized to not read fatmlndfrc- for now this is hard-wired read_fatmlndfrc = .true. else read_fatmlndfrc = .false. @@ -127,16 +128,16 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf write_landmask_file = .false. read_landmask_file = .false. - ! Read in ocean mesh file if its not null, map the mask to the land mesh and write out the landfrac and land mask - if (trim(meshfile_ocn) /= 'null') then - ! first read in ocn mask meshfile - mesh_ocninput = ESMF_MeshCreate(filename=trim(meshfile_ocn), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + ! Read in mask mesh file if its not null, map the mask to the land mesh and write out the landfrac and land mask + if (trim(meshfile_mask) /= 'null') then + ! first read in mask meshfile + mesh_maskinput = ESMF_MeshCreate(filename=trim(meshfile_mask), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then - write(iulog,'(a)')'ocean mesh file ',trim(meshfile_ocn) + write(iulog,'(a)')'ocean mesh file ',trim(meshfile_mask) end if ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh - call lnd_set_lndmask_from_maskmesh(mesh_lndinput, mesh_ocninput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + call lnd_set_lndmask_from_maskmesh(mesh_lndinput, mesh_maskinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (write_landmask_file) then @@ -663,13 +664,11 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr real(r8) , pointer :: rtemp_glob(:) type(ESMF_Field) :: areaField - ! for reading in fatmlndfrc to override mesh data - type(file_desc_t) :: ncid ! netcdf id - character(len=CL) :: locfn ! local file name - logical :: override_lon = .false. - logical :: override_lat = .true. - logical :: override_area = .false. - real(r8), allocatable :: rdata2d(:,:) ! temporary + ! for sanity check - remove when this is done + type(file_desc_t) :: ncid ! netcdf id + character(len=CL) :: locfn ! local file name + real(r8), pointer :: lonc_atmlndfrc(:) + real(r8), pointer :: latc_atmlndfrc(:) !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -740,23 +739,28 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr deallocate(rtemp_glob) end if - ! TODO: For BFB with previous baselines - the following read will overwrite - ! ldomain%latc, ldomain%lonc and ldomain%area with the data above - ! Note that latitude and longitude read in are in degrees + ! Sanity check- remove this when it is done call getfil( trim(fatmlndfrc), locfn, 0 ) call ncd_pio_openfile (ncid, trim(locfn), 0) - if (override_lon .or. override_lat .or. override_area) then - if (override_lon) then - call ncd_io(ncid=ncid, varname= 'xc' , flag='read', data=ldomain%lonc , dim1name=grlnd) - end if - if (override_lat) then - call ncd_io(ncid=ncid, varname= 'yc' , flag='read', data=ldomain%latc , dim1name=grlnd) + allocate(lonc_atmlndfrc(numownedelements)) + allocate(latc_atmlndfrc(numownedelements)) + call ncd_io(ncid=ncid, varname= 'xc' , flag='read', data=lonc_atmlndfrc , dim1name=grlnd) + call ncd_io(ncid=ncid, varname= 'yc' , flag='read', data=latc_atmlndfrc , dim1name=grlnd) + do g = begg,endg + n = g - begg + 1 + if (abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) > 1.e-11) then + write(6,'(a,3(d20.13,2x))')'ERROR: lonc_atmlndfrac(n), ldomain%lonc(g), abs(diff) = ',& + lonc_atmlndfrc(n), ldomain%lonc(g), abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) + call shr_sys_abort() end if - if (override_area) then - call ncd_io(ncid=ncid, varname= 'area', flag='read', data=ldomain%area, dim1name=grlnd) - ldomain%area = ldomain%area * (re**2) ! convert from radians**2 to km**2 + if (abs(latc_atmlndfrc(n) - ldomain%latc(g)) > 1.e-11) then + write(6,'(a,3(d20.13,2x))')'ERROR: latc_atmlndfrac(n), ldomain%latc(g), abs(diff) = ',& + latc_atmlndfrc(n), ldomain%latc(g), abs(latc_atmlndfrc(n) - ldomain%latc(g)) + call shr_sys_abort() end if - end if + end do + deallocate(lonc_atmlndfrc) + deallocate(latc_atmlndfrc) call ncd_pio_closefile(ncid) end subroutine lnd_set_ldomain_gridinfo_from_mesh From ba572465ad9f9fce127d14369fc97962e965e8a2 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 5 Jan 2021 21:43:37 -0700 Subject: [PATCH 1749/1973] minor change to diagnostic output --- src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index 7b43e4584e..ec2f0ed19f 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -134,7 +134,7 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf mesh_maskinput = ESMF_MeshCreate(filename=trim(meshfile_mask), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (masterproc) then - write(iulog,'(a)')'ocean mesh file ',trim(meshfile_mask) + write(iulog,'(a)')'mask mesh file ',trim(meshfile_mask) end if ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh call lnd_set_lndmask_from_maskmesh(mesh_lndinput, mesh_maskinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) From 87ccf2b5c4e18d9e822a7fb68d86406f238af205 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 8 Jan 2021 10:58:22 -0700 Subject: [PATCH 1750/1973] bug fixes found in aux_clm tests and cleanup --- src/cpl/lilac/lnd_comp_esmf.F90 | 2 +- src/cpl/nuopc/lnd_comp_nuopc.F90 | 6 +- .../share_esmf/lnd_set_decomp_and_domain.F90 | 584 ++++++++++-------- src/main/clm_initializeMod.F90 | 10 - 4 files changed, 337 insertions(+), 265 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 7e8f55e464..27b022f10c 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -342,7 +342,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call lnd_set_decomp_and_domain_from_readmesh(mode='lilac', vm=vm, & - meshfile_lnd=lnd_mesh_filename, meshfile_mask='null', mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) + meshfile_lnd=lnd_mesh_filename, meshfile_mask=lnd_mesh_filename, mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return !-------------------------------- diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 60938b9cc9..373c16c486 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -345,7 +345,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) use clm_instMod , only : lnd2atm_inst, lnd2glc_inst, water_inst use domainMod , only : ldomain use decompMod , only : ldecomp, bounds_type, get_proc_bounds - use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_newmesh + use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_createmesh use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_readmesh ! input/output variables @@ -545,10 +545,10 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (single_column) model_meshfile = 'create_mesh' if (trim(model_meshfile) == 'create_mesh') then - ! TODO: can't this just be fatmlndfrc call NUOPC_CompAttributeGet(gcomp, name='domain_lnd', value=domain_file, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) + call lnd_set_decomp_and_domain_from_createmesh(domain_file=domain_file, vm=vm, & + mesh_ctsm=mesh, ni=ni, nj=nj, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else call NUOPC_CompAttributeGet(gcomp, name='mesh_mask', value=meshfile_mask, rc=rc) diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index ec2f0ed19f..0f9ec9bd51 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -2,7 +2,7 @@ module lnd_set_decomp_and_domain use ESMF use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl - use shr_sys_mod , only : shr_sys_abort + use shr_sys_mod , only : shr_sys_abort use spmdMod , only : masterproc use clm_varctl , only : iulog @@ -11,7 +11,7 @@ module lnd_set_decomp_and_domain ! Module public routines public :: lnd_set_decomp_and_domain_from_readmesh - public :: lnd_set_decomp_and_domain_from_newmesh + public :: lnd_set_decomp_and_domain_from_createmesh ! Module private routines private :: lnd_get_global_dims @@ -19,11 +19,10 @@ module lnd_set_decomp_and_domain private :: lnd_set_lndmask_from_lndmesh private :: lnd_set_ldomain_gridinfo_from_mesh private :: chkerr - private :: nc_check_err + private :: pio_check_err character(len=*) , parameter :: u_FILE_u = & __FILE__ - character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -38,13 +37,7 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf use domainMod , only : ldomain, domain_init use decompMod , only : ldecomp, bounds_type, get_proc_bounds use clm_varpar , only : nlevsoi - use clm_varctl , only : fatmlndfrc, use_soil_moisture_streams, single_column - use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile - use ncdio_pio , only : ncd_defdim, ncd_defvar, ncd_enddef, ncd_inqdlen - use ncdio_pio , only : ncd_int, ncd_double, ncd_pio_createfile - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getfil + use clm_varctl , only : use_soil_moisture_streams ! input/output variables character(len=*) , intent(in) :: mode ! lilac or nuopc mode @@ -59,121 +52,61 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf type(ESMF_Mesh) :: mesh_maskinput type(ESMF_Mesh) :: mesh_lndinput type(ESMF_DistGrid) :: distgrid_ctsm - character(CL) :: cvalue ! config data - integer :: nlnd, nocn ! local size of arrays integer :: g,n ! indices + integer :: nlnd, nocn ! local size of arrays + integer :: gsize ! global size of grid + logical :: isgrid2d ! true => grid is 2d type(bounds_type) :: bounds ! bounds - integer :: begg,endg + integer :: begg,endg ! local bounds integer , pointer :: gindex_lnd(:) ! global index space for just land points integer , pointer :: gindex_ocn(:) ! global index space for just ocean points integer , pointer :: gindex_ctsm(:) ! global index space for land and ocean points - integer , pointer :: gindex_input(:) ! global index space for land and ocean points integer , pointer :: lndmask_glob(:) real(r8) , pointer :: lndfrac_glob(:) - integer :: lsize_input - integer :: gsize - logical :: isgrid2d - character(len=CL) :: locfn - type(file_desc_t) :: ncid ! netcdf file id - integer :: dimid ! netCDF dimension id - integer :: varid - logical :: readvar ! read variable in or not - logical :: fileexists - logical :: read_fatmlndfrc - logical :: write_landmask_file - logical :: read_landmask_file - character(len=CL) :: flandfrac = 'landfrac.nc' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - ! Determine global 2d sizes from read of dimensions of surface dataset - call lnd_get_global_dims(ni, nj, gsize, isgrid2d) + ! Write diag info + if (masterproc) then + write(iulog,*) + write(iulog,'(a)')' Input land mesh file '//trim(meshfile_lnd) + write(iulog,'(a)')' Input mask mesh file '//trim(meshfile_mask) + if (trim(meshfile_mask) /= trim(meshfile_lnd)) then + write(iulog, '(a)') ' Obtaining land mask and fraction from mask file '//trim(meshfile_mask) + else + write(iulog, '(a)') ' Obtaining land mask and fraction from land mesh file '//trim(meshfile_lnd) + end if + write(iulog,*) + end if - ! Allocate global memory for land mask and land fraction + ! Determine global 2d sizes from read of dimensions of surface dataset and allocate global memory + call lnd_get_global_dims(ni, nj, gsize, isgrid2d) allocate(lndmask_glob(gsize)); lndmask_glob(:) = 0 allocate(lndfrac_glob(gsize)); lndfrac_glob(:) = 0._r8 - ! read in the land mesh from the file + ! Read in the land mesh from the file mesh_lndinput = ESMF_MeshCreate(filename=trim(meshfile_lnd), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,'(a)')'land mesh file ',trim(meshfile_lnd) - end if - if (mode == 'lilac') then - ! TODO: how can lilac be generalized to not read fatmlndfrc- for now this is hard-wired - read_fatmlndfrc = .true. - else - read_fatmlndfrc = .false. + ! Read in mask meshfile if needed + if (trim(meshfile_mask) /= trim(meshfile_lnd)) then + mesh_maskinput = ESMF_MeshCreate(filename=trim(meshfile_mask), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - ! Set global land fraction and global land mask across all processors - if (read_fatmlndfrc) then - - ! Read in global land mask and land fraction from fatmlndfrc - call getfil( trim(fatmlndfrc), locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_io(ncid=ncid, varname='mask', data=lndmask_glob, flag='read', readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: variable mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - allocate(lndfrac_glob(ni*nj)); lndfrac_glob(:) = 0._r8 - call ncd_io(ncid=ncid, varname='frac', data=lndfrac_glob, flag='read', readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: variable frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - call ncd_pio_closefile(ncid) - + ! Determine lndmask_glob and lndfrac_glob + if (trim(meshfile_mask) /= trim(meshfile_lnd)) then + ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh + call lnd_set_lndmask_from_maskmesh(mesh_lndinput, mesh_maskinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return else - - ! TODO: write landmask_file on initialization and read it in on restart or branch - ! for now see if any tests fail like ERP if the file is not written out - write_landmask_file = .false. - read_landmask_file = .false. - - ! Read in mask mesh file if its not null, map the mask to the land mesh and write out the landfrac and land mask - if (trim(meshfile_mask) /= 'null') then - ! first read in mask meshfile - mesh_maskinput = ESMF_MeshCreate(filename=trim(meshfile_mask), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (masterproc) then - write(iulog,'(a)')'mask mesh file ',trim(meshfile_mask) - end if - ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh - call lnd_set_lndmask_from_maskmesh(mesh_lndinput, mesh_maskinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - if (write_landmask_file) then - ! NOW write land mesh/fraction to file in executable directory - this will be used from now on - if (masterproc) then - write(iulog,*) - write(iulog,'(a)') 'lnd_set_decomp_and_domain: writing landmask and landfrac data to landfrac.nc' - write(iulog,*) - end if - call ncd_pio_createfile(ncid, trim(flandfrac)) - call ncd_defdim (ncid, 'gridcell', gsize, dimid) - call ncd_defvar(ncid=ncid, varname='landmask', xtype=ncd_int , dim1name='gridcell') - call ncd_defvar(ncid=ncid, varname='landfrac', xtype=ncd_double, dim1name='gridcell') - call ncd_enddef(ncid) - call ncd_io(ncid=ncid, varname='landmask', data=lndmask_glob, flag='write') - call ncd_io(ncid=ncid, varname='landfrac', data=lndfrac_glob, flag='write') - call ncd_pio_closefile(ncid) - else if (read_landmask_file) then - if (masterproc) then - write(iulog,*) - write(iulog,'(a)') 'lnd_set_decomp_and_domain: reading landmask and landfrac data from landfrac.nc' - write(iulog,*) - end if - call ncd_pio_openfile (ncid, trim(flandfrac), 0) - call ncd_io(ncid=ncid, varname='landmask', data=lndmask_glob, flag='read') - call ncd_io(ncid=ncid, varname='landfrac', data=lndfrac_glob, flag='read') - call ncd_pio_closefile(ncid) - end if - else - ! obtain land mask from land mesh file - assume that land frac is identical to land mask - call lnd_set_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + ! obtain land mask from land mesh file - assume that land frac is identical to land mask + call lnd_set_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - ! Determine lnd decomposition that will be used by ctsm + ! Determine lnd decomposition that will be used by ctsm from lndmask_glob call decompInit_lnd(lni=ni, lnj=nj, amask=lndmask_glob) if (use_soil_moisture_streams) then call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) @@ -208,6 +141,8 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf ldomain%mask(g) = lndmask_glob(gindex_lnd(n)) ldomain%frac(g) = lndfrac_glob(gindex_lnd(n)) end do + + ! Deallocate global pointer memory deallocate(lndmask_glob) deallocate(lndfrac_glob) @@ -232,13 +167,249 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf call lnd_set_ldomain_gridinfo_from_mesh(mesh_ctsm, vm, gindex_ctsm, begg, endg, isgrid2d, ni, nj, ldomain, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Deallocate memory + ! Deallocate local pointer memory deallocate(gindex_lnd) deallocate(gindex_ocn) deallocate(gindex_ctsm) end subroutine lnd_set_decomp_and_domain_from_readmesh + !=============================================================================== + subroutine lnd_set_decomp_and_domain_from_createmesh(domain_file, vm, mesh_ctsm, ni, nj, rc) + + ! Generate a new mesh from the input domain file and set the mask to 1 + + use decompInitMod , only : decompInit_lnd, decompInit_lnd3D + use decompMod , only : ldecomp, bounds_type, get_proc_bounds + use domainMod , only : ldomain, domain_init + use clm_varctl , only : use_soil_moisture_streams + use clm_varctl , only : scmlat, scmlon, single_column + use clm_varpar , only : nlevsoi + use ncdio_pio , only : pio_subsystem, io_type + use pio + + ! input/output variables + character(len=CL) , intent(in) :: domain_file + type(ESMF_VM) , intent(in) :: vm + type(ESMF_Mesh) , intent(out) :: mesh_ctsm + integer , intent(out) :: ni,nj ! global grid dimensions + integer , intent(out) :: rc + + ! local variables + type(ESMF_Grid) :: lgrid + type(ESMF_Mesh) :: mesh_lndcreate + type(ESMF_DistGrid) :: distgrid_ctsm + integer, pointer :: gindex_ctsm(:) ! global index space for just land points + logical :: isgrid2d + integer :: i,j,g,n + integer :: nv + integer :: ierr + integer :: dimid + integer :: varid_xv, varid_yv + integer :: varid_xc, varid_yc + integer :: varid_area + real(r8), allocatable :: xc(:,:), yc(:,:) ! coordinates of centers + real(r8), allocatable :: xv(:,:,:), yv(:,:,:) ! coordinates of corners + integer :: maxIndex(2) + real(r8) :: mincornerCoord(2) + real(r8) :: maxcornerCoord(2) + integer :: spatialDim + integer :: numownedelements + real(r8) , pointer :: ownedElemCoords(:) + integer, allocatable :: lnd_mask(:) + type(bounds_type) :: bounds ! bounds + integer :: begg,endg + integer :: nlnd + integer :: start(2) ! start index to read in for single column mode + integer :: count(2) ! number of points to read in + real(r8) :: scol_data(1) ! temporary + integer , allocatable :: mask(:) ! temporary + real(r8), allocatable :: lats(:) ! temporary + real(r8), allocatable :: lons(:) ! temporary + real(r8), allocatable :: pos_lons(:) ! temporary + real(r8) :: pos_scmlon ! temporary + real(r8) :: scol_area ! temporary + type(file_desc_t) :: pioid + integer :: rcode ! error code + !------------------------------------------------------------------------------- + + rc = ESMF_SUCCESS + + rcode = pio_openfile(pio_subsystem, pioid, io_type, trim(domain_file), pio_nowrite) + call pio_check_err(rcode, 'error opening file '//trim(domain_file)) + call pio_seterrorhandling(pioid, PIO_BCAST_ERROR) + rcode = pio_inq_dimid(pioid, 'ni', dimid) + call pio_check_err(rcode, 'pio_inq_dimid for ni in file '//trim(domain_file)) + rcode = pio_inquire_dimension(pioid, dimid, len=ni) + call pio_check_err(rcode, 'pio_inq_dimension for ni in file '//trim(domain_file)) + rcode = pio_inq_dimid(pioid, 'nj', dimid) + call pio_check_err(rcode, 'pio_inq_dimid for nj in file '//trim(domain_file)) + rcode = pio_inquire_dimension(pioid, dimid, len=nj) + call pio_check_err(rcode, 'pio_inq_dimension for nj in file '//trim(domain_file)) + rcode = pio_inq_dimid(pioid, 'nv', dimid) + call pio_check_err(rcode, 'pio_inq_dimid for nv in file '//trim(domain_file)) + rcode = pio_inquire_dimension(pioid, dimid, len=nv) + call pio_check_err(rcode, 'pio_inq_dimension for nv in file '//trim(domain_file)) + rcode = pio_inq_varid(pioid, 'xc' , varid_xc) + call pio_check_err(rcode, 'pio_inq_varid for yc in file '//trim(domain_file)) + rcode = pio_inq_varid(pioid, 'yc' , varid_yc) + call pio_check_err(rcode, 'pio_inq_varid for yc in file '//trim(domain_file)) + rcode = pio_inq_varid(pioid, 'xv' , varid_xv) + call pio_check_err(rcode, 'pio_inq_varid for xv in file '//trim(domain_file)) + rcode = pio_inq_varid(pioid, 'yv' , varid_yv) + call pio_check_err(rcode, 'pio_inq_varid for yv in file '//trim(domain_file)) + rcode = pio_inq_varid(pioid, 'area', varid_area) + call pio_check_err(rcode, 'pio_inq_varid for area in file '//trim(domain_file)) + + if (single_column) then + + ! In this case the domain file is not a single point file - but normally a + ! global domain file where a nearest neighbor search will be done to find + ! the closest point in the domin file to scol_lon and scol_lat + + ! get center lats and lons from domain file + allocate(xc(ni,nj)) + allocate(yc(ni,nj)) + rcode = pio_get_var(pioid, varid_xc, xc) + call pio_check_err(rcode, 'pio_get_var for xc in file '//trim(domain_file)) + rcode = pio_get_var(pioid, varid_yc, yc) + call pio_check_err(rcode, 'pio_get_var for yc in file '//trim(domain_file)) + + ! find nearest neighbor indices of scmlon and scmlat in domain file + allocate(lats(nj)) + allocate(lons(ni)) + allocate(pos_lons(ni)) + do i = 1,ni + lons(i) = xc(i,1) + end do + do j = 1,nj + lats(j) = yc(1,j) + end do + pos_lons(:) = mod(lons(:) + 360._r8, 360._r8) + pos_scmlon = mod(scmlon + 360._r8, 360._r8) + start(1) = (MINLOC(abs(pos_lons - pos_scmlon), dim=1)) + start(2) = (MINLOC(abs(lats -scmlat ), dim=1)) + count(:) = 1 + deallocate(lons) + deallocate(lats) + + ! read in value of nearest neighbor lon and RESET scmlat + rcode = pio_get_var(pioid, varid_xc, start, count, scol_data) + call pio_check_err(rcode, 'pio_get_var for xc in file '//trim(domain_file)) + scmlon = scol_data(1) + + ! read in value of nearest neighbor lon and RESET scmlon + rcode = pio_get_var(pioid, varid_yc, start, count, scol_data) + call pio_check_err(rcode, 'pio_get_var for yc in file '//trim(domain_file)) + scmlat = scol_data(1) + + ! get area of gridcell + rcode = pio_get_var(pioid, varid_area, start, count, scol_data) + call pio_check_err(rcode, 'pio_get_var for area in file '//trim(domain_file)) + scol_area = scol_data(1) + + ! reset ni and nj to be single point values + ni = 1 + nj = 1 + + ! determine mincornerCoord and maxcornerCoord neede to create ESMF grid + maxIndex(1) = 1 ! number of lons + maxIndex(2) = 1 ! number of lats + mincornerCoord(1) = scmlon - scol_area/2._r8 ! min lon + mincornerCoord(2) = scmlat - scol_area/2._r8 ! min lat + maxcornerCoord(1) = scmlon + scol_area/2._r8 ! max lon + maxcornerCoord(2) = scmlat + scol_area/2._r8 ! max lat + deallocate(xc,yc) + + else + + ! allocate xv and yv and read them in + allocate(xv(nv,ni,nj)) + allocate(yv(nv,ni,nj)) + rcode = pio_get_var(pioid, varid_xv, xv) + call pio_check_err(rcode, 'pio_get_var for xv in file '//trim(domain_file)) + rcode = pio_get_var(pioid, varid_yv, yv) + call pio_check_err(rcode, 'pio_get_var for yv in file '//trim(domain_file)) + + ! determine mincornerCoord and maxcornerCoord neede to create ESMF grid + maxIndex(1) = ni ! number of lons + maxIndex(2) = nj ! number of lats + mincornerCoord(1) = xv(1,1,1) ! min lon + mincornerCoord(2) = yv(1,1,1) ! min lat + maxcornerCoord(1) = xv(3,ni,nj) ! max lon + maxcornerCoord(2) = yv(3,ni,nj) ! max lat + deallocate(xv,yv) + + end if + + ! close file + call pio_seterrorhandling(pioid, PIO_INTERNAL_ERROR) + call pio_closefile(pioid) + + ! create the ESMF grid + lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & + mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & + staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! create the mesh from the lgrid + mesh_lndcreate = ESMF_MeshCreate(lgrid, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Set the mesh mask to 1 + call ESMF_MeshGet(mesh_lndcreate, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(ownedElemCoords(spatialDim*numownedelements)) + call ESMF_MeshGet(mesh_lndcreate, ownedElemCoords=ownedElemCoords, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + allocate(lnd_mask(numownedelements)) + lnd_mask(:) = 1 + ! call ESMF_MeshSet(mesh_lndcreate, elementMask=lnd_mask, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Determine ldecomp and ldomain + call decompInit_lnd(lni=ni, lnj=nj, amask=lnd_mask) + if (use_soil_moisture_streams) then + call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) + end if + + ! Initialize processor bounds + call get_proc_bounds(bounds) + begg = bounds%begg + endg = bounds%endg + + ! Create gindex_ctsm + nlnd = endg - begg + 1 + allocate(gindex_ctsm(nlnd)) + do g = begg, endg + n = 1 + (g - begg) + gindex_ctsm(n) = ldecomp%gdc2glo(g) + end do + + ! Initialize domain data structure + isgrid2d = .true. + call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + + ! Determine ldomain%mask and ldomain%frac + do g = begg, endg + ldomain%mask(g) = 1 + ldomain%frac(g) = 1._r8 + end do + + ! Generate a new mesh on the gindex decomposition + distGrid_ctsm = ESMF_DistGridCreate(arbSeqIndexList=gindex_ctsm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + mesh_ctsm = ESMF_MeshCreate(mesh_lndcreate, elementDistGrid=distgrid_ctsm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + ! Set ldomain%lonc, ldomain%latc and ldomain%area + call lnd_set_ldomain_gridinfo_from_mesh(mesh_ctsm, vm, gindex_ctsm, begg, endg, isgrid2d, ni, nj, ldomain, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + deallocate(lnd_mask) + + end subroutine lnd_set_decomp_and_domain_from_createmesh + !=============================================================================== subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) @@ -313,136 +484,6 @@ subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) end subroutine lnd_get_global_dims - !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_newmesh(domain_file, mesh, ni, nj, rc) - - ! Generate a new mesh from the input domain file and set the mask to 1 - - use decompInitMod , only : decompInit_lnd, decompInit_lnd3D - use decompMod , only : ldecomp, bounds_type, get_proc_bounds - use domainMod , only : ldomain, domain_init - use clm_varctl , only : use_soil_moisture_streams, single_column - use clm_varpar , only : nlevsoi - use netcdf , only : nf90_open, nf90_nowrite, nf90_noerr, nf90_close, nf90_strerror - use netcdf , only : nf90_inq_dimid, nf90_inq_varid, nf90_get_var - use netcdf , only : nf90_inquire_dimension, nf90_inquire_variable - - ! input/output variables - character(len=CL) , intent(in) :: domain_file - type(ESMF_Mesh) , intent(out) :: mesh - integer , intent(out) :: ni,nj ! global grid dimensions - integer , intent(out) :: rc - - ! local variables - logical :: isgrid2d - integer :: g,n - integer :: nv - integer :: ncid, ierr - integer :: dimid_ni, dimid_nj, dimid_nv - integer :: maxIndex(2) - real(r8) :: mincornerCoord(2) - real(r8) :: maxcornerCoord(2) - type(ESMF_Grid) :: lgrid - real(r8), allocatable :: xv(:,:,:), yv(:,:,:) - integer :: varid_xv, varid_yv - integer :: numownedelements - integer, allocatable :: lnd_mask(:) - type(bounds_type) :: bounds ! bounds - integer :: begg,endg - integer :: nlnd - integer, pointer :: gindex_lnd(:) ! global index space for just land points - !------------------------------------------------------------------------------- - - rc = ESMF_SUCCESS - - ! open file - ierr = nf90_open(domain_file, NF90_NOWRITE, ncid) - call nc_check_err(ierr, 'nf90_open', trim(domain_file)) - ! get dimension ids - ierr = nf90_inq_dimid(ncid, 'ni', dimid_ni) - call nc_check_err(ierr, 'nf90_inq_dimid for ni', trim(domain_file)) - ierr = nf90_inq_dimid(ncid, 'nj', dimid_nj) - call nc_check_err(ierr, 'nf90_inq_dimid for nj', trim(domain_file)) - ierr = nf90_inq_dimid(ncid, 'nv', dimid_nv) - call nc_check_err(ierr, 'nf90_inq_dimid for nv', trim(domain_file)) - ! get dimension values - ierr = nf90_inquire_dimension(ncid, dimid_ni, len=ni) - call nc_check_err(ierr, 'nf90_inq_dimension for ni', trim(domain_file)) - ierr = nf90_inquire_dimension(ncid, dimid_nj, len=nj) - call nc_check_err(ierr, 'nf90_inq_dimension for nj', trim(domain_file)) - ierr = nf90_inquire_dimension(ncid, dimid_nv, len=nv) - call nc_check_err(ierr, 'nf90_inq_dimension for nv', trim(domain_file)) - ! get variable ids - ierr = nf90_inq_varid(ncid, 'xv', varid_xv) - call nc_check_err(ierr, 'nf90_inq_varid for xv', trim(domain_file)) - ierr = nf90_inq_varid(ncid, 'yv', varid_yv) - call nc_check_err(ierr, 'nf90_inq_varid for yv', trim(domain_file)) - ! allocate memory for variables and get variable values - allocate(xv(nv,ni,nj), yv(nv,ni,nj)) - ierr = nf90_get_var(ncid, varid_xv, xv) - call nc_check_err(ierr, 'nf90_get_var for xv', trim(domain_file)) - ierr = nf90_get_var(ncid, varid_yv, yv) - call nc_check_err(ierr, 'nf90_get_var for yv', trim(domain_file)) - ! close file - ierr = nf90_close(ncid) - call nc_check_err(ierr, 'nf90_close', trim(domain_file)) - ! create the grid - maxIndex(1) = ni ! number of lons - maxIndex(2) = nj ! number of lats - mincornerCoord(1) = xv(1,1,1) ! min lon - mincornerCoord(2) = yv(1,1,1) ! min lat - maxcornerCoord(1) = xv(3,ni,nj) ! max lon - maxcornerCoord(2) = yv(3,ni,nj) ! max lat - deallocate(xv,yv) - lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & - mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & - staggerloclist=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! create the mesh from the grid - mesh = ESMF_MeshCreate(lgrid, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Set the mesh mask to 1 - call ESMF_MeshGet(mesh, numOwnedElements=numOwnedElements, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(lnd_mask(numownedelements)) - lnd_mask(:) = 1 - call ESMF_MeshSet(mesh, elementMask=lnd_mask, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Determine ldecomp and ldomain - call decompInit_lnd(lni=ni, lnj=nj, amask=lnd_mask) - if (use_soil_moisture_streams) then - call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) - end if - - ! Initialize processor bounds - call get_proc_bounds(bounds) - begg = bounds%begg - endg = bounds%endg - - ! Create ctsm gindex_lnd - nlnd = endg - begg + 1 - allocate(gindex_lnd(nlnd)) - do g = begg, endg - n = 1 + (g - begg) - gindex_lnd(n) = ldecomp%gdc2glo(g) - end do - - ! Initialize domain data structure - isgrid2d = .true. - call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - - ! Determine ldomain%mask and ldomain%frac - do g = begg, endg - ldomain%mask(g) = 1 - ldomain%frac(g) = 1._r8 - end do - deallocate(lnd_mask) - - end subroutine lnd_set_decomp_and_domain_from_newmesh - !=============================================================================== subroutine lnd_set_lndmask_from_maskmesh(mesh_lnd, mesh_mask, vm, gsize, lndmask_glob, lndfrac_glob, rc) @@ -648,7 +689,7 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr integer , intent(in) :: gindex(:) integer , intent(in) :: begg,endg logical , intent(in) :: isgrid2d - integer , intent(in) :: ni, nj + integer , intent(in) :: ni, nj type(domain_type) , intent(inout) :: ldomain integer , intent(out) :: rc @@ -665,8 +706,8 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr type(ESMF_Field) :: areaField ! for sanity check - remove when this is done - type(file_desc_t) :: ncid ! netcdf id - character(len=CL) :: locfn ! local file name + type(file_desc_t) :: ncid ! netcdf id + character(len=CL) :: locfn ! local file name real(r8), pointer :: lonc_atmlndfrc(:) real(r8), pointer :: latc_atmlndfrc(:) !------------------------------------------------------------------------------- @@ -677,8 +718,6 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr call ESMF_MeshGet(mesh, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return allocate(ownedElemCoords(spatialDim*numownedelements)) - call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords) - if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_MeshGet(mesh, ownedElemCoords=ownedElemCoords, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return do g = begg,endg @@ -748,7 +787,8 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr call ncd_io(ncid=ncid, varname= 'yc' , flag='read', data=latc_atmlndfrc , dim1name=grlnd) do g = begg,endg n = g - begg + 1 - if (abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) > 1.e-11) then + if ( abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) > 1.e-11 .and. & + abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) /= 360._r8) then write(6,'(a,3(d20.13,2x))')'ERROR: lonc_atmlndfrac(n), ldomain%lonc(g), abs(diff) = ',& lonc_atmlndfrc(n), ldomain%lonc(g), abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) call shr_sys_abort() @@ -766,21 +806,15 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr end subroutine lnd_set_ldomain_gridinfo_from_mesh !=============================================================================== - subroutine nc_check_err(ierror, description, filename) - - use shr_sys_mod , only : shr_sys_abort - use netcdf , only : nf90_noerr, nf90_strerror - + subroutine pio_check_err(ierror, description) + use pio, only : PIO_NOERR integer , intent(in) :: ierror character(*), intent(in) :: description - character(*), intent(in) :: filename - - if (ierror /= nf90_noerr) then - write (*,'(6a)') 'ERROR ', trim(description),'. NetCDF file : "', trim(filename),& - '". Error message:', trim(nf90_strerror(ierror)) + if (ierror /= PIO_NOERR) then + write (*,'(6a)') 'ERROR ', trim(description) call shr_sys_abort() endif - end subroutine nc_check_err + end subroutine pio_check_err !=============================================================================== logical function chkerr(rc, line, file) @@ -796,4 +830,52 @@ logical function chkerr(rc, line, file) endif end function chkerr + !=============================================================================== + subroutine lnd_set_read_write_landmask(write_file, read_file, lndmask_glob, lndfrac_glob, gsize) + + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile + use ncdio_pio , only : ncd_defdim, ncd_defvar, ncd_enddef, ncd_inqdlen + use ncdio_pio , only : ncd_int, ncd_double, ncd_pio_createfile + + ! input/output variables + logical , intent(in) :: write_file + logical , intent(in) :: read_file + integer , pointer :: lndmask_glob(:) + real(r8) , pointer :: lndfrac_glob(:) + integer , intent(in) :: gsize + + ! local variables + type(file_desc_t) :: pioid ! netcdf file id + integer :: dimid + character(len=CL) :: flandfrac = 'landfrac.nc' + !------------------------------------------------------------------------------- + + if (write_file) then + if (masterproc) then + write(iulog,*) + write(iulog,'(a)') 'lnd_set_decomp_and_domain: writing landmask and landfrac data to landfrac.nc' + write(iulog,*) + end if + call ncd_pio_createfile(pioid, trim(flandfrac)) + call ncd_defdim (pioid, 'gridcell', gsize, dimid) + call ncd_defvar(ncid=pioid, varname='landmask', xtype=ncd_int , dim1name='gridcell') + call ncd_defvar(ncid=pioid, varname='landfrac', xtype=ncd_double, dim1name='gridcell') + call ncd_enddef(pioid) + call ncd_io(ncid=pioid, varname='landmask', data=lndmask_glob, flag='write') + call ncd_io(ncid=pioid, varname='landfrac', data=lndfrac_glob, flag='write') + call ncd_pio_closefile(pioid) + else if (read_file) then + if (masterproc) then + write(iulog,*) + write(iulog,'(a)') 'lnd_set_decomp_and_domain: reading landmask and landfrac data from landfrac.nc' + write(iulog,*) + end if + call ncd_pio_openfile (pioid, trim(flandfrac), 0) + call ncd_io(ncid=pioid, varname='landmask', data=lndmask_glob, flag='read') + call ncd_io(ncid=pioid, varname='landfrac', data=lndfrac_glob, flag='read') + call ncd_pio_closefile(pioid) + end if + + end subroutine lnd_set_read_write_landmask + end module lnd_set_decomp_and_domain diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index f2e07696f9..53cbd237c2 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -348,16 +348,6 @@ subroutine initialize2(ni,nj) avgflag='A', long_name='convective boundary height', & ptr_col=col%zii, default='inactive') - ! If single-column determine closest latitude and longitude - ! TODO: for mct this should use fatmlnd file - for nuopc should use esmf functionality for nearest neighbor, - ! for lilac not applicable - ! TODO: these values are never used - is scam even working for ctsm? - ! if (single_column) then - ! call getfil (fsurdat, locfn, 0) - ! call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - ! closelat, closelon, closelatidx, closelonidx) - ! end if - ! Initialize instances of all derived types as well as time constant variables call clm_instInit(bounds_proc) From d642e9616d47bf7851a3a1633355d314cec95ed1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 9 Jan 2021 18:21:53 -0700 Subject: [PATCH 1751/1973] Add 1850 Clm51 Bgc and BgcCrop compsets --- cime_config/config_compsets.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index de0139fc63..4567e755e7 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -144,6 +144,11 @@ + + I1850Clm51BgcCrop + 1850_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV + + I1850Clm51Sp 1850_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_MOSART_SGLC_SWAV @@ -238,6 +243,12 @@ + + I1850Clm51Bgc + 1850_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV + + + I1850Clm51SpNoAnthro 1850_DATM%GSWP3v1_CLM51%SP-NOANTHRO_SICE_SOCN_MOSART_SGLC_SWAV From 63e7ae79c85a8073509a3babe478f4b9fa4b36c1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 9 Jan 2021 18:22:36 -0700 Subject: [PATCH 1752/1973] Use cime share constant for specfic heat of water --- src/main/clm_varcon.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/clm_varcon.F90 b/src/main/clm_varcon.F90 index ff9f5e0d2c..9f66d335ad 100644 --- a/src/main/clm_varcon.F90 +++ b/src/main/clm_varcon.F90 @@ -13,7 +13,7 @@ module clm_varcon SHR_CONST_RHOICE,SHR_CONST_TKFRZ,SHR_CONST_REARTH, & SHR_CONST_PDB, SHR_CONST_PI, SHR_CONST_CDAY, & SHR_CONST_RGAS, SHR_CONST_PSTD, & - SHR_CONST_MWDAIR, SHR_CONST_MWWV + SHR_CONST_MWDAIR, SHR_CONST_MWWV, SHR_CONST_CPFW use clm_varpar , only: numrad, nlevgrnd, nlevlak, nlevdecomp_full use clm_varpar , only: ngases use clm_varpar , only: nlayer @@ -81,7 +81,7 @@ module clm_varcon real(r8), public :: alpha_aero = 1.0_r8 ! constant for aerodynamic parameter weighting real(r8), public :: tlsai_crit = 2.0_r8 ! critical value of elai+esai for which aerodynamic parameters are maximum real(r8), public :: watmin = 0.01_r8 ! minimum soil moisture (mm) - real(r8), public :: c_water = 4188_r8 ! specific heat of water [J/kg/K] + real(r8), public :: c_water = SHR_CONST_CPFW ! specific heat of water [J/kg/K] real(r8), public :: c_dry_biomass = 1400_r8 ! specific heat of dry biomass real(r8), public :: re = SHR_CONST_REARTH*0.001_r8 ! radius of earth (km) From cb5bd95a711d117264476c0493480c4c364f0634 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 9 Jan 2021 18:23:51 -0700 Subject: [PATCH 1753/1973] Some formatting changes, and changes that @swensosc found to fix the spinup cases in regard to dt_veg, there were some parenthesis that got out of place --- src/biogeophys/CanopyFluxesMod.F90 | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 01141fa7c3..348af3a613 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -403,20 +403,20 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8) :: dt_veg_temp(bounds%begp:bounds%endp) integer :: iv logical :: is_end_day ! is end of current day - real(r8) :: dbh(bounds%begp:bounds%endp) !diameter at breast height of vegetation - real(r8) :: cp_leaf(bounds%begp:bounds%endp) !heat capacity of leaves - real(r8) :: cp_stem(bounds%begp:bounds%endp) !heat capacity of stems - real(r8) :: rstem(bounds%begp:bounds%endp) !stem resistance to heat transfer - real(r8) :: dt_stem(bounds%begp:bounds%endp) !change in stem temperature - real(r8) :: frac_rad_abs_by_stem(bounds%begp:bounds%endp) !fraction of incoming radiation absorbed by stems - real(r8) :: lw_stem(bounds%begp:bounds%endp) !internal longwave stem - real(r8) :: lw_leaf(bounds%begp:bounds%endp) !internal longwave leaf - real(r8) :: sa_stem(bounds%begp:bounds%endp) !surface area stem m2/m2_ground - real(r8) :: sa_leaf(bounds%begp:bounds%endp) !surface area leaf m2/m2_ground - real(r8) :: sa_internal(bounds%begp:bounds%endp) !min(sa_stem,sa_leaf) - real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed - real(r8) :: carea_stem !cross-sectional area of stem - real(r8) :: dlrad_leaf !Downward longwave radition from leaf + real(r8) :: dbh(bounds%begp:bounds%endp) ! diameter at breast height of vegetation + real(r8) :: cp_leaf(bounds%begp:bounds%endp) ! heat capacity of leaves + real(r8) :: cp_stem(bounds%begp:bounds%endp) ! heat capacity of stems + real(r8) :: rstem(bounds%begp:bounds%endp) ! stem resistance to heat transfer + real(r8) :: dt_stem(bounds%begp:bounds%endp) ! change in stem temperature + real(r8) :: frac_rad_abs_by_stem(bounds%begp:bounds%endp) ! fraction of incoming radiation absorbed by stems + real(r8) :: lw_stem(bounds%begp:bounds%endp) ! internal longwave stem + real(r8) :: lw_leaf(bounds%begp:bounds%endp) ! internal longwave leaf + real(r8) :: sa_stem(bounds%begp:bounds%endp) ! surface area stem m2/m2_ground + real(r8) :: sa_leaf(bounds%begp:bounds%endp) ! surface area leaf m2/m2_ground + real(r8) :: sa_internal(bounds%begp:bounds%endp) ! min(sa_stem,sa_leaf) + real(r8) :: uuc(bounds%begp:bounds%endp) ! undercanopy windspeed + real(r8) :: carea_stem ! cross-sectional area of stem + real(r8) :: dlrad_leaf ! Downward longwave radition from leaf ! Indices for raw and rah integer, parameter :: above_canopy = 1 ! Above canopy @@ -1228,9 +1228,9 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, + bir(p)*t_veg(p)**4 + cir(p)*lw_grnd) & - efsh - efe(p) - lw_leaf(p) + lw_stem(p) & - (cp_leaf(p)/dtime)*(t_veg(p) - tl_ini(p))) & - / ((1._r8-frac_rad_abs_by_stem(p))*(- 4._r8*bir(p)*t_veg(p)**3 & + / ((1._r8-frac_rad_abs_by_stem(p))*(- 4._r8*bir(p)*t_veg(p)**3) & + 4._r8*sa_internal(p)*emv(p)*sb*t_veg(p)**3 & - +dc1*wtga(p) +dc2*wtgaq*qsatldT(p))+ cp_leaf(p)/dtime) + +dc1*wtga(p) +dc2*wtgaq*qsatldT(p)+ cp_leaf(p)/dtime) t_veg(p) = tlbef(p) + dt_veg(p) From 115477d2024ab1e655ef9d05cf48f51c54c30b80 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 9 Jan 2021 18:31:06 -0700 Subject: [PATCH 1754/1973] Add spinup_factor_AD to use for Accel. Decomp. mode --- src/biogeochem/CNVegCarbonStateType.F90 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index 9a754640c7..fd8924c2f1 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -102,7 +102,8 @@ module CNVegCarbonStateType end type cnveg_carbonstate_type - real(r8), public :: spinup_factor = 1.0_r8 ! Spinup factor used when in Accelerated Decomposition mode + real(r8), public :: spinup_factor = 1.0_r8 ! Spinup factor used for this simulation + real(r8), public :: spinup_factor_AD = 10.0_r8 ! Spinup factor used when in Accelerated Decomposition mode ! !PRIVATE DATA: @@ -1245,13 +1246,14 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, if (flag == 'read' .and. spinup_state /= restart_file_spinup_state .and. .not. use_cndv) then if ( masterproc ) write(iulog, *) 'exit_spinup ',exit_spinup,' restart_file_spinup_state ',restart_file_spinup_state + if ( spinup_state == 2 ) spinup_factor = spinup_factor_AD if (spinup_state <= 1 .and. restart_file_spinup_state == 2 ) then if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood C pools out of AD spinup mode' exit_spinup = .true. if ( masterproc ) write(iulog, *) 'Multiplying stemc and crootc by 10 for exit spinup' do i = bounds%begp,bounds%endp - this%deadstemc_patch(i) = this%deadstemc_patch(i) * 10._r8 - this%deadcrootc_patch(i) = this%deadcrootc_patch(i) * 10._r8 + this%deadstemc_patch(i) = this%deadstemc_patch(i) * spinup_factor_AD + this%deadcrootc_patch(i) = this%deadcrootc_patch(i) * spinup_factor_AD end do else if (spinup_state == 2 .and. restart_file_spinup_state <= 1 )then if (spinup_state == 2 .and. restart_file_spinup_state <= 1 )then @@ -1259,8 +1261,8 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, enter_spinup = .true. if ( masterproc ) write(iulog, *) 'Dividing stemc and crootc by 10 for enter spinup ' do i = bounds%begp,bounds%endp - this%deadstemc_patch(i) = this%deadstemc_patch(i) / 10._r8 - this%deadcrootc_patch(i) = this%deadcrootc_patch(i) / 10._r8 + this%deadstemc_patch(i) = this%deadstemc_patch(i) / spinup_factor_AD + this%deadcrootc_patch(i) = this%deadcrootc_patch(i) / spinup_factor_AD end do end if end if From 5b011aa5ce9ec1a1a7abcf581421148b77d14ce1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 10 Jan 2021 09:52:11 -0700 Subject: [PATCH 1755/1973] Change the hardwired 10x multiplier for deadwood to spinup_factor_deadwood, and change the name of it from spinup_factor in CNVegCarbonState to spinup_factor_deadwood since the previous name conflicted with the array in decomp --- src/biogeochem/CNFireBaseMod.F90 | 9 +++------ src/biogeochem/CNFireLi2014Mod.F90 | 9 +++------ src/biogeochem/CNFireLi2016Mod.F90 | 6 +++--- src/biogeochem/CNFireLi2021Mod.F90 | 6 +++--- src/biogeochem/CNGapMortalityMod.F90 | 10 +++++----- src/biogeochem/CNVegCarbonStateType.F90 | 10 +++++----- src/biogeochem/CNVegStructUpdateMod.F90 | 6 +++--- 7 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 index 1ba0efc4d4..b9c125716e 100644 --- a/src/biogeochem/CNFireBaseMod.F90 +++ b/src/biogeochem/CNFireBaseMod.F90 @@ -24,7 +24,7 @@ module CNFireBaseMod use atm2lndType , only : atm2lnd_type use CNDVType , only : dgvs_type use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor_deadwood use CNVegCarbonFluxType , only : cnveg_carbonflux_type use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type @@ -441,7 +441,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! ! !USES: use clm_time_manager , only: get_step_size_real,get_days_per_year,get_curr_date - use clm_varctl , only: use_cndv, spinup_state + use clm_varctl , only: use_cndv use clm_varcon , only: secspday use pftconMod , only: nc3crop use dynSubgridControlMod , only: run_has_transient_landcover @@ -718,10 +718,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! apply this rate to the patch state variables to get flux rates ! biomass burning ! carbon fluxes - m = 1._r8 - if (spinup_state == 2) then - m = 10._r8 - end if + m = spinup_factor_deadwood m_leafc_to_fire(p) = leafc(p) * f * cc_leaf(patch%itype(p)) m_leafc_storage_to_fire(p) = leafc_storage(p) * f * cc_other(patch%itype(p)) diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 index a69efbfeae..e8fd78230e 100644 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ b/src/biogeochem/CNFireLi2014Mod.F90 @@ -17,7 +17,7 @@ module CNFireLi2014Mod use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL use shr_const_mod , only : SHR_CONST_PI,SHR_CONST_TKFRZ use shr_infnan_mod , only : shr_infnan_isnan - use clm_varctl , only : iulog, spinup_state + use clm_varctl , only : iulog use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full use clm_varcon , only : dzsoi_decomp use pftconMod , only : noveg, pftcon @@ -27,7 +27,7 @@ module CNFireLi2014Mod use atm2lndType , only : atm2lnd_type use CNDVType , only : dgvs_type use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor_deadwood use CNVegCarbonFluxType , only : cnveg_carbonflux_type use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type @@ -920,10 +920,7 @@ subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filte ! apply this rate to the patch state variables to get flux rates ! biomass burning ! carbon fluxes - m = 1._r8 - if (spinup_state == 2) then - m = 10._r8 - end if + m = spinup_factor_deadwood m_leafc_to_fire(p) = leafc(p) * f * cc_leaf(patch%itype(p)) m_leafc_storage_to_fire(p) = leafc_storage(p) * f * cc_other(patch%itype(p)) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index b1cdafb4ee..aa1d123a55 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -27,7 +27,7 @@ module CNFireLi2016Mod use atm2lndType , only : atm2lnd_type use CNDVType , only : dgvs_type use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor_deadwood use CNVegCarbonFluxType , only : cnveg_carbonflux_type use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type @@ -422,7 +422,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if if (spinup_state == 2) then rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) * 10._r8 + & + frootc_xfer(p) + deadcrootc(p) * spinup_factor_deadwood + & deadcrootc_storage(p) + deadcrootc_xfer(p) + & livecrootc(p)+livecrootc_storage(p) + & livecrootc_xfer(p))*patch%wtcol(p) @@ -588,7 +588,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ if( cropf_col(c) < 1._r8 )then fuelc(c) = totlitc(c)+totvegc(c)-rootc_col(c)-fuelc_crop(c)*cropf_col(c) if (spinup_state == 2) then - fuelc(c) = fuelc(c) + ((10._r8 - 1._r8)*deadstemc_col(c)) + fuelc(c) = fuelc(c) + ((spinup_factor_deadwood - 1._r8)*deadstemc_col(c)) do j = 1, nlevdecomp fuelc(c) = fuelc(c)+decomp_cpools_vr(c,j,i_cwd) * dzsoi_decomp(j) * spinup_factor(i_cwd) & * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index 77b0693fca..b2f64867f7 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -27,7 +27,7 @@ module CNFireLi2021Mod use atm2lndType , only : atm2lnd_type use CNDVType , only : dgvs_type use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor_deadwood use CNVegCarbonFluxType , only : cnveg_carbonflux_type use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type @@ -423,7 +423,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if if (spinup_state == 2) then rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) * 10._r8 + & + frootc_xfer(p) + deadcrootc(p) * spinup_factor_deadwood + & deadcrootc_storage(p) + deadcrootc_xfer(p) + & livecrootc(p)+livecrootc_storage(p) + & livecrootc_xfer(p))*patch%wtcol(p) @@ -589,7 +589,7 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ if( cropf_col(c) < 1._r8 )then fuelc(c) = totlitc(c)+totvegc(c)-rootc_col(c)-fuelc_crop(c)*cropf_col(c) if (spinup_state == 2) then - fuelc(c) = fuelc(c) + ((10._r8 - 1._r8)*deadstemc_col(c)) + fuelc(c) = fuelc(c) + ((spinup_factor_deadwood - 1._r8)*deadstemc_col(c)) do j = 1, nlevdecomp fuelc(c) = fuelc(c)+decomp_cpools_vr(c,j,i_cwd) * dzsoi_decomp(j) * spinup_factor(i_cwd) & * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) diff --git a/src/biogeochem/CNGapMortalityMod.F90 b/src/biogeochem/CNGapMortalityMod.F90 index e313cdf213..e5acca9a39 100644 --- a/src/biogeochem/CNGapMortalityMod.F90 +++ b/src/biogeochem/CNGapMortalityMod.F90 @@ -14,7 +14,7 @@ module CNGapMortalityMod use shr_log_mod , only : errMsg => shr_log_errMsg use pftconMod , only : pftcon use CNDVType , only : dgvs_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor_deadwood use CNVegCarbonFluxType , only : cnveg_carbonflux_type use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type @@ -192,8 +192,8 @@ subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_so cnveg_carbonflux_inst%m_livestemc_to_litter_patch(p) = cnveg_carbonstate_inst%livestemc_patch(p) * m cnveg_carbonflux_inst%m_livecrootc_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_patch(p) * m if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools - cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * 10._r8 - cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8 + cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * spinup_factor_deadwood + cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * spinup_factor_deadwood else cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m @@ -228,8 +228,8 @@ subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_so cnveg_nitrogenflux_inst%m_livecrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%livecrootn_patch(p) * m if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools - cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_patch(p) * m * 10._r8 - cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_patch(p) * m * 10._r8 + cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_patch(p) * m * spinup_factor_deadwood + cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_patch(p) * m * spinup_factor_deadwood else cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_patch(p) * m cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_patch(p) * m diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index fd8924c2f1..1d6d36fe4e 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -102,8 +102,8 @@ module CNVegCarbonStateType end type cnveg_carbonstate_type - real(r8), public :: spinup_factor = 1.0_r8 ! Spinup factor used for this simulation - real(r8), public :: spinup_factor_AD = 10.0_r8 ! Spinup factor used when in Accelerated Decomposition mode + real(r8), public :: spinup_factor_deadwood = 1.0_r8 ! Spinup factor used for this simulation + real(r8), public :: spinup_factor_AD = 10.0_r8 ! Spinup factor used when in Accelerated Decomposition mode ! !PRIVATE DATA: @@ -1246,11 +1246,11 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, if (flag == 'read' .and. spinup_state /= restart_file_spinup_state .and. .not. use_cndv) then if ( masterproc ) write(iulog, *) 'exit_spinup ',exit_spinup,' restart_file_spinup_state ',restart_file_spinup_state - if ( spinup_state == 2 ) spinup_factor = spinup_factor_AD + if ( spinup_state == 2 ) spinup_factor_deadwood = spinup_factor_AD if (spinup_state <= 1 .and. restart_file_spinup_state == 2 ) then if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood C pools out of AD spinup mode' exit_spinup = .true. - if ( masterproc ) write(iulog, *) 'Multiplying stemc and crootc by 10 for exit spinup' + if ( masterproc ) write(iulog, *) 'Multiplying stemc and crootc by ', spinup_factor_AD, ' for exit spinup' do i = bounds%begp,bounds%endp this%deadstemc_patch(i) = this%deadstemc_patch(i) * spinup_factor_AD this%deadcrootc_patch(i) = this%deadcrootc_patch(i) * spinup_factor_AD @@ -1259,7 +1259,7 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, if (spinup_state == 2 .and. restart_file_spinup_state <= 1 )then if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood C pools into AD spinup mode' enter_spinup = .true. - if ( masterproc ) write(iulog, *) 'Dividing stemc and crootc by 10 for enter spinup ' + if ( masterproc ) write(iulog, *) 'Dividing stemc and crootc by ', spinup_factor_AD, 'for enter spinup ' do i = bounds%begp,bounds%endp this%deadstemc_patch(i) = this%deadstemc_patch(i) / spinup_factor_AD this%deadcrootc_patch(i) = this%deadcrootc_patch(i) / spinup_factor_AD diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index d9740e7ef9..91055508b9 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -13,7 +13,7 @@ module CNVegStructUpdateMod use CNDVType , only : dgvs_type use CNVegStateType , only : cnveg_state_type use CropType , only : crop_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor + use CNVegCarbonStateType , only : cnveg_carbonstate_type, spinup_factor_deadwood use CanopyStateType , only : canopystate_type use PatchType , only : patch use decompMod , only : bounds_type @@ -200,7 +200,7 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & else !correct height calculation if doing accelerated spinup if (spinup_state == 2) then - htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper(ivt(p)) * taper(ivt(p)))/ & + htop(p) = ((3._r8 * deadstemc(p) * spinup_factor_deadwood * taper(ivt(p)) * taper(ivt(p)))/ & (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) else htop(p) = ((3._r8 * deadstemc(p) * taper(ivt(p)) * taper(ivt(p)))/ & @@ -217,7 +217,7 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & leaf_biomass(p) = max(0.0025_r8,leafc(p)) & * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) - stem_biomass(p) = (spinup_factor*deadstemc(p) + livestemc(p)) & + stem_biomass(p) = (spinup_factor_deadwood*deadstemc(p) + livestemc(p)) & * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) else From 7889677a6c07f9ea7c4ae6b9a991a3575d19c7fb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 10 Jan 2021 14:27:30 -0700 Subject: [PATCH 1756/1973] Correct the note about the spinup factor --- src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 index 98951f9b56..8305fcefe6 100644 --- a/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 @@ -668,7 +668,9 @@ subroutine decomp_rate_constants_cn(bounds, & end if ! The following code implements the acceleration part of the AD spinup - ! algorithm, by multiplying all of the SOM decomposition base rates by 10.0. + ! algorithm, by multiplying all of the SOM decomposition base rates by + ! spinup_vector, scalar between 1 and 70X, defined as a constant for each + ! pool here if ( spinup_state .eq. 1 ) then k_s1 = k_s1 * params_inst%spinup_vector(1) From 50d87ec91886cba50c3fbe411eaafffe7ff99e60 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 10 Jan 2021 22:12:12 -0700 Subject: [PATCH 1757/1973] Pass deadwood spinup_factor into NitrogenState rather than using a hardcoded constant of 10. --- src/biogeochem/CNVegCarbonStateType.F90 | 6 +++++- src/biogeochem/CNVegNitrogenStateType.F90 | 16 +++++++++------- src/biogeochem/CNVegetationFacade.F90 | 9 +++++++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index 1d6d36fe4e..f7c9178453 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -1039,7 +1039,7 @@ end subroutine InitCold !----------------------------------------------------------------------- subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, & c12_cnveg_carbonstate_inst, filter_reseed_patch, & - num_reseed_patch) + num_reseed_patch, spinup_factor4deadwood ) ! ! !DESCRIPTION: ! Read/write CN restart data for carbon state @@ -1065,6 +1065,7 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, type (cnveg_carbonstate_type) , intent(in), optional :: c12_cnveg_carbonstate_inst integer , intent(out), optional :: filter_reseed_patch(:) integer , intent(out), optional :: num_reseed_patch + real(r8) , intent(out), optional :: spinup_factor4deadwood ! ! !LOCAL VARIABLES: integer :: i,j,k,l,c,p @@ -2285,6 +2286,9 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, end if end if + ! Output spinup factor for deadwood (dead stem and dead course root) + if ( present(spinup_factor4deadwood) ) spinup_factor4deadwood = spinup_factor_AD + end subroutine Restart !----------------------------------------------------------------------- diff --git a/src/biogeochem/CNVegNitrogenStateType.F90 b/src/biogeochem/CNVegNitrogenStateType.F90 index 1b06cd3fc3..10a191ded9 100644 --- a/src/biogeochem/CNVegNitrogenStateType.F90 +++ b/src/biogeochem/CNVegNitrogenStateType.F90 @@ -529,7 +529,8 @@ end subroutine InitCold !----------------------------------------------------------------------- subroutine Restart ( this, bounds, ncid, flag, leafc_patch, & leafc_storage_patch, frootc_patch, frootc_storage_patch, & - deadstemc_patch, filter_reseed_patch, num_reseed_patch ) + deadstemc_patch, filter_reseed_patch, num_reseed_patch, & + spinup_factor_deadwood ) ! ! !DESCRIPTION: ! Read/write restart data @@ -554,6 +555,7 @@ subroutine Restart ( this, bounds, ncid, flag, leafc_patch, & real(r8) , intent(in) :: deadstemc_patch(bounds%begp:) integer , intent(in) :: filter_reseed_patch(:) integer , intent(in) :: num_reseed_patch + real(r8) , intent(in) :: spinup_factor_deadwood ! ! !LOCAL VARIABLES: integer :: i, p, l @@ -719,18 +721,18 @@ subroutine Restart ( this, bounds, ncid, flag, leafc_patch, & if (spinup_state <= 1 .and. restart_file_spinup_state == 2 ) then if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood N pools out of AD spinup mode' exit_spinup = .true. - if ( masterproc ) write(iulog, *) 'Multiplying stemn and crootn by 10 for exit spinup ' + if ( masterproc ) write(iulog, *) 'Multiplying stemn and crootn by ', spinup_factor_deadwood, 'for exit spinup ' do i = bounds%begp,bounds%endp - this%deadstemn_patch(i) = this%deadstemn_patch(i) * 10._r8 - this%deadcrootn_patch(i) = this%deadcrootn_patch(i) * 10._r8 + this%deadstemn_patch(i) = this%deadstemn_patch(i) * spinup_factor_deadwood + this%deadcrootn_patch(i) = this%deadcrootn_patch(i) * spinup_factor_deadwood end do else if (spinup_state == 2 .and. restart_file_spinup_state <= 1 ) then if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood N pools into AD spinup mode' enter_spinup = .true. - if ( masterproc ) write(iulog, *) 'Dividing stemn and crootn by 10 for enter spinup ' + if ( masterproc ) write(iulog, *) 'Dividing stemn and crootn by ', spinup_factor_deadwood, 'for enter spinup ' do i = bounds%begp,bounds%endp - this%deadstemn_patch(i) = this%deadstemn_patch(i) / 10._r8 - this%deadcrootn_patch(i) = this%deadcrootn_patch(i) / 10._r8 + this%deadstemn_patch(i) = this%deadstemn_patch(i) / spinup_factor_deadwood + this%deadcrootn_patch(i) = this%deadcrootn_patch(i) / spinup_factor_deadwood end do endif diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index d0741e68ff..9ef32b4563 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -451,6 +451,7 @@ subroutine Restart(this, bounds, ncid, flag) ! !LOCAL VARIABLES: integer :: begp, endp + real(r8) :: spinup_factor4deadwood ! Spinup factor used for deadwood (dead-stem and dead course root) character(len=*), parameter :: subname = 'Restart' !----------------------------------------------------------------------- @@ -460,10 +461,13 @@ subroutine Restart(this, bounds, ncid, flag) endp = bounds%endp call this%cnveg_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c12', & reseed_dead_plants=this%reseed_dead_plants, filter_reseed_patch=reseed_patch, & - num_reseed_patch=num_reseed_patch ) + num_reseed_patch=num_reseed_patch, spinup_factor4deadwood=spinup_factor4deadwood ) if ( flag /= 'read' .and. num_reseed_patch /= 0 )then call endrun(msg="ERROR num_reseed should be zero and is not"//errmsg(sourcefile, __LINE__)) end if + if ( flag /= 'read' .and. spinup_factor4deadwood /= 10_r8 )then + call endrun(msg="ERROR spinup_factor4deadwood should be 10 and is not"//errmsg(sourcefile, __LINE__)) + end if if (use_c13) then call this%c13_cnveg_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c13', & reseed_dead_plants=this%reseed_dead_plants, c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) @@ -487,7 +491,8 @@ subroutine Restart(this, bounds, ncid, flag) frootc_patch=this%cnveg_carbonstate_inst%frootc_patch(begp:endp), & frootc_storage_patch=this%cnveg_carbonstate_inst%frootc_storage_patch(begp:endp), & deadstemc_patch=this%cnveg_carbonstate_inst%deadstemc_patch(begp:endp), & - filter_reseed_patch=reseed_patch, num_reseed_patch=num_reseed_patch) + filter_reseed_patch=reseed_patch, num_reseed_patch=num_reseed_patch, & + spinup_factor_deadwood=spinup_factor4deadwood ) call this%cnveg_nitrogenflux_inst%restart(bounds, ncid, flag=flag) call this%cnveg_state_inst%restart(bounds, ncid, flag=flag, & cnveg_carbonstate=this%cnveg_carbonstate_inst, & From 79a94d2fcd87273d17fa1644e9d774f8b03bb813 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 10 Jan 2021 23:30:56 -0700 Subject: [PATCH 1758/1973] Remove some logic regarding spinup_state and just use spinup_factor_deadwood, so the logic isn't needed anymore (answers for SSP_Ld10.f19_g17.I1850Clm50Bgc.cheyenne_intel.clm-rtmColdSSP remain identical). This simplifies and makes the code more robust by removing some duplicated lines --- src/biogeochem/CNFireLi2016Mod.F90 | 10 +--------- src/biogeochem/CNFireLi2021Mod.F90 | 10 +--------- src/biogeochem/CNGapMortalityMod.F90 | 9 ++------- src/biogeochem/CNVegStructUpdateMod.F90 | 7 +------ 4 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 index aa1d123a55..afd661cd28 100644 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ b/src/biogeochem/CNFireLi2016Mod.F90 @@ -420,19 +420,11 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end if end if - if (spinup_state == 2) then - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & frootc_xfer(p) + deadcrootc(p) * spinup_factor_deadwood + & deadcrootc_storage(p) + deadcrootc_xfer(p) + & livecrootc(p)+livecrootc_storage(p) + & livecrootc_xfer(p))*patch%wtcol(p) - else - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - endif fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) diff --git a/src/biogeochem/CNFireLi2021Mod.F90 b/src/biogeochem/CNFireLi2021Mod.F90 index b2f64867f7..973bbf46ed 100644 --- a/src/biogeochem/CNFireLi2021Mod.F90 +++ b/src/biogeochem/CNFireLi2021Mod.F90 @@ -421,19 +421,11 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ end if end if end if - if (spinup_state == 2) then - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & + rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & frootc_xfer(p) + deadcrootc(p) * spinup_factor_deadwood + & deadcrootc_storage(p) + deadcrootc_xfer(p) + & livecrootc(p)+livecrootc_storage(p) + & livecrootc_xfer(p))*patch%wtcol(p) - else - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - endif fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) diff --git a/src/biogeochem/CNGapMortalityMod.F90 b/src/biogeochem/CNGapMortalityMod.F90 index e5acca9a39..cd02221de4 100644 --- a/src/biogeochem/CNGapMortalityMod.F90 +++ b/src/biogeochem/CNGapMortalityMod.F90 @@ -191,13 +191,8 @@ subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_so cnveg_carbonflux_inst%m_frootc_to_litter_patch(p) = cnveg_carbonstate_inst%frootc_patch(p) * m cnveg_carbonflux_inst%m_livestemc_to_litter_patch(p) = cnveg_carbonstate_inst%livestemc_patch(p) * m cnveg_carbonflux_inst%m_livecrootc_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_patch(p) * m - if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools - cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * spinup_factor_deadwood - cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * spinup_factor_deadwood - else - cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m - cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m - end if + cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * spinup_factor_deadwood + cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * spinup_factor_deadwood ! storage pools cnveg_carbonflux_inst%m_leafc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%leafc_storage_patch(p) * m diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 91055508b9..1c0ec70fa0 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -199,13 +199,8 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & else !correct height calculation if doing accelerated spinup - if (spinup_state == 2) then - htop(p) = ((3._r8 * deadstemc(p) * spinup_factor_deadwood * taper(ivt(p)) * taper(ivt(p)))/ & + htop(p) = ((3._r8 * deadstemc(p) * spinup_factor_deadwood * taper(ivt(p)) * taper(ivt(p)))/ & (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) - else - htop(p) = ((3._r8 * deadstemc(p) * taper(ivt(p)) * taper(ivt(p)))/ & - (SHR_CONST_PI * nstem(ivt(p)) * dwood(ivt(p))))**(1._r8/3._r8) - end if endif From 6455221078d05af8b1c4cd6cc2d94cead2db5a26 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 11 Jan 2021 12:40:17 -0700 Subject: [PATCH 1759/1973] added more diagnostic output info --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 244 ++++++++++++---------------- src/cpl/nuopc/lnd_import_export.F90 | 71 ++++---- 2 files changed, 143 insertions(+), 172 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 373c16c486..0b1c41445c 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -165,17 +165,19 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_VM) :: vm - integer :: lmpicom - integer :: ierr - integer :: n - integer :: localpet - integer :: compid ! component id - integer :: shrlogunit ! original log unit - character(len=CL) :: cvalue - character(len=CL) :: logmsg - logical :: isPresent, isSet - logical :: cism_evolve + type(ESMF_VM) :: vm + integer :: lmpicom + integer :: ierr + integer :: n + integer :: localpet + integer :: compid ! component id + integer :: shrlogunit ! original log unit + character(len=CL) :: cvalue + character(len=CL) :: logmsg + logical :: cism_evolve + character(len=CL) :: atm_model + character(len=CL) :: rof_model + character(len=CL) :: glc_model character(len=*), parameter :: subname=trim(modName)//':(InitializeAdvertise) ' character(len=*), parameter :: format = "('("//trim(subname)//") :',A)" !------------------------------------------------------------------------------- @@ -225,104 +227,69 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! advertise fields !---------------------------------------------------------------------------- - call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldName", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldName", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - flds_scalar_name = trim(cvalue) - call ESMF_LogWrite(trim(subname)//' flds_scalar_name = '//trim(flds_scalar_name), ESMF_LOGMSG_INFO) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldName') - endif - - call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldCount", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + flds_scalar_name = trim(cvalue) + call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldCount", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - read(cvalue, *) flds_scalar_num - write(logmsg,*) flds_scalar_num - call ESMF_LogWrite(trim(subname)//' flds_scalar_num = '//trim(logmsg), ESMF_LOGMSG_INFO) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldCount') - endif - - call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNX", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + read(cvalue, *) flds_scalar_num + call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNX", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - read(cvalue,*) flds_scalar_index_nx - write(logmsg,*) flds_scalar_index_nx - call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_nx = '//trim(logmsg), ESMF_LOGMSG_INFO) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldIdxGridNX') - endif - - call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNY", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + read(cvalue,*) flds_scalar_index_nx + call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNY", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - read(cvalue,*) flds_scalar_index_ny - write(logmsg,*) flds_scalar_index_ny - call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_ny = '//trim(logmsg), ESMF_LOGMSG_INFO) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldIdxGridNY') - endif - - call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxNextSwCday", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + read(cvalue,*) flds_scalar_index_ny + call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxNextSwCday", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - read(cvalue,*) flds_scalar_index_nextsw_cday - write(logmsg,*) flds_scalar_index_nextsw_cday - call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_nextsw_cday = '//trim(logmsg), ESMF_LOGMSG_INFO) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - call shr_sys_abort(subname//'Need to set attribute ScalarFieldIdxNextSwCday') - endif - - call NUOPC_CompAttributeGet(gcomp, name='ROF_model', value=cvalue, rc=rc) + read(cvalue,*) flds_scalar_index_nextsw_cday + call NUOPC_CompAttributeGet(gcomp, name='ROF_model', value=rof_model, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (trim(cvalue) == 'srof' .or. trim(cvalue) == 'drof') then + if (trim(rof_model) == 'srof' .or. trim(rof_model) == 'drof') then rof_prognostic = .false. else rof_prognostic = .true. end if - - call NUOPC_CompAttributeGet(gcomp, name='ATM_model', value=cvalue, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name='ATM_model', value=atm_model, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (trim(cvalue) == 'satm' .or. trim(cvalue) == 'datm') then + if (trim(atm_model) == 'satm' .or. trim(atm_model) == 'datm') then atm_prognostic = .false. else atm_prognostic = .true. end if - - call NUOPC_CompAttributeGet(gcomp, name='GLC_model', value=cvalue, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name='GLC_model', value=glc_model, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (trim(cvalue) == 'sglc') then + if (trim(glc_model) == 'sglc') then glc_present = .false. else glc_present = .true. - cism_evolve = .true. - call NUOPC_CompAttributeGet(gcomp, name="cism_evolve", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + end if + if (.not. glc_present) then + cism_evolve = .false. + else + call NUOPC_CompAttributeGet(gcomp, name="cism_evolve", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (isPresent .and. isSet) then - call ESMF_LogWrite(trim(subname)//' cism_evolve = '//trim(cvalue), ESMF_LOGMSG_INFO) - if (trim(cvalue) .eq. '.true.') then - cism_evolve = .true. - else if (trim(cvalue) .eq. '.false.') then - cism_evolve = .false. - else - call shr_sys_abort(subname//'Could not determine cism_evolve value '//trim(cvalue)) - endif - else - call shr_sys_abort(subname//'Need to set cism_evolve if glc is present') + if (trim(cvalue) == '.true.') then + cism_evolve = .true. + else if (trim(cvalue) == '.false.') then + cism_evolve = .false. endif end if if (masterproc) then - write(iulog,*)' atm_prognostic = ',atm_prognostic - write(iulog,*)' rof_prognostic = ',rof_prognostic - write(iulog,*)' glc_present = ',glc_present - if (glc_present) write(iulog,*)' cism_evolve = ',cism_evolve + write(iulog,'(a )')' atm component = '//trim(atm_model) + write(iulog,'(a )')' rof component = '//trim(rof_model) + write(iulog,'(a )')' glc component = '//trim(glc_model) + write(iulog,'(a,l )')' atm_prognostic = ',atm_prognostic + write(iulog,'(a,l )')' rof_prognostic = ',rof_prognostic + write(iulog,'(a,l )')' glc_present = ',glc_present + if (glc_present) then + write(iulog,'(a,l)')' cism_evolve = ',cism_evolve + end if + write(iulog,'(a )')' flds_scalar_name = '//trim(flds_scalar_name) + write(iulog,'(a,i8)')' flds_scalar_num = ',flds_scalar_num + write(iulog,'(a,i8)')' flds_scalar_index_nx = ',flds_scalar_index_nx + write(iulog,'(a,i8)')' flds_scalar_index_ny = ',flds_scalar_index_ny + write(iulog,'(a,i8)')' flds_scalar_index_nextsw_cday = ',flds_scalar_index_nextsw_cday end if call advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, atm_prognostic, rc) @@ -373,25 +340,25 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: dtime_sync ! coupling time-step from the input synchronization clock integer :: localPet integer :: localpecount - character(ESMF_MAXSTR) :: cvalue ! config data - real(r8) :: scmlat ! single-column latitude - real(r8) :: scmlon ! single-column longitude real(r8) :: nextsw_cday ! calday from clock of next radiation computation - character(len=CL) :: caseid ! case identifier name - character(len=CL) :: ctitle ! case description title character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) character(len=CL) :: calendar ! calendar type name - character(len=CL) :: hostname ! hostname of machine running on - character(len=CL) :: model_version ! Model version - character(len=CL) :: username ! user running the model - integer :: nsrest ! ctsm restart type logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type + integer :: nsrest ! ctsm restart type integer :: lbnum ! input to memory diagnostic integer :: shrlogunit ! original log unit type(bounds_type) :: bounds ! bounds integer :: ni, nj + character(len=CL) :: cvalue ! config data character(len=CL) :: meshfile_mask character(len=CL) :: domain_file + character(len=CL) :: ctitle ! case description title + character(len=CL) :: caseid ! case identifier name + real(r8) :: scmlat ! single-column latitude + real(r8) :: scmlon ! single-column longitude + character(len=CL) :: model_version ! Model version + character(len=CL) :: hostname ! hostname of machine running on + character(len=CL) :: username ! user running the model character(len=*),parameter :: subname=trim(modName)//':(InitializeRealize) ' !------------------------------------------------------------------------------- @@ -418,49 +385,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !$ call omp_set_num_threads(localPeCount) - !---------------------- - ! Obtain attribute values - !---------------------- - - call NUOPC_CompAttributeGet(gcomp, name='case_name', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) caseid - ctitle= trim(caseid) - call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scmlon - call NUOPC_CompAttributeGet(gcomp, name='scmlat', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scmlat - call NUOPC_CompAttributeGet(gcomp, name='single_column', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) single_column - call NUOPC_CompAttributeGet(gcomp, name='brnch_retain_casename', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) brnch_retain_casename - call NUOPC_CompAttributeGet(gcomp, name='start_type', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) starttype - call NUOPC_CompAttributeGet(gcomp, name='model_version', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) model_version - call NUOPC_CompAttributeGet(gcomp, name='hostname', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) hostname - call NUOPC_CompAttributeGet(gcomp, name='username', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) username - - if ( trim(starttype) == trim(startup_run)) then - nsrest = nsrStartup - else if (trim(starttype) == trim(continue_run)) then - nsrest = nsrContinue - else if (trim(starttype) == trim(branch_run)) then - nsrest = nsrBranch - else - call shr_sys_abort( subname//' ERROR: unknown starttype' ) - end if - !---------------------- ! Consistency check on namelist filename !---------------------- @@ -507,6 +431,33 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) !---------------------- ! Initialize CTSM time manager !---------------------- + call NUOPC_CompAttributeGet(gcomp, name='case_name', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) caseid + ctitle= trim(caseid) + call NUOPC_CompAttributeGet(gcomp, name='model_version', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) model_version + call NUOPC_CompAttributeGet(gcomp, name='username', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) username + call NUOPC_CompAttributeGet(gcomp, name='hostname', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) hostname + call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scmlon + call NUOPC_CompAttributeGet(gcomp, name='scmlat', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scmlat + call NUOPC_CompAttributeGet(gcomp, name='single_column', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) single_column + call NUOPC_CompAttributeGet(gcomp, name='start_type', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) starttype + + ! Note that we assume that CTSM's internal dtime matches the coupling time step. ! i.e., we currently do NOT allow sub-cycling within a coupling time step. call set_timemgr_init( & @@ -517,14 +468,29 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ref_tod_in=ref_tod, & dtime_in=dtime_sync) - !---------------------------------------------------------------------------- ! Set model clock in lnd_comp_shr - !---------------------------------------------------------------------------- model_clock = clock ! --------------------- ! Initialize first phase of ctsm ! --------------------- + call NUOPC_CompAttributeGet(gcomp, name='brnch_retain_casename', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) brnch_retain_casename + call NUOPC_CompAttributeGet(gcomp, name='start_type', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) starttype + + if ( trim(starttype) == trim(startup_run)) then + nsrest = nsrStartup + else if (trim(starttype) == trim(continue_run)) then + nsrest = nsrContinue + else if (trim(starttype) == trim(branch_run)) then + nsrest = nsrBranch + else + call shr_sys_abort( subname//' ERROR: unknown starttype' ) + end if + ! set default values for run control variables call clm_varctl_set(& caseid_in=caseid, ctitle_in=ctitle, & diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 1ba40f22f1..2265ee4263 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -135,7 +135,7 @@ module lnd_import_export character(*), parameter :: Sl_topo_elev = 'Sl_topo_elev' character(*), parameter :: Flgl_qice_elev = 'Flgl_qice_elev' - logical :: send_to_atm = .false. + logical :: send_to_atm character(*),parameter :: F01 = "('(lnd_import_export) ',a,i5,2x,i5,2x,d21.14)" character(*),parameter :: u_FILE_u = & @@ -162,10 +162,12 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r integer , intent(out) :: rc ! local variables - type(ESMF_State) :: importState - type(ESMF_State) :: exportState - character(ESMF_MAXSTR) :: cvalue - integer :: n, num + type(ESMF_State) :: importState + type(ESMF_State) :: exportState + character(len=CS) :: cvalue + integer :: n, num + logical :: send_co2_to_atm = .false. + logical :: recv_co2_fr_atm = .false. character(len=*), parameter :: subname='(lnd_import_export:advertise_fields)' !------------------------------------------------------------------------------- @@ -174,33 +176,6 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r call NUOPC_ModelGet(gcomp, importState=importState, exportState=exportState, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - !-------------------------------- - ! determine necessary toggles for below - !-------------------------------- - - if (atm_prognostic) then - send_to_atm = .true. - else - send_to_atm = .false. - end if - ! for now always send to atm - send_to_atm = .true. - - call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) flds_co2a - call ESMF_LogWrite('flds_co2a = '// trim(cvalue), ESMF_LOGMSG_INFO) - - call NUOPC_CompAttributeGet(gcomp, name='flds_co2b', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) flds_co2b - call ESMF_LogWrite('flds_co2b = '// trim(cvalue), ESMF_LOGMSG_INFO) - - call NUOPC_CompAttributeGet(gcomp, name='flds_co2c', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) flds_co2c - call ESMF_LogWrite('flds_co2c = '// trim(cvalue), ESMF_LOGMSG_INFO) - ! Determine number of elevation classes call NUOPC_CompAttributeGet(gcomp, name='glc_nec', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -214,6 +189,36 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r ! Advertise export fields !-------------------------------- + ! Is any data going to sent back to the atm + ! For now always send to atm + if (atm_prognostic) then + send_to_atm = .true. + else + send_to_atm = .false. + end if + send_to_atm = .true. + + if (send_to_atm) then + call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) flds_co2a + call NUOPC_CompAttributeGet(gcomp, name='flds_co2b', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) flds_co2b + call NUOPC_CompAttributeGet(gcomp, name='flds_co2c', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) flds_co2c + if (flds_co2b .or. flds_co2c) send_co2_to_atm = .true. + if (flds_co2a .or. flds_co2b .or. flds_co2c) recv_co2_fr_atm = .true. + if (masterproc) then + write(iulog,'(a,l)') 'flds_co2a= ',flds_co2a + write(iulog,'(a,l)') 'flds_co2b= ',flds_co2b + write(iulog,'(a,l)') 'flds_co2c= ',flds_co2c + write(iulog,'(a,l)') 'sending co2 to atm = ',send_co2_to_atm + write(iulog,'(a,l)') 'receiving co2 from atm = ',recv_co2_fr_atm + end if + end if + ! The following namelist reads should always be called regardless of the send_to_atm value ! Dry Deposition velocities from land - ALSO initialize drydep here @@ -255,7 +260,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r ! call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_methane ) ! dust fluxes from land (4 sizes) call fldlist_add(fldsFrLnd_num, fldsFrLnd, Fall_flxdst, ungridded_lbound=1, ungridded_ubound=4) - if (flds_co2b .or. flds_co2c) then + if (send_co2_to_atm) then call fldlist_add(fldsFrLnd_num, fldsFrlnd, Fall_fco2_lnd ) ! co2 fields from land end if if (drydep_nflds > 0) then From 391502a8397721e88c2fb8d7039111be5d8bbe41 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 12 Jan 2021 01:31:38 -0700 Subject: [PATCH 1760/1973] Add taper to paramsfiles, and always use it and nstem, new paramsfiles for clm45, clm50, ctsm51 --- bld/namelist_files/namelist_defaults_ctsm.xml | 6 +++--- src/main/pftconMod.F90 | 15 ++++----------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 519c021c83..b80f529904 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -473,9 +473,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c201220.nc -lnd/clm2/paramdata/clm50_params.c200905.nc -lnd/clm2/paramdata/clm45_params.c200905.nc +lnd/clm2/paramdata/ctsm51_params.c210112.nc +lnd/clm2/paramdata/clm50_params.c210112.nc +lnd/clm2/paramdata/clm45_params.c210112.nc diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 91851e8626..e6989ded10 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -1030,6 +1030,10 @@ subroutine InitRead(this) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) end if + call ncd_io('nstem',this%nstem, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + call ncd_io('taper',this%taper, 'read', ncid, readvar=readv) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) ! ! Biomass heat storage variables ! @@ -1042,8 +1046,6 @@ subroutine InitRead(this) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('fbw',this%fbw, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - call ncd_io('nstem',this%nstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('rstem',this%rstem_per_dbh, 'read', ncid, readvar=readv) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('wood_density',this%wood_density, 'read', ncid, readvar=readv) @@ -1051,11 +1053,9 @@ subroutine InitRead(this) else this%dbh = 0.0_r8 this%fbw = 0.0_r8 - this%nstem = 1000._r8 / 10000._r8 this%rstem_per_dbh = 0.0_r8 this%wood_density = 0.0_r8 end if - this%taper = 200._r8 ! Initialize taper to the same value everywhere (below change it for shrub) call ncd_pio_closefile(ncid) @@ -1179,13 +1179,6 @@ subroutine InitRead(this) this%is_grass(m) = .false. endif - ! Set taper differently if shrub - if ( this%is_shrub(m) )then - this%taper(m) = 10._r8 - else - this%taper(m) = 200._r8 - end if - end do if (use_cndv) then From d4267fe2827e909366d4128566a151877315629a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 12 Jan 2021 09:51:43 -0700 Subject: [PATCH 1761/1973] Deallocate new array, so that Clean method will work, which is required for the FUNITCTSM_P1x1.f10_f10_musgs.I2000Clm50Sp.cheyenne_intel to pass --- src/main/pftconMod.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index e6989ded10..10a0d06db6 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -1476,6 +1476,7 @@ subroutine Clean(this) deallocate( this%nstem) deallocate( this%rstem_per_dbh) deallocate( this%wood_density) + deallocate( this%taper) end subroutine Clean end module pftconMod From af30ca3c4f809c717e23fba304e41886e41f3071 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 12 Jan 2021 16:53:41 -0700 Subject: [PATCH 1762/1973] Remove ntree because it's not used anymore --- src/main/pftconMod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 10a0d06db6..88e5965051 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -26,7 +26,6 @@ module pftconMod integer, public :: nbrdlf_dcd_trp_tree ! value for Broadleaf deciduous tropical tree integer, public :: nbrdlf_dcd_tmp_tree ! value for Broadleaf deciduous temperate tree integer, public :: nbrdlf_dcd_brl_tree ! value for Broadleaf deciduous boreal tree - integer, public :: ntree ! value for last type of tree integer, public :: nbrdlf_evr_shrub ! value for Broadleaf evergreen shrub integer, public :: nbrdlf_dcd_tmp_shrub ! value for Broadleaf deciduous temperate shrub integer, public :: nbrdlf_dcd_brl_shrub ! value for Broadleaf deciduous boreal shrub @@ -1151,7 +1150,6 @@ subroutine InitRead(this) if ( trim(pftname(i)) == 'irrigated_tropical_soybean' ) nirrig_trp_soybean = i end do - ntree = nbrdlf_dcd_brl_tree ! value for last type of tree npcropmin = ntmp_corn ! first prognostic crop npcropmax = mxpft ! last prognostic crop in list From f6c6d4e4164788579423ed3bc5b3ebeb5be2223d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 12 Jan 2021 17:10:42 -0700 Subject: [PATCH 1763/1973] Update change files --- doc/ChangeLog | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 130 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4eac6c847f..b3f5f739a2 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,133 @@ =============================================================== +Tag name: ctsm5.1.dev021 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Tue Jan 12 17:10:32 MST 2021 +One-line Summary: Add option for biomass heat storage (BHS) to clm5_1 physics + +Purpose of changes +------------------ + +Add heat stored in biomass (for trees and shrubs) to the surface energy balance calculation. Add +a switch for it and turn it on by default for clm5_1 physics. It's turned off for clm4_5, clm5_0 +physics and when FATES is turned on. Those cases are identical to before, answers only change +when it's turned on. + +Papers describing BHS simulations: +R. Meier, Davin, E., Swenson, S., Lawrence, D., and Schwaab, Jo. (2019). Biomass heat +storage dampens diurnal temperature variations +in forests. Environmental Research Letters. 14. 084026. 10.1088/1748-9326/ab2b4e. + +S.C. Swenson, Burns, S. P., and Lawrence, D. M. ( 2019). The impact of biomass heat storage +on the canopy energy balance and atmospheric stability in the community land model, Journal +of Advances in Modeling Earth Systems, 11, 83– 98. +https://doi.org/10.1029/2018MS001476 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + #342 --- set medlynslope to C4 appropriate value for millet and sorghum + (had already been done for miscanthus and switchgrass) + #1246 -- Make spinup_factor_deadwood a variable rather than hardcoded constant + +Known bugs introduced in this tag (include github issue ID): + #1247 -- FATES doesn't work with BHS + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + New variables are added on the restart files (stem/leaf biomass and stem Temp) + Testing didn't show this as a problem, but theoretically could require + updating initial conditions + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): New compsets, new hist fields + I1850Clm51BgcCrop + I1850Clm51Bgc + History fields: AGSB, AGLB, FSH_STEM, DHDT_CANOPY, RAH1, RAH2, RAW1, RAW2, USTAR, UM, UAF, UM, UAF, + TAF, QAF, OBU, ZETA, VPD, num_iter, RB, TSTEM + DHSDT_CANOPY, TSTEM are default active + +Changes made to namelist defaults (e.g., changed parameter values): New use_biomass_heat_storage + New namelist item: use_biomass_heat_storage to turn on or off (by default only on for clm5_1 + physics for both SP and BGC modes) + +Changes to the datasets (e.g., parameter, surface or initial files): New parameter datasets + All of the params files were updated. New terms were BHS parameters and taper + stocking is now set as "nstem" on the parameter file + taper is now on the parameter file + +Substantial timing or memory changes: Doesn't seem to + Only one short test failed the TPUTCOMP test + Longer tests were not significantly different + +Notes of particular relevance for developers: (including Code reviews and testing) +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Setting of leaf/stem biomass should be refactored and removed from CanopyFluxes (as described in #1247) + There's a change in CNGapMortality that could change for DV when AD mode is on + Stability cap (zera) is different for BHS on than off + +Changes to tests or testing: New CLM51 FATES test + +CTSM testing: regular + + [PASS means all tests PASS and OK means tests PASS other than expected fails.] + + build-namelist tests: + + cheyenne - OK (462 comparisons fail because of new namelist and params files) + + python testing (see instructions in python/README.md; document testing done): + + cheyenne -- PASS + + regular tests (aux_clm): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes! + + Summarize any changes to answers, i.e., + - what code configurations: clm5_1 + - what platforms/compilers: all + - nature of change: new climate for tree and shrubs + +Detailed list of changes +------------------------ + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + #1016 -- Heat Storage biomass + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev020 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Wed Dec 30 00:42:16 MST 2020 diff --git a/doc/ChangeSum b/doc/ChangeSum index 6dc5b4fc0d..0ca1854990 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev021 erik 01/12/2021 Add option for biomass heat storage (BHS) to clm5_1 physics ctsm5.1.dev020 erik 12/30/2020 Potential roundoff changes in preparation for bio-mass heat storage option ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler ctsm5.1.dev018 slevis 12/08/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize From a1c0b5f3308350d3fbe9e400ed2c0ce590c5ba4b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 12 Jan 2021 20:22:04 -0700 Subject: [PATCH 1764/1973] Update time --- doc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index b3f5f739a2..2ca737aa91 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev021 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Tue Jan 12 17:10:32 MST 2021 +Date: Tue Jan 12 20:21:52 MST 2021 One-line Summary: Add option for biomass heat storage (BHS) to clm5_1 physics Purpose of changes From 3dd33b15e66b50e9b1f31a99c8763206fed2702b Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 14 Jan 2021 09:41:08 -0800 Subject: [PATCH 1765/1973] simple CNFireArea fix attempt --- src/biogeochem/FATESFireBase.F90 | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/biogeochem/FATESFireBase.F90 b/src/biogeochem/FATESFireBase.F90 index fc3f2bd4c5..b439adbbc0 100644 --- a/src/biogeochem/FATESFireBase.F90 +++ b/src/biogeochem/FATESFireBase.F90 @@ -24,6 +24,8 @@ module FATESFireBase procedure(InitAccBuffer_interface), public, deferred :: InitAccBuffer ! Initialize accumulation processes procedure(InitAccVars_interface), public, deferred :: InitAccVars ! Initialize accumulation variables procedure(UpdateAccVars_interface), public, deferred :: UpdateAccVars ! Update/extract accumulations vars + + procedure, public :: CNFireArea end type fates_fire_base_type @@ -103,6 +105,39 @@ subroutine UpdateAccVars_interface (this, bounds) end subroutine UpdateAccVars_interface end interface + + subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & + waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + ! + ! !DESCRIPTION: + ! Computes column-level burned area + ! + ! !USES: + ! + ! !ARGUMENTS: + class(cnfire_base_type) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(atm2lnd_type) , intent(in) :: atm2lnd_inst + type(energyflux_type) , intent(in) :: energyflux_inst + type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + real(r8) , intent(in) :: totlitc_col(bounds%begc:) + real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) + real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) + ! + + call endrun( 'cnfire_base::CNFireArea: this method MUST be implemented!' ) + +end subroutine CNFireArea !--------------------------------------------------------------------- end module FATESFireBase From fa0a369c038a8ba2fca8b218bcb174c008525756 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 14 Jan 2021 10:25:30 -0800 Subject: [PATCH 1766/1973] adding missing use calls --- src/biogeochem/FATESFireBase.F90 | 61 +++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/src/biogeochem/FATESFireBase.F90 b/src/biogeochem/FATESFireBase.F90 index b439adbbc0..d8b1df98df 100644 --- a/src/biogeochem/FATESFireBase.F90 +++ b/src/biogeochem/FATESFireBase.F90 @@ -5,8 +5,20 @@ module FATESFireBase ! Abstract base class for FATES fire data object ! ! !USES: - use CNFireBaseMod , only: cnfire_base_type - ! + use CNFireBaseMod , only : cnfire_base_type + use decompMod , only : bounds_type + use atm2lndType , only : atm2lnd_type + use EnergyFluxType , only : energyflux_type + use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type + use CNVegStateType , only : cnveg_state_type + use CNVegCarbonStateType , only : cnveg_carbonstate_type + implicit none private ! @@ -107,8 +119,9 @@ end subroutine UpdateAccVars_interface end interface subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & - waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & + atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & + wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: @@ -117,23 +130,29 @@ subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_ ! !USES: ! ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - real(r8) , intent(in) :: totlitc_col(bounds%begc:) - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) - real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) - ! + class(fates_fire_base_type) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 + type(atm2lnd_type) , intent(in) :: atm2lnd_inst + type(energyflux_type) , intent(in) :: energyflux_inst + type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + real(r8) , intent(in) :: totlitc_col(bounds%begc:) + real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) + real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) call endrun( 'cnfire_base::CNFireArea: this method MUST be implemented!' ) From 340f5f282aa0e269a0d67c4d54485c60b2d4b360 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 14 Jan 2021 10:36:45 -0800 Subject: [PATCH 1767/1973] adding missing abortutils and contain statement --- src/biogeochem/FATESFireBase.F90 | 86 +++++++++++++++++--------------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/src/biogeochem/FATESFireBase.F90 b/src/biogeochem/FATESFireBase.F90 index d8b1df98df..c213f81e98 100644 --- a/src/biogeochem/FATESFireBase.F90 +++ b/src/biogeochem/FATESFireBase.F90 @@ -18,6 +18,7 @@ module FATESFireBase use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use CNVegStateType , only : cnveg_state_type use CNVegCarbonStateType , only : cnveg_carbonstate_type + use abortutils , only : endrun implicit none private @@ -41,6 +42,8 @@ module FATESFireBase end type fates_fire_base_type + !----------------------- + abstract interface !----------------------------------------------------------------------- @@ -118,45 +121,48 @@ end subroutine UpdateAccVars_interface end interface - subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & - atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & - wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & - cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) - ! - ! !DESCRIPTION: - ! Computes column-level burned area - ! - ! !USES: - ! - ! !ARGUMENTS: - class(fates_fire_base_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp - integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst - type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst - type(soilstate_type) , intent(in) :: soilstate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - real(r8) , intent(in) :: totlitc_col(bounds%begc:) - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) - real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) - - call endrun( 'cnfire_base::CNFireArea: this method MUST be implemented!' ) - -end subroutine CNFireArea - !--------------------------------------------------------------------- + contains + + subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & + atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & + wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & + cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + ! + ! !DESCRIPTION: + ! Computes column-level burned area + ! + ! !USES: + ! + ! !ARGUMENTS: + class(fates_fire_base_type) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 + type(atm2lnd_type) , intent(in) :: atm2lnd_inst + type(energyflux_type) , intent(in) :: energyflux_inst + type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + real(r8) , intent(in) :: totlitc_col(bounds%begc:) + real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) + real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) + + call endrun( 'cnfire_base::CNFireArea: this method MUST be implemented!' ) + + end subroutine CNFireArea + +---------------------------------------------- end module FATESFireBase From bc2bc2ff136738dce93fa3e237db6f280b215479 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 14 Jan 2021 10:57:35 -0800 Subject: [PATCH 1768/1973] adding more missing use cases --- src/biogeochem/FATESFireBase.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/biogeochem/FATESFireBase.F90 b/src/biogeochem/FATESFireBase.F90 index c213f81e98..39044377fb 100644 --- a/src/biogeochem/FATESFireBase.F90 +++ b/src/biogeochem/FATESFireBase.F90 @@ -6,6 +6,8 @@ module FATESFireBase ! ! !USES: use CNFireBaseMod , only : cnfire_base_type + use shr_kind_mod , only : r8 => shr_kind_r8 + use abortutils , only : endrun use decompMod , only : bounds_type use atm2lndType , only : atm2lnd_type use EnergyFluxType , only : energyflux_type @@ -18,7 +20,6 @@ module FATESFireBase use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use CNVegStateType , only : cnveg_state_type use CNVegCarbonStateType , only : cnveg_carbonstate_type - use abortutils , only : endrun implicit none private From 219083113137926af0d1be522375c878a31a42b0 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 15 Jan 2021 07:45:09 -0700 Subject: [PATCH 1769/1973] replace constant lma --- src/biogeophys/CanopyFluxesMod.F90 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 348af3a613..32015ac134 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -228,7 +228,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, use clm_varcon , only : sb, cpair, hvap, vkc, grav, denice, c_to_b use clm_varcon , only : denh2o, tfrz, tlsai_crit, alpha_aero use clm_varcon , only : c14ratio - use clm_varcon , only : c_water, c_dry_biomass + use clm_varcon , only : c_water, c_dry_biomass, c_to_b use perf_mod , only : t_startf, t_stopf use QSatMod , only : QSat use CLMFatesInterfaceMod, only : hlm_fates_interface_type @@ -447,6 +447,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, is_shrub => pftcon%is_shrub , & ! Input: shrub patch or not dleaf => pftcon%dleaf , & ! Input: characteristic leaf dimension (m) dbh_param => pftcon%dbh , & ! Input: diameter at brest height (m) + slatop => pftcon%slatop , & ! SLA at top of canopy [m^2/gC] fbw => pftcon%fbw , & ! Input: fraction of biomass that is water nstem => pftcon%nstem , & ! Input: stem number density (#ind/m2) rstem_per_dbh => pftcon%rstem_per_dbh , & ! Input: stem resistance per stem diameter (s/m**2) @@ -728,14 +729,14 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, sa_stem(p) = 0.0 endif - ! cross-sectional area of stems - carea_stem = shr_const_pi * (dbh(p)*0.5)**2 - ! if using Satellite Phenology mode, calculate leaf and stem biomass if(.not. use_cn) then - ! boreal needleleaf lma*c2b ~ 0.25 kg dry mass/m2(leaf) - leaf_biomass(p) = 0.25_r8 * max(0.01_r8, sa_leaf(p)) & + ! 2gbiomass/gC * (1/SLA) * 1e-3 = kg dry mass/m2(leaf) + leaf_biomass(p) = (1.e-3_r8*c_to_b/slatop(patch%itype(p))) & + * max(0.01_r8, 0.5_r8*sa_leaf(p)) & / (1.-fbw(patch%itype(p))) + ! cross-sectional area of stems + carea_stem = shr_const_pi * (dbh(p)*0.5)**2 stem_biomass(p) = carea_stem * htop(p) * k_cyl_vol & * nstem(patch%itype(p)) * wood_density(patch%itype(p)) & /(1.-fbw(patch%itype(p))) @@ -1346,13 +1347,13 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! Test for convergence itlef = itlef+1 - num_iter(p) = itlef if (itlef > itmin) then do f = 1, fn p = filterp(f) dele(p) = abs(efe(p)-efeb(p)) efeb(p) = efe(p) det(p) = max(del(p),del2(p)) + num_iter(p) = itlef end do fnold = fn fn = 0 From e09dc512e2d3335cbf1c15cedadd2f89f64ca6fa Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Jan 2021 12:23:54 -0700 Subject: [PATCH 1770/1973] Implement CNFire subroutines to the FATES Fire base class, they are required in the base class even though they aren't used in FATES versions, so they are empty and call endrun, if they were invoked wrongly --- src/biogeochem/FATESFireBase.F90 | 153 +++++++++++++++++++++---------- 1 file changed, 107 insertions(+), 46 deletions(-) diff --git a/src/biogeochem/FATESFireBase.F90 b/src/biogeochem/FATESFireBase.F90 index 39044377fb..457e577a7b 100644 --- a/src/biogeochem/FATESFireBase.F90 +++ b/src/biogeochem/FATESFireBase.F90 @@ -9,15 +9,6 @@ module FATESFireBase use shr_kind_mod , only : r8 => shr_kind_r8 use abortutils , only : endrun use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use EnergyFluxType , only : energyflux_type - use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type - use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type - use Wateratm2lndBulkType , only : wateratm2lndbulk_type - use WaterStateBulkType , only : waterstatebulk_type - use WaterStateBulkType , only : waterstatebulk_type - use SoilStateType , only : soilstate_type - use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type use CNVegStateType , only : cnveg_state_type use CNVegCarbonStateType , only : cnveg_carbonstate_type @@ -38,9 +29,12 @@ module FATESFireBase procedure(InitAccBuffer_interface), public, deferred :: InitAccBuffer ! Initialize accumulation processes procedure(InitAccVars_interface), public, deferred :: InitAccVars ! Initialize accumulation variables procedure(UpdateAccVars_interface), public, deferred :: UpdateAccVars ! Update/extract accumulations vars + ! Interfaces that need to be implemented because they are in the base class + ! They are NOT used when FATES is on + procedure, public :: CNFireReadParams ! Read in parameters (NOT USED FOR FATES) + procedure, public :: CNFireArea ! Calculate fire area (NOT USED FOR FATES) + procedure, public :: CNFireFluxes ! Calculate fire fluxes (NOT USED FOR FATES) - procedure, public :: CNFireArea - end type fates_fire_base_type !----------------------- @@ -124,46 +118,113 @@ end subroutine UpdateAccVars_interface contains - subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & - atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, waterdiagnosticbulk_inst, & - wateratm2lndbulk_inst, waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & - cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) + !----------------------------------------------------------------------- + ! Implement empty subroutines that are required in the FireMethodType base + ! class, but are NOT used in the FATES version + !----------------------------------------------------------------------- + subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + dgvs_inst, cnveg_state_inst, & + cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & + leaf_prof_patch, froot_prof_patch, croot_prof_patch, stem_prof_patch, & + totsomc_col, decomp_cpools_vr_col, decomp_npools_vr_col, somc_fire_col) + ! + ! !DESCRIPTION: + ! Fire effects routine for coupled carbon-nitrogen code (CN). (NOT USED FOR FATES) + ! + ! !USES: + use CNDVType , only : dgvs_type + use CNVegCarbonFluxType , only : cnveg_carbonflux_type + use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type + use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type + ! + ! !ARGUMENTS: + class(fates_fire_base_type) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + type(dgvs_type) , intent(inout) :: dgvs_inst + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst + type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst + type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst + real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) + real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) + real(r8) , intent(in) :: croot_prof_patch(bounds%begp:,1:) + real(r8) , intent(in) :: stem_prof_patch(bounds%begp:,1:) + real(r8) , intent(in) :: totsomc_col(bounds%begc:) + real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) + real(r8) , intent(in) :: decomp_npools_vr_col(bounds%begc:,1:,1:) + real(r8) , intent(out) :: somc_fire_col(bounds%begc:) + ! + call endrun( "This subroutine should NEVER be called when FATES is active" ) + end subroutine CNFireFluxes + + !----------------------------------------------------------------------- + subroutine CNFireReadParams( this, ncid ) + ! + ! Read in the constant parameters from the input NetCDF parameter file (NOT USED FOR FATES) + ! !USES: + use ncdio_pio , only : file_desc_t + ! + ! !ARGUMENTS: + implicit none + class(fates_fire_base_type) :: this + type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id + ! + call endrun( "This subroutine should NEVER be called when FATES is active" ) + end subroutine CNFireReadParams + + !----------------------------------------------------------------------- + subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & + num_exposedvegp, filter_exposedvegp, num_noexposedvegp, filter_noexposedvegp, & + atm2lnd_inst, energyflux_inst, saturated_excess_runoff_inst, & + waterdiagnosticbulk_inst, wateratm2lndbulk_inst, & + waterstatebulk_inst, soilstate_inst, soil_water_retention_curve, & + cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) ! ! !DESCRIPTION: - ! Computes column-level burned area + ! Computes column-level burned area (NOT USED FOR FATES) ! ! !USES: + use EnergyFluxType , only : energyflux_type + use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type + use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type + use Wateratm2lndBulkType , only : wateratm2lndbulk_type + use WaterStateBulkType , only : waterstatebulk_type + use SoilStateType , only : soilstate_type + use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type + use atm2lndType , only : atm2lnd_type ! ! !ARGUMENTS: - class(fates_fire_base_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp - integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst - type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst - type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst - type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst - type(soilstate_type) , intent(in) :: soilstate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - real(r8) , intent(in) :: totlitc_col(bounds%begc:) - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) - real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) - - call endrun( 'cnfire_base::CNFireArea: this method MUST be implemented!' ) - - end subroutine CNFireArea - ----------------------------------------------- + class(fates_fire_base_type) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_soilc ! number of soil columns in filter + integer , intent(in) :: filter_soilc(:) ! filter for soil columns + integer , intent(in) :: num_soilp ! number of soil patches in filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp + integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 + type(atm2lnd_type) , intent(in) :: atm2lnd_inst + type(energyflux_type) , intent(in) :: energyflux_inst + type(saturated_excess_runoff_type) , intent(in) :: saturated_excess_runoff_inst + type(waterdiagnosticbulk_type) , intent(in) :: waterdiagnosticbulk_inst + type(wateratm2lndbulk_type) , intent(in) :: wateratm2lndbulk_inst + type(waterstatebulk_type) , intent(in) :: waterstatebulk_inst + type(soilstate_type) , intent(in) :: soilstate_inst + class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve + type(cnveg_state_type) , intent(inout) :: cnveg_state_inst + type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst + real(r8) , intent(in) :: totlitc_col(bounds%begc:) + real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) + real(r8) , intent(in) :: t_soi17cm_col(bounds%begc:) + ! + call endrun( "This subroutine should NEVER be called when FATES is active" ) + end subroutine CNFireArea + !---------------------------------------------- end module FATESFireBase From f74a74d1997856286aa08b0c30a7258c89029c22 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Jan 2021 21:46:29 -0700 Subject: [PATCH 1771/1973] Set updated paramsfile with updated nstem/dbh from Sean --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index b80f529904..c09e2e3db7 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -473,7 +473,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c210112.nc +lnd/clm2/paramdata/ctsm51_params.c210115.nc lnd/clm2/paramdata/clm50_params.c210112.nc lnd/clm2/paramdata/clm45_params.c210112.nc From e565c37ccfc11a45f46d7b0ccd2f0aee6ffc9e8c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 17 Jan 2021 15:33:28 -0700 Subject: [PATCH 1772/1973] updates to Externals.cfg needed for PR --- Externals.cfg | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index aecac45976..a0cf8ffb44 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -8,22 +8,24 @@ required = True local_path = components/cism protocol = git repo_url = https://github.com/ESCOMP/CISM-wrapper -tag = cism2_1_69 +tag = df1bbfa externals = Externals_CISM.cfg required = True +# rtm branch nuopc_cap - needs to have a PR to master [rtm] local_path = components/rtm protocol = git repo_url = https://github.com/ESCOMP/RTM -tag = rtm1_0_73 +tag = c2927b6 required = True +# mosart branch jedwards/nuopc_update - needs to have a PR to master [mosart] local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/MOSART -tag = mosart1_0_38 +tag = 0089e744a required = True [mizuRoute] @@ -33,25 +35,28 @@ repo_url = https://github.com/nmizukami/mizuRoute hash = 34723c2 required = True +# this is cime master and needs a branch that will enable lilac to build [cime] local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.32_a02 +hash = 91c9f65b3 required = True +# cmeps branch mvertens/dynfrac (has changes from mvertens/ocn2glc_coupling) [cmeps] local_path = cime/src/drivers/nuopc/ protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git -hash = 7654038 +hash = b829de9 required = True -[cdeps] +# cdeps branch mvertens/dynfrac +[cdeps] local_path = components/cdeps protocol = git repo_url = https://github.com/ESCOMP/CDEPS.git -hash = 45b7a85 +hash = 2e77890 required = True [doc-builder] From 8dceacdd343aabdc9a4b2381ba18e7941ef16183 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 19 Jan 2021 13:54:18 -0700 Subject: [PATCH 1773/1973] replace limit of evaporation from surface layer --- src/biogeophys/BareGroundFluxesMod.F90 | 26 +++++- src/biogeophys/CanopyFluxesMod.F90 | 17 ++++ src/biogeophys/SoilFluxesMod.F90 | 118 +++++++++++-------------- 3 files changed, 95 insertions(+), 66 deletions(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index 89893e3aa4..cbcc3694cb 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -89,6 +89,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & Wet_Bulb, Wet_BulbS, HeatIndex, AppTemp, & swbgt, hmdex, dis_coi, dis_coiS, THIndex, & SwampCoolEff, KtoC, VaporPres + use clm_time_manager , only : get_step_size_real + ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -143,6 +145,10 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] real(r8) :: www ! surface soil wetness [-] + + real(r8) :: snow_evaporation_limit + real(r8) :: ev_snow_unconstrained + real(r8) :: dtime ! land model time step (sec) !------------------------------------------------------------------------------ associate( & @@ -202,7 +208,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature beta => temperature_inst%beta_col , & ! Input: [real(r8) (:) ] coefficient of conective velocity [-] - frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) + frac_sno_eff => waterdiagnosticbulk_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) qg_snow => waterdiagnosticbulk_inst%qg_snow_col , & ! Input: [real(r8) (:) ] specific humidity at snow surface [kg/kg] qg_soil => waterdiagnosticbulk_inst%qg_soil_col , & ! Input: [real(r8) (:) ] specific humidity at soil surface [kg/kg] qg_h2osfc => waterdiagnosticbulk_inst%qg_h2osfc_col , & ! Input: [real(r8) (:) ] specific humidity at h2osfc surface [kg/kg] @@ -259,6 +265,10 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & endp => bounds%endp & ) + ! Get step size + + dtime = get_step_size_real() + ! First do some simple settings of values over points where frac vegetation covered ! by snow is zero @@ -417,6 +427,20 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & qflx_ev_soil(p) = -raiw*(forc_q(c) - qg_soil(c)) qflx_ev_h2osfc(p) = -raiw*(forc_q(c) - qg_h2osfc(c)) + ! adjust snow surface layer evaporation + j = col%snl(c)+1 + if ((h2osoi_ice(c,j)+h2osoi_liq(c,j)) > 0._r8 .and. j < 1) then + ! assumes for j < 1 that frac_sno_eff > 0 + snow_evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))*patch%wtcol(p)/frac_sno_eff(c) + if (qflx_ev_snow(p)*dtime > snow_evaporation_limit) then + ev_snow_unconstrained = qflx_ev_snow(p) + qflx_ev_snow(p) = snow_evaporation_limit/dtime + + qflx_evap_soi(p) = qflx_evap_soi(p) - frac_sno_eff(c)*(ev_snow_unconstrained - qflx_ev_snow(p)) + qflx_evap_tot(p) = qflx_evap_soi(p) + endif + endif + ! 2 m height air temperature t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 348af3a613..bfc1499455 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -431,6 +431,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8), parameter :: min_stem_diameter = 0.05_r8 !minimum stem diameter for which to calculate stem interactions integer :: dummy_to_make_pgi_happy + + real(r8) :: snow_evaporation_limit + real(r8) :: ev_snow_unconstrained + !------------------------------------------------------------------------------ SHR_ASSERT_ALL_FL((ubound(downreg_patch) == (/bounds%endp/)), sourcefile, __LINE__) @@ -1435,6 +1439,19 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, delq_h2osfc = wtalq(p)*qg_h2osfc(c)-wtlq0(p)*qsatl(p)-wtaq0(p)*forc_q(c) qflx_ev_h2osfc(p) = forc_rho(c)*wtgq(p)*delq_h2osfc + ! adjust snow surface layer evaporation + j = col%snl(c)+1 + if ((h2osoi_ice(c,j)+h2osoi_liq(c,j)) > 0._r8 .and. j < 1) then + ! assumes for j < 1 that frac_sno_eff > 0 + snow_evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))*patch%wtcol(p)/frac_sno(c) + if (qflx_ev_snow(p)*dtime > snow_evaporation_limit) then + ev_snow_unconstrained = qflx_ev_snow(p) + qflx_ev_snow(p) = snow_evaporation_limit/dtime + + qflx_evap_soi(p) = qflx_evap_soi(p) - frac_sno(c)*(ev_snow_unconstrained - qflx_ev_snow(p)) + endif + endif + ! 2 m height air temperature t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index 10082db373..f70800ecf6 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -74,17 +74,12 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & integer :: p,c,g,j,pi,l ! indices integer :: fc,fp ! lake filtered column and pft indices real(r8) :: dtime ! land model time step (sec) - real(r8) :: egsmax(bounds%begc:bounds%endc) ! max. evaporation which soil can provide at one time step - real(r8) :: egirat(bounds%begc:bounds%endc) ! ratio of topsoil_evap_tot : egsmax real(r8) :: tinc(bounds%begc:bounds%endc) ! temperature difference of two time step - real(r8) :: sumwt(bounds%begc:bounds%endc) ! temporary - real(r8) :: evaprat(bounds%begp:bounds%endp) ! ratio of qflx_evap_soi/topsoil_evap_tot - real(r8) :: save_qflx_evap_soi ! temporary storage for qflx_evap_soi - real(r8) :: topsoil_evap_tot(bounds%begc:bounds%endc) ! column-level total evaporation from top soil layer real(r8) :: eflx_lwrad_del(bounds%begp:bounds%endp) ! update due to eflx_lwrad real(r8) :: t_grnd0(bounds%begc:bounds%endc) ! t_grnd of previous time step real(r8) :: lw_grnd - real(r8) :: fsno_eff + real(r8) :: evaporation_limit + real(r8) :: ev_unconstrained !----------------------------------------------------------------------- associate( & @@ -186,23 +181,8 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & tinc(c) = t_grnd(c) - t_grnd0(c) - ! Determine ratio of topsoil_evap_tot - - egsmax(c) = (h2osoi_ice(c,j)+h2osoi_liq(c,j)) / dtime - - ! added to trap very small negative soil water,ice - - if (egsmax(c) < 0._r8) then - egsmax(c) = 0._r8 - end if end do - ! A preliminary pft loop to determine if corrections are required for - ! excess evaporation from the top soil layer... Includes new logic - ! to distribute the corrections between patches on the basis of their - ! evaporative demands. - ! egirat holds the ratio of demand to availability if demand is - ! greater than availability, or 1.0 otherwise. ! Correct fluxes to present soil temperature do fp = 1,num_nolakep @@ -224,40 +204,43 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & endif end do - ! Set the column-average qflx_evap_soi as the weighted average over all patches - ! but only count the patches that are evaporating - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - topsoil_evap_tot(c) = 0._r8 - sumwt(c) = 0._r8 - end do - - do pi = 1,max_patch_per_col - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if ( pi <= col%npatches(c) ) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - topsoil_evap_tot(c) = topsoil_evap_tot(c) + qflx_evap_soi(p) * patch%wtcol(p) - end if - end if - end do - end do + ! evaporation from snow may be larger than available moisture + ! after flux update from tinc*cgrnd, repeat adjustment of ev_snow + do fp = 1,num_nolakep + p = filter_nolakep(fp) + c = patch%column(p) + j = col%snl(c)+1 + ! snow layers + if (j < 1) then + ! assumes for j < 1 that frac_sno_eff > 0 + evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))*patch%wtcol(p)/frac_sno_eff(c) + if (qflx_ev_snow(p)*dtime > evaporation_limit) then + ev_unconstrained = qflx_ev_snow(p) + qflx_ev_snow(p) = evaporation_limit/dtime + + qflx_evap_soi(p) = qflx_evap_soi(p) - frac_sno_eff(c)*(ev_unconstrained - qflx_ev_snow(p)) + ! conserve total energy flux + eflx_sh_grnd(p) = eflx_sh_grnd(p) + frac_sno_eff(c)*(ev_unconstrained - qflx_ev_snow(p))*htvp(c) + endif + endif + + ! top soil layer for urban columns; adjust qflx_evap_soi directly + if (lun%urbpoi(patch%landunit(p))) then + j = 1 + evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))*patch%wtcol(p) + if (qflx_evap_soi(p)*dtime > evaporation_limit) then + ev_unconstrained = qflx_evap_soi(p) + qflx_evap_soi(p) = evaporation_limit/dtime + ! conserve total energy flux + eflx_sh_grnd(p) = eflx_sh_grnd(p) +(ev_unconstrained - qflx_evap_soi(p))*htvp(c) + endif + endif + + enddo + call t_stopf('bgp2_loop_1') call t_startf('bgp2_loop_2') - ! Calculate ratio for rescaling patch-level fluxes to meet availability - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (topsoil_evap_tot(c) > egsmax(c)) then - egirat(c) = (egsmax(c)/topsoil_evap_tot(c)) - else - egirat(c) = 1.0_r8 - end if - end do - do fp = 1,num_nolakep p = filter_nolakep(fp) c = patch%column(p) @@ -265,18 +248,6 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & g = patch%gridcell(p) j = col%snl(c)+1 - ! Correct soil fluxes for possible evaporation in excess of top layer water - ! excess energy is added to the sensible heat flux from soil - - if (egirat(c) < 1.0_r8) then - save_qflx_evap_soi = qflx_evap_soi(p) - qflx_evap_soi(p) = qflx_evap_soi(p) * egirat(c) - eflx_sh_grnd(p) = eflx_sh_grnd(p) + (save_qflx_evap_soi - qflx_evap_soi(p))*htvp(c) - qflx_ev_snow(p) = qflx_ev_snow(p) * egirat(c) - qflx_ev_soil(p) = qflx_ev_soil(p) * egirat(c) - qflx_ev_h2osfc(p) = qflx_ev_h2osfc(p) * egirat(c) - end if - ! Update ev_snow for urban landunits here if (lun%urbpoi(l)) then qflx_ev_snow(p) = qflx_evap_soi(p) @@ -318,6 +289,14 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_grnd(p) if (.not. lun%urbpoi(l)) eflx_sh_tot(p) = eflx_sh_tot(p) + eflx_sh_stem(p) qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) + + if (c==82328) then + write(*,*) ' ' + write(*,*) 'evaptot1: ',c,j,qflx_evap_tot(p),qflx_evap_tot(p)*dtime + write(*,*) 'evaptot2: ',c,j,qflx_evap_soi(p),qflx_evap_veg(p) + write(*,*) ' ' + endif + eflx_lh_tot(p)= hvap*qflx_evap_veg(p) + htvp(c)*qflx_evap_soi(p) if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then eflx_lh_tot_r(p)= eflx_lh_tot(p) @@ -352,6 +331,15 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & if ((h2osoi_liq(c,j)+h2osoi_ice(c,j)) > 0._r8) then qflx_liqevap_from_top_layer(p) = max(qflx_ev_snow(p)*(h2osoi_liq(c,j)/ & (h2osoi_liq(c,j)+h2osoi_ice(c,j))), 0._r8) + !scs + if(c==-8212) then + write(iulog,*) 'evtupdate: ',c,tinc(c)*cgrndl(p) + write(iulog,*) 'evsnow2: ',c,j,qflx_ev_snow(p),qflx_liqevap_from_top_layer(p),qflx_liqevap_from_top_layer(p)*dtime + write(*,*) 'h2oamt2: ',c,j,h2osoi_liq(c,j),h2osoi_ice(c,j),(h2osoi_ice(c,j)+h2osoi_liq(c,j)) + write(*,*) 'h2ofrac2: ',c,j,(h2osoi_liq(c,j))/(h2osoi_ice(c,j)+h2osoi_liq(c,j)) + write(*,*) ' ' + endif + else qflx_liqevap_from_top_layer(p) = 0._r8 end if From 3a4ce3d171b3b5f74b30dc4c51d18eafff41a1de Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 19 Jan 2021 13:57:28 -0700 Subject: [PATCH 1774/1973] remove write statements --- src/biogeophys/SoilFluxesMod.F90 | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index f70800ecf6..eecdcb24a8 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -290,13 +290,6 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & if (.not. lun%urbpoi(l)) eflx_sh_tot(p) = eflx_sh_tot(p) + eflx_sh_stem(p) qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) - if (c==82328) then - write(*,*) ' ' - write(*,*) 'evaptot1: ',c,j,qflx_evap_tot(p),qflx_evap_tot(p)*dtime - write(*,*) 'evaptot2: ',c,j,qflx_evap_soi(p),qflx_evap_veg(p) - write(*,*) ' ' - endif - eflx_lh_tot(p)= hvap*qflx_evap_veg(p) + htvp(c)*qflx_evap_soi(p) if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then eflx_lh_tot_r(p)= eflx_lh_tot(p) @@ -331,15 +324,6 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & if ((h2osoi_liq(c,j)+h2osoi_ice(c,j)) > 0._r8) then qflx_liqevap_from_top_layer(p) = max(qflx_ev_snow(p)*(h2osoi_liq(c,j)/ & (h2osoi_liq(c,j)+h2osoi_ice(c,j))), 0._r8) - !scs - if(c==-8212) then - write(iulog,*) 'evtupdate: ',c,tinc(c)*cgrndl(p) - write(iulog,*) 'evsnow2: ',c,j,qflx_ev_snow(p),qflx_liqevap_from_top_layer(p),qflx_liqevap_from_top_layer(p)*dtime - write(*,*) 'h2oamt2: ',c,j,h2osoi_liq(c,j),h2osoi_ice(c,j),(h2osoi_ice(c,j)+h2osoi_liq(c,j)) - write(*,*) 'h2ofrac2: ',c,j,(h2osoi_liq(c,j))/(h2osoi_ice(c,j)+h2osoi_liq(c,j)) - write(*,*) ' ' - endif - else qflx_liqevap_from_top_layer(p) = 0._r8 end if From 1675cbb23fc04f798ed0c24ab27704a6b060efea Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 22 Jan 2021 07:35:26 -0700 Subject: [PATCH 1775/1973] remove initial corrections --- src/biogeophys/BareGroundFluxesMod.F90 | 22 ---------------------- src/biogeophys/CanopyFluxesMod.F90 | 16 ---------------- src/biogeophys/SoilFluxesMod.F90 | 22 +++++++++++++++++++--- src/biogeophys/SoilHydrologyMod.F90 | 14 +++++++++++--- 4 files changed, 30 insertions(+), 44 deletions(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index cbcc3694cb..0e6985c22b 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -89,7 +89,6 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & Wet_Bulb, Wet_BulbS, HeatIndex, AppTemp, & swbgt, hmdex, dis_coi, dis_coiS, THIndex, & SwampCoolEff, KtoC, VaporPres - use clm_time_manager , only : get_step_size_real ! ! !ARGUMENTS: @@ -146,9 +145,6 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] real(r8) :: www ! surface soil wetness [-] - real(r8) :: snow_evaporation_limit - real(r8) :: ev_snow_unconstrained - real(r8) :: dtime ! land model time step (sec) !------------------------------------------------------------------------------ associate( & @@ -265,10 +261,6 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & endp => bounds%endp & ) - ! Get step size - - dtime = get_step_size_real() - ! First do some simple settings of values over points where frac vegetation covered ! by snow is zero @@ -427,20 +419,6 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & qflx_ev_soil(p) = -raiw*(forc_q(c) - qg_soil(c)) qflx_ev_h2osfc(p) = -raiw*(forc_q(c) - qg_h2osfc(c)) - ! adjust snow surface layer evaporation - j = col%snl(c)+1 - if ((h2osoi_ice(c,j)+h2osoi_liq(c,j)) > 0._r8 .and. j < 1) then - ! assumes for j < 1 that frac_sno_eff > 0 - snow_evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))*patch%wtcol(p)/frac_sno_eff(c) - if (qflx_ev_snow(p)*dtime > snow_evaporation_limit) then - ev_snow_unconstrained = qflx_ev_snow(p) - qflx_ev_snow(p) = snow_evaporation_limit/dtime - - qflx_evap_soi(p) = qflx_evap_soi(p) - frac_sno_eff(c)*(ev_snow_unconstrained - qflx_ev_snow(p)) - qflx_evap_tot(p) = qflx_evap_soi(p) - endif - endif - ! 2 m height air temperature t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index bfc1499455..9c26942559 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -432,9 +432,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, integer :: dummy_to_make_pgi_happy - real(r8) :: snow_evaporation_limit - real(r8) :: ev_snow_unconstrained - !------------------------------------------------------------------------------ SHR_ASSERT_ALL_FL((ubound(downreg_patch) == (/bounds%endp/)), sourcefile, __LINE__) @@ -1439,19 +1436,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, delq_h2osfc = wtalq(p)*qg_h2osfc(c)-wtlq0(p)*qsatl(p)-wtaq0(p)*forc_q(c) qflx_ev_h2osfc(p) = forc_rho(c)*wtgq(p)*delq_h2osfc - ! adjust snow surface layer evaporation - j = col%snl(c)+1 - if ((h2osoi_ice(c,j)+h2osoi_liq(c,j)) > 0._r8 .and. j < 1) then - ! assumes for j < 1 that frac_sno_eff > 0 - snow_evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))*patch%wtcol(p)/frac_sno(c) - if (qflx_ev_snow(p)*dtime > snow_evaporation_limit) then - ev_snow_unconstrained = qflx_ev_snow(p) - qflx_ev_snow(p) = snow_evaporation_limit/dtime - - qflx_evap_soi(p) = qflx_evap_soi(p) - frac_sno(c)*(ev_snow_unconstrained - qflx_ev_snow(p)) - endif - endif - ! 2 m height air temperature t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index eecdcb24a8..ffb6aa8056 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -5,7 +5,7 @@ module SoilFluxesMod ! Updates surface fluxes based on the new ground temperature. ! ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 + use shr_kind_mod , only : r8 => shr_kind_r8, r4 => shr_kind_r4 use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use abortutils , only : endrun @@ -213,7 +213,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! snow layers if (j < 1) then ! assumes for j < 1 that frac_sno_eff > 0 - evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))*patch%wtcol(p)/frac_sno_eff(c) + evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/frac_sno_eff(c) if (qflx_ev_snow(p)*dtime > evaporation_limit) then ev_unconstrained = qflx_ev_snow(p) qflx_ev_snow(p) = evaporation_limit/dtime @@ -227,7 +227,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! top soil layer for urban columns; adjust qflx_evap_soi directly if (lun%urbpoi(patch%landunit(p))) then j = 1 - evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))*patch%wtcol(p) + evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j)) if (qflx_evap_soi(p)*dtime > evaporation_limit) then ev_unconstrained = qflx_evap_soi(p) qflx_evap_soi(p) = evaporation_limit/dtime @@ -358,6 +358,22 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & end if + ! limit only solid evaporation (sublimation) from top soil layer + ! (liquid evaporation from soil should not be limited) + if (j==1 .and. frac_h2osfc(c) < 1._r8) then + + if (real((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(p) * dtime,r4) > real(h2osoi_ice(c,j),r4)) then + + qflx_liqevap_from_top_layer(p) & + = qflx_liqevap_from_top_layer(p) & + + (qflx_solidevap_from_top_layer(p) & + - h2osoi_ice(c,j)/(dtime*(1._r8 - frac_h2osfc(c)))) + qflx_solidevap_from_top_layer(p) & + = h2osoi_ice(c,j)/(dtime*(1._r8 - frac_h2osfc(c))) + + endif + endif + ! Variables needed by history tape qflx_evap_can(p) = qflx_evap_veg(p) - qflx_tran_veg(p) diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 index 436b35e1cf..61f0767ce4 100644 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ b/src/biogeophys/SoilHydrologyMod.F90 @@ -844,11 +844,15 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil ! make consistent with how evap_grnd removed in infiltration h2osoi_liq(c,1) = h2osoi_liq(c,1) + (1._r8 - frac_h2osfc(c))*qflx_liqdew_to_top_layer(c) * dtime h2osoi_ice(c,1) = h2osoi_ice(c,1) + (1._r8 - frac_h2osfc(c))*qflx_soliddew_to_top_layer(c) * dtime - if (qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then + if ((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then qflx_solidevap_from_top_layer_save = qflx_solidevap_from_top_layer(c) qflx_solidevap_from_top_layer(c) = h2osoi_ice(c,1)/dtime qflx_ev_snow(c) = qflx_ev_snow(c) - (qflx_solidevap_from_top_layer_save & - qflx_solidevap_from_top_layer(c)) + + if((abs((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1))) > 1.e-8) then + call endrun(msg="solid evap too large! "//errmsg(sourcefile, __LINE__)) + endif h2osoi_ice(c,1) = 0._r8 else h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_solidevap_from_top_layer(c) * dtime @@ -2315,11 +2319,15 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & ! make consistent with how evap_grnd removed in infiltration h2osoi_liq(c,1) = h2osoi_liq(c,1) + (1._r8 - frac_h2osfc(c))*qflx_liqdew_to_top_layer(c) * dtime h2osoi_ice(c,1) = h2osoi_ice(c,1) + (1._r8 - frac_h2osfc(c))*qflx_soliddew_to_top_layer(c) * dtime - if (qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then + if ((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then qflx_solidevap_from_top_layer_save = qflx_solidevap_from_top_layer(c) qflx_solidevap_from_top_layer(c) = h2osoi_ice(c,1)/dtime qflx_ev_snow(c) = qflx_ev_snow(c) - (qflx_solidevap_from_top_layer_save & - - qflx_solidevap_from_top_layer(c)) + - qflx_solidevap_from_top_layer(c)) + if((abs((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1))) > 1.e-8) then + call endrun(msg="solid evap too large! "//errmsg(sourcefile, __LINE__)) + endif + h2osoi_ice(c,1) = 0._r8 else h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_solidevap_from_top_layer(c) * dtime From cb6a84042a47e785e365ac3629715bd22a5810d0 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 23 Jan 2021 16:48:50 -0700 Subject: [PATCH 1776/1973] Revisions part 1 in response to code review --- src/biogeophys/BalanceCheckMod.F90 | 52 ++++++++++------------------- src/biogeophys/WaterBalanceType.F90 | 4 --- src/main/clm_driver.F90 | 3 +- src/main/lnd2atmMod.F90 | 21 ++++++++---- 4 files changed, 34 insertions(+), 46 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index ad2cbd31dd..733f24403d 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -168,8 +168,7 @@ end subroutine BeginWaterGridcellBalance !----------------------------------------------------------------------- subroutine BeginWaterColumnBalance(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, soilhydrology_inst, lakestate_inst, & - use_aquifer_layer) + water_inst, lakestate_inst) ! ! !DESCRIPTION: ! Initialize column-level water balance at beginning of time step, for bulk water and @@ -183,8 +182,6 @@ subroutine BeginWaterColumnBalance(bounds, & integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(water_type) , intent(inout) :: water_inst type(lakestate_type) , intent(in) :: lakestate_inst - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: integer :: i @@ -196,12 +193,10 @@ subroutine BeginWaterColumnBalance(bounds, & call BeginWaterColumnBalanceSingle(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & - soilhydrology_inst, & lakestate_inst, & water_inst%bulk_and_tracers(i)%waterstate_inst, & water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & - water_inst%bulk_and_tracers(i)%waterbalance_inst, & - use_aquifer_layer = use_aquifer_layer) + water_inst%bulk_and_tracers(i)%waterbalance_inst) end do end subroutine BeginWaterColumnBalance @@ -282,8 +277,12 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & call c2g(bounds, begwb_col(begc:endc), begwb_grc(begg:endg), & c2l_scale_type='urbanf', l2g_scale_type='unity') - call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_beg(bounds, qflx_liq_dynbal_left_to_dribble(begg:endg)) - call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_beg(bounds, qflx_ice_dynbal_left_to_dribble(begg:endg)) + call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_beg( & + bounds, & + qflx_liq_dynbal_left_to_dribble(begg:endg)) + call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_beg( & + bounds, & + qflx_ice_dynbal_left_to_dribble(begg:endg)) do g = begg, endg begwb_grc(g) = begwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & @@ -297,9 +296,8 @@ end subroutine BeginWaterGridcellBalanceSingle !----------------------------------------------------------------------- subroutine BeginWaterColumnBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - soilhydrology_inst, lakestate_inst, waterstate_inst, & - waterdiagnostic_inst, waterbalance_inst, & - use_aquifer_layer) + lakestate_inst, waterstate_inst, & + waterdiagnostic_inst, waterbalance_inst) ! ! !DESCRIPTION: ! Initialize column-level water balance at beginning of time step, for bulk or a @@ -311,37 +309,19 @@ subroutine BeginWaterColumnBalanceSingle(bounds, & integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points - type(soilhydrology_type) , intent(in) :: soilhydrology_inst type(lakestate_type) , intent(in) :: lakestate_inst class(waterstate_type) , intent(inout) :: waterstate_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst class(waterbalance_type) , intent(inout) :: waterbalance_inst - logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: - integer :: c, j, fc ! indices !----------------------------------------------------------------------- associate( & - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - aquifer_water_baseline => waterstate_inst%aquifer_water_baseline, & ! Input: [real(r8)] baseline value for water in the unconfined aquifer (wa_col) for this bulk / tracer (mm) - wa => waterstate_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) begwb => waterbalance_inst%begwb_col , & ! Output: [real(r8) (:) ] water mass begining of the time step h2osno_old => waterbalance_inst%h2osno_old_col & ! Output: [real(r8) (:) ] snow water (mm H2O) at previous time step ) - if(use_aquifer_layer) then - do fc = 1, num_nolakec - c = filter_nolakec(fc) - if (col%hydrologically_active(c)) then - if(zwt(c) <= zi(c,nlevsoi)) then - wa(c) = aquifer_water_baseline - end if - end if - end do - endif - call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & waterstate_inst, waterdiagnostic_inst, & subtract_dynbal_baselines = .false., & @@ -413,6 +393,7 @@ subroutine BalanceCheck( bounds, & integer :: nstep ! time step number integer :: DAnstep ! time step number since last Data Assimilation (DA) integer :: indexp,indexc,indexl,indexg ! index of first found in search loop + real(r8) :: errh2o_grc(bounds%begg:bounds%endg) ! grid cell level water conservation error [mm H2O] real(r8) :: forc_rain_col(bounds%begc:bounds%endc) ! column level rain rate [mm/s] real(r8) :: forc_snow_col(bounds%begc:bounds%endc) ! column level snow rate [mm/s] real(r8) :: h2osno_total(bounds%begc:bounds%endc) ! total snow water [mm H2O] @@ -450,7 +431,6 @@ subroutine BalanceCheck( bounds, & snow_depth => waterdiagnosticbulk_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) begwb_grc => waterbalance_inst%begwb_grc , & ! Input: [real(r8) (:) ] grid cell-level water mass begining of the time step endwb_grc => waterbalance_inst%endwb_grc , & ! Output: [real(r8) (:) ] grid cell-level water mass end of the time step - errh2o_grc => waterbalance_inst%errh2o_grc , & ! Output: [real(r8) (:) ] grid cell-level water conservation error (mm H2O) begwb_col => waterbalance_inst%begwb_col , & ! Input: [real(r8) (:) ] column-level water mass begining of the time step endwb_col => waterbalance_inst%endwb_col , & ! Output: [real(r8) (:) ] column-level water mass end of the time step errh2o_col => waterbalance_inst%errh2o_col , & ! Output: [real(r8) (:) ] column-level water conservation error (mm H2O) @@ -642,8 +622,12 @@ subroutine BalanceCheck( bounds, & qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_end(bounds, qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg)) - call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_end(bounds, qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg)) + call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_end( & + bounds, & + qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg)) + call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_end( & + bounds, & + qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg)) do g = bounds%begg, bounds%endg endwb_grc(g) = endwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & @@ -704,7 +688,7 @@ subroutine BalanceCheck( bounds, & end if - ! Snow balance check at the grid cell level. + ! Snow balance check at the column level. ! Beginning snow balance variable h2osno_old is calculated once ! for both the column-level and grid cell-level balance checks. diff --git a/src/biogeophys/WaterBalanceType.F90 b/src/biogeophys/WaterBalanceType.F90 index 4d747acebe..6b10895549 100644 --- a/src/biogeophys/WaterBalanceType.F90 +++ b/src/biogeophys/WaterBalanceType.F90 @@ -42,7 +42,6 @@ module WaterBalanceType real(r8), pointer :: endwb_col (:) ! column-level water mass end of the time step real(r8), pointer :: errh2o_patch (:) ! water conservation error (mm H2O) real(r8), pointer :: errh2o_col (:) ! column-level water conservation error (mm H2O) - real(r8), pointer :: errh2o_grc (:) ! grid cell-level water conservation error (mm H2O) real(r8), pointer :: errh2osno_col (:) ! snow water conservation error(mm H2O) contains @@ -133,9 +132,6 @@ subroutine InitAllocate(this, bounds, tracer_vars) call AllocateVar1d(var = this%errh2o_col, name = 'errh2o_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN) - call AllocateVar1d(var = this%errh2o_grc, name = 'errh2o_grc', & - container = tracer_vars, & - bounds = bounds, subgrid_level = BOUNDS_SUBGRID_GRIDCELL) call AllocateVar1d(var = this%errh2osno_col, name = 'errh2osno_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index eb94d5de83..2340b5d139 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -391,8 +391,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call BeginWaterColumnBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & - water_inst, soilhydrology_inst, lakestate_inst, & - use_aquifer_layer = use_aquifer_layer()) + water_inst, lakestate_inst) call t_stopf('begwbal') diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index d3eb22d610..ed9d44f36f 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -358,8 +358,9 @@ subroutine lnd2atm(bounds, & ! qflx_runoff is the sum of a number of terms, including qflx_qrgwl. Since we ! are adjusting qflx_qrgwl above, we need to adjust qflx_runoff analogously. - water_inst%waterfluxbulk_inst%qflx_runoff_col(c) = water_inst%waterfluxbulk_inst%qflx_runoff_col(c) + & - water_inst%waterlnd2atmbulk_inst%qflx_liq_from_ice_col(c) + water_inst%waterfluxbulk_inst%qflx_runoff_col(c) = & + water_inst%waterfluxbulk_inst%qflx_runoff_col(c) + & + water_inst%waterlnd2atmbulk_inst%qflx_liq_from_ice_col(c) end if end do @@ -374,8 +375,12 @@ subroutine lnd2atm(bounds, & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) do g = bounds%begg, bounds%endg - water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) - water_inst%waterfluxbulk_inst%qflx_liq_dynbal_grc(g) - water_inst%waterlnd2atmbulk_inst%qflx_rofliq_grc(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofliq_grc(g) - water_inst%waterfluxbulk_inst%qflx_liq_dynbal_grc(g) + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) = & + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_qgwl_grc(g) - & + water_inst%waterfluxbulk_inst%qflx_liq_dynbal_grc(g) + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_grc(g) = & + water_inst%waterlnd2atmbulk_inst%qflx_rofliq_grc(g) - & + water_inst%waterfluxbulk_inst%qflx_liq_dynbal_grc(g) enddo call c2g( bounds, & @@ -394,7 +399,9 @@ subroutine lnd2atm(bounds, & water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) do g = bounds%begg, bounds%endg - water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc(g) = water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc(g) - water_inst%waterfluxbulk_inst%qflx_ice_dynbal_grc(g) + water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc(g) = & + water_inst%waterlnd2atmbulk_inst%qflx_rofice_grc(g) - & + water_inst%waterfluxbulk_inst%qflx_ice_dynbal_grc(g) enddo ! calculate total water storage for history files @@ -407,7 +414,9 @@ subroutine lnd2atm(bounds, & water_inst%waterbalancebulk_inst%endwb_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) do g = bounds%begg, bounds%endg - water_inst%waterdiagnosticbulk_inst%tws_grc(g) = water_inst%waterbalancebulk_inst%endwb_grc(g) + water_inst%wateratm2lndbulk_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8 + water_inst%waterdiagnosticbulk_inst%tws_grc(g) = & + water_inst%waterbalancebulk_inst%endwb_grc(g) + & + water_inst%wateratm2lndbulk_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8 enddo end subroutine lnd2atm From 799e011fe71a02f4ddb8c97ed267cb6b5de6ebaf Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 23 Jan 2021 18:43:36 -0700 Subject: [PATCH 1777/1973] Revisions part 2: bypass `for_testing_zero_dynbal_fluxes` cases --- src/biogeophys/BalanceCheckMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 733f24403d..fae724f58d 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -370,6 +370,7 @@ subroutine BalanceCheck( bounds, & use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause use CanopyStateType , only : canopystate_type use subgridAveMod , only : c2g + use dynSubgridControlMod, only : get_for_testing_zero_dynbal_fluxes ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -658,7 +659,8 @@ subroutine BalanceCheck( bounds, & ' nstep= ',nstep, & ' local indexg= ',indexg,& ' errh2o_grc= ',errh2o_grc(indexg) - if ((errh2o_max_val > error_thresh) .and. (DAnstep > skip_steps)) then + if (errh2o_max_val > error_thresh .and. DAnstep > skip_steps .and. & + .not. get_for_testing_zero_dynbal_fluxes()) then write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' write(iulog,*)'nstep = ',nstep From 23bf38baa6142b478ccff8c0cb7326d402edefb5 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 25 Jan 2021 14:48:21 -0700 Subject: [PATCH 1778/1973] Revisions part 3: Insert comment about negative dribble terms --- src/biogeophys/BalanceCheckMod.F90 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index fae724f58d..f1df93fa4a 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -284,6 +284,10 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & bounds, & qflx_ice_dynbal_left_to_dribble(begg:endg)) + ! These dynbal dribblers store the delta state, (end - beg). Thus, the + ! amount dribbled out is the negative of the amount stored in the + ! dribblers. Therefore, conservation requires us to subtract the amount + ! remaining to dribble. do g = begg, endg begwb_grc(g) = begwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - qflx_ice_dynbal_left_to_dribble(g) @@ -630,6 +634,10 @@ subroutine BalanceCheck( bounds, & bounds, & qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg)) + ! These dynbal dribblers store the delta state, (end - beg). Thus, the + ! amount dribbled out is the negative of the amount stored in the + ! dribblers. Therefore, conservation requires us to subtract the amount + ! remaining to dribble. do g = bounds%begg, bounds%endg endwb_grc(g) = endwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - qflx_ice_dynbal_left_to_dribble(g) From c5b09617be65bab70f00820e1162713f50883058 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 25 Jan 2021 18:05:33 -0700 Subject: [PATCH 1779/1973] Addition of text to the comment that I added in the last commit --- src/biogeophys/BalanceCheckMod.F90 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index f1df93fa4a..56dabca84c 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -288,6 +288,11 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & ! amount dribbled out is the negative of the amount stored in the ! dribblers. Therefore, conservation requires us to subtract the amount ! remaining to dribble. + ! This sign convention is opposite to the convention chosen for the + ! respective dribble terms used in the carbon balance. At some point + ! it may be worth making the two conventions consistent. + ! Bill Sacks states: I think the convention used for the water and + ! energy dribblers is counter-intuitive. do g = begg, endg begwb_grc(g) = begwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - qflx_ice_dynbal_left_to_dribble(g) @@ -638,6 +643,11 @@ subroutine BalanceCheck( bounds, & ! amount dribbled out is the negative of the amount stored in the ! dribblers. Therefore, conservation requires us to subtract the amount ! remaining to dribble. + ! This sign convention is opposite to the convention chosen for the + ! respective dribble terms used in the carbon balance. At some point + ! it may be worth making the two conventions consistent. + ! Bill Sacks states: I think the convention used for the water and + ! energy dribblers is counter-intuitive. do g = bounds%begg, bounds%endg endwb_grc(g) = endwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - qflx_ice_dynbal_left_to_dribble(g) From 377ec154fbae36a563635b0dba9d4e4eb856f55e Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 27 Jan 2021 01:01:19 -0800 Subject: [PATCH 1780/1973] updating Changelog --- doc/ChangeLog | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 130 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 2ca737aa91..e84357bdb7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,132 @@ =============================================================== +Tag name: ctsm5.1.dev022 +Originator(s): gregorylemieux (Gregory Lemieux,LBL/NGEET,510-486-5049) +Date: Wed 27 Jan 2021 12:26:44 AM PST +One-line Summary: Merge fates_main_api into ctsm master + +Purpose and description of changes +---------------------------------- + +This brings fates_main_api into and up-to-date with ctsm master. +At the point of merge, fates_main_api was parallel with ctsm5.1.dev020, +only one tag behind ctsm master's head. + +The purpose of this merge is to make all future updates to fates +on the ctsm master branch instead of on the fates_main_api branch. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[X] clm5_0 + +[ ] ctsm5_0-nwp + +[X] clm4_5 + + +Bugs fixed or introduced +------------------------ +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Issues fixed (include CTSM Issue #): none + +CIME Issues fixed (include issue #): none + +Known bugs introduced in this tag (include issue #): none + +Known bugs found since the previous tag (include issue #): none + + +Notes of particular relevance for users +--------------------------------------- +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Caveats for users (e.g., need to interpolate initial conditions): none + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist +variables): none + +Changes made to namelist defaults (e.g., changed parameter values): none + +Changes to the datasets (e.g., parameter, surface or initial files): none + +Substantial timing or memory changes: + Only the fates testmod FatesAllVars failed the MEMCOMP test + + +Notes of particular relevance for developers: +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double +maintenance): none + +Changes to tests or testing: none + + +Testing summary: +---------------- + + [PASS means all tests PASS; OK means tests PASS other than expected fails.] + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- PASS (except for fates DIFFs) + izumi ------- N/A + + ok: All non-fates testmods PASS. Fates testmods have DIFF as expected due + to update of fates tag. + + any other testing (give details below): + + fates suite: + cheyenne ---- OK + + ok: expected failures on COMPARE_base_rest for FatesHydro + and Fates_nat_and_anthro_ignitions. All else B4B. + + fates baseline: fates-sci.1.43.2_api.14.2.0-ctsm5.1.dev020-C5f348cac-F5534a940 + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + +Answer changes +-------------- + +Changes answers relative to baseline: Yes, only for fates + + Summarize any changes to answers, i.e., + - what code configurations: all fates + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new + climate): larger than roundoff + + Comparison made using fates suite between fates_main_api (at ctsm5.1.dev020) + and ctsm5.1.dev022. All tests PASS, except for two expected failures and + expected NLCOMP failure due to ctsm5.1.dev021 update to paramfile. + + +Other details +------------- + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +fates + + fates: sci.1.30.0_api.8.0.0 -> sci.1.43.2_api.14.2.0 + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + #1264 -- Merge fates_main_api into master + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev021 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Tue Jan 12 20:21:52 MST 2021 @@ -122,6 +250,7 @@ Changes answers relative to baseline: Yes! Detailed list of changes ------------------------ + Pull Requests that document the changes (include PR ids): (https://github.com/ESCOMP/ctsm/pull) #1016 -- Heat Storage biomass diff --git a/doc/ChangeSum b/doc/ChangeSum index 0ca1854990..501dbbb210 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev022 glemieux 01/27/2021 Merge fates_main_api into ctsm master ctsm5.1.dev021 erik 01/12/2021 Add option for biomass heat storage (BHS) to clm5_1 physics ctsm5.1.dev020 erik 12/30/2020 Potential roundoff changes in preparation for bio-mass heat storage option ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler From 9bc64e0f1cf5a99daf72e6dcad1b6d3ce9556022 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Wed, 27 Jan 2021 12:32:03 -0700 Subject: [PATCH 1781/1973] move leaf_biomass calculation out of if woody=1 block --- src/biogeochem/CNVegStructUpdateMod.F90 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 1c0ec70fa0..a3e0438544 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -181,6 +181,17 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & tsai_min = tsai_min * 0.5_r8 tsai(p) = max(tsai_alpha*tsai_old+max(tlai_old-tlai(p),0._r8),tsai_min) + ! calculate vegetation physiological parameters used in biomass heat storage + ! + if (use_biomass_heat_storage) then + ! Assumes fbw (fraction of biomass that is water) is the same for leaves and stems + leaf_biomass(p) = max(0.0025_r8,leafc(p)) & + * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) + + else + leaf_biomass(p) = 0_r8 + end if + if (woody(ivt(p)) == 1._r8) then ! trees and shrubs for now have a very simple allometry, with hard-wired @@ -204,22 +215,15 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & endif - ! - ! calculate vegetation physiological parameters used in biomass heat storage - ! if (use_biomass_heat_storage) then ! Assumes fbw (fraction of biomass that is water) is the same for leaves and stems - leaf_biomass(p) = max(0.0025_r8,leafc(p)) & - * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) - stem_biomass(p) = (spinup_factor_deadwood*deadstemc(p) + livestemc(p)) & * c_to_b * 1.e-3_r8 / (1._r8 - fbw(ivt(p))) - else - leaf_biomass(p) = 0_r8 stem_biomass(p) = 0_r8 end if + ! ! Peter Thornton, 5/3/2004 ! Adding test to keep htop from getting too close to forcing height for windspeed ! Also added for grass, below, although it is not likely to ever be an issue. From 6e38fc28ebab92d41981f4097c2f9ef039d14321 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 27 Jan 2021 15:46:07 -0700 Subject: [PATCH 1782/1973] Revisions part 4: Tracking wa_reset_nonconservation_gain --- src/biogeophys/BalanceCheckMod.F90 | 81 ++++++++++++++++++++--------- src/biogeophys/WaterBalanceType.F90 | 23 +++++++- src/main/clm_driver.F90 | 5 +- 3 files changed, 80 insertions(+), 29 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 56dabca84c..50575eb5c9 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -126,7 +126,7 @@ end function GetBalanceCheckSkipSteps !----------------------------------------------------------------------- subroutine BeginWaterGridcellBalance(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, soilhydrology_inst, lakestate_inst, & + water_inst, lakestate_inst, & use_aquifer_layer) ! ! !DESCRIPTION: @@ -141,7 +141,6 @@ subroutine BeginWaterGridcellBalance(bounds, & integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(water_type) , intent(inout) :: water_inst type(lakestate_type) , intent(in) :: lakestate_inst - type(soilhydrology_type), intent(in) :: soilhydrology_inst logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: @@ -154,7 +153,6 @@ subroutine BeginWaterGridcellBalance(bounds, & call BeginWaterGridcellBalanceSingle(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & - soilhydrology_inst, & lakestate_inst, & water_inst%bulk_and_tracers(i)%waterstate_inst, & water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & @@ -168,7 +166,8 @@ end subroutine BeginWaterGridcellBalance !----------------------------------------------------------------------- subroutine BeginWaterColumnBalance(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, lakestate_inst) + water_inst, soilhydrology_inst, lakestate_inst, & + use_aquifer_layer) ! ! !DESCRIPTION: ! Initialize column-level water balance at beginning of time step, for bulk water and @@ -182,6 +181,8 @@ subroutine BeginWaterColumnBalance(bounds, & integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(water_type) , intent(inout) :: water_inst type(lakestate_type) , intent(in) :: lakestate_inst + type(soilhydrology_type) , intent(in) :: soilhydrology_inst + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: integer :: i @@ -193,10 +194,12 @@ subroutine BeginWaterColumnBalance(bounds, & call BeginWaterColumnBalanceSingle(bounds, & num_nolakec, filter_nolakec, & num_lakec, filter_lakec, & + soilhydrology_inst, & lakestate_inst, & water_inst%bulk_and_tracers(i)%waterstate_inst, & water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & - water_inst%bulk_and_tracers(i)%waterbalance_inst) + water_inst%bulk_and_tracers(i)%waterbalance_inst, & + use_aquifer_layer = use_aquifer_layer) end do end subroutine BeginWaterColumnBalance @@ -204,7 +207,7 @@ end subroutine BeginWaterColumnBalance !----------------------------------------------------------------------- subroutine BeginWaterGridcellBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - soilhydrology_inst, lakestate_inst, waterstate_inst, & + lakestate_inst, waterstate_inst, & waterdiagnostic_inst, waterbalance_inst, waterflux_inst, & use_aquifer_layer) ! @@ -221,7 +224,6 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points - type(soilhydrology_type) , intent(in) :: soilhydrology_inst type(lakestate_type) , intent(in) :: lakestate_inst class(waterstate_type) , intent(inout) :: waterstate_inst class(waterflux_type) , intent(inout) :: waterflux_inst @@ -230,17 +232,15 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: - integer :: c, g, j, fc ! indices + integer :: g ! indices integer :: begc, endc, begg, endg ! bounds real(r8) :: qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at beginning of time step real(r8) :: qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc ice dynamic land cover change conversion runoff flux at beginning of time step + real(r8) :: wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg) ! grc mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) !----------------------------------------------------------------------- associate( & - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - aquifer_water_baseline => waterstate_inst%aquifer_water_baseline, & ! Input: [real(r8)] baseline value for water in the unconfined aquifer (wa_col) for this bulk / tracer (mm) - wa => waterstate_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) + wa_reset_nonconservation_gain_col => waterbalance_inst%wa_reset_nonconservation_gain_col , & ! Output: [real(r8) (:) ] col mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) begwb_col => waterbalance_inst%begwb_col, & ! Output: [real(r8) (:) ] column-level water mass begining of the time step begwb_grc => waterbalance_inst%begwb_grc & ! Output: [real(r8) (:) ] grid cell-level water mass begining of the time step ) @@ -250,17 +250,20 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & begg = bounds%begg endg = bounds%endg - ! wa(c) gets added to liquid_mass in ComputeLiqIceMassNonLake - if(use_aquifer_layer) then - do fc = 1, num_nolakec - c = filter_nolakec(fc) - if (col%hydrologically_active(c)) then - if(zwt(c) <= zi(c,nlevsoi)) then - wa(c) = aquifer_water_baseline - end if - end if - end do - endif + if (use_aquifer_layer) then + ! wa_reset_nonconservation_gain_col should be non-zero only when + ! use_aquifer_layer is true. We do this c2g call only when needed + ! to avoid unnecessary calculations; by adding this term only when + ! use_aquifer_layer is true, we effectively let the balance checks + ! ensure that this term is zero when use_aquifer_layer is false, + ! as it should be. + call c2g( bounds, & + wa_reset_nonconservation_gain_col(begc:endc), & + wa_reset_nonconservation_gain_grc(begg:endg), & + c2l_scale_type='urbanf', l2g_scale_type='unity' ) + else + wa_reset_nonconservation_gain_grc(begg:endg) = 0._r8 + end if ! NOTES subroutines Compute*Mass* are in TotalWaterAndHeatMod.F90 ! endwb is calculated in HydrologyDrainageMod & LakeHydrologyMod @@ -295,7 +298,8 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & ! energy dribblers is counter-intuitive. do g = begg, endg begwb_grc(g) = begwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - - qflx_ice_dynbal_left_to_dribble(g) + - qflx_ice_dynbal_left_to_dribble(g) & + - wa_reset_nonconservation_gain_grc(g) end do end associate @@ -305,8 +309,9 @@ end subroutine BeginWaterGridcellBalanceSingle !----------------------------------------------------------------------- subroutine BeginWaterColumnBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - lakestate_inst, waterstate_inst, & - waterdiagnostic_inst, waterbalance_inst) + soilhydrology_inst, lakestate_inst, waterstate_inst, & + waterdiagnostic_inst, waterbalance_inst, & + use_aquifer_layer) ! ! !DESCRIPTION: ! Initialize column-level water balance at beginning of time step, for bulk or a @@ -318,19 +323,43 @@ subroutine BeginWaterColumnBalanceSingle(bounds, & integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points integer , intent(in) :: num_lakec ! number of column lake points in column filter integer , intent(in) :: filter_lakec(:) ! column filter for lake points + type(soilhydrology_type) , intent(in) :: soilhydrology_inst type(lakestate_type) , intent(in) :: lakestate_inst class(waterstate_type) , intent(inout) :: waterstate_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst class(waterbalance_type) , intent(inout) :: waterbalance_inst + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: + integer :: c, fc ! indices !----------------------------------------------------------------------- associate( & + zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) + zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) + aquifer_water_baseline => waterstate_inst%aquifer_water_baseline, & ! Input: [real(r8)] baseline value for water in the unconfined aquifer (wa_col) for this bulk / tracer (mm) + wa => waterstate_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) + wa_reset_nonconservation_gain => waterbalance_inst%wa_reset_nonconservation_gain_col , & ! Output: [real(r8) (:) ] mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) begwb => waterbalance_inst%begwb_col , & ! Output: [real(r8) (:) ] water mass begining of the time step h2osno_old => waterbalance_inst%h2osno_old_col & ! Output: [real(r8) (:) ] snow water (mm H2O) at previous time step ) + ! wa(c) gets added to liquid_mass in ComputeLiqIceMassNonLake + if(use_aquifer_layer) then + do fc = 1, num_nolakec + c = filter_nolakec(fc) + if (col%hydrologically_active(c)) then + if(zwt(c) <= zi(c,nlevsoi)) then + wa_reset_nonconservation_gain(c) = aquifer_water_baseline - & + wa(c) + wa(c) = aquifer_water_baseline + else + wa_reset_nonconservation_gain(c) = 0._r8 + end if + end if + end do + endif + call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & waterstate_inst, waterdiagnostic_inst, & subtract_dynbal_baselines = .false., & diff --git a/src/biogeophys/WaterBalanceType.F90 b/src/biogeophys/WaterBalanceType.F90 index 6b10895549..0bf0573913 100644 --- a/src/biogeophys/WaterBalanceType.F90 +++ b/src/biogeophys/WaterBalanceType.F90 @@ -33,6 +33,7 @@ module WaterBalanceType real(r8), pointer :: snow_sources_col (:) ! col snow sources (mm H2O/s) real(r8), pointer :: snow_sinks_col (:) ! col snow sinks (mm H2O/s) + real(r8), pointer :: wa_reset_nonconservation_gain_col(:) ! col mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) ! Balance Checks @@ -49,6 +50,7 @@ module WaterBalanceType procedure :: Init procedure, private :: InitAllocate procedure, private :: InitHistory + procedure, private :: InitCold end type waterbalance_type @@ -70,8 +72,8 @@ subroutine Init(this, bounds, info, tracer_vars) this%info => info call this%InitAllocate(bounds, tracer_vars) - call this%InitHistory(bounds) + call this%InitCold(bounds) end subroutine Init @@ -113,6 +115,9 @@ subroutine InitAllocate(this, bounds, tracer_vars) call AllocateVar1d(var = this%snow_sinks_col, name = 'snow_sinks_col', & container = tracer_vars, & bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN) + call AllocateVar1d(var = this%wa_reset_nonconservation_gain_col, name = 'wa_reset_nonconservation_gain_col', & + container = tracer_vars, & + bounds = bounds, subgrid_level = BOUNDS_SUBGRID_COLUMN) call AllocateVar1d(var = this%begwb_grc, name = 'begwb_grc', & container = tracer_vars, & @@ -233,4 +238,20 @@ subroutine InitHistory(this, bounds) ptr_col=this%errh2osno_col, c2l_scale_type='urbanf') end subroutine InitHistory + !----------------------------------------------------------------------- + subroutine InitCold(this, bounds) + ! + ! !USES: + ! + ! !ARGUMENTS: + class(waterbalance_type), intent(in) :: this + type(bounds_type) , intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + !----------------------------------------------------------------------- + + this%wa_reset_nonconservation_gain_col(bounds%begc:bounds%endc) = 0.0_r8 + + end subroutine InitCold + end module WaterBalanceType diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 2340b5d139..7504ae1c28 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -330,7 +330,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call BeginWaterGridcellBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & - water_inst, soilhydrology_inst, lakestate_inst, & + water_inst, lakestate_inst, & use_aquifer_layer = use_aquifer_layer()) call t_stopf('begwbal') end do @@ -391,7 +391,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call BeginWaterColumnBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & - water_inst, lakestate_inst) + water_inst, soilhydrology_inst, lakestate_inst, & + use_aquifer_layer = use_aquifer_layer()) call t_stopf('begwbal') From 292c8b63ff8528f73348a129374a23312fe3887c Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 27 Jan 2021 16:11:36 -0800 Subject: [PATCH 1783/1973] removing unnecessary spitfire addition to cnfire_inparm group --- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index b65a93c12c..ecc8fdef36 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -207,7 +207,7 @@ formulation (1). + group="cnfire_inparm" valid_values="nofire,li2014qianfrc,li2016crufrc,li2021gswpfrc" > The method type to use for CNFire nofire: Turn fire effects off From 6f0bf37db5e22422b7d58474989ee331957ee4c2 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 28 Jan 2021 15:12:05 -0700 Subject: [PATCH 1784/1973] Minor cleanup of comments and write statements --- src/biogeophys/BalanceCheckMod.F90 | 42 ++++++++++++++++-------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 50575eb5c9..84f4bc9484 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -240,7 +240,7 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & !----------------------------------------------------------------------- associate( & - wa_reset_nonconservation_gain_col => waterbalance_inst%wa_reset_nonconservation_gain_col , & ! Output: [real(r8) (:) ] col mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) + wa_reset_nonconservation_gain_col => waterbalance_inst%wa_reset_nonconservation_gain_col , & ! Output: [real(r8) (:) ] col mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) begwb_col => waterbalance_inst%begwb_col, & ! Output: [real(r8) (:) ] column-level water mass begining of the time step begwb_grc => waterbalance_inst%begwb_grc & ! Output: [real(r8) (:) ] grid cell-level water mass begining of the time step ) @@ -251,7 +251,7 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & endg = bounds%endg if (use_aquifer_layer) then - ! wa_reset_nonconservation_gain_col should be non-zero only when + ! wa_reset_nonconservation_gain may be non-zero only when ! use_aquifer_layer is true. We do this c2g call only when needed ! to avoid unnecessary calculations; by adding this term only when ! use_aquifer_layer is true, we effectively let the balance checks @@ -309,7 +309,7 @@ end subroutine BeginWaterGridcellBalanceSingle !----------------------------------------------------------------------- subroutine BeginWaterColumnBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - soilhydrology_inst, lakestate_inst, waterstate_inst, & + soilhydrology_inst, lakestate_inst, waterstate_inst, & waterdiagnostic_inst, waterbalance_inst, & use_aquifer_layer) ! @@ -335,16 +335,20 @@ subroutine BeginWaterColumnBalanceSingle(bounds, & !----------------------------------------------------------------------- associate( & - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) + zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) + zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) aquifer_water_baseline => waterstate_inst%aquifer_water_baseline, & ! Input: [real(r8)] baseline value for water in the unconfined aquifer (wa_col) for this bulk / tracer (mm) - wa => waterstate_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) - wa_reset_nonconservation_gain => waterbalance_inst%wa_reset_nonconservation_gain_col , & ! Output: [real(r8) (:) ] mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) + wa => waterstate_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) + wa_reset_nonconservation_gain => waterbalance_inst%wa_reset_nonconservation_gain_col , & ! Output: [real(r8) (:) ] mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) begwb => waterbalance_inst%begwb_col , & ! Output: [real(r8) (:) ] water mass begining of the time step h2osno_old => waterbalance_inst%h2osno_old_col & ! Output: [real(r8) (:) ] snow water (mm H2O) at previous time step ) ! wa(c) gets added to liquid_mass in ComputeLiqIceMassNonLake + ! wa_reset_nonconservation_gain is calculated for the grid cell-level + ! water balance check and may be non-zero only when + ! use_aquifer_layer is true. The grid cell-level balance check ensures + ! that this term is zero when use_aquifer_layer is false, as it should be. if(use_aquifer_layer) then do fc = 1, num_nolakec c = filter_nolakec(fc) @@ -610,7 +614,7 @@ subroutine BalanceCheck( bounds, & ' errh2o= ',errh2o_col(indexc) if ((errh2o_max_val > error_thresh) .and. (DAnstep > skip_steps)) then - write(iulog,*)'clm urban model is stopping - error is greater than 1e-5 (mm)' + write(iulog,*)'CTSM model stopping because errh2o > ', error_thresh, ' mm' write(iulog,*)'nstep = ',nstep write(iulog,*)'errh2o_col = ',errh2o_col(indexc) write(iulog,*)'forc_rain = ',forc_rain_col(indexc)*dtime @@ -639,7 +643,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'qflx_glcice_dyn_water_flux = ', qflx_glcice_dyn_water_flux_col(indexc)*dtime end if - write(iulog,*)'clm model is stopping' + write(iulog,*)'CTSM model is stopping' call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) end if @@ -709,7 +713,7 @@ subroutine BalanceCheck( bounds, & if (errh2o_max_val > error_thresh .and. DAnstep > skip_steps .and. & .not. get_for_testing_zero_dynbal_fluxes()) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' + write(iulog,*)'CTSM model stopping because errh2o > ', error_thresh, ' mm' write(iulog,*)'nstep = ',nstep write(iulog,*)'errh2o_grc = ',errh2o_grc(indexg) write(iulog,*)'forc_rain = ',forc_rain_grc(indexg)*dtime @@ -731,7 +735,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'forc_flood = ',forc_flood_grc(indexg)*dtime write(iulog,*)'qflx_glcice_dyn_water_flux = ',qflx_glcice_dyn_water_flux_grc(indexg)*dtime - write(iulog,*)'clm model is stopping' + write(iulog,*)'CTSM model is stopping' call endrun(decomp_index=indexg, clmlevel=nameg, msg=errmsg(sourcefile, __LINE__)) end if @@ -811,7 +815,7 @@ subroutine BalanceCheck( bounds, & ' errh2osno= ',errh2osno(indexc) if ((errh2osno_max_val > error_thresh) .and. (DAnstep > skip_steps) ) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' + write(iulog,*)'CTSM model stopping because errh2osno > ', error_thresh, ' mm' write(iulog,*)'nstep = ',nstep write(iulog,*)'errh2osno = ',errh2osno(indexc) write(iulog,*)'snl = ',col%snl(indexc) @@ -834,7 +838,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice_col(indexc)*dtime write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq_col(indexc)*dtime write(iulog,*)'qflx_sl_top_soil = ',qflx_sl_top_soil(indexc)*dtime - write(iulog,*)'clm model is stopping' + write(iulog,*)'CTSM model is stopping' call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) end if @@ -906,7 +910,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'errsol = ',errsol(indexp) if (errsol_max_val > error_thresh) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (W/m2)' + write(iulog,*)'CTSM model stopping because errsol > ', error_thresh, ' W/m2' write(iulog,*)'fsa = ',fsa(indexp) write(iulog,*)'fsr = ',fsr(indexp) write(iulog,*)'forc_solad(1) = ',forc_solad(indexg,1) @@ -915,7 +919,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'forc_solai(2) = ',forc_solai(indexg,2) write(iulog,*)'forc_tot = ',forc_solad(indexg,1)+forc_solad(indexg,2) & +forc_solai(indexg,1)+forc_solai(indexg,2) - write(iulog,*)'clm model is stopping' + write(iulog,*)'CTSM model is stopping' call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) end if @@ -932,7 +936,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'nstep = ',nstep write(iulog,*)'errlon = ',errlon(indexp) if (errlon_max_val > error_thresh ) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (W/m2)' + write(iulog,*)'CTSM model stopping because errlon > ', error_thresh, ' W/m2' call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) end if end if @@ -952,7 +956,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'errseb = ' ,errseb(indexp) if ( errseb_max_val > error_thresh ) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (W/m2)' + write(iulog,*)'CTSM model stopping because errseb > ', error_thresh, ' W/m2' write(iulog,*)'sabv = ' ,sabv(indexp) write(iulog,*)'sabg = ' ,sabg(indexp), ((1._r8- frac_sno(indexc))*sabg_soil(indexp) + & frac_sno(indexc)*sabg_snow(indexp)),sabg_chk(indexp) @@ -968,7 +972,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'albd albi = ' ,albd(indexp,:), albi(indexp,:) write(iulog,*)'ftii ftdd ftid = ' ,ftii(indexp,:), ftdd(indexp,:),ftid(indexp,:) write(iulog,*)'elai esai = ' ,elai(indexp), esai(indexp) - write(iulog,*)'clm model is stopping' + write(iulog,*)'CTSM model is stopping' call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) end if @@ -985,7 +989,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'errsoi_col = ',errsoi_col(indexc) if ((errsoi_col_max_val > 1.e-4_r8) .and. (DAnstep > skip_steps)) then - write(iulog,*)'clm model is stopping' + write(iulog,*)'CTSM model is stopping' call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) end if end if From 677f422c98de1d4b5548df020a86ee13828d3e45 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 28 Jan 2021 16:47:30 -0800 Subject: [PATCH 1785/1973] add hgrid setting to lightning stream filename setting --- bld/namelist_files/namelist_defaults_ctsm.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 6d6704d8cc..e60930ba6e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1580,9 +1580,9 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 0001 0001 -atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc -atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc -atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc +atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc +atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc +atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc bilinear bilinear From 0fe37c06659cad163417b20a9391f586bbd01c98 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 29 Jan 2021 09:33:06 -0800 Subject: [PATCH 1786/1973] adding clarifying comments --- bld/namelist_files/namelist_definition_ctsm.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index ecc8fdef36..78c712e969 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -654,9 +654,10 @@ Switch deciding which nutrient model to use in FATES. Turn on spitfire module to simulate fire by setting fates_spitfire_mode > 0. Relevant only if use_fates = .true. Allowed values are: + 0 : Simulations of fire are off 1 : use a global constant lightning rate found in fates_params. 2 : use an external lightning dataset. - 3 : use an external confirmed ignitions dataset. + 3 : use an external confirmed ignitions dataset (not available through standard CSEM dataset collection). 4 : use external lightning and population datasets to simulate both natural and anthropogenic ignitions. @@ -679,7 +680,7 @@ Toggle to turn on the logging module (only relevant if FATES is being used). - Toggle to turn on cohort age tracking (only relevant if FATES is on). + Toggle to turn on cohort age tracking (only relevant if FATES is on, which only tracks patches by default). Date: Fri, 29 Jan 2021 09:41:54 -0800 Subject: [PATCH 1787/1973] strike out dated edison test --- cime_config/testdefs/testlist_clm.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index e2211d7b4a..dced442457 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1656,7 +1656,6 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - From bf52b8ae0843dd7f3f3a6262847ebb103cc32ec8 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 29 Jan 2021 12:49:05 -0700 Subject: [PATCH 1788/1973] Cleanup of comments, write-statmts, and formatting --- doc/ChangeLog | 14 ++++----- src/biogeophys/BalanceCheckMod.F90 | 50 +++++++++++++++++++----------- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index a9cbe04d1e..dfa751387f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,5 @@ =============================================================== -Tag name: ctsm5.1.dev020 +Tag name: ctsm5.1.dev0?? Originator(s): slevis (Samuel Levis,303-665-1310) Date: Wed Dec 23 11:29:33 MST 2020 One-line Summary: Grid cell-level error check for H2O @@ -26,13 +26,13 @@ Does this tag change answers significantly for any of the following physics conf [Put an [X] in the box for any configuration with significant answer changes.] -[X] clm5_1 +[ ] clm5_1 -[X] clm5_0 +[ ] clm5_0 -[X] ctsm5_0-nwp +[ ] ctsm5_0-nwp -[X] clm4_5 +[ ] clm4_5 Notes of particular relevance for users --------------------------------------- @@ -93,12 +93,12 @@ If the tag used for baseline comparisons was NOT the previous tag, note that her Answer changes -------------- -Changes answers relative to baseline: +Changes answers relative to baseline: YES Summarize any changes to answers, i.e., - what code configurations: ALL - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): + - nature of change: ROUNDOFF Specific example from running the single point test ERI_D_Ld9.1x1_camdenNJ.I2000Clm50BgcCruRs.cheyenne_intel.clm-default: RMS ERRH2O 6.0280E-21 NORMALIZED 7.6050E-06 diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 84f4bc9484..b36f23893a 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -257,6 +257,9 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & ! use_aquifer_layer is true, we effectively let the balance checks ! ensure that this term is zero when use_aquifer_layer is false, ! as it should be. + ! The _col term converted to _grc here gets determined in + ! BeginWaterColumnBalanceSingle in the previous time step after any + ! dynamic landuse adjustments. call c2g( bounds, & wa_reset_nonconservation_gain_col(begc:endc), & wa_reset_nonconservation_gain_grc(begg:endg), & @@ -335,20 +338,33 @@ subroutine BeginWaterColumnBalanceSingle(bounds, & !----------------------------------------------------------------------- associate( & - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) + zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) + zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) aquifer_water_baseline => waterstate_inst%aquifer_water_baseline, & ! Input: [real(r8)] baseline value for water in the unconfined aquifer (wa_col) for this bulk / tracer (mm) - wa => waterstate_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) + wa => waterstate_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) wa_reset_nonconservation_gain => waterbalance_inst%wa_reset_nonconservation_gain_col , & ! Output: [real(r8) (:) ] mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) begwb => waterbalance_inst%begwb_col , & ! Output: [real(r8) (:) ] water mass begining of the time step h2osno_old => waterbalance_inst%h2osno_old_col & ! Output: [real(r8) (:) ] snow water (mm H2O) at previous time step ) - ! wa(c) gets added to liquid_mass in ComputeLiqIceMassNonLake + ! wa(c) gets added to liquid_mass in ComputeLiqIceMassNonLake called here. ! wa_reset_nonconservation_gain is calculated for the grid cell-level ! water balance check and may be non-zero only when ! use_aquifer_layer is true. The grid cell-level balance check ensures ! that this term is zero when use_aquifer_layer is false, as it should be. + ! In particular, we adjust wa back to the baseline under certain + ! conditions. The right way to do this might be to use explicit fluxes from + ! some other state, but in this case we don't have a source to pull from, + ! so we adjust wa without explicit fluxes. Because we do this before + ! initializing the column-level balance check, the column-level check is + ! unaware of the adjustment. However, since this adjustment happens after + ! initializing the gridcell-level balance check, we have to account for + ! it in the gridcell-level balance check. The normal way to account for an + ! adjustment like this would be to include the flux in the balance check. + ! Here we don't have an explicit flux, so instead we track the + ! non-conservation state. In principle, we could calculate an explicit flux + ! and use that, but we don't gain anything from using an explicit flux in + ! this case. if(use_aquifer_layer) then do fc = 1, num_nolakec c = filter_nolakec(fc) @@ -614,7 +630,7 @@ subroutine BalanceCheck( bounds, & ' errh2o= ',errh2o_col(indexc) if ((errh2o_max_val > error_thresh) .and. (DAnstep > skip_steps)) then - write(iulog,*)'CTSM model stopping because errh2o > ', error_thresh, ' mm' + write(iulog,*)'CTSM is stopping because errh2o > ', error_thresh, ' mm' write(iulog,*)'nstep = ',nstep write(iulog,*)'errh2o_col = ',errh2o_col(indexc) write(iulog,*)'forc_rain = ',forc_rain_col(indexc)*dtime @@ -643,7 +659,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'qflx_glcice_dyn_water_flux = ', qflx_glcice_dyn_water_flux_col(indexc)*dtime end if - write(iulog,*)'CTSM model is stopping' + write(iulog,*)'CTSM is stopping' call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) end if @@ -713,7 +729,7 @@ subroutine BalanceCheck( bounds, & if (errh2o_max_val > error_thresh .and. DAnstep > skip_steps .and. & .not. get_for_testing_zero_dynbal_fluxes()) then - write(iulog,*)'CTSM model stopping because errh2o > ', error_thresh, ' mm' + write(iulog,*)'CTSM is stopping because errh2o > ', error_thresh, ' mm' write(iulog,*)'nstep = ',nstep write(iulog,*)'errh2o_grc = ',errh2o_grc(indexg) write(iulog,*)'forc_rain = ',forc_rain_grc(indexg)*dtime @@ -735,15 +751,13 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'forc_flood = ',forc_flood_grc(indexg)*dtime write(iulog,*)'qflx_glcice_dyn_water_flux = ',qflx_glcice_dyn_water_flux_grc(indexg)*dtime - write(iulog,*)'CTSM model is stopping' + write(iulog,*)'CTSM is stopping' call endrun(decomp_index=indexg, clmlevel=nameg, msg=errmsg(sourcefile, __LINE__)) end if end if ! Snow balance check at the column level. - ! Beginning snow balance variable h2osno_old is calculated once - ! for both the column-level and grid cell-level balance checks. call waterstate_inst%CalculateTotalH2osno(bounds, num_allc, filter_allc, & caller = 'BalanceCheck', & @@ -815,7 +829,7 @@ subroutine BalanceCheck( bounds, & ' errh2osno= ',errh2osno(indexc) if ((errh2osno_max_val > error_thresh) .and. (DAnstep > skip_steps) ) then - write(iulog,*)'CTSM model stopping because errh2osno > ', error_thresh, ' mm' + write(iulog,*)'CTSM is stopping because errh2osno > ', error_thresh, ' mm' write(iulog,*)'nstep = ',nstep write(iulog,*)'errh2osno = ',errh2osno(indexc) write(iulog,*)'snl = ',col%snl(indexc) @@ -838,7 +852,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice_col(indexc)*dtime write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq_col(indexc)*dtime write(iulog,*)'qflx_sl_top_soil = ',qflx_sl_top_soil(indexc)*dtime - write(iulog,*)'CTSM model is stopping' + write(iulog,*)'CTSM is stopping' call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) end if @@ -910,7 +924,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'errsol = ',errsol(indexp) if (errsol_max_val > error_thresh) then - write(iulog,*)'CTSM model stopping because errsol > ', error_thresh, ' W/m2' + write(iulog,*)'CTSM is stopping because errsol > ', error_thresh, ' W/m2' write(iulog,*)'fsa = ',fsa(indexp) write(iulog,*)'fsr = ',fsr(indexp) write(iulog,*)'forc_solad(1) = ',forc_solad(indexg,1) @@ -919,7 +933,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'forc_solai(2) = ',forc_solai(indexg,2) write(iulog,*)'forc_tot = ',forc_solad(indexg,1)+forc_solad(indexg,2) & +forc_solai(indexg,1)+forc_solai(indexg,2) - write(iulog,*)'CTSM model is stopping' + write(iulog,*)'CTSM is stopping' call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) end if @@ -936,7 +950,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'nstep = ',nstep write(iulog,*)'errlon = ',errlon(indexp) if (errlon_max_val > error_thresh ) then - write(iulog,*)'CTSM model stopping because errlon > ', error_thresh, ' W/m2' + write(iulog,*)'CTSM is stopping because errlon > ', error_thresh, ' W/m2' call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) end if end if @@ -956,7 +970,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'errseb = ' ,errseb(indexp) if ( errseb_max_val > error_thresh ) then - write(iulog,*)'CTSM model stopping because errseb > ', error_thresh, ' W/m2' + write(iulog,*)'CTSM is stopping because errseb > ', error_thresh, ' W/m2' write(iulog,*)'sabv = ' ,sabv(indexp) write(iulog,*)'sabg = ' ,sabg(indexp), ((1._r8- frac_sno(indexc))*sabg_soil(indexp) + & frac_sno(indexc)*sabg_snow(indexp)),sabg_chk(indexp) @@ -972,7 +986,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'albd albi = ' ,albd(indexp,:), albi(indexp,:) write(iulog,*)'ftii ftdd ftid = ' ,ftii(indexp,:), ftdd(indexp,:),ftid(indexp,:) write(iulog,*)'elai esai = ' ,elai(indexp), esai(indexp) - write(iulog,*)'CTSM model is stopping' + write(iulog,*)'CTSM is stopping' call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) end if @@ -989,7 +1003,7 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'errsoi_col = ',errsoi_col(indexc) if ((errsoi_col_max_val > 1.e-4_r8) .and. (DAnstep > skip_steps)) then - write(iulog,*)'CTSM model is stopping' + write(iulog,*)'CTSM is stopping' call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) end if end if From 5dbbc81bbf4ab78dd671ad865266085a06ac30bf Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 29 Jan 2021 15:02:28 -0700 Subject: [PATCH 1789/1973] Revisions 4b: Move code from the beg. to the ending of h2o balance check --- src/biogeophys/BalanceCheckMod.F90 | 59 ++++++++++++++---------------- src/main/clm_driver.F90 | 6 +-- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index b36f23893a..c1b672975a 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -126,8 +126,7 @@ end function GetBalanceCheckSkipSteps !----------------------------------------------------------------------- subroutine BeginWaterGridcellBalance(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, lakestate_inst, & - use_aquifer_layer) + water_inst, lakestate_inst) ! ! !DESCRIPTION: ! Initialize grid cell-level water balance at beginning of time step @@ -141,7 +140,6 @@ subroutine BeginWaterGridcellBalance(bounds, & integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(water_type) , intent(inout) :: water_inst type(lakestate_type) , intent(in) :: lakestate_inst - logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: integer :: i @@ -157,8 +155,7 @@ subroutine BeginWaterGridcellBalance(bounds, & water_inst%bulk_and_tracers(i)%waterstate_inst, & water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & water_inst%bulk_and_tracers(i)%waterbalance_inst, & - water_inst%bulk_and_tracers(i)%waterflux_inst, & - use_aquifer_layer = use_aquifer_layer) + water_inst%bulk_and_tracers(i)%waterflux_inst) end do end subroutine BeginWaterGridcellBalance @@ -208,8 +205,7 @@ end subroutine BeginWaterColumnBalance subroutine BeginWaterGridcellBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & lakestate_inst, waterstate_inst, & - waterdiagnostic_inst, waterbalance_inst, waterflux_inst, & - use_aquifer_layer) + waterdiagnostic_inst, waterbalance_inst, waterflux_inst) ! ! !DESCRIPTION: ! Initialize grid cell-level water balance at beginning of time step @@ -229,18 +225,15 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & class(waterflux_type) , intent(inout) :: waterflux_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst class(waterbalance_type) , intent(inout) :: waterbalance_inst - logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: integer :: g ! indices integer :: begc, endc, begg, endg ! bounds real(r8) :: qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at beginning of time step real(r8) :: qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc ice dynamic land cover change conversion runoff flux at beginning of time step - real(r8) :: wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg) ! grc mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) !----------------------------------------------------------------------- associate( & - wa_reset_nonconservation_gain_col => waterbalance_inst%wa_reset_nonconservation_gain_col , & ! Output: [real(r8) (:) ] col mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) begwb_col => waterbalance_inst%begwb_col, & ! Output: [real(r8) (:) ] column-level water mass begining of the time step begwb_grc => waterbalance_inst%begwb_grc & ! Output: [real(r8) (:) ] grid cell-level water mass begining of the time step ) @@ -250,24 +243,6 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & begg = bounds%begg endg = bounds%endg - if (use_aquifer_layer) then - ! wa_reset_nonconservation_gain may be non-zero only when - ! use_aquifer_layer is true. We do this c2g call only when needed - ! to avoid unnecessary calculations; by adding this term only when - ! use_aquifer_layer is true, we effectively let the balance checks - ! ensure that this term is zero when use_aquifer_layer is false, - ! as it should be. - ! The _col term converted to _grc here gets determined in - ! BeginWaterColumnBalanceSingle in the previous time step after any - ! dynamic landuse adjustments. - call c2g( bounds, & - wa_reset_nonconservation_gain_col(begc:endc), & - wa_reset_nonconservation_gain_grc(begg:endg), & - c2l_scale_type='urbanf', l2g_scale_type='unity' ) - else - wa_reset_nonconservation_gain_grc(begg:endg) = 0._r8 - end if - ! NOTES subroutines Compute*Mass* are in TotalWaterAndHeatMod.F90 ! endwb is calculated in HydrologyDrainageMod & LakeHydrologyMod call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & @@ -301,8 +276,7 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & ! energy dribblers is counter-intuitive. do g = begg, endg begwb_grc(g) = begwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - - qflx_ice_dynbal_left_to_dribble(g) & - - wa_reset_nonconservation_gain_grc(g) + - qflx_ice_dynbal_left_to_dribble(g) end do end associate @@ -406,7 +380,8 @@ subroutine BalanceCheck( bounds, & num_allc, filter_allc, & atm2lnd_inst, solarabs_inst, waterflux_inst, waterstate_inst, & waterdiagnosticbulk_inst, waterbalance_inst, wateratm2lnd_inst, & - waterlnd2atm_inst, surfalb_inst, energyflux_inst, canopystate_inst) + waterlnd2atm_inst, surfalb_inst, energyflux_inst, canopystate_inst, & + use_aquifer_layer) ! ! !DESCRIPTION: ! This subroutine accumulates the numerical truncation errors of the water @@ -445,6 +420,7 @@ subroutine BalanceCheck( bounds, & type(surfalb_type) , intent(in) :: surfalb_inst type(energyflux_type) , intent(inout) :: energyflux_inst type(canopystate_type), intent(inout) :: canopystate_inst + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: integer :: p,c,l,g,fc ! indices @@ -461,6 +437,7 @@ subroutine BalanceCheck( bounds, & real(r8) :: qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg) ! grid cell-level excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] real(r8) :: qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at end of time step real(r8) :: qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at end of time step + real(r8) :: wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg) ! grc mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) real(r8) :: errh2o_max_val ! Maximum value of error in water conservation error over all columns [mm H2O] real(r8) :: errh2osno_max_val ! Maximum value of error in h2osno conservation error over all columns [kg m-2] @@ -513,6 +490,7 @@ subroutine BalanceCheck( bounds, & qflx_h2osfc_to_ice => waterflux_inst%qflx_h2osfc_to_ice_col , & ! Input: [real(r8) (:) ] conversion of h2osfc to ice qflx_drain_perched_col => waterflux_inst%qflx_drain_perched_col , & ! Input: [real(r8) (:) ] column level sub-surface runoff (mm H2O /s) qflx_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:)] grid cell-level sub-surface runoff (mm H2O /s) + wa_reset_nonconservation_gain_col => waterbalance_inst%wa_reset_nonconservation_gain_col, & ! Output: [real(r8) (:) ] col mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) qflx_flood_col => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] column level total runoff due to flooding forc_flood_grc => wateratm2lnd_inst%forc_flood_grc , & ! Input: [real(r8) (:) ] grid cell-level total grid cell-level runoff from river model qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Input: [real(r8) (:) ] drainage from snow pack @@ -680,6 +658,22 @@ subroutine BalanceCheck( bounds, & qflx_snwcp_discarded_ice_col(bounds%begc:bounds%endc), & qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) + if (use_aquifer_layer) then + ! wa_reset_nonconservation_gain may be non-zero only when + ! use_aquifer_layer is true. We do this c2g call only when needed + ! to avoid unnecessary calculations; by adding this term only when + ! use_aquifer_layer is true, we effectively let the balance checks + ! ensure that this term is zero when use_aquifer_layer is false, + ! as it should be. + ! The _col term was determined in BeginWaterColumnBalanceSingle + ! after any dynamic landuse adjustments. + call c2g( bounds, & + wa_reset_nonconservation_gain_col(bounds%begc:bounds%endc), & + wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg), & + c2l_scale_type='urbanf', l2g_scale_type='unity' ) + else + wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg) = 0._r8 + end if call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_end( & bounds, & @@ -699,7 +693,8 @@ subroutine BalanceCheck( bounds, & ! energy dribblers is counter-intuitive. do g = bounds%begg, bounds%endg endwb_grc(g) = endwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - - qflx_ice_dynbal_left_to_dribble(g) + - qflx_ice_dynbal_left_to_dribble(g) & + - wa_reset_nonconservation_gain_grc(g) errh2o_grc(g) = endwb_grc(g) - begwb_grc(g) & - (forc_rain_grc(g) & diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 7504ae1c28..4f88a5ef90 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -330,8 +330,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call BeginWaterGridcellBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & - water_inst, lakestate_inst, & - use_aquifer_layer = use_aquifer_layer()) + water_inst, lakestate_inst) call t_stopf('begwbal') end do !$OMP END PARALLEL DO @@ -1271,7 +1270,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro atm2lnd_inst, solarabs_inst, water_inst%waterfluxbulk_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & water_inst%waterbalancebulk_inst, water_inst%wateratm2lndbulk_inst, & - water_inst%waterlnd2atmbulk_inst, surfalb_inst, energyflux_inst, canopystate_inst) + water_inst%waterlnd2atmbulk_inst, surfalb_inst, energyflux_inst, & + canopystate_inst, use_aquifer_layer = use_aquifer_layer()) end do !$OMP END PARALLEL DO call t_stopf('balchk') From b1a6080a90fa50cc5d9f78efcf2fccc221744cb3 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 29 Jan 2021 14:50:35 -0800 Subject: [PATCH 1790/1973] updating changelog notes --- doc/ChangeLog | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index e84357bdb7..0affa035d0 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -32,34 +32,25 @@ Does this tag change answers significantly for any of the following physics conf [X] clm4_5 -Bugs fixed or introduced ------------------------- -[Remove any lines that don't apply. Remove entire section if nothing applies.] - -Issues fixed (include CTSM Issue #): none - -CIME Issues fixed (include issue #): none - -Known bugs introduced in this tag (include issue #): none - -Known bugs found since the previous tag (include issue #): none - - Notes of particular relevance for users --------------------------------------- -[Remove any lines that don't apply. Remove entire section if nothing applies.] Caveats for users (e.g., need to interpolate initial conditions): none Changes to CTSM's user interface (e.g., new/renamed XML or namelist -variables): none +variables): + -Changes made to namelist defaults (e.g., changed parameter values): none +Changes made to namelist defaults (e.g., changed parameter values): + - fates_spitfire_mode updated with multiple modes that use external datasets + - use_fates_cohort_age_tracking added to enable size and age dependent mortality + - fates_parteh_mode option 2 added for fates CNP mode -Changes to the datasets (e.g., parameter, surface or initial files): none +Changes to the datasets (e.g., parameter, surface or initial files): + fates_paramfile updated to fates_params_api.14.0.0_12pft_c200921.nc Substantial timing or memory changes: - Only the fates testmod FatesAllVars failed the MEMCOMP test + Only the fates testmod FatesAllVars failed the MEMCOMP test due to the increase in the number of variables included Notes of particular relevance for developers: @@ -69,7 +60,11 @@ NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the Caveats for developers (e.g., code that is duplicated that requires double maintenance): none -Changes to tests or testing: none +Changes to tests or testing: + - Added FatesPRT2 testmod test which activates fates CNP mode + - Added FatesReducedComplexFixedBiogeo testmod which activates fates fixed biogeography mode + - Added FatesSizeAgeMort testmod which activates tracking of size and age dependent mortality in fates + - Added Fates_nat_and_anthro_ignitions testmod to activate use of external lightning and population datasets Testing summary: From 62439ab2505377a72bccb4bd7e7b15c75ec619ed Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 29 Jan 2021 15:58:47 -0800 Subject: [PATCH 1791/1973] adding comments to all fates testmods --- cime_config/testdefs/testlist_clm.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index dced442457..62e78bac29 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -2135,6 +2135,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2143,6 +2144,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2153,6 +2155,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2163,6 +2166,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2173,6 +2177,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2183,6 +2188,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2192,6 +2198,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2202,6 +2209,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2211,6 +2219,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2221,6 +2230,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2230,6 +2240,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2240,6 +2251,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2249,6 +2261,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2259,6 +2272,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2267,6 +2281,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2277,6 +2292,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2285,6 +2301,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2295,6 +2312,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2314,6 +2332,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + @@ -2322,6 +2341,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + From 0a563fbc5d456139fe3ab92093003300e3eb85d8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 31 Jan 2021 00:00:23 -0700 Subject: [PATCH 1792/1973] Remove most of the notes about FATES being experimental, make the note about fates options only being relevant for FATES be consistent between options --- .../namelist_definition_ctsm.xml | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index b65a93c12c..2c2bcdc5a4 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -641,68 +641,74 @@ baseline proportion of nitrogen allocated for electron transport (J) Toggle to turn on the FATES model -(use_fates= '.true.' is EXPERIMENTAL NOT SUPPORTED!) +Functionally Assembled Terrestrial Ecosystem Simulator (FATES) Switch deciding which nutrient model to use in FATES. +(Only relevant if FATES is on) Turn on spitfire module to simulate fire by setting fates_spitfire_mode > 0. -Relevant only if use_fates = .true. Allowed values are: 1 : use a global constant lightning rate found in fates_params. 2 : use an external lightning dataset. 3 : use an external confirmed ignitions dataset. 4 : use external lightning and population datasets to simulate both natural and anthropogenic ignitions. +(Only relevant if FATES is on) -Toggle to turn on fixed biogeography mode (only relevant if FATES is being used). +Toggle to turn on fixed biogeography mode +(Only relevant if FATES is on) -Toggle to turn on the logging module (only relevant if FATES is being used). +Toggle to turn on the logging module +(Only relevant if FATES is on) - Toggle to turn on plant hydraulics (only relevant if FATES is on). - (use_fates_planthydro=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) +Toggle to turn on plant hydraulics +(Only relevant if FATES is on) - Toggle to turn on cohort age tracking (only relevant if FATES is on). +Toggle to turn on cohort age tracking +(Only relevant if FATES is on). Toggle to turn on Static Stand Structure Mode (only relevant if FATES is being used). -(use_fates_ed_st3=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) +(Only relevant if FATES is on). -Toggle to turn on prescribed physiology (only relevant if FATES is being used). +Toggle to turn on prescribed physiology +(Only relevant if FATES is on). -Toggle to turn on inventory initialization to startup FATES (only relevant if FATES is being used). -(use_fates_inventory_init=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) +Toggle to turn on inventory initialization to startup FATES +(Only relevant if FATES is on). Full pathname to the inventory initialization control file. (Required, if use_fates_inventory_init=T) +(Only relevant if FATES is on). Full pathname datafile with fates parameters +(Only relevant if FATES is on). Date: Mon, 1 Feb 2021 00:05:28 -0700 Subject: [PATCH 1793/1973] Set light_res default according to some a few attributes rather than nothing which allows fates namelist tests to work, also add clm5_1 physics default for fates light_res, and remote the fail test for fates and transient --- bld/CLMBuildNamelist.pm | 6 +++++- bld/namelist_files/namelist_defaults_ctsm.xml | 1 + bld/unit_testers/build-namelist_test.pl | 7 +------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 198ea749f3..5d91212bf1 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -908,7 +908,11 @@ sub setup_cmdl_fire_light_res { my $var = "light_res"; my $val = $opts->{$var}; if ( $val eq "default" ) { - $nl_flags->{$var} = remove_leading_and_trailing_quotes($defaults->get_value($var)); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, + 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, + 'use_fates'=>$nl_flags->{'use_fates'}, fire_method=>$nl->get_value('fire_method') ); + $val = remove_leading_and_trailing_quotes( $nl->get_value($var) ); + $nl_flags->{$var} = $val; } else { my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); if ( defined($fire_method) && $val ne "none" ) { diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index e60930ba6e..2fce00a22a 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1574,6 +1574,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 360x720 360x720 360x720 +360x720 0001 0001 diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 5c7a775d72..49b9b9a591 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,7 +138,7 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 1550; +my $ntests = 1549; if ( defined($opts{'compare'}) ) { $ntests += 1044; } @@ -847,11 +847,6 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, - "useFATESWTransient" =>{ options=>"-bgc fates -use_case 20thC_transient -envxml_dir . -no-megan -res 10x15", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - phys=>"clm5_0", - }, "usespitfireButNOTFATES" =>{ options=>"-envxml_dir . -no-megan", namelst=>"fates_spitfire_mode>0", GLC_TWO_WAY_COUPLING=>"FALSE", From 08b1f8781a3dd3442e52e4719b840ae2559498b9 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 1 Feb 2021 10:39:09 -0800 Subject: [PATCH 1794/1973] create FATES version of fire factory --- src/biogeochem/CNFireFactoryMod.F90 | 51 ----------------------------- src/main/clm_driver.F90 | 2 +- src/main/clm_initializeMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 6 ++-- 4 files changed, 5 insertions(+), 56 deletions(-) diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 index 87616d5280..dbd9b70d15 100644 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ b/src/biogeochem/CNFireFactoryMod.F90 @@ -17,18 +17,6 @@ module CNFireFactoryMod ! !PUBLIC ROUTINES: public :: CNFireReadNML ! read the fire namelist public :: create_cnfire_method ! create an object of class fire_method_type - public :: create_fates_fire_data_method ! create an object of class fates_fire_base_type - - ! These parameters set the ranges of the cases in subroutine - ! create_fates_fire_data_method. We declare them public in order to - ! use them as flags elsewhere in the CTSM and FATES-SPITFIRE. - ! They correspond one-to-one to the fates_spitfire_mode options listed - ! in bld/namelist_files/namelist_definition_clm4_5.xml - integer, public, parameter :: no_fire = 0 ! value of no_fire mode - integer, public, parameter :: scalar_lightning = 1 ! value of scalar_lightning mode - integer, public, parameter :: lightning_from_data = 2 ! value of lightning_from_data mode - integer, public, parameter :: successful_ignitions = 3 ! value of successful_ignitions mode - integer, public, parameter :: anthro_ignitions = 4 ! value of anthro_ignitions mode ! !PRIVATE DATA MEMBERS: character(len=80), private :: fire_method = "li2014qianfrc" @@ -138,43 +126,4 @@ subroutine create_cnfire_method( NLFilename, cnfire_method ) end subroutine create_cnfire_method !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine create_fates_fire_data_method( fates_fire_data_method ) - ! - ! !DESCRIPTION: - ! Create and return an object of fates_fire_data_method_type. - ! The particular type is determined based on a namelist parameter. - ! - ! !USES: - use clm_varctl, only: fates_spitfire_mode - use FATESFireBase, only: fates_fire_base_type - use FATESFireNoDataMod, only: fates_fire_no_data_type - use FATESFireDataMod, only: fates_fire_data_type - ! - ! !ARGUMENTS: - class(fates_fire_base_type), allocatable, intent(inout) :: fates_fire_data_method ! function result - ! - ! !LOCAL VARIABLES: - integer :: current_case - - character(len=*), parameter :: subname = 'create_fates_fire_data_method' - !----------------------------------------------------------------------- - - current_case = fates_spitfire_mode - - select case (current_case) - - case (no_fire:scalar_lightning) - allocate(fates_fire_no_data_type :: fates_fire_data_method) - case (lightning_from_data:anthro_ignitions) - allocate(fates_fire_data_type :: fates_fire_data_method) - - case default - write(iulog,*) subname//' ERROR: unknown method: ', fates_spitfire_mode - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end select - - end subroutine create_fates_fire_data_method - end module CNFireFactoryMod diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index b65a260bc2..400aa65f56 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -113,7 +113,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro use clm_time_manager , only : get_curr_date use clm_varctl , only : use_lai_streams, fates_spitfire_mode use SatellitePhenologyMod, only : lai_advance - use CNFireFactoryMod , only : scalar_lightning + use FATESFireFactoryMod , only : scalar_lightning ! ! !ARGUMENTS: implicit none diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index fb54ee2ffc..648e252f5c 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -317,7 +317,7 @@ subroutine initialize2( ) use controlMod , only : NLFilename use clm_instMod , only : clm_fates use BalanceCheckMod , only : BalanceCheckInit - use CNFireFactoryMod , only : scalar_lightning + use FATESFireFactoryMod , only : scalar_lightning ! ! !ARGUMENTS ! diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index d0609b85e2..836668511f 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -142,7 +142,7 @@ module CLMFatesInterfaceMod use FatesPlantHydraulicsMod, only : InitHydrSites use FatesPlantHydraulicsMod, only : RestartHydrStates use FATESFireBase , only : fates_fire_base_type - use CNFireFactoryMod , only : no_fire, scalar_lightning, & + use FATESFireFactoryMod , only : no_fire, scalar_lightning, & successful_ignitions, anthro_ignitions use dynSubgridControlMod , only : get_do_harvest use dynHarvestMod , only : num_harvest_inst, harvest_varnames @@ -460,7 +460,7 @@ subroutine init(this, bounds_proc ) use FatesParameterDerivedMod, only : param_derived use subgridMod, only : natveg_patch_exists use clm_instur , only : wt_nat_patch - use CNFireFactoryMod , only: create_fates_fire_data_method + use FATESFireFactoryMod , only: create_fates_fire_data_method implicit none @@ -717,7 +717,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! to process array bounding information ! !USES - use CNFireFactoryMod, only: scalar_lightning + use FATESFireFactoryMod, only: scalar_lightning ! !ARGUMENTS: implicit none From deb57e02b75fc491c31346c60503ade1988f41f2 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 1 Feb 2021 11:33:01 -0800 Subject: [PATCH 1795/1973] adding FATESFireFactoryMod --- src/biogeochem/FATESFireFactoryMod.F90 | 75 ++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/biogeochem/FATESFireFactoryMod.F90 diff --git a/src/biogeochem/FATESFireFactoryMod.F90 b/src/biogeochem/FATESFireFactoryMod.F90 new file mode 100644 index 0000000000..2bbc300e7d --- /dev/null +++ b/src/biogeochem/FATESFireFactoryMod.F90 @@ -0,0 +1,75 @@ +module FATESFireFactoryMod + + !--------------------------------------------------------------------------- + ! !DESCRIPTION: + ! Factory to create an instance of fire_method_type. This module figures + ! out the particular type to return. + ! + ! !USES: + use abortutils , only : endrun + use shr_log_mod , only : errMsg => shr_log_errMsg + use clm_varctl , only : iulog + + implicit none + save + private + ! + ! !PUBLIC ROUTINES: + public :: create_fates_fire_data_method ! create an object of class fates_fire_base_type + + ! These parameters set the ranges of the cases in subroutine + ! create_fates_fire_data_method. We declare them public in order to + ! use them as flags elsewhere in the CTSM and FATES-SPITFIRE. + ! They correspond one-to-one to the fates_spitfire_mode options listed + ! in bld/namelist_files/namelist_definition_clm4_5.xml + integer, public, parameter :: no_fire = 0 ! value of no_fire mode + integer, public, parameter :: scalar_lightning = 1 ! value of scalar_lightning mode + integer, public, parameter :: lightning_from_data = 2 ! value of lightning_from_data mode + integer, public, parameter :: successful_ignitions = 3 ! value of successful_ignitions mode + integer, public, parameter :: anthro_ignitions = 4 ! value of anthro_ignitions mode + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + +contains + + !----------------------------------------------------------------------- + subroutine create_fates_fire_data_method( fates_fire_data_method ) + ! + ! !DESCRIPTION: + ! Create and return an object of fates_fire_data_method_type. + ! The particular type is determined based on a namelist parameter. + ! + ! !USES: + use clm_varctl, only: fates_spitfire_mode + use FATESFireBase, only: fates_fire_base_type + use FATESFireNoDataMod, only: fates_fire_no_data_type + use FATESFireDataMod, only: fates_fire_data_type + ! + ! !ARGUMENTS: + class(fates_fire_base_type), allocatable, intent(inout) :: fates_fire_data_method ! function result + ! + ! !LOCAL VARIABLES: + integer :: current_case + + character(len=*), parameter :: subname = 'create_fates_fire_data_method' + !----------------------------------------------------------------------- + + current_case = fates_spitfire_mode + + select case (current_case) + + case (no_fire:scalar_lightning) + allocate(fates_fire_no_data_type :: fates_fire_data_method) + case (lightning_from_data:anthro_ignitions) + allocate(fates_fire_data_type :: fates_fire_data_method) + + case default + write(iulog,*) subname//' ERROR: unknown method: ', fates_spitfire_mode + call endrun(msg=errMsg(sourcefile, __LINE__)) + + end select + + end subroutine create_fates_fire_data_method + +end module CNFireFactoryMod From b8abb886416dab11f314201727462aa93ef06e8b Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 1 Feb 2021 11:46:58 -0800 Subject: [PATCH 1796/1973] fixing missing end module name --- src/biogeochem/FATESFireFactoryMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/FATESFireFactoryMod.F90 b/src/biogeochem/FATESFireFactoryMod.F90 index 2bbc300e7d..4e8ea8681f 100644 --- a/src/biogeochem/FATESFireFactoryMod.F90 +++ b/src/biogeochem/FATESFireFactoryMod.F90 @@ -72,4 +72,4 @@ subroutine create_fates_fire_data_method( fates_fire_data_method ) end subroutine create_fates_fire_data_method -end module CNFireFactoryMod +end module FATESFireFactoryMod From c8b2339533f41385e678ecabe021d899dd21ab24 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 1 Feb 2021 16:55:30 -0700 Subject: [PATCH 1797/1973] removing old call to fire_method = spitfire in ignitions testmod --- .../testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm | 1 - 1 file changed, 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm index 77d3a7179f..7915bb63eb 100644 --- a/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/Fates_nat_and_anthro_ignitions/user_nl_clm @@ -1,4 +1,3 @@ -fire_method = 'spitfire' fates_spitfire_mode = 4 hist_nhtfrq = 0 hist_mfilt = 1 From 9f0916bbb6798ad41b515c9aab7726f6e26d1f4d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 2 Feb 2021 23:07:21 -0700 Subject: [PATCH 1798/1973] Set T62 lightning dataset for fates as well, set light_res for fates spitfire settings that don't need it to 'none' when light_res is none do not set any of the lighting settings, remove use_cn setting for lightning as not needed --- bld/CLMBuildNamelist.pm | 13 +++++++------ bld/namelist_files/namelist_defaults_ctsm.xml | 10 +++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 5d91212bf1..83128f7357 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -910,6 +910,7 @@ sub setup_cmdl_fire_light_res { if ( $val eq "default" ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, + 'fates_spitfire_mode'=>$nl->get_value('fates_spitfire_mode'), 'use_fates'=>$nl_flags->{'use_fates'}, fire_method=>$nl->get_value('fire_method') ); $val = remove_leading_and_trailing_quotes( $nl->get_value($var) ); $nl_flags->{$var} = $val; @@ -3373,14 +3374,14 @@ sub setup_logic_lightning_streams { # lightning streams require CN/BGC my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - if ( &value_is_true($nl_flags->{'cnfireson'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, + if ( $nl_flags->{'light_res'} ne "none" ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'hgrid'=>$nl_flags->{'res'}, 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); # Set align year, if first and last years are different @@ -3389,7 +3390,7 @@ sub setup_logic_lightning_streams { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_lightng', 'sim_year'=>$nl_flags->{'sim_year'}, 'sim_year_range'=>$nl_flags->{'sim_year_range'}); } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lightng', 'hgrid'=>$nl_flags->{'light_res'} ); } else { # If bgc is NOT CN/CNDV then make sure none of the Lightng settings are set @@ -3398,7 +3399,7 @@ sub setup_logic_lightning_streams { defined($nl->get_value('model_year_align_lightng')) || defined($nl->get_value('lightng_tintalgo' )) || defined($nl->get_value('stream_fldfilename_lightng')) ) { - $log->fatal_error("When bgc is SP (NOT CN or BGC) or fire_method==nofire none of: stream_year_first_lightng,\n" . + $log->fatal_error("When bgc is SP (NOT CN or BGC or FATES) or fire is turned off none of: stream_year_first_lightng,\n" . "stream_year_last_lightng, model_year_align_lightng, lightng_tintalgo nor\n" . "stream_fldfilename_lightng can be set!"); } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 2fce00a22a..b0367fab04 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1572,9 +1572,12 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 94x192 94x192 360x720 -360x720 -360x720 -360x720 +none +none +none +360x720 +360x720 +360x720 0001 0001 @@ -1583,6 +1586,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc +atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc bilinear From 2f27c6852e22a53a98450f49db3cd328d001543f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 3 Feb 2021 11:51:59 -0700 Subject: [PATCH 1799/1973] Remove the use_cn and use_fates settings for lightning variables so don't have to have a different copy for each --- bld/namelist_files/namelist_defaults_ctsm.xml | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index b0367fab04..aea9c07e75 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -1579,26 +1579,21 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts 360x720 360x720 -0001 -0001 -0001 -0001 - -atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc -atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc -atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc -atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc - -bilinear -bilinear - -nn -nn -nn -nn -nn -nn -nn +0001 +0001 + +atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc +atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc + +bilinear + +nn +nn +nn +nn +nn +nn +nn 2015 From 089eb798dd8d65e3d89e75cf8bacbf7b49ef763c Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 4 Feb 2021 09:40:00 -0800 Subject: [PATCH 1800/1973] updating changelog template --- doc/.ChangeLog_template | 5 +++++ doc/ChangeLog | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 1150edaa03..11c30a596d 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -26,6 +26,8 @@ Does this tag change answers significantly for any of the following physics conf [ ] clm4_5 +[ ] fates + Bugs fixed or introduced ------------------------ @@ -119,6 +121,9 @@ infrastructure should be run when appropriate, as described below. cheyenne ---- izumi ------- + + fates tests: + cheyenne ---- any other testing (give details below): diff --git a/doc/ChangeLog b/doc/ChangeLog index 0affa035d0..fe40c4c3cb 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -25,12 +25,13 @@ Does this tag change answers significantly for any of the following physics conf [ ] clm5_1 -[X] clm5_0 +[ ] clm5_0 [ ] ctsm5_0-nwp -[X] clm4_5 +[ ] clm4_5 +[X] fates Notes of particular relevance for users --------------------------------------- @@ -40,7 +41,6 @@ Caveats for users (e.g., need to interpolate initial conditions): none Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - Changes made to namelist defaults (e.g., changed parameter values): - fates_spitfire_mode updated with multiple modes that use external datasets - use_fates_cohort_age_tracking added to enable size and age dependent mortality @@ -75,20 +75,20 @@ Testing summary: regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): cheyenne ---- PASS (except for fates DIFFs) - izumi ------- N/A + izumi ------- OK ok: All non-fates testmods PASS. Fates testmods have DIFF as expected due to update of fates tag. - any other testing (give details below): - - fates suite: + fates tests: cheyenne ---- OK ok: expected failures on COMPARE_base_rest for FatesHydro and Fates_nat_and_anthro_ignitions. All else B4B. fates baseline: fates-sci.1.43.2_api.14.2.0-ctsm5.1.dev020-C5f348cac-F5534a940 + + any other testing (give details below): If the tag used for baseline comparisons was NOT the previous tag, note that here: From 0643ad45f8f46879c632f67c326ec75a1fecb0a4 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 4 Feb 2021 13:59:55 -0700 Subject: [PATCH 1801/1973] Remove all non-debug nag tests There is a compiler error with nag when building in non-debug mode with the latest FATES code. The non-debug nag tests don't seem to have much value, so I'm removing them - either changing them to debug tests or removing them entirely, depending on whether a given configuration seems to have sufficient test coverage. --- cime_config/testdefs/testlist_clm.xml | 33 ++++----------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 62e78bac29..95db622a9c 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -659,7 +659,7 @@ - + @@ -695,7 +695,7 @@ - + @@ -703,7 +703,7 @@ - + @@ -711,23 +711,7 @@ - - - - - - - - - - - - - - - - - + @@ -1236,14 +1220,6 @@ - - - - - - - - @@ -1680,7 +1656,6 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - From 5567b1f6e40cce16f5b2e5dbc668c3a00f064419 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 4 Feb 2021 16:12:47 -0700 Subject: [PATCH 1802/1973] Fix non-standard hexadecimal constant Resolves ESCOMP/CTSM#1270 --- src/biogeochem/FireEmisFactorsMod.F90 | 2 +- src/biogeochem/MEGANFactorsMod.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/FireEmisFactorsMod.F90 b/src/biogeochem/FireEmisFactorsMod.F90 index 7aef11ffc3..e97082c0b8 100644 --- a/src/biogeochem/FireEmisFactorsMod.F90 +++ b/src/biogeochem/FireEmisFactorsMod.F90 @@ -227,7 +227,7 @@ integer function gen_hashkey(string) integer :: i integer :: strlen integer, parameter :: tbl_max_idx = 15 ! 2**N - 1 - integer, parameter :: gen_hash_key_offset = z'000053db' + integer, parameter :: gen_hash_key_offset = int(z'000053db') integer, dimension(0:tbl_max_idx) :: tbl_gen_hash_key = (/61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1/) hash = gen_hash_key_offset diff --git a/src/biogeochem/MEGANFactorsMod.F90 b/src/biogeochem/MEGANFactorsMod.F90 index 8c91959b88..661bfbdde2 100644 --- a/src/biogeochem/MEGANFactorsMod.F90 +++ b/src/biogeochem/MEGANFactorsMod.F90 @@ -274,7 +274,7 @@ integer function gen_hashkey(string) integer :: i integer, parameter :: tbl_max_idx = 15 ! 2**N - 1 - integer, parameter :: gen_hash_key_offset = z'000053db' + integer, parameter :: gen_hash_key_offset = int(z'000053db') integer, dimension(0:tbl_max_idx) :: tbl_gen_hash_key = (/61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1/) hash = gen_hash_key_offset From 0d52de5efdc64d05c7d11c4668f364bc2d4e68be Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 4 Feb 2021 15:14:51 -0800 Subject: [PATCH 1803/1973] updating changelog notes for dev022 and removing fates checkbox from template --- doc/.ChangeLog_template | 2 -- doc/ChangeLog | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template index 11c30a596d..f72764d0f4 100644 --- a/doc/.ChangeLog_template +++ b/doc/.ChangeLog_template @@ -26,8 +26,6 @@ Does this tag change answers significantly for any of the following physics conf [ ] clm4_5 -[ ] fates - Bugs fixed or introduced ------------------------ diff --git a/doc/ChangeLog b/doc/ChangeLog index fe40c4c3cb..be84eaeaa1 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -31,7 +31,6 @@ Does this tag change answers significantly for any of the following physics conf [ ] clm4_5 -[X] fates Notes of particular relevance for users --------------------------------------- @@ -65,6 +64,7 @@ Changes to tests or testing: - Added FatesReducedComplexFixedBiogeo testmod which activates fates fixed biogeography mode - Added FatesSizeAgeMort testmod which activates tracking of size and age dependent mortality in fates - Added Fates_nat_and_anthro_ignitions testmod to activate use of external lightning and population datasets + - Non-debug mode nag tests replaced in izumi test list with debug versions due to internal compiler error. Testing summary: @@ -74,11 +74,11 @@ Testing summary: regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): - cheyenne ---- PASS (except for fates DIFFs) + cheyenne ---- PASS (fates testmods DIFFs are expected) izumi ------- OK - ok: All non-fates testmods PASS. Fates testmods have DIFF as expected due - to update of fates tag. + ok: All non-fates testmods PASS. Fates testmods have DIFF as expected due to update of fates tag. + BFAILs expected due to changing non-debug nag test to debug. See #1264 comments for discussion. fates tests: cheyenne ---- OK From 6b13bfe0634d08fecb5c538bb094e1fea1a80432 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 4 Feb 2021 16:38:04 -0700 Subject: [PATCH 1804/1973] Use typed allocation rather than sourced allocation I feel like this is cleaner, and I've had problems with sourced allocation in some cases --- src/biogeophys/OzoneFactoryMod.F90 | 4 ++-- src/biogeophys/OzoneMod.F90 | 29 ----------------------------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/src/biogeophys/OzoneFactoryMod.F90 b/src/biogeophys/OzoneFactoryMod.F90 index 2b28587a99..fa68b31851 100644 --- a/src/biogeophys/OzoneFactoryMod.F90 +++ b/src/biogeophys/OzoneFactoryMod.F90 @@ -41,9 +41,9 @@ function create_and_init_ozone_type(bounds) result(ozone) !----------------------------------------------------------------------- if (use_ozone) then - allocate(ozone, source = ozone_type()) + allocate(ozone_type :: ozone) else - allocate(ozone, source = ozone_off_type()) + allocate(ozone_off_type :: ozone) end if call ozone%Init(bounds) diff --git a/src/biogeophys/OzoneMod.F90 b/src/biogeophys/OzoneMod.F90 index 82c012a815..5dcce46270 100644 --- a/src/biogeophys/OzoneMod.F90 +++ b/src/biogeophys/OzoneMod.F90 @@ -63,10 +63,6 @@ module OzoneMod procedure, private, nopass :: CalcOzoneStressOnePoint end type ozone_type - interface ozone_type - module procedure constructor - end interface ozone_type - ! !PRIVATE TYPES: ! TODO(wjs, 2014-09-29) This parameter will eventually become a spatially-varying @@ -111,31 +107,6 @@ module OzoneMod ! Infrastructure routines (initialization, restart, etc.) ! ======================================================================== - !----------------------------------------------------------------------- - function constructor() result(ozone) - ! - ! !DESCRIPTION: - ! Return an instance of ozone_type - ! - ! !USES: - ! - ! !ARGUMENTS: - type(ozone_type) :: ozone ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - ! DO NOTHING (simply return a variable of the appropriate type) - - ! Eventually this should call the Init routine (or replace the Init routine - ! entirely). But I think it would be confusing to do that until we switch everything - ! to use a constructor rather than the init routine. - - end function constructor - - !----------------------------------------------------------------------- subroutine Init(this, bounds) ! From 0c05d6ce3ad3e4566d8bfd794ed38a674d389c62 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 4 Feb 2021 16:45:33 -0700 Subject: [PATCH 1805/1973] Don't unnecessarily set things to 1 This adds up in terms of performance --- src/biogeophys/OzoneOffMod.F90 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/biogeophys/OzoneOffMod.F90 b/src/biogeophys/OzoneOffMod.F90 index ac5a946de9..01104f2647 100644 --- a/src/biogeophys/OzoneOffMod.F90 +++ b/src/biogeophys/OzoneOffMod.F90 @@ -104,13 +104,7 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & SHR_ASSERT_ALL_FL((ubound(ram) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(tlai) == (/bounds%endp/)), sourcefile, __LINE__) - ! Explicitly set outputs to 1. This isn't really needed, because they should still be - ! at 1 from cold-start initialization, but do this for clarity here. - - this%o3coefvsha_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefvsun_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefgsha_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefgsun_patch(bounds%begp:bounds%endp) = 1._r8 + ! Do nothing: Outputs are already fixed at 1 from cold start initialization. end subroutine CalcOzoneStress From 5ee6ce2517c16c3b4ffc828c5bde0188324472f5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 4 Feb 2021 17:01:46 -0700 Subject: [PATCH 1806/1973] Add two fail tests for light-res set to none, but fire required to be on --- bld/unit_testers/build-namelist_test.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 49b9b9a591..56bf61a387 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -138,7 +138,7 @@ sub make_config_cache { # # Figure out number of tests that will run # -my $ntests = 1549; +my $ntests = 1551; if ( defined($opts{'compare'}) ) { $ntests += 1044; } @@ -842,6 +842,16 @@ sub make_config_cache { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_1", }, + "FireNoneButFATESfireon" =>{ options=>"-bgc fates -envxml_dir . -no-megan -light_res none", + namelst=>"fates_spitfire_mode=4", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_1", + }, + "FireNoneButBGCfireon" =>{ options=>"-bgc bgc -envxml_dir . -light_res none", + namelst=>"fire_method='li2021gswpfrc'", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_1", + }, "createcropFalse" =>{ options=>"-bgc bgc -envxml_dir . -no-megan", namelst=>"create_crop_landunit=.false.", GLC_TWO_WAY_COUPLING=>"FALSE", From c49dcbc497eef12b1ffe2fa448292f634b2b41ad Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 5 Feb 2021 00:03:41 -0700 Subject: [PATCH 1807/1973] Some more work with the Change files --- doc/ChangeLog | 33 ++++++++++++++++++++++++--------- doc/ChangeSum | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index be84eaeaa1..bc681f955a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev022 Originator(s): gregorylemieux (Gregory Lemieux,LBL/NGEET,510-486-5049) -Date: Wed 27 Jan 2021 12:26:44 AM PST +Date: Fri Feb 5 00:03:28 MST 2021 One-line Summary: Merge fates_main_api into ctsm master Purpose and description of changes @@ -31,15 +31,24 @@ Does this tag change answers significantly for any of the following physics conf [ ] clm4_5 +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1128 -- missing compset for FATES tests + Fixes #1002 -- allow transient land-use files when FATES is on? + Some work was done on #1272 -- namelist refactor for FATES + +Known bugs introduced in this tag (include issue #): + #1265 -- Diversifying fates testmods included in `aux_clm` test suite + #1266 - Add test for successful_ignitions mode for FATES-SPITFIRE + +Known bugs found since the previous tag (include issue #): + #1269 -- GSWP3V1 atmospheric forcing for 2011-2014 is "bad" over Antarctica Notes of particular relevance for users --------------------------------------- -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist -variables): - Changes made to namelist defaults (e.g., changed parameter values): - fates_spitfire_mode updated with multiple modes that use external datasets - use_fates_cohort_age_tracking added to enable size and age dependent mortality @@ -56,8 +65,11 @@ Notes of particular relevance for developers: --------------------------------------------- NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide -Caveats for developers (e.g., code that is duplicated that requires double -maintenance): none +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + There are a couple of issues we plan to address later (#1265, and #1272) + Note also that NAG compiler production tests started failing because of a compiler error + Since, we only care about NAG for DEBUG testing we removed those tests. Hopefully, a compiler + update will allow that to work in the future. Changes to tests or testing: - Added FatesPRT2 testmod test which activates fates CNP mode @@ -67,10 +79,13 @@ Changes to tests or testing: - Non-debug mode nag tests replaced in izumi test list with debug versions due to internal compiler error. -Testing summary: +Testing summary: regular ---------------- [PASS means all tests PASS; OK means tests PASS other than expected fails.] + build-namelist tests (if CLMBuildNamelist.pm has changed): + + cheyenne - PASS (61 namelists are different because of fates changes) regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): diff --git a/doc/ChangeSum b/doc/ChangeSum index 501dbbb210..ffd5a805a4 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev022 glemieux 01/27/2021 Merge fates_main_api into ctsm master + ctsm5.1.dev022 glemieux 02/05/2021 Merge fates_main_api into ctsm master ctsm5.1.dev021 erik 01/12/2021 Add option for biomass heat storage (BHS) to clm5_1 physics ctsm5.1.dev020 erik 12/30/2020 Potential roundoff changes in preparation for bio-mass heat storage option ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler From b5997684ee8c817cdfccf6094ff2d41f2b11aafc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 5 Feb 2021 13:59:55 -0700 Subject: [PATCH 1808/1973] Fix #1261 by setting spinup_factor_deadwood always in InitCold when spinup_state, having it only set in Restart was the problem --- .../testdefs/testmods_dirs/clm/ADspinup/include_user_mods | 1 + .../testdefs/testmods_dirs/clm/ADspinup/shell_commands | 4 ++++ src/biogeochem/CNVegCarbonStateType.F90 | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/clm/ADspinup/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/ADspinup/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/clm/ADspinup/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ADspinup/include_user_mods new file mode 100644 index 0000000000..fe0e18cf88 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/ADspinup/include_user_mods @@ -0,0 +1 @@ +../default diff --git a/cime_config/testdefs/testmods_dirs/clm/ADspinup/shell_commands b/cime_config/testdefs/testmods_dirs/clm/ADspinup/shell_commands new file mode 100644 index 0000000000..771777c92a --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/ADspinup/shell_commands @@ -0,0 +1,4 @@ +#!/bin/bash + +./xmlchange CLM_ACCELERATED_SPINUP="on" + diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index f7c9178453..28cf07869b 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -872,7 +872,7 @@ subroutine InitCold(this, bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst ! ! !USES: use landunit_varcon , only : istsoil, istcrop - use clm_varctl, only : MM_Nuptake_opt + use clm_varctl, only : MM_Nuptake_opt, spinup_state ! ! !ARGUMENTS: class(cnveg_carbonstate_type) :: this @@ -895,6 +895,8 @@ subroutine InitCold(this, bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst call endrun(msg=' ERROR: for C13 or C14 must pass in c12_cnveg_carbonstate_inst as argument' //& errMsg(sourcefile, __LINE__)) end if + else + if ( spinup_state == 2 ) spinup_factor_deadwood = spinup_factor_AD end if ! Set column filters @@ -1247,7 +1249,6 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, if (flag == 'read' .and. spinup_state /= restart_file_spinup_state .and. .not. use_cndv) then if ( masterproc ) write(iulog, *) 'exit_spinup ',exit_spinup,' restart_file_spinup_state ',restart_file_spinup_state - if ( spinup_state == 2 ) spinup_factor_deadwood = spinup_factor_AD if (spinup_state <= 1 .and. restart_file_spinup_state == 2 ) then if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood C pools out of AD spinup mode' exit_spinup = .true. From 8cd34647aa9e3b57c0046166340ab7b2616d9dfb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 5 Feb 2021 14:16:52 -0700 Subject: [PATCH 1809/1973] Reverse order of modules as given in #1255 --- tools/mkmapdata/mkmapdata.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index d0691a9817..c778261234 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -344,8 +344,8 @@ case $hostname in fi esmfvers=7.1.0r intelvers=18.0.5 # Could also use intel/19.0.2 EBK 10/4/2019 - module load esmf_libs/$esmfvers module load intel/$intelvers + module load esmf_libs/$esmfvers module load ncl module load nco From 977ec171020a5cf8be0286d1844f7d4402ddfcc7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 5 Feb 2021 20:25:41 -0700 Subject: [PATCH 1810/1973] Make separate subroutines for ozone uptake & stress This will support introducing alternative methods for ozone stress, as well as removing some variables from the restart file. --- src/biogeophys/CanopyFluxesMod.F90 | 5 +- src/biogeophys/OzoneBaseMod.F90 | 16 +++- src/biogeophys/OzoneMod.F90 | 118 ++++++++++++++++++++++------- src/biogeophys/OzoneOffMod.F90 | 16 +++- 4 files changed, 119 insertions(+), 36 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 348af3a613..97b40be7e1 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1557,7 +1557,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, ! needed with pgi 14.7 on yellowstone; without it, forc_pbot_downscaled_col gets ! resized inappropriately in the following subroutine call, due to a compiler bug. dummy_to_make_pgi_happy = ubound(atm2lnd_inst%forc_pbot_downscaled_col, 1) - call ozone_inst%CalcOzoneStress( & + call ozone_inst%CalcOzoneUptake( & bounds, fn, filterp, & forc_pbot = atm2lnd_inst%forc_pbot_downscaled_col(bounds%begc:bounds%endc), & forc_th = atm2lnd_inst%forc_th_downscaled_col(bounds%begc:bounds%endc), & @@ -1566,7 +1566,8 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, rb = frictionvel_inst%rb1_patch(bounds%begp:bounds%endp), & ram = frictionvel_inst%ram1_patch(bounds%begp:bounds%endp), & tlai = canopystate_inst%tlai_patch(bounds%begp:bounds%endp)) - + call ozone_inst%CalcOzoneStress(bounds, fn, filterp) + !--------------------------------------------------------- !update Vc,max and Jmax by LUNA model if(use_luna)then diff --git a/src/biogeophys/OzoneBaseMod.F90 b/src/biogeophys/OzoneBaseMod.F90 index c50818f380..a93a22f4eb 100644 --- a/src/biogeophys/OzoneBaseMod.F90 +++ b/src/biogeophys/OzoneBaseMod.F90 @@ -31,6 +31,7 @@ module OzoneBaseMod ! The following routines need to be implemented by all type extensions procedure(Init_interface) , public, deferred :: Init procedure(Restart_interface) , public, deferred :: Restart + procedure(CalcOzoneUptake_interface) , public, deferred :: CalcOzoneUptake procedure(CalcOzoneStress_interface) , public, deferred :: CalcOzoneStress ! The following routines should only be called by extensions of the ozone_base_type @@ -59,8 +60,8 @@ subroutine Restart_interface(this, bounds, ncid, flag) type(file_desc_t) , intent(inout) :: ncid ! netcdf id character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' end subroutine Restart_interface - - subroutine CalcOzoneStress_interface(this, bounds, num_exposedvegp, filter_exposedvegp, & + + subroutine CalcOzoneUptake_interface(this, bounds, num_exposedvegp, filter_exposedvegp, & forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) use decompMod , only : bounds_type use shr_kind_mod , only : r8 => shr_kind_r8 @@ -77,8 +78,17 @@ subroutine CalcOzoneStress_interface(this, bounds, num_exposedvegp, filter_expos real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) real(r8) , intent(in) :: ram( bounds%begp: ) ! aerodynamical resistance (s/m) real(r8) , intent(in) :: tlai( bounds%begp: ) ! one-sided leaf area index, no burying by snow - end subroutine CalcOzoneStress_interface + end subroutine CalcOzoneUptake_interface + + subroutine CalcOzoneStress_interface(this, bounds, num_exposedvegp, filter_exposedvegp) + use decompMod, only : bounds_type + import :: ozone_base_type + class(ozone_base_type) , intent(inout) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + end subroutine CalcOzoneStress_interface end interface contains diff --git a/src/biogeophys/OzoneMod.F90 b/src/biogeophys/OzoneMod.F90 index 5dcce46270..3abac46d5e 100644 --- a/src/biogeophys/OzoneMod.F90 +++ b/src/biogeophys/OzoneMod.F90 @@ -18,6 +18,8 @@ module OzoneMod use clm_varcon , only : spval use OzoneBaseMod, only : ozone_base_type use abortutils , only : endrun + use PatchType , only : patch + use pftconMod , only : pftcon implicit none save @@ -52,6 +54,7 @@ module OzoneMod ! Public routines procedure, public :: Init procedure, public :: Restart + procedure, public :: CalcOzoneUptake procedure, public :: CalcOzoneStress ! Private routines @@ -59,6 +62,9 @@ module OzoneMod procedure, private :: InitHistory procedure, private :: InitCold + ! Calculate ozone uptake for a single point, for just sunlit or shaded leaves + procedure, private, nopass :: CalcOzoneUptakeOnePoint + ! Calculate ozone stress for a single point, for just sunlit or shaded leaves procedure, private, nopass :: CalcOzoneStressOnePoint end type ozone_type @@ -278,14 +284,11 @@ end subroutine Restart ! ======================================================================== !----------------------------------------------------------------------- - subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & + subroutine CalcOzoneUptake(this, bounds, num_exposedvegp, filter_exposedvegp, & forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) ! ! !DESCRIPTION: - ! Calculate ozone stress. - ! - ! !USES: - use PatchType , only : patch + ! Calculate ozone uptake. ! ! !ARGUMENTS: class(ozone_type) , intent(inout) :: this @@ -305,7 +308,7 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & integer :: p ! patch index integer :: c ! column index - character(len=*), parameter :: subname = 'CalcOzoneStress' + character(len=*), parameter :: subname = 'CalcOzoneUptake' !----------------------------------------------------------------------- ! Enforce expected array sizes @@ -318,10 +321,6 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & SHR_ASSERT_ALL_FL((ubound(tlai) == (/bounds%endp/)), sourcefile, __LINE__) associate( & - o3coefvsha => this%o3coefvsha_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefvsun => this%o3coefvsun_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefgsha => this%o3coefgsha_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefgsun => this%o3coefgsun_patch , & ! Output: [real(r8) (:)] ozone coef o3uptakesha => this%o3uptakesha_patch , & ! Output: [real(r8) (:)] ozone dose o3uptakesun => this%o3uptakesun_patch , & ! Output: [real(r8) (:)] ozone dose tlai_old => this%tlai_old_patch & ! Output: [real(r8) (:)] tlai from last time step @@ -331,41 +330,87 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & p = filter_exposedvegp(fp) c = patch%column(p) - ! Ozone stress for shaded leaves - call CalcOzoneStressOnePoint( & + ! Ozone uptake for shaded leaves + call CalcOzoneUptakeOnePoint( & forc_ozone=forc_ozone, forc_pbot=forc_pbot(c), forc_th=forc_th(c), & rs=rssha(p), rb=rb(p), ram=ram(p), & tlai=tlai(p), tlai_old=tlai_old(p), pft_type=patch%itype(p), & - o3uptake=o3uptakesha(p), o3coefv=o3coefvsha(p), o3coefg=o3coefgsha(p)) + o3uptake=o3uptakesha(p)) - ! Ozone stress for sunlit leaves - call CalcOzoneStressOnePoint( & + ! Ozone uptake for sunlit leaves + call CalcOzoneUptakeOnePoint( & forc_ozone=forc_ozone, forc_pbot=forc_pbot(c), forc_th=forc_th(c), & rs=rssun(p), rb=rb(p), ram=ram(p), & tlai=tlai(p), tlai_old=tlai_old(p), pft_type=patch%itype(p), & - o3uptake=o3uptakesun(p), o3coefv=o3coefvsun(p), o3coefg=o3coefgsun(p)) + o3uptake=o3uptakesun(p)) tlai_old(p) = tlai(p) end do + end associate + + end subroutine CalcOzoneUptake + + !----------------------------------------------------------------------- + subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) + ! + ! !DESCRIPTION: + ! Calculate ozone stress. + ! + ! !ARGUMENTS: + class(ozone_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + ! + ! !LOCAL VARIABLES: + integer :: fp ! filter index + integer :: p ! patch index + + character(len=*), parameter :: subname = 'CalcOzoneStress' + !----------------------------------------------------------------------- + + associate( & + o3uptakesha => this%o3uptakesha_patch , & ! Input: [real(r8) (:)] ozone dose + o3uptakesun => this%o3uptakesun_patch , & ! Input: [real(r8) (:)] ozone dose + o3coefvsha => this%o3coefvsha_patch , & ! Output: [real(r8) (:)] ozone coef + o3coefvsun => this%o3coefvsun_patch , & ! Output: [real(r8) (:)] ozone coef + o3coefgsha => this%o3coefgsha_patch , & ! Output: [real(r8) (:)] ozone coef + o3coefgsun => this%o3coefgsun_patch & ! Output: [real(r8) (:)] ozone coef + ) + + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + + ! Ozone stress for shaded leaves + call CalcOzoneStressOnePoint( & + pft_type=patch%itype(p), o3uptake=o3uptakesha(p), & + o3coefv=o3coefvsha(p), o3coefg=o3coefgsha(p)) + + ! Ozone stress for sunlit leaves + call CalcOzoneStressOnePoint( & + pft_type=patch%itype(p), o3uptake=o3uptakesun(p), & + o3coefv=o3coefvsun(p), o3coefg=o3coefgsun(p)) + end do + + end associate end subroutine CalcOzoneStress !----------------------------------------------------------------------- - subroutine CalcOzoneStressOnePoint( & + subroutine CalcOzoneUptakeOnePoint( & forc_ozone, forc_pbot, forc_th, & rs, rb, ram, & tlai, tlai_old, pft_type, & - o3uptake, o3coefv, o3coefg) + o3uptake) ! ! !DESCRIPTION: - ! Calculates ozone stress for a single point, for just sunlit or shaded leaves + ! Calculates ozone uptake for a single point, for just sunlit or shaded leaves ! ! !USES: use shr_const_mod , only : SHR_CONST_RGAS - use pftconMod , only : pftcon use clm_time_manager , only : get_step_size ! ! !ARGUMENTS: @@ -379,8 +424,6 @@ subroutine CalcOzoneStressOnePoint( & real(r8) , intent(in) :: tlai_old ! tlai from last time step integer , intent(in) :: pft_type ! vegetation type, for indexing into pftvarcon arrays real(r8) , intent(inout) :: o3uptake ! ozone entering the leaf - real(r8) , intent(out) :: o3coefv ! ozone coefficient for photosynthesis (0 - 1) - real(r8) , intent(out) :: o3coefg ! ozone coefficient for conductance (0 - 1) ! ! !LOCAL VARIABLES: integer :: dtime ! land model time step (sec) @@ -392,12 +435,8 @@ subroutine CalcOzoneStressOnePoint( & real(r8) :: heal ! o3uptake healing rate based on % of new leaves growing (mmol m^-2) real(r8) :: leafturn ! leaf turnover time / mortality rate (per hour) real(r8) :: decay ! o3uptake decay rate based on leaf lifetime (mmol m^-2) - real(r8) :: photoInt ! intercept for photosynthesis - real(r8) :: photoSlope ! slope for photosynthesis - real(r8) :: condInt ! intercept for conductance - real(r8) :: condSlope ! slope for conductance - character(len=*), parameter :: subname = 'CalcOzoneStressOnePoint' + character(len=*), parameter :: subname = 'CalcOzoneUptakeOnePoint' !----------------------------------------------------------------------- ! convert o3 from mol/mol to nmol m^-3 @@ -443,6 +482,30 @@ subroutine CalcOzoneStressOnePoint( & o3uptake = 0._r8 end if + end subroutine CalcOzoneUptakeOnePoint + + !----------------------------------------------------------------------- + subroutine CalcOzoneStressOnePoint( & + pft_type, o3uptake, & + o3coefv, o3coefg) + ! + ! !DESCRIPTION: + ! Calculates ozone stress for a single point, for just sunlit or shaded leaves + ! + ! !ARGUMENTS: + integer , intent(in) :: pft_type ! vegetation type, for indexing into pftvarcon arrays + real(r8) , intent(in) :: o3uptake ! ozone entering the leaf + real(r8) , intent(out) :: o3coefv ! ozone coefficient for photosynthesis (0 - 1) + real(r8) , intent(out) :: o3coefg ! ozone coefficient for conductance (0 - 1) + ! + ! !LOCAL VARIABLES: + real(r8) :: photoInt ! intercept for photosynthesis + real(r8) :: photoSlope ! slope for photosynthesis + real(r8) :: condInt ! intercept for conductance + real(r8) :: condSlope ! slope for conductance + + character(len=*), parameter :: subname = 'CalcOzoneStressOnePoint' + !----------------------------------------------------------------------- if (o3uptake == 0._r8) then ! No o3 damage if no o3 uptake @@ -479,5 +542,4 @@ subroutine CalcOzoneStressOnePoint( & end subroutine CalcOzoneStressOnePoint - end module OzoneMod diff --git a/src/biogeophys/OzoneOffMod.F90 b/src/biogeophys/OzoneOffMod.F90 index 01104f2647..f42707f667 100644 --- a/src/biogeophys/OzoneOffMod.F90 +++ b/src/biogeophys/OzoneOffMod.F90 @@ -22,6 +22,7 @@ module OzoneOffMod contains procedure, public :: Init procedure, public :: Restart + procedure, public :: CalcOzoneUptake procedure, public :: CalcOzoneStress end type ozone_off_type @@ -79,8 +80,8 @@ subroutine Restart(this, bounds, ncid, flag) end subroutine Restart - subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & - forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) + subroutine CalcOzoneUptake(this, bounds, num_exposedvegp, filter_exposedvegp, & + forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) class(ozone_off_type) , intent(inout) :: this type(bounds_type) , intent(in) :: bounds @@ -104,8 +105,17 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & SHR_ASSERT_ALL_FL((ubound(ram) == (/bounds%endp/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(tlai) == (/bounds%endp/)), sourcefile, __LINE__) - ! Do nothing: Outputs are already fixed at 1 from cold start initialization. + ! Do nothing: In the ozone off case, we don't need to track ozone uptake + end subroutine CalcOzoneUptake + + subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) + class(ozone_off_type), intent(inout) :: this + type(bounds_type) , intent(in) :: bounds + integer , intent(in) :: num_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) + + ! Do nothing: Outputs (stress terms) are already fixed at 1 from cold start initialization end subroutine CalcOzoneStress end module OzoneOffMod From 0ac085b1a36d385bfe90be7b08d771d5a21e81d2 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 6 Feb 2021 08:03:28 -0700 Subject: [PATCH 1811/1973] Rearrange subroutines --- src/biogeophys/OzoneMod.F90 | 96 ++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/biogeophys/OzoneMod.F90 b/src/biogeophys/OzoneMod.F90 index 3abac46d5e..5822a26f30 100644 --- a/src/biogeophys/OzoneMod.F90 +++ b/src/biogeophys/OzoneMod.F90 @@ -352,53 +352,6 @@ subroutine CalcOzoneUptake(this, bounds, num_exposedvegp, filter_exposedvegp, & end subroutine CalcOzoneUptake - !----------------------------------------------------------------------- - subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) - ! - ! !DESCRIPTION: - ! Calculate ozone stress. - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - ! - ! !LOCAL VARIABLES: - integer :: fp ! filter index - integer :: p ! patch index - - character(len=*), parameter :: subname = 'CalcOzoneStress' - !----------------------------------------------------------------------- - - associate( & - o3uptakesha => this%o3uptakesha_patch , & ! Input: [real(r8) (:)] ozone dose - o3uptakesun => this%o3uptakesun_patch , & ! Input: [real(r8) (:)] ozone dose - o3coefvsha => this%o3coefvsha_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefvsun => this%o3coefvsun_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefgsha => this%o3coefgsha_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefgsun => this%o3coefgsun_patch & ! Output: [real(r8) (:)] ozone coef - ) - - do fp = 1, num_exposedvegp - p = filter_exposedvegp(fp) - - ! Ozone stress for shaded leaves - call CalcOzoneStressOnePoint( & - pft_type=patch%itype(p), o3uptake=o3uptakesha(p), & - o3coefv=o3coefvsha(p), o3coefg=o3coefgsha(p)) - - ! Ozone stress for sunlit leaves - call CalcOzoneStressOnePoint( & - pft_type=patch%itype(p), o3uptake=o3uptakesun(p), & - o3coefv=o3coefvsun(p), o3coefg=o3coefgsun(p)) - end do - - - end associate - - end subroutine CalcOzoneStress - !----------------------------------------------------------------------- subroutine CalcOzoneUptakeOnePoint( & forc_ozone, forc_pbot, forc_th, & @@ -445,7 +398,7 @@ subroutine CalcOzoneUptakeOnePoint( & ! calculate instantaneous flux o3flux = o3concnmolm3/ (ko3*rs+ rb + ram) - ! apply o3 flux threshold + ! apply o3 flux threshold if (o3flux < o3_flux_threshold) then o3fluxcrit = 0._r8 else @@ -484,6 +437,53 @@ subroutine CalcOzoneUptakeOnePoint( & end subroutine CalcOzoneUptakeOnePoint + !----------------------------------------------------------------------- + subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) + ! + ! !DESCRIPTION: + ! Calculate ozone stress. + ! + ! !ARGUMENTS: + class(ozone_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + ! + ! !LOCAL VARIABLES: + integer :: fp ! filter index + integer :: p ! patch index + + character(len=*), parameter :: subname = 'CalcOzoneStress' + !----------------------------------------------------------------------- + + associate( & + o3uptakesha => this%o3uptakesha_patch , & ! Input: [real(r8) (:)] ozone dose + o3uptakesun => this%o3uptakesun_patch , & ! Input: [real(r8) (:)] ozone dose + o3coefvsha => this%o3coefvsha_patch , & ! Output: [real(r8) (:)] ozone coef + o3coefvsun => this%o3coefvsun_patch , & ! Output: [real(r8) (:)] ozone coef + o3coefgsha => this%o3coefgsha_patch , & ! Output: [real(r8) (:)] ozone coef + o3coefgsun => this%o3coefgsun_patch & ! Output: [real(r8) (:)] ozone coef + ) + + do fp = 1, num_exposedvegp + p = filter_exposedvegp(fp) + + ! Ozone stress for shaded leaves + call CalcOzoneStressOnePoint( & + pft_type=patch%itype(p), o3uptake=o3uptakesha(p), & + o3coefv=o3coefvsha(p), o3coefg=o3coefgsha(p)) + + ! Ozone stress for sunlit leaves + call CalcOzoneStressOnePoint( & + pft_type=patch%itype(p), o3uptake=o3uptakesun(p), & + o3coefv=o3coefvsun(p), o3coefg=o3coefgsun(p)) + end do + + + end associate + + end subroutine CalcOzoneStress + !----------------------------------------------------------------------- subroutine CalcOzoneStressOnePoint( & pft_type, o3uptake, & From a78bb45736ffd8b8936762225672dd7aecd514ef Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 6 Feb 2021 09:40:47 -0700 Subject: [PATCH 1812/1973] Demonstrate method for selecting between different ozone stress methods --- src/biogeophys/OzoneMod.F90 | 57 +++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/OzoneMod.F90 b/src/biogeophys/OzoneMod.F90 index 5822a26f30..6210d574ad 100644 --- a/src/biogeophys/OzoneMod.F90 +++ b/src/biogeophys/OzoneMod.F90 @@ -16,6 +16,7 @@ module OzoneMod use shr_kind_mod, only : r8 => shr_kind_r8 use decompMod , only : bounds_type use clm_varcon , only : spval + use clm_varctl , only : iulog use OzoneBaseMod, only : ozone_base_type use abortutils , only : endrun use PatchType , only : patch @@ -29,6 +30,8 @@ module OzoneMod type, extends(ozone_base_type), public :: ozone_type private ! Private data members + integer :: stress_method ! Which ozone stress parameterization we're using in this run + real(r8), pointer :: o3uptakesha_patch(:) ! ozone dose, shaded leaves (mmol O3/m^2) real(r8), pointer :: o3uptakesun_patch(:) ! ozone dose, sunlit leaves (mmol O3/m^2) @@ -65,11 +68,15 @@ module OzoneMod ! Calculate ozone uptake for a single point, for just sunlit or shaded leaves procedure, private, nopass :: CalcOzoneUptakeOnePoint + ! Original ozone stress parameterization, from Danica Lombardozzi + procedure, private :: CalcOzoneStressLombardozzi + ! Calculate ozone stress for a single point, for just sunlit or shaded leaves - procedure, private, nopass :: CalcOzoneStressOnePoint + procedure, private, nopass :: CalcOzoneStressLombardozziOnePoint end type ozone_type ! !PRIVATE TYPES: + integer, parameter :: stress_method_lombardozzi = 1 ! TODO(wjs, 2014-09-29) This parameter will eventually become a spatially-varying ! value, obtained from ATM @@ -124,6 +131,9 @@ subroutine Init(this, bounds) type(bounds_type), intent(in) :: bounds !----------------------------------------------------------------------- + ! TODO(wjs, 2021-02-06) This will be based on a namelist variable + this%stress_method = stress_method_lombardozzi + call this%InitAllocate(bounds) call this%InitHistory(bounds) call this%InitCold(bounds) @@ -450,10 +460,39 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg ! ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'CalcOzoneStress' + !----------------------------------------------------------------------- + + select case (this%stress_method) + case (stress_method_lombardozzi) + call this%CalcOzoneStressLombardozzi(bounds, num_exposedvegp, filter_exposedvegp) + case default + write(iulog,*) 'ERROR: unknown ozone stress method: ', this%stress_method + call endrun('Unknown ozone stress method') + end select + + end subroutine CalcOzoneStress + + !----------------------------------------------------------------------- + subroutine CalcOzoneStressLombardozzi(this, bounds, num_exposedvegp, filter_exposedvegp) + ! + ! !DESCRIPTION: + ! Calculate ozone stress. + ! + ! This subroutine uses the Lombardozzi formulation for ozone stress + ! + ! !ARGUMENTS: + class(ozone_type), intent(inout) :: this + type(bounds_type), intent(in) :: bounds + integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp + integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg + ! + ! !LOCAL VARIABLES: integer :: fp ! filter index integer :: p ! patch index - character(len=*), parameter :: subname = 'CalcOzoneStress' + character(len=*), parameter :: subname = 'CalcOzoneStressLombardozzi' !----------------------------------------------------------------------- associate( & @@ -469,12 +508,12 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) p = filter_exposedvegp(fp) ! Ozone stress for shaded leaves - call CalcOzoneStressOnePoint( & + call CalcOzoneStressLombardozziOnePoint( & pft_type=patch%itype(p), o3uptake=o3uptakesha(p), & o3coefv=o3coefvsha(p), o3coefg=o3coefgsha(p)) ! Ozone stress for sunlit leaves - call CalcOzoneStressOnePoint( & + call CalcOzoneStressLombardozziOnePoint( & pft_type=patch%itype(p), o3uptake=o3uptakesun(p), & o3coefv=o3coefvsun(p), o3coefg=o3coefgsun(p)) end do @@ -482,16 +521,18 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) end associate - end subroutine CalcOzoneStress + end subroutine CalcOzoneStressLombardozzi !----------------------------------------------------------------------- - subroutine CalcOzoneStressOnePoint( & + subroutine CalcOzoneStressLombardozziOnePoint( & pft_type, o3uptake, & o3coefv, o3coefg) ! ! !DESCRIPTION: ! Calculates ozone stress for a single point, for just sunlit or shaded leaves ! + ! This subroutine uses the Lombardozzi formulation for ozone stress + ! ! !ARGUMENTS: integer , intent(in) :: pft_type ! vegetation type, for indexing into pftvarcon arrays real(r8) , intent(in) :: o3uptake ! ozone entering the leaf @@ -504,7 +545,7 @@ subroutine CalcOzoneStressOnePoint( & real(r8) :: condInt ! intercept for conductance real(r8) :: condSlope ! slope for conductance - character(len=*), parameter :: subname = 'CalcOzoneStressOnePoint' + character(len=*), parameter :: subname = 'CalcOzoneStressLombardozziOnePoint' !----------------------------------------------------------------------- if (o3uptake == 0._r8) then @@ -540,6 +581,6 @@ subroutine CalcOzoneStressOnePoint( & end if - end subroutine CalcOzoneStressOnePoint + end subroutine CalcOzoneStressLombardozziOnePoint end module OzoneMod From c5b8f4e952d14069c72c75d7eb357b707979890f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 6 Feb 2021 11:09:23 -0700 Subject: [PATCH 1813/1973] Move call to CalcOzoneStress to earlier in the driver loop This way, we don't need the stress terms on the restart file. --- src/biogeophys/CanopyFluxesMod.F90 | 9 ++++----- src/biogeophys/OzoneMod.F90 | 20 -------------------- src/main/clm_driver.F90 | 4 ++-- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 97b40be7e1..a88df97448 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -1548,10 +1548,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, call PhotosynthesisTotal(fn, filterp, & atm2lnd_inst, canopystate_inst, photosyns_inst) - ! Calculate ozone stress. This needs to be done after rssun and rsshade are - ! computed by the Photosynthesis routine. However, Photosynthesis also uses the - ! ozone stress computed here. Thus, the ozone stress computed in timestep i is - ! applied in timestep (i+1). + ! Calculate ozone uptake. This needs to be done after rssun and rsshade are + ! computed by the Photosynthesis routine. The updated ozone uptake computed here + ! will be used in the next time step to calculate ozone stress for the next time + ! step's photosynthesis calculations. ! COMPILER_BUG(wjs, 2014-11-29, pgi 14.7) The following dummy variable assignment is ! needed with pgi 14.7 on yellowstone; without it, forc_pbot_downscaled_col gets @@ -1566,7 +1566,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, rb = frictionvel_inst%rb1_patch(bounds%begp:bounds%endp), & ram = frictionvel_inst%ram1_patch(bounds%begp:bounds%endp), & tlai = canopystate_inst%tlai_patch(bounds%begp:bounds%endp)) - call ozone_inst%CalcOzoneStress(bounds, fn, filterp) !--------------------------------------------------------- !update Vc,max and Jmax by LUNA model diff --git a/src/biogeophys/OzoneMod.F90 b/src/biogeophys/OzoneMod.F90 index 6210d574ad..95d6fde5c4 100644 --- a/src/biogeophys/OzoneMod.F90 +++ b/src/biogeophys/OzoneMod.F90 @@ -267,26 +267,6 @@ subroutine Restart(this, bounds, ncid, flag) long_name='ozone uptake for sunlit leaves', units='mmol m^-3', & readvar=readvar, interpinic_flag='interp', data=this%o3uptakesun_patch) - call restartvar(ncid=ncid, flag=flag, varname='o3coefvsun', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for photosynthesis for sunlit leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefvsun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefgsun', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for stomatal conductance for sunlit leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefgsun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefvsha', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for photosynthesis for shaded leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefvsha_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefgsha', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for stomatal conductance for shaded leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefgsha_patch) - end subroutine Restart ! ======================================================================== diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index b16b0ae576..11daa19354 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -74,13 +74,11 @@ module clm_driver use DaylengthMod , only : UpdateDaylength use perf_mod ! - use clm_instMod , only : nutrient_competition_method use GridcellType , only : grc use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch use clm_instMod - use clm_instMod , only : soil_water_retention_curve use EDBGCDynMod , only : EDBGCDyn, EDBGCDynSummary use SoilMoistureStreamMod , only : PrescribedSoilMoistureInterp, PrescribedSoilMoistureAdvance ! @@ -610,6 +608,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro water_inst%wateratm2lndbulk_inst, water_inst%waterdiagnosticbulk_inst, & water_inst%waterstatebulk_inst) + call ozone_inst%CalcOzoneStress(bounds_clump, filter(nc)%num_exposedvegp, filter(nc)%exposedvegp) + ! TODO(wjs, 2019-10-02) I'd like to keep moving this down until it is below ! LakeFluxes... I'll probably leave it in place there. if (water_inst%DoConsistencyCheck()) then From 57e604446940360fae73d8addba9d19ec51169c2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 8 Feb 2021 19:40:05 -0700 Subject: [PATCH 1814/1973] Handel SOILWATER_10CM properly in Summary rather than too early as in #932 --- src/biogeophys/HydrologyNoDrainageMod.F90 | 8 ---- src/biogeophys/WaterDiagnosticBulkType.F90 | 56 +++++++++++++++++++--- src/biogeophys/WaterDiagnosticType.F90 | 3 ++ src/biogeophys/WaterType.F90 | 9 +++- src/main/clm_driver.F90 | 3 +- 5 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index 9a3009d968..a3803238b4 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -245,7 +245,6 @@ subroutine HydrologyNoDrainage(bounds, & snowice => b_waterdiagnostic_inst%snowice_col , & ! Output: [real(r8) (:) ] average snow ice lens snowliq => b_waterdiagnostic_inst%snowliq_col , & ! Output: [real(r8) (:) ] average snow liquid water snow_persistence => b_waterstate_inst%snow_persistence_col , & ! Output: [real(r8) (:) ] counter for length of time snow-covered - h2osoi_liqice_10cm => b_waterdiagnostic_inst%h2osoi_liqice_10cm_col , & ! Output: [real(r8) (:) ] liquid water + ice lens in top 10cm of soil (kg/m2) h2osoi_ice => b_waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) h2osoi_liq => b_waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) h2osoi_ice_tot => b_waterdiagnostic_inst%h2osoi_ice_tot_col , & ! Output: [real(r8) (:) ] vertically summed ice lens (kg/m2) @@ -511,7 +510,6 @@ subroutine HydrologyNoDrainage(bounds, & if (.not. lun%urbpoi(l)) then t_soi_10cm(c) = 0._r8 tsoi17(c) = 0._r8 - h2osoi_liqice_10cm(c) = 0._r8 h2osoi_liq_tot(c) = 0._r8 h2osoi_ice_tot(c) = 0._r8 end if @@ -538,16 +536,10 @@ subroutine HydrologyNoDrainage(bounds, & if (zi(c,j) <= 0.1_r8) then fracl = 1._r8 t_soi_10cm(c) = t_soi_10cm(c) + t_soisno(c,j)*dz(c,j)*fracl - h2osoi_liqice_10cm(c) = h2osoi_liqice_10cm(c) + & - (h2osoi_liq(c,j)+h2osoi_ice(c,j))* & - fracl else if (zi(c,j) > 0.1_r8 .and. zi(c,j-1) < 0.1_r8) then fracl = (0.1_r8 - zi(c,j-1))/dz(c,j) t_soi_10cm(c) = t_soi_10cm(c) + t_soisno(c,j)*dz(c,j)*fracl - h2osoi_liqice_10cm(c) = h2osoi_liqice_10cm(c) + & - (h2osoi_liq(c,j)+h2osoi_ice(c,j))* & - fracl end if end if diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index 21cc9d283b..55125f232d 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -829,31 +829,45 @@ end subroutine RestartBackcompatIssue783 subroutine Summary(this, bounds, & num_soilp, filter_soilp, & num_allc, filter_allc, & + num_nolakec, filter_nolakec, & waterstate_inst, waterflux_inst) ! ! !DESCRIPTION: ! Compute end-of-timestep summaries of water diagnostic terms ! + ! !USES: + use clm_varpar , only : nlevsoi ! !ARGUMENTS: class(waterdiagnosticbulk_type) , intent(inout) :: this type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of patches in soilp filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all columns + integer , intent(in) :: num_soilp ! number of patches in soilp filter + integer , intent(in) :: filter_soilp(:) ! filter for soil patches + integer , intent(in) :: num_allc ! number of columns in allc filter + integer , intent(in) :: filter_allc(:) ! filter for all columns + integer , intent(in) :: num_nolakec ! number of columns in no-lake columnc filter + integer , intent(in) :: filter_nolakec(:) ! filter for no-lake columns class(waterstate_type) , intent(in) :: waterstate_inst class(waterflux_type) , intent(in) :: waterflux_inst ! ! !LOCAL VARIABLES: - integer :: fp, p - integer :: fc, c + integer :: fp, p, j, l, fc, c ! Indices + real(r8):: fracl ! fraction of soil layer contributing to 10cm total soil water character(len=*), parameter :: subname = 'Summary' !----------------------------------------------------------------------- + associate( & + dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness depth (m) + zi => col%zi , & ! Input: [real(r8) (:,:) ] interface depth (m) + + h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) + h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) + h2osoi_liqice_10cm => this%h2osoi_liqice_10cm_col & ! Output: [real(r8) (:) ] liquid water + ice lens in top 10cm of soil (kg/m2) + ) call this%waterdiagnostic_type%Summary(bounds, & num_soilp, filter_soilp, & num_allc, filter_allc, & + num_nolakec, filter_nolakec, & waterstate_inst, waterflux_inst) call waterstate_inst%CalculateTotalH2osno(bounds, num_allc, filter_allc, & @@ -873,6 +887,36 @@ subroutine Summary(this, bounds, & waterflux_inst%qflx_liq_grnd_col(c) + & waterflux_inst%qflx_snow_grnd_col(c) end do + do fc = 1, num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (.not. lun%urbpoi(l)) then + h2osoi_liqice_10cm(c) = 0.0_r8 + end if + end do + do j = 1, nlevsoi + do fc = 1, num_nolakec + c = filter_nolakec(fc) + l = col%landunit(c) + if (.not. lun%urbpoi(l)) then + if (zi(c,j) <= 0.1_r8) then + fracl = 1._r8 + h2osoi_liqice_10cm(c) = h2osoi_liqice_10cm(c) + & + (h2osoi_liq(c,j)+h2osoi_ice(c,j))* & + fracl + else + if (zi(c,j) > 0.1_r8 .and. zi(c,j-1) < 0.1_r8) then + fracl = (0.1_r8 - zi(c,j-1))/dz(c,j) + h2osoi_liqice_10cm(c) = h2osoi_liqice_10cm(c) + & + (h2osoi_liq(c,j)+h2osoi_ice(c,j))* & + fracl + end if + end if + end if + end do + end do + + end associate end subroutine Summary diff --git a/src/biogeophys/WaterDiagnosticType.F90 b/src/biogeophys/WaterDiagnosticType.F90 index 448d422877..0006ecc20d 100644 --- a/src/biogeophys/WaterDiagnosticType.F90 +++ b/src/biogeophys/WaterDiagnosticType.F90 @@ -335,6 +335,7 @@ end subroutine Restart subroutine Summary(this, bounds, & num_soilp, filter_soilp, & num_allc, filter_allc, & + num_nolakec, filter_nolakec, & waterstate_inst, waterflux_inst) ! ! !DESCRIPTION: @@ -347,6 +348,8 @@ subroutine Summary(this, bounds, & integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_allc ! number of columns in allc filter integer , intent(in) :: filter_allc(:) ! filter for all columns + integer , intent(in) :: num_nolakec ! number of columns in no-lake filter + integer , intent(in) :: filter_nolakec(:) ! filter for no-lake columns class(waterstate_type) , intent(in) :: waterstate_inst class(waterflux_type) , intent(in) :: waterflux_inst ! diff --git a/src/biogeophys/WaterType.F90 b/src/biogeophys/WaterType.F90 index 4744b63085..9e3431daa5 100644 --- a/src/biogeophys/WaterType.F90 +++ b/src/biogeophys/WaterType.F90 @@ -1009,8 +1009,9 @@ end subroutine ResetCheckedTracers !----------------------------------------------------------------------- subroutine Summary(this, bounds, & - num_soilp, filter_soilp, & - num_allc, filter_allc) + num_soilp, filter_soilp, & + num_allc, filter_allc, & + num_nolakec, filter_nolakec) ! ! !DESCRIPTION: ! Compute end-of-timestep summaries of water diagnostic terms @@ -1022,6 +1023,8 @@ subroutine Summary(this, bounds, & integer , intent(in) :: filter_soilp(:) ! filter for soil patches integer , intent(in) :: num_allc ! number of columns in allc filter integer , intent(in) :: filter_allc(:) ! filter for all columns + integer , intent(in) :: num_nolakec ! number of no-lake filter + integer , intent(in) :: filter_nolakec(:) ! filter for no-lake columns ! ! !LOCAL VARIABLES: integer :: i @@ -1037,6 +1040,8 @@ subroutine Summary(this, bounds, & filter_soilp = filter_soilp, & num_allc = num_allc, & filter_allc = filter_allc, & + num_nolakec = num_nolakec, & + filter_nolakec = filter_nolakec, & waterstate_inst = bulk_or_tracer%waterstate_inst, & waterflux_inst = bulk_or_tracer%waterflux_inst) end associate diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 400aa65f56..927acabf49 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1112,7 +1112,8 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call water_inst%Summary(bounds_clump, & filter(nc)%num_soilp, filter(nc)%soilp, & - filter(nc)%num_allc, filter(nc)%allc) + filter(nc)%num_allc, filter(nc)%allc, & + filter(nc)%num_nolakec, filter(nc)%nolakec) ! ============================================================================ ! Check the energy and water balance From 36454eb38caf81bdd18fd92d99d671a6547b0962 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 8 Feb 2021 21:07:30 -0700 Subject: [PATCH 1815/1973] Add handling of TOTSOILICE and TOTSOILLIQ to Summary for #932 as well, finishing it off --- src/biogeophys/WaterDiagnosticBulkType.F90 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index 55125f232d..d592948f9b 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -855,13 +855,16 @@ subroutine Summary(this, bounds, & character(len=*), parameter :: subname = 'Summary' !----------------------------------------------------------------------- - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface depth (m) + associate( & + dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness depth (m) + zi => col%zi , & ! Input: [real(r8) (:,:) ] interface depth (m) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_liqice_10cm => this%h2osoi_liqice_10cm_col & ! Output: [real(r8) (:) ] liquid water + ice lens in top 10cm of soil (kg/m2) + h2osoi_ice => waterstate_inst%h2osoi_ice_col, & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) + h2osoi_liq => waterstate_inst%h2osoi_liq_col, & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) + + h2osoi_ice_tot => this%h2osoi_ice_tot_col , & ! Output: [real(r8) (:) ] vertically summed ice lens (kg/m2) + h2osoi_liq_tot => this%h2osoi_liq_tot_col , & ! Output: [real(r8) (:) ] vertically summed liquid water (kg/m2) + h2osoi_liqice_10cm => this%h2osoi_liqice_10cm_col & ! Output: [real(r8) (:) ] liquid water + ice lens in top 10cm of soil (kg/m2) ) call this%waterdiagnostic_type%Summary(bounds, & @@ -892,6 +895,8 @@ subroutine Summary(this, bounds, & l = col%landunit(c) if (.not. lun%urbpoi(l)) then h2osoi_liqice_10cm(c) = 0.0_r8 + h2osoi_liq_tot(c) = 0._r8 + h2osoi_ice_tot(c) = 0._r8 end if end do do j = 1, nlevsoi @@ -912,6 +917,8 @@ subroutine Summary(this, bounds, & fracl end if end if + h2osoi_liq_tot(c) = h2osoi_liq_tot(c) + h2osoi_liq(c,j) + h2osoi_ice_tot(c) = h2osoi_ice_tot(c) + h2osoi_ice(c,j) end if end do end do From 493ba048a5aa784bda0d0c55e867405acabe84fe Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 8 Feb 2021 21:55:49 -0700 Subject: [PATCH 1816/1973] Remove sum of h2osoi_liq_tot and h2osoi_ice_tot from HydrologyNoDrainage as it's moved to the Summary routine (note also for validation I checked that answers stay the same for these variables if I use the previous version of HydrologyNoDrainage and comment out the sums in Summary and it does). --- src/biogeophys/HydrologyNoDrainageMod.F90 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index a3803238b4..d65a01e2b9 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -247,8 +247,6 @@ subroutine HydrologyNoDrainage(bounds, & snow_persistence => b_waterstate_inst%snow_persistence_col , & ! Output: [real(r8) (:) ] counter for length of time snow-covered h2osoi_ice => b_waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) h2osoi_liq => b_waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice_tot => b_waterdiagnostic_inst%h2osoi_ice_tot_col , & ! Output: [real(r8) (:) ] vertically summed ice lens (kg/m2) - h2osoi_liq_tot => b_waterdiagnostic_inst%h2osoi_liq_tot_col , & ! Output: [real(r8) (:) ] vertically summed liquid water (kg/m2) h2osoi_vol => b_waterstate_inst%h2osoi_vol_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] h2osno_top => b_waterdiagnostic_inst%h2osno_top_col , & ! Output: [real(r8) (:) ] mass of snow in top layer (col) [kg] wf => b_waterdiagnostic_inst%wf_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.05 m @@ -510,8 +508,6 @@ subroutine HydrologyNoDrainage(bounds, & if (.not. lun%urbpoi(l)) then t_soi_10cm(c) = 0._r8 tsoi17(c) = 0._r8 - h2osoi_liq_tot(c) = 0._r8 - h2osoi_ice_tot(c) = 0._r8 end if end do do j = 1, nlevsoi @@ -543,9 +539,6 @@ subroutine HydrologyNoDrainage(bounds, & end if end if - h2osoi_liq_tot(c) = h2osoi_liq_tot(c) + h2osoi_liq(c,j) - h2osoi_ice_tot(c) = h2osoi_ice_tot(c) + h2osoi_ice(c,j) - end if end do end do From c004581e74fce7f12f335e272d76c975cd9bfae0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 8 Feb 2021 23:00:25 -0700 Subject: [PATCH 1817/1973] Add ADspinup test --- cime_config/testdefs/testlist_clm.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 95db622a9c..8c91bd9d88 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1813,6 +1813,15 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + + + + + + + + From 27cac9294bfd32cdb5be0ec42c4e3a6407fa40d1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 8 Feb 2021 23:20:45 -0700 Subject: [PATCH 1818/1973] Update paramsfile to fix issues #1262, #1184, and #478 --- bld/namelist_files/namelist_defaults_ctsm.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index e73adfe305..3ccbe89a0e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -473,9 +473,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c210115.nc -lnd/clm2/paramdata/clm50_params.c210112.nc -lnd/clm2/paramdata/clm45_params.c210112.nc +lnd/clm2/paramdata/ctsm51_params.c210208.nc +lnd/clm2/paramdata/clm50_params.c210208.nc +lnd/clm2/paramdata/clm45_params.c210208.nc From 329977fb7d08be4aed309e6793e917cb300dfa2d Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Feb 2021 10:55:45 -0700 Subject: [PATCH 1819/1973] Add year in Lombardozzi method --- src/biogeophys/OzoneMod.F90 | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/biogeophys/OzoneMod.F90 b/src/biogeophys/OzoneMod.F90 index 95d6fde5c4..8e3a5d0dc2 100644 --- a/src/biogeophys/OzoneMod.F90 +++ b/src/biogeophys/OzoneMod.F90 @@ -9,7 +9,9 @@ module OzoneMod ! computed here. Thus, the ozone stress computed in timestep i is applied in timestep ! (i+1), requiring these stresses to be saved on the restart file. ! - ! Developed by Danica Lombardozzi. + ! Developed by Danica Lombardozzi: Lombardozzi, D., S. Levis, G. Bonan, P. G. Hess, and + ! J. P. Sparks (2015), The Influence of Chronic Ozone Exposure on Global Carbon and + ! Water Cycles, J Climate, 28(1), 292–305, doi:10.1175/JCLI-D-14-00223.1. ! ! !USES: #include "shr_assert.h" @@ -68,15 +70,15 @@ module OzoneMod ! Calculate ozone uptake for a single point, for just sunlit or shaded leaves procedure, private, nopass :: CalcOzoneUptakeOnePoint - ! Original ozone stress parameterization, from Danica Lombardozzi - procedure, private :: CalcOzoneStressLombardozzi + ! Original ozone stress parameterization, from Danica Lombardozzi 2015 + procedure, private :: CalcOzoneStressLombardozzi2015 ! Calculate ozone stress for a single point, for just sunlit or shaded leaves - procedure, private, nopass :: CalcOzoneStressLombardozziOnePoint + procedure, private, nopass :: CalcOzoneStressLombardozzi2015OnePoint end type ozone_type ! !PRIVATE TYPES: - integer, parameter :: stress_method_lombardozzi = 1 + integer, parameter :: stress_method_lombardozzi2015 = 1 ! TODO(wjs, 2014-09-29) This parameter will eventually become a spatially-varying ! value, obtained from ATM @@ -132,7 +134,7 @@ subroutine Init(this, bounds) !----------------------------------------------------------------------- ! TODO(wjs, 2021-02-06) This will be based on a namelist variable - this%stress_method = stress_method_lombardozzi + this%stress_method = stress_method_lombardozzi2015 call this%InitAllocate(bounds) call this%InitHistory(bounds) @@ -445,8 +447,8 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) !----------------------------------------------------------------------- select case (this%stress_method) - case (stress_method_lombardozzi) - call this%CalcOzoneStressLombardozzi(bounds, num_exposedvegp, filter_exposedvegp) + case (stress_method_lombardozzi2015) + call this%CalcOzoneStressLombardozzi2015(bounds, num_exposedvegp, filter_exposedvegp) case default write(iulog,*) 'ERROR: unknown ozone stress method: ', this%stress_method call endrun('Unknown ozone stress method') @@ -455,12 +457,12 @@ subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp) end subroutine CalcOzoneStress !----------------------------------------------------------------------- - subroutine CalcOzoneStressLombardozzi(this, bounds, num_exposedvegp, filter_exposedvegp) + subroutine CalcOzoneStressLombardozzi2015(this, bounds, num_exposedvegp, filter_exposedvegp) ! ! !DESCRIPTION: ! Calculate ozone stress. ! - ! This subroutine uses the Lombardozzi formulation for ozone stress + ! This subroutine uses the Lombardozzi2015 formulation for ozone stress ! ! !ARGUMENTS: class(ozone_type), intent(inout) :: this @@ -472,7 +474,7 @@ subroutine CalcOzoneStressLombardozzi(this, bounds, num_exposedvegp, filter_expo integer :: fp ! filter index integer :: p ! patch index - character(len=*), parameter :: subname = 'CalcOzoneStressLombardozzi' + character(len=*), parameter :: subname = 'CalcOzoneStressLombardozzi2015' !----------------------------------------------------------------------- associate( & @@ -488,12 +490,12 @@ subroutine CalcOzoneStressLombardozzi(this, bounds, num_exposedvegp, filter_expo p = filter_exposedvegp(fp) ! Ozone stress for shaded leaves - call CalcOzoneStressLombardozziOnePoint( & + call CalcOzoneStressLombardozzi2015OnePoint( & pft_type=patch%itype(p), o3uptake=o3uptakesha(p), & o3coefv=o3coefvsha(p), o3coefg=o3coefgsha(p)) ! Ozone stress for sunlit leaves - call CalcOzoneStressLombardozziOnePoint( & + call CalcOzoneStressLombardozzi2015OnePoint( & pft_type=patch%itype(p), o3uptake=o3uptakesun(p), & o3coefv=o3coefvsun(p), o3coefg=o3coefgsun(p)) end do @@ -501,17 +503,17 @@ subroutine CalcOzoneStressLombardozzi(this, bounds, num_exposedvegp, filter_expo end associate - end subroutine CalcOzoneStressLombardozzi + end subroutine CalcOzoneStressLombardozzi2015 !----------------------------------------------------------------------- - subroutine CalcOzoneStressLombardozziOnePoint( & + subroutine CalcOzoneStressLombardozzi2015OnePoint( & pft_type, o3uptake, & o3coefv, o3coefg) ! ! !DESCRIPTION: ! Calculates ozone stress for a single point, for just sunlit or shaded leaves ! - ! This subroutine uses the Lombardozzi formulation for ozone stress + ! This subroutine uses the Lombardozzi2015 formulation for ozone stress ! ! !ARGUMENTS: integer , intent(in) :: pft_type ! vegetation type, for indexing into pftvarcon arrays @@ -525,7 +527,7 @@ subroutine CalcOzoneStressLombardozziOnePoint( & real(r8) :: condInt ! intercept for conductance real(r8) :: condSlope ! slope for conductance - character(len=*), parameter :: subname = 'CalcOzoneStressLombardozziOnePoint' + character(len=*), parameter :: subname = 'CalcOzoneStressLombardozzi2015OnePoint' !----------------------------------------------------------------------- if (o3uptake == 0._r8) then @@ -561,6 +563,6 @@ subroutine CalcOzoneStressLombardozziOnePoint( & end if - end subroutine CalcOzoneStressLombardozziOnePoint + end subroutine CalcOzoneStressLombardozzi2015OnePoint end module OzoneMod From ff4f3a793d71f57b002ca3ce0358cafe5aa23043 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Feb 2021 15:40:11 -0700 Subject: [PATCH 1820/1973] Update change files --- doc/ChangeLog | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 116 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index bc681f955a..479ba86070 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,119 @@ =============================================================== +Tag name: ctsm5.1.dev023 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Wed Feb 10 13:33:19 MST 2021 +One-line Summary: Calculate leaf biomass for non-woody PFTS, and a few other small answer changes + +Purpose and description of changes +---------------------------------- + +Replace hard code constant 0.25 for leaf mass per area with calculation based on parameter slatop (specific leaf area, top of +canopy). Also move num_iter into loop over patches; currently it sits outside a loop, so p index is incorrect. + +Also do some small answer changes in terms of new parameter files, and some other existing issues that have mild answer changes. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ +Issues fixed (include CTSM Issue #): + Fixes #1256 + Fixes #1268 + Fixes #1262 + Fixes #1261 + Fixes #1256 + Fixes #1255 + Fixes #1252 + Fixes #1184 + Fixes #932 + Fixes #478 + +Known bugs found since the previous tag (include issue #): + #1274 -- Dead PFTs in PPE2_BHSon simulations + + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): + +Changes made to namelist defaults (e.g., changed parameter values): + Parameter files are updated + +Changes to the datasets (e.g., parameter, surface or initial files): + +Notes of particular relevance for developers: +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: Add ADspinup test + Add an ADspinup restart test that would've detected one of the bugs fixed here + + +Testing summary: regular tools +---------------- + + [PASS means all tests PASS; OK means tests PASS other than expected fails.] + + build-namelist tests (if CLMBuildNamelist.pm has changed): + + cheyenne - PASS (348 tests are different because of parameter file update) + + tools-tests (test/tools) (if tools have been changed): + + cheyenne - PASS + + python testing (if python code has changed; see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- PASS + izumi ------- PASS + + any other testing (give details below): + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: Yes, clm51, clm50-non-crop, clm45 two diagnostics + + Summarize any changes to answers, i.e., + - what code configurations: clm5_1 for all, clm50 for non-crop (Sp and Bgc), clm4_5 two diagnostics + - what platforms/compilers: All + - nature of change: clm51--BGC climate, others similar climate + +Other details +------------- +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + + #1254 -- replace constant leaf mass per area (lma) + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev022 Originator(s): gregorylemieux (Gregory Lemieux,LBL/NGEET,510-486-5049) Date: Fri Feb 5 00:03:28 MST 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index ffd5a805a4..d6059635da 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev023 erik 02/10/2021 Calculate leaf biomass for non-woody PFTS, and a few other small answer changes ctsm5.1.dev022 glemieux 02/05/2021 Merge fates_main_api into ctsm master ctsm5.1.dev021 erik 01/12/2021 Add option for biomass heat storage (BHS) to clm5_1 physics ctsm5.1.dev020 erik 12/30/2020 Potential roundoff changes in preparation for bio-mass heat storage option From 0da34ed0e3fb915005e87a92e529916cc82d2ff8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Feb 2021 22:16:40 -0700 Subject: [PATCH 1821/1973] Go back to previous version of urban dataset so that you can at least use a created surface dataset with this version partial fix for #1252 --- bld/namelist_files/namelist_defaults_ctsm_tools.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm_tools.xml b/bld/namelist_files/namelist_defaults_ctsm_tools.xml index 2a14f2df50..78ab368110 100644 --- a/bld/namelist_files/namelist_defaults_ctsm_tools.xml +++ b/bld/namelist_files/namelist_defaults_ctsm_tools.xml @@ -269,7 +269,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd/clm2/rawdata/mksrf_urban_0.05x0.05_simyr2000.c170724.nc +>lnd/clm2/rawdata/mksrf_urban_0.05x0.05_simyr2000.c120621.nc lnd/clm2/rawdata/mksrf_urban_0.05x0.05_zerourbanpct.c181014.nc From 52210c5c93a637669f415d30bfa3fe91efb3dbb1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 11 Feb 2021 00:06:23 -0700 Subject: [PATCH 1822/1973] Add a mkmapdata script test for a single-point and do what's needed for it to run --- test/tools/README | 2 +- test/tools/nl_files/mkmapdata_i1x1_brazil | 1 + test/tools/nl_files/mkmapdata_if10 | 2 +- test/tools/test_driver.sh | 1 + test/tools/tests_pretag_cheyenne_nompi | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 test/tools/nl_files/mkmapdata_i1x1_brazil diff --git a/test/tools/README b/test/tools/README index 4929144b20..8972894527 100644 --- a/test/tools/README +++ b/test/tools/README @@ -13,7 +13,7 @@ To use... on cheyenne -qcmd -l walltime=06:00:00 -- ./test_driver.sh -i >& run.out & +qcmd -l select=mem=109GB -l walltime=06:00:00 -- ./test_driver.sh -i >& run.out & Intended for use on NCAR machines cheyenne, geyser (DAV) and hobart. diff --git a/test/tools/nl_files/mkmapdata_i1x1_brazil b/test/tools/nl_files/mkmapdata_i1x1_brazil new file mode 100644 index 0000000000..879ffa6d47 --- /dev/null +++ b/test/tools/nl_files/mkmapdata_i1x1_brazil @@ -0,0 +1 @@ +-t regional -r 1x1_brazil diff --git a/test/tools/nl_files/mkmapdata_if10 b/test/tools/nl_files/mkmapdata_if10 index 1c30796e2e..c3218edc1c 100644 --- a/test/tools/nl_files/mkmapdata_if10 +++ b/test/tools/nl_files/mkmapdata_if10 @@ -1 +1 @@ --t regional -r 10x15 +-r 10x15 diff --git a/test/tools/test_driver.sh b/test/tools/test_driver.sh index 0cd322b9d2..28ecb07072 100755 --- a/test/tools/test_driver.sh +++ b/test/tools/test_driver.sh @@ -78,6 +78,7 @@ export MACH_WORKSPACE="/glade/scratch" export CPRNC_EXE="$CESMDATAROOT/tools/cime/tools/cprnc/cprnc.cheyenne" dataroot="$CESMDATAROOT" export TOOLSLIBS="" +export REGRID_PROC=1 export TOOLS_CONF_STRING="--mpilib mpi-serial" diff --git a/test/tools/tests_pretag_cheyenne_nompi b/test/tools/tests_pretag_cheyenne_nompi index b80d9a78c1..3bdeef5deb 100644 --- a/test/tools/tests_pretag_cheyenne_nompi +++ b/test/tools/tests_pretag_cheyenne_nompi @@ -1,3 +1,4 @@ +smi79 bli79 smc#4 blc#4 sme14 ble14 sme@4 ble@4 From c49631da7726b8d1f0b4af5016708a138004f41c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 11 Feb 2021 00:07:26 -0700 Subject: [PATCH 1823/1973] Add a module purge at the start on cheyenne, so that it's for sure loading the desired modules --- tools/mkmapdata/mkmapdata.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index c778261234..9c5ef63db4 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -344,6 +344,7 @@ case $hostname in fi esmfvers=7.1.0r intelvers=18.0.5 # Could also use intel/19.0.2 EBK 10/4/2019 + module purge module load intel/$intelvers module load esmf_libs/$esmfvers module load ncl From 5613c355151fc529ff99b02ba5db5046a0898abb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 11 Feb 2021 00:14:19 -0700 Subject: [PATCH 1824/1973] More updates to change files --- doc/ChangeLog | 24 +++++++++++------------- doc/ChangeSum | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 479ba86070..f959e21e1f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev023 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Feb 10 13:33:19 MST 2021 +Date: Thu Feb 11 00:14:03 MST 2021 One-line Summary: Calculate leaf biomass for non-woody PFTS, and a few other small answer changes Purpose and description of changes @@ -33,16 +33,15 @@ Does this tag change answers significantly for any of the following physics conf Bugs fixed or introduced ------------------------ Issues fixed (include CTSM Issue #): - Fixes #1256 - Fixes #1268 - Fixes #1262 - Fixes #1261 - Fixes #1256 - Fixes #1255 - Fixes #1252 - Fixes #1184 - Fixes #932 - Fixes #478 + Fixes #1256 -- num_iter incorrect + Fixes #1268 -- Leaf biomass not updated for + Fixes #1262 -- pconv should be 1 for crops + Fixes #1261 -- Restarts fail in AD-spinup mode + Fixes #1255 -- mkmapdata crashes because of modules + Fixes #1252 -- New urban dataset for fsurdat fails when used with new model + Fixes #1184 -- slatop for generic crop + Fixes #932 --- Diagnostic variables are incorrect + Fixes #478 --- Bare soil g1 should be zero Known bugs found since the previous tag (include issue #): #1274 -- Dead PFTs in PPE2_BHSon simulations @@ -51,8 +50,6 @@ Known bugs found since the previous tag (include issue #): Notes of particular relevance for users --------------------------------------- -Caveats for users (e.g., need to interpolate initial conditions): - Changes made to namelist defaults (e.g., changed parameter values): Parameter files are updated @@ -63,6 +60,7 @@ Notes of particular relevance for developers: NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Leaf biomass should still be completely moved outside of CanopyFluxes Changes to tests or testing: Add ADspinup test Add an ADspinup restart test that would've detected one of the bugs fixed here diff --git a/doc/ChangeSum b/doc/ChangeSum index d6059635da..68c10d64a1 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev023 erik 02/10/2021 Calculate leaf biomass for non-woody PFTS, and a few other small answer changes + ctsm5.1.dev023 erik 02/11/2021 Calculate leaf biomass for non-woody PFTS, and a few other small answer changes ctsm5.1.dev022 glemieux 02/05/2021 Merge fates_main_api into ctsm master ctsm5.1.dev021 erik 01/12/2021 Add option for biomass heat storage (BHS) to clm5_1 physics ctsm5.1.dev020 erik 12/30/2020 Potential roundoff changes in preparation for bio-mass heat storage option From 6768534c40e9a185a45aff256af819160bd731ae Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 13 Feb 2021 17:28:40 -0700 Subject: [PATCH 1825/1973] Bypass grc-level h2o check when use_soil_moisture_streams = .true. --- src/biogeophys/BalanceCheckMod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index c0aafe60e9..79eab50610 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -18,7 +18,6 @@ module BalanceCheckMod use EnergyFluxType , only : energyflux_type use SolarAbsorbedType , only : solarabs_type use SoilHydrologyType , only : soilhydrology_type - use SurfaceAlbedoType , only : surfalb_type use WaterStateType , only : waterstate_type use LakestateType , only : lakestate_type use WaterDiagnosticBulkType, only : waterdiagnosticbulk_type @@ -399,6 +398,7 @@ subroutine BalanceCheck( bounds, & ! ! !USES: use clm_varcon , only : spval + use clm_varctl , only : use_soil_moisture_streams use clm_time_manager , only : get_step_size_real, get_nstep use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause use CanopyStateType , only : canopystate_type @@ -724,6 +724,7 @@ subroutine BalanceCheck( bounds, & ' local indexg= ',indexg,& ' errh2o_grc= ',errh2o_grc(indexg) if (errh2o_max_val > error_thresh .and. DAnstep > skip_steps .and. & + .not. use_soil_moisture_streams .and. & .not. get_for_testing_zero_dynbal_fluxes()) then write(iulog,*)'CTSM is stopping because errh2o > ', error_thresh, ' mm' From 8409364397a304097c220cdeb49d1a2d0862eed8 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 16 Feb 2021 15:42:02 -0700 Subject: [PATCH 1826/1973] changes needed for nag --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 9 ++++----- src/cpl/nuopc/lnd_import_export.F90 | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index de743d481e..14ab1032f5 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -279,11 +279,11 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(iulog,'(a )')' atm component = '//trim(atm_model) write(iulog,'(a )')' rof component = '//trim(rof_model) write(iulog,'(a )')' glc component = '//trim(glc_model) - write(iulog,'(a,l )')' atm_prognostic = ',atm_prognostic - write(iulog,'(a,l )')' rof_prognostic = ',rof_prognostic - write(iulog,'(a,l )')' glc_present = ',glc_present + write(iulog,'(a,L1 )')' atm_prognostic = ',atm_prognostic + write(iulog,'(a,L1 )')' rof_prognostic = ',rof_prognostic + write(iulog,'(a,L1 )')' glc_present = ',glc_present if (glc_present) then - write(iulog,'(a,l)')' cism_evolve = ',cism_evolve + write(iulog,'(a,L1)')' cism_evolve = ',cism_evolve end if write(iulog,'(a )')' flds_scalar_name = '//trim(flds_scalar_name) write(iulog,'(a,i8)')' flds_scalar_num = ',flds_scalar_num @@ -328,7 +328,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) type(ESMF_Time) :: startTime ! Start time type(ESMF_Time) :: refTime ! Ref time type(ESMF_TimeInterval) :: timeStep ! Model timestep - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type integer :: ref_ymd ! reference date (YYYYMMDD) integer :: ref_tod ! reference time of day (sec) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 3839ff6331..1c5a6423ad 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -216,11 +216,11 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r if (flds_co2b .or. flds_co2c) send_co2_to_atm = .true. if (flds_co2a .or. flds_co2b .or. flds_co2c) recv_co2_fr_atm = .true. if (masterproc) then - write(iulog,'(a,l)') 'flds_co2a= ',flds_co2a - write(iulog,'(a,l)') 'flds_co2b= ',flds_co2b - write(iulog,'(a,l)') 'flds_co2c= ',flds_co2c - write(iulog,'(a,l)') 'sending co2 to atm = ',send_co2_to_atm - write(iulog,'(a,l)') 'receiving co2 from atm = ',recv_co2_fr_atm + write(iulog,'(a,l1)') 'flds_co2a= ',flds_co2a + write(iulog,'(a,l1)') 'flds_co2b= ',flds_co2b + write(iulog,'(a,l1)') 'flds_co2c= ',flds_co2c + write(iulog,'(a,l1)') 'sending co2 to atm = ',send_co2_to_atm + write(iulog,'(a,l1)') 'receiving co2 from atm = ',recv_co2_fr_atm end if end if From 59576bf329336a4f0591f5752c56c73118c9e187 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Thu, 18 Feb 2021 09:04:02 -0700 Subject: [PATCH 1827/1973] add tolerance parameter --- src/biogeophys/SoilFluxesMod.F90 | 9 ++++----- src/biogeophys/SoilHydrologyMod.F90 | 14 +++++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index ffb6aa8056..d94dac723e 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -5,7 +5,7 @@ module SoilFluxesMod ! Updates surface fluxes based on the new ground temperature. ! ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, r4 => shr_kind_r4 + use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use abortutils , only : endrun @@ -78,8 +78,8 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & real(r8) :: eflx_lwrad_del(bounds%begp:bounds%endp) ! update due to eflx_lwrad real(r8) :: t_grnd0(bounds%begc:bounds%endc) ! t_grnd of previous time step real(r8) :: lw_grnd - real(r8) :: evaporation_limit - real(r8) :: ev_unconstrained + real(r8) :: evaporation_limit ! top layer moisture available for evaporation + real(r8) :: ev_unconstrained ! evaporative demand !----------------------------------------------------------------------- associate( & @@ -361,8 +361,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! limit only solid evaporation (sublimation) from top soil layer ! (liquid evaporation from soil should not be limited) if (j==1 .and. frac_h2osfc(c) < 1._r8) then - - if (real((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(p) * dtime,r4) > real(h2osoi_ice(c,j),r4)) then + if (((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(p)*dtime) >= h2osoi_ice(c,j)) then qflx_liqevap_from_top_layer(p) & = qflx_liqevap_from_top_layer(p) & diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 index 61f0767ce4..cc79fd9461 100644 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ b/src/biogeophys/SoilHydrologyMod.F90 @@ -66,6 +66,7 @@ module SoilHydrologyMod !----------------------------------------------------------------------- real(r8), private :: baseflow_scalar = 1.e-2_r8 + real(r8), parameter :: tolerance = 1.e-12_r8 ! tolerance for checking whether sublimation is greater than ice in top soil layer character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -850,8 +851,8 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil qflx_ev_snow(c) = qflx_ev_snow(c) - (qflx_solidevap_from_top_layer_save & - qflx_solidevap_from_top_layer(c)) - if((abs((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1))) > 1.e-8) then - call endrun(msg="solid evap too large! "//errmsg(sourcefile, __LINE__)) + if((abs((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1))) > tolerance) then + call endrun(msg="qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) endif h2osoi_ice(c,1) = 0._r8 else @@ -2322,10 +2323,13 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & if ((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then qflx_solidevap_from_top_layer_save = qflx_solidevap_from_top_layer(c) qflx_solidevap_from_top_layer(c) = h2osoi_ice(c,1)/dtime - qflx_ev_snow(c) = qflx_ev_snow(c) - (qflx_solidevap_from_top_layer_save & + qflx_ev_snow(c) = qflx_ev_snow(c) & + - (qflx_solidevap_from_top_layer_save & - qflx_solidevap_from_top_layer(c)) - if((abs((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1))) > 1.e-8) then - call endrun(msg="solid evap too large! "//errmsg(sourcefile, __LINE__)) + ! qflx_solidevap_from_top_layer should be constrained + ! in SoilFluxesMod to be <= h2osoi_ice, but check here + if((abs((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1))) > tolerance) then + call endrun(msg="qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) endif h2osoi_ice(c,1) = 0._r8 From 09e35531f7422229a332fe7e972801981339e9f4 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 18 Feb 2021 18:02:52 -0700 Subject: [PATCH 1828/1973] Revisions required for I*G tests and *clm-prescribed tests to PASS 1) Addressed the former with some code reorg. At the crux of it though was the need to pass subtract_dynbal_baselines = .true. and add_lake_water_and_subtract_dynbal_baselines = .true. instead of .false. when calling ComputeWaterMassNonLake and ComputeWaterMassLake at the beginning and end of the time step. 2) Addressed the *clm-prescribed test failure by bypassing the grc-level water balance check when use_soil_moisture_streams = .false. --- src/biogeophys/BalanceCheckMod.F90 | 183 ++++++++++++++++------------- src/main/clm_driver.F90 | 12 +- src/main/lnd2atmMod.F90 | 4 +- 3 files changed, 113 insertions(+), 86 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 79eab50610..e1d7497198 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -44,7 +44,7 @@ module BalanceCheckMod ! !PUBLIC MEMBER FUNCTIONS: public :: BalanceCheckInit ! Initialization of Water and energy balance check - public :: BeginWaterGridcellBalance ! Initialize grid cell-level water balance check + public :: WaterGridcellBalance ! Grid cell-level water balance check public :: BeginWaterColumnBalance ! Initialize column-level water balance check public :: BalanceCheck ! Water & energy balance checks public :: GetBalanceCheckSkipSteps ! Get the number of steps to skip for the balance check @@ -56,7 +56,7 @@ module BalanceCheckMod ! ! !PRIVATE MEMBER FUNCTIONS: - private :: BeginWaterGridcellBalanceSingle ! Initialize grid cell-level water balance check for bulk or a single tracer + private :: WaterGridcellBalanceSingle ! Grid cell-level water balance check for bulk or a single tracer private :: BeginWaterColumnBalanceSingle ! Initialize column-level water balance check for bulk or a single tracer character(len=*), parameter, private :: sourcefile = & @@ -123,13 +123,12 @@ end function GetBalanceCheckSkipSteps !----------------------------------------------------------------------- !----------------------------------------------------------------------- - subroutine BeginWaterGridcellBalance(bounds, & + subroutine WaterGridcellBalance(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, lakestate_inst) + water_inst, lakestate_inst, use_aquifer_layer, flag) ! ! !DESCRIPTION: - ! Initialize grid cell-level water balance at beginning of time step - ! for bulk water and each water tracer + ! Grid cell-level water balance for bulk water and each water tracer ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -139,25 +138,28 @@ subroutine BeginWaterGridcellBalance(bounds, & integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(water_type) , intent(inout) :: water_inst type(lakestate_type) , intent(in) :: lakestate_inst + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run + character(len=5) , intent(in) :: flag ! specifies begwb or endwb ! ! !LOCAL VARIABLES: integer :: i - character(len=*), parameter :: subname = 'BeginWaterGridcellBalance' + character(len=*), parameter :: subname = 'WaterGridcellBalance' !----------------------------------------------------------------------- do i = water_inst%bulk_and_tracers_beg, water_inst%bulk_and_tracers_end - call BeginWaterGridcellBalanceSingle(bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & + ! Obtain begwb_grc + call WaterGridcellBalanceSingle(bounds, & + num_nolakec, filter_nolakec, num_lakec, filter_lakec, & lakestate_inst, & water_inst%bulk_and_tracers(i)%waterstate_inst, & water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, & water_inst%bulk_and_tracers(i)%waterbalance_inst, & - water_inst%bulk_and_tracers(i)%waterflux_inst) + water_inst%bulk_and_tracers(i)%waterflux_inst, & + use_aquifer_layer = use_aquifer_layer, flag = flag) end do - end subroutine BeginWaterGridcellBalance + end subroutine WaterGridcellBalance !----------------------------------------------------------------------- subroutine BeginWaterColumnBalance(bounds, & @@ -201,14 +203,14 @@ subroutine BeginWaterColumnBalance(bounds, & end subroutine BeginWaterColumnBalance !----------------------------------------------------------------------- - subroutine BeginWaterGridcellBalanceSingle(bounds, & + subroutine WaterGridcellBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - lakestate_inst, waterstate_inst, & - waterdiagnostic_inst, waterbalance_inst, waterflux_inst) + lakestate_inst, waterstate_inst, waterdiagnostic_inst, & + waterbalance_inst, waterflux_inst, use_aquifer_layer, flag) ! ! !DESCRIPTION: - ! Initialize grid cell-level water balance at beginning of time step - ! for bulk or a single tracer + ! Grid cell-level water balance for bulk or a single tracer + ! at beginning or end of time step as specified by "flag" ! ! !USES: use subgridAveMod, only: c2g @@ -221,20 +223,28 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & integer , intent(in) :: filter_lakec(:) ! column filter for lake points type(lakestate_type) , intent(in) :: lakestate_inst class(waterstate_type) , intent(inout) :: waterstate_inst - class(waterflux_type) , intent(inout) :: waterflux_inst class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst class(waterbalance_type) , intent(inout) :: waterbalance_inst + class(waterflux_type) , intent(inout) :: waterflux_inst + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run + character(len=5) , intent(in) :: flag ! specifies begwb or endwb ! ! !LOCAL VARIABLES: integer :: g ! indices integer :: begc, endc, begg, endg ! bounds - real(r8) :: qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at beginning of time step - real(r8) :: qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc ice dynamic land cover change conversion runoff flux at beginning of time step + real(r8) :: wb_col(bounds%begc:bounds%endc) ! temporary column-level water mass + real(r8) :: wb_grc(bounds%begg:bounds%endg) ! temporary grid cell-level water mass + real(r8) :: qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux + real(r8) :: qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc ice dynamic land cover change conversion runoff flux + real(r8) :: wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg) ! grc mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) + + character(len=*), parameter :: subname = 'WaterGridcellBalanceSingle' !----------------------------------------------------------------------- associate( & - begwb_col => waterbalance_inst%begwb_col, & ! Output: [real(r8) (:) ] column-level water mass begining of the time step - begwb_grc => waterbalance_inst%begwb_grc & ! Output: [real(r8) (:) ] grid cell-level water mass begining of the time step + begwb_grc => waterbalance_inst%begwb_grc, & ! Output: [real(r8) (:)] grid cell-level water mass begining of the time step + endwb_grc => waterbalance_inst%endwb_grc, & ! Output: [real(r8) (:)] grid cell-level water mass end of the time step + wa_reset_nonconservation_gain_col => waterbalance_inst%wa_reset_nonconservation_gain_col & ! Input: [real(r8) (:)] col mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) ) begc = bounds%begc @@ -242,27 +252,40 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & begg = bounds%begg endg = bounds%endg - ! NOTES subroutines Compute*Mass* are in TotalWaterAndHeatMod.F90 - ! endwb is calculated in HydrologyDrainageMod & LakeHydrologyMod call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & waterstate_inst, waterdiagnostic_inst, & - subtract_dynbal_baselines = .false., & - water_mass = begwb_col(begc:endc)) + subtract_dynbal_baselines = .true., & + water_mass = wb_col(begc:endc)) call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, lakestate_inst, & - add_lake_water_and_subtract_dynbal_baselines = .false., & - water_mass = begwb_col(begc:endc)) + add_lake_water_and_subtract_dynbal_baselines = .true., & + water_mass = wb_col(begc:endc)) - call c2g(bounds, begwb_col(begc:endc), begwb_grc(begg:endg), & + call c2g(bounds, wb_col(begc:endc), wb_grc(begg:endg), & c2l_scale_type='urbanf', l2g_scale_type='unity') - call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_beg( & - bounds, & - qflx_liq_dynbal_left_to_dribble(begg:endg)) - call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_beg( & - bounds, & - qflx_ice_dynbal_left_to_dribble(begg:endg)) + ! Call the beginning or ending version of the subroutine according + ! to flag value + if (flag == 'begwb') then + call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_beg( & + bounds, & + qflx_liq_dynbal_left_to_dribble(begg:endg)) + call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_beg( & + bounds, & + qflx_ice_dynbal_left_to_dribble(begg:endg)) + else if (flag == 'endwb') then + call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_end( & + bounds, & + qflx_liq_dynbal_left_to_dribble(begg:endg)) + call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_end( & + bounds, & + qflx_ice_dynbal_left_to_dribble(begg:endg)) + else + write(iulog,*) 'Unknown flag passed into this subroutine.' + write(iulog,*) 'Expecting either begwb or endwb.' + call endrun(msg=errmsg(sourcefile, __LINE__)) + end if ! These dynbal dribblers store the delta state, (end - beg). Thus, the ! amount dribbled out is the negative of the amount stored in the @@ -271,16 +294,42 @@ subroutine BeginWaterGridcellBalanceSingle(bounds, & ! This sign convention is opposite to the convention chosen for the ! respective dribble terms used in the carbon balance. At some point ! it may be worth making the two conventions consistent. - ! Bill Sacks states: I think the convention used for the water and - ! energy dribblers is counter-intuitive. do g = begg, endg - begwb_grc(g) = begwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - - qflx_ice_dynbal_left_to_dribble(g) + wb_grc(g) = wb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & + - qflx_ice_dynbal_left_to_dribble(g) end do + ! Map wb_grc to beginning/ending water balance according to flag + if (flag == 'begwb') then + do g = begg, endg + begwb_grc(g) = wb_grc(g) + end do + else if (flag == 'endwb') then + ! endwb_grc requires one more step first + if (use_aquifer_layer) then + ! wa_reset_nonconservation_gain may be non-zero only when + ! use_aquifer_layer is true. We do this c2g call only when needed + ! to avoid unnecessary calculations; by adding this term only when + ! use_aquifer_layer is true, we effectively let the balance checks + ! ensure that this term is zero when use_aquifer_layer is false, + ! as it should be. + ! The _col term was determined in BeginWaterColumnBalanceSingle + ! after any dynamic landuse adjustments. + call c2g( bounds, & + wa_reset_nonconservation_gain_col(begc:endc), & + wa_reset_nonconservation_gain_grc(begg:endg), & + c2l_scale_type='urbanf', l2g_scale_type='unity' ) + else + wa_reset_nonconservation_gain_grc(begg:endg) = 0._r8 + end if + do g = begg, endg + endwb_grc(g) = wb_grc(g) - wa_reset_nonconservation_gain_grc(g) + end do + end if + end associate - end subroutine BeginWaterGridcellBalanceSingle + end subroutine WaterGridcellBalanceSingle !----------------------------------------------------------------------- subroutine BeginWaterColumnBalanceSingle(bounds, & @@ -377,6 +426,8 @@ end subroutine BeginWaterColumnBalanceSingle !----------------------------------------------------------------------- subroutine BalanceCheck( bounds, & num_allc, filter_allc, & + num_nolakec, filter_nolakec, num_lakec, filter_lakec, & + water_inst, lakestate_inst, & atm2lnd_inst, solarabs_inst, waterflux_inst, waterstate_inst, & waterdiagnosticbulk_inst, waterbalance_inst, wateratm2lnd_inst, & waterlnd2atm_inst, surfalb_inst, energyflux_inst, canopystate_inst, & @@ -410,6 +461,12 @@ subroutine BalanceCheck( bounds, & type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_allc ! number of columns in allc filter integer , intent(in) :: filter_allc(:) ! filter for all columns + integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter + integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points + integer , intent(in) :: num_lakec ! number of column lake points in column filter + integer , intent(in) :: filter_lakec(:) ! column filter for lake points + type(water_type) , intent(inout) :: water_inst + type(lakestate_type) , intent(in) :: lakestate_inst type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(solarabs_type) , intent(in) :: solarabs_inst class(waterflux_type) , intent(in) :: waterflux_inst @@ -436,9 +493,6 @@ subroutine BalanceCheck( bounds, & real(r8) :: qflx_glcice_dyn_water_flux_grc(bounds%begg:bounds%endg) ! grid cell-level water flux needed for balance check due to glc_dyn_runoff_routing [mm H2O/s] (positive means addition of water to the system) real(r8) :: qflx_snwcp_discarded_liq_grc(bounds%begg:bounds%endg) ! grid cell-level excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] real(r8) :: qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg) ! grid cell-level excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack [mm H2O /s] - real(r8) :: qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at end of time step - real(r8) :: qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg) ! grc liq dynamic land cover change conversion runoff flux at end of time step - real(r8) :: wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg) ! grc mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) real(r8) :: errh2o_max_val ! Maximum value of error in water conservation error over all columns [mm H2O] real(r8) :: errh2osno_max_val ! Maximum value of error in h2osno conservation error over all columns [kg m-2] @@ -491,7 +545,6 @@ subroutine BalanceCheck( bounds, & qflx_h2osfc_to_ice => waterflux_inst%qflx_h2osfc_to_ice_col , & ! Input: [real(r8) (:) ] conversion of h2osfc to ice qflx_drain_perched_col => waterflux_inst%qflx_drain_perched_col , & ! Input: [real(r8) (:) ] column level sub-surface runoff (mm H2O /s) qflx_drain_perched_grc => waterlnd2atm_inst%qflx_rofliq_drain_perched_grc, & ! Input: [real(r8) (:)] grid cell-level sub-surface runoff (mm H2O /s) - wa_reset_nonconservation_gain_col => waterbalance_inst%wa_reset_nonconservation_gain_col, & ! Output: [real(r8) (:) ] col mass gained from resetting water in the unconfined aquifer, wa_col (negative indicates mass lost) (mm) qflx_flood_col => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] column level total runoff due to flooding forc_flood_grc => wateratm2lnd_inst%forc_flood_grc , & ! Input: [real(r8) (:) ] grid cell-level total grid cell-level runoff from river model qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Input: [real(r8) (:) ] drainage from snow pack @@ -660,44 +713,14 @@ subroutine BalanceCheck( bounds, & qflx_snwcp_discarded_ice_col(bounds%begc:bounds%endc), & qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - if (use_aquifer_layer) then - ! wa_reset_nonconservation_gain may be non-zero only when - ! use_aquifer_layer is true. We do this c2g call only when needed - ! to avoid unnecessary calculations; by adding this term only when - ! use_aquifer_layer is true, we effectively let the balance checks - ! ensure that this term is zero when use_aquifer_layer is false, - ! as it should be. - ! The _col term was determined in BeginWaterColumnBalanceSingle - ! after any dynamic landuse adjustments. - call c2g( bounds, & - wa_reset_nonconservation_gain_col(bounds%begc:bounds%endc), & - wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg), & - c2l_scale_type='urbanf', l2g_scale_type='unity' ) - else - wa_reset_nonconservation_gain_grc(bounds%begg:bounds%endg) = 0._r8 - end if - call waterflux_inst%qflx_liq_dynbal_dribbler%get_amount_left_to_dribble_end( & - bounds, & - qflx_liq_dynbal_left_to_dribble(bounds%begg:bounds%endg)) - call waterflux_inst%qflx_ice_dynbal_dribbler%get_amount_left_to_dribble_end( & - bounds, & - qflx_ice_dynbal_left_to_dribble(bounds%begg:bounds%endg)) - - ! These dynbal dribblers store the delta state, (end - beg). Thus, the - ! amount dribbled out is the negative of the amount stored in the - ! dribblers. Therefore, conservation requires us to subtract the amount - ! remaining to dribble. - ! This sign convention is opposite to the convention chosen for the - ! respective dribble terms used in the carbon balance. At some point - ! it may be worth making the two conventions consistent. - ! Bill Sacks states: I think the convention used for the water and - ! energy dribblers is counter-intuitive. - do g = bounds%begg, bounds%endg - endwb_grc(g) = endwb_grc(g) - qflx_liq_dynbal_left_to_dribble(g) & - - qflx_ice_dynbal_left_to_dribble(g) & - - wa_reset_nonconservation_gain_grc(g) + ! Obtain endwb_grc + call WaterGridcellBalance(bounds, & + num_nolakec, filter_nolakec, num_lakec, filter_lakec, & + water_inst, lakestate_inst, & + use_aquifer_layer = use_aquifer_layer, flag = 'endwb') + do g = bounds%begg, bounds%endg errh2o_grc(g) = endwb_grc(g) - begwb_grc(g) & - (forc_rain_grc(g) & + forc_snow_grc(g) & diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 1df3a3640c..1122455abf 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -26,7 +26,7 @@ module clm_driver use abortutils , only : endrun ! use dynSubgridDriverMod , only : dynSubgrid_driver, dynSubgrid_wrapup_weight_changes - use BalanceCheckMod , only : BeginWaterGridcellBalance, BeginWaterColumnBalance, BalanceCheck + use BalanceCheckMod , only : WaterGridcellBalance, BeginWaterColumnBalance, BalanceCheck ! use BiogeophysPreFluxCalcsMod , only : BiogeophysPreFluxCalcs use SurfaceHumidityMod , only : CalculateSurfaceHumidity @@ -328,10 +328,11 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_stopf('begcnbal_grc') call t_startf('begwbal') - call BeginWaterGridcellBalance(bounds_clump, & + call WaterGridcellBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & - water_inst, lakestate_inst) + water_inst, lakestate_inst, & + use_aquifer_layer = use_aquifer_layer(), flag = 'begwb') call t_stopf('begwbal') end do !$OMP END PARALLEL DO @@ -370,7 +371,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! conserved when weights change (instead the difference is put in the grid cell-level ! terms, qflx_liq_dynbal, etc.). Grid cell-level balance ! checks ensure that the grid cell-level water is conserved by considering - ! qflx_liq_dynbal and calling BeginWaterGridcellBalance + ! qflx_liq_dynbal and calling WaterGridcellBalance ! before the weight updates. ! ! For carbon & nitrogen: This needs to be done after dynSubgrid_driver, because the @@ -1284,6 +1285,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call get_clump_bounds(nc, bounds_clump) call BalanceCheck(bounds_clump, & filter(nc)%num_allc, filter(nc)%allc, & + filter(nc)%num_nolakec, filter(nc)%nolakec, & + filter(nc)%num_lakec, filter(nc)%lakec, & + water_inst, lakestate_inst, & atm2lnd_inst, solarabs_inst, water_inst%waterfluxbulk_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & water_inst%waterbalancebulk_inst, water_inst%wateratm2lndbulk_inst, & diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index ed9d44f36f..b05013ea09 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -411,11 +411,11 @@ subroutine lnd2atm(bounds, & call c2g( bounds, & water_inst%waterbalancebulk_inst%endwb_col(bounds%begc:bounds%endc), & - water_inst%waterbalancebulk_inst%endwb_grc(bounds%begg:bounds%endg), & + water_inst%waterdiagnosticbulk_inst%tws_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) do g = bounds%begg, bounds%endg water_inst%waterdiagnosticbulk_inst%tws_grc(g) = & - water_inst%waterbalancebulk_inst%endwb_grc(g) + & + water_inst%waterdiagnosticbulk_inst%tws_grc(g) + & water_inst%wateratm2lndbulk_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8 enddo From 5a0ba100a094c7152fa0f7247d44f2e88a42823f Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Sat, 20 Feb 2021 14:51:46 -0700 Subject: [PATCH 1829/1973] Small updates to ChangeLog and ChangeSum --- doc/ChangeLog | 11 ++++------- doc/ChangeSum | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index a5e4b0c493..a25df070f3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev024 Originator(s): slevis (Samuel Levis,303-665-1310) -Date: Wed Feb 11 10:35:33 MST 2021 +Date: Sat Feb 20 14:42:33 MST 2021 One-line Summary: Grid cell-level error check for H2O Purpose of changes @@ -84,8 +84,8 @@ CTSM testing: regular tests (aux_clm): - cheyenne ---- PEND (expect OK) - izumi ------- PEND (expect OK) + cheyenne ---- OK (comparisons to baseline fail as expected) + izumi ------- OK (comparisons to baseline fail as expected) If the tag used for baseline comparisons was NOT the previous tag, note that here: @@ -99,13 +99,10 @@ Changes answers relative to baseline: YES - what code configurations: ALL - what platforms/compilers: ALL - nature of change: ROUNDOFF - Specific example from running the single point test - ERI_D_Ld9.1x1_camdenNJ.I2000Clm50BgcCruRs.cheyenne_intel.clm-default: - RMS ERRH2O 6.0280E-21 NORMALIZED 7.6050E-06 Explanation: Moving call BalanceCheck to after the call lnd2glc in subroutine clm_drv causes a change in order of operations that leads to - the above change in ERRH2O. + roundoff change in ERRH2O. Confirmed by running ./summarize_cprnc_diffs Detailed list of changes diff --git a/doc/ChangeSum b/doc/ChangeSum index 3337e6e449..e179f3cd2d 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev024 slevis 02/11/2021 Grid cell-level error check for H2O + ctsm5.1.dev024 slevis 02/20/2021 Grid cell-level error check for H2O ctsm5.1.dev023 erik 02/11/2021 Calculate leaf biomass for non-woody PFTS, and a few other small answer changes ctsm5.1.dev022 glemieux 02/05/2021 Merge fates_main_api into ctsm master ctsm5.1.dev021 erik 01/12/2021 Add option for biomass heat storage (BHS) to clm5_1 physics From 53e9efed6ab20b4982edfa8f1b29503133dd74d5 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 21 Feb 2021 16:49:25 -0700 Subject: [PATCH 1830/1973] Move final WaterGridcellBalance call out to clm_driver I prefer this for two reasons: - It is more symmetrical: since the initial WaterGridcellBalance call happens from clm_driver, it is nice to have the final one happen there, too, so that you can more clearly see the order of when things happen in the driver - It is confusing to me to have both water_inst and individual components of water_inst passed in to the same routine; I've been trying to avoid this. Resolves ESCOMP/CTSM#1286 --- src/biogeophys/BalanceCheckMod.F90 | 20 ++------------------ src/main/clm_driver.F90 | 8 +++++--- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index e1d7497198..c94a4095ac 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -148,7 +148,7 @@ subroutine WaterGridcellBalance(bounds, & !----------------------------------------------------------------------- do i = water_inst%bulk_and_tracers_beg, water_inst%bulk_and_tracers_end - ! Obtain begwb_grc + ! Obtain begwb_grc or endwb_grc call WaterGridcellBalanceSingle(bounds, & num_nolakec, filter_nolakec, num_lakec, filter_lakec, & lakestate_inst, & @@ -426,12 +426,9 @@ end subroutine BeginWaterColumnBalanceSingle !----------------------------------------------------------------------- subroutine BalanceCheck( bounds, & num_allc, filter_allc, & - num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, lakestate_inst, & atm2lnd_inst, solarabs_inst, waterflux_inst, waterstate_inst, & waterdiagnosticbulk_inst, waterbalance_inst, wateratm2lnd_inst, & - waterlnd2atm_inst, surfalb_inst, energyflux_inst, canopystate_inst, & - use_aquifer_layer) + waterlnd2atm_inst, surfalb_inst, energyflux_inst, canopystate_inst) ! ! !DESCRIPTION: ! This subroutine accumulates the numerical truncation errors of the water @@ -461,12 +458,6 @@ subroutine BalanceCheck( bounds, & type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_allc ! number of columns in allc filter integer , intent(in) :: filter_allc(:) ! filter for all columns - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - type(water_type) , intent(inout) :: water_inst - type(lakestate_type) , intent(in) :: lakestate_inst type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(solarabs_type) , intent(in) :: solarabs_inst class(waterflux_type) , intent(in) :: waterflux_inst @@ -478,7 +469,6 @@ subroutine BalanceCheck( bounds, & type(surfalb_type) , intent(in) :: surfalb_inst type(energyflux_type) , intent(inout) :: energyflux_inst type(canopystate_type), intent(inout) :: canopystate_inst - logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: integer :: p,c,l,g,fc ! indices @@ -714,12 +704,6 @@ subroutine BalanceCheck( bounds, & qflx_snwcp_discarded_ice_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - ! Obtain endwb_grc - call WaterGridcellBalance(bounds, & - num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - water_inst, lakestate_inst, & - use_aquifer_layer = use_aquifer_layer, flag = 'endwb') - do g = bounds%begg, bounds%endg errh2o_grc(g) = endwb_grc(g) - begwb_grc(g) & - (forc_rain_grc(g) & diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index f64aa4531c..276dfbc467 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -1283,16 +1283,18 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) do nc = 1,nclumps call get_clump_bounds(nc, bounds_clump) - call BalanceCheck(bounds_clump, & - filter(nc)%num_allc, filter(nc)%allc, & + call WaterGridcellBalance(bounds_clump, & filter(nc)%num_nolakec, filter(nc)%nolakec, & filter(nc)%num_lakec, filter(nc)%lakec, & water_inst, lakestate_inst, & + use_aquifer_layer = use_aquifer_layer(), flag = 'endwb') + call BalanceCheck(bounds_clump, & + filter(nc)%num_allc, filter(nc)%allc, & atm2lnd_inst, solarabs_inst, water_inst%waterfluxbulk_inst, & water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, & water_inst%waterbalancebulk_inst, water_inst%wateratm2lndbulk_inst, & water_inst%waterlnd2atmbulk_inst, surfalb_inst, energyflux_inst, & - canopystate_inst, use_aquifer_layer = use_aquifer_layer()) + canopystate_inst) end do !$OMP END PARALLEL DO call t_stopf('balchk') From 8dd43f6232878b78fd3bea5fff456d51aa09f499 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sun, 21 Feb 2021 19:48:12 -0700 Subject: [PATCH 1831/1973] Only add WA and QCHARGE history fields if use_aquifer_layer is true Resolves ESCOMP/CTSM#1281 --- bld/namelist_files/use_cases/stdurbpt_pd.xml | 2 +- src/biogeophys/SoilHydrologyType.F90 | 15 +++++++++------ src/biogeophys/WaterStateType.F90 | 19 ++++++++++--------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/bld/namelist_files/use_cases/stdurbpt_pd.xml b/bld/namelist_files/use_cases/stdurbpt_pd.xml index ab1da63bcf..65786f32ae 100644 --- a/bld/namelist_files/use_cases/stdurbpt_pd.xml +++ b/bld/namelist_files/use_cases/stdurbpt_pd.xml @@ -10,7 +10,7 @@ 'TBUILD','BUILDHEAT','TRAFFICFLUX','WASTEHEAT','SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','COSZEN' -'TG','TBOT','FIRE','FIRA','FLDS','FSDS','FSR','FSA','FGEV','FSH','FGR','TSOI','ERRSOI','BUILDHEAT','SABV','SABG','FSDSVD','FSDSND','FSDSVI','FSDSNI','FSRVD','FSRND','FSRVI','FSRNI','TSA','FCTR','FCEV','QBOT','Q2M','H2OSOI','H2OSNO','SOILLIQ','SOILICE','SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','SoilAlpha_U','ZWT','WA' +'TG','TBOT','FIRE','FIRA','FLDS','FSDS','FSR','FSA','FGEV','FSH','FGR','TSOI','ERRSOI','BUILDHEAT','SABV','SABG','FSDSVD','FSDSND','FSDSVI','FSDSNI','FSRVD','FSRND','FSRVI','FSRNI','TSA','FCTR','FCEV','QBOT','Q2M','H2OSOI','H2OSNO','SOILLIQ','SOILICE','SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','SoilAlpha_U','ZWT' 'SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','FSA','FIRA','TG','COSZEN','SoilAlpha_U','TBUILD','BUILDHEAT' diff --git a/src/biogeophys/SoilHydrologyType.F90 b/src/biogeophys/SoilHydrologyType.F90 index 752fae220a..4dfca06811 100644 --- a/src/biogeophys/SoilHydrologyType.F90 +++ b/src/biogeophys/SoilHydrologyType.F90 @@ -86,7 +86,7 @@ subroutine Init(this, bounds, NLFilename, waterstatebulk_inst, use_aquifer_layer call this%ReadNL(NLFilename) call this%InitAllocate(bounds) - call this%InitHistory(bounds) + call this%InitHistory(bounds, use_aquifer_layer) call this%InitCold(bounds, waterstatebulk_inst, use_aquifer_layer) end subroutine Init @@ -150,7 +150,7 @@ subroutine InitAllocate(this, bounds) end subroutine InitAllocate !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) + subroutine InitHistory(this, bounds, use_aquifer_layer) ! ! !USES: use histFileMod , only : hist_addfld1d @@ -158,6 +158,7 @@ subroutine InitHistory(this, bounds) ! !ARGUMENTS: class(soilhydrology_type) :: this type(bounds_type), intent(in) :: bounds + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: integer :: begc, endc @@ -167,10 +168,12 @@ subroutine InitHistory(this, bounds) begc = bounds%begc; endc= bounds%endc begg = bounds%begg; endg= bounds%endg - this%qcharge_col(begc:endc) = spval - call hist_addfld1d (fname='QCHARGE', units='mm/s', & - avgflag='A', long_name='aquifer recharge rate (natural vegetated and crop landunits only)', & - ptr_col=this%qcharge_col, l2g_scale_type='veg') + if (use_aquifer_layer) then + this%qcharge_col(begc:endc) = spval + call hist_addfld1d (fname='QCHARGE', units='mm/s', & + avgflag='A', long_name='aquifer recharge rate (natural vegetated and crop landunits only)', & + ptr_col=this%qcharge_col, l2g_scale_type='veg') + end if this%num_substeps_col(begc:endc) = spval call hist_addfld1d (fname='NSUBSTEPS', units='unitless', & diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index 243e93ca48..c0b7abc6a5 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -87,7 +87,7 @@ subroutine Init(this, bounds, info, tracer_vars, & call this%InitAllocate(bounds, tracer_vars) - call this%InitHistory(bounds) + call this%InitHistory(bounds, use_aquifer_layer) call this%InitCold(bounds = bounds, & h2osno_input_col = h2osno_input_col, & @@ -154,7 +154,7 @@ subroutine InitAllocate(this, bounds, tracer_vars) end subroutine InitAllocate !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) + subroutine InitHistory(this, bounds, use_aquifer_layer) ! ! !DESCRIPTION: ! Initialize module data structure @@ -166,6 +166,7 @@ subroutine InitHistory(this, bounds) ! !ARGUMENTS: class(waterstate_type), intent(in) :: this type(bounds_type), intent(in) :: bounds + logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run ! ! !LOCAL VARIABLES: integer :: begp, endp @@ -259,13 +260,13 @@ subroutine InitHistory(this, bounds) long_name=this%info%lname('surface water depth'), & ptr_col=this%h2osfc_col) - this%wa_col(begc:endc) = spval - call hist_addfld1d (fname=this%info%fname('WA'), units='mm', & - avgflag='A', & - long_name=this%info%lname('water in the unconfined aquifer (natural vegetated and crop landunits only)'), & - ptr_col=this%wa_col, l2g_scale_type='veg') - - + if (use_aquifer_layer) then + this%wa_col(begc:endc) = spval + call hist_addfld1d (fname=this%info%fname('WA'), units='mm', & + avgflag='A', & + long_name=this%info%lname('water in the unconfined aquifer (natural vegetated and crop landunits only)'), & + ptr_col=this%wa_col, l2g_scale_type='veg') + end if ! (rgk 02-02-2017) There is intentionally no entry here for stored plant water ! I think that since the value is zero in all cases except From eb41917ab099402954c806b9e4443a3111d89b81 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 22 Feb 2021 21:22:06 -0700 Subject: [PATCH 1832/1973] Consolidate conditional structures for VIC initialization Resolves ESCOMP/CTSM#1287 (Inconsistent logic for VIC initialization can cause crash in debug mode) --- .../SoilHydrologyInitTimeConstMod.F90 | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 b/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 index 64ede52fc4..f06fdd691e 100644 --- a/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 +++ b/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 @@ -167,22 +167,6 @@ subroutine SoilHydrologyInitTimeConst(bounds, soilhydrology_inst, soilstate_inst end if end do - end if - end if ! end of if not lake - - if (lun%itype(l) /= istdlak) then ! soil columns of both urban and non-urban types - if (lun%urbpoi(l)) then - if (col%itype(c)==icol_sunwall .or. col%itype(c)==icol_shadewall .or. col%itype(c)==icol_roof) then - ! do nothing - else - soilhydrology_inst%depth_col(c, 1:nlayer) = dzvic - soilhydrology_inst%depth_col(c, nlayer+1:nlayert) = col%dz(c, nlevsoi+1:nlevgrnd) - - ! create weights to map soil moisture profiles (10 layer) to 3 layers for VIC hydrology, M.Huang - call initCLMVICMap(c, soilhydrology_inst) - call initSoilParVIC(c, claycol, sandcol, om_fraccol, soilhydrology_inst) - end if - else soilhydrology_inst%depth_col(c, 1:nlayer) = dzvic soilhydrology_inst%depth_col(c, nlayer+1:nlayert) = col%dz(c, nlevsoi+1:nlevgrnd) @@ -191,7 +175,6 @@ subroutine SoilHydrologyInitTimeConst(bounds, soilhydrology_inst, soilstate_inst call initSoilParVIC(c, claycol, sandcol, om_fraccol, soilhydrology_inst) end if end if ! end of if not lake - end do ! end of loop over columns deallocate(b2d, ds2d, dsmax2d, ws2d) From d71e650bc8feaf4c34ad3940e52260e7201ee969 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 23 Feb 2021 13:27:12 -0700 Subject: [PATCH 1833/1973] Update ChangeLog --- doc/ChangeLog | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 83 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index a25df070f3..bf36f50415 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,86 @@ =============================================================== +Tag name: ctsm5.1.dev025 +Originator(s): sacks (Bill Sacks) +Date: Tue Feb 23 11:20:17 MST 2021 +One-line Summary: Refactor ozone code, and misc. small fixes + +Purpose and description of changes +---------------------------------- + +(1) Restructure ozone code (https://github.com/ESCOMP/CTSM/pull/1276) in + preparation for new ozone parameterization. + +(2) Fix non-standard hexadecimal constant + (https://github.com/ESCOMP/CTSM/pull/1271), needed for gfortran 10 + +(3) Remove support for CISM1 (https://github.com/ESCOMP/CTSM/pull/1226) + +(4) Move final WaterGridcellBalance call out to clm_driver (resolves + ESCOMP/CTSM#1286) + +(5) Only add WA and QCHARGE history fields if use_aquifer_layer is true + (resolves ESCOMP/CTSM#1281) + +(6) Consolidate conditional structures for VIC initialization (resolves + ESCOMP/CTSM#1287) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1286 (Move call to WaterGridcellBalance out to + the driver) +- Resolves ESCOMP/CTSM#1281 (Remove deprecated history output) +- Resolves ESCOMP/CTSM#1287 (Inconsistent logic for VIC initialization + can cause crash in debug mode) +- Resolves ESCOMP/CTSM#1270 (Hexadecimal constants use non-standard + Fortran) + + +Testing summary: +---------------- + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + Field lists differ for Clm50 / Clm51 / Ctsm50 tests; otherwise + bit-for-bit + +Other details +------------- +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/CTSM/pull/1276 (Restructure ozone code) +- https://github.com/ESCOMP/CTSM/pull/1271 (Fix non-standard hexadecimal constant) +- https://github.com/ESCOMP/CTSM/pull/1226 (Remove support for CISM1) + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev024 Originator(s): slevis (Samuel Levis,303-665-1310) Date: Sat Feb 20 14:42:33 MST 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index e179f3cd2d..74dab4b0cc 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev025 sacks 02/23/2021 Refactor ozone code, and misc. small fixes ctsm5.1.dev024 slevis 02/20/2021 Grid cell-level error check for H2O ctsm5.1.dev023 erik 02/11/2021 Calculate leaf biomass for non-woody PFTS, and a few other small answer changes ctsm5.1.dev022 glemieux 02/05/2021 Merge fates_main_api into ctsm master From 0f72db027645ee7183ba4316942c610ae75b44ea Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 24 Feb 2021 13:52:55 -0700 Subject: [PATCH 1834/1973] Minor clean up of some diffs --- src/biogeophys/BareGroundFluxesMod.F90 | 5 +---- src/biogeophys/CanopyFluxesMod.F90 | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 index 0e6985c22b..cc14091a26 100644 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ b/src/biogeophys/BareGroundFluxesMod.F90 @@ -89,7 +89,6 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & Wet_Bulb, Wet_BulbS, HeatIndex, AppTemp, & swbgt, hmdex, dis_coi, dis_coiS, THIndex, & SwampCoolEff, KtoC, VaporPres - ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -144,7 +143,6 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] real(r8) :: www ! surface soil wetness [-] - !------------------------------------------------------------------------------ associate( & @@ -204,8 +202,7 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature beta => temperature_inst%beta_col , & ! Input: [real(r8) (:) ] coefficient of conective velocity [-] - frac_sno_eff => waterdiagnosticbulk_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - qg_snow => waterdiagnosticbulk_inst%qg_snow_col , & ! Input: [real(r8) (:) ] specific humidity at snow surface [kg/kg] + qg_snow => waterdiagnosticbulk_inst%qg_snow_col , & ! Input: [real(r8) (:) ] specific humidity at snow surface [kg/kg] qg_soil => waterdiagnosticbulk_inst%qg_soil_col , & ! Input: [real(r8) (:) ] specific humidity at soil surface [kg/kg] qg_h2osfc => waterdiagnosticbulk_inst%qg_h2osfc_col , & ! Input: [real(r8) (:) ] specific humidity at h2osfc surface [kg/kg] qg => waterdiagnosticbulk_inst%qg_col , & ! Input: [real(r8) (:) ] specific humidity at ground surface [kg/kg] diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 index 9c26942559..348af3a613 100644 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ b/src/biogeophys/CanopyFluxesMod.F90 @@ -431,7 +431,6 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, real(r8), parameter :: min_stem_diameter = 0.05_r8 !minimum stem diameter for which to calculate stem interactions integer :: dummy_to_make_pgi_happy - !------------------------------------------------------------------------------ SHR_ASSERT_ALL_FL((ubound(downreg_patch) == (/bounds%endp/)), sourcefile, __LINE__) From e58a245fe0de821a87522d9b05d2e919bb5e8df1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 25 Feb 2021 10:37:45 -0700 Subject: [PATCH 1835/1973] removed additional musgs in test --- cime_config/testdefs/testlist_clm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 06a7c97893..47d2f79709 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -424,7 +424,7 @@ - + From 74d4394e31a9056cfffc2288eb173415b7d21f6c Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Fri, 26 Feb 2021 13:20:09 -0700 Subject: [PATCH 1836/1973] fix urban conditional for j=1 --- src/biogeophys/SoilFluxesMod.F90 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index d94dac723e..9bff7ce42f 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -224,9 +224,8 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & endif endif - ! top soil layer for urban columns; adjust qflx_evap_soi directly - if (lun%urbpoi(patch%landunit(p))) then - j = 1 + ! top soil layer for urban columns (excluding pervious road); adjust qflx_evap_soi directly + if (lun%urbpoi(patch%landunit(p)) .and. (col%itype(c)/=icol_road_perv) .and. (j == 1)) then evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j)) if (qflx_evap_soi(p)*dtime > evaporation_limit) then ev_unconstrained = qflx_evap_soi(p) From f41c0e8fe3078e6217346350e54c3deee02ed05b Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 1 Mar 2021 10:23:21 -0700 Subject: [PATCH 1837/1973] remove solid evap adjustment in SoilHydrologyMod --- src/biogeophys/SoilFluxesMod.F90 | 49 +++++++++++++---------------- src/biogeophys/SoilHydrologyMod.F90 | 30 +++++------------- 2 files changed, 28 insertions(+), 51 deletions(-) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index 9bff7ce42f..d700148774 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -79,7 +79,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & real(r8) :: t_grnd0(bounds%begc:bounds%endc) ! t_grnd of previous time step real(r8) :: lw_grnd real(r8) :: evaporation_limit ! top layer moisture available for evaporation - real(r8) :: ev_unconstrained ! evaporative demand + real(r8) :: evaporation_demand ! evaporative demand !----------------------------------------------------------------------- associate( & @@ -204,8 +204,7 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & endif end do - ! evaporation from snow may be larger than available moisture - ! after flux update from tinc*cgrnd, repeat adjustment of ev_snow + ! Constrain evaporation from snow to be <= available moisture do fp = 1,num_nolakep p = filter_nolakep(fp) c = patch%column(p) @@ -213,25 +212,25 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! snow layers if (j < 1) then ! assumes for j < 1 that frac_sno_eff > 0 - evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/frac_sno_eff(c) - if (qflx_ev_snow(p)*dtime > evaporation_limit) then - ev_unconstrained = qflx_ev_snow(p) - qflx_ev_snow(p) = evaporation_limit/dtime - - qflx_evap_soi(p) = qflx_evap_soi(p) - frac_sno_eff(c)*(ev_unconstrained - qflx_ev_snow(p)) + evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/(frac_sno_eff(c)*dtime) + if (qflx_ev_snow(p) > evaporation_limit) then + evaporation_demand = qflx_ev_snow(p) + qflx_ev_snow(p) = evaporation_limit + qflx_evap_soi(p) = qflx_evap_soi(p) - frac_sno_eff(c)*(evaporation_demand - evaporation_limit) ! conserve total energy flux - eflx_sh_grnd(p) = eflx_sh_grnd(p) + frac_sno_eff(c)*(ev_unconstrained - qflx_ev_snow(p))*htvp(c) + eflx_sh_grnd(p) = eflx_sh_grnd(p) + frac_sno_eff(c)*(evaporation_demand - evaporation_limit)*htvp(c) endif endif - ! top soil layer for urban columns (excluding pervious road); adjust qflx_evap_soi directly + ! top soil layer for urban columns (excluding pervious road) if (lun%urbpoi(patch%landunit(p)) .and. (col%itype(c)/=icol_road_perv) .and. (j == 1)) then - evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j)) - if (qflx_evap_soi(p)*dtime > evaporation_limit) then - ev_unconstrained = qflx_evap_soi(p) - qflx_evap_soi(p) = evaporation_limit/dtime + evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/dtime + if (qflx_evap_soi(p) > evaporation_limit) then + evaporation_demand = qflx_evap_soi(p) + qflx_evap_soi(p) = evaporation_limit + qflx_ev_snow(p) = qflx_evap_soi(p) ! conserve total energy flux - eflx_sh_grnd(p) = eflx_sh_grnd(p) +(ev_unconstrained - qflx_evap_soi(p))*htvp(c) + eflx_sh_grnd(p) = eflx_sh_grnd(p) +(evaporation_demand -evaporation_limit)*htvp(c) endif endif @@ -247,11 +246,6 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & g = patch%gridcell(p) j = col%snl(c)+1 - ! Update ev_snow for urban landunits here - if (lun%urbpoi(l)) then - qflx_ev_snow(p) = qflx_evap_soi(p) - end if - ! Ground heat flux if (.not. lun%urbpoi(l)) then @@ -360,15 +354,14 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! limit only solid evaporation (sublimation) from top soil layer ! (liquid evaporation from soil should not be limited) if (j==1 .and. frac_h2osfc(c) < 1._r8) then - if (((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(p)*dtime) >= h2osoi_ice(c,j)) then - + evaporation_limit = h2osoi_ice(c,j)/(dtime*(1._r8 - frac_h2osfc(c))) + if (qflx_solidevap_from_top_layer(p) >= evaporation_limit) then + evaporation_demand = qflx_solidevap_from_top_layer(p) + qflx_solidevap_from_top_layer(p) & + = evaporation_limit qflx_liqevap_from_top_layer(p) & = qflx_liqevap_from_top_layer(p) & - + (qflx_solidevap_from_top_layer(p) & - - h2osoi_ice(c,j)/(dtime*(1._r8 - frac_h2osfc(c)))) - qflx_solidevap_from_top_layer(p) & - = h2osoi_ice(c,j)/(dtime*(1._r8 - frac_h2osfc(c))) - + + (evaporation_demand - evaporation_limit) endif endif diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 index cc79fd9461..2f9993f058 100644 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ b/src/biogeophys/SoilHydrologyMod.F90 @@ -65,7 +65,7 @@ module SoilHydrologyMod type(params_type), private :: params_inst !----------------------------------------------------------------------- - real(r8), private :: baseflow_scalar = 1.e-2_r8 + real(r8), private :: baseflow_scalar = 1.e-2_r8 real(r8), parameter :: tolerance = 1.e-12_r8 ! tolerance for checking whether sublimation is greater than ice in top soil layer character(len=*), parameter, private :: sourcefile = & @@ -845,16 +845,8 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil ! make consistent with how evap_grnd removed in infiltration h2osoi_liq(c,1) = h2osoi_liq(c,1) + (1._r8 - frac_h2osfc(c))*qflx_liqdew_to_top_layer(c) * dtime h2osoi_ice(c,1) = h2osoi_ice(c,1) + (1._r8 - frac_h2osfc(c))*qflx_soliddew_to_top_layer(c) * dtime - if ((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then - qflx_solidevap_from_top_layer_save = qflx_solidevap_from_top_layer(c) - qflx_solidevap_from_top_layer(c) = h2osoi_ice(c,1)/dtime - qflx_ev_snow(c) = qflx_ev_snow(c) - (qflx_solidevap_from_top_layer_save & - - qflx_solidevap_from_top_layer(c)) - - if((abs((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1))) > tolerance) then - call endrun(msg="qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) - endif - h2osoi_ice(c,1) = 0._r8 + if (((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1) > tolerance)) then + call endrun(msg="qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) else h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_solidevap_from_top_layer(c) * dtime end if @@ -870,12 +862,8 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil if (snl(c)+1 >= 1) then h2osoi_liq(c,1) = h2osoi_liq(c,1) + qflx_liqdew_to_top_layer(c) * dtime h2osoi_ice(c,1) = h2osoi_ice(c,1) + (qflx_soliddew_to_top_layer(c) * dtime) - if (qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then - qflx_solidevap_from_top_layer_save = qflx_solidevap_from_top_layer(c) - qflx_solidevap_from_top_layer(c) = h2osoi_ice(c,1)/dtime - qflx_ev_snow(c) = qflx_ev_snow(c) - (qflx_solidevap_from_top_layer_save & - - qflx_solidevap_from_top_layer(c)) - h2osoi_ice(c,1) = 0._r8 + if ((qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1)) > tolerance) then + call endrun(msg="urban qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) else h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_solidevap_from_top_layer(c) * dtime) end if @@ -2349,12 +2337,8 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & if (snl(c)+1 >= 1) then h2osoi_liq(c,1) = h2osoi_liq(c,1) + qflx_liqdew_to_top_layer(c) * dtime h2osoi_ice(c,1) = h2osoi_ice(c,1) + (qflx_soliddew_to_top_layer(c) * dtime) - if (qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then - qflx_solidevap_from_top_layer_save = qflx_solidevap_from_top_layer(c) - qflx_solidevap_from_top_layer(c) = h2osoi_ice(c,1)/dtime - qflx_ev_snow(c) = qflx_ev_snow(c) - (qflx_solidevap_from_top_layer_save & - - qflx_solidevap_from_top_layer(c)) - h2osoi_ice(c,1) = 0._r8 + if ((qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1)) > tolerance) then + call endrun(msg="urban qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) else h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_solidevap_from_top_layer(c) * dtime) end if From 9630325c372fae5e398f0c95cebfa6043223dd38 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Mon, 1 Mar 2021 14:11:16 -0700 Subject: [PATCH 1838/1973] fix conditional in renewcondensation --- src/biogeophys/SoilHydrologyMod.F90 | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 index 2f9993f058..c0089cc84f 100644 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ b/src/biogeophys/SoilHydrologyMod.F90 @@ -2308,19 +2308,8 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & ! make consistent with how evap_grnd removed in infiltration h2osoi_liq(c,1) = h2osoi_liq(c,1) + (1._r8 - frac_h2osfc(c))*qflx_liqdew_to_top_layer(c) * dtime h2osoi_ice(c,1) = h2osoi_ice(c,1) + (1._r8 - frac_h2osfc(c))*qflx_soliddew_to_top_layer(c) * dtime - if ((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime > h2osoi_ice(c,1)) then - qflx_solidevap_from_top_layer_save = qflx_solidevap_from_top_layer(c) - qflx_solidevap_from_top_layer(c) = h2osoi_ice(c,1)/dtime - qflx_ev_snow(c) = qflx_ev_snow(c) & - - (qflx_solidevap_from_top_layer_save & - - qflx_solidevap_from_top_layer(c)) - ! qflx_solidevap_from_top_layer should be constrained - ! in SoilFluxesMod to be <= h2osoi_ice, but check here - if((abs((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1))) > tolerance) then - call endrun(msg="qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) - endif - - h2osoi_ice(c,1) = 0._r8 + if (((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1)) > tolerance) then + call endrun(msg="qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) else h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_solidevap_from_top_layer(c) * dtime end if From a3274091725e89f3a398804f8ea4e00d60383966 Mon Sep 17 00:00:00 2001 From: Sean Swenson Date: Tue, 2 Mar 2021 08:27:44 -0700 Subject: [PATCH 1839/1973] add comments --- src/biogeophys/SoilFluxesMod.F90 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 index d700148774..bb88042797 100644 --- a/src/biogeophys/SoilFluxesMod.F90 +++ b/src/biogeophys/SoilFluxesMod.F90 @@ -209,9 +209,12 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & p = filter_nolakep(fp) c = patch%column(p) j = col%snl(c)+1 - ! snow layers + ! snow layers; assumes for j < 1 that frac_sno_eff > 0 if (j < 1) then - ! assumes for j < 1 that frac_sno_eff > 0 + ! Defining the limitation uniformly for all patches is more + ! strict than absolutely necessary. This definition assumes + ! each patch is spatially distinct and may remove all the snow + ! on its patch, but may not remove snow from adjacent patches. evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/(frac_sno_eff(c)*dtime) if (qflx_ev_snow(p) > evaporation_limit) then evaporation_demand = qflx_ev_snow(p) @@ -222,7 +225,9 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & endif endif - ! top soil layer for urban columns (excluding pervious road) + ! top soil layer for urban columns (excluding pervious road, which + ! shouldn't be limited here b/c it uses the uses the soilwater + ! equations, while the other urban columns do not) if (lun%urbpoi(patch%landunit(p)) .and. (col%itype(c)/=icol_road_perv) .and. (j == 1)) then evaporation_limit = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/dtime if (qflx_evap_soi(p) > evaporation_limit) then From 71a4c2ff8fe2a0ad42972c66dd8f78d1eaaa5183 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 3 Mar 2021 13:37:22 -0700 Subject: [PATCH 1840/1973] Update externals to version in cesm2_3_alpha02b Resolves ESCOMP/CTSM#1175 --- Externals.cfg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index aecac45976..85182ac0f8 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -8,7 +8,7 @@ required = True local_path = components/cism protocol = git repo_url = https://github.com/ESCOMP/CISM-wrapper -tag = cism2_1_69 +tag = cism2_1_75 externals = Externals_CISM.cfg required = True @@ -16,14 +16,14 @@ required = True local_path = components/rtm protocol = git repo_url = https://github.com/ESCOMP/RTM -tag = rtm1_0_73 +tag = rtm1_0_74 required = True [mosart] local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/MOSART -tag = mosart1_0_38 +tag = branch_tag/pio2.n01_mosart1_0_38 required = True [mizuRoute] @@ -37,21 +37,21 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.32_a02 +tag = cime5.8.37 required = True [cmeps] local_path = cime/src/drivers/nuopc/ protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git -hash = 7654038 +hash = c4acaa8 required = True [cdeps] local_path = components/cdeps protocol = git repo_url = https://github.com/ESCOMP/CDEPS.git -hash = 45b7a85 +hash = 1f02a73 required = True [doc-builder] From a7345406cd4e7ee923ac8aa954ce59c0ceb733bb Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 3 Mar 2021 16:20:09 -0700 Subject: [PATCH 1841/1973] Now that pio2 is the default, use pio_rearranger=2 for pnetcdf Resolves ESCOMP/CTSM#1194 --- lilac/bld_templates/lnd_modelio_template.nml | 2 +- python/ctsm/lilac_build_ctsm.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lilac/bld_templates/lnd_modelio_template.nml b/lilac/bld_templates/lnd_modelio_template.nml index 6ee97fb119..8686ebeeca 100644 --- a/lilac/bld_templates/lnd_modelio_template.nml +++ b/lilac/bld_templates/lnd_modelio_template.nml @@ -1,7 +1,7 @@ &pio_inparm pio_netcdf_format = "64bit_offset" pio_numiotasks = -99 - pio_rearranger = 1 + pio_rearranger = $PIO_REARRANGER pio_root = 1 pio_stride = $PIO_STRIDE pio_typename = "$PIO_TYPENAME" diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 4774993e7e..2e428d69a8 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -658,12 +658,18 @@ def _stage_runtime_inputs(build_dir, no_pnetcdf): pio_stride = _xmlquery('MAX_MPITASKS_PER_NODE', build_dir) if no_pnetcdf: pio_typename = 'netcdf' + # pio_rearranger = 1 is generally more efficient with netcdf (see + # https://github.com/ESMCI/cime/pull/3732#discussion_r508954806 and the following + # discussion) + pio_rearranger = 1 else: pio_typename = 'pnetcdf' + pio_rearranger = 2 fill_template_file( path_to_template=os.path.join(_PATH_TO_TEMPLATES, 'lnd_modelio_template.nml'), path_to_final=os.path.join(build_dir, _RUNTIME_INPUTS_DIRNAME, 'lnd_modelio.nml'), - substitutions={'PIO_STRIDE':pio_stride, + substitutions={'PIO_REARRANGER':pio_rearranger, + 'PIO_STRIDE':pio_stride, 'PIO_TYPENAME':pio_typename}) shutil.copyfile( From a54bd894ad83d967519c43b90b45392262852043 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 3 Mar 2021 16:46:34 -0700 Subject: [PATCH 1842/1973] Point to cime branch tag Same as cime5.8.37 but with ESMCI/cime#3841 cherry-picked in This was a PR from Mariana Vertenstein: Introduction of MASK_GRID for CMEPS This PR introduces the a new mask grid specification for CMEPS and also updates the config_grids.xml to add new ESMF meshes. --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 85182ac0f8..7b93187762 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -37,7 +37,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.37 +tag = branch_tags/cime5.8.37_a01 required = True [cmeps] From 9032470649800f6f89edceb2cd371ca0a3aeb3b8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 3 Mar 2021 20:10:16 -0700 Subject: [PATCH 1843/1973] Change f10 tests to use mg37 mask The musgs mask will soon be dropped, and has already been dropped for nuopc --- cime_config/testdefs/testlist_clm.xml | 230 +++++++++++++------------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 8c91bd9d88..c304a4bb27 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1,6 +1,6 @@ - + @@ -46,7 +46,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -156,7 +156,7 @@ - + @@ -190,7 +190,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -206,7 +206,7 @@ - + @@ -214,7 +214,7 @@ - + @@ -247,7 +247,7 @@ - + @@ -256,7 +256,7 @@ - + @@ -265,7 +265,7 @@ - + @@ -331,7 +331,7 @@ - + @@ -340,7 +340,7 @@ - + @@ -348,7 +348,7 @@ - + @@ -356,7 +356,7 @@ - + @@ -381,7 +381,7 @@ - + @@ -390,7 +390,7 @@ - + @@ -407,7 +407,7 @@ - + @@ -424,7 +424,7 @@ - + @@ -453,7 +453,7 @@ - + @@ -461,7 +461,7 @@ - + @@ -470,7 +470,7 @@ - + @@ -478,7 +478,7 @@ - + @@ -494,7 +494,7 @@ - + @@ -505,7 +505,7 @@ - + @@ -513,7 +513,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -529,7 +529,7 @@ - + @@ -537,7 +537,7 @@ - + @@ -546,7 +546,7 @@ - + @@ -555,7 +555,7 @@ - + @@ -564,7 +564,7 @@ - + @@ -573,7 +573,7 @@ - + @@ -583,7 +583,7 @@ - + @@ -592,7 +592,7 @@ - + @@ -600,7 +600,7 @@ - + @@ -608,7 +608,7 @@ - + @@ -651,7 +651,7 @@ - + @@ -659,7 +659,7 @@ - + @@ -695,7 +695,7 @@ - + @@ -703,7 +703,7 @@ - + @@ -711,7 +711,7 @@ - + @@ -719,7 +719,7 @@ - + @@ -748,7 +748,7 @@ - + @@ -757,7 +757,7 @@ - + @@ -766,7 +766,7 @@ - + @@ -774,7 +774,7 @@ - + @@ -782,7 +782,7 @@ - + @@ -791,7 +791,7 @@ - + @@ -801,7 +801,7 @@ - + @@ -850,7 +850,7 @@ - + @@ -878,7 +878,7 @@ - + @@ -932,7 +932,7 @@ - + @@ -941,7 +941,7 @@ - + @@ -951,7 +951,7 @@ - + @@ -959,7 +959,7 @@ - + @@ -968,7 +968,7 @@ - + @@ -978,7 +978,7 @@ - + @@ -988,7 +988,7 @@ - + @@ -996,7 +996,7 @@ - + @@ -1014,7 +1014,7 @@ - + @@ -1023,7 +1023,7 @@ - + @@ -1032,7 +1032,7 @@ - + @@ -1041,7 +1041,7 @@ - + @@ -1050,7 +1050,7 @@ - + @@ -1071,7 +1071,7 @@ - + @@ -1080,7 +1080,7 @@ - + @@ -1088,7 +1088,7 @@ - + @@ -1104,7 +1104,7 @@ - + @@ -1193,7 +1193,7 @@ - + @@ -1211,7 +1211,7 @@ - + @@ -1220,7 +1220,7 @@ - + @@ -1229,7 +1229,7 @@ - + @@ -1266,7 +1266,7 @@ - + @@ -1275,7 +1275,7 @@ - + @@ -1285,7 +1285,7 @@ - + @@ -1303,7 +1303,7 @@ - + @@ -1312,7 +1312,7 @@ - + @@ -1322,7 +1322,7 @@ - + @@ -1432,7 +1432,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1490,7 +1490,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1498,7 +1498,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1508,7 +1508,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1516,7 +1516,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1527,7 +1527,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1545,7 +1545,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1554,7 +1554,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1583,7 +1583,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1611,7 +1611,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1678,7 +1678,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1705,7 +1705,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1713,7 +1713,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1721,7 +1721,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1731,7 +1731,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1740,7 +1740,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1757,7 +1757,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1776,7 +1776,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1804,7 +1804,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1875,7 +1875,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1893,7 +1893,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1937,7 +1937,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1955,7 +1955,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2000,7 +2000,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2016,7 +2016,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2033,7 +2033,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2043,7 +2043,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2055,7 +2055,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2067,7 +2067,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2077,7 +2077,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2328,7 +2328,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2350,7 +2350,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this 2-degree since that resolution turns off Carbon isotopes - + @@ -2380,7 +2380,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2403,7 +2403,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2414,7 +2414,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -2427,7 +2427,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + From 1451d94d67b7532e9958517b41e6f3ac28ebcd00 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 3 Mar 2021 21:09:09 -0700 Subject: [PATCH 1844/1973] Fix mask used in lilac case --- python/ctsm/lilac_build_ctsm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 4774993e7e..c48c283a2b 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -23,7 +23,7 @@ # these are arbitrary, since we only use the case for its build, not any of the runtime # settings; they just need to be valid _COMPSET = 'I2000Ctsm50NwpSpAsRs' -_RES = 'f10_f10_musgs' +_RES = 'f10_f10_mg37' _PATH_TO_TEMPLATES = os.path.join(path_to_ctsm_root(), 'lilac', From 4a9faaddf7d47247b04211dffc5d924e28220aaa Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Mar 2021 13:24:25 -0700 Subject: [PATCH 1845/1973] Update ChangeLog --- doc/ChangeLog | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 51 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index bf36f50415..4b42c37131 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,54 @@ =============================================================== +Tag name: ctsm5.1.dev026 +Originator(s): sacks (Bill Sacks) +Date: Mon Mar 8 13:20:33 MST 2021 +One-line Summary: Change f10 tests to use mg37 mask + +Purpose and description of changes +---------------------------------- + +The musgs mask will soon be dropped, and has already been dropped for +nuopc + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Notes of particular relevance for developers: +--------------------------------------------- +Changes to tests or testing: All f10_f10_musgs tests changed to f10_f10_mg37 + + +Testing summary: +---------------- + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- pass + izumi ------- pass + +Answer changes +-------------- + +Changes answers relative to baseline: NO + + BFAIL results for all f10 tests because the tests have changed, but + no answer changes + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev025 Originator(s): sacks (Bill Sacks) Date: Tue Feb 23 11:20:17 MST 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 74dab4b0cc..1ecd52894f 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev026 sacks 03/08/2021 Change f10 tests to use mg37 mask ctsm5.1.dev025 sacks 02/23/2021 Refactor ozone code, and misc. small fixes ctsm5.1.dev024 slevis 02/20/2021 Grid cell-level error check for H2O ctsm5.1.dev023 erik 02/11/2021 Calculate leaf biomass for non-woody PFTS, and a few other small answer changes From adc35d239bc5e83557e737251cf1b8a0a445a42f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 8 Mar 2021 16:09:08 -0700 Subject: [PATCH 1846/1973] Replace shared code with call to RenewCondensation --- src/biogeophys/SoilHydrologyMod.F90 | 56 +++++++---------------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 index c0089cc84f..99aa6275c0 100644 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ b/src/biogeophys/SoilHydrologyMod.F90 @@ -633,8 +633,7 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil !----------------------------------------------------------------------- associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) + dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) @@ -644,10 +643,7 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil h2osoi_liq => waterstatebulk_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) h2osoi_ice => waterstatebulk_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) h2osoi_vol => waterstatebulk_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - frac_h2osfc => waterdiagnosticbulk_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] - qflx_liqdew_to_top_layer => waterfluxbulk_inst%qflx_liqdew_to_top_layer_col , & ! Input: [real(r8) (:) ] rate of liquid water deposited on top soil or snow layer (dew) (mm H2O /s) [+] - qflx_soliddew_to_top_layer => waterfluxbulk_inst%qflx_soliddew_to_top_layer_col, & ! Input: [real(r8) (:) ] rate of solid water deposited on top soil or snow layer (frost) (mm H2O /s) [+] qflx_ev_snow => waterfluxbulk_inst%qflx_ev_snow_col , & ! In/Out: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) @@ -662,8 +658,7 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil qcharge => soilhydrology_inst%qcharge_col , & ! Input: [real(r8) (:) ] aquifer recharge rate (mm/s) origflag => soilhydrology_inst%origflag , & ! Input: logical - qflx_solidevap_from_top_layer => waterfluxbulk_inst%qflx_solidevap_from_top_layer_col, & ! Output: [real(r8) (:) ] rate of ice evaporated from top soil or snow layer (sublimation) (mm H2O /s) [+] - qflx_drain => waterfluxbulk_inst%qflx_drain_col , & ! Output: [real(r8) (:) ] sub-surface runoff (mm H2O /s) + qflx_drain => waterfluxbulk_inst%qflx_drain_col , & ! Output: [real(r8) (:) ] sub-surface runoff (mm H2O /s) qflx_drain_perched => waterfluxbulk_inst%qflx_drain_perched_col , & ! Output: [real(r8) (:) ] perched wt sub-surface runoff (mm H2O /s) qflx_rsub_sat => waterfluxbulk_inst%qflx_rsub_sat_col & ! Output: [real(r8) (:) ] soil saturation excess [mm h2o/s] ) @@ -835,42 +830,17 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil endif end do - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Renew the ice and liquid mass due to condensation - - if (snl(c)+1 >= 1) then - - ! make consistent with how evap_grnd removed in infiltration - h2osoi_liq(c,1) = h2osoi_liq(c,1) + (1._r8 - frac_h2osfc(c))*qflx_liqdew_to_top_layer(c) * dtime - h2osoi_ice(c,1) = h2osoi_ice(c,1) + (1._r8 - frac_h2osfc(c))*qflx_soliddew_to_top_layer(c) * dtime - if (((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1) > tolerance)) then - call endrun(msg="qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_solidevap_from_top_layer(c) * dtime - end if - end if - end do - - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - ! Renew the ice and liquid mass due to condensation for urban roof and impervious road - - if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - if (snl(c)+1 >= 1) then - h2osoi_liq(c,1) = h2osoi_liq(c,1) + qflx_liqdew_to_top_layer(c) * dtime - h2osoi_ice(c,1) = h2osoi_ice(c,1) + (qflx_soliddew_to_top_layer(c) * dtime) - if ((qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1)) > tolerance) then - call endrun(msg="urban qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_solidevap_from_top_layer(c) * dtime) - end if - end if - end if - - end do + call RenewCondensation(& + bounds = bounds, & + num_hydrologyc = num_hydrologyc, & + filter_hydrologyc = filter_hydrologyc, & + num_urbanc = num_urbanc, & + filter_urbanc = filter_urbanc, & + soilhydrology_inst = soilhydrology_inst, & + soilstate_inst = soilstate_inst, & + waterstatebulk_inst = waterstatebulk_inst, & + waterdiagnosticbulk_inst = waterdiagnosticbulk_inst, & + waterfluxbulk_inst = waterfluxbulk_inst) end associate From a283fd6e1f57718171e5ccb7f7c7900b69109610 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 9 Mar 2021 11:36:34 -0700 Subject: [PATCH 1847/1973] Move RenewCondensation call up a level This way RenewCondensation is called from the same place whether or not use_aquifer_layer is true. --- src/biogeophys/HydrologyNoDrainageMod.F90 | 16 ++++++++-------- src/biogeophys/SoilHydrologyMod.F90 | 19 ++----------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 index 9a3009d968..7cb1e5575f 100644 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/biogeophys/HydrologyNoDrainageMod.F90 @@ -357,9 +357,9 @@ subroutine HydrologyNoDrainage(bounds, & end if if (use_aquifer_layer()) then - call WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & + call WaterTable(bounds, num_hydrologyc, filter_hydrologyc, & soilhydrology_inst, soilstate_inst, temperature_inst, b_waterstate_inst, & - b_waterdiagnostic_inst, b_waterflux_inst) + b_waterflux_inst) else call PerchedWaterTable(bounds, num_hydrologyc, filter_hydrologyc, & @@ -370,12 +370,12 @@ subroutine HydrologyNoDrainage(bounds, & num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & b_waterstate_inst, b_waterflux_inst) - call RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc,& - soilhydrology_inst, soilstate_inst, & - b_waterstate_inst, b_waterdiagnostic_inst, b_waterflux_inst) - - endif + end if + + call RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & + num_urbanc, filter_urbanc,& + soilhydrology_inst, soilstate_inst, & + b_waterstate_inst, b_waterdiagnostic_inst, b_waterflux_inst) ! BUG(wjs, 2019-09-16, ESCOMP/ctsm#762) This is needed so that we can test the ! tracerization of the following snow stuff without having tracerized everything diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 index 99aa6275c0..dbead59f9f 100644 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ b/src/biogeophys/SoilHydrologyMod.F90 @@ -571,8 +571,8 @@ subroutine UpdateUrbanPonding(bounds, num_urbanc, filter_urbanc, & end subroutine UpdateUrbanPonding !----------------------------------------------------------------------- - subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & - soilhydrology_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst) + subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, & + soilhydrology_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, waterfluxbulk_inst) ! ! !DESCRIPTION: ! Calculate watertable, considering aquifer recharge but no drainage. @@ -584,14 +584,11 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points type(soilhydrology_type) , intent(inout) :: soilhydrology_inst type(soilstate_type) , intent(in) :: soilstate_inst type(temperature_type) , intent(in) :: temperature_inst type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst - type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst type(waterfluxbulk_type) , intent(inout) :: waterfluxbulk_inst ! ! !LOCAL VARIABLES: @@ -830,18 +827,6 @@ subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, fil endif end do - call RenewCondensation(& - bounds = bounds, & - num_hydrologyc = num_hydrologyc, & - filter_hydrologyc = filter_hydrologyc, & - num_urbanc = num_urbanc, & - filter_urbanc = filter_urbanc, & - soilhydrology_inst = soilhydrology_inst, & - soilstate_inst = soilstate_inst, & - waterstatebulk_inst = waterstatebulk_inst, & - waterdiagnosticbulk_inst = waterdiagnosticbulk_inst, & - waterfluxbulk_inst = waterfluxbulk_inst) - end associate end subroutine WaterTable From 5ad3c8c17512b4f2df2ed0876ee0886df4dbff3e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 11 Mar 2021 15:29:08 -0700 Subject: [PATCH 1848/1973] In RenewCondensation, truncate small values using standard approach --- src/biogeophys/SoilHydrologyMod.F90 | 54 +++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 index dbead59f9f..817280c7f4 100644 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ b/src/biogeophys/SoilHydrologyMod.F90 @@ -17,6 +17,7 @@ module SoilHydrologyMod use column_varcon , only : icol_road_imperv use landunit_varcon , only : istsoil, istcrop use clm_time_manager , only : get_step_size_real + use NumericsMod , only : truncate_small_values use EnergyFluxType , only : energyflux_type use InfiltrationExcessRunoffMod, only : infiltration_excess_runoff_type use SoilHydrologyType , only : soilhydrology_type @@ -2233,9 +2234,12 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & type(waterfluxbulk_type) , intent(inout) :: waterfluxbulk_inst ! ! !LOCAL VARIABLES: - integer :: c,j,fc,i ! indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: qflx_solidevap_from_top_layer_save ! temporary + integer :: c ,j,fc,i ! indices + real(r8) :: dtime ! land model time step (sec) + real(r8) :: qflx_solidevap_from_top_layer_save ! temporary + integer :: num_modifiedc ! number of columns in filter_modifiedc + integer :: filter_modifiedc(bounds%endc-bounds%begc+1) ! column filter of points modified in this subroutine + real(r8) :: h2osoi_ice_before_evap(bounds%begc:bounds%endc) ! h2osoi_ice in layer 1 before applying solidevap !----------------------------------------------------------------------- associate( & @@ -2252,6 +2256,7 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & ! Get time step dtime = get_step_size_real() + num_modifiedc = 0 do fc = 1, num_hydrologyc c = filter_hydrologyc(fc) @@ -2259,15 +2264,14 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & ! Renew the ice and liquid mass due to condensation if (snl(c)+1 >= 1) then + num_modifiedc = num_modifiedc + 1 + filter_modifiedc(num_modifiedc) = c ! make consistent with how evap_grnd removed in infiltration h2osoi_liq(c,1) = h2osoi_liq(c,1) + (1._r8 - frac_h2osfc(c))*qflx_liqdew_to_top_layer(c) * dtime h2osoi_ice(c,1) = h2osoi_ice(c,1) + (1._r8 - frac_h2osfc(c))*qflx_soliddew_to_top_layer(c) * dtime - if (((1._r8 - frac_h2osfc(c))*qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1)) > tolerance) then - call endrun(msg="qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_solidevap_from_top_layer(c) * dtime - end if + h2osoi_ice_before_evap(c) = h2osoi_ice(c,1) + h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_solidevap_from_top_layer(c) * dtime end if end do @@ -2279,19 +2283,41 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then if (snl(c)+1 >= 1) then + num_modifiedc = num_modifiedc + 1 + filter_modifiedc(num_modifiedc) = c + h2osoi_liq(c,1) = h2osoi_liq(c,1) + qflx_liqdew_to_top_layer(c) * dtime h2osoi_ice(c,1) = h2osoi_ice(c,1) + (qflx_soliddew_to_top_layer(c) * dtime) - if ((qflx_solidevap_from_top_layer(c)*dtime - h2osoi_ice(c,1)) > tolerance) then - call endrun(msg="urban qflx_solidevap_from_top_layer too large! "//errmsg(sourcefile, __LINE__)) - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_solidevap_from_top_layer(c) * dtime) - end if + h2osoi_ice_before_evap(c) = h2osoi_ice(c,1) + h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_solidevap_from_top_layer(c) * dtime) end if end if end do - end associate + call truncate_small_values( & + num_f = num_modifiedc, & + filter_f = filter_modifiedc, & + lb = bounds%begc, & + ub = bounds%endc, & + data_baseline = h2osoi_ice_before_evap(bounds%begc:bounds%endc), & + data = h2osoi_ice(bounds%begc:bounds%endc, 1), & + custom_rel_epsilon = tolerance) + + do fc = 1, num_modifiedc + c = filter_modifiedc(fc) + + if (h2osoi_ice(c,1) < 0._r8) then + write(iulog,*) "ERROR: In RenewCondensation, h2osoi_ice has gone significantly negative" + write(iulog,*) "c = ", c + write(iulog,*) "h2osoi_ice_before_evap = ", h2osoi_ice_before_evap(c) + write(iulog,*) "h2osoi_ice(c,1) = ", h2osoi_ice(c,1) + write(iulog,*) "qflx_solidevap_from_top_layer*dtime = ", qflx_solidevap_from_top_layer(c)*dtime + call endrun("In RenewCondensation, h2osoi_ice has gone significantly negative") + end if + end do + + end associate end subroutine RenewCondensation !#8 From a4c2e3d73a70f8bd9e6469a35f51e4de7569c189 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 11 Mar 2021 16:05:56 -0700 Subject: [PATCH 1849/1973] Use a valid resolution for lilac --- python/ctsm/lilac_build_ctsm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index 2e428d69a8..c44ad6831e 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -23,7 +23,7 @@ # these are arbitrary, since we only use the case for its build, not any of the runtime # settings; they just need to be valid _COMPSET = 'I2000Ctsm50NwpSpAsRs' -_RES = 'f10_f10_musgs' +_RES = 'f10_f10_mg37' _PATH_TO_TEMPLATES = os.path.join(path_to_ctsm_root(), 'lilac', From c4a83b807d036e826538e6d6ace407dc08136494 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 12 Mar 2021 12:50:10 -0700 Subject: [PATCH 1850/1973] Add -k oed to qsub command for cheyenne cheyenne has disabled qpeek, so this seems useful so we can see the ongoing job output --- python/ctsm/machine_defaults.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ctsm/machine_defaults.py b/python/ctsm/machine_defaults.py index f4df95b768..78b6062f50 100644 --- a/python/ctsm/machine_defaults.py +++ b/python/ctsm/machine_defaults.py @@ -49,7 +49,7 @@ # to add more flexibility in the future, making the node / proc counts # individually selectable required_args= - '-l select=1:ncpus=36:mpiprocs=1 -r n -l inception=login') + '-l select=1:ncpus=36:mpiprocs=1 -r n -l inception=login -k oed') }), 'hobart': MachineDefaults( job_launcher_type=JOB_LAUNCHER_QSUB, From d25a22f1196b56d2b2948fd2fded6fa9b99b7de0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 12 Mar 2021 20:08:44 -0700 Subject: [PATCH 1851/1973] Point to updated cime branch Avoid adding CDEPS things to inc & lib paths with LILAC --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 7b93187762..efca327610 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -37,7 +37,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.37_a01 +tag = branch_tags/cime5.8.37_a02 required = True [cmeps] From c14e9331817b50d9a163b8d831e2d86b194594ef Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 15 Mar 2021 14:32:17 -0600 Subject: [PATCH 1852/1973] Update ChangeLog --- doc/ChangeLog | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 114 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4b42c37131..43ca9a65fd 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,117 @@ =============================================================== +Tag name: ctsm5.1.dev027 +Originator(s): sacks (Bill Sacks) +Date: Mon Mar 15 14:05:20 MDT 2021 +One-line Summary: Update cime and other externals; includes switch to pio2 + +Purpose and description of changes +---------------------------------- + +Updates cime and other externals to version in cesm2_3_alpha02b (with +some minor changes to cime on top of that). This includes substantial +changes to cime, including switching to PIO2 rather than PIO1. + +Also: + +- For LILAC, changes default pio_rearranger now that we're using PIO2 by + default + +- In run_sys_tests, adds '-k oed' to qsub command on cheyenne; this is + useful now that qpeek is disabled on cheyenne (this puts the job's + stdout and stderr files directly in their final location from the + beginning, rather than keeping them in some temporary location on the + compute node until the job completes) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1175 (Once there is a cime tag with pio2 as the + default, update to it) +- Resolves ESCOMP/CTSM#1194 (Once we switch to pio2 by default, change + the default rearranger used in LILAC) + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- PIO2 is now the default. This has been tested extensively, but let us + know if you run into any I/O related issues. Also, from testing we've + done, I/O performance looks better than with PIO1 in many cases, but + also let us know if you see a substantial degradation in I/O + performance. + +Changes made to namelist defaults (e.g., changed parameter values): +- Some I/O-related defaults change with the use of PIO2 rather than PIO1 + +Substantial timing or memory changes: +- Various changes due to the change to PIO2, some of them large. For the + most part, timing improves with PIO2, particularly for production + resolutions. +- The PFS test and many others show a substantial improvement in timing. + This is especially noticeable in initialization time. For example, the + initialization time of + PFS_Ld20.f09_g17.I2000Clm50BgcCrop.cheyenne_intel dropped from 111 sec + to 34 sec. (These tests were run a couple of weeks apart, before and + after a cheyenne upgrade, so there may be some machine variability in + these numbers, but I saw a big improvement a few months ago with a + more objective comparison.) + +Testing summary: +---------------- + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- ok + izumi ------- pass + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but just for nuopc + + Summarize any changes to answers, i.e., + - what code configurations: Just with nuopc driver + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Not investigated + + The only test that changes answers is + SMS_D_Ld5_Vnuopc.f10_f10_mg37.I2000Clm50BgcCrop.cheyenne_intel.clm-default + + (There are NLCOMP failures in all tests, though, due to the update to pio2.) + +Other details +------------- +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- CISM: cism2_1_69 -> cism2_1_75 +- RTM: rtm1_0_73 -> rtm1_0_74 +- MOSART: mosart1_0_38 -> branch_tag/pio2.n01_mosart1_0_38 +- CIME: branch_tags/cime5.8.32_a02 -> branch_tags/cime5.8.37_a02 +- CMEPS: 7654038 -> c4acaa8 +- CDEPS: 45b7a85 -> 1f02a73 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev026 Originator(s): sacks (Bill Sacks) Date: Mon Mar 8 13:20:33 MST 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 1ecd52894f..879dd24fea 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev027 sacks 03/15/2021 Update cime and other externals; includes switch to pio2 ctsm5.1.dev026 sacks 03/08/2021 Change f10 tests to use mg37 mask ctsm5.1.dev025 sacks 02/23/2021 Refactor ozone code, and misc. small fixes ctsm5.1.dev024 slevis 02/20/2021 Grid cell-level error check for H2O From 84d80dcdec85d6ed25782ee194ea56f29f232b7d Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 15 Mar 2021 19:11:54 -0600 Subject: [PATCH 1853/1973] Include scale_by_thickness flag and DZSOI in restart files To correct how init_interp handles the variables H2OSOI_LIQ and H2OSOI_ICE, I have added as a first step a new scale_by_thickness flag as well as DZSOI to restart files. --- src/biogeophys/WaterStateType.F90 | 2 ++ src/main/histFileMod.F90 | 2 +- src/main/subgridRestMod.F90 | 15 +++++++++++++++ src/utils/restUtilMod.F90.in | 29 ++++++++++++++++++++++++++--- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index c0b7abc6a5..61edeb4ef5 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -578,6 +578,7 @@ subroutine Restart(this, bounds, ncid, flag, & dim1name='column', dim2name='levtot', switchdim=.true., & long_name=this%info%lname('liquid water'), & units='kg/m2', & + scale_by_thickness=.true., & interpinic_flag='interp', readvar=readvar, data=this%h2osoi_liq_col) call restartvar(ncid=ncid, flag=flag, & @@ -586,6 +587,7 @@ subroutine Restart(this, bounds, ncid, flag, & dim1name='column', dim2name='levtot', switchdim=.true., & long_name=this%info%lname('ice lens'), & units='kg/m2', & + scale_by_thickness=.true., & interpinic_flag='interp', readvar=readvar, data=this%h2osoi_ice_col) call restartvar(ncid=ncid, flag=flag, & diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 5c43e1540d..7235da6eb7 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -13,7 +13,7 @@ module histFileMod use spmdMod , only : masterproc use abortutils , only : endrun use clm_varctl , only : iulog, use_vertsoilc, use_fates, compname - use clm_varcon , only : spval, ispval, dzsoi_decomp + use clm_varcon , only : spval, ispval use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort use decompMod , only : get_proc_bounds, get_proc_global, bounds_type use GetGlobalValuesMod , only : GetGlobalIndexArray diff --git a/src/main/subgridRestMod.F90 b/src/main/subgridRestMod.F90 index 4bcb69b928..378ed78612 100644 --- a/src/main/subgridRestMod.F90 +++ b/src/main/subgridRestMod.F90 @@ -539,6 +539,21 @@ subroutine subgridRest_write_and_read(bounds, ncid, flag) end if deallocate(temp2d) + ! Soil column variables + + allocate(temp2d(bounds%begc:bounds%endc,1:nlevmaxurbgrnd)) + if (flag == 'write') then + temp2d(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) = col%dz(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) + end if + call restartvar(ncid=ncid, flag=flag, varname='DZSOI', xtype=ncd_double, & + dim1name='column', dim2name='levgrnd', switchdim=.true., lowerb2=1, upperb2=nlevmaxurbgrnd, & + long_name='soil layer thickness', units='m', & + interpinic_flag='skip', readvar=readvar, data=temp2d) + if (flag == 'read') then + col%dz(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) = temp2d(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) + end if + deallocate(temp2d) + end subroutine subgridRest_write_and_read !----------------------------------------------------------------------- diff --git a/src/utils/restUtilMod.F90.in b/src/utils/restUtilMod.F90.in index ea8b8ff84d..99cf72169d 100644 --- a/src/utils/restUtilMod.F90.in +++ b/src/utils/restUtilMod.F90.in @@ -47,6 +47,9 @@ module restUtilMod integer,parameter, public :: iflag_noswitchdim = 0 integer,parameter, public :: iflag_switchdim = 1 + integer,parameter, public :: iflag_no_scale_by_thickness = 0 + integer,parameter, public :: iflag_scale_by_thickness = 1 + public :: restartvar ! Set values of a missing restart field from a template field, with some constant @@ -356,7 +359,7 @@ contains !TYPE int,double subroutine restartvar_2d_{TYPE}_bounds(ncid, flag, varname, xtype, & dim1name, dim2name, switchdim, lowerb2, upperb2, & - long_name, units, interpinic_flag, data, readvar, & + long_name, units, scale_by_thickness, interpinic_flag, data, readvar, & comment, flag_meanings, missing_value, fill_value, & imissing_value, ifill_value, flag_values, nvalid_range ) @@ -384,6 +387,7 @@ contains integer , intent(in), optional :: lowerb2 integer , intent(in), optional :: upperb2 character(len=*) , intent(in), optional :: units ! long name for variable + logical , intent(in), optional :: scale_by_thickness ! to scale by thickness in vertical interpolation or not character(len=*) , intent(in), optional :: comment ! attribute character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute real(r8) , intent(in), optional :: missing_value ! attribute for real @@ -397,6 +401,7 @@ contains character(len=len(varname)) :: primary_varname ! first name in the varname list character(len=len(varname)) :: my_varname ! actual varname to read/write integer :: ivalue + logical :: scale_by_thickness_local ! set to .false. unless present(scale_by_thickness) type(var_desc_t) :: vardesc ! local vardesc integer :: status ! return error code integer :: varid ! returned var id @@ -442,9 +447,9 @@ contains call ncd_putatt(ncid, varid, 'varnames_on_old_files', trim(varname)) if (switchdim) then - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', 1) + status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', iflag_switchdim) else - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', 0) + status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', iflag_noswitchdim) end if status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_values', (/0,1/)) status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_is_0', & @@ -452,6 +457,24 @@ contains status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_is_1', & "1st and 2nd dims are switched from model representation") + if (dim2name == 'levtot' .or. dim2name == 'levgrnd' .or. dim2name == 'levmaxurbgrnd') then + if (present(scale_by_thickness)) then + scale_by_thickness_local = scale_by_thickness + else + scale_by_thickness_local = .false. + end if + if (scale_by_thickness_local) then + status = PIO_put_att(ncid, vardesc%varid, 'scale_by_thickness_flag', iflag_scale_by_thickness) + else + status = PIO_put_att(ncid, vardesc%varid, 'scale_by_thickness_flag', iflag_no_scale_by_thickness) + end if + status = PIO_put_att(ncid, vardesc%varid, 'scale_by_thickness_flag_values', (/0,1/)) + status = PIO_put_att(ncid, vardesc%varid, 'scale_by_thickness_flag_is_0', & + "scale_by_thickness is .false.") + status = PIO_put_att(ncid, vardesc%varid, 'scale_by_thickness_flag_is_1', & + "scale_by_thickness is .true.") + end if + if (present(comment)) then call ncd_putatt(ncid, varid, 'comment', trim(comment)) end if From f82a97d7392b90c71fa8b5145701daa3d80a159c Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 16 Mar 2021 23:53:12 -0600 Subject: [PATCH 1854/1973] Minor cleanup --- src/cpl/mct/lnd_set_decomp_and_domain.F90 | 4 ++-- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cpl/mct/lnd_set_decomp_and_domain.F90 b/src/cpl/mct/lnd_set_decomp_and_domain.F90 index 1b8edece43..13fa52a6dd 100644 --- a/src/cpl/mct/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/mct/lnd_set_decomp_and_domain.F90 @@ -12,8 +12,8 @@ module lnd_set_decomp_and_domain public :: lnd_set_decomp_and_domain_from_surfrd ! private member routines - public :: surfrd_get_globmask ! Reads global land mask (needed for setting domain decomp) - public :: surfrd_get_grid ! Read grid/ladnfrac data into domain (after domain decomp) + private :: surfrd_get_globmask ! Reads global land mask (needed for setting domain decomp) + private :: surfrd_get_grid ! Read grid/ladnfrac data into domain (after domain decomp) character(len=*), parameter, private :: sourcefile = & __FILE__ diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 14ab1032f5..028ea7e0da 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -272,6 +272,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) cism_evolve = .true. else if (trim(cvalue) == '.false.') then cism_evolve = .false. + else + call shr_sys_abort(subname//'Could not determine cism_evolve value '//trim(cvalue)) endif end if From 07d117f6d3558d12331ca6d2e3b525337c85aacf Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 17 Mar 2021 15:34:53 -0600 Subject: [PATCH 1855/1973] Remove unused argument --- src/cpl/lilac/lnd_comp_esmf.F90 | 2 +- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 +- src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 27b022f10c..5a28db04dc 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -341,7 +341,7 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- call ESMF_VMGetCurrent(vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lnd_set_decomp_and_domain_from_readmesh(mode='lilac', vm=vm, & + call lnd_set_decomp_and_domain_from_readmesh(vm=vm, & meshfile_lnd=lnd_mesh_filename, meshfile_mask=lnd_mesh_filename, mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 028ea7e0da..3420e131c4 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -522,7 +522,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lnd_set_decomp_and_domain_from_readmesh(mode='nuopc', vm=vm, & + call lnd_set_decomp_and_domain_from_readmesh(vm=vm, & meshfile_lnd=model_meshfile, meshfile_mask=meshfile_mask, mesh_ctsm=mesh, ni=ni, nj=nj, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index 0f9ec9bd51..230e65daa4 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -30,7 +30,7 @@ module lnd_set_decomp_and_domain contains !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshfile_mask, mesh_ctsm, & + subroutine lnd_set_decomp_and_domain_from_readmesh(vm, meshfile_lnd, meshfile_mask, mesh_ctsm, & ni, nj, rc) use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D @@ -40,7 +40,6 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(mode, vm, meshfile_lnd, meshf use clm_varctl , only : use_soil_moisture_streams ! input/output variables - character(len=*) , intent(in) :: mode ! lilac or nuopc mode type(ESMF_VM) , intent(in) :: vm character(len=*) , intent(in) :: meshfile_lnd character(len=*) , intent(in) :: meshfile_mask From ffb17526d725642d1359c19a98fbb24b9884292a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 17 Mar 2021 15:41:57 -0600 Subject: [PATCH 1856/1973] Add a comment --- src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index 230e65daa4..94d22c4069 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -832,6 +832,17 @@ end function chkerr !=============================================================================== subroutine lnd_set_read_write_landmask(write_file, read_file, lndmask_glob, lndfrac_glob, gsize) + ! This subroutine is currently unused (as of 2021-03-17), but it may be needed in the + ! future. Its purpose is: Now that we get landmask and landfrac at runtime, from + ! mapping the ocean mask to the land grid, it's possible that landfrac will be + ! roundoff-level different with different processor counts. Mariana Vertenstein + ! hasn't seen this happen yet, but if it does, then we can use this subroutine to + ! solve this issue in tests that change processor count (ERP, PEM). I think Mariana's + ! intent was: in the first run, we would write landmask and landfrac to a landfrac.nc + ! file; then, in the second run (with different processor count), we would read that + ! file rather than doing the mapping again. This way, both runs of the ERP or PEM + ! test would use consistent landmask and landfrac values. + use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile use ncdio_pio , only : ncd_defdim, ncd_defvar, ncd_enddef, ncd_inqdlen use ncdio_pio , only : ncd_int, ncd_double, ncd_pio_createfile From 87aaa7afbdeba337cc811396e0e053a7e3d23fb3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 17 Mar 2021 15:43:03 -0600 Subject: [PATCH 1857/1973] Add a comment (wording from Mariana Vertenstein) --- src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index 94d22c4069..a0ca93e84a 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -413,6 +413,12 @@ end subroutine lnd_set_decomp_and_domain_from_createmesh subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) ! Determine global 2d sizes from read of dimensions of surface dataset + ! + ! Meshes do not indicate if the mesh can be represented as a logically rectangular + ! grid. However, CTSM needs this information in the history file generation via the + ! logical variable isgrid2d. Since for CMEPS and LILAC there is no longer the need for + ! the fatmlndfrc file (where the isgrid2d variable was determined from before), the + ! surface dataset is now used to determine if the underlying grid is 2d or not. use clm_varctl , only : fsurdat, single_column use fileutils , only : getfil From 660cc8bce57a0dfb79c0400ba02055ba62c1e16f Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 17 Mar 2021 21:32:31 -0600 Subject: [PATCH 1858/1973] Update to latest rtm and mosart tags --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index efca327610..617adb644f 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -16,14 +16,14 @@ required = True local_path = components/rtm protocol = git repo_url = https://github.com/ESCOMP/RTM -tag = rtm1_0_74 +tag = rtm1_0_75 required = True [mosart] local_path = components/mosart protocol = git repo_url = https://github.com/ESCOMP/MOSART -tag = branch_tag/pio2.n01_mosart1_0_38 +tag = mosart1_0_41 required = True [mizuRoute] From 51519a8846cb567741ba08f94eba78555111727e Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 17 Mar 2021 22:01:44 -0600 Subject: [PATCH 1859/1973] Update ChangeLog --- doc/ChangeLog | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 84 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 43ca9a65fd..2a472c46e0 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,87 @@ =============================================================== +Tag name: ctsm5.1.dev028 +Originator(s): swensosc (Sean Swenson) +Date: Wed Mar 17 20:08:51 MDT 2021 +One-line Summary: Change limitation of top layer evaporation/sublimation + +Purpose and description of changes +---------------------------------- + +Sublimation from top soil layer and evaporation/sublimation from top +snow layer needs to be limited to ensure moisture states do not become +negative. The original formulation did not always work, so we added a +new limitation to SoilFluxesMod. + +Also removes a limitation in SoilHydrologyMod that seemed not to +conserve energy and should no longer be necessary with the reworked +limitation in SoilFluxesMod. + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1253 (h2osoi_ice can go significantly negative) + + +Notes of particular relevance for users +--------------------------------------- + +Caveats for users (e.g., need to interpolate initial conditions): +- The old flux limitation in SoilHydrologyMod has been replaced by a + truncation of roundoff-level values followed by a check that the final + state is non-negative. Although this check hasn't been triggered in + any of our testing, it's possible that we'll run into situations where + we need to relax the tolerance for this check. + +Testing summary: +---------------- + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + +Answer changes +-------------- + +Changes answers relative to baseline: YES + + Summarize any changes to answers, i.e., + - what code configurations: all + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + Not investigated carefully, but expected to be larger than + roundoff/same climate + + If bitwise differences were observed, how did you show they were no worse + than roundoff? N/A + + +Other details +------------- + +Pull Requests that document the changes (include PR ids): +https://github.com/ESCOMP/CTSM/pull/1282 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev027 Originator(s): sacks (Bill Sacks) Date: Mon Mar 15 14:05:20 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 879dd24fea..03ce7353d5 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev028 swensosc 03/17/2021 Change limitation of top layer evaporation/sublimation ctsm5.1.dev027 sacks 03/15/2021 Update cime and other externals; includes switch to pio2 ctsm5.1.dev026 sacks 03/08/2021 Change f10 tests to use mg37 mask ctsm5.1.dev025 sacks 02/23/2021 Refactor ozone code, and misc. small fixes From efedea0373cfab83905d12b283adffc21dd22586 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 18 Mar 2021 15:13:33 -0600 Subject: [PATCH 1860/1973] changes to get LILAC working - verified that nuopc cap is bfb --- src/cpl/lilac/lnd_comp_esmf.F90 | 12 +- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 +- .../share_esmf/lnd_set_decomp_and_domain.F90 | 136 +++++++++++++++--- 3 files changed, 124 insertions(+), 26 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index 5a28db04dc..c3ba631577 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -39,7 +39,7 @@ module lnd_comp_esmf use clm_driver , only : clm_drv use lnd_import_export , only : import_fields, export_fields use lnd_shr_methods , only : chkerr, state_diagnose - use lnd_set_decomp_and_domain, only : lnd_set_decomp_and_domain_from_readmesh + use lnd_set_decomp_and_domain, only :lnd_set_decomp_and_domain_from_readmesh implicit none private ! By default make data private except @@ -339,11 +339,11 @@ subroutine lnd_init(comp, import_state, export_state, clock, rc) !---------------------- ! Initialize decomposition (ldecomp) and domain (ldomain) types and generate land mesh !---------------------- - call ESMF_VMGetCurrent(vm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lnd_set_decomp_and_domain_from_readmesh(vm=vm, & - meshfile_lnd=lnd_mesh_filename, meshfile_mask=lnd_mesh_filename, mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + ! TODO: generalize this so that a mask mesh is read in like for nuopc/cmeps + ! For now set the meshfile_mask equal to the model_meshfile + call lnd_set_decomp_and_domain_from_readmesh(driver='lilac', vm=vm, & + meshfile_lnd=lnd_mesh_filename, meshfile_mask=lnd_mesh_filename, & + mesh_ctsm=lnd_mesh, ni=ni, nj=nj, rc=rc) !-------------------------------- ! Finish initializing ctsm diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 3420e131c4..3c8006e5b4 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -522,7 +522,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lnd_set_decomp_and_domain_from_readmesh(vm=vm, & + call lnd_set_decomp_and_domain_from_readmesh(driver='cmeps', vm=vm, & meshfile_lnd=model_meshfile, meshfile_mask=meshfile_mask, mesh_ctsm=mesh, ni=ni, nj=nj, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index a0ca93e84a..c37ad36c07 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -10,13 +10,14 @@ module lnd_set_decomp_and_domain private ! except ! Module public routines - public :: lnd_set_decomp_and_domain_from_readmesh - public :: lnd_set_decomp_and_domain_from_createmesh + public :: lnd_set_decomp_and_domain_from_readmesh ! nuopc/cmeps + public :: lnd_set_decomp_and_domain_from_createmesh ! nuopc/cmeps ! Module private routines private :: lnd_get_global_dims private :: lnd_set_lndmask_from_maskmesh private :: lnd_set_lndmask_from_lndmesh + private :: lnd_set_lndmask_from_fatmlndfrc private :: lnd_set_ldomain_gridinfo_from_mesh private :: chkerr private :: pio_check_err @@ -30,7 +31,7 @@ module lnd_set_decomp_and_domain contains !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_readmesh(vm, meshfile_lnd, meshfile_mask, mesh_ctsm, & + subroutine lnd_set_decomp_and_domain_from_readmesh(driver, vm, meshfile_lnd, meshfile_mask, mesh_ctsm, & ni, nj, rc) use decompInitMod , only : decompInit_ocn, decompInit_lnd, decompInit_lnd3D @@ -40,11 +41,12 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(vm, meshfile_lnd, meshfile_ma use clm_varctl , only : use_soil_moisture_streams ! input/output variables + character(len=*) , intent(in) :: driver ! cmeps or lilac type(ESMF_VM) , intent(in) :: vm character(len=*) , intent(in) :: meshfile_lnd character(len=*) , intent(in) :: meshfile_mask type(ESMF_Mesh) , intent(out) :: mesh_ctsm - integer , intent(out) :: ni,nj ! global grid dimensions + integer , intent(out) :: ni,nj ! global grid dimensions integer , intent(out) :: rc ! local variables @@ -88,21 +90,27 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(vm, meshfile_lnd, meshfile_ma mesh_lndinput = ESMF_MeshCreate(filename=trim(meshfile_lnd), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Read in mask meshfile if needed - if (trim(meshfile_mask) /= trim(meshfile_lnd)) then - mesh_maskinput = ESMF_MeshCreate(filename=trim(meshfile_mask), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + if (trim(driver) == 'cmeps') then + ! Read in mask meshfile if needed + if (trim(meshfile_mask) /= trim(meshfile_lnd)) then + mesh_maskinput = ESMF_MeshCreate(filename=trim(meshfile_mask), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if - ! Determine lndmask_glob and lndfrac_glob - if (trim(meshfile_mask) /= trim(meshfile_lnd)) then - ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh - call lnd_set_lndmask_from_maskmesh(mesh_lndinput, mesh_maskinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! Determine lndmask_glob and lndfrac_glob + if (trim(meshfile_mask) /= trim(meshfile_lnd)) then + ! obain land mask and land fraction by mapping ocean mesh conservatively to land mesh + call lnd_set_lndmask_from_maskmesh(mesh_lndinput, mesh_maskinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + else + ! obtain land mask from land mesh file - assume that land frac is identical to land mask + call lnd_set_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + end if + else if (trim(driver) == 'lilac') then + call lnd_set_lndmask_from_fatmlndfrc(lndmask_glob, lndfrac_glob, ni,nj) else - ! obtain land mask from land mesh file - assume that land frac is identical to land mask - call lnd_set_lndmask_from_lndmesh(mesh_lndinput, vm, gsize, lndmask_glob, lndfrac_glob, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return + call shr_sys_abort('driver '//trim(driver)//' is not supported, must be lilac or cmeps') end if ! Determine lnd decomposition that will be used by ctsm from lndmask_glob @@ -307,8 +315,8 @@ subroutine lnd_set_decomp_and_domain_from_createmesh(domain_file, vm, mesh_ctsm, call pio_check_err(rcode, 'pio_get_var for area in file '//trim(domain_file)) scol_area = scol_data(1) - ! reset ni and nj to be single point values - ni = 1 + ! reset ni and nj to be single point values + ni = 1 nj = 1 ! determine mincornerCoord and maxcornerCoord neede to create ESMF grid @@ -676,6 +684,95 @@ subroutine lnd_set_lndmask_from_lndmesh(mesh_lnd, vm, gsize, lndmask_glob, lndfr end subroutine lnd_set_lndmask_from_lndmesh + !=============================================================================== + subroutine lnd_set_lndmask_from_fatmlndfrc(mask, frac, ni, nj) + + ! Read the surface dataset grid related information + ! This is used to set the domain decomposition - so global data is read here + + use clm_varctl , only : fatmlndfrc + use fileutils , only : getfil + use ncdio_pio , only : ncd_io, ncd_pio_openfile, ncd_pio_closefile, ncd_inqfdims, file_desc_t + use abortutils , only : endrun + use shr_log_mod, only : errMsg => shr_log_errMsg + + ! input/output variables + integer , pointer :: mask(:) ! grid mask + real(r8) , pointer :: frac(:) ! grid fraction + integer , intent(out) :: ni, nj ! global grid sizes + + ! local variables + logical :: isgrid2d + integer :: dimid,varid ! netCDF id's + integer :: ns ! size of grid on file + integer :: n,i,j ! index + integer :: ier ! error status + type(file_desc_t) :: ncid ! netcdf id + character(len=256) :: varname ! variable name + character(len=256) :: locfn ! local file name + logical :: readvar ! read variable in or not + integer , allocatable :: idata2d(:,:) + real(r8), allocatable :: rdata2d(:,:) + character(len=32) :: subname = 'lnd_set_mask_from_fatmlndfrc' ! subroutine name + !----------------------------------------------------------------------- + + ! Open file + call getfil( fatmlndfrc, locfn, 0 ) + call ncd_pio_openfile (ncid, trim(locfn), 0) + + ! Determine dimensions and if grid file is 2d or 1d + call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) + if (masterproc) then + write(iulog,*)'lat/lon grid flag (isgrid2d) is ',isgrid2d + end if + + if (isgrid2d) then + ! Grid is 2d + allocate(idata2d(ni,nj)) + idata2d(:,:) = 1 + call ncd_io(ncid=ncid, varname='mask', data=idata2d, flag='read', readvar=readvar) + if (readvar) then + do j = 1,nj + do i = 1,ni + n = (j-1)*ni + i + mask(n) = idata2d(i,j) + enddo + enddo + else + call endrun( msg=' ERROR: mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + end if + deallocate(idata2d) + allocate(rdata2d(ni,nj)) + rdata2d(:,:) = 1._r8 + call ncd_io(ncid=ncid, varname='frac', data=rdata2d, flag='read', readvar=readvar) + if (readvar) then + do j = 1,nj + do i = 1,ni + n = (j-1)*ni + i + frac(n) = rdata2d(i,j) + enddo + enddo + else + call endrun( msg=' ERROR: mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + end if + deallocate(rdata2d) + else + ! Grid is not 2d + call ncd_io(ncid=ncid, varname='mask', data=mask, flag='read', readvar=readvar) + if (.not. readvar) then + call endrun( msg=' ERROR: mask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + end if + call ncd_io(ncid=ncid, varname='frac', data=frac, flag='read', readvar=readvar) + if (.not. readvar) then + call endrun( msg=' ERROR: frac not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) + end if + end if + + ! Close file + call ncd_pio_closefile(ncid) + + end subroutine lnd_set_lndmask_from_fatmlndfrc + !=============================================================================== subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgrid2d, ni, nj, ldomain, rc) @@ -894,4 +991,5 @@ subroutine lnd_set_read_write_landmask(write_file, read_file, lndmask_glob, lndf end subroutine lnd_set_read_write_landmask + end module lnd_set_decomp_and_domain From 1e63871d7d69c13ee0019db4a91fa4761a41b5e9 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 18 Mar 2021 21:31:31 -0600 Subject: [PATCH 1861/1973] Update ChangeLog --- doc/ChangeLog | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 83 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 2a472c46e0..0457cbf22a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,86 @@ =============================================================== +Tag name: ctsm5.1.dev029 +Originator(s): mvertens (Mariana Vertenstein), sacks (Bill Sacks) +Date: Thu Mar 18 21:21:21 MDT 2021 +One-line Summary: Rework domain initialization for nuopc + +Purpose and description of changes +---------------------------------- + +Total rework of land domain initialization - no longer need domain files +to be created with NUOPC cap. + +Also, significant performance improvements with the NUOPC cap. + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Notes of particular relevance for developers: +--------------------------------------------- + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): +- We still need to figure out how to apply this to LILAC: for now, LILAC + is still using the old method (as is MCT): reading domain information + from fatmlndfrac + + +Testing summary: +---------------- + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- PASS + +Answer changes +-------------- + +Changes answers relative to baseline: YES, but just for NUOPC and +limited changes for LILAC + + Summarize any changes to answers, i.e., + - what code configurations: NUOPC, and limited changes for LILAC + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + roundoff + + For nuopc: changes in area (relatively large differences in the + f10 test in the test suite, but Mariana saw only very small + changes in an f09 case), landfrac; these influence l2r fields, + which in turn influence TWS and methane fields. + + For lilac: just changes in area + + If bitwise differences were observed, how did you show they were no worse + than roundoff? Examination of cprnc diffs. + +Other details +------------- + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- rtm: rtm1_0_74 -> rtm1_0_75 +- mosart: branch_tag/pio2.n01_mosart1_0_38 -> mosart1_0_41 + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/CTSM/pull/1258 +- https://github.com/ESCOMP/CTSM/pull/1236 (closed and replaced by 1258) + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev028 Originator(s): swensosc (Sean Swenson) Date: Wed Mar 17 20:08:51 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 03ce7353d5..7b4a2b02a9 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev029 mvertens 03/18/2021 Rework domain initialization for nuopc ctsm5.1.dev028 swensosc 03/17/2021 Change limitation of top layer evaporation/sublimation ctsm5.1.dev027 sacks 03/15/2021 Update cime and other externals; includes switch to pio2 ctsm5.1.dev026 sacks 03/08/2021 Change f10 tests to use mg37 mask From 8b7236d96dd8943122fa7ebb7ff5c99e2400f56b Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 8 Mar 2021 21:34:33 -0700 Subject: [PATCH 1862/1973] updates for single column --- cime_config/buildnml | 1 + cime_config/testdefs/testlist_clm.xml | 8 +- src/biogeochem/SatellitePhenologyMod.F90 | 17 - src/cpl/nuopc/lnd_comp_nuopc.F90 | 167 +++++++--- src/cpl/nuopc/lnd_import_export.F90 | 12 +- .../share_esmf/lnd_set_decomp_and_domain.F90 | 298 ++++-------------- 6 files changed, 187 insertions(+), 316 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index f60206a01d..9f76913010 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -61,6 +61,7 @@ def buildnml(case, caseroot, compname): run_reftod = case.get_value("RUN_REFTOD") glc_nec = case.get_value("GLC_NEC") mask = case.get_value("MASK_GRID") + driver = case.get_value("COMP_INTERFACE").lower() # ----------------------------------------------------- # Set ctsmconf diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index c304a4bb27..b3f93c0ae1 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1477,7 +1477,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1653,7 +1653,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1662,7 +1662,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1670,7 +1670,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 7b5aea35dd..1d273a9e64 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -17,7 +17,6 @@ module SatellitePhenologyMod use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use abortutils , only : endrun - use clm_varctl , only : scmlat,scmlon,single_column use clm_varctl , only : iulog, use_lai_streams, inst_name use clm_varcon , only : grlnd use controlMod , only : NLFilename @@ -501,7 +500,6 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) use domainMod , only : ldomain use fileutils , only : getfil use clm_varctl , only : fsurdat - use shr_scam_mod, only : shr_scam_getCloseLatLon ! ! !ARGUMENTS: type(bounds_type), intent(in) :: bounds @@ -511,7 +509,6 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) type(file_desc_t) :: ncid ! netcdf id real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set real(r8), pointer :: mlai(:,:) ! lai read from input files - real(r8):: closelat,closelon ! single column vars integer :: ier ! error code integer :: g,k,l,m,n,p ! indices integer :: ni,nj,ns ! indices @@ -520,7 +517,6 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) integer :: nlon_i ! number of input data longitudes integer :: nlat_i ! number of input data latitudes integer :: npft_i ! number of input data patch types - integer :: closelatidx,closelonidx ! single column vars logical :: isgrid2d ! true => file is 2d character(len=256) :: locfn ! local file name character(len=32) :: subname = 'readAnnualVegetation' @@ -553,11 +549,6 @@ subroutine readAnnualVegetation (bounds, canopystate_inst) end if call check_dim_size(ncid, 'lsmpft', maxsoil_patches) - if (single_column) then - call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - closelat, closelon, closelatidx, closelonidx) - endif - do k=1,12 !! loop over months and read vegetated data call ncd_io(ncid=ncid, varname='MONTHLY_LAI', flag='read', data=mlai, & @@ -600,7 +591,6 @@ subroutine readMonthlyVegetation (bounds, & use pftconMod , only : noveg use fileutils , only : getfil use spmdMod , only : masterproc, mpicom, MPI_REAL8, MPI_INTEGER - use shr_scam_mod , only : shr_scam_getCloseLatLon use clm_time_manager , only : get_nstep use netcdf ! @@ -620,8 +610,6 @@ subroutine readMonthlyVegetation (bounds, & integer :: nlat_i ! number of input data latitudes integer :: npft_i ! number of input data patch types integer :: ier ! error code - integer :: closelatidx,closelonidx - real(r8):: closelat,closelon logical :: readvar real(r8), pointer :: mlai(:,:) ! lai read from input files real(r8), pointer :: msai(:,:) ! sai read from input files @@ -651,11 +639,6 @@ subroutine readMonthlyVegetation (bounds, & call getfil(fveg, locfn, 0) call ncd_pio_openfile (ncid, trim(locfn), 0) - if (single_column) then - call shr_scam_getCloseLatLon (ncid, scmlat, scmlon, closelat, closelon,& - closelatidx, closelonidx) - endif - do k=1,2 !loop over months and read vegetated data call ncd_io(ncid=ncid, varname='MONTHLY_LAI', flag='read', data=mlai, dim1name=grlnd, & diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 3c8006e5b4..83943c3f76 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -76,6 +76,9 @@ module lnd_comp_nuopc real(R8) :: orb_mvelp ! attribute - moving vernal equinox longitude real(R8) :: orb_eccen ! attribute and update- orbital eccentricity + logical :: single_column ! single column mode (nn search of domainfile) + logical :: scol_valid ! if single_column, does point have a mask of zero + character(len=*) , parameter :: orb_fixed_year = 'fixed_year' character(len=*) , parameter :: orb_variable_year = 'variable_year' character(len=*) , parameter :: orb_fixed_parameters = 'fixed_parameters' @@ -281,11 +284,11 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(iulog,'(a )')' atm component = '//trim(atm_model) write(iulog,'(a )')' rof component = '//trim(rof_model) write(iulog,'(a )')' glc component = '//trim(glc_model) - write(iulog,'(a,L1 )')' atm_prognostic = ',atm_prognostic - write(iulog,'(a,L1 )')' rof_prognostic = ',rof_prognostic - write(iulog,'(a,L1 )')' glc_present = ',glc_present + write(iulog,'(a,l )')' atm_prognostic = ',atm_prognostic + write(iulog,'(a,l )')' rof_prognostic = ',rof_prognostic + write(iulog,'(a,l )')' glc_present = ',glc_present if (glc_present) then - write(iulog,'(a,L1)')' cism_evolve = ',cism_evolve + write(iulog,'(a,l)')' cism_evolve = ',cism_evolve end if write(iulog,'(a )')' flds_scalar_name = '//trim(flds_scalar_name) write(iulog,'(a,i8)')' flds_scalar_num = ',flds_scalar_num @@ -314,8 +317,9 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) use clm_instMod , only : lnd2atm_inst, lnd2glc_inst, water_inst use domainMod , only : ldomain use decompMod , only : ldecomp, bounds_type, get_proc_bounds - use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_createmesh use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_readmesh + use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_single_column + use lnd_set_decomp_and_domain , only : lnd_set_mesh_for_single_column ! input/output variables type(ESMF_GridComp) :: gcomp @@ -330,6 +334,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) type(ESMF_Time) :: startTime ! Start time type(ESMF_Time) :: refTime ! Ref time type(ESMF_TimeInterval) :: timeStep ! Model timestep + type(ESMF_Calendar) :: esmf_calendar ! esmf calendar type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type integer :: ref_ymd ! reference date (YYYYMMDD) integer :: ref_tod ! reference time of day (sec) @@ -349,14 +354,21 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: lbnum ! input to memory diagnostic integer :: shrlogunit ! original log unit type(bounds_type) :: bounds ! bounds - integer :: ni, nj + integer :: n, ni, nj character(len=CL) :: cvalue ! config data character(len=CL) :: meshfile_mask - character(len=CL) :: domain_file character(len=CL) :: ctitle ! case description title character(len=CL) :: caseid ! case identifier name - real(r8) :: scmlat ! single-column latitude - real(r8) :: scmlon ! single-column longitude + character(len=CL) :: single_column_domainfile + real(r8) :: scol_lat ! single-column latitude + real(r8) :: scol_lon ! single-column longitude + real(r8) :: scol_area ! single-column area + real(r8) :: scol_frac ! single-column frac + integer :: scol_mask ! single-column mask + type(ESMF_Field) :: lfield + character(CL) ,pointer :: lfieldnamelist(:) => null() + integer :: fieldCount + real(r8), pointer :: fldptr(:) character(len=CL) :: model_version ! Model version character(len=CL) :: hostname ! hostname of machine running on character(len=CL) :: username ! user running the model @@ -366,6 +378,73 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) rc = ESMF_SUCCESS call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) + !---------------------------------------------------------------------------- + ! Single column logic - if mask is zero for nearest neighbor search then + ! set all export state fields to zero and return + !---------------------------------------------------------------------------- + + ! If single_column is true - use single_column_domainfile to + ! obtain nearest neighbor values for scol_lon and scol_lat + ! If single_column is false and scol_lon and scol_lat are not equal to -999 then + ! use scol_lon and scol_lat directly + + call NUOPC_CompAttributeGet(gcomp, name='scol_lon', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scol_lon + call NUOPC_CompAttributeGet(gcomp, name='scol_lat', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scol_lat + call NUOPC_CompAttributeGet(gcomp, name='single_column_domainfile', value=single_column_domainfile, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (scol_lon > -900. .and. scol_lat > -900.) then + if (trim(single_column_domainfile) /= 'null') then + single_column = .true. + write(iulog,'(a)')' single column mode is active:' + write(iulog,'(a,f13.5,a,f10.5,a)')' will find nearest neighbor values of ',scol_lon,' and ',& + scol_lat,' in '//trim(single_column_domainfile) + else + single_column = .false. + write(iulog,'(a)')' single point mode is active' + write(iulog,'(a,f13.5,a,f13.5,a)')' scol_lon is ',scol_lon,' and scol_lat is ' + end if + call lnd_set_mesh_for_single_column(single_column_domainfile, scol_lon, scol_lat, & + scol_area, scol_mask, scol_frac, mesh, scol_valid, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (.not. scol_valid) then + write(iulog,'(a)')' single column mode point does not contain any land - will set all export data to 0' + ! if single column is not valid - set all export state fields to zero and return + call realize_fields(gcomp, mesh, flds_scalar_name, flds_scalar_num, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call NUOPC_ModelGet(gcomp, exportState=exportState, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call State_SetScalar(1._r8, flds_scalar_index_nx, exportState, & + flds_scalar_name, flds_scalar_num, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call State_SetScalar(1._r8, flds_scalar_index_ny, exportState, & + flds_scalar_name, flds_scalar_num, rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + allocate(lfieldnamelist(fieldCount)) + call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + do n = 1, fieldCount + call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, farrayPtr=fldptr, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr(:) = 0._r8 + enddo + deallocate(lfieldnamelist) + ! ******************* + ! *** RETURN HERE *** + ! ******************* + RETURN + else + write(iulog,'(a,f10.5)')' single column mode lon/lat does contain land with land fraction ',scol_frac + end if + end if + !---------------------------------------------------------------------------- ! Reset shr logging to my log file !---------------------------------------------------------------------------- @@ -439,25 +518,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call NUOPC_CompAttributeGet(gcomp, name='model_version', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) model_version - call NUOPC_CompAttributeGet(gcomp, name='username', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) username - call NUOPC_CompAttributeGet(gcomp, name='hostname', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) hostname - call NUOPC_CompAttributeGet(gcomp, name='scmlon', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scmlon - call NUOPC_CompAttributeGet(gcomp, name='scmlat', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scmlat - call NUOPC_CompAttributeGet(gcomp, name='single_column', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) single_column - call NUOPC_CompAttributeGet(gcomp, name='start_type', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) starttype - ! Note that we assume that CTSM's internal dtime matches the coupling time step. ! i.e., we currently do NOT allow sub-cycling within a coupling time step. @@ -475,6 +535,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! --------------------- ! Initialize first phase of ctsm ! --------------------- + call NUOPC_CompAttributeGet(gcomp, name='hostname', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) hostname + call NUOPC_CompAttributeGet(gcomp, name='username', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) username call NUOPC_CompAttributeGet(gcomp, name='brnch_retain_casename', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) brnch_retain_casename @@ -496,7 +562,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call clm_varctl_set(& caseid_in=caseid, ctitle_in=ctitle, & brnch_retain_casename_in=brnch_retain_casename, & - single_column_in=single_column, scmlat_in=scmlat, scmlon_in=scmlon, & + single_column_in=single_column, scmlat_in=scol_lat, scmlon_in=scol_lon, & nsrest_in=nsrest, & version_in=model_version, & hostname_in=hostname, & @@ -507,17 +573,13 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! --------------------- ! Create ctsm decomp and domain info ! --------------------- - call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=model_meshfile, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (single_column) model_meshfile = 'create_mesh' - - if (trim(model_meshfile) == 'create_mesh') then - call NUOPC_CompAttributeGet(gcomp, name='domain_lnd', value=domain_file, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call lnd_set_decomp_and_domain_from_createmesh(domain_file=domain_file, vm=vm, & - mesh_ctsm=mesh, ni=ni, nj=nj, rc=rc) + if (scol_lon > -900. .and. scol_lat > -900.) then + call lnd_set_decomp_and_domain_from_single_column(scol_lon, scol_lat, & + scol_area, scol_mask, scol_frac) if (ChkErr(rc,__LINE__,u_FILE_u)) return else + call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=model_meshfile, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return call NUOPC_CompAttributeGet(gcomp, name='mesh_mask', value=meshfile_mask, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_GridCompGet(gcomp, vm=vm, rc=rc) @@ -536,11 +598,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! --------------------- ! Finish initializing ctsm ! --------------------- - ! If no land then abort for now - ! TODO: need to handle the case of noland with CMEPS - ! if ( noland ) then - ! call shr_sys_abort(trim(subname)//"ERROR: Currently cannot handle case of single column with non-land") - ! end if call initialize2(ni, nj) !-------------------------------- @@ -566,7 +623,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call State_SetScalar(dble(ldomain%ni), flds_scalar_index_nx, exportState, & flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call State_SetScalar(dble(ldomain%nj), flds_scalar_index_ny, exportState, & flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -596,6 +652,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) end subroutine InitializeRealize !=============================================================================== + subroutine ModelAdvance(gcomp, rc) !------------------------ @@ -656,10 +713,17 @@ subroutine ModelAdvance(gcomp, rc) rc = ESMF_SUCCESS call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO) - call ESMF_GridCompGet(gcomp, vm=vm, localPet=localPet, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return + !-------------------------------- + ! Single column logic if nearest neighbor point has a mask of zero + !-------------------------------- + + if (single_column .and. .not. scol_valid) then + RETURN + end if + + !-------------------------------- + ! Reset share log units + !-------------------------------- !$ call omp_set_num_threads(localPeCount) @@ -674,9 +738,14 @@ subroutine ModelAdvance(gcomp, rc) #endif !-------------------------------- - ! Query the Component for its clock, importState and exportState + ! Query the Component for its clock, importState and exportState and vm !-------------------------------- + call ESMF_GridCompGet(gcomp, vm=vm, localPet=localPet, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call NUOPC_ModelGet(gcomp, modelClock=clock, importState=importState, exportState=exportState, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 1c5a6423ad..df4b4d1a6e 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -197,6 +197,8 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r ! Advertise export fields !-------------------------------- + ! Need to determine if there is no land for single column before the advertise call is done + if (atm_prognostic .or. force_send_to_atm) then send_to_atm = .true. else @@ -216,11 +218,11 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r if (flds_co2b .or. flds_co2c) send_co2_to_atm = .true. if (flds_co2a .or. flds_co2b .or. flds_co2c) recv_co2_fr_atm = .true. if (masterproc) then - write(iulog,'(a,l1)') 'flds_co2a= ',flds_co2a - write(iulog,'(a,l1)') 'flds_co2b= ',flds_co2b - write(iulog,'(a,l1)') 'flds_co2c= ',flds_co2c - write(iulog,'(a,l1)') 'sending co2 to atm = ',send_co2_to_atm - write(iulog,'(a,l1)') 'receiving co2 from atm = ',recv_co2_fr_atm + write(iulog,'(a,l)') 'flds_co2a= ',flds_co2a + write(iulog,'(a,l)') 'flds_co2b= ',flds_co2b + write(iulog,'(a,l)') 'flds_co2c= ',flds_co2c + write(iulog,'(a,l)') 'sending co2 to atm = ',send_co2_to_atm + write(iulog,'(a,l)') 'receiving co2 from atm = ',recv_co2_fr_atm end if end if diff --git a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 index c37ad36c07..55ab210e18 100644 --- a/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/share_esmf/lnd_set_decomp_and_domain.F90 @@ -10,8 +10,9 @@ module lnd_set_decomp_and_domain private ! except ! Module public routines - public :: lnd_set_decomp_and_domain_from_readmesh ! nuopc/cmeps - public :: lnd_set_decomp_and_domain_from_createmesh ! nuopc/cmeps + public :: lnd_set_decomp_and_domain_from_readmesh + public :: lnd_set_mesh_for_single_column + public :: lnd_set_decomp_and_domain_for_single_column ! Module private routines private :: lnd_get_global_dims @@ -182,177 +183,35 @@ subroutine lnd_set_decomp_and_domain_from_readmesh(driver, vm, meshfile_lnd, mes end subroutine lnd_set_decomp_and_domain_from_readmesh !=============================================================================== - subroutine lnd_set_decomp_and_domain_from_createmesh(domain_file, vm, mesh_ctsm, ni, nj, rc) + subroutine lnd_set_mesh_for_single_column(scol_lon, scol_lat, mesh, rc) - ! Generate a new mesh from the input domain file and set the mask to 1 - - use decompInitMod , only : decompInit_lnd, decompInit_lnd3D - use decompMod , only : ldecomp, bounds_type, get_proc_bounds - use domainMod , only : ldomain, domain_init - use clm_varctl , only : use_soil_moisture_streams - use clm_varctl , only : scmlat, scmlon, single_column - use clm_varpar , only : nlevsoi - use ncdio_pio , only : pio_subsystem, io_type - use pio + ! Generate a mesh for single column + use netcdf + use clm_varcon, only : spval ! input/output variables - character(len=CL) , intent(in) :: domain_file - type(ESMF_VM) , intent(in) :: vm - type(ESMF_Mesh) , intent(out) :: mesh_ctsm - integer , intent(out) :: ni,nj ! global grid dimensions - integer , intent(out) :: rc + real(r8) , intent(in) :: scol_lon + real(r8) , intent(in) :: scol_lat + type(ESMF_Mesh) , intent(out) :: mesh + integer , intent(out) :: rc ! local variables - type(ESMF_Grid) :: lgrid - type(ESMF_Mesh) :: mesh_lndcreate - type(ESMF_DistGrid) :: distgrid_ctsm - integer, pointer :: gindex_ctsm(:) ! global index space for just land points - logical :: isgrid2d - integer :: i,j,g,n - integer :: nv - integer :: ierr - integer :: dimid - integer :: varid_xv, varid_yv - integer :: varid_xc, varid_yc - integer :: varid_area - real(r8), allocatable :: xc(:,:), yc(:,:) ! coordinates of centers - real(r8), allocatable :: xv(:,:,:), yv(:,:,:) ! coordinates of corners - integer :: maxIndex(2) - real(r8) :: mincornerCoord(2) - real(r8) :: maxcornerCoord(2) - integer :: spatialDim - integer :: numownedelements - real(r8) , pointer :: ownedElemCoords(:) - integer, allocatable :: lnd_mask(:) - type(bounds_type) :: bounds ! bounds - integer :: begg,endg - integer :: nlnd - integer :: start(2) ! start index to read in for single column mode - integer :: count(2) ! number of points to read in - real(r8) :: scol_data(1) ! temporary - integer , allocatable :: mask(:) ! temporary - real(r8), allocatable :: lats(:) ! temporary - real(r8), allocatable :: lons(:) ! temporary - real(r8), allocatable :: pos_lons(:) ! temporary - real(r8) :: pos_scmlon ! temporary - real(r8) :: scol_area ! temporary - type(file_desc_t) :: pioid - integer :: rcode ! error code + type(ESMF_Grid) :: lgrid + integer :: maxIndex(2) + real(r8) :: mincornerCoord(2) + real(r8) :: maxcornerCoord(2) + character(len=*), parameter :: subname= ' (lnd_set_mesh_for_single_column) ' !------------------------------------------------------------------------------- rc = ESMF_SUCCESS - rcode = pio_openfile(pio_subsystem, pioid, io_type, trim(domain_file), pio_nowrite) - call pio_check_err(rcode, 'error opening file '//trim(domain_file)) - call pio_seterrorhandling(pioid, PIO_BCAST_ERROR) - rcode = pio_inq_dimid(pioid, 'ni', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for ni in file '//trim(domain_file)) - rcode = pio_inquire_dimension(pioid, dimid, len=ni) - call pio_check_err(rcode, 'pio_inq_dimension for ni in file '//trim(domain_file)) - rcode = pio_inq_dimid(pioid, 'nj', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for nj in file '//trim(domain_file)) - rcode = pio_inquire_dimension(pioid, dimid, len=nj) - call pio_check_err(rcode, 'pio_inq_dimension for nj in file '//trim(domain_file)) - rcode = pio_inq_dimid(pioid, 'nv', dimid) - call pio_check_err(rcode, 'pio_inq_dimid for nv in file '//trim(domain_file)) - rcode = pio_inquire_dimension(pioid, dimid, len=nv) - call pio_check_err(rcode, 'pio_inq_dimension for nv in file '//trim(domain_file)) - rcode = pio_inq_varid(pioid, 'xc' , varid_xc) - call pio_check_err(rcode, 'pio_inq_varid for yc in file '//trim(domain_file)) - rcode = pio_inq_varid(pioid, 'yc' , varid_yc) - call pio_check_err(rcode, 'pio_inq_varid for yc in file '//trim(domain_file)) - rcode = pio_inq_varid(pioid, 'xv' , varid_xv) - call pio_check_err(rcode, 'pio_inq_varid for xv in file '//trim(domain_file)) - rcode = pio_inq_varid(pioid, 'yv' , varid_yv) - call pio_check_err(rcode, 'pio_inq_varid for yv in file '//trim(domain_file)) - rcode = pio_inq_varid(pioid, 'area', varid_area) - call pio_check_err(rcode, 'pio_inq_varid for area in file '//trim(domain_file)) - - if (single_column) then - - ! In this case the domain file is not a single point file - but normally a - ! global domain file where a nearest neighbor search will be done to find - ! the closest point in the domin file to scol_lon and scol_lat - - ! get center lats and lons from domain file - allocate(xc(ni,nj)) - allocate(yc(ni,nj)) - rcode = pio_get_var(pioid, varid_xc, xc) - call pio_check_err(rcode, 'pio_get_var for xc in file '//trim(domain_file)) - rcode = pio_get_var(pioid, varid_yc, yc) - call pio_check_err(rcode, 'pio_get_var for yc in file '//trim(domain_file)) - - ! find nearest neighbor indices of scmlon and scmlat in domain file - allocate(lats(nj)) - allocate(lons(ni)) - allocate(pos_lons(ni)) - do i = 1,ni - lons(i) = xc(i,1) - end do - do j = 1,nj - lats(j) = yc(1,j) - end do - pos_lons(:) = mod(lons(:) + 360._r8, 360._r8) - pos_scmlon = mod(scmlon + 360._r8, 360._r8) - start(1) = (MINLOC(abs(pos_lons - pos_scmlon), dim=1)) - start(2) = (MINLOC(abs(lats -scmlat ), dim=1)) - count(:) = 1 - deallocate(lons) - deallocate(lats) - - ! read in value of nearest neighbor lon and RESET scmlat - rcode = pio_get_var(pioid, varid_xc, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for xc in file '//trim(domain_file)) - scmlon = scol_data(1) - - ! read in value of nearest neighbor lon and RESET scmlon - rcode = pio_get_var(pioid, varid_yc, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for yc in file '//trim(domain_file)) - scmlat = scol_data(1) - - ! get area of gridcell - rcode = pio_get_var(pioid, varid_area, start, count, scol_data) - call pio_check_err(rcode, 'pio_get_var for area in file '//trim(domain_file)) - scol_area = scol_data(1) - - ! reset ni and nj to be single point values - ni = 1 - nj = 1 - - ! determine mincornerCoord and maxcornerCoord neede to create ESMF grid - maxIndex(1) = 1 ! number of lons - maxIndex(2) = 1 ! number of lats - mincornerCoord(1) = scmlon - scol_area/2._r8 ! min lon - mincornerCoord(2) = scmlat - scol_area/2._r8 ! min lat - maxcornerCoord(1) = scmlon + scol_area/2._r8 ! max lon - maxcornerCoord(2) = scmlat + scol_area/2._r8 ! max lat - deallocate(xc,yc) - - else - - ! allocate xv and yv and read them in - allocate(xv(nv,ni,nj)) - allocate(yv(nv,ni,nj)) - rcode = pio_get_var(pioid, varid_xv, xv) - call pio_check_err(rcode, 'pio_get_var for xv in file '//trim(domain_file)) - rcode = pio_get_var(pioid, varid_yv, yv) - call pio_check_err(rcode, 'pio_get_var for yv in file '//trim(domain_file)) - - ! determine mincornerCoord and maxcornerCoord neede to create ESMF grid - maxIndex(1) = ni ! number of lons - maxIndex(2) = nj ! number of lats - mincornerCoord(1) = xv(1,1,1) ! min lon - mincornerCoord(2) = yv(1,1,1) ! min lat - maxcornerCoord(1) = xv(3,ni,nj) ! max lon - maxcornerCoord(2) = yv(3,ni,nj) ! max lat - deallocate(xv,yv) - - end if - - ! close file - call pio_seterrorhandling(pioid, PIO_INTERNAL_ERROR) - call pio_closefile(pioid) - + ! Use center and come up with arbitrary area delta lon and lat = .1 degree + maxIndex(1) = 1 ! number of lons + maxIndex(2) = 1 ! number of lats + mincornerCoord(1) = scol_lon - .1_r8 ! min lon + mincornerCoord(2) = scol_lat - .1_r8 ! min lat + maxcornerCoord(1) = scol_lon + .1_r8 ! max lon + maxcornerCoord(2) = scol_lat + .1_r8 ! max lat ! create the ESMF grid lgrid = ESMF_GridCreateNoPeriDimUfrm (maxindex=maxindex, & mincornercoord=mincornercoord, maxcornercoord= maxcornercoord, & @@ -360,62 +219,51 @@ subroutine lnd_set_decomp_and_domain_from_createmesh(domain_file, vm, mesh_ctsm, if (ChkErr(rc,__LINE__,u_FILE_u)) return ! create the mesh from the lgrid - mesh_lndcreate = ESMF_MeshCreate(lgrid, rc=rc) + mesh = ESMF_MeshCreate(lgrid, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Set the mesh mask to 1 - call ESMF_MeshGet(mesh_lndcreate, spatialDim=spatialDim, numOwnedElements=numOwnedElements, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - allocate(ownedElemCoords(spatialDim*numownedelements)) - call ESMF_MeshGet(mesh_lndcreate, ownedElemCoords=ownedElemCoords, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - allocate(lnd_mask(numownedelements)) - lnd_mask(:) = 1 - ! call ESMF_MeshSet(mesh_lndcreate, elementMask=lnd_mask, rc=rc) - ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + end subroutine lnd_set_mesh_for_single_column + + !=============================================================================== + subroutine lnd_set_decomp_and_domain_for_single_column(scol_lon, scol_lat, scol_mask, scol_frac) + + use decompInitMod , only : decompInit_lnd, decompInit_lnd3D + use decompMod , only : bounds_type, get_proc_bounds + use domainMod , only : ldomain, domain_init + use clm_varctl , only : use_soil_moisture_streams + use clm_varpar , only : nlevsoi + use clm_varcon , only : spval + + ! input/output variables + real(r8) , intent(in) :: scol_lon + real(r8) , intent(in) :: scol_lat + integer , intent(in) :: scol_mask + real(r8) , intent(in) :: scol_frac + + ! local variables + type(bounds_type) :: bounds ! bounds + !------------------------------------------------------------------------------- ! Determine ldecomp and ldomain - call decompInit_lnd(lni=ni, lnj=nj, amask=lnd_mask) + call decompInit_lnd(lni=1, lnj=1, amask=(/1/)) if (use_soil_moisture_streams) then - call decompInit_lnd3D(lni=ni, lnj=nj, lnk=nlevsoi) + call decompInit_lnd3D(lni=1, lnj=1, lnk=nlevsoi) end if ! Initialize processor bounds call get_proc_bounds(bounds) - begg = bounds%begg - endg = bounds%endg - - ! Create gindex_ctsm - nlnd = endg - begg + 1 - allocate(gindex_ctsm(nlnd)) - do g = begg, endg - n = 1 + (g - begg) - gindex_ctsm(n) = ldecomp%gdc2glo(g) - end do ! Initialize domain data structure - isgrid2d = .true. - call domain_init(domain=ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) + call domain_init(domain=ldomain, isgrid2d=.false., ni=1, nj=1, nbeg=1, nend=1) - ! Determine ldomain%mask and ldomain%frac - do g = begg, endg - ldomain%mask(g) = 1 - ldomain%frac(g) = 1._r8 - end do + ! Initialize ldomain attributes + ldomain%lonc(1) = scol_lon + ldomain%latc(1) = scol_lat + ldomain%area(1) = spval + ldomain%mask(1) = scol_mask + ldomain%frac(1) = scol_frac - ! Generate a new mesh on the gindex decomposition - distGrid_ctsm = ESMF_DistGridCreate(arbSeqIndexList=gindex_ctsm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - mesh_ctsm = ESMF_MeshCreate(mesh_lndcreate, elementDistGrid=distgrid_ctsm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - ! Set ldomain%lonc, ldomain%latc and ldomain%area - call lnd_set_ldomain_gridinfo_from_mesh(mesh_ctsm, vm, gindex_ctsm, begg, endg, isgrid2d, ni, nj, ldomain, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - deallocate(lnd_mask) - - end subroutine lnd_set_decomp_and_domain_from_createmesh + end subroutine lnd_set_decomp_and_domain_for_single_column !=============================================================================== subroutine lnd_get_global_dims(ni, nj, gsize, isgrid2d) @@ -713,7 +561,8 @@ subroutine lnd_set_lndmask_from_fatmlndfrc(mask, frac, ni, nj) logical :: readvar ! read variable in or not integer , allocatable :: idata2d(:,:) real(r8), allocatable :: rdata2d(:,:) - character(len=32) :: subname = 'lnd_set_mask_from_fatmlndfrc' ! subroutine name + integer :: unitn + character(len=32) :: subname = 'lnd_set_mask_from_fatmlndfrc' ! subroutine name !----------------------------------------------------------------------- ! Open file @@ -779,8 +628,6 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr use domainMod , only : domain_type, lon1d, lat1d use clm_varcon , only : re - ! for reading in fatmlndfrc to override mesh data - use clm_varctl , only : fatmlndfrc use clm_varcon , only : grlnd use fileutils , only : getfil use ncdio_pio , only : ncd_io, file_desc_t, ncd_pio_openfile, ncd_pio_closefile @@ -806,12 +653,6 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr real(r8) , pointer :: lndlons_glob(:) real(r8) , pointer :: rtemp_glob(:) type(ESMF_Field) :: areaField - - ! for sanity check - remove when this is done - type(file_desc_t) :: ncid ! netcdf id - character(len=CL) :: locfn ! local file name - real(r8), pointer :: lonc_atmlndfrc(:) - real(r8), pointer :: latc_atmlndfrc(:) !------------------------------------------------------------------------------- rc = ESMF_SUCCESS @@ -880,31 +721,6 @@ subroutine lnd_set_ldomain_gridinfo_from_mesh(mesh, vm, gindex, begg, endg, isgr deallocate(rtemp_glob) end if - ! Sanity check- remove this when it is done - call getfil( trim(fatmlndfrc), locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - allocate(lonc_atmlndfrc(numownedelements)) - allocate(latc_atmlndfrc(numownedelements)) - call ncd_io(ncid=ncid, varname= 'xc' , flag='read', data=lonc_atmlndfrc , dim1name=grlnd) - call ncd_io(ncid=ncid, varname= 'yc' , flag='read', data=latc_atmlndfrc , dim1name=grlnd) - do g = begg,endg - n = g - begg + 1 - if ( abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) > 1.e-11 .and. & - abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) /= 360._r8) then - write(6,'(a,3(d20.13,2x))')'ERROR: lonc_atmlndfrac(n), ldomain%lonc(g), abs(diff) = ',& - lonc_atmlndfrc(n), ldomain%lonc(g), abs(lonc_atmlndfrc(n) - ldomain%lonc(g)) - call shr_sys_abort() - end if - if (abs(latc_atmlndfrc(n) - ldomain%latc(g)) > 1.e-11) then - write(6,'(a,3(d20.13,2x))')'ERROR: latc_atmlndfrac(n), ldomain%latc(g), abs(diff) = ',& - latc_atmlndfrc(n), ldomain%latc(g), abs(latc_atmlndfrc(n) - ldomain%latc(g)) - call shr_sys_abort() - end if - end do - deallocate(lonc_atmlndfrc) - deallocate(latc_atmlndfrc) - call ncd_pio_closefile(ncid) - end subroutine lnd_set_ldomain_gridinfo_from_mesh !=============================================================================== From bf8989cd03da3c855340e91275cf4dc582001d9f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 8 Mar 2021 22:43:42 -0700 Subject: [PATCH 1863/1973] bug fixes --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 12 ++++-------- src/cpl/nuopc/lnd_import_export.F90 | 18 +++++++----------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 83943c3f76..10999d51c5 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -413,15 +413,11 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (.not. scol_valid) then write(iulog,'(a)')' single column mode point does not contain any land - will set all export data to 0' ! if single column is not valid - set all export state fields to zero and return - call realize_fields(gcomp, mesh, flds_scalar_name, flds_scalar_num, rc) + call realize_fields(importState, exportState, mesh, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call NUOPC_ModelGet(gcomp, exportState=exportState, rc=rc) + call State_SetScalar(1._r8, flds_scalar_index_nx, exportState, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call State_SetScalar(1._r8, flds_scalar_index_nx, exportState, & - flds_scalar_name, flds_scalar_num, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call State_SetScalar(1._r8, flds_scalar_index_ny, exportState, & - flds_scalar_name, flds_scalar_num, rc) + call State_SetScalar(1._r8, flds_scalar_index_ny, exportState, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return @@ -592,7 +588,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! --------------------- ! Realize the actively coupled fields ! --------------------- - call realize_fields(gcomp, mesh, flds_scalar_name, flds_scalar_num, rc) + call realize_fields(importState, exportState, mesh, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! --------------------- diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index df4b4d1a6e..e84d267e1f 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -397,26 +397,22 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r end subroutine advertise_fields !=============================================================================== - subroutine realize_fields(gcomp, Emesh, flds_scalar_name, flds_scalar_num, rc) + subroutine realize_fields(importState, exportState, Emesh, flds_scalar_name, flds_scalar_num, rc) ! input/output variables - type(ESMF_GridComp) , intent(inout) :: gcomp - type(ESMF_Mesh) , intent(in) :: Emesh - character(len=*) , intent(in) :: flds_scalar_name - integer , intent(in) :: flds_scalar_num - integer , intent(out) :: rc + type(ESMF_State) , intent(inout) :: importState + type(ESMF_State) , intent(inout) :: exportState + type(ESMF_Mesh) , intent(in) :: Emesh + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(in) :: flds_scalar_num + integer , intent(out) :: rc ! local variables - type(ESMF_State) :: importState - type(ESMF_State) :: exportState character(len=*), parameter :: subname='(lnd_import_export:realize_fields)' !--------------------------------------------------------------------------- rc = ESMF_SUCCESS - call NUOPC_ModelGet(gcomp, importState=importState, exportState=exportState, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call fldlist_realize( & state=ExportState, & fldList=fldsFrLnd, & From 3134c88d095bfa56f1ab7543db3f10bfce960bf1 Mon Sep 17 00:00:00 2001 From: mvertens Date: Fri, 12 Mar 2021 12:39:36 -0700 Subject: [PATCH 1864/1973] updates for single column functionality --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 70 ++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 10999d51c5..42a446234e 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -318,8 +318,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) use domainMod , only : ldomain use decompMod , only : ldecomp, bounds_type, get_proc_bounds use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_readmesh - use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_single_column use lnd_set_decomp_and_domain , only : lnd_set_mesh_for_single_column + use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_for_single_column ! input/output variables type(ESMF_GridComp) :: gcomp @@ -359,16 +359,18 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) character(len=CL) :: meshfile_mask character(len=CL) :: ctitle ! case description title character(len=CL) :: caseid ! case identifier name - character(len=CL) :: single_column_domainfile real(r8) :: scol_lat ! single-column latitude real(r8) :: scol_lon ! single-column longitude real(r8) :: scol_area ! single-column area real(r8) :: scol_frac ! single-column frac integer :: scol_mask ! single-column mask + character(len=CL) :: single_column_lnd_domainfile type(ESMF_Field) :: lfield character(CL) ,pointer :: lfieldnamelist(:) => null() integer :: fieldCount - real(r8), pointer :: fldptr(:) + integer :: rank + real(r8), pointer :: fldptr1d(:) + real(r8), pointer :: fldptr2d(:,:) character(len=CL) :: model_version ! Model version character(len=CL) :: hostname ! hostname of machine running on character(len=CL) :: username ! user running the model @@ -383,7 +385,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! set all export state fields to zero and return !---------------------------------------------------------------------------- - ! If single_column is true - use single_column_domainfile to + ! If single_column is true - used single_column_domainfile to ! obtain nearest neighbor values for scol_lon and scol_lat ! If single_column is false and scol_lon and scol_lat are not equal to -999 then ! use scol_lon and scol_lat directly @@ -394,42 +396,50 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call NUOPC_CompAttributeGet(gcomp, name='scol_lat', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) scol_lat - call NUOPC_CompAttributeGet(gcomp, name='single_column_domainfile', value=single_column_domainfile, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name='single_column_lnd_domainfile', value=single_column_lnd_domainfile, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (scol_lon > -900. .and. scol_lat > -900.) then - if (trim(single_column_domainfile) /= 'null') then - single_column = .true. - write(iulog,'(a)')' single column mode is active:' - write(iulog,'(a,f13.5,a,f10.5,a)')' will find nearest neighbor values of ',scol_lon,' and ',& - scol_lat,' in '//trim(single_column_domainfile) - else - single_column = .false. - write(iulog,'(a)')' single point mode is active' - write(iulog,'(a,f13.5,a,f13.5,a)')' scol_lon is ',scol_lon,' and scol_lat is ' - end if - call lnd_set_mesh_for_single_column(single_column_domainfile, scol_lon, scol_lat, & - scol_area, scol_mask, scol_frac, mesh, scol_valid, rc) + + if (scol_lon > -999. .and. scol_lat > -999.) then + single_column = (trim(single_column_lnd_domainfile) /= 'null') + + call NUOPC_CompAttributeGet(gcomp, name='scol_lndmask', value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scol_mask + + call NUOPC_CompAttributeGet(gcomp, name='scol_lndfrac', value=cvalue, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scol_frac + + call lnd_set_mesh_for_single_column(scol_lon, scol_lat, mesh, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + + scol_valid = (scol_mask == 1) if (.not. scol_valid) then write(iulog,'(a)')' single column mode point does not contain any land - will set all export data to 0' ! if single column is not valid - set all export state fields to zero and return call realize_fields(importState, exportState, mesh, flds_scalar_name, flds_scalar_num, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - call State_SetScalar(1._r8, flds_scalar_index_nx, exportState, flds_scalar_name, flds_scalar_num, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - call State_SetScalar(1._r8, flds_scalar_index_ny, exportState, flds_scalar_name, flds_scalar_num, rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return call ESMF_StateGet(exportState, itemCount=fieldCount, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return allocate(lfieldnamelist(fieldCount)) call ESMF_StateGet(exportState, itemNameList=lfieldnamelist, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return do n = 1, fieldCount - call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_FieldGet(lfield, farrayPtr=fldptr, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - fldptr(:) = 0._r8 + if (trim(lfieldnamelist(n)) /= flds_scalar_name) then + call ESMF_StateGet(exportState, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldGet(lfield, rank=rank, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + if (rank == 2) then + call ESMF_FieldGet(lfield, farrayPtr=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0._r8 + else + call ESMF_FieldGet(lfield, farrayPtr=fldptr1d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr1d(:) = 0._r8 + end if + end if enddo deallocate(lfieldnamelist) ! ******************* @@ -437,7 +447,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! ******************* RETURN else - write(iulog,'(a,f10.5)')' single column mode lon/lat does contain land with land fraction ',scol_frac + write(iulog,'(a,3(f10.5,2x))')' single column mode scol_lon/scol_lat/scol_frac is ',& + scol_lon,scol_lat,scol_frac end if end if @@ -570,8 +581,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Create ctsm decomp and domain info ! --------------------- if (scol_lon > -900. .and. scol_lat > -900.) then - call lnd_set_decomp_and_domain_from_single_column(scol_lon, scol_lat, & - scol_area, scol_mask, scol_frac) + call lnd_set_decomp_and_domain_for_single_column(scol_lon, scol_lat, scol_mask, scol_frac) if (ChkErr(rc,__LINE__,u_FILE_u)) return else call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=model_meshfile, rc=rc) From 326ed8d7c3b9ab4c3ce44aee4d0d79ac0f927be2 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 14 Mar 2021 16:03:44 -0600 Subject: [PATCH 1865/1973] updates for single column and removal of fatmlndfrc references other than in mct cap --- bld/CLMBuildNamelist.pm | 22 ++++++---- .../namelist_definition_ctsm.xml | 2 +- cime_config/buildnml | 5 ++- cime_config/testdefs/ExpectedTestFails.xml | 2 +- cime_config/testdefs/testlist_clm.xml | 22 +++++----- .../testmods_dirs/clm/pts/shell_commands | 2 + src/biogeophys/SoilMoistureStreamMod.F90 | 3 +- src/cpl/lilac/lnd_import_export.F90 | 3 +- src/cpl/mct/lnd_comp_mct.F90 | 13 +++++- src/cpl/mct/lnd_set_decomp_and_domain.F90 | 40 +++++++++++++++---- src/cpl/nuopc/lnd_comp_nuopc.F90 | 3 +- src/main/clm_initializeMod.F90 | 2 +- src/main/clm_varctl.F90 | 2 - src/main/controlMod.F90 | 8 +--- src/main/surfrdMod.F90 | 4 +- 15 files changed, 86 insertions(+), 47 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 83128f7357..a345965611 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1781,15 +1781,19 @@ sub setup_logic_lnd_frac { $log->fatal_error("Can NOT set both -lnd_frac option (set via LND_DOMAIN_PATH/LND_DOMAIN_FILE " . "env variables) AND fatmlndfrac on namelist"); } - my $lnd_frac = SetupTools::expand_xml_var( $opts->{$var}, $envxml_ref); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fatmlndfrc','val'=>$lnd_frac ); + if ($opts->{$var} ne 'UNSET') { + my $lnd_frac = SetupTools::expand_xml_var( $opts->{$var}, $envxml_ref); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fatmlndfrc','val'=>$lnd_frac ); + } } - # Get the fraction file - if (defined $nl->get_value('fatmlndfrc')) { - # do nothing - use value provided by config_grid.xml and clm.cpl7.template - } else { - $log->fatal_error("fatmlndfrc was NOT sent into CLM build-namelist."); + if ($opts->{$var} ne 'UNSET') { + # Get the fraction file + if (defined $nl->get_value('fatmlndfrc')) { + # do nothing - use value provided by config_grid.xml and clm.cpl7.template + } else { + $log->fatal_error("fatmlndfrc was NOT sent into CLM build-namelist."); + } } } @@ -3933,6 +3937,10 @@ sub write_output_files { cnprecision_inparm clm_glacier_behavior crop irrigation_inparm surfacealbedo_inparm water_tracers_inparm); + if ($opts->{'lnd_frac'} ne 'UNSET') { + push @groups, "clm_lndfrac"; + } + #@groups = qw(clm_inparm clm_canopyhydrology_inparm clm_soilhydrology_inparm # finidat_consistency_checks dynpft_consistency_checks); # Eventually only list namelists that are actually used when CN on diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 9543fbcf6f..2d7e4a5d82 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -62,7 +62,7 @@ Component name to use in history and restart files type="char*256" category="datasets" input_pathname="abs" - group="clm_inparm" + group="clm_lndfrac" valid_values="" > Full pathname of land fraction data file. diff --git a/cime_config/buildnml b/cime_config/buildnml index 9f76913010..1771e4bf2a 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -153,7 +153,10 @@ def buildnml(case, caseroot, compname): inputdata_file = os.path.join(caseroot,"Buildconf","ctsm.input_data_list") - lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) + if (driver == 'mct'): + lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) + else: + lndfrac_file = 'UNSET' config_cache_file = os.path.join(caseroot,"Buildconf", compname+"conf","config_cache.xml") diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 04ff4b5dee..1147fb7bc3 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -30,7 +30,7 @@ - + FAIL #1117 diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index b3f93c0ae1..c7371650a0 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -55,7 +55,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -302,7 +302,7 @@ - + @@ -1005,7 +1005,7 @@ - + @@ -1348,7 +1348,7 @@ - + @@ -1358,7 +1358,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this high core count test with every tag, but include it in the less frequent ctsm_sci testing)" - + @@ -1367,7 +1367,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1376,7 +1376,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1405,7 +1405,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1414,7 +1414,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + diff --git a/cime_config/testdefs/testmods_dirs/clm/pts/shell_commands b/cime_config/testdefs/testmods_dirs/clm/pts/shell_commands index ad140e45e1..1613d28b25 100644 --- a/cime_config/testdefs/testmods_dirs/clm/pts/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/pts/shell_commands @@ -22,3 +22,5 @@ ./xmlchange NTASKS_ROF=1 ./xmlchange NTASKS_WAV=1 ./xmlchange NTASKS_ESP=1 +./xmlchange MOSART_MODE=NULL +./xmlchange RTM_MODE=NULL diff --git a/src/biogeophys/SoilMoistureStreamMod.F90 b/src/biogeophys/SoilMoistureStreamMod.F90 index 421d729f0b..eab6d26c02 100644 --- a/src/biogeophys/SoilMoistureStreamMod.F90 +++ b/src/biogeophys/SoilMoistureStreamMod.F90 @@ -23,8 +23,7 @@ module SoilMoistureStreamMod use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type use abortutils , only : endrun - use clm_varctl , only : scmlat,scmlon,single_column, inst_name - use clm_varctl , only : iulog, use_soil_moisture_streams + use clm_varctl , only : iulog, use_soil_moisture_streams, inst_name use clm_varcon , only : grlnd use controlMod , only : NLFilename use decompMod , only : gsMap_lnd2Dsoi_gdc2glo diff --git a/src/cpl/lilac/lnd_import_export.F90 b/src/cpl/lilac/lnd_import_export.F90 index 951b9f239d..9e2d921563 100644 --- a/src/cpl/lilac/lnd_import_export.F90 +++ b/src/cpl/lilac/lnd_import_export.F90 @@ -275,7 +275,7 @@ subroutine check_atm_landfrac(importState, bounds, rc) !--------------------------------------------------------------------------- ! Implementation notes: The CTSM decomposition is set up so that ocean points appear - ! at the end of the vectors received from the coupler. Thus, in order to check if + ! at the end of the vectors received from the atm. Thus, in order to check if ! there are any points that the atmosphere considers land but CTSM considers ocean, ! it is sufficient to check the points following the typical ending bounds in the ! vectors received from the coupler. @@ -291,7 +291,6 @@ subroutine check_atm_landfrac(importState, bounds, rc) if (atm_landfrac(n) > 0._r8) then write(iulog,*) 'At point ', n, ' atm landfrac = ', atm_landfrac(n) write(iulog,*) 'but CTSM thinks this is ocean.' - write(iulog,*) "Make sure the mask on CTSM's fatmlndfrc file agrees with the atmosphere's land mask" call shr_sys_abort( subname//& ' ERROR: atm landfrac > 0 for a point that CTSM thinks is ocean') end if diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index 21745d0ce6..fdab1f7d25 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -9,6 +9,7 @@ module lnd_comp_mct ! !uses: use shr_kind_mod , only : r8 => shr_kind_r8 use shr_sys_mod , only : shr_sys_flush + use shr_log_mod , only : errMsg => shr_log_errMsg use mct_mod , only : mct_avect, mct_gsmap, mct_gGrid use decompmod , only : bounds_type, ldecomp use lnd_import_export, only : lnd_import, lnd_export @@ -28,6 +29,9 @@ module lnd_comp_mct private :: lnd_domain_mct ! set the land model domain information private :: lnd_handle_resume ! handle pause/resume signals from the coupler + character(len=*), parameter, private :: sourcefile = & + __FILE__ + !==================================================================================== contains !==================================================================================== @@ -44,7 +48,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) use clm_time_manager , only : get_nstep, set_timemgr_init, set_nextsw_cday use clm_initializeMod, only : initialize1, initialize2 use clm_instMod , only : water_inst, lnd2atm_inst, lnd2glc_inst - use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog + use clm_varctl , only : finidat, single_column, clm_varctl_set, iulog use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_varorb , only : eccen, obliqr, lambm0, mvelpp use controlMod , only : control_setNL @@ -105,6 +109,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) type(bounds_type) :: bounds ! bounds logical :: noland integer :: ni,nj + real(r8) , parameter :: rundef = -9999999._r8 character(len=32), parameter :: sub = 'lnd_init_mct' character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" !----------------------------------------------------------------------- @@ -173,6 +178,12 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) start_type=starttype, model_version=version, & hostname=hostname, username=username ) + ! Single Column + if ( single_column .and. (scmlat == rundef .or. scmlon == rundef ) ) then + call endrun(msg=' ERROR:: single column mode on -- but scmlat and scmlon are NOT set'//& + errMsg(sourcefile, __LINE__)) + end if + ! Note that we assume that CTSM's internal dtime matches the coupling time step. ! i.e., we currently do NOT allow sub-cycling within a coupling time step. call set_timemgr_init( calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & diff --git a/src/cpl/mct/lnd_set_decomp_and_domain.F90 b/src/cpl/mct/lnd_set_decomp_and_domain.F90 index 13fa52a6dd..59d4f51bfe 100644 --- a/src/cpl/mct/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/mct/lnd_set_decomp_and_domain.F90 @@ -1,8 +1,10 @@ module lnd_set_decomp_and_domain use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl - use spmdMod , only : masterproc + use shr_log_mod , only : errMsg => shr_log_errMsg + use spmdMod , only : masterproc, mpicom use clm_varctl , only : iulog + use abortutils , only : endrun use perf_mod , only : t_startf, t_stopf, t_barrierf implicit none @@ -26,28 +28,52 @@ subroutine lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) ! Initialize ldecomp and ldomain data types + use shr_nl_mod , only: shr_nl_find_group_name use clm_varpar , only: nlevsoi - use clm_varctl , only: fatmlndfrc, use_soil_moisture_streams + use clm_varctl , only: use_soil_moisture_streams use decompInitMod , only: decompInit_lnd, decompInit_lnd3D use decompMod , only: bounds_type, get_proc_bounds use domainMod , only: ldomain, domain_init, domain_check + use spmdMod , only: MPI_CHARACTER ! input/output variables logical, intent(out) :: noland integer, intent(out) :: ni, nj ! global grid sizes ! local variables - integer ,pointer :: amask(:) ! global land mask - integer :: begg, endg ! processor bounds - type(bounds_type) :: bounds ! bounds + character(len=CL) :: fatmlndfrc = ' ' ! lnd frac file on atm grid + integer ,pointer :: amask(:) ! global land mask + integer :: begg, endg ! processor bounds + type(bounds_type) :: bounds ! bounds + integer :: unitn + integer :: ierr character(len=32) :: subname = 'lnd_set_decomp_and_domain_from_surfrd' !----------------------------------------------------------------------- ! Read in global land grid and land mask (amask)- needed to set decomposition ! global memory for amask is allocate in surfrd_get_glomask - must be deallocated below + namelist /clm_lndfrac/ fatmlndfrc + if (masterproc) then - write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) - endif + open( newunit=unitn, file='lnd_in', status='old' ) + call shr_nl_find_group_name(unitn, 'clm_lndfrac', status=ierr) + if (ierr == 0) then + read(unitn, clm_lndfrac, iostat=ierr) + if (ierr /= 0) then + call endrun(msg='ERROR reading clm_lndfrac namelist'//errMsg(sourcefile, __LINE__)) + end if + else + call endrun(msg='ERROR finding clm_lndfrac namelist'//errMsg(sourcefile, __LINE__)) + end if + close(unitn) + if (fatmlndfrc == ' ') then + write(iulog,*) 'fatmlndfrc not set, setting frac/mask to 1' + else + write(iulog,*) 'Land frac data = ',trim(fatmlndfrc) + write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) + end if + end if + call mpi_bcast (fatmlndfrc,len(fatmlndfrc),MPI_CHARACTER, 0, mpicom, ierr) ! Get global mask, ni and nj call surfrd_get_globmask(filename=fatmlndfrc, mask=amask, ni=ni, nj=nj) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 42a446234e..de7813fcf4 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -76,7 +76,6 @@ module lnd_comp_nuopc real(R8) :: orb_mvelp ! attribute - moving vernal equinox longitude real(R8) :: orb_eccen ! attribute and update- orbital eccentricity - logical :: single_column ! single column mode (nn search of domainfile) logical :: scol_valid ! if single_column, does point have a mask of zero character(len=*) , parameter :: orb_fixed_year = 'fixed_year' @@ -400,7 +399,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (scol_lon > -999. .and. scol_lat > -999.) then - single_column = (trim(single_column_lnd_domainfile) /= 'null') + single_column = (trim(single_column_lnd_domainfile) /= 'UNSET') call NUOPC_CompAttributeGet(gcomp, name='scol_lndmask', value=cvalue, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 625b86ae84..eef3168b38 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -116,7 +116,7 @@ subroutine initialize2(ni,nj) use clm_varpar , only : nlevsno use clm_varctl , only : fsurdat use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat - use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn, use_fates + use clm_varctl , only : use_century_decomp, use_cn, use_fates use clm_varctl , only : use_crop, ndep_from_cpl, fates_spitfire_mode use clm_varorb , only : eccen, mvelpp, lambm0, obliqr use landunit_varcon , only : landunit_varcon_init, max_lunit diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 0f50a53b96..e8c210e11c 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -89,8 +89,6 @@ module clm_varctl character(len=fname_len), public :: finidat = ' ' ! initial conditions file name character(len=fname_len), public :: fsurdat = ' ' ! surface data file name - character(len=fname_len), public :: fatmgrid = ' ' ! atm grid file name - character(len=fname_len), public :: fatmlndfrc = ' ' ! lnd frac file on atm grid character(len=fname_len), public :: paramfile = ' ' ! ASCII data file with PFT physiological constants character(len=fname_len), public :: nrevsn = ' ' ! restart data file name for branch run character(len=fname_len), public :: fsnowoptics = ' ' ! snow optical properties file name diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index ec22fff5c7..d1d3715f08 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -140,7 +140,7 @@ subroutine control_init(dtime) ! CLM namelist settings namelist /clm_inparm/ & - fatmlndfrc, finidat, nrevsn, & + finidat, nrevsn, & finidat_interp_dest, & use_init_interp, compname @@ -649,7 +649,6 @@ subroutine control_spmd() call mpi_bcast (finidat_interp_source, len(finidat_interp_source), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (finidat_interp_dest, len(finidat_interp_dest), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fsurdat, len(fsurdat), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fatmlndfrc,len(fatmlndfrc),MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (paramfile, len(paramfile) , MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fsnowoptics, len(fsnowoptics), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fsnowaging, len(fsnowaging), MPI_CHARACTER, 0, mpicom, ier) @@ -892,11 +891,6 @@ subroutine control_print () else write(iulog,*) ' surface data = ',trim(fsurdat) end if - if (fatmlndfrc == ' ') then - write(iulog,*) ' fatmlndfrc not set, setting frac/mask to 1' - else - write(iulog,*) ' land frac data = ',trim(fatmlndfrc) - end if write(iulog,*) ' Number of ACTIVE PFTS (0 means input pft data NOT collapsed to n_dom_pfts) =', n_dom_pfts write(iulog,*) ' Number of ACTIVE LANDUNITS (0 means input landunit data NOT collapsed to n_dom_landunits) =', n_dom_landunits write(iulog,*) ' Collapse urban landunits; done before collapsing all landunits to n_dom_landunits; .false. means do nothing i.e. keep all the urban landunits, though n_dom_landunits may still remove them =', collapse_urban diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index 33c5194423..4a7f8b8c9f 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -125,7 +125,7 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) dim1name=grlnd, readvar=readvar) if (.not. readvar) call endrun( msg=' ERROR: pftm NOT on surface dataset'//errMsg(sourcefile, __LINE__)) - ! Check if fsurdat grid is "close" to fatmlndfrc grid, exit if lats/lon > 0.001 + ! Cmopare surfdat_domain attributes to ldomain attributes call check_var(ncid=ncid, varname='xc', readvar=readvar) if (readvar) then @@ -173,7 +173,7 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat, actual_numcft) rmaxlat = max(rmaxlat,abs(ldomain%latc(n)-surfdata_domain%latc(n))) enddo if (rmaxlon > 0.001_r8 .or. rmaxlat > 0.001_r8) then - write(iulog,*)' ERROR: surfdata/fatmgrid lon/lat mismatch error', rmaxlon,rmaxlat + write(iulog,*)' ERROR: surfdata_domain/ldomain lon/lat mismatch error', rmaxlon,rmaxlat call endrun(msg=errMsg(sourcefile, __LINE__)) end if From 09aeff5b9246485e14ae84e579b3738f421c8164 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 15 Mar 2021 21:34:39 -0600 Subject: [PATCH 1866/1973] used scol_spval --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index de7813fcf4..d084674598 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -363,6 +363,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(r8) :: scol_area ! single-column area real(r8) :: scol_frac ! single-column frac integer :: scol_mask ! single-column mask + real(r8) :: scol_spval character(len=CL) :: single_column_lnd_domainfile type(ESMF_Field) :: lfield character(CL) ,pointer :: lfieldnamelist(:) => null() @@ -386,7 +387,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! If single_column is true - used single_column_domainfile to ! obtain nearest neighbor values for scol_lon and scol_lat - ! If single_column is false and scol_lon and scol_lat are not equal to -999 then + ! If single_column is false and scol_lon and scol_lat are not equal to scol_spval then ! use scol_lon and scol_lat directly call NUOPC_CompAttributeGet(gcomp, name='scol_lon', value=cvalue, rc=rc) @@ -395,10 +396,13 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call NUOPC_CompAttributeGet(gcomp, name='scol_lat', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) scol_lat + call NUOPC_CompAttributeGet(gcomp, name='scol_spval', value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue,*) scol_spval call NUOPC_CompAttributeGet(gcomp, name='single_column_lnd_domainfile', value=single_column_lnd_domainfile, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - if (scol_lon > -999. .and. scol_lat > -999.) then + if (scol_lon > scol_spval .and. scol_lat > scol_spval) then single_column = (trim(single_column_lnd_domainfile) /= 'UNSET') call NUOPC_CompAttributeGet(gcomp, name='scol_lndmask', value=cvalue, rc=rc) @@ -579,7 +583,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! --------------------- ! Create ctsm decomp and domain info ! --------------------- - if (scol_lon > -900. .and. scol_lat > -900.) then + if (scol_lon > scol_spval .and. scol_lat > scol_spval) then call lnd_set_decomp_and_domain_for_single_column(scol_lon, scol_lat, scol_mask, scol_frac) if (ChkErr(rc,__LINE__,u_FILE_u)) return else From 4dfbcaaa897fae2f2bc095471ba7d84f6a7a7a84 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 18 Mar 2021 22:04:28 -0600 Subject: [PATCH 1867/1973] backing out removal of fatmlndfrc from clm_varctl.F90 --- bld/CLMBuildNamelist.pm | 22 +++----- .../namelist_definition_ctsm.xml | 2 +- cime_config/buildnml | 6 +-- src/cpl/mct/lnd_set_decomp_and_domain.F90 | 51 +++---------------- src/main/clm_varctl.F90 | 3 ++ src/main/controlMod.F90 | 8 ++- 6 files changed, 26 insertions(+), 66 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index a345965611..83128f7357 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1781,19 +1781,15 @@ sub setup_logic_lnd_frac { $log->fatal_error("Can NOT set both -lnd_frac option (set via LND_DOMAIN_PATH/LND_DOMAIN_FILE " . "env variables) AND fatmlndfrac on namelist"); } - if ($opts->{$var} ne 'UNSET') { - my $lnd_frac = SetupTools::expand_xml_var( $opts->{$var}, $envxml_ref); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fatmlndfrc','val'=>$lnd_frac ); - } + my $lnd_frac = SetupTools::expand_xml_var( $opts->{$var}, $envxml_ref); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fatmlndfrc','val'=>$lnd_frac ); } - if ($opts->{$var} ne 'UNSET') { - # Get the fraction file - if (defined $nl->get_value('fatmlndfrc')) { - # do nothing - use value provided by config_grid.xml and clm.cpl7.template - } else { - $log->fatal_error("fatmlndfrc was NOT sent into CLM build-namelist."); - } + # Get the fraction file + if (defined $nl->get_value('fatmlndfrc')) { + # do nothing - use value provided by config_grid.xml and clm.cpl7.template + } else { + $log->fatal_error("fatmlndfrc was NOT sent into CLM build-namelist."); } } @@ -3937,10 +3933,6 @@ sub write_output_files { cnprecision_inparm clm_glacier_behavior crop irrigation_inparm surfacealbedo_inparm water_tracers_inparm); - if ($opts->{'lnd_frac'} ne 'UNSET') { - push @groups, "clm_lndfrac"; - } - #@groups = qw(clm_inparm clm_canopyhydrology_inparm clm_soilhydrology_inparm # finidat_consistency_checks dynpft_consistency_checks); # Eventually only list namelists that are actually used when CN on diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 2d7e4a5d82..9543fbcf6f 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -62,7 +62,7 @@ Component name to use in history and restart files type="char*256" category="datasets" input_pathname="abs" - group="clm_lndfrac" + group="clm_inparm" valid_values="" > Full pathname of land fraction data file. diff --git a/cime_config/buildnml b/cime_config/buildnml index 1771e4bf2a..f60206a01d 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -61,7 +61,6 @@ def buildnml(case, caseroot, compname): run_reftod = case.get_value("RUN_REFTOD") glc_nec = case.get_value("GLC_NEC") mask = case.get_value("MASK_GRID") - driver = case.get_value("COMP_INTERFACE").lower() # ----------------------------------------------------- # Set ctsmconf @@ -153,10 +152,7 @@ def buildnml(case, caseroot, compname): inputdata_file = os.path.join(caseroot,"Buildconf","ctsm.input_data_list") - if (driver == 'mct'): - lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) - else: - lndfrac_file = 'UNSET' + lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) config_cache_file = os.path.join(caseroot,"Buildconf", compname+"conf","config_cache.xml") diff --git a/src/cpl/mct/lnd_set_decomp_and_domain.F90 b/src/cpl/mct/lnd_set_decomp_and_domain.F90 index 59d4f51bfe..0e1dbb9477 100644 --- a/src/cpl/mct/lnd_set_decomp_and_domain.F90 +++ b/src/cpl/mct/lnd_set_decomp_and_domain.F90 @@ -1,10 +1,8 @@ module lnd_set_decomp_and_domain use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc, mpicom + use spmdMod , only : masterproc use clm_varctl , only : iulog - use abortutils , only : endrun use perf_mod , only : t_startf, t_stopf, t_barrierf implicit none @@ -28,52 +26,28 @@ subroutine lnd_set_decomp_and_domain_from_surfrd(noland, ni, nj) ! Initialize ldecomp and ldomain data types - use shr_nl_mod , only: shr_nl_find_group_name use clm_varpar , only: nlevsoi - use clm_varctl , only: use_soil_moisture_streams + use clm_varctl , only: fatmlndfrc, use_soil_moisture_streams use decompInitMod , only: decompInit_lnd, decompInit_lnd3D use decompMod , only: bounds_type, get_proc_bounds use domainMod , only: ldomain, domain_init, domain_check - use spmdMod , only: MPI_CHARACTER ! input/output variables logical, intent(out) :: noland integer, intent(out) :: ni, nj ! global grid sizes ! local variables - character(len=CL) :: fatmlndfrc = ' ' ! lnd frac file on atm grid - integer ,pointer :: amask(:) ! global land mask - integer :: begg, endg ! processor bounds - type(bounds_type) :: bounds ! bounds - integer :: unitn - integer :: ierr + integer ,pointer :: amask(:) ! global land mask + integer :: begg, endg ! processor bounds + type(bounds_type) :: bounds ! bounds character(len=32) :: subname = 'lnd_set_decomp_and_domain_from_surfrd' !----------------------------------------------------------------------- ! Read in global land grid and land mask (amask)- needed to set decomposition ! global memory for amask is allocate in surfrd_get_glomask - must be deallocated below - namelist /clm_lndfrac/ fatmlndfrc - if (masterproc) then - open( newunit=unitn, file='lnd_in', status='old' ) - call shr_nl_find_group_name(unitn, 'clm_lndfrac', status=ierr) - if (ierr == 0) then - read(unitn, clm_lndfrac, iostat=ierr) - if (ierr /= 0) then - call endrun(msg='ERROR reading clm_lndfrac namelist'//errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='ERROR finding clm_lndfrac namelist'//errMsg(sourcefile, __LINE__)) - end if - close(unitn) - if (fatmlndfrc == ' ') then - write(iulog,*) 'fatmlndfrc not set, setting frac/mask to 1' - else - write(iulog,*) 'Land frac data = ',trim(fatmlndfrc) - write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) - end if - end if - call mpi_bcast (fatmlndfrc,len(fatmlndfrc),MPI_CHARACTER, 0, mpicom, ierr) + write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) + endif ! Get global mask, ni and nj call surfrd_get_globmask(filename=fatmlndfrc, mask=amask, ni=ni, nj=nj) @@ -214,8 +188,6 @@ subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) use shr_log_mod , only : errMsg => shr_log_errMsg use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim_size, ncd_inqdid, ncd_inqdlen - use clm_varctl , only : single_column, scmlat, scmlon - use shr_scam_mod , only : shr_scam_getCloseLatLon use pio ! input/output variables @@ -239,10 +211,6 @@ subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) character(len=16) :: vname ! temporary character(len=256) :: locfn ! local file name integer :: n ! indices - integer :: closelatidx - integer :: closelonidx - real(r8) :: closelat - real(r8) :: closelon character(len=32) :: subname = 'surfrd_get_grid' ! subroutine name !----------------------------------------------------------------------- @@ -319,11 +287,6 @@ subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) call endrun( msg=' ERROR: LANDFRAC NOT on fracdata file'//errMsg(sourcefile, __LINE__)) end if - if (single_column) then - call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - closelat, closelon, closelatidx, closelonidx) - end if - call ncd_pio_closefile(ncid) end subroutine surfrd_get_grid diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index e8c210e11c..796fa086fa 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -94,6 +94,9 @@ module clm_varctl character(len=fname_len), public :: fsnowoptics = ' ' ! snow optical properties file name character(len=fname_len), public :: fsnowaging = ' ' ! snow aging parameters file name + character(len=fname_len), public :: fatmlndfrc = ' ' ! lnd frac file on atm grid + ! only needed for LILAC and MCT drivers + !---------------------------------------------------------- ! Flag to read ndep rather than obtain it from coupler !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index d1d3715f08..ec22fff5c7 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -140,7 +140,7 @@ subroutine control_init(dtime) ! CLM namelist settings namelist /clm_inparm/ & - finidat, nrevsn, & + fatmlndfrc, finidat, nrevsn, & finidat_interp_dest, & use_init_interp, compname @@ -649,6 +649,7 @@ subroutine control_spmd() call mpi_bcast (finidat_interp_source, len(finidat_interp_source), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (finidat_interp_dest, len(finidat_interp_dest), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fsurdat, len(fsurdat), MPI_CHARACTER, 0, mpicom, ier) + call mpi_bcast (fatmlndfrc,len(fatmlndfrc),MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (paramfile, len(paramfile) , MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fsnowoptics, len(fsnowoptics), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fsnowaging, len(fsnowaging), MPI_CHARACTER, 0, mpicom, ier) @@ -891,6 +892,11 @@ subroutine control_print () else write(iulog,*) ' surface data = ',trim(fsurdat) end if + if (fatmlndfrc == ' ') then + write(iulog,*) ' fatmlndfrc not set, setting frac/mask to 1' + else + write(iulog,*) ' land frac data = ',trim(fatmlndfrc) + end if write(iulog,*) ' Number of ACTIVE PFTS (0 means input pft data NOT collapsed to n_dom_pfts) =', n_dom_pfts write(iulog,*) ' Number of ACTIVE LANDUNITS (0 means input landunit data NOT collapsed to n_dom_landunits) =', n_dom_landunits write(iulog,*) ' Collapse urban landunits; done before collapsing all landunits to n_dom_landunits; .false. means do nothing i.e. keep all the urban landunits, though n_dom_landunits may still remove them =', collapse_urban From 16785fdb489a29a12a553acfa1e8f62154796880 Mon Sep 17 00:00:00 2001 From: negin513 Date: Thu, 18 Mar 2021 22:26:32 -0600 Subject: [PATCH 1868/1973] adding the files for WRF-CTSM to work with lakes. --- doc/source/lilac/specific-atm-models/wrf.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index f1118973e9..3d2ace80c9 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -37,9 +37,9 @@ Clone WRF and CTSM Repositories Clone the WRF repository and checkout ``develop`` branch:: - git clone https://github.com/wrf-model/WRF.git WRF-CTSM + git clone https://github.com/negin513/WRF-1.git WRF-CTSM cd WRF-CTSM - git checkout develop + git checkout wrf_ctsm_pr2 Clone the CTSM repository:: @@ -322,10 +322,18 @@ The following is the recommended CTSM options to run WRF:: In ``ctsm.cfg`` you should specify CTSM domain file, surface dataset and finidat file. For this example (US domain), you can use the following settings:: - lnd_domain_file = /glade/work/slevis/barlage_wrf_ctsm/conus/gen_domain_files/domain.lnd.wrf2ctsm_lnd_wrf2ctsm_ocn.191211.nc - fsurdat = /glade/work/slevis/git_wrf/ctsm_surf/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c191212.nc + lnd_domain_file = /glade/work/slevis/git_wrf/ctsm_domain/domain.lnd.wrf2clm_lnd_noneg_wrf2clm_ocn_noneg.201117.nc + fsurdat = /glade/work/slevis/git_wrf/ctsm_surf/surfdata_conus_hist_16pfts_Irrig_CMIP6_simyr2000_c210119.nc finidat = /glade/work/slevis/git_wrf/ctsm_init/finidat_interp_dest_wrfinit_snow_ERAI_12month.nc +File ``user_nl_ctsm`` allows you to override individual CTSM namelist variables +and set any extra namelist items you would like to appear in your ``lnd_in``. +For this example, we recommend adding the following options in +``user_nl_ctsm``:: + + use_init_interp = .true. + init_interp_fill_missing_with_natveg = .true. + Run the script ``make_runtime_inputs`` to create ``lnd_in`` and ``clm.input_data_list``:: @@ -333,8 +341,8 @@ Run the script ``make_runtime_inputs`` to create ``lnd_in`` and Modify ``lilac_in`` as needed. For this example, you can use the following options:: - atm_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' - lnd_mesh_filename = '/glade/work/slevis/barlage_wrf_ctsm/conus/mesh/wrf2ctsm_land_conus_ESMFMesh_c20191216.nc' + atm_mesh_filename = '/glade/scratch/negins/wrf_ctsm_files/wrf2ctsm_land_conus_ESMFMesh_c20201110.nc' + lnd_mesh_filename = '/glade/scratch/negins/wrf_ctsm_files/wrf2ctsm_land_conus_ESMFMesh_c20201110.nc' Run ``download_input_data`` script to download any of CTSM's standard input From 5508d28cb8bbfd610e1b70ff552b205462417f28 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 19 Mar 2021 11:20:25 -0600 Subject: [PATCH 1869/1973] bug fix for setting single_column flag --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index d084674598..861598e0d5 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -453,6 +453,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) write(iulog,'(a,3(f10.5,2x))')' single column mode scol_lon/scol_lat/scol_frac is ',& scol_lon,scol_lat,scol_frac end if + else + single_column = .false. end if !---------------------------------------------------------------------------- From c325a32f7051cc6f794082fde348b116c6f9e35a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 19 Mar 2021 11:34:22 -0600 Subject: [PATCH 1870/1973] updated the Externals needed for this PR --- Externals.cfg | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 617adb644f..bde774bba3 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -33,25 +33,26 @@ repo_url = https://github.com/nmizukami/mizuRoute hash = 34723c2 required = True +# Note that this is a hash off of cime master that is required [cime] local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = branch_tags/cime5.8.37_a02 +hash = 0cd2268d5 required = True [cmeps] local_path = cime/src/drivers/nuopc/ protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git -hash = c4acaa8 +tag = v0.2.0 required = True [cdeps] local_path = components/cdeps protocol = git repo_url = https://github.com/ESCOMP/CDEPS.git -hash = 1f02a73 +tag = v0.1.0 required = True [doc-builder] From 3cddb0c6fc5f34e7dcc85da92b2b02d1f22f42ca Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 19 Mar 2021 16:20:29 -0600 Subject: [PATCH 1871/1973] run_sys_tests: Add --retry option to create_newcase This defaults to 1 for izumi, 0 for other machines. It can be overridden with a new --retry flag to run_sys_tests --- python/ctsm/machine.py | 34 +++++++++++++-------- python/ctsm/machine_defaults.py | 7 +++++ python/ctsm/run_sys_tests.py | 29 ++++++++++++++---- python/ctsm/test/test_unit_machine.py | 33 +++++++++++++------- python/ctsm/test/test_unit_run_sys_tests.py | 7 +++-- 5 files changed, 78 insertions(+), 32 deletions(-) diff --git a/python/ctsm/machine.py b/python/ctsm/machine.py index 6065f54716..67613053a9 100644 --- a/python/ctsm/machine.py +++ b/python/ctsm/machine.py @@ -23,11 +23,12 @@ # user of the machine object to check for that possibility if need be. # # Similar notes apply to baseline_dir. -Machine = namedtuple('Machine', ['name', # str - 'scratch_dir', # str - 'baseline_dir', # str - 'account', # str or None - 'job_launcher']) # subclass of JobLauncherBase +Machine = namedtuple('Machine', ['name', # str + 'scratch_dir', # str + 'baseline_dir', # str + 'account', # str or None + 'create_test_retry', # int + 'job_launcher']) # subclass of JobLauncherBase def create_machine(machine_name, defaults, job_launcher_type=None, scratch_dir=None, account=None, @@ -78,6 +79,7 @@ def create_machine(machine_name, defaults, job_launcher_type=None, mach_defaults = defaults.get(machine_name) baseline_dir = None + create_test_retry = 0 if mach_defaults is not None: if job_launcher_type is None: job_launcher_type = mach_defaults.job_launcher_type @@ -93,6 +95,10 @@ def create_machine(machine_name, defaults, job_launcher_type=None, # generation and comparison, or making a link in some temporary location that # points to the standard baselines). baseline_dir = mach_defaults.baseline_dir + # We also don't provide a way to override the default create_test_retry in the + # machine object: this will always give the default value for this machine, and + # other mechanisms will be given for overriding this in a particular case. + create_test_retry = mach_defaults.create_test_retry if account is None and mach_defaults.account_required and not allow_missing_entries: raise RuntimeError("Could not find an account code") else: @@ -142,21 +148,23 @@ def create_machine(machine_name, defaults, job_launcher_type=None, scratch_dir=scratch_dir, baseline_dir=baseline_dir, account=account, + create_test_retry=create_test_retry, job_launcher=job_launcher) -def get_possibly_overridden_baseline_dir(machine, baseline_dir=None): - """Get the baseline directory to use here, or None +def get_possibly_overridden_mach_value(machine, varname, value=None): + """Get the value to use for the given machine variable - If baseline_dir is provided (not None), use that. Otherwise use the baseline directory - from machine (which may be None). + If value is provided (not None), use that. Otherwise use the value of the given + variable from the provided machine object. Args: machine (Machine) - baseline_dir (str or None): gives the overriding baseline directory to use + varname (str): name of variable to get from the machine object + value: if not None, use this instead of fetching from the machine object """ - if baseline_dir is not None: - return baseline_dir - return machine.baseline_dir + if value is not None: + return value + return getattr(machine, varname) def _get_account(): account = get_project() diff --git a/python/ctsm/machine_defaults.py b/python/ctsm/machine_defaults.py index 78b6062f50..637845d7eb 100644 --- a/python/ctsm/machine_defaults.py +++ b/python/ctsm/machine_defaults.py @@ -12,6 +12,7 @@ 'scratch_dir', 'baseline_dir', 'account_required', + 'create_test_retry', 'job_launcher_defaults']) # job_launcher_type: one of the JOB_LAUNCHERs defined in job_launcher_factory # scratch_dir: str @@ -21,6 +22,7 @@ # have 0, 1 or multiple job_launcher_defaults. (It can be useful to have defaults even # for the non-default job launcher for this machine, in case the user chooses a # non-default launcher.) +# create_test_retry: int: Default number of times to retry a create_test job on this machine # account_required: bool: whether an account number is required on this machine (not # really a default, but used for error-checking) @@ -40,6 +42,7 @@ scratch_dir=os.path.join(os.path.sep, 'glade', 'scratch', get_user()), baseline_dir=os.path.join(os.path.sep, 'glade', 'p', 'cgd', 'tss', 'ctsm_baselines'), account_required=True, + create_test_retry=0, job_launcher_defaults={ JOB_LAUNCHER_QSUB: QsubDefaults( queue='regular', @@ -56,6 +59,7 @@ scratch_dir=os.path.join(os.path.sep, 'scratch', 'cluster', get_user()), baseline_dir=os.path.join(os.path.sep, 'fs', 'cgd', 'csm', 'ccsm_baselines'), account_required=False, + create_test_retry=0, job_launcher_defaults={ JOB_LAUNCHER_QSUB: QsubDefaults( queue='medium', @@ -68,6 +72,9 @@ scratch_dir=os.path.join(os.path.sep, 'scratch', 'cluster', get_user()), baseline_dir=os.path.join(os.path.sep, 'fs', 'cgd', 'csm', 'ccsm_baselines'), account_required=False, + # jobs on izumi experience a high frequency of failures, often at the very end of + # the job; so we'll automatically retry a failed job once before giving up on it + create_test_retry=1, job_launcher_defaults={ JOB_LAUNCHER_QSUB: QsubDefaults( queue='medium', diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index 7d5d0a2e94..2299eb472e 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -10,7 +10,7 @@ from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args from ctsm.machine_utils import get_machine_name -from ctsm.machine import create_machine, get_possibly_overridden_baseline_dir +from ctsm.machine import create_machine, get_possibly_overridden_mach_value from ctsm.machine_defaults import MACHINE_DEFAULTS from ctsm.os_utils import make_link from ctsm.path_utils import path_to_ctsm_root @@ -72,6 +72,7 @@ def main(cime_path): compare_name=args.compare, generate_name=args.generate, baseline_root=args.baseline_root, walltime=args.walltime, queue=args.queue, + retry=args.retry, extra_create_test_args=args.extra_create_test_args) def run_sys_tests(machine, cime_path, @@ -85,6 +86,7 @@ def run_sys_tests(machine, cime_path, compare_name=None, generate_name=None, baseline_root=None, walltime=None, queue=None, + retry=None, extra_create_test_args=''): """Implementation of run_sys_tests command @@ -119,6 +121,8 @@ def run_sys_tests(machine, cime_path, determine it automatically) queue (str): queue to use for each test (if not provided, the test suite will determine it automatically) + retry (int): retry value to pass to create_test (if not provided, will use the default + for this machine) extra_create_test_args (str): any extra arguments to create_test, as a single, space-delimited string testlist: list of strings giving test names to run @@ -137,17 +141,22 @@ def run_sys_tests(machine, cime_path, if not (skip_testroot_creation or rerun_existing_failures): _make_testroot(testroot, testid_base, dry_run) print("Testroot: {}\n".format(testroot)) + retry_final = get_possibly_overridden_mach_value(machine, + varname='create_test_retry', + value=retry) if not skip_git_status: - _record_git_status(testroot, dry_run) + _record_git_status(testroot, retry_final, dry_run) - baseline_root_final = get_possibly_overridden_baseline_dir(machine, - baseline_dir=baseline_root) + baseline_root_final = get_possibly_overridden_mach_value(machine, + varname='baseline_dir', + value=baseline_root) create_test_args = _get_create_test_args(compare_name=compare_name, generate_name=generate_name, baseline_root=baseline_root_final, account=machine.account, walltime=walltime, queue=queue, + retry=retry_final, rerun_existing_failures=rerun_existing_failures, extra_create_test_args=extra_create_test_args) if suite_name: @@ -298,6 +307,11 @@ def _commandline_args(): help='Queue to which tests are submitted.\n' 'If not provided, uses machine default.') + parser.add_argument('--retry', + help='Argument to create_test: Number of times to retry failed tests.\n' + 'Default for this machine: {}'.format( + default_machine.create_test_retry)) + parser.add_argument('--extra-create-test-args', default='', help='String giving extra arguments to pass to create_test\n' '(To allow the argument parsing to accept this, enclose the string\n' @@ -396,11 +410,13 @@ def _make_testroot(testroot, testid_base, dry_run): os.makedirs(testroot) make_link(testroot, _get_testdir_name(testid_base)) -def _record_git_status(testroot, dry_run): +def _record_git_status(testroot, retry, dry_run): """Record git status and related information to stdout and a file""" output = '' ctsm_root = path_to_ctsm_root() + output += "create_test --retry: {}\n\n".format(retry) + current_hash = subprocess.check_output(['git', 'show', '--no-patch', '--format=format:%h (%an, %ad) %s\n', 'HEAD'], cwd=ctsm_root, @@ -440,7 +456,7 @@ def _record_git_status(testroot, dry_run): git_status_file.write(output) def _get_create_test_args(compare_name, generate_name, baseline_root, - account, walltime, queue, + account, walltime, queue, retry, rerun_existing_failures, extra_create_test_args): args = [] @@ -456,6 +472,7 @@ def _get_create_test_args(compare_name, generate_name, baseline_root, args.extend(['--walltime', walltime]) if queue: args.extend(['--queue', queue]) + args.extend(['--retry', str(retry)]) if rerun_existing_failures: # In addition to --use-existing, we also need --allow-baseline-overwrite in this # case; otherwise, create_test throws an error saying that the baseline diff --git a/python/ctsm/test/test_unit_machine.py b/python/ctsm/test/test_unit_machine.py index 2712ffafc7..65cd73620e 100755 --- a/python/ctsm/test/test_unit_machine.py +++ b/python/ctsm/test/test_unit_machine.py @@ -9,7 +9,7 @@ from ctsm import add_cime_to_path # pylint: disable=unused-import from ctsm import unit_testing -from ctsm.machine import create_machine, get_possibly_overridden_baseline_dir +from ctsm.machine import create_machine, get_possibly_overridden_mach_value from ctsm.machine_utils import get_user from ctsm.machine_defaults import MACHINE_DEFAULTS, MachineDefaults, QsubDefaults from ctsm.joblauncher.job_launcher_no_batch import JobLauncherNoBatch @@ -23,7 +23,8 @@ class TestCreateMachine(unittest.TestCase): """Tests of create_machine""" - def assertMachineInfo(self, machine, name, scratch_dir, baseline_dir, account): + def assertMachineInfo(self, machine, name, scratch_dir, baseline_dir, account, + create_test_retry=0): """Asserts that the basic machine info is as expected. This does NOT dive down into the job launcher""" @@ -31,6 +32,7 @@ def assertMachineInfo(self, machine, name, scratch_dir, baseline_dir, account): self.assertEqual(machine.scratch_dir, scratch_dir) self.assertEqual(machine.baseline_dir, baseline_dir) self.assertEqual(machine.account, account) + self.assertEqual(machine.create_test_retry, create_test_retry) def assertNoBatchInfo(self, machine, nice_level=None): """Asserts that the machine's launcher is of type JobLauncherNoBatch""" @@ -62,6 +64,7 @@ def create_defaults(default_job_launcher=JOB_LAUNCHER_QSUB): scratch_dir=os.path.join(os.path.sep, 'glade', 'scratch', get_user()), baseline_dir=os.path.join(os.path.sep, 'my', 'baselines'), account_required=True, + create_test_retry=2, job_launcher_defaults={ JOB_LAUNCHER_QSUB: QsubDefaults( queue='regular', @@ -130,7 +133,8 @@ def test_knownMachine_defaults(self): 'scratch', get_user()), baseline_dir=os.path.join(os.path.sep, 'my', 'baselines'), - account='a123') + account='a123', + create_test_retry=2) self.assertQsubInfo(machine=machine, queue='regular', walltime='06:00:00', @@ -152,7 +156,8 @@ def test_knownMachine_argsExplicit(self): name='cheyenne', scratch_dir='/custom/path/to/scratch', baseline_dir=os.path.join(os.path.sep, 'my', 'baselines'), - account='a123') + account='a123', + create_test_retry=2) self.assertQsubInfo(machine=machine, queue='custom_queue', walltime='9:87:65', @@ -161,29 +166,35 @@ def test_knownMachine_argsExplicit(self): extra_args='--custom args') # ------------------------------------------------------------------------ - # Tests of get_possibly_overridden_baseline_dir + # Tests of get_possibly_overridden_mach_value # ------------------------------------------------------------------------ def test_baselineDir_overridden(self): - """Tests get_possibly_overridden_baseline_dir when baseline_dir is provided""" + """Tests get_possibly_overridden_mach_value when baseline_dir is provided""" defaults = self.create_defaults() machine = create_machine('cheyenne', defaults, account='a123') - baseline_dir = get_possibly_overridden_baseline_dir(machine, baseline_dir='mypath') + baseline_dir = get_possibly_overridden_mach_value(machine, + varname='baseline_dir', + value='mypath') self.assertEqual(baseline_dir, 'mypath') def test_baselineDir_default(self): - """Tests get_possibly_overridden_baseline_dir when baseline_dir is not provided""" + """Tests get_possibly_overridden_mach_value when baseline_dir is not provided""" defaults = self.create_defaults() machine = create_machine('cheyenne', defaults, account='a123') - baseline_dir = get_possibly_overridden_baseline_dir(machine, baseline_dir=None) + baseline_dir = get_possibly_overridden_mach_value(machine, + varname='baseline_dir', + value=None) self.assertEqual(baseline_dir, os.path.join(os.path.sep, 'my', 'baselines')) def test_baselineDir_noDefault(self): - """Tests get_possibly_overridden_baseline_dir when baseline_dir is not provided + """Tests get_possibly_overridden_mach_value when baseline_dir is not provided and there is no default""" machine = create_machine('unknown_test_machine', MACHINE_DEFAULTS, account='a123') - baseline_dir = get_possibly_overridden_baseline_dir(machine, baseline_dir=None) + baseline_dir = get_possibly_overridden_mach_value(machine, + varname='baseline_dir', + value=None) self.assertIsNone(baseline_dir) if __name__ == '__main__': diff --git a/python/ctsm/test/test_unit_run_sys_tests.py b/python/ctsm/test/test_unit_run_sys_tests.py index 316fd40a2d..78ab02a648 100755 --- a/python/ctsm/test/test_unit_run_sys_tests.py +++ b/python/ctsm/test/test_unit_run_sys_tests.py @@ -100,8 +100,8 @@ def test_createTestCommand_testnames(self): (1) The use of a testlist argument (2) The standard arguments to create_test (the path to create_test, the arguments - --test-id and --output-root, the absence of --compare and --generate, and (on this - unknown machine) the absence of --baseline-root) + --test-id, --output-root and --retry, the absence of --compare and --generate, and + (on this unknown machine) the absence of --baseline-root) (3) That a cs.status.fails file was created """ @@ -119,6 +119,7 @@ def test_createTestCommand_testnames(self): six.assertRegex(self, command, r'--test-id +{}\s'.format(self._expected_testid())) expected_testroot_path = os.path.join(self._scratch, self._expected_testroot()) six.assertRegex(self, command, r'--output-root +{}\s'.format(expected_testroot_path)) + six.assertRegex(self, command, r'--retry +0(\s|$)') six.assertRegex(self, command, r'test1 +test2(\s|$)') assertNotRegex(self, command, r'--compare\s') assertNotRegex(self, command, r'--generate\s') @@ -151,6 +152,7 @@ def test_createTestCommand_testfileAndExtraArgs(self): baseline_root='myblroot', walltime='3:45:67', queue='runqueue', + retry=5, extra_create_test_args='--some extra --createtest args') all_commands = machine.job_launcher.get_commands() @@ -166,6 +168,7 @@ def test_createTestCommand_testfileAndExtraArgs(self): six.assertRegex(self, command, r'--walltime +3:45:67(\s|$)') six.assertRegex(self, command, r'--queue +runqueue(\s|$)') six.assertRegex(self, command, r'--project +myaccount(\s|$)') + six.assertRegex(self, command, r'--retry +5(\s|$)') six.assertRegex(self, command, r'--some +extra +--createtest +args(\s|$)') expected_cs_status = os.path.join(expected_testroot, From 793ca464314ba41d633f28afde66c5c5a9df87ed Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 19 Mar 2021 16:43:10 -0600 Subject: [PATCH 1872/1973] Fix pylint errors These were pre-existing errors. I'm thinking they're showing up now because I have a new version of pylint. --- python/ctsm/lilac_build_ctsm.py | 4 ++-- python/ctsm/lilac_download_input_data.py | 4 ++-- python/ctsm/lilac_make_runtime_inputs.py | 4 ++-- python/ctsm/machine.py | 2 +- python/ctsm/run_sys_tests.py | 6 +++--- python/ctsm/utils.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/python/ctsm/lilac_build_ctsm.py b/python/ctsm/lilac_build_ctsm.py index c44ad6831e..888008897a 100644 --- a/python/ctsm/lilac_build_ctsm.py +++ b/python/ctsm/lilac_build_ctsm.py @@ -473,8 +473,8 @@ def _check_and_transform_os(os_type): 'cnl': 'CNL'} try: os_type_transformed = transforms[os_type] - except KeyError: - raise ValueError("Unknown OS: {}".format(os_type)) + except KeyError as exc: + raise ValueError("Unknown OS: {}".format(os_type)) from exc return os_type_transformed def _get_case_dir(build_dir): diff --git a/python/ctsm/lilac_download_input_data.py b/python/ctsm/lilac_download_input_data.py index 1e0c240d25..dffc78150a 100644 --- a/python/ctsm/lilac_download_input_data.py +++ b/python/ctsm/lilac_download_input_data.py @@ -5,10 +5,10 @@ import os import re -from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args - from CIME.case import Case # pylint: disable=import-error +from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args + logger = logging.getLogger(__name__) # ======================================================================== diff --git a/python/ctsm/lilac_make_runtime_inputs.py b/python/ctsm/lilac_make_runtime_inputs.py index 5b9a4e1f76..2119c0e225 100644 --- a/python/ctsm/lilac_make_runtime_inputs.py +++ b/python/ctsm/lilac_make_runtime_inputs.py @@ -8,12 +8,12 @@ from configparser import ConfigParser from configparser import NoSectionError, NoOptionError +from CIME.buildnml import create_namelist_infile # pylint: disable=import-error + from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args from ctsm.path_utils import path_to_ctsm_root from ctsm.utils import abort -from CIME.buildnml import create_namelist_infile # pylint: disable=import-error - logger = logging.getLogger(__name__) # ======================================================================== diff --git a/python/ctsm/machine.py b/python/ctsm/machine.py index 67613053a9..36e5c61788 100644 --- a/python/ctsm/machine.py +++ b/python/ctsm/machine.py @@ -3,9 +3,9 @@ import logging from collections import namedtuple +from CIME.utils import get_project # pylint: disable=import-error from ctsm.joblauncher.job_launcher_factory import \ create_job_launcher, JOB_LAUNCHER_NOBATCH -from CIME.utils import get_project # pylint: disable=import-error logger = logging.getLogger(__name__) diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index 2299eb472e..8bfe006cae 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -8,6 +8,9 @@ import subprocess from datetime import datetime +from CIME.test_utils import get_tests_from_xml # pylint: disable=import-error +from CIME.cs_status_creator import create_cs_status # pylint: disable=import-error + from ctsm.ctsm_logging import setup_logging_pre_config, add_logging_args, process_logging_args from ctsm.machine_utils import get_machine_name from ctsm.machine import create_machine, get_possibly_overridden_mach_value @@ -16,9 +19,6 @@ from ctsm.path_utils import path_to_ctsm_root from ctsm.joblauncher.job_launcher_factory import JOB_LAUNCHER_NOBATCH -from CIME.test_utils import get_tests_from_xml # pylint: disable=import-error -from CIME.cs_status_creator import create_cs_status # pylint: disable=import-error - logger = logging.getLogger(__name__) # Number of initial characters from the compiler name to use in a testid diff --git a/python/ctsm/utils.py b/python/ctsm/utils.py index 09a08ff9af..44cce0cccf 100644 --- a/python/ctsm/utils.py +++ b/python/ctsm/utils.py @@ -3,6 +3,7 @@ import logging import sys import string +import pdb logger = logging.getLogger(__name__) @@ -12,7 +13,6 @@ def abort(errmsg): No traceback is given, but if the logging level is DEBUG, then we'll enter pdb """ if logger.isEnabledFor(logging.DEBUG): - import pdb pdb.set_trace() sys.exit('ERROR: {}'.format(errmsg)) From 853dc06861ea382ec34482d7f81e169f6d9249c0 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 19 Mar 2021 16:50:26 -0600 Subject: [PATCH 1873/1973] Give type of retry argument --- python/ctsm/run_sys_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ctsm/run_sys_tests.py b/python/ctsm/run_sys_tests.py index 8bfe006cae..f72d1863cf 100644 --- a/python/ctsm/run_sys_tests.py +++ b/python/ctsm/run_sys_tests.py @@ -307,7 +307,7 @@ def _commandline_args(): help='Queue to which tests are submitted.\n' 'If not provided, uses machine default.') - parser.add_argument('--retry', + parser.add_argument('--retry', type=int, help='Argument to create_test: Number of times to retry failed tests.\n' 'Default for this machine: {}'.format( default_machine.create_test_retry)) From 3ac4305770eed954c4aab192840007a6e76f02db Mon Sep 17 00:00:00 2001 From: negin513 Date: Fri, 19 Mar 2021 22:59:43 -0600 Subject: [PATCH 1874/1973] pointing to wrf/develop in WRF-CTSM docs --- doc/source/lilac/specific-atm-models/wrf.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf.rst b/doc/source/lilac/specific-atm-models/wrf.rst index 3d2ace80c9..d34dd66d0b 100644 --- a/doc/source/lilac/specific-atm-models/wrf.rst +++ b/doc/source/lilac/specific-atm-models/wrf.rst @@ -37,9 +37,9 @@ Clone WRF and CTSM Repositories Clone the WRF repository and checkout ``develop`` branch:: - git clone https://github.com/negin513/WRF-1.git WRF-CTSM + git clone https://github.com/wrf-model/WRF.git WRF-CTSM cd WRF-CTSM - git checkout wrf_ctsm_pr2 + git checkout develop Clone the CTSM repository:: From b8b4e703dc78095c6e53930c67a890b48f211bdf Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 20 Mar 2021 19:00:31 -0600 Subject: [PATCH 1875/1973] reintroduced nag fixes that were mistakenly deleted as part of this PR --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 861598e0d5..89874d332e 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -283,11 +283,11 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(iulog,'(a )')' atm component = '//trim(atm_model) write(iulog,'(a )')' rof component = '//trim(rof_model) write(iulog,'(a )')' glc component = '//trim(glc_model) - write(iulog,'(a,l )')' atm_prognostic = ',atm_prognostic - write(iulog,'(a,l )')' rof_prognostic = ',rof_prognostic - write(iulog,'(a,l )')' glc_present = ',glc_present + write(iulog,'(a,L1 )')' atm_prognostic = ',atm_prognostic + write(iulog,'(a,L1 )')' rof_prognostic = ',rof_prognostic + write(iulog,'(a,L1 )')' glc_present = ',glc_present if (glc_present) then - write(iulog,'(a,l)')' cism_evolve = ',cism_evolve + write(iulog,'(a,L1)')' cism_evolve = ',cism_evolve end if write(iulog,'(a )')' flds_scalar_name = '//trim(flds_scalar_name) write(iulog,'(a,i8)')' flds_scalar_num = ',flds_scalar_num From 6b3599b613913724558787e18c721d0f6c1bfb89 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 20 Mar 2021 19:03:57 -0600 Subject: [PATCH 1876/1973] reintroduced nag fixes that were mistakenly deleted as part of this PR --- src/cpl/nuopc/lnd_import_export.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index e84d267e1f..c5f56a3fbd 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -218,11 +218,11 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r if (flds_co2b .or. flds_co2c) send_co2_to_atm = .true. if (flds_co2a .or. flds_co2b .or. flds_co2c) recv_co2_fr_atm = .true. if (masterproc) then - write(iulog,'(a,l)') 'flds_co2a= ',flds_co2a - write(iulog,'(a,l)') 'flds_co2b= ',flds_co2b - write(iulog,'(a,l)') 'flds_co2c= ',flds_co2c - write(iulog,'(a,l)') 'sending co2 to atm = ',send_co2_to_atm - write(iulog,'(a,l)') 'receiving co2 from atm = ',recv_co2_fr_atm + write(iulog,'(a,L1)') 'flds_co2a= ',flds_co2a + write(iulog,'(a,L1)') 'flds_co2b= ',flds_co2b + write(iulog,'(a,L1)') 'flds_co2c= ',flds_co2c + write(iulog,'(a,L1)') 'sending co2 to atm = ',send_co2_to_atm + write(iulog,'(a,L1)') 'receiving co2 from atm = ',recv_co2_fr_atm end if end if From ae67c839ddfe41673fce559d8ce0ce0256d02dd6 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 22 Mar 2021 19:59:16 -0600 Subject: [PATCH 1877/1973] Adding code to handle dzsoi from a finidat file For now scale_by_thickness hardwired to .false.. The test ERP_D_Ld3_P36x2.f10_f10_mg37.I2000Clm50BgcCru.cheyenne_intel.clm-default passes bfb against baseline. Same test but with various combinations of finidat files and changing soil profile pass but with diff from baseline as expected. --- .../initInterpMultilevelContainer.F90 | 159 +++++++++++++++--- .../initInterpMultilevelInterp.F90 | 58 ++++++- src/main/subgridRestMod.F90 | 34 ++-- src/utils/restUtilMod.F90.in | 18 ++ 4 files changed, 223 insertions(+), 46 deletions(-) diff --git a/src/init_interp/initInterpMultilevelContainer.F90 b/src/init_interp/initInterpMultilevelContainer.F90 index d27f7591de..9e553bc41c 100644 --- a/src/init_interp/initInterpMultilevelContainer.F90 +++ b/src/init_interp/initInterpMultilevelContainer.F90 @@ -257,6 +257,8 @@ subroutine create_levgrnd_col_interpolators(ncid_source, ncid_dest, & ! !LOCAL VARIABLES: real(r8), allocatable :: coordinates_source(:,:) ! [lev, vec] real(r8), allocatable :: coordinates_dest(:,:) ! [lev, vec] + real(r8), allocatable :: dzsoi_source(:,:) ! [lev, vec] + real(r8), allocatable :: dzsoi_dest(:,:) ! [lev, vec] integer , allocatable :: level_classes_source(:,:) ! [lev, vec] integer , allocatable :: level_classes_dest(:,:) ! [lev, vec] @@ -269,16 +271,21 @@ subroutine create_levgrnd_col_interpolators(ncid_source, ncid_dest, & bounds_source = bounds_source, & bounds_dest = bounds_dest, & coord_varname = 'COL_Z', & + dzsoi_varname = 'DZSOI', & level_class_varname = 'LEVGRND_CLASS', & sgridindex = colindex, & coordinates_source = coordinates_source, & coordinates_dest = coordinates_dest, & + dzsoi_source = dzsoi_source, & + dzsoi_dest = dzsoi_dest, & level_classes_source = level_classes_source, & level_classes_dest = level_classes_dest) interp_multilevel_levmaxurbgrnd_col = interp_multilevel_interp_type( & coordinates_source = coordinates_source, & coordinates_dest = coordinates_dest, & + dzsoi_source = dzsoi_source, & + dzsoi_dest = dzsoi_dest, & level_classes_source = level_classes_source, & level_classes_dest = level_classes_dest, & coord_varname = 'COL_Z') @@ -286,6 +293,8 @@ subroutine create_levgrnd_col_interpolators(ncid_source, ncid_dest, & interp_multilevel_levgrnd_col = interp_multilevel_interp_type( & coordinates_source = coordinates_source(1:levgrnd_source, :), & coordinates_dest = coordinates_dest(1:levgrnd_dest, :), & + dzsoi_source = dzsoi_source(1:levgrnd_source, :), & + dzsoi_dest = dzsoi_dest(1:levgrnd_dest, :), & level_classes_source = level_classes_source(1:levgrnd_source, :), & level_classes_dest = level_classes_dest(1:levgrnd_dest, :), & coord_varname = 'COL_Z down to levgrnd') @@ -315,6 +324,8 @@ subroutine create_levgrnd_pft_interpolator(ncid_source, ncid_dest, & real(r8), allocatable :: coordinates_dest(:,:) ! [lev, vec] integer , allocatable :: level_classes_source(:,:) ! [lev, vec] integer , allocatable :: level_classes_dest(:,:) ! [lev, vec] + real(r8), allocatable :: dzsoi_source(:,:) ! [lev, vec] + real(r8), allocatable :: dzsoi_dest(:,:) ! [lev, vec] character(len=*), parameter :: subname = 'create_levgrnd_pft_interpolator' !----------------------------------------------------------------------- @@ -325,16 +336,21 @@ subroutine create_levgrnd_pft_interpolator(ncid_source, ncid_dest, & bounds_source = bounds_source, & bounds_dest = bounds_dest, & coord_varname = 'COL_Z_p', & + dzsoi_varname = 'DZSOI_p', & level_class_varname = 'LEVGRND_CLASS_p', & sgridindex = pftindex, & coordinates_source = coordinates_source, & coordinates_dest = coordinates_dest, & + dzsoi_source = dzsoi_source, & + dzsoi_dest = dzsoi_dest, & level_classes_source = level_classes_source, & level_classes_dest = level_classes_dest) interp_multilevel_levgrnd_pft = interp_multilevel_interp_type( & coordinates_source = coordinates_source(1:levgrnd_source, :), & coordinates_dest = coordinates_dest(1:levgrnd_dest, :), & + dzsoi_source = dzsoi_source(1:levgrnd_source, :), & + dzsoi_dest = dzsoi_dest(1:levgrnd_dest, :), & level_classes_source = level_classes_source(1:levgrnd_source, :), & level_classes_dest = level_classes_dest(1:levgrnd_dest, :), & coord_varname = 'COL_Z_p down to levgrnd') @@ -344,11 +360,12 @@ end subroutine create_levgrnd_pft_interpolator !----------------------------------------------------------------------- subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & bounds_source, bounds_dest, & - coord_varname, level_class_varname, sgridindex, & - coordinates_source, coordinates_dest, level_classes_source, level_classes_dest) + coord_varname, dzsoi_varname, level_class_varname, sgridindex, & + coordinates_source, coordinates_dest, dzsoi_source, dzsoi_dest, & + level_classes_source, level_classes_dest) ! ! !DESCRIPTION: - ! Get coordinate and level class metadata for the levmaxurbgrnd dimension + ! Get coordinate, dzsoi, and level class metadata for the levmaxurbgrnd dimension ! ! !ARGUMENTS: type(file_desc_t), target, intent(inout) :: ncid_source @@ -356,6 +373,7 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & type(interp_bounds_type), intent(in) :: bounds_source type(interp_bounds_type), intent(in) :: bounds_dest character(len=*), intent(in) :: coord_varname + character(len=*), intent(in) :: dzsoi_varname character(len=*), intent(in) :: level_class_varname integer, intent(in) :: sgridindex(:) ! mappings from source to dest points for the appropriate subgrid level (e.g., column-level mappings if this interpolator is for column-level data) @@ -364,15 +382,22 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & real(r8), allocatable, intent(out) :: coordinates_dest(:,:) ! [lev, vec] integer , allocatable, intent(out) :: level_classes_source(:,:) ! [lev, vec] integer , allocatable, intent(out) :: level_classes_dest(:,:) ! [lev, vec] + real(r8), allocatable, intent(out) :: dzsoi_source(:,:) ! [lev, vec] + real(r8), allocatable, intent(out) :: dzsoi_dest(:,:) ! [lev, vec] ! ! !LOCAL VARIABLES: type(interp_2dvar_type) :: coord_source type(interp_2dvar_type) :: coord_dest + type(interp_2dvar_type) :: dzs_source + type(interp_2dvar_type) :: dzs_dest type(interp_2dvar_type) :: level_class_source type(interp_2dvar_type) :: level_class_dest real(r8), pointer :: coord_data_source_sgrid_1d(:) ! [vec] On the source grid real(r8), allocatable :: coord_data_source(:,:) ! [vec, lev] Interpolated to the dest grid, but source vertical grid real(r8), pointer :: coord_data_dest(:,:) ! [vec, lev] Dest horiz & vertical grid + real(r8), pointer :: dzsoi_data_source_sgrid_1d(:) ! [vec] On the source grid + real(r8), allocatable :: dzsoi_data_source(:,:) ! [vec, lev] Interpolated to the dest grid, but source vertical grid + real(r8), pointer :: dzsoi_data_dest(:,:) ! [vec, lev] Dest horiz & vertical grid integer , pointer :: level_class_data_source_sgrid_1d(:) ! [vec] On the source grid integer , allocatable :: level_class_data_source(:,:) ! [vec, lev] Interpolated to the dest grid, but source vertical grid integer , pointer :: level_class_data_dest(:,:) ! [vec, lev] Dest horiz & vertical grid @@ -388,7 +413,7 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & integer :: beg_source integer :: end_source - integer :: level + integer :: level, g ! loop indices integer :: nlev_source character(len=*), parameter :: levmaxurbgrnd_name = 'levmaxurbgrnd' @@ -428,6 +453,24 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & beg_dest = coord_dest%get_vec_beg() end_dest = coord_dest%get_vec_end() + ! Set dzsoi_data_dest + dzs_dest = interp_2dvar_type( & + varname = dzsoi_varname, & + ncid = ncid_dest, & + file_is_dest = .true., & + bounds = bounds_dest) + ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble + ! resolving the generic reference here, giving the message: 'No specific + ! match can be found for the generic subprogram call "READVAR"'. So we + ! explicitly call the specific routine, rather than calling readvar. + call dzs_dest%readvar_double(dzsoi_data_dest) + call shr_assert(dzs_dest%get_nlev() == levmaxurbgrnd_dest, & + msg = 'dest '//dzsoi_varname//' dimension length does not match expected levmaxurbgrnd size', & + file = sourcefile, & + line = __LINE__) + SHR_ASSERT_FL(dzs_dest%get_vec_beg() == beg_dest, sourcefile, __LINE__) + SHR_ASSERT_FL(dzs_dest%get_vec_end() == end_dest, sourcefile, __LINE__) + ! Set level_class_data_dest level_class_dest = interp_2dvar_type( & varname = level_class_varname, & @@ -451,7 +494,7 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & ! conditions files have been phased out, we can remove this check. (Without this ! check, the run will still abort if it can't find the necessary variables - it just ! won't have a very helpful error message.) - call interp_levgrnd_check_source_file(ncid_source, coord_varname, level_class_varname) + call interp_levgrnd_check_source_file(ncid_source, coord_varname) ! Set coord_data_source coord_source = interp_2dvar_type( & @@ -484,6 +527,74 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & end do deallocate(coord_data_source_sgrid_1d) + if (coord_data_source(beg_dest,1) /= coord_data_dest(beg_dest,1)) then + ! The following call checks whether the finidat file contains the + ! necessary metadata for a vertical interpolation with scaling by soil + ! layer thickness. Scaling by thickness is necessary only if the run + ! uses a different soil profile than the one found in the finidata file. + ! Without this call the run still aborts if it can't find the necessary + ! variables, but it does not provide a helpful error message. + ! TODO Need similar call to check for scale_by_thickness + call interp_levgrnd_check_source_file(ncid_source, dzsoi_varname) + ! Set dzsoi_data_source + dzs_source = interp_2dvar_type( & + varname = dzsoi_varname, & + ncid = ncid_source, & + file_is_dest = .false., & + bounds = bounds_source) + call shr_assert(dzs_source%get_nlev() == levmaxurbgrnd_source, & + msg = 'source '//dzsoi_varname//' dimension length does not match expected levmaxurbgrnd size', & + file = sourcefile, & + line = __LINE__) + SHR_ASSERT_FL(dzs_source%get_vec_beg() == beg_source, sourcefile, __LINE__) + SHR_ASSERT_FL(dzs_source%get_vec_end() == end_source, sourcefile, __LINE__) + allocate(dzsoi_data_source(beg_dest:end_dest, nlev_source)) + allocate(dzsoi_data_source_sgrid_1d(beg_source:end_source)) + do level = 1, nlev_source + ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble + ! resolving the generic reference here, giving the message: 'No specific + ! match can be found for the generic subprogram call "READLEVEL"'. So we + ! explicitly call the specific routine, rather than calling readlevel. + call dzs_source%readlevel_double(dzsoi_data_source_sgrid_1d, level) + call interp_1d_data( & + begi = beg_source, endi = end_source, & + bego = beg_dest, endo = end_dest, & + sgridindex = sgridindex, & + keep_existing = .false., & + data_in = dzsoi_data_source_sgrid_1d, & + data_out = dzsoi_data_source(:,level)) + end do + deallocate(dzsoi_data_source_sgrid_1d) + else ! coord_data_source(beg_dest,1) == coord_data_dest(beg_dest,1) + ! When this is true, we assume identical source and dest soil profiles, + ! so we skip the calls to + ! (a) interp_levgrnd_check_source_file(ncid_source, dzsoi_varname) + ! (b) dzs_source%readlevel_double(dzsoi_data_source... + ! to avoid stopping or crashing the model due to missing dzsoi + ! in the finidat file. We do this for backwards compatibility when the + ! soil profile in the run is the same as in the finidat file and the + ! finidat file does not include dzsoi and scale_by_thickness as + ! metadata, yet. + ! + ! Skipping these calls is a problem only in the off chance that the + ! source and dest soil profiles differ despite having the same col_z at + ! beg_dest and layer 1. The model will handle such cases without scaling + ! the finidat variables that need scaling by soil layer thickness. + allocate(dzsoi_data_source(beg_dest:end_dest, nlev_source)) + do level = 1, nlev_source + do g = beg_dest, end_dest + dzsoi_data_source(g,level) = dzsoi_data_dest(g,level) + end do + end do + end if + + ! NOTE(wjs, 2015-10-18) The following check is helpful while we still have old initial + ! conditions files that do not have the necessary metadata. Once these old initial + ! conditions files have been phased out, we can remove this check. (Without this + ! check, the run will still abort if it can't find the necessary variables - it just + ! won't have a very helpful error message.) + call interp_levgrnd_check_source_file(ncid_source, level_class_varname) + ! Set level_class_data_source level_class_source = interp_2dvar_type( & varname = level_class_varname, & @@ -517,53 +628,53 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & ! Set output arrays call transpose_wrapper(coordinates_source, coord_data_source) call transpose_wrapper(coordinates_dest, coord_data_dest) + call transpose_wrapper(dzsoi_source, dzsoi_data_source) + call transpose_wrapper(dzsoi_dest, dzsoi_data_dest) call transpose_wrapper(level_classes_source, level_class_data_source) call transpose_wrapper(level_classes_dest, level_class_data_dest) ! Deallocate pointers (allocatables are automatically deallocated) deallocate(coord_data_dest) + deallocate(dzsoi_data_dest) deallocate(level_class_data_dest) end subroutine get_levmaxurbgrnd_metadata !----------------------------------------------------------------------- - subroutine interp_levgrnd_check_source_file(ncid_source, coord_varname, level_class_varname) + subroutine interp_levgrnd_check_source_file(ncid_source, varname) ! ! !DESCRIPTION: ! Ensure that the necessary variables are present on the source file for the levgrnd - ! interpolator. + ! interpolator. In separate calls to this subroutine, we check for + ! - coord + ! - dzsoi + ! - level_class ! - ! Aborts the run with a useful error message if either variable is missing + ! Aborts the run with a useful error message if variable is missing. ! ! !USES: ! ! !ARGUMENTS: type(file_desc_t), intent(inout) :: ncid_source - character(len=*) , intent(in) :: coord_varname - character(len=*) , intent(in) :: level_class_varname + character(len=*) , intent(in) :: varname ! ! !LOCAL VARIABLES: - logical :: coord_on_source - logical :: level_class_on_source - character(len=:), allocatable :: variables_missing + logical :: on_source + character(len=:), allocatable :: missing character(len=*), parameter :: subname = 'interp_levgrnd_check_source_file' !----------------------------------------------------------------------- - variables_missing = ' ' - call check_var(ncid_source, coord_varname, coord_on_source) - if (.not. coord_on_source) then - variables_missing = variables_missing // coord_varname // ' ' - end if - call check_var(ncid_source, level_class_varname, level_class_on_source) - if (.not. level_class_on_source) then - variables_missing = variables_missing // level_class_varname // ' ' + missing = ' ' + call check_var(ncid_source, varname, on_source) + if (.not. on_source) then + missing = missing // varname // ' ' end if - if (variables_missing /= ' ') then + if (missing /= ' ') then if (masterproc) then write(iulog,*) subname//& ' ERROR: source file for init_interp is missing the necessary variable(s):' - write(iulog,*) variables_missing + write(iulog,*) missing write(iulog,*) 'To solve this problem, run the model for a short time using this tag,' write(iulog,*) 'with a configuration that matches the source file, using the source' write(iulog,*) 'file as finidat (with use_init_interp = .false.), in order to' @@ -578,7 +689,7 @@ subroutine interp_levgrnd_check_source_file(ncid_source, coord_varname, level_cl end if call endrun(subname//' ERROR: source file for init_interp is missing '// & - variables_missing) + missing) end if end subroutine interp_levgrnd_check_source_file diff --git a/src/init_interp/initInterpMultilevelInterp.F90 b/src/init_interp/initInterpMultilevelInterp.F90 index 7045495f68..b268738bb8 100644 --- a/src/init_interp/initInterpMultilevelInterp.F90 +++ b/src/init_interp/initInterpMultilevelInterp.F90 @@ -85,6 +85,8 @@ module initInterpMultilevelInterp ! maps to destination point i. real(r8), allocatable :: coordinates_source(:,:) ! coordinate values on source grid [lev, pt] real(r8), allocatable :: coordinates_dest(:,:) ! coordinate values on dest grid [lev, pt] + real(r8), allocatable :: dzsoi_source(:,:) ! soil thicknesses on source grid [lev, pt] + real(r8), allocatable :: dzsoi_dest(:,:) ! soil thicknesses on dest grid [lev, pt] integer , allocatable :: level_classes_source(:,:) ! class indices on source grid [lev, pt] integer , allocatable :: level_classes_dest(:,:) ! class indices on dest grid [lev, pt] @@ -123,7 +125,9 @@ module initInterpMultilevelInterp ! ======================================================================== !----------------------------------------------------------------------- - function constructor_no_levclasses(coordinates_source, coordinates_dest, coord_varname) & + function constructor_no_levclasses(coordinates_source, coordinates_dest, & + dzsoi_source, dzsoi_dest, & + coord_varname) & result(this) ! ! !DESCRIPTION: @@ -142,6 +146,8 @@ function constructor_no_levclasses(coordinates_source, coordinates_dest, coord_v type(interp_multilevel_interp_type) :: this ! function result real(r8), intent(in) :: coordinates_source(:,:) ! coordinate values on source grid [lev, pt] real(r8), intent(in) :: coordinates_dest(:,:) ! coordinate values on dest grid [lev, pt] + real(r8), intent(in) :: dzsoi_source(:,:) ! dzsoi values on source grid [lev, pt] + real(r8), intent(in) :: dzsoi_dest(:,:) ! dzsoi values on dest grid [lev, pt] character(len=*), intent(in) :: coord_varname ! name of coordinate variable (just used for identification purposes) ! ! !LOCAL VARIABLES: @@ -155,6 +161,7 @@ function constructor_no_levclasses(coordinates_source, coordinates_dest, coord_v npts = size(coordinates_source, 2) SHR_ASSERT_FL((size(coordinates_dest, 2) == npts), sourcefile, __LINE__) + SHR_ASSERT_FL((size(dzsoi_dest, 2) == npts), sourcefile, __LINE__) nlev_source = size(coordinates_source, 1) nlev_dest = size(coordinates_dest, 1) @@ -165,6 +172,8 @@ function constructor_no_levclasses(coordinates_source, coordinates_dest, coord_v this = interp_multilevel_interp_type( & coordinates_source = coordinates_source, & coordinates_dest = coordinates_dest, & + dzsoi_source = dzsoi_source, & + dzsoi_dest = dzsoi_dest, & level_classes_source = level_classes_source, & level_classes_dest = level_classes_dest, & coord_varname = coord_varname) @@ -174,6 +183,7 @@ end function constructor_no_levclasses !----------------------------------------------------------------------- function constructor_with_levclasses(coordinates_source, coordinates_dest, & + dzsoi_source, dzsoi_dest, & level_classes_source, level_classes_dest, & coord_varname) & result(this) @@ -204,6 +214,8 @@ function constructor_with_levclasses(coordinates_source, coordinates_dest, & type(interp_multilevel_interp_type) :: this ! function result real(r8), intent(in) :: coordinates_source(:,:) ! coordinate values on source grid [lev, pt] real(r8), intent(in) :: coordinates_dest(:,:) ! coordinate values on dest grid [lev, pt] + real(r8), intent(in) :: dzsoi_source(:,:) ! dzsoi values on source grid [lev, pt] + real(r8), intent(in) :: dzsoi_dest(:,:) ! dzsoi values on dest grid [lev, pt] integer , intent(in) :: level_classes_source(:,:) ! class indices on source grid [lev, pt] integer , intent(in) :: level_classes_dest(:,:) ! class indices on dest grid [lev, pt] character(len=*), intent(in) :: coord_varname ! name of coordinate variable (just used for identification purposes) @@ -218,12 +230,13 @@ function constructor_with_levclasses(coordinates_source, coordinates_dest, & this%npts = size(coordinates_source, 2) SHR_ASSERT_FL((size(coordinates_dest, 2) == this%npts), sourcefile, __LINE__) - this%nlev_source = size(coordinates_source, 1) this%nlev_dest = size(coordinates_dest, 1) SHR_ASSERT_ALL_FL((shape(level_classes_source) == [this%nlev_source, this%npts]), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((shape(level_classes_dest) == [this%nlev_dest, this%npts]), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((shape(dzsoi_source) == [this%nlev_source, this%npts]), sourcefile, __LINE__) + SHR_ASSERT_ALL_FL((shape(dzsoi_dest) == [this%nlev_dest, this%npts]), sourcefile, __LINE__) do i = 1, this%npts call this%check_coordinate_array(coordinates_source(:,i), level_classes_source(:,i)) @@ -234,6 +247,8 @@ function constructor_with_levclasses(coordinates_source, coordinates_dest, & this%coordinates_source = coordinates_source this%coordinates_dest = coordinates_dest + this%dzsoi_source = dzsoi_source + this%dzsoi_dest = dzsoi_dest this%level_classes_source = level_classes_source this%level_classes_dest = level_classes_dest @@ -309,10 +324,12 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) integer :: lev_dest integer :: level_class_dest integer :: lev_source + logical :: scale_by_thickness = .false. ! TODO where/how to read from finidat ! source information for this index_dest real(r8) :: my_level_classes_source(this%nlev_source) real(r8) :: my_coordinates_source(this%nlev_source) + real(r8) :: my_dzsoi_source(this%nlev_source) ! whether each source level is in the destination level_class logical :: source_levels_in_class(this%nlev_source) @@ -320,6 +337,7 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) ! data and coordinates packed to just contain levels in the destination level_class: real(r8), allocatable :: data_source_in_class(:) real(r8), allocatable :: coordinates_source_in_class(:) + real(r8), allocatable :: dzsoi_source_in_class(:) character(len=*), parameter :: subname = 'interp_multilevel' !----------------------------------------------------------------------- @@ -330,6 +348,7 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) my_level_classes_source(:) = this%level_classes_source(:, index_dest) my_coordinates_source(:) = this%coordinates_source(:, index_dest) + my_dzsoi_source(:) = this%dzsoi_source(:, index_dest) do lev_dest = 1, this%nlev_dest level_class_dest = this%level_classes_dest(lev_dest, index_dest) @@ -346,11 +365,15 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) end do call pack_wrapper(data_source_in_class, data_source, source_levels_in_class) call pack_wrapper(coordinates_source_in_class, my_coordinates_source, source_levels_in_class) + call pack_wrapper(dzsoi_source_in_class, my_dzsoi_source, source_levels_in_class) call this%interp_onelevel( & data_dest = data_dest(lev_dest), & + dzsoi_dest = this%dzsoi_dest(lev_dest, index_dest), & coordinate_dest = this%coordinates_dest(lev_dest, index_dest), & data_source = data_source_in_class, & - coordinates_source = coordinates_source_in_class) + dzsoi_source = dzsoi_source_in_class, & + coordinates_source = coordinates_source_in_class, & + scale_by_thickness = scale_by_thickness) end if end if end do @@ -469,16 +492,21 @@ subroutine confirm_monotonically_increasing(data) end subroutine confirm_monotonically_increasing !----------------------------------------------------------------------- - subroutine interp_onelevel(data_dest, coordinate_dest, data_source, coordinates_source) + subroutine interp_onelevel(data_dest, dzsoi_dest, coordinate_dest, & + data_source, dzsoi_source, coordinates_source, & + scale_by_thickness) ! ! !DESCRIPTION: ! Do the interpolation for a single destination level ! ! !ARGUMENTS: real(r8), intent(inout) :: data_dest + real(r8), intent(in) :: dzsoi_dest real(r8), intent(in) :: coordinate_dest real(r8), intent(in) :: data_source(:) + real(r8), intent(in) :: dzsoi_source(:) real(r8), intent(in) :: coordinates_source(:) + logical , intent(in) :: scale_by_thickness ! ! !LOCAL VARIABLES: logical :: copylevel @@ -486,6 +514,8 @@ subroutine interp_onelevel(data_dest, coordinate_dest, data_source, coordinates_ integer :: nlev_source integer :: lev integer :: index_lower + real(r8) :: wt_lower ! Weight factor to scale the interpolation + real(r8) :: wt_lower_plus_1 ! Weight factor to scale the interpolation real(r8), parameter :: eps = 1.e-13_r8 character(len=*), parameter :: subname = 'interp_onelevel' @@ -546,18 +576,32 @@ subroutine interp_onelevel(data_dest, coordinate_dest, data_source, coordinates_ errMsg(sourcefile, __LINE__)) end if + ! Assemble the weights for scaling certain variables by soil thicknesses + if (scale_by_thickness) then + if (dzsoi_source(index_lower) == 0._r8 .or. & + dzsoi_source(index_lower+1) == 0._r8) then + call endrun(msg=subname//' ERROR: about to divide by zero... '// & + errMsg(sourcefile, __LINE__)) + end if + wt_lower = dzsoi_dest / dzsoi_source(index_lower) + wt_lower_plus_1 = dzsoi_dest / dzsoi_source(index_lower+1) + else ! no scaling; scale factors equal 1 + wt_lower = 1.0_r8 + wt_lower_plus_1 = wt_lower + end if + ! ------------------------------------------------------------------------ ! Do the interpolation ! ------------------------------------------------------------------------ if ( copylevel) then - data_dest = data_source(index_lower) + data_dest = data_source(index_lower) * wt_lower else data_dest = & - data_source(index_lower+1) & + data_source(index_lower+1) * wt_lower_plus_1 & * (coordinate_dest - coordinates_source(index_lower)) & / (coordinates_source(index_lower+1) - coordinates_source(index_lower)) + & - data_source(index_lower) & + data_source(index_lower) * wt_lower & * (coordinates_source(index_lower+1) - coordinate_dest ) & / (coordinates_source(index_lower+1) - coordinates_source(index_lower)) end if diff --git a/src/main/subgridRestMod.F90 b/src/main/subgridRestMod.F90 index 378ed78612..686c7b0308 100644 --- a/src/main/subgridRestMod.F90 +++ b/src/main/subgridRestMod.F90 @@ -310,6 +310,14 @@ subroutine subgridRest_write_only(bounds, ncid, flag) interpinic_flag='skip', readvar=readvar, data=temp2d_r) deallocate(temp2d_r) + allocate(temp2d_r(bounds%begc:bounds%endc, 1:nlevmaxurbgrnd)) + temp2d_r(bounds%begc:bounds%endc, 1:nlevmaxurbgrnd) = col%dz(bounds%begc:bounds%endc, 1:nlevmaxurbgrnd) + call restartvar(ncid=ncid, flag=flag, varname='DZSOI', xtype=ncd_double, & + dim1name='column', dim2name='levmaxurbgrnd', switchdim=.true., & + long_name='soil layer thickness', units='m', & + interpinic_flag='skip', readvar=readvar, data=temp2d_r) + deallocate(temp2d_r) + deallocate(rcarr, icarr) !------------------------------------------------------------------ @@ -423,6 +431,17 @@ subroutine subgridRest_write_only(bounds, ncid, flag) interpinic_flag='skip', readvar=readvar, data=temp2d_r) deallocate(temp2d_r) + allocate(temp2d_r(bounds%begp:bounds%endp, 1:nlevmaxurbgrnd)) + do p=bounds%begp,bounds%endp + c = patch%column(p) + temp2d_r(p, 1:nlevmaxurbgrnd) = col%dz(c, 1:nlevmaxurbgrnd) + end do + call restartvar(ncid=ncid, flag=flag, varname='DZSOI_p', xtype=ncd_double, & + dim1name='pft', dim2name='levmaxurbgrnd', switchdim=.true., & + long_name='soil layer thickness, patch-level', units='m', & + interpinic_flag='skip', readvar=readvar, data=temp2d_r) + deallocate(temp2d_r) + deallocate(rparr, iparr) ! ------------------------------------------------------------------------ @@ -539,21 +558,6 @@ subroutine subgridRest_write_and_read(bounds, ncid, flag) end if deallocate(temp2d) - ! Soil column variables - - allocate(temp2d(bounds%begc:bounds%endc,1:nlevmaxurbgrnd)) - if (flag == 'write') then - temp2d(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) = col%dz(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) - end if - call restartvar(ncid=ncid, flag=flag, varname='DZSOI', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., lowerb2=1, upperb2=nlevmaxurbgrnd, & - long_name='soil layer thickness', units='m', & - interpinic_flag='skip', readvar=readvar, data=temp2d) - if (flag == 'read') then - col%dz(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) = temp2d(bounds%begc:bounds%endc,1:nlevmaxurbgrnd) - end if - deallocate(temp2d) - end subroutine subgridRest_write_and_read !----------------------------------------------------------------------- diff --git a/src/utils/restUtilMod.F90.in b/src/utils/restUtilMod.F90.in index 99cf72169d..5af7e669ef 100644 --- a/src/utils/restUtilMod.F90.in +++ b/src/utils/restUtilMod.F90.in @@ -47,6 +47,24 @@ module restUtilMod integer,parameter, public :: iflag_noswitchdim = 0 integer,parameter, public :: iflag_switchdim = 1 + ! iflag_no_scale_by_thickness => init_interp WILL NOT scale these soil + ! variables by soil layer thickness. This is the default option. + ! Currently these variables get interpolated linearly and + ! without weighting by soil layer thickness. + ! iflag_scale_by_thickness => init_interp WILL scale these soil variables + ! by soil layer thickness to interpolate correctly from + ! the soil profile present in the initial/restart file to the soil profile + ! used by the model. For an example of setting this option to .true., + ! see H2OSOI_LIQ in subroutine Restart in WaterStateType.F90. + ! Soil variables of so called extensive properties require this + ! scaling for correct interpolation. Extensive properties depend on the + ! sample size. H2OSOI_LIQ with units of kg/m2 contains fewer kg of + ! water in thinner layers than in thicker layers. + ! Scaling the quantity by layer thickness contributes the correct amount + ! of water by adding rather than averaging amounts during interpolation. + ! Not scaling by thickness results in underestimated soil water when + ! interpolating from a finer to a coarser soil profile and + ! overestimated soil water in the opposite case. integer,parameter, public :: iflag_no_scale_by_thickness = 0 integer,parameter, public :: iflag_scale_by_thickness = 1 From 42b08333c062b4990a0b671f7c4e7936cf45faf8 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 24 Mar 2021 19:12:26 -0600 Subject: [PATCH 1878/1973] Updates so as to read scale_by_thickness from finidat file --- src/init_interp/initInterp.F90 | 31 ++++++++++++++++--- src/init_interp/initInterpMultilevelBase.F90 | 3 +- src/init_interp/initInterpMultilevelCopy.F90 | 4 ++- .../initInterpMultilevelInterp.F90 | 23 +++++++++----- src/init_interp/initInterpMultilevelSnow.F90 | 4 ++- src/init_interp/initInterpMultilevelSplit.F90 | 9 ++++-- 6 files changed, 57 insertions(+), 17 deletions(-) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index 0e6e8da6e2..7d40b9ab02 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -22,7 +22,7 @@ module initInterpMod use clm_varctl , only: iulog use abortutils , only: endrun use spmdMod , only: masterproc - use restUtilMod , only: iflag_interp, iflag_copy, iflag_skip, iflag_area + use restUtilMod , only: iflag_copy, iflag_skip, iflag_area use IssueFixedMetadataHandler, only : copy_issue_fixed_metadata use glcBehaviorMod , only: glc_behavior_type use ncdio_utils , only: find_var_on_file @@ -203,6 +203,8 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) integer :: dimidso(3) = -1 ! netCDF dimension ids integer :: status ! return code integer :: iflag_interpinic + integer :: iflag_scale_by_thickness ! 1=true/0=false flag to scale vertically interpolated variable by soil thickness or not + logical :: scale_by_thickness ! true/false flag to scale vertically interpolated variable by soil thickness or not real(r8) :: rvalue integer :: ivalue integer :: spinup_state_i, spinup_state_o @@ -455,6 +457,25 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) CYCLE end if + !--------------------------------------------------- + ! Get scale_by_thickness value (.true./.false.) from output + ! file to avoid backwards compatibility issue. + ! TODO status before the next pio_get_att returns 0; however, after + ! the call, the model just crashes when the attribute is missing. + ! How to check for the attribute to avoid + ! hardwiring the variable names below? Ideas: + ! - call read_issue_fixed_metadata? + !--------------------------------------------------- + + scale_by_thickness = .false. ! default value + + if ( trim(varname) == 'H2OSOI_LIQ' .or. trim(varname) == 'H2OSOI_ICE') then + status = pio_get_att(ncido, vardesc, 'scale_by_thickness_flag', iflag_scale_by_thickness) + if (iflag_scale_by_thickness == 1) then + scale_by_thickness = .true. + end if + end if + !--------------------------------------------------- ! Read metadata telling us possible variable names on input file; ! determine which of these is present on the input file @@ -648,7 +669,7 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) call interp_2d_double(var2d_i, var2d_o, & begi, endi, bego, endo, & sgridindex, & - interp_multilevel_container) + interp_multilevel_container, scale_by_thickness) else @@ -1082,7 +1103,7 @@ end subroutine interp_1d_int subroutine interp_2d_double (var2di, var2do, & begi, endi, bego, endo, sgridindex, & - interp_multilevel_container) + interp_multilevel_container, scale_by_thickness) ! -------------------------------------------------------------------- ! arguments @@ -1092,6 +1113,7 @@ subroutine interp_2d_double (var2di, var2do, & integer , intent(in) :: bego, endo integer , intent(in) :: sgridindex(bego:) type(interp_multilevel_container_type), intent(in) :: interp_multilevel_container + logical , intent(in) :: scale_by_thickness ! true/false flag to scale vertically interpolated variable by soil thickness or not ! ! local variables class(interp_multilevel_type), pointer :: multilevel_interpolator @@ -1158,7 +1180,8 @@ subroutine interp_2d_double (var2di, var2do, & call multilevel_interpolator%interp_multilevel( & data_dest = rbuf2do(no,:), & data_source = rbuf2do_levelsi(no,:), & - index_dest = no - bego + 1) + index_dest = no - bego + 1, & + scale_by_thickness = scale_by_thickness) end if end do diff --git a/src/init_interp/initInterpMultilevelBase.F90 b/src/init_interp/initInterpMultilevelBase.F90 index ae15b263eb..bd7b9077d1 100644 --- a/src/init_interp/initInterpMultilevelBase.F90 +++ b/src/init_interp/initInterpMultilevelBase.F90 @@ -53,7 +53,7 @@ subroutine check_npts_interface(this, npts, varname) end subroutine check_npts_interface subroutine interp_multilevel_interface(this, & - data_dest, data_source, index_dest) + data_dest, data_source, index_dest, scale_by_thickness) ! !DESCRIPTION: ! Interpolates a multi-level field from source to dest, for a single point. ! @@ -73,6 +73,7 @@ subroutine interp_multilevel_interface(this, & real(r8) , intent(inout) :: data_dest(:) real(r8) , intent(in) :: data_source(:) integer , intent(in) :: index_dest + logical , intent(in) :: scale_by_thickness end subroutine interp_multilevel_interface pure function get_description_interface(this) result(description) diff --git a/src/init_interp/initInterpMultilevelCopy.F90 b/src/init_interp/initInterpMultilevelCopy.F90 index 8aba51abfe..03f88b0788 100644 --- a/src/init_interp/initInterpMultilevelCopy.F90 +++ b/src/init_interp/initInterpMultilevelCopy.F90 @@ -85,7 +85,8 @@ end subroutine check_npts !----------------------------------------------------------------------- - subroutine interp_multilevel(this, data_dest, data_source, index_dest) + subroutine interp_multilevel(this, data_dest, data_source, index_dest, & + scale_by_thickness) ! ! !DESCRIPTION: ! Interpolates a multi-level field from source to dest, for a single point. @@ -98,6 +99,7 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) real(r8) , intent(inout) :: data_dest(:) real(r8) , intent(in) :: data_source(:) integer , intent(in) :: index_dest + logical , intent(in) :: scale_by_thickness ! ! !LOCAL VARIABLES: diff --git a/src/init_interp/initInterpMultilevelInterp.F90 b/src/init_interp/initInterpMultilevelInterp.F90 index b268738bb8..3d7593aed8 100644 --- a/src/init_interp/initInterpMultilevelInterp.F90 +++ b/src/init_interp/initInterpMultilevelInterp.F90 @@ -290,7 +290,7 @@ subroutine check_npts(this, npts, varname) end subroutine check_npts !----------------------------------------------------------------------- - subroutine interp_multilevel(this, data_dest, data_source, index_dest) + subroutine interp_multilevel(this, data_dest, data_source, index_dest, scale_by_thickness) ! ! !DESCRIPTION: ! Interpolates a multi-level field from source to dest, for a single point. @@ -319,12 +319,12 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) real(r8) , intent(inout) :: data_dest(:) real(r8) , intent(in) :: data_source(:) integer , intent(in) :: index_dest + logical , intent(in) :: scale_by_thickness ! ! !LOCAL VARIABLES: integer :: lev_dest integer :: level_class_dest integer :: lev_source - logical :: scale_by_thickness = .false. ! TODO where/how to read from finidat ! source information for this index_dest real(r8) :: my_level_classes_source(this%nlev_source) @@ -578,13 +578,22 @@ subroutine interp_onelevel(data_dest, dzsoi_dest, coordinate_dest, & ! Assemble the weights for scaling certain variables by soil thicknesses if (scale_by_thickness) then - if (dzsoi_source(index_lower) == 0._r8 .or. & - dzsoi_source(index_lower+1) == 0._r8) then - call endrun(msg=subname//' ERROR: about to divide by zero... '// & + if (dzsoi_source(index_lower) == 0._r8) then + call endrun(msg=subname//' ERROR case 1: about to divide by 0 '// & errMsg(sourcefile, __LINE__)) + else + wt_lower = dzsoi_dest / dzsoi_source(index_lower) + end if + if (.not. copylevel) then + if (dzsoi_source(index_lower+1) == 0._r8) then + call endrun(msg=subname//' ERROR case 2: about to divide by 0 '// & + errMsg(sourcefile, __LINE__)) + else + wt_lower_plus_1 = dzsoi_dest / dzsoi_source(index_lower+1) + end if + else ! if (copylevel) then wt_lower_plus_1 set but not used + wt_lower_plus_1 = wt_lower end if - wt_lower = dzsoi_dest / dzsoi_source(index_lower) - wt_lower_plus_1 = dzsoi_dest / dzsoi_source(index_lower+1) else ! no scaling; scale factors equal 1 wt_lower = 1.0_r8 wt_lower_plus_1 = wt_lower diff --git a/src/init_interp/initInterpMultilevelSnow.F90 b/src/init_interp/initInterpMultilevelSnow.F90 index f64d239448..393a3ee7cb 100644 --- a/src/init_interp/initInterpMultilevelSnow.F90 +++ b/src/init_interp/initInterpMultilevelSnow.F90 @@ -122,7 +122,8 @@ subroutine check_npts(this, npts, varname) end subroutine check_npts !----------------------------------------------------------------------- - subroutine interp_multilevel(this, data_dest, data_source, index_dest) + subroutine interp_multilevel(this, data_dest, data_source, index_dest, & + scale_by_thickness) ! ! !DESCRIPTION: ! Interpolates a multi-level field from source to dest, for a single point. @@ -157,6 +158,7 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) real(r8) , intent(inout) :: data_dest(:) real(r8) , intent(in) :: data_source(:) integer , intent(in) :: index_dest + logical , intent(in) :: scale_by_thickness ! ! !LOCAL VARIABLES: integer :: num_source ! total number of source layers diff --git a/src/init_interp/initInterpMultilevelSplit.F90 b/src/init_interp/initInterpMultilevelSplit.F90 index fa082b85f4..1480382f8a 100644 --- a/src/init_interp/initInterpMultilevelSplit.F90 +++ b/src/init_interp/initInterpMultilevelSplit.F90 @@ -159,7 +159,7 @@ pure function get_description(this) result(description) end function get_description !----------------------------------------------------------------------- - subroutine interp_multilevel(this, data_dest, data_source, index_dest) + subroutine interp_multilevel(this, data_dest, data_source, index_dest, scale_by_thickness) ! ! !DESCRIPTION: ! Interpolates a multi-level field from source to dest, for a single point. @@ -171,6 +171,7 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) real(r8) , intent(inout) :: data_dest(:) real(r8) , intent(in) :: data_source(:) integer , intent(in) :: index_dest + logical , intent(in) :: scale_by_thickness ! ! !LOCAL VARIABLES: integer :: num_first_levels_dest @@ -196,12 +197,14 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest) call this%interpolator_first_levels%interp_multilevel( & data_dest = data_dest(1:num_first_levels_dest), & data_source = data_source(1:num_first_levels_source), & - index_dest = index_dest) + index_dest = index_dest, & + scale_by_thickness = scale_by_thickness) call this%interpolator_second_levels%interp_multilevel( & data_dest = data_dest((num_first_levels_dest+1):size(data_dest)), & data_source = data_source((num_first_levels_source+1):size(data_source)), & - index_dest = index_dest) + index_dest = index_dest, & + scale_by_thickness = scale_by_thickness) end subroutine interp_multilevel From b85a4910a3e1374bd536500231eb0505210b6962 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 25 Mar 2021 11:50:36 -0600 Subject: [PATCH 1879/1973] Go back to L2 for logical display like before, and line write statements up, remove unneeded declaration of esmf_calander as this caused a problem on NAG on izumi --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 9 ++++----- src/cpl/nuopc/lnd_import_export.F90 | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 89874d332e..465421712b 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -283,11 +283,11 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) write(iulog,'(a )')' atm component = '//trim(atm_model) write(iulog,'(a )')' rof component = '//trim(rof_model) write(iulog,'(a )')' glc component = '//trim(glc_model) - write(iulog,'(a,L1 )')' atm_prognostic = ',atm_prognostic - write(iulog,'(a,L1 )')' rof_prognostic = ',rof_prognostic - write(iulog,'(a,L1 )')' glc_present = ',glc_present + write(iulog,'(a,L2)')' atm_prognostic = ',atm_prognostic + write(iulog,'(a,L2)')' rof_prognostic = ',rof_prognostic + write(iulog,'(a,L2)')' glc_present = ',glc_present if (glc_present) then - write(iulog,'(a,L1)')' cism_evolve = ',cism_evolve + write(iulog,'(a,L2)')' cism_evolve = ',cism_evolve end if write(iulog,'(a )')' flds_scalar_name = '//trim(flds_scalar_name) write(iulog,'(a,i8)')' flds_scalar_num = ',flds_scalar_num @@ -333,7 +333,6 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) type(ESMF_Time) :: startTime ! Start time type(ESMF_Time) :: refTime ! Ref time type(ESMF_TimeInterval) :: timeStep ! Model timestep - type(ESMF_Calendar) :: esmf_calendar ! esmf calendar type(ESMF_CalKind_Flag) :: esmf_caltype ! esmf calendar type integer :: ref_ymd ! reference date (YYYYMMDD) integer :: ref_tod ! reference time of day (sec) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index c5f56a3fbd..170212db03 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -218,11 +218,11 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r if (flds_co2b .or. flds_co2c) send_co2_to_atm = .true. if (flds_co2a .or. flds_co2b .or. flds_co2c) recv_co2_fr_atm = .true. if (masterproc) then - write(iulog,'(a,L1)') 'flds_co2a= ',flds_co2a - write(iulog,'(a,L1)') 'flds_co2b= ',flds_co2b - write(iulog,'(a,L1)') 'flds_co2c= ',flds_co2c - write(iulog,'(a,L1)') 'sending co2 to atm = ',send_co2_to_atm - write(iulog,'(a,L1)') 'receiving co2 from atm = ',recv_co2_fr_atm + write(iulog,'(a,L2)') 'flds_co2a= ',flds_co2a + write(iulog,'(a,L2)') 'flds_co2b= ',flds_co2b + write(iulog,'(a,L2)') 'flds_co2c= ',flds_co2c + write(iulog,'(a,L2)') 'sending co2 to atm = ',send_co2_to_atm + write(iulog,'(a,L2)') 'receiving co2 from atm = ',recv_co2_fr_atm end if end if From 43202e2b1064072ee50b5c0c92f9f777f17e10c3 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 25 Mar 2021 19:03:19 -0600 Subject: [PATCH 1880/1973] Adding scale_by_thickness=.true. to two restart vars While determining which variables needed the flag set to .true., I filled the units field for a number of other restart variables that had their units unspecified in restart. I based my unit entries on the code comments documenting these variables. --- src/biogeochem/CNDriverMod.F90 | 2 +- src/biogeophys/SoilStateType.F90 | 2 ++ .../SoilBiogeochemCarbonFluxType.F90 | 12 +++++----- .../SoilBiogeochemCarbonStateType.F90 | 24 +++++++++---------- .../SoilBiogeochemNStateUpdate1Mod.F90 | 1 - .../SoilBiogeochemNitrogenStateType.F90 | 20 ++++++++-------- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 index a969349136..b5d5ce97cd 100644 --- a/src/biogeochem/CNDriverMod.F90 +++ b/src/biogeochem/CNDriverMod.F90 @@ -108,7 +108,7 @@ subroutine CNDriverNoLeaching(bounds, ! stays synchronized with albedo calculations. ! ! !USES: - use clm_varpar , only: nlevgrnd, nlevdecomp_full + use clm_varpar , only: nlevdecomp_full use clm_varpar , only: nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools use subgridAveMod , only: p2c use CropType , only: crop_type diff --git a/src/biogeophys/SoilStateType.F90 b/src/biogeophys/SoilStateType.F90 index f5b75324c6..1690b06da9 100644 --- a/src/biogeophys/SoilStateType.F90 +++ b/src/biogeophys/SoilStateType.F90 @@ -384,11 +384,13 @@ subroutine Restart(this, bounds, ncid, flag) call restartvar(ncid=ncid, flag=flag, varname='SMP', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & long_name='soil matric potential', units='mm', & + scale_by_thickness=.true., & interpinic_flag='interp', readvar=readvar, data=this%smp_l_col) call restartvar(ncid=ncid, flag=flag, varname='HK', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & long_name='hydraulic conductivity', units='mm/s', & + scale_by_thickness=.true., & interpinic_flag='interp', readvar=readvar, data=this%hk_l_col) if( use_dynroot ) then diff --git a/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 b/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 index e866ea280b..e0b296080b 100644 --- a/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 +++ b/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 @@ -609,35 +609,35 @@ subroutine Restart(this, bounds, ncid, flag) ptr2d => this%FATES_c_to_litr_lab_c_col call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lab_c_col', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & + long_name='', units='gC/m3/s', & interpinic_flag='interp', readvar=readvar, data=ptr2d) ptr2d => this%FATES_c_to_litr_cel_c_col call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_cel_c_col', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & + long_name='', units='gC/m3/s', & interpinic_flag='interp', readvar=readvar, data=ptr2d) ptr2d => this%FATES_c_to_litr_lig_c_col call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lig_c_col', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & + long_name='', units='gC/m3/s', & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%FATES_c_to_litr_lab_c_col(:,1) call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lab_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & + dim1name='column', long_name='', units='gC/m3/s', & interpinic_flag='interp', readvar=readvar, data=ptr1d) ptr1d => this%FATES_c_to_litr_cel_c_col(:,1) call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_cel_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & + dim1name='column', long_name='', units='gC/m3/s', & interpinic_flag='interp', readvar=readvar, data=ptr1d) ptr1d => this%FATES_c_to_litr_lig_c_col(:,1) call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lig_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & + dim1name='column', long_name='', units='gC/m3/s', & interpinic_flag='interp', readvar=readvar, data=ptr1d) end if diff --git a/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 b/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 index 1c2fdd01bc..c39c3a0a86 100644 --- a/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 +++ b/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 @@ -522,12 +522,12 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, totvegc_col, c12_so ptr2d => this%decomp_cpools_vr_col(:,:,k) call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & + long_name='', units='g/m3', fill_value=spval, & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & + dim1name='column', long_name='', units='g/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if if (flag=='read' .and. .not. readvar) then @@ -540,12 +540,12 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, totvegc_col, c12_so ptr2d => this%ctrunc_vr_col call restartvar(ncid=ncid, flag=flag, varname='col_ctrunc_vr', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & + long_name='', units='gC/m3', fill_value=spval, & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%ctrunc_vr_col(:,1) ! nlevdecomp = 1; so treat as 1D variable call restartvar(ncid=ncid, flag=flag, varname='col_ctrunc', xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & + dim1name='column', long_name='', units='gC/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if if (flag=='read' .and. .not. readvar) then @@ -567,12 +567,12 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, totvegc_col, c12_so ptr2d => this%decomp_cpools_vr_col(:,:,k) call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & + long_name='', units='g/m3', fill_value=spval, & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & + dim1name='column', long_name='', units='g/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if if (flag=='read' .and. .not. readvar) then @@ -592,12 +592,12 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, totvegc_col, c12_so ptr2d => this%ctrunc_vr_col call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c13_vr", xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & + long_name='', units='gC/m3', fill_value=spval, & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%ctrunc_vr_col(:,1) call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c13", xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & + dim1name='column', long_name='', units='gC/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if end if @@ -614,13 +614,13 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, totvegc_col, c12_so ptr2d => this%decomp_cpools_vr_col(:,:,k) call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & + long_name='', units='g/m3', fill_value=spval, & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & dim1name='column', & - long_name='', units='', fill_value=spval, & + long_name='', units='g/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if if (flag=='read' .and. .not. readvar) then @@ -640,12 +640,12 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, totvegc_col, c12_so ptr2d => this%ctrunc_vr_col call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c14_vr", xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & + long_name='', units='gC/m3', fill_value=spval, & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%ctrunc_vr_col(:,1) call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c14", xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & + dim1name='column', long_name='', units='gC/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if diff --git a/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 b/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 index 9ea6883397..c3bc61a315 100644 --- a/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 @@ -8,7 +8,6 @@ module SoilBiogeochemNStateUpdate1Mod use shr_kind_mod , only: r8 => shr_kind_r8 use clm_time_manager , only : get_step_size_real use clm_varpar , only : nlevdecomp, ndecomp_pools, ndecomp_cascade_transitions - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd use clm_varctl , only : iulog, use_nitrif_denitrif, use_crop use clm_varcon , only : nitrif_n2o_loss_frac, dzsoi_decomp use SoilBiogeochemStateType , only : soilbiogeochem_state_type diff --git a/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 b/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 index 486783bbb1..ce06833e80 100644 --- a/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 +++ b/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 @@ -433,13 +433,13 @@ subroutine Restart ( this, bounds, ncid, flag, totvegc_col ) ptr2d => this%sminn_vr_col call restartvar(ncid=ncid, flag=flag, varname="sminn_vr", xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & + long_name='', units='gN/m3', fill_value=spval, & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%sminn_vr_col(:,1) call restartvar(ncid=ncid, flag=flag, varname="sminn", xtype=ncd_double, & dim1name='column', & - long_name='', units='', fill_value=spval, & + long_name='', units='gN/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if if (flag=='read' .and. .not. readvar) then @@ -454,13 +454,13 @@ subroutine Restart ( this, bounds, ncid, flag, totvegc_col ) ptr2d => this%decomp_npools_vr_col(:,:,k) call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & + long_name='', units='gN/m3', & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%decomp_npools_vr_col(:,1,k) call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & dim1name='column', & - long_name='', units='', fill_value=spval, & + long_name='', units='gN/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if if (flag=='read' .and. .not. readvar) then @@ -473,13 +473,13 @@ subroutine Restart ( this, bounds, ncid, flag, totvegc_col ) ptr2d => this%ntrunc_vr_col call restartvar(ncid=ncid, flag=flag, varname="col_ntrunc_vr", xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & + long_name='', units='gN/m3', fill_value=spval, & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%ntrunc_vr_col(:,1) call restartvar(ncid=ncid, flag=flag, varname="col_ntrunc", xtype=ncd_double, & dim1name='column', & - long_name='', units='', fill_value=spval, & + long_name='', units='gN/m3', fill_value=spval, & interpinic_flag='interp' , readvar=readvar, data=ptr1d) end if @@ -489,13 +489,13 @@ subroutine Restart ( this, bounds, ncid, flag, totvegc_col ) ptr2d => this%smin_no3_vr_col(:,:) call restartvar(ncid=ncid, flag=flag, varname='smin_no3_vr', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & + long_name='', units='gN/m3', & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%smin_no3_vr_col(:,1) call restartvar(ncid=ncid, flag=flag, varname='smin_no3', xtype=ncd_double, & dim1name='column', & - long_name='', units='', & + long_name='', units='gN/m3', & interpinic_flag='interp', readvar=readvar, data=ptr1d) end if if (flag=='read' .and. .not. readvar) then @@ -509,13 +509,13 @@ subroutine Restart ( this, bounds, ncid, flag, totvegc_col ) ptr2d => this%smin_nh4_vr_col(:,:) call restartvar(ncid=ncid, flag=flag, varname='smin_nh4_vr', xtype=ncd_double, & dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & + long_name='', units='gN/m3', & interpinic_flag='interp', readvar=readvar, data=ptr2d) else ptr1d => this%smin_nh4_vr_col(:,1) call restartvar(ncid=ncid, flag=flag, varname='smin_nh4', xtype=ncd_double, & dim1name='column', & - long_name='', units='', & + long_name='', units='gN/m3', & interpinic_flag='interp', readvar=readvar, data=ptr1d) end if if (flag=='read' .and. .not. readvar) then From 70e8d43118e140baf08518d13bd91ab380ade12f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 25 Mar 2021 20:08:55 -0600 Subject: [PATCH 1881/1973] updates to cime and cdeps --- Externals.cfg | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index bde774bba3..bdcc2415b7 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -33,12 +33,12 @@ repo_url = https://github.com/nmizukami/mizuRoute hash = 34723c2 required = True -# Note that this is a hash off of cime master that is required +# Note that this is a hash off of cime master that is required [cime] local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -hash = 0cd2268d5 +hash = 4d16c5b91 required = True [cmeps] @@ -52,7 +52,7 @@ required = True local_path = components/cdeps protocol = git repo_url = https://github.com/ESCOMP/CDEPS.git -tag = v0.1.0 +tag = v0.3.0 required = True [doc-builder] @@ -64,4 +64,3 @@ required = False [externals_description] schema_version = 1.0.0 - From e8f3f9cc03334a1aedb91aaee4441877763d806a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 25 Mar 2021 21:20:04 -0600 Subject: [PATCH 1882/1973] work around for accessing component attribute scol_spval --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index 89874d332e..39b00133b5 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -396,12 +396,16 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call NUOPC_CompAttributeGet(gcomp, name='scol_lat', value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return read(cvalue,*) scol_lat - call NUOPC_CompAttributeGet(gcomp, name='scol_spval', value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue,*) scol_spval call NUOPC_CompAttributeGet(gcomp, name='single_column_lnd_domainfile', value=single_column_lnd_domainfile, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! TODO: there is a problem retrieving scol_spval from the driver - for now + ! hard-wire scol_spval - this needs to be fixed + scol_spval = -999._r8 + ! call NUOPC_CompAttributeGet(gcomp, name='scol_spval', value=cvalue, rc=rc) + ! if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! read(cvalue,*) scol_spval + if (scol_lon > scol_spval .and. scol_lat > scol_spval) then single_column = (trim(single_column_lnd_domainfile) /= 'UNSET') From 2fa1a36998ec5670803f568f4b7cbffc0ab93f85 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 25 Mar 2021 21:23:57 -0600 Subject: [PATCH 1883/1973] introduction of branch in cime for single column bug fixes --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index bdcc2415b7..33fab29a0e 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -33,12 +33,12 @@ repo_url = https://github.com/nmizukami/mizuRoute hash = 34723c2 required = True -# Note that this is a hash off of cime master that is required +# Note that this a branch mvertens/scol_bugfix - needs a PR to master [cime] local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -hash = 4d16c5b91 +hash = ce458952e required = True [cmeps] From 5d0c1eb0fc60c73b3d343da90668786806113e43 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 26 Mar 2021 13:31:19 -0600 Subject: [PATCH 1884/1973] Add izumi_pgi nuopc tests to expected fail, because of ESMF build issue --- cime_config/testdefs/ExpectedTestFails.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 1147fb7bc3..73e0b564e6 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -88,6 +88,20 @@ + + + FAIL + ESMCI/cime#3496 + + + + + + FAIL + ESMCI/cime#3496 + + + FAIL From 56e44598e4869ea437b06b142ad557f2842080a3 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 26 Mar 2021 16:32:59 -0600 Subject: [PATCH 1885/1973] Add nuopc tests Resolves ESCOMP/CTSM#1312 --- cime_config/testdefs/testlist_clm.xml | 114 +++++++++++++++++++++++--- 1 file changed, 104 insertions(+), 10 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index c7371650a0..f4a74134c2 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -139,6 +139,16 @@ + + + + + + + + + + @@ -164,6 +174,15 @@ + + + + + + + + + @@ -190,6 +209,15 @@ + + + + + + + + + @@ -470,6 +498,15 @@ + + + + + + + + + @@ -583,6 +620,16 @@ + + + + + + + + + + @@ -988,6 +1035,16 @@ + + + + + + + + + + @@ -1220,6 +1277,15 @@ + + + + + + + + + @@ -1490,6 +1556,16 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + + + + + + + + + @@ -1516,6 +1592,15 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + + + + + + + + @@ -1554,6 +1639,16 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + + + + + + + + + @@ -1929,6 +2024,15 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this + + + + + + + + + @@ -2380,16 +2484,6 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - - - - - - - - - - From 0ec6051a22ee78fa980984ea6c68af7e2ce5191f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 26 Mar 2021 16:58:38 -0600 Subject: [PATCH 1886/1973] Point to a cime tag rather than a hash --- Externals.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 33fab29a0e..ad3651d1e2 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -33,12 +33,11 @@ repo_url = https://github.com/nmizukami/mizuRoute hash = 34723c2 required = True -# Note that this a branch mvertens/scol_bugfix - needs a PR to master [cime] local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -hash = ce458952e +tag = cime5.8.39 required = True [cmeps] From f9772679c5dcf4a507c45fc15319a1d547ec5e3a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sat, 27 Mar 2021 10:05:22 -0600 Subject: [PATCH 1887/1973] fixed call to get localpecount --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index a9402b6517..fc370905c1 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -739,6 +739,11 @@ subroutine ModelAdvance(gcomp, rc) ! Reset share log units !-------------------------------- + call ESMF_GridCompGet(gcomp, vm=vm, localPet=localPet, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + !$ call omp_set_num_threads(localPeCount) call shr_file_getLogUnit (shrlogunit) @@ -755,11 +760,6 @@ subroutine ModelAdvance(gcomp, rc) ! Query the Component for its clock, importState and exportState and vm !-------------------------------- - call ESMF_GridCompGet(gcomp, vm=vm, localPet=localPet, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call NUOPC_ModelGet(gcomp, modelClock=clock, importState=importState, exportState=exportState, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From ac0d391dc5c3b740bd5e0b0c5fd978bb7d735dea Mon Sep 17 00:00:00 2001 From: mvertens Date: Sat, 27 Mar 2021 13:53:40 -0600 Subject: [PATCH 1888/1973] cmeps branch that fixes nag tests --- Externals.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index ad3651d1e2..32ed2a3802 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -40,11 +40,12 @@ repo_url = https://github.com/ESMCI/cime tag = cime5.8.39 required = True +# cmeps branch mvertens/cesm_bugfix which has a PR to master [cmeps] local_path = cime/src/drivers/nuopc/ protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git -tag = v0.2.0 +hash = b437148 required = True [cdeps] From fe910f4958235dd9c35cde36343db228c40417e1 Mon Sep 17 00:00:00 2001 From: mvertens Date: Sat, 27 Mar 2021 14:11:35 -0600 Subject: [PATCH 1889/1973] updated cmeps to new tag on master --- Externals.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 32ed2a3802..6f5fa903a3 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -40,12 +40,11 @@ repo_url = https://github.com/ESMCI/cime tag = cime5.8.39 required = True -# cmeps branch mvertens/cesm_bugfix which has a PR to master [cmeps] local_path = cime/src/drivers/nuopc/ protocol = git repo_url = https://github.com/ESCOMP/CMEPS.git -hash = b437148 +tag = v0.5.0 required = True [cdeps] From ec4a4d8b2d5f8d3bc6f246691b7c9419ce889cef Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 29 Mar 2021 15:08:06 -0600 Subject: [PATCH 1890/1973] Add comments about new variables added --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index fc370905c1..bea9ed37d8 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -171,7 +171,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: lmpicom integer :: ierr integer :: n - integer :: localpet + integer :: localPet ! local PET (Persistent Execution Threads) (both MPI tasks and OpenMP threads) integer :: compid ! component id integer :: shrlogunit ! original log unit character(len=CL) :: cvalue @@ -328,7 +328,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer, intent(out) :: rc ! local variables - type(ESMF_VM) :: vm + type(ESMF_VM) :: vm ! Virtual machine, description of parallel procesors being used (both MPI and OpenMP) type(ESMF_Time) :: currTime ! Current time type(ESMF_Time) :: startTime ! Start time type(ESMF_Time) :: refTime ! Ref time @@ -342,8 +342,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: curr_ymd ! Start date (YYYYMMDD) integer :: curr_tod ! Start time of day (sec) integer :: dtime_sync ! coupling time-step from the input synchronization clock - integer :: localPet - integer :: localpecount + integer :: localPet ! local PET (Persistent Execution Threads) (both MPI tasks and OpenMP threads) + integer :: localPeCount ! Number of local Processors real(r8) :: nextsw_cday ! calday from clock of next radiation computation character(len=CL) :: starttype ! start-type (startup, continue, branch, hybrid) character(len=CL) :: calendar ! calendar type name @@ -352,9 +352,9 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) integer :: lbnum ! input to memory diagnostic integer :: shrlogunit ! original log unit type(bounds_type) :: bounds ! bounds - integer :: n, ni, nj + integer :: n, ni, nj ! Indices character(len=CL) :: cvalue ! config data - character(len=CL) :: meshfile_mask + character(len=CL) :: meshfile_mask ! filename of mesh file with land mask character(len=CL) :: ctitle ! case description title character(len=CL) :: caseid ! case identifier name real(r8) :: scol_lat ! single-column latitude @@ -362,14 +362,14 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) real(r8) :: scol_area ! single-column area real(r8) :: scol_frac ! single-column frac integer :: scol_mask ! single-column mask - real(r8) :: scol_spval - character(len=CL) :: single_column_lnd_domainfile - type(ESMF_Field) :: lfield - character(CL) ,pointer :: lfieldnamelist(:) => null() - integer :: fieldCount - integer :: rank - real(r8), pointer :: fldptr1d(:) - real(r8), pointer :: fldptr2d(:,:) + real(r8) :: scol_spval ! single-column special value to indicate it isn't set + character(len=CL) :: single_column_lnd_domainfile ! domain filename to use for single-column mode (i.e. SCAM) + type(ESMF_Field) :: lfield ! Land field read in + character(CL) ,pointer :: lfieldnamelist(:) => null() ! Land field namelist item sent with land field + integer :: fieldCount ! Number of fields on export state + integer :: rank ! Rank of field (1D or 2D) + real(r8), pointer :: fldptr1d(:) ! 1D field pointer + real(r8), pointer :: fldptr2d(:,:) ! 2D field pointer character(len=CL) :: model_version ! Model version character(len=CL) :: hostname ! hostname of machine running on character(len=CL) :: username ! user running the model @@ -704,8 +704,8 @@ subroutine ModelAdvance(gcomp, rc) integer :: tod_sync ! Sync current time of day (sec) integer :: dtime ! time step increment (sec) integer :: nstep ! time step index - integer :: localPet - integer :: localpecount + integer :: localPet ! local PET (Persistent Execution Threads) (both MPI tasks and OpenMP threads) + integer :: localPeCount ! Number of local Processors logical :: rstwr ! .true. ==> write restart file before returning logical :: nlend ! .true. ==> last time-step logical :: dosend ! true => send data back to driver From 21e6ec93af788497d73f66da6b4179967b895fe3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 30 Mar 2021 16:00:54 -0600 Subject: [PATCH 1891/1973] Point to CDEPS branch with fixed meshfile names --- Externals.cfg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 6f5fa903a3..a712dc2f70 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -50,8 +50,9 @@ required = True [cdeps] local_path = components/cdeps protocol = git -repo_url = https://github.com/ESCOMP/CDEPS.git -tag = v0.3.0 +repo_url = https://github.com/ekluzek/CDEPS.git +branch = cdf5files +#tag = v0.3.0 required = True [doc-builder] From f3a46685fa4bd4e5964a776c593ff4ed3824feda Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 30 Mar 2021 16:23:49 -0600 Subject: [PATCH 1892/1973] Add two expected fails --- cime_config/testdefs/ExpectedTestFails.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 73e0b564e6..73fb8deafc 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -102,6 +102,20 @@ + + + FAIL + #1317 + + + + + + FAIL + #1317 + + + FAIL From 456ca81efb9a5ac11c8a4f3fb4a7a33b47881ab2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 30 Mar 2021 22:09:25 -0600 Subject: [PATCH 1893/1973] Point to latest CDEPS version --- Externals.cfg | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index a712dc2f70..23e4b8d54f 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -50,9 +50,8 @@ required = True [cdeps] local_path = components/cdeps protocol = git -repo_url = https://github.com/ekluzek/CDEPS.git -branch = cdf5files -#tag = v0.3.0 +repo_url = https://github.com/ESCOMP/CDEPS.git +tag = v0.5.0 required = True [doc-builder] From c06a97d637a1e8237e9aa4f3baea093c03e11760 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 30 Mar 2021 22:10:42 -0600 Subject: [PATCH 1894/1973] Change CAM tests from 12 step back to 9 step, just to match the CAM version of the tests, and set ROF_NCPL to ATM_NCPL as is done in the CAM tests --- cime_config/testdefs/testlist_clm.xml | 30 +++++++++---------- .../clm/clm50cam6LndTuningMode/shell_commands | 1 + .../clm/waccmx_offline/shell_commands | 1 + 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index f4a74134c2..626b0dc689 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -55,7 +55,7 @@ - + @@ -191,7 +191,7 @@ - + @@ -200,7 +200,7 @@ - + @@ -209,7 +209,7 @@ - + @@ -330,7 +330,7 @@ - + @@ -1062,13 +1062,13 @@ - + - + @@ -1414,17 +1414,17 @@ - + - + - + @@ -1433,7 +1433,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1442,7 +1442,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1471,7 +1471,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + @@ -1480,7 +1480,7 @@ for ERS test as otherwise it won't work for a sub-day test (no need to run this - + diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/shell_commands index 19326795bb..0ed374e279 100644 --- a/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/clm50cam6LndTuningMode/shell_commands @@ -1,4 +1,5 @@ #!/bin/bash ./xmlchange LND_TUNING_MODE="clm5_0_cam6.0" +./xmlchange ROF_NCPL='$ATM_NCPL' diff --git a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands index e7d88b5afa..25f39d374e 100755 --- a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands @@ -1,4 +1,5 @@ ./xmlchange USE_ESMF_LIB=TRUE,ATM_NCPL=288,CALENDAR=GREGORIAN,ROF_NCPL='$ATM_NCPL',LND_TUNING_MODE="clm5_0_cam6.0" ./xmlchange CLM_BLDNML_OPTS="-megan -drydep" --append ./xmlchange RUN_STARTDATE=1979-01-01 +./xmlchange ./xmlchange ROF_NCPL='$ATM_NCPL' From e2722833301c6059a99ddb4540723f1eadb95680 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 30 Mar 2021 22:25:30 -0600 Subject: [PATCH 1895/1973] These are fields that are not optional, so remove the unneeded checks around them --- src/cpl/nuopc/lnd_import_export.F90 | 58 +++++++++++------------------ 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 170212db03..77ced85cfa 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -541,26 +541,18 @@ subroutine import_fields( gcomp, bounds, glc_present, rof_prognostic, & if (ChkErr(rc,__LINE__,u_FILE_u)) return ! optional atm input fields - if (fldchk(importState, Faxa_bcph)) then - ! 1 = bcphidry, 2 = bcphodry, 3 = bcphiwet - call state_getimport_2d(importState, Faxa_bcph, atm2lnd_inst%forc_aer_grc(begg:,1:3), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (fldchk(importState, Faxa_ocph)) then - ! 4 = ocphidry, 5 = ocphodry, 6 = ocphiwet - call state_getimport_2d(importState, Faxa_ocph, atm2lnd_inst%forc_aer_grc(begg:,4:6), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (fldchk(importState, Faxa_dstwet)) then - ! 7 = dstwet1, 9 = dstwet2, 11 = dstwet3, 13 = dstwet4 - call state_getimport_2d(importState, Faxa_dstwet, atm2lnd_inst%forc_aer_grc(begg:,7:13:2), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (fldchk(importState, Faxa_dstdry)) then - ! 8 = dstdry1, 10 = dstdry2, 12 = dstdry3, 14 = dstdry4 - call state_getimport_2d(importState, Faxa_dstdry, atm2lnd_inst%forc_aer_grc(begg:,8:14:2), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + ! 1 = bcphidry, 2 = bcphodry, 3 = bcphiwet + call state_getimport_2d(importState, Faxa_bcph, atm2lnd_inst%forc_aer_grc(begg:,1:3), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! 4 = ocphidry, 5 = ocphodry, 6 = ocphiwet + call state_getimport_2d(importState, Faxa_ocph, atm2lnd_inst%forc_aer_grc(begg:,4:6), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! 7 = dstwet1, 9 = dstwet2, 11 = dstwet3, 13 = dstwet4 + call state_getimport_2d(importState, Faxa_dstwet, atm2lnd_inst%forc_aer_grc(begg:,7:13:2), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + ! 8 = dstdry1, 10 = dstdry2, 12 = dstdry3, 14 = dstdry4 + call state_getimport_2d(importState, Faxa_dstdry, atm2lnd_inst%forc_aer_grc(begg:,8:14:2), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return if (fldchk(importState, Sa_methane)) then call state_getimport_1d(importState, Sa_methane, atm2lnd_inst%forc_pch4_grc(begg:), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -778,28 +770,20 @@ subroutine export_fields( gcomp, bounds, glc_present, rof_prognostic, & if (ChkErr(rc,__LINE__,u_FILE_u)) return ! optional fields - if (fldchk(exportState, Fall_flxdst)) then - call state_setexport_2d(exportState, Fall_flxdst, lnd2atm_inst%flxdst_grc(begg:,1:4), & - minus= .true., rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + call state_setexport_2d(exportState, Fall_flxdst, lnd2atm_inst%flxdst_grc(begg:,1:4), & + minus= .true., rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return if (fldchk(exportState, Fall_methane)) then call state_setexport_1d(exportState, Fall_methane, lnd2atm_inst%ch4_surf_flux_tot_grc(begg:), & minus=.true., rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end if - if (fldchk(exportState, Sl_u10)) then - call state_setexport_1d(exportState, Sl_u10, lnd2atm_inst%u_ref10m_grc(begg:), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (fldchk(exportState, Sl_ram1)) then - call state_setexport_1d(exportState, Sl_ram1, lnd2atm_inst%ram1_grc(begg:), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if - if (fldchk(exportState, Sl_fv)) then - call state_setexport_1d(exportState, Sl_fv, lnd2atm_inst%fv_grc(begg:), rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - end if + call state_setexport_1d(exportState, Sl_u10, lnd2atm_inst%u_ref10m_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport_1d(exportState, Sl_ram1, lnd2atm_inst%ram1_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + call state_setexport_1d(exportState, Sl_fv, lnd2atm_inst%fv_grc(begg:), rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return if (fldchk(exportState, Sl_soilw)) then call state_setexport_1d(exportState, Sl_soilw, waterlnd2atmbulk_inst%h2osoi_vol_grc(begg:,1), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 1f9f71b5e4019d6b94139de044939d90bcec535e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 30 Mar 2021 23:27:15 -0600 Subject: [PATCH 1896/1973] Add some more comments on what the code is doing --- src/cpl/nuopc/lnd_comp_nuopc.F90 | 24 ++++++++++++++---------- src/cpl/nuopc/lnd_import_export.F90 | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index bea9ed37d8..b1a7eabcfc 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -40,18 +40,18 @@ module lnd_comp_nuopc private ! except ! Module public routines - public :: SetServices - public :: SetVM + public :: SetServices ! Setup the pointers to the function calls for the different models phases (initialize, run, finalize) + public :: SetVM ! Set the virtual machine description of the paralell model (both MPI and OpenMP) ! Module private routines - private :: InitializeP0 - private :: InitializeAdvertise - private :: InitializeRealize - private :: ModelSetRunClock - private :: ModelAdvance - private :: ModelFinalize - private :: clm_orbital_init - private :: clm_orbital_update + private :: InitializeP0 ! Phase zero of initialization + private :: InitializeAdvertise ! Advertise the fields that can be passed + private :: InitializeRealize ! Realize the list of fields that will be exchanged + private :: ModelSetRunClock ! Set the run clock + private :: ModelAdvance ! Advance the model + private :: ModelFinalize ! Finalize the model + private :: clm_orbital_init ! Initialize the orbital information + private :: clm_orbital_update ! Update the orbital information !-------------------------------------------------------------------------- ! Private module data @@ -94,6 +94,7 @@ module lnd_comp_nuopc !=============================================================================== subroutine SetServices(gcomp, rc) + ! Setup the pointers to the function calls for the different models phases (initialize, run, finalize) type(ESMF_GridComp) :: gcomp integer, intent(out) :: rc @@ -142,6 +143,7 @@ end subroutine SetServices !=============================================================================== subroutine InitializeP0(gcomp, importState, exportState, clock, rc) + ! Phase zero initialization ! input/output variables type(ESMF_GridComp) :: gcomp type(ESMF_State) :: importState, exportState @@ -160,6 +162,7 @@ end subroutine InitializeP0 !=============================================================================== subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) + ! Advertise the fields that can be exchanged ! input/output variables type(ESMF_GridComp) :: gcomp type(ESMF_State) :: importState, exportState @@ -311,6 +314,7 @@ end subroutine InitializeAdvertise !=============================================================================== subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) + ! Realize the list of fields that will be exchanged !$ use omp_lib, only : omp_set_num_threads use ESMF , only : ESMF_VM, ESMF_VMGet use clm_instMod , only : lnd2atm_inst, lnd2glc_inst, water_inst diff --git a/src/cpl/nuopc/lnd_import_export.F90 b/src/cpl/nuopc/lnd_import_export.F90 index 77ced85cfa..03bd4d49d7 100644 --- a/src/cpl/nuopc/lnd_import_export.F90 +++ b/src/cpl/nuopc/lnd_import_export.F90 @@ -1,5 +1,5 @@ module lnd_import_export - + ! CTSM import and export fields exchanged with the coupler use ESMF , only : ESMF_GridComp, ESMF_State, ESMF_Mesh, ESMF_StateGet use ESMF , only : ESMF_KIND_R8, ESMF_SUCCESS, ESMF_MAXSTR, ESMF_LOGMSG_INFO use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_ERROR, ESMF_LogFoundError From d6fed4dbcb568eb9969f9602a538696f7351ad07 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 01:00:12 -0600 Subject: [PATCH 1897/1973] Fix xmlchange error --- .../testdefs/testmods_dirs/clm/waccmx_offline/shell_commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands index 25f39d374e..5e9068895c 100755 --- a/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/waccmx_offline/shell_commands @@ -1,5 +1,5 @@ ./xmlchange USE_ESMF_LIB=TRUE,ATM_NCPL=288,CALENDAR=GREGORIAN,ROF_NCPL='$ATM_NCPL',LND_TUNING_MODE="clm5_0_cam6.0" ./xmlchange CLM_BLDNML_OPTS="-megan -drydep" --append ./xmlchange RUN_STARTDATE=1979-01-01 -./xmlchange ./xmlchange ROF_NCPL='$ATM_NCPL' +./xmlchange ROF_NCPL='$ATM_NCPL' From 32413581da6cdd0eacff800e14fafe5e748e5af1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 01:15:29 -0600 Subject: [PATCH 1898/1973] Start the change files --- doc/ChangeLog | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 115 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 0457cbf22a..94fd098f1a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,118 @@ =============================================================== +Tag name: ctsm5.1.dev030 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Wed Mar 31 01:05:50 MDT 2021 +One-line Summary: New single column functionality for the NUOPC cap + +Purpose and description of changes +---------------------------------- + + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + +CIME Issues fixed (include issue #): + +Known bugs introduced in this tag (include issue #): + +Known bugs found since the previous tag (include issue #): + + +Notes of particular relevance for users +--------------------------------------- +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Caveats for users (e.g., need to interpolate initial conditions): + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + +Changes made to namelist defaults (e.g., changed parameter values): + +Changes to the datasets (e.g., parameter, surface or initial files): + +Notes of particular relevance for developers: +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + +Changes to tests or testing: + + +Testing summary: regular +---------------- + [PASS means all tests PASS; OK means tests PASS other than expected fails.] + + build-namelist tests (if CLMBuildNamelist.pm has changed): + + cheyenne - + + tools-tests (test/tools) (if tools have been changed): + + cheyenne - + + PTCLM testing (tools/shared/PTCLM/test): (if cime or cime_config are changed) + (PTCLM is being deprecated, so we only expect this to be done on occasion) + + cheyenne - + + python testing (if python code has changed; see instructions in python/README.md; document testing done): + + (any machine) - + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + + any other testing (give details below): + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No + (List of fields change though) + + +Other details +------------- + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, CDEPS, CMEPS + cime to cime5.8.39 + CDEPS to v0.5.0 + CMEPS to v0.5.0 + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + #1309 -- New single column functionality for NUOPC/CMEPS + #1310 -- run_sys_tests: add --retry option on izumi + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev029 Originator(s): mvertens (Mariana Vertenstein), sacks (Bill Sacks) Date: Thu Mar 18 21:21:21 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 7b4a2b02a9..a381c74c10 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev030 erik 03/31/2021 New single column functionality for the NUOPC cap ctsm5.1.dev029 mvertens 03/18/2021 Rework domain initialization for nuopc ctsm5.1.dev028 swensosc 03/17/2021 Change limitation of top layer evaporation/sublimation ctsm5.1.dev027 sacks 03/15/2021 Update cime and other externals; includes switch to pio2 From 3d7e555f8d616c98494a38b7612079055864922b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 01:17:48 -0600 Subject: [PATCH 1899/1973] Allow a 2000-2025 range for landuse timeseries as part of #1302 --- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 9543fbcf6f..ebec522bc9 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -2003,7 +2003,7 @@ CLM datasets exist for years: 1000 (for testing), 1850, and 2000 +"constant,1000-1002,1000-1004,850-1850,1850-1855,1850-2000,1850-2005,1850-2100,1980-2015,2000-2025,2000-2100"> Range of years to simulate transitory datasets for (such as dynamic: land-use datasets, aerosol-deposition, Nitrogen deposition rates etc.) Constant means simulation will be held at a constant year given in sim_year. A sim_year_range of 1000-1002 or 1000-1004 corresponds to data used for testing only, NOT corresponding to any real datasets. From c62b0b79e3504a3dee0d7bae8382714db54d0b67 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 02:06:47 -0600 Subject: [PATCH 1900/1973] Add --hires option to output maps in 64bit-offset form fixing #1183 --- tools/mkmapdata/mkmapdata.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index 9c5ef63db4..0ff7e805b8 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -14,6 +14,7 @@ # -t Output type, supported values are [regional, global] # -r Output resolution # -b use batch mode (not default) +# -i High resolution mode (Only used with -f) # -l list mapping files required (so can use check_input_data to get them) # -d debug usage -- display mkmapdata that will be run but don't execute them # -v verbose usage -- log more information on what is happening @@ -68,6 +69,8 @@ usage() { echo " you need to have a separate batch script for a supported machine" echo " that calls this script interactively - you cannot submit this" echo " script directly to the batch system" + echo "[-i|--hires]" + echo " Output maps are high resolution and large file support should be used" echo "[-l|--list]" echo " List mapping files required (use check_input_data to get them)" echo " also writes data to $outfilelist" @@ -137,6 +140,7 @@ list="no" outgrid="" gridfile="default" fast="no" +netcdfout="none" while [ $# -gt 0 ]; do case $1 in @@ -152,6 +156,9 @@ while [ $# -gt 0 ]; do --fast) fast="YES" ;; + -i|--hires) + netcdfout="64bit_offset" + ;; -l|--list) debug="YES" list="YES" @@ -202,12 +209,11 @@ if [ "$gridfile" != "default" ]; then exit 1 fi - # For now, make some assumptions about user-specified grids -- - # that they are SCRIP format, and small enough to not require - # large file support for the output mapping file. In the future, - # we may want to provide command-line options to allow the user to - # override these defaults. - DST_LRGFIL="none" + # For now, maked the assumption about user-specified grids -- + # that they are SCRIP format. In the future we may want to + # provide a command-line options to allow the user to + # override that default. + DST_LRGFIL=$netcdfout DST_TYPE="SCRIP" else if [ "$res" = "default" ]; then From 07a1ae1415f5e6533c64c6e3752db288ab782669 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 10:45:05 -0600 Subject: [PATCH 1901/1973] Move tests to aux_clm section --- cime_config/testdefs/ExpectedTestFails.xml | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 73fb8deafc..36b4961313 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -37,6 +37,34 @@ + + + FAIL + #1317 + + + + + + FAIL + #1317 + + + + + + FAIL + ESMCI/cime#3496 + + + + + + FAIL + ESMCI/cime#3496 + + + @@ -88,34 +116,6 @@ - - - FAIL - ESMCI/cime#3496 - - - - - - FAIL - ESMCI/cime#3496 - - - - - - FAIL - #1317 - - - - - - FAIL - #1317 - - - FAIL From 0b6c08c6d8a191df21ae9ecd57b5cd1e072970d7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 11:15:56 -0600 Subject: [PATCH 1902/1973] Add note about the failing DAE test --- cime_config/testdefs/ExpectedTestFails.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 36b4961313..5935e209ec 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -37,6 +37,13 @@ + + + FAIL + ESCOMP/CMEPS#175 + + + FAIL From 84960af183e0fd93c32013ad1129b0b372947d3f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 15:43:28 -0600 Subject: [PATCH 1903/1973] Add USUMB CLM_USRDAT tests to expected fails --- cime_config/testdefs/ExpectedTestFails.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 5935e209ec..3f79c30c55 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -44,6 +44,20 @@ + + + FAIL + ESMCI/cime#3905 + + + + + + FAIL + ESMCI/cime#3905 + + + FAIL From 1c11c434a09dcc5b2086b8f61b11c79715be190a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 15:46:14 -0600 Subject: [PATCH 1904/1973] Add a CLM_USRDAT USUMB test for NUOPC --- cime_config/testdefs/testlist_clm.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 626b0dc689..26040b60c9 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1678,6 +1678,16 @@ + + + + + + + + + + From 9bee7f55d699bed66067faa303ae26a729eb873b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Mar 2021 16:46:18 -0600 Subject: [PATCH 1905/1973] Update chagnelog file --- doc/ChangeLog | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 94fd098f1a..43d90bff93 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,12 +1,24 @@ =============================================================== Tag name: ctsm5.1.dev030 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Mar 31 01:05:50 MDT 2021 +Originator(s): mvertens / erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Wed Mar 31 16:46:04 MDT 2021 One-line Summary: New single column functionality for the NUOPC cap Purpose and description of changes ---------------------------------- +Implemented new nuopc/cmeps single column functionality. + +In config/cesm/config_files.xml - single point domains are only used +for mct/cpl7. For cmeps single point meshes are now generated on the +fly and component domains files are no longer needed. +env_run.xml variables PTS_LAT, PTS_LON and PTS_DOMAINFILE are used +to determine if there is a single point or single column run. +If PTS_LAT and PTS_LON are not -999 and PTS_DOMAINFILE is UNSET, +then you have a single point run and the exact values of PTS_LAT +and PTS_LON are used. If PTS_LAT and PTS_LON are not -999 and +PTS_DOMAINFILE is not UNSET, then then the cmeps driver will recognize the nearest neighbor +values of PTS_LAT and PTS_LON in PTS_DOMAINFILE as the single column lat and lon to use. Significant changes to scientifically-supported configurations @@ -30,25 +42,18 @@ Bugs fixed or introduced ------------------------ Issues fixed (include CTSM Issue #): - -CIME Issues fixed (include issue #): + Fixes #1312 -- Add NUOPC tests + Fixes #1302 -- Setup to allow landuse.timeseries file for high resolution cases for 2000-2025 + Fixes #1183 -- mkmapdata needs input option for large file support, current defaults unsuitable for high res grids. Known bugs introduced in this tag (include issue #): Known bugs found since the previous tag (include issue #): - + #1317 -- MPI timeout for some izumi_nag tests reading in datm forcing files in NUOPC cap + #1314 -- Send unset value for scol_lat/lon from driver Notes of particular relevance for users --------------------------------------- -[Remove any lines that don't apply. Remove entire section if nothing applies.] - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): Notes of particular relevance for developers: --------------------------------------------- @@ -56,8 +61,11 @@ NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the [Remove any lines that don't apply. Remove entire section if nothing applies.] Caveats for developers (e.g., code that is duplicated that requires double maintenance): + Nine step tests changed so that they have ROF run at same frequency as ATM (like the similar CAM tests) + as these will fail with NUOPC since it doesn't allow you to end not on an even time-step for all components. + One of these tests changed to a CAM type test from decStart -Changes to tests or testing: +Changes to tests or testing: Add more NUOPC tests to test list Testing summary: regular @@ -66,27 +74,22 @@ Testing summary: regular build-namelist tests (if CLMBuildNamelist.pm has changed): - cheyenne - + cheyenne - PASS tools-tests (test/tools) (if tools have been changed): - cheyenne - - - PTCLM testing (tools/shared/PTCLM/test): (if cime or cime_config are changed) - (PTCLM is being deprecated, so we only expect this to be done on occasion) - - cheyenne - + cheyenne - OK python testing (if python code has changed; see instructions in python/README.md; document testing done): - (any machine) - + cheyenne -- FAIL regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): cheyenne ---- OK izumi ------- OK - any other testing (give details below): + any other testing (give details below): Ran full izumi test list for nuopc driver (failed tests appear above) If the tag used for baseline comparisons was NOT the previous tag, note that here: From 610b99ba8be773eb0ba7b03d5c1d3a861f342eae Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Wed, 31 Mar 2021 21:03:41 -0600 Subject: [PATCH 1906/1973] Use python3 in more shebang lines This is needed to run the python unit tests on cheyenne without explicitly pointing to python3. There are still more shebang instances throughout CTSM that I have not yet changed, because I'm not positive if they should be changed yet. (buildnml and buildlib should probably be changed in conjunction with others through CESM, and I'm not sure about the usage of the contrib tools.) --- python/Makefile | 2 +- python/README.md | 2 +- python/ctsm/test/joblauncher/test_unit_job_launcher_no_batch.py | 2 +- python/ctsm/test/test_sys_lilac_build_ctsm.py | 2 +- python/ctsm/test/test_unit_lilac_build_ctsm.py | 2 +- python/ctsm/test/test_unit_lilac_make_runtime_inputs.py | 2 +- python/ctsm/test/test_unit_machine.py | 2 +- python/ctsm/test/test_unit_path_utils.py | 2 +- python/ctsm/test/test_unit_run_sys_tests.py | 2 +- python/ctsm/test/test_unit_utils.py | 2 +- python/run_ctsm_py_tests | 2 +- run_sys_tests | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) mode change 100644 => 100755 python/ctsm/test/joblauncher/test_unit_job_launcher_no_batch.py diff --git a/python/Makefile b/python/Makefile index 470d32b9d4..6c7e1ab32c 100644 --- a/python/Makefile +++ b/python/Makefile @@ -8,7 +8,7 @@ debug = not-set ifneq ($(python), not-set) PYTHON=$(python) else - PYTHON=python + PYTHON=python3 endif ifneq ($(debug), not-set) diff --git a/python/README.md b/python/README.md index c1cd00e4aa..57a3179bac 100644 --- a/python/README.md +++ b/python/README.md @@ -14,7 +14,7 @@ thing, but support different options: You can specify a few arguments to this: - - python version: `make python=python3 test` + - python version: `make python=python3.9 test` (defaults to `python3`; you should expect errors if trying to run with python2) - verbose: `make verbose=true test` - debug: `make debug=true test` diff --git a/python/ctsm/test/joblauncher/test_unit_job_launcher_no_batch.py b/python/ctsm/test/joblauncher/test_unit_job_launcher_no_batch.py old mode 100644 new mode 100755 index c407c62904..53bb6dc07d --- a/python/ctsm/test/joblauncher/test_unit_job_launcher_no_batch.py +++ b/python/ctsm/test/joblauncher/test_unit_job_launcher_no_batch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Unit tests for job_launcher_no_batch """ diff --git a/python/ctsm/test/test_sys_lilac_build_ctsm.py b/python/ctsm/test/test_sys_lilac_build_ctsm.py index 74121ba90d..5a44688171 100755 --- a/python/ctsm/test/test_sys_lilac_build_ctsm.py +++ b/python/ctsm/test/test_sys_lilac_build_ctsm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """System tests for lilac_build_ctsm diff --git a/python/ctsm/test/test_unit_lilac_build_ctsm.py b/python/ctsm/test/test_unit_lilac_build_ctsm.py index 677de63da4..3c1a600326 100755 --- a/python/ctsm/test/test_unit_lilac_build_ctsm.py +++ b/python/ctsm/test/test_unit_lilac_build_ctsm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Unit tests for lilac_build_ctsm """ diff --git a/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py b/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py index 7c94089269..e6b602b3d7 100755 --- a/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py +++ b/python/ctsm/test/test_unit_lilac_make_runtime_inputs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Unit tests for lilac_make_runtime_inputs """ diff --git a/python/ctsm/test/test_unit_machine.py b/python/ctsm/test/test_unit_machine.py index 65cd73620e..6a2f7ac172 100755 --- a/python/ctsm/test/test_unit_machine.py +++ b/python/ctsm/test/test_unit_machine.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Unit tests for machine """ diff --git a/python/ctsm/test/test_unit_path_utils.py b/python/ctsm/test/test_unit_path_utils.py index 9d4d1a78ff..9fc996aa2c 100755 --- a/python/ctsm/test/test_unit_path_utils.py +++ b/python/ctsm/test/test_unit_path_utils.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Unit tests for path_utils """ diff --git a/python/ctsm/test/test_unit_run_sys_tests.py b/python/ctsm/test/test_unit_run_sys_tests.py index 78ab02a648..8a53081a5b 100755 --- a/python/ctsm/test/test_unit_run_sys_tests.py +++ b/python/ctsm/test/test_unit_run_sys_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Unit tests for run_sys_tests """ diff --git a/python/ctsm/test/test_unit_utils.py b/python/ctsm/test/test_unit_utils.py index 34449aa93c..4a3fbbbb15 100755 --- a/python/ctsm/test/test_unit_utils.py +++ b/python/ctsm/test/test_unit_utils.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Unit tests for utils """ diff --git a/python/run_ctsm_py_tests b/python/run_ctsm_py_tests index ef56f74740..a3da6fdb1f 100755 --- a/python/run_ctsm_py_tests +++ b/python/run_ctsm_py_tests @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Driver for running the unit tests of the python code We use this rather than simply relying on 'python -m unittest discover' so we can do some diff --git a/run_sys_tests b/run_sys_tests index bccf6f00e1..48e6c71370 100755 --- a/run_sys_tests +++ b/run_sys_tests @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Driver for running CTSM system tests""" import os From c6ce0b8b44cfca25cd4f29a9728e366cae5d6c80 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 1 Apr 2021 15:37:41 -0600 Subject: [PATCH 1907/1973] threading for cmeps driver --- src/biogeochem/CNVegetationFacade.F90 | 2 ++ src/cpl/nuopc/lnd_comp_nuopc.F90 | 36 ++++++++++++++++----------- src/main/initSubgridMod.F90 | 4 +-- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 9ef32b4563..3068278559 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -1127,7 +1127,9 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & DA_nstep = get_nstep_since_startup_or_lastDA_restart_or_pause() if (DA_nstep <= skip_steps )then if (masterproc) then +!$OMP CRITICAL write(iulog,*) '--WARNING-- skipping CN balance check for first timesteps after startup or data assimilation' +!$OMP END CRITICAL end if else diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index b1a7eabcfc..7a74ca1f3a 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -78,6 +78,8 @@ module lnd_comp_nuopc logical :: scol_valid ! if single_column, does point have a mask of zero + integer :: nthrds ! Number of threads per task in this component + character(len=*) , parameter :: orb_fixed_year = 'fixed_year' character(len=*) , parameter :: orb_variable_year = 'variable_year' character(len=*) , parameter :: orb_fixed_parameters = 'fixed_parameters' @@ -476,13 +478,24 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) call memmon_dump_fort('memmon.out','lnd_comp_nuopc_InitializeRealize:start::',lbnum) endif #endif - - call ESMF_GridCompGet(gcomp, vm=vm, localPet=localPet, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - !$ call omp_set_num_threads(localPeCount) + !---------------------------------------------------------------------------- + ! Initialize component threading + !---------------------------------------------------------------------------- + + call ESMF_GridCompGet(gcomp, vm=vm, localPet=localPet, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) + if (chkerr(rc,__LINE__,u_FILE_u)) return + + if(localPeCount == 1) then + call NUOPC_CompAttributeGet(gcomp, "nthreads", value=cvalue, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + read(cvalue,*) nthrds + else + nthrds = localPeCount + endif + + !$ call omp_set_num_threads(nthrds) !---------------------- ! Consistency check on namelist filename @@ -739,17 +752,12 @@ subroutine ModelAdvance(gcomp, rc) RETURN end if + !$ call omp_set_num_threads(nthrds) + !-------------------------------- ! Reset share log units !-------------------------------- - call ESMF_GridCompGet(gcomp, vm=vm, localPet=localPet, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - call ESMF_VMGet(vm, pet=localPet, peCount=localPeCount, rc=rc) - if (chkerr(rc,__LINE__,u_FILE_u)) return - - !$ call omp_set_num_threads(localPeCount) - call shr_file_getLogUnit (shrlogunit) call shr_file_setLogUnit (iulog) diff --git a/src/main/initSubgridMod.F90 b/src/main/initSubgridMod.F90 index 43851c337b..5c7e2bd3b1 100644 --- a/src/main/initSubgridMod.F90 +++ b/src/main/initSubgridMod.F90 @@ -167,7 +167,7 @@ subroutine clm_ptrs_check(bounds) integer :: ltype ! landunit type logical :: error ! error flag !------------------------------------------------------------------------------ - +!$OMP CRITICAL associate( & begg => bounds%begg, & endg => bounds%endg, & @@ -325,7 +325,7 @@ subroutine clm_ptrs_check(bounds) if (masterproc) write(iulog,*) ' ' end associate - +!$OMP END CRITICAL end subroutine clm_ptrs_check !----------------------------------------------------------------------- From 3e6d711a5f94c3c503bf3c6d63c4deeb2ae7ba82 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 1 Apr 2021 16:42:59 -0600 Subject: [PATCH 1908/1973] Tweak the fixes for writes within threaded regions - initSubgridMod: clm_ptrs_check: these writes seem unnecessary and misleading (because, if there were an error on some tasks but not the master task, you would see messages both about "OK" and failures), so I'm simply removing the write statements - CNVegetationFacade: BalanceCheck: using OMP MASTER because this only needs to be written from one thread --- src/biogeochem/CNVegetationFacade.F90 | 4 +- src/main/initSubgridMod.F90 | 68 +++++++++++++-------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 3068278559..98995626b0 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -1127,9 +1127,9 @@ subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & DA_nstep = get_nstep_since_startup_or_lastDA_restart_or_pause() if (DA_nstep <= skip_steps )then if (masterproc) then -!$OMP CRITICAL +!$OMP MASTER write(iulog,*) '--WARNING-- skipping CN balance check for first timesteps after startup or data assimilation' -!$OMP END CRITICAL +!$OMP END MASTER end if else diff --git a/src/main/initSubgridMod.F90 b/src/main/initSubgridMod.F90 index 5c7e2bd3b1..a0a68e0d28 100644 --- a/src/main/initSubgridMod.F90 +++ b/src/main/initSubgridMod.F90 @@ -151,7 +151,7 @@ end subroutine clm_ptrs_compdown subroutine clm_ptrs_check(bounds) ! ! !DESCRIPTION: - ! Checks and writes out a summary of subgrid data + ! Checks subgrid data ! ! !USES use clm_varcon, only : ispval @@ -167,7 +167,7 @@ subroutine clm_ptrs_check(bounds) integer :: ltype ! landunit type logical :: error ! error flag !------------------------------------------------------------------------------ -!$OMP CRITICAL + associate( & begg => bounds%begg, & endg => bounds%endg, & @@ -179,9 +179,6 @@ subroutine clm_ptrs_check(bounds) endp => bounds%endp & ) - if (masterproc) write(iulog,*) ' ' - if (masterproc) write(iulog,*) '---clm_ptrs_check:' - !--- check index ranges --- error = .false. do g = begg, endg @@ -193,10 +190,10 @@ subroutine clm_ptrs_check(bounds) end do end do if (error) then - write(iulog,*) ' clm_ptrs_check: g index ranges - ERROR' - call endrun(msg=errMsg(sourcefile, __LINE__)) + call endrun( & + msg = 'clm_ptrs_check: g index ranges - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) end if - if (masterproc) write(iulog,*) ' clm_ptrs_check: g index ranges - OK' error = .false. if (minval(lun%gridcell(begl:endl)) < begg .or. maxval(lun%gridcell(begl:endl)) > endg) error=.true. @@ -205,10 +202,10 @@ subroutine clm_ptrs_check(bounds) if (minval(lun%patchi(begl:endl)) < begp .or. maxval(lun%patchi(begl:endl)) > endp) error=.true. if (minval(lun%patchf(begl:endl)) < begp .or. maxval(lun%patchf(begl:endl)) > endp) error=.true. if (error) then - write(iulog,*) ' clm_ptrs_check: l index ranges - ERROR' - call endrun(msg=errMsg(sourcefile, __LINE__)) + call endrun( & + msg = 'clm_ptrs_check: l index ranges - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: l index ranges - OK' error = .false. if (minval(col%gridcell(begc:endc)) < begg .or. maxval(col%gridcell(begc:endc)) > endg) error=.true. @@ -216,20 +213,20 @@ subroutine clm_ptrs_check(bounds) if (minval(col%patchi(begc:endc)) < begp .or. maxval(col%patchi(begc:endc)) > endp) error=.true. if (minval(col%patchf(begc:endc)) < begp .or. maxval(col%patchf(begc:endc)) > endp) error=.true. if (error) then - write(iulog,*) ' clm_ptrs_check: c index ranges - ERROR' - call endrun(msg=errMsg(sourcefile, __LINE__)) + call endrun( & + msg = 'clm_ptrs_check: c index ranges - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: c index ranges - OK' error = .false. if (minval(patch%gridcell(begp:endp)) < begg .or. maxval(patch%gridcell(begp:endp)) > endg) error=.true. if (minval(patch%landunit(begp:endp)) < begl .or. maxval(patch%landunit(begp:endp)) > endl) error=.true. if (minval(patch%column(begp:endp)) < begc .or. maxval(patch%column(begp:endp)) > endc) error=.true. if (error) then - write(iulog,*) ' clm_ptrs_check: p index ranges - ERROR' - call endrun(msg=errMsg(sourcefile, __LINE__)) + call endrun( & + msg = 'clm_ptrs_check: p index ranges - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: p index ranges - OK' !--- check that indices in arrays are monotonically increasing --- error = .false. @@ -244,11 +241,11 @@ subroutine clm_ptrs_check(bounds) if (lun%patchi(l) < lun%patchi(l-1)) error = .true. if (lun%patchf(l) < lun%patchf(l-1)) error = .true. if (error) then - write(iulog,*) ' clm_ptrs_check: l mono increasing - ERROR' - call endrun(decomp_index=l, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) + call endrun(decomp_index=l, clmlevel=namel, & + msg = 'clm_ptrs_check: l mono increasing - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: l mono increasing - OK' error = .false. do c=begc+1,endc @@ -263,11 +260,11 @@ subroutine clm_ptrs_check(bounds) if (col%patchi(c) < col%patchi(c-1)) error = .true. if (col%patchf(c) < col%patchf(c-1)) error = .true. if (error) then - write(iulog,*) ' clm_ptrs_check: c mono increasing - ERROR' - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) + call endrun(decomp_index=c, clmlevel=namec, & + msg = 'clm_ptrs_check: c mono increasing - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: c mono increasing - OK' error = .false. do p=begp+1,endp @@ -281,11 +278,11 @@ subroutine clm_ptrs_check(bounds) if (patch%landunit(p) < patch%landunit(p-1)) error = .true. if (patch%column (p) < patch%column (p-1)) error = .true. if (error) then - write(iulog,*) ' clm_ptrs_check: p mono increasing - ERROR' - call endrun(decomp_index=p, clmlevel=namep, msg=errMsg(sourcefile, __LINE__)) + call endrun(decomp_index=p, clmlevel=namep, & + msg = 'clm_ptrs_check: p mono increasing - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: p mono increasing - OK' !--- check that the tree is internally consistent --- error = .false. @@ -298,34 +295,35 @@ subroutine clm_ptrs_check(bounds) if (lun%itype(l) /= ltype) error = .true. if (lun%gridcell(l) /= g) error = .true. if (error) then - write(iulog,*) ' clm_ptrs_check: tree consistent - ERROR' - call endrun(decomp_index=l, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) + call endrun(decomp_index=l, clmlevel=namel, & + msg = 'clm_ptrs_check: tree consistent - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif do c = lun%coli(l),lun%colf(l) if (col%gridcell(c) /= g) error = .true. if (col%landunit(c) /= l) error = .true. if (error) then - write(iulog,*) ' clm_ptrs_check: tree consistent - ERROR' - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) + call endrun(decomp_index=c, clmlevel=namec, & + msg = 'clm_ptrs_check: tree consistent - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif do p = col%patchi(c),col%patchf(c) if (patch%gridcell(p) /= g) error = .true. if (patch%landunit(p) /= l) error = .true. if (patch%column(p) /= c) error = .true. if (error) then - write(iulog,*) ' clm_ptrs_check: tree consistent - ERROR' - call endrun(decomp_index=p, clmlevel=namep, msg=errMsg(sourcefile, __LINE__)) + call endrun(decomp_index=p, clmlevel=namep, & + msg = 'clm_ptrs_check: tree consistent - ERROR', & + additional_msg = errMsg(sourcefile, __LINE__)) endif enddo ! p enddo ! c end if ! l /= ispval enddo ! ltype enddo ! g - if (masterproc) write(iulog,*) ' clm_ptrs_check: tree consistent - OK' - if (masterproc) write(iulog,*) ' ' end associate -!$OMP END CRITICAL + end subroutine clm_ptrs_check !----------------------------------------------------------------------- From 88661a5d69b56b8525a98e0ff71f7caa63b72a9a Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 2 Apr 2021 17:20:02 -0600 Subject: [PATCH 1909/1973] Default glacier_region_behavior depends on CISM_USE_ANTARCTICA --- bld/CLMBuildNamelist.pm | 6 +++++- bld/namelist_files/namelist_defaults_ctsm.xml | 10 ++++++++-- cime_config/buildnml | 16 ++++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 83128f7357..89e4772d8b 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -167,6 +167,7 @@ OPTIONS (Note: buildnml copies the file for use by the driver) -glc_nec Glacier number of elevation classes [0 | 3 | 5 | 10 | 36] (default is 0) (standard option with land-ice model is 10) + -glc_use_antarctica Set defaults appropriate for runs that include Antarctica -help [or -h] Print usage to STDOUT. -light_res Resolution of lightning dataset to use for CN fire (360x720 or 94x192) -ignore_ic_date Ignore the date on the initial condition files @@ -253,6 +254,7 @@ sub process_commandline { clm_demand => "null", help => 0, glc_nec => "default", + glc_use_antarctica => 0, light_res => "default", lnd_tuning_mode => "default", lnd_frac => undef, @@ -297,6 +299,7 @@ sub process_commandline { "note!" => \$opts{'note'}, "megan!" => \$opts{'megan'}, "glc_nec=i" => \$opts{'glc_nec'}, + "glc_use_antarctica!" => \$opts{'glc_use_antarctica'}, "light_res=s" => \$opts{'light_res'}, "d:s" => \$opts{'dir'}, "h|help" => \$opts{'help'}, @@ -1917,7 +1920,8 @@ sub setup_logic_glacier { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glc_snow_persistence_max_days'); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'albice'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_behavior'); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_behavior', + 'glc_use_antarctica'=>$nl_flags->{'glc_use_antarctica'}); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_melt_behavior'); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_ice_runoff_behavior'); } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 3ccbe89a0e..c372b03771 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -442,8 +442,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). Mountain glaciers: single_at_atm_topo Greenland - inside CISM grid but outside Greenland itself: virtual Greenland itself: virtual - Antarctica: multiple --> -'single_at_atm_topo','virtual','virtual','multiple' + Antarctica: multiple + + If CISM is running over Antarctica, then we change the Antarctica + behavior to virtual. Note that the Greenland behavior is always + virtual, even if Greenland isn't included in this run. +--> +'single_at_atm_topo','virtual','virtual','multiple' +'single_at_atm_topo','virtual','virtual','virtual' From 1873d41b6054a38efeeb2f8c4d8139538ec89b63 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 10 Apr 2021 07:51:39 -0600 Subject: [PATCH 1940/1973] Update ChangeLog --- doc/ChangeLog | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 94 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 43d90bff93..d5dc6cb048 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,97 @@ =============================================================== +Tag name: ctsm5.1.dev031 +Originator(s): jedwards (Jim Edwards), sacks (Bill Sacks) +Date: Sat Apr 10 07:33:49 MDT 2021 +One-line Summary: Update externals and fixes for nuopc threading + +Purpose and description of changes +---------------------------------- + +(1) Some fixes for threading with the nuopc/cmeps driver. (However, + threading with nuopc/cmeps still doesn't work completely: see + https://github.com/ESCOMP/CTSM/issues/1331.) + +(2) Updates externals to versions needed for these nuopc threading changes + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ +Known bugs introduced in this tag (include issue #): +- https://github.com/ESCOMP/CTSM/issues/1331 Some runs with NUOPC driver + with multiple threads can hang + +Notes of particular relevance for developers: +--------------------------------------------- +Changes to tests or testing: +- Temporarily changed + SMS_D_Ln9_P480x3_Vnuopc.f19_g17.IHistClm50Sp.cheyenne_intel.clm-waccmx_offline + to use a 480x1 layout so that it will pass reliably (see + https://github.com/ESCOMP/CTSM/issues/1331) + +Testing summary: +---------------- + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: YES (but very limited) + + Summarize any changes to answers, i.e., + - what code configurations: NUOPC driver with CISM + - what platforms/compilers: cheyenne_intel; maybe others + - nature of change (roundoff; larger than roundoff/same climate; new climate): roundoff + + For an unknown reason, the new externals lead to small differences + in global sums in the CMEPS driver/mediator. For what we assume is + the same reason, lnd -> glc fields can change by roundoff (probably + due to the global renormalization). + + The only test in the aux_clm test suite where this shows up is + ERS_Ly3_P72x2_Vnuopc.f10_f10_mg37.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + + Inspection of cpl hist files + +Other details +------------- +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cism: cism2_1_75 -> cism_1_78 +- rtm: rtm1_0_75 -> rtm1_0_76 +- mosart: mosart1_0_41 -> mosart1_0_42 +- cime: cime5.8.39 -> cime5.8.42 +- cmeps: v0.5.0 -> v0.9.0 +- cdeps: v0.5.0 -> v0.6.0 + +Pull Requests that document the changes (include PR ids): +- https://github.com/ESCOMP/CTSM/pull/1319 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev030 Originator(s): mvertens / erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Wed Mar 31 16:46:04 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index a381c74c10..bd5f0f7823 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev031 jedwards 04/10/2021 Update externals and fixes for nuopc threading ctsm5.1.dev030 erik 03/31/2021 New single column functionality for the NUOPC cap ctsm5.1.dev029 mvertens 03/18/2021 Rework domain initialization for nuopc ctsm5.1.dev028 swensosc 03/17/2021 Change limitation of top layer evaporation/sublimation From f988226d3450228829cdcc0a207312c87d333b70 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 10 Apr 2021 09:55:00 -0600 Subject: [PATCH 1941/1973] Update ChangeLog --- doc/ChangeLog | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 86 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index d5dc6cb048..7596e9581c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,89 @@ =============================================================== +Tag name: ctsm5.1.dev032 +Originator(s): mvertens (Mariana Vertenstein), sacks (Bill Sacks) +Date: Sat Apr 10 09:47:25 MDT 2021 +One-line Summary: Fix bugs in co2 from atmosphere + +Purpose and description of changes +---------------------------------- + +ctsm5.1.dev002 introduced bugs when receiving co2 from the atmosphere, +both for mct and nuopc: +- For mct, with spatially-varying co2 from atmosphere, all grid cells on + a given processor were given the co2 value from the last grid cell on + that processor +- For nuopc, co2 from atmosphere was ignored and overridden with a + constant co2 value + +This tag fixes both of those bugs. + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + + +Bugs fixed or introduced +------------------------ +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1327 (When using co2 from atmosphere with mct, it + looks like values are taken just from the last gridcell on each proc) + +Testing summary: +---------------- + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + +Answer changes +-------------- + +Changes answers relative to baseline: YES + + Summarize any changes to answers, i.e., + - what code configurations: Cases where CTSM receives CO2 from atmosphere + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): + potentially new climate + + Answer changes due to fixing these issues: + - For mct, with spatially-varying co2 from atmosphere, all grid cells on + a given processor were given the co2 value from the last grid cell on + that processor + - For nuopc, co2 from atmosphere was ignored and overridden with a + constant co2 value + + In the test suite, this leads to changes in: + - ERP_D_Ld10_P36x2_Vnuopc.f10_f10_mg37.IHistClm51BgcCrop.cheyenne_intel.clm-ciso_decStart + - ERS_Ly3_P72x2_Vnuopc.f10_f10_mg37.IHistClm50BgcCropG.cheyenne_intel.clm-cropMonthOutput + - SMS_D_Ln9_P480x1_Vnuopc.f19_g17.IHistClm50Sp.cheyenne_intel.clm-waccmx_offline + + But more widespread changes are expected - including for mct - if + coupled runs can generate spatially-varying co2 from atm + +Other details +------------- +Pull Requests that document the changes (include PR ids): +- Merges the first part of the changes in + https://github.com/ESCOMP/CTSM/pull/1330 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev031 Originator(s): jedwards (Jim Edwards), sacks (Bill Sacks) Date: Sat Apr 10 07:33:49 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index bd5f0f7823..3b353b92d3 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev032 mvertens 04/10/2021 Fix bugs in co2 from atmosphere ctsm5.1.dev031 jedwards 04/10/2021 Update externals and fixes for nuopc threading ctsm5.1.dev030 erik 03/31/2021 New single column functionality for the NUOPC cap ctsm5.1.dev029 mvertens 03/18/2021 Rework domain initialization for nuopc From 0081aabe0bc1cd587ce8d3a4238a4d3061a4c777 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 10 Apr 2021 11:24:41 -0600 Subject: [PATCH 1942/1973] Remove nextsw_cday from clm_time_manager It was being set there but was never being used from there, so it was confusing to have this unnecessary set_nextsw_cday subroutine. --- src/cpl/lilac/lnd_comp_esmf.F90 | 2 +- src/cpl/mct/lnd_comp_mct.F90 | 3 +-- src/cpl/nuopc/lnd_comp_nuopc.F90 | 3 +-- src/utils/clm_time_manager.F90 | 22 ---------------------- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/cpl/lilac/lnd_comp_esmf.F90 b/src/cpl/lilac/lnd_comp_esmf.F90 index c72c7cfceb..7d227a4134 100644 --- a/src/cpl/lilac/lnd_comp_esmf.F90 +++ b/src/cpl/lilac/lnd_comp_esmf.F90 @@ -32,7 +32,7 @@ module lnd_comp_esmf use clm_varctl , only : nsrStartup, nsrContinue use clm_varctl , only : inst_index, inst_suffix, inst_name use clm_time_manager , only : set_timemgr_init, advance_timestep - use clm_time_manager , only : set_nextsw_cday, update_rad_dtime + use clm_time_manager , only : update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size use clm_time_manager , only : get_curr_date, get_curr_calday use clm_initializeMod , only : initialize1, initialize2 diff --git a/src/cpl/mct/lnd_comp_mct.F90 b/src/cpl/mct/lnd_comp_mct.F90 index 8bea7a8e4b..f94a3544dc 100644 --- a/src/cpl/mct/lnd_comp_mct.F90 +++ b/src/cpl/mct/lnd_comp_mct.F90 @@ -273,7 +273,7 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) use clm_instMod , only : water_inst, lnd2atm_inst, atm2lnd_inst, lnd2glc_inst, glc2lnd_inst use clm_driver , only : clm_drv use clm_time_manager, only : get_curr_date, get_nstep, get_curr_calday, get_step_size - use clm_time_manager, only : advance_timestep, set_nextsw_cday,update_rad_dtime + use clm_time_manager, only : advance_timestep, update_rad_dtime use decompMod , only : get_proc_bounds use abortutils , only : endrun use clm_varctl , only : iulog @@ -357,7 +357,6 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) curr_yr=yr_sync, curr_mon=mon_sync, curr_day=day_sync) call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) - call set_nextsw_cday( nextsw_cday ) dtime = get_step_size() ! Handle pause/resume signals from coupler diff --git a/src/cpl/nuopc/lnd_comp_nuopc.F90 b/src/cpl/nuopc/lnd_comp_nuopc.F90 index be7c7133b7..19c7748297 100644 --- a/src/cpl/nuopc/lnd_comp_nuopc.F90 +++ b/src/cpl/nuopc/lnd_comp_nuopc.F90 @@ -26,7 +26,7 @@ module lnd_comp_nuopc use clm_varctl , only : single_column, clm_varctl_set, iulog use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch use clm_time_manager , only : set_timemgr_init, advance_timestep - use clm_time_manager , only : set_nextsw_cday, update_rad_dtime + use clm_time_manager , only : update_rad_dtime use clm_time_manager , only : get_nstep, get_step_size use clm_time_manager , only : get_curr_date, get_curr_calday use clm_initializeMod , only : initialize1, initialize2 @@ -770,7 +770,6 @@ subroutine ModelAdvance(gcomp, rc) call State_GetScalar(importState, & flds_scalar_index_nextsw_cday, nextsw_cday, & flds_scalar_name, flds_scalar_num, rc) - call set_nextsw_cday( nextsw_cday ) ! Get proc bounds call get_proc_bounds(bounds) diff --git a/src/utils/clm_time_manager.F90 b/src/utils/clm_time_manager.F90 index 9ad956ebc8..3980ddc775 100644 --- a/src/utils/clm_time_manager.F90 +++ b/src/utils/clm_time_manager.F90 @@ -43,7 +43,6 @@ module clm_time_manager get_rest_date, &! return the date from the restart file get_local_timestep_time, &! return the local time for the input longitude to the nearest time-step get_local_time, &! return the local time for the input longitude - set_nextsw_cday, &! set the next radiation calendar day is_first_step, &! return true on first step of initial run is_first_restart_step, &! return true on first step of restart or branch run is_first_step_of_this_run_segment, &! return true on first step of any run segment (initial, restart or branch run) @@ -108,10 +107,6 @@ module clm_time_manager logical, save :: tm_first_restart_step = .false. ! true for first step of a restart or branch run logical, save :: tm_perp_calendar = .false. ! true when using perpetual calendar logical, save :: timemgr_set = .false. ! true when timemgr initialized - ! - ! Next short-wave radiation calendar day - ! - real(r8) :: nextsw_cday = uninit_r8 ! calday from clock of next radiation computation ! ! The time-step number of startup or last Data Assimulation (DA) restart or pause @@ -1417,21 +1412,6 @@ logical function is_near_local_noon( londeg, deltasec ) !--------------------------------------------------------------------------------- end function is_near_local_noon - !========================================================================================= - - subroutine set_nextsw_cday( nextsw_cday_in ) - - ! Set the next radiation calendar day, so that radiation step can be calculated - ! - ! Arguments - real(r8), intent(IN) :: nextsw_cday_in ! input calday of next radiation computation - - character(len=*), parameter :: sub = 'clm::set_nextsw_cday' - - nextsw_cday = nextsw_cday_in - - end subroutine set_nextsw_cday - !========================================================================================= function is_beg_curr_day() @@ -1800,8 +1780,6 @@ subroutine timemgr_reset() tm_perp_calendar = .false. timemgr_set = .false. - nextsw_cday = uninit_r8 - ! ------------------------------------------------------------------------ ! Reset other module-level variables to some reasonable default, to ensure that they ! don't carry over any state from one unit test to the next. From e4b727699765ac0c5b3d1ab37cdb9ea91e8d35f7 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 10 Apr 2021 11:29:51 -0600 Subject: [PATCH 1943/1973] Point to a cime branch tag Same as cime5.8.42 but with the changes from https://github.com/ESMCI/cime/pull/3914 cherry-picked in --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index 12d6f8df6c..8fdff0ac4b 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -37,7 +37,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ESMCI/cime -tag = cime5.8.42 +tag = branch_tags/cime5.8.42_a01 required = True [cmeps] From a97e2110fc3e89b94bb25211cc35ea33e9c11566 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Sat, 10 Apr 2021 16:53:26 -0600 Subject: [PATCH 1944/1973] Update ChangeLog --- doc/ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 65 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7596e9581c..f178eee325 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,68 @@ =============================================================== +Tag name: ctsm5.1.dev033 +Originator(s): mvertens (Mariana Vertenstein), sacks (Bill Sacks) +Date: Sat Apr 10 16:42:06 MDT 2021 +One-line Summary: Remove unnecessary settings of nextsw_cday + +Purpose and description of changes +---------------------------------- + +Remove setting of nextsw_cday in initialization: this hasn't been needed +ever since we stopped calculating albedos in initialization. + +Also remove nextsw_cday from clm_time_manager: this was being set but +was never referenced from here: instead, nextsw_cday was being passed as +an argument to clm_drv. + +Also, updates cime to a branch tag where I have fixed the --retry option +to create_test. + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +CIME Issues fixed (include issue #): +- ESMCI/cime#3912 (create_test --retry fails if the test is doing + baseline generation) + +Testing summary: +---------------- + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Other details +------------- +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): +- cime: cime5.8.42 -> branch_tags/cime5.8.42_a01 + +Pull Requests that document the changes (include PR ids): +- Second part of https://github.com/ESCOMP/CTSM/pull/1330 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev032 Originator(s): mvertens (Mariana Vertenstein), sacks (Bill Sacks) Date: Sat Apr 10 09:47:25 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 3b353b92d3..604005f609 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev033 mvertens 04/10/2021 Remove unnecessary settings of nextsw_cday ctsm5.1.dev032 mvertens 04/10/2021 Fix bugs in co2 from atmosphere ctsm5.1.dev031 jedwards 04/10/2021 Update externals and fixes for nuopc threading ctsm5.1.dev030 erik 03/31/2021 New single column functionality for the NUOPC cap From 916c11d607016b911f0b8e98def636cfeae5b2b7 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 13 Apr 2021 11:14:50 -0400 Subject: [PATCH 1945/1973] Bypass grid-level water mass check when fates hydro is active --- src/biogeophys/BalanceCheckMod.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index c94a4095ac..baf393d61d 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -11,6 +11,7 @@ module BalanceCheckMod use decompMod , only : bounds_type use abortutils , only : endrun use clm_varctl , only : iulog + use clm_varctl , only : use_fates_planthydro use clm_varcon , only : namep, namec, nameg use clm_varpar , only : nlevsoi use GetGlobalValuesMod , only : GetGlobalIndex @@ -723,7 +724,7 @@ subroutine BalanceCheck( bounds, & errh2o_max_val = maxval(abs(errh2o_grc(bounds%begg:bounds%endg))) - if (errh2o_max_val > h2o_warning_thresh) then + if (errh2o_max_val > h2o_warning_thresh .and. .not.use_fates_planthydro) then indexg = maxloc( abs(errh2o_grc(bounds%begg:bounds%endg)), 1 ) + bounds%begg - 1 write(iulog,*)'WARNING: grid cell-level water balance error ',& From 5a606c754bd67f119caf4bfbdef776a8a53439ce Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 13 Apr 2021 14:35:48 -0400 Subject: [PATCH 1946/1973] Added comment at fates-hydro grid-check that indicates temporary fix still needs to be addressed. --- src/biogeophys/BalanceCheckMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index baf393d61d..eaf2eec447 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -724,6 +724,8 @@ subroutine BalanceCheck( bounds, & errh2o_max_val = maxval(abs(errh2o_grc(bounds%begg:bounds%endg))) + ! BUG(rgk, 2021-04-13, ESCOMP/CTSM#1314) Temporarily bypassing gridcell-level check with use_fates_planthydro until issue 1314 is resolved + if (errh2o_max_val > h2o_warning_thresh .and. .not.use_fates_planthydro) then indexg = maxloc( abs(errh2o_grc(bounds%begg:bounds%endg)), 1 ) + bounds%begg - 1 From 09da58acf3a6ed12b6787269be7043a862bb9a31 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 13 Apr 2021 15:44:22 -0600 Subject: [PATCH 1947/1973] Added plant water storage to restarts --- src/biogeophys/WaterDiagnosticType.F90 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/WaterDiagnosticType.F90 b/src/biogeophys/WaterDiagnosticType.F90 index 0006ecc20d..5bc18ff4e6 100644 --- a/src/biogeophys/WaterDiagnosticType.F90 +++ b/src/biogeophys/WaterDiagnosticType.F90 @@ -294,7 +294,7 @@ subroutine Restart(this, bounds, ncid, flag) ! Read/Write module information to/from restart file. ! ! !USES: - use clm_varcon , only : nameg + use clm_varcon , only : nameg, namec use ncdio_pio , only : file_desc_t, ncd_double use restUtilMod ! @@ -329,6 +329,15 @@ subroutine Restart(this, bounds, ncid, flag) units='kg/kg', & interpinic_flag='interp', readvar=readvar, data=this%qaf_lun) + + call restartvar(ncid=ncid, flag=flag, & + varname=this%info%fname('TOTAL_PLANT_STORED_H2O'), & + xtype=ncd_double, dim1name=namec, & + long_name=this%info%lname('total plant stored water (for fates hydro)'), & + units='kg/m2', & + interpinic_flag='interp', readvar=readvar, data=this%total_plant_stored_h2o_col) + + end subroutine Restart !----------------------------------------------------------------------- From adb68078792ab600faee9a18c33f037b7ab8bb91 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 13 Apr 2021 15:48:16 -0600 Subject: [PATCH 1948/1973] Added comment in testdefs about current fates hydro tests --- cime_config/testdefs/testlist_clm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index c775ea4b8d..f7f2e3391e 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -2321,7 +2321,7 @@ - + @@ -2332,7 +2332,7 @@ - + From c2ca2a9669301c271b34798fd81322ed532f9b1e Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 15 Apr 2021 13:41:31 -0400 Subject: [PATCH 1949/1973] Added an if-clause to restarting with plant-stored-water --- src/biogeophys/WaterDiagnosticType.F90 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/WaterDiagnosticType.F90 b/src/biogeophys/WaterDiagnosticType.F90 index 5bc18ff4e6..9f27d89287 100644 --- a/src/biogeophys/WaterDiagnosticType.F90 +++ b/src/biogeophys/WaterDiagnosticType.F90 @@ -296,6 +296,7 @@ subroutine Restart(this, bounds, ncid, flag) ! !USES: use clm_varcon , only : nameg, namec use ncdio_pio , only : file_desc_t, ncd_double + use clm_varctl , only : use_fates_planthydro use restUtilMod ! ! !ARGUMENTS: @@ -329,14 +330,14 @@ subroutine Restart(this, bounds, ncid, flag) units='kg/kg', & interpinic_flag='interp', readvar=readvar, data=this%qaf_lun) - - call restartvar(ncid=ncid, flag=flag, & - varname=this%info%fname('TOTAL_PLANT_STORED_H2O'), & - xtype=ncd_double, dim1name=namec, & - long_name=this%info%lname('total plant stored water (for fates hydro)'), & - units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%total_plant_stored_h2o_col) - + if(use_fates_planthydro) then + call restartvar(ncid=ncid, flag=flag, & + varname=this%info%fname('TOTAL_PLANT_STORED_H2O'), & + xtype=ncd_double, dim1name=namec, & + long_name=this%info%lname('total plant stored water (for fates hydro)'), & + units='kg/m2', & + interpinic_flag='interp', readvar=readvar, data=this%total_plant_stored_h2o_col) + end if end subroutine Restart From a945c27286c29c300af63bf9ac02bcccb8f2f721 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 15 Apr 2021 13:43:11 -0400 Subject: [PATCH 1950/1973] Updated white-space issue that was driving me nuts --- src/biogeophys/WaterDiagnosticType.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeophys/WaterDiagnosticType.F90 b/src/biogeophys/WaterDiagnosticType.F90 index 9f27d89287..d3ef72849f 100644 --- a/src/biogeophys/WaterDiagnosticType.F90 +++ b/src/biogeophys/WaterDiagnosticType.F90 @@ -296,7 +296,7 @@ subroutine Restart(this, bounds, ncid, flag) ! !USES: use clm_varcon , only : nameg, namec use ncdio_pio , only : file_desc_t, ncd_double - use clm_varctl , only : use_fates_planthydro + use clm_varctl , only : use_fates_planthydro use restUtilMod ! ! !ARGUMENTS: From 3e40761147733e8f32a2f21fd3c81020d502e59e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Apr 2021 00:48:24 -0600 Subject: [PATCH 1951/1973] Turn reseed_dead_plants on for AD spinup mode fixes #1307 --- bld/CLMBuildNamelist.pm | 6 ++++++ bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 4eaaa0b485..863491b9f7 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1102,6 +1102,12 @@ sub setup_cmdl_spinup { $nl_flags->{'bgc_spinup'} = "off"; $val = $defaults->get_value($var); } + # For AD spinup mode by default reseed dead plants + if ( $nl_flags->{$var} ne "off" ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, + $defaults, $nl, "reseed_dead_plants", clm_accelerated_spinup=>$nl_flags->{$var}, + use_cn=>$nl_flags->{'use_cn'} ); + } } else { if ( defined($nl->get_value("spinup_state")) ) { $log->fatal_error("spinup_state is accelerated (=1 or 2) which is for a BGC mode of CN or BGC," . diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index d16bd788b2..564b1b6956 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -57,6 +57,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 1 0 + +.true. +.false. + .false. From 620d9b2dbb303433af3dc79b5535ed3db52b9da2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Apr 2021 01:01:13 -0600 Subject: [PATCH 1952/1973] Remove KO comments and commented out code --- src/biogeochem/CNPhenologyMod.F90 | 12 ------------ src/main/pftconMod.F90 | 8 -------- 2 files changed, 20 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 9e8f46365c..e81883ea91 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -674,9 +674,7 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) -!KO season_decid_temperate => pftcon%season_decid_temperate , & ! Input: binary flag for seasonal-deciduous temperate leaf habit (0 or 1) -!KO t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) soila10 => temperature_inst%soila10_patch , & ! Input: [real(r8) (:) ] @@ -881,15 +879,6 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday end if -!KO !separate into Arctic boreal and lower latitudes -!KO if (onset_gdd(p) > crit_onset_gdd .and. abs(grc%latdeg(g))<45.0_r8) then -!KO onset_thresh=1.0_r8 -!KO else if (onset_gddflag(p) == 1.0_r8 .and. soila10(p) > SHR_CONST_TKFRZ .and. & -!KO t_a5min(p) > SHR_CONST_TKFRZ .and. ws_flag==1.0_r8 .and. & -!KO dayl(g)>(crit_dayl/2.0_r8) .and. snow_5day(c)<0.1_r8) then -!KO onset_thresh=1.0_r8 -!KO end if -!KO if ( onset_thresh_depends_on_veg ) then ! separate into non-arctic seasonally deciduous pfts (temperate broadleaf deciduous ! tree) and arctic/boreal seasonally deciduous pfts (boreal needleleaf deciduous tree, @@ -906,7 +895,6 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & ! set onset_flag if critical growing degree-day sum is exceeded if (onset_gdd(p) > crit_onset_gdd) onset_thresh = 1.0_r8 end if -!KO ! If onset is being triggered if (onset_thresh == 1.0_r8) then onset_flag(p) = 1.0_r8 diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 999b56f15a..3645a6f63a 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -210,9 +210,7 @@ module pftconMod real(r8), allocatable :: evergreen (:) ! binary flag for evergreen leaf habit (0 or 1) real(r8), allocatable :: stress_decid (:) ! binary flag for stress-deciduous leaf habit (0 or 1) real(r8), allocatable :: season_decid (:) ! binary flag for seasonal-deciduous leaf habit (0 or 1) -!KO real(r8), allocatable :: season_decid_temperate(:) ! binary flag for seasonal-deciduous temperate leaf habit (0 or 1) -!KO real(r8), allocatable :: pconv (:) ! proportion of deadstem to conversion flux real(r8), allocatable :: pprod10 (:) ! proportion of deadstem to 10-yr product pool real(r8), allocatable :: pprod100 (:) ! proportion of deadstem to 100-yr product pool @@ -427,9 +425,7 @@ subroutine InitAllocate (this) allocate( this%evergreen (0:mxpft) ) allocate( this%stress_decid (0:mxpft) ) allocate( this%season_decid (0:mxpft) ) -!KO allocate( this%season_decid_temperate (0:mxpft) ) -!KO allocate( this%dwood (0:mxpft) ) allocate( this%root_density (0:mxpft) ) allocate( this%root_radius (0:mxpft) ) @@ -771,10 +767,8 @@ subroutine InitRead(this) call ncd_io('season_decid', this%season_decid, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) -!KO call ncd_io('season_decid_temperate', this%season_decid_temperate, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) -!KO call ncd_io('pftpar20', this%pftpar20, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) @@ -1427,9 +1421,7 @@ subroutine Clean(this) deallocate( this%evergreen) deallocate( this%stress_decid) deallocate( this%season_decid) -!KO deallocate( this%season_decid_temperate) -!KO deallocate( this%dwood) deallocate( this%root_density) deallocate( this%root_radius) From 9684ec30525ec4ff282d345230440275a0f0afac Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 16 Apr 2021 14:39:17 -0600 Subject: [PATCH 1953/1973] Need backwards compatibility for init_interp attribute --- src/init_interp/initInterp.F90 | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index 65eb46d3ca..343f1b9ea8 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -210,6 +210,7 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) integer :: npftsi, ncolsi, nlunsi, ngrcsi integer :: npftso, ncolso, nlunso, ngrcso logical :: glc_elevclasses_same + logical :: att_found integer , allocatable, target :: pftindx(:) integer , allocatable, target :: colindx(:) integer , allocatable, target :: lunindx(:) @@ -292,9 +293,25 @@ subroutine initInterp (filei, fileo, bounds, glc_behavior) status = pio_get_att(ncidi, pio_global, & 'ilun_crop', & subgrid_special_indices%ilun_crop) - status = pio_get_att(ncidi, pio_global, & - 'ilun_landice', & - subgrid_special_indices%ilun_landice) + + ! BACKWARDS_COMPATIBILITY(wjs, 2021-04-16) ilun_landice_multiple_elevation_classes has + ! been renamed to ilun_landice. For now we need to handle both possibilities for the + ! sake of old initial conditions files. There is a chance that we had ilun_landice + ! alongside ilun_landice_multiple_elevation_classes on really old initial conditions + ! files; in that case, we want to use ilun_landice_multiple_elevation_classes. Once we + ! can rely on all initial conditions files having the new behavior, we can remove this + ! check_att call and just assume there is an ilun_landice attribute. + call check_att(ncidi, pio_global, 'ilun_landice_multiple_elevation_classes', att_found) + if (att_found) then + status = pio_get_att(ncidi, pio_global, & + 'ilun_landice_multiple_elevation_classes', & + subgrid_special_indices%ilun_landice) + else + status = pio_get_att(ncidi, pio_global, & + 'ilun_landice', & + subgrid_special_indices%ilun_landice) + end if + status = pio_get_att(ncidi, pio_global, & 'created_glacier_mec_landunits', & created_glacier_mec_landunits) From e10dc0545f86516dd440ad86588657243f74a3bf Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 16 Apr 2021 15:08:21 -0600 Subject: [PATCH 1954/1973] Remove some dead code Resolves ESCOMP/CTSM#1333 --- src/cpl/utils/lnd_import_export_utils.F90 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/cpl/utils/lnd_import_export_utils.F90 b/src/cpl/utils/lnd_import_export_utils.F90 index 2f0c3939e7..032cb19b6f 100644 --- a/src/cpl/utils/lnd_import_export_utils.F90 +++ b/src/cpl/utils/lnd_import_export_utils.F90 @@ -84,15 +84,6 @@ subroutine derive_quantities( bounds, atm2lnd_inst, wateratm2lndbulk_inst, & call QSat(forc_t, forc_pbot, qsat_kg_kg) - ! modify specific humidity if precip occurs - if (1==2) then - if ((forc_rainc(g) + forc_rainl(g)) > 0._r8) then - forc_q = 0.95_r8 * qsat_kg_kg - !forc_q = qsat_kg_kg - wateratm2lndbulk_inst%forc_q_not_downscaled_grc(g) = forc_q - endif - endif - wateratm2lndbulk_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat_kg_kg) end do From e9d49621a25fdd3516a01172fd4dd5da26b367a8 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 16 Apr 2021 16:45:50 -0600 Subject: [PATCH 1955/1973] Add history file metadata on each variable's l2g_scale_type Adds a landunit_mask attribute Resolves ESCOMP/CTSM#1343 --- src/main/histFileMod.F90 | 155 +++++++++++++++++++++++++------------- src/main/ncdio_pio.F90.in | 12 ++- 2 files changed, 111 insertions(+), 56 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 988076f757..6a9100edfc 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -172,6 +172,7 @@ module histFileMod private :: pointer_index ! Track data pointer indices private :: max_nFields ! The max number of fields on any tape private :: avgflag_valid ! Whether a given avgflag is a valid option + private :: add_landunit_mask_metadata ! Add landunit_mask metadata for the given history field ! ! !PRIVATE TYPES: ! Constants @@ -2429,7 +2430,7 @@ subroutine htape_timeconst3D(t, & character(len=max_chars) :: long_name ! variable long name character(len=max_namlen):: varname ! variable name character(len=max_namlen):: units ! variable units - character(len=scale_type_strlen) :: l2g_scale_type ! scale type for subgrid averaging of landunits to grid cells + integer :: varid ! variable id ! real(r8), pointer :: histi(:,:) ! temporary real(r8), pointer :: histo(:,:) ! temporary @@ -2443,13 +2444,35 @@ subroutine htape_timeconst3D(t, & 'BSW ', & 'HKSAT ' & /) + ! Scale type for subgrid averaging of landunits to grid cells + ! WJS (10-25-11): Note about l2g_scale_type in the following: ZSOI & DZSOI are + ! currently constant in space, except for urban points, so their scale type + ! doesn't matter at the moment as long as it excludes urban points. I am using + ! 'nonurb' so that the values are output everywhere where the fields are + ! constant (i.e., everywhere except urban points). For the other fields, I am + ! using 'veg' to be consistent with the l2g_scale_type that is now used for many + ! of the 3-d time-variant fields; in theory, though, one might want versions of + ! these variables output for different landunits. + character(len=scale_type_strlen) :: l2g_scale_type(nflds) = [ & + 'nonurb', & ! ZSOI + 'nonurb', & ! DZSOI + 'veg ', & ! WATSAT + 'veg ', & ! SUCSAT + 'veg ', & ! BSW + 'veg ' & ! HKSAT + ] real(r8), pointer :: histil(:,:) ! temporary real(r8), pointer :: histol(:,:) integer, parameter :: nfldsl = 2 character(len=*),parameter :: varnamesl(nfldsl) = (/ & 'ZLAKE ', & 'DZLAKE' & - /) + /) + ! Scale type for subgrid averaging of landunits to grid cells, for lake fields + character(len=scale_type_strlen) :: l2g_scale_typel(nfldsl) = [ & + 'lake', & ! ZLAKE + 'lake' & ! DZLAKE + ] !----------------------------------------------------------------------- SHR_ASSERT_ALL_FL((ubound(watsat_col) == (/bounds%endc, nlevmaxurbgrnd/)), sourcefile, __LINE__) @@ -2486,12 +2509,16 @@ subroutine htape_timeconst3D(t, & if (ldomain%isgrid2d) then call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec,& dim1name='lon', dim2name='lat', dim3name='levgrnd', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) + long_name=long_name, units=units, missing_value=spval, fill_value=spval, & + varid=varid) else call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec, & - dim1name=grlnd, dim2name='levgrnd', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) + dim1name=grlnd, dim2name='levgrnd', & + long_name=long_name, units=units, missing_value=spval, fill_value=spval, & + varid=varid) end if + + call add_landunit_mask_metadata(nfid(t), varid, l2g_scale_type(ifld)) else call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec, & dim1name=namec, dim2name='levgrnd', & @@ -2520,30 +2547,6 @@ subroutine htape_timeconst3D(t, & do ifld = 1,nflds - ! WJS (10-25-11): Note about l2g_scale_type in the following: ZSOI & DZSOI are - ! currently constant in space, except for urban points, so their scale type - ! doesn't matter at the moment as long as it excludes urban points. I am using - ! 'nonurb' so that the values are output everywhere where the fields are - ! constant (i.e., everywhere except urban points). For the other fields, I am - ! using 'veg' to be consistent with the l2g_scale_type that is now used for many - ! of the 3-d time-variant fields; in theory, though, one might want versions of - ! these variables output for different landunits. - - ! Field indices MUST match varnames array order above! - if (ifld == 1) then ! ZSOI - l2g_scale_type = 'nonurb' - else if (ifld == 2) then ! DZSOI - l2g_scale_type = 'nonurb' - else if (ifld == 3) then ! WATSAT - l2g_scale_type = 'veg' - else if (ifld == 4) then ! SUCSAT - l2g_scale_type = 'veg' - else if (ifld == 5) then ! BSW - l2g_scale_type = 'veg' - else if (ifld == 6) then ! HKSAT - l2g_scale_type = 'veg' - end if - histi(:,:) = spval do lev = 1,nlevgrnd do c = bounds%begc,bounds%endc @@ -2563,7 +2566,7 @@ subroutine htape_timeconst3D(t, & call c2g(bounds, nlevgrnd, & histi(bounds%begc:bounds%endc, :), & histo(bounds%begg:bounds%endg, :), & - c2l_scale_type='unity', l2g_scale_type=l2g_scale_type) + c2l_scale_type='unity', l2g_scale_type=l2g_scale_type(ifld)) if (ldomain%isgrid2d) then call ncd_io(varname=trim(varnames(ifld)), dim1name=grlnd, & @@ -2597,12 +2600,16 @@ subroutine htape_timeconst3D(t, & if (ldomain%isgrid2d) then call ncd_defvar(ncid=nfid(t), varname=trim(varnamesl(ifld)), xtype=tape(t)%ncprec,& dim1name='lon', dim2name='lat', dim3name='levlak', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) + long_name=long_name, units=units, missing_value=spval, fill_value=spval, & + varid=varid) else call ncd_defvar(ncid=nfid(t), varname=trim(varnamesl(ifld)), xtype=tape(t)%ncprec, & - dim1name=grlnd, dim2name='levlak', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) + dim1name=grlnd, dim2name='levlak', & + long_name=long_name, units=units, missing_value=spval, fill_value=spval, & + varid=varid) end if + + call add_landunit_mask_metadata(nfid(t), varid, l2g_scale_typel(ifld)) else call ncd_defvar(ncid=nfid(t), varname=trim(varnamesl(ifld)), xtype=tape(t)%ncprec, & dim1name=namec, dim2name='levlak', & @@ -2646,7 +2653,7 @@ subroutine htape_timeconst3D(t, & call c2g(bounds, nlevlak, & histil(bounds%begc:bounds%endc, :), & histol(bounds%begg:bounds%endg, :), & - c2l_scale_type='unity', l2g_scale_type='lake') + c2l_scale_type='unity', l2g_scale_type=l2g_scale_typel(ifld)) if (ldomain%isgrid2d) then call ncd_io(varname=trim(varnamesl(ifld)), dim1name=grlnd, & data=histol, ncid=nfid(t), flag='write') @@ -3116,6 +3123,7 @@ subroutine hfields_write(t, mode) integer :: nt ! time index integer :: ier ! error status integer :: numdims ! number of dimensions + integer :: varid ! variable id character(len=avgflag_strlen) :: avgflag ! time averaging flag character(len=max_chars) :: long_name! long name character(len=max_chars) :: units ! units @@ -3124,6 +3132,7 @@ subroutine hfields_write(t, mode) character(len=hist_dim_name_length) :: type1d ! field 1d type character(len=hist_dim_name_length) :: type1d_out ! history output 1d type character(len=hist_dim_name_length) :: type2d ! history output 2d type + character(len=scale_type_strlen) :: l2g_scale_type character(len=32) :: dim1name ! temporary character(len=32) :: dim2name ! temporary real(r8), pointer :: histo(:,:) ! temporary @@ -3147,21 +3156,22 @@ subroutine hfields_write(t, mode) ! Set history field variables - varname = tape(t)%hlist(f)%field%name - long_name = tape(t)%hlist(f)%field%long_name - units = tape(t)%hlist(f)%field%units - avgflag = tape(t)%hlist(f)%avgflag - type1d = tape(t)%hlist(f)%field%type1d - type1d_out = tape(t)%hlist(f)%field%type1d_out - beg1d = tape(t)%hlist(f)%field%beg1d - end1d = tape(t)%hlist(f)%field%end1d - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - num1d_out = tape(t)%hlist(f)%field%num1d_out - type2d = tape(t)%hlist(f)%field%type2d - numdims = tape(t)%hlist(f)%field%numdims - num2d = tape(t)%hlist(f)%field%num2d - nt = tape(t)%ntimes + varname = tape(t)%hlist(f)%field%name + long_name = tape(t)%hlist(f)%field%long_name + units = tape(t)%hlist(f)%field%units + avgflag = tape(t)%hlist(f)%avgflag + type1d = tape(t)%hlist(f)%field%type1d + type1d_out = tape(t)%hlist(f)%field%type1d_out + beg1d = tape(t)%hlist(f)%field%beg1d + end1d = tape(t)%hlist(f)%field%end1d + beg1d_out = tape(t)%hlist(f)%field%beg1d_out + end1d_out = tape(t)%hlist(f)%field%end1d_out + num1d_out = tape(t)%hlist(f)%field%num1d_out + type2d = tape(t)%hlist(f)%field%type2d + numdims = tape(t)%hlist(f)%field%numdims + num2d = tape(t)%hlist(f)%field%num2d + l2g_scale_type = tape(t)%hlist(f)%field%l2g_scale_type + nt = tape(t)%ntimes if (mode == 'define') then @@ -3196,27 +3206,35 @@ subroutine hfields_write(t, mode) call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & dim1name=dim1name, dim2name='time', & long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) + missing_value=spval, fill_value=spval, & + varid=varid) else call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & dim1name=dim1name, dim2name=type2d, dim3name='time', & long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) + missing_value=spval, fill_value=spval, & + varid=varid) end if else if (numdims == 1) then call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & dim1name=dim1name, dim2name=dim2name, dim3name='time', & long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) + missing_value=spval, fill_value=spval, & + varid=varid) else call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & dim1name=dim1name, dim2name=dim2name, dim3name=type2d, dim4name='time', & long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) + missing_value=spval, fill_value=spval, & + varid=varid) end if endif + if (type1d_out == nameg .or. type1d_out == grlnd) then + call add_landunit_mask_metadata(nfid(t), varid, l2g_scale_type) + end if + else if (mode == 'write') then ! Determine output buffer @@ -5556,5 +5574,36 @@ function avgflag_valid(avgflag, blank_valid) result(valid) end function avgflag_valid + !----------------------------------------------------------------------- + subroutine add_landunit_mask_metadata(ncid, varid, l2g_scale_type) + ! + ! !DESCRIPTION: + ! Add landunit_mask metadata for the given history field + ! + ! !ARGUMENTS: + class(file_desc_t), intent(inout) :: ncid ! netcdf file id + integer , intent(in) :: varid ! netcdf var id + character(len=*) , intent(in) :: l2g_scale_type ! l2g_scale_type for this variable + ! + ! !LOCAL VARIABLES: + character(len=:), allocatable :: landunit_mask_string + + character(len=*), parameter :: subname = 'add_landunit_mask_metadata' + !----------------------------------------------------------------------- + + if (l2g_scale_type == 'unity') then + ! TODO(wjs, 2021-04-16) Once we consistently set l2g_scale_type for all variables, + ! and have stopped using other mechanisms (particularly the setting of variables to + ! spval everywhere) then we can stop setting this to 'unknown': we can instead set + ! this to something like 'all', with reasonable confidence that the field truly + ! applies over all landunits. + landunit_mask_string = 'unknown' + else + landunit_mask_string = l2g_scale_type + end if + + call ncd_putatt(ncid, varid, 'landunit_mask', landunit_mask_string) + + end subroutine add_landunit_mask_metadata end module histFileMod diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in index 4b7b75c82e..b321dc04bc 100644 --- a/src/main/ncdio_pio.F90.in +++ b/src/main/ncdio_pio.F90.in @@ -1212,7 +1212,8 @@ contains dim1name, dim2name, dim3name, dim4name, dim5name, & long_name, units, cell_method, missing_value, fill_value, & imissing_value, ifill_value, switchdim, comment, & - flag_meanings, flag_values, nvalid_range ) + flag_meanings, flag_values, nvalid_range, & + varid) ! ! !DESCRIPTION: ! Define a netcdf variable @@ -1238,12 +1239,13 @@ contains logical , intent(in), optional :: switchdim ! true=> permute dim1 and dim2 for output integer , intent(in), optional :: flag_values(:) ! attribute for int integer , intent(in), optional :: nvalid_range(2) ! attribute for int + integer , intent(out), optional :: varid ! returned var id ! ! !LOCAL VARIABLES: integer :: n ! indices integer :: ndims ! dimension counter integer :: dimid(5) ! dimension ids - integer :: varid ! variable id + integer :: l_varid ! local variable id integer :: itmp ! temporary character(len=256) :: str ! temporary character(len=*),parameter :: subname='ncd_defvar_bygrid' ! subroutine name @@ -1276,13 +1278,17 @@ contains end do end if - call ncd_defvar_bynf(ncid,varname,xtype,ndims,dimid,varid, & + call ncd_defvar_bynf(ncid,varname,xtype,ndims,dimid,l_varid, & long_name=long_name, units=units, cell_method=cell_method, & missing_value=missing_value, fill_value=fill_value, & imissing_value=imissing_value, ifill_value=ifill_value, & comment=comment, flag_meanings=flag_meanings, & flag_values=flag_values, nvalid_range=nvalid_range ) + if (present(varid)) then + varid = l_varid + end if + end subroutine ncd_defvar_bygrid !------------------------------------------------------------------------ From 8dbd8b5a47a1770358535448a7f4cb2b2a3f9eb0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 19 Apr 2021 00:34:19 -0600 Subject: [PATCH 1956/1973] Set upper_soil_layer with a function call at initialization so that it will work for different soil depths --- src/biogeochem/CNSharedParamsMod.F90 | 21 ++++++++++++++++++++- src/biogeophys/TemperatureType.F90 | 4 +++- src/main/clm_initializeMod.F90 | 2 ++ src/main/clm_instMod.F90 | 8 +++++++- src/main/initVerticalMod.F90 | 11 +---------- 5 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/biogeochem/CNSharedParamsMod.F90 b/src/biogeochem/CNSharedParamsMod.F90 index 8a4eafc99a..c7e05358a9 100644 --- a/src/biogeochem/CNSharedParamsMod.F90 +++ b/src/biogeochem/CNSharedParamsMod.F90 @@ -24,8 +24,20 @@ module CNSharedParamsMod type(CNParamsShareType), protected :: CNParamsShareInst + ! Public subroutines + public :: CNParamsReadShared + public :: CNParamsSetSoilDepth + public :: CNParamsReadShared_namelist + + ! Public data + logical, public :: use_fun = .false. ! Use the FUN2.0 model integer, public :: nlev_soildecomp_standard = 5 + integer, public :: upper_soil_layer = -1 ! Upper soil layer to use for 10-day average in CNPhenology + + ! Private subroutines and data + + private :: CNParamsReadShared_netcdf character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -36,7 +48,7 @@ module CNSharedParamsMod !----------------------------------------------------------------------- subroutine CNParamsReadShared(ncid, namelist_file) - use ncdio_pio , only : file_desc_t + use ncdio_pio , only : file_desc_t type(file_desc_t), intent(inout) :: ncid ! pio netCDF file id character(len=*), intent(in) :: namelist_file @@ -46,6 +58,13 @@ subroutine CNParamsReadShared(ncid, namelist_file) end subroutine CNParamsReadShared + !----------------------------------------------------------------------- + + subroutine CNParamsSetSoilDepth( ) + use initVerticalMod, only : find_soil_layer_containing_depth + ! Set the soil depth needed for CNPhenology + call find_soil_layer_containing_depth ( 0.12_r8, upper_soil_layer ) + end subroutine CNParamsSetSoilDepth !----------------------------------------------------------------------- subroutine CNParamsReadShared_netcdf(ncid) ! diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index 174db59818..a5210c219e 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -1329,6 +1329,7 @@ subroutine UpdateAccVars (this, bounds) use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ use clm_time_manager , only : get_step_size, get_nstep, is_end_curr_day, get_curr_date use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal + use CNSharedParamsMod, only : upper_soil_layer ! ! !ARGUMENTS: class(temperature_type) :: this @@ -1460,9 +1461,10 @@ subroutine UpdateAccVars (this, bounds) call update_accum_field ('T10', this%t_ref2m_patch, nstep) call extract_accum_field ('T10', this%t_a10_patch, nstep) + if ( upper_soil_layer /= 3 ) call endrun( "abort not 3" ) do p = begp,endp c = patch%column(p) - rbufslp(p) = this%t_soisno_col(c,3) + rbufslp(p) = this%t_soisno_col(c,upper_soil_layer) end do call update_accum_field ('SOIL10', rbufslp, nstep) call extract_accum_field ('SOIL10', this%soila10_patch, nstep) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index eef3168b38..196f09b3d4 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -153,6 +153,7 @@ subroutine initialize2(ni,nj) use controlMod , only : NLFilename use clm_instMod , only : clm_fates use BalanceCheckMod , only : BalanceCheckInit + use CNSharedParamsMod , only : CNParamsSetSoilDepth use NutrientCompetitionFactoryMod , only : create_nutrient_competition_method use FATESFireFactoryMod , only : scalar_lightning ! @@ -355,6 +356,7 @@ subroutine initialize2(ni,nj) ! Initialize instances of all derived types as well as time constant variables call clm_instInit(bounds_proc) + call CNParamsSetSoilDepth() ! Initialize SNICAR optical and aging parameters call SnowOptics_init( ) ! SNICAR optical parameters: call SnowAge_init( ) ! SNICAR aging parameters: diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index ae42966634..35f2851c0b 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -193,6 +193,7 @@ subroutine clm_instInit(bounds) use SoilBiogeochemCompetitionMod , only : SoilBiogeochemCompetitionInit use initVerticalMod , only : initVertical + use SnowHydrologyMod , only : InitSnowLayers use accumulMod , only : print_accum_fields use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve use decompMod , only : get_proc_bounds @@ -263,10 +264,15 @@ subroutine clm_instInit(bounds) call initVertical(bounds, & glc_behavior, & - snow_depth_col(begc:endc), & urbanparams_inst%thick_wall(begl:endl), & urbanparams_inst%thick_roof(begl:endl)) + !----------------------------------------------- + ! Set cold-start values for snow levels, snow layers and snow interfaces + !----------------------------------------------- + + call InitSnowLayers(bounds, snow_depth_col(bounds%begc:bounds%endc)) + ! Initialize clm->drv and drv->clm data structures call atm2lnd_inst%Init( bounds, NLFilename ) diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index 58bf29afce..f7a962579c 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -28,7 +28,6 @@ module initVerticalMod use GridcellType , only : grc use ColumnType , only : col use glcBehaviorMod , only : glc_behavior_type - use SnowHydrologyMod , only : InitSnowLayers use abortUtils , only : endrun use ncdio_pio ! @@ -54,13 +53,12 @@ module initVerticalMod contains !------------------------------------------------------------------------ - subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof) + subroutine initVertical(bounds, glc_behavior, thick_wall, thick_roof) use clm_varcon, only : zmin_bedrock ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds type(glc_behavior_type), intent(in) :: glc_behavior - real(r8) , intent(in) :: snow_depth(bounds%begc:) real(r8) , intent(in) :: thick_wall(bounds%begl:) real(r8) , intent(in) :: thick_roof(bounds%begl:) ! @@ -118,7 +116,6 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof begc = bounds%begc; endc= bounds%endc begl = bounds%begl; endl= bounds%endl - SHR_ASSERT_ALL_FL((ubound(snow_depth) == (/endc/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(thick_wall) == (/endl/)), sourcefile, __LINE__) SHR_ASSERT_ALL_FL((ubound(thick_roof) == (/endl/)), sourcefile, __LINE__) @@ -651,12 +648,6 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof end do end do - !----------------------------------------------- - ! Set cold-start values for snow levels, snow layers and snow interfaces - !----------------------------------------------- - - call InitSnowLayers(bounds, snow_depth(bounds%begc:bounds%endc)) - !----------------------------------------------- ! Read in topographic index and slope !----------------------------------------------- From 0164f445e744726c393a3ea60be9322411fcb7e6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 19 Apr 2021 01:29:02 -0600 Subject: [PATCH 1957/1973] Add some comments and formatting, also remove hard-coded check that the upper_soil_layer was exactly 3 as ERS_Ly5_P144x1.f10_f10_mg37.IHistClm51BgcCrop.cheyenne_intel.clm-cropMonthOutput passes and with identical answers to previously --- src/biogeochem/CNSharedParamsMod.F90 | 12 ++++--- src/biogeophys/TemperatureType.F90 | 6 ++-- src/biogeophys/WaterDiagnosticBulkType.F90 | 39 ++++++++++++---------- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/src/biogeochem/CNSharedParamsMod.F90 b/src/biogeochem/CNSharedParamsMod.F90 index c7e05358a9..f38a7debb5 100644 --- a/src/biogeochem/CNSharedParamsMod.F90 +++ b/src/biogeochem/CNSharedParamsMod.F90 @@ -2,6 +2,8 @@ module CNSharedParamsMod !----------------------------------------------------------------------- ! + ! Parameters that are shared by the Carbon Nitrogen Biogeochemistry modules + ! ! !USES: use shr_kind_mod , only: r8 => shr_kind_r8 implicit none @@ -25,9 +27,9 @@ module CNSharedParamsMod type(CNParamsShareType), protected :: CNParamsShareInst ! Public subroutines - public :: CNParamsReadShared - public :: CNParamsSetSoilDepth - public :: CNParamsReadShared_namelist + public :: CNParamsReadShared ! Read in CN shared parameters + public :: CNParamsSetSoilDepth ! Set the soil depth needed for CNPhenology + public :: CNParamsReadShared_namelist ! Read in CN shared namelist items ! Public data @@ -37,7 +39,7 @@ module CNSharedParamsMod ! Private subroutines and data - private :: CNParamsReadShared_netcdf + private :: CNParamsReadShared_netcdf ! Read shared parameters from NetCDF file character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -62,7 +64,7 @@ end subroutine CNParamsReadShared subroutine CNParamsSetSoilDepth( ) use initVerticalMod, only : find_soil_layer_containing_depth - ! Set the soil depth needed for CNPhenology + ! Set the soil depth needed for CNPhenology call find_soil_layer_containing_depth ( 0.12_r8, upper_soil_layer ) end subroutine CNParamsSetSoilDepth !----------------------------------------------------------------------- diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index a5210c219e..19738e3374 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -467,7 +467,7 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) this%soila10_patch(begp:endp) = spval call hist_addfld1d (fname='SOIL10', units='K', & - avgflag='A', long_name='10-day running mean of 3rd layer soil', & + avgflag='A', long_name='10-day running mean of 12cm layer soil', & ptr_patch=this%soila10_patch, default='inactive') this%t_a5min_patch(begp:endp) = spval @@ -1461,7 +1461,9 @@ subroutine UpdateAccVars (this, bounds) call update_accum_field ('T10', this%t_ref2m_patch, nstep) call extract_accum_field ('T10', this%t_a10_patch, nstep) - if ( upper_soil_layer /= 3 ) call endrun( "abort not 3" ) + ! Accumulate and extract SOIL10, for a sepcific soil layer + !(acumulates SOIL10 as 10-day running mean) + do p = begp,endp c = patch%column(p) rbufslp(p) = this%t_soisno_col(c,upper_soil_layer) diff --git a/src/biogeophys/WaterDiagnosticBulkType.F90 b/src/biogeophys/WaterDiagnosticBulkType.F90 index 589776b4f0..e0203deb74 100644 --- a/src/biogeophys/WaterDiagnosticBulkType.F90 +++ b/src/biogeophys/WaterDiagnosticBulkType.F90 @@ -38,7 +38,7 @@ module WaterDiagnosticBulkType real(r8), pointer :: h2osno_total_col (:) ! col total snow water (mm H2O) real(r8), pointer :: snow_depth_col (:) ! col snow height of snow covered area (m) - real(r8), pointer :: snow_5day_col (:) ! col snow height 5 day avg + real(r8), pointer :: snow_5day_col (:) ! col snow height 5 day avg (m) real(r8), pointer :: snowdp_col (:) ! col area-averaged snow height (m) real(r8), pointer :: snow_layer_unity_col (:,:) ! value 1 for each snow layer, used for history diagnostics real(r8), pointer :: bw_col (:,:) ! col partial density of water in the snow pack (ice + liquid) [kg/m3] @@ -79,17 +79,20 @@ module WaterDiagnosticBulkType contains - procedure, public :: InitBulk - procedure, public :: RestartBulk - procedure, public :: Summary - procedure, public :: ResetBulkFilter - procedure, public :: ResetBulk + ! Public interfaces + procedure, public :: InitBulk ! Initiatlization of bulk water diagnostics + procedure, public :: RestartBulk ! Restart bulk water diagnostics + procedure, public :: Summary ! Compute end of time-step summaries of terms + procedure, public :: ResetBulkFilter ! Reset the filter for bulk water + procedure, public :: ResetBulk ! Reset bulk water characteristics + procedure, public :: InitAccBuffer ! Initialize accumulation buffers + procedure, public :: InitAccVars ! Initialize accumulation variables + procedure, public :: UpdateAccVars ! Update accumulation variables + + ! Private subroutines procedure, private :: InitBulkAllocate procedure, private :: InitBulkHistory procedure, private :: InitBulkCold - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars procedure, private :: RestartBackcompatIssue783 end type waterdiagnosticbulk_type @@ -521,7 +524,8 @@ subroutine InitBulkHistory(this, bounds) end subroutine InitBulkHistory !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) + + subroutine InitAccBuffer (this, bounds) ! ! !DESCRIPTION: ! Initialize accumulation buffer for all required module accumulated fields @@ -542,11 +546,11 @@ subroutine InitAccBuffer (this, bounds) desc='5-day running mean of snowdepth', accum_type='runmean', accum_period=-5, & subgrid_type='column', numlev=1, init_value=0._r8) - end subroutine InitAccBuffer !----------------------------------------------------------------------- - subroutine InitAccVars (this, bounds) + + subroutine InitAccVars (this, bounds) ! !DESCRIPTION: ! Initialize module variables that are associated with ! time accumulated fields. This routine is called for both an initial run @@ -581,8 +585,11 @@ subroutine InitAccVars (this, bounds) end subroutine InitAccVars -!----------------------------------------------------------------------- + !----------------------------------------------------------------------- + subroutine UpdateAccVars (this, bounds) + ! + ! Update the accumulation variuables ! ! USES use clm_time_manager, only : get_nstep @@ -603,16 +610,12 @@ subroutine UpdateAccVars (this, bounds) ! Allocate needed dynamic memory for single level patch field - - ! Accumulate and extract snow 10 day + ! Accumulate and extract 5 day average of snow depth call update_accum_field ('SNOW_5D', this%snow_depth_col, nstep) call extract_accum_field ('SNOW_5D', this%snow_5day_col, nstep) - - end subroutine UpdateAccVars - !----------------------------------------------------------------------- subroutine InitBulkCold(this, bounds, & From 8ec39e826c1e9ea08eb739b763e2fb39ec2ef816 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 19 Apr 2021 15:21:40 -0600 Subject: [PATCH 1958/1973] Add reference to issue --- src/main/histFileMod.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 6a9100edfc..3587e920cb 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -5592,11 +5592,11 @@ subroutine add_landunit_mask_metadata(ncid, varid, l2g_scale_type) !----------------------------------------------------------------------- if (l2g_scale_type == 'unity') then - ! TODO(wjs, 2021-04-16) Once we consistently set l2g_scale_type for all variables, - ! and have stopped using other mechanisms (particularly the setting of variables to - ! spval everywhere) then we can stop setting this to 'unknown': we can instead set - ! this to something like 'all', with reasonable confidence that the field truly - ! applies over all landunits. + ! BUG(wjs, 2021-04-19, ESCOMP/CTSM#1347) Once we consistently set l2g_scale_type + ! for all variables, and have stopped using other mechanisms (particularly the + ! setting of variables to spval everywhere) then we can stop setting this to + ! 'unknown': we can instead set this to something like 'all', with reasonable + ! confidence that the field truly applies over all landunits. landunit_mask_string = 'unknown' else landunit_mask_string = l2g_scale_type From f78d4cf1332aebf5a4a430350999b3bb86d95cdc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 19 Apr 2021 16:02:38 -0600 Subject: [PATCH 1959/1973] Update change files --- doc/ChangeLog | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 117 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index f178eee325..8ab8b9e889 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,120 @@ =============================================================== +Tag name: ctsm5.1.dev034 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Mon Apr 19 16:02:29 MDT 2021 +One-line Summary: Bring in Arctic changes to LUNA from Leah Birch + +Purpose and description of changes +---------------------------------- + +This is @lmbirch89 branch from #947 with the exception that Kattge is used in place of +Leuning in LUNA. Also the startup initial values in the luna bug fix branch #961 is +used in place of the updated values by @lmbirch89. The LUNA bug fixes have already come +in, so these are some changes to improve arctic plants. + +We have addressed the issues in phenology and photosynthesis in the high latitudes. +Development was focused on PFT specific differences and we used observations to inform +model development. GPP is improved now such that the tundra is realistically less +productive than the boreal forest. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[x] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #807 -- Revisit PFT optical properties per Majasalmi and Bright (2019) + Fixes #1307 -- Turn on reseed_dead_plants when you start AD spinup mode + +Known bugs introduced in this tag (include issue #): + #1346 -- Use of floating point flag onset_thresh is confusing in CNPhenologyMod + +Notes of particular relevance for users +--------------------------------------- + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + New namelist items: onset_thresh_depends_on_veg and min_crtical_dayl_depends_on_lat + +Changes made to namelist defaults (e.g., changed parameter values): + reseed_dead_plants turned on when AD spinup mode turned on + onset_thresh_depends_on_veg and min_crtical_dayl_depends_on_lat turned on for clm5_1 physics + +Changes to the datasets (e.g., parameter, surface or initial files): + New parameter file (same as start used in PPE work) also has additional fields on it + +Notes of particular relevance for developers: +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Caveats for developers (e.g., code that is duplicated that requires double maintenance): + As noted in #1346 some of the logic in CNPhenology in CNSeasonDecidPhenology is a bit confusing. + The soil layer used was put in CNSharedParameters and needed it's own subroutine to prevent circular dependencies. + There are new accumulator variables added that area always turned on even when not needed. Doing this + in a reasonable manner (without having lots of CNPhenology logic spilled into base types) would require + a refactoring of a better way to figure this out. + +Testing summary: regular +---------------- + + [PASS means all tests PASS; OK means tests PASS other than expected fails.] + + build-namelist tests (if CLMBuildNamelist.pm has changed): + + cheyenne - PASS + + python testing (if python code has changed; see instructions in python/README.md; document testing done): + + cheyenne - PASS + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + +Answer changes +-------------- + +Changes answers relative to baseline: Yes for clm5_1 physics + + Summarize any changes to answers, i.e., + - what code configurations: clm5_1 + - what platforms/compilers: all + - nature of change: new climate + + If this tag changes climate describe the run(s) done to evaluate the new + climate (put details of the simulations in the experiment database) + oleson -- clm50_ctsm10d089_2deg_GSWP3V1_lmbirch_wkattge_jmaxb1-0.17_slatopA_1850AD + + URL for LMWG diagnostics output used to validate new climate: + http://webext.cgd.ucar.edu/I1850/clm50_ctsm10d089_2deg_GSWP3V1_lmbirch_wkattge_jmaxb1-0.17_slatopA_1850AD/ + + +Other details +------------- +Pull Requests that document the changes (include PR ids): #990 +(https://github.com/ESCOMP/ctsm/pull) + + #990 -- Arctic changes branch with Kattge in place of Leuning in LUNA + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev033 Originator(s): mvertens (Mariana Vertenstein), sacks (Bill Sacks) Date: Sat Apr 10 16:42:06 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 604005f609..08eef1df26 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev034 erik 04/19/2021 Bring in Arctic changes to LUNA from Leah Birch ctsm5.1.dev033 mvertens 04/10/2021 Remove unnecessary settings of nextsw_cday ctsm5.1.dev032 mvertens 04/10/2021 Fix bugs in co2 from atmosphere ctsm5.1.dev031 jedwards 04/10/2021 Update externals and fixes for nuopc threading From 2f685613a3bbf599e6104ffa998cf28aad66c880 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 19 Apr 2021 17:06:03 -0600 Subject: [PATCH 1960/1973] Two new unit tests PASS while checking the scale_by_thickness=.T. code Committing: - two new unit tests and the new scale_by_thickness=.true. version of the vertical interpolation - minor revisions from latest code review --- .../initInterpMultilevelInterp.F90 | 74 ++++++++++++----- .../test_init_interp_multilevel_interp.pf | 81 ++++++++++++++++++- src/main/accumulMod.F90 | 6 +- 3 files changed, 140 insertions(+), 21 deletions(-) diff --git a/src/init_interp/initInterpMultilevelInterp.F90 b/src/init_interp/initInterpMultilevelInterp.F90 index b78da69fce..f288743c56 100644 --- a/src/init_interp/initInterpMultilevelInterp.F90 +++ b/src/init_interp/initInterpMultilevelInterp.F90 @@ -327,6 +327,7 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest, scale_by_ integer :: lev_dest integer :: level_class_dest integer :: lev_source + real(r8) :: dzsoi_dest_sum ! Sum of the destination layer thickness (m) ! source information for this index_dest real(r8) :: my_level_classes_source(this%nlev_source) @@ -352,6 +353,7 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest, scale_by_ my_coordinates_source(:) = this%coordinates_source(:, index_dest) my_dzsoi_source(:) = this%dzsoi_source(:, index_dest) + dzsoi_dest_sum = 0._r8 do lev_dest = 1, this%nlev_dest level_class_dest = this%level_classes_dest(lev_dest, index_dest) if (level_class_dest /= ispval) then @@ -368,8 +370,10 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest, scale_by_ call pack_wrapper(data_source_in_class, data_source, source_levels_in_class) call pack_wrapper(coordinates_source_in_class, my_coordinates_source, source_levels_in_class) call pack_wrapper(dzsoi_source_in_class, my_dzsoi_source, source_levels_in_class) + dzsoi_dest_sum = dzsoi_dest_sum + this%dzsoi_dest(lev_dest, index_dest) call this%interp_onelevel( & data_dest = data_dest(lev_dest), & + dzsoi_dest_sum = dzsoi_dest_sum, & dzsoi_dest = this%dzsoi_dest(lev_dest, index_dest), & coordinate_dest = this%coordinates_dest(lev_dest, index_dest), & data_source = data_source_in_class, & @@ -494,7 +498,7 @@ subroutine confirm_monotonically_increasing(data) end subroutine confirm_monotonically_increasing !----------------------------------------------------------------------- - subroutine interp_onelevel(data_dest, dzsoi_dest, coordinate_dest, & + subroutine interp_onelevel(data_dest, dzsoi_dest_sum, dzsoi_dest, coordinate_dest, & data_source, dzsoi_source, coordinates_source, & scale_by_thickness) ! @@ -503,6 +507,7 @@ subroutine interp_onelevel(data_dest, dzsoi_dest, coordinate_dest, & ! ! !ARGUMENTS: real(r8), intent(inout) :: data_dest + real(r8), intent(in) :: dzsoi_dest_sum real(r8), intent(in) :: dzsoi_dest real(r8), intent(in) :: coordinate_dest real(r8), intent(in) :: data_source(:) @@ -516,8 +521,10 @@ subroutine interp_onelevel(data_dest, dzsoi_dest, coordinate_dest, & integer :: nlev_source integer :: lev integer :: index_lower - real(r8) :: wt_lower ! Weight factor to scale the interpolation - real(r8) :: wt_lower_plus_1 ! Weight factor to scale the interpolation + real(r8) :: overlap_dest_lower ! Overlap of the destination layer with one source layer + real(r8) :: overlap_dest_lower_plus_1 ! Overlap of the destination layer with the other source layer + real(r8) :: wt_lower ! Weight factor for interpolation of extensive properties + real(r8) :: wt_lower_plus_1 ! Weight factor for interpolation of extensive properties real(r8), parameter :: eps = 1.e-13_r8 character(len=*), parameter :: subname = 'interp_onelevel' @@ -580,39 +587,68 @@ subroutine interp_onelevel(data_dest, dzsoi_dest, coordinate_dest, & ! Assemble the weights for scaling certain variables by soil thicknesses if (scale_by_thickness) then - if (dzsoi_source(index_lower) == 0._r8) then - call endrun(msg=subname//' ERROR case 1: about to divide by 0 '// & - errMsg(sourcefile, __LINE__)) - else + if (copylevel) then ! not using wt_lower_plus_1 and overlap_dest* wt_lower = dzsoi_dest / dzsoi_source(index_lower) - end if - if (.not. copylevel) then - if (dzsoi_source(index_lower+1) == 0._r8) then - call endrun(msg=subname//' ERROR case 2: about to divide by 0 '// & + else + ! Set wt_lower and overlap_dest_lower + SHR_ASSERT_FL((dzsoi_source(index_lower) > 0._r8), sourcefile, __LINE__) + overlap_dest_lower = max(0._r8, sum(dzsoi_source(1:index_lower)) - & + (dzsoi_dest_sum - dzsoi_dest)) + wt_lower = overlap_dest_lower * dzsoi_dest / dzsoi_source(index_lower) + + ! Set wt_lower_plus_one and overlap_dest_lower_plus_1 + SHR_ASSERT_FL((dzsoi_source(index_lower+1) > 0._r8), sourcefile, __LINE__) + overlap_dest_lower_plus_1 = max(0._r8, & + dzsoi_dest_sum - sum(dzsoi_source(1:index_lower))) + wt_lower_plus_1 = overlap_dest_lower_plus_1 * dzsoi_dest / dzsoi_source(index_lower+1) + if (wt_lower <= 0._r8 .and. wt_lower_plus_1 <= 0._r8) then + write(iulog,*) 'Both wt_lower* are <= 0. This likely means that ' + write(iulog,*) 'both overlap_dest* are <= 0.' + call endrun(msg=subname//' ERROR: This will lead to a divide by 0 in the interpolation '// & errMsg(sourcefile, __LINE__)) - else - wt_lower_plus_1 = dzsoi_dest / dzsoi_source(index_lower+1) end if - else ! if (copylevel) then wt_lower_plus_1 set but not used - wt_lower_plus_1 = wt_lower end if - else ! no scaling; scale factors equal 1 + else ! no scaling but still using wt_lower if (copylevel) wt_lower = 1.0_r8 - wt_lower_plus_1 = wt_lower end if ! ------------------------------------------------------------------------ ! Do the interpolation + ! Case 1: copylevel + ! Direct mapping. If scale_by_thickness=.true., we scale by + ! wt_lower = dzsoi_dest / dzsoi_source + ! Case 2a: interpolate with scale_by_thickness=.true. + ! The analytical solution looks like this: + ! data_dest = (data_source(index_lower ) * wt_lower + & + ! data_source(index_lower+1) * wt_lower_plus_1 + & + ! ... + ! data_source(index_lower+n) * wt_lower_plus_n) / & + ! sum(overlap_dest) + ! for all source layers overlapping with the destination layer. Here + ! we approximate with the two nearest overlapping source layers. + ! Case 2b: interpolate with scale_by_thickness=.false. + ! We use this formula: + ! data_dest = (data_source(index_lower ) * distance_lower_plus_1 + & + ! data_source(index_lower+1) * distance_lower) / & + ! (distance_lower_plus_1 + distance_lower) + ! where we derive the distance variables from their respective + ! coordinates as an approximation of the more exact solution + ! derived from the corresponding overlaps between the destination + ! layer and each source layer. ! ------------------------------------------------------------------------ if ( copylevel) then data_dest = data_source(index_lower) * wt_lower + else if (scale_by_thickness) then + data_dest = (data_source(index_lower ) * wt_lower + & + data_source(index_lower+1) * wt_lower_plus_1) / & + (overlap_dest_lower + overlap_dest_lower_plus_1) else data_dest = & - data_source(index_lower+1) * wt_lower_plus_1 & + data_source(index_lower+1) & * (coordinate_dest - coordinates_source(index_lower)) & / (coordinates_source(index_lower+1) - coordinates_source(index_lower)) + & - data_source(index_lower) * wt_lower & + data_source(index_lower) & * (coordinates_source(index_lower+1) - coordinate_dest ) & / (coordinates_source(index_lower+1) - coordinates_source(index_lower)) end if diff --git a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf b/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf index ee28a41ce8..af0dd9a296 100644 --- a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf +++ b/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf @@ -116,7 +116,6 @@ contains @Test subroutine allWithinBounds_interpolates(this) - ! TODO Start from this test to develop new tests w scale_by_thickness=.true. ! If the destination has different levels, but all levels are within the bounds of ! the source, the destination data should simply be interpolated from the source data. ! @@ -147,6 +146,86 @@ contains end subroutine allWithinBounds_interpolates + @Test + subroutine allWithinBounds_scaledInterp(this) + ! Similar to subroutine allWithinBounds_interpolates but with + ! scale_by_thickness=.true. to scale the interpolation according to + ! soil layer thickness, dzsoi. + ! + ! In particular here we test: + ! 1st layer copying to 1st layer of same thickness dzsoi (no scaling) + ! 2nd layer copying to 2nd layer of half the thickness (scale * 0.5) + ! 2nd + 3rd layers interpolating to 3rd layer, where the scaling from the + ! thicknesses (dz) and the weighting from the overlapping depths both + ! contribute to the result. + ! + ! The "copying" scenarios untangle the effect of scaling by thickness + ! (scale_by_thickness=.true.) from that of weighting by overlap. + ! The interpolation scheme is explained in a schematic available here: + ! https://docs.google.com/presentation/d/1ka1QkXqZcekQqCmj5S1eMGaEgM-pxZy5jwvvnNoasj4/edit?usp=sharing + + class(TestInitInterpMultilevelInterp), intent(inout) :: this + type(interp_multilevel_interp_type) :: interpolator + real(r8) :: data_dest(3) = 0._r8 + real(r8) :: data_dest_expected(3) + real(r8), parameter :: data_source(3) = [1._r8, 1._r8, 1.5_r8] + real(r8), parameter :: coordinates_source(3) = [0.1_r8, 1.5_r8, 2.75_r8] + real(r8), parameter :: coordinates_dest(3) = [0.5_r8, 1.25_r8, 2.5_r8] + real(r8), parameter :: dzsoi_source(3) = [1._r8, 1._r8, 1.5_r8] + real(r8), parameter :: dzsoi_dest(3) = [1._r8, 0.5_r8, 2._r8] + + interpolator = create_interpolator_no_levclasses( & + coordinates_source = coordinates_source, & + coordinates_dest = coordinates_dest, & + dzsoi_source = dzsoi_source, & + dzsoi_dest = dzsoi_dest) + + call interpolator%interp_multilevel(data_dest, data_source, index_dest, scale_by_thickness=.true.) + + data_dest_expected = [1._r8, 0.5_r8, 2._r8] + + @assertEqual(data_dest_expected, data_dest, tolerance=tol) + + end subroutine allWithinBounds_scaledInterp + + @Test + subroutine greaterThanLastLevel_scaledInterp(this) + ! Similar to subroutine allWithinBounds_scaledInterp but with + ! last level destination depth greater than last level source depth as in + ! subroutine greaterThanLastLevel_copiesLastLevel. + ! + ! In particular here we test: + ! 1st layer copying to 1st layer of same thickness dzsoi (no scaling) + ! 2nd layer copying to 2nd layer of half the thickness (scale * 0.5) + ! 2nd layer copying to 3rd layer of double the thickness (scale * 2) + ! + ! The "copying" scenarios untangle the effect of scaling by thickness + ! (scale_by_thickness=.true.) from that of weighting by overlap. + + class(TestInitInterpMultilevelInterp), intent(inout) :: this + type(interp_multilevel_interp_type) :: interpolator + real(r8) :: data_dest(3) = 0._r8 + real(r8) :: data_dest_expected(3) + real(r8), parameter :: data_source(2) = [1._r8, 1._r8] + real(r8), parameter :: coordinates_source(2) = [0.8_r8, 1.5_r8] + real(r8), parameter :: coordinates_dest(3) = [0.5_r8, 1.25_r8, 2.5_r8] + real(r8), parameter :: dzsoi_source(2) = [1._r8, 1._r8] + real(r8), parameter :: dzsoi_dest(3) = [1._r8, 0.5_r8, 2._r8] + + interpolator = create_interpolator_no_levclasses( & + coordinates_source = coordinates_source, & + coordinates_dest = coordinates_dest, & + dzsoi_source = dzsoi_source, & + dzsoi_dest = dzsoi_dest) + + call interpolator%interp_multilevel(data_dest, data_source, index_dest, scale_by_thickness=.true.) + + data_dest_expected = [1._r8, 0.5_r8, 2._r8] + + @assertEqual(data_dest_expected, data_dest, tolerance=tol) + + end subroutine greaterThanLastLevel_scaledInterp + @Test subroutine greaterThanLastLevel_copiesLastLevel(this) ! If the destination level is greater than the last source level, it should copy data diff --git a/src/main/accumulMod.F90 b/src/main/accumulMod.F90 index 3a7e4ba25a..3baba13814 100644 --- a/src/main/accumulMod.F90 +++ b/src/main/accumulMod.F90 @@ -267,7 +267,7 @@ subroutine init_accum_field (name, units, desc, & if (present(scale_by_thickness)) then accum(nf)%scale_by_thickness = scale_by_thickness else - accum(nf)%scale_by_thickness = ' ' + accum(nf)%scale_by_thickness = .false. end if ! Allocate and initialize accumulation field @@ -731,6 +731,10 @@ subroutine accumulRest( ncid, flag ) interpinic_flag='interp', & data=accum(nf)%nsteps, readvar=readvar) else + ! Counterintuitive to scale NSTEPS by thickness and + ! counterintuitive to do vertical interpolation at all on NSTEPS. + ! NSTEPS will probably always be the same for all levels, so the + ! vertical interpolation will be trivial. Leaving this code as is. call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_int, & dim1name=accum(nf)%type1d, dim2name=accum(nf)%type2d, & long_name='number of accumulated steps for '//trim(accum(nf)%name), & From a5b2e16a4f93d980695557ece55cacf346e302f6 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Tue, 20 Apr 2021 11:10:57 -0600 Subject: [PATCH 1961/1973] Update ChangeLog --- doc/ChangeLog | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 106 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8ab8b9e889..62f7b7e16e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,109 @@ =============================================================== +Tag name: ctsm5.1.dev035 +Originator(s): sacks (Bill Sacks) +Date: Tue Apr 20 10:45:25 MDT 2021 +One-line Summary: Misc bfb enhancements and fixes + +Purpose and description of changes +---------------------------------- + +(1) If CISM is running over Antarctica, use virtual glacier columns over + Antarctica + +(2) Remove "mec" from some glacier/ice variable names (it is misleading + to have "mec" in variable names when the ice landunit can actually + have multiple columns *or* a single column) (ESCOMP/CTSM#1294) + +(3) Add history file metadata on each variable's l2g_scale_type (adds a + landunit_mask attribute) (ESCOMP/CTSM#1343) + +(4) Use python3 in more shebang lines - needed to run python unit tests + on cheyenne + +(5) New compset naming for IG compsets (ESCOMP/CTSM#1289) + +(6) Remove calculation of fun_cost_fix that is overwritten + (ESCOMP/CTSM#1115) + +(7) Bypass grid-level water mass check when fates hydro is active + (ESCOMP/CTSM#1334) + +(8) Remove some dead code (ESCOMP/CTSM#1333) + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Issues fixed (include CTSM Issue #): +- Resolves ESCOMP/CTSM#1115 (overwrite fun_cost_fix) +- Resolves ESCOMP/CTSM#1289 (After updating to cism2_1_76 or later, + change compsets involving CISM) +- Resolves ESCOMP/CTSM#1294 (Replace istice_mec with istice) +- Resolves ESCOMP/CTSM#1333 (Remove some dead code) +- Resolves ESCOMP/CTSM#1343 (Add landunit_mask (formerly l2g_scale_type) + metadata to history file) + +Notes of particular relevance for users +--------------------------------------- +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- Renamed maxpatch_glcmec to maxpatch_glc + +Substantial timing or memory changes: +- Increase in land initialization time in the PFS test + (PFS_Ld20.f09_g17.I2000Clm50BgcCrop.cheyenne_intel); this is probably + due to machine variability because I don't think any of the changes in + this tag would have any significant impact on model initialization + time. + + +Testing summary: +---------------- + + build-namelist tests (if CLMBuildNamelist.pm has changed): + + cheyenne - ok (tests pass, namelists differ as expected) + + python testing (if python code has changed; see instructions in python/README.md; document testing done): + + (any machine) - pass (ran 'make test' on cheyenne and 'make all' on my Mac) + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- ok + izumi ------- ok + +Answer changes +-------------- + +Changes answers relative to baseline: NO + +Other details +------------- + +Pull Requests that document the changes (include PR ids): +- One small piece is documented in https://github.com/ESCOMP/CTSM/pull/1334 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev034 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Mon Apr 19 16:02:29 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 08eef1df26..1816a557a9 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev035 sacks 04/20/2021 Misc bfb enhancements and fixes ctsm5.1.dev034 erik 04/19/2021 Bring in Arctic changes to LUNA from Leah Birch ctsm5.1.dev033 mvertens 04/10/2021 Remove unnecessary settings of nextsw_cday ctsm5.1.dev032 mvertens 04/10/2021 Fix bugs in co2 from atmosphere From 64c06ff5fd845c7769ec7adee41895cd05fa902b Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Wed, 21 Apr 2021 09:48:49 -0700 Subject: [PATCH 1962/1973] updating fates tag in Externals_CLM.cfg and adding ChangeLog entry --- Externals_CLM.cfg | 2 +- doc/ChangeLog | 98 ++++++++++++++++++++++++++++++++++++++++++++++- doc/ChangeSum | 1 + 3 files changed, 99 insertions(+), 2 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 6412efffe5..d90c5e381e 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.43.2_api.14.2.0 +tag = sci.1.45.0_api.15.0.0 required = True [PTCLM] diff --git a/doc/ChangeLog b/doc/ChangeLog index 62f7b7e16e..fe8312f620 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,100 @@ =============================================================== +Tag name: ctsm5.1.dev036 +Originator(s): glemieux (Gregory Lemieux,LBL/NGEET,510-486-5049) +Date: Wed 21 Apr 2021 08:44:38 AM PDT +One-line Summary: FATES tag update and snow occlusion of LAI fix + +Purpose and description of changes +---------------------------------- + +This tag updates the way in which fates is called during restarts to appropriately +handle the fates-side snow occlusion code. Additionally, this update points to the +most recent fates tag, which includes a number of fates science updates (including +the snow occlusion fix) and fates-side bug fixes (see below for list of issues +addressed). + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + #1293 -- Update FATES on CTSM main-dev + NGEET/fates#359 -- ground snow is not occluding lai profile + NGEET/fates#709 -- Error Check issue in EDPatchDynamicsMod.F90: spawn_patches() causes problem with logging module + NGEET/fates#725 -- declaration of the prt pointer + NGEET/fates#713 -- Changes associated with patch fraction burnt + NGEET/fates#473 -- Update FIRE_AREA long name units + NGEET/fates#575 -- Clean up NaN and zeroing of fire variables in Patch and Cohort Dynamics + +Known bugs found since the previous tag (include issue #): + #1338 -- Floating point exception in fates gnu compiler regression test with ctsm5.1.dev027 + +Testing summary: regular +---------------- + + [PASS means all tests PASS; OK means tests PASS other than expected fails.] + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- ok + izumi ------- ok + + ok: All non-fates testmods PASS b4b. Fates testmods have DIFF as expected due to update of fates science tag. + + fates tests: + cheyenne ---- ok + + ok: NLCOMP failures due to clm50_param file update relative to ctsm tag used on the last fates baseline. + + fates baseline: fates-sci.1.44.1_api.14.2.0-ctsm5.1.dev033-C30ca1849-F6065b9a2 + +Answer changes +-------------- + +Changes answers relative to baseline: Yes, only for fates + + Summarize any changes to answers, i.e., + - what code configurations: all fates + - what platforms/compilers: all + - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff + + If bitwise differences were observed, how did you show they were no worse + than roundoff? + - fates-side review of expected differences for all PRs that changed answers (2 science updates + and 2 bug fixes) + + +Other details +------------- + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): + + fates: sci.1.43.2_api.14.2.0 -> sci.1.45.0_api.15.0.0 + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull) + + - https://github.com/ESCOMP/CTSM/pull/1324 + - https://github.com/NGEET/fates/pull/734 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev035 Originator(s): sacks (Bill Sacks) Date: Tue Apr 20 10:45:25 MDT 2021 @@ -1220,7 +1316,7 @@ Pull Requests that document the changes (include PR ids): =============================================================== =============================================================== Tag name: ctsm5.1.dev022 -Originator(s): gregorylemieux (Gregory Lemieux,LBL/NGEET,510-486-5049) +Originator(s): glemieux (Gregory Lemieux,LBL/NGEET,510-486-5049) Date: Fri Feb 5 00:03:28 MST 2021 One-line Summary: Merge fates_main_api into ctsm master diff --git a/doc/ChangeSum b/doc/ChangeSum index 1816a557a9..600c016c65 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev036 glemieux 04/21/2021 FATES tag update and snow occlusion of LAI fix ctsm5.1.dev035 sacks 04/20/2021 Misc bfb enhancements and fixes ctsm5.1.dev034 erik 04/19/2021 Bring in Arctic changes to LUNA from Leah Birch ctsm5.1.dev033 mvertens 04/10/2021 Remove unnecessary settings of nextsw_cday From da2df93adaa5fe79f900e76952dfbc37c239b47e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 21 Apr 2021 14:51:14 -0600 Subject: [PATCH 1963/1973] Update change log file --- doc/ChangeLog | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index fe8312f620..bb998353b0 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev036 Originator(s): glemieux (Gregory Lemieux,LBL/NGEET,510-486-5049) -Date: Wed 21 Apr 2021 08:44:38 AM PDT +Date: Wed Apr 21 14:50:19 MDT 2021 One-line Summary: FATES tag update and snow occlusion of LAI fix Purpose and description of changes @@ -50,6 +50,14 @@ Testing summary: regular [PASS means all tests PASS; OK means tests PASS other than expected fails.] + build-namelist tests (if CLMBuildNamelist.pm has changed): + + cheyenne - PASS + + python testing (if python code has changed; see instructions in python/README.md; document testing done): + + cheyenne - PASS + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): cheyenne ---- ok From 28ef11ced9653adedea3ee83497651ecf25945f5 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 21 Apr 2021 16:38:55 -0600 Subject: [PATCH 1964/1973] Revert to the old interpolation & new scaling combo, i.e. commit 42b0833 Keeping other mods that I committed since then --- .../initInterpMultilevelInterp.F90 | 79 ++++++------------- .../test_init_interp_multilevel_interp.pf | 12 +-- 2 files changed, 25 insertions(+), 66 deletions(-) diff --git a/src/init_interp/initInterpMultilevelInterp.F90 b/src/init_interp/initInterpMultilevelInterp.F90 index f288743c56..230e1b3474 100644 --- a/src/init_interp/initInterpMultilevelInterp.F90 +++ b/src/init_interp/initInterpMultilevelInterp.F90 @@ -327,7 +327,6 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest, scale_by_ integer :: lev_dest integer :: level_class_dest integer :: lev_source - real(r8) :: dzsoi_dest_sum ! Sum of the destination layer thickness (m) ! source information for this index_dest real(r8) :: my_level_classes_source(this%nlev_source) @@ -353,7 +352,6 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest, scale_by_ my_coordinates_source(:) = this%coordinates_source(:, index_dest) my_dzsoi_source(:) = this%dzsoi_source(:, index_dest) - dzsoi_dest_sum = 0._r8 do lev_dest = 1, this%nlev_dest level_class_dest = this%level_classes_dest(lev_dest, index_dest) if (level_class_dest /= ispval) then @@ -370,10 +368,8 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest, scale_by_ call pack_wrapper(data_source_in_class, data_source, source_levels_in_class) call pack_wrapper(coordinates_source_in_class, my_coordinates_source, source_levels_in_class) call pack_wrapper(dzsoi_source_in_class, my_dzsoi_source, source_levels_in_class) - dzsoi_dest_sum = dzsoi_dest_sum + this%dzsoi_dest(lev_dest, index_dest) call this%interp_onelevel( & data_dest = data_dest(lev_dest), & - dzsoi_dest_sum = dzsoi_dest_sum, & dzsoi_dest = this%dzsoi_dest(lev_dest, index_dest), & coordinate_dest = this%coordinates_dest(lev_dest, index_dest), & data_source = data_source_in_class, & @@ -498,7 +494,7 @@ subroutine confirm_monotonically_increasing(data) end subroutine confirm_monotonically_increasing !----------------------------------------------------------------------- - subroutine interp_onelevel(data_dest, dzsoi_dest_sum, dzsoi_dest, coordinate_dest, & + subroutine interp_onelevel(data_dest, dzsoi_dest, coordinate_dest, & data_source, dzsoi_source, coordinates_source, & scale_by_thickness) ! @@ -507,7 +503,6 @@ subroutine interp_onelevel(data_dest, dzsoi_dest_sum, dzsoi_dest, coordinate_des ! ! !ARGUMENTS: real(r8), intent(inout) :: data_dest - real(r8), intent(in) :: dzsoi_dest_sum real(r8), intent(in) :: dzsoi_dest real(r8), intent(in) :: coordinate_dest real(r8), intent(in) :: data_source(:) @@ -521,8 +516,6 @@ subroutine interp_onelevel(data_dest, dzsoi_dest_sum, dzsoi_dest, coordinate_des integer :: nlev_source integer :: lev integer :: index_lower - real(r8) :: overlap_dest_lower ! Overlap of the destination layer with one source layer - real(r8) :: overlap_dest_lower_plus_1 ! Overlap of the destination layer with the other source layer real(r8) :: wt_lower ! Weight factor for interpolation of extensive properties real(r8) :: wt_lower_plus_1 ! Weight factor for interpolation of extensive properties @@ -585,70 +578,46 @@ subroutine interp_onelevel(data_dest, dzsoi_dest_sum, dzsoi_dest, coordinate_des errMsg(sourcefile, __LINE__)) end if - ! Assemble the weights for scaling certain variables by soil thicknesses + ! Assemble the weights for scaling certain variables by soil thicknesses. + ! Such variables represent so-called "extensive" properties and have units + ! such as kg/m2 or mm or mm/s. The weights by which we scale these variables + ! are unit converters in reality. The denominators dzsoi_source(index_lower) + ! and dzsoi_source(index_lower+1) convert data_source from a surface density + ! to a volume density. The numerator dzsoi_dest converts data_dest back to + ! a surface density. if (scale_by_thickness) then - if (copylevel) then ! not using wt_lower_plus_1 and overlap_dest* - wt_lower = dzsoi_dest / dzsoi_source(index_lower) - else - ! Set wt_lower and overlap_dest_lower - SHR_ASSERT_FL((dzsoi_source(index_lower) > 0._r8), sourcefile, __LINE__) - overlap_dest_lower = max(0._r8, sum(dzsoi_source(1:index_lower)) - & - (dzsoi_dest_sum - dzsoi_dest)) - wt_lower = overlap_dest_lower * dzsoi_dest / dzsoi_source(index_lower) - - ! Set wt_lower_plus_one and overlap_dest_lower_plus_1 - SHR_ASSERT_FL((dzsoi_source(index_lower+1) > 0._r8), sourcefile, __LINE__) - overlap_dest_lower_plus_1 = max(0._r8, & - dzsoi_dest_sum - sum(dzsoi_source(1:index_lower))) - wt_lower_plus_1 = overlap_dest_lower_plus_1 * dzsoi_dest / dzsoi_source(index_lower+1) - if (wt_lower <= 0._r8 .and. wt_lower_plus_1 <= 0._r8) then - write(iulog,*) 'Both wt_lower* are <= 0. This likely means that ' - write(iulog,*) 'both overlap_dest* are <= 0.' - call endrun(msg=subname//' ERROR: This will lead to a divide by 0 in the interpolation '// & + ! Set wt_lower + if (dzsoi_source(index_lower) <= 0._r8) then + call endrun(msg=subname//' ERROR1: about to divide by zero or negative dzsoi '// & + errMsg(sourcefile, __LINE__)) + end if + wt_lower = dzsoi_dest / dzsoi_source(index_lower) + + ! Set wt_lower_plus_1 only if (.not. copylevel) + if (.not. copylevel) then ! not using wt_lower_plus_1 + if (dzsoi_source(index_lower+1) <= 0._r8) then + call endrun(msg=subname//' ERROR2: about to divide by zero or negative dzsoi '// & errMsg(sourcefile, __LINE__)) end if + wt_lower_plus_1 = dzsoi_dest / dzsoi_source(index_lower+1) end if - else ! no scaling but still using wt_lower if (copylevel) + else ! the no scaling option for both copylevel and .not. copylevel wt_lower = 1.0_r8 + wt_lower_plus_1 = 1.0_r8 end if ! ------------------------------------------------------------------------ ! Do the interpolation - ! Case 1: copylevel - ! Direct mapping. If scale_by_thickness=.true., we scale by - ! wt_lower = dzsoi_dest / dzsoi_source - ! Case 2a: interpolate with scale_by_thickness=.true. - ! The analytical solution looks like this: - ! data_dest = (data_source(index_lower ) * wt_lower + & - ! data_source(index_lower+1) * wt_lower_plus_1 + & - ! ... - ! data_source(index_lower+n) * wt_lower_plus_n) / & - ! sum(overlap_dest) - ! for all source layers overlapping with the destination layer. Here - ! we approximate with the two nearest overlapping source layers. - ! Case 2b: interpolate with scale_by_thickness=.false. - ! We use this formula: - ! data_dest = (data_source(index_lower ) * distance_lower_plus_1 + & - ! data_source(index_lower+1) * distance_lower) / & - ! (distance_lower_plus_1 + distance_lower) - ! where we derive the distance variables from their respective - ! coordinates as an approximation of the more exact solution - ! derived from the corresponding overlaps between the destination - ! layer and each source layer. ! ------------------------------------------------------------------------ if ( copylevel) then data_dest = data_source(index_lower) * wt_lower - else if (scale_by_thickness) then - data_dest = (data_source(index_lower ) * wt_lower + & - data_source(index_lower+1) * wt_lower_plus_1) / & - (overlap_dest_lower + overlap_dest_lower_plus_1) else data_dest = & - data_source(index_lower+1) & + data_source(index_lower+1) * wt_lower_plus_1 & * (coordinate_dest - coordinates_source(index_lower)) & / (coordinates_source(index_lower+1) - coordinates_source(index_lower)) + & - data_source(index_lower) & + data_source(index_lower) * wt_lower & * (coordinates_source(index_lower+1) - coordinate_dest ) & / (coordinates_source(index_lower+1) - coordinates_source(index_lower)) end if diff --git a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf b/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf index af0dd9a296..cf5a2279a8 100644 --- a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf +++ b/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf @@ -155,14 +155,7 @@ contains ! In particular here we test: ! 1st layer copying to 1st layer of same thickness dzsoi (no scaling) ! 2nd layer copying to 2nd layer of half the thickness (scale * 0.5) - ! 2nd + 3rd layers interpolating to 3rd layer, where the scaling from the - ! thicknesses (dz) and the weighting from the overlapping depths both - ! contribute to the result. - ! - ! The "copying" scenarios untangle the effect of scaling by thickness - ! (scale_by_thickness=.true.) from that of weighting by overlap. - ! The interpolation scheme is explained in a schematic available here: - ! https://docs.google.com/presentation/d/1ka1QkXqZcekQqCmj5S1eMGaEgM-pxZy5jwvvnNoasj4/edit?usp=sharing + ! 2nd + 3rd layers interpolating to 3rd layer class(TestInitInterpMultilevelInterp), intent(inout) :: this type(interp_multilevel_interp_type) :: interpolator @@ -198,9 +191,6 @@ contains ! 1st layer copying to 1st layer of same thickness dzsoi (no scaling) ! 2nd layer copying to 2nd layer of half the thickness (scale * 0.5) ! 2nd layer copying to 3rd layer of double the thickness (scale * 2) - ! - ! The "copying" scenarios untangle the effect of scaling by thickness - ! (scale_by_thickness=.true.) from that of weighting by overlap. class(TestInitInterpMultilevelInterp), intent(inout) :: this type(interp_multilevel_interp_type) :: interpolator From 9644d996f574c9a3ce62b5be18e8c5d82d04bf72 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 22 Apr 2021 13:39:51 -0600 Subject: [PATCH 1965/1973] Syntax correction caught by a test in cheyenne's test-suite --- src/init_interp/initInterpMultilevelCopy.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init_interp/initInterpMultilevelCopy.F90 b/src/init_interp/initInterpMultilevelCopy.F90 index ee5c991095..706ee143eb 100644 --- a/src/init_interp/initInterpMultilevelCopy.F90 +++ b/src/init_interp/initInterpMultilevelCopy.F90 @@ -107,7 +107,7 @@ subroutine interp_multilevel(this, data_dest, data_source, index_dest, & !----------------------------------------------------------------------- SHR_ASSERT_FL((size(data_source) == size(data_dest)), sourcefile, __LINE__) - SHR_ASSERT_FL((scale_by_thickness == .false.), sourcefile, __LINE__) + SHR_ASSERT_FL((.not. scale_by_thickness), sourcefile, __LINE__) ! Note that it's safe to do whole-array assignment here because we never decompose ! along the level dimension (in contrast to the spatial dimension, where you need to From 703d536941f9cec999eebcc1e2e5b4cd5094a938 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 22 Apr 2021 19:08:39 -0600 Subject: [PATCH 1966/1973] Add code to handle diff number of layers when DZSOI is not on finidat Tests recommended by @billsacks SMS_Ld1.nldas2_rnldas2_mnldas2.I2000Ctsm50NwpSpNldasRs.cheyenne_gnu.clm-default ERS_D_Ld3.f10_f10_mg37.I2000Clm50BgcCru.cheyenne_intel.clm-deepsoil_bedrock with scale_by_thickness=.false. PASS bfb against baseline dev036 --- .../initInterpMultilevelContainer.F90 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/init_interp/initInterpMultilevelContainer.F90 b/src/init_interp/initInterpMultilevelContainer.F90 index 9c2847b8cd..790255051d 100644 --- a/src/init_interp/initInterpMultilevelContainer.F90 +++ b/src/init_interp/initInterpMultilevelContainer.F90 @@ -533,6 +533,7 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & ! thickness. Scaling by thickness is necessary only if the run uses a ! different vertical profile than the one found in the finidata file. call check_var(ncid_source, dzsoi_varname, on_source) + allocate(dzsoi_data_source(beg_dest:end_dest, nlev_source)) if (on_source) then ! Set dzsoi_data_source dzs_source = interp_2dvar_type( & @@ -546,7 +547,6 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & line = __LINE__) SHR_ASSERT_FL(dzs_source%get_vec_beg() == beg_source, sourcefile, __LINE__) SHR_ASSERT_FL(dzs_source%get_vec_end() == end_source, sourcefile, __LINE__) - allocate(dzsoi_data_source(beg_dest:end_dest, nlev_source)) allocate(dzsoi_data_source_sgrid_1d(beg_source:end_source)) do level = 1, nlev_source ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble @@ -576,14 +576,24 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & ! source and dest soil profiles differ despite having the same number of ! layers. The model will handle such cases without scaling ! the finidat variables that need scaling by soil layer thickness. - allocate(dzsoi_data_source(beg_dest:end_dest, nlev_source)) do level = 1, nlev_source do g = beg_dest, end_dest dzsoi_data_source(g,level) = dzsoi_data_dest(g,level) end do end do - else ! fail with helpful error message - call interp_levgrnd_check_source_file(ncid_source, dzsoi_varname) + else ! different number of layers and .not. on_source + ! Rather than failing when DZSOI is not present on the finidat file, + ! construct dzsoi_data_source from coord_data_source + do g = beg_dest, end_dest + dzsoi_data_source(g,1) = 2._r8 * coord_data_source(g,1) + if (nlev_source > 1) then + do level = 2, nlev_source + dzsoi_data_source(g,level) = 2._r8 * & + (coord_data_source(g,level) - & + sum(dzsoi_data_source(g,1:level-1))) + end do + end if + end do end if ! NOTE(wjs, 2015-10-18) The following check is helpful while we still have old initial From 62670a92c094e49d00c9e45c420cc6a676869af4 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 22 Apr 2021 20:09:48 -0600 Subject: [PATCH 1967/1973] Add comment about modifications for Backwards Compatibility --- src/init_interp/initInterpMultilevelContainer.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/init_interp/initInterpMultilevelContainer.F90 b/src/init_interp/initInterpMultilevelContainer.F90 index 790255051d..5a7b14832a 100644 --- a/src/init_interp/initInterpMultilevelContainer.F90 +++ b/src/init_interp/initInterpMultilevelContainer.F90 @@ -564,6 +564,7 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & end do deallocate(dzsoi_data_source_sgrid_1d) else if (levmaxurbgrnd_source == levmaxurbgrnd_dest) then + ! BACKWARDS_COMPATIBILITY (slevis, 2021-04-22) ! When same number of layers and .not. on_source, we skip the calls to ! (a) interp_levgrnd_check_source_file(ncid_source, dzsoi_varname) ! (b) dzs_source%readlevel_double(dzsoi_data_source... @@ -582,6 +583,7 @@ subroutine get_levmaxurbgrnd_metadata(ncid_source, ncid_dest, & end do end do else ! different number of layers and .not. on_source + ! BACKWARDS_COMPATIBILITY (slevis, 2021-04-22) ! Rather than failing when DZSOI is not present on the finidat file, ! construct dzsoi_data_source from coord_data_source do g = beg_dest, end_dest From 090ebff2c9d51c80fc010724d99805fb64ee2c42 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 23 Apr 2021 10:32:39 -0600 Subject: [PATCH 1968/1973] New ChangeLog and ChangeSum --- doc/ChangeLog | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 107 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index bb998353b0..8938a19a93 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,110 @@ =============================================================== +Tag name: ctsm5.1.dev037 +Originator(s): slevis (Samuel Levis,SLevis Consulting,303-665-1310) +Date: Fri Apr 23 10:06:32 MDT 2021 +One-line Summary: Correct vertical interpolation in init_interp when soil thicknesses change + +Purpose and description of changes +---------------------------------- + + To correct how init_interp handles soil variables with units of kg/m2 or mm + or mm/s (generally speaking so-called extensive properties), we now add DZSOI + and a scale_by_thickness flag to restart files. In init_interp we use these to + scale the vertical interpolation by soil layer thickness. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[X] clm5_1 + +[X] clm5_0 + +[X] ctsm5_0-nwp + +[X] clm4_5 + + +Bugs fixed or introduced +------------------------ +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Issues fixed (include CTSM Issue #): #1298 + +Notes of particular relevance for users +--------------------------------------- +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Caveats for users (e.g., need to interpolate initial conditions): + For H2OSOI_LIQ, H2OSOI_ICE, SMP, and HK, from now on init_interp interpolates + from the soil profile in finidat to the soil profile in the model run by + scaling these variables by dzsoi (layer thickness). This makes the vertical + interpolation of these variables more accurate. Users need not do anything. + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + +Changes to the datasets (e.g., parameter, surface or initial files): + From now on newly generated finidat files will contain the scale_by_thickness + flag and DZSOI for use by the new code. For backwards compatibility, the code + handles preexisting finidat files by deriving dzsoi from the node depths for + the four variables listed above. + +Notes of particular relevance for developers: +--------------------------------------------- +NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +Changes to tests or testing: + Added two unit tests to confirm that the modified vertical interpolation + behaves as expected. + + +Testing summary: +---------------- +[Remove any lines that don't apply.] + + [PASS means all tests PASS; OK means tests PASS other than expected fails.] + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + + any other testing (give details below): + Unit tests PASS + +Answer changes +-------------- + +Changes answers relative to baseline: + + [ If a tag changes answers relative to baseline comparison the + following should be filled in (otherwise remove this section). + And always remove these three lines and parts that don't apply. ] + + Summarize any changes to answers, i.e., + - what code configurations: ALL + - what platforms/compilers: ALL + - nature of change: larger than roundoff/same climate + + scale_by_thickness=.true. for the four variables that require it (listed + above). This causes answers to change for all tests in the test suite that + interpolate from the soil profile found in finidat to the one used by the + model. + +Other details +------------- + +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/CTSM/pull/1301 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev036 Originator(s): glemieux (Gregory Lemieux,LBL/NGEET,510-486-5049) Date: Wed Apr 21 14:50:19 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 600c016c65..ac994d26ae 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev037 slevis 04/23/2021 Correct vertical interpolation in init_interp when soil thicknesses change ctsm5.1.dev036 glemieux 04/21/2021 FATES tag update and snow occlusion of LAI fix ctsm5.1.dev035 sacks 04/20/2021 Misc bfb enhancements and fixes ctsm5.1.dev034 erik 04/19/2021 Bring in Arctic changes to LUNA from Leah Birch From 373897b00c5d2d8a93cb1cdff0de772d3d31e472 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 23 Apr 2021 10:37:49 -0600 Subject: [PATCH 1969/1973] Minor edits in ChangeLog --- doc/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8938a19a93..f5064651e2 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -42,7 +42,7 @@ Notes of particular relevance for users Caveats for users (e.g., need to interpolate initial conditions): For H2OSOI_LIQ, H2OSOI_ICE, SMP, and HK, from now on init_interp interpolates - from the soil profile in finidat to the soil profile in the model run by + from the soil profile in finidat to the soil profile in the model by scaling these variables by dzsoi (layer thickness). This makes the vertical interpolation of these variables more accurate. Users need not do anything. @@ -81,7 +81,7 @@ Testing summary: Answer changes -------------- -Changes answers relative to baseline: +Changes answers relative to baseline: Yes [ If a tag changes answers relative to baseline comparison the following should be filled in (otherwise remove this section). From 7ebe388f5d272502858a714722d97649d1d02fb3 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 23 Apr 2021 10:43:06 -0600 Subject: [PATCH 1970/1973] Minor edit to ChangeLog --- doc/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index f5064651e2..83d09ad5c3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -94,8 +94,8 @@ Changes answers relative to baseline: Yes scale_by_thickness=.true. for the four variables that require it (listed above). This causes answers to change for all tests in the test suite that - interpolate from the soil profile found in finidat to the one used by the - model. + interpolate from the soil profile found in finidat to a differing soil profile + used by the model. Other details ------------- From 8399b4de6fc2c969767dce10148a087c63a7d266 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Apr 2021 22:54:32 -0600 Subject: [PATCH 1971/1973] Make sure module load of intel is done --- tools/mkmapdata/mkmapdata.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index 5ff37cb307..5a50ab90ff 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -354,6 +354,7 @@ case $hostname in esmfvers=8.0.0 intelvers=19.0.5 module purge + module load intel/$intelvers module load esmf_libs module load esmf_libs/$esmfvers module load ncl From b27564ef846f03898c89036c9a1eb1cb7605ff37 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 27 Apr 2021 13:12:33 -0600 Subject: [PATCH 1972/1973] Correct spelling of Successfully which is important so that test won't be declared as failing --- tools/mkmapdata/mkmapdata.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh index 5a50ab90ff..747676cac7 100755 --- a/tools/mkmapdata/mkmapdata.sh +++ b/tools/mkmapdata/mkmapdata.sh @@ -562,6 +562,6 @@ until ((nfile>${#INGRID[*]})); do nfile=nfile+1 done -echo "Successffully created needed mapping files for $res" +echo "Successfully created needed mapping files for $res" exit 0 From 15010462d7f1e2bd8183074a28ae3d429774ce2e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 27 Apr 2021 23:51:13 -0600 Subject: [PATCH 1973/1973] Update change files --- doc/ChangeLog | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 78 +++++++++++++++++------------------ 2 files changed, 150 insertions(+), 39 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 83d09ad5c3..fbdd413d1e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,115 @@ =============================================================== +Tag name: ctsm5.1.dev038 +Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) +Date: Tue Apr 27 23:51:04 MDT 2021 +One-line Summary: Bring in minor changes from the cesm2.2.0 release tag + +Purpose and description of changes +---------------------------------- + +Bring in the changes that went in the cesm2.2.0 release tag. +Get the CLM offline tools working as well as the tools testing. +Remove the finidat file for FATES as it was shown to be problematic +in the release testing. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? No +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +Issues fixed (include CTSM Issue #): + Fixes #1134 mkmapdata.sh is not working + Fixes #1128 missing compset + +Known bugs found since the previous tag (include issue #): + #1358 -- C isotope fields can have garbage values starting in ctsm5.1.dev008 + #1357 -- No output values in large lake gridcells in 0.5° resolution (hcru_hcru) + + +Notes of particular relevance for users +--------------------------------------- + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): + Add a new compset alias: I2000Clm50FatesCruRsGs + +Changes to the datasets (e.g., parameter, surface or initial files): + Remove finidat file setting for FATES becaues it sometimes caused problems. + +Notes of particular relevance for developers: +--------------------------------------------- + +Changes to tests or testing: + A couple of the tools tests were changed + + +Testing summary: regular +---------------- + + [PASS means all tests PASS; OK means tests PASS other than expected fails.] + + build-namelist tests (if CLMBuildNamelist.pm has changed): + + cheyenne - PASS + + tools-tests (test/tools) (if tools have been changed): + + cheyenne - PASS + + PTCLM testing (tools/shared/PTCLM/test): (if cime or cime_config are changed) + (PTCLM is being deprecated, so we only expect this to be done on occasion) + + cheyenne - OK + + python testing (if python code has changed; see instructions in python/README.md; document testing done): + + cheyenne -- PASS + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- OK + + any other testing (give details below): + + Ran mkmapdata.sh for 1-deg maps + +If the tag used for baseline comparisons was NOT the previous tag, note that here: + + +Answer changes +-------------- + +Changes answers relative to baseline: No bit-for-bit + +Other details +------------- + +List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): PTCLM + PTCLM to PTCLM2_20200902 + +Pull Requests that document the changes (include PR ids): #1179 +(https://github.com/ESCOMP/ctsm/pull) + + #1179 -- Bring in changes from release-cesm2.2.01 to main-development + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev037 Originator(s): slevis (Samuel Levis,SLevis Consulting,303-665-1310) Date: Fri Apr 23 10:06:32 MDT 2021 diff --git a/doc/ChangeSum b/doc/ChangeSum index 90e1fbbda2..5d0692ad68 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,44 +1,44 @@ Tag Who Date Summary ============================================================================================================================ -release-cesm2.2.01 erik 09/02/2020 Fix clm4_5 initial conditions - ctsm5.1.dev037 slevis 04/23/2021 Correct vertical interpolation in init_interp when soil thicknesses change - ctsm5.1.dev036 glemieux 04/21/2021 FATES tag update and snow occlusion of LAI fix - ctsm5.1.dev035 sacks 04/20/2021 Misc bfb enhancements and fixes - ctsm5.1.dev034 erik 04/19/2021 Bring in Arctic changes to LUNA from Leah Birch - ctsm5.1.dev033 mvertens 04/10/2021 Remove unnecessary settings of nextsw_cday - ctsm5.1.dev032 mvertens 04/10/2021 Fix bugs in co2 from atmosphere - ctsm5.1.dev031 jedwards 04/10/2021 Update externals and fixes for nuopc threading - ctsm5.1.dev030 erik 03/31/2021 New single column functionality for the NUOPC cap - ctsm5.1.dev029 mvertens 03/18/2021 Rework domain initialization for nuopc - ctsm5.1.dev028 swensosc 03/17/2021 Change limitation of top layer evaporation/sublimation - ctsm5.1.dev027 sacks 03/15/2021 Update cime and other externals; includes switch to pio2 - ctsm5.1.dev026 sacks 03/08/2021 Change f10 tests to use mg37 mask - ctsm5.1.dev025 sacks 02/23/2021 Refactor ozone code, and misc. small fixes - ctsm5.1.dev024 slevis 02/20/2021 Grid cell-level error check for H2O - ctsm5.1.dev023 erik 02/11/2021 Calculate leaf biomass for non-woody PFTS, and a few other small answer changes - ctsm5.1.dev022 glemieux 02/05/2021 Merge fates_main_api into ctsm master - ctsm5.1.dev021 erik 01/12/2021 Add option for biomass heat storage (BHS) to clm5_1 physics - ctsm5.1.dev020 erik 12/30/2020 Potential roundoff changes in preparation for bio-mass heat storage option - ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler - ctsm5.1.dev018 slevis 12/08/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize - ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file - ctsm5.1.dev016 multiple 11/17/2020 Updates for nuopc - ctsm5.1.dev015 sacks 11/13/2020 A few small fixes - ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes - ctsm5.1.dev013 jedwards 11/04/2020 Allow pnetcdf for vector history files - ctsm5.1.dev012 oleson/s 11/03/2020 Allow nlevgrnd < nlevurb - ctsm5.1.dev011 sacks 11/02/2020 Change CISM2%NOEVOLVE compsets to use SGLC; documentation updates - ctsm5.1.dev010 sacks/je 10/23/2020 Fix reading netcdf variable into a different data type - ctsm5.1.dev009 negins 10/21/2020 BFB changes for Perturbed Parameter Ensemble and Hydraulic redistribution ->>>>>>> ctsm5.1.dev037 - ctsm5.1.dev008 erik 10/07/2020 Two answer changes: Clm45/50/51 with crop, and for 2000Clm51 - ctsm5.1.dev007 sacks 10/06/2020 CNFire: btran2 fixes and general cleanup - ctsm5.1.dev006 sacks 10/03/2020 Call correct routine to calculate btran2 for CNFireLi2021 - ctsm5.1.dev005 sacks 10/02/2020 Answer changing bug fixes for clm51: fire and organic_frac_squared - ctsm5.1.dev004 oleson 09/30/2020 Improve robustness of onset and offset counters when changing dt - ctsm5.1.dev003 ivanderk 09/29/2020 Add capability for dynamic lakes - ctsm5.1.dev002 slevis 09/25/2020 Reduce duplication between caps - ctsm5.1.dev001 erik 09/23/2020 Start the clm5_1 physics series, with some changes to the fire model from Fang Li + ctsm5.1.dev038 erik 04/27/2021 Bring in minor changes from the cesm2.2.0 release tag +release-cesm2.2.01 erik 09/02/2020 Fix clm4_5 initial conditions + ctsm5.1.dev037 slevis 04/23/2021 Correct vertical interpolation in init_interp when soil thicknesses change + ctsm5.1.dev036 glemieux 04/21/2021 FATES tag update and snow occlusion of LAI fix + ctsm5.1.dev035 sacks 04/20/2021 Misc bfb enhancements and fixes + ctsm5.1.dev034 erik 04/19/2021 Bring in Arctic changes to LUNA from Leah Birch + ctsm5.1.dev033 mvertens 04/10/2021 Remove unnecessary settings of nextsw_cday + ctsm5.1.dev032 mvertens 04/10/2021 Fix bugs in co2 from atmosphere + ctsm5.1.dev031 jedwards 04/10/2021 Update externals and fixes for nuopc threading + ctsm5.1.dev030 erik 03/31/2021 New single column functionality for the NUOPC cap + ctsm5.1.dev029 mvertens 03/18/2021 Rework domain initialization for nuopc + ctsm5.1.dev028 swensosc 03/17/2021 Change limitation of top layer evaporation/sublimation + ctsm5.1.dev027 sacks 03/15/2021 Update cime and other externals; includes switch to pio2 + ctsm5.1.dev026 sacks 03/08/2021 Change f10 tests to use mg37 mask + ctsm5.1.dev025 sacks 02/23/2021 Refactor ozone code, and misc. small fixes + ctsm5.1.dev024 slevis 02/20/2021 Grid cell-level error check for H2O + ctsm5.1.dev023 erik 02/11/2021 Calculate leaf biomass for non-woody PFTS, and a few other small answer changes + ctsm5.1.dev022 glemieux 02/05/2021 Merge fates_main_api into ctsm master + ctsm5.1.dev021 erik 01/12/2021 Add option for biomass heat storage (BHS) to clm5_1 physics + ctsm5.1.dev020 erik 12/30/2020 Potential roundoff changes in preparation for bio-mass heat storage option + ctsm5.1.dev019 sacks 12/19/2020 Fix ndep from coupler + ctsm5.1.dev018 slevis 12/08/2020 Add ACTIVE (T/F) column to master hist fields table and alphabetize + ctsm5.1.dev017 slevis 11/17/2020 Write history fields master list to separate optional file + ctsm5.1.dev016 multiple 11/17/2020 Updates for nuopc + ctsm5.1.dev015 sacks 11/13/2020 A few small fixes + ctsm5.1.dev014 dll/oles 11/07/2020 Grass/crop snow burial fraction fix, and some other fixes + ctsm5.1.dev013 jedwards 11/04/2020 Allow pnetcdf for vector history files + ctsm5.1.dev012 oleson/s 11/03/2020 Allow nlevgrnd < nlevurb + ctsm5.1.dev011 sacks 11/02/2020 Change CISM2%NOEVOLVE compsets to use SGLC; documentation updates + ctsm5.1.dev010 sacks/je 10/23/2020 Fix reading netcdf variable into a different data type + ctsm5.1.dev009 negins 10/21/2020 BFB changes for Perturbed Parameter Ensemble and Hydraulic redistribution + ctsm5.1.dev008 erik 10/07/2020 Two answer changes: Clm45/50/51 with crop, and for 2000Clm51 + ctsm5.1.dev007 sacks 10/06/2020 CNFire: btran2 fixes and general cleanup + ctsm5.1.dev006 sacks 10/03/2020 Call correct routine to calculate btran2 for CNFireLi2021 + ctsm5.1.dev005 sacks 10/02/2020 Answer changing bug fixes for clm51: fire and organic_frac_squared + ctsm5.1.dev004 oleson 09/30/2020 Improve robustness of onset and offset counters when changing dt + ctsm5.1.dev003 ivanderk 09/29/2020 Add capability for dynamic lakes + ctsm5.1.dev002 slevis 09/25/2020 Reduce duplication between caps + ctsm5.1.dev001 erik 09/23/2020 Start the clm5_1 physics series, with some changes to the fire model from Fang Li ctsm1.0.dev113 negins 09/08/2020 Some bit-for-bit changes needed for the Perturbed Parameter Ensemble work ctsm1.0.dev112 sacks/ww 08/28/2020 Small changes to mksurfdata_map, singlept tool and run_sys_tests ctsm1.0.dev111 erik 08/28/2020 Compsets don't use 2014 for GSWP3 forcing, LUNA prevyr changed back